From: support Date: Thu, 8 Sep 2022 12:39:30 +0000 (+0000) Subject: Built motion from commit be5d5b00.|2.6.15 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=f2424c4504e4e8744b9c32fb0c428b4ab8381919;p=motion2.git Built motion from commit be5d5b00.|2.6.15 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 8f97c3d..0c3565f 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-08T10:06:45.064Z", + "time": "2022-09-08T12:31:24.474Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 7ab325f..29f77d4 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-09-08T10:06:45.064Z", + "time": "2022-09-08T12:31:24.474Z", "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 ad1db03..59da137 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 _0x7b17=['urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','TEXT'];(function(_0x47f615,_0x4d80d9){var _0x33e97e=function(_0x3d6c1){while(--_0x3d6c1){_0x47f615['push'](_0x47f615['shift']());}};_0x33e97e(++_0x4d80d9);}(_0x7b17,0x157));var _0x77b1=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x7b17[_0xa990b7];return _0x52c99c;};'use strict';var Sequelize=require(_0x77b1('0x0'));module[_0x77b1('0x1')]={'name':{'type':Sequelize[_0x77b1('0x2')],'get':function(_0x2060f6){return this[_0x77b1('0x3')]('action');}},'action':{'type':Sequelize[_0x77b1('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x77b1('0x5'),_0x77b1('0x6'),_0x77b1('0x7'),_0x77b1('0x8'),_0x77b1('0x9'),_0x77b1('0xa'),_0x77b1('0xb'),_0x77b1('0xc')]],'msg':_0x77b1('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x77b1('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x77b1('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x77b1('0xf')},'data4':{'type':Sequelize[_0x77b1('0x4')](0x1000),'comments':_0x77b1('0x10')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x77b1('0x4')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x77b1('0x11')],'comments':_0x77b1('0x12')}}; \ No newline at end of file +var _0xed66=['integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','getDataValue','action','STRING','contactManager'];(function(_0xf017b8,_0x143852){var _0x48bc01=function(_0x5eaa70){while(--_0x5eaa70){_0xf017b8['push'](_0xf017b8['shift']());}};_0x48bc01(++_0x143852);}(_0xed66,0xff));var _0x6ed6=function(_0x7ed1f,_0xe724d3){_0x7ed1f=_0x7ed1f-0x0;var _0x58d101=_0xed66[_0x7ed1f];return _0x58d101;};'use strict';var Sequelize=require(_0x6ed6('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x47211e){return this[_0x6ed6('0x1')](_0x6ed6('0x2'));}},'action':{'type':Sequelize[_0x6ed6('0x3')],'allowNull':![],'validate':{'isIn':{'args':[[_0x6ed6('0x4'),_0x6ed6('0x5'),_0x6ed6('0x6'),_0x6ed6('0x7'),_0x6ed6('0x8'),_0x6ed6('0x9'),_0x6ed6('0xa'),_0x6ed6('0xb')]],'msg':_0x6ed6('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x6ed6('0x3')](0x1000),'comment':_0x6ed6('0xd')},'data3':{'type':Sequelize[_0x6ed6('0x3')](0x1000),'comment':_0x6ed6('0xe')},'data4':{'type':Sequelize[_0x6ed6('0x3')](0x1000),'comments':_0x6ed6('0xf')},'data5':{'type':Sequelize[_0x6ed6('0x3')](0x1000),'comments':_0x6ed6('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x6ed6('0x11')},'data7':{'type':Sequelize[_0x6ed6('0x12')],'comments':_0x6ed6('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 7f3e647..56ea44e 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 _0x9f4d=['destroy','find','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','error','stack','name','send','update','body','Action','params','catch'];(function(_0x56eb2e,_0x4889dd){var _0x4a52ce=function(_0x1023f9){while(--_0x1023f9){_0x56eb2e['push'](_0x56eb2e['shift']());}};_0x4a52ce(++_0x4889dd);}(_0x9f4d,0x8f));var _0xd9f4=function(_0x16de68,_0x33d7ff){_0x16de68=_0x16de68-0x0;var _0x1c277e=_0x9f4d[_0x16de68];return _0x1c277e;};'use strict';var emlformat=require(_0xd9f4('0x0'));var rimraf=require(_0xd9f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9f4('0x2'));var rp=require('request-promise');var moment=require(_0xd9f4('0x3'));var BPromise=require(_0xd9f4('0x4'));var Mustache=require(_0xd9f4('0x5'));var util=require(_0xd9f4('0x6'));var path=require(_0xd9f4('0x7'));var sox=require(_0xd9f4('0x8'));var csv=require(_0xd9f4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9f4('0xa'));var _=require(_0xd9f4('0xb'));var squel=require('squel');var crypto=require(_0xd9f4('0xc'));var jsforce=require(_0xd9f4('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9f4('0xe'));var Papa=require(_0xd9f4('0xf'));var Redis=require(_0xd9f4('0x10'));var authService=require(_0xd9f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd9f4('0x12'));var hardwareService=require(_0xd9f4('0x13'));var logger=require(_0xd9f4('0x14'))(_0xd9f4('0x15'));var utils=require(_0xd9f4('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd9f4('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x874eda,_0x56ac21){_0x56ac21=_0x56ac21||0xcc;return function(_0x4f76d2){if(_0x4f76d2){return _0x874eda['sendStatus'](_0x56ac21);}return _0x874eda[_0xd9f4('0x18')](_0x56ac21)[_0xd9f4('0x19')]();};}function respondWithResult(_0x276cc9,_0x2db951){_0x2db951=_0x2db951||0xc8;return function(_0x46e6fd){if(_0x46e6fd){return _0x276cc9['status'](_0x2db951)[_0xd9f4('0x1a')](_0x46e6fd);}};}function respondWithFilteredResult(_0x1e1d20,_0x3b955b){return function(_0xfaa282){if(_0xfaa282){var _0x269f7d=typeof _0x3b955b['offset']===_0xd9f4('0x1b')&&typeof _0x3b955b[_0xd9f4('0x1c')]===_0xd9f4('0x1b');var _0x4815f5=_0xfaa282[_0xd9f4('0x1d')];var _0x2bbfe3=_0x269f7d?0x0:_0x3b955b[_0xd9f4('0x1e')];var _0x5eb015=_0x269f7d?_0xfaa282['count']:_0x3b955b[_0xd9f4('0x1e')]+_0x3b955b[_0xd9f4('0x1c')];var _0x5661b2;if(_0x5eb015>=_0x4815f5){_0x5eb015=_0x4815f5;_0x5661b2=0xc8;}else{_0x5661b2=0xce;}_0x1e1d20[_0xd9f4('0x18')](_0x5661b2);return _0x1e1d20[_0xd9f4('0x1f')]('Content-Range',_0x2bbfe3+'-'+_0x5eb015+'/'+_0x4815f5)[_0xd9f4('0x1a')](_0xfaa282);}return null;};}function patchUpdates(_0x2cf3b0){return function(_0x3756b5){try{jsonpatch[_0xd9f4('0x20')](_0x3756b5,_0x2cf3b0,!![]);}catch(_0x4fdaad){return BPromise[_0xd9f4('0x21')](_0x4fdaad);}return _0x3756b5[_0xd9f4('0x22')]();};}function saveUpdates(_0x246c0e,_0x5e3411){return function(_0xf2f308){if(_0xf2f308){return _0xf2f308['update'](_0x246c0e)['then'](function(_0x905eaa){return _0x905eaa;});}return null;};}function removeEntity(_0x51c424,_0x498b20){return function(_0x56a0da){if(_0x56a0da){return _0x56a0da['destroy']()[_0xd9f4('0x23')](function(){_0x51c424['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x358372,_0x525f35){return function(_0x541997){if(!_0x541997){_0x358372['sendStatus'](0x194);}return _0x541997;};}function handleError(_0x2fc749,_0x4a448c){_0x4a448c=_0x4a448c||0x1f4;return function(_0x2b81c5){logger[_0xd9f4('0x24')](_0x2b81c5[_0xd9f4('0x25')]);if(_0x2b81c5[_0xd9f4('0x26')]){delete _0x2b81c5[_0xd9f4('0x26')];}_0x2fc749[_0xd9f4('0x18')](_0x4a448c)[_0xd9f4('0x27')](_0x2b81c5);};}exports[_0xd9f4('0x28')]=function(_0x2ee209,_0x105bfe){if(_0x2ee209[_0xd9f4('0x29')]['id']){delete _0x2ee209[_0xd9f4('0x29')]['id'];}return db[_0xd9f4('0x2a')]['find']({'where':{'id':_0x2ee209[_0xd9f4('0x2b')]['id']}})[_0xd9f4('0x23')](handleEntityNotFound(_0x105bfe,null))[_0xd9f4('0x23')](saveUpdates(_0x2ee209[_0xd9f4('0x29')],null))[_0xd9f4('0x23')](respondWithResult(_0x105bfe,null))[_0xd9f4('0x2c')](handleError(_0x105bfe,null));};exports[_0xd9f4('0x2d')]=function(_0x557892,_0x41d568){return db[_0xd9f4('0x2a')][_0xd9f4('0x2e')]({'where':{'id':_0x557892[_0xd9f4('0x2b')]['id']}})[_0xd9f4('0x23')](handleEntityNotFound(_0x41d568,null))['then'](removeEntity(_0x41d568,null))[_0xd9f4('0x2c')](handleError(_0x41d568,null));}; \ No newline at end of file +var _0xc977=['../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','json','reject','save','update','end','error','stack','name','send','body','Action','params','then','catch','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api'];(function(_0x5bd6da,_0x3f7ac8){var _0x5e6b8=function(_0x10ecdd){while(--_0x10ecdd){_0x5bd6da['push'](_0x5bd6da['shift']());}};_0x5e6b8(++_0x3f7ac8);}(_0xc977,0x1a5));var _0x7c97=function(_0x499210,_0x325b29){_0x499210=_0x499210-0x0;var _0x2e153d=_0xc977[_0x499210];return _0x2e153d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c97('0x0'));var zipdir=require(_0x7c97('0x1'));var jsonpatch=require(_0x7c97('0x2'));var rp=require(_0x7c97('0x3'));var moment=require(_0x7c97('0x4'));var BPromise=require(_0x7c97('0x5'));var Mustache=require('mustache');var util=require(_0x7c97('0x6'));var path=require('path');var sox=require(_0x7c97('0x7'));var csv=require(_0x7c97('0x8'));var ejs=require(_0x7c97('0x9'));var fs=require('fs');var fs_extra=require(_0x7c97('0xa'));var _=require(_0x7c97('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c97('0xc'));var deskjs=require(_0x7c97('0xd'));var toCsv=require(_0x7c97('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7c97('0xe'));var qs=require(_0x7c97('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c97('0x10'));var logger=require(_0x7c97('0x11'))(_0x7c97('0x12'));var utils=require(_0x7c97('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x7c97('0x14'));var db=require(_0x7c97('0x15'))['db'];function respondWithStatusCode(_0x19bf92,_0x2d27e4){_0x2d27e4=_0x2d27e4||0xcc;return function(_0x53f52f){if(_0x53f52f){return _0x19bf92['sendStatus'](_0x2d27e4);}return _0x19bf92[_0x7c97('0x16')](_0x2d27e4)['end']();};}function respondWithResult(_0x2296af,_0x61eb5a){_0x61eb5a=_0x61eb5a||0xc8;return function(_0x200861){if(_0x200861){return _0x2296af[_0x7c97('0x16')](_0x61eb5a)['json'](_0x200861);}};}function respondWithFilteredResult(_0x2bb77f,_0xc99198){return function(_0x4ed8e6){if(_0x4ed8e6){var _0x5e92a3=typeof _0xc99198[_0x7c97('0x17')]===_0x7c97('0x18')&&typeof _0xc99198['limit']===_0x7c97('0x18');var _0xcc0458=_0x4ed8e6[_0x7c97('0x19')];var _0x11d524=_0x5e92a3?0x0:_0xc99198['offset'];var _0x252394=_0x5e92a3?_0x4ed8e6[_0x7c97('0x19')]:_0xc99198[_0x7c97('0x17')]+_0xc99198[_0x7c97('0x1a')];var _0x122f9d;if(_0x252394>=_0xcc0458){_0x252394=_0xcc0458;_0x122f9d=0xc8;}else{_0x122f9d=0xce;}_0x2bb77f[_0x7c97('0x16')](_0x122f9d);return _0x2bb77f[_0x7c97('0x1b')]('Content-Range',_0x11d524+'-'+_0x252394+'/'+_0xcc0458)[_0x7c97('0x1c')](_0x4ed8e6);}return null;};}function patchUpdates(_0xdad5cb){return function(_0x50ee5d){try{jsonpatch['apply'](_0x50ee5d,_0xdad5cb,!![]);}catch(_0x39035c){return BPromise[_0x7c97('0x1d')](_0x39035c);}return _0x50ee5d[_0x7c97('0x1e')]();};}function saveUpdates(_0x34aabd,_0x23cfb9){return function(_0x3c189a){if(_0x3c189a){return _0x3c189a[_0x7c97('0x1f')](_0x34aabd)['then'](function(_0x43d6f0){return _0x43d6f0;});}return null;};}function removeEntity(_0xfc25bb,_0x1e5560){return function(_0x5f30c4){if(_0x5f30c4){return _0x5f30c4['destroy']()['then'](function(){_0xfc25bb[_0x7c97('0x16')](0xcc)[_0x7c97('0x20')]();});}};}function handleEntityNotFound(_0x2da9aa,_0x4e4417){return function(_0x5e8368){if(!_0x5e8368){_0x2da9aa['sendStatus'](0x194);}return _0x5e8368;};}function handleError(_0x5e81dd,_0x823207){_0x823207=_0x823207||0x1f4;return function(_0x875ad3){logger[_0x7c97('0x21')](_0x875ad3[_0x7c97('0x22')]);if(_0x875ad3[_0x7c97('0x23')]){delete _0x875ad3['name'];}_0x5e81dd[_0x7c97('0x16')](_0x823207)[_0x7c97('0x24')](_0x875ad3);};}exports[_0x7c97('0x1f')]=function(_0x36dbb0,_0x8a32f2){if(_0x36dbb0['body']['id']){delete _0x36dbb0[_0x7c97('0x25')]['id'];}return db[_0x7c97('0x26')]['find']({'where':{'id':_0x36dbb0[_0x7c97('0x27')]['id']}})[_0x7c97('0x28')](handleEntityNotFound(_0x8a32f2,null))[_0x7c97('0x28')](saveUpdates(_0x36dbb0[_0x7c97('0x25')],null))[_0x7c97('0x28')](respondWithResult(_0x8a32f2,null))[_0x7c97('0x29')](handleError(_0x8a32f2,null));};exports[_0x7c97('0x2a')]=function(_0x34ae56,_0x445be6){return db[_0x7c97('0x26')][_0x7c97('0x2b')]({'where':{'id':_0x34ae56[_0x7c97('0x27')]['id']}})[_0x7c97('0x28')](handleEntityNotFound(_0x445be6,null))[_0x7c97('0x28')](removeEntity(_0x445be6,null))[_0x7c97('0x29')](handleError(_0x445be6,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 3e490c9..c2384e5 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 _0x26dc=['path','rimraf','../../config/environment','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x26dc,0x1b9));var _0xc26d=function(_0x506f65,_0x1b5e34){_0x506f65=_0x506f65-0x0;var _0xf57e51=_0x26dc[_0x506f65];return _0xf57e51;};'use strict';var _=require(_0xc26d('0x0'));var util=require(_0xc26d('0x1'));var logger=require(_0xc26d('0x2'))(_0xc26d('0x3'));var moment=require(_0xc26d('0x4'));var BPromise=require(_0xc26d('0x5'));var rp=require(_0xc26d('0x6'));var fs=require('fs');var path=require(_0xc26d('0x7'));var rimraf=require(_0xc26d('0x8'));var config=require(_0xc26d('0x9'));var attributes=require(_0xc26d('0xa'));module[_0xc26d('0xb')]=function(_0x430182,_0x500d97){return _0x430182[_0xc26d('0xc')]('Action',attributes,{'tableName':_0xc26d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd5d=['request-promise','path','rimraf','./action.attributes','define','Action','tools_actions','lodash','util','api','moment','bluebird'];(function(_0x23b092,_0x3d0e5e){var _0x1907ff=function(_0x4b2d9f){while(--_0x4b2d9f){_0x23b092['push'](_0x23b092['shift']());}};_0x1907ff(++_0x3d0e5e);}(_0xbd5d,0x13f));var _0xdbd5=function(_0x1c321c,_0x52d6b0){_0x1c321c=_0x1c321c-0x0;var _0xa79796=_0xbd5d[_0x1c321c];return _0xa79796;};'use strict';var _=require(_0xdbd5('0x0'));var util=require(_0xdbd5('0x1'));var logger=require('../../config/logger')(_0xdbd5('0x2'));var moment=require(_0xdbd5('0x3'));var BPromise=require(_0xdbd5('0x4'));var rp=require(_0xdbd5('0x5'));var fs=require('fs');var path=require(_0xdbd5('0x6'));var rimraf=require(_0xdbd5('0x7'));var config=require('../../config/environment');var attributes=require(_0xdbd5('0x8'));module['exports']=function(_0x70c326,_0x181c51){return _0x70c326[_0xdbd5('0x9')](_0xdbd5('0xa'),attributes,{'tableName':_0xdbd5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 1d0af03..272306a 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x3793c0,_0x3b8839){var _0x5273ae=function(_0x272e6d){while(--_0x272e6d){_0x3793c0['push'](_0x3793c0['shift']());}};_0x5273ae(++_0x3b8839);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xc4aa[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x7fbe=['request','then','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2067bd,_0x19a308){var _0x1bbf97=function(_0x340d43){while(--_0x340d43){_0x2067bd['push'](_0x2067bd['shift']());}};_0x1bbf97(++_0x19a308);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x32fe22,_0x5287d6){_0x32fe22=_0x32fe22-0x0;var _0x319ba7=_0x7fbe[_0x32fe22];return _0x319ba7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe7fb('0x0'));var BPromise=require(_0xe7fb('0x1'));var rs=require(_0xe7fb('0x2'));var fs=require('fs');var Redis=require(_0xe7fb('0x3'));var db=require(_0xe7fb('0x4'))['db'];var utils=require(_0xe7fb('0x5'));var logger=require(_0xe7fb('0x6'))(_0xe7fb('0x7'));var config=require(_0xe7fb('0x8'));var jayson=require(_0xe7fb('0x9'));var client=jayson[_0xe7fb('0xa')][_0xe7fb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){return client[_0xe7fb('0xc')](_0x24cd67,_0x5ad75b)[_0xe7fb('0xd')](function(_0x4ba197){logger['info'](_0xe7fb('0xe'),_0x1f943f,_0xe7fb('0xf'));logger[_0xe7fb('0x10')](_0xe7fb('0x11'),_0x1f943f,_0xe7fb('0xf'),JSON[_0xe7fb('0x12')](_0x4ba197));if(_0x4ba197[_0xe7fb('0x13')]){if(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x14')]===0x1f4){logger[_0xe7fb('0x13')](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);return _0x228f6b(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x4ba197[_0xe7fb('0x13')]['message']);return _0x213ebc(_0x4ba197[_0xe7fb('0x13')][_0xe7fb('0x15')]);}else{logger['info'](_0xe7fb('0xe'),_0x1f943f,'request\x20sent');_0x213ebc(_0x4ba197[_0xe7fb('0x16')][_0xe7fb('0x15')]);}})[_0xe7fb('0x17')](function(_0x17e8a8){logger['error'](_0xe7fb('0xe'),_0x1f943f,_0x17e8a8);_0x228f6b(_0x17e8a8);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 03176ca..4deea56 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 _0xab92=['destroy','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab92,0xfe));var _0x2ab9=function(_0x1a14a2,_0x4bd091){_0x1a14a2=_0x1a14a2-0x0;var _0x540c65=_0xab92[_0x1a14a2];return _0x540c65;};'use strict';var multer=require('multer');var util=require(_0x2ab9('0x0'));var path=require(_0x2ab9('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ab9('0x2'));var router=express[_0x2ab9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2ab9('0x4'));var config=require(_0x2ab9('0x5'));var controller=require(_0x2ab9('0x6'));router[_0x2ab9('0x7')]('/:id',auth[_0x2ab9('0x8')](),controller[_0x2ab9('0x9')]);router[_0x2ab9('0xa')](_0x2ab9('0xb'),auth['isAuthenticated'](),controller[_0x2ab9('0xc')]);module[_0x2ab9('0xd')]=router; \ No newline at end of file +var _0x5e8f=['../../config/environment','./action.controller','put','/:id','isAuthenticated','update','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5e8f,0x1ca));var _0xf5e8=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x5e8f[_0x533e4e];return _0x1f14bb;};'use strict';var multer=require(_0xf5e8('0x0'));var util=require(_0xf5e8('0x1'));var path=require('path');var timeout=require(_0xf5e8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf5e8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf5e8('0x4'));var controller=require(_0xf5e8('0x5'));router[_0xf5e8('0x6')](_0xf5e8('0x7'),auth[_0xf5e8('0x8')](),controller[_0xf5e8('0x9')]);router['delete'](_0xf5e8('0x7'),auth[_0xf5e8('0x8')](),controller[_0xf5e8('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 0b0eb8a..978280b 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 _0xe14b=['exports','STRING','TEXT','sequelize'];(function(_0x3cd6da,_0x55b35a){var _0x5e09c1=function(_0x1496da){while(--_0x1496da){_0x3cd6da['push'](_0x3cd6da['shift']());}};_0x5e09c1(++_0x55b35a);}(_0xe14b,0x93));var _0xbe14=function(_0x4404fe,_0x1b662a){_0x4404fe=_0x4404fe-0x0;var _0x16e391=_0xe14b[_0x4404fe];return _0x16e391;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0xbe14('0x2')]},'table':{'type':Sequelize[_0xbe14('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xbe14('0x3')]}}; \ No newline at end of file +var _0xabce=['exports','STRING','TEXT','sequelize'];(function(_0x2ecfb0,_0x2a18ef){var _0x260777=function(_0x5ba179){while(--_0x5ba179){_0x2ecfb0['push'](_0x2ecfb0['shift']());}};_0x260777(++_0x2a18ef);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0xeabc('0x0'));module[_0xeabc('0x1')]={'name':{'type':Sequelize[_0xeabc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xeabc('0x2')]},'parent':{'type':Sequelize[_0xeabc('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0xeabc('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index a4db8e8..fbbadcc 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 _0x275b=['Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','replace','format','groupBy','orderBy','order','DESC','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','COUNT(DISTINCT\x20%s)','DATE(%s)','ROUND(%s)','IS\x20NOT\x20NULL','value','function','web','fullPath','%s-%s.%s','randomstring','generate','output','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','COUNT(*)','run','runReport','AVG(%s)','rimraf','zip-dir','request-promise','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','CustomReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','pick','filter','where','merge','options','includeAll','include','rows','catch','params','create','body','role','user','get'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x275b,0x1a1));var _0xb275=function(_0xf6aa77,_0x50c3e9){_0xf6aa77=_0xf6aa77-0x0;var _0x2f4c1f=_0x275b[_0xf6aa77];return _0x2f4c1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb275('0x0'));var zipdir=require(_0xb275('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb275('0x2'));var moment=require(_0xb275('0x3'));var BPromise=require(_0xb275('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb275('0x5'));var sox=require(_0xb275('0x6'));var csv=require('to-csv');var ejs=require(_0xb275('0x7'));var fs=require('fs');var fs_extra=require(_0xb275('0x8'));var _=require(_0xb275('0x9'));var squel=require(_0xb275('0xa'));var crypto=require(_0xb275('0xb'));var jsforce=require(_0xb275('0xc'));var deskjs=require(_0xb275('0xd'));var toCsv=require(_0xb275('0xe'));var querystring=require(_0xb275('0xf'));var Papa=require(_0xb275('0x10'));var Redis=require(_0xb275('0x11'));var authService=require(_0xb275('0x12'));var qs=require(_0xb275('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb275('0x14'));var logger=require(_0xb275('0x15'))(_0xb275('0x16'));var utils=require(_0xb275('0x17'));var config=require(_0xb275('0x18'));var licenseUtil=require(_0xb275('0x19'));var db=require(_0xb275('0x1a'))['db'];var dbH=require(_0xb275('0x1a'))[_0xb275('0x1b')];function respondWithStatusCode(_0x748eea,_0x17bf47){_0x17bf47=_0x17bf47||0xcc;return function(_0x2a0a6d){if(_0x2a0a6d){return _0x748eea[_0xb275('0x1c')](_0x17bf47);}return _0x748eea[_0xb275('0x1d')](_0x17bf47)[_0xb275('0x1e')]();};}function respondWithResult(_0x508e3e,_0x1d3869){_0x1d3869=_0x1d3869||0xc8;return function(_0x33d114){if(_0x33d114){return _0x508e3e[_0xb275('0x1d')](_0x1d3869)[_0xb275('0x1f')](_0x33d114);}};}function respondWithFilteredResult(_0x2e5695,_0x4fb37d){return function(_0x3ac202){if(_0x3ac202){var _0x3ddc59=typeof _0x4fb37d[_0xb275('0x20')]===_0xb275('0x21')&&typeof _0x4fb37d[_0xb275('0x22')]===_0xb275('0x21');var _0x5e5020=_0x3ac202['count'];var _0x5d24a3=_0x3ddc59?0x0:_0x4fb37d[_0xb275('0x20')];var _0x2555f8=_0x3ddc59?_0x3ac202[_0xb275('0x23')]:_0x4fb37d[_0xb275('0x20')]+_0x4fb37d['limit'];var _0x13f944;if(_0x2555f8>=_0x5e5020){_0x2555f8=_0x5e5020;_0x13f944=0xc8;}else{_0x13f944=0xce;}_0x2e5695[_0xb275('0x1d')](_0x13f944);return _0x2e5695[_0xb275('0x24')](_0xb275('0x25'),_0x5d24a3+'-'+_0x2555f8+'/'+_0x5e5020)[_0xb275('0x1f')](_0x3ac202);}return null;};}function patchUpdates(_0x1c2828){return function(_0xccebe0){try{jsonpatch['apply'](_0xccebe0,_0x1c2828,!![]);}catch(_0x5ace6c){return BPromise[_0xb275('0x26')](_0x5ace6c);}return _0xccebe0[_0xb275('0x27')]();};}function saveUpdates(_0x4a05bb,_0x266ac5){return function(_0x269ba2){if(_0x269ba2){return _0x269ba2['update'](_0x4a05bb)[_0xb275('0x28')](function(_0x2e2a43){return _0x2e2a43;});}return null;};}function removeEntity(_0x528541,_0x25f789){return function(_0x1504d4){if(_0x1504d4){return _0x1504d4['destroy']()[_0xb275('0x28')](function(){var _0x17aabd=_0x1504d4['get']({'plain':!![]});var _0x414ae3=_0xb275('0x29');return db[_0xb275('0x2a')][_0xb275('0x2b')]({'where':{'type':_0x414ae3,'resourceId':_0x17aabd['id']}})[_0xb275('0x28')](function(){return _0x1504d4;});})['then'](function(){_0x528541[_0xb275('0x1d')](0xcc)[_0xb275('0x1e')]();});}};}function handleEntityNotFound(_0x572b8b,_0x4d5a2b){return function(_0x48e0ed){if(!_0x48e0ed){_0x572b8b[_0xb275('0x1c')](0x194);}return _0x48e0ed;};}function handleError(_0x52c6ed,_0x19f14e){_0x19f14e=_0x19f14e||0x1f4;return function(_0x57f60b){logger[_0xb275('0x2c')](_0x57f60b[_0xb275('0x2d')]);if(_0x57f60b[_0xb275('0x2e')]){delete _0x57f60b['name'];}_0x52c6ed[_0xb275('0x1d')](_0x19f14e)[_0xb275('0x2f')](_0x57f60b);};}exports['index']=function(_0xf735a4,_0x286e0d){var _0x550f8f={},_0x24a3e2={},_0x3a61ce={'count':0x0,'rows':[]};var _0x81c979=_[_0xb275('0x30')](db[_0xb275('0x31')][_0xb275('0x32')],function(_0x5b877c){return{'name':_0x5b877c[_0xb275('0x33')],'type':_0x5b877c[_0xb275('0x34')][_0xb275('0x35')]};});_0x24a3e2[_0xb275('0x36')]=_[_0xb275('0x30')](_0x81c979,_0xb275('0x2e'));_0x24a3e2[_0xb275('0x37')]=_[_0xb275('0x38')](_0xf735a4['query']);_0x24a3e2[_0xb275('0x39')]=_[_0xb275('0x3a')](_0x24a3e2[_0xb275('0x36')],_0x24a3e2[_0xb275('0x37')]);_0x550f8f[_0xb275('0x3b')]=_[_0xb275('0x3a')](_0x24a3e2[_0xb275('0x36')],qs[_0xb275('0x3c')](_0xf735a4['query'][_0xb275('0x3c')]));_0x550f8f[_0xb275('0x3b')]=_0x550f8f[_0xb275('0x3b')][_0xb275('0x3d')]?_0x550f8f['attributes']:_0x24a3e2[_0xb275('0x36')];if(!_0xf735a4[_0xb275('0x37')]['hasOwnProperty'](_0xb275('0x3e'))){_0x550f8f[_0xb275('0x22')]=qs[_0xb275('0x22')](_0xf735a4[_0xb275('0x37')][_0xb275('0x22')]);_0x550f8f[_0xb275('0x20')]=qs[_0xb275('0x20')](_0xf735a4[_0xb275('0x37')]['offset']);}_0x550f8f['order']=qs['sort'](_0xf735a4[_0xb275('0x37')]['sort']);_0x550f8f['where']=qs[_0xb275('0x39')](_[_0xb275('0x3f')](_0xf735a4[_0xb275('0x37')],_0x24a3e2[_0xb275('0x39')]),_0x81c979);if(_0xf735a4[_0xb275('0x37')][_0xb275('0x40')]){_0x550f8f[_0xb275('0x41')]=_[_0xb275('0x42')](_0x550f8f['where'],{'$or':_[_0xb275('0x30')](_0x81c979,function(_0x5deff2){if(_0x5deff2[_0xb275('0x34')]!=='VIRTUAL'){var _0x50f9b0={};_0x50f9b0[_0x5deff2[_0xb275('0x2e')]]={'$like':'%'+_0xf735a4[_0xb275('0x37')]['filter']+'%'};return _0x50f9b0;}})});}_0x550f8f=_[_0xb275('0x42')]({},_0x550f8f,_0xf735a4[_0xb275('0x43')]);var _0x958135={'where':_0x550f8f[_0xb275('0x41')]};return db['AnalyticCustomReport'][_0xb275('0x23')](_0x958135)[_0xb275('0x28')](function(_0x3e5bbe){_0x3a61ce[_0xb275('0x23')]=_0x3e5bbe;if(_0xf735a4['query'][_0xb275('0x44')]){_0x550f8f[_0xb275('0x45')]=[{'all':!![]}];}return db[_0xb275('0x31')]['findAll'](_0x550f8f);})[_0xb275('0x28')](function(_0x49f2d9){_0x3a61ce[_0xb275('0x46')]=_0x49f2d9;return _0x3a61ce;})[_0xb275('0x28')](respondWithFilteredResult(_0x286e0d,_0x550f8f))[_0xb275('0x47')](handleError(_0x286e0d,null));};exports['show']=function(_0x438692,_0x383927){var _0x12410c={'raw':![],'where':{'id':_0x438692[_0xb275('0x48')]['id']}},_0x5d9702={};_0x5d9702['model']=_['keys'](db[_0xb275('0x31')][_0xb275('0x32')]);_0x5d9702[_0xb275('0x37')]=_[_0xb275('0x38')](_0x438692[_0xb275('0x37')]);_0x5d9702[_0xb275('0x39')]=_[_0xb275('0x3a')](_0x5d9702['model'],_0x5d9702['query']);_0x12410c[_0xb275('0x3b')]=_[_0xb275('0x3a')](_0x5d9702[_0xb275('0x36')],qs[_0xb275('0x3c')](_0x438692[_0xb275('0x37')]['fields']));_0x12410c['attributes']=_0x12410c['attributes'][_0xb275('0x3d')]?_0x12410c[_0xb275('0x3b')]:_0x5d9702[_0xb275('0x36')];if(_0x438692[_0xb275('0x37')][_0xb275('0x44')]){_0x12410c[_0xb275('0x45')]=[{'all':!![]}];}_0x12410c=_[_0xb275('0x42')]({},_0x12410c,_0x438692[_0xb275('0x43')]);return db['AnalyticCustomReport']['find'](_0x12410c)[_0xb275('0x28')](handleEntityNotFound(_0x383927,null))[_0xb275('0x28')](respondWithResult(_0x383927,null))[_0xb275('0x47')](handleError(_0x383927,null));};exports[_0xb275('0x49')]=function(_0x3a98b0,_0x495515){return db['AnalyticCustomReport'][_0xb275('0x49')](_0x3a98b0[_0xb275('0x4a')],{})[_0xb275('0x28')](function(_0x55e843){var _0x51f0b9=_0x3a98b0['user']['get']({'plain':!![]});if(!_0x51f0b9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51f0b9[_0xb275('0x4b')]===_0xb275('0x4c')){var _0x3c682f=_0x55e843[_0xb275('0x4d')]({'plain':!![]});var _0x328d61=_0xb275('0x4e');return db[_0xb275('0x4f')][_0xb275('0x50')]({'where':{'name':_0x328d61,'userProfileId':_0x51f0b9[_0xb275('0x51')]},'raw':!![]})[_0xb275('0x28')](function(_0x5d8d6a){if(_0x5d8d6a&&_0x5d8d6a[_0xb275('0x52')]===0x0){return db[_0xb275('0x2a')]['create']({'name':_0x3c682f[_0xb275('0x2e')],'resourceId':_0x3c682f['id'],'type':'CustomReports','sectionId':_0x5d8d6a['id']},{})[_0xb275('0x28')](function(){return _0x55e843;});}else{return _0x55e843;}})['catch'](function(_0x31f81c){logger['error'](_0xb275('0x53'),_0x31f81c);throw _0x31f81c;});}return _0x55e843;})[_0xb275('0x28')](respondWithResult(_0x495515,0xc9))['catch'](handleError(_0x495515,null));};exports[_0xb275('0x54')]=function(_0x42af35,_0x5b7c58){if(_0x42af35[_0xb275('0x4a')]['id']){delete _0x42af35[_0xb275('0x4a')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x42af35[_0xb275('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b7c58,null))[_0xb275('0x28')](saveUpdates(_0x42af35[_0xb275('0x4a')],null))[_0xb275('0x28')](respondWithResult(_0x5b7c58,null))[_0xb275('0x47')](handleError(_0x5b7c58,null));};exports[_0xb275('0x2b')]=function(_0x2f2d99,_0x17ef29){return db[_0xb275('0x31')][_0xb275('0x50')]({'where':{'id':_0x2f2d99['params']['id']}})['then'](handleEntityNotFound(_0x17ef29,null))[_0xb275('0x28')](removeEntity(_0x17ef29,null))['catch'](handleError(_0x17ef29,null));};exports[_0xb275('0x55')]=function(_0xa92d0d,_0x4d156c){var _0x4f25f4=0xa;var _0x38b8f9=[_0xb275('0x56'),_0xb275('0x57'),_0xb275('0x58'),_0xb275('0x59')];var _0x46e5f2={'SUM':'SUM(%s)','COUNT':_0xb275('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xb275('0x5b'),'MIN':_0xb275('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb275('0x5d'),'GROUP_CONCAT ASC':_0xb275('0x5e'),'GROUP_CONCAT DESC':_0xb275('0x5f')};var _0x23d1f1={'SEC_TO_TIME':_0xb275('0x60'),'DATE':'DATE(%s)','HOUR':_0xb275('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb275('0x62')};var _0x2c4283=function(_0x292570){return!_['includes']([_0xb275('0x63'),'IS\x20NOT\x20NULL',_0xb275('0x64'),_0xb275('0x65')],_0x292570);};var _0x1939dc=function(_0x423627){if(!_0x423627||!_0x423627[_0xb275('0x66')][_0xb275('0x3d')]){return'';}for(var _0x4a07d2='(',_0x50eb39=0x0;_0x50eb39<_0x423627[_0xb275('0x66')][_0xb275('0x3d')];_0x50eb39+=0x1){_0x50eb39>0x0&&(_0x4a07d2+='\x20'+_0x423627[_0xb275('0x67')]+'\x20');_0x4a07d2+=_0x423627[_0xb275('0x66')][_0x50eb39][_0xb275('0x68')]?_0x1939dc(_0x423627['rules'][_0x50eb39]['group']):_0x423627[_0xb275('0x66')][_0x50eb39][_0xb275('0x69')]+'\x20'+_0x423627[_0xb275('0x66')][_0x50eb39][_0xb275('0x6a')]+(_0x2c4283(_0x423627[_0xb275('0x66')][_0x50eb39][_0xb275('0x6a')])?'\x20'+_0x423627[_0xb275('0x66')][_0x50eb39]['value']:'');}return _0x4a07d2+')';};var _0x575a0a={'where':{'id':_0xa92d0d['params']['id']}},_0x5913a0,_0x108d96,_0x524d80,_0x40b7b7,_0x491037;_0x575a0a=_['merge']({},_0x575a0a,_0xa92d0d['options']);return db[_0xb275('0x31')][_0xb275('0x50')](_0x575a0a)[_0xb275('0x28')](function(_0x312bc5){if(_0x312bc5){_0x5913a0=_0x312bc5;return _0x312bc5[_0xb275('0x6b')]();}return null;})['then'](function(_0x49a33f){if(_0x49a33f){if(!_0x49a33f['length']){throw new db[(_0xb275('0x6c'))][(_0xb275('0x6d'))](_0xb275('0x6e'),0x193);}_0x108d96=_0x49a33f;return db[_0xb275('0x6f')][_0xb275('0x70')]({'raw':!![]});}return null;})[_0xb275('0x28')](function(_0x40a337){if(_0x40a337){_0x524d80=_[_0xb275('0x71')](_0x40a337,'id');var _0x4abd37;var _0x434462=squel[_0xb275('0x72')]();_0x434462[_0xb275('0x73')](_0x5913a0[_0xb275('0x74')]);for(var _0x1b54d0=0x0;_0x1b54d0<_0x108d96[_0xb275('0x3d')];_0x1b54d0+=0x1){_0x4abd37=_0x108d96[_0x1b54d0][_0xb275('0x75')]?_0x524d80[_0x108d96[_0x1b54d0]['MetricId']][_0xb275('0x76')]:_0x108d96[_0x1b54d0][_0xb275('0x69')];_0x4abd37=_0x108d96[_0x1b54d0]['function']?_[_0xb275('0x77')](_0x46e5f2[_0x108d96[_0x1b54d0]['function']],'%s',_0x4abd37):_0x4abd37;_0x4abd37=_0x108d96[_0x1b54d0][_0xb275('0x78')]?_[_0xb275('0x77')](_0x23d1f1[_0x108d96[_0x1b54d0][_0xb275('0x78')]],'%s',_0x4abd37):_0x4abd37;if(_0x108d96[_0x1b54d0][_0xb275('0x79')]){_0x434462[_0xb275('0x68')](_0x4abd37);}_0x108d96[_0x1b54d0][_0xb275('0x7a')]&&_0x434462[_0xb275('0x7b')](_0x4abd37,_0x108d96[_0x1b54d0][_0xb275('0x7a')]===_0xb275('0x7c')?![]:!![]);_0x434462[_0xb275('0x69')](_0x4abd37,_0x108d96[_0x1b54d0]['alias']||_0x4abd37);}if(_0x5913a0[_0xb275('0x7d')]){_0x5913a0['joins']=JSON[_0xb275('0x7e')](_0x5913a0[_0xb275('0x7d')]);for(var _0x32177c=0x0;_0x32177c<_0x5913a0[_0xb275('0x7d')][_0xb275('0x3d')];_0x32177c+=0x1){if(_0x5913a0[_0xb275('0x7d')][_0x32177c]['type']&&_[_0xb275('0x7f')](_0x38b8f9,_0x5913a0[_0xb275('0x7d')][_0x32177c]['type'])&&_0x5913a0[_0xb275('0x7d')][_0x32177c][_0xb275('0x80')]&&_0x5913a0[_0xb275('0x7d')][_0x32177c]['foreignTable']&&_0x5913a0[_0xb275('0x7d')][_0x32177c]['foreignKey']){_0x434462[_0x5913a0[_0xb275('0x7d')][_0x32177c][_0xb275('0x34')]](_0x5913a0[_0xb275('0x7d')][_0x32177c][_0xb275('0x81')],null,util['format'](_0xb275('0x82'),_0x5913a0[_0xb275('0x74')],_0x5913a0[_0xb275('0x7d')][_0x32177c]['parentKey'],_0x5913a0[_0xb275('0x7d')][_0x32177c][_0xb275('0x81')],_0x5913a0[_0xb275('0x7d')][_0x32177c][_0xb275('0x83')]));}}}if(_0x5913a0[_0xb275('0x84')]){_0x5913a0[_0xb275('0x84')]=JSON['parse'](_0x5913a0[_0xb275('0x84')]);_0x434462[_0xb275('0x41')](_0x1939dc(_0x5913a0[_0xb275('0x84')][_0xb275('0x68')]));}_0x491037=_0x434462[_0xb275('0x85')]();_0x434462[_0xb275('0x22')](_0x4f25f4);_0x434462['offset'](0x0);logger[_0xb275('0x86')](_0xb275('0x87'),_0x434462[_0xb275('0x88')]());return dbH[_0xb275('0x89')]['query'](_0x434462[_0xb275('0x88')](),{'type':dbH['sequelize'][_0xb275('0x8a')][_0xb275('0x8b')]});}})[_0xb275('0x28')](respondWithResult(_0x4d156c,null))['catch'](handleError(_0x4d156c,null));};function runReport(_0x3eeb42,_0x833581,_0x3154c4){var _0x15c25c=_0x833581[_0xb275('0x2e')];var _0xa6055e=0xa;var _0x576e54=[_0xb275('0x56'),_0xb275('0x57'),_0xb275('0x58'),_0xb275('0x59')];var _0x4bb2be={'SUM':'SUM(%s)','COUNT':_0xb275('0x5a'),'COUNT DISTINCT':_0xb275('0x8c'),'MAX':_0xb275('0x5b'),'MIN':_0xb275('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xb275('0x5d'),'GROUP_CONCAT ASC':_0xb275('0x5e'),'GROUP_CONCAT DESC':_0xb275('0x5f')};var _0x23ed9d={'SEC_TO_TIME':_0xb275('0x60'),'DATE':_0xb275('0x8d'),'HOUR':'HOUR(%s)','ROUND':_0xb275('0x8e'),'UNIX_TIMESTAMP':_0xb275('0x62')};var _0x445274=function(_0x41765c){return!_[_0xb275('0x7f')]([_0xb275('0x63'),_0xb275('0x8f'),_0xb275('0x64'),_0xb275('0x65')],_0x41765c);};var _0x310cbc=function(_0x25968c){if(!_0x25968c||!_0x25968c['rules']['length']){return'';}for(var _0x3e35ca='(',_0x4e7cb8=0x0;_0x4e7cb8<_0x25968c['rules'][_0xb275('0x3d')];_0x4e7cb8+=0x1){_0x4e7cb8>0x0&&(_0x3e35ca+='\x20'+_0x25968c[_0xb275('0x67')]+'\x20');_0x3e35ca+=_0x25968c[_0xb275('0x66')][_0x4e7cb8][_0xb275('0x68')]?_0x310cbc(_0x25968c['rules'][_0x4e7cb8][_0xb275('0x68')]):_0x25968c[_0xb275('0x66')][_0x4e7cb8][_0xb275('0x69')]+'\x20'+_0x25968c[_0xb275('0x66')][_0x4e7cb8][_0xb275('0x6a')]+(_0x445274(_0x25968c['rules'][_0x4e7cb8]['condition'])?'\x20'+_0x25968c[_0xb275('0x66')][_0x4e7cb8][_0xb275('0x90')]:'');}return _0x3e35ca+')';};var _0x400d73={'where':{'id':_0x3eeb42['id']}},_0x41a4e3,_0x43d7fe,_0x335cc3,_0x5e58fc,_0x3b7a67;_0x400d73=_['merge']({},_0x400d73,_0x3154c4);return db[_0xb275('0x31')][_0xb275('0x50')](_0x400d73)[_0xb275('0x28')](function(_0xfb7640){if(_0xfb7640){_0x41a4e3=_0xfb7640;return _0xfb7640[_0xb275('0x6b')]();}return null;})[_0xb275('0x28')](function(_0x25c169){if(_0x25c169){if(!_0x25c169[_0xb275('0x3d')]){throw new db['Sequelize']['ValidationErrorItem'](_0xb275('0x6e'),0x193);}_0x43d7fe=_0x25c169;return db[_0xb275('0x6f')][_0xb275('0x70')]({'raw':!![]});}return null;})[_0xb275('0x28')](function(_0x52231c){if(_0x52231c){_0x335cc3=_['keyBy'](_0x52231c,'id');var _0x1fe172;var _0x2f94bc=squel['select']();_0x2f94bc[_0xb275('0x73')](_0x41a4e3[_0xb275('0x74')]);for(var _0x5e17b2=0x0;_0x5e17b2<_0x43d7fe['length'];_0x5e17b2+=0x1){_0x1fe172=_0x43d7fe[_0x5e17b2][_0xb275('0x75')]?_0x335cc3[_0x43d7fe[_0x5e17b2][_0xb275('0x75')]][_0xb275('0x76')]:_0x43d7fe[_0x5e17b2][_0xb275('0x69')];_0x1fe172=_0x43d7fe[_0x5e17b2][_0xb275('0x91')]?_[_0xb275('0x77')](_0x4bb2be[_0x43d7fe[_0x5e17b2][_0xb275('0x91')]],'%s',_0x1fe172):_0x1fe172;_0x1fe172=_0x43d7fe[_0x5e17b2]['format']?_[_0xb275('0x77')](_0x23ed9d[_0x43d7fe[_0x5e17b2]['format']],'%s',_0x1fe172):_0x1fe172;if(_0x43d7fe[_0x5e17b2][_0xb275('0x79')]){_0x2f94bc[_0xb275('0x68')](_0x1fe172);}_0x43d7fe[_0x5e17b2][_0xb275('0x7a')]&&_0x2f94bc[_0xb275('0x7b')](_0x1fe172,_0x43d7fe[_0x5e17b2]['orderBy']===_0xb275('0x7c')?![]:!![]);_0x2f94bc[_0xb275('0x69')](_0x1fe172,_0x43d7fe[_0x5e17b2]['alias']||_0x1fe172);}if(_0x41a4e3[_0xb275('0x7d')]){_0x41a4e3[_0xb275('0x7d')]=JSON[_0xb275('0x7e')](_0x41a4e3[_0xb275('0x7d')]);for(var _0xaa5d2d=0x0;_0xaa5d2d<_0x41a4e3[_0xb275('0x7d')][_0xb275('0x3d')];_0xaa5d2d+=0x1){if(_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x34')]&&_[_0xb275('0x7f')](_0x576e54,_0x41a4e3['joins'][_0xaa5d2d]['type'])&&_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x80')]&&_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d]['foreignTable']&&_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x83')]){_0x2f94bc[_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x34')]](_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x81')],null,util[_0xb275('0x78')]('%s.%s\x20=\x20%s.%s',_0x41a4e3[_0xb275('0x74')],_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x80')],_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d][_0xb275('0x81')],_0x41a4e3[_0xb275('0x7d')][_0xaa5d2d]['foreignKey']));}}}if(_0x41a4e3[_0xb275('0x84')]){_0x41a4e3[_0xb275('0x84')]=JSON['parse'](_0x41a4e3[_0xb275('0x84')]);_0x2f94bc['where'](_0x310cbc(_0x41a4e3['conditions'][_0xb275('0x68')]));}_0x3b7a67=_0x2f94bc['clone']();_0x2f94bc['limit'](_0xa6055e);_0x2f94bc[_0xb275('0x20')](0x0);return;}})['then'](function(){if(_0x833581['output']===_0xb275('0x92')){return null;}var _0x254f1e=_['merge'](_0x833581,{'name':_0x833581[_0xb275('0x93')]||_0x833581[_0xb275('0x2e')]||_0x41a4e3[_0xb275('0x2e')],'basename':_0x15c25c,'savename':util[_0xb275('0x78')](_0xb275('0x94'),_0x833581[_0xb275('0x2e')]||_0x41a4e3[_0xb275('0x2e')],require(_0xb275('0x95'))[_0xb275('0x96')](0x4),_0x833581[_0xb275('0x97')]||'csv'),'reportId':_0x41a4e3['id'],'reportType':'custom'});return db[_0xb275('0x98')][_0xb275('0x49')](_0x254f1e,{'raw':!![]});})['then'](function(_0x1c4211){if(_0x41a4e3[_0xb275('0x74')]==='cdr'){_0x3b7a67[_0xb275('0x41')](_0x41a4e3[_0xb275('0x74')]+_0xb275('0x99'),_0x833581[_0xb275('0x9a')],_0x833581[_0xb275('0x9b')]);}else{_0x3b7a67[_0xb275('0x41')](_0x41a4e3[_0xb275('0x74')]+_0xb275('0x9c'),_0x833581['startDate'],_0x833581[_0xb275('0x9b')]);}if(_0x1c4211){logger[_0xb275('0x9d')](_0xb275('0x9e'),_0x3b7a67[_0xb275('0x88')]());require(_0xb275('0x9f'))[_0xb275('0xa0')](path[_0xb275('0x56')](__dirname,'../../components/export/',_0x1c4211['output']),[_0x1c4211['id'],_0x3b7a67['toString'](),path['join'](__dirname,'../../files/reports',_0x1c4211['savename']),_0x15c25c]);return _0x1c4211;}else{var _0x537c13=squel['select']();_0x537c13[_0xb275('0x73')]('('+_0x3b7a67[_0xb275('0x88')]()+')','countTable');_0x537c13['field'](_0xb275('0xa1'),'count');_0x3b7a67[_0xb275('0x22')](_0x833581[_0xb275('0x22')]||_0xa6055e);_0x3b7a67[_0xb275('0x20')](_0x833581[_0xb275('0x20')]||0x0);return dbH['sequelize'][_0xb275('0x37')](_0x537c13[_0xb275('0x88')](),{'type':dbH[_0xb275('0x89')][_0xb275('0x8a')][_0xb275('0x8b')]})['then'](function(_0x10b427){if(!_0x10b427['length']){_0x5e58fc=0x0;}else{_0x5e58fc=_0x10b427[0x0][_0xb275('0x23')]||0x0;}return dbH[_0xb275('0x89')][_0xb275('0x37')](_0x3b7a67[_0xb275('0x88')](),{'type':dbH[_0xb275('0x89')][_0xb275('0x8a')][_0xb275('0x8b')]});})['then'](function(_0x1cdb59){return{'rows':_0x1cdb59||[],'count':_0x5e58fc};});}});}exports[_0xb275('0xa2')]=function(_0x33b45c,_0x55ebce){return runReport(_0x33b45c['params'],_0x33b45c[_0xb275('0x37')],_0x33b45c[_0xb275('0x43')])[_0xb275('0x28')](respondWithResult(_0x55ebce,null))[_0xb275('0x47')](handleError(_0x55ebce,null));};exports[_0xb275('0xa3')]=runReport;exports['query']=function(_0x4fa7d3,_0x3fa985){var _0x1ef908=0xa;var _0x1e0717=[_0xb275('0x56'),_0xb275('0x57'),_0xb275('0x58'),'cross_join'];var _0x4bd0e0={'SUM':'SUM(%s)','COUNT':_0xb275('0x5a'),'COUNT DISTINCT':_0xb275('0x8c'),'MAX':_0xb275('0x5b'),'MIN':'MIN(%s)','AVG':_0xb275('0xa4'),'GROUP_CONCAT':_0xb275('0x5d'),'GROUP_CONCAT ASC':_0xb275('0x5e'),'GROUP_CONCAT DESC':_0xb275('0x5f')};var _0x510292={'SEC_TO_TIME':_0xb275('0x60'),'DATE':_0xb275('0x8d'),'HOUR':_0xb275('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xb275('0x62')};var _0x4977e6=function(_0x4035ff){return!_['includes']([_0xb275('0x63'),_0xb275('0x8f'),_0xb275('0x64'),_0xb275('0x65')],_0x4035ff);};var _0x322a73=function(_0x516bab){if(!_0x516bab||!_0x516bab['rules'][_0xb275('0x3d')]){return'';}for(var _0x1ad869='(',_0x12603b=0x0;_0x12603b<_0x516bab['rules']['length'];_0x12603b+=0x1){_0x12603b>0x0&&(_0x1ad869+='\x20'+_0x516bab[_0xb275('0x67')]+'\x20');_0x1ad869+=_0x516bab['rules'][_0x12603b][_0xb275('0x68')]?_0x322a73(_0x516bab['rules'][_0x12603b][_0xb275('0x68')]):_0x516bab[_0xb275('0x66')][_0x12603b][_0xb275('0x69')]+'\x20'+_0x516bab['rules'][_0x12603b][_0xb275('0x6a')]+(_0x4977e6(_0x516bab['rules'][_0x12603b][_0xb275('0x6a')])?'\x20'+_0x516bab[_0xb275('0x66')][_0x12603b][_0xb275('0x90')]:'');}return _0x1ad869+')';};var _0x2d3dd5={'where':{'id':_0x4fa7d3[_0xb275('0x48')]['id']}},_0x5bf7d0,_0x556324,_0x1b9d68,_0x5c9e36,_0x29bc91;_0x2d3dd5=_['merge']({},_0x2d3dd5,_0x4fa7d3[_0xb275('0x43')]);return db[_0xb275('0x31')][_0xb275('0x50')](_0x2d3dd5)['then'](function(_0x32d3ad){if(_0x32d3ad){_0x5bf7d0=_0x32d3ad;return _0x32d3ad['getFields']();}return null;})['then'](function(_0x5bcb3a){if(_0x5bcb3a){if(!_0x5bcb3a['length']){throw new db['Sequelize'][(_0xb275('0x6d'))](_0xb275('0x6e'),0x193);}_0x556324=_0x5bcb3a;return db['AnalyticMetric'][_0xb275('0x70')]({'raw':!![]});}return null;})[_0xb275('0x28')](function(_0x51b43b){if(_0x51b43b){_0x1b9d68=_[_0xb275('0x71')](_0x51b43b,'id');var _0x1d2a1b;var _0x3ec3e0=squel[_0xb275('0x72')]();_0x3ec3e0['from'](_0x5bf7d0[_0xb275('0x74')]);for(var _0x383b3b=0x0;_0x383b3b<_0x556324[_0xb275('0x3d')];_0x383b3b+=0x1){_0x1d2a1b=_0x556324[_0x383b3b]['MetricId']?_0x1b9d68[_0x556324[_0x383b3b]['MetricId']][_0xb275('0x76')]:_0x556324[_0x383b3b]['field'];_0x1d2a1b=_0x556324[_0x383b3b][_0xb275('0x91')]?_[_0xb275('0x77')](_0x4bd0e0[_0x556324[_0x383b3b]['function']],'%s',_0x1d2a1b):_0x1d2a1b;_0x1d2a1b=_0x556324[_0x383b3b][_0xb275('0x78')]?_[_0xb275('0x77')](_0x510292[_0x556324[_0x383b3b][_0xb275('0x78')]],'%s',_0x1d2a1b):_0x1d2a1b;if(_0x556324[_0x383b3b][_0xb275('0x79')]){_0x3ec3e0['group'](_0x1d2a1b);}_0x556324[_0x383b3b][_0xb275('0x7a')]&&_0x3ec3e0[_0xb275('0x7b')](_0x1d2a1b,_0x556324[_0x383b3b][_0xb275('0x7a')]==='DESC'?![]:!![]);_0x3ec3e0[_0xb275('0x69')](_0x1d2a1b,_0x556324[_0x383b3b]['alias']||_0x1d2a1b);}if(_0x5bf7d0[_0xb275('0x7d')]){_0x5bf7d0['joins']=JSON['parse'](_0x5bf7d0[_0xb275('0x7d')]);for(var _0x59332c=0x0;_0x59332c<_0x5bf7d0[_0xb275('0x7d')][_0xb275('0x3d')];_0x59332c+=0x1){if(_0x5bf7d0[_0xb275('0x7d')][_0x59332c][_0xb275('0x34')]&&_[_0xb275('0x7f')](_0x1e0717,_0x5bf7d0[_0xb275('0x7d')][_0x59332c]['type'])&&_0x5bf7d0[_0xb275('0x7d')][_0x59332c][_0xb275('0x80')]&&_0x5bf7d0[_0xb275('0x7d')][_0x59332c][_0xb275('0x81')]&&_0x5bf7d0[_0xb275('0x7d')][_0x59332c][_0xb275('0x83')]){_0x3ec3e0[_0x5bf7d0['joins'][_0x59332c]['type']](_0x5bf7d0[_0xb275('0x7d')][_0x59332c][_0xb275('0x81')],null,util[_0xb275('0x78')](_0xb275('0x82'),_0x5bf7d0[_0xb275('0x74')],_0x5bf7d0[_0xb275('0x7d')][_0x59332c][_0xb275('0x80')],_0x5bf7d0['joins'][_0x59332c][_0xb275('0x81')],_0x5bf7d0[_0xb275('0x7d')][_0x59332c]['foreignKey']));}}}if(_0x5bf7d0[_0xb275('0x84')]){_0x5bf7d0['conditions']=JSON[_0xb275('0x7e')](_0x5bf7d0[_0xb275('0x84')]);_0x3ec3e0[_0xb275('0x41')](_0x322a73(_0x5bf7d0[_0xb275('0x84')][_0xb275('0x68')]));}_0x29bc91=_0x3ec3e0[_0xb275('0x85')]();_0x3ec3e0['limit'](_0x1ef908);_0x3ec3e0[_0xb275('0x20')](0x0);logger[_0xb275('0x86')]('Limited\x20Query:',_0x3ec3e0['toString']());return dbH[_0xb275('0x89')][_0xb275('0x37')](_0x3ec3e0['toString'](),{'type':dbH[_0xb275('0x89')][_0xb275('0x8a')][_0xb275('0x8b')]});}})[_0xb275('0x28')](function(){return{'sql':_0x29bc91[_0xb275('0x88')]()};})['then'](respondWithResult(_0x3fa985,null))[_0xb275('0x47')](handleError(_0x3fa985,null));}; \ No newline at end of file +var _0x00c2=['sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','dbH','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomReports','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','find','catch','create','body','user','Reports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','from','table','function','format','groupBy','order','orderBy','DESC','field','joins','foreignTable','foreignKey','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SELECT','join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','select','MetricId','metric','replace','alias','%s.%s\x20=\x20%s.%s','output','fullPath','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','run','IS\x20NULL','keyBy','parentKey','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path'];(function(_0x3098d4,_0x3f414b){var _0x12987b=function(_0x552bdb){while(--_0x552bdb){_0x3098d4['push'](_0x3098d4['shift']());}};_0x12987b(++_0x3f414b);}(_0x00c2,0x146));var _0x200c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00c2[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x200c('0x0'));var zipdir=require(_0x200c('0x1'));var jsonpatch=require(_0x200c('0x2'));var rp=require(_0x200c('0x3'));var moment=require(_0x200c('0x4'));var BPromise=require(_0x200c('0x5'));var Mustache=require('mustache');var util=require(_0x200c('0x6'));var path=require(_0x200c('0x7'));var sox=require(_0x200c('0x8'));var csv=require(_0x200c('0x9'));var ejs=require(_0x200c('0xa'));var fs=require('fs');var fs_extra=require(_0x200c('0xb'));var _=require(_0x200c('0xc'));var squel=require(_0x200c('0xd'));var crypto=require('crypto');var jsforce=require(_0x200c('0xe'));var deskjs=require(_0x200c('0xf'));var toCsv=require(_0x200c('0x9'));var querystring=require(_0x200c('0x10'));var Papa=require('papaparse');var Redis=require(_0x200c('0x11'));var authService=require(_0x200c('0x12'));var qs=require(_0x200c('0x13'));var as=require(_0x200c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x200c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x200c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x200c('0x17'))[_0x200c('0x18')];function respondWithStatusCode(_0x42d0fa,_0x5594c1){_0x5594c1=_0x5594c1||0xcc;return function(_0x30937a){if(_0x30937a){return _0x42d0fa[_0x200c('0x19')](_0x5594c1);}return _0x42d0fa[_0x200c('0x1a')](_0x5594c1)[_0x200c('0x1b')]();};}function respondWithResult(_0x11d42f,_0x5b8537){_0x5b8537=_0x5b8537||0xc8;return function(_0x159de7){if(_0x159de7){return _0x11d42f['status'](_0x5b8537)[_0x200c('0x1c')](_0x159de7);}};}function respondWithFilteredResult(_0x142488,_0x30184d){return function(_0x51daa1){if(_0x51daa1){var _0x833282=typeof _0x30184d['offset']==='undefined'&&typeof _0x30184d['limit']===_0x200c('0x1d');var _0x1a64d1=_0x51daa1[_0x200c('0x1e')];var _0x2f2ecd=_0x833282?0x0:_0x30184d[_0x200c('0x1f')];var _0x2365a8=_0x833282?_0x51daa1[_0x200c('0x1e')]:_0x30184d[_0x200c('0x1f')]+_0x30184d[_0x200c('0x20')];var _0x27f192;if(_0x2365a8>=_0x1a64d1){_0x2365a8=_0x1a64d1;_0x27f192=0xc8;}else{_0x27f192=0xce;}_0x142488['status'](_0x27f192);return _0x142488[_0x200c('0x21')](_0x200c('0x22'),_0x2f2ecd+'-'+_0x2365a8+'/'+_0x1a64d1)['json'](_0x51daa1);}return null;};}function patchUpdates(_0x36bdd0){return function(_0x39d8da){try{jsonpatch[_0x200c('0x23')](_0x39d8da,_0x36bdd0,!![]);}catch(_0x18b911){return BPromise[_0x200c('0x24')](_0x18b911);}return _0x39d8da[_0x200c('0x25')]();};}function saveUpdates(_0x421efe,_0x3c172d){return function(_0x5779b7){if(_0x5779b7){return _0x5779b7[_0x200c('0x26')](_0x421efe)[_0x200c('0x27')](function(_0x1f2b49){return _0x1f2b49;});}return null;};}function removeEntity(_0x41618a,_0x574a3e){return function(_0x366ad1){if(_0x366ad1){return _0x366ad1[_0x200c('0x28')]()[_0x200c('0x27')](function(){var _0x4b94c6=_0x366ad1[_0x200c('0x29')]({'plain':!![]});var _0x3e6d4a=_0x200c('0x2a');return db['UserProfileResource'][_0x200c('0x28')]({'where':{'type':_0x3e6d4a,'resourceId':_0x4b94c6['id']}})[_0x200c('0x27')](function(){return _0x366ad1;});})[_0x200c('0x27')](function(){_0x41618a[_0x200c('0x1a')](0xcc)[_0x200c('0x1b')]();});}};}function handleEntityNotFound(_0x574896,_0x39ac39){return function(_0x3d4d2d){if(!_0x3d4d2d){_0x574896[_0x200c('0x19')](0x194);}return _0x3d4d2d;};}function handleError(_0x10b8b4,_0x214ed7){_0x214ed7=_0x214ed7||0x1f4;return function(_0x3cef5e){logger[_0x200c('0x2b')](_0x3cef5e[_0x200c('0x2c')]);if(_0x3cef5e[_0x200c('0x2d')]){delete _0x3cef5e[_0x200c('0x2d')];}_0x10b8b4[_0x200c('0x1a')](_0x214ed7)[_0x200c('0x2e')](_0x3cef5e);};}exports[_0x200c('0x2f')]=function(_0x1112a4,_0x2ed842){var _0x2f9d39={},_0x45074a={},_0x55ace6={'count':0x0,'rows':[]};var _0x40c201=_[_0x200c('0x30')](db[_0x200c('0x31')][_0x200c('0x32')],function(_0x3558d5){return{'name':_0x3558d5[_0x200c('0x33')],'type':_0x3558d5[_0x200c('0x34')][_0x200c('0x35')]};});_0x45074a['model']=_[_0x200c('0x30')](_0x40c201,'name');_0x45074a[_0x200c('0x36')]=_[_0x200c('0x37')](_0x1112a4['query']);_0x45074a[_0x200c('0x38')]=_[_0x200c('0x39')](_0x45074a['model'],_0x45074a[_0x200c('0x36')]);_0x2f9d39[_0x200c('0x3a')]=_[_0x200c('0x39')](_0x45074a['model'],qs[_0x200c('0x3b')](_0x1112a4[_0x200c('0x36')]['fields']));_0x2f9d39[_0x200c('0x3a')]=_0x2f9d39['attributes']['length']?_0x2f9d39['attributes']:_0x45074a[_0x200c('0x3c')];if(!_0x1112a4[_0x200c('0x36')][_0x200c('0x3d')](_0x200c('0x3e'))){_0x2f9d39[_0x200c('0x20')]=qs[_0x200c('0x20')](_0x1112a4['query'][_0x200c('0x20')]);_0x2f9d39[_0x200c('0x1f')]=qs[_0x200c('0x1f')](_0x1112a4[_0x200c('0x36')][_0x200c('0x1f')]);}_0x2f9d39['order']=qs[_0x200c('0x3f')](_0x1112a4[_0x200c('0x36')]['sort']);_0x2f9d39[_0x200c('0x40')]=qs[_0x200c('0x38')](_[_0x200c('0x41')](_0x1112a4[_0x200c('0x36')],_0x45074a[_0x200c('0x38')]),_0x40c201);if(_0x1112a4[_0x200c('0x36')]['filter']){_0x2f9d39[_0x200c('0x40')]=_[_0x200c('0x42')](_0x2f9d39['where'],{'$or':_[_0x200c('0x30')](_0x40c201,function(_0x339505){if(_0x339505[_0x200c('0x34')]!==_0x200c('0x43')){var _0x2b117f={};_0x2b117f[_0x339505[_0x200c('0x2d')]]={'$like':'%'+_0x1112a4['query'][_0x200c('0x44')]+'%'};return _0x2b117f;}})});}_0x2f9d39=_[_0x200c('0x42')]({},_0x2f9d39,_0x1112a4[_0x200c('0x45')]);var _0x48e7c0={'where':_0x2f9d39[_0x200c('0x40')]};return db[_0x200c('0x31')][_0x200c('0x1e')](_0x48e7c0)[_0x200c('0x27')](function(_0xdd86cc){_0x55ace6[_0x200c('0x1e')]=_0xdd86cc;if(_0x1112a4[_0x200c('0x36')][_0x200c('0x46')]){_0x2f9d39[_0x200c('0x47')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x2f9d39);})[_0x200c('0x27')](function(_0x41709e){_0x55ace6[_0x200c('0x48')]=_0x41709e;return _0x55ace6;})['then'](respondWithFilteredResult(_0x2ed842,_0x2f9d39))['catch'](handleError(_0x2ed842,null));};exports[_0x200c('0x49')]=function(_0xd44e77,_0x25d7ee){var _0x21ed35={'raw':![],'where':{'id':_0xd44e77[_0x200c('0x4a')]['id']}},_0x4bdca9={};_0x4bdca9[_0x200c('0x3c')]=_[_0x200c('0x37')](db[_0x200c('0x31')][_0x200c('0x32')]);_0x4bdca9['query']=_[_0x200c('0x37')](_0xd44e77[_0x200c('0x36')]);_0x4bdca9['filters']=_[_0x200c('0x39')](_0x4bdca9[_0x200c('0x3c')],_0x4bdca9['query']);_0x21ed35[_0x200c('0x3a')]=_['intersection'](_0x4bdca9['model'],qs[_0x200c('0x3b')](_0xd44e77[_0x200c('0x36')][_0x200c('0x3b')]));_0x21ed35['attributes']=_0x21ed35[_0x200c('0x3a')][_0x200c('0x4b')]?_0x21ed35['attributes']:_0x4bdca9[_0x200c('0x3c')];if(_0xd44e77[_0x200c('0x36')][_0x200c('0x46')]){_0x21ed35[_0x200c('0x47')]=[{'all':!![]}];}_0x21ed35=_['merge']({},_0x21ed35,_0xd44e77[_0x200c('0x45')]);return db['AnalyticCustomReport'][_0x200c('0x4c')](_0x21ed35)[_0x200c('0x27')](handleEntityNotFound(_0x25d7ee,null))[_0x200c('0x27')](respondWithResult(_0x25d7ee,null))[_0x200c('0x4d')](handleError(_0x25d7ee,null));};exports['create']=function(_0x111611,_0x5f57b5){return db[_0x200c('0x31')][_0x200c('0x4e')](_0x111611[_0x200c('0x4f')],{})[_0x200c('0x27')](function(_0x1617e4){var _0x361d0c=_0x111611[_0x200c('0x50')][_0x200c('0x29')]({'plain':!![]});if(!_0x361d0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x361d0c['role']===_0x200c('0x50')){var _0x3dbd62=_0x1617e4[_0x200c('0x29')]({'plain':!![]});var _0xc80e5f=_0x200c('0x51');return db[_0x200c('0x52')][_0x200c('0x4c')]({'where':{'name':_0xc80e5f,'userProfileId':_0x361d0c['userProfileId']},'raw':!![]})['then'](function(_0x41658c){if(_0x41658c&&_0x41658c[_0x200c('0x53')]===0x0){return db['UserProfileResource'][_0x200c('0x4e')]({'name':_0x3dbd62['name'],'resourceId':_0x3dbd62['id'],'type':_0x200c('0x2a'),'sectionId':_0x41658c['id']},{})['then'](function(){return _0x1617e4;});}else{return _0x1617e4;}})[_0x200c('0x4d')](function(_0x19c305){logger[_0x200c('0x2b')](_0x200c('0x54'),_0x19c305);throw _0x19c305;});}return _0x1617e4;})[_0x200c('0x27')](respondWithResult(_0x5f57b5,0xc9))[_0x200c('0x4d')](handleError(_0x5f57b5,null));};exports['update']=function(_0x122754,_0x6ec139){if(_0x122754[_0x200c('0x4f')]['id']){delete _0x122754[_0x200c('0x4f')]['id'];}return db[_0x200c('0x31')][_0x200c('0x4c')]({'where':{'id':_0x122754[_0x200c('0x4a')]['id']}})['then'](handleEntityNotFound(_0x6ec139,null))[_0x200c('0x27')](saveUpdates(_0x122754[_0x200c('0x4f')],null))[_0x200c('0x27')](respondWithResult(_0x6ec139,null))['catch'](handleError(_0x6ec139,null));};exports[_0x200c('0x28')]=function(_0x5eef9f,_0x5ecf92){return db[_0x200c('0x31')]['find']({'where':{'id':_0x5eef9f[_0x200c('0x4a')]['id']}})[_0x200c('0x27')](handleEntityNotFound(_0x5ecf92,null))[_0x200c('0x27')](removeEntity(_0x5ecf92,null))[_0x200c('0x4d')](handleError(_0x5ecf92,null));};exports[_0x200c('0x55')]=function(_0x5cfde2,_0x1769ae){var _0x38efdd=0xa;var _0x24e731=['join',_0x200c('0x56'),_0x200c('0x57'),_0x200c('0x58')];var _0x32598a={'SUM':'SUM(%s)','COUNT':_0x200c('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x200c('0x5a'),'MIN':'MIN(%s)','AVG':_0x200c('0x5b'),'GROUP_CONCAT':_0x200c('0x5c'),'GROUP_CONCAT ASC':_0x200c('0x5d'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x472bc1={'SEC_TO_TIME':_0x200c('0x5e'),'DATE':_0x200c('0x5f'),'HOUR':_0x200c('0x60'),'ROUND':_0x200c('0x61'),'UNIX_TIMESTAMP':_0x200c('0x62')};var _0x49a703=function(_0x18838b){return!_[_0x200c('0x63')](['IS\x20NULL',_0x200c('0x64'),_0x200c('0x65'),_0x200c('0x66')],_0x18838b);};var _0xf0528b=function(_0x260605){if(!_0x260605||!_0x260605[_0x200c('0x67')]['length']){return'';}for(var _0x549c60='(',_0x1d61a4=0x0;_0x1d61a4<_0x260605[_0x200c('0x67')][_0x200c('0x4b')];_0x1d61a4+=0x1){_0x1d61a4>0x0&&(_0x549c60+='\x20'+_0x260605[_0x200c('0x68')]+'\x20');_0x549c60+=_0x260605['rules'][_0x1d61a4][_0x200c('0x69')]?_0xf0528b(_0x260605[_0x200c('0x67')][_0x1d61a4][_0x200c('0x69')]):_0x260605[_0x200c('0x67')][_0x1d61a4]['field']+'\x20'+_0x260605[_0x200c('0x67')][_0x1d61a4][_0x200c('0x6a')]+(_0x49a703(_0x260605[_0x200c('0x67')][_0x1d61a4][_0x200c('0x6a')])?'\x20'+_0x260605[_0x200c('0x67')][_0x1d61a4][_0x200c('0x6b')]:'');}return _0x549c60+')';};var _0x356252={'where':{'id':_0x5cfde2[_0x200c('0x4a')]['id']}},_0xd46d69,_0xdec58e,_0x98354d,_0xced153,_0x171cbb;_0x356252=_[_0x200c('0x42')]({},_0x356252,_0x5cfde2[_0x200c('0x45')]);return db['AnalyticCustomReport'][_0x200c('0x4c')](_0x356252)[_0x200c('0x27')](function(_0x1a970e){if(_0x1a970e){_0xd46d69=_0x1a970e;return _0x1a970e[_0x200c('0x6c')]();}return null;})['then'](function(_0xc291c3){if(_0xc291c3){if(!_0xc291c3[_0x200c('0x4b')]){throw new db[(_0x200c('0x6d'))][(_0x200c('0x6e'))](_0x200c('0x6f'),0x193);}_0xdec58e=_0xc291c3;return db[_0x200c('0x70')][_0x200c('0x71')]({'raw':!![]});}return null;})[_0x200c('0x27')](function(_0x274e9a){if(_0x274e9a){_0x98354d=_['keyBy'](_0x274e9a,'id');var _0x576f69;var _0x5271bd=squel['select']();_0x5271bd[_0x200c('0x72')](_0xd46d69[_0x200c('0x73')]);for(var _0x5b9668=0x0;_0x5b9668<_0xdec58e['length'];_0x5b9668+=0x1){_0x576f69=_0xdec58e[_0x5b9668]['MetricId']?_0x98354d[_0xdec58e[_0x5b9668]['MetricId']]['metric']:_0xdec58e[_0x5b9668]['field'];_0x576f69=_0xdec58e[_0x5b9668][_0x200c('0x74')]?_['replace'](_0x32598a[_0xdec58e[_0x5b9668][_0x200c('0x74')]],'%s',_0x576f69):_0x576f69;_0x576f69=_0xdec58e[_0x5b9668][_0x200c('0x75')]?_['replace'](_0x472bc1[_0xdec58e[_0x5b9668][_0x200c('0x75')]],'%s',_0x576f69):_0x576f69;if(_0xdec58e[_0x5b9668][_0x200c('0x76')]){_0x5271bd[_0x200c('0x69')](_0x576f69);}_0xdec58e[_0x5b9668]['orderBy']&&_0x5271bd[_0x200c('0x77')](_0x576f69,_0xdec58e[_0x5b9668][_0x200c('0x78')]===_0x200c('0x79')?![]:!![]);_0x5271bd[_0x200c('0x7a')](_0x576f69,_0xdec58e[_0x5b9668]['alias']||_0x576f69);}if(_0xd46d69[_0x200c('0x7b')]){_0xd46d69[_0x200c('0x7b')]=JSON['parse'](_0xd46d69[_0x200c('0x7b')]);for(var _0x22e97c=0x0;_0x22e97c<_0xd46d69[_0x200c('0x7b')][_0x200c('0x4b')];_0x22e97c+=0x1){if(_0xd46d69[_0x200c('0x7b')][_0x22e97c]['type']&&_[_0x200c('0x63')](_0x24e731,_0xd46d69[_0x200c('0x7b')][_0x22e97c][_0x200c('0x34')])&&_0xd46d69[_0x200c('0x7b')][_0x22e97c]['parentKey']&&_0xd46d69[_0x200c('0x7b')][_0x22e97c][_0x200c('0x7c')]&&_0xd46d69[_0x200c('0x7b')][_0x22e97c][_0x200c('0x7d')]){_0x5271bd[_0xd46d69[_0x200c('0x7b')][_0x22e97c]['type']](_0xd46d69[_0x200c('0x7b')][_0x22e97c]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0xd46d69[_0x200c('0x73')],_0xd46d69[_0x200c('0x7b')][_0x22e97c]['parentKey'],_0xd46d69[_0x200c('0x7b')][_0x22e97c][_0x200c('0x7c')],_0xd46d69[_0x200c('0x7b')][_0x22e97c][_0x200c('0x7d')]));}}}if(_0xd46d69[_0x200c('0x7e')]){_0xd46d69[_0x200c('0x7e')]=JSON[_0x200c('0x7f')](_0xd46d69[_0x200c('0x7e')]);_0x5271bd[_0x200c('0x40')](_0xf0528b(_0xd46d69['conditions'][_0x200c('0x69')]));}_0x171cbb=_0x5271bd[_0x200c('0x80')]();_0x5271bd[_0x200c('0x20')](_0x38efdd);_0x5271bd[_0x200c('0x1f')](0x0);logger[_0x200c('0x81')](_0x200c('0x82'),_0x5271bd['toString']());return dbH[_0x200c('0x83')][_0x200c('0x36')](_0x5271bd[_0x200c('0x84')](),{'type':dbH[_0x200c('0x83')][_0x200c('0x85')][_0x200c('0x86')]});}})[_0x200c('0x27')](respondWithResult(_0x1769ae,null))[_0x200c('0x4d')](handleError(_0x1769ae,null));};function runReport(_0x5cafdb,_0x436668,_0x5d93b3){var _0x129af8=_0x436668[_0x200c('0x2d')];var _0x45a0e8=0xa;var _0x3efc44=[_0x200c('0x87'),_0x200c('0x56'),_0x200c('0x57'),'cross_join'];var _0x22a92c={'SUM':_0x200c('0x88'),'COUNT':_0x200c('0x59'),'COUNT DISTINCT':_0x200c('0x89'),'MAX':_0x200c('0x5a'),'MIN':_0x200c('0x8a'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x200c('0x5c'),'GROUP_CONCAT ASC':_0x200c('0x5d'),'GROUP_CONCAT DESC':_0x200c('0x8b')};var _0x1aad73={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x200c('0x5f'),'HOUR':_0x200c('0x60'),'ROUND':_0x200c('0x61'),'UNIX_TIMESTAMP':_0x200c('0x62')};var _0x5eb706=function(_0x5406ee){return!_['includes'](['IS\x20NULL',_0x200c('0x64'),_0x200c('0x65'),_0x200c('0x66')],_0x5406ee);};var _0x131a0d=function(_0x2b8e6b){if(!_0x2b8e6b||!_0x2b8e6b['rules'][_0x200c('0x4b')]){return'';}for(var _0x33f5f9='(',_0x266c24=0x0;_0x266c24<_0x2b8e6b[_0x200c('0x67')][_0x200c('0x4b')];_0x266c24+=0x1){_0x266c24>0x0&&(_0x33f5f9+='\x20'+_0x2b8e6b[_0x200c('0x68')]+'\x20');_0x33f5f9+=_0x2b8e6b[_0x200c('0x67')][_0x266c24]['group']?_0x131a0d(_0x2b8e6b[_0x200c('0x67')][_0x266c24]['group']):_0x2b8e6b[_0x200c('0x67')][_0x266c24][_0x200c('0x7a')]+'\x20'+_0x2b8e6b[_0x200c('0x67')][_0x266c24][_0x200c('0x6a')]+(_0x5eb706(_0x2b8e6b['rules'][_0x266c24]['condition'])?'\x20'+_0x2b8e6b[_0x200c('0x67')][_0x266c24][_0x200c('0x6b')]:'');}return _0x33f5f9+')';};var _0x364737={'where':{'id':_0x5cafdb['id']}},_0xc18af7,_0x200166,_0x4bf5a5,_0x3ce0bb,_0x24091b;_0x364737=_[_0x200c('0x42')]({},_0x364737,_0x5d93b3);return db['AnalyticCustomReport'][_0x200c('0x4c')](_0x364737)[_0x200c('0x27')](function(_0x200934){if(_0x200934){_0xc18af7=_0x200934;return _0x200934[_0x200c('0x6c')]();}return null;})[_0x200c('0x27')](function(_0x301cdb){if(_0x301cdb){if(!_0x301cdb['length']){throw new db[(_0x200c('0x6d'))][(_0x200c('0x6e'))](_0x200c('0x6f'),0x193);}_0x200166=_0x301cdb;return db[_0x200c('0x70')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x1d1a96){if(_0x1d1a96){_0x4bf5a5=_['keyBy'](_0x1d1a96,'id');var _0x5db206;var _0x39d5cb=squel[_0x200c('0x8c')]();_0x39d5cb[_0x200c('0x72')](_0xc18af7[_0x200c('0x73')]);for(var _0x3bf834=0x0;_0x3bf834<_0x200166[_0x200c('0x4b')];_0x3bf834+=0x1){_0x5db206=_0x200166[_0x3bf834]['MetricId']?_0x4bf5a5[_0x200166[_0x3bf834][_0x200c('0x8d')]][_0x200c('0x8e')]:_0x200166[_0x3bf834][_0x200c('0x7a')];_0x5db206=_0x200166[_0x3bf834][_0x200c('0x74')]?_[_0x200c('0x8f')](_0x22a92c[_0x200166[_0x3bf834][_0x200c('0x74')]],'%s',_0x5db206):_0x5db206;_0x5db206=_0x200166[_0x3bf834][_0x200c('0x75')]?_[_0x200c('0x8f')](_0x1aad73[_0x200166[_0x3bf834][_0x200c('0x75')]],'%s',_0x5db206):_0x5db206;if(_0x200166[_0x3bf834][_0x200c('0x76')]){_0x39d5cb[_0x200c('0x69')](_0x5db206);}_0x200166[_0x3bf834]['orderBy']&&_0x39d5cb[_0x200c('0x77')](_0x5db206,_0x200166[_0x3bf834][_0x200c('0x78')]===_0x200c('0x79')?![]:!![]);_0x39d5cb[_0x200c('0x7a')](_0x5db206,_0x200166[_0x3bf834][_0x200c('0x90')]||_0x5db206);}if(_0xc18af7[_0x200c('0x7b')]){_0xc18af7[_0x200c('0x7b')]=JSON[_0x200c('0x7f')](_0xc18af7[_0x200c('0x7b')]);for(var _0x2135af=0x0;_0x2135af<_0xc18af7[_0x200c('0x7b')][_0x200c('0x4b')];_0x2135af+=0x1){if(_0xc18af7[_0x200c('0x7b')][_0x2135af][_0x200c('0x34')]&&_[_0x200c('0x63')](_0x3efc44,_0xc18af7['joins'][_0x2135af]['type'])&&_0xc18af7[_0x200c('0x7b')][_0x2135af]['parentKey']&&_0xc18af7[_0x200c('0x7b')][_0x2135af]['foreignTable']&&_0xc18af7[_0x200c('0x7b')][_0x2135af][_0x200c('0x7d')]){_0x39d5cb[_0xc18af7['joins'][_0x2135af][_0x200c('0x34')]](_0xc18af7['joins'][_0x2135af][_0x200c('0x7c')],null,util[_0x200c('0x75')](_0x200c('0x91'),_0xc18af7[_0x200c('0x73')],_0xc18af7[_0x200c('0x7b')][_0x2135af]['parentKey'],_0xc18af7['joins'][_0x2135af][_0x200c('0x7c')],_0xc18af7[_0x200c('0x7b')][_0x2135af]['foreignKey']));}}}if(_0xc18af7[_0x200c('0x7e')]){_0xc18af7['conditions']=JSON[_0x200c('0x7f')](_0xc18af7['conditions']);_0x39d5cb[_0x200c('0x40')](_0x131a0d(_0xc18af7[_0x200c('0x7e')][_0x200c('0x69')]));}_0x24091b=_0x39d5cb['clone']();_0x39d5cb[_0x200c('0x20')](_0x45a0e8);_0x39d5cb['offset'](0x0);return;}})[_0x200c('0x27')](function(){if(_0x436668[_0x200c('0x92')]==='web'){return null;}var _0x8e9795=_['merge'](_0x436668,{'name':_0x436668[_0x200c('0x93')]||_0x436668[_0x200c('0x2d')]||_0xc18af7[_0x200c('0x2d')],'basename':_0x129af8,'savename':util[_0x200c('0x75')]('%s-%s.%s',_0x436668[_0x200c('0x2d')]||_0xc18af7[_0x200c('0x2d')],require(_0x200c('0x94'))[_0x200c('0x95')](0x4),_0x436668[_0x200c('0x92')]||_0x200c('0x96')),'reportId':_0xc18af7['id'],'reportType':'custom'});return db[_0x200c('0x97')][_0x200c('0x4e')](_0x8e9795,{'raw':!![]});})[_0x200c('0x27')](function(_0x49b777){if(_0xc18af7[_0x200c('0x73')]==='cdr'){_0x24091b[_0x200c('0x40')](_0xc18af7['table']+_0x200c('0x98'),_0x436668[_0x200c('0x99')],_0x436668[_0x200c('0x9a')]);}else{_0x24091b[_0x200c('0x40')](_0xc18af7[_0x200c('0x73')]+_0x200c('0x9b'),_0x436668[_0x200c('0x99')],_0x436668[_0x200c('0x9a')]);}if(_0x49b777){logger[_0x200c('0x9c')](_0x200c('0x9d'),_0x24091b['toString']());require(_0x200c('0x9e'))[_0x200c('0x9f')](path[_0x200c('0x87')](__dirname,_0x200c('0xa0'),_0x49b777[_0x200c('0x92')]),[_0x49b777['id'],_0x24091b[_0x200c('0x84')](),path[_0x200c('0x87')](__dirname,_0x200c('0xa1'),_0x49b777[_0x200c('0xa2')]),_0x129af8]);return _0x49b777;}else{var _0x196351=squel[_0x200c('0x8c')]();_0x196351[_0x200c('0x72')]('('+_0x24091b[_0x200c('0x84')]()+')','countTable');_0x196351[_0x200c('0x7a')]('COUNT(*)',_0x200c('0x1e'));_0x24091b[_0x200c('0x20')](_0x436668[_0x200c('0x20')]||_0x45a0e8);_0x24091b[_0x200c('0x1f')](_0x436668[_0x200c('0x1f')]||0x0);return dbH[_0x200c('0x83')][_0x200c('0x36')](_0x196351[_0x200c('0x84')](),{'type':dbH[_0x200c('0x83')][_0x200c('0x85')][_0x200c('0x86')]})['then'](function(_0x319a70){if(!_0x319a70[_0x200c('0x4b')]){_0x3ce0bb=0x0;}else{_0x3ce0bb=_0x319a70[0x0][_0x200c('0x1e')]||0x0;}return dbH[_0x200c('0x83')]['query'](_0x24091b['toString'](),{'type':dbH[_0x200c('0x83')][_0x200c('0x85')][_0x200c('0x86')]});})[_0x200c('0x27')](function(_0x366fb1){return{'rows':_0x366fb1||[],'count':_0x3ce0bb};});}});}exports[_0x200c('0xa3')]=function(_0x5353c5,_0x33a430){return runReport(_0x5353c5[_0x200c('0x4a')],_0x5353c5[_0x200c('0x36')],_0x5353c5[_0x200c('0x45')])[_0x200c('0x27')](respondWithResult(_0x33a430,null))[_0x200c('0x4d')](handleError(_0x33a430,null));};exports['runReport']=runReport;exports[_0x200c('0x36')]=function(_0x54dc55,_0x4ee84e){var _0x21bb22=0xa;var _0x1b5708=['join',_0x200c('0x56'),'right_join','cross_join'];var _0x5011ac={'SUM':_0x200c('0x88'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x200c('0x89'),'MAX':'MAX(%s)','MIN':_0x200c('0x8a'),'AVG':_0x200c('0x5b'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x200c('0x8b')};var _0x2f8270={'SEC_TO_TIME':_0x200c('0x5e'),'DATE':_0x200c('0x5f'),'HOUR':_0x200c('0x60'),'ROUND':_0x200c('0x61'),'UNIX_TIMESTAMP':_0x200c('0x62')};var _0x472fb1=function(_0x13ed43){return!_[_0x200c('0x63')]([_0x200c('0xa4'),_0x200c('0x64'),'IS\x20EMPTY',_0x200c('0x66')],_0x13ed43);};var _0x5b1768=function(_0x4c9c04){if(!_0x4c9c04||!_0x4c9c04[_0x200c('0x67')][_0x200c('0x4b')]){return'';}for(var _0x2db11c='(',_0x303842=0x0;_0x303842<_0x4c9c04[_0x200c('0x67')][_0x200c('0x4b')];_0x303842+=0x1){_0x303842>0x0&&(_0x2db11c+='\x20'+_0x4c9c04['operator']+'\x20');_0x2db11c+=_0x4c9c04[_0x200c('0x67')][_0x303842][_0x200c('0x69')]?_0x5b1768(_0x4c9c04[_0x200c('0x67')][_0x303842]['group']):_0x4c9c04[_0x200c('0x67')][_0x303842][_0x200c('0x7a')]+'\x20'+_0x4c9c04['rules'][_0x303842][_0x200c('0x6a')]+(_0x472fb1(_0x4c9c04[_0x200c('0x67')][_0x303842][_0x200c('0x6a')])?'\x20'+_0x4c9c04[_0x200c('0x67')][_0x303842][_0x200c('0x6b')]:'');}return _0x2db11c+')';};var _0x316814={'where':{'id':_0x54dc55[_0x200c('0x4a')]['id']}},_0x2854a0,_0x28edf4,_0x2aa554,_0x28bc7b,_0x59e536;_0x316814=_[_0x200c('0x42')]({},_0x316814,_0x54dc55[_0x200c('0x45')]);return db[_0x200c('0x31')]['find'](_0x316814)[_0x200c('0x27')](function(_0x1f5615){if(_0x1f5615){_0x2854a0=_0x1f5615;return _0x1f5615[_0x200c('0x6c')]();}return null;})[_0x200c('0x27')](function(_0xe538a5){if(_0xe538a5){if(!_0xe538a5[_0x200c('0x4b')]){throw new db['Sequelize'][(_0x200c('0x6e'))](_0x200c('0x6f'),0x193);}_0x28edf4=_0xe538a5;return db['AnalyticMetric'][_0x200c('0x71')]({'raw':!![]});}return null;})[_0x200c('0x27')](function(_0x2524c8){if(_0x2524c8){_0x2aa554=_[_0x200c('0xa5')](_0x2524c8,'id');var _0x5b46e8;var _0x8412ff=squel['select']();_0x8412ff[_0x200c('0x72')](_0x2854a0[_0x200c('0x73')]);for(var _0x4bee0e=0x0;_0x4bee0e<_0x28edf4[_0x200c('0x4b')];_0x4bee0e+=0x1){_0x5b46e8=_0x28edf4[_0x4bee0e][_0x200c('0x8d')]?_0x2aa554[_0x28edf4[_0x4bee0e][_0x200c('0x8d')]][_0x200c('0x8e')]:_0x28edf4[_0x4bee0e][_0x200c('0x7a')];_0x5b46e8=_0x28edf4[_0x4bee0e][_0x200c('0x74')]?_['replace'](_0x5011ac[_0x28edf4[_0x4bee0e][_0x200c('0x74')]],'%s',_0x5b46e8):_0x5b46e8;_0x5b46e8=_0x28edf4[_0x4bee0e][_0x200c('0x75')]?_[_0x200c('0x8f')](_0x2f8270[_0x28edf4[_0x4bee0e][_0x200c('0x75')]],'%s',_0x5b46e8):_0x5b46e8;if(_0x28edf4[_0x4bee0e]['groupBy']){_0x8412ff[_0x200c('0x69')](_0x5b46e8);}_0x28edf4[_0x4bee0e]['orderBy']&&_0x8412ff[_0x200c('0x77')](_0x5b46e8,_0x28edf4[_0x4bee0e][_0x200c('0x78')]===_0x200c('0x79')?![]:!![]);_0x8412ff['field'](_0x5b46e8,_0x28edf4[_0x4bee0e][_0x200c('0x90')]||_0x5b46e8);}if(_0x2854a0[_0x200c('0x7b')]){_0x2854a0['joins']=JSON[_0x200c('0x7f')](_0x2854a0[_0x200c('0x7b')]);for(var _0x6ba12c=0x0;_0x6ba12c<_0x2854a0[_0x200c('0x7b')][_0x200c('0x4b')];_0x6ba12c+=0x1){if(_0x2854a0['joins'][_0x6ba12c]['type']&&_[_0x200c('0x63')](_0x1b5708,_0x2854a0[_0x200c('0x7b')][_0x6ba12c][_0x200c('0x34')])&&_0x2854a0[_0x200c('0x7b')][_0x6ba12c][_0x200c('0xa6')]&&_0x2854a0['joins'][_0x6ba12c]['foreignTable']&&_0x2854a0[_0x200c('0x7b')][_0x6ba12c][_0x200c('0x7d')]){_0x8412ff[_0x2854a0[_0x200c('0x7b')][_0x6ba12c]['type']](_0x2854a0[_0x200c('0x7b')][_0x6ba12c][_0x200c('0x7c')],null,util[_0x200c('0x75')]('%s.%s\x20=\x20%s.%s',_0x2854a0['table'],_0x2854a0[_0x200c('0x7b')][_0x6ba12c][_0x200c('0xa6')],_0x2854a0[_0x200c('0x7b')][_0x6ba12c]['foreignTable'],_0x2854a0[_0x200c('0x7b')][_0x6ba12c]['foreignKey']));}}}if(_0x2854a0['conditions']){_0x2854a0['conditions']=JSON[_0x200c('0x7f')](_0x2854a0[_0x200c('0x7e')]);_0x8412ff[_0x200c('0x40')](_0x5b1768(_0x2854a0[_0x200c('0x7e')][_0x200c('0x69')]));}_0x59e536=_0x8412ff[_0x200c('0x80')]();_0x8412ff[_0x200c('0x20')](_0x21bb22);_0x8412ff['offset'](0x0);logger[_0x200c('0x81')](_0x200c('0x82'),_0x8412ff[_0x200c('0x84')]());return dbH[_0x200c('0x83')][_0x200c('0x36')](_0x8412ff[_0x200c('0x84')](),{'type':dbH[_0x200c('0x83')][_0x200c('0x85')][_0x200c('0x86')]});}})[_0x200c('0x27')](function(){return{'sql':_0x59e536[_0x200c('0x84')]()};})[_0x200c('0x27')](respondWithResult(_0x4ee84e,null))[_0x200c('0x4d')](handleError(_0x4ee84e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 40f2754..6bde2de 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 _0x6820=['define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports'];(function(_0x3b5e9d,_0x5970dc){var _0x44681d=function(_0x306697){while(--_0x306697){_0x3b5e9d['push'](_0x3b5e9d['shift']());}};_0x44681d(++_0x5970dc);}(_0x6820,0x177));var _0x0682=function(_0x57e8d7,_0x5ba3e0){_0x57e8d7=_0x57e8d7-0x0;var _0x527e11=_0x6820[_0x57e8d7];return _0x527e11;};'use strict';var _=require(_0x0682('0x0'));var util=require(_0x0682('0x1'));var logger=require(_0x0682('0x2'))(_0x0682('0x3'));var moment=require(_0x0682('0x4'));var BPromise=require(_0x0682('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0682('0x6'));var rimraf=require(_0x0682('0x7'));var config=require('../../config/environment');var attributes=require('./analyticCustomReport.attributes');module[_0x0682('0x8')]=function(_0x22092d,_0x2d62e2){return _0x22092d[_0x0682('0x9')](_0x0682('0xa'),attributes,{'tableName':_0x0682('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f2d=['../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3f2d,0x13d));var _0xd3f2=function(_0x21f22e,_0x3868a7){_0x21f22e=_0x21f22e-0x0;var _0x3bc364=_0x3f2d[_0x21f22e];return _0x3bc364;};'use strict';var _=require(_0xd3f2('0x0'));var util=require('util');var logger=require(_0xd3f2('0x1'))(_0xd3f2('0x2'));var moment=require(_0xd3f2('0x3'));var BPromise=require(_0xd3f2('0x4'));var rp=require(_0xd3f2('0x5'));var fs=require('fs');var path=require(_0xd3f2('0x6'));var rimraf=require('rimraf');var config=require(_0xd3f2('0x7'));var attributes=require(_0xd3f2('0x8'));module[_0xd3f2('0x9')]=function(_0x59c8b6,_0x5a67de){return _0x59c8b6[_0xd3f2('0xa')](_0xd3f2('0xb'),attributes,{'tableName':'analytics_custom_reports','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 d15ce4d..4c5bdfd 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 _0x2469=['lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info','result'];(function(_0x214214,_0x469594){var _0x11df66=function(_0x2ee39b){while(--_0x2ee39b){_0x214214['push'](_0x214214['shift']());}};_0x11df66(++_0x469594);}(_0x2469,0x1a2));var _0x9246=function(_0xeca329,_0x59b998){_0xeca329=_0xeca329-0x0;var _0x395c5f=_0x2469[_0xeca329];return _0x395c5f;};'use strict';var _=require(_0x9246('0x0'));var util=require(_0x9246('0x1'));var moment=require('moment');var BPromise=require(_0x9246('0x2'));var rs=require(_0x9246('0x3'));var fs=require('fs');var Redis=require(_0x9246('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9246('0x5'));var logger=require(_0x9246('0x6'))(_0x9246('0x7'));var config=require(_0x9246('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9246('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1730c2,_0x226a22,_0xa9990f){return new BPromise(function(_0x54d31d,_0x39e0fe){return client[_0x9246('0xa')](_0x1730c2,_0xa9990f)[_0x9246('0xb')](function(_0xf1cb8d){logger['info'](_0x9246('0xc'),_0x226a22,'request\x20sent');logger[_0x9246('0xd')](_0x9246('0xe'),_0x226a22,_0x9246('0xf'),JSON[_0x9246('0x10')](_0xf1cb8d));if(_0xf1cb8d['error']){if(_0xf1cb8d['error'][_0x9246('0x11')]===0x1f4){logger[_0x9246('0x12')](_0x9246('0xc'),_0x226a22,_0xf1cb8d['error'][_0x9246('0x13')]);return _0x39e0fe(_0xf1cb8d[_0x9246('0x12')]['message']);}logger[_0x9246('0x12')](_0x9246('0xc'),_0x226a22,_0xf1cb8d[_0x9246('0x12')]['message']);return _0x54d31d(_0xf1cb8d[_0x9246('0x12')]['message']);}else{logger[_0x9246('0x14')](_0x9246('0xc'),_0x226a22,_0x9246('0xf'));_0x54d31d(_0xf1cb8d[_0x9246('0x15')][_0x9246('0x13')]);}})['catch'](function(_0x35b91d){logger['error'](_0x9246('0xc'),_0x226a22,_0x35b91d);_0x39e0fe(_0x35b91d);});});} \ No newline at end of file +var _0x5c99=['../../config/environment','client','http','then','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x69996f,_0x33c80d){var _0x24af64=function(_0xc175e3){while(--_0xc175e3){_0x69996f['push'](_0x69996f['shift']());}};_0x24af64(++_0x33c80d);}(_0x5c99,0x117));var _0x95c9=function(_0x277a50,_0x1b5383){_0x277a50=_0x277a50-0x0;var _0x47aeae=_0x5c99[_0x277a50];return _0x47aeae;};'use strict';var _=require(_0x95c9('0x0'));var util=require('util');var moment=require(_0x95c9('0x1'));var BPromise=require(_0x95c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95c9('0x3'));var db=require(_0x95c9('0x4'))['db'];var utils=require(_0x95c9('0x5'));var logger=require(_0x95c9('0x6'))('rpc');var config=require(_0x95c9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x95c9('0x8')][_0x95c9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26cbf4,_0x54803c,_0x36ab5e){return new BPromise(function(_0x4a5da3,_0x67b71e){return client['request'](_0x26cbf4,_0x36ab5e)[_0x95c9('0xa')](function(_0x65a47b){logger['info'](_0x95c9('0xb'),_0x54803c,'request\x20sent');logger[_0x95c9('0xc')](_0x95c9('0xd'),_0x54803c,_0x95c9('0xe'),JSON[_0x95c9('0xf')](_0x65a47b));if(_0x65a47b[_0x95c9('0x10')]){if(_0x65a47b[_0x95c9('0x10')][_0x95c9('0x11')]===0x1f4){logger[_0x95c9('0x10')](_0x95c9('0xb'),_0x54803c,_0x65a47b[_0x95c9('0x10')]['message']);return _0x67b71e(_0x65a47b[_0x95c9('0x10')][_0x95c9('0x12')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x54803c,_0x65a47b[_0x95c9('0x10')][_0x95c9('0x12')]);return _0x4a5da3(_0x65a47b[_0x95c9('0x10')][_0x95c9('0x12')]);}else{logger[_0x95c9('0x13')](_0x95c9('0xb'),_0x54803c,_0x95c9('0xe'));_0x4a5da3(_0x65a47b[_0x95c9('0x14')][_0x95c9('0x12')]);}})[_0x95c9('0x15')](function(_0x5a6bb5){logger[_0x95c9('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x54803c,_0x5a6bb5);_0x67b71e(_0x5a6bb5);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8ca0a2c..e1c64f3 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 _0x6164=['get','/:id','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index'];(function(_0x1ea682,_0x70bf1d){var _0x27fc4b=function(_0x3c0ebb){while(--_0x3c0ebb){_0x1ea682['push'](_0x1ea682['shift']());}};_0x27fc4b(++_0x70bf1d);}(_0x6164,0xd6));var _0x4616=function(_0x156b03,_0x238b09){_0x156b03=_0x156b03-0x0;var _0x302cc5=_0x6164[_0x156b03];return _0x302cc5;};'use strict';var multer=require('multer');var util=require(_0x4616('0x0'));var path=require(_0x4616('0x1'));var timeout=require(_0x4616('0x2'));var express=require(_0x4616('0x3'));var router=express[_0x4616('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4616('0x5'));var interaction=require(_0x4616('0x6'));var config=require(_0x4616('0x7'));var controller=require(_0x4616('0x8'));router['get']('/',auth[_0x4616('0x9')](),controller[_0x4616('0xa')]);router[_0x4616('0xb')](_0x4616('0xc'),auth[_0x4616('0x9')](),controller['show']);router[_0x4616('0xb')](_0x4616('0xd'),auth['isAuthenticated'](),controller[_0x4616('0xe')]);router[_0x4616('0xb')](_0x4616('0xf'),auth[_0x4616('0x9')](),controller[_0x4616('0x10')]);router[_0x4616('0xb')](_0x4616('0x11'),auth[_0x4616('0x9')](),controller[_0x4616('0x12')]);router[_0x4616('0x13')]('/',auth[_0x4616('0x9')](),controller[_0x4616('0x14')]);router[_0x4616('0x15')]('/:id',auth[_0x4616('0x9')](),controller[_0x4616('0x16')]);router[_0x4616('0x17')](_0x4616('0xc'),auth[_0x4616('0x9')](),controller['destroy']);module[_0x4616('0x18')]=router; \ No newline at end of file +var _0xad36=['run','query','create','put','update','multer','path','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run'];(function(_0x5c2467,_0x11f9c0){var _0x1ef7c4=function(_0x552466){while(--_0x552466){_0x5c2467['push'](_0x5c2467['shift']());}};_0x1ef7c4(++_0x11f9c0);}(_0xad36,0xc3));var _0x6ad3=function(_0x34bcd2,_0x387162){_0x34bcd2=_0x34bcd2-0x0;var _0x44c710=_0xad36[_0x34bcd2];return _0x44c710;};'use strict';var multer=require(_0x6ad3('0x0'));var util=require('util');var path=require(_0x6ad3('0x1'));var timeout=require(_0x6ad3('0x2'));var express=require(_0x6ad3('0x3'));var router=express[_0x6ad3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ad3('0x5'));var controller=require('./analyticCustomReport.controller');router[_0x6ad3('0x6')]('/',auth[_0x6ad3('0x7')](),controller[_0x6ad3('0x8')]);router[_0x6ad3('0x6')](_0x6ad3('0x9'),auth['isAuthenticated'](),controller[_0x6ad3('0xa')]);router[_0x6ad3('0x6')](_0x6ad3('0xb'),auth[_0x6ad3('0x7')](),controller[_0x6ad3('0xc')]);router['get'](_0x6ad3('0xd'),auth[_0x6ad3('0x7')](),controller[_0x6ad3('0xe')]);router[_0x6ad3('0x6')]('/:id/query',auth[_0x6ad3('0x7')](),controller[_0x6ad3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6ad3('0x10')]);router[_0x6ad3('0x11')](_0x6ad3('0x9'),auth[_0x6ad3('0x7')](),controller[_0x6ad3('0x12')]);router['delete'](_0x6ad3('0x9'),auth[_0x6ad3('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index c9d1a97..1d9eb2e 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x2675,0x75));var _0x5267=function(_0x460386,_0x553ec4){_0x460386=_0x460386-0x0;var _0x326666=_0x2675[_0x460386];return _0x326666;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0xb138=['TEXT','sequelize','exports','STRING'];(function(_0x7f10cb,_0x141eb6){var _0x160eb5=function(_0x5d6b33){while(--_0x5d6b33){_0x7f10cb['push'](_0x7f10cb['shift']());}};_0x160eb5(++_0x141eb6);}(_0xb138,0x1dd));var _0x8b13=function(_0x58c751,_0x3b7b63){_0x58c751=_0x58c751-0x0;var _0x224c37=_0xb138[_0x58c751];return _0x224c37;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'name':{'type':Sequelize[_0x8b13('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8b13('0x2')]},'parent':{'type':Sequelize[_0x8b13('0x2')]},'table':{'type':Sequelize[_0x8b13('0x2')]},'conditions':{'type':Sequelize[_0x8b13('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 01b441f..29a6fe2 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 _0x4819=['keyBy','table','metric','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','select','from','countTable','COUNT(*)','SELECT','run','cross_join','COUNT(DISTINCT\x20%s)','debug','Limited\x20Query:','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','AnalyticDefaultReport','includeAll','include','findAll','rows','show','params','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','autoAssociation','body','preview','join','left_join','SUM(%s)','COUNT(%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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','MetricId','function','replace','format','groupBy','group','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','conditions','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20NULL','IS\x20EMPTY','operator','condition'];(function(_0x4a858b,_0x270c1c){var _0x5ae6a0=function(_0x38f9dc){while(--_0x38f9dc){_0x4a858b['push'](_0x4a858b['shift']());}};_0x5ae6a0(++_0x270c1c);}(_0x4819,0xcd));var _0x9481=function(_0x5cbab1,_0x32afac){_0x5cbab1=_0x5cbab1-0x0;var _0x2637f4=_0x4819[_0x5cbab1];return _0x2637f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];var dbH=require(_0x9481('0x19'))['dbH'];function respondWithStatusCode(_0x5aac02,_0xce6fa2){_0xce6fa2=_0xce6fa2||0xcc;return function(_0x150276){if(_0x150276){return _0x5aac02[_0x9481('0x1a')](_0xce6fa2);}return _0x5aac02[_0x9481('0x1b')](_0xce6fa2)[_0x9481('0x1c')]();};}function respondWithResult(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xc8;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1b')](_0x3fb97f)[_0x9481('0x1d')](_0x495b30);}};}function respondWithFilteredResult(_0x5b1fe6,_0x2266d5){return function(_0x518150){if(_0x518150){var _0x34108d=typeof _0x2266d5[_0x9481('0x1e')]===_0x9481('0x1f')&&typeof _0x2266d5[_0x9481('0x20')]==='undefined';var _0x5eda66=_0x518150[_0x9481('0x21')];var _0x50a559=_0x34108d?0x0:_0x2266d5['offset'];var _0x26671c=_0x34108d?_0x518150[_0x9481('0x21')]:_0x2266d5[_0x9481('0x1e')]+_0x2266d5[_0x9481('0x20')];var _0x7000e7;if(_0x26671c>=_0x5eda66){_0x26671c=_0x5eda66;_0x7000e7=0xc8;}else{_0x7000e7=0xce;}_0x5b1fe6[_0x9481('0x1b')](_0x7000e7);return _0x5b1fe6['set'](_0x9481('0x22'),_0x50a559+'-'+_0x26671c+'/'+_0x5eda66)[_0x9481('0x1d')](_0x518150);}return null;};}function patchUpdates(_0x45f9df){return function(_0x615e02){try{jsonpatch[_0x9481('0x23')](_0x615e02,_0x45f9df,!![]);}catch(_0x56da97){return BPromise[_0x9481('0x24')](_0x56da97);}return _0x615e02[_0x9481('0x25')]();};}function saveUpdates(_0x572599,_0x2bcf37){return function(_0xd1cd1a){if(_0xd1cd1a){return _0xd1cd1a[_0x9481('0x26')](_0x572599)[_0x9481('0x27')](function(_0x2dc02e){return _0x2dc02e;});}return null;};}function removeEntity(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['destroy']()['then'](function(){var _0x12b0c3=_0x22f0b5[_0x9481('0x28')]({'plain':!![]});var _0x550fce=_0x9481('0x29');return db[_0x9481('0x2a')][_0x9481('0x2b')]({'where':{'type':_0x550fce,'resourceId':_0x12b0c3['id']}})[_0x9481('0x27')](function(){return _0x22f0b5;});})['then'](function(){_0x49ecfa[_0x9481('0x1b')](0xcc)[_0x9481('0x1c')]();});}};}function handleEntityNotFound(_0x3c2585,_0x587706){return function(_0x1791b2){if(!_0x1791b2){_0x3c2585['sendStatus'](0x194);}return _0x1791b2;};}function handleError(_0x2e1eff,_0xe153ab){_0xe153ab=_0xe153ab||0x1f4;return function(_0x22ab26){logger[_0x9481('0x2c')](_0x22ab26[_0x9481('0x2d')]);if(_0x22ab26['name']){delete _0x22ab26[_0x9481('0x2e')];}_0x2e1eff[_0x9481('0x1b')](_0xe153ab)[_0x9481('0x2f')](_0x22ab26);};}exports['index']=function(_0x56752e,_0x1addc8){var _0x427c25={},_0x42df68={},_0x2b33f8={'count':0x0,'rows':[]};var _0x5d9926=_['map'](db['AnalyticDefaultReport'][_0x9481('0x30')],function(_0x5d6c65){return{'name':_0x5d6c65[_0x9481('0x31')],'type':_0x5d6c65['type'][_0x9481('0x32')]};});_0x42df68[_0x9481('0x33')]=_[_0x9481('0x34')](_0x5d9926,_0x9481('0x2e'));_0x42df68[_0x9481('0x35')]=_['keys'](_0x56752e[_0x9481('0x35')]);_0x42df68[_0x9481('0x36')]=_[_0x9481('0x37')](_0x42df68['model'],_0x42df68[_0x9481('0x35')]);_0x427c25[_0x9481('0x38')]=_[_0x9481('0x37')](_0x42df68[_0x9481('0x33')],qs[_0x9481('0x39')](_0x56752e[_0x9481('0x35')]['fields']));_0x427c25[_0x9481('0x38')]=_0x427c25['attributes'][_0x9481('0x3a')]?_0x427c25[_0x9481('0x38')]:_0x42df68[_0x9481('0x33')];if(!_0x56752e[_0x9481('0x35')][_0x9481('0x3b')](_0x9481('0x3c'))){_0x427c25['limit']=qs[_0x9481('0x20')](_0x56752e[_0x9481('0x35')]['limit']);_0x427c25['offset']=qs[_0x9481('0x1e')](_0x56752e['query'][_0x9481('0x1e')]);}_0x427c25[_0x9481('0x3d')]=qs[_0x9481('0x3e')](_0x56752e[_0x9481('0x35')]['sort']);_0x427c25[_0x9481('0x3f')]=qs['filters'](_[_0x9481('0x40')](_0x56752e['query'],_0x42df68[_0x9481('0x36')]),_0x5d9926);if(_0x56752e['query'][_0x9481('0x41')]){_0x427c25[_0x9481('0x3f')]=_[_0x9481('0x42')](_0x427c25[_0x9481('0x3f')],{'$or':_[_0x9481('0x34')](_0x5d9926,function(_0x3b7998){if(_0x3b7998[_0x9481('0x43')]!=='VIRTUAL'){var _0x464080={};_0x464080[_0x3b7998[_0x9481('0x2e')]]={'$like':'%'+_0x56752e[_0x9481('0x35')][_0x9481('0x41')]+'%'};return _0x464080;}})});}_0x427c25=_[_0x9481('0x42')]({},_0x427c25,_0x56752e[_0x9481('0x44')]);var _0x2e4241={'where':_0x427c25['where']};return db[_0x9481('0x45')][_0x9481('0x21')](_0x2e4241)['then'](function(_0x704e81){_0x2b33f8[_0x9481('0x21')]=_0x704e81;if(_0x56752e[_0x9481('0x35')][_0x9481('0x46')]){_0x427c25[_0x9481('0x47')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x9481('0x48')](_0x427c25);})['then'](function(_0x23811a){_0x2b33f8[_0x9481('0x49')]=_0x23811a;return _0x2b33f8;})['then'](respondWithFilteredResult(_0x1addc8,_0x427c25))['catch'](handleError(_0x1addc8,null));};exports[_0x9481('0x4a')]=function(_0x1d0df0,_0x42b19a){var _0x4c4caf={'raw':!![],'where':{'id':_0x1d0df0[_0x9481('0x4b')]['id']}},_0x4402f6={};_0x4402f6['model']=_['keys'](db[_0x9481('0x45')]['rawAttributes']);_0x4402f6[_0x9481('0x35')]=_[_0x9481('0x4c')](_0x1d0df0[_0x9481('0x35')]);_0x4402f6[_0x9481('0x36')]=_[_0x9481('0x37')](_0x4402f6['model'],_0x4402f6[_0x9481('0x35')]);_0x4c4caf[_0x9481('0x38')]=_['intersection'](_0x4402f6[_0x9481('0x33')],qs[_0x9481('0x39')](_0x1d0df0[_0x9481('0x35')][_0x9481('0x39')]));_0x4c4caf[_0x9481('0x38')]=_0x4c4caf[_0x9481('0x38')][_0x9481('0x3a')]?_0x4c4caf[_0x9481('0x38')]:_0x4402f6[_0x9481('0x33')];if(_0x1d0df0['query'][_0x9481('0x46')]){_0x4c4caf['include']=[{'all':!![]}];}_0x4c4caf=_['merge']({},_0x4c4caf,_0x1d0df0[_0x9481('0x44')]);return db['AnalyticDefaultReport'][_0x9481('0x4d')](_0x4c4caf)[_0x9481('0x27')](handleEntityNotFound(_0x42b19a,null))['then'](respondWithResult(_0x42b19a,null))[_0x9481('0x4e')](handleError(_0x42b19a,null));};exports[_0x9481('0x4f')]=function(_0x2f3413,_0x13b674){return db[_0x9481('0x45')][_0x9481('0x4f')](_0x2f3413['body'],{})['then'](function(_0x424b22){var _0x44d7e0=_0x2f3413[_0x9481('0x50')][_0x9481('0x28')]({'plain':!![]});if(!_0x44d7e0)throw new Error(_0x9481('0x51'));if(_0x44d7e0[_0x9481('0x52')]===_0x9481('0x50')){var _0x3d2250=_0x424b22['get']({'plain':!![]});var _0x3972c1=_0x9481('0x53');return db[_0x9481('0x54')][_0x9481('0x4d')]({'where':{'name':_0x3972c1,'userProfileId':_0x44d7e0[_0x9481('0x55')]},'raw':!![]})['then'](function(_0x4c3048){if(_0x4c3048&&_0x4c3048[_0x9481('0x56')]===0x0){return db[_0x9481('0x2a')][_0x9481('0x4f')]({'name':_0x3d2250['name'],'resourceId':_0x3d2250['id'],'type':'DefaultReports','sectionId':_0x4c3048['id']},{})['then'](function(){return _0x424b22;});}else{return _0x424b22;}})['catch'](function(_0x538507){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x538507);throw _0x538507;});}return _0x424b22;})[_0x9481('0x27')](respondWithResult(_0x13b674,0xc9))[_0x9481('0x4e')](handleError(_0x13b674,null));};exports['update']=function(_0xd8351c,_0x5f210c){if(_0xd8351c[_0x9481('0x57')]['id']){delete _0xd8351c[_0x9481('0x57')]['id'];}return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0xd8351c[_0x9481('0x4b')]['id']}})[_0x9481('0x27')](handleEntityNotFound(_0x5f210c,null))[_0x9481('0x27')](saveUpdates(_0xd8351c['body'],null))[_0x9481('0x27')](respondWithResult(_0x5f210c,null))[_0x9481('0x4e')](handleError(_0x5f210c,null));};exports['destroy']=function(_0x16416a,_0x1240dc){return db[_0x9481('0x45')][_0x9481('0x4d')]({'where':{'id':_0x16416a[_0x9481('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1240dc,null))[_0x9481('0x27')](removeEntity(_0x1240dc,null))[_0x9481('0x4e')](handleError(_0x1240dc,null));};exports[_0x9481('0x58')]=function(_0x3fc0f9,_0x559dd2){var _0x3ac428=0xa;var _0x2927f5=[_0x9481('0x59'),_0x9481('0x5a'),'right_join','cross_join'];var _0x5b4234={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x589b16={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x239676=function(_0x205b96){return!_['includes'](['IS\x20NULL',_0x9481('0x67'),'IS\x20EMPTY',_0x9481('0x68')],_0x205b96);};var _0x59637f=function(_0x9af916){if(!_0x9af916||!_0x9af916[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x492464='(',_0x28d331=0x0;_0x28d331<_0x9af916[_0x9481('0x69')]['length'];_0x28d331+=0x1){_0x28d331>0x0&&(_0x492464+='\x20'+_0x9af916['operator']+'\x20');_0x492464+=_0x9af916['rules'][_0x28d331]['group']?_0x59637f(_0x9af916[_0x9481('0x69')][_0x28d331]['group']):_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6a')]+'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331]['condition']+(_0x239676(_0x9af916[_0x9481('0x69')][_0x28d331]['condition'])?'\x20'+_0x9af916[_0x9481('0x69')][_0x28d331][_0x9481('0x6b')]:'');}return _0x492464+')';};var _0x3c267b={'where':{'id':_0x3fc0f9[_0x9481('0x4b')]['id']}},_0x4f157d,_0x2f20b4,_0x40fed2,_0x4ff016,_0x321972;_0x3c267b=_[_0x9481('0x42')]({},_0x3c267b,_0x3fc0f9[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x3c267b)[_0x9481('0x27')](function(_0x32ebde){if(_0x32ebde){_0x4f157d=_0x32ebde;return _0x32ebde[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x237d9b){if(_0x237d9b){if(!_0x237d9b[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x2f20b4=_0x237d9b;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})['then'](function(_0x1e05f8){if(_0x1e05f8){_0x40fed2=_['keyBy'](_0x1e05f8,'id');var _0x47bf37;var _0x1a7892=squel['select']();_0x1a7892['from'](_0x4f157d['table']);for(var _0x1b1967=0x0;_0x1b1967<_0x2f20b4[_0x9481('0x3a')];_0x1b1967+=0x1){_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x71')]?_0x40fed2[_0x2f20b4[_0x1b1967][_0x9481('0x71')]]['metric']:_0x2f20b4[_0x1b1967][_0x9481('0x6a')];_0x47bf37=_0x2f20b4[_0x1b1967][_0x9481('0x72')]?_[_0x9481('0x73')](_0x5b4234[_0x2f20b4[_0x1b1967][_0x9481('0x72')]],'%s',_0x47bf37):_0x47bf37;_0x47bf37=_0x2f20b4[_0x1b1967]['format']?_['replace'](_0x589b16[_0x2f20b4[_0x1b1967][_0x9481('0x74')]],'%s',_0x47bf37):_0x47bf37;if(_0x2f20b4[_0x1b1967][_0x9481('0x75')]){_0x1a7892[_0x9481('0x76')](_0x47bf37);}_0x2f20b4[_0x1b1967][_0x9481('0x77')]&&_0x1a7892[_0x9481('0x3d')](_0x47bf37,_0x2f20b4[_0x1b1967]['orderBy']===_0x9481('0x78')?![]:!![]);_0x1a7892[_0x9481('0x6a')](_0x47bf37,_0x2f20b4[_0x1b1967][_0x9481('0x79')]||_0x47bf37);}if(_0x4f157d[_0x9481('0x7a')]){_0x4f157d[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x4f157d[_0x9481('0x7a')]);for(var _0x42a6d2=0x0;_0x42a6d2<_0x4f157d[_0x9481('0x7a')][_0x9481('0x3a')];_0x42a6d2+=0x1){if(_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2927f5,_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')])&&_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7d')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7e')]&&_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x7f')]){_0x1a7892[_0x4f157d[_0x9481('0x7a')][_0x42a6d2][_0x9481('0x43')]](_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x4f157d['table'],_0x4f157d[_0x9481('0x7a')][_0x42a6d2]['parentKey'],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7e')],_0x4f157d['joins'][_0x42a6d2][_0x9481('0x7f')]));}}}if(_0x4f157d[_0x9481('0x80')]){_0x4f157d[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x4f157d['conditions']);_0x1a7892[_0x9481('0x3f')](_0x59637f(_0x4f157d['conditions'][_0x9481('0x76')]));}_0x321972=_0x1a7892[_0x9481('0x81')]();_0x1a7892[_0x9481('0x20')](_0x3ac428);_0x1a7892['offset'](0x0);logger['debug']('Limited\x20Query:',_0x1a7892[_0x9481('0x82')]());return dbH['sequelize']['query'](_0x1a7892[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')]['SELECT']});}})[_0x9481('0x27')](respondWithResult(_0x559dd2,null))[_0x9481('0x4e')](handleError(_0x559dd2,null));};function runReport(_0x545457,_0x226932,_0x3c8241){var _0x1ea93a=_0x226932[_0x9481('0x2e')];var _0x5f4be2=0xa;var _0x2e585d=['join',_0x9481('0x5a'),_0x9481('0x85'),'cross_join'];var _0x1c82a1={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x9481('0x5e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x55b428={'SEC_TO_TIME':_0x9481('0x86'),'DATE':_0x9481('0x63'),'HOUR':_0x9481('0x64'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9481('0x66')};var _0x31e097=function(_0x339a30){return!_[_0x9481('0x7c')]([_0x9481('0x87'),_0x9481('0x67'),_0x9481('0x88'),_0x9481('0x68')],_0x339a30);};var _0x22e787=function(_0x31b70b){if(!_0x31b70b||!_0x31b70b['rules'][_0x9481('0x3a')]){return'';}for(var _0x5c430e='(',_0x4f55b5=0x0;_0x4f55b5<_0x31b70b['rules'][_0x9481('0x3a')];_0x4f55b5+=0x1){_0x4f55b5>0x0&&(_0x5c430e+='\x20'+_0x31b70b[_0x9481('0x89')]+'\x20');_0x5c430e+=_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x76')]?_0x22e787(_0x31b70b[_0x9481('0x69')][_0x4f55b5]['group']):_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6a')]+'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')]+(_0x31e097(_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x8a')])?'\x20'+_0x31b70b[_0x9481('0x69')][_0x4f55b5][_0x9481('0x6b')]:'');}return _0x5c430e+')';};var _0x28d924={'where':{'id':_0x545457['id']}},_0x426d56,_0x5808c8,_0x27be69,_0x1d49ba,_0x458a6f;_0x28d924=_[_0x9481('0x42')]({},_0x28d924,_0x3c8241);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x28d924)[_0x9481('0x27')](function(_0x1173e9){if(_0x1173e9){_0x426d56=_0x1173e9;return _0x1173e9[_0x9481('0x6c')]();}return null;})[_0x9481('0x27')](function(_0x5557d7){if(_0x5557d7){if(!_0x5557d7[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x5808c8=_0x5557d7;return db[_0x9481('0x70')][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x3ae3e2){if(_0x3ae3e2){_0x27be69=_[_0x9481('0x8b')](_0x3ae3e2,'id');var _0x538fe0;var _0x44e2c2=squel['select']();_0x44e2c2['from'](_0x426d56[_0x9481('0x8c')]);for(var _0x382455=0x0;_0x382455<_0x5808c8[_0x9481('0x3a')];_0x382455+=0x1){_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x71')]?_0x27be69[_0x5808c8[_0x382455][_0x9481('0x71')]][_0x9481('0x8d')]:_0x5808c8[_0x382455]['field'];_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x72')]?_['replace'](_0x1c82a1[_0x5808c8[_0x382455][_0x9481('0x72')]],'%s',_0x538fe0):_0x538fe0;_0x538fe0=_0x5808c8[_0x382455][_0x9481('0x74')]?_[_0x9481('0x73')](_0x55b428[_0x5808c8[_0x382455]['format']],'%s',_0x538fe0):_0x538fe0;if(_0x5808c8[_0x382455]['groupBy']){_0x44e2c2[_0x9481('0x76')](_0x538fe0);}_0x5808c8[_0x382455][_0x9481('0x77')]&&_0x44e2c2[_0x9481('0x3d')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x44e2c2[_0x9481('0x6a')](_0x538fe0,_0x5808c8[_0x382455][_0x9481('0x79')]||_0x538fe0);}if(_0x426d56[_0x9481('0x7a')]){_0x426d56[_0x9481('0x7a')]=JSON['parse'](_0x426d56[_0x9481('0x7a')]);for(var _0xd64114=0x0;_0xd64114<_0x426d56['joins'][_0x9481('0x3a')];_0xd64114+=0x1){if(_0x426d56['joins'][_0xd64114][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x2e585d,_0x426d56['joins'][_0xd64114][_0x9481('0x43')])&&_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')]&&_0x426d56['joins'][_0xd64114][_0x9481('0x7e')]&&_0x426d56[_0x9481('0x7a')][_0xd64114]['foreignKey']){_0x44e2c2[_0x426d56[_0x9481('0x7a')][_0xd64114]['type']](_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x426d56['table'],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7d')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7e')],_0x426d56[_0x9481('0x7a')][_0xd64114][_0x9481('0x7f')]));}}}if(_0x426d56['conditions']){_0x426d56[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x426d56[_0x9481('0x80')]);_0x44e2c2[_0x9481('0x3f')](_0x22e787(_0x426d56[_0x9481('0x80')][_0x9481('0x76')]));}_0x458a6f=_0x44e2c2[_0x9481('0x81')]();_0x44e2c2['limit'](_0x5f4be2);_0x44e2c2[_0x9481('0x1e')](0x0);return;}})[_0x9481('0x27')](function(){if(_0x226932[_0x9481('0x8e')]===_0x9481('0x8f')){return null;}var _0x4e5a8d=_[_0x9481('0x42')](_0x226932,{'name':_0x226932[_0x9481('0x90')]||_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],'basename':_0x1ea93a,'savename':util['format'](_0x9481('0x91'),_0x226932[_0x9481('0x2e')]||_0x426d56[_0x9481('0x2e')],require(_0x9481('0x92'))[_0x9481('0x93')](0x4),_0x226932[_0x9481('0x8e')]||_0x9481('0x94')),'reportId':_0x426d56['id'],'reportType':_0x9481('0x95')});return db[_0x9481('0x96')][_0x9481('0x4f')](_0x4e5a8d,{'raw':!![]});})[_0x9481('0x27')](function(_0x5930d6){if(_0x426d56[_0x9481('0x8c')]==='cdr'){_0x458a6f[_0x9481('0x3f')](_0x426d56[_0x9481('0x8c')]+_0x9481('0x97'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}else{_0x458a6f['where'](_0x426d56[_0x9481('0x8c')]+_0x9481('0x9a'),_0x226932[_0x9481('0x98')],_0x226932[_0x9481('0x99')]);}if(_0x5930d6){logger[_0x9481('0x9b')](_0x9481('0x9c'),_0x458a6f['toString']());require(_0x9481('0x9d'))[_0x9481('0x9e')](path[_0x9481('0x59')](__dirname,_0x9481('0x9f'),_0x5930d6[_0x9481('0x8e')]),[_0x5930d6['id'],_0x458a6f[_0x9481('0x82')](),path[_0x9481('0x59')](__dirname,_0x9481('0xa0'),_0x5930d6[_0x9481('0xa1')]),_0x1ea93a]);return _0x5930d6;}else{var _0x26a666=squel[_0x9481('0xa2')]();_0x26a666[_0x9481('0xa3')]('('+_0x458a6f['toString']()+')',_0x9481('0xa4'));_0x26a666[_0x9481('0x6a')](_0x9481('0xa5'),_0x9481('0x21'));_0x458a6f[_0x9481('0x20')](_0x226932[_0x9481('0x20')]||_0x5f4be2);_0x458a6f[_0x9481('0x1e')](_0x226932[_0x9481('0x1e')]||0x0);return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x26a666[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]})[_0x9481('0x27')](function(_0xcf83d2){if(!_0xcf83d2[_0x9481('0x3a')]){_0x1d49ba=0x0;}else{_0x1d49ba=_0xcf83d2[0x0][_0x9481('0x21')]||0x0;}return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x458a6f['toString'](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});})[_0x9481('0x27')](function(_0x4553fc){return{'rows':_0x4553fc||[],'count':_0x1d49ba};});}});}exports[_0x9481('0xa7')]=function(_0x55c4ab,_0x57928a){return runReport(_0x55c4ab[_0x9481('0x4b')],_0x55c4ab[_0x9481('0x35')],_0x55c4ab[_0x9481('0x44')])[_0x9481('0x27')](respondWithResult(_0x57928a,null))['catch'](handleError(_0x57928a,null));};exports['runReport']=runReport;exports['query']=function(_0x52b980,_0x5792b1){var _0x3a199b=0xa;var _0x4b779b=[_0x9481('0x59'),_0x9481('0x5a'),_0x9481('0x85'),_0x9481('0xa8')];var _0x55a65f={'SUM':_0x9481('0x5b'),'COUNT':_0x9481('0x5c'),'COUNT DISTINCT':_0x9481('0xa9'),'MAX':_0x9481('0x5d'),'MIN':_0x9481('0x5e'),'AVG':_0x9481('0x5f'),'GROUP_CONCAT':_0x9481('0x60'),'GROUP_CONCAT ASC':_0x9481('0x61'),'GROUP_CONCAT DESC':_0x9481('0x62')};var _0x583490={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x9481('0x63'),'HOUR':'HOUR(%s)','ROUND':_0x9481('0x65'),'UNIX_TIMESTAMP':_0x9481('0x66')};var _0x1e40fe=function(_0x26c87b){return!_[_0x9481('0x7c')](['IS\x20NULL',_0x9481('0x67'),_0x9481('0x88'),'IS\x20NOT\x20EMPTY'],_0x26c87b);};var _0x4ea411=function(_0x1cdca0){if(!_0x1cdca0||!_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')]){return'';}for(var _0x15c53f='(',_0x7ee854=0x0;_0x7ee854<_0x1cdca0[_0x9481('0x69')][_0x9481('0x3a')];_0x7ee854+=0x1){_0x7ee854>0x0&&(_0x15c53f+='\x20'+_0x1cdca0[_0x9481('0x89')]+'\x20');_0x15c53f+=_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x76')]?_0x4ea411(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x76')]):_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x6a')]+'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854][_0x9481('0x8a')]+(_0x1e40fe(_0x1cdca0['rules'][_0x7ee854][_0x9481('0x8a')])?'\x20'+_0x1cdca0[_0x9481('0x69')][_0x7ee854]['value']:'');}return _0x15c53f+')';};var _0x49a6db={'where':{'id':_0x52b980['params']['id']}},_0x224b16,_0x83543f,_0x58c043,_0x97a67a,_0xe157e4;_0x49a6db=_[_0x9481('0x42')]({},_0x49a6db,_0x52b980[_0x9481('0x44')]);return db[_0x9481('0x45')][_0x9481('0x4d')](_0x49a6db)['then'](function(_0x1a1058){if(_0x1a1058){_0x224b16=_0x1a1058;return _0x1a1058['getFields']();}return null;})[_0x9481('0x27')](function(_0x206661){if(_0x206661){if(!_0x206661[_0x9481('0x3a')]){throw new db[(_0x9481('0x6d'))][(_0x9481('0x6e'))](_0x9481('0x6f'),0x193);}_0x83543f=_0x206661;return db['AnalyticMetric'][_0x9481('0x48')]({'raw':!![]});}return null;})[_0x9481('0x27')](function(_0x40cdf9){if(_0x40cdf9){_0x58c043=_['keyBy'](_0x40cdf9,'id');var _0x5467fe;var _0x440d88=squel['select']();_0x440d88[_0x9481('0xa3')](_0x224b16['table']);for(var _0x2a0367=0x0;_0x2a0367<_0x83543f[_0x9481('0x3a')];_0x2a0367+=0x1){_0x5467fe=_0x83543f[_0x2a0367]['MetricId']?_0x58c043[_0x83543f[_0x2a0367][_0x9481('0x71')]][_0x9481('0x8d')]:_0x83543f[_0x2a0367][_0x9481('0x6a')];_0x5467fe=_0x83543f[_0x2a0367]['function']?_[_0x9481('0x73')](_0x55a65f[_0x83543f[_0x2a0367][_0x9481('0x72')]],'%s',_0x5467fe):_0x5467fe;_0x5467fe=_0x83543f[_0x2a0367][_0x9481('0x74')]?_[_0x9481('0x73')](_0x583490[_0x83543f[_0x2a0367][_0x9481('0x74')]],'%s',_0x5467fe):_0x5467fe;if(_0x83543f[_0x2a0367][_0x9481('0x75')]){_0x440d88[_0x9481('0x76')](_0x5467fe);}_0x83543f[_0x2a0367]['orderBy']&&_0x440d88[_0x9481('0x3d')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x77')]===_0x9481('0x78')?![]:!![]);_0x440d88[_0x9481('0x6a')](_0x5467fe,_0x83543f[_0x2a0367][_0x9481('0x79')]||_0x5467fe);}if(_0x224b16['joins']){_0x224b16[_0x9481('0x7a')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x7a')]);for(var _0x527ef6=0x0;_0x527ef6<_0x224b16['joins'][_0x9481('0x3a')];_0x527ef6+=0x1){if(_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]&&_[_0x9481('0x7c')](_0x4b779b,_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')])&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7d')]&&_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')]&&_0x224b16['joins'][_0x527ef6][_0x9481('0x7f')]){_0x440d88[_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x43')]](_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],null,util[_0x9481('0x74')]('%s.%s\x20=\x20%s.%s',_0x224b16[_0x9481('0x8c')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['parentKey'],_0x224b16[_0x9481('0x7a')][_0x527ef6][_0x9481('0x7e')],_0x224b16[_0x9481('0x7a')][_0x527ef6]['foreignKey']));}}}if(_0x224b16[_0x9481('0x80')]){_0x224b16[_0x9481('0x80')]=JSON[_0x9481('0x7b')](_0x224b16[_0x9481('0x80')]);_0x440d88['where'](_0x4ea411(_0x224b16[_0x9481('0x80')][_0x9481('0x76')]));}_0xe157e4=_0x440d88[_0x9481('0x81')]();_0x440d88[_0x9481('0x20')](_0x3a199b);_0x440d88['offset'](0x0);logger[_0x9481('0xaa')](_0x9481('0xab'),_0x440d88[_0x9481('0x82')]());return dbH[_0x9481('0x83')][_0x9481('0x35')](_0x440d88[_0x9481('0x82')](),{'type':dbH[_0x9481('0x83')][_0x9481('0x84')][_0x9481('0xa6')]});}})[_0x9481('0x27')](function(){return{'sql':_0xe157e4['toString']()};})[_0x9481('0x27')](respondWithResult(_0x5792b1,null))[_0x9481('0x4e')](handleError(_0x5792b1,null));}; \ No newline at end of file +var _0x2675=['AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','find','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','table','MetricId','metric','field','function','replace','format','groupBy','order','orderBy','DESC','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','right_join','SEC_TO_TIME(%s)','IS\x20EMPTY','Sequelize','keyBy','from','alias','output','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','COUNT(*)','SELECT','run','runReport','MIN(%s)','debug','eml-format','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','DefaultReports','name','map'];(function(_0xd3cc19,_0x491934){var _0xf69125=function(_0x4c380e){while(--_0x4c380e){_0xd3cc19['push'](_0xd3cc19['shift']());}};_0xf69125(++_0x491934);}(_0x2675,0x75));var _0x5267=function(_0x1cedfd,_0x2a4c73){_0x1cedfd=_0x1cedfd-0x0;var _0x4b854c=_0x2675[_0x1cedfd];return _0x4b854c;};'use strict';var emlformat=require(_0x5267('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5267('0x1'));var moment=require(_0x5267('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x5267('0x3'));var util=require(_0x5267('0x4'));var path=require('path');var sox=require(_0x5267('0x5'));var csv=require(_0x5267('0x6'));var ejs=require(_0x5267('0x7'));var fs=require('fs');var fs_extra=require(_0x5267('0x8'));var _=require(_0x5267('0x9'));var squel=require(_0x5267('0xa'));var crypto=require('crypto');var jsforce=require(_0x5267('0xb'));var deskjs=require(_0x5267('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5267('0xd'));var Papa=require('papaparse');var Redis=require(_0x5267('0xe'));var authService=require(_0x5267('0xf'));var qs=require(_0x5267('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5267('0x11'));var logger=require('../../config/logger')(_0x5267('0x12'));var utils=require('../../config/utils');var config=require(_0x5267('0x13'));var licenseUtil=require(_0x5267('0x14'));var db=require(_0x5267('0x15'))['db'];var dbH=require(_0x5267('0x15'))[_0x5267('0x16')];function respondWithStatusCode(_0x1171b9,_0x20785c){_0x20785c=_0x20785c||0xcc;return function(_0x36dc17){if(_0x36dc17){return _0x1171b9[_0x5267('0x17')](_0x20785c);}return _0x1171b9[_0x5267('0x18')](_0x20785c)[_0x5267('0x19')]();};}function respondWithResult(_0x29349a,_0x3e2bab){_0x3e2bab=_0x3e2bab||0xc8;return function(_0x548040){if(_0x548040){return _0x29349a['status'](_0x3e2bab)[_0x5267('0x1a')](_0x548040);}};}function respondWithFilteredResult(_0x40d897,_0x38a147){return function(_0x3f5344){if(_0x3f5344){var _0x46b2c2=typeof _0x38a147[_0x5267('0x1b')]===_0x5267('0x1c')&&typeof _0x38a147[_0x5267('0x1d')]===_0x5267('0x1c');var _0xb1c97a=_0x3f5344[_0x5267('0x1e')];var _0x1ab03=_0x46b2c2?0x0:_0x38a147['offset'];var _0x18f32e=_0x46b2c2?_0x3f5344[_0x5267('0x1e')]:_0x38a147['offset']+_0x38a147[_0x5267('0x1d')];var _0x56733e;if(_0x18f32e>=_0xb1c97a){_0x18f32e=_0xb1c97a;_0x56733e=0xc8;}else{_0x56733e=0xce;}_0x40d897[_0x5267('0x18')](_0x56733e);return _0x40d897[_0x5267('0x1f')](_0x5267('0x20'),_0x1ab03+'-'+_0x18f32e+'/'+_0xb1c97a)[_0x5267('0x1a')](_0x3f5344);}return null;};}function patchUpdates(_0x5ca9c6){return function(_0x4dd637){try{jsonpatch[_0x5267('0x21')](_0x4dd637,_0x5ca9c6,!![]);}catch(_0x5aebdd){return BPromise[_0x5267('0x22')](_0x5aebdd);}return _0x4dd637[_0x5267('0x23')]();};}function saveUpdates(_0x3b53ac,_0x56dd95){return function(_0x499f19){if(_0x499f19){return _0x499f19['update'](_0x3b53ac)['then'](function(_0x5ea6a6){return _0x5ea6a6;});}return null;};}function removeEntity(_0x26c7f8,_0x399e64){return function(_0x2d761d){if(_0x2d761d){return _0x2d761d[_0x5267('0x24')]()[_0x5267('0x25')](function(){var _0x40d1be=_0x2d761d[_0x5267('0x26')]({'plain':!![]});var _0x220e03=_0x5267('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x220e03,'resourceId':_0x40d1be['id']}})[_0x5267('0x25')](function(){return _0x2d761d;});})[_0x5267('0x25')](function(){_0x26c7f8['status'](0xcc)[_0x5267('0x19')]();});}};}function handleEntityNotFound(_0x52504e,_0x4d7c2a){return function(_0x43e7e7){if(!_0x43e7e7){_0x52504e[_0x5267('0x17')](0x194);}return _0x43e7e7;};}function handleError(_0x1f33b7,_0x2d2ace){_0x2d2ace=_0x2d2ace||0x1f4;return function(_0x33c431){logger['error'](_0x33c431['stack']);if(_0x33c431[_0x5267('0x28')]){delete _0x33c431[_0x5267('0x28')];}_0x1f33b7[_0x5267('0x18')](_0x2d2ace)['send'](_0x33c431);};}exports['index']=function(_0xbe7922,_0x3ef2a8){var _0x1fa725={},_0x5bec7e={},_0x59b091={'count':0x0,'rows':[]};var _0x2249a1=_[_0x5267('0x29')](db[_0x5267('0x2a')][_0x5267('0x2b')],function(_0x5bbb83){return{'name':_0x5bbb83[_0x5267('0x2c')],'type':_0x5bbb83[_0x5267('0x2d')][_0x5267('0x2e')]};});_0x5bec7e[_0x5267('0x2f')]=_[_0x5267('0x29')](_0x2249a1,_0x5267('0x28'));_0x5bec7e[_0x5267('0x30')]=_[_0x5267('0x31')](_0xbe7922['query']);_0x5bec7e['filters']=_[_0x5267('0x32')](_0x5bec7e['model'],_0x5bec7e[_0x5267('0x30')]);_0x1fa725[_0x5267('0x33')]=_[_0x5267('0x32')](_0x5bec7e[_0x5267('0x2f')],qs['fields'](_0xbe7922[_0x5267('0x30')][_0x5267('0x34')]));_0x1fa725[_0x5267('0x33')]=_0x1fa725[_0x5267('0x33')][_0x5267('0x35')]?_0x1fa725[_0x5267('0x33')]:_0x5bec7e[_0x5267('0x2f')];if(!_0xbe7922[_0x5267('0x30')]['hasOwnProperty'](_0x5267('0x36'))){_0x1fa725['limit']=qs[_0x5267('0x1d')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1d')]);_0x1fa725[_0x5267('0x1b')]=qs[_0x5267('0x1b')](_0xbe7922[_0x5267('0x30')][_0x5267('0x1b')]);}_0x1fa725['order']=qs[_0x5267('0x37')](_0xbe7922[_0x5267('0x30')][_0x5267('0x37')]);_0x1fa725[_0x5267('0x38')]=qs[_0x5267('0x39')](_[_0x5267('0x3a')](_0xbe7922[_0x5267('0x30')],_0x5bec7e['filters']),_0x2249a1);if(_0xbe7922[_0x5267('0x30')]['filter']){_0x1fa725[_0x5267('0x38')]=_['merge'](_0x1fa725['where'],{'$or':_['map'](_0x2249a1,function(_0x46bfcc){if(_0x46bfcc['type']!==_0x5267('0x3b')){var _0x146476={};_0x146476[_0x46bfcc[_0x5267('0x28')]]={'$like':'%'+_0xbe7922[_0x5267('0x30')]['filter']+'%'};return _0x146476;}})});}_0x1fa725=_[_0x5267('0x3c')]({},_0x1fa725,_0xbe7922[_0x5267('0x3d')]);var _0x588edf={'where':_0x1fa725['where']};return db[_0x5267('0x2a')]['count'](_0x588edf)[_0x5267('0x25')](function(_0x1cf94a){_0x59b091[_0x5267('0x1e')]=_0x1cf94a;if(_0xbe7922[_0x5267('0x30')][_0x5267('0x3e')]){_0x1fa725[_0x5267('0x3f')]=[{'all':!![]}];}return db[_0x5267('0x2a')]['findAll'](_0x1fa725);})['then'](function(_0x28ea4a){_0x59b091['rows']=_0x28ea4a;return _0x59b091;})[_0x5267('0x25')](respondWithFilteredResult(_0x3ef2a8,_0x1fa725))[_0x5267('0x40')](handleError(_0x3ef2a8,null));};exports['show']=function(_0x1fa925,_0xc764cd){var _0x299a13={'raw':!![],'where':{'id':_0x1fa925[_0x5267('0x41')]['id']}},_0x161fed={};_0x161fed[_0x5267('0x2f')]=_[_0x5267('0x31')](db[_0x5267('0x2a')][_0x5267('0x2b')]);_0x161fed['query']=_[_0x5267('0x31')](_0x1fa925[_0x5267('0x30')]);_0x161fed[_0x5267('0x39')]=_[_0x5267('0x32')](_0x161fed[_0x5267('0x2f')],_0x161fed['query']);_0x299a13[_0x5267('0x33')]=_['intersection'](_0x161fed[_0x5267('0x2f')],qs['fields'](_0x1fa925['query'][_0x5267('0x34')]));_0x299a13['attributes']=_0x299a13[_0x5267('0x33')][_0x5267('0x35')]?_0x299a13[_0x5267('0x33')]:_0x161fed[_0x5267('0x2f')];if(_0x1fa925['query'][_0x5267('0x3e')]){_0x299a13['include']=[{'all':!![]}];}_0x299a13=_['merge']({},_0x299a13,_0x1fa925[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x299a13)['then'](handleEntityNotFound(_0xc764cd,null))[_0x5267('0x25')](respondWithResult(_0xc764cd,null))[_0x5267('0x40')](handleError(_0xc764cd,null));};exports[_0x5267('0x42')]=function(_0x1b5a7e,_0x1c2803){return db[_0x5267('0x2a')][_0x5267('0x42')](_0x1b5a7e[_0x5267('0x43')],{})[_0x5267('0x25')](function(_0x2cfe09){var _0x21b040=_0x1b5a7e[_0x5267('0x44')][_0x5267('0x26')]({'plain':!![]});if(!_0x21b040)throw new Error(_0x5267('0x45'));if(_0x21b040['role']===_0x5267('0x44')){var _0x466d46=_0x2cfe09[_0x5267('0x26')]({'plain':!![]});var _0x4f0148=_0x5267('0x46');return db[_0x5267('0x47')][_0x5267('0x48')]({'where':{'name':_0x4f0148,'userProfileId':_0x21b040[_0x5267('0x49')]},'raw':!![]})[_0x5267('0x25')](function(_0x1457cf){if(_0x1457cf&&_0x1457cf['autoAssociation']===0x0){return db[_0x5267('0x4a')]['create']({'name':_0x466d46[_0x5267('0x28')],'resourceId':_0x466d46['id'],'type':_0x5267('0x27'),'sectionId':_0x1457cf['id']},{})[_0x5267('0x25')](function(){return _0x2cfe09;});}else{return _0x2cfe09;}})[_0x5267('0x40')](function(_0x91b932){logger[_0x5267('0x4b')](_0x5267('0x4c'),_0x91b932);throw _0x91b932;});}return _0x2cfe09;})['then'](respondWithResult(_0x1c2803,0xc9))['catch'](handleError(_0x1c2803,null));};exports[_0x5267('0x4d')]=function(_0x15b5c9,_0x566b6f){if(_0x15b5c9[_0x5267('0x43')]['id']){delete _0x15b5c9['body']['id'];}return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0x15b5c9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x566b6f,null))[_0x5267('0x25')](saveUpdates(_0x15b5c9[_0x5267('0x43')],null))[_0x5267('0x25')](respondWithResult(_0x566b6f,null))[_0x5267('0x40')](handleError(_0x566b6f,null));};exports[_0x5267('0x24')]=function(_0xf0b5a9,_0x43d254){return db['AnalyticDefaultReport'][_0x5267('0x48')]({'where':{'id':_0xf0b5a9[_0x5267('0x41')]['id']}})[_0x5267('0x25')](handleEntityNotFound(_0x43d254,null))[_0x5267('0x25')](removeEntity(_0x43d254,null))[_0x5267('0x40')](handleError(_0x43d254,null));};exports[_0x5267('0x4e')]=function(_0x552211,_0x195575){var _0x5ad1ce=0xa;var _0x1522d6=[_0x5267('0x4f'),_0x5267('0x50'),'right_join',_0x5267('0x51')];var _0x161dab={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x51220c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x4e3771=function(_0x489780){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),'IS\x20EMPTY',_0x5267('0x60')],_0x489780);};var _0xc88193=function(_0x293e61){if(!_0x293e61||!_0x293e61[_0x5267('0x61')]['length']){return'';}for(var _0x5a87b5='(',_0x540ab8=0x0;_0x540ab8<_0x293e61[_0x5267('0x61')][_0x5267('0x35')];_0x540ab8+=0x1){_0x540ab8>0x0&&(_0x5a87b5+='\x20'+_0x293e61[_0x5267('0x62')]+'\x20');_0x5a87b5+=_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]?_0xc88193(_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x63')]):_0x293e61[_0x5267('0x61')][_0x540ab8]['field']+'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x64')]+(_0x4e3771(_0x293e61['rules'][_0x540ab8][_0x5267('0x64')])?'\x20'+_0x293e61[_0x5267('0x61')][_0x540ab8][_0x5267('0x65')]:'');}return _0x5a87b5+')';};var _0x1b6dd7={'where':{'id':_0x552211[_0x5267('0x41')]['id']}},_0x19adf5,_0xde1ecd,_0x4915f4,_0x2ca259,_0x726410;_0x1b6dd7=_[_0x5267('0x3c')]({},_0x1b6dd7,_0x552211[_0x5267('0x3d')]);return db[_0x5267('0x2a')]['find'](_0x1b6dd7)[_0x5267('0x25')](function(_0x87465){if(_0x87465){_0x19adf5=_0x87465;return _0x87465[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x1a4016){if(_0x1a4016){if(!_0x1a4016[_0x5267('0x35')]){throw new db['Sequelize'][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0xde1ecd=_0x1a4016;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x516e6e){if(_0x516e6e){_0x4915f4=_['keyBy'](_0x516e6e,'id');var _0x910f97;var _0x5cca85=squel[_0x5267('0x6b')]();_0x5cca85['from'](_0x19adf5[_0x5267('0x6c')]);for(var _0x1150ba=0x0;_0x1150ba<_0xde1ecd[_0x5267('0x35')];_0x1150ba+=0x1){_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x6d')]?_0x4915f4[_0xde1ecd[_0x1150ba][_0x5267('0x6d')]][_0x5267('0x6e')]:_0xde1ecd[_0x1150ba][_0x5267('0x6f')];_0x910f97=_0xde1ecd[_0x1150ba][_0x5267('0x70')]?_['replace'](_0x161dab[_0xde1ecd[_0x1150ba]['function']],'%s',_0x910f97):_0x910f97;_0x910f97=_0xde1ecd[_0x1150ba]['format']?_[_0x5267('0x71')](_0x51220c[_0xde1ecd[_0x1150ba][_0x5267('0x72')]],'%s',_0x910f97):_0x910f97;if(_0xde1ecd[_0x1150ba][_0x5267('0x73')]){_0x5cca85[_0x5267('0x63')](_0x910f97);}_0xde1ecd[_0x1150ba]['orderBy']&&_0x5cca85[_0x5267('0x74')](_0x910f97,_0xde1ecd[_0x1150ba][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x5cca85[_0x5267('0x6f')](_0x910f97,_0xde1ecd[_0x1150ba]['alias']||_0x910f97);}if(_0x19adf5[_0x5267('0x77')]){_0x19adf5[_0x5267('0x77')]=JSON['parse'](_0x19adf5[_0x5267('0x77')]);for(var _0x268805=0x0;_0x268805<_0x19adf5['joins']['length'];_0x268805+=0x1){if(_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x2d')]&&_['includes'](_0x1522d6,_0x19adf5['joins'][_0x268805][_0x5267('0x2d')])&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')]&&_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')]&&_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]){_0x5cca85[_0x19adf5[_0x5267('0x77')][_0x268805]['type']](_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x19adf5[_0x5267('0x6c')],_0x19adf5[_0x5267('0x77')][_0x268805][_0x5267('0x78')],_0x19adf5[_0x5267('0x77')][_0x268805]['foreignTable'],_0x19adf5['joins'][_0x268805][_0x5267('0x7a')]));}}}if(_0x19adf5[_0x5267('0x7c')]){_0x19adf5[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x19adf5['conditions']);_0x5cca85[_0x5267('0x38')](_0xc88193(_0x19adf5['conditions'][_0x5267('0x63')]));}_0x726410=_0x5cca85[_0x5267('0x7e')]();_0x5cca85[_0x5267('0x1d')](_0x5ad1ce);_0x5cca85[_0x5267('0x1b')](0x0);logger['debug']('Limited\x20Query:',_0x5cca85[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x5cca85[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')]['SELECT']});}})[_0x5267('0x25')](respondWithResult(_0x195575,null))['catch'](handleError(_0x195575,null));};function runReport(_0x418a03,_0x5b8026,_0x2c2b95){var _0x20888d=_0x5b8026[_0x5267('0x28')];var _0x87aa90=0xa;var _0x164cc1=[_0x5267('0x4f'),_0x5267('0x50'),_0x5267('0x82'),_0x5267('0x51')];var _0x28e4b6={'SUM':_0x5267('0x52'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':'MIN(%s)','AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0xd18795={'SEC_TO_TIME':_0x5267('0x83'),'DATE':_0x5267('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x2543a4=function(_0x2feea8){return!_[_0x5267('0x5d')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5267('0x84'),_0x5267('0x60')],_0x2feea8);};var _0x199ff6=function(_0xbf36fb){if(!_0xbf36fb||!_0xbf36fb['rules'][_0x5267('0x35')]){return'';}for(var _0x3cc775='(',_0x2630f2=0x0;_0x2630f2<_0xbf36fb[_0x5267('0x61')][_0x5267('0x35')];_0x2630f2+=0x1){_0x2630f2>0x0&&(_0x3cc775+='\x20'+_0xbf36fb[_0x5267('0x62')]+'\x20');_0x3cc775+=_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]?_0x199ff6(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x63')]):_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x6f')]+'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2]['condition']+(_0x2543a4(_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x64')])?'\x20'+_0xbf36fb[_0x5267('0x61')][_0x2630f2][_0x5267('0x65')]:'');}return _0x3cc775+')';};var _0x447b5f={'where':{'id':_0x418a03['id']}},_0x25ce90,_0x257c69,_0x160c9c,_0x42694a,_0x11a2f4;_0x447b5f=_[_0x5267('0x3c')]({},_0x447b5f,_0x2c2b95);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x447b5f)[_0x5267('0x25')](function(_0x35c3b7){if(_0x35c3b7){_0x25ce90=_0x35c3b7;return _0x35c3b7[_0x5267('0x66')]();}return null;})[_0x5267('0x25')](function(_0x35a4a3){if(_0x35a4a3){if(!_0x35a4a3[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))][(_0x5267('0x67'))](_0x5267('0x68'),0x193);}_0x257c69=_0x35a4a3;return db[_0x5267('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x318393){if(_0x318393){_0x160c9c=_[_0x5267('0x86')](_0x318393,'id');var _0x405eb4;var _0x38f5b7=squel['select']();_0x38f5b7[_0x5267('0x87')](_0x25ce90[_0x5267('0x6c')]);for(var _0x4c68cd=0x0;_0x4c68cd<_0x257c69['length'];_0x4c68cd+=0x1){_0x405eb4=_0x257c69[_0x4c68cd]['MetricId']?_0x160c9c[_0x257c69[_0x4c68cd][_0x5267('0x6d')]]['metric']:_0x257c69[_0x4c68cd][_0x5267('0x6f')];_0x405eb4=_0x257c69[_0x4c68cd]['function']?_['replace'](_0x28e4b6[_0x257c69[_0x4c68cd][_0x5267('0x70')]],'%s',_0x405eb4):_0x405eb4;_0x405eb4=_0x257c69[_0x4c68cd][_0x5267('0x72')]?_[_0x5267('0x71')](_0xd18795[_0x257c69[_0x4c68cd][_0x5267('0x72')]],'%s',_0x405eb4):_0x405eb4;if(_0x257c69[_0x4c68cd][_0x5267('0x73')]){_0x38f5b7['group'](_0x405eb4);}_0x257c69[_0x4c68cd]['orderBy']&&_0x38f5b7[_0x5267('0x74')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x38f5b7[_0x5267('0x6f')](_0x405eb4,_0x257c69[_0x4c68cd][_0x5267('0x88')]||_0x405eb4);}if(_0x25ce90['joins']){_0x25ce90[_0x5267('0x77')]=JSON['parse'](_0x25ce90['joins']);for(var _0x3dfd8d=0x0;_0x3dfd8d<_0x25ce90['joins']['length'];_0x3dfd8d+=0x1){if(_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x2d')]&&_['includes'](_0x164cc1,_0x25ce90['joins'][_0x3dfd8d]['type'])&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['parentKey']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable']&&_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x7a')]){_0x38f5b7[_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x2d')]](_0x25ce90[_0x5267('0x77')][_0x3dfd8d][_0x5267('0x79')],null,util[_0x5267('0x72')](_0x5267('0x7b'),_0x25ce90[_0x5267('0x6c')],_0x25ce90['joins'][_0x3dfd8d]['parentKey'],_0x25ce90[_0x5267('0x77')][_0x3dfd8d]['foreignTable'],_0x25ce90['joins'][_0x3dfd8d][_0x5267('0x7a')]));}}}if(_0x25ce90['conditions']){_0x25ce90[_0x5267('0x7c')]=JSON['parse'](_0x25ce90[_0x5267('0x7c')]);_0x38f5b7['where'](_0x199ff6(_0x25ce90[_0x5267('0x7c')][_0x5267('0x63')]));}_0x11a2f4=_0x38f5b7[_0x5267('0x7e')]();_0x38f5b7[_0x5267('0x1d')](_0x87aa90);_0x38f5b7[_0x5267('0x1b')](0x0);return;}})[_0x5267('0x25')](function(){if(_0x5b8026[_0x5267('0x89')]==='web'){return null;}var _0x4df99f=_[_0x5267('0x3c')](_0x5b8026,{'name':_0x5b8026['fullPath']||_0x5b8026['name']||_0x25ce90['name'],'basename':_0x20888d,'savename':util['format']('%s-%s.%s',_0x5b8026['name']||_0x25ce90[_0x5267('0x28')],require(_0x5267('0x8a'))[_0x5267('0x8b')](0x4),_0x5b8026[_0x5267('0x89')]||_0x5267('0x8c')),'reportId':_0x25ce90['id'],'reportType':_0x5267('0x8d')});return db[_0x5267('0x8e')][_0x5267('0x42')](_0x4df99f,{'raw':!![]});})['then'](function(_0x5df23d){if(_0x25ce90['table']===_0x5267('0x8f')){_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+_0x5267('0x90'),_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}else{_0x11a2f4[_0x5267('0x38')](_0x25ce90['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5b8026[_0x5267('0x91')],_0x5b8026[_0x5267('0x92')]);}if(_0x5df23d){logger[_0x5267('0x93')](_0x5267('0x94'),_0x11a2f4[_0x5267('0x7f')]());require(_0x5267('0x95'))[_0x5267('0x96')](path['join'](__dirname,'../../components/export/',_0x5df23d['output']),[_0x5df23d['id'],_0x11a2f4[_0x5267('0x7f')](),path[_0x5267('0x4f')](__dirname,_0x5267('0x97'),_0x5df23d[_0x5267('0x98')]),_0x20888d]);return _0x5df23d;}else{var _0x190ef4=squel[_0x5267('0x6b')]();_0x190ef4['from']('('+_0x11a2f4[_0x5267('0x7f')]()+')','countTable');_0x190ef4[_0x5267('0x6f')](_0x5267('0x99'),_0x5267('0x1e'));_0x11a2f4[_0x5267('0x1d')](_0x5b8026[_0x5267('0x1d')]||_0x87aa90);_0x11a2f4['offset'](_0x5b8026[_0x5267('0x1b')]||0x0);return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x190ef4['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5267('0x9a')]})[_0x5267('0x25')](function(_0x1be763){if(!_0x1be763[_0x5267('0x35')]){_0x42694a=0x0;}else{_0x42694a=_0x1be763[0x0]['count']||0x0;}return dbH['sequelize'][_0x5267('0x30')](_0x11a2f4[_0x5267('0x7f')](),{'type':dbH['sequelize'][_0x5267('0x81')][_0x5267('0x9a')]});})['then'](function(_0x5005b3){return{'rows':_0x5005b3||[],'count':_0x42694a};});}});}exports[_0x5267('0x9b')]=function(_0x11a6f4,_0x5a16ee){return runReport(_0x11a6f4[_0x5267('0x41')],_0x11a6f4[_0x5267('0x30')],_0x11a6f4[_0x5267('0x3d')])[_0x5267('0x25')](respondWithResult(_0x5a16ee,null))[_0x5267('0x40')](handleError(_0x5a16ee,null));};exports[_0x5267('0x9c')]=runReport;exports[_0x5267('0x30')]=function(_0x1e9651,_0x66da7a){var _0x54b582=0xa;var _0x4e4724=[_0x5267('0x4f'),'left_join',_0x5267('0x82'),_0x5267('0x51')];var _0x2722f9={'SUM':_0x5267('0x52'),'COUNT':_0x5267('0x53'),'COUNT DISTINCT':_0x5267('0x54'),'MAX':_0x5267('0x55'),'MIN':_0x5267('0x9d'),'AVG':_0x5267('0x56'),'GROUP_CONCAT':_0x5267('0x57'),'GROUP_CONCAT ASC':_0x5267('0x58'),'GROUP_CONCAT DESC':_0x5267('0x59')};var _0x5909b3={'SEC_TO_TIME':_0x5267('0x83'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x5267('0x5b'),'UNIX_TIMESTAMP':_0x5267('0x5c')};var _0x1d7987=function(_0x59efe1){return!_[_0x5267('0x5d')]([_0x5267('0x5e'),_0x5267('0x5f'),_0x5267('0x84'),_0x5267('0x60')],_0x59efe1);};var _0x46c79e=function(_0xcfba51){if(!_0xcfba51||!_0xcfba51[_0x5267('0x61')][_0x5267('0x35')]){return'';}for(var _0x3c5516='(',_0x1e8367=0x0;_0x1e8367<_0xcfba51[_0x5267('0x61')]['length'];_0x1e8367+=0x1){_0x1e8367>0x0&&(_0x3c5516+='\x20'+_0xcfba51[_0x5267('0x62')]+'\x20');_0x3c5516+=_0xcfba51[_0x5267('0x61')][_0x1e8367]['group']?_0x46c79e(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x63')]):_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x6f')]+'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x64')]+(_0x1d7987(_0xcfba51[_0x5267('0x61')][_0x1e8367][_0x5267('0x64')])?'\x20'+_0xcfba51['rules'][_0x1e8367][_0x5267('0x65')]:'');}return _0x3c5516+')';};var _0x19935d={'where':{'id':_0x1e9651[_0x5267('0x41')]['id']}},_0x3102e0,_0x2d215e,_0xc0af94,_0x178080,_0x3485ab;_0x19935d=_[_0x5267('0x3c')]({},_0x19935d,_0x1e9651['options']);return db[_0x5267('0x2a')][_0x5267('0x48')](_0x19935d)['then'](function(_0x17d2d4){if(_0x17d2d4){_0x3102e0=_0x17d2d4;return _0x17d2d4['getFields']();}return null;})[_0x5267('0x25')](function(_0x4c5a26){if(_0x4c5a26){if(!_0x4c5a26[_0x5267('0x35')]){throw new db[(_0x5267('0x85'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x2d215e=_0x4c5a26;return db[_0x5267('0x69')][_0x5267('0x6a')]({'raw':!![]});}return null;})[_0x5267('0x25')](function(_0x1a0883){if(_0x1a0883){_0xc0af94=_[_0x5267('0x86')](_0x1a0883,'id');var _0x501da6;var _0x3dcf73=squel['select']();_0x3dcf73['from'](_0x3102e0['table']);for(var _0x1ded05=0x0;_0x1ded05<_0x2d215e[_0x5267('0x35')];_0x1ded05+=0x1){_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x6d')]?_0xc0af94[_0x2d215e[_0x1ded05][_0x5267('0x6d')]][_0x5267('0x6e')]:_0x2d215e[_0x1ded05][_0x5267('0x6f')];_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x70')]?_['replace'](_0x2722f9[_0x2d215e[_0x1ded05]['function']],'%s',_0x501da6):_0x501da6;_0x501da6=_0x2d215e[_0x1ded05][_0x5267('0x72')]?_[_0x5267('0x71')](_0x5909b3[_0x2d215e[_0x1ded05][_0x5267('0x72')]],'%s',_0x501da6):_0x501da6;if(_0x2d215e[_0x1ded05][_0x5267('0x73')]){_0x3dcf73[_0x5267('0x63')](_0x501da6);}_0x2d215e[_0x1ded05]['orderBy']&&_0x3dcf73[_0x5267('0x74')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x75')]===_0x5267('0x76')?![]:!![]);_0x3dcf73[_0x5267('0x6f')](_0x501da6,_0x2d215e[_0x1ded05][_0x5267('0x88')]||_0x501da6);}if(_0x3102e0['joins']){_0x3102e0[_0x5267('0x77')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x77')]);for(var _0x4bfafd=0x0;_0x4bfafd<_0x3102e0[_0x5267('0x77')]['length'];_0x4bfafd+=0x1){if(_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]&&_['includes'](_0x4e4724,_0x3102e0[_0x5267('0x77')][_0x4bfafd]['type'])&&_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')]&&_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')]&&_0x3102e0[_0x5267('0x77')][_0x4bfafd]['foreignKey']){_0x3dcf73[_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x2d')]](_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x79')],null,util[_0x5267('0x72')]('%s.%s\x20=\x20%s.%s',_0x3102e0['table'],_0x3102e0[_0x5267('0x77')][_0x4bfafd][_0x5267('0x78')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x79')],_0x3102e0['joins'][_0x4bfafd][_0x5267('0x7a')]));}}}if(_0x3102e0[_0x5267('0x7c')]){_0x3102e0[_0x5267('0x7c')]=JSON[_0x5267('0x7d')](_0x3102e0[_0x5267('0x7c')]);_0x3dcf73[_0x5267('0x38')](_0x46c79e(_0x3102e0[_0x5267('0x7c')][_0x5267('0x63')]));}_0x3485ab=_0x3dcf73[_0x5267('0x7e')]();_0x3dcf73[_0x5267('0x1d')](_0x54b582);_0x3dcf73[_0x5267('0x1b')](0x0);logger[_0x5267('0x9e')]('Limited\x20Query:',_0x3dcf73[_0x5267('0x7f')]());return dbH[_0x5267('0x80')][_0x5267('0x30')](_0x3dcf73[_0x5267('0x7f')](),{'type':dbH[_0x5267('0x80')][_0x5267('0x81')][_0x5267('0x9a')]});}})[_0x5267('0x25')](function(){return{'sql':_0x3485ab[_0x5267('0x7f')]()};})[_0x5267('0x25')](respondWithResult(_0x66da7a,null))[_0x5267('0x40')](handleError(_0x66da7a,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index cc03c2a..5c0bf89 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 _0xeba9=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport'];(function(_0x4c2808,_0x2ddffe){var _0x45d22c=function(_0x5cfdbb){while(--_0x5cfdbb){_0x4c2808['push'](_0x4c2808['shift']());}};_0x45d22c(++_0x2ddffe);}(_0xeba9,0x15c));var _0x9eba=function(_0x52a5a5,_0x138112){_0x52a5a5=_0x52a5a5-0x0;var _0x39db45=_0xeba9[_0x52a5a5];return _0x39db45;};'use strict';var _=require(_0x9eba('0x0'));var util=require(_0x9eba('0x1'));var logger=require('../../config/logger')(_0x9eba('0x2'));var moment=require('moment');var BPromise=require(_0x9eba('0x3'));var rp=require(_0x9eba('0x4'));var fs=require('fs');var path=require(_0x9eba('0x5'));var rimraf=require(_0x9eba('0x6'));var config=require(_0x9eba('0x7'));var attributes=require(_0x9eba('0x8'));module[_0x9eba('0x9')]=function(_0x3300e9,_0x743f69){return _0x3300e9[_0x9eba('0xa')](_0x9eba('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd68=['rimraf','../../config/environment','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','bluebird'];(function(_0x4287fe,_0x14ad49){var _0x329a39=function(_0x3c30a9){while(--_0x3c30a9){_0x4287fe['push'](_0x4287fe['shift']());}};_0x329a39(++_0x14ad49);}(_0xdd68,0xa4));var _0x8dd6=function(_0x12b83d,_0x4bcec7){_0x12b83d=_0x12b83d-0x0;var _0x1fd39d=_0xdd68[_0x12b83d];return _0x1fd39d;};'use strict';var _=require(_0x8dd6('0x0'));var util=require('util');var logger=require(_0x8dd6('0x1'))(_0x8dd6('0x2'));var moment=require('moment');var BPromise=require(_0x8dd6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8dd6('0x4'));var config=require(_0x8dd6('0x5'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x54a666,_0x3a94c6){return _0x54a666['define'](_0x8dd6('0x6'),attributes,{'tableName':_0x8dd6('0x7'),'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 c86d281..6e848f9 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 _0x2995=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3ea7f7,_0x58d463){var _0x36831a=function(_0x7dad2){while(--_0x7dad2){_0x3ea7f7['push'](_0x3ea7f7['shift']());}};_0x36831a(++_0x58d463);}(_0x2995,0x1df));var _0x5299=function(_0x542bf5,_0x1e6222){_0x542bf5=_0x542bf5-0x0;var _0x5e1a14=_0x2995[_0x542bf5];return _0x5e1a14;};'use strict';var _=require(_0x5299('0x0'));var util=require('util');var moment=require(_0x5299('0x1'));var BPromise=require(_0x5299('0x2'));var rs=require(_0x5299('0x3'));var fs=require('fs');var Redis=require(_0x5299('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5299('0x5'))(_0x5299('0x6'));var config=require('../../config/environment');var jayson=require(_0x5299('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe0dc63,_0x993442,_0x18aa1b){return new BPromise(function(_0x58836c,_0x330345){return client['request'](_0xe0dc63,_0x18aa1b)['then'](function(_0x4e3838){logger[_0x5299('0x8')](_0x5299('0x9'),_0x993442,_0x5299('0xa'));logger[_0x5299('0xb')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x993442,_0x5299('0xa'),JSON[_0x5299('0xc')](_0x4e3838));if(_0x4e3838['error']){if(_0x4e3838['error']['code']===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x993442,_0x4e3838[_0x5299('0xd')]['message']);return _0x330345(_0x4e3838[_0x5299('0xd')][_0x5299('0xe')]);}logger['error'](_0x5299('0x9'),_0x993442,_0x4e3838[_0x5299('0xd')][_0x5299('0xe')]);return _0x58836c(_0x4e3838[_0x5299('0xd')]['message']);}else{logger[_0x5299('0x8')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x993442,'request\x20sent');_0x58836c(_0x4e3838[_0x5299('0xf')][_0x5299('0xe')]);}})[_0x5299('0x10')](function(_0x5b990e){logger[_0x5299('0xd')](_0x5299('0x9'),_0x993442,_0x5b990e);_0x330345(_0x5b990e);});});} \ No newline at end of file +var _0xe4e3=['http','then','request\x20sent','debug','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','info','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','client'];(function(_0x3ca524,_0x4d689b){var _0x360631=function(_0x2d18e4){while(--_0x2d18e4){_0x3ca524['push'](_0x3ca524['shift']());}};_0x360631(++_0x4d689b);}(_0xe4e3,0x13c));var _0x3e4e=function(_0x2f698b,_0x2cc318){_0x2f698b=_0x2f698b-0x0;var _0x24cdf9=_0xe4e3[_0x2f698b];return _0x24cdf9;};'use strict';var _=require('lodash');var util=require(_0x3e4e('0x0'));var moment=require(_0x3e4e('0x1'));var BPromise=require('bluebird');var rs=require(_0x3e4e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e4e('0x3'))['db'];var utils=require(_0x3e4e('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x3e4e('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x3e4e('0x6')][_0x3e4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x887c5e,_0x4390c6,_0x136224){return new BPromise(function(_0x38c6c4,_0x2b302f){return client['request'](_0x887c5e,_0x136224)[_0x3e4e('0x8')](function(_0x5b04de){logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4390c6,_0x3e4e('0x9'));logger[_0x3e4e('0xa')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x4390c6,_0x3e4e('0x9'),JSON[_0x3e4e('0xb')](_0x5b04de));if(_0x5b04de[_0x3e4e('0xc')]){if(_0x5b04de[_0x3e4e('0xc')][_0x3e4e('0xd')]===0x1f4){logger['error'](_0x3e4e('0xe'),_0x4390c6,_0x5b04de[_0x3e4e('0xc')]['message']);return _0x2b302f(_0x5b04de['error'][_0x3e4e('0xf')]);}logger['error'](_0x3e4e('0xe'),_0x4390c6,_0x5b04de[_0x3e4e('0xc')][_0x3e4e('0xf')]);return _0x38c6c4(_0x5b04de[_0x3e4e('0xc')][_0x3e4e('0xf')]);}else{logger[_0x3e4e('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4390c6,'request\x20sent');_0x38c6c4(_0x5b04de[_0x3e4e('0x11')][_0x3e4e('0xf')]);}})[_0x3e4e('0x12')](function(_0x4778fc){logger[_0x3e4e('0xc')](_0x3e4e('0xe'),_0x4390c6,_0x4778fc);_0x2b302f(_0x4778fc);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e620b45..f8cbdb6 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 _0xc311=['isAuthenticated','index','get','/:id','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller'];(function(_0x2f2d62,_0x8ea173){var _0x3987c8=function(_0x2e3f7c){while(--_0x2e3f7c){_0x2f2d62['push'](_0x2f2d62['shift']());}};_0x3987c8(++_0x8ea173);}(_0xc311,0x1a0));var _0x1c31=function(_0x44ae49,_0x1d00b4){_0x44ae49=_0x44ae49-0x0;var _0x476a6a=_0xc311[_0x44ae49];return _0x476a6a;};'use strict';var multer=require(_0x1c31('0x0'));var util=require(_0x1c31('0x1'));var path=require(_0x1c31('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c31('0x3')]();var fs_extra=require(_0x1c31('0x4'));var auth=require(_0x1c31('0x5'));var interaction=require(_0x1c31('0x6'));var config=require(_0x1c31('0x7'));var controller=require(_0x1c31('0x8'));router['get']('/',auth[_0x1c31('0x9')](),controller[_0x1c31('0xa')]);router[_0x1c31('0xb')](_0x1c31('0xc'),auth[_0x1c31('0x9')](),controller['show']);router[_0x1c31('0xb')](_0x1c31('0xd'),auth[_0x1c31('0x9')](),controller[_0x1c31('0xe')]);router[_0x1c31('0xb')]('/:id/run',auth['isAuthenticated'](),controller[_0x1c31('0xf')]);router[_0x1c31('0xb')](_0x1c31('0x10'),auth['isAuthenticated'](),controller[_0x1c31('0x11')]);router[_0x1c31('0x12')]('/',auth[_0x1c31('0x9')](),controller[_0x1c31('0x13')]);router[_0x1c31('0x14')](_0x1c31('0xc'),auth[_0x1c31('0x9')](),controller[_0x1c31('0x15')]);router[_0x1c31('0x16')](_0x1c31('0xc'),auth['isAuthenticated'](),controller[_0x1c31('0x17')]);module[_0x1c31('0x18')]=router; \ No newline at end of file +var _0x58ac=['../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','get','index','isAuthenticated','/:id/preview','preview','run','/:id/query','query','post','create','put','/:id','update','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dde18,_0x11bdb0){var _0x436d04=function(_0x3f86ba){while(--_0x3f86ba){_0x3dde18['push'](_0x3dde18['shift']());}};_0x436d04(++_0x11bdb0);}(_0x58ac,0xc9));var _0xc58a=function(_0x4143f8,_0x318481){_0x4143f8=_0x4143f8-0x0;var _0x24f397=_0x58ac[_0x4143f8];return _0x24f397;};'use strict';var multer=require('multer');var util=require(_0xc58a('0x0'));var path=require(_0xc58a('0x1'));var timeout=require(_0xc58a('0x2'));var express=require(_0xc58a('0x3'));var router=express[_0xc58a('0x4')]();var fs_extra=require(_0xc58a('0x5'));var auth=require(_0xc58a('0x6'));var interaction=require(_0xc58a('0x7'));var config=require('../../config/environment');var controller=require(_0xc58a('0x8'));router[_0xc58a('0x9')]('/',auth['isAuthenticated'](),controller[_0xc58a('0xa')]);router['get']('/:id',auth[_0xc58a('0xb')](),controller['show']);router[_0xc58a('0x9')](_0xc58a('0xc'),auth[_0xc58a('0xb')](),controller[_0xc58a('0xd')]);router[_0xc58a('0x9')]('/:id/run',auth[_0xc58a('0xb')](),controller[_0xc58a('0xe')]);router[_0xc58a('0x9')](_0xc58a('0xf'),auth['isAuthenticated'](),controller[_0xc58a('0x10')]);router[_0xc58a('0x11')]('/',auth[_0xc58a('0xb')](),controller[_0xc58a('0x12')]);router[_0xc58a('0x13')](_0xc58a('0x14'),auth[_0xc58a('0xb')](),controller[_0xc58a('0x15')]);router['delete'](_0xc58a('0x14'),auth[_0xc58a('0xb')](),controller[_0xc58a('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 1c451ca..4159161 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 _0xab9d=['csv','xlsx','DATE','Loading','manual','scheduled','sequelize','moment','exports','STRING','ENUM'];(function(_0x432987,_0x5b96a2){var _0x47ce4a=function(_0x1af2f7){while(--_0x1af2f7){_0x432987['push'](_0x432987['shift']());}};_0x47ce4a(++_0x5b96a2);}(_0xab9d,0x1df));var _0xdab9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xab9d[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0xdab9('0x0'));var moment=require(_0xdab9('0x1'));module[_0xdab9('0x2')]={'name':{'type':Sequelize[_0xdab9('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xdab9('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xdab9('0x4')](_0xdab9('0x5'),'pdf',_0xdab9('0x6')),'allowNull':![],'defaultValue':_0xdab9('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0xdab9('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xdab9('0x3')],'defaultValue':_0xdab9('0x8')},'type':{'type':Sequelize['ENUM'](_0xdab9('0x9'),_0xdab9('0xa')),'allowNull':![],'defaultValue':_0xdab9('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6fb8=['INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','Loading','ENUM','scheduled','manual'];(function(_0x2f9cf6,_0x5eb8b2){var _0x51dfc6=function(_0x1ae687){while(--_0x1ae687){_0x2f9cf6['push'](_0x2f9cf6['shift']());}};_0x51dfc6(++_0x5eb8b2);}(_0x6fb8,0x1a6));var _0x86fb=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x6fb8[_0x4e783c];return _0x2fbd6d;};'use strict';var Sequelize=require(_0x86fb('0x0'));var moment=require(_0x86fb('0x1'));module[_0x86fb('0x2')]={'name':{'type':Sequelize[_0x86fb('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x86fb('0x4'),_0x86fb('0x5'),_0x86fb('0x6')),'allowNull':![],'defaultValue':_0x86fb('0x4')},'savename':{'type':Sequelize[_0x86fb('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x86fb('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x86fb('0x3')],'defaultValue':_0x86fb('0x8')},'type':{'type':Sequelize[_0x86fb('0x9')]('manual',_0x86fb('0xa')),'allowNull':![],'defaultValue':_0x86fb('0xb')},'reportId':{'type':Sequelize[_0x86fb('0xc')](0xb)[_0x86fb('0xd')]},'reportType':{'type':Sequelize[_0x86fb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 8f5a599..a6df457 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 _0x276c=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','sendStatus','download','format','%s.%s','toLowerCase','rimraf','fast-json-patch'];(function(_0xf273f9,_0x486198){var _0xb4abcc=function(_0x2f9418){while(--_0x2f9418){_0xf273f9['push'](_0xf273f9['shift']());}};_0xb4abcc(++_0x486198);}(_0x276c,0x176));var _0xc276=function(_0x32d60a,_0x5e40fe){_0x32d60a=_0x32d60a-0x0;var _0x31ac01=_0x276c[_0x32d60a];return _0x31ac01;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc276('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc276('0x1'));var rp=require(_0xc276('0x2'));var moment=require(_0xc276('0x3'));var BPromise=require(_0xc276('0x4'));var Mustache=require(_0xc276('0x5'));var util=require(_0xc276('0x6'));var path=require(_0xc276('0x7'));var sox=require(_0xc276('0x8'));var csv=require(_0xc276('0x9'));var ejs=require(_0xc276('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc276('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc276('0xc'));var toCsv=require(_0xc276('0x9'));var querystring=require('querystring');var Papa=require(_0xc276('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc276('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc276('0xf'));var logger=require(_0xc276('0x10'))(_0xc276('0x11'));var utils=require(_0xc276('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xc276('0x13'));var db=require(_0xc276('0x14'))['db'];function respondWithStatusCode(_0x32e5d6,_0x3c348d){_0x3c348d=_0x3c348d||0xcc;return function(_0x371f5a){if(_0x371f5a){return _0x32e5d6['sendStatus'](_0x3c348d);}return _0x32e5d6[_0xc276('0x15')](_0x3c348d)[_0xc276('0x16')]();};}function respondWithResult(_0x30372e,_0x796efd){_0x796efd=_0x796efd||0xc8;return function(_0x507086){if(_0x507086){return _0x30372e[_0xc276('0x15')](_0x796efd)[_0xc276('0x17')](_0x507086);}};}function respondWithFilteredResult(_0x42fdb6,_0xd771f3){return function(_0x1662e4){if(_0x1662e4){var _0x33825e=typeof _0xd771f3[_0xc276('0x18')]==='undefined'&&typeof _0xd771f3[_0xc276('0x19')]==='undefined';var _0x3136af=_0x1662e4[_0xc276('0x1a')];var _0x3fc9a6=_0x33825e?0x0:_0xd771f3[_0xc276('0x18')];var _0x1acd8d=_0x33825e?_0x1662e4[_0xc276('0x1a')]:_0xd771f3[_0xc276('0x18')]+_0xd771f3[_0xc276('0x19')];var _0x631692;if(_0x1acd8d>=_0x3136af){_0x1acd8d=_0x3136af;_0x631692=0xc8;}else{_0x631692=0xce;}_0x42fdb6[_0xc276('0x15')](_0x631692);return _0x42fdb6[_0xc276('0x1b')](_0xc276('0x1c'),_0x3fc9a6+'-'+_0x1acd8d+'/'+_0x3136af)[_0xc276('0x17')](_0x1662e4);}return null;};}function patchUpdates(_0x584715){return function(_0x54002d){try{jsonpatch[_0xc276('0x1d')](_0x54002d,_0x584715,!![]);}catch(_0x5bc216){return BPromise[_0xc276('0x1e')](_0x5bc216);}return _0x54002d[_0xc276('0x1f')]();};}function saveUpdates(_0x4b2c42,_0x1320bb){return function(_0x37b7d6){if(_0x37b7d6){return _0x37b7d6[_0xc276('0x20')](_0x4b2c42)[_0xc276('0x21')](function(_0x3ce7e9){return _0x3ce7e9;});}return null;};}function removeEntity(_0xd4f59f,_0x1d3c18){return function(_0x567224){if(_0x567224){return _0x567224[_0xc276('0x22')]()[_0xc276('0x21')](function(){var _0x271702=_0x567224['get']({'plain':!![]});var _0x4ddab1=_0xc276('0x23');return db[_0xc276('0x24')]['destroy']({'where':{'type':_0x4ddab1,'resourceId':_0x271702['id']}})[_0xc276('0x21')](function(){return _0x567224;});})['then'](function(){_0xd4f59f['status'](0xcc)[_0xc276('0x16')]();});}};}function handleEntityNotFound(_0x57a660,_0x2fc5f1){return function(_0x47b1f8){if(!_0x47b1f8){_0x57a660['sendStatus'](0x194);}return _0x47b1f8;};}function handleError(_0x1f2010,_0x3bde1b){_0x3bde1b=_0x3bde1b||0x1f4;return function(_0x22f089){logger['error'](_0x22f089[_0xc276('0x25')]);if(_0x22f089['name']){delete _0x22f089[_0xc276('0x26')];}_0x1f2010['status'](_0x3bde1b)[_0xc276('0x27')](_0x22f089);};}exports['index']=function(_0x199b35,_0x52cb4d){var _0x3a3993={},_0x567c27={},_0x40e4d7={'count':0x0,'rows':[]};var _0x1942be=_[_0xc276('0x28')](db[_0xc276('0x29')][_0xc276('0x2a')],function(_0x156672){return{'name':_0x156672[_0xc276('0x2b')],'type':_0x156672[_0xc276('0x2c')][_0xc276('0x2d')]};});_0x567c27['model']=_['map'](_0x1942be,_0xc276('0x26'));_0x567c27[_0xc276('0x2e')]=_[_0xc276('0x2f')](_0x199b35[_0xc276('0x2e')]);_0x567c27[_0xc276('0x30')]=_['intersection'](_0x567c27[_0xc276('0x31')],_0x567c27['query']);_0x3a3993['attributes']=_[_0xc276('0x32')](_0x567c27[_0xc276('0x31')],qs[_0xc276('0x33')](_0x199b35[_0xc276('0x2e')][_0xc276('0x33')]));_0x3a3993[_0xc276('0x34')]=_0x3a3993[_0xc276('0x34')]['length']?_0x3a3993[_0xc276('0x34')]:_0x567c27[_0xc276('0x31')];if(!_0x199b35[_0xc276('0x2e')][_0xc276('0x35')]('nolimit')){_0x3a3993[_0xc276('0x19')]=qs[_0xc276('0x19')](_0x199b35['query'][_0xc276('0x19')]);_0x3a3993['offset']=qs[_0xc276('0x18')](_0x199b35[_0xc276('0x2e')][_0xc276('0x18')]);}_0x3a3993[_0xc276('0x36')]=qs[_0xc276('0x37')](_0x199b35[_0xc276('0x2e')][_0xc276('0x37')]);_0x3a3993['where']=qs['filters'](_[_0xc276('0x38')](_0x199b35[_0xc276('0x2e')],_0x567c27[_0xc276('0x30')]),_0x1942be);if(_0x199b35[_0xc276('0x2e')]['filter']){_0x3a3993[_0xc276('0x39')]=_[_0xc276('0x3a')](_0x3a3993[_0xc276('0x39')],{'$or':_[_0xc276('0x28')](_0x1942be,function(_0x30b9fd){if(_0x30b9fd[_0xc276('0x2c')]!==_0xc276('0x3b')){var _0x3ef2d8={};_0x3ef2d8[_0x30b9fd[_0xc276('0x26')]]={'$like':'%'+_0x199b35[_0xc276('0x2e')][_0xc276('0x3c')]+'%'};return _0x3ef2d8;}})});}_0x3a3993=_[_0xc276('0x3a')]({},_0x3a3993,_0x199b35[_0xc276('0x3d')]);var _0x5c3a76={'where':_0x3a3993[_0xc276('0x39')]};return db['AnalyticExtractedReport'][_0xc276('0x1a')](_0x5c3a76)['then'](function(_0x261dbb){_0x40e4d7[_0xc276('0x1a')]=_0x261dbb;if(_0x199b35[_0xc276('0x2e')][_0xc276('0x3e')]){_0x3a3993[_0xc276('0x3f')]=[{'all':!![]}];}return db[_0xc276('0x29')][_0xc276('0x40')](_0x3a3993);})[_0xc276('0x21')](function(_0x31667e){_0x40e4d7[_0xc276('0x41')]=_0x31667e;return _0x40e4d7;})[_0xc276('0x21')](respondWithFilteredResult(_0x52cb4d,_0x3a3993))[_0xc276('0x42')](handleError(_0x52cb4d,null));};exports[_0xc276('0x43')]=function(_0x33a101,_0x96221a){var _0x5f2d97={'raw':!![],'where':{'id':_0x33a101[_0xc276('0x44')]['id']}},_0x448344={};_0x448344[_0xc276('0x31')]=_[_0xc276('0x2f')](db[_0xc276('0x29')]['rawAttributes']);_0x448344[_0xc276('0x2e')]=_[_0xc276('0x2f')](_0x33a101[_0xc276('0x2e')]);_0x448344[_0xc276('0x30')]=_['intersection'](_0x448344[_0xc276('0x31')],_0x448344['query']);_0x5f2d97[_0xc276('0x34')]=_[_0xc276('0x32')](_0x448344[_0xc276('0x31')],qs['fields'](_0x33a101['query'][_0xc276('0x33')]));_0x5f2d97[_0xc276('0x34')]=_0x5f2d97[_0xc276('0x34')][_0xc276('0x45')]?_0x5f2d97[_0xc276('0x34')]:_0x448344['model'];if(_0x33a101[_0xc276('0x2e')][_0xc276('0x3e')]){_0x5f2d97[_0xc276('0x3f')]=[{'all':!![]}];}_0x5f2d97=_[_0xc276('0x3a')]({},_0x5f2d97,_0x33a101[_0xc276('0x3d')]);return db[_0xc276('0x29')]['find'](_0x5f2d97)[_0xc276('0x21')](handleEntityNotFound(_0x96221a,null))[_0xc276('0x21')](respondWithResult(_0x96221a,null))['catch'](handleError(_0x96221a,null));};exports[_0xc276('0x46')]=function(_0x491b34,_0x553d9c){return db[_0xc276('0x29')]['create'](_0x491b34[_0xc276('0x47')],{})[_0xc276('0x21')](function(_0x4adf8c){var _0x400828=_0x491b34[_0xc276('0x48')][_0xc276('0x49')]({'plain':!![]});if(!_0x400828)throw new Error(_0xc276('0x4a'));if(_0x400828['role']===_0xc276('0x48')){var _0x52f165=_0x4adf8c[_0xc276('0x49')]({'plain':!![]});var _0x916a8='ExtractedReports';return db[_0xc276('0x4b')][_0xc276('0x4c')]({'where':{'name':_0x916a8,'userProfileId':_0x400828[_0xc276('0x4d')]},'raw':!![]})[_0xc276('0x21')](function(_0x46d7fc){if(_0x46d7fc&&_0x46d7fc[_0xc276('0x4e')]===0x0){return db[_0xc276('0x24')][_0xc276('0x46')]({'name':_0x52f165[_0xc276('0x26')],'resourceId':_0x52f165['id'],'type':_0x46d7fc[_0xc276('0x26')],'sectionId':_0x46d7fc['id']},{})[_0xc276('0x21')](function(){return _0x4adf8c;});}else{return _0x4adf8c;}})['catch'](function(_0x2ef0a3){logger[_0xc276('0x4f')](_0xc276('0x50'),_0x2ef0a3);throw _0x2ef0a3;});}return _0x4adf8c;})[_0xc276('0x21')](respondWithResult(_0x553d9c,0xc9))[_0xc276('0x42')](handleError(_0x553d9c,null));};exports['update']=function(_0x1d231b,_0x4d4def){if(_0x1d231b['body']['id']){delete _0x1d231b['body']['id'];}return db[_0xc276('0x29')][_0xc276('0x4c')]({'where':{'id':_0x1d231b[_0xc276('0x44')]['id']}})[_0xc276('0x21')](handleEntityNotFound(_0x4d4def,null))[_0xc276('0x21')](saveUpdates(_0x1d231b['body'],null))[_0xc276('0x21')](respondWithResult(_0x4d4def,null))[_0xc276('0x42')](handleError(_0x4d4def,null));};exports['destroy']=function(_0x2ad2b2,_0x1f044c){return db[_0xc276('0x29')][_0xc276('0x4c')]({'where':{'id':_0x2ad2b2[_0xc276('0x44')]['id']}})[_0xc276('0x21')](handleEntityNotFound(_0x1f044c,null))[_0xc276('0x21')](removeEntity(_0x1f044c,null))[_0xc276('0x42')](handleError(_0x1f044c,null));};exports['download']=function(_0x3baa93,_0x2d6243,_0x1a8dfb){return db[_0xc276('0x29')]['find']({'where':{'id':_0x3baa93[_0xc276('0x44')]['id']},'attributes':[_0xc276('0x26'),'basename',_0xc276('0x51'),'output'],'raw':!![]})[_0xc276('0x21')](handleEntityNotFound(_0x2d6243,null))[_0xc276('0x21')](function(_0x4d1110){if(_0x4d1110){if(!fs['existsSync'](path[_0xc276('0x52')](config[_0xc276('0x53')],_0xc276('0x54'),_0x4d1110['savename']))){throw new db[(_0xc276('0x55'))][(_0xc276('0x56'))](_0xc276('0x57'));}if(_0x3baa93[_0xc276('0x2e')][_0xc276('0x58')]){return _0x2d6243[_0xc276('0x59')](0xc8);}return _0x2d6243[_0xc276('0x5a')](path[_0xc276('0x52')](config[_0xc276('0x53')],'server/files/reports',_0x4d1110[_0xc276('0x51')]),util[_0xc276('0x5b')](_0xc276('0x5c'),_0x4d1110['basename']||_0x4d1110[_0xc276('0x26')],_0x4d1110['output'][_0xc276('0x5d')]()));}})[_0xc276('0x42')](handleError(_0x2d6243,null));}; \ No newline at end of file +var _0xf98a=['send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','download','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xf98a,0x162));var _0xaf98=function(_0x114d1f,_0x55548e){_0x114d1f=_0x114d1f-0x0;var _0x5b91d4=_0xf98a[_0x114d1f];return _0x5b91d4;};'use strict';var emlformat=require(_0xaf98('0x0'));var rimraf=require(_0xaf98('0x1'));var zipdir=require(_0xaf98('0x2'));var jsonpatch=require(_0xaf98('0x3'));var rp=require('request-promise');var moment=require(_0xaf98('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaf98('0x5'));var util=require(_0xaf98('0x6'));var path=require(_0xaf98('0x7'));var sox=require(_0xaf98('0x8'));var csv=require('to-csv');var ejs=require(_0xaf98('0x9'));var fs=require('fs');var fs_extra=require(_0xaf98('0xa'));var _=require(_0xaf98('0xb'));var squel=require(_0xaf98('0xc'));var crypto=require('crypto');var jsforce=require(_0xaf98('0xd'));var deskjs=require(_0xaf98('0xe'));var toCsv=require('to-csv');var querystring=require(_0xaf98('0xf'));var Papa=require(_0xaf98('0x10'));var Redis=require(_0xaf98('0x11'));var authService=require(_0xaf98('0x12'));var qs=require(_0xaf98('0x13'));var as=require(_0xaf98('0x14'));var hardwareService=require(_0xaf98('0x15'));var logger=require(_0xaf98('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaf98('0x17'))['db'];function respondWithStatusCode(_0x591236,_0x5455c5){_0x5455c5=_0x5455c5||0xcc;return function(_0x383bd3){if(_0x383bd3){return _0x591236[_0xaf98('0x18')](_0x5455c5);}return _0x591236['status'](_0x5455c5)[_0xaf98('0x19')]();};}function respondWithResult(_0x372dfc,_0x4ba95b){_0x4ba95b=_0x4ba95b||0xc8;return function(_0x1b3e8e){if(_0x1b3e8e){return _0x372dfc['status'](_0x4ba95b)[_0xaf98('0x1a')](_0x1b3e8e);}};}function respondWithFilteredResult(_0x175c95,_0xf1081c){return function(_0x1e10d5){if(_0x1e10d5){var _0x1a6ac6=typeof _0xf1081c['offset']===_0xaf98('0x1b')&&typeof _0xf1081c[_0xaf98('0x1c')]==='undefined';var _0x8b455c=_0x1e10d5[_0xaf98('0x1d')];var _0x4aa9fa=_0x1a6ac6?0x0:_0xf1081c[_0xaf98('0x1e')];var _0x3ffeca=_0x1a6ac6?_0x1e10d5[_0xaf98('0x1d')]:_0xf1081c['offset']+_0xf1081c[_0xaf98('0x1c')];var _0x917907;if(_0x3ffeca>=_0x8b455c){_0x3ffeca=_0x8b455c;_0x917907=0xc8;}else{_0x917907=0xce;}_0x175c95[_0xaf98('0x1f')](_0x917907);return _0x175c95[_0xaf98('0x20')](_0xaf98('0x21'),_0x4aa9fa+'-'+_0x3ffeca+'/'+_0x8b455c)['json'](_0x1e10d5);}return null;};}function patchUpdates(_0x1292cc){return function(_0xa13f97){try{jsonpatch[_0xaf98('0x22')](_0xa13f97,_0x1292cc,!![]);}catch(_0x16fcf2){return BPromise[_0xaf98('0x23')](_0x16fcf2);}return _0xa13f97[_0xaf98('0x24')]();};}function saveUpdates(_0x4a9721,_0x12de95){return function(_0x117424){if(_0x117424){return _0x117424[_0xaf98('0x25')](_0x4a9721)[_0xaf98('0x26')](function(_0x4885f0){return _0x4885f0;});}return null;};}function removeEntity(_0x36f7ee,_0x5e7af7){return function(_0x19e303){if(_0x19e303){return _0x19e303[_0xaf98('0x27')]()[_0xaf98('0x26')](function(){var _0x4a210c=_0x19e303[_0xaf98('0x28')]({'plain':!![]});var _0x3f8551=_0xaf98('0x29');return db[_0xaf98('0x2a')][_0xaf98('0x27')]({'where':{'type':_0x3f8551,'resourceId':_0x4a210c['id']}})['then'](function(){return _0x19e303;});})[_0xaf98('0x26')](function(){_0x36f7ee[_0xaf98('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23457a,_0x3bfcf7){return function(_0x4392eb){if(!_0x4392eb){_0x23457a[_0xaf98('0x18')](0x194);}return _0x4392eb;};}function handleError(_0x395685,_0x1f2f5a){_0x1f2f5a=_0x1f2f5a||0x1f4;return function(_0x3ef881){logger[_0xaf98('0x2b')](_0x3ef881[_0xaf98('0x2c')]);if(_0x3ef881[_0xaf98('0x2d')]){delete _0x3ef881[_0xaf98('0x2d')];}_0x395685['status'](_0x1f2f5a)[_0xaf98('0x2e')](_0x3ef881);};}exports[_0xaf98('0x2f')]=function(_0x14b9e1,_0x15bee9){var _0x5cd09e={},_0x1e7d84={},_0x252fbe={'count':0x0,'rows':[]};var _0x31ba27=_[_0xaf98('0x30')](db[_0xaf98('0x31')][_0xaf98('0x32')],function(_0x159ead){return{'name':_0x159ead[_0xaf98('0x33')],'type':_0x159ead[_0xaf98('0x34')][_0xaf98('0x35')]};});_0x1e7d84[_0xaf98('0x36')]=_[_0xaf98('0x30')](_0x31ba27,'name');_0x1e7d84['query']=_[_0xaf98('0x37')](_0x14b9e1[_0xaf98('0x38')]);_0x1e7d84[_0xaf98('0x39')]=_[_0xaf98('0x3a')](_0x1e7d84['model'],_0x1e7d84['query']);_0x5cd09e[_0xaf98('0x3b')]=_[_0xaf98('0x3a')](_0x1e7d84[_0xaf98('0x36')],qs['fields'](_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x3c')]));_0x5cd09e[_0xaf98('0x3b')]=_0x5cd09e[_0xaf98('0x3b')][_0xaf98('0x3d')]?_0x5cd09e[_0xaf98('0x3b')]:_0x1e7d84[_0xaf98('0x36')];if(!_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x3e')](_0xaf98('0x3f'))){_0x5cd09e[_0xaf98('0x1c')]=qs[_0xaf98('0x1c')](_0x14b9e1['query'][_0xaf98('0x1c')]);_0x5cd09e['offset']=qs['offset'](_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x1e')]);}_0x5cd09e['order']=qs[_0xaf98('0x40')](_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x40')]);_0x5cd09e[_0xaf98('0x41')]=qs['filters'](_[_0xaf98('0x42')](_0x14b9e1['query'],_0x1e7d84[_0xaf98('0x39')]),_0x31ba27);if(_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x43')]){_0x5cd09e['where']=_[_0xaf98('0x44')](_0x5cd09e[_0xaf98('0x41')],{'$or':_['map'](_0x31ba27,function(_0x1aaede){if(_0x1aaede['type']!==_0xaf98('0x45')){var _0x3ad1ca={};_0x3ad1ca[_0x1aaede[_0xaf98('0x2d')]]={'$like':'%'+_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x43')]+'%'};return _0x3ad1ca;}})});}_0x5cd09e=_[_0xaf98('0x44')]({},_0x5cd09e,_0x14b9e1['options']);var _0x3f3235={'where':_0x5cd09e[_0xaf98('0x41')]};return db[_0xaf98('0x31')][_0xaf98('0x1d')](_0x3f3235)['then'](function(_0x2a827d){_0x252fbe[_0xaf98('0x1d')]=_0x2a827d;if(_0x14b9e1[_0xaf98('0x38')][_0xaf98('0x46')]){_0x5cd09e[_0xaf98('0x47')]=[{'all':!![]}];}return db[_0xaf98('0x31')][_0xaf98('0x48')](_0x5cd09e);})['then'](function(_0x13f4a1){_0x252fbe[_0xaf98('0x49')]=_0x13f4a1;return _0x252fbe;})[_0xaf98('0x26')](respondWithFilteredResult(_0x15bee9,_0x5cd09e))[_0xaf98('0x4a')](handleError(_0x15bee9,null));};exports[_0xaf98('0x4b')]=function(_0x1d2bb6,_0x46c902){var _0x54b8e9={'raw':!![],'where':{'id':_0x1d2bb6[_0xaf98('0x4c')]['id']}},_0xefb422={};_0xefb422[_0xaf98('0x36')]=_[_0xaf98('0x37')](db[_0xaf98('0x31')][_0xaf98('0x32')]);_0xefb422[_0xaf98('0x38')]=_['keys'](_0x1d2bb6[_0xaf98('0x38')]);_0xefb422[_0xaf98('0x39')]=_[_0xaf98('0x3a')](_0xefb422[_0xaf98('0x36')],_0xefb422[_0xaf98('0x38')]);_0x54b8e9[_0xaf98('0x3b')]=_[_0xaf98('0x3a')](_0xefb422['model'],qs[_0xaf98('0x3c')](_0x1d2bb6[_0xaf98('0x38')][_0xaf98('0x3c')]));_0x54b8e9['attributes']=_0x54b8e9[_0xaf98('0x3b')]['length']?_0x54b8e9[_0xaf98('0x3b')]:_0xefb422[_0xaf98('0x36')];if(_0x1d2bb6[_0xaf98('0x38')]['includeAll']){_0x54b8e9[_0xaf98('0x47')]=[{'all':!![]}];}_0x54b8e9=_[_0xaf98('0x44')]({},_0x54b8e9,_0x1d2bb6['options']);return db[_0xaf98('0x31')]['find'](_0x54b8e9)['then'](handleEntityNotFound(_0x46c902,null))[_0xaf98('0x26')](respondWithResult(_0x46c902,null))[_0xaf98('0x4a')](handleError(_0x46c902,null));};exports[_0xaf98('0x4d')]=function(_0x226061,_0x485795){return db['AnalyticExtractedReport'][_0xaf98('0x4d')](_0x226061['body'],{})[_0xaf98('0x26')](function(_0x2bd12f){var _0x179e9f=_0x226061[_0xaf98('0x4e')]['get']({'plain':!![]});if(!_0x179e9f)throw new Error(_0xaf98('0x4f'));if(_0x179e9f[_0xaf98('0x50')]==='user'){var _0x4fd4c3=_0x2bd12f[_0xaf98('0x28')]({'plain':!![]});var _0x5d8c39=_0xaf98('0x29');return db[_0xaf98('0x51')][_0xaf98('0x52')]({'where':{'name':_0x5d8c39,'userProfileId':_0x179e9f['userProfileId']},'raw':!![]})[_0xaf98('0x26')](function(_0x220500){if(_0x220500&&_0x220500[_0xaf98('0x53')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fd4c3[_0xaf98('0x2d')],'resourceId':_0x4fd4c3['id'],'type':_0x220500[_0xaf98('0x2d')],'sectionId':_0x220500['id']},{})[_0xaf98('0x26')](function(){return _0x2bd12f;});}else{return _0x2bd12f;}})[_0xaf98('0x4a')](function(_0xdaeb9e){logger['error'](_0xaf98('0x54'),_0xdaeb9e);throw _0xdaeb9e;});}return _0x2bd12f;})[_0xaf98('0x26')](respondWithResult(_0x485795,0xc9))[_0xaf98('0x4a')](handleError(_0x485795,null));};exports[_0xaf98('0x25')]=function(_0x2c6517,_0x329ba5){if(_0x2c6517[_0xaf98('0x55')]['id']){delete _0x2c6517[_0xaf98('0x55')]['id'];}return db[_0xaf98('0x31')][_0xaf98('0x52')]({'where':{'id':_0x2c6517[_0xaf98('0x4c')]['id']}})[_0xaf98('0x26')](handleEntityNotFound(_0x329ba5,null))[_0xaf98('0x26')](saveUpdates(_0x2c6517['body'],null))[_0xaf98('0x26')](respondWithResult(_0x329ba5,null))['catch'](handleError(_0x329ba5,null));};exports[_0xaf98('0x27')]=function(_0x73a293,_0x1322ef){return db[_0xaf98('0x31')][_0xaf98('0x52')]({'where':{'id':_0x73a293[_0xaf98('0x4c')]['id']}})[_0xaf98('0x26')](handleEntityNotFound(_0x1322ef,null))[_0xaf98('0x26')](removeEntity(_0x1322ef,null))['catch'](handleError(_0x1322ef,null));};exports['download']=function(_0x24bf06,_0x260ab9,_0xd5ebe3){return db['AnalyticExtractedReport'][_0xaf98('0x52')]({'where':{'id':_0x24bf06[_0xaf98('0x4c')]['id']},'attributes':[_0xaf98('0x2d'),_0xaf98('0x56'),_0xaf98('0x57'),_0xaf98('0x58')],'raw':!![]})[_0xaf98('0x26')](handleEntityNotFound(_0x260ab9,null))['then'](function(_0x1783c7){if(_0x1783c7){if(!fs[_0xaf98('0x59')](path[_0xaf98('0x5a')](config[_0xaf98('0x5b')],_0xaf98('0x5c'),_0x1783c7['savename']))){throw new db[(_0xaf98('0x5d'))][(_0xaf98('0x5e'))](_0xaf98('0x5f'));}if(_0x24bf06[_0xaf98('0x38')]['exists']){return _0x260ab9[_0xaf98('0x18')](0xc8);}return _0x260ab9[_0xaf98('0x60')](path['join'](config[_0xaf98('0x5b')],_0xaf98('0x5c'),_0x1783c7[_0xaf98('0x57')]),util[_0xaf98('0x61')](_0xaf98('0x62'),_0x1783c7[_0xaf98('0x56')]||_0x1783c7[_0xaf98('0x2d')],_0x1783c7[_0xaf98('0x58')][_0xaf98('0x63')]()));}})[_0xaf98('0x4a')](handleError(_0x260ab9,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index b0da306..ded9986 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 _0x9122=['AnalyticExtractedReport','analytics_extracted_reports','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3be5c0,_0x55ed8e){var _0x26ee97=function(_0x6966b8){while(--_0x6966b8){_0x3be5c0['push'](_0x3be5c0['shift']());}};_0x26ee97(++_0x55ed8e);}(_0x9122,0x120));var _0x2912=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0x9122[_0x412b2a];return _0x5872e3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2912('0x0'))('api');var moment=require(_0x2912('0x1'));var BPromise=require(_0x2912('0x2'));var rp=require(_0x2912('0x3'));var fs=require('fs');var path=require(_0x2912('0x4'));var rimraf=require(_0x2912('0x5'));var config=require(_0x2912('0x6'));var attributes=require('./analyticExtractedReport.attributes');module[_0x2912('0x7')]=function(_0x4ba2b4,_0x210e35){return _0x4ba2b4[_0x2912('0x8')](_0x2912('0x9'),attributes,{'tableName':_0x2912('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8a2d=['../../config/environment','./analyticExtractedReport.attributes','define','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','api','request-promise'];(function(_0xa49f02,_0x49a870){var _0x10ad21=function(_0x66e800){while(--_0x66e800){_0xa49f02['push'](_0xa49f02['shift']());}};_0x10ad21(++_0x49a870);}(_0x8a2d,0x16d));var _0xd8a2=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x8a2d[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var util=require(_0xd8a2('0x0'));var logger=require(_0xd8a2('0x1'))(_0xd8a2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd8a2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8a2('0x4'));var attributes=require(_0xd8a2('0x5'));module['exports']=function(_0x10ad3b,_0x851000){return _0x10ad3b[_0xd8a2('0x6')](_0xd8a2('0x7'),attributes,{'tableName':_0xd8a2('0x8'),'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 bf127b5..0929a6a 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 _0x8425=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x6aa32f,_0x3820f7){var _0x52bfee=function(_0x49814f){while(--_0x49814f){_0x6aa32f['push'](_0x6aa32f['shift']());}};_0x52bfee(++_0x3820f7);}(_0x8425,0x13b));var _0x5842=function(_0x2d1586,_0x51def){_0x2d1586=_0x2d1586-0x0;var _0x20c876=_0x8425[_0x2d1586];return _0x20c876;};'use strict';var _=require(_0x5842('0x0'));var util=require(_0x5842('0x1'));var moment=require(_0x5842('0x2'));var BPromise=require(_0x5842('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5842('0x4'));var db=require(_0x5842('0x5'))['db'];var utils=require(_0x5842('0x6'));var logger=require(_0x5842('0x7'))(_0x5842('0x8'));var config=require(_0x5842('0x9'));var jayson=require(_0x5842('0xa'));var client=jayson['client'][_0x5842('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15eb92,_0x6d04d0,_0x3ccf6e){return new BPromise(function(_0x3ad2e0,_0x4f4fc4){return client['request'](_0x15eb92,_0x3ccf6e)[_0x5842('0xc')](function(_0x47e603){logger[_0x5842('0xd')](_0x5842('0xe'),_0x6d04d0,_0x5842('0xf'));logger[_0x5842('0x10')](_0x5842('0x11'),_0x6d04d0,_0x5842('0xf'),JSON[_0x5842('0x12')](_0x47e603));if(_0x47e603[_0x5842('0x13')]){if(_0x47e603[_0x5842('0x13')][_0x5842('0x14')]===0x1f4){logger[_0x5842('0x13')](_0x5842('0xe'),_0x6d04d0,_0x47e603['error'][_0x5842('0x15')]);return _0x4f4fc4(_0x47e603[_0x5842('0x13')][_0x5842('0x15')]);}logger[_0x5842('0x13')](_0x5842('0xe'),_0x6d04d0,_0x47e603[_0x5842('0x13')][_0x5842('0x15')]);return _0x3ad2e0(_0x47e603[_0x5842('0x13')][_0x5842('0x15')]);}else{logger[_0x5842('0xd')](_0x5842('0xe'),_0x6d04d0,_0x5842('0xf'));_0x3ad2e0(_0x47e603[_0x5842('0x16')][_0x5842('0x15')]);}})[_0x5842('0x17')](function(_0x4c1240){logger[_0x5842('0x13')](_0x5842('0xe'),_0x6d04d0,_0x4c1240);_0x4f4fc4(_0x4c1240);});});} \ No newline at end of file +var _0xd948=['http','request','then','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticExtractedReport,\x20%s,\x20%s','info','result','catch','moment','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x10f838,_0x4d1351){var _0x2d460c=function(_0x4991a3){while(--_0x4991a3){_0x10f838['push'](_0x10f838['shift']());}};_0x2d460c(++_0x4d1351);}(_0xd948,0x12a));var _0x8d94=function(_0x14d6c2,_0x1f142a){_0x14d6c2=_0x14d6c2-0x0;var _0x3afb2c=_0xd948[_0x14d6c2];return _0x3afb2c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8d94('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d94('0x1'));var db=require(_0x8d94('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8d94('0x3'));var config=require('../../config/environment');var jayson=require(_0x8d94('0x4'));var client=jayson[_0x8d94('0x5')][_0x8d94('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x31dbfd,_0x278bcd,_0x5c3b2f){return new BPromise(function(_0x3a45a7,_0x5cb2e2){return client[_0x8d94('0x7')](_0x31dbfd,_0x5c3b2f)[_0x8d94('0x8')](function(_0x46bd01){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x278bcd,_0x8d94('0x9'));logger['debug'](_0x8d94('0xa'),_0x278bcd,_0x8d94('0x9'),JSON[_0x8d94('0xb')](_0x46bd01));if(_0x46bd01[_0x8d94('0xc')]){if(_0x46bd01[_0x8d94('0xc')][_0x8d94('0xd')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x278bcd,_0x46bd01[_0x8d94('0xc')]['message']);return _0x5cb2e2(_0x46bd01[_0x8d94('0xc')][_0x8d94('0xe')]);}logger[_0x8d94('0xc')](_0x8d94('0xf'),_0x278bcd,_0x46bd01['error'][_0x8d94('0xe')]);return _0x3a45a7(_0x46bd01[_0x8d94('0xc')]['message']);}else{logger[_0x8d94('0x10')](_0x8d94('0xf'),_0x278bcd,_0x8d94('0x9'));_0x3a45a7(_0x46bd01[_0x8d94('0x11')][_0x8d94('0xe')]);}})[_0x8d94('0x12')](function(_0x296bd0){logger[_0x8d94('0xc')](_0x8d94('0xf'),_0x278bcd,_0x296bd0);_0x5cb2e2(_0x296bd0);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index e868003..2c601eb 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 _0xdff6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','index','get','isAuthenticated','download','put','update','delete','/:id','destroy','exports'];(function(_0x21cb94,_0x52ea8b){var _0x1fbfdb=function(_0x3eeb9c){while(--_0x3eeb9c){_0x21cb94['push'](_0x21cb94['shift']());}};_0x1fbfdb(++_0x52ea8b);}(_0xdff6,0x1d4));var _0x6dff=function(_0x50422f,_0x188962){_0x50422f=_0x50422f-0x0;var _0x4e9766=_0xdff6[_0x50422f];return _0x4e9766;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6dff('0x0'));var timeout=require(_0x6dff('0x1'));var express=require(_0x6dff('0x2'));var router=express[_0x6dff('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6dff('0x4'));var interaction=require(_0x6dff('0x5'));var config=require(_0x6dff('0x6'));var controller=require(_0x6dff('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6dff('0x8')]);router[_0x6dff('0x9')]('/:id',auth[_0x6dff('0xa')](),controller['show']);router[_0x6dff('0x9')]('/:id/download',auth['isAuthenticated'](),controller[_0x6dff('0xb')]);router['post']('/',auth[_0x6dff('0xa')](),controller['create']);router[_0x6dff('0xc')]('/:id',auth[_0x6dff('0xa')](),controller[_0x6dff('0xd')]);router[_0x6dff('0xe')](_0x6dff('0xf'),auth[_0x6dff('0xa')](),controller[_0x6dff('0x10')]);module[_0x6dff('0x11')]=router; \ No newline at end of file +var _0x9c42=['update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','get','index','/:id','isAuthenticated','show','download','post','create','put'];(function(_0x4ef2f3,_0x485ee2){var _0x1d2fa4=function(_0x59cc0e){while(--_0x59cc0e){_0x4ef2f3['push'](_0x4ef2f3['shift']());}};_0x1d2fa4(++_0x485ee2);}(_0x9c42,0x1c4));var _0x29c4=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0x9c42[_0x166d93];return _0xba708;};'use strict';var multer=require(_0x29c4('0x0'));var util=require(_0x29c4('0x1'));var path=require(_0x29c4('0x2'));var timeout=require(_0x29c4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x29c4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x29c4('0x5'));var config=require('../../config/environment');var controller=require(_0x29c4('0x6'));router[_0x29c4('0x7')]('/',auth['isAuthenticated'](),controller[_0x29c4('0x8')]);router[_0x29c4('0x7')](_0x29c4('0x9'),auth[_0x29c4('0xa')](),controller[_0x29c4('0xb')]);router[_0x29c4('0x7')]('/:id/download',auth[_0x29c4('0xa')](),controller[_0x29c4('0xc')]);router[_0x29c4('0xd')]('/',auth['isAuthenticated'](),controller[_0x29c4('0xe')]);router[_0x29c4('0xf')](_0x29c4('0x9'),auth['isAuthenticated'](),controller[_0x29c4('0x10')]);router['delete'](_0x29c4('0x9'),auth[_0x29c4('0xa')](),controller[_0x29c4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index bdc7ea9..388b938 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 _0x3080=['STRING','BOOLEAN','exports','TEXT'];(function(_0x4d1be4,_0x280173){var _0x4668f6=function(_0xcbdb2){while(--_0xcbdb2){_0x4d1be4['push'](_0x4d1be4['shift']());}};_0x4668f6(++_0x280173);}(_0x3080,0xce));var _0x0308=function(_0x59b65c,_0x496d5e){_0x59b65c=_0x59b65c-0x0;var _0x175784=_0x3080[_0x59b65c];return _0x175784;};'use strict';var Sequelize=require('sequelize');module[_0x0308('0x0')]={'field':{'type':Sequelize[_0x0308('0x1')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x0308('0x2')]},'format':{'type':Sequelize[_0x0308('0x2')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0308('0x2')]},'custom':{'type':Sequelize[_0x0308('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xc032=['BOOLEAN','sequelize','STRING'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0xc032,0x166));var _0x2c03=function(_0x20d36f,_0x79067){_0x20d36f=_0x20d36f-0x0;var _0x4049d6=_0xc032[_0x20d36f];return _0x4049d6;};'use strict';var Sequelize=require(_0x2c03('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x2c03('0x1')]},'function':{'type':Sequelize[_0x2c03('0x1')]},'format':{'type':Sequelize[_0x2c03('0x1')]},'groupBy':{'type':Sequelize[_0x2c03('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x2c03('0x1')]},'custom':{'type':Sequelize[_0x2c03('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index c66b0c2..6f162a9 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 _0x381b=['destroy','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','query','filters','attributes','intersection','fields','length','model','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','find','create','body','bulkCreate','ids','addFields','AnalyticCustomReport','findOne','transaction','CustomReportId','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then'];(function(_0x2dfbc5,_0x3d245c){var _0x5b1cee=function(_0x5f1394){while(--_0x5f1394){_0x2dfbc5['push'](_0x2dfbc5['shift']());}};_0x5b1cee(++_0x3d245c);}(_0x381b,0x7c));var _0xb381=function(_0x343b56,_0x27ebbf){_0x343b56=_0x343b56-0x0;var _0x4bdc57=_0x381b[_0x343b56];return _0x4bdc57;};'use strict';var emlformat=require(_0xb381('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb381('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb381('0x2'));var moment=require(_0xb381('0x3'));var BPromise=require(_0xb381('0x4'));var Mustache=require(_0xb381('0x5'));var util=require(_0xb381('0x6'));var path=require(_0xb381('0x7'));var sox=require(_0xb381('0x8'));var csv=require(_0xb381('0x9'));var ejs=require(_0xb381('0xa'));var fs=require('fs');var fs_extra=require(_0xb381('0xb'));var _=require('lodash');var squel=require(_0xb381('0xc'));var crypto=require(_0xb381('0xd'));var jsforce=require(_0xb381('0xe'));var deskjs=require(_0xb381('0xf'));var toCsv=require(_0xb381('0x9'));var querystring=require(_0xb381('0x10'));var Papa=require(_0xb381('0x11'));var Redis=require(_0xb381('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb381('0x13'));var as=require(_0xb381('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb381('0x15'));var utils=require(_0xb381('0x16'));var config=require(_0xb381('0x17'));var licenseUtil=require(_0xb381('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c22a9,_0x555e10){_0x555e10=_0x555e10||0xcc;return function(_0x41ba0e){if(_0x41ba0e){return _0x3c22a9[_0xb381('0x19')](_0x555e10);}return _0x3c22a9[_0xb381('0x1a')](_0x555e10)[_0xb381('0x1b')]();};}function respondWithResult(_0x5695de,_0x199ddd){_0x199ddd=_0x199ddd||0xc8;return function(_0x22b5d3){if(_0x22b5d3){return _0x5695de['status'](_0x199ddd)[_0xb381('0x1c')](_0x22b5d3);}};}function respondWithFilteredResult(_0x1155b4,_0x5b4ea2){return function(_0x442d89){if(_0x442d89){var _0x1cfa50=typeof _0x5b4ea2[_0xb381('0x1d')]===_0xb381('0x1e')&&typeof _0x5b4ea2[_0xb381('0x1f')]===_0xb381('0x1e');var _0xf989dc=_0x442d89[_0xb381('0x20')];var _0x42497d=_0x1cfa50?0x0:_0x5b4ea2[_0xb381('0x1d')];var _0x3d51e7=_0x1cfa50?_0x442d89[_0xb381('0x20')]:_0x5b4ea2[_0xb381('0x1d')]+_0x5b4ea2[_0xb381('0x1f')];var _0x51c5ad;if(_0x3d51e7>=_0xf989dc){_0x3d51e7=_0xf989dc;_0x51c5ad=0xc8;}else{_0x51c5ad=0xce;}_0x1155b4['status'](_0x51c5ad);return _0x1155b4[_0xb381('0x21')](_0xb381('0x22'),_0x42497d+'-'+_0x3d51e7+'/'+_0xf989dc)[_0xb381('0x1c')](_0x442d89);}return null;};}function patchUpdates(_0x152948){return function(_0x1c76ea){try{jsonpatch[_0xb381('0x23')](_0x1c76ea,_0x152948,!![]);}catch(_0xa41a0c){return BPromise[_0xb381('0x24')](_0xa41a0c);}return _0x1c76ea[_0xb381('0x25')]();};}function saveUpdates(_0x4e11e4,_0x3419e9){return function(_0x31ccc2){if(_0x31ccc2){return _0x31ccc2[_0xb381('0x26')](_0x4e11e4)[_0xb381('0x27')](function(_0x41ce86){return _0x41ce86;});}return null;};}function removeEntity(_0x571d83,_0x531732){return function(_0xc62e6b){if(_0xc62e6b){return _0xc62e6b[_0xb381('0x28')]()['then'](function(){_0x571d83[_0xb381('0x1a')](0xcc)[_0xb381('0x1b')]();});}};}function handleEntityNotFound(_0x4d25a1,_0x51a922){return function(_0x307f9){if(!_0x307f9){_0x4d25a1['sendStatus'](0x194);}return _0x307f9;};}function handleError(_0x485974,_0x35f816){_0x35f816=_0x35f816||0x1f4;return function(_0x3e9150){logger[_0xb381('0x29')](_0x3e9150[_0xb381('0x2a')]);if(_0x3e9150[_0xb381('0x2b')]){delete _0x3e9150[_0xb381('0x2b')];}_0x485974[_0xb381('0x1a')](_0x35f816)[_0xb381('0x2c')](_0x3e9150);};}exports[_0xb381('0x2d')]=function(_0x1c73b5,_0x3659e5){var _0x1f1b62={},_0x39c5e0={},_0x226284={'count':0x0,'rows':[]};var _0x3401cd=_[_0xb381('0x2e')](db[_0xb381('0x2f')][_0xb381('0x30')],function(_0x471b43){return{'name':_0x471b43[_0xb381('0x31')],'type':_0x471b43[_0xb381('0x32')][_0xb381('0x33')]};});_0x39c5e0['model']=_[_0xb381('0x2e')](_0x3401cd,_0xb381('0x2b'));_0x39c5e0[_0xb381('0x34')]=_['keys'](_0x1c73b5[_0xb381('0x34')]);_0x39c5e0[_0xb381('0x35')]=_['intersection'](_0x39c5e0['model'],_0x39c5e0[_0xb381('0x34')]);_0x1f1b62[_0xb381('0x36')]=_[_0xb381('0x37')](_0x39c5e0['model'],qs[_0xb381('0x38')](_0x1c73b5['query'][_0xb381('0x38')]));_0x1f1b62[_0xb381('0x36')]=_0x1f1b62[_0xb381('0x36')][_0xb381('0x39')]?_0x1f1b62['attributes']:_0x39c5e0[_0xb381('0x3a')];if(!_0x1c73b5[_0xb381('0x34')]['hasOwnProperty']('nolimit')){_0x1f1b62[_0xb381('0x1f')]=qs[_0xb381('0x1f')](_0x1c73b5[_0xb381('0x34')]['limit']);_0x1f1b62[_0xb381('0x1d')]=qs[_0xb381('0x1d')](_0x1c73b5['query'][_0xb381('0x1d')]);}_0x1f1b62['order']=qs[_0xb381('0x3b')](_0x1c73b5['query'][_0xb381('0x3b')]);_0x1f1b62[_0xb381('0x3c')]=qs[_0xb381('0x35')](_[_0xb381('0x3d')](_0x1c73b5[_0xb381('0x34')],_0x39c5e0[_0xb381('0x35')]),_0x3401cd);if(_0x1c73b5[_0xb381('0x34')][_0xb381('0x3e')]){_0x1f1b62[_0xb381('0x3c')]=_[_0xb381('0x3f')](_0x1f1b62[_0xb381('0x3c')],{'$or':_[_0xb381('0x2e')](_0x3401cd,function(_0x2d9e10){if(_0x2d9e10['type']!=='VIRTUAL'){var _0x323853={};_0x323853[_0x2d9e10[_0xb381('0x2b')]]={'$like':'%'+_0x1c73b5[_0xb381('0x34')][_0xb381('0x3e')]+'%'};return _0x323853;}})});}_0x1f1b62=_[_0xb381('0x3f')]({},_0x1f1b62,_0x1c73b5[_0xb381('0x40')]);var _0x1e1aff={'where':_0x1f1b62['where']};return db[_0xb381('0x2f')][_0xb381('0x20')](_0x1e1aff)['then'](function(_0x2a8853){_0x226284[_0xb381('0x20')]=_0x2a8853;if(_0x1c73b5[_0xb381('0x34')][_0xb381('0x41')]){_0x1f1b62[_0xb381('0x42')]=[{'all':!![]}];}return db[_0xb381('0x2f')]['findAll'](_0x1f1b62);})['then'](function(_0x16c8cd){_0x226284[_0xb381('0x43')]=_0x16c8cd;return _0x226284;})['then'](respondWithFilteredResult(_0x3659e5,_0x1f1b62))[_0xb381('0x44')](handleError(_0x3659e5,null));};exports[_0xb381('0x45')]=function(_0x41d978,_0x29d719){var _0x40831c={'raw':![],'where':{'id':_0x41d978[_0xb381('0x46')]['id']}},_0x4a982f={};_0x4a982f['model']=_[_0xb381('0x47')](db['AnalyticFieldReport'][_0xb381('0x30')]);_0x4a982f[_0xb381('0x34')]=_[_0xb381('0x47')](_0x41d978[_0xb381('0x34')]);_0x4a982f[_0xb381('0x35')]=_[_0xb381('0x37')](_0x4a982f[_0xb381('0x3a')],_0x4a982f['query']);_0x40831c['attributes']=_[_0xb381('0x37')](_0x4a982f[_0xb381('0x3a')],qs['fields'](_0x41d978[_0xb381('0x34')][_0xb381('0x38')]));_0x40831c[_0xb381('0x36')]=_0x40831c['attributes'][_0xb381('0x39')]?_0x40831c['attributes']:_0x4a982f[_0xb381('0x3a')];if(_0x41d978[_0xb381('0x34')][_0xb381('0x41')]){_0x40831c[_0xb381('0x42')]=[{'all':!![]}];}_0x40831c=_[_0xb381('0x3f')]({},_0x40831c,_0x41d978[_0xb381('0x40')]);return db[_0xb381('0x2f')][_0xb381('0x48')](_0x40831c)[_0xb381('0x27')](handleEntityNotFound(_0x29d719,null))['then'](respondWithResult(_0x29d719,null))[_0xb381('0x44')](handleError(_0x29d719,null));};exports['create']=function(_0x98053d,_0x5a112c){return db[_0xb381('0x2f')][_0xb381('0x49')](_0x98053d[_0xb381('0x4a')],{})['then'](respondWithResult(_0x5a112c,0xc9))[_0xb381('0x44')](handleError(_0x5a112c,null));};exports[_0xb381('0x4b')]=function(_0x58656b,_0x33e11b){return db[_0xb381('0x2f')][_0xb381('0x4b')](_0x58656b[_0xb381('0x4a')],{'raw':![],'individualHooks':!![]})[_0xb381('0x27')](respondWithResult(_0x33e11b,0xc9))[_0xb381('0x44')](handleError(_0x33e11b,null));};exports[_0xb381('0x26')]=function(_0x186721,_0x49db8a){if(_0x186721[_0xb381('0x4a')]['id']){delete _0x186721[_0xb381('0x4a')]['id'];}return db[_0xb381('0x2f')]['find']({'where':{'id':_0x186721[_0xb381('0x46')]['id']}})[_0xb381('0x27')](handleEntityNotFound(_0x49db8a,null))['then'](saveUpdates(_0x186721[_0xb381('0x4a')],null))[_0xb381('0x27')](respondWithResult(_0x49db8a,null))['catch'](handleError(_0x49db8a,null));};exports['destroy']=function(_0x460264,_0x3fcd51){return db[_0xb381('0x2f')][_0xb381('0x48')]({'where':{'id':_0x460264[_0xb381('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fcd51,null))['then'](removeEntity(_0x3fcd51,null))['catch'](handleError(_0x3fcd51,null));};exports['bulkDestroy']=function(_0x7e0157,_0x2740fa){return db[_0xb381('0x2f')][_0xb381('0x28')]({'where':{'id':_0x7e0157[_0xb381('0x34')][_0xb381('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xb381('0x27')](respondWithResult(_0x2740fa,0xcc))[_0xb381('0x44')](handleError(_0x2740fa,null));};exports[_0xb381('0x4d')]=function(_0x34e302,_0x598823,_0x2280c1){return db[_0xb381('0x4e')][_0xb381('0x4f')]({'where':{'id':_0x34e302[_0xb381('0x46')]['id']}})['then'](handleEntityNotFound(_0x598823,null))[_0xb381('0x27')](function(_0x215b6a){if(_0x215b6a){return db['sequelize'][_0xb381('0x50')](function(_0x3c702e){return db[_0xb381('0x2f')]['destroy']({'where':{'CustomReportId':_0x34e302[_0xb381('0x46')]['id']},'transaction':_0x3c702e})['then'](function(_0x36786b){var _0x3989f8=_[_0xb381('0x2e')](_0x34e302[_0xb381('0x4a')],function(_0x591ab3){delete _0x591ab3['id'];_0x591ab3[_0xb381('0x51')]=_0x34e302[_0xb381('0x46')]['id'];return _0x591ab3;});return db[_0xb381('0x2f')][_0xb381('0x4b')](_0x3989f8,{'transaction':_0x3c702e});});})[_0xb381('0x27')](function(){return db[_0xb381('0x2f')]['findAll']({'where':{'CustomReportId':_0x34e302[_0xb381('0x46')]['id']}});});}})[_0xb381('0x27')](respondWithResult(_0x598823,null))['catch'](handleError(_0x598823,null));}; \ No newline at end of file +var _0x1c1a=['bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','sendStatus','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','include','catch','show','params','create','body'];(function(_0x1af9e2,_0x144382){var _0x547b9f=function(_0x352f95){while(--_0x352f95){_0x1af9e2['push'](_0x1af9e2['shift']());}};_0x547b9f(++_0x144382);}(_0x1c1a,0x1b9));var _0xa1c1=function(_0x11ed4a,_0x1e0209){_0x11ed4a=_0x11ed4a-0x0;var _0x97a974=_0x1c1a[_0x11ed4a];return _0x97a974;};'use strict';var emlformat=require(_0xa1c1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c1('0x2'));var moment=require(_0xa1c1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa1c1('0x4'));var util=require(_0xa1c1('0x5'));var path=require(_0xa1c1('0x6'));var sox=require(_0xa1c1('0x7'));var csv=require(_0xa1c1('0x8'));var ejs=require(_0xa1c1('0x9'));var fs=require('fs');var fs_extra=require(_0xa1c1('0xa'));var _=require(_0xa1c1('0xb'));var squel=require(_0xa1c1('0xc'));var crypto=require(_0xa1c1('0xd'));var jsforce=require(_0xa1c1('0xe'));var deskjs=require(_0xa1c1('0xf'));var toCsv=require(_0xa1c1('0x8'));var querystring=require(_0xa1c1('0x10'));var Papa=require(_0xa1c1('0x11'));var Redis=require(_0xa1c1('0x12'));var authService=require(_0xa1c1('0x13'));var qs=require(_0xa1c1('0x14'));var as=require(_0xa1c1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa1c1('0x16'));var utils=require(_0xa1c1('0x17'));var config=require(_0xa1c1('0x18'));var licenseUtil=require(_0xa1c1('0x19'));var db=require(_0xa1c1('0x1a'))['db'];function respondWithStatusCode(_0x9647ca,_0x5a9118){_0x5a9118=_0x5a9118||0xcc;return function(_0x1b6507){if(_0x1b6507){return _0x9647ca['sendStatus'](_0x5a9118);}return _0x9647ca[_0xa1c1('0x1b')](_0x5a9118)['end']();};}function respondWithResult(_0x67d7a6,_0x58155b){_0x58155b=_0x58155b||0xc8;return function(_0x4e4c1c){if(_0x4e4c1c){return _0x67d7a6['status'](_0x58155b)[_0xa1c1('0x1c')](_0x4e4c1c);}};}function respondWithFilteredResult(_0x315cd7,_0x4e205e){return function(_0x2f818f){if(_0x2f818f){var _0x2204ae=typeof _0x4e205e[_0xa1c1('0x1d')]===_0xa1c1('0x1e')&&typeof _0x4e205e[_0xa1c1('0x1f')]==='undefined';var _0x24e3f3=_0x2f818f[_0xa1c1('0x20')];var _0x270bae=_0x2204ae?0x0:_0x4e205e[_0xa1c1('0x1d')];var _0x5de484=_0x2204ae?_0x2f818f['count']:_0x4e205e[_0xa1c1('0x1d')]+_0x4e205e[_0xa1c1('0x1f')];var _0x1c98f4;if(_0x5de484>=_0x24e3f3){_0x5de484=_0x24e3f3;_0x1c98f4=0xc8;}else{_0x1c98f4=0xce;}_0x315cd7[_0xa1c1('0x1b')](_0x1c98f4);return _0x315cd7[_0xa1c1('0x21')](_0xa1c1('0x22'),_0x270bae+'-'+_0x5de484+'/'+_0x24e3f3)[_0xa1c1('0x1c')](_0x2f818f);}return null;};}function patchUpdates(_0x130d7f){return function(_0x3a30c9){try{jsonpatch[_0xa1c1('0x23')](_0x3a30c9,_0x130d7f,!![]);}catch(_0x56482a){return BPromise[_0xa1c1('0x24')](_0x56482a);}return _0x3a30c9[_0xa1c1('0x25')]();};}function saveUpdates(_0x1f969c,_0x39bad1){return function(_0x5e020c){if(_0x5e020c){return _0x5e020c['update'](_0x1f969c)[_0xa1c1('0x26')](function(_0x3573a2){return _0x3573a2;});}return null;};}function removeEntity(_0x54f4a2,_0x308a6b){return function(_0x12a5b3){if(_0x12a5b3){return _0x12a5b3[_0xa1c1('0x27')]()[_0xa1c1('0x26')](function(){_0x54f4a2[_0xa1c1('0x1b')](0xcc)[_0xa1c1('0x28')]();});}};}function handleEntityNotFound(_0x17765a,_0x32c262){return function(_0x44e10e){if(!_0x44e10e){_0x17765a[_0xa1c1('0x29')](0x194);}return _0x44e10e;};}function handleError(_0x1f1a15,_0x452d63){_0x452d63=_0x452d63||0x1f4;return function(_0x24868c){logger[_0xa1c1('0x2a')](_0x24868c['stack']);if(_0x24868c[_0xa1c1('0x2b')]){delete _0x24868c[_0xa1c1('0x2b')];}_0x1f1a15[_0xa1c1('0x1b')](_0x452d63)[_0xa1c1('0x2c')](_0x24868c);};}exports[_0xa1c1('0x2d')]=function(_0x465829,_0x60379c){var _0x3513ec={},_0x93ffb7={},_0x4215e1={'count':0x0,'rows':[]};var _0x4ae71a=_[_0xa1c1('0x2e')](db['AnalyticFieldReport'][_0xa1c1('0x2f')],function(_0x4a4763){return{'name':_0x4a4763['fieldName'],'type':_0x4a4763[_0xa1c1('0x30')][_0xa1c1('0x31')]};});_0x93ffb7[_0xa1c1('0x32')]=_[_0xa1c1('0x2e')](_0x4ae71a,_0xa1c1('0x2b'));_0x93ffb7[_0xa1c1('0x33')]=_[_0xa1c1('0x34')](_0x465829[_0xa1c1('0x33')]);_0x93ffb7[_0xa1c1('0x35')]=_[_0xa1c1('0x36')](_0x93ffb7['model'],_0x93ffb7[_0xa1c1('0x33')]);_0x3513ec[_0xa1c1('0x37')]=_[_0xa1c1('0x36')](_0x93ffb7[_0xa1c1('0x32')],qs[_0xa1c1('0x38')](_0x465829[_0xa1c1('0x33')][_0xa1c1('0x38')]));_0x3513ec[_0xa1c1('0x37')]=_0x3513ec[_0xa1c1('0x37')][_0xa1c1('0x39')]?_0x3513ec[_0xa1c1('0x37')]:_0x93ffb7[_0xa1c1('0x32')];if(!_0x465829[_0xa1c1('0x33')][_0xa1c1('0x3a')](_0xa1c1('0x3b'))){_0x3513ec['limit']=qs[_0xa1c1('0x1f')](_0x465829[_0xa1c1('0x33')][_0xa1c1('0x1f')]);_0x3513ec[_0xa1c1('0x1d')]=qs['offset'](_0x465829[_0xa1c1('0x33')][_0xa1c1('0x1d')]);}_0x3513ec[_0xa1c1('0x3c')]=qs[_0xa1c1('0x3d')](_0x465829[_0xa1c1('0x33')][_0xa1c1('0x3d')]);_0x3513ec[_0xa1c1('0x3e')]=qs[_0xa1c1('0x35')](_['pick'](_0x465829[_0xa1c1('0x33')],_0x93ffb7[_0xa1c1('0x35')]),_0x4ae71a);if(_0x465829[_0xa1c1('0x33')][_0xa1c1('0x3f')]){_0x3513ec[_0xa1c1('0x3e')]=_[_0xa1c1('0x40')](_0x3513ec[_0xa1c1('0x3e')],{'$or':_[_0xa1c1('0x2e')](_0x4ae71a,function(_0x14b4de){if(_0x14b4de['type']!==_0xa1c1('0x41')){var _0xb6b64c={};_0xb6b64c[_0x14b4de['name']]={'$like':'%'+_0x465829[_0xa1c1('0x33')]['filter']+'%'};return _0xb6b64c;}})});}_0x3513ec=_['merge']({},_0x3513ec,_0x465829[_0xa1c1('0x42')]);var _0x92eea5={'where':_0x3513ec[_0xa1c1('0x3e')]};return db[_0xa1c1('0x43')]['count'](_0x92eea5)['then'](function(_0x10767e){_0x4215e1[_0xa1c1('0x20')]=_0x10767e;if(_0x465829['query'][_0xa1c1('0x44')]){_0x3513ec[_0xa1c1('0x45')]=[{'all':!![]}];}return db[_0xa1c1('0x43')]['findAll'](_0x3513ec);})[_0xa1c1('0x26')](function(_0x216979){_0x4215e1['rows']=_0x216979;return _0x4215e1;})[_0xa1c1('0x26')](respondWithFilteredResult(_0x60379c,_0x3513ec))[_0xa1c1('0x46')](handleError(_0x60379c,null));};exports[_0xa1c1('0x47')]=function(_0x3dd13c,_0x1613e4){var _0x405b23={'raw':![],'where':{'id':_0x3dd13c[_0xa1c1('0x48')]['id']}},_0x253255={};_0x253255['model']=_[_0xa1c1('0x34')](db[_0xa1c1('0x43')][_0xa1c1('0x2f')]);_0x253255[_0xa1c1('0x33')]=_[_0xa1c1('0x34')](_0x3dd13c[_0xa1c1('0x33')]);_0x253255[_0xa1c1('0x35')]=_[_0xa1c1('0x36')](_0x253255[_0xa1c1('0x32')],_0x253255[_0xa1c1('0x33')]);_0x405b23[_0xa1c1('0x37')]=_[_0xa1c1('0x36')](_0x253255[_0xa1c1('0x32')],qs[_0xa1c1('0x38')](_0x3dd13c[_0xa1c1('0x33')][_0xa1c1('0x38')]));_0x405b23['attributes']=_0x405b23[_0xa1c1('0x37')][_0xa1c1('0x39')]?_0x405b23['attributes']:_0x253255[_0xa1c1('0x32')];if(_0x3dd13c[_0xa1c1('0x33')][_0xa1c1('0x44')]){_0x405b23[_0xa1c1('0x45')]=[{'all':!![]}];}_0x405b23=_[_0xa1c1('0x40')]({},_0x405b23,_0x3dd13c[_0xa1c1('0x42')]);return db['AnalyticFieldReport']['find'](_0x405b23)['then'](handleEntityNotFound(_0x1613e4,null))[_0xa1c1('0x26')](respondWithResult(_0x1613e4,null))[_0xa1c1('0x46')](handleError(_0x1613e4,null));};exports[_0xa1c1('0x49')]=function(_0x4e7a84,_0x3cb995){return db[_0xa1c1('0x43')]['create'](_0x4e7a84[_0xa1c1('0x4a')],{})[_0xa1c1('0x26')](respondWithResult(_0x3cb995,0xc9))[_0xa1c1('0x46')](handleError(_0x3cb995,null));};exports[_0xa1c1('0x4b')]=function(_0x92db99,_0x941fb7){return db[_0xa1c1('0x43')][_0xa1c1('0x4b')](_0x92db99[_0xa1c1('0x4a')],{'raw':![],'individualHooks':!![]})[_0xa1c1('0x26')](respondWithResult(_0x941fb7,0xc9))[_0xa1c1('0x46')](handleError(_0x941fb7,null));};exports[_0xa1c1('0x4c')]=function(_0x35244f,_0x5a958c){if(_0x35244f[_0xa1c1('0x4a')]['id']){delete _0x35244f[_0xa1c1('0x4a')]['id'];}return db[_0xa1c1('0x43')]['find']({'where':{'id':_0x35244f[_0xa1c1('0x48')]['id']}})[_0xa1c1('0x26')](handleEntityNotFound(_0x5a958c,null))[_0xa1c1('0x26')](saveUpdates(_0x35244f[_0xa1c1('0x4a')],null))['then'](respondWithResult(_0x5a958c,null))['catch'](handleError(_0x5a958c,null));};exports['destroy']=function(_0x109d5c,_0x378905){return db['AnalyticFieldReport']['find']({'where':{'id':_0x109d5c[_0xa1c1('0x48')]['id']}})[_0xa1c1('0x26')](handleEntityNotFound(_0x378905,null))[_0xa1c1('0x26')](removeEntity(_0x378905,null))[_0xa1c1('0x46')](handleError(_0x378905,null));};exports[_0xa1c1('0x4d')]=function(_0x44446a,_0x3a2b9f){return db[_0xa1c1('0x43')][_0xa1c1('0x27')]({'where':{'id':_0x44446a[_0xa1c1('0x33')][_0xa1c1('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0xa1c1('0x26')](respondWithResult(_0x3a2b9f,0xcc))[_0xa1c1('0x46')](handleError(_0x3a2b9f,null));};exports[_0xa1c1('0x4f')]=function(_0x387f62,_0x1521a9,_0x1bfbc5){return db[_0xa1c1('0x50')][_0xa1c1('0x51')]({'where':{'id':_0x387f62[_0xa1c1('0x48')]['id']}})['then'](handleEntityNotFound(_0x1521a9,null))['then'](function(_0x1b8a94){if(_0x1b8a94){return db[_0xa1c1('0x52')][_0xa1c1('0x53')](function(_0x349737){return db[_0xa1c1('0x43')][_0xa1c1('0x27')]({'where':{'CustomReportId':_0x387f62[_0xa1c1('0x48')]['id']},'transaction':_0x349737})[_0xa1c1('0x26')](function(_0x5e5e83){var _0x29210b=_[_0xa1c1('0x2e')](_0x387f62[_0xa1c1('0x4a')],function(_0x262778){delete _0x262778['id'];_0x262778[_0xa1c1('0x54')]=_0x387f62['params']['id'];return _0x262778;});return db[_0xa1c1('0x43')][_0xa1c1('0x4b')](_0x29210b,{'transaction':_0x349737});});})[_0xa1c1('0x26')](function(){return db[_0xa1c1('0x43')][_0xa1c1('0x55')]({'where':{'CustomReportId':_0x387f62[_0xa1c1('0x48')]['id']}});});}})[_0xa1c1('0x26')](respondWithResult(_0x1521a9,null))[_0xa1c1('0x46')](handleError(_0x1521a9,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9620a35..467a61a 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 _0xbfcc=['api','moment','request-promise','path','../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger'];(function(_0x316fba,_0x2ddcb5){var _0x2ee42d=function(_0x582419){while(--_0x582419){_0x316fba['push'](_0x316fba['shift']());}};_0x2ee42d(++_0x2ddcb5);}(_0xbfcc,0x128));var _0xcbfc=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0xbfcc[_0x1e6659];return _0x4d16e4;};'use strict';var _=require(_0xcbfc('0x0'));var util=require(_0xcbfc('0x1'));var logger=require(_0xcbfc('0x2'))(_0xcbfc('0x3'));var moment=require(_0xcbfc('0x4'));var BPromise=require('bluebird');var rp=require(_0xcbfc('0x5'));var fs=require('fs');var path=require(_0xcbfc('0x6'));var rimraf=require('rimraf');var config=require(_0xcbfc('0x7'));var attributes=require(_0xcbfc('0x8'));module[_0xcbfc('0x9')]=function(_0x589009,_0x401957){return _0x589009[_0xcbfc('0xa')](_0xcbfc('0xb'),attributes,{'tableName':_0xcbfc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8328=['moment','bluebird','request-promise','path','rimraf','./analyticFieldReport.attributes','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api'];(function(_0x2d84fa,_0x401f8a){var _0x3338be=function(_0x319b8b){while(--_0x319b8b){_0x2d84fa['push'](_0x2d84fa['shift']());}};_0x3338be(++_0x401f8a);}(_0x8328,0x7e));var _0x8832=function(_0x2ed056,_0x1ca64f){_0x2ed056=_0x2ed056-0x0;var _0x191198=_0x8328[_0x2ed056];return _0x191198;};'use strict';var _=require(_0x8832('0x0'));var util=require(_0x8832('0x1'));var logger=require(_0x8832('0x2'))(_0x8832('0x3'));var moment=require(_0x8832('0x4'));var BPromise=require(_0x8832('0x5'));var rp=require(_0x8832('0x6'));var fs=require('fs');var path=require(_0x8832('0x7'));var rimraf=require(_0x8832('0x8'));var config=require('../../config/environment');var attributes=require(_0x8832('0x9'));module['exports']=function(_0x55a546,_0x2efd90){return _0x55a546[_0x8832('0xa')](_0x8832('0xb'),attributes,{'tableName':_0x8832('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index d3de0db..3438338 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 _0xcf9f=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x5ad973,_0x3cc9de){var _0x3407ed=function(_0x58c4fb){while(--_0x58c4fb){_0x5ad973['push'](_0x5ad973['shift']());}};_0x3407ed(++_0x3cc9de);}(_0xcf9f,0x13d));var _0xfcf9=function(_0x5e7f47,_0x2f526e){_0x5e7f47=_0x5e7f47-0x0;var _0x57caee=_0xcf9f[_0x5e7f47];return _0x57caee;};'use strict';var _=require('lodash');var util=require(_0xfcf9('0x0'));var moment=require(_0xfcf9('0x1'));var BPromise=require('bluebird');var rs=require(_0xfcf9('0x2'));var fs=require('fs');var Redis=require(_0xfcf9('0x3'));var db=require(_0xfcf9('0x4'))['db'];var utils=require(_0xfcf9('0x5'));var logger=require(_0xfcf9('0x6'))(_0xfcf9('0x7'));var config=require(_0xfcf9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfcf9('0x9')][_0xfcf9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ef0b7,_0x16d535,_0x3d4b00){return new BPromise(function(_0x37c825,_0xc3930d){return client[_0xfcf9('0xb')](_0x1ef0b7,_0x3d4b00)[_0xfcf9('0xc')](function(_0x192908){logger[_0xfcf9('0xd')](_0xfcf9('0xe'),_0x16d535,_0xfcf9('0xf'));logger['debug'](_0xfcf9('0x10'),_0x16d535,'request\x20sent',JSON[_0xfcf9('0x11')](_0x192908));if(_0x192908['error']){if(_0x192908[_0xfcf9('0x12')][_0xfcf9('0x13')]===0x1f4){logger[_0xfcf9('0x12')](_0xfcf9('0xe'),_0x16d535,_0x192908[_0xfcf9('0x12')]['message']);return _0xc3930d(_0x192908['error']['message']);}logger[_0xfcf9('0x12')](_0xfcf9('0xe'),_0x16d535,_0x192908[_0xfcf9('0x12')]['message']);return _0x37c825(_0x192908[_0xfcf9('0x12')][_0xfcf9('0x14')]);}else{logger[_0xfcf9('0xd')](_0xfcf9('0xe'),_0x16d535,_0xfcf9('0xf'));_0x37c825(_0x192908[_0xfcf9('0x15')][_0xfcf9('0x14')]);}})[_0xfcf9('0x16')](function(_0xc16c6c){logger[_0xfcf9('0x12')](_0xfcf9('0xe'),_0x16d535,_0xc16c6c);_0xc3930d(_0xc16c6c);});});} \ No newline at end of file +var _0x0584=['jayson/promise','client','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x46c890,_0x2e5150){var _0x10502d=function(_0x4618ee){while(--_0x4618ee){_0x46c890['push'](_0x46c890['shift']());}};_0x10502d(++_0x2e5150);}(_0x0584,0xe7));var _0x4058=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x0584[_0x342700];return _0x53406f;};'use strict';var _=require(_0x4058('0x0'));var util=require(_0x4058('0x1'));var moment=require(_0x4058('0x2'));var BPromise=require(_0x4058('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4058('0x4'));var db=require(_0x4058('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4058('0x6'))(_0x4058('0x7'));var config=require(_0x4058('0x8'));var jayson=require(_0x4058('0x9'));var client=jayson[_0x4058('0xa')][_0x4058('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eb1e0,_0x247ff7,_0x58cbb2){return new BPromise(function(_0x173218,_0x281fd0){return client[_0x4058('0xc')](_0x5eb1e0,_0x58cbb2)[_0x4058('0xd')](function(_0x4e6950){logger[_0x4058('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x247ff7,_0x4058('0xf'));logger[_0x4058('0x10')](_0x4058('0x11'),_0x247ff7,_0x4058('0xf'),JSON[_0x4058('0x12')](_0x4e6950));if(_0x4e6950['error']){if(_0x4e6950[_0x4058('0x13')]['code']===0x1f4){logger[_0x4058('0x13')](_0x4058('0x14'),_0x247ff7,_0x4e6950[_0x4058('0x13')]['message']);return _0x281fd0(_0x4e6950['error'][_0x4058('0x15')]);}logger[_0x4058('0x13')](_0x4058('0x14'),_0x247ff7,_0x4e6950[_0x4058('0x13')][_0x4058('0x15')]);return _0x173218(_0x4e6950[_0x4058('0x13')][_0x4058('0x15')]);}else{logger[_0x4058('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x247ff7,_0x4058('0xf'));_0x173218(_0x4e6950[_0x4058('0x16')][_0x4058('0x15')]);}})[_0x4058('0x17')](function(_0x452004){logger[_0x4058('0x13')]('AnalyticFieldReport,\x20%s,\x20%s',_0x247ff7,_0x452004);_0x281fd0(_0x452004);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 18c0e25..b97087c 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(_0x545b51,_0x3928a0){var _0x9ac8a6=function(_0x3db365){while(--_0x3db365){_0x545b51['push'](_0x545b51['shift']());}};_0x9ac8a6(++_0x3928a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x27aa85,_0xfb9e4d){var _0x1c1c0a=function(_0x240b8e){while(--_0x240b8e){_0x27aa85['push'](_0x27aa85['shift']());}};_0x1c1c0a(++_0xfb9e4d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'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 f810418..8bd7262 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 _0xfc61=['sequelize','exports','STRING','name'];(function(_0x21be30,_0x470620){var _0x5874d8=function(_0xebaa72){while(--_0xebaa72){_0x21be30['push'](_0x21be30['shift']());}};_0x5874d8(++_0x470620);}(_0xfc61,0x78));var _0x1fc6=function(_0x4d2b3f,_0x408d7e){_0x4d2b3f=_0x4d2b3f-0x0;var _0x47bef1=_0xfc61[_0x4d2b3f];return _0x47bef1;};'use strict';var Sequelize=require(_0x1fc6('0x0'));module[_0x1fc6('0x1')]={'name':{'type':Sequelize[_0x1fc6('0x2')],'allowNull':![],'unique':_0x1fc6('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8cc=['TEXT','sequelize','exports','STRING'];(function(_0x3037a5,_0x3021c3){var _0x137ed2=function(_0x1a7e4d){while(--_0x1a7e4d){_0x3037a5['push'](_0x3037a5['shift']());}};_0x137ed2(++_0x3021c3);}(_0xd8cc,0xc9));var _0xcd8c=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xd8cc[_0x86b219];return _0x1f320c;};'use strict';var Sequelize=require(_0xcd8c('0x0'));module[_0xcd8c('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xcd8c('0x2')]},'metric':{'type':Sequelize[_0xcd8c('0x3')]},'description':{'type':Sequelize[_0xcd8c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index acc8231..0c8f4be 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 _0x9a19=['AnalyticMetric','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','body','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Metrics','stack','name','send','index','map'];(function(_0x187371,_0x5ae3e3){var _0x3a7787=function(_0x50b23e){while(--_0x50b23e){_0x187371['push'](_0x187371['shift']());}};_0x3a7787(++_0x5ae3e3);}(_0x9a19,0x114));var _0x99a1=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x9a19[_0x31ced5];return _0x10d9e5;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];function respondWithStatusCode(_0x1bc7aa,_0x2ff655){_0x2ff655=_0x2ff655||0xcc;return function(_0x532f56){if(_0x532f56){return _0x1bc7aa[_0x99a1('0x19')](_0x2ff655);}return _0x1bc7aa[_0x99a1('0x1a')](_0x2ff655)[_0x99a1('0x1b')]();};}function respondWithResult(_0x47815e,_0xe1a1f){_0xe1a1f=_0xe1a1f||0xc8;return function(_0x3c9ef4){if(_0x3c9ef4){return _0x47815e[_0x99a1('0x1a')](_0xe1a1f)['json'](_0x3c9ef4);}};}function respondWithFilteredResult(_0x2d81ed,_0x3e45d4){return function(_0x1bb464){if(_0x1bb464){var _0x3d40cc=typeof _0x3e45d4[_0x99a1('0x1c')]===_0x99a1('0x1d')&&typeof _0x3e45d4[_0x99a1('0x1e')]==='undefined';var _0x4f049c=_0x1bb464[_0x99a1('0x1f')];var _0xbf62f1=_0x3d40cc?0x0:_0x3e45d4[_0x99a1('0x1c')];var _0x1fcd00=_0x3d40cc?_0x1bb464[_0x99a1('0x1f')]:_0x3e45d4[_0x99a1('0x1c')]+_0x3e45d4[_0x99a1('0x1e')];var _0x3cd62c;if(_0x1fcd00>=_0x4f049c){_0x1fcd00=_0x4f049c;_0x3cd62c=0xc8;}else{_0x3cd62c=0xce;}_0x2d81ed[_0x99a1('0x1a')](_0x3cd62c);return _0x2d81ed[_0x99a1('0x20')](_0x99a1('0x21'),_0xbf62f1+'-'+_0x1fcd00+'/'+_0x4f049c)['json'](_0x1bb464);}return null;};}function patchUpdates(_0x3023a1){return function(_0x20007e){try{jsonpatch['apply'](_0x20007e,_0x3023a1,!![]);}catch(_0x38435b){return BPromise['reject'](_0x38435b);}return _0x20007e[_0x99a1('0x22')]();};}function saveUpdates(_0x2927b0,_0x2d6f20){return function(_0x2d3b82){if(_0x2d3b82){return _0x2d3b82['update'](_0x2927b0)[_0x99a1('0x23')](function(_0x1268a7){return _0x1268a7;});}return null;};}function removeEntity(_0x483c17,_0x44df2d){return function(_0x5b5dfa){if(_0x5b5dfa){return _0x5b5dfa[_0x99a1('0x24')]()[_0x99a1('0x23')](function(){var _0x179597=_0x5b5dfa[_0x99a1('0x25')]({'plain':!![]});var _0x3c813=_0x99a1('0x26');return db['UserProfileResource'][_0x99a1('0x24')]({'where':{'type':_0x3c813,'resourceId':_0x179597['id']}})['then'](function(){return _0x5b5dfa;});})['then'](function(){_0x483c17[_0x99a1('0x1a')](0xcc)[_0x99a1('0x1b')]();});}};}function handleEntityNotFound(_0xa6799b,_0x15a0b6){return function(_0x25d560){if(!_0x25d560){_0xa6799b[_0x99a1('0x19')](0x194);}return _0x25d560;};}function handleError(_0x183037,_0x549645){_0x549645=_0x549645||0x1f4;return function(_0xf41b0d){logger['error'](_0xf41b0d[_0x99a1('0x27')]);if(_0xf41b0d[_0x99a1('0x28')]){delete _0xf41b0d[_0x99a1('0x28')];}_0x183037['status'](_0x549645)[_0x99a1('0x29')](_0xf41b0d);};}exports[_0x99a1('0x2a')]=function(_0x5718b9,_0x37514e){var _0x1434a0={},_0x36aa34={},_0x303d1e={'count':0x0,'rows':[]};var _0x2a5b8c=_[_0x99a1('0x2b')](db[_0x99a1('0x2c')][_0x99a1('0x2d')],function(_0x52da8d){return{'name':_0x52da8d['fieldName'],'type':_0x52da8d[_0x99a1('0x2e')]['key']};});_0x36aa34[_0x99a1('0x2f')]=_[_0x99a1('0x2b')](_0x2a5b8c,'name');_0x36aa34[_0x99a1('0x30')]=_[_0x99a1('0x31')](_0x5718b9[_0x99a1('0x30')]);_0x36aa34[_0x99a1('0x32')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],_0x36aa34[_0x99a1('0x30')]);_0x1434a0[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x36aa34[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1434a0[_0x99a1('0x34')]=_0x1434a0['attributes']['length']?_0x1434a0[_0x99a1('0x34')]:_0x36aa34[_0x99a1('0x2f')];if(!_0x5718b9[_0x99a1('0x30')][_0x99a1('0x36')](_0x99a1('0x37'))){_0x1434a0[_0x99a1('0x1e')]=qs[_0x99a1('0x1e')](_0x5718b9['query'][_0x99a1('0x1e')]);_0x1434a0[_0x99a1('0x1c')]=qs['offset'](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x1c')]);}_0x1434a0[_0x99a1('0x38')]=qs[_0x99a1('0x39')](_0x5718b9[_0x99a1('0x30')][_0x99a1('0x39')]);_0x1434a0[_0x99a1('0x3a')]=qs[_0x99a1('0x32')](_[_0x99a1('0x3b')](_0x5718b9[_0x99a1('0x30')],_0x36aa34[_0x99a1('0x32')]),_0x2a5b8c);if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]){_0x1434a0['where']=_['merge'](_0x1434a0['where'],{'$or':_[_0x99a1('0x2b')](_0x2a5b8c,function(_0x169df7){if(_0x169df7[_0x99a1('0x2e')]!==_0x99a1('0x3d')){var _0x40613a={};_0x40613a[_0x169df7['name']]={'$like':'%'+_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3c')]+'%'};return _0x40613a;}})});}_0x1434a0=_[_0x99a1('0x3e')]({},_0x1434a0,_0x5718b9['options']);var _0x49be37={'where':_0x1434a0[_0x99a1('0x3a')]};return db[_0x99a1('0x2c')][_0x99a1('0x1f')](_0x49be37)['then'](function(_0x6c4cb){_0x303d1e[_0x99a1('0x1f')]=_0x6c4cb;if(_0x5718b9[_0x99a1('0x30')][_0x99a1('0x3f')]){_0x1434a0[_0x99a1('0x40')]=[{'all':!![]}];}return db[_0x99a1('0x2c')][_0x99a1('0x41')](_0x1434a0);})[_0x99a1('0x23')](function(_0x1c4ce4){_0x303d1e[_0x99a1('0x42')]=_0x1c4ce4;return _0x303d1e;})['then'](respondWithFilteredResult(_0x37514e,_0x1434a0))[_0x99a1('0x43')](handleError(_0x37514e,null));};exports[_0x99a1('0x44')]=function(_0x3d5373,_0x50d38b){var _0x1beed2={'raw':!![],'where':{'id':_0x3d5373[_0x99a1('0x45')]['id']}},_0x51536d={};_0x51536d[_0x99a1('0x2f')]=_[_0x99a1('0x31')](db[_0x99a1('0x2c')][_0x99a1('0x2d')]);_0x51536d[_0x99a1('0x30')]=_['keys'](_0x3d5373[_0x99a1('0x30')]);_0x51536d['filters']=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],_0x51536d[_0x99a1('0x30')]);_0x1beed2[_0x99a1('0x34')]=_[_0x99a1('0x33')](_0x51536d[_0x99a1('0x2f')],qs[_0x99a1('0x35')](_0x3d5373[_0x99a1('0x30')][_0x99a1('0x35')]));_0x1beed2[_0x99a1('0x34')]=_0x1beed2[_0x99a1('0x34')]['length']?_0x1beed2[_0x99a1('0x34')]:_0x51536d[_0x99a1('0x2f')];if(_0x3d5373['query'][_0x99a1('0x3f')]){_0x1beed2[_0x99a1('0x40')]=[{'all':!![]}];}_0x1beed2=_[_0x99a1('0x3e')]({},_0x1beed2,_0x3d5373[_0x99a1('0x46')]);return db[_0x99a1('0x2c')][_0x99a1('0x47')](_0x1beed2)[_0x99a1('0x23')](handleEntityNotFound(_0x50d38b,null))['then'](respondWithResult(_0x50d38b,null))[_0x99a1('0x43')](handleError(_0x50d38b,null));};exports['create']=function(_0x1d4d3f,_0x269798){return db['AnalyticMetric']['create'](_0x1d4d3f[_0x99a1('0x48')],{})[_0x99a1('0x23')](function(_0x462c15){var _0x4519fb=_0x1d4d3f[_0x99a1('0x49')]['get']({'plain':!![]});if(!_0x4519fb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4519fb['role']===_0x99a1('0x49')){var _0x4ae90e=_0x462c15[_0x99a1('0x25')]({'plain':!![]});var _0x30fdfb=_0x99a1('0x26');return db[_0x99a1('0x4a')][_0x99a1('0x47')]({'where':{'name':_0x30fdfb,'userProfileId':_0x4519fb['userProfileId']},'raw':!![]})[_0x99a1('0x23')](function(_0x22bfd8){if(_0x22bfd8&&_0x22bfd8[_0x99a1('0x4b')]===0x0){return db['UserProfileResource'][_0x99a1('0x4c')]({'name':_0x4ae90e['name'],'resourceId':_0x4ae90e['id'],'type':_0x22bfd8['name'],'sectionId':_0x22bfd8['id']},{})[_0x99a1('0x23')](function(){return _0x462c15;});}else{return _0x462c15;}})[_0x99a1('0x43')](function(_0x1dd17b){logger[_0x99a1('0x4d')](_0x99a1('0x4e'),_0x1dd17b);throw _0x1dd17b;});}return _0x462c15;})[_0x99a1('0x23')](respondWithResult(_0x269798,0xc9))[_0x99a1('0x43')](handleError(_0x269798,null));};exports[_0x99a1('0x4f')]=function(_0x16641e,_0x53e9eb){if(_0x16641e[_0x99a1('0x48')]['id']){delete _0x16641e['body']['id'];}return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x16641e['params']['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x53e9eb,null))[_0x99a1('0x23')](saveUpdates(_0x16641e[_0x99a1('0x48')],null))[_0x99a1('0x23')](respondWithResult(_0x53e9eb,null))[_0x99a1('0x43')](handleError(_0x53e9eb,null));};exports[_0x99a1('0x24')]=function(_0x157c49,_0x1a5658){return db[_0x99a1('0x2c')][_0x99a1('0x47')]({'where':{'id':_0x157c49[_0x99a1('0x45')]['id']}})[_0x99a1('0x23')](handleEntityNotFound(_0x1a5658,null))['then'](removeEntity(_0x1a5658,null))['catch'](handleError(_0x1a5658,null));}; \ No newline at end of file +var _0x6aa7=['json','apply','reject','save','update','then','destroy','get','Metrics','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','show','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','UserProfileResource','catch','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range'];(function(_0x493c7a,_0x30ea93){var _0x1ad499=function(_0x5c8318){while(--_0x5c8318){_0x493c7a['push'](_0x493c7a['shift']());}};_0x1ad499(++_0x30ea93);}(_0x6aa7,0x178));var _0x76aa=function(_0x479ac7,_0x56770f){_0x479ac7=_0x479ac7-0x0;var _0x46633d=_0x6aa7[_0x479ac7];return _0x46633d;};'use strict';var emlformat=require(_0x76aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x76aa('0x1'));var jsonpatch=require(_0x76aa('0x2'));var rp=require(_0x76aa('0x3'));var moment=require(_0x76aa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x76aa('0x5'));var util=require(_0x76aa('0x6'));var path=require(_0x76aa('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x76aa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76aa('0x9'));var squel=require(_0x76aa('0xa'));var crypto=require(_0x76aa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x76aa('0xc'));var toCsv=require(_0x76aa('0xd'));var querystring=require(_0x76aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x76aa('0xf'));var authService=require(_0x76aa('0x10'));var qs=require(_0x76aa('0x11'));var as=require(_0x76aa('0x12'));var hardwareService=require(_0x76aa('0x13'));var logger=require(_0x76aa('0x14'))(_0x76aa('0x15'));var utils=require(_0x76aa('0x16'));var config=require(_0x76aa('0x17'));var licenseUtil=require(_0x76aa('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x112c39,_0x5df49c){_0x5df49c=_0x5df49c||0xcc;return function(_0x226536){if(_0x226536){return _0x112c39[_0x76aa('0x19')](_0x5df49c);}return _0x112c39[_0x76aa('0x1a')](_0x5df49c)[_0x76aa('0x1b')]();};}function respondWithResult(_0x10432c,_0x4e309f){_0x4e309f=_0x4e309f||0xc8;return function(_0x5f5b59){if(_0x5f5b59){return _0x10432c[_0x76aa('0x1a')](_0x4e309f)['json'](_0x5f5b59);}};}function respondWithFilteredResult(_0x180d92,_0x319bf1){return function(_0x5cf594){if(_0x5cf594){var _0x2111c7=typeof _0x319bf1['offset']===_0x76aa('0x1c')&&typeof _0x319bf1['limit']===_0x76aa('0x1c');var _0x413cf6=_0x5cf594[_0x76aa('0x1d')];var _0x21c16d=_0x2111c7?0x0:_0x319bf1[_0x76aa('0x1e')];var _0x3ead3f=_0x2111c7?_0x5cf594['count']:_0x319bf1['offset']+_0x319bf1[_0x76aa('0x1f')];var _0x454dd3;if(_0x3ead3f>=_0x413cf6){_0x3ead3f=_0x413cf6;_0x454dd3=0xc8;}else{_0x454dd3=0xce;}_0x180d92[_0x76aa('0x1a')](_0x454dd3);return _0x180d92[_0x76aa('0x20')](_0x76aa('0x21'),_0x21c16d+'-'+_0x3ead3f+'/'+_0x413cf6)[_0x76aa('0x22')](_0x5cf594);}return null;};}function patchUpdates(_0x19af92){return function(_0x2eaf48){try{jsonpatch[_0x76aa('0x23')](_0x2eaf48,_0x19af92,!![]);}catch(_0x5990c1){return BPromise[_0x76aa('0x24')](_0x5990c1);}return _0x2eaf48[_0x76aa('0x25')]();};}function saveUpdates(_0x338a6b,_0x5b3f55){return function(_0x41463a){if(_0x41463a){return _0x41463a[_0x76aa('0x26')](_0x338a6b)[_0x76aa('0x27')](function(_0x2bd2c6){return _0x2bd2c6;});}return null;};}function removeEntity(_0x29c50c,_0xc1044c){return function(_0x3cd039){if(_0x3cd039){return _0x3cd039[_0x76aa('0x28')]()[_0x76aa('0x27')](function(){var _0x2cba6d=_0x3cd039[_0x76aa('0x29')]({'plain':!![]});var _0x26b75e=_0x76aa('0x2a');return db['UserProfileResource'][_0x76aa('0x28')]({'where':{'type':_0x26b75e,'resourceId':_0x2cba6d['id']}})[_0x76aa('0x27')](function(){return _0x3cd039;});})[_0x76aa('0x27')](function(){_0x29c50c[_0x76aa('0x1a')](0xcc)[_0x76aa('0x1b')]();});}};}function handleEntityNotFound(_0x2f9316,_0x25a803){return function(_0x282d0a){if(!_0x282d0a){_0x2f9316[_0x76aa('0x19')](0x194);}return _0x282d0a;};}function handleError(_0x1bdc3d,_0x545b06){_0x545b06=_0x545b06||0x1f4;return function(_0x3fcb7f){logger['error'](_0x3fcb7f[_0x76aa('0x2b')]);if(_0x3fcb7f[_0x76aa('0x2c')]){delete _0x3fcb7f[_0x76aa('0x2c')];}_0x1bdc3d[_0x76aa('0x1a')](_0x545b06)[_0x76aa('0x2d')](_0x3fcb7f);};}exports[_0x76aa('0x2e')]=function(_0x2ee0f9,_0x3827ec){var _0x19fd4f={},_0x3ea05a={},_0x5edcd8={'count':0x0,'rows':[]};var _0x430ad6=_[_0x76aa('0x2f')](db[_0x76aa('0x30')][_0x76aa('0x31')],function(_0x458ac3){return{'name':_0x458ac3[_0x76aa('0x32')],'type':_0x458ac3[_0x76aa('0x33')]['key']};});_0x3ea05a[_0x76aa('0x34')]=_[_0x76aa('0x2f')](_0x430ad6,'name');_0x3ea05a[_0x76aa('0x35')]=_['keys'](_0x2ee0f9[_0x76aa('0x35')]);_0x3ea05a['filters']=_[_0x76aa('0x36')](_0x3ea05a['model'],_0x3ea05a['query']);_0x19fd4f[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x3ea05a[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x2ee0f9['query']['fields']));_0x19fd4f[_0x76aa('0x37')]=_0x19fd4f[_0x76aa('0x37')][_0x76aa('0x39')]?_0x19fd4f[_0x76aa('0x37')]:_0x3ea05a[_0x76aa('0x34')];if(!_0x2ee0f9['query'][_0x76aa('0x3a')]('nolimit')){_0x19fd4f['limit']=qs[_0x76aa('0x1f')](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1f')]);_0x19fd4f[_0x76aa('0x1e')]=qs['offset'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x1e')]);}_0x19fd4f[_0x76aa('0x3b')]=qs['sort'](_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x3c')]);_0x19fd4f[_0x76aa('0x3d')]=qs[_0x76aa('0x3e')](_[_0x76aa('0x3f')](_0x2ee0f9[_0x76aa('0x35')],_0x3ea05a[_0x76aa('0x3e')]),_0x430ad6);if(_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]){_0x19fd4f['where']=_[_0x76aa('0x41')](_0x19fd4f[_0x76aa('0x3d')],{'$or':_[_0x76aa('0x2f')](_0x430ad6,function(_0xa824e8){if(_0xa824e8[_0x76aa('0x33')]!==_0x76aa('0x42')){var _0x572fdb={};_0x572fdb[_0xa824e8['name']]={'$like':'%'+_0x2ee0f9[_0x76aa('0x35')][_0x76aa('0x40')]+'%'};return _0x572fdb;}})});}_0x19fd4f=_[_0x76aa('0x41')]({},_0x19fd4f,_0x2ee0f9[_0x76aa('0x43')]);var _0x50599f={'where':_0x19fd4f[_0x76aa('0x3d')]};return db[_0x76aa('0x30')][_0x76aa('0x1d')](_0x50599f)[_0x76aa('0x27')](function(_0x1138b5){_0x5edcd8['count']=_0x1138b5;if(_0x2ee0f9[_0x76aa('0x35')]['includeAll']){_0x19fd4f[_0x76aa('0x44')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x19fd4f);})['then'](function(_0x144f0a){_0x5edcd8['rows']=_0x144f0a;return _0x5edcd8;})['then'](respondWithFilteredResult(_0x3827ec,_0x19fd4f))['catch'](handleError(_0x3827ec,null));};exports[_0x76aa('0x45')]=function(_0x3fd153,_0x116dc5){var _0x2c0744={'raw':!![],'where':{'id':_0x3fd153['params']['id']}},_0x27a52e={};_0x27a52e[_0x76aa('0x34')]=_[_0x76aa('0x46')](db[_0x76aa('0x30')][_0x76aa('0x31')]);_0x27a52e[_0x76aa('0x35')]=_['keys'](_0x3fd153[_0x76aa('0x35')]);_0x27a52e[_0x76aa('0x3e')]=_['intersection'](_0x27a52e[_0x76aa('0x34')],_0x27a52e['query']);_0x2c0744[_0x76aa('0x37')]=_[_0x76aa('0x36')](_0x27a52e[_0x76aa('0x34')],qs[_0x76aa('0x38')](_0x3fd153[_0x76aa('0x35')][_0x76aa('0x38')]));_0x2c0744[_0x76aa('0x37')]=_0x2c0744[_0x76aa('0x37')][_0x76aa('0x39')]?_0x2c0744[_0x76aa('0x37')]:_0x27a52e['model'];if(_0x3fd153[_0x76aa('0x35')]['includeAll']){_0x2c0744[_0x76aa('0x44')]=[{'all':!![]}];}_0x2c0744=_[_0x76aa('0x41')]({},_0x2c0744,_0x3fd153[_0x76aa('0x43')]);return db[_0x76aa('0x30')]['find'](_0x2c0744)['then'](handleEntityNotFound(_0x116dc5,null))[_0x76aa('0x27')](respondWithResult(_0x116dc5,null))['catch'](handleError(_0x116dc5,null));};exports[_0x76aa('0x47')]=function(_0x302a0c,_0x4315b3){return db[_0x76aa('0x30')][_0x76aa('0x47')](_0x302a0c[_0x76aa('0x48')],{})['then'](function(_0x564546){var _0x2fcf8f=_0x302a0c[_0x76aa('0x49')][_0x76aa('0x29')]({'plain':!![]});if(!_0x2fcf8f)throw new Error(_0x76aa('0x4a'));if(_0x2fcf8f[_0x76aa('0x4b')]===_0x76aa('0x49')){var _0x4c52d5=_0x564546[_0x76aa('0x29')]({'plain':!![]});var _0x2d631e=_0x76aa('0x2a');return db['UserProfileSection'][_0x76aa('0x4c')]({'where':{'name':_0x2d631e,'userProfileId':_0x2fcf8f['userProfileId']},'raw':!![]})[_0x76aa('0x27')](function(_0x5e1d84){if(_0x5e1d84&&_0x5e1d84[_0x76aa('0x4d')]===0x0){return db[_0x76aa('0x4e')][_0x76aa('0x47')]({'name':_0x4c52d5[_0x76aa('0x2c')],'resourceId':_0x4c52d5['id'],'type':_0x5e1d84[_0x76aa('0x2c')],'sectionId':_0x5e1d84['id']},{})[_0x76aa('0x27')](function(){return _0x564546;});}else{return _0x564546;}})[_0x76aa('0x4f')](function(_0x4f2c2b){logger[_0x76aa('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f2c2b);throw _0x4f2c2b;});}return _0x564546;})[_0x76aa('0x27')](respondWithResult(_0x4315b3,0xc9))[_0x76aa('0x4f')](handleError(_0x4315b3,null));};exports[_0x76aa('0x26')]=function(_0x53be10,_0x3fa7ec){if(_0x53be10[_0x76aa('0x48')]['id']){delete _0x53be10[_0x76aa('0x48')]['id'];}return db['AnalyticMetric'][_0x76aa('0x4c')]({'where':{'id':_0x53be10[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x3fa7ec,null))[_0x76aa('0x27')](saveUpdates(_0x53be10['body'],null))[_0x76aa('0x27')](respondWithResult(_0x3fa7ec,null))[_0x76aa('0x4f')](handleError(_0x3fa7ec,null));};exports[_0x76aa('0x28')]=function(_0x410933,_0x2027f8){return db[_0x76aa('0x30')]['find']({'where':{'id':_0x410933[_0x76aa('0x51')]['id']}})[_0x76aa('0x27')](handleEntityNotFound(_0x2027f8,null))[_0x76aa('0x27')](removeEntity(_0x2027f8,null))[_0x76aa('0x4f')](handleError(_0x2027f8,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 5144ba0..22c9f26 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 _0x2087=['analytics_metrics','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','AnalyticMetric'];(function(_0xf6520a,_0x5959cd){var _0x40301a=function(_0x33f154){while(--_0x33f154){_0xf6520a['push'](_0xf6520a['shift']());}};_0x40301a(++_0x5959cd);}(_0x2087,0xf3));var _0x7208=function(_0x1998f5,_0x4aae86){_0x1998f5=_0x1998f5-0x0;var _0x3f768e=_0x2087[_0x1998f5];return _0x3f768e;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var logger=require(_0x7208('0x2'))(_0x7208('0x3'));var moment=require('moment');var BPromise=require(_0x7208('0x4'));var rp=require(_0x7208('0x5'));var fs=require('fs');var path=require(_0x7208('0x6'));var rimraf=require(_0x7208('0x7'));var config=require('../../config/environment');var attributes=require('./analyticMetric.attributes');module[_0x7208('0x8')]=function(_0x5cc93f,_0x3c7d9d){return _0x5cc93f['define'](_0x7208('0x9'),attributes,{'tableName':_0x7208('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79bf=['rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','util','api','bluebird','request-promise','path'];(function(_0x5deec5,_0x3fad78){var _0x3c78f9=function(_0x1c4378){while(--_0x1c4378){_0x5deec5['push'](_0x5deec5['shift']());}};_0x3c78f9(++_0x3fad78);}(_0x79bf,0x1df));var _0xf79b=function(_0x158443,_0x1f4a35){_0x158443=_0x158443-0x0;var _0x282e59=_0x79bf[_0x158443];return _0x282e59;};'use strict';var _=require('lodash');var util=require(_0xf79b('0x0'));var logger=require('../../config/logger')(_0xf79b('0x1'));var moment=require('moment');var BPromise=require(_0xf79b('0x2'));var rp=require(_0xf79b('0x3'));var fs=require('fs');var path=require(_0xf79b('0x4'));var rimraf=require(_0xf79b('0x5'));var config=require(_0xf79b('0x6'));var attributes=require(_0xf79b('0x7'));module[_0xf79b('0x8')]=function(_0x5de87a,_0x377b85){return _0x5de87a[_0xf79b('0x9')](_0xf79b('0xa'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 67aabea..19bf4d8 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 _0xa77c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x303d18,_0x216807){var _0x5daa73=function(_0x4e37f6){while(--_0x4e37f6){_0x303d18['push'](_0x303d18['shift']());}};_0x5daa73(++_0x216807);}(_0xa77c,0xaa));var _0xca77=function(_0x24b5c7,_0xebed55){_0x24b5c7=_0x24b5c7-0x0;var _0x19f269=_0xa77c[_0x24b5c7];return _0x19f269;};'use strict';var _=require(_0xca77('0x0'));var util=require(_0xca77('0x1'));var moment=require(_0xca77('0x2'));var BPromise=require(_0xca77('0x3'));var rs=require(_0xca77('0x4'));var fs=require('fs');var Redis=require(_0xca77('0x5'));var db=require(_0xca77('0x6'))['db'];var utils=require(_0xca77('0x7'));var logger=require(_0xca77('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xca77('0x9'));var client=jayson[_0xca77('0xa')][_0xca77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1362d1,_0x2997b1,_0x50ebb4){return new BPromise(function(_0xa35e9a,_0x3c5005){return client[_0xca77('0xc')](_0x1362d1,_0x50ebb4)[_0xca77('0xd')](function(_0x2733bc){logger[_0xca77('0xe')](_0xca77('0xf'),_0x2997b1,_0xca77('0x10'));logger[_0xca77('0x11')](_0xca77('0x12'),_0x2997b1,_0xca77('0x10'),JSON[_0xca77('0x13')](_0x2733bc));if(_0x2733bc[_0xca77('0x14')]){if(_0x2733bc['error'][_0xca77('0x15')]===0x1f4){logger[_0xca77('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x2997b1,_0x2733bc[_0xca77('0x14')][_0xca77('0x16')]);return _0x3c5005(_0x2733bc[_0xca77('0x14')]['message']);}logger['error'](_0xca77('0xf'),_0x2997b1,_0x2733bc[_0xca77('0x14')][_0xca77('0x16')]);return _0xa35e9a(_0x2733bc['error'][_0xca77('0x16')]);}else{logger[_0xca77('0xe')](_0xca77('0xf'),_0x2997b1,_0xca77('0x10'));_0xa35e9a(_0x2733bc[_0xca77('0x17')]['message']);}})[_0xca77('0x18')](function(_0x4e8d28){logger[_0xca77('0x14')](_0xca77('0xf'),_0x2997b1,_0x4e8d28);_0x3c5005(_0x4e8d28);});});} \ No newline at end of file +var _0x4d52=['code','message','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4667b2,_0x135b67){var _0x1070f2=function(_0xa72ca5){while(--_0xa72ca5){_0x4667b2['push'](_0x4667b2['shift']());}};_0x1070f2(++_0x135b67);}(_0x4d52,0x16b));var _0x24d5=function(_0xd76fb6,_0x4ca8c1){_0xd76fb6=_0xd76fb6-0x0;var _0x2cc428=_0x4d52[_0xd76fb6];return _0x2cc428;};'use strict';var _=require(_0x24d5('0x0'));var util=require('util');var moment=require(_0x24d5('0x1'));var BPromise=require(_0x24d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24d5('0x3'));var db=require(_0x24d5('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x24d5('0x5'))(_0x24d5('0x6'));var config=require(_0x24d5('0x7'));var jayson=require(_0x24d5('0x8'));var client=jayson['client'][_0x24d5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c36ba,_0x107bec,_0x1b0251){return new BPromise(function(_0xc74d3a,_0x468058){return client[_0x24d5('0xa')](_0x3c36ba,_0x1b0251)[_0x24d5('0xb')](function(_0x379f11){logger[_0x24d5('0xc')](_0x24d5('0xd'),_0x107bec,'request\x20sent');logger['debug'](_0x24d5('0xe'),_0x107bec,_0x24d5('0xf'),JSON['stringify'](_0x379f11));if(_0x379f11[_0x24d5('0x10')]){if(_0x379f11[_0x24d5('0x10')][_0x24d5('0x11')]===0x1f4){logger[_0x24d5('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x107bec,_0x379f11[_0x24d5('0x10')][_0x24d5('0x12')]);return _0x468058(_0x379f11['error'][_0x24d5('0x12')]);}logger[_0x24d5('0x10')](_0x24d5('0xd'),_0x107bec,_0x379f11[_0x24d5('0x10')][_0x24d5('0x12')]);return _0xc74d3a(_0x379f11[_0x24d5('0x10')][_0x24d5('0x12')]);}else{logger['info'](_0x24d5('0xd'),_0x107bec,_0x24d5('0xf'));_0xc74d3a(_0x379f11['result'][_0x24d5('0x12')]);}})['catch'](function(_0x376964){logger[_0x24d5('0x10')](_0x24d5('0xd'),_0x107bec,_0x376964);_0x468058(_0x376964);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8d6c5cc..fcba588 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 _0xe4d9=['path','express','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','index','show','isAuthenticated','create','/:id','update','delete','destroy','exports','multer','util'];(function(_0x33ca22,_0xbcc94){var _0x1790c3=function(_0x448b06){while(--_0x448b06){_0x33ca22['push'](_0x33ca22['shift']());}};_0x1790c3(++_0xbcc94);}(_0xe4d9,0x141));var _0x9e4d=function(_0x5778d5,_0x4c05fb){_0x5778d5=_0x5778d5-0x0;var _0x3fc5c3=_0xe4d9[_0x5778d5];return _0x3fc5c3;};'use strict';var multer=require(_0x9e4d('0x0'));var util=require(_0x9e4d('0x1'));var path=require(_0x9e4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x9e4d('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9e4d('0x4'));var interaction=require(_0x9e4d('0x5'));var config=require('../../config/environment');var controller=require(_0x9e4d('0x6'));router[_0x9e4d('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e4d('0x8')]);router[_0x9e4d('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x9e4d('0x9')]);router['post']('/',auth[_0x9e4d('0xa')](),controller[_0x9e4d('0xb')]);router['put'](_0x9e4d('0xc'),auth[_0x9e4d('0xa')](),controller[_0x9e4d('0xd')]);router[_0x9e4d('0xe')](_0x9e4d('0xc'),auth[_0x9e4d('0xa')](),controller[_0x9e4d('0xf')]);module[_0x9e4d('0x10')]=router; \ No newline at end of file +var _0x746f=['isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x858840,_0x5e5985){var _0x1ea924=function(_0xb8e08e){while(--_0xb8e08e){_0x858840['push'](_0x858840['shift']());}};_0x1ea924(++_0x5e5985);}(_0x746f,0x9c));var _0xf746=function(_0x37fefe,_0x4c2818){_0x37fefe=_0x37fefe-0x0;var _0x3390b0=_0x746f[_0x37fefe];return _0x3390b0;};'use strict';var multer=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var path=require(_0xf746('0x2'));var timeout=require(_0xf746('0x3'));var express=require(_0xf746('0x4'));var router=express[_0xf746('0x5')]();var fs_extra=require(_0xf746('0x6'));var auth=require(_0xf746('0x7'));var interaction=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var controller=require(_0xf746('0xa'));router[_0xf746('0xb')]('/',auth[_0xf746('0xc')](),controller[_0xf746('0xd')]);router[_0xf746('0xb')](_0xf746('0xe'),auth[_0xf746('0xc')](),controller[_0xf746('0xf')]);router[_0xf746('0x10')]('/',auth[_0xf746('0xc')](),controller[_0xf746('0x11')]);router[_0xf746('0x12')](_0xf746('0xe'),auth[_0xf746('0xc')](),controller[_0xf746('0x13')]);router['delete'](_0xf746('0xe'),auth[_0xf746('0xc')](),controller[_0xf746('0x14')]);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 7a2319e..9e64afb 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 _0xc727=['TEXT','sequelize','exports'];(function(_0x300eb6,_0x576dce){var _0x22a706=function(_0xc3972a){while(--_0xc3972a){_0x300eb6['push'](_0x300eb6['shift']());}};_0x22a706(++_0x576dce);}(_0xc727,0x18a));var _0x7c72=function(_0x52652f,_0x138b0f){_0x52652f=_0x52652f-0x0;var _0x51db50=_0xc727[_0x52652f];return _0x51db50;};'use strict';var Sequelize=require(_0x7c72('0x0'));module[_0x7c72('0x1')]={'tree':{'type':Sequelize[_0x7c72('0x2')],'allowNull':![]}}; \ No newline at end of file +'use strict';var Sequelize=require('sequelize');module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 1b66150..bbfe3ff 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 _0xdb91=['../../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','undefined','limit','count','offset','set','apply','update','then','destroy','error','name','map','AnalyticTreeReport','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdb91,0x1b0));var _0x1db9=function(_0x157fe3,_0x4f76fc){_0x157fe3=_0x157fe3-0x0;var _0x4f2791=_0xdb91[_0x157fe3];return _0x4f2791;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1db9('0x0'));var jsonpatch=require(_0x1db9('0x1'));var rp=require(_0x1db9('0x2'));var moment=require(_0x1db9('0x3'));var BPromise=require(_0x1db9('0x4'));var Mustache=require(_0x1db9('0x5'));var util=require(_0x1db9('0x6'));var path=require(_0x1db9('0x7'));var sox=require(_0x1db9('0x8'));var csv=require('to-csv');var ejs=require(_0x1db9('0x9'));var fs=require('fs');var fs_extra=require(_0x1db9('0xa'));var _=require(_0x1db9('0xb'));var squel=require(_0x1db9('0xc'));var crypto=require(_0x1db9('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1db9('0xe'));var toCsv=require(_0x1db9('0xf'));var querystring=require(_0x1db9('0x10'));var Papa=require(_0x1db9('0x11'));var Redis=require('ioredis');var authService=require(_0x1db9('0x12'));var qs=require(_0x1db9('0x13'));var as=require(_0x1db9('0x14'));var hardwareService=require(_0x1db9('0x15'));var logger=require(_0x1db9('0x16'))(_0x1db9('0x17'));var utils=require(_0x1db9('0x18'));var config=require(_0x1db9('0x19'));var licenseUtil=require(_0x1db9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x281a6e,_0x182247){_0x182247=_0x182247||0xcc;return function(_0xee2cf0){if(_0xee2cf0){return _0x281a6e[_0x1db9('0x1b')](_0x182247);}return _0x281a6e[_0x1db9('0x1c')](_0x182247)[_0x1db9('0x1d')]();};}function respondWithResult(_0x2b949c,_0x547ec2){_0x547ec2=_0x547ec2||0xc8;return function(_0x77f835){if(_0x77f835){return _0x2b949c[_0x1db9('0x1c')](_0x547ec2)[_0x1db9('0x1e')](_0x77f835);}};}function respondWithFilteredResult(_0x414984,_0x34657c){return function(_0x3ec63b){if(_0x3ec63b){var _0x5d1650=typeof _0x34657c['offset']===_0x1db9('0x1f')&&typeof _0x34657c[_0x1db9('0x20')]===_0x1db9('0x1f');var _0x3ceeb6=_0x3ec63b[_0x1db9('0x21')];var _0x2b67a8=_0x5d1650?0x0:_0x34657c[_0x1db9('0x22')];var _0x3ac83a=_0x5d1650?_0x3ec63b[_0x1db9('0x21')]:_0x34657c[_0x1db9('0x22')]+_0x34657c[_0x1db9('0x20')];var _0x264688;if(_0x3ac83a>=_0x3ceeb6){_0x3ac83a=_0x3ceeb6;_0x264688=0xc8;}else{_0x264688=0xce;}_0x414984[_0x1db9('0x1c')](_0x264688);return _0x414984[_0x1db9('0x23')]('Content-Range',_0x2b67a8+'-'+_0x3ac83a+'/'+_0x3ceeb6)['json'](_0x3ec63b);}return null;};}function patchUpdates(_0x3a3d89){return function(_0x4289bf){try{jsonpatch[_0x1db9('0x24')](_0x4289bf,_0x3a3d89,!![]);}catch(_0x4485eb){return BPromise['reject'](_0x4485eb);}return _0x4289bf['save']();};}function saveUpdates(_0x5b453e,_0x13ce81){return function(_0x5adaf0){if(_0x5adaf0){return _0x5adaf0[_0x1db9('0x25')](_0x5b453e)[_0x1db9('0x26')](function(_0x413f1f){return _0x413f1f;});}return null;};}function removeEntity(_0x43ebb4,_0x3f4c6){return function(_0x32b880){if(_0x32b880){return _0x32b880[_0x1db9('0x27')]()[_0x1db9('0x26')](function(){_0x43ebb4[_0x1db9('0x1c')](0xcc)[_0x1db9('0x1d')]();});}};}function handleEntityNotFound(_0x4ac2ed,_0x2dd666){return function(_0x12637f){if(!_0x12637f){_0x4ac2ed[_0x1db9('0x1b')](0x194);}return _0x12637f;};}function handleError(_0xdb1d5,_0x34d4b1){_0x34d4b1=_0x34d4b1||0x1f4;return function(_0x234a18){logger[_0x1db9('0x28')](_0x234a18['stack']);if(_0x234a18[_0x1db9('0x29')]){delete _0x234a18[_0x1db9('0x29')];}_0xdb1d5[_0x1db9('0x1c')](_0x34d4b1)['send'](_0x234a18);};}exports['index']=function(_0x424d27,_0x11c630){var _0x1960a8={},_0x2b81b0={},_0x2039fa={'count':0x0,'rows':[]};var _0x3221c9=_[_0x1db9('0x2a')](db[_0x1db9('0x2b')][_0x1db9('0x2c')],function(_0x3408ec){return{'name':_0x3408ec[_0x1db9('0x2d')],'type':_0x3408ec['type'][_0x1db9('0x2e')]};});_0x2b81b0['model']=_['map'](_0x3221c9,_0x1db9('0x29'));_0x2b81b0[_0x1db9('0x2f')]=_['keys'](_0x424d27[_0x1db9('0x2f')]);_0x2b81b0[_0x1db9('0x30')]=_[_0x1db9('0x31')](_0x2b81b0['model'],_0x2b81b0[_0x1db9('0x2f')]);_0x1960a8[_0x1db9('0x32')]=_['intersection'](_0x2b81b0['model'],qs[_0x1db9('0x33')](_0x424d27['query'][_0x1db9('0x33')]));_0x1960a8[_0x1db9('0x32')]=_0x1960a8[_0x1db9('0x32')][_0x1db9('0x34')]?_0x1960a8[_0x1db9('0x32')]:_0x2b81b0[_0x1db9('0x35')];if(!_0x424d27[_0x1db9('0x2f')][_0x1db9('0x36')]('nolimit')){_0x1960a8[_0x1db9('0x20')]=qs[_0x1db9('0x20')](_0x424d27['query'][_0x1db9('0x20')]);_0x1960a8[_0x1db9('0x22')]=qs[_0x1db9('0x22')](_0x424d27['query']['offset']);}_0x1960a8[_0x1db9('0x37')]=qs[_0x1db9('0x38')](_0x424d27[_0x1db9('0x2f')][_0x1db9('0x38')]);_0x1960a8[_0x1db9('0x39')]=qs[_0x1db9('0x30')](_[_0x1db9('0x3a')](_0x424d27[_0x1db9('0x2f')],_0x2b81b0[_0x1db9('0x30')]),_0x3221c9);if(_0x424d27['query']['filter']){_0x1960a8[_0x1db9('0x39')]=_[_0x1db9('0x3b')](_0x1960a8['where'],{'$or':_[_0x1db9('0x2a')](_0x3221c9,function(_0x50a056){if(_0x50a056[_0x1db9('0x3c')]!==_0x1db9('0x3d')){var _0x2dfdfd={};_0x2dfdfd[_0x50a056[_0x1db9('0x29')]]={'$like':'%'+_0x424d27[_0x1db9('0x2f')][_0x1db9('0x3e')]+'%'};return _0x2dfdfd;}})});}_0x1960a8=_[_0x1db9('0x3b')]({},_0x1960a8,_0x424d27[_0x1db9('0x3f')]);var _0x44fa8c={'where':_0x1960a8[_0x1db9('0x39')]};return db[_0x1db9('0x2b')][_0x1db9('0x21')](_0x44fa8c)['then'](function(_0xe0bb64){_0x2039fa['count']=_0xe0bb64;if(_0x424d27[_0x1db9('0x2f')]['includeAll']){_0x1960a8[_0x1db9('0x40')]=[{'all':!![]}];}return db[_0x1db9('0x2b')][_0x1db9('0x41')](_0x1960a8);})['then'](function(_0x1522a9){_0x2039fa[_0x1db9('0x42')]=_0x1522a9;return _0x2039fa;})[_0x1db9('0x26')](respondWithFilteredResult(_0x11c630,_0x1960a8))['catch'](handleError(_0x11c630,null));};exports[_0x1db9('0x43')]=function(_0x4dade5,_0x24ba1d){var _0x2e22f0={'raw':!![],'where':{'id':_0x4dade5[_0x1db9('0x44')]['id']}},_0x190082={};_0x190082[_0x1db9('0x35')]=_[_0x1db9('0x45')](db[_0x1db9('0x2b')][_0x1db9('0x2c')]);_0x190082[_0x1db9('0x2f')]=_['keys'](_0x4dade5[_0x1db9('0x2f')]);_0x190082[_0x1db9('0x30')]=_[_0x1db9('0x31')](_0x190082['model'],_0x190082['query']);_0x2e22f0[_0x1db9('0x32')]=_[_0x1db9('0x31')](_0x190082[_0x1db9('0x35')],qs[_0x1db9('0x33')](_0x4dade5['query'][_0x1db9('0x33')]));_0x2e22f0[_0x1db9('0x32')]=_0x2e22f0[_0x1db9('0x32')][_0x1db9('0x34')]?_0x2e22f0[_0x1db9('0x32')]:_0x190082[_0x1db9('0x35')];if(_0x4dade5['query'][_0x1db9('0x46')]){_0x2e22f0['include']=[{'all':!![]}];}_0x2e22f0=_[_0x1db9('0x3b')]({},_0x2e22f0,_0x4dade5[_0x1db9('0x3f')]);return db[_0x1db9('0x2b')][_0x1db9('0x47')](_0x2e22f0)[_0x1db9('0x26')](handleEntityNotFound(_0x24ba1d,null))['then'](respondWithResult(_0x24ba1d,null))[_0x1db9('0x48')](handleError(_0x24ba1d,null));};exports[_0x1db9('0x49')]=function(_0xcf0f35,_0x585295){return db['AnalyticTreeReport'][_0x1db9('0x49')](_0xcf0f35['body'],{})[_0x1db9('0x26')](respondWithResult(_0x585295,0xc9))['catch'](handleError(_0x585295,null));};exports[_0x1db9('0x25')]=function(_0x19310e,_0x2ee192){if(_0x19310e[_0x1db9('0x4a')]['id']){delete _0x19310e[_0x1db9('0x4a')]['id'];}return db['AnalyticTreeReport'][_0x1db9('0x47')]({'where':{'id':_0x19310e[_0x1db9('0x44')]['id']}})[_0x1db9('0x26')](handleEntityNotFound(_0x2ee192,null))['then'](saveUpdates(_0x19310e[_0x1db9('0x4a')],null))['then'](respondWithResult(_0x2ee192,null))[_0x1db9('0x48')](handleError(_0x2ee192,null));};exports[_0x1db9('0x27')]=function(_0x3e1e85,_0x57b8a6){return db['AnalyticTreeReport'][_0x1db9('0x47')]({'where':{'id':_0x3e1e85[_0x1db9('0x44')]['id']}})[_0x1db9('0x26')](handleEntityNotFound(_0x57b8a6,null))[_0x1db9('0x26')](removeEntity(_0x57b8a6,null))['catch'](handleError(_0x57b8a6,null));}; \ No newline at end of file +var _0xad9a=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','save','update','then','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x2665a3,_0x3bac99){var _0x586de6=function(_0x1034d7){while(--_0x1034d7){_0x2665a3['push'](_0x2665a3['shift']());}};_0x586de6(++_0x3bac99);}(_0xad9a,0xd6));var _0xaad9=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xad9a[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0xaad9('0x0'));var rimraf=require(_0xaad9('0x1'));var zipdir=require(_0xaad9('0x2'));var jsonpatch=require(_0xaad9('0x3'));var rp=require(_0xaad9('0x4'));var moment=require('moment');var BPromise=require(_0xaad9('0x5'));var Mustache=require(_0xaad9('0x6'));var util=require(_0xaad9('0x7'));var path=require('path');var sox=require(_0xaad9('0x8'));var csv=require(_0xaad9('0x9'));var ejs=require(_0xaad9('0xa'));var fs=require('fs');var fs_extra=require(_0xaad9('0xb'));var _=require(_0xaad9('0xc'));var squel=require(_0xaad9('0xd'));var crypto=require(_0xaad9('0xe'));var jsforce=require(_0xaad9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaad9('0x10'));var Papa=require(_0xaad9('0x11'));var Redis=require(_0xaad9('0x12'));var authService=require(_0xaad9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaad9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaad9('0x15'))(_0xaad9('0x16'));var utils=require(_0xaad9('0x17'));var config=require(_0xaad9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad9('0x19'))['db'];function respondWithStatusCode(_0x101ee2,_0x43fa98){_0x43fa98=_0x43fa98||0xcc;return function(_0x17556c){if(_0x17556c){return _0x101ee2[_0xaad9('0x1a')](_0x43fa98);}return _0x101ee2['status'](_0x43fa98)[_0xaad9('0x1b')]();};}function respondWithResult(_0x4cf90f,_0x5b565d){_0x5b565d=_0x5b565d||0xc8;return function(_0x48418c){if(_0x48418c){return _0x4cf90f['status'](_0x5b565d)['json'](_0x48418c);}};}function respondWithFilteredResult(_0xec912b,_0xfcaf78){return function(_0x4b382c){if(_0x4b382c){var _0xa7ad12=typeof _0xfcaf78['offset']===_0xaad9('0x1c')&&typeof _0xfcaf78[_0xaad9('0x1d')]==='undefined';var _0x186c04=_0x4b382c[_0xaad9('0x1e')];var _0xa39cde=_0xa7ad12?0x0:_0xfcaf78[_0xaad9('0x1f')];var _0x25d08e=_0xa7ad12?_0x4b382c['count']:_0xfcaf78[_0xaad9('0x1f')]+_0xfcaf78['limit'];var _0x2d7f69;if(_0x25d08e>=_0x186c04){_0x25d08e=_0x186c04;_0x2d7f69=0xc8;}else{_0x2d7f69=0xce;}_0xec912b[_0xaad9('0x20')](_0x2d7f69);return _0xec912b[_0xaad9('0x21')](_0xaad9('0x22'),_0xa39cde+'-'+_0x25d08e+'/'+_0x186c04)[_0xaad9('0x23')](_0x4b382c);}return null;};}function patchUpdates(_0x379264){return function(_0x50deca){try{jsonpatch[_0xaad9('0x24')](_0x50deca,_0x379264,!![]);}catch(_0x28e42e){return BPromise[_0xaad9('0x25')](_0x28e42e);}return _0x50deca[_0xaad9('0x26')]();};}function saveUpdates(_0x1e663c,_0x14d073){return function(_0x1796ad){if(_0x1796ad){return _0x1796ad[_0xaad9('0x27')](_0x1e663c)[_0xaad9('0x28')](function(_0x4307aa){return _0x4307aa;});}return null;};}function removeEntity(_0x5784d5,_0x36ef3b){return function(_0xe42aa7){if(_0xe42aa7){return _0xe42aa7['destroy']()['then'](function(){_0x5784d5[_0xaad9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15016e,_0xd73255){return function(_0x224ebb){if(!_0x224ebb){_0x15016e['sendStatus'](0x194);}return _0x224ebb;};}function handleError(_0xb982b9,_0x453332){_0x453332=_0x453332||0x1f4;return function(_0x574b68){logger[_0xaad9('0x29')](_0x574b68['stack']);if(_0x574b68[_0xaad9('0x2a')]){delete _0x574b68[_0xaad9('0x2a')];}_0xb982b9[_0xaad9('0x20')](_0x453332)[_0xaad9('0x2b')](_0x574b68);};}exports[_0xaad9('0x2c')]=function(_0x13ee58,_0x33db04){var _0x55886c={},_0x46f46e={},_0x489958={'count':0x0,'rows':[]};var _0x20df3d=_[_0xaad9('0x2d')](db[_0xaad9('0x2e')][_0xaad9('0x2f')],function(_0x44f329){return{'name':_0x44f329[_0xaad9('0x30')],'type':_0x44f329[_0xaad9('0x31')][_0xaad9('0x32')]};});_0x46f46e['model']=_[_0xaad9('0x2d')](_0x20df3d,'name');_0x46f46e[_0xaad9('0x33')]=_[_0xaad9('0x34')](_0x13ee58[_0xaad9('0x33')]);_0x46f46e[_0xaad9('0x35')]=_[_0xaad9('0x36')](_0x46f46e['model'],_0x46f46e[_0xaad9('0x33')]);_0x55886c['attributes']=_[_0xaad9('0x36')](_0x46f46e[_0xaad9('0x37')],qs[_0xaad9('0x38')](_0x13ee58[_0xaad9('0x33')]['fields']));_0x55886c[_0xaad9('0x39')]=_0x55886c[_0xaad9('0x39')][_0xaad9('0x3a')]?_0x55886c[_0xaad9('0x39')]:_0x46f46e[_0xaad9('0x37')];if(!_0x13ee58[_0xaad9('0x33')]['hasOwnProperty'](_0xaad9('0x3b'))){_0x55886c[_0xaad9('0x1d')]=qs[_0xaad9('0x1d')](_0x13ee58['query'][_0xaad9('0x1d')]);_0x55886c[_0xaad9('0x1f')]=qs[_0xaad9('0x1f')](_0x13ee58[_0xaad9('0x33')][_0xaad9('0x1f')]);}_0x55886c[_0xaad9('0x3c')]=qs[_0xaad9('0x3d')](_0x13ee58[_0xaad9('0x33')][_0xaad9('0x3d')]);_0x55886c['where']=qs[_0xaad9('0x35')](_[_0xaad9('0x3e')](_0x13ee58['query'],_0x46f46e[_0xaad9('0x35')]),_0x20df3d);if(_0x13ee58[_0xaad9('0x33')]['filter']){_0x55886c[_0xaad9('0x3f')]=_[_0xaad9('0x40')](_0x55886c['where'],{'$or':_[_0xaad9('0x2d')](_0x20df3d,function(_0x5514c8){if(_0x5514c8['type']!==_0xaad9('0x41')){var _0x269413={};_0x269413[_0x5514c8[_0xaad9('0x2a')]]={'$like':'%'+_0x13ee58[_0xaad9('0x33')][_0xaad9('0x42')]+'%'};return _0x269413;}})});}_0x55886c=_[_0xaad9('0x40')]({},_0x55886c,_0x13ee58[_0xaad9('0x43')]);var _0x1d9e5f={'where':_0x55886c[_0xaad9('0x3f')]};return db['AnalyticTreeReport'][_0xaad9('0x1e')](_0x1d9e5f)['then'](function(_0x71a25){_0x489958[_0xaad9('0x1e')]=_0x71a25;if(_0x13ee58[_0xaad9('0x33')][_0xaad9('0x44')]){_0x55886c[_0xaad9('0x45')]=[{'all':!![]}];}return db[_0xaad9('0x2e')][_0xaad9('0x46')](_0x55886c);})['then'](function(_0x28910f){_0x489958[_0xaad9('0x47')]=_0x28910f;return _0x489958;})[_0xaad9('0x28')](respondWithFilteredResult(_0x33db04,_0x55886c))['catch'](handleError(_0x33db04,null));};exports[_0xaad9('0x48')]=function(_0x4ae742,_0x5e9e5e){var _0x23bcb1={'raw':!![],'where':{'id':_0x4ae742['params']['id']}},_0x4505cc={};_0x4505cc[_0xaad9('0x37')]=_[_0xaad9('0x34')](db['AnalyticTreeReport'][_0xaad9('0x2f')]);_0x4505cc[_0xaad9('0x33')]=_[_0xaad9('0x34')](_0x4ae742[_0xaad9('0x33')]);_0x4505cc[_0xaad9('0x35')]=_[_0xaad9('0x36')](_0x4505cc[_0xaad9('0x37')],_0x4505cc['query']);_0x23bcb1[_0xaad9('0x39')]=_[_0xaad9('0x36')](_0x4505cc['model'],qs[_0xaad9('0x38')](_0x4ae742[_0xaad9('0x33')][_0xaad9('0x38')]));_0x23bcb1['attributes']=_0x23bcb1['attributes'][_0xaad9('0x3a')]?_0x23bcb1['attributes']:_0x4505cc[_0xaad9('0x37')];if(_0x4ae742['query']['includeAll']){_0x23bcb1[_0xaad9('0x45')]=[{'all':!![]}];}_0x23bcb1=_[_0xaad9('0x40')]({},_0x23bcb1,_0x4ae742['options']);return db[_0xaad9('0x2e')][_0xaad9('0x49')](_0x23bcb1)[_0xaad9('0x28')](handleEntityNotFound(_0x5e9e5e,null))['then'](respondWithResult(_0x5e9e5e,null))[_0xaad9('0x4a')](handleError(_0x5e9e5e,null));};exports[_0xaad9('0x4b')]=function(_0x1cbf02,_0x4a8fd7){return db[_0xaad9('0x2e')][_0xaad9('0x4b')](_0x1cbf02['body'],{})[_0xaad9('0x28')](respondWithResult(_0x4a8fd7,0xc9))[_0xaad9('0x4a')](handleError(_0x4a8fd7,null));};exports[_0xaad9('0x27')]=function(_0x583ea9,_0x55c39a){if(_0x583ea9[_0xaad9('0x4c')]['id']){delete _0x583ea9[_0xaad9('0x4c')]['id'];}return db['AnalyticTreeReport'][_0xaad9('0x49')]({'where':{'id':_0x583ea9['params']['id']}})[_0xaad9('0x28')](handleEntityNotFound(_0x55c39a,null))['then'](saveUpdates(_0x583ea9[_0xaad9('0x4c')],null))[_0xaad9('0x28')](respondWithResult(_0x55c39a,null))[_0xaad9('0x4a')](handleError(_0x55c39a,null));};exports['destroy']=function(_0x41c49c,_0x1d3956){return db[_0xaad9('0x2e')]['find']({'where':{'id':_0x41c49c['params']['id']}})[_0xaad9('0x28')](handleEntityNotFound(_0x1d3956,null))[_0xaad9('0x28')](removeEntity(_0x1d3956,null))[_0xaad9('0x4a')](handleError(_0x1d3956,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index d99c0e3..400fb8d 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 _0xdac3=['path','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x39f7b6,_0x57f2ca){var _0x372521=function(_0x49527){while(--_0x49527){_0x39f7b6['push'](_0x39f7b6['shift']());}};_0x372521(++_0x57f2ca);}(_0xdac3,0x1c7));var _0x3dac=function(_0x9c3c94,_0x296e5a){_0x9c3c94=_0x9c3c94-0x0;var _0x598937=_0xdac3[_0x9c3c94];return _0x598937;};'use strict';var _=require('lodash');var util=require(_0x3dac('0x0'));var logger=require(_0x3dac('0x1'))('api');var moment=require(_0x3dac('0x2'));var BPromise=require(_0x3dac('0x3'));var rp=require(_0x3dac('0x4'));var fs=require('fs');var path=require(_0x3dac('0x5'));var rimraf=require('rimraf');var config=require(_0x3dac('0x6'));var attributes=require(_0x3dac('0x7'));module['exports']=function(_0x4ecd34,_0x5716e1){return _0x4ecd34[_0x3dac('0x8')](_0x3dac('0x9'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6889=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x6889,0x125));var _0x9688=function(_0x2a4dda,_0x394a1b){_0x2a4dda=_0x2a4dda-0x0;var _0xe725e=_0x6889[_0x2a4dda];return _0xe725e;};'use strict';var _=require(_0x9688('0x0'));var util=require(_0x9688('0x1'));var logger=require(_0x9688('0x2'))('api');var moment=require(_0x9688('0x3'));var BPromise=require(_0x9688('0x4'));var rp=require(_0x9688('0x5'));var fs=require('fs');var path=require(_0x9688('0x6'));var rimraf=require(_0x9688('0x7'));var config=require(_0x9688('0x8'));var attributes=require('./analyticTreeReport.attributes');module[_0x9688('0x9')]=function(_0x403c21,_0x1011f7){return _0x403c21[_0x9688('0xa')]('AnalyticTreeReport',attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 23cd010..c605244 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x523671,_0x4657fc){var _0x5b0bdc=function(_0x301007){while(--_0x301007){_0x523671['push'](_0x523671['shift']());}};_0x5b0bdc(++_0x4657fc);}(_0x2ef3,0xba));var _0x32ef=function(_0x172000,_0x56dd6c){_0x172000=_0x172000-0x0;var _0x13cee5=_0x2ef3[_0x172000];return _0x13cee5;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x499573,_0x5e995b){var _0x1757e5=function(_0x1de694){while(--_0x1de694){_0x499573['push'](_0x499573['shift']());}};_0x1757e5(++_0x5e995b);}(_0xadb5,0xad));var _0x5adb=function(_0x2e61fd,_0x20c425){_0x2e61fd=_0x2e61fd-0x0;var _0x313b93=_0xadb5[_0x2e61fd];return _0x313b93;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 8421255..d4a219e 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 _0x9433=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9433,0x181));var _0x3943=function(_0x195cd1,_0x54ec93){_0x195cd1=_0x195cd1-0x0;var _0x4b6af2=_0x9433[_0x195cd1];return _0x4b6af2;};'use strict';var multer=require(_0x3943('0x0'));var util=require(_0x3943('0x1'));var path=require(_0x3943('0x2'));var timeout=require(_0x3943('0x3'));var express=require(_0x3943('0x4'));var router=express[_0x3943('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3943('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3943('0x7'));router[_0x3943('0x8')]('/',auth[_0x3943('0x9')](),controller[_0x3943('0xa')]);router[_0x3943('0x8')](_0x3943('0xb'),auth[_0x3943('0x9')](),controller[_0x3943('0xc')]);router[_0x3943('0xd')]('/',auth[_0x3943('0x9')](),controller[_0x3943('0xe')]);router[_0x3943('0xf')](_0x3943('0xb'),auth[_0x3943('0x9')](),controller[_0x3943('0x10')]);router[_0x3943('0x11')]('/:id',auth[_0x3943('0x9')](),controller[_0x3943('0x12')]);module[_0x3943('0x13')]=router; \ No newline at end of file +var _0xae8c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','create','put','delete','destroy','exports'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0xae8c,0xb4));var _0xcae8=function(_0x458848,_0x2e9ddf){_0x458848=_0x458848-0x0;var _0xbe9dfc=_0xae8c[_0x458848];return _0xbe9dfc;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcae8('0x0'));var router=express[_0xcae8('0x1')]();var fs_extra=require(_0xcae8('0x2'));var auth=require(_0xcae8('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xcae8('0x4'));var controller=require(_0xcae8('0x5'));router[_0xcae8('0x6')]('/',auth[_0xcae8('0x7')](),controller['index']);router[_0xcae8('0x6')](_0xcae8('0x8'),auth[_0xcae8('0x7')](),controller['show']);router[_0xcae8('0x9')]('/',auth[_0xcae8('0x7')](),controller[_0xcae8('0xa')]);router[_0xcae8('0xb')](_0xcae8('0x8'),auth[_0xcae8('0x7')](),controller['update']);router[_0xcae8('0xc')](_0xcae8('0x8'),auth[_0xcae8('0x7')](),controller[_0xcae8('0xd')]);module[_0xcae8('0xe')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 9eebda5..99c0a7a 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 _0xd847=['STRING','sequelize','exports'];(function(_0x2fee96,_0x2f735d){var _0x2e6ad1=function(_0x2c55ad){while(--_0x2c55ad){_0x2fee96['push'](_0x2fee96['shift']());}};_0x2e6ad1(++_0x2f735d);}(_0xd847,0x18a));var _0x7d84=function(_0xc445cc,_0x2d7b13){_0xc445cc=_0xc445cc-0x0;var _0x4cb500=_0xd847[_0xc445cc];return _0x4cb500;};'use strict';var Sequelize=require(_0x7d84('0x0'));module[_0x7d84('0x1')]={'name':{'type':Sequelize[_0x7d84('0x2')]},'basename':{'type':Sequelize[_0x7d84('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6334=['exports','STRING','sequelize'];(function(_0x158e3b,_0x4534b){var _0x551a1d=function(_0x629c21){while(--_0x629c21){_0x158e3b['push'](_0x158e3b['shift']());}};_0x551a1d(++_0x4534b);}(_0x6334,0x119));var _0x4633=function(_0x89d79e,_0x3b5ddf){_0x89d79e=_0x89d79e-0x0;var _0x1a01c7=_0x6334[_0x89d79e];return _0x1a01c7;};'use strict';var Sequelize=require(_0x4633('0x0'));module[_0x4633('0x1')]={'name':{'type':Sequelize[_0x4633('0x2')]},'basename':{'type':Sequelize[_0x4633('0x2')]},'type':{'type':Sequelize[_0x4633('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 2df92a5..f26f7e5 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 _0x3253=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','Attachment','find','catch','clone','params','omit','updatedAt','body','create','file','basename','filename','mimetype','download','ChatOfflineMessageId','join','offline-chat/','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x692cb,_0x4cd91d){var _0x3e5d0e=function(_0x4420d8){while(--_0x4420d8){_0x692cb['push'](_0x692cb['shift']());}};_0x3e5d0e(++_0x4cd91d);}(_0x3253,0xf6));var _0x3325=function(_0x5b47d9,_0x1327ce){_0x5b47d9=_0x5b47d9-0x0;var _0x4151f0=_0x3253[_0x5b47d9];return _0x4151f0;};'use strict';var emlformat=require(_0x3325('0x0'));var rimraf=require(_0x3325('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3325('0x2'));var rp=require(_0x3325('0x3'));var moment=require(_0x3325('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3325('0x5'));var util=require(_0x3325('0x6'));var path=require('path');var sox=require(_0x3325('0x7'));var csv=require(_0x3325('0x8'));var ejs=require(_0x3325('0x9'));var fs=require('fs');var fs_extra=require(_0x3325('0xa'));var _=require(_0x3325('0xb'));var squel=require(_0x3325('0xc'));var crypto=require('crypto');var jsforce=require(_0x3325('0xd'));var deskjs=require(_0x3325('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3325('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3325('0x10'));var qs=require(_0x3325('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3325('0x12'));var logger=require(_0x3325('0x13'))(_0x3325('0x14'));var utils=require(_0x3325('0x15'));var config=require(_0x3325('0x16'));var licenseUtil=require(_0x3325('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d4ec8,_0x5e7270){_0x5e7270=_0x5e7270||0xcc;return function(_0x58fbef){if(_0x58fbef){return _0x5d4ec8['sendStatus'](_0x5e7270);}return _0x5d4ec8[_0x3325('0x18')](_0x5e7270)[_0x3325('0x19')]();};}function respondWithResult(_0x4d9d23,_0x4c015d){_0x4c015d=_0x4c015d||0xc8;return function(_0x2ef776){if(_0x2ef776){return _0x4d9d23[_0x3325('0x18')](_0x4c015d)[_0x3325('0x1a')](_0x2ef776);}};}function respondWithFilteredResult(_0x3bda39,_0x30df9f){return function(_0x45c072){if(_0x45c072){var _0x5b89d0=typeof _0x30df9f[_0x3325('0x1b')]===_0x3325('0x1c')&&typeof _0x30df9f[_0x3325('0x1d')]==='undefined';var _0x580100=_0x45c072[_0x3325('0x1e')];var _0x164861=_0x5b89d0?0x0:_0x30df9f[_0x3325('0x1b')];var _0x32c499=_0x5b89d0?_0x45c072[_0x3325('0x1e')]:_0x30df9f[_0x3325('0x1b')]+_0x30df9f['limit'];var _0x58d9e5;if(_0x32c499>=_0x580100){_0x32c499=_0x580100;_0x58d9e5=0xc8;}else{_0x58d9e5=0xce;}_0x3bda39[_0x3325('0x18')](_0x58d9e5);return _0x3bda39[_0x3325('0x1f')](_0x3325('0x20'),_0x164861+'-'+_0x32c499+'/'+_0x580100)[_0x3325('0x1a')](_0x45c072);}return null;};}function patchUpdates(_0x36185b){return function(_0xd7fc87){try{jsonpatch['apply'](_0xd7fc87,_0x36185b,!![]);}catch(_0x423b0c){return BPromise[_0x3325('0x21')](_0x423b0c);}return _0xd7fc87[_0x3325('0x22')]();};}function saveUpdates(_0x163962,_0x17ef02){return function(_0x5ac090){if(_0x5ac090){return _0x5ac090[_0x3325('0x23')](_0x163962)['then'](function(_0x6c811a){return _0x6c811a;});}return null;};}function removeEntity(_0x4a3abc,_0x4eea53){return function(_0x170e43){if(_0x170e43){return _0x170e43[_0x3325('0x24')]()[_0x3325('0x25')](function(){_0x4a3abc[_0x3325('0x18')](0xcc)[_0x3325('0x19')]();});}};}function handleEntityNotFound(_0x343c7a,_0x3806f7){return function(_0x52c4e7){if(!_0x52c4e7){_0x343c7a[_0x3325('0x26')](0x194);}return _0x52c4e7;};}function handleError(_0xda843c,_0x7449ae){_0x7449ae=_0x7449ae||0x1f4;return function(_0x5529d0){logger[_0x3325('0x27')](_0x5529d0[_0x3325('0x28')]);if(_0x5529d0[_0x3325('0x29')]){delete _0x5529d0[_0x3325('0x29')];}_0xda843c['status'](_0x7449ae)[_0x3325('0x2a')](_0x5529d0);};}exports[_0x3325('0x2b')]=function(_0x5fb281,_0x1e1017){var _0x397143={},_0x53fd4d={},_0x4d970f={'count':0x0,'rows':[]};var _0xb87d0f=_[_0x3325('0x2c')](db['Attachment'][_0x3325('0x2d')],function(_0x50d482){return{'name':_0x50d482[_0x3325('0x2e')],'type':_0x50d482[_0x3325('0x2f')][_0x3325('0x30')]};});_0x53fd4d['model']=_[_0x3325('0x2c')](_0xb87d0f,'name');_0x53fd4d[_0x3325('0x31')]=_[_0x3325('0x32')](_0x5fb281[_0x3325('0x31')]);_0x53fd4d['filters']=_[_0x3325('0x33')](_0x53fd4d[_0x3325('0x34')],_0x53fd4d[_0x3325('0x31')]);_0x397143[_0x3325('0x35')]=_[_0x3325('0x33')](_0x53fd4d[_0x3325('0x34')],qs[_0x3325('0x36')](_0x5fb281[_0x3325('0x31')][_0x3325('0x36')]));_0x397143[_0x3325('0x35')]=_0x397143[_0x3325('0x35')][_0x3325('0x37')]?_0x397143[_0x3325('0x35')]:_0x53fd4d['model'];if(!_0x5fb281[_0x3325('0x31')][_0x3325('0x38')](_0x3325('0x39'))){_0x397143[_0x3325('0x1d')]=qs['limit'](_0x5fb281[_0x3325('0x31')][_0x3325('0x1d')]);_0x397143[_0x3325('0x1b')]=qs[_0x3325('0x1b')](_0x5fb281[_0x3325('0x31')][_0x3325('0x1b')]);}_0x397143['order']=qs[_0x3325('0x3a')](_0x5fb281[_0x3325('0x31')][_0x3325('0x3a')]);_0x397143[_0x3325('0x3b')]=qs[_0x3325('0x3c')](_[_0x3325('0x3d')](_0x5fb281['query'],_0x53fd4d[_0x3325('0x3c')]),_0xb87d0f);if(_0x5fb281[_0x3325('0x31')][_0x3325('0x3e')]){_0x397143[_0x3325('0x3b')]=_['merge'](_0x397143[_0x3325('0x3b')],{'$or':_[_0x3325('0x2c')](_0xb87d0f,function(_0x16928a){if(_0x16928a[_0x3325('0x2f')]!=='VIRTUAL'){var _0x5e60a5={};_0x5e60a5[_0x16928a[_0x3325('0x29')]]={'$like':'%'+_0x5fb281[_0x3325('0x31')][_0x3325('0x3e')]+'%'};return _0x5e60a5;}})});}_0x397143=_[_0x3325('0x3f')]({},_0x397143,_0x5fb281[_0x3325('0x40')]);var _0x3b0d17={'where':_0x397143[_0x3325('0x3b')]};return db['Attachment']['count'](_0x3b0d17)['then'](function(_0x5cd64){_0x4d970f[_0x3325('0x1e')]=_0x5cd64;if(_0x5fb281[_0x3325('0x31')][_0x3325('0x41')]){_0x397143[_0x3325('0x42')]=[{'all':!![]}];}return db['Attachment'][_0x3325('0x43')](_0x397143);})[_0x3325('0x25')](function(_0x76e782){_0x4d970f[_0x3325('0x44')]=_0x76e782;return _0x4d970f;})[_0x3325('0x25')](respondWithFilteredResult(_0x1e1017,_0x397143))['catch'](handleError(_0x1e1017,null));};exports[_0x3325('0x45')]=function(_0x180ae4,_0x1005e7){var _0x3ce915={'raw':!![],'where':{'id':_0x180ae4['params']['id']}},_0x3c1758={};_0x3c1758[_0x3325('0x34')]=_[_0x3325('0x32')](db[_0x3325('0x46')][_0x3325('0x2d')]);_0x3c1758['query']=_[_0x3325('0x32')](_0x180ae4['query']);_0x3c1758[_0x3325('0x3c')]=_[_0x3325('0x33')](_0x3c1758[_0x3325('0x34')],_0x3c1758[_0x3325('0x31')]);_0x3ce915[_0x3325('0x35')]=_[_0x3325('0x33')](_0x3c1758[_0x3325('0x34')],qs[_0x3325('0x36')](_0x180ae4['query'][_0x3325('0x36')]));_0x3ce915['attributes']=_0x3ce915[_0x3325('0x35')]['length']?_0x3ce915[_0x3325('0x35')]:_0x3c1758[_0x3325('0x34')];if(_0x180ae4['query'][_0x3325('0x41')]){_0x3ce915[_0x3325('0x42')]=[{'all':!![]}];}_0x3ce915=_[_0x3325('0x3f')]({},_0x3ce915,_0x180ae4[_0x3325('0x40')]);return db[_0x3325('0x46')][_0x3325('0x47')](_0x3ce915)['then'](handleEntityNotFound(_0x1005e7,null))[_0x3325('0x25')](respondWithResult(_0x1005e7,null))[_0x3325('0x48')](handleError(_0x1005e7,null));};exports[_0x3325('0x49')]=function(_0x3c6f0f,_0x41c3c1){var _0xbc10fc={'where':{'id':_0x3c6f0f[_0x3325('0x4a')]['id']}},_0x597438={};_0x597438[_0x3325('0x34')]=_[_0x3325('0x32')](db[_0x3325('0x46')][_0x3325('0x2d')]);_0xbc10fc[_0x3325('0x35')]=_[_0x3325('0x33')](_0x597438[_0x3325('0x34')],qs['fields'](_0x3c6f0f[_0x3325('0x31')][_0x3325('0x36')]));_0xbc10fc[_0x3325('0x35')]=_0xbc10fc[_0x3325('0x35')]['length']?_0xbc10fc[_0x3325('0x35')]:_0x597438[_0x3325('0x34')];if(_0x3c6f0f[_0x3325('0x31')][_0x3325('0x41')]){_0xbc10fc['include']=[{'all':!![]}];}_0xbc10fc=_[_0x3325('0x3f')]({},_0xbc10fc,_0x3c6f0f['options']);return db['Attachment'][_0x3325('0x47')](_0xbc10fc)[_0x3325('0x25')](handleEntityNotFound(_0x41c3c1,null))[_0x3325('0x25')](function(_0x12e097){if(_0x12e097){var _0x2ef0dd=_0x12e097['get']({'plain':!![]});_0x2ef0dd=qs[_0x3325('0x4b')](_0x2ef0dd,['id','createdAt',_0x3325('0x4c')]);_0x3c6f0f[_0x3325('0x4d')]=_[_0x3325('0x4b')](_0x3c6f0f[_0x3325('0x4d')],['id','createdAt',_0x3325('0x4c')]);return db[_0x3325('0x46')][_0x3325('0x4e')](_[_0x3325('0x3f')](_0x2ef0dd,_0x3c6f0f[_0x3325('0x4d')]),{'include':_0x3c6f0f['query'][_0x3325('0x41')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x41c3c1,0xc9))[_0x3325('0x48')](handleError(_0x41c3c1,null));};exports[_0x3325('0x23')]=function(_0x49ea3c,_0x25596f){if(_0x49ea3c[_0x3325('0x4d')]['id']){delete _0x49ea3c[_0x3325('0x4d')]['id'];}return db[_0x3325('0x46')]['find']({'where':{'id':_0x49ea3c[_0x3325('0x4a')]['id']}})[_0x3325('0x25')](handleEntityNotFound(_0x25596f,null))[_0x3325('0x25')](saveUpdates(_0x49ea3c['body'],null))[_0x3325('0x25')](respondWithResult(_0x25596f,null))['catch'](handleError(_0x25596f,null));};exports[_0x3325('0x24')]=function(_0x3ab421,_0x3d71f7){return db[_0x3325('0x46')][_0x3325('0x47')]({'where':{'id':_0x3ab421['params']['id']}})[_0x3325('0x25')](handleEntityNotFound(_0x3d71f7,null))['then'](removeEntity(_0x3d71f7,null))[_0x3325('0x48')](handleError(_0x3d71f7,null));};exports[_0x3325('0x4e')]=function(_0x45bd51,_0x1ae281,_0x241816){_0x45bd51[_0x3325('0x4d')]['name']=_0x45bd51[_0x3325('0x4f')]['originalname'];_0x45bd51[_0x3325('0x4d')][_0x3325('0x50')]=_0x45bd51['file'][_0x3325('0x51')];_0x45bd51['body'][_0x3325('0x2f')]=_0x45bd51['file'][_0x3325('0x52')];return db[_0x3325('0x46')]['create'](_0x45bd51['body'])[_0x3325('0x25')](respondWithResult(_0x1ae281,0xc9))[_0x3325('0x48')](handleError(_0x1ae281,null));};exports[_0x3325('0x53')]=function(_0x27cf18,_0x27c7be,_0x3ab0c9){return db[_0x3325('0x46')]['findOne']({'where':{'id':_0x27cf18[_0x3325('0x4a')]['id']},'raw':!![]})[_0x3325('0x25')](handleEntityNotFound(_0x27c7be,null))[_0x3325('0x25')](function(_0x2dcd0e){if(_0x2dcd0e){var _0x50978b=_0x2dcd0e[_0x3325('0x54')]!==null;var _0x5c92fb=path[_0x3325('0x55')](config['root'],'server/files/attachments/');if(_0x50978b){_0x5c92fb=path[_0x3325('0x55')](_0x5c92fb,_0x3325('0x56'));}var _0x4636ef=path['join'](_0x5c92fb,_0x2dcd0e['basename']);return _0x27c7be[_0x3325('0x53')](_0x4636ef);}})['catch'](handleError(_0x27c7be,null));}; \ No newline at end of file +var _0xbaaf=['filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','type','options','Attachment','includeAll','findAll','rows','show','intersection','fields','include','merge','find','catch','get','omit','createdAt','updatedAt','body','params','create','file','originalname','basename','download','ChatOfflineMessageId','join','offline-chat/','eml-format','zip-dir','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','query'];(function(_0x331740,_0x309a7b){var _0x53b6d7=function(_0x48f997){while(--_0x48f997){_0x331740['push'](_0x331740['shift']());}};_0x53b6d7(++_0x309a7b);}(_0xbaaf,0x174));var _0xfbaa=function(_0x1334f5,_0x3066f2){_0x1334f5=_0x1334f5-0x0;var _0x5bd582=_0xbaaf[_0x1334f5];return _0x5bd582;};'use strict';var emlformat=require(_0xfbaa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbaa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfbaa('0x2'));var Mustache=require(_0xfbaa('0x3'));var util=require('util');var path=require(_0xfbaa('0x4'));var sox=require(_0xfbaa('0x5'));var csv=require(_0xfbaa('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbaa('0x7'));var _=require(_0xfbaa('0x8'));var squel=require(_0xfbaa('0x9'));var crypto=require(_0xfbaa('0xa'));var jsforce=require(_0xfbaa('0xb'));var deskjs=require(_0xfbaa('0xc'));var toCsv=require(_0xfbaa('0x6'));var querystring=require('querystring');var Papa=require(_0xfbaa('0xd'));var Redis=require(_0xfbaa('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xfbaa('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfbaa('0x10'));var utils=require(_0xfbaa('0x11'));var config=require(_0xfbaa('0x12'));var licenseUtil=require(_0xfbaa('0x13'));var db=require(_0xfbaa('0x14'))['db'];function respondWithStatusCode(_0xcbe63c,_0x128d79){_0x128d79=_0x128d79||0xcc;return function(_0x227db5){if(_0x227db5){return _0xcbe63c[_0xfbaa('0x15')](_0x128d79);}return _0xcbe63c[_0xfbaa('0x16')](_0x128d79)[_0xfbaa('0x17')]();};}function respondWithResult(_0x41972a,_0x317620){_0x317620=_0x317620||0xc8;return function(_0x29f026){if(_0x29f026){return _0x41972a[_0xfbaa('0x16')](_0x317620)[_0xfbaa('0x18')](_0x29f026);}};}function respondWithFilteredResult(_0x29068c,_0x1349a5){return function(_0xa7e82){if(_0xa7e82){var _0x14dc46=typeof _0x1349a5[_0xfbaa('0x19')]===_0xfbaa('0x1a')&&typeof _0x1349a5[_0xfbaa('0x1b')]===_0xfbaa('0x1a');var _0x184700=_0xa7e82[_0xfbaa('0x1c')];var _0x1c8bc8=_0x14dc46?0x0:_0x1349a5['offset'];var _0x187fee=_0x14dc46?_0xa7e82[_0xfbaa('0x1c')]:_0x1349a5[_0xfbaa('0x19')]+_0x1349a5['limit'];var _0x4a90cc;if(_0x187fee>=_0x184700){_0x187fee=_0x184700;_0x4a90cc=0xc8;}else{_0x4a90cc=0xce;}_0x29068c[_0xfbaa('0x16')](_0x4a90cc);return _0x29068c['set'](_0xfbaa('0x1d'),_0x1c8bc8+'-'+_0x187fee+'/'+_0x184700)[_0xfbaa('0x18')](_0xa7e82);}return null;};}function patchUpdates(_0x2255bf){return function(_0x5c1252){try{jsonpatch[_0xfbaa('0x1e')](_0x5c1252,_0x2255bf,!![]);}catch(_0x189319){return BPromise[_0xfbaa('0x1f')](_0x189319);}return _0x5c1252[_0xfbaa('0x20')]();};}function saveUpdates(_0x567291,_0x9fddd8){return function(_0x59526e){if(_0x59526e){return _0x59526e[_0xfbaa('0x21')](_0x567291)[_0xfbaa('0x22')](function(_0x1cf8de){return _0x1cf8de;});}return null;};}function removeEntity(_0x164b62,_0x276129){return function(_0x4e10ac){if(_0x4e10ac){return _0x4e10ac[_0xfbaa('0x23')]()[_0xfbaa('0x22')](function(){_0x164b62[_0xfbaa('0x16')](0xcc)[_0xfbaa('0x17')]();});}};}function handleEntityNotFound(_0x34f59e,_0x5713d1){return function(_0x2d3ae8){if(!_0x2d3ae8){_0x34f59e[_0xfbaa('0x15')](0x194);}return _0x2d3ae8;};}function handleError(_0x233e2d,_0x332669){_0x332669=_0x332669||0x1f4;return function(_0x4f458d){logger[_0xfbaa('0x24')](_0x4f458d[_0xfbaa('0x25')]);if(_0x4f458d[_0xfbaa('0x26')]){delete _0x4f458d[_0xfbaa('0x26')];}_0x233e2d['status'](_0x332669)[_0xfbaa('0x27')](_0x4f458d);};}exports[_0xfbaa('0x28')]=function(_0x365a94,_0x360b0d){var _0x409e74={},_0x2cbe32={},_0x139d91={'count':0x0,'rows':[]};var _0x1636e4=_['map'](db['Attachment'][_0xfbaa('0x29')],function(_0x386e1e){return{'name':_0x386e1e[_0xfbaa('0x2a')],'type':_0x386e1e['type'][_0xfbaa('0x2b')]};});_0x2cbe32[_0xfbaa('0x2c')]=_[_0xfbaa('0x2d')](_0x1636e4,_0xfbaa('0x26'));_0x2cbe32['query']=_[_0xfbaa('0x2e')](_0x365a94[_0xfbaa('0x2f')]);_0x2cbe32[_0xfbaa('0x30')]=_['intersection'](_0x2cbe32['model'],_0x2cbe32[_0xfbaa('0x2f')]);_0x409e74[_0xfbaa('0x31')]=_['intersection'](_0x2cbe32[_0xfbaa('0x2c')],qs['fields'](_0x365a94[_0xfbaa('0x2f')]['fields']));_0x409e74[_0xfbaa('0x31')]=_0x409e74[_0xfbaa('0x31')][_0xfbaa('0x32')]?_0x409e74[_0xfbaa('0x31')]:_0x2cbe32[_0xfbaa('0x2c')];if(!_0x365a94[_0xfbaa('0x2f')][_0xfbaa('0x33')](_0xfbaa('0x34'))){_0x409e74['limit']=qs['limit'](_0x365a94['query'][_0xfbaa('0x1b')]);_0x409e74[_0xfbaa('0x19')]=qs[_0xfbaa('0x19')](_0x365a94[_0xfbaa('0x2f')][_0xfbaa('0x19')]);}_0x409e74[_0xfbaa('0x35')]=qs[_0xfbaa('0x36')](_0x365a94['query'][_0xfbaa('0x36')]);_0x409e74[_0xfbaa('0x37')]=qs['filters'](_['pick'](_0x365a94[_0xfbaa('0x2f')],_0x2cbe32[_0xfbaa('0x30')]),_0x1636e4);if(_0x365a94['query'][_0xfbaa('0x38')]){_0x409e74[_0xfbaa('0x37')]=_['merge'](_0x409e74['where'],{'$or':_[_0xfbaa('0x2d')](_0x1636e4,function(_0x2fc70d){if(_0x2fc70d[_0xfbaa('0x39')]!=='VIRTUAL'){var _0x2f637b={};_0x2f637b[_0x2fc70d['name']]={'$like':'%'+_0x365a94[_0xfbaa('0x2f')][_0xfbaa('0x38')]+'%'};return _0x2f637b;}})});}_0x409e74=_['merge']({},_0x409e74,_0x365a94[_0xfbaa('0x3a')]);var _0x3fb200={'where':_0x409e74['where']};return db[_0xfbaa('0x3b')][_0xfbaa('0x1c')](_0x3fb200)[_0xfbaa('0x22')](function(_0x2b8d63){_0x139d91[_0xfbaa('0x1c')]=_0x2b8d63;if(_0x365a94[_0xfbaa('0x2f')][_0xfbaa('0x3c')]){_0x409e74['include']=[{'all':!![]}];}return db['Attachment'][_0xfbaa('0x3d')](_0x409e74);})[_0xfbaa('0x22')](function(_0x518c59){_0x139d91[_0xfbaa('0x3e')]=_0x518c59;return _0x139d91;})[_0xfbaa('0x22')](respondWithFilteredResult(_0x360b0d,_0x409e74))['catch'](handleError(_0x360b0d,null));};exports[_0xfbaa('0x3f')]=function(_0x2b014b,_0xacd1){var _0x458c51={'raw':!![],'where':{'id':_0x2b014b['params']['id']}},_0x5eb133={};_0x5eb133[_0xfbaa('0x2c')]=_[_0xfbaa('0x2e')](db[_0xfbaa('0x3b')][_0xfbaa('0x29')]);_0x5eb133[_0xfbaa('0x2f')]=_['keys'](_0x2b014b['query']);_0x5eb133['filters']=_[_0xfbaa('0x40')](_0x5eb133[_0xfbaa('0x2c')],_0x5eb133[_0xfbaa('0x2f')]);_0x458c51[_0xfbaa('0x31')]=_[_0xfbaa('0x40')](_0x5eb133[_0xfbaa('0x2c')],qs[_0xfbaa('0x41')](_0x2b014b[_0xfbaa('0x2f')][_0xfbaa('0x41')]));_0x458c51[_0xfbaa('0x31')]=_0x458c51[_0xfbaa('0x31')][_0xfbaa('0x32')]?_0x458c51[_0xfbaa('0x31')]:_0x5eb133['model'];if(_0x2b014b[_0xfbaa('0x2f')]['includeAll']){_0x458c51[_0xfbaa('0x42')]=[{'all':!![]}];}_0x458c51=_[_0xfbaa('0x43')]({},_0x458c51,_0x2b014b['options']);return db[_0xfbaa('0x3b')][_0xfbaa('0x44')](_0x458c51)[_0xfbaa('0x22')](handleEntityNotFound(_0xacd1,null))[_0xfbaa('0x22')](respondWithResult(_0xacd1,null))[_0xfbaa('0x45')](handleError(_0xacd1,null));};exports['clone']=function(_0x47143f,_0x55601a){var _0x131622={'where':{'id':_0x47143f['params']['id']}},_0x2e909d={};_0x2e909d[_0xfbaa('0x2c')]=_[_0xfbaa('0x2e')](db[_0xfbaa('0x3b')][_0xfbaa('0x29')]);_0x131622[_0xfbaa('0x31')]=_['intersection'](_0x2e909d[_0xfbaa('0x2c')],qs[_0xfbaa('0x41')](_0x47143f['query'][_0xfbaa('0x41')]));_0x131622['attributes']=_0x131622['attributes'][_0xfbaa('0x32')]?_0x131622[_0xfbaa('0x31')]:_0x2e909d[_0xfbaa('0x2c')];if(_0x47143f[_0xfbaa('0x2f')][_0xfbaa('0x3c')]){_0x131622[_0xfbaa('0x42')]=[{'all':!![]}];}_0x131622=_['merge']({},_0x131622,_0x47143f[_0xfbaa('0x3a')]);return db[_0xfbaa('0x3b')][_0xfbaa('0x44')](_0x131622)[_0xfbaa('0x22')](handleEntityNotFound(_0x55601a,null))[_0xfbaa('0x22')](function(_0x5281ea){if(_0x5281ea){var _0x1a9d34=_0x5281ea[_0xfbaa('0x46')]({'plain':!![]});_0x1a9d34=qs[_0xfbaa('0x47')](_0x1a9d34,['id',_0xfbaa('0x48'),_0xfbaa('0x49')]);_0x47143f[_0xfbaa('0x4a')]=_[_0xfbaa('0x47')](_0x47143f[_0xfbaa('0x4a')],['id','createdAt',_0xfbaa('0x49')]);return db[_0xfbaa('0x3b')]['create'](_[_0xfbaa('0x43')](_0x1a9d34,_0x47143f[_0xfbaa('0x4a')]),{'include':_0x47143f[_0xfbaa('0x2f')][_0xfbaa('0x3c')]?[{'all':!![]}]:undefined});}})[_0xfbaa('0x22')](respondWithResult(_0x55601a,0xc9))[_0xfbaa('0x45')](handleError(_0x55601a,null));};exports[_0xfbaa('0x21')]=function(_0x10332b,_0x51cd48){if(_0x10332b[_0xfbaa('0x4a')]['id']){delete _0x10332b[_0xfbaa('0x4a')]['id'];}return db[_0xfbaa('0x3b')]['find']({'where':{'id':_0x10332b[_0xfbaa('0x4b')]['id']}})['then'](handleEntityNotFound(_0x51cd48,null))[_0xfbaa('0x22')](saveUpdates(_0x10332b['body'],null))[_0xfbaa('0x22')](respondWithResult(_0x51cd48,null))[_0xfbaa('0x45')](handleError(_0x51cd48,null));};exports[_0xfbaa('0x23')]=function(_0x4b36c4,_0x5cf1a0){return db[_0xfbaa('0x3b')]['find']({'where':{'id':_0x4b36c4[_0xfbaa('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5cf1a0,null))[_0xfbaa('0x22')](removeEntity(_0x5cf1a0,null))[_0xfbaa('0x45')](handleError(_0x5cf1a0,null));};exports[_0xfbaa('0x4c')]=function(_0x1b89ad,_0x138bfe,_0x3dd1e8){_0x1b89ad[_0xfbaa('0x4a')]['name']=_0x1b89ad[_0xfbaa('0x4d')][_0xfbaa('0x4e')];_0x1b89ad[_0xfbaa('0x4a')][_0xfbaa('0x4f')]=_0x1b89ad[_0xfbaa('0x4d')]['filename'];_0x1b89ad['body'][_0xfbaa('0x39')]=_0x1b89ad['file']['mimetype'];return db[_0xfbaa('0x3b')][_0xfbaa('0x4c')](_0x1b89ad[_0xfbaa('0x4a')])[_0xfbaa('0x22')](respondWithResult(_0x138bfe,0xc9))[_0xfbaa('0x45')](handleError(_0x138bfe,null));};exports[_0xfbaa('0x50')]=function(_0x28cf28,_0x10bdbf,_0x5d8edd){return db[_0xfbaa('0x3b')]['findOne']({'where':{'id':_0x28cf28[_0xfbaa('0x4b')]['id']},'raw':!![]})[_0xfbaa('0x22')](handleEntityNotFound(_0x10bdbf,null))[_0xfbaa('0x22')](function(_0x4b4e97){if(_0x4b4e97){var _0x3307ce=_0x4b4e97[_0xfbaa('0x51')]!==null;var _0x1dddf7=path['join'](config['root'],'server/files/attachments/');if(_0x3307ce){_0x1dddf7=path[_0xfbaa('0x52')](_0x1dddf7,_0xfbaa('0x53'));}var _0x141d43=path[_0xfbaa('0x52')](_0x1dddf7,_0x4b4e97[_0xfbaa('0x4f')]);return _0x10bdbf[_0xfbaa('0x50')](_0x141d43);}})[_0xfbaa('0x45')](handleError(_0x10bdbf,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 045cd42..af076e4 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 _0x0b90=['define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x1730d7,_0x130c47){var _0x7d4107=function(_0x5a89a1){while(--_0x5a89a1){_0x1730d7['push'](_0x1730d7['shift']());}};_0x7d4107(++_0x130c47);}(_0x0b90,0x10d));var _0x00b9=function(_0xbf54aa,_0x242ccf){_0xbf54aa=_0xbf54aa-0x0;var _0x5a7478=_0x0b90[_0xbf54aa];return _0x5a7478;};'use strict';var _=require(_0x00b9('0x0'));var util=require(_0x00b9('0x1'));var logger=require(_0x00b9('0x2'))(_0x00b9('0x3'));var moment=require(_0x00b9('0x4'));var BPromise=require(_0x00b9('0x5'));var rp=require(_0x00b9('0x6'));var fs=require('fs');var path=require(_0x00b9('0x7'));var rimraf=require(_0x00b9('0x8'));var config=require(_0x00b9('0x9'));var attributes=require('./attachment.attributes');module[_0x00b9('0xa')]=function(_0x4e9e11,_0x280a2f){return _0x4e9e11[_0x00b9('0xb')](_0x00b9('0xc'),attributes,{'tableName':_0x00b9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x235a=['../../config/environment','./attachment.attributes','attachments','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2b7f97,_0x3fe5c6){var _0x3c2339=function(_0x12e36c){while(--_0x12e36c){_0x2b7f97['push'](_0x2b7f97['shift']());}};_0x3c2339(++_0x3fe5c6);}(_0x235a,0x158));var _0xa235=function(_0x251f8f,_0xde2a1f){_0x251f8f=_0x251f8f-0x0;var _0x52f508=_0x235a[_0x251f8f];return _0x52f508;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var logger=require(_0xa235('0x2'))(_0xa235('0x3'));var moment=require('moment');var BPromise=require(_0xa235('0x4'));var rp=require(_0xa235('0x5'));var fs=require('fs');var path=require(_0xa235('0x6'));var rimraf=require(_0xa235('0x7'));var config=require(_0xa235('0x8'));var attributes=require(_0xa235('0x9'));module['exports']=function(_0x4eb52c,_0x3a1ab8){return _0x4eb52c['define']('Attachment',attributes,{'tableName':_0xa235('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index e5dc80f..6456e64 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 _0x765e=['request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','Attachment,\x20%s,\x20%s','message','result','catch','CreateAttachment','create','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x17ace5,_0x11a736){var _0x44a983=function(_0x547d9f){while(--_0x547d9f){_0x17ace5['push'](_0x17ace5['shift']());}};_0x44a983(++_0x11a736);}(_0x765e,0x131));var _0xe765=function(_0x17804e,_0x1cd787){_0x17804e=_0x17804e-0x0;var _0x5e6025=_0x765e[_0x17804e];return _0x5e6025;};'use strict';var _=require(_0xe765('0x0'));var util=require(_0xe765('0x1'));var moment=require(_0xe765('0x2'));var BPromise=require(_0xe765('0x3'));var rs=require(_0xe765('0x4'));var fs=require('fs');var Redis=require(_0xe765('0x5'));var db=require(_0xe765('0x6'))['db'];var utils=require(_0xe765('0x7'));var logger=require(_0xe765('0x8'))(_0xe765('0x9'));var config=require(_0xe765('0xa'));var jayson=require(_0xe765('0xb'));var client=jayson[_0xe765('0xc')][_0xe765('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xdd89e7,_0x504542,_0x35d891){return new BPromise(function(_0x28e955,_0x27b0f4){return client[_0xe765('0xe')](_0xdd89e7,_0x35d891)[_0xe765('0xf')](function(_0x41801f){logger[_0xe765('0x10')]('Attachment,\x20%s,\x20%s',_0x504542,_0xe765('0x11'));logger[_0xe765('0x12')](_0xe765('0x13'),_0x504542,'request\x20sent',JSON[_0xe765('0x14')](_0x41801f));if(_0x41801f['error']){if(_0x41801f['error']['code']===0x1f4){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x27b0f4(_0x41801f[_0xe765('0x15')]['message']);}logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x41801f[_0xe765('0x15')][_0xe765('0x17')]);return _0x28e955(_0x41801f[_0xe765('0x15')]['message']);}else{logger['info'](_0xe765('0x16'),_0x504542,_0xe765('0x11'));_0x28e955(_0x41801f[_0xe765('0x18')]['message']);}})[_0xe765('0x19')](function(_0x36aca3){logger[_0xe765('0x15')](_0xe765('0x16'),_0x504542,_0x36aca3);_0x27b0f4(_0x36aca3);});});}exports[_0xe765('0x1a')]=function(_0xf93371){var _0x788b40=this;return new Promise(function(_0x2a95a9,_0x99e6a9){return db['Attachment'][_0xe765('0x1b')](_0xf93371['body'],{'raw':_0xf93371[_0xe765('0x1c')]?_0xf93371[_0xe765('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xe765('0xf')](function(_0x59118f){logger[_0xe765('0x10')](_0xe765('0x1a'),_0xf93371);logger[_0xe765('0x12')]('CreateAttachment',_0xf93371,JSON['stringify'](_0x59118f));_0x2a95a9(_0x59118f);})['catch'](function(_0x1c6de4){logger[_0xe765('0x15')](_0xe765('0x1a'),_0x1c6de4[_0xe765('0x17')],_0xf93371);_0x99e6a9(_0x788b40['error'](0x1f4,_0x1c6de4['message']));});});}; \ No newline at end of file +var _0x0487=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','create','raw','CreateAttachment','catch','lodash'];(function(_0xec1e0b,_0x4375fd){var _0x261752=function(_0x539e38){while(--_0x539e38){_0xec1e0b['push'](_0xec1e0b['shift']());}};_0x261752(++_0x4375fd);}(_0x0487,0x14f));var _0x7048=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x0487[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x7048('0x0'));var util=require(_0x7048('0x1'));var moment=require(_0x7048('0x2'));var BPromise=require(_0x7048('0x3'));var rs=require(_0x7048('0x4'));var fs=require('fs');var Redis=require(_0x7048('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7048('0x6'));var logger=require('../../config/logger')(_0x7048('0x7'));var config=require(_0x7048('0x8'));var jayson=require(_0x7048('0x9'));var client=jayson[_0x7048('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aaedd,_0x140c84,_0xf90179){return new BPromise(function(_0x5683ce,_0x40c685){return client['request'](_0x2aaedd,_0xf90179)[_0x7048('0xb')](function(_0x40fc92){logger[_0x7048('0xc')](_0x7048('0xd'),_0x140c84,_0x7048('0xe'));logger[_0x7048('0xf')](_0x7048('0x10'),_0x140c84,'request\x20sent',JSON[_0x7048('0x11')](_0x40fc92));if(_0x40fc92[_0x7048('0x12')]){if(_0x40fc92[_0x7048('0x12')]['code']===0x1f4){logger[_0x7048('0x12')](_0x7048('0xd'),_0x140c84,_0x40fc92['error'][_0x7048('0x13')]);return _0x40c685(_0x40fc92[_0x7048('0x12')][_0x7048('0x13')]);}logger[_0x7048('0x12')](_0x7048('0xd'),_0x140c84,_0x40fc92['error'][_0x7048('0x13')]);return _0x5683ce(_0x40fc92['error'][_0x7048('0x13')]);}else{logger[_0x7048('0xc')](_0x7048('0xd'),_0x140c84,_0x7048('0xe'));_0x5683ce(_0x40fc92['result'][_0x7048('0x13')]);}})['catch'](function(_0x1082a0){logger[_0x7048('0x12')]('Attachment,\x20%s,\x20%s',_0x140c84,_0x1082a0);_0x40c685(_0x1082a0);});});}exports['CreateAttachment']=function(_0x255d5d){var _0xbef931=this;return new Promise(function(_0x1db323,_0xe5fd91){return db['Attachment'][_0x7048('0x14')](_0x255d5d['body'],{'raw':_0x255d5d['options']?_0x255d5d['options'][_0x7048('0x15')]===undefined?!![]:![]:!![]})[_0x7048('0xb')](function(_0xa83230){logger[_0x7048('0xc')](_0x7048('0x16'),_0x255d5d);logger['debug'](_0x7048('0x16'),_0x255d5d,JSON['stringify'](_0xa83230));_0x1db323(_0xa83230);})[_0x7048('0x17')](function(_0x43a621){logger[_0x7048('0x12')](_0x7048('0x16'),_0x43a621[_0x7048('0x13')],_0x255d5d);_0xe5fd91(_0xbef931[_0x7048('0x12')](0x1f4,_0x43a621['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 61cccc3..de56a19 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['/:id/clone','clone','diskStorage','join','server/files/attachments/','format','now','originalname','replace','single','create','/:id','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','show','/:id/download','post'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0x0b0e[_0x4e11e7];return _0x1d7d39;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['download']);router[_0xe0b0('0xe')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);var upload=multer({'storage':multer[_0xe0b0('0x11')]({'destination':function(_0x574d96,_0x399320,_0x2cdad2){_0x2cdad2(null,path[_0xe0b0('0x12')](config['root'],_0xe0b0('0x13')));},'filename':function(_0x1c358a,_0x3cc19a,_0x45f914){_0x45f914(null,util[_0xe0b0('0x14')]('%s-%s',Date[_0xe0b0('0x15')](),_0x3cc19a[_0xe0b0('0x16')][_0xe0b0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe0b0('0xe')]('/',upload[_0xe0b0('0x18')]('file'),controller[_0xe0b0('0x19')]);router['put'](_0xe0b0('0x1a'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x1b')]('/:id',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x10903a,_0x113c61){var _0xd7f6ff=function(_0x250d14){while(--_0x250d14){_0x10903a['push'](_0x10903a['shift']());}};_0xd7f6ff(++_0x113c61);}(_0xb10b,0x12a));var _0xbb10=function(_0x1ac33a,_0x52f6f8){_0x1ac33a=_0x1ac33a-0x0;var _0x3b6b87=_0xb10b[_0x1ac33a];return _0x3b6b87;};'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 3b17d14..a5bdcf7 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 _0xa10d=['util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','findOne','adSsoEnabled','blockDuration','then','password','role','disabled','blocked','online','admin','user','agent','name','blockedAt','add','minutes','getLicense','login','signToken','json','ad-login','User','passport','passport-local','Strategy','moment','bluebird'];(function(_0x2e0f64,_0x17743b){var _0x40ec93=function(_0x3f95a){while(--_0x3f95a){_0x2e0f64['push'](_0x2e0f64['shift']());}};_0x40ec93(++_0x17743b);}(_0xa10d,0xd2));var _0xda10=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xa10d[_0x4ff09b];return _0x3f5c2e;};'use strict';var passport=require(_0xda10('0x0'));var LocalStrategy=require(_0xda10('0x1'))[_0xda10('0x2')];var moment=require(_0xda10('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xda10('0x4'));var util=require(_0xda10('0x5'));var db=require('../../mysqldb')['db'];var authService=require(_0xda10('0x6'));var utils=require(_0xda10('0x7'));var config=require(_0xda10('0x8'));var logger=require(_0xda10('0x9'))(_0xda10('0xa'));function isActiveDirectoryConfigured(_0x122603){var _0x254978=![];if(typeof _0x122603[_0xda10('0xb')]!==_0xda10('0xc')){_0x254978=_0x122603[_0xda10('0xb')][_0xda10('0xd')]&&_0x122603[_0xda10('0xb')]['url']&&_0x122603['activedirectory'][_0xda10('0xe')];}return _0x254978;}function adAuthenticate(_0xc44a1f,_0x23fb85,_0x10a15d){return new BPromise(function(_0x576f6e,_0x2876a8){try{var _0x161975=new ActiveDirectory(_0xc44a1f);_0x161975[_0xda10('0xf')](_0x23fb85,_0x10a15d,function(_0x3c8f4e,_0x67600){if(_0x3c8f4e){logger[_0xda10('0x10')](_0xda10('0x11'),_0x23fb85,util[_0xda10('0x12')](_0x3c8f4e,{'showHidden':![],'depth':null}));_0x2876a8(_0xda10('0x13'));}else if(!_0x67600){logger[_0xda10('0x10')](_0xda10('0x14'),_0x23fb85);_0x2876a8(_0xda10('0x13'));}else{_0x576f6e(_0x67600);}});}catch(_0x495766){_0x2876a8(_0x495766);}});}function ActiveDirectoryAuthenticate(_0xe44d1e,_0x48667e,_0x17e13f,_0x5a756b){var _0x2f6c70,_0xb99592;if(!isActiveDirectoryConfigured(config)){logger['error']('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x48667e);return _0x5a756b(null,![],{'message':_0xda10('0x13')});}return db['Setting'][_0xda10('0x15')]({'where':{'id':0x1},'attributes':[_0xda10('0x16'),_0xda10('0x17')],'raw':!![]})[_0xda10('0x18')](function(_0x19936c){_0x2f6c70=_0x19936c;if(!_0x2f6c70['adSsoEnabled']){logger[_0xda10('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x48667e);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xe44d1e[_0xda10('0x15')]({'attributes':['id','name',_0xda10('0x19'),'salt',_0xda10('0x1a'),_0xda10('0x1b'),_0xda10('0x1c'),'blockedAt',_0xda10('0x1d')],'where':{'name':_0x48667e,'role':{'$or':[_0xda10('0x1e'),_0xda10('0x1f'),_0xda10('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x32a731){if(!_0x32a731||_0x32a731&&_0x32a731[_0xda10('0x21')]!==_0x48667e){throw new Error(_0xda10('0x13'));}_0xb99592=_0x32a731;var _0x1c59a7=_0xb99592[_0xda10('0x21')]+'@'+config[_0xda10('0xb')]['domain'];return adAuthenticate(config[_0xda10('0xb')],_0x1c59a7,_0x17e13f);})[_0xda10('0x18')](function(_0x3ad924){if(_0xb99592[_0xda10('0x1b')]){throw new Error(_0xda10('0x13'));}if(_0x2f6c70[_0xda10('0x17')]>0x0){if(_0xb99592[_0xda10('0x1c')]){if(moment(_0xb99592[_0xda10('0x22')])[_0xda10('0x23')](_0x2f6c70[_0xda10('0x17')],_0xda10('0x24'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils['clearBlockUser'](_0xb99592,0x0,![],null)[_0xda10('0x18')](function(){return utils[_0xda10('0x25')](_0xb99592);})[_0xda10('0x18')](function(){return _0x5a756b(null,_0xb99592);});}else{return utils['getLicense'](_0xb99592)['then'](function(){return _0x5a756b(null,_0xb99592);});}}else{return utils['getLicense'](_0xb99592)[_0xda10('0x18')](function(){return _0x5a756b(null,_0xb99592);});}})['catch'](function(_0x137668){return _0x5a756b(null,![],_0x137668);});}function handleError(_0x5e396f,_0x690ad4,_0x292d86){return _0x5e396f['status'](_0x690ad4||0x1f4)['send']({'message':_0x292d86?_0x292d86['message']||_0x292d86:''});}exports[_0xda10('0x26')]=function(_0x47bee8,_0x1d2090,_0x7c22f9){passport[_0xda10('0xf')]('ad-login',function(_0x23470a,_0x106d5c,_0x1ac4d6){var _0x28592e=_0x23470a||_0x1ac4d6;if(_0x28592e){return handleError(_0x1d2090,0x191,_0x28592e);}if(!_0x106d5c){return handleError(_0x1d2090,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x436be6={'payload':{'id':_0x106d5c['id'],'role':_0x106d5c[_0xda10('0x1a')]},'options':{'expiresIn':0x15180}};return authService[_0xda10('0x27')](_0x436be6)[_0xda10('0x18')](function(_0x19be42){_0x1d2090[_0xda10('0x28')]({'id':_0x106d5c['id'],'token':_0x19be42,'statusCall':'','isAlreadyLogged':_0x106d5c[_0xda10('0x1d')]});});}})(_0x47bee8,_0x1d2090,_0x7c22f9);};passport['use'](_0xda10('0x29'),new LocalStrategy({'usernameField':'name','passwordField':_0xda10('0x19')},function(_0x2358ac,_0x2fa66f,_0x2ba005){return ActiveDirectoryAuthenticate(db[_0xda10('0x2a')],_0x2358ac,_0x2fa66f,_0x2ba005);})); \ No newline at end of file +var _0x62e6=['then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blocked','blockedAt','online','admin','user','add','minutes','clearBlockUser','getLicense','catch','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','activedirectory','undefined','baseDN','url','domain','authenticate','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration'];(function(_0x575c75,_0x120aa9){var _0x436370=function(_0x235a5a){while(--_0x235a5a){_0x575c75['push'](_0x575c75['shift']());}};_0x436370(++_0x120aa9);}(_0x62e6,0x151));var _0x662e=function(_0x295a3d,_0x56d487){_0x295a3d=_0x295a3d-0x0;var _0x23a732=_0x62e6[_0x295a3d];return _0x23a732;};'use strict';var passport=require(_0x662e('0x0'));var LocalStrategy=require(_0x662e('0x1'))[_0x662e('0x2')];var moment=require(_0x662e('0x3'));var ActiveDirectory=require(_0x662e('0x4'));var BPromise=require(_0x662e('0x5'));var util=require(_0x662e('0x6'));var db=require(_0x662e('0x7'))['db'];var authService=require(_0x662e('0x8'));var utils=require(_0x662e('0x9'));var config=require('../../config/environment');var logger=require(_0x662e('0xa'))('api');function isActiveDirectoryConfigured(_0x4f820c){var _0x3bb476=![];if(typeof _0x4f820c[_0x662e('0xb')]!==_0x662e('0xc')){_0x3bb476=_0x4f820c[_0x662e('0xb')][_0x662e('0xd')]&&_0x4f820c[_0x662e('0xb')][_0x662e('0xe')]&&_0x4f820c[_0x662e('0xb')][_0x662e('0xf')];}return _0x3bb476;}function adAuthenticate(_0xa50fc7,_0x41cc04,_0x34f64d){return new BPromise(function(_0x36929d,_0x3b2d3b){try{var _0x565ae6=new ActiveDirectory(_0xa50fc7);_0x565ae6[_0x662e('0x10')](_0x41cc04,_0x34f64d,function(_0x392537,_0x3e6e3b){if(_0x392537){logger['error'](_0x662e('0x11'),_0x41cc04,util[_0x662e('0x12')](_0x392537,{'showHidden':![],'depth':null}));_0x3b2d3b(_0x662e('0x13'));}else if(!_0x3e6e3b){logger[_0x662e('0x14')](_0x662e('0x15'),_0x41cc04);_0x3b2d3b(_0x662e('0x13'));}else{_0x36929d(_0x3e6e3b);}});}catch(_0x13f9a9){_0x3b2d3b(_0x13f9a9);}});}function ActiveDirectoryAuthenticate(_0x48b27b,_0xe92d45,_0x4dd7dc,_0x1a6a13){var _0x541ada,_0x4cd7e1;if(!isActiveDirectoryConfigured(config)){logger[_0x662e('0x14')](_0x662e('0x16'),_0xe92d45);return _0x1a6a13(null,![],{'message':_0x662e('0x13')});}return db[_0x662e('0x17')][_0x662e('0x18')]({'where':{'id':0x1},'attributes':[_0x662e('0x19'),_0x662e('0x1a')],'raw':!![]})[_0x662e('0x1b')](function(_0x2acf43){_0x541ada=_0x2acf43;if(!_0x541ada[_0x662e('0x19')]){logger[_0x662e('0x14')](_0x662e('0x1c'),_0xe92d45);throw new Error(_0x662e('0x13'));}return _0x48b27b[_0x662e('0x18')]({'attributes':['id',_0x662e('0x1d'),_0x662e('0x1e'),_0x662e('0x1f'),_0x662e('0x20'),'disabled',_0x662e('0x21'),_0x662e('0x22'),_0x662e('0x23')],'where':{'name':_0xe92d45,'role':{'$or':[_0x662e('0x24'),_0x662e('0x25'),'agent']},'adSsoEnabled':!![]}});})[_0x662e('0x1b')](function(_0xa9c41){if(!_0xa9c41||_0xa9c41&&_0xa9c41[_0x662e('0x1d')]!==_0xe92d45){throw new Error(_0x662e('0x13'));}_0x4cd7e1=_0xa9c41;var _0x243e82=_0x4cd7e1[_0x662e('0x1d')]+'@'+config[_0x662e('0xb')][_0x662e('0xf')];return adAuthenticate(config[_0x662e('0xb')],_0x243e82,_0x4dd7dc);})[_0x662e('0x1b')](function(_0x23327d){if(_0x4cd7e1['disabled']){throw new Error(_0x662e('0x13'));}if(_0x541ada[_0x662e('0x1a')]>0x0){if(_0x4cd7e1['blocked']){if(moment(_0x4cd7e1[_0x662e('0x22')])[_0x662e('0x26')](_0x541ada[_0x662e('0x1a')],_0x662e('0x27'))>moment()){throw new Error(_0x662e('0x13'));}return utils[_0x662e('0x28')](_0x4cd7e1,0x0,![],null)['then'](function(){return utils['getLicense'](_0x4cd7e1);})[_0x662e('0x1b')](function(){return _0x1a6a13(null,_0x4cd7e1);});}else{return utils['getLicense'](_0x4cd7e1)['then'](function(){return _0x1a6a13(null,_0x4cd7e1);});}}else{return utils[_0x662e('0x29')](_0x4cd7e1)[_0x662e('0x1b')](function(){return _0x1a6a13(null,_0x4cd7e1);});}})[_0x662e('0x2a')](function(_0x398d26){return _0x1a6a13(null,![],_0x398d26);});}function handleError(_0x1b9326,_0x4fa731,_0x3acec2){return _0x1b9326[_0x662e('0x2b')](_0x4fa731||0x1f4)[_0x662e('0x2c')]({'message':_0x3acec2?_0x3acec2[_0x662e('0x2d')]||_0x3acec2:''});}exports[_0x662e('0x2e')]=function(_0x760c0d,_0x3f009e,_0x19d96e){passport['authenticate'](_0x662e('0x2f'),function(_0x317240,_0x2fc835,_0x5e788f){var _0x53b61e=_0x317240||_0x5e788f;if(_0x53b61e){return handleError(_0x3f009e,0x191,_0x53b61e);}if(!_0x2fc835){return handleError(_0x3f009e,0x194,{'message':_0x662e('0x30')});}else{var _0x108eaf={'payload':{'id':_0x2fc835['id'],'role':_0x2fc835[_0x662e('0x20')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x108eaf)['then'](function(_0x39e12e){_0x3f009e[_0x662e('0x31')]({'id':_0x2fc835['id'],'token':_0x39e12e,'statusCall':'','isAlreadyLogged':_0x2fc835[_0x662e('0x23')]});});}})(_0x760c0d,_0x3f009e,_0x19d96e);};passport[_0x662e('0x32')]('ad-login',new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x4f3d20,_0x2b4839,_0x3f479f){return ActiveDirectoryAuthenticate(db[_0x662e('0x33')],_0x4f3d20,_0x2b4839,_0x3f479f);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index c647f17..ec18db7 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 _0xd4e9=['login','express','Router','post'];(function(_0x2d9f25,_0x173f8b){var _0x5dbb89=function(_0x374bd2){while(--_0x374bd2){_0x2d9f25['push'](_0x2d9f25['shift']());}};_0x5dbb89(++_0x173f8b);}(_0xd4e9,0x109));var _0x9d4e=function(_0x6a4251,_0x3f98e7){_0x6a4251=_0x6a4251-0x0;var _0x2a2425=_0xd4e9[_0x6a4251];return _0x2a2425;};'use strict';var express=require(_0x9d4e('0x0'));var router=express[_0x9d4e('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0x9d4e('0x2')]('/',controller[_0x9d4e('0x3')]);module['exports']=router; \ No newline at end of file +var _0x011e=['./authActiveDirectory.controller','post','login','express','Router'];(function(_0xc23a57,_0x21d26f){var _0x4ba038=function(_0x42be44){while(--_0x42be44){_0xc23a57['push'](_0xc23a57['shift']());}};_0x4ba038(++_0x21d26f);}(_0x011e,0x193));var _0xe011=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0x011e[_0x3054be];return _0x3df150;};'use strict';var express=require(_0xe011('0x0'));var router=express[_0xe011('0x1')]();var controller=require(_0xe011('0x2'));router[_0xe011('0x3')]('/',controller[_0xe011('0x4')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5fb4489..15f5b62 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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x7a54,0x106));var _0x47a5=function(_0x1e2bc0,_0x486773){_0x1e2bc0=_0x1e2bc0-0x0;var _0x4ceb73=_0x7a54[_0x1e2bc0];return _0x4ceb73;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x7a54,0x106));var _0x47a5=function(_0x4e594a,_0x10c8e9){_0x4e594a=_0x4e594a-0x0;var _0x401a21=_0x7a54[_0x4e594a];return _0x401a21;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index abcb958..d8f2c1b 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 _0x30ea=['callback','isMiddleware','setTokenCookie','exports','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x30ea,0x13a));var _0xa30e=function(_0xcb09c5,_0x41c348){_0xcb09c5=_0xcb09c5-0x0;var _0x149219=_0x30ea[_0xcb09c5];return _0x149219;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0xa30e('0x0')]();var controller=require(_0xa30e('0x1'));var userController=require('../user/user.controller.js');var authService=require(_0xa30e('0x2'));router[_0xa30e('0x3')]('/',controller[_0xa30e('0x4')]);router['get'](_0xa30e('0x5'),controller[_0xa30e('0x6')],authService[_0xa30e('0x7')],userController[_0xa30e('0x4')],authService[_0xa30e('0x8')]);module[_0xa30e('0x9')]=router; \ No newline at end of file +var _0x4f35=['setTokenCookie','exports','express','Router','./authGoogle.controller','../../components/auth/service','get','login','/callback','callback'];(function(_0xef4540,_0x58ffd1){var _0x5d9ee1=function(_0x8c1af){while(--_0x8c1af){_0xef4540['push'](_0xef4540['shift']());}};_0x5d9ee1(++_0x58ffd1);}(_0x4f35,0x142));var _0x54f3=function(_0x465931,_0x2a32a2){_0x465931=_0x465931-0x0;var _0x329227=_0x4f35[_0x465931];return _0x329227;};'use strict';var express=require(_0x54f3('0x0'));var passport=require('passport');var router=express[_0x54f3('0x1')]();var controller=require(_0x54f3('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x54f3('0x3'));router[_0x54f3('0x4')]('/',controller[_0x54f3('0x5')]);router['get'](_0x54f3('0x6'),controller[_0x54f3('0x7')],authService['isMiddleware'],userController[_0x54f3('0x5')],authService[_0x54f3('0x8')]);module[_0x54f3('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index fffe73b..7e04fa7 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 _0xcf12=['merge','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','send','login','local-login','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','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://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','password','previousPasswords','validatePasswordHistory','resetPasswordToken','Password\x20reset!','User','util','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','then','findOne','name','salt','role','disabled','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','allowedLoginAttempts','add','blockDuration','minutes','clearBlockUser','blocked','getLicense','catch','MailAccount','find','email','Smtp','CloudProvider','getSmtpOptions'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcf12,0x16a));var _0x2cf1=function(_0x8bece7,_0x2b0a5f){_0x8bece7=_0x8bece7-0x0;var _0x54191b=_0xcf12[_0x8bece7];return _0x54191b;};'use strict';var util=require(_0x2cf1('0x0'));var passport=require('passport');var LocalStrategy=require(_0x2cf1('0x1'))[_0x2cf1('0x2')];var jayson=require(_0x2cf1('0x3'));var _=require(_0x2cf1('0x4'));var rs=require('randomstring');var moment=require(_0x2cf1('0x5'));var db=require(_0x2cf1('0x6'))['db'];var authService=require(_0x2cf1('0x7'));var utils=require(_0x2cf1('0x8'));var client=jayson[_0x2cf1('0x9')][_0x2cf1('0xa')]({'port':0x232b});function localAuthenticate(_0x5ae8aa,_0x6b3677,_0x391b76,_0x1a9475){var _0x5a6371,_0x15b407;return db[_0x2cf1('0xb')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x2cf1('0xc')](function(_0x31e8ec){_0x5a6371=_0x31e8ec;return _0x5ae8aa[_0x2cf1('0xd')]({'attributes':['id',_0x2cf1('0xe'),'password',_0x2cf1('0xf'),_0x2cf1('0x10'),_0x2cf1('0x11'),'blocked',_0x2cf1('0x12'),_0x2cf1('0x13')],'where':{'name':_0x6b3677,'role':{'$or':['admin',_0x2cf1('0x14'),_0x2cf1('0x15')]}}});})[_0x2cf1('0xc')](function(_0x2a7a78){if(!_0x2a7a78||_0x2a7a78&&_0x2a7a78[_0x2cf1('0xe')]!==_0x6b3677){throw new Error(_0x2cf1('0x16'));}else{_0x15b407=_0x2a7a78;return _0x15b407;}})[_0x2cf1('0xc')](function(){_0x15b407[_0x2cf1('0x17')](_0x391b76,function(_0xfd810c,_0x10884b){var _0x295b0a=_0x15b407[_0x2cf1('0x13')]+0x1;if(_0xfd810c){return _0x1a9475(_0xfd810c);}else if(!_0x10884b){if(_0x15b407[_0x2cf1('0x11')]){return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});}else if(_0x5a6371[_0x2cf1('0x18')]>0x0){if(_0x15b407['blocked']){if(_0x5a6371['blockDuration']>0x0){if(moment(_0x15b407[_0x2cf1('0x12')])[_0x2cf1('0x19')](_0x5a6371[_0x2cf1('0x1a')],_0x2cf1('0x1b'))>moment()){return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});}else{return utils[_0x2cf1('0x1c')](_0x15b407,_0x295b0a,![],null)[_0x2cf1('0xc')](function(){return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});});}}else{return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});}}else{if(_0x295b0a>=_0x5a6371['allowedLoginAttempts']){return utils[_0x2cf1('0x1c')](_0x15b407,0x0,!![],moment())[_0x2cf1('0xc')](function(){return _0x1a9475(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0x2cf1('0x1c')](_0x15b407,_0x295b0a,![],null)[_0x2cf1('0xc')](function(){return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});});}}}else{return _0x1a9475(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x15b407['disabled']){return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});}else if(_0x5a6371[_0x2cf1('0x18')]>0x0){if(_0x15b407[_0x2cf1('0x1d')]){if(_0x5a6371[_0x2cf1('0x1a')]>0x0){if(moment(_0x15b407['blockedAt'])['add'](_0x5a6371[_0x2cf1('0x1a')],'minutes')>moment()){return _0x1a9475(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x2cf1('0x1c')](_0x15b407,0x0,![],null)[_0x2cf1('0xc')](function(){return utils[_0x2cf1('0x1e')](_0x15b407);})['then'](function(){return _0x1a9475(null,_0x15b407);});}}else{return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});}}else{return utils[_0x2cf1('0x1c')](_0x15b407,0x0,![],null)['then'](function(){return utils[_0x2cf1('0x1e')](_0x15b407);})[_0x2cf1('0xc')](function(){return _0x1a9475(null,_0x15b407);})[_0x2cf1('0x1f')](function(_0x27c5b0){return _0x1a9475(null,![],_0x27c5b0);});}}else{if(_0x15b407[_0x2cf1('0x1d')]){return _0x1a9475(null,![],{'message':_0x2cf1('0x16')});}else{return utils[_0x2cf1('0x1e')](_0x15b407)[_0x2cf1('0xc')](function(){return _0x1a9475(null,_0x15b407);});}}}});})[_0x2cf1('0x1f')](function(_0x81d620){return _0x1a9475(null,![],_0x81d620);});}function sendServiceMail(_0x53a05d){return db[_0x2cf1('0x20')][_0x2cf1('0x21')]({'where':{'service':!![]},'attributes':['id',_0x2cf1('0xe'),_0x2cf1('0x22')],'include':[{'model':db['MailServerOut'],'as':_0x2cf1('0x23'),'include':[{'model':db[_0x2cf1('0x24')],'as':_0x2cf1('0x24')}]}]})['then'](function(_0x531869){if(!_0x531869){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x9cf36f=_0x531869[_0x2cf1('0x25')]();var _0xf9c535={'account':_0x9cf36f,'message':_[_0x2cf1('0x26')]({'from':util[_0x2cf1('0x27')](_0x2cf1('0x28'),_0x531869[_0x2cf1('0xe')],_0x531869['email']||_0x531869['Smtp'][_0x2cf1('0x14')])},_0x53a05d)};return client[_0x2cf1('0x29')](_0x2cf1('0x2a'),_0xf9c535);})[_0x2cf1('0xc')](function(_0x4eddeb){if(_0x4eddeb['error']){throw new Error(util[_0x2cf1('0x27')](_0x2cf1('0x2b'),_0x4eddeb['error'][_0x2cf1('0x2c')]||JSON['stringify'](_0x4eddeb[_0x2cf1('0x2d')])));}return!![];});}function handleError(_0x140e5c,_0x207093,_0x3d78cb){return _0x140e5c['status'](_0x207093||0x1f4)[_0x2cf1('0x2e')]({'message':_0x3d78cb?_0x3d78cb[_0x2cf1('0x2c')]||_0x3d78cb:''});}exports[_0x2cf1('0x2f')]=function(_0x575bf9,_0x3e0eed,_0x51626a){passport[_0x2cf1('0x17')](_0x2cf1('0x30'),function(_0x513e15,_0x4f4ad5,_0x18c9a0){var _0x3e9bc9=_0x513e15||_0x18c9a0;if(_0x3e9bc9){return handleError(_0x3e0eed,0x191,_0x3e9bc9);}if(!_0x4f4ad5){return handleError(_0x3e0eed,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x1c225={'payload':{'id':_0x4f4ad5['id'],'role':_0x4f4ad5[_0x2cf1('0x10')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1c225)[_0x2cf1('0xc')](function(_0x22fe52){_0x3e0eed[_0x2cf1('0x31')]({'id':_0x4f4ad5['id'],'token':_0x22fe52,'statusCall':'','isAlreadyLogged':_0x4f4ad5[_0x2cf1('0x32')]});});}})(_0x575bf9,_0x3e0eed,_0x51626a);};exports[_0x2cf1('0x33')]=function(_0x23a3fd,_0x5ba968){if(!_0x23a3fd[_0x2cf1('0x34')][_0x2cf1('0x22')]){return handleError(_0x5ba968,0x1f4,{'message':_0x2cf1('0x35')});}var _0x5522de=rs[_0x2cf1('0x36')]();_0x23a3fd[_0x2cf1('0x34')][_0x2cf1('0x22')]=_0x23a3fd['body'][_0x2cf1('0x22')][_0x2cf1('0x37')]()['toLowerCase']();var _0x3d9a72;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x2cf1('0x18'),_0x2cf1('0x1a')],'raw':!![]})[_0x2cf1('0xc')](function(_0xb88b57){_0x3d9a72=_0xb88b57;return db['User'][_0x2cf1('0x21')]({'where':{'email':_0x23a3fd[_0x2cf1('0x34')][_0x2cf1('0x22')]}});})[_0x2cf1('0xc')](function(_0x3e566a){if(!_0x3e566a){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x3e566a['disabled']){throw new Error(_0x2cf1('0x38'));}if(_0x3e566a[_0x2cf1('0x1d')]){if(moment(_0x3e566a[_0x2cf1('0x12')])[_0x2cf1('0x19')](_0x3d9a72['blockDuration'],_0x2cf1('0x1b'))>moment()){throw new Error(_0x2cf1('0x39'));}else{_0x3e566a[_0x2cf1('0x1d')]=![];_0x3e566a[_0x2cf1('0x12')]=null;}}_0x3e566a['resetPasswordToken']=_0x5522de;_0x3e566a[_0x2cf1('0x3a')]=Date[_0x2cf1('0x3b')]()+0x36ee80;return _0x3e566a[_0x2cf1('0x3c')]();})[_0x2cf1('0xc')](function(){return sendServiceMail({'to':_0x23a3fd[_0x2cf1('0x34')][_0x2cf1('0x22')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x2cf1('0x3d')+_0x2cf1('0x3e')+_0x2cf1('0x3f')+_0x23a3fd['headers'][_0x2cf1('0x40')]+'/reset/'+_0x5522de+'\x0a\x0a'+_0x2cf1('0x41')});})['then'](function(){_0x5ba968[_0x2cf1('0x42')](0xc8)[_0x2cf1('0x2e')]({'message':_0x2cf1('0x43')});})[_0x2cf1('0x1f')](function(_0x15c3b0){return handleError(_0x5ba968,0x1f4,_0x15c3b0);});};exports[_0x2cf1('0x44')]=function(_0x131df0,_0x10ef5d){return db['User'][_0x2cf1('0x21')]({'where':{'resetPasswordToken':_0x131df0[_0x2cf1('0x45')]['token'],'resetPasswordExpires':{'$gt':Date[_0x2cf1('0x3b')]()}}})[_0x2cf1('0xc')](function(_0x10731e){if(!_0x10731e){throw new Error('Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.');}return db[_0x2cf1('0xb')][_0x2cf1('0xd')]({'attributes':['id',_0x2cf1('0x46'),_0x2cf1('0x47'),_0x2cf1('0x48')]})['then'](function(_0x4a3e5f){if(_0x4a3e5f[_0x2cf1('0x46')])authService[_0x2cf1('0x49')](_0x131df0[_0x2cf1('0x34')][_0x2cf1('0x4a')]);if(!_0x4a3e5f[_0x2cf1('0x47')]||!_0x10731e[_0x2cf1('0x4b')])return _0x10731e;authService[_0x2cf1('0x4c')](_0x131df0[_0x2cf1('0x34')][_0x2cf1('0x4a')],_0x10731e[_0x2cf1('0x4b')],_0x4a3e5f[_0x2cf1('0x48')]);return _0x10731e;})['then'](function(){_0x10731e[_0x2cf1('0x4a')]=_0x131df0[_0x2cf1('0x34')][_0x2cf1('0x4a')];_0x10731e[_0x2cf1('0x4d')]=null;_0x10731e[_0x2cf1('0x3a')]=null;return _0x10731e[_0x2cf1('0x3c')]();});})['then'](function(){_0x10ef5d['status'](0xc8)[_0x2cf1('0x2e')]({'message':_0x2cf1('0x4e')});})[_0x2cf1('0x1f')](function(_0x535a12){return handleError(_0x10ef5d,0x1f4,_0x535a12);});};passport['use'](_0x2cf1('0x30'),new LocalStrategy({'usernameField':_0x2cf1('0xe'),'passwordField':_0x2cf1('0x4a')},function(_0x4cb05b,_0x2489a5,_0x14bf2c){return localAuthenticate(db[_0x2cf1('0x4f')],_0x4cb05b,_0x2489a5,_0x14bf2c);})); \ No newline at end of file +var _0x596e=['role','blocked','blockedAt','loginAttempts','admin','user','agent','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','clearBlockUser','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','add','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','previousPasswords','validatePasswordHistory','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','name','password','salt'];(function(_0x6962d3,_0x5d097e){var _0x2b98cd=function(_0x51b9f0){while(--_0x51b9f0){_0x6962d3['push'](_0x6962d3['shift']());}};_0x2b98cd(++_0x5d097e);}(_0x596e,0x96));var _0xe596=function(_0x5b4d96,_0x4b1c4c){_0x5b4d96=_0x5b4d96-0x0;var _0x1ffe2c=_0x596e[_0x5b4d96];return _0x1ffe2c;};'use strict';var util=require(_0xe596('0x0'));var passport=require('passport');var LocalStrategy=require(_0xe596('0x1'))[_0xe596('0x2')];var jayson=require(_0xe596('0x3'));var _=require(_0xe596('0x4'));var rs=require(_0xe596('0x5'));var moment=require(_0xe596('0x6'));var db=require(_0xe596('0x7'))['db'];var authService=require(_0xe596('0x8'));var utils=require(_0xe596('0x9'));var client=jayson[_0xe596('0xa')][_0xe596('0xb')]({'port':0x232b});function localAuthenticate(_0x5bfb5e,_0x26e2cb,_0x397189,_0x56edb9){var _0x28477c,_0x3e19dc;return db[_0xe596('0xc')][_0xe596('0xd')]({'where':{'id':0x1},'attributes':[_0xe596('0xe'),'blockDuration'],'raw':!![]})['then'](function(_0x164251){_0x28477c=_0x164251;return _0x5bfb5e[_0xe596('0xd')]({'attributes':['id',_0xe596('0xf'),_0xe596('0x10'),_0xe596('0x11'),_0xe596('0x12'),'disabled',_0xe596('0x13'),_0xe596('0x14'),_0xe596('0x15')],'where':{'name':_0x26e2cb,'role':{'$or':[_0xe596('0x16'),_0xe596('0x17'),_0xe596('0x18')]}}});})[_0xe596('0x19')](function(_0x23f1bb){if(!_0x23f1bb||_0x23f1bb&&_0x23f1bb['name']!==_0x26e2cb){throw new Error(_0xe596('0x1a'));}else{_0x3e19dc=_0x23f1bb;return _0x3e19dc;}})[_0xe596('0x19')](function(){_0x3e19dc[_0xe596('0x1b')](_0x397189,function(_0x488d5c,_0xe6dd68){var _0xfecb18=_0x3e19dc[_0xe596('0x15')]+0x1;if(_0x488d5c){return _0x56edb9(_0x488d5c);}else if(!_0xe6dd68){if(_0x3e19dc[_0xe596('0x1c')]){return _0x56edb9(null,![],{'message':_0xe596('0x1a')});}else if(_0x28477c[_0xe596('0xe')]>0x0){if(_0x3e19dc[_0xe596('0x13')]){if(_0x28477c[_0xe596('0x1d')]>0x0){if(moment(_0x3e19dc['blockedAt'])['add'](_0x28477c[_0xe596('0x1d')],'minutes')>moment()){return _0x56edb9(null,![],{'message':_0xe596('0x1a')});}else{return utils[_0xe596('0x1e')](_0x3e19dc,_0xfecb18,![],null)[_0xe596('0x19')](function(){return _0x56edb9(null,![],{'message':_0xe596('0x1a')});});}}else{return _0x56edb9(null,![],{'message':_0xe596('0x1a')});}}else{if(_0xfecb18>=_0x28477c[_0xe596('0xe')]){return utils[_0xe596('0x1e')](_0x3e19dc,0x0,!![],moment())[_0xe596('0x19')](function(){return _0x56edb9(null,![],{'message':_0xe596('0x1a')});});}else{return utils[_0xe596('0x1e')](_0x3e19dc,_0xfecb18,![],null)[_0xe596('0x19')](function(){return _0x56edb9(null,![],{'message':_0xe596('0x1a')});});}}}else{return _0x56edb9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x3e19dc[_0xe596('0x1c')]){return _0x56edb9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x28477c[_0xe596('0xe')]>0x0){if(_0x3e19dc['blocked']){if(_0x28477c[_0xe596('0x1d')]>0x0){if(moment(_0x3e19dc['blockedAt'])['add'](_0x28477c[_0xe596('0x1d')],'minutes')>moment()){return _0x56edb9(null,![],{'message':_0xe596('0x1a')});}else{return utils[_0xe596('0x1e')](_0x3e19dc,0x0,![],null)[_0xe596('0x19')](function(){return utils[_0xe596('0x1f')](_0x3e19dc);})[_0xe596('0x19')](function(){return _0x56edb9(null,_0x3e19dc);});}}else{return _0x56edb9(null,![],{'message':_0xe596('0x1a')});}}else{return utils[_0xe596('0x1e')](_0x3e19dc,0x0,![],null)[_0xe596('0x19')](function(){return utils[_0xe596('0x1f')](_0x3e19dc);})[_0xe596('0x19')](function(){return _0x56edb9(null,_0x3e19dc);})[_0xe596('0x20')](function(_0x4496a4){return _0x56edb9(null,![],_0x4496a4);});}}else{if(_0x3e19dc[_0xe596('0x13')]){return _0x56edb9(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe596('0x1f')](_0x3e19dc)[_0xe596('0x19')](function(){return _0x56edb9(null,_0x3e19dc);});}}}});})[_0xe596('0x20')](function(_0x5d03c1){return _0x56edb9(null,![],_0x5d03c1);});}function sendServiceMail(_0xbac0bf){return db[_0xe596('0x21')][_0xe596('0x22')]({'where':{'service':!![]},'attributes':['id',_0xe596('0xf'),_0xe596('0x23')],'include':[{'model':db[_0xe596('0x24')],'as':_0xe596('0x25'),'include':[{'model':db[_0xe596('0x26')],'as':_0xe596('0x26')}]}]})[_0xe596('0x19')](function(_0x58a9a2){if(!_0x58a9a2){throw new Error(_0xe596('0x27'));}var _0x4507f8=_0x58a9a2['getSmtpOptions']();var _0x3f6bcf={'account':_0x4507f8,'message':_[_0xe596('0x28')]({'from':util[_0xe596('0x29')](_0xe596('0x2a'),_0x58a9a2['name'],_0x58a9a2[_0xe596('0x23')]||_0x58a9a2[_0xe596('0x25')][_0xe596('0x17')])},_0xbac0bf)};return client[_0xe596('0x2b')](_0xe596('0x2c'),_0x3f6bcf);})[_0xe596('0x19')](function(_0x14c118){if(_0x14c118[_0xe596('0x2d')]){throw new Error(util['format'](_0xe596('0x2e'),_0x14c118[_0xe596('0x2d')][_0xe596('0x2f')]||JSON[_0xe596('0x30')](_0x14c118[_0xe596('0x2d')])));}return!![];});}function handleError(_0x30fcdd,_0x4247b2,_0x3b09f0){return _0x30fcdd[_0xe596('0x31')](_0x4247b2||0x1f4)[_0xe596('0x32')]({'message':_0x3b09f0?_0x3b09f0[_0xe596('0x2f')]||_0x3b09f0:''});}exports[_0xe596('0x33')]=function(_0x3d66bb,_0x21f5b4,_0x1b5385){passport[_0xe596('0x1b')](_0xe596('0x34'),function(_0xa07eec,_0x3c77be,_0x260135){var _0x2314ef=_0xa07eec||_0x260135;if(_0x2314ef){return handleError(_0x21f5b4,0x191,_0x2314ef);}if(!_0x3c77be){return handleError(_0x21f5b4,0x194,{'message':_0xe596('0x35')});}else{var _0x3c451c={'payload':{'id':_0x3c77be['id'],'role':_0x3c77be[_0xe596('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0xe596('0x36')](_0x3c451c)[_0xe596('0x19')](function(_0x23dd17){_0x21f5b4[_0xe596('0x37')]({'id':_0x3c77be['id'],'token':_0x23dd17,'statusCall':'','isAlreadyLogged':_0x3c77be[_0xe596('0x38')]});});}})(_0x3d66bb,_0x21f5b4,_0x1b5385);};exports[_0xe596('0x39')]=function(_0x2036d4,_0xfaa067){if(!_0x2036d4[_0xe596('0x3a')][_0xe596('0x23')]){return handleError(_0xfaa067,0x1f4,{'message':_0xe596('0x3b')});}var _0x2c5f41=rs[_0xe596('0x3c')]();_0x2036d4['body'][_0xe596('0x23')]=_0x2036d4['body'][_0xe596('0x23')]['trim']()['toLowerCase']();var _0x5aaf9f;return db[_0xe596('0xc')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe596('0x1d')],'raw':!![]})[_0xe596('0x19')](function(_0x486a55){_0x5aaf9f=_0x486a55;return db[_0xe596('0x3d')][_0xe596('0x22')]({'where':{'email':_0x2036d4[_0xe596('0x3a')]['email']}});})[_0xe596('0x19')](function(_0x514894){if(!_0x514894){throw new Error(_0xe596('0x3e'));}if(_0x514894[_0xe596('0x1c')]){throw new Error(_0xe596('0x3f'));}if(_0x514894[_0xe596('0x13')]){if(moment(_0x514894[_0xe596('0x14')])[_0xe596('0x40')](_0x5aaf9f[_0xe596('0x1d')],_0xe596('0x41'))>moment()){throw new Error(_0xe596('0x42'));}else{_0x514894['blocked']=![];_0x514894[_0xe596('0x14')]=null;}}_0x514894[_0xe596('0x43')]=_0x2c5f41;_0x514894[_0xe596('0x44')]=Date[_0xe596('0x45')]()+0x36ee80;return _0x514894[_0xe596('0x46')]();})['then'](function(){return sendServiceMail({'to':_0x2036d4[_0xe596('0x3a')][_0xe596('0x23')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0xe596('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x2036d4[_0xe596('0x48')][_0xe596('0x49')]+_0xe596('0x4a')+_0x2c5f41+'\x0a\x0a'+_0xe596('0x4b')});})[_0xe596('0x19')](function(){_0xfaa067['status'](0xc8)[_0xe596('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0xe596('0x20')](function(_0x3f8bd1){return handleError(_0xfaa067,0x1f4,_0x3f8bd1);});};exports['reset']=function(_0x442b63,_0x11d742){return db[_0xe596('0x3d')][_0xe596('0x22')]({'where':{'resetPasswordToken':_0x442b63['params']['token'],'resetPasswordExpires':{'$gt':Date[_0xe596('0x45')]()}}})[_0xe596('0x19')](function(_0x579cff){if(!_0x579cff){throw new Error(_0xe596('0x4c'));}return db['Setting'][_0xe596('0xd')]({'attributes':['id',_0xe596('0x4d'),'enforcePasswordHistory',_0xe596('0x4e')]})[_0xe596('0x19')](function(_0x377466){if(_0x377466[_0xe596('0x4d')])authService[_0xe596('0x4f')](_0x442b63[_0xe596('0x3a')]['password']);if(!_0x377466[_0xe596('0x50')]||!_0x579cff[_0xe596('0x51')])return _0x579cff;authService[_0xe596('0x52')](_0x442b63[_0xe596('0x3a')]['password'],_0x579cff['previousPasswords'],_0x377466['passwordHistoryLimit']);return _0x579cff;})[_0xe596('0x19')](function(){_0x579cff[_0xe596('0x10')]=_0x442b63[_0xe596('0x3a')][_0xe596('0x10')];_0x579cff[_0xe596('0x43')]=null;_0x579cff[_0xe596('0x44')]=null;return _0x579cff['save']();});})[_0xe596('0x19')](function(){_0x11d742['status'](0xc8)['send']({'message':'Password\x20reset!'});})[_0xe596('0x20')](function(_0x462ac0){return handleError(_0x11d742,0x1f4,_0x462ac0);});};passport[_0xe596('0x53')](_0xe596('0x34'),new LocalStrategy({'usernameField':'name','passwordField':_0xe596('0x10')},function(_0x535f3c,_0x31874d,_0x41ef9a){return localAuthenticate(db[_0xe596('0x3d')],_0x535f3c,_0x31874d,_0x41ef9a);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e107033..ac39fab 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 _0x4062=['exports','Router','./authLocal.controller','post','login','/forgot','forgot','/reset/:token','reset'];(function(_0x198bd7,_0x26c4a4){var _0x16b8fe=function(_0xaf0ef4){while(--_0xaf0ef4){_0x198bd7['push'](_0x198bd7['shift']());}};_0x16b8fe(++_0x26c4a4);}(_0x4062,0xb5));var _0x2406=function(_0x32b259,_0x239e98){_0x32b259=_0x32b259-0x0;var _0x3180f7=_0x4062[_0x32b259];return _0x3180f7;};'use strict';var express=require('express');var router=express[_0x2406('0x0')]();var controller=require(_0x2406('0x1'));router[_0x2406('0x2')]('/',controller[_0x2406('0x3')]);router[_0x2406('0x2')](_0x2406('0x4'),controller[_0x2406('0x5')]);router[_0x2406('0x2')](_0x2406('0x6'),controller[_0x2406('0x7')]);module[_0x2406('0x8')]=router; \ No newline at end of file +var _0x56ab=['reset','exports','./authLocal.controller','post','/forgot','forgot','/reset/:token'];(function(_0xea4c5a,_0x41bc96){var _0x211bf3=function(_0x3e87a0){while(--_0x3e87a0){_0xea4c5a['push'](_0xea4c5a['shift']());}};_0x211bf3(++_0x41bc96);}(_0x56ab,0x167));var _0xb56a=function(_0x202b5f,_0x23bae1){_0x202b5f=_0x202b5f-0x0;var _0x306bbf=_0x56ab[_0x202b5f];return _0x306bbf;};'use strict';var express=require('express');var router=express['Router']();var controller=require(_0xb56a('0x0'));router[_0xb56a('0x1')]('/',controller['login']);router[_0xb56a('0x1')](_0xb56a('0x2'),controller[_0xb56a('0x3')]);router[_0xb56a('0x1')](_0xb56a('0x4'),controller[_0xb56a('0x5')]);module[_0xb56a('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4c1c7dd..9539ca2 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 _0x8fe6=['INTEGER','sequelize','exports','STRING','BOOLEAN'];(function(_0x4c1af6,_0x3c9659){var _0x4ca15f=function(_0x5ea790){while(--_0x5ea790){_0x4c1af6['push'](_0x4c1af6['shift']());}};_0x4ca15f(++_0x3c9659);}(_0x8fe6,0x79));var _0x68fe=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x8fe6[_0x39772f];return _0xc9edbf;};'use strict';var Sequelize=require(_0x68fe('0x0'));module[_0x68fe('0x1')]={'name':{'type':Sequelize[_0x68fe('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x68fe('0x2')]},'description':{'type':Sequelize[_0x68fe('0x2')]},'status':{'type':Sequelize[_0x68fe('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x68fe('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x368f=['STRING','BOOLEAN','exports'];(function(_0x5ee18a,_0x80ca71){var _0x3c79b2=function(_0x44b1f9){while(--_0x44b1f9){_0x5ee18a['push'](_0x5ee18a['shift']());}};_0x3c79b2(++_0x80ca71);}(_0x368f,0x9e));var _0xf368=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x368f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf368('0x0')]={'name':{'type':Sequelize[_0xf368('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xf368('0x1')]},'description':{'type':Sequelize[_0xf368('0x1')]},'status':{'type':Sequelize[_0xf368('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 353f2f2..a79c3de 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 _0x7fd5=['end','limit','count','offset','set','Content-Range','json','reject','update','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','keys','query','filters','model','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','Automation','includeAll','include','findAll','rows','show','intersection','options','catch','create','body','find','params','addConditions','Condition','omit','findOne','order','getConditions','hasOwnProperty','nolimit','addActions','Action','ids','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x3dcb6f,_0x1400fd){var _0x4ff635=function(_0xdf2ed){while(--_0xdf2ed){_0x3dcb6f['push'](_0x3dcb6f['shift']());}};_0x4ff635(++_0x1400fd);}(_0x7fd5,0x1de));var _0x57fd=function(_0x34eabc,_0x51d411){_0x34eabc=_0x34eabc-0x0;var _0x43e72f=_0x7fd5[_0x34eabc];return _0x43e72f;};'use strict';var emlformat=require(_0x57fd('0x0'));var rimraf=require(_0x57fd('0x1'));var zipdir=require(_0x57fd('0x2'));var jsonpatch=require(_0x57fd('0x3'));var rp=require(_0x57fd('0x4'));var moment=require(_0x57fd('0x5'));var BPromise=require(_0x57fd('0x6'));var Mustache=require(_0x57fd('0x7'));var util=require('util');var path=require(_0x57fd('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x57fd('0x9'));var fs=require('fs');var fs_extra=require(_0x57fd('0xa'));var _=require(_0x57fd('0xb'));var squel=require(_0x57fd('0xc'));var crypto=require(_0x57fd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x57fd('0xe'));var Papa=require(_0x57fd('0xf'));var Redis=require(_0x57fd('0x10'));var authService=require(_0x57fd('0x11'));var qs=require(_0x57fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x57fd('0x13'))(_0x57fd('0x14'));var utils=require(_0x57fd('0x15'));var config=require(_0x57fd('0x16'));var licenseUtil=require(_0x57fd('0x17'));var db=require(_0x57fd('0x18'))['db'];function respondWithStatusCode(_0x933311,_0x4bcf76){_0x4bcf76=_0x4bcf76||0xcc;return function(_0xf90776){if(_0xf90776){return _0x933311['sendStatus'](_0x4bcf76);}return _0x933311[_0x57fd('0x19')](_0x4bcf76)[_0x57fd('0x1a')]();};}function respondWithResult(_0x26c5d8,_0x304f5e){_0x304f5e=_0x304f5e||0xc8;return function(_0x4f2598){if(_0x4f2598){return _0x26c5d8[_0x57fd('0x19')](_0x304f5e)['json'](_0x4f2598);}};}function respondWithFilteredResult(_0x58a42d,_0x8bc81){return function(_0x346496){if(_0x346496){var _0x2c30be=typeof _0x8bc81['offset']==='undefined'&&typeof _0x8bc81[_0x57fd('0x1b')]==='undefined';var _0x4c8f43=_0x346496[_0x57fd('0x1c')];var _0x4faf8f=_0x2c30be?0x0:_0x8bc81[_0x57fd('0x1d')];var _0x1772f7=_0x2c30be?_0x346496[_0x57fd('0x1c')]:_0x8bc81[_0x57fd('0x1d')]+_0x8bc81[_0x57fd('0x1b')];var _0x2e980c;if(_0x1772f7>=_0x4c8f43){_0x1772f7=_0x4c8f43;_0x2e980c=0xc8;}else{_0x2e980c=0xce;}_0x58a42d[_0x57fd('0x19')](_0x2e980c);return _0x58a42d[_0x57fd('0x1e')](_0x57fd('0x1f'),_0x4faf8f+'-'+_0x1772f7+'/'+_0x4c8f43)[_0x57fd('0x20')](_0x346496);}return null;};}function patchUpdates(_0x258bba){return function(_0x43f6af){try{jsonpatch['apply'](_0x43f6af,_0x258bba,!![]);}catch(_0xcea535){return BPromise[_0x57fd('0x21')](_0xcea535);}return _0x43f6af['save']();};}function saveUpdates(_0x44d1d9,_0x5a0184){return function(_0x2015df){if(_0x2015df){return _0x2015df[_0x57fd('0x22')](_0x44d1d9)[_0x57fd('0x23')](function(_0x309d58){return _0x309d58;});}return null;};}function removeEntity(_0x215ccf,_0x13ca60){return function(_0x43df46){if(_0x43df46){return _0x43df46[_0x57fd('0x24')]()[_0x57fd('0x23')](function(){_0x215ccf[_0x57fd('0x19')](0xcc)[_0x57fd('0x1a')]();});}};}function handleEntityNotFound(_0x4447ab,_0xda44b7){return function(_0x53eebf){if(!_0x53eebf){_0x4447ab[_0x57fd('0x25')](0x194);}return _0x53eebf;};}function handleError(_0x358ca4,_0x44af2d){_0x44af2d=_0x44af2d||0x1f4;return function(_0x2d2606){logger[_0x57fd('0x26')](_0x2d2606['stack']);if(_0x2d2606[_0x57fd('0x27')]){delete _0x2d2606[_0x57fd('0x27')];}_0x358ca4[_0x57fd('0x19')](_0x44af2d)['send'](_0x2d2606);};}exports[_0x57fd('0x28')]=function(_0xa3d603,_0x207760){var _0x4935be={},_0x177a3e={},_0x57b40d={'count':0x0,'rows':[]};var _0x16522c=_[_0x57fd('0x29')](db['Automation'][_0x57fd('0x2a')],function(_0x3742e4){return{'name':_0x3742e4[_0x57fd('0x2b')],'type':_0x3742e4[_0x57fd('0x2c')][_0x57fd('0x2d')]};});_0x177a3e['model']=_[_0x57fd('0x29')](_0x16522c,_0x57fd('0x27'));_0x177a3e['query']=_[_0x57fd('0x2e')](_0xa3d603[_0x57fd('0x2f')]);_0x177a3e[_0x57fd('0x30')]=_['intersection'](_0x177a3e[_0x57fd('0x31')],_0x177a3e['query']);_0x4935be['attributes']=_['intersection'](_0x177a3e[_0x57fd('0x31')],qs[_0x57fd('0x32')](_0xa3d603['query'][_0x57fd('0x32')]));_0x4935be['attributes']=_0x4935be[_0x57fd('0x33')][_0x57fd('0x34')]?_0x4935be['attributes']:_0x177a3e[_0x57fd('0x31')];if(!_0xa3d603[_0x57fd('0x2f')]['hasOwnProperty']('nolimit')){_0x4935be['limit']=qs[_0x57fd('0x1b')](_0xa3d603[_0x57fd('0x2f')][_0x57fd('0x1b')]);_0x4935be[_0x57fd('0x1d')]=qs['offset'](_0xa3d603[_0x57fd('0x2f')]['offset']);}_0x4935be['order']=qs['sort'](_0xa3d603['query'][_0x57fd('0x35')]);_0x4935be[_0x57fd('0x36')]=qs[_0x57fd('0x30')](_[_0x57fd('0x37')](_0xa3d603[_0x57fd('0x2f')],_0x177a3e[_0x57fd('0x30')]),_0x16522c);if(_0xa3d603['query'][_0x57fd('0x38')]){_0x4935be[_0x57fd('0x36')]=_[_0x57fd('0x39')](_0x4935be['where'],{'$or':_[_0x57fd('0x29')](_0x16522c,function(_0x7b3a53){if(_0x7b3a53[_0x57fd('0x2c')]!==_0x57fd('0x3a')){var _0x2716a7={};_0x2716a7[_0x7b3a53[_0x57fd('0x27')]]={'$like':'%'+_0xa3d603[_0x57fd('0x2f')]['filter']+'%'};return _0x2716a7;}})});}_0x4935be=_[_0x57fd('0x39')]({},_0x4935be,_0xa3d603['options']);var _0x567e78={'where':_0x4935be[_0x57fd('0x36')]};return db[_0x57fd('0x3b')]['count'](_0x567e78)[_0x57fd('0x23')](function(_0x4ceee2){_0x57b40d[_0x57fd('0x1c')]=_0x4ceee2;if(_0xa3d603['query'][_0x57fd('0x3c')]){_0x4935be[_0x57fd('0x3d')]=[{'all':!![]}];}return db[_0x57fd('0x3b')][_0x57fd('0x3e')](_0x4935be);})['then'](function(_0x42f0a3){_0x57b40d[_0x57fd('0x3f')]=_0x42f0a3;return _0x57b40d;})[_0x57fd('0x23')](respondWithFilteredResult(_0x207760,_0x4935be))['catch'](handleError(_0x207760,null));};exports[_0x57fd('0x40')]=function(_0x5730f9,_0xf988a4){var _0x27a0f3={'raw':![],'where':{'id':_0x5730f9['params']['id']}},_0x1436f7={};_0x1436f7['model']=_[_0x57fd('0x2e')](db['Automation']['rawAttributes']);_0x1436f7[_0x57fd('0x2f')]=_[_0x57fd('0x2e')](_0x5730f9[_0x57fd('0x2f')]);_0x1436f7[_0x57fd('0x30')]=_[_0x57fd('0x41')](_0x1436f7[_0x57fd('0x31')],_0x1436f7[_0x57fd('0x2f')]);_0x27a0f3[_0x57fd('0x33')]=_[_0x57fd('0x41')](_0x1436f7[_0x57fd('0x31')],qs[_0x57fd('0x32')](_0x5730f9[_0x57fd('0x2f')][_0x57fd('0x32')]));_0x27a0f3[_0x57fd('0x33')]=_0x27a0f3[_0x57fd('0x33')][_0x57fd('0x34')]?_0x27a0f3[_0x57fd('0x33')]:_0x1436f7[_0x57fd('0x31')];if(_0x5730f9[_0x57fd('0x2f')][_0x57fd('0x3c')]){_0x27a0f3[_0x57fd('0x3d')]=[{'all':!![]}];}_0x27a0f3=_[_0x57fd('0x39')]({},_0x27a0f3,_0x5730f9[_0x57fd('0x42')]);return db[_0x57fd('0x3b')]['find'](_0x27a0f3)['then'](handleEntityNotFound(_0xf988a4,null))[_0x57fd('0x23')](respondWithResult(_0xf988a4,null))[_0x57fd('0x43')](handleError(_0xf988a4,null));};exports[_0x57fd('0x44')]=function(_0xb701c7,_0x18d800){return db['Automation'][_0x57fd('0x44')](_0xb701c7[_0x57fd('0x45')],{})[_0x57fd('0x23')](respondWithResult(_0x18d800,0xc9))[_0x57fd('0x43')](handleError(_0x18d800,null));};exports['update']=function(_0x33d5bd,_0x1d9d99){if(_0x33d5bd[_0x57fd('0x45')]['id']){delete _0x33d5bd['body']['id'];}return db[_0x57fd('0x3b')][_0x57fd('0x46')]({'where':{'id':_0x33d5bd[_0x57fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d9d99,null))[_0x57fd('0x23')](saveUpdates(_0x33d5bd[_0x57fd('0x45')],null))[_0x57fd('0x23')](respondWithResult(_0x1d9d99,null))[_0x57fd('0x43')](handleError(_0x1d9d99,null));};exports[_0x57fd('0x24')]=function(_0x4d8478,_0x57ab14){return db[_0x57fd('0x3b')][_0x57fd('0x46')]({'where':{'id':_0x4d8478['params']['id']}})[_0x57fd('0x23')](handleEntityNotFound(_0x57ab14,null))['then'](removeEntity(_0x57ab14,null))[_0x57fd('0x43')](handleError(_0x57ab14,null));};exports[_0x57fd('0x48')]=function(_0x233ff6,_0x1a3345,_0x1c9f7d){return db[_0x57fd('0x49')]['find']({'where':{'id':_0x233ff6[_0x57fd('0x47')]['id']}})[_0x57fd('0x23')](handleEntityNotFound(_0x1a3345,null))['then'](function(_0x4a7b63){if(_0x4a7b63){return _0x4a7b63['addConditions'](_0x233ff6[_0x57fd('0x45')]['ids'],_[_0x57fd('0x4a')](_0x233ff6[_0x57fd('0x45')],['ids','id'])||{});}})[_0x57fd('0x23')](respondWithResult(_0x1a3345,null))['catch'](handleError(_0x1a3345,null));};exports['getConditions']=function(_0x153daa,_0x1e5c52,_0x5d15d8){var _0x3ee8e7={};var _0xee54a7={};var _0x13551b;var _0x3814de;return db['Automation'][_0x57fd('0x4b')]({'where':{'id':_0x153daa['params']['id']}})[_0x57fd('0x23')](handleEntityNotFound(_0x1e5c52,null))['then'](function(_0x4b487d){if(_0x4b487d){_0x13551b=_0x4b487d;_0xee54a7['model']=_[_0x57fd('0x2e')](db[_0x57fd('0x49')][_0x57fd('0x2a')]);_0xee54a7[_0x57fd('0x2f')]=_['keys'](_0x153daa[_0x57fd('0x2f')]);_0xee54a7[_0x57fd('0x30')]=_[_0x57fd('0x41')](_0xee54a7['model'],_0xee54a7['query']);_0x3ee8e7[_0x57fd('0x33')]=_[_0x57fd('0x41')](_0xee54a7[_0x57fd('0x31')],qs[_0x57fd('0x32')](_0x153daa[_0x57fd('0x2f')]['fields']));_0x3ee8e7[_0x57fd('0x33')]=_0x3ee8e7['attributes'][_0x57fd('0x34')]?_0x3ee8e7[_0x57fd('0x33')]:_0xee54a7['model'];_0x3ee8e7[_0x57fd('0x4c')]=qs['sort'](_0x153daa[_0x57fd('0x2f')][_0x57fd('0x35')]);_0x3ee8e7['where']=qs[_0x57fd('0x30')](_['pick'](_0x153daa[_0x57fd('0x2f')],_0xee54a7['filters']));if(_0x153daa['query'][_0x57fd('0x38')]){_0x3ee8e7[_0x57fd('0x36')]=_[_0x57fd('0x39')](_0x3ee8e7['where'],{'$or':_[_0x57fd('0x29')](_0x3ee8e7[_0x57fd('0x33')],function(_0x11cc9e){var _0x2dbe27={};_0x2dbe27[_0x11cc9e]={'$like':'%'+_0x153daa['query'][_0x57fd('0x38')]+'%'};return _0x2dbe27;})});}_0x3ee8e7=_['merge']({},_0x3ee8e7,_0x153daa['options']);return _0x13551b[_0x57fd('0x4d')](_0x3ee8e7);}})[_0x57fd('0x23')](function(_0x1c542f){if(_0x1c542f){_0x3814de=_0x1c542f[_0x57fd('0x34')];if(!_0x153daa[_0x57fd('0x2f')][_0x57fd('0x4e')](_0x57fd('0x4f'))){_0x3ee8e7[_0x57fd('0x1b')]=qs[_0x57fd('0x1b')](_0x153daa['query'][_0x57fd('0x1b')]);_0x3ee8e7[_0x57fd('0x1d')]=qs[_0x57fd('0x1d')](_0x153daa[_0x57fd('0x2f')][_0x57fd('0x1d')]);}return _0x13551b['getConditions'](_0x3ee8e7);}})['then'](function(_0x808f6){if(_0x808f6){return _0x808f6?{'count':_0x3814de,'rows':_0x808f6}:null;}})[_0x57fd('0x23')](respondWithResult(_0x1e5c52,null))[_0x57fd('0x43')](handleError(_0x1e5c52,null));};exports[_0x57fd('0x50')]=function(_0x442cb8,_0x54af58,_0x1ae7cf){return db[_0x57fd('0x51')]['find']({'where':{'id':_0x442cb8[_0x57fd('0x47')]['id']}})['then'](handleEntityNotFound(_0x54af58,null))[_0x57fd('0x23')](function(_0x23969c){if(_0x23969c){return _0x23969c[_0x57fd('0x50')](_0x442cb8['body']['ids'],_[_0x57fd('0x4a')](_0x442cb8['body'],[_0x57fd('0x52'),'id'])||{});}})[_0x57fd('0x23')](respondWithResult(_0x54af58,null))['catch'](handleError(_0x54af58,null));};exports[_0x57fd('0x53')]=function(_0x2d7695,_0xca09db,_0x4ed02a){var _0x253a45={};var _0x1574d2={};var _0x42db95;var _0x2ea43c;return db[_0x57fd('0x3b')][_0x57fd('0x4b')]({'where':{'id':_0x2d7695[_0x57fd('0x47')]['id']}})[_0x57fd('0x23')](handleEntityNotFound(_0xca09db,null))[_0x57fd('0x23')](function(_0x2645c2){if(_0x2645c2){_0x42db95=_0x2645c2;_0x1574d2[_0x57fd('0x31')]=_[_0x57fd('0x2e')](db[_0x57fd('0x51')]['rawAttributes']);_0x1574d2[_0x57fd('0x2f')]=_[_0x57fd('0x2e')](_0x2d7695[_0x57fd('0x2f')]);_0x1574d2[_0x57fd('0x30')]=_[_0x57fd('0x41')](_0x1574d2[_0x57fd('0x31')],_0x1574d2[_0x57fd('0x2f')]);_0x253a45['attributes']=_['intersection'](_0x1574d2['model'],qs[_0x57fd('0x32')](_0x2d7695[_0x57fd('0x2f')][_0x57fd('0x32')]));_0x253a45[_0x57fd('0x33')]=_0x253a45[_0x57fd('0x33')][_0x57fd('0x34')]?_0x253a45[_0x57fd('0x33')]:_0x1574d2[_0x57fd('0x31')];_0x253a45['order']=qs[_0x57fd('0x35')](_0x2d7695[_0x57fd('0x2f')]['sort']);_0x253a45[_0x57fd('0x36')]=qs[_0x57fd('0x30')](_[_0x57fd('0x37')](_0x2d7695['query'],_0x1574d2[_0x57fd('0x30')]));if(_0x2d7695['query'][_0x57fd('0x38')]){_0x253a45['where']=_[_0x57fd('0x39')](_0x253a45[_0x57fd('0x36')],{'$or':_[_0x57fd('0x29')](_0x253a45[_0x57fd('0x33')],function(_0x52bd69){var _0x3e9617={};_0x3e9617[_0x52bd69]={'$like':'%'+_0x2d7695[_0x57fd('0x2f')][_0x57fd('0x38')]+'%'};return _0x3e9617;})});}_0x253a45=_[_0x57fd('0x39')]({},_0x253a45,_0x2d7695[_0x57fd('0x42')]);return _0x42db95[_0x57fd('0x53')](_0x253a45);}})['then'](function(_0x560ab1){if(_0x560ab1){_0x2ea43c=_0x560ab1[_0x57fd('0x34')];if(!_0x2d7695[_0x57fd('0x2f')][_0x57fd('0x4e')](_0x57fd('0x4f'))){_0x253a45[_0x57fd('0x1b')]=qs[_0x57fd('0x1b')](_0x2d7695[_0x57fd('0x2f')][_0x57fd('0x1b')]);_0x253a45[_0x57fd('0x1d')]=qs[_0x57fd('0x1d')](_0x2d7695['query'][_0x57fd('0x1d')]);}return _0x42db95[_0x57fd('0x53')](_0x253a45);}})[_0x57fd('0x23')](function(_0x2da51a){if(_0x2da51a){return _0x2da51a?{'count':_0x2ea43c,'rows':_0x2da51a}:null;}})[_0x57fd('0x23')](respondWithResult(_0xca09db,null))['catch'](handleError(_0xca09db,null));}; \ No newline at end of file +var _0xa973=['send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','params','catch','create','body','find','destroy','addConditions','Condition','ids','omit','findOne','getConditions','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','error','name'];(function(_0x3bafd6,_0x5967eb){var _0x4f6c80=function(_0x41ccd3){while(--_0x41ccd3){_0x3bafd6['push'](_0x3bafd6['shift']());}};_0x4f6c80(++_0x5967eb);}(_0xa973,0x7e));var _0x3a97=function(_0x46f6c6,_0x5f337d){_0x46f6c6=_0x46f6c6-0x0;var _0x462bb8=_0xa973[_0x46f6c6];return _0x462bb8;};'use strict';var emlformat=require(_0x3a97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3a97('0x1'));var jsonpatch=require(_0x3a97('0x2'));var rp=require('request-promise');var moment=require(_0x3a97('0x3'));var BPromise=require(_0x3a97('0x4'));var Mustache=require(_0x3a97('0x5'));var util=require(_0x3a97('0x6'));var path=require('path');var sox=require(_0x3a97('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a97('0x8'));var _=require(_0x3a97('0x9'));var squel=require('squel');var crypto=require(_0x3a97('0xa'));var jsforce=require(_0x3a97('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3a97('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3a97('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3a97('0xe'));var as=require(_0x3a97('0xf'));var hardwareService=require(_0x3a97('0x10'));var logger=require('../../config/logger')(_0x3a97('0x11'));var utils=require(_0x3a97('0x12'));var config=require(_0x3a97('0x13'));var licenseUtil=require(_0x3a97('0x14'));var db=require(_0x3a97('0x15'))['db'];function respondWithStatusCode(_0x2053d2,_0x36fc4d){_0x36fc4d=_0x36fc4d||0xcc;return function(_0x578436){if(_0x578436){return _0x2053d2[_0x3a97('0x16')](_0x36fc4d);}return _0x2053d2['status'](_0x36fc4d)[_0x3a97('0x17')]();};}function respondWithResult(_0x2f50d4,_0x6b9731){_0x6b9731=_0x6b9731||0xc8;return function(_0x2458aa){if(_0x2458aa){return _0x2f50d4[_0x3a97('0x18')](_0x6b9731)['json'](_0x2458aa);}};}function respondWithFilteredResult(_0x5c40d7,_0xe572e3){return function(_0x3cddf0){if(_0x3cddf0){var _0x5e39f3=typeof _0xe572e3[_0x3a97('0x19')]===_0x3a97('0x1a')&&typeof _0xe572e3[_0x3a97('0x1b')]===_0x3a97('0x1a');var _0x496cef=_0x3cddf0[_0x3a97('0x1c')];var _0x19f745=_0x5e39f3?0x0:_0xe572e3[_0x3a97('0x19')];var _0x4e4303=_0x5e39f3?_0x3cddf0[_0x3a97('0x1c')]:_0xe572e3[_0x3a97('0x19')]+_0xe572e3['limit'];var _0x855ce9;if(_0x4e4303>=_0x496cef){_0x4e4303=_0x496cef;_0x855ce9=0xc8;}else{_0x855ce9=0xce;}_0x5c40d7[_0x3a97('0x18')](_0x855ce9);return _0x5c40d7['set'](_0x3a97('0x1d'),_0x19f745+'-'+_0x4e4303+'/'+_0x496cef)[_0x3a97('0x1e')](_0x3cddf0);}return null;};}function patchUpdates(_0x27510e){return function(_0x3de0d8){try{jsonpatch[_0x3a97('0x1f')](_0x3de0d8,_0x27510e,!![]);}catch(_0x3d26f3){return BPromise[_0x3a97('0x20')](_0x3d26f3);}return _0x3de0d8[_0x3a97('0x21')]();};}function saveUpdates(_0x315e71,_0x45c1f2){return function(_0x195ea8){if(_0x195ea8){return _0x195ea8[_0x3a97('0x22')](_0x315e71)[_0x3a97('0x23')](function(_0x4b9934){return _0x4b9934;});}return null;};}function removeEntity(_0xdddbf7,_0xf92bf3){return function(_0x5d5161){if(_0x5d5161){return _0x5d5161['destroy']()[_0x3a97('0x23')](function(){_0xdddbf7[_0x3a97('0x18')](0xcc)[_0x3a97('0x17')]();});}};}function handleEntityNotFound(_0x93be7d,_0x254150){return function(_0xe43336){if(!_0xe43336){_0x93be7d[_0x3a97('0x16')](0x194);}return _0xe43336;};}function handleError(_0x5bb81b,_0x3d9812){_0x3d9812=_0x3d9812||0x1f4;return function(_0x128b6a){logger[_0x3a97('0x24')](_0x128b6a['stack']);if(_0x128b6a[_0x3a97('0x25')]){delete _0x128b6a[_0x3a97('0x25')];}_0x5bb81b[_0x3a97('0x18')](_0x3d9812)[_0x3a97('0x26')](_0x128b6a);};}exports[_0x3a97('0x27')]=function(_0x44f6fe,_0x4f99bf){var _0x46f432={},_0x9c8b83={},_0x2820a1={'count':0x0,'rows':[]};var _0x5489c3=_[_0x3a97('0x28')](db[_0x3a97('0x29')][_0x3a97('0x2a')],function(_0x502f35){return{'name':_0x502f35[_0x3a97('0x2b')],'type':_0x502f35[_0x3a97('0x2c')][_0x3a97('0x2d')]};});_0x9c8b83[_0x3a97('0x2e')]=_[_0x3a97('0x28')](_0x5489c3,_0x3a97('0x25'));_0x9c8b83['query']=_[_0x3a97('0x2f')](_0x44f6fe['query']);_0x9c8b83['filters']=_[_0x3a97('0x30')](_0x9c8b83['model'],_0x9c8b83['query']);_0x46f432[_0x3a97('0x31')]=_['intersection'](_0x9c8b83[_0x3a97('0x2e')],qs[_0x3a97('0x32')](_0x44f6fe[_0x3a97('0x33')][_0x3a97('0x32')]));_0x46f432[_0x3a97('0x31')]=_0x46f432[_0x3a97('0x31')][_0x3a97('0x34')]?_0x46f432[_0x3a97('0x31')]:_0x9c8b83['model'];if(!_0x44f6fe['query'][_0x3a97('0x35')](_0x3a97('0x36'))){_0x46f432[_0x3a97('0x1b')]=qs[_0x3a97('0x1b')](_0x44f6fe[_0x3a97('0x33')][_0x3a97('0x1b')]);_0x46f432[_0x3a97('0x19')]=qs[_0x3a97('0x19')](_0x44f6fe[_0x3a97('0x33')]['offset']);}_0x46f432[_0x3a97('0x37')]=qs[_0x3a97('0x38')](_0x44f6fe[_0x3a97('0x33')]['sort']);_0x46f432[_0x3a97('0x39')]=qs[_0x3a97('0x3a')](_[_0x3a97('0x3b')](_0x44f6fe[_0x3a97('0x33')],_0x9c8b83[_0x3a97('0x3a')]),_0x5489c3);if(_0x44f6fe['query']['filter']){_0x46f432['where']=_[_0x3a97('0x3c')](_0x46f432[_0x3a97('0x39')],{'$or':_[_0x3a97('0x28')](_0x5489c3,function(_0x44444){if(_0x44444['type']!=='VIRTUAL'){var _0xc74f1a={};_0xc74f1a[_0x44444[_0x3a97('0x25')]]={'$like':'%'+_0x44f6fe[_0x3a97('0x33')][_0x3a97('0x3d')]+'%'};return _0xc74f1a;}})});}_0x46f432=_[_0x3a97('0x3c')]({},_0x46f432,_0x44f6fe[_0x3a97('0x3e')]);var _0x1ff0cf={'where':_0x46f432[_0x3a97('0x39')]};return db[_0x3a97('0x29')][_0x3a97('0x1c')](_0x1ff0cf)[_0x3a97('0x23')](function(_0x131b6d){_0x2820a1['count']=_0x131b6d;if(_0x44f6fe[_0x3a97('0x33')][_0x3a97('0x3f')]){_0x46f432[_0x3a97('0x40')]=[{'all':!![]}];}return db[_0x3a97('0x29')][_0x3a97('0x41')](_0x46f432);})[_0x3a97('0x23')](function(_0x366f3b){_0x2820a1[_0x3a97('0x42')]=_0x366f3b;return _0x2820a1;})[_0x3a97('0x23')](respondWithFilteredResult(_0x4f99bf,_0x46f432))['catch'](handleError(_0x4f99bf,null));};exports['show']=function(_0x89fc9b,_0x4ad7f3){var _0x4da34f={'raw':![],'where':{'id':_0x89fc9b[_0x3a97('0x43')]['id']}},_0x1479a6={};_0x1479a6['model']=_[_0x3a97('0x2f')](db[_0x3a97('0x29')][_0x3a97('0x2a')]);_0x1479a6[_0x3a97('0x33')]=_[_0x3a97('0x2f')](_0x89fc9b['query']);_0x1479a6[_0x3a97('0x3a')]=_[_0x3a97('0x30')](_0x1479a6[_0x3a97('0x2e')],_0x1479a6[_0x3a97('0x33')]);_0x4da34f['attributes']=_['intersection'](_0x1479a6[_0x3a97('0x2e')],qs['fields'](_0x89fc9b[_0x3a97('0x33')]['fields']));_0x4da34f[_0x3a97('0x31')]=_0x4da34f[_0x3a97('0x31')][_0x3a97('0x34')]?_0x4da34f['attributes']:_0x1479a6[_0x3a97('0x2e')];if(_0x89fc9b[_0x3a97('0x33')][_0x3a97('0x3f')]){_0x4da34f[_0x3a97('0x40')]=[{'all':!![]}];}_0x4da34f=_[_0x3a97('0x3c')]({},_0x4da34f,_0x89fc9b[_0x3a97('0x3e')]);return db[_0x3a97('0x29')]['find'](_0x4da34f)[_0x3a97('0x23')](handleEntityNotFound(_0x4ad7f3,null))[_0x3a97('0x23')](respondWithResult(_0x4ad7f3,null))[_0x3a97('0x44')](handleError(_0x4ad7f3,null));};exports[_0x3a97('0x45')]=function(_0x40ade1,_0x5f21c8){return db[_0x3a97('0x29')]['create'](_0x40ade1[_0x3a97('0x46')],{})[_0x3a97('0x23')](respondWithResult(_0x5f21c8,0xc9))[_0x3a97('0x44')](handleError(_0x5f21c8,null));};exports[_0x3a97('0x22')]=function(_0x8ed50c,_0x1568d6){if(_0x8ed50c[_0x3a97('0x46')]['id']){delete _0x8ed50c[_0x3a97('0x46')]['id'];}return db[_0x3a97('0x29')][_0x3a97('0x47')]({'where':{'id':_0x8ed50c['params']['id']}})[_0x3a97('0x23')](handleEntityNotFound(_0x1568d6,null))[_0x3a97('0x23')](saveUpdates(_0x8ed50c[_0x3a97('0x46')],null))[_0x3a97('0x23')](respondWithResult(_0x1568d6,null))[_0x3a97('0x44')](handleError(_0x1568d6,null));};exports[_0x3a97('0x48')]=function(_0x48cafa,_0xdda6f8){return db[_0x3a97('0x29')][_0x3a97('0x47')]({'where':{'id':_0x48cafa[_0x3a97('0x43')]['id']}})[_0x3a97('0x23')](handleEntityNotFound(_0xdda6f8,null))[_0x3a97('0x23')](removeEntity(_0xdda6f8,null))[_0x3a97('0x44')](handleError(_0xdda6f8,null));};exports[_0x3a97('0x49')]=function(_0x5b46ce,_0x3004ab,_0x2b1cfe){return db[_0x3a97('0x4a')]['find']({'where':{'id':_0x5b46ce['params']['id']}})[_0x3a97('0x23')](handleEntityNotFound(_0x3004ab,null))[_0x3a97('0x23')](function(_0x4403ef){if(_0x4403ef){return _0x4403ef[_0x3a97('0x49')](_0x5b46ce[_0x3a97('0x46')][_0x3a97('0x4b')],_[_0x3a97('0x4c')](_0x5b46ce['body'],['ids','id'])||{});}})[_0x3a97('0x23')](respondWithResult(_0x3004ab,null))[_0x3a97('0x44')](handleError(_0x3004ab,null));};exports['getConditions']=function(_0x107f71,_0x21a011,_0x1603c1){var _0x3b26b8={};var _0x214ab8={};var _0x56b874;var _0x135cb9;return db['Automation'][_0x3a97('0x4d')]({'where':{'id':_0x107f71[_0x3a97('0x43')]['id']}})[_0x3a97('0x23')](handleEntityNotFound(_0x21a011,null))[_0x3a97('0x23')](function(_0x2e796a){if(_0x2e796a){_0x56b874=_0x2e796a;_0x214ab8[_0x3a97('0x2e')]=_[_0x3a97('0x2f')](db['Condition'][_0x3a97('0x2a')]);_0x214ab8['query']=_[_0x3a97('0x2f')](_0x107f71[_0x3a97('0x33')]);_0x214ab8[_0x3a97('0x3a')]=_['intersection'](_0x214ab8[_0x3a97('0x2e')],_0x214ab8[_0x3a97('0x33')]);_0x3b26b8[_0x3a97('0x31')]=_[_0x3a97('0x30')](_0x214ab8['model'],qs[_0x3a97('0x32')](_0x107f71[_0x3a97('0x33')][_0x3a97('0x32')]));_0x3b26b8[_0x3a97('0x31')]=_0x3b26b8[_0x3a97('0x31')][_0x3a97('0x34')]?_0x3b26b8['attributes']:_0x214ab8['model'];_0x3b26b8[_0x3a97('0x37')]=qs[_0x3a97('0x38')](_0x107f71[_0x3a97('0x33')][_0x3a97('0x38')]);_0x3b26b8[_0x3a97('0x39')]=qs[_0x3a97('0x3a')](_[_0x3a97('0x3b')](_0x107f71['query'],_0x214ab8[_0x3a97('0x3a')]));if(_0x107f71[_0x3a97('0x33')][_0x3a97('0x3d')]){_0x3b26b8[_0x3a97('0x39')]=_[_0x3a97('0x3c')](_0x3b26b8[_0x3a97('0x39')],{'$or':_[_0x3a97('0x28')](_0x3b26b8[_0x3a97('0x31')],function(_0x57017b){var _0x55355b={};_0x55355b[_0x57017b]={'$like':'%'+_0x107f71[_0x3a97('0x33')][_0x3a97('0x3d')]+'%'};return _0x55355b;})});}_0x3b26b8=_['merge']({},_0x3b26b8,_0x107f71[_0x3a97('0x3e')]);return _0x56b874[_0x3a97('0x4e')](_0x3b26b8);}})['then'](function(_0x2fd00b){if(_0x2fd00b){_0x135cb9=_0x2fd00b[_0x3a97('0x34')];if(!_0x107f71['query'][_0x3a97('0x35')](_0x3a97('0x36'))){_0x3b26b8[_0x3a97('0x1b')]=qs['limit'](_0x107f71['query']['limit']);_0x3b26b8[_0x3a97('0x19')]=qs['offset'](_0x107f71[_0x3a97('0x33')][_0x3a97('0x19')]);}return _0x56b874['getConditions'](_0x3b26b8);}})[_0x3a97('0x23')](function(_0x34cc0a){if(_0x34cc0a){return _0x34cc0a?{'count':_0x135cb9,'rows':_0x34cc0a}:null;}})[_0x3a97('0x23')](respondWithResult(_0x21a011,null))['catch'](handleError(_0x21a011,null));};exports[_0x3a97('0x4f')]=function(_0x3ef75b,_0x432fc0,_0x5d6dd4){return db[_0x3a97('0x50')][_0x3a97('0x47')]({'where':{'id':_0x3ef75b[_0x3a97('0x43')]['id']}})['then'](handleEntityNotFound(_0x432fc0,null))[_0x3a97('0x23')](function(_0x45e155){if(_0x45e155){return _0x45e155[_0x3a97('0x4f')](_0x3ef75b['body'][_0x3a97('0x4b')],_[_0x3a97('0x4c')](_0x3ef75b[_0x3a97('0x46')],[_0x3a97('0x4b'),'id'])||{});}})[_0x3a97('0x23')](respondWithResult(_0x432fc0,null))[_0x3a97('0x44')](handleError(_0x432fc0,null));};exports[_0x3a97('0x51')]=function(_0x3e6c04,_0x12aba1,_0x7260b2){var _0x21a624={};var _0x535f9b={};var _0x2c5a11;var _0x28c6c1;return db[_0x3a97('0x29')][_0x3a97('0x4d')]({'where':{'id':_0x3e6c04[_0x3a97('0x43')]['id']}})[_0x3a97('0x23')](handleEntityNotFound(_0x12aba1,null))['then'](function(_0x5e0f01){if(_0x5e0f01){_0x2c5a11=_0x5e0f01;_0x535f9b[_0x3a97('0x2e')]=_['keys'](db['Action']['rawAttributes']);_0x535f9b['query']=_[_0x3a97('0x2f')](_0x3e6c04[_0x3a97('0x33')]);_0x535f9b[_0x3a97('0x3a')]=_[_0x3a97('0x30')](_0x535f9b[_0x3a97('0x2e')],_0x535f9b['query']);_0x21a624[_0x3a97('0x31')]=_[_0x3a97('0x30')](_0x535f9b[_0x3a97('0x2e')],qs['fields'](_0x3e6c04[_0x3a97('0x33')][_0x3a97('0x32')]));_0x21a624[_0x3a97('0x31')]=_0x21a624['attributes']['length']?_0x21a624[_0x3a97('0x31')]:_0x535f9b[_0x3a97('0x2e')];_0x21a624['order']=qs[_0x3a97('0x38')](_0x3e6c04[_0x3a97('0x33')][_0x3a97('0x38')]);_0x21a624[_0x3a97('0x39')]=qs['filters'](_['pick'](_0x3e6c04[_0x3a97('0x33')],_0x535f9b[_0x3a97('0x3a')]));if(_0x3e6c04[_0x3a97('0x33')][_0x3a97('0x3d')]){_0x21a624[_0x3a97('0x39')]=_[_0x3a97('0x3c')](_0x21a624[_0x3a97('0x39')],{'$or':_[_0x3a97('0x28')](_0x21a624[_0x3a97('0x31')],function(_0xb1d1ad){var _0x69a7c1={};_0x69a7c1[_0xb1d1ad]={'$like':'%'+_0x3e6c04[_0x3a97('0x33')][_0x3a97('0x3d')]+'%'};return _0x69a7c1;})});}_0x21a624=_[_0x3a97('0x3c')]({},_0x21a624,_0x3e6c04[_0x3a97('0x3e')]);return _0x2c5a11[_0x3a97('0x51')](_0x21a624);}})[_0x3a97('0x23')](function(_0x28a7ae){if(_0x28a7ae){_0x28c6c1=_0x28a7ae[_0x3a97('0x34')];if(!_0x3e6c04[_0x3a97('0x33')]['hasOwnProperty'](_0x3a97('0x36'))){_0x21a624[_0x3a97('0x1b')]=qs[_0x3a97('0x1b')](_0x3e6c04[_0x3a97('0x33')]['limit']);_0x21a624[_0x3a97('0x19')]=qs[_0x3a97('0x19')](_0x3e6c04[_0x3a97('0x33')]['offset']);}return _0x2c5a11[_0x3a97('0x51')](_0x21a624);}})['then'](function(_0x4af020){if(_0x4af020){return _0x4af020?{'count':_0x28c6c1,'rows':_0x4af020}:null;}})[_0x3a97('0x23')](respondWithResult(_0x12aba1,null))[_0x3a97('0x44')](handleError(_0x12aba1,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 2b36dc5..69a54c5 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 _0x8316=['../../config/environment','exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5579d4,_0x15e79f){var _0x1325ec=function(_0x588c31){while(--_0x588c31){_0x5579d4['push'](_0x5579d4['shift']());}};_0x1325ec(++_0x15e79f);}(_0x8316,0x191));var _0x6831=function(_0x5cf287,_0x4ab971){_0x5cf287=_0x5cf287-0x0;var _0x222ffb=_0x8316[_0x5cf287];return _0x222ffb;};'use strict';var _=require(_0x6831('0x0'));var util=require(_0x6831('0x1'));var logger=require(_0x6831('0x2'))(_0x6831('0x3'));var moment=require(_0x6831('0x4'));var BPromise=require(_0x6831('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6831('0x6'));var attributes=require('./automation.attributes');module[_0x6831('0x7')]=function(_0x5beb02,_0x4cf20e){return _0x5beb02[_0x6831('0x8')](_0x6831('0x9'),attributes,{'tableName':_0x6831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x922f=['exports','Automation','lodash','util','../../config/logger','api','bluebird','request-promise','path','./automation.attributes'];(function(_0x3653d5,_0x3fc615){var _0x2d5af4=function(_0x3e93dd){while(--_0x3e93dd){_0x3653d5['push'](_0x3653d5['shift']());}};_0x2d5af4(++_0x3fc615);}(_0x922f,0x17e));var _0xf922=function(_0x31b4ee,_0x3eb94f){_0x31b4ee=_0x31b4ee-0x0;var _0x194e24=_0x922f[_0x31b4ee];return _0x194e24;};'use strict';var _=require(_0xf922('0x0'));var util=require(_0xf922('0x1'));var logger=require(_0xf922('0x2'))(_0xf922('0x3'));var moment=require('moment');var BPromise=require(_0xf922('0x4'));var rp=require(_0xf922('0x5'));var fs=require('fs');var path=require(_0xf922('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf922('0x7'));module[_0xf922('0x8')]=function(_0xb5a7bb,_0x30525f){return _0xb5a7bb['define'](_0xf922('0x9'),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 c2cee2e..91d3483 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 _0xeda7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','error','code','Automation,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1c5a3a,_0x34960a){var _0x36aae3=function(_0x2c0d6b){while(--_0x2c0d6b){_0x1c5a3a['push'](_0x1c5a3a['shift']());}};_0x36aae3(++_0x34960a);}(_0xeda7,0x196));var _0x7eda=function(_0x503950,_0x5022eb){_0x503950=_0x503950-0x0;var _0x1657a9=_0xeda7[_0x503950];return _0x1657a9;};'use strict';var _=require(_0x7eda('0x0'));var util=require(_0x7eda('0x1'));var moment=require(_0x7eda('0x2'));var BPromise=require(_0x7eda('0x3'));var rs=require(_0x7eda('0x4'));var fs=require('fs');var Redis=require(_0x7eda('0x5'));var db=require(_0x7eda('0x6'))['db'];var utils=require(_0x7eda('0x7'));var logger=require(_0x7eda('0x8'))(_0x7eda('0x9'));var config=require(_0x7eda('0xa'));var jayson=require(_0x7eda('0xb'));var client=jayson[_0x7eda('0xc')][_0x7eda('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x314602,_0x839e38,_0x163427){return new BPromise(function(_0x2bc200,_0x11576a){return client[_0x7eda('0xe')](_0x314602,_0x163427)['then'](function(_0x29bce2){logger['info']('Automation,\x20%s,\x20%s',_0x839e38,_0x7eda('0xf'));logger[_0x7eda('0x10')](_0x7eda('0x11'),_0x839e38,_0x7eda('0xf'),JSON['stringify'](_0x29bce2));if(_0x29bce2['error']){if(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x13')]===0x1f4){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2['error'][_0x7eda('0x15')]);return _0x11576a(_0x29bce2['error'][_0x7eda('0x15')]);}logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);return _0x2bc200(_0x29bce2[_0x7eda('0x12')][_0x7eda('0x15')]);}else{logger[_0x7eda('0x16')](_0x7eda('0x14'),_0x839e38,'request\x20sent');_0x2bc200(_0x29bce2['result'][_0x7eda('0x15')]);}})['catch'](function(_0x597ce9){logger[_0x7eda('0x12')](_0x7eda('0x14'),_0x839e38,_0x597ce9);_0x11576a(_0x597ce9);});});} \ No newline at end of file +var _0x6d5e=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x1f8845,_0x4fd460){var _0x4645b7=function(_0x24059a){while(--_0x24059a){_0x1f8845['push'](_0x1f8845['shift']());}};_0x4645b7(++_0x4fd460);}(_0x6d5e,0x103));var _0xe6d5=function(_0x14dcf3,_0x5a96a1){_0x14dcf3=_0x14dcf3-0x0;var _0x774999=_0x6d5e[_0x14dcf3];return _0x774999;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var moment=require(_0xe6d5('0x2'));var BPromise=require(_0xe6d5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe6d5('0x4'));var db=require(_0xe6d5('0x5'))['db'];var utils=require(_0xe6d5('0x6'));var logger=require(_0xe6d5('0x7'))(_0xe6d5('0x8'));var config=require(_0xe6d5('0x9'));var jayson=require(_0xe6d5('0xa'));var client=jayson['client'][_0xe6d5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c0f87,_0x162375,_0x5cf296){return new BPromise(function(_0x572986,_0x52913e){return client['request'](_0x4c0f87,_0x5cf296)[_0xe6d5('0xc')](function(_0x65a619){logger[_0xe6d5('0xd')](_0xe6d5('0xe'),_0x162375,'request\x20sent');logger[_0xe6d5('0xf')](_0xe6d5('0x10'),_0x162375,_0xe6d5('0x11'),JSON['stringify'](_0x65a619));if(_0x65a619['error']){if(_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x13')]===0x1f4){logger[_0xe6d5('0x12')](_0xe6d5('0xe'),_0x162375,_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x14')]);return _0x52913e(_0x65a619[_0xe6d5('0x12')]['message']);}logger[_0xe6d5('0x12')](_0xe6d5('0xe'),_0x162375,_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x14')]);return _0x572986(_0x65a619[_0xe6d5('0x12')][_0xe6d5('0x14')]);}else{logger[_0xe6d5('0xd')](_0xe6d5('0xe'),_0x162375,_0xe6d5('0x11'));_0x572986(_0x65a619['result'][_0xe6d5('0x14')]);}})[_0xe6d5('0x15')](function(_0x268ced){logger['error'](_0xe6d5('0xe'),_0x162375,_0x268ced);_0x52913e(_0x268ced);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 9ed3919..f089ac2 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 _0x8388=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getConditions','getActions','post','/:id/conditions','addConditions','/:id/actions','put','update','delete'];(function(_0x524c4a,_0x498be2){var _0x3c7527=function(_0x537a8e){while(--_0x537a8e){_0x524c4a['push'](_0x524c4a['shift']());}};_0x3c7527(++_0x498be2);}(_0x8388,0x18d));var _0x8838=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0x8388[_0x2fc012];return _0x2891f9;};'use strict';var multer=require(_0x8838('0x0'));var util=require(_0x8838('0x1'));var path=require(_0x8838('0x2'));var timeout=require(_0x8838('0x3'));var express=require('express');var router=express[_0x8838('0x4')]();var fs_extra=require(_0x8838('0x5'));var auth=require(_0x8838('0x6'));var interaction=require(_0x8838('0x7'));var config=require(_0x8838('0x8'));var controller=require('./automation.controller');router[_0x8838('0x9')]('/',auth[_0x8838('0xa')](),controller['index']);router[_0x8838('0x9')](_0x8838('0xb'),auth[_0x8838('0xa')](),controller['show']);router[_0x8838('0x9')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x8838('0xc')]);router['get']('/:id/actions',auth[_0x8838('0xa')](),controller[_0x8838('0xd')]);router[_0x8838('0xe')]('/',auth[_0x8838('0xa')](),controller['create']);router[_0x8838('0xe')](_0x8838('0xf'),auth[_0x8838('0xa')](),controller[_0x8838('0x10')]);router['post'](_0x8838('0x11'),auth['isAuthenticated'](),controller['addActions']);router[_0x8838('0x12')](_0x8838('0xb'),auth[_0x8838('0xa')](),controller[_0x8838('0x13')]);router[_0x8838('0x14')](_0x8838('0xb'),auth[_0x8838('0xa')](),controller[_0x8838('0x15')]);module['exports']=router; \ No newline at end of file +var _0xa37e=['/:id/conditions','isAuthenticated','/:id/actions','create','post','addConditions','addActions','/:id','update','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./automation.controller','get','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xa37e,0x97));var _0xea37=function(_0xd1315,_0x26ad3e){_0xd1315=_0xd1315-0x0;var _0x1bcd8f=_0xa37e[_0xd1315];return _0x1bcd8f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xea37('0x0'));var timeout=require(_0xea37('0x1'));var express=require(_0xea37('0x2'));var router=express[_0xea37('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xea37('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x5'));var controller=require(_0xea37('0x6'));router[_0xea37('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xea37('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xea37('0x8')]);router[_0xea37('0x7')](_0xea37('0x9'),auth[_0xea37('0xa')](),controller['getConditions']);router[_0xea37('0x7')](_0xea37('0xb'),auth[_0xea37('0xa')](),controller['getActions']);router['post']('/',auth[_0xea37('0xa')](),controller[_0xea37('0xc')]);router[_0xea37('0xd')]('/:id/conditions',auth[_0xea37('0xa')](),controller[_0xea37('0xe')]);router[_0xea37('0xd')]('/:id/actions',auth[_0xea37('0xa')](),controller[_0xea37('0xf')]);router['put'](_0xea37('0x10'),auth['isAuthenticated'](),controller[_0xea37('0x11')]);router['delete'](_0xea37('0x10'),auth[_0xea37('0xa')](),controller[_0xea37('0x12')]);module[_0xea37('0x13')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 722dd9c..0022fe6 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 _0xbe62=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','ASC','DESC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\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\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','ivr','STRING','BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x5b509f,_0x2fa1e0){var _0x23db71=function(_0x2eca36){while(--_0x2eca36){_0x5b509f['push'](_0x5b509f['shift']());}};_0x23db71(++_0x2fa1e0);}(_0xbe62,0x9e));var _0x2be6=function(_0x352a83,_0x5b64db){_0x352a83=_0x352a83-0x0;var _0x3c7ed0=_0xbe62[_0x352a83];return _0x3c7ed0;};'use strict';var Sequelize=require('sequelize');module[_0x2be6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x2be6('0x1')},'description':{'type':Sequelize[_0x2be6('0x2')]},'active':{'type':Sequelize[_0x2be6('0x3')],'defaultValue':0x0,'comment':_0x2be6('0x4')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x2be6('0x5')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2be6('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2be6('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x2be6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be6('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be6('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'defaultValue':0x3,'comment':_0x2be6('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x2be6('0xd')},'dialTimezone':{'type':Sequelize[_0x2be6('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x2be6('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x2be6('0xf')](_0x2be6('0x10'),'never',_0x2be6('0x11')),'defaultValue':_0x2be6('0x10')},'dialAMDActive':{'type':Sequelize[_0x2be6('0x3')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x2be6('0x7')](0x9)[_0x2be6('0x5')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x2be6('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x2be6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x2be6('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2be6('0x7')](0x9)[_0x2be6('0x5')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2be6('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2be6('0x7')](0x9)[_0x2be6('0x5')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2be6('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x2be6('0x7')](0x9)[_0x2be6('0x5')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2be6('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x2be6('0x7')](0x9)[_0x2be6('0x5')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2be6('0x7')](0x9)[_0x2be6('0x5')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2be6('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2be6('0x7')](0x5)[_0x2be6('0x5')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2be6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x2be6('0xf')]('DESC',_0x2be6('0x18')),'defaultValue':_0x2be6('0x19')},'dialPrefix':{'type':Sequelize[_0x2be6('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2be6('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2be6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be6('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be6('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be6('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)[_0x2be6('0x5')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0x21')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x2be6('0x7')](0x3)[_0x2be6('0x5')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2be6('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2be6('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2be6('0x23')}}; \ No newline at end of file +var _0xad60=['STRING','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name','ENUM','ivr'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xad60,0x196));var _0x0ad6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xad60[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0x0ad6('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x0ad6('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x0ad6('0x2')](_0x0ad6('0x3')),'allowNull':![],'defaultValue':_0x0ad6('0x3')},'description':{'type':Sequelize[_0x0ad6('0x4')]},'active':{'type':Sequelize[_0x0ad6('0x5')],'defaultValue':0x0,'comment':_0x0ad6('0x6')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x0ad6('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x0ad6('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x0ad6('0x7')](0x3)[_0x0ad6('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x0ad6('0x7')](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ad6('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x0ad6('0x8')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x0ad6('0x7')](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ad6('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x0ad6('0xe')},'dialTimezone':{'type':Sequelize[_0x0ad6('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x0ad6('0x4')],'defaultValue':_0x0ad6('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0x0ad6('0x2')](_0x0ad6('0x10'),_0x0ad6('0x11'),'onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x0ad6('0x5')],'defaultValue':0x0,'comment':_0x0ad6('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x0ad6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x0ad6('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x0ad6('0x7')](0x9)[_0x0ad6('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x0ad6('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x0ad6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x0ad6('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x0ad6('0x7')](0x9)[_0x0ad6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ad6('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x0ad6('0x7')](0x9)[_0x0ad6('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x0ad6('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x0ad6('0x7')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x0ad6('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x0ad6('0x7')](0x9)[_0x0ad6('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x0ad6('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x0ad6('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x0ad6('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x0ad6('0x7')](0x9)[_0x0ad6('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x0ad6('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x0ad6('0x2')](_0x0ad6('0x1c'),_0x0ad6('0x1d')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x0ad6('0x7')](0x3)[_0x0ad6('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ad6('0x1e')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x0ad6('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)[_0x0ad6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x0ad6('0x7')](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ad6('0x21')},'dialDropMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)[_0x0ad6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0x22')},'dialDropRetryFrequency':{'type':Sequelize[_0x0ad6('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ad6('0x23')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)[_0x0ad6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0x24')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ad6('0x25')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0x26')},'dialMachineRetryFrequency':{'type':Sequelize[_0x0ad6('0x7')](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x0ad6('0x7')](0x3)[_0x0ad6('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x0ad6('0x27')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x0ad6('0x7')](0x5)[_0x0ad6('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x0ad6('0x28')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 2e6da37..f86212d 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 _0xbd9f=['h.id','ci.item','ci.OrderBY','OrderBy','join','h.ContactId\x20=\x20ci.CmContactId','sequelize','push','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Campaign','rawAttributes','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','include','findAll','params','keys','fields','length','includeAll','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','userProfileId','autoAssociation','clone','createdAt','updatedAt','omit','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','findOne','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','select','field','phone','NOW()','ContactId','CmListId','toString','from','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','cm_contacts','cm_hopper_additional_phones'];(function(_0x32602f,_0x20be94){var _0x18f845=function(_0x14ab58){while(--_0x14ab58){_0x32602f['push'](_0x32602f['shift']());}};_0x18f845(++_0x20be94);}(_0xbd9f,0x98));var _0xfbd9=function(_0x3102af,_0x137b65){_0x3102af=_0x3102af-0x0;var _0x3c208c=_0xbd9f[_0x3102af];return _0x3c208c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfbd9('0x0'));var rp=require('request-promise');var moment=require(_0xfbd9('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xfbd9('0x2'));var util=require('util');var path=require(_0xfbd9('0x3'));var sox=require(_0xfbd9('0x4'));var csv=require(_0xfbd9('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfbd9('0x6'));var _=require('lodash');var squel=require(_0xfbd9('0x7'));var crypto=require(_0xfbd9('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xfbd9('0x9'));var toCsv=require(_0xfbd9('0x5'));var querystring=require(_0xfbd9('0xa'));var Papa=require('papaparse');var Redis=require(_0xfbd9('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xfbd9('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfbd9('0xd'));var logger=require(_0xfbd9('0xe'))('api');var utils=require(_0xfbd9('0xf'));var config=require(_0xfbd9('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbd9('0x11'))['db'];function respondWithStatusCode(_0x301770,_0x1a4a0e){_0x1a4a0e=_0x1a4a0e||0xcc;return function(_0x527707){if(_0x527707){return _0x301770[_0xfbd9('0x12')](_0x1a4a0e);}return _0x301770['status'](_0x1a4a0e)['end']();};}function respondWithResult(_0x36113b,_0x35adb1){_0x35adb1=_0x35adb1||0xc8;return function(_0x159743){if(_0x159743){return _0x36113b[_0xfbd9('0x13')](_0x35adb1)['json'](_0x159743);}};}function respondWithFilteredResult(_0x2fef54,_0x9f8390){return function(_0x2b9553){if(_0x2b9553){var _0x58d553=typeof _0x9f8390[_0xfbd9('0x14')]===_0xfbd9('0x15')&&typeof _0x9f8390['limit']===_0xfbd9('0x15');var _0x516dcf=_0x2b9553[_0xfbd9('0x16')];var _0x13918f=_0x58d553?0x0:_0x9f8390['offset'];var _0x3ed394=_0x58d553?_0x2b9553[_0xfbd9('0x16')]:_0x9f8390[_0xfbd9('0x14')]+_0x9f8390[_0xfbd9('0x17')];var _0x35bf78;if(_0x3ed394>=_0x516dcf){_0x3ed394=_0x516dcf;_0x35bf78=0xc8;}else{_0x35bf78=0xce;}_0x2fef54[_0xfbd9('0x13')](_0x35bf78);return _0x2fef54[_0xfbd9('0x18')](_0xfbd9('0x19'),_0x13918f+'-'+_0x3ed394+'/'+_0x516dcf)[_0xfbd9('0x1a')](_0x2b9553);}return null;};}function patchUpdates(_0x1b1eea){return function(_0x2d2c6e){try{jsonpatch[_0xfbd9('0x1b')](_0x2d2c6e,_0x1b1eea,!![]);}catch(_0x2fc10b){return BPromise[_0xfbd9('0x1c')](_0x2fc10b);}return _0x2d2c6e[_0xfbd9('0x1d')]();};}function saveUpdates(_0x32f9bb,_0x12140b){return function(_0x4d3020){if(_0x4d3020){return _0x4d3020[_0xfbd9('0x1e')](_0x32f9bb)[_0xfbd9('0x1f')](function(_0x175373){return _0x175373;});}return null;};}function removeEntity(_0x299dd2,_0x237313){return function(_0x39da76){if(_0x39da76){return _0x39da76[_0xfbd9('0x20')]()[_0xfbd9('0x1f')](function(){var _0x3624f3=_0x39da76[_0xfbd9('0x21')]({'plain':!![]});var _0x1b0cc5='IvrCampaigns';return db[_0xfbd9('0x22')][_0xfbd9('0x20')]({'where':{'type':_0x1b0cc5,'resourceId':_0x3624f3['id']}})[_0xfbd9('0x1f')](function(){return _0x39da76;});})['then'](function(){_0x299dd2['status'](0xcc)[_0xfbd9('0x23')]();});}};}function handleEntityNotFound(_0x4d0104,_0x3c8cca){return function(_0x58de44){if(!_0x58de44){_0x4d0104['sendStatus'](0x194);}return _0x58de44;};}function handleError(_0x3a6a0,_0x5a00ff){_0x5a00ff=_0x5a00ff||0x1f4;return function(_0x303257){logger[_0xfbd9('0x24')](_0x303257[_0xfbd9('0x25')]);if(_0x303257[_0xfbd9('0x26')]){delete _0x303257[_0xfbd9('0x26')];}_0x3a6a0[_0xfbd9('0x13')](_0x5a00ff)[_0xfbd9('0x27')](_0x303257);};}exports['index']=function(_0x27dc31,_0x179b8e){var _0x2728c9={},_0x4515b5={},_0x43f09b={'count':0x0,'rows':[]};var _0x17936b=_[_0xfbd9('0x28')](db[_0xfbd9('0x29')][_0xfbd9('0x2a')],function(_0x1f66d1){return{'name':_0x1f66d1['fieldName'],'type':_0x1f66d1['type'][_0xfbd9('0x2b')]};});_0x4515b5[_0xfbd9('0x2c')]=_[_0xfbd9('0x28')](_0x17936b,_0xfbd9('0x26'));_0x4515b5[_0xfbd9('0x2d')]=_['keys'](_0x27dc31[_0xfbd9('0x2d')]);_0x4515b5[_0xfbd9('0x2e')]=_[_0xfbd9('0x2f')](_0x4515b5[_0xfbd9('0x2c')],_0x4515b5[_0xfbd9('0x2d')]);_0x2728c9[_0xfbd9('0x30')]=_[_0xfbd9('0x2f')](_0x4515b5[_0xfbd9('0x2c')],qs['fields'](_0x27dc31[_0xfbd9('0x2d')]['fields']));_0x2728c9[_0xfbd9('0x30')]=_0x2728c9['attributes']['length']?_0x2728c9[_0xfbd9('0x30')]:_0x4515b5[_0xfbd9('0x2c')];if(!_0x27dc31['query'][_0xfbd9('0x31')](_0xfbd9('0x32'))){_0x2728c9[_0xfbd9('0x17')]=qs['limit'](_0x27dc31[_0xfbd9('0x2d')]['limit']);_0x2728c9[_0xfbd9('0x14')]=qs[_0xfbd9('0x14')](_0x27dc31['query'][_0xfbd9('0x14')]);}_0x2728c9[_0xfbd9('0x33')]=qs[_0xfbd9('0x34')](_0x27dc31[_0xfbd9('0x2d')][_0xfbd9('0x34')]);_0x2728c9[_0xfbd9('0x35')]=qs[_0xfbd9('0x2e')](_[_0xfbd9('0x36')](_0x27dc31['query'],_0x4515b5[_0xfbd9('0x2e')]),_0x17936b);if(_0x27dc31[_0xfbd9('0x2d')][_0xfbd9('0x37')]){_0x2728c9[_0xfbd9('0x35')]=_[_0xfbd9('0x38')](_0x2728c9['where'],{'$or':_[_0xfbd9('0x28')](_0x17936b,function(_0x5b7040){if(_0x5b7040[_0xfbd9('0x39')]!=='VIRTUAL'){var _0x1b88c5={};_0x1b88c5[_0x5b7040[_0xfbd9('0x26')]]={'$like':'%'+_0x27dc31[_0xfbd9('0x2d')]['filter']+'%'};return _0x1b88c5;}})});}_0x2728c9=_[_0xfbd9('0x38')]({},_0x2728c9,_0x27dc31[_0xfbd9('0x3a')]);var _0x16bfdf={'where':_0x2728c9[_0xfbd9('0x35')]};return db[_0xfbd9('0x29')][_0xfbd9('0x16')](_0x16bfdf)[_0xfbd9('0x1f')](function(_0x55f3dc){_0x43f09b[_0xfbd9('0x16')]=_0x55f3dc;if(_0x27dc31[_0xfbd9('0x2d')]['includeAll']){_0x2728c9[_0xfbd9('0x3b')]=[{'all':!![]}];}return db[_0xfbd9('0x29')][_0xfbd9('0x3c')](_0x2728c9);})[_0xfbd9('0x1f')](function(_0x2eaa5d){_0x43f09b['rows']=_0x2eaa5d;return _0x43f09b;})[_0xfbd9('0x1f')](respondWithFilteredResult(_0x179b8e,_0x2728c9))['catch'](handleError(_0x179b8e,null));};exports['show']=function(_0x443cdc,_0x5d8a94){var _0xa19c47={'raw':![],'where':{'id':_0x443cdc[_0xfbd9('0x3d')]['id']}},_0x1aa6d3={};_0x1aa6d3[_0xfbd9('0x2c')]=_[_0xfbd9('0x3e')](db[_0xfbd9('0x29')][_0xfbd9('0x2a')]);_0x1aa6d3['query']=_[_0xfbd9('0x3e')](_0x443cdc[_0xfbd9('0x2d')]);_0x1aa6d3['filters']=_[_0xfbd9('0x2f')](_0x1aa6d3[_0xfbd9('0x2c')],_0x1aa6d3[_0xfbd9('0x2d')]);_0xa19c47[_0xfbd9('0x30')]=_['intersection'](_0x1aa6d3[_0xfbd9('0x2c')],qs[_0xfbd9('0x3f')](_0x443cdc[_0xfbd9('0x2d')]['fields']));_0xa19c47['attributes']=_0xa19c47[_0xfbd9('0x30')][_0xfbd9('0x40')]?_0xa19c47[_0xfbd9('0x30')]:_0x1aa6d3[_0xfbd9('0x2c')];if(_0x443cdc[_0xfbd9('0x2d')][_0xfbd9('0x41')]){_0xa19c47[_0xfbd9('0x3b')]=[{'all':!![]}];}_0xa19c47=_[_0xfbd9('0x38')]({},_0xa19c47,_0x443cdc[_0xfbd9('0x3a')]);return db[_0xfbd9('0x29')]['find'](_0xa19c47)[_0xfbd9('0x1f')](handleEntityNotFound(_0x5d8a94,null))[_0xfbd9('0x1f')](respondWithResult(_0x5d8a94,null))[_0xfbd9('0x42')](handleError(_0x5d8a94,null));};exports[_0xfbd9('0x43')]=function(_0x4add02,_0x5d2576){return db['Campaign'][_0xfbd9('0x43')](_0x4add02[_0xfbd9('0x44')],{})[_0xfbd9('0x1f')](function(_0x11365a){var _0x484523=_0x4add02['user'][_0xfbd9('0x21')]({'plain':!![]});if(!_0x484523)throw new Error(_0xfbd9('0x45'));if(_0x484523[_0xfbd9('0x46')]==='user'){var _0x3e3d94=_0x11365a[_0xfbd9('0x21')]({'plain':!![]});var _0x5ccd07=_0xfbd9('0x47');return db[_0xfbd9('0x48')][_0xfbd9('0x49')]({'where':{'name':_0x5ccd07,'userProfileId':_0x484523[_0xfbd9('0x4a')]},'raw':!![]})[_0xfbd9('0x1f')](function(_0x5dbaa6){if(_0x5dbaa6&&_0x5dbaa6[_0xfbd9('0x4b')]===0x0){return db[_0xfbd9('0x22')][_0xfbd9('0x43')]({'name':_0x3e3d94[_0xfbd9('0x26')],'resourceId':_0x3e3d94['id'],'type':_0x5dbaa6[_0xfbd9('0x26')],'sectionId':_0x5dbaa6['id']},{})['then'](function(){return _0x11365a;});}else{return _0x11365a;}})[_0xfbd9('0x42')](function(_0x310b73){logger[_0xfbd9('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x310b73);throw _0x310b73;});}return _0x11365a;})['then'](respondWithResult(_0x5d2576,0xc9))[_0xfbd9('0x42')](handleError(_0x5d2576,null));};exports[_0xfbd9('0x4c')]=function(_0xe4d9f,_0x84cddb){var _0x18ac89={'where':{'id':_0xe4d9f[_0xfbd9('0x3d')]['id']}},_0x3406c8={};_0x3406c8[_0xfbd9('0x2c')]=_[_0xfbd9('0x3e')](db[_0xfbd9('0x29')][_0xfbd9('0x2a')]);_0x18ac89[_0xfbd9('0x30')]=_[_0xfbd9('0x2f')](_0x3406c8['model'],qs['fields'](_0xe4d9f[_0xfbd9('0x2d')][_0xfbd9('0x3f')]));_0x18ac89['attributes']=_0x18ac89[_0xfbd9('0x30')][_0xfbd9('0x40')]?_0x18ac89[_0xfbd9('0x30')]:_0x3406c8['model'];if(_0xe4d9f[_0xfbd9('0x2d')][_0xfbd9('0x41')]){_0x18ac89[_0xfbd9('0x3b')]=[{'all':!![]}];}_0x18ac89=_['merge']({},_0x18ac89,_0xe4d9f[_0xfbd9('0x3a')]);return db[_0xfbd9('0x29')][_0xfbd9('0x49')](_0x18ac89)[_0xfbd9('0x1f')](handleEntityNotFound(_0x84cddb,null))[_0xfbd9('0x1f')](function(_0x5b7187){if(_0x5b7187){var _0x2e53f8=_0x5b7187['get']({'plain':!![]});_0x2e53f8=qs['omit'](_0x2e53f8,['id',_0xfbd9('0x4d'),_0xfbd9('0x4e')]);_0xe4d9f['body']=_[_0xfbd9('0x4f')](_0xe4d9f['body'],['id',_0xfbd9('0x4d'),_0xfbd9('0x4e')]);return db[_0xfbd9('0x29')][_0xfbd9('0x43')](_[_0xfbd9('0x38')](_0x2e53f8,_0xe4d9f[_0xfbd9('0x44')]),{'include':_0xe4d9f['query'][_0xfbd9('0x41')]?[{'all':!![]}]:undefined})[_0xfbd9('0x1f')](function(_0x683623){var _0x42bc46=_0xe4d9f['user'][_0xfbd9('0x21')]({'plain':!![]});if(!_0x42bc46)throw new Error(_0xfbd9('0x45'));if(_0x42bc46['role']==='user'){var _0x5c287b=_0x683623[_0xfbd9('0x21')]({'plain':!![]});var _0x41416a=_0xfbd9('0x47');return db['UserProfileSection'][_0xfbd9('0x49')]({'where':{'name':_0x41416a,'userProfileId':_0x42bc46[_0xfbd9('0x4a')]},'raw':!![]})[_0xfbd9('0x1f')](function(_0x366b9a){if(_0x366b9a&&_0x366b9a[_0xfbd9('0x4b')]===0x0){return db['UserProfileResource'][_0xfbd9('0x43')]({'name':_0x5c287b[_0xfbd9('0x26')],'resourceId':_0x5c287b['id'],'type':_0x366b9a[_0xfbd9('0x26')],'sectionId':_0x366b9a['id']},{})[_0xfbd9('0x1f')](function(){return _0x683623;});}else{return _0x683623;}})[_0xfbd9('0x42')](function(_0x50651b){logger[_0xfbd9('0x24')](_0xfbd9('0x50'),_0x50651b);throw _0x50651b;});}return _0x683623;});}})[_0xfbd9('0x1f')](respondWithResult(_0x84cddb,0xc9))['catch'](handleError(_0x84cddb,null));};exports[_0xfbd9('0x1e')]=function(_0x5b5284,_0xb25879){if(_0x5b5284[_0xfbd9('0x44')]['id']){delete _0x5b5284[_0xfbd9('0x44')]['id'];}return db[_0xfbd9('0x29')][_0xfbd9('0x49')]({'where':{'id':_0x5b5284['params']['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0xb25879,null))[_0xfbd9('0x1f')](saveUpdates(_0x5b5284['body'],null))['then'](respondWithResult(_0xb25879,null))[_0xfbd9('0x42')](handleError(_0xb25879,null));};exports['destroy']=function(_0x6f3c37,_0x260949){return db[_0xfbd9('0x29')][_0xfbd9('0x49')]({'where':{'id':_0x6f3c37[_0xfbd9('0x3d')]['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x260949,null))['then'](removeEntity(_0x260949,null))['catch'](handleError(_0x260949,null));};exports[_0xfbd9('0x51')]=function(_0x3d1698,_0x2de072,_0x935dc4){var _0x2fb24a={'raw':!![],'where':{}};var _0x3b59c0={};var _0x243b1d={'count':0x0,'rows':[]};return db[_0xfbd9('0x29')]['findOne']({'where':{'id':_0x3d1698['params']['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x2de072,null))[_0xfbd9('0x1f')](function(_0x7d7cc4){if(_0x7d7cc4){_0x3b59c0['model']=_['keys'](db[_0xfbd9('0x52')]['rawAttributes']);_0x3b59c0['query']=_[_0xfbd9('0x3e')](_0x3d1698[_0xfbd9('0x2d')]);_0x3b59c0['filters']=_[_0xfbd9('0x2f')](_0x3b59c0[_0xfbd9('0x2c')],_0x3b59c0[_0xfbd9('0x2d')]);_0x2fb24a[_0xfbd9('0x30')]=_['intersection'](_0x3b59c0[_0xfbd9('0x2c')],qs[_0xfbd9('0x3f')](_0x3d1698[_0xfbd9('0x2d')]['fields']));_0x2fb24a[_0xfbd9('0x30')]=_0x2fb24a['attributes'][_0xfbd9('0x40')]?_0x2fb24a[_0xfbd9('0x30')]:_0x3b59c0[_0xfbd9('0x2c')];if(!_0x3d1698[_0xfbd9('0x2d')]['hasOwnProperty'](_0xfbd9('0x32'))){_0x2fb24a[_0xfbd9('0x17')]=qs['limit'](_0x3d1698[_0xfbd9('0x2d')][_0xfbd9('0x17')]);_0x2fb24a[_0xfbd9('0x14')]=qs[_0xfbd9('0x14')](_0x3d1698[_0xfbd9('0x2d')]['offset']);}_0x2fb24a[_0xfbd9('0x33')]=qs[_0xfbd9('0x34')](_0x3d1698[_0xfbd9('0x2d')]['sort']);_0x2fb24a['where']=qs['filters'](_['pick'](_0x3d1698[_0xfbd9('0x2d')],_0x3b59c0[_0xfbd9('0x2e')]));_0x2fb24a['where'][_0xfbd9('0x53')]=_0x7d7cc4['id'];if(_0x3d1698[_0xfbd9('0x2d')]['filter']){_0x2fb24a['where']=_[_0xfbd9('0x38')](_0x2fb24a[_0xfbd9('0x35')],{'$or':_['map'](_0x2fb24a[_0xfbd9('0x30')],function(_0x3c97b3){var _0x555d8e={};_0x555d8e[_0x3c97b3]={'$like':'%'+_0x3d1698[_0xfbd9('0x2d')]['filter']+'%'};return _0x555d8e;})});}_0x2fb24a=_['merge']({},_0x2fb24a,_0x3d1698[_0xfbd9('0x3a')]);return db[_0xfbd9('0x52')][_0xfbd9('0x16')]({'where':_0x2fb24a[_0xfbd9('0x35')]})[_0xfbd9('0x1f')](function(_0x411a37){_0x243b1d['count']=_0x411a37;if(_0x3d1698[_0xfbd9('0x2d')][_0xfbd9('0x41')]){_0x2fb24a[_0xfbd9('0x3b')]=[{'all':!![]}];}return db[_0xfbd9('0x52')]['findAll'](_0x2fb24a);})['then'](function(_0x20292a){_0x243b1d[_0xfbd9('0x54')]=_0x20292a;return _0x243b1d;});}})[_0xfbd9('0x1f')](respondWithFilteredResult(_0x2de072,_0x2fb24a))[_0xfbd9('0x42')](handleError(_0x2de072,null));};exports[_0xfbd9('0x55')]=function(_0x527e7b,_0x31e50e,_0xb6f4ee){var _0x1ba4fc={'raw':!![],'where':{}};var _0x26311b={};var _0x4a5a05={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x527e7b['params']['id']}})['then'](handleEntityNotFound(_0x31e50e,null))[_0xfbd9('0x1f')](function(_0x2cd315){if(_0x2cd315){_0x26311b[_0xfbd9('0x2c')]=_[_0xfbd9('0x3e')](db[_0xfbd9('0x56')][_0xfbd9('0x2a')]);_0x26311b[_0xfbd9('0x2d')]=_[_0xfbd9('0x3e')](_0x527e7b[_0xfbd9('0x2d')]);_0x26311b[_0xfbd9('0x2e')]=_['intersection'](_0x26311b['model'],_0x26311b['query']);_0x1ba4fc[_0xfbd9('0x30')]=_[_0xfbd9('0x2f')](_0x26311b[_0xfbd9('0x2c')],qs[_0xfbd9('0x3f')](_0x527e7b[_0xfbd9('0x2d')][_0xfbd9('0x3f')]));_0x1ba4fc['attributes']=_0x1ba4fc[_0xfbd9('0x30')][_0xfbd9('0x40')]?_0x1ba4fc[_0xfbd9('0x30')]:_0x26311b[_0xfbd9('0x2c')];if(!_0x527e7b[_0xfbd9('0x2d')]['hasOwnProperty'](_0xfbd9('0x32'))){_0x1ba4fc[_0xfbd9('0x17')]=qs[_0xfbd9('0x17')](_0x527e7b[_0xfbd9('0x2d')][_0xfbd9('0x17')]);_0x1ba4fc[_0xfbd9('0x14')]=qs[_0xfbd9('0x14')](_0x527e7b['query'][_0xfbd9('0x14')]);}_0x1ba4fc['order']=qs[_0xfbd9('0x34')](_0x527e7b[_0xfbd9('0x2d')]['sort']);_0x1ba4fc['where']=qs[_0xfbd9('0x2e')](_['pick'](_0x527e7b[_0xfbd9('0x2d')],_0x26311b[_0xfbd9('0x2e')]));_0x1ba4fc[_0xfbd9('0x35')][_0xfbd9('0x53')]=_0x2cd315['id'];if(_0x527e7b[_0xfbd9('0x2d')][_0xfbd9('0x37')]){_0x1ba4fc['where']=_[_0xfbd9('0x38')](_0x1ba4fc[_0xfbd9('0x35')],{'$or':_[_0xfbd9('0x28')](_0x1ba4fc[_0xfbd9('0x30')],function(_0x596e34){var _0x8049d8={};_0x8049d8[_0x596e34]={'$like':'%'+_0x527e7b[_0xfbd9('0x2d')][_0xfbd9('0x37')]+'%'};return _0x8049d8;})});}_0x1ba4fc=_[_0xfbd9('0x38')]({},_0x1ba4fc,_0x527e7b[_0xfbd9('0x3a')]);return db['CmHopperHistory'][_0xfbd9('0x16')]({'where':_0x1ba4fc['where']})[_0xfbd9('0x1f')](function(_0x4cf720){_0x4a5a05['count']=_0x4cf720;if(_0x527e7b[_0xfbd9('0x2d')]['includeAll']){_0x1ba4fc[_0xfbd9('0x3b')]=[{'all':!![]}];}return db[_0xfbd9('0x56')][_0xfbd9('0x3c')](_0x1ba4fc);})['then'](function(_0x821f1e){_0x4a5a05['rows']=_0x821f1e;return _0x4a5a05;});}})[_0xfbd9('0x1f')](respondWithFilteredResult(_0x31e50e,_0x1ba4fc))[_0xfbd9('0x42')](handleError(_0x31e50e,null));};exports[_0xfbd9('0x57')]=function(_0x304d68,_0x27dd2e,_0x51f33a){var _0x4ddfc6={'raw':!![],'where':{}};var _0x26deb3={};var _0x2bb227={'count':0x0,'rows':[]};return db[_0xfbd9('0x29')]['findOne']({'where':{'id':_0x304d68[_0xfbd9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x27dd2e,null))['then'](function(_0x5a0f34){if(_0x5a0f34){_0x26deb3[_0xfbd9('0x2c')]=_[_0xfbd9('0x3e')](db['CmHopperFinal'][_0xfbd9('0x2a')]);_0x26deb3['query']=_[_0xfbd9('0x3e')](_0x304d68[_0xfbd9('0x2d')]);_0x26deb3[_0xfbd9('0x2e')]=_[_0xfbd9('0x2f')](_0x26deb3['model'],_0x26deb3[_0xfbd9('0x2d')]);_0x4ddfc6[_0xfbd9('0x30')]=_[_0xfbd9('0x2f')](_0x26deb3[_0xfbd9('0x2c')],qs[_0xfbd9('0x3f')](_0x304d68['query'][_0xfbd9('0x3f')]));_0x4ddfc6[_0xfbd9('0x30')]=_0x4ddfc6[_0xfbd9('0x30')]['length']?_0x4ddfc6['attributes']:_0x26deb3[_0xfbd9('0x2c')];if(!_0x304d68[_0xfbd9('0x2d')][_0xfbd9('0x31')](_0xfbd9('0x32'))){_0x4ddfc6[_0xfbd9('0x17')]=qs[_0xfbd9('0x17')](_0x304d68[_0xfbd9('0x2d')]['limit']);_0x4ddfc6[_0xfbd9('0x14')]=qs[_0xfbd9('0x14')](_0x304d68[_0xfbd9('0x2d')][_0xfbd9('0x14')]);}_0x4ddfc6[_0xfbd9('0x33')]=qs[_0xfbd9('0x34')](_0x304d68[_0xfbd9('0x2d')][_0xfbd9('0x34')]);_0x4ddfc6[_0xfbd9('0x35')]=qs['filters'](_[_0xfbd9('0x36')](_0x304d68[_0xfbd9('0x2d')],_0x26deb3['filters']));_0x4ddfc6['where'][_0xfbd9('0x53')]=_0x5a0f34['id'];if(_0x304d68[_0xfbd9('0x2d')][_0xfbd9('0x37')]){_0x4ddfc6[_0xfbd9('0x35')]=_[_0xfbd9('0x38')](_0x4ddfc6['where'],{'$or':_[_0xfbd9('0x28')](_0x4ddfc6[_0xfbd9('0x30')],function(_0x66b429){var _0x4f5ac1={};_0x4f5ac1[_0x66b429]={'$like':'%'+_0x304d68[_0xfbd9('0x2d')][_0xfbd9('0x37')]+'%'};return _0x4f5ac1;})});}_0x4ddfc6=_[_0xfbd9('0x38')]({},_0x4ddfc6,_0x304d68[_0xfbd9('0x3a')]);return db[_0xfbd9('0x58')]['count']({'where':_0x4ddfc6['where']})['then'](function(_0x4648b2){_0x2bb227[_0xfbd9('0x16')]=_0x4648b2;if(_0x304d68[_0xfbd9('0x2d')][_0xfbd9('0x41')]){_0x4ddfc6['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xfbd9('0x3c')](_0x4ddfc6);})[_0xfbd9('0x1f')](function(_0x27bc94){_0x2bb227['rows']=_0x27bc94;return _0x2bb227;});}})[_0xfbd9('0x1f')](respondWithFilteredResult(_0x27dd2e,_0x4ddfc6))['catch'](handleError(_0x27dd2e,null));};exports['getHopperBlacks']=function(_0x1de195,_0x4c70de,_0x1a3fc5){var _0x304594={'raw':!![],'where':{}};var _0x3582c1={};var _0x239267={'count':0x0,'rows':[]};return db[_0xfbd9('0x29')][_0xfbd9('0x59')]({'where':{'id':_0x1de195[_0xfbd9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x4c70de,null))[_0xfbd9('0x1f')](function(_0x5aada3){if(_0x5aada3){_0x3582c1[_0xfbd9('0x2c')]=_[_0xfbd9('0x3e')](db[_0xfbd9('0x5a')][_0xfbd9('0x2a')]);_0x3582c1['query']=_[_0xfbd9('0x3e')](_0x1de195['query']);_0x3582c1[_0xfbd9('0x2e')]=_['intersection'](_0x3582c1['model'],_0x3582c1['query']);_0x304594[_0xfbd9('0x30')]=_[_0xfbd9('0x2f')](_0x3582c1[_0xfbd9('0x2c')],qs[_0xfbd9('0x3f')](_0x1de195['query'][_0xfbd9('0x3f')]));_0x304594['attributes']=_0x304594[_0xfbd9('0x30')][_0xfbd9('0x40')]?_0x304594['attributes']:_0x3582c1[_0xfbd9('0x2c')];if(!_0x1de195[_0xfbd9('0x2d')][_0xfbd9('0x31')](_0xfbd9('0x32'))){_0x304594[_0xfbd9('0x17')]=qs[_0xfbd9('0x17')](_0x1de195[_0xfbd9('0x2d')][_0xfbd9('0x17')]);_0x304594[_0xfbd9('0x14')]=qs[_0xfbd9('0x14')](_0x1de195[_0xfbd9('0x2d')][_0xfbd9('0x14')]);}_0x304594[_0xfbd9('0x33')]=qs[_0xfbd9('0x34')](_0x1de195['query']['sort']);_0x304594[_0xfbd9('0x35')]=qs[_0xfbd9('0x2e')](_[_0xfbd9('0x36')](_0x1de195[_0xfbd9('0x2d')],_0x3582c1[_0xfbd9('0x2e')]));_0x304594[_0xfbd9('0x35')][_0xfbd9('0x53')]=_0x5aada3['id'];if(_0x1de195[_0xfbd9('0x2d')][_0xfbd9('0x37')]){_0x304594['where']=_[_0xfbd9('0x38')](_0x304594[_0xfbd9('0x35')],{'$or':_[_0xfbd9('0x28')](_0x304594[_0xfbd9('0x30')],function(_0x16ea14){var _0x358cd6={};_0x358cd6[_0x16ea14]={'$like':'%'+_0x1de195[_0xfbd9('0x2d')][_0xfbd9('0x37')]+'%'};return _0x358cd6;})});}_0x304594=_['merge']({},_0x304594,_0x1de195[_0xfbd9('0x3a')]);return db[_0xfbd9('0x5a')][_0xfbd9('0x16')]({'where':_0x304594[_0xfbd9('0x35')]})[_0xfbd9('0x1f')](function(_0x5db30a){_0x239267['count']=_0x5db30a;if(_0x1de195[_0xfbd9('0x2d')][_0xfbd9('0x41')]){_0x304594[_0xfbd9('0x3b')]=[{'all':!![]}];}return db[_0xfbd9('0x5a')][_0xfbd9('0x3c')](_0x304594);})[_0xfbd9('0x1f')](function(_0x246599){_0x239267[_0xfbd9('0x54')]=_0x246599;return _0x239267;});}})[_0xfbd9('0x1f')](respondWithFilteredResult(_0x4c70de,_0x304594))[_0xfbd9('0x42')](handleError(_0x4c70de,null));};exports['getLists']=function(_0x3b07aa,_0x50fa49,_0x19b565){var _0x5cf769={};var _0x1c6093={};var _0x5a3d9d;var _0x228b74;return db[_0xfbd9('0x29')][_0xfbd9('0x59')]({'where':{'id':_0x3b07aa[_0xfbd9('0x3d')]['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x50fa49,null))['then'](function(_0x2090bc){if(_0x2090bc){_0x5a3d9d=_0x2090bc;_0x1c6093[_0xfbd9('0x2c')]=_['keys'](db['CmList'][_0xfbd9('0x2a')]);_0x1c6093[_0xfbd9('0x2d')]=_['keys'](_0x3b07aa[_0xfbd9('0x2d')]);_0x1c6093[_0xfbd9('0x2e')]=_[_0xfbd9('0x2f')](_0x1c6093[_0xfbd9('0x2c')],_0x1c6093['query']);_0x5cf769[_0xfbd9('0x30')]=_[_0xfbd9('0x2f')](_0x1c6093['model'],qs[_0xfbd9('0x3f')](_0x3b07aa['query'][_0xfbd9('0x3f')]));_0x5cf769[_0xfbd9('0x30')]=_0x5cf769[_0xfbd9('0x30')]['length']?_0x5cf769['attributes']:_0x1c6093[_0xfbd9('0x2c')];_0x5cf769[_0xfbd9('0x33')]=qs['sort'](_0x3b07aa[_0xfbd9('0x2d')][_0xfbd9('0x34')]);_0x5cf769[_0xfbd9('0x35')]=qs['filters'](_[_0xfbd9('0x36')](_0x3b07aa['query'],_0x1c6093[_0xfbd9('0x2e')]));if(_0x3b07aa[_0xfbd9('0x2d')][_0xfbd9('0x37')]){_0x5cf769[_0xfbd9('0x35')]=_[_0xfbd9('0x38')](_0x5cf769[_0xfbd9('0x35')],{'$or':_[_0xfbd9('0x28')](_0x5cf769['attributes'],function(_0x1330ca){var _0x23467e={};_0x23467e[_0x1330ca]={'$like':'%'+_0x3b07aa[_0xfbd9('0x2d')][_0xfbd9('0x37')]+'%'};return _0x23467e;})});}_0x5cf769=_[_0xfbd9('0x38')]({},_0x5cf769,_0x3b07aa[_0xfbd9('0x3a')]);return _0x5a3d9d[_0xfbd9('0x5b')](_0x5cf769);}})[_0xfbd9('0x1f')](function(_0x3cee54){if(_0x3cee54){_0x228b74=_0x3cee54['length'];if(!_0x3b07aa[_0xfbd9('0x2d')][_0xfbd9('0x31')](_0xfbd9('0x32'))){_0x5cf769[_0xfbd9('0x17')]=qs[_0xfbd9('0x17')](_0x3b07aa[_0xfbd9('0x2d')][_0xfbd9('0x17')]);_0x5cf769[_0xfbd9('0x14')]=qs[_0xfbd9('0x14')](_0x3b07aa['query']['offset']);}return _0x5a3d9d['getLists'](_0x5cf769);}})[_0xfbd9('0x1f')](function(_0xdb663){if(_0xdb663){return _0xdb663?{'count':_0x228b74,'rows':_0xdb663}:null;}})[_0xfbd9('0x1f')](respondWithResult(_0x50fa49,null))[_0xfbd9('0x42')](handleError(_0x50fa49,null));};exports[_0xfbd9('0x5c')]=function(_0xed8d73,_0x4226dd,_0x209d04){var _0x359bb8,_0x555179;var _0x16c43=[];var _0x4d2d4a=moment()[_0xfbd9('0x5d')](_0xfbd9('0x5e'));return db[_0xfbd9('0x29')][_0xfbd9('0x49')]({'where':{'id':_0xed8d73[_0xfbd9('0x3d')]['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x4226dd,null))[_0xfbd9('0x1f')](function(_0x6dd950){if(_0x6dd950){_0x555179=_0x6dd950;return _0x6dd950[_0xfbd9('0x5c')](_0xed8d73[_0xfbd9('0x44')][_0xfbd9('0x5f')],_[_0xfbd9('0x4f')](_0xed8d73[_0xfbd9('0x44')],[_0xfbd9('0x5f'),'id'])||{});}return null;})['spread'](function(_0x4186f2){var _0x45b4f6;var _0x57f0c9;_0x359bb8=_0x4186f2||[];var _0x538e9d=[];if(_0x4186f2){for(var _0x26b11a=0x0;_0x26b11a<_0x4186f2[_0xfbd9('0x40')];_0x26b11a+=0x1){var _0x3d3271=_0x4186f2[_0x26b11a][_0xfbd9('0x21')]({'plain':!![]});_0x555179[_0xfbd9('0x60')]=_0xed8d73[_0xfbd9('0x44')][_0xfbd9('0x60')]?_0xed8d73[_0xfbd9('0x44')]['dialCheckDuplicateType']:_0x555179['dialCheckDuplicateType'];switch(_0x555179[_0xfbd9('0x60')]){case _0xfbd9('0x61'):_0x45b4f6=squel[_0xfbd9('0x62')]()[_0xfbd9('0x63')](_0xfbd9('0x64'))[_0xfbd9('0x65')](['phone',_0xfbd9('0x66'),'ContactId',_0xfbd9('0x67'),_0xfbd9('0x53'),_0xfbd9('0x4d'),_0xfbd9('0x4e')],squel[_0xfbd9('0x68')]()[_0xfbd9('0x69')](_0xfbd9('0x6a'),_0xfbd9('0x6a'))[_0xfbd9('0x69')](_0xfbd9('0x6b'),_0xfbd9('0x66'))[_0xfbd9('0x69')]('id',_0xfbd9('0x6c'))[_0xfbd9('0x69')](_0x3d3271[_0xfbd9('0x6d')][_0xfbd9('0x6e')](),_0xfbd9('0x67'))[_0xfbd9('0x69')](_0xed8d73['params']['id'][_0xfbd9('0x6e')](),'CampaignId')[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27','createdAt')[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27',_0xfbd9('0x4e'))[_0xfbd9('0x6f')]('cm_contacts')[_0xfbd9('0x35')]('deletedAt\x20IS\x20NULL')['where'](_0xfbd9('0x70'),_0x3d3271['CmListId'][_0xfbd9('0x6e')]())[_0xfbd9('0x35')](_0xfbd9('0x71'))['where'](_0xfbd9('0x72'),squel['select']()[_0xfbd9('0x69')]('COALESCE(calleridnum,\x27\x27)')[_0xfbd9('0x6f')](_0xfbd9('0x73'))[_0xfbd9('0x35')](_0xfbd9('0x74'),_0xed8d73['params']['id'][_0xfbd9('0x6e')]()))[_0xfbd9('0x35')](_0xfbd9('0x72'),squel[_0xfbd9('0x68')]()[_0xfbd9('0x69')](_0xfbd9('0x75'))[_0xfbd9('0x6f')](_0xfbd9('0x64'))['where'](_0xfbd9('0x74'),_0xed8d73[_0xfbd9('0x3d')]['id'][_0xfbd9('0x6e')]())))[_0xfbd9('0x6e')]();break;case _0xfbd9('0x76'):_0x45b4f6=squel[_0xfbd9('0x62')]()[_0xfbd9('0x63')](_0xfbd9('0x64'))[_0xfbd9('0x65')](['phone',_0xfbd9('0x66'),_0xfbd9('0x6c'),_0xfbd9('0x67'),_0xfbd9('0x53'),_0xfbd9('0x4d'),_0xfbd9('0x4e')],squel[_0xfbd9('0x68')]()['field'](_0xfbd9('0x6a'),_0xfbd9('0x6a'))[_0xfbd9('0x69')](_0xfbd9('0x6b'),_0xfbd9('0x66'))[_0xfbd9('0x69')]('id',_0xfbd9('0x6c'))[_0xfbd9('0x69')](_0x3d3271[_0xfbd9('0x6d')][_0xfbd9('0x6e')](),_0xfbd9('0x67'))['field'](_0xed8d73['params']['id'][_0xfbd9('0x6e')](),_0xfbd9('0x53'))[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27',_0xfbd9('0x4d'))['field']('\x27'+_0x4d2d4a+'\x27','updatedAt')[_0xfbd9('0x6f')]('cm_contacts')[_0xfbd9('0x35')](_0xfbd9('0x77'))[_0xfbd9('0x35')]('ListId\x20=\x20?',_0x3d3271[_0xfbd9('0x6d')][_0xfbd9('0x6e')]())[_0xfbd9('0x35')](_0xfbd9('0x71'))[_0xfbd9('0x35')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfbd9('0x68')]()[_0xfbd9('0x69')](_0xfbd9('0x75'))[_0xfbd9('0x6f')](_0xfbd9('0x64'))[_0xfbd9('0x35')](_0xfbd9('0x74'),_0xed8d73['params']['id'][_0xfbd9('0x6e')]())))['toString']();break;default:_0x45b4f6=squel[_0xfbd9('0x62')]()['into'](_0xfbd9('0x64'))[_0xfbd9('0x65')]([_0xfbd9('0x6a'),_0xfbd9('0x66'),_0xfbd9('0x6c'),_0xfbd9('0x67'),_0xfbd9('0x53'),_0xfbd9('0x4d'),_0xfbd9('0x4e')],squel[_0xfbd9('0x68')]()[_0xfbd9('0x69')](_0xfbd9('0x6a'),'phone')[_0xfbd9('0x69')](_0xfbd9('0x6b'),'scheduledAt')['field']('id','ContactId')['field'](_0x3d3271[_0xfbd9('0x6d')]['toString'](),_0xfbd9('0x67'))[_0xfbd9('0x69')](_0xed8d73['params']['id'][_0xfbd9('0x6e')](),_0xfbd9('0x53'))[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27',_0xfbd9('0x4d'))[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27',_0xfbd9('0x4e'))['from'](_0xfbd9('0x78'))[_0xfbd9('0x35')]('deletedAt\x20IS\x20NULL')[_0xfbd9('0x35')]('ListId\x20=\x20?',_0x3d3271[_0xfbd9('0x6d')][_0xfbd9('0x6e')]())[_0xfbd9('0x35')](_0xfbd9('0x71')))['toString']();}_0x57f0c9=squel[_0xfbd9('0x62')]()[_0xfbd9('0x63')](_0xfbd9('0x79'))[_0xfbd9('0x65')](['cmHopperId',_0xfbd9('0x66'),_0xfbd9('0x6a'),'OrderBy',_0xfbd9('0x4d'),_0xfbd9('0x4e')],squel[_0xfbd9('0x68')]()[_0xfbd9('0x69')](_0xfbd9('0x7a'),'id')[_0xfbd9('0x69')](_0xfbd9('0x6b'),_0xfbd9('0x66'))['field'](_0xfbd9('0x7b'),_0xfbd9('0x6a'))[_0xfbd9('0x69')](_0xfbd9('0x7c'),_0xfbd9('0x7d'))[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27',_0xfbd9('0x4d'))[_0xfbd9('0x69')]('\x27'+_0x4d2d4a+'\x27',_0xfbd9('0x4e'))[_0xfbd9('0x6f')]('cm_contact_has_items','ci')[_0xfbd9('0x7e')](_0xfbd9('0x64'),'h',_0xfbd9('0x7f'))[_0xfbd9('0x35')]('h.ListId\x20=\x20?',_0x3d3271['CmListId'][_0xfbd9('0x6e')]())['where']('h.CampaignId=?',_0xed8d73[_0xfbd9('0x3d')]['id'][_0xfbd9('0x6e')]())[_0xfbd9('0x35')]('h.createdAt\x20=\x20?',_0x4d2d4a))['toString']();_0x538e9d['push'](db[_0xfbd9('0x80')][_0xfbd9('0x2d')](_0x45b4f6));_0x16c43[_0xfbd9('0x81')](db[_0xfbd9('0x80')][_0xfbd9('0x2d')](_0x57f0c9));}return BPromise[_0xfbd9('0x82')](_0x538e9d);}})[_0xfbd9('0x1f')](function(){return BPromise['all'](_0x16c43);})['then'](function(){return _0x359bb8;})[_0xfbd9('0x1f')](respondWithResult(_0x4226dd,null))[_0xfbd9('0x42')](handleError(_0x4226dd,null));};exports[_0xfbd9('0x83')]=function(_0x2711e5,_0x166238,_0x59e460){return db['Campaign'][_0xfbd9('0x49')]({'where':{'id':_0x2711e5['params']['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x166238,null))[_0xfbd9('0x1f')](function(_0x3e4416){if(_0x3e4416){return _0x3e4416[_0xfbd9('0x83')](_0x2711e5[_0xfbd9('0x2d')]['ids']);}})[_0xfbd9('0x1f')](function(_0xcb6afc){if(_0xcb6afc){return db['CmHopper'][_0xfbd9('0x20')]({'where':{'ListId':_0x2711e5[_0xfbd9('0x2d')][_0xfbd9('0x5f')],'CampaignId':_0x2711e5['params']['id']}})[_0xfbd9('0x1f')](function(){return _0xcb6afc;});}})['then'](respondWithStatusCode(_0x166238,null))['catch'](handleError(_0x166238,null));};exports[_0xfbd9('0x84')]=function(_0xb24a8a,_0x53c930,_0x186429){var _0x411f9e={};var _0x16a131={};var _0x5c444e;var _0x1f97bb;return db[_0xfbd9('0x29')][_0xfbd9('0x59')]({'where':{'id':_0xb24a8a[_0xfbd9('0x3d')]['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x53c930,null))[_0xfbd9('0x1f')](function(_0xc4d6ec){if(_0xc4d6ec){_0x5c444e=_0xc4d6ec;_0x16a131['model']=_[_0xfbd9('0x3e')](db['CmList'][_0xfbd9('0x2a')]);_0x16a131['query']=_['keys'](_0xb24a8a[_0xfbd9('0x2d')]);_0x16a131[_0xfbd9('0x2e')]=_[_0xfbd9('0x2f')](_0x16a131[_0xfbd9('0x2c')],_0x16a131[_0xfbd9('0x2d')]);_0x411f9e['attributes']=_['intersection'](_0x16a131[_0xfbd9('0x2c')],qs['fields'](_0xb24a8a[_0xfbd9('0x2d')]['fields']));_0x411f9e[_0xfbd9('0x30')]=_0x411f9e[_0xfbd9('0x30')]['length']?_0x411f9e['attributes']:_0x16a131['model'];_0x411f9e[_0xfbd9('0x33')]=qs[_0xfbd9('0x34')](_0xb24a8a[_0xfbd9('0x2d')][_0xfbd9('0x34')]);_0x411f9e[_0xfbd9('0x35')]=qs['filters'](_[_0xfbd9('0x36')](_0xb24a8a['query'],_0x16a131[_0xfbd9('0x2e')]));if(_0xb24a8a['query'][_0xfbd9('0x37')]){_0x411f9e[_0xfbd9('0x35')]=_[_0xfbd9('0x38')](_0x411f9e[_0xfbd9('0x35')],{'$or':_[_0xfbd9('0x28')](_0x411f9e[_0xfbd9('0x30')],function(_0x6e7c5f){var _0x23f9a5={};_0x23f9a5[_0x6e7c5f]={'$like':'%'+_0xb24a8a[_0xfbd9('0x2d')][_0xfbd9('0x37')]+'%'};return _0x23f9a5;})});}_0x411f9e=_[_0xfbd9('0x38')]({},_0x411f9e,_0xb24a8a['options']);return _0x5c444e['getBlackLists'](_0x411f9e);}})['then'](function(_0x5004a4){if(_0x5004a4){_0x1f97bb=_0x5004a4[_0xfbd9('0x40')];if(!_0xb24a8a['query']['hasOwnProperty'](_0xfbd9('0x32'))){_0x411f9e['limit']=qs[_0xfbd9('0x17')](_0xb24a8a[_0xfbd9('0x2d')][_0xfbd9('0x17')]);_0x411f9e[_0xfbd9('0x14')]=qs['offset'](_0xb24a8a['query'][_0xfbd9('0x14')]);}return _0x5c444e[_0xfbd9('0x84')](_0x411f9e);}})[_0xfbd9('0x1f')](function(_0x1b595b){if(_0x1b595b){return _0x1b595b?{'count':_0x1f97bb,'rows':_0x1b595b}:null;}})[_0xfbd9('0x1f')](respondWithResult(_0x53c930,null))[_0xfbd9('0x42')](handleError(_0x53c930,null));};exports[_0xfbd9('0x85')]=function(_0x2e8e68,_0x578b32,_0x4e9cc0){var _0x53326c,_0xc9b979;var _0x390b08=[];var _0x38cfeb=moment()[_0xfbd9('0x5d')](_0xfbd9('0x5e'));return db['Campaign'][_0xfbd9('0x49')]({'where':{'id':_0x2e8e68[_0xfbd9('0x3d')]['id']}})[_0xfbd9('0x1f')](handleEntityNotFound(_0x578b32,null))[_0xfbd9('0x1f')](function(_0x3b826d){if(_0x3b826d){_0xc9b979=_0x3b826d;return _0x3b826d[_0xfbd9('0x85')](_0x2e8e68[_0xfbd9('0x44')]['ids'],_[_0xfbd9('0x4f')](_0x2e8e68[_0xfbd9('0x44')],[_0xfbd9('0x5f'),'id'])||{});}return null;})[_0xfbd9('0x86')](function(_0x38445a){var _0x4555dd;var _0x3aae2a;_0x53326c=_0x38445a||[];var _0x5160f3=[];if(_0x38445a){for(var _0x5acda9=0x0;_0x5acda9<_0x38445a[_0xfbd9('0x40')];_0x5acda9+=0x1){var _0x461471=_0x38445a[_0x5acda9][_0xfbd9('0x21')]({'plain':!![]});_0x4555dd=squel[_0xfbd9('0x62')]()[_0xfbd9('0x63')](_0xfbd9('0x87'))[_0xfbd9('0x65')](['phone',_0xfbd9('0x6c'),_0xfbd9('0x67'),_0xfbd9('0x53'),_0xfbd9('0x4d'),_0xfbd9('0x4e')],squel[_0xfbd9('0x68')]()[_0xfbd9('0x69')](_0xfbd9('0x6a'),'phone')[_0xfbd9('0x69')]('id',_0xfbd9('0x6c'))[_0xfbd9('0x69')](_0x461471['CmListId'][_0xfbd9('0x6e')](),'ListId')[_0xfbd9('0x69')](_0x2e8e68['params']['id']['toString'](),_0xfbd9('0x53'))['field'](_0xfbd9('0x6b'),_0xfbd9('0x4d'))[_0xfbd9('0x69')](_0xfbd9('0x6b'),'updatedAt')[_0xfbd9('0x6f')]('cm_contacts')[_0xfbd9('0x35')](_0xfbd9('0x77'))[_0xfbd9('0x35')](_0xfbd9('0x70'),_0x461471[_0xfbd9('0x6d')]['toString']())[_0xfbd9('0x35')](_0xfbd9('0x71')))[_0xfbd9('0x6e')]();_0x5160f3[_0xfbd9('0x81')](db['sequelize'][_0xfbd9('0x2d')](_0x4555dd));}return BPromise[_0xfbd9('0x82')](_0x5160f3);}})['then'](function(){return _0x53326c;})[_0xfbd9('0x1f')](respondWithResult(_0x578b32,null))[_0xfbd9('0x42')](handleError(_0x578b32,null));};exports['removeBlackLists']=function(_0x40dd26,_0x192241,_0x2a419b){return db[_0xfbd9('0x29')][_0xfbd9('0x49')]({'where':{'id':_0x40dd26[_0xfbd9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x192241,null))[_0xfbd9('0x1f')](function(_0x19ffd5){if(_0x19ffd5){return _0x19ffd5[_0xfbd9('0x88')](_0x40dd26[_0xfbd9('0x2d')][_0xfbd9('0x5f')]);}})[_0xfbd9('0x1f')](function(_0x5aa56e){if(_0x5aa56e){return db['CmHopperBlack'][_0xfbd9('0x20')]({'where':{'ListId':_0x40dd26[_0xfbd9('0x2d')][_0xfbd9('0x5f')],'CampaignId':_0x40dd26[_0xfbd9('0x3d')]['id']}})[_0xfbd9('0x1f')](function(){return _0x5aa56e;});}})[_0xfbd9('0x1f')](respondWithStatusCode(_0x192241,null))[_0xfbd9('0x42')](handleError(_0x192241,null));}; \ No newline at end of file +var _0x2f8b=['all','removeLists','getBlackLists','cm_hopper_black','push','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','then','get','IvrCampaigns','UserProfileResource','destroy','error','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','userProfileId','update','getHoppers','findOne','CampaignId','CmHopper','CmHopperHistory','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','omit','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','select','field','NOW()','toString','ListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','insert','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','OrderBy','h.id','ci.item','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','sequelize'];(function(_0x1b4137,_0x5cbbfc){var _0xa84907=function(_0x584298){while(--_0x584298){_0x1b4137['push'](_0x1b4137['shift']());}};_0xa84907(++_0x5cbbfc);}(_0x2f8b,0x96));var _0xb2f8=function(_0x2c316b,_0x45e18d){_0x2c316b=_0x2c316b-0x0;var _0x628b04=_0x2f8b[_0x2c316b];return _0x628b04;};'use strict';var emlformat=require(_0xb2f8('0x0'));var rimraf=require(_0xb2f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb2f8('0x2'));var rp=require(_0xb2f8('0x3'));var moment=require(_0xb2f8('0x4'));var BPromise=require(_0xb2f8('0x5'));var Mustache=require(_0xb2f8('0x6'));var util=require(_0xb2f8('0x7'));var path=require(_0xb2f8('0x8'));var sox=require('sox');var csv=require(_0xb2f8('0x9'));var ejs=require(_0xb2f8('0xa'));var fs=require('fs');var fs_extra=require(_0xb2f8('0xb'));var _=require('lodash');var squel=require(_0xb2f8('0xc'));var crypto=require('crypto');var jsforce=require(_0xb2f8('0xd'));var deskjs=require(_0xb2f8('0xe'));var toCsv=require(_0xb2f8('0x9'));var querystring=require(_0xb2f8('0xf'));var Papa=require(_0xb2f8('0x10'));var Redis=require(_0xb2f8('0x11'));var authService=require(_0xb2f8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xb2f8('0x13'));var hardwareService=require(_0xb2f8('0x14'));var logger=require(_0xb2f8('0x15'))(_0xb2f8('0x16'));var utils=require(_0xb2f8('0x17'));var config=require(_0xb2f8('0x18'));var licenseUtil=require(_0xb2f8('0x19'));var db=require(_0xb2f8('0x1a'))['db'];function respondWithStatusCode(_0x3aeb83,_0x2f896a){_0x2f896a=_0x2f896a||0xcc;return function(_0x1dae14){if(_0x1dae14){return _0x3aeb83[_0xb2f8('0x1b')](_0x2f896a);}return _0x3aeb83[_0xb2f8('0x1c')](_0x2f896a)['end']();};}function respondWithResult(_0x56b9b7,_0x4100d2){_0x4100d2=_0x4100d2||0xc8;return function(_0x1389a3){if(_0x1389a3){return _0x56b9b7['status'](_0x4100d2)[_0xb2f8('0x1d')](_0x1389a3);}};}function respondWithFilteredResult(_0x6d73fd,_0x3c30a6){return function(_0x2097e7){if(_0x2097e7){var _0x57d3c8=typeof _0x3c30a6['offset']===_0xb2f8('0x1e')&&typeof _0x3c30a6[_0xb2f8('0x1f')]==='undefined';var _0x90ee1f=_0x2097e7[_0xb2f8('0x20')];var _0x56b307=_0x57d3c8?0x0:_0x3c30a6[_0xb2f8('0x21')];var _0x4dae59=_0x57d3c8?_0x2097e7[_0xb2f8('0x20')]:_0x3c30a6[_0xb2f8('0x21')]+_0x3c30a6[_0xb2f8('0x1f')];var _0x3f54c4;if(_0x4dae59>=_0x90ee1f){_0x4dae59=_0x90ee1f;_0x3f54c4=0xc8;}else{_0x3f54c4=0xce;}_0x6d73fd[_0xb2f8('0x1c')](_0x3f54c4);return _0x6d73fd[_0xb2f8('0x22')](_0xb2f8('0x23'),_0x56b307+'-'+_0x4dae59+'/'+_0x90ee1f)[_0xb2f8('0x1d')](_0x2097e7);}return null;};}function patchUpdates(_0x3f1efa){return function(_0x1a27c5){try{jsonpatch['apply'](_0x1a27c5,_0x3f1efa,!![]);}catch(_0x4501eb){return BPromise['reject'](_0x4501eb);}return _0x1a27c5[_0xb2f8('0x24')]();};}function saveUpdates(_0x2b190c,_0x46c11a){return function(_0x22fe8b){if(_0x22fe8b){return _0x22fe8b['update'](_0x2b190c)[_0xb2f8('0x25')](function(_0x32dc7d){return _0x32dc7d;});}return null;};}function removeEntity(_0x43f6ed,_0x5a8466){return function(_0x12d551){if(_0x12d551){return _0x12d551['destroy']()['then'](function(){var _0x184b24=_0x12d551[_0xb2f8('0x26')]({'plain':!![]});var _0x4c2dcc=_0xb2f8('0x27');return db[_0xb2f8('0x28')][_0xb2f8('0x29')]({'where':{'type':_0x4c2dcc,'resourceId':_0x184b24['id']}})[_0xb2f8('0x25')](function(){return _0x12d551;});})[_0xb2f8('0x25')](function(){_0x43f6ed[_0xb2f8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42355d,_0x3ca25b){return function(_0x3f9e32){if(!_0x3f9e32){_0x42355d[_0xb2f8('0x1b')](0x194);}return _0x3f9e32;};}function handleError(_0x2ceb6e,_0x5de25e){_0x5de25e=_0x5de25e||0x1f4;return function(_0x2a2dcf){logger[_0xb2f8('0x2a')](_0x2a2dcf['stack']);if(_0x2a2dcf[_0xb2f8('0x2b')]){delete _0x2a2dcf[_0xb2f8('0x2b')];}_0x2ceb6e[_0xb2f8('0x1c')](_0x5de25e)[_0xb2f8('0x2c')](_0x2a2dcf);};}exports['index']=function(_0x2695e7,_0x353e29){var _0x196a14={},_0x5ca8b1={},_0x38b7e0={'count':0x0,'rows':[]};var _0x573e61=_[_0xb2f8('0x2d')](db[_0xb2f8('0x2e')][_0xb2f8('0x2f')],function(_0x37f31b){return{'name':_0x37f31b[_0xb2f8('0x30')],'type':_0x37f31b[_0xb2f8('0x31')][_0xb2f8('0x32')]};});_0x5ca8b1[_0xb2f8('0x33')]=_[_0xb2f8('0x2d')](_0x573e61,_0xb2f8('0x2b'));_0x5ca8b1['query']=_[_0xb2f8('0x34')](_0x2695e7[_0xb2f8('0x35')]);_0x5ca8b1[_0xb2f8('0x36')]=_[_0xb2f8('0x37')](_0x5ca8b1['model'],_0x5ca8b1[_0xb2f8('0x35')]);_0x196a14[_0xb2f8('0x38')]=_[_0xb2f8('0x37')](_0x5ca8b1[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x2695e7['query'][_0xb2f8('0x39')]));_0x196a14['attributes']=_0x196a14['attributes'][_0xb2f8('0x3a')]?_0x196a14[_0xb2f8('0x38')]:_0x5ca8b1[_0xb2f8('0x33')];if(!_0x2695e7[_0xb2f8('0x35')][_0xb2f8('0x3b')](_0xb2f8('0x3c'))){_0x196a14['limit']=qs[_0xb2f8('0x1f')](_0x2695e7[_0xb2f8('0x35')][_0xb2f8('0x1f')]);_0x196a14['offset']=qs['offset'](_0x2695e7['query'][_0xb2f8('0x21')]);}_0x196a14[_0xb2f8('0x3d')]=qs[_0xb2f8('0x3e')](_0x2695e7['query'][_0xb2f8('0x3e')]);_0x196a14[_0xb2f8('0x3f')]=qs[_0xb2f8('0x36')](_[_0xb2f8('0x40')](_0x2695e7[_0xb2f8('0x35')],_0x5ca8b1[_0xb2f8('0x36')]),_0x573e61);if(_0x2695e7[_0xb2f8('0x35')]['filter']){_0x196a14[_0xb2f8('0x3f')]=_[_0xb2f8('0x41')](_0x196a14['where'],{'$or':_[_0xb2f8('0x2d')](_0x573e61,function(_0x3fd7b8){if(_0x3fd7b8[_0xb2f8('0x31')]!==_0xb2f8('0x42')){var _0x7ac8e5={};_0x7ac8e5[_0x3fd7b8[_0xb2f8('0x2b')]]={'$like':'%'+_0x2695e7[_0xb2f8('0x35')][_0xb2f8('0x43')]+'%'};return _0x7ac8e5;}})});}_0x196a14=_[_0xb2f8('0x41')]({},_0x196a14,_0x2695e7[_0xb2f8('0x44')]);var _0x4bb3e7={'where':_0x196a14[_0xb2f8('0x3f')]};return db[_0xb2f8('0x2e')][_0xb2f8('0x20')](_0x4bb3e7)[_0xb2f8('0x25')](function(_0x1e946f){_0x38b7e0[_0xb2f8('0x20')]=_0x1e946f;if(_0x2695e7['query'][_0xb2f8('0x45')]){_0x196a14[_0xb2f8('0x46')]=[{'all':!![]}];}return db['Campaign'][_0xb2f8('0x47')](_0x196a14);})[_0xb2f8('0x25')](function(_0x80d7ab){_0x38b7e0['rows']=_0x80d7ab;return _0x38b7e0;})[_0xb2f8('0x25')](respondWithFilteredResult(_0x353e29,_0x196a14))[_0xb2f8('0x48')](handleError(_0x353e29,null));};exports['show']=function(_0x523fe3,_0x32e495){var _0x308efb={'raw':![],'where':{'id':_0x523fe3[_0xb2f8('0x49')]['id']}},_0x575636={};_0x575636['model']=_[_0xb2f8('0x34')](db[_0xb2f8('0x2e')][_0xb2f8('0x2f')]);_0x575636[_0xb2f8('0x35')]=_[_0xb2f8('0x34')](_0x523fe3['query']);_0x575636[_0xb2f8('0x36')]=_[_0xb2f8('0x37')](_0x575636['model'],_0x575636[_0xb2f8('0x35')]);_0x308efb[_0xb2f8('0x38')]=_[_0xb2f8('0x37')](_0x575636[_0xb2f8('0x33')],qs['fields'](_0x523fe3[_0xb2f8('0x35')]['fields']));_0x308efb[_0xb2f8('0x38')]=_0x308efb['attributes'][_0xb2f8('0x3a')]?_0x308efb[_0xb2f8('0x38')]:_0x575636[_0xb2f8('0x33')];if(_0x523fe3[_0xb2f8('0x35')][_0xb2f8('0x45')]){_0x308efb[_0xb2f8('0x46')]=[{'all':!![]}];}_0x308efb=_['merge']({},_0x308efb,_0x523fe3[_0xb2f8('0x44')]);return db[_0xb2f8('0x2e')][_0xb2f8('0x4a')](_0x308efb)[_0xb2f8('0x25')](handleEntityNotFound(_0x32e495,null))['then'](respondWithResult(_0x32e495,null))[_0xb2f8('0x48')](handleError(_0x32e495,null));};exports['create']=function(_0x1291b6,_0x405b2){return db['Campaign'][_0xb2f8('0x4b')](_0x1291b6[_0xb2f8('0x4c')],{})[_0xb2f8('0x25')](function(_0x60d7a5){var _0x182d18=_0x1291b6['user'][_0xb2f8('0x26')]({'plain':!![]});if(!_0x182d18)throw new Error(_0xb2f8('0x4d'));if(_0x182d18[_0xb2f8('0x4e')]==='user'){var _0x1b0d6e=_0x60d7a5['get']({'plain':!![]});var _0x3d77cb=_0xb2f8('0x27');return db[_0xb2f8('0x4f')][_0xb2f8('0x4a')]({'where':{'name':_0x3d77cb,'userProfileId':_0x182d18['userProfileId']},'raw':!![]})[_0xb2f8('0x25')](function(_0xf3a33c){if(_0xf3a33c&&_0xf3a33c[_0xb2f8('0x50')]===0x0){return db[_0xb2f8('0x28')]['create']({'name':_0x1b0d6e['name'],'resourceId':_0x1b0d6e['id'],'type':_0xf3a33c[_0xb2f8('0x2b')],'sectionId':_0xf3a33c['id']},{})[_0xb2f8('0x25')](function(){return _0x60d7a5;});}else{return _0x60d7a5;}})['catch'](function(_0x25a45a){logger['error'](_0xb2f8('0x51'),_0x25a45a);throw _0x25a45a;});}return _0x60d7a5;})[_0xb2f8('0x25')](respondWithResult(_0x405b2,0xc9))[_0xb2f8('0x48')](handleError(_0x405b2,null));};exports[_0xb2f8('0x52')]=function(_0x3055cd,_0x2ab423){var _0x4c752b={'where':{'id':_0x3055cd[_0xb2f8('0x49')]['id']}},_0x36f3fd={};_0x36f3fd[_0xb2f8('0x33')]=_[_0xb2f8('0x34')](db['Campaign'][_0xb2f8('0x2f')]);_0x4c752b['attributes']=_[_0xb2f8('0x37')](_0x36f3fd[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x3055cd[_0xb2f8('0x35')][_0xb2f8('0x39')]));_0x4c752b[_0xb2f8('0x38')]=_0x4c752b[_0xb2f8('0x38')][_0xb2f8('0x3a')]?_0x4c752b[_0xb2f8('0x38')]:_0x36f3fd[_0xb2f8('0x33')];if(_0x3055cd['query']['includeAll']){_0x4c752b[_0xb2f8('0x46')]=[{'all':!![]}];}_0x4c752b=_[_0xb2f8('0x41')]({},_0x4c752b,_0x3055cd['options']);return db['Campaign']['find'](_0x4c752b)[_0xb2f8('0x25')](handleEntityNotFound(_0x2ab423,null))['then'](function(_0x20a770){if(_0x20a770){var _0x15b6f3=_0x20a770[_0xb2f8('0x26')]({'plain':!![]});_0x15b6f3=qs['omit'](_0x15b6f3,['id',_0xb2f8('0x53'),'updatedAt']);_0x3055cd['body']=_['omit'](_0x3055cd[_0xb2f8('0x4c')],['id',_0xb2f8('0x53'),_0xb2f8('0x54')]);return db[_0xb2f8('0x2e')][_0xb2f8('0x4b')](_['merge'](_0x15b6f3,_0x3055cd[_0xb2f8('0x4c')]),{'include':_0x3055cd[_0xb2f8('0x35')][_0xb2f8('0x45')]?[{'all':!![]}]:undefined})[_0xb2f8('0x25')](function(_0x5b5e07){var _0x323dc4=_0x3055cd['user'][_0xb2f8('0x26')]({'plain':!![]});if(!_0x323dc4)throw new Error(_0xb2f8('0x4d'));if(_0x323dc4['role']==='user'){var _0x14f8bc=_0x5b5e07[_0xb2f8('0x26')]({'plain':!![]});var _0x24e90b=_0xb2f8('0x27');return db[_0xb2f8('0x4f')][_0xb2f8('0x4a')]({'where':{'name':_0x24e90b,'userProfileId':_0x323dc4[_0xb2f8('0x55')]},'raw':!![]})['then'](function(_0x502957){if(_0x502957&&_0x502957[_0xb2f8('0x50')]===0x0){return db['UserProfileResource'][_0xb2f8('0x4b')]({'name':_0x14f8bc[_0xb2f8('0x2b')],'resourceId':_0x14f8bc['id'],'type':_0x502957[_0xb2f8('0x2b')],'sectionId':_0x502957['id']},{})[_0xb2f8('0x25')](function(){return _0x5b5e07;});}else{return _0x5b5e07;}})[_0xb2f8('0x48')](function(_0xe711ac){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe711ac);throw _0xe711ac;});}return _0x5b5e07;});}})[_0xb2f8('0x25')](respondWithResult(_0x2ab423,0xc9))[_0xb2f8('0x48')](handleError(_0x2ab423,null));};exports[_0xb2f8('0x56')]=function(_0x58eabf,_0x3237b5){if(_0x58eabf['body']['id']){delete _0x58eabf[_0xb2f8('0x4c')]['id'];}return db[_0xb2f8('0x2e')][_0xb2f8('0x4a')]({'where':{'id':_0x58eabf[_0xb2f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x3237b5,null))['then'](saveUpdates(_0x58eabf[_0xb2f8('0x4c')],null))[_0xb2f8('0x25')](respondWithResult(_0x3237b5,null))[_0xb2f8('0x48')](handleError(_0x3237b5,null));};exports[_0xb2f8('0x29')]=function(_0xcf6c17,_0x1a5f55){return db['Campaign'][_0xb2f8('0x4a')]({'where':{'id':_0xcf6c17['params']['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0x1a5f55,null))[_0xb2f8('0x25')](removeEntity(_0x1a5f55,null))[_0xb2f8('0x48')](handleError(_0x1a5f55,null));};exports[_0xb2f8('0x57')]=function(_0x4cab97,_0x2eb161,_0x5042c4){var _0x593eb8={'raw':!![],'where':{}};var _0x57cdf0={};var _0x565103={'count':0x0,'rows':[]};return db[_0xb2f8('0x2e')][_0xb2f8('0x58')]({'where':{'id':_0x4cab97[_0xb2f8('0x49')]['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0x2eb161,null))[_0xb2f8('0x25')](function(_0x53db48){if(_0x53db48){_0x57cdf0[_0xb2f8('0x33')]=_[_0xb2f8('0x34')](db['CmHopper'][_0xb2f8('0x2f')]);_0x57cdf0[_0xb2f8('0x35')]=_[_0xb2f8('0x34')](_0x4cab97[_0xb2f8('0x35')]);_0x57cdf0[_0xb2f8('0x36')]=_[_0xb2f8('0x37')](_0x57cdf0[_0xb2f8('0x33')],_0x57cdf0[_0xb2f8('0x35')]);_0x593eb8[_0xb2f8('0x38')]=_[_0xb2f8('0x37')](_0x57cdf0[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x4cab97[_0xb2f8('0x35')]['fields']));_0x593eb8[_0xb2f8('0x38')]=_0x593eb8[_0xb2f8('0x38')][_0xb2f8('0x3a')]?_0x593eb8[_0xb2f8('0x38')]:_0x57cdf0[_0xb2f8('0x33')];if(!_0x4cab97[_0xb2f8('0x35')][_0xb2f8('0x3b')]('nolimit')){_0x593eb8[_0xb2f8('0x1f')]=qs[_0xb2f8('0x1f')](_0x4cab97[_0xb2f8('0x35')]['limit']);_0x593eb8[_0xb2f8('0x21')]=qs[_0xb2f8('0x21')](_0x4cab97['query'][_0xb2f8('0x21')]);}_0x593eb8[_0xb2f8('0x3d')]=qs[_0xb2f8('0x3e')](_0x4cab97[_0xb2f8('0x35')][_0xb2f8('0x3e')]);_0x593eb8[_0xb2f8('0x3f')]=qs[_0xb2f8('0x36')](_[_0xb2f8('0x40')](_0x4cab97[_0xb2f8('0x35')],_0x57cdf0[_0xb2f8('0x36')]));_0x593eb8[_0xb2f8('0x3f')][_0xb2f8('0x59')]=_0x53db48['id'];if(_0x4cab97['query'][_0xb2f8('0x43')]){_0x593eb8[_0xb2f8('0x3f')]=_[_0xb2f8('0x41')](_0x593eb8[_0xb2f8('0x3f')],{'$or':_['map'](_0x593eb8['attributes'],function(_0x503cda){var _0xe1fc99={};_0xe1fc99[_0x503cda]={'$like':'%'+_0x4cab97['query'][_0xb2f8('0x43')]+'%'};return _0xe1fc99;})});}_0x593eb8=_[_0xb2f8('0x41')]({},_0x593eb8,_0x4cab97['options']);return db[_0xb2f8('0x5a')][_0xb2f8('0x20')]({'where':_0x593eb8[_0xb2f8('0x3f')]})['then'](function(_0x277ba3){_0x565103['count']=_0x277ba3;if(_0x4cab97[_0xb2f8('0x35')]['includeAll']){_0x593eb8[_0xb2f8('0x46')]=[{'all':!![]}];}return db[_0xb2f8('0x5a')]['findAll'](_0x593eb8);})['then'](function(_0x30d76a){_0x565103['rows']=_0x30d76a;return _0x565103;});}})[_0xb2f8('0x25')](respondWithFilteredResult(_0x2eb161,_0x593eb8))[_0xb2f8('0x48')](handleError(_0x2eb161,null));};exports['getHopperHistories']=function(_0x5565d5,_0x5af4fd,_0x45923b){var _0x133cad={'raw':!![],'where':{}};var _0x5a9a56={};var _0x4edce7={'count':0x0,'rows':[]};return db[_0xb2f8('0x2e')][_0xb2f8('0x58')]({'where':{'id':_0x5565d5[_0xb2f8('0x49')]['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0x5af4fd,null))[_0xb2f8('0x25')](function(_0x5edb76){if(_0x5edb76){_0x5a9a56[_0xb2f8('0x33')]=_[_0xb2f8('0x34')](db[_0xb2f8('0x5b')][_0xb2f8('0x2f')]);_0x5a9a56['query']=_['keys'](_0x5565d5[_0xb2f8('0x35')]);_0x5a9a56[_0xb2f8('0x36')]=_['intersection'](_0x5a9a56[_0xb2f8('0x33')],_0x5a9a56[_0xb2f8('0x35')]);_0x133cad['attributes']=_[_0xb2f8('0x37')](_0x5a9a56[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x5565d5[_0xb2f8('0x35')][_0xb2f8('0x39')]));_0x133cad[_0xb2f8('0x38')]=_0x133cad['attributes']['length']?_0x133cad[_0xb2f8('0x38')]:_0x5a9a56[_0xb2f8('0x33')];if(!_0x5565d5[_0xb2f8('0x35')]['hasOwnProperty'](_0xb2f8('0x3c'))){_0x133cad[_0xb2f8('0x1f')]=qs[_0xb2f8('0x1f')](_0x5565d5[_0xb2f8('0x35')][_0xb2f8('0x1f')]);_0x133cad['offset']=qs[_0xb2f8('0x21')](_0x5565d5['query']['offset']);}_0x133cad[_0xb2f8('0x3d')]=qs['sort'](_0x5565d5[_0xb2f8('0x35')]['sort']);_0x133cad[_0xb2f8('0x3f')]=qs[_0xb2f8('0x36')](_[_0xb2f8('0x40')](_0x5565d5[_0xb2f8('0x35')],_0x5a9a56[_0xb2f8('0x36')]));_0x133cad[_0xb2f8('0x3f')][_0xb2f8('0x59')]=_0x5edb76['id'];if(_0x5565d5[_0xb2f8('0x35')][_0xb2f8('0x43')]){_0x133cad[_0xb2f8('0x3f')]=_[_0xb2f8('0x41')](_0x133cad[_0xb2f8('0x3f')],{'$or':_[_0xb2f8('0x2d')](_0x133cad[_0xb2f8('0x38')],function(_0x1804bb){var _0x443b88={};_0x443b88[_0x1804bb]={'$like':'%'+_0x5565d5[_0xb2f8('0x35')][_0xb2f8('0x43')]+'%'};return _0x443b88;})});}_0x133cad=_[_0xb2f8('0x41')]({},_0x133cad,_0x5565d5[_0xb2f8('0x44')]);return db['CmHopperHistory'][_0xb2f8('0x20')]({'where':_0x133cad[_0xb2f8('0x3f')]})[_0xb2f8('0x25')](function(_0x179e32){_0x4edce7[_0xb2f8('0x20')]=_0x179e32;if(_0x5565d5[_0xb2f8('0x35')][_0xb2f8('0x45')]){_0x133cad[_0xb2f8('0x46')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb2f8('0x47')](_0x133cad);})[_0xb2f8('0x25')](function(_0x2f2ff2){_0x4edce7[_0xb2f8('0x5c')]=_0x2f2ff2;return _0x4edce7;});}})[_0xb2f8('0x25')](respondWithFilteredResult(_0x5af4fd,_0x133cad))[_0xb2f8('0x48')](handleError(_0x5af4fd,null));};exports[_0xb2f8('0x5d')]=function(_0x55752d,_0x33c383,_0x412dcd){var _0x1b2eab={'raw':!![],'where':{}};var _0x5281ee={};var _0x961baf={'count':0x0,'rows':[]};return db['Campaign'][_0xb2f8('0x58')]({'where':{'id':_0x55752d[_0xb2f8('0x49')]['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0x33c383,null))[_0xb2f8('0x25')](function(_0x26033d){if(_0x26033d){_0x5281ee[_0xb2f8('0x33')]=_[_0xb2f8('0x34')](db[_0xb2f8('0x5e')][_0xb2f8('0x2f')]);_0x5281ee[_0xb2f8('0x35')]=_[_0xb2f8('0x34')](_0x55752d[_0xb2f8('0x35')]);_0x5281ee[_0xb2f8('0x36')]=_[_0xb2f8('0x37')](_0x5281ee[_0xb2f8('0x33')],_0x5281ee[_0xb2f8('0x35')]);_0x1b2eab['attributes']=_[_0xb2f8('0x37')](_0x5281ee[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x55752d[_0xb2f8('0x35')][_0xb2f8('0x39')]));_0x1b2eab[_0xb2f8('0x38')]=_0x1b2eab[_0xb2f8('0x38')][_0xb2f8('0x3a')]?_0x1b2eab[_0xb2f8('0x38')]:_0x5281ee[_0xb2f8('0x33')];if(!_0x55752d[_0xb2f8('0x35')][_0xb2f8('0x3b')](_0xb2f8('0x3c'))){_0x1b2eab[_0xb2f8('0x1f')]=qs['limit'](_0x55752d['query'][_0xb2f8('0x1f')]);_0x1b2eab[_0xb2f8('0x21')]=qs[_0xb2f8('0x21')](_0x55752d[_0xb2f8('0x35')][_0xb2f8('0x21')]);}_0x1b2eab[_0xb2f8('0x3d')]=qs['sort'](_0x55752d['query'][_0xb2f8('0x3e')]);_0x1b2eab[_0xb2f8('0x3f')]=qs['filters'](_[_0xb2f8('0x40')](_0x55752d['query'],_0x5281ee[_0xb2f8('0x36')]));_0x1b2eab[_0xb2f8('0x3f')][_0xb2f8('0x59')]=_0x26033d['id'];if(_0x55752d[_0xb2f8('0x35')][_0xb2f8('0x43')]){_0x1b2eab[_0xb2f8('0x3f')]=_[_0xb2f8('0x41')](_0x1b2eab[_0xb2f8('0x3f')],{'$or':_[_0xb2f8('0x2d')](_0x1b2eab[_0xb2f8('0x38')],function(_0x37dab2){var _0x4faeb6={};_0x4faeb6[_0x37dab2]={'$like':'%'+_0x55752d[_0xb2f8('0x35')][_0xb2f8('0x43')]+'%'};return _0x4faeb6;})});}_0x1b2eab=_[_0xb2f8('0x41')]({},_0x1b2eab,_0x55752d[_0xb2f8('0x44')]);return db[_0xb2f8('0x5e')][_0xb2f8('0x20')]({'where':_0x1b2eab['where']})[_0xb2f8('0x25')](function(_0xf464c1){_0x961baf['count']=_0xf464c1;if(_0x55752d[_0xb2f8('0x35')][_0xb2f8('0x45')]){_0x1b2eab[_0xb2f8('0x46')]=[{'all':!![]}];}return db[_0xb2f8('0x5e')]['findAll'](_0x1b2eab);})[_0xb2f8('0x25')](function(_0x427f03){_0x961baf[_0xb2f8('0x5c')]=_0x427f03;return _0x961baf;});}})[_0xb2f8('0x25')](respondWithFilteredResult(_0x33c383,_0x1b2eab))[_0xb2f8('0x48')](handleError(_0x33c383,null));};exports[_0xb2f8('0x5f')]=function(_0x2a5af8,_0x4c03dc,_0x2a4ca2){var _0x21fb3f={'raw':!![],'where':{}};var _0x595e92={};var _0x1e03cc={'count':0x0,'rows':[]};return db[_0xb2f8('0x2e')][_0xb2f8('0x58')]({'where':{'id':_0x2a5af8['params']['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0x4c03dc,null))['then'](function(_0x1204fc){if(_0x1204fc){_0x595e92[_0xb2f8('0x33')]=_['keys'](db[_0xb2f8('0x60')][_0xb2f8('0x2f')]);_0x595e92['query']=_[_0xb2f8('0x34')](_0x2a5af8['query']);_0x595e92[_0xb2f8('0x36')]=_[_0xb2f8('0x37')](_0x595e92[_0xb2f8('0x33')],_0x595e92[_0xb2f8('0x35')]);_0x21fb3f[_0xb2f8('0x38')]=_[_0xb2f8('0x37')](_0x595e92[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x39')]));_0x21fb3f[_0xb2f8('0x38')]=_0x21fb3f[_0xb2f8('0x38')][_0xb2f8('0x3a')]?_0x21fb3f[_0xb2f8('0x38')]:_0x595e92[_0xb2f8('0x33')];if(!_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x3b')]('nolimit')){_0x21fb3f[_0xb2f8('0x1f')]=qs[_0xb2f8('0x1f')](_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x1f')]);_0x21fb3f['offset']=qs[_0xb2f8('0x21')](_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x21')]);}_0x21fb3f[_0xb2f8('0x3d')]=qs[_0xb2f8('0x3e')](_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x3e')]);_0x21fb3f[_0xb2f8('0x3f')]=qs[_0xb2f8('0x36')](_[_0xb2f8('0x40')](_0x2a5af8[_0xb2f8('0x35')],_0x595e92[_0xb2f8('0x36')]));_0x21fb3f['where'][_0xb2f8('0x59')]=_0x1204fc['id'];if(_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x43')]){_0x21fb3f['where']=_[_0xb2f8('0x41')](_0x21fb3f['where'],{'$or':_[_0xb2f8('0x2d')](_0x21fb3f[_0xb2f8('0x38')],function(_0x15aedb){var _0x5a43a1={};_0x5a43a1[_0x15aedb]={'$like':'%'+_0x2a5af8[_0xb2f8('0x35')][_0xb2f8('0x43')]+'%'};return _0x5a43a1;})});}_0x21fb3f=_[_0xb2f8('0x41')]({},_0x21fb3f,_0x2a5af8[_0xb2f8('0x44')]);return db[_0xb2f8('0x60')]['count']({'where':_0x21fb3f[_0xb2f8('0x3f')]})[_0xb2f8('0x25')](function(_0x4c1077){_0x1e03cc[_0xb2f8('0x20')]=_0x4c1077;if(_0x2a5af8['query']['includeAll']){_0x21fb3f[_0xb2f8('0x46')]=[{'all':!![]}];}return db[_0xb2f8('0x60')][_0xb2f8('0x47')](_0x21fb3f);})[_0xb2f8('0x25')](function(_0x502281){_0x1e03cc[_0xb2f8('0x5c')]=_0x502281;return _0x1e03cc;});}})[_0xb2f8('0x25')](respondWithFilteredResult(_0x4c03dc,_0x21fb3f))['catch'](handleError(_0x4c03dc,null));};exports[_0xb2f8('0x61')]=function(_0xfc97c4,_0x2d1f0f,_0x23e06c){var _0x563721={};var _0x259d5c={};var _0x219219;var _0x1827cc;return db[_0xb2f8('0x2e')][_0xb2f8('0x58')]({'where':{'id':_0xfc97c4[_0xb2f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x2d1f0f,null))[_0xb2f8('0x25')](function(_0x38b1d1){if(_0x38b1d1){_0x219219=_0x38b1d1;_0x259d5c[_0xb2f8('0x33')]=_['keys'](db[_0xb2f8('0x62')][_0xb2f8('0x2f')]);_0x259d5c[_0xb2f8('0x35')]=_[_0xb2f8('0x34')](_0xfc97c4[_0xb2f8('0x35')]);_0x259d5c[_0xb2f8('0x36')]=_[_0xb2f8('0x37')](_0x259d5c[_0xb2f8('0x33')],_0x259d5c['query']);_0x563721[_0xb2f8('0x38')]=_[_0xb2f8('0x37')](_0x259d5c['model'],qs[_0xb2f8('0x39')](_0xfc97c4[_0xb2f8('0x35')]['fields']));_0x563721['attributes']=_0x563721[_0xb2f8('0x38')]['length']?_0x563721[_0xb2f8('0x38')]:_0x259d5c['model'];_0x563721[_0xb2f8('0x3d')]=qs[_0xb2f8('0x3e')](_0xfc97c4[_0xb2f8('0x35')]['sort']);_0x563721[_0xb2f8('0x3f')]=qs['filters'](_[_0xb2f8('0x40')](_0xfc97c4[_0xb2f8('0x35')],_0x259d5c[_0xb2f8('0x36')]));if(_0xfc97c4[_0xb2f8('0x35')][_0xb2f8('0x43')]){_0x563721['where']=_[_0xb2f8('0x41')](_0x563721[_0xb2f8('0x3f')],{'$or':_[_0xb2f8('0x2d')](_0x563721['attributes'],function(_0x48a96a){var _0x1426f8={};_0x1426f8[_0x48a96a]={'$like':'%'+_0xfc97c4[_0xb2f8('0x35')][_0xb2f8('0x43')]+'%'};return _0x1426f8;})});}_0x563721=_[_0xb2f8('0x41')]({},_0x563721,_0xfc97c4['options']);return _0x219219[_0xb2f8('0x61')](_0x563721);}})[_0xb2f8('0x25')](function(_0x3a67e6){if(_0x3a67e6){_0x1827cc=_0x3a67e6['length'];if(!_0xfc97c4['query'][_0xb2f8('0x3b')]('nolimit')){_0x563721[_0xb2f8('0x1f')]=qs[_0xb2f8('0x1f')](_0xfc97c4[_0xb2f8('0x35')][_0xb2f8('0x1f')]);_0x563721[_0xb2f8('0x21')]=qs[_0xb2f8('0x21')](_0xfc97c4['query'][_0xb2f8('0x21')]);}return _0x219219[_0xb2f8('0x61')](_0x563721);}})['then'](function(_0x563319){if(_0x563319){return _0x563319?{'count':_0x1827cc,'rows':_0x563319}:null;}})[_0xb2f8('0x25')](respondWithResult(_0x2d1f0f,null))[_0xb2f8('0x48')](handleError(_0x2d1f0f,null));};exports['addLists']=function(_0x3e1faf,_0x355992,_0x571caa){var _0x4995d0,_0x17c4d5;var _0x279fcb=[];var _0x12a01b=moment()[_0xb2f8('0x63')](_0xb2f8('0x64'));return db[_0xb2f8('0x2e')][_0xb2f8('0x4a')]({'where':{'id':_0x3e1faf['params']['id']}})['then'](handleEntityNotFound(_0x355992,null))[_0xb2f8('0x25')](function(_0x2de502){if(_0x2de502){_0x17c4d5=_0x2de502;return _0x2de502[_0xb2f8('0x65')](_0x3e1faf[_0xb2f8('0x4c')][_0xb2f8('0x66')],_[_0xb2f8('0x67')](_0x3e1faf[_0xb2f8('0x4c')],[_0xb2f8('0x66'),'id'])||{});}return null;})[_0xb2f8('0x68')](function(_0x2fb93d){var _0x50d23e;var _0x3d07b8;_0x4995d0=_0x2fb93d||[];var _0x384e5e=[];if(_0x2fb93d){for(var _0x4dcb85=0x0;_0x4dcb85<_0x2fb93d[_0xb2f8('0x3a')];_0x4dcb85+=0x1){var _0x52dadf=_0x2fb93d[_0x4dcb85]['get']({'plain':!![]});_0x17c4d5['dialCheckDuplicateType']=_0x3e1faf[_0xb2f8('0x4c')][_0xb2f8('0x69')]?_0x3e1faf[_0xb2f8('0x4c')][_0xb2f8('0x69')]:_0x17c4d5[_0xb2f8('0x69')];switch(_0x17c4d5['dialCheckDuplicateType']){case _0xb2f8('0x6a'):_0x50d23e=squel['insert']()[_0xb2f8('0x6b')](_0xb2f8('0x6c'))[_0xb2f8('0x6d')]([_0xb2f8('0x6e'),_0xb2f8('0x6f'),_0xb2f8('0x70'),'ListId','CampaignId',_0xb2f8('0x53'),_0xb2f8('0x54')],squel[_0xb2f8('0x71')]()[_0xb2f8('0x72')](_0xb2f8('0x6e'),_0xb2f8('0x6e'))['field'](_0xb2f8('0x73'),_0xb2f8('0x6f'))[_0xb2f8('0x72')]('id',_0xb2f8('0x70'))['field'](_0x52dadf['CmListId'][_0xb2f8('0x74')](),_0xb2f8('0x75'))['field'](_0x3e1faf[_0xb2f8('0x49')]['id'][_0xb2f8('0x74')](),'CampaignId')['field']('\x27'+_0x12a01b+'\x27',_0xb2f8('0x53'))[_0xb2f8('0x72')]('\x27'+_0x12a01b+'\x27',_0xb2f8('0x54'))[_0xb2f8('0x76')](_0xb2f8('0x77'))['where'](_0xb2f8('0x78'))[_0xb2f8('0x3f')](_0xb2f8('0x79'),_0x52dadf[_0xb2f8('0x7a')][_0xb2f8('0x74')]())[_0xb2f8('0x3f')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xb2f8('0x7b'),squel[_0xb2f8('0x71')]()[_0xb2f8('0x72')](_0xb2f8('0x7c'))[_0xb2f8('0x76')](_0xb2f8('0x7d'))['where'](_0xb2f8('0x7e'),_0x3e1faf[_0xb2f8('0x49')]['id']['toString']()))[_0xb2f8('0x3f')](_0xb2f8('0x7b'),squel[_0xb2f8('0x71')]()[_0xb2f8('0x72')]('COALESCE(phone,\x27\x27)')['from'](_0xb2f8('0x6c'))[_0xb2f8('0x3f')]('CampaignId\x20=\x20?',_0x3e1faf[_0xb2f8('0x49')]['id'][_0xb2f8('0x74')]())))['toString']();break;case _0xb2f8('0x7f'):_0x50d23e=squel[_0xb2f8('0x80')]()['into'](_0xb2f8('0x6c'))[_0xb2f8('0x6d')]([_0xb2f8('0x6e'),_0xb2f8('0x6f'),_0xb2f8('0x70'),_0xb2f8('0x75'),_0xb2f8('0x59'),'createdAt',_0xb2f8('0x54')],squel[_0xb2f8('0x71')]()[_0xb2f8('0x72')](_0xb2f8('0x6e'),_0xb2f8('0x6e'))['field'](_0xb2f8('0x73'),_0xb2f8('0x6f'))[_0xb2f8('0x72')]('id',_0xb2f8('0x70'))[_0xb2f8('0x72')](_0x52dadf[_0xb2f8('0x7a')][_0xb2f8('0x74')](),_0xb2f8('0x75'))[_0xb2f8('0x72')](_0x3e1faf[_0xb2f8('0x49')]['id'][_0xb2f8('0x74')](),'CampaignId')[_0xb2f8('0x72')]('\x27'+_0x12a01b+'\x27',_0xb2f8('0x53'))[_0xb2f8('0x72')]('\x27'+_0x12a01b+'\x27','updatedAt')[_0xb2f8('0x76')](_0xb2f8('0x77'))[_0xb2f8('0x3f')](_0xb2f8('0x78'))[_0xb2f8('0x3f')](_0xb2f8('0x79'),_0x52dadf['CmListId']['toString']())[_0xb2f8('0x3f')](_0xb2f8('0x81'))[_0xb2f8('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb2f8('0x71')]()[_0xb2f8('0x72')](_0xb2f8('0x82'))['from'](_0xb2f8('0x6c'))[_0xb2f8('0x3f')](_0xb2f8('0x7e'),_0x3e1faf['params']['id'][_0xb2f8('0x74')]())))[_0xb2f8('0x74')]();break;default:_0x50d23e=squel[_0xb2f8('0x80')]()[_0xb2f8('0x6b')](_0xb2f8('0x6c'))['fromQuery']([_0xb2f8('0x6e'),'scheduledAt',_0xb2f8('0x70'),'ListId',_0xb2f8('0x59'),_0xb2f8('0x53'),_0xb2f8('0x54')],squel['select']()[_0xb2f8('0x72')](_0xb2f8('0x6e'),'phone')[_0xb2f8('0x72')](_0xb2f8('0x73'),'scheduledAt')['field']('id',_0xb2f8('0x70'))['field'](_0x52dadf[_0xb2f8('0x7a')]['toString'](),'ListId')[_0xb2f8('0x72')](_0x3e1faf[_0xb2f8('0x49')]['id'][_0xb2f8('0x74')](),_0xb2f8('0x59'))[_0xb2f8('0x72')]('\x27'+_0x12a01b+'\x27',_0xb2f8('0x53'))['field']('\x27'+_0x12a01b+'\x27',_0xb2f8('0x54'))[_0xb2f8('0x76')](_0xb2f8('0x77'))[_0xb2f8('0x3f')](_0xb2f8('0x78'))['where'](_0xb2f8('0x79'),_0x52dadf['CmListId']['toString']())[_0xb2f8('0x3f')](_0xb2f8('0x81')))[_0xb2f8('0x74')]();}_0x3d07b8=squel['insert']()[_0xb2f8('0x6b')](_0xb2f8('0x83'))[_0xb2f8('0x6d')](['cmHopperId',_0xb2f8('0x6f'),_0xb2f8('0x6e'),_0xb2f8('0x84'),'createdAt','updatedAt'],squel[_0xb2f8('0x71')]()[_0xb2f8('0x72')](_0xb2f8('0x85'),'id')[_0xb2f8('0x72')](_0xb2f8('0x73'),_0xb2f8('0x6f'))[_0xb2f8('0x72')](_0xb2f8('0x86'),'phone')[_0xb2f8('0x72')]('ci.OrderBY',_0xb2f8('0x84'))[_0xb2f8('0x72')]('\x27'+_0x12a01b+'\x27','createdAt')[_0xb2f8('0x72')]('\x27'+_0x12a01b+'\x27',_0xb2f8('0x54'))[_0xb2f8('0x76')]('cm_contact_has_items','ci')[_0xb2f8('0x87')](_0xb2f8('0x6c'),'h',_0xb2f8('0x88'))['where']('h.ListId\x20=\x20?',_0x52dadf[_0xb2f8('0x7a')][_0xb2f8('0x74')]())[_0xb2f8('0x3f')](_0xb2f8('0x89'),_0x3e1faf['params']['id']['toString']())['where'](_0xb2f8('0x8a'),_0x12a01b))[_0xb2f8('0x74')]();_0x384e5e['push'](db[_0xb2f8('0x8b')][_0xb2f8('0x35')](_0x50d23e));_0x279fcb['push'](db['sequelize'][_0xb2f8('0x35')](_0x3d07b8));}return BPromise[_0xb2f8('0x8c')](_0x384e5e);}})[_0xb2f8('0x25')](function(){return BPromise['all'](_0x279fcb);})['then'](function(){return _0x4995d0;})[_0xb2f8('0x25')](respondWithResult(_0x355992,null))[_0xb2f8('0x48')](handleError(_0x355992,null));};exports[_0xb2f8('0x8d')]=function(_0x48cf95,_0xa46ced,_0x1e8adf){return db[_0xb2f8('0x2e')][_0xb2f8('0x4a')]({'where':{'id':_0x48cf95['params']['id']}})['then'](handleEntityNotFound(_0xa46ced,null))[_0xb2f8('0x25')](function(_0x1fade5){if(_0x1fade5){return _0x1fade5[_0xb2f8('0x8d')](_0x48cf95[_0xb2f8('0x35')][_0xb2f8('0x66')]);}})[_0xb2f8('0x25')](function(_0x5ca1e1){if(_0x5ca1e1){return db['CmHopper'][_0xb2f8('0x29')]({'where':{'ListId':_0x48cf95[_0xb2f8('0x35')][_0xb2f8('0x66')],'CampaignId':_0x48cf95[_0xb2f8('0x49')]['id']}})[_0xb2f8('0x25')](function(){return _0x5ca1e1;});}})[_0xb2f8('0x25')](respondWithStatusCode(_0xa46ced,null))[_0xb2f8('0x48')](handleError(_0xa46ced,null));};exports[_0xb2f8('0x8e')]=function(_0x399932,_0xef48b0,_0xf6b06a){var _0x245e97={};var _0x15c77d={};var _0x5f15c1;var _0x59133e;return db[_0xb2f8('0x2e')]['findOne']({'where':{'id':_0x399932[_0xb2f8('0x49')]['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0xef48b0,null))[_0xb2f8('0x25')](function(_0x12f679){if(_0x12f679){_0x5f15c1=_0x12f679;_0x15c77d[_0xb2f8('0x33')]=_[_0xb2f8('0x34')](db[_0xb2f8('0x62')][_0xb2f8('0x2f')]);_0x15c77d[_0xb2f8('0x35')]=_[_0xb2f8('0x34')](_0x399932[_0xb2f8('0x35')]);_0x15c77d['filters']=_[_0xb2f8('0x37')](_0x15c77d[_0xb2f8('0x33')],_0x15c77d[_0xb2f8('0x35')]);_0x245e97[_0xb2f8('0x38')]=_[_0xb2f8('0x37')](_0x15c77d[_0xb2f8('0x33')],qs[_0xb2f8('0x39')](_0x399932[_0xb2f8('0x35')][_0xb2f8('0x39')]));_0x245e97[_0xb2f8('0x38')]=_0x245e97['attributes'][_0xb2f8('0x3a')]?_0x245e97[_0xb2f8('0x38')]:_0x15c77d[_0xb2f8('0x33')];_0x245e97[_0xb2f8('0x3d')]=qs['sort'](_0x399932[_0xb2f8('0x35')][_0xb2f8('0x3e')]);_0x245e97[_0xb2f8('0x3f')]=qs[_0xb2f8('0x36')](_[_0xb2f8('0x40')](_0x399932[_0xb2f8('0x35')],_0x15c77d[_0xb2f8('0x36')]));if(_0x399932['query']['filter']){_0x245e97[_0xb2f8('0x3f')]=_[_0xb2f8('0x41')](_0x245e97[_0xb2f8('0x3f')],{'$or':_[_0xb2f8('0x2d')](_0x245e97[_0xb2f8('0x38')],function(_0x5a8ce1){var _0x117946={};_0x117946[_0x5a8ce1]={'$like':'%'+_0x399932[_0xb2f8('0x35')][_0xb2f8('0x43')]+'%'};return _0x117946;})});}_0x245e97=_[_0xb2f8('0x41')]({},_0x245e97,_0x399932[_0xb2f8('0x44')]);return _0x5f15c1['getBlackLists'](_0x245e97);}})[_0xb2f8('0x25')](function(_0x57b1d1){if(_0x57b1d1){_0x59133e=_0x57b1d1[_0xb2f8('0x3a')];if(!_0x399932[_0xb2f8('0x35')][_0xb2f8('0x3b')](_0xb2f8('0x3c'))){_0x245e97[_0xb2f8('0x1f')]=qs[_0xb2f8('0x1f')](_0x399932[_0xb2f8('0x35')][_0xb2f8('0x1f')]);_0x245e97[_0xb2f8('0x21')]=qs[_0xb2f8('0x21')](_0x399932['query'][_0xb2f8('0x21')]);}return _0x5f15c1[_0xb2f8('0x8e')](_0x245e97);}})[_0xb2f8('0x25')](function(_0x538c38){if(_0x538c38){return _0x538c38?{'count':_0x59133e,'rows':_0x538c38}:null;}})[_0xb2f8('0x25')](respondWithResult(_0xef48b0,null))[_0xb2f8('0x48')](handleError(_0xef48b0,null));};exports['addBlackLists']=function(_0x394f30,_0x3fa255,_0xff1ebc){var _0x2fa8be,_0x242354;var _0x59b9cf=[];var _0x4fec0f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return db[_0xb2f8('0x2e')][_0xb2f8('0x4a')]({'where':{'id':_0x394f30[_0xb2f8('0x49')]['id']}})[_0xb2f8('0x25')](handleEntityNotFound(_0x3fa255,null))[_0xb2f8('0x25')](function(_0x4ee990){if(_0x4ee990){_0x242354=_0x4ee990;return _0x4ee990['addBlackLists'](_0x394f30['body'][_0xb2f8('0x66')],_[_0xb2f8('0x67')](_0x394f30[_0xb2f8('0x4c')],[_0xb2f8('0x66'),'id'])||{});}return null;})['spread'](function(_0x4ea3cf){var _0x531d2f;var _0x17f37e;_0x2fa8be=_0x4ea3cf||[];var _0x446ef1=[];if(_0x4ea3cf){for(var _0x4a08dc=0x0;_0x4a08dc<_0x4ea3cf[_0xb2f8('0x3a')];_0x4a08dc+=0x1){var _0x1accc6=_0x4ea3cf[_0x4a08dc][_0xb2f8('0x26')]({'plain':!![]});_0x531d2f=squel[_0xb2f8('0x80')]()[_0xb2f8('0x6b')](_0xb2f8('0x8f'))[_0xb2f8('0x6d')]([_0xb2f8('0x6e'),_0xb2f8('0x70'),_0xb2f8('0x75'),_0xb2f8('0x59'),_0xb2f8('0x53'),_0xb2f8('0x54')],squel['select']()['field'](_0xb2f8('0x6e'),_0xb2f8('0x6e'))[_0xb2f8('0x72')]('id',_0xb2f8('0x70'))[_0xb2f8('0x72')](_0x1accc6[_0xb2f8('0x7a')][_0xb2f8('0x74')](),'ListId')[_0xb2f8('0x72')](_0x394f30['params']['id'][_0xb2f8('0x74')](),_0xb2f8('0x59'))[_0xb2f8('0x72')](_0xb2f8('0x73'),_0xb2f8('0x53'))['field'](_0xb2f8('0x73'),_0xb2f8('0x54'))['from'](_0xb2f8('0x77'))[_0xb2f8('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0xb2f8('0x79'),_0x1accc6[_0xb2f8('0x7a')][_0xb2f8('0x74')]())[_0xb2f8('0x3f')](_0xb2f8('0x81')))['toString']();_0x446ef1[_0xb2f8('0x90')](db['sequelize'][_0xb2f8('0x35')](_0x531d2f));}return BPromise[_0xb2f8('0x8c')](_0x446ef1);}})['then'](function(){return _0x2fa8be;})[_0xb2f8('0x25')](respondWithResult(_0x3fa255,null))['catch'](handleError(_0x3fa255,null));};exports['removeBlackLists']=function(_0xdf826e,_0x586c3d,_0x43f9ee){return db[_0xb2f8('0x2e')][_0xb2f8('0x4a')]({'where':{'id':_0xdf826e[_0xb2f8('0x49')]['id']}})['then'](handleEntityNotFound(_0x586c3d,null))[_0xb2f8('0x25')](function(_0x3ab3e4){if(_0x3ab3e4){return _0x3ab3e4['removeBlackLists'](_0xdf826e['query'][_0xb2f8('0x66')]);}})[_0xb2f8('0x25')](function(_0x4d6a5e){if(_0x4d6a5e){return db['CmHopperBlack'][_0xb2f8('0x29')]({'where':{'ListId':_0xdf826e[_0xb2f8('0x35')][_0xb2f8('0x66')],'CampaignId':_0xdf826e['params']['id']}})[_0xb2f8('0x25')](function(){return _0x4d6a5e;});}})[_0xb2f8('0x25')](respondWithStatusCode(_0x586c3d,null))['catch'](handleError(_0x586c3d,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index d7e2da4..78120db 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(_0x3b6778,_0x57ddd4){var _0x4061de=function(_0x3c5060){while(--_0x3c5060){_0x3b6778['push'](_0x3b6778['shift']());}};_0x4061de(++_0x57ddd4);}(_0x7a54,0x106));var _0x47a5=function(_0x39800f,_0x14ab33){_0x39800f=_0x39800f-0x0;var _0x23b0b6=_0x7a54[_0x39800f];return _0x23b0b6;};'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(_0x2c5ff3,_0xf7e6b2){var _0x131838=function(_0x2cf1c6){while(--_0x2cf1c6){_0x2c5ff3['push'](_0x2c5ff3['shift']());}};_0x131838(++_0xf7e6b2);}(_0x7a54,0x106));var _0x47a5=function(_0x3f06b8,_0x42c2d4){_0x3f06b8=_0x3f06b8-0x0;var _0xfc96e7=_0x7a54[_0x3f06b8];return _0xfc96e7;};'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 1f5e9e3..bf4fc31 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 _0x3379=['attributes','map','include','model','GetCampaign','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Campaign','findAll','options','raw','where'];(function(_0x58cc03,_0x35315d){var _0x27deda=function(_0x28e198){while(--_0x28e198){_0x58cc03['push'](_0x58cc03['shift']());}};_0x27deda(++_0x35315d);}(_0x3379,0x115));var _0x9337=function(_0x3191be,_0x47b026){_0x3191be=_0x3191be-0x0;var _0x3b3e79=_0x3379[_0x3191be];return _0x3b3e79;};'use strict';var _=require(_0x9337('0x0'));var util=require(_0x9337('0x1'));var moment=require(_0x9337('0x2'));var BPromise=require(_0x9337('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9337('0x4'));var db=require(_0x9337('0x5'))['db'];var utils=require(_0x9337('0x6'));var logger=require(_0x9337('0x7'))('rpc');var config=require(_0x9337('0x8'));var jayson=require(_0x9337('0x9'));var client=jayson[_0x9337('0xa')][_0x9337('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a59ab,_0x16e2a4,_0x5b1986){return new BPromise(function(_0x268943,_0xdaec59){return client[_0x9337('0xc')](_0x5a59ab,_0x5b1986)[_0x9337('0xd')](function(_0x15c578){logger['info'](_0x9337('0xe'),_0x16e2a4,_0x9337('0xf'));logger[_0x9337('0x10')](_0x9337('0x11'),_0x16e2a4,_0x9337('0xf'),JSON['stringify'](_0x15c578));if(_0x15c578[_0x9337('0x12')]){if(_0x15c578[_0x9337('0x12')][_0x9337('0x13')]===0x1f4){logger[_0x9337('0x12')](_0x9337('0xe'),_0x16e2a4,_0x15c578[_0x9337('0x12')][_0x9337('0x14')]);return _0xdaec59(_0x15c578['error']['message']);}logger[_0x9337('0x12')](_0x9337('0xe'),_0x16e2a4,_0x15c578[_0x9337('0x12')][_0x9337('0x14')]);return _0x268943(_0x15c578['error']['message']);}else{logger[_0x9337('0x15')]('Campaign,\x20%s,\x20%s',_0x16e2a4,'request\x20sent');_0x268943(_0x15c578[_0x9337('0x16')][_0x9337('0x14')]);}})[_0x9337('0x17')](function(_0x48644e){logger[_0x9337('0x12')](_0x9337('0xe'),_0x16e2a4,_0x48644e);_0xdaec59(_0x48644e);});});}exports['GetCampaign']=function(_0x5e49e7){var _0x424f11=this;return new Promise(function(_0x462196,_0x4a27cc){return db[_0x9337('0x18')][_0x9337('0x19')]({'raw':_0x5e49e7['options']?_0x5e49e7[_0x9337('0x1a')][_0x9337('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e49e7['options']?_0x5e49e7[_0x9337('0x1a')][_0x9337('0x1c')]||null:null,'attributes':_0x5e49e7['options']?_0x5e49e7['options'][_0x9337('0x1d')]||null:null,'limit':_0x5e49e7['options']?_0x5e49e7[_0x9337('0x1a')]['limit']||null:null,'include':_0x5e49e7[_0x9337('0x1a')]?_0x5e49e7['options']['include']?_[_0x9337('0x1e')](_0x5e49e7['options'][_0x9337('0x1f')],function(_0x543cfc){return{'model':db[_0x543cfc[_0x9337('0x20')]],'as':_0x543cfc['as'],'attributes':_0x543cfc[_0x9337('0x1d')],'include':_0x543cfc[_0x9337('0x1f')]?_[_0x9337('0x1e')](_0x543cfc[_0x9337('0x1f')],function(_0xb49ff1){return{'model':db[_0xb49ff1['model']],'as':_0xb49ff1['as'],'attributes':_0xb49ff1['attributes'],'include':_0xb49ff1[_0x9337('0x1f')]?_[_0x9337('0x1e')](_0xb49ff1[_0x9337('0x1f')],function(_0x178ed5){return{'model':db[_0x178ed5['model']],'as':_0x178ed5['as'],'attributes':_0x178ed5[_0x9337('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2e2c6e){logger[_0x9337('0x15')](_0x9337('0x21'),_0x5e49e7);logger[_0x9337('0x10')]('GetCampaign',_0x5e49e7,JSON['stringify'](_0x2e2c6e));_0x462196(_0x2e2c6e);})[_0x9337('0x17')](function(_0x1bcb04){logger[_0x9337('0x12')](_0x9337('0x21'),_0x1bcb04[_0x9337('0x14')],_0x5e49e7);_0x4a27cc(_0x424f11['error'](0x1f4,_0x1bcb04[_0x9337('0x14')]));});});}; \ No newline at end of file +var _0xaf80=['then','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Campaign,\x20%s,\x20%s','Campaign,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetCampaign','options','raw','attributes','limit','include','map','model'];(function(_0x2b6b89,_0x172ec0){var _0x5aa6af=function(_0x19cd5e){while(--_0x19cd5e){_0x2b6b89['push'](_0x2b6b89['shift']());}};_0x5aa6af(++_0x172ec0);}(_0xaf80,0x1ef));var _0x0af8=function(_0x94cfd6,_0x3a4bd8){_0x94cfd6=_0x94cfd6-0x0;var _0x581ca8=_0xaf80[_0x94cfd6];return _0x581ca8;};'use strict';var _=require(_0x0af8('0x0'));var util=require(_0x0af8('0x1'));var moment=require(_0x0af8('0x2'));var BPromise=require(_0x0af8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0af8('0x4'));var logger=require(_0x0af8('0x5'))(_0x0af8('0x6'));var config=require(_0x0af8('0x7'));var jayson=require(_0x0af8('0x8'));var client=jayson[_0x0af8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4bce2c,_0x28f555,_0x538c1c){return new BPromise(function(_0x207a9b,_0x430bd4){return client[_0x0af8('0xa')](_0x4bce2c,_0x538c1c)['then'](function(_0xc0d5eb){logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,'request\x20sent');logger['debug'](_0x0af8('0xd'),_0x28f555,_0x0af8('0xe'),JSON[_0x0af8('0xf')](_0xc0d5eb));if(_0xc0d5eb[_0x0af8('0x10')]){if(_0xc0d5eb[_0x0af8('0x10')]['code']===0x1f4){logger[_0x0af8('0x10')](_0x0af8('0xc'),_0x28f555,_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);return _0x430bd4(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}logger[_0x0af8('0x10')]('Campaign,\x20%s,\x20%s',_0x28f555,_0xc0d5eb['error'][_0x0af8('0x11')]);return _0x207a9b(_0xc0d5eb[_0x0af8('0x10')][_0x0af8('0x11')]);}else{logger[_0x0af8('0xb')](_0x0af8('0xc'),_0x28f555,_0x0af8('0xe'));_0x207a9b(_0xc0d5eb[_0x0af8('0x12')][_0x0af8('0x11')]);}})['catch'](function(_0x5f4275){logger['error'](_0x0af8('0xc'),_0x28f555,_0x5f4275);_0x430bd4(_0x5f4275);});});}exports[_0x0af8('0x13')]=function(_0x54e946){var _0x2ace30=this;return new Promise(function(_0x230a68,_0x38068d){return db['Campaign']['findAll']({'raw':_0x54e946['options']?_0x54e946[_0x0af8('0x14')][_0x0af8('0x15')]===undefined?!![]:![]:!![],'where':_0x54e946['options']?_0x54e946[_0x0af8('0x14')]['where']||null:null,'attributes':_0x54e946['options']?_0x54e946[_0x0af8('0x14')][_0x0af8('0x16')]||null:null,'limit':_0x54e946[_0x0af8('0x14')]?_0x54e946[_0x0af8('0x14')][_0x0af8('0x17')]||null:null,'include':_0x54e946['options']?_0x54e946['options'][_0x0af8('0x18')]?_[_0x0af8('0x19')](_0x54e946[_0x0af8('0x14')][_0x0af8('0x18')],function(_0x320d0c){return{'model':db[_0x320d0c[_0x0af8('0x1a')]],'as':_0x320d0c['as'],'attributes':_0x320d0c[_0x0af8('0x16')],'include':_0x320d0c[_0x0af8('0x18')]?_['map'](_0x320d0c['include'],function(_0x1c6306){return{'model':db[_0x1c6306[_0x0af8('0x1a')]],'as':_0x1c6306['as'],'attributes':_0x1c6306[_0x0af8('0x16')],'include':_0x1c6306[_0x0af8('0x18')]?_['map'](_0x1c6306['include'],function(_0x315ad){return{'model':db[_0x315ad[_0x0af8('0x1a')]],'as':_0x315ad['as'],'attributes':_0x315ad[_0x0af8('0x16')]};}):[]};}):[]};}):[]:[]})[_0x0af8('0x1b')](function(_0x2e8853){logger[_0x0af8('0xb')](_0x0af8('0x13'),_0x54e946);logger['debug'](_0x0af8('0x13'),_0x54e946,JSON[_0x0af8('0xf')](_0x2e8853));_0x230a68(_0x2e8853);})[_0x0af8('0x1c')](function(_0x20eab4){logger[_0x0af8('0x10')](_0x0af8('0x13'),_0x20eab4[_0x0af8('0x11')],_0x54e946);_0x38068d(_0x2ace30[_0x0af8('0x10')](0x1f4,_0x20eab4[_0x0af8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 80ba23f..c12fef2 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 _0x08e7=['/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','/:id/clone','clone','addLists','/:id/blacklists','put','update','delete','destroy','removeLists','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x5dcf96,_0x287bf0){var _0x385d5d=function(_0x1ddd2f){while(--_0x1ddd2f){_0x5dcf96['push'](_0x5dcf96['shift']());}};_0x385d5d(++_0x287bf0);}(_0x08e7,0x9d));var _0x708e=function(_0x3fbc49,_0x416d37){_0x3fbc49=_0x3fbc49-0x0;var _0x5c57b0=_0x08e7[_0x3fbc49];return _0x5c57b0;};'use strict';var multer=require(_0x708e('0x0'));var util=require(_0x708e('0x1'));var path=require(_0x708e('0x2'));var timeout=require(_0x708e('0x3'));var express=require(_0x708e('0x4'));var router=express[_0x708e('0x5')]();var fs_extra=require(_0x708e('0x6'));var auth=require(_0x708e('0x7'));var interaction=require(_0x708e('0x8'));var config=require('../../config/environment');var controller=require(_0x708e('0x9'));router[_0x708e('0xa')]('/',auth[_0x708e('0xb')](),controller['index']);router[_0x708e('0xa')](_0x708e('0xc'),auth[_0x708e('0xb')](),controller[_0x708e('0xd')]);router['get'](_0x708e('0xe'),auth[_0x708e('0xb')](),controller[_0x708e('0xf')]);router['get'](_0x708e('0x10'),auth[_0x708e('0xb')](),controller[_0x708e('0x11')]);router[_0x708e('0xa')](_0x708e('0x12'),auth[_0x708e('0xb')](),controller[_0x708e('0x13')]);router[_0x708e('0xa')](_0x708e('0x14'),auth[_0x708e('0xb')](),controller[_0x708e('0x15')]);router[_0x708e('0xa')](_0x708e('0x16'),auth[_0x708e('0xb')](),controller[_0x708e('0x17')]);router[_0x708e('0xa')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x708e('0x18')]);router[_0x708e('0x19')]('/',auth['isAuthenticated'](),controller['create']);router[_0x708e('0x19')](_0x708e('0x1a'),auth[_0x708e('0xb')](),controller[_0x708e('0x1b')]);router[_0x708e('0x19')](_0x708e('0x16'),auth[_0x708e('0xb')](),controller[_0x708e('0x1c')]);router[_0x708e('0x19')](_0x708e('0x1d'),auth[_0x708e('0xb')](),controller['addBlackLists']);router[_0x708e('0x1e')](_0x708e('0xc'),auth[_0x708e('0xb')](),controller[_0x708e('0x1f')]);router[_0x708e('0x20')](_0x708e('0xc'),auth[_0x708e('0xb')](),controller[_0x708e('0x21')]);router['delete'](_0x708e('0x16'),auth['isAuthenticated'](),controller[_0x708e('0x22')]);router['delete'](_0x708e('0x1d'),auth[_0x708e('0xb')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0xb67d=['put','update','delete','removeLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists'];(function(_0xdd7006,_0x3e28fb){var _0x1219ad=function(_0x58aeb5){while(--_0x58aeb5){_0xdd7006['push'](_0xdd7006['shift']());}};_0x1219ad(++_0x3e28fb);}(_0xb67d,0x1ef));var _0xdb67=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb67d[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xdb67('0x0'));var util=require(_0xdb67('0x1'));var path=require(_0xdb67('0x2'));var timeout=require(_0xdb67('0x3'));var express=require(_0xdb67('0x4'));var router=express[_0xdb67('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdb67('0x6'));var interaction=require(_0xdb67('0x7'));var config=require(_0xdb67('0x8'));var controller=require(_0xdb67('0x9'));router[_0xdb67('0xa')]('/',auth[_0xdb67('0xb')](),controller['index']);router[_0xdb67('0xa')](_0xdb67('0xc'),auth[_0xdb67('0xb')](),controller[_0xdb67('0xd')]);router[_0xdb67('0xa')](_0xdb67('0xe'),auth[_0xdb67('0xb')](),controller[_0xdb67('0xf')]);router[_0xdb67('0xa')](_0xdb67('0x10'),auth[_0xdb67('0xb')](),controller[_0xdb67('0x11')]);router[_0xdb67('0xa')](_0xdb67('0x12'),auth[_0xdb67('0xb')](),controller[_0xdb67('0x13')]);router['get'](_0xdb67('0x14'),auth['isAuthenticated'](),controller[_0xdb67('0x15')]);router[_0xdb67('0xa')](_0xdb67('0x16'),auth['isAuthenticated'](),controller['getLists']);router[_0xdb67('0xa')](_0xdb67('0x17'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xdb67('0x18')]('/',auth[_0xdb67('0xb')](),controller[_0xdb67('0x19')]);router['post'](_0xdb67('0x1a'),auth['isAuthenticated'](),controller[_0xdb67('0x1b')]);router[_0xdb67('0x18')](_0xdb67('0x16'),auth[_0xdb67('0xb')](),controller[_0xdb67('0x1c')]);router[_0xdb67('0x18')](_0xdb67('0x17'),auth[_0xdb67('0xb')](),controller[_0xdb67('0x1d')]);router[_0xdb67('0x1e')](_0xdb67('0xc'),auth[_0xdb67('0xb')](),controller[_0xdb67('0x1f')]);router[_0xdb67('0x20')]('/:id',auth[_0xdb67('0xb')](),controller['destroy']);router[_0xdb67('0x20')](_0xdb67('0x16'),auth[_0xdb67('0xb')](),controller[_0xdb67('0x21')]);router[_0xdb67('0x20')](_0xdb67('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module[_0xdb67('0x22')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 28c8936..f4177c7 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 _0x1737=['VIRTUAL','key','sequelize','exports','STRING','TEXT'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1737,0xda));var _0x7173=function(_0x246906,_0xd907d3){_0x246906=_0x246906-0x0;var _0x12e86a=_0x1737[_0x246906];return _0x12e86a;};'use strict';var Sequelize=require(_0x7173('0x0'));module[_0x7173('0x1')]={'key':{'type':Sequelize[_0x7173('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x7173('0x3')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x7173('0x4')],'get':function(){return this['getDataValue'](_0x7173('0x5'));}}}; \ No newline at end of file +var _0x11dd=['key','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x19c861,_0x3178f2){var _0x1bb9d1=function(_0xa97bf1){while(--_0xa97bf1){_0x19c861['push'](_0x19c861['shift']());}};_0x1bb9d1(++_0x3178f2);}(_0x11dd,0xdf));var _0xd11d=function(_0x43a37c,_0x25a567){_0x43a37c=_0x43a37c-0x0;var _0x5d1d40=_0x11dd[_0x43a37c];return _0x5d1d40;};'use strict';var Sequelize=require(_0xd11d('0x0'));module[_0xd11d('0x1')]={'key':{'type':Sequelize[_0xd11d('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xd11d('0x3')],'get':function(){return this[_0xd11d('0x4')](_0xd11d('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 9ee6d33..6bb93b5 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 _0xd6f8=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','name','send','map','CannedAnswer','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','params','filters','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','CannedAnswers','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x4e4681,_0x2f0100){var _0x5bbb8b=function(_0x47de74){while(--_0x47de74){_0x4e4681['push'](_0x4e4681['shift']());}};_0x5bbb8b(++_0x2f0100);}(_0xd6f8,0x1ad));var _0x8d6f=function(_0x5cab28,_0x307622){_0x5cab28=_0x5cab28-0x0;var _0xa3554d=_0xd6f8[_0x5cab28];return _0xa3554d;};'use strict';var emlformat=require(_0x8d6f('0x0'));var rimraf=require(_0x8d6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d6f('0x2'));var rp=require(_0x8d6f('0x3'));var moment=require(_0x8d6f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8d6f('0x5'));var util=require(_0x8d6f('0x6'));var path=require(_0x8d6f('0x7'));var sox=require(_0x8d6f('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8d6f('0x9'));var _=require(_0x8d6f('0xa'));var squel=require(_0x8d6f('0xb'));var crypto=require(_0x8d6f('0xc'));var jsforce=require(_0x8d6f('0xd'));var deskjs=require(_0x8d6f('0xe'));var toCsv=require(_0x8d6f('0xf'));var querystring=require(_0x8d6f('0x10'));var Papa=require(_0x8d6f('0x11'));var Redis=require(_0x8d6f('0x12'));var authService=require(_0x8d6f('0x13'));var qs=require(_0x8d6f('0x14'));var as=require(_0x8d6f('0x15'));var hardwareService=require(_0x8d6f('0x16'));var logger=require(_0x8d6f('0x17'))(_0x8d6f('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8d6f('0x19'));var db=require(_0x8d6f('0x1a'))['db'];function respondWithStatusCode(_0x4b915c,_0x181f46){_0x181f46=_0x181f46||0xcc;return function(_0x10d710){if(_0x10d710){return _0x4b915c[_0x8d6f('0x1b')](_0x181f46);}return _0x4b915c[_0x8d6f('0x1c')](_0x181f46)[_0x8d6f('0x1d')]();};}function respondWithResult(_0xd003d9,_0x56dfd2){_0x56dfd2=_0x56dfd2||0xc8;return function(_0x9708f1){if(_0x9708f1){return _0xd003d9[_0x8d6f('0x1c')](_0x56dfd2)[_0x8d6f('0x1e')](_0x9708f1);}};}function respondWithFilteredResult(_0x3818ec,_0x3ef57e){return function(_0x117a8f){if(_0x117a8f){var _0x30ee40=typeof _0x3ef57e[_0x8d6f('0x1f')]===_0x8d6f('0x20')&&typeof _0x3ef57e[_0x8d6f('0x21')]==='undefined';var _0x55eeb7=_0x117a8f[_0x8d6f('0x22')];var _0x20139d=_0x30ee40?0x0:_0x3ef57e[_0x8d6f('0x1f')];var _0x2c87bf=_0x30ee40?_0x117a8f[_0x8d6f('0x22')]:_0x3ef57e['offset']+_0x3ef57e[_0x8d6f('0x21')];var _0x59a8a1;if(_0x2c87bf>=_0x55eeb7){_0x2c87bf=_0x55eeb7;_0x59a8a1=0xc8;}else{_0x59a8a1=0xce;}_0x3818ec['status'](_0x59a8a1);return _0x3818ec['set'](_0x8d6f('0x23'),_0x20139d+'-'+_0x2c87bf+'/'+_0x55eeb7)[_0x8d6f('0x1e')](_0x117a8f);}return null;};}function patchUpdates(_0x2375a1){return function(_0x47ad12){try{jsonpatch[_0x8d6f('0x24')](_0x47ad12,_0x2375a1,!![]);}catch(_0x20ff2f){return BPromise[_0x8d6f('0x25')](_0x20ff2f);}return _0x47ad12[_0x8d6f('0x26')]();};}function saveUpdates(_0x42f895,_0x2e102a){return function(_0x2cb693){if(_0x2cb693){return _0x2cb693['update'](_0x42f895)[_0x8d6f('0x27')](function(_0x367d1f){return _0x367d1f;});}return null;};}function removeEntity(_0x9678b2,_0x22353f){return function(_0x40d546){if(_0x40d546){return _0x40d546[_0x8d6f('0x28')]()['then'](function(){var _0x4f42cc=_0x40d546[_0x8d6f('0x29')]({'plain':!![]});var _0x369aea='CannedAnswers';return db[_0x8d6f('0x2a')][_0x8d6f('0x28')]({'where':{'type':_0x369aea,'resourceId':_0x4f42cc['id']}})[_0x8d6f('0x27')](function(){return _0x40d546;});})['then'](function(){_0x9678b2[_0x8d6f('0x1c')](0xcc)[_0x8d6f('0x1d')]();});}};}function handleEntityNotFound(_0x57bd76,_0xd0f703){return function(_0x46c649){if(!_0x46c649){_0x57bd76[_0x8d6f('0x1b')](0x194);}return _0x46c649;};}function handleError(_0x73767a,_0xcffb2a){_0xcffb2a=_0xcffb2a||0x1f4;return function(_0x80c1ca){logger['error'](_0x80c1ca['stack']);if(_0x80c1ca[_0x8d6f('0x2b')]){delete _0x80c1ca[_0x8d6f('0x2b')];}_0x73767a[_0x8d6f('0x1c')](_0xcffb2a)[_0x8d6f('0x2c')](_0x80c1ca);};}exports['index']=function(_0x17c2d2,_0x359e4f){var _0x349f9f={},_0x37d2c5={},_0x836a99={'count':0x0,'rows':[]};var _0x5afabc=_[_0x8d6f('0x2d')](db[_0x8d6f('0x2e')][_0x8d6f('0x2f')],function(_0x28f679){return{'name':_0x28f679[_0x8d6f('0x30')],'type':_0x28f679['type'][_0x8d6f('0x31')]};});_0x37d2c5['model']=_[_0x8d6f('0x2d')](_0x5afabc,_0x8d6f('0x2b'));_0x37d2c5[_0x8d6f('0x32')]=_[_0x8d6f('0x33')](_0x17c2d2[_0x8d6f('0x32')]);_0x37d2c5['filters']=_['intersection'](_0x37d2c5['model'],_0x37d2c5[_0x8d6f('0x32')]);_0x349f9f[_0x8d6f('0x34')]=_[_0x8d6f('0x35')](_0x37d2c5[_0x8d6f('0x36')],qs[_0x8d6f('0x37')](_0x17c2d2[_0x8d6f('0x32')][_0x8d6f('0x37')]));_0x349f9f[_0x8d6f('0x34')]=_0x349f9f[_0x8d6f('0x34')][_0x8d6f('0x38')]?_0x349f9f[_0x8d6f('0x34')]:_0x37d2c5['model'];if(!_0x17c2d2[_0x8d6f('0x32')][_0x8d6f('0x39')]('nolimit')){_0x349f9f[_0x8d6f('0x21')]=qs[_0x8d6f('0x21')](_0x17c2d2[_0x8d6f('0x32')]['limit']);_0x349f9f[_0x8d6f('0x1f')]=qs['offset'](_0x17c2d2['query']['offset']);}_0x349f9f[_0x8d6f('0x3a')]=qs[_0x8d6f('0x3b')](_0x17c2d2[_0x8d6f('0x32')][_0x8d6f('0x3b')]);_0x349f9f[_0x8d6f('0x3c')]=qs['filters'](_['pick'](_0x17c2d2[_0x8d6f('0x32')],_0x37d2c5['filters']),_0x5afabc);if(_0x17c2d2['query']['filter']){_0x349f9f[_0x8d6f('0x3c')]=_[_0x8d6f('0x3d')](_0x349f9f[_0x8d6f('0x3c')],{'$or':[{'key':{'$like':'%'+_0x17c2d2[_0x8d6f('0x32')]['filter']+'%'}},{'value':{'$like':'%'+_0x17c2d2[_0x8d6f('0x32')][_0x8d6f('0x3e')]+'%'}}]});}_0x349f9f=_[_0x8d6f('0x3d')]({},_0x349f9f,_0x17c2d2[_0x8d6f('0x3f')]);var _0x2d8eff={'where':_0x349f9f[_0x8d6f('0x3c')]};return db[_0x8d6f('0x2e')][_0x8d6f('0x22')](_0x2d8eff)['then'](function(_0x1358dc){_0x836a99[_0x8d6f('0x22')]=_0x1358dc;if(_0x17c2d2[_0x8d6f('0x32')][_0x8d6f('0x40')]){_0x349f9f[_0x8d6f('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8d6f('0x42')](_0x349f9f);})[_0x8d6f('0x27')](function(_0x516173){_0x836a99[_0x8d6f('0x43')]=_0x516173;return _0x836a99;})[_0x8d6f('0x27')](respondWithFilteredResult(_0x359e4f,_0x349f9f))[_0x8d6f('0x44')](handleError(_0x359e4f,null));};exports['show']=function(_0x19c4a0,_0x3ca176){var _0x3d8772={'raw':!![],'where':{'id':_0x19c4a0[_0x8d6f('0x45')]['id']}},_0x5ada97={};_0x5ada97['model']=_['keys'](db[_0x8d6f('0x2e')][_0x8d6f('0x2f')]);_0x5ada97[_0x8d6f('0x32')]=_['keys'](_0x19c4a0[_0x8d6f('0x32')]);_0x5ada97[_0x8d6f('0x46')]=_[_0x8d6f('0x35')](_0x5ada97[_0x8d6f('0x36')],_0x5ada97[_0x8d6f('0x32')]);_0x3d8772[_0x8d6f('0x34')]=_['intersection'](_0x5ada97[_0x8d6f('0x36')],qs[_0x8d6f('0x37')](_0x19c4a0['query'][_0x8d6f('0x37')]));_0x3d8772[_0x8d6f('0x34')]=_0x3d8772['attributes'][_0x8d6f('0x38')]?_0x3d8772[_0x8d6f('0x34')]:_0x5ada97[_0x8d6f('0x36')];if(_0x19c4a0[_0x8d6f('0x32')][_0x8d6f('0x40')]){_0x3d8772[_0x8d6f('0x41')]=[{'all':!![]}];}_0x3d8772=_['merge']({},_0x3d8772,_0x19c4a0[_0x8d6f('0x3f')]);return db['CannedAnswer'][_0x8d6f('0x47')](_0x3d8772)[_0x8d6f('0x27')](handleEntityNotFound(_0x3ca176,null))[_0x8d6f('0x27')](respondWithResult(_0x3ca176,null))[_0x8d6f('0x44')](handleError(_0x3ca176,null));};exports[_0x8d6f('0x48')]=function(_0x5cd29a,_0x34deb0){if(_0x5cd29a[_0x8d6f('0x49')]['id']){delete _0x5cd29a['body']['id'];}return db[_0x8d6f('0x2e')][_0x8d6f('0x47')]({'where':{'id':_0x5cd29a[_0x8d6f('0x45')]['id']}})[_0x8d6f('0x27')](handleEntityNotFound(_0x34deb0,null))[_0x8d6f('0x27')](saveUpdates(_0x5cd29a[_0x8d6f('0x49')],null))[_0x8d6f('0x27')](respondWithResult(_0x34deb0,null))[_0x8d6f('0x44')](handleError(_0x34deb0,null));};exports['destroy']=function(_0x3c6277,_0x2cbf7){return db['CannedAnswer']['find']({'where':{'id':_0x3c6277[_0x8d6f('0x45')]['id']}})[_0x8d6f('0x27')](handleEntityNotFound(_0x2cbf7,null))['then'](removeEntity(_0x2cbf7,null))[_0x8d6f('0x44')](handleError(_0x2cbf7,null));};exports[_0x8d6f('0x4a')]=function(_0x16e79a,_0x14c8ee){var _0x51e2fb={'key':_0x16e79a['body']['key']};if(_0x16e79a[_0x8d6f('0x49')][_0x8d6f('0x4b')]){_0x51e2fb[_0x8d6f('0x4b')]=_0x16e79a[_0x8d6f('0x49')]['MailAccountId'];}else if(_0x16e79a[_0x8d6f('0x49')]['SmsAccountId']){_0x51e2fb[_0x8d6f('0x4c')]=_0x16e79a[_0x8d6f('0x49')][_0x8d6f('0x4c')];}else if(_0x16e79a[_0x8d6f('0x49')][_0x8d6f('0x4d')]){_0x51e2fb[_0x8d6f('0x4d')]=_0x16e79a[_0x8d6f('0x49')][_0x8d6f('0x4d')];}else if(_0x16e79a[_0x8d6f('0x49')][_0x8d6f('0x4e')]){_0x51e2fb[_0x8d6f('0x4e')]=_0x16e79a[_0x8d6f('0x49')][_0x8d6f('0x4e')];}return db[_0x8d6f('0x2e')][_0x8d6f('0x47')]({'where':_0x51e2fb})[_0x8d6f('0x27')](function(_0x2fe248){if(_0x2fe248){throw new db['Sequelize'][(_0x8d6f('0x4f'))](_0x8d6f('0x50'));}return db[_0x8d6f('0x2e')]['create'](_0x16e79a[_0x8d6f('0x49')]);})['then'](function(_0x23993f){var _0x54c3e9=_0x16e79a['user'][_0x8d6f('0x29')]({'plain':!![]});if(!_0x54c3e9)throw new Error(_0x8d6f('0x51'));if(_0x54c3e9[_0x8d6f('0x52')]===_0x8d6f('0x53')){var _0x3c17c2=_0x23993f[_0x8d6f('0x29')]({'plain':!![]});return db[_0x8d6f('0x54')][_0x8d6f('0x47')]({'where':{'name':_0x8d6f('0x55'),'userProfileId':_0x54c3e9[_0x8d6f('0x56')]},'raw':!![]})[_0x8d6f('0x27')](function(_0xbe2285){if(_0xbe2285&&_0xbe2285['autoAssociation']===0x0){return db['UserProfileResource'][_0x8d6f('0x4a')]({'name':_0x3c17c2[_0x8d6f('0x2b')],'resourceId':_0x3c17c2['id'],'type':_0xbe2285[_0x8d6f('0x2b')],'sectionId':_0xbe2285['id']},{})['then'](function(){return _0x23993f;});}else{return _0x23993f;}})['catch'](function(_0x525d70){logger[_0x8d6f('0x57')](_0x8d6f('0x58'),_0x525d70);throw _0x525d70;});}return _0x23993f;})[_0x8d6f('0x27')](respondWithResult(_0x14c8ee,0xc9))[_0x8d6f('0x44')](handleError(_0x14c8ee,null));}; \ No newline at end of file +var _0x96a6=['send','index','map','CannedAnswer','rawAttributes','type','key','model','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','catch','show','params','keys','fields','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','end','error','stack','name'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0x96a6,0xd2));var _0x696a=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x96a6[_0x5783f4];return _0x28e380;};'use strict';var emlformat=require(_0x696a('0x0'));var rimraf=require(_0x696a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x696a('0x2'));var rp=require(_0x696a('0x3'));var moment=require(_0x696a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x696a('0x5'));var sox=require(_0x696a('0x6'));var csv=require(_0x696a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x696a('0x8'));var _=require(_0x696a('0x9'));var squel=require('squel');var crypto=require(_0x696a('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x696a('0xb'));var toCsv=require(_0x696a('0x7'));var querystring=require('querystring');var Papa=require(_0x696a('0xc'));var Redis=require(_0x696a('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x696a('0xe'));var hardwareService=require(_0x696a('0xf'));var logger=require(_0x696a('0x10'))(_0x696a('0x11'));var utils=require(_0x696a('0x12'));var config=require(_0x696a('0x13'));var licenseUtil=require(_0x696a('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1eeeda,_0x66e1e){_0x66e1e=_0x66e1e||0xcc;return function(_0x231e53){if(_0x231e53){return _0x1eeeda[_0x696a('0x15')](_0x66e1e);}return _0x1eeeda[_0x696a('0x16')](_0x66e1e)['end']();};}function respondWithResult(_0x20fef2,_0x567324){_0x567324=_0x567324||0xc8;return function(_0x2e8132){if(_0x2e8132){return _0x20fef2[_0x696a('0x16')](_0x567324)[_0x696a('0x17')](_0x2e8132);}};}function respondWithFilteredResult(_0x438aac,_0x4976c4){return function(_0x39306e){if(_0x39306e){var _0x478718=typeof _0x4976c4[_0x696a('0x18')]===_0x696a('0x19')&&typeof _0x4976c4[_0x696a('0x1a')]===_0x696a('0x19');var _0x3b4147=_0x39306e[_0x696a('0x1b')];var _0x583d98=_0x478718?0x0:_0x4976c4[_0x696a('0x18')];var _0x9a8760=_0x478718?_0x39306e[_0x696a('0x1b')]:_0x4976c4[_0x696a('0x18')]+_0x4976c4['limit'];var _0x7b4dbe;if(_0x9a8760>=_0x3b4147){_0x9a8760=_0x3b4147;_0x7b4dbe=0xc8;}else{_0x7b4dbe=0xce;}_0x438aac[_0x696a('0x16')](_0x7b4dbe);return _0x438aac[_0x696a('0x1c')](_0x696a('0x1d'),_0x583d98+'-'+_0x9a8760+'/'+_0x3b4147)[_0x696a('0x17')](_0x39306e);}return null;};}function patchUpdates(_0x1b57cf){return function(_0x557899){try{jsonpatch[_0x696a('0x1e')](_0x557899,_0x1b57cf,!![]);}catch(_0x368d0d){return BPromise['reject'](_0x368d0d);}return _0x557899[_0x696a('0x1f')]();};}function saveUpdates(_0x3ab503,_0x205b80){return function(_0x4cadd2){if(_0x4cadd2){return _0x4cadd2[_0x696a('0x20')](_0x3ab503)[_0x696a('0x21')](function(_0x2efcde){return _0x2efcde;});}return null;};}function removeEntity(_0x4e63fa,_0x36134f){return function(_0x2fbf52){if(_0x2fbf52){return _0x2fbf52[_0x696a('0x22')]()[_0x696a('0x21')](function(){var _0x1ce1ad=_0x2fbf52[_0x696a('0x23')]({'plain':!![]});var _0x5689ea=_0x696a('0x24');return db[_0x696a('0x25')][_0x696a('0x22')]({'where':{'type':_0x5689ea,'resourceId':_0x1ce1ad['id']}})['then'](function(){return _0x2fbf52;});})[_0x696a('0x21')](function(){_0x4e63fa[_0x696a('0x16')](0xcc)[_0x696a('0x26')]();});}};}function handleEntityNotFound(_0x564a2a,_0x3c6aee){return function(_0x225f79){if(!_0x225f79){_0x564a2a[_0x696a('0x15')](0x194);}return _0x225f79;};}function handleError(_0x4a44f2,_0x5013ec){_0x5013ec=_0x5013ec||0x1f4;return function(_0xa0a742){logger[_0x696a('0x27')](_0xa0a742[_0x696a('0x28')]);if(_0xa0a742['name']){delete _0xa0a742[_0x696a('0x29')];}_0x4a44f2[_0x696a('0x16')](_0x5013ec)[_0x696a('0x2a')](_0xa0a742);};}exports[_0x696a('0x2b')]=function(_0x56549d,_0xdc9326){var _0x1fb8ff={},_0x425f50={},_0x2eb1c1={'count':0x0,'rows':[]};var _0x117c24=_[_0x696a('0x2c')](db[_0x696a('0x2d')][_0x696a('0x2e')],function(_0x152f2b){return{'name':_0x152f2b['fieldName'],'type':_0x152f2b[_0x696a('0x2f')][_0x696a('0x30')]};});_0x425f50[_0x696a('0x31')]=_[_0x696a('0x2c')](_0x117c24,_0x696a('0x29'));_0x425f50[_0x696a('0x32')]=_['keys'](_0x56549d[_0x696a('0x32')]);_0x425f50['filters']=_['intersection'](_0x425f50['model'],_0x425f50[_0x696a('0x32')]);_0x1fb8ff[_0x696a('0x33')]=_[_0x696a('0x34')](_0x425f50[_0x696a('0x31')],qs['fields'](_0x56549d[_0x696a('0x32')]['fields']));_0x1fb8ff[_0x696a('0x33')]=_0x1fb8ff[_0x696a('0x33')][_0x696a('0x35')]?_0x1fb8ff[_0x696a('0x33')]:_0x425f50[_0x696a('0x31')];if(!_0x56549d['query'][_0x696a('0x36')](_0x696a('0x37'))){_0x1fb8ff['limit']=qs[_0x696a('0x1a')](_0x56549d[_0x696a('0x32')][_0x696a('0x1a')]);_0x1fb8ff[_0x696a('0x18')]=qs[_0x696a('0x18')](_0x56549d[_0x696a('0x32')]['offset']);}_0x1fb8ff[_0x696a('0x38')]=qs[_0x696a('0x39')](_0x56549d[_0x696a('0x32')][_0x696a('0x39')]);_0x1fb8ff['where']=qs['filters'](_['pick'](_0x56549d[_0x696a('0x32')],_0x425f50[_0x696a('0x3a')]),_0x117c24);if(_0x56549d[_0x696a('0x32')][_0x696a('0x3b')]){_0x1fb8ff[_0x696a('0x3c')]=_[_0x696a('0x3d')](_0x1fb8ff[_0x696a('0x3c')],{'$or':[{'key':{'$like':'%'+_0x56549d[_0x696a('0x32')][_0x696a('0x3b')]+'%'}},{'value':{'$like':'%'+_0x56549d[_0x696a('0x32')]['filter']+'%'}}]});}_0x1fb8ff=_[_0x696a('0x3d')]({},_0x1fb8ff,_0x56549d[_0x696a('0x3e')]);var _0x452d3f={'where':_0x1fb8ff[_0x696a('0x3c')]};return db[_0x696a('0x2d')][_0x696a('0x1b')](_0x452d3f)[_0x696a('0x21')](function(_0xdea73c){_0x2eb1c1[_0x696a('0x1b')]=_0xdea73c;if(_0x56549d[_0x696a('0x32')][_0x696a('0x3f')]){_0x1fb8ff[_0x696a('0x40')]=[{'all':!![]}];}return db[_0x696a('0x2d')][_0x696a('0x41')](_0x1fb8ff);})[_0x696a('0x21')](function(_0x53eeca){_0x2eb1c1['rows']=_0x53eeca;return _0x2eb1c1;})['then'](respondWithFilteredResult(_0xdc9326,_0x1fb8ff))[_0x696a('0x42')](handleError(_0xdc9326,null));};exports[_0x696a('0x43')]=function(_0x3d9958,_0x5e3cb6){var _0x124ef6={'raw':!![],'where':{'id':_0x3d9958[_0x696a('0x44')]['id']}},_0x1daf22={};_0x1daf22[_0x696a('0x31')]=_['keys'](db[_0x696a('0x2d')][_0x696a('0x2e')]);_0x1daf22[_0x696a('0x32')]=_[_0x696a('0x45')](_0x3d9958['query']);_0x1daf22[_0x696a('0x3a')]=_[_0x696a('0x34')](_0x1daf22[_0x696a('0x31')],_0x1daf22['query']);_0x124ef6[_0x696a('0x33')]=_[_0x696a('0x34')](_0x1daf22[_0x696a('0x31')],qs[_0x696a('0x46')](_0x3d9958[_0x696a('0x32')][_0x696a('0x46')]));_0x124ef6['attributes']=_0x124ef6['attributes'][_0x696a('0x35')]?_0x124ef6['attributes']:_0x1daf22[_0x696a('0x31')];if(_0x3d9958[_0x696a('0x32')][_0x696a('0x3f')]){_0x124ef6[_0x696a('0x40')]=[{'all':!![]}];}_0x124ef6=_[_0x696a('0x3d')]({},_0x124ef6,_0x3d9958[_0x696a('0x3e')]);return db['CannedAnswer'][_0x696a('0x47')](_0x124ef6)[_0x696a('0x21')](handleEntityNotFound(_0x5e3cb6,null))[_0x696a('0x21')](respondWithResult(_0x5e3cb6,null))['catch'](handleError(_0x5e3cb6,null));};exports[_0x696a('0x20')]=function(_0x18599b,_0x373e18){if(_0x18599b[_0x696a('0x48')]['id']){delete _0x18599b[_0x696a('0x48')]['id'];}return db[_0x696a('0x2d')][_0x696a('0x47')]({'where':{'id':_0x18599b[_0x696a('0x44')]['id']}})['then'](handleEntityNotFound(_0x373e18,null))['then'](saveUpdates(_0x18599b[_0x696a('0x48')],null))['then'](respondWithResult(_0x373e18,null))[_0x696a('0x42')](handleError(_0x373e18,null));};exports['destroy']=function(_0xe324ec,_0x43f63f){return db[_0x696a('0x2d')][_0x696a('0x47')]({'where':{'id':_0xe324ec[_0x696a('0x44')]['id']}})[_0x696a('0x21')](handleEntityNotFound(_0x43f63f,null))[_0x696a('0x21')](removeEntity(_0x43f63f,null))['catch'](handleError(_0x43f63f,null));};exports[_0x696a('0x49')]=function(_0x1fd035,_0x15b12f){var _0x544c79={'key':_0x1fd035[_0x696a('0x48')]['key']};if(_0x1fd035[_0x696a('0x48')][_0x696a('0x4a')]){_0x544c79[_0x696a('0x4a')]=_0x1fd035['body'][_0x696a('0x4a')];}else if(_0x1fd035[_0x696a('0x48')][_0x696a('0x4b')]){_0x544c79[_0x696a('0x4b')]=_0x1fd035[_0x696a('0x48')][_0x696a('0x4b')];}else if(_0x1fd035[_0x696a('0x48')][_0x696a('0x4c')]){_0x544c79[_0x696a('0x4c')]=_0x1fd035[_0x696a('0x48')][_0x696a('0x4c')];}else if(_0x1fd035[_0x696a('0x48')][_0x696a('0x4d')]){_0x544c79[_0x696a('0x4d')]=_0x1fd035[_0x696a('0x48')][_0x696a('0x4d')];}return db[_0x696a('0x2d')]['find']({'where':_0x544c79})[_0x696a('0x21')](function(_0x26fc17){if(_0x26fc17){throw new db['Sequelize'][(_0x696a('0x4e'))](_0x696a('0x4f'));}return db[_0x696a('0x2d')][_0x696a('0x49')](_0x1fd035[_0x696a('0x48')]);})['then'](function(_0x210a35){var _0x29091e=_0x1fd035[_0x696a('0x50')][_0x696a('0x23')]({'plain':!![]});if(!_0x29091e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29091e['role']==='user'){var _0x37798a=_0x210a35['get']({'plain':!![]});return db[_0x696a('0x51')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x29091e[_0x696a('0x52')]},'raw':!![]})[_0x696a('0x21')](function(_0x4f1846){if(_0x4f1846&&_0x4f1846['autoAssociation']===0x0){return db[_0x696a('0x25')][_0x696a('0x49')]({'name':_0x37798a[_0x696a('0x29')],'resourceId':_0x37798a['id'],'type':_0x4f1846[_0x696a('0x29')],'sectionId':_0x4f1846['id']},{})[_0x696a('0x21')](function(){return _0x210a35;});}else{return _0x210a35;}})[_0x696a('0x42')](function(_0x193461){logger[_0x696a('0x27')](_0x696a('0x53'),_0x193461);throw _0x193461;});}return _0x210a35;})[_0x696a('0x21')](respondWithResult(_0x15b12f,0xc9))[_0x696a('0x42')](handleError(_0x15b12f,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f13f381..3d2c1e6 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 _0xa9b2=['exports','define','CannedAnswer','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cannedAnswer.attributes'];(function(_0x5d5837,_0x407b1e){var _0x4c3e56=function(_0x55d1da){while(--_0x55d1da){_0x5d5837['push'](_0x5d5837['shift']());}};_0x4c3e56(++_0x407b1e);}(_0xa9b2,0x1e5));var _0x2a9b=function(_0x4aa7b8,_0xc69b67){_0x4aa7b8=_0x4aa7b8-0x0;var _0x310986=_0xa9b2[_0x4aa7b8];return _0x310986;};'use strict';var _=require(_0x2a9b('0x0'));var util=require(_0x2a9b('0x1'));var logger=require(_0x2a9b('0x2'))(_0x2a9b('0x3'));var moment=require(_0x2a9b('0x4'));var BPromise=require(_0x2a9b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2a9b('0x6'));var rimraf=require('rimraf');var config=require(_0x2a9b('0x7'));var attributes=require(_0x2a9b('0x8'));module[_0x2a9b('0x9')]=function(_0xb93bc3,_0x8a4bdd){return _0xb93bc3[_0x2a9b('0xa')](_0x2a9b('0xb'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2a9b('0xc')});}; \ No newline at end of file +var _0x6556=['bluebird','path','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','api','moment'];(function(_0x22dfc6,_0x388280){var _0x217105=function(_0x210094){while(--_0x210094){_0x22dfc6['push'](_0x22dfc6['shift']());}};_0x217105(++_0x388280);}(_0x6556,0x8b));var _0x6655=function(_0x5b965c,_0x434d30){_0x5b965c=_0x5b965c-0x0;var _0x89e03b=_0x6556[_0x5b965c];return _0x89e03b;};'use strict';var _=require(_0x6655('0x0'));var util=require(_0x6655('0x1'));var logger=require('../../config/logger')(_0x6655('0x2'));var moment=require(_0x6655('0x3'));var BPromise=require(_0x6655('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6655('0x5'));var rimraf=require(_0x6655('0x6'));var config=require(_0x6655('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x6655('0x8')]=function(_0x6ce14c,_0x5e4d00){return _0x6ce14c[_0x6655('0x9')](_0x6655('0xa'),attributes,{'tableName':_0x6655('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6655('0xc'),'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 5cad14a..f0ab1db 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(_0x44b28a,_0x4fd472){var _0xf4402b=function(_0x5cd321){while(--_0x5cd321){_0x44b28a['push'](_0x44b28a['shift']());}};_0xf4402b(++_0x4fd472);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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(_0x5b6b9e,_0x338b42){var _0x469931=function(_0x1b7b1){while(--_0x1b7b1){_0x5b6b9e['push'](_0x5b6b9e['shift']());}};_0x469931(++_0x338b42);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 157c268..efea6ad 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 _0xca1d=['util','path','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','create','put','/:id','update','delete','exports'];(function(_0x4a1e84,_0x247c02){var _0x21ed01=function(_0x2ff1d2){while(--_0x2ff1d2){_0x4a1e84['push'](_0x4a1e84['shift']());}};_0x21ed01(++_0x247c02);}(_0xca1d,0x186));var _0xdca1=function(_0x10a4a5,_0x4773ac){_0x10a4a5=_0x10a4a5-0x0;var _0x51edae=_0xca1d[_0x10a4a5];return _0x51edae;};'use strict';var multer=require('multer');var util=require(_0xdca1('0x0'));var path=require(_0xdca1('0x1'));var timeout=require('connect-timeout');var express=require(_0xdca1('0x2'));var router=express[_0xdca1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xdca1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xdca1('0x5'));var controller=require(_0xdca1('0x6'));router[_0xdca1('0x7')]('/',auth[_0xdca1('0x8')](),controller['index']);router[_0xdca1('0x7')]('/:id',auth[_0xdca1('0x8')](),controller['show']);router['post']('/',auth[_0xdca1('0x8')](),controller[_0xdca1('0x9')]);router[_0xdca1('0xa')](_0xdca1('0xb'),auth[_0xdca1('0x8')](),controller[_0xdca1('0xc')]);router[_0xdca1('0xd')](_0xdca1('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xdca1('0xe')]=router; \ No newline at end of file +var _0x4ee5=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get','index','/:id','show','isAuthenticated','create','delete'];(function(_0xc6843,_0x51948b){var _0x44bed1=function(_0x30139e){while(--_0x30139e){_0xc6843['push'](_0xc6843['shift']());}};_0x44bed1(++_0x51948b);}(_0x4ee5,0xab));var _0x54ee=function(_0x3eb488,_0xd254c4){_0x3eb488=_0x3eb488-0x0;var _0x72626c=_0x4ee5[_0x3eb488];return _0x72626c;};'use strict';var multer=require(_0x54ee('0x0'));var util=require(_0x54ee('0x1'));var path=require(_0x54ee('0x2'));var timeout=require('connect-timeout');var express=require(_0x54ee('0x3'));var router=express[_0x54ee('0x4')]();var fs_extra=require(_0x54ee('0x5'));var auth=require(_0x54ee('0x6'));var interaction=require(_0x54ee('0x7'));var config=require('../../config/environment');var controller=require(_0x54ee('0x8'));router[_0x54ee('0x9')]('/',auth['isAuthenticated'](),controller[_0x54ee('0xa')]);router[_0x54ee('0x9')](_0x54ee('0xb'),auth['isAuthenticated'](),controller[_0x54ee('0xc')]);router['post']('/',auth[_0x54ee('0xd')](),controller[_0x54ee('0xe')]);router['put'](_0x54ee('0xb'),auth[_0x54ee('0xd')](),controller['update']);router[_0x54ee('0xf')](_0x54ee('0xb'),auth[_0x54ee('0xd')](),controller['destroy']);module[_0x54ee('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 a369bf6..b521342 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 _0xd845=['1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports','DATE'];(function(_0x4c7a4d,_0xf6fda9){var _0x16a471=function(_0x2a736f){while(--_0x2a736f){_0x4c7a4d['push'](_0x4c7a4d['shift']());}};_0x16a471(++_0xf6fda9);}(_0xd845,0x135));var _0x5d84=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xd845[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require(_0x5d84('0x0'));module[_0x5d84('0x1')]={'calldate':{'type':Sequelize[_0x5d84('0x2')],'allowNull':![],'defaultValue':_0x5d84('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x5d84('0x4')]},'dst':{'type':Sequelize[_0x5d84('0x4')]},'dcontext':{'type':Sequelize[_0x5d84('0x4')]},'channel':{'type':Sequelize[_0x5d84('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x5d84('0x4')]},'lastdata':{'type':Sequelize[_0x5d84('0x4')]},'duration':{'type':Sequelize[_0x5d84('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x5d84('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5d84('0x4')]},'amaflags':{'type':Sequelize[_0x5d84('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5d84('0x4')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x5d84('0x4')]},'sequence':{'type':Sequelize[_0x5d84('0x4')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x5d84('0x4')]},'tag':{'type':Sequelize[_0x5d84('0x4')]}}; \ No newline at end of file +var _0xdead=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x294043,_0x34c2e3){var _0x3b75c2=function(_0x1fc6df){while(--_0x1fc6df){_0x294043['push'](_0x294043['shift']());}};_0x3b75c2(++_0x34c2e3);}(_0xdead,0x172));var _0xddea=function(_0x2ae612,_0x1c0ceb){_0x2ae612=_0x2ae612-0x0;var _0xfaabb9=_0xdead[_0x2ae612];return _0xfaabb9;};'use strict';var Sequelize=require(_0xddea('0x0'));module[_0xddea('0x1')]={'calldate':{'type':Sequelize[_0xddea('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0xddea('0x3')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xddea('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0xddea('0x3')]},'lastdata':{'type':Sequelize[_0xddea('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xddea('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xddea('0x3')]},'amaflags':{'type':Sequelize[_0xddea('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xddea('0x3')]},'userfield':{'type':Sequelize[_0xddea('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0xddea('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xddea('0x3')]},'type':{'type':Sequelize[_0xddea('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4e3915d..b4f7cda 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 _0x885a=['include','findAll','rows','show','params','rawAttributes','length','options','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','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','status','end','json','undefined','limit','offset','set','reject','save','update','then','error','stack','name','map','Cdr','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','count','includeAll'];(function(_0x39f320,_0x21bfda){var _0x48a7ee=function(_0x18ba35){while(--_0x18ba35){_0x39f320['push'](_0x39f320['shift']());}};_0x48a7ee(++_0x21bfda);}(_0x885a,0x180));var _0xa885=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x885a[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa885('0x0'));var zipdir=require(_0xa885('0x1'));var jsonpatch=require(_0xa885('0x2'));var rp=require(_0xa885('0x3'));var moment=require('moment');var BPromise=require(_0xa885('0x4'));var Mustache=require(_0xa885('0x5'));var util=require(_0xa885('0x6'));var path=require(_0xa885('0x7'));var sox=require(_0xa885('0x8'));var csv=require(_0xa885('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa885('0xa'));var _=require(_0xa885('0xb'));var squel=require(_0xa885('0xc'));var crypto=require('crypto');var jsforce=require(_0xa885('0xd'));var deskjs=require(_0xa885('0xe'));var toCsv=require(_0xa885('0x9'));var querystring=require('querystring');var Papa=require(_0xa885('0xf'));var Redis=require(_0xa885('0x10'));var authService=require(_0xa885('0x11'));var qs=require(_0xa885('0x12'));var as=require(_0xa885('0x13'));var hardwareService=require(_0xa885('0x14'));var logger=require(_0xa885('0x15'))('api');var utils=require(_0xa885('0x16'));var config=require(_0xa885('0x17'));var licenseUtil=require(_0xa885('0x18'));var db=require(_0xa885('0x19'))['db'];function respondWithStatusCode(_0x412b2a,_0x3e9c7a){_0x3e9c7a=_0x3e9c7a||0xcc;return function(_0x4585d9){if(_0x4585d9){return _0x412b2a['sendStatus'](_0x3e9c7a);}return _0x412b2a[_0xa885('0x1a')](_0x3e9c7a)[_0xa885('0x1b')]();};}function respondWithResult(_0x27b24a,_0x12d81c){_0x12d81c=_0x12d81c||0xc8;return function(_0x33ce2e){if(_0x33ce2e){return _0x27b24a['status'](_0x12d81c)[_0xa885('0x1c')](_0x33ce2e);}};}function respondWithFilteredResult(_0x2ca5c5,_0x5296e6){return function(_0x14bff1){if(_0x14bff1){var _0x32fc86=typeof _0x5296e6['offset']===_0xa885('0x1d')&&typeof _0x5296e6[_0xa885('0x1e')]==='undefined';var _0x20a206=_0x14bff1['count'];var _0x2e9290=_0x32fc86?0x0:_0x5296e6[_0xa885('0x1f')];var _0x8c26c=_0x32fc86?_0x14bff1['count']:_0x5296e6[_0xa885('0x1f')]+_0x5296e6['limit'];var _0x127a86;if(_0x8c26c>=_0x20a206){_0x8c26c=_0x20a206;_0x127a86=0xc8;}else{_0x127a86=0xce;}_0x2ca5c5[_0xa885('0x1a')](_0x127a86);return _0x2ca5c5[_0xa885('0x20')]('Content-Range',_0x2e9290+'-'+_0x8c26c+'/'+_0x20a206)[_0xa885('0x1c')](_0x14bff1);}return null;};}function patchUpdates(_0x32b8df){return function(_0x1530b6){try{jsonpatch['apply'](_0x1530b6,_0x32b8df,!![]);}catch(_0x273988){return BPromise[_0xa885('0x21')](_0x273988);}return _0x1530b6[_0xa885('0x22')]();};}function saveUpdates(_0x4ad909,_0x303830){return function(_0x582b59){if(_0x582b59){return _0x582b59[_0xa885('0x23')](_0x4ad909)[_0xa885('0x24')](function(_0x5d2b43){return _0x5d2b43;});}return null;};}function removeEntity(_0x1d94c1,_0x190a57){return function(_0x21c98c){if(_0x21c98c){return _0x21c98c['destroy']()[_0xa885('0x24')](function(){_0x1d94c1[_0xa885('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ae58,_0x47daee){return function(_0x15ff4d){if(!_0x15ff4d){_0x39ae58['sendStatus'](0x194);}return _0x15ff4d;};}function handleError(_0x1a28d6,_0x110e63){_0x110e63=_0x110e63||0x1f4;return function(_0x3e347e){logger[_0xa885('0x25')](_0x3e347e[_0xa885('0x26')]);if(_0x3e347e[_0xa885('0x27')]){delete _0x3e347e[_0xa885('0x27')];}_0x1a28d6[_0xa885('0x1a')](_0x110e63)['send'](_0x3e347e);};}exports['index']=function(_0x5c4ca7,_0x4fc438){var _0x1c94ab={},_0x3e9e22={},_0x3af5d9={'count':0x0,'rows':[]};var _0x17c0eb=_[_0xa885('0x28')](db[_0xa885('0x29')]['rawAttributes'],function(_0x40d982){return{'name':_0x40d982['fieldName'],'type':_0x40d982[_0xa885('0x2a')]['key']};});_0x3e9e22[_0xa885('0x2b')]=_['map'](_0x17c0eb,_0xa885('0x27'));_0x3e9e22[_0xa885('0x2c')]=_[_0xa885('0x2d')](_0x5c4ca7['query']);_0x3e9e22[_0xa885('0x2e')]=_[_0xa885('0x2f')](_0x3e9e22['model'],_0x3e9e22[_0xa885('0x2c')]);_0x1c94ab['attributes']=_[_0xa885('0x2f')](_0x3e9e22[_0xa885('0x2b')],qs[_0xa885('0x30')](_0x5c4ca7['query'][_0xa885('0x30')]));_0x1c94ab[_0xa885('0x31')]=_0x1c94ab[_0xa885('0x31')]['length']?_0x1c94ab[_0xa885('0x31')]:_0x3e9e22[_0xa885('0x2b')];if(!_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x32')](_0xa885('0x33'))){_0x1c94ab[_0xa885('0x1e')]=qs[_0xa885('0x1e')](_0x5c4ca7[_0xa885('0x2c')]['limit']);_0x1c94ab['offset']=qs[_0xa885('0x1f')](_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x1f')]);}_0x1c94ab[_0xa885('0x34')]=qs[_0xa885('0x35')](_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x35')]);_0x1c94ab[_0xa885('0x36')]=qs[_0xa885('0x2e')](_['pick'](_0x5c4ca7['query'],_0x3e9e22[_0xa885('0x2e')]),_0x17c0eb);if(_0x5c4ca7['query']['filter']){_0x1c94ab[_0xa885('0x36')]=_['merge'](_0x1c94ab[_0xa885('0x36')],{'$or':_[_0xa885('0x28')](_0x17c0eb,function(_0x39503d){if(_0x39503d[_0xa885('0x2a')]!==_0xa885('0x37')){var _0xc35213={};_0xc35213[_0x39503d[_0xa885('0x27')]]={'$like':'%'+_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x38')]+'%'};return _0xc35213;}})});}_0x1c94ab=_[_0xa885('0x39')]({},_0x1c94ab,_0x5c4ca7['options']);var _0x30759d={'where':_0x1c94ab[_0xa885('0x36')]};return db[_0xa885('0x29')][_0xa885('0x3a')](_0x30759d)[_0xa885('0x24')](function(_0x5e327f){_0x3af5d9['count']=_0x5e327f;if(_0x5c4ca7[_0xa885('0x2c')][_0xa885('0x3b')]){_0x1c94ab[_0xa885('0x3c')]=[{'all':!![]}];}return db[_0xa885('0x29')][_0xa885('0x3d')](_0x1c94ab);})['then'](function(_0x1f2a71){_0x3af5d9[_0xa885('0x3e')]=_0x1f2a71;return _0x3af5d9;})['then'](respondWithFilteredResult(_0x4fc438,_0x1c94ab))['catch'](handleError(_0x4fc438,null));};exports[_0xa885('0x3f')]=function(_0x299baf,_0x4da64c){var _0x561bf0={'raw':!![],'where':{'id':_0x299baf[_0xa885('0x40')]['id']}},_0x1089e5={};_0x1089e5[_0xa885('0x2b')]=_[_0xa885('0x2d')](db[_0xa885('0x29')][_0xa885('0x41')]);_0x1089e5[_0xa885('0x2c')]=_[_0xa885('0x2d')](_0x299baf[_0xa885('0x2c')]);_0x1089e5[_0xa885('0x2e')]=_[_0xa885('0x2f')](_0x1089e5['model'],_0x1089e5[_0xa885('0x2c')]);_0x561bf0[_0xa885('0x31')]=_[_0xa885('0x2f')](_0x1089e5['model'],qs[_0xa885('0x30')](_0x299baf[_0xa885('0x2c')][_0xa885('0x30')]));_0x561bf0[_0xa885('0x31')]=_0x561bf0['attributes'][_0xa885('0x42')]?_0x561bf0['attributes']:_0x1089e5[_0xa885('0x2b')];if(_0x299baf[_0xa885('0x2c')]['includeAll']){_0x561bf0[_0xa885('0x3c')]=[{'all':!![]}];}_0x561bf0=_[_0xa885('0x39')]({},_0x561bf0,_0x299baf[_0xa885('0x43')]);return db[_0xa885('0x29')][_0xa885('0x44')](_0x561bf0)['then'](handleEntityNotFound(_0x4da64c,null))[_0xa885('0x24')](respondWithResult(_0x4da64c,null))[_0xa885('0x45')](handleError(_0x4da64c,null));};exports[_0xa885('0x46')]=function(_0x51f4df,_0x4d146e){return db['Cdr'][_0xa885('0x46')](_0x51f4df[_0xa885('0x47')],{})[_0xa885('0x24')](respondWithResult(_0x4d146e,0xc9))[_0xa885('0x45')](handleError(_0x4d146e,null));};exports[_0xa885('0x23')]=function(_0x49aa9b,_0x43245c){if(_0x49aa9b[_0xa885('0x47')]['id']){delete _0x49aa9b[_0xa885('0x47')]['id'];}return db[_0xa885('0x29')][_0xa885('0x44')]({'where':{'id':_0x49aa9b['params']['id']}})['then'](handleEntityNotFound(_0x43245c,null))['then'](saveUpdates(_0x49aa9b[_0xa885('0x47')],null))[_0xa885('0x24')](respondWithResult(_0x43245c,null))[_0xa885('0x45')](handleError(_0x43245c,null));};exports[_0xa885('0x48')]=function(_0x164d9d,_0x66a035){return db[_0xa885('0x29')]['find']({'where':{'id':_0x164d9d[_0xa885('0x40')]['id']}})[_0xa885('0x24')](handleEntityNotFound(_0x66a035,null))[_0xa885('0x24')](removeEntity(_0x66a035,null))[_0xa885('0x45')](handleError(_0x66a035,null));};exports[_0xa885('0x49')]=function(_0x1bd3a2,_0x159d12){return db['Cdr'][_0xa885('0x49')]()[_0xa885('0x24')](respondWithResult(_0x159d12,null))[_0xa885('0x45')](handleError(_0x159d12,null));}; \ No newline at end of file +var _0xf3cc=['then','destroy','end','stack','name','send','Cdr','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x1314d4,_0xb0b16d){_0x1314d4=_0x1314d4-0x0;var _0x584ba5=_0xf3cc[_0x1314d4];return _0x584ba5;};'use strict';var emlformat=require(_0xcf3c('0x0'));var rimraf=require(_0xcf3c('0x1'));var zipdir=require(_0xcf3c('0x2'));var jsonpatch=require(_0xcf3c('0x3'));var rp=require('request-promise');var moment=require(_0xcf3c('0x4'));var BPromise=require(_0xcf3c('0x5'));var Mustache=require(_0xcf3c('0x6'));var util=require('util');var path=require(_0xcf3c('0x7'));var sox=require(_0xcf3c('0x8'));var csv=require('to-csv');var ejs=require(_0xcf3c('0x9'));var fs=require('fs');var fs_extra=require(_0xcf3c('0xa'));var _=require(_0xcf3c('0xb'));var squel=require(_0xcf3c('0xc'));var crypto=require(_0xcf3c('0xd'));var jsforce=require(_0xcf3c('0xe'));var deskjs=require(_0xcf3c('0xf'));var toCsv=require(_0xcf3c('0x10'));var querystring=require(_0xcf3c('0x11'));var Papa=require(_0xcf3c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcf3c('0x13'));var as=require(_0xcf3c('0x14'));var hardwareService=require(_0xcf3c('0x15'));var logger=require(_0xcf3c('0x16'))(_0xcf3c('0x17'));var utils=require(_0xcf3c('0x18'));var config=require(_0xcf3c('0x19'));var licenseUtil=require(_0xcf3c('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245b88,_0x389b0f){_0x389b0f=_0x389b0f||0xcc;return function(_0x59a8dc){if(_0x59a8dc){return _0x245b88[_0xcf3c('0x1b')](_0x389b0f);}return _0x245b88['status'](_0x389b0f)['end']();};}function respondWithResult(_0x56261f,_0x3fd714){_0x3fd714=_0x3fd714||0xc8;return function(_0x598576){if(_0x598576){return _0x56261f[_0xcf3c('0x1c')](_0x3fd714)[_0xcf3c('0x1d')](_0x598576);}};}function respondWithFilteredResult(_0x4e35fc,_0x3e759f){return function(_0x540046){if(_0x540046){var _0x30d023=typeof _0x3e759f[_0xcf3c('0x1e')]===_0xcf3c('0x1f')&&typeof _0x3e759f['limit']===_0xcf3c('0x1f');var _0x190c8c=_0x540046[_0xcf3c('0x20')];var _0x3f6cef=_0x30d023?0x0:_0x3e759f['offset'];var _0x3789b6=_0x30d023?_0x540046[_0xcf3c('0x20')]:_0x3e759f[_0xcf3c('0x1e')]+_0x3e759f[_0xcf3c('0x21')];var _0x3d0e0a;if(_0x3789b6>=_0x190c8c){_0x3789b6=_0x190c8c;_0x3d0e0a=0xc8;}else{_0x3d0e0a=0xce;}_0x4e35fc[_0xcf3c('0x1c')](_0x3d0e0a);return _0x4e35fc[_0xcf3c('0x22')](_0xcf3c('0x23'),_0x3f6cef+'-'+_0x3789b6+'/'+_0x190c8c)[_0xcf3c('0x1d')](_0x540046);}return null;};}function patchUpdates(_0x8e7738){return function(_0x26a26e){try{jsonpatch[_0xcf3c('0x24')](_0x26a26e,_0x8e7738,!![]);}catch(_0x4e80d4){return BPromise[_0xcf3c('0x25')](_0x4e80d4);}return _0x26a26e['save']();};}function saveUpdates(_0x3c9153,_0x1228c1){return function(_0x5dddc1){if(_0x5dddc1){return _0x5dddc1[_0xcf3c('0x26')](_0x3c9153)[_0xcf3c('0x27')](function(_0x328336){return _0x328336;});}return null;};}function removeEntity(_0x1d7e79,_0x32bbd5){return function(_0x3f1771){if(_0x3f1771){return _0x3f1771[_0xcf3c('0x28')]()[_0xcf3c('0x27')](function(){_0x1d7e79['status'](0xcc)[_0xcf3c('0x29')]();});}};}function handleEntityNotFound(_0x4ce43c,_0x2281b6){return function(_0x15b55c){if(!_0x15b55c){_0x4ce43c[_0xcf3c('0x1b')](0x194);}return _0x15b55c;};}function handleError(_0x35e546,_0x181c90){_0x181c90=_0x181c90||0x1f4;return function(_0x43c912){logger['error'](_0x43c912[_0xcf3c('0x2a')]);if(_0x43c912['name']){delete _0x43c912[_0xcf3c('0x2b')];}_0x35e546[_0xcf3c('0x1c')](_0x181c90)[_0xcf3c('0x2c')](_0x43c912);};}exports['index']=function(_0x397996,_0x54174a){var _0x1d8223={},_0xe22e99={},_0x21a329={'count':0x0,'rows':[]};var _0x5bdae3=_['map'](db[_0xcf3c('0x2d')][_0xcf3c('0x2e')],function(_0x1f53ee){return{'name':_0x1f53ee[_0xcf3c('0x2f')],'type':_0x1f53ee['type'][_0xcf3c('0x30')]};});_0xe22e99[_0xcf3c('0x31')]=_[_0xcf3c('0x32')](_0x5bdae3,'name');_0xe22e99[_0xcf3c('0x33')]=_[_0xcf3c('0x34')](_0x397996[_0xcf3c('0x33')]);_0xe22e99['filters']=_[_0xcf3c('0x35')](_0xe22e99[_0xcf3c('0x31')],_0xe22e99[_0xcf3c('0x33')]);_0x1d8223[_0xcf3c('0x36')]=_[_0xcf3c('0x35')](_0xe22e99['model'],qs[_0xcf3c('0x37')](_0x397996['query'][_0xcf3c('0x37')]));_0x1d8223['attributes']=_0x1d8223[_0xcf3c('0x36')][_0xcf3c('0x38')]?_0x1d8223[_0xcf3c('0x36')]:_0xe22e99[_0xcf3c('0x31')];if(!_0x397996[_0xcf3c('0x33')][_0xcf3c('0x39')](_0xcf3c('0x3a'))){_0x1d8223[_0xcf3c('0x21')]=qs['limit'](_0x397996[_0xcf3c('0x33')][_0xcf3c('0x21')]);_0x1d8223[_0xcf3c('0x1e')]=qs[_0xcf3c('0x1e')](_0x397996[_0xcf3c('0x33')][_0xcf3c('0x1e')]);}_0x1d8223[_0xcf3c('0x3b')]=qs[_0xcf3c('0x3c')](_0x397996[_0xcf3c('0x33')][_0xcf3c('0x3c')]);_0x1d8223['where']=qs[_0xcf3c('0x3d')](_['pick'](_0x397996['query'],_0xe22e99['filters']),_0x5bdae3);if(_0x397996[_0xcf3c('0x33')][_0xcf3c('0x3e')]){_0x1d8223[_0xcf3c('0x3f')]=_[_0xcf3c('0x40')](_0x1d8223['where'],{'$or':_['map'](_0x5bdae3,function(_0x27e186){if(_0x27e186[_0xcf3c('0x41')]!==_0xcf3c('0x42')){var _0x9c753f={};_0x9c753f[_0x27e186[_0xcf3c('0x2b')]]={'$like':'%'+_0x397996[_0xcf3c('0x33')]['filter']+'%'};return _0x9c753f;}})});}_0x1d8223=_[_0xcf3c('0x40')]({},_0x1d8223,_0x397996[_0xcf3c('0x43')]);var _0x292c4d={'where':_0x1d8223['where']};return db[_0xcf3c('0x2d')]['count'](_0x292c4d)['then'](function(_0x43ba75){_0x21a329[_0xcf3c('0x20')]=_0x43ba75;if(_0x397996[_0xcf3c('0x33')][_0xcf3c('0x44')]){_0x1d8223[_0xcf3c('0x45')]=[{'all':!![]}];}return db[_0xcf3c('0x2d')][_0xcf3c('0x46')](_0x1d8223);})[_0xcf3c('0x27')](function(_0x245c77){_0x21a329['rows']=_0x245c77;return _0x21a329;})['then'](respondWithFilteredResult(_0x54174a,_0x1d8223))[_0xcf3c('0x47')](handleError(_0x54174a,null));};exports[_0xcf3c('0x48')]=function(_0x4f5b07,_0x3092e4){var _0x48e5f1={'raw':!![],'where':{'id':_0x4f5b07[_0xcf3c('0x49')]['id']}},_0x2831de={};_0x2831de[_0xcf3c('0x31')]=_[_0xcf3c('0x34')](db[_0xcf3c('0x2d')][_0xcf3c('0x2e')]);_0x2831de[_0xcf3c('0x33')]=_[_0xcf3c('0x34')](_0x4f5b07[_0xcf3c('0x33')]);_0x2831de[_0xcf3c('0x3d')]=_[_0xcf3c('0x35')](_0x2831de[_0xcf3c('0x31')],_0x2831de[_0xcf3c('0x33')]);_0x48e5f1[_0xcf3c('0x36')]=_[_0xcf3c('0x35')](_0x2831de[_0xcf3c('0x31')],qs[_0xcf3c('0x37')](_0x4f5b07[_0xcf3c('0x33')]['fields']));_0x48e5f1['attributes']=_0x48e5f1[_0xcf3c('0x36')]['length']?_0x48e5f1[_0xcf3c('0x36')]:_0x2831de[_0xcf3c('0x31')];if(_0x4f5b07[_0xcf3c('0x33')][_0xcf3c('0x44')]){_0x48e5f1[_0xcf3c('0x45')]=[{'all':!![]}];}_0x48e5f1=_['merge']({},_0x48e5f1,_0x4f5b07['options']);return db['Cdr'][_0xcf3c('0x4a')](_0x48e5f1)[_0xcf3c('0x27')](handleEntityNotFound(_0x3092e4,null))['then'](respondWithResult(_0x3092e4,null))[_0xcf3c('0x47')](handleError(_0x3092e4,null));};exports[_0xcf3c('0x4b')]=function(_0x1cfbc9,_0x2800d4){return db[_0xcf3c('0x2d')][_0xcf3c('0x4b')](_0x1cfbc9[_0xcf3c('0x4c')],{})[_0xcf3c('0x27')](respondWithResult(_0x2800d4,0xc9))[_0xcf3c('0x47')](handleError(_0x2800d4,null));};exports[_0xcf3c('0x26')]=function(_0x25d090,_0x2cfc0b){if(_0x25d090['body']['id']){delete _0x25d090[_0xcf3c('0x4c')]['id'];}return db[_0xcf3c('0x2d')][_0xcf3c('0x4a')]({'where':{'id':_0x25d090[_0xcf3c('0x49')]['id']}})['then'](handleEntityNotFound(_0x2cfc0b,null))[_0xcf3c('0x27')](saveUpdates(_0x25d090['body'],null))[_0xcf3c('0x27')](respondWithResult(_0x2cfc0b,null))['catch'](handleError(_0x2cfc0b,null));};exports['destroy']=function(_0x4bba35,_0x5e3abc){return db[_0xcf3c('0x2d')][_0xcf3c('0x4a')]({'where':{'id':_0x4bba35['params']['id']}})[_0xcf3c('0x27')](handleEntityNotFound(_0x5e3abc,null))[_0xcf3c('0x27')](removeEntity(_0x5e3abc,null))[_0xcf3c('0x47')](handleError(_0x5e3abc,null));};exports['describe']=function(_0x5b5e6a,_0x43f2e1){return db[_0xcf3c('0x2d')]['describe']()['then'](respondWithResult(_0x43f2e1,null))['catch'](handleError(_0x43f2e1,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 9b97f81..8066908 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(_0x275981,_0x303dcc){var _0x12c333=function(_0x33c5fb){while(--_0x33c5fb){_0x275981['push'](_0x275981['shift']());}};_0x12c333(++_0x303dcc);}(_0x7a54,0x106));var _0x47a5=function(_0x11fa52,_0x62aa2f){_0x11fa52=_0x11fa52-0x0;var _0x1afad2=_0x7a54[_0x11fa52];return _0x1afad2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2743c9,_0x3fd412){var _0x2624ac=function(_0x8b27ad){while(--_0x8b27ad){_0x2743c9['push'](_0x2743c9['shift']());}};_0x2624ac(++_0x3fd412);}(_0x7a54,0x106));var _0x47a5=function(_0x23a863,_0x4ac9c0){_0x23a863=_0x23a863-0x0;var _0xaa4b1c=_0x7a54[_0x23a863];return _0xaa4b1c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index f7efde0..bfd8cb3 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 _0xce99=['Cdr,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb78b9a,_0x3693bc){var _0x291888=function(_0x23190a){while(--_0x23190a){_0xb78b9a['push'](_0xb78b9a['shift']());}};_0x291888(++_0x3693bc);}(_0xce99,0x138));var _0x9ce9=function(_0x2d0f26,_0x209a8c){_0x2d0f26=_0x2d0f26-0x0;var _0x35dfd5=_0xce99[_0x2d0f26];return _0x35dfd5;};'use strict';var _=require(_0x9ce9('0x0'));var util=require(_0x9ce9('0x1'));var moment=require(_0x9ce9('0x2'));var BPromise=require(_0x9ce9('0x3'));var rs=require(_0x9ce9('0x4'));var fs=require('fs');var Redis=require(_0x9ce9('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9ce9('0x6'));var logger=require(_0x9ce9('0x7'))(_0x9ce9('0x8'));var config=require(_0x9ce9('0x9'));var jayson=require(_0x9ce9('0xa'));var client=jayson[_0x9ce9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x580add,_0xc5869c,_0x2e3da2){return new BPromise(function(_0x337cca,_0x31dce3){return client[_0x9ce9('0xc')](_0x580add,_0x2e3da2)[_0x9ce9('0xd')](function(_0x2fdaa4){logger[_0x9ce9('0xe')](_0x9ce9('0xf'),_0xc5869c,_0x9ce9('0x10'));logger[_0x9ce9('0x11')](_0x9ce9('0x12'),_0xc5869c,_0x9ce9('0x10'),JSON['stringify'](_0x2fdaa4));if(_0x2fdaa4[_0x9ce9('0x13')]){if(_0x2fdaa4[_0x9ce9('0x13')]['code']===0x1f4){logger[_0x9ce9('0x13')](_0x9ce9('0xf'),_0xc5869c,_0x2fdaa4[_0x9ce9('0x13')][_0x9ce9('0x14')]);return _0x31dce3(_0x2fdaa4[_0x9ce9('0x13')][_0x9ce9('0x14')]);}logger[_0x9ce9('0x13')](_0x9ce9('0xf'),_0xc5869c,_0x2fdaa4[_0x9ce9('0x13')][_0x9ce9('0x14')]);return _0x337cca(_0x2fdaa4[_0x9ce9('0x13')][_0x9ce9('0x14')]);}else{logger[_0x9ce9('0xe')]('Cdr,\x20%s,\x20%s',_0xc5869c,'request\x20sent');_0x337cca(_0x2fdaa4['result'][_0x9ce9('0x14')]);}})[_0x9ce9('0x15')](function(_0x40cd33){logger[_0x9ce9('0x13')](_0x9ce9('0xf'),_0xc5869c,_0x40cd33);_0x31dce3(_0x40cd33);});});} \ No newline at end of file +var _0x0ad3=['message','Cdr,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0x0ad3,0x1bc));var _0x30ad=function(_0x245268,_0x3170a3){_0x245268=_0x245268-0x0;var _0x1bd8e4=_0x0ad3[_0x245268];return _0x1bd8e4;};'use strict';var _=require(_0x30ad('0x0'));var util=require('util');var moment=require(_0x30ad('0x1'));var BPromise=require(_0x30ad('0x2'));var rs=require(_0x30ad('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x30ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x30ad('0x5'))(_0x30ad('0x6'));var config=require(_0x30ad('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x30ad('0x8')][_0x30ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c45af,_0x2c50a4,_0x29554b){return new BPromise(function(_0x1ef918,_0x4b7bcd){return client['request'](_0x4c45af,_0x29554b)['then'](function(_0x741853){logger[_0x30ad('0xa')]('Cdr,\x20%s,\x20%s',_0x2c50a4,_0x30ad('0xb'));logger['debug'](_0x30ad('0xc'),_0x2c50a4,_0x30ad('0xb'),JSON[_0x30ad('0xd')](_0x741853));if(_0x741853[_0x30ad('0xe')]){if(_0x741853['error'][_0x30ad('0xf')]===0x1f4){logger[_0x30ad('0xe')]('Cdr,\x20%s,\x20%s',_0x2c50a4,_0x741853[_0x30ad('0xe')][_0x30ad('0x10')]);return _0x4b7bcd(_0x741853['error']['message']);}logger[_0x30ad('0xe')](_0x30ad('0x11'),_0x2c50a4,_0x741853['error'][_0x30ad('0x10')]);return _0x1ef918(_0x741853['error'][_0x30ad('0x10')]);}else{logger[_0x30ad('0xa')](_0x30ad('0x11'),_0x2c50a4,_0x30ad('0xb'));_0x1ef918(_0x741853[_0x30ad('0x12')]['message']);}})[_0x30ad('0x13')](function(_0x125905){logger[_0x30ad('0xe')](_0x30ad('0x11'),_0x2c50a4,_0x125905);_0x4b7bcd(_0x125905);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 5209ca8..5e4337a 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x574c35,_0x2a1658){var _0x3ace87=function(_0x1a4035){while(--_0x1a4035){_0x574c35['push'](_0x574c35['shift']());}};_0x3ace87(++_0x2a1658);}(_0xb10b,0x12a));var _0xbb10=function(_0xcbe787,_0x401e4c){_0xcbe787=_0xcbe787-0x0;var _0x4c78fa=_0xb10b[_0xcbe787];return _0x4c78fa;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x235f7f,_0x4cc112){var _0x3bf31e=function(_0x618236){while(--_0x618236){_0x235f7f['push'](_0x235f7f['shift']());}};_0x3bf31e(++_0x4cc112);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index c9d5f39..0baf06d 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 _0x4300=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x4b7b62,_0x4920a9){var _0x2280df=function(_0x21e1f8){while(--_0x21e1f8){_0x4b7b62['push'](_0x4b7b62['shift']());}};_0x2280df(++_0x4920a9);}(_0x4300,0x99));var _0x0430=function(_0x5ee02e,_0x170ab6){_0x5ee02e=_0x5ee02e-0x0;var _0x206e55=_0x4300[_0x5ee02e];return _0x206e55;};'use strict';var Sequelize=require(_0x0430('0x0'));module[_0x0430('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0430('0x2')],'allowNull':![],'defaultValue':_0x0430('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0430('0x2')]},'interval':{'type':Sequelize[_0x0430('0x2')],'defaultValue':_0x0430('0x4')}}; \ No newline at end of file +var _0xc02f=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0xf7379b,_0x44ec77){var _0x96a568=function(_0x496b79){while(--_0x496b79){_0xf7379b['push'](_0xf7379b['shift']());}};_0x96a568(++_0x44ec77);}(_0xc02f,0xd7));var _0xfc02=function(_0x40c387,_0x2aa9e3){_0x40c387=_0x40c387-0x0;var _0xdb9522=_0xc02f[_0x40c387];return _0xdb9522;};'use strict';var Sequelize=require(_0xfc02('0x0'));module[_0xfc02('0x1')]={'priority':{'type':Sequelize[_0xfc02('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfc02('0x3')],'allowNull':![],'defaultValue':_0xfc02('0x4')},'appdata':{'type':Sequelize[_0xfc02('0x5')]()},'description':{'type':Sequelize[_0xfc02('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xfc02('0x6')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index e33d3bc..fe43cee 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 _0x43fd=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','reject','then','destroy','error','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x14df8c,_0xa43c02){var _0x4b1247=function(_0x24c37b){while(--_0x24c37b){_0x14df8c['push'](_0x14df8c['shift']());}};_0x4b1247(++_0xa43c02);}(_0x43fd,0x150));var _0xd43f=function(_0x53ad9a,_0x2bfcc6){_0x53ad9a=_0x53ad9a-0x0;var _0x474c67=_0x43fd[_0x53ad9a];return _0x474c67;};'use strict';var emlformat=require(_0xd43f('0x0'));var rimraf=require(_0xd43f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd43f('0x2'));var rp=require('request-promise');var moment=require(_0xd43f('0x3'));var BPromise=require(_0xd43f('0x4'));var Mustache=require(_0xd43f('0x5'));var util=require(_0xd43f('0x6'));var path=require(_0xd43f('0x7'));var sox=require(_0xd43f('0x8'));var csv=require(_0xd43f('0x9'));var ejs=require(_0xd43f('0xa'));var fs=require('fs');var fs_extra=require(_0xd43f('0xb'));var _=require(_0xd43f('0xc'));var squel=require(_0xd43f('0xd'));var crypto=require(_0xd43f('0xe'));var jsforce=require(_0xd43f('0xf'));var deskjs=require(_0xd43f('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd43f('0x11'));var Papa=require(_0xd43f('0x12'));var Redis=require(_0xd43f('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd43f('0x14'));var as=require(_0xd43f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd43f('0x16'))(_0xd43f('0x17'));var utils=require(_0xd43f('0x18'));var config=require(_0xd43f('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3be74e,_0xed42ff){_0xed42ff=_0xed42ff||0xcc;return function(_0x5b90a7){if(_0x5b90a7){return _0x3be74e[_0xd43f('0x1a')](_0xed42ff);}return _0x3be74e['status'](_0xed42ff)['end']();};}function respondWithResult(_0x28fe2d,_0x12bd82){_0x12bd82=_0x12bd82||0xc8;return function(_0x568087){if(_0x568087){return _0x28fe2d[_0xd43f('0x1b')](_0x12bd82)[_0xd43f('0x1c')](_0x568087);}};}function respondWithFilteredResult(_0x54f136,_0x229f81){return function(_0x351c9c){if(_0x351c9c){var _0x10f584=typeof _0x229f81[_0xd43f('0x1d')]===_0xd43f('0x1e')&&typeof _0x229f81['limit']==='undefined';var _0x5c03a6=_0x351c9c[_0xd43f('0x1f')];var _0x22d86f=_0x10f584?0x0:_0x229f81[_0xd43f('0x1d')];var _0x2e2396=_0x10f584?_0x351c9c['count']:_0x229f81[_0xd43f('0x1d')]+_0x229f81[_0xd43f('0x20')];var _0x263e9a;if(_0x2e2396>=_0x5c03a6){_0x2e2396=_0x5c03a6;_0x263e9a=0xc8;}else{_0x263e9a=0xce;}_0x54f136[_0xd43f('0x1b')](_0x263e9a);return _0x54f136[_0xd43f('0x21')]('Content-Range',_0x22d86f+'-'+_0x2e2396+'/'+_0x5c03a6)[_0xd43f('0x1c')](_0x351c9c);}return null;};}function patchUpdates(_0x5bae9e){return function(_0x1ad9d3){try{jsonpatch['apply'](_0x1ad9d3,_0x5bae9e,!![]);}catch(_0x1ce702){return BPromise[_0xd43f('0x22')](_0x1ce702);}return _0x1ad9d3['save']();};}function saveUpdates(_0x37da4a,_0x1c79b8){return function(_0x15a7d9){if(_0x15a7d9){return _0x15a7d9['update'](_0x37da4a)[_0xd43f('0x23')](function(_0x51c68c){return _0x51c68c;});}return null;};}function removeEntity(_0x3ff3dc,_0x4646c2){return function(_0x1bf18d){if(_0x1bf18d){return _0x1bf18d[_0xd43f('0x24')]()[_0xd43f('0x23')](function(){_0x3ff3dc[_0xd43f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cf19f,_0x4750c3){return function(_0x30d7a3){if(!_0x30d7a3){_0x3cf19f[_0xd43f('0x1a')](0x194);}return _0x30d7a3;};}function handleError(_0x3381b6,_0x2f7769){_0x2f7769=_0x2f7769||0x1f4;return function(_0x2df5b4){logger[_0xd43f('0x25')](_0x2df5b4[_0xd43f('0x26')]);if(_0x2df5b4[_0xd43f('0x27')]){delete _0x2df5b4['name'];}_0x3381b6[_0xd43f('0x1b')](_0x2f7769)[_0xd43f('0x28')](_0x2df5b4);};}exports[_0xd43f('0x29')]=function(_0x1215cf,_0x82103b){var _0x30d1dc={'raw':!![],'where':{'id':_0x1215cf[_0xd43f('0x2a')]['id']}},_0x4efdb5={};_0x4efdb5[_0xd43f('0x2b')]=_[_0xd43f('0x2c')](db[_0xd43f('0x2d')][_0xd43f('0x2e')]);_0x4efdb5[_0xd43f('0x2f')]=_[_0xd43f('0x2c')](_0x1215cf[_0xd43f('0x2f')]);_0x4efdb5[_0xd43f('0x30')]=_['intersection'](_0x4efdb5[_0xd43f('0x2b')],_0x4efdb5[_0xd43f('0x2f')]);_0x30d1dc['attributes']=_[_0xd43f('0x31')](_0x4efdb5['model'],qs[_0xd43f('0x32')](_0x1215cf['query'][_0xd43f('0x32')]));_0x30d1dc['attributes']=_0x30d1dc[_0xd43f('0x33')]['length']?_0x30d1dc[_0xd43f('0x33')]:_0x4efdb5[_0xd43f('0x2b')];if(_0x1215cf['query'][_0xd43f('0x34')]){_0x30d1dc[_0xd43f('0x35')]=[{'all':!![]}];}_0x30d1dc=_[_0xd43f('0x36')]({},_0x30d1dc,_0x1215cf[_0xd43f('0x37')]);return db[_0xd43f('0x2d')][_0xd43f('0x38')](_0x30d1dc)['then'](handleEntityNotFound(_0x82103b,null))[_0xd43f('0x23')](respondWithResult(_0x82103b,null))[_0xd43f('0x39')](handleError(_0x82103b,null));};exports['update']=function(_0x12f22f,_0x15759d){if(_0x12f22f[_0xd43f('0x3a')]['id']){delete _0x12f22f[_0xd43f('0x3a')]['id'];}return db[_0xd43f('0x2d')]['find']({'where':{'id':_0x12f22f[_0xd43f('0x2a')]['id']}})['then'](handleEntityNotFound(_0x15759d,null))[_0xd43f('0x23')](saveUpdates(_0x12f22f[_0xd43f('0x3a')],null))[_0xd43f('0x23')](respondWithResult(_0x15759d,null))[_0xd43f('0x39')](handleError(_0x15759d,null));};exports[_0xd43f('0x24')]=function(_0x400fa5,_0x4b6608){return db[_0xd43f('0x2d')][_0xd43f('0x38')]({'where':{'id':_0x400fa5['params']['id']}})[_0xd43f('0x23')](handleEntityNotFound(_0x4b6608,null))[_0xd43f('0x23')](removeEntity(_0x4b6608,null))[_0xd43f('0x39')](handleError(_0x4b6608,null));}; \ No newline at end of file +var _0x1020=['../../config/logger','../../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','error','stack','name','send','show','params','model','query','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','catch','body','ChatApplication','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1948da,_0x4607e0){var _0x11a4d2=function(_0x537144){while(--_0x537144){_0x1948da['push'](_0x1948da['shift']());}};_0x11a4d2(++_0x4607e0);}(_0x1020,0x1a4));var _0x0102=function(_0x305486,_0x24acd4){_0x305486=_0x305486-0x0;var _0xa04940=_0x1020[_0x305486];return _0xa04940;};'use strict';var emlformat=require(_0x0102('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0102('0x1'));var jsonpatch=require(_0x0102('0x2'));var rp=require(_0x0102('0x3'));var moment=require(_0x0102('0x4'));var BPromise=require(_0x0102('0x5'));var Mustache=require(_0x0102('0x6'));var util=require(_0x0102('0x7'));var path=require(_0x0102('0x8'));var sox=require(_0x0102('0x9'));var csv=require(_0x0102('0xa'));var ejs=require(_0x0102('0xb'));var fs=require('fs');var fs_extra=require(_0x0102('0xc'));var _=require('lodash');var squel=require(_0x0102('0xd'));var crypto=require(_0x0102('0xe'));var jsforce=require(_0x0102('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0102('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0102('0x11'));var qs=require(_0x0102('0x12'));var as=require(_0x0102('0x13'));var hardwareService=require(_0x0102('0x14'));var logger=require(_0x0102('0x15'))('api');var utils=require(_0x0102('0x16'));var config=require(_0x0102('0x17'));var licenseUtil=require(_0x0102('0x18'));var db=require(_0x0102('0x19'))['db'];function respondWithStatusCode(_0x1945cf,_0x204192){_0x204192=_0x204192||0xcc;return function(_0x391fe1){if(_0x391fe1){return _0x1945cf[_0x0102('0x1a')](_0x204192);}return _0x1945cf[_0x0102('0x1b')](_0x204192)['end']();};}function respondWithResult(_0x502b93,_0xe2c57f){_0xe2c57f=_0xe2c57f||0xc8;return function(_0x20f557){if(_0x20f557){return _0x502b93[_0x0102('0x1b')](_0xe2c57f)[_0x0102('0x1c')](_0x20f557);}};}function respondWithFilteredResult(_0x41f27b,_0x435ac7){return function(_0x1a3e66){if(_0x1a3e66){var _0x2e0c35=typeof _0x435ac7[_0x0102('0x1d')]===_0x0102('0x1e')&&typeof _0x435ac7[_0x0102('0x1f')]==='undefined';var _0x2ca87b=_0x1a3e66['count'];var _0x58ba05=_0x2e0c35?0x0:_0x435ac7['offset'];var _0x246a2a=_0x2e0c35?_0x1a3e66[_0x0102('0x20')]:_0x435ac7[_0x0102('0x1d')]+_0x435ac7[_0x0102('0x1f')];var _0x1da56c;if(_0x246a2a>=_0x2ca87b){_0x246a2a=_0x2ca87b;_0x1da56c=0xc8;}else{_0x1da56c=0xce;}_0x41f27b[_0x0102('0x1b')](_0x1da56c);return _0x41f27b[_0x0102('0x21')](_0x0102('0x22'),_0x58ba05+'-'+_0x246a2a+'/'+_0x2ca87b)[_0x0102('0x1c')](_0x1a3e66);}return null;};}function patchUpdates(_0x43eb89){return function(_0x26a805){try{jsonpatch[_0x0102('0x23')](_0x26a805,_0x43eb89,!![]);}catch(_0x1cc7bb){return BPromise[_0x0102('0x24')](_0x1cc7bb);}return _0x26a805[_0x0102('0x25')]();};}function saveUpdates(_0x58ffbb,_0x2e33a6){return function(_0x2dc5f5){if(_0x2dc5f5){return _0x2dc5f5[_0x0102('0x26')](_0x58ffbb)[_0x0102('0x27')](function(_0x2787aa){return _0x2787aa;});}return null;};}function removeEntity(_0x4e8142,_0x4004f4){return function(_0x3d0fa7){if(_0x3d0fa7){return _0x3d0fa7[_0x0102('0x28')]()[_0x0102('0x27')](function(){_0x4e8142[_0x0102('0x1b')](0xcc)[_0x0102('0x29')]();});}};}function handleEntityNotFound(_0x5ea683,_0x6938fc){return function(_0x42e908){if(!_0x42e908){_0x5ea683[_0x0102('0x1a')](0x194);}return _0x42e908;};}function handleError(_0x16b9e8,_0x563f44){_0x563f44=_0x563f44||0x1f4;return function(_0x2013c){logger[_0x0102('0x2a')](_0x2013c[_0x0102('0x2b')]);if(_0x2013c[_0x0102('0x2c')]){delete _0x2013c[_0x0102('0x2c')];}_0x16b9e8['status'](_0x563f44)[_0x0102('0x2d')](_0x2013c);};}exports[_0x0102('0x2e')]=function(_0x5a3850,_0x1e6efc){var _0x5944de={'raw':!![],'where':{'id':_0x5a3850[_0x0102('0x2f')]['id']}},_0x3e5d95={};_0x3e5d95[_0x0102('0x30')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x3e5d95[_0x0102('0x31')]=_[_0x0102('0x32')](_0x5a3850['query']);_0x3e5d95[_0x0102('0x33')]=_[_0x0102('0x34')](_0x3e5d95['model'],_0x3e5d95['query']);_0x5944de['attributes']=_[_0x0102('0x34')](_0x3e5d95[_0x0102('0x30')],qs[_0x0102('0x35')](_0x5a3850[_0x0102('0x31')][_0x0102('0x35')]));_0x5944de[_0x0102('0x36')]=_0x5944de[_0x0102('0x36')][_0x0102('0x37')]?_0x5944de[_0x0102('0x36')]:_0x3e5d95[_0x0102('0x30')];if(_0x5a3850[_0x0102('0x31')][_0x0102('0x38')]){_0x5944de[_0x0102('0x39')]=[{'all':!![]}];}_0x5944de=_[_0x0102('0x3a')]({},_0x5944de,_0x5a3850['options']);return db['ChatApplication'][_0x0102('0x3b')](_0x5944de)[_0x0102('0x27')](handleEntityNotFound(_0x1e6efc,null))[_0x0102('0x27')](respondWithResult(_0x1e6efc,null))[_0x0102('0x3c')](handleError(_0x1e6efc,null));};exports[_0x0102('0x26')]=function(_0x596950,_0x2b14d1){if(_0x596950[_0x0102('0x3d')]['id']){delete _0x596950[_0x0102('0x3d')]['id'];}return db['ChatApplication'][_0x0102('0x3b')]({'where':{'id':_0x596950[_0x0102('0x2f')]['id']}})[_0x0102('0x27')](handleEntityNotFound(_0x2b14d1,null))[_0x0102('0x27')](saveUpdates(_0x596950[_0x0102('0x3d')],null))[_0x0102('0x27')](respondWithResult(_0x2b14d1,null))[_0x0102('0x3c')](handleError(_0x2b14d1,null));};exports[_0x0102('0x28')]=function(_0x9a6143,_0x43c195){return db[_0x0102('0x3e')][_0x0102('0x3b')]({'where':{'id':_0x9a6143[_0x0102('0x2f')]['id']}})['then'](handleEntityNotFound(_0x43c195,null))[_0x0102('0x27')](removeEntity(_0x43c195,null))[_0x0102('0x3c')](handleError(_0x43c195,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index ea545f5..48704a7 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 _0xbe79=['api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','utf8mb4','lodash','util','../../config/logger'];(function(_0x1e2115,_0x3a2d14){var _0x9ce664=function(_0x24cafd){while(--_0x24cafd){_0x1e2115['push'](_0x1e2115['shift']());}};_0x9ce664(++_0x3a2d14);}(_0xbe79,0x169));var _0x9be7=function(_0x2c1d7a,_0x148f5a){_0x2c1d7a=_0x2c1d7a-0x0;var _0x4f258b=_0xbe79[_0x2c1d7a];return _0x4f258b;};'use strict';var _=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var logger=require(_0x9be7('0x2'))(_0x9be7('0x3'));var moment=require(_0x9be7('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be7('0x5'));var fs=require('fs');var path=require(_0x9be7('0x6'));var rimraf=require(_0x9be7('0x7'));var config=require(_0x9be7('0x8'));var attributes=require(_0x9be7('0x9'));module[_0x9be7('0xa')]=function(_0x57b111,_0x2ddcb5){return _0x57b111[_0x9be7('0xb')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9be7('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4200=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4'];(function(_0x3cae65,_0x1d0b55){var _0x1ba9bc=function(_0x4b36ed){while(--_0x4b36ed){_0x3cae65['push'](_0x3cae65['shift']());}};_0x1ba9bc(++_0x1d0b55);}(_0x4200,0x199));var _0x0420=function(_0x3b3e0f,_0xf0733c){_0x3b3e0f=_0x3b3e0f-0x0;var _0xf7c91a=_0x4200[_0x3b3e0f];return _0xf7c91a;};'use strict';var _=require('lodash');var util=require(_0x0420('0x0'));var logger=require(_0x0420('0x1'))(_0x0420('0x2'));var moment=require(_0x0420('0x3'));var BPromise=require(_0x0420('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0420('0x5'));module[_0x0420('0x6')]=function(_0x4d7002,_0x4670d6){return _0x4d7002[_0x0420('0x7')](_0x0420('0x8'),attributes,{'tableName':_0x0420('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0420('0xa'),'collate':_0x0420('0xb')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index fc3dc58..2638446 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 _0xa2fd=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4e90ff,_0x1cbed2){var _0x29f031=function(_0xbd9648){while(--_0xbd9648){_0x4e90ff['push'](_0x4e90ff['shift']());}};_0x29f031(++_0x1cbed2);}(_0xa2fd,0x177));var _0xda2f=function(_0x1878a1,_0x1ead6c){_0x1878a1=_0x1878a1-0x0;var _0x563c42=_0xa2fd[_0x1878a1];return _0x563c42;};'use strict';var _=require(_0xda2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda2f('0x1'));var rs=require(_0xda2f('0x2'));var fs=require('fs');var Redis=require(_0xda2f('0x3'));var db=require(_0xda2f('0x4'))['db'];var utils=require(_0xda2f('0x5'));var logger=require(_0xda2f('0x6'))(_0xda2f('0x7'));var config=require('../../config/environment');var jayson=require(_0xda2f('0x8'));var client=jayson['client'][_0xda2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b816b,_0x57a56a,_0xedbd0b){return new BPromise(function(_0x300635,_0x33751c){return client[_0xda2f('0xa')](_0x4b816b,_0xedbd0b)['then'](function(_0x2445a5){logger['info'](_0xda2f('0xb'),_0x57a56a,_0xda2f('0xc'));logger[_0xda2f('0xd')](_0xda2f('0xe'),_0x57a56a,_0xda2f('0xc'),JSON[_0xda2f('0xf')](_0x2445a5));if(_0x2445a5[_0xda2f('0x10')]){if(_0x2445a5['error'][_0xda2f('0x11')]===0x1f4){logger[_0xda2f('0x10')](_0xda2f('0xb'),_0x57a56a,_0x2445a5[_0xda2f('0x10')][_0xda2f('0x12')]);return _0x33751c(_0x2445a5[_0xda2f('0x10')][_0xda2f('0x12')]);}logger[_0xda2f('0x10')](_0xda2f('0xb'),_0x57a56a,_0x2445a5[_0xda2f('0x10')][_0xda2f('0x12')]);return _0x300635(_0x2445a5[_0xda2f('0x10')][_0xda2f('0x12')]);}else{logger[_0xda2f('0x13')](_0xda2f('0xb'),_0x57a56a,_0xda2f('0xc'));_0x300635(_0x2445a5[_0xda2f('0x14')][_0xda2f('0x12')]);}})[_0xda2f('0x15')](function(_0x1fea1c){logger[_0xda2f('0x10')]('ChatApplication,\x20%s,\x20%s',_0x57a56a,_0x1fea1c);_0x33751c(_0x1fea1c);});});} \ No newline at end of file +var _0x6337=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','util','moment','bluebird'];(function(_0x28ed5f,_0x2a11bc){var _0xc43996=function(_0x64784c){while(--_0x64784c){_0x28ed5f['push'](_0x28ed5f['shift']());}};_0xc43996(++_0x2a11bc);}(_0x6337,0x105));var _0x7633=function(_0x8c69bb,_0x4f84f5){_0x8c69bb=_0x8c69bb-0x0;var _0x577fbf=_0x6337[_0x8c69bb];return _0x577fbf;};'use strict';var _=require('lodash');var util=require(_0x7633('0x0'));var moment=require(_0x7633('0x1'));var BPromise=require(_0x7633('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7633('0x3'));var db=require(_0x7633('0x4'))['db'];var utils=require(_0x7633('0x5'));var logger=require(_0x7633('0x6'))(_0x7633('0x7'));var config=require(_0x7633('0x8'));var jayson=require(_0x7633('0x9'));var client=jayson[_0x7633('0xa')][_0x7633('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53155f,_0xf1ecb4,_0x1d48a1){return new BPromise(function(_0x1aa81e,_0x1168f5){return client[_0x7633('0xc')](_0x53155f,_0x1d48a1)[_0x7633('0xd')](function(_0x529829){logger[_0x7633('0xe')]('ChatApplication,\x20%s,\x20%s',_0xf1ecb4,_0x7633('0xf'));logger[_0x7633('0x10')](_0x7633('0x11'),_0xf1ecb4,_0x7633('0xf'),JSON[_0x7633('0x12')](_0x529829));if(_0x529829[_0x7633('0x13')]){if(_0x529829[_0x7633('0x13')][_0x7633('0x14')]===0x1f4){logger[_0x7633('0x13')](_0x7633('0x15'),_0xf1ecb4,_0x529829[_0x7633('0x13')]['message']);return _0x1168f5(_0x529829['error'][_0x7633('0x16')]);}logger[_0x7633('0x13')](_0x7633('0x15'),_0xf1ecb4,_0x529829['error'][_0x7633('0x16')]);return _0x1aa81e(_0x529829['error'][_0x7633('0x16')]);}else{logger[_0x7633('0xe')](_0x7633('0x15'),_0xf1ecb4,_0x7633('0xf'));_0x1aa81e(_0x529829[_0x7633('0x17')][_0x7633('0x16')]);}})['catch'](function(_0x3c8c91){logger[_0x7633('0x13')](_0x7633('0x15'),_0xf1ecb4,_0x3c8c91);_0x1168f5(_0x3c8c91);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index fab09a9..fda6dc6 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 _0x45e0=['update','delete','exports','multer','util','Router','fs-extra','../../components/interaction/service','./chatApplication.controller','get','/:id','put','isAuthenticated'];(function(_0x315104,_0x3c08d2){var _0x8ca6ce=function(_0x2136a4){while(--_0x2136a4){_0x315104['push'](_0x315104['shift']());}};_0x8ca6ce(++_0x3c08d2);}(_0x45e0,0xe0));var _0x045e=function(_0x5203f3,_0x231e6d){_0x5203f3=_0x5203f3-0x0;var _0x48296a=_0x45e0[_0x5203f3];return _0x48296a;};'use strict';var multer=require(_0x045e('0x0'));var util=require(_0x045e('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x045e('0x2')]();var fs_extra=require(_0x045e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x045e('0x4'));var config=require('../../config/environment');var controller=require(_0x045e('0x5'));router[_0x045e('0x6')](_0x045e('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x045e('0x8')](_0x045e('0x7'),auth[_0x045e('0x9')](),controller[_0x045e('0xa')]);router[_0x045e('0xb')](_0x045e('0x7'),auth[_0x045e('0x9')](),controller['destroy']);module[_0x045e('0xc')]=router; \ No newline at end of file +var _0x4e2f=['../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x13974c,_0x5c5155){var _0x1e468f=function(_0x3e4008){while(--_0x3e4008){_0x13974c['push'](_0x13974c['shift']());}};_0x1e468f(++_0x5c5155);}(_0x4e2f,0x12b));var _0xf4e2=function(_0x4e3641,_0x3c436c){_0x4e3641=_0x4e3641-0x0;var _0x487604=_0x4e2f[_0x4e3641];return _0x487604;};'use strict';var multer=require('multer');var util=require(_0xf4e2('0x0'));var path=require(_0xf4e2('0x1'));var timeout=require(_0xf4e2('0x2'));var express=require(_0xf4e2('0x3'));var router=express[_0xf4e2('0x4')]();var fs_extra=require(_0xf4e2('0x5'));var auth=require(_0xf4e2('0x6'));var interaction=require(_0xf4e2('0x7'));var config=require('../../config/environment');var controller=require(_0xf4e2('0x8'));router[_0xf4e2('0x9')](_0xf4e2('0xa'),auth[_0xf4e2('0xb')](),controller[_0xf4e2('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf4e2('0xd')]);router[_0xf4e2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf4e2('0xf')]);module[_0xf4e2('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 3e9c35b..855afaf 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 _0xd668=['STRING','BOOLEAN','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd668,0x18e));var _0x8d66=function(_0x44bbac,_0x5299a4){_0x44bbac=_0x44bbac-0x0;var _0x32216b=_0xd668[_0x44bbac];return _0x32216b;};'use strict';var Sequelize=require(_0x8d66('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d66('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8d66('0x1')]},'write':{'type':Sequelize[_0x8d66('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc2b4=['exports','STRING','sequelize'];(function(_0x313d9c,_0x3eee34){var _0x34efc8=function(_0xef801f){while(--_0xef801f){_0x313d9c['push'](_0x313d9c['shift']());}};_0x34efc8(++_0x3eee34);}(_0xc2b4,0xc5));var _0x4c2b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc2b4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4c2b('0x0'));module[_0x4c2b('0x1')]={'name':{'type':Sequelize[_0x4c2b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4c2b('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 124ad1b..9c3f02c 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 _0xc27e=['include','options','find','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','map','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','nolimit','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ChatGroup','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','catch','params'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xc27e,0x7d));var _0xec27=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc27e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xec27('0x0'));var rimraf=require(_0xec27('0x1'));var zipdir=require(_0xec27('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec27('0x3'));var moment=require('moment');var BPromise=require(_0xec27('0x4'));var Mustache=require(_0xec27('0x5'));var util=require(_0xec27('0x6'));var path=require(_0xec27('0x7'));var sox=require(_0xec27('0x8'));var csv=require(_0xec27('0x9'));var ejs=require(_0xec27('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xec27('0xb'));var squel=require(_0xec27('0xc'));var crypto=require(_0xec27('0xd'));var jsforce=require(_0xec27('0xe'));var deskjs=require(_0xec27('0xf'));var toCsv=require(_0xec27('0x9'));var querystring=require(_0xec27('0x10'));var Papa=require('papaparse');var Redis=require(_0xec27('0x11'));var authService=require(_0xec27('0x12'));var qs=require(_0xec27('0x13'));var as=require(_0xec27('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec27('0x15'))(_0xec27('0x16'));var utils=require(_0xec27('0x17'));var config=require(_0xec27('0x18'));var licenseUtil=require(_0xec27('0x19'));var db=require(_0xec27('0x1a'))['db'];config[_0xec27('0x1b')]=_['defaults'](config[_0xec27('0x1b')],{'host':_0xec27('0x1c'),'port':0x18eb});var socket=require(_0xec27('0x1d'))(new Redis(config[_0xec27('0x1b')]));require(_0xec27('0x1e'))['register'](socket);function respondWithStatusCode(_0x41b8ad,_0x427193){_0x427193=_0x427193||0xcc;return function(_0x1a34b9){if(_0x1a34b9){return _0x41b8ad['sendStatus'](_0x427193);}return _0x41b8ad['status'](_0x427193)[_0xec27('0x1f')]();};}function respondWithResult(_0x20257b,_0x24bcf3){_0x24bcf3=_0x24bcf3||0xc8;return function(_0x5df6f7){if(_0x5df6f7){return _0x20257b[_0xec27('0x20')](_0x24bcf3)[_0xec27('0x21')](_0x5df6f7);}};}function respondWithFilteredResult(_0x36b1b3,_0x3e360b){return function(_0x364f6c){if(_0x364f6c){var _0x3b6606=typeof _0x3e360b[_0xec27('0x22')]===_0xec27('0x23')&&typeof _0x3e360b[_0xec27('0x24')]==='undefined';var _0x93c619=_0x364f6c[_0xec27('0x25')];var _0x42a89c=_0x3b6606?0x0:_0x3e360b[_0xec27('0x22')];var _0x3b1585=_0x3b6606?_0x364f6c[_0xec27('0x25')]:_0x3e360b['offset']+_0x3e360b[_0xec27('0x24')];var _0x5ceaa0;if(_0x3b1585>=_0x93c619){_0x3b1585=_0x93c619;_0x5ceaa0=0xc8;}else{_0x5ceaa0=0xce;}_0x36b1b3[_0xec27('0x20')](_0x5ceaa0);return _0x36b1b3[_0xec27('0x26')](_0xec27('0x27'),_0x42a89c+'-'+_0x3b1585+'/'+_0x93c619)[_0xec27('0x21')](_0x364f6c);}return null;};}function patchUpdates(_0x2d5d30){return function(_0x16d6b8){try{jsonpatch['apply'](_0x16d6b8,_0x2d5d30,!![]);}catch(_0x3a1506){return BPromise[_0xec27('0x28')](_0x3a1506);}return _0x16d6b8[_0xec27('0x29')]();};}function saveUpdates(_0x44e594,_0x17e954){return function(_0xb708ef){if(_0xb708ef){return _0xb708ef[_0xec27('0x2a')](_0x44e594)[_0xec27('0x2b')](function(_0x255d42){return _0x255d42;});}return null;};}function removeEntity(_0x468a82,_0x419abb){return function(_0x28bb7f){if(_0x28bb7f){return _0x28bb7f[_0xec27('0x2c')]()[_0xec27('0x2b')](function(){_0x468a82[_0xec27('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f5389,_0x33c9d6){return function(_0x122aa5){if(!_0x122aa5){_0x4f5389[_0xec27('0x2d')](0x194);}return _0x122aa5;};}function handleError(_0x1b4169,_0x5bad00){_0x5bad00=_0x5bad00||0x1f4;return function(_0x35e19b){logger[_0xec27('0x2e')](_0x35e19b[_0xec27('0x2f')]);if(_0x35e19b[_0xec27('0x30')]){delete _0x35e19b[_0xec27('0x30')];}_0x1b4169['status'](_0x5bad00)[_0xec27('0x31')](_0x35e19b);};}exports[_0xec27('0x32')]=function(_0x5738fb,_0x18440d){var _0x4c4a2e={},_0x16e745={},_0x464757={'count':0x0,'rows':[]};var _0x2dcea9=_['map'](db[_0xec27('0x33')][_0xec27('0x34')],function(_0x27f4c1){return{'name':_0x27f4c1[_0xec27('0x35')],'type':_0x27f4c1[_0xec27('0x36')][_0xec27('0x37')]};});_0x16e745[_0xec27('0x38')]=_['map'](_0x2dcea9,'name');_0x16e745[_0xec27('0x39')]=_[_0xec27('0x3a')](_0x5738fb[_0xec27('0x39')]);_0x16e745[_0xec27('0x3b')]=_[_0xec27('0x3c')](_0x16e745[_0xec27('0x38')],_0x16e745[_0xec27('0x39')]);_0x4c4a2e[_0xec27('0x3d')]=_['intersection'](_0x16e745[_0xec27('0x38')],qs['fields'](_0x5738fb[_0xec27('0x39')][_0xec27('0x3e')]));_0x4c4a2e[_0xec27('0x3d')]=_0x4c4a2e['attributes'][_0xec27('0x3f')]?_0x4c4a2e[_0xec27('0x3d')]:_0x16e745[_0xec27('0x38')];if(!_0x5738fb['query']['hasOwnProperty']('nolimit')){_0x4c4a2e[_0xec27('0x24')]=qs[_0xec27('0x24')](_0x5738fb['query']['limit']);_0x4c4a2e[_0xec27('0x22')]=qs[_0xec27('0x22')](_0x5738fb['query'][_0xec27('0x22')]);}_0x4c4a2e[_0xec27('0x40')]=qs[_0xec27('0x41')](_0x5738fb[_0xec27('0x39')][_0xec27('0x41')]);_0x4c4a2e[_0xec27('0x42')]=qs[_0xec27('0x3b')](_[_0xec27('0x43')](_0x5738fb[_0xec27('0x39')],_0x16e745[_0xec27('0x3b')]),_0x2dcea9);if(_0x5738fb[_0xec27('0x39')]['filter']){_0x4c4a2e[_0xec27('0x42')]=_[_0xec27('0x44')](_0x4c4a2e[_0xec27('0x42')],{'$or':_['map'](_0x2dcea9,function(_0x56c7c4){if(_0x56c7c4[_0xec27('0x36')]!==_0xec27('0x45')){var _0x546c32={};_0x546c32[_0x56c7c4[_0xec27('0x30')]]={'$like':'%'+_0x5738fb['query'][_0xec27('0x46')]+'%'};return _0x546c32;}})});}_0x4c4a2e=_[_0xec27('0x44')]({},_0x4c4a2e,_0x5738fb['options']);var _0x51a186={'where':_0x4c4a2e[_0xec27('0x42')]};return db[_0xec27('0x33')][_0xec27('0x25')](_0x51a186)[_0xec27('0x2b')](function(_0x5bdbdb){_0x464757['count']=_0x5bdbdb;if(_0x5738fb[_0xec27('0x39')][_0xec27('0x47')]){_0x4c4a2e['include']=[{'all':!![]}];}return db[_0xec27('0x33')][_0xec27('0x48')](_0x4c4a2e);})[_0xec27('0x2b')](function(_0x11a1cd){_0x464757['rows']=_0x11a1cd;return _0x464757;})[_0xec27('0x2b')](respondWithFilteredResult(_0x18440d,_0x4c4a2e))[_0xec27('0x49')](handleError(_0x18440d,null));};exports['show']=function(_0x18c9be,_0x3623d5){var _0x43b01f={'raw':!![],'where':{'id':_0x18c9be[_0xec27('0x4a')]['id']}},_0x2b3ba6={};_0x2b3ba6[_0xec27('0x38')]=_[_0xec27('0x3a')](db[_0xec27('0x33')][_0xec27('0x34')]);_0x2b3ba6[_0xec27('0x39')]=_[_0xec27('0x3a')](_0x18c9be[_0xec27('0x39')]);_0x2b3ba6[_0xec27('0x3b')]=_['intersection'](_0x2b3ba6[_0xec27('0x38')],_0x2b3ba6[_0xec27('0x39')]);_0x43b01f[_0xec27('0x3d')]=_[_0xec27('0x3c')](_0x2b3ba6[_0xec27('0x38')],qs['fields'](_0x18c9be[_0xec27('0x39')]['fields']));_0x43b01f[_0xec27('0x3d')]=_0x43b01f[_0xec27('0x3d')]['length']?_0x43b01f[_0xec27('0x3d')]:_0x2b3ba6[_0xec27('0x38')];if(_0x18c9be['query'][_0xec27('0x47')]){_0x43b01f[_0xec27('0x4b')]=[{'all':!![]}];}_0x43b01f=_[_0xec27('0x44')]({},_0x43b01f,_0x18c9be[_0xec27('0x4c')]);return db['ChatGroup'][_0xec27('0x4d')](_0x43b01f)[_0xec27('0x2b')](handleEntityNotFound(_0x3623d5,null))['then'](respondWithResult(_0x3623d5,null))[_0xec27('0x49')](handleError(_0x3623d5,null));};exports[_0xec27('0x4e')]=function(_0x545e70,_0x33886a){return db[_0xec27('0x33')][_0xec27('0x4e')](_0x545e70[_0xec27('0x4f')],{})[_0xec27('0x2b')](respondWithResult(_0x33886a,0xc9))[_0xec27('0x49')](handleError(_0x33886a,null));};exports['update']=function(_0x255c77,_0x249b26){if(_0x255c77['body']['id']){delete _0x255c77['body']['id'];}return db[_0xec27('0x33')][_0xec27('0x4d')]({'where':{'id':_0x255c77['params']['id']}})['then'](handleEntityNotFound(_0x249b26,null))['then'](saveUpdates(_0x255c77['body'],null))[_0xec27('0x2b')](respondWithResult(_0x249b26,null))[_0xec27('0x49')](handleError(_0x249b26,null));};exports['destroy']=function(_0x5311ce,_0x3afa76){return db[_0xec27('0x33')][_0xec27('0x4d')]({'where':{'id':_0x5311ce[_0xec27('0x4a')]['id']}})[_0xec27('0x2b')](handleEntityNotFound(_0x3afa76,null))['then'](removeEntity(_0x3afa76,null))[_0xec27('0x49')](handleError(_0x3afa76,null));};exports[_0xec27('0x50')]=function(_0xd37bd3,_0x45456e){return db['ChatGroup']['describe']()[_0xec27('0x2b')](respondWithResult(_0x45456e,null))[_0xec27('0x49')](handleError(_0x45456e,null));};exports[_0xec27('0x51')]=function(_0x4cc638,_0x4cef52,_0x57a2c2){return db[_0xec27('0x52')]['count']({'where':{'ChatGroupId':_0x4cc638['params']['id'],'ToId':_0x4cc638[_0xec27('0x53')]['id'],'read':![]}})[_0xec27('0x2b')](function(_0x3f57ef){return{'id':_[_0xec27('0x54')](_0x4cc638[_0xec27('0x4a')]['id']),'count':_0x3f57ef};})['then'](respondWithResult(_0x4cef52,null))[_0xec27('0x49')](handleError(_0x4cef52,null));};exports[_0xec27('0x55')]=function(_0x36478a,_0x129760,_0x4bdd58){return db['ChatGroup'][_0xec27('0x4d')]({'where':{'id':_0x36478a['params']['id']}})[_0xec27('0x2b')](handleEntityNotFound(_0x129760,null))[_0xec27('0x2b')](function(_0x4ce445){if(_0x4ce445){return _0x4ce445[_0xec27('0x55')](_0x36478a[_0xec27('0x4f')][_0xec27('0x56')],_[_0xec27('0x57')](_0x36478a[_0xec27('0x4f')],[_0xec27('0x56'),'id'])||{});}})['then'](respondWithResult(_0x129760,null))[_0xec27('0x49')](handleError(_0x129760,null));};exports[_0xec27('0x58')]=function(_0x5ea398,_0x12f603,_0x32d9b7){var _0x39798b={};var _0x13d132={};var _0x5cb77b;var _0x38f4f5;return db['ChatGroup'][_0xec27('0x59')]({'where':{'id':_0x5ea398[_0xec27('0x4a')]['id']}})[_0xec27('0x2b')](handleEntityNotFound(_0x12f603,null))['then'](function(_0x4a6feb){if(_0x4a6feb){_0x5cb77b=_0x4a6feb;_0x13d132['model']=_['keys'](db['User'][_0xec27('0x34')]);_0x13d132[_0xec27('0x39')]=_[_0xec27('0x3a')](_0x5ea398['query']);_0x13d132['filters']=_[_0xec27('0x3c')](_0x13d132['model'],_0x13d132[_0xec27('0x39')]);_0x39798b[_0xec27('0x3d')]=_['intersection'](_0x13d132['model'],qs[_0xec27('0x3e')](_0x5ea398[_0xec27('0x39')][_0xec27('0x3e')]));_0x39798b['attributes']=_0x39798b[_0xec27('0x3d')][_0xec27('0x3f')]?_0x39798b[_0xec27('0x3d')]:_0x13d132['model'];_0x39798b[_0xec27('0x40')]=qs[_0xec27('0x41')](_0x5ea398[_0xec27('0x39')][_0xec27('0x41')]);_0x39798b[_0xec27('0x42')]=qs[_0xec27('0x3b')](_[_0xec27('0x43')](_0x5ea398[_0xec27('0x39')],_0x13d132[_0xec27('0x3b')]));if(_0x5ea398[_0xec27('0x39')][_0xec27('0x46')]){_0x39798b[_0xec27('0x42')]=_[_0xec27('0x44')](_0x39798b[_0xec27('0x42')],{'$or':_[_0xec27('0x5a')](_0x39798b[_0xec27('0x3d')],function(_0xa93056){var _0x446008={};_0x446008[_0xa93056]={'$like':'%'+_0x5ea398[_0xec27('0x39')]['filter']+'%'};return _0x446008;})});}_0x39798b=_[_0xec27('0x44')]({},_0x39798b,_0x5ea398[_0xec27('0x4c')]);return _0x5cb77b[_0xec27('0x58')](_0x39798b);}})[_0xec27('0x2b')](function(_0x125083){if(_0x125083){_0x38f4f5=_0x125083[_0xec27('0x3f')];if(!_0x5ea398[_0xec27('0x39')][_0xec27('0x5b')]('nolimit')){_0x39798b[_0xec27('0x24')]=qs['limit'](_0x5ea398['query'][_0xec27('0x24')]);_0x39798b[_0xec27('0x22')]=qs[_0xec27('0x22')](_0x5ea398[_0xec27('0x39')][_0xec27('0x22')]);}return _0x5cb77b[_0xec27('0x58')](_0x39798b);}})[_0xec27('0x2b')](function(_0x44c54b){if(_0x44c54b){return _0x44c54b?{'count':_0x38f4f5,'rows':_0x44c54b}:null;}})[_0xec27('0x2b')](respondWithResult(_0x12f603,null))['catch'](handleError(_0x12f603,null));};exports[_0xec27('0x5c')]=function(_0x2686a3,_0x540ab9,_0x558978){return db[_0xec27('0x33')][_0xec27('0x4d')]({'where':{'id':_0x2686a3['params']['id']}})['then'](handleEntityNotFound(_0x540ab9,null))['then'](function(_0x34da2e){if(_0x34da2e){return _0x34da2e['removeMembers'](_0x2686a3[_0xec27('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x540ab9,null))[_0xec27('0x49')](handleError(_0x540ab9,null));};exports[_0xec27('0x5d')]=function(_0x41e31d,_0x19a31e,_0xb79c3){if(_0x41e31d['body']['id']){delete _0x41e31d[_0xec27('0x4f')]['id'];}return db[_0xec27('0x33')][_0xec27('0x4d')]({'where':{'id':_0x41e31d[_0xec27('0x4a')]['id']}})[_0xec27('0x2b')](handleEntityNotFound(_0x19a31e,null))[_0xec27('0x2b')](function(_0x58934d){if(_0x58934d){_0x41e31d[_0xec27('0x4f')][_0xec27('0x5e')]=_0x58934d['id'];return db[_0xec27('0x52')]['create'](_0x41e31d[_0xec27('0x4f')]);}})[_0xec27('0x2b')](respondWithResult(_0x19a31e,null))[_0xec27('0x49')](handleError(_0x19a31e,null));};exports[_0xec27('0x5f')]=function(_0x2927ad,_0x76dd33,_0x1e2bda){var _0xf4b388={};var _0x34dece={};var _0x437cf1;var _0x109967;return db['ChatGroup'][_0xec27('0x59')]({'where':{'id':_0x2927ad[_0xec27('0x4a')]['id']}})[_0xec27('0x2b')](handleEntityNotFound(_0x76dd33,null))[_0xec27('0x2b')](function(_0x19cea1){if(_0x19cea1){_0x437cf1=_0x19cea1;_0x34dece[_0xec27('0x38')]=_[_0xec27('0x3a')](db[_0xec27('0x52')][_0xec27('0x34')]);_0x34dece[_0xec27('0x39')]=_['keys'](_0x2927ad[_0xec27('0x39')]);_0x34dece[_0xec27('0x3b')]=_['intersection'](_0x34dece['model'],_0x34dece[_0xec27('0x39')]);_0xf4b388[_0xec27('0x3d')]=_[_0xec27('0x3c')](_0x34dece[_0xec27('0x38')],qs[_0xec27('0x3e')](_0x2927ad['query'][_0xec27('0x3e')]));_0xf4b388['attributes']=_0xf4b388[_0xec27('0x3d')]['length']?_0xf4b388[_0xec27('0x3d')]:_0x34dece['model'];_0xf4b388['order']=qs['sort'](_0x2927ad['query']['sort']);_0xf4b388[_0xec27('0x42')]=qs['filters'](_[_0xec27('0x43')](_0x2927ad[_0xec27('0x39')],_0x34dece['filters']));if(_0x2927ad[_0xec27('0x39')][_0xec27('0x46')]){_0xf4b388['where']=_[_0xec27('0x44')](_0xf4b388[_0xec27('0x42')],{'$or':_[_0xec27('0x5a')](_0xf4b388[_0xec27('0x3d')],function(_0x50e4cf){var _0x47a7f3={};_0x47a7f3[_0x50e4cf]={'$like':'%'+_0x2927ad['query'][_0xec27('0x46')]+'%'};return _0x47a7f3;})});}if(_0x2927ad[_0xec27('0x39')]['$gte']){var _0x42887e=_0x2927ad[_0xec27('0x39')][_0xec27('0x60')][_0xec27('0x61')](',');var _0x440f99={};_0x440f99[_0x42887e[0x0]]={'$gte':moment(_0x42887e[0x1])['format'](_0xec27('0x62'))};_0xf4b388[_0xec27('0x42')]=_['merge'](_0xf4b388[_0xec27('0x42')],_0x440f99);}_0xf4b388=_[_0xec27('0x44')]({},_0xf4b388,_0x2927ad['options']);return _0x437cf1[_0xec27('0x5f')](_0xf4b388);}})[_0xec27('0x2b')](function(_0x52c389){if(_0x52c389){_0x109967=_0x52c389[_0xec27('0x3f')];if(!_0x2927ad[_0xec27('0x39')][_0xec27('0x5b')](_0xec27('0x63'))){_0xf4b388['limit']=qs[_0xec27('0x24')](_0x2927ad['query'][_0xec27('0x24')]);_0xf4b388[_0xec27('0x22')]=qs['offset'](_0x2927ad[_0xec27('0x39')][_0xec27('0x22')]);}return _0x437cf1[_0xec27('0x5f')](_0xf4b388);}})[_0xec27('0x2b')](function(_0x4a9761){if(_0x4a9761){return _0x4a9761?{'count':_0x109967,'rows':_0x4a9761}:null;}})[_0xec27('0x2b')](respondWithResult(_0x76dd33,null))[_0xec27('0x49')](handleError(_0x76dd33,null));}; \ No newline at end of file +var _0x5990=['ids','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','describe','getUnread','user'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x5990,0x129));var _0x0599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5990[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x0599('0x0'));var rimraf=require(_0x0599('0x1'));var zipdir=require(_0x0599('0x2'));var jsonpatch=require(_0x0599('0x3'));var rp=require(_0x0599('0x4'));var moment=require(_0x0599('0x5'));var BPromise=require(_0x0599('0x6'));var Mustache=require('mustache');var util=require(_0x0599('0x7'));var path=require(_0x0599('0x8'));var sox=require('sox');var csv=require(_0x0599('0x9'));var ejs=require(_0x0599('0xa'));var fs=require('fs');var fs_extra=require(_0x0599('0xb'));var _=require('lodash');var squel=require(_0x0599('0xc'));var crypto=require(_0x0599('0xd'));var jsforce=require(_0x0599('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0599('0xf'));var Papa=require('papaparse');var Redis=require(_0x0599('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0599('0x11'));var as=require(_0x0599('0x12'));var hardwareService=require(_0x0599('0x13'));var logger=require('../../config/logger')(_0x0599('0x14'));var utils=require(_0x0599('0x15'));var config=require(_0x0599('0x16'));var licenseUtil=require(_0x0599('0x17'));var db=require(_0x0599('0x18'))['db'];config[_0x0599('0x19')]=_['defaults'](config[_0x0599('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0599('0x19')]));require('./chatGroup.socket')[_0x0599('0x1a')](socket);function respondWithStatusCode(_0x3a51bf,_0x619452){_0x619452=_0x619452||0xcc;return function(_0x13b43c){if(_0x13b43c){return _0x3a51bf[_0x0599('0x1b')](_0x619452);}return _0x3a51bf[_0x0599('0x1c')](_0x619452)[_0x0599('0x1d')]();};}function respondWithResult(_0x5b894d,_0x2c9a11){_0x2c9a11=_0x2c9a11||0xc8;return function(_0x4fd45f){if(_0x4fd45f){return _0x5b894d[_0x0599('0x1c')](_0x2c9a11)[_0x0599('0x1e')](_0x4fd45f);}};}function respondWithFilteredResult(_0x13cb5d,_0x30f067){return function(_0x4dc654){if(_0x4dc654){var _0x357109=typeof _0x30f067['offset']===_0x0599('0x1f')&&typeof _0x30f067[_0x0599('0x20')]==='undefined';var _0xcb0ec=_0x4dc654[_0x0599('0x21')];var _0x5bf590=_0x357109?0x0:_0x30f067[_0x0599('0x22')];var _0x5cda77=_0x357109?_0x4dc654[_0x0599('0x21')]:_0x30f067[_0x0599('0x22')]+_0x30f067[_0x0599('0x20')];var _0x2aa01e;if(_0x5cda77>=_0xcb0ec){_0x5cda77=_0xcb0ec;_0x2aa01e=0xc8;}else{_0x2aa01e=0xce;}_0x13cb5d[_0x0599('0x1c')](_0x2aa01e);return _0x13cb5d[_0x0599('0x23')](_0x0599('0x24'),_0x5bf590+'-'+_0x5cda77+'/'+_0xcb0ec)[_0x0599('0x1e')](_0x4dc654);}return null;};}function patchUpdates(_0x23af01){return function(_0x148dae){try{jsonpatch[_0x0599('0x25')](_0x148dae,_0x23af01,!![]);}catch(_0x1cb1f2){return BPromise[_0x0599('0x26')](_0x1cb1f2);}return _0x148dae[_0x0599('0x27')]();};}function saveUpdates(_0x407aec,_0x78fb40){return function(_0x38b956){if(_0x38b956){return _0x38b956[_0x0599('0x28')](_0x407aec)['then'](function(_0x442985){return _0x442985;});}return null;};}function removeEntity(_0xf90b05,_0x33ba87){return function(_0x2ddb3e){if(_0x2ddb3e){return _0x2ddb3e[_0x0599('0x29')]()[_0x0599('0x2a')](function(){_0xf90b05[_0x0599('0x1c')](0xcc)[_0x0599('0x1d')]();});}};}function handleEntityNotFound(_0x21bec9,_0x259c77){return function(_0x2864d7){if(!_0x2864d7){_0x21bec9['sendStatus'](0x194);}return _0x2864d7;};}function handleError(_0x5bc0f2,_0x44ff09){_0x44ff09=_0x44ff09||0x1f4;return function(_0x2dae88){logger[_0x0599('0x2b')](_0x2dae88[_0x0599('0x2c')]);if(_0x2dae88['name']){delete _0x2dae88[_0x0599('0x2d')];}_0x5bc0f2[_0x0599('0x1c')](_0x44ff09)['send'](_0x2dae88);};}exports[_0x0599('0x2e')]=function(_0x3ba2ab,_0x10cb47){var _0x5d1464={},_0x365dfb={},_0x47aaa9={'count':0x0,'rows':[]};var _0x4cfa5c=_[_0x0599('0x2f')](db[_0x0599('0x30')][_0x0599('0x31')],function(_0x5c3f0b){return{'name':_0x5c3f0b[_0x0599('0x32')],'type':_0x5c3f0b[_0x0599('0x33')][_0x0599('0x34')]};});_0x365dfb['model']=_[_0x0599('0x2f')](_0x4cfa5c,_0x0599('0x2d'));_0x365dfb['query']=_[_0x0599('0x35')](_0x3ba2ab[_0x0599('0x36')]);_0x365dfb['filters']=_[_0x0599('0x37')](_0x365dfb[_0x0599('0x38')],_0x365dfb['query']);_0x5d1464['attributes']=_[_0x0599('0x37')](_0x365dfb[_0x0599('0x38')],qs[_0x0599('0x39')](_0x3ba2ab[_0x0599('0x36')][_0x0599('0x39')]));_0x5d1464['attributes']=_0x5d1464[_0x0599('0x3a')][_0x0599('0x3b')]?_0x5d1464[_0x0599('0x3a')]:_0x365dfb[_0x0599('0x38')];if(!_0x3ba2ab[_0x0599('0x36')][_0x0599('0x3c')](_0x0599('0x3d'))){_0x5d1464[_0x0599('0x20')]=qs[_0x0599('0x20')](_0x3ba2ab['query'][_0x0599('0x20')]);_0x5d1464[_0x0599('0x22')]=qs['offset'](_0x3ba2ab['query']['offset']);}_0x5d1464[_0x0599('0x3e')]=qs[_0x0599('0x3f')](_0x3ba2ab[_0x0599('0x36')][_0x0599('0x3f')]);_0x5d1464[_0x0599('0x40')]=qs['filters'](_[_0x0599('0x41')](_0x3ba2ab[_0x0599('0x36')],_0x365dfb[_0x0599('0x42')]),_0x4cfa5c);if(_0x3ba2ab['query'][_0x0599('0x43')]){_0x5d1464['where']=_[_0x0599('0x44')](_0x5d1464[_0x0599('0x40')],{'$or':_[_0x0599('0x2f')](_0x4cfa5c,function(_0x1e7eaf){if(_0x1e7eaf[_0x0599('0x33')]!==_0x0599('0x45')){var _0x22a0ac={};_0x22a0ac[_0x1e7eaf[_0x0599('0x2d')]]={'$like':'%'+_0x3ba2ab[_0x0599('0x36')][_0x0599('0x43')]+'%'};return _0x22a0ac;}})});}_0x5d1464=_['merge']({},_0x5d1464,_0x3ba2ab[_0x0599('0x46')]);var _0x3bbc1c={'where':_0x5d1464[_0x0599('0x40')]};return db[_0x0599('0x30')][_0x0599('0x21')](_0x3bbc1c)[_0x0599('0x2a')](function(_0x4620d8){_0x47aaa9['count']=_0x4620d8;if(_0x3ba2ab['query'][_0x0599('0x47')]){_0x5d1464[_0x0599('0x48')]=[{'all':!![]}];}return db[_0x0599('0x30')][_0x0599('0x49')](_0x5d1464);})[_0x0599('0x2a')](function(_0x5a898c){_0x47aaa9['rows']=_0x5a898c;return _0x47aaa9;})[_0x0599('0x2a')](respondWithFilteredResult(_0x10cb47,_0x5d1464))[_0x0599('0x4a')](handleError(_0x10cb47,null));};exports[_0x0599('0x4b')]=function(_0x120f16,_0x4e076b){var _0x543dbe={'raw':!![],'where':{'id':_0x120f16[_0x0599('0x4c')]['id']}},_0x26e3f0={};_0x26e3f0[_0x0599('0x38')]=_[_0x0599('0x35')](db[_0x0599('0x30')]['rawAttributes']);_0x26e3f0[_0x0599('0x36')]=_[_0x0599('0x35')](_0x120f16[_0x0599('0x36')]);_0x26e3f0[_0x0599('0x42')]=_[_0x0599('0x37')](_0x26e3f0['model'],_0x26e3f0[_0x0599('0x36')]);_0x543dbe[_0x0599('0x3a')]=_[_0x0599('0x37')](_0x26e3f0[_0x0599('0x38')],qs[_0x0599('0x39')](_0x120f16[_0x0599('0x36')]['fields']));_0x543dbe[_0x0599('0x3a')]=_0x543dbe[_0x0599('0x3a')]['length']?_0x543dbe[_0x0599('0x3a')]:_0x26e3f0['model'];if(_0x120f16[_0x0599('0x36')][_0x0599('0x47')]){_0x543dbe['include']=[{'all':!![]}];}_0x543dbe=_[_0x0599('0x44')]({},_0x543dbe,_0x120f16['options']);return db['ChatGroup'][_0x0599('0x4d')](_0x543dbe)[_0x0599('0x2a')](handleEntityNotFound(_0x4e076b,null))[_0x0599('0x2a')](respondWithResult(_0x4e076b,null))[_0x0599('0x4a')](handleError(_0x4e076b,null));};exports[_0x0599('0x4e')]=function(_0x57868f,_0x240640){return db['ChatGroup'][_0x0599('0x4e')](_0x57868f[_0x0599('0x4f')],{})[_0x0599('0x2a')](respondWithResult(_0x240640,0xc9))[_0x0599('0x4a')](handleError(_0x240640,null));};exports['update']=function(_0x227a38,_0x18be7d){if(_0x227a38[_0x0599('0x4f')]['id']){delete _0x227a38['body']['id'];}return db[_0x0599('0x30')][_0x0599('0x4d')]({'where':{'id':_0x227a38['params']['id']}})[_0x0599('0x2a')](handleEntityNotFound(_0x18be7d,null))[_0x0599('0x2a')](saveUpdates(_0x227a38[_0x0599('0x4f')],null))[_0x0599('0x2a')](respondWithResult(_0x18be7d,null))[_0x0599('0x4a')](handleError(_0x18be7d,null));};exports['destroy']=function(_0x5e386a,_0x10e1cc){return db[_0x0599('0x30')][_0x0599('0x4d')]({'where':{'id':_0x5e386a[_0x0599('0x4c')]['id']}})[_0x0599('0x2a')](handleEntityNotFound(_0x10e1cc,null))[_0x0599('0x2a')](removeEntity(_0x10e1cc,null))['catch'](handleError(_0x10e1cc,null));};exports[_0x0599('0x50')]=function(_0x5f000a,_0x3662a9){return db[_0x0599('0x30')]['describe']()['then'](respondWithResult(_0x3662a9,null))[_0x0599('0x4a')](handleError(_0x3662a9,null));};exports[_0x0599('0x51')]=function(_0x191dbc,_0x2d9548,_0x1bcb19){return db['ChatInternalMessage'][_0x0599('0x21')]({'where':{'ChatGroupId':_0x191dbc[_0x0599('0x4c')]['id'],'ToId':_0x191dbc[_0x0599('0x52')]['id'],'read':![]}})[_0x0599('0x2a')](function(_0x208a91){return{'id':_['toInteger'](_0x191dbc[_0x0599('0x4c')]['id']),'count':_0x208a91};})[_0x0599('0x2a')](respondWithResult(_0x2d9548,null))[_0x0599('0x4a')](handleError(_0x2d9548,null));};exports['addMembers']=function(_0x5ac8ed,_0x5787ab,_0x4d590e){return db[_0x0599('0x30')][_0x0599('0x4d')]({'where':{'id':_0x5ac8ed['params']['id']}})[_0x0599('0x2a')](handleEntityNotFound(_0x5787ab,null))[_0x0599('0x2a')](function(_0x5cb126){if(_0x5cb126){return _0x5cb126['addMembers'](_0x5ac8ed[_0x0599('0x4f')][_0x0599('0x53')],_['omit'](_0x5ac8ed[_0x0599('0x4f')],[_0x0599('0x53'),'id'])||{});}})['then'](respondWithResult(_0x5787ab,null))[_0x0599('0x4a')](handleError(_0x5787ab,null));};exports[_0x0599('0x54')]=function(_0x2e7ea7,_0x24092a,_0xc4dc80){var _0x3272cb={};var _0x456018={};var _0x3e2bf2;var _0x114862;return db['ChatGroup'][_0x0599('0x55')]({'where':{'id':_0x2e7ea7[_0x0599('0x4c')]['id']}})[_0x0599('0x2a')](handleEntityNotFound(_0x24092a,null))[_0x0599('0x2a')](function(_0x109f46){if(_0x109f46){_0x3e2bf2=_0x109f46;_0x456018[_0x0599('0x38')]=_[_0x0599('0x35')](db[_0x0599('0x56')][_0x0599('0x31')]);_0x456018[_0x0599('0x36')]=_[_0x0599('0x35')](_0x2e7ea7[_0x0599('0x36')]);_0x456018['filters']=_[_0x0599('0x37')](_0x456018[_0x0599('0x38')],_0x456018[_0x0599('0x36')]);_0x3272cb[_0x0599('0x3a')]=_[_0x0599('0x37')](_0x456018[_0x0599('0x38')],qs[_0x0599('0x39')](_0x2e7ea7[_0x0599('0x36')][_0x0599('0x39')]));_0x3272cb[_0x0599('0x3a')]=_0x3272cb[_0x0599('0x3a')]['length']?_0x3272cb[_0x0599('0x3a')]:_0x456018[_0x0599('0x38')];_0x3272cb[_0x0599('0x3e')]=qs[_0x0599('0x3f')](_0x2e7ea7[_0x0599('0x36')][_0x0599('0x3f')]);_0x3272cb[_0x0599('0x40')]=qs[_0x0599('0x42')](_[_0x0599('0x41')](_0x2e7ea7[_0x0599('0x36')],_0x456018['filters']));if(_0x2e7ea7['query'][_0x0599('0x43')]){_0x3272cb[_0x0599('0x40')]=_['merge'](_0x3272cb[_0x0599('0x40')],{'$or':_['map'](_0x3272cb['attributes'],function(_0x1d4c09){var _0x4c5947={};_0x4c5947[_0x1d4c09]={'$like':'%'+_0x2e7ea7['query'][_0x0599('0x43')]+'%'};return _0x4c5947;})});}_0x3272cb=_[_0x0599('0x44')]({},_0x3272cb,_0x2e7ea7[_0x0599('0x46')]);return _0x3e2bf2[_0x0599('0x54')](_0x3272cb);}})[_0x0599('0x2a')](function(_0x4cd5e1){if(_0x4cd5e1){_0x114862=_0x4cd5e1['length'];if(!_0x2e7ea7[_0x0599('0x36')][_0x0599('0x3c')](_0x0599('0x3d'))){_0x3272cb[_0x0599('0x20')]=qs[_0x0599('0x20')](_0x2e7ea7[_0x0599('0x36')][_0x0599('0x20')]);_0x3272cb[_0x0599('0x22')]=qs[_0x0599('0x22')](_0x2e7ea7[_0x0599('0x36')]['offset']);}return _0x3e2bf2[_0x0599('0x54')](_0x3272cb);}})[_0x0599('0x2a')](function(_0x19f8ec){if(_0x19f8ec){return _0x19f8ec?{'count':_0x114862,'rows':_0x19f8ec}:null;}})[_0x0599('0x2a')](respondWithResult(_0x24092a,null))[_0x0599('0x4a')](handleError(_0x24092a,null));};exports[_0x0599('0x57')]=function(_0x1e0761,_0x1891ad,_0x51d4d3){return db[_0x0599('0x30')]['find']({'where':{'id':_0x1e0761[_0x0599('0x4c')]['id']}})[_0x0599('0x2a')](handleEntityNotFound(_0x1891ad,null))[_0x0599('0x2a')](function(_0xff013c){if(_0xff013c){return _0xff013c['removeMembers'](_0x1e0761['query'][_0x0599('0x53')]);}})[_0x0599('0x2a')](respondWithStatusCode(_0x1891ad,null))[_0x0599('0x4a')](handleError(_0x1891ad,null));};exports[_0x0599('0x58')]=function(_0x56465d,_0x41dc28,_0x4834e7){if(_0x56465d[_0x0599('0x4f')]['id']){delete _0x56465d[_0x0599('0x4f')]['id'];}return db[_0x0599('0x30')][_0x0599('0x4d')]({'where':{'id':_0x56465d[_0x0599('0x4c')]['id']}})[_0x0599('0x2a')](handleEntityNotFound(_0x41dc28,null))['then'](function(_0x3228c9){if(_0x3228c9){_0x56465d[_0x0599('0x4f')][_0x0599('0x59')]=_0x3228c9['id'];return db['ChatInternalMessage'][_0x0599('0x4e')](_0x56465d[_0x0599('0x4f')]);}})['then'](respondWithResult(_0x41dc28,null))[_0x0599('0x4a')](handleError(_0x41dc28,null));};exports['getMessages']=function(_0x27de61,_0x2b585f,_0x122f29){var _0x50a55f={};var _0x19a821={};var _0x36cd96;var _0xf3907d;return db[_0x0599('0x30')][_0x0599('0x55')]({'where':{'id':_0x27de61[_0x0599('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2b585f,null))[_0x0599('0x2a')](function(_0x3fc723){if(_0x3fc723){_0x36cd96=_0x3fc723;_0x19a821['model']=_[_0x0599('0x35')](db['ChatInternalMessage'][_0x0599('0x31')]);_0x19a821['query']=_[_0x0599('0x35')](_0x27de61[_0x0599('0x36')]);_0x19a821[_0x0599('0x42')]=_[_0x0599('0x37')](_0x19a821[_0x0599('0x38')],_0x19a821['query']);_0x50a55f['attributes']=_[_0x0599('0x37')](_0x19a821[_0x0599('0x38')],qs['fields'](_0x27de61[_0x0599('0x36')][_0x0599('0x39')]));_0x50a55f[_0x0599('0x3a')]=_0x50a55f[_0x0599('0x3a')][_0x0599('0x3b')]?_0x50a55f[_0x0599('0x3a')]:_0x19a821[_0x0599('0x38')];_0x50a55f[_0x0599('0x3e')]=qs['sort'](_0x27de61[_0x0599('0x36')][_0x0599('0x3f')]);_0x50a55f[_0x0599('0x40')]=qs[_0x0599('0x42')](_[_0x0599('0x41')](_0x27de61[_0x0599('0x36')],_0x19a821['filters']));if(_0x27de61[_0x0599('0x36')]['filter']){_0x50a55f[_0x0599('0x40')]=_[_0x0599('0x44')](_0x50a55f[_0x0599('0x40')],{'$or':_['map'](_0x50a55f['attributes'],function(_0x3accbf){var _0xc84093={};_0xc84093[_0x3accbf]={'$like':'%'+_0x27de61['query']['filter']+'%'};return _0xc84093;})});}if(_0x27de61['query'][_0x0599('0x5a')]){var _0x493348=_0x27de61[_0x0599('0x36')][_0x0599('0x5a')][_0x0599('0x5b')](',');var _0xf774a7={};_0xf774a7[_0x493348[0x0]]={'$gte':moment(_0x493348[0x1])[_0x0599('0x5c')](_0x0599('0x5d'))};_0x50a55f[_0x0599('0x40')]=_[_0x0599('0x44')](_0x50a55f[_0x0599('0x40')],_0xf774a7);}_0x50a55f=_[_0x0599('0x44')]({},_0x50a55f,_0x27de61['options']);return _0x36cd96[_0x0599('0x5e')](_0x50a55f);}})[_0x0599('0x2a')](function(_0xf0a090){if(_0xf0a090){_0xf3907d=_0xf0a090[_0x0599('0x3b')];if(!_0x27de61[_0x0599('0x36')][_0x0599('0x3c')]('nolimit')){_0x50a55f[_0x0599('0x20')]=qs['limit'](_0x27de61[_0x0599('0x36')][_0x0599('0x20')]);_0x50a55f[_0x0599('0x22')]=qs[_0x0599('0x22')](_0x27de61[_0x0599('0x36')][_0x0599('0x22')]);}return _0x36cd96['getMessages'](_0x50a55f);}})['then'](function(_0x3f89c3){if(_0x3f89c3){return _0x3f89c3?{'count':_0xf3907d,'rows':_0x3f89c3}:null;}})[_0x0599('0x2a')](respondWithResult(_0x2b585f,null))[_0x0599('0x4a')](handleError(_0x2b585f,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index f8ecddd..1b5351a 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 _0xa77e=['hasOwnProperty','hook','events','../../mysqldb','ChatGroup','save','update','remove','emit'];(function(_0xbe5d6b,_0x439324){var _0x210aa0=function(_0x19755d){while(--_0x19755d){_0xbe5d6b['push'](_0xbe5d6b['shift']());}};_0x210aa0(++_0x439324);}(_0xa77e,0x197));var _0xea77=function(_0x32d122,_0x3effeb){_0x32d122=_0x32d122-0x0;var _0x16d0fe=_0xa77e[_0x32d122];return _0x16d0fe;};'use strict';var EventEmitter=require(_0xea77('0x0'));var ChatGroup=require(_0xea77('0x1'))['db'][_0xea77('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xea77('0x3'),'afterUpdate':_0xea77('0x4'),'afterDestroy':_0xea77('0x5')};function emitEvent(_0x3475a1){return function(_0x30d29a,_0x15970e,_0x3b7a0f){ChatGroupEvents['emit'](_0x3475a1+':'+_0x30d29a['id'],_0x30d29a);ChatGroupEvents[_0xea77('0x6')](_0x3475a1,_0x30d29a);_0x3b7a0f(null);};}for(var e in events){if(events[_0xea77('0x7')](e)){var event=events[e];ChatGroup[_0xea77('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x171c=['setMaxListeners','save','remove','emit','ChatGroup'];(function(_0x6c82cf,_0x121c8f){var _0x3ef004=function(_0x5777ea){while(--_0x5777ea){_0x6c82cf['push'](_0x6c82cf['shift']());}};_0x3ef004(++_0x121c8f);}(_0x171c,0x8b));var _0xc171=function(_0x3b3f79,_0x469987){_0x3b3f79=_0x3b3f79-0x0;var _0xb77236=_0x171c[_0x3b3f79];return _0xb77236;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xc171('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc171('0x1')](0x0);var events={'afterCreate':_0xc171('0x2'),'afterUpdate':'update','afterDestroy':_0xc171('0x3')};function emitEvent(_0x2e1a51){return function(_0x58edf4,_0x4b8768,_0x26c71c){ChatGroupEvents[_0xc171('0x4')](_0x2e1a51+':'+_0x58edf4['id'],_0x58edf4);ChatGroupEvents['emit'](_0x2e1a51,_0x58edf4);_0x26c71c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6cf708a..73d6f00 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 _0x3fae=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','chat_groups'];(function(_0xc8c149,_0x104184){var _0x261259=function(_0x314df3){while(--_0x314df3){_0xc8c149['push'](_0xc8c149['shift']());}};_0x261259(++_0x104184);}(_0x3fae,0xbb));var _0xe3fa=function(_0x468289,_0x6aee23){_0x468289=_0x468289-0x0;var _0x54e03f=_0x3fae[_0x468289];return _0x54e03f;};'use strict';var _=require('lodash');var util=require(_0xe3fa('0x0'));var logger=require('../../config/logger')(_0xe3fa('0x1'));var moment=require(_0xe3fa('0x2'));var BPromise=require(_0xe3fa('0x3'));var rp=require(_0xe3fa('0x4'));var fs=require('fs');var path=require(_0xe3fa('0x5'));var rimraf=require(_0xe3fa('0x6'));var config=require(_0xe3fa('0x7'));var attributes=require(_0xe3fa('0x8'));module['exports']=function(_0x4851d4,_0x24e236){return _0x4851d4[_0xe3fa('0x9')]('ChatGroup',attributes,{'tableName':_0xe3fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7978=['define','ChatGroup','chat_groups','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2b0b61,_0x170827){var _0x2ae144=function(_0x4f0459){while(--_0x4f0459){_0x2b0b61['push'](_0x2b0b61['shift']());}};_0x2ae144(++_0x170827);}(_0x7978,0x123));var _0x8797=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x7978[_0x31a371];return _0x2a5bd6;};'use strict';var _=require(_0x8797('0x0'));var util=require(_0x8797('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8797('0x2'));var BPromise=require(_0x8797('0x3'));var rp=require(_0x8797('0x4'));var fs=require('fs');var path=require(_0x8797('0x5'));var rimraf=require(_0x8797('0x6'));var config=require(_0x8797('0x7'));var attributes=require('./chatGroup.attributes');module[_0x8797('0x8')]=function(_0xd80ea2,_0x2a6aa6){return _0xd80ea2[_0x8797('0x9')](_0x8797('0xa'),attributes,{'tableName':_0x8797('0xb'),'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 8264dd9..95fd127 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 _0x3937=['http','redis','defaults','localhost','./chatGroup.socket','register','info','ChatGroup,\x20%s,\x20%s','debug','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x428161,_0x47a951){var _0x53b947=function(_0x311774){while(--_0x311774){_0x428161['push'](_0x428161['shift']());}};_0x53b947(++_0x47a951);}(_0x3937,0xbf));var _0x7393=function(_0xbbc38,_0x429f7e){_0xbbc38=_0xbbc38-0x0;var _0xe0fb99=_0x3937[_0xbbc38];return _0xe0fb99;};'use strict';var _=require(_0x7393('0x0'));var util=require('util');var moment=require(_0x7393('0x1'));var BPromise=require(_0x7393('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7393('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7393('0x4'));var logger=require('../../config/logger')(_0x7393('0x5'));var config=require(_0x7393('0x6'));var jayson=require(_0x7393('0x7'));var client=jayson[_0x7393('0x8')][_0x7393('0x9')]({'port':0x232a});config[_0x7393('0xa')]=_[_0x7393('0xb')](config[_0x7393('0xa')],{'host':_0x7393('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7393('0xd'))[_0x7393('0xe')](socket);function respondWithRpcPromise(_0x1cc3fd,_0x4d3f6c,_0xab290c){return new BPromise(function(_0x5f0dd5,_0x56ed4c){return client['request'](_0x1cc3fd,_0xab290c)['then'](function(_0xe00598){logger[_0x7393('0xf')](_0x7393('0x10'),_0x4d3f6c,'request\x20sent');logger[_0x7393('0x11')](_0x7393('0x12'),_0x4d3f6c,_0x7393('0x13'),JSON[_0x7393('0x14')](_0xe00598));if(_0xe00598[_0x7393('0x15')]){if(_0xe00598[_0x7393('0x15')][_0x7393('0x16')]===0x1f4){logger[_0x7393('0x15')](_0x7393('0x10'),_0x4d3f6c,_0xe00598['error']['message']);return _0x56ed4c(_0xe00598[_0x7393('0x15')]['message']);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x4d3f6c,_0xe00598[_0x7393('0x15')]['message']);return _0x5f0dd5(_0xe00598[_0x7393('0x15')][_0x7393('0x17')]);}else{logger['info'](_0x7393('0x10'),_0x4d3f6c,'request\x20sent');_0x5f0dd5(_0xe00598['result'][_0x7393('0x17')]);}})[_0x7393('0x18')](function(_0x1b032c){logger[_0x7393('0x15')](_0x7393('0x10'),_0x4d3f6c,_0x1b032c);_0x56ed4c(_0x1b032c);});});} \ No newline at end of file +var _0xf37f=['request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s'];(function(_0x3a7162,_0xc5c3dc){var _0x34bee3=function(_0x2e1c62){while(--_0x2e1c62){_0x3a7162['push'](_0x3a7162['shift']());}};_0x34bee3(++_0xc5c3dc);}(_0xf37f,0x11a));var _0xff37=function(_0x31a415,_0x342648){_0x31a415=_0x31a415-0x0;var _0x159ccb=_0xf37f[_0x31a415];return _0x159ccb;};'use strict';var _=require('lodash');var util=require(_0xff37('0x0'));var moment=require('moment');var BPromise=require(_0xff37('0x1'));var rs=require(_0xff37('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xff37('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xff37('0x4'))(_0xff37('0x5'));var config=require('../../config/environment');var jayson=require(_0xff37('0x6'));var client=jayson[_0xff37('0x7')][_0xff37('0x8')]({'port':0x232a});config['redis']=_[_0xff37('0x9')](config[_0xff37('0xa')],{'host':_0xff37('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xff37('0xc'))[_0xff37('0xd')](socket);function respondWithRpcPromise(_0x115deb,_0x2ee7a8,_0x4b64f0){return new BPromise(function(_0x1ed7a9,_0x1235a1){return client[_0xff37('0xe')](_0x115deb,_0x4b64f0)[_0xff37('0xf')](function(_0x4e521f){logger[_0xff37('0x10')](_0xff37('0x11'),_0x2ee7a8,_0xff37('0x12'));logger['debug'](_0xff37('0x13'),_0x2ee7a8,_0xff37('0x12'),JSON[_0xff37('0x14')](_0x4e521f));if(_0x4e521f['error']){if(_0x4e521f[_0xff37('0x15')][_0xff37('0x16')]===0x1f4){logger[_0xff37('0x15')]('ChatGroup,\x20%s,\x20%s',_0x2ee7a8,_0x4e521f[_0xff37('0x15')][_0xff37('0x17')]);return _0x1235a1(_0x4e521f[_0xff37('0x15')][_0xff37('0x17')]);}logger[_0xff37('0x15')](_0xff37('0x11'),_0x2ee7a8,_0x4e521f[_0xff37('0x15')][_0xff37('0x17')]);return _0x1ed7a9(_0x4e521f[_0xff37('0x15')][_0xff37('0x17')]);}else{logger['info'](_0xff37('0x11'),_0x2ee7a8,_0xff37('0x12'));_0x1ed7a9(_0x4e521f['result'][_0xff37('0x17')]);}})[_0xff37('0x18')](function(_0x2683fc){logger['error'](_0xff37('0x11'),_0x2ee7a8,_0x2683fc);_0x1235a1(_0x2683fc);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index efce9ba..849c8e8 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 _0x8b07=['emit','removeListener','register','length','chatGroup:','./chatGroup.events','save','remove','update'];(function(_0x1c71cd,_0x4b696a){var _0x505500=function(_0x56300b){while(--_0x56300b){_0x1c71cd['push'](_0x1c71cd['shift']());}};_0x505500(++_0x4b696a);}(_0x8b07,0xc2));var _0x78b0=function(_0xc44d75,_0x222848){_0xc44d75=_0xc44d75-0x0;var _0x280d05=_0x8b07[_0xc44d75];return _0x280d05;};'use strict';var ChatGroupEvents=require(_0x78b0('0x0'));var events=[_0x78b0('0x1'),_0x78b0('0x2'),_0x78b0('0x3')];function createListener(_0x3fc51d,_0x4022e4){return function(_0x374dc2){_0x4022e4[_0x78b0('0x4')](_0x3fc51d,_0x374dc2);};}function removeListener(_0x409e81,_0x391cc1){return function(){ChatGroupEvents[_0x78b0('0x5')](_0x409e81,_0x391cc1);};}exports[_0x78b0('0x6')]=function(_0x2ce1a0){for(var _0x390fa8=0x0,_0x1b3a0f=events[_0x78b0('0x7')];_0x390fa8<_0x1b3a0f;_0x390fa8++){var _0x3ea73d=events[_0x390fa8];var _0x3c78de=createListener(_0x78b0('0x8')+_0x3ea73d,_0x2ce1a0);ChatGroupEvents['on'](_0x3ea73d,_0x3c78de);}}; \ No newline at end of file +var _0x18cd=['update','removeListener','register','length','chatGroup:','save'];(function(_0x3e9ef1,_0x50b5ee){var _0x4e0de6=function(_0x40fe72){while(--_0x40fe72){_0x3e9ef1['push'](_0x3e9ef1['shift']());}};_0x4e0de6(++_0x50b5ee);}(_0x18cd,0x113));var _0xd18c=function(_0x531d97,_0x461586){_0x531d97=_0x531d97-0x0;var _0x58c778=_0x18cd[_0x531d97];return _0x58c778;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0xd18c('0x0'),'remove',_0xd18c('0x1')];function createListener(_0xfc0676,_0xcfa30f){return function(_0x1cafbe){_0xcfa30f['emit'](_0xfc0676,_0x1cafbe);};}function removeListener(_0x3087cb,_0x35a69d){return function(){ChatGroupEvents[_0xd18c('0x2')](_0x3087cb,_0x35a69d);};}exports[_0xd18c('0x3')]=function(_0x5e34ba){for(var _0x5a2c45=0x0,_0x35b3d6=events[_0xd18c('0x4')];_0x5a2c45<_0x35b3d6;_0x5a2c45++){var _0x3931b7=events[_0x5a2c45];var _0xac4b81=createListener(_0xd18c('0x5')+_0x3931b7,_0x5e34ba);ChatGroupEvents['on'](_0x3931b7,_0xac4b81);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9d86252..d069f0a 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 _0xf3c2=['../../components/interaction/service','./chatGroup.controller','get','index','isAuthenticated','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','put','update','delete','destroy','removeMembers','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x69b55a,_0x438b40){var _0x235e7e=function(_0x25d8cd){while(--_0x25d8cd){_0x69b55a['push'](_0x69b55a['shift']());}};_0x235e7e(++_0x438b40);}(_0xf3c2,0xbd));var _0x2f3c=function(_0x521c3b,_0x1cc177){_0x521c3b=_0x521c3b-0x0;var _0x264eb2=_0xf3c2[_0x521c3b];return _0x264eb2;};'use strict';var multer=require(_0x2f3c('0x0'));var util=require(_0x2f3c('0x1'));var path=require(_0x2f3c('0x2'));var timeout=require(_0x2f3c('0x3'));var express=require('express');var router=express[_0x2f3c('0x4')]();var fs_extra=require(_0x2f3c('0x5'));var auth=require(_0x2f3c('0x6'));var interaction=require(_0x2f3c('0x7'));var config=require('../../config/environment');var controller=require(_0x2f3c('0x8'));router[_0x2f3c('0x9')]('/',auth['isAuthenticated'](),controller[_0x2f3c('0xa')]);router[_0x2f3c('0x9')]('/describe',auth[_0x2f3c('0xb')](),controller[_0x2f3c('0xc')]);router[_0x2f3c('0x9')](_0x2f3c('0xd'),auth['isAuthenticated'](),controller[_0x2f3c('0xe')]);router[_0x2f3c('0x9')](_0x2f3c('0xf'),auth[_0x2f3c('0xb')](),controller[_0x2f3c('0x10')]);router[_0x2f3c('0x9')](_0x2f3c('0x11'),auth[_0x2f3c('0xb')](),controller['getMembers']);router['get'](_0x2f3c('0x12'),auth['isAuthenticated'](),controller[_0x2f3c('0x13')]);router[_0x2f3c('0x14')]('/',auth[_0x2f3c('0xb')](),controller[_0x2f3c('0x15')]);router[_0x2f3c('0x14')](_0x2f3c('0x11'),auth[_0x2f3c('0xb')](),controller[_0x2f3c('0x16')]);router['post'](_0x2f3c('0x12'),auth[_0x2f3c('0xb')](),controller['addMessage']);router[_0x2f3c('0x17')](_0x2f3c('0xd'),auth[_0x2f3c('0xb')](),controller[_0x2f3c('0x18')]);router[_0x2f3c('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x2f3c('0x1a')]);router[_0x2f3c('0x19')](_0x2f3c('0x11'),auth['isAuthenticated'](),controller[_0x2f3c('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xca26=['/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','delete','/:id','destroy','removeMembers','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','show','/:id/unread','getUnread','/:id/members'];(function(_0x30f32c,_0x3a93d3){var _0x3db6fb=function(_0x5b317b){while(--_0x5b317b){_0x30f32c['push'](_0x30f32c['shift']());}};_0x3db6fb(++_0x3a93d3);}(_0xca26,0x66));var _0x6ca2=function(_0x51b8e7,_0x5c70fb){_0x51b8e7=_0x51b8e7-0x0;var _0x81fd25=_0xca26[_0x51b8e7];return _0x81fd25;};'use strict';var multer=require('multer');var util=require(_0x6ca2('0x0'));var path=require(_0x6ca2('0x1'));var timeout=require(_0x6ca2('0x2'));var express=require(_0x6ca2('0x3'));var router=express[_0x6ca2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ca2('0x5'));var interaction=require(_0x6ca2('0x6'));var config=require(_0x6ca2('0x7'));var controller=require(_0x6ca2('0x8'));router[_0x6ca2('0x9')]('/',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0xb')]);router[_0x6ca2('0x9')](_0x6ca2('0xc'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0xd')]);router[_0x6ca2('0x9')]('/:id',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0xe')]);router[_0x6ca2('0x9')](_0x6ca2('0xf'),auth['isAuthenticated'](),controller[_0x6ca2('0x10')]);router['get'](_0x6ca2('0x11'),auth[_0x6ca2('0xa')](),controller['getMembers']);router[_0x6ca2('0x9')](_0x6ca2('0x12'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x13')]);router[_0x6ca2('0x14')]('/',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x15')]);router[_0x6ca2('0x14')](_0x6ca2('0x11'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x16')]);router[_0x6ca2('0x14')](_0x6ca2('0x12'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x17')]);router[_0x6ca2('0x18')]('/:id',auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x19')]);router[_0x6ca2('0x1a')](_0x6ca2('0x1b'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x1c')]);router[_0x6ca2('0x1a')](_0x6ca2('0x11'),auth[_0x6ca2('0xa')](),controller[_0x6ca2('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index dc3e7aa..5d1f01f 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 _0x6f59=['long','out','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE'];(function(_0x177d4a,_0x35bcb7){var _0x3b1aa0=function(_0x6cda2){while(--_0x6cda2){_0x177d4a['push'](_0x177d4a['shift']());}};_0x3b1aa0(++_0x35bcb7);}(_0x6f59,0x1be));var _0x96f5=function(_0x282a11,_0x48910d){_0x282a11=_0x282a11-0x0;var _0x40895a=_0x6f59[_0x282a11];return _0x40895a;};'use strict';var Sequelize=require(_0x96f5('0x0'));module[_0x96f5('0x1')]={'closed':{'type':Sequelize[_0x96f5('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x96f5('0x3')]},'ratingType':{'type':Sequelize[_0x96f5('0x4')](_0x96f5('0x5'),_0x96f5('0x6')),'defaultValue':_0x96f5('0x5')},'ratingMessage':{'type':Sequelize[_0x96f5('0x7')]},'pathTranscript':{'type':Sequelize[_0x96f5('0x7')]},'mailTranscript':{'type':Sequelize[_0x96f5('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x96f5('0x9')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x96f5('0x8')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x96f5('0x8')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x96f5('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x96f5('0x8')]},'deviceModel':{'type':Sequelize[_0x96f5('0x8')]},'deviceVendor':{'type':Sequelize[_0x96f5('0x8')]},'deviceType':{'type':Sequelize[_0x96f5('0x8')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x96f5('0x8')]},'formData':{'type':Sequelize[_0x96f5('0x7')](_0x96f5('0xa'))},'read1stAt':{'type':Sequelize[_0x96f5('0x9')]},'lastMsgAt':{'type':Sequelize[_0x96f5('0x9')]},'lastMsgDirection':{'type':Sequelize[_0x96f5('0x4')]('in',_0x96f5('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x96f5('0x8')]},'customerPort':{'type':Sequelize[_0x96f5('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x96f5('0x7')]},'autoreplyExecuted':{'type':Sequelize[_0x96f5('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb921=['DATE','long','sequelize','exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING'];(function(_0x3eac7b,_0x43267d){var _0x15fd3a=function(_0x14d1fa){while(--_0x14d1fa){_0x3eac7b['push'](_0x3eac7b['shift']());}};_0x15fd3a(++_0x43267d);}(_0xb921,0x16a));var _0x1b92=function(_0x411e5d,_0x450c00){_0x411e5d=_0x411e5d-0x0;var _0x58298=_0xb921[_0x411e5d];return _0x58298;};'use strict';var Sequelize=require(_0x1b92('0x0'));module[_0x1b92('0x1')]={'closed':{'type':Sequelize[_0x1b92('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1b92('0x3')]},'ratingType':{'type':Sequelize[_0x1b92('0x4')]('star','thumb'),'defaultValue':_0x1b92('0x5')},'ratingMessage':{'type':Sequelize[_0x1b92('0x6')]},'pathTranscript':{'type':Sequelize[_0x1b92('0x6')]},'mailTranscript':{'type':Sequelize[_0x1b92('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1b92('0x8')]},'disposition':{'type':Sequelize[_0x1b92('0x7')]},'secondDisposition':{'type':Sequelize[_0x1b92('0x7')]},'thirdDisposition':{'type':Sequelize[_0x1b92('0x7')]},'note':{'type':Sequelize[_0x1b92('0x7')]},'browserName':{'type':Sequelize[_0x1b92('0x7')]},'browserVersion':{'type':Sequelize[_0x1b92('0x7')]},'osName':{'type':Sequelize[_0x1b92('0x7')]},'osVersion':{'type':Sequelize[_0x1b92('0x7')]},'deviceModel':{'type':Sequelize[_0x1b92('0x7')]},'deviceVendor':{'type':Sequelize[_0x1b92('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x1b92('0x6')]},'customerIp':{'type':Sequelize[_0x1b92('0x7')]},'formData':{'type':Sequelize[_0x1b92('0x6')](_0x1b92('0x9'))},'read1stAt':{'type':Sequelize[_0x1b92('0x8')]},'lastMsgAt':{'type':Sequelize[_0x1b92('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x1b92('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1b92('0x7')]},'customerPort':{'type':Sequelize[_0x1b92('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x1b92('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 230163e..93fdb39 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 _0x05af=['MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','\x22%s\x22\x20<%s>','mailTranscript','addMessage','ids','omit','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','ChatInteractionId','includeAgent','push','setTags','spread','chatInteractionTags:save','removeTags','unix','toString','server','files','transcript-%d-%s.zip','firstName','attachments','read','Account','Owner','get','mkdirSync','Chat','closedAt','browserName','osName','referer','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','out','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','util','path','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','jayson/promise','http','client','request','then','info','request\x20sent','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','update','destroy','stack','name','render','merge','body','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','show','params','keys','filters','intersection','model','attributes','length','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooTopic','vidaooMetadata','vidaooEscalation','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','Contact','abandon','entity\x20not\x20found','ValidationError','closed','disposition','attachmentUpload','file','originalname','basename','filename','attachmentDownload','Unauthorized','Attachment','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ChatWebsiteId','CmContact','ContactId','Messages','UserId','agentAlias','customer','%s%d','System','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync'];(function(_0x5ad244,_0x25759c){var _0x3bc5a7=function(_0x105bda){while(--_0x105bda){_0x5ad244['push'](_0x5ad244['shift']());}};_0x3bc5a7(++_0x25759c);}(_0x05af,0x1de));var _0xf05a=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x05af[_0x2440fe];return _0x5cf734;};'use strict';var rimraf=require(_0xf05a('0x0'));var zipdir=require('zip-dir');var rp=require(_0xf05a('0x1'));var moment=require(_0xf05a('0x2'));var BPromise=require(_0xf05a('0x3'));var Mustache=require(_0xf05a('0x4'));var util=require(_0xf05a('0x5'));var path=require(_0xf05a('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xf05a('0x7'));var Redis=require('ioredis');var interaction=require(_0xf05a('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0xf05a('0x9'));var logger=require(_0xf05a('0xa'))('api');var config=require(_0xf05a('0xb'));var db=require(_0xf05a('0xc'))['db'];config[_0xf05a('0xd')]=_[_0xf05a('0xe')](config['redis'],{'host':_0xf05a('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf05a('0xd')]));require(_0xf05a('0x10'))['register'](socket);var jayson=require(_0xf05a('0x11'));var client=jayson['client'][_0xf05a('0x12')]({'port':0x232b});var client9004=jayson[_0xf05a('0x13')][_0xf05a('0x12')]({'port':0x232c});function respondWithRpcPromise(_0x9e4d96,_0x2263fc,_0x543738,_0x1ff789){return new BPromise(function(_0x4e1d26,_0x260966){var _0x5efe8e=_0x1ff789||client;return _0x5efe8e[_0xf05a('0x14')](_0x9e4d96,_0x543738)[_0xf05a('0x15')](function(_0x282e30){logger[_0xf05a('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x2263fc,_0xf05a('0x17'));logger['debug']('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x2263fc,_0xf05a('0x17'),JSON['stringify'](_0x282e30));if(_0x282e30['error']){if(_0x282e30[_0xf05a('0x18')][_0xf05a('0x19')]===0x1f4){logger[_0xf05a('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x2263fc,_0x282e30[_0xf05a('0x18')][_0xf05a('0x1a')]);return _0x260966(_0x282e30[_0xf05a('0x18')][_0xf05a('0x1a')]);}logger[_0xf05a('0x18')](_0xf05a('0x1b'),_0x2263fc,_0x282e30[_0xf05a('0x18')]['message']);return _0x4e1d26(_0x282e30[_0xf05a('0x18')]['message']);}else{logger[_0xf05a('0x16')](_0xf05a('0x1b'),_0x2263fc,'request\x20sent');_0x4e1d26(_0x282e30[_0xf05a('0x1c')][_0xf05a('0x1a')]);}})[_0xf05a('0x1d')](function(_0xca8bfe){logger['error'](_0xf05a('0x1b'),_0x2263fc,_0xca8bfe);_0x260966(_0xca8bfe);});});}function respondWithStatusCode(_0x356f05,_0x4b67c0){_0x4b67c0=_0x4b67c0||0xcc;return function(_0x9c2aa3){if(_0x9c2aa3){return _0x356f05[_0xf05a('0x1e')](_0x4b67c0);}return _0x356f05[_0xf05a('0x1f')](_0x4b67c0)[_0xf05a('0x20')]();};}function respondWithResult(_0x3a11bf,_0x3fe443){_0x3fe443=_0x3fe443||0xc8;return function(_0x20242f){if(_0x20242f){return _0x3a11bf[_0xf05a('0x1f')](_0x3fe443)['json'](_0x20242f);}};}function respondWithFilteredResult(_0x172285,_0x1a4761){return function(_0x2ac8bd){if(_0x2ac8bd){var _0x33888f=typeof _0x1a4761[_0xf05a('0x21')]===_0xf05a('0x22')&&typeof _0x1a4761[_0xf05a('0x23')]===_0xf05a('0x22');var _0x26975e=_0x2ac8bd[_0xf05a('0x24')];var _0x5a89b4=_0x33888f?0x0:_0x1a4761[_0xf05a('0x21')];var _0x13dcff=_0x33888f?_0x2ac8bd[_0xf05a('0x24')]:_0x1a4761[_0xf05a('0x21')]+_0x1a4761[_0xf05a('0x23')];var _0x459633;if(_0x13dcff>=_0x26975e){_0x13dcff=_0x26975e;_0x459633=0xc8;}else{_0x459633=0xce;}_0x172285[_0xf05a('0x1f')](_0x459633);return _0x172285['set'](_0xf05a('0x25'),_0x5a89b4+'-'+_0x13dcff+'/'+_0x26975e)[_0xf05a('0x26')](_0x2ac8bd);}return null;};}function saveUpdates(_0xd84d35){return function(_0x4c7400){if(_0x4c7400){return _0x4c7400[_0xf05a('0x27')](_0xd84d35)[_0xf05a('0x15')](function(_0xd358f4){return _0xd358f4;});}return null;};}function removeEntity(_0x3440e3){return function(_0x3d4496){if(_0x3d4496){return _0x3d4496[_0xf05a('0x28')]()['then'](function(){_0x3440e3[_0xf05a('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x464eb1){return function(_0x51ddef){if(!_0x51ddef){_0x464eb1[_0xf05a('0x1e')](0x194);}return _0x51ddef;};}function handleError(_0x6204e4,_0x33cc15){_0x33cc15=_0x33cc15||0x1f4;return function(_0x38abfa){logger[_0xf05a('0x18')](_0x38abfa[_0xf05a('0x29')]);if(_0x38abfa[_0xf05a('0x2a')]){delete _0x38abfa[_0xf05a('0x2a')];}_0x6204e4[_0xf05a('0x1f')](_0x33cc15)['send'](_0x38abfa);};}function getMustacheRender(_0x3e28b5,_0x71858a){return Mustache[_0xf05a('0x2b')](_0x3e28b5,_[_0xf05a('0x2c')](_0x71858a[_0xf05a('0x2d')],{'contact':_0x71858a['contact'],'message':_0x71858a[_0xf05a('0x1a')],'agent':_0x71858a[_0xf05a('0x2e')],'interaction':_0x71858a[_0xf05a('0x2f')],'account':_0x71858a[_0xf05a('0x30')]}))||'';}exports[_0xf05a('0x31')]=function(_0x5bb2b3,_0x5a5644){var _0xca4f70={};var _0x53ba9d=_[_0xf05a('0x32')](db[_0xf05a('0x33')][_0xf05a('0x34')],function(_0x15e048){return{'name':_0x15e048[_0xf05a('0x35')],'type':_0x15e048[_0xf05a('0x36')]['key']};});_0xca4f70=qs[_0xf05a('0x37')](_0x53ba9d,_0x5bb2b3);return interaction[_0xf05a('0x38')]('chat',_0x5bb2b3[_0xf05a('0x39')],_0x5bb2b3['user'],_0xca4f70,_0x53ba9d)[_0xf05a('0x15')](respondWithFilteredResult(_0x5a5644,_0xca4f70))['catch'](handleError(_0x5a5644,null));};exports[_0xf05a('0x3a')]=function(_0x4cf70b,_0x18e14b){var _0x39ce51={'raw':![],'where':{'id':_0x4cf70b[_0xf05a('0x3b')]['id']}},_0x46fbde={};_0x46fbde['model']=_[_0xf05a('0x3c')](db[_0xf05a('0x33')]['rawAttributes']);_0x46fbde[_0xf05a('0x39')]=_[_0xf05a('0x3c')](_0x4cf70b[_0xf05a('0x39')]);_0x46fbde[_0xf05a('0x3d')]=_[_0xf05a('0x3e')](_0x46fbde['model'],_0x46fbde[_0xf05a('0x39')]);_0x39ce51['attributes']=_[_0xf05a('0x3e')](_0x46fbde[_0xf05a('0x3f')],qs['fields'](_0x4cf70b[_0xf05a('0x39')]['fields']));_0x39ce51[_0xf05a('0x40')]=_0x39ce51[_0xf05a('0x40')][_0xf05a('0x41')]?_0x39ce51[_0xf05a('0x40')]:_0x46fbde['model'];if(_0x4cf70b['query']['includeAll']){_0x39ce51[_0xf05a('0x42')]=[{'all':!![]}];}_0x39ce51=_[_0xf05a('0x2c')]({},_0x39ce51,_0x4cf70b[_0xf05a('0x43')]);return db[_0xf05a('0x33')][_0xf05a('0x44')](_0x39ce51)[_0xf05a('0x15')](handleEntityNotFound(_0x18e14b,null))[_0xf05a('0x15')](respondWithResult(_0x18e14b,null))[_0xf05a('0x1d')](handleError(_0x18e14b,null));};exports['create']=function(_0x323de0,_0x4dc6f1){return db['ChatInteraction'][_0xf05a('0x45')](_0x323de0['body'],{})[_0xf05a('0x15')](respondWithResult(_0x4dc6f1,0xc9))[_0xf05a('0x1d')](handleError(_0x4dc6f1,null));};exports[_0xf05a('0x27')]=function(_0x3affca,_0x25ad74){if(_0x3affca[_0xf05a('0x2d')]['id']){delete _0x3affca['body']['id'];}return db[_0xf05a('0x33')]['find']({'where':{'id':_0x3affca[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](handleEntityNotFound(_0x25ad74,null))['then'](saveUpdates(_0x3affca[_0xf05a('0x2d')],null))[_0xf05a('0x15')](respondWithResult(_0x25ad74,null))[_0xf05a('0x1d')](handleError(_0x25ad74,null));};exports['destroy']=function(_0x244d21,_0x2ff9ce){return db['ChatInteraction'][_0xf05a('0x44')]({'where':{'id':_0x244d21[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](handleEntityNotFound(_0x2ff9ce,null))['then'](removeEntity(_0x2ff9ce,null))[_0xf05a('0x1d')](handleError(_0x2ff9ce,null));};exports[_0xf05a('0x46')]=function(_0x110025,_0x423972){return db['ChatInteraction'][_0xf05a('0x46')]()[_0xf05a('0x15')](respondWithResult(_0x423972,null))['catch'](handleError(_0x423972,null));};exports[_0xf05a('0x47')]=function(_0x25fa32,_0x3dfc74){var _0x4c9138=_0x25fa32[_0xf05a('0x3b')]['id'];var _0xc269c2;var _0x7bf4aa;var _0x5b812b;return db[_0xf05a('0x33')][_0xf05a('0x48')]({'where':{'id':_0x4c9138}})[_0xf05a('0x15')](function(_0xb05a29){_0xc269c2=_0xb05a29;return db[_0xf05a('0x49')][_0xf05a('0x48')]({'where':{'id':_0xb05a29['ChatWebsiteId']},'attributes':['id',_0xf05a('0x4a'),'vidaooEscalation',_0xf05a('0x4b'),'vidaooNote',_0xf05a('0x4c')],'raw':!![]});})[_0xf05a('0x15')](function(_0x9bc005){if(_0x9bc005&&_0x9bc005['vidaooApiKey']&&_0x9bc005[_0xf05a('0x4d')]){_0x7bf4aa=_0x9bc005;var _0x453db8={'interaction':{'id':_0x4c9138},'agent':{'id':_0x25fa32[_0xf05a('0x4e')]['id'],'name':_0x25fa32[_0xf05a('0x4e')][_0xf05a('0x2a')],'fullname':_0x25fa32[_0xf05a('0x4e')][_0xf05a('0x4f')],'email':_0x25fa32[_0xf05a('0x4e')][_0xf05a('0x50')]},'contact':_0x25fa32[_0xf05a('0x2d')]['contact'],'account':_0x25fa32[_0xf05a('0x2d')][_0xf05a('0x30')]};var _0x1b4de6={'rejectUnauthorized':![],'method':_0xf05a('0x51'),'url':_0xf05a('0x52'),'headers':{'X-APIKEY':_0x9bc005[_0xf05a('0x4a')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x25fa32[_0xf05a('0x4e')][_0xf05a('0x50')]],'buttons':null,'topic':_0x7bf4aa[_0xf05a('0x4b')],'note':_[_0xf05a('0x53')](_0x7bf4aa[_0xf05a('0x54')])?null:getMustacheRender(_0x7bf4aa[_0xf05a('0x54')],_0x453db8),'metadata':null},'redirect':_0xf05a('0x55'),'json':!![]};try{if(!_['isNull'](_0x7bf4aa[_0xf05a('0x4c')])){var _0x2b2ecc=getMustacheRender(_0x7bf4aa[_0xf05a('0x4c')],_0x453db8);var _0xaa097e=JSON['parse'](_0x2b2ecc);_0x1b4de6[_0xf05a('0x2d')][_0xf05a('0x56')]=_0xaa097e;}}catch(_0x1d0b6f){throw new db[(_0xf05a('0x57'))]['ValidationError'](_0xf05a('0x58'));}return rp(_0x1b4de6);}else{throw new db[(_0xf05a('0x57'))]['ValidationError'](_0xf05a('0x59'));}})[_0xf05a('0x15')](function(_0xdeb65c){_0x5b812b=_0xdeb65c;if(_0x5b812b['id']){var _0x363efc={'body':_0x5b812b[_0xf05a('0x5a')],'ChatWebsiteId':_0x7bf4aa['id'],'ChatInteractionId':_0xc269c2['id'],'direction':'out','UserId':_0x25fa32['user']['id']};return db[_0xf05a('0x5b')][_0xf05a('0x45')](_0x363efc,{});}else{throw new db['Sequelize']['ValidationError'](_0xf05a('0x5c'));}})[_0xf05a('0x15')](function(){return _0xc269c2['updateAttributes']({'vidaooSessionId':_0x5b812b['id']});})[_0xf05a('0x15')](respondWithResult(_0x3dfc74,null))[_0xf05a('0x1d')](handleError(_0x3dfc74,null));};exports[_0xf05a('0x5d')]=function(_0x3f2e3e,_0x251816){if(_0x3f2e3e['body']['id']){delete _0x3f2e3e[_0xf05a('0x2d')]['id'];}return db[_0xf05a('0x33')][_0xf05a('0x44')]({'where':{'id':_0x3f2e3e[_0xf05a('0x3b')]['id']},'include':[{'model':db['CmContact'],'as':_0xf05a('0x5e')}]})[_0xf05a('0x15')](handleEntityNotFound(_0x251816,null))[_0xf05a('0x15')](saveUpdates(_0x3f2e3e[_0xf05a('0x2d')],null))[_0xf05a('0x15')](respondWithResult(_0x251816,null))[_0xf05a('0x1d')](handleError(_0x251816,null));};exports[_0xf05a('0x5f')]=function(_0x50e262,_0x349c8e){if(_0x50e262[_0xf05a('0x2d')]['id']){delete _0x50e262[_0xf05a('0x2d')]['id'];}return db[_0xf05a('0x33')]['find']({'where':{'id':_0x50e262[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](function(_0x5464e7){if(!_0x5464e7){logger[_0xf05a('0x18')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xf05a('0x5f'),0x194,_0xf05a('0x60'));_0x349c8e[_0xf05a('0x1e')](0x194);}else{if(_0x5464e7['UserId']){throw new db[(_0xf05a('0x57'))][(_0xf05a('0x61'))]('Interaction\x20already\x20assigned');}}return _0x5464e7;})['then'](function(_0x43a9ae){if(_0x43a9ae){return _0x43a9ae[_0xf05a('0x27')]({'closed':_0x50e262[_0xf05a('0x2d')][_0xf05a('0x62')],'disposition':_0x50e262[_0xf05a('0x2d')][_0xf05a('0x63')]})[_0xf05a('0x15')](function(_0x1279dc){return _0x1279dc;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0xf05a('0x5f'),_0x50e262[_0xf05a('0x2d')],client9004);})[_0xf05a('0x15')](respondWithResult(_0x349c8e,null))[_0xf05a('0x1d')](handleError(_0x349c8e,null));};exports[_0xf05a('0x64')]=function(_0x1c7d2e,_0x22d976){_0x1c7d2e[_0xf05a('0x2d')][_0xf05a('0x2a')]=_0x1c7d2e[_0xf05a('0x65')][_0xf05a('0x66')];_0x1c7d2e[_0xf05a('0x2d')][_0xf05a('0x67')]=_0x1c7d2e[_0xf05a('0x65')][_0xf05a('0x68')];_0x1c7d2e[_0xf05a('0x2d')][_0xf05a('0x36')]=_0x1c7d2e[_0xf05a('0x65')]['mimetype'];return db['Attachment'][_0xf05a('0x45')](_0x1c7d2e[_0xf05a('0x2d')])[_0xf05a('0x15')](respondWithResult(_0x22d976,0xc9))[_0xf05a('0x1d')](handleError(_0x22d976,null));};exports[_0xf05a('0x69')]=function(_0x5b77e7,_0xb64110){return db[_0xf05a('0x33')][_0xf05a('0x48')]({'where':{'id':_0x5b77e7['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0xb64110,null))[_0xf05a('0x15')](function(_0x15bc55){if(_0x15bc55){if(_0x15bc55[_0xf05a('0x62')]){return _0xb64110[_0xf05a('0x1f')](0x193)['json']({'status':0x193,'message':_0xf05a('0x6a')});}return db[_0xf05a('0x6b')][_0xf05a('0x48')]({'where':{'id':_0x5b77e7['query'][_0xf05a('0x6c')]},'raw':!![]})[_0xf05a('0x15')](handleEntityNotFound(_0xb64110,null));}})[_0xf05a('0x15')](function(_0x24eb13){if(_0x24eb13){var _0x3eab95=_0x24eb13[_0xf05a('0x6d')]!==null;var _0x3d6de8=path[_0xf05a('0x6e')](config[_0xf05a('0x6f')],_0xf05a('0x70'));if(_0x3eab95){_0x3d6de8=path['join'](_0x3d6de8,_0xf05a('0x71'));}var _0x2701ff=path[_0xf05a('0x6e')](_0x3d6de8,_0x24eb13[_0xf05a('0x67')]);return _0xb64110[_0xf05a('0x72')](_0x2701ff);}})[_0xf05a('0x1d')](handleError(_0xb64110,null));};exports[_0xf05a('0x73')]=function(_0x284d5a,_0x489f2c){var _0xc61f08=null;var _0x58bacd=null;var _0x310884=null;if(_0x284d5a['body']['id']){delete _0x284d5a['body']['id'];}if(_0x284d5a[_0xf05a('0x2d')]['mailTranscript']){_0x310884=path[_0xf05a('0x6e')](config['root'],_0xf05a('0x74'),util[_0xf05a('0x75')](_0xf05a('0x76'),Date[_0xf05a('0x77')]()));_0x284d5a[_0xf05a('0x2d')][_0xf05a('0x78')]=_0x310884;}return db[_0xf05a('0x33')][_0xf05a('0x44')]({'where':{'id':_0x284d5a['params']['id']},'include':[{'model':db[_0xf05a('0x5b')],'as':'Messages','include':[{'model':db[_0xf05a('0x79')],'as':_0xf05a('0x79')}]}]})[_0xf05a('0x15')](handleEntityNotFound(_0x489f2c,null))['then'](saveUpdates(_0x284d5a['body'],null))[_0xf05a('0x15')](function(_0x4e671d){if(_0x4e671d){_0xc61f08=_0x4e671d;return db['ChatWebsite'][_0xf05a('0x44')]({'where':{'id':_0xc61f08[_0xf05a('0x7a')]}});}})[_0xf05a('0x15')](function(_0x3fc209){if(_0x3fc209){_0x58bacd=_0x3fc209;return db[_0xf05a('0x7b')]['find']({'where':{'id':_0xc61f08[_0xf05a('0x7c')]}});}})[_0xf05a('0x15')](function(_0x24fe28){if(_0x24fe28){if(_0x310884){var _0x73aef2=null;for(var _0x49da7d=0x1;_0x49da7d<_0xc61f08[_0xf05a('0x7d')][_0xf05a('0x41')];++_0x49da7d){_0x73aef2=_0xc61f08[_0xf05a('0x7d')][_0x49da7d];var _0x266a87=_0x73aef2[_0xf05a('0x7e')]?util['format']('%s%d',_0x58bacd[_0xf05a('0x7f')],_0x73aef2[_0xf05a('0x7e')]):'System';var _0x49a2e8=_0x284d5a['body'][_0xf05a('0x80')]||util['format'](_0xf05a('0x81'),'Visitor',_0x73aef2[_0xf05a('0x7c')]);switch(_0x58bacd['agentIdentifier']){case'website_alias':_0x266a87=_0x73aef2[_0xf05a('0x7e')]?util[_0xf05a('0x75')](_0xf05a('0x81'),_0x58bacd[_0xf05a('0x7f')],_0x73aef2['UserId']):_0xf05a('0x82');break;case _0xf05a('0x83'):_0x266a87=_0x73aef2['UserId']?_0x73aef2[_0xf05a('0x79')][_0xf05a('0x84')]||_0x73aef2[_0xf05a('0x79')][_0xf05a('0x4f')]:'System';break;case _0xf05a('0x85'):_0x266a87=_0x73aef2[_0xf05a('0x7e')]?_0x73aef2[_0xf05a('0x79')][_0xf05a('0x4f')]:_0xf05a('0x82');break;default:_0x266a87=_0x73aef2['UserId']?util[_0xf05a('0x75')](_0xf05a('0x81'),_0x58bacd[_0xf05a('0x7f')],_0x73aef2[_0xf05a('0x7e')]):_0xf05a('0x82');}var _0x48e0be=util[_0xf05a('0x75')](_0xf05a('0x86'),moment(_0x73aef2[_0xf05a('0x87')])[_0xf05a('0x75')](_0xf05a('0x88')),_0x73aef2[_0xf05a('0x89')]==='in'?_0x49a2e8:_0x266a87,_0x73aef2[_0xf05a('0x2d')]);if(!_0x73aef2[_0xf05a('0x8a')]){fs[_0xf05a('0x8b')](_0x310884,_0x48e0be);}}return db[_0xf05a('0x8c')][_0xf05a('0x48')]({'where':{'service':!![]},'include':[{'model':db[_0xf05a('0x8d')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf05a('0x8e')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0xf05a('0x15')](function(_0x272084){if(!_0x272084||!_0x272084[_0xf05a('0x8f')]||!_0x284d5a['body'])return _0xc61f08;var _0x443110=_0x272084[_0xf05a('0x90')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x443110,'message':{'from':util[_0xf05a('0x75')](_0xf05a('0x91'),_0x272084['name'],_0x272084[_0xf05a('0x50')]||_0x272084['Smtp'][_0xf05a('0x4e')]),'to':_0x284d5a['body'][_0xf05a('0x92')],'subject':'Mail\x20Transcript','text':util[_0xf05a('0x75')]('Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a',_0x284d5a[_0xf05a('0x2d')][_0xf05a('0x92')]),'attachments':[{'path':_0x310884}]}})[_0xf05a('0x15')](function(){return _0xc61f08;})[_0xf05a('0x1d')](function(_0x44cc07){logger[_0xf05a('0x18')](_0x44cc07);});})[_0xf05a('0x15')](respondWithStatusCode(_0x489f2c,0xc8))[_0xf05a('0x1d')](handleError(_0x489f2c,null));};exports[_0xf05a('0x93')]=function(_0x1a55f0,_0x389cc3){return db[_0xf05a('0x5b')][_0xf05a('0x44')]({'where':{'id':_0x1a55f0[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](handleEntityNotFound(_0x389cc3,null))[_0xf05a('0x15')](function(_0x4bfb1d){if(_0x4bfb1d){return _0x4bfb1d[_0xf05a('0x93')](_0x1a55f0['body'][_0xf05a('0x94')],_[_0xf05a('0x95')](_0x1a55f0['body'],[_0xf05a('0x94'),'id'])||{});}})['then'](respondWithResult(_0x389cc3,null))['catch'](handleError(_0x389cc3,null));};exports[_0xf05a('0x96')]=function(_0xbdd398,_0x3337d3){var _0x27c723={'raw':![],'where':{}};var _0x3aa830={};var _0x2bfa97={'count':0x0,'rows':[]};return db[_0xf05a('0x33')][_0xf05a('0x48')]({'where':{'id':_0xbdd398[_0xf05a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x3337d3,null))[_0xf05a('0x15')](function(_0x3892dc){if(_0x3892dc){_0x3aa830[_0xf05a('0x3f')]=_['keys'](db[_0xf05a('0x5b')][_0xf05a('0x34')]);_0x3aa830[_0xf05a('0x39')]=_[_0xf05a('0x3c')](_0xbdd398[_0xf05a('0x39')]);_0x3aa830['filters']=_['intersection'](_0x3aa830[_0xf05a('0x3f')],_0x3aa830[_0xf05a('0x39')]);_0x27c723[_0xf05a('0x40')]=_[_0xf05a('0x3e')](_0x3aa830['model'],qs[_0xf05a('0x97')](_0xbdd398['query'][_0xf05a('0x97')]));_0x27c723[_0xf05a('0x40')]=_0x27c723['attributes']['length']?_0x27c723[_0xf05a('0x40')]:_0x3aa830[_0xf05a('0x3f')];if(!_0xbdd398[_0xf05a('0x39')][_0xf05a('0x98')](_0xf05a('0x99'))){_0x27c723['limit']=qs[_0xf05a('0x23')](_0xbdd398[_0xf05a('0x39')][_0xf05a('0x23')]);_0x27c723[_0xf05a('0x21')]=qs['offset'](_0xbdd398['query'][_0xf05a('0x21')]);}_0x27c723[_0xf05a('0x9a')]=qs[_0xf05a('0x9b')](_0xbdd398['query']['sort']);_0x27c723[_0xf05a('0x9c')]=qs['filters'](_[_0xf05a('0x9d')](_0xbdd398[_0xf05a('0x39')],_0x3aa830[_0xf05a('0x3d')]));_0x27c723['where']['ChatInteractionId']=_0x3892dc['id'];if(_0xbdd398[_0xf05a('0x39')][_0xf05a('0x9e')]){_0x27c723[_0xf05a('0x9c')]=_[_0xf05a('0x2c')](_0x27c723[_0xf05a('0x9c')],{'$or':_[_0xf05a('0x32')](_0x27c723[_0xf05a('0x40')],function(_0x3996dd){var _0x441738={};_0x441738[_0x3996dd]={'$like':'%'+_0xbdd398[_0xf05a('0x39')]['filter']+'%'};return _0x441738;})});}if(_0xbdd398[_0xf05a('0x39')][_0xf05a('0x9f')]){var _0xe5224d=_0xbdd398[_0xf05a('0x39')][_0xf05a('0x9f')]['split'](',');var _0x51b6a5={};_0x51b6a5[_0xe5224d[0x0]]={'$gte':moment(_0xe5224d[0x1])[_0xf05a('0x75')](_0xf05a('0xa0'))};_0x27c723[_0xf05a('0x9c')]=_[_0xf05a('0x2c')](_0x27c723[_0xf05a('0x9c')],_0x51b6a5);}_0x27c723=_['merge']({},_0x27c723,_0xbdd398[_0xf05a('0x43')]);return db[_0xf05a('0x5b')][_0xf05a('0x24')]({'where':_0x27c723[_0xf05a('0x9c')]})[_0xf05a('0x15')](function(_0x5d451f){_0x2bfa97['count']=_0x5d451f;if(_0xbdd398[_0xf05a('0x39')][_0xf05a('0xa1')]){_0x27c723[_0xf05a('0x42')]=[{'all':!![]}];}return db[_0xf05a('0x5b')]['findAll'](_0x27c723);})[_0xf05a('0x15')](function(_0x1c2116){_0x2bfa97[_0xf05a('0xa2')]=_0x1c2116;return _0x2bfa97;});}})[_0xf05a('0x15')](respondWithFilteredResult(_0x3337d3,_0x27c723))[_0xf05a('0x1d')](handleError(_0x3337d3,null));};exports[_0xf05a('0xa3')]=function(_0x191ab2,_0x309ff8){var _0x2aef90={'where':{}},_0x4e6bf0={},_0x1fd288={'count':0x0,'rows':[]};return db[_0xf05a('0x33')][_0xf05a('0x48')]({'where':{'id':_0x191ab2[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](handleEntityNotFound(_0x309ff8,null))[_0xf05a('0x15')](function(_0x1f4ab7){if(_0x1f4ab7){_0x4e6bf0['model']=_[_0xf05a('0x3c')](db[_0xf05a('0x5b')][_0xf05a('0x34')]);_0x4e6bf0['query']=_[_0xf05a('0x3c')](_0x191ab2[_0xf05a('0x39')]);_0x4e6bf0[_0xf05a('0x3d')]=_[_0xf05a('0x3e')](_0x4e6bf0['model'],_0x4e6bf0[_0xf05a('0x39')]);_0x2aef90['attributes']=_[_0xf05a('0x3e')](_0x4e6bf0[_0xf05a('0x3f')],qs[_0xf05a('0x97')](_0x191ab2[_0xf05a('0x39')][_0xf05a('0x97')]));_0x2aef90[_0xf05a('0x40')]=_0x2aef90['attributes'][_0xf05a('0x41')]?_0x2aef90[_0xf05a('0x40')]:_0x4e6bf0[_0xf05a('0x3f')];if(!_0x191ab2[_0xf05a('0x39')]['hasOwnProperty']('nolimit')){_0x2aef90['limit']=qs[_0xf05a('0x23')](_0x191ab2[_0xf05a('0x39')]['limit']);_0x2aef90[_0xf05a('0x21')]=qs[_0xf05a('0x21')](_0x191ab2['query']['offset']);}_0x2aef90['order']=qs['sort'](_0x191ab2[_0xf05a('0x39')][_0xf05a('0x9b')]);_0x2aef90[_0xf05a('0x9c')]=qs[_0xf05a('0x3d')](_[_0xf05a('0x9d')](_0x191ab2[_0xf05a('0x39')],_0x4e6bf0[_0xf05a('0x3d')]));_0x2aef90[_0xf05a('0x9c')][_0xf05a('0xa4')]=_0x1f4ab7['id'];if(_0x191ab2[_0xf05a('0x39')][_0xf05a('0x9e')]){_0x2aef90[_0xf05a('0x9c')]=_['merge'](_0x2aef90['where'],{'$or':_[_0xf05a('0x32')](_0x2aef90[_0xf05a('0x40')],function(_0x5ce0ed){var _0x166811={};_0x166811[_0x5ce0ed]={'$like':'%'+_0x191ab2[_0xf05a('0x39')][_0xf05a('0x9e')]+'%'};return _0x166811;})});}_0x2aef90['where']['secret']=![];if(_0x191ab2[_0xf05a('0x39')]['id']){_0x2aef90[_0xf05a('0x9c')]['id']={'$gt':_0x191ab2[_0xf05a('0x39')]['id']};}_0x2aef90=_[_0xf05a('0x2c')]({},_0x2aef90,_0x191ab2['options']);return db['ChatMessage'][_0xf05a('0x24')]({'where':_0x2aef90[_0xf05a('0x9c')]})['then'](function(_0x5b36cf){_0x1fd288[_0xf05a('0x24')]=_0x5b36cf;_0x2aef90['include']=[];if(_0x191ab2[_0xf05a('0x39')][_0xf05a('0xa5')]){_0x2aef90['include'][_0xf05a('0xa6')]({'model':db[_0xf05a('0x79')],'as':_0xf05a('0x79'),'attributes':['id','fullname','alias']});}if(_0x191ab2[_0xf05a('0x39')][_0xf05a('0xa1')]){_0x2aef90[_0xf05a('0x42')]=[{'all':!![]}];}return db[_0xf05a('0x5b')][_0xf05a('0x38')](_0x2aef90);})[_0xf05a('0x15')](function(_0x3813fb){_0x1fd288[_0xf05a('0xa2')]=_0x3813fb;return _0x1fd288;});}})[_0xf05a('0x15')](respondWithFilteredResult(_0x309ff8,_0x2aef90))[_0xf05a('0x1d')](handleError(_0x309ff8,null));};exports['addTags']=function(_0x578396,_0x3d2c15){return db[_0xf05a('0x33')]['find']({'where':{'id':_0x578396[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](handleEntityNotFound(_0x3d2c15,null))['then'](function(_0x32a521){if(_0x32a521){return _0x32a521[_0xf05a('0xa7')](_0x578396['body'][_0xf05a('0x94')],_[_0xf05a('0x95')](_0x578396[_0xf05a('0x2d')],[_0xf05a('0x94'),'id'])||{})[_0xf05a('0xa8')](function(){return db['Tag'][_0xf05a('0x38')]({'attributes':['id',_0xf05a('0x2a'),'color'],'where':{'id':_0x578396[_0xf05a('0x2d')][_0xf05a('0x94')]}});})[_0xf05a('0x15')](function(_0x15a9aa){socket['emit'](_0xf05a('0xa9'),{'id':Number(_0x578396['params']['id']),'tags':_0x15a9aa||[]});return{'id':Number(_0x578396[_0xf05a('0x3b')]['id']),'tags':_0x15a9aa||[]};});}})[_0xf05a('0x15')](respondWithResult(_0x3d2c15,null))[_0xf05a('0x1d')](handleError(_0x3d2c15,null));};exports['removeTags']=function(_0x53dbc1,_0xc343cc){return db['ChatInteraction'][_0xf05a('0x44')]({'where':{'id':_0x53dbc1[_0xf05a('0x3b')]['id']}})[_0xf05a('0x15')](handleEntityNotFound(_0xc343cc,null))[_0xf05a('0x15')](function(_0x3b4b91){if(_0x3b4b91){return _0x3b4b91[_0xf05a('0xaa')](_0x53dbc1[_0xf05a('0x39')][_0xf05a('0x94')]);}})[_0xf05a('0x15')](respondWithStatusCode(_0xc343cc,null))[_0xf05a('0x1d')](handleError(_0xc343cc,null));};exports['download']=function(_0x43c6e0,_0x289691){var _0x45c193=moment()[_0xf05a('0xab')]()[_0xf05a('0xac')]();var _0x471437=path[_0xf05a('0x6e')](config['root'],_0xf05a('0xad'),_0xf05a('0xae'),'tmp');var _0x3b6ed8=path[_0xf05a('0x6e')](config[_0xf05a('0x6f')],'server',_0xf05a('0xae'),'attachments');var _0x3617c6=path[_0xf05a('0x6e')](_0x471437,_0x45c193);var _0x53446d=util[_0xf05a('0x75')](_0xf05a('0xaf'),_0x43c6e0[_0xf05a('0x3b')]['id'],_0x45c193);var _0x109f00=path['join'](_0x471437,_0x53446d);var _0x32e60e=[];_0x32e60e[_0xf05a('0xa6')]({'model':db['User'],'as':_0xf05a('0x79'),'attributes':['id',_0xf05a('0x4f')],'raw':!![]});_0x32e60e[_0xf05a('0xa6')]({'model':db[_0xf05a('0x7b')],'as':_0xf05a('0x5e'),'attributes':['id',_0xf05a('0xb0'),'lastName'],'raw':!![]});if(_0x43c6e0[_0xf05a('0x39')][_0xf05a('0xb1')]){_0x32e60e[_0xf05a('0xa6')]({'model':db[_0xf05a('0x6b')],'as':_0xf05a('0x6b'),'raw':!![]});}var _0x20aeb8=[{'model':db[_0xf05a('0x5b')],'as':_0xf05a('0x7d'),'attributes':['id','body','createdAt',_0xf05a('0x89'),_0xf05a('0x8a'),_0xf05a('0xb2')],'include':_0x32e60e}];_0x20aeb8[_0xf05a('0xa6')]({'model':db['ChatWebsite'],'as':_0xf05a('0xb3'),'attributes':['id',_0xf05a('0x2a')]});_0x20aeb8[_0xf05a('0xa6')]({'model':db['User'],'as':_0xf05a('0xb4'),'attributes':['id',_0xf05a('0x4f')]});return db[_0xf05a('0x33')]['find']({'where':{'id':_0x43c6e0[_0xf05a('0x3b')]['id']},'include':_0x20aeb8})[_0xf05a('0x15')](handleEntityNotFound(_0x289691,null))[_0xf05a('0x15')](function(_0x3af7cd){if(_0x3af7cd){var _0xb6b969=_0x3af7cd[_0xf05a('0xb5')]({'plain':!![]});fs[_0xf05a('0xb6')](_0x3617c6);var _0xe70e48={'channel':_0xf05a('0xb7'),'account':_0xb6b969['Account'][_0xf05a('0x2a')],'agent':_0xb6b969['Owner']?_0xb6b969['Owner'][_0xf05a('0x4f')]:'N.A.','createdAt':moment(_0xb6b969['createdAt'])[_0xf05a('0x75')](_0xf05a('0xa0'))['toString'](),'closedAt':_0xb6b969['closed']?moment(_0xb6b969[_0xf05a('0xb8')])[_0xf05a('0x75')](_0xf05a('0xa0'))[_0xf05a('0xac')]():'','disposition':_0xb6b969[_0xf05a('0x63')],'chatInfo':{'browser':_0xb6b969[_0xf05a('0xb9')],'os':_0xb6b969[_0xf05a('0xba')],'referer':_0xb6b969[_0xf05a('0xbb')],'customerIp':_0xb6b969['customerIp'],'customerPort':_0xb6b969[_0xf05a('0xbc')]?_0xb6b969[_0xf05a('0xbc')]:_0xf05a('0xbd')},'messages':_(_0xb6b969[_0xf05a('0x7d')])[_0xf05a('0xbe')]()[_0xf05a('0x9e')]({'secret':![]})['map'](function(_0x428175){if(_0x428175[_0xf05a('0x6b')]){var _0x300e84=path[_0xf05a('0x6e')](_0x3b6ed8,_0x428175[_0xf05a('0x6b')][_0xf05a('0x67')]);if(fs[_0xf05a('0xbf')](_0x300e84)){fs[_0xf05a('0xc0')](_0x300e84)[_0xf05a('0xc1')](fs[_0xf05a('0xc2')](path[_0xf05a('0x6e')](_0x3617c6,_0x428175[_0xf05a('0x6b')][_0xf05a('0x67')])));}}return{'date':moment(_0x428175[_0xf05a('0x87')])['format'](_0xf05a('0xa0'))[_0xf05a('0xac')](),'sender':_0x428175['direction']===_0xf05a('0xc3')?_0x428175[_0xf05a('0x79')]?_0x428175[_0xf05a('0x79')][_0xf05a('0x4f')]:_0xf05a('0x82'):_0x428175[_0xf05a('0x5e')][_0xf05a('0xb0')]+(_0x428175[_0xf05a('0x5e')][_0xf05a('0xc4')]?'\x20'+_0x428175[_0xf05a('0x5e')][_0xf05a('0xc4')]:''),'body':_0x428175[_0xf05a('0x6b')]?_0x428175['Attachment'][_0xf05a('0x67')]:_0x428175[_0xf05a('0x2d')],'direction':_0x428175[_0xf05a('0x89')]===_0xf05a('0xc3')?'A':'C','secret':_0x428175[_0xf05a('0x8a')],'read':_0x428175[_0xf05a('0xb2')],'attachment':_0x428175[_0xf05a('0x6b')]};})[_0xf05a('0xc5')]()};return ejs[_0xf05a('0xc6')](path['join'](config[_0xf05a('0x6f')],_0xf05a('0xad'),_0xf05a('0xc7'),_0xf05a('0xc8')),{'interaction':_0xe70e48})['then'](function(_0x413ea4){var _0x1eb67a=path[_0xf05a('0x6e')](_0x3617c6,_0xf05a('0xc9')+_0xb6b969['id']+'-'+_0x45c193+_0xf05a('0xca'));var _0x2b44e7={'path':_0x1eb67a,'channel':_0xf05a('0xb7'),'interactionId':_0xb6b969['id']};return pdf[_0xf05a('0xcb')](_0x413ea4,_0x2b44e7);})[_0xf05a('0x15')](function(){return new Promise(function(_0x59efef,_0x1fdf82){zipdir(_0x3617c6,{'saveTo':_0x109f00},function(_0x2de905,_0x27c648){if(_0x2de905)return _0x1fdf82(_0x2de905);return _0x59efef(_0x27c648);});})[_0xf05a('0x15')](function(){return new BPromise(function(_0x448774,_0x34bf9a){rimraf(_0x3617c6,function(_0x497f5f){if(_0x497f5f)_0x34bf9a(_0x497f5f);return _0x448774();});});})[_0xf05a('0x15')](function(){return _0x289691[_0xf05a('0x72')](_0x109f00,_0x53446d,function(_0x1868cb){if(_0x1868cb){logger['error'](_0xf05a('0xcc'),_0x1868cb);}else{fs[_0xf05a('0xcd')](_0x109f00);}});});});}else{return _0x289691[_0xf05a('0x1e')](0xc8);}})[_0xf05a('0x1d')](handleError(_0x289691,null));}; \ No newline at end of file +var _0x6bef=['omit','getMessages','hasOwnProperty','nolimit','sort','where','pick','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','getMyMessages','ChatInteractionId','includeAgent','addTags','setTags','color','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','push','Contact','Owner','get','mkdirSync','Chat','N.A.','closedAt','disposition','browserName','osName','referer','customerPort','tail','createReadStream','createWriteStream','lastName','value','views','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','update','destroy','end','stack','name','send','render','contact','interaction','account','index','map','rawAttributes','type','key','getOptions','chat','query','user','params','model','keys','filters','attributes','intersection','fields','includeAll','include','ChatInteraction','find','create','body','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','POST','email','isNull','vidaooNote','follow','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','originalname','basename','filename','file','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','User','ContactId','Messages','length','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','Smtp','CloudProvider','getSmtpOptions','SendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','ids'];(function(_0x345282,_0x350ac9){var _0x1251fc=function(_0x42a73a){while(--_0x42a73a){_0x345282['push'](_0x345282['shift']());}};_0x1251fc(++_0x350ac9);}(_0x6bef,0x103));var _0xf6be=function(_0x25a86b,_0x4dd198){_0x25a86b=_0x25a86b-0x0;var _0x29bd54=_0x6bef[_0x25a86b];return _0x29bd54;};'use strict';var rimraf=require(_0xf6be('0x0'));var zipdir=require(_0xf6be('0x1'));var rp=require(_0xf6be('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf6be('0x3'));var util=require(_0xf6be('0x4'));var path=require(_0xf6be('0x5'));var ejs=require(_0xf6be('0x6'));var fs=require('fs');var _=require(_0xf6be('0x7'));var Redis=require(_0xf6be('0x8'));var interaction=require(_0xf6be('0x9'));var qs=require(_0xf6be('0xa'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xf6be('0xb'));var config=require('../../config/environment');var db=require(_0xf6be('0xc'))['db'];config[_0xf6be('0xd')]=_['defaults'](config['redis'],{'host':_0xf6be('0xe'),'port':0x18eb});var socket=require(_0xf6be('0xf'))(new Redis(config[_0xf6be('0xd')]));require(_0xf6be('0x10'))[_0xf6be('0x11')](socket);var jayson=require(_0xf6be('0x12'));var client=jayson[_0xf6be('0x13')][_0xf6be('0x14')]({'port':0x232b});var client9004=jayson['client'][_0xf6be('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x13b368,_0x56174a,_0x32252c,_0x5446e4){return new BPromise(function(_0xe48a18,_0x25d9a3){var _0x393188=_0x5446e4||client;return _0x393188[_0xf6be('0x15')](_0x13b368,_0x32252c)[_0xf6be('0x16')](function(_0xaea77){logger[_0xf6be('0x17')](_0xf6be('0x18'),_0x56174a,'request\x20sent');logger[_0xf6be('0x19')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x56174a,_0xf6be('0x1a'),JSON[_0xf6be('0x1b')](_0xaea77));if(_0xaea77['error']){if(_0xaea77[_0xf6be('0x1c')]['code']===0x1f4){logger[_0xf6be('0x1c')](_0xf6be('0x18'),_0x56174a,_0xaea77[_0xf6be('0x1c')]['message']);return _0x25d9a3(_0xaea77[_0xf6be('0x1c')][_0xf6be('0x1d')]);}logger[_0xf6be('0x1c')](_0xf6be('0x18'),_0x56174a,_0xaea77[_0xf6be('0x1c')]['message']);return _0xe48a18(_0xaea77[_0xf6be('0x1c')]['message']);}else{logger[_0xf6be('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x56174a,_0xf6be('0x1a'));_0xe48a18(_0xaea77[_0xf6be('0x1e')][_0xf6be('0x1d')]);}})[_0xf6be('0x1f')](function(_0x5f573e){logger[_0xf6be('0x1c')]('ChatInteraction,\x20%s,\x20%s',_0x56174a,_0x5f573e);_0x25d9a3(_0x5f573e);});});}function respondWithStatusCode(_0x20be4d,_0x2a92d7){_0x2a92d7=_0x2a92d7||0xcc;return function(_0x1bc295){if(_0x1bc295){return _0x20be4d[_0xf6be('0x20')](_0x2a92d7);}return _0x20be4d[_0xf6be('0x21')](_0x2a92d7)['end']();};}function respondWithResult(_0x375683,_0x2a8e1d){_0x2a8e1d=_0x2a8e1d||0xc8;return function(_0xa44ef1){if(_0xa44ef1){return _0x375683[_0xf6be('0x21')](_0x2a8e1d)[_0xf6be('0x22')](_0xa44ef1);}};}function respondWithFilteredResult(_0x15aeae,_0x1eb702){return function(_0x5f020e){if(_0x5f020e){var _0x308af3=typeof _0x1eb702[_0xf6be('0x23')]===_0xf6be('0x24')&&typeof _0x1eb702[_0xf6be('0x25')]===_0xf6be('0x24');var _0x16828a=_0x5f020e[_0xf6be('0x26')];var _0xff084e=_0x308af3?0x0:_0x1eb702[_0xf6be('0x23')];var _0x5113af=_0x308af3?_0x5f020e[_0xf6be('0x26')]:_0x1eb702[_0xf6be('0x23')]+_0x1eb702[_0xf6be('0x25')];var _0x289ace;if(_0x5113af>=_0x16828a){_0x5113af=_0x16828a;_0x289ace=0xc8;}else{_0x289ace=0xce;}_0x15aeae['status'](_0x289ace);return _0x15aeae['set']('Content-Range',_0xff084e+'-'+_0x5113af+'/'+_0x16828a)['json'](_0x5f020e);}return null;};}function saveUpdates(_0x3aff46){return function(_0x3ca171){if(_0x3ca171){return _0x3ca171[_0xf6be('0x27')](_0x3aff46)[_0xf6be('0x16')](function(_0x344a12){return _0x344a12;});}return null;};}function removeEntity(_0xae506e){return function(_0x69e8c7){if(_0x69e8c7){return _0x69e8c7[_0xf6be('0x28')]()[_0xf6be('0x16')](function(){_0xae506e[_0xf6be('0x21')](0xcc)[_0xf6be('0x29')]();});}};}function handleEntityNotFound(_0x182622){return function(_0x359d28){if(!_0x359d28){_0x182622[_0xf6be('0x20')](0x194);}return _0x359d28;};}function handleError(_0x1a1e4d,_0x400d74){_0x400d74=_0x400d74||0x1f4;return function(_0x571d37){logger[_0xf6be('0x1c')](_0x571d37[_0xf6be('0x2a')]);if(_0x571d37[_0xf6be('0x2b')]){delete _0x571d37[_0xf6be('0x2b')];}_0x1a1e4d[_0xf6be('0x21')](_0x400d74)[_0xf6be('0x2c')](_0x571d37);};}function getMustacheRender(_0x2366b4,_0xcc3117){return Mustache[_0xf6be('0x2d')](_0x2366b4,_['merge'](_0xcc3117['body'],{'contact':_0xcc3117[_0xf6be('0x2e')],'message':_0xcc3117['message'],'agent':_0xcc3117['agent'],'interaction':_0xcc3117[_0xf6be('0x2f')],'account':_0xcc3117[_0xf6be('0x30')]}))||'';}exports[_0xf6be('0x31')]=function(_0x15f4cd,_0x293416){var _0x156df1={};var _0x8213e4=_[_0xf6be('0x32')](db['ChatInteraction'][_0xf6be('0x33')],function(_0x166da7){return{'name':_0x166da7['fieldName'],'type':_0x166da7[_0xf6be('0x34')][_0xf6be('0x35')]};});_0x156df1=qs[_0xf6be('0x36')](_0x8213e4,_0x15f4cd);return interaction['findAll'](_0xf6be('0x37'),_0x15f4cd[_0xf6be('0x38')],_0x15f4cd[_0xf6be('0x39')],_0x156df1,_0x8213e4)[_0xf6be('0x16')](respondWithFilteredResult(_0x293416,_0x156df1))[_0xf6be('0x1f')](handleError(_0x293416,null));};exports['show']=function(_0x38397e,_0x5791e5){var _0x316424={'raw':![],'where':{'id':_0x38397e[_0xf6be('0x3a')]['id']}},_0x2d3c9a={};_0x2d3c9a[_0xf6be('0x3b')]=_[_0xf6be('0x3c')](db['ChatInteraction'][_0xf6be('0x33')]);_0x2d3c9a[_0xf6be('0x38')]=_[_0xf6be('0x3c')](_0x38397e[_0xf6be('0x38')]);_0x2d3c9a[_0xf6be('0x3d')]=_['intersection'](_0x2d3c9a[_0xf6be('0x3b')],_0x2d3c9a[_0xf6be('0x38')]);_0x316424[_0xf6be('0x3e')]=_[_0xf6be('0x3f')](_0x2d3c9a[_0xf6be('0x3b')],qs[_0xf6be('0x40')](_0x38397e[_0xf6be('0x38')][_0xf6be('0x40')]));_0x316424[_0xf6be('0x3e')]=_0x316424['attributes']['length']?_0x316424['attributes']:_0x2d3c9a['model'];if(_0x38397e[_0xf6be('0x38')][_0xf6be('0x41')]){_0x316424[_0xf6be('0x42')]=[{'all':!![]}];}_0x316424=_['merge']({},_0x316424,_0x38397e['options']);return db[_0xf6be('0x43')][_0xf6be('0x44')](_0x316424)[_0xf6be('0x16')](handleEntityNotFound(_0x5791e5,null))['then'](respondWithResult(_0x5791e5,null))[_0xf6be('0x1f')](handleError(_0x5791e5,null));};exports[_0xf6be('0x45')]=function(_0x2b5b19,_0x4ecfb4){return db[_0xf6be('0x43')]['create'](_0x2b5b19['body'],{})['then'](respondWithResult(_0x4ecfb4,0xc9))[_0xf6be('0x1f')](handleError(_0x4ecfb4,null));};exports[_0xf6be('0x27')]=function(_0x192ae6,_0x13f3ba){if(_0x192ae6['body']['id']){delete _0x192ae6['body']['id'];}return db['ChatInteraction'][_0xf6be('0x44')]({'where':{'id':_0x192ae6['params']['id']}})[_0xf6be('0x16')](handleEntityNotFound(_0x13f3ba,null))[_0xf6be('0x16')](saveUpdates(_0x192ae6[_0xf6be('0x46')],null))[_0xf6be('0x16')](respondWithResult(_0x13f3ba,null))['catch'](handleError(_0x13f3ba,null));};exports['destroy']=function(_0x5b1e2e,_0x44f04){return db['ChatInteraction'][_0xf6be('0x44')]({'where':{'id':_0x5b1e2e[_0xf6be('0x3a')]['id']}})[_0xf6be('0x16')](handleEntityNotFound(_0x44f04,null))['then'](removeEntity(_0x44f04,null))[_0xf6be('0x1f')](handleError(_0x44f04,null));};exports[_0xf6be('0x47')]=function(_0x3e58e0,_0x1e94f0){return db[_0xf6be('0x43')][_0xf6be('0x47')]()[_0xf6be('0x16')](respondWithResult(_0x1e94f0,null))[_0xf6be('0x1f')](handleError(_0x1e94f0,null));};exports[_0xf6be('0x48')]=function(_0x54b853,_0xc0967e){var _0x8ba025=_0x54b853[_0xf6be('0x3a')]['id'];var _0x422aed;var _0x5eb4b5;var _0x5235ed;return db[_0xf6be('0x43')][_0xf6be('0x49')]({'where':{'id':_0x8ba025}})['then'](function(_0x5050ec){_0x422aed=_0x5050ec;return db[_0xf6be('0x4a')]['findOne']({'where':{'id':_0x5050ec[_0xf6be('0x4b')]},'attributes':['id',_0xf6be('0x4c'),_0xf6be('0x4d'),_0xf6be('0x4e'),'vidaooNote',_0xf6be('0x4f')],'raw':!![]});})[_0xf6be('0x16')](function(_0x5288ef){if(_0x5288ef&&_0x5288ef[_0xf6be('0x4c')]&&_0x5288ef[_0xf6be('0x4d')]){_0x5eb4b5=_0x5288ef;var _0x23c068={'interaction':{'id':_0x8ba025},'agent':{'id':_0x54b853[_0xf6be('0x39')]['id'],'name':_0x54b853[_0xf6be('0x39')]['name'],'fullname':_0x54b853['user'][_0xf6be('0x50')],'email':_0x54b853['user']['email']},'contact':_0x54b853['body'][_0xf6be('0x2e')],'account':_0x54b853[_0xf6be('0x46')]['account']};var _0x4e0d47={'rejectUnauthorized':![],'method':_0xf6be('0x51'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x5288ef['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x54b853[_0xf6be('0x39')][_0xf6be('0x52')]],'buttons':null,'topic':_0x5eb4b5['vidaooTopic'],'note':_[_0xf6be('0x53')](_0x5eb4b5['vidaooNote'])?null:getMustacheRender(_0x5eb4b5[_0xf6be('0x54')],_0x23c068),'metadata':null},'redirect':_0xf6be('0x55'),'json':!![]};try{if(!_[_0xf6be('0x53')](_0x5eb4b5['vidaooMetadata'])){var _0x13721d=getMustacheRender(_0x5eb4b5[_0xf6be('0x4f')],_0x23c068);var _0x413427=JSON[_0xf6be('0x56')](_0x13721d);_0x4e0d47[_0xf6be('0x46')][_0xf6be('0x57')]=_0x413427;}}catch(_0x4bae1d){throw new db['Sequelize']['ValidationError'](_0xf6be('0x58'));}return rp(_0x4e0d47);}else{throw new db[(_0xf6be('0x59'))][(_0xf6be('0x5a'))](_0xf6be('0x5b'));}})[_0xf6be('0x16')](function(_0x2a2d75){_0x5235ed=_0x2a2d75;if(_0x5235ed['id']){var _0x9f513a={'body':_0x5235ed[_0xf6be('0x5c')],'ChatWebsiteId':_0x5eb4b5['id'],'ChatInteractionId':_0x422aed['id'],'direction':_0xf6be('0x5d'),'UserId':_0x54b853[_0xf6be('0x39')]['id']};return db['ChatMessage']['create'](_0x9f513a,{});}else{throw new db[(_0xf6be('0x59'))][(_0xf6be('0x5a'))](_0xf6be('0x5e'));}})[_0xf6be('0x16')](function(){return _0x422aed[_0xf6be('0x5f')]({'vidaooSessionId':_0x5235ed['id']});})['then'](respondWithResult(_0xc0967e,null))['catch'](handleError(_0xc0967e,null));};exports['customUpdate']=function(_0x1e262c,_0x5e4165){if(_0x1e262c[_0xf6be('0x46')]['id']){delete _0x1e262c[_0xf6be('0x46')]['id'];}return db[_0xf6be('0x43')][_0xf6be('0x44')]({'where':{'id':_0x1e262c['params']['id']},'include':[{'model':db[_0xf6be('0x60')],'as':'Contact'}]})[_0xf6be('0x16')](handleEntityNotFound(_0x5e4165,null))[_0xf6be('0x16')](saveUpdates(_0x1e262c[_0xf6be('0x46')],null))[_0xf6be('0x16')](respondWithResult(_0x5e4165,null))[_0xf6be('0x1f')](handleError(_0x5e4165,null));};exports[_0xf6be('0x61')]=function(_0x5002b1,_0x1eb661){if(_0x5002b1['body']['id']){delete _0x5002b1[_0xf6be('0x46')]['id'];}return db[_0xf6be('0x43')][_0xf6be('0x44')]({'where':{'id':_0x5002b1[_0xf6be('0x3a')]['id']}})[_0xf6be('0x16')](function(_0x2e06c2){if(!_0x2e06c2){logger[_0xf6be('0x1c')](_0xf6be('0x62'),'abandon',0x194,_0xf6be('0x63'));_0x1eb661[_0xf6be('0x20')](0x194);}else{if(_0x2e06c2[_0xf6be('0x64')]){throw new db[(_0xf6be('0x59'))][(_0xf6be('0x5a'))](_0xf6be('0x65'));}}return _0x2e06c2;})[_0xf6be('0x16')](function(_0x1abc21){if(_0x1abc21){return _0x1abc21[_0xf6be('0x27')]({'closed':_0x5002b1[_0xf6be('0x46')][_0xf6be('0x66')],'disposition':_0x5002b1[_0xf6be('0x46')]['disposition']})['then'](function(_0x45757d){return _0x45757d;});}})[_0xf6be('0x16')](function(){return respondWithRpcPromise(_0xf6be('0x67'),'abandon',_0x5002b1[_0xf6be('0x46')],client9004);})[_0xf6be('0x16')](respondWithResult(_0x1eb661,null))['catch'](handleError(_0x1eb661,null));};exports[_0xf6be('0x68')]=function(_0x48fd3a,_0x2c125d){_0x48fd3a[_0xf6be('0x46')]['name']=_0x48fd3a['file'][_0xf6be('0x69')];_0x48fd3a[_0xf6be('0x46')][_0xf6be('0x6a')]=_0x48fd3a['file'][_0xf6be('0x6b')];_0x48fd3a[_0xf6be('0x46')]['type']=_0x48fd3a[_0xf6be('0x6c')]['mimetype'];return db[_0xf6be('0x6d')][_0xf6be('0x45')](_0x48fd3a[_0xf6be('0x46')])[_0xf6be('0x16')](respondWithResult(_0x2c125d,0xc9))['catch'](handleError(_0x2c125d,null));};exports[_0xf6be('0x6e')]=function(_0x2800aa,_0x4aff58){return db[_0xf6be('0x43')]['findOne']({'where':{'id':_0x2800aa[_0xf6be('0x3a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4aff58,null))['then'](function(_0x2117fe){if(_0x2117fe){if(_0x2117fe[_0xf6be('0x66')]){return _0x4aff58[_0xf6be('0x21')](0x193)[_0xf6be('0x22')]({'status':0x193,'message':_0xf6be('0x6f')});}return db[_0xf6be('0x6d')][_0xf6be('0x49')]({'where':{'id':_0x2800aa[_0xf6be('0x38')][_0xf6be('0x70')]},'raw':!![]})['then'](handleEntityNotFound(_0x4aff58,null));}})[_0xf6be('0x16')](function(_0x5d2fbc){if(_0x5d2fbc){var _0x481184=_0x5d2fbc[_0xf6be('0x71')]!==null;var _0x4f5e4d=path[_0xf6be('0x72')](config[_0xf6be('0x73')],_0xf6be('0x74'));if(_0x481184){_0x4f5e4d=path['join'](_0x4f5e4d,_0xf6be('0x75'));}var _0x378ae4=path[_0xf6be('0x72')](_0x4f5e4d,_0x5d2fbc[_0xf6be('0x6a')]);return _0x4aff58[_0xf6be('0x76')](_0x378ae4);}})[_0xf6be('0x1f')](handleError(_0x4aff58,null));};exports[_0xf6be('0x77')]=function(_0x513093,_0x2c155c){var _0x679e67=null;var _0x32c572=null;var _0x4c056a=null;if(_0x513093[_0xf6be('0x46')]['id']){delete _0x513093['body']['id'];}if(_0x513093[_0xf6be('0x46')][_0xf6be('0x78')]){_0x4c056a=path[_0xf6be('0x72')](config[_0xf6be('0x73')],_0xf6be('0x79'),util[_0xf6be('0x7a')](_0xf6be('0x7b'),Date[_0xf6be('0x7c')]()));_0x513093[_0xf6be('0x46')][_0xf6be('0x7d')]=_0x4c056a;}return db[_0xf6be('0x43')][_0xf6be('0x44')]({'where':{'id':_0x513093[_0xf6be('0x3a')]['id']},'include':[{'model':db[_0xf6be('0x7e')],'as':'Messages','include':[{'model':db[_0xf6be('0x7f')],'as':_0xf6be('0x7f')}]}]})[_0xf6be('0x16')](handleEntityNotFound(_0x2c155c,null))[_0xf6be('0x16')](saveUpdates(_0x513093['body'],null))[_0xf6be('0x16')](function(_0x4ecf1b){if(_0x4ecf1b){_0x679e67=_0x4ecf1b;return db[_0xf6be('0x4a')][_0xf6be('0x44')]({'where':{'id':_0x679e67[_0xf6be('0x4b')]}});}})[_0xf6be('0x16')](function(_0x31a96e){if(_0x31a96e){_0x32c572=_0x31a96e;return db[_0xf6be('0x60')][_0xf6be('0x44')]({'where':{'id':_0x679e67[_0xf6be('0x80')]}});}})[_0xf6be('0x16')](function(_0x76b5b2){if(_0x76b5b2){if(_0x4c056a){var _0x1469b9=null;for(var _0x2ec3da=0x1;_0x2ec3da<_0x679e67[_0xf6be('0x81')][_0xf6be('0x82')];++_0x2ec3da){_0x1469b9=_0x679e67[_0xf6be('0x81')][_0x2ec3da];var _0x30bea5=_0x1469b9[_0xf6be('0x64')]?util[_0xf6be('0x7a')]('%s%d',_0x32c572[_0xf6be('0x83')],_0x1469b9[_0xf6be('0x64')]):_0xf6be('0x84');var _0x1a2de2=_0x513093[_0xf6be('0x46')][_0xf6be('0x85')]||util[_0xf6be('0x7a')](_0xf6be('0x86'),_0xf6be('0x87'),_0x1469b9['ContactId']);switch(_0x32c572[_0xf6be('0x88')]){case'website_alias':_0x30bea5=_0x1469b9['UserId']?util['format'](_0xf6be('0x86'),_0x32c572[_0xf6be('0x83')],_0x1469b9['UserId']):'System';break;case _0xf6be('0x89'):_0x30bea5=_0x1469b9[_0xf6be('0x64')]?_0x1469b9[_0xf6be('0x7f')][_0xf6be('0x8a')]||_0x1469b9[_0xf6be('0x7f')][_0xf6be('0x50')]:_0xf6be('0x84');break;case _0xf6be('0x8b'):_0x30bea5=_0x1469b9[_0xf6be('0x64')]?_0x1469b9[_0xf6be('0x7f')]['fullname']:_0xf6be('0x84');break;default:_0x30bea5=_0x1469b9['UserId']?util[_0xf6be('0x7a')](_0xf6be('0x86'),_0x32c572['agentAlias'],_0x1469b9[_0xf6be('0x64')]):_0xf6be('0x84');}var _0x5b73f0=util[_0xf6be('0x7a')](_0xf6be('0x8c'),moment(_0x1469b9[_0xf6be('0x8d')])[_0xf6be('0x7a')](_0xf6be('0x8e')),_0x1469b9[_0xf6be('0x8f')]==='in'?_0x1a2de2:_0x30bea5,_0x1469b9[_0xf6be('0x46')]);if(!_0x1469b9[_0xf6be('0x90')]){fs[_0xf6be('0x91')](_0x4c056a,_0x5b73f0);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xf6be('0x92'),'raw':!![],'include':[{'model':db[_0xf6be('0x93')],'as':_0xf6be('0x93'),'raw':!![]}]}]});}}})[_0xf6be('0x16')](function(_0x427f9e){if(!_0x427f9e||!_0x427f9e[_0xf6be('0x92')]||!_0x513093[_0xf6be('0x46')])return _0x679e67;var _0xfdf3c7=_0x427f9e[_0xf6be('0x94')]();return respondWithRpcPromise(_0xf6be('0x95'),'sendMail',{'account':_0xfdf3c7,'message':{'from':util[_0xf6be('0x7a')]('\x22%s\x22\x20<%s>',_0x427f9e[_0xf6be('0x2b')],_0x427f9e['email']||_0x427f9e[_0xf6be('0x92')][_0xf6be('0x39')]),'to':_0x513093[_0xf6be('0x46')]['mailTranscript'],'subject':_0xf6be('0x96'),'text':util[_0xf6be('0x7a')](_0xf6be('0x97'),_0x513093[_0xf6be('0x46')][_0xf6be('0x78')]),'attachments':[{'path':_0x4c056a}]}})['then'](function(){return _0x679e67;})[_0xf6be('0x1f')](function(_0x439f88){logger[_0xf6be('0x1c')](_0x439f88);});})[_0xf6be('0x16')](respondWithStatusCode(_0x2c155c,0xc8))[_0xf6be('0x1f')](handleError(_0x2c155c,null));};exports['addMessage']=function(_0x2edc2a,_0x17b61a){return db[_0xf6be('0x7e')][_0xf6be('0x44')]({'where':{'id':_0x2edc2a[_0xf6be('0x3a')]['id']}})[_0xf6be('0x16')](handleEntityNotFound(_0x17b61a,null))[_0xf6be('0x16')](function(_0x37bb3c){if(_0x37bb3c){return _0x37bb3c['addMessage'](_0x2edc2a[_0xf6be('0x46')][_0xf6be('0x98')],_[_0xf6be('0x99')](_0x2edc2a[_0xf6be('0x46')],[_0xf6be('0x98'),'id'])||{});}})[_0xf6be('0x16')](respondWithResult(_0x17b61a,null))[_0xf6be('0x1f')](handleError(_0x17b61a,null));};exports[_0xf6be('0x9a')]=function(_0x1a17a4,_0x361f22){var _0x3a651e={'raw':![],'where':{}};var _0xfeacc6={};var _0x5533df={'count':0x0,'rows':[]};return db[_0xf6be('0x43')]['findOne']({'where':{'id':_0x1a17a4[_0xf6be('0x3a')]['id']}})['then'](handleEntityNotFound(_0x361f22,null))[_0xf6be('0x16')](function(_0xfcedfa){if(_0xfcedfa){_0xfeacc6['model']=_[_0xf6be('0x3c')](db[_0xf6be('0x7e')][_0xf6be('0x33')]);_0xfeacc6[_0xf6be('0x38')]=_['keys'](_0x1a17a4[_0xf6be('0x38')]);_0xfeacc6[_0xf6be('0x3d')]=_[_0xf6be('0x3f')](_0xfeacc6[_0xf6be('0x3b')],_0xfeacc6['query']);_0x3a651e[_0xf6be('0x3e')]=_['intersection'](_0xfeacc6[_0xf6be('0x3b')],qs[_0xf6be('0x40')](_0x1a17a4[_0xf6be('0x38')]['fields']));_0x3a651e['attributes']=_0x3a651e[_0xf6be('0x3e')][_0xf6be('0x82')]?_0x3a651e[_0xf6be('0x3e')]:_0xfeacc6[_0xf6be('0x3b')];if(!_0x1a17a4[_0xf6be('0x38')][_0xf6be('0x9b')](_0xf6be('0x9c'))){_0x3a651e[_0xf6be('0x25')]=qs[_0xf6be('0x25')](_0x1a17a4[_0xf6be('0x38')][_0xf6be('0x25')]);_0x3a651e[_0xf6be('0x23')]=qs['offset'](_0x1a17a4[_0xf6be('0x38')][_0xf6be('0x23')]);}_0x3a651e['order']=qs[_0xf6be('0x9d')](_0x1a17a4[_0xf6be('0x38')][_0xf6be('0x9d')]);_0x3a651e[_0xf6be('0x9e')]=qs['filters'](_[_0xf6be('0x9f')](_0x1a17a4[_0xf6be('0x38')],_0xfeacc6[_0xf6be('0x3d')]));_0x3a651e[_0xf6be('0x9e')]['ChatInteractionId']=_0xfcedfa['id'];if(_0x1a17a4[_0xf6be('0x38')]['filter']){_0x3a651e['where']=_[_0xf6be('0xa0')](_0x3a651e['where'],{'$or':_['map'](_0x3a651e[_0xf6be('0x3e')],function(_0x306981){var _0x3dc8ba={};_0x3dc8ba[_0x306981]={'$like':'%'+_0x1a17a4['query'][_0xf6be('0xa1')]+'%'};return _0x3dc8ba;})});}if(_0x1a17a4[_0xf6be('0x38')][_0xf6be('0xa2')]){var _0x294306=_0x1a17a4[_0xf6be('0x38')]['$gte'][_0xf6be('0xa3')](',');var _0x263b94={};_0x263b94[_0x294306[0x0]]={'$gte':moment(_0x294306[0x1])[_0xf6be('0x7a')](_0xf6be('0xa4'))};_0x3a651e[_0xf6be('0x9e')]=_['merge'](_0x3a651e[_0xf6be('0x9e')],_0x263b94);}_0x3a651e=_[_0xf6be('0xa0')]({},_0x3a651e,_0x1a17a4[_0xf6be('0xa5')]);return db['ChatMessage'][_0xf6be('0x26')]({'where':_0x3a651e[_0xf6be('0x9e')]})['then'](function(_0x2bdc3c){_0x5533df['count']=_0x2bdc3c;if(_0x1a17a4[_0xf6be('0x38')]['includeAll']){_0x3a651e[_0xf6be('0x42')]=[{'all':!![]}];}return db['ChatMessage'][_0xf6be('0xa6')](_0x3a651e);})[_0xf6be('0x16')](function(_0x5c4443){_0x5533df[_0xf6be('0xa7')]=_0x5c4443;return _0x5533df;});}})[_0xf6be('0x16')](respondWithFilteredResult(_0x361f22,_0x3a651e))[_0xf6be('0x1f')](handleError(_0x361f22,null));};exports[_0xf6be('0xa8')]=function(_0x1b6168,_0x495d13){var _0x508ed2={'where':{}},_0x19d9cd={},_0x2a8304={'count':0x0,'rows':[]};return db[_0xf6be('0x43')][_0xf6be('0x49')]({'where':{'id':_0x1b6168['params']['id']}})[_0xf6be('0x16')](handleEntityNotFound(_0x495d13,null))['then'](function(_0x50e840){if(_0x50e840){_0x19d9cd[_0xf6be('0x3b')]=_[_0xf6be('0x3c')](db[_0xf6be('0x7e')]['rawAttributes']);_0x19d9cd[_0xf6be('0x38')]=_[_0xf6be('0x3c')](_0x1b6168['query']);_0x19d9cd[_0xf6be('0x3d')]=_[_0xf6be('0x3f')](_0x19d9cd[_0xf6be('0x3b')],_0x19d9cd['query']);_0x508ed2[_0xf6be('0x3e')]=_[_0xf6be('0x3f')](_0x19d9cd['model'],qs['fields'](_0x1b6168[_0xf6be('0x38')][_0xf6be('0x40')]));_0x508ed2[_0xf6be('0x3e')]=_0x508ed2['attributes'][_0xf6be('0x82')]?_0x508ed2[_0xf6be('0x3e')]:_0x19d9cd['model'];if(!_0x1b6168[_0xf6be('0x38')][_0xf6be('0x9b')]('nolimit')){_0x508ed2[_0xf6be('0x25')]=qs[_0xf6be('0x25')](_0x1b6168['query']['limit']);_0x508ed2[_0xf6be('0x23')]=qs[_0xf6be('0x23')](_0x1b6168['query']['offset']);}_0x508ed2['order']=qs[_0xf6be('0x9d')](_0x1b6168[_0xf6be('0x38')][_0xf6be('0x9d')]);_0x508ed2['where']=qs[_0xf6be('0x3d')](_[_0xf6be('0x9f')](_0x1b6168[_0xf6be('0x38')],_0x19d9cd[_0xf6be('0x3d')]));_0x508ed2[_0xf6be('0x9e')][_0xf6be('0xa9')]=_0x50e840['id'];if(_0x1b6168[_0xf6be('0x38')][_0xf6be('0xa1')]){_0x508ed2[_0xf6be('0x9e')]=_[_0xf6be('0xa0')](_0x508ed2[_0xf6be('0x9e')],{'$or':_[_0xf6be('0x32')](_0x508ed2[_0xf6be('0x3e')],function(_0xdb3f18){var _0x54b7ad={};_0x54b7ad[_0xdb3f18]={'$like':'%'+_0x1b6168[_0xf6be('0x38')][_0xf6be('0xa1')]+'%'};return _0x54b7ad;})});}_0x508ed2[_0xf6be('0x9e')]['secret']=![];if(_0x1b6168[_0xf6be('0x38')]['id']){_0x508ed2[_0xf6be('0x9e')]['id']={'$gt':_0x1b6168[_0xf6be('0x38')]['id']};}_0x508ed2=_['merge']({},_0x508ed2,_0x1b6168[_0xf6be('0xa5')]);return db[_0xf6be('0x7e')][_0xf6be('0x26')]({'where':_0x508ed2['where']})[_0xf6be('0x16')](function(_0x17b818){_0x2a8304[_0xf6be('0x26')]=_0x17b818;_0x508ed2['include']=[];if(_0x1b6168[_0xf6be('0x38')][_0xf6be('0xaa')]){_0x508ed2[_0xf6be('0x42')]['push']({'model':db[_0xf6be('0x7f')],'as':_0xf6be('0x7f'),'attributes':['id',_0xf6be('0x50'),_0xf6be('0x8a')]});}if(_0x1b6168[_0xf6be('0x38')]['includeAll']){_0x508ed2['include']=[{'all':!![]}];}return db['ChatMessage'][_0xf6be('0xa6')](_0x508ed2);})[_0xf6be('0x16')](function(_0x426662){_0x2a8304['rows']=_0x426662;return _0x2a8304;});}})[_0xf6be('0x16')](respondWithFilteredResult(_0x495d13,_0x508ed2))['catch'](handleError(_0x495d13,null));};exports[_0xf6be('0xab')]=function(_0x149d88,_0x3e47ab){return db[_0xf6be('0x43')][_0xf6be('0x44')]({'where':{'id':_0x149d88['params']['id']}})['then'](handleEntityNotFound(_0x3e47ab,null))[_0xf6be('0x16')](function(_0x422f18){if(_0x422f18){return _0x422f18[_0xf6be('0xac')](_0x149d88[_0xf6be('0x46')][_0xf6be('0x98')],_['omit'](_0x149d88[_0xf6be('0x46')],[_0xf6be('0x98'),'id'])||{})['spread'](function(){return db['Tag'][_0xf6be('0xa6')]({'attributes':['id',_0xf6be('0x2b'),_0xf6be('0xad')],'where':{'id':_0x149d88[_0xf6be('0x46')][_0xf6be('0x98')]}});})['then'](function(_0x252b61){socket[_0xf6be('0xae')](_0xf6be('0xaf'),{'id':Number(_0x149d88[_0xf6be('0x3a')]['id']),'tags':_0x252b61||[]});return{'id':Number(_0x149d88[_0xf6be('0x3a')]['id']),'tags':_0x252b61||[]};});}})[_0xf6be('0x16')](respondWithResult(_0x3e47ab,null))['catch'](handleError(_0x3e47ab,null));};exports[_0xf6be('0xb0')]=function(_0x2a18ac,_0x48956e){return db[_0xf6be('0x43')][_0xf6be('0x44')]({'where':{'id':_0x2a18ac[_0xf6be('0x3a')]['id']}})[_0xf6be('0x16')](handleEntityNotFound(_0x48956e,null))[_0xf6be('0x16')](function(_0x460e25){if(_0x460e25){return _0x460e25['removeTags'](_0x2a18ac[_0xf6be('0x38')]['ids']);}})[_0xf6be('0x16')](respondWithStatusCode(_0x48956e,null))[_0xf6be('0x1f')](handleError(_0x48956e,null));};exports['download']=function(_0x4072a3,_0x5c5f84){var _0x2b10b5=moment()[_0xf6be('0xb1')]()[_0xf6be('0xb2')]();var _0x5ce496=path[_0xf6be('0x72')](config['root'],_0xf6be('0xb3'),_0xf6be('0xb4'),_0xf6be('0xb5'));var _0x449054=path[_0xf6be('0x72')](config['root'],_0xf6be('0xb3'),_0xf6be('0xb4'),_0xf6be('0xb6'));var _0x28884c=path[_0xf6be('0x72')](_0x5ce496,_0x2b10b5);var _0x494c2a=util['format']('transcript-%d-%s.zip',_0x4072a3[_0xf6be('0x3a')]['id'],_0x2b10b5);var _0xb19fa=path['join'](_0x5ce496,_0x494c2a);var _0x92cb4=[];_0x92cb4[_0xf6be('0xb7')]({'model':db[_0xf6be('0x7f')],'as':'User','attributes':['id',_0xf6be('0x50')],'raw':!![]});_0x92cb4[_0xf6be('0xb7')]({'model':db[_0xf6be('0x60')],'as':_0xf6be('0xb8'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x4072a3['query'][_0xf6be('0xb6')]){_0x92cb4[_0xf6be('0xb7')]({'model':db[_0xf6be('0x6d')],'as':_0xf6be('0x6d'),'raw':!![]});}var _0x359cc9=[{'model':db[_0xf6be('0x7e')],'as':_0xf6be('0x81'),'attributes':['id',_0xf6be('0x46'),_0xf6be('0x8d'),_0xf6be('0x8f'),_0xf6be('0x90'),'read'],'include':_0x92cb4}];_0x359cc9[_0xf6be('0xb7')]({'model':db[_0xf6be('0x4a')],'as':'Account','attributes':['id',_0xf6be('0x2b')]});_0x359cc9[_0xf6be('0xb7')]({'model':db[_0xf6be('0x7f')],'as':_0xf6be('0xb9'),'attributes':['id',_0xf6be('0x50')]});return db[_0xf6be('0x43')][_0xf6be('0x44')]({'where':{'id':_0x4072a3[_0xf6be('0x3a')]['id']},'include':_0x359cc9})['then'](handleEntityNotFound(_0x5c5f84,null))[_0xf6be('0x16')](function(_0x4a1681){if(_0x4a1681){var _0x475dd5=_0x4a1681[_0xf6be('0xba')]({'plain':!![]});fs[_0xf6be('0xbb')](_0x28884c);var _0x32d225={'channel':_0xf6be('0xbc'),'account':_0x475dd5['Account'][_0xf6be('0x2b')],'agent':_0x475dd5[_0xf6be('0xb9')]?_0x475dd5[_0xf6be('0xb9')]['fullname']:_0xf6be('0xbd'),'createdAt':moment(_0x475dd5[_0xf6be('0x8d')])['format'](_0xf6be('0xa4'))[_0xf6be('0xb2')](),'closedAt':_0x475dd5[_0xf6be('0x66')]?moment(_0x475dd5[_0xf6be('0xbe')])[_0xf6be('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xf6be('0xb2')]():'','disposition':_0x475dd5[_0xf6be('0xbf')],'chatInfo':{'browser':_0x475dd5[_0xf6be('0xc0')],'os':_0x475dd5[_0xf6be('0xc1')],'referer':_0x475dd5[_0xf6be('0xc2')],'customerIp':_0x475dd5['customerIp'],'customerPort':_0x475dd5[_0xf6be('0xc3')]?_0x475dd5['customerPort']:_0xf6be('0xbd')},'messages':_(_0x475dd5[_0xf6be('0x81')])[_0xf6be('0xc4')]()[_0xf6be('0xa1')]({'secret':![]})[_0xf6be('0x32')](function(_0x4915e9){if(_0x4915e9[_0xf6be('0x6d')]){var _0xffc0b5=path[_0xf6be('0x72')](_0x449054,_0x4915e9['Attachment']['basename']);if(fs['existsSync'](_0xffc0b5)){fs[_0xf6be('0xc5')](_0xffc0b5)['pipe'](fs[_0xf6be('0xc6')](path[_0xf6be('0x72')](_0x28884c,_0x4915e9[_0xf6be('0x6d')][_0xf6be('0x6a')])));}}return{'date':moment(_0x4915e9['createdAt'])[_0xf6be('0x7a')](_0xf6be('0xa4'))[_0xf6be('0xb2')](),'sender':_0x4915e9[_0xf6be('0x8f')]===_0xf6be('0x5d')?_0x4915e9['User']?_0x4915e9['User'][_0xf6be('0x50')]:_0xf6be('0x84'):_0x4915e9[_0xf6be('0xb8')]['firstName']+(_0x4915e9[_0xf6be('0xb8')][_0xf6be('0xc7')]?'\x20'+_0x4915e9[_0xf6be('0xb8')]['lastName']:''),'body':_0x4915e9['Attachment']?_0x4915e9[_0xf6be('0x6d')][_0xf6be('0x6a')]:_0x4915e9['body'],'direction':_0x4915e9[_0xf6be('0x8f')]===_0xf6be('0x5d')?'A':'C','secret':_0x4915e9[_0xf6be('0x90')],'read':_0x4915e9['read'],'attachment':_0x4915e9[_0xf6be('0x6d')]};})[_0xf6be('0xc8')]()};return ejs['renderFile'](path['join'](config['root'],_0xf6be('0xb3'),_0xf6be('0xc9'),'downloadInteraction.ejs'),{'interaction':_0x32d225})[_0xf6be('0x16')](function(_0x5cf03e){var _0x1f57b4=path[_0xf6be('0x72')](_0x28884c,_0xf6be('0xca')+_0x475dd5['id']+'-'+_0x2b10b5+'.pdf');var _0x14f4f2={'path':_0x1f57b4,'channel':_0xf6be('0xbc'),'interactionId':_0x475dd5['id']};return pdf[_0xf6be('0xcb')](_0x5cf03e,_0x14f4f2);})[_0xf6be('0x16')](function(){return new Promise(function(_0xaff53a,_0x50f2c3){zipdir(_0x28884c,{'saveTo':_0xb19fa},function(_0x19b077,_0x125cca){if(_0x19b077)return _0x50f2c3(_0x19b077);return _0xaff53a(_0x125cca);});})[_0xf6be('0x16')](function(){return new BPromise(function(_0x1774ed,_0x3d0ba3){rimraf(_0x28884c,function(_0x381751){if(_0x381751)_0x3d0ba3(_0x381751);return _0x1774ed();});});})[_0xf6be('0x16')](function(){return _0x5c5f84[_0xf6be('0x76')](_0xb19fa,_0x494c2a,function(_0x7158cb){if(_0x7158cb){logger[_0xf6be('0x1c')](_0xf6be('0xcc'),_0x7158cb);}else{fs[_0xf6be('0xcd')](_0xb19fa);}});});});}else{return _0x5c5f84[_0xf6be('0x20')](0xc8);}})[_0xf6be('0x1f')](handleError(_0x5c5f84,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 4ea2da4..a790283 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 _0xa5af=['setDataValue','map','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','save','update','remove','getUsers','then'];(function(_0x2b048e,_0x5abd64){var _0x2f5d57=function(_0x377a1a){while(--_0x377a1a){_0x2b048e['push'](_0x2b048e['shift']());}};_0x2f5d57(++_0x5abd64);}(_0xa5af,0xf7));var _0xfa5a=function(_0x348558,_0x27f9b4){_0x348558=_0x348558-0x0;var _0x14f0aa=_0xa5af[_0x348558];return _0x14f0aa;};'use strict';var EventEmitter=require(_0xfa5a('0x0'));var ChatInteraction=require(_0xfa5a('0x1'))['db'][_0xfa5a('0x2')];var ChatMessage=require(_0xfa5a('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xfa5a('0x3')](0x0);var events={'afterCreate':_0xfa5a('0x4'),'afterUpdate':_0xfa5a('0x5'),'afterDestroy':_0xfa5a('0x6')};function emitEvent(_0x3f204c){return function(_0x5ad5f8,_0x5a99b3,_0x1b652d){_0x5ad5f8[_0xfa5a('0x7')]({'attributes':['id'],'raw':!![]})[_0xfa5a('0x8')](function(_0x8f7f5e){_0x5ad5f8[_0xfa5a('0x9')]('Users',_0x8f7f5e[_0xfa5a('0xa')](function(_0xdb6ce0){return{'id':_0xdb6ce0['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x5ad5f8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5f13e3){_0x5ad5f8[_0xfa5a('0x9')]('unreadMessages',_0x5f13e3[_0xfa5a('0xb')]);ChatInteractionEvents[_0xfa5a('0xc')](_0x3f204c+':'+_0x5ad5f8['id'],_0x5ad5f8);ChatInteractionEvents['emit'](_0x3f204c,_0x5ad5f8);_0x1b652d(null);})[_0xfa5a('0xd')](_0x1b652d(null));};}for(var e in events){if(events[_0xfa5a('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xfa5a('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xb9ef=['map','findAll','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0xb9ef,0xbb));var _0xfb9e=function(_0x516d3f,_0x282a48){_0x516d3f=_0x516d3f-0x0;var _0x216275=_0xb9ef[_0x516d3f];return _0x216275;};'use strict';var EventEmitter=require(_0xfb9e('0x0'));var ChatInteraction=require(_0xfb9e('0x1'))['db'][_0xfb9e('0x2')];var ChatMessage=require(_0xfb9e('0x1'))['db'][_0xfb9e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfb9e('0x4'),'afterUpdate':_0xfb9e('0x5'),'afterDestroy':_0xfb9e('0x6')};function emitEvent(_0x35fa2a){return function(_0x537036,_0x17e28d,_0x5a696c){_0x537036[_0xfb9e('0x7')]({'attributes':['id'],'raw':!![]})[_0xfb9e('0x8')](function(_0x17557f){_0x537036[_0xfb9e('0x9')](_0xfb9e('0xa'),_0x17557f[_0xfb9e('0xb')](function(_0x32f685){return{'id':_0x32f685['id']};}));return ChatMessage[_0xfb9e('0xc')]({'where':{'ChatInteractionId':_0x537036['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4369d5){_0x537036[_0xfb9e('0x9')](_0xfb9e('0xd'),_0x4369d5[_0xfb9e('0xe')]);ChatInteractionEvents[_0xfb9e('0xf')](_0x35fa2a+':'+_0x537036['id'],_0x537036);ChatInteractionEvents['emit'](_0x35fa2a,_0x537036);_0x5a696c(null);})['catch'](_0x5a696c(null));};}for(var e in events){if(events[_0xfb9e('0x10')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xfb9e('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 80333e4..eda6f9f 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 _0xa2bd=['../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','format','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x401ec9,_0x77c73f){var _0x8ef3a1=function(_0x171c3c){while(--_0x171c3c){_0x401ec9['push'](_0x401ec9['shift']());}};_0x8ef3a1(++_0x77c73f);}(_0xa2bd,0x1ca));var _0xda2b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa2bd[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xda2b('0x0'));var util=require(_0xda2b('0x1'));var logger=require(_0xda2b('0x2'))(_0xda2b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xda2b('0x4'));var fs=require('fs');var path=require(_0xda2b('0x5'));var rimraf=require('rimraf');var config=require(_0xda2b('0x6'));var attributes=require(_0xda2b('0x7'));module[_0xda2b('0x8')]=function(_0x5e0b0a,_0x5466df){return _0x5e0b0a[_0xda2b('0x9')](_0xda2b('0xa'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x164840,_0x17ebaf,_0x2c2805){if(_0x164840[_0xda2b('0xb')](_0xda2b('0xc'))){_0x164840[_0xda2b('0xd')]=moment()[_0xda2b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2c2805(null,_0x164840);}},'charset':'utf8mb4','collate':_0xda2b('0xf')});}; \ No newline at end of file +var _0xd01e=['exports','define','ChatInteraction','chat_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd01e,0x1dd));var _0xed01=function(_0x3aa15f,_0x1a6fcf){_0x3aa15f=_0x3aa15f-0x0;var _0x54f112=_0xd01e[_0x3aa15f];return _0x54f112;};'use strict';var _=require(_0xed01('0x0'));var util=require(_0xed01('0x1'));var logger=require(_0xed01('0x2'))(_0xed01('0x3'));var moment=require(_0xed01('0x4'));var BPromise=require(_0xed01('0x5'));var rp=require(_0xed01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed01('0x7'));var config=require(_0xed01('0x8'));var attributes=require('./chatInteraction.attributes');module[_0xed01('0x9')]=function(_0x3a8662,_0x58a222){return _0x3a8662[_0xed01('0xa')](_0xed01('0xb'),attributes,{'tableName':_0xed01('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x447b41,_0x3d3d1b,_0xaf9194){if(_0x447b41[_0xed01('0xd')]('closed')){_0x447b41[_0xed01('0xe')]=moment()['format'](_0xed01('0xf'));}_0xaf9194(null,_0x447b41);}},'charset':_0xed01('0x10'),'collate':_0xed01('0x11')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 3c5e260..53952c3 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 _0x1230=['request\x20sent','debug','stringify','error','message','result','catch','UpdateChatInteraction','ChatInteraction','update','options','limit','AddTagsToChatInteraction','find','addTags','body','ids','spread','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s'];(function(_0x4c0006,_0x44bcf6){var _0x16c4c6=function(_0x3716e7){while(--_0x3716e7){_0x4c0006['push'](_0x4c0006['shift']());}};_0x16c4c6(++_0x44bcf6);}(_0x1230,0x1ce));var _0x0123=function(_0x2f055f,_0xf2e2a5){_0x2f055f=_0x2f055f-0x0;var _0x4c78e9=_0x1230[_0x2f055f];return _0x4c78e9;};'use strict';var _=require(_0x0123('0x0'));var util=require(_0x0123('0x1'));var moment=require(_0x0123('0x2'));var BPromise=require(_0x0123('0x3'));var rs=require(_0x0123('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0123('0x5'));var logger=require('../../config/logger')(_0x0123('0x6'));var config=require(_0x0123('0x7'));var jayson=require(_0x0123('0x8'));var client=jayson[_0x0123('0x9')]['http']({'port':0x232a});config[_0x0123('0xa')]=_['defaults'](config[_0x0123('0xa')],{'host':_0x0123('0xb'),'port':0x18eb});var socket=require(_0x0123('0xc'))(new Redis(config[_0x0123('0xa')]));require(_0x0123('0xd'))[_0x0123('0xe')](socket);function respondWithRpcPromise(_0x135ed8,_0x327e5a,_0x2b0071){return new BPromise(function(_0x467bef,_0x4703a7){return client[_0x0123('0xf')](_0x135ed8,_0x2b0071)[_0x0123('0x10')](function(_0x6c1e9){logger[_0x0123('0x11')](_0x0123('0x12'),_0x327e5a,_0x0123('0x13'));logger[_0x0123('0x14')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x327e5a,_0x0123('0x13'),JSON[_0x0123('0x15')](_0x6c1e9));if(_0x6c1e9[_0x0123('0x16')]){if(_0x6c1e9['error']['code']===0x1f4){logger[_0x0123('0x16')](_0x0123('0x12'),_0x327e5a,_0x6c1e9[_0x0123('0x16')][_0x0123('0x17')]);return _0x4703a7(_0x6c1e9[_0x0123('0x16')]['message']);}logger[_0x0123('0x16')](_0x0123('0x12'),_0x327e5a,_0x6c1e9[_0x0123('0x16')][_0x0123('0x17')]);return _0x467bef(_0x6c1e9['error'][_0x0123('0x17')]);}else{logger['info'](_0x0123('0x12'),_0x327e5a,_0x0123('0x13'));_0x467bef(_0x6c1e9[_0x0123('0x18')][_0x0123('0x17')]);}})[_0x0123('0x19')](function(_0x2a65c9){logger[_0x0123('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x327e5a,_0x2a65c9);_0x4703a7(_0x2a65c9);});});}exports[_0x0123('0x1a')]=function(_0x5f42f7){var _0x29992e=this;return new Promise(function(_0x2a0b16,_0x63fc7b){return db[_0x0123('0x1b')][_0x0123('0x1c')](_0x5f42f7['body'],{'raw':_0x5f42f7['options']?_0x5f42f7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f42f7[_0x0123('0x1d')]?_0x5f42f7[_0x0123('0x1d')]['where']||null:null,'attributes':_0x5f42f7[_0x0123('0x1d')]?_0x5f42f7[_0x0123('0x1d')]['attributes']||null:null,'limit':_0x5f42f7['options']?_0x5f42f7[_0x0123('0x1d')][_0x0123('0x1e')]||null:null})[_0x0123('0x10')](function(_0x13e46e){logger[_0x0123('0x11')](_0x0123('0x1a'),_0x5f42f7);logger[_0x0123('0x14')](_0x0123('0x1a'),_0x5f42f7,JSON['stringify'](_0x13e46e));_0x2a0b16(_0x13e46e);})[_0x0123('0x19')](function(_0x1a851f){logger['error'](_0x0123('0x1a'),_0x1a851f[_0x0123('0x17')],_0x5f42f7);_0x63fc7b(_0x29992e[_0x0123('0x16')](0x1f4,_0x1a851f[_0x0123('0x17')]));});});};exports[_0x0123('0x1f')]=function(_0x43fecc){return new Promise(function(_0x3af059,_0x473a0b){return db['ChatInteraction'][_0x0123('0x20')]({'where':_0x43fecc['options']?_0x43fecc[_0x0123('0x1d')]['where']||null:null})[_0x0123('0x10')](function(_0x329e11){if(_0x329e11){return _0x329e11[_0x0123('0x21')](_0x43fecc[_0x0123('0x22')][_0x0123('0x23')],_['omit'](_0x43fecc[_0x0123('0x22')],[_0x0123('0x23'),'id'])||{});}})[_0x0123('0x24')](function(_0x54fbfb){logger[_0x0123('0x11')]('AddTags',_0x43fecc);logger[_0x0123('0x14')]('AddTags',_0x43fecc,JSON[_0x0123('0x15')](_0x54fbfb));_0x3af059(_0x54fbfb);})[_0x0123('0x19')](function(_0x3ec612){logger[_0x0123('0x16')]('AddTags',_0x3ec612['message'],_0x43fecc);_0x473a0b(_this[_0x0123('0x16')](0x1f4,_0x3ec612[_0x0123('0x17')]));});});}; \ No newline at end of file +var _0x21d4=['limit','AddTagsToChatInteraction','addTags','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateChatInteraction','ChatInteraction','body','options','where','attributes'];(function(_0x112e02,_0x4bb03b){var _0x1c7a53=function(_0x501695){while(--_0x501695){_0x112e02['push'](_0x112e02['shift']());}};_0x1c7a53(++_0x4bb03b);}(_0x21d4,0x167));var _0x421d=function(_0x177a0b,_0x58d655){_0x177a0b=_0x177a0b-0x0;var _0x11af52=_0x21d4[_0x177a0b];return _0x11af52;};'use strict';var _=require(_0x421d('0x0'));var util=require('util');var moment=require(_0x421d('0x1'));var BPromise=require(_0x421d('0x2'));var rs=require(_0x421d('0x3'));var fs=require('fs');var Redis=require(_0x421d('0x4'));var db=require(_0x421d('0x5'))['db'];var utils=require(_0x421d('0x6'));var logger=require(_0x421d('0x7'))(_0x421d('0x8'));var config=require(_0x421d('0x9'));var jayson=require(_0x421d('0xa'));var client=jayson['client'][_0x421d('0xb')]({'port':0x232a});config['redis']=_[_0x421d('0xc')](config[_0x421d('0xd')],{'host':_0x421d('0xe'),'port':0x18eb});var socket=require(_0x421d('0xf'))(new Redis(config['redis']));require(_0x421d('0x10'))[_0x421d('0x11')](socket);function respondWithRpcPromise(_0x5579cb,_0x5df71c,_0x3f5f41){return new BPromise(function(_0x9b85c3,_0x56669f){return client[_0x421d('0x12')](_0x5579cb,_0x3f5f41)[_0x421d('0x13')](function(_0xe2e1c7){logger['info'](_0x421d('0x14'),_0x5df71c,_0x421d('0x15'));logger[_0x421d('0x16')](_0x421d('0x17'),_0x5df71c,_0x421d('0x15'),JSON[_0x421d('0x18')](_0xe2e1c7));if(_0xe2e1c7[_0x421d('0x19')]){if(_0xe2e1c7[_0x421d('0x19')][_0x421d('0x1a')]===0x1f4){logger[_0x421d('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x5df71c,_0xe2e1c7['error'][_0x421d('0x1b')]);return _0x56669f(_0xe2e1c7[_0x421d('0x19')][_0x421d('0x1b')]);}logger[_0x421d('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x5df71c,_0xe2e1c7[_0x421d('0x19')]['message']);return _0x9b85c3(_0xe2e1c7['error'][_0x421d('0x1b')]);}else{logger[_0x421d('0x1c')](_0x421d('0x14'),_0x5df71c,_0x421d('0x15'));_0x9b85c3(_0xe2e1c7[_0x421d('0x1d')][_0x421d('0x1b')]);}})[_0x421d('0x1e')](function(_0x10abf2){logger['error'](_0x421d('0x14'),_0x5df71c,_0x10abf2);_0x56669f(_0x10abf2);});});}exports[_0x421d('0x1f')]=function(_0x48a9ba){var _0x564937=this;return new Promise(function(_0x38de77,_0x293376){return db[_0x421d('0x20')]['update'](_0x48a9ba[_0x421d('0x21')],{'raw':_0x48a9ba[_0x421d('0x22')]?_0x48a9ba[_0x421d('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48a9ba[_0x421d('0x22')]?_0x48a9ba[_0x421d('0x22')][_0x421d('0x23')]||null:null,'attributes':_0x48a9ba['options']?_0x48a9ba[_0x421d('0x22')][_0x421d('0x24')]||null:null,'limit':_0x48a9ba[_0x421d('0x22')]?_0x48a9ba[_0x421d('0x22')][_0x421d('0x25')]||null:null})[_0x421d('0x13')](function(_0x4fcca0){logger['info'](_0x421d('0x1f'),_0x48a9ba);logger['debug'](_0x421d('0x1f'),_0x48a9ba,JSON[_0x421d('0x18')](_0x4fcca0));_0x38de77(_0x4fcca0);})[_0x421d('0x1e')](function(_0x80f4c2){logger[_0x421d('0x19')](_0x421d('0x1f'),_0x80f4c2[_0x421d('0x1b')],_0x48a9ba);_0x293376(_0x564937[_0x421d('0x19')](0x1f4,_0x80f4c2[_0x421d('0x1b')]));});});};exports[_0x421d('0x26')]=function(_0x139eff){return new Promise(function(_0x3a8ea3,_0x56b8a2){return db[_0x421d('0x20')]['find']({'where':_0x139eff['options']?_0x139eff[_0x421d('0x22')]['where']||null:null})['then'](function(_0x27d847){if(_0x27d847){return _0x27d847[_0x421d('0x27')](_0x139eff[_0x421d('0x21')][_0x421d('0x28')],_[_0x421d('0x29')](_0x139eff['body'],['ids','id'])||{});}})[_0x421d('0x2a')](function(_0x2d1c86){logger['info'](_0x421d('0x2b'),_0x139eff);logger[_0x421d('0x16')](_0x421d('0x2b'),_0x139eff,JSON[_0x421d('0x18')](_0x2d1c86));_0x3a8ea3(_0x2d1c86);})[_0x421d('0x1e')](function(_0xb40433){logger[_0x421d('0x19')](_0x421d('0x2b'),_0xb40433['message'],_0x139eff);_0x56b8a2(_this[_0x421d('0x19')](0x1f4,_0xb40433[_0x421d('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 7524a4f..dc3333f 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 _0x4398=['register','length','chatInteraction:','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x43cb78,_0x43b90d){var _0x3a05ae=function(_0x4440dc){while(--_0x4440dc){_0x43cb78['push'](_0x43cb78['shift']());}};_0x3a05ae(++_0x43b90d);}(_0x4398,0x14b));var _0x8439=function(_0x1a3572,_0x5b7ce7){_0x1a3572=_0x1a3572-0x0;var _0x1a2d35=_0x4398[_0x1a3572];return _0x1a2d35;};'use strict';var ChatInteractionEvents=require(_0x8439('0x0'));var events=['save',_0x8439('0x1'),_0x8439('0x2')];function createListener(_0x1df4bc,_0x40259e){return function(_0x3ae374){_0x40259e[_0x8439('0x3')](_0x1df4bc,_0x3ae374);};}function removeListener(_0x165866,_0x349e1a){return function(){ChatInteractionEvents[_0x8439('0x4')](_0x165866,_0x349e1a);};}exports[_0x8439('0x5')]=function(_0x1eb765){for(var _0x19345b=0x0,_0x1a24f2=events[_0x8439('0x6')];_0x19345b<_0x1a24f2;_0x19345b++){var _0x509809=events[_0x19345b];var _0x1e5fba=createListener(_0x8439('0x7')+_0x509809,_0x1eb765);ChatInteractionEvents['on'](_0x509809,_0x1e5fba);}}; \ No newline at end of file +var _0x1a82=['register','chatInteraction:','update','emit','removeListener'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x1a82,0x16a));var _0x21a8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x1a82[_0x2c91e9];return _0x13f0ff;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=['save','remove',_0x21a8('0x0')];function createListener(_0x3dcef5,_0x149262){return function(_0x2c9956){_0x149262[_0x21a8('0x1')](_0x3dcef5,_0x2c9956);};}function removeListener(_0x18944a,_0x292550){return function(){ChatInteractionEvents[_0x21a8('0x2')](_0x18944a,_0x292550);};}exports[_0x21a8('0x3')]=function(_0x55f380){for(var _0x22ba1a=0x0,_0x3895dd=events['length'];_0x22ba1a<_0x3895dd;_0x22ba1a++){var _0x350898=events[_0x22ba1a];var _0x133b8e=createListener(_0x21a8('0x4')+_0x350898,_0x55f380);ChatInteractionEvents['on'](_0x350898,_0x133b8e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 2534613..4da0c27 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 _0x9ac6=['/:id/tags','tracked','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','get','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload'];(function(_0x551336,_0x298cbe){var _0x304c3a=function(_0x324c4d){while(--_0x324c4d){_0x551336['push'](_0x551336['shift']());}};_0x304c3a(++_0x298cbe);}(_0x9ac6,0xe7));var _0x69ac=function(_0x2ae93a,_0x4e9ea9){_0x2ae93a=_0x2ae93a-0x0;var _0x2e5ac0=_0x9ac6[_0x2ae93a];return _0x2e5ac0;};'use strict';var multer=require(_0x69ac('0x0'));var util=require(_0x69ac('0x1'));var path=require('path');var timeout=require(_0x69ac('0x2'));var express=require(_0x69ac('0x3'));var router=express[_0x69ac('0x4')]();var fs_extra=require(_0x69ac('0x5'));var auth=require(_0x69ac('0x6'));var interaction=require(_0x69ac('0x7'));var config=require(_0x69ac('0x8'));var controller=require(_0x69ac('0x9'));router['get']('/',auth[_0x69ac('0xa')](),controller[_0x69ac('0xb')]);router['get'](_0x69ac('0xc'),auth[_0x69ac('0xa')](),controller['describe']);router[_0x69ac('0xd')](_0x69ac('0xe'),auth[_0x69ac('0xf')](),controller['show']);router[_0x69ac('0xd')](_0x69ac('0x10'),auth[_0x69ac('0xf')](),controller[_0x69ac('0x11')]);router[_0x69ac('0xd')](_0x69ac('0x12'),auth['isAuthenticated'](),controller[_0x69ac('0x13')]);router[_0x69ac('0xd')](_0x69ac('0x14'),auth[_0x69ac('0xf')](),controller[_0x69ac('0x15')]);router[_0x69ac('0xd')]('/:id/download',auth['isAuthenticated'](),controller[_0x69ac('0x16')]);router[_0x69ac('0x17')]('/',auth['isAuthenticated'](),controller[_0x69ac('0x18')]);router[_0x69ac('0x17')](_0x69ac('0x19'),auth[_0x69ac('0xa')](),controller[_0x69ac('0x1a')]);var upload=multer({'storage':multer[_0x69ac('0x1b')]({'destination':function(_0x5ebc8e,_0x1d3cd7,_0x12f475){_0x12f475(null,path[_0x69ac('0x1c')](config[_0x69ac('0x1d')],_0x69ac('0x1e')));},'filename':function(_0x39f424,_0x2c9afb,_0x272aa0){_0x272aa0(null,util[_0x69ac('0x1f')](_0x69ac('0x20'),Date[_0x69ac('0x21')](),_0x2c9afb[_0x69ac('0x22')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x69ac('0x17')](_0x69ac('0x23'),upload[_0x69ac('0x24')](_0x69ac('0x25')),controller[_0x69ac('0x26')]);router[_0x69ac('0x17')](_0x69ac('0x12'),auth[_0x69ac('0xf')](),controller['addMessage']);router[_0x69ac('0x17')](_0x69ac('0x27'),auth[_0x69ac('0xa')](),interaction[_0x69ac('0x28')](_0x69ac('0x29'),'chatinteraction:addtags'),controller['addTags']);router['put'](_0x69ac('0xe'),auth[_0x69ac('0xa')](),interaction[_0x69ac('0x28')](_0x69ac('0x29'),_0x69ac('0x2a')),controller[_0x69ac('0x2b')]);router[_0x69ac('0x2c')]('/:id/custom_update',controller[_0x69ac('0x2d')]);router['put'](_0x69ac('0x2e'),auth[_0x69ac('0xf')](),controller['abandon']);router[_0x69ac('0x2c')](_0x69ac('0x2f'),controller[_0x69ac('0x30')]);router[_0x69ac('0x31')](_0x69ac('0xe'),auth[_0x69ac('0xa')](),interaction[_0x69ac('0x28')](_0x69ac('0x29'),_0x69ac('0x32')),controller[_0x69ac('0x33')]);router[_0x69ac('0x31')]('/:id/tags',auth[_0x69ac('0xa')](),controller[_0x69ac('0x34')]);module[_0x69ac('0x35')]=router; \ No newline at end of file +var _0xe44d=['update','customUpdate','put','/:id/abandon','/:id/close','close','chatinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','post','diskStorage','join','root','server/files/attachments/','%s-%s','now','originalname','replace','single','file','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','chatinteraction:update'];(function(_0x295a7f,_0x240017){var _0x25c438=function(_0x38a9d7){while(--_0x38a9d7){_0x295a7f['push'](_0x295a7f['shift']());}};_0x25c438(++_0x240017);}(_0xe44d,0x13d));var _0xde44=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xe44d[_0x1deb03];return _0x189fe7;};'use strict';var multer=require(_0xde44('0x0'));var util=require(_0xde44('0x1'));var path=require('path');var timeout=require(_0xde44('0x2'));var express=require(_0xde44('0x3'));var router=express['Router']();var fs_extra=require(_0xde44('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xde44('0x5'));var config=require('../../config/environment');var controller=require(_0xde44('0x6'));router[_0xde44('0x7')]('/',auth[_0xde44('0x8')](),controller[_0xde44('0x9')]);router[_0xde44('0x7')](_0xde44('0xa'),auth[_0xde44('0x8')](),controller[_0xde44('0xb')]);router[_0xde44('0x7')](_0xde44('0xc'),auth[_0xde44('0xd')](),controller[_0xde44('0xe')]);router[_0xde44('0x7')](_0xde44('0xf'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0xde44('0x7')](_0xde44('0x10'),auth[_0xde44('0x8')](),controller[_0xde44('0x11')]);router['get'](_0xde44('0x12'),auth[_0xde44('0xd')](),controller[_0xde44('0x13')]);router[_0xde44('0x7')](_0xde44('0x14'),auth[_0xde44('0x8')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xde44('0x15')]);router[_0xde44('0x16')]('/:id/vidaoo',auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xde44('0x17')]({'destination':function(_0x5e3369,_0x53524c,_0x5921f4){_0x5921f4(null,path[_0xde44('0x18')](config[_0xde44('0x19')],_0xde44('0x1a')));},'filename':function(_0x5a08de,_0x307c2e,_0x436b28){_0x436b28(null,util['format'](_0xde44('0x1b'),Date[_0xde44('0x1c')](),_0x307c2e[_0xde44('0x1d')][_0xde44('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0xde44('0x1f')](_0xde44('0x20')),controller['attachmentUpload']);router[_0xde44('0x16')](_0xde44('0x10'),auth[_0xde44('0xd')](),controller[_0xde44('0x21')]);router[_0xde44('0x16')](_0xde44('0x22'),auth[_0xde44('0x8')](),interaction[_0xde44('0x23')](_0xde44('0x24'),_0xde44('0x25')),controller[_0xde44('0x26')]);router['put']('/:id',auth[_0xde44('0x8')](),interaction['tracked']('chat',_0xde44('0x27')),controller[_0xde44('0x28')]);router['put']('/:id/custom_update',controller[_0xde44('0x29')]);router[_0xde44('0x2a')](_0xde44('0x2b'),auth[_0xde44('0xd')](),controller['abandon']);router[_0xde44('0x2a')](_0xde44('0x2c'),controller[_0xde44('0x2d')]);router['delete'](_0xde44('0xc'),auth[_0xde44('0x8')](),interaction['tracked']('chat',_0xde44('0x2e')),controller[_0xde44('0x2f')]);router[_0xde44('0x30')]('/:id/tags',auth['isAuthenticated'](),controller[_0xde44('0x31')]);module[_0xde44('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5b6592d..8e5e19b 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 _0x5ffc=['medium','INTEGER','sequelize','exports','TEXT'];(function(_0x394688,_0x7942f0){var _0x311dad=function(_0x334dd6){while(--_0x334dd6){_0x394688['push'](_0x394688['shift']());}};_0x311dad(++_0x7942f0);}(_0x5ffc,0x16a));var _0xc5ff=function(_0x4227f7,_0x5e2633){_0x4227f7=_0x4227f7-0x0;var _0x4d394e=_0x5ffc[_0x4227f7];return _0x4d394e;};'use strict';var Sequelize=require(_0xc5ff('0x0'));module[_0xc5ff('0x1')]={'body':{'type':Sequelize[_0xc5ff('0x2')](_0xc5ff('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc5ff('0x4')]}}; \ No newline at end of file +var _0x6d0a=['sequelize','exports','TEXT','INTEGER'];(function(_0x139745,_0x503124){var _0x2cd695=function(_0x2ab1ba){while(--_0x2ab1ba){_0x139745['push'](_0x139745['shift']());}};_0x2cd695(++_0x503124);}(_0x6d0a,0x1cc));var _0xa6d0=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x6d0a[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0xa6d0('0x0'));module[_0xa6d0('0x1')]={'body':{'type':Sequelize[_0xa6d0('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xa6d0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index db035ed..990bf73 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 _0x1154=['./chatInternalMessage.socket','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','sendStatus','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','pick','filter','merge','where','includeAll','include','findAll','catch','params','find','create','body','describe','get','messages','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','sort','-online','VoiceQueue','VoiceQueues','user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','createdAt','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis'];(function(_0x1aada2,_0x36f5cc){var _0x5d8ae3=function(_0x396f6f){while(--_0x396f6f){_0x1aada2['push'](_0x1aada2['shift']());}};_0x5d8ae3(++_0x36f5cc);}(_0x1154,0x1f0));var _0x4115=function(_0x110633,_0x1d8099){_0x110633=_0x110633-0x0;var _0x5d4b68=_0x1154[_0x110633];return _0x5d4b68;};'use strict';var emlformat=require(_0x4115('0x0'));var rimraf=require(_0x4115('0x1'));var zipdir=require(_0x4115('0x2'));var jsonpatch=require(_0x4115('0x3'));var rp=require(_0x4115('0x4'));var moment=require(_0x4115('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4115('0x6'));var util=require(_0x4115('0x7'));var path=require('path');var sox=require(_0x4115('0x8'));var csv=require(_0x4115('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4115('0xa'));var _=require('lodash');var squel=require(_0x4115('0xb'));var crypto=require(_0x4115('0xc'));var jsforce=require(_0x4115('0xd'));var deskjs=require(_0x4115('0xe'));var toCsv=require(_0x4115('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4115('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4115('0x10'));var as=require(_0x4115('0x11'));var hardwareService=require(_0x4115('0x12'));var logger=require(_0x4115('0x13'))(_0x4115('0x14'));var utils=require('../../config/utils');var config=require(_0x4115('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4115('0x16'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4115('0x17')]));require(_0x4115('0x18'))['register'](socket);function respondWithStatusCode(_0x1492c0,_0x2e2780){_0x2e2780=_0x2e2780||0xcc;return function(_0x49333d){if(_0x49333d){return _0x1492c0['sendStatus'](_0x2e2780);}return _0x1492c0[_0x4115('0x19')](_0x2e2780)[_0x4115('0x1a')]();};}function respondWithResult(_0x50a398,_0x12564b){_0x12564b=_0x12564b||0xc8;return function(_0x3060d0){if(_0x3060d0){return _0x50a398['status'](_0x12564b)[_0x4115('0x1b')](_0x3060d0);}};}function respondWithFilteredResult(_0x3aaa79,_0x176d5f){return function(_0x1de6d8){if(_0x1de6d8){var _0x2f41f0=typeof _0x176d5f[_0x4115('0x1c')]===_0x4115('0x1d')&&typeof _0x176d5f['limit']==='undefined';var _0x19fade=_0x1de6d8[_0x4115('0x1e')];var _0x2d557a=_0x2f41f0?0x0:_0x176d5f[_0x4115('0x1c')];var _0x5a308a=_0x2f41f0?_0x1de6d8[_0x4115('0x1e')]:_0x176d5f['offset']+_0x176d5f[_0x4115('0x1f')];var _0x321502;if(_0x5a308a>=_0x19fade){_0x5a308a=_0x19fade;_0x321502=0xc8;}else{_0x321502=0xce;}_0x3aaa79['status'](_0x321502);return _0x3aaa79[_0x4115('0x20')](_0x4115('0x21'),_0x2d557a+'-'+_0x5a308a+'/'+_0x19fade)[_0x4115('0x1b')](_0x1de6d8);}return null;};}function patchUpdates(_0x55df09){return function(_0x53d798){try{jsonpatch[_0x4115('0x22')](_0x53d798,_0x55df09,!![]);}catch(_0x352f8f){return BPromise[_0x4115('0x23')](_0x352f8f);}return _0x53d798[_0x4115('0x24')]();};}function saveUpdates(_0x2a36af,_0x2585e9){return function(_0x1de6de){if(_0x1de6de){return _0x1de6de['update'](_0x2a36af)[_0x4115('0x25')](function(_0x1fa878){return _0x1fa878;});}return null;};}function removeEntity(_0xba0de,_0xd4b5db){return function(_0x5d3283){if(_0x5d3283){return _0x5d3283[_0x4115('0x26')]()[_0x4115('0x25')](function(){_0xba0de[_0x4115('0x19')](0xcc)[_0x4115('0x1a')]();});}};}function handleEntityNotFound(_0x4bdf6e,_0x16f772){return function(_0x5842a4){if(!_0x5842a4){_0x4bdf6e[_0x4115('0x27')](0x194);}return _0x5842a4;};}function handleError(_0x255614,_0x4f262d){_0x4f262d=_0x4f262d||0x1f4;return function(_0x532f3d){logger['error'](_0x532f3d['stack']);if(_0x532f3d['name']){delete _0x532f3d[_0x4115('0x28')];}_0x255614[_0x4115('0x19')](_0x4f262d)[_0x4115('0x29')](_0x532f3d);};}exports[_0x4115('0x2a')]=function(_0x45408a,_0x4e7620){var _0x2c745a={},_0x22bcd1={},_0x2f10bd={'count':0x0,'rows':[]};var _0x51734f=_['map'](db[_0x4115('0x2b')][_0x4115('0x2c')],function(_0x18bed0){return{'name':_0x18bed0[_0x4115('0x2d')],'type':_0x18bed0[_0x4115('0x2e')][_0x4115('0x2f')]};});_0x22bcd1[_0x4115('0x30')]=_[_0x4115('0x31')](_0x51734f,_0x4115('0x28'));_0x22bcd1[_0x4115('0x32')]=_[_0x4115('0x33')](_0x45408a[_0x4115('0x32')]);_0x22bcd1[_0x4115('0x34')]=_[_0x4115('0x35')](_0x22bcd1[_0x4115('0x30')],_0x22bcd1['query']);_0x2c745a[_0x4115('0x36')]=_[_0x4115('0x35')](_0x22bcd1[_0x4115('0x30')],qs[_0x4115('0x37')](_0x45408a[_0x4115('0x32')]['fields']));_0x2c745a[_0x4115('0x36')]=_0x2c745a[_0x4115('0x36')][_0x4115('0x38')]?_0x2c745a[_0x4115('0x36')]:_0x22bcd1[_0x4115('0x30')];if(!_0x45408a[_0x4115('0x32')][_0x4115('0x39')]('nolimit')){_0x2c745a[_0x4115('0x1f')]=qs[_0x4115('0x1f')](_0x45408a[_0x4115('0x32')][_0x4115('0x1f')]);_0x2c745a['offset']=qs[_0x4115('0x1c')](_0x45408a[_0x4115('0x32')][_0x4115('0x1c')]);}_0x2c745a['order']=qs['sort'](_0x45408a[_0x4115('0x32')]['sort']);_0x2c745a['where']=qs[_0x4115('0x34')](_[_0x4115('0x3a')](_0x45408a['query'],_0x22bcd1['filters']),_0x51734f);if(_0x45408a[_0x4115('0x32')][_0x4115('0x3b')]){_0x2c745a['where']=_[_0x4115('0x3c')](_0x2c745a['where'],{'$or':_['map'](_0x51734f,function(_0x1b2c53){if(_0x1b2c53[_0x4115('0x2e')]!=='VIRTUAL'){var _0x1659e8={};_0x1659e8[_0x1b2c53[_0x4115('0x28')]]={'$like':'%'+_0x45408a[_0x4115('0x32')][_0x4115('0x3b')]+'%'};return _0x1659e8;}})});}_0x2c745a=_[_0x4115('0x3c')]({},_0x2c745a,_0x45408a['options']);var _0x5c7a69={'where':_0x2c745a[_0x4115('0x3d')]};return db['ChatInternalMessage']['count'](_0x5c7a69)[_0x4115('0x25')](function(_0x4912f9){_0x2f10bd[_0x4115('0x1e')]=_0x4912f9;if(_0x45408a[_0x4115('0x32')][_0x4115('0x3e')]){_0x2c745a[_0x4115('0x3f')]=[{'all':!![]}];}return db[_0x4115('0x2b')][_0x4115('0x40')](_0x2c745a);})['then'](function(_0x263216){_0x2f10bd['rows']=_0x263216;return _0x2f10bd;})[_0x4115('0x25')](respondWithFilteredResult(_0x4e7620,_0x2c745a))[_0x4115('0x41')](handleError(_0x4e7620,null));};exports['show']=function(_0x4fa2e0,_0x1c87ca){var _0x1813f2={'raw':!![],'where':{'id':_0x4fa2e0[_0x4115('0x42')]['id']}},_0xbe5ae6={};_0xbe5ae6['model']=_[_0x4115('0x33')](db[_0x4115('0x2b')][_0x4115('0x2c')]);_0xbe5ae6[_0x4115('0x32')]=_[_0x4115('0x33')](_0x4fa2e0[_0x4115('0x32')]);_0xbe5ae6[_0x4115('0x34')]=_['intersection'](_0xbe5ae6[_0x4115('0x30')],_0xbe5ae6['query']);_0x1813f2[_0x4115('0x36')]=_['intersection'](_0xbe5ae6[_0x4115('0x30')],qs[_0x4115('0x37')](_0x4fa2e0[_0x4115('0x32')]['fields']));_0x1813f2[_0x4115('0x36')]=_0x1813f2[_0x4115('0x36')][_0x4115('0x38')]?_0x1813f2[_0x4115('0x36')]:_0xbe5ae6['model'];if(_0x4fa2e0[_0x4115('0x32')][_0x4115('0x3e')]){_0x1813f2[_0x4115('0x3f')]=[{'all':!![]}];}_0x1813f2=_[_0x4115('0x3c')]({},_0x1813f2,_0x4fa2e0['options']);return db['ChatInternalMessage'][_0x4115('0x43')](_0x1813f2)[_0x4115('0x25')](handleEntityNotFound(_0x1c87ca,null))[_0x4115('0x25')](respondWithResult(_0x1c87ca,null))['catch'](handleError(_0x1c87ca,null));};exports[_0x4115('0x44')]=function(_0x51641d,_0x22209a){return db[_0x4115('0x2b')][_0x4115('0x44')](_0x51641d['body'],{})['then'](respondWithResult(_0x22209a,0xc9))[_0x4115('0x41')](handleError(_0x22209a,null));};exports['update']=function(_0x2a5dcd,_0x14be56){if(_0x2a5dcd[_0x4115('0x45')]['id']){delete _0x2a5dcd[_0x4115('0x45')]['id'];}return db[_0x4115('0x2b')][_0x4115('0x43')]({'where':{'id':_0x2a5dcd[_0x4115('0x42')]['id']}})[_0x4115('0x25')](handleEntityNotFound(_0x14be56,null))[_0x4115('0x25')](saveUpdates(_0x2a5dcd['body'],null))[_0x4115('0x25')](respondWithResult(_0x14be56,null))['catch'](handleError(_0x14be56,null));};exports[_0x4115('0x26')]=function(_0x59be34,_0xb52c9){return db[_0x4115('0x2b')][_0x4115('0x43')]({'where':{'id':_0x59be34[_0x4115('0x42')]['id']}})[_0x4115('0x25')](handleEntityNotFound(_0xb52c9,null))[_0x4115('0x25')](removeEntity(_0xb52c9,null))[_0x4115('0x41')](handleError(_0xb52c9,null));};exports[_0x4115('0x46')]=function(_0x19cdd0,_0x3b961a){return db[_0x4115('0x2b')]['describe']()[_0x4115('0x25')](respondWithResult(_0x3b961a,null))[_0x4115('0x41')](handleError(_0x3b961a,null));};function wrapUser(_0x35702e){return function(_0x468123){var _0x2115c6=_0x35702e[_0x4115('0x47')]({'plain':!![]});_0x2115c6[_0x4115('0x48')]=[];if(_0x468123){_0x2115c6['lastMessageAt']=_0x468123['createdAt'];_0x2115c6[_0x4115('0x49')]=_0x468123;}else{_0x2115c6[_0x4115('0x4a')]=moment(0x0)[_0x4115('0x4b')](_0x4115('0x4c'));_0x2115c6[_0x4115('0x49')]={};}return _0x2115c6;};}exports[_0x4115('0x4d')]=function(_0x401628,_0x3ab913,_0x107aed){var _0x564065=[];return db[_0x4115('0x4e')]['findAll']({'where':{'role':[_0x4115('0x4f'),'admin','user']},'attributes':['id',_0x4115('0x50'),_0x4115('0x28'),_0x4115('0x51'),_0x4115('0x52'),_0x4115('0x53'),_0x4115('0x54'),_0x4115('0x55'),_0x4115('0x56'),_0x4115('0x57')],'order':qs[_0x4115('0x58')](_0x4115('0x59')),'include':[{'model':db[_0x4115('0x5a')],'as':_0x4115('0x5b'),'attributes':['id',_0x4115('0x28'),_0x4115('0x2e')],'through':{'attributes':[]}}]})['then'](function(_0x18c011){if(_0x18c011){var _0x477fd5=_0x401628[_0x4115('0x5c')][_0x4115('0x47')]({'plain':!![]});if(!_0x477fd5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x477fd5[_0x4115('0x51')]===_0x4115('0x5c')){return db[_0x4115('0x5d')][_0x4115('0x43')]({'where':{'name':_0x4115('0x5e'),'userProfileId':_0x477fd5[_0x4115('0x5f')]},'raw':!![]})['then'](function(_0x925fd6){if(_0x925fd6){if(_0x925fd6[_0x4115('0x60')]===0x0){return db[_0x4115('0x61')]['findAll']({'where':{'sectionId':_0x925fd6['id']},'raw':!![]})['then'](function(_0x589e5c){var _0x366e10=[];if(_['isEmpty'](_0x589e5c)){_0x366e10=_[_0x4115('0x3b')](_0x18c011,function(_0xede7e3){if(_0xede7e3['role']!=='agent'){return _0xede7e3;}});return _0x366e10;}else{for(var _0x2e3ee0=0x0;_0x2e3ee0<_0x18c011[_0x4115('0x38')];_0x2e3ee0++){var _0x2e8fd4=_0x18c011[_0x2e3ee0];if(_0x2e8fd4[_0x4115('0x51')]===_0x4115('0x4f')){var _0x502aad=_['find'](_0x589e5c,function(_0x4bbb15){return _0x4bbb15[_0x4115('0x62')]===_0x2e8fd4['id'];});if(_0x502aad)_0x366e10['push'](_0x2e8fd4);}else{_0x366e10[_0x4115('0x63')](_0x2e8fd4);}}return _0x366e10;}});}else{return _0x18c011;}}else{var _0x48da19=_[_0x4115('0x3b')](_0x18c011,function(_0x11ee4b){if(_0x11ee4b[_0x4115('0x51')]!==_0x4115('0x4f')){return _0x11ee4b;}});return _0x48da19;}});}else{return _0x18c011;}}})[_0x4115('0x25')](function(_0x3ba47a){var _0x4699af=[];if(_0x3ba47a){_0x564065=_0x3ba47a;for(var _0x459bd6=0x0;_0x459bd6<_0x3ba47a[_0x4115('0x38')];_0x459bd6+=0x1){_0x564065[_0x459bd6]['messages']=[];_0x4699af['push'](db['ChatInternalMessage'][_0x4115('0x43')]({'where':{'FromId':[_0x401628[_0x4115('0x5c')]['id'],_0x3ba47a[_0x459bd6]['id']],'ToId':[_0x401628[_0x4115('0x5c')]['id'],_0x3ba47a[_0x459bd6]['id']],'ChatGroupId':null},'attributes':['id',_0x4115('0x64'),'FromId','ToId',_0x4115('0x65'),_0x4115('0x45')],'order':qs[_0x4115('0x58')](_0x4115('0x66')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x4115('0x25')](wrapUser(_0x3ba47a[_0x459bd6])));}return BPromise[_0x4115('0x67')](_0x4699af);}return[];})[_0x4115('0x25')](function(_0x3e9903){return{'rows':_0x3e9903,'count':_0x3e9903[_0x4115('0x38')]};})['then'](respondWithResult(_0x3ab913,null))['catch'](handleError(_0x3ab913,null));}; \ No newline at end of file +var _0xd65d=['YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','agent','user','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','isEmpty','role','push','createdAt','FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatInternalMessage','includeAll','include','findAll','catch','show','options','find','create','body','update','params','destroy','describe','get','messages','lastMessageAt','format'];(function(_0x523cd5,_0x343c56){var _0x1c8218=function(_0x5bc5f8){while(--_0x5bc5f8){_0x523cd5['push'](_0x523cd5['shift']());}};_0x1c8218(++_0x343c56);}(_0xd65d,0xf3));var _0xdd65=function(_0x1adf3c,_0x2c56f9){_0x1adf3c=_0x1adf3c-0x0;var _0x1d0dcc=_0xd65d[_0x1adf3c];return _0x1d0dcc;};'use strict';var emlformat=require(_0xdd65('0x0'));var rimraf=require(_0xdd65('0x1'));var zipdir=require(_0xdd65('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdd65('0x3'));var moment=require('moment');var BPromise=require(_0xdd65('0x4'));var Mustache=require(_0xdd65('0x5'));var util=require(_0xdd65('0x6'));var path=require(_0xdd65('0x7'));var sox=require(_0xdd65('0x8'));var csv=require(_0xdd65('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd65('0xa'));var _=require(_0xdd65('0xb'));var squel=require('squel');var crypto=require(_0xdd65('0xc'));var jsforce=require(_0xdd65('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xdd65('0x9'));var querystring=require(_0xdd65('0xe'));var Papa=require(_0xdd65('0xf'));var Redis=require(_0xdd65('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdd65('0x11'))(_0xdd65('0x12'));var utils=require(_0xdd65('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdd65('0x14'))['db'];config[_0xdd65('0x15')]=_[_0xdd65('0x16')](config['redis'],{'host':_0xdd65('0x17'),'port':0x18eb});var socket=require(_0xdd65('0x18'))(new Redis(config['redis']));require(_0xdd65('0x19'))[_0xdd65('0x1a')](socket);function respondWithStatusCode(_0x403c45,_0x29d522){_0x29d522=_0x29d522||0xcc;return function(_0x2f31d6){if(_0x2f31d6){return _0x403c45[_0xdd65('0x1b')](_0x29d522);}return _0x403c45[_0xdd65('0x1c')](_0x29d522)[_0xdd65('0x1d')]();};}function respondWithResult(_0x1da334,_0x2bf38f){_0x2bf38f=_0x2bf38f||0xc8;return function(_0x34b8df){if(_0x34b8df){return _0x1da334[_0xdd65('0x1c')](_0x2bf38f)['json'](_0x34b8df);}};}function respondWithFilteredResult(_0x333a94,_0x431aff){return function(_0xdeeb68){if(_0xdeeb68){var _0x1c5496=typeof _0x431aff[_0xdd65('0x1e')]===_0xdd65('0x1f')&&typeof _0x431aff[_0xdd65('0x20')]===_0xdd65('0x1f');var _0x255c19=_0xdeeb68[_0xdd65('0x21')];var _0x166799=_0x1c5496?0x0:_0x431aff[_0xdd65('0x1e')];var _0x42ec23=_0x1c5496?_0xdeeb68['count']:_0x431aff[_0xdd65('0x1e')]+_0x431aff['limit'];var _0x3d9a69;if(_0x42ec23>=_0x255c19){_0x42ec23=_0x255c19;_0x3d9a69=0xc8;}else{_0x3d9a69=0xce;}_0x333a94[_0xdd65('0x1c')](_0x3d9a69);return _0x333a94[_0xdd65('0x22')](_0xdd65('0x23'),_0x166799+'-'+_0x42ec23+'/'+_0x255c19)['json'](_0xdeeb68);}return null;};}function patchUpdates(_0x2b2261){return function(_0x388c18){try{jsonpatch[_0xdd65('0x24')](_0x388c18,_0x2b2261,!![]);}catch(_0xc6d830){return BPromise[_0xdd65('0x25')](_0xc6d830);}return _0x388c18[_0xdd65('0x26')]();};}function saveUpdates(_0x39a7c2,_0x233636){return function(_0x373802){if(_0x373802){return _0x373802['update'](_0x39a7c2)[_0xdd65('0x27')](function(_0x32155a){return _0x32155a;});}return null;};}function removeEntity(_0x3f573c,_0x297e26){return function(_0x3daee3){if(_0x3daee3){return _0x3daee3['destroy']()['then'](function(){_0x3f573c[_0xdd65('0x1c')](0xcc)[_0xdd65('0x1d')]();});}};}function handleEntityNotFound(_0x7aba6,_0x2c7456){return function(_0x3ece30){if(!_0x3ece30){_0x7aba6[_0xdd65('0x1b')](0x194);}return _0x3ece30;};}function handleError(_0x5a3c76,_0x186bde){_0x186bde=_0x186bde||0x1f4;return function(_0x5e0322){logger['error'](_0x5e0322['stack']);if(_0x5e0322[_0xdd65('0x28')]){delete _0x5e0322['name'];}_0x5a3c76['status'](_0x186bde)[_0xdd65('0x29')](_0x5e0322);};}exports[_0xdd65('0x2a')]=function(_0x2691da,_0x1d1ab8){var _0x2e2089={},_0x2a796e={},_0x36056a={'count':0x0,'rows':[]};var _0xe9b438=_['map'](db['ChatInternalMessage'][_0xdd65('0x2b')],function(_0x56c9ae){return{'name':_0x56c9ae['fieldName'],'type':_0x56c9ae['type'][_0xdd65('0x2c')]};});_0x2a796e[_0xdd65('0x2d')]=_[_0xdd65('0x2e')](_0xe9b438,_0xdd65('0x28'));_0x2a796e[_0xdd65('0x2f')]=_[_0xdd65('0x30')](_0x2691da['query']);_0x2a796e[_0xdd65('0x31')]=_[_0xdd65('0x32')](_0x2a796e[_0xdd65('0x2d')],_0x2a796e[_0xdd65('0x2f')]);_0x2e2089[_0xdd65('0x33')]=_[_0xdd65('0x32')](_0x2a796e['model'],qs[_0xdd65('0x34')](_0x2691da[_0xdd65('0x2f')]['fields']));_0x2e2089[_0xdd65('0x33')]=_0x2e2089[_0xdd65('0x33')][_0xdd65('0x35')]?_0x2e2089[_0xdd65('0x33')]:_0x2a796e[_0xdd65('0x2d')];if(!_0x2691da[_0xdd65('0x2f')][_0xdd65('0x36')](_0xdd65('0x37'))){_0x2e2089[_0xdd65('0x20')]=qs[_0xdd65('0x20')](_0x2691da[_0xdd65('0x2f')][_0xdd65('0x20')]);_0x2e2089[_0xdd65('0x1e')]=qs['offset'](_0x2691da[_0xdd65('0x2f')][_0xdd65('0x1e')]);}_0x2e2089[_0xdd65('0x38')]=qs[_0xdd65('0x39')](_0x2691da[_0xdd65('0x2f')][_0xdd65('0x39')]);_0x2e2089[_0xdd65('0x3a')]=qs['filters'](_[_0xdd65('0x3b')](_0x2691da[_0xdd65('0x2f')],_0x2a796e[_0xdd65('0x31')]),_0xe9b438);if(_0x2691da[_0xdd65('0x2f')][_0xdd65('0x3c')]){_0x2e2089['where']=_[_0xdd65('0x3d')](_0x2e2089[_0xdd65('0x3a')],{'$or':_[_0xdd65('0x2e')](_0xe9b438,function(_0x466c9b){if(_0x466c9b['type']!==_0xdd65('0x3e')){var _0x5b4de2={};_0x5b4de2[_0x466c9b[_0xdd65('0x28')]]={'$like':'%'+_0x2691da[_0xdd65('0x2f')][_0xdd65('0x3c')]+'%'};return _0x5b4de2;}})});}_0x2e2089=_[_0xdd65('0x3d')]({},_0x2e2089,_0x2691da['options']);var _0x2d9c03={'where':_0x2e2089['where']};return db[_0xdd65('0x3f')][_0xdd65('0x21')](_0x2d9c03)[_0xdd65('0x27')](function(_0x138536){_0x36056a[_0xdd65('0x21')]=_0x138536;if(_0x2691da['query'][_0xdd65('0x40')]){_0x2e2089[_0xdd65('0x41')]=[{'all':!![]}];}return db[_0xdd65('0x3f')][_0xdd65('0x42')](_0x2e2089);})[_0xdd65('0x27')](function(_0x9763f5){_0x36056a['rows']=_0x9763f5;return _0x36056a;})[_0xdd65('0x27')](respondWithFilteredResult(_0x1d1ab8,_0x2e2089))[_0xdd65('0x43')](handleError(_0x1d1ab8,null));};exports[_0xdd65('0x44')]=function(_0x5000d5,_0x448666){var _0x1c454d={'raw':!![],'where':{'id':_0x5000d5['params']['id']}},_0x6d9959={};_0x6d9959[_0xdd65('0x2d')]=_[_0xdd65('0x30')](db['ChatInternalMessage'][_0xdd65('0x2b')]);_0x6d9959['query']=_['keys'](_0x5000d5[_0xdd65('0x2f')]);_0x6d9959['filters']=_[_0xdd65('0x32')](_0x6d9959[_0xdd65('0x2d')],_0x6d9959[_0xdd65('0x2f')]);_0x1c454d[_0xdd65('0x33')]=_[_0xdd65('0x32')](_0x6d9959['model'],qs[_0xdd65('0x34')](_0x5000d5[_0xdd65('0x2f')][_0xdd65('0x34')]));_0x1c454d[_0xdd65('0x33')]=_0x1c454d['attributes'][_0xdd65('0x35')]?_0x1c454d[_0xdd65('0x33')]:_0x6d9959[_0xdd65('0x2d')];if(_0x5000d5[_0xdd65('0x2f')][_0xdd65('0x40')]){_0x1c454d[_0xdd65('0x41')]=[{'all':!![]}];}_0x1c454d=_[_0xdd65('0x3d')]({},_0x1c454d,_0x5000d5[_0xdd65('0x45')]);return db['ChatInternalMessage'][_0xdd65('0x46')](_0x1c454d)['then'](handleEntityNotFound(_0x448666,null))['then'](respondWithResult(_0x448666,null))[_0xdd65('0x43')](handleError(_0x448666,null));};exports[_0xdd65('0x47')]=function(_0x46d38e,_0x418354){return db[_0xdd65('0x3f')][_0xdd65('0x47')](_0x46d38e[_0xdd65('0x48')],{})['then'](respondWithResult(_0x418354,0xc9))['catch'](handleError(_0x418354,null));};exports[_0xdd65('0x49')]=function(_0x1203b0,_0x155b5d){if(_0x1203b0[_0xdd65('0x48')]['id']){delete _0x1203b0[_0xdd65('0x48')]['id'];}return db[_0xdd65('0x3f')][_0xdd65('0x46')]({'where':{'id':_0x1203b0[_0xdd65('0x4a')]['id']}})[_0xdd65('0x27')](handleEntityNotFound(_0x155b5d,null))[_0xdd65('0x27')](saveUpdates(_0x1203b0[_0xdd65('0x48')],null))[_0xdd65('0x27')](respondWithResult(_0x155b5d,null))[_0xdd65('0x43')](handleError(_0x155b5d,null));};exports[_0xdd65('0x4b')]=function(_0x32a467,_0x54dec5){return db[_0xdd65('0x3f')][_0xdd65('0x46')]({'where':{'id':_0x32a467['params']['id']}})[_0xdd65('0x27')](handleEntityNotFound(_0x54dec5,null))[_0xdd65('0x27')](removeEntity(_0x54dec5,null))[_0xdd65('0x43')](handleError(_0x54dec5,null));};exports[_0xdd65('0x4c')]=function(_0x47b8f8,_0x1ac6a5){return db[_0xdd65('0x3f')]['describe']()[_0xdd65('0x27')](respondWithResult(_0x1ac6a5,null))[_0xdd65('0x43')](handleError(_0x1ac6a5,null));};function wrapUser(_0x455956){return function(_0x59948b){var _0x2ac9f7=_0x455956[_0xdd65('0x4d')]({'plain':!![]});_0x2ac9f7[_0xdd65('0x4e')]=[];if(_0x59948b){_0x2ac9f7[_0xdd65('0x4f')]=_0x59948b['createdAt'];_0x2ac9f7['lastMessage']=_0x59948b;}else{_0x2ac9f7[_0xdd65('0x4f')]=moment(0x0)[_0xdd65('0x50')](_0xdd65('0x51'));_0x2ac9f7[_0xdd65('0x52')]={};}return _0x2ac9f7;};}exports[_0xdd65('0x53')]=function(_0x385080,_0x55c86b,_0x3b91ee){var _0x5690c3=[];return db['User']['findAll']({'where':{'role':[_0xdd65('0x54'),'admin',_0xdd65('0x55')]},'attributes':['id','fullname',_0xdd65('0x28'),'role',_0xdd65('0x56'),_0xdd65('0x57'),'online',_0xdd65('0x58'),_0xdd65('0x59'),_0xdd65('0x5a')],'order':qs[_0xdd65('0x39')](_0xdd65('0x5b')),'include':[{'model':db[_0xdd65('0x5c')],'as':_0xdd65('0x5d'),'attributes':['id',_0xdd65('0x28'),_0xdd65('0x5e')],'through':{'attributes':[]}}]})[_0xdd65('0x27')](function(_0x44e922){if(_0x44e922){var _0x1256b1=_0x385080[_0xdd65('0x55')][_0xdd65('0x4d')]({'plain':!![]});if(!_0x1256b1)throw new Error(_0xdd65('0x5f'));if(_0x1256b1['role']===_0xdd65('0x55')){return db[_0xdd65('0x60')]['find']({'where':{'name':'Agents','userProfileId':_0x1256b1[_0xdd65('0x61')]},'raw':!![]})[_0xdd65('0x27')](function(_0x238363){if(_0x238363){if(_0x238363[_0xdd65('0x62')]===0x0){return db[_0xdd65('0x63')]['findAll']({'where':{'sectionId':_0x238363['id']},'raw':!![]})[_0xdd65('0x27')](function(_0x536f93){var _0x583b40=[];if(_[_0xdd65('0x64')](_0x536f93)){_0x583b40=_[_0xdd65('0x3c')](_0x44e922,function(_0x5a281f){if(_0x5a281f[_0xdd65('0x65')]!=='agent'){return _0x5a281f;}});return _0x583b40;}else{for(var _0xf44499=0x0;_0xf44499<_0x44e922[_0xdd65('0x35')];_0xf44499++){var _0x221543=_0x44e922[_0xf44499];if(_0x221543[_0xdd65('0x65')]===_0xdd65('0x54')){var _0x59e62=_['find'](_0x536f93,function(_0x379548){return _0x379548['resourceId']===_0x221543['id'];});if(_0x59e62)_0x583b40[_0xdd65('0x66')](_0x221543);}else{_0x583b40[_0xdd65('0x66')](_0x221543);}}return _0x583b40;}});}else{return _0x44e922;}}else{var _0x201d7a=_[_0xdd65('0x3c')](_0x44e922,function(_0x343db6){if(_0x343db6[_0xdd65('0x65')]!==_0xdd65('0x54')){return _0x343db6;}});return _0x201d7a;}});}else{return _0x44e922;}}})[_0xdd65('0x27')](function(_0x26820f){var _0x317886=[];if(_0x26820f){_0x5690c3=_0x26820f;for(var _0x15a71e=0x0;_0x15a71e<_0x26820f[_0xdd65('0x35')];_0x15a71e+=0x1){_0x5690c3[_0x15a71e]['messages']=[];_0x317886[_0xdd65('0x66')](db['ChatInternalMessage']['find']({'where':{'FromId':[_0x385080['user']['id'],_0x26820f[_0x15a71e]['id']],'ToId':[_0x385080['user']['id'],_0x26820f[_0x15a71e]['id']],'ChatGroupId':null},'attributes':['id',_0xdd65('0x67'),_0xdd65('0x68'),_0xdd65('0x69'),_0xdd65('0x6a'),_0xdd65('0x48')],'order':qs['sort'](_0xdd65('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xdd65('0x27')](wrapUser(_0x26820f[_0x15a71e])));}return BPromise['all'](_0x317886);}return[];})['then'](function(_0x3b1c13){return{'rows':_0x3b1c13,'count':_0x3b1c13['length']};})[_0xdd65('0x27')](respondWithResult(_0x55c86b,null))[_0xdd65('0x43')](handleError(_0x55c86b,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index aceea51..308372b 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 _0xa1d0=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage','save'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xa1d0,0x1a4));var _0x0a1d=function(_0x5db3b4,_0x17bc65){_0x5db3b4=_0x5db3b4-0x0;var _0x5e621e=_0xa1d0[_0x5db3b4];return _0x5e621e;};'use strict';var EventEmitter=require(_0x0a1d('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0x0a1d('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0a1d('0x2'),'afterUpdate':_0x0a1d('0x3'),'afterDestroy':_0x0a1d('0x4')};function emitEvent(_0x1203c0){return function(_0x15e254,_0x2d2b14,_0x12ea98){ChatInternalMessageEvents[_0x0a1d('0x5')](_0x1203c0+':'+_0x15e254['id'],_0x15e254);ChatInternalMessageEvents[_0x0a1d('0x5')](_0x1203c0,_0x15e254);_0x12ea98(null);};}for(var e in events){if(events[_0x0a1d('0x6')](e)){var event=events[e];ChatInternalMessage[_0x0a1d('0x7')](e,emitEvent(event));}}module[_0x0a1d('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x6558=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5b1e3b,_0x18e4cf){var _0x575cff=function(_0x1ea755){while(--_0x1ea755){_0x5b1e3b['push'](_0x5b1e3b['shift']());}};_0x575cff(++_0x18e4cf);}(_0x6558,0x153));var _0x8655=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0x6558[_0xfcbcb8];return _0x1b1f97;};'use strict';var EventEmitter=require(_0x8655('0x0'));var ChatInternalMessage=require(_0x8655('0x1'))['db'][_0x8655('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x8655('0x3')](0x0);var events={'afterCreate':_0x8655('0x4'),'afterUpdate':_0x8655('0x5'),'afterDestroy':_0x8655('0x6')};function emitEvent(_0x23da5d){return function(_0x3d38fa,_0x177c29,_0x3afaf0){ChatInternalMessageEvents[_0x8655('0x7')](_0x23da5d+':'+_0x3d38fa['id'],_0x3d38fa);ChatInternalMessageEvents['emit'](_0x23da5d,_0x3d38fa);_0x3afaf0(null);};}for(var e in events){if(events[_0x8655('0x8')](e)){var event=events[e];ChatInternalMessage[_0x8655('0x9')](e,emitEvent(event));}}module[_0x8655('0xa')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 037544f..b3d7b2b 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 _0xac51=['utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0xac51,0x1ae));var _0x1ac5=function(_0x20b4c9,_0x4126fc){_0x20b4c9=_0x20b4c9-0x0;var _0x4aba9f=_0xac51[_0x20b4c9];return _0x4aba9f;};'use strict';var _=require(_0x1ac5('0x0'));var util=require(_0x1ac5('0x1'));var logger=require(_0x1ac5('0x2'))('api');var moment=require(_0x1ac5('0x3'));var BPromise=require(_0x1ac5('0x4'));var rp=require(_0x1ac5('0x5'));var fs=require('fs');var path=require(_0x1ac5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ac5('0x7'));module[_0x1ac5('0x8')]=function(_0xf3a54a,_0x2473d3){return _0xf3a54a['define'](_0x1ac5('0x9'),attributes,{'tableName':_0x1ac5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ac5('0xb'),'collate':_0x1ac5('0xc')});}; \ No newline at end of file +var _0x4d2a=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x49dec2,_0xa82903){var _0x49e698=function(_0x31396f){while(--_0x31396f){_0x49dec2['push'](_0x49dec2['shift']());}};_0x49e698(++_0xa82903);}(_0x4d2a,0x9e));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xa4d2('0x0'));var logger=require(_0xa4d2('0x1'))(_0xa4d2('0x2'));var moment=require('moment');var BPromise=require(_0xa4d2('0x3'));var rp=require(_0xa4d2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4d2('0x5'));var config=require(_0xa4d2('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0xa4d2('0x7')]=function(_0x4ac226,_0xfda93e){return _0x4ac226['define'](_0xa4d2('0x8'),attributes,{'tableName':_0xa4d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa4d2('0xa'),'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 bf79408..45f2292 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 _0xf986=['../../mysqldb','client','http','defaults','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','ChatInternalMessage,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4cda06,_0x3cb29c){var _0x48f3fa=function(_0x21f3a6){while(--_0x21f3a6){_0x4cda06['push'](_0x4cda06['shift']());}};_0x48f3fa(++_0x3cb29c);}(_0xf986,0x163));var _0x6f98=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xf986[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6f98('0x0'));var util=require(_0x6f98('0x1'));var moment=require(_0x6f98('0x2'));var BPromise=require('bluebird');var rs=require(_0x6f98('0x3'));var fs=require('fs');var Redis=require(_0x6f98('0x4'));var db=require(_0x6f98('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6f98('0x6')][_0x6f98('0x7')]({'port':0x232a});config['redis']=_[_0x6f98('0x8')](config[_0x6f98('0x9')],{'host':_0x6f98('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f98('0x9')]));require(_0x6f98('0xb'))[_0x6f98('0xc')](socket);function respondWithRpcPromise(_0xd358bc,_0x257d98,_0x322ce7){return new BPromise(function(_0x4b84a2,_0x10e14a){return client[_0x6f98('0xd')](_0xd358bc,_0x322ce7)[_0x6f98('0xe')](function(_0xadf22a){logger[_0x6f98('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x257d98,'request\x20sent');logger['debug'](_0x6f98('0x10'),_0x257d98,_0x6f98('0x11'),JSON['stringify'](_0xadf22a));if(_0xadf22a[_0x6f98('0x12')]){if(_0xadf22a[_0x6f98('0x12')][_0x6f98('0x13')]===0x1f4){logger[_0x6f98('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x257d98,_0xadf22a[_0x6f98('0x12')][_0x6f98('0x14')]);return _0x10e14a(_0xadf22a[_0x6f98('0x12')]['message']);}logger[_0x6f98('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x257d98,_0xadf22a[_0x6f98('0x12')]['message']);return _0x4b84a2(_0xadf22a[_0x6f98('0x12')][_0x6f98('0x14')]);}else{logger[_0x6f98('0xf')](_0x6f98('0x15'),_0x257d98,_0x6f98('0x11'));_0x4b84a2(_0xadf22a[_0x6f98('0x16')][_0x6f98('0x14')]);}})[_0x6f98('0x17')](function(_0x5d23f8){logger[_0x6f98('0x12')](_0x6f98('0x15'),_0x257d98,_0x5d23f8);_0x10e14a(_0x5d23f8);});});} \ No newline at end of file +var _0x18ab=['../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','./chatInternalMessage.socket','register','request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x3d252e,_0x25ad2f){var _0x349410=function(_0x5a783d){while(--_0x5a783d){_0x3d252e['push'](_0x3d252e['shift']());}};_0x349410(++_0x25ad2f);}(_0x18ab,0xd2));var _0xb18a=function(_0x418fb3,_0x4e11d0){_0x418fb3=_0x418fb3-0x0;var _0x269eb7=_0x18ab[_0x418fb3];return _0x269eb7;};'use strict';var _=require(_0xb18a('0x0'));var util=require(_0xb18a('0x1'));var moment=require(_0xb18a('0x2'));var BPromise=require(_0xb18a('0x3'));var rs=require(_0xb18a('0x4'));var fs=require('fs');var Redis=require(_0xb18a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb18a('0x6'));var logger=require(_0xb18a('0x7'))(_0xb18a('0x8'));var config=require(_0xb18a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb18a('0xa')]['http']({'port':0x232a});config[_0xb18a('0xb')]=_[_0xb18a('0xc')](config['redis'],{'host':_0xb18a('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb18a('0xb')]));require(_0xb18a('0xe'))[_0xb18a('0xf')](socket);function respondWithRpcPromise(_0x5e02a1,_0x1eaf93,_0x2b3ccc){return new BPromise(function(_0x4a6e05,_0x2b9d7d){return client[_0xb18a('0x10')](_0x5e02a1,_0x2b3ccc)['then'](function(_0x320e54){logger[_0xb18a('0x11')](_0xb18a('0x12'),_0x1eaf93,_0xb18a('0x13'));logger[_0xb18a('0x14')](_0xb18a('0x15'),_0x1eaf93,'request\x20sent',JSON[_0xb18a('0x16')](_0x320e54));if(_0x320e54['error']){if(_0x320e54[_0xb18a('0x17')]['code']===0x1f4){logger[_0xb18a('0x17')](_0xb18a('0x12'),_0x1eaf93,_0x320e54[_0xb18a('0x17')]['message']);return _0x2b9d7d(_0x320e54[_0xb18a('0x17')][_0xb18a('0x18')]);}logger[_0xb18a('0x17')](_0xb18a('0x12'),_0x1eaf93,_0x320e54[_0xb18a('0x17')][_0xb18a('0x18')]);return _0x4a6e05(_0x320e54['error']['message']);}else{logger[_0xb18a('0x11')](_0xb18a('0x12'),_0x1eaf93,'request\x20sent');_0x4a6e05(_0x320e54[_0xb18a('0x19')][_0xb18a('0x18')]);}})[_0xb18a('0x1a')](function(_0x585d47){logger[_0xb18a('0x17')](_0xb18a('0x12'),_0x1eaf93,_0x585d47);_0x2b9d7d(_0x585d47);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 531c78e..ef43437 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 _0xb150=['save','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xb150,0xcc));var _0x0b15=function(_0x204154,_0x3351e8){_0x204154=_0x204154-0x0;var _0x3ec92f=_0xb150[_0x204154];return _0x3ec92f;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x0b15('0x0'),'remove','update'];function createListener(_0x33db53,_0x4fd903){return function(_0x337c13){_0x4fd903[_0x0b15('0x1')](_0x33db53,_0x337c13);};}function removeListener(_0x50a99f,_0x95a113){return function(){ChatInternalMessageEvents[_0x0b15('0x2')](_0x50a99f,_0x95a113);};}exports[_0x0b15('0x3')]=function(_0x1e1bfe){for(var _0x479454=0x0,_0x5d5eb5=events[_0x0b15('0x4')];_0x479454<_0x5d5eb5;_0x479454++){var _0xf4d7a=events[_0x479454];var _0x13c9da=createListener(_0x0b15('0x5')+_0xf4d7a,_0x1e1bfe);ChatInternalMessageEvents['on'](_0xf4d7a,_0x13c9da);}}; \ No newline at end of file +var _0xa0aa=['removeListener','register','save','remove','update'];(function(_0x3d0228,_0x461f95){var _0x18ab3b=function(_0x7f0d0e){while(--_0x7f0d0e){_0x3d0228['push'](_0x3d0228['shift']());}};_0x18ab3b(++_0x461f95);}(_0xa0aa,0xa7));var _0xaa0a=function(_0x299b0e,_0x1c1b20){_0x299b0e=_0x299b0e-0x0;var _0x14c063=_0xa0aa[_0x299b0e];return _0x14c063;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xaa0a('0x0'),_0xaa0a('0x1'),_0xaa0a('0x2')];function createListener(_0x548bfc,_0x5408dc){return function(_0x17e60c){_0x5408dc['emit'](_0x548bfc,_0x17e60c);};}function removeListener(_0xd97ae9,_0x2f109e){return function(){ChatInternalMessageEvents[_0xaa0a('0x3')](_0xd97ae9,_0x2f109e);};}exports[_0xaa0a('0x4')]=function(_0x4a84f8){for(var _0x2087da=0x0,_0x3c928c=events['length'];_0x2087da<_0x3c928c;_0x2087da++){var _0xec1026=events[_0x2087da];var _0x3b30ea=createListener('chatInternalMessage:'+_0xec1026,_0x4a84f8);ChatInternalMessageEvents['on'](_0xec1026,_0x3b30ea);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 85522f6..42bb7bf 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 _0xcd41=['../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','create','update','delete','destroy','exports','connect-timeout','Router'];(function(_0x1d5400,_0x567e3c){var _0x21d9fe=function(_0x23fb75){while(--_0x23fb75){_0x1d5400['push'](_0x1d5400['shift']());}};_0x21d9fe(++_0x567e3c);}(_0xcd41,0x152));var _0x1cd4=function(_0x43f9e1,_0x53cce9){_0x43f9e1=_0x43f9e1-0x0;var _0x233901=_0xcd41[_0x43f9e1];return _0x233901;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1cd4('0x0'));var express=require('express');var router=express[_0x1cd4('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x1cd4('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x1cd4('0x3'));var controller=require(_0x1cd4('0x4'));router[_0x1cd4('0x5')]('/',auth[_0x1cd4('0x6')](),controller[_0x1cd4('0x7')]);router['get'](_0x1cd4('0x8'),auth['isAuthenticated'](),controller[_0x1cd4('0x9')]);router[_0x1cd4('0x5')](_0x1cd4('0xa'),auth['isAuthenticated'](),controller[_0x1cd4('0xb')]);router[_0x1cd4('0x5')](_0x1cd4('0xc'),auth['isAuthenticated'](),controller[_0x1cd4('0xd')]);router[_0x1cd4('0xe')]('/',auth[_0x1cd4('0x6')](),controller[_0x1cd4('0xf')]);router['put'](_0x1cd4('0xc'),controller[_0x1cd4('0x10')]);router[_0x1cd4('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x1cd4('0x12')]);module[_0x1cd4('0x13')]=router; \ No newline at end of file +var _0xb7af=['put','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','describe','/users','show','post','create'];(function(_0xa7d0fe,_0x37a35d){var _0x339e3e=function(_0xe21ae1){while(--_0xe21ae1){_0xa7d0fe['push'](_0xa7d0fe['shift']());}};_0x339e3e(++_0x37a35d);}(_0xb7af,0x194));var _0xfb7a=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0xb7af[_0x246148];return _0x453d94;};'use strict';var multer=require('multer');var util=require(_0xfb7a('0x0'));var path=require(_0xfb7a('0x1'));var timeout=require(_0xfb7a('0x2'));var express=require(_0xfb7a('0x3'));var router=express[_0xfb7a('0x4')]();var fs_extra=require(_0xfb7a('0x5'));var auth=require(_0xfb7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfb7a('0x7'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth[_0xfb7a('0x8')](),controller[_0xfb7a('0x9')]);router[_0xfb7a('0xa')]('/describe',auth[_0xfb7a('0x8')](),controller[_0xfb7a('0xb')]);router['get'](_0xfb7a('0xc'),auth[_0xfb7a('0x8')](),controller['getUsers']);router[_0xfb7a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xfb7a('0xd')]);router[_0xfb7a('0xe')]('/',auth[_0xfb7a('0x8')](),controller[_0xfb7a('0xf')]);router[_0xfb7a('0x10')](_0xfb7a('0x11'),controller['update']);router[_0xfb7a('0x12')](_0xfb7a('0x11'),auth[_0xfb7a('0x8')](),controller[_0xfb7a('0x13')]);module[_0xfb7a('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 082929c..a8796d3 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 _0x065e=['ENUM','DATE','STRING','sequelize','BOOLEAN'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x065e,0x1a7));var _0xe065=function(_0x2ff90e,_0xdae85f){_0x2ff90e=_0x2ff90e-0x0;var _0x34b8cf=_0x065e[_0x2ff90e];return _0x34b8cf;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe065('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe065('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe065('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe065('0x3')]},'providerName':{'type':Sequelize[_0xe065('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xccde=['STRING','sequelize','TEXT','BOOLEAN','out','DATE'];(function(_0x14a282,_0x2aa70a){var _0x42ba90=function(_0x573e63){while(--_0x573e63){_0x14a282['push'](_0x14a282['shift']());}};_0x42ba90(++_0x2aa70a);}(_0xccde,0x1e1));var _0xeccd=function(_0x3f3f06,_0x581e5b){_0x3f3f06=_0x3f3f06-0x0;var _0x140feb=_0xccde[_0x3f3f06];return _0x140feb;};'use strict';var Sequelize=require(_0xeccd('0x0'));module['exports']={'body':{'type':Sequelize[_0xeccd('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xeccd('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xeccd('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xeccd('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xeccd('0x4')]},'providerName':{'type':Sequelize[_0xeccd('0x5')]},'providerResponse':{'type':Sequelize[_0xeccd('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 211246a..d1281cb 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 _0x5557=['create','body','params','describe','chat-interactions','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','read1stAt','interaction','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','contact','User','fullname','internal','manual','motionChannel','channel','event','accept','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','ContactId','Sequelize','SELECT','email','interface','SIP/%s','rejectmessage','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','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/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','stringify','error','message','ChatMessage,\x20%s,\x20%s','info','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','include','rows','length','includeAll','options','find'];(function(_0x403eeb,_0x396419){var _0x1b8342=function(_0xf2cef7){while(--_0xf2cef7){_0x403eeb['push'](_0x403eeb['shift']());}};_0x1b8342(++_0x396419);}(_0x5557,0x132));var _0x7555=function(_0x7818b1,_0x505da9){_0x7818b1=_0x7818b1-0x0;var _0x15e2f1=_0x5557[_0x7818b1];return _0x15e2f1;};'use strict';var emlformat=require(_0x7555('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7555('0x1'));var jsonpatch=require(_0x7555('0x2'));var rp=require(_0x7555('0x3'));var moment=require(_0x7555('0x4'));var BPromise=require(_0x7555('0x5'));var Mustache=require('mustache');var util=require(_0x7555('0x6'));var path=require('path');var sox=require(_0x7555('0x7'));var csv=require(_0x7555('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7555('0x9'));var _=require(_0x7555('0xa'));var squel=require(_0x7555('0xb'));var crypto=require(_0x7555('0xc'));var jsforce=require(_0x7555('0xd'));var deskjs=require(_0x7555('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7555('0xf'));var Papa=require(_0x7555('0x10'));var Redis=require(_0x7555('0x11'));var authService=require(_0x7555('0x12'));var qs=require(_0x7555('0x13'));var as=require(_0x7555('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7555('0x15'))('api');var utils=require(_0x7555('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7555('0x17'));var db=require(_0x7555('0x18'))['db'];config[_0x7555('0x19')]=_[_0x7555('0x1a')](config[_0x7555('0x19')],{'host':_0x7555('0x1b'),'port':0x18eb});var socket=require(_0x7555('0x1c'))(new Redis(config['redis']));require(_0x7555('0x1d'))[_0x7555('0x1e')](socket);var jayson=require(_0x7555('0x1f'));var client=jayson[_0x7555('0x20')][_0x7555('0x21')]({'port':0x232c});var client9002=jayson[_0x7555('0x20')][_0x7555('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x5b59cf,_0x26da90,_0x49d3a5,_0x154c90){return new BPromise(function(_0x58e236,_0x241984){var _0x5344e5=_0x154c90||client;return _0x5344e5[_0x7555('0x22')](_0x5b59cf,_0x49d3a5)[_0x7555('0x23')](function(_0x48742e){logger['info']('ChatMessage,\x20%s,\x20%s',_0x26da90,_0x7555('0x24'));logger[_0x7555('0x25')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x26da90,'request\x20sent',JSON[_0x7555('0x26')](_0x48742e));if(_0x48742e['error']){if(_0x48742e[_0x7555('0x27')]['code']===0x1f4){logger[_0x7555('0x27')]('ChatMessage,\x20%s,\x20%s',_0x26da90,_0x48742e[_0x7555('0x27')][_0x7555('0x28')]);return _0x241984(_0x48742e[_0x7555('0x27')][_0x7555('0x28')]);}logger[_0x7555('0x27')](_0x7555('0x29'),_0x26da90,_0x48742e[_0x7555('0x27')]['message']);return _0x58e236(_0x48742e[_0x7555('0x27')][_0x7555('0x28')]);}else{logger[_0x7555('0x2a')](_0x7555('0x29'),_0x26da90,_0x7555('0x24'));_0x58e236(_0x48742e['result']['message']);}})[_0x7555('0x2b')](function(_0x4f44a4){logger[_0x7555('0x27')](_0x7555('0x29'),_0x26da90,_0x4f44a4);_0x241984(_0x4f44a4);});});}function respondWithStatusCode(_0xc13c18,_0x11845e){_0x11845e=_0x11845e||0xcc;return function(_0x213256){if(_0x213256){return _0xc13c18[_0x7555('0x2c')](_0x11845e);}return _0xc13c18['status'](_0x11845e)[_0x7555('0x2d')]();};}function respondWithResult(_0x5ce815,_0x430e2d){_0x430e2d=_0x430e2d||0xc8;return function(_0x521fd0){if(_0x521fd0){return _0x5ce815[_0x7555('0x2e')](_0x430e2d)[_0x7555('0x2f')](_0x521fd0);}};}function respondWithFilteredResult(_0x4856d6,_0x40bca3){return function(_0x57be45){if(_0x57be45){var _0x13d396=typeof _0x40bca3[_0x7555('0x30')]===_0x7555('0x31')&&typeof _0x40bca3[_0x7555('0x32')]===_0x7555('0x31');var _0x509e26=_0x57be45[_0x7555('0x33')];var _0x2cd797=_0x13d396?0x0:_0x40bca3[_0x7555('0x30')];var _0x5115a9=_0x13d396?_0x57be45[_0x7555('0x33')]:_0x40bca3[_0x7555('0x30')]+_0x40bca3[_0x7555('0x32')];var _0x4508d8;if(_0x5115a9>=_0x509e26){_0x5115a9=_0x509e26;_0x4508d8=0xc8;}else{_0x4508d8=0xce;}_0x4856d6[_0x7555('0x2e')](_0x4508d8);return _0x4856d6[_0x7555('0x34')](_0x7555('0x35'),_0x2cd797+'-'+_0x5115a9+'/'+_0x509e26)[_0x7555('0x2f')](_0x57be45);}return null;};}function patchUpdates(_0x412eb3){return function(_0x425a87){try{jsonpatch[_0x7555('0x36')](_0x425a87,_0x412eb3,!![]);}catch(_0x99d749){return BPromise[_0x7555('0x37')](_0x99d749);}return _0x425a87['save']();};}function saveUpdates(_0x209fbb,_0x504aa8){return function(_0x332955){if(_0x332955){return _0x332955[_0x7555('0x38')](_0x209fbb)['then'](function(_0x1109a7){return _0x1109a7;});}return null;};}function removeEntity(_0x5cec44,_0x4f8df7){return function(_0x3f400d){if(_0x3f400d){return _0x3f400d[_0x7555('0x39')]()[_0x7555('0x23')](function(){_0x5cec44[_0x7555('0x2e')](0xcc)[_0x7555('0x2d')]();});}};}function handleEntityNotFound(_0x1dfb31,_0x2b1f50){return function(_0x3a3466){if(!_0x3a3466){_0x1dfb31['sendStatus'](0x194);}return _0x3a3466;};}function handleError(_0x15f860,_0x560847){_0x560847=_0x560847||0x1f4;return function(_0x4c05f0){logger[_0x7555('0x27')](_0x4c05f0[_0x7555('0x3a')]);if(_0x4c05f0[_0x7555('0x3b')]){delete _0x4c05f0[_0x7555('0x3b')];}_0x15f860[_0x7555('0x2e')](_0x560847)[_0x7555('0x3c')](_0x4c05f0);};}exports[_0x7555('0x3d')]=function(_0x289e2f,_0x2f0435){var _0x20042e={},_0x39749a={},_0x5245c8={'count':0x0,'rows':[]};var _0x178290=_[_0x7555('0x3e')](db[_0x7555('0x3f')][_0x7555('0x40')],function(_0x161b75){return{'name':_0x161b75['fieldName'],'type':_0x161b75[_0x7555('0x41')][_0x7555('0x42')]};});_0x39749a[_0x7555('0x43')]=_[_0x7555('0x3e')](_0x178290,'name');_0x39749a[_0x7555('0x44')]=_[_0x7555('0x45')](_0x289e2f[_0x7555('0x44')]);_0x39749a[_0x7555('0x46')]=_[_0x7555('0x47')](_0x39749a[_0x7555('0x43')],_0x39749a['query']);_0x20042e[_0x7555('0x48')]=_['intersection'](_0x39749a[_0x7555('0x43')],qs[_0x7555('0x49')](_0x289e2f['query'][_0x7555('0x49')]));_0x20042e[_0x7555('0x48')]=_0x20042e[_0x7555('0x48')]['length']?_0x20042e[_0x7555('0x48')]:_0x39749a[_0x7555('0x43')];if(!_0x289e2f[_0x7555('0x44')][_0x7555('0x4a')]('nolimit')){_0x20042e[_0x7555('0x32')]=qs[_0x7555('0x32')](_0x289e2f[_0x7555('0x44')][_0x7555('0x32')]);_0x20042e[_0x7555('0x30')]=qs['offset'](_0x289e2f[_0x7555('0x44')][_0x7555('0x30')]);}_0x20042e[_0x7555('0x4b')]=qs[_0x7555('0x4c')](_0x289e2f[_0x7555('0x44')]['sort']);_0x20042e[_0x7555('0x4d')]=qs[_0x7555('0x46')](_['pick'](_0x289e2f['query'],_0x39749a[_0x7555('0x46')]),_0x178290);if(_0x289e2f[_0x7555('0x44')][_0x7555('0x4e')]){_0x20042e[_0x7555('0x4d')]=_[_0x7555('0x4f')](_0x20042e['where'],{'$or':_[_0x7555('0x3e')](_0x178290,function(_0x169ab5){if(_0x169ab5[_0x7555('0x41')]!==_0x7555('0x50')){var _0x425b1d={};_0x425b1d[_0x169ab5['name']]={'$like':'%'+_0x289e2f[_0x7555('0x44')][_0x7555('0x4e')]+'%'};return _0x425b1d;}})});}_0x20042e=_[_0x7555('0x4f')]({},_0x20042e,_0x289e2f['options']);var _0x112aa4={'where':_0x20042e[_0x7555('0x4d')]};return db[_0x7555('0x3f')][_0x7555('0x33')](_0x112aa4)[_0x7555('0x23')](function(_0x25d86b){_0x5245c8[_0x7555('0x33')]=_0x25d86b;if(_0x289e2f[_0x7555('0x44')]['includeAll']){_0x20042e[_0x7555('0x51')]=[{'all':!![]}];}return db[_0x7555('0x3f')]['findAll'](_0x20042e);})[_0x7555('0x23')](function(_0x584911){_0x5245c8[_0x7555('0x52')]=_0x584911;return _0x5245c8;})[_0x7555('0x23')](respondWithFilteredResult(_0x2f0435,_0x20042e))[_0x7555('0x2b')](handleError(_0x2f0435,null));};exports['show']=function(_0x17bb90,_0x3dcdec){var _0x49f46e={'raw':!![],'where':{'id':_0x17bb90['params']['id']}},_0x181352={};_0x181352[_0x7555('0x43')]=_[_0x7555('0x45')](db[_0x7555('0x3f')][_0x7555('0x40')]);_0x181352[_0x7555('0x44')]=_[_0x7555('0x45')](_0x17bb90[_0x7555('0x44')]);_0x181352[_0x7555('0x46')]=_[_0x7555('0x47')](_0x181352[_0x7555('0x43')],_0x181352['query']);_0x49f46e[_0x7555('0x48')]=_['intersection'](_0x181352[_0x7555('0x43')],qs[_0x7555('0x49')](_0x17bb90[_0x7555('0x44')][_0x7555('0x49')]));_0x49f46e['attributes']=_0x49f46e['attributes'][_0x7555('0x53')]?_0x49f46e[_0x7555('0x48')]:_0x181352[_0x7555('0x43')];if(_0x17bb90[_0x7555('0x44')][_0x7555('0x54')]){_0x49f46e[_0x7555('0x51')]=[{'all':!![]}];}_0x49f46e=_[_0x7555('0x4f')]({},_0x49f46e,_0x17bb90[_0x7555('0x55')]);return db[_0x7555('0x3f')][_0x7555('0x56')](_0x49f46e)[_0x7555('0x23')](handleEntityNotFound(_0x3dcdec,null))[_0x7555('0x23')](respondWithResult(_0x3dcdec,null))[_0x7555('0x2b')](handleError(_0x3dcdec,null));};exports[_0x7555('0x57')]=function(_0x477e30,_0xb55642){return db[_0x7555('0x3f')][_0x7555('0x57')](_0x477e30[_0x7555('0x58')],{})[_0x7555('0x23')](respondWithResult(_0xb55642,0xc9))[_0x7555('0x2b')](handleError(_0xb55642,null));};exports['update']=function(_0x522d32,_0x1d453a){if(_0x522d32[_0x7555('0x58')]['id']){delete _0x522d32[_0x7555('0x58')]['id'];}return db[_0x7555('0x3f')][_0x7555('0x56')]({'where':{'id':_0x522d32[_0x7555('0x59')]['id']}})[_0x7555('0x23')](handleEntityNotFound(_0x1d453a,null))[_0x7555('0x23')](saveUpdates(_0x522d32[_0x7555('0x58')],null))[_0x7555('0x23')](respondWithResult(_0x1d453a,null))[_0x7555('0x2b')](handleError(_0x1d453a,null));};exports['destroy']=function(_0x321424,_0x2e8dbd){return db[_0x7555('0x3f')][_0x7555('0x56')]({'where':{'id':_0x321424[_0x7555('0x59')]['id']}})[_0x7555('0x23')](handleEntityNotFound(_0x2e8dbd,null))[_0x7555('0x23')](removeEntity(_0x2e8dbd,null))[_0x7555('0x2b')](handleError(_0x2e8dbd,null));};exports[_0x7555('0x5a')]=function(_0x36eb13,_0x2c9cca){return db[_0x7555('0x3f')]['describe']()[_0x7555('0x23')](respondWithResult(_0x2c9cca,null))[_0x7555('0x2b')](handleError(_0x2c9cca,null));};var interaction_log=require('../../config/logger')(_0x7555('0x5b'));exports['accept']=function(_0x50ebca,_0x134cad,_0x48ec52){var _0x1b2c77={'agent':{},'channel':'chat'};if(_0x50ebca[_0x7555('0x58')]['id']){delete _0x50ebca[_0x7555('0x58')]['id'];}_0x50ebca[_0x7555('0x58')][_0x7555('0x5c')]=!![];_0x50ebca[_0x7555('0x58')]['readAt']=moment()[_0x7555('0x5d')](_0x7555('0x5e'));_0x50ebca[_0x7555('0x58')]['UserId']=_0x50ebca['body'][_0x7555('0x5f')]||_0x50ebca[_0x7555('0x60')]['id'];_0x1b2c77[_0x7555('0x61')]['id']=_0x50ebca['body'][_0x7555('0x5f')];return db[_0x7555('0x3f')][_0x7555('0x56')]({'where':{'id':_0x50ebca[_0x7555('0x59')]['id'],'UserId':null}})[_0x7555('0x23')](handleEntityNotFound(_0x134cad,null))[_0x7555('0x23')](saveUpdates(_0x50ebca['body'],null))['then'](function(_0x16bc00){if(_0x16bc00){_0x1b2c77[_0x7555('0x28')]=_0x16bc00['get']({'plain':!![]});return db[_0x7555('0x62')][_0x7555('0x56')]({'where':{'id':_0x16bc00[_0x7555('0x63')]}});}return null;})[_0x7555('0x23')](handleEntityNotFound(_0x134cad,null))['then'](function(_0x198bf7){if(_0x198bf7){return _0x198bf7[_0x7555('0x38')]({'UserId':_0x50ebca[_0x7555('0x58')][_0x7555('0x5f')],'read1stAt':_['isNil'](_0x198bf7[_0x7555('0x64')])?moment()['format'](_0x7555('0x5e')):undefined});}return null;})[_0x7555('0x23')](function(_0x236a39){if(_0x236a39){_0x1b2c77[_0x7555('0x65')]=_0x236a39[_0x7555('0x66')]({'plain':!![]});interaction_log['info'](_0x7555('0x67'),_0x50ebca[_0x7555('0x60')]['id'],_0x50ebca['user']['name'],_0x50ebca[_0x7555('0x60')][_0x7555('0x68')],_0x1b2c77[_0x7555('0x65')]['id'],_0x50ebca[_0x7555('0x58')]?JSON[_0x7555('0x26')](_0x50ebca[_0x7555('0x58')]):_0x7555('0x69'));return respondWithRpcPromise('AcceptMessage',_0x7555('0x6a'),_0x1b2c77);}return null;})['then'](function(_0x4df84e){var _0x37b37b=_0x7555('0x6b')+_0x4df84e['message']['ContactId'];return db[_0x7555('0x6c')][_0x7555('0x44')](_0x37b37b,{'type':db['Sequelize'][_0x7555('0x6d')]['SELECT'],'raw':!![]})[_0x7555('0x23')](function(_0x3fa07d){return _0x3fa07d;});})[_0x7555('0x23')](function(_0xa49729){if(_0xa49729){_0x1b2c77[_0x7555('0x28')][_0x7555('0x6e')]=_0xa49729[0x0];if(!_0x50ebca[_0x7555('0x58')][_0x7555('0x5f')])return;return db[_0x7555('0x6f')][_0x7555('0x56')]({'where':{'id':_0x50ebca[_0x7555('0x58')][_0x7555('0x5f')],'role':_0x7555('0x61')},'attributes':['id','name',_0x7555('0x70'),'email',_0x7555('0x71')],'raw':!![]});}return null;})[_0x7555('0x23')](function(_0x1732e3){if(!_0x1732e3)return null;_0x1b2c77[_0x7555('0x28')][_0x7555('0x61')]=_0x1732e3;return _0x1b2c77;})['then'](function(_0x67640b){if(_0x67640b){if(_0x50ebca[_0x7555('0x58')][_0x7555('0x72')]){_0x1b2c77[_0x7555('0x28')]['interface']=util[_0x7555('0x5d')]('SIP/%s',_0x50ebca[_0x7555('0x60')]['name']);_0x1b2c77[_0x7555('0x28')]['channel']=_0x1b2c77['channel'];_0x1b2c77[_0x7555('0x28')][_0x7555('0x73')]=_0x1b2c77[_0x7555('0x74')];_0x1b2c77['message'][_0x7555('0x75')]=_0x7555('0x76');return respondWithRpcPromise(_0x7555('0x77'),_0x7555('0x77'),{'event':'acceptmessage','message':_[_0x7555('0x4f')](_0x1b2c77[_0x7555('0x28')],JSON[_0x7555('0x78')](_0x1b2c77['interaction'][_0x7555('0x79')]))},client9002)[_0x7555('0x23')](function(){return _0x1b2c77;});}return _0x1b2c77;}return null;})[_0x7555('0x23')](respondWithResult(_0x134cad,null))[_0x7555('0x2b')](handleError(_0x134cad,null));};var interaction_log=require(_0x7555('0x15'))(_0x7555('0x5b'));exports[_0x7555('0x37')]=function(_0x2f6137,_0x12b4b3,_0x52e0b9){var _0x4d74e4={'agent':{},'channel':'chat'};if(_0x2f6137[_0x7555('0x58')]['id']){delete _0x2f6137['body']['id'];}_0x2f6137[_0x7555('0x58')][_0x7555('0x5f')]=_0x2f6137[_0x7555('0x58')]['UserId']||_0x2f6137[_0x7555('0x60')]['id'];_0x4d74e4[_0x7555('0x61')]['id']=_0x2f6137['body']['UserId'];return db[_0x7555('0x3f')][_0x7555('0x56')]({'where':{'id':_0x2f6137['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12b4b3,null))[_0x7555('0x23')](function(_0x4eb997){if(_0x4eb997){_0x4d74e4[_0x7555('0x28')]=_0x4eb997[_0x7555('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x7555('0x56')]({'where':{'id':_0x4eb997[_0x7555('0x63')]}});}return null;})[_0x7555('0x23')](handleEntityNotFound(_0x12b4b3,null))[_0x7555('0x23')](function(_0x1995e0){if(_0x1995e0){_0x4d74e4['interaction']=_0x1995e0['get']({'plain':!![]});interaction_log[_0x7555('0x2a')](_0x7555('0x7a'),_0x2f6137[_0x7555('0x60')]['id'],_0x2f6137[_0x7555('0x60')][_0x7555('0x3b')],_0x2f6137[_0x7555('0x60')]['role'],_0x4d74e4['interaction']['id'],_0x2f6137[_0x7555('0x58')]?JSON[_0x7555('0x26')](_0x2f6137[_0x7555('0x58')]):_0x7555('0x69'));return respondWithRpcPromise(_0x7555('0x7b'),'rejectMessage',_0x4d74e4);}return null;})[_0x7555('0x23')](function(_0x769e6f){var _0x12bfe5=_0x7555('0x6b')+_0x769e6f[_0x7555('0x28')][_0x7555('0x7c')];return db[_0x7555('0x6c')][_0x7555('0x44')](_0x12bfe5,{'type':db[_0x7555('0x7d')][_0x7555('0x6d')][_0x7555('0x7e')],'raw':!![]})[_0x7555('0x23')](function(_0x37d6d8){return _0x37d6d8;});})[_0x7555('0x23')](function(_0x307cdc){if(_0x307cdc){_0x4d74e4['message'][_0x7555('0x6e')]=_0x307cdc[0x0];if(!_0x2f6137[_0x7555('0x58')][_0x7555('0x5f')])return;return db['User'][_0x7555('0x56')]({'where':{'id':_0x2f6137[_0x7555('0x58')][_0x7555('0x5f')],'role':'agent'},'attributes':['id','name',_0x7555('0x70'),_0x7555('0x7f'),_0x7555('0x71')],'raw':!![]});}return null;})['then'](function(_0x45dc06){if(!_0x45dc06)return null;_0x4d74e4[_0x7555('0x28')][_0x7555('0x61')]=_0x45dc06;return _0x4d74e4;})[_0x7555('0x23')](function(_0x1e5c08){if(_0x1e5c08){_0x1e5c08[_0x7555('0x28')][_0x7555('0x80')]=util[_0x7555('0x5d')](_0x7555('0x81'),_0x2f6137['user'][_0x7555('0x3b')]);_0x1e5c08[_0x7555('0x28')][_0x7555('0x74')]=_0x4d74e4[_0x7555('0x74')];_0x1e5c08[_0x7555('0x28')][_0x7555('0x73')]=_0x4d74e4['channel'];_0x1e5c08[_0x7555('0x28')][_0x7555('0x75')]=_0x7555('0x37');respondWithRpcPromise(_0x7555('0x77'),_0x7555('0x77'),{'event':_0x7555('0x82'),'message':_[_0x7555('0x4f')](_0x4d74e4[_0x7555('0x28')],JSON['parse'](_0x4d74e4[_0x7555('0x65')][_0x7555('0x79')]))},client9002);return _0x4d74e4;}return null;})[_0x7555('0x23')](respondWithResult(_0x12b4b3,null))[_0x7555('0x2b')](handleError(_0x12b4b3,null));}; \ No newline at end of file +var _0xfad4=['count','set','Content-Range','reject','update','destroy','end','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','filters','intersection','model','query','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','show','keys','length','find','create','body','params','describe','chat-interactions','accept','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','event','rejectmessage','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','undefined','limit'];(function(_0x3c2c96,_0x188c6c){var _0xd1f892=function(_0x3d5c05){while(--_0x3d5c05){_0x3c2c96['push'](_0x3c2c96['shift']());}};_0xd1f892(++_0x188c6c);}(_0xfad4,0x165));var _0x4fad=function(_0x4eae71,_0x5520e2){_0x4eae71=_0x4eae71-0x0;var _0x40f00d=_0xfad4[_0x4eae71];return _0x40f00d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4fad('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fad('0x1'));var moment=require(_0x4fad('0x2'));var BPromise=require(_0x4fad('0x3'));var Mustache=require(_0x4fad('0x4'));var util=require(_0x4fad('0x5'));var path=require(_0x4fad('0x6'));var sox=require(_0x4fad('0x7'));var csv=require(_0x4fad('0x8'));var ejs=require(_0x4fad('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4fad('0xa'));var squel=require(_0x4fad('0xb'));var crypto=require(_0x4fad('0xc'));var jsforce=require(_0x4fad('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4fad('0x8'));var querystring=require(_0x4fad('0xe'));var Papa=require('papaparse');var Redis=require(_0x4fad('0xf'));var authService=require(_0x4fad('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4fad('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fad('0x12'))(_0x4fad('0x13'));var utils=require(_0x4fad('0x14'));var config=require(_0x4fad('0x15'));var licenseUtil=require(_0x4fad('0x16'));var db=require(_0x4fad('0x17'))['db'];config['redis']=_[_0x4fad('0x18')](config[_0x4fad('0x19')],{'host':_0x4fad('0x1a'),'port':0x18eb});var socket=require(_0x4fad('0x1b'))(new Redis(config[_0x4fad('0x19')]));require(_0x4fad('0x1c'))[_0x4fad('0x1d')](socket);var jayson=require(_0x4fad('0x1e'));var client=jayson[_0x4fad('0x1f')][_0x4fad('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x4fad('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x2051c6,_0x5a427a,_0x4193d1,_0x44ddc4){return new BPromise(function(_0x386c0f,_0x1e6625){var _0x5e6f43=_0x44ddc4||client;return _0x5e6f43[_0x4fad('0x21')](_0x2051c6,_0x4193d1)[_0x4fad('0x22')](function(_0x5cb16b){logger['info'](_0x4fad('0x23'),_0x5a427a,_0x4fad('0x24'));logger['debug'](_0x4fad('0x25'),_0x5a427a,_0x4fad('0x24'),JSON[_0x4fad('0x26')](_0x5cb16b));if(_0x5cb16b[_0x4fad('0x27')]){if(_0x5cb16b['error'][_0x4fad('0x28')]===0x1f4){logger[_0x4fad('0x27')](_0x4fad('0x23'),_0x5a427a,_0x5cb16b[_0x4fad('0x27')][_0x4fad('0x29')]);return _0x1e6625(_0x5cb16b[_0x4fad('0x27')][_0x4fad('0x29')]);}logger['error'](_0x4fad('0x23'),_0x5a427a,_0x5cb16b[_0x4fad('0x27')][_0x4fad('0x29')]);return _0x386c0f(_0x5cb16b['error']['message']);}else{logger[_0x4fad('0x2a')](_0x4fad('0x23'),_0x5a427a,_0x4fad('0x24'));_0x386c0f(_0x5cb16b[_0x4fad('0x2b')]['message']);}})[_0x4fad('0x2c')](function(_0x45cd9e){logger[_0x4fad('0x27')](_0x4fad('0x23'),_0x5a427a,_0x45cd9e);_0x1e6625(_0x45cd9e);});});}function respondWithStatusCode(_0x2d565e,_0x104939){_0x104939=_0x104939||0xcc;return function(_0x2adaac){if(_0x2adaac){return _0x2d565e[_0x4fad('0x2d')](_0x104939);}return _0x2d565e[_0x4fad('0x2e')](_0x104939)['end']();};}function respondWithResult(_0x4b874b,_0x4b8863){_0x4b8863=_0x4b8863||0xc8;return function(_0xaf0ce6){if(_0xaf0ce6){return _0x4b874b[_0x4fad('0x2e')](_0x4b8863)[_0x4fad('0x2f')](_0xaf0ce6);}};}function respondWithFilteredResult(_0x527570,_0x2b24e4){return function(_0x279f3d){if(_0x279f3d){var _0x7c45de=typeof _0x2b24e4[_0x4fad('0x30')]===_0x4fad('0x31')&&typeof _0x2b24e4[_0x4fad('0x32')]===_0x4fad('0x31');var _0x45fc28=_0x279f3d['count'];var _0x269d07=_0x7c45de?0x0:_0x2b24e4['offset'];var _0x4bee13=_0x7c45de?_0x279f3d[_0x4fad('0x33')]:_0x2b24e4[_0x4fad('0x30')]+_0x2b24e4['limit'];var _0x248593;if(_0x4bee13>=_0x45fc28){_0x4bee13=_0x45fc28;_0x248593=0xc8;}else{_0x248593=0xce;}_0x527570[_0x4fad('0x2e')](_0x248593);return _0x527570[_0x4fad('0x34')](_0x4fad('0x35'),_0x269d07+'-'+_0x4bee13+'/'+_0x45fc28)['json'](_0x279f3d);}return null;};}function patchUpdates(_0x500a38){return function(_0x2d3d2f){try{jsonpatch['apply'](_0x2d3d2f,_0x500a38,!![]);}catch(_0x1ae55e){return BPromise[_0x4fad('0x36')](_0x1ae55e);}return _0x2d3d2f['save']();};}function saveUpdates(_0x1377d3,_0xcbd091){return function(_0x3a55eb){if(_0x3a55eb){return _0x3a55eb[_0x4fad('0x37')](_0x1377d3)[_0x4fad('0x22')](function(_0x200060){return _0x200060;});}return null;};}function removeEntity(_0xa48703,_0x1e8328){return function(_0x575aef){if(_0x575aef){return _0x575aef[_0x4fad('0x38')]()[_0x4fad('0x22')](function(){_0xa48703[_0x4fad('0x2e')](0xcc)[_0x4fad('0x39')]();});}};}function handleEntityNotFound(_0x12b24c,_0x2e2fb7){return function(_0xfb317d){if(!_0xfb317d){_0x12b24c['sendStatus'](0x194);}return _0xfb317d;};}function handleError(_0x33914c,_0x59cc2a){_0x59cc2a=_0x59cc2a||0x1f4;return function(_0x458574){logger['error'](_0x458574[_0x4fad('0x3a')]);if(_0x458574[_0x4fad('0x3b')]){delete _0x458574[_0x4fad('0x3b')];}_0x33914c['status'](_0x59cc2a)[_0x4fad('0x3c')](_0x458574);};}exports[_0x4fad('0x3d')]=function(_0x4ba45d,_0x31a927){var _0x542874={},_0xdb5504={},_0x135172={'count':0x0,'rows':[]};var _0x14b695=_[_0x4fad('0x3e')](db[_0x4fad('0x3f')][_0x4fad('0x40')],function(_0x4501a3){return{'name':_0x4501a3[_0x4fad('0x41')],'type':_0x4501a3[_0x4fad('0x42')][_0x4fad('0x43')]};});_0xdb5504['model']=_[_0x4fad('0x3e')](_0x14b695,_0x4fad('0x3b'));_0xdb5504['query']=_['keys'](_0x4ba45d['query']);_0xdb5504[_0x4fad('0x44')]=_[_0x4fad('0x45')](_0xdb5504[_0x4fad('0x46')],_0xdb5504[_0x4fad('0x47')]);_0x542874['attributes']=_[_0x4fad('0x45')](_0xdb5504[_0x4fad('0x46')],qs['fields'](_0x4ba45d[_0x4fad('0x47')][_0x4fad('0x48')]));_0x542874['attributes']=_0x542874[_0x4fad('0x49')]['length']?_0x542874[_0x4fad('0x49')]:_0xdb5504[_0x4fad('0x46')];if(!_0x4ba45d[_0x4fad('0x47')][_0x4fad('0x4a')](_0x4fad('0x4b'))){_0x542874['limit']=qs[_0x4fad('0x32')](_0x4ba45d[_0x4fad('0x47')]['limit']);_0x542874[_0x4fad('0x30')]=qs['offset'](_0x4ba45d['query'][_0x4fad('0x30')]);}_0x542874[_0x4fad('0x4c')]=qs[_0x4fad('0x4d')](_0x4ba45d[_0x4fad('0x47')][_0x4fad('0x4d')]);_0x542874[_0x4fad('0x4e')]=qs[_0x4fad('0x44')](_[_0x4fad('0x4f')](_0x4ba45d[_0x4fad('0x47')],_0xdb5504['filters']),_0x14b695);if(_0x4ba45d[_0x4fad('0x47')][_0x4fad('0x50')]){_0x542874[_0x4fad('0x4e')]=_[_0x4fad('0x51')](_0x542874[_0x4fad('0x4e')],{'$or':_['map'](_0x14b695,function(_0x40e2f7){if(_0x40e2f7['type']!=='VIRTUAL'){var _0x444364={};_0x444364[_0x40e2f7[_0x4fad('0x3b')]]={'$like':'%'+_0x4ba45d[_0x4fad('0x47')]['filter']+'%'};return _0x444364;}})});}_0x542874=_[_0x4fad('0x51')]({},_0x542874,_0x4ba45d[_0x4fad('0x52')]);var _0x55123f={'where':_0x542874['where']};return db['ChatMessage'][_0x4fad('0x33')](_0x55123f)[_0x4fad('0x22')](function(_0x24a48b){_0x135172[_0x4fad('0x33')]=_0x24a48b;if(_0x4ba45d[_0x4fad('0x47')][_0x4fad('0x53')]){_0x542874['include']=[{'all':!![]}];}return db['ChatMessage'][_0x4fad('0x54')](_0x542874);})[_0x4fad('0x22')](function(_0x2a81fc){_0x135172[_0x4fad('0x55')]=_0x2a81fc;return _0x135172;})[_0x4fad('0x22')](respondWithFilteredResult(_0x31a927,_0x542874))[_0x4fad('0x2c')](handleError(_0x31a927,null));};exports[_0x4fad('0x56')]=function(_0x880a8f,_0x48dde3){var _0x96f9f8={'raw':!![],'where':{'id':_0x880a8f['params']['id']}},_0x1de931={};_0x1de931[_0x4fad('0x46')]=_[_0x4fad('0x57')](db[_0x4fad('0x3f')][_0x4fad('0x40')]);_0x1de931[_0x4fad('0x47')]=_[_0x4fad('0x57')](_0x880a8f[_0x4fad('0x47')]);_0x1de931[_0x4fad('0x44')]=_[_0x4fad('0x45')](_0x1de931['model'],_0x1de931['query']);_0x96f9f8[_0x4fad('0x49')]=_['intersection'](_0x1de931['model'],qs[_0x4fad('0x48')](_0x880a8f[_0x4fad('0x47')][_0x4fad('0x48')]));_0x96f9f8['attributes']=_0x96f9f8[_0x4fad('0x49')][_0x4fad('0x58')]?_0x96f9f8[_0x4fad('0x49')]:_0x1de931[_0x4fad('0x46')];if(_0x880a8f[_0x4fad('0x47')][_0x4fad('0x53')]){_0x96f9f8['include']=[{'all':!![]}];}_0x96f9f8=_[_0x4fad('0x51')]({},_0x96f9f8,_0x880a8f['options']);return db[_0x4fad('0x3f')][_0x4fad('0x59')](_0x96f9f8)[_0x4fad('0x22')](handleEntityNotFound(_0x48dde3,null))[_0x4fad('0x22')](respondWithResult(_0x48dde3,null))['catch'](handleError(_0x48dde3,null));};exports[_0x4fad('0x5a')]=function(_0x6849f0,_0x55579f){return db[_0x4fad('0x3f')][_0x4fad('0x5a')](_0x6849f0['body'],{})[_0x4fad('0x22')](respondWithResult(_0x55579f,0xc9))[_0x4fad('0x2c')](handleError(_0x55579f,null));};exports[_0x4fad('0x37')]=function(_0x40e854,_0x1504ec){if(_0x40e854[_0x4fad('0x5b')]['id']){delete _0x40e854[_0x4fad('0x5b')]['id'];}return db['ChatMessage'][_0x4fad('0x59')]({'where':{'id':_0x40e854[_0x4fad('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1504ec,null))[_0x4fad('0x22')](saveUpdates(_0x40e854[_0x4fad('0x5b')],null))[_0x4fad('0x22')](respondWithResult(_0x1504ec,null))[_0x4fad('0x2c')](handleError(_0x1504ec,null));};exports[_0x4fad('0x38')]=function(_0x3d9f36,_0x5085fc){return db[_0x4fad('0x3f')][_0x4fad('0x59')]({'where':{'id':_0x3d9f36[_0x4fad('0x5c')]['id']}})[_0x4fad('0x22')](handleEntityNotFound(_0x5085fc,null))[_0x4fad('0x22')](removeEntity(_0x5085fc,null))[_0x4fad('0x2c')](handleError(_0x5085fc,null));};exports[_0x4fad('0x5d')]=function(_0x4744b,_0x499784){return db[_0x4fad('0x3f')][_0x4fad('0x5d')]()[_0x4fad('0x22')](respondWithResult(_0x499784,null))[_0x4fad('0x2c')](handleError(_0x499784,null));};var interaction_log=require(_0x4fad('0x12'))(_0x4fad('0x5e'));exports[_0x4fad('0x5f')]=function(_0x4066b1,_0x98fd8e,_0x35de29){var _0x54f288={'agent':{},'channel':_0x4fad('0x60')};if(_0x4066b1['body']['id']){delete _0x4066b1[_0x4fad('0x5b')]['id'];}_0x4066b1[_0x4fad('0x5b')][_0x4fad('0x61')]=!![];_0x4066b1['body']['readAt']=moment()[_0x4fad('0x62')](_0x4fad('0x63'));_0x4066b1['body'][_0x4fad('0x64')]=_0x4066b1['body']['UserId']||_0x4066b1[_0x4fad('0x65')]['id'];_0x54f288[_0x4fad('0x66')]['id']=_0x4066b1['body'][_0x4fad('0x64')];return db['ChatMessage'][_0x4fad('0x59')]({'where':{'id':_0x4066b1[_0x4fad('0x5c')]['id'],'UserId':null}})[_0x4fad('0x22')](handleEntityNotFound(_0x98fd8e,null))[_0x4fad('0x22')](saveUpdates(_0x4066b1[_0x4fad('0x5b')],null))[_0x4fad('0x22')](function(_0x1bbb98){if(_0x1bbb98){_0x54f288[_0x4fad('0x29')]=_0x1bbb98[_0x4fad('0x67')]({'plain':!![]});return db[_0x4fad('0x68')][_0x4fad('0x59')]({'where':{'id':_0x1bbb98[_0x4fad('0x69')]}});}return null;})[_0x4fad('0x22')](handleEntityNotFound(_0x98fd8e,null))['then'](function(_0x46f950){if(_0x46f950){return _0x46f950[_0x4fad('0x37')]({'UserId':_0x4066b1[_0x4fad('0x5b')]['UserId'],'read1stAt':_[_0x4fad('0x6a')](_0x46f950[_0x4fad('0x6b')])?moment()[_0x4fad('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x4fad('0x22')](function(_0x49db56){if(_0x49db56){_0x54f288[_0x4fad('0x6c')]=_0x49db56['get']({'plain':!![]});interaction_log['info'](_0x4fad('0x6d'),_0x4066b1[_0x4fad('0x65')]['id'],_0x4066b1[_0x4fad('0x65')][_0x4fad('0x3b')],_0x4066b1[_0x4fad('0x65')][_0x4fad('0x6e')],_0x54f288[_0x4fad('0x6c')]['id'],_0x4066b1[_0x4fad('0x5b')]?JSON[_0x4fad('0x26')](_0x4066b1[_0x4fad('0x5b')]):'null');return respondWithRpcPromise('AcceptMessage',_0x4fad('0x6f'),_0x54f288);}return null;})[_0x4fad('0x22')](function(_0x3ae1d1){var _0x1f1929=_0x4fad('0x70')+_0x3ae1d1[_0x4fad('0x29')][_0x4fad('0x71')];return db[_0x4fad('0x72')][_0x4fad('0x47')](_0x1f1929,{'type':db[_0x4fad('0x73')][_0x4fad('0x74')][_0x4fad('0x75')],'raw':!![]})[_0x4fad('0x22')](function(_0x52f439){return _0x52f439;});})[_0x4fad('0x22')](function(_0x2e51be){if(_0x2e51be){_0x54f288[_0x4fad('0x29')][_0x4fad('0x76')]=_0x2e51be[0x0];if(!_0x4066b1['body'][_0x4fad('0x64')])return;return db[_0x4fad('0x77')][_0x4fad('0x59')]({'where':{'id':_0x4066b1['body'][_0x4fad('0x64')],'role':_0x4fad('0x66')},'attributes':['id',_0x4fad('0x3b'),_0x4fad('0x78'),_0x4fad('0x79'),'internal'],'raw':!![]});}return null;})[_0x4fad('0x22')](function(_0x125bdb){if(!_0x125bdb)return null;_0x54f288[_0x4fad('0x29')]['agent']=_0x125bdb;return _0x54f288;})['then'](function(_0x28a698){if(_0x28a698){if(_0x4066b1[_0x4fad('0x5b')][_0x4fad('0x7a')]){_0x54f288[_0x4fad('0x29')][_0x4fad('0x7b')]=util[_0x4fad('0x62')](_0x4fad('0x7c'),_0x4066b1[_0x4fad('0x65')][_0x4fad('0x3b')]);_0x54f288[_0x4fad('0x29')][_0x4fad('0x7d')]=_0x54f288[_0x4fad('0x7d')];_0x54f288[_0x4fad('0x29')][_0x4fad('0x7e')]=_0x54f288[_0x4fad('0x7d')];_0x54f288['message']['event']=_0x4fad('0x5f');return respondWithRpcPromise(_0x4fad('0x7f'),_0x4fad('0x7f'),{'event':_0x4fad('0x80'),'message':_[_0x4fad('0x51')](_0x54f288['message'],JSON[_0x4fad('0x81')](_0x54f288['interaction'][_0x4fad('0x82')]))},client9002)[_0x4fad('0x22')](function(){return _0x54f288;});}return _0x54f288;}return null;})['then'](respondWithResult(_0x98fd8e,null))[_0x4fad('0x2c')](handleError(_0x98fd8e,null));};var interaction_log=require(_0x4fad('0x12'))(_0x4fad('0x5e'));exports[_0x4fad('0x36')]=function(_0x3605ef,_0x4ecde5,_0x2309c9){var _0x5ad9aa={'agent':{},'channel':'chat'};if(_0x3605ef[_0x4fad('0x5b')]['id']){delete _0x3605ef['body']['id'];}_0x3605ef['body']['UserId']=_0x3605ef[_0x4fad('0x5b')][_0x4fad('0x64')]||_0x3605ef['user']['id'];_0x5ad9aa[_0x4fad('0x66')]['id']=_0x3605ef[_0x4fad('0x5b')][_0x4fad('0x64')];return db[_0x4fad('0x3f')][_0x4fad('0x59')]({'where':{'id':_0x3605ef['params']['id'],'UserId':null}})[_0x4fad('0x22')](handleEntityNotFound(_0x4ecde5,null))[_0x4fad('0x22')](function(_0x11ae29){if(_0x11ae29){_0x5ad9aa['message']=_0x11ae29[_0x4fad('0x67')]({'plain':!![]});return db[_0x4fad('0x68')][_0x4fad('0x59')]({'where':{'id':_0x11ae29['ChatInteractionId']}});}return null;})[_0x4fad('0x22')](handleEntityNotFound(_0x4ecde5,null))['then'](function(_0x4a1bc3){if(_0x4a1bc3){_0x5ad9aa[_0x4fad('0x6c')]=_0x4a1bc3[_0x4fad('0x67')]({'plain':!![]});interaction_log[_0x4fad('0x2a')](_0x4fad('0x83'),_0x3605ef[_0x4fad('0x65')]['id'],_0x3605ef[_0x4fad('0x65')][_0x4fad('0x3b')],_0x3605ef['user'][_0x4fad('0x6e')],_0x5ad9aa['interaction']['id'],_0x3605ef[_0x4fad('0x5b')]?JSON[_0x4fad('0x26')](_0x3605ef[_0x4fad('0x5b')]):_0x4fad('0x84'));return respondWithRpcPromise(_0x4fad('0x85'),'rejectMessage',_0x5ad9aa);}return null;})[_0x4fad('0x22')](function(_0x1ee004){var _0xb62a8f=_0x4fad('0x70')+_0x1ee004[_0x4fad('0x29')]['ContactId'];return db[_0x4fad('0x72')][_0x4fad('0x47')](_0xb62a8f,{'type':db[_0x4fad('0x73')][_0x4fad('0x74')][_0x4fad('0x75')],'raw':!![]})[_0x4fad('0x22')](function(_0x37a096){return _0x37a096;});})[_0x4fad('0x22')](function(_0x5a96b0){if(_0x5a96b0){_0x5ad9aa['message'][_0x4fad('0x76')]=_0x5a96b0[0x0];if(!_0x3605ef[_0x4fad('0x5b')]['UserId'])return;return db[_0x4fad('0x77')][_0x4fad('0x59')]({'where':{'id':_0x3605ef[_0x4fad('0x5b')][_0x4fad('0x64')],'role':_0x4fad('0x66')},'attributes':['id','name','fullname',_0x4fad('0x79'),'internal'],'raw':!![]});}return null;})[_0x4fad('0x22')](function(_0x5f458d){if(!_0x5f458d)return null;_0x5ad9aa['message']['agent']=_0x5f458d;return _0x5ad9aa;})[_0x4fad('0x22')](function(_0x4f56a7){if(_0x4f56a7){_0x4f56a7[_0x4fad('0x29')]['interface']=util[_0x4fad('0x62')](_0x4fad('0x7c'),_0x3605ef['user']['name']);_0x4f56a7[_0x4fad('0x29')][_0x4fad('0x7d')]=_0x5ad9aa[_0x4fad('0x7d')];_0x4f56a7['message'][_0x4fad('0x7e')]=_0x5ad9aa['channel'];_0x4f56a7[_0x4fad('0x29')][_0x4fad('0x86')]=_0x4fad('0x36');respondWithRpcPromise(_0x4fad('0x7f'),'EventManager',{'event':_0x4fad('0x87'),'message':_[_0x4fad('0x51')](_0x5ad9aa[_0x4fad('0x29')],JSON[_0x4fad('0x81')](_0x5ad9aa[_0x4fad('0x6c')][_0x4fad('0x82')]))},client9002);return _0x5ad9aa;}return null;})[_0x4fad('0x22')](respondWithResult(_0x4ecde5,null))[_0x4fad('0x2c')](handleError(_0x4ecde5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7d9a6f5..3678c1d 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 _0x8221=['remove','emit','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x20dbb3,_0x4deb84){var _0x36b458=function(_0x2d053f){while(--_0x2d053f){_0x20dbb3['push'](_0x20dbb3['shift']());}};_0x36b458(++_0x4deb84);}(_0x8221,0x1bd));var _0x1822=function(_0x162780,_0x47f2e2){_0x162780=_0x162780-0x0;var _0x1ea2dc=_0x8221[_0x162780];return _0x1ea2dc;};'use strict';var EventEmitter=require(_0x1822('0x0'));var ChatMessage=require(_0x1822('0x1'))['db'][_0x1822('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x1822('0x3')](0x0);var events={'afterCreate':_0x1822('0x4'),'afterUpdate':'update','afterDestroy':_0x1822('0x5')};function emitEvent(_0xf91f9c){return function(_0x4c9fca,_0x286677,_0x2abeb6){ChatMessageEvents[_0x1822('0x6')](_0xf91f9c+':'+_0x4c9fca['id'],_0x4c9fca);ChatMessageEvents['emit'](_0xf91f9c,_0x4c9fca);_0x2abeb6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x1822('0x7')](e,emitEvent(event));}}module[_0x1822('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0x2282=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','save','update'];(function(_0x1e1f7d,_0x2fa82c){var _0x5b5aa4=function(_0x3e3d86){while(--_0x3e3d86){_0x1e1f7d['push'](_0x1e1f7d['shift']());}};_0x5b5aa4(++_0x2fa82c);}(_0x2282,0x164));var _0x2228=function(_0x2ad008,_0x45c253){_0x2ad008=_0x2ad008-0x0;var _0x4538cf=_0x2282[_0x2ad008];return _0x4538cf;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x2228('0x0'))['db'][_0x2228('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2228('0x2'),'afterUpdate':_0x2228('0x3'),'afterDestroy':_0x2228('0x4')};function emitEvent(_0x309f18){return function(_0x41c59e,_0x3042ad,_0x2c6165){ChatMessageEvents[_0x2228('0x5')](_0x309f18+':'+_0x41c59e['id'],_0x41c59e);ChatMessageEvents['emit'](_0x309f18,_0x41c59e);_0x2c6165(null);};}for(var e in events){if(events[_0x2228('0x6')](e)){var event=events[e];ChatMessage[_0x2228('0x7')](e,emitEvent(event));}}module[_0x2228('0x8')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index fdc8f0f..4a3bf2f 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 _0x4853=['api','moment','bluebird','request-promise','path','rimraf','define','ChatMessage','chat_messages','fti_chat_messages','body','models','get','direction','toLowerCase','out','UserId','ChatInteraction','findOne','catch','error','util'];(function(_0x1d7907,_0x131382){var _0x4656fa=function(_0x440fd6){while(--_0x440fd6){_0x1d7907['push'](_0x1d7907['shift']());}};_0x4656fa(++_0x131382);}(_0x4853,0x11d));var _0x3485=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4853[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x3485('0x0'));var logger=require('../../config/logger')(_0x3485('0x1'));var moment=require(_0x3485('0x2'));var BPromise=require(_0x3485('0x3'));var rp=require(_0x3485('0x4'));var fs=require('fs');var path=require(_0x3485('0x5'));var rimraf=require(_0x3485('0x6'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module['exports']=function(_0x249d2c,_0x7512e3){return _0x249d2c[_0x3485('0x7')](_0x3485('0x8'),attributes,{'tableName':_0x3485('0x9'),'paranoid':![],'indexes':[{'name':_0x3485('0xa'),'fields':[_0x3485('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x386f6b,_0x302f8c,_0x2d18a6){var _0x876b94=_0x249d2c[_0x3485('0xc')];var _0x466c62=_0x386f6b[_0x3485('0xd')]({'plain':!![]});if(_0x466c62[_0x3485('0xe')][_0x3485('0xf')]()==='in'||_0x466c62['direction'][_0x3485('0xf')]()===_0x3485('0x10')&&!_0x466c62['secret']&&!_['isNil'](_0x466c62[_0x3485('0x11')])){_0x876b94[_0x3485('0x12')][_0x3485('0x13')]({'where':{'id':_0x466c62['ChatInteractionId']}})['then'](function(_0x4dcbd8){if(_0x4dcbd8){_0x4dcbd8['update']({'lastMsgAt':_0x466c62['createdAt'],'lastMsgDirection':_0x466c62[_0x3485('0xe')][_0x3485('0xf')]()});}})[_0x3485('0x14')](function(_0x5e792d){console[_0x3485('0x15')](_0x5e792d);});}_0x2d18a6();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa25a=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','then','update','createdAt','catch'];(function(_0x4873ca,_0x43b1a9){var _0x12af16=function(_0x50a383){while(--_0x50a383){_0x4873ca['push'](_0x4873ca['shift']());}};_0x12af16(++_0x43b1a9);}(_0xa25a,0x153));var _0xaa25=function(_0x3a5b8c,_0x2edf4e){_0x3a5b8c=_0x3a5b8c-0x0;var _0x266560=_0xa25a[_0x3a5b8c];return _0x266560;};'use strict';var _=require(_0xaa25('0x0'));var util=require(_0xaa25('0x1'));var logger=require(_0xaa25('0x2'))(_0xaa25('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa25('0x4'));var rimraf=require('rimraf');var config=require(_0xaa25('0x5'));var attributes=require(_0xaa25('0x6'));module[_0xaa25('0x7')]=function(_0x5c292f,_0x24660c){return _0x5c292f[_0xaa25('0x8')](_0xaa25('0x9'),attributes,{'tableName':_0xaa25('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xaa25('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x542562,_0x402ac3,_0x2bbac){var _0x37c46b=_0x5c292f[_0xaa25('0xc')];var _0x38b04a=_0x542562[_0xaa25('0xd')]({'plain':!![]});if(_0x38b04a[_0xaa25('0xe')][_0xaa25('0xf')]()==='in'||_0x38b04a[_0xaa25('0xe')][_0xaa25('0xf')]()==='out'&&!_0x38b04a[_0xaa25('0x10')]&&!_[_0xaa25('0x11')](_0x38b04a[_0xaa25('0x12')])){_0x37c46b[_0xaa25('0x13')][_0xaa25('0x14')]({'where':{'id':_0x38b04a['ChatInteractionId']}})[_0xaa25('0x15')](function(_0x25523e){if(_0x25523e){_0x25523e[_0xaa25('0x16')]({'lastMsgAt':_0x38b04a[_0xaa25('0x17')],'lastMsgDirection':_0x38b04a[_0xaa25('0xe')][_0xaa25('0xf')]()});}})[_0xaa25('0x18')](function(_0x5446c5){console[_0xaa25('0x19')](_0x5446c5);});}_0x2bbac();}},'charset':_0xaa25('0x1a'),'collate':_0xaa25('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index c4249ec..e7c5d88 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 _0x16ce=['options','raw','CreateChatMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','ChatMessage','create'];(function(_0x50d828,_0x9bdce8){var _0x4d8696=function(_0x10c37e){while(--_0x10c37e){_0x50d828['push'](_0x50d828['shift']());}};_0x4d8696(++_0x9bdce8);}(_0x16ce,0xfb));var _0xe16c=function(_0x599e0c,_0x1d71f5){_0x599e0c=_0x599e0c-0x0;var _0x9cbfb3=_0x16ce[_0x599e0c];return _0x9cbfb3;};'use strict';var _=require('lodash');var util=require(_0xe16c('0x0'));var moment=require(_0xe16c('0x1'));var BPromise=require(_0xe16c('0x2'));var rs=require(_0xe16c('0x3'));var fs=require('fs');var Redis=require(_0xe16c('0x4'));var db=require(_0xe16c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe16c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe16c('0x7')][_0xe16c('0x8')]({'port':0x232a});config[_0xe16c('0x9')]=_[_0xe16c('0xa')](config[_0xe16c('0x9')],{'host':_0xe16c('0xb'),'port':0x18eb});var socket=require(_0xe16c('0xc'))(new Redis(config[_0xe16c('0x9')]));require('./chatMessage.socket')[_0xe16c('0xd')](socket);function respondWithRpcPromise(_0x1dfa84,_0x3cc96b,_0x2e59ad){return new BPromise(function(_0x1b7da7,_0x280e21){return client[_0xe16c('0xe')](_0x1dfa84,_0x2e59ad)[_0xe16c('0xf')](function(_0x1b460c){logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,'request\x20sent');logger[_0xe16c('0x12')](_0xe16c('0x13'),_0x3cc96b,_0xe16c('0x14'),JSON[_0xe16c('0x15')](_0x1b460c));if(_0x1b460c['error']){if(_0x1b460c['error'][_0xe16c('0x16')]===0x1f4){logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x280e21(_0x1b460c[_0xe16c('0x17')]['message']);}logger[_0xe16c('0x17')](_0xe16c('0x11'),_0x3cc96b,_0x1b460c[_0xe16c('0x17')]['message']);return _0x1b7da7(_0x1b460c[_0xe16c('0x17')][_0xe16c('0x18')]);}else{logger[_0xe16c('0x10')](_0xe16c('0x11'),_0x3cc96b,_0xe16c('0x14'));_0x1b7da7(_0x1b460c['result'][_0xe16c('0x18')]);}})[_0xe16c('0x19')](function(_0x22fe04){logger['error']('ChatMessage,\x20%s,\x20%s',_0x3cc96b,_0x22fe04);_0x280e21(_0x22fe04);});});}exports['CreateChatMessage']=function(_0x30e657){var _0x23fe64=this;return new Promise(function(_0x611939,_0xfc18a6){return db[_0xe16c('0x1a')][_0xe16c('0x1b')](_0x30e657['body'],{'raw':_0x30e657[_0xe16c('0x1c')]?_0x30e657[_0xe16c('0x1c')][_0xe16c('0x1d')]===undefined?!![]:![]:!![]})[_0xe16c('0xf')](function(_0x5a88ed){logger[_0xe16c('0x10')](_0xe16c('0x1e'),_0x30e657);logger[_0xe16c('0x12')](_0xe16c('0x1e'),_0x30e657,JSON[_0xe16c('0x15')](_0x5a88ed));_0x611939(_0x5a88ed);})[_0xe16c('0x19')](function(_0x1d888d){logger[_0xe16c('0x17')]('CreateChatMessage',_0x1d888d[_0xe16c('0x18')],_0x30e657);_0xfc18a6(_0x23fe64[_0xe16c('0x17')](0x1f4,_0x1d888d['message']));});});}; \ No newline at end of file +var _0x31ce=['CreateChatMessage','debug','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage','body','options'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x31ce,0x99));var _0xe31c=function(_0x2e3545,_0x20a6ec){_0x2e3545=_0x2e3545-0x0;var _0xcf18f=_0x31ce[_0x2e3545];return _0xcf18f;};'use strict';var _=require(_0xe31c('0x0'));var util=require(_0xe31c('0x1'));var moment=require(_0xe31c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe31c('0x3'));var fs=require('fs');var Redis=require(_0xe31c('0x4'));var db=require(_0xe31c('0x5'))['db'];var utils=require(_0xe31c('0x6'));var logger=require('../../config/logger')(_0xe31c('0x7'));var config=require(_0xe31c('0x8'));var jayson=require(_0xe31c('0x9'));var client=jayson['client'][_0xe31c('0xa')]({'port':0x232a});config[_0xe31c('0xb')]=_['defaults'](config[_0xe31c('0xb')],{'host':_0xe31c('0xc'),'port':0x18eb});var socket=require(_0xe31c('0xd'))(new Redis(config['redis']));require(_0xe31c('0xe'))[_0xe31c('0xf')](socket);function respondWithRpcPromise(_0x47b7ae,_0x1ca016,_0x1e6ad9){return new BPromise(function(_0x57758a,_0x37479a){return client['request'](_0x47b7ae,_0x1e6ad9)[_0xe31c('0x10')](function(_0xe4de0f){logger[_0xe31c('0x11')](_0xe31c('0x12'),_0x1ca016,'request\x20sent');logger['debug'](_0xe31c('0x13'),_0x1ca016,'request\x20sent',JSON[_0xe31c('0x14')](_0xe4de0f));if(_0xe4de0f[_0xe31c('0x15')]){if(_0xe4de0f[_0xe31c('0x15')][_0xe31c('0x16')]===0x1f4){logger[_0xe31c('0x15')](_0xe31c('0x12'),_0x1ca016,_0xe4de0f['error'][_0xe31c('0x17')]);return _0x37479a(_0xe4de0f[_0xe31c('0x15')][_0xe31c('0x17')]);}logger[_0xe31c('0x15')]('ChatMessage,\x20%s,\x20%s',_0x1ca016,_0xe4de0f[_0xe31c('0x15')]['message']);return _0x57758a(_0xe4de0f[_0xe31c('0x15')][_0xe31c('0x17')]);}else{logger[_0xe31c('0x11')](_0xe31c('0x12'),_0x1ca016,'request\x20sent');_0x57758a(_0xe4de0f['result'][_0xe31c('0x17')]);}})['catch'](function(_0x503be7){logger[_0xe31c('0x15')](_0xe31c('0x12'),_0x1ca016,_0x503be7);_0x37479a(_0x503be7);});});}exports['CreateChatMessage']=function(_0x3bbee0){var _0x5a7269=this;return new Promise(function(_0x3734f4,_0x5a8bed){return db[_0xe31c('0x18')]['create'](_0x3bbee0[_0xe31c('0x19')],{'raw':_0x3bbee0[_0xe31c('0x1a')]?_0x3bbee0['options']['raw']===undefined?!![]:![]:!![]})[_0xe31c('0x10')](function(_0x37ae5d){logger[_0xe31c('0x11')](_0xe31c('0x1b'),_0x3bbee0);logger[_0xe31c('0x1c')]('CreateChatMessage',_0x3bbee0,JSON[_0xe31c('0x14')](_0x37ae5d));_0x3734f4(_0x37ae5d);})[_0xe31c('0x1d')](function(_0x4981d6){logger[_0xe31c('0x15')](_0xe31c('0x1b'),_0x4981d6[_0xe31c('0x17')],_0x3bbee0);_0x5a8bed(_0x5a7269[_0xe31c('0x15')](0x1f4,_0x4981d6[_0xe31c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 84b489f..4b398dc 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 _0xc18a=['removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update','emit'];(function(_0x999b85,_0x1edc2b){var _0x1d7124=function(_0x59cd29){while(--_0x59cd29){_0x999b85['push'](_0x999b85['shift']());}};_0x1d7124(++_0x1edc2b);}(_0xc18a,0x1cf));var _0xac18=function(_0x31bc18,_0x13e195){_0x31bc18=_0x31bc18-0x0;var _0x46d54b=_0xc18a[_0x31bc18];return _0x46d54b;};'use strict';var ChatMessageEvents=require(_0xac18('0x0'));var events=[_0xac18('0x1'),_0xac18('0x2'),_0xac18('0x3')];function createListener(_0x48266f,_0x3a3e96){return function(_0x2651c2){_0x3a3e96[_0xac18('0x4')](_0x48266f,_0x2651c2);};}function removeListener(_0x3da5f5,_0x42f646){return function(){ChatMessageEvents[_0xac18('0x5')](_0x3da5f5,_0x42f646);};}exports[_0xac18('0x6')]=function(_0x395493){for(var _0x49136f=0x0,_0xab6cb=events[_0xac18('0x7')];_0x49136f<_0xab6cb;_0x49136f++){var _0x542a9=events[_0x49136f];var _0x2bf4b8=createListener(_0xac18('0x8')+_0x542a9,_0x395493);ChatMessageEvents['on'](_0x542a9,_0x2bf4b8);}}; \ No newline at end of file +var _0xf873=['register','length','chatMessage:','save','remove','update','emit'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xf873,0xb2));var _0x3f87=function(_0x22794a,_0x3ac10c){_0x22794a=_0x22794a-0x0;var _0x4de8b=_0xf873[_0x22794a];return _0x4de8b;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x3f87('0x0'),_0x3f87('0x1'),_0x3f87('0x2')];function createListener(_0x3ef688,_0x1c56a3){return function(_0xd4592c){_0x1c56a3[_0x3f87('0x3')](_0x3ef688,_0xd4592c);};}function removeListener(_0x1d68dd,_0x3c80d6){return function(){ChatMessageEvents['removeListener'](_0x1d68dd,_0x3c80d6);};}exports[_0x3f87('0x4')]=function(_0x43c8e4){for(var _0x27c03e=0x0,_0x5a5e37=events[_0x3f87('0x5')];_0x27c03e<_0x5a5e37;_0x27c03e++){var _0x2c7ccc=events[_0x27c03e];var _0x3b8e92=createListener(_0x3f87('0x6')+_0x2c7ccc,_0x43c8e4);ChatMessageEvents['on'](_0x2c7ccc,_0x3b8e92);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e3e30a3..02a0059 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 _0xa7da=['../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','describe','/:id','show','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x10482c,_0x3cf4fa){var _0x8362fa=function(_0x2b0132){while(--_0x2b0132){_0x10482c['push'](_0x10482c['shift']());}};_0x8362fa(++_0x3cf4fa);}(_0xa7da,0x123));var _0xaa7d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa7da[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xaa7d('0x0'));var util=require(_0xaa7d('0x1'));var path=require(_0xaa7d('0x2'));var timeout=require('connect-timeout');var express=require(_0xaa7d('0x3'));var router=express[_0xaa7d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaa7d('0x5'));var interaction=require(_0xaa7d('0x6'));var config=require(_0xaa7d('0x7'));var controller=require(_0xaa7d('0x8'));router['get']('/',auth[_0xaa7d('0x9')](),controller[_0xaa7d('0xa')]);router[_0xaa7d('0xb')]('/describe',auth[_0xaa7d('0x9')](),controller[_0xaa7d('0xc')]);router[_0xaa7d('0xb')](_0xaa7d('0xd'),auth['isAuthenticated'](),controller[_0xaa7d('0xe')]);router['post']('/',auth[_0xaa7d('0x9')](),interaction['tracked'](_0xaa7d('0xf'),_0xaa7d('0x10')),controller[_0xaa7d('0x11')]);router[_0xaa7d('0x12')](_0xaa7d('0xd'),controller[_0xaa7d('0x13')]);router[_0xaa7d('0x12')](_0xaa7d('0x14'),auth['isAuthenticated'](),controller[_0xaa7d('0x15')]);router['put'](_0xaa7d('0x16'),auth[_0xaa7d('0x9')](),controller[_0xaa7d('0x17')]);router[_0xaa7d('0x18')]('/:id',auth[_0xaa7d('0x9')](),controller[_0xaa7d('0x19')]);module[_0xaa7d('0x1a')]=router; \ No newline at end of file +var _0x0fa1=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','tracked','chatmessage:create','create','put','/:id/accept','accept','/:id/reject','delete','exports','multer','util','Router','../../components/auth/service'];(function(_0x4bd629,_0x1114bf){var _0x585c2d=function(_0x15644f){while(--_0x15644f){_0x4bd629['push'](_0x4bd629['shift']());}};_0x585c2d(++_0x1114bf);}(_0x0fa1,0x6f));var _0x10fa=function(_0x4236d7,_0x155ab4){_0x4236d7=_0x4236d7-0x0;var _0x19581a=_0x0fa1[_0x4236d7];return _0x19581a;};'use strict';var multer=require(_0x10fa('0x0'));var util=require(_0x10fa('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x10fa('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x10fa('0x3'));var interaction=require(_0x10fa('0x4'));var config=require(_0x10fa('0x5'));var controller=require(_0x10fa('0x6'));router[_0x10fa('0x7')]('/',auth[_0x10fa('0x8')](),controller[_0x10fa('0x9')]);router[_0x10fa('0x7')]('/describe',auth[_0x10fa('0x8')](),controller[_0x10fa('0xa')]);router[_0x10fa('0x7')](_0x10fa('0xb'),auth[_0x10fa('0x8')](),controller[_0x10fa('0xc')]);router[_0x10fa('0xd')]('/',auth[_0x10fa('0x8')](),interaction[_0x10fa('0xe')]('chat',_0x10fa('0xf')),controller[_0x10fa('0x10')]);router[_0x10fa('0x11')]('/:id',controller['update']);router['put'](_0x10fa('0x12'),auth[_0x10fa('0x8')](),controller[_0x10fa('0x13')]);router[_0x10fa('0x11')](_0x10fa('0x14'),auth['isAuthenticated'](),controller['reject']);router[_0x10fa('0x15')](_0x10fa('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x10fa('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 1a907bb..3c7f216 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(_0x2714eb,_0x554280){var _0x1da83d=function(_0x16eca6){while(--_0x16eca6){_0x2714eb['push'](_0x2714eb['shift']());}};_0x1da83d(++_0x554280);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'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 _0x0b0e=['medium','sequelize','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x1c7b4c,_0x5b85b2){_0x1c7b4c=_0x1c7b4c-0x0;var _0x18daf6=_0x0b0e[_0x1c7b4c];return _0x18daf6;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xe0b0('0x1')](_0xe0b0('0x2')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9b4779b..2d4aa49 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 _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(_0x1fc04a,_0x199982){var _0xbe31ad=function(_0x5537dc){while(--_0x5537dc){_0x1fc04a['push'](_0x1fc04a['shift']());}};_0xbe31ad(++_0x199982);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +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(_0x20a6ab,_0x53d608){var _0xcba6fc=function(_0x4037e5){while(--_0x4037e5){_0x20a6ab['push'](_0x20a6ab['shift']());}};_0xcba6fc(++_0x53d608);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 845f378..8f1d9d3 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 _0xd4f7=['events','setMaxListeners','save','update','emit','hook','exports'];(function(_0xdad237,_0x361a1d){var _0x15c575=function(_0x8db2f6){while(--_0x8db2f6){_0xdad237['push'](_0xdad237['shift']());}};_0x15c575(++_0x361a1d);}(_0xd4f7,0x8c));var _0x7d4f=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0xd4f7[_0x492af5];return _0x59f529;};'use strict';var EventEmitter=require(_0x7d4f('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7d4f('0x1')](0x0);var events={'afterCreate':_0x7d4f('0x2'),'afterUpdate':_0x7d4f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b4844){return function(_0x5dd1ed,_0x1d0a46,_0x4d0d59){ChatOfflineMessageEvents[_0x7d4f('0x4')](_0x2b4844+':'+_0x5dd1ed['id'],_0x5dd1ed);ChatOfflineMessageEvents[_0x7d4f('0x4')](_0x2b4844,_0x5dd1ed);_0x4d0d59(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x7d4f('0x5')](e,emitEvent(event));}}module[_0x7d4f('0x6')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x3e51=['emit','hook','exports','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x326a61,_0x2d21b6){var _0x4ea93e=function(_0x4a706e){while(--_0x4a706e){_0x326a61['push'](_0x326a61['shift']());}};_0x4ea93e(++_0x2d21b6);}(_0x3e51,0xa3));var _0x13e5=function(_0x13c377,_0x498416){_0x13c377=_0x13c377-0x0;var _0x36f033=_0x3e51[_0x13c377];return _0x36f033;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x13e5('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x13e5('0x1')](0x0);var events={'afterCreate':_0x13e5('0x2'),'afterUpdate':_0x13e5('0x3'),'afterDestroy':_0x13e5('0x4')};function emitEvent(_0x54f10d){return function(_0x23c868,_0x203c53,_0x4f1010){ChatOfflineMessageEvents[_0x13e5('0x5')](_0x54f10d+':'+_0x23c868['id'],_0x23c868);ChatOfflineMessageEvents[_0x13e5('0x5')](_0x54f10d,_0x23c868);_0x4f1010(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x13e5('0x6')](e,emitEvent(event));}}module[_0x13e5('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 98aa264..727188d 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 _0x1a63=['chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x40ab54,_0x486321){var _0x2cd51f=function(_0x162971){while(--_0x162971){_0x40ab54['push'](_0x40ab54['shift']());}};_0x2cd51f(++_0x486321);}(_0x1a63,0xf7));var _0x31a6=function(_0x1a9cdb,_0x5ac842){_0x1a9cdb=_0x1a9cdb-0x0;var _0x42d97f=_0x1a63[_0x1a9cdb];return _0x42d97f;};'use strict';var attributes=require(_0x31a6('0x0'));module['exports']=function(_0x349234){return _0x349234[_0x31a6('0x1')](_0x31a6('0x2'),attributes,{'tableName':_0x31a6('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x31a6('0x4')});}; \ No newline at end of file +var _0x5e4d=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x483eff,_0x1b5e73){var _0x13ecf8=function(_0x530028){while(--_0x530028){_0x483eff['push'](_0x483eff['shift']());}};_0x13ecf8(++_0x1b5e73);}(_0x5e4d,0x67));var _0xd5e4=function(_0x107a46,_0x472a99){_0x107a46=_0x107a46-0x0;var _0xb4b07f=_0x5e4d[_0x107a46];return _0xb4b07f;};'use strict';var attributes=require(_0xd5e4('0x0'));module[_0xd5e4('0x1')]=function(_0x41a145){return _0x41a145[_0xd5e4('0x2')](_0xd5e4('0x3'),attributes,{'tableName':_0xd5e4('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd5e4('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 973f10b..8cea47a 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 _0xb5fc=['client','request','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x590d49,_0x130f80){var _0x1ca79b=function(_0x35e777){while(--_0x35e777){_0x590d49['push'](_0x590d49['shift']());}};_0x1ca79b(++_0x130f80);}(_0xb5fc,0x71));var _0xcb5f=function(_0x233425,_0x4a8a59){_0x233425=_0x233425-0x0;var _0xd87764=_0xb5fc[_0x233425];return _0xd87764;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcb5f('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb5f('0x1'))['db'];var utils=require(_0xcb5f('0x2'));var logger=require(_0xcb5f('0x3'))(_0xcb5f('0x4'));var config=require(_0xcb5f('0x5'));var jayson=require(_0xcb5f('0x6'));var client=jayson[_0xcb5f('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13abe7,_0x48cfe1,_0x1dfeb0){return new BPromise(function(_0x29308d,_0x36535f){return client[_0xcb5f('0x8')](_0x13abe7,_0x1dfeb0)['then'](function(_0x2165f6){logger[_0xcb5f('0x9')]('ChatOfflineMessage,\x20%s,\x20%s',_0x48cfe1,_0xcb5f('0xa'));logger[_0xcb5f('0xb')](_0xcb5f('0xc'),_0x48cfe1,_0xcb5f('0xa'),JSON[_0xcb5f('0xd')](_0x2165f6));if(_0x2165f6[_0xcb5f('0xe')]){if(_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0xf')]===0x1f4){logger[_0xcb5f('0xe')](_0xcb5f('0x10'),_0x48cfe1,_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0x11')]);return _0x36535f(_0x2165f6['error'][_0xcb5f('0x11')]);}logger[_0xcb5f('0xe')](_0xcb5f('0x10'),_0x48cfe1,_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0x11')]);return _0x29308d(_0x2165f6[_0xcb5f('0xe')][_0xcb5f('0x11')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x48cfe1,_0xcb5f('0xa'));_0x29308d(_0x2165f6[_0xcb5f('0x12')][_0xcb5f('0x11')]);}})[_0xcb5f('0x13')](function(_0x3909be){logger[_0xcb5f('0xe')](_0xcb5f('0x10'),_0x48cfe1,_0x3909be);_0x36535f(_0x3909be);});});} \ No newline at end of file +var _0x4453=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3d830b,_0x4bb447){var _0x247ec8=function(_0xe041cd){while(--_0xe041cd){_0x3d830b['push'](_0x3d830b['shift']());}};_0x247ec8(++_0x4bb447);}(_0x4453,0x9c));var _0x3445=function(_0x1b0bb1,_0x5a0540){_0x1b0bb1=_0x1b0bb1-0x0;var _0x11c001=_0x4453[_0x1b0bb1];return _0x11c001;};'use strict';var _=require(_0x3445('0x0'));var util=require(_0x3445('0x1'));var moment=require('moment');var BPromise=require(_0x3445('0x2'));var rs=require(_0x3445('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3445('0x4'))['db'];var utils=require(_0x3445('0x5'));var logger=require(_0x3445('0x6'))(_0x3445('0x7'));var config=require(_0x3445('0x8'));var jayson=require(_0x3445('0x9'));var client=jayson[_0x3445('0xa')][_0x3445('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x297c26,_0x214619,_0x4b52f0){return new BPromise(function(_0x3f3a99,_0xc81616){return client[_0x3445('0xc')](_0x297c26,_0x4b52f0)[_0x3445('0xd')](function(_0x2770bb){logger[_0x3445('0xe')](_0x3445('0xf'),_0x214619,'request\x20sent');logger[_0x3445('0x10')](_0x3445('0x11'),_0x214619,_0x3445('0x12'),JSON[_0x3445('0x13')](_0x2770bb));if(_0x2770bb['error']){if(_0x2770bb[_0x3445('0x14')][_0x3445('0x15')]===0x1f4){logger[_0x3445('0x14')](_0x3445('0xf'),_0x214619,_0x2770bb[_0x3445('0x14')][_0x3445('0x16')]);return _0xc81616(_0x2770bb[_0x3445('0x14')]['message']);}logger['error'](_0x3445('0xf'),_0x214619,_0x2770bb['error'][_0x3445('0x16')]);return _0x3f3a99(_0x2770bb['error'][_0x3445('0x16')]);}else{logger[_0x3445('0xe')](_0x3445('0xf'),_0x214619,_0x3445('0x12'));_0x3f3a99(_0x2770bb[_0x3445('0x17')][_0x3445('0x16')]);}})[_0x3445('0x18')](function(_0x4d9a55){logger[_0x3445('0x14')](_0x3445('0xf'),_0x214619,_0x4d9a55);_0xc81616(_0x4d9a55);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 69de8a8..bd476c1 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 _0xa923=['create','put','/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show','post'];(function(_0x483225,_0x134cbd){var _0x21c51b=function(_0x23dd0e){while(--_0x23dd0e){_0x483225['push'](_0x483225['shift']());}};_0x21c51b(++_0x134cbd);}(_0xa923,0xe2));var _0x3a92=function(_0x295557,_0x548d1d){_0x295557=_0x295557-0x0;var _0x251ba3=_0xa923[_0x295557];return _0x251ba3;};'use strict';var multer=require(_0x3a92('0x0'));var util=require(_0x3a92('0x1'));var path=require('path');var timeout=require(_0x3a92('0x2'));var express=require(_0x3a92('0x3'));var router=express[_0x3a92('0x4')]();var fs_extra=require(_0x3a92('0x5'));var auth=require(_0x3a92('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a92('0x7'));var controller=require('./chatOfflineMessage.controller');router[_0x3a92('0x8')]('/',auth[_0x3a92('0x9')](),controller['index']);router['get']('/describe',auth[_0x3a92('0x9')](),controller['describe']);router[_0x3a92('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x3a92('0xa')]);router[_0x3a92('0xb')]('/',auth[_0x3a92('0x9')](),controller[_0x3a92('0xc')]);router[_0x3a92('0xd')](_0x3a92('0xe'),auth[_0x3a92('0x9')](),controller['update']);router['delete'](_0x3a92('0xe'),auth[_0x3a92('0x9')](),controller[_0x3a92('0xf')]);module[_0x3a92('0x10')]=router; \ No newline at end of file +var _0xf6aa=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatOfflineMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','post','create','put'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xf6aa,0x1e8));var _0xaf6a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf6aa[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0xaf6a('0x0'));var util=require(_0xaf6a('0x1'));var path=require(_0xaf6a('0x2'));var timeout=require(_0xaf6a('0x3'));var express=require(_0xaf6a('0x4'));var router=express['Router']();var fs_extra=require(_0xaf6a('0x5'));var auth=require(_0xaf6a('0x6'));var interaction=require(_0xaf6a('0x7'));var config=require('../../config/environment');var controller=require(_0xaf6a('0x8'));router[_0xaf6a('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf6a('0xa')]);router[_0xaf6a('0x9')](_0xaf6a('0xb'),auth[_0xaf6a('0xc')](),controller[_0xaf6a('0xd')]);router[_0xaf6a('0x9')](_0xaf6a('0xe'),auth[_0xaf6a('0xc')](),controller['show']);router[_0xaf6a('0xf')]('/',auth[_0xaf6a('0xc')](),controller[_0xaf6a('0x10')]);router[_0xaf6a('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xaf6a('0x12')]);router[_0xaf6a('0x13')](_0xaf6a('0xe'),auth[_0xaf6a('0xc')](),controller[_0xaf6a('0x14')]);module[_0xaf6a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 4352c98..d5d1b17 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 _0xdf73=['exports','STRING','mouseOver','timeout','INTEGER','sequelize'];(function(_0x3e07f5,_0x399410){var _0x22d810=function(_0x36c4b2){while(--_0x36c4b2){_0x3e07f5['push'](_0x3e07f5['shift']());}};_0x22d810(++_0x399410);}(_0xdf73,0x155));var _0x3df7=function(_0x2da978,_0xe13cb6){_0x2da978=_0x2da978-0x0;var _0x3785d6=_0xdf73[_0x2da978];return _0x3785d6;};'use strict';var Sequelize=require(_0x3df7('0x0'));module[_0x3df7('0x1')]={'name':{'type':Sequelize[_0x3df7('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x3df7('0x3'),_0x3df7('0x4')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3df7('0x5')]}}; \ No newline at end of file +var _0x1763=['mouseOver','timeout','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x1763,0x8f));var _0x3176=function(_0x593de6,_0x569391){_0x593de6=_0x593de6-0x0;var _0x455fa2=_0x1763[_0x593de6];return _0x455fa2;};'use strict';var Sequelize=require(_0x3176('0x0'));module[_0x3176('0x1')]={'name':{'type':Sequelize[_0x3176('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3176('0x3')](_0x3176('0x4'),_0x3176('0x5')),'defaultValue':_0x3176('0x4')},'selector':{'type':Sequelize[_0x3176('0x2')]},'timeout':{'type':Sequelize[_0x3176('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 1e99342..fdeda20 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 _0x0bde=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','save','then','stack','name','params','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','include','find','catch','create','ChatProactiveAction','body','update','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x227944,_0x2a00e5){var _0x3d884d=function(_0x121139){while(--_0x121139){_0x227944['push'](_0x227944['shift']());}};_0x3d884d(++_0x2a00e5);}(_0x0bde,0x110));var _0xe0bd=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0bde[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0xe0bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0bd('0x1'));var jsonpatch=require(_0xe0bd('0x2'));var rp=require('request-promise');var moment=require(_0xe0bd('0x3'));var BPromise=require(_0xe0bd('0x4'));var Mustache=require(_0xe0bd('0x5'));var util=require('util');var path=require(_0xe0bd('0x6'));var sox=require(_0xe0bd('0x7'));var csv=require(_0xe0bd('0x8'));var ejs=require(_0xe0bd('0x9'));var fs=require('fs');var fs_extra=require(_0xe0bd('0xa'));var _=require(_0xe0bd('0xb'));var squel=require(_0xe0bd('0xc'));var crypto=require(_0xe0bd('0xd'));var jsforce=require(_0xe0bd('0xe'));var deskjs=require(_0xe0bd('0xf'));var toCsv=require(_0xe0bd('0x8'));var querystring=require(_0xe0bd('0x10'));var Papa=require(_0xe0bd('0x11'));var Redis=require('ioredis');var authService=require(_0xe0bd('0x12'));var qs=require(_0xe0bd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe0bd('0x14'));var logger=require('../../config/logger')(_0xe0bd('0x15'));var utils=require(_0xe0bd('0x16'));var config=require(_0xe0bd('0x17'));var licenseUtil=require(_0xe0bd('0x18'));var db=require(_0xe0bd('0x19'))['db'];function respondWithStatusCode(_0x16c3a9,_0x1905b2){_0x1905b2=_0x1905b2||0xcc;return function(_0x500a9e){if(_0x500a9e){return _0x16c3a9[_0xe0bd('0x1a')](_0x1905b2);}return _0x16c3a9[_0xe0bd('0x1b')](_0x1905b2)[_0xe0bd('0x1c')]();};}function respondWithResult(_0x5c76f1,_0x479438){_0x479438=_0x479438||0xc8;return function(_0x48afde){if(_0x48afde){return _0x5c76f1[_0xe0bd('0x1b')](_0x479438)[_0xe0bd('0x1d')](_0x48afde);}};}function respondWithFilteredResult(_0x3f5ef7,_0x3042e1){return function(_0x361429){if(_0x361429){var _0x302f5f=typeof _0x3042e1[_0xe0bd('0x1e')]===_0xe0bd('0x1f')&&typeof _0x3042e1['limit']==='undefined';var _0x2d2ba3=_0x361429[_0xe0bd('0x20')];var _0x1c4533=_0x302f5f?0x0:_0x3042e1[_0xe0bd('0x1e')];var _0xa6be32=_0x302f5f?_0x361429[_0xe0bd('0x20')]:_0x3042e1['offset']+_0x3042e1['limit'];var _0x29bd21;if(_0xa6be32>=_0x2d2ba3){_0xa6be32=_0x2d2ba3;_0x29bd21=0xc8;}else{_0x29bd21=0xce;}_0x3f5ef7[_0xe0bd('0x1b')](_0x29bd21);return _0x3f5ef7[_0xe0bd('0x21')](_0xe0bd('0x22'),_0x1c4533+'-'+_0xa6be32+'/'+_0x2d2ba3)[_0xe0bd('0x1d')](_0x361429);}return null;};}function patchUpdates(_0x154480){return function(_0x3dbd98){try{jsonpatch['apply'](_0x3dbd98,_0x154480,!![]);}catch(_0x5ad8bf){return BPromise[_0xe0bd('0x23')](_0x5ad8bf);}return _0x3dbd98[_0xe0bd('0x24')]();};}function saveUpdates(_0x3927ab,_0xdcb789){return function(_0x290c1e){if(_0x290c1e){return _0x290c1e['update'](_0x3927ab)[_0xe0bd('0x25')](function(_0x4795ac){return _0x4795ac;});}return null;};}function removeEntity(_0x242cbe,_0x296f64){return function(_0x3f24b6){if(_0x3f24b6){return _0x3f24b6['destroy']()[_0xe0bd('0x25')](function(){_0x242cbe[_0xe0bd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41ca10,_0x5e6496){return function(_0x2debcb){if(!_0x2debcb){_0x41ca10['sendStatus'](0x194);}return _0x2debcb;};}function handleError(_0x198a1c,_0x72e284){_0x72e284=_0x72e284||0x1f4;return function(_0x3c851d){logger['error'](_0x3c851d[_0xe0bd('0x26')]);if(_0x3c851d['name']){delete _0x3c851d[_0xe0bd('0x27')];}_0x198a1c[_0xe0bd('0x1b')](_0x72e284)['send'](_0x3c851d);};}exports['show']=function(_0x273b95,_0x3789a1){var _0x441475={'raw':!![],'where':{'id':_0x273b95[_0xe0bd('0x28')]['id']}},_0x23a317={};_0x23a317[_0xe0bd('0x29')]=_[_0xe0bd('0x2a')](db['ChatProactiveAction'][_0xe0bd('0x2b')]);_0x23a317[_0xe0bd('0x2c')]=_[_0xe0bd('0x2a')](_0x273b95[_0xe0bd('0x2c')]);_0x23a317[_0xe0bd('0x2d')]=_[_0xe0bd('0x2e')](_0x23a317['model'],_0x23a317[_0xe0bd('0x2c')]);_0x441475[_0xe0bd('0x2f')]=_[_0xe0bd('0x2e')](_0x23a317[_0xe0bd('0x29')],qs[_0xe0bd('0x30')](_0x273b95[_0xe0bd('0x2c')][_0xe0bd('0x30')]));_0x441475[_0xe0bd('0x2f')]=_0x441475['attributes']['length']?_0x441475[_0xe0bd('0x2f')]:_0x23a317[_0xe0bd('0x29')];if(_0x273b95[_0xe0bd('0x2c')][_0xe0bd('0x31')]){_0x441475[_0xe0bd('0x32')]=[{'all':!![]}];}_0x441475=_['merge']({},_0x441475,_0x273b95['options']);return db['ChatProactiveAction'][_0xe0bd('0x33')](_0x441475)[_0xe0bd('0x25')](handleEntityNotFound(_0x3789a1,null))[_0xe0bd('0x25')](respondWithResult(_0x3789a1,null))[_0xe0bd('0x34')](handleError(_0x3789a1,null));};exports[_0xe0bd('0x35')]=function(_0x3df4c8,_0x4b48f5){return db[_0xe0bd('0x36')][_0xe0bd('0x35')](_0x3df4c8[_0xe0bd('0x37')],{})['then'](respondWithResult(_0x4b48f5,0xc9))[_0xe0bd('0x34')](handleError(_0x4b48f5,null));};exports[_0xe0bd('0x38')]=function(_0x4e56d9,_0x193f94){if(_0x4e56d9[_0xe0bd('0x37')]['id']){delete _0x4e56d9[_0xe0bd('0x37')]['id'];}return db['ChatProactiveAction'][_0xe0bd('0x33')]({'where':{'id':_0x4e56d9['params']['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x193f94,null))[_0xe0bd('0x25')](saveUpdates(_0x4e56d9[_0xe0bd('0x37')],null))[_0xe0bd('0x25')](respondWithResult(_0x193f94,null))['catch'](handleError(_0x193f94,null));};exports[_0xe0bd('0x39')]=function(_0x184ac4,_0x7f9272){return db['ChatProactiveAction']['find']({'where':{'id':_0x184ac4[_0xe0bd('0x28')]['id']}})[_0xe0bd('0x25')](handleEntityNotFound(_0x7f9272,null))[_0xe0bd('0x25')](removeEntity(_0x7f9272,null))['catch'](handleError(_0x7f9272,null));}; \ No newline at end of file +var _0xe6c1=['apply','reject','then','destroy','error','stack','name','send','show','model','keys','ChatProactiveAction','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','catch','update','params','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','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','end','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x1feb91,_0x2d6c7f){var _0x41de30=function(_0x1263df){while(--_0x1263df){_0x1feb91['push'](_0x1feb91['shift']());}};_0x41de30(++_0x2d6c7f);}(_0xe6c1,0xd8));var _0x1e6c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe6c1[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e6c('0x0'));var zipdir=require(_0x1e6c('0x1'));var jsonpatch=require(_0x1e6c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1e6c('0x3'));var Mustache=require(_0x1e6c('0x4'));var util=require(_0x1e6c('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e6c('0x6'));var _=require(_0x1e6c('0x7'));var squel=require(_0x1e6c('0x8'));var crypto=require(_0x1e6c('0x9'));var jsforce=require(_0x1e6c('0xa'));var deskjs=require(_0x1e6c('0xb'));var toCsv=require(_0x1e6c('0xc'));var querystring=require(_0x1e6c('0xd'));var Papa=require(_0x1e6c('0xe'));var Redis=require(_0x1e6c('0xf'));var authService=require(_0x1e6c('0x10'));var qs=require(_0x1e6c('0x11'));var as=require(_0x1e6c('0x12'));var hardwareService=require(_0x1e6c('0x13'));var logger=require(_0x1e6c('0x14'))(_0x1e6c('0x15'));var utils=require(_0x1e6c('0x16'));var config=require(_0x1e6c('0x17'));var licenseUtil=require(_0x1e6c('0x18'));var db=require(_0x1e6c('0x19'))['db'];function respondWithStatusCode(_0x24c4cf,_0x4a76aa){_0x4a76aa=_0x4a76aa||0xcc;return function(_0x1bff58){if(_0x1bff58){return _0x24c4cf[_0x1e6c('0x1a')](_0x4a76aa);}return _0x24c4cf['status'](_0x4a76aa)[_0x1e6c('0x1b')]();};}function respondWithResult(_0x293712,_0x121326){_0x121326=_0x121326||0xc8;return function(_0x51489b){if(_0x51489b){return _0x293712[_0x1e6c('0x1c')](_0x121326)[_0x1e6c('0x1d')](_0x51489b);}};}function respondWithFilteredResult(_0x3ef544,_0x556244){return function(_0x1e8769){if(_0x1e8769){var _0x30cff0=typeof _0x556244[_0x1e6c('0x1e')]===_0x1e6c('0x1f')&&typeof _0x556244[_0x1e6c('0x20')]==='undefined';var _0x42a511=_0x1e8769[_0x1e6c('0x21')];var _0xe3ec5d=_0x30cff0?0x0:_0x556244[_0x1e6c('0x1e')];var _0x4dc9d3=_0x30cff0?_0x1e8769[_0x1e6c('0x21')]:_0x556244[_0x1e6c('0x1e')]+_0x556244['limit'];var _0x576fac;if(_0x4dc9d3>=_0x42a511){_0x4dc9d3=_0x42a511;_0x576fac=0xc8;}else{_0x576fac=0xce;}_0x3ef544[_0x1e6c('0x1c')](_0x576fac);return _0x3ef544[_0x1e6c('0x22')](_0x1e6c('0x23'),_0xe3ec5d+'-'+_0x4dc9d3+'/'+_0x42a511)[_0x1e6c('0x1d')](_0x1e8769);}return null;};}function patchUpdates(_0x3fa599){return function(_0x52eb0c){try{jsonpatch[_0x1e6c('0x24')](_0x52eb0c,_0x3fa599,!![]);}catch(_0x444784){return BPromise[_0x1e6c('0x25')](_0x444784);}return _0x52eb0c['save']();};}function saveUpdates(_0x4b9484,_0x8dd01e){return function(_0x356df1){if(_0x356df1){return _0x356df1['update'](_0x4b9484)[_0x1e6c('0x26')](function(_0x5efe57){return _0x5efe57;});}return null;};}function removeEntity(_0x4b5592,_0x2e92d5){return function(_0x2494b4){if(_0x2494b4){return _0x2494b4[_0x1e6c('0x27')]()[_0x1e6c('0x26')](function(){_0x4b5592[_0x1e6c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2bdd9e,_0x3fa4d7){return function(_0x530fff){if(!_0x530fff){_0x2bdd9e[_0x1e6c('0x1a')](0x194);}return _0x530fff;};}function handleError(_0x37df4b,_0x586cad){_0x586cad=_0x586cad||0x1f4;return function(_0x513338){logger[_0x1e6c('0x28')](_0x513338[_0x1e6c('0x29')]);if(_0x513338[_0x1e6c('0x2a')]){delete _0x513338[_0x1e6c('0x2a')];}_0x37df4b['status'](_0x586cad)[_0x1e6c('0x2b')](_0x513338);};}exports[_0x1e6c('0x2c')]=function(_0x1f8d2b,_0x9e2f3c){var _0x247a57={'raw':!![],'where':{'id':_0x1f8d2b['params']['id']}},_0x485620={};_0x485620[_0x1e6c('0x2d')]=_[_0x1e6c('0x2e')](db[_0x1e6c('0x2f')]['rawAttributes']);_0x485620[_0x1e6c('0x30')]=_[_0x1e6c('0x2e')](_0x1f8d2b[_0x1e6c('0x30')]);_0x485620[_0x1e6c('0x31')]=_[_0x1e6c('0x32')](_0x485620[_0x1e6c('0x2d')],_0x485620['query']);_0x247a57[_0x1e6c('0x33')]=_['intersection'](_0x485620[_0x1e6c('0x2d')],qs[_0x1e6c('0x34')](_0x1f8d2b['query'][_0x1e6c('0x34')]));_0x247a57[_0x1e6c('0x33')]=_0x247a57[_0x1e6c('0x33')][_0x1e6c('0x35')]?_0x247a57['attributes']:_0x485620[_0x1e6c('0x2d')];if(_0x1f8d2b[_0x1e6c('0x30')][_0x1e6c('0x36')]){_0x247a57[_0x1e6c('0x37')]=[{'all':!![]}];}_0x247a57=_[_0x1e6c('0x38')]({},_0x247a57,_0x1f8d2b['options']);return db[_0x1e6c('0x2f')][_0x1e6c('0x39')](_0x247a57)[_0x1e6c('0x26')](handleEntityNotFound(_0x9e2f3c,null))[_0x1e6c('0x26')](respondWithResult(_0x9e2f3c,null))['catch'](handleError(_0x9e2f3c,null));};exports[_0x1e6c('0x3a')]=function(_0x4153d6,_0xfc87ac){return db[_0x1e6c('0x2f')]['create'](_0x4153d6[_0x1e6c('0x3b')],{})['then'](respondWithResult(_0xfc87ac,0xc9))[_0x1e6c('0x3c')](handleError(_0xfc87ac,null));};exports[_0x1e6c('0x3d')]=function(_0x35539e,_0x28421b){if(_0x35539e['body']['id']){delete _0x35539e[_0x1e6c('0x3b')]['id'];}return db[_0x1e6c('0x2f')][_0x1e6c('0x39')]({'where':{'id':_0x35539e[_0x1e6c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x28421b,null))[_0x1e6c('0x26')](saveUpdates(_0x35539e[_0x1e6c('0x3b')],null))['then'](respondWithResult(_0x28421b,null))[_0x1e6c('0x3c')](handleError(_0x28421b,null));};exports[_0x1e6c('0x27')]=function(_0x33ede4,_0x174f85){return db['ChatProactiveAction']['find']({'where':{'id':_0x33ede4[_0x1e6c('0x3e')]['id']}})[_0x1e6c('0x26')](handleEntityNotFound(_0x174f85,null))['then'](removeEntity(_0x174f85,null))[_0x1e6c('0x3c')](handleError(_0x174f85,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index bacece3..b5b3304 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 _0x6c12=['define','chat_proactive_actions','lodash','../../config/logger','api','moment','../../config/environment','./chatProactiveAction.attributes','exports'];(function(_0x11add7,_0x2175d8){var _0x109ec9=function(_0x5037dd){while(--_0x5037dd){_0x11add7['push'](_0x11add7['shift']());}};_0x109ec9(++_0x2175d8);}(_0x6c12,0x158));var _0x26c1=function(_0x2998db,_0x3424f1){_0x2998db=_0x2998db-0x0;var _0x115fea=_0x6c12[_0x2998db];return _0x115fea;};'use strict';var _=require(_0x26c1('0x0'));var util=require('util');var logger=require(_0x26c1('0x1'))(_0x26c1('0x2'));var moment=require(_0x26c1('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(_0x26c1('0x4'));var attributes=require(_0x26c1('0x5'));module[_0x26c1('0x6')]=function(_0x24f7ab,_0x103bd7){return _0x24f7ab[_0x26c1('0x7')]('ChatProactiveAction',attributes,{'tableName':_0x26c1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x572e=['exports','define','chat_proactive_actions','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x20ba07,_0x2d72c9){var _0x3d652a=function(_0x35b697){while(--_0x35b697){_0x20ba07['push'](_0x20ba07['shift']());}};_0x3d652a(++_0x2d72c9);}(_0x572e,0x1dc));var _0xe572=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x572e[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0xe572('0x0'));var util=require(_0xe572('0x1'));var logger=require('../../config/logger')(_0xe572('0x2'));var moment=require('moment');var BPromise=require(_0xe572('0x3'));var rp=require(_0xe572('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe572('0x5'));var config=require(_0xe572('0x6'));var attributes=require(_0xe572('0x7'));module[_0xe572('0x8')]=function(_0x3bc813,_0x1ab7fd){return _0x3bc813[_0xe572('0x9')]('ChatProactiveAction',attributes,{'tableName':_0xe572('0xa'),'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 ad80fda..ab24948 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 _0x4c67=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36409b,_0x1e6d2d){var _0x3099e0=function(_0x8442f1){while(--_0x8442f1){_0x36409b['push'](_0x36409b['shift']());}};_0x3099e0(++_0x1e6d2d);}(_0x4c67,0x1cd));var _0x74c6=function(_0x55cd85,_0x176b6f){_0x55cd85=_0x55cd85-0x0;var _0x6e1010=_0x4c67[_0x55cd85];return _0x6e1010;};'use strict';var _=require(_0x74c6('0x0'));var util=require(_0x74c6('0x1'));var moment=require(_0x74c6('0x2'));var BPromise=require(_0x74c6('0x3'));var rs=require(_0x74c6('0x4'));var fs=require('fs');var Redis=require(_0x74c6('0x5'));var db=require(_0x74c6('0x6'))['db'];var utils=require(_0x74c6('0x7'));var logger=require(_0x74c6('0x8'))(_0x74c6('0x9'));var config=require(_0x74c6('0xa'));var jayson=require(_0x74c6('0xb'));var client=jayson[_0x74c6('0xc')][_0x74c6('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xf3a76e,_0x5d446c,_0x13a36d){return new BPromise(function(_0x3973d8,_0x36a3df){return client[_0x74c6('0xe')](_0xf3a76e,_0x13a36d)[_0x74c6('0xf')](function(_0x328138){logger['info'](_0x74c6('0x10'),_0x5d446c,'request\x20sent');logger[_0x74c6('0x11')](_0x74c6('0x12'),_0x5d446c,_0x74c6('0x13'),JSON['stringify'](_0x328138));if(_0x328138[_0x74c6('0x14')]){if(_0x328138['error'][_0x74c6('0x15')]===0x1f4){logger[_0x74c6('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x5d446c,_0x328138[_0x74c6('0x14')][_0x74c6('0x16')]);return _0x36a3df(_0x328138[_0x74c6('0x14')]['message']);}logger[_0x74c6('0x14')](_0x74c6('0x10'),_0x5d446c,_0x328138[_0x74c6('0x14')]['message']);return _0x3973d8(_0x328138[_0x74c6('0x14')]['message']);}else{logger[_0x74c6('0x17')]('ChatProactiveAction,\x20%s,\x20%s',_0x5d446c,_0x74c6('0x13'));_0x3973d8(_0x328138[_0x74c6('0x18')][_0x74c6('0x16')]);}})[_0x74c6('0x19')](function(_0x421fb4){logger['error'](_0x74c6('0x10'),_0x5d446c,_0x421fb4);_0x36a3df(_0x421fb4);});});} \ No newline at end of file +var _0xf1fb=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1d293f,_0x497df8){var _0x3f5106=function(_0x36e3d5){while(--_0x36e3d5){_0x1d293f['push'](_0x1d293f['shift']());}};_0x3f5106(++_0x497df8);}(_0xf1fb,0x1dc));var _0xbf1f=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xf1fb[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xbf1f('0x0'));var util=require(_0xbf1f('0x1'));var moment=require(_0xbf1f('0x2'));var BPromise=require(_0xbf1f('0x3'));var rs=require(_0xbf1f('0x4'));var fs=require('fs');var Redis=require(_0xbf1f('0x5'));var db=require(_0xbf1f('0x6'))['db'];var utils=require(_0xbf1f('0x7'));var logger=require(_0xbf1f('0x8'))('rpc');var config=require(_0xbf1f('0x9'));var jayson=require(_0xbf1f('0xa'));var client=jayson[_0xbf1f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x174704,_0x493ff8,_0x10f0c8){return new BPromise(function(_0x5d0380,_0x18e522){return client[_0xbf1f('0xc')](_0x174704,_0x10f0c8)[_0xbf1f('0xd')](function(_0x4d1616){logger[_0xbf1f('0xe')](_0xbf1f('0xf'),_0x493ff8,_0xbf1f('0x10'));logger[_0xbf1f('0x11')](_0xbf1f('0x12'),_0x493ff8,_0xbf1f('0x10'),JSON['stringify'](_0x4d1616));if(_0x4d1616['error']){if(_0x4d1616[_0xbf1f('0x13')][_0xbf1f('0x14')]===0x1f4){logger['error'](_0xbf1f('0xf'),_0x493ff8,_0x4d1616['error'][_0xbf1f('0x15')]);return _0x18e522(_0x4d1616['error'][_0xbf1f('0x15')]);}logger[_0xbf1f('0x13')](_0xbf1f('0xf'),_0x493ff8,_0x4d1616[_0xbf1f('0x13')][_0xbf1f('0x15')]);return _0x5d0380(_0x4d1616[_0xbf1f('0x13')][_0xbf1f('0x15')]);}else{logger[_0xbf1f('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x493ff8,_0xbf1f('0x10'));_0x5d0380(_0x4d1616[_0xbf1f('0x16')]['message']);}})[_0xbf1f('0x17')](function(_0x68a42d){logger[_0xbf1f('0x13')]('ChatProactiveAction,\x20%s,\x20%s',_0x493ff8,_0x68a42d);_0x18e522(_0x68a42d);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 4ff7aa7..82942e2 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 _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x5ced8b,_0x5f0335){var _0x535973=function(_0x44bf74){while(--_0x44bf74){_0x5ced8b['push'](_0x5ced8b['shift']());}};_0x535973(++_0x5f0335);}(_0xeec6,0x1c2));var _0x6eec=function(_0x13fd59,_0x2e05b1){_0x13fd59=_0x13fd59-0x0;var _0x2e6ce7=_0xeec6[_0x13fd59];return _0x2e6ce7;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file +var _0x7da7=['util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','show','isAuthenticated','create','put','delete','exports','multer'];(function(_0x56a871,_0x18b7fe){var _0x124954=function(_0x39b7a1){while(--_0x39b7a1){_0x56a871['push'](_0x56a871['shift']());}};_0x124954(++_0x18b7fe);}(_0x7da7,0x10d));var _0x77da=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x7da7[_0x4bd06e];return _0x85ebb;};'use strict';var multer=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var path=require(_0x77da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x77da('0x3')]();var fs_extra=require(_0x77da('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var controller=require('./chatProactiveAction.controller');router[_0x77da('0x7')](_0x77da('0x8'),auth['isAuthenticated'](),controller[_0x77da('0x9')]);router['post']('/',auth[_0x77da('0xa')](),controller[_0x77da('0xb')]);router[_0x77da('0xc')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['update']);router[_0x77da('0xd')](_0x77da('0x8'),auth[_0x77da('0xa')](),controller['destroy']);module[_0x77da('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 058fcda..61e53af 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 _0x1ee8=['beepall','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x62c4dc,_0x2b3a85){var _0x23cc7c=function(_0x23a4be){while(--_0x23a4be){_0x62c4dc['push'](_0x62c4dc['shift']());}};_0x23cc7c(++_0x2b3a85);}(_0x1ee8,0xc8));var _0x81ee=function(_0x523cb4,_0x4b3851){_0x523cb4=_0x523cb4-0x0;var _0x53f3f3=_0x1ee8[_0x523cb4];return _0x53f3f3;};'use strict';var Sequelize=require(_0x81ee('0x0'));module[_0x81ee('0x1')]={'name':{'type':Sequelize[_0x81ee('0x2')],'unique':_0x81ee('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x81ee('0x2')]},'timeout':{'type':Sequelize[_0x81ee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x81ee('0x5')](_0x81ee('0x6'),_0x81ee('0x7'),_0x81ee('0x8'))}}; \ No newline at end of file +var _0xfe42=['exports','name','STRING','INTEGER','ENUM','roundrobin','sequelize'];(function(_0x1cbc72,_0xf4ac51){var _0x37c8c2=function(_0x47bea0){while(--_0x47bea0){_0x1cbc72['push'](_0x1cbc72['shift']());}};_0x37c8c2(++_0xf4ac51);}(_0xfe42,0x102));var _0x2fe4=function(_0x38c940,_0xcc5de0){_0x38c940=_0x38c940-0x0;var _0xb74b09=_0xfe42[_0x38c940];return _0xb74b09;};'use strict';var Sequelize=require(_0x2fe4('0x0'));module[_0x2fe4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2fe4('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2fe4('0x3')]},'timeout':{'type':Sequelize[_0x2fe4('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fe4('0x5')]('rrmemory','beepall',_0x2fe4('0x6'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4c57e1d..f2629e4 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 _0xfdad=['agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','removeTeams','ids','select','field','from','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','emit','userChatQueue:remove','omit','spread','userChatQueue:save','isArray','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatQueue.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','ChatQueue,\x20%s,\x20%s','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','destroy','get','ChatQueues','UserProfileResource','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserChatQueue','findAll','User','findAndCountAll','UserId'];(function(_0x276ea1,_0x3e3b44){var _0x67c56f=function(_0x49f9b8){while(--_0x49f9b8){_0x276ea1['push'](_0x276ea1['shift']());}};_0x67c56f(++_0x3e3b44);}(_0xfdad,0x164));var _0xdfda=function(_0x201428,_0x677f88){_0x201428=_0x201428-0x0;var _0x1d68a3=_0xfdad[_0x201428];return _0x1d68a3;};'use strict';var emlformat=require(_0xdfda('0x0'));var rimraf=require(_0xdfda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdfda('0x2'));var rp=require(_0xdfda('0x3'));var moment=require('moment');var BPromise=require(_0xdfda('0x4'));var Mustache=require(_0xdfda('0x5'));var util=require(_0xdfda('0x6'));var path=require('path');var sox=require(_0xdfda('0x7'));var csv=require(_0xdfda('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfda('0x9'));var _=require(_0xdfda('0xa'));var squel=require(_0xdfda('0xb'));var crypto=require(_0xdfda('0xc'));var jsforce=require(_0xdfda('0xd'));var deskjs=require(_0xdfda('0xe'));var toCsv=require(_0xdfda('0x8'));var querystring=require(_0xdfda('0xf'));var Papa=require(_0xdfda('0x10'));var Redis=require(_0xdfda('0x11'));var authService=require(_0xdfda('0x12'));var qs=require(_0xdfda('0x13'));var as=require(_0xdfda('0x14'));var hardwareService=require(_0xdfda('0x15'));var logger=require(_0xdfda('0x16'))(_0xdfda('0x17'));var utils=require('../../config/utils');var config=require(_0xdfda('0x18'));var licenseUtil=require(_0xdfda('0x19'));var db=require(_0xdfda('0x1a'))['db'];config[_0xdfda('0x1b')]=_[_0xdfda('0x1c')](config['redis'],{'host':_0xdfda('0x1d'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdfda('0x1e'))[_0xdfda('0x1f')](socket);var jayson=require(_0xdfda('0x20'));var client=jayson['client'][_0xdfda('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x56020a,_0x4064f2,_0xf250d0,_0x19d124){return new BPromise(function(_0x3fe8ff,_0x55b626){var _0x5baf98=_0x19d124||client;return _0x5baf98[_0xdfda('0x22')](_0x56020a,_0xf250d0)[_0xdfda('0x23')](function(_0xd3457f){logger[_0xdfda('0x24')]('ChatQueue,\x20%s,\x20%s',_0x4064f2,_0xdfda('0x25'));logger[_0xdfda('0x26')](_0xdfda('0x27'),_0x4064f2,_0xdfda('0x25'),JSON['stringify'](_0xd3457f));if(_0xd3457f[_0xdfda('0x28')]){if(_0xd3457f[_0xdfda('0x28')][_0xdfda('0x29')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4064f2,_0xd3457f['error'][_0xdfda('0x2a')]);return _0x55b626(_0xd3457f['error'][_0xdfda('0x2a')]);}logger[_0xdfda('0x28')](_0xdfda('0x2b'),_0x4064f2,_0xd3457f[_0xdfda('0x28')][_0xdfda('0x2a')]);return _0x3fe8ff(_0xd3457f['error'][_0xdfda('0x2a')]);}else{logger[_0xdfda('0x24')]('ChatQueue,\x20%s,\x20%s',_0x4064f2,_0xdfda('0x25'));_0x3fe8ff(_0xd3457f['result']['message']);}})['catch'](function(_0xb2628c){logger[_0xdfda('0x28')](_0xdfda('0x2b'),_0x4064f2,_0xb2628c);_0x55b626(_0xb2628c);});});}function respondWithStatusCode(_0x483ce6,_0x23be54){_0x23be54=_0x23be54||0xcc;return function(_0x55b0e6){if(_0x55b0e6){return _0x483ce6[_0xdfda('0x2c')](_0x23be54);}return _0x483ce6[_0xdfda('0x2d')](_0x23be54)[_0xdfda('0x2e')]();};}function respondWithResult(_0x1d2ed0,_0x3f8534){_0x3f8534=_0x3f8534||0xc8;return function(_0xb4eac1){if(_0xb4eac1){return _0x1d2ed0[_0xdfda('0x2d')](_0x3f8534)[_0xdfda('0x2f')](_0xb4eac1);}};}function respondWithFilteredResult(_0x499438,_0x244799){return function(_0x57331a){if(_0x57331a){var _0x1e0f8f=typeof _0x244799['offset']===_0xdfda('0x30')&&typeof _0x244799[_0xdfda('0x31')]==='undefined';var _0x313228=_0x57331a[_0xdfda('0x32')];var _0x4351f6=_0x1e0f8f?0x0:_0x244799['offset'];var _0x29e8ac=_0x1e0f8f?_0x57331a[_0xdfda('0x32')]:_0x244799['offset']+_0x244799[_0xdfda('0x31')];var _0x5645a9;if(_0x29e8ac>=_0x313228){_0x29e8ac=_0x313228;_0x5645a9=0xc8;}else{_0x5645a9=0xce;}_0x499438[_0xdfda('0x2d')](_0x5645a9);return _0x499438[_0xdfda('0x33')](_0xdfda('0x34'),_0x4351f6+'-'+_0x29e8ac+'/'+_0x313228)[_0xdfda('0x2f')](_0x57331a);}return null;};}function patchUpdates(_0x19751a){return function(_0x1f244f){try{jsonpatch['apply'](_0x1f244f,_0x19751a,!![]);}catch(_0x1addf5){return BPromise['reject'](_0x1addf5);}return _0x1f244f['save']();};}function saveUpdates(_0x140aaa,_0x44a521){return function(_0x137031){if(_0x137031){return _0x137031['update'](_0x140aaa)['then'](function(_0x976db4){return _0x976db4;});}return null;};}function removeEntity(_0x5386ec,_0xcc78f1){return function(_0x378890){if(_0x378890){return _0x378890[_0xdfda('0x35')]()[_0xdfda('0x23')](function(){var _0x437618=_0x378890[_0xdfda('0x36')]({'plain':!![]});var _0x8b3916=_0xdfda('0x37');return db[_0xdfda('0x38')][_0xdfda('0x35')]({'where':{'type':_0x8b3916,'resourceId':_0x437618['id']}})['then'](function(){return _0x378890;});})[_0xdfda('0x23')](function(){_0x5386ec[_0xdfda('0x2d')](0xcc)[_0xdfda('0x2e')]();});}};}function handleEntityNotFound(_0x189523,_0x3012fa){return function(_0x463032){if(!_0x463032){_0x189523[_0xdfda('0x2c')](0x194);}return _0x463032;};}function handleError(_0x2a74c4,_0x4cb9db){_0x4cb9db=_0x4cb9db||0x1f4;return function(_0x55903c){logger[_0xdfda('0x28')](_0x55903c[_0xdfda('0x39')]);if(_0x55903c[_0xdfda('0x3a')]){delete _0x55903c[_0xdfda('0x3a')];}_0x2a74c4[_0xdfda('0x2d')](_0x4cb9db)[_0xdfda('0x3b')](_0x55903c);};}exports[_0xdfda('0x3c')]=function(_0x35ef0f,_0x112c08){var _0x445311={},_0x52dcbf={},_0x26717d={'count':0x0,'rows':[]};var _0x1bfa0a=_[_0xdfda('0x3d')](db[_0xdfda('0x3e')][_0xdfda('0x3f')],function(_0xf51df3){return{'name':_0xf51df3[_0xdfda('0x40')],'type':_0xf51df3[_0xdfda('0x41')][_0xdfda('0x42')]};});_0x52dcbf[_0xdfda('0x43')]=_[_0xdfda('0x3d')](_0x1bfa0a,_0xdfda('0x3a'));_0x52dcbf[_0xdfda('0x44')]=_['keys'](_0x35ef0f[_0xdfda('0x44')]);_0x52dcbf[_0xdfda('0x45')]=_[_0xdfda('0x46')](_0x52dcbf[_0xdfda('0x43')],_0x52dcbf[_0xdfda('0x44')]);_0x445311[_0xdfda('0x47')]=_['intersection'](_0x52dcbf[_0xdfda('0x43')],qs[_0xdfda('0x48')](_0x35ef0f[_0xdfda('0x44')][_0xdfda('0x48')]));_0x445311[_0xdfda('0x47')]=_0x445311[_0xdfda('0x47')][_0xdfda('0x49')]?_0x445311[_0xdfda('0x47')]:_0x52dcbf[_0xdfda('0x43')];if(!_0x35ef0f[_0xdfda('0x44')][_0xdfda('0x4a')](_0xdfda('0x4b'))){_0x445311['limit']=qs[_0xdfda('0x31')](_0x35ef0f[_0xdfda('0x44')][_0xdfda('0x31')]);_0x445311[_0xdfda('0x4c')]=qs[_0xdfda('0x4c')](_0x35ef0f['query']['offset']);}_0x445311[_0xdfda('0x4d')]=qs[_0xdfda('0x4e')](_0x35ef0f['query']['sort']);_0x445311[_0xdfda('0x4f')]=qs[_0xdfda('0x45')](_[_0xdfda('0x50')](_0x35ef0f['query'],_0x52dcbf[_0xdfda('0x45')]),_0x1bfa0a);if(_0x35ef0f[_0xdfda('0x44')][_0xdfda('0x51')]){_0x445311[_0xdfda('0x4f')]=_[_0xdfda('0x52')](_0x445311['where'],{'$or':_['map'](_0x1bfa0a,function(_0x2357a3){if(_0x2357a3[_0xdfda('0x41')]!==_0xdfda('0x53')){var _0x30d443={};_0x30d443[_0x2357a3[_0xdfda('0x3a')]]={'$like':'%'+_0x35ef0f[_0xdfda('0x44')][_0xdfda('0x51')]+'%'};return _0x30d443;}})});}_0x445311=_['merge']({},_0x445311,_0x35ef0f[_0xdfda('0x54')]);var _0x5238db={'where':_0x445311[_0xdfda('0x4f')]};return db[_0xdfda('0x3e')][_0xdfda('0x32')](_0x5238db)[_0xdfda('0x23')](function(_0x8cb292){_0x26717d['count']=_0x8cb292;if(_0x35ef0f[_0xdfda('0x44')][_0xdfda('0x55')]){_0x445311[_0xdfda('0x56')]=[{'all':!![]}];}return db[_0xdfda('0x3e')]['findAll'](_0x445311);})[_0xdfda('0x23')](function(_0x2fb758){_0x26717d[_0xdfda('0x57')]=_0x2fb758;return _0x26717d;})['then'](respondWithFilteredResult(_0x112c08,_0x445311))[_0xdfda('0x58')](handleError(_0x112c08,null));};exports[_0xdfda('0x59')]=function(_0x5c2c87,_0x3f5c8a){var _0x8f837={'raw':!![],'where':{'id':_0x5c2c87[_0xdfda('0x5a')]['id']}},_0x302056={};_0x302056['model']=_[_0xdfda('0x5b')](db['ChatQueue']['rawAttributes']);_0x302056[_0xdfda('0x44')]=_[_0xdfda('0x5b')](_0x5c2c87[_0xdfda('0x44')]);_0x302056[_0xdfda('0x45')]=_[_0xdfda('0x46')](_0x302056[_0xdfda('0x43')],_0x302056['query']);_0x8f837['attributes']=_[_0xdfda('0x46')](_0x302056['model'],qs[_0xdfda('0x48')](_0x5c2c87['query'][_0xdfda('0x48')]));_0x8f837[_0xdfda('0x47')]=_0x8f837[_0xdfda('0x47')][_0xdfda('0x49')]?_0x8f837['attributes']:_0x302056[_0xdfda('0x43')];if(_0x5c2c87[_0xdfda('0x44')][_0xdfda('0x55')]){_0x8f837[_0xdfda('0x56')]=[{'all':!![]}];}_0x8f837=_[_0xdfda('0x52')]({},_0x8f837,_0x5c2c87['options']);return db[_0xdfda('0x3e')][_0xdfda('0x5c')](_0x8f837)['then'](handleEntityNotFound(_0x3f5c8a,null))[_0xdfda('0x23')](respondWithResult(_0x3f5c8a,null))['catch'](handleError(_0x3f5c8a,null));};exports[_0xdfda('0x5d')]=function(_0x5856df,_0x1c1caa){return db[_0xdfda('0x3e')][_0xdfda('0x5d')](_0x5856df[_0xdfda('0x5e')],{})[_0xdfda('0x23')](function(_0x12372d){var _0x4a0755=_0x5856df[_0xdfda('0x5f')][_0xdfda('0x36')]({'plain':!![]});if(!_0x4a0755)throw new Error(_0xdfda('0x60'));if(_0x4a0755['role']===_0xdfda('0x5f')){var _0xc4758b=_0x12372d[_0xdfda('0x36')]({'plain':!![]});var _0x5e9c60=_0xdfda('0x37');return db[_0xdfda('0x61')][_0xdfda('0x5c')]({'where':{'name':_0x5e9c60,'userProfileId':_0x4a0755[_0xdfda('0x62')]},'raw':!![]})[_0xdfda('0x23')](function(_0x2da80f){if(_0x2da80f&&_0x2da80f['autoAssociation']===0x0){return db['UserProfileResource'][_0xdfda('0x5d')]({'name':_0xc4758b['name'],'resourceId':_0xc4758b['id'],'type':_0x2da80f[_0xdfda('0x3a')],'sectionId':_0x2da80f['id']},{})['then'](function(){return _0x12372d;});}else{return _0x12372d;}})['catch'](function(_0x5de8d7){logger['error'](_0xdfda('0x63'),_0x5de8d7);throw _0x5de8d7;});}return _0x12372d;})[_0xdfda('0x23')](respondWithResult(_0x1c1caa,0xc9))['catch'](handleError(_0x1c1caa,null));};exports[_0xdfda('0x64')]=function(_0x5c4c8f,_0x51974c){if(_0x5c4c8f[_0xdfda('0x5e')]['id']){delete _0x5c4c8f[_0xdfda('0x5e')]['id'];}return db[_0xdfda('0x3e')][_0xdfda('0x5c')]({'where':{'id':_0x5c4c8f[_0xdfda('0x5a')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x51974c,null))[_0xdfda('0x23')](saveUpdates(_0x5c4c8f[_0xdfda('0x5e')],null))['then'](respondWithResult(_0x51974c,null))[_0xdfda('0x58')](handleError(_0x51974c,null));};exports[_0xdfda('0x35')]=function(_0x5b7356,_0x5a56e3){return db[_0xdfda('0x3e')][_0xdfda('0x5c')]({'where':{'id':_0x5b7356[_0xdfda('0x5a')]['id']}})['then'](handleEntityNotFound(_0x5a56e3,null))[_0xdfda('0x23')](removeEntity(_0x5a56e3,null))[_0xdfda('0x58')](handleError(_0x5a56e3,null));};exports[_0xdfda('0x65')]=function(_0x44ef74,_0x409fa5){return db['ChatQueue'][_0xdfda('0x65')]()['then'](respondWithResult(_0x409fa5,null))[_0xdfda('0x58')](handleError(_0x409fa5,null));};exports[_0xdfda('0x66')]=function(_0x3a13ee,_0x57a686,_0x2c8924){var _0x141045={'raw':!![],'where':{}},_0x1b2d29={},_0x3fb84d;return db['ChatQueue'][_0xdfda('0x67')]({'where':{'id':_0x3a13ee[_0xdfda('0x5a')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x57a686,null))[_0xdfda('0x23')](function(_0x536692){if(_0x536692){_0x3fb84d=_0x536692[_0xdfda('0x36')]({'plain':!![]});_0x1b2d29[_0xdfda('0x43')]=_['keys'](db[_0xdfda('0x68')][_0xdfda('0x3f')]);_0x1b2d29[_0xdfda('0x44')]=_[_0xdfda('0x5b')](_0x3a13ee[_0xdfda('0x44')]);_0x1b2d29[_0xdfda('0x45')]=_[_0xdfda('0x46')](_0x1b2d29[_0xdfda('0x43')],_0x1b2d29[_0xdfda('0x44')]);_0x141045['attributes']=_[_0xdfda('0x46')](_0x1b2d29['model'],qs[_0xdfda('0x48')](_0x3a13ee[_0xdfda('0x44')]['fields']));_0x141045[_0xdfda('0x47')]=_0x141045[_0xdfda('0x47')][_0xdfda('0x49')]?_0x141045[_0xdfda('0x47')]:_0x1b2d29[_0xdfda('0x43')];if(!_0x3a13ee['query'][_0xdfda('0x4a')](_0xdfda('0x4b'))){_0x141045[_0xdfda('0x31')]=qs[_0xdfda('0x31')](_0x3a13ee['query'][_0xdfda('0x31')]);_0x141045['offset']=qs[_0xdfda('0x4c')](_0x3a13ee[_0xdfda('0x44')][_0xdfda('0x4c')]);}_0x141045[_0xdfda('0x4d')]=qs['sort'](_0x3a13ee['query']['sort']);_0x141045[_0xdfda('0x4f')]=qs[_0xdfda('0x45')](_['pick'](_0x3a13ee[_0xdfda('0x44')],_0x1b2d29['filters']));_0x141045[_0xdfda('0x4f')]['ChatQueueId']=_0x536692['id'];if(_0x3a13ee[_0xdfda('0x44')][_0xdfda('0x51')]){_0x141045['where']=_[_0xdfda('0x52')](_0x141045[_0xdfda('0x4f')],{'$or':_[_0xdfda('0x3d')](_0x141045['attributes'],function(_0x34b6cc){var _0x1f8c35={};_0x1f8c35[_0x34b6cc]={'$like':'%'+_0x3a13ee[_0xdfda('0x44')][_0xdfda('0x51')]+'%'};return _0x1f8c35;})});}_0x141045=_[_0xdfda('0x52')]({},_0x141045,_0x3a13ee[_0xdfda('0x54')]);return db[_0xdfda('0x68')][_0xdfda('0x69')](_0x141045);}})['then'](function(_0x1afa02){if(_0x1afa02){return db[_0xdfda('0x6a')][_0xdfda('0x6b')]({'where':{'id':_[_0xdfda('0x3d')](_0x1afa02,_0xdfda('0x6c')),'role':_0xdfda('0x6d')},'attributes':['id',_0xdfda('0x3a'),_0xdfda('0x6e'),_0xdfda('0x6f'),_0xdfda('0x70')]});}})['then'](function(_0x35187d){if(_0x35187d){return{'count':_0x35187d[_0xdfda('0x32')],'rows':_[_0xdfda('0x3d')](_0x35187d[_0xdfda('0x57')],function(_0x3c075b){return{'membername':_0x3c075b[_0xdfda('0x3a')],'UserId':_0x3c075b['id'],'queue_name':_0x3fb84d[_0xdfda('0x3a')],'ChatQueueId':_0x3fb84d['id'],'interface':util[_0xdfda('0x71')](_0xdfda('0x72'),'SIP',_0x3c075b[_0xdfda('0x3a')]),'penalty':0x0,'paused':_0x3c075b[_0xdfda('0x6e')],'createdAt':_0x3c075b[_0xdfda('0x70')],'updatedAt':_0x3c075b[_0xdfda('0x6f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdfda('0x23')](respondWithFilteredResult(_0x57a686,_0x141045))['catch'](handleError(_0x57a686,null));};exports[_0xdfda('0x73')]=function(_0x34ec86,_0x1f73e1,_0x54181c){var _0x314cc8={};var _0x34cc0a={};var _0x164fef;var _0x29d3e4;return db['ChatQueue'][_0xdfda('0x67')]({'where':{'id':_0x34ec86[_0xdfda('0x5a')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x1f73e1,null))[_0xdfda('0x23')](function(_0x31c727){if(_0x31c727){_0x164fef=_0x31c727;_0x34cc0a[_0xdfda('0x43')]=_[_0xdfda('0x5b')](db[_0xdfda('0x74')][_0xdfda('0x3f')]);_0x34cc0a[_0xdfda('0x44')]=_[_0xdfda('0x5b')](_0x34ec86[_0xdfda('0x44')]);_0x34cc0a[_0xdfda('0x45')]=_['intersection'](_0x34cc0a[_0xdfda('0x43')],_0x34cc0a['query']);_0x314cc8['attributes']=_[_0xdfda('0x46')](_0x34cc0a['model'],qs['fields'](_0x34ec86['query'][_0xdfda('0x48')]));_0x314cc8[_0xdfda('0x47')]=_0x314cc8['attributes'][_0xdfda('0x49')]?_0x314cc8[_0xdfda('0x47')]:_0x34cc0a[_0xdfda('0x43')];_0x314cc8[_0xdfda('0x4d')]=qs[_0xdfda('0x4e')](_0x34ec86[_0xdfda('0x44')]['sort']);_0x314cc8[_0xdfda('0x4f')]=qs['filters'](_['pick'](_0x34ec86[_0xdfda('0x44')],_0x34cc0a['filters']));if(_0x34ec86[_0xdfda('0x44')]['filter']){_0x314cc8[_0xdfda('0x4f')]=_[_0xdfda('0x52')](_0x314cc8[_0xdfda('0x4f')],{'$or':_[_0xdfda('0x3d')](_0x314cc8[_0xdfda('0x47')],function(_0x46ac4f){var _0xfa8088={};_0xfa8088[_0x46ac4f]={'$like':'%'+_0x34ec86['query']['filter']+'%'};return _0xfa8088;})});}_0x314cc8=_['merge']({},_0x314cc8,_0x34ec86[_0xdfda('0x54')]);return _0x164fef['getTeams'](_0x314cc8);}})[_0xdfda('0x23')](function(_0x430641){if(_0x430641){_0x29d3e4=_0x430641[_0xdfda('0x49')];if(!_0x34ec86['query'][_0xdfda('0x4a')](_0xdfda('0x4b'))){_0x314cc8[_0xdfda('0x31')]=qs[_0xdfda('0x31')](_0x34ec86[_0xdfda('0x44')][_0xdfda('0x31')]);_0x314cc8[_0xdfda('0x4c')]=qs[_0xdfda('0x4c')](_0x34ec86['query']['offset']);}return _0x164fef[_0xdfda('0x73')](_0x314cc8);}})[_0xdfda('0x23')](function(_0x3f7843){if(_0x3f7843){return _0x3f7843?{'count':_0x29d3e4,'rows':_0x3f7843}:null;}})[_0xdfda('0x23')](respondWithResult(_0x1f73e1,null))[_0xdfda('0x58')](handleError(_0x1f73e1,null));};exports[_0xdfda('0x75')]=function(_0x344d85,_0x196c6c,_0x5711e3){var _0x1e5cca=_0x344d85['body']['ids'];return db[_0xdfda('0x74')][_0xdfda('0x69')]({'where':{'id':_0x1e5cca},'attributes':['id'],'include':[{'model':db['User'],'as':_0xdfda('0x76'),'attributes':['id',_0xdfda('0x3a'),'online','voicePause',_0xdfda('0x77')],'raw':!![]}]})[_0xdfda('0x23')](function(_0x216e05){if(_0x216e05){var _0x2e2b95=_[_0xdfda('0x78')](_0x216e05,function(_0x4402d7){var _0x58cf47=_0x4402d7[_0xdfda('0x36')]({'plain':!![]});return _0x58cf47[_0xdfda('0x76')];});return db[_0xdfda('0x3e')][_0xdfda('0x5c')]({'where':{'id':_0x344d85[_0xdfda('0x5a')]['id']}})[_0xdfda('0x23')](function(_0x2ed2ff){return db[_0xdfda('0x79')][_0xdfda('0x7a')](function(_0x46a549){return _0x2ed2ff[_0xdfda('0x75')](_0x1e5cca,{'transaction':_0x46a549})[_0xdfda('0x23')](function(){return BPromise[_0xdfda('0x7b')](_0x2e2b95,function(_0x45ca54){return db[_0xdfda('0x68')][_0xdfda('0x7c')]({'where':{'UserId':_0x45ca54['id'],'ChatQueueId':_0x344d85[_0xdfda('0x5a')]['id']},'transaction':_0x46a549});});})[_0xdfda('0x23')](function(){_0x2e2b95[_0xdfda('0x7d')](function(_0x29ab78){socket['emit']('userChatQueue:save',{'UserId':_0x29ab78['id'],'ChatQueueId':_0x2ed2ff['id']});});});});});}})[_0xdfda('0x23')](respondWithStatusCode(_0x196c6c,null))['catch'](handleError(_0x196c6c,null));};exports[_0xdfda('0x7e')]=function(_0x191654,_0x330010,_0x2ffc15){return db[_0xdfda('0x74')][_0xdfda('0x69')]({'where':{'id':_0x191654[_0xdfda('0x44')][_0xdfda('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xdfda('0x6a')],'as':_0xdfda('0x76'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x330010,null))[_0xdfda('0x23')](function(_0x1edf2d){var _0x22511c=_['map'](_0x1edf2d,'id');var _0x748e5d=[];var _0x330e4f=[];var _0x150178=squel[_0xdfda('0x80')]();_0x150178[_0xdfda('0x81')]('tq.TeamId')[_0xdfda('0x82')]('team_has_chat_queues','tq')[_0xdfda('0x83')]('user_has_teams','ut',_0xdfda('0x84'))[_0xdfda('0x4f')]('ChatQueueId\x20=\x20?',_0x191654['params']['id']);for(var _0x10bf24=0x0;_0x10bf24<_0x1edf2d[_0xdfda('0x49')];_0x10bf24+=0x1){let _0x5885c4=_0x1edf2d[_0x10bf24];for(var _0x25dc4a=0x0;_0x25dc4a<_0x5885c4[_0xdfda('0x76')]['length'];_0x25dc4a+=0x1){let _0x171e4d=_0x5885c4[_0xdfda('0x76')][_0x25dc4a];var _0x218e2e=_0x150178[_0xdfda('0x85')]();_0x218e2e[_0xdfda('0x4f')](_0xdfda('0x86'),_0x171e4d['id']);_0x330e4f[_0xdfda('0x87')](db[_0xdfda('0x79')][_0xdfda('0x44')](_0x218e2e[_0xdfda('0x88')](),{'type':db[_0xdfda('0x79')][_0xdfda('0x89')][_0xdfda('0x8a')]})[_0xdfda('0x23')](function(_0x446a76){if(_0x446a76[_0xdfda('0x49')]===0x1){return _0x171e4d['id'];}else{var _0x3cb34e=_[_0xdfda('0x8b')](_['map'](_0x446a76,_0xdfda('0x8c')),function(_0x2c84d1){return _[_0xdfda('0x8d')](_0x22511c,_0x2c84d1);});if(_0x3cb34e){return _0x171e4d['id'];}}}));}}return BPromise[_0xdfda('0x8e')](_0x330e4f)[_0xdfda('0x23')](function(_0x48d05c){_0x748e5d=_(_0x748e5d)[_0xdfda('0x8f')](_0x48d05c)[_0xdfda('0x90')]()[_0xdfda('0x91')]();return db[_0xdfda('0x3e')][_0xdfda('0x5c')]({'where':{'id':_0x191654[_0xdfda('0x5a')]['id']}})[_0xdfda('0x23')](function(_0x1f41be){return db[_0xdfda('0x79')][_0xdfda('0x7a')](function(_0x4ac5d0){return _0x1f41be[_0xdfda('0x7e')](_0x191654[_0xdfda('0x44')][_0xdfda('0x7f')],{'transaction':_0x4ac5d0})[_0xdfda('0x23')](function(){if(!_[_0xdfda('0x92')](_0x748e5d)){return _0x1f41be[_0xdfda('0x93')](_0x748e5d,{'transaction':_0x4ac5d0});}})[_0xdfda('0x23')](function(){_0x748e5d['forEach'](function(_0x8a74f9){socket[_0xdfda('0x94')](_0xdfda('0x95'),{'UserId':_0x8a74f9,'ChatQueueId':_0x1f41be['id']});});});});});});})[_0xdfda('0x23')](respondWithStatusCode(_0x330010,null))[_0xdfda('0x58')](handleError(_0x330010,null));};exports['addAgents']=function(_0x7ad3ca,_0x24e9b0,_0xefa90a){return db[_0xdfda('0x3e')][_0xdfda('0x5c')]({'where':{'id':_0x7ad3ca[_0xdfda('0x5a')]['id']}})[_0xdfda('0x23')](handleEntityNotFound(_0x24e9b0,null))['then'](function(_0x20f067){if(_0x20f067){return _0x20f067['addAgents'](_0x7ad3ca['body']['ids'],_[_0xdfda('0x96')](_0x7ad3ca[_0xdfda('0x5e')],[_0xdfda('0x7f'),'id'])||{})[_0xdfda('0x97')](function(_0x4d030b){for(var _0x52c1d4=0x0;_0x52c1d4<_0x7ad3ca[_0xdfda('0x5e')][_0xdfda('0x7f')][_0xdfda('0x49')];_0x52c1d4+=0x1){socket['emit'](_0xdfda('0x98'),{'UserId':Number(_0x7ad3ca[_0xdfda('0x5e')][_0xdfda('0x7f')][_0x52c1d4]),'ChatQueueId':Number(_0x7ad3ca[_0xdfda('0x5a')]['id'])});}return _0x4d030b;});}})['then'](respondWithResult(_0x24e9b0,null))[_0xdfda('0x58')](handleError(_0x24e9b0,null));};exports[_0xdfda('0x93')]=function(_0x47ed25,_0x52b871,_0x5e2e44){return db[_0xdfda('0x3e')][_0xdfda('0x5c')]({'where':{'id':_0x47ed25['params']['id']}})['then'](handleEntityNotFound(_0x52b871,null))[_0xdfda('0x23')](function(_0x27770d){if(_0x27770d){return _0x27770d['removeAgents'](_0x47ed25['query'][_0xdfda('0x7f')])[_0xdfda('0x23')](function(){if(_[_0xdfda('0x99')](_0x47ed25[_0xdfda('0x44')][_0xdfda('0x7f')])){for(var _0x208daf=0x0;_0x208daf<_0x47ed25[_0xdfda('0x44')][_0xdfda('0x7f')]['length'];_0x208daf+=0x1){socket[_0xdfda('0x94')]('userChatQueue:remove',{'UserId':Number(_0x47ed25[_0xdfda('0x44')][_0xdfda('0x7f')][_0x208daf]),'ChatQueueId':Number(_0x47ed25[_0xdfda('0x5a')]['id'])});}}else{socket[_0xdfda('0x94')]('userChatQueue:remove',{'UserId':Number(_0x47ed25[_0xdfda('0x44')][_0xdfda('0x7f')]),'ChatQueueId':Number(_0x47ed25[_0xdfda('0x5a')]['id'])});}});}})[_0xdfda('0x23')](respondWithStatusCode(_0x52b871,null))[_0xdfda('0x58')](handleError(_0x52b871,null));};exports[_0xdfda('0x9a')]=function(_0x35834c,_0x152eee,_0x181ae8){var _0x482fb6={};var _0x475aa1={};var _0x2a6bd7;var _0xa50fac;return db[_0xdfda('0x3e')][_0xdfda('0x67')]({'where':{'id':_0x35834c[_0xdfda('0x5a')]['id']}})['then'](handleEntityNotFound(_0x152eee,null))[_0xdfda('0x23')](function(_0x26735c){if(_0x26735c){_0x2a6bd7=_0x26735c;_0x475aa1['model']=_[_0xdfda('0x5b')](db[_0xdfda('0x6a')][_0xdfda('0x3f')]);_0x475aa1[_0xdfda('0x44')]=_[_0xdfda('0x5b')](_0x35834c[_0xdfda('0x44')]);_0x475aa1['filters']=_[_0xdfda('0x46')](_0x475aa1[_0xdfda('0x43')],_0x475aa1[_0xdfda('0x44')]);_0x482fb6[_0xdfda('0x47')]=_[_0xdfda('0x46')](_0x475aa1[_0xdfda('0x43')],qs[_0xdfda('0x48')](_0x35834c[_0xdfda('0x44')][_0xdfda('0x48')]));_0x482fb6[_0xdfda('0x47')]=_0x482fb6[_0xdfda('0x47')][_0xdfda('0x49')]?_0x482fb6[_0xdfda('0x47')]:_0x475aa1['model'];_0x482fb6[_0xdfda('0x4d')]=qs[_0xdfda('0x4e')](_0x35834c[_0xdfda('0x44')][_0xdfda('0x4e')]);_0x482fb6[_0xdfda('0x4f')]=qs[_0xdfda('0x45')](_[_0xdfda('0x50')](_0x35834c[_0xdfda('0x44')],_0x475aa1['filters']));if(_0x35834c['query']['filter']){_0x482fb6[_0xdfda('0x4f')]=_['merge'](_0x482fb6[_0xdfda('0x4f')],{'$or':_[_0xdfda('0x3d')](_0x482fb6[_0xdfda('0x47')],function(_0xd5fb1c){var _0x4360ff={};_0x4360ff[_0xd5fb1c]={'$like':'%'+_0x35834c[_0xdfda('0x44')][_0xdfda('0x51')]+'%'};return _0x4360ff;})});}_0x482fb6=_[_0xdfda('0x52')]({},_0x482fb6,_0x35834c[_0xdfda('0x54')]);return _0x2a6bd7[_0xdfda('0x9a')](_0x482fb6);}})[_0xdfda('0x23')](function(_0x5674c5){if(_0x5674c5){_0xa50fac=_0x5674c5[_0xdfda('0x49')];if(!_0x35834c[_0xdfda('0x44')]['hasOwnProperty']('nolimit')){_0x482fb6[_0xdfda('0x31')]=qs[_0xdfda('0x31')](_0x35834c[_0xdfda('0x44')]['limit']);_0x482fb6[_0xdfda('0x4c')]=qs[_0xdfda('0x4c')](_0x35834c[_0xdfda('0x44')][_0xdfda('0x4c')]);}return _0x2a6bd7['getAgents'](_0x482fb6);}})[_0xdfda('0x23')](function(_0x168ed9){if(_0x168ed9){return _0x168ed9?{'count':_0xa50fac,'rows':_0x168ed9}:null;}})['then'](respondWithResult(_0x152eee,null))[_0xdfda('0x58')](handleError(_0x152eee,null));}; \ No newline at end of file +var _0x1a2f=['ChatQueueId','User','findAndCountAll','agent','chatPause','updatedAt','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','tq.TeamId','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','userChatQueue:save','getAgents','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','get','UserProfileResource','destroy','end','name','index','map','ChatQueue','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','length','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','create','body','describe','findOne','UserChatQueue','pick'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a2f,0x158));var _0xf1a2=function(_0x38d69a,_0x543c17){_0x38d69a=_0x38d69a-0x0;var _0x33ed3f=_0x1a2f[_0x38d69a];return _0x33ed3f;};'use strict';var emlformat=require(_0xf1a2('0x0'));var rimraf=require(_0xf1a2('0x1'));var zipdir=require(_0xf1a2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf1a2('0x3'));var moment=require('moment');var BPromise=require(_0xf1a2('0x4'));var Mustache=require(_0xf1a2('0x5'));var util=require(_0xf1a2('0x6'));var path=require('path');var sox=require(_0xf1a2('0x7'));var csv=require(_0xf1a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf1a2('0x9'));var _=require('lodash');var squel=require(_0xf1a2('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf1a2('0xb'));var toCsv=require(_0xf1a2('0x8'));var querystring=require(_0xf1a2('0xc'));var Papa=require(_0xf1a2('0xd'));var Redis=require(_0xf1a2('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf1a2('0xf'));var as=require(_0xf1a2('0x10'));var hardwareService=require(_0xf1a2('0x11'));var logger=require(_0xf1a2('0x12'))(_0xf1a2('0x13'));var utils=require(_0xf1a2('0x14'));var config=require(_0xf1a2('0x15'));var licenseUtil=require(_0xf1a2('0x16'));var db=require(_0xf1a2('0x17'))['db'];config[_0xf1a2('0x18')]=_[_0xf1a2('0x19')](config[_0xf1a2('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xf1a2('0x1a'))(new Redis(config[_0xf1a2('0x18')]));require(_0xf1a2('0x1b'))[_0xf1a2('0x1c')](socket);var jayson=require(_0xf1a2('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x532e3d,_0x44b6a5,_0x49ec24,_0x85e64d){return new BPromise(function(_0x14a7df,_0x431da7){var _0x3f9c37=_0x85e64d||client;return _0x3f9c37[_0xf1a2('0x1e')](_0x532e3d,_0x49ec24)[_0xf1a2('0x1f')](function(_0x250d64){logger[_0xf1a2('0x20')](_0xf1a2('0x21'),_0x44b6a5,'request\x20sent');logger[_0xf1a2('0x22')](_0xf1a2('0x23'),_0x44b6a5,'request\x20sent',JSON[_0xf1a2('0x24')](_0x250d64));if(_0x250d64[_0xf1a2('0x25')]){if(_0x250d64[_0xf1a2('0x25')][_0xf1a2('0x26')]===0x1f4){logger[_0xf1a2('0x25')]('ChatQueue,\x20%s,\x20%s',_0x44b6a5,_0x250d64[_0xf1a2('0x25')][_0xf1a2('0x27')]);return _0x431da7(_0x250d64['error'][_0xf1a2('0x27')]);}logger[_0xf1a2('0x25')]('ChatQueue,\x20%s,\x20%s',_0x44b6a5,_0x250d64['error'][_0xf1a2('0x27')]);return _0x14a7df(_0x250d64[_0xf1a2('0x25')][_0xf1a2('0x27')]);}else{logger['info'](_0xf1a2('0x21'),_0x44b6a5,_0xf1a2('0x28'));_0x14a7df(_0x250d64[_0xf1a2('0x29')][_0xf1a2('0x27')]);}})[_0xf1a2('0x2a')](function(_0x107010){logger[_0xf1a2('0x25')](_0xf1a2('0x21'),_0x44b6a5,_0x107010);_0x431da7(_0x107010);});});}function respondWithStatusCode(_0x4a7950,_0x35fa33){_0x35fa33=_0x35fa33||0xcc;return function(_0x1597c3){if(_0x1597c3){return _0x4a7950[_0xf1a2('0x2b')](_0x35fa33);}return _0x4a7950['status'](_0x35fa33)['end']();};}function respondWithResult(_0x4e41e6,_0x21d557){_0x21d557=_0x21d557||0xc8;return function(_0x3a3702){if(_0x3a3702){return _0x4e41e6[_0xf1a2('0x2c')](_0x21d557)[_0xf1a2('0x2d')](_0x3a3702);}};}function respondWithFilteredResult(_0x338cbd,_0x46ee2){return function(_0x15bc59){if(_0x15bc59){var _0x1c61f9=typeof _0x46ee2[_0xf1a2('0x2e')]==='undefined'&&typeof _0x46ee2[_0xf1a2('0x2f')]===_0xf1a2('0x30');var _0x5c132c=_0x15bc59[_0xf1a2('0x31')];var _0xe88392=_0x1c61f9?0x0:_0x46ee2['offset'];var _0x3d047e=_0x1c61f9?_0x15bc59[_0xf1a2('0x31')]:_0x46ee2[_0xf1a2('0x2e')]+_0x46ee2[_0xf1a2('0x2f')];var _0x37c76d;if(_0x3d047e>=_0x5c132c){_0x3d047e=_0x5c132c;_0x37c76d=0xc8;}else{_0x37c76d=0xce;}_0x338cbd[_0xf1a2('0x2c')](_0x37c76d);return _0x338cbd[_0xf1a2('0x32')](_0xf1a2('0x33'),_0xe88392+'-'+_0x3d047e+'/'+_0x5c132c)[_0xf1a2('0x2d')](_0x15bc59);}return null;};}function patchUpdates(_0x5985e4){return function(_0x92a7b0){try{jsonpatch[_0xf1a2('0x34')](_0x92a7b0,_0x5985e4,!![]);}catch(_0x544d86){return BPromise['reject'](_0x544d86);}return _0x92a7b0['save']();};}function saveUpdates(_0x163968,_0x1de7e1){return function(_0xa0048d){if(_0xa0048d){return _0xa0048d[_0xf1a2('0x35')](_0x163968)[_0xf1a2('0x1f')](function(_0x87082a){return _0x87082a;});}return null;};}function removeEntity(_0x259bad,_0x2bc5e2){return function(_0x2c33df){if(_0x2c33df){return _0x2c33df['destroy']()['then'](function(){var _0x3f789f=_0x2c33df[_0xf1a2('0x36')]({'plain':!![]});var _0x2e7552='ChatQueues';return db[_0xf1a2('0x37')][_0xf1a2('0x38')]({'where':{'type':_0x2e7552,'resourceId':_0x3f789f['id']}})[_0xf1a2('0x1f')](function(){return _0x2c33df;});})[_0xf1a2('0x1f')](function(){_0x259bad[_0xf1a2('0x2c')](0xcc)[_0xf1a2('0x39')]();});}};}function handleEntityNotFound(_0x346c2e,_0x5a7192){return function(_0x1b6b4a){if(!_0x1b6b4a){_0x346c2e[_0xf1a2('0x2b')](0x194);}return _0x1b6b4a;};}function handleError(_0x4442f5,_0x8ce3bd){_0x8ce3bd=_0x8ce3bd||0x1f4;return function(_0x5ed209){logger['error'](_0x5ed209['stack']);if(_0x5ed209[_0xf1a2('0x3a')]){delete _0x5ed209[_0xf1a2('0x3a')];}_0x4442f5[_0xf1a2('0x2c')](_0x8ce3bd)['send'](_0x5ed209);};}exports[_0xf1a2('0x3b')]=function(_0x5c167a,_0x58b264){var _0x47d400={},_0x5b89ac={},_0x3a9d36={'count':0x0,'rows':[]};var _0x9eeceb=_[_0xf1a2('0x3c')](db[_0xf1a2('0x3d')][_0xf1a2('0x3e')],function(_0x34b5c7){return{'name':_0x34b5c7[_0xf1a2('0x3f')],'type':_0x34b5c7[_0xf1a2('0x40')]['key']};});_0x5b89ac['model']=_[_0xf1a2('0x3c')](_0x9eeceb,_0xf1a2('0x3a'));_0x5b89ac[_0xf1a2('0x41')]=_[_0xf1a2('0x42')](_0x5c167a['query']);_0x5b89ac[_0xf1a2('0x43')]=_[_0xf1a2('0x44')](_0x5b89ac[_0xf1a2('0x45')],_0x5b89ac['query']);_0x47d400[_0xf1a2('0x46')]=_['intersection'](_0x5b89ac[_0xf1a2('0x45')],qs[_0xf1a2('0x47')](_0x5c167a['query'][_0xf1a2('0x47')]));_0x47d400['attributes']=_0x47d400[_0xf1a2('0x46')]['length']?_0x47d400[_0xf1a2('0x46')]:_0x5b89ac[_0xf1a2('0x45')];if(!_0x5c167a[_0xf1a2('0x41')][_0xf1a2('0x48')](_0xf1a2('0x49'))){_0x47d400[_0xf1a2('0x2f')]=qs[_0xf1a2('0x2f')](_0x5c167a[_0xf1a2('0x41')][_0xf1a2('0x2f')]);_0x47d400[_0xf1a2('0x2e')]=qs[_0xf1a2('0x2e')](_0x5c167a['query'][_0xf1a2('0x2e')]);}_0x47d400[_0xf1a2('0x4a')]=qs[_0xf1a2('0x4b')](_0x5c167a[_0xf1a2('0x41')][_0xf1a2('0x4b')]);_0x47d400[_0xf1a2('0x4c')]=qs[_0xf1a2('0x43')](_['pick'](_0x5c167a[_0xf1a2('0x41')],_0x5b89ac['filters']),_0x9eeceb);if(_0x5c167a[_0xf1a2('0x41')][_0xf1a2('0x4d')]){_0x47d400[_0xf1a2('0x4c')]=_['merge'](_0x47d400[_0xf1a2('0x4c')],{'$or':_[_0xf1a2('0x3c')](_0x9eeceb,function(_0x543f91){if(_0x543f91['type']!==_0xf1a2('0x4e')){var _0x3853e5={};_0x3853e5[_0x543f91['name']]={'$like':'%'+_0x5c167a[_0xf1a2('0x41')][_0xf1a2('0x4d')]+'%'};return _0x3853e5;}})});}_0x47d400=_[_0xf1a2('0x4f')]({},_0x47d400,_0x5c167a[_0xf1a2('0x50')]);var _0x789160={'where':_0x47d400['where']};return db['ChatQueue'][_0xf1a2('0x31')](_0x789160)[_0xf1a2('0x1f')](function(_0x1169ce){_0x3a9d36[_0xf1a2('0x31')]=_0x1169ce;if(_0x5c167a[_0xf1a2('0x41')][_0xf1a2('0x51')]){_0x47d400[_0xf1a2('0x52')]=[{'all':!![]}];}return db[_0xf1a2('0x3d')][_0xf1a2('0x53')](_0x47d400);})[_0xf1a2('0x1f')](function(_0x59e03d){_0x3a9d36[_0xf1a2('0x54')]=_0x59e03d;return _0x3a9d36;})['then'](respondWithFilteredResult(_0x58b264,_0x47d400))[_0xf1a2('0x2a')](handleError(_0x58b264,null));};exports[_0xf1a2('0x55')]=function(_0x1f2093,_0x5ac590){var _0x1e5245={'raw':!![],'where':{'id':_0x1f2093[_0xf1a2('0x56')]['id']}},_0x412079={};_0x412079[_0xf1a2('0x45')]=_[_0xf1a2('0x42')](db['ChatQueue'][_0xf1a2('0x3e')]);_0x412079[_0xf1a2('0x41')]=_[_0xf1a2('0x42')](_0x1f2093['query']);_0x412079['filters']=_[_0xf1a2('0x44')](_0x412079['model'],_0x412079[_0xf1a2('0x41')]);_0x1e5245[_0xf1a2('0x46')]=_[_0xf1a2('0x44')](_0x412079[_0xf1a2('0x45')],qs[_0xf1a2('0x47')](_0x1f2093[_0xf1a2('0x41')][_0xf1a2('0x47')]));_0x1e5245[_0xf1a2('0x46')]=_0x1e5245['attributes'][_0xf1a2('0x57')]?_0x1e5245['attributes']:_0x412079[_0xf1a2('0x45')];if(_0x1f2093[_0xf1a2('0x41')]['includeAll']){_0x1e5245[_0xf1a2('0x52')]=[{'all':!![]}];}_0x1e5245=_[_0xf1a2('0x4f')]({},_0x1e5245,_0x1f2093['options']);return db['ChatQueue']['find'](_0x1e5245)[_0xf1a2('0x1f')](handleEntityNotFound(_0x5ac590,null))[_0xf1a2('0x1f')](respondWithResult(_0x5ac590,null))[_0xf1a2('0x2a')](handleError(_0x5ac590,null));};exports['create']=function(_0x49d9a5,_0x3f90d5){return db[_0xf1a2('0x3d')]['create'](_0x49d9a5['body'],{})[_0xf1a2('0x1f')](function(_0x484124){var _0xd9a8bb=_0x49d9a5[_0xf1a2('0x58')][_0xf1a2('0x36')]({'plain':!![]});if(!_0xd9a8bb)throw new Error(_0xf1a2('0x59'));if(_0xd9a8bb[_0xf1a2('0x5a')]===_0xf1a2('0x58')){var _0x25ef83=_0x484124['get']({'plain':!![]});var _0x2f9401='ChatQueues';return db[_0xf1a2('0x5b')][_0xf1a2('0x5c')]({'where':{'name':_0x2f9401,'userProfileId':_0xd9a8bb['userProfileId']},'raw':!![]})['then'](function(_0x3d64b0){if(_0x3d64b0&&_0x3d64b0[_0xf1a2('0x5d')]===0x0){return db[_0xf1a2('0x37')][_0xf1a2('0x5e')]({'name':_0x25ef83['name'],'resourceId':_0x25ef83['id'],'type':_0x3d64b0['name'],'sectionId':_0x3d64b0['id']},{})[_0xf1a2('0x1f')](function(){return _0x484124;});}else{return _0x484124;}})[_0xf1a2('0x2a')](function(_0x5f535c){logger[_0xf1a2('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f535c);throw _0x5f535c;});}return _0x484124;})[_0xf1a2('0x1f')](respondWithResult(_0x3f90d5,0xc9))[_0xf1a2('0x2a')](handleError(_0x3f90d5,null));};exports['update']=function(_0x3b8e77,_0x54719f){if(_0x3b8e77['body']['id']){delete _0x3b8e77[_0xf1a2('0x5f')]['id'];}return db[_0xf1a2('0x3d')][_0xf1a2('0x5c')]({'where':{'id':_0x3b8e77['params']['id']}})[_0xf1a2('0x1f')](handleEntityNotFound(_0x54719f,null))[_0xf1a2('0x1f')](saveUpdates(_0x3b8e77['body'],null))[_0xf1a2('0x1f')](respondWithResult(_0x54719f,null))[_0xf1a2('0x2a')](handleError(_0x54719f,null));};exports[_0xf1a2('0x38')]=function(_0xa69715,_0x1f3030){return db[_0xf1a2('0x3d')][_0xf1a2('0x5c')]({'where':{'id':_0xa69715[_0xf1a2('0x56')]['id']}})['then'](handleEntityNotFound(_0x1f3030,null))[_0xf1a2('0x1f')](removeEntity(_0x1f3030,null))[_0xf1a2('0x2a')](handleError(_0x1f3030,null));};exports[_0xf1a2('0x60')]=function(_0x324c9a,_0x50d3b1){return db['ChatQueue'][_0xf1a2('0x60')]()[_0xf1a2('0x1f')](respondWithResult(_0x50d3b1,null))[_0xf1a2('0x2a')](handleError(_0x50d3b1,null));};exports['getMembers']=function(_0x166a0b,_0x5b65d4,_0x524914){var _0x27d7ce={'raw':!![],'where':{}},_0x3cc937={},_0x3d6d69;return db['ChatQueue'][_0xf1a2('0x61')]({'where':{'id':_0x166a0b['params']['id']}})[_0xf1a2('0x1f')](handleEntityNotFound(_0x5b65d4,null))[_0xf1a2('0x1f')](function(_0x324ed0){if(_0x324ed0){_0x3d6d69=_0x324ed0['get']({'plain':!![]});_0x3cc937[_0xf1a2('0x45')]=_['keys'](db[_0xf1a2('0x62')][_0xf1a2('0x3e')]);_0x3cc937[_0xf1a2('0x41')]=_['keys'](_0x166a0b[_0xf1a2('0x41')]);_0x3cc937[_0xf1a2('0x43')]=_[_0xf1a2('0x44')](_0x3cc937['model'],_0x3cc937[_0xf1a2('0x41')]);_0x27d7ce[_0xf1a2('0x46')]=_[_0xf1a2('0x44')](_0x3cc937[_0xf1a2('0x45')],qs[_0xf1a2('0x47')](_0x166a0b['query'][_0xf1a2('0x47')]));_0x27d7ce['attributes']=_0x27d7ce[_0xf1a2('0x46')][_0xf1a2('0x57')]?_0x27d7ce[_0xf1a2('0x46')]:_0x3cc937[_0xf1a2('0x45')];if(!_0x166a0b[_0xf1a2('0x41')][_0xf1a2('0x48')](_0xf1a2('0x49'))){_0x27d7ce['limit']=qs[_0xf1a2('0x2f')](_0x166a0b[_0xf1a2('0x41')][_0xf1a2('0x2f')]);_0x27d7ce[_0xf1a2('0x2e')]=qs[_0xf1a2('0x2e')](_0x166a0b[_0xf1a2('0x41')][_0xf1a2('0x2e')]);}_0x27d7ce[_0xf1a2('0x4a')]=qs[_0xf1a2('0x4b')](_0x166a0b[_0xf1a2('0x41')]['sort']);_0x27d7ce[_0xf1a2('0x4c')]=qs[_0xf1a2('0x43')](_[_0xf1a2('0x63')](_0x166a0b[_0xf1a2('0x41')],_0x3cc937['filters']));_0x27d7ce[_0xf1a2('0x4c')][_0xf1a2('0x64')]=_0x324ed0['id'];if(_0x166a0b['query']['filter']){_0x27d7ce[_0xf1a2('0x4c')]=_[_0xf1a2('0x4f')](_0x27d7ce['where'],{'$or':_['map'](_0x27d7ce[_0xf1a2('0x46')],function(_0x281f96){var _0x3253ee={};_0x3253ee[_0x281f96]={'$like':'%'+_0x166a0b[_0xf1a2('0x41')][_0xf1a2('0x4d')]+'%'};return _0x3253ee;})});}_0x27d7ce=_[_0xf1a2('0x4f')]({},_0x27d7ce,_0x166a0b[_0xf1a2('0x50')]);return db[_0xf1a2('0x62')][_0xf1a2('0x53')](_0x27d7ce);}})[_0xf1a2('0x1f')](function(_0x5ddf38){if(_0x5ddf38){return db[_0xf1a2('0x65')][_0xf1a2('0x66')]({'where':{'id':_['map'](_0x5ddf38,'UserId'),'role':_0xf1a2('0x67')},'attributes':['id',_0xf1a2('0x3a'),_0xf1a2('0x68'),_0xf1a2('0x69'),'createdAt']});}})[_0xf1a2('0x1f')](function(_0x500a4d){if(_0x500a4d){return{'count':_0x500a4d[_0xf1a2('0x31')],'rows':_[_0xf1a2('0x3c')](_0x500a4d[_0xf1a2('0x54')],function(_0x13e2b6){return{'membername':_0x13e2b6[_0xf1a2('0x3a')],'UserId':_0x13e2b6['id'],'queue_name':_0x3d6d69[_0xf1a2('0x3a')],'ChatQueueId':_0x3d6d69['id'],'interface':util['format'](_0xf1a2('0x6a'),_0xf1a2('0x6b'),_0x13e2b6[_0xf1a2('0x3a')]),'penalty':0x0,'paused':_0x13e2b6[_0xf1a2('0x68')],'createdAt':_0x13e2b6[_0xf1a2('0x6c')],'updatedAt':_0x13e2b6[_0xf1a2('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf1a2('0x1f')](respondWithFilteredResult(_0x5b65d4,_0x27d7ce))[_0xf1a2('0x2a')](handleError(_0x5b65d4,null));};exports[_0xf1a2('0x6d')]=function(_0x3d2773,_0x330491,_0x579856){var _0x47525a={};var _0x3a520c={};var _0x1de34b;var _0x233b8b;return db[_0xf1a2('0x3d')][_0xf1a2('0x61')]({'where':{'id':_0x3d2773[_0xf1a2('0x56')]['id']}})[_0xf1a2('0x1f')](handleEntityNotFound(_0x330491,null))[_0xf1a2('0x1f')](function(_0x1584ce){if(_0x1584ce){_0x1de34b=_0x1584ce;_0x3a520c[_0xf1a2('0x45')]=_[_0xf1a2('0x42')](db[_0xf1a2('0x6e')][_0xf1a2('0x3e')]);_0x3a520c[_0xf1a2('0x41')]=_['keys'](_0x3d2773[_0xf1a2('0x41')]);_0x3a520c[_0xf1a2('0x43')]=_[_0xf1a2('0x44')](_0x3a520c['model'],_0x3a520c[_0xf1a2('0x41')]);_0x47525a[_0xf1a2('0x46')]=_[_0xf1a2('0x44')](_0x3a520c[_0xf1a2('0x45')],qs['fields'](_0x3d2773[_0xf1a2('0x41')][_0xf1a2('0x47')]));_0x47525a[_0xf1a2('0x46')]=_0x47525a[_0xf1a2('0x46')][_0xf1a2('0x57')]?_0x47525a['attributes']:_0x3a520c[_0xf1a2('0x45')];_0x47525a[_0xf1a2('0x4a')]=qs['sort'](_0x3d2773['query'][_0xf1a2('0x4b')]);_0x47525a[_0xf1a2('0x4c')]=qs[_0xf1a2('0x43')](_[_0xf1a2('0x63')](_0x3d2773[_0xf1a2('0x41')],_0x3a520c[_0xf1a2('0x43')]));if(_0x3d2773[_0xf1a2('0x41')][_0xf1a2('0x4d')]){_0x47525a[_0xf1a2('0x4c')]=_['merge'](_0x47525a[_0xf1a2('0x4c')],{'$or':_['map'](_0x47525a[_0xf1a2('0x46')],function(_0x16b577){var _0x3eec40={};_0x3eec40[_0x16b577]={'$like':'%'+_0x3d2773[_0xf1a2('0x41')][_0xf1a2('0x4d')]+'%'};return _0x3eec40;})});}_0x47525a=_[_0xf1a2('0x4f')]({},_0x47525a,_0x3d2773[_0xf1a2('0x50')]);return _0x1de34b[_0xf1a2('0x6d')](_0x47525a);}})[_0xf1a2('0x1f')](function(_0x35c459){if(_0x35c459){_0x233b8b=_0x35c459[_0xf1a2('0x57')];if(!_0x3d2773['query']['hasOwnProperty'](_0xf1a2('0x49'))){_0x47525a[_0xf1a2('0x2f')]=qs[_0xf1a2('0x2f')](_0x3d2773[_0xf1a2('0x41')]['limit']);_0x47525a[_0xf1a2('0x2e')]=qs[_0xf1a2('0x2e')](_0x3d2773[_0xf1a2('0x41')][_0xf1a2('0x2e')]);}return _0x1de34b[_0xf1a2('0x6d')](_0x47525a);}})[_0xf1a2('0x1f')](function(_0x4528b5){if(_0x4528b5){return _0x4528b5?{'count':_0x233b8b,'rows':_0x4528b5}:null;}})[_0xf1a2('0x1f')](respondWithResult(_0x330491,null))[_0xf1a2('0x2a')](handleError(_0x330491,null));};exports[_0xf1a2('0x6f')]=function(_0x511d15,_0x2f26f3,_0x2106ad){var _0x2c86d1=_0x511d15[_0xf1a2('0x5f')][_0xf1a2('0x70')];return db[_0xf1a2('0x6e')][_0xf1a2('0x53')]({'where':{'id':_0x2c86d1},'attributes':['id'],'include':[{'model':db[_0xf1a2('0x65')],'as':_0xf1a2('0x71'),'attributes':['id',_0xf1a2('0x3a'),_0xf1a2('0x72'),_0xf1a2('0x73'),'interface'],'raw':!![]}]})[_0xf1a2('0x1f')](function(_0x3b9582){if(_0x3b9582){var _0x515b29=_[_0xf1a2('0x74')](_0x3b9582,function(_0x2ea5a8){var _0x1c83b4=_0x2ea5a8[_0xf1a2('0x36')]({'plain':!![]});return _0x1c83b4[_0xf1a2('0x71')];});return db['ChatQueue'][_0xf1a2('0x5c')]({'where':{'id':_0x511d15[_0xf1a2('0x56')]['id']}})[_0xf1a2('0x1f')](function(_0x3b3146){return db[_0xf1a2('0x75')][_0xf1a2('0x76')](function(_0x4d0010){return _0x3b3146[_0xf1a2('0x6f')](_0x2c86d1,{'transaction':_0x4d0010})['then'](function(){return BPromise[_0xf1a2('0x77')](_0x515b29,function(_0xbdf4d6){return db[_0xf1a2('0x62')][_0xf1a2('0x78')]({'where':{'UserId':_0xbdf4d6['id'],'ChatQueueId':_0x511d15[_0xf1a2('0x56')]['id']},'transaction':_0x4d0010});});})[_0xf1a2('0x1f')](function(){_0x515b29['forEach'](function(_0x544f57){socket[_0xf1a2('0x79')]('userChatQueue:save',{'UserId':_0x544f57['id'],'ChatQueueId':_0x3b3146['id']});});});});});}})[_0xf1a2('0x1f')](respondWithStatusCode(_0x2f26f3,null))[_0xf1a2('0x2a')](handleError(_0x2f26f3,null));};exports[_0xf1a2('0x7a')]=function(_0x1a4e63,_0xecf2ca,_0xb5af46){return db['Team'][_0xf1a2('0x53')]({'where':{'id':_0x1a4e63[_0xf1a2('0x41')][_0xf1a2('0x70')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf1a2('0x71'),'attributes':['id'],'raw':!![]}]})[_0xf1a2('0x1f')](handleEntityNotFound(_0xecf2ca,null))[_0xf1a2('0x1f')](function(_0x2c2519){var _0x13be73=_[_0xf1a2('0x3c')](_0x2c2519,'id');var _0x43da3c=[];var _0x82bab0=[];var _0x49f0bd=squel[_0xf1a2('0x7b')]();_0x49f0bd['field'](_0xf1a2('0x7c'))['from'](_0xf1a2('0x7d'),'tq')[_0xf1a2('0x7e')](_0xf1a2('0x7f'),'ut',_0xf1a2('0x80'))[_0xf1a2('0x4c')](_0xf1a2('0x81'),_0x1a4e63[_0xf1a2('0x56')]['id']);for(var _0x39525e=0x0;_0x39525e<_0x2c2519[_0xf1a2('0x57')];_0x39525e+=0x1){let _0xf3e8db=_0x2c2519[_0x39525e];for(var _0x2e65e0=0x0;_0x2e65e0<_0xf3e8db[_0xf1a2('0x71')]['length'];_0x2e65e0+=0x1){let _0x21fe93=_0xf3e8db['Agents'][_0x2e65e0];var _0x1387d4=_0x49f0bd['clone']();_0x1387d4[_0xf1a2('0x4c')](_0xf1a2('0x82'),_0x21fe93['id']);_0x82bab0[_0xf1a2('0x83')](db[_0xf1a2('0x75')][_0xf1a2('0x41')](_0x1387d4[_0xf1a2('0x84')](),{'type':db['sequelize']['QueryTypes'][_0xf1a2('0x85')]})[_0xf1a2('0x1f')](function(_0x37e410){if(_0x37e410[_0xf1a2('0x57')]===0x1){return _0x21fe93['id'];}else{var _0x2dff7d=_[_0xf1a2('0x86')](_[_0xf1a2('0x3c')](_0x37e410,_0xf1a2('0x87')),function(_0x1c4409){return _[_0xf1a2('0x88')](_0x13be73,_0x1c4409);});if(_0x2dff7d){return _0x21fe93['id'];}}}));}}return BPromise[_0xf1a2('0x89')](_0x82bab0)[_0xf1a2('0x1f')](function(_0x52a588){_0x43da3c=_(_0x43da3c)[_0xf1a2('0x8a')](_0x52a588)[_0xf1a2('0x8b')]()['value']();return db[_0xf1a2('0x3d')][_0xf1a2('0x5c')]({'where':{'id':_0x1a4e63[_0xf1a2('0x56')]['id']}})['then'](function(_0x170b20){return db[_0xf1a2('0x75')][_0xf1a2('0x76')](function(_0x49edf5){return _0x170b20[_0xf1a2('0x7a')](_0x1a4e63['query'][_0xf1a2('0x70')],{'transaction':_0x49edf5})[_0xf1a2('0x1f')](function(){if(!_[_0xf1a2('0x8c')](_0x43da3c)){return _0x170b20[_0xf1a2('0x8d')](_0x43da3c,{'transaction':_0x49edf5});}})[_0xf1a2('0x1f')](function(){_0x43da3c[_0xf1a2('0x8e')](function(_0x31cdd9){socket[_0xf1a2('0x79')](_0xf1a2('0x8f'),{'UserId':_0x31cdd9,'ChatQueueId':_0x170b20['id']});});});});});});})[_0xf1a2('0x1f')](respondWithStatusCode(_0xecf2ca,null))[_0xf1a2('0x2a')](handleError(_0xecf2ca,null));};exports[_0xf1a2('0x90')]=function(_0x4353eb,_0x10c679,_0x16f102){return db[_0xf1a2('0x3d')]['find']({'where':{'id':_0x4353eb[_0xf1a2('0x56')]['id']}})[_0xf1a2('0x1f')](handleEntityNotFound(_0x10c679,null))[_0xf1a2('0x1f')](function(_0x1b3bf3){if(_0x1b3bf3){return _0x1b3bf3[_0xf1a2('0x90')](_0x4353eb['body'][_0xf1a2('0x70')],_['omit'](_0x4353eb[_0xf1a2('0x5f')],['ids','id'])||{})[_0xf1a2('0x91')](function(_0x2cd420){for(var _0x5d556f=0x0;_0x5d556f<_0x4353eb[_0xf1a2('0x5f')][_0xf1a2('0x70')][_0xf1a2('0x57')];_0x5d556f+=0x1){socket[_0xf1a2('0x79')](_0xf1a2('0x92'),{'UserId':Number(_0x4353eb[_0xf1a2('0x5f')][_0xf1a2('0x70')][_0x5d556f]),'ChatQueueId':Number(_0x4353eb[_0xf1a2('0x56')]['id'])});}return _0x2cd420;});}})[_0xf1a2('0x1f')](respondWithResult(_0x10c679,null))[_0xf1a2('0x2a')](handleError(_0x10c679,null));};exports[_0xf1a2('0x8d')]=function(_0x2fe652,_0x37472a,_0x20dce4){return db['ChatQueue'][_0xf1a2('0x5c')]({'where':{'id':_0x2fe652['params']['id']}})[_0xf1a2('0x1f')](handleEntityNotFound(_0x37472a,null))[_0xf1a2('0x1f')](function(_0x44971c){if(_0x44971c){return _0x44971c[_0xf1a2('0x8d')](_0x2fe652['query'][_0xf1a2('0x70')])[_0xf1a2('0x1f')](function(){if(_['isArray'](_0x2fe652[_0xf1a2('0x41')][_0xf1a2('0x70')])){for(var _0x2f77f2=0x0;_0x2f77f2<_0x2fe652[_0xf1a2('0x41')][_0xf1a2('0x70')][_0xf1a2('0x57')];_0x2f77f2+=0x1){socket[_0xf1a2('0x79')]('userChatQueue:remove',{'UserId':Number(_0x2fe652[_0xf1a2('0x41')][_0xf1a2('0x70')][_0x2f77f2]),'ChatQueueId':Number(_0x2fe652['params']['id'])});}}else{socket[_0xf1a2('0x79')](_0xf1a2('0x8f'),{'UserId':Number(_0x2fe652[_0xf1a2('0x41')][_0xf1a2('0x70')]),'ChatQueueId':Number(_0x2fe652[_0xf1a2('0x56')]['id'])});}});}})[_0xf1a2('0x1f')](respondWithStatusCode(_0x37472a,null))[_0xf1a2('0x2a')](handleError(_0x37472a,null));};exports['getAgents']=function(_0x2ae989,_0x5a268b,_0x5c214e){var _0x4b4b01={};var _0x372026={};var _0xe7280d;var _0x5e99cb;return db[_0xf1a2('0x3d')]['findOne']({'where':{'id':_0x2ae989[_0xf1a2('0x56')]['id']}})['then'](handleEntityNotFound(_0x5a268b,null))[_0xf1a2('0x1f')](function(_0x427eb7){if(_0x427eb7){_0xe7280d=_0x427eb7;_0x372026['model']=_[_0xf1a2('0x42')](db[_0xf1a2('0x65')]['rawAttributes']);_0x372026[_0xf1a2('0x41')]=_['keys'](_0x2ae989[_0xf1a2('0x41')]);_0x372026[_0xf1a2('0x43')]=_[_0xf1a2('0x44')](_0x372026[_0xf1a2('0x45')],_0x372026[_0xf1a2('0x41')]);_0x4b4b01[_0xf1a2('0x46')]=_[_0xf1a2('0x44')](_0x372026[_0xf1a2('0x45')],qs[_0xf1a2('0x47')](_0x2ae989['query']['fields']));_0x4b4b01['attributes']=_0x4b4b01[_0xf1a2('0x46')][_0xf1a2('0x57')]?_0x4b4b01['attributes']:_0x372026[_0xf1a2('0x45')];_0x4b4b01[_0xf1a2('0x4a')]=qs[_0xf1a2('0x4b')](_0x2ae989['query']['sort']);_0x4b4b01[_0xf1a2('0x4c')]=qs[_0xf1a2('0x43')](_[_0xf1a2('0x63')](_0x2ae989[_0xf1a2('0x41')],_0x372026[_0xf1a2('0x43')]));if(_0x2ae989[_0xf1a2('0x41')]['filter']){_0x4b4b01[_0xf1a2('0x4c')]=_[_0xf1a2('0x4f')](_0x4b4b01[_0xf1a2('0x4c')],{'$or':_['map'](_0x4b4b01[_0xf1a2('0x46')],function(_0x20db49){var _0x5ad946={};_0x5ad946[_0x20db49]={'$like':'%'+_0x2ae989['query'][_0xf1a2('0x4d')]+'%'};return _0x5ad946;})});}_0x4b4b01=_[_0xf1a2('0x4f')]({},_0x4b4b01,_0x2ae989[_0xf1a2('0x50')]);return _0xe7280d[_0xf1a2('0x93')](_0x4b4b01);}})[_0xf1a2('0x1f')](function(_0x491f3d){if(_0x491f3d){_0x5e99cb=_0x491f3d[_0xf1a2('0x57')];if(!_0x2ae989[_0xf1a2('0x41')][_0xf1a2('0x48')](_0xf1a2('0x49'))){_0x4b4b01[_0xf1a2('0x2f')]=qs[_0xf1a2('0x2f')](_0x2ae989[_0xf1a2('0x41')]['limit']);_0x4b4b01[_0xf1a2('0x2e')]=qs[_0xf1a2('0x2e')](_0x2ae989[_0xf1a2('0x41')][_0xf1a2('0x2e')]);}return _0xe7280d[_0xf1a2('0x93')](_0x4b4b01);}})[_0xf1a2('0x1f')](function(_0xc6f7de){if(_0xc6f7de){return _0xc6f7de?{'count':_0x5e99cb,'rows':_0xc6f7de}:null;}})[_0xf1a2('0x1f')](respondWithResult(_0x5a268b,null))[_0xf1a2('0x2a')](handleError(_0x5a268b,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 2a508f0..aac49d4 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 _0xb784=['hasOwnProperty','hook','exports','events','ChatQueue','setMaxListeners','save','update','remove','emit'];(function(_0x59943d,_0x2e751b){var _0x46ace9=function(_0xfbd5f2){while(--_0xfbd5f2){_0x59943d['push'](_0x59943d['shift']());}};_0x46ace9(++_0x2e751b);}(_0xb784,0x8f));var _0x4b78=function(_0x28d645,_0x40dd0d){_0x28d645=_0x28d645-0x0;var _0x3f25c3=_0xb784[_0x28d645];return _0x3f25c3;};'use strict';var EventEmitter=require(_0x4b78('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x4b78('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x4b78('0x2')](0x0);var events={'afterCreate':_0x4b78('0x3'),'afterUpdate':_0x4b78('0x4'),'afterDestroy':_0x4b78('0x5')};function emitEvent(_0x1fcf70){return function(_0x174bb6,_0x22677b,_0x4e1b65){ChatQueueEvents[_0x4b78('0x6')](_0x1fcf70+':'+_0x174bb6['id'],_0x174bb6);ChatQueueEvents[_0x4b78('0x6')](_0x1fcf70,_0x174bb6);_0x4e1b65(null);};}for(var e in events){if(events[_0x4b78('0x7')](e)){var event=events[e];ChatQueue[_0x4b78('0x8')](e,emitEvent(event));}}module[_0x4b78('0x9')]=ChatQueueEvents; \ No newline at end of file +var _0x1235=['exports','events','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x22f85a,_0x195ed5){var _0xaa717=function(_0xe9828e){while(--_0xe9828e){_0x22f85a['push'](_0x22f85a['shift']());}};_0xaa717(++_0x195ed5);}(_0x1235,0x71));var _0x5123=function(_0x812862,_0x2e003d){_0x812862=_0x812862-0x0;var _0x4f6c62=_0x1235[_0x812862];return _0x4f6c62;};'use strict';var EventEmitter=require(_0x5123('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x5123('0x1')](0x0);var events={'afterCreate':_0x5123('0x2'),'afterUpdate':_0x5123('0x3'),'afterDestroy':'remove'};function emitEvent(_0x50dd9d){return function(_0x4ab6bd,_0x4dda2a,_0x3d94f6){ChatQueueEvents[_0x5123('0x4')](_0x50dd9d+':'+_0x4ab6bd['id'],_0x4ab6bd);ChatQueueEvents[_0x5123('0x4')](_0x50dd9d,_0x4ab6bd);_0x3d94f6(null);};}for(var e in events){if(events[_0x5123('0x5')](e)){var event=events[e];ChatQueue[_0x5123('0x6')](e,emitEvent(event));}}module[_0x5123('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 07eea20..c901dfd 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 _0xc979=['lodash','util','../../config/logger','api','request-promise','path','rimraf','./chatQueue.attributes','exports','ChatQueue','chat_queues'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xc979,0x1ef));var _0x9c97=function(_0x3c3210,_0x5356d0){_0x3c3210=_0x3c3210-0x0;var _0xa13f7f=_0xc979[_0x3c3210];return _0xa13f7f;};'use strict';var _=require(_0x9c97('0x0'));var util=require(_0x9c97('0x1'));var logger=require(_0x9c97('0x2'))(_0x9c97('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9c97('0x4'));var fs=require('fs');var path=require(_0x9c97('0x5'));var rimraf=require(_0x9c97('0x6'));var config=require('../../config/environment');var attributes=require(_0x9c97('0x7'));module[_0x9c97('0x8')]=function(_0x6b98c8,_0x28f1f8){return _0x6b98c8['define'](_0x9c97('0x9'),attributes,{'tableName':_0x9c97('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x449a=['util','api','moment','request-promise','path','./chatQueue.attributes','define','ChatQueue','chat_queues'];(function(_0x2445ed,_0x4a98d3){var _0x209d28=function(_0x225cb1){while(--_0x225cb1){_0x2445ed['push'](_0x2445ed['shift']());}};_0x209d28(++_0x4a98d3);}(_0x449a,0x7e));var _0xa449=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x449a[_0x9fd887];return _0x1a54ab;};'use strict';var _=require('lodash');var util=require(_0xa449('0x0'));var logger=require('../../config/logger')(_0xa449('0x1'));var moment=require(_0xa449('0x2'));var BPromise=require('bluebird');var rp=require(_0xa449('0x3'));var fs=require('fs');var path=require(_0xa449('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa449('0x5'));module['exports']=function(_0xf47e45,_0x273b21){return _0xf47e45[_0xa449('0x6')](_0xa449('0x7'),attributes,{'tableName':_0xa449('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 1abedf8..8a5086c 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 _0x5ed0=['debug','error','code','message','result','catch','GetChatQueue','ChatQueue','options','raw','limit','include','model','attributes','map','stringify','ShowChatQueue','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x38b676,_0x20789c){var _0x134a56=function(_0x53158a){while(--_0x53158a){_0x38b676['push'](_0x38b676['shift']());}};_0x134a56(++_0x20789c);}(_0x5ed0,0xcb));var _0x05ed=function(_0x1aea88,_0x5db37b){_0x1aea88=_0x1aea88-0x0;var _0x2c0309=_0x5ed0[_0x1aea88];return _0x2c0309;};'use strict';var _=require('lodash');var util=require(_0x05ed('0x0'));var moment=require(_0x05ed('0x1'));var BPromise=require(_0x05ed('0x2'));var rs=require(_0x05ed('0x3'));var fs=require('fs');var Redis=require(_0x05ed('0x4'));var db=require(_0x05ed('0x5'))['db'];var utils=require(_0x05ed('0x6'));var logger=require(_0x05ed('0x7'))('rpc');var config=require(_0x05ed('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x05ed('0x9')]({'port':0x232a});config[_0x05ed('0xa')]=_[_0x05ed('0xb')](config[_0x05ed('0xa')],{'host':_0x05ed('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x05ed('0xa')]));require('./chatQueue.socket')[_0x05ed('0xd')](socket);function respondWithRpcPromise(_0x1f64ac,_0x4dd2e4,_0x8a6298){return new BPromise(function(_0x1c6502,_0x4fdba5){return client[_0x05ed('0xe')](_0x1f64ac,_0x8a6298)[_0x05ed('0xf')](function(_0x18954b){logger[_0x05ed('0x10')](_0x05ed('0x11'),_0x4dd2e4,_0x05ed('0x12'));logger[_0x05ed('0x13')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x4dd2e4,'request\x20sent',JSON['stringify'](_0x18954b));if(_0x18954b[_0x05ed('0x14')]){if(_0x18954b[_0x05ed('0x14')][_0x05ed('0x15')]===0x1f4){logger['error'](_0x05ed('0x11'),_0x4dd2e4,_0x18954b[_0x05ed('0x14')][_0x05ed('0x16')]);return _0x4fdba5(_0x18954b[_0x05ed('0x14')]['message']);}logger[_0x05ed('0x14')](_0x05ed('0x11'),_0x4dd2e4,_0x18954b[_0x05ed('0x14')]['message']);return _0x1c6502(_0x18954b[_0x05ed('0x14')][_0x05ed('0x16')]);}else{logger['info'](_0x05ed('0x11'),_0x4dd2e4,'request\x20sent');_0x1c6502(_0x18954b[_0x05ed('0x17')][_0x05ed('0x16')]);}})[_0x05ed('0x18')](function(_0x519124){logger['error'](_0x05ed('0x11'),_0x4dd2e4,_0x519124);_0x4fdba5(_0x519124);});});}exports[_0x05ed('0x19')]=function(_0x28de40){var _0x1bdf4d=this;return new Promise(function(_0x397a45,_0x3b023c){return db[_0x05ed('0x1a')]['findAll']({'raw':_0x28de40[_0x05ed('0x1b')]?_0x28de40[_0x05ed('0x1b')][_0x05ed('0x1c')]===undefined?!![]:![]:!![],'where':_0x28de40['options']?_0x28de40[_0x05ed('0x1b')]['where']||null:null,'attributes':_0x28de40[_0x05ed('0x1b')]?_0x28de40['options']['attributes']||null:null,'limit':_0x28de40['options']?_0x28de40['options'][_0x05ed('0x1d')]||null:null,'include':_0x28de40[_0x05ed('0x1b')]?_0x28de40[_0x05ed('0x1b')][_0x05ed('0x1e')]?_['map'](_0x28de40['options'][_0x05ed('0x1e')],function(_0x307321){return{'model':db[_0x307321[_0x05ed('0x1f')]],'as':_0x307321['as'],'attributes':_0x307321[_0x05ed('0x20')],'include':_0x307321[_0x05ed('0x1e')]?_[_0x05ed('0x21')](_0x307321[_0x05ed('0x1e')],function(_0x141c8f){return{'model':db[_0x141c8f[_0x05ed('0x1f')]],'as':_0x141c8f['as'],'attributes':_0x141c8f['attributes'],'include':_0x141c8f['include']?_['map'](_0x141c8f[_0x05ed('0x1e')],function(_0x5854cc){return{'model':db[_0x5854cc[_0x05ed('0x1f')]],'as':_0x5854cc['as'],'attributes':_0x5854cc[_0x05ed('0x20')]};}):[]};}):[]};}):[]:[]})[_0x05ed('0xf')](function(_0x4db7f4){logger['info'](_0x05ed('0x19'),_0x28de40);logger['debug'](_0x05ed('0x19'),_0x28de40,JSON[_0x05ed('0x22')](_0x4db7f4));_0x397a45(_0x4db7f4);})[_0x05ed('0x18')](function(_0x7644f0){logger[_0x05ed('0x14')](_0x05ed('0x19'),_0x7644f0['message'],_0x28de40);_0x3b023c(_0x1bdf4d['error'](0x1f4,_0x7644f0[_0x05ed('0x16')]));});});};exports[_0x05ed('0x23')]=function(_0x409588){var _0x1c7759=this;return new Promise(function(_0x1668ba,_0x3e95ad){return db[_0x05ed('0x1a')][_0x05ed('0x24')]({'raw':_0x409588[_0x05ed('0x1b')]?_0x409588[_0x05ed('0x1b')][_0x05ed('0x1c')]===undefined?!![]:![]:!![],'where':_0x409588['options']?_0x409588['options']['where']||null:null,'attributes':_0x409588[_0x05ed('0x1b')]?_0x409588[_0x05ed('0x1b')]['attributes']||null:null,'include':_0x409588[_0x05ed('0x1b')]?_0x409588[_0x05ed('0x1b')][_0x05ed('0x1e')]?_[_0x05ed('0x21')](_0x409588[_0x05ed('0x1b')][_0x05ed('0x1e')],function(_0x3454f7){return{'model':db[_0x3454f7[_0x05ed('0x1f')]],'as':_0x3454f7['as'],'attributes':_0x3454f7[_0x05ed('0x20')],'include':_0x3454f7[_0x05ed('0x1e')]?_['map'](_0x3454f7['include'],function(_0x3f8f26){return{'model':db[_0x3f8f26[_0x05ed('0x1f')]],'as':_0x3f8f26['as'],'attributes':_0x3f8f26['attributes'],'include':_0x3f8f26['include']?_[_0x05ed('0x21')](_0x3f8f26[_0x05ed('0x1e')],function(_0x30d771){return{'model':db[_0x30d771[_0x05ed('0x1f')]],'as':_0x30d771['as'],'attributes':_0x30d771[_0x05ed('0x20')]};}):[]};}):[]};}):[]:[]})[_0x05ed('0xf')](function(_0x46b118){logger[_0x05ed('0x10')](_0x05ed('0x23'),_0x409588);logger[_0x05ed('0x13')](_0x05ed('0x23'),_0x409588,JSON[_0x05ed('0x22')](_0x46b118));_0x1668ba(_0x46b118);})[_0x05ed('0x18')](function(_0x1ec847){logger['error'](_0x05ed('0x23'),_0x1ec847[_0x05ed('0x16')],_0x409588);_0x3e95ad(_0x1c7759[_0x05ed('0x14')](0x1f4,_0x1ec847[_0x05ed('0x16')]));});});}; \ No newline at end of file +var _0x4cf5=['register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','findAll','options','where','attributes','map','include','model','GetChatQueue','ShowChatQueue','find','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4cf5,0x12e));var _0x54cf=function(_0x5baf6d,_0x439aa7){_0x5baf6d=_0x5baf6d-0x0;var _0x285208=_0x4cf5[_0x5baf6d];return _0x285208;};'use strict';var _=require(_0x54cf('0x0'));var util=require(_0x54cf('0x1'));var moment=require(_0x54cf('0x2'));var BPromise=require(_0x54cf('0x3'));var rs=require(_0x54cf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x54cf('0x5'));var logger=require(_0x54cf('0x6'))(_0x54cf('0x7'));var config=require('../../config/environment');var jayson=require(_0x54cf('0x8'));var client=jayson['client'][_0x54cf('0x9')]({'port':0x232a});config[_0x54cf('0xa')]=_[_0x54cf('0xb')](config[_0x54cf('0xa')],{'host':_0x54cf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatQueue.socket')[_0x54cf('0xd')](socket);function respondWithRpcPromise(_0x57d7bb,_0x2b69a7,_0x2b6978){return new BPromise(function(_0x24f27d,_0x15e77d){return client['request'](_0x57d7bb,_0x2b6978)[_0x54cf('0xe')](function(_0x15aafe){logger[_0x54cf('0xf')](_0x54cf('0x10'),_0x2b69a7,_0x54cf('0x11'));logger[_0x54cf('0x12')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2b69a7,_0x54cf('0x11'),JSON[_0x54cf('0x13')](_0x15aafe));if(_0x15aafe[_0x54cf('0x14')]){if(_0x15aafe[_0x54cf('0x14')]['code']===0x1f4){logger[_0x54cf('0x14')](_0x54cf('0x10'),_0x2b69a7,_0x15aafe[_0x54cf('0x14')][_0x54cf('0x15')]);return _0x15e77d(_0x15aafe['error'][_0x54cf('0x15')]);}logger[_0x54cf('0x14')]('ChatQueue,\x20%s,\x20%s',_0x2b69a7,_0x15aafe[_0x54cf('0x14')][_0x54cf('0x15')]);return _0x24f27d(_0x15aafe['error']['message']);}else{logger['info'](_0x54cf('0x10'),_0x2b69a7,_0x54cf('0x11'));_0x24f27d(_0x15aafe[_0x54cf('0x16')]['message']);}})[_0x54cf('0x17')](function(_0x4c0a33){logger[_0x54cf('0x14')](_0x54cf('0x10'),_0x2b69a7,_0x4c0a33);_0x15e77d(_0x4c0a33);});});}exports['GetChatQueue']=function(_0x51628f){var _0x2a279e=this;return new Promise(function(_0x36b9d6,_0x943d2d){return db['ChatQueue'][_0x54cf('0x18')]({'raw':_0x51628f[_0x54cf('0x19')]?_0x51628f[_0x54cf('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x51628f['options']?_0x51628f[_0x54cf('0x19')][_0x54cf('0x1a')]||null:null,'attributes':_0x51628f[_0x54cf('0x19')]?_0x51628f[_0x54cf('0x19')][_0x54cf('0x1b')]||null:null,'limit':_0x51628f[_0x54cf('0x19')]?_0x51628f['options']['limit']||null:null,'include':_0x51628f[_0x54cf('0x19')]?_0x51628f['options']['include']?_[_0x54cf('0x1c')](_0x51628f[_0x54cf('0x19')][_0x54cf('0x1d')],function(_0x587ef0){return{'model':db[_0x587ef0['model']],'as':_0x587ef0['as'],'attributes':_0x587ef0[_0x54cf('0x1b')],'include':_0x587ef0[_0x54cf('0x1d')]?_['map'](_0x587ef0[_0x54cf('0x1d')],function(_0xeb645a){return{'model':db[_0xeb645a[_0x54cf('0x1e')]],'as':_0xeb645a['as'],'attributes':_0xeb645a['attributes'],'include':_0xeb645a[_0x54cf('0x1d')]?_[_0x54cf('0x1c')](_0xeb645a[_0x54cf('0x1d')],function(_0x10588d){return{'model':db[_0x10588d[_0x54cf('0x1e')]],'as':_0x10588d['as'],'attributes':_0x10588d['attributes']};}):[]};}):[]};}):[]:[]})[_0x54cf('0xe')](function(_0x59a483){logger[_0x54cf('0xf')](_0x54cf('0x1f'),_0x51628f);logger[_0x54cf('0x12')]('GetChatQueue',_0x51628f,JSON[_0x54cf('0x13')](_0x59a483));_0x36b9d6(_0x59a483);})[_0x54cf('0x17')](function(_0x5678b8){logger[_0x54cf('0x14')](_0x54cf('0x1f'),_0x5678b8['message'],_0x51628f);_0x943d2d(_0x2a279e[_0x54cf('0x14')](0x1f4,_0x5678b8[_0x54cf('0x15')]));});});};exports[_0x54cf('0x20')]=function(_0x1040e9){var _0x188e98=this;return new Promise(function(_0x5a1088,_0x506cc){return db['ChatQueue'][_0x54cf('0x21')]({'raw':_0x1040e9['options']?_0x1040e9[_0x54cf('0x19')][_0x54cf('0x22')]===undefined?!![]:![]:!![],'where':_0x1040e9[_0x54cf('0x19')]?_0x1040e9[_0x54cf('0x19')][_0x54cf('0x1a')]||null:null,'attributes':_0x1040e9[_0x54cf('0x19')]?_0x1040e9[_0x54cf('0x19')]['attributes']||null:null,'include':_0x1040e9[_0x54cf('0x19')]?_0x1040e9[_0x54cf('0x19')][_0x54cf('0x1d')]?_[_0x54cf('0x1c')](_0x1040e9[_0x54cf('0x19')][_0x54cf('0x1d')],function(_0x6ad37e){return{'model':db[_0x6ad37e[_0x54cf('0x1e')]],'as':_0x6ad37e['as'],'attributes':_0x6ad37e[_0x54cf('0x1b')],'include':_0x6ad37e[_0x54cf('0x1d')]?_[_0x54cf('0x1c')](_0x6ad37e['include'],function(_0xc1a6b7){return{'model':db[_0xc1a6b7[_0x54cf('0x1e')]],'as':_0xc1a6b7['as'],'attributes':_0xc1a6b7[_0x54cf('0x1b')],'include':_0xc1a6b7['include']?_[_0x54cf('0x1c')](_0xc1a6b7[_0x54cf('0x1d')],function(_0x212b47){return{'model':db[_0x212b47[_0x54cf('0x1e')]],'as':_0x212b47['as'],'attributes':_0x212b47[_0x54cf('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47b0dc){logger[_0x54cf('0xf')]('ShowChatQueue',_0x1040e9);logger[_0x54cf('0x12')](_0x54cf('0x20'),_0x1040e9,JSON[_0x54cf('0x13')](_0x47b0dc));_0x5a1088(_0x47b0dc);})['catch'](function(_0x7caa48){logger['error'](_0x54cf('0x20'),_0x7caa48[_0x54cf('0x15')],_0x1040e9);_0x506cc(_0x188e98[_0x54cf('0x14')](0x1f4,_0x7caa48[_0x54cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 437632c..9392cdb 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 _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x23ff19,_0x3ed90f){var _0x540d87=function(_0x2949ef){while(--_0x2949ef){_0x23ff19['push'](_0x23ff19['shift']());}};_0x540d87(++_0x3ed90f);}(_0x4b84,0x1cc));var _0x44b8=function(_0x33c9f8,_0x5aedbb){_0x33c9f8=_0x33c9f8-0x0;var _0x2d7004=_0x4b84[_0x33c9f8];return _0x2d7004;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file +var _0xbb53=['length','./chatQueue.events','save','remove','update','emit'];(function(_0x24f5fe,_0x2171bd){var _0x587652=function(_0x1b2119){while(--_0x1b2119){_0x24f5fe['push'](_0x24f5fe['shift']());}};_0x587652(++_0x2171bd);}(_0xbb53,0x121));var _0x3bb5=function(_0xf382e5,_0x4c8690){_0xf382e5=_0xf382e5-0x0;var _0x3272b6=_0xbb53[_0xf382e5];return _0x3272b6;};'use strict';var ChatQueueEvents=require(_0x3bb5('0x0'));var events=[_0x3bb5('0x1'),_0x3bb5('0x2'),_0x3bb5('0x3')];function createListener(_0x20c8b6,_0x226d39){return function(_0x414da7){_0x226d39[_0x3bb5('0x4')](_0x20c8b6,_0x414da7);};}function removeListener(_0x83e44b,_0x450d9e){return function(){ChatQueueEvents['removeListener'](_0x83e44b,_0x450d9e);};}exports['register']=function(_0x23f11e){for(var _0x2460b0=0x0,_0x28aa7d=events[_0x3bb5('0x5')];_0x2460b0<_0x28aa7d;_0x2460b0++){var _0x22f92f=events[_0x2460b0];var _0x480f9c=createListener('chatQueue:'+_0x22f92f,_0x23f11e);ChatQueueEvents['on'](_0x22f92f,_0x480f9c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index e37af60..39858a5 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 _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x39f9de,_0x4cee1c){var _0x5dca4d=function(_0x3e9b04){while(--_0x3e9b04){_0x39f9de['push'](_0x39f9de['shift']());}};_0x5dca4d(++_0x4cee1c);}(_0x7217,0x19e));var _0x7721=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x7217[_0x4e1d03];return _0x362d4b;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x249d89,_0x3423c5){var _0x469254=function(_0x19fcb9){while(--_0x19fcb9){_0x249d89['push'](_0x249d89['shift']());}};_0x469254(++_0x3423c5);}(_0x7217,0x19e));var _0x7721=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x7217[_0x2763f2];return _0x3ef471;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 20e2ff1..7b9a727 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 _0xde4e=['STRING','DATE','moment','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xde4e,0x1ec));var _0xede4=function(_0x314115,_0x384810){_0x314115=_0x314115-0x0;var _0x41fecf=_0xde4e[_0x314115];return _0x41fecf;};'use strict';var moment=require(_0xede4('0x0'));var Sequelize=require(_0xede4('0x1'));module[_0xede4('0x2')]={'uniqueid':{'type':Sequelize[_0xede4('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xede4('0x3')]},'joinAt':{'type':Sequelize[_0xede4('0x4')]},'leaveAt':{'type':Sequelize[_0xede4('0x4')]},'acceptAt':{'type':Sequelize[_0xede4('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xede4('0x3')]}}; \ No newline at end of file +var _0x25ac=['DATE','STRING'];(function(_0x3dcc78,_0x5a3972){var _0x4c173c=function(_0x2f675f){while(--_0x2f675f){_0x3dcc78['push'](_0x3dcc78['shift']());}};_0x4c173c(++_0x5a3972);}(_0x25ac,0x1d3));var _0xc25a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25ac[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xc25a('0x0')]},'joinAt':{'type':Sequelize[_0xc25a('0x1')]},'leaveAt':{'type':Sequelize[_0xc25a('0x1')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xc25a('0x1')]},'reason':{'type':Sequelize[_0xc25a('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 2bef246..0fe6e3c 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 _0x81c6=['includeAll','include','findAll','rows','catch','show','keys','fields','length','create','body','find','params','describe','rimraf','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','update','then','destroy','end','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','options','ChatQueueReport'];(function(_0x3b887e,_0x2f1318){var _0x22c0f4=function(_0x4bc632){while(--_0x4bc632){_0x3b887e['push'](_0x3b887e['shift']());}};_0x22c0f4(++_0x2f1318);}(_0x81c6,0x1d5));var _0x681c=function(_0x36a4f9,_0x3f5506){_0x36a4f9=_0x36a4f9-0x0;var _0x479588=_0x81c6[_0x36a4f9];return _0x479588;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x681c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x681c('0x1'));var BPromise=require(_0x681c('0x2'));var Mustache=require(_0x681c('0x3'));var util=require('util');var path=require(_0x681c('0x4'));var sox=require(_0x681c('0x5'));var csv=require(_0x681c('0x6'));var ejs=require(_0x681c('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x681c('0x8'));var squel=require(_0x681c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x681c('0xa'));var toCsv=require(_0x681c('0x6'));var querystring=require(_0x681c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x681c('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x681c('0xd'));var hardwareService=require(_0x681c('0xe'));var logger=require(_0x681c('0xf'))(_0x681c('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x681c('0x11'));var db=require(_0x681c('0x12'))['db'];function respondWithStatusCode(_0x2d379b,_0x50cae8){_0x50cae8=_0x50cae8||0xcc;return function(_0x2e4651){if(_0x2e4651){return _0x2d379b['sendStatus'](_0x50cae8);}return _0x2d379b[_0x681c('0x13')](_0x50cae8)['end']();};}function respondWithResult(_0x2c059e,_0x27c3a2){_0x27c3a2=_0x27c3a2||0xc8;return function(_0xe8bb4d){if(_0xe8bb4d){return _0x2c059e[_0x681c('0x13')](_0x27c3a2)[_0x681c('0x14')](_0xe8bb4d);}};}function respondWithFilteredResult(_0x2bc3fb,_0x50a4ec){return function(_0x2b0939){if(_0x2b0939){var _0x1135c9=typeof _0x50a4ec[_0x681c('0x15')]===_0x681c('0x16')&&typeof _0x50a4ec[_0x681c('0x17')]===_0x681c('0x16');var _0x4e7df2=_0x2b0939[_0x681c('0x18')];var _0x42f506=_0x1135c9?0x0:_0x50a4ec[_0x681c('0x15')];var _0x42304f=_0x1135c9?_0x2b0939['count']:_0x50a4ec[_0x681c('0x15')]+_0x50a4ec[_0x681c('0x17')];var _0x54d27f;if(_0x42304f>=_0x4e7df2){_0x42304f=_0x4e7df2;_0x54d27f=0xc8;}else{_0x54d27f=0xce;}_0x2bc3fb[_0x681c('0x13')](_0x54d27f);return _0x2bc3fb['set'](_0x681c('0x19'),_0x42f506+'-'+_0x42304f+'/'+_0x4e7df2)[_0x681c('0x14')](_0x2b0939);}return null;};}function patchUpdates(_0x11d68d){return function(_0x33c495){try{jsonpatch[_0x681c('0x1a')](_0x33c495,_0x11d68d,!![]);}catch(_0x51d626){return BPromise['reject'](_0x51d626);}return _0x33c495['save']();};}function saveUpdates(_0x2e5331,_0x39c8b7){return function(_0x3adfe3){if(_0x3adfe3){return _0x3adfe3[_0x681c('0x1b')](_0x2e5331)[_0x681c('0x1c')](function(_0x29f3fa){return _0x29f3fa;});}return null;};}function removeEntity(_0x415a0a,_0x3d0297){return function(_0x1b3d2b){if(_0x1b3d2b){return _0x1b3d2b[_0x681c('0x1d')]()[_0x681c('0x1c')](function(){_0x415a0a[_0x681c('0x13')](0xcc)[_0x681c('0x1e')]();});}};}function handleEntityNotFound(_0x218410,_0x3237ed){return function(_0x228f59){if(!_0x228f59){_0x218410['sendStatus'](0x194);}return _0x228f59;};}function handleError(_0x11063b,_0x5705a7){_0x5705a7=_0x5705a7||0x1f4;return function(_0x5f8d64){logger['error'](_0x5f8d64['stack']);if(_0x5f8d64[_0x681c('0x1f')]){delete _0x5f8d64[_0x681c('0x1f')];}_0x11063b[_0x681c('0x13')](_0x5705a7)[_0x681c('0x20')](_0x5f8d64);};}exports['index']=function(_0x3b1031,_0x39fca3){var _0x2fde4b={},_0x936fce={},_0x147cda={'count':0x0,'rows':[]};var _0x204006=_[_0x681c('0x21')](db['ChatQueueReport'][_0x681c('0x22')],function(_0x390be5){return{'name':_0x390be5[_0x681c('0x23')],'type':_0x390be5['type'][_0x681c('0x24')]};});_0x936fce[_0x681c('0x25')]=_[_0x681c('0x21')](_0x204006,'name');_0x936fce[_0x681c('0x26')]=_['keys'](_0x3b1031['query']);_0x936fce[_0x681c('0x27')]=_[_0x681c('0x28')](_0x936fce[_0x681c('0x25')],_0x936fce['query']);_0x2fde4b[_0x681c('0x29')]=_['intersection'](_0x936fce[_0x681c('0x25')],qs['fields'](_0x3b1031['query']['fields']));_0x2fde4b[_0x681c('0x29')]=_0x2fde4b[_0x681c('0x29')]['length']?_0x2fde4b[_0x681c('0x29')]:_0x936fce['model'];if(!_0x3b1031['query'][_0x681c('0x2a')]('nolimit')){_0x2fde4b[_0x681c('0x17')]=qs[_0x681c('0x17')](_0x3b1031[_0x681c('0x26')]['limit']);_0x2fde4b['offset']=qs[_0x681c('0x15')](_0x3b1031[_0x681c('0x26')]['offset']);}_0x2fde4b[_0x681c('0x2b')]=qs[_0x681c('0x2c')](_0x3b1031[_0x681c('0x26')]['sort']);_0x2fde4b[_0x681c('0x2d')]=qs[_0x681c('0x27')](_['pick'](_0x3b1031[_0x681c('0x26')],_0x936fce[_0x681c('0x27')]),_0x204006);if(_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]){_0x2fde4b[_0x681c('0x2d')]=_['merge'](_0x2fde4b['where'],{'$or':_[_0x681c('0x21')](_0x204006,function(_0x373f33){if(_0x373f33['type']!==_0x681c('0x2f')){var _0x183f13={};_0x183f13[_0x373f33['name']]={'$like':'%'+_0x3b1031[_0x681c('0x26')][_0x681c('0x2e')]+'%'};return _0x183f13;}})});}_0x2fde4b=_[_0x681c('0x30')]({},_0x2fde4b,_0x3b1031[_0x681c('0x31')]);var _0x3b258b={'where':_0x2fde4b[_0x681c('0x2d')]};return db[_0x681c('0x32')][_0x681c('0x18')](_0x3b258b)[_0x681c('0x1c')](function(_0x1ece6f){_0x147cda['count']=_0x1ece6f;if(_0x3b1031[_0x681c('0x26')][_0x681c('0x33')]){_0x2fde4b[_0x681c('0x34')]=[{'all':!![]}];}return db[_0x681c('0x32')][_0x681c('0x35')](_0x2fde4b);})[_0x681c('0x1c')](function(_0x542c02){_0x147cda[_0x681c('0x36')]=_0x542c02;return _0x147cda;})[_0x681c('0x1c')](respondWithFilteredResult(_0x39fca3,_0x2fde4b))[_0x681c('0x37')](handleError(_0x39fca3,null));};exports[_0x681c('0x38')]=function(_0x30abe8,_0x5dd2f4){var _0x2143a9={'raw':!![],'where':{'id':_0x30abe8['params']['id']}},_0x5d7031={};_0x5d7031[_0x681c('0x25')]=_[_0x681c('0x39')](db[_0x681c('0x32')][_0x681c('0x22')]);_0x5d7031['query']=_[_0x681c('0x39')](_0x30abe8['query']);_0x5d7031['filters']=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],_0x5d7031[_0x681c('0x26')]);_0x2143a9[_0x681c('0x29')]=_[_0x681c('0x28')](_0x5d7031[_0x681c('0x25')],qs['fields'](_0x30abe8[_0x681c('0x26')][_0x681c('0x3a')]));_0x2143a9['attributes']=_0x2143a9['attributes'][_0x681c('0x3b')]?_0x2143a9['attributes']:_0x5d7031[_0x681c('0x25')];if(_0x30abe8['query']['includeAll']){_0x2143a9['include']=[{'all':!![]}];}_0x2143a9=_[_0x681c('0x30')]({},_0x2143a9,_0x30abe8[_0x681c('0x31')]);return db[_0x681c('0x32')]['find'](_0x2143a9)[_0x681c('0x1c')](handleEntityNotFound(_0x5dd2f4,null))[_0x681c('0x1c')](respondWithResult(_0x5dd2f4,null))['catch'](handleError(_0x5dd2f4,null));};exports[_0x681c('0x3c')]=function(_0x17bb48,_0x15d1c0){return db[_0x681c('0x32')]['create'](_0x17bb48[_0x681c('0x3d')],{})['then'](respondWithResult(_0x15d1c0,0xc9))[_0x681c('0x37')](handleError(_0x15d1c0,null));};exports[_0x681c('0x1b')]=function(_0xa56f20,_0x5731f0){if(_0xa56f20[_0x681c('0x3d')]['id']){delete _0xa56f20[_0x681c('0x3d')]['id'];}return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0xa56f20[_0x681c('0x3f')]['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x5731f0,null))[_0x681c('0x1c')](saveUpdates(_0xa56f20[_0x681c('0x3d')],null))[_0x681c('0x1c')](respondWithResult(_0x5731f0,null))[_0x681c('0x37')](handleError(_0x5731f0,null));};exports[_0x681c('0x1d')]=function(_0x37bdf6,_0x4cae41){return db[_0x681c('0x32')][_0x681c('0x3e')]({'where':{'id':_0x37bdf6['params']['id']}})[_0x681c('0x1c')](handleEntityNotFound(_0x4cae41,null))[_0x681c('0x1c')](removeEntity(_0x4cae41,null))['catch'](handleError(_0x4cae41,null));};exports[_0x681c('0x40')]=function(_0x5e58bf,_0x38daf8){return db[_0x681c('0x32')][_0x681c('0x40')]()['then'](respondWithResult(_0x38daf8,null))[_0x681c('0x37')](handleError(_0x38daf8,null));}; \ No newline at end of file +var _0xfe39=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch'];(function(_0x2feb53,_0x264ef7){var _0x5700ee=function(_0x700c98){while(--_0x700c98){_0x2feb53['push'](_0x2feb53['shift']());}};_0x5700ee(++_0x264ef7);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xfe39[_0x411017];return _0x2adeea;};'use strict';var emlformat=require(_0x9fe3('0x0'));var rimraf=require(_0x9fe3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9fe3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9fe3('0x3'));var Mustache=require(_0x9fe3('0x4'));var util=require('util');var path=require('path');var sox=require(_0x9fe3('0x5'));var csv=require(_0x9fe3('0x6'));var ejs=require(_0x9fe3('0x7'));var fs=require('fs');var fs_extra=require(_0x9fe3('0x8'));var _=require(_0x9fe3('0x9'));var squel=require(_0x9fe3('0xa'));var crypto=require(_0x9fe3('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9fe3('0xc'));var toCsv=require(_0x9fe3('0x6'));var querystring=require(_0x9fe3('0xd'));var Papa=require(_0x9fe3('0xe'));var Redis=require(_0x9fe3('0xf'));var authService=require(_0x9fe3('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9fe3('0x11'));var logger=require(_0x9fe3('0x12'))('api');var utils=require(_0x9fe3('0x13'));var config=require(_0x9fe3('0x14'));var licenseUtil=require(_0x9fe3('0x15'));var db=require(_0x9fe3('0x16'))['db'];function respondWithStatusCode(_0x51d1cb,_0x37bfef){_0x37bfef=_0x37bfef||0xcc;return function(_0x155013){if(_0x155013){return _0x51d1cb[_0x9fe3('0x17')](_0x37bfef);}return _0x51d1cb[_0x9fe3('0x18')](_0x37bfef)['end']();};}function respondWithResult(_0x4e4dcc,_0x329032){_0x329032=_0x329032||0xc8;return function(_0x31bbf3){if(_0x31bbf3){return _0x4e4dcc[_0x9fe3('0x18')](_0x329032)[_0x9fe3('0x19')](_0x31bbf3);}};}function respondWithFilteredResult(_0x1b2057,_0x5f5b58){return function(_0x5f0067){if(_0x5f0067){var _0x207eef=typeof _0x5f5b58[_0x9fe3('0x1a')]===_0x9fe3('0x1b')&&typeof _0x5f5b58[_0x9fe3('0x1c')]==='undefined';var _0xd7141a=_0x5f0067[_0x9fe3('0x1d')];var _0x15fcaa=_0x207eef?0x0:_0x5f5b58['offset'];var _0x35bbaf=_0x207eef?_0x5f0067[_0x9fe3('0x1d')]:_0x5f5b58['offset']+_0x5f5b58[_0x9fe3('0x1c')];var _0x4f272c;if(_0x35bbaf>=_0xd7141a){_0x35bbaf=_0xd7141a;_0x4f272c=0xc8;}else{_0x4f272c=0xce;}_0x1b2057[_0x9fe3('0x18')](_0x4f272c);return _0x1b2057['set'](_0x9fe3('0x1e'),_0x15fcaa+'-'+_0x35bbaf+'/'+_0xd7141a)[_0x9fe3('0x19')](_0x5f0067);}return null;};}function patchUpdates(_0x302d5c){return function(_0x5b53f3){try{jsonpatch['apply'](_0x5b53f3,_0x302d5c,!![]);}catch(_0x113f23){return BPromise[_0x9fe3('0x1f')](_0x113f23);}return _0x5b53f3['save']();};}function saveUpdates(_0x328989,_0x2e9ae5){return function(_0x587e43){if(_0x587e43){return _0x587e43[_0x9fe3('0x20')](_0x328989)[_0x9fe3('0x21')](function(_0x5b6719){return _0x5b6719;});}return null;};}function removeEntity(_0x3ec2e7,_0x2fb7a9){return function(_0x3fd88e){if(_0x3fd88e){return _0x3fd88e[_0x9fe3('0x22')]()[_0x9fe3('0x21')](function(){_0x3ec2e7[_0x9fe3('0x18')](0xcc)[_0x9fe3('0x23')]();});}};}function handleEntityNotFound(_0x4c1a30,_0x1763c0){return function(_0x1304ff){if(!_0x1304ff){_0x4c1a30[_0x9fe3('0x17')](0x194);}return _0x1304ff;};}function handleError(_0x3b29dd,_0x47f38b){_0x47f38b=_0x47f38b||0x1f4;return function(_0x1a4a43){logger[_0x9fe3('0x24')](_0x1a4a43[_0x9fe3('0x25')]);if(_0x1a4a43['name']){delete _0x1a4a43[_0x9fe3('0x26')];}_0x3b29dd[_0x9fe3('0x18')](_0x47f38b)[_0x9fe3('0x27')](_0x1a4a43);};}exports[_0x9fe3('0x28')]=function(_0x1d2da7,_0x17f01f){var _0x59eb15={},_0xa4d56e={},_0x369fde={'count':0x0,'rows':[]};var _0x31d8fb=_[_0x9fe3('0x29')](db[_0x9fe3('0x2a')][_0x9fe3('0x2b')],function(_0x5a9af3){return{'name':_0x5a9af3[_0x9fe3('0x2c')],'type':_0x5a9af3[_0x9fe3('0x2d')]['key']};});_0xa4d56e[_0x9fe3('0x2e')]=_[_0x9fe3('0x29')](_0x31d8fb,_0x9fe3('0x26'));_0xa4d56e[_0x9fe3('0x2f')]=_[_0x9fe3('0x30')](_0x1d2da7[_0x9fe3('0x2f')]);_0xa4d56e['filters']=_[_0x9fe3('0x31')](_0xa4d56e[_0x9fe3('0x2e')],_0xa4d56e[_0x9fe3('0x2f')]);_0x59eb15['attributes']=_['intersection'](_0xa4d56e['model'],qs[_0x9fe3('0x32')](_0x1d2da7['query'][_0x9fe3('0x32')]));_0x59eb15[_0x9fe3('0x33')]=_0x59eb15[_0x9fe3('0x33')][_0x9fe3('0x34')]?_0x59eb15[_0x9fe3('0x33')]:_0xa4d56e[_0x9fe3('0x2e')];if(!_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x35')](_0x9fe3('0x36'))){_0x59eb15['limit']=qs[_0x9fe3('0x1c')](_0x1d2da7['query']['limit']);_0x59eb15[_0x9fe3('0x1a')]=qs[_0x9fe3('0x1a')](_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x1a')]);}_0x59eb15['order']=qs[_0x9fe3('0x37')](_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x37')]);_0x59eb15['where']=qs[_0x9fe3('0x38')](_[_0x9fe3('0x39')](_0x1d2da7[_0x9fe3('0x2f')],_0xa4d56e[_0x9fe3('0x38')]),_0x31d8fb);if(_0x1d2da7['query'][_0x9fe3('0x3a')]){_0x59eb15[_0x9fe3('0x3b')]=_['merge'](_0x59eb15['where'],{'$or':_[_0x9fe3('0x29')](_0x31d8fb,function(_0x5a09e8){if(_0x5a09e8[_0x9fe3('0x2d')]!==_0x9fe3('0x3c')){var _0x294073={};_0x294073[_0x5a09e8[_0x9fe3('0x26')]]={'$like':'%'+_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x3a')]+'%'};return _0x294073;}})});}_0x59eb15=_[_0x9fe3('0x3d')]({},_0x59eb15,_0x1d2da7[_0x9fe3('0x3e')]);var _0x5932b5={'where':_0x59eb15[_0x9fe3('0x3b')]};return db[_0x9fe3('0x2a')][_0x9fe3('0x1d')](_0x5932b5)[_0x9fe3('0x21')](function(_0x24f7bf){_0x369fde[_0x9fe3('0x1d')]=_0x24f7bf;if(_0x1d2da7[_0x9fe3('0x2f')][_0x9fe3('0x3f')]){_0x59eb15[_0x9fe3('0x40')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x59eb15);})['then'](function(_0x4d96b8){_0x369fde[_0x9fe3('0x41')]=_0x4d96b8;return _0x369fde;})[_0x9fe3('0x21')](respondWithFilteredResult(_0x17f01f,_0x59eb15))[_0x9fe3('0x42')](handleError(_0x17f01f,null));};exports[_0x9fe3('0x43')]=function(_0x1e5c52,_0x5126b6){var _0x1868a2={'raw':!![],'where':{'id':_0x1e5c52[_0x9fe3('0x44')]['id']}},_0x157bf5={};_0x157bf5['model']=_[_0x9fe3('0x30')](db[_0x9fe3('0x2a')][_0x9fe3('0x2b')]);_0x157bf5['query']=_['keys'](_0x1e5c52['query']);_0x157bf5[_0x9fe3('0x38')]=_['intersection'](_0x157bf5[_0x9fe3('0x2e')],_0x157bf5[_0x9fe3('0x2f')]);_0x1868a2['attributes']=_['intersection'](_0x157bf5['model'],qs['fields'](_0x1e5c52[_0x9fe3('0x2f')][_0x9fe3('0x32')]));_0x1868a2[_0x9fe3('0x33')]=_0x1868a2[_0x9fe3('0x33')][_0x9fe3('0x34')]?_0x1868a2[_0x9fe3('0x33')]:_0x157bf5[_0x9fe3('0x2e')];if(_0x1e5c52[_0x9fe3('0x2f')]['includeAll']){_0x1868a2['include']=[{'all':!![]}];}_0x1868a2=_['merge']({},_0x1868a2,_0x1e5c52[_0x9fe3('0x3e')]);return db['ChatQueueReport'][_0x9fe3('0x45')](_0x1868a2)[_0x9fe3('0x21')](handleEntityNotFound(_0x5126b6,null))[_0x9fe3('0x21')](respondWithResult(_0x5126b6,null))[_0x9fe3('0x42')](handleError(_0x5126b6,null));};exports[_0x9fe3('0x46')]=function(_0x501504,_0x105373){return db[_0x9fe3('0x2a')][_0x9fe3('0x46')](_0x501504[_0x9fe3('0x47')],{})[_0x9fe3('0x21')](respondWithResult(_0x105373,0xc9))[_0x9fe3('0x42')](handleError(_0x105373,null));};exports['update']=function(_0x5dc31e,_0x480aa5){if(_0x5dc31e[_0x9fe3('0x47')]['id']){delete _0x5dc31e['body']['id'];}return db[_0x9fe3('0x2a')][_0x9fe3('0x45')]({'where':{'id':_0x5dc31e[_0x9fe3('0x44')]['id']}})[_0x9fe3('0x21')](handleEntityNotFound(_0x480aa5,null))[_0x9fe3('0x21')](saveUpdates(_0x5dc31e[_0x9fe3('0x47')],null))['then'](respondWithResult(_0x480aa5,null))[_0x9fe3('0x42')](handleError(_0x480aa5,null));};exports['destroy']=function(_0xe25bdb,_0x435e75){return db['ChatQueueReport'][_0x9fe3('0x45')]({'where':{'id':_0xe25bdb['params']['id']}})[_0x9fe3('0x21')](handleEntityNotFound(_0x435e75,null))[_0x9fe3('0x21')](removeEntity(_0x435e75,null))[_0x9fe3('0x42')](handleError(_0x435e75,null));};exports['describe']=function(_0x277251,_0x1235ad){return db['ChatQueueReport'][_0x9fe3('0x48')]()[_0x9fe3('0x21')](respondWithResult(_0x1235ad,null))[_0x9fe3('0x42')](handleError(_0x1235ad,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 762022d..8337474 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x3bec61,_0x3a04b8){var _0x4bf6d2=function(_0x51e312){while(--_0x51e312){_0x3bec61['push'](_0x3bec61['shift']());}};_0x4bf6d2(++_0x3a04b8);}(_0xe706,0xa3));var _0x6e70=function(_0x38d92b,_0x1be181){_0x38d92b=_0x38d92b-0x0;var _0x56c746=_0xe706[_0x38d92b];return _0x56c746;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x138be7,_0x4330b0){var _0x2a6924=function(_0x45b461){while(--_0x45b461){_0x138be7['push'](_0x138be7['shift']());}};_0x2a6924(++_0x4330b0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index b4e6193..cdb34f9 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 _0xe5a9=['code','message','info','result','catch','ChatQueueReport','create','body','options','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x261b1f,_0x594b1f){_0x261b1f=_0x261b1f-0x0;var _0x56529a=_0xe5a9[_0x261b1f];return _0x56529a;};'use strict';var _=require('lodash');var util=require(_0x9e5a('0x0'));var moment=require(_0x9e5a('0x1'));var BPromise=require(_0x9e5a('0x2'));var rs=require(_0x9e5a('0x3'));var fs=require('fs');var Redis=require(_0x9e5a('0x4'));var db=require(_0x9e5a('0x5'))['db'];var utils=require(_0x9e5a('0x6'));var logger=require('../../config/logger')(_0x9e5a('0x7'));var config=require(_0x9e5a('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24ec01,_0x13029f,_0x41f12c){return new BPromise(function(_0x4a57bb,_0x19b3d7){return client[_0x9e5a('0x9')](_0x24ec01,_0x41f12c)[_0x9e5a('0xa')](function(_0x325b5c){logger['info'](_0x9e5a('0xb'),_0x13029f,_0x9e5a('0xc'));logger[_0x9e5a('0xd')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x13029f,'request\x20sent',JSON[_0x9e5a('0xe')](_0x325b5c));if(_0x325b5c['error']){if(_0x325b5c[_0x9e5a('0xf')][_0x9e5a('0x10')]===0x1f4){logger[_0x9e5a('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x13029f,_0x325b5c[_0x9e5a('0xf')][_0x9e5a('0x11')]);return _0x19b3d7(_0x325b5c[_0x9e5a('0xf')]['message']);}logger[_0x9e5a('0xf')](_0x9e5a('0xb'),_0x13029f,_0x325b5c['error'][_0x9e5a('0x11')]);return _0x4a57bb(_0x325b5c[_0x9e5a('0xf')][_0x9e5a('0x11')]);}else{logger[_0x9e5a('0x12')](_0x9e5a('0xb'),_0x13029f,_0x9e5a('0xc'));_0x4a57bb(_0x325b5c[_0x9e5a('0x13')][_0x9e5a('0x11')]);}})[_0x9e5a('0x14')](function(_0x36536e){logger[_0x9e5a('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x13029f,_0x36536e);_0x19b3d7(_0x36536e);});});}exports['CreateChatQueueReport']=function(_0x108965){var _0x236ddf=this;return new Promise(function(_0x3e0714,_0x5c2829){return db[_0x9e5a('0x15')][_0x9e5a('0x16')](_0x108965[_0x9e5a('0x17')],{'raw':_0x108965['options']?_0x108965[_0x9e5a('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x9e5a('0xa')](function(_0xf3b052){logger['info']('CreateChatQueueReport',_0x108965);logger[_0x9e5a('0xd')](_0x9e5a('0x19'),_0x108965,JSON[_0x9e5a('0xe')](_0xf3b052));_0x3e0714(_0xf3b052);})[_0x9e5a('0x14')](function(_0x2ac1a1){logger['error']('CreateChatQueueReport',_0x2ac1a1[_0x9e5a('0x11')],_0x108965);_0x5c2829(_0x236ddf['error'](0x1f4,_0x2ac1a1[_0x9e5a('0x11')]));});});};exports[_0x9e5a('0x1a')]=function(_0x343662){var _0x5d9de8=this;return new Promise(function(_0x53c94f,_0x160373){return db[_0x9e5a('0x15')]['update'](_0x343662[_0x9e5a('0x17')],{'raw':_0x343662[_0x9e5a('0x18')]?_0x343662[_0x9e5a('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x343662[_0x9e5a('0x18')]?_0x343662[_0x9e5a('0x18')][_0x9e5a('0x1b')]||null:null,'attributes':_0x343662['options']?_0x343662[_0x9e5a('0x18')][_0x9e5a('0x1c')]||null:null,'limit':_0x343662[_0x9e5a('0x18')]?_0x343662['options']['limit']||null:null})[_0x9e5a('0xa')](function(_0x43da83){logger[_0x9e5a('0x12')](_0x9e5a('0x1a'),_0x343662);logger['debug'](_0x9e5a('0x1a'),_0x343662,JSON[_0x9e5a('0xe')](_0x43da83));_0x53c94f(_0x43da83);})[_0x9e5a('0x14')](function(_0xb5f88d){logger[_0x9e5a('0xf')](_0x9e5a('0x1a'),_0xb5f88d['message'],_0x343662);_0x160373(_0x5d9de8['error'](0x1f4,_0xb5f88d['message']));});});}; \ No newline at end of file +var _0xe211=['ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','create','options','CreateChatQueueReport','debug','stringify','UpdateChatQueueReport','ChatQueueReport','raw','where','attributes','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x4270cd,_0x48586d){var _0x1b214c=function(_0x6998db){while(--_0x6998db){_0x4270cd['push'](_0x4270cd['shift']());}};_0x1b214c(++_0x48586d);}(_0xe211,0x166));var _0x1e21=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe211[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1e21('0x0'));var BPromise=require('bluebird');var rs=require(_0x1e21('0x1'));var fs=require('fs');var Redis=require(_0x1e21('0x2'));var db=require(_0x1e21('0x3'))['db'];var utils=require(_0x1e21('0x4'));var logger=require(_0x1e21('0x5'))('rpc');var config=require(_0x1e21('0x6'));var jayson=require(_0x1e21('0x7'));var client=jayson[_0x1e21('0x8')][_0x1e21('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27fb23,_0x4ce4d3,_0xc80a2){return new BPromise(function(_0xec891d,_0x43f0e6){return client[_0x1e21('0xa')](_0x27fb23,_0xc80a2)[_0x1e21('0xb')](function(_0x45c19e){logger[_0x1e21('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x4ce4d3,_0x1e21('0xd'));logger['debug'](_0x1e21('0xe'),_0x4ce4d3,_0x1e21('0xd'),JSON['stringify'](_0x45c19e));if(_0x45c19e[_0x1e21('0xf')]){if(_0x45c19e['error'][_0x1e21('0x10')]===0x1f4){logger[_0x1e21('0xf')](_0x1e21('0x11'),_0x4ce4d3,_0x45c19e[_0x1e21('0xf')][_0x1e21('0x12')]);return _0x43f0e6(_0x45c19e[_0x1e21('0xf')][_0x1e21('0x12')]);}logger[_0x1e21('0xf')](_0x1e21('0x11'),_0x4ce4d3,_0x45c19e[_0x1e21('0xf')]['message']);return _0xec891d(_0x45c19e[_0x1e21('0xf')]['message']);}else{logger[_0x1e21('0xc')](_0x1e21('0x11'),_0x4ce4d3,_0x1e21('0xd'));_0xec891d(_0x45c19e[_0x1e21('0x13')]['message']);}})[_0x1e21('0x14')](function(_0x43be57){logger[_0x1e21('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x4ce4d3,_0x43be57);_0x43f0e6(_0x43be57);});});}exports['CreateChatQueueReport']=function(_0x542851){var _0x28dc2e=this;return new Promise(function(_0x100522,_0x547eaf){return db['ChatQueueReport'][_0x1e21('0x15')](_0x542851['body'],{'raw':_0x542851['options']?_0x542851[_0x1e21('0x16')]['raw']===undefined?!![]:![]:!![]})[_0x1e21('0xb')](function(_0xf07ea5){logger[_0x1e21('0xc')](_0x1e21('0x17'),_0x542851);logger[_0x1e21('0x18')](_0x1e21('0x17'),_0x542851,JSON[_0x1e21('0x19')](_0xf07ea5));_0x100522(_0xf07ea5);})['catch'](function(_0x1c5701){logger[_0x1e21('0xf')]('CreateChatQueueReport',_0x1c5701[_0x1e21('0x12')],_0x542851);_0x547eaf(_0x28dc2e[_0x1e21('0xf')](0x1f4,_0x1c5701[_0x1e21('0x12')]));});});};exports[_0x1e21('0x1a')]=function(_0x4817e0){var _0x4c477a=this;return new Promise(function(_0x1c89cd,_0x208f79){return db[_0x1e21('0x1b')]['update'](_0x4817e0['body'],{'raw':_0x4817e0[_0x1e21('0x16')]?_0x4817e0[_0x1e21('0x16')][_0x1e21('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4817e0[_0x1e21('0x16')]?_0x4817e0[_0x1e21('0x16')][_0x1e21('0x1d')]||null:null,'attributes':_0x4817e0[_0x1e21('0x16')]?_0x4817e0[_0x1e21('0x16')][_0x1e21('0x1e')]||null:null,'limit':_0x4817e0[_0x1e21('0x16')]?_0x4817e0[_0x1e21('0x16')]['limit']||null:null})[_0x1e21('0xb')](function(_0x277deb){logger[_0x1e21('0xc')](_0x1e21('0x1a'),_0x4817e0);logger[_0x1e21('0x18')](_0x1e21('0x1a'),_0x4817e0,JSON[_0x1e21('0x19')](_0x277deb));_0x1c89cd(_0x277deb);})[_0x1e21('0x14')](function(_0x9327f3){logger['error'](_0x1e21('0x1a'),_0x9327f3[_0x1e21('0x12')],_0x4817e0);_0x208f79(_0x4c477a['error'](0x1f4,_0x9327f3[_0x1e21('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 988fb72..5df68a2 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 _0xd0fc=['create','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0xd0fc,0x1a7));var _0xcd0f=function(_0x287f7d,_0x413df4){_0x287f7d=_0x287f7d-0x0;var _0x2eb773=_0xd0fc[_0x287f7d];return _0x2eb773;};'use strict';var multer=require(_0xcd0f('0x0'));var util=require(_0xcd0f('0x1'));var path=require(_0xcd0f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcd0f('0x3'));var router=express[_0xcd0f('0x4')]();var fs_extra=require(_0xcd0f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcd0f('0x6'));var config=require(_0xcd0f('0x7'));var controller=require(_0xcd0f('0x8'));router[_0xcd0f('0x9')]('/',auth['isAuthenticated'](),controller[_0xcd0f('0xa')]);router['get'](_0xcd0f('0xb'),auth[_0xcd0f('0xc')](),controller[_0xcd0f('0xd')]);router[_0xcd0f('0x9')](_0xcd0f('0xe'),auth[_0xcd0f('0xc')](),controller[_0xcd0f('0xf')]);router[_0xcd0f('0x10')]('/',auth[_0xcd0f('0xc')](),controller[_0xcd0f('0x11')]);router['put'](_0xcd0f('0xe'),auth[_0xcd0f('0xc')](),controller['update']);router['delete'](_0xcd0f('0xe'),auth[_0xcd0f('0xc')](),controller[_0xcd0f('0x12')]);module[_0xcd0f('0x13')]=router; \ No newline at end of file +var _0x6d1e=['../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','show','post','put','update','/:id','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1df22a,_0x1f64dc){var _0x42d9a3=function(_0x510014){while(--_0x510014){_0x1df22a['push'](_0x1df22a['shift']());}};_0x42d9a3(++_0x1f64dc);}(_0x6d1e,0xb4));var _0xe6d1=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x6d1e[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xe6d1('0x0'));var util=require(_0xe6d1('0x1'));var path=require('path');var timeout=require(_0xe6d1('0x2'));var express=require(_0xe6d1('0x3'));var router=express[_0xe6d1('0x4')]();var fs_extra=require(_0xe6d1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe6d1('0x6'));var config=require(_0xe6d1('0x7'));var controller=require(_0xe6d1('0x8'));router[_0xe6d1('0x9')]('/',auth[_0xe6d1('0xa')](),controller['index']);router[_0xe6d1('0x9')](_0xe6d1('0xb'),auth[_0xe6d1('0xa')](),controller['describe']);router[_0xe6d1('0x9')]('/:id',auth[_0xe6d1('0xa')](),controller[_0xe6d1('0xc')]);router[_0xe6d1('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe6d1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe6d1('0xf')]);router['delete'](_0xe6d1('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 55398d1..4bec586 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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x3e5e03,_0x2fac27){var _0x45279e=function(_0xb0f1c8){while(--_0xb0f1c8){_0x3e5e03['push'](_0x3e5e03['shift']());}};_0x45279e(++_0x2fac27);}(_0x54ef,0x112));var _0xf54e=function(_0x4ba848,_0x1adb39){_0x4ba848=_0x4ba848-0x0;var _0x48f292=_0x54ef[_0x4ba848];return _0x48f292;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file +var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5a076e,_0x5e2f19){var _0x59bdf7=function(_0x414fdd){while(--_0x414fdd){_0x5a076e['push'](_0x5a076e['shift']());}};_0x59bdf7(++_0x5e2f19);}(_0xf4eb,0xec));var _0xbf4e=function(_0x593530,_0xd4b2ce){_0x593530=_0x593530-0x0;var _0x1cb9dd=_0xf4eb[_0x593530];return _0x1cb9dd;};'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/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 7d56324..0a331f3 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 _0x36df=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','options','ChatTransferReport','includeAll','include','findAll','rows','show','params','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x5dcc2e,_0x4c34fe){var _0x1aa7b7=function(_0x46f75d){while(--_0x46f75d){_0x5dcc2e['push'](_0x5dcc2e['shift']());}};_0x1aa7b7(++_0x4c34fe);}(_0x36df,0xd7));var _0xf36d=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x36df[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0xf36d('0x0'));var rimraf=require(_0xf36d('0x1'));var zipdir=require(_0xf36d('0x2'));var jsonpatch=require(_0xf36d('0x3'));var rp=require(_0xf36d('0x4'));var moment=require(_0xf36d('0x5'));var BPromise=require(_0xf36d('0x6'));var Mustache=require(_0xf36d('0x7'));var util=require('util');var path=require(_0xf36d('0x8'));var sox=require('sox');var csv=require(_0xf36d('0x9'));var ejs=require(_0xf36d('0xa'));var fs=require('fs');var fs_extra=require(_0xf36d('0xb'));var _=require(_0xf36d('0xc'));var squel=require('squel');var crypto=require(_0xf36d('0xd'));var jsforce=require(_0xf36d('0xe'));var deskjs=require(_0xf36d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf36d('0x10'));var Redis=require('ioredis');var authService=require(_0xf36d('0x11'));var qs=require(_0xf36d('0x12'));var as=require(_0xf36d('0x13'));var hardwareService=require(_0xf36d('0x14'));var logger=require(_0xf36d('0x15'))(_0xf36d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf36d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a2998,_0x4f4116){_0x4f4116=_0x4f4116||0xcc;return function(_0x2b368a){if(_0x2b368a){return _0x2a2998[_0xf36d('0x18')](_0x4f4116);}return _0x2a2998[_0xf36d('0x19')](_0x4f4116)[_0xf36d('0x1a')]();};}function respondWithResult(_0x191fcc,_0x1a8068){_0x1a8068=_0x1a8068||0xc8;return function(_0x175544){if(_0x175544){return _0x191fcc[_0xf36d('0x19')](_0x1a8068)[_0xf36d('0x1b')](_0x175544);}};}function respondWithFilteredResult(_0x55b326,_0x18bc19){return function(_0x4e433b){if(_0x4e433b){var _0x3c4f38=typeof _0x18bc19[_0xf36d('0x1c')]===_0xf36d('0x1d')&&typeof _0x18bc19['limit']===_0xf36d('0x1d');var _0x568e77=_0x4e433b[_0xf36d('0x1e')];var _0x8a9e10=_0x3c4f38?0x0:_0x18bc19[_0xf36d('0x1c')];var _0x55b6c2=_0x3c4f38?_0x4e433b[_0xf36d('0x1e')]:_0x18bc19[_0xf36d('0x1c')]+_0x18bc19[_0xf36d('0x1f')];var _0x2f47a0;if(_0x55b6c2>=_0x568e77){_0x55b6c2=_0x568e77;_0x2f47a0=0xc8;}else{_0x2f47a0=0xce;}_0x55b326[_0xf36d('0x19')](_0x2f47a0);return _0x55b326[_0xf36d('0x20')](_0xf36d('0x21'),_0x8a9e10+'-'+_0x55b6c2+'/'+_0x568e77)['json'](_0x4e433b);}return null;};}function patchUpdates(_0x14d666){return function(_0x4c0271){try{jsonpatch[_0xf36d('0x22')](_0x4c0271,_0x14d666,!![]);}catch(_0x5613b1){return BPromise[_0xf36d('0x23')](_0x5613b1);}return _0x4c0271[_0xf36d('0x24')]();};}function saveUpdates(_0x19b886,_0x454388){return function(_0x4373c4){if(_0x4373c4){return _0x4373c4[_0xf36d('0x25')](_0x19b886)[_0xf36d('0x26')](function(_0x5f4fff){return _0x5f4fff;});}return null;};}function removeEntity(_0x34410d,_0x4d9db2){return function(_0x56eaee){if(_0x56eaee){return _0x56eaee[_0xf36d('0x27')]()[_0xf36d('0x26')](function(){_0x34410d[_0xf36d('0x19')](0xcc)[_0xf36d('0x1a')]();});}};}function handleEntityNotFound(_0x4b632f,_0x50ce0d){return function(_0xa07e40){if(!_0xa07e40){_0x4b632f[_0xf36d('0x18')](0x194);}return _0xa07e40;};}function handleError(_0x2f680f,_0x338bb9){_0x338bb9=_0x338bb9||0x1f4;return function(_0x45fc92){logger['error'](_0x45fc92[_0xf36d('0x28')]);if(_0x45fc92[_0xf36d('0x29')]){delete _0x45fc92[_0xf36d('0x29')];}_0x2f680f['status'](_0x338bb9)[_0xf36d('0x2a')](_0x45fc92);};}exports['index']=function(_0x34a0c0,_0x53d6b0){var _0x57509f={},_0x16c6db={},_0x3418e0={'count':0x0,'rows':[]};var _0x437a4f=_['map'](db['ChatTransferReport'][_0xf36d('0x2b')],function(_0xfc6612){return{'name':_0xfc6612[_0xf36d('0x2c')],'type':_0xfc6612[_0xf36d('0x2d')][_0xf36d('0x2e')]};});_0x16c6db['model']=_[_0xf36d('0x2f')](_0x437a4f,_0xf36d('0x29'));_0x16c6db[_0xf36d('0x30')]=_[_0xf36d('0x31')](_0x34a0c0[_0xf36d('0x30')]);_0x16c6db['filters']=_[_0xf36d('0x32')](_0x16c6db[_0xf36d('0x33')],_0x16c6db[_0xf36d('0x30')]);_0x57509f['attributes']=_[_0xf36d('0x32')](_0x16c6db['model'],qs['fields'](_0x34a0c0[_0xf36d('0x30')][_0xf36d('0x34')]));_0x57509f[_0xf36d('0x35')]=_0x57509f['attributes'][_0xf36d('0x36')]?_0x57509f[_0xf36d('0x35')]:_0x16c6db[_0xf36d('0x33')];if(!_0x34a0c0[_0xf36d('0x30')][_0xf36d('0x37')](_0xf36d('0x38'))){_0x57509f[_0xf36d('0x1f')]=qs[_0xf36d('0x1f')](_0x34a0c0['query']['limit']);_0x57509f[_0xf36d('0x1c')]=qs['offset'](_0x34a0c0['query'][_0xf36d('0x1c')]);}_0x57509f[_0xf36d('0x39')]=qs[_0xf36d('0x3a')](_0x34a0c0['query'][_0xf36d('0x3a')]);_0x57509f[_0xf36d('0x3b')]=qs[_0xf36d('0x3c')](_[_0xf36d('0x3d')](_0x34a0c0[_0xf36d('0x30')],_0x16c6db['filters']),_0x437a4f);if(_0x34a0c0['query']['filter']){_0x57509f[_0xf36d('0x3b')]=_['merge'](_0x57509f[_0xf36d('0x3b')],{'$or':_[_0xf36d('0x2f')](_0x437a4f,function(_0x5bd268){if(_0x5bd268[_0xf36d('0x2d')]!==_0xf36d('0x3e')){var _0x1601c0={};_0x1601c0[_0x5bd268[_0xf36d('0x29')]]={'$like':'%'+_0x34a0c0[_0xf36d('0x30')]['filter']+'%'};return _0x1601c0;}})});}_0x57509f=_[_0xf36d('0x3f')]({},_0x57509f,_0x34a0c0[_0xf36d('0x40')]);var _0x51b380={'where':_0x57509f['where']};return db[_0xf36d('0x41')][_0xf36d('0x1e')](_0x51b380)['then'](function(_0x334bac){_0x3418e0['count']=_0x334bac;if(_0x34a0c0[_0xf36d('0x30')][_0xf36d('0x42')]){_0x57509f[_0xf36d('0x43')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xf36d('0x44')](_0x57509f);})[_0xf36d('0x26')](function(_0x52f21a){_0x3418e0[_0xf36d('0x45')]=_0x52f21a;return _0x3418e0;})[_0xf36d('0x26')](respondWithFilteredResult(_0x53d6b0,_0x57509f))['catch'](handleError(_0x53d6b0,null));};exports[_0xf36d('0x46')]=function(_0x142a73,_0x32d06f){var _0x220a9c={'raw':!![],'where':{'id':_0x142a73[_0xf36d('0x47')]['id']}},_0x5cd1da={};_0x5cd1da[_0xf36d('0x33')]=_[_0xf36d('0x31')](db[_0xf36d('0x41')][_0xf36d('0x2b')]);_0x5cd1da[_0xf36d('0x30')]=_[_0xf36d('0x31')](_0x142a73[_0xf36d('0x30')]);_0x5cd1da[_0xf36d('0x3c')]=_[_0xf36d('0x32')](_0x5cd1da['model'],_0x5cd1da[_0xf36d('0x30')]);_0x220a9c[_0xf36d('0x35')]=_[_0xf36d('0x32')](_0x5cd1da[_0xf36d('0x33')],qs[_0xf36d('0x34')](_0x142a73[_0xf36d('0x30')][_0xf36d('0x34')]));_0x220a9c[_0xf36d('0x35')]=_0x220a9c[_0xf36d('0x35')][_0xf36d('0x36')]?_0x220a9c['attributes']:_0x5cd1da[_0xf36d('0x33')];if(_0x142a73[_0xf36d('0x30')][_0xf36d('0x42')]){_0x220a9c['include']=[{'all':!![]}];}_0x220a9c=_[_0xf36d('0x3f')]({},_0x220a9c,_0x142a73[_0xf36d('0x40')]);return db[_0xf36d('0x41')][_0xf36d('0x48')](_0x220a9c)['then'](handleEntityNotFound(_0x32d06f,null))[_0xf36d('0x26')](respondWithResult(_0x32d06f,null))['catch'](handleError(_0x32d06f,null));};exports[_0xf36d('0x49')]=function(_0x1e2907,_0x2c3e0c){return db[_0xf36d('0x41')]['create'](_0x1e2907[_0xf36d('0x4a')],{})[_0xf36d('0x26')](respondWithResult(_0x2c3e0c,0xc9))[_0xf36d('0x4b')](handleError(_0x2c3e0c,null));};exports[_0xf36d('0x25')]=function(_0x21fc7e,_0xefdf3c){if(_0x21fc7e[_0xf36d('0x4a')]['id']){delete _0x21fc7e['body']['id'];}return db[_0xf36d('0x41')][_0xf36d('0x48')]({'where':{'id':_0x21fc7e[_0xf36d('0x47')]['id']}})[_0xf36d('0x26')](handleEntityNotFound(_0xefdf3c,null))['then'](saveUpdates(_0x21fc7e[_0xf36d('0x4a')],null))['then'](respondWithResult(_0xefdf3c,null))[_0xf36d('0x4b')](handleError(_0xefdf3c,null));};exports[_0xf36d('0x27')]=function(_0x530867,_0x20bff7){return db[_0xf36d('0x41')]['find']({'where':{'id':_0x530867[_0xf36d('0x47')]['id']}})['then'](handleEntityNotFound(_0x20bff7,null))[_0xf36d('0x26')](removeEntity(_0x20bff7,null))[_0xf36d('0x4b')](handleError(_0x20bff7,null));};exports['describe']=function(_0x565385,_0x328b9b){return db[_0xf36d('0x41')][_0xf36d('0x4c')]()['then'](respondWithResult(_0x328b9b,null))[_0xf36d('0x4b')](handleError(_0x328b9b,null));}; \ No newline at end of file +var _0x7acd=['index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','ChatTransferReport','count','includeAll','findAll','rows','catch','show','params','find','create','body','describe','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','reject','save','update','then','destroy','error','name','send'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x7acd,0x17d));var _0xd7ac=function(_0x599f3b,_0x25c112){_0x599f3b=_0x599f3b-0x0;var _0x8001eb=_0x7acd[_0x599f3b];return _0x8001eb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd7ac('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7ac('0x1'));var moment=require(_0xd7ac('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xd7ac('0x3'));var util=require(_0xd7ac('0x4'));var path=require(_0xd7ac('0x5'));var sox=require(_0xd7ac('0x6'));var csv=require(_0xd7ac('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd7ac('0x8'));var crypto=require(_0xd7ac('0x9'));var jsforce=require(_0xd7ac('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xd7ac('0x7'));var querystring=require(_0xd7ac('0xb'));var Papa=require('papaparse');var Redis=require(_0xd7ac('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xd7ac('0xd'));var as=require(_0xd7ac('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd7ac('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd7ac('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1984e3,_0x5f846d){_0x5f846d=_0x5f846d||0xcc;return function(_0x3f255d){if(_0x3f255d){return _0x1984e3[_0xd7ac('0x11')](_0x5f846d);}return _0x1984e3[_0xd7ac('0x12')](_0x5f846d)[_0xd7ac('0x13')]();};}function respondWithResult(_0xce915a,_0x386982){_0x386982=_0x386982||0xc8;return function(_0x67b6d8){if(_0x67b6d8){return _0xce915a[_0xd7ac('0x12')](_0x386982)[_0xd7ac('0x14')](_0x67b6d8);}};}function respondWithFilteredResult(_0x18ae08,_0xd2b1c3){return function(_0x163f71){if(_0x163f71){var _0x34de37=typeof _0xd2b1c3[_0xd7ac('0x15')]===_0xd7ac('0x16')&&typeof _0xd2b1c3['limit']===_0xd7ac('0x16');var _0x45f7ea=_0x163f71['count'];var _0x2ea5a3=_0x34de37?0x0:_0xd2b1c3[_0xd7ac('0x15')];var _0x1db0a9=_0x34de37?_0x163f71['count']:_0xd2b1c3[_0xd7ac('0x15')]+_0xd2b1c3[_0xd7ac('0x17')];var _0x40a01e;if(_0x1db0a9>=_0x45f7ea){_0x1db0a9=_0x45f7ea;_0x40a01e=0xc8;}else{_0x40a01e=0xce;}_0x18ae08['status'](_0x40a01e);return _0x18ae08[_0xd7ac('0x18')]('Content-Range',_0x2ea5a3+'-'+_0x1db0a9+'/'+_0x45f7ea)[_0xd7ac('0x14')](_0x163f71);}return null;};}function patchUpdates(_0xe283fb){return function(_0x290359){try{jsonpatch['apply'](_0x290359,_0xe283fb,!![]);}catch(_0x4c8d48){return BPromise[_0xd7ac('0x19')](_0x4c8d48);}return _0x290359[_0xd7ac('0x1a')]();};}function saveUpdates(_0x513fec,_0xd59502){return function(_0x36b5df){if(_0x36b5df){return _0x36b5df[_0xd7ac('0x1b')](_0x513fec)[_0xd7ac('0x1c')](function(_0x5076d8){return _0x5076d8;});}return null;};}function removeEntity(_0x1aa726,_0x228368){return function(_0x527bc8){if(_0x527bc8){return _0x527bc8[_0xd7ac('0x1d')]()['then'](function(){_0x1aa726['status'](0xcc)[_0xd7ac('0x13')]();});}};}function handleEntityNotFound(_0x2e054f,_0x4d8ac7){return function(_0x236d1e){if(!_0x236d1e){_0x2e054f[_0xd7ac('0x11')](0x194);}return _0x236d1e;};}function handleError(_0x1ad171,_0x655685){_0x655685=_0x655685||0x1f4;return function(_0xb698fd){logger[_0xd7ac('0x1e')](_0xb698fd['stack']);if(_0xb698fd[_0xd7ac('0x1f')]){delete _0xb698fd[_0xd7ac('0x1f')];}_0x1ad171[_0xd7ac('0x12')](_0x655685)[_0xd7ac('0x20')](_0xb698fd);};}exports[_0xd7ac('0x21')]=function(_0x1ef5d6,_0x1e8e33){var _0x1d899a={},_0xdf95c9={},_0x2399a5={'count':0x0,'rows':[]};var _0x1e289a=_['map'](db['ChatTransferReport'][_0xd7ac('0x22')],function(_0x30e326){return{'name':_0x30e326[_0xd7ac('0x23')],'type':_0x30e326[_0xd7ac('0x24')][_0xd7ac('0x25')]};});_0xdf95c9[_0xd7ac('0x26')]=_[_0xd7ac('0x27')](_0x1e289a,'name');_0xdf95c9[_0xd7ac('0x28')]=_[_0xd7ac('0x29')](_0x1ef5d6['query']);_0xdf95c9['filters']=_[_0xd7ac('0x2a')](_0xdf95c9[_0xd7ac('0x26')],_0xdf95c9['query']);_0x1d899a[_0xd7ac('0x2b')]=_[_0xd7ac('0x2a')](_0xdf95c9[_0xd7ac('0x26')],qs['fields'](_0x1ef5d6[_0xd7ac('0x28')][_0xd7ac('0x2c')]));_0x1d899a['attributes']=_0x1d899a['attributes'][_0xd7ac('0x2d')]?_0x1d899a[_0xd7ac('0x2b')]:_0xdf95c9[_0xd7ac('0x26')];if(!_0x1ef5d6[_0xd7ac('0x28')][_0xd7ac('0x2e')](_0xd7ac('0x2f'))){_0x1d899a[_0xd7ac('0x17')]=qs[_0xd7ac('0x17')](_0x1ef5d6[_0xd7ac('0x28')]['limit']);_0x1d899a['offset']=qs[_0xd7ac('0x15')](_0x1ef5d6[_0xd7ac('0x28')][_0xd7ac('0x15')]);}_0x1d899a[_0xd7ac('0x30')]=qs[_0xd7ac('0x31')](_0x1ef5d6[_0xd7ac('0x28')]['sort']);_0x1d899a[_0xd7ac('0x32')]=qs[_0xd7ac('0x33')](_[_0xd7ac('0x34')](_0x1ef5d6[_0xd7ac('0x28')],_0xdf95c9[_0xd7ac('0x33')]),_0x1e289a);if(_0x1ef5d6['query']['filter']){_0x1d899a[_0xd7ac('0x32')]=_[_0xd7ac('0x35')](_0x1d899a['where'],{'$or':_[_0xd7ac('0x27')](_0x1e289a,function(_0x4692a1){if(_0x4692a1[_0xd7ac('0x24')]!==_0xd7ac('0x36')){var _0x342298={};_0x342298[_0x4692a1[_0xd7ac('0x1f')]]={'$like':'%'+_0x1ef5d6['query'][_0xd7ac('0x37')]+'%'};return _0x342298;}})});}_0x1d899a=_[_0xd7ac('0x35')]({},_0x1d899a,_0x1ef5d6[_0xd7ac('0x38')]);var _0x55e14a={'where':_0x1d899a[_0xd7ac('0x32')]};return db[_0xd7ac('0x39')][_0xd7ac('0x3a')](_0x55e14a)['then'](function(_0x18a7b9){_0x2399a5[_0xd7ac('0x3a')]=_0x18a7b9;if(_0x1ef5d6[_0xd7ac('0x28')][_0xd7ac('0x3b')]){_0x1d899a['include']=[{'all':!![]}];}return db[_0xd7ac('0x39')][_0xd7ac('0x3c')](_0x1d899a);})[_0xd7ac('0x1c')](function(_0x21cff3){_0x2399a5[_0xd7ac('0x3d')]=_0x21cff3;return _0x2399a5;})[_0xd7ac('0x1c')](respondWithFilteredResult(_0x1e8e33,_0x1d899a))[_0xd7ac('0x3e')](handleError(_0x1e8e33,null));};exports[_0xd7ac('0x3f')]=function(_0x2672df,_0x21fe4a){var _0x46ed67={'raw':!![],'where':{'id':_0x2672df[_0xd7ac('0x40')]['id']}},_0x53bd82={};_0x53bd82[_0xd7ac('0x26')]=_[_0xd7ac('0x29')](db['ChatTransferReport'][_0xd7ac('0x22')]);_0x53bd82[_0xd7ac('0x28')]=_['keys'](_0x2672df['query']);_0x53bd82[_0xd7ac('0x33')]=_[_0xd7ac('0x2a')](_0x53bd82[_0xd7ac('0x26')],_0x53bd82['query']);_0x46ed67[_0xd7ac('0x2b')]=_[_0xd7ac('0x2a')](_0x53bd82[_0xd7ac('0x26')],qs[_0xd7ac('0x2c')](_0x2672df[_0xd7ac('0x28')][_0xd7ac('0x2c')]));_0x46ed67['attributes']=_0x46ed67[_0xd7ac('0x2b')]['length']?_0x46ed67[_0xd7ac('0x2b')]:_0x53bd82[_0xd7ac('0x26')];if(_0x2672df[_0xd7ac('0x28')]['includeAll']){_0x46ed67['include']=[{'all':!![]}];}_0x46ed67=_['merge']({},_0x46ed67,_0x2672df[_0xd7ac('0x38')]);return db[_0xd7ac('0x39')][_0xd7ac('0x41')](_0x46ed67)['then'](handleEntityNotFound(_0x21fe4a,null))['then'](respondWithResult(_0x21fe4a,null))['catch'](handleError(_0x21fe4a,null));};exports[_0xd7ac('0x42')]=function(_0x583a44,_0x15ca36){return db['ChatTransferReport'][_0xd7ac('0x42')](_0x583a44['body'],{})[_0xd7ac('0x1c')](respondWithResult(_0x15ca36,0xc9))[_0xd7ac('0x3e')](handleError(_0x15ca36,null));};exports[_0xd7ac('0x1b')]=function(_0x132a08,_0x2ae24a){if(_0x132a08[_0xd7ac('0x43')]['id']){delete _0x132a08[_0xd7ac('0x43')]['id'];}return db[_0xd7ac('0x39')]['find']({'where':{'id':_0x132a08['params']['id']}})[_0xd7ac('0x1c')](handleEntityNotFound(_0x2ae24a,null))[_0xd7ac('0x1c')](saveUpdates(_0x132a08[_0xd7ac('0x43')],null))[_0xd7ac('0x1c')](respondWithResult(_0x2ae24a,null))[_0xd7ac('0x3e')](handleError(_0x2ae24a,null));};exports[_0xd7ac('0x1d')]=function(_0x5f56a7,_0x2034ee){return db[_0xd7ac('0x39')][_0xd7ac('0x41')]({'where':{'id':_0x5f56a7['params']['id']}})[_0xd7ac('0x1c')](handleEntityNotFound(_0x2034ee,null))[_0xd7ac('0x1c')](removeEntity(_0x2034ee,null))[_0xd7ac('0x3e')](handleError(_0x2034ee,null));};exports[_0xd7ac('0x44')]=function(_0x39ebe0,_0x4fcd0d){return db[_0xd7ac('0x39')][_0xd7ac('0x44')]()['then'](respondWithResult(_0x4fcd0d,null))[_0xd7ac('0x3e')](handleError(_0x4fcd0d,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 29d0a38..5fb6cb3 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 _0x9a5b=['report_chat_transfer','uniqueid','lodash','util','api','bluebird','request-promise','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0x9a5b,0xff));var _0xb9a5=function(_0x4ac34e,_0x2cbe6b){_0x4ac34e=_0x4ac34e-0x0;var _0x2da383=_0x9a5b[_0x4ac34e];return _0x2da383;};'use strict';var _=require(_0xb9a5('0x0'));var util=require(_0xb9a5('0x1'));var logger=require('../../config/logger')(_0xb9a5('0x2'));var moment=require('moment');var BPromise=require(_0xb9a5('0x3'));var rp=require(_0xb9a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb9a5('0x5'));module[_0xb9a5('0x6')]=function(_0x13cbf4,_0x5691f9){return _0x13cbf4[_0xb9a5('0x7')](_0xb9a5('0x8'),attributes,{'tableName':_0xb9a5('0x9'),'paranoid':![],'indexes':[{'name':_0xb9a5('0xa'),'fields':[_0xb9a5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1c9d=['api','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util'];(function(_0x286e5f,_0x2980e4){var _0x470423=function(_0x592ea2){while(--_0x592ea2){_0x286e5f['push'](_0x286e5f['shift']());}};_0x470423(++_0x2980e4);}(_0x1c9d,0x113));var _0xd1c9=function(_0x47f3d9,_0x102eaa){_0x47f3d9=_0x47f3d9-0x0;var _0x6dc337=_0x1c9d[_0x47f3d9];return _0x6dc337;};'use strict';var _=require('lodash');var util=require(_0xd1c9('0x0'));var logger=require('../../config/logger')(_0xd1c9('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd1c9('0x2'));var fs=require('fs');var path=require(_0xd1c9('0x3'));var rimraf=require(_0xd1c9('0x4'));var config=require(_0xd1c9('0x5'));var attributes=require(_0xd1c9('0x6'));module[_0xd1c9('0x7')]=function(_0x30de9c,_0x1838f5){return _0x30de9c[_0xd1c9('0x8')](_0xd1c9('0x9'),attributes,{'tableName':_0xd1c9('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd1c9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 75e7cca..d5ec95f 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 _0xa594=['../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','ChatTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x34b564,_0x560b6c){var _0xb48828=function(_0x4c15d9){while(--_0x4c15d9){_0x34b564['push'](_0x34b564['shift']());}};_0xb48828(++_0x560b6c);}(_0xa594,0x1f0));var _0x4a59=function(_0x560448,_0x2c1082){_0x560448=_0x560448-0x0;var _0x550276=_0xa594[_0x560448];return _0x550276;};'use strict';var _=require(_0x4a59('0x0'));var util=require(_0x4a59('0x1'));var moment=require(_0x4a59('0x2'));var BPromise=require(_0x4a59('0x3'));var rs=require(_0x4a59('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a59('0x5'))['db'];var utils=require(_0x4a59('0x6'));var logger=require('../../config/logger')(_0x4a59('0x7'));var config=require(_0x4a59('0x8'));var jayson=require(_0x4a59('0x9'));var client=jayson[_0x4a59('0xa')][_0x4a59('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x493e35,_0x462ce1,_0x537062){return new BPromise(function(_0x3488ab,_0x34f077){return client[_0x4a59('0xc')](_0x493e35,_0x537062)[_0x4a59('0xd')](function(_0x45f6b9){logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x462ce1,_0x4a59('0xe'));logger[_0x4a59('0xf')](_0x4a59('0x10'),_0x462ce1,'request\x20sent',JSON[_0x4a59('0x11')](_0x45f6b9));if(_0x45f6b9[_0x4a59('0x12')]){if(_0x45f6b9[_0x4a59('0x12')]['code']===0x1f4){logger[_0x4a59('0x12')](_0x4a59('0x13'),_0x462ce1,_0x45f6b9[_0x4a59('0x12')][_0x4a59('0x14')]);return _0x34f077(_0x45f6b9[_0x4a59('0x12')]['message']);}logger[_0x4a59('0x12')](_0x4a59('0x13'),_0x462ce1,_0x45f6b9[_0x4a59('0x12')][_0x4a59('0x14')]);return _0x3488ab(_0x45f6b9[_0x4a59('0x12')][_0x4a59('0x14')]);}else{logger[_0x4a59('0x15')]('ChatTransferReport,\x20%s,\x20%s',_0x462ce1,'request\x20sent');_0x3488ab(_0x45f6b9[_0x4a59('0x16')]['message']);}})[_0x4a59('0x17')](function(_0x34ef54){logger[_0x4a59('0x12')](_0x4a59('0x13'),_0x462ce1,_0x34ef54);_0x34f077(_0x34ef54);});});} \ No newline at end of file +var _0x597f=['info','catch','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3fdbc3,_0x3290e6){var _0x4091dc=function(_0x2034ba){while(--_0x2034ba){_0x3fdbc3['push'](_0x3fdbc3['shift']());}};_0x4091dc(++_0x3290e6);}(_0x597f,0x66));var _0xf597=function(_0xcd3806,_0x3182ad){_0xcd3806=_0xcd3806-0x0;var _0x5e3594=_0x597f[_0xcd3806];return _0x5e3594;};'use strict';var _=require('lodash');var util=require(_0xf597('0x0'));var moment=require(_0xf597('0x1'));var BPromise=require(_0xf597('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf597('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf597('0x4'))(_0xf597('0x5'));var config=require(_0xf597('0x6'));var jayson=require(_0xf597('0x7'));var client=jayson[_0xf597('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a198,_0x39555f,_0x134129){return new BPromise(function(_0x2f4af2,_0x431142){return client['request'](_0x44a198,_0x134129)[_0xf597('0x9')](function(_0x18381d){logger['info'](_0xf597('0xa'),_0x39555f,_0xf597('0xb'));logger[_0xf597('0xc')](_0xf597('0xd'),_0x39555f,_0xf597('0xb'),JSON[_0xf597('0xe')](_0x18381d));if(_0x18381d[_0xf597('0xf')]){if(_0x18381d['error'][_0xf597('0x10')]===0x1f4){logger[_0xf597('0xf')](_0xf597('0xa'),_0x39555f,_0x18381d[_0xf597('0xf')][_0xf597('0x11')]);return _0x431142(_0x18381d['error']['message']);}logger[_0xf597('0xf')](_0xf597('0xa'),_0x39555f,_0x18381d[_0xf597('0xf')][_0xf597('0x11')]);return _0x2f4af2(_0x18381d[_0xf597('0xf')][_0xf597('0x11')]);}else{logger[_0xf597('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x39555f,_0xf597('0xb'));_0x2f4af2(_0x18381d['result']['message']);}})[_0xf597('0x13')](function(_0x4fc6d7){logger[_0xf597('0xf')](_0xf597('0xa'),_0x39555f,_0x4fc6d7);_0x431142(_0x4fc6d7);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 0310219..3034358 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 _0x6b93=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','describe','post'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x6b93,0x1cf));var _0x36b9=function(_0x4abbba,_0x4e355c){_0x4abbba=_0x4abbba-0x0;var _0x5f1bfb=_0x6b93[_0x4abbba];return _0x5f1bfb;};'use strict';var multer=require(_0x36b9('0x0'));var util=require(_0x36b9('0x1'));var path=require(_0x36b9('0x2'));var timeout=require(_0x36b9('0x3'));var express=require(_0x36b9('0x4'));var router=express[_0x36b9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x36b9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x36b9('0x7'));var controller=require(_0x36b9('0x8'));router['get']('/',auth[_0x36b9('0x9')](),controller['index']);router['get']('/describe',auth[_0x36b9('0x9')](),controller[_0x36b9('0xa')]);router['get']('/:id',auth[_0x36b9('0x9')](),controller['show']);router[_0x36b9('0xb')]('/',auth[_0x36b9('0x9')](),controller[_0x36b9('0xc')]);router[_0x36b9('0xd')](_0x36b9('0xe'),auth[_0x36b9('0x9')](),controller[_0x36b9('0xf')]);router[_0x36b9('0x10')](_0x36b9('0xe'),auth['isAuthenticated'](),controller[_0x36b9('0x11')]);module[_0x36b9('0x12')]=router; \ No newline at end of file +var _0x7aec=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','delete','/:id','destroy','exports','multer','util'];(function(_0x547c3f,_0x1be8fa){var _0x370c76=function(_0x36b6dc){while(--_0x36b6dc){_0x547c3f['push'](_0x547c3f['shift']());}};_0x370c76(++_0x1be8fa);}(_0x7aec,0x106));var _0xc7ae=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x7aec[_0x4fbfd9];return _0x31dc94;};'use strict';var multer=require(_0xc7ae('0x0'));var util=require(_0xc7ae('0x1'));var path=require('path');var timeout=require(_0xc7ae('0x2'));var express=require(_0xc7ae('0x3'));var router=express[_0xc7ae('0x4')]();var fs_extra=require(_0xc7ae('0x5'));var auth=require(_0xc7ae('0x6'));var interaction=require(_0xc7ae('0x7'));var config=require(_0xc7ae('0x8'));var controller=require(_0xc7ae('0x9'));router[_0xc7ae('0xa')]('/',auth[_0xc7ae('0xb')](),controller[_0xc7ae('0xc')]);router['get'](_0xc7ae('0xd'),auth['isAuthenticated'](),controller[_0xc7ae('0xe')]);router[_0xc7ae('0xa')]('/:id',auth[_0xc7ae('0xb')](),controller[_0xc7ae('0xf')]);router[_0xc7ae('0x10')]('/',auth[_0xc7ae('0xb')](),controller[_0xc7ae('0x11')]);router[_0xc7ae('0x12')]('/:id',auth[_0xc7ae('0xb')](),controller[_0xc7ae('0x13')]);router[_0xc7ae('0x14')](_0xc7ae('0x15'),auth[_0xc7ae('0xb')](),controller[_0xc7ae('0x16')]);module[_0xc7ae('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index ff31090..b57cb7d 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 _0x2750=['BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Send','Feedback','thumb','star','stringify','name','input','getDataValue','parse','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2750,0x13b));var _0x0275=function(_0x6d11d9,_0x179ae0){_0x6d11d9=_0x6d11d9-0x0;var _0x1d2fdd=_0x2750[_0x6d11d9];return _0x1d2fdd;};'use strict';var Sequelize=require(_0x0275('0x0'));var rs=require('randomstring');module[_0x0275('0x1')]={'name':{'type':Sequelize[_0x0275('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'unique':_0x0275('0x3')},'description':{'type':Sequelize[_0x0275('0x2')]},'mapKey':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x4')},'mapKeyOffline':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x4')},'key':{'type':Sequelize[_0x0275('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x5')},'customerAlias':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0275('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x0275('0xa')](_0x0275('0xb'),_0x0275('0xc')),'defaultValue':_0x0275('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0xd')},'start_chat_button':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0xf')},'download_transcript':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x10')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x0275('0x11')]},'closingQuestion':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x12')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x13')},'noteTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x14')},'skipMessageButton':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x15')},'ratingType':{'type':Sequelize['ENUM']('star',_0x0275('0x16')),'defaultValue':_0x0275('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x0275('0x18')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0x0275('0x19'),'type':'text','required':!![]},'props':{'title':_0x0275('0x19'),'helpText':''}},{'type':_0x0275('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x0275('0x4'),'type':_0x0275('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x0275('0x1b')]('onlineForm')?JSON[_0x0275('0x1c')](this[_0x0275('0x1b')](_0x0275('0x1d'))):{};},'set':function(_0x15813f){return this[_0x0275('0x1e')](_0x0275('0x1d'),JSON['stringify'](_0x15813f));}},'offlineForm':{'type':Sequelize[_0x0275('0x11')],'defaultValue':function(){return JSON[_0x0275('0x18')]({'items':[{'type':_0x0275('0x1a'),'props':{'title':_0x0275('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x0275('0x4'),'type':'email'},'variable':null},{'type':_0x0275('0x1f'),'config':{'placeholder':_0x0275('0x20')},'props':{'title':_0x0275('0x20'),'helpText':_0x0275('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x0275('0x1b')]('offlineForm')?JSON[_0x0275('0x1c')](this[_0x0275('0x1b')](_0x0275('0x22'))):{};},'set':function(_0x489d7f){return this['setDataValue'](_0x0275('0x22'),JSON[_0x0275('0x18')](_0x489d7f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x0275('0x23')]();}},'autoclose':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x0275('0x2')]},'waitingTitle':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x24')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x25')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x26')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x0275('0x28')},'skipUnmanaged':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x29')},'sendUnmanaged':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x0275('0x11')]},'showAgentAvatar':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x0275('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0275('0x2a');}},'notificationSound':{'type':Sequelize[_0x0275('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2b')},'waitForTheAssignedAgent':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2c')},'verticalAlignment':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x0275('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2d')},'defaultTitle':{'type':Sequelize[_0x0275('0x2')]},'customerAvatar':{'type':Sequelize[_0x0275('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x0275('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0275('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x0275('0x2')],'defaultValue':_0x0275('0x2f')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0275('0x8')],'comment':_0x0275('0x30')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x0275('0x31'),'set':function(_0x76b8fa){if(!_0x76b8fa)this[_0x0275('0x1e')](_0x0275('0x32'),null);this[_0x0275('0x1e')](_0x0275('0x33'),_0x76b8fa);}},'vidaooEscalation':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x0275('0x2')],'allowNull':![],'defaultValue':_0x0275('0x34')},'vidaooNote':{'type':Sequelize[_0x0275('0x2')],'defaultValue':function(){return _0x0275('0x35');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x0275('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x0275('0x11')]}}; \ No newline at end of file +var _0xb58b=['alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','ENUM','squared','rounded','We\x20are\x20here!','Chat','Contact\x20us','BOOLEAN','TEXT','Form\x20properly\x20submitted','Type\x20a\x20message','Skip','star','thumb','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x22eb04,_0x4c4289){var _0x329104=function(_0xe85977){while(--_0xe85977){_0x22eb04['push'](_0x22eb04['shift']());}};_0x329104(++_0x4c4289);}(_0xb58b,0x1f1));var _0xbb58=function(_0x181566,_0x1c089c){_0x181566=_0x181566-0x0;var _0x275891=_0xb58b[_0x181566];return _0x275891;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xbb58('0x0'));module[_0xbb58('0x1')]={'name':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xbb58('0x3')},'description':{'type':Sequelize[_0xbb58('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x4')},'key':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbb58('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbb58('0x8')]('rounded',_0xbb58('0x9')),'defaultValue':_0xbb58('0xa')},'header_online':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0xc')},'offline_chat_button':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0xd')},'download_transcript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbb58('0xf')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x11')},'closingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x12')},'conditionAgreement':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbb58('0x8')](_0xbb58('0x13'),_0xbb58('0x14')),'defaultValue':_0xbb58('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'variable':null,'config':{'placeholder':_0xbb58('0x17'),'type':'text','required':!![]},'props':{'title':_0xbb58('0x17'),'helpText':''}},{'type':'input','props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x19'))?JSON[_0xbb58('0x1a')](this[_0xbb58('0x18')](_0xbb58('0x19'))):{};},'set':function(_0x4e0303){return this[_0xbb58('0x1b')](_0xbb58('0x19'),JSON[_0xbb58('0x15')](_0x4e0303));}},'offlineForm':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':function(){return JSON[_0xbb58('0x15')]({'items':[{'type':_0xbb58('0x16'),'props':{'title':_0xbb58('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbb58('0x4'),'type':_0xbb58('0x4')},'variable':null},{'type':_0xbb58('0x1c'),'config':{'placeholder':_0xbb58('0x1d')},'props':{'title':_0xbb58('0x1d'),'helpText':_0xbb58('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xbb58('0x18')](_0xbb58('0x1f'))?JSON['parse'](this[_0xbb58('0x18')](_0xbb58('0x1f'))):{};},'set':function(_0x12b3eb){return this[_0xbb58('0x1b')](_0xbb58('0x1f'),JSON[_0xbb58('0x15')](_0x12b3eb));}},'token':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return rs[_0xbb58('0x20')]();}},'autoclose':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbb58('0x2')]},'forwardOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbb58('0x2')]},'waitingTitle':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x21')},'waitingMessage':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x22')},'offlineMessageSubject':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x23')},'offlineMessageBody':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x12')},'sendUnmanaged':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x25')},'enableCustomerAttachment':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xbb58('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xbb58('0x26');}},'notificationSound':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0xbb58('0x27')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x28')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x29')},'messagesAlignment':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':_0xbb58('0x2a')},'defaultTitle':{'type':Sequelize[_0xbb58('0x2')]},'customerAvatar':{'type':Sequelize[_0xbb58('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbb58('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbb58('0x2b'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbb58('0x7')],'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[_0xbb58('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xbb58('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbb58('0x7')],'comment':_0xbb58('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xc29171){if(!_0xc29171)this[_0xbb58('0x1b')](_0xbb58('0x2d'),null);this[_0xbb58('0x1b')](_0xbb58('0x2e'),_0xc29171);}},'vidaooEscalation':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xbb58('0x2')],'allowNull':![],'defaultValue':_0xbb58('0x2f')},'vidaooNote':{'type':Sequelize[_0xbb58('0x2')],'defaultValue':function(){return _0xbb58('0x30');}},'vidaooMetadata':{'type':Sequelize[_0xbb58('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbb58('0xe')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 2e796c3..b9af818 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 _0x5003=['toPairs','ChatOfflineMessage','fromString','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','sendMail','email','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','server','remove','addInteraction','omit','getInteractions','Contact','Owner','Tag','Tags','tag','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','No\x20timezone','inspect','Interval','Intervals','License','increment','all','some','readFileSync','server/files/chat/iframe.ejs','URL','address','origin','3.1.0','remote','x-real-ip','connection','virtual','replace','verticalAlignment','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','priority','getApplications','addProactiveActions','ChatProactiveAction','getProactiveActions','getFields','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','getAgents','bluebird','mustache','fs-extra','lodash','querystring','ioredis','api','../../config/environment','url','../../mysqldb','localhost','socket.io-emitter','redis','./chatWebsite.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','end','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','fields','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','describe','Disposition','findOne','order','ChatWebsiteId','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','findAll','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','agentAvatar','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','setUA','headers','user-agent','getResult','chat','ValidationError','createdAt','updatedAt','ListId','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','CmContact','Contacts','Applications','account','applications','list','asc','defaults','contact','customerIp','cf-connecting-ip','x-forwarded-for','firstName','lastName','x-real-port','referer','browser','format','version','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','offline','files','difference','CompanyId','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render'];(function(_0x52ea5e,_0x3dfc55){var _0x496dbf=function(_0x3703d2){while(--_0x3703d2){_0x52ea5e['push'](_0x52ea5e['shift']());}};_0x496dbf(++_0x3dfc55);}(_0x5003,0x191));var _0x3500=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5003[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x3500('0x0'));var Mustache=require(_0x3500('0x1'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3500('0x2'));var _=require(_0x3500('0x3'));var querystring=require(_0x3500('0x4'));var Redis=require(_0x3500('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3500('0x6'));var config=require(_0x3500('0x7'));var url=require(_0x3500('0x8'));var db=require(_0x3500('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x3500('0xa'),'port':0x18eb});var socket=require(_0x3500('0xb'))(new Redis(config[_0x3500('0xc')]));require(_0x3500('0xd'))[_0x3500('0xe')](socket);var htmlToText=require('html-to-text');var jayson=require(_0x3500('0xf'));var client=jayson[_0x3500('0x10')][_0x3500('0x11')]({'port':0x232c});var client9002=jayson[_0x3500('0x10')][_0x3500('0x11')]({'port':0x232a});var client9003=jayson[_0x3500('0x10')][_0x3500('0x11')]({'port':0x232b});var client9001=jayson[_0x3500('0x10')][_0x3500('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x4fc172,_0x9ad645,_0x6aceda,_0x74f43a){return new BPromise(function(_0x1ea157,_0x36da3d){var _0x93d904=_0x74f43a||client;return _0x93d904[_0x3500('0x12')](_0x4fc172,_0x6aceda)[_0x3500('0x13')](function(_0xd2f983){logger[_0x3500('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x9ad645,_0x3500('0x15'));logger[_0x3500('0x16')](_0x3500('0x17'),_0x9ad645,_0x3500('0x15'),JSON[_0x3500('0x18')](_0xd2f983));if(_0xd2f983[_0x3500('0x19')]){if(_0xd2f983[_0x3500('0x19')][_0x3500('0x1a')]===0x1f4){logger['error'](_0x3500('0x1b'),_0x9ad645,_0xd2f983[_0x3500('0x19')][_0x3500('0x1c')]);return _0x36da3d(_0xd2f983['error']['message']);}logger[_0x3500('0x19')](_0x3500('0x1b'),_0x9ad645,_0xd2f983[_0x3500('0x19')][_0x3500('0x1c')]);return _0x1ea157(_0xd2f983[_0x3500('0x19')]['message']);}else{logger[_0x3500('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x9ad645,_0x3500('0x15'));_0x1ea157(_0xd2f983['result']['message']);}})[_0x3500('0x1d')](function(_0xf6e510){logger[_0x3500('0x19')](_0x3500('0x1b'),_0x9ad645,_0xf6e510);_0x36da3d(_0xf6e510);});});}function respondWithStatusCode(_0x574584,_0x57d71b){_0x57d71b=_0x57d71b||0xcc;return function(_0x1cb5d8){if(_0x1cb5d8){return _0x574584['sendStatus'](_0x57d71b);}return _0x574584[_0x3500('0x1e')](_0x57d71b)['end']();};}function respondWithResult(_0x1df317,_0x12cb92){_0x12cb92=_0x12cb92||0xc8;return function(_0x2e7bdf){if(_0x2e7bdf){return _0x1df317['status'](_0x12cb92)['json'](_0x2e7bdf);}};}function respondWithFilteredResult(_0x5f0b16,_0x996365){return function(_0x543a26){if(_0x543a26){var _0x68004e=typeof _0x996365[_0x3500('0x1f')]===_0x3500('0x20')&&typeof _0x996365['limit']==='undefined';var _0x19344e=_0x543a26['count'];var _0x349d27=_0x68004e?0x0:_0x996365['offset'];var _0x158fca=_0x68004e?_0x543a26[_0x3500('0x21')]:_0x996365[_0x3500('0x1f')]+_0x996365[_0x3500('0x22')];var _0xe76016;if(_0x158fca>=_0x19344e){_0x158fca=_0x19344e;_0xe76016=0xc8;}else{_0xe76016=0xce;}_0x5f0b16[_0x3500('0x1e')](_0xe76016);return _0x5f0b16[_0x3500('0x23')](_0x3500('0x24'),_0x349d27+'-'+_0x158fca+'/'+_0x19344e)[_0x3500('0x25')](_0x543a26);}return null;};}function saveUpdates(_0x16f0ed){return function(_0x4a7b6d){if(_0x4a7b6d){return _0x4a7b6d[_0x3500('0x26')](_0x16f0ed)[_0x3500('0x13')](function(_0x506232){return _0x506232;});}return null;};}function removeEntity(_0x5529ff){return function(_0x1c7458){if(_0x1c7458){return _0x1c7458[_0x3500('0x27')]()[_0x3500('0x13')](function(){var _0x334b66=_0x1c7458[_0x3500('0x28')]({'plain':!![]});var _0xbdf60c=_0x3500('0x29');return db[_0x3500('0x2a')]['destroy']({'where':{'type':_0xbdf60c,'resourceId':_0x334b66['id']}})[_0x3500('0x13')](function(){return _0x1c7458;});})['then'](function(){_0x5529ff[_0x3500('0x1e')](0xcc)[_0x3500('0x2b')]();});}};}function handleEntityNotFound(_0x3fae1b){return function(_0x28d345){if(!_0x28d345){_0x3fae1b[_0x3500('0x2c')](0x194);}return _0x28d345;};}function handleError(_0xf1b732,_0x1c3a19){_0x1c3a19=_0x1c3a19||0x1f4;return function(_0x3077fc){logger[_0x3500('0x19')](_0x3077fc[_0x3500('0x2d')]);if(_0x3077fc[_0x3500('0x2e')]){delete _0x3077fc[_0x3500('0x2e')];}_0xf1b732[_0x3500('0x1e')](_0x1c3a19)['send'](_0x3077fc);};}exports[_0x3500('0x2f')]=function(_0x2ade23,_0x5e65a7){var _0x1719cd={'include':[{'model':db[_0x3500('0x30')],'as':_0x3500('0x31')}]},_0x2959c8={},_0xe72e3c={'count':0x0,'rows':[]};var _0x23a4dd=_['map'](db[_0x3500('0x32')][_0x3500('0x33')],function(_0x34679e){return{'name':_0x34679e[_0x3500('0x34')],'type':_0x34679e[_0x3500('0x35')][_0x3500('0x36')]};});_0x2959c8[_0x3500('0x37')]=_[_0x3500('0x38')](_0x23a4dd,'name');_0x2959c8[_0x3500('0x39')]=_[_0x3500('0x3a')](_0x2ade23[_0x3500('0x39')]);_0x2959c8[_0x3500('0x3b')]=_[_0x3500('0x3c')](_0x2959c8[_0x3500('0x37')],_0x2959c8[_0x3500('0x39')]);_0x1719cd[_0x3500('0x3d')]=_['intersection'](_0x2959c8['model'],qs['fields'](_0x2ade23['query']['fields']));_0x1719cd[_0x3500('0x3d')]=_0x1719cd['attributes'][_0x3500('0x3e')]?_0x1719cd['attributes']:_0x2959c8[_0x3500('0x37')];if(!_0x2ade23[_0x3500('0x39')][_0x3500('0x3f')](_0x3500('0x40'))){_0x1719cd[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x2ade23[_0x3500('0x39')][_0x3500('0x22')]);_0x1719cd[_0x3500('0x1f')]=qs[_0x3500('0x1f')](_0x2ade23[_0x3500('0x39')]['offset']);}_0x1719cd['order']=qs['sort'](_0x2ade23[_0x3500('0x39')][_0x3500('0x41')]);_0x1719cd['where']=qs[_0x3500('0x3b')](_[_0x3500('0x42')](_0x2ade23[_0x3500('0x39')],_0x2959c8[_0x3500('0x3b')]),_0x23a4dd);if(_0x2ade23[_0x3500('0x39')][_0x3500('0x43')]){_0x1719cd[_0x3500('0x44')]=_['merge'](_0x1719cd[_0x3500('0x44')],{'$or':_['map'](_0x23a4dd,function(_0x3d2656){if(_0x3d2656[_0x3500('0x35')]!==_0x3500('0x45')){var _0x3bc88c={};_0x3bc88c[_0x3d2656[_0x3500('0x2e')]]={'$like':'%'+_0x2ade23['query'][_0x3500('0x43')]+'%'};return _0x3bc88c;}})});}_0x1719cd=_[_0x3500('0x46')]({},_0x1719cd,_0x2ade23[_0x3500('0x47')]);var _0x220b55={'where':_0x1719cd['where']};return db[_0x3500('0x32')][_0x3500('0x21')](_0x220b55)[_0x3500('0x13')](function(_0x2370fe){_0xe72e3c[_0x3500('0x21')]=_0x2370fe;if(_0x2ade23['query'][_0x3500('0x48')]){_0x1719cd[_0x3500('0x49')]=[{'all':!![]}];}return db[_0x3500('0x32')]['findAll'](_0x1719cd);})[_0x3500('0x13')](function(_0x34c4c9){_0xe72e3c['rows']=_0x34c4c9;return _0xe72e3c;})[_0x3500('0x13')](respondWithFilteredResult(_0x5e65a7,_0x1719cd))[_0x3500('0x1d')](handleError(_0x5e65a7,null));};exports['show']=function(_0x115840,_0x286f77){var _0x26b82b={'raw':![],'where':{'id':_0x115840['params']['id']},'include':[{'model':db[_0x3500('0x30')],'as':_0x3500('0x31')}]},_0x36c4c3={};_0x36c4c3['model']=_['keys'](db[_0x3500('0x32')][_0x3500('0x33')]);_0x36c4c3[_0x3500('0x39')]=_[_0x3500('0x3a')](_0x115840[_0x3500('0x39')]);_0x36c4c3['filters']=_[_0x3500('0x3c')](_0x36c4c3['model'],_0x36c4c3[_0x3500('0x39')]);_0x26b82b[_0x3500('0x3d')]=_[_0x3500('0x3c')](_0x36c4c3[_0x3500('0x37')],qs[_0x3500('0x4a')](_0x115840['query']['fields']));_0x26b82b['attributes']=_0x26b82b[_0x3500('0x3d')][_0x3500('0x3e')]?_0x26b82b[_0x3500('0x3d')]:_0x36c4c3['model'];if(_0x115840[_0x3500('0x39')]['includeAll']){_0x26b82b[_0x3500('0x49')]=[{'all':!![]}];}_0x26b82b=_[_0x3500('0x46')]({},_0x26b82b,_0x115840[_0x3500('0x47')]);return db[_0x3500('0x32')][_0x3500('0x4b')](_0x26b82b)[_0x3500('0x13')](handleEntityNotFound(_0x286f77,null))[_0x3500('0x13')](respondWithResult(_0x286f77,null))[_0x3500('0x1d')](handleError(_0x286f77,null));};exports['create']=function(_0x2d0b3e,_0x113057){return db[_0x3500('0x32')][_0x3500('0x4c')](_0x2d0b3e[_0x3500('0x4d')],{})[_0x3500('0x13')](function(_0x4dc64a){var _0x59b017=_0x2d0b3e[_0x3500('0x4e')]['get']({'plain':!![]});if(!_0x59b017)throw new Error(_0x3500('0x4f'));if(_0x59b017[_0x3500('0x50')]===_0x3500('0x4e')){var _0x42e3f1=_0x4dc64a['get']({'plain':!![]});var _0x34447c='ChatWebsites';return db[_0x3500('0x51')]['find']({'where':{'name':_0x34447c,'userProfileId':_0x59b017['userProfileId']},'raw':!![]})[_0x3500('0x13')](function(_0x397d6b){if(_0x397d6b&&_0x397d6b[_0x3500('0x52')]===0x0){return db[_0x3500('0x2a')]['create']({'name':_0x42e3f1[_0x3500('0x2e')],'resourceId':_0x42e3f1['id'],'type':_0x397d6b[_0x3500('0x2e')],'sectionId':_0x397d6b['id']},{})[_0x3500('0x13')](function(){return _0x4dc64a;});}else{return _0x4dc64a;}})[_0x3500('0x1d')](function(_0x382cef){logger[_0x3500('0x19')](_0x3500('0x53'),_0x382cef);throw _0x382cef;});}return _0x4dc64a;})[_0x3500('0x13')](respondWithResult(_0x113057,0xc9))[_0x3500('0x1d')](handleError(_0x113057,null));};exports['update']=function(_0x5c3c99,_0x7c3237){if(_0x5c3c99[_0x3500('0x4d')]['id']){delete _0x5c3c99[_0x3500('0x4d')]['id'];}return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x5c3c99[_0x3500('0x54')]['id']},'include':[{'model':db[_0x3500('0x30')],'as':_0x3500('0x31')}]})[_0x3500('0x13')](handleEntityNotFound(_0x7c3237,null))[_0x3500('0x13')](saveUpdates(_0x5c3c99[_0x3500('0x4d')],null))['then'](respondWithResult(_0x7c3237,null))[_0x3500('0x1d')](handleError(_0x7c3237,null));};exports[_0x3500('0x27')]=function(_0x1a781b,_0x10a695){return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x1a781b[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x10a695,null))[_0x3500('0x13')](removeEntity(_0x10a695,null))[_0x3500('0x1d')](handleError(_0x10a695,null));};exports[_0x3500('0x55')]=function(_0x5e0c68,_0x1e6e6c){return db[_0x3500('0x32')][_0x3500('0x55')]()[_0x3500('0x13')](respondWithResult(_0x1e6e6c,null))[_0x3500('0x1d')](handleError(_0x1e6e6c,null));};exports['addDisposition']=function(_0x34276e,_0x2783f4){if(_0x34276e[_0x3500('0x4d')]['id']){delete _0x34276e[_0x3500('0x4d')]['id'];}return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x34276e[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x2783f4,null))['then'](function(_0xf692f9){if(_0xf692f9){_0x34276e['body']['ChatWebsiteId']=_0xf692f9['id'];return db[_0x3500('0x56')][_0x3500('0x4c')](_0x34276e[_0x3500('0x4d')]);}})[_0x3500('0x13')](respondWithResult(_0x2783f4,null))[_0x3500('0x1d')](handleError(_0x2783f4,null));};exports['getDispositions']=function(_0x4e3e4d,_0x23c48d){var _0x10c47d={'raw':![],'where':{}};var _0x5d8d63={};var _0x45806d={'count':0x0,'rows':[]};return db[_0x3500('0x32')][_0x3500('0x57')]({'where':{'id':_0x4e3e4d[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x23c48d,null))[_0x3500('0x13')](function(_0x8b4650){if(_0x8b4650){_0x5d8d63['model']=_[_0x3500('0x3a')](db[_0x3500('0x56')][_0x3500('0x33')]);_0x5d8d63[_0x3500('0x39')]=_['keys'](_0x4e3e4d[_0x3500('0x39')]);_0x5d8d63[_0x3500('0x3b')]=_['intersection'](_0x5d8d63[_0x3500('0x37')],_0x5d8d63[_0x3500('0x39')]);_0x10c47d[_0x3500('0x3d')]=_[_0x3500('0x3c')](_0x5d8d63[_0x3500('0x37')],qs[_0x3500('0x4a')](_0x4e3e4d['query']['fields']));_0x10c47d[_0x3500('0x3d')]=_0x10c47d[_0x3500('0x3d')][_0x3500('0x3e')]?_0x10c47d[_0x3500('0x3d')]:_0x5d8d63['model'];if(!_0x4e3e4d[_0x3500('0x39')][_0x3500('0x3f')](_0x3500('0x40'))){_0x10c47d[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x4e3e4d[_0x3500('0x39')][_0x3500('0x22')]);_0x10c47d['offset']=qs[_0x3500('0x1f')](_0x4e3e4d[_0x3500('0x39')][_0x3500('0x1f')]);}_0x10c47d[_0x3500('0x58')]=qs[_0x3500('0x41')](_0x4e3e4d[_0x3500('0x39')][_0x3500('0x41')]);_0x10c47d[_0x3500('0x44')]=qs['filters'](_['pick'](_0x4e3e4d[_0x3500('0x39')],_0x5d8d63['filters']));_0x10c47d[_0x3500('0x44')][_0x3500('0x59')]=_0x8b4650['id'];if(_0x4e3e4d[_0x3500('0x39')][_0x3500('0x43')]){_0x10c47d[_0x3500('0x44')]=_[_0x3500('0x46')](_0x10c47d[_0x3500('0x44')],{'$or':_[_0x3500('0x38')](_0x10c47d[_0x3500('0x3d')],function(_0x554d74){var _0x3e8123={};_0x3e8123[_0x554d74]={'$like':'%'+_0x4e3e4d[_0x3500('0x39')][_0x3500('0x43')]+'%'};return _0x3e8123;})});}_0x10c47d=_[_0x3500('0x46')]({},_0x10c47d,_0x4e3e4d[_0x3500('0x47')]);return db['Disposition'][_0x3500('0x21')]({'where':_0x10c47d['where']})[_0x3500('0x13')](function(_0x2cf347){_0x45806d['count']=_0x2cf347;if(_0x4e3e4d[_0x3500('0x39')][_0x3500('0x48')]){_0x10c47d[_0x3500('0x49')]=[{'all':!![]}];}return db[_0x3500('0x56')]['findAll'](_0x10c47d);})['then'](function(_0x58024e){_0x45806d[_0x3500('0x5a')]=_0x58024e;return _0x45806d;});}})[_0x3500('0x13')](respondWithFilteredResult(_0x23c48d,_0x10c47d))[_0x3500('0x1d')](handleError(_0x23c48d,null));};exports[_0x3500('0x5b')]=function(_0x51fda7,_0xe1263e){return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x51fda7['params']['id']}})[_0x3500('0x13')](handleEntityNotFound(_0xe1263e,null))[_0x3500('0x13')](function(_0xb7e41e){if(_0xb7e41e){return _0xb7e41e[_0x3500('0x5b')](_0x51fda7['query'][_0x3500('0x5c')]);}})[_0x3500('0x13')](respondWithStatusCode(_0xe1263e,null))[_0x3500('0x1d')](handleError(_0xe1263e,null));};exports[_0x3500('0x5d')]=function(_0x104756,_0x1a0c5d){if(_0x104756[_0x3500('0x4d')]['id']){delete _0x104756[_0x3500('0x4d')]['id'];}return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x104756[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x1a0c5d,null))[_0x3500('0x13')](function(_0xefe6be){if(_0xefe6be){_0x104756[_0x3500('0x4d')][_0x3500('0x59')]=_0xefe6be['id'];return db['CannedAnswer'][_0x3500('0x4c')](_0x104756[_0x3500('0x4d')]);}})[_0x3500('0x13')](respondWithResult(_0x1a0c5d,null))[_0x3500('0x1d')](handleError(_0x1a0c5d,null));};exports[_0x3500('0x5e')]=function(_0x466b0c,_0x1b81dc){var _0x282d63={'raw':![],'where':{}};var _0x1aa346={};var _0x3facc5={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3500('0x57')]({'where':{'id':_0x466b0c[_0x3500('0x54')]['id']}})['then'](handleEntityNotFound(_0x1b81dc,null))[_0x3500('0x13')](function(_0x1d4778){if(_0x1d4778){_0x1aa346['model']=_['keys'](db[_0x3500('0x5f')][_0x3500('0x33')]);_0x1aa346[_0x3500('0x39')]=_['keys'](_0x466b0c[_0x3500('0x39')]);_0x1aa346[_0x3500('0x3b')]=_['intersection'](_0x1aa346[_0x3500('0x37')],_0x1aa346[_0x3500('0x39')]);_0x282d63[_0x3500('0x3d')]=_[_0x3500('0x3c')](_0x1aa346[_0x3500('0x37')],qs[_0x3500('0x4a')](_0x466b0c[_0x3500('0x39')][_0x3500('0x4a')]));_0x282d63[_0x3500('0x3d')]=_0x282d63[_0x3500('0x3d')][_0x3500('0x3e')]?_0x282d63[_0x3500('0x3d')]:_0x1aa346[_0x3500('0x37')];if(!_0x466b0c[_0x3500('0x39')][_0x3500('0x3f')]('nolimit')){_0x282d63[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x466b0c[_0x3500('0x39')][_0x3500('0x22')]);_0x282d63[_0x3500('0x1f')]=qs[_0x3500('0x1f')](_0x466b0c[_0x3500('0x39')][_0x3500('0x1f')]);}_0x282d63[_0x3500('0x58')]=qs[_0x3500('0x41')](_0x466b0c[_0x3500('0x39')][_0x3500('0x41')]);_0x282d63['where']=qs[_0x3500('0x3b')](_[_0x3500('0x42')](_0x466b0c['query'],_0x1aa346[_0x3500('0x3b')]));_0x282d63['where'][_0x3500('0x59')]=_0x1d4778['id'];if(_0x466b0c[_0x3500('0x39')][_0x3500('0x43')]){_0x282d63[_0x3500('0x44')]=_[_0x3500('0x46')](_0x282d63['where'],{'$or':_[_0x3500('0x38')](_0x282d63['attributes'],function(_0x35261b){var _0x4acf2a={};_0x4acf2a[_0x35261b]={'$like':'%'+_0x466b0c[_0x3500('0x39')]['filter']+'%'};return _0x4acf2a;})});}_0x282d63=_[_0x3500('0x46')]({},_0x282d63,_0x466b0c[_0x3500('0x47')]);return db['CannedAnswer'][_0x3500('0x21')]({'where':_0x282d63['where']})['then'](function(_0xe5f0a8){_0x3facc5[_0x3500('0x21')]=_0xe5f0a8;if(_0x466b0c['query']['includeAll']){_0x282d63[_0x3500('0x49')]=[{'all':!![]}];}return db[_0x3500('0x5f')][_0x3500('0x60')](_0x282d63);})[_0x3500('0x13')](function(_0x173248){_0x3facc5[_0x3500('0x5a')]=_0x173248;return _0x3facc5;});}})[_0x3500('0x13')](respondWithFilteredResult(_0x1b81dc,_0x282d63))[_0x3500('0x1d')](handleError(_0x1b81dc,null));};exports[_0x3500('0x61')]=function(_0x160396,_0x5d267b){return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x160396[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x5d267b,null))['then'](function(_0x5a7dd5){if(_0x5a7dd5){return _0x5a7dd5[_0x3500('0x61')](_0x160396[_0x3500('0x39')][_0x3500('0x5c')]);}})[_0x3500('0x13')](respondWithStatusCode(_0x5d267b,null))[_0x3500('0x1d')](handleError(_0x5d267b,null));};exports[_0x3500('0x62')]=function(_0x580c2d,_0x5cb125){_0x580c2d[_0x3500('0x4d')][_0x3500('0x63')]=_0x580c2d[_0x3500('0x64')][_0x3500('0x65')];return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x580c2d[_0x3500('0x54')]['id']}})['then'](handleEntityNotFound(_0x5cb125,null))['then'](saveUpdates(_0x580c2d['body'],null))[_0x3500('0x13')](respondWithResult(_0x5cb125,null))[_0x3500('0x1d')](handleError(_0x5cb125,null));};exports[_0x3500('0x66')]=function(_0x4ef03c,_0x164e1b){_0x4ef03c[_0x3500('0x4d')]['agentAvatar']=_0x4ef03c[_0x3500('0x64')][_0x3500('0x65')];return db[_0x3500('0x32')]['find']({'where':{'id':_0x4ef03c['params']['id']}})['then'](handleEntityNotFound(_0x164e1b,null))[_0x3500('0x13')](saveUpdates(_0x4ef03c[_0x3500('0x4d')],null))[_0x3500('0x13')](respondWithResult(_0x164e1b,null))['catch'](handleError(_0x164e1b,null));};exports[_0x3500('0x67')]=function(_0x51fabd,_0x1bc752){_0x51fabd[_0x3500('0x4d')][_0x3500('0x68')]=_0x51fabd[_0x3500('0x64')]['filename'];return db['ChatWebsite'][_0x3500('0x4b')]({'where':{'id':_0x51fabd['params']['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x1bc752,null))['then'](saveUpdates(_0x51fabd[_0x3500('0x4d')],null))[_0x3500('0x13')](respondWithResult(_0x1bc752,null))[_0x3500('0x1d')](handleError(_0x1bc752,null));};exports[_0x3500('0x69')]=function(_0x5d4a21,_0x58d83b){_0x5d4a21[_0x3500('0x4d')]['systemAvatar']=_0x5d4a21['file'][_0x3500('0x65')];return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x5d4a21[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x58d83b,null))[_0x3500('0x13')](saveUpdates(_0x5d4a21[_0x3500('0x4d')],null))[_0x3500('0x13')](respondWithResult(_0x58d83b,null))[_0x3500('0x1d')](handleError(_0x58d83b,null));};exports[_0x3500('0x6a')]=function(_0x36dea7,_0x5a23ee){var _0x1d91b8=path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0x6d'));var _0x5bc48d={'where':{'id':_0x36dea7['params']['id']},'attributes':['id',_0x3500('0x63')],'raw':!![]};var _0x5cf089=![];return require(_0x3500('0x6e'))[_0x3500('0x6f')]()[_0x3500('0x13')](function(_0x455df2){if(_0x455df2){_0x5cf089=_0x455df2[_0x3500('0x70')];}})[_0x3500('0x13')](function(){return db[_0x3500('0x32')]['find'](_0x5bc48d);})[_0x3500('0x13')](handleEntityNotFound(_0x5a23ee,null))[_0x3500('0x13')](function(_0x246f80){if(_0x246f80){if(!_[_0x3500('0x71')](_0x246f80[_0x3500('0x63')])){if(fs[_0x3500('0x72')](path[_0x3500('0x6b')](config['root'],'server/files/images/logos/',_0x246f80[_0x3500('0x63')]))&&_0x5cf089){_0x1d91b8=path['join'](config[_0x3500('0x6c')],_0x3500('0x73'),_0x246f80['sitepic']);}}return _0x5a23ee[_0x3500('0x74')](_0x1d91b8);}})[_0x3500('0x1d')](handleError(_0x5a23ee,null));};exports['getAvatar']=function(_0x57c094,_0x3bcb96){var _0x5ef27d=path[_0x3500('0x6b')](config[_0x3500('0x6c')],'server/files/images/avatars/default_avatar.png');var _0xa12e3c={'where':{'id':_0x57c094[_0x3500('0x54')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x3500('0x32')][_0x3500('0x4b')](_0xa12e3c)[_0x3500('0x13')](handleEntityNotFound(_0x3bcb96,null))[_0x3500('0x13')](function(_0x105d70){if(_0x105d70){if(!_[_0x3500('0x71')](_0x105d70[_0x3500('0x75')])){if(fs[_0x3500('0x72')](path[_0x3500('0x6b')](config['root'],_0x3500('0x76'),_0x105d70['agentAvatar']))){_0x5ef27d=path[_0x3500('0x6b')](config['root'],_0x3500('0x76'),_0x105d70[_0x3500('0x75')]);}}return _0x3bcb96['download'](_0x5ef27d);}})[_0x3500('0x1d')](handleError(_0x3bcb96,null));};exports['getCustomerAvatar']=function(_0x5d1bfb,_0x568789){var _0x48beab=path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0x77'));var _0x2e4f46={'where':{'id':_0x5d1bfb[_0x3500('0x54')]['id']},'attributes':['id',_0x3500('0x68'),_0x3500('0x78')],'raw':!![]};return db['ChatWebsite'][_0x3500('0x4b')](_0x2e4f46)[_0x3500('0x13')](handleEntityNotFound(_0x568789,null))[_0x3500('0x13')](function(_0x37bf92){if(_0x37bf92){if(!_[_0x3500('0x71')](_0x37bf92[_0x3500('0x68')])){if(fs[_0x3500('0x72')](path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0x76'),_0x37bf92['customerAvatar']))&&_0x37bf92[_0x3500('0x78')]){_0x48beab=path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0x76'),_0x37bf92[_0x3500('0x68')]);}}return _0x568789['download'](_0x48beab);}})[_0x3500('0x1d')](handleError(_0x568789,null));};exports[_0x3500('0x79')]=function(_0xb1cf0,_0x2d0b3c){var _0x14d9b2=path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0x7a'));var _0x49fa20={'where':{'id':_0xb1cf0[_0x3500('0x54')]['id']},'attributes':['id',_0x3500('0x7b')],'raw':!![]};return db[_0x3500('0x32')][_0x3500('0x4b')](_0x49fa20)[_0x3500('0x13')](handleEntityNotFound(_0x2d0b3c,null))[_0x3500('0x13')](function(_0x5d2cf7){if(_0x5d2cf7){if(!_['isNil'](_0x5d2cf7[_0x3500('0x7b')])){if(fs['existsSync'](path[_0x3500('0x6b')](config['root'],_0x3500('0x76'),_0x5d2cf7[_0x3500('0x7b')]))){_0x14d9b2=path['join'](config[_0x3500('0x6c')],_0x3500('0x76'),_0x5d2cf7[_0x3500('0x7b')]);}}return _0x2d0b3c['download'](_0x14d9b2);}})[_0x3500('0x1d')](handleError(_0x2d0b3c,null));};exports['notify']=function(_0x192f0b,_0x2acc29){var _0x26e05e=require('user-agent-parser');var _0x49f0a0=new _0x26e05e();var _0x3e533d=_0x49f0a0[_0x3500('0x7c')](_0x192f0b[_0x3500('0x7d')][_0x3500('0x7e')])[_0x3500('0x7f')]();var _0x16a963={'body':_0x192f0b['body'],'channel':_0x3500('0x80')};var _0x5a1066=[];var _0x7360c0=[];var _0xc32eaf={};var _0x596782=![];return db['CmContact']['describe']()[_0x3500('0x13')](function(_0x1844d0){if(!_0x1844d0){throw new db['Sequelize'][(_0x3500('0x81'))]('no\x20available\x20attributes');}_0x5a1066=_['difference'](_[_0x3500('0x3a')](_0x1844d0),[_0x3500('0x82'),_0x3500('0x83')]);_0x7360c0=_['difference'](_[_0x3500('0x3a')](_0x1844d0),['createdAt','updatedAt','CompanyId',_0x3500('0x84')]);if(_0x192f0b[_0x3500('0x4d')]['id']){delete _0x192f0b[_0x3500('0x4d')]['id'];}if(_['isNil'](_0x192f0b['body'][_0x3500('0x85')])){throw new db[(_0x3500('0x86'))][(_0x3500('0x81'))](_0x3500('0x87'));}if(_['isNil'](_0x192f0b['body'][_0x3500('0x4d')])||_0x192f0b[_0x3500('0x4d')]['body']===''){throw new db[(_0x3500('0x86'))][(_0x3500('0x81'))](_0x3500('0x88'));}if(_[_0x3500('0x71')](_0x192f0b[_0x3500('0x4d')][_0x3500('0x89')])){throw new db[(_0x3500('0x86'))][(_0x3500('0x81'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x7360c0);}if(!_[_0x3500('0x8a')](_0x7360c0,_0x192f0b[_0x3500('0x4d')][_0x3500('0x89')])){throw new db['Sequelize'][(_0x3500('0x81'))](_0x3500('0x8b')+_0x7360c0);}_0xc32eaf[_0x192f0b['body'][_0x3500('0x89')]]=_0x192f0b['body'][_0x3500('0x85')];})['then'](function(){return db[_0x3500('0x32')]['find']({'where':{'id':_0x192f0b[_0x3500('0x54')]['id']},'include':[{'model':db['CmList'],'as':_0x3500('0x8c'),'include':[{'model':db[_0x3500('0x8d')],'as':_0x3500('0x8e'),'where':_0xc32eaf,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['ChatApplication'],'as':_0x3500('0x8f')}]});})[_0x3500('0x13')](handleEntityNotFound(_0x2acc29,null))['then'](function(_0x2043e9){if(_0x2043e9&&_0x2043e9['List']){_0x16a963[_0x3500('0x90')]=_0x2043e9;_0x16a963[_0x3500('0x91')]=_0x2043e9[_0x3500('0x8f')];_0x16a963[_0x3500('0x92')]=_0x2043e9[_0x3500('0x8c')];_0x16a963[_0x3500('0x91')]=_['orderBy'](_0x16a963['applications'],['priority'],[_0x3500('0x93')]);if(_0x16a963[_0x3500('0x90')]['Applications']){delete _0x16a963[_0x3500('0x90')][_0x3500('0x8f')];}if(_0x16a963[_0x3500('0x90')]['List']&&_0x16a963[_0x3500('0x90')][_0x3500('0x8c')][_0x3500('0x8e')]['length']){return _0x16a963[_0x3500('0x90')]['List'][_0x3500('0x8e')][0x0];}var _0x5be95c=_[_0x3500('0x94')](_0x192f0b[_0x3500('0x4d')],{'firstName':_0x192f0b['body']['from'],'ListId':_0x2043e9[_0x3500('0x84')]});_0x5be95c[_0x192f0b[_0x3500('0x4d')][_0x3500('0x89')]]=_0x192f0b[_0x3500('0x4d')][_0x3500('0x85')];return db[_0x3500('0x8d')][_0x3500('0x4c')](_0x5be95c,{'fields':_0x5a1066,'raw':!![]});}})['then'](handleEntityNotFound(_0x2acc29,null))[_0x3500('0x13')](function(_0x467a87){_0x16a963[_0x3500('0x95')]=_0x467a87;var _0x6357ad=_0x192f0b[_0x3500('0x4d')][_0x3500('0x96')];if(_0x192f0b['headers'][_0x3500('0x97')]){_0x6357ad=_0x192f0b['headers'][_0x3500('0x97')];}else if(_0x192f0b[_0x3500('0x7d')]['x-forwarded-for']){_0x6357ad=_['first'](_0x192f0b['headers'][_0x3500('0x98')]['split'](','));}if(_0x467a87){var _0x14b21c={'ContactId':_0x467a87['id'],'ChatWebsiteId':_0x192f0b[_0x3500('0x54')]['id'],'from':(_0x467a87[_0x3500('0x99')]||'')+'\x20'+(_0x467a87[_0x3500('0x9a')]||''),'customerIp':_0x6357ad,'customerPort':_0x192f0b['headers'][_0x3500('0x9b')]?_0x192f0b['headers'][_0x3500('0x9b')]:null,'referer':_0x192f0b[_0x3500('0x4d')][_0x3500('0x9c')],'browserName':_0x3e533d['browser'][_0x3500('0x2e')]&&_0x3e533d[_0x3500('0x9d')]['version']?util[_0x3500('0x9e')]('%s\x20%s',_0x3e533d['browser'][_0x3500('0x2e')],_0x3e533d[_0x3500('0x9d')][_0x3500('0x9f')]):'unknown','browserVersion':_0x3e533d['browser'][_0x3500('0x9f')]||_0x3500('0xa0'),'osName':util[_0x3500('0x9e')](_0x3500('0xa1'),_0x3e533d['os'][_0x3500('0x2e')],_0x3e533d['os'][_0x3500('0x9f')]),'osVersion':_0x3e533d['os'][_0x3500('0x9f')],'deviceModel':_0x3e533d[_0x3500('0xa2')]['model']&&_0x3e533d[_0x3500('0xa2')][_0x3500('0xa3')]?util[_0x3500('0x9e')](_0x3500('0xa4'),_0x3e533d['device'][_0x3500('0x37')],_0x3e533d[_0x3500('0xa2')][_0x3500('0xa3')],_0x3e533d[_0x3500('0xa2')]['type']):null,'deviceVendor':_0x3e533d[_0x3500('0xa2')][_0x3500('0xa3')],'deviceType':_0x3e533d[_0x3500('0xa2')]['type'],'formData':JSON[_0x3500('0x18')](_0x192f0b['body'])};var _0x138fb6={'ChatWebsiteId':_0x192f0b[_0x3500('0x54')]['id'],'closed':![]};if(_0x192f0b['body'][_0x3500('0xa5')]){_0x138fb6['threadId']=_0x192f0b[_0x3500('0x4d')][_0x3500('0xa5')];return db[_0x3500('0xa6')][_0x3500('0x4b')]({'where':_0x138fb6})[_0x3500('0x13')](function(_0x59cc73){if(_0x59cc73){return[_0x59cc73,![]];}_0x14b21c['threadId']=_0x192f0b[_0x3500('0x4d')][_0x3500('0xa5')];_0x14b21c[_0x3500('0xa7')]=_0x192f0b[_0x3500('0x4d')]['externalUrl'];return db['ChatInteraction']['create'](_0x14b21c)[_0x3500('0x13')](function(_0x31223c){return[_0x31223c,!![]];});});}_0x138fb6[_0x3500('0xa8')]=_0x467a87['id'];if(_0x192f0b[_0x3500('0x4d')][_0x3500('0xa9')]&&_0x192f0b[_0x3500('0x4d')][_0x3500('0xa9')]['id']){_0x138fb6['id']=_0x192f0b[_0x3500('0x4d')][_0x3500('0xa9')]['id'];return db[_0x3500('0xa6')][_0x3500('0x4b')]({'where':_0x138fb6})[_0x3500('0x13')](function(_0x139405){if(_0x139405){return[_0x139405,![]];}return db[_0x3500('0xa6')][_0x3500('0x4c')](_0x14b21c)[_0x3500('0x13')](function(_0x2aeaf0){return[_0x2aeaf0,!![]];});});}return db[_0x3500('0xa6')][_0x3500('0x4c')](_0x14b21c)[_0x3500('0x13')](function(_0x44f423){return[_0x44f423,!![]];});}})[_0x3500('0xaa')](function(_0x5166f7,_0x1c8b42){if(_0x5166f7){_0x596782=_0x1c8b42;if(!_0x1c8b42){var _0x6b2a10={'from':(_0x16a963['contact'][_0x3500('0x99')]||'')+'\x20'+(_0x16a963[_0x3500('0x95')][_0x3500('0x9a')]||'')};if(_0x192f0b[_0x3500('0x4d')][_0x3500('0xa5')]&&_0x192f0b[_0x3500('0x4d')]['messageId']&&_0x192f0b['body'][_0x3500('0xa5')]!=_0x192f0b['body']['messageId']){_0x6b2a10[_0x3500('0xa5')]=_0x192f0b[_0x3500('0x4d')][_0x3500('0xab')];}return _0x5166f7['update'](_0x6b2a10);}else{return _0x5166f7;}}})[_0x3500('0x13')](function(_0x5d8231){_0x16a963['interaction']=_0x5d8231[_0x3500('0x28')]({'plain':!![]});_0x16a963[_0x3500('0xa9')][_0x3500('0xac')]=_0x596782;if(_0x16a963['interaction'][_0x3500('0xac')]){if(_0x16a963[_0x3500('0x90')][_0x3500('0xad')]){_0x16a963[_0x3500('0x91')][_0x3500('0xae')]({'id':0x0,'priority':_0x16a963['applications'][_0x3500('0x3e')]+0x1,'app':_0x3500('0xaf'),'appdata':_0x3500('0xb0'),'interval':'*,*,*,*'});}}return db[_0x3500('0xb1')][_0x3500('0x4c')]({'body':_0x192f0b[_0x3500('0x4d')]['body'],'ChatWebsiteId':_0x192f0b[_0x3500('0x54')]['id'],'ChatInteractionId':_0x5d8231['id'],'direction':'in','ContactId':_0x16a963[_0x3500('0x95')]['id'],'AttachmentId':_0x192f0b[_0x3500('0x4d')][_0x3500('0xb2')]});})['then'](function(_0x4b6ebb){_0x16a963[_0x3500('0x1c')]=_0x4b6ebb;if(_0x16a963[_0x3500('0xa9')][_0x3500('0xb3')]){return db[_0x3500('0xb4')][_0x3500('0x4b')]({'attributes':['id','name'],'where':{'id':_0x16a963[_0x3500('0xa9')][_0x3500('0xb3')]}})[_0x3500('0x13')](function(_0x101b71){if(_0x101b71){_0x16a963['applications'][_0x3500('0xb5')]({'id':0x0,'priority':0x0,'app':_0x3500('0xb6'),'appdata':_0x101b71[_0x3500('0x2e')]+','+(_0x16a963[_0x3500('0x90')][_0x3500('0xb7')]||0xa),'interval':_0x3500('0xb8')});_0x16a963[_0x3500('0xb9')]=!![];}return respondWithRpcPromise(_0x3500('0xba'),'startRouting',_0x16a963);});}return respondWithRpcPromise('Start',_0x3500('0xbb'),_0x16a963);})[_0x3500('0x13')](function(_0x5bb738){respondWithRpcPromise(_0x3500('0xbc'),_0x3500('0xbc'),{'event':'notify','message':_0x5bb738},client9002);return _0x5bb738;})[_0x3500('0x13')](respondWithResult(_0x2acc29,null))['catch'](handleError(_0x2acc29,null));};exports[_0x3500('0xbd')]=function(_0x442b47,_0x2f9aee){var _0x2c27e6,_0x1aba65,_0x164b35;var _0x28f866=[];var _0xab1261={};var _0x15bdd5=_0x442b47[_0x3500('0xbe')]||[];var _0x3d4685=[];var _0x581dcf;return db[_0x3500('0x8d')][_0x3500('0x55')]()[_0x3500('0x13')](function(_0x3b978f){if(!_0x3b978f){throw new db[(_0x3500('0x86'))][(_0x3500('0x81'))]('no\x20available\x20attributes');}_0x28f866=_[_0x3500('0xbf')](_[_0x3500('0x3a')](_0x3b978f),['createdAt',_0x3500('0x83'),_0x3500('0xc0'),'ListId']);if(_0x442b47['body']['id']){delete _0x442b47[_0x3500('0x4d')]['id'];}if(_[_0x3500('0x71')](_0x442b47[_0x3500('0x4d')]['from'])){throw _0x2f9aee[_0x3500('0x1e')](0x1f4)[_0x3500('0xc1')](new db[(_0x3500('0x86'))][(_0x3500('0x81'))](_0x3500('0x87')));}if(_[_0x3500('0x71')](_0x442b47[_0x3500('0x4d')][_0x3500('0x4d')])||_0x442b47[_0x3500('0x4d')][_0x3500('0x4d')]===''){throw _0x2f9aee['status'](0x1f4)[_0x3500('0xc1')](new db[(_0x3500('0x86'))][(_0x3500('0x81'))](_0x3500('0x88')));}if(_[_0x3500('0x71')](_0x442b47['body']['mapKeyOffline'])){throw _0x2f9aee[_0x3500('0x1e')](0x1f4)[_0x3500('0xc1')](new db['Sequelize'][(_0x3500('0x81'))](_0x3500('0xc2')+_0x28f866));}if(!_['includes'](_0x28f866,_0x442b47['body'][_0x3500('0xc3')])){throw _0x2f9aee[_0x3500('0x1e')](0x1f4)['send'](new db[(_0x3500('0x86'))][(_0x3500('0x81'))](_0x3500('0xc4')+_0x28f866));}_0xab1261[_0x442b47[_0x3500('0x4d')][_0x3500('0xc3')]]=_0x442b47[_0x3500('0x4d')][_0x3500('0x85')];})[_0x3500('0x13')](function(){return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x442b47['params']['id']},'include':[{'model':db[_0x3500('0xc5')],'as':_0x3500('0x8c')},{'model':db['MailAccount'],'as':_0x3500('0xc6')}]});})[_0x3500('0x13')](handleEntityNotFound(_0x2f9aee,null))[_0x3500('0x13')](function(_0x240dc6){if(_0x240dc6&&_0x240dc6[_0x3500('0x8c')]){_0x1aba65=_0x240dc6;var _0x4b5faa=_[_0x3500('0x94')](_0x442b47[_0x3500('0x4d')],{'firstName':_0x442b47[_0x3500('0x4d')]['from'],'phone':_0x442b47['body'][_0x3500('0x85')],'ListId':_0x240dc6[_0x3500('0x84')]});_0x4b5faa[_0x442b47[_0x3500('0x4d')]['mapKeyOffline']]=_0x442b47[_0x3500('0x4d')][_0x3500('0x85')];return db[_0x3500('0x8d')][_0x3500('0xc7')]({'where':_0xab1261,'defaults':_0x4b5faa});}})['spread'](function(_0x275dcf){if(_0x275dcf){_0x164b35=_0x275dcf;var _0x243d0a=fs['readFileSync'](path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0xc8')),_0x3500('0xc9'));var _0x591733=ejs[_0x3500('0xca')](_0x243d0a,{'body':_[_0x3500('0xcb')](_0x442b47['body'][_0x3500('0x4d')]),'bodyTitle':_0x1aba65['offlineMessageBody']});return db[_0x3500('0xcc')]['create']({'body':_0x591733,'plainBody':htmlToText[_0x3500('0xcd')](_0x591733),'ContactId':_0x275dcf['id'],'ChatWebsiteId':_0x1aba65['id']});}})[_0x3500('0x13')](function(_0x29619c){_0x581dcf=_0x29619c;if(_0x15bdd5['length']){var _0x44132e=_0x15bdd5[_0x3500('0x38')](function(_0x10c926){return{'name':_0x10c926['originalname'],'basename':_0x10c926[_0x3500('0x65')],'type':_0x10c926['mimetype'],'ChatOfflineMessageId':_0x29619c['id']};});_0x3d4685=_0x44132e[_0x3500('0x38')](_0x17084c=>{var _0x1022a6={'filename':_0x17084c[_0x3500('0x2e')],'path':path[_0x3500('0x6b')](config[_0x3500('0x6c')],'server',_0x3500('0xbe'),_0x3500('0xce'),_0x3500('0xcf'),_0x17084c[_0x3500('0xd0')])};return _0x1022a6;});if(!_0x1aba65[_0x3500('0xd1')]){return db[_0x3500('0xd2')]['transaction'](function(_0x2a3c1d){return db[_0x3500('0xd3')][_0x3500('0xd4')](_0x44132e,{'transaction':_0x2a3c1d});});}}})[_0x3500('0x13')](function(){if(_0x581dcf){_0x2c27e6=_0x581dcf;return db[_0x3500('0xc6')][_0x3500('0x57')]({'where':{'service':!![]},'include':[{'model':db[_0x3500('0xd5')],'as':_0x3500('0xd6'),'raw':!![],'include':[{'model':db[_0x3500('0xd7')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x3500('0x13')](function(_0x30aed7){if(_0x30aed7&&_0x30aed7[_0x3500('0xd6')]&&_0x1aba65[_0x3500('0xd8')]&&_0x1aba65[_0x3500('0xd9')]){var _0x400a0b=_0x30aed7[_0x3500('0xda')]();return respondWithRpcPromise('SendMail',_0x3500('0xdb'),{'account':_0x400a0b,'message':{'from':util[_0x3500('0x9e')]('\x22%s\x22\x20<%s>',_0x30aed7[_0x3500('0x2e')],_0x30aed7[_0x3500('0xdc')]||_0x30aed7[_0x3500('0xd6')][_0x3500('0x4e')]),'to':_0x1aba65[_0x3500('0xd9')],'subject':_0x1aba65[_0x3500('0xdd')],'html':_0x2c27e6['body'],'attachments':_0x3d4685}},client9003)[_0x3500('0x13')](function(){return _0x2c27e6;})['catch'](function(_0x470086){logger[_0x3500('0x19')](_0x470086);});}})[_0x3500('0x13')](function(){if(_0x1aba65&&_0x1aba65[_0x3500('0xd1')]&&_0x1aba65[_0x3500('0xde')]){var _0x3190c7=[];if(_0x15bdd5[_0x3500('0x3e')]){_0x3190c7=_0x15bdd5['map'](function(_0x4a187f){return{'name':_0x4a187f[_0x3500('0xdf')],'basename':_0x4a187f[_0x3500('0x65')],'type':_0x4a187f['mimetype'],'ChatOfflineMessageId':_0x581dcf['id']};});}var _0x3af54d;if(!_[_0x3500('0x71')](_0x1aba65[_0x3500('0xe0')])){var _0x53e8cf=_[_0x3500('0x38')](_0x442b47[_0x3500('0x4d')],function(_0x45c467){return _0x45c467;});var _0x511eae=_[_0x3500('0xe1')](_0x53e8cf)[0x0];var _0x11855e=_[_0x3500('0xe2')](_0x511eae,function(_0x4ccedd){return _0x4ccedd;});_0x3af54d=_0x11855e[0x1][_0x1aba65[_0x3500('0xe0')]];}var _0x1ce044={'from':_0x164b35['email'],'firstName':_0x164b35[_0x3500('0x99')],'lastName':_0x164b35[_0x3500('0x9a')],'mapKey':_0x3500('0xdc'),'message':{'from':_0x164b35[_0x3500('0xdc')],'to':_0x1aba65[_0x3500('0xc6')]['email'],'cc':'','subject':_[_0x3500('0x71')](_0x3af54d)?_0x1aba65[_0x3500('0xdd')]:_0x3af54d,'messageId':'','sentAt':new Date(),'attach':_0x3190c7[_0x3500('0x3e')],'attachments':_0x3190c7,'originChannel':_0x3500('0xe3'),'ChatWebsiteId':_0x1aba65['id'],'ChatOfflineMessageId':_0x2c27e6['id'],'originTo':_0x1aba65[_0x3500('0xc6')]['email']},'body':_0x2c27e6[_0x3500('0x4d')]};var _0x1fc144={'account':{'id':_0x1aba65[_0x3500('0xde')]},'body':_0x1ce044,'log':_0x3500('0xe4')};return respondWithRpcPromise(_0x3500('0xe4'),_0x3500('0xe5'),_0x1fc144,client9001)[_0x3500('0x13')](function(){return _0x2c27e6;})[_0x3500('0x1d')](function(_0x107067){logger[_0x3500('0x19')](_0x107067);});}return;})['then'](function(){if(_0x2c27e6){return _0x2c27e6;}})[_0x3500('0x13')](respondWithResult(_0x2f9aee,null))['catch'](function(_0x466240){logger[_0x3500('0x19')](_0x3500('0x1d'),_0x466240);for(var _0x5a73ff of _0x15bdd5){var _0x49eae0=path[_0x3500('0x6b')](config[_0x3500('0x6c')],_0x3500('0xe6'),'files',_0x3500('0xce'),_0x3500('0xcf'),_0x5a73ff[_0x3500('0x65')]);fs_extra[_0x3500('0xe7')](_0x49eae0)['catch'](function(_0x2fd03a){logger[_0x3500('0x19')]('Could\x20not\x20remove\x20attachment\x20file',_0x49eae0,_0x2fd03a);});}});};exports['addInteraction']=function(_0x1ba60c,_0x112c3f){return db[_0x3500('0xa6')][_0x3500('0x4b')]({'where':{'id':_0x1ba60c[_0x3500('0x54')]['id']}})['then'](handleEntityNotFound(_0x112c3f,null))[_0x3500('0x13')](function(_0x2ff6b2){if(_0x2ff6b2){return _0x2ff6b2[_0x3500('0xe8')](_0x1ba60c['body'][_0x3500('0x5c')],_[_0x3500('0xe9')](_0x1ba60c[_0x3500('0x4d')],[_0x3500('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x112c3f,null))[_0x3500('0x1d')](handleError(_0x112c3f,null));};exports[_0x3500('0xea')]=function(_0x5aca91,_0x235a64){var _0x3b3488={'raw':![],'where':{}};var _0x475381={};var _0xe03a89={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3500('0x57')]({'where':{'id':_0x5aca91[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x235a64,null))[_0x3500('0x13')](function(_0x50626d){if(_0x50626d){_0x475381[_0x3500('0x37')]=_['keys'](db[_0x3500('0xa6')][_0x3500('0x33')]);_0x475381['query']=_[_0x3500('0x3a')](_0x5aca91[_0x3500('0x39')]);_0x475381[_0x3500('0x3b')]=_['intersection'](_0x475381[_0x3500('0x37')],_0x475381[_0x3500('0x39')]);_0x3b3488[_0x3500('0x3d')]=_['intersection'](_0x475381[_0x3500('0x37')],qs['fields'](_0x5aca91[_0x3500('0x39')]['fields']));_0x3b3488['attributes']=_0x3b3488[_0x3500('0x3d')][_0x3500('0x3e')]?_0x3b3488[_0x3500('0x3d')]:_0x475381[_0x3500('0x37')];if(!_0x5aca91['query']['hasOwnProperty'](_0x3500('0x40'))){_0x3b3488[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x5aca91['query']['limit']);_0x3b3488['offset']=qs[_0x3500('0x1f')](_0x5aca91['query']['offset']);}_0x3b3488[_0x3500('0x58')]=qs[_0x3500('0x41')](_0x5aca91['query'][_0x3500('0x41')]);_0x3b3488['where']=qs[_0x3500('0x3b')](_[_0x3500('0x42')](_0x5aca91['query'],_0x475381[_0x3500('0x3b')]));_0x3b3488['where'][_0x3500('0x59')]=_0x50626d['id'];if(_0x5aca91[_0x3500('0x39')][_0x3500('0x43')]){_0x3b3488[_0x3500('0x44')]=_[_0x3500('0x46')](_0x3b3488['where'],{'$or':_[_0x3500('0x38')](_0x3b3488[_0x3500('0x3d')],function(_0x1225c5){var _0x523e5a={};_0x523e5a[_0x1225c5]={'$like':'%'+_0x5aca91[_0x3500('0x39')][_0x3500('0x43')]+'%'};return _0x523e5a;})});}_0x3b3488=_['merge']({},_0x3b3488,_0x5aca91['options']);return db['ChatInteraction']['count']({'where':_0x3b3488[_0x3500('0x44')]})[_0x3500('0x13')](function(_0x12d081){_0xe03a89[_0x3500('0x21')]=_0x12d081;if(_0x5aca91[_0x3500('0x39')]['includeAll']){_0x3b3488[_0x3500('0x49')]=[{'model':db[_0x3500('0x8d')],'as':_0x3500('0xeb'),'required':![]},{'model':db['User'],'as':_0x3500('0xec'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x3500('0xed')],'as':_0x3500('0xee'),'attributes':['id',_0x3500('0x2e'),'color'],'where':_0x5aca91[_0x3500('0x39')][_0x3500('0xef')]?{'id':_0x5aca91[_0x3500('0x39')][_0x3500('0xef')]}:undefined,'required':_0x5aca91['query'][_0x3500('0xef')]?!![]:![]}];}return db[_0x3500('0xa6')][_0x3500('0x60')](_0x3b3488);})[_0x3500('0x13')](function(_0x33b083){_0xe03a89[_0x3500('0x5a')]=_0x33b083;return _0xe03a89;});}})[_0x3500('0x13')](respondWithFilteredResult(_0x235a64,_0x3b3488))[_0x3500('0x1d')](handleError(_0x235a64,null));};function iftimePromise(_0x18f2ae,_0x50c6b4){return respondWithRpcPromise(_0x3500('0xf0'),_0x3500('0xf1'),{'command':_0x50c6b4['timezone']?util[_0x3500('0x9e')](_0x3500('0xf2'),_0x18f2ae[_0x3500('0xf3')],_0x50c6b4[_0x3500('0xf4')]):util[_0x3500('0x9e')](_0x3500('0xf5'),_0x18f2ae['interval'])},client9002)[_0x3500('0x13')](function(_0x531a2c){var _0x34f4c7=_0x531a2c&&_0x531a2c[_0x3500('0xf6')]('true')>=0x0?!![]:![];logger[_0x3500('0x14')](_0x3500('0xf7'),_0x50c6b4['id'],_0x18f2ae['id'],_0x18f2ae['interval'],_0x34f4c7?'ONLINE':'OFFLINE',_0x50c6b4[_0x3500('0xf4')]?_0x50c6b4['timezone']:_0x3500('0xf8'));return _0x34f4c7;})[_0x3500('0x1d')](function(_0x3c50cc){logger[_0x3500('0x19')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x50c6b4['id'],_0x18f2ae['id'],_0x18f2ae['interval'],util[_0x3500('0xf9')](_0x3c50cc,{'showHidden':![],'depth':null}),_0x50c6b4[_0x3500('0xf4')]?_0x50c6b4[_0x3500('0xf4')]:'No\x20timezone');return![];});}exports[_0x3500('0xf1')]=function(_0x35ecbe,_0x113fd7){var _0x448314=0x0;var _0x54902e=0x0;var _0x21d36f=![];var _0x225e1a;var _0x3160af;return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x35ecbe['params']['id']},'include':[{'model':db[_0x3500('0xfa')],'as':_0x3500('0xfa'),'include':[{'model':db[_0x3500('0xfa')],'as':_0x3500('0xfb'),'attributes':['id',_0x3500('0xf3')],'raw':!![]}]}]})[_0x3500('0x13')](handleEntityNotFound(_0x113fd7,null))[_0x3500('0x13')](function(_0x2ed2c1){if(_0x2ed2c1){_0x225e1a=_0x2ed2c1;return _0x2ed2c1['getProactiveActions']({'raw':!![]});}})[_0x3500('0x13')](function(_0xcfb77f){if(_0x225e1a){if(_0xcfb77f){_0x3160af=_0xcfb77f;}}return require(_0x3500('0x6e'))[_0x3500('0x6f')]();})[_0x3500('0x13')](function(_0x5ac904){if(_0x5ac904){_0x54902e=_0x5ac904['virtual'];_0x21d36f=_0x5ac904[_0x3500('0x70')];}})['then'](function(){return db[_0x3500('0xa6')]['count']({'where':{'closed':![]}});})[_0x3500('0x13')](function(_0xbb795c){_0x448314=_0xbb795c;if(_0x54902e&&_0xbb795c>_0x54902e){return db[_0x3500('0xfc')][_0x3500('0x57')]({'where':{'id':0x1}})[_0x3500('0x13')](function(_0x7c2e2a){if(_0x7c2e2a){_0x7c2e2a[_0x3500('0xfd')]('chatLicenseExceeded');}});}})[_0x3500('0x13')](function(){if(_0x225e1a['Interval']&&_0x225e1a[_0x3500('0xfa')][_0x3500('0xfb')]){var _0x157791=[];for(var _0x3d6454=0x0;_0x3d6454<_0x225e1a[_0x3500('0xfa')]['Intervals'][_0x3500('0x3e')];_0x3d6454++){var _0x2e20a5=_0x225e1a[_0x3500('0xfa')]['Intervals'][_0x3d6454][_0x3500('0x28')]({'plain':!![]});_0x157791[_0x3500('0xae')](iftimePromise(_0x2e20a5,_0x225e1a));}return BPromise[_0x3500('0xfe')](_0x157791)['then'](function(_0x5d3f4a){return _[_0x3500('0xff')](_0x5d3f4a);});}else{return!![];}})[_0x3500('0x13')](function(_0x3b3e57){var _0x2a9267=fs[_0x3500('0x100')](path[_0x3500('0x6b')](config['root'],_0x3500('0x101')),_0x3500('0xc9'));var _0x416539=new url[(_0x3500('0x102'))](_0x225e1a[_0x3500('0x103')])[_0x3500('0x104')];var _0xbcb2c7=_0x3500('0x105');var _0x1efc29=![];var _0x88a582={'chatVersion':_0xbcb2c7,'chatWebsiteAddressOrigin':_0x416539,'remote':_0x225e1a[_0x3500('0x106')],'query':querystring[_0x3500('0x18')](_['merge'](_0x225e1a['get']({'plain':!![]}),{'customerIp':_0x35ecbe[_0x3500('0x7d')][_0x3500('0x98')]||_0x35ecbe['headers'][_0x3500('0x107')]||_0x35ecbe[_0x3500('0x108')]['remoteAddress']||_0x35ecbe['ip'],'referer':_0x35ecbe['headers']['referer'],'openedInteractions':_0x448314,'maxInteractions':_0x54902e,'virtual':_0x21d36f[_0x3500('0x109')],'online':_0x3b3e57,'custom':_0x21d36f}))[_0x3500('0x10a')](/'/g,'\x5c\x27')};_0x113fd7['send'](ejs[_0x3500('0xca')](Mustache[_0x3500('0xca')](_0x2a9267,_0x88a582),{'proactiveActions':_0x3160af,'alignment':_0x225e1a['alignment'],'verticalAlignment':_0x225e1a[_0x3500('0x10b')],'div_color':_0x225e1a[_0x3500('0x10c')],'labelText':_0x225e1a[_0x3500('0x10d')],'text_color':_0x225e1a[_0x3500('0x10e')],'text_button_color':_0x225e1a[_0x3500('0x10f')],'button_color':_0x225e1a[_0x3500('0x110')],'background_color':_0x225e1a[_0x3500('0x111')],'hideWhenOffline':_0x225e1a[_0x3500('0x112')],'intervalId':_0x225e1a[_0x3500('0x113')],'isDevelopment':_0x1efc29,'chatVersion':_0xbcb2c7}));})[_0x3500('0x1d')](handleError(_0x113fd7,null));};exports[_0x3500('0x114')]=function(_0x2b1b28,_0x342f1d){var _0x3d456b=_0x2b1b28['params']['id'];var _0x38f748=_0x2b1b28[_0x3500('0x4d')];var _0x4e3e78=0xc8;var _0x8fe050=null;return db[_0x3500('0xd2')][_0x3500('0x115')]({'isolationLevel':db['sequelize'][_0x3500('0x116')][_0x3500('0x117')][_0x3500('0x118')]},function(_0x5a06ea){return db[_0x3500('0x32')][_0x3500('0x57')]({'where':{'id':_0x3d456b},'transaction':_0x5a06ea})['then'](function(_0x2fdf56){if(_0x2fdf56){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x3d456b},'transaction':_0x5a06ea})[_0x3500('0x13')](function(){var _0x4c7987=_['map'](_0x38f748,function(_0x2e4d8d){_0x2e4d8d[_0x3500('0x59')]=_0x3d456b;return _0x2e4d8d;});return db[_0x3500('0x119')]['bulkCreate'](_0x4c7987,{'transaction':_0x5a06ea});});}else{_0x4e3e78=0x194;_0x8fe050=[];}});})['then'](function(){if(_0x4e3e78!==0x194){return db[_0x3500('0x119')][_0x3500('0x11a')]({'where':{'ChatWebsiteId':_0x3d456b},'order':_0x3500('0x11b')})['then'](function(_0x4a9f66){_0x8fe050=_0x4a9f66;});}})['catch'](function(_0x48bfc4){_0x4e3e78=0x1f4;logger[_0x3500('0x19')](_0x48bfc4[_0x3500('0x2d')]);if(_0x48bfc4[_0x3500('0x2e')]){delete _0x48bfc4[_0x3500('0x2e')];}_0x8fe050=_0x48bfc4;})['finally'](function(){if(_0x8fe050===null){_0x342f1d[_0x3500('0x2c')](_0x4e3e78);}else{if(_0x4e3e78===0x1f4){_0x342f1d[_0x3500('0x1e')](_0x4e3e78)[_0x3500('0xc1')](_0x8fe050);}else{_0x342f1d['status'](_0x4e3e78)['json'](_0x8fe050);}}});};exports[_0x3500('0x11c')]=function(_0x25c3ef,_0x3d3a01){var _0x53a272={};var _0x10553e={};var _0x1a7a88;var _0x240c45;return db[_0x3500('0x32')][_0x3500('0x57')]({'where':{'id':_0x25c3ef[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x3d3a01,null))[_0x3500('0x13')](function(_0x415d30){if(_0x415d30){_0x1a7a88=_0x415d30;_0x10553e[_0x3500('0x37')]=_['keys'](db[_0x3500('0x119')][_0x3500('0x33')]);_0x10553e[_0x3500('0x39')]=_[_0x3500('0x3a')](_0x25c3ef[_0x3500('0x39')]);_0x10553e[_0x3500('0x3b')]=_[_0x3500('0x3c')](_0x10553e[_0x3500('0x37')],_0x10553e[_0x3500('0x39')]);_0x53a272[_0x3500('0x3d')]=_[_0x3500('0x3c')](_0x10553e[_0x3500('0x37')],qs['fields'](_0x25c3ef[_0x3500('0x39')][_0x3500('0x4a')]));_0x53a272[_0x3500('0x3d')]=_0x53a272['attributes'][_0x3500('0x3e')]?_0x53a272[_0x3500('0x3d')]:_0x10553e[_0x3500('0x37')];_0x53a272['order']=qs[_0x3500('0x41')](_0x25c3ef[_0x3500('0x39')][_0x3500('0x41')]);_0x53a272[_0x3500('0x44')]=qs[_0x3500('0x3b')](_['pick'](_0x25c3ef[_0x3500('0x39')],_0x10553e['filters']));if(_0x25c3ef[_0x3500('0x39')]['filter']){_0x53a272['where']=_[_0x3500('0x46')](_0x53a272['where'],{'$or':_['map'](_0x53a272['attributes'],function(_0x39becc){var _0x54063f={};_0x54063f[_0x39becc]={'$like':'%'+_0x25c3ef[_0x3500('0x39')][_0x3500('0x43')]+'%'};return _0x54063f;})});}_0x53a272=_[_0x3500('0x46')]({},_0x53a272,_0x25c3ef[_0x3500('0x47')]);return _0x1a7a88[_0x3500('0x11c')](_0x53a272);}})[_0x3500('0x13')](function(_0x2f610e){if(_0x2f610e){_0x240c45=_0x2f610e[_0x3500('0x3e')];if(!_0x25c3ef[_0x3500('0x39')]['hasOwnProperty'](_0x3500('0x40'))){_0x53a272[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x25c3ef['query'][_0x3500('0x22')]);_0x53a272[_0x3500('0x1f')]=qs['offset'](_0x25c3ef[_0x3500('0x39')]['offset']);}return _0x1a7a88['getApplications'](_0x53a272);}})['then'](function(_0x58f5df){if(_0x58f5df){return _0x58f5df?{'count':_0x240c45,'rows':_0x58f5df}:null;}})[_0x3500('0x13')](respondWithResult(_0x3d3a01,null))['catch'](handleError(_0x3d3a01,null));};exports[_0x3500('0x11d')]=function(_0xbee178,_0x2121ae){return db['chatProactiveAction']['find']({'where':{'id':_0xbee178[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x2121ae,null))[_0x3500('0x13')](function(_0x205e39){if(_0x205e39){return _0x205e39[_0x3500('0x11d')](_0xbee178[_0x3500('0x4d')]['ids'],_[_0x3500('0xe9')](_0xbee178[_0x3500('0x4d')],[_0x3500('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x2121ae,null))[_0x3500('0x1d')](handleError(_0x2121ae,null));};exports['getProactiveActions']=function(_0x5d509e,_0x12fe4d){var _0x346704={};var _0xad7ed4={};var _0x4f6c88;var _0x4c02dc;return db[_0x3500('0x32')]['findOne']({'where':{'id':_0x5d509e[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x12fe4d,null))['then'](function(_0x81e76b){if(_0x81e76b){_0x4f6c88=_0x81e76b;_0xad7ed4[_0x3500('0x37')]=_[_0x3500('0x3a')](db[_0x3500('0x11e')]['rawAttributes']);_0xad7ed4[_0x3500('0x39')]=_[_0x3500('0x3a')](_0x5d509e[_0x3500('0x39')]);_0xad7ed4['filters']=_[_0x3500('0x3c')](_0xad7ed4[_0x3500('0x37')],_0xad7ed4[_0x3500('0x39')]);_0x346704['attributes']=_['intersection'](_0xad7ed4['model'],qs[_0x3500('0x4a')](_0x5d509e[_0x3500('0x39')][_0x3500('0x4a')]));_0x346704[_0x3500('0x3d')]=_0x346704[_0x3500('0x3d')][_0x3500('0x3e')]?_0x346704[_0x3500('0x3d')]:_0xad7ed4[_0x3500('0x37')];_0x346704[_0x3500('0x58')]=qs['sort'](_0x5d509e['query'][_0x3500('0x41')]);_0x346704[_0x3500('0x44')]=qs[_0x3500('0x3b')](_[_0x3500('0x42')](_0x5d509e[_0x3500('0x39')],_0xad7ed4['filters']));if(_0x5d509e[_0x3500('0x39')][_0x3500('0x43')]){_0x346704[_0x3500('0x44')]=_[_0x3500('0x46')](_0x346704['where'],{'$or':_['map'](_0x346704['attributes'],function(_0x5e7636){var _0xc0201={};_0xc0201[_0x5e7636]={'$like':'%'+_0x5d509e[_0x3500('0x39')][_0x3500('0x43')]+'%'};return _0xc0201;})});}_0x346704=_['merge']({},_0x346704,_0x5d509e[_0x3500('0x47')]);return _0x4f6c88[_0x3500('0x11f')](_0x346704);}})[_0x3500('0x13')](function(_0x34b9e7){if(_0x34b9e7){_0x4c02dc=_0x34b9e7['length'];if(!_0x5d509e[_0x3500('0x39')][_0x3500('0x3f')](_0x3500('0x40'))){_0x346704['limit']=qs[_0x3500('0x22')](_0x5d509e[_0x3500('0x39')][_0x3500('0x22')]);_0x346704[_0x3500('0x1f')]=qs[_0x3500('0x1f')](_0x5d509e['query'][_0x3500('0x1f')]);}return _0x4f6c88[_0x3500('0x11f')](_0x346704);}})[_0x3500('0x13')](function(_0x17348b){if(_0x17348b){return _0x17348b?{'count':_0x4c02dc,'rows':_0x17348b}:null;}})[_0x3500('0x13')](respondWithResult(_0x12fe4d,null))[_0x3500('0x1d')](handleError(_0x12fe4d,null));};exports[_0x3500('0x120')]=function(_0x373016,_0x3fe7df){var _0x510fa5=_0x373016['query'][_0x3500('0x121')]==='false'?_0x3500('0x122'):_0x3500('0x123');return db['ChatWebsite']['find']({'attributes':['id',_0x510fa5],'where':{'id':_0x373016[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x3fe7df,null))[_0x3500('0x13')](function(_0x17f3a4){if(_0x17f3a4){var _0x388e79=_0x17f3a4[_0x510fa5];var _0x11c106=_0x388e79&&_0x388e79['items']?_0x388e79[_0x3500('0x124')]:[];_0x3fe7df[_0x3500('0xc1')]({'fromKey':_['isNil'](_0x388e79[_0x3500('0x125')])?undefined:_0x388e79[_0x3500('0x125')],'count':_0x11c106[_0x3500('0x3e')],'rows':_0x11c106});}})['catch'](handleError(_0x3fe7df,null));};exports[_0x3500('0x126')]=function(_0x9e1c7d,_0xdc6977){var _0x2ea44c={'raw':![],'where':{}};var _0x5b99d5={};var _0x2b28d3={'count':0x0,'rows':[]};return db[_0x3500('0x32')][_0x3500('0x57')]({'where':{'id':_0x9e1c7d[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0xdc6977,null))['then'](function(_0x38738a){if(_0x38738a){_0x5b99d5[_0x3500('0x37')]=_[_0x3500('0x3a')](db[_0x3500('0xcc')]['rawAttributes']);_0x5b99d5[_0x3500('0x39')]=_[_0x3500('0x3a')](_0x9e1c7d[_0x3500('0x39')]);_0x5b99d5[_0x3500('0x3b')]=_[_0x3500('0x3c')](_0x5b99d5['model'],_0x5b99d5[_0x3500('0x39')]);_0x2ea44c[_0x3500('0x3d')]=_[_0x3500('0x3c')](_0x5b99d5[_0x3500('0x37')],qs[_0x3500('0x4a')](_0x9e1c7d[_0x3500('0x39')]['fields']));_0x2ea44c[_0x3500('0x3d')]=_0x2ea44c['attributes'][_0x3500('0x3e')]?_0x2ea44c['attributes']:_0x5b99d5[_0x3500('0x37')];if(!_0x9e1c7d[_0x3500('0x39')]['hasOwnProperty'](_0x3500('0x40'))){_0x2ea44c[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x9e1c7d['query'][_0x3500('0x22')]);_0x2ea44c[_0x3500('0x1f')]=qs['offset'](_0x9e1c7d[_0x3500('0x39')][_0x3500('0x1f')]);}_0x2ea44c[_0x3500('0x58')]=qs[_0x3500('0x41')](_0x9e1c7d[_0x3500('0x39')][_0x3500('0x41')]);_0x2ea44c[_0x3500('0x44')]=qs[_0x3500('0x3b')](_[_0x3500('0x42')](_0x9e1c7d[_0x3500('0x39')],_0x5b99d5[_0x3500('0x3b')]));_0x2ea44c[_0x3500('0x44')]['ChatWebsiteId']=_0x38738a['id'];if(_0x9e1c7d[_0x3500('0x39')][_0x3500('0x43')]){_0x2ea44c[_0x3500('0x44')]=_[_0x3500('0x46')](_0x2ea44c['where'],{'$or':_[_0x3500('0x38')](_0x2ea44c[_0x3500('0x3d')],function(_0x277350){var _0xd727c6={};_0xd727c6[_0x277350]={'$like':'%'+_0x9e1c7d[_0x3500('0x39')][_0x3500('0x43')]+'%'};return _0xd727c6;})});}_0x2ea44c=_['merge']({},_0x2ea44c,_0x9e1c7d[_0x3500('0x47')]);return db['ChatOfflineMessage'][_0x3500('0x21')]({'where':_0x2ea44c[_0x3500('0x44')]})[_0x3500('0x13')](function(_0x365fe1){_0x2b28d3[_0x3500('0x21')]=_0x365fe1;if(_0x9e1c7d['query'][_0x3500('0x48')]){_0x2ea44c[_0x3500('0x49')]=[{'all':!![]}];}else{_0x2ea44c[_0x3500('0x49')]=[{'model':db[_0x3500('0x8d')],'as':'Contact','required':![]},{'model':db[_0x3500('0xd3')],'as':_0x3500('0x127'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x2ea44c);})[_0x3500('0x13')](function(_0x59ebf){_0x2b28d3['rows']=_0x59ebf;return _0x2b28d3;});}})[_0x3500('0x13')](respondWithFilteredResult(_0xdc6977,_0x2ea44c))['catch'](handleError(_0xdc6977,null));};exports['addAgents']=function(_0x109344,_0x2cc5f1){return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x109344['params']['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x2cc5f1,null))[_0x3500('0x13')](function(_0x1390ca){if(_0x1390ca){return _0x1390ca[_0x3500('0x128')](_0x109344['body'][_0x3500('0x5c')],_[_0x3500('0xe9')](_0x109344[_0x3500('0x4d')],[_0x3500('0x5c'),'id'])||{})[_0x3500('0xaa')](function(_0x2b0098){for(var _0x337547=0x0;_0x337547<_0x109344['body'][_0x3500('0x5c')]['length'];_0x337547+=0x1){socket['emit'](_0x3500('0x129'),{'UserId':Number(_0x109344['body'][_0x3500('0x5c')][_0x337547]),'ChatWebsiteId':Number(_0x109344[_0x3500('0x54')]['id'])});}return _0x2b0098;});}})[_0x3500('0x13')](respondWithResult(_0x2cc5f1,null))[_0x3500('0x1d')](handleError(_0x2cc5f1,null));};exports['removeAgents']=function(_0x5efc01,_0x3872e2){return db[_0x3500('0x32')][_0x3500('0x4b')]({'where':{'id':_0x5efc01[_0x3500('0x54')]['id']}})['then'](handleEntityNotFound(_0x3872e2,null))[_0x3500('0x13')](function(_0x5004c0){if(_0x5004c0){return _0x5004c0[_0x3500('0x12a')](_0x5efc01[_0x3500('0x39')][_0x3500('0x5c')])[_0x3500('0x13')](function(){if(_[_0x3500('0x12b')](_0x5efc01[_0x3500('0x39')][_0x3500('0x5c')])){for(var _0x49d893=0x0;_0x49d893<_0x5efc01[_0x3500('0x39')][_0x3500('0x5c')][_0x3500('0x3e')];_0x49d893+=0x1){socket[_0x3500('0x12c')]('userChatWebsite:remove',{'UserId':Number(_0x5efc01[_0x3500('0x39')]['ids'][_0x49d893]),'ChatWebsiteId':Number(_0x5efc01[_0x3500('0x54')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x5efc01[_0x3500('0x39')][_0x3500('0x5c')]),'ChatWebsiteId':Number(_0x5efc01['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3872e2,null))['catch'](handleError(_0x3872e2,null));};exports['getAgents']=function(_0x3b5fa4,_0x372556){var _0x3c29d0={};var _0x46006f={};var _0xd05492;var _0x388f07;return db['ChatWebsite']['findOne']({'where':{'id':_0x3b5fa4[_0x3500('0x54')]['id']}})[_0x3500('0x13')](handleEntityNotFound(_0x372556,null))[_0x3500('0x13')](function(_0x575193){if(_0x575193){_0xd05492=_0x575193;_0x46006f[_0x3500('0x37')]=_['keys'](db[_0x3500('0xb4')]['rawAttributes']);_0x46006f['query']=_[_0x3500('0x3a')](_0x3b5fa4['query']);_0x46006f[_0x3500('0x3b')]=_['intersection'](_0x46006f['model'],_0x46006f[_0x3500('0x39')]);_0x3c29d0[_0x3500('0x3d')]=_['intersection'](_0x46006f[_0x3500('0x37')],qs['fields'](_0x3b5fa4[_0x3500('0x39')][_0x3500('0x4a')]));_0x3c29d0[_0x3500('0x3d')]=_0x3c29d0[_0x3500('0x3d')][_0x3500('0x3e')]?_0x3c29d0[_0x3500('0x3d')]:_0x46006f[_0x3500('0x37')];_0x3c29d0[_0x3500('0x58')]=qs['sort'](_0x3b5fa4[_0x3500('0x39')]['sort']);_0x3c29d0[_0x3500('0x44')]=qs[_0x3500('0x3b')](_[_0x3500('0x42')](_0x3b5fa4[_0x3500('0x39')],_0x46006f[_0x3500('0x3b')]));if(_0x3b5fa4[_0x3500('0x39')][_0x3500('0x43')]){_0x3c29d0['where']=_[_0x3500('0x46')](_0x3c29d0[_0x3500('0x44')],{'$or':_[_0x3500('0x38')](_0x3c29d0['attributes'],function(_0x21b3af){var _0x5d8d3b={};_0x5d8d3b[_0x21b3af]={'$like':'%'+_0x3b5fa4[_0x3500('0x39')][_0x3500('0x43')]+'%'};return _0x5d8d3b;})});}_0x3c29d0=_[_0x3500('0x46')]({},_0x3c29d0,_0x3b5fa4[_0x3500('0x47')]);return _0xd05492[_0x3500('0x12d')](_0x3c29d0);}})[_0x3500('0x13')](function(_0x570a14){if(_0x570a14){_0x388f07=_0x570a14[_0x3500('0x3e')];if(!_0x3b5fa4[_0x3500('0x39')][_0x3500('0x3f')](_0x3500('0x40'))){_0x3c29d0[_0x3500('0x22')]=qs[_0x3500('0x22')](_0x3b5fa4[_0x3500('0x39')][_0x3500('0x22')]);_0x3c29d0[_0x3500('0x1f')]=qs['offset'](_0x3b5fa4[_0x3500('0x39')]['offset']);}return _0xd05492[_0x3500('0x12d')](_0x3c29d0);}})[_0x3500('0x13')](function(_0x44ad69){if(_0x44ad69){return _0x44ad69?{'count':_0x388f07,'rows':_0x44ad69}:null;}})[_0x3500('0x13')](respondWithResult(_0x372556,null))[_0x3500('0x1d')](handleError(_0x372556,null));}; \ No newline at end of file +var _0x23dc=['textColor','textButtonColor','backgroundColor','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','online','false','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachment','Attachments','addAgents','omit','userChatWebsite:save','userChatWebsite:remove','emit','getAgents','bluebird','mustache','ejs','fs-extra','querystring','../../config/logger','../../config/environment','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','html-to-text','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','sendStatus','status','offset','limit','undefined','count','json','update','destroy','get','ChatWebsites','UserProfileResource','end','stack','name','index','Pause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ChatWebsite','rows','show','params','mandatoryDispositionPause','keys','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','includeAll','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','isNil','existsSync','download','server/files/images/avatars/default_avatar.png','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','notify','setUA','getResult','chat','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','ChatApplication','Applications','account','applications','priority','asc','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','format','version','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','Start','startRouting','EventManager','ListId','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','originalname','server','files','offline-chat','basename','openNewInteraction','sequelize','transaction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','fullname','internal','Tag','Tags','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','virtual','custom','License','increment','some','server/files/chat/iframe.ejs','utf8','URL','origin','remote','connection','remoteAddress','replace','alignment','color'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x23dc,0x142));var _0xc23d=function(_0x46f9cb,_0x2cce1){_0x46f9cb=_0x46f9cb-0x0;var _0x2d18cc=_0x23dc[_0x46f9cb];return _0x2d18cc;};'use strict';var BPromise=require(_0xc23d('0x0'));var Mustache=require(_0xc23d('0x1'));var util=require('util');var path=require('path');var ejs=require(_0xc23d('0x2'));var fs=require('fs');var fs_extra=require(_0xc23d('0x3'));var _=require('lodash');var querystring=require(_0xc23d('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xc23d('0x5'))('api');var config=require(_0xc23d('0x6'));var url=require(_0xc23d('0x7'));var db=require(_0xc23d('0x8'))['db'];config[_0xc23d('0x9')]=_[_0xc23d('0xa')](config[_0xc23d('0x9')],{'host':_0xc23d('0xb'),'port':0x18eb});var socket=require(_0xc23d('0xc'))(new Redis(config[_0xc23d('0x9')]));require(_0xc23d('0xd'))[_0xc23d('0xe')](socket);var htmlToText=require(_0xc23d('0xf'));var jayson=require('jayson/promise');var client=jayson[_0xc23d('0x10')][_0xc23d('0x11')]({'port':0x232c});var client9002=jayson[_0xc23d('0x10')][_0xc23d('0x11')]({'port':0x232a});var client9003=jayson[_0xc23d('0x10')][_0xc23d('0x11')]({'port':0x232b});var client9001=jayson[_0xc23d('0x10')][_0xc23d('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x36a716,_0x11dc4f,_0x418925,_0x4183ad){return new BPromise(function(_0x726d11,_0x382e32){var _0x323c1f=_0x4183ad||client;return _0x323c1f[_0xc23d('0x12')](_0x36a716,_0x418925)[_0xc23d('0x13')](function(_0x24883b){logger['info'](_0xc23d('0x14'),_0x11dc4f,_0xc23d('0x15'));logger[_0xc23d('0x16')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x11dc4f,_0xc23d('0x15'),JSON['stringify'](_0x24883b));if(_0x24883b['error']){if(_0x24883b[_0xc23d('0x17')][_0xc23d('0x18')]===0x1f4){logger['error'](_0xc23d('0x14'),_0x11dc4f,_0x24883b[_0xc23d('0x17')]['message']);return _0x382e32(_0x24883b['error'][_0xc23d('0x19')]);}logger[_0xc23d('0x17')](_0xc23d('0x14'),_0x11dc4f,_0x24883b['error'][_0xc23d('0x19')]);return _0x726d11(_0x24883b[_0xc23d('0x17')][_0xc23d('0x19')]);}else{logger[_0xc23d('0x1a')](_0xc23d('0x14'),_0x11dc4f,_0xc23d('0x15'));_0x726d11(_0x24883b[_0xc23d('0x1b')][_0xc23d('0x19')]);}})[_0xc23d('0x1c')](function(_0x4918fd){logger[_0xc23d('0x17')](_0xc23d('0x14'),_0x11dc4f,_0x4918fd);_0x382e32(_0x4918fd);});});}function respondWithStatusCode(_0x1a518b,_0x3b5eaa){_0x3b5eaa=_0x3b5eaa||0xcc;return function(_0xc39f99){if(_0xc39f99){return _0x1a518b[_0xc23d('0x1d')](_0x3b5eaa);}return _0x1a518b[_0xc23d('0x1e')](_0x3b5eaa)['end']();};}function respondWithResult(_0x2263ac,_0x1de25f){_0x1de25f=_0x1de25f||0xc8;return function(_0x171805){if(_0x171805){return _0x2263ac[_0xc23d('0x1e')](_0x1de25f)['json'](_0x171805);}};}function respondWithFilteredResult(_0x33da85,_0x45e097){return function(_0x16e554){if(_0x16e554){var _0x1d8bd7=typeof _0x45e097[_0xc23d('0x1f')]==='undefined'&&typeof _0x45e097[_0xc23d('0x20')]===_0xc23d('0x21');var _0x386665=_0x16e554[_0xc23d('0x22')];var _0xfa86d9=_0x1d8bd7?0x0:_0x45e097[_0xc23d('0x1f')];var _0x2da760=_0x1d8bd7?_0x16e554[_0xc23d('0x22')]:_0x45e097[_0xc23d('0x1f')]+_0x45e097[_0xc23d('0x20')];var _0x41e733;if(_0x2da760>=_0x386665){_0x2da760=_0x386665;_0x41e733=0xc8;}else{_0x41e733=0xce;}_0x33da85[_0xc23d('0x1e')](_0x41e733);return _0x33da85['set']('Content-Range',_0xfa86d9+'-'+_0x2da760+'/'+_0x386665)[_0xc23d('0x23')](_0x16e554);}return null;};}function saveUpdates(_0x2a1a74){return function(_0x121220){if(_0x121220){return _0x121220[_0xc23d('0x24')](_0x2a1a74)[_0xc23d('0x13')](function(_0x2cfeb0){return _0x2cfeb0;});}return null;};}function removeEntity(_0x2c5bc1){return function(_0x8187c1){if(_0x8187c1){return _0x8187c1[_0xc23d('0x25')]()[_0xc23d('0x13')](function(){var _0x4b4f32=_0x8187c1[_0xc23d('0x26')]({'plain':!![]});var _0x22566a=_0xc23d('0x27');return db[_0xc23d('0x28')][_0xc23d('0x25')]({'where':{'type':_0x22566a,'resourceId':_0x4b4f32['id']}})[_0xc23d('0x13')](function(){return _0x8187c1;});})['then'](function(){_0x2c5bc1[_0xc23d('0x1e')](0xcc)[_0xc23d('0x29')]();});}};}function handleEntityNotFound(_0x1b7fa8){return function(_0x2181c8){if(!_0x2181c8){_0x1b7fa8[_0xc23d('0x1d')](0x194);}return _0x2181c8;};}function handleError(_0x53a865,_0x23ea64){_0x23ea64=_0x23ea64||0x1f4;return function(_0x5a7542){logger[_0xc23d('0x17')](_0x5a7542[_0xc23d('0x2a')]);if(_0x5a7542['name']){delete _0x5a7542[_0xc23d('0x2b')];}_0x53a865['status'](_0x23ea64)['send'](_0x5a7542);};}exports[_0xc23d('0x2c')]=function(_0x3844db,_0x387b7c){var _0x4d1e12={'include':[{'model':db[_0xc23d('0x2d')],'as':'mandatoryDispositionPause'}]},_0x6f916c={},_0x3caff4={'count':0x0,'rows':[]};var _0x58a4d0=_[_0xc23d('0x2e')](db['ChatWebsite'][_0xc23d('0x2f')],function(_0x418491){return{'name':_0x418491[_0xc23d('0x30')],'type':_0x418491['type'][_0xc23d('0x31')]};});_0x6f916c[_0xc23d('0x32')]=_[_0xc23d('0x2e')](_0x58a4d0,_0xc23d('0x2b'));_0x6f916c[_0xc23d('0x33')]=_['keys'](_0x3844db['query']);_0x6f916c[_0xc23d('0x34')]=_[_0xc23d('0x35')](_0x6f916c[_0xc23d('0x32')],_0x6f916c[_0xc23d('0x33')]);_0x4d1e12[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0x6f916c[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x3844db[_0xc23d('0x33')]['fields']));_0x4d1e12['attributes']=_0x4d1e12[_0xc23d('0x36')][_0xc23d('0x38')]?_0x4d1e12[_0xc23d('0x36')]:_0x6f916c[_0xc23d('0x32')];if(!_0x3844db[_0xc23d('0x33')][_0xc23d('0x39')](_0xc23d('0x3a'))){_0x4d1e12[_0xc23d('0x20')]=qs[_0xc23d('0x20')](_0x3844db[_0xc23d('0x33')][_0xc23d('0x20')]);_0x4d1e12[_0xc23d('0x1f')]=qs[_0xc23d('0x1f')](_0x3844db[_0xc23d('0x33')][_0xc23d('0x1f')]);}_0x4d1e12[_0xc23d('0x3b')]=qs[_0xc23d('0x3c')](_0x3844db[_0xc23d('0x33')][_0xc23d('0x3c')]);_0x4d1e12[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x3844db[_0xc23d('0x33')],_0x6f916c[_0xc23d('0x34')]),_0x58a4d0);if(_0x3844db[_0xc23d('0x33')][_0xc23d('0x3f')]){_0x4d1e12['where']=_[_0xc23d('0x40')](_0x4d1e12[_0xc23d('0x3d')],{'$or':_[_0xc23d('0x2e')](_0x58a4d0,function(_0x423df8){if(_0x423df8[_0xc23d('0x41')]!==_0xc23d('0x42')){var _0x9be1ca={};_0x9be1ca[_0x423df8[_0xc23d('0x2b')]]={'$like':'%'+_0x3844db[_0xc23d('0x33')][_0xc23d('0x3f')]+'%'};return _0x9be1ca;}})});}_0x4d1e12=_[_0xc23d('0x40')]({},_0x4d1e12,_0x3844db[_0xc23d('0x43')]);var _0x277eb1={'where':_0x4d1e12['where']};return db[_0xc23d('0x44')]['count'](_0x277eb1)[_0xc23d('0x13')](function(_0x4c9727){_0x3caff4[_0xc23d('0x22')]=_0x4c9727;if(_0x3844db[_0xc23d('0x33')]['includeAll']){_0x4d1e12['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x4d1e12);})[_0xc23d('0x13')](function(_0x4d6863){_0x3caff4[_0xc23d('0x45')]=_0x4d6863;return _0x3caff4;})['then'](respondWithFilteredResult(_0x387b7c,_0x4d1e12))[_0xc23d('0x1c')](handleError(_0x387b7c,null));};exports[_0xc23d('0x46')]=function(_0x592b33,_0x34a9d5){var _0x55d699={'raw':![],'where':{'id':_0x592b33[_0xc23d('0x47')]['id']},'include':[{'model':db[_0xc23d('0x2d')],'as':_0xc23d('0x48')}]},_0x3b03a0={};_0x3b03a0['model']=_[_0xc23d('0x49')](db[_0xc23d('0x44')][_0xc23d('0x2f')]);_0x3b03a0[_0xc23d('0x33')]=_[_0xc23d('0x49')](_0x592b33['query']);_0x3b03a0[_0xc23d('0x34')]=_[_0xc23d('0x35')](_0x3b03a0[_0xc23d('0x32')],_0x3b03a0[_0xc23d('0x33')]);_0x55d699[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0x3b03a0[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x592b33['query']['fields']));_0x55d699['attributes']=_0x55d699[_0xc23d('0x36')]['length']?_0x55d699[_0xc23d('0x36')]:_0x3b03a0['model'];if(_0x592b33[_0xc23d('0x33')]['includeAll']){_0x55d699[_0xc23d('0x4a')]=[{'all':!![]}];}_0x55d699=_[_0xc23d('0x40')]({},_0x55d699,_0x592b33[_0xc23d('0x43')]);return db[_0xc23d('0x44')]['find'](_0x55d699)[_0xc23d('0x13')](handleEntityNotFound(_0x34a9d5,null))[_0xc23d('0x13')](respondWithResult(_0x34a9d5,null))[_0xc23d('0x1c')](handleError(_0x34a9d5,null));};exports[_0xc23d('0x4b')]=function(_0x20ad48,_0x5dfccd){return db[_0xc23d('0x44')][_0xc23d('0x4b')](_0x20ad48[_0xc23d('0x4c')],{})['then'](function(_0x4da407){var _0xa2c011=_0x20ad48[_0xc23d('0x4d')]['get']({'plain':!![]});if(!_0xa2c011)throw new Error(_0xc23d('0x4e'));if(_0xa2c011[_0xc23d('0x4f')]===_0xc23d('0x4d')){var _0x205e74=_0x4da407['get']({'plain':!![]});var _0x4fc20f=_0xc23d('0x27');return db[_0xc23d('0x50')][_0xc23d('0x51')]({'where':{'name':_0x4fc20f,'userProfileId':_0xa2c011[_0xc23d('0x52')]},'raw':!![]})['then'](function(_0xf3583d){if(_0xf3583d&&_0xf3583d[_0xc23d('0x53')]===0x0){return db['UserProfileResource'][_0xc23d('0x4b')]({'name':_0x205e74[_0xc23d('0x2b')],'resourceId':_0x205e74['id'],'type':_0xf3583d['name'],'sectionId':_0xf3583d['id']},{})[_0xc23d('0x13')](function(){return _0x4da407;});}else{return _0x4da407;}})[_0xc23d('0x1c')](function(_0x3e2a6f){logger[_0xc23d('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e2a6f);throw _0x3e2a6f;});}return _0x4da407;})['then'](respondWithResult(_0x5dfccd,0xc9))['catch'](handleError(_0x5dfccd,null));};exports['update']=function(_0x5a6214,_0x2ec24e){if(_0x5a6214[_0xc23d('0x4c')]['id']){delete _0x5a6214['body']['id'];}return db['ChatWebsite'][_0xc23d('0x51')]({'where':{'id':_0x5a6214[_0xc23d('0x47')]['id']},'include':[{'model':db[_0xc23d('0x2d')],'as':'mandatoryDispositionPause'}]})[_0xc23d('0x13')](handleEntityNotFound(_0x2ec24e,null))[_0xc23d('0x13')](saveUpdates(_0x5a6214[_0xc23d('0x4c')],null))[_0xc23d('0x13')](respondWithResult(_0x2ec24e,null))['catch'](handleError(_0x2ec24e,null));};exports['destroy']=function(_0x421d91,_0xbe9bb4){return db[_0xc23d('0x44')]['find']({'where':{'id':_0x421d91[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0xbe9bb4,null))[_0xc23d('0x13')](removeEntity(_0xbe9bb4,null))[_0xc23d('0x1c')](handleError(_0xbe9bb4,null));};exports['describe']=function(_0xe4ab47,_0x5cbda9){return db[_0xc23d('0x44')]['describe']()[_0xc23d('0x13')](respondWithResult(_0x5cbda9,null))[_0xc23d('0x1c')](handleError(_0x5cbda9,null));};exports[_0xc23d('0x54')]=function(_0x5013f0,_0x13be0f){if(_0x5013f0[_0xc23d('0x4c')]['id']){delete _0x5013f0[_0xc23d('0x4c')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x5013f0[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x13be0f,null))[_0xc23d('0x13')](function(_0x109ec6){if(_0x109ec6){_0x5013f0[_0xc23d('0x4c')][_0xc23d('0x55')]=_0x109ec6['id'];return db[_0xc23d('0x56')][_0xc23d('0x4b')](_0x5013f0['body']);}})[_0xc23d('0x13')](respondWithResult(_0x13be0f,null))['catch'](handleError(_0x13be0f,null));};exports[_0xc23d('0x57')]=function(_0x423075,_0x1d7950){var _0xbbb594={'raw':![],'where':{}};var _0x4aa85b={};var _0x56aa4a={'count':0x0,'rows':[]};return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x423075[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x1d7950,null))[_0xc23d('0x13')](function(_0x5173ed){if(_0x5173ed){_0x4aa85b['model']=_[_0xc23d('0x49')](db['Disposition'][_0xc23d('0x2f')]);_0x4aa85b[_0xc23d('0x33')]=_['keys'](_0x423075['query']);_0x4aa85b[_0xc23d('0x34')]=_[_0xc23d('0x35')](_0x4aa85b['model'],_0x4aa85b[_0xc23d('0x33')]);_0xbbb594[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0x4aa85b[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x423075['query']['fields']));_0xbbb594['attributes']=_0xbbb594['attributes'][_0xc23d('0x38')]?_0xbbb594[_0xc23d('0x36')]:_0x4aa85b[_0xc23d('0x32')];if(!_0x423075[_0xc23d('0x33')][_0xc23d('0x39')](_0xc23d('0x3a'))){_0xbbb594[_0xc23d('0x20')]=qs[_0xc23d('0x20')](_0x423075[_0xc23d('0x33')][_0xc23d('0x20')]);_0xbbb594[_0xc23d('0x1f')]=qs[_0xc23d('0x1f')](_0x423075[_0xc23d('0x33')][_0xc23d('0x1f')]);}_0xbbb594['order']=qs[_0xc23d('0x3c')](_0x423075[_0xc23d('0x33')]['sort']);_0xbbb594[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x423075[_0xc23d('0x33')],_0x4aa85b['filters']));_0xbbb594[_0xc23d('0x3d')][_0xc23d('0x55')]=_0x5173ed['id'];if(_0x423075[_0xc23d('0x33')]['filter']){_0xbbb594[_0xc23d('0x3d')]=_['merge'](_0xbbb594[_0xc23d('0x3d')],{'$or':_[_0xc23d('0x2e')](_0xbbb594[_0xc23d('0x36')],function(_0x59cb40){var _0x5be6a4={};_0x5be6a4[_0x59cb40]={'$like':'%'+_0x423075[_0xc23d('0x33')][_0xc23d('0x3f')]+'%'};return _0x5be6a4;})});}_0xbbb594=_[_0xc23d('0x40')]({},_0xbbb594,_0x423075[_0xc23d('0x43')]);return db['Disposition'][_0xc23d('0x22')]({'where':_0xbbb594['where']})[_0xc23d('0x13')](function(_0x118d7f){_0x56aa4a[_0xc23d('0x22')]=_0x118d7f;if(_0x423075[_0xc23d('0x33')]['includeAll']){_0xbbb594['include']=[{'all':!![]}];}return db[_0xc23d('0x56')][_0xc23d('0x59')](_0xbbb594);})['then'](function(_0x25ce3f){_0x56aa4a[_0xc23d('0x45')]=_0x25ce3f;return _0x56aa4a;});}})[_0xc23d('0x13')](respondWithFilteredResult(_0x1d7950,_0xbbb594))['catch'](handleError(_0x1d7950,null));};exports[_0xc23d('0x5a')]=function(_0x44e2a0,_0x5704eb){return db['ChatWebsite']['find']({'where':{'id':_0x44e2a0[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x5704eb,null))['then'](function(_0x460e54){if(_0x460e54){return _0x460e54[_0xc23d('0x5a')](_0x44e2a0[_0xc23d('0x33')][_0xc23d('0x5b')]);}})[_0xc23d('0x13')](respondWithStatusCode(_0x5704eb,null))['catch'](handleError(_0x5704eb,null));};exports[_0xc23d('0x5c')]=function(_0x4994db,_0x31932a){if(_0x4994db[_0xc23d('0x4c')]['id']){delete _0x4994db[_0xc23d('0x4c')]['id'];}return db['ChatWebsite'][_0xc23d('0x51')]({'where':{'id':_0x4994db['params']['id']}})['then'](handleEntityNotFound(_0x31932a,null))[_0xc23d('0x13')](function(_0x31452b){if(_0x31452b){_0x4994db[_0xc23d('0x4c')]['ChatWebsiteId']=_0x31452b['id'];return db['CannedAnswer']['create'](_0x4994db['body']);}})[_0xc23d('0x13')](respondWithResult(_0x31932a,null))[_0xc23d('0x1c')](handleError(_0x31932a,null));};exports['getAnswers']=function(_0x870dc5,_0x4bad66){var _0xb32c76={'raw':![],'where':{}};var _0xfda3e7={};var _0x3e6149={'count':0x0,'rows':[]};return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x870dc5[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x4bad66,null))[_0xc23d('0x13')](function(_0x4c40be){if(_0x4c40be){_0xfda3e7[_0xc23d('0x32')]=_['keys'](db['CannedAnswer'][_0xc23d('0x2f')]);_0xfda3e7[_0xc23d('0x33')]=_['keys'](_0x870dc5[_0xc23d('0x33')]);_0xfda3e7['filters']=_[_0xc23d('0x35')](_0xfda3e7['model'],_0xfda3e7[_0xc23d('0x33')]);_0xb32c76[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0xfda3e7[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x870dc5[_0xc23d('0x33')][_0xc23d('0x37')]));_0xb32c76['attributes']=_0xb32c76[_0xc23d('0x36')][_0xc23d('0x38')]?_0xb32c76[_0xc23d('0x36')]:_0xfda3e7[_0xc23d('0x32')];if(!_0x870dc5[_0xc23d('0x33')]['hasOwnProperty']('nolimit')){_0xb32c76[_0xc23d('0x20')]=qs[_0xc23d('0x20')](_0x870dc5[_0xc23d('0x33')][_0xc23d('0x20')]);_0xb32c76[_0xc23d('0x1f')]=qs['offset'](_0x870dc5[_0xc23d('0x33')][_0xc23d('0x1f')]);}_0xb32c76[_0xc23d('0x3b')]=qs[_0xc23d('0x3c')](_0x870dc5['query'][_0xc23d('0x3c')]);_0xb32c76[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x870dc5[_0xc23d('0x33')],_0xfda3e7[_0xc23d('0x34')]));_0xb32c76[_0xc23d('0x3d')][_0xc23d('0x55')]=_0x4c40be['id'];if(_0x870dc5[_0xc23d('0x33')][_0xc23d('0x3f')]){_0xb32c76['where']=_[_0xc23d('0x40')](_0xb32c76[_0xc23d('0x3d')],{'$or':_[_0xc23d('0x2e')](_0xb32c76['attributes'],function(_0xe34fe1){var _0x590016={};_0x590016[_0xe34fe1]={'$like':'%'+_0x870dc5[_0xc23d('0x33')][_0xc23d('0x3f')]+'%'};return _0x590016;})});}_0xb32c76=_[_0xc23d('0x40')]({},_0xb32c76,_0x870dc5[_0xc23d('0x43')]);return db[_0xc23d('0x5d')]['count']({'where':_0xb32c76['where']})[_0xc23d('0x13')](function(_0x5d90dd){_0x3e6149[_0xc23d('0x22')]=_0x5d90dd;if(_0x870dc5[_0xc23d('0x33')][_0xc23d('0x5e')]){_0xb32c76[_0xc23d('0x4a')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xb32c76);})['then'](function(_0x39a88e){_0x3e6149[_0xc23d('0x45')]=_0x39a88e;return _0x3e6149;});}})[_0xc23d('0x13')](respondWithFilteredResult(_0x4bad66,_0xb32c76))[_0xc23d('0x1c')](handleError(_0x4bad66,null));};exports[_0xc23d('0x5f')]=function(_0xc35926,_0x2e8545){return db['ChatWebsite'][_0xc23d('0x51')]({'where':{'id':_0xc35926[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x2e8545,null))[_0xc23d('0x13')](function(_0x3993fe){if(_0x3993fe){return _0x3993fe['removeAnswers'](_0xc35926[_0xc23d('0x33')][_0xc23d('0x5b')]);}})[_0xc23d('0x13')](respondWithStatusCode(_0x2e8545,null))[_0xc23d('0x1c')](handleError(_0x2e8545,null));};exports[_0xc23d('0x60')]=function(_0x675590,_0x86ccb7){_0x675590['body'][_0xc23d('0x61')]=_0x675590[_0xc23d('0x62')][_0xc23d('0x63')];return db[_0xc23d('0x44')]['find']({'where':{'id':_0x675590[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x86ccb7,null))[_0xc23d('0x13')](saveUpdates(_0x675590[_0xc23d('0x4c')],null))['then'](respondWithResult(_0x86ccb7,null))[_0xc23d('0x1c')](handleError(_0x86ccb7,null));};exports[_0xc23d('0x64')]=function(_0x4797da,_0x59fcc0){_0x4797da[_0xc23d('0x4c')][_0xc23d('0x65')]=_0x4797da[_0xc23d('0x62')][_0xc23d('0x63')];return db[_0xc23d('0x44')][_0xc23d('0x51')]({'where':{'id':_0x4797da[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x59fcc0,null))[_0xc23d('0x13')](saveUpdates(_0x4797da[_0xc23d('0x4c')],null))[_0xc23d('0x13')](respondWithResult(_0x59fcc0,null))['catch'](handleError(_0x59fcc0,null));};exports[_0xc23d('0x66')]=function(_0x10e19c,_0x189c7c){_0x10e19c[_0xc23d('0x4c')][_0xc23d('0x67')]=_0x10e19c[_0xc23d('0x62')][_0xc23d('0x63')];return db['ChatWebsite']['find']({'where':{'id':_0x10e19c['params']['id']}})['then'](handleEntityNotFound(_0x189c7c,null))['then'](saveUpdates(_0x10e19c[_0xc23d('0x4c')],null))[_0xc23d('0x13')](respondWithResult(_0x189c7c,null))[_0xc23d('0x1c')](handleError(_0x189c7c,null));};exports['addSystemAvatar']=function(_0x5a0109,_0x60bb16){_0x5a0109[_0xc23d('0x4c')][_0xc23d('0x68')]=_0x5a0109[_0xc23d('0x62')][_0xc23d('0x63')];return db[_0xc23d('0x44')][_0xc23d('0x51')]({'where':{'id':_0x5a0109[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x60bb16,null))[_0xc23d('0x13')](saveUpdates(_0x5a0109[_0xc23d('0x4c')],null))[_0xc23d('0x13')](respondWithResult(_0x60bb16,null))[_0xc23d('0x1c')](handleError(_0x60bb16,null));};exports[_0xc23d('0x69')]=function(_0x21bea5,_0x2b28ab){var _0x1bf9f2=path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0x6c'));var _0x5726a2={'where':{'id':_0x21bea5[_0xc23d('0x47')]['id']},'attributes':['id',_0xc23d('0x61')],'raw':!![]};var _0x9e7b9e=![];return require(_0xc23d('0x6d'))[_0xc23d('0x6e')]()['then'](function(_0x4fde66){if(_0x4fde66){_0x9e7b9e=_0x4fde66['custom'];}})['then'](function(){return db[_0xc23d('0x44')]['find'](_0x5726a2);})[_0xc23d('0x13')](handleEntityNotFound(_0x2b28ab,null))[_0xc23d('0x13')](function(_0x51acbb){if(_0x51acbb){if(!_[_0xc23d('0x6f')](_0x51acbb[_0xc23d('0x61')])){if(fs[_0xc23d('0x70')](path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],'server/files/images/logos/',_0x51acbb[_0xc23d('0x61')]))&&_0x9e7b9e){_0x1bf9f2=path['join'](config[_0xc23d('0x6b')],'server/files/images/logos/',_0x51acbb['sitepic']);}}return _0x2b28ab[_0xc23d('0x71')](_0x1bf9f2);}})['catch'](handleError(_0x2b28ab,null));};exports['getAvatar']=function(_0x5e7dc3,_0x53ee8e){var _0x2800fa=path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0x72'));var _0x33f978={'where':{'id':_0x5e7dc3[_0xc23d('0x47')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc23d('0x44')][_0xc23d('0x51')](_0x33f978)[_0xc23d('0x13')](handleEntityNotFound(_0x53ee8e,null))[_0xc23d('0x13')](function(_0x3080bb){if(_0x3080bb){if(!_[_0xc23d('0x6f')](_0x3080bb[_0xc23d('0x65')])){if(fs['existsSync'](path[_0xc23d('0x6a')](config['root'],'server/files/images/avatars/',_0x3080bb[_0xc23d('0x65')]))){_0x2800fa=path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],'server/files/images/avatars/',_0x3080bb[_0xc23d('0x65')]);}}return _0x53ee8e[_0xc23d('0x71')](_0x2800fa);}})['catch'](handleError(_0x53ee8e,null));};exports[_0xc23d('0x73')]=function(_0x232a4b,_0x5a2140){var _0x5a6d28=path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0x74'));var _0xd3dac7={'where':{'id':_0x232a4b['params']['id']},'attributes':['id',_0xc23d('0x67'),'showCustomerAvatar'],'raw':!![]};return db['ChatWebsite'][_0xc23d('0x51')](_0xd3dac7)['then'](handleEntityNotFound(_0x5a2140,null))['then'](function(_0x5c25bd){if(_0x5c25bd){if(!_[_0xc23d('0x6f')](_0x5c25bd[_0xc23d('0x67')])){if(fs[_0xc23d('0x70')](path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0x75'),_0x5c25bd[_0xc23d('0x67')]))&&_0x5c25bd[_0xc23d('0x76')]){_0x5a6d28=path['join'](config['root'],_0xc23d('0x75'),_0x5c25bd[_0xc23d('0x67')]);}}return _0x5a2140[_0xc23d('0x71')](_0x5a6d28);}})[_0xc23d('0x1c')](handleError(_0x5a2140,null));};exports[_0xc23d('0x77')]=function(_0x420a56,_0x21a3eb){var _0x37ba70=path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],'server/files/images/avatars/system_avatar.png');var _0x8a7fe={'where':{'id':_0x420a56[_0xc23d('0x47')]['id']},'attributes':['id',_0xc23d('0x68')],'raw':!![]};return db['ChatWebsite'][_0xc23d('0x51')](_0x8a7fe)[_0xc23d('0x13')](handleEntityNotFound(_0x21a3eb,null))[_0xc23d('0x13')](function(_0x1e56da){if(_0x1e56da){if(!_[_0xc23d('0x6f')](_0x1e56da[_0xc23d('0x68')])){if(fs[_0xc23d('0x70')](path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0x75'),_0x1e56da['systemAvatar']))){_0x37ba70=path['join'](config['root'],_0xc23d('0x75'),_0x1e56da[_0xc23d('0x68')]);}}return _0x21a3eb[_0xc23d('0x71')](_0x37ba70);}})['catch'](handleError(_0x21a3eb,null));};exports[_0xc23d('0x78')]=function(_0x4012d2,_0x102462){var _0x171fce=require('user-agent-parser');var _0x5395fe=new _0x171fce();var _0x3f8a31=_0x5395fe[_0xc23d('0x79')](_0x4012d2['headers']['user-agent'])[_0xc23d('0x7a')]();var _0x4d68fa={'body':_0x4012d2['body'],'channel':_0xc23d('0x7b')};var _0x215f52=[];var _0x509649=[];var _0x349742={};var _0x2b9658=![];return db[_0xc23d('0x7c')][_0xc23d('0x7d')]()[_0xc23d('0x13')](function(_0x26b791){if(!_0x26b791){throw new db[(_0xc23d('0x7e'))]['ValidationError'](_0xc23d('0x7f'));}_0x215f52=_[_0xc23d('0x80')](_[_0xc23d('0x49')](_0x26b791),['createdAt',_0xc23d('0x81')]);_0x509649=_[_0xc23d('0x80')](_[_0xc23d('0x49')](_0x26b791),[_0xc23d('0x82'),_0xc23d('0x81'),_0xc23d('0x83'),'ListId']);if(_0x4012d2[_0xc23d('0x4c')]['id']){delete _0x4012d2[_0xc23d('0x4c')]['id'];}if(_[_0xc23d('0x6f')](_0x4012d2['body']['from'])){throw new db['Sequelize'][(_0xc23d('0x84'))](_0xc23d('0x85'));}if(_[_0xc23d('0x6f')](_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x4c')])||_0x4012d2[_0xc23d('0x4c')]['body']===''){throw new db['Sequelize']['ValidationError'](_0xc23d('0x86'));}if(_[_0xc23d('0x6f')](_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x87')])){throw new db[(_0xc23d('0x7e'))][(_0xc23d('0x84'))](_0xc23d('0x88')+_0x509649);}if(!_[_0xc23d('0x89')](_0x509649,_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x87')])){throw new db[(_0xc23d('0x7e'))][(_0xc23d('0x84'))](_0xc23d('0x8a')+_0x509649);}_0x349742[_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x87')]]=_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x8b')];})[_0xc23d('0x13')](function(){return db[_0xc23d('0x44')]['find']({'where':{'id':_0x4012d2['params']['id']},'include':[{'model':db[_0xc23d('0x8c')],'as':_0xc23d('0x8d'),'include':[{'model':db[_0xc23d('0x7c')],'as':_0xc23d('0x8e'),'where':_0x349742,'limit':0x1,'order':[[_0xc23d('0x81'),_0xc23d('0x8f')]]}]},{'model':db[_0xc23d('0x90')],'as':_0xc23d('0x91')}]});})['then'](handleEntityNotFound(_0x102462,null))[_0xc23d('0x13')](function(_0x42e867){if(_0x42e867&&_0x42e867[_0xc23d('0x8d')]){_0x4d68fa[_0xc23d('0x92')]=_0x42e867;_0x4d68fa[_0xc23d('0x93')]=_0x42e867[_0xc23d('0x91')];_0x4d68fa['list']=_0x42e867[_0xc23d('0x8d')];_0x4d68fa['applications']=_['orderBy'](_0x4d68fa['applications'],[_0xc23d('0x94')],[_0xc23d('0x95')]);if(_0x4d68fa[_0xc23d('0x92')]['Applications']){delete _0x4d68fa[_0xc23d('0x92')][_0xc23d('0x91')];}if(_0x4d68fa['account'][_0xc23d('0x8d')]&&_0x4d68fa['account']['List'][_0xc23d('0x8e')][_0xc23d('0x38')]){return _0x4d68fa['account'][_0xc23d('0x8d')][_0xc23d('0x8e')][0x0];}var _0x377130=_['defaults'](_0x4012d2['body'],{'firstName':_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x8b')],'ListId':_0x42e867['ListId']});_0x377130[_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x87')]]=_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x8b')];return db[_0xc23d('0x7c')][_0xc23d('0x4b')](_0x377130,{'fields':_0x215f52,'raw':!![]});}})[_0xc23d('0x13')](handleEntityNotFound(_0x102462,null))[_0xc23d('0x13')](function(_0x590d16){_0x4d68fa[_0xc23d('0x96')]=_0x590d16;var _0x2adfcf=_0x4012d2['body'][_0xc23d('0x97')];if(_0x4012d2['headers'][_0xc23d('0x98')]){_0x2adfcf=_0x4012d2[_0xc23d('0x99')][_0xc23d('0x98')];}else if(_0x4012d2[_0xc23d('0x99')][_0xc23d('0x9a')]){_0x2adfcf=_[_0xc23d('0x9b')](_0x4012d2['headers'][_0xc23d('0x9a')]['split'](','));}if(_0x590d16){var _0x44a897={'ContactId':_0x590d16['id'],'ChatWebsiteId':_0x4012d2[_0xc23d('0x47')]['id'],'from':(_0x590d16[_0xc23d('0x9c')]||'')+'\x20'+(_0x590d16[_0xc23d('0x9d')]||''),'customerIp':_0x2adfcf,'customerPort':_0x4012d2[_0xc23d('0x99')]['x-real-port']?_0x4012d2[_0xc23d('0x99')][_0xc23d('0x9e')]:null,'referer':_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x9f')],'browserName':_0x3f8a31[_0xc23d('0xa0')][_0xc23d('0x2b')]&&_0x3f8a31[_0xc23d('0xa0')]['version']?util[_0xc23d('0xa1')]('%s\x20%s',_0x3f8a31[_0xc23d('0xa0')][_0xc23d('0x2b')],_0x3f8a31['browser']['version']):'unknown','browserVersion':_0x3f8a31['browser'][_0xc23d('0xa2')]||'unknown','osName':util[_0xc23d('0xa1')](_0xc23d('0xa3'),_0x3f8a31['os'][_0xc23d('0x2b')],_0x3f8a31['os'][_0xc23d('0xa2')]),'osVersion':_0x3f8a31['os'][_0xc23d('0xa2')],'deviceModel':_0x3f8a31[_0xc23d('0xa4')][_0xc23d('0x32')]&&_0x3f8a31[_0xc23d('0xa4')][_0xc23d('0xa5')]?util['format'](_0xc23d('0xa6'),_0x3f8a31[_0xc23d('0xa4')][_0xc23d('0x32')],_0x3f8a31['device'][_0xc23d('0xa5')],_0x3f8a31[_0xc23d('0xa4')]['type']):null,'deviceVendor':_0x3f8a31['device'][_0xc23d('0xa5')],'deviceType':_0x3f8a31[_0xc23d('0xa4')][_0xc23d('0x41')],'formData':JSON[_0xc23d('0xa7')](_0x4012d2['body'])};var _0x21be84={'ChatWebsiteId':_0x4012d2[_0xc23d('0x47')]['id'],'closed':![]};if(_0x4012d2['body'][_0xc23d('0xa8')]){_0x21be84[_0xc23d('0xa8')]=_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xa8')];return db['ChatInteraction'][_0xc23d('0x51')]({'where':_0x21be84})['then'](function(_0x1627dc){if(_0x1627dc){return[_0x1627dc,![]];}_0x44a897[_0xc23d('0xa8')]=_0x4012d2['body'][_0xc23d('0xa8')];_0x44a897[_0xc23d('0xa9')]=_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xa9')];return db['ChatInteraction'][_0xc23d('0x4b')](_0x44a897)['then'](function(_0x21cfde){return[_0x21cfde,!![]];});});}_0x21be84[_0xc23d('0xaa')]=_0x590d16['id'];if(_0x4012d2['body'][_0xc23d('0xab')]&&_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xab')]['id']){_0x21be84['id']=_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xab')]['id'];return db[_0xc23d('0xac')][_0xc23d('0x51')]({'where':_0x21be84})['then'](function(_0x4a5b91){if(_0x4a5b91){return[_0x4a5b91,![]];}return db[_0xc23d('0xac')][_0xc23d('0x4b')](_0x44a897)[_0xc23d('0x13')](function(_0x4cf10e){return[_0x4cf10e,!![]];});});}return db[_0xc23d('0xac')][_0xc23d('0x4b')](_0x44a897)['then'](function(_0x284348){return[_0x284348,!![]];});}})[_0xc23d('0xad')](function(_0x518d00,_0x416a09){if(_0x518d00){_0x2b9658=_0x416a09;if(!_0x416a09){var _0xf9a0fb={'from':(_0x4d68fa['contact'][_0xc23d('0x9c')]||'')+'\x20'+(_0x4d68fa[_0xc23d('0x96')][_0xc23d('0x9d')]||'')};if(_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xa8')]&&_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xae')]&&_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xa8')]!=_0x4012d2[_0xc23d('0x4c')]['messageId']){_0xf9a0fb[_0xc23d('0xa8')]=_0x4012d2['body'][_0xc23d('0xae')];}return _0x518d00[_0xc23d('0x24')](_0xf9a0fb);}else{return _0x518d00;}}})['then'](function(_0x4140d1){_0x4d68fa[_0xc23d('0xab')]=_0x4140d1['get']({'plain':!![]});_0x4d68fa['interaction'][_0xc23d('0xaf')]=_0x2b9658;if(_0x4d68fa[_0xc23d('0xab')][_0xc23d('0xaf')]){if(_0x4d68fa[_0xc23d('0x92')][_0xc23d('0xb0')]){_0x4d68fa['applications'][_0xc23d('0xb1')]({'id':0x0,'priority':_0x4d68fa[_0xc23d('0x93')][_0xc23d('0x38')]+0x1,'app':_0xc23d('0xb2'),'appdata':_0xc23d('0xb3'),'interval':_0xc23d('0xb4')});}}return db[_0xc23d('0xb5')][_0xc23d('0x4b')]({'body':_0x4012d2[_0xc23d('0x4c')][_0xc23d('0x4c')],'ChatWebsiteId':_0x4012d2[_0xc23d('0x47')]['id'],'ChatInteractionId':_0x4140d1['id'],'direction':'in','ContactId':_0x4d68fa['contact']['id'],'AttachmentId':_0x4012d2[_0xc23d('0x4c')][_0xc23d('0xb6')]});})[_0xc23d('0x13')](function(_0x5df412){_0x4d68fa[_0xc23d('0x19')]=_0x5df412;if(_0x4d68fa[_0xc23d('0xab')][_0xc23d('0xb7')]){return db[_0xc23d('0xb8')][_0xc23d('0x51')]({'attributes':['id',_0xc23d('0x2b')],'where':{'id':_0x4d68fa[_0xc23d('0xab')]['UserId']}})[_0xc23d('0x13')](function(_0x19fe93){if(_0x19fe93){_0x4d68fa[_0xc23d('0x93')][_0xc23d('0xb9')]({'id':0x0,'priority':0x0,'app':_0xc23d('0xba'),'appdata':_0x19fe93[_0xc23d('0x2b')]+','+(_0x4d68fa[_0xc23d('0x92')]['waitForTheAssignedAgent']||0xa),'interval':_0xc23d('0xb4')});_0x4d68fa[_0xc23d('0xbb')]=!![];}return respondWithRpcPromise(_0xc23d('0xbc'),_0xc23d('0xbd'),_0x4d68fa);});}return respondWithRpcPromise(_0xc23d('0xbc'),_0xc23d('0xbd'),_0x4d68fa);})[_0xc23d('0x13')](function(_0x3adc47){respondWithRpcPromise(_0xc23d('0xbe'),'EventManager',{'event':'notify','message':_0x3adc47},client9002);return _0x3adc47;})[_0xc23d('0x13')](respondWithResult(_0x102462,null))[_0xc23d('0x1c')](handleError(_0x102462,null));};exports['offline']=function(_0x20eee8,_0x5553b5){var _0x321dd9,_0x3150a5,_0x4a6eab;var _0x1176f5=[];var _0x1b485f={};var _0x4f25f2=_0x20eee8['files']||[];var _0x3e8411=[];var _0xd662ee;return db[_0xc23d('0x7c')][_0xc23d('0x7d')]()['then'](function(_0x5b2f89){if(!_0x5b2f89){throw new db['Sequelize']['ValidationError'](_0xc23d('0x7f'));}_0x1176f5=_[_0xc23d('0x80')](_[_0xc23d('0x49')](_0x5b2f89),[_0xc23d('0x82'),_0xc23d('0x81'),_0xc23d('0x83'),_0xc23d('0xbf')]);if(_0x20eee8[_0xc23d('0x4c')]['id']){delete _0x20eee8[_0xc23d('0x4c')]['id'];}if(_['isNil'](_0x20eee8[_0xc23d('0x4c')]['from'])){throw _0x5553b5[_0xc23d('0x1e')](0x1f4)[_0xc23d('0xc0')](new db[(_0xc23d('0x7e'))][(_0xc23d('0x84'))](_0xc23d('0x85')));}if(_[_0xc23d('0x6f')](_0x20eee8[_0xc23d('0x4c')]['body'])||_0x20eee8[_0xc23d('0x4c')][_0xc23d('0x4c')]===''){throw _0x5553b5[_0xc23d('0x1e')](0x1f4)['send'](new db[(_0xc23d('0x7e'))][(_0xc23d('0x84'))](_0xc23d('0x86')));}if(_[_0xc23d('0x6f')](_0x20eee8[_0xc23d('0x4c')]['mapKeyOffline'])){throw _0x5553b5[_0xc23d('0x1e')](0x1f4)[_0xc23d('0xc0')](new db[(_0xc23d('0x7e'))][(_0xc23d('0x84'))](_0xc23d('0xc1')+_0x1176f5));}if(!_['includes'](_0x1176f5,_0x20eee8[_0xc23d('0x4c')][_0xc23d('0xc2')])){throw _0x5553b5[_0xc23d('0x1e')](0x1f4)[_0xc23d('0xc0')](new db[(_0xc23d('0x7e'))][(_0xc23d('0x84'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1176f5));}_0x1b485f[_0x20eee8['body'][_0xc23d('0xc2')]]=_0x20eee8[_0xc23d('0x4c')][_0xc23d('0x8b')];})['then'](function(){return db[_0xc23d('0x44')][_0xc23d('0x51')]({'where':{'id':_0x20eee8[_0xc23d('0x47')]['id']},'include':[{'model':db[_0xc23d('0x8c')],'as':_0xc23d('0x8d')},{'model':db['MailAccount'],'as':_0xc23d('0xc3')}]});})[_0xc23d('0x13')](handleEntityNotFound(_0x5553b5,null))[_0xc23d('0x13')](function(_0x312c95){if(_0x312c95&&_0x312c95[_0xc23d('0x8d')]){_0x3150a5=_0x312c95;var _0x59f3e7=_[_0xc23d('0xa')](_0x20eee8[_0xc23d('0x4c')],{'firstName':_0x20eee8[_0xc23d('0x4c')][_0xc23d('0x8b')],'phone':_0x20eee8['body'][_0xc23d('0x8b')],'ListId':_0x312c95[_0xc23d('0xbf')]});_0x59f3e7[_0x20eee8['body'][_0xc23d('0xc2')]]=_0x20eee8['body'][_0xc23d('0x8b')];return db[_0xc23d('0x7c')][_0xc23d('0xc4')]({'where':_0x1b485f,'defaults':_0x59f3e7});}})[_0xc23d('0xad')](function(_0x5cfe23){if(_0x5cfe23){_0x4a6eab=_0x5cfe23;var _0x11c945=fs[_0xc23d('0xc5')](path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0xc6')),'utf8');var _0x2d4a37=ejs[_0xc23d('0xc7')](_0x11c945,{'body':_[_0xc23d('0xc8')](_0x20eee8[_0xc23d('0x4c')]['body']),'bodyTitle':_0x3150a5['offlineMessageBody']});return db[_0xc23d('0xc9')][_0xc23d('0x4b')]({'body':_0x2d4a37,'plainBody':htmlToText['fromString'](_0x2d4a37),'ContactId':_0x5cfe23['id'],'ChatWebsiteId':_0x3150a5['id']});}})[_0xc23d('0x13')](function(_0x47df71){_0xd662ee=_0x47df71;if(_0x4f25f2[_0xc23d('0x38')]){var _0x5c9c58=_0x4f25f2[_0xc23d('0x2e')](function(_0x120fb3){return{'name':_0x120fb3[_0xc23d('0xca')],'basename':_0x120fb3[_0xc23d('0x63')],'type':_0x120fb3['mimetype'],'ChatOfflineMessageId':_0x47df71['id']};});_0x3e8411=_0x5c9c58[_0xc23d('0x2e')](_0x30f405=>{var _0x10bc71={'filename':_0x30f405[_0xc23d('0x2b')],'path':path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0xcb'),_0xc23d('0xcc'),'attachments',_0xc23d('0xcd'),_0x30f405[_0xc23d('0xce')])};return _0x10bc71;});if(!_0x3150a5[_0xc23d('0xcf')]){return db[_0xc23d('0xd0')][_0xc23d('0xd1')](function(_0x5ba13a){return db['Attachment'][_0xc23d('0xd2')](_0x5c9c58,{'transaction':_0x5ba13a});});}}})[_0xc23d('0x13')](function(){if(_0xd662ee){_0x321dd9=_0xd662ee;return db[_0xc23d('0xc3')][_0xc23d('0x58')]({'where':{'service':!![]},'include':[{'model':db[_0xc23d('0xd3')],'as':_0xc23d('0xd4'),'raw':!![],'include':[{'model':db[_0xc23d('0xd5')],'as':_0xc23d('0xd5'),'raw':!![]}]}]});}})[_0xc23d('0x13')](function(_0x2b0de0){if(_0x2b0de0&&_0x2b0de0['Smtp']&&_0x3150a5['forwardOffline']&&_0x3150a5[_0xc23d('0xd6')]){var _0x457c13=_0x2b0de0[_0xc23d('0xd7')]();return respondWithRpcPromise('SendMail',_0xc23d('0xd8'),{'account':_0x457c13,'message':{'from':util[_0xc23d('0xa1')](_0xc23d('0xd9'),_0x2b0de0['name'],_0x2b0de0[_0xc23d('0xda')]||_0x2b0de0['Smtp'][_0xc23d('0x4d')]),'to':_0x3150a5[_0xc23d('0xd6')],'subject':_0x3150a5[_0xc23d('0xdb')],'html':_0x321dd9[_0xc23d('0x4c')],'attachments':_0x3e8411}},client9003)[_0xc23d('0x13')](function(){return _0x321dd9;})[_0xc23d('0x1c')](function(_0x31a2d6){logger['error'](_0x31a2d6);});}})[_0xc23d('0x13')](function(){if(_0x3150a5&&_0x3150a5['openNewInteraction']&&_0x3150a5[_0xc23d('0xdc')]){var _0x246a89=[];if(_0x4f25f2['length']){_0x246a89=_0x4f25f2['map'](function(_0x1c097f){return{'name':_0x1c097f['originalname'],'basename':_0x1c097f[_0xc23d('0x63')],'type':_0x1c097f[_0xc23d('0xdd')],'ChatOfflineMessageId':_0xd662ee['id']};});}var _0x37ff40;if(!_[_0xc23d('0x6f')](_0x3150a5[_0xc23d('0xde')])){var _0x12cfa9=_['map'](_0x20eee8[_0xc23d('0x4c')],function(_0x43a23b){return _0x43a23b;});var _0x454bcc=_[_0xc23d('0xdf')](_0x12cfa9)[0x0];var _0x2d6aed=_['mapValues'](_0x454bcc,function(_0xe6dca3){return _0xe6dca3;});_0x37ff40=_0x2d6aed[0x1][_0x3150a5['subjectOffline']];}var _0x5de2f5={'from':_0x4a6eab[_0xc23d('0xda')],'firstName':_0x4a6eab[_0xc23d('0x9c')],'lastName':_0x4a6eab[_0xc23d('0x9d')],'mapKey':'email','message':{'from':_0x4a6eab[_0xc23d('0xda')],'to':_0x3150a5['MailAccount'][_0xc23d('0xda')],'cc':'','subject':_[_0xc23d('0x6f')](_0x37ff40)?_0x3150a5[_0xc23d('0xdb')]:_0x37ff40,'messageId':'','sentAt':new Date(),'attach':_0x246a89[_0xc23d('0x38')],'attachments':_0x246a89,'originChannel':_0xc23d('0xe0'),'ChatWebsiteId':_0x3150a5['id'],'ChatOfflineMessageId':_0x321dd9['id'],'originTo':_0x3150a5[_0xc23d('0xc3')][_0xc23d('0xda')]},'body':_0x321dd9[_0xc23d('0x4c')]};var _0x28eb1a={'account':{'id':_0x3150a5[_0xc23d('0xdc')]},'body':_0x5de2f5,'log':_0xc23d('0xe1')};return respondWithRpcPromise(_0xc23d('0xe1'),_0xc23d('0xe2'),_0x28eb1a,client9001)[_0xc23d('0x13')](function(){return _0x321dd9;})[_0xc23d('0x1c')](function(_0x20e27c){logger['error'](_0x20e27c);});}return;})['then'](function(){if(_0x321dd9){return _0x321dd9;}})['then'](respondWithResult(_0x5553b5,null))[_0xc23d('0x1c')](function(_0x2965c3){logger[_0xc23d('0x17')](_0xc23d('0x1c'),_0x2965c3);for(var _0x1e114e of _0x4f25f2){var _0x3b0ad6=path['join'](config[_0xc23d('0x6b')],_0xc23d('0xcb'),_0xc23d('0xcc'),_0xc23d('0xe3'),_0xc23d('0xcd'),_0x1e114e[_0xc23d('0x63')]);fs_extra[_0xc23d('0xe4')](_0x3b0ad6)[_0xc23d('0x1c')](function(_0x5e1d55){logger[_0xc23d('0x17')](_0xc23d('0xe5'),_0x3b0ad6,_0x5e1d55);});}});};exports[_0xc23d('0xe6')]=function(_0x2d4ca9,_0x5a307a){return db[_0xc23d('0xac')][_0xc23d('0x51')]({'where':{'id':_0x2d4ca9[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x5a307a,null))['then'](function(_0x26e7e6){if(_0x26e7e6){return _0x26e7e6['addInteraction'](_0x2d4ca9['body'][_0xc23d('0x5b')],_['omit'](_0x2d4ca9['body'],[_0xc23d('0x5b'),'id'])||{});}})[_0xc23d('0x13')](respondWithResult(_0x5a307a,null))['catch'](handleError(_0x5a307a,null));};exports['getInteractions']=function(_0x1f3a43,_0x5edfa3){var _0x5a5364={'raw':![],'where':{}};var _0x5a1821={};var _0x5906c6={'count':0x0,'rows':[]};return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x1f3a43[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x5edfa3,null))[_0xc23d('0x13')](function(_0x26a030){if(_0x26a030){_0x5a1821[_0xc23d('0x32')]=_[_0xc23d('0x49')](db['ChatInteraction'][_0xc23d('0x2f')]);_0x5a1821['query']=_[_0xc23d('0x49')](_0x1f3a43[_0xc23d('0x33')]);_0x5a1821[_0xc23d('0x34')]=_[_0xc23d('0x35')](_0x5a1821['model'],_0x5a1821[_0xc23d('0x33')]);_0x5a5364['attributes']=_[_0xc23d('0x35')](_0x5a1821[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x1f3a43['query'][_0xc23d('0x37')]));_0x5a5364[_0xc23d('0x36')]=_0x5a5364[_0xc23d('0x36')][_0xc23d('0x38')]?_0x5a5364['attributes']:_0x5a1821[_0xc23d('0x32')];if(!_0x1f3a43[_0xc23d('0x33')][_0xc23d('0x39')](_0xc23d('0x3a'))){_0x5a5364[_0xc23d('0x20')]=qs[_0xc23d('0x20')](_0x1f3a43[_0xc23d('0x33')][_0xc23d('0x20')]);_0x5a5364[_0xc23d('0x1f')]=qs[_0xc23d('0x1f')](_0x1f3a43['query'][_0xc23d('0x1f')]);}_0x5a5364[_0xc23d('0x3b')]=qs['sort'](_0x1f3a43['query']['sort']);_0x5a5364[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x1f3a43['query'],_0x5a1821['filters']));_0x5a5364[_0xc23d('0x3d')][_0xc23d('0x55')]=_0x26a030['id'];if(_0x1f3a43['query'][_0xc23d('0x3f')]){_0x5a5364['where']=_['merge'](_0x5a5364[_0xc23d('0x3d')],{'$or':_[_0xc23d('0x2e')](_0x5a5364[_0xc23d('0x36')],function(_0x24c2f8){var _0x2c6447={};_0x2c6447[_0x24c2f8]={'$like':'%'+_0x1f3a43[_0xc23d('0x33')]['filter']+'%'};return _0x2c6447;})});}_0x5a5364=_[_0xc23d('0x40')]({},_0x5a5364,_0x1f3a43['options']);return db[_0xc23d('0xac')][_0xc23d('0x22')]({'where':_0x5a5364['where']})[_0xc23d('0x13')](function(_0x480d0e){_0x5906c6[_0xc23d('0x22')]=_0x480d0e;if(_0x1f3a43['query'][_0xc23d('0x5e')]){_0x5a5364[_0xc23d('0x4a')]=[{'model':db[_0xc23d('0x7c')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xc23d('0xe7'),_0xc23d('0xe8')],'required':![]},{'model':db[_0xc23d('0xe9')],'as':_0xc23d('0xea'),'attributes':['id',_0xc23d('0x2b'),'color'],'where':_0x1f3a43[_0xc23d('0x33')][_0xc23d('0xeb')]?{'id':_0x1f3a43[_0xc23d('0x33')][_0xc23d('0xeb')]}:undefined,'required':_0x1f3a43['query'][_0xc23d('0xeb')]?!![]:![]}];}return db[_0xc23d('0xac')]['findAll'](_0x5a5364);})[_0xc23d('0x13')](function(_0x3f851b){_0x5906c6[_0xc23d('0x45')]=_0x3f851b;return _0x5906c6;});}})[_0xc23d('0x13')](respondWithFilteredResult(_0x5edfa3,_0x5a5364))['catch'](handleError(_0x5edfa3,null));};function iftimePromise(_0xc5dc81,_0x2b0b59){return respondWithRpcPromise(_0xc23d('0xec'),_0xc23d('0xed'),{'command':_0x2b0b59[_0xc23d('0xee')]?util[_0xc23d('0xa1')](_0xc23d('0xef'),_0xc5dc81[_0xc23d('0xf0')],_0x2b0b59['timezone']):util[_0xc23d('0xa1')](_0xc23d('0xf1'),_0xc5dc81['interval'])},client9002)[_0xc23d('0x13')](function(_0x43b452){var _0x2cbf99=_0x43b452&&_0x43b452['indexOf'](_0xc23d('0xf2'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2b0b59['id'],_0xc5dc81['id'],_0xc5dc81['interval'],_0x2cbf99?_0xc23d('0xf3'):_0xc23d('0xf4'),_0x2b0b59['timezone']?_0x2b0b59[_0xc23d('0xee')]:_0xc23d('0xf5'));return _0x2cbf99;})[_0xc23d('0x1c')](function(_0x319388){logger[_0xc23d('0x17')](_0xc23d('0xf6'),_0x2b0b59['id'],_0xc5dc81['id'],_0xc5dc81['interval'],util[_0xc23d('0xf7')](_0x319388,{'showHidden':![],'depth':null}),_0x2b0b59[_0xc23d('0xee')]?_0x2b0b59[_0xc23d('0xee')]:_0xc23d('0xf5'));return![];});}exports[_0xc23d('0xed')]=function(_0x5bc9eb,_0x24c965){var _0x363aff=0x0;var _0x4d6060=0x0;var _0x5893ad=![];var _0x222c38;var _0x3ab42f;return db[_0xc23d('0x44')]['find']({'where':{'id':_0x5bc9eb['params']['id']},'include':[{'model':db[_0xc23d('0xf8')],'as':_0xc23d('0xf8'),'include':[{'model':db[_0xc23d('0xf8')],'as':_0xc23d('0xf9'),'attributes':['id',_0xc23d('0xf0')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x24c965,null))['then'](function(_0x30ff89){if(_0x30ff89){_0x222c38=_0x30ff89;return _0x30ff89[_0xc23d('0xfa')]({'raw':!![]});}})[_0xc23d('0x13')](function(_0x53aa58){if(_0x222c38){if(_0x53aa58){_0x3ab42f=_0x53aa58;}}return require(_0xc23d('0x6d'))[_0xc23d('0x6e')]();})[_0xc23d('0x13')](function(_0x36b33b){if(_0x36b33b){_0x4d6060=_0x36b33b[_0xc23d('0xfb')];_0x5893ad=_0x36b33b[_0xc23d('0xfc')];}})['then'](function(){return db[_0xc23d('0xac')]['count']({'where':{'closed':![]}});})[_0xc23d('0x13')](function(_0x37943c){_0x363aff=_0x37943c;if(_0x4d6060&&_0x37943c>_0x4d6060){return db[_0xc23d('0xfd')]['findOne']({'where':{'id':0x1}})['then'](function(_0x2073ab){if(_0x2073ab){_0x2073ab[_0xc23d('0xfe')]('chatLicenseExceeded');}});}})[_0xc23d('0x13')](function(){if(_0x222c38[_0xc23d('0xf8')]&&_0x222c38['Interval'][_0xc23d('0xf9')]){var _0x4e1bb7=[];for(var _0x4b1785=0x0;_0x4b1785<_0x222c38[_0xc23d('0xf8')][_0xc23d('0xf9')][_0xc23d('0x38')];_0x4b1785++){var _0x38e6a4=_0x222c38[_0xc23d('0xf8')][_0xc23d('0xf9')][_0x4b1785]['get']({'plain':!![]});_0x4e1bb7[_0xc23d('0xb1')](iftimePromise(_0x38e6a4,_0x222c38));}return BPromise['all'](_0x4e1bb7)[_0xc23d('0x13')](function(_0x5addf3){return _[_0xc23d('0xff')](_0x5addf3);});}else{return!![];}})[_0xc23d('0x13')](function(_0x568596){var _0x1263a1=fs['readFileSync'](path[_0xc23d('0x6a')](config[_0xc23d('0x6b')],_0xc23d('0x100')),_0xc23d('0x101'));var _0x50c39b=new url[(_0xc23d('0x102'))](_0x222c38['address'])[_0xc23d('0x103')];var _0x1d3baa='3.1.0';var _0x478216=![];var _0x2a7cea={'chatVersion':_0x1d3baa,'chatWebsiteAddressOrigin':_0x50c39b,'remote':_0x222c38[_0xc23d('0x104')],'query':querystring[_0xc23d('0xa7')](_['merge'](_0x222c38[_0xc23d('0x26')]({'plain':!![]}),{'customerIp':_0x5bc9eb[_0xc23d('0x99')]['x-forwarded-for']||_0x5bc9eb[_0xc23d('0x99')]['x-real-ip']||_0x5bc9eb[_0xc23d('0x105')][_0xc23d('0x106')]||_0x5bc9eb['ip'],'referer':_0x5bc9eb[_0xc23d('0x99')][_0xc23d('0x9f')],'openedInteractions':_0x363aff,'maxInteractions':_0x4d6060,'virtual':_0x5893ad[_0xc23d('0xfb')],'online':_0x568596,'custom':_0x5893ad}))[_0xc23d('0x107')](/'/g,'\x5c\x27')};_0x24c965[_0xc23d('0xc0')](ejs[_0xc23d('0xc7')](Mustache[_0xc23d('0xc7')](_0x1263a1,_0x2a7cea),{'proactiveActions':_0x3ab42f,'alignment':_0x222c38[_0xc23d('0x108')],'verticalAlignment':_0x222c38['verticalAlignment'],'div_color':_0x222c38[_0xc23d('0x109')],'labelText':_0x222c38['labelText'],'text_color':_0x222c38[_0xc23d('0x10a')],'text_button_color':_0x222c38[_0xc23d('0x10b')],'button_color':_0x222c38['color_button'],'background_color':_0x222c38[_0xc23d('0x10c')],'hideWhenOffline':_0x222c38['hideWhenOffline'],'intervalId':_0x222c38['IntervalId'],'isDevelopment':_0x478216,'chatVersion':_0x1d3baa}));})[_0xc23d('0x1c')](handleError(_0x24c965,null));};exports[_0xc23d('0x10d')]=function(_0x52936f,_0xd45010){var _0x85c20c=_0x52936f[_0xc23d('0x47')]['id'];var _0x7b722e=_0x52936f[_0xc23d('0x4c')];var _0x249c41=0xc8;var _0x1b21f0=null;return db[_0xc23d('0xd0')][_0xc23d('0xd1')]({'isolationLevel':db['sequelize'][_0xc23d('0x10e')][_0xc23d('0x10f')][_0xc23d('0x110')]},function(_0x4bc467){return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x85c20c},'transaction':_0x4bc467})[_0xc23d('0x13')](function(_0x189880){if(_0x189880){return db[_0xc23d('0x90')][_0xc23d('0x25')]({'where':{'ChatWebsiteId':_0x85c20c},'transaction':_0x4bc467})[_0xc23d('0x13')](function(){var _0x317f28=_['map'](_0x7b722e,function(_0x34ce01){_0x34ce01[_0xc23d('0x55')]=_0x85c20c;return _0x34ce01;});return db[_0xc23d('0x90')]['bulkCreate'](_0x317f28,{'transaction':_0x4bc467});});}else{_0x249c41=0x194;_0x1b21f0=[];}});})['then'](function(){if(_0x249c41!==0x194){return db[_0xc23d('0x90')][_0xc23d('0x111')]({'where':{'ChatWebsiteId':_0x85c20c},'order':_0xc23d('0x94')})[_0xc23d('0x13')](function(_0x29f01b){_0x1b21f0=_0x29f01b;});}})[_0xc23d('0x1c')](function(_0x45c462){_0x249c41=0x1f4;logger[_0xc23d('0x17')](_0x45c462['stack']);if(_0x45c462['name']){delete _0x45c462[_0xc23d('0x2b')];}_0x1b21f0=_0x45c462;})[_0xc23d('0x112')](function(){if(_0x1b21f0===null){_0xd45010[_0xc23d('0x1d')](_0x249c41);}else{if(_0x249c41===0x1f4){_0xd45010[_0xc23d('0x1e')](_0x249c41)[_0xc23d('0xc0')](_0x1b21f0);}else{_0xd45010[_0xc23d('0x1e')](_0x249c41)['json'](_0x1b21f0);}}});};exports[_0xc23d('0x113')]=function(_0x46eeae,_0x242c52){var _0x4d77cf={};var _0x32f502={};var _0x164aa6;var _0x594577;return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x46eeae[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x242c52,null))[_0xc23d('0x13')](function(_0x48ca20){if(_0x48ca20){_0x164aa6=_0x48ca20;_0x32f502[_0xc23d('0x32')]=_[_0xc23d('0x49')](db[_0xc23d('0x90')][_0xc23d('0x2f')]);_0x32f502['query']=_[_0xc23d('0x49')](_0x46eeae[_0xc23d('0x33')]);_0x32f502['filters']=_[_0xc23d('0x35')](_0x32f502[_0xc23d('0x32')],_0x32f502[_0xc23d('0x33')]);_0x4d77cf[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0x32f502['model'],qs[_0xc23d('0x37')](_0x46eeae[_0xc23d('0x33')][_0xc23d('0x37')]));_0x4d77cf[_0xc23d('0x36')]=_0x4d77cf['attributes'][_0xc23d('0x38')]?_0x4d77cf['attributes']:_0x32f502['model'];_0x4d77cf['order']=qs['sort'](_0x46eeae[_0xc23d('0x33')][_0xc23d('0x3c')]);_0x4d77cf[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x46eeae[_0xc23d('0x33')],_0x32f502[_0xc23d('0x34')]));if(_0x46eeae[_0xc23d('0x33')][_0xc23d('0x3f')]){_0x4d77cf['where']=_[_0xc23d('0x40')](_0x4d77cf[_0xc23d('0x3d')],{'$or':_['map'](_0x4d77cf[_0xc23d('0x36')],function(_0x5ad6b9){var _0x690689={};_0x690689[_0x5ad6b9]={'$like':'%'+_0x46eeae[_0xc23d('0x33')][_0xc23d('0x3f')]+'%'};return _0x690689;})});}_0x4d77cf=_[_0xc23d('0x40')]({},_0x4d77cf,_0x46eeae[_0xc23d('0x43')]);return _0x164aa6[_0xc23d('0x113')](_0x4d77cf);}})[_0xc23d('0x13')](function(_0x163f5a){if(_0x163f5a){_0x594577=_0x163f5a['length'];if(!_0x46eeae[_0xc23d('0x33')][_0xc23d('0x39')](_0xc23d('0x3a'))){_0x4d77cf['limit']=qs[_0xc23d('0x20')](_0x46eeae[_0xc23d('0x33')][_0xc23d('0x20')]);_0x4d77cf[_0xc23d('0x1f')]=qs[_0xc23d('0x1f')](_0x46eeae['query']['offset']);}return _0x164aa6['getApplications'](_0x4d77cf);}})['then'](function(_0x39cafb){if(_0x39cafb){return _0x39cafb?{'count':_0x594577,'rows':_0x39cafb}:null;}})['then'](respondWithResult(_0x242c52,null))[_0xc23d('0x1c')](handleError(_0x242c52,null));};exports[_0xc23d('0x114')]=function(_0x1b48a6,_0x5c59b8){return db['chatProactiveAction']['find']({'where':{'id':_0x1b48a6['params']['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x5c59b8,null))['then'](function(_0xf906fb){if(_0xf906fb){return _0xf906fb[_0xc23d('0x114')](_0x1b48a6[_0xc23d('0x4c')][_0xc23d('0x5b')],_['omit'](_0x1b48a6[_0xc23d('0x4c')],[_0xc23d('0x5b'),'id'])||{});}})[_0xc23d('0x13')](respondWithResult(_0x5c59b8,null))[_0xc23d('0x1c')](handleError(_0x5c59b8,null));};exports[_0xc23d('0xfa')]=function(_0x1d6766,_0x562312){var _0x18fc69={};var _0x9d93b5={};var _0x4da349;var _0x1da687;return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x1d6766['params']['id']}})['then'](handleEntityNotFound(_0x562312,null))[_0xc23d('0x13')](function(_0x24f80b){if(_0x24f80b){_0x4da349=_0x24f80b;_0x9d93b5[_0xc23d('0x32')]=_[_0xc23d('0x49')](db[_0xc23d('0x115')][_0xc23d('0x2f')]);_0x9d93b5[_0xc23d('0x33')]=_[_0xc23d('0x49')](_0x1d6766[_0xc23d('0x33')]);_0x9d93b5[_0xc23d('0x34')]=_[_0xc23d('0x35')](_0x9d93b5[_0xc23d('0x32')],_0x9d93b5['query']);_0x18fc69[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0x9d93b5[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x1d6766['query'][_0xc23d('0x37')]));_0x18fc69[_0xc23d('0x36')]=_0x18fc69['attributes'][_0xc23d('0x38')]?_0x18fc69[_0xc23d('0x36')]:_0x9d93b5[_0xc23d('0x32')];_0x18fc69[_0xc23d('0x3b')]=qs[_0xc23d('0x3c')](_0x1d6766[_0xc23d('0x33')][_0xc23d('0x3c')]);_0x18fc69[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x1d6766[_0xc23d('0x33')],_0x9d93b5[_0xc23d('0x34')]));if(_0x1d6766[_0xc23d('0x33')][_0xc23d('0x3f')]){_0x18fc69['where']=_[_0xc23d('0x40')](_0x18fc69['where'],{'$or':_['map'](_0x18fc69['attributes'],function(_0x3b7dcf){var _0x2f3fe8={};_0x2f3fe8[_0x3b7dcf]={'$like':'%'+_0x1d6766['query'][_0xc23d('0x3f')]+'%'};return _0x2f3fe8;})});}_0x18fc69=_[_0xc23d('0x40')]({},_0x18fc69,_0x1d6766[_0xc23d('0x43')]);return _0x4da349[_0xc23d('0xfa')](_0x18fc69);}})[_0xc23d('0x13')](function(_0x1fcd1e){if(_0x1fcd1e){_0x1da687=_0x1fcd1e[_0xc23d('0x38')];if(!_0x1d6766['query'][_0xc23d('0x39')](_0xc23d('0x3a'))){_0x18fc69[_0xc23d('0x20')]=qs['limit'](_0x1d6766[_0xc23d('0x33')][_0xc23d('0x20')]);_0x18fc69[_0xc23d('0x1f')]=qs['offset'](_0x1d6766[_0xc23d('0x33')][_0xc23d('0x1f')]);}return _0x4da349['getProactiveActions'](_0x18fc69);}})[_0xc23d('0x13')](function(_0x36c511){if(_0x36c511){return _0x36c511?{'count':_0x1da687,'rows':_0x36c511}:null;}})[_0xc23d('0x13')](respondWithResult(_0x562312,null))['catch'](handleError(_0x562312,null));};exports[_0xc23d('0x116')]=function(_0x4b7f47,_0x143350){var _0xd006a4=_0x4b7f47[_0xc23d('0x33')][_0xc23d('0x117')]===_0xc23d('0x118')?'offlineForm':_0xc23d('0x119');return db[_0xc23d('0x44')][_0xc23d('0x51')]({'attributes':['id',_0xd006a4],'where':{'id':_0x4b7f47[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x143350,null))['then'](function(_0x578075){if(_0x578075){var _0x556eaf=_0x578075[_0xd006a4];var _0x340151=_0x556eaf&&_0x556eaf[_0xc23d('0x11a')]?_0x556eaf[_0xc23d('0x11a')]:[];_0x143350['send']({'fromKey':_[_0xc23d('0x6f')](_0x556eaf[_0xc23d('0x11b')])?undefined:_0x556eaf[_0xc23d('0x11b')],'count':_0x340151[_0xc23d('0x38')],'rows':_0x340151});}})[_0xc23d('0x1c')](handleError(_0x143350,null));};exports[_0xc23d('0x11c')]=function(_0x55f6ee,_0x29d6e2){var _0x152336={'raw':![],'where':{}};var _0xc26bf8={};var _0x4e2430={'count':0x0,'rows':[]};return db[_0xc23d('0x44')][_0xc23d('0x58')]({'where':{'id':_0x55f6ee['params']['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x29d6e2,null))['then'](function(_0x5f1827){if(_0x5f1827){_0xc26bf8[_0xc23d('0x32')]=_['keys'](db[_0xc23d('0xc9')][_0xc23d('0x2f')]);_0xc26bf8['query']=_[_0xc23d('0x49')](_0x55f6ee[_0xc23d('0x33')]);_0xc26bf8['filters']=_[_0xc23d('0x35')](_0xc26bf8[_0xc23d('0x32')],_0xc26bf8['query']);_0x152336[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0xc26bf8[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x55f6ee[_0xc23d('0x33')][_0xc23d('0x37')]));_0x152336[_0xc23d('0x36')]=_0x152336[_0xc23d('0x36')]['length']?_0x152336[_0xc23d('0x36')]:_0xc26bf8[_0xc23d('0x32')];if(!_0x55f6ee[_0xc23d('0x33')][_0xc23d('0x39')](_0xc23d('0x3a'))){_0x152336[_0xc23d('0x20')]=qs[_0xc23d('0x20')](_0x55f6ee[_0xc23d('0x33')][_0xc23d('0x20')]);_0x152336[_0xc23d('0x1f')]=qs[_0xc23d('0x1f')](_0x55f6ee['query']['offset']);}_0x152336[_0xc23d('0x3b')]=qs[_0xc23d('0x3c')](_0x55f6ee[_0xc23d('0x33')][_0xc23d('0x3c')]);_0x152336[_0xc23d('0x3d')]=qs[_0xc23d('0x34')](_[_0xc23d('0x3e')](_0x55f6ee['query'],_0xc26bf8[_0xc23d('0x34')]));_0x152336[_0xc23d('0x3d')]['ChatWebsiteId']=_0x5f1827['id'];if(_0x55f6ee[_0xc23d('0x33')][_0xc23d('0x3f')]){_0x152336[_0xc23d('0x3d')]=_['merge'](_0x152336[_0xc23d('0x3d')],{'$or':_[_0xc23d('0x2e')](_0x152336[_0xc23d('0x36')],function(_0x5e3f88){var _0x128317={};_0x128317[_0x5e3f88]={'$like':'%'+_0x55f6ee['query'][_0xc23d('0x3f')]+'%'};return _0x128317;})});}_0x152336=_['merge']({},_0x152336,_0x55f6ee[_0xc23d('0x43')]);return db[_0xc23d('0xc9')][_0xc23d('0x22')]({'where':_0x152336[_0xc23d('0x3d')]})[_0xc23d('0x13')](function(_0x2aee35){_0x4e2430['count']=_0x2aee35;if(_0x55f6ee[_0xc23d('0x33')][_0xc23d('0x5e')]){_0x152336[_0xc23d('0x4a')]=[{'all':!![]}];}else{_0x152336['include']=[{'model':db[_0xc23d('0x7c')],'as':_0xc23d('0x11d'),'required':![]},{'model':db[_0xc23d('0x11e')],'as':_0xc23d('0x11f'),'required':![]}];}return db[_0xc23d('0xc9')][_0xc23d('0x59')](_0x152336);})[_0xc23d('0x13')](function(_0x35213f){_0x4e2430[_0xc23d('0x45')]=_0x35213f;return _0x4e2430;});}})[_0xc23d('0x13')](respondWithFilteredResult(_0x29d6e2,_0x152336))[_0xc23d('0x1c')](handleError(_0x29d6e2,null));};exports[_0xc23d('0x120')]=function(_0x51f6c4,_0x1ea5fd){return db[_0xc23d('0x44')][_0xc23d('0x51')]({'where':{'id':_0x51f6c4[_0xc23d('0x47')]['id']}})[_0xc23d('0x13')](handleEntityNotFound(_0x1ea5fd,null))[_0xc23d('0x13')](function(_0x433a9b){if(_0x433a9b){return _0x433a9b[_0xc23d('0x120')](_0x51f6c4[_0xc23d('0x4c')][_0xc23d('0x5b')],_[_0xc23d('0x121')](_0x51f6c4[_0xc23d('0x4c')],[_0xc23d('0x5b'),'id'])||{})['spread'](function(_0x28b7bd){for(var _0x1f27d6=0x0;_0x1f27d6<_0x51f6c4[_0xc23d('0x4c')][_0xc23d('0x5b')]['length'];_0x1f27d6+=0x1){socket['emit'](_0xc23d('0x122'),{'UserId':Number(_0x51f6c4[_0xc23d('0x4c')][_0xc23d('0x5b')][_0x1f27d6]),'ChatWebsiteId':Number(_0x51f6c4['params']['id'])});}return _0x28b7bd;});}})[_0xc23d('0x13')](respondWithResult(_0x1ea5fd,null))[_0xc23d('0x1c')](handleError(_0x1ea5fd,null));};exports['removeAgents']=function(_0x2e71ad,_0x3dd590){return db[_0xc23d('0x44')][_0xc23d('0x51')]({'where':{'id':_0x2e71ad[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x3dd590,null))[_0xc23d('0x13')](function(_0x3b7a34){if(_0x3b7a34){return _0x3b7a34['removeAgents'](_0x2e71ad[_0xc23d('0x33')][_0xc23d('0x5b')])[_0xc23d('0x13')](function(){if(_['isArray'](_0x2e71ad['query']['ids'])){for(var _0x505c87=0x0;_0x505c87<_0x2e71ad['query']['ids'][_0xc23d('0x38')];_0x505c87+=0x1){socket['emit'](_0xc23d('0x123'),{'UserId':Number(_0x2e71ad[_0xc23d('0x33')][_0xc23d('0x5b')][_0x505c87]),'ChatWebsiteId':Number(_0x2e71ad[_0xc23d('0x47')]['id'])});}}else{socket[_0xc23d('0x124')](_0xc23d('0x123'),{'UserId':Number(_0x2e71ad['query'][_0xc23d('0x5b')]),'ChatWebsiteId':Number(_0x2e71ad['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3dd590,null))['catch'](handleError(_0x3dd590,null));};exports['getAgents']=function(_0x519bb2,_0x51bc54){var _0x40f548={};var _0x2c5294={};var _0x5a1641;var _0x29dfe4;return db[_0xc23d('0x44')]['findOne']({'where':{'id':_0x519bb2[_0xc23d('0x47')]['id']}})['then'](handleEntityNotFound(_0x51bc54,null))[_0xc23d('0x13')](function(_0x25db1c){if(_0x25db1c){_0x5a1641=_0x25db1c;_0x2c5294[_0xc23d('0x32')]=_['keys'](db[_0xc23d('0xb8')][_0xc23d('0x2f')]);_0x2c5294[_0xc23d('0x33')]=_[_0xc23d('0x49')](_0x519bb2['query']);_0x2c5294[_0xc23d('0x34')]=_[_0xc23d('0x35')](_0x2c5294[_0xc23d('0x32')],_0x2c5294['query']);_0x40f548[_0xc23d('0x36')]=_[_0xc23d('0x35')](_0x2c5294[_0xc23d('0x32')],qs[_0xc23d('0x37')](_0x519bb2[_0xc23d('0x33')][_0xc23d('0x37')]));_0x40f548[_0xc23d('0x36')]=_0x40f548[_0xc23d('0x36')][_0xc23d('0x38')]?_0x40f548[_0xc23d('0x36')]:_0x2c5294['model'];_0x40f548[_0xc23d('0x3b')]=qs[_0xc23d('0x3c')](_0x519bb2['query'][_0xc23d('0x3c')]);_0x40f548['where']=qs['filters'](_[_0xc23d('0x3e')](_0x519bb2[_0xc23d('0x33')],_0x2c5294['filters']));if(_0x519bb2['query'][_0xc23d('0x3f')]){_0x40f548['where']=_['merge'](_0x40f548[_0xc23d('0x3d')],{'$or':_[_0xc23d('0x2e')](_0x40f548[_0xc23d('0x36')],function(_0x2ff1bf){var _0x283c77={};_0x283c77[_0x2ff1bf]={'$like':'%'+_0x519bb2[_0xc23d('0x33')][_0xc23d('0x3f')]+'%'};return _0x283c77;})});}_0x40f548=_[_0xc23d('0x40')]({},_0x40f548,_0x519bb2[_0xc23d('0x43')]);return _0x5a1641[_0xc23d('0x125')](_0x40f548);}})[_0xc23d('0x13')](function(_0x294d8f){if(_0x294d8f){_0x29dfe4=_0x294d8f[_0xc23d('0x38')];if(!_0x519bb2[_0xc23d('0x33')][_0xc23d('0x39')](_0xc23d('0x3a'))){_0x40f548[_0xc23d('0x20')]=qs[_0xc23d('0x20')](_0x519bb2[_0xc23d('0x33')][_0xc23d('0x20')]);_0x40f548[_0xc23d('0x1f')]=qs['offset'](_0x519bb2[_0xc23d('0x33')][_0xc23d('0x1f')]);}return _0x5a1641[_0xc23d('0x125')](_0x40f548);}})['then'](function(_0x35131c){if(_0x35131c){return _0x35131c?{'count':_0x29dfe4,'rows':_0x35131c}:null;}})[_0xc23d('0x13')](respondWithResult(_0x51bc54,null))[_0xc23d('0x1c')](handleError(_0x51bc54,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index de398d3..465bcdb 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 _0xa13d=['update','emit','hook','exports','events','ChatWebsite','setMaxListeners'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa13d,0x154));var _0xda13=function(_0x4c8f8c,_0x126298){_0x4c8f8c=_0x4c8f8c-0x0;var _0x57bfeb=_0xa13d[_0x4c8f8c];return _0x57bfeb;};'use strict';var EventEmitter=require(_0xda13('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xda13('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xda13('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xda13('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3a3d87){return function(_0x208aa8,_0x56837b,_0x5b00af){ChatWebsiteEvents[_0xda13('0x4')](_0x3a3d87+':'+_0x208aa8['id'],_0x208aa8);ChatWebsiteEvents[_0xda13('0x4')](_0x3a3d87,_0x208aa8);_0x5b00af(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xda13('0x5')](e,emitEvent(event));}}module[_0xda13('0x6')]=ChatWebsiteEvents; \ No newline at end of file +var _0xbc82=['events','save','hasOwnProperty'];(function(_0x52a8fd,_0x577d77){var _0x2d5ceb=function(_0xafa534){while(--_0xafa534){_0x52a8fd['push'](_0x52a8fd['shift']());}};_0x2d5ceb(++_0x577d77);}(_0xbc82,0x13e));var _0x2bc8=function(_0x127b52,_0x5ef4e4){_0x127b52=_0x127b52-0x0;var _0x49025b=_0xbc82[_0x127b52];return _0x49025b;};'use strict';var EventEmitter=require(_0x2bc8('0x0'));var ChatWebsite=require('../../mysqldb')['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2bc8('0x1'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1320a5){return function(_0x5c8329,_0x528bc4,_0x43e157){ChatWebsiteEvents['emit'](_0x1320a5+':'+_0x5c8329['id'],_0x5c8329);ChatWebsiteEvents['emit'](_0x1320a5,_0x5c8329);_0x43e157(null);};}for(var e in events){if(events[_0x2bc8('0x2')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 1c91dc0..24438c7 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 _0x2446=['moment','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','ChatWebsite','chat_websites','lodash','util','../../config/logger'];(function(_0x4b5813,_0x5769de){var _0x423465=function(_0x18071f){while(--_0x18071f){_0x4b5813['push'](_0x4b5813['shift']());}};_0x423465(++_0x5769de);}(_0x2446,0x8c));var _0x6244=function(_0x4458eb,_0x42b851){_0x4458eb=_0x4458eb-0x0;var _0x3278bf=_0x2446[_0x4458eb];return _0x3278bf;};'use strict';var _=require(_0x6244('0x0'));var util=require(_0x6244('0x1'));var logger=require(_0x6244('0x2'))('api');var moment=require(_0x6244('0x3'));var BPromise=require('bluebird');var rp=require(_0x6244('0x4'));var fs=require('fs');var path=require(_0x6244('0x5'));var rimraf=require('rimraf');var config=require(_0x6244('0x6'));var attributes=require(_0x6244('0x7'));module[_0x6244('0x8')]=function(_0x4cc5fd,_0xa9ed2e){return _0x4cc5fd['define'](_0x6244('0x9'),attributes,{'tableName':_0x6244('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa6b=['path','rimraf','../../config/environment','exports','ChatWebsite','util','../../config/logger','api','moment','request-promise'];(function(_0x574e93,_0x2cb9fb){var _0x590652=function(_0xb96d7){while(--_0xb96d7){_0x574e93['push'](_0x574e93['shift']());}};_0x590652(++_0x2cb9fb);}(_0xaa6b,0xcd));var _0xbaa6=function(_0x31aa1a,_0x5929bc){_0x31aa1a=_0x31aa1a-0x0;var _0x265735=_0xaa6b[_0x31aa1a];return _0x265735;};'use strict';var _=require('lodash');var util=require(_0xbaa6('0x0'));var logger=require(_0xbaa6('0x1'))(_0xbaa6('0x2'));var moment=require(_0xbaa6('0x3'));var BPromise=require('bluebird');var rp=require(_0xbaa6('0x4'));var fs=require('fs');var path=require(_0xbaa6('0x5'));var rimraf=require(_0xbaa6('0x6'));var config=require(_0xbaa6('0x7'));var attributes=require('./chatWebsite.attributes');module[_0xbaa6('0x8')]=function(_0xc4b7b8,_0x2b7575){return _0xc4b7b8['define'](_0xbaa6('0x9'),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 f90928b..14f5b5d 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 _0x7a99=['randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','ChatWebsite,\x20%s,\x20%s','message','result','lodash','moment','bluebird'];(function(_0x1aa853,_0x50501f){var _0x35bc07=function(_0xf6a4e7){while(--_0xf6a4e7){_0x1aa853['push'](_0x1aa853['shift']());}};_0x35bc07(++_0x50501f);}(_0x7a99,0x19b));var _0x97a9=function(_0x2863d7,_0x29f43){_0x2863d7=_0x2863d7-0x0;var _0x32ff01=_0x7a99[_0x2863d7];return _0x32ff01;};'use strict';var _=require(_0x97a9('0x0'));var util=require('util');var moment=require(_0x97a9('0x1'));var BPromise=require(_0x97a9('0x2'));var rs=require(_0x97a9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97a9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x97a9('0x5'))(_0x97a9('0x6'));var config=require('../../config/environment');var jayson=require(_0x97a9('0x7'));var client=jayson[_0x97a9('0x8')][_0x97a9('0x9')]({'port':0x232a});config[_0x97a9('0xa')]=_['defaults'](config['redis'],{'host':_0x97a9('0xb'),'port':0x18eb});var socket=require(_0x97a9('0xc'))(new Redis(config['redis']));require(_0x97a9('0xd'))[_0x97a9('0xe')](socket);function respondWithRpcPromise(_0x567667,_0x3dd76c,_0x6a6ce8){return new BPromise(function(_0xe7a35f,_0x2acbcb){return client[_0x97a9('0xf')](_0x567667,_0x6a6ce8)['then'](function(_0x157664){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3dd76c,_0x97a9('0x10'));logger[_0x97a9('0x11')](_0x97a9('0x12'),_0x3dd76c,_0x97a9('0x10'),JSON['stringify'](_0x157664));if(_0x157664[_0x97a9('0x13')]){if(_0x157664[_0x97a9('0x13')]['code']===0x1f4){logger[_0x97a9('0x13')](_0x97a9('0x14'),_0x3dd76c,_0x157664[_0x97a9('0x13')]['message']);return _0x2acbcb(_0x157664['error']['message']);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3dd76c,_0x157664[_0x97a9('0x13')][_0x97a9('0x15')]);return _0xe7a35f(_0x157664[_0x97a9('0x13')][_0x97a9('0x15')]);}else{logger['info'](_0x97a9('0x14'),_0x3dd76c,_0x97a9('0x10'));_0xe7a35f(_0x157664[_0x97a9('0x16')][_0x97a9('0x15')]);}})['catch'](function(_0x37a6bd){logger[_0x97a9('0x13')](_0x97a9('0x14'),_0x3dd76c,_0x37a6bd);_0x2acbcb(_0x37a6bd);});});} \ No newline at end of file +var _0xb48b=['error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','register','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xb48b,0x10c));var _0xbb48=function(_0x4d835a,_0x1bd5bf){_0x4d835a=_0x4d835a-0x0;var _0x19725f=_0xb48b[_0x4d835a];return _0x19725f;};'use strict';var _=require(_0xbb48('0x0'));var util=require('util');var moment=require(_0xbb48('0x1'));var BPromise=require(_0xbb48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb48('0x3'));var db=require(_0xbb48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb48('0x5'))('rpc');var config=require(_0xbb48('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb48('0x7')]({'port':0x232a});config[_0xbb48('0x8')]=_[_0xbb48('0x9')](config[_0xbb48('0x8')],{'host':_0xbb48('0xa'),'port':0x18eb});var socket=require(_0xbb48('0xb'))(new Redis(config[_0xbb48('0x8')]));require('./chatWebsite.socket')[_0xbb48('0xc')](socket);function respondWithRpcPromise(_0x22e451,_0x4be23e,_0x355a54){return new BPromise(function(_0x305b4f,_0x15d48b){return client['request'](_0x22e451,_0x355a54)[_0xbb48('0xd')](function(_0x360086){logger[_0xbb48('0xe')](_0xbb48('0xf'),_0x4be23e,_0xbb48('0x10'));logger[_0xbb48('0x11')](_0xbb48('0x12'),_0x4be23e,_0xbb48('0x10'),JSON[_0xbb48('0x13')](_0x360086));if(_0x360086[_0xbb48('0x14')]){if(_0x360086[_0xbb48('0x14')][_0xbb48('0x15')]===0x1f4){logger['error'](_0xbb48('0xf'),_0x4be23e,_0x360086[_0xbb48('0x14')][_0xbb48('0x16')]);return _0x15d48b(_0x360086['error'][_0xbb48('0x16')]);}logger[_0xbb48('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x4be23e,_0x360086[_0xbb48('0x14')]['message']);return _0x305b4f(_0x360086[_0xbb48('0x14')][_0xbb48('0x16')]);}else{logger[_0xbb48('0xe')](_0xbb48('0xf'),_0x4be23e,_0xbb48('0x10'));_0x305b4f(_0x360086[_0xbb48('0x17')][_0xbb48('0x16')]);}})['catch'](function(_0x4f1f1e){logger[_0xbb48('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x4be23e,_0x4f1f1e);_0x15d48b(_0x4f1f1e);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index ba1b38b..f2e5ade 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 _0x3ce0=['chatWebsite:','./chatWebsite.events','save','remove','update','length'];(function(_0x386597,_0x3e27c3){var _0x1ac397=function(_0x41bea5){while(--_0x41bea5){_0x386597['push'](_0x386597['shift']());}};_0x1ac397(++_0x3e27c3);}(_0x3ce0,0x145));var _0x03ce=function(_0x52efe5,_0x5f40e8){_0x52efe5=_0x52efe5-0x0;var _0x545866=_0x3ce0[_0x52efe5];return _0x545866;};'use strict';var ChatWebsiteEvents=require(_0x03ce('0x0'));var events=[_0x03ce('0x1'),_0x03ce('0x2'),_0x03ce('0x3')];function createListener(_0x415584,_0x4a3de4){return function(_0x2e9280){_0x4a3de4['emit'](_0x415584,_0x2e9280);};}function removeListener(_0x448f1b,_0x13e265){return function(){ChatWebsiteEvents['removeListener'](_0x448f1b,_0x13e265);};}exports['register']=function(_0x2b4649){for(var _0x2ce99b=0x0,_0x5a510e=events[_0x03ce('0x4')];_0x2ce99b<_0x5a510e;_0x2ce99b++){var _0xdb22e4=events[_0x2ce99b];var _0x465bdc=createListener(_0x03ce('0x5')+_0xdb22e4,_0x2b4649);ChatWebsiteEvents['on'](_0xdb22e4,_0x465bdc);}}; \ No newline at end of file +var _0xed1f=['chatWebsite:','./chatWebsite.events','save','emit','removeListener','register','length'];(function(_0x29f49e,_0x50c0c5){var _0x3ed560=function(_0x466b91){while(--_0x466b91){_0x29f49e['push'](_0x29f49e['shift']());}};_0x3ed560(++_0x50c0c5);}(_0xed1f,0xa9));var _0xfed1=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xed1f[_0x3070dc];return _0x431489;};'use strict';var ChatWebsiteEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),'remove','update'];function createListener(_0xdcb28c,_0x5a4c4a){return function(_0x557b04){_0x5a4c4a[_0xfed1('0x2')](_0xdcb28c,_0x557b04);};}function removeListener(_0x6a4ba,_0xcd700a){return function(){ChatWebsiteEvents[_0xfed1('0x3')](_0x6a4ba,_0xcd700a);};}exports[_0xfed1('0x4')]=function(_0x2d5bf4){for(var _0x349dc9=0x0,_0x230744=events[_0xfed1('0x5')];_0x349dc9<_0x230744;_0x349dc9++){var _0x2c5a59=events[_0x349dc9];var _0x4d1f60=createListener(_0xfed1('0x6')+_0x2c5a59,_0x2d5bf4);ChatWebsiteEvents['on'](_0x2c5a59,_0x4d1f60);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index ee573c4..c8949d2 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 _0x71d1=['addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','server/files','replace','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition'];(function(_0x567976,_0x4efa92){var _0x43872=function(_0x1789f8){while(--_0x1789f8){_0x567976['push'](_0x567976['shift']());}};_0x43872(++_0x4efa92);}(_0x71d1,0x179));var _0x171d=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x71d1[_0x2fd160];return _0x5c2031;};'use strict';var multer=require('multer');var util=require(_0x171d('0x0'));var path=require(_0x171d('0x1'));var timeout=require(_0x171d('0x2'));var express=require(_0x171d('0x3'));var router=express[_0x171d('0x4')]();var fs_extra=require(_0x171d('0x5'));var auth=require(_0x171d('0x6'));var interaction=require(_0x171d('0x7'));var config=require(_0x171d('0x8'));var controller=require('./chatWebsite.controller');router[_0x171d('0x9')]('/',auth['isAuthenticated'](),controller[_0x171d('0xa')]);router['get'](_0x171d('0xb'),auth[_0x171d('0xc')](),controller[_0x171d('0xd')]);router[_0x171d('0x9')](_0x171d('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x171d('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x171d('0xf')]);router['get'](_0x171d('0x10'),auth[_0x171d('0xc')](),controller[_0x171d('0x11')]);router['get']('/:id/logo',controller[_0x171d('0x12')]);router[_0x171d('0x9')]('/:id/avatar',controller[_0x171d('0x13')]);router[_0x171d('0x9')](_0x171d('0x14'),controller['getCustomerAvatar']);router['get'](_0x171d('0x15'),controller['getSystemAvatar']);router['get'](_0x171d('0x16'),auth['isAuthenticated'](),controller[_0x171d('0x17')]);router[_0x171d('0x9')]('/:id/snippet',controller[_0x171d('0x18')]);router[_0x171d('0x9')](_0x171d('0x19'),auth[_0x171d('0xc')](),controller[_0x171d('0x1a')]);router[_0x171d('0x9')](_0x171d('0x1b'),auth[_0x171d('0xc')](),controller[_0x171d('0x1c')]);router['get']('/:id/fields',controller[_0x171d('0x1d')]);router[_0x171d('0x9')](_0x171d('0x1e'),auth[_0x171d('0xc')](),controller[_0x171d('0x1f')]);router[_0x171d('0x9')](_0x171d('0x20'),auth[_0x171d('0xc')](),controller[_0x171d('0x21')]);router[_0x171d('0x22')]('/',auth[_0x171d('0xc')](),controller[_0x171d('0x23')]);router[_0x171d('0x22')]('/:id/dispositions',auth[_0x171d('0xc')](),controller[_0x171d('0x24')]);router['post'](_0x171d('0x10'),auth[_0x171d('0xc')](),controller[_0x171d('0x25')]);var upload=multer({'storage':multer[_0x171d('0x26')]({'destination':function(_0x127b60,_0x3d073e,_0x599898){_0x599898(null,path[_0x171d('0x27')](config[_0x171d('0x28')],_0x171d('0x29')));},'filename':function(_0x35e4b6,_0x58d4f6,_0x4e653b){_0x4e653b(null,util[_0x171d('0x2a')](_0x171d('0x2b'),Date[_0x171d('0x2c')](),_0x58d4f6[_0x171d('0x2d')]));}})});router[_0x171d('0x22')](_0x171d('0x2e'),upload[_0x171d('0x2f')](_0x171d('0x30')),controller[_0x171d('0x31')]);var upload=multer({'storage':multer[_0x171d('0x26')]({'destination':function(_0x31febe,_0x28e1ba,_0x1827ad){_0x1827ad(null,path[_0x171d('0x27')](config['root'],_0x171d('0x32')));},'filename':function(_0x525a69,_0x5b9331,_0x2f3368){_0x2f3368(null,util[_0x171d('0x2a')](_0x171d('0x2b'),Date['now'](),_0x5b9331[_0x171d('0x2d')]));}})});router[_0x171d('0x22')]('/:id/avatar',upload[_0x171d('0x2f')]('file'),controller[_0x171d('0x33')]);var upload=multer({'storage':multer[_0x171d('0x26')]({'destination':function(_0xd96e8d,_0x89d59b,_0x2bd127){_0x2bd127(null,path[_0x171d('0x27')](config[_0x171d('0x28')],_0x171d('0x32')));},'filename':function(_0x5ee8e5,_0x19ab21,_0x534fc8){_0x534fc8(null,util['format'](_0x171d('0x2b'),Date[_0x171d('0x2c')](),_0x19ab21[_0x171d('0x2d')]));}})});router[_0x171d('0x22')](_0x171d('0x14'),upload[_0x171d('0x2f')](_0x171d('0x30')),controller[_0x171d('0x34')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xbbff4f,_0x152772,_0x274357){_0x274357(null,path['join'](config[_0x171d('0x28')],_0x171d('0x32')));},'filename':function(_0x122d48,_0xd24bea,_0x251416){_0x251416(null,util[_0x171d('0x2a')](_0x171d('0x2b'),Date[_0x171d('0x2c')](),_0xd24bea[_0x171d('0x2d')]));}})});router[_0x171d('0x22')](_0x171d('0x15'),upload[_0x171d('0x2f')](_0x171d('0x30')),controller[_0x171d('0x35')]);router[_0x171d('0x22')](_0x171d('0x36'),controller['notify']);const offlineUploadMulter=multer({'storage':multer[_0x171d('0x26')]({'destination':function(_0x34994e,_0x543856,_0x547e23){const _0x71be0e=path['join'](config[_0x171d('0x28')],_0x171d('0x37'),'attachments','offline-chat');fs_extra['ensureDir'](_0x71be0e,function(){_0x547e23(null,_0x71be0e);});},'filename':function(_0x5152b1,_0x1083da,_0x3d0e78){const _0x2867e7=_0x1083da[_0x171d('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x587308=path['extname'](_0x2867e7);const _0x410490=Date[_0x171d('0x2c')]()+'-'+_0x2867e7[_0x171d('0x38')](_0x587308,'')+_0x587308;_0x3d0e78(null,_0x410490);}})});router[_0x171d('0x22')](_0x171d('0x39'),offlineUploadMulter[_0x171d('0x3a')](),controller[_0x171d('0x3b')]);router[_0x171d('0x22')](_0x171d('0x16'),auth[_0x171d('0xc')](),controller['addInteraction']);router[_0x171d('0x22')](_0x171d('0x19'),auth[_0x171d('0xc')](),controller[_0x171d('0x3c')]);router[_0x171d('0x22')](_0x171d('0x1b'),auth['isAuthenticated'](),controller[_0x171d('0x3d')]);router['post'](_0x171d('0x20'),auth[_0x171d('0xc')](),controller[_0x171d('0x3e')]);router[_0x171d('0x3f')]('/:id',auth[_0x171d('0xc')](),controller[_0x171d('0x40')]);router[_0x171d('0x41')](_0x171d('0xe'),auth[_0x171d('0xc')](),controller[_0x171d('0x42')]);router[_0x171d('0x41')]('/:id/dispositions',auth[_0x171d('0xc')](),controller[_0x171d('0x43')]);router['delete'](_0x171d('0x10'),auth[_0x171d('0xc')](),controller[_0x171d('0x44')]);router[_0x171d('0x41')](_0x171d('0x20'),auth[_0x171d('0xc')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x2908=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','/describe','describe','getDispositions','getAnswers','/:id/logo','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/canned_answers','root','server/files/images/logos/','%s-%s','now','single','file','addLogo','diskStorage','server/files/images/avatars/','format','originalname','/:id/avatar','addAvatar','join','notify','server/files','offline-chat','ensureDir','extname','/:id/offline','offline','addInteraction','/:id/applications','addApplications','addAgents','/:id','update','delete'];(function(_0x48c1e0,_0x2238e2){var _0x1d1923=function(_0x202797){while(--_0x202797){_0x48c1e0['push'](_0x48c1e0['shift']());}};_0x1d1923(++_0x2238e2);}(_0x2908,0x1b2));var _0x8290=function(_0x3505cb,_0x3bf231){_0x3505cb=_0x3505cb-0x0;var _0x22a747=_0x2908[_0x3505cb];return _0x22a747;};'use strict';var multer=require(_0x8290('0x0'));var util=require(_0x8290('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8290('0x2'));var router=express[_0x8290('0x3')]();var fs_extra=require(_0x8290('0x4'));var auth=require(_0x8290('0x5'));var interaction=require(_0x8290('0x6'));var config=require('../../config/environment');var controller=require(_0x8290('0x7'));router[_0x8290('0x8')]('/',auth[_0x8290('0x9')](),controller['index']);router[_0x8290('0x8')](_0x8290('0xa'),auth[_0x8290('0x9')](),controller[_0x8290('0xb')]);router[_0x8290('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x8290('0x8')]('/:id/dispositions',auth[_0x8290('0x9')](),controller[_0x8290('0xc')]);router[_0x8290('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x8290('0xd')]);router[_0x8290('0x8')](_0x8290('0xe'),controller['getLogo']);router[_0x8290('0x8')]('/:id/avatar',controller['getAvatar']);router['get']('/:id/customer_avatar',controller[_0x8290('0xf')]);router['get'](_0x8290('0x10'),controller[_0x8290('0x11')]);router[_0x8290('0x8')](_0x8290('0x12'),auth['isAuthenticated'](),controller[_0x8290('0x13')]);router[_0x8290('0x8')](_0x8290('0x14'),controller['getSnippet']);router[_0x8290('0x8')]('/:id/applications',auth[_0x8290('0x9')](),controller[_0x8290('0x15')]);router[_0x8290('0x8')](_0x8290('0x16'),auth['isAuthenticated'](),controller['getProactiveActions']);router[_0x8290('0x8')](_0x8290('0x17'),controller[_0x8290('0x18')]);router[_0x8290('0x8')](_0x8290('0x19'),auth[_0x8290('0x9')](),controller[_0x8290('0x1a')]);router[_0x8290('0x8')](_0x8290('0x1b'),auth[_0x8290('0x9')](),controller[_0x8290('0x1c')]);router[_0x8290('0x1d')]('/',auth['isAuthenticated'](),controller[_0x8290('0x1e')]);router[_0x8290('0x1d')](_0x8290('0x1f'),auth[_0x8290('0x9')](),controller[_0x8290('0x20')]);router['post'](_0x8290('0x21'),auth[_0x8290('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x9fc41d,_0x53dc79,_0x16d028){_0x16d028(null,path['join'](config[_0x8290('0x22')],_0x8290('0x23')));},'filename':function(_0x14e07b,_0x48d121,_0x4b3e6f){_0x4b3e6f(null,util['format'](_0x8290('0x24'),Date[_0x8290('0x25')](),_0x48d121['originalname']));}})});router['post'](_0x8290('0xe'),upload[_0x8290('0x26')](_0x8290('0x27')),controller[_0x8290('0x28')]);var upload=multer({'storage':multer[_0x8290('0x29')]({'destination':function(_0x2e9577,_0x49780d,_0x375691){_0x375691(null,path['join'](config[_0x8290('0x22')],_0x8290('0x2a')));},'filename':function(_0xf41264,_0x45001c,_0xe8178c){_0xe8178c(null,util[_0x8290('0x2b')](_0x8290('0x24'),Date[_0x8290('0x25')](),_0x45001c[_0x8290('0x2c')]));}})});router[_0x8290('0x1d')](_0x8290('0x2d'),upload[_0x8290('0x26')](_0x8290('0x27')),controller[_0x8290('0x2e')]);var upload=multer({'storage':multer[_0x8290('0x29')]({'destination':function(_0x3fe2de,_0x512cb1,_0x1c06de){_0x1c06de(null,path[_0x8290('0x2f')](config[_0x8290('0x22')],'server/files/images/avatars/'));},'filename':function(_0xd5e7b4,_0x5f3406,_0x244cd7){_0x244cd7(null,util['format'](_0x8290('0x24'),Date['now'](),_0x5f3406['originalname']));}})});router[_0x8290('0x1d')]('/:id/customer_avatar',upload['single'](_0x8290('0x27')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x8290('0x29')]({'destination':function(_0x95cd16,_0x5630c9,_0x5a51f4){_0x5a51f4(null,path[_0x8290('0x2f')](config[_0x8290('0x22')],'server/files/images/avatars/'));},'filename':function(_0x3a0afe,_0x29dc03,_0x1b7972){_0x1b7972(null,util[_0x8290('0x2b')](_0x8290('0x24'),Date[_0x8290('0x25')](),_0x29dc03[_0x8290('0x2c')]));}})});router['post'](_0x8290('0x10'),upload[_0x8290('0x26')]('file'),controller['addSystemAvatar']);router[_0x8290('0x1d')]('/:id/notify',controller[_0x8290('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x8290('0x29')]({'destination':function(_0x39e84d,_0x33ca0f,_0x447d65){const _0x58110b=path[_0x8290('0x2f')](config['root'],_0x8290('0x31'),'attachments',_0x8290('0x32'));fs_extra[_0x8290('0x33')](_0x58110b,function(){_0x447d65(null,_0x58110b);});},'filename':function(_0x394ba1,_0x596598,_0x4d815b){const _0x39d90c=_0x596598[_0x8290('0x2c')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x46707b=path[_0x8290('0x34')](_0x39d90c);const _0x3166c8=Date[_0x8290('0x25')]()+'-'+_0x39d90c['replace'](_0x46707b,'')+_0x46707b;_0x4d815b(null,_0x3166c8);}})});router['post'](_0x8290('0x35'),offlineUploadMulter['any'](),controller[_0x8290('0x36')]);router[_0x8290('0x1d')](_0x8290('0x12'),auth[_0x8290('0x9')](),controller[_0x8290('0x37')]);router[_0x8290('0x1d')](_0x8290('0x38'),auth[_0x8290('0x9')](),controller[_0x8290('0x39')]);router[_0x8290('0x1d')]('/:id/proactive_actions',auth[_0x8290('0x9')](),controller['addProactiveActions']);router[_0x8290('0x1d')]('/:id/users',auth[_0x8290('0x9')](),controller[_0x8290('0x3a')]);router['put'](_0x8290('0x3b'),auth[_0x8290('0x9')](),controller[_0x8290('0x3c')]);router['delete'](_0x8290('0x3b'),auth[_0x8290('0x9')](),controller['destroy']);router[_0x8290('0x3d')]('/:id/dispositions',auth[_0x8290('0x9')](),controller['removeDispositions']);router[_0x8290('0x3d')](_0x8290('0x21'),auth[_0x8290('0x9')](),controller['removeAnswers']);router[_0x8290('0x3d')]('/:id/users',auth[_0x8290('0x9')](),controller['removeAgents']);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 6379b8d..020ffcd 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 _0xcbd8=['express','../components/auth/service','../config/environment','env','production','app','get','client-side-logger','expressEndpoint','/client-logs','use','isAuthenticated','exports','beaver-logger/server'];(function(_0x589a91,_0x116112){var _0x278242=function(_0x166d88){while(--_0x166d88){_0x589a91['push'](_0x589a91['shift']());}};_0x278242(++_0x116112);}(_0xcbd8,0xb5));var _0x8cbd=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xcbd8[_0x501510];return _0x1e6ee5;};var beaverLogger=require(_0x8cbd('0x0'));var express=require(_0x8cbd('0x1'));var auth=require(_0x8cbd('0x2'));var config=require(_0x8cbd('0x3'));var router=express['Router']();var isProduction=config[_0x8cbd('0x4')]===_0x8cbd('0x5')||![];function clientSideLogs(_0x6d686a,_0x11de80,_0x3fe321){var _0x372d58=_0x6d686a[_0x8cbd('0x6')][_0x8cbd('0x7')](_0x8cbd('0x8'));if(!_0x372d58){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x8cbd('0x9')]({'uri':_0x8cbd('0xa'),'logger':_0x372d58,'enableCors':!isProduction})(_0x6d686a,_0x11de80,_0x3fe321);}router[_0x8cbd('0xb')](auth[_0x8cbd('0xc')](),clientSideLogs);module[_0x8cbd('0xd')]=router; \ No newline at end of file +var _0x7d83=['../config/environment','Router','app','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','express','../components/auth/service'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x7d83,0xc4));var _0x37d8=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x7d83[_0x24061a];return _0x82054e;};var beaverLogger=require('beaver-logger/server');var express=require(_0x37d8('0x0'));var auth=require(_0x37d8('0x1'));var config=require(_0x37d8('0x2'));var router=express[_0x37d8('0x3')]();var isProduction=config['env']==='production'||![];function clientSideLogs(_0x37aa04,_0x1e898a,_0x4fd435){var _0x4c3466=_0x37aa04[_0x37d8('0x4')]['get'](_0x37d8('0x5'));if(!_0x4c3466){throw new Error(_0x37d8('0x6'));}return beaverLogger[_0x37d8('0x7')]({'uri':_0x37d8('0x8'),'logger':_0x4c3466,'enableCors':!isProduction})(_0x37aa04,_0x1e898a,_0x4fd435);}router[_0x37d8('0x9')](auth[_0x37d8('0xa')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 62e49cc..2fca404 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 _0x2bb6=['MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM'];(function(_0xd341b,_0x3100ba){var _0x86bd5a=function(_0x325140){while(--_0x325140){_0xd341b['push'](_0xd341b['shift']());}};_0x86bd5a(++_0x3100ba);}(_0x2bb6,0x6c));var _0x62bb=function(_0x769dd2,_0x51c569){_0x769dd2=_0x769dd2-0x0;var _0x103980=_0x2bb6[_0x769dd2];return _0x103980;};'use strict';var Sequelize=require(_0x62bb('0x0'));module[_0x62bb('0x1')]={'name':{'type':Sequelize[_0x62bb('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x62bb('0x3')]('AmazonAWS','Google',_0x62bb('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x62bb('0x5'),_0x62bb('0x6'))},'data1':{'type':Sequelize[_0x62bb('0x2')],'comment':_0x62bb('0x7')},'data2':{'type':Sequelize[_0x62bb('0x2')],'comment':_0x62bb('0x8')},'data3':{'type':Sequelize[_0x62bb('0x2')],'comment':_0x62bb('0x9')},'data4':{'type':Sequelize[_0x62bb('0x2')],'comment':_0x62bb('0xa')},'data5':{'type':Sequelize[_0x62bb('0xb')],'comment':_0x62bb('0xc')},'data6':{'type':Sequelize[_0x62bb('0xb')],'comment':_0x62bb('0xd')},'data7':{'type':Sequelize[_0x62bb('0xb')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file +var _0x256f=['TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','Google','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri'];(function(_0x5b2c50,_0x4db66b){var _0x47f2f9=function(_0xef76e4){while(--_0xef76e4){_0x5b2c50['push'](_0x5b2c50['shift']());}};_0x47f2f9(++_0x4db66b);}(_0x256f,0x18b));var _0xf256=function(_0x4fd1fc,_0x454f07){_0x4fd1fc=_0x4fd1fc-0x0;var _0x59a56f=_0x256f[_0x4fd1fc];return _0x59a56f;};'use strict';var Sequelize=require(_0xf256('0x0'));module[_0xf256('0x1')]={'name':{'type':Sequelize[_0xf256('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xf256('0x3')]('AmazonAWS',_0xf256('0x4'),_0xf256('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xf256('0x3')](_0xf256('0x6'),_0xf256('0x7'))},'data1':{'type':Sequelize[_0xf256('0x2')],'comment':_0xf256('0x8')},'data2':{'type':Sequelize[_0xf256('0x2')],'comment':_0xf256('0x9')},'data3':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xf256('0x2')],'comment':_0xf256('0xa')},'data5':{'type':Sequelize[_0xf256('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0xf256('0xb')],'comment':_0xf256('0xc')},'data7':{'type':Sequelize[_0xf256('0xb')],'comment':_0xf256('0xd')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index f071366..51d3656 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 _0x5d5d=['attributes','intersection','query','fields','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','service','MicrosoftAzure','decryptString','show','find','data3','create','Name\x20parameter\x20not\x20specified','body','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','CloudProvider','update','findOne','params','sendStatus','generateMicrosoftAuthorizationUrl','catch','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','parse','from','state','base64','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','Content-Range','then','destroy','end','stack','name','send','padEnd','slice','index','rawAttributes','fieldName','type','key','model','map','keys'];(function(_0x18c40d,_0x37e964){var _0x147016=function(_0x41002f){while(--_0x41002f){_0x18c40d['push'](_0x18c40d['shift']());}};_0x147016(++_0x37e964);}(_0x5d5d,0x1be));var _0xd5d5=function(_0x539554,_0x48ab5c){_0x539554=_0x539554-0x0;var _0x266cd5=_0x5d5d[_0x539554];return _0x266cd5;};'use strict';var _=require(_0xd5d5('0x0'));var Redis=require(_0xd5d5('0x1'));var qs=require(_0xd5d5('0x2'));var encryptor=require(_0xd5d5('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xd5d5('0x4'));var db=require(_0xd5d5('0x5'))['db'];var oauth=require(_0xd5d5('0x6'));config[_0xd5d5('0x7')]=_[_0xd5d5('0x8')](config[_0xd5d5('0x7')],{'host':_0xd5d5('0x9'),'port':0x18eb});var socket=require(_0xd5d5('0xa'))(new Redis(config[_0xd5d5('0x7')]));var redis=new Redis(config[_0xd5d5('0x7')]);function respondWithStatusCode(_0x5f1d66,_0x5aed2d){_0x5aed2d=_0x5aed2d||0xcc;return function(_0x4d5e97){if(_0x4d5e97){return _0x5f1d66['sendStatus'](_0x5aed2d);}return _0x5f1d66[_0xd5d5('0xb')](_0x5aed2d)['end']();};}function respondWithResult(_0x58a122,_0x245188){_0x245188=_0x245188||0xc8;return function(_0x1e4d46){if(_0x1e4d46){return _0x58a122['status'](_0x245188)[_0xd5d5('0xc')](_0x1e4d46);}};}function respondWithFilteredResult(_0x473f9c,_0x2d332b){return function(_0x3fdb11){if(_0x3fdb11){var _0x1813e2=typeof _0x2d332b[_0xd5d5('0xd')]===_0xd5d5('0xe')&&typeof _0x2d332b[_0xd5d5('0xf')]==='undefined';var _0x21b34d=_0x3fdb11[_0xd5d5('0x10')];var _0x5b7d92=_0x1813e2?0x0:_0x2d332b['offset'];var _0x30e47f=_0x1813e2?_0x3fdb11['count']:_0x2d332b[_0xd5d5('0xd')]+_0x2d332b[_0xd5d5('0xf')];var _0xfe378f;if(_0x30e47f>=_0x21b34d){_0x30e47f=_0x21b34d;_0xfe378f=0xc8;}else{_0xfe378f=0xce;}_0x473f9c['status'](_0xfe378f);return _0x473f9c['set'](_0xd5d5('0x11'),_0x5b7d92+'-'+_0x30e47f+'/'+_0x21b34d)['json'](_0x3fdb11);}return null;};}function saveUpdates(_0x2352b8){return function(_0x1701cc){if(_0x1701cc){return _0x1701cc['update'](_0x2352b8)[_0xd5d5('0x12')](function(_0x63af0a){return _0x63af0a;});}return null;};}function removeEntity(_0x4c6b2b){return function(_0x1ea93a){if(_0x1ea93a){return _0x1ea93a[_0xd5d5('0x13')]()[_0xd5d5('0x12')](function(){_0x4c6b2b[_0xd5d5('0xb')](0xcc)[_0xd5d5('0x14')]();});}};}function handleEntityNotFound(_0x33a7e1){return function(_0x3e5114){if(!_0x3e5114){_0x33a7e1['sendStatus'](0x194);}return _0x3e5114;};}function handleError(_0x40d40b,_0xd5e45b){_0xd5e45b=_0xd5e45b||0x1f4;return function(_0x488d85){logger['error'](_0x488d85[_0xd5d5('0x15')]);if(_0x488d85[_0xd5d5('0x16')]){delete _0x488d85[_0xd5d5('0x16')];}_0x40d40b[_0xd5d5('0xb')](_0xd5e45b)[_0xd5d5('0x17')](_0x488d85);};}function maskClientSecret(_0x5d0486){return _[_0xd5d5('0x18')](_0x5d0486[_0xd5d5('0x19')](0x0,0x3),0x14,'*');}exports[_0xd5d5('0x1a')]=function(_0x2d3e6a,_0x4ea124){var _0x9ce974={},_0x3865c8={},_0x423277={'count':0x0,'rows':[]};var _0x5363ef=_['map'](db['CloudProvider'][_0xd5d5('0x1b')],function(_0xabb424){return{'name':_0xabb424[_0xd5d5('0x1c')],'type':_0xabb424[_0xd5d5('0x1d')][_0xd5d5('0x1e')]};});_0x3865c8[_0xd5d5('0x1f')]=_[_0xd5d5('0x20')](_0x5363ef,_0xd5d5('0x16'));_0x3865c8['query']=_[_0xd5d5('0x21')](_0x2d3e6a['query']);_0x3865c8['filters']=_['intersection'](_0x3865c8[_0xd5d5('0x1f')],_0x3865c8['query']);_0x9ce974[_0xd5d5('0x22')]=_[_0xd5d5('0x23')](_0x3865c8[_0xd5d5('0x1f')],qs['fields'](_0x2d3e6a[_0xd5d5('0x24')][_0xd5d5('0x25')]));_0x9ce974[_0xd5d5('0x22')]=_0x9ce974[_0xd5d5('0x22')]['length']?_0x9ce974[_0xd5d5('0x22')]:_0x3865c8[_0xd5d5('0x1f')];if(!_0x2d3e6a['query']['hasOwnProperty'](_0xd5d5('0x26'))){_0x9ce974['limit']=qs['limit'](_0x2d3e6a['query'][_0xd5d5('0xf')]);_0x9ce974[_0xd5d5('0xd')]=qs['offset'](_0x2d3e6a[_0xd5d5('0x24')]['offset']);}_0x9ce974[_0xd5d5('0x27')]=qs[_0xd5d5('0x28')](_0x2d3e6a[_0xd5d5('0x24')][_0xd5d5('0x28')]);_0x9ce974[_0xd5d5('0x29')]=qs[_0xd5d5('0x2a')](_[_0xd5d5('0x2b')](_0x2d3e6a['query'],_0x3865c8[_0xd5d5('0x2a')]),_0x5363ef);if(_0x2d3e6a[_0xd5d5('0x24')]['filter']){_0x9ce974[_0xd5d5('0x29')]=_['merge'](_0x9ce974[_0xd5d5('0x29')],{'$or':_[_0xd5d5('0x20')](_0x5363ef,function(_0x420061){if(_0x420061['type']!==_0xd5d5('0x2c')){var _0x492985={};_0x492985[_0x420061[_0xd5d5('0x16')]]={'$like':'%'+_0x2d3e6a[_0xd5d5('0x24')][_0xd5d5('0x2d')]+'%'};return _0x492985;}})});}_0x9ce974=_[_0xd5d5('0x2e')]({},_0x9ce974,_0x2d3e6a[_0xd5d5('0x2f')]);var _0x3b481c={'where':_0x9ce974[_0xd5d5('0x29')]};return db['CloudProvider'][_0xd5d5('0x10')](_0x3b481c)[_0xd5d5('0x12')](function(_0x2e244c){_0x423277[_0xd5d5('0x10')]=_0x2e244c;if(_0x2d3e6a[_0xd5d5('0x24')][_0xd5d5('0x30')]){_0x9ce974[_0xd5d5('0x31')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x9ce974);})['then'](function(_0x32aea2){_0x423277['rows']=_[_0xd5d5('0x20')](_0x32aea2,function(_0x898840){if(_0x898840[_0xd5d5('0x32')]===_0xd5d5('0x33')){var _0x1308a5=encryptor[_0xd5d5('0x34')](_0x898840['data3']);_0x898840['data3']=maskClientSecret(_0x1308a5);}return _0x898840;});return _0x423277;})[_0xd5d5('0x12')](respondWithFilteredResult(_0x4ea124,_0x9ce974))['catch'](handleError(_0x4ea124,null));};exports[_0xd5d5('0x35')]=function(_0x2ea6b2,_0x1d977a){var _0x24c024={'raw':!![],'where':{'id':_0x2ea6b2['params']['id']}},_0x580c68={};_0x580c68['model']=_[_0xd5d5('0x21')](db['CloudProvider']['rawAttributes']);_0x580c68[_0xd5d5('0x24')]=_[_0xd5d5('0x21')](_0x2ea6b2['query']);_0x580c68[_0xd5d5('0x2a')]=_['intersection'](_0x580c68[_0xd5d5('0x1f')],_0x580c68[_0xd5d5('0x24')]);_0x24c024[_0xd5d5('0x22')]=_[_0xd5d5('0x23')](_0x580c68[_0xd5d5('0x1f')],qs[_0xd5d5('0x25')](_0x2ea6b2['query'][_0xd5d5('0x25')]));_0x24c024[_0xd5d5('0x22')]=_0x24c024['attributes']['length']?_0x24c024[_0xd5d5('0x22')]:_0x580c68[_0xd5d5('0x1f')];if(_0x2ea6b2[_0xd5d5('0x24')][_0xd5d5('0x30')]){_0x24c024[_0xd5d5('0x31')]=[{'all':!![]}];}_0x24c024=_['merge']({},_0x24c024,_0x2ea6b2['options']);return db['CloudProvider'][_0xd5d5('0x36')](_0x24c024)[_0xd5d5('0x12')](handleEntityNotFound(_0x1d977a,null))['then'](function(_0x4f820a){if(_0x4f820a[_0xd5d5('0x32')]===_0xd5d5('0x33')){var _0x185a7a=encryptor[_0xd5d5('0x34')](_0x4f820a[_0xd5d5('0x37')]);_0x4f820a[_0xd5d5('0x37')]=maskClientSecret(_0x185a7a);}return _0x4f820a;})[_0xd5d5('0x12')](respondWithResult(_0x1d977a,null))['catch'](handleError(_0x1d977a,null));};exports[_0xd5d5('0x38')]=function(_0x5e7262,_0x28a1b1){if(!_0x5e7262['body'][_0xd5d5('0x16')])throw new Error(_0xd5d5('0x39'));if(!_0x5e7262[_0xd5d5('0x3a')][_0xd5d5('0x32')])throw new Error(_0xd5d5('0x3b'));var _0x30e1aa=db['CloudProvider']['rawAttributes'][_0xd5d5('0x32')][_0xd5d5('0x3c')];if(!_0x30e1aa[_0xd5d5('0x3d')](_0x5e7262[_0xd5d5('0x3a')][_0xd5d5('0x32')]))throw new Error(_0xd5d5('0x3e')+_0x30e1aa[_0xd5d5('0x3f')](',\x20'));if(_0x5e7262[_0xd5d5('0x3a')]['service']===_0xd5d5('0x33')&&_0x5e7262['body'][_0xd5d5('0x37')]){_0x5e7262[_0xd5d5('0x3a')][_0xd5d5('0x37')]=encryptor[_0xd5d5('0x40')](_0x5e7262[_0xd5d5('0x3a')][_0xd5d5('0x37')]);}return db[_0xd5d5('0x41')][_0xd5d5('0x38')](_0x5e7262[_0xd5d5('0x3a')],{})[_0xd5d5('0x12')](respondWithResult(_0x28a1b1,0xc9))['catch'](handleError(_0x28a1b1,null));};exports[_0xd5d5('0x42')]=function(_0x3a234a,_0x50f31b){if(_0x3a234a[_0xd5d5('0x3a')]['id']){delete _0x3a234a[_0xd5d5('0x3a')]['id'];}return db['CloudProvider'][_0xd5d5('0x36')]({'where':{'id':_0x3a234a['params']['id']}})[_0xd5d5('0x12')](handleEntityNotFound(_0x50f31b,null))[_0xd5d5('0x12')](function(_0x35f1c3){if(_0x35f1c3[_0xd5d5('0x32')]===_0xd5d5('0x33')&&_0x3a234a[_0xd5d5('0x3a')][_0xd5d5('0x37')]){_0x3a234a[_0xd5d5('0x3a')][_0xd5d5('0x37')]=encryptor[_0xd5d5('0x40')](_0x3a234a['body']['data3']);}return _0x35f1c3;})[_0xd5d5('0x12')](saveUpdates(_0x3a234a['body'],null))[_0xd5d5('0x12')](respondWithResult(_0x50f31b,null))['catch'](handleError(_0x50f31b,null));};exports[_0xd5d5('0x13')]=function(_0x2c5fcd,_0x30f6e3){return db['CloudProvider'][_0xd5d5('0x36')]({'where':{'id':_0x2c5fcd['params']['id']}})[_0xd5d5('0x12')](handleEntityNotFound(_0x30f6e3,null))['then'](removeEntity(_0x30f6e3,null))['catch'](handleError(_0x30f6e3,null));};exports['oauth2MicrosoftAuthorize']=function(_0xc1cea4,_0x2f6a7f){return db[_0xd5d5('0x41')][_0xd5d5('0x43')]({'where':{'id':_0xc1cea4[_0xd5d5('0x44')]['id']},'raw':!![]})[_0xd5d5('0x12')](function(_0x51f680){if(!_0x51f680)return _0x2f6a7f[_0xd5d5('0x45')](0x194);return{'url':oauth[_0xd5d5('0x46')](_0x51f680,_0xc1cea4['user']['id'])};})[_0xd5d5('0x12')](respondWithResult(_0x2f6a7f,null))[_0xd5d5('0x47')](handleError(_0x2f6a7f,null));};exports[_0xd5d5('0x48')]=function(_0x2378dc,_0x4ad572){var _0x6da589=_0x2378dc[_0xd5d5('0x3a')];var _0x3be423;var _0x357e77;if(_0x6da589['error'])throw _0x6da589;redis[_0xd5d5('0x49')](_0x6da589['state'])[_0xd5d5('0x12')](function(_0xf500d9){if(!_0xf500d9)throw new Error(_0xd5d5('0x4a'));_0x3be423=JSON[_0xd5d5('0x4b')](_0xf500d9);var _0x2671f6=Buffer[_0xd5d5('0x4c')](_0x6da589[_0xd5d5('0x4d')],_0xd5d5('0x4e'))['toString'](_0xd5d5('0x4f'));_0x357e77=JSON[_0xd5d5('0x4b')](_0x2671f6);if(!oauth[_0xd5d5('0x50')](_0x6da589[_0xd5d5('0x51')],_0x3be423[_0xd5d5('0x52')]))throw new Error(_0xd5d5('0x53'));redis[_0xd5d5('0x54')](_0x6da589[_0xd5d5('0x4d')]);return oauth['getOauth2MicrosoftAccessToken'](_0x6da589[_0xd5d5('0x55')],_0x3be423);})['then'](function(_0x1a7f6f){_0x3be423[_0xd5d5('0x56')]=_0x1a7f6f[_0xd5d5('0x57')];_0x3be423[_0xd5d5('0x58')]=_0x1a7f6f[_0xd5d5('0x59')];return db[_0xd5d5('0x41')][_0xd5d5('0x42')]({'data5':_0x3be423[_0xd5d5('0x56')],'data6':_0x3be423[_0xd5d5('0x58')]},{'where':{'id':_0x3be423['id']}});})[_0xd5d5('0x12')](function(){oauth[_0xd5d5('0x5a')](_0x3be423);socket[_0xd5d5('0x5b')](_0xd5d5('0x5c'),{'id':_0x357e77['id']});return;})['then'](respondWithStatusCode(_0x4ad572,null))[_0xd5d5('0x47')](function(_0x318e61){if(_0x357e77){socket[_0xd5d5('0x5b')]('microsoftAuthorization:error',{'id':_0x357e77['id']});}if(!_0x3be423){logger[_0xd5d5('0x5d')](_0xd5d5('0x5e'),_0x318e61);return _0x4ad572[_0xd5d5('0xb')](0x1f4)[_0xd5d5('0x17')](_0x318e61['message']);}logger[_0xd5d5('0x5d')](_0xd5d5('0x5f'),_0x3be423['id'],JSON['stringify'](_0x318e61));});}; \ No newline at end of file +var _0xac69=['ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','offset','undefined','count','limit','Content-Range','then','destroy','end','error','stack','name','send','index','CloudProvider','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','includeAll','findAll','service','MicrosoftAzure','decryptString','data3','catch','show','params','length','include','options','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','create','update','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xac69,0x72));var _0x9ac6=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xac69[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x9ac6('0x0'));var Redis=require(_0x9ac6('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require('../../components/encryptor');var config=require(_0x9ac6('0x2'));var logger=require(_0x9ac6('0x3'))(_0x9ac6('0x4'));var db=require(_0x9ac6('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x9ac6('0x6')]=_[_0x9ac6('0x7')](config[_0x9ac6('0x6')],{'host':_0x9ac6('0x8'),'port':0x18eb});var socket=require(_0x9ac6('0x9'))(new Redis(config[_0x9ac6('0x6')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x5e6250,_0x582370){_0x582370=_0x582370||0xcc;return function(_0x23bbf3){if(_0x23bbf3){return _0x5e6250[_0x9ac6('0xa')](_0x582370);}return _0x5e6250[_0x9ac6('0xb')](_0x582370)['end']();};}function respondWithResult(_0xdefc9c,_0x55c96f){_0x55c96f=_0x55c96f||0xc8;return function(_0x2faaa4){if(_0x2faaa4){return _0xdefc9c['status'](_0x55c96f)['json'](_0x2faaa4);}};}function respondWithFilteredResult(_0x598fc4,_0xaac070){return function(_0x48eb23){if(_0x48eb23){var _0x44b863=typeof _0xaac070[_0x9ac6('0xc')]===_0x9ac6('0xd')&&typeof _0xaac070['limit']===_0x9ac6('0xd');var _0x5760eb=_0x48eb23[_0x9ac6('0xe')];var _0x2d51bc=_0x44b863?0x0:_0xaac070[_0x9ac6('0xc')];var _0x560534=_0x44b863?_0x48eb23[_0x9ac6('0xe')]:_0xaac070[_0x9ac6('0xc')]+_0xaac070[_0x9ac6('0xf')];var _0xaffa32;if(_0x560534>=_0x5760eb){_0x560534=_0x5760eb;_0xaffa32=0xc8;}else{_0xaffa32=0xce;}_0x598fc4[_0x9ac6('0xb')](_0xaffa32);return _0x598fc4['set'](_0x9ac6('0x10'),_0x2d51bc+'-'+_0x560534+'/'+_0x5760eb)['json'](_0x48eb23);}return null;};}function saveUpdates(_0x375de6){return function(_0x5c8212){if(_0x5c8212){return _0x5c8212['update'](_0x375de6)[_0x9ac6('0x11')](function(_0x463b64){return _0x463b64;});}return null;};}function removeEntity(_0x13fd33){return function(_0x3fc005){if(_0x3fc005){return _0x3fc005[_0x9ac6('0x12')]()[_0x9ac6('0x11')](function(){_0x13fd33['status'](0xcc)[_0x9ac6('0x13')]();});}};}function handleEntityNotFound(_0x5180f1){return function(_0x4abdd9){if(!_0x4abdd9){_0x5180f1[_0x9ac6('0xa')](0x194);}return _0x4abdd9;};}function handleError(_0x1a6a11,_0x51b645){_0x51b645=_0x51b645||0x1f4;return function(_0x2c8696){logger[_0x9ac6('0x14')](_0x2c8696[_0x9ac6('0x15')]);if(_0x2c8696[_0x9ac6('0x16')]){delete _0x2c8696[_0x9ac6('0x16')];}_0x1a6a11['status'](_0x51b645)[_0x9ac6('0x17')](_0x2c8696);};}function maskClientSecret(_0x1545c0){return _['padEnd'](_0x1545c0['slice'](0x0,0x3),0x14,'*');}exports[_0x9ac6('0x18')]=function(_0x705869,_0x48af83){var _0x307af0={},_0x4433dd={},_0x4ee774={'count':0x0,'rows':[]};var _0x4853e4=_['map'](db[_0x9ac6('0x19')][_0x9ac6('0x1a')],function(_0x1e66f7){return{'name':_0x1e66f7[_0x9ac6('0x1b')],'type':_0x1e66f7['type'][_0x9ac6('0x1c')]};});_0x4433dd[_0x9ac6('0x1d')]=_[_0x9ac6('0x1e')](_0x4853e4,_0x9ac6('0x16'));_0x4433dd[_0x9ac6('0x1f')]=_[_0x9ac6('0x20')](_0x705869[_0x9ac6('0x1f')]);_0x4433dd['filters']=_[_0x9ac6('0x21')](_0x4433dd[_0x9ac6('0x1d')],_0x4433dd['query']);_0x307af0[_0x9ac6('0x22')]=_['intersection'](_0x4433dd[_0x9ac6('0x1d')],qs[_0x9ac6('0x23')](_0x705869[_0x9ac6('0x1f')][_0x9ac6('0x23')]));_0x307af0[_0x9ac6('0x22')]=_0x307af0[_0x9ac6('0x22')]['length']?_0x307af0[_0x9ac6('0x22')]:_0x4433dd['model'];if(!_0x705869[_0x9ac6('0x1f')][_0x9ac6('0x24')](_0x9ac6('0x25'))){_0x307af0[_0x9ac6('0xf')]=qs[_0x9ac6('0xf')](_0x705869[_0x9ac6('0x1f')][_0x9ac6('0xf')]);_0x307af0[_0x9ac6('0xc')]=qs[_0x9ac6('0xc')](_0x705869[_0x9ac6('0x1f')][_0x9ac6('0xc')]);}_0x307af0['order']=qs[_0x9ac6('0x26')](_0x705869['query'][_0x9ac6('0x26')]);_0x307af0[_0x9ac6('0x27')]=qs[_0x9ac6('0x28')](_[_0x9ac6('0x29')](_0x705869['query'],_0x4433dd[_0x9ac6('0x28')]),_0x4853e4);if(_0x705869[_0x9ac6('0x1f')]['filter']){_0x307af0[_0x9ac6('0x27')]=_[_0x9ac6('0x2a')](_0x307af0['where'],{'$or':_[_0x9ac6('0x1e')](_0x4853e4,function(_0x48b388){if(_0x48b388[_0x9ac6('0x2b')]!==_0x9ac6('0x2c')){var _0x34c04c={};_0x34c04c[_0x48b388[_0x9ac6('0x16')]]={'$like':'%'+_0x705869[_0x9ac6('0x1f')]['filter']+'%'};return _0x34c04c;}})});}_0x307af0=_['merge']({},_0x307af0,_0x705869['options']);var _0x55247e={'where':_0x307af0['where']};return db[_0x9ac6('0x19')]['count'](_0x55247e)[_0x9ac6('0x11')](function(_0x426d86){_0x4ee774[_0x9ac6('0xe')]=_0x426d86;if(_0x705869[_0x9ac6('0x1f')][_0x9ac6('0x2d')]){_0x307af0['include']=[{'all':!![]}];}return db[_0x9ac6('0x19')][_0x9ac6('0x2e')](_0x307af0);})['then'](function(_0x74ad88){_0x4ee774['rows']=_[_0x9ac6('0x1e')](_0x74ad88,function(_0x30bd9b){if(_0x30bd9b[_0x9ac6('0x2f')]===_0x9ac6('0x30')){var _0x5b62c3=encryptor[_0x9ac6('0x31')](_0x30bd9b[_0x9ac6('0x32')]);_0x30bd9b[_0x9ac6('0x32')]=maskClientSecret(_0x5b62c3);}return _0x30bd9b;});return _0x4ee774;})[_0x9ac6('0x11')](respondWithFilteredResult(_0x48af83,_0x307af0))[_0x9ac6('0x33')](handleError(_0x48af83,null));};exports[_0x9ac6('0x34')]=function(_0x1cc93e,_0x46cc31){var _0x14e98f={'raw':!![],'where':{'id':_0x1cc93e[_0x9ac6('0x35')]['id']}},_0x3ea844={};_0x3ea844[_0x9ac6('0x1d')]=_[_0x9ac6('0x20')](db[_0x9ac6('0x19')]['rawAttributes']);_0x3ea844[_0x9ac6('0x1f')]=_[_0x9ac6('0x20')](_0x1cc93e[_0x9ac6('0x1f')]);_0x3ea844[_0x9ac6('0x28')]=_[_0x9ac6('0x21')](_0x3ea844[_0x9ac6('0x1d')],_0x3ea844[_0x9ac6('0x1f')]);_0x14e98f['attributes']=_['intersection'](_0x3ea844[_0x9ac6('0x1d')],qs[_0x9ac6('0x23')](_0x1cc93e['query']['fields']));_0x14e98f['attributes']=_0x14e98f[_0x9ac6('0x22')][_0x9ac6('0x36')]?_0x14e98f['attributes']:_0x3ea844['model'];if(_0x1cc93e[_0x9ac6('0x1f')][_0x9ac6('0x2d')]){_0x14e98f[_0x9ac6('0x37')]=[{'all':!![]}];}_0x14e98f=_[_0x9ac6('0x2a')]({},_0x14e98f,_0x1cc93e[_0x9ac6('0x38')]);return db['CloudProvider'][_0x9ac6('0x39')](_0x14e98f)[_0x9ac6('0x11')](handleEntityNotFound(_0x46cc31,null))[_0x9ac6('0x11')](function(_0x39305c){if(_0x39305c[_0x9ac6('0x2f')]==='MicrosoftAzure'){var _0x358a07=encryptor['decryptString'](_0x39305c[_0x9ac6('0x32')]);_0x39305c[_0x9ac6('0x32')]=maskClientSecret(_0x358a07);}return _0x39305c;})[_0x9ac6('0x11')](respondWithResult(_0x46cc31,null))['catch'](handleError(_0x46cc31,null));};exports['create']=function(_0x489b61,_0x148aba){if(!_0x489b61[_0x9ac6('0x3a')][_0x9ac6('0x16')])throw new Error(_0x9ac6('0x3b'));if(!_0x489b61[_0x9ac6('0x3a')][_0x9ac6('0x2f')])throw new Error(_0x9ac6('0x3c'));var _0x4ca36a=db['CloudProvider']['rawAttributes'][_0x9ac6('0x2f')]['values'];if(!_0x4ca36a[_0x9ac6('0x3d')](_0x489b61['body'][_0x9ac6('0x2f')]))throw new Error(_0x9ac6('0x3e')+_0x4ca36a[_0x9ac6('0x3f')](',\x20'));if(_0x489b61[_0x9ac6('0x3a')]['service']===_0x9ac6('0x30')&&_0x489b61[_0x9ac6('0x3a')]['data3']){_0x489b61[_0x9ac6('0x3a')][_0x9ac6('0x32')]=encryptor['encryptString'](_0x489b61[_0x9ac6('0x3a')]['data3']);}return db[_0x9ac6('0x19')][_0x9ac6('0x40')](_0x489b61[_0x9ac6('0x3a')],{})['then'](respondWithResult(_0x148aba,0xc9))[_0x9ac6('0x33')](handleError(_0x148aba,null));};exports[_0x9ac6('0x41')]=function(_0x281581,_0x127ccc){if(_0x281581[_0x9ac6('0x3a')]['id']){delete _0x281581[_0x9ac6('0x3a')]['id'];}return db[_0x9ac6('0x19')]['find']({'where':{'id':_0x281581[_0x9ac6('0x35')]['id']}})[_0x9ac6('0x11')](handleEntityNotFound(_0x127ccc,null))[_0x9ac6('0x11')](function(_0x35adeb){if(_0x35adeb[_0x9ac6('0x2f')]===_0x9ac6('0x30')&&_0x281581[_0x9ac6('0x3a')][_0x9ac6('0x32')]){_0x281581[_0x9ac6('0x3a')][_0x9ac6('0x32')]=encryptor[_0x9ac6('0x42')](_0x281581[_0x9ac6('0x3a')][_0x9ac6('0x32')]);}return _0x35adeb;})[_0x9ac6('0x11')](saveUpdates(_0x281581['body'],null))[_0x9ac6('0x11')](respondWithResult(_0x127ccc,null))['catch'](handleError(_0x127ccc,null));};exports[_0x9ac6('0x12')]=function(_0x316c53,_0x147961){return db[_0x9ac6('0x19')]['find']({'where':{'id':_0x316c53['params']['id']}})[_0x9ac6('0x11')](handleEntityNotFound(_0x147961,null))[_0x9ac6('0x11')](removeEntity(_0x147961,null))[_0x9ac6('0x33')](handleError(_0x147961,null));};exports[_0x9ac6('0x43')]=function(_0x584f8d,_0x311675){return db['CloudProvider'][_0x9ac6('0x44')]({'where':{'id':_0x584f8d['params']['id']},'raw':!![]})[_0x9ac6('0x11')](function(_0x7e0949){if(!_0x7e0949)return _0x311675[_0x9ac6('0xa')](0x194);return{'url':oauth[_0x9ac6('0x45')](_0x7e0949,_0x584f8d['user']['id'])};})[_0x9ac6('0x11')](respondWithResult(_0x311675,null))[_0x9ac6('0x33')](handleError(_0x311675,null));};exports[_0x9ac6('0x46')]=function(_0x49ace0,_0x43f2a7){var _0x475c4b=_0x49ace0[_0x9ac6('0x3a')];var _0x199b67;var _0x5cef1d;if(_0x475c4b[_0x9ac6('0x14')])throw _0x475c4b;redis[_0x9ac6('0x47')](_0x475c4b[_0x9ac6('0x48')])[_0x9ac6('0x11')](function(_0x47e86c){if(!_0x47e86c)throw new Error(_0x9ac6('0x49'));_0x199b67=JSON[_0x9ac6('0x4a')](_0x47e86c);var _0xc7f617=Buffer[_0x9ac6('0x4b')](_0x475c4b[_0x9ac6('0x48')],_0x9ac6('0x4c'))[_0x9ac6('0x4d')](_0x9ac6('0x4e'));_0x5cef1d=JSON['parse'](_0xc7f617);if(!oauth[_0x9ac6('0x4f')](_0x475c4b[_0x9ac6('0x50')],_0x199b67[_0x9ac6('0x51')]))throw new Error(_0x9ac6('0x52'));redis[_0x9ac6('0x53')](_0x475c4b[_0x9ac6('0x48')]);return oauth[_0x9ac6('0x54')](_0x475c4b[_0x9ac6('0x55')],_0x199b67);})['then'](function(_0x83390c){_0x199b67[_0x9ac6('0x56')]=_0x83390c['access_token'];_0x199b67[_0x9ac6('0x57')]=_0x83390c[_0x9ac6('0x58')];return db[_0x9ac6('0x19')]['update']({'data5':_0x199b67[_0x9ac6('0x56')],'data6':_0x199b67[_0x9ac6('0x57')]},{'where':{'id':_0x199b67['id']}});})[_0x9ac6('0x11')](function(){oauth[_0x9ac6('0x59')](_0x199b67);socket[_0x9ac6('0x5a')](_0x9ac6('0x5b'),{'id':_0x5cef1d['id']});return;})[_0x9ac6('0x11')](respondWithStatusCode(_0x43f2a7,null))[_0x9ac6('0x33')](function(_0xeda6ee){if(_0x5cef1d){socket[_0x9ac6('0x5a')](_0x9ac6('0x5c'),{'id':_0x5cef1d['id']});}if(!_0x199b67){logger['error'](_0x9ac6('0x5d'),_0xeda6ee);return _0x43f2a7[_0x9ac6('0xb')](0x1f4)[_0x9ac6('0x17')](_0xeda6ee['message']);}logger[_0x9ac6('0x14')](_0x9ac6('0x5e'),_0x199b67['id'],JSON[_0x9ac6('0x5f')](_0xeda6ee));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 3e96324..c8d4307 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 _0x4424=['../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3dbba2,_0x58ec32){var _0x4acd23=function(_0x93e09f){while(--_0x93e09f){_0x3dbba2['push'](_0x3dbba2['shift']());}};_0x4acd23(++_0x58ec32);}(_0x4424,0x157));var _0x4442=function(_0x54a1b9,_0x1433e4){_0x54a1b9=_0x54a1b9-0x0;var _0x10fa2f=_0x4424[_0x54a1b9];return _0x10fa2f;};'use strict';var _=require(_0x4442('0x0'));var util=require(_0x4442('0x1'));var logger=require('../../config/logger')(_0x4442('0x2'));var moment=require(_0x4442('0x3'));var BPromise=require(_0x4442('0x4'));var rp=require(_0x4442('0x5'));var fs=require('fs');var path=require(_0x4442('0x6'));var rimraf=require(_0x4442('0x7'));var config=require(_0x4442('0x8'));var attributes=require(_0x4442('0x9'));module[_0x4442('0xa')]=function(_0x3971c4,_0x353935){return _0x3971c4['define'](_0x4442('0xb'),attributes,{'tableName':_0x4442('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc81=['exports','define','cloud_providers','lodash','api','moment','path','rimraf'];(function(_0x20790b,_0x30c3e4){var _0x47a3b6=function(_0x2f6c91){while(--_0x2f6c91){_0x20790b['push'](_0x20790b['shift']());}};_0x47a3b6(++_0x30c3e4);}(_0xbc81,0xe3));var _0x1bc8=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xbc81[_0x648163];return _0x199d4d;};'use strict';var _=require(_0x1bc8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1bc8('0x1'));var moment=require(_0x1bc8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bc8('0x3'));var rimraf=require(_0x1bc8('0x4'));var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0x1bc8('0x5')]=function(_0x3c4242,_0x1c31f3){return _0x3c4242[_0x1bc8('0x6')]('CloudProvider',attributes,{'tableName':_0x1bc8('0x7'),'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 140f931..552878d 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 _0xfcb0=['issuer','aud','audience','nonce','unix','resolve','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','{TENANT_ID}','then','data5','update','catch','error','authorization_code','intervals','bind','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','ioredis','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','type','Dynamics365','push','data7','/.default','join','data2','from','stringify','toString','base64','randomBytes','hex','client_id','data1','data4','response_mode','scope','state','prompt','login','map','key','oauth2Claims','replace','set','decode','payload','iss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfcb0,0xfe));var _0x0fcb=function(_0x106058,_0x373fca){_0x106058=_0x106058-0x0;var _0x3f03ba=_0xfcb0[_0x106058];return _0x3f03ba;};'use strict';var _=require(_0x0fcb('0x0'));var crypto=require('crypto');var jwt=require(_0x0fcb('0x1'));var moment=require('moment');var Redis=require(_0x0fcb('0x2'));var rp=require('request-promise');var util=require(_0x0fcb('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x0fcb('0x4'));var logger=require(_0x0fcb('0x5'))(_0x0fcb('0x6'));var schedule=require(_0x0fcb('0x7'));var db=require(_0x0fcb('0x8'))['db'];config[_0x0fcb('0x9')]=_[_0x0fcb('0xa')](config[_0x0fcb('0x9')],{'host':_0x0fcb('0xb'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0x0fcb('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x0fcb('0xd'),_0x0fcb('0xe'),_0x0fcb('0xf'),_0x0fcb('0x10'),_0x0fcb('0x11'),_0x0fcb('0x12'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid',_0x0fcb('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x0fcb('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x0fcb('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1d636a){var _0xdc3f8b=_['map'](AZURE_AUTH_SCOPES[_0x1d636a[_0x0fcb('0x15')]]);if(_0x1d636a['type']===_0x0fcb('0x16'))_0xdc3f8b[_0x0fcb('0x17')](_0x1d636a[_0x0fcb('0x18')]+_0x0fcb('0x19'));return _0xdc3f8b[_0x0fcb('0x1a')]('\x20');}function getAccessTokenScope(_0x51a377){if(_0x51a377[_0x0fcb('0x15')]==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x51a377[_0x0fcb('0x15')]===_0x0fcb('0x16'))return _0x51a377[_0x0fcb('0x18')]+_0x0fcb('0x19');}function generateMicrosoftAuthorizationUrl(_0xa39800,_0x5bbdb1){var _0x564d1b=MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0xa39800[_0x0fcb('0x1b')]);var _0x33dcea=['code','id_token'];var _0xe12d08=Buffer[_0x0fcb('0x1c')](JSON[_0x0fcb('0x1d')]({'id':_0x5bbdb1}))[_0x0fcb('0x1e')](_0x0fcb('0x1f'));var _0x421da1=crypto[_0x0fcb('0x20')](0x10)['toString'](_0x0fcb('0x21'));var _0x178b27=getAuthorizationScopes(_0xa39800);var _0x482af0=[{'key':_0x0fcb('0x22'),'value':_0xa39800[_0x0fcb('0x23')]},{'key':'response_type','value':encodeURIComponent(_0x33dcea[_0x0fcb('0x1a')]('\x20'))},{'key':'redirect_uri','value':_0xa39800[_0x0fcb('0x24')]},{'key':_0x0fcb('0x25'),'value':'form_post'},{'key':_0x0fcb('0x26'),'value':encodeURIComponent(_0x178b27)},{'key':_0x0fcb('0x27'),'value':_0xe12d08},{'key':'nonce','value':_0x421da1},{'key':_0x0fcb('0x28'),'value':_0x0fcb('0x29')}];var _0x3dc4ad=_0x564d1b+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0fcb('0x2a')](_0x482af0,function(_0x2e34ea){return _0x2e34ea[_0x0fcb('0x2b')]+'='+_0x2e34ea['value'];})[_0x0fcb('0x1a')]('&');_0xa39800[_0x0fcb('0x2c')]={'issuer':_0x564d1b[_0x0fcb('0x2d')]('oauth2/',''),'audience':_0xa39800[_0x0fcb('0x23')],'state':_0xe12d08,'nonce':_0x421da1};redis[_0x0fcb('0x2e')](_0xe12d08,JSON[_0x0fcb('0x1d')](_0xa39800));return _0x3dc4ad;}function isValidIdToken(_0x5f0812,_0x1b0171){try{var _0x7f8b71=jwt[_0x0fcb('0x2f')](_0x5f0812,{'complete':!![]});var _0x3eb1e7=_0x7f8b71[_0x0fcb('0x30')];if(_0x3eb1e7[_0x0fcb('0x31')]!==_0x1b0171[_0x0fcb('0x32')])return![];if(_0x3eb1e7[_0x0fcb('0x33')]!==_0x1b0171[_0x0fcb('0x34')])return![];if(_0x3eb1e7[_0x0fcb('0x35')]!==_0x1b0171[_0x0fcb('0x35')])return![];if(moment()['isAfter'](moment[_0x0fcb('0x36')](_0x3eb1e7['exp'])))return![];return!![];}catch(_0x1e28c1){throw _0x1e28c1;}}function refreshOauth2MicrosoftAccessToken(_0xd3f5b6){return Promise[_0x0fcb('0x37')]()['then'](function(){if(_0xd3f5b6[_0x0fcb('0x38')])return _0xd3f5b6;return db[_0x0fcb('0x39')][_0x0fcb('0x3a')]({'where':{'id':_0xd3f5b6['id']},'raw':!![]});})['then'](function(_0x2fa97a){var _0x5527c5={'grant_type':_0x0fcb('0x3b'),'refresh_token':_0x2fa97a[_0x0fcb('0x3c')],'scope':getAccessTokenScope(_0x2fa97a),'redirect_uri':_0x2fa97a['data4'],'client_id':_0x2fa97a[_0x0fcb('0x23')],'client_secret':encryptor[_0x0fcb('0x3d')](_0x2fa97a[_0x0fcb('0x38')])};var _0x1a3480={'method':_0x0fcb('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x0fcb('0x3f'),_0x2fa97a[_0x0fcb('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5527c5,'json':!![]};return rp(_0x1a3480);})[_0x0fcb('0x40')](function(_0x3847ea){_0xd3f5b6[_0x0fcb('0x41')]=_0x3847ea['access_token'];_0xd3f5b6['data6']=_0x3847ea['refresh_token'];return db[_0x0fcb('0x39')][_0x0fcb('0x42')]({'data5':_0xd3f5b6[_0x0fcb('0x41')],'data6':_0xd3f5b6[_0x0fcb('0x3c')]},{'where':{'id':_0xd3f5b6['id']}});})['then'](function(){return _0xd3f5b6;})[_0x0fcb('0x43')](function(_0x4cf189){logger[_0x0fcb('0x44')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0xd3f5b6['id'],_0x4cf189);});}function getOauth2MicrosoftAccessToken(_0x1ab871,_0x2788c1){var _0x27e8b2={'grant_type':_0x0fcb('0x45'),'code':_0x1ab871,'scope':getAccessTokenScope(_0x2788c1),'redirect_uri':_0x2788c1[_0x0fcb('0x24')],'client_id':_0x2788c1[_0x0fcb('0x23')],'client_secret':encryptor[_0x0fcb('0x3d')](_0x2788c1['data3'])};var _0x2fd0cf={'method':_0x0fcb('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x0fcb('0x2d')]('{TENANT_ID}',_0x2788c1[_0x0fcb('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x27e8b2,'json':!![]};return rp(_0x2fd0cf);}function startRefreshInterval(_0x848a1f){var _0x5e8223=schedule[_0x0fcb('0x46')];if(_0x5e8223[_0x848a1f['id']])clearInterval(_0x5e8223[_0x848a1f['id']]);_0x5e8223[_0x848a1f['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0fcb('0x47')](this,{'id':_0x848a1f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0fcb('0x46')]=_0x5e8223;}function startAllRefreshIntervals(){return db[_0x0fcb('0x39')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x0fcb('0x40')](function(_0x4b73fd){var _0x4a5783=_0x4b73fd[_0x0fcb('0x2a')](function(_0x3c87f0){return refreshOauth2MicrosoftAccessToken(_0x3c87f0)[_0x0fcb('0x40')](function(_0x5f3376){startRefreshInterval(_0x5f3376);});});return Promise[_0x0fcb('0x48')](_0x4a5783);})['catch'](function(_0x3b6cff){var _0x5d93cc=_0x3b6cff?util[_0x0fcb('0x49')](_0x3b6cff,{'showHidden':![],'depth':null}):'';logger['error'](_0x0fcb('0x4a'),_0x5d93cc);});}module[_0x0fcb('0x4b')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x6169=['update','then','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','/authorize','type','Dynamics365','push','data7','/.default','{TENANT_ID}','data2','code','stringify','toString','randomBytes','hex','client_id','data1','response_type','join','redirect_uri','data4','response_mode','form_post','scope','state','nonce','login','map','value','oauth2Claims','oauth2/','set','decode','payload','iss','issuer','aud','audience','isAfter','unix','resolve','CloudProvider','findOne','refresh_token','data6','decryptString','data3','POST','data5','access_token'];(function(_0x25ca44,_0x111633){var _0x4897c1=function(_0xf344b9){while(--_0xf344b9){_0x25ca44['push'](_0x25ca44['shift']());}};_0x4897c1(++_0x111633);}(_0x6169,0x1d3));var _0x9616=function(_0x379800,_0x58cced){_0x379800=_0x379800-0x0;var _0x206b4e=_0x6169[_0x379800];return _0x206b4e;};'use strict';var _=require(_0x9616('0x0'));var crypto=require(_0x9616('0x1'));var jwt=require(_0x9616('0x2'));var moment=require('moment');var Redis=require(_0x9616('0x3'));var rp=require('request-promise');var util=require('util');var encryptor=require(_0x9616('0x4'));var config=require(_0x9616('0x5'));var logger=require(_0x9616('0x6'))(_0x9616('0x7'));var schedule=require(_0x9616('0x8'));var db=require('../../mysqldb')['db'];config[_0x9616('0x9')]=_[_0x9616('0xa')](config[_0x9616('0x9')],{'host':_0x9616('0xb'),'port':0x18eb});var redis=new Redis(config[_0x9616('0x9')]);var MICROSOFT_AUTH_URL=_0x9616('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9616('0xd'),_0x9616('0xe'),'email',_0x9616('0xf'),_0x9616('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x9616('0xd'),_0x9616('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x9616('0x11');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x21a0b3){var _0x201149=_['map'](AZURE_AUTH_SCOPES[_0x21a0b3[_0x9616('0x12')]]);if(_0x21a0b3['type']===_0x9616('0x13'))_0x201149[_0x9616('0x14')](_0x21a0b3[_0x9616('0x15')]+_0x9616('0x16'));return _0x201149['join']('\x20');}function getAccessTokenScope(_0x4f18c2){if(_0x4f18c2[_0x9616('0x12')]==='Outlook365')return _0x9616('0x10');if(_0x4f18c2[_0x9616('0x12')]===_0x9616('0x13'))return _0x4f18c2['data7']+_0x9616('0x16');}function generateMicrosoftAuthorizationUrl(_0x364ba6,_0x21aaf5){var _0x32c607=MICROSOFT_AUTH_URL['replace'](_0x9616('0x17'),_0x364ba6[_0x9616('0x18')]);var _0x26d767=[_0x9616('0x19'),'id_token'];var _0x270c84=Buffer['from'](JSON[_0x9616('0x1a')]({'id':_0x21aaf5}))[_0x9616('0x1b')]('base64');var _0x2b00af=crypto[_0x9616('0x1c')](0x10)[_0x9616('0x1b')](_0x9616('0x1d'));var _0x2ecc4b=getAuthorizationScopes(_0x364ba6);var _0x273247=[{'key':_0x9616('0x1e'),'value':_0x364ba6[_0x9616('0x1f')]},{'key':_0x9616('0x20'),'value':encodeURIComponent(_0x26d767[_0x9616('0x21')]('\x20'))},{'key':_0x9616('0x22'),'value':_0x364ba6[_0x9616('0x23')]},{'key':_0x9616('0x24'),'value':_0x9616('0x25')},{'key':_0x9616('0x26'),'value':encodeURIComponent(_0x2ecc4b)},{'key':_0x9616('0x27'),'value':_0x270c84},{'key':_0x9616('0x28'),'value':_0x2b00af},{'key':'prompt','value':_0x9616('0x29')}];var _0x2d678a=_0x32c607+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x9616('0x2a')](_0x273247,function(_0x53b5a6){return _0x53b5a6['key']+'='+_0x53b5a6[_0x9616('0x2b')];})[_0x9616('0x21')]('&');_0x364ba6[_0x9616('0x2c')]={'issuer':_0x32c607['replace'](_0x9616('0x2d'),''),'audience':_0x364ba6[_0x9616('0x1f')],'state':_0x270c84,'nonce':_0x2b00af};redis[_0x9616('0x2e')](_0x270c84,JSON[_0x9616('0x1a')](_0x364ba6));return _0x2d678a;}function isValidIdToken(_0x14fea4,_0x25b3a6){try{var _0x173ab8=jwt[_0x9616('0x2f')](_0x14fea4,{'complete':!![]});var _0x3915f4=_0x173ab8[_0x9616('0x30')];if(_0x3915f4[_0x9616('0x31')]!==_0x25b3a6[_0x9616('0x32')])return![];if(_0x3915f4[_0x9616('0x33')]!==_0x25b3a6[_0x9616('0x34')])return![];if(_0x3915f4['nonce']!==_0x25b3a6[_0x9616('0x28')])return![];if(moment()[_0x9616('0x35')](moment[_0x9616('0x36')](_0x3915f4['exp'])))return![];return!![];}catch(_0x5dd772){throw _0x5dd772;}}function refreshOauth2MicrosoftAccessToken(_0x116a03){return Promise[_0x9616('0x37')]()['then'](function(){if(_0x116a03['data3'])return _0x116a03;return db[_0x9616('0x38')][_0x9616('0x39')]({'where':{'id':_0x116a03['id']},'raw':!![]});})['then'](function(_0x2a116f){var _0x1c0ce7={'grant_type':_0x9616('0x3a'),'refresh_token':_0x2a116f[_0x9616('0x3b')],'scope':getAccessTokenScope(_0x2a116f),'redirect_uri':_0x2a116f[_0x9616('0x23')],'client_id':_0x2a116f[_0x9616('0x1f')],'client_secret':encryptor[_0x9616('0x3c')](_0x2a116f[_0x9616('0x3d')])};var _0x2ca594={'method':_0x9616('0x3e'),'uri':MICROSOFT_AUTH_URL['replace'](_0x9616('0x17'),_0x2a116f['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1c0ce7,'json':!![]};return rp(_0x2ca594);})['then'](function(_0x59c2d5){_0x116a03[_0x9616('0x3f')]=_0x59c2d5[_0x9616('0x40')];_0x116a03[_0x9616('0x3b')]=_0x59c2d5['refresh_token'];return db['CloudProvider'][_0x9616('0x41')]({'data5':_0x116a03[_0x9616('0x3f')],'data6':_0x116a03[_0x9616('0x3b')]},{'where':{'id':_0x116a03['id']}});})[_0x9616('0x42')](function(){return _0x116a03;})[_0x9616('0x43')](function(_0x3f3731){logger[_0x9616('0x44')](_0x9616('0x45'),_0x116a03['id'],_0x3f3731);});}function getOauth2MicrosoftAccessToken(_0x2eb4f4,_0x3e3ccc){var _0x27b36e={'grant_type':_0x9616('0x46'),'code':_0x2eb4f4,'scope':getAccessTokenScope(_0x3e3ccc),'redirect_uri':_0x3e3ccc[_0x9616('0x23')],'client_id':_0x3e3ccc[_0x9616('0x1f')],'client_secret':encryptor[_0x9616('0x3c')](_0x3e3ccc[_0x9616('0x3d')])};var _0x58333a={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x9616('0x17'),_0x3e3ccc[_0x9616('0x18')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x27b36e,'json':!![]};return rp(_0x58333a);}function startRefreshInterval(_0x136541){var _0x5dcaf2=schedule[_0x9616('0x47')];if(_0x5dcaf2[_0x136541['id']])clearInterval(_0x5dcaf2[_0x136541['id']]);_0x5dcaf2[_0x136541['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x9616('0x48')](this,{'id':_0x136541['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x5dcaf2;}function startAllRefreshIntervals(){return db[_0x9616('0x38')][_0x9616('0x49')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x9616('0x42')](function(_0x162405){var _0xea25b6=_0x162405[_0x9616('0x2a')](function(_0x18169e){return refreshOauth2MicrosoftAccessToken(_0x18169e)[_0x9616('0x42')](function(_0x1f84b2){startRefreshInterval(_0x1f84b2);});});return Promise['all'](_0xea25b6);})[_0x9616('0x43')](function(_0x31120e){var _0x2ea37b=_0x31120e?util['inspect'](_0x31120e,{'showHidden':![],'depth':null}):'';logger[_0x9616('0x44')](_0x9616('0x4a'),_0x2ea37b);});}module[_0x9616('0x4b')]={'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 75bedde..01f69d4 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 _0xd906=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','moment'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xd906,0x6b));var _0x6d90=function(_0x13bd98,_0x39bddb){_0x13bd98=_0x13bd98-0x0;var _0x224816=_0xd906[_0x13bd98];return _0x224816;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6d90('0x0'));var BPromise=require(_0x6d90('0x1'));var rs=require(_0x6d90('0x2'));var fs=require('fs');var Redis=require(_0x6d90('0x3'));var db=require(_0x6d90('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d90('0x5'))(_0x6d90('0x6'));var config=require(_0x6d90('0x7'));var jayson=require(_0x6d90('0x8'));var client=jayson['client'][_0x6d90('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19eb61,_0xd120f6,_0x160c7d){return new BPromise(function(_0x219737,_0x5d0ed4){return client['request'](_0x19eb61,_0x160c7d)['then'](function(_0x41c0a3){logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));logger[_0x6d90('0xd')](_0x6d90('0xe'),_0xd120f6,_0x6d90('0xc'),JSON['stringify'](_0x41c0a3));if(_0x41c0a3[_0x6d90('0xf')]){if(_0x41c0a3['error'][_0x6d90('0x10')]===0x1f4){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);return _0x5d0ed4(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}logger[_0x6d90('0xf')](_0x6d90('0xb'),_0xd120f6,_0x41c0a3[_0x6d90('0xf')]['message']);return _0x219737(_0x41c0a3[_0x6d90('0xf')][_0x6d90('0x11')]);}else{logger[_0x6d90('0xa')](_0x6d90('0xb'),_0xd120f6,_0x6d90('0xc'));_0x219737(_0x41c0a3['result'][_0x6d90('0x11')]);}})['catch'](function(_0x379439){logger['error'](_0x6d90('0xb'),_0xd120f6,_0x379439);_0x5d0ed4(_0x379439);});});} \ 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','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'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')]('CloudProvider,\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')]('CloudProvider,\x20%s,\x20%s',_0x11ad23,_0x6709('0xe'));_0x30147f(_0x2d8c0b[_0x6709('0x14')][_0x6709('0x13')]);}})[_0x6709('0x15')](function(_0x4cab30){logger['error']('CloudProvider,\x20%s,\x20%s',_0x11ad23,_0x4cab30);_0x513ab6(_0x4cab30);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 33340b6..a9f052e 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','oauth2MicrosoftCallback','express','Router','../../components/auth/service','./cloudProvider.controller','isAuthenticated','index','get','/:id','post','update'];(function(_0x58ba5d,_0x447c80){var _0x193fab=function(_0x3c357d){while(--_0x3c357d){_0x58ba5d['push'](_0x58ba5d['shift']());}};_0x193fab(++_0x447c80);}(_0xdb28,0x106));var _0x8db2=function(_0x5880ef,_0x40816c){_0x5880ef=_0x5880ef-0x0;var _0x13f7cb=_0xdb28[_0x5880ef];return _0x13f7cb;};'use strict';var express=require(_0x8db2('0x0'));var router=express[_0x8db2('0x1')]();var auth=require(_0x8db2('0x2'));var controller=require(_0x8db2('0x3'));router['get']('/',auth[_0x8db2('0x4')](),controller[_0x8db2('0x5')]);router[_0x8db2('0x6')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller['show']);router[_0x8db2('0x8')]('/',auth[_0x8db2('0x4')](),controller['create']);router['put'](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0x9')]);router[_0x8db2('0xa')](_0x8db2('0x7'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xb')]);router['get'](_0x8db2('0xc'),auth[_0x8db2('0x4')](),controller[_0x8db2('0xd')]);router['post'](_0x8db2('0xe'),controller[_0x8db2('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0xe2c95e,_0x3e6545){var _0x42ce6f=function(_0x218482){while(--_0x218482){_0xe2c95e['push'](_0xe2c95e['shift']());}};_0x42ce6f(++_0x3e6545);}(_0x1261,0x144));var _0x1126=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x1261[_0x458363];return _0x4d0290;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c024935..eb54587 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 _0xab28=['name','sequelize','exports','STRING'];(function(_0x1c5fed,_0x5b2115){var _0x25c8e3=function(_0x3e6a29){while(--_0x3e6a29){_0x1c5fed['push'](_0x1c5fed['shift']());}};_0x25c8e3(++_0x5b2115);}(_0xab28,0x15d));var _0x8ab2=function(_0x453378,_0x2f360c){_0x453378=_0x453378-0x0;var _0xab3d9e=_0xab28[_0x453378];return _0xab3d9e;};'use strict';var Sequelize=require(_0x8ab2('0x0'));module[_0x8ab2('0x1')]={'name':{'type':Sequelize[_0x8ab2('0x2')],'unique':_0x8ab2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x8ab2('0x2')]},'website':{'type':Sequelize[_0x8ab2('0x2')]},'phone':{'type':Sequelize[_0x8ab2('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x8ab2('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x8ab2('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8ab2('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0x8ab2('0x2')]},'sPostalCode':{'type':Sequelize[_0x8ab2('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8ab2('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x90a1=['sequelize','name','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0x90a1,0xae));var _0x190a=function(_0x12f688,_0x585c25){_0x12f688=_0x12f688-0x0;var _0x59c3de=_0x90a1[_0x12f688];return _0x59c3de;};'use strict';var Sequelize=require(_0x190a('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x190a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x190a('0x2')]},'companyId':{'type':Sequelize[_0x190a('0x2')]},'website':{'type':Sequelize[_0x190a('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x190a('0x2')]},'type':{'type':Sequelize[_0x190a('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x190a('0x2')]},'city':{'type':Sequelize[_0x190a('0x2')]},'country':{'type':Sequelize[_0x190a('0x2')]},'email':{'type':Sequelize[_0x190a('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x190a('0x2')]},'sStreet':{'type':Sequelize[_0x190a('0x2')]},'sPostalCode':{'type':Sequelize[_0x190a('0x2')]},'sCity':{'type':Sequelize[_0x190a('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index acd11eb..d1e0794 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 _0x5ebf=['update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','CmCompany','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addContacts','CmContact','omit','getContacts','findOne','rawAttributes','order','map','nolimit','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x5ebf,0x13a));var _0xf5eb=function(_0x459503,_0x2140c6){_0x459503=_0x459503-0x0;var _0x343233=_0x5ebf[_0x459503];return _0x343233;};'use strict';var emlformat=require(_0xf5eb('0x0'));var rimraf=require(_0xf5eb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5eb('0x2'));var rp=require(_0xf5eb('0x3'));var moment=require(_0xf5eb('0x4'));var BPromise=require(_0xf5eb('0x5'));var Mustache=require(_0xf5eb('0x6'));var util=require(_0xf5eb('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xf5eb('0x8'));var ejs=require(_0xf5eb('0x9'));var fs=require('fs');var fs_extra=require(_0xf5eb('0xa'));var _=require(_0xf5eb('0xb'));var squel=require(_0xf5eb('0xc'));var crypto=require(_0xf5eb('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf5eb('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf5eb('0xf'));var Papa=require('papaparse');var Redis=require(_0xf5eb('0x10'));var authService=require(_0xf5eb('0x11'));var qs=require(_0xf5eb('0x12'));var as=require(_0xf5eb('0x13'));var hardwareService=require(_0xf5eb('0x14'));var logger=require(_0xf5eb('0x15'))(_0xf5eb('0x16'));var utils=require(_0xf5eb('0x17'));var config=require(_0xf5eb('0x18'));var licenseUtil=require(_0xf5eb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6078e5,_0x2ae3b8){_0x2ae3b8=_0x2ae3b8||0xcc;return function(_0x19248e){if(_0x19248e){return _0x6078e5[_0xf5eb('0x1a')](_0x2ae3b8);}return _0x6078e5[_0xf5eb('0x1b')](_0x2ae3b8)[_0xf5eb('0x1c')]();};}function respondWithResult(_0x3bd6d0,_0x1b732e){_0x1b732e=_0x1b732e||0xc8;return function(_0x1d9249){if(_0x1d9249){return _0x3bd6d0[_0xf5eb('0x1b')](_0x1b732e)[_0xf5eb('0x1d')](_0x1d9249);}};}function respondWithFilteredResult(_0x52d8b3,_0x1cc986){return function(_0x353093){if(_0x353093){var _0x48fa45=typeof _0x1cc986[_0xf5eb('0x1e')]===_0xf5eb('0x1f')&&typeof _0x1cc986['limit']===_0xf5eb('0x1f');var _0x19e6ea=_0x353093['count'];var _0x28c00b=_0x48fa45?0x0:_0x1cc986[_0xf5eb('0x1e')];var _0x108120=_0x48fa45?_0x353093[_0xf5eb('0x20')]:_0x1cc986['offset']+_0x1cc986[_0xf5eb('0x21')];var _0x5def04;if(_0x108120>=_0x19e6ea){_0x108120=_0x19e6ea;_0x5def04=0xc8;}else{_0x5def04=0xce;}_0x52d8b3[_0xf5eb('0x1b')](_0x5def04);return _0x52d8b3[_0xf5eb('0x22')](_0xf5eb('0x23'),_0x28c00b+'-'+_0x108120+'/'+_0x19e6ea)[_0xf5eb('0x1d')](_0x353093);}return null;};}function patchUpdates(_0xa348a1){return function(_0x460731){try{jsonpatch[_0xf5eb('0x24')](_0x460731,_0xa348a1,!![]);}catch(_0x468048){return BPromise[_0xf5eb('0x25')](_0x468048);}return _0x460731['save']();};}function saveUpdates(_0x95d09e,_0x205670){return function(_0x1e9220){if(_0x1e9220){return _0x1e9220[_0xf5eb('0x26')](_0x95d09e)[_0xf5eb('0x27')](function(_0x4b0473){return _0x4b0473;});}return null;};}function removeEntity(_0x4c5687,_0x1750cf){return function(_0x18cdea){if(_0x18cdea){return _0x18cdea[_0xf5eb('0x28')]()['then'](function(){var _0x276420=_0x18cdea[_0xf5eb('0x29')]({'plain':!![]});var _0x129378=_0xf5eb('0x2a');return db[_0xf5eb('0x2b')][_0xf5eb('0x28')]({'where':{'type':_0x129378,'resourceId':_0x276420['id']}})[_0xf5eb('0x27')](function(){return _0x18cdea;});})[_0xf5eb('0x27')](function(){_0x4c5687['status'](0xcc)[_0xf5eb('0x1c')]();});}};}function handleEntityNotFound(_0x5d440f,_0x4b5801){return function(_0x5e95b6){if(!_0x5e95b6){_0x5d440f[_0xf5eb('0x1a')](0x194);}return _0x5e95b6;};}function handleError(_0x9d7a02,_0x8fd86b){_0x8fd86b=_0x8fd86b||0x1f4;return function(_0x440e0a){logger[_0xf5eb('0x2c')](_0x440e0a[_0xf5eb('0x2d')]);if(_0x440e0a['name']){delete _0x440e0a[_0xf5eb('0x2e')];}_0x9d7a02['status'](_0x8fd86b)[_0xf5eb('0x2f')](_0x440e0a);};}exports[_0xf5eb('0x30')]=function(_0x1a5b68,_0x166428){var _0x5bd3a4={},_0x22797c={},_0x33fc4d={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xf5eb('0x27')](function(_0x1c1946){_0x22797c[_0xf5eb('0x31')]=_[_0xf5eb('0x32')](_0x1c1946);_0x22797c['query']=_['keys'](_0x1a5b68[_0xf5eb('0x33')]);_0x22797c[_0xf5eb('0x34')]=_[_0xf5eb('0x35')](_0x22797c[_0xf5eb('0x31')],_0x22797c[_0xf5eb('0x33')]);_0x5bd3a4['attributes']=_[_0xf5eb('0x35')](_0x22797c[_0xf5eb('0x31')],qs[_0xf5eb('0x36')](_0x1a5b68['query']['fields']));_0x5bd3a4[_0xf5eb('0x37')]=_0x5bd3a4['attributes'][_0xf5eb('0x38')]?_0x5bd3a4[_0xf5eb('0x37')]:_0x22797c[_0xf5eb('0x31')];if(!_0x1a5b68[_0xf5eb('0x33')][_0xf5eb('0x39')]('nolimit')){_0x5bd3a4[_0xf5eb('0x21')]=qs[_0xf5eb('0x21')](_0x1a5b68[_0xf5eb('0x33')]['limit']);_0x5bd3a4[_0xf5eb('0x1e')]=qs['offset'](_0x1a5b68[_0xf5eb('0x33')]['offset']);}_0x5bd3a4['order']=qs[_0xf5eb('0x3a')](_0x1a5b68[_0xf5eb('0x33')][_0xf5eb('0x3a')]);_0x5bd3a4[_0xf5eb('0x3b')]=qs[_0xf5eb('0x34')](_[_0xf5eb('0x3c')](_0x1a5b68[_0xf5eb('0x33')],_0x22797c[_0xf5eb('0x34')]),_0x1c1946);if(_0x1a5b68['query']['filter']){_0x5bd3a4[_0xf5eb('0x3b')]=_[_0xf5eb('0x3d')](_0x5bd3a4[_0xf5eb('0x3b')],{'$or':_['map'](_0x5bd3a4[_0xf5eb('0x37')],function(_0x2a5337){var _0x4e382d={};_0x4e382d[_0x2a5337]={'$like':'%'+_0x1a5b68[_0xf5eb('0x33')][_0xf5eb('0x3e')]+'%'};return _0x4e382d;})});}_0x5bd3a4=_[_0xf5eb('0x3d')]({},_0x5bd3a4,_0x1a5b68[_0xf5eb('0x3f')]);var _0x371d96={'where':_0x5bd3a4[_0xf5eb('0x3b')]};return db['CmCompany'][_0xf5eb('0x20')](_0x371d96)[_0xf5eb('0x27')](function(_0x10af93){_0x33fc4d[_0xf5eb('0x20')]=_0x10af93;if(_0x1a5b68['query'][_0xf5eb('0x40')]){_0x5bd3a4[_0xf5eb('0x41')]=[{'all':!![]}];}return db['CmCompany']['findAll'](_0x5bd3a4);})[_0xf5eb('0x27')](function(_0x4f4cec){_0x33fc4d[_0xf5eb('0x42')]=_0x4f4cec;return _0x33fc4d;})[_0xf5eb('0x27')](respondWithFilteredResult(_0x166428,_0x5bd3a4))[_0xf5eb('0x43')](handleError(_0x166428,null));})[_0xf5eb('0x43')](handleError(_0x166428,null));};exports[_0xf5eb('0x44')]=function(_0x396f0c,_0x104009){var _0x58ad0f={'raw':![],'where':{'id':_0x396f0c[_0xf5eb('0x45')]['id']}},_0x277c16={};_0x277c16[_0xf5eb('0x31')]=_['keys'](db[_0xf5eb('0x46')]['rawAttributes']);_0x277c16[_0xf5eb('0x33')]=_[_0xf5eb('0x32')](_0x396f0c[_0xf5eb('0x33')]);_0x277c16['filters']=_[_0xf5eb('0x35')](_0x277c16[_0xf5eb('0x31')],_0x277c16[_0xf5eb('0x33')]);_0x58ad0f[_0xf5eb('0x37')]=_['intersection'](_0x277c16[_0xf5eb('0x31')],qs[_0xf5eb('0x36')](_0x396f0c[_0xf5eb('0x33')][_0xf5eb('0x36')]));_0x58ad0f[_0xf5eb('0x37')]=_0x58ad0f['attributes'][_0xf5eb('0x38')]?_0x58ad0f[_0xf5eb('0x37')]:_0x277c16[_0xf5eb('0x31')];if(_0x396f0c['query'][_0xf5eb('0x40')]){_0x58ad0f[_0xf5eb('0x41')]=[{'all':!![]}];}_0x58ad0f=_['merge']({},_0x58ad0f,_0x396f0c[_0xf5eb('0x3f')]);return db[_0xf5eb('0x46')][_0xf5eb('0x47')](_0x58ad0f)[_0xf5eb('0x27')](handleEntityNotFound(_0x104009,null))['then'](respondWithResult(_0x104009,null))['catch'](handleError(_0x104009,null));};exports['create']=function(_0x2fc514,_0x570e4f){return db['CmCompany'][_0xf5eb('0x48')](_0x2fc514['body'],{})['then'](function(_0x1b797b){var _0x64006d=_0x2fc514[_0xf5eb('0x49')][_0xf5eb('0x29')]({'plain':!![]});if(!_0x64006d)throw new Error(_0xf5eb('0x4a'));if(_0x64006d[_0xf5eb('0x4b')]===_0xf5eb('0x49')){var _0x5a343f=_0x1b797b[_0xf5eb('0x29')]({'plain':!![]});var _0x1ee29d=_0xf5eb('0x2a');return db['UserProfileSection']['find']({'where':{'name':_0x1ee29d,'userProfileId':_0x64006d['userProfileId']},'raw':!![]})[_0xf5eb('0x27')](function(_0x4c52e0){if(_0x4c52e0&&_0x4c52e0['autoAssociation']===0x0){return db['UserProfileResource'][_0xf5eb('0x48')]({'name':_0x5a343f[_0xf5eb('0x2e')],'resourceId':_0x5a343f['id'],'type':_0x4c52e0[_0xf5eb('0x2e')],'sectionId':_0x4c52e0['id']},{})[_0xf5eb('0x27')](function(){return _0x1b797b;});}else{return _0x1b797b;}})[_0xf5eb('0x43')](function(_0x574fa){logger[_0xf5eb('0x2c')](_0xf5eb('0x4c'),_0x574fa);throw _0x574fa;});}return _0x1b797b;})['then'](respondWithResult(_0x570e4f,0xc9))[_0xf5eb('0x43')](handleError(_0x570e4f,null));};exports[_0xf5eb('0x26')]=function(_0x37cfc3,_0x46e07b){if(_0x37cfc3[_0xf5eb('0x4d')]['id']){delete _0x37cfc3[_0xf5eb('0x4d')]['id'];}return db[_0xf5eb('0x46')][_0xf5eb('0x47')]({'where':{'id':_0x37cfc3[_0xf5eb('0x45')]['id']}})['then'](handleEntityNotFound(_0x46e07b,null))[_0xf5eb('0x27')](saveUpdates(_0x37cfc3[_0xf5eb('0x4d')],null))[_0xf5eb('0x27')](respondWithResult(_0x46e07b,null))[_0xf5eb('0x43')](handleError(_0x46e07b,null));};exports[_0xf5eb('0x28')]=function(_0x335f43,_0x502dc6){return db[_0xf5eb('0x46')][_0xf5eb('0x47')]({'where':{'id':_0x335f43[_0xf5eb('0x45')]['id']}})[_0xf5eb('0x27')](handleEntityNotFound(_0x502dc6,null))[_0xf5eb('0x27')](removeEntity(_0x502dc6,null))['catch'](handleError(_0x502dc6,null));};exports[_0xf5eb('0x4e')]=function(_0x300be9,_0x3052dd){return db[_0xf5eb('0x46')][_0xf5eb('0x4e')]()['then'](respondWithResult(_0x3052dd,null))[_0xf5eb('0x43')](handleError(_0x3052dd,null));};exports[_0xf5eb('0x4f')]=function(_0x8e12aa,_0x83846c,_0x3a4ca5){return db[_0xf5eb('0x50')]['find']({'where':{'id':_0x8e12aa[_0xf5eb('0x45')]['id']}})['then'](handleEntityNotFound(_0x83846c,null))[_0xf5eb('0x27')](function(_0x18f7ea){if(_0x18f7ea){return _0x18f7ea['addContacts'](_0x8e12aa[_0xf5eb('0x4d')]['ids'],_[_0xf5eb('0x51')](_0x8e12aa[_0xf5eb('0x4d')],['ids','id'])||{});}})[_0xf5eb('0x27')](respondWithResult(_0x83846c,null))['catch'](handleError(_0x83846c,null));};exports[_0xf5eb('0x52')]=function(_0x46c659,_0x5b070b,_0x513d0e){var _0x32cc25={};var _0x52260c={};var _0x10a6cb;var _0xb8c1e7;return db[_0xf5eb('0x46')][_0xf5eb('0x53')]({'where':{'id':_0x46c659['params']['id']}})[_0xf5eb('0x27')](handleEntityNotFound(_0x5b070b,null))[_0xf5eb('0x27')](function(_0x230d24){if(_0x230d24){_0x10a6cb=_0x230d24;_0x52260c[_0xf5eb('0x31')]=_[_0xf5eb('0x32')](db[_0xf5eb('0x50')][_0xf5eb('0x54')]);_0x52260c[_0xf5eb('0x33')]=_[_0xf5eb('0x32')](_0x46c659[_0xf5eb('0x33')]);_0x52260c['filters']=_[_0xf5eb('0x35')](_0x52260c[_0xf5eb('0x31')],_0x52260c['query']);_0x32cc25['attributes']=_[_0xf5eb('0x35')](_0x52260c[_0xf5eb('0x31')],qs[_0xf5eb('0x36')](_0x46c659[_0xf5eb('0x33')][_0xf5eb('0x36')]));_0x32cc25[_0xf5eb('0x37')]=_0x32cc25[_0xf5eb('0x37')][_0xf5eb('0x38')]?_0x32cc25[_0xf5eb('0x37')]:_0x52260c['model'];_0x32cc25[_0xf5eb('0x55')]=qs[_0xf5eb('0x3a')](_0x46c659[_0xf5eb('0x33')][_0xf5eb('0x3a')]);_0x32cc25[_0xf5eb('0x3b')]=qs['filters'](_[_0xf5eb('0x3c')](_0x46c659[_0xf5eb('0x33')],_0x52260c[_0xf5eb('0x34')]));if(_0x46c659[_0xf5eb('0x33')][_0xf5eb('0x3e')]){_0x32cc25[_0xf5eb('0x3b')]=_['merge'](_0x32cc25['where'],{'$or':_[_0xf5eb('0x56')](_0x32cc25[_0xf5eb('0x37')],function(_0x4be8f9){var _0x332069={};_0x332069[_0x4be8f9]={'$like':'%'+_0x46c659['query'][_0xf5eb('0x3e')]+'%'};return _0x332069;})});}_0x32cc25=_[_0xf5eb('0x3d')]({},_0x32cc25,_0x46c659[_0xf5eb('0x3f')]);return _0x10a6cb[_0xf5eb('0x52')](_0x32cc25);}})[_0xf5eb('0x27')](function(_0x3b6278){if(_0x3b6278){_0xb8c1e7=_0x3b6278['length'];if(!_0x46c659[_0xf5eb('0x33')][_0xf5eb('0x39')](_0xf5eb('0x57'))){_0x32cc25[_0xf5eb('0x21')]=qs[_0xf5eb('0x21')](_0x46c659[_0xf5eb('0x33')][_0xf5eb('0x21')]);_0x32cc25['offset']=qs['offset'](_0x46c659[_0xf5eb('0x33')][_0xf5eb('0x1e')]);}return _0x10a6cb['getContacts'](_0x32cc25);}})[_0xf5eb('0x27')](function(_0x3846ca){if(_0x3846ca){return _0x3846ca?{'count':_0xb8c1e7,'rows':_0x3846ca}:null;}})[_0xf5eb('0x27')](respondWithResult(_0x5b070b,null))[_0xf5eb('0x43')](handleError(_0x5b070b,null));}; \ No newline at end of file +var _0x19c7=['send','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','show','params','rawAttributes','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','name','destroy','CmContact','addContacts','ids','omit','map','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','get','Companies','then','error','stack'];(function(_0x196525,_0x589858){var _0x38d7ee=function(_0x115edc){while(--_0x115edc){_0x196525['push'](_0x196525['shift']());}};_0x38d7ee(++_0x589858);}(_0x19c7,0x195));var _0x719c=function(_0x1440bd,_0x4bb4f0){_0x1440bd=_0x1440bd-0x0;var _0x243f6b=_0x19c7[_0x1440bd];return _0x243f6b;};'use strict';var emlformat=require(_0x719c('0x0'));var rimraf=require(_0x719c('0x1'));var zipdir=require(_0x719c('0x2'));var jsonpatch=require(_0x719c('0x3'));var rp=require(_0x719c('0x4'));var moment=require('moment');var BPromise=require(_0x719c('0x5'));var Mustache=require(_0x719c('0x6'));var util=require(_0x719c('0x7'));var path=require(_0x719c('0x8'));var sox=require(_0x719c('0x9'));var csv=require(_0x719c('0xa'));var ejs=require(_0x719c('0xb'));var fs=require('fs');var fs_extra=require(_0x719c('0xc'));var _=require(_0x719c('0xd'));var squel=require(_0x719c('0xe'));var crypto=require(_0x719c('0xf'));var jsforce=require(_0x719c('0x10'));var deskjs=require(_0x719c('0x11'));var toCsv=require(_0x719c('0xa'));var querystring=require(_0x719c('0x12'));var Papa=require(_0x719c('0x13'));var Redis=require(_0x719c('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x719c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x719c('0x16'));var logger=require(_0x719c('0x17'))(_0x719c('0x18'));var utils=require(_0x719c('0x19'));var config=require(_0x719c('0x1a'));var licenseUtil=require(_0x719c('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35ac43,_0x429c8b){_0x429c8b=_0x429c8b||0xcc;return function(_0x525626){if(_0x525626){return _0x35ac43[_0x719c('0x1c')](_0x429c8b);}return _0x35ac43[_0x719c('0x1d')](_0x429c8b)[_0x719c('0x1e')]();};}function respondWithResult(_0x5015e0,_0x8182a8){_0x8182a8=_0x8182a8||0xc8;return function(_0x5e97a4){if(_0x5e97a4){return _0x5015e0[_0x719c('0x1d')](_0x8182a8)['json'](_0x5e97a4);}};}function respondWithFilteredResult(_0x24c0c8,_0x4a0e68){return function(_0x123e9d){if(_0x123e9d){var _0x4457c9=typeof _0x4a0e68[_0x719c('0x1f')]===_0x719c('0x20')&&typeof _0x4a0e68['limit']===_0x719c('0x20');var _0x29af1c=_0x123e9d[_0x719c('0x21')];var _0xe5746d=_0x4457c9?0x0:_0x4a0e68['offset'];var _0x3fc0c3=_0x4457c9?_0x123e9d['count']:_0x4a0e68[_0x719c('0x1f')]+_0x4a0e68['limit'];var _0x3a477d;if(_0x3fc0c3>=_0x29af1c){_0x3fc0c3=_0x29af1c;_0x3a477d=0xc8;}else{_0x3a477d=0xce;}_0x24c0c8[_0x719c('0x1d')](_0x3a477d);return _0x24c0c8[_0x719c('0x22')](_0x719c('0x23'),_0xe5746d+'-'+_0x3fc0c3+'/'+_0x29af1c)['json'](_0x123e9d);}return null;};}function patchUpdates(_0x1a947c){return function(_0x5491f5){try{jsonpatch[_0x719c('0x24')](_0x5491f5,_0x1a947c,!![]);}catch(_0x1f954f){return BPromise[_0x719c('0x25')](_0x1f954f);}return _0x5491f5[_0x719c('0x26')]();};}function saveUpdates(_0x3290ba,_0x4cf016){return function(_0x31448b){if(_0x31448b){return _0x31448b[_0x719c('0x27')](_0x3290ba)['then'](function(_0x3e1f7f){return _0x3e1f7f;});}return null;};}function removeEntity(_0x518895,_0x517fe1){return function(_0x5952ba){if(_0x5952ba){return _0x5952ba['destroy']()['then'](function(){var _0xcbb4c0=_0x5952ba[_0x719c('0x28')]({'plain':!![]});var _0x22c3e4=_0x719c('0x29');return db['UserProfileResource']['destroy']({'where':{'type':_0x22c3e4,'resourceId':_0xcbb4c0['id']}})[_0x719c('0x2a')](function(){return _0x5952ba;});})['then'](function(){_0x518895[_0x719c('0x1d')](0xcc)[_0x719c('0x1e')]();});}};}function handleEntityNotFound(_0x4c3e11,_0x2f279a){return function(_0x395ee6){if(!_0x395ee6){_0x4c3e11['sendStatus'](0x194);}return _0x395ee6;};}function handleError(_0x22a2fa,_0x2869a8){_0x2869a8=_0x2869a8||0x1f4;return function(_0x2b0fd1){logger[_0x719c('0x2b')](_0x2b0fd1[_0x719c('0x2c')]);if(_0x2b0fd1['name']){delete _0x2b0fd1['name'];}_0x22a2fa['status'](_0x2869a8)[_0x719c('0x2d')](_0x2b0fd1);};}exports['index']=function(_0x23ecc0,_0x1c2acb){var _0x2fee7d={},_0x477bf3={},_0x2fd101={'count':0x0,'rows':[]};return db[_0x719c('0x2e')][_0x719c('0x2f')]()[_0x719c('0x2a')](function(_0x190d9f){_0x477bf3[_0x719c('0x30')]=_[_0x719c('0x31')](_0x190d9f);_0x477bf3['query']=_[_0x719c('0x31')](_0x23ecc0[_0x719c('0x32')]);_0x477bf3[_0x719c('0x33')]=_[_0x719c('0x34')](_0x477bf3[_0x719c('0x30')],_0x477bf3[_0x719c('0x32')]);_0x2fee7d['attributes']=_[_0x719c('0x34')](_0x477bf3['model'],qs['fields'](_0x23ecc0[_0x719c('0x32')][_0x719c('0x35')]));_0x2fee7d[_0x719c('0x36')]=_0x2fee7d[_0x719c('0x36')][_0x719c('0x37')]?_0x2fee7d[_0x719c('0x36')]:_0x477bf3['model'];if(!_0x23ecc0['query'][_0x719c('0x38')](_0x719c('0x39'))){_0x2fee7d[_0x719c('0x3a')]=qs['limit'](_0x23ecc0[_0x719c('0x32')][_0x719c('0x3a')]);_0x2fee7d[_0x719c('0x1f')]=qs['offset'](_0x23ecc0['query'][_0x719c('0x1f')]);}_0x2fee7d[_0x719c('0x3b')]=qs[_0x719c('0x3c')](_0x23ecc0[_0x719c('0x32')][_0x719c('0x3c')]);_0x2fee7d[_0x719c('0x3d')]=qs[_0x719c('0x33')](_[_0x719c('0x3e')](_0x23ecc0[_0x719c('0x32')],_0x477bf3[_0x719c('0x33')]),_0x190d9f);if(_0x23ecc0[_0x719c('0x32')]['filter']){_0x2fee7d[_0x719c('0x3d')]=_['merge'](_0x2fee7d[_0x719c('0x3d')],{'$or':_['map'](_0x2fee7d['attributes'],function(_0x2b95f0){var _0x215cae={};_0x215cae[_0x2b95f0]={'$like':'%'+_0x23ecc0[_0x719c('0x32')][_0x719c('0x3f')]+'%'};return _0x215cae;})});}_0x2fee7d=_[_0x719c('0x40')]({},_0x2fee7d,_0x23ecc0[_0x719c('0x41')]);var _0xca9dac={'where':_0x2fee7d[_0x719c('0x3d')]};return db[_0x719c('0x2e')][_0x719c('0x21')](_0xca9dac)[_0x719c('0x2a')](function(_0x3586e9){_0x2fd101[_0x719c('0x21')]=_0x3586e9;if(_0x23ecc0[_0x719c('0x32')][_0x719c('0x42')]){_0x2fee7d['include']=[{'all':!![]}];}return db[_0x719c('0x2e')]['findAll'](_0x2fee7d);})[_0x719c('0x2a')](function(_0x4c6442){_0x2fd101[_0x719c('0x43')]=_0x4c6442;return _0x2fd101;})[_0x719c('0x2a')](respondWithFilteredResult(_0x1c2acb,_0x2fee7d))[_0x719c('0x44')](handleError(_0x1c2acb,null));})['catch'](handleError(_0x1c2acb,null));};exports[_0x719c('0x45')]=function(_0x451d30,_0x10be07){var _0x47577e={'raw':![],'where':{'id':_0x451d30[_0x719c('0x46')]['id']}},_0x5306e5={};_0x5306e5['model']=_['keys'](db[_0x719c('0x2e')][_0x719c('0x47')]);_0x5306e5[_0x719c('0x32')]=_[_0x719c('0x31')](_0x451d30[_0x719c('0x32')]);_0x5306e5[_0x719c('0x33')]=_['intersection'](_0x5306e5[_0x719c('0x30')],_0x5306e5[_0x719c('0x32')]);_0x47577e[_0x719c('0x36')]=_[_0x719c('0x34')](_0x5306e5[_0x719c('0x30')],qs[_0x719c('0x35')](_0x451d30[_0x719c('0x32')][_0x719c('0x35')]));_0x47577e['attributes']=_0x47577e[_0x719c('0x36')]['length']?_0x47577e[_0x719c('0x36')]:_0x5306e5[_0x719c('0x30')];if(_0x451d30['query'][_0x719c('0x42')]){_0x47577e[_0x719c('0x48')]=[{'all':!![]}];}_0x47577e=_[_0x719c('0x40')]({},_0x47577e,_0x451d30[_0x719c('0x41')]);return db[_0x719c('0x2e')]['find'](_0x47577e)[_0x719c('0x2a')](handleEntityNotFound(_0x10be07,null))['then'](respondWithResult(_0x10be07,null))['catch'](handleError(_0x10be07,null));};exports[_0x719c('0x49')]=function(_0x5ef71a,_0x4af1ea){return db[_0x719c('0x2e')][_0x719c('0x49')](_0x5ef71a[_0x719c('0x4a')],{})[_0x719c('0x2a')](function(_0x3b5283){var _0x459e58=_0x5ef71a[_0x719c('0x4b')][_0x719c('0x28')]({'plain':!![]});if(!_0x459e58)throw new Error(_0x719c('0x4c'));if(_0x459e58['role']===_0x719c('0x4b')){var _0x4e0e7c=_0x3b5283[_0x719c('0x28')]({'plain':!![]});var _0x237ac6=_0x719c('0x29');return db[_0x719c('0x4d')][_0x719c('0x4e')]({'where':{'name':_0x237ac6,'userProfileId':_0x459e58[_0x719c('0x4f')]},'raw':!![]})[_0x719c('0x2a')](function(_0x2282c7){if(_0x2282c7&&_0x2282c7[_0x719c('0x50')]===0x0){return db[_0x719c('0x51')][_0x719c('0x49')]({'name':_0x4e0e7c[_0x719c('0x52')],'resourceId':_0x4e0e7c['id'],'type':_0x2282c7['name'],'sectionId':_0x2282c7['id']},{})[_0x719c('0x2a')](function(){return _0x3b5283;});}else{return _0x3b5283;}})[_0x719c('0x44')](function(_0x375860){logger[_0x719c('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x375860);throw _0x375860;});}return _0x3b5283;})['then'](respondWithResult(_0x4af1ea,0xc9))[_0x719c('0x44')](handleError(_0x4af1ea,null));};exports[_0x719c('0x27')]=function(_0x213030,_0xadc68e){if(_0x213030['body']['id']){delete _0x213030['body']['id'];}return db[_0x719c('0x2e')]['find']({'where':{'id':_0x213030[_0x719c('0x46')]['id']}})['then'](handleEntityNotFound(_0xadc68e,null))[_0x719c('0x2a')](saveUpdates(_0x213030[_0x719c('0x4a')],null))['then'](respondWithResult(_0xadc68e,null))[_0x719c('0x44')](handleError(_0xadc68e,null));};exports[_0x719c('0x53')]=function(_0x46214f,_0x2f0a3f){return db[_0x719c('0x2e')][_0x719c('0x4e')]({'where':{'id':_0x46214f[_0x719c('0x46')]['id']}})[_0x719c('0x2a')](handleEntityNotFound(_0x2f0a3f,null))[_0x719c('0x2a')](removeEntity(_0x2f0a3f,null))['catch'](handleError(_0x2f0a3f,null));};exports[_0x719c('0x2f')]=function(_0x3dd7f6,_0x3d5b38){return db['CmCompany'][_0x719c('0x2f')]()['then'](respondWithResult(_0x3d5b38,null))[_0x719c('0x44')](handleError(_0x3d5b38,null));};exports['addContacts']=function(_0x83a7bb,_0x2edcd0,_0x7e5f6e){return db[_0x719c('0x54')][_0x719c('0x4e')]({'where':{'id':_0x83a7bb[_0x719c('0x46')]['id']}})[_0x719c('0x2a')](handleEntityNotFound(_0x2edcd0,null))[_0x719c('0x2a')](function(_0xc74df9){if(_0xc74df9){return _0xc74df9[_0x719c('0x55')](_0x83a7bb[_0x719c('0x4a')][_0x719c('0x56')],_[_0x719c('0x57')](_0x83a7bb[_0x719c('0x4a')],[_0x719c('0x56'),'id'])||{});}})['then'](respondWithResult(_0x2edcd0,null))[_0x719c('0x44')](handleError(_0x2edcd0,null));};exports['getContacts']=function(_0x8c78f6,_0x3213b9,_0x24cb55){var _0x3a9128={};var _0x19b9b3={};var _0x1eb9e4;var _0x4ed937;return db[_0x719c('0x2e')]['findOne']({'where':{'id':_0x8c78f6[_0x719c('0x46')]['id']}})[_0x719c('0x2a')](handleEntityNotFound(_0x3213b9,null))[_0x719c('0x2a')](function(_0x2d0cf9){if(_0x2d0cf9){_0x1eb9e4=_0x2d0cf9;_0x19b9b3['model']=_[_0x719c('0x31')](db[_0x719c('0x54')][_0x719c('0x47')]);_0x19b9b3[_0x719c('0x32')]=_['keys'](_0x8c78f6['query']);_0x19b9b3['filters']=_[_0x719c('0x34')](_0x19b9b3[_0x719c('0x30')],_0x19b9b3['query']);_0x3a9128[_0x719c('0x36')]=_[_0x719c('0x34')](_0x19b9b3[_0x719c('0x30')],qs[_0x719c('0x35')](_0x8c78f6[_0x719c('0x32')][_0x719c('0x35')]));_0x3a9128['attributes']=_0x3a9128[_0x719c('0x36')][_0x719c('0x37')]?_0x3a9128['attributes']:_0x19b9b3[_0x719c('0x30')];_0x3a9128[_0x719c('0x3b')]=qs[_0x719c('0x3c')](_0x8c78f6[_0x719c('0x32')][_0x719c('0x3c')]);_0x3a9128['where']=qs['filters'](_[_0x719c('0x3e')](_0x8c78f6['query'],_0x19b9b3[_0x719c('0x33')]));if(_0x8c78f6[_0x719c('0x32')][_0x719c('0x3f')]){_0x3a9128['where']=_[_0x719c('0x40')](_0x3a9128[_0x719c('0x3d')],{'$or':_[_0x719c('0x58')](_0x3a9128[_0x719c('0x36')],function(_0x3805ea){var _0x59987a={};_0x59987a[_0x3805ea]={'$like':'%'+_0x8c78f6[_0x719c('0x32')][_0x719c('0x3f')]+'%'};return _0x59987a;})});}_0x3a9128=_[_0x719c('0x40')]({},_0x3a9128,_0x8c78f6[_0x719c('0x41')]);return _0x1eb9e4[_0x719c('0x59')](_0x3a9128);}})[_0x719c('0x2a')](function(_0x83b449){if(_0x83b449){_0x4ed937=_0x83b449['length'];if(!_0x8c78f6[_0x719c('0x32')][_0x719c('0x38')](_0x719c('0x39'))){_0x3a9128[_0x719c('0x3a')]=qs[_0x719c('0x3a')](_0x8c78f6['query'][_0x719c('0x3a')]);_0x3a9128[_0x719c('0x1f')]=qs[_0x719c('0x1f')](_0x8c78f6[_0x719c('0x32')][_0x719c('0x1f')]);}return _0x1eb9e4['getContacts'](_0x3a9128);}})[_0x719c('0x2a')](function(_0x51de39){if(_0x51de39){return _0x51de39?{'count':_0x4ed937,'rows':_0x51de39}:null;}})['then'](respondWithResult(_0x3213b9,null))[_0x719c('0x44')](handleError(_0x3213b9,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 4c38420..499e38d 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 _0xea53=['moment','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','../../config/logger','api'];(function(_0x41df11,_0xfdfbe1){var _0x459ef5=function(_0x12c1a8){while(--_0x12c1a8){_0x41df11['push'](_0x41df11['shift']());}};_0x459ef5(++_0xfdfbe1);}(_0xea53,0x100));var _0x3ea5=function(_0x4c7429,_0x41d7e2){_0x4c7429=_0x4c7429-0x0;var _0xc03ebe=_0xea53[_0x4c7429];return _0xc03ebe;};'use strict';var _=require(_0x3ea5('0x0'));var util=require(_0x3ea5('0x1'));var logger=require(_0x3ea5('0x2'))(_0x3ea5('0x3'));var moment=require(_0x3ea5('0x4'));var BPromise=require('bluebird');var rp=require(_0x3ea5('0x5'));var fs=require('fs');var path=require(_0x3ea5('0x6'));var rimraf=require(_0x3ea5('0x7'));var config=require(_0x3ea5('0x8'));var attributes=require(_0x3ea5('0x9'));module[_0x3ea5('0xa')]=function(_0x4c6ba0,_0x84c741){return _0x4c6ba0['define'](_0x3ea5('0xb'),attributes,{'tableName':_0x3ea5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf594=['moment','bluebird','request-promise','path','./cmCompany.attributes','define','CmCompany','cm_companies','lodash','util','../../config/logger'];(function(_0xe9455d,_0xacbe74){var _0x37d5bf=function(_0x2c4046){while(--_0x2c4046){_0xe9455d['push'](_0xe9455d['shift']());}};_0x37d5bf(++_0xacbe74);}(_0xf594,0x1d6));var _0x4f59=function(_0x124c5b,_0x1ff16b){_0x124c5b=_0x124c5b-0x0;var _0x4fe48f=_0xf594[_0x124c5b];return _0x4fe48f;};'use strict';var _=require(_0x4f59('0x0'));var util=require(_0x4f59('0x1'));var logger=require(_0x4f59('0x2'))('api');var moment=require(_0x4f59('0x3'));var BPromise=require(_0x4f59('0x4'));var rp=require(_0x4f59('0x5'));var fs=require('fs');var path=require(_0x4f59('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4f59('0x7'));module['exports']=function(_0x4f9805,_0x524597){return _0x4f9805[_0x4f59('0x8')](_0x4f59('0x9'),attributes,{'tableName':_0x4f59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 9b90c07..996086b 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 _0x7064=['debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent'];(function(_0x3bfd25,_0x36c09f){var _0x34d12f=function(_0xf64932){while(--_0xf64932){_0x3bfd25['push'](_0x3bfd25['shift']());}};_0x34d12f(++_0x36c09f);}(_0x7064,0x105));var _0x4706=function(_0x540f48,_0x8be529){_0x540f48=_0x540f48-0x0;var _0x3a54d9=_0x7064[_0x540f48];return _0x3a54d9;};'use strict';var _=require(_0x4706('0x0'));var util=require(_0x4706('0x1'));var moment=require('moment');var BPromise=require(_0x4706('0x2'));var rs=require(_0x4706('0x3'));var fs=require('fs');var Redis=require(_0x4706('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4706('0x5'));var config=require(_0x4706('0x6'));var jayson=require(_0x4706('0x7'));var client=jayson[_0x4706('0x8')][_0x4706('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2afe15,_0x34d515,_0x2e2976){return new BPromise(function(_0x2f3c94,_0x85b43e){return client[_0x4706('0xa')](_0x2afe15,_0x2e2976)[_0x4706('0xb')](function(_0x26c522){logger[_0x4706('0xc')](_0x4706('0xd'),_0x34d515,_0x4706('0xe'));logger[_0x4706('0xf')](_0x4706('0x10'),_0x34d515,_0x4706('0xe'),JSON[_0x4706('0x11')](_0x26c522));if(_0x26c522[_0x4706('0x12')]){if(_0x26c522[_0x4706('0x12')][_0x4706('0x13')]===0x1f4){logger[_0x4706('0x12')]('CmCompany,\x20%s,\x20%s',_0x34d515,_0x26c522[_0x4706('0x12')][_0x4706('0x14')]);return _0x85b43e(_0x26c522[_0x4706('0x12')][_0x4706('0x14')]);}logger[_0x4706('0x12')](_0x4706('0xd'),_0x34d515,_0x26c522['error'][_0x4706('0x14')]);return _0x2f3c94(_0x26c522[_0x4706('0x12')][_0x4706('0x14')]);}else{logger[_0x4706('0xc')](_0x4706('0xd'),_0x34d515,'request\x20sent');_0x2f3c94(_0x26c522[_0x4706('0x15')][_0x4706('0x14')]);}})[_0x4706('0x16')](function(_0x3e51ff){logger[_0x4706('0x12')]('CmCompany,\x20%s,\x20%s',_0x34d515,_0x3e51ff);_0x85b43e(_0x3e51ff);});});} \ No newline at end of file +var _0x8f11=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird'];(function(_0x3f1664,_0x39c1a5){var _0x3e50f6=function(_0x2ad290){while(--_0x2ad290){_0x3f1664['push'](_0x3f1664['shift']());}};_0x3e50f6(++_0x39c1a5);}(_0x8f11,0x66));var _0x18f1=function(_0x41423e,_0xefbf6e){_0x41423e=_0x41423e-0x0;var _0x1c041c=_0x8f11[_0x41423e];return _0x1c041c;};'use strict';var _=require(_0x18f1('0x0'));var util=require(_0x18f1('0x1'));var moment=require('moment');var BPromise=require(_0x18f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18f1('0x3'));var db=require(_0x18f1('0x4'))['db'];var utils=require(_0x18f1('0x5'));var logger=require(_0x18f1('0x6'))('rpc');var config=require(_0x18f1('0x7'));var jayson=require(_0x18f1('0x8'));var client=jayson['client'][_0x18f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c3d54,_0x4693cd,_0x14f731){return new BPromise(function(_0x175613,_0x5cd0ad){return client['request'](_0x3c3d54,_0x14f731)[_0x18f1('0xa')](function(_0x1d0e0f){logger[_0x18f1('0xb')](_0x18f1('0xc'),_0x4693cd,_0x18f1('0xd'));logger[_0x18f1('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x4693cd,_0x18f1('0xd'),JSON[_0x18f1('0xf')](_0x1d0e0f));if(_0x1d0e0f[_0x18f1('0x10')]){if(_0x1d0e0f['error'][_0x18f1('0x11')]===0x1f4){logger['error'](_0x18f1('0xc'),_0x4693cd,_0x1d0e0f['error'][_0x18f1('0x12')]);return _0x5cd0ad(_0x1d0e0f[_0x18f1('0x10')][_0x18f1('0x12')]);}logger[_0x18f1('0x10')](_0x18f1('0xc'),_0x4693cd,_0x1d0e0f[_0x18f1('0x10')][_0x18f1('0x12')]);return _0x175613(_0x1d0e0f[_0x18f1('0x10')][_0x18f1('0x12')]);}else{logger[_0x18f1('0xb')]('CmCompany,\x20%s,\x20%s',_0x4693cd,_0x18f1('0xd'));_0x175613(_0x1d0e0f[_0x18f1('0x13')]['message']);}})[_0x18f1('0x14')](function(_0x3cbe09){logger[_0x18f1('0x10')]('CmCompany,\x20%s,\x20%s',_0x4693cd,_0x3cbe09);_0x5cd0ad(_0x3cbe09);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b0f844d..aef4afc 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 _0xc06e=['/:id/contacts','getContacts','put','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xc06e,0x14a));var _0xec06=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xc06e[_0x1ee351];return _0x245aaf;};'use strict';var multer=require('multer');var util=require(_0xec06('0x0'));var path=require(_0xec06('0x1'));var timeout=require(_0xec06('0x2'));var express=require(_0xec06('0x3'));var router=express['Router']();var fs_extra=require(_0xec06('0x4'));var auth=require(_0xec06('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmCompany.controller');router[_0xec06('0x6')]('/',auth[_0xec06('0x7')](),controller['index']);router[_0xec06('0x6')](_0xec06('0x8'),auth[_0xec06('0x7')](),controller[_0xec06('0x9')]);router[_0xec06('0x6')](_0xec06('0xa'),auth['isAuthenticated'](),controller[_0xec06('0xb')]);router['get'](_0xec06('0xc'),auth[_0xec06('0x7')](),controller[_0xec06('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/contacts',auth[_0xec06('0x7')](),controller['addContacts']);router[_0xec06('0xe')]('/:id',auth[_0xec06('0x7')](),controller[_0xec06('0xf')]);router[_0xec06('0x10')](_0xec06('0xa'),auth[_0xec06('0x7')](),controller[_0xec06('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5d91=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','multer','util'];(function(_0x333e09,_0x44ac60){var _0x2e4ca0=function(_0x5967c8){while(--_0x5967c8){_0x333e09['push'](_0x333e09['shift']());}};_0x2e4ca0(++_0x44ac60);}(_0x5d91,0xf8));var _0x15d9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5d91[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x15d9('0x0'));var util=require(_0x15d9('0x1'));var path=require(_0x15d9('0x2'));var timeout=require(_0x15d9('0x3'));var express=require(_0x15d9('0x4'));var router=express[_0x15d9('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x15d9('0x6'));var interaction=require(_0x15d9('0x7'));var config=require(_0x15d9('0x8'));var controller=require(_0x15d9('0x9'));router['get']('/',auth[_0x15d9('0xa')](),controller[_0x15d9('0xb')]);router['get'](_0x15d9('0xc'),auth[_0x15d9('0xa')](),controller[_0x15d9('0xd')]);router[_0x15d9('0xe')](_0x15d9('0xf'),auth[_0x15d9('0xa')](),controller[_0x15d9('0x10')]);router[_0x15d9('0xe')](_0x15d9('0x11'),auth[_0x15d9('0xa')](),controller[_0x15d9('0x12')]);router[_0x15d9('0x13')]('/',auth[_0x15d9('0xa')](),controller[_0x15d9('0x14')]);router[_0x15d9('0x13')](_0x15d9('0x11'),auth['isAuthenticated'](),controller[_0x15d9('0x15')]);router[_0x15d9('0x16')](_0x15d9('0xf'),auth['isAuthenticated'](),controller[_0x15d9('0x17')]);router[_0x15d9('0x18')]('/:id',auth[_0x15d9('0xa')](),controller['destroy']);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 222e05c..e0b5290 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 _0x7094=['STRING','TEXT','INTEGER','DATE','lodash','sequelize'];(function(_0x1e502f,_0x42063c){var _0x573fb4=function(_0x54d410){while(--_0x54d410){_0x1e502f['push'](_0x1e502f['shift']());}};_0x573fb4(++_0x42063c);}(_0x7094,0x12a));var _0x4709=function(_0xf35753,_0x50665c){_0xf35753=_0xf35753-0x0;var _0x5d7381=_0x7094[_0xf35753];return _0x5d7381;};'use strict';var _=require(_0x4709('0x0'));var Sequelize=require(_0x4709('0x1'));module['exports']={'firstName':{'type':Sequelize[_0x4709('0x2')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x4709('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x4709('0x2')]},'dateOfBirth':{'type':Sequelize[_0x4709('0x2')]},'description':{'type':Sequelize[_0x4709('0x3')]},'phone':{'type':Sequelize[_0x4709('0x2')]},'mobile':{'type':Sequelize[_0x4709('0x2')]},'fax':{'type':Sequelize[_0x4709('0x2')]},'email':{'type':Sequelize[_0x4709('0x2')]},'url':{'type':Sequelize[_0x4709('0x2')]},'facebook':{'type':Sequelize[_0x4709('0x2')]},'fb_data':{'type':Sequelize[_0x4709('0x2')]},'twitter':{'type':Sequelize[_0x4709('0x2')]},'skype':{'type':Sequelize[_0x4709('0x2')]},'teams':{'type':Sequelize[_0x4709('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x4709('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x4709('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x4709('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x4709('0x5')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x4709('0x2')]},'utcOffset':{'type':Sequelize[_0x4709('0x4')]}}; \ No newline at end of file +var _0x3eb1=['STRING','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0x3eb1,0x1ee));var _0x13eb=function(_0x34f701,_0x37e407){_0x34f701=_0x34f701-0x0;var _0x3e2429=_0x3eb1[_0x34f701];return _0x3e2429;};'use strict';var _=require(_0x13eb('0x0'));var Sequelize=require(_0x13eb('0x1'));module[_0x13eb('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x13eb('0x3')]},'street':{'type':Sequelize[_0x13eb('0x3')]},'postalCode':{'type':Sequelize[_0x13eb('0x3')]},'city':{'type':Sequelize[_0x13eb('0x3')]},'country':{'type':Sequelize[_0x13eb('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize[_0x13eb('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x13eb('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0x13eb('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x13eb('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize['STRING']},'telegram':{'type':Sequelize[_0x13eb('0x3')]},'UserId':{'type':Sequelize[_0x13eb('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x13eb('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x13eb('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x13eb('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0x13eb('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 6470808..2e72e22 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(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 e0a0b4c..a31cc2a 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 _0xefa5=['CmContact','save','remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0xf8a63a,_0x2235cf){var _0x1aace6=function(_0x4ae1b1){while(--_0x4ae1b1){_0xf8a63a['push'](_0xf8a63a['shift']());}};_0x1aace6(++_0x2235cf);}(_0xefa5,0xc3));var _0x5efa=function(_0x5f2c5f,_0x76561d){_0x5f2c5f=_0x5f2c5f-0x0;var _0x44cd63=_0xefa5[_0x5f2c5f];return _0x44cd63;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x5efa('0x0'))['db'][_0x5efa('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5efa('0x2'),'afterUpdate':'update','afterDestroy':_0x5efa('0x3')};function emitEvent(_0x344000){return function(_0x16b424,_0xbfcf49,_0x938b5){CmContactEvents['emit'](_0x344000+':'+_0x16b424['id'],_0x16b424);CmContactEvents[_0x5efa('0x4')](_0x344000,_0x16b424);_0x938b5(null);};}for(var e in events){if(events[_0x5efa('0x5')](e)){var event=events[e];CmContact[_0x5efa('0x6')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0xec70=['../../mysqldb','CmContact','setMaxListeners','save','remove','emit','hook','events'];(function(_0x2c0ba3,_0x44c0a3){var _0x22f386=function(_0x36e037){while(--_0x36e037){_0x2c0ba3['push'](_0x2c0ba3['shift']());}};_0x22f386(++_0x44c0a3);}(_0xec70,0x167));var _0x0ec7=function(_0xb2d091,_0x44cff2){_0xb2d091=_0xb2d091-0x0;var _0x39d1a9=_0xec70[_0xb2d091];return _0x39d1a9;};'use strict';var EventEmitter=require(_0x0ec7('0x0'));var CmContact=require(_0x0ec7('0x1'))['db'][_0x0ec7('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x0ec7('0x3')](0x0);var events={'afterCreate':_0x0ec7('0x4'),'afterUpdate':'update','afterDestroy':_0x0ec7('0x5')};function emitEvent(_0x48a529){return function(_0x59e250,_0x4f69d4,_0x1fa905){CmContactEvents[_0x0ec7('0x6')](_0x48a529+':'+_0x59e250['id'],_0x59e250);CmContactEvents['emit'](_0x48a529,_0x59e250);_0x1fa905(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x0ec7('0x7')](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 bd77d8d..d8e9c2c 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 _0x9e2b=['format','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','minutes','ret','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','ListId','priority','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','error','inspect','add','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','create','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','dialCheckDuplicateType','length','get','always','onlyIfOpen','outbound','CmList','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','Lists','List\x20not\x20found','models','isEmpty','ContactId','VoiceQueueId','push','all','info','[CmContact][afterDestroy][Error]','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContact.attributes','define','CmContact','cm_contacts','phone','firstName','lastName','mobile','fax','email','utf8mb4','utf8mb4_unicode_ci','afterCreate','scheduledat'];(function(_0x1efc8c,_0x46e5ef){var _0x2f2ace=function(_0x1623a4){while(--_0x1623a4){_0x1efc8c['push'](_0x1efc8c['shift']());}};_0x2f2ace(++_0x46e5ef);}(_0x9e2b,0x19f));var _0xb9e2=function(_0x24ce09,_0x219531){_0x24ce09=_0x24ce09-0x0;var _0x2acc72=_0x9e2b[_0x24ce09];return _0x2acc72;};'use strict';var _=require(_0xb9e2('0x0'));var util=require(_0xb9e2('0x1'));var logger=require('../../config/logger')(_0xb9e2('0x2'));var moment=require(_0xb9e2('0x3'));var BPromise=require(_0xb9e2('0x4'));var rp=require(_0xb9e2('0x5'));var fs=require('fs');var path=require(_0xb9e2('0x6'));var rimraf=require(_0xb9e2('0x7'));var config=require(_0xb9e2('0x8'));var shared=require('../../config/environment/shared');var attributes=require(_0xb9e2('0x9'));module['exports']=function(_0x44f4c9,_0x5c5e83){return _0x44f4c9[_0xb9e2('0xa')](_0xb9e2('0xb'),attributes,{'tableName':_0xb9e2('0xc'),'paranoid':!![],'indexes':[{'name':_0xb9e2('0xd'),'fields':[_0xb9e2('0xd')]},{'name':'fti_cm_contacts','fields':[_0xb9e2('0xe'),_0xb9e2('0xf'),_0xb9e2('0xd'),_0xb9e2('0x10'),_0xb9e2('0x11'),_0xb9e2('0x12')],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xb9e2('0x13'),'collate':_0xb9e2('0x14'),'hooks':{'afterCreate':function(_0x57b4ac,_0x205ef8,_0x65c851){var _0x144986=_0x44f4c9['models'];var _0x2bcf0b=_0x57b4ac['get']({'plain':!![]});function _0x44c28c(){return function(_0x5c6b5e){logger['error']('cmContact',_0xb9e2('0x15'),util['inspect'](_0x5c6b5e,{'showHidden':![],'depth':null}));};}function _0x325e30(_0xb3c001,_0x44d80b){var _0x4ca369=_0x44d80b[_0xb9e2('0x16')]?_0x44d80b[_0xb9e2('0x16')]:moment()[_0xb9e2('0x17')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x3bdfe5,_0x20da83){if(_[_0xb9e2('0x18')](_0x44d80b[_0xb9e2('0x19')])){_0x3bdfe5({'ret':_0x4ca369});}else{_0x144986[_0xb9e2('0x1a')][_0xb9e2('0x1b')]({'where':{'id':_0xb3c001['id']}})[_0xb9e2('0x1c')](function(_0x4fdcfa){if(!_['isNil'](_0x4fdcfa)){var _0x282b40=_0x4fdcfa[_0xb9e2('0x19')];if(!_['isNil'](_0x282b40)){var _0x37b332=shared[_0xb9e2('0x1d')];var _0x290b7b=_0x37b332[_0x282b40];var _0x1a098c=_0x37b332[_0x44d80b[_0xb9e2('0x19')]];if(!_[_0xb9e2('0x18')](_0x290b7b)&&!_[_0xb9e2('0x18')](_0x1a098c)){var _0x403624=_0x290b7b[_0xb9e2('0x1e')]-_0x1a098c['utcOffset'];_0x4ca369=_0x44d80b[_0xb9e2('0x16')]?_0x44d80b['scheduledat']:moment();var _0x29d6d0=moment(_0x4ca369)['add'](_0x403624,_0xb9e2('0x1f'));_0x3bdfe5({'ret':_0x29d6d0[_0xb9e2('0x17')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x3bdfe5({'ret':_0x4ca369});}else _0x3bdfe5({'ret':_0x4ca369});}else{_0x3bdfe5({'ret':_0x4ca369});}});}});return 0xa;}var _0x1916ee=function(_0x227536){return new BPromise(function(_0x2c0609,_0x6238fd){_0x325e30(_0x227536,_0x2bcf0b)[_0xb9e2('0x1c')](function(_0x456d47){_0x2bcf0b[_0xb9e2('0x16')]=_0x456d47[_0xb9e2('0x20')];_0x144986['CmHopper']['findOne']({'where':{'phone':_0x2bcf0b[_0xb9e2('0xd')],'VoiceQueueId':_0x227536['id']}})[_0xb9e2('0x1c')](function(_0x2ec9ad){if(!_[_0xb9e2('0x18')](_0x2ec9ad)){throw new Error(_0xb9e2('0x21')+_0x2bcf0b[_0xb9e2('0xd')]+_0xb9e2('0x22')+_0x227536['id']);}return _0x144986[_0xb9e2('0x23')]['create']({'phone':_0x2bcf0b['phone'],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b[_0xb9e2('0x24')],'priority':_0x2bcf0b[_0xb9e2('0x25')]?_0x2bcf0b[_0xb9e2('0x25')]:0x2,'scheduledat':_0x2bcf0b['scheduledat']?_0x2bcf0b[_0xb9e2('0x16')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2bcf0b[_0xb9e2('0x26')]?!![]:![],'callbackuniqueid':_0x2bcf0b[_0xb9e2('0x26')]?_0x2bcf0b[_0xb9e2('0x26')]:undefined,'callbackat':_0x2bcf0b[_0xb9e2('0x26')]?moment()[_0xb9e2('0x17')](_0xb9e2('0x27')):undefined,'VoiceQueueId':_0x227536['id']});})[_0xb9e2('0x28')](function(_0x4f4350){_0x6238fd(_0x4f4350);});});});};var _0xb90263=function(_0x46fa4c){return new BPromise(function(_0x5aa44f,_0x46fd23){_0x325e30(_0x46fa4c,_0x2bcf0b)[_0xb9e2('0x1c')](function(_0x2b2ae5){_0x2bcf0b[_0xb9e2('0x16')]=_0x2b2ae5[_0xb9e2('0x20')];_0x144986['CmHopper'][_0xb9e2('0x1b')]({'where':{'phone':_0x2bcf0b[_0xb9e2('0xd')],'VoiceQueueId':_0x46fa4c['id']}})[_0xb9e2('0x1c')](function(_0x2b4e0c){if(!_['isNil'](_0x2b4e0c)){throw new Error(_0xb9e2('0x21')+_0x2bcf0b[_0xb9e2('0xd')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x46fa4c['id']);}return _0x144986['CmHopperFinal'][_0xb9e2('0x1b')]({'where':{'calleridnum':_0x2bcf0b['phone'],'VoiceQueueId':_0x46fa4c['id']}});})[_0xb9e2('0x1c')](function(_0x10c789){if(!_[_0xb9e2('0x18')](_0x10c789)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x2bcf0b[_0xb9e2('0xd')]+_0xb9e2('0x29')+_0x46fa4c['id']);}return _0x144986[_0xb9e2('0x23')]['create']({'phone':_0x2bcf0b[_0xb9e2('0xd')],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b['ListId'],'priority':_0x2bcf0b[_0xb9e2('0x25')]?_0x2bcf0b[_0xb9e2('0x25')]:0x2,'scheduledat':_0x2bcf0b['scheduledat']?_0x2bcf0b[_0xb9e2('0x16')]:moment()[_0xb9e2('0x17')](_0xb9e2('0x27')),'callback':_0x2bcf0b[_0xb9e2('0x26')]?!![]:![],'callbackuniqueid':_0x2bcf0b['callbackUniqueid']?_0x2bcf0b[_0xb9e2('0x26')]:undefined,'callbackat':_0x2bcf0b[_0xb9e2('0x26')]?moment()[_0xb9e2('0x17')](_0xb9e2('0x27')):undefined,'VoiceQueueId':_0x46fa4c['id']});})[_0xb9e2('0x28')](function(_0x4655b9){_0x46fd23(_0x4655b9);});});});};function _0x491fd4(){return function(_0x42f32d){logger[_0xb9e2('0x2a')]('cmContact',_0xb9e2('0x15'),util[_0xb9e2('0x2b')](_0x42f32d,{'showHidden':![],'depth':null}));};}function _0xbbfc0f(_0xcdeae8,_0x362361){var _0x1fda36=_0x362361[_0xb9e2('0x16')]?_0x362361[_0xb9e2('0x16')]:moment()[_0xb9e2('0x17')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x46162,_0x4a82fb){if(_[_0xb9e2('0x18')](_0x362361[_0xb9e2('0x19')])){_0x46162({'ret':_0x1fda36});}else{_0x144986['Campaign'][_0xb9e2('0x1b')]({'where':{'id':_0xcdeae8['id']}})[_0xb9e2('0x1c')](function(_0x2aa80a){if(!_['isNil'](_0x2aa80a)){var _0x3c41aa=_0x2aa80a[_0xb9e2('0x19')];if(!_[_0xb9e2('0x18')](_0x3c41aa)){var _0xcf6b9c=shared['timezones'];var _0x3fdead=_0xcf6b9c[_0x3c41aa];var _0x50ed77=_0xcf6b9c[_0x362361[_0xb9e2('0x19')]];if(!_[_0xb9e2('0x18')](_0x3fdead)&&!_['isNil'](_0x50ed77)){var _0x1eaeae=_0x3fdead[_0xb9e2('0x1e')]-_0x50ed77['utcOffset'];_0x1fda36=_0x362361[_0xb9e2('0x16')]?_0x362361[_0xb9e2('0x16')]:moment();var _0x4fb3c2=moment(_0x1fda36)[_0xb9e2('0x2c')](_0x1eaeae,'minutes');_0x46162({'ret':_0x4fb3c2['format'](_0xb9e2('0x27'))});}else _0x46162({'ret':_0x1fda36});}else _0x46162({'ret':_0x1fda36});}else{_0x46162({'ret':_0x1fda36});}});}});return 0xa;}var _0x33938d=function(_0x5bd099){return new BPromise(function(_0x416d40,_0x291537){_0xbbfc0f(_0x5bd099,_0x2bcf0b)['then'](function(_0x61b4cd){_0x2bcf0b['scheduledat']=_0x61b4cd[_0xb9e2('0x20')];_0x144986[_0xb9e2('0x23')][_0xb9e2('0x1b')]({'where':{'phone':_0x2bcf0b['phone'],'CampaignId':_0x5bd099['id']}})[_0xb9e2('0x1c')](function(_0x376b40){if(!_[_0xb9e2('0x18')](_0x376b40)){throw new Error(_0xb9e2('0x21')+_0x2bcf0b['phone']+_0xb9e2('0x2d')+_0x5bd099['id']);}return _0x144986[_0xb9e2('0x23')][_0xb9e2('0x2e')]({'phone':_0x2bcf0b[_0xb9e2('0xd')],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b['ListId'],'priority':_0x2bcf0b['priority']?_0x2bcf0b[_0xb9e2('0x25')]:0x2,'scheduledat':_0x2bcf0b[_0xb9e2('0x16')]?_0x2bcf0b['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x2bcf0b[_0xb9e2('0x26')]?!![]:![],'callbackuniqueid':_0x2bcf0b[_0xb9e2('0x26')]?_0x2bcf0b[_0xb9e2('0x26')]:undefined,'callbackat':_0x2bcf0b[_0xb9e2('0x26')]?moment()['format'](_0xb9e2('0x27')):undefined,'CampaignId':_0x5bd099['id']});})[_0xb9e2('0x28')](function(_0x38240b){_0x291537(_0x38240b);});});});};var _0x1b120b=function(_0x2466fe){return new BPromise(function(_0x20aebc,_0x3d29e0){_0xbbfc0f(_0x2466fe,_0x2bcf0b)['then'](function(_0x158575){_0x2bcf0b[_0xb9e2('0x16')]=_0x158575['ret'];_0x144986[_0xb9e2('0x23')][_0xb9e2('0x1b')]({'where':{'phone':_0x2bcf0b[_0xb9e2('0xd')],'CampaignId':_0x2466fe['id']}})[_0xb9e2('0x1c')](function(_0x3a4219){if(!_[_0xb9e2('0x18')](_0x3a4219)){throw new Error(_0xb9e2('0x21')+_0x2bcf0b[_0xb9e2('0xd')]+_0xb9e2('0x2f')+_0x2466fe['id']);}return _0x144986['CmHopperFinal'][_0xb9e2('0x1b')]({'where':{'calleridnum':_0x2bcf0b[_0xb9e2('0xd')],'CampaignId':_0x2466fe['id']}});})[_0xb9e2('0x1c')](function(_0x1f8366){if(!_[_0xb9e2('0x18')](_0x1f8366)){throw new Error(_0xb9e2('0x30')+_0x2bcf0b[_0xb9e2('0xd')]+_0xb9e2('0x31')+_0x2466fe['id']);}return _0x144986[_0xb9e2('0x23')][_0xb9e2('0x2e')]({'phone':_0x2bcf0b['phone'],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b[_0xb9e2('0x24')],'priority':_0x2bcf0b[_0xb9e2('0x25')]?_0x2bcf0b['priority']:0x2,'scheduledat':_0x2bcf0b[_0xb9e2('0x16')]?_0x2bcf0b[_0xb9e2('0x16')]:moment()[_0xb9e2('0x17')](_0xb9e2('0x27')),'callback':_0x2bcf0b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2bcf0b['callbackUniqueid']?_0x2bcf0b[_0xb9e2('0x26')]:undefined,'callbackat':_0x2bcf0b['callbackUniqueid']?moment()['format'](_0xb9e2('0x27')):undefined,'CampaignId':_0x2466fe['id']});})['catch'](function(_0x55cd75){_0x3d29e0(_0x55cd75);});});});};if(_0x2bcf0b['ListId']){_0x144986[_0xb9e2('0x1a')][_0xb9e2('0x32')]({'where':{'type':'outbound'},'attributes':['id',_0xb9e2('0x33'),_0xb9e2('0x19')],'include':[{'model':_0x144986['CmList'],'as':'Lists','where':{'id':_0x2bcf0b[_0xb9e2('0x24')]}}]})[_0xb9e2('0x1c')](function(_0x1d8d47){if(_0x1d8d47){var _0x11a4e3=[];for(var _0x1a5faf=0x0,_0x4816e5;_0x1a5faf<_0x1d8d47[_0xb9e2('0x34')];_0x1a5faf+=0x1){_0x4816e5=_0x1d8d47[_0x1a5faf][_0xb9e2('0x35')]({'plain':!![]});switch(_0x4816e5[_0xb9e2('0x33')]){case _0xb9e2('0x36'):_0xb90263(_0x4816e5)[_0xb9e2('0x28')](_0x44c28c());break;case _0xb9e2('0x37'):_0x1916ee(_0x4816e5)[_0xb9e2('0x28')](_0x44c28c());break;default:_0xbbfc0f(_0x4816e5,_0x2bcf0b)[_0xb9e2('0x1c')](function(_0x42b330){_0x2bcf0b[_0xb9e2('0x16')]=_0x42b330[_0xb9e2('0x20')];_0x144986['CmHopper'][_0xb9e2('0x2e')]({'phone':_0x2bcf0b[_0xb9e2('0xd')],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b[_0xb9e2('0x24')],'scheduledat':_0x2bcf0b[_0xb9e2('0x16')]?_0x2bcf0b[_0xb9e2('0x16')]:moment()['format'](_0xb9e2('0x27')),'priority':_0x2bcf0b[_0xb9e2('0x25')]?_0x2bcf0b[_0xb9e2('0x25')]:0x2,'callback':_0x2bcf0b['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x2bcf0b[_0xb9e2('0x26')]?_0x2bcf0b['callbackUniqueid']:undefined,'callbackat':_0x2bcf0b[_0xb9e2('0x26')]?moment()[_0xb9e2('0x17')](_0xb9e2('0x27')):undefined,'VoiceQueueId':_0x4816e5['id']})[_0xb9e2('0x28')](_0x44c28c());});}}}})['then'](function(){return _0x144986['VoiceQueue'][_0xb9e2('0x32')]({'where':{'type':_0xb9e2('0x38')},'attributes':['id'],'include':[{'model':_0x144986[_0xb9e2('0x39')],'as':_0xb9e2('0x3a'),'where':{'id':_0x2bcf0b['ListId']}}]})['then'](function(_0x3faf6d){if(_0x3faf6d){var _0x4615d7=[];for(var _0x1d6607=0x0,_0xc4b763;_0x1d6607<_0x3faf6d['length'];_0x1d6607+=0x1){_0xc4b763=_0x3faf6d[_0x1d6607][_0xb9e2('0x35')]({'plain':!![]});_0x144986[_0xb9e2('0x3b')]['create']({'phone':_0x2bcf0b['phone'],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b[_0xb9e2('0x24')],'VoiceQueueId':_0xc4b763['id']})[_0xb9e2('0x28')](function(_0x20bae6){logger[_0xb9e2('0x2a')](_0xb9e2('0x3c'),_0xb9e2('0x15'),_0x20bae6[_0xb9e2('0x3d')]);});}}});})[_0xb9e2('0x1c')](function(){return _0x144986[_0xb9e2('0x3e')][_0xb9e2('0x32')]({'attributes':['id',_0xb9e2('0x33'),_0xb9e2('0x19')],'include':[{'model':_0x144986[_0xb9e2('0x39')],'as':_0xb9e2('0x3f'),'where':{'id':_0x2bcf0b[_0xb9e2('0x24')]}}]})['then'](function(_0x4ca0bc){if(_0x4ca0bc){var _0x3376d4=[];for(var _0x278349=0x0,_0x55abe3;_0x278349<_0x4ca0bc[_0xb9e2('0x34')];_0x278349+=0x1){_0x55abe3=_0x4ca0bc[_0x278349][_0xb9e2('0x35')]({'plain':!![]});switch(_0x55abe3[_0xb9e2('0x33')]){case'always':_0x1b120b(_0x55abe3)[_0xb9e2('0x28')](_0x491fd4());break;case _0xb9e2('0x37'):_0x33938d(_0x55abe3)[_0xb9e2('0x28')](_0x491fd4());break;default:_0x144986[_0xb9e2('0x23')][_0xb9e2('0x2e')]({'phone':_0x2bcf0b[_0xb9e2('0xd')],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b[_0xb9e2('0x24')],'scheduledat':_0x2bcf0b[_0xb9e2('0x16')]?_0x2bcf0b['scheduledat']:moment()[_0xb9e2('0x17')](_0xb9e2('0x27')),'priority':_0x2bcf0b[_0xb9e2('0x25')]?_0x2bcf0b[_0xb9e2('0x25')]:0x2,'callback':_0x2bcf0b[_0xb9e2('0x26')]?!![]:![],'callbackuniqueid':_0x2bcf0b[_0xb9e2('0x26')]?_0x2bcf0b[_0xb9e2('0x26')]:undefined,'callbackat':_0x2bcf0b['callbackUniqueid']?moment()[_0xb9e2('0x17')](_0xb9e2('0x27')):undefined,'CampaignId':_0x55abe3['id']})[_0xb9e2('0x28')](_0x491fd4());}}}});})['then'](function(){return _0x144986['Campaign'][_0xb9e2('0x32')]({'attributes':['id'],'include':[{'model':_0x144986[_0xb9e2('0x39')],'as':_0xb9e2('0x3a'),'where':{'id':_0x2bcf0b[_0xb9e2('0x24')]}}]})['then'](function(_0x1e3c0f){if(_0x1e3c0f){var _0x4f6327=[];for(var _0x2b548c=0x0,_0x5569f0;_0x2b548c<_0x1e3c0f['length'];_0x2b548c+=0x1){_0x5569f0=_0x1e3c0f[_0x2b548c][_0xb9e2('0x35')]({'plain':!![]});_0x144986['CmHopperBlack']['create']({'phone':_0x2bcf0b[_0xb9e2('0xd')],'ContactId':_0x2bcf0b['id'],'ListId':_0x2bcf0b[_0xb9e2('0x24')],'CampaignId':_0x5569f0['id']})['catch'](function(_0x1f6038){logger[_0xb9e2('0x2a')]('cmContact,\x20%s,\x20%s','afterCreate',_0x1f6038[_0xb9e2('0x3d')]);});}}});})['then'](function(){_0x65c851();})['catch'](function(_0x34381b){logger[_0xb9e2('0x2a')](_0xb9e2('0x3c'),_0xb9e2('0x15'),_0x34381b['message']);_0x65c851(_0x34381b);});}else{_0x65c851(new Error(_0xb9e2('0x40')));}},'afterDestroy':function(_0x561627,_0x396ac6,_0x27efd4){var _0x54e3fb=_0x44f4c9[_0xb9e2('0x41')];var _0xf6c153=_0x561627[_0xb9e2('0x35')]({'plain':!![]});return _0x54e3fb[_0xb9e2('0x23')][_0xb9e2('0x32')]({'raw':!![],'where':{'ListId':_0xf6c153[_0xb9e2('0x24')],'ContactId':_0xf6c153['id']}})[_0xb9e2('0x1c')](function(_0x131965){if(!_[_0xb9e2('0x42')](_0x131965)){var _0x57b393=[];for(var _0x16b202=0x0;_0x16b202<_0x131965[_0xb9e2('0x34')];_0x16b202+=0x1){var _0x2c850a=_0x54e3fb[_0xb9e2('0x23')]['destroy']({'where':{'ListId':_0x131965[_0x16b202][_0xb9e2('0x24')],'ContactId':_0x131965[_0x16b202][_0xb9e2('0x43')],'VoiceQueueId':_0x131965[_0x16b202][_0xb9e2('0x44')],'CampaignId':_0x131965[_0x16b202]['CampaignId']}});_0x57b393[_0xb9e2('0x45')](_0x2c850a);}return BPromise[_0xb9e2('0x46')](_0x57b393);}})[_0xb9e2('0x1c')](function(_0x5f5da1){logger[_0xb9e2('0x47')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x5f5da1,{'showHidden':![],'depth':null}));_0x27efd4();})[_0xb9e2('0x28')](function(_0x2f4292){logger[_0xb9e2('0x2a')](_0xb9e2('0x48'),util[_0xb9e2('0x2b')](_0x2f4292,{'showHidden':![],'depth':null}));_0x27efd4(_0x2f4292);});}}});}; \ No newline at end of file +var _0xeb53=['message','CmList','List\x20not\x20found','models','isEmpty','destroy','ContactId','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','add','minutes','then','ret','CmHopper','cmContact,\x20afterCreate\x20','ListId','priority','callbackUniqueid','catch','\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','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','Lists','length','get','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s'];(function(_0x3416e5,_0x15b259){var _0x51f568=function(_0x4a786c){while(--_0x4a786c){_0x3416e5['push'](_0x3416e5['shift']());}};_0x51f568(++_0x15b259);}(_0xeb53,0xf8));var _0x3eb5=function(_0xb0169e,_0x39ba7d){_0xb0169e=_0xb0169e-0x0;var _0x4b4687=_0xeb53[_0xb0169e];return _0x4b4687;};'use strict';var _=require(_0x3eb5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3eb5('0x1'));var moment=require(_0x3eb5('0x2'));var BPromise=require(_0x3eb5('0x3'));var rp=require(_0x3eb5('0x4'));var fs=require('fs');var path=require(_0x3eb5('0x5'));var rimraf=require(_0x3eb5('0x6'));var config=require(_0x3eb5('0x7'));var shared=require(_0x3eb5('0x8'));var attributes=require('./cmContact.attributes');module[_0x3eb5('0x9')]=function(_0x35e623,_0x21e094){return _0x35e623[_0x3eb5('0xa')](_0x3eb5('0xb'),attributes,{'tableName':_0x3eb5('0xc'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x3eb5('0xd')]},{'name':_0x3eb5('0xe'),'fields':['firstName',_0x3eb5('0xf'),_0x3eb5('0xd'),'mobile',_0x3eb5('0x10'),_0x3eb5('0x11')],'type':_0x3eb5('0x12')}],'timestamps':!![],'charset':_0x3eb5('0x13'),'collate':_0x3eb5('0x14'),'hooks':{'afterCreate':function(_0xcf0a17,_0x4cab80,_0xa0e0d){var _0x3d0606=_0x35e623['models'];var _0x1cf952=_0xcf0a17['get']({'plain':!![]});function _0x8ba8ff(){return function(_0xcb91f2){logger[_0x3eb5('0x15')](_0x3eb5('0x16'),_0x3eb5('0x17'),util[_0x3eb5('0x18')](_0xcb91f2,{'showHidden':![],'depth':null}));};}function _0x59cfad(_0xfeb642,_0x1ae934){var _0x3280e1=_0x1ae934[_0x3eb5('0x19')]?_0x1ae934[_0x3eb5('0x19')]:moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b'));return new BPromise(function(_0x388734,_0x1d8420){if(_[_0x3eb5('0x1c')](_0x1ae934[_0x3eb5('0x1d')])){_0x388734({'ret':_0x3280e1});}else{_0x3d0606[_0x3eb5('0x1e')][_0x3eb5('0x1f')]({'where':{'id':_0xfeb642['id']}})['then'](function(_0x23c945){if(!_[_0x3eb5('0x1c')](_0x23c945)){var _0x11876c=_0x23c945[_0x3eb5('0x1d')];if(!_[_0x3eb5('0x1c')](_0x11876c)){var _0x594cab=shared[_0x3eb5('0x20')];var _0x890f9b=_0x594cab[_0x11876c];var _0x51f0d9=_0x594cab[_0x1ae934[_0x3eb5('0x1d')]];if(!_[_0x3eb5('0x1c')](_0x890f9b)&&!_[_0x3eb5('0x1c')](_0x51f0d9)){var _0x27e5df=_0x890f9b[_0x3eb5('0x21')]-_0x51f0d9['utcOffset'];_0x3280e1=_0x1ae934[_0x3eb5('0x19')]?_0x1ae934[_0x3eb5('0x19')]:moment();var _0xdae3cf=moment(_0x3280e1)[_0x3eb5('0x22')](_0x27e5df,_0x3eb5('0x23'));_0x388734({'ret':_0xdae3cf['format'](_0x3eb5('0x1b'))});}else _0x388734({'ret':_0x3280e1});}else _0x388734({'ret':_0x3280e1});}else{_0x388734({'ret':_0x3280e1});}});}});return 0xa;}var _0x3e01e2=function(_0x59b53a){return new BPromise(function(_0xaa7644,_0x493874){_0x59cfad(_0x59b53a,_0x1cf952)[_0x3eb5('0x24')](function(_0x4feca4){_0x1cf952['scheduledat']=_0x4feca4[_0x3eb5('0x25')];_0x3d0606[_0x3eb5('0x26')]['findOne']({'where':{'phone':_0x1cf952[_0x3eb5('0xd')],'VoiceQueueId':_0x59b53a['id']}})['then'](function(_0x3ab812){if(!_['isNil'](_0x3ab812)){throw new Error(_0x3eb5('0x27')+_0x1cf952['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x59b53a['id']);}return _0x3d0606[_0x3eb5('0x26')]['create']({'phone':_0x1cf952['phone'],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'priority':_0x1cf952[_0x3eb5('0x29')]?_0x1cf952[_0x3eb5('0x29')]:0x2,'scheduledat':_0x1cf952['scheduledat']?_0x1cf952[_0x3eb5('0x19')]:moment()[_0x3eb5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1cf952['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x1cf952[_0x3eb5('0x2a')]?_0x1cf952[_0x3eb5('0x2a')]:undefined,'callbackat':_0x1cf952[_0x3eb5('0x2a')]?moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b')):undefined,'VoiceQueueId':_0x59b53a['id']});})[_0x3eb5('0x2b')](function(_0x56554c){_0x493874(_0x56554c);});});});};var _0x180fd2=function(_0xfae2dd){return new BPromise(function(_0x2f4179,_0x13c514){_0x59cfad(_0xfae2dd,_0x1cf952)[_0x3eb5('0x24')](function(_0x274e87){_0x1cf952['scheduledat']=_0x274e87['ret'];_0x3d0606[_0x3eb5('0x26')][_0x3eb5('0x1f')]({'where':{'phone':_0x1cf952[_0x3eb5('0xd')],'VoiceQueueId':_0xfae2dd['id']}})[_0x3eb5('0x24')](function(_0x265548){if(!_[_0x3eb5('0x1c')](_0x265548)){throw new Error(_0x3eb5('0x27')+_0x1cf952[_0x3eb5('0xd')]+_0x3eb5('0x2c')+_0xfae2dd['id']);}return _0x3d0606[_0x3eb5('0x2d')][_0x3eb5('0x1f')]({'where':{'calleridnum':_0x1cf952[_0x3eb5('0xd')],'VoiceQueueId':_0xfae2dd['id']}});})['then'](function(_0x1bed7f){if(!_['isNil'](_0x1bed7f)){throw new Error(_0x3eb5('0x2e')+_0x1cf952[_0x3eb5('0xd')]+_0x3eb5('0x2f')+_0xfae2dd['id']);}return _0x3d0606[_0x3eb5('0x26')][_0x3eb5('0x30')]({'phone':_0x1cf952[_0x3eb5('0xd')],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'priority':_0x1cf952[_0x3eb5('0x29')]?_0x1cf952['priority']:0x2,'scheduledat':_0x1cf952[_0x3eb5('0x19')]?_0x1cf952[_0x3eb5('0x19')]:moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b')),'callback':_0x1cf952[_0x3eb5('0x2a')]?!![]:![],'callbackuniqueid':_0x1cf952['callbackUniqueid']?_0x1cf952[_0x3eb5('0x2a')]:undefined,'callbackat':_0x1cf952[_0x3eb5('0x2a')]?moment()[_0x3eb5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0xfae2dd['id']});})['catch'](function(_0x4a57a2){_0x13c514(_0x4a57a2);});});});};function _0x587661(){return function(_0xa4ef30){logger[_0x3eb5('0x15')](_0x3eb5('0x16'),'afterCreate',util[_0x3eb5('0x18')](_0xa4ef30,{'showHidden':![],'depth':null}));};}function _0x3c33ad(_0x3d68d7,_0x444ebc){var _0x26a962=_0x444ebc[_0x3eb5('0x19')]?_0x444ebc[_0x3eb5('0x19')]:moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b'));return new BPromise(function(_0x3be551,_0x744878){if(_['isNil'](_0x444ebc[_0x3eb5('0x1d')])){_0x3be551({'ret':_0x26a962});}else{_0x3d0606[_0x3eb5('0x31')][_0x3eb5('0x1f')]({'where':{'id':_0x3d68d7['id']}})[_0x3eb5('0x24')](function(_0x3e3dc0){if(!_[_0x3eb5('0x1c')](_0x3e3dc0)){var _0x15244e=_0x3e3dc0['dialTimezone'];if(!_[_0x3eb5('0x1c')](_0x15244e)){var _0x4b6c79=shared[_0x3eb5('0x20')];var _0x2d160d=_0x4b6c79[_0x15244e];var _0x14b930=_0x4b6c79[_0x444ebc['dialTimezone']];if(!_['isNil'](_0x2d160d)&&!_[_0x3eb5('0x1c')](_0x14b930)){var _0x5876ed=_0x2d160d['utcOffset']-_0x14b930['utcOffset'];_0x26a962=_0x444ebc[_0x3eb5('0x19')]?_0x444ebc['scheduledat']:moment();var _0x8658f5=moment(_0x26a962)[_0x3eb5('0x22')](_0x5876ed,_0x3eb5('0x23'));_0x3be551({'ret':_0x8658f5['format'](_0x3eb5('0x1b'))});}else _0x3be551({'ret':_0x26a962});}else _0x3be551({'ret':_0x26a962});}else{_0x3be551({'ret':_0x26a962});}});}});return 0xa;}var _0x2cb8dc=function(_0xa60be9){return new BPromise(function(_0x2d34a8,_0x3f8b5c){_0x3c33ad(_0xa60be9,_0x1cf952)[_0x3eb5('0x24')](function(_0x5b7054){_0x1cf952[_0x3eb5('0x19')]=_0x5b7054['ret'];_0x3d0606[_0x3eb5('0x26')]['findOne']({'where':{'phone':_0x1cf952['phone'],'CampaignId':_0xa60be9['id']}})[_0x3eb5('0x24')](function(_0x2ef93f){if(!_['isNil'](_0x2ef93f)){throw new Error(_0x3eb5('0x27')+_0x1cf952[_0x3eb5('0xd')]+_0x3eb5('0x32')+_0xa60be9['id']);}return _0x3d0606[_0x3eb5('0x26')][_0x3eb5('0x30')]({'phone':_0x1cf952[_0x3eb5('0xd')],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'priority':_0x1cf952['priority']?_0x1cf952[_0x3eb5('0x29')]:0x2,'scheduledat':_0x1cf952[_0x3eb5('0x19')]?_0x1cf952[_0x3eb5('0x19')]:moment()[_0x3eb5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x1cf952[_0x3eb5('0x2a')]?!![]:![],'callbackuniqueid':_0x1cf952[_0x3eb5('0x2a')]?_0x1cf952['callbackUniqueid']:undefined,'callbackat':_0x1cf952[_0x3eb5('0x2a')]?moment()['format'](_0x3eb5('0x1b')):undefined,'CampaignId':_0xa60be9['id']});})[_0x3eb5('0x2b')](function(_0x641363){_0x3f8b5c(_0x641363);});});});};var _0x47a24b=function(_0x472062){return new BPromise(function(_0x5c19e5,_0x217bc3){_0x3c33ad(_0x472062,_0x1cf952)[_0x3eb5('0x24')](function(_0x276364){_0x1cf952['scheduledat']=_0x276364[_0x3eb5('0x25')];_0x3d0606[_0x3eb5('0x26')]['findOne']({'where':{'phone':_0x1cf952[_0x3eb5('0xd')],'CampaignId':_0x472062['id']}})['then'](function(_0x1a0dc7){if(!_[_0x3eb5('0x1c')](_0x1a0dc7)){throw new Error(_0x3eb5('0x27')+_0x1cf952['phone']+_0x3eb5('0x33')+_0x472062['id']);}return _0x3d0606['CmHopperFinal'][_0x3eb5('0x1f')]({'where':{'calleridnum':_0x1cf952[_0x3eb5('0xd')],'CampaignId':_0x472062['id']}});})[_0x3eb5('0x24')](function(_0x39734d){if(!_[_0x3eb5('0x1c')](_0x39734d)){throw new Error(_0x3eb5('0x2e')+_0x1cf952[_0x3eb5('0xd')]+_0x3eb5('0x34')+_0x472062['id']);}return _0x3d0606[_0x3eb5('0x26')]['create']({'phone':_0x1cf952['phone'],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'priority':_0x1cf952['priority']?_0x1cf952[_0x3eb5('0x29')]:0x2,'scheduledat':_0x1cf952['scheduledat']?_0x1cf952[_0x3eb5('0x19')]:moment()['format'](_0x3eb5('0x1b')),'callback':_0x1cf952[_0x3eb5('0x2a')]?!![]:![],'callbackuniqueid':_0x1cf952[_0x3eb5('0x2a')]?_0x1cf952[_0x3eb5('0x2a')]:undefined,'callbackat':_0x1cf952[_0x3eb5('0x2a')]?moment()['format'](_0x3eb5('0x1b')):undefined,'CampaignId':_0x472062['id']});})[_0x3eb5('0x2b')](function(_0x326d79){_0x217bc3(_0x326d79);});});});};if(_0x1cf952[_0x3eb5('0x28')]){_0x3d0606['VoiceQueue'][_0x3eb5('0x35')]({'where':{'type':_0x3eb5('0x36')},'attributes':['id',_0x3eb5('0x37'),'dialTimezone'],'include':[{'model':_0x3d0606['CmList'],'as':_0x3eb5('0x38'),'where':{'id':_0x1cf952[_0x3eb5('0x28')]}}]})['then'](function(_0x2b5b30){if(_0x2b5b30){var _0xf5e69=[];for(var _0x520d54=0x0,_0x323de2;_0x520d54<_0x2b5b30[_0x3eb5('0x39')];_0x520d54+=0x1){_0x323de2=_0x2b5b30[_0x520d54][_0x3eb5('0x3a')]({'plain':!![]});switch(_0x323de2[_0x3eb5('0x37')]){case _0x3eb5('0x3b'):_0x180fd2(_0x323de2)[_0x3eb5('0x2b')](_0x8ba8ff());break;case _0x3eb5('0x3c'):_0x3e01e2(_0x323de2)[_0x3eb5('0x2b')](_0x8ba8ff());break;default:_0x3c33ad(_0x323de2,_0x1cf952)[_0x3eb5('0x24')](function(_0xe4b315){_0x1cf952[_0x3eb5('0x19')]=_0xe4b315[_0x3eb5('0x25')];_0x3d0606[_0x3eb5('0x26')]['create']({'phone':_0x1cf952[_0x3eb5('0xd')],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'scheduledat':_0x1cf952['scheduledat']?_0x1cf952['scheduledat']:moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b')),'priority':_0x1cf952[_0x3eb5('0x29')]?_0x1cf952['priority']:0x2,'callback':_0x1cf952[_0x3eb5('0x2a')]?!![]:![],'callbackuniqueid':_0x1cf952[_0x3eb5('0x2a')]?_0x1cf952['callbackUniqueid']:undefined,'callbackat':_0x1cf952['callbackUniqueid']?moment()[_0x3eb5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x323de2['id']})['catch'](_0x8ba8ff());});}}}})['then'](function(){return _0x3d0606[_0x3eb5('0x1e')][_0x3eb5('0x35')]({'where':{'type':_0x3eb5('0x36')},'attributes':['id'],'include':[{'model':_0x3d0606['CmList'],'as':_0x3eb5('0x3d'),'where':{'id':_0x1cf952[_0x3eb5('0x28')]}}]})['then'](function(_0x42c053){if(_0x42c053){var _0x58eb06=[];for(var _0x4f1b6e=0x0,_0x434e39;_0x4f1b6e<_0x42c053[_0x3eb5('0x39')];_0x4f1b6e+=0x1){_0x434e39=_0x42c053[_0x4f1b6e][_0x3eb5('0x3a')]({'plain':!![]});_0x3d0606[_0x3eb5('0x3e')]['create']({'phone':_0x1cf952['phone'],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'VoiceQueueId':_0x434e39['id']})['catch'](function(_0x416df6){logger[_0x3eb5('0x15')](_0x3eb5('0x3f'),'afterCreate',_0x416df6[_0x3eb5('0x40')]);});}}});})[_0x3eb5('0x24')](function(){return _0x3d0606[_0x3eb5('0x31')][_0x3eb5('0x35')]({'attributes':['id',_0x3eb5('0x37'),_0x3eb5('0x1d')],'include':[{'model':_0x3d0606[_0x3eb5('0x41')],'as':_0x3eb5('0x38'),'where':{'id':_0x1cf952['ListId']}}]})[_0x3eb5('0x24')](function(_0x2163a7){if(_0x2163a7){var _0xa1971b=[];for(var _0x1099b5=0x0,_0x3169f9;_0x1099b5<_0x2163a7['length'];_0x1099b5+=0x1){_0x3169f9=_0x2163a7[_0x1099b5][_0x3eb5('0x3a')]({'plain':!![]});switch(_0x3169f9[_0x3eb5('0x37')]){case'always':_0x47a24b(_0x3169f9)[_0x3eb5('0x2b')](_0x587661());break;case _0x3eb5('0x3c'):_0x2cb8dc(_0x3169f9)[_0x3eb5('0x2b')](_0x587661());break;default:_0x3d0606['CmHopper'][_0x3eb5('0x30')]({'phone':_0x1cf952[_0x3eb5('0xd')],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'scheduledat':_0x1cf952[_0x3eb5('0x19')]?_0x1cf952[_0x3eb5('0x19')]:moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b')),'priority':_0x1cf952['priority']?_0x1cf952[_0x3eb5('0x29')]:0x2,'callback':_0x1cf952[_0x3eb5('0x2a')]?!![]:![],'callbackuniqueid':_0x1cf952['callbackUniqueid']?_0x1cf952['callbackUniqueid']:undefined,'callbackat':_0x1cf952[_0x3eb5('0x2a')]?moment()[_0x3eb5('0x1a')](_0x3eb5('0x1b')):undefined,'CampaignId':_0x3169f9['id']})[_0x3eb5('0x2b')](_0x587661());}}}});})[_0x3eb5('0x24')](function(){return _0x3d0606['Campaign'][_0x3eb5('0x35')]({'attributes':['id'],'include':[{'model':_0x3d0606['CmList'],'as':_0x3eb5('0x3d'),'where':{'id':_0x1cf952['ListId']}}]})['then'](function(_0x16b77c){if(_0x16b77c){var _0x1a5860=[];for(var _0x387778=0x0,_0x55141c;_0x387778<_0x16b77c['length'];_0x387778+=0x1){_0x55141c=_0x16b77c[_0x387778]['get']({'plain':!![]});_0x3d0606[_0x3eb5('0x3e')][_0x3eb5('0x30')]({'phone':_0x1cf952[_0x3eb5('0xd')],'ContactId':_0x1cf952['id'],'ListId':_0x1cf952[_0x3eb5('0x28')],'CampaignId':_0x55141c['id']})[_0x3eb5('0x2b')](function(_0x2cd12e){logger[_0x3eb5('0x15')](_0x3eb5('0x3f'),_0x3eb5('0x17'),_0x2cd12e[_0x3eb5('0x40')]);});}}});})[_0x3eb5('0x24')](function(){_0xa0e0d();})[_0x3eb5('0x2b')](function(_0x4e262c){logger['error'](_0x3eb5('0x3f'),_0x3eb5('0x17'),_0x4e262c[_0x3eb5('0x40')]);_0xa0e0d(_0x4e262c);});}else{_0xa0e0d(new Error(_0x3eb5('0x42')));}},'afterDestroy':function(_0x24294e,_0x525606,_0x9f0f34){var _0x13c7a8=_0x35e623[_0x3eb5('0x43')];var _0x145717=_0x24294e[_0x3eb5('0x3a')]({'plain':!![]});return _0x13c7a8[_0x3eb5('0x26')][_0x3eb5('0x35')]({'raw':!![],'where':{'ListId':_0x145717[_0x3eb5('0x28')],'ContactId':_0x145717['id']}})[_0x3eb5('0x24')](function(_0x1a28ba){if(!_[_0x3eb5('0x44')](_0x1a28ba)){var _0x52f499=[];for(var _0x4df167=0x0;_0x4df167<_0x1a28ba['length'];_0x4df167+=0x1){var _0x222d70=_0x13c7a8[_0x3eb5('0x26')][_0x3eb5('0x45')]({'where':{'ListId':_0x1a28ba[_0x4df167]['ListId'],'ContactId':_0x1a28ba[_0x4df167][_0x3eb5('0x46')],'VoiceQueueId':_0x1a28ba[_0x4df167][_0x3eb5('0x47')],'CampaignId':_0x1a28ba[_0x4df167][_0x3eb5('0x48')]}});_0x52f499[_0x3eb5('0x49')](_0x222d70);}return BPromise[_0x3eb5('0x4a')](_0x52f499);}})['then'](function(_0x263db1){logger[_0x3eb5('0x4b')](_0x3eb5('0x4c'),util[_0x3eb5('0x18')](_0x263db1,{'showHidden':![],'depth':null}));_0x9f0f34();})['catch'](function(_0x5f50e9){logger[_0x3eb5('0x15')](_0x3eb5('0x4d'),util[_0x3eb5('0x18')](_0x5f50e9,{'showHidden':![],'depth':null}));_0x9f0f34(_0x5f50e9);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index f99be99..e47a933 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(_0x3aa6da,_0x2f808a){var _0x208817=function(_0x3ee076){while(--_0x3ee076){_0x3aa6da['push'](_0x3aa6da['shift']());}};_0x208817(++_0x2f808a);}(_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 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(_0x4c0c0f,_0x1d976b){var _0x1722da=function(_0x46e06a){while(--_0x46e06a){_0x4c0c0f['push'](_0x4c0c0f['shift']());}};_0x1722da(++_0x1d976b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 ee7ad88..461a7b5 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 _0x89c3=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0x145e9e,_0x2e6dd4){var _0x2264c2=function(_0x57d209){while(--_0x57d209){_0x145e9e['push'](_0x145e9e['shift']());}};_0x2264c2(++_0x2e6dd4);}(_0x89c3,0xff));var _0x389c=function(_0x193f84,_0x3e2dca){_0x193f84=_0x193f84-0x0;var _0xb1263b=_0x89c3[_0x193f84];return _0xb1263b;};'use strict';var Sequelize=require(_0x389c('0x0'));module[_0x389c('0x1')]={'CmContactId':{'type':Sequelize[_0x389c('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x389c('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x389c('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x389c('0x3')],'defaultValue':_0x389c('0x4')},'OrderBy':{'type':Sequelize[_0x389c('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0x559a=['exports','STRING','INTEGER','PHONE','sequelize'];(function(_0x76ddc,_0x32ed4b){var _0x24ebc4=function(_0x314fd1){while(--_0x314fd1){_0x76ddc['push'](_0x76ddc['shift']());}};_0x24ebc4(++_0x32ed4b);}(_0x559a,0xb3));var _0xa559=function(_0x56697c,_0xe7812){_0x56697c=_0x56697c-0x0;var _0x55e063=_0x559a[_0x56697c];return _0x55e063;};'use strict';var Sequelize=require(_0xa559('0x0'));module[_0xa559('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xa559('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xa559('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xa559('0x2')],'defaultValue':_0xa559('0x4')},'OrderBy':{'type':Sequelize[_0xa559('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xa559('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 65eada8..a865ff6 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 _0x5beb=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','papaparse','../../config/license/hardware'];(function(_0xa3de2b,_0x27c03d){var _0x317195=function(_0x692194){while(--_0x692194){_0xa3de2b['push'](_0xa3de2b['shift']());}};_0x317195(++_0x27c03d);}(_0x5beb,0x98));var _0xb5be=function(_0xfb2cd8,_0x2b9990){_0xfb2cd8=_0xfb2cd8-0x0;var _0x420691=_0x5beb[_0xfb2cd8];return _0x420691;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb5be('0x0'));var zipdir=require(_0xb5be('0x1'));var jsonpatch=require(_0xb5be('0x2'));var rp=require(_0xb5be('0x3'));var moment=require(_0xb5be('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb5be('0x5'));var util=require(_0xb5be('0x6'));var path=require(_0xb5be('0x7'));var sox=require(_0xb5be('0x8'));var csv=require(_0xb5be('0x9'));var ejs=require(_0xb5be('0xa'));var fs=require('fs');var fs_extra=require(_0xb5be('0xb'));var _=require(_0xb5be('0xc'));var squel=require(_0xb5be('0xd'));var crypto=require(_0xb5be('0xe'));var jsforce=require(_0xb5be('0xf'));var deskjs=require(_0xb5be('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb5be('0x11'));var Papa=require(_0xb5be('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5be('0x13'));var logger=require(_0xb5be('0x14'))(_0xb5be('0x15'));var utils=require(_0xb5be('0x16'));var config=require(_0xb5be('0x17'));var licenseUtil=require(_0xb5be('0x18'));var db=require(_0xb5be('0x19'))['db'];function respondWithStatusCode(_0x338c80,_0x486a63){_0x486a63=_0x486a63||0xcc;return function(_0x4776d0){if(_0x4776d0){return _0x338c80[_0xb5be('0x1a')](_0x486a63);}return _0x338c80['status'](_0x486a63)[_0xb5be('0x1b')]();};}function respondWithResult(_0x3e31ba,_0x2600db){_0x2600db=_0x2600db||0xc8;return function(_0xcead79){if(_0xcead79){return _0x3e31ba['status'](_0x2600db)[_0xb5be('0x1c')](_0xcead79);}};}function respondWithFilteredResult(_0x30e5fb,_0x393342){return function(_0x2ff114){if(_0x2ff114){var _0x2dabf1=typeof _0x393342['offset']==='undefined'&&typeof _0x393342['limit']===_0xb5be('0x1d');var _0x101eb6=_0x2ff114[_0xb5be('0x1e')];var _0x37f755=_0x2dabf1?0x0:_0x393342['offset'];var _0x246af0=_0x2dabf1?_0x2ff114['count']:_0x393342[_0xb5be('0x1f')]+_0x393342['limit'];var _0x197ad6;if(_0x246af0>=_0x101eb6){_0x246af0=_0x101eb6;_0x197ad6=0xc8;}else{_0x197ad6=0xce;}_0x30e5fb[_0xb5be('0x20')](_0x197ad6);return _0x30e5fb[_0xb5be('0x21')](_0xb5be('0x22'),_0x37f755+'-'+_0x246af0+'/'+_0x101eb6)[_0xb5be('0x1c')](_0x2ff114);}return null;};}function patchUpdates(_0x39cb16){return function(_0x387870){try{jsonpatch[_0xb5be('0x23')](_0x387870,_0x39cb16,!![]);}catch(_0x3aee5a){return BPromise[_0xb5be('0x24')](_0x3aee5a);}return _0x387870[_0xb5be('0x25')]();};}function saveUpdates(_0x1cf3eb,_0x5a57d4){return function(_0x346aa8){if(_0x346aa8){return _0x346aa8[_0xb5be('0x26')](_0x1cf3eb)[_0xb5be('0x27')](function(_0x5b0f72){return _0x5b0f72;});}return null;};}function removeEntity(_0xfc3acc,_0x50046e){return function(_0x55ed5d){if(_0x55ed5d){return _0x55ed5d[_0xb5be('0x28')]()['then'](function(){var _0xeb9487=_0x55ed5d['get']({'plain':!![]});var _0x5b38d5=_0xb5be('0x29');return db[_0xb5be('0x2a')][_0xb5be('0x28')]({'where':{'type':_0x5b38d5,'resourceId':_0xeb9487['id']}})[_0xb5be('0x27')](function(){return _0x55ed5d;});})[_0xb5be('0x27')](function(){_0xfc3acc[_0xb5be('0x20')](0xcc)[_0xb5be('0x1b')]();});}};}function handleEntityNotFound(_0x2635eb,_0xddfb5e){return function(_0x72c823){if(!_0x72c823){_0x2635eb[_0xb5be('0x1a')](0x194);}return _0x72c823;};}function handleError(_0x352ee5,_0xfe2daa){_0xfe2daa=_0xfe2daa||0x1f4;return function(_0x3a1853){logger[_0xb5be('0x2b')](_0x3a1853[_0xb5be('0x2c')]);if(_0x3a1853['name']){delete _0x3a1853[_0xb5be('0x2d')];}_0x352ee5[_0xb5be('0x20')](_0xfe2daa)[_0xb5be('0x2e')](_0x3a1853);};}exports[_0xb5be('0x2f')]=function(_0x5f44af,_0x41b4ef){var _0x4710d3={},_0x2f732a={},_0x5e1c98={'count':0x0,'rows':[]};var _0x13acbe=_[_0xb5be('0x30')](db[_0xb5be('0x31')][_0xb5be('0x32')],function(_0x56f3cb){return{'name':_0x56f3cb[_0xb5be('0x33')],'type':_0x56f3cb[_0xb5be('0x34')][_0xb5be('0x35')]};});_0x2f732a[_0xb5be('0x36')]=_[_0xb5be('0x30')](_0x13acbe,_0xb5be('0x2d'));_0x2f732a[_0xb5be('0x37')]=_['keys'](_0x5f44af[_0xb5be('0x37')]);_0x2f732a[_0xb5be('0x38')]=_[_0xb5be('0x39')](_0x2f732a['model'],_0x2f732a[_0xb5be('0x37')]);_0x4710d3[_0xb5be('0x3a')]=_[_0xb5be('0x39')](_0x2f732a[_0xb5be('0x36')],qs[_0xb5be('0x3b')](_0x5f44af[_0xb5be('0x37')]['fields']));_0x4710d3['attributes']=_0x4710d3[_0xb5be('0x3a')][_0xb5be('0x3c')]?_0x4710d3[_0xb5be('0x3a')]:_0x2f732a[_0xb5be('0x36')];if(!_0x5f44af[_0xb5be('0x37')][_0xb5be('0x3d')](_0xb5be('0x3e'))){_0x4710d3[_0xb5be('0x3f')]=qs['limit'](_0x5f44af[_0xb5be('0x37')]['limit']);_0x4710d3[_0xb5be('0x1f')]=qs[_0xb5be('0x1f')](_0x5f44af[_0xb5be('0x37')][_0xb5be('0x1f')]);}_0x4710d3['order']=qs['sort'](_0x5f44af['query'][_0xb5be('0x40')]);_0x4710d3[_0xb5be('0x41')]=qs['filters'](_[_0xb5be('0x42')](_0x5f44af[_0xb5be('0x37')],_0x2f732a[_0xb5be('0x38')]),_0x13acbe);if(_0x5f44af[_0xb5be('0x37')][_0xb5be('0x43')]){_0x4710d3['where']=_[_0xb5be('0x44')](_0x4710d3[_0xb5be('0x41')],{'$or':_[_0xb5be('0x30')](_0x13acbe,function(_0x46372a){if(_0x46372a[_0xb5be('0x34')]!==_0xb5be('0x45')){var _0x52887d={};_0x52887d[_0x46372a['name']]={'$like':'%'+_0x5f44af[_0xb5be('0x37')][_0xb5be('0x43')]+'%'};return _0x52887d;}})});}_0x4710d3=_[_0xb5be('0x44')]({},_0x4710d3,_0x5f44af[_0xb5be('0x46')]);var _0x2e8119={'where':_0x4710d3[_0xb5be('0x41')]};return db[_0xb5be('0x31')]['count'](_0x2e8119)[_0xb5be('0x27')](function(_0x179c22){_0x5e1c98[_0xb5be('0x1e')]=_0x179c22;if(_0x5f44af[_0xb5be('0x37')][_0xb5be('0x47')]){_0x4710d3[_0xb5be('0x48')]=[{'all':!![]}];}return db[_0xb5be('0x31')]['findAll'](_0x4710d3);})[_0xb5be('0x27')](function(_0x33a911){_0x5e1c98[_0xb5be('0x49')]=_0x33a911;return _0x5e1c98;})[_0xb5be('0x27')](respondWithFilteredResult(_0x41b4ef,_0x4710d3))['catch'](handleError(_0x41b4ef,null));};exports[_0xb5be('0x4a')]=function(_0x34b23e,_0x5d8ae1){var _0x58f79d={'raw':!![],'where':{'id':_0x34b23e[_0xb5be('0x4b')]['id']}},_0x3fded8={};_0x3fded8[_0xb5be('0x36')]=_['keys'](db[_0xb5be('0x31')]['rawAttributes']);_0x3fded8[_0xb5be('0x37')]=_[_0xb5be('0x4c')](_0x34b23e[_0xb5be('0x37')]);_0x3fded8['filters']=_[_0xb5be('0x39')](_0x3fded8[_0xb5be('0x36')],_0x3fded8[_0xb5be('0x37')]);_0x58f79d[_0xb5be('0x3a')]=_[_0xb5be('0x39')](_0x3fded8[_0xb5be('0x36')],qs[_0xb5be('0x3b')](_0x34b23e[_0xb5be('0x37')]['fields']));_0x58f79d['attributes']=_0x58f79d['attributes']['length']?_0x58f79d[_0xb5be('0x3a')]:_0x3fded8[_0xb5be('0x36')];if(_0x34b23e[_0xb5be('0x37')]['includeAll']){_0x58f79d[_0xb5be('0x48')]=[{'all':!![]}];}_0x58f79d=_['merge']({},_0x58f79d,_0x34b23e[_0xb5be('0x46')]);return db[_0xb5be('0x31')][_0xb5be('0x4d')](_0x58f79d)[_0xb5be('0x27')](handleEntityNotFound(_0x5d8ae1,null))[_0xb5be('0x27')](respondWithResult(_0x5d8ae1,null))[_0xb5be('0x4e')](handleError(_0x5d8ae1,null));};exports[_0xb5be('0x4f')]=function(_0x563e28,_0x489460){return db[_0xb5be('0x31')][_0xb5be('0x4f')](_0x563e28[_0xb5be('0x50')],{})[_0xb5be('0x27')](function(_0x4749af){var _0x873ab8=_0x563e28[_0xb5be('0x51')][_0xb5be('0x52')]({'plain':!![]});if(!_0x873ab8)throw new Error(_0xb5be('0x53'));if(_0x873ab8['role']===_0xb5be('0x51')){var _0x4e9de7=_0x4749af['get']({'plain':!![]});var _0x4da626=_0xb5be('0x29');return db[_0xb5be('0x54')]['find']({'where':{'name':_0x4da626,'userProfileId':_0x873ab8['userProfileId']},'raw':!![]})['then'](function(_0x8aac0c){if(_0x8aac0c&&_0x8aac0c['autoAssociation']===0x0){return db[_0xb5be('0x2a')]['create']({'name':_0x4e9de7['name'],'resourceId':_0x4e9de7['id'],'type':_0x8aac0c['name'],'sectionId':_0x8aac0c['id']},{})[_0xb5be('0x27')](function(){return _0x4749af;});}else{return _0x4749af;}})['catch'](function(_0x203ff3){logger[_0xb5be('0x2b')](_0xb5be('0x55'),_0x203ff3);throw _0x203ff3;});}return _0x4749af;})[_0xb5be('0x27')](respondWithResult(_0x489460,0xc9))[_0xb5be('0x4e')](handleError(_0x489460,null));};exports[_0xb5be('0x26')]=function(_0x4fcdbc,_0x5e97c1){if(_0x4fcdbc[_0xb5be('0x50')]['id']){delete _0x4fcdbc[_0xb5be('0x50')]['id'];}return db[_0xb5be('0x31')][_0xb5be('0x4d')]({'where':{'id':_0x4fcdbc[_0xb5be('0x4b')]['id']}})[_0xb5be('0x27')](handleEntityNotFound(_0x5e97c1,null))[_0xb5be('0x27')](saveUpdates(_0x4fcdbc['body'],null))[_0xb5be('0x27')](respondWithResult(_0x5e97c1,null))[_0xb5be('0x4e')](handleError(_0x5e97c1,null));};exports['destroy']=function(_0x5128cc,_0x1e8cdc){return db[_0xb5be('0x31')][_0xb5be('0x4d')]({'where':{'id':_0x5128cc['params']['id']}})[_0xb5be('0x27')](handleEntityNotFound(_0x1e8cdc,null))['then'](removeEntity(_0x1e8cdc,null))[_0xb5be('0x4e')](handleError(_0x1e8cdc,null));}; \ No newline at end of file +var _0x9158=['options','includeAll','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','map','CmContactHasItem','rawAttributes','fieldName','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter'];(function(_0x3fb37a,_0x11e8f5){var _0x5bb6b9=function(_0x3d6f1f){while(--_0x3d6f1f){_0x3fb37a['push'](_0x3fb37a['shift']());}};_0x5bb6b9(++_0x11e8f5);}(_0x9158,0x153));var _0x8915=function(_0x237004,_0x1cb563){_0x237004=_0x237004-0x0;var _0x7d2b2=_0x9158[_0x237004];return _0x7d2b2;};'use strict';var emlformat=require(_0x8915('0x0'));var rimraf=require(_0x8915('0x1'));var zipdir=require(_0x8915('0x2'));var jsonpatch=require(_0x8915('0x3'));var rp=require(_0x8915('0x4'));var moment=require(_0x8915('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8915('0x6'));var util=require(_0x8915('0x7'));var path=require(_0x8915('0x8'));var sox=require(_0x8915('0x9'));var csv=require(_0x8915('0xa'));var ejs=require(_0x8915('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8915('0xc'));var crypto=require(_0x8915('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8915('0xa'));var querystring=require(_0x8915('0xe'));var Papa=require(_0x8915('0xf'));var Redis=require(_0x8915('0x10'));var authService=require(_0x8915('0x11'));var qs=require(_0x8915('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8915('0x13'));var logger=require(_0x8915('0x14'))(_0x8915('0x15'));var utils=require(_0x8915('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8915('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x579923,_0x1372c4){_0x1372c4=_0x1372c4||0xcc;return function(_0xe91537){if(_0xe91537){return _0x579923[_0x8915('0x18')](_0x1372c4);}return _0x579923[_0x8915('0x19')](_0x1372c4)[_0x8915('0x1a')]();};}function respondWithResult(_0x5b6deb,_0x1d9e8e){_0x1d9e8e=_0x1d9e8e||0xc8;return function(_0x43f44c){if(_0x43f44c){return _0x5b6deb['status'](_0x1d9e8e)[_0x8915('0x1b')](_0x43f44c);}};}function respondWithFilteredResult(_0x3b38a9,_0x34e342){return function(_0x506bd4){if(_0x506bd4){var _0x2fc662=typeof _0x34e342[_0x8915('0x1c')]==='undefined'&&typeof _0x34e342[_0x8915('0x1d')]===_0x8915('0x1e');var _0x4765a8=_0x506bd4['count'];var _0xa0158f=_0x2fc662?0x0:_0x34e342[_0x8915('0x1c')];var _0x30983a=_0x2fc662?_0x506bd4[_0x8915('0x1f')]:_0x34e342[_0x8915('0x1c')]+_0x34e342['limit'];var _0x538de4;if(_0x30983a>=_0x4765a8){_0x30983a=_0x4765a8;_0x538de4=0xc8;}else{_0x538de4=0xce;}_0x3b38a9['status'](_0x538de4);return _0x3b38a9[_0x8915('0x20')](_0x8915('0x21'),_0xa0158f+'-'+_0x30983a+'/'+_0x4765a8)[_0x8915('0x1b')](_0x506bd4);}return null;};}function patchUpdates(_0x2cd7cc){return function(_0x5dd73a){try{jsonpatch[_0x8915('0x22')](_0x5dd73a,_0x2cd7cc,!![]);}catch(_0x260598){return BPromise['reject'](_0x260598);}return _0x5dd73a[_0x8915('0x23')]();};}function saveUpdates(_0x47d023,_0x3e1173){return function(_0x45d6d6){if(_0x45d6d6){return _0x45d6d6['update'](_0x47d023)[_0x8915('0x24')](function(_0x2f609e){return _0x2f609e;});}return null;};}function removeEntity(_0x135298,_0x253c1b){return function(_0x4b63ca){if(_0x4b63ca){return _0x4b63ca[_0x8915('0x25')]()[_0x8915('0x24')](function(){var _0x19cf77=_0x4b63ca[_0x8915('0x26')]({'plain':!![]});var _0xf2c84=_0x8915('0x27');return db[_0x8915('0x28')][_0x8915('0x25')]({'where':{'type':_0xf2c84,'resourceId':_0x19cf77['id']}})['then'](function(){return _0x4b63ca;});})['then'](function(){_0x135298[_0x8915('0x19')](0xcc)[_0x8915('0x1a')]();});}};}function handleEntityNotFound(_0x14c9e6,_0x4bd09f){return function(_0x2dfb79){if(!_0x2dfb79){_0x14c9e6[_0x8915('0x18')](0x194);}return _0x2dfb79;};}function handleError(_0x20b2a7,_0x290c25){_0x290c25=_0x290c25||0x1f4;return function(_0xf4b674){logger[_0x8915('0x29')](_0xf4b674[_0x8915('0x2a')]);if(_0xf4b674[_0x8915('0x2b')]){delete _0xf4b674['name'];}_0x20b2a7[_0x8915('0x19')](_0x290c25)[_0x8915('0x2c')](_0xf4b674);};}exports['index']=function(_0x364858,_0x48ed78){var _0x626217={},_0x20d8eb={},_0x4c54a3={'count':0x0,'rows':[]};var _0x3fa998=_[_0x8915('0x2d')](db[_0x8915('0x2e')][_0x8915('0x2f')],function(_0x11ccb4){return{'name':_0x11ccb4[_0x8915('0x30')],'type':_0x11ccb4['type']['key']};});_0x20d8eb['model']=_[_0x8915('0x2d')](_0x3fa998,'name');_0x20d8eb[_0x8915('0x31')]=_[_0x8915('0x32')](_0x364858[_0x8915('0x31')]);_0x20d8eb['filters']=_[_0x8915('0x33')](_0x20d8eb['model'],_0x20d8eb[_0x8915('0x31')]);_0x626217[_0x8915('0x34')]=_[_0x8915('0x33')](_0x20d8eb[_0x8915('0x35')],qs[_0x8915('0x36')](_0x364858['query'][_0x8915('0x36')]));_0x626217[_0x8915('0x34')]=_0x626217[_0x8915('0x34')][_0x8915('0x37')]?_0x626217[_0x8915('0x34')]:_0x20d8eb[_0x8915('0x35')];if(!_0x364858['query'][_0x8915('0x38')]('nolimit')){_0x626217['limit']=qs[_0x8915('0x1d')](_0x364858[_0x8915('0x31')][_0x8915('0x1d')]);_0x626217[_0x8915('0x1c')]=qs['offset'](_0x364858[_0x8915('0x31')]['offset']);}_0x626217[_0x8915('0x39')]=qs['sort'](_0x364858[_0x8915('0x31')][_0x8915('0x3a')]);_0x626217[_0x8915('0x3b')]=qs[_0x8915('0x3c')](_[_0x8915('0x3d')](_0x364858[_0x8915('0x31')],_0x20d8eb[_0x8915('0x3c')]),_0x3fa998);if(_0x364858['query']['filter']){_0x626217[_0x8915('0x3b')]=_[_0x8915('0x3e')](_0x626217['where'],{'$or':_[_0x8915('0x2d')](_0x3fa998,function(_0x303e4c){if(_0x303e4c[_0x8915('0x3f')]!==_0x8915('0x40')){var _0x2ce1af={};_0x2ce1af[_0x303e4c['name']]={'$like':'%'+_0x364858[_0x8915('0x31')][_0x8915('0x41')]+'%'};return _0x2ce1af;}})});}_0x626217=_[_0x8915('0x3e')]({},_0x626217,_0x364858[_0x8915('0x42')]);var _0x1faca0={'where':_0x626217[_0x8915('0x3b')]};return db[_0x8915('0x2e')][_0x8915('0x1f')](_0x1faca0)[_0x8915('0x24')](function(_0x544bde){_0x4c54a3[_0x8915('0x1f')]=_0x544bde;if(_0x364858['query'][_0x8915('0x43')]){_0x626217['include']=[{'all':!![]}];}return db[_0x8915('0x2e')]['findAll'](_0x626217);})[_0x8915('0x24')](function(_0x8529a1){_0x4c54a3[_0x8915('0x44')]=_0x8529a1;return _0x4c54a3;})['then'](respondWithFilteredResult(_0x48ed78,_0x626217))['catch'](handleError(_0x48ed78,null));};exports['show']=function(_0x6682b6,_0x18cd46){var _0x3a6be7={'raw':!![],'where':{'id':_0x6682b6[_0x8915('0x45')]['id']}},_0x269439={};_0x269439['model']=_[_0x8915('0x32')](db[_0x8915('0x2e')][_0x8915('0x2f')]);_0x269439[_0x8915('0x31')]=_['keys'](_0x6682b6[_0x8915('0x31')]);_0x269439[_0x8915('0x3c')]=_[_0x8915('0x33')](_0x269439['model'],_0x269439[_0x8915('0x31')]);_0x3a6be7[_0x8915('0x34')]=_[_0x8915('0x33')](_0x269439[_0x8915('0x35')],qs[_0x8915('0x36')](_0x6682b6['query']['fields']));_0x3a6be7['attributes']=_0x3a6be7['attributes'][_0x8915('0x37')]?_0x3a6be7[_0x8915('0x34')]:_0x269439[_0x8915('0x35')];if(_0x6682b6[_0x8915('0x31')]['includeAll']){_0x3a6be7['include']=[{'all':!![]}];}_0x3a6be7=_[_0x8915('0x3e')]({},_0x3a6be7,_0x6682b6[_0x8915('0x42')]);return db[_0x8915('0x2e')][_0x8915('0x46')](_0x3a6be7)[_0x8915('0x24')](handleEntityNotFound(_0x18cd46,null))[_0x8915('0x24')](respondWithResult(_0x18cd46,null))[_0x8915('0x47')](handleError(_0x18cd46,null));};exports[_0x8915('0x48')]=function(_0x3486e6,_0x58332c){return db[_0x8915('0x2e')][_0x8915('0x48')](_0x3486e6[_0x8915('0x49')],{})[_0x8915('0x24')](function(_0x3e63cf){var _0x58cc32=_0x3486e6[_0x8915('0x4a')]['get']({'plain':!![]});if(!_0x58cc32)throw new Error(_0x8915('0x4b'));if(_0x58cc32[_0x8915('0x4c')]===_0x8915('0x4a')){var _0x33da96=_0x3e63cf[_0x8915('0x26')]({'plain':!![]});var _0x1c4bbe=_0x8915('0x27');return db[_0x8915('0x4d')][_0x8915('0x46')]({'where':{'name':_0x1c4bbe,'userProfileId':_0x58cc32[_0x8915('0x4e')]},'raw':!![]})[_0x8915('0x24')](function(_0x33ee2c){if(_0x33ee2c&&_0x33ee2c[_0x8915('0x4f')]===0x0){return db[_0x8915('0x28')][_0x8915('0x48')]({'name':_0x33da96[_0x8915('0x2b')],'resourceId':_0x33da96['id'],'type':_0x33ee2c[_0x8915('0x2b')],'sectionId':_0x33ee2c['id']},{})[_0x8915('0x24')](function(){return _0x3e63cf;});}else{return _0x3e63cf;}})[_0x8915('0x47')](function(_0x4c4fd2){logger[_0x8915('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c4fd2);throw _0x4c4fd2;});}return _0x3e63cf;})[_0x8915('0x24')](respondWithResult(_0x58332c,0xc9))[_0x8915('0x47')](handleError(_0x58332c,null));};exports[_0x8915('0x50')]=function(_0xcb5cb2,_0x450c50){if(_0xcb5cb2[_0x8915('0x49')]['id']){delete _0xcb5cb2[_0x8915('0x49')]['id'];}return db[_0x8915('0x2e')][_0x8915('0x46')]({'where':{'id':_0xcb5cb2[_0x8915('0x45')]['id']}})[_0x8915('0x24')](handleEntityNotFound(_0x450c50,null))[_0x8915('0x24')](saveUpdates(_0xcb5cb2[_0x8915('0x49')],null))['then'](respondWithResult(_0x450c50,null))[_0x8915('0x47')](handleError(_0x450c50,null));};exports[_0x8915('0x25')]=function(_0x4d178d,_0x47d2d4){return db[_0x8915('0x2e')]['find']({'where':{'id':_0x4d178d['params']['id']}})[_0x8915('0x24')](handleEntityNotFound(_0x47d2d4,null))[_0x8915('0x24')](removeEntity(_0x47d2d4,null))['catch'](handleError(_0x47d2d4,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index b747ca7..d009c28 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 _0x94be=['request-promise','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','api','moment'];(function(_0x2bfa06,_0x351e03){var _0x58811b=function(_0x624504){while(--_0x624504){_0x2bfa06['push'](_0x2bfa06['shift']());}};_0x58811b(++_0x351e03);}(_0x94be,0x125));var _0xe94b=function(_0x461ab7,_0x396964){_0x461ab7=_0x461ab7-0x0;var _0x4f9c3c=_0x94be[_0x461ab7];return _0x4f9c3c;};'use strict';var _=require(_0xe94b('0x0'));var util=require(_0xe94b('0x1'));var logger=require('../../config/logger')(_0xe94b('0x2'));var moment=require(_0xe94b('0x3'));var BPromise=require('bluebird');var rp=require(_0xe94b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe94b('0x5'));var attributes=require(_0xe94b('0x6'));module[_0xe94b('0x7')]=function(_0x144cb3,_0x12a4e7){return _0x144cb3[_0xe94b('0x8')](_0xe94b('0x9'),attributes,{'tableName':_0xe94b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7882=['CmContactHasItem','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment'];(function(_0x53a1be,_0x42dff2){var _0x38ae84=function(_0x51fa5c){while(--_0x51fa5c){_0x53a1be['push'](_0x53a1be['shift']());}};_0x38ae84(++_0x42dff2);}(_0x7882,0x184));var _0x2788=function(_0x17a32f,_0x5a51a){_0x17a32f=_0x17a32f-0x0;var _0x15a293=_0x7882[_0x17a32f];return _0x15a293;};'use strict';var _=require(_0x2788('0x0'));var util=require(_0x2788('0x1'));var logger=require(_0x2788('0x2'))(_0x2788('0x3'));var moment=require(_0x2788('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2788('0x5'));var rimraf=require(_0x2788('0x6'));var config=require(_0x2788('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0x19b9a3,_0x36c462){return _0x19b9a3['define'](_0x2788('0x8'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index ace4ce8..fc5abfc 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 _0x9a43=['CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent'];(function(_0x54080c,_0x2b5537){var _0x37b3a7=function(_0xb85a85){while(--_0xb85a85){_0x54080c['push'](_0x54080c['shift']());}};_0x37b3a7(++_0x2b5537);}(_0x9a43,0x15a));var _0x39a4=function(_0x3c9a89,_0x378778){_0x3c9a89=_0x3c9a89-0x0;var _0x1eb47b=_0x9a43[_0x3c9a89];return _0x1eb47b;};'use strict';var _=require('lodash');var util=require(_0x39a4('0x0'));var moment=require(_0x39a4('0x1'));var BPromise=require(_0x39a4('0x2'));var rs=require(_0x39a4('0x3'));var fs=require('fs');var Redis=require(_0x39a4('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x39a4('0x5'));var config=require(_0x39a4('0x6'));var jayson=require(_0x39a4('0x7'));var client=jayson['client'][_0x39a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42e557,_0x574013,_0x13572a){return new BPromise(function(_0x29373b,_0x18e681){return client[_0x39a4('0x9')](_0x42e557,_0x13572a)[_0x39a4('0xa')](function(_0x423064){logger[_0x39a4('0xb')](_0x39a4('0xc'),_0x574013,_0x39a4('0xd'));logger['debug'](_0x39a4('0xe'),_0x574013,'request\x20sent',JSON[_0x39a4('0xf')](_0x423064));if(_0x423064['error']){if(_0x423064[_0x39a4('0x10')][_0x39a4('0x11')]===0x1f4){logger[_0x39a4('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x574013,_0x423064[_0x39a4('0x10')]['message']);return _0x18e681(_0x423064[_0x39a4('0x10')][_0x39a4('0x12')]);}logger[_0x39a4('0x10')](_0x39a4('0xc'),_0x574013,_0x423064[_0x39a4('0x10')][_0x39a4('0x12')]);return _0x29373b(_0x423064[_0x39a4('0x10')]['message']);}else{logger[_0x39a4('0xb')]('CmContactHasItem,\x20%s,\x20%s',_0x574013,_0x39a4('0xd'));_0x29373b(_0x423064[_0x39a4('0x13')][_0x39a4('0x12')]);}})['catch'](function(_0x222711){logger[_0x39a4('0x10')](_0x39a4('0xc'),_0x574013,_0x222711);_0x18e681(_0x222711);});});} \ No newline at end of file +var _0x9b5d=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','info','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','CmContactHasItem,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x31af4e,_0x3230dc){var _0x401fca=function(_0x5eb583){while(--_0x5eb583){_0x31af4e['push'](_0x31af4e['shift']());}};_0x401fca(++_0x3230dc);}(_0x9b5d,0x1c9));var _0xd9b5=function(_0x4fcea8,_0x50350c){_0x4fcea8=_0x4fcea8-0x0;var _0x396793=_0x9b5d[_0x4fcea8];return _0x396793;};'use strict';var _=require(_0xd9b5('0x0'));var util=require(_0xd9b5('0x1'));var moment=require(_0xd9b5('0x2'));var BPromise=require(_0xd9b5('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd9b5('0x4'));var db=require(_0xd9b5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd9b5('0x6'))(_0xd9b5('0x7'));var config=require(_0xd9b5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd9b5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3fef77,_0x30ec84,_0x1c5f6f){return new BPromise(function(_0x6a1935,_0x190adb){return client['request'](_0x3fef77,_0x1c5f6f)['then'](function(_0x4ec47f){logger[_0xd9b5('0xa')]('CmContactHasItem,\x20%s,\x20%s',_0x30ec84,_0xd9b5('0xb'));logger['debug'](_0xd9b5('0xc'),_0x30ec84,'request\x20sent',JSON[_0xd9b5('0xd')](_0x4ec47f));if(_0x4ec47f[_0xd9b5('0xe')]){if(_0x4ec47f[_0xd9b5('0xe')][_0xd9b5('0xf')]===0x1f4){logger[_0xd9b5('0xe')](_0xd9b5('0x10'),_0x30ec84,_0x4ec47f[_0xd9b5('0xe')][_0xd9b5('0x11')]);return _0x190adb(_0x4ec47f[_0xd9b5('0xe')][_0xd9b5('0x11')]);}logger[_0xd9b5('0xe')](_0xd9b5('0x10'),_0x30ec84,_0x4ec47f[_0xd9b5('0xe')][_0xd9b5('0x11')]);return _0x6a1935(_0x4ec47f[_0xd9b5('0xe')]['message']);}else{logger['info'](_0xd9b5('0x10'),_0x30ec84,_0xd9b5('0xb'));_0x6a1935(_0x4ec47f[_0xd9b5('0x12')][_0xd9b5('0x11')]);}})[_0xd9b5('0x13')](function(_0x1b0707){logger[_0xd9b5('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x30ec84,_0x1b0707);_0x190adb(_0x1b0707);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 1004b64..22319b0 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 _0x8192=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','create','put'];(function(_0x54fa55,_0x852248){var _0x559bc4=function(_0x2fcefc){while(--_0x2fcefc){_0x54fa55['push'](_0x54fa55['shift']());}};_0x559bc4(++_0x852248);}(_0x8192,0x82));var _0x2819=function(_0x8c0304,_0x3a197c){_0x8c0304=_0x8c0304-0x0;var _0x1a9382=_0x8192[_0x8c0304];return _0x1a9382;};'use strict';var multer=require(_0x2819('0x0'));var util=require(_0x2819('0x1'));var path=require(_0x2819('0x2'));var timeout=require(_0x2819('0x3'));var express=require(_0x2819('0x4'));var router=express['Router']();var fs_extra=require(_0x2819('0x5'));var auth=require(_0x2819('0x6'));var interaction=require(_0x2819('0x7'));var config=require(_0x2819('0x8'));var controller=require(_0x2819('0x9'));router[_0x2819('0xa')]('/',auth[_0x2819('0xb')](),controller[_0x2819('0xc')]);router['get'](_0x2819('0xd'),auth[_0x2819('0xb')](),controller[_0x2819('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2819('0xf')]);router[_0x2819('0x10')](_0x2819('0xd'),auth[_0x2819('0xb')](),controller[_0x2819('0x11')]);router[_0x2819('0x12')](_0x2819('0xd'),auth[_0x2819('0xb')](),controller[_0x2819('0x13')]);module[_0x2819('0x14')]=router; \ No newline at end of file +var _0xc8a9=['isAuthenticated','index','/:id','show','create','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get'];(function(_0x24644d,_0x40ff3a){var _0x27ef8a=function(_0x564baf){while(--_0x564baf){_0x24644d['push'](_0x24644d['shift']());}};_0x27ef8a(++_0x40ff3a);}(_0xc8a9,0x128));var _0x9c8a=function(_0x35fe65,_0x5c429c){_0x35fe65=_0x35fe65-0x0;var _0x1fcf84=_0xc8a9[_0x35fe65];return _0x1fcf84;};'use strict';var multer=require(_0x9c8a('0x0'));var util=require(_0x9c8a('0x1'));var path=require(_0x9c8a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9c8a('0x3')]();var fs_extra=require(_0x9c8a('0x4'));var auth=require(_0x9c8a('0x5'));var interaction=require(_0x9c8a('0x6'));var config=require(_0x9c8a('0x7'));var controller=require(_0x9c8a('0x8'));router[_0x9c8a('0x9')]('/',auth[_0x9c8a('0xa')](),controller[_0x9c8a('0xb')]);router[_0x9c8a('0x9')](_0x9c8a('0xc'),auth[_0x9c8a('0xa')](),controller[_0x9c8a('0xd')]);router['post']('/',auth[_0x9c8a('0xa')](),controller[_0x9c8a('0xe')]);router['put'](_0x9c8a('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9c8a('0xc'),auth[_0x9c8a('0xa')](),controller[_0x9c8a('0xf')]);module[_0x9c8a('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 019a6bc..1665733 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 _0xd4ba=['sequelize','lodash','exports','VIRTUAL','getDataValue','alias','setDataValue','STRING','TEXT','long','type','parse','values','isArray','BOOLEAN','ENUM','voice'];(function(_0x1c8181,_0x424b01){var _0x3d1cb=function(_0x270e8e){while(--_0x270e8e){_0x1c8181['push'](_0x1c8181['shift']());}};_0x3d1cb(++_0x424b01);}(_0xd4ba,0x88));var _0xad4b=function(_0x5d1092,_0x57b1af){_0x5d1092=_0x5d1092-0x0;var _0x23511b=_0xd4ba[_0x5d1092];return _0x23511b;};'use strict';var Sequelize=require(_0xad4b('0x0'));var _=require(_0xad4b('0x1'));module[_0xad4b('0x2')]={'name':{'type':Sequelize[_0xad4b('0x3')],'get':function(_0x517324){return this[_0xad4b('0x4')](_0xad4b('0x5'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x2ccdc5){this[_0xad4b('0x6')]('alias',_0x2ccdc5?_0x2ccdc5:this[_0xad4b('0x4')]('name'));}},'type':{'type':Sequelize[_0xad4b('0x7')],'allowNull':![]},'values':{'type':Sequelize[_0xad4b('0x8')](_0xad4b('0x9')),'get':function(){if(this['getDataValue'](_0xad4b('0xa'))==='select'){return JSON[_0xad4b('0xb')](this[_0xad4b('0x4')]('values'));}else{return this[_0xad4b('0x4')](_0xad4b('0xc'));}},'set':function(_0x41a4ac){if(Array[_0xad4b('0xd')](_0x41a4ac)){this['setDataValue']('values',JSON['stringify'](_0x41a4ac));}else{this['setDataValue'](_0xad4b('0xc'),_0x41a4ac);}}},'required':{'type':Sequelize[_0xad4b('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xad4b('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xad4b('0xf')](_0xad4b('0x10'))}}; \ No newline at end of file +var _0xbec6=['isArray','setDataValue','BOOLEAN','ENUM','voice','exports','VIRTUAL','getDataValue','alias','STRING','TEXT','long','type','select','parse','values'];(function(_0xae01dd,_0xbd8a3c){var _0x8c26df=function(_0x359827){while(--_0x359827){_0xae01dd['push'](_0xae01dd['shift']());}};_0x8c26df(++_0xbd8a3c);}(_0xbec6,0x185));var _0x6bec=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0xbec6[_0x3b231a];return _0x18d67a;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x6bec('0x0')]={'name':{'type':Sequelize[_0x6bec('0x1')],'get':function(_0x2d86aa){return this[_0x6bec('0x2')](_0x6bec('0x3'));}},'alias':{'type':Sequelize[_0x6bec('0x4')],'allowNull':![],'set':function(_0x3df3aa){this['setDataValue'](_0x6bec('0x3'),_0x3df3aa?_0x3df3aa:this['getDataValue']('name'));}},'type':{'type':Sequelize[_0x6bec('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x6bec('0x5')](_0x6bec('0x6')),'get':function(){if(this[_0x6bec('0x2')](_0x6bec('0x7'))===_0x6bec('0x8')){return JSON[_0x6bec('0x9')](this[_0x6bec('0x2')](_0x6bec('0xa')));}else{return this[_0x6bec('0x2')](_0x6bec('0xa'));}},'set':function(_0x4c38a9){if(Array[_0x6bec('0xb')](_0x4c38a9)){this['setDataValue'](_0x6bec('0xa'),JSON['stringify'](_0x4c38a9));}else{this[_0x6bec('0xc')]('values',_0x4c38a9);}}},'required':{'type':Sequelize[_0x6bec('0xd')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x6bec('0xe')](_0x6bec('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index f3a4778..61c0805 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 _0x2d6e=['switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','CmCustomField','fieldName','type','key','differenceBy','map','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','include','show','keys','rawAttributes','body','find','params','destroy','transaction','create','text','Sequelize','TEXT','number','INTEGER'];(function(_0x436b6e,_0x30ccab){var _0x3fe68d=function(_0x4cc0a9){while(--_0x4cc0a9){_0x436b6e['push'](_0x436b6e['shift']());}};_0x3fe68d(++_0x30ccab);}(_0x2d6e,0xb3));var _0xe2d6=function(_0x5db269,_0x3df0ad){_0x5db269=_0x5db269-0x0;var _0x1f5787=_0x2d6e[_0x5db269];return _0x1f5787;};'use strict';var emlformat=require(_0xe2d6('0x0'));var rimraf=require(_0xe2d6('0x1'));var zipdir=require(_0xe2d6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe2d6('0x3'));var moment=require(_0xe2d6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe2d6('0x5'));var util=require(_0xe2d6('0x6'));var path=require(_0xe2d6('0x7'));var sox=require(_0xe2d6('0x8'));var csv=require(_0xe2d6('0x9'));var ejs=require(_0xe2d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2d6('0xb'));var squel=require(_0xe2d6('0xc'));var crypto=require('crypto');var jsforce=require(_0xe2d6('0xd'));var deskjs=require(_0xe2d6('0xe'));var toCsv=require(_0xe2d6('0x9'));var querystring=require(_0xe2d6('0xf'));var Papa=require(_0xe2d6('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2d6('0x11'));var hardwareService=require(_0xe2d6('0x12'));var logger=require(_0xe2d6('0x13'))(_0xe2d6('0x14'));var utils=require(_0xe2d6('0x15'));var config=require(_0xe2d6('0x16'));var licenseUtil=require(_0xe2d6('0x17'));var db=require(_0xe2d6('0x18'))['db'];function respondWithStatusCode(_0x240d05,_0x5c9cbd){_0x5c9cbd=_0x5c9cbd||0xcc;return function(_0x596573){if(_0x596573){return _0x240d05[_0xe2d6('0x19')](_0x5c9cbd);}return _0x240d05[_0xe2d6('0x1a')](_0x5c9cbd)['end']();};}function respondWithResult(_0x1e2c96,_0x2d0820){_0x2d0820=_0x2d0820||0xc8;return function(_0x39b468){if(_0x39b468){return _0x1e2c96[_0xe2d6('0x1a')](_0x2d0820)[_0xe2d6('0x1b')](_0x39b468);}};}function respondWithFilteredResult(_0x2b9d5e,_0x11db4f){return function(_0xae67a){if(_0xae67a){var _0x57e6c0=typeof _0x11db4f[_0xe2d6('0x1c')]===_0xe2d6('0x1d')&&typeof _0x11db4f['limit']==='undefined';var _0x1298bf=_0xae67a[_0xe2d6('0x1e')];var _0x12fdd2=_0x57e6c0?0x0:_0x11db4f['offset'];var _0x50e43a=_0x57e6c0?_0xae67a[_0xe2d6('0x1e')]:_0x11db4f[_0xe2d6('0x1c')]+_0x11db4f[_0xe2d6('0x1f')];var _0x48795e;if(_0x50e43a>=_0x1298bf){_0x50e43a=_0x1298bf;_0x48795e=0xc8;}else{_0x48795e=0xce;}_0x2b9d5e[_0xe2d6('0x1a')](_0x48795e);return _0x2b9d5e['set'](_0xe2d6('0x20'),_0x12fdd2+'-'+_0x50e43a+'/'+_0x1298bf)[_0xe2d6('0x1b')](_0xae67a);}return null;};}function patchUpdates(_0x36abdd){return function(_0x49347b){try{jsonpatch[_0xe2d6('0x21')](_0x49347b,_0x36abdd,!![]);}catch(_0xcd2f67){return BPromise[_0xe2d6('0x22')](_0xcd2f67);}return _0x49347b[_0xe2d6('0x23')]();};}function saveUpdates(_0x401491,_0x1689b9){return function(_0x20ee14){if(_0x20ee14){return _0x20ee14[_0xe2d6('0x24')](_0x401491)[_0xe2d6('0x25')](function(_0x2e7e68){return _0x2e7e68;});}return null;};}function removeEntity(_0x378877,_0x2e8063){return function(_0xc0d58f){if(_0xc0d58f){return _0xc0d58f['destroy']()[_0xe2d6('0x25')](function(){_0x378877[_0xe2d6('0x1a')](0xcc)[_0xe2d6('0x26')]();});}};}function handleEntityNotFound(_0x2d2ffb,_0x42e38d){return function(_0xa6dfd0){if(!_0xa6dfd0){_0x2d2ffb[_0xe2d6('0x19')](0x194);}return _0xa6dfd0;};}function handleError(_0x59f329,_0x5f242b){_0x5f242b=_0x5f242b||0x1f4;return function(_0xfb8e92){logger[_0xe2d6('0x27')](_0xfb8e92[_0xe2d6('0x28')]);if(_0xfb8e92[_0xe2d6('0x29')]){delete _0xfb8e92[_0xe2d6('0x29')];}_0x59f329[_0xe2d6('0x1a')](_0x5f242b)[_0xe2d6('0x2a')](_0xfb8e92);};}exports[_0xe2d6('0x2b')]=function(_0x62f992,_0x315402){var _0x821d56={},_0x1916c3={},_0x51ae2d={'count':0x0,'rows':[]};var _0x128d33=_['map'](db[_0xe2d6('0x2c')]['rawAttributes'],function(_0x31956a){return{'name':_0x31956a[_0xe2d6('0x2d')],'type':_0x31956a[_0xe2d6('0x2e')][_0xe2d6('0x2f')]};});_0x1916c3['model']=_[_0xe2d6('0x30')](_[_0xe2d6('0x31')](_0x128d33,_0xe2d6('0x29')),[_0xe2d6('0x29')]);_0x1916c3['query']=_['keys'](_0x62f992[_0xe2d6('0x32')]);_0x1916c3[_0xe2d6('0x33')]=_[_0xe2d6('0x34')](_0x1916c3[_0xe2d6('0x35')],_0x1916c3[_0xe2d6('0x32')]);_0x821d56[_0xe2d6('0x36')]=_['intersection'](_0x1916c3[_0xe2d6('0x35')],qs[_0xe2d6('0x37')](_0x62f992[_0xe2d6('0x32')]['fields']));_0x821d56[_0xe2d6('0x36')]=_0x821d56[_0xe2d6('0x36')][_0xe2d6('0x38')]?_0x821d56[_0xe2d6('0x36')]:_0x1916c3[_0xe2d6('0x35')];if(!_0x62f992[_0xe2d6('0x32')]['hasOwnProperty'](_0xe2d6('0x39'))){_0x821d56[_0xe2d6('0x1f')]=qs['limit'](_0x62f992[_0xe2d6('0x32')][_0xe2d6('0x1f')]);_0x821d56['offset']=qs[_0xe2d6('0x1c')](_0x62f992[_0xe2d6('0x32')][_0xe2d6('0x1c')]);}_0x821d56[_0xe2d6('0x3a')]=qs[_0xe2d6('0x3b')](_0x62f992[_0xe2d6('0x32')][_0xe2d6('0x3b')]);_0x821d56[_0xe2d6('0x3c')]=qs['filters'](_['pick'](_0x62f992[_0xe2d6('0x32')],_0x1916c3[_0xe2d6('0x33')]),_0x128d33);if(_0x62f992[_0xe2d6('0x32')]['filter']){_0x821d56['where']=_[_0xe2d6('0x3d')](_0x821d56['where'],{'$or':_[_0xe2d6('0x31')](_0x128d33,function(_0x22beb9){if(_0x22beb9[_0xe2d6('0x2e')]!==_0xe2d6('0x3e')){var _0x1bff96={};_0x1bff96[_0x22beb9[_0xe2d6('0x29')]]={'$like':'%'+_0x62f992[_0xe2d6('0x32')]['filter']+'%'};return _0x1bff96;}})});}_0x821d56=_[_0xe2d6('0x3d')]({},_0x821d56,_0x62f992[_0xe2d6('0x3f')]);var _0xa2ac15={'where':_0x821d56[_0xe2d6('0x3c')]};return db[_0xe2d6('0x2c')][_0xe2d6('0x1e')](_0xa2ac15)[_0xe2d6('0x25')](function(_0xd09a30){_0x51ae2d[_0xe2d6('0x1e')]=_0xd09a30;if(_0x62f992[_0xe2d6('0x32')]['includeAll']){_0x821d56[_0xe2d6('0x40')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x821d56);})[_0xe2d6('0x25')](function(_0x565758){_0x51ae2d['rows']=_0x565758;return _0x51ae2d;})[_0xe2d6('0x25')](respondWithFilteredResult(_0x315402,_0x821d56))['catch'](handleError(_0x315402,null));};exports[_0xe2d6('0x41')]=function(_0xa2bca3,_0x344c25){var _0x49763f={'raw':!![],'where':{'id':_0xa2bca3['params']['id']}},_0x514e25={};_0x514e25[_0xe2d6('0x35')]=_[_0xe2d6('0x42')](db[_0xe2d6('0x2c')][_0xe2d6('0x43')]);_0x514e25[_0xe2d6('0x32')]=_[_0xe2d6('0x42')](_0xa2bca3['query']);_0x514e25[_0xe2d6('0x33')]=_[_0xe2d6('0x34')](_0x514e25['model'],_0x514e25[_0xe2d6('0x32')]);_0x49763f[_0xe2d6('0x36')]=_[_0xe2d6('0x34')](_0x514e25['model'],qs['fields'](_0xa2bca3[_0xe2d6('0x32')][_0xe2d6('0x37')]));_0x49763f[_0xe2d6('0x36')]=_0x49763f['attributes'][_0xe2d6('0x38')]?_0x49763f[_0xe2d6('0x36')]:_0x514e25['model'];if(_0xa2bca3[_0xe2d6('0x32')]['includeAll']){_0x49763f['include']=[{'all':!![]}];}_0x49763f=_[_0xe2d6('0x3d')]({},_0x49763f,_0xa2bca3[_0xe2d6('0x3f')]);return db[_0xe2d6('0x2c')]['find'](_0x49763f)[_0xe2d6('0x25')](handleEntityNotFound(_0x344c25,null))[_0xe2d6('0x25')](respondWithResult(_0x344c25,null))['catch'](handleError(_0x344c25,null));};exports[_0xe2d6('0x24')]=function(_0x28fc08,_0x256ecd){if(_0x28fc08[_0xe2d6('0x44')]['id']){delete _0x28fc08[_0xe2d6('0x44')]['id'];}return db['CmCustomField'][_0xe2d6('0x45')]({'where':{'id':_0x28fc08[_0xe2d6('0x46')]['id']}})[_0xe2d6('0x25')](handleEntityNotFound(_0x256ecd,null))[_0xe2d6('0x25')](saveUpdates(_0x28fc08['body'],null))[_0xe2d6('0x25')](respondWithResult(_0x256ecd,null))['catch'](handleError(_0x256ecd,null));};exports[_0xe2d6('0x47')]=function(_0x3b54bd,_0x5977c1){return db[_0xe2d6('0x2c')][_0xe2d6('0x45')]({'where':{'id':_0x3b54bd['params']['id']}})[_0xe2d6('0x25')](handleEntityNotFound(_0x5977c1,null))['then'](removeEntity(_0x5977c1,null))['catch'](handleError(_0x5977c1,null));};exports['create']=function(_0x18b390,_0x92fb89){var _0x20b43d;return db['sequelize'][_0xe2d6('0x48')](function(_0x59e307){return db[_0xe2d6('0x2c')][_0xe2d6('0x49')](_0x18b390['body'],{'transaction':_0x59e307})[_0xe2d6('0x25')](function(_0x4f9f04){_0x20b43d=_0x4f9f04;var _0x43d920={'type':db['Sequelize']['TEXT'],'transaction':_0x59e307};switch(_0x18b390[_0xe2d6('0x44')]['type']){case _0xe2d6('0x4a'):_0x43d920[_0xe2d6('0x2e')]=db[_0xe2d6('0x4b')][_0xe2d6('0x4c')];break;case _0xe2d6('0x4d'):_0x43d920['type']=db[_0xe2d6('0x4b')][_0xe2d6('0x4e')];break;case _0xe2d6('0x4f'):_0x43d920[_0xe2d6('0x2e')]=db[_0xe2d6('0x4b')][_0xe2d6('0x50')];_0x43d920['defaultValue']=![];break;default:}return db[_0xe2d6('0x51')][_0xe2d6('0x52')][_0xe2d6('0x53')](_0xe2d6('0x54'),util[_0xe2d6('0x55')]('cf_%d',_0x20b43d['id']),_0x43d920);})[_0xe2d6('0x25')](function(){return _0x20b43d;});})[_0xe2d6('0x25')](respondWithResult(_0x92fb89,0xc9))['catch'](handleError(_0x92fb89,null));}; \ No newline at end of file +var _0x32ab=['CmCustomField','rawAttributes','type','key','model','differenceBy','map','filters','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','body','catch','find','create','sequelize','transaction','Sequelize','text','TEXT','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','name'];(function(_0x1946f7,_0x344f58){var _0x2f8b34=function(_0x503d1a){while(--_0x503d1a){_0x1946f7['push'](_0x1946f7['shift']());}};_0x2f8b34(++_0x344f58);}(_0x32ab,0x1dd));var _0xb32a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x32ab[_0x19950b];return _0x3c6b41;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb32a('0x0'));var jsonpatch=require(_0xb32a('0x1'));var rp=require(_0xb32a('0x2'));var moment=require(_0xb32a('0x3'));var BPromise=require(_0xb32a('0x4'));var Mustache=require(_0xb32a('0x5'));var util=require(_0xb32a('0x6'));var path=require(_0xb32a('0x7'));var sox=require(_0xb32a('0x8'));var csv=require(_0xb32a('0x9'));var ejs=require(_0xb32a('0xa'));var fs=require('fs');var fs_extra=require(_0xb32a('0xb'));var _=require(_0xb32a('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb32a('0x9'));var querystring=require(_0xb32a('0xd'));var Papa=require(_0xb32a('0xe'));var Redis=require('ioredis');var authService=require(_0xb32a('0xf'));var qs=require(_0xb32a('0x10'));var as=require(_0xb32a('0x11'));var hardwareService=require(_0xb32a('0x12'));var logger=require(_0xb32a('0x13'))('api');var utils=require(_0xb32a('0x14'));var config=require(_0xb32a('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb32a('0x16'))['db'];function respondWithStatusCode(_0x589d0e,_0xe9c9a2){_0xe9c9a2=_0xe9c9a2||0xcc;return function(_0x45cf53){if(_0x45cf53){return _0x589d0e[_0xb32a('0x17')](_0xe9c9a2);}return _0x589d0e[_0xb32a('0x18')](_0xe9c9a2)[_0xb32a('0x19')]();};}function respondWithResult(_0x170a78,_0x14cbaf){_0x14cbaf=_0x14cbaf||0xc8;return function(_0x9f0a2d){if(_0x9f0a2d){return _0x170a78[_0xb32a('0x18')](_0x14cbaf)[_0xb32a('0x1a')](_0x9f0a2d);}};}function respondWithFilteredResult(_0x568d15,_0x4265a3){return function(_0xc5ca62){if(_0xc5ca62){var _0x1908c1=typeof _0x4265a3[_0xb32a('0x1b')]===_0xb32a('0x1c')&&typeof _0x4265a3[_0xb32a('0x1d')]===_0xb32a('0x1c');var _0x3b5036=_0xc5ca62[_0xb32a('0x1e')];var _0x37268a=_0x1908c1?0x0:_0x4265a3[_0xb32a('0x1b')];var _0x5a1774=_0x1908c1?_0xc5ca62[_0xb32a('0x1e')]:_0x4265a3['offset']+_0x4265a3[_0xb32a('0x1d')];var _0x42624d;if(_0x5a1774>=_0x3b5036){_0x5a1774=_0x3b5036;_0x42624d=0xc8;}else{_0x42624d=0xce;}_0x568d15[_0xb32a('0x18')](_0x42624d);return _0x568d15[_0xb32a('0x1f')]('Content-Range',_0x37268a+'-'+_0x5a1774+'/'+_0x3b5036)[_0xb32a('0x1a')](_0xc5ca62);}return null;};}function patchUpdates(_0x57d595){return function(_0x33a421){try{jsonpatch[_0xb32a('0x20')](_0x33a421,_0x57d595,!![]);}catch(_0x4cab67){return BPromise[_0xb32a('0x21')](_0x4cab67);}return _0x33a421[_0xb32a('0x22')]();};}function saveUpdates(_0x1406c2,_0x425dbf){return function(_0xcd9585){if(_0xcd9585){return _0xcd9585[_0xb32a('0x23')](_0x1406c2)['then'](function(_0x257f34){return _0x257f34;});}return null;};}function removeEntity(_0x3c7895,_0x70de51){return function(_0x1e7a63){if(_0x1e7a63){return _0x1e7a63[_0xb32a('0x24')]()[_0xb32a('0x25')](function(){_0x3c7895['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x576f6f,_0x20b0b2){return function(_0x523554){if(!_0x523554){_0x576f6f[_0xb32a('0x17')](0x194);}return _0x523554;};}function handleError(_0x326a73,_0x20f0dd){_0x20f0dd=_0x20f0dd||0x1f4;return function(_0x30150f){logger['error'](_0x30150f['stack']);if(_0x30150f[_0xb32a('0x26')]){delete _0x30150f[_0xb32a('0x26')];}_0x326a73[_0xb32a('0x18')](_0x20f0dd)['send'](_0x30150f);};}exports['index']=function(_0x3c3f3e,_0x2f6247){var _0x46b068={},_0x490373={},_0x206e99={'count':0x0,'rows':[]};var _0x231f9a=_['map'](db[_0xb32a('0x27')][_0xb32a('0x28')],function(_0x42b342){return{'name':_0x42b342['fieldName'],'type':_0x42b342[_0xb32a('0x29')][_0xb32a('0x2a')]};});_0x490373[_0xb32a('0x2b')]=_[_0xb32a('0x2c')](_[_0xb32a('0x2d')](_0x231f9a,'name'),['name']);_0x490373['query']=_['keys'](_0x3c3f3e['query']);_0x490373[_0xb32a('0x2e')]=_[_0xb32a('0x2f')](_0x490373[_0xb32a('0x2b')],_0x490373[_0xb32a('0x30')]);_0x46b068[_0xb32a('0x31')]=_['intersection'](_0x490373[_0xb32a('0x2b')],qs[_0xb32a('0x32')](_0x3c3f3e[_0xb32a('0x30')]['fields']));_0x46b068[_0xb32a('0x31')]=_0x46b068['attributes'][_0xb32a('0x33')]?_0x46b068[_0xb32a('0x31')]:_0x490373['model'];if(!_0x3c3f3e['query']['hasOwnProperty'](_0xb32a('0x34'))){_0x46b068[_0xb32a('0x1d')]=qs[_0xb32a('0x1d')](_0x3c3f3e[_0xb32a('0x30')][_0xb32a('0x1d')]);_0x46b068['offset']=qs[_0xb32a('0x1b')](_0x3c3f3e['query'][_0xb32a('0x1b')]);}_0x46b068[_0xb32a('0x35')]=qs['sort'](_0x3c3f3e[_0xb32a('0x30')][_0xb32a('0x36')]);_0x46b068[_0xb32a('0x37')]=qs[_0xb32a('0x2e')](_[_0xb32a('0x38')](_0x3c3f3e['query'],_0x490373[_0xb32a('0x2e')]),_0x231f9a);if(_0x3c3f3e[_0xb32a('0x30')][_0xb32a('0x39')]){_0x46b068[_0xb32a('0x37')]=_[_0xb32a('0x3a')](_0x46b068[_0xb32a('0x37')],{'$or':_[_0xb32a('0x2d')](_0x231f9a,function(_0x1cb16e){if(_0x1cb16e[_0xb32a('0x29')]!==_0xb32a('0x3b')){var _0x4f4e35={};_0x4f4e35[_0x1cb16e[_0xb32a('0x26')]]={'$like':'%'+_0x3c3f3e[_0xb32a('0x30')]['filter']+'%'};return _0x4f4e35;}})});}_0x46b068=_[_0xb32a('0x3a')]({},_0x46b068,_0x3c3f3e[_0xb32a('0x3c')]);var _0x5389f9={'where':_0x46b068[_0xb32a('0x37')]};return db['CmCustomField'][_0xb32a('0x1e')](_0x5389f9)[_0xb32a('0x25')](function(_0x14caac){_0x206e99[_0xb32a('0x1e')]=_0x14caac;if(_0x3c3f3e[_0xb32a('0x30')][_0xb32a('0x3d')]){_0x46b068[_0xb32a('0x3e')]=[{'all':!![]}];}return db[_0xb32a('0x27')][_0xb32a('0x3f')](_0x46b068);})[_0xb32a('0x25')](function(_0x29f0eb){_0x206e99[_0xb32a('0x40')]=_0x29f0eb;return _0x206e99;})['then'](respondWithFilteredResult(_0x2f6247,_0x46b068))['catch'](handleError(_0x2f6247,null));};exports[_0xb32a('0x41')]=function(_0x30048d,_0x2769ee){var _0x8462b5={'raw':!![],'where':{'id':_0x30048d[_0xb32a('0x42')]['id']}},_0x3536e9={};_0x3536e9[_0xb32a('0x2b')]=_[_0xb32a('0x43')](db[_0xb32a('0x27')][_0xb32a('0x28')]);_0x3536e9[_0xb32a('0x30')]=_['keys'](_0x30048d[_0xb32a('0x30')]);_0x3536e9[_0xb32a('0x2e')]=_[_0xb32a('0x2f')](_0x3536e9['model'],_0x3536e9['query']);_0x8462b5['attributes']=_[_0xb32a('0x2f')](_0x3536e9[_0xb32a('0x2b')],qs[_0xb32a('0x32')](_0x30048d['query'][_0xb32a('0x32')]));_0x8462b5[_0xb32a('0x31')]=_0x8462b5[_0xb32a('0x31')][_0xb32a('0x33')]?_0x8462b5[_0xb32a('0x31')]:_0x3536e9[_0xb32a('0x2b')];if(_0x30048d[_0xb32a('0x30')][_0xb32a('0x3d')]){_0x8462b5['include']=[{'all':!![]}];}_0x8462b5=_[_0xb32a('0x3a')]({},_0x8462b5,_0x30048d[_0xb32a('0x3c')]);return db[_0xb32a('0x27')]['find'](_0x8462b5)[_0xb32a('0x25')](handleEntityNotFound(_0x2769ee,null))['then'](respondWithResult(_0x2769ee,null))['catch'](handleError(_0x2769ee,null));};exports[_0xb32a('0x23')]=function(_0x4c9b8e,_0x2b6575){if(_0x4c9b8e[_0xb32a('0x44')]['id']){delete _0x4c9b8e[_0xb32a('0x44')]['id'];}return db[_0xb32a('0x27')]['find']({'where':{'id':_0x4c9b8e[_0xb32a('0x42')]['id']}})[_0xb32a('0x25')](handleEntityNotFound(_0x2b6575,null))[_0xb32a('0x25')](saveUpdates(_0x4c9b8e[_0xb32a('0x44')],null))[_0xb32a('0x25')](respondWithResult(_0x2b6575,null))[_0xb32a('0x45')](handleError(_0x2b6575,null));};exports[_0xb32a('0x24')]=function(_0x59ca97,_0x41933b){return db[_0xb32a('0x27')][_0xb32a('0x46')]({'where':{'id':_0x59ca97[_0xb32a('0x42')]['id']}})[_0xb32a('0x25')](handleEntityNotFound(_0x41933b,null))[_0xb32a('0x25')](removeEntity(_0x41933b,null))['catch'](handleError(_0x41933b,null));};exports[_0xb32a('0x47')]=function(_0x426a70,_0x297606){var _0x220d79;return db[_0xb32a('0x48')][_0xb32a('0x49')](function(_0x2d9b0e){return db[_0xb32a('0x27')][_0xb32a('0x47')](_0x426a70[_0xb32a('0x44')],{'transaction':_0x2d9b0e})['then'](function(_0x3cb75f){_0x220d79=_0x3cb75f;var _0x21d504={'type':db[_0xb32a('0x4a')]['TEXT'],'transaction':_0x2d9b0e};switch(_0x426a70[_0xb32a('0x44')][_0xb32a('0x29')]){case _0xb32a('0x4b'):_0x21d504['type']=db[_0xb32a('0x4a')][_0xb32a('0x4c')];break;case'number':_0x21d504[_0xb32a('0x29')]=db['Sequelize'][_0xb32a('0x4d')];break;case _0xb32a('0x4e'):_0x21d504[_0xb32a('0x29')]=db[_0xb32a('0x4a')][_0xb32a('0x4f')];_0x21d504[_0xb32a('0x50')]=![];break;default:}return db[_0xb32a('0x48')][_0xb32a('0x51')][_0xb32a('0x52')](_0xb32a('0x53'),util[_0xb32a('0x54')](_0xb32a('0x55'),_0x220d79['id']),_0x21d504);})['then'](function(){return _0x220d79;});})['then'](respondWithResult(_0x297606,0xc9))[_0xb32a('0x45')](handleError(_0x297606,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index da9aa2e..265e5fa 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 _0xac36=['path','rimraf','../../config/environment','exports','define','CmCustomField','util','api','request-promise'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xac36,0x114));var _0x6ac3=function(_0x4e8e61,_0x510bdd){_0x4e8e61=_0x4e8e61-0x0;var _0x362dbc=_0xac36[_0x4e8e61];return _0x362dbc;};'use strict';var _=require('lodash');var util=require(_0x6ac3('0x0'));var logger=require('../../config/logger')(_0x6ac3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6ac3('0x2'));var fs=require('fs');var path=require(_0x6ac3('0x3'));var rimraf=require(_0x6ac3('0x4'));var config=require(_0x6ac3('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x6ac3('0x6')]=function(_0x4177be,_0x27f0fc){return _0x4177be[_0x6ac3('0x7')](_0x6ac3('0x8'),attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fa=['define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe2fa,0x1b0));var _0xae2f=function(_0x3e0f16,_0x1c23a4){_0x3e0f16=_0x3e0f16-0x0;var _0x190970=_0xe2fa[_0x3e0f16];return _0x190970;};'use strict';var _=require(_0xae2f('0x0'));var util=require(_0xae2f('0x1'));var logger=require(_0xae2f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xae2f('0x3'));var rp=require(_0xae2f('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae2f('0x5'));var config=require(_0xae2f('0x6'));var attributes=require(_0xae2f('0x7'));module['exports']=function(_0x488505,_0xddd9c6){return _0x488505[_0xae2f('0x8')](_0xae2f('0x9'),attributes,{'tableName':_0xae2f('0xa'),'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 c0ca27c..a8fe637 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 _0x7e13=['message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x33fe98,_0x4c43b6){var _0x347952=function(_0x42b834){while(--_0x42b834){_0x33fe98['push'](_0x33fe98['shift']());}};_0x347952(++_0x4c43b6);}(_0x7e13,0x173));var _0x37e1=function(_0xe42011,_0x45e2f8){_0xe42011=_0xe42011-0x0;var _0x1b4619=_0x7e13[_0xe42011];return _0x1b4619;};'use strict';var _=require(_0x37e1('0x0'));var util=require(_0x37e1('0x1'));var moment=require(_0x37e1('0x2'));var BPromise=require(_0x37e1('0x3'));var rs=require(_0x37e1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x37e1('0x5'))(_0x37e1('0x6'));var config=require(_0x37e1('0x7'));var jayson=require(_0x37e1('0x8'));var client=jayson[_0x37e1('0x9')][_0x37e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46811f,_0x51ffd8,_0x404f48){return new BPromise(function(_0x2b2e41,_0x5db99d){return client[_0x37e1('0xb')](_0x46811f,_0x404f48)[_0x37e1('0xc')](function(_0x3c53be){logger[_0x37e1('0xd')](_0x37e1('0xe'),_0x51ffd8,'request\x20sent');logger[_0x37e1('0xf')](_0x37e1('0x10'),_0x51ffd8,'request\x20sent',JSON[_0x37e1('0x11')](_0x3c53be));if(_0x3c53be['error']){if(_0x3c53be['error'][_0x37e1('0x12')]===0x1f4){logger['error'](_0x37e1('0xe'),_0x51ffd8,_0x3c53be[_0x37e1('0x13')][_0x37e1('0x14')]);return _0x5db99d(_0x3c53be[_0x37e1('0x13')][_0x37e1('0x14')]);}logger['error'](_0x37e1('0xe'),_0x51ffd8,_0x3c53be['error'][_0x37e1('0x14')]);return _0x2b2e41(_0x3c53be[_0x37e1('0x13')][_0x37e1('0x14')]);}else{logger[_0x37e1('0xd')](_0x37e1('0xe'),_0x51ffd8,_0x37e1('0x15'));_0x2b2e41(_0x3c53be['result'][_0x37e1('0x14')]);}})[_0x37e1('0x16')](function(_0x4fa26e){logger[_0x37e1('0x13')](_0x37e1('0xe'),_0x51ffd8,_0x4fa26e);_0x5db99d(_0x4fa26e);});});} \ No newline at end of file +var _0x771c=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','then','info','CmCustomField,\x20%s,\x20%s','debug'];(function(_0x2f4ee6,_0x24a540){var _0x28f20e=function(_0x239715){while(--_0x239715){_0x2f4ee6['push'](_0x2f4ee6['shift']());}};_0x28f20e(++_0x24a540);}(_0x771c,0x6d));var _0xc771=function(_0x52ebdd,_0x2dfd8b){_0x52ebdd=_0x52ebdd-0x0;var _0x1aafb0=_0x771c[_0x52ebdd];return _0x1aafb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc771('0x0'));var BPromise=require(_0xc771('0x1'));var rs=require(_0xc771('0x2'));var fs=require('fs');var Redis=require(_0xc771('0x3'));var db=require(_0xc771('0x4'))['db'];var utils=require(_0xc771('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7849cb,_0x50e9c7,_0x2786f){return new BPromise(function(_0x2c83b2,_0x5eb7d9){return client['request'](_0x7849cb,_0x2786f)[_0xc771('0x6')](function(_0x4b97cd){logger[_0xc771('0x7')](_0xc771('0x8'),_0x50e9c7,'request\x20sent');logger[_0xc771('0x9')](_0xc771('0xa'),_0x50e9c7,'request\x20sent',JSON[_0xc771('0xb')](_0x4b97cd));if(_0x4b97cd[_0xc771('0xc')]){if(_0x4b97cd[_0xc771('0xc')][_0xc771('0xd')]===0x1f4){logger['error'](_0xc771('0x8'),_0x50e9c7,_0x4b97cd[_0xc771('0xc')]['message']);return _0x5eb7d9(_0x4b97cd[_0xc771('0xc')][_0xc771('0xe')]);}logger[_0xc771('0xc')](_0xc771('0x8'),_0x50e9c7,_0x4b97cd[_0xc771('0xc')][_0xc771('0xe')]);return _0x2c83b2(_0x4b97cd[_0xc771('0xc')][_0xc771('0xe')]);}else{logger[_0xc771('0x7')](_0xc771('0x8'),_0x50e9c7,'request\x20sent');_0x2c83b2(_0x4b97cd[_0xc771('0xf')][_0xc771('0xe')]);}})[_0xc771('0x10')](function(_0x527727){logger[_0xc771('0xc')](_0xc771('0x8'),_0x50e9c7,_0x527727);_0x5eb7d9(_0x527727);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e150384..a57f176 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 _0xc949=['create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x29784b,_0x42a97c){var _0x30ad1b=function(_0x4922d0){while(--_0x4922d0){_0x29784b['push'](_0x29784b['shift']());}};_0x30ad1b(++_0x42a97c);}(_0xc949,0x181));var _0x9c94=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc949[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x9c94('0x0'));var util=require('util');var path=require(_0x9c94('0x1'));var timeout=require(_0x9c94('0x2'));var express=require(_0x9c94('0x3'));var router=express[_0x9c94('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9c94('0x5'));var interaction=require(_0x9c94('0x6'));var config=require('../../config/environment');var controller=require(_0x9c94('0x7'));router[_0x9c94('0x8')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xc')]);router[_0x9c94('0xd')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0xf')](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x10')]);router['delete'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x11')]);module[_0x9c94('0x12')]=router; \ No newline at end of file +var _0x91e6=['post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCustomField.controller','get','isAuthenticated','/:id'];(function(_0x25ae65,_0x550dbd){var _0x3bddb9=function(_0x46896d){while(--_0x46896d){_0x25ae65['push'](_0x25ae65['shift']());}};_0x3bddb9(++_0x550dbd);}(_0x91e6,0x123));var _0x691e=function(_0x1f55a9,_0xee93b4){_0x1f55a9=_0x1f55a9-0x0;var _0x47b439=_0x91e6[_0x1f55a9];return _0x47b439;};'use strict';var multer=require(_0x691e('0x0'));var util=require(_0x691e('0x1'));var path=require(_0x691e('0x2'));var timeout=require(_0x691e('0x3'));var express=require(_0x691e('0x4'));var router=express[_0x691e('0x5')]();var fs_extra=require(_0x691e('0x6'));var auth=require(_0x691e('0x7'));var interaction=require(_0x691e('0x8'));var config=require('../../config/environment');var controller=require(_0x691e('0x9'));router[_0x691e('0xa')]('/',auth[_0x691e('0xb')](),controller['index']);router[_0x691e('0xa')](_0x691e('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x691e('0xd')]('/',auth['isAuthenticated'](),controller[_0x691e('0xe')]);router[_0x691e('0xf')](_0x691e('0xc'),auth[_0x691e('0xb')](),controller['update']);router[_0x691e('0x10')](_0x691e('0xc'),auth[_0x691e('0xb')](),controller[_0x691e('0x11')]);module[_0x691e('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index e0405e9..3cd9426 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 _0xd35d=['DATE','UNSIGNED','contactListQueue','STRING','exports','format','INTEGER','BOOLEAN'];(function(_0x3074da,_0x50b231){var _0x607d7=function(_0x56e6b2){while(--_0x56e6b2){_0x3074da['push'](_0x3074da['shift']());}};_0x607d7(++_0x50b231);}(_0xd35d,0xd4));var _0xdd35=function(_0x11ec6c,_0x1a8169){_0x11ec6c=_0x11ec6c-0x0;var _0xb59506=_0xd35d[_0x11ec6c];return _0xb59506;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0xdd35('0x0')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xdd35('0x1')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xdd35('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xdd35('0x2')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xdd35('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xdd35('0x4')]},'priority':{'type':Sequelize[_0xdd35('0x2')](0x2)[_0xdd35('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xdd35('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xdd35('0x2')],'unique':_0xdd35('0x6')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xdd35('0x2')],'unique':_0xdd35('0x6')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xdd35('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xdd35('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xdd35('0x7')]},'recallmeNotifiedDate':{'type':Sequelize[_0xdd35('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x3e43=['UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','DATE','INTEGER'];(function(_0x233ad2,_0x4aa188){var _0x2d55a1=function(_0x553e19){while(--_0x553e19){_0x233ad2['push'](_0x233ad2['shift']());}};_0x2d55a1(++_0x4aa188);}(_0x3e43,0x1da));var _0x33e4=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x3e43[_0x5bd426];return _0x23a7eb;};'use strict';var moment=require(_0x33e4('0x0'));var Sequelize=require('sequelize');module[_0x33e4('0x1')]={'phone':{'type':Sequelize[_0x33e4('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x33e4('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x33e4('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x33e4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x33e4('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x33e4('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x33e4('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x33e4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x33e4('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x33e4('0x7')},'ListId':{'type':Sequelize[_0x33e4('0x5')],'unique':_0x33e4('0x7')},'UserId':{'type':Sequelize[_0x33e4('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x33e4('0x5')],'unique':_0x33e4('0x7')},'CampaignId':{'type':Sequelize[_0x33e4('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x33e4('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x33e4('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x33e4('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x33e4('0x2')]},'recallmeNotifiedDate':{'type':Sequelize[_0x33e4('0x4')],'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 2adcc38..17055cf 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 _0xfa2b=['COALESCE(CmHopper.UserId,\x200)\x20DESC','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','findOne','scheduledat','recallme','LOCK','UPDATE','Contact','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','utcOffset','getTimezone','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','update','sendStatus','stack','send','map','rawAttributes','fieldName','key','model','name','query','filters','intersection','concat','$or','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$notLike','$iLike','$like','$contains','$any','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopper','then','includeAll','include','rows','show','params','keys','fields','find','catch','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','createdAt','updatedAt','statedesc','deleted','membername','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','user','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC'];(function(_0x136a67,_0x50cc82){var _0x4d3ed2=function(_0x2442fe){while(--_0x2442fe){_0x136a67['push'](_0x136a67['shift']());}};_0x4d3ed2(++_0x50cc82);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x1809ef,_0x4dcecf){_0x1809ef=_0x1809ef-0x0;var _0x13af5d=_0xfa2b[_0x1809ef];return _0x13af5d;};'use strict';var moment=require(_0xbfa2('0x0'));var _=require(_0xbfa2('0x1'));var qs=require(_0xbfa2('0x2'));var logger=require(_0xbfa2('0x3'))(_0xbfa2('0x4'));var shared=require(_0xbfa2('0x5'));var db=require(_0xbfa2('0x6'))['db'];function respondWithResult(_0x1103cf,_0x116ab4){_0x116ab4=_0x116ab4||0xc8;return function(_0x43f8d9){if(_0x43f8d9){return _0x1103cf[_0xbfa2('0x7')](_0x116ab4)[_0xbfa2('0x8')](_0x43f8d9);}};}function respondWithFilteredResult(_0x12d71e,_0x237a99){return function(_0x26ed93){if(_0x26ed93){var _0x26e9bf=typeof _0x237a99['offset']===_0xbfa2('0x9')&&typeof _0x237a99['limit']===_0xbfa2('0x9');var _0x22e6fe=_0x26ed93[_0xbfa2('0xa')];var _0x1b990a=_0x26e9bf?0x0:_0x237a99[_0xbfa2('0xb')];var _0xbea357=_0x26e9bf?_0x26ed93[_0xbfa2('0xa')]:_0x237a99[_0xbfa2('0xb')]+_0x237a99[_0xbfa2('0xc')];var _0x4e0f1e;if(_0xbea357>=_0x22e6fe){_0xbea357=_0x22e6fe;_0x4e0f1e=0xc8;}else{_0x4e0f1e=0xce;}_0x12d71e['status'](_0x4e0f1e);return _0x12d71e['set'](_0xbfa2('0xd'),_0x1b990a+'-'+_0xbea357+'/'+_0x22e6fe)[_0xbfa2('0x8')](_0x26ed93);}return null;};}function saveUpdates(_0x62b1e9,_0x829a72){return function(_0x137e0d){if(_0x137e0d){return _0x137e0d[_0xbfa2('0xe')](_0x62b1e9)['then'](function(_0x324930){return _0x324930;});}return null;};}function handleEntityNotFound(_0xaf815f,_0x458653){return function(_0x445598){if(!_0x445598){_0xaf815f[_0xbfa2('0xf')](0x194);}return _0x445598;};}function handleError(_0x4e799a,_0xa988cc){_0xa988cc=_0xa988cc||0x1f4;return function(_0x47db68){logger['error'](_0x47db68[_0xbfa2('0x10')]);if(_0x47db68['name']){delete _0x47db68['name'];}_0x4e799a[_0xbfa2('0x7')](_0xa988cc)[_0xbfa2('0x11')](_0x47db68);};}exports['index']=function(_0xb9b6a3,_0x12627a){var _0x28fe6f={},_0x4088c5={},_0x37aed6={'count':0x0,'rows':[]};var _0xea9286=_[_0xbfa2('0x12')](db['CmHopper'][_0xbfa2('0x13')],function(_0x100bfa){return{'name':_0x100bfa[_0xbfa2('0x14')],'type':_0x100bfa['type'][_0xbfa2('0x15')]};});_0x4088c5[_0xbfa2('0x16')]=_['map'](_0xea9286,_0xbfa2('0x17'));_0x4088c5['query']=_['keys'](_0xb9b6a3[_0xbfa2('0x18')]);_0x4088c5[_0xbfa2('0x19')]=_[_0xbfa2('0x1a')](_0x4088c5[_0xbfa2('0x16')],_0x4088c5['query']);_0x4088c5['filters']=_[_0xbfa2('0x1b')](_0x4088c5[_0xbfa2('0x19')],['$and',_0xbfa2('0x1c'),'$gt',_0xbfa2('0x1d'),'$lt',_0xbfa2('0x1e'),_0xbfa2('0x1f'),_0xbfa2('0x20'),_0xbfa2('0x21'),_0xbfa2('0x22'),'$notBetween',_0xbfa2('0x23'),_0xbfa2('0x24'),'$like',_0xbfa2('0x25'),_0xbfa2('0x26'),'$notILike',_0xbfa2('0x27'),'$overlap',_0xbfa2('0x28'),'$contained',_0xbfa2('0x29')]);_0x28fe6f[_0xbfa2('0x2a')]=_[_0xbfa2('0x1a')](_0x4088c5[_0xbfa2('0x16')],qs['fields'](_0xb9b6a3[_0xbfa2('0x18')]['fields']));_0x28fe6f[_0xbfa2('0x2a')]=_0x28fe6f[_0xbfa2('0x2a')][_0xbfa2('0x2b')]?_0x28fe6f['attributes']:_0x4088c5[_0xbfa2('0x16')];if(!_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x2c')]('nolimit')){_0x28fe6f['limit']=qs['limit'](_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0xc')]);_0x28fe6f['offset']=qs[_0xbfa2('0xb')](_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0xb')]);}_0x28fe6f[_0xbfa2('0x2d')]=qs['sort'](_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x2e')]);_0x28fe6f['where']=qs[_0xbfa2('0x19')](_[_0xbfa2('0x2f')](_0xb9b6a3[_0xbfa2('0x18')],_0x4088c5[_0xbfa2('0x19')]),_0xea9286);if(_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x30')]){_0x28fe6f[_0xbfa2('0x31')]=_[_0xbfa2('0x32')](_0x28fe6f[_0xbfa2('0x31')],{'$or':_['map'](_0xea9286,function(_0x79c2bd){if(_0x79c2bd['type']!==_0xbfa2('0x33')){var _0x57c93c={};_0x57c93c[_0x79c2bd[_0xbfa2('0x17')]]={'$like':'%'+_0xb9b6a3[_0xbfa2('0x18')][_0xbfa2('0x30')]+'%'};return _0x57c93c;}})});}_0x28fe6f=_[_0xbfa2('0x32')]({},_0x28fe6f,_0xb9b6a3[_0xbfa2('0x34')]);var _0x4fa12c={'where':_0x28fe6f[_0xbfa2('0x31')]};return db[_0xbfa2('0x35')][_0xbfa2('0xa')](_0x4fa12c)[_0xbfa2('0x36')](function(_0xa6f846){_0x37aed6['count']=_0xa6f846;if(_0xb9b6a3['query'][_0xbfa2('0x37')]){_0x28fe6f[_0xbfa2('0x38')]=[{'all':!![]}];}return db[_0xbfa2('0x35')]['findAll'](_0x28fe6f);})['then'](function(_0x44da05){_0x37aed6[_0xbfa2('0x39')]=_0x44da05;return _0x37aed6;})['then'](respondWithFilteredResult(_0x12627a,_0x28fe6f))['catch'](handleError(_0x12627a,null));};exports[_0xbfa2('0x3a')]=function(_0x1fd877,_0x5af87e){var _0x3708ea={'raw':!![],'where':{'id':_0x1fd877[_0xbfa2('0x3b')]['id']}},_0x2803b6={};_0x2803b6[_0xbfa2('0x16')]=_[_0xbfa2('0x3c')](db[_0xbfa2('0x35')][_0xbfa2('0x13')]);_0x2803b6[_0xbfa2('0x18')]=_[_0xbfa2('0x3c')](_0x1fd877[_0xbfa2('0x18')]);_0x2803b6[_0xbfa2('0x19')]=_[_0xbfa2('0x1a')](_0x2803b6[_0xbfa2('0x16')],_0x2803b6[_0xbfa2('0x18')]);_0x3708ea[_0xbfa2('0x2a')]=_[_0xbfa2('0x1a')](_0x2803b6[_0xbfa2('0x16')],qs['fields'](_0x1fd877[_0xbfa2('0x18')][_0xbfa2('0x3d')]));_0x3708ea[_0xbfa2('0x2a')]=_0x3708ea[_0xbfa2('0x2a')][_0xbfa2('0x2b')]?_0x3708ea[_0xbfa2('0x2a')]:_0x2803b6['model'];if(_0x1fd877[_0xbfa2('0x18')]['includeAll']){_0x3708ea[_0xbfa2('0x38')]=[{'all':!![]}];}_0x3708ea=_[_0xbfa2('0x32')]({},_0x3708ea,_0x1fd877['options']);return db[_0xbfa2('0x35')][_0xbfa2('0x3e')](_0x3708ea)[_0xbfa2('0x36')](handleEntityNotFound(_0x5af87e,null))[_0xbfa2('0x36')](respondWithResult(_0x5af87e,null))[_0xbfa2('0x3f')](handleError(_0x5af87e,null));};exports['create']=function(_0x44d0a6,_0x76bc9f){return db[_0xbfa2('0x35')][_0xbfa2('0x40')](_0x44d0a6[_0xbfa2('0x41')],{})[_0xbfa2('0x36')](respondWithResult(_0x76bc9f,0xc9))[_0xbfa2('0x3f')](handleError(_0x76bc9f,null));};exports[_0xbfa2('0xe')]=function(_0x4a43f8,_0x20eb6e){if(_0x4a43f8[_0xbfa2('0x41')]['id']){delete _0x4a43f8['body']['id'];}return db[_0xbfa2('0x35')][_0xbfa2('0x3e')]({'where':{'id':_0x4a43f8[_0xbfa2('0x3b')]['id']}})[_0xbfa2('0x36')](handleEntityNotFound(_0x20eb6e,null))[_0xbfa2('0x36')](saveUpdates(_0x4a43f8[_0xbfa2('0x41')],null))[_0xbfa2('0x36')](respondWithResult(_0x20eb6e,null))[_0xbfa2('0x3f')](handleError(_0x20eb6e,null));};exports[_0xbfa2('0x42')]=function(_0x59d61b,_0x3d98d4){return db[_0xbfa2('0x35')][_0xbfa2('0x42')]()['then'](respondWithResult(_0x3d98d4,null))['catch'](handleError(_0x3d98d4,null));};exports[_0xbfa2('0x43')]=function(_0x51fd07,_0x457a15){var _0x29f0ef;var _0x4ef203=_0x51fd07[_0xbfa2('0x3b')]['id'];return db[_0xbfa2('0x35')][_0xbfa2('0x3e')]({'where':{'id':_0x51fd07['params']['id']}})[_0xbfa2('0x36')](handleEntityNotFound(_0x457a15,null))['then'](function(_0x378b18){if(_0x378b18){return _0x378b18[_0xbfa2('0x43')]()['then'](function(_0x3f8e7c){return _0x3f8e7c;});}})['then'](function(_0x40eba9){_0x29f0ef=_0x40eba9;if(_0x40eba9){if(_0x40eba9['VoiceQueueId']||_0x40eba9[_0xbfa2('0x44')]){return db[_0x40eba9[_0xbfa2('0x45')]?_0xbfa2('0x46'):_0xbfa2('0x47')][_0xbfa2('0x3e')]({'where':{'id':_0x40eba9['VoiceQueueId']?_0x40eba9['VoiceQueueId']:_0x40eba9['CampaignId']},'attributes':['id',_0xbfa2('0x17')],'raw':!![]});}}})[_0xbfa2('0x36')](function(_0x221f5a){var _0x4d5271={};if(_0x221f5a){_[_0xbfa2('0x32')](_0x4d5271,_[_0xbfa2('0x48')](_0x29f0ef['dataValues'],[_0xbfa2('0x49'),_0xbfa2('0x4a'),'id']));_0x4d5271['state']=0x15;_0x4d5271[_0xbfa2('0x4b')]=_0xbfa2('0x4c');_0x4d5271['campaign']=_0x221f5a['name'];_0x4d5271[_0xbfa2('0x4d')]=_0x51fd07['user'][_0xbfa2('0x17')];_0x4d5271[_0xbfa2('0x4e')]=_0x51fd07['user']['id'];_0x4d5271[_0xbfa2('0x4c')]=!![];_0x4d5271[_0xbfa2('0x4f')]=moment()[_0xbfa2('0x50')](_0xbfa2('0x51'));_0x4d5271[_0xbfa2('0x52')]=_0x29f0ef[_0xbfa2('0x53')];_0x4d5271[_0xbfa2('0x54')]=_0x29f0ef[_0xbfa2('0x45')]?_0xbfa2('0x55'):_0xbfa2('0x56');return db[_0xbfa2('0x57')][_0xbfa2('0x3e')]({'where':{'id':_0x4d5271[_0xbfa2('0x58')]},'attributes':[_0xbfa2('0x59'),'lastName']})[_0xbfa2('0x36')](function(_0x4e43c7){if(!_[_0xbfa2('0x5a')](_0x457a15)&&!_[_0xbfa2('0x5a')](_0x4e43c7[_0xbfa2('0x59')])){_0x4d5271[_0xbfa2('0x5b')]=_0x4e43c7[_0xbfa2('0x59')];if(!_[_0xbfa2('0x5a')](_0x4e43c7[_0xbfa2('0x5c')])){_0x4d5271[_0xbfa2('0x5b')]+='\x20'+_0x4e43c7[_0xbfa2('0x5c')];}}})[_0xbfa2('0x5d')](function(){return db[_0xbfa2('0x5e')]['create'](_0x4d5271);});}})[_0xbfa2('0x36')](function(_0x44e433){return db[_0xbfa2('0x5f')][_0xbfa2('0x43')]({'where':{'CmHopperId':_0x4ef203}});})['then'](function(){return _0x457a15[_0xbfa2('0x7')](0xcc)[_0xbfa2('0x60')]();})[_0xbfa2('0x3f')](handleError(_0x457a15,null));};exports[_0xbfa2('0x61')]=function(_0x2f7666,_0x49f224){var _0x3a7fc7=[];return db[_0xbfa2('0x57')][_0xbfa2('0x42')]()[_0xbfa2('0x36')](function(_0x3b8c77){_0x3a7fc7=_[_0xbfa2('0x3c')](_0x3b8c77);return _0x2f7666['user'][_0xbfa2('0x62')]({'where':{'type':_0xbfa2('0x63'),'dialActive':!![],'dialMethod':_0xbfa2('0x64')},'attributes':['id',_0xbfa2('0x65'),_0xbfa2('0x66')],'raw':!![]});})['then'](function(_0x5d0b6e){if(_0x5d0b6e&&_0x5d0b6e['length']){return db[_0xbfa2('0x67')][_0xbfa2('0x68')](function(_0x3c337d){var _0x12e182={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xbfa2('0x12')](_0x5d0b6e,'id')},'$or':[{'UserId':null},{'UserId':_0x2f7666[_0xbfa2('0x69')]['id']}]};var _0x15c172={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x5d0b6e)['filter']([_0xbfa2('0x66'),0x0])[_0xbfa2('0x12')]('id')[_0xbfa2('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x2f7666[_0xbfa2('0x69')]['id']}]};var _0x5019c7={'$or':[_0x12e182,_0x15c172]};var _0x433448=[];if(_0x2f7666[_0xbfa2('0x41')]['direction']&&_0x2f7666[_0xbfa2('0x41')][_0xbfa2('0x6b')]===_0xbfa2('0x6c')){if(!_[_0xbfa2('0x6d')](_0x2f7666['body']['hopperIds'])){_0x5019c7['id']={'$in':_0x2f7666[_0xbfa2('0x41')][_0xbfa2('0x6e')]};}_0x433448=[[_0xbfa2('0x6f'),_0xbfa2('0x70')],[_0xbfa2('0x71'),_0x5d0b6e[0x0]['dialOrderByScheduledAt']===_0xbfa2('0x70')?_0xbfa2('0x72'):_0xbfa2('0x70')],db['sequelize'][_0xbfa2('0x73')](_0xbfa2('0x74')),['id',_0xbfa2('0x72')]];}else{if(!_[_0xbfa2('0x6d')](_0x2f7666['body']['hopperIds'])){_0x5019c7['id']={'$notIn':_0x2f7666[_0xbfa2('0x41')]['hopperIds']};}_0x433448=[[_0xbfa2('0x6f'),_0xbfa2('0x72')],[_0xbfa2('0x71'),_0x5d0b6e[0x0][_0xbfa2('0x65')]],db[_0xbfa2('0x67')]['literal'](_0xbfa2('0x75')),['id',_0xbfa2('0x70')]];}return db[_0xbfa2('0x35')]['findOne']({'attributes':['id','scheduledat',_0xbfa2('0x53'),'recallme'],'where':_0x5019c7,'order':_0x433448,'transaction':_0x3c337d,'lock':_0x3c337d['LOCK']['UPDATE'],'include':[{'model':db[_0xbfa2('0x57')],'as':'Contact','attributes':_0x3a7fc7,'include':[{'model':db[_0xbfa2('0x76')],'as':_0xbfa2('0x77'),'attributes':['id',_0xbfa2('0x17')]}]},{'model':db[_0xbfa2('0x78')],'as':_0xbfa2('0x79'),'attributes':['id',_0xbfa2('0x17')]},{'model':db[_0xbfa2('0x46')],'as':_0xbfa2('0x7a'),'attributes':['id',_0xbfa2('0x17'),_0xbfa2('0x7b')]}]})[_0xbfa2('0x36')](function(_0x46636f){if(_0x46636f){return _0x46636f[_0xbfa2('0xe')]({'UserId':_0x2f7666[_0xbfa2('0x69')]['id']},{'transaction':_0x3c337d});}});});}})[_0xbfa2('0x36')](handleEntityNotFound(_0x49f224,null))[_0xbfa2('0x36')](respondWithResult(_0x49f224,null))[_0xbfa2('0x3f')](handleError(_0x49f224,null));};exports[_0xbfa2('0x7c')]=function(_0x3ddd98,_0x2279c9,_0x40a162){var _0x31bab8=[];var _0x4d94a4=_0x3ddd98['params']['id'];var _0x3f2bd3=_0x3ddd98[_0xbfa2('0x69')]['id'];return db[_0xbfa2('0x57')][_0xbfa2('0x42')]()[_0xbfa2('0x36')](function(_0x5d384c){_0x31bab8=_[_0xbfa2('0x3c')](_0x5d384c);return db[_0xbfa2('0x67')]['transaction'](function(_0x320fbc){const _0x52a7f0={'id':_0x4d94a4};return db[_0xbfa2('0x35')][_0xbfa2('0x7d')]({'attributes':['id',_0xbfa2('0x7e'),_0xbfa2('0x7f')],'where':_0x52a7f0,'transaction':_0x320fbc,'lock':_0x320fbc[_0xbfa2('0x80')][_0xbfa2('0x81')],'include':[{'model':db[_0xbfa2('0x57')],'as':_0xbfa2('0x82'),'attributes':_0x31bab8,'include':[{'model':db[_0xbfa2('0x76')],'as':'Company','attributes':['id',_0xbfa2('0x17')]}]},{'model':db[_0xbfa2('0x78')],'as':'List','attributes':['id',_0xbfa2('0x17')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xbfa2('0x17'),_0xbfa2('0x7b')]}]})[_0xbfa2('0x36')](function(_0x44e251){if(_0x44e251){return _0x44e251['update']({'UserId':_0x3f2bd3},{'transaction':_0x320fbc});}});});})[_0xbfa2('0x36')](handleEntityNotFound(_0x2279c9,null))['then'](respondWithResult(_0x2279c9,null))[_0xbfa2('0x3f')](handleError(_0x2279c9,null));};exports[_0xbfa2('0x83')]=function(_0x205243,_0x269cf4){return _0x205243[_0xbfa2('0x69')][_0xbfa2('0x62')]({'where':{'type':_0xbfa2('0x63'),'dialActive':!![],'dialMethod':_0xbfa2('0x64')},'attributes':['id'],'raw':!![]})[_0xbfa2('0x36')](function(_0xa4df7f){if(_0xa4df7f&&_0xa4df7f['length']){return db[_0xbfa2('0x35')][_0xbfa2('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xbfa2('0x50')](_0xbfa2('0x51'))},'VoiceQueueId':{'$in':_[_0xbfa2('0x12')](_0xa4df7f,'id')},'$or':[{'UserId':null},{'UserId':_0x205243[_0xbfa2('0x69')]['id']}]}});}return 0x0;})['then'](function(_0xa4feb9){if(!_[_0xbfa2('0x5a')](_0xa4feb9)&&_[_0xbfa2('0x84')](_0xa4feb9)){return _0x269cf4[_0xbfa2('0x7')](0xc8)['json']({'contacts':_0xa4feb9});}else{logger['error'](_0xbfa2('0x85'),_0xbfa2('0x83'),0x194,_0xbfa2('0x86'));_0x269cf4[_0xbfa2('0xf')](0x194);}})[_0xbfa2('0x3f')](handleError(_0x269cf4,null));};exports[_0xbfa2('0x87')]=function(_0x138df1,_0x27d898){var _0x1743fc=shared['timezones'];var _0x5a6d77=[];_[_0xbfa2('0x12')](_0x1743fc,function(_0x391002){_0x5a6d77['push']({'id':_0x391002[_0xbfa2('0x17')],'name':_0x391002['name'],'utcOffset':_0x391002[_0xbfa2('0x88')]});});return _0x27d898[_0xbfa2('0x7')](0xc8)[_0xbfa2('0x8')]({'tz':_0x5a6d77});};exports[_0xbfa2('0x89')]=function(_0x3a4a44,_0x4b1422){var _0x509677=shared[_0xbfa2('0x8a')];var _0x51c5b2={};if(!_[_0xbfa2('0x5a')](_0x509677[_0x3a4a44[_0xbfa2('0x41')]['id']]))_0x51c5b2=_0x509677[_0x3a4a44['body']['id']];return _0x4b1422[_0xbfa2('0x7')](0xc8)['json'](_0x51c5b2);}; \ No newline at end of file +var _0x02a7=['rawAttributes','fieldName','type','key','model','map','name','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','includeAll','include','findAll','then','rows','catch','show','params','length','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','format','YYYY-MM-DD\x20HH:mm:ss','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','phone','recallme','LOCK','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','transaction','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','lodash','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','error','stack','send','index'];(function(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x02a7,0x7a));var _0x702a=function(_0x540d0b,_0x37d310){_0x540d0b=_0x540d0b-0x0;var _0x182e3f=_0x02a7[_0x540d0b];return _0x182e3f;};'use strict';var moment=require('moment');var _=require(_0x702a('0x0'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x702a('0x1'));var shared=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];function respondWithResult(_0xd65b34,_0x4612ca){_0x4612ca=_0x4612ca||0xc8;return function(_0x1fc26b){if(_0x1fc26b){return _0xd65b34[_0x702a('0x4')](_0x4612ca)['json'](_0x1fc26b);}};}function respondWithFilteredResult(_0x1bcfe5,_0x5b7d8c){return function(_0x26b25e){if(_0x26b25e){var _0x1aa2c2=typeof _0x5b7d8c[_0x702a('0x5')]===_0x702a('0x6')&&typeof _0x5b7d8c[_0x702a('0x7')]===_0x702a('0x6');var _0x3b745c=_0x26b25e['count'];var _0x15acfb=_0x1aa2c2?0x0:_0x5b7d8c['offset'];var _0x5c83a4=_0x1aa2c2?_0x26b25e[_0x702a('0x8')]:_0x5b7d8c[_0x702a('0x5')]+_0x5b7d8c[_0x702a('0x7')];var _0x27ef6a;if(_0x5c83a4>=_0x3b745c){_0x5c83a4=_0x3b745c;_0x27ef6a=0xc8;}else{_0x27ef6a=0xce;}_0x1bcfe5['status'](_0x27ef6a);return _0x1bcfe5[_0x702a('0x9')](_0x702a('0xa'),_0x15acfb+'-'+_0x5c83a4+'/'+_0x3b745c)[_0x702a('0xb')](_0x26b25e);}return null;};}function saveUpdates(_0x221b35,_0x4688d1){return function(_0x75455){if(_0x75455){return _0x75455[_0x702a('0xc')](_0x221b35)['then'](function(_0x51364a){return _0x51364a;});}return null;};}function handleEntityNotFound(_0x38139d,_0x57f5fc){return function(_0x576cf8){if(!_0x576cf8){_0x38139d['sendStatus'](0x194);}return _0x576cf8;};}function handleError(_0x554435,_0x5c768d){_0x5c768d=_0x5c768d||0x1f4;return function(_0x44f7fd){logger[_0x702a('0xd')](_0x44f7fd[_0x702a('0xe')]);if(_0x44f7fd['name']){delete _0x44f7fd['name'];}_0x554435['status'](_0x5c768d)[_0x702a('0xf')](_0x44f7fd);};}exports[_0x702a('0x10')]=function(_0x2fd0e0,_0x492cfb){var _0x290591={},_0x5ec1b3={},_0x823794={'count':0x0,'rows':[]};var _0x2c3b0d=_['map'](db['CmHopper'][_0x702a('0x11')],function(_0x18b8a0){return{'name':_0x18b8a0[_0x702a('0x12')],'type':_0x18b8a0[_0x702a('0x13')][_0x702a('0x14')]};});_0x5ec1b3[_0x702a('0x15')]=_[_0x702a('0x16')](_0x2c3b0d,_0x702a('0x17'));_0x5ec1b3[_0x702a('0x18')]=_[_0x702a('0x19')](_0x2fd0e0['query']);_0x5ec1b3[_0x702a('0x1a')]=_[_0x702a('0x1b')](_0x5ec1b3[_0x702a('0x15')],_0x5ec1b3[_0x702a('0x18')]);_0x5ec1b3[_0x702a('0x1a')]=_[_0x702a('0x1c')](_0x5ec1b3[_0x702a('0x1a')],[_0x702a('0x1d'),_0x702a('0x1e'),'$gt',_0x702a('0x1f'),_0x702a('0x20'),'$lte',_0x702a('0x21'),_0x702a('0x22'),_0x702a('0x23'),_0x702a('0x24'),_0x702a('0x25'),_0x702a('0x26'),'$notIn',_0x702a('0x27'),_0x702a('0x28'),'$iLike',_0x702a('0x29'),_0x702a('0x27'),_0x702a('0x2a'),_0x702a('0x2b'),_0x702a('0x2c'),_0x702a('0x2d')]);_0x290591[_0x702a('0x2e')]=_['intersection'](_0x5ec1b3[_0x702a('0x15')],qs[_0x702a('0x2f')](_0x2fd0e0[_0x702a('0x18')][_0x702a('0x2f')]));_0x290591[_0x702a('0x2e')]=_0x290591[_0x702a('0x2e')]['length']?_0x290591[_0x702a('0x2e')]:_0x5ec1b3[_0x702a('0x15')];if(!_0x2fd0e0['query']['hasOwnProperty'](_0x702a('0x30'))){_0x290591[_0x702a('0x7')]=qs['limit'](_0x2fd0e0[_0x702a('0x18')]['limit']);_0x290591['offset']=qs[_0x702a('0x5')](_0x2fd0e0[_0x702a('0x18')][_0x702a('0x5')]);}_0x290591['order']=qs[_0x702a('0x31')](_0x2fd0e0[_0x702a('0x18')][_0x702a('0x31')]);_0x290591[_0x702a('0x32')]=qs[_0x702a('0x1a')](_[_0x702a('0x33')](_0x2fd0e0[_0x702a('0x18')],_0x5ec1b3[_0x702a('0x1a')]),_0x2c3b0d);if(_0x2fd0e0[_0x702a('0x18')][_0x702a('0x34')]){_0x290591[_0x702a('0x32')]=_[_0x702a('0x35')](_0x290591[_0x702a('0x32')],{'$or':_[_0x702a('0x16')](_0x2c3b0d,function(_0x38b1da){if(_0x38b1da[_0x702a('0x13')]!==_0x702a('0x36')){var _0x324d99={};_0x324d99[_0x38b1da['name']]={'$like':'%'+_0x2fd0e0[_0x702a('0x18')][_0x702a('0x34')]+'%'};return _0x324d99;}})});}_0x290591=_[_0x702a('0x35')]({},_0x290591,_0x2fd0e0[_0x702a('0x37')]);var _0x927fd7={'where':_0x290591[_0x702a('0x32')]};return db[_0x702a('0x38')][_0x702a('0x8')](_0x927fd7)['then'](function(_0x1f544d){_0x823794[_0x702a('0x8')]=_0x1f544d;if(_0x2fd0e0[_0x702a('0x18')][_0x702a('0x39')]){_0x290591[_0x702a('0x3a')]=[{'all':!![]}];}return db[_0x702a('0x38')][_0x702a('0x3b')](_0x290591);})[_0x702a('0x3c')](function(_0x38fa54){_0x823794[_0x702a('0x3d')]=_0x38fa54;return _0x823794;})[_0x702a('0x3c')](respondWithFilteredResult(_0x492cfb,_0x290591))[_0x702a('0x3e')](handleError(_0x492cfb,null));};exports[_0x702a('0x3f')]=function(_0xe542be,_0x55f71b){var _0x252b54={'raw':!![],'where':{'id':_0xe542be[_0x702a('0x40')]['id']}},_0xdcb21a={};_0xdcb21a['model']=_[_0x702a('0x19')](db[_0x702a('0x38')][_0x702a('0x11')]);_0xdcb21a[_0x702a('0x18')]=_[_0x702a('0x19')](_0xe542be[_0x702a('0x18')]);_0xdcb21a['filters']=_[_0x702a('0x1b')](_0xdcb21a[_0x702a('0x15')],_0xdcb21a[_0x702a('0x18')]);_0x252b54[_0x702a('0x2e')]=_[_0x702a('0x1b')](_0xdcb21a[_0x702a('0x15')],qs[_0x702a('0x2f')](_0xe542be[_0x702a('0x18')]['fields']));_0x252b54[_0x702a('0x2e')]=_0x252b54['attributes'][_0x702a('0x41')]?_0x252b54[_0x702a('0x2e')]:_0xdcb21a[_0x702a('0x15')];if(_0xe542be['query'][_0x702a('0x39')]){_0x252b54[_0x702a('0x3a')]=[{'all':!![]}];}_0x252b54=_[_0x702a('0x35')]({},_0x252b54,_0xe542be[_0x702a('0x37')]);return db[_0x702a('0x38')][_0x702a('0x42')](_0x252b54)[_0x702a('0x3c')](handleEntityNotFound(_0x55f71b,null))['then'](respondWithResult(_0x55f71b,null))['catch'](handleError(_0x55f71b,null));};exports[_0x702a('0x43')]=function(_0x2caa38,_0x509f43){return db['CmHopper']['create'](_0x2caa38[_0x702a('0x44')],{})[_0x702a('0x3c')](respondWithResult(_0x509f43,0xc9))[_0x702a('0x3e')](handleError(_0x509f43,null));};exports[_0x702a('0xc')]=function(_0x40dbb0,_0x889898){if(_0x40dbb0[_0x702a('0x44')]['id']){delete _0x40dbb0[_0x702a('0x44')]['id'];}return db[_0x702a('0x38')][_0x702a('0x42')]({'where':{'id':_0x40dbb0[_0x702a('0x40')]['id']}})[_0x702a('0x3c')](handleEntityNotFound(_0x889898,null))[_0x702a('0x3c')](saveUpdates(_0x40dbb0['body'],null))['then'](respondWithResult(_0x889898,null))[_0x702a('0x3e')](handleError(_0x889898,null));};exports[_0x702a('0x45')]=function(_0x5a1cdf,_0x4477b7){return db[_0x702a('0x38')]['describe']()[_0x702a('0x3c')](respondWithResult(_0x4477b7,null))[_0x702a('0x3e')](handleError(_0x4477b7,null));};exports[_0x702a('0x46')]=function(_0x55e380,_0x3b1bba){var _0x18a107;var _0x59b1a0=_0x55e380[_0x702a('0x40')]['id'];return db[_0x702a('0x38')]['find']({'where':{'id':_0x55e380[_0x702a('0x40')]['id']}})[_0x702a('0x3c')](handleEntityNotFound(_0x3b1bba,null))[_0x702a('0x3c')](function(_0xf3dc32){if(_0xf3dc32){return _0xf3dc32[_0x702a('0x46')]()[_0x702a('0x3c')](function(_0xee9f8d){return _0xee9f8d;});}})[_0x702a('0x3c')](function(_0x3abd06){_0x18a107=_0x3abd06;if(_0x3abd06){if(_0x3abd06['VoiceQueueId']||_0x3abd06[_0x702a('0x47')]){return db[_0x3abd06[_0x702a('0x48')]?_0x702a('0x49'):_0x702a('0x4a')]['find']({'where':{'id':_0x3abd06[_0x702a('0x48')]?_0x3abd06[_0x702a('0x48')]:_0x3abd06[_0x702a('0x47')]},'attributes':['id',_0x702a('0x17')],'raw':!![]});}}})[_0x702a('0x3c')](function(_0x4d2387){var _0x1cd107={};if(_0x4d2387){_[_0x702a('0x35')](_0x1cd107,_[_0x702a('0x4b')](_0x18a107[_0x702a('0x4c')],[_0x702a('0x4d'),'updatedAt','id']));_0x1cd107['state']=0x15;_0x1cd107[_0x702a('0x4e')]=_0x702a('0x4f');_0x1cd107[_0x702a('0x50')]=_0x4d2387[_0x702a('0x17')];_0x1cd107[_0x702a('0x51')]=_0x55e380[_0x702a('0x52')][_0x702a('0x17')];_0x1cd107[_0x702a('0x53')]=_0x55e380['user']['id'];_0x1cd107['deleted']=!![];_0x1cd107[_0x702a('0x54')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1cd107[_0x702a('0x55')]=_0x18a107['phone'];_0x1cd107[_0x702a('0x56')]=_0x18a107[_0x702a('0x48')]?_0x702a('0x57'):_0x702a('0x58');return db[_0x702a('0x59')][_0x702a('0x42')]({'where':{'id':_0x1cd107[_0x702a('0x5a')]},'attributes':[_0x702a('0x5b'),_0x702a('0x5c')]})['then'](function(_0xb31089){if(!_[_0x702a('0x5d')](_0x3b1bba)&&!_['isNil'](_0xb31089[_0x702a('0x5b')])){_0x1cd107[_0x702a('0x5e')]=_0xb31089[_0x702a('0x5b')];if(!_[_0x702a('0x5d')](_0xb31089[_0x702a('0x5c')])){_0x1cd107[_0x702a('0x5e')]+='\x20'+_0xb31089[_0x702a('0x5c')];}}})['finally'](function(){return db[_0x702a('0x5f')][_0x702a('0x43')](_0x1cd107);});}})['then'](function(_0x20a0ce){return db['CmHopperAdditionalPhone'][_0x702a('0x46')]({'where':{'CmHopperId':_0x59b1a0}});})['then'](function(){return _0x3b1bba[_0x702a('0x4')](0xcc)[_0x702a('0x60')]();})['catch'](handleError(_0x3b1bba,null));};exports[_0x702a('0x61')]=function(_0x312bca,_0x2eeb3d){var _0x2792ce=[];return db['CmContact'][_0x702a('0x45')]()[_0x702a('0x3c')](function(_0x44f845){_0x2792ce=_[_0x702a('0x19')](_0x44f845);return _0x312bca[_0x702a('0x52')][_0x702a('0x62')]({'where':{'type':_0x702a('0x63'),'dialActive':!![],'dialMethod':_0x702a('0x64')},'attributes':['id',_0x702a('0x65'),_0x702a('0x66')],'raw':!![]});})['then'](function(_0x310e06){if(_0x310e06&&_0x310e06[_0x702a('0x41')]){return db[_0x702a('0x67')]['transaction'](function(_0x297a28){var _0x12ea4c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x702a('0x68')](_0x702a('0x69'))},'VoiceQueueId':{'$in':_[_0x702a('0x16')](_0x310e06,'id')},'$or':[{'UserId':null},{'UserId':_0x312bca[_0x702a('0x52')]['id']}]};var _0x27f84f={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x310e06)['filter'](['dialPreviewAutoRecallMe',0x0])[_0x702a('0x16')]('id')[_0x702a('0x6a')]()},'$or':[{'UserId':null},{'UserId':_0x312bca[_0x702a('0x52')]['id']}]};var _0x3a57d9={'$or':[_0x12ea4c,_0x27f84f]};var _0x551a05=[];if(_0x312bca[_0x702a('0x44')][_0x702a('0x6b')]&&_0x312bca[_0x702a('0x44')][_0x702a('0x6b')]==='prev'){if(!_[_0x702a('0x6c')](_0x312bca['body'][_0x702a('0x6d')])){_0x3a57d9['id']={'$in':_0x312bca[_0x702a('0x44')]['hopperIds']};}_0x551a05=[[_0x702a('0x6e'),_0x702a('0x6f')],[_0x702a('0x70'),_0x310e06[0x0][_0x702a('0x65')]==='ASC'?_0x702a('0x71'):_0x702a('0x6f')],db['sequelize']['literal'](_0x702a('0x72')),['id','DESC']];}else{if(!_[_0x702a('0x6c')](_0x312bca[_0x702a('0x44')][_0x702a('0x6d')])){_0x3a57d9['id']={'$notIn':_0x312bca['body'][_0x702a('0x6d')]};}_0x551a05=[[_0x702a('0x6e'),_0x702a('0x71')],['scheduledAt',_0x310e06[0x0][_0x702a('0x65')]],db[_0x702a('0x67')][_0x702a('0x73')](_0x702a('0x74')),['id',_0x702a('0x6f')]];}return db[_0x702a('0x38')][_0x702a('0x75')]({'attributes':['id','scheduledat',_0x702a('0x76'),_0x702a('0x77')],'where':_0x3a57d9,'order':_0x551a05,'transaction':_0x297a28,'lock':_0x297a28[_0x702a('0x78')]['UPDATE'],'include':[{'model':db[_0x702a('0x59')],'as':_0x702a('0x79'),'attributes':_0x2792ce,'include':[{'model':db[_0x702a('0x7a')],'as':_0x702a('0x7b'),'attributes':['id','name']}]},{'model':db[_0x702a('0x7c')],'as':_0x702a('0x7d'),'attributes':['id',_0x702a('0x17')]},{'model':db['VoiceQueue'],'as':_0x702a('0x7e'),'attributes':['id',_0x702a('0x17'),_0x702a('0x7f')]}]})['then'](function(_0x5772c9){if(_0x5772c9){return _0x5772c9[_0x702a('0xc')]({'UserId':_0x312bca[_0x702a('0x52')]['id']},{'transaction':_0x297a28});}});});}})[_0x702a('0x3c')](handleEntityNotFound(_0x2eeb3d,null))['then'](respondWithResult(_0x2eeb3d,null))[_0x702a('0x3e')](handleError(_0x2eeb3d,null));};exports[_0x702a('0x80')]=function(_0x59063d,_0x11b1bd,_0x4d244b){var _0x3d599b=[];var _0xe8b6b2=_0x59063d[_0x702a('0x40')]['id'];var _0x5cbba6=_0x59063d[_0x702a('0x52')]['id'];return db[_0x702a('0x59')]['describe']()['then'](function(_0x3dc3a0){_0x3d599b=_[_0x702a('0x19')](_0x3dc3a0);return db['sequelize'][_0x702a('0x81')](function(_0x26f911){const _0xc9549={'id':_0xe8b6b2};return db[_0x702a('0x38')][_0x702a('0x75')]({'attributes':['id','scheduledat',_0x702a('0x77')],'where':_0xc9549,'transaction':_0x26f911,'lock':_0x26f911[_0x702a('0x78')]['UPDATE'],'include':[{'model':db[_0x702a('0x59')],'as':_0x702a('0x79'),'attributes':_0x3d599b,'include':[{'model':db[_0x702a('0x7a')],'as':_0x702a('0x7b'),'attributes':['id',_0x702a('0x17')]}]},{'model':db['CmList'],'as':_0x702a('0x7d'),'attributes':['id',_0x702a('0x17')]},{'model':db['VoiceQueue'],'as':_0x702a('0x7e'),'attributes':['id',_0x702a('0x17'),_0x702a('0x7f')]}]})[_0x702a('0x3c')](function(_0x19fe67){if(_0x19fe67){return _0x19fe67[_0x702a('0xc')]({'UserId':_0x5cbba6},{'transaction':_0x26f911});}});});})['then'](handleEntityNotFound(_0x11b1bd,null))[_0x702a('0x3c')](respondWithResult(_0x11b1bd,null))[_0x702a('0x3e')](handleError(_0x11b1bd,null));};exports[_0x702a('0x82')]=function(_0x39b515,_0x56e636){return _0x39b515[_0x702a('0x52')]['getVoiceQueues']({'where':{'type':_0x702a('0x63'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x702a('0x3c')](function(_0x425ec5){if(_0x425ec5&&_0x425ec5[_0x702a('0x41')]){return db[_0x702a('0x38')][_0x702a('0x8')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x702a('0x68')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x425ec5,'id')},'$or':[{'UserId':null},{'UserId':_0x39b515[_0x702a('0x52')]['id']}]}});}return 0x0;})['then'](function(_0x13d90a){if(!_[_0x702a('0x5d')](_0x13d90a)&&_['isNumber'](_0x13d90a)){return _0x56e636[_0x702a('0x4')](0xc8)[_0x702a('0xb')]({'contacts':_0x13d90a});}else{logger[_0x702a('0xd')](_0x702a('0x83'),'getOpenContacts',0x194,_0x702a('0x84'));_0x56e636[_0x702a('0x85')](0x194);}})['catch'](handleError(_0x56e636,null));};exports[_0x702a('0x86')]=function(_0x58245e,_0x24fbf3){var _0x3f2bd7=shared[_0x702a('0x87')];var _0x20f404=[];_['map'](_0x3f2bd7,function(_0x43a2cc){_0x20f404[_0x702a('0x88')]({'id':_0x43a2cc[_0x702a('0x17')],'name':_0x43a2cc[_0x702a('0x17')],'utcOffset':_0x43a2cc[_0x702a('0x89')]});});return _0x24fbf3[_0x702a('0x4')](0xc8)[_0x702a('0xb')]({'tz':_0x20f404});};exports[_0x702a('0x8a')]=function(_0x532621,_0x4d13a7){var _0x5c15f1=shared[_0x702a('0x87')];var _0x129983={};if(!_[_0x702a('0x5d')](_0x5c15f1[_0x532621[_0x702a('0x44')]['id']]))_0x129983=_0x5c15f1[_0x532621['body']['id']];return _0x4d13a7[_0x702a('0x4')](0xc8)[_0x702a('0xb')](_0x129983);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index d96fe5a..94334bd 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(_0x416569,_0x1d0fd9){var _0x443b79=function(_0x51d0c7){while(--_0x51d0c7){_0x416569['push'](_0x416569['shift']());}};_0x443b79(++_0x1d0fd9);}(_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 _0x814b=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0x814b,0x1a2));var _0xb814=function(_0x26a10d,_0xe5c001){_0x26a10d=_0x26a10d-0x0;var _0xf90201=_0x814b[_0x26a10d];return _0xf90201;};'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':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]},{'name':_0xb814('0xe'),'fields':[_0xb814('0xe')]},{'name':_0xb814('0xf'),'fields':[_0xb814('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 1a1414f..f0bb6a3 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 _0x1a12=['keys','Agent','name','voicePause','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','active','MoveContactManagedDialer','sequelize','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','destroy','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','User','CmList','length','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','options','where','attributes','include','model','map','then','info','stringify','catch','error','message','find','raw','ShowCmHopper','debug','CreateCmHopper','body','UpdateCmHopper','update','limit','DestroyCmHopper','GetContactDialer','describe','transaction','findAll','order','LOCK','UPDATE','CmContact'];(function(_0x4e2d83,_0x339b19){var _0x352511=function(_0x5a2e69){while(--_0x5a2e69){_0x4e2d83['push'](_0x4e2d83['shift']());}};_0x352511(++_0x339b19);}(_0x1a12,0x80));var _0x21a1=function(_0x215ba5,_0x2ad099){_0x215ba5=_0x215ba5-0x0;var _0x445d70=_0x1a12[_0x215ba5];return _0x445d70;};'use strict';var _=require(_0x21a1('0x0'));var util=require(_0x21a1('0x1'));var moment=require(_0x21a1('0x2'));var BPromise=require(_0x21a1('0x3'));var db=require(_0x21a1('0x4'))['db'];var logger=require(_0x21a1('0x5'))('rpc');exports[_0x21a1('0x6')]=function(_0x544440){var _0x29a3c7=this;return new Promise(function(_0x485889,_0xd0d22a){return db[_0x21a1('0x7')]['findAll']({'raw':_0x544440[_0x21a1('0x8')]?_0x544440[_0x21a1('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x544440['options']?_0x544440[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'attributes':_0x544440[_0x21a1('0x8')]?_0x544440[_0x21a1('0x8')][_0x21a1('0xa')]||null:null,'limit':_0x544440[_0x21a1('0x8')]?_0x544440['options']['limit']||null:null,'include':_0x544440[_0x21a1('0x8')]?_0x544440[_0x21a1('0x8')]['include']?_['map'](_0x544440[_0x21a1('0x8')][_0x21a1('0xb')],function(_0x15e2f9){return{'model':db[_0x15e2f9[_0x21a1('0xc')]],'as':_0x15e2f9['as'],'attributes':_0x15e2f9[_0x21a1('0xa')],'include':_0x15e2f9[_0x21a1('0xb')]?_[_0x21a1('0xd')](_0x15e2f9[_0x21a1('0xb')],function(_0x29bff6){return{'model':db[_0x29bff6['model']],'as':_0x29bff6['as'],'attributes':_0x29bff6[_0x21a1('0xa')],'include':_0x29bff6[_0x21a1('0xb')]?_[_0x21a1('0xd')](_0x29bff6['include'],function(_0x2227fb){return{'model':db[_0x2227fb[_0x21a1('0xc')]],'as':_0x2227fb['as'],'attributes':_0x2227fb[_0x21a1('0xa')]};}):[]};}):[]};}):[]:[]})[_0x21a1('0xe')](function(_0x1ec3c3){logger[_0x21a1('0xf')]('GetCmHopper',_0x544440);logger['debug'](_0x21a1('0x6'),_0x544440,JSON[_0x21a1('0x10')](_0x1ec3c3));_0x485889(_0x1ec3c3);})[_0x21a1('0x11')](function(_0x1bde99){logger[_0x21a1('0x12')](_0x21a1('0x6'),_0x1bde99[_0x21a1('0x13')],_0x544440);_0xd0d22a(_0x29a3c7[_0x21a1('0x12')](0x1f4,_0x1bde99[_0x21a1('0x13')]));});});};exports['ShowCmHopper']=function(_0x157aed){var _0x3680d6=this;return new Promise(function(_0x2aa800,_0x284acd){return db['CmHopper'][_0x21a1('0x14')]({'raw':_0x157aed[_0x21a1('0x8')]?_0x157aed[_0x21a1('0x8')][_0x21a1('0x15')]===undefined?!![]:![]:!![],'where':_0x157aed['options']?_0x157aed[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'attributes':_0x157aed[_0x21a1('0x8')]?_0x157aed[_0x21a1('0x8')][_0x21a1('0xa')]||null:null,'include':_0x157aed[_0x21a1('0x8')]?_0x157aed[_0x21a1('0x8')][_0x21a1('0xb')]?_['map'](_0x157aed['options']['include'],function(_0x5561f4){return{'model':db[_0x5561f4[_0x21a1('0xc')]],'as':_0x5561f4['as'],'attributes':_0x5561f4[_0x21a1('0xa')],'include':_0x5561f4[_0x21a1('0xb')]?_['map'](_0x5561f4[_0x21a1('0xb')],function(_0x40ec13){return{'model':db[_0x40ec13[_0x21a1('0xc')]],'as':_0x40ec13['as'],'attributes':_0x40ec13['attributes'],'include':_0x40ec13[_0x21a1('0xb')]?_[_0x21a1('0xd')](_0x40ec13[_0x21a1('0xb')],function(_0x28cee1){return{'model':db[_0x28cee1['model']],'as':_0x28cee1['as'],'attributes':_0x28cee1[_0x21a1('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35d7ca){logger[_0x21a1('0xf')](_0x21a1('0x16'),_0x157aed);logger[_0x21a1('0x17')](_0x21a1('0x16'),_0x157aed,JSON[_0x21a1('0x10')](_0x35d7ca));_0x2aa800(_0x35d7ca);})[_0x21a1('0x11')](function(_0x18c09c){logger['error'](_0x21a1('0x16'),_0x18c09c[_0x21a1('0x13')],_0x157aed);_0x284acd(_0x3680d6[_0x21a1('0x12')](0x1f4,_0x18c09c[_0x21a1('0x13')]));});});};exports[_0x21a1('0x18')]=function(_0x4fb79b){var _0xcfbfac=this;return new Promise(function(_0x3eeeb4,_0x33769e){return db[_0x21a1('0x7')]['create'](_0x4fb79b[_0x21a1('0x19')],{'raw':_0x4fb79b['options']?_0x4fb79b[_0x21a1('0x8')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x501c66){logger[_0x21a1('0xf')]('CreateCmHopper',_0x4fb79b);logger[_0x21a1('0x17')](_0x21a1('0x18'),_0x4fb79b,JSON[_0x21a1('0x10')](_0x501c66));_0x3eeeb4(_0x501c66);})[_0x21a1('0x11')](function(_0x1cb852){logger[_0x21a1('0x12')](_0x21a1('0x18'),_0x1cb852['message'],_0x4fb79b);_0x33769e(_0xcfbfac['error'](0x1f4,_0x1cb852['message']));});});};exports[_0x21a1('0x1a')]=function(_0x1f7d33){var _0x389f26=this;return new Promise(function(_0x254ac6,_0x2f816b){return db[_0x21a1('0x7')][_0x21a1('0x1b')](_0x1f7d33[_0x21a1('0x19')],{'raw':_0x1f7d33['options']?_0x1f7d33['options'][_0x21a1('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f7d33[_0x21a1('0x8')]?_0x1f7d33[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'attributes':_0x1f7d33[_0x21a1('0x8')]?_0x1f7d33[_0x21a1('0x8')][_0x21a1('0xa')]||null:null,'limit':_0x1f7d33[_0x21a1('0x8')]?_0x1f7d33[_0x21a1('0x8')][_0x21a1('0x1c')]||null:null})[_0x21a1('0xe')](function(_0x4a5d98){logger[_0x21a1('0xf')]('UpdateCmHopper',_0x1f7d33);logger[_0x21a1('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x21a1('0x10')](_0x1f7d33[_0x21a1('0x8')][_0x21a1('0x9')]),_0x1f7d33[_0x21a1('0x19')]['active']);logger[_0x21a1('0x17')](_0x21a1('0x1a'),_0x1f7d33,JSON['stringify'](_0x4a5d98));_0x254ac6(_0x4a5d98);})[_0x21a1('0x11')](function(_0x39532b){logger[_0x21a1('0x12')](_0x21a1('0x1a'),_0x39532b[_0x21a1('0x13')],_0x1f7d33);_0x2f816b(_0x389f26[_0x21a1('0x12')](0x1f4,_0x39532b['message']));});});};exports[_0x21a1('0x1d')]=function(_0x5ea743){var _0x35ff18=this;return new Promise(function(_0x27f2d6,_0x3feb72){return db[_0x21a1('0x7')]['destroy']({'where':_0x5ea743[_0x21a1('0x8')]?_0x5ea743['options'][_0x21a1('0x9')]||null:null})[_0x21a1('0xe')](function(_0xe5c8d3){logger[_0x21a1('0xf')](_0x21a1('0x1d'),_0x5ea743);logger[_0x21a1('0x17')]('DestroyCmHopper',_0x5ea743,JSON[_0x21a1('0x10')](_0xe5c8d3));_0x27f2d6(_0xe5c8d3);})[_0x21a1('0x11')](function(_0x13cd2b){logger['error']('DestroyCmHopper',_0x13cd2b[_0x21a1('0x13')],_0x5ea743);_0x3feb72(_0x35ff18['error'](0x1f4,_0x13cd2b[_0x21a1('0x13')]));});});};exports[_0x21a1('0x1e')]=function(_0x584f45){var _0x23ebbc=this;return new Promise(function(_0x87db61,_0x37457e){return db['CmContact'][_0x21a1('0x1f')]()[_0x21a1('0xe')](function(_0x57fb39){return db['sequelize'][_0x21a1('0x20')](function(_0x468c5b){return db[_0x21a1('0x7')][_0x21a1('0x21')]({'where':_0x584f45['options']?_0x584f45[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'attributes':_0x584f45[_0x21a1('0x8')]?_0x584f45['options'][_0x21a1('0xa')]||null:null,'limit':_0x584f45[_0x21a1('0x8')]?_0x584f45[_0x21a1('0x8')][_0x21a1('0x1c')]||null:null,'order':_0x584f45[_0x21a1('0x8')]?_0x584f45[_0x21a1('0x8')][_0x21a1('0x22')]||null:null,'transaction':_0x468c5b,'lock':_0x468c5b[_0x21a1('0x23')][_0x21a1('0x24')],'include':[{'model':db[_0x21a1('0x25')],'as':'Contact','attributes':_[_0x21a1('0x26')](_0x57fb39)},{'model':db['User'],'as':_0x21a1('0x27'),'attributes':['id',_0x21a1('0x28'),_0x21a1('0x29')]}]})[_0x21a1('0xe')](function(_0x351517){var _0x15ac4=[];var _0x5d2154=[];for(var _0x5931a9=0x0;_0x5931a9<_0x351517['length'];_0x5931a9+=0x1){var _0x1c8f05=_0x351517[_0x5931a9][_0x21a1('0x2a')];if(_0x1c8f05===null){_0x15ac4[_0x21a1('0x2b')](_0x351517[_0x5931a9][_0x21a1('0x1b')](_0x584f45[_0x21a1('0x19')],{'transaction':_0x468c5b}));}else if(!_0x5d2154[_0x21a1('0x2c')](_0x1c8f05)){_0x5d2154['push'](_0x1c8f05);_0x15ac4[_0x21a1('0x2b')](_0x351517[_0x5931a9][_0x21a1('0x1b')](_0x584f45[_0x21a1('0x19')],{'transaction':_0x468c5b}));}}return BPromise[_0x21a1('0x2d')](_0x15ac4);});})[_0x21a1('0xe')](function(_0x23f9e5){logger['info']('GetContactDialer',_0x584f45);if(_0x23f9e5['length']>0x0){logger['info'](_0x21a1('0x2e'),_0x23f9e5[0x0][_0x21a1('0x2f')]['id'],_0x23f9e5[0x0][_0x21a1('0x2f')][_0x21a1('0x30')],_0x23f9e5[0x0][_0x21a1('0x2f')][_0x21a1('0x31')]);}logger[_0x21a1('0x17')]('GetContactDialer',_0x584f45,JSON[_0x21a1('0x10')](_0x23f9e5));_0x87db61(_0x23f9e5);})['catch'](function(_0xa276f4){logger[_0x21a1('0x12')](_0x21a1('0x1e'),_0xa276f4['message'],_0x584f45);_0x37457e(_0x23ebbc[_0x21a1('0x12')](0x1f4,_0xa276f4[_0x21a1('0x13')]));});});});};exports[_0x21a1('0x32')]=function(_0x54e9f1){var _0x439c08=this;return new Promise(function(_0x32c4a2,_0x3db239){return db[_0x21a1('0x33')][_0x21a1('0x20')](function(_0x4b111e){return db[_0x21a1('0x34')][_0x21a1('0x35')](_0x54e9f1[_0x21a1('0x19')],{'raw':_0x54e9f1[_0x21a1('0x8')]?_0x54e9f1[_0x21a1('0x8')]['raw']===undefined?!![]:![]:!![],'transaction':_0x4b111e})[_0x21a1('0xe')](function(){logger[_0x21a1('0xf')](_0x21a1('0x36'),JSON[_0x21a1('0x10')](_0x54e9f1['options']['where']),_0x54e9f1[_0x21a1('0x8')][_0x21a1('0x9')]['active']);return db['CmHopper'][_0x21a1('0x37')]({'where':_0x54e9f1[_0x21a1('0x8')]?_0x54e9f1[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'transaction':_0x4b111e});});})['then'](function(_0x6b96e8){logger[_0x21a1('0xf')](_0x21a1('0x32'),_0x54e9f1);logger['debug'](_0x21a1('0x32'),_0x54e9f1,JSON[_0x21a1('0x10')](_0x6b96e8));_0x32c4a2(_0x6b96e8);})[_0x21a1('0x11')](function(_0x40fe8d){logger[_0x21a1('0x12')](_0x21a1('0x32'),_0x40fe8d['message'],_0x54e9f1);_0x3db239(_0x439c08['error'](0x1f4,_0x40fe8d[_0x21a1('0x13')]));});});};exports[_0x21a1('0x38')]=function(_0x5d3ef4){var _0x23110f=this;return new Promise(function(_0x2eeaac,_0x4594ae){return db['CmHopper']['findAll']({'raw':_0x5d3ef4['options']?_0x5d3ef4[_0x21a1('0x8')][_0x21a1('0x15')]===undefined?!![]:![]:!![],'where':_0x5d3ef4[_0x21a1('0x8')]?_0x5d3ef4[_0x21a1('0x8')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x21a1('0x39'),db[_0x21a1('0x33')]['fn']('IF',db[_0x21a1('0x33')][_0x21a1('0x3a')](_0x21a1('0x3b')+util['format'](_0x21a1('0x3c'),moment()[_0x21a1('0x3d')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x21a1('0x3e')))),_0x21a1('0x3f')]]})[_0x21a1('0xe')](function(_0x561625){logger['info'](_0x21a1('0x38'),_0x5d3ef4);logger[_0x21a1('0x17')](_0x21a1('0x38'),_0x5d3ef4,JSON[_0x21a1('0x10')](_0x561625));_0x2eeaac(_0x561625);})[_0x21a1('0x11')](function(_0x212adf){logger[_0x21a1('0x12')](_0x21a1('0x38'),_0x212adf[_0x21a1('0x13')],_0x5d3ef4);_0x4594ae(_0x23110f[_0x21a1('0x12')](0x1f4,_0x212adf[_0x21a1('0x13')]));});});};exports[_0x21a1('0x40')]=function(_0x16f15a){var _0x398474=this;return new Promise(function(_0x14c01c,_0x5e8352){return db[_0x21a1('0x25')][_0x21a1('0x1f')]()[_0x21a1('0xe')](function(){return db[_0x21a1('0x33')]['transaction'](function(_0xdc5907){return db[_0x21a1('0x7')][_0x21a1('0x21')]({'where':_0x16f15a['options']?_0x16f15a[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'attributes':_0x16f15a[_0x21a1('0x8')]?_0x16f15a[_0x21a1('0x8')][_0x21a1('0xa')]||null:null,'limit':0x1,'order':_0x16f15a[_0x21a1('0x8')]?_0x16f15a[_0x21a1('0x8')][_0x21a1('0x22')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0xdc5907,'lock':_0xdc5907[_0x21a1('0x23')][_0x21a1('0x24')],'include':_0x16f15a[_0x21a1('0x8')]?_0x16f15a[_0x21a1('0x8')][_0x21a1('0xb')]?_[_0x21a1('0xd')](_0x16f15a['options'][_0x21a1('0xb')],function(_0x2b44e3){return{'model':db[_0x2b44e3['model']],'as':_0x2b44e3['as'],'attributes':_0x2b44e3[_0x21a1('0xa')],'include':_0x2b44e3[_0x21a1('0xb')]?_[_0x21a1('0xd')](_0x2b44e3['include'],function(_0x127ead){return{'model':db[_0x127ead['model']],'as':_0x127ead['as'],'attributes':_0x127ead[_0x21a1('0xa')],'include':_0x127ead['include']?_[_0x21a1('0xd')](_0x127ead[_0x21a1('0xb')],function(_0x234bf6){return{'model':db[_0x234bf6['model']],'as':_0x234bf6['as'],'attributes':_0x234bf6['attributes']};}):[]};}):[]};}):[]:[]})[_0x21a1('0xe')](function(_0x3a55f4){var _0x3fee65=[];for(var _0x3ec881=0x0;_0x3ec881<_0x3a55f4['length'];_0x3ec881+=0x1){_0x3fee65[_0x21a1('0x2b')](_0x3a55f4[_0x3ec881][_0x21a1('0x1b')](_0x16f15a[_0x21a1('0x19')],{'transaction':_0xdc5907}));}return BPromise[_0x21a1('0x2d')](_0x3fee65);});})[_0x21a1('0xe')](function(_0x3e4dde){logger['info'](_0x21a1('0x40'),_0x16f15a);logger['debug'](_0x21a1('0x40'),_0x16f15a,JSON[_0x21a1('0x10')](_0x3e4dde));_0x14c01c(_0x3e4dde);})[_0x21a1('0x11')](function(_0x281dcb){logger[_0x21a1('0x12')]('GetContactRecallMe',_0x281dcb['message'],_0x16f15a);_0x5e8352(_0x398474['error'](0x1f4,_0x281dcb[_0x21a1('0x13')]));});});});};exports[_0x21a1('0x41')]=function(_0x5cd8ca){var _0x3d2fec=this;return new Promise(function(_0x307263,_0x4182d3){db[_0x21a1('0x25')]['describe']()[_0x21a1('0xe')](function(_0x315c15){return db[_0x21a1('0x7')][_0x21a1('0x21')]({'raw':_0x5cd8ca['options']?_0x5cd8ca[_0x21a1('0x8')][_0x21a1('0x15')]===undefined?!![]:![]:!![],'where':_0x5cd8ca[_0x21a1('0x8')]?_0x5cd8ca[_0x21a1('0x8')][_0x21a1('0x9')]||null:null,'attributes':_0x5cd8ca[_0x21a1('0x8')]?_0x5cd8ca[_0x21a1('0x8')][_0x21a1('0xa')]||null:null,'limit':_0x5cd8ca[_0x21a1('0x8')]?_0x5cd8ca['options'][_0x21a1('0x1c')]||null:null,'include':_0x5cd8ca[_0x21a1('0x8')]?_0x5cd8ca[_0x21a1('0x8')][_0x21a1('0xb')]?_['map'](_0x5cd8ca[_0x21a1('0x8')][_0x21a1('0xb')],function(_0x2a6865){return{'model':db[_0x2a6865[_0x21a1('0xc')]],'as':_0x2a6865['as'],'attributes':_0x2a6865['as']===_0x21a1('0x42')?_[_0x21a1('0x26')](_0x315c15):_0x2a6865[_0x21a1('0xa')],'include':_0x2a6865[_0x21a1('0xb')]?_['map'](_0x2a6865[_0x21a1('0xb')],function(_0x3753c8){return{'model':db[_0x3753c8[_0x21a1('0xc')]],'as':_0x3753c8['as'],'attributes':_0x3753c8[_0x21a1('0xa')],'include':_0x3753c8['include']?_[_0x21a1('0xd')](_0x3753c8[_0x21a1('0xb')],function(_0x3729e9){return{'model':db[_0x3729e9[_0x21a1('0xc')]],'as':_0x3729e9['as'],'attributes':_0x3729e9[_0x21a1('0xa')]};}):[]};}):[]};}):[]:[]})[_0x21a1('0xe')](function(_0x42cc38){logger[_0x21a1('0xf')]('GetCmHopper',_0x5cd8ca);logger[_0x21a1('0x17')](_0x21a1('0x6'),_0x5cd8ca,JSON[_0x21a1('0x10')](_0x42cc38));_0x307263(_0x42cc38);})[_0x21a1('0x11')](function(_0x3c22ea){logger[_0x21a1('0x12')](_0x21a1('0x6'),_0x3c22ea[_0x21a1('0x13')],_0x5cd8ca);_0x4182d3(_0x3d2fec[_0x21a1('0x12')](0x1f4,_0x3c22ea[_0x21a1('0x13')]));});});});};exports[_0x21a1('0x43')]=function(_0x448f91){var _0x18207b=this;return new Promise(function(_0x5ad8da,_0x2b04d0){return db[_0x21a1('0x25')][_0x21a1('0x44')]({'raw':!![],'where':{'phone':_0x448f91[_0x21a1('0x8')]['where'][_0x21a1('0x45')]},'attributes':['id',_0x21a1('0x46')],'order':[['id',_0x21a1('0x47')]]})['then'](function(_0x24ae70){logger[_0x21a1('0xf')](_0x21a1('0x48'),_0x448f91);logger[_0x21a1('0x17')](_0x21a1('0x48'),_0x448f91,JSON['stringify'](_0x24ae70));_0x5ad8da(_0x24ae70);})[_0x21a1('0x11')](function(_0x79e0e9){logger[_0x21a1('0x12')](_0x21a1('0x48'),_0x79e0e9[_0x21a1('0x13')],_0x448f91);_0x2b04d0(_0x18207b[_0x21a1('0x12')](0x1f4,_0x79e0e9['message']));});});};exports['ResetActiveCalls']=function(_0x4ffa6e){var _0x5882b0=this;return new Promise(function(_0x564cc1,_0x284d80){return db[_0x21a1('0x33')][_0x21a1('0x20')](function(_0x5bb48b){var _0x33a777=_0x4ffa6e[_0x21a1('0x8')]&&_0x4ffa6e['options'][_0x21a1('0x9')]?_0x4ffa6e[_0x21a1('0x8')][_0x21a1('0x9')]:{};return db[_0x21a1('0x7')]['update'](_0x4ffa6e[_0x21a1('0x19')],{'where':_0x33a777,'transaction':_0x5bb48b})['then'](function(_0x428ed5){logger[_0x21a1('0xf')]('ResetActiveCalls',_0x4ffa6e);logger[_0x21a1('0x17')](_0x21a1('0x49'),_0x4ffa6e,JSON[_0x21a1('0x10')](_0x428ed5));_0x564cc1(_0x428ed5);})['catch'](function(_0x134e87){logger[_0x21a1('0x12')](_0x21a1('0x49'),_0x134e87[_0x21a1('0x13')],_0x4ffa6e);_0x284d80(_0x5882b0[_0x21a1('0x12')](0x1f4,_0x134e87[_0x21a1('0x13')]));});});});};exports[_0x21a1('0x4a')]=function(_0x26781c){var _0x21fa37=this;var _0x4bb94e=_0x26781c['body'][_0x21a1('0x9')][_0x21a1('0x4b')];var _0x1785bf=_0x26781c[_0x21a1('0x19')][_0x21a1('0x9')][_0x21a1('0x4c')];var _0x203aa3=_0x26781c[_0x21a1('0x19')][_0x21a1('0x9')]['availableAgentsIds'];return new Promise(function(_0x374fcf,_0x33a7f3){return db[_0x21a1('0x7')][_0x21a1('0x21')]({'where':{'voiceQueueId':{'$in':_0x4bb94e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0x21a1('0x3a')](_0x21a1('0x4d')+_0x1785bf+_0x21a1('0x4e')),'$gt':db[_0x21a1('0x33')][_0x21a1('0x3a')](_0x21a1('0x4f'))}},'UserId':{'$in':_0x203aa3}},'include':[{'model':db[_0x21a1('0x25')],'as':_0x21a1('0x42')},{'model':db[_0x21a1('0x50')],'as':'Agent','attributes':['id',_0x21a1('0x28'),_0x21a1('0x29')]},{'model':db[_0x21a1('0x51')],'as':'List'}]})['then'](function(_0x2c0b03){if(_0x2c0b03[_0x21a1('0x52')]>0x0){return db[_0x21a1('0x33')][_0x21a1('0x20')](function(_0x2998a0){return db[_0x21a1('0x7')][_0x21a1('0x1b')]({'recallmeNotifiedDate':db['sequelize'][_0x21a1('0x3a')](_0x21a1('0x4f'))},{'where':{'id':{'$in':_['map'](_0x2c0b03,'id')}},'transaction':_0x2998a0})['then'](function(){_0x374fcf(_0x2c0b03);})[_0x21a1('0x11')](function(_0x44cb8e){logger[_0x21a1('0x12')]('CmHopperHandlePreviewRecallNotifications',_0x44cb8e['message'],_0x26781c);_0x33a7f3(_0x21fa37[_0x21a1('0x12')](0x1f4,_0x44cb8e[_0x21a1('0x13')]));});})[_0x21a1('0x11')](function(_0x5d586c){logger[_0x21a1('0x12')](_0x21a1('0x4a'),_0x5d586c[_0x21a1('0x13')],_0x26781c);_0x33a7f3(_0x21fa37['error'](0x1f4,_0x5d586c[_0x21a1('0x13')]));});}else{_0x374fcf(_0x2c0b03);}});});}; \ No newline at end of file +var _0xb574=['dataValues','active','MoveContactManagedDialer','CmHopperFinal','create','destroy','CountReScheduled','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','Contact','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','NOW()','name','CmList','List','CmHopperHandlePreviewRecallNotifications','lodash','util','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','raw','CreateCmHopper','update','UpdateCmHopper','body','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','UPDATE','keys','User','Agent','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]'];(function(_0x32888f,_0x421666){var _0x597099=function(_0x416e5e){while(--_0x416e5e){_0x32888f['push'](_0x32888f['shift']());}};_0x597099(++_0x421666);}(_0xb574,0x106));var _0x4b57=function(_0x5e317a,_0x208079){_0x5e317a=_0x5e317a-0x0;var _0x56f44a=_0xb574[_0x5e317a];return _0x56f44a;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var db=require(_0x4b57('0x3'))['db'];var logger=require('../../config/logger')(_0x4b57('0x4'));exports[_0x4b57('0x5')]=function(_0x168524){var _0x919851=this;return new Promise(function(_0xe2ae86,_0x4a3efa){return db['CmHopper'][_0x4b57('0x6')]({'raw':_0x168524['options']?_0x168524['options']['raw']===undefined?!![]:![]:!![],'where':_0x168524['options']?_0x168524[_0x4b57('0x7')][_0x4b57('0x8')]||null:null,'attributes':_0x168524[_0x4b57('0x7')]?_0x168524[_0x4b57('0x7')][_0x4b57('0x9')]||null:null,'limit':_0x168524[_0x4b57('0x7')]?_0x168524[_0x4b57('0x7')][_0x4b57('0xa')]||null:null,'include':_0x168524['options']?_0x168524[_0x4b57('0x7')][_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x168524['options']['include'],function(_0x2701ab){return{'model':db[_0x2701ab[_0x4b57('0xd')]],'as':_0x2701ab['as'],'attributes':_0x2701ab[_0x4b57('0x9')],'include':_0x2701ab[_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x2701ab[_0x4b57('0xb')],function(_0x30f685){return{'model':db[_0x30f685[_0x4b57('0xd')]],'as':_0x30f685['as'],'attributes':_0x30f685[_0x4b57('0x9')],'include':_0x30f685['include']?_['map'](_0x30f685[_0x4b57('0xb')],function(_0x24f776){return{'model':db[_0x24f776[_0x4b57('0xd')]],'as':_0x24f776['as'],'attributes':_0x24f776['attributes']};}):[]};}):[]};}):[]:[]})[_0x4b57('0xe')](function(_0x48bd13){logger[_0x4b57('0xf')](_0x4b57('0x5'),_0x168524);logger[_0x4b57('0x10')](_0x4b57('0x5'),_0x168524,JSON[_0x4b57('0x11')](_0x48bd13));_0xe2ae86(_0x48bd13);})[_0x4b57('0x12')](function(_0x4ede42){logger[_0x4b57('0x13')](_0x4b57('0x5'),_0x4ede42[_0x4b57('0x14')],_0x168524);_0x4a3efa(_0x919851[_0x4b57('0x13')](0x1f4,_0x4ede42['message']));});});};exports[_0x4b57('0x15')]=function(_0x1ca49e){var _0xad9165=this;return new Promise(function(_0x2682d6,_0xef1eae){return db[_0x4b57('0x16')]['find']({'raw':_0x1ca49e[_0x4b57('0x7')]?_0x1ca49e[_0x4b57('0x7')][_0x4b57('0x17')]===undefined?!![]:![]:!![],'where':_0x1ca49e['options']?_0x1ca49e[_0x4b57('0x7')][_0x4b57('0x8')]||null:null,'attributes':_0x1ca49e[_0x4b57('0x7')]?_0x1ca49e[_0x4b57('0x7')]['attributes']||null:null,'include':_0x1ca49e[_0x4b57('0x7')]?_0x1ca49e[_0x4b57('0x7')]['include']?_[_0x4b57('0xc')](_0x1ca49e[_0x4b57('0x7')][_0x4b57('0xb')],function(_0x36197e){return{'model':db[_0x36197e['model']],'as':_0x36197e['as'],'attributes':_0x36197e[_0x4b57('0x9')],'include':_0x36197e['include']?_[_0x4b57('0xc')](_0x36197e['include'],function(_0x36ceb1){return{'model':db[_0x36ceb1[_0x4b57('0xd')]],'as':_0x36ceb1['as'],'attributes':_0x36ceb1[_0x4b57('0x9')],'include':_0x36ceb1[_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x36ceb1[_0x4b57('0xb')],function(_0x4ffee1){return{'model':db[_0x4ffee1['model']],'as':_0x4ffee1['as'],'attributes':_0x4ffee1[_0x4b57('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ea0cb){logger[_0x4b57('0xf')](_0x4b57('0x15'),_0x1ca49e);logger[_0x4b57('0x10')](_0x4b57('0x15'),_0x1ca49e,JSON[_0x4b57('0x11')](_0x1ea0cb));_0x2682d6(_0x1ea0cb);})['catch'](function(_0xab365c){logger[_0x4b57('0x13')](_0x4b57('0x15'),_0xab365c[_0x4b57('0x14')],_0x1ca49e);_0xef1eae(_0xad9165['error'](0x1f4,_0xab365c[_0x4b57('0x14')]));});});};exports[_0x4b57('0x18')]=function(_0x4cc72a){var _0xbfb420=this;return new Promise(function(_0xa5b5dc,_0x4726a6){return db[_0x4b57('0x16')]['create'](_0x4cc72a['body'],{'raw':_0x4cc72a['options']?_0x4cc72a[_0x4b57('0x7')][_0x4b57('0x17')]===undefined?!![]:![]:!![]})[_0x4b57('0xe')](function(_0xb43038){logger[_0x4b57('0xf')]('CreateCmHopper',_0x4cc72a);logger[_0x4b57('0x10')](_0x4b57('0x18'),_0x4cc72a,JSON[_0x4b57('0x11')](_0xb43038));_0xa5b5dc(_0xb43038);})['catch'](function(_0xff1183){logger[_0x4b57('0x13')](_0x4b57('0x18'),_0xff1183['message'],_0x4cc72a);_0x4726a6(_0xbfb420[_0x4b57('0x13')](0x1f4,_0xff1183[_0x4b57('0x14')]));});});};exports['UpdateCmHopper']=function(_0x1b23b8){var _0x9ea43e=this;return new Promise(function(_0x29b1f4,_0x91f32e){return db[_0x4b57('0x16')][_0x4b57('0x19')](_0x1b23b8['body'],{'raw':_0x1b23b8[_0x4b57('0x7')]?_0x1b23b8[_0x4b57('0x7')][_0x4b57('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b23b8[_0x4b57('0x7')]?_0x1b23b8[_0x4b57('0x7')][_0x4b57('0x8')]||null:null,'attributes':_0x1b23b8[_0x4b57('0x7')]?_0x1b23b8['options']['attributes']||null:null,'limit':_0x1b23b8[_0x4b57('0x7')]?_0x1b23b8[_0x4b57('0x7')][_0x4b57('0xa')]||null:null})['then'](function(_0x40414f){logger[_0x4b57('0xf')](_0x4b57('0x1a'),_0x1b23b8);logger[_0x4b57('0xf')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x4b57('0x11')](_0x1b23b8[_0x4b57('0x7')][_0x4b57('0x8')]),_0x1b23b8[_0x4b57('0x1b')]['active']);logger['debug']('UpdateCmHopper',_0x1b23b8,JSON[_0x4b57('0x11')](_0x40414f));_0x29b1f4(_0x40414f);})[_0x4b57('0x12')](function(_0x188f24){logger[_0x4b57('0x13')]('UpdateCmHopper',_0x188f24[_0x4b57('0x14')],_0x1b23b8);_0x91f32e(_0x9ea43e[_0x4b57('0x13')](0x1f4,_0x188f24[_0x4b57('0x14')]));});});};exports[_0x4b57('0x1c')]=function(_0x2820ce){var _0x453129=this;return new Promise(function(_0x2d5a0c,_0x55952f){return db[_0x4b57('0x16')]['destroy']({'where':_0x2820ce[_0x4b57('0x7')]?_0x2820ce[_0x4b57('0x7')][_0x4b57('0x8')]||null:null})['then'](function(_0x44f988){logger['info'](_0x4b57('0x1c'),_0x2820ce);logger[_0x4b57('0x10')](_0x4b57('0x1c'),_0x2820ce,JSON[_0x4b57('0x11')](_0x44f988));_0x2d5a0c(_0x44f988);})[_0x4b57('0x12')](function(_0x477352){logger[_0x4b57('0x13')](_0x4b57('0x1c'),_0x477352[_0x4b57('0x14')],_0x2820ce);_0x55952f(_0x453129[_0x4b57('0x13')](0x1f4,_0x477352[_0x4b57('0x14')]));});});};exports[_0x4b57('0x1d')]=function(_0x3a87a1){var _0x4fbed3=this;return new Promise(function(_0x5b83ab,_0x41258d){return db[_0x4b57('0x1e')][_0x4b57('0x1f')]()[_0x4b57('0xe')](function(_0x47fac6){return db[_0x4b57('0x20')][_0x4b57('0x21')](function(_0x5531d0){return db[_0x4b57('0x16')]['findAll']({'where':_0x3a87a1[_0x4b57('0x7')]?_0x3a87a1['options']['where']||null:null,'attributes':_0x3a87a1[_0x4b57('0x7')]?_0x3a87a1[_0x4b57('0x7')]['attributes']||null:null,'limit':_0x3a87a1[_0x4b57('0x7')]?_0x3a87a1[_0x4b57('0x7')][_0x4b57('0xa')]||null:null,'order':_0x3a87a1[_0x4b57('0x7')]?_0x3a87a1[_0x4b57('0x7')][_0x4b57('0x22')]||null:null,'transaction':_0x5531d0,'lock':_0x5531d0['LOCK'][_0x4b57('0x23')],'include':[{'model':db[_0x4b57('0x1e')],'as':'Contact','attributes':_[_0x4b57('0x24')](_0x47fac6)},{'model':db[_0x4b57('0x25')],'as':_0x4b57('0x26'),'attributes':['id','name',_0x4b57('0x27')]}]})['then'](function(_0x213dca){var _0xfbe7ed=[];var _0x2ae205=[];for(var _0xf71da2=0x0;_0xf71da2<_0x213dca[_0x4b57('0x28')];_0xf71da2+=0x1){var _0x1b36b6=_0x213dca[_0xf71da2][_0x4b57('0x29')];if(_0x1b36b6===null){_0xfbe7ed[_0x4b57('0x2a')](_0x213dca[_0xf71da2]['update'](_0x3a87a1[_0x4b57('0x1b')],{'transaction':_0x5531d0}));}else if(!_0x2ae205[_0x4b57('0x2b')](_0x1b36b6)){_0x2ae205[_0x4b57('0x2a')](_0x1b36b6);_0xfbe7ed['push'](_0x213dca[_0xf71da2][_0x4b57('0x19')](_0x3a87a1[_0x4b57('0x1b')],{'transaction':_0x5531d0}));}}return BPromise[_0x4b57('0x2c')](_0xfbe7ed);});})['then'](function(_0x1579d1){logger[_0x4b57('0xf')](_0x4b57('0x1d'),_0x3a87a1);if(_0x1579d1[_0x4b57('0x28')]>0x0){logger[_0x4b57('0xf')](_0x4b57('0x2d'),_0x1579d1[0x0][_0x4b57('0x2e')]['id'],_0x1579d1[0x0]['dataValues']['ContactId'],_0x1579d1[0x0][_0x4b57('0x2e')][_0x4b57('0x2f')]);}logger[_0x4b57('0x10')](_0x4b57('0x1d'),_0x3a87a1,JSON['stringify'](_0x1579d1));_0x5b83ab(_0x1579d1);})[_0x4b57('0x12')](function(_0x73d979){logger[_0x4b57('0x13')](_0x4b57('0x1d'),_0x73d979['message'],_0x3a87a1);_0x41258d(_0x4fbed3['error'](0x1f4,_0x73d979[_0x4b57('0x14')]));});});});};exports[_0x4b57('0x30')]=function(_0x57efcc){var _0x4d6966=this;return new Promise(function(_0x451737,_0x5c1082){return db[_0x4b57('0x20')][_0x4b57('0x21')](function(_0x16f83a){return db[_0x4b57('0x31')][_0x4b57('0x32')](_0x57efcc['body'],{'raw':_0x57efcc['options']?_0x57efcc['options']['raw']===undefined?!![]:![]:!![],'transaction':_0x16f83a})[_0x4b57('0xe')](function(){logger[_0x4b57('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x4b57('0x11')](_0x57efcc[_0x4b57('0x7')][_0x4b57('0x8')]),_0x57efcc[_0x4b57('0x7')][_0x4b57('0x8')][_0x4b57('0x2f')]);return db[_0x4b57('0x16')][_0x4b57('0x33')]({'where':_0x57efcc[_0x4b57('0x7')]?_0x57efcc['options'][_0x4b57('0x8')]||null:null,'transaction':_0x16f83a});});})['then'](function(_0x10bd32){logger[_0x4b57('0xf')]('MoveContactManagedDialer',_0x57efcc);logger[_0x4b57('0x10')](_0x4b57('0x30'),_0x57efcc,JSON[_0x4b57('0x11')](_0x10bd32));_0x451737(_0x10bd32);})[_0x4b57('0x12')](function(_0x36f154){logger[_0x4b57('0x13')](_0x4b57('0x30'),_0x36f154[_0x4b57('0x14')],_0x57efcc);_0x5c1082(_0x4d6966[_0x4b57('0x13')](0x1f4,_0x36f154[_0x4b57('0x14')]));});});};exports[_0x4b57('0x34')]=function(_0x9d83fe){var _0x59e4bb=this;return new Promise(function(_0x163bfa,_0x34bc74){return db['CmHopper'][_0x4b57('0x6')]({'raw':_0x9d83fe['options']?_0x9d83fe['options']['raw']===undefined?!![]:![]:!![],'where':_0x9d83fe[_0x4b57('0x7')]?_0x9d83fe['options'][_0x4b57('0x8')]||null:null,'attributes':[[db[_0x4b57('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4b57('0x20')][_0x4b57('0x35')](_0x4b57('0x36')+util['format'](_0x4b57('0x37'),moment()[_0x4b57('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x4b57('0x39')))),_0x4b57('0x3a')]]})['then'](function(_0x1ff102){logger[_0x4b57('0xf')](_0x4b57('0x34'),_0x9d83fe);logger[_0x4b57('0x10')](_0x4b57('0x34'),_0x9d83fe,JSON[_0x4b57('0x11')](_0x1ff102));_0x163bfa(_0x1ff102);})[_0x4b57('0x12')](function(_0x522aac){logger['error'](_0x4b57('0x34'),_0x522aac[_0x4b57('0x14')],_0x9d83fe);_0x34bc74(_0x59e4bb['error'](0x1f4,_0x522aac['message']));});});};exports[_0x4b57('0x3b')]=function(_0x38e9d6){var _0x5a1cec=this;return new Promise(function(_0x5407e9,_0x4e88ef){return db[_0x4b57('0x1e')][_0x4b57('0x1f')]()[_0x4b57('0xe')](function(){return db['sequelize']['transaction'](function(_0x50ccd4){return db[_0x4b57('0x16')]['findAll']({'where':_0x38e9d6[_0x4b57('0x7')]?_0x38e9d6['options'][_0x4b57('0x8')]||null:null,'attributes':_0x38e9d6[_0x4b57('0x7')]?_0x38e9d6[_0x4b57('0x7')][_0x4b57('0x9')]||null:null,'limit':0x1,'order':_0x38e9d6['options']?_0x38e9d6[_0x4b57('0x7')]['order']||null:null,'group':db['CmHopper'][_0x4b57('0x29')],'transaction':_0x50ccd4,'lock':_0x50ccd4[_0x4b57('0x3c')]['UPDATE'],'include':_0x38e9d6[_0x4b57('0x7')]?_0x38e9d6[_0x4b57('0x7')][_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x38e9d6[_0x4b57('0x7')][_0x4b57('0xb')],function(_0x57e9eb){return{'model':db[_0x57e9eb[_0x4b57('0xd')]],'as':_0x57e9eb['as'],'attributes':_0x57e9eb[_0x4b57('0x9')],'include':_0x57e9eb[_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x57e9eb[_0x4b57('0xb')],function(_0x55fc5d){return{'model':db[_0x55fc5d[_0x4b57('0xd')]],'as':_0x55fc5d['as'],'attributes':_0x55fc5d[_0x4b57('0x9')],'include':_0x55fc5d[_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x55fc5d['include'],function(_0x4b17c3){return{'model':db[_0x4b17c3[_0x4b57('0xd')]],'as':_0x4b17c3['as'],'attributes':_0x4b17c3[_0x4b57('0x9')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xe')](function(_0x4e30e7){var _0x2807d3=[];for(var _0x5c1679=0x0;_0x5c1679<_0x4e30e7[_0x4b57('0x28')];_0x5c1679+=0x1){_0x2807d3[_0x4b57('0x2a')](_0x4e30e7[_0x5c1679]['update'](_0x38e9d6['body'],{'transaction':_0x50ccd4}));}return BPromise[_0x4b57('0x2c')](_0x2807d3);});})['then'](function(_0x323189){logger[_0x4b57('0xf')](_0x4b57('0x3b'),_0x38e9d6);logger[_0x4b57('0x10')](_0x4b57('0x3b'),_0x38e9d6,JSON['stringify'](_0x323189));_0x5407e9(_0x323189);})[_0x4b57('0x12')](function(_0x3083f3){logger[_0x4b57('0x13')]('GetContactRecallMe',_0x3083f3['message'],_0x38e9d6);_0x4e88ef(_0x5a1cec[_0x4b57('0x13')](0x1f4,_0x3083f3[_0x4b57('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x1ceb74){var _0x1148ff=this;return new Promise(function(_0x5d4ff9,_0x358dac){db[_0x4b57('0x1e')]['describe']()[_0x4b57('0xe')](function(_0x46a99a){return db[_0x4b57('0x16')]['findAll']({'raw':_0x1ceb74[_0x4b57('0x7')]?_0x1ceb74[_0x4b57('0x7')][_0x4b57('0x17')]===undefined?!![]:![]:!![],'where':_0x1ceb74[_0x4b57('0x7')]?_0x1ceb74[_0x4b57('0x7')][_0x4b57('0x8')]||null:null,'attributes':_0x1ceb74[_0x4b57('0x7')]?_0x1ceb74['options'][_0x4b57('0x9')]||null:null,'limit':_0x1ceb74[_0x4b57('0x7')]?_0x1ceb74['options'][_0x4b57('0xa')]||null:null,'include':_0x1ceb74[_0x4b57('0x7')]?_0x1ceb74['options'][_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x1ceb74[_0x4b57('0x7')][_0x4b57('0xb')],function(_0x346123){return{'model':db[_0x346123[_0x4b57('0xd')]],'as':_0x346123['as'],'attributes':_0x346123['as']===_0x4b57('0x3d')?_[_0x4b57('0x24')](_0x46a99a):_0x346123[_0x4b57('0x9')],'include':_0x346123[_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x346123[_0x4b57('0xb')],function(_0x1dbfb8){return{'model':db[_0x1dbfb8[_0x4b57('0xd')]],'as':_0x1dbfb8['as'],'attributes':_0x1dbfb8[_0x4b57('0x9')],'include':_0x1dbfb8[_0x4b57('0xb')]?_[_0x4b57('0xc')](_0x1dbfb8[_0x4b57('0xb')],function(_0x40d259){return{'model':db[_0x40d259[_0x4b57('0xd')]],'as':_0x40d259['as'],'attributes':_0x40d259[_0x4b57('0x9')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xe')](function(_0x3f79f0){logger[_0x4b57('0xf')](_0x4b57('0x5'),_0x1ceb74);logger['debug']('GetCmHopper',_0x1ceb74,JSON['stringify'](_0x3f79f0));_0x5d4ff9(_0x3f79f0);})['catch'](function(_0x35f32f){logger[_0x4b57('0x13')]('GetCmHopper',_0x35f32f[_0x4b57('0x14')],_0x1ceb74);_0x358dac(_0x1148ff[_0x4b57('0x13')](0x1f4,_0x35f32f['message']));});});});};exports[_0x4b57('0x3e')]=function(_0x245887){var _0x54ecdc=this;return new Promise(function(_0x4b2785,_0x36f980){return db[_0x4b57('0x1e')][_0x4b57('0x3f')]({'raw':!![],'where':{'phone':_0x245887[_0x4b57('0x7')][_0x4b57('0x8')][_0x4b57('0x40')]},'attributes':['id',_0x4b57('0x41')],'order':[['id','DESC']]})['then'](function(_0x2ff63a){logger[_0x4b57('0xf')](_0x4b57('0x42'),_0x245887);logger[_0x4b57('0x10')](_0x4b57('0x42'),_0x245887,JSON[_0x4b57('0x11')](_0x2ff63a));_0x4b2785(_0x2ff63a);})[_0x4b57('0x12')](function(_0xb4d62a){logger[_0x4b57('0x13')]('getContactByPhone',_0xb4d62a[_0x4b57('0x14')],_0x245887);_0x36f980(_0x54ecdc[_0x4b57('0x13')](0x1f4,_0xb4d62a[_0x4b57('0x14')]));});});};exports[_0x4b57('0x43')]=function(_0x53016e){var _0x496531=this;return new Promise(function(_0x11b0ab,_0x5e7628){return db['sequelize'][_0x4b57('0x21')](function(_0x71a944){var _0x4b6643=_0x53016e[_0x4b57('0x7')]&&_0x53016e['options']['where']?_0x53016e[_0x4b57('0x7')][_0x4b57('0x8')]:{};return db[_0x4b57('0x16')][_0x4b57('0x19')](_0x53016e[_0x4b57('0x1b')],{'where':_0x4b6643,'transaction':_0x71a944})['then'](function(_0x34d0b8){logger[_0x4b57('0xf')](_0x4b57('0x43'),_0x53016e);logger[_0x4b57('0x10')](_0x4b57('0x43'),_0x53016e,JSON[_0x4b57('0x11')](_0x34d0b8));_0x11b0ab(_0x34d0b8);})[_0x4b57('0x12')](function(_0x58b377){logger[_0x4b57('0x13')]('ResetActiveCalls',_0x58b377[_0x4b57('0x14')],_0x53016e);_0x5e7628(_0x496531[_0x4b57('0x13')](0x1f4,_0x58b377[_0x4b57('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x5357a3){var _0x10e365=this;var _0x1942d2=_0x5357a3[_0x4b57('0x1b')]['where'][_0x4b57('0x44')];var _0x455949=_0x5357a3['body'][_0x4b57('0x8')][_0x4b57('0x45')];var _0x36690c=_0x5357a3[_0x4b57('0x1b')][_0x4b57('0x8')][_0x4b57('0x46')];return new Promise(function(_0x29e1f6,_0x17da7f){return db['CmHopper'][_0x4b57('0x6')]({'where':{'voiceQueueId':{'$in':_0x1942d2},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x4b57('0x20')][_0x4b57('0x35')]('NOW()\x20+\x20INTERVAL\x20'+_0x455949+_0x4b57('0x47')),'$gt':db['sequelize']['literal'](_0x4b57('0x48'))}},'UserId':{'$in':_0x36690c}},'include':[{'model':db[_0x4b57('0x1e')],'as':_0x4b57('0x3d')},{'model':db[_0x4b57('0x25')],'as':_0x4b57('0x26'),'attributes':['id',_0x4b57('0x49'),_0x4b57('0x27')]},{'model':db[_0x4b57('0x4a')],'as':_0x4b57('0x4b')}]})['then'](function(_0x1b1584){if(_0x1b1584['length']>0x0){return db[_0x4b57('0x20')]['transaction'](function(_0x4e5934){return db[_0x4b57('0x16')][_0x4b57('0x19')]({'recallmeNotifiedDate':db[_0x4b57('0x20')][_0x4b57('0x35')](_0x4b57('0x48'))},{'where':{'id':{'$in':_[_0x4b57('0xc')](_0x1b1584,'id')}},'transaction':_0x4e5934})[_0x4b57('0xe')](function(){_0x29e1f6(_0x1b1584);})[_0x4b57('0x12')](function(_0x34ee3f){logger[_0x4b57('0x13')](_0x4b57('0x4c'),_0x34ee3f[_0x4b57('0x14')],_0x5357a3);_0x17da7f(_0x10e365[_0x4b57('0x13')](0x1f4,_0x34ee3f[_0x4b57('0x14')]));});})['catch'](function(_0x7f5aa8){logger[_0x4b57('0x13')](_0x4b57('0x4c'),_0x7f5aa8['message'],_0x5357a3);_0x17da7f(_0x10e365[_0x4b57('0x13')](0x1f4,_0x7f5aa8[_0x4b57('0x14')]));});}else{_0x29e1f6(_0x1b1584);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index cb5f0cd..6787905 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 _0x76b8=['/preview','getPreview','/timezone','put','update','delete','destroy','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','/describe','describe','getOpenContacts','/:id','show','post','create'];(function(_0x3170e1,_0x484124){var _0x4999f7=function(_0x2a79b5){while(--_0x2a79b5){_0x3170e1['push'](_0x3170e1['shift']());}};_0x4999f7(++_0x484124);}(_0x76b8,0x120));var _0x876b=function(_0xfb8e9c,_0x4bfaec){_0xfb8e9c=_0xfb8e9c-0x0;var _0x432968=_0x76b8[_0xfb8e9c];return _0x432968;};'use strict';var express=require('express');var router=express[_0x876b('0x0')]();var auth=require(_0x876b('0x1'));var controller=require(_0x876b('0x2'));router[_0x876b('0x3')]('/',auth[_0x876b('0x4')](),controller['index']);router[_0x876b('0x3')](_0x876b('0x5'),auth[_0x876b('0x4')](),controller[_0x876b('0x6')]);router[_0x876b('0x3')]('/opencontacts',auth[_0x876b('0x4')](),controller[_0x876b('0x7')]);router['get']('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x876b('0x3')](_0x876b('0x8'),auth[_0x876b('0x4')](),controller[_0x876b('0x9')]);router['get']('/:id/previewrecall',auth[_0x876b('0x4')](),controller['getPreviewRecall']);router[_0x876b('0xa')]('/',auth[_0x876b('0x4')](),controller[_0x876b('0xb')]);router['post'](_0x876b('0xc'),auth[_0x876b('0x4')](),controller[_0x876b('0xd')]);router[_0x876b('0xa')](_0x876b('0xe'),auth[_0x876b('0x4')](),controller['getTimezone']);router[_0x876b('0xf')](_0x876b('0x8'),auth['isAuthenticated'](),controller[_0x876b('0x10')]);router[_0x876b('0x11')](_0x876b('0x8'),auth[_0x876b('0x4')](),controller[_0x876b('0x12')]);module[_0x876b('0x13')]=router; \ No newline at end of file +var _0x2389=['isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','show','/:id/previewrecall','create','post','getPreview','/timezone','update','delete','destroy','exports','express','../../components/auth/service','./cmHopper.controller','get'];(function(_0x4aab4d,_0x4caae5){var _0x2f9309=function(_0x118187){while(--_0x118187){_0x4aab4d['push'](_0x4aab4d['shift']());}};_0x2f9309(++_0x4caae5);}(_0x2389,0xc2));var _0x9238=function(_0x7220f4,_0x5ac632){_0x7220f4=_0x7220f4-0x0;var _0x5e4f9f=_0x2389[_0x7220f4];return _0x5e4f9f;};'use strict';var express=require(_0x9238('0x0'));var router=express['Router']();var auth=require(_0x9238('0x1'));var controller=require(_0x9238('0x2'));router[_0x9238('0x3')]('/',auth[_0x9238('0x4')](),controller[_0x9238('0x5')]);router['get'](_0x9238('0x6'),auth['isAuthenticated'](),controller[_0x9238('0x7')]);router['get'](_0x9238('0x8'),auth['isAuthenticated'](),controller[_0x9238('0x9')]);router['get'](_0x9238('0xa'),auth[_0x9238('0x4')](),controller[_0x9238('0xb')]);router[_0x9238('0x3')]('/:id',auth[_0x9238('0x4')](),controller[_0x9238('0xc')]);router['get'](_0x9238('0xd'),auth[_0x9238('0x4')](),controller['getPreviewRecall']);router['post']('/',auth[_0x9238('0x4')](),controller[_0x9238('0xe')]);router[_0x9238('0xf')]('/preview',auth['isAuthenticated'](),controller[_0x9238('0x10')]);router[_0x9238('0xf')](_0x9238('0x11'),auth[_0x9238('0x4')](),controller['getTimezone']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9238('0x12')]);router[_0x9238('0x13')]('/:id',auth[_0x9238('0x4')](),controller[_0x9238('0x14')]);module[_0x9238('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index e9eba7d..0c824f0 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 _0xbe49=['STRING','format','moment','exports','INTEGER'];(function(_0x1eb613,_0x36474f){var _0x46b625=function(_0x1a25f9){while(--_0x1a25f9){_0x1eb613['push'](_0x1eb613['shift']());}};_0x46b625(++_0x36474f);}(_0xbe49,0x1c4));var _0x9be4=function(_0x2cd821,_0x32f974){_0x2cd821=_0x2cd821-0x0;var _0x4a4b83=_0xbe49[_0x2cd821];return _0x4a4b83;};'use strict';var moment=require(_0x9be4('0x0'));var Sequelize=require('sequelize');module[_0x9be4('0x1')]={'CmHopperId':{'type':Sequelize[_0x9be4('0x2')]},'phone':{'type':Sequelize[_0x9be4('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x9be4('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9be4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb56=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','INTEGER'];(function(_0x20a558,_0x160e0e){var _0x53d3f7=function(_0x259bd8){while(--_0x259bd8){_0x20a558['push'](_0x20a558['shift']());}};_0x53d3f7(++_0x160e0e);}(_0xbb56,0x82));var _0x6bb5=function(_0x4eea5f,_0x32ef96){_0x4eea5f=_0x4eea5f-0x0;var _0x4a7b8e=_0xbb56[_0x4eea5f];return _0x4a7b8e;};'use strict';var moment=require(_0x6bb5('0x0'));var Sequelize=require(_0x6bb5('0x1'));module['exports']={'CmHopperId':{'type':Sequelize[_0x6bb5('0x2')]},'phone':{'type':Sequelize[_0x6bb5('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x6bb5('0x4')],'defaultValue':moment()[_0x6bb5('0x5')](_0x6bb5('0x6'))},'countbusyretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6bb5('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d3eb3fe..aa14899 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 _0x068f=['update','destroy','then','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','CmHopperAdditionalPhone','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x068f,0x186));var _0xf068=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x068f[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xf068('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf068('0x1'));var rp=require(_0xf068('0x2'));var moment=require(_0xf068('0x3'));var BPromise=require(_0xf068('0x4'));var Mustache=require(_0xf068('0x5'));var util=require('util');var path=require('path');var sox=require(_0xf068('0x6'));var csv=require(_0xf068('0x7'));var ejs=require(_0xf068('0x8'));var fs=require('fs');var fs_extra=require(_0xf068('0x9'));var _=require(_0xf068('0xa'));var squel=require(_0xf068('0xb'));var crypto=require(_0xf068('0xc'));var jsforce=require(_0xf068('0xd'));var deskjs=require(_0xf068('0xe'));var toCsv=require(_0xf068('0x7'));var querystring=require(_0xf068('0xf'));var Papa=require(_0xf068('0x10'));var Redis=require(_0xf068('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf068('0x12'));var as=require(_0xf068('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf068('0x14'));var utils=require(_0xf068('0x15'));var config=require(_0xf068('0x16'));var licenseUtil=require(_0xf068('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e4e2a,_0x5415f6){_0x5415f6=_0x5415f6||0xcc;return function(_0x5ad34f){if(_0x5ad34f){return _0x5e4e2a['sendStatus'](_0x5415f6);}return _0x5e4e2a[_0xf068('0x18')](_0x5415f6)[_0xf068('0x19')]();};}function respondWithResult(_0x4649f9,_0x20f9a0){_0x20f9a0=_0x20f9a0||0xc8;return function(_0x40e84a){if(_0x40e84a){return _0x4649f9[_0xf068('0x18')](_0x20f9a0)[_0xf068('0x1a')](_0x40e84a);}};}function respondWithFilteredResult(_0x35812f,_0x456473){return function(_0x4da1fd){if(_0x4da1fd){var _0x51c8e3=typeof _0x456473[_0xf068('0x1b')]===_0xf068('0x1c')&&typeof _0x456473['limit']==='undefined';var _0x3c0961=_0x4da1fd[_0xf068('0x1d')];var _0x4007ff=_0x51c8e3?0x0:_0x456473[_0xf068('0x1b')];var _0x3c9c53=_0x51c8e3?_0x4da1fd[_0xf068('0x1d')]:_0x456473[_0xf068('0x1b')]+_0x456473[_0xf068('0x1e')];var _0x4f0dfa;if(_0x3c9c53>=_0x3c0961){_0x3c9c53=_0x3c0961;_0x4f0dfa=0xc8;}else{_0x4f0dfa=0xce;}_0x35812f['status'](_0x4f0dfa);return _0x35812f[_0xf068('0x1f')](_0xf068('0x20'),_0x4007ff+'-'+_0x3c9c53+'/'+_0x3c0961)[_0xf068('0x1a')](_0x4da1fd);}return null;};}function patchUpdates(_0x10ff2c){return function(_0x213900){try{jsonpatch[_0xf068('0x21')](_0x213900,_0x10ff2c,!![]);}catch(_0x12fade){return BPromise['reject'](_0x12fade);}return _0x213900[_0xf068('0x22')]();};}function saveUpdates(_0x40db2f,_0x35707d){return function(_0x1d864d){if(_0x1d864d){return _0x1d864d[_0xf068('0x23')](_0x40db2f)['then'](function(_0x45825e){return _0x45825e;});}return null;};}function removeEntity(_0x3e1126,_0x2e7b03){return function(_0x4d0c3e){if(_0x4d0c3e){return _0x4d0c3e[_0xf068('0x24')]()[_0xf068('0x25')](function(){var _0x46b48d=_0x4d0c3e[_0xf068('0x26')]({'plain':!![]});var _0x53e7fd='CmHopperAdditionalPhones';return db[_0xf068('0x27')][_0xf068('0x24')]({'where':{'type':_0x53e7fd,'resourceId':_0x46b48d['id']}})[_0xf068('0x25')](function(){return _0x4d0c3e;});})['then'](function(){_0x3e1126[_0xf068('0x18')](0xcc)[_0xf068('0x19')]();});}};}function handleEntityNotFound(_0x1723cf,_0x454f3c){return function(_0x168d77){if(!_0x168d77){_0x1723cf[_0xf068('0x28')](0x194);}return _0x168d77;};}function handleError(_0x4c6f37,_0x3ffd9e){_0x3ffd9e=_0x3ffd9e||0x1f4;return function(_0x3314a5){logger[_0xf068('0x29')](_0x3314a5[_0xf068('0x2a')]);if(_0x3314a5[_0xf068('0x2b')]){delete _0x3314a5[_0xf068('0x2b')];}_0x4c6f37[_0xf068('0x18')](_0x3ffd9e)[_0xf068('0x2c')](_0x3314a5);};}exports[_0xf068('0x2d')]=function(_0x22244c,_0x11ae8b){var _0x3a6357={},_0x4fa366={},_0x5a5c42={'count':0x0,'rows':[]};var _0x1d2102=_[_0xf068('0x2e')](db[_0xf068('0x2f')]['rawAttributes'],function(_0x2bab64){return{'name':_0x2bab64[_0xf068('0x30')],'type':_0x2bab64[_0xf068('0x31')][_0xf068('0x32')]};});_0x4fa366[_0xf068('0x33')]=_[_0xf068('0x2e')](_0x1d2102,_0xf068('0x2b'));_0x4fa366['query']=_[_0xf068('0x34')](_0x22244c[_0xf068('0x35')]);_0x4fa366[_0xf068('0x36')]=_['intersection'](_0x4fa366[_0xf068('0x33')],_0x4fa366[_0xf068('0x35')]);_0x3a6357[_0xf068('0x37')]=_[_0xf068('0x38')](_0x4fa366[_0xf068('0x33')],qs[_0xf068('0x39')](_0x22244c[_0xf068('0x35')][_0xf068('0x39')]));_0x3a6357[_0xf068('0x37')]=_0x3a6357[_0xf068('0x37')]['length']?_0x3a6357[_0xf068('0x37')]:_0x4fa366[_0xf068('0x33')];if(!_0x22244c[_0xf068('0x35')][_0xf068('0x3a')](_0xf068('0x3b'))){_0x3a6357[_0xf068('0x1e')]=qs['limit'](_0x22244c[_0xf068('0x35')][_0xf068('0x1e')]);_0x3a6357[_0xf068('0x1b')]=qs[_0xf068('0x1b')](_0x22244c['query'][_0xf068('0x1b')]);}_0x3a6357[_0xf068('0x3c')]=qs[_0xf068('0x3d')](_0x22244c['query']['sort']);_0x3a6357[_0xf068('0x3e')]=qs[_0xf068('0x36')](_['pick'](_0x22244c[_0xf068('0x35')],_0x4fa366[_0xf068('0x36')]),_0x1d2102);if(_0x22244c['query']['filter']){_0x3a6357[_0xf068('0x3e')]=_['merge'](_0x3a6357[_0xf068('0x3e')],{'$or':_[_0xf068('0x2e')](_0x1d2102,function(_0x44f451){if(_0x44f451[_0xf068('0x31')]!==_0xf068('0x3f')){var _0x4de830={};_0x4de830[_0x44f451[_0xf068('0x2b')]]={'$like':'%'+_0x22244c['query']['filter']+'%'};return _0x4de830;}})});}_0x3a6357=_[_0xf068('0x40')]({},_0x3a6357,_0x22244c[_0xf068('0x41')]);var _0x7375ac={'where':_0x3a6357['where']};return db[_0xf068('0x2f')][_0xf068('0x1d')](_0x7375ac)['then'](function(_0x5c51db){_0x5a5c42[_0xf068('0x1d')]=_0x5c51db;if(_0x22244c['query'][_0xf068('0x42')]){_0x3a6357[_0xf068('0x43')]=[{'all':!![]}];}return db[_0xf068('0x2f')][_0xf068('0x44')](_0x3a6357);})[_0xf068('0x25')](function(_0x5cc3b6){_0x5a5c42[_0xf068('0x45')]=_0x5cc3b6;return _0x5a5c42;})['then'](respondWithFilteredResult(_0x11ae8b,_0x3a6357))[_0xf068('0x46')](handleError(_0x11ae8b,null));};exports[_0xf068('0x47')]=function(_0x58157a,_0x5a9ab8){var _0x333e04={'raw':!![],'where':{'id':_0x58157a[_0xf068('0x48')]['id']}},_0x1029ab={};_0x1029ab[_0xf068('0x33')]=_[_0xf068('0x34')](db['CmHopperAdditionalPhone'][_0xf068('0x49')]);_0x1029ab[_0xf068('0x35')]=_[_0xf068('0x34')](_0x58157a[_0xf068('0x35')]);_0x1029ab[_0xf068('0x36')]=_[_0xf068('0x38')](_0x1029ab[_0xf068('0x33')],_0x1029ab['query']);_0x333e04[_0xf068('0x37')]=_['intersection'](_0x1029ab[_0xf068('0x33')],qs[_0xf068('0x39')](_0x58157a[_0xf068('0x35')][_0xf068('0x39')]));_0x333e04['attributes']=_0x333e04['attributes'][_0xf068('0x4a')]?_0x333e04[_0xf068('0x37')]:_0x1029ab['model'];if(_0x58157a['query'][_0xf068('0x42')]){_0x333e04['include']=[{'all':!![]}];}_0x333e04=_['merge']({},_0x333e04,_0x58157a[_0xf068('0x41')]);return db[_0xf068('0x2f')][_0xf068('0x4b')](_0x333e04)[_0xf068('0x25')](handleEntityNotFound(_0x5a9ab8,null))[_0xf068('0x25')](respondWithResult(_0x5a9ab8,null))[_0xf068('0x46')](handleError(_0x5a9ab8,null));};exports[_0xf068('0x4c')]=function(_0x372fa9,_0x522034){return db[_0xf068('0x2f')][_0xf068('0x4c')](_0x372fa9[_0xf068('0x4d')],{})[_0xf068('0x25')](function(_0x280252){var _0x1220f9=_0x372fa9[_0xf068('0x4e')][_0xf068('0x26')]({'plain':!![]});if(!_0x1220f9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1220f9[_0xf068('0x4f')]===_0xf068('0x4e')){var _0x48bdad=_0x280252[_0xf068('0x26')]({'plain':!![]});var _0x4b42fb=_0xf068('0x50');return db[_0xf068('0x51')][_0xf068('0x4b')]({'where':{'name':_0x4b42fb,'userProfileId':_0x1220f9[_0xf068('0x52')]},'raw':!![]})[_0xf068('0x25')](function(_0x31a77c){if(_0x31a77c&&_0x31a77c[_0xf068('0x53')]===0x0){return db[_0xf068('0x27')][_0xf068('0x4c')]({'name':_0x48bdad[_0xf068('0x2b')],'resourceId':_0x48bdad['id'],'type':_0x31a77c[_0xf068('0x2b')],'sectionId':_0x31a77c['id']},{})[_0xf068('0x25')](function(){return _0x280252;});}else{return _0x280252;}})[_0xf068('0x46')](function(_0x286115){logger['error'](_0xf068('0x54'),_0x286115);throw _0x286115;});}return _0x280252;})[_0xf068('0x25')](respondWithResult(_0x522034,0xc9))[_0xf068('0x46')](handleError(_0x522034,null));};exports['update']=function(_0x24036d,_0x2ad886){if(_0x24036d['body']['id']){delete _0x24036d['body']['id'];}return db[_0xf068('0x2f')]['find']({'where':{'id':_0x24036d[_0xf068('0x48')]['id']}})[_0xf068('0x25')](handleEntityNotFound(_0x2ad886,null))[_0xf068('0x25')](saveUpdates(_0x24036d[_0xf068('0x4d')],null))[_0xf068('0x25')](respondWithResult(_0x2ad886,null))[_0xf068('0x46')](handleError(_0x2ad886,null));};exports[_0xf068('0x24')]=function(_0x31c420,_0x5868f3){return db[_0xf068('0x2f')][_0xf068('0x4b')]({'where':{'id':_0x31c420[_0xf068('0x48')]['id']}})['then'](handleEntityNotFound(_0x5868f3,null))[_0xf068('0x25')](removeEntity(_0x5868f3,null))['catch'](handleError(_0x5868f3,null));}; \ No newline at end of file +var _0xdcc2=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','apply','save','update','then','get','CmHopperAdditionalPhones','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','CmHopperAdditionalPhone','findAll','catch','params','length','include','find'];(function(_0x20cea6,_0x3a0611){var _0x29f2ae=function(_0x204b68){while(--_0x204b68){_0x20cea6['push'](_0x20cea6['shift']());}};_0x29f2ae(++_0x3a0611);}(_0xdcc2,0xfe));var _0x2dcc=function(_0x163372,_0x17966c){_0x163372=_0x163372-0x0;var _0x163e0d=_0xdcc2[_0x163372];return _0x163e0d;};'use strict';var emlformat=require(_0x2dcc('0x0'));var rimraf=require(_0x2dcc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2dcc('0x2'));var rp=require(_0x2dcc('0x3'));var moment=require(_0x2dcc('0x4'));var BPromise=require(_0x2dcc('0x5'));var Mustache=require(_0x2dcc('0x6'));var util=require(_0x2dcc('0x7'));var path=require(_0x2dcc('0x8'));var sox=require(_0x2dcc('0x9'));var csv=require(_0x2dcc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dcc('0xb'));var _=require(_0x2dcc('0xc'));var squel=require(_0x2dcc('0xd'));var crypto=require(_0x2dcc('0xe'));var jsforce=require(_0x2dcc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2dcc('0xa'));var querystring=require(_0x2dcc('0x10'));var Papa=require(_0x2dcc('0x11'));var Redis=require(_0x2dcc('0x12'));var authService=require(_0x2dcc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2dcc('0x14'));var hardwareService=require(_0x2dcc('0x15'));var logger=require(_0x2dcc('0x16'))(_0x2dcc('0x17'));var utils=require(_0x2dcc('0x18'));var config=require(_0x2dcc('0x19'));var licenseUtil=require(_0x2dcc('0x1a'));var db=require(_0x2dcc('0x1b'))['db'];function respondWithStatusCode(_0x188945,_0x5d6e83){_0x5d6e83=_0x5d6e83||0xcc;return function(_0x598011){if(_0x598011){return _0x188945[_0x2dcc('0x1c')](_0x5d6e83);}return _0x188945[_0x2dcc('0x1d')](_0x5d6e83)[_0x2dcc('0x1e')]();};}function respondWithResult(_0x53c6e3,_0x4dcb3a){_0x4dcb3a=_0x4dcb3a||0xc8;return function(_0x22de40){if(_0x22de40){return _0x53c6e3[_0x2dcc('0x1d')](_0x4dcb3a)[_0x2dcc('0x1f')](_0x22de40);}};}function respondWithFilteredResult(_0x1ed9c3,_0x4fd9e8){return function(_0x122948){if(_0x122948){var _0x7c808c=typeof _0x4fd9e8[_0x2dcc('0x20')]===_0x2dcc('0x21')&&typeof _0x4fd9e8['limit']===_0x2dcc('0x21');var _0x4a14e8=_0x122948[_0x2dcc('0x22')];var _0x19f718=_0x7c808c?0x0:_0x4fd9e8[_0x2dcc('0x20')];var _0x4e6b50=_0x7c808c?_0x122948[_0x2dcc('0x22')]:_0x4fd9e8[_0x2dcc('0x20')]+_0x4fd9e8['limit'];var _0x45d1e5;if(_0x4e6b50>=_0x4a14e8){_0x4e6b50=_0x4a14e8;_0x45d1e5=0xc8;}else{_0x45d1e5=0xce;}_0x1ed9c3['status'](_0x45d1e5);return _0x1ed9c3['set']('Content-Range',_0x19f718+'-'+_0x4e6b50+'/'+_0x4a14e8)[_0x2dcc('0x1f')](_0x122948);}return null;};}function patchUpdates(_0x1452d3){return function(_0x564036){try{jsonpatch[_0x2dcc('0x23')](_0x564036,_0x1452d3,!![]);}catch(_0x234414){return BPromise['reject'](_0x234414);}return _0x564036[_0x2dcc('0x24')]();};}function saveUpdates(_0x4274c3,_0x3b7a6f){return function(_0x21090b){if(_0x21090b){return _0x21090b[_0x2dcc('0x25')](_0x4274c3)['then'](function(_0x45cede){return _0x45cede;});}return null;};}function removeEntity(_0xe02b55,_0x3ea99f){return function(_0x309388){if(_0x309388){return _0x309388['destroy']()[_0x2dcc('0x26')](function(){var _0x2139c7=_0x309388[_0x2dcc('0x27')]({'plain':!![]});var _0x4f01f8=_0x2dcc('0x28');return db['UserProfileResource'][_0x2dcc('0x29')]({'where':{'type':_0x4f01f8,'resourceId':_0x2139c7['id']}})[_0x2dcc('0x26')](function(){return _0x309388;});})[_0x2dcc('0x26')](function(){_0xe02b55[_0x2dcc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cb236,_0x5d5215){return function(_0x1ff31c){if(!_0x1ff31c){_0x5cb236[_0x2dcc('0x1c')](0x194);}return _0x1ff31c;};}function handleError(_0x500f06,_0x18c65a){_0x18c65a=_0x18c65a||0x1f4;return function(_0x3758eb){logger[_0x2dcc('0x2a')](_0x3758eb[_0x2dcc('0x2b')]);if(_0x3758eb['name']){delete _0x3758eb[_0x2dcc('0x2c')];}_0x500f06['status'](_0x18c65a)[_0x2dcc('0x2d')](_0x3758eb);};}exports[_0x2dcc('0x2e')]=function(_0x560a56,_0x3ea42c){var _0x8adfcc={},_0x2a9821={},_0x112224={'count':0x0,'rows':[]};var _0x39e6bc=_['map'](db['CmHopperAdditionalPhone'][_0x2dcc('0x2f')],function(_0x1189fa){return{'name':_0x1189fa[_0x2dcc('0x30')],'type':_0x1189fa[_0x2dcc('0x31')]['key']};});_0x2a9821[_0x2dcc('0x32')]=_[_0x2dcc('0x33')](_0x39e6bc,_0x2dcc('0x2c'));_0x2a9821[_0x2dcc('0x34')]=_[_0x2dcc('0x35')](_0x560a56[_0x2dcc('0x34')]);_0x2a9821[_0x2dcc('0x36')]=_[_0x2dcc('0x37')](_0x2a9821[_0x2dcc('0x32')],_0x2a9821['query']);_0x8adfcc['attributes']=_['intersection'](_0x2a9821[_0x2dcc('0x32')],qs['fields'](_0x560a56[_0x2dcc('0x34')][_0x2dcc('0x38')]));_0x8adfcc[_0x2dcc('0x39')]=_0x8adfcc[_0x2dcc('0x39')]['length']?_0x8adfcc[_0x2dcc('0x39')]:_0x2a9821[_0x2dcc('0x32')];if(!_0x560a56[_0x2dcc('0x34')]['hasOwnProperty'](_0x2dcc('0x3a'))){_0x8adfcc[_0x2dcc('0x3b')]=qs[_0x2dcc('0x3b')](_0x560a56[_0x2dcc('0x34')][_0x2dcc('0x3b')]);_0x8adfcc[_0x2dcc('0x20')]=qs[_0x2dcc('0x20')](_0x560a56[_0x2dcc('0x34')]['offset']);}_0x8adfcc[_0x2dcc('0x3c')]=qs[_0x2dcc('0x3d')](_0x560a56[_0x2dcc('0x34')][_0x2dcc('0x3d')]);_0x8adfcc[_0x2dcc('0x3e')]=qs[_0x2dcc('0x36')](_[_0x2dcc('0x3f')](_0x560a56[_0x2dcc('0x34')],_0x2a9821['filters']),_0x39e6bc);if(_0x560a56[_0x2dcc('0x34')][_0x2dcc('0x40')]){_0x8adfcc[_0x2dcc('0x3e')]=_[_0x2dcc('0x41')](_0x8adfcc[_0x2dcc('0x3e')],{'$or':_[_0x2dcc('0x33')](_0x39e6bc,function(_0x168c42){if(_0x168c42[_0x2dcc('0x31')]!==_0x2dcc('0x42')){var _0x30612b={};_0x30612b[_0x168c42[_0x2dcc('0x2c')]]={'$like':'%'+_0x560a56['query'][_0x2dcc('0x40')]+'%'};return _0x30612b;}})});}_0x8adfcc=_[_0x2dcc('0x41')]({},_0x8adfcc,_0x560a56['options']);var _0x4c303b={'where':_0x8adfcc[_0x2dcc('0x3e')]};return db[_0x2dcc('0x43')][_0x2dcc('0x22')](_0x4c303b)[_0x2dcc('0x26')](function(_0x352ce6){_0x112224[_0x2dcc('0x22')]=_0x352ce6;if(_0x560a56[_0x2dcc('0x34')]['includeAll']){_0x8adfcc['include']=[{'all':!![]}];}return db[_0x2dcc('0x43')][_0x2dcc('0x44')](_0x8adfcc);})['then'](function(_0x1229ed){_0x112224['rows']=_0x1229ed;return _0x112224;})[_0x2dcc('0x26')](respondWithFilteredResult(_0x3ea42c,_0x8adfcc))[_0x2dcc('0x45')](handleError(_0x3ea42c,null));};exports['show']=function(_0x5932ff,_0x167746){var _0x448d40={'raw':!![],'where':{'id':_0x5932ff[_0x2dcc('0x46')]['id']}},_0x6580f4={};_0x6580f4[_0x2dcc('0x32')]=_[_0x2dcc('0x35')](db[_0x2dcc('0x43')][_0x2dcc('0x2f')]);_0x6580f4[_0x2dcc('0x34')]=_['keys'](_0x5932ff[_0x2dcc('0x34')]);_0x6580f4['filters']=_[_0x2dcc('0x37')](_0x6580f4[_0x2dcc('0x32')],_0x6580f4['query']);_0x448d40[_0x2dcc('0x39')]=_[_0x2dcc('0x37')](_0x6580f4[_0x2dcc('0x32')],qs[_0x2dcc('0x38')](_0x5932ff[_0x2dcc('0x34')][_0x2dcc('0x38')]));_0x448d40['attributes']=_0x448d40[_0x2dcc('0x39')][_0x2dcc('0x47')]?_0x448d40[_0x2dcc('0x39')]:_0x6580f4['model'];if(_0x5932ff['query']['includeAll']){_0x448d40[_0x2dcc('0x48')]=[{'all':!![]}];}_0x448d40=_[_0x2dcc('0x41')]({},_0x448d40,_0x5932ff['options']);return db[_0x2dcc('0x43')][_0x2dcc('0x49')](_0x448d40)[_0x2dcc('0x26')](handleEntityNotFound(_0x167746,null))[_0x2dcc('0x26')](respondWithResult(_0x167746,null))[_0x2dcc('0x45')](handleError(_0x167746,null));};exports[_0x2dcc('0x4a')]=function(_0x1e1b50,_0x4fb3b5){return db['CmHopperAdditionalPhone'][_0x2dcc('0x4a')](_0x1e1b50[_0x2dcc('0x4b')],{})['then'](function(_0x23bec6){var _0x4877c6=_0x1e1b50[_0x2dcc('0x4c')][_0x2dcc('0x27')]({'plain':!![]});if(!_0x4877c6)throw new Error(_0x2dcc('0x4d'));if(_0x4877c6[_0x2dcc('0x4e')]===_0x2dcc('0x4c')){var _0x4beca9=_0x23bec6['get']({'plain':!![]});var _0x53577c=_0x2dcc('0x28');return db[_0x2dcc('0x4f')][_0x2dcc('0x49')]({'where':{'name':_0x53577c,'userProfileId':_0x4877c6['userProfileId']},'raw':!![]})[_0x2dcc('0x26')](function(_0x1e4c0c){if(_0x1e4c0c&&_0x1e4c0c['autoAssociation']===0x0){return db[_0x2dcc('0x50')]['create']({'name':_0x4beca9[_0x2dcc('0x2c')],'resourceId':_0x4beca9['id'],'type':_0x1e4c0c['name'],'sectionId':_0x1e4c0c['id']},{})[_0x2dcc('0x26')](function(){return _0x23bec6;});}else{return _0x23bec6;}})['catch'](function(_0x1d2447){logger[_0x2dcc('0x2a')](_0x2dcc('0x51'),_0x1d2447);throw _0x1d2447;});}return _0x23bec6;})[_0x2dcc('0x26')](respondWithResult(_0x4fb3b5,0xc9))[_0x2dcc('0x45')](handleError(_0x4fb3b5,null));};exports[_0x2dcc('0x25')]=function(_0x287dbf,_0xb4f741){if(_0x287dbf[_0x2dcc('0x4b')]['id']){delete _0x287dbf[_0x2dcc('0x4b')]['id'];}return db[_0x2dcc('0x43')][_0x2dcc('0x49')]({'where':{'id':_0x287dbf[_0x2dcc('0x46')]['id']}})[_0x2dcc('0x26')](handleEntityNotFound(_0xb4f741,null))[_0x2dcc('0x26')](saveUpdates(_0x287dbf['body'],null))['then'](respondWithResult(_0xb4f741,null))[_0x2dcc('0x45')](handleError(_0xb4f741,null));};exports[_0x2dcc('0x29')]=function(_0x2a469b,_0x40c0e3){return db[_0x2dcc('0x43')][_0x2dcc('0x49')]({'where':{'id':_0x2a469b[_0x2dcc('0x46')]['id']}})[_0x2dcc('0x26')](handleEntityNotFound(_0x40c0e3,null))['then'](removeEntity(_0x40c0e3,null))[_0x2dcc('0x45')](handleError(_0x40c0e3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 3097306..98125dd 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 _0x99b8=['CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x4182dd,_0x2500f0){var _0x343ea5=function(_0x2e7ac3){while(--_0x2e7ac3){_0x4182dd['push'](_0x4182dd['shift']());}};_0x343ea5(++_0x2500f0);}(_0x99b8,0xb5));var _0x899b=function(_0x34c2ff,_0x2dd0bc){_0x34c2ff=_0x34c2ff-0x0;var _0x44f8c3=_0x99b8[_0x34c2ff];return _0x44f8c3;};'use strict';var _=require(_0x899b('0x0'));var util=require(_0x899b('0x1'));var logger=require(_0x899b('0x2'))(_0x899b('0x3'));var moment=require(_0x899b('0x4'));var BPromise=require(_0x899b('0x5'));var rp=require(_0x899b('0x6'));var fs=require('fs');var path=require(_0x899b('0x7'));var rimraf=require('rimraf');var config=require(_0x899b('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x899b('0x9')]=function(_0x1ecb86,_0x3a450a){return _0x1ecb86[_0x899b('0xa')](_0x899b('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7699=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','CmHopperAdditionalPhone','lodash','util','api'];(function(_0x8b97d6,_0x23b18f){var _0x5bf49a=function(_0x355a57){while(--_0x355a57){_0x8b97d6['push'](_0x8b97d6['shift']());}};_0x5bf49a(++_0x23b18f);}(_0x7699,0x15c));var _0x9769=function(_0x45bd84,_0x4a61bb){_0x45bd84=_0x45bd84-0x0;var _0x551b62=_0x7699[_0x45bd84];return _0x551b62;};'use strict';var _=require(_0x9769('0x0'));var util=require(_0x9769('0x1'));var logger=require('../../config/logger')(_0x9769('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9769('0x3'));var rimraf=require(_0x9769('0x4'));var config=require(_0x9769('0x5'));var attributes=require(_0x9769('0x6'));module[_0x9769('0x7')]=function(_0x713eb5,_0x1dbcec){return _0x713eb5['define'](_0x9769('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 7390104..dbac201 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 _0xb863=['then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','VoiceQueueId','CampaignId','OrderBy','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','entity','countbusyretry','countabandonedretry','countagentrejectretry','dialGlobalMaxRetry','SwapAdditionalPhones','ContactId','ListId','CmHopperAdditionalPhone','duration','isNil','scheduledat','minutes','add','countdropretry','createdAt','updatedAt','phone','sequelize','update','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xb863,0x65));var _0x3b86=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xb863[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require(_0x3b86('0x0'));var moment=require(_0x3b86('0x1'));var BPromise=require(_0x3b86('0x2'));var rs=require(_0x3b86('0x3'));var fs=require('fs');var Redis=require(_0x3b86('0x4'));var db=require(_0x3b86('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3b86('0x6'));var jayson=require(_0x3b86('0x7'));var client=jayson[_0x3b86('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc68743,_0x4035ac,_0x333720){return new BPromise(function(_0xe7139,_0x4a7ab5){return client['request'](_0xc68743,_0x333720)[_0x3b86('0x9')](function(_0x3ad7d2){logger[_0x3b86('0xa')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x4035ac,_0x3b86('0xb'));logger[_0x3b86('0xc')](_0x3b86('0xd'),_0x4035ac,'request\x20sent',JSON[_0x3b86('0xe')](_0x3ad7d2));if(_0x3ad7d2[_0x3b86('0xf')]){if(_0x3ad7d2[_0x3b86('0xf')][_0x3b86('0x10')]===0x1f4){logger[_0x3b86('0xf')](_0x3b86('0x11'),_0x4035ac,_0x3ad7d2[_0x3b86('0xf')]['message']);return _0x4a7ab5(_0x3ad7d2[_0x3b86('0xf')][_0x3b86('0x12')]);}logger[_0x3b86('0xf')](_0x3b86('0x11'),_0x4035ac,_0x3ad7d2[_0x3b86('0xf')][_0x3b86('0x12')]);return _0xe7139(_0x3ad7d2['error'][_0x3b86('0x12')]);}else{logger[_0x3b86('0xa')](_0x3b86('0x11'),_0x4035ac,_0x3b86('0xb'));_0xe7139(_0x3ad7d2[_0x3b86('0x13')][_0x3b86('0x12')]);}})[_0x3b86('0x14')](function(_0x11e69d){logger['error'](_0x3b86('0x11'),_0x4035ac,_0x11e69d);_0x4a7ab5(_0x11e69d);});});}exports[_0x3b86('0x15')]=function(_0x971119){var _0x2aeee0=this;return new Promise(function(_0x23abcd,_0x164078){return db[_0x3b86('0x16')][_0x3b86('0x17')]({'raw':!![],'where':{'ContactId':_0x971119[_0x3b86('0x18')]['ContactId'],'ListId':_0x971119[_0x3b86('0x18')]['ListId'],'VoiceQueueId':_0x971119[_0x3b86('0x18')][_0x3b86('0x19')]===undefined?null:_0x971119[_0x3b86('0x18')][_0x3b86('0x19')],'CampaignId':_0x971119[_0x3b86('0x18')]['CampaignId']===undefined?null:_0x971119[_0x3b86('0x18')][_0x3b86('0x1a')]}})['then'](function(_0x1a8622){if(_0x1a8622!=null){return db['CmHopperAdditionalPhone'][_0x3b86('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1a8622['id'],'OrderBy':{'$gt':_0x1a8622['OrderBy']}},'order':[[_0x3b86('0x1b'),_0x3b86('0x1c')]]})[_0x3b86('0x9')](function(_0x1d663e){var _0x435dde=0x0;if(_0x1d663e){if(_0x1d663e['countbusyretry']+_0x1d663e[_0x3b86('0x1d')]+_0x1d663e[_0x3b86('0x1e')]+_0x1d663e[_0x3b86('0x1f')]+_0x1d663e['countdropretry']+_0x1d663e['countabandonedretry']+_0x1d663e[_0x3b86('0x20')]+_0x1d663e['countagentrejectretry']<_0x971119[_0x3b86('0x21')]['dialGlobalMaxRetry'])_0x435dde=0x1;_0x23abcd({'additional':_0x435dde});}else{return db['CmHopperAdditionalPhone'][_0x3b86('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1a8622['id']},'order':[[_0x3b86('0x1b'),'ASC']]})[_0x3b86('0x9')](function(_0x4a569){var _0x464abd=0x0;if(_0x4a569){if(_0x4a569[_0x3b86('0x22')]+_0x4a569[_0x3b86('0x1d')]+_0x4a569[_0x3b86('0x1e')]+_0x4a569['countnosuchnumberretry']+_0x4a569['countdropretry']+_0x4a569[_0x3b86('0x23')]+_0x4a569[_0x3b86('0x20')]+_0x4a569[_0x3b86('0x24')]<_0x971119[_0x3b86('0x21')][_0x3b86('0x25')])_0x464abd=0x1;_0x23abcd({'additional':_0x464abd});}else{_0x23abcd({'additional':0x0});}})['catch'](function(_0xc57af4){logger[_0x3b86('0xf')](_0x3b86('0x15'),_0xc57af4[_0x3b86('0x12')]);_0x164078(_0x2aeee0[_0x3b86('0xf')](0x1f4,_0xc57af4[_0x3b86('0x12')]));});}})['catch'](function(_0x1a8134){logger[_0x3b86('0xf')](_0x3b86('0x15'),_0x1a8134['message']);_0x164078(_0x2aeee0[_0x3b86('0xf')](0x1f4,_0x1a8134[_0x3b86('0x12')]));});}else _0x23abcd({'additional':0x0});});});};exports[_0x3b86('0x26')]=function(_0x212c8f){var _0x517c67=this;return new Promise(function(_0x7df917,_0xc7d0d8){return db[_0x3b86('0x16')]['findOne']({'raw':!![],'where':{'ContactId':_0x212c8f[_0x3b86('0x18')][_0x3b86('0x27')],'ListId':_0x212c8f[_0x3b86('0x18')][_0x3b86('0x28')],'VoiceQueueId':_0x212c8f[_0x3b86('0x18')][_0x3b86('0x19')]===undefined?null:_0x212c8f[_0x3b86('0x18')][_0x3b86('0x19')],'CampaignId':_0x212c8f['body'][_0x3b86('0x1a')]===undefined?null:_0x212c8f[_0x3b86('0x18')][_0x3b86('0x1a')]}})[_0x3b86('0x9')](function(_0x8f7beb){if(_0x8f7beb!=null){return db[_0x3b86('0x29')][_0x3b86('0x17')]({'raw':!![],'where':{'CmHopperId':_0x8f7beb['id'],'OrderBy':{'$gte':_0x8f7beb[_0x3b86('0x1b')]}},'order':[[_0x3b86('0x1b'),'ASC']]})['then'](function(_0x2cb617){if(_0x2cb617)return activateAdditionalPhone(_0x8f7beb,_0x212c8f[_0x3b86('0x18')],_0x2cb617,_0x212c8f[_0x3b86('0x2a')],_0x212c8f['waitTime'])[_0x3b86('0x9')](function(_0xe46ec4){_0x7df917(_0xe46ec4);});else{return db[_0x3b86('0x29')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x8f7beb['id']},'order':[[_0x3b86('0x1b'),_0x3b86('0x1c')]]})[_0x3b86('0x9')](function(_0x5ed215){if(_0x5ed215)return activateAdditionalPhone(_0x8f7beb,_0x212c8f['body'],_0x5ed215,_0x212c8f[_0x3b86('0x2a')],_0x212c8f['waitTime'])[_0x3b86('0x9')](function(_0x36f20b){_0x7df917(_0x36f20b);});else{_0x7df917({'id':_0x8f7beb['id'],'phone':''});}})[_0x3b86('0x14')](function(_0x3d40fb){logger[_0x3b86('0xf')](_0x3b86('0x15'),_0x3d40fb[_0x3b86('0x12')]);_0xc7d0d8(_0x517c67['error'](0x1f4,_0x3d40fb[_0x3b86('0x12')]));});}})['catch'](function(_0x5bfcbf){logger[_0x3b86('0xf')]('VerifyAdditionalPhones',_0x5bfcbf['message']);_0xc7d0d8(_0x517c67['error'](0x1f4,_0x5bfcbf[_0x3b86('0x12')]));});}else _0x7df917(0x1);});});};function activateAdditionalPhone(_0x75a7cd,_0x7ca27c,_0x55a9a1,_0x432905,_0x4b6687){return new Promise(function(_0x3c593f,_0x9fce3a){var _0x4d2a86;if(_[_0x3b86('0x2b')](_0x55a9a1[_0x3b86('0x2c')])){_0x55a9a1['scheduledat']=moment();}if(moment()>moment(_0x55a9a1[_0x3b86('0x2c')])){_0x4d2a86=moment()['add'](_0x4b6687||0x3,_0x3b86('0x2d'));}else{if(_0x55a9a1['OrderBy']==0x0){_0x4d2a86=moment(_0x55a9a1[_0x3b86('0x2c')]);}else{_0x4d2a86=moment()[_0x3b86('0x2e')](_0x4b6687||0x3,_0x3b86('0x2d'));}}if(_['isNil'](_0x4d2a86)){_0x4d2a86=moment()[_0x3b86('0x2e')](_0x4b6687||0x3,_0x3b86('0x2d'));}var _0x17f9bc={'phone':_0x75a7cd['phone'],'active':0x0,'OrderBy':_[_0x3b86('0x2b')](_0x75a7cd[_0x3b86('0x1b')])?0x0:_0x75a7cd[_0x3b86('0x1b')],'scheduledat':moment()['add'](_0x432905||0x1,_0x3b86('0x2d')),'countbusyretry':_0x7ca27c['countbusyretry'],'countcongestionretry':_0x7ca27c[_0x3b86('0x1d')],'countnoanswerretry':_0x7ca27c[_0x3b86('0x1e')],'countnosuchnumberretry':_0x7ca27c[_0x3b86('0x1f')],'countdropretry':_0x7ca27c[_0x3b86('0x2f')],'countabandonedretry':_0x7ca27c['countabandonedretry'],'countmachineretry':_0x7ca27c[_0x3b86('0x20')],'countagentrejectretry':_0x7ca27c[_0x3b86('0x24')],'createdAt':_0x7ca27c[_0x3b86('0x30')],'updatedAt':_0x7ca27c[_0x3b86('0x31')]};var _0x144665={'CmHopperId':_0x75a7cd['id'],'phone':_0x55a9a1[_0x3b86('0x32')],'active':0x0,'OrderBy':_['isNil'](_0x55a9a1[_0x3b86('0x1b')])?0x0:_0x55a9a1[_0x3b86('0x1b')],'scheduledat':_0x4d2a86,'countbusyretry':_0x55a9a1[_0x3b86('0x22')],'countcongestionretry':_0x55a9a1[_0x3b86('0x1d')],'countnoanswerretry':_0x55a9a1[_0x3b86('0x1e')],'countnosuchnumberretry':_0x55a9a1[_0x3b86('0x1f')],'countdropretry':_0x55a9a1[_0x3b86('0x2f')],'countabandonedretry':_0x55a9a1[_0x3b86('0x23')],'countmachineretry':_0x55a9a1[_0x3b86('0x20')],'countagentrejectretry':_0x55a9a1[_0x3b86('0x24')],'createdAt':_0x55a9a1[_0x3b86('0x30')],'updatedAt':_0x55a9a1[_0x3b86('0x31')]};return db[_0x3b86('0x33')]['transaction'](function(_0x49226e){return db[_0x3b86('0x29')][_0x3b86('0x34')](_0x17f9bc,{'where':{'id':_0x55a9a1['id']}},{'transaction':_0x49226e})[_0x3b86('0x9')](function(){return db[_0x3b86('0x16')][_0x3b86('0x34')](_0x144665,{'where':{'id':_0x75a7cd['id']}},{'transaction':_0x49226e});});})[_0x3b86('0x9')](function(_0x89c8ab){_0x3c593f({'id':_0x75a7cd['id'],'phone':_0x55a9a1[_0x3b86('0x32')]});})[_0x3b86('0x14')](function(_0x46fb8e){logger['error']('activateAdditionalPhone',_0x46fb8e[_0x3b86('0x12')]);_0x9fce3a({'error':_0x46fb8e[_0x3b86('0x12')]});});});}exports[_0x3b86('0x35')]=function(_0x3965f2){var _0x5cf29a=this;return new Promise(function(_0x273934,_0xda76e5){return db[_0x3b86('0x16')][_0x3b86('0x34')](_0x3965f2[_0x3b86('0x18')][_0x3b86('0x36')],{'where':{'id':_0x3965f2[_0x3b86('0x18')]['id']}})[_0x3b86('0x9')](function(_0xf75b69){_0x273934(_0xf75b69);})[_0x3b86('0x14')](function(_0x159ff6){logger['error']('IncrementPreviewCounters',_0x159ff6['message']);_0xda76e5(_0x5cf29a[_0x3b86('0xf')](0x1f4,_0x159ff6[_0x3b86('0x12')]));});});}; \ No newline at end of file +var _0xc175=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xe1b5f6,_0x210c09){var _0x44636e=function(_0x3a3212){while(--_0x3a3212){_0xe1b5f6['push'](_0xe1b5f6['shift']());}};_0x44636e(++_0x210c09);}(_0xc175,0x196));var _0x5c17=function(_0x3a594c,_0x59d8ad){_0x3a594c=_0x3a594c-0x0;var _0x5dd774=_0xc175[_0x3a594c];return _0x5dd774;};'use strict';var _=require(_0x5c17('0x0'));var util=require(_0x5c17('0x1'));var moment=require(_0x5c17('0x2'));var BPromise=require(_0x5c17('0x3'));var rs=require(_0x5c17('0x4'));var fs=require('fs');var Redis=require(_0x5c17('0x5'));var db=require(_0x5c17('0x6'))['db'];var utils=require(_0x5c17('0x7'));var logger=require(_0x5c17('0x8'))(_0x5c17('0x9'));var config=require(_0x5c17('0xa'));var jayson=require(_0x5c17('0xb'));var client=jayson[_0x5c17('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x156319,_0x240f4e,_0x5d3139){return new BPromise(function(_0x4a35b3,_0x194a37){return client[_0x5c17('0xd')](_0x156319,_0x5d3139)[_0x5c17('0xe')](function(_0x34446a){logger[_0x5c17('0xf')](_0x5c17('0x10'),_0x240f4e,_0x5c17('0x11'));logger[_0x5c17('0x12')](_0x5c17('0x13'),_0x240f4e,_0x5c17('0x11'),JSON[_0x5c17('0x14')](_0x34446a));if(_0x34446a[_0x5c17('0x15')]){if(_0x34446a['error']['code']===0x1f4){logger[_0x5c17('0x15')](_0x5c17('0x10'),_0x240f4e,_0x34446a[_0x5c17('0x15')][_0x5c17('0x16')]);return _0x194a37(_0x34446a['error'][_0x5c17('0x16')]);}logger[_0x5c17('0x15')](_0x5c17('0x10'),_0x240f4e,_0x34446a[_0x5c17('0x15')][_0x5c17('0x16')]);return _0x4a35b3(_0x34446a[_0x5c17('0x15')]['message']);}else{logger['info'](_0x5c17('0x10'),_0x240f4e,_0x5c17('0x11'));_0x4a35b3(_0x34446a['result']['message']);}})[_0x5c17('0x17')](function(_0x4ca250){logger[_0x5c17('0x15')](_0x5c17('0x10'),_0x240f4e,_0x4ca250);_0x194a37(_0x4ca250);});});}exports[_0x5c17('0x18')]=function(_0x328e91){var _0x391432=this;return new Promise(function(_0x545f3f,_0x47b522){return db[_0x5c17('0x19')][_0x5c17('0x1a')]({'raw':!![],'where':{'ContactId':_0x328e91[_0x5c17('0x1b')][_0x5c17('0x1c')],'ListId':_0x328e91['body'][_0x5c17('0x1d')],'VoiceQueueId':_0x328e91[_0x5c17('0x1b')][_0x5c17('0x1e')]===undefined?null:_0x328e91[_0x5c17('0x1b')][_0x5c17('0x1e')],'CampaignId':_0x328e91['body'][_0x5c17('0x1f')]===undefined?null:_0x328e91['body'][_0x5c17('0x1f')]}})[_0x5c17('0xe')](function(_0x81819d){if(_0x81819d!=null){return db[_0x5c17('0x20')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x81819d['id'],'OrderBy':{'$gt':_0x81819d[_0x5c17('0x21')]}},'order':[['OrderBy',_0x5c17('0x22')]]})[_0x5c17('0xe')](function(_0x36f7ac){var _0x323bc1=0x0;if(_0x36f7ac){if(_0x36f7ac[_0x5c17('0x23')]+_0x36f7ac[_0x5c17('0x24')]+_0x36f7ac[_0x5c17('0x25')]+_0x36f7ac[_0x5c17('0x26')]+_0x36f7ac[_0x5c17('0x27')]+_0x36f7ac[_0x5c17('0x28')]+_0x36f7ac[_0x5c17('0x29')]+_0x36f7ac[_0x5c17('0x2a')]<_0x328e91[_0x5c17('0x2b')][_0x5c17('0x2c')])_0x323bc1=0x1;_0x545f3f({'additional':_0x323bc1});}else{return db[_0x5c17('0x20')][_0x5c17('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x81819d['id']},'order':[[_0x5c17('0x21'),_0x5c17('0x22')]]})[_0x5c17('0xe')](function(_0x1f47de){var _0x4f3314=0x0;if(_0x1f47de){if(_0x1f47de[_0x5c17('0x23')]+_0x1f47de[_0x5c17('0x24')]+_0x1f47de[_0x5c17('0x25')]+_0x1f47de[_0x5c17('0x26')]+_0x1f47de['countdropretry']+_0x1f47de['countabandonedretry']+_0x1f47de[_0x5c17('0x29')]+_0x1f47de['countagentrejectretry']<_0x328e91[_0x5c17('0x2b')][_0x5c17('0x2c')])_0x4f3314=0x1;_0x545f3f({'additional':_0x4f3314});}else{_0x545f3f({'additional':0x0});}})[_0x5c17('0x17')](function(_0x2f0953){logger[_0x5c17('0x15')](_0x5c17('0x18'),_0x2f0953[_0x5c17('0x16')]);_0x47b522(_0x391432['error'](0x1f4,_0x2f0953[_0x5c17('0x16')]));});}})[_0x5c17('0x17')](function(_0x5d0c41){logger['error'](_0x5c17('0x18'),_0x5d0c41[_0x5c17('0x16')]);_0x47b522(_0x391432[_0x5c17('0x15')](0x1f4,_0x5d0c41[_0x5c17('0x16')]));});}else _0x545f3f({'additional':0x0});});});};exports[_0x5c17('0x2d')]=function(_0x67877b){var _0x2af46d=this;return new Promise(function(_0x308911,_0x503808){return db[_0x5c17('0x19')][_0x5c17('0x1a')]({'raw':!![],'where':{'ContactId':_0x67877b[_0x5c17('0x1b')][_0x5c17('0x1c')],'ListId':_0x67877b['body'][_0x5c17('0x1d')],'VoiceQueueId':_0x67877b[_0x5c17('0x1b')]['VoiceQueueId']===undefined?null:_0x67877b[_0x5c17('0x1b')][_0x5c17('0x1e')],'CampaignId':_0x67877b[_0x5c17('0x1b')][_0x5c17('0x1f')]===undefined?null:_0x67877b[_0x5c17('0x1b')][_0x5c17('0x1f')]}})['then'](function(_0x603ff2){if(_0x603ff2!=null){return db[_0x5c17('0x20')][_0x5c17('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x603ff2['id'],'OrderBy':{'$gte':_0x603ff2[_0x5c17('0x21')]}},'order':[['OrderBy',_0x5c17('0x22')]]})[_0x5c17('0xe')](function(_0x33194e){if(_0x33194e)return activateAdditionalPhone(_0x603ff2,_0x67877b['body'],_0x33194e,_0x67877b[_0x5c17('0x2e')],_0x67877b[_0x5c17('0x2f')])[_0x5c17('0xe')](function(_0x4dee70){_0x308911(_0x4dee70);});else{return db[_0x5c17('0x20')][_0x5c17('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x603ff2['id']},'order':[[_0x5c17('0x21'),_0x5c17('0x22')]]})[_0x5c17('0xe')](function(_0x1e7dc6){if(_0x1e7dc6)return activateAdditionalPhone(_0x603ff2,_0x67877b[_0x5c17('0x1b')],_0x1e7dc6,_0x67877b[_0x5c17('0x2e')],_0x67877b['waitTime'])[_0x5c17('0xe')](function(_0x59002c){_0x308911(_0x59002c);});else{_0x308911({'id':_0x603ff2['id'],'phone':''});}})[_0x5c17('0x17')](function(_0x5dc63c){logger[_0x5c17('0x15')](_0x5c17('0x18'),_0x5dc63c[_0x5c17('0x16')]);_0x503808(_0x2af46d[_0x5c17('0x15')](0x1f4,_0x5dc63c['message']));});}})['catch'](function(_0x224a60){logger[_0x5c17('0x15')](_0x5c17('0x18'),_0x224a60[_0x5c17('0x16')]);_0x503808(_0x2af46d['error'](0x1f4,_0x224a60[_0x5c17('0x16')]));});}else _0x308911(0x1);});});};function activateAdditionalPhone(_0xcdebb8,_0x2d9c30,_0x5d6c75,_0xbc498b,_0x1de8f7){return new Promise(function(_0x48264d,_0x90d865){var _0xe9a4fd;if(_[_0x5c17('0x30')](_0x5d6c75['scheduledat'])){_0x5d6c75['scheduledat']=moment();}if(moment()>moment(_0x5d6c75[_0x5c17('0x31')])){_0xe9a4fd=moment()[_0x5c17('0x32')](_0x1de8f7||0x3,_0x5c17('0x33'));}else{if(_0x5d6c75[_0x5c17('0x21')]==0x0){_0xe9a4fd=moment(_0x5d6c75[_0x5c17('0x31')]);}else{_0xe9a4fd=moment()[_0x5c17('0x32')](_0x1de8f7||0x3,_0x5c17('0x33'));}}if(_[_0x5c17('0x30')](_0xe9a4fd)){_0xe9a4fd=moment()['add'](_0x1de8f7||0x3,'minutes');}var _0x30cdbb={'phone':_0xcdebb8[_0x5c17('0x34')],'active':0x0,'OrderBy':_[_0x5c17('0x30')](_0xcdebb8['OrderBy'])?0x0:_0xcdebb8[_0x5c17('0x21')],'scheduledat':moment()[_0x5c17('0x32')](_0xbc498b||0x1,_0x5c17('0x33')),'countbusyretry':_0x2d9c30[_0x5c17('0x23')],'countcongestionretry':_0x2d9c30['countcongestionretry'],'countnoanswerretry':_0x2d9c30['countnoanswerretry'],'countnosuchnumberretry':_0x2d9c30[_0x5c17('0x26')],'countdropretry':_0x2d9c30[_0x5c17('0x27')],'countabandonedretry':_0x2d9c30[_0x5c17('0x28')],'countmachineretry':_0x2d9c30[_0x5c17('0x29')],'countagentrejectretry':_0x2d9c30[_0x5c17('0x2a')],'createdAt':_0x2d9c30[_0x5c17('0x35')],'updatedAt':_0x2d9c30['updatedAt']};var _0x2817c0={'CmHopperId':_0xcdebb8['id'],'phone':_0x5d6c75[_0x5c17('0x34')],'active':0x0,'OrderBy':_[_0x5c17('0x30')](_0x5d6c75[_0x5c17('0x21')])?0x0:_0x5d6c75[_0x5c17('0x21')],'scheduledat':_0xe9a4fd,'countbusyretry':_0x5d6c75[_0x5c17('0x23')],'countcongestionretry':_0x5d6c75['countcongestionretry'],'countnoanswerretry':_0x5d6c75[_0x5c17('0x25')],'countnosuchnumberretry':_0x5d6c75[_0x5c17('0x26')],'countdropretry':_0x5d6c75[_0x5c17('0x27')],'countabandonedretry':_0x5d6c75[_0x5c17('0x28')],'countmachineretry':_0x5d6c75[_0x5c17('0x29')],'countagentrejectretry':_0x5d6c75['countagentrejectretry'],'createdAt':_0x5d6c75['createdAt'],'updatedAt':_0x5d6c75[_0x5c17('0x36')]};return db['sequelize']['transaction'](function(_0x40747d){return db[_0x5c17('0x20')][_0x5c17('0x37')](_0x30cdbb,{'where':{'id':_0x5d6c75['id']}},{'transaction':_0x40747d})['then'](function(){return db[_0x5c17('0x19')]['update'](_0x2817c0,{'where':{'id':_0xcdebb8['id']}},{'transaction':_0x40747d});});})[_0x5c17('0xe')](function(_0x14d8de){_0x48264d({'id':_0xcdebb8['id'],'phone':_0x5d6c75['phone']});})[_0x5c17('0x17')](function(_0x4dfe3b){logger[_0x5c17('0x15')](_0x5c17('0x38'),_0x4dfe3b[_0x5c17('0x16')]);_0x90d865({'error':_0x4dfe3b[_0x5c17('0x16')]});});});}exports[_0x5c17('0x39')]=function(_0x385006){var _0xa8f196=this;return new Promise(function(_0x298270,_0x47f7a6){return db[_0x5c17('0x19')][_0x5c17('0x37')](_0x385006[_0x5c17('0x1b')][_0x5c17('0x3a')],{'where':{'id':_0x385006[_0x5c17('0x1b')]['id']}})[_0x5c17('0xe')](function(_0x45894c){_0x298270(_0x45894c);})[_0x5c17('0x17')](function(_0x204be9){logger[_0x5c17('0x15')](_0x5c17('0x39'),_0x204be9['message']);_0x47f7a6(_0xa8f196['error'](0x1f4,_0x204be9[_0x5c17('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index d7e6303..7d219d1 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 _0x9c3c=['../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xbb9b40,_0x51b63a){var _0x4cd1b3=function(_0x4c0343){while(--_0x4c0343){_0xbb9b40['push'](_0xbb9b40['shift']());}};_0x4cd1b3(++_0x51b63a);}(_0x9c3c,0x1c1));var _0xc9c3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9c3c[_0x21a9d9];return _0x46adce;};'use strict';var multer=require(_0xc9c3('0x0'));var util=require('util');var path=require(_0xc9c3('0x1'));var timeout=require('connect-timeout');var express=require(_0xc9c3('0x2'));var router=express[_0xc9c3('0x3')]();var fs_extra=require(_0xc9c3('0x4'));var auth=require(_0xc9c3('0x5'));var interaction=require(_0xc9c3('0x6'));var config=require(_0xc9c3('0x7'));var controller=require(_0xc9c3('0x8'));router['get']('/',auth[_0xc9c3('0x9')](),controller[_0xc9c3('0xa')]);router[_0xc9c3('0xb')](_0xc9c3('0xc'),auth[_0xc9c3('0x9')](),controller[_0xc9c3('0xd')]);router[_0xc9c3('0xe')]('/',auth[_0xc9c3('0x9')](),controller['create']);router[_0xc9c3('0xf')]('/:id',auth[_0xc9c3('0x9')](),controller[_0xc9c3('0x10')]);router[_0xc9c3('0x11')](_0xc9c3('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xc9c3('0x12')]=router; \ No newline at end of file +var _0xc638=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x49ac6,_0x28d76e){var _0x2fa0f9=function(_0xffc8d6){while(--_0xffc8d6){_0x49ac6['push'](_0x49ac6['shift']());}};_0x2fa0f9(++_0x28d76e);}(_0xc638,0x112));var _0x8c63=function(_0x5291fb,_0x151cfc){_0x5291fb=_0x5291fb-0x0;var _0x790840=_0xc638[_0x5291fb];return _0x790840;};'use strict';var multer=require(_0x8c63('0x0'));var util=require(_0x8c63('0x1'));var path=require('path');var timeout=require(_0x8c63('0x2'));var express=require('express');var router=express[_0x8c63('0x3')]();var fs_extra=require(_0x8c63('0x4'));var auth=require(_0x8c63('0x5'));var interaction=require(_0x8c63('0x6'));var config=require(_0x8c63('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8c63('0x8')](_0x8c63('0x9'),auth[_0x8c63('0xa')](),controller[_0x8c63('0xb')]);router[_0x8c63('0xc')]('/',auth[_0x8c63('0xa')](),controller[_0x8c63('0xd')]);router[_0x8c63('0xe')](_0x8c63('0x9'),auth[_0x8c63('0xa')](),controller['update']);router[_0x8c63('0xf')](_0x8c63('0x9'),auth[_0x8c63('0xa')](),controller['destroy']);module[_0x8c63('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ab0fb05..ac82946 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 _0x031f=['INTEGER','contactListQueue','moment','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x031f,0x1c2));var _0xf031=function(_0x2428d8,_0x52169f){_0x2428d8=_0x2428d8-0x0;var _0x4908cb=_0x031f[_0x2428d8];return _0x4908cb;};'use strict';var moment=require(_0xf031('0x0'));var Sequelize=require('sequelize');module[_0xf031('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xf031('0x2')],'unique':_0xf031('0x3')},'ListId':{'type':Sequelize[_0xf031('0x2')],'unique':_0xf031('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xf031('0x3')}}; \ No newline at end of file +var _0xda1e=['moment','exports','STRING','INTEGER','contactListQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda1e,0xeb));var _0xeda1=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xda1e[_0x489b87];return _0x1823b6;};'use strict';var moment=require(_0xeda1('0x0'));var Sequelize=require('sequelize');module[_0xeda1('0x1')]={'phone':{'type':Sequelize[_0xeda1('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xeda1('0x3')],'unique':_0xeda1('0x4')},'ListId':{'type':Sequelize[_0xeda1('0x3')],'unique':_0xeda1('0x4')},'VoiceQueueId':{'type':Sequelize[_0xeda1('0x3')],'unique':_0xeda1('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a8d9083..df961e9 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 _0x3a18=['querystring','papaparse','../../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','reject','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','CmHopperBlack','findAll','rows','catch','params','rawAttributes','options','body','find','describe','eml-format','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv'];(function(_0x2a9eb7,_0x36a58d){var _0x5a5807=function(_0x5c6264){while(--_0x5c6264){_0x2a9eb7['push'](_0x2a9eb7['shift']());}};_0x5a5807(++_0x36a58d);}(_0x3a18,0x104));var _0x83a1=function(_0x36a19b,_0x1f6d56){_0x36a19b=_0x36a19b-0x0;var _0x2a19b4=_0x3a18[_0x36a19b];return _0x2a19b4;};'use strict';var emlformat=require(_0x83a1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x83a1('0x1'));var Mustache=require(_0x83a1('0x2'));var util=require('util');var path=require(_0x83a1('0x3'));var sox=require(_0x83a1('0x4'));var csv=require('to-csv');var ejs=require(_0x83a1('0x5'));var fs=require('fs');var fs_extra=require(_0x83a1('0x6'));var _=require(_0x83a1('0x7'));var squel=require(_0x83a1('0x8'));var crypto=require('crypto');var jsforce=require(_0x83a1('0x9'));var deskjs=require(_0x83a1('0xa'));var toCsv=require(_0x83a1('0xb'));var querystring=require(_0x83a1('0xc'));var Papa=require(_0x83a1('0xd'));var Redis=require('ioredis');var authService=require(_0x83a1('0xe'));var qs=require(_0x83a1('0xf'));var as=require(_0x83a1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x83a1('0x11'));var utils=require(_0x83a1('0x12'));var config=require(_0x83a1('0x13'));var licenseUtil=require(_0x83a1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38ca56,_0xadd399){_0xadd399=_0xadd399||0xcc;return function(_0x46c67c){if(_0x46c67c){return _0x38ca56[_0x83a1('0x15')](_0xadd399);}return _0x38ca56[_0x83a1('0x16')](_0xadd399)[_0x83a1('0x17')]();};}function respondWithResult(_0x1490a7,_0x3162fa){_0x3162fa=_0x3162fa||0xc8;return function(_0x50c591){if(_0x50c591){return _0x1490a7['status'](_0x3162fa)[_0x83a1('0x18')](_0x50c591);}};}function respondWithFilteredResult(_0x2c112f,_0x5a5c8b){return function(_0x273aa9){if(_0x273aa9){var _0x399494=typeof _0x5a5c8b[_0x83a1('0x19')]===_0x83a1('0x1a')&&typeof _0x5a5c8b['limit']===_0x83a1('0x1a');var _0x3f1944=_0x273aa9[_0x83a1('0x1b')];var _0x2b20ca=_0x399494?0x0:_0x5a5c8b[_0x83a1('0x19')];var _0x2b7db2=_0x399494?_0x273aa9[_0x83a1('0x1b')]:_0x5a5c8b[_0x83a1('0x19')]+_0x5a5c8b[_0x83a1('0x1c')];var _0x3ca8dd;if(_0x2b7db2>=_0x3f1944){_0x2b7db2=_0x3f1944;_0x3ca8dd=0xc8;}else{_0x3ca8dd=0xce;}_0x2c112f['status'](_0x3ca8dd);return _0x2c112f[_0x83a1('0x1d')]('Content-Range',_0x2b20ca+'-'+_0x2b7db2+'/'+_0x3f1944)[_0x83a1('0x18')](_0x273aa9);}return null;};}function patchUpdates(_0x133b26){return function(_0x1570f7){try{jsonpatch['apply'](_0x1570f7,_0x133b26,!![]);}catch(_0x3e68dd){return BPromise[_0x83a1('0x1e')](_0x3e68dd);}return _0x1570f7['save']();};}function saveUpdates(_0x5b566a,_0x464c3d){return function(_0x1096e8){if(_0x1096e8){return _0x1096e8['update'](_0x5b566a)[_0x83a1('0x1f')](function(_0x335d8f){return _0x335d8f;});}return null;};}function removeEntity(_0xe7825a,_0x56f673){return function(_0x226561){if(_0x226561){return _0x226561[_0x83a1('0x20')]()[_0x83a1('0x1f')](function(){_0xe7825a[_0x83a1('0x16')](0xcc)[_0x83a1('0x17')]();});}};}function handleEntityNotFound(_0x26116c,_0x484361){return function(_0x55c813){if(!_0x55c813){_0x26116c[_0x83a1('0x15')](0x194);}return _0x55c813;};}function handleError(_0x3f26e8,_0x5b552d){_0x5b552d=_0x5b552d||0x1f4;return function(_0x3727ec){logger[_0x83a1('0x21')](_0x3727ec[_0x83a1('0x22')]);if(_0x3727ec[_0x83a1('0x23')]){delete _0x3727ec[_0x83a1('0x23')];}_0x3f26e8['status'](_0x5b552d)[_0x83a1('0x24')](_0x3727ec);};}exports['index']=function(_0x419ec7,_0x401b68){var _0x3349b3={},_0x25258a={},_0x54442a={'count':0x0,'rows':[]};var _0xcbfede=_[_0x83a1('0x25')](db['CmHopperBlack']['rawAttributes'],function(_0x559899){return{'name':_0x559899[_0x83a1('0x26')],'type':_0x559899[_0x83a1('0x27')][_0x83a1('0x28')]};});_0x25258a[_0x83a1('0x29')]=_[_0x83a1('0x25')](_0xcbfede,_0x83a1('0x23'));_0x25258a[_0x83a1('0x2a')]=_[_0x83a1('0x2b')](_0x419ec7[_0x83a1('0x2a')]);_0x25258a[_0x83a1('0x2c')]=_['intersection'](_0x25258a[_0x83a1('0x29')],_0x25258a[_0x83a1('0x2a')]);_0x3349b3[_0x83a1('0x2d')]=_[_0x83a1('0x2e')](_0x25258a[_0x83a1('0x29')],qs[_0x83a1('0x2f')](_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x2f')]));_0x3349b3['attributes']=_0x3349b3[_0x83a1('0x2d')][_0x83a1('0x30')]?_0x3349b3['attributes']:_0x25258a['model'];if(!_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x31')](_0x83a1('0x32'))){_0x3349b3['limit']=qs[_0x83a1('0x1c')](_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x1c')]);_0x3349b3[_0x83a1('0x19')]=qs[_0x83a1('0x19')](_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x19')]);}_0x3349b3[_0x83a1('0x33')]=qs[_0x83a1('0x34')](_0x419ec7[_0x83a1('0x2a')]['sort']);_0x3349b3[_0x83a1('0x35')]=qs[_0x83a1('0x2c')](_['pick'](_0x419ec7[_0x83a1('0x2a')],_0x25258a[_0x83a1('0x2c')]),_0xcbfede);if(_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x36')]){_0x3349b3[_0x83a1('0x35')]=_[_0x83a1('0x37')](_0x3349b3['where'],{'$or':_[_0x83a1('0x25')](_0xcbfede,function(_0x2eabb0){if(_0x2eabb0['type']!=='VIRTUAL'){var _0x2c47ca={};_0x2c47ca[_0x2eabb0['name']]={'$like':'%'+_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x36')]+'%'};return _0x2c47ca;}})});}_0x3349b3=_[_0x83a1('0x37')]({},_0x3349b3,_0x419ec7['options']);var _0x22af5c={'where':_0x3349b3[_0x83a1('0x35')]};return db['CmHopperBlack'][_0x83a1('0x1b')](_0x22af5c)[_0x83a1('0x1f')](function(_0x5e0f1a){_0x54442a['count']=_0x5e0f1a;if(_0x419ec7[_0x83a1('0x2a')][_0x83a1('0x38')]){_0x3349b3[_0x83a1('0x39')]=[{'all':!![]}];}return db[_0x83a1('0x3a')][_0x83a1('0x3b')](_0x3349b3);})[_0x83a1('0x1f')](function(_0x249601){_0x54442a[_0x83a1('0x3c')]=_0x249601;return _0x54442a;})[_0x83a1('0x1f')](respondWithFilteredResult(_0x401b68,_0x3349b3))[_0x83a1('0x3d')](handleError(_0x401b68,null));};exports['show']=function(_0xb247b3,_0x159c2f){var _0x44df70={'raw':!![],'where':{'id':_0xb247b3[_0x83a1('0x3e')]['id']}},_0x385480={};_0x385480[_0x83a1('0x29')]=_[_0x83a1('0x2b')](db['CmHopperBlack'][_0x83a1('0x3f')]);_0x385480[_0x83a1('0x2a')]=_[_0x83a1('0x2b')](_0xb247b3[_0x83a1('0x2a')]);_0x385480[_0x83a1('0x2c')]=_[_0x83a1('0x2e')](_0x385480[_0x83a1('0x29')],_0x385480[_0x83a1('0x2a')]);_0x44df70[_0x83a1('0x2d')]=_[_0x83a1('0x2e')](_0x385480['model'],qs['fields'](_0xb247b3['query'][_0x83a1('0x2f')]));_0x44df70['attributes']=_0x44df70[_0x83a1('0x2d')][_0x83a1('0x30')]?_0x44df70[_0x83a1('0x2d')]:_0x385480[_0x83a1('0x29')];if(_0xb247b3[_0x83a1('0x2a')][_0x83a1('0x38')]){_0x44df70[_0x83a1('0x39')]=[{'all':!![]}];}_0x44df70=_[_0x83a1('0x37')]({},_0x44df70,_0xb247b3[_0x83a1('0x40')]);return db[_0x83a1('0x3a')]['find'](_0x44df70)[_0x83a1('0x1f')](handleEntityNotFound(_0x159c2f,null))[_0x83a1('0x1f')](respondWithResult(_0x159c2f,null))['catch'](handleError(_0x159c2f,null));};exports['update']=function(_0x1dfb4a,_0x230946){if(_0x1dfb4a[_0x83a1('0x41')]['id']){delete _0x1dfb4a[_0x83a1('0x41')]['id'];}return db[_0x83a1('0x3a')][_0x83a1('0x42')]({'where':{'id':_0x1dfb4a[_0x83a1('0x3e')]['id']}})[_0x83a1('0x1f')](handleEntityNotFound(_0x230946,null))[_0x83a1('0x1f')](saveUpdates(_0x1dfb4a['body'],null))[_0x83a1('0x1f')](respondWithResult(_0x230946,null))[_0x83a1('0x3d')](handleError(_0x230946,null));};exports[_0x83a1('0x20')]=function(_0x313b08,_0xbd7721){return db[_0x83a1('0x3a')][_0x83a1('0x42')]({'where':{'id':_0x313b08[_0x83a1('0x3e')]['id']}})[_0x83a1('0x1f')](handleEntityNotFound(_0xbd7721,null))[_0x83a1('0x1f')](removeEntity(_0xbd7721,null))[_0x83a1('0x3d')](handleError(_0xbd7721,null));};exports[_0x83a1('0x43')]=function(_0x554a33,_0xd57386){return db[_0x83a1('0x3a')][_0x83a1('0x43')]()[_0x83a1('0x1f')](respondWithResult(_0xd57386,null))['catch'](handleError(_0xd57386,null));}; \ No newline at end of file +var _0xf935=['includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x3820c6,_0x2cd623){var _0x4d23c7=function(_0x433179){while(--_0x433179){_0x3820c6['push'](_0x3820c6['shift']());}};_0x4d23c7(++_0x2cd623);}(_0xf935,0x1eb));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x5f93('0x0'));var rimraf=require(_0x5f93('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f93('0x2'));var rp=require(_0x5f93('0x3'));var moment=require(_0x5f93('0x4'));var BPromise=require(_0x5f93('0x5'));var Mustache=require(_0x5f93('0x6'));var util=require('util');var path=require(_0x5f93('0x7'));var sox=require(_0x5f93('0x8'));var csv=require(_0x5f93('0x9'));var ejs=require(_0x5f93('0xa'));var fs=require('fs');var fs_extra=require(_0x5f93('0xb'));var _=require(_0x5f93('0xc'));var squel=require(_0x5f93('0xd'));var crypto=require(_0x5f93('0xe'));var jsforce=require(_0x5f93('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5f93('0x9'));var querystring=require(_0x5f93('0x10'));var Papa=require(_0x5f93('0x11'));var Redis=require(_0x5f93('0x12'));var authService=require(_0x5f93('0x13'));var qs=require(_0x5f93('0x14'));var as=require(_0x5f93('0x15'));var hardwareService=require(_0x5f93('0x16'));var logger=require(_0x5f93('0x17'))('api');var utils=require(_0x5f93('0x18'));var config=require(_0x5f93('0x19'));var licenseUtil=require(_0x5f93('0x1a'));var db=require(_0x5f93('0x1b'))['db'];function respondWithStatusCode(_0xf66d55,_0x1ed31a){_0x1ed31a=_0x1ed31a||0xcc;return function(_0xd95598){if(_0xd95598){return _0xf66d55[_0x5f93('0x1c')](_0x1ed31a);}return _0xf66d55['status'](_0x1ed31a)[_0x5f93('0x1d')]();};}function respondWithResult(_0x1e633f,_0x26083d){_0x26083d=_0x26083d||0xc8;return function(_0x42b0a4){if(_0x42b0a4){return _0x1e633f[_0x5f93('0x1e')](_0x26083d)[_0x5f93('0x1f')](_0x42b0a4);}};}function respondWithFilteredResult(_0x45f7ab,_0x3b8b31){return function(_0x5301f3){if(_0x5301f3){var _0x4194da=typeof _0x3b8b31[_0x5f93('0x20')]===_0x5f93('0x21')&&typeof _0x3b8b31[_0x5f93('0x22')]===_0x5f93('0x21');var _0x4b3044=_0x5301f3[_0x5f93('0x23')];var _0x1a15e5=_0x4194da?0x0:_0x3b8b31['offset'];var _0x5090d9=_0x4194da?_0x5301f3['count']:_0x3b8b31[_0x5f93('0x20')]+_0x3b8b31[_0x5f93('0x22')];var _0x140461;if(_0x5090d9>=_0x4b3044){_0x5090d9=_0x4b3044;_0x140461=0xc8;}else{_0x140461=0xce;}_0x45f7ab[_0x5f93('0x1e')](_0x140461);return _0x45f7ab['set'](_0x5f93('0x24'),_0x1a15e5+'-'+_0x5090d9+'/'+_0x4b3044)[_0x5f93('0x1f')](_0x5301f3);}return null;};}function patchUpdates(_0x169cdc){return function(_0x647363){try{jsonpatch[_0x5f93('0x25')](_0x647363,_0x169cdc,!![]);}catch(_0x5f29d5){return BPromise[_0x5f93('0x26')](_0x5f29d5);}return _0x647363[_0x5f93('0x27')]();};}function saveUpdates(_0x349182,_0x362a62){return function(_0x66d35a){if(_0x66d35a){return _0x66d35a[_0x5f93('0x28')](_0x349182)[_0x5f93('0x29')](function(_0x53638c){return _0x53638c;});}return null;};}function removeEntity(_0xa027fc,_0x33b53c){return function(_0x187a42){if(_0x187a42){return _0x187a42[_0x5f93('0x2a')]()[_0x5f93('0x29')](function(){_0xa027fc[_0x5f93('0x1e')](0xcc)[_0x5f93('0x1d')]();});}};}function handleEntityNotFound(_0xf419ca,_0x49cbd4){return function(_0x40fe7d){if(!_0x40fe7d){_0xf419ca[_0x5f93('0x1c')](0x194);}return _0x40fe7d;};}function handleError(_0x1c4e30,_0x5deec0){_0x5deec0=_0x5deec0||0x1f4;return function(_0x439a5c){logger[_0x5f93('0x2b')](_0x439a5c[_0x5f93('0x2c')]);if(_0x439a5c[_0x5f93('0x2d')]){delete _0x439a5c[_0x5f93('0x2d')];}_0x1c4e30['status'](_0x5deec0)[_0x5f93('0x2e')](_0x439a5c);};}exports[_0x5f93('0x2f')]=function(_0x1e6bdb,_0x23f374){var _0x345140={},_0x4e45df={},_0x2dfc90={'count':0x0,'rows':[]};var _0x4aaa0b=_[_0x5f93('0x30')](db[_0x5f93('0x31')]['rawAttributes'],function(_0x41b7e0){return{'name':_0x41b7e0[_0x5f93('0x32')],'type':_0x41b7e0[_0x5f93('0x33')][_0x5f93('0x34')]};});_0x4e45df[_0x5f93('0x35')]=_[_0x5f93('0x30')](_0x4aaa0b,_0x5f93('0x2d'));_0x4e45df[_0x5f93('0x36')]=_['keys'](_0x1e6bdb[_0x5f93('0x36')]);_0x4e45df[_0x5f93('0x37')]=_[_0x5f93('0x38')](_0x4e45df[_0x5f93('0x35')],_0x4e45df[_0x5f93('0x36')]);_0x345140['attributes']=_[_0x5f93('0x38')](_0x4e45df[_0x5f93('0x35')],qs[_0x5f93('0x39')](_0x1e6bdb[_0x5f93('0x36')]['fields']));_0x345140[_0x5f93('0x3a')]=_0x345140['attributes'][_0x5f93('0x3b')]?_0x345140['attributes']:_0x4e45df[_0x5f93('0x35')];if(!_0x1e6bdb[_0x5f93('0x36')][_0x5f93('0x3c')](_0x5f93('0x3d'))){_0x345140['limit']=qs[_0x5f93('0x22')](_0x1e6bdb['query'][_0x5f93('0x22')]);_0x345140[_0x5f93('0x20')]=qs[_0x5f93('0x20')](_0x1e6bdb['query']['offset']);}_0x345140[_0x5f93('0x3e')]=qs[_0x5f93('0x3f')](_0x1e6bdb['query'][_0x5f93('0x3f')]);_0x345140[_0x5f93('0x40')]=qs[_0x5f93('0x37')](_[_0x5f93('0x41')](_0x1e6bdb[_0x5f93('0x36')],_0x4e45df[_0x5f93('0x37')]),_0x4aaa0b);if(_0x1e6bdb['query'][_0x5f93('0x42')]){_0x345140[_0x5f93('0x40')]=_[_0x5f93('0x43')](_0x345140[_0x5f93('0x40')],{'$or':_[_0x5f93('0x30')](_0x4aaa0b,function(_0xdfced9){if(_0xdfced9['type']!=='VIRTUAL'){var _0xefcf8c={};_0xefcf8c[_0xdfced9[_0x5f93('0x2d')]]={'$like':'%'+_0x1e6bdb[_0x5f93('0x36')]['filter']+'%'};return _0xefcf8c;}})});}_0x345140=_['merge']({},_0x345140,_0x1e6bdb[_0x5f93('0x44')]);var _0x2db9f5={'where':_0x345140[_0x5f93('0x40')]};return db['CmHopperBlack'][_0x5f93('0x23')](_0x2db9f5)[_0x5f93('0x29')](function(_0x3c149a){_0x2dfc90[_0x5f93('0x23')]=_0x3c149a;if(_0x1e6bdb[_0x5f93('0x36')][_0x5f93('0x45')]){_0x345140[_0x5f93('0x46')]=[{'all':!![]}];}return db[_0x5f93('0x31')][_0x5f93('0x47')](_0x345140);})[_0x5f93('0x29')](function(_0x3f894a){_0x2dfc90['rows']=_0x3f894a;return _0x2dfc90;})['then'](respondWithFilteredResult(_0x23f374,_0x345140))[_0x5f93('0x48')](handleError(_0x23f374,null));};exports[_0x5f93('0x49')]=function(_0x9294a6,_0x481bbb){var _0x2fde77={'raw':!![],'where':{'id':_0x9294a6[_0x5f93('0x4a')]['id']}},_0x58c4b7={};_0x58c4b7[_0x5f93('0x35')]=_[_0x5f93('0x4b')](db[_0x5f93('0x31')][_0x5f93('0x4c')]);_0x58c4b7[_0x5f93('0x36')]=_[_0x5f93('0x4b')](_0x9294a6[_0x5f93('0x36')]);_0x58c4b7['filters']=_[_0x5f93('0x38')](_0x58c4b7[_0x5f93('0x35')],_0x58c4b7[_0x5f93('0x36')]);_0x2fde77[_0x5f93('0x3a')]=_[_0x5f93('0x38')](_0x58c4b7[_0x5f93('0x35')],qs[_0x5f93('0x39')](_0x9294a6[_0x5f93('0x36')][_0x5f93('0x39')]));_0x2fde77['attributes']=_0x2fde77[_0x5f93('0x3a')][_0x5f93('0x3b')]?_0x2fde77[_0x5f93('0x3a')]:_0x58c4b7[_0x5f93('0x35')];if(_0x9294a6[_0x5f93('0x36')]['includeAll']){_0x2fde77[_0x5f93('0x46')]=[{'all':!![]}];}_0x2fde77=_[_0x5f93('0x43')]({},_0x2fde77,_0x9294a6[_0x5f93('0x44')]);return db['CmHopperBlack'][_0x5f93('0x4d')](_0x2fde77)[_0x5f93('0x29')](handleEntityNotFound(_0x481bbb,null))[_0x5f93('0x29')](respondWithResult(_0x481bbb,null))[_0x5f93('0x48')](handleError(_0x481bbb,null));};exports[_0x5f93('0x28')]=function(_0x4c3478,_0x2e83d0){if(_0x4c3478[_0x5f93('0x4e')]['id']){delete _0x4c3478['body']['id'];}return db[_0x5f93('0x31')][_0x5f93('0x4d')]({'where':{'id':_0x4c3478[_0x5f93('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e83d0,null))[_0x5f93('0x29')](saveUpdates(_0x4c3478[_0x5f93('0x4e')],null))['then'](respondWithResult(_0x2e83d0,null))[_0x5f93('0x48')](handleError(_0x2e83d0,null));};exports[_0x5f93('0x2a')]=function(_0x559fb8,_0x22dea7){return db[_0x5f93('0x31')]['find']({'where':{'id':_0x559fb8['params']['id']}})[_0x5f93('0x29')](handleEntityNotFound(_0x22dea7,null))[_0x5f93('0x29')](removeEntity(_0x22dea7,null))[_0x5f93('0x48')](handleError(_0x22dea7,null));};exports['describe']=function(_0x4325d4,_0x512d04){return db[_0x5f93('0x31')][_0x5f93('0x4f')]()[_0x5f93('0x29')](respondWithResult(_0x512d04,null))[_0x5f93('0x48')](handleError(_0x512d04,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 4239ad9..dffe155 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 _0xec22=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','path','rimraf','./cmHopperBlack.attributes','exports','define'];(function(_0x3633be,_0x190e56){var _0x45326d=function(_0x49e1c6){while(--_0x49e1c6){_0x3633be['push'](_0x3633be['shift']());}};_0x45326d(++_0x190e56);}(_0xec22,0x136));var _0x2ec2=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xec22[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x2ec2('0x0'));var logger=require(_0x2ec2('0x1'))(_0x2ec2('0x2'));var moment=require(_0x2ec2('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ec2('0x4'));var rimraf=require(_0x2ec2('0x5'));var config=require('../../config/environment');var attributes=require(_0x2ec2('0x6'));module[_0x2ec2('0x7')]=function(_0x232ee4,_0x5631dc){return _0x232ee4[_0x2ec2('0x8')](_0x2ec2('0x9'),attributes,{'tableName':_0x2ec2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x221b=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','CmHopperBlack','lodash'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x221b,0x135));var _0xb221=function(_0x4fec05,_0x45512d){_0x4fec05=_0x4fec05-0x0;var _0x11176e=_0x221b[_0x4fec05];return _0x11176e;};'use strict';var _=require(_0xb221('0x0'));var util=require(_0xb221('0x1'));var logger=require(_0xb221('0x2'))('api');var moment=require(_0xb221('0x3'));var BPromise=require(_0xb221('0x4'));var rp=require(_0xb221('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb221('0x6'));var config=require(_0xb221('0x7'));var attributes=require(_0xb221('0x8'));module['exports']=function(_0x90fbc2,_0x5ed5b0){return _0x90fbc2['define'](_0xb221('0x9'),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 22df5bc..1c85e83 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 _0xd3bb=['jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CmHopperBlack','findAll','options','where','attributes','limit','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0xd3bb,0xb1));var _0xbd3b=function(_0x86e4e5,_0x54dc3f){_0x86e4e5=_0x86e4e5-0x0;var _0x236ca7=_0xd3bb[_0x86e4e5];return _0x236ca7;};'use strict';var _=require('lodash');var util=require(_0xbd3b('0x0'));var moment=require(_0xbd3b('0x1'));var BPromise=require(_0xbd3b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd3b('0x3'));var db=require(_0xbd3b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd3b('0x5'))(_0xbd3b('0x6'));var config=require(_0xbd3b('0x7'));var jayson=require(_0xbd3b('0x8'));var client=jayson['client'][_0xbd3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e9b6e,_0x47c9cb,_0x15c54e){return new BPromise(function(_0x58d2a8,_0xd6d00d){return client[_0xbd3b('0xa')](_0x1e9b6e,_0x15c54e)[_0xbd3b('0xb')](function(_0x4672cd){logger[_0xbd3b('0xc')](_0xbd3b('0xd'),_0x47c9cb,_0xbd3b('0xe'));logger[_0xbd3b('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x47c9cb,_0xbd3b('0xe'),JSON[_0xbd3b('0x10')](_0x4672cd));if(_0x4672cd[_0xbd3b('0x11')]){if(_0x4672cd[_0xbd3b('0x11')][_0xbd3b('0x12')]===0x1f4){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x47c9cb,_0x4672cd['error']['message']);return _0xd6d00d(_0x4672cd[_0xbd3b('0x11')][_0xbd3b('0x13')]);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x47c9cb,_0x4672cd[_0xbd3b('0x11')][_0xbd3b('0x13')]);return _0x58d2a8(_0x4672cd['error']['message']);}else{logger[_0xbd3b('0xc')](_0xbd3b('0xd'),_0x47c9cb,_0xbd3b('0xe'));_0x58d2a8(_0x4672cd[_0xbd3b('0x14')]['message']);}})[_0xbd3b('0x15')](function(_0x17c0f2){logger['error'](_0xbd3b('0xd'),_0x47c9cb,_0x17c0f2);_0xd6d00d(_0x17c0f2);});});}exports['GetCmHopperBlack']=function(_0x480045){var _0x3a080a=this;return new Promise(function(_0x5f0a8b,_0x5bfd2a){return db[_0xbd3b('0x16')][_0xbd3b('0x17')]({'raw':_0x480045['options']?_0x480045[_0xbd3b('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x480045['options']?_0x480045[_0xbd3b('0x18')][_0xbd3b('0x19')]||null:null,'attributes':_0x480045[_0xbd3b('0x18')]?_0x480045[_0xbd3b('0x18')][_0xbd3b('0x1a')]||null:null,'limit':_0x480045[_0xbd3b('0x18')]?_0x480045['options'][_0xbd3b('0x1b')]||null:null,'include':_0x480045[_0xbd3b('0x18')]?_0x480045[_0xbd3b('0x18')][_0xbd3b('0x1c')]?_[_0xbd3b('0x1d')](_0x480045[_0xbd3b('0x18')][_0xbd3b('0x1c')],function(_0x4d1078){return{'model':db[_0x4d1078[_0xbd3b('0x1e')]],'as':_0x4d1078['as'],'attributes':_0x4d1078[_0xbd3b('0x1a')],'include':_0x4d1078[_0xbd3b('0x1c')]?_['map'](_0x4d1078[_0xbd3b('0x1c')],function(_0x41db8e){return{'model':db[_0x41db8e[_0xbd3b('0x1e')]],'as':_0x41db8e['as'],'attributes':_0x41db8e[_0xbd3b('0x1a')],'include':_0x41db8e[_0xbd3b('0x1c')]?_[_0xbd3b('0x1d')](_0x41db8e[_0xbd3b('0x1c')],function(_0x26a195){return{'model':db[_0x26a195['model']],'as':_0x26a195['as'],'attributes':_0x26a195[_0xbd3b('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbd3b('0xb')](function(_0x452ecc){logger['info']('GetCmHopperBlack',_0x480045);logger['debug'](_0xbd3b('0x1f'),_0x480045,JSON[_0xbd3b('0x10')](_0x452ecc));_0x5f0a8b(_0x452ecc);})[_0xbd3b('0x15')](function(_0x50dc79){logger['error'](_0xbd3b('0x1f'),_0x50dc79[_0xbd3b('0x13')],_0x480045);_0x5bfd2a(_0x3a080a['error'](0x1f4,_0x50dc79[_0xbd3b('0x13')]));});});};exports[_0xbd3b('0x20')]=function(_0x5dbc85){var _0x293bf6=this;return new Promise(function(_0x531a80,_0x3f9e2d){return db[_0xbd3b('0x16')][_0xbd3b('0x21')](_0x5dbc85['body'],{'raw':_0x5dbc85['options']?_0x5dbc85[_0xbd3b('0x18')][_0xbd3b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5dbc85[_0xbd3b('0x18')]?_0x5dbc85[_0xbd3b('0x18')][_0xbd3b('0x19')]||null:null,'attributes':_0x5dbc85[_0xbd3b('0x18')]?_0x5dbc85[_0xbd3b('0x18')][_0xbd3b('0x1a')]||null:null,'limit':_0x5dbc85[_0xbd3b('0x18')]?_0x5dbc85[_0xbd3b('0x18')]['limit']||null:null})['then'](function(_0xaffffa){logger[_0xbd3b('0xc')](_0xbd3b('0x20'),_0x5dbc85);logger['debug']('UpdateCmHopperBlack',_0x5dbc85,JSON[_0xbd3b('0x10')](_0xaffffa));_0x531a80(_0xaffffa);})[_0xbd3b('0x15')](function(_0x164681){logger[_0xbd3b('0x11')](_0xbd3b('0x20'),_0x164681[_0xbd3b('0x13')],_0x5dbc85);_0x3f9e2d(_0x293bf6[_0xbd3b('0x11')](0x1f4,_0x164681[_0xbd3b('0x13')]));});});};exports[_0xbd3b('0x23')]=function(_0x52dd22){var _0xe11a37=this;return new Promise(function(_0x4bd551,_0x59276f){return db[_0xbd3b('0x16')][_0xbd3b('0x24')]({'where':_0x52dd22['options']?_0x52dd22[_0xbd3b('0x18')][_0xbd3b('0x19')]||null:null})['then'](function(_0x538204){logger[_0xbd3b('0xc')](_0xbd3b('0x23'),_0x52dd22);logger[_0xbd3b('0xf')](_0xbd3b('0x23'),_0x52dd22,JSON[_0xbd3b('0x10')](_0x538204));_0x4bd551(_0x538204);})[_0xbd3b('0x15')](function(_0x469da3){logger[_0xbd3b('0x11')](_0xbd3b('0x23'),_0x469da3[_0xbd3b('0x13')],_0x52dd22);_0x59276f(_0xe11a37[_0xbd3b('0x11')](0x1f4,_0x469da3[_0xbd3b('0x13')]));});});}; \ No newline at end of file +var _0xf10a=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','where','attributes','limit','include','model','map','update','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis'];(function(_0x115048,_0x4d391f){var _0x242b70=function(_0x3f4a60){while(--_0x3f4a60){_0x115048['push'](_0x115048['shift']());}};_0x242b70(++_0x4d391f);}(_0xf10a,0x177));var _0xaf10=function(_0x3cea78,_0x4a6751){_0x3cea78=_0x3cea78-0x0;var _0x33b66b=_0xf10a[_0x3cea78];return _0x33b66b;};'use strict';var _=require(_0xaf10('0x0'));var util=require(_0xaf10('0x1'));var moment=require('moment');var BPromise=require(_0xaf10('0x2'));var rs=require(_0xaf10('0x3'));var fs=require('fs');var Redis=require(_0xaf10('0x4'));var db=require(_0xaf10('0x5'))['db'];var utils=require(_0xaf10('0x6'));var logger=require(_0xaf10('0x7'))('rpc');var config=require(_0xaf10('0x8'));var jayson=require(_0xaf10('0x9'));var client=jayson[_0xaf10('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f02f3,_0x9bcff3,_0x1484fa){return new BPromise(function(_0x2d2c7c,_0x4e27e1){return client[_0xaf10('0xb')](_0x5f02f3,_0x1484fa)[_0xaf10('0xc')](function(_0x596446){logger[_0xaf10('0xd')](_0xaf10('0xe'),_0x9bcff3,_0xaf10('0xf'));logger[_0xaf10('0x10')](_0xaf10('0x11'),_0x9bcff3,_0xaf10('0xf'),JSON[_0xaf10('0x12')](_0x596446));if(_0x596446[_0xaf10('0x13')]){if(_0x596446[_0xaf10('0x13')][_0xaf10('0x14')]===0x1f4){logger[_0xaf10('0x13')](_0xaf10('0xe'),_0x9bcff3,_0x596446['error'][_0xaf10('0x15')]);return _0x4e27e1(_0x596446[_0xaf10('0x13')][_0xaf10('0x15')]);}logger[_0xaf10('0x13')](_0xaf10('0xe'),_0x9bcff3,_0x596446[_0xaf10('0x13')][_0xaf10('0x15')]);return _0x2d2c7c(_0x596446[_0xaf10('0x13')]['message']);}else{logger[_0xaf10('0xd')](_0xaf10('0xe'),_0x9bcff3,_0xaf10('0xf'));_0x2d2c7c(_0x596446[_0xaf10('0x16')][_0xaf10('0x15')]);}})[_0xaf10('0x17')](function(_0x5f45a5){logger[_0xaf10('0x13')](_0xaf10('0xe'),_0x9bcff3,_0x5f45a5);_0x4e27e1(_0x5f45a5);});});}exports[_0xaf10('0x18')]=function(_0x484059){var _0x4cdac9=this;return new Promise(function(_0x28b2ef,_0x35f746){return db[_0xaf10('0x19')][_0xaf10('0x1a')]({'raw':_0x484059[_0xaf10('0x1b')]?_0x484059[_0xaf10('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x484059[_0xaf10('0x1b')]?_0x484059[_0xaf10('0x1b')][_0xaf10('0x1c')]||null:null,'attributes':_0x484059[_0xaf10('0x1b')]?_0x484059['options'][_0xaf10('0x1d')]||null:null,'limit':_0x484059[_0xaf10('0x1b')]?_0x484059[_0xaf10('0x1b')][_0xaf10('0x1e')]||null:null,'include':_0x484059['options']?_0x484059[_0xaf10('0x1b')][_0xaf10('0x1f')]?_['map'](_0x484059[_0xaf10('0x1b')]['include'],function(_0xa7c446){return{'model':db[_0xa7c446[_0xaf10('0x20')]],'as':_0xa7c446['as'],'attributes':_0xa7c446[_0xaf10('0x1d')],'include':_0xa7c446[_0xaf10('0x1f')]?_[_0xaf10('0x21')](_0xa7c446['include'],function(_0xd11f95){return{'model':db[_0xd11f95[_0xaf10('0x20')]],'as':_0xd11f95['as'],'attributes':_0xd11f95[_0xaf10('0x1d')],'include':_0xd11f95[_0xaf10('0x1f')]?_['map'](_0xd11f95[_0xaf10('0x1f')],function(_0x3c3441){return{'model':db[_0x3c3441['model']],'as':_0x3c3441['as'],'attributes':_0x3c3441['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf10('0xc')](function(_0x22242f){logger['info'](_0xaf10('0x18'),_0x484059);logger['debug'](_0xaf10('0x18'),_0x484059,JSON['stringify'](_0x22242f));_0x28b2ef(_0x22242f);})[_0xaf10('0x17')](function(_0x372d11){logger[_0xaf10('0x13')](_0xaf10('0x18'),_0x372d11['message'],_0x484059);_0x35f746(_0x4cdac9[_0xaf10('0x13')](0x1f4,_0x372d11[_0xaf10('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x2ba145){var _0xbbd52f=this;return new Promise(function(_0x5344d6,_0x5b280e){return db[_0xaf10('0x19')][_0xaf10('0x22')](_0x2ba145['body'],{'raw':_0x2ba145[_0xaf10('0x1b')]?_0x2ba145[_0xaf10('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba145['options']?_0x2ba145['options'][_0xaf10('0x1c')]||null:null,'attributes':_0x2ba145[_0xaf10('0x1b')]?_0x2ba145[_0xaf10('0x1b')][_0xaf10('0x1d')]||null:null,'limit':_0x2ba145[_0xaf10('0x1b')]?_0x2ba145[_0xaf10('0x1b')][_0xaf10('0x1e')]||null:null})[_0xaf10('0xc')](function(_0x4bd71f){logger[_0xaf10('0xd')]('UpdateCmHopperBlack',_0x2ba145);logger[_0xaf10('0x10')]('UpdateCmHopperBlack',_0x2ba145,JSON[_0xaf10('0x12')](_0x4bd71f));_0x5344d6(_0x4bd71f);})['catch'](function(_0x537171){logger['error'](_0xaf10('0x23'),_0x537171['message'],_0x2ba145);_0x5b280e(_0xbbd52f[_0xaf10('0x13')](0x1f4,_0x537171[_0xaf10('0x15')]));});});};exports[_0xaf10('0x24')]=function(_0x3e83c1){var _0x4f921f=this;return new Promise(function(_0x41a992,_0x2cedf8){return db[_0xaf10('0x19')][_0xaf10('0x25')]({'where':_0x3e83c1[_0xaf10('0x1b')]?_0x3e83c1[_0xaf10('0x1b')][_0xaf10('0x1c')]||null:null})[_0xaf10('0xc')](function(_0x59a77b){logger['info'](_0xaf10('0x24'),_0x3e83c1);logger[_0xaf10('0x10')]('DestroyCmHopperBlack',_0x3e83c1,JSON['stringify'](_0x59a77b));_0x41a992(_0x59a77b);})[_0xaf10('0x17')](function(_0x334081){logger[_0xaf10('0x13')](_0xaf10('0x24'),_0x334081['message'],_0x3e83c1);_0x2cedf8(_0x4f921f[_0xaf10('0x13')](0x1f4,_0x334081[_0xaf10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 21d8a3b..244de09 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 _0xd101=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xd101,0xc1));var _0x1d10=function(_0x1a4ab2,_0x4a641b){_0x1a4ab2=_0x1a4ab2-0x0;var _0x1576ef=_0xd101[_0x1a4ab2];return _0x1576ef;};'use strict';var multer=require(_0x1d10('0x0'));var util=require('util');var path=require(_0x1d10('0x1'));var timeout=require(_0x1d10('0x2'));var express=require(_0x1d10('0x3'));var router=express[_0x1d10('0x4')]();var fs_extra=require(_0x1d10('0x5'));var auth=require(_0x1d10('0x6'));var interaction=require(_0x1d10('0x7'));var config=require(_0x1d10('0x8'));var controller=require('./cmHopperBlack.controller');router[_0x1d10('0x9')]('/',auth[_0x1d10('0xa')](),controller[_0x1d10('0xb')]);router[_0x1d10('0x9')](_0x1d10('0xc'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xd')]);router[_0x1d10('0x9')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0xf')]);router[_0x1d10('0x10')](_0x1d10('0xe'),auth[_0x1d10('0xa')](),controller[_0x1d10('0x11')]);router[_0x1d10('0x12')](_0x1d10('0xe'),auth['isAuthenticated'](),controller[_0x1d10('0x13')]);module[_0x1d10('0x14')]=router; \ No newline at end of file +var _0xc6ac=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x4fdfae,_0x3b784c){_0x4fdfae=_0x4fdfae-0x0;var _0x464520=_0xc6ac[_0x4fdfae];return _0x464520;};'use strict';var multer=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var path=require(_0xcc6a('0x2'));var timeout=require(_0xcc6a('0x3'));var express=require(_0xcc6a('0x4'));var router=express[_0xcc6a('0x5')]();var fs_extra=require(_0xcc6a('0x6'));var auth=require(_0xcc6a('0x7'));var interaction=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var controller=require(_0xcc6a('0xa'));router[_0xcc6a('0xb')]('/',auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router['get'](_0xcc6a('0xe'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router['get'](_0xcc6a('0x10'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0x11')]);router[_0xcc6a('0x12')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x13')]);router[_0xcc6a('0x14')](_0xcc6a('0x10'),auth['isAuthenticated'](),controller[_0xcc6a('0x15')]);module[_0xcc6a('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 79a22fc..30ba6f9 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 _0x2e16=['setDataValue','followuptime','BOOLEAN','sequelize','exports','INTEGER','DATE','STRING','endtime'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2e16,0x198));var _0x62e1=function(_0x4e107a,_0x229ebc){_0x4e107a=_0x4e107a-0x0;var _0x5774f1=_0x2e16[_0x4e107a];return _0x5774f1;};'use strict';var Sequelize=require(_0x62e1('0x0'));var moment=require('moment');module[_0x62e1('0x1')]={'state':{'type':Sequelize[_0x62e1('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x62e1('0x3')]},'countbusyretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x62e1('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x62e1('0x4')]},'originatecalleridname':{'type':Sequelize[_0x62e1('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x62e1('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x62e1('0x3')]},'answertime':{'type':Sequelize[_0x62e1('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x62e1('0x3')]},'ringtime':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x62e1('0x4')]},'campaigntype':{'type':Sequelize[_0x62e1('0x4')]},'membername':{'type':Sequelize[_0x62e1('0x4')]},'reason':{'type':Sequelize[_0x62e1('0x4')]},'disposition':{'type':Sequelize[_0x62e1('0x4')]},'secondDisposition':{'type':Sequelize[_0x62e1('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x587716){var _0x2547f3=this['getDataValue'](_0x62e1('0x5'));if(_0x2547f3&&_0x587716){this[_0x62e1('0x6')](_0x62e1('0x7'),moment(_0x587716)['diff'](moment(_0x2547f3),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x62e1('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x62e1('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x62e1('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x62e1('0x3')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x62e1('0x3')]},'recallme':{'type':Sequelize[_0x62e1('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x62e1('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x62e1('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8800=['INTEGER','STRING','DATE','endtime','setDataValue','diff','seconds','BOOLEAN','moment','exports'];(function(_0x249c85,_0x2bb238){var _0x211ab7=function(_0x437023){while(--_0x437023){_0x249c85['push'](_0x249c85['shift']());}};_0x211ab7(++_0x2bb238);}(_0x8800,0x94));var _0x0880=function(_0x4a1d25,_0x10e625){_0x4a1d25=_0x4a1d25-0x0;var _0x4b68ee=_0x8800[_0x4a1d25];return _0x4b68ee;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0880('0x0'));module[_0x0880('0x1')]={'state':{'type':Sequelize[_0x0880('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x0880('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x0880('0x3')]},'originatecalleridname':{'type':Sequelize[_0x0880('0x3')]},'calleridnum':{'type':Sequelize[_0x0880('0x3')]},'calleridname':{'type':Sequelize[_0x0880('0x3')]},'starttime':{'type':Sequelize[_0x0880('0x4')]},'responsetime':{'type':Sequelize[_0x0880('0x4')]},'answertime':{'type':Sequelize[_0x0880('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x0880('0x3')]},'campaigntype':{'type':Sequelize[_0x0880('0x3')]},'membername':{'type':Sequelize[_0x0880('0x3')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x0880('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x0880('0x3')]},'dispositionat':{'type':Sequelize[_0x0880('0x4')],'set':function(_0x11be19){var _0x37518f=this['getDataValue'](_0x0880('0x5'));if(_0x37518f&&_0x11be19){this[_0x0880('0x6')]('followuptime',moment(_0x11be19)[_0x0880('0x7')](moment(_0x37518f),_0x0880('0x8')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x0880('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x0880('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x0880('0x4')]},'callback':{'type':Sequelize[_0x0880('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0880('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0880('0x4')]},'deleted':{'type':Sequelize[_0x0880('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x0880('0x4')]},'recallme':{'type':Sequelize[_0x0880('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x0880('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x0880('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 572b96e..e790abf 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 _0xd117=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','CmHopperFinal','fieldName','type','map','keys','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','findAll','rows','catch','show','params','rawAttributes','includeAll','find','describe','update','body','uniqueid','countContactsQueueCampaignHopperFinal','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','insert','CampaignId','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format'];(function(_0x1c1f31,_0x57bce4){var _0x12f677=function(_0x2dcdda){while(--_0x2dcdda){_0x1c1f31['push'](_0x1c1f31['shift']());}};_0x12f677(++_0x57bce4);}(_0xd117,0x182));var _0x7d11=function(_0x29bf80,_0x4af855){_0x29bf80=_0x29bf80-0x0;var _0x932096=_0xd117[_0x29bf80];return _0x932096;};'use strict';var emlformat=require(_0x7d11('0x0'));var rimraf=require(_0x7d11('0x1'));var zipdir=require(_0x7d11('0x2'));var jsonpatch=require(_0x7d11('0x3'));var rp=require(_0x7d11('0x4'));var moment=require(_0x7d11('0x5'));var BPromise=require(_0x7d11('0x6'));var Mustache=require(_0x7d11('0x7'));var util=require(_0x7d11('0x8'));var path=require(_0x7d11('0x9'));var sox=require(_0x7d11('0xa'));var csv=require(_0x7d11('0xb'));var ejs=require(_0x7d11('0xc'));var fs=require('fs');var fs_extra=require(_0x7d11('0xd'));var _=require(_0x7d11('0xe'));var squel=require(_0x7d11('0xf'));var crypto=require('crypto');var jsforce=require(_0x7d11('0x10'));var deskjs=require(_0x7d11('0x11'));var toCsv=require(_0x7d11('0xb'));var querystring=require('querystring');var Papa=require(_0x7d11('0x12'));var Redis=require(_0x7d11('0x13'));var authService=require(_0x7d11('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7d11('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7d11('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7d11('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4767d5,_0x471f46){_0x471f46=_0x471f46||0xcc;return function(_0x5ee572){if(_0x5ee572){return _0x4767d5[_0x7d11('0x18')](_0x471f46);}return _0x4767d5[_0x7d11('0x19')](_0x471f46)['end']();};}function respondWithResult(_0x324de5,_0x16949d){_0x16949d=_0x16949d||0xc8;return function(_0x20a2df){if(_0x20a2df){return _0x324de5[_0x7d11('0x19')](_0x16949d)[_0x7d11('0x1a')](_0x20a2df);}};}function respondWithFilteredResult(_0xeae744,_0x2a269e){return function(_0xb1669e){if(_0xb1669e){var _0x4aa795=typeof _0x2a269e[_0x7d11('0x1b')]===_0x7d11('0x1c')&&typeof _0x2a269e[_0x7d11('0x1d')]===_0x7d11('0x1c');var _0x45f916=_0xb1669e['count'];var _0x456cb9=_0x4aa795?0x0:_0x2a269e[_0x7d11('0x1b')];var _0x4d1306=_0x4aa795?_0xb1669e['count']:_0x2a269e[_0x7d11('0x1b')]+_0x2a269e['limit'];var _0x1f9990;if(_0x4d1306>=_0x45f916){_0x4d1306=_0x45f916;_0x1f9990=0xc8;}else{_0x1f9990=0xce;}_0xeae744['status'](_0x1f9990);return _0xeae744[_0x7d11('0x1e')](_0x7d11('0x1f'),_0x456cb9+'-'+_0x4d1306+'/'+_0x45f916)[_0x7d11('0x1a')](_0xb1669e);}return null;};}function patchUpdates(_0x46f662){return function(_0x30df70){try{jsonpatch[_0x7d11('0x20')](_0x30df70,_0x46f662,!![]);}catch(_0x4297f8){return BPromise[_0x7d11('0x21')](_0x4297f8);}return _0x30df70['save']();};}function saveUpdates(_0x441917,_0x4a34f4){return function(_0x58455b){if(_0x58455b){return _0x58455b['update'](_0x441917)[_0x7d11('0x22')](function(_0x3545dc){return _0x3545dc;});}return null;};}function removeEntity(_0x44476c,_0x1a7853){return function(_0x355d14){if(_0x355d14){return _0x355d14[_0x7d11('0x23')]()[_0x7d11('0x22')](function(){_0x44476c[_0x7d11('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36c2b4,_0x577ca9){return function(_0x4bfa76){if(!_0x4bfa76){_0x36c2b4['sendStatus'](0x194);}return _0x4bfa76;};}function handleError(_0x3ba092,_0x59cdba){_0x59cdba=_0x59cdba||0x1f4;return function(_0x180e1e){logger[_0x7d11('0x24')](_0x180e1e[_0x7d11('0x25')]);if(_0x180e1e['name']){delete _0x180e1e[_0x7d11('0x26')];}_0x3ba092[_0x7d11('0x19')](_0x59cdba)[_0x7d11('0x27')](_0x180e1e);};}exports['index']=function(_0x601650,_0x35a789){var _0x18c049={},_0x38f1be={},_0x4c7d6a={'count':0x0,'rows':[]};var _0x1a7745=_['map'](db[_0x7d11('0x28')]['rawAttributes'],function(_0x31866d){return{'name':_0x31866d[_0x7d11('0x29')],'type':_0x31866d[_0x7d11('0x2a')]['key']};});_0x38f1be['model']=_[_0x7d11('0x2b')](_0x1a7745,_0x7d11('0x26'));_0x38f1be['query']=_[_0x7d11('0x2c')](_0x601650[_0x7d11('0x2d')]);_0x38f1be[_0x7d11('0x2e')]=_['intersection'](_0x38f1be[_0x7d11('0x2f')],_0x38f1be['query']);_0x18c049['attributes']=_[_0x7d11('0x30')](_0x38f1be['model'],qs[_0x7d11('0x31')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x31')]));_0x18c049[_0x7d11('0x32')]=_0x18c049['attributes'][_0x7d11('0x33')]?_0x18c049[_0x7d11('0x32')]:_0x38f1be['model'];if(!_0x601650['query'][_0x7d11('0x34')](_0x7d11('0x35'))){_0x18c049['limit']=qs[_0x7d11('0x1d')](_0x601650['query']['limit']);_0x18c049[_0x7d11('0x1b')]=qs['offset'](_0x601650['query'][_0x7d11('0x1b')]);}_0x18c049[_0x7d11('0x36')]=qs[_0x7d11('0x37')](_0x601650[_0x7d11('0x2d')][_0x7d11('0x37')]);_0x18c049[_0x7d11('0x38')]=qs[_0x7d11('0x2e')](_[_0x7d11('0x39')](_0x601650[_0x7d11('0x2d')],_0x38f1be[_0x7d11('0x2e')]),_0x1a7745);if(_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]){_0x18c049['where']=_[_0x7d11('0x3b')](_0x18c049['where'],{'$or':_[_0x7d11('0x2b')](_0x1a7745,function(_0x111e26){if(_0x111e26[_0x7d11('0x2a')]!==_0x7d11('0x3c')){var _0x4f8fd2={};_0x4f8fd2[_0x111e26[_0x7d11('0x26')]]={'$like':'%'+_0x601650[_0x7d11('0x2d')][_0x7d11('0x3a')]+'%'};return _0x4f8fd2;}})});}_0x18c049=_[_0x7d11('0x3b')]({},_0x18c049,_0x601650['options']);var _0x22730e={'where':_0x18c049['where']};return db[_0x7d11('0x28')]['count'](_0x22730e)[_0x7d11('0x22')](function(_0x622725){_0x4c7d6a[_0x7d11('0x3d')]=_0x622725;if(_0x601650[_0x7d11('0x2d')]['includeAll']){_0x18c049['include']=[{'all':!![]}];}return db[_0x7d11('0x28')][_0x7d11('0x3e')](_0x18c049);})['then'](function(_0x1caef9){_0x4c7d6a[_0x7d11('0x3f')]=_0x1caef9;return _0x4c7d6a;})[_0x7d11('0x22')](respondWithFilteredResult(_0x35a789,_0x18c049))[_0x7d11('0x40')](handleError(_0x35a789,null));};exports[_0x7d11('0x41')]=function(_0x2e1647,_0x47e968){var _0x25b73b={'raw':!![],'where':{'id':_0x2e1647[_0x7d11('0x42')]['id']}},_0x5cf6a6={};_0x5cf6a6[_0x7d11('0x2f')]=_[_0x7d11('0x2c')](db[_0x7d11('0x28')][_0x7d11('0x43')]);_0x5cf6a6[_0x7d11('0x2d')]=_['keys'](_0x2e1647['query']);_0x5cf6a6['filters']=_[_0x7d11('0x30')](_0x5cf6a6[_0x7d11('0x2f')],_0x5cf6a6[_0x7d11('0x2d')]);_0x25b73b[_0x7d11('0x32')]=_[_0x7d11('0x30')](_0x5cf6a6['model'],qs[_0x7d11('0x31')](_0x2e1647[_0x7d11('0x2d')]['fields']));_0x25b73b[_0x7d11('0x32')]=_0x25b73b[_0x7d11('0x32')][_0x7d11('0x33')]?_0x25b73b['attributes']:_0x5cf6a6[_0x7d11('0x2f')];if(_0x2e1647[_0x7d11('0x2d')][_0x7d11('0x44')]){_0x25b73b['include']=[{'all':!![]}];}_0x25b73b=_[_0x7d11('0x3b')]({},_0x25b73b,_0x2e1647['options']);return db[_0x7d11('0x28')][_0x7d11('0x45')](_0x25b73b)[_0x7d11('0x22')](handleEntityNotFound(_0x47e968,null))[_0x7d11('0x22')](respondWithResult(_0x47e968,null))[_0x7d11('0x40')](handleError(_0x47e968,null));};exports[_0x7d11('0x46')]=function(_0x161213,_0x193631){return db[_0x7d11('0x28')]['describe']()['then'](respondWithResult(_0x193631,null))['catch'](handleError(_0x193631,null));};exports[_0x7d11('0x47')]=function(_0x1e5bb5,_0x20297a){if(_0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')]){delete _0x1e5bb5[_0x7d11('0x48')][_0x7d11('0x49')];}return db[_0x7d11('0x28')][_0x7d11('0x45')]({'where':{'uniqueid':_0x1e5bb5[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x20297a,null))[_0x7d11('0x22')](saveUpdates(_0x1e5bb5['body'],null))[_0x7d11('0x22')](respondWithResult(_0x20297a,null))[_0x7d11('0x40')](handleError(_0x20297a,null));};exports[_0x7d11('0x4a')]=function(_0x553a03,_0x503ebc,_0x14db1c){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'VoiceQueueId':_0x553a03['params']['id']},'attributes':[[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x4e')))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')]('`state`\x20=\x205,\x201,\x20null'))),_0x7d11('0x50')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db['sequelize']['literal'](_0x7d11('0x51')))),_0x7d11('0x52')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x57')))),_0x7d11('0x58')],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})['then'](handleEntityNotFound(_0x503ebc,null))[_0x7d11('0x22')](respondWithResult(_0x503ebc,null))['catch'](handleError(_0x503ebc,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x52d62d,_0x32c551,_0x12f05b){return db[_0x7d11('0x28')][_0x7d11('0x3e')]({'raw':![],'where':{'CampaignId':_0x52d62d[_0x7d11('0x42')]['id']},'attributes':[[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db['sequelize'][_0x7d11('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x7d11('0x4f')],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x59')))),'noAnswerContacts'],[db['sequelize']['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x5a')))),'busyContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x51')))),'congestionContacts'],[db[_0x7d11('0x4c')]['fn']('COUNT',db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x53')))),_0x7d11('0x54')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')][_0x7d11('0x4d')](_0x7d11('0x55')))),_0x7d11('0x56')],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db['sequelize']['fn']('IF',db[_0x7d11('0x4c')]['literal'](_0x7d11('0x57')))),'reCallContacts'],[db[_0x7d11('0x4c')]['fn'](_0x7d11('0x4b'),db[_0x7d11('0x4c')]['fn']('IF',db[_0x7d11('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),_0x7d11('0x5b')]]})[_0x7d11('0x22')](handleEntityNotFound(_0x32c551,null))[_0x7d11('0x22')](respondWithResult(_0x32c551,null))['catch'](handleError(_0x32c551,null));};exports[_0x7d11('0x5c')]=function(_0x3c656b,_0x31cb39,_0x1b89de){return db[_0x7d11('0x5d')][_0x7d11('0x45')]({'where':{'id':_0x3c656b['params']['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x31cb39,null))['then'](function(_0x1fd598){var _0x4c88c6;if(_0x1fd598){_0x4c88c6=squel['insert']()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')]([_0x7d11('0x61'),_0x7d11('0x62'),_0x7d11('0x63'),_0x7d11('0x64'),_0x7d11('0x65'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field'](_0x7d11('0x69'),'phone')[_0x7d11('0x6a')](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')]('ANY_VALUE(ListId)','ListId')[_0x7d11('0x6a')](_0x7d11('0x6d'),_0x7d11('0x65'))[_0x7d11('0x6a')](_0x7d11('0x6b'),'createdAt')[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())[_0x7d11('0x38')]('state\x20=\x20?',_0x3c656b['body'][_0x7d11('0x72')][_0x7d11('0x71')]())[_0x7d11('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel['select']()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))['where'](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))[_0x7d11('0x38')](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x74'))['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x70'),_0x3c656b[_0x7d11('0x42')]['id'][_0x7d11('0x71')]())['where'](_0x7d11('0x75')))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db[_0x7d11('0x4c')]['query'](_0x4c88c6);}return[];})['then'](respondWithResult(_0x31cb39,null))['catch'](handleError(_0x31cb39,null));};exports[_0x7d11('0x77')]=function(_0x4c15e9,_0x2a9e92,_0x5459d1){return db['Campaign'][_0x7d11('0x45')]({'where':{'id':_0x4c15e9[_0x7d11('0x42')]['id']}})[_0x7d11('0x22')](handleEntityNotFound(_0x2a9e92,null))[_0x7d11('0x22')](function(_0x345fb3){var _0x32a17a;if(_0x345fb3){_0x32a17a=squel[_0x7d11('0x78')]()[_0x7d11('0x5e')](_0x7d11('0x5f'))[_0x7d11('0x60')](['phone',_0x7d11('0x62'),_0x7d11('0x63'),'ListId',_0x7d11('0x79'),_0x7d11('0x66'),_0x7d11('0x67')],squel[_0x7d11('0x68')]()['field']('ANY_VALUE(calleridnum)',_0x7d11('0x61'))['field'](_0x7d11('0x6b'),_0x7d11('0x62'))[_0x7d11('0x6a')](_0x7d11('0x6c'),_0x7d11('0x63'))[_0x7d11('0x6a')](_0x7d11('0x7a'),'ListId')[_0x7d11('0x6a')](_0x7d11('0x7b'),_0x7d11('0x79'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x66'))[_0x7d11('0x6a')]('NOW()',_0x7d11('0x67'))[_0x7d11('0x6e')](_0x7d11('0x6f'))['where'](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())[_0x7d11('0x38')](_0x7d11('0x7d'),_0x4c15e9['body'][_0x7d11('0x72')]['toString']())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where'](_0x7d11('0x73'),squel[_0x7d11('0x68')]()[_0x7d11('0x6a')](_0x7d11('0x61'))[_0x7d11('0x6e')](_0x7d11('0x5f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id'][_0x7d11('0x71')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x7d11('0x68')]()[_0x7d11('0x6a')]('calleridnum')['from'](_0x7d11('0x6f'))[_0x7d11('0x38')](_0x7d11('0x7c'),_0x4c15e9[_0x7d11('0x42')]['id']['toString']())['where']('state\x20=\x204'))[_0x7d11('0x76')](_0x7d11('0x63')))[_0x7d11('0x71')]();return db['sequelize'][_0x7d11('0x2d')](_0x32a17a);}return[];})[_0x7d11('0x22')](respondWithResult(_0x2a9e92,null))['catch'](handleError(_0x2a9e92,null));};exports[_0x7d11('0x7e')]=function(_0x1cb457,_0x59f0db,_0x5e5faf){return db[_0x7d11('0x7f')][_0x7d11('0x80')]({'where':{'VoiceQueueId':_0x1cb457['body']['VoiceQueueId'],'CampaignId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x79')],'ContactId':_0x1cb457[_0x7d11('0x48')][_0x7d11('0x63')]}})['then'](handleEntityNotFound(_0x59f0db,null))[_0x7d11('0x22')](function(_0x2cfa77){if(_0x2cfa77){return _0x2cfa77;}return null;})[_0x7d11('0x22')](respondWithResult(_0x59f0db,null))[_0x7d11('0x40')](handleError(_0x59f0db,null));}; \ No newline at end of file +var _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','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','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x10ea76,_0x507f0c){var _0x748ae1=function(_0x28b498){while(--_0x28b498){_0x10ea76['push'](_0x10ea76['shift']());}};_0x748ae1(++_0x507f0c);}(_0xadb5,0xad));var _0x5adb=function(_0x468ecd,_0x3a6f3e){_0x468ecd=_0x468ecd-0x0;var _0x4fa6a0=_0xadb5[_0x468ecd];return _0x4fa6a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 86a8266..a2a8f6f 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 _0x4bb7=['bluebird','path','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x34d22d,_0x4aef5b){var _0x30ef06=function(_0x555ba6){while(--_0x555ba6){_0x34d22d['push'](_0x34d22d['shift']());}};_0x30ef06(++_0x4aef5b);}(_0x4bb7,0x1bb));var _0x74bb=function(_0x45cc04,_0x1df248){_0x45cc04=_0x45cc04-0x0;var _0xbae3ea=_0x4bb7[_0x45cc04];return _0xbae3ea;};'use strict';var _=require(_0x74bb('0x0'));var util=require(_0x74bb('0x1'));var logger=require(_0x74bb('0x2'))(_0x74bb('0x3'));var moment=require(_0x74bb('0x4'));var BPromise=require(_0x74bb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74bb('0x6'));var rimraf=require('rimraf');var config=require(_0x74bb('0x7'));var attributes=require(_0x74bb('0x8'));module[_0x74bb('0x9')]=function(_0x21f6b4,_0x19ccfb){return _0x21f6b4['define'](_0x74bb('0xa'),attributes,{'tableName':_0x74bb('0xb'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x74bb('0xc')]},{'name':_0x74bb('0xd'),'fields':[_0x74bb('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1820=['./cmHopperFinal.attributes','exports','cm_hopper_final','calleridnum','uniqueid','util','api','moment','path','rimraf','../../config/environment'];(function(_0x3b452c,_0x5b3a1f){var _0xae75cf=function(_0x4ebf9e){while(--_0x4ebf9e){_0x3b452c['push'](_0x3b452c['shift']());}};_0xae75cf(++_0x5b3a1f);}(_0x1820,0x123));var _0x0182=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x1820[_0x3ff085];return _0x2b68c3;};'use strict';var _=require('lodash');var util=require(_0x0182('0x0'));var logger=require('../../config/logger')(_0x0182('0x1'));var moment=require(_0x0182('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0182('0x3'));var rimraf=require(_0x0182('0x4'));var config=require(_0x0182('0x5'));var attributes=require(_0x0182('0x6'));module[_0x0182('0x7')]=function(_0x5b3c06,_0x3208ef){return _0x5b3c06['define']('CmHopperFinal',attributes,{'tableName':_0x0182('0x8'),'paranoid':![],'indexes':[{'name':_0x0182('0x9'),'fields':[_0x0182('0x9')]},{'name':_0x0182('0xa'),'fields':[_0x0182('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 327748c..5738f4a 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x182c76,_0x17ada5){var _0x1e9c1e=function(_0x339fe5){while(--_0x339fe5){_0x182c76['push'](_0x182c76['shift']());}};_0x1e9c1e(++_0x17ada5);}(_0x7a54,0x106));var _0x47a5=function(_0xfaa5a8,_0xff70f5){_0xfaa5a8=_0xfaa5a8-0x0;var _0x1abb87=_0x7a54[_0xfaa5a8];return _0x1abb87;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x55f3c2,_0x24149d){var _0xf7ff2e=function(_0x1b9274){while(--_0x1b9274){_0x55f3c2['push'](_0x55f3c2['shift']());}};_0xf7ff2e(++_0x24149d);}(_0xb10b,0x12a));var _0xbb10=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xb10b[_0x4d613c];return _0x301fe3;};'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 f274469..3293686 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 _0xe091=['../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3fe149,_0x54f2f0){var _0x9932e2=function(_0x38291a){while(--_0x38291a){_0x3fe149['push'](_0x3fe149['shift']());}};_0x9932e2(++_0x54f2f0);}(_0xe091,0x1ad));var _0x1e09=function(_0x47436d,_0x752fa3){_0x47436d=_0x47436d-0x0;var _0x133770=_0xe091[_0x47436d];return _0x133770;};'use strict';var multer=require(_0x1e09('0x0'));var util=require(_0x1e09('0x1'));var path=require(_0x1e09('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e09('0x3'));var router=express[_0x1e09('0x4')]();var fs_extra=require(_0x1e09('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1e09('0x6'));var config=require(_0x1e09('0x7'));var controller=require(_0x1e09('0x8'));router[_0x1e09('0x9')]('/',auth[_0x1e09('0xa')](),controller[_0x1e09('0xb')]);router[_0x1e09('0x9')](_0x1e09('0xc'),auth['isAuthenticated'](),controller[_0x1e09('0xd')]);router[_0x1e09('0x9')](_0x1e09('0xe'),auth[_0x1e09('0xa')](),controller[_0x1e09('0xf')]);router[_0x1e09('0x9')]('/voice/queue/countAttributes/:id',auth[_0x1e09('0xa')](),controller[_0x1e09('0x10')]);router['get'](_0x1e09('0x11'),auth[_0x1e09('0xa')](),controller[_0x1e09('0x12')]);router['post'](_0x1e09('0x13'),auth['isAuthenticated'](),controller[_0x1e09('0x14')]);router[_0x1e09('0x15')](_0x1e09('0x16'),auth[_0x1e09('0xa')](),controller[_0x1e09('0x17')]);router[_0x1e09('0x15')](_0x1e09('0x18'),auth['isAuthenticated'](),controller[_0x1e09('0x19')]);router[_0x1e09('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x1e09('0x1b')]);module[_0x1e09('0x1c')]=router; \ No newline at end of file +var _0x86a3=['index','get','/describe','isAuthenticated','describe','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x28796c,_0x302f98){var _0x56eb6d=function(_0x275f48){while(--_0x275f48){_0x28796c['push'](_0x28796c['shift']());}};_0x56eb6d(++_0x302f98);}(_0x86a3,0xf6));var _0x386a=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x86a3[_0x46428c];return _0x16a677;};'use strict';var multer=require(_0x386a('0x0'));var util=require(_0x386a('0x1'));var path=require('path');var timeout=require(_0x386a('0x2'));var express=require(_0x386a('0x3'));var router=express['Router']();var fs_extra=require(_0x386a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x386a('0x5'));var config=require(_0x386a('0x6'));var controller=require('./cmHopperFinal.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x386a('0x7')]);router[_0x386a('0x8')](_0x386a('0x9'),auth[_0x386a('0xa')](),controller[_0x386a('0xb')]);router[_0x386a('0x8')]('/:id',auth[_0x386a('0xa')](),controller[_0x386a('0xc')]);router[_0x386a('0x8')]('/voice/queue/countAttributes/:id',auth[_0x386a('0xa')](),controller[_0x386a('0xd')]);router['get'](_0x386a('0xe'),auth[_0x386a('0xa')](),controller[_0x386a('0xf')]);router['post'](_0x386a('0x10'),auth[_0x386a('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router['post'](_0x386a('0x11'),auth[_0x386a('0xa')](),controller[_0x386a('0x12')]);router['post'](_0x386a('0x13'),auth[_0x386a('0xa')](),controller['checkContactHopper']);router[_0x386a('0x14')]('/:id',auth[_0x386a('0xa')](),controller[_0x386a('0x15')]);module[_0x386a('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 606b3d7..fba7519 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 _0xa54c=['STRING','DATE','BOOLEAN','INTEGER'];(function(_0x473ab8,_0x111267){var _0x45fbc5=function(_0x5bc60f){while(--_0x5bc60f){_0x473ab8['push'](_0x473ab8['shift']());}};_0x45fbc5(++_0x111267);}(_0xa54c,0xcf));var _0xca54=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa54c[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xca54('0x0')](0x2)},'statedesc':{'type':Sequelize[_0xca54('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xca54('0x1')]},'originatecalleridnum':{'type':Sequelize[_0xca54('0x1')]},'originatecalleridname':{'type':Sequelize[_0xca54('0x1')]},'calleridnum':{'type':Sequelize[_0xca54('0x1')]},'calleridname':{'type':Sequelize[_0xca54('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xca54('0x2')]},'answertime':{'type':Sequelize[_0xca54('0x2')]},'droptime':{'type':Sequelize[_0xca54('0x2')]},'endtime':{'type':Sequelize[_0xca54('0x2')]},'ringtime':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xca54('0x1')]},'campaign':{'type':Sequelize[_0xca54('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xca54('0x1')]},'reason':{'type':Sequelize[_0xca54('0x1')]},'amd':{'type':Sequelize[_0xca54('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xca54('0x3')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xca54('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xca54('0x2')]},'recallme':{'type':Sequelize[_0xca54('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xca54('0x2')]},'edited':{'type':Sequelize[_0xca54('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xca54('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xca54('0x1')]}}; \ No newline at end of file +var _0x3f2d=['STRING','DATE','BOOLEAN','sequelize','exports','INTEGER'];(function(_0x200b91,_0x2a871c){var _0x184554=function(_0x4a847c){while(--_0x4a847c){_0x200b91['push'](_0x200b91['shift']());}};_0x184554(++_0x2a871c);}(_0x3f2d,0xc3));var _0xd3f2=function(_0x145b1e,_0x3e089c){_0x145b1e=_0x145b1e-0x0;var _0x5db350=_0x3f2d[_0x145b1e];return _0x5db350;};'use strict';var Sequelize=require(_0xd3f2('0x0'));module[_0xd3f2('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xd3f2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd3f2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd3f2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd3f2('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xd3f2('0x3')]},'originatecalleridname':{'type':Sequelize[_0xd3f2('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xd3f2('0x3')]},'starttime':{'type':Sequelize[_0xd3f2('0x4')]},'responsetime':{'type':Sequelize[_0xd3f2('0x4')]},'answertime':{'type':Sequelize[_0xd3f2('0x4')]},'droptime':{'type':Sequelize[_0xd3f2('0x4')]},'endtime':{'type':Sequelize[_0xd3f2('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd3f2('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xd3f2('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xd3f2('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd3f2('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd3f2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd3f2('0x4')]},'recallme':{'type':Sequelize[_0xd3f2('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xd3f2('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd3f2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd3f2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd3f2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd3f2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index c15eb2d..4e1a0dd 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 _0x3e72=['request-promise','moment','bluebird','mustache','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','destroy','then','stack','name','send','map','fieldName','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','CmHopperHistory','includeAll','include','rows','show','params','keys','rawAttributes','intersection','length','find','catch','create','describe','update','body','uniqueid','eml-format','rimraf'];(function(_0x5adde9,_0x1ab2c2){var _0x5509fe=function(_0x293518){while(--_0x293518){_0x5adde9['push'](_0x5adde9['shift']());}};_0x5509fe(++_0x1ab2c2);}(_0x3e72,0x126));var _0x23e7=function(_0x4f3b2d,_0x3bbf46){_0x4f3b2d=_0x4f3b2d-0x0;var _0x3dddfa=_0x3e72[_0x4f3b2d];return _0x3dddfa;};'use strict';var emlformat=require(_0x23e7('0x0'));var rimraf=require(_0x23e7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x23e7('0x2'));var moment=require(_0x23e7('0x3'));var BPromise=require(_0x23e7('0x4'));var Mustache=require(_0x23e7('0x5'));var util=require('util');var path=require(_0x23e7('0x6'));var sox=require(_0x23e7('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x23e7('0x8'));var _=require('lodash');var squel=require(_0x23e7('0x9'));var crypto=require(_0x23e7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x23e7('0xb'));var toCsv=require(_0x23e7('0xc'));var querystring=require(_0x23e7('0xd'));var Papa=require('papaparse');var Redis=require(_0x23e7('0xe'));var authService=require(_0x23e7('0xf'));var qs=require(_0x23e7('0x10'));var as=require(_0x23e7('0x11'));var hardwareService=require(_0x23e7('0x12'));var logger=require(_0x23e7('0x13'))(_0x23e7('0x14'));var utils=require(_0x23e7('0x15'));var config=require(_0x23e7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x23e7('0x17'))['db'];function respondWithStatusCode(_0x5450d3,_0x486c85){_0x486c85=_0x486c85||0xcc;return function(_0x51e516){if(_0x51e516){return _0x5450d3['sendStatus'](_0x486c85);}return _0x5450d3['status'](_0x486c85)['end']();};}function respondWithResult(_0x38817c,_0x3d9f5b){_0x3d9f5b=_0x3d9f5b||0xc8;return function(_0x3308de){if(_0x3308de){return _0x38817c['status'](_0x3d9f5b)[_0x23e7('0x18')](_0x3308de);}};}function respondWithFilteredResult(_0x3c88d5,_0x1fd670){return function(_0x590540){if(_0x590540){var _0x421fc7=typeof _0x1fd670[_0x23e7('0x19')]===_0x23e7('0x1a')&&typeof _0x1fd670[_0x23e7('0x1b')]===_0x23e7('0x1a');var _0x3dd77d=_0x590540[_0x23e7('0x1c')];var _0x1f650d=_0x421fc7?0x0:_0x1fd670[_0x23e7('0x19')];var _0x483d61=_0x421fc7?_0x590540[_0x23e7('0x1c')]:_0x1fd670[_0x23e7('0x19')]+_0x1fd670[_0x23e7('0x1b')];var _0x89318c;if(_0x483d61>=_0x3dd77d){_0x483d61=_0x3dd77d;_0x89318c=0xc8;}else{_0x89318c=0xce;}_0x3c88d5[_0x23e7('0x1d')](_0x89318c);return _0x3c88d5[_0x23e7('0x1e')](_0x23e7('0x1f'),_0x1f650d+'-'+_0x483d61+'/'+_0x3dd77d)[_0x23e7('0x18')](_0x590540);}return null;};}function patchUpdates(_0x52945c){return function(_0x170b08){try{jsonpatch[_0x23e7('0x20')](_0x170b08,_0x52945c,!![]);}catch(_0x5816a1){return BPromise[_0x23e7('0x21')](_0x5816a1);}return _0x170b08['save']();};}function saveUpdates(_0x38cfea,_0x41dc62){return function(_0x4ab5d2){if(_0x4ab5d2){return _0x4ab5d2['update'](_0x38cfea)['then'](function(_0x43d2e3){return _0x43d2e3;});}return null;};}function removeEntity(_0x2e33a7,_0x5098be){return function(_0x3085ad){if(_0x3085ad){return _0x3085ad[_0x23e7('0x22')]()[_0x23e7('0x23')](function(){_0x2e33a7[_0x23e7('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x615f32,_0x2df69a){return function(_0x484fd6){if(!_0x484fd6){_0x615f32['sendStatus'](0x194);}return _0x484fd6;};}function handleError(_0x26dfb6,_0x4daf95){_0x4daf95=_0x4daf95||0x1f4;return function(_0x5560c6){logger['error'](_0x5560c6[_0x23e7('0x24')]);if(_0x5560c6[_0x23e7('0x25')]){delete _0x5560c6[_0x23e7('0x25')];}_0x26dfb6[_0x23e7('0x1d')](_0x4daf95)[_0x23e7('0x26')](_0x5560c6);};}exports['index']=function(_0x3abdec,_0x499b3e){var _0x278f29={},_0x21f33b={},_0x11e2cd={'count':0x0,'rows':[]};var _0x327795=_[_0x23e7('0x27')](db['CmHopperHistory']['rawAttributes'],function(_0x494433){return{'name':_0x494433[_0x23e7('0x28')],'type':_0x494433['type'][_0x23e7('0x29')]};});_0x21f33b[_0x23e7('0x2a')]=_[_0x23e7('0x27')](_0x327795,_0x23e7('0x25'));_0x21f33b[_0x23e7('0x2b')]=_['keys'](_0x3abdec[_0x23e7('0x2b')]);_0x21f33b[_0x23e7('0x2c')]=_['intersection'](_0x21f33b[_0x23e7('0x2a')],_0x21f33b[_0x23e7('0x2b')]);_0x278f29[_0x23e7('0x2d')]=_['intersection'](_0x21f33b[_0x23e7('0x2a')],qs[_0x23e7('0x2e')](_0x3abdec['query'][_0x23e7('0x2e')]));_0x278f29[_0x23e7('0x2d')]=_0x278f29[_0x23e7('0x2d')]['length']?_0x278f29[_0x23e7('0x2d')]:_0x21f33b[_0x23e7('0x2a')];if(!_0x3abdec['query'][_0x23e7('0x2f')](_0x23e7('0x30'))){_0x278f29[_0x23e7('0x1b')]=qs['limit'](_0x3abdec['query'][_0x23e7('0x1b')]);_0x278f29['offset']=qs[_0x23e7('0x19')](_0x3abdec[_0x23e7('0x2b')][_0x23e7('0x19')]);}_0x278f29['order']=qs['sort'](_0x3abdec[_0x23e7('0x2b')][_0x23e7('0x31')]);_0x278f29[_0x23e7('0x32')]=qs[_0x23e7('0x2c')](_[_0x23e7('0x33')](_0x3abdec[_0x23e7('0x2b')],_0x21f33b[_0x23e7('0x2c')]),_0x327795);if(_0x3abdec[_0x23e7('0x2b')][_0x23e7('0x34')]){_0x278f29[_0x23e7('0x32')]=_['merge'](_0x278f29[_0x23e7('0x32')],{'$or':_[_0x23e7('0x27')](_0x327795,function(_0x53fa1b){if(_0x53fa1b[_0x23e7('0x35')]!==_0x23e7('0x36')){var _0x9a76f3={};_0x9a76f3[_0x53fa1b[_0x23e7('0x25')]]={'$like':'%'+_0x3abdec[_0x23e7('0x2b')][_0x23e7('0x34')]+'%'};return _0x9a76f3;}})});}_0x278f29=_[_0x23e7('0x37')]({},_0x278f29,_0x3abdec[_0x23e7('0x38')]);var _0x52f33a={'where':_0x278f29[_0x23e7('0x32')]};return db[_0x23e7('0x39')][_0x23e7('0x1c')](_0x52f33a)[_0x23e7('0x23')](function(_0x4dfb3e){_0x11e2cd['count']=_0x4dfb3e;if(_0x3abdec['query'][_0x23e7('0x3a')]){_0x278f29[_0x23e7('0x3b')]=[{'all':!![]}];}return db[_0x23e7('0x39')]['findAll'](_0x278f29);})[_0x23e7('0x23')](function(_0x18af91){_0x11e2cd[_0x23e7('0x3c')]=_0x18af91;return _0x11e2cd;})[_0x23e7('0x23')](respondWithFilteredResult(_0x499b3e,_0x278f29))['catch'](handleError(_0x499b3e,null));};exports[_0x23e7('0x3d')]=function(_0xf65493,_0x58cd77){var _0x195123={'raw':!![],'where':{'id':_0xf65493[_0x23e7('0x3e')]['id']}},_0x519c16={};_0x519c16[_0x23e7('0x2a')]=_[_0x23e7('0x3f')](db['CmHopperHistory'][_0x23e7('0x40')]);_0x519c16[_0x23e7('0x2b')]=_[_0x23e7('0x3f')](_0xf65493[_0x23e7('0x2b')]);_0x519c16[_0x23e7('0x2c')]=_['intersection'](_0x519c16[_0x23e7('0x2a')],_0x519c16[_0x23e7('0x2b')]);_0x195123[_0x23e7('0x2d')]=_[_0x23e7('0x41')](_0x519c16['model'],qs[_0x23e7('0x2e')](_0xf65493[_0x23e7('0x2b')][_0x23e7('0x2e')]));_0x195123[_0x23e7('0x2d')]=_0x195123[_0x23e7('0x2d')][_0x23e7('0x42')]?_0x195123['attributes']:_0x519c16[_0x23e7('0x2a')];if(_0xf65493[_0x23e7('0x2b')]['includeAll']){_0x195123[_0x23e7('0x3b')]=[{'all':!![]}];}_0x195123=_[_0x23e7('0x37')]({},_0x195123,_0xf65493['options']);return db['CmHopperHistory'][_0x23e7('0x43')](_0x195123)['then'](handleEntityNotFound(_0x58cd77,null))[_0x23e7('0x23')](respondWithResult(_0x58cd77,null))[_0x23e7('0x44')](handleError(_0x58cd77,null));};exports[_0x23e7('0x45')]=function(_0xdb7f52,_0x1ff9f7){return db[_0x23e7('0x39')]['create'](_0xdb7f52['body'],{})[_0x23e7('0x23')](respondWithResult(_0x1ff9f7,0xc9))[_0x23e7('0x44')](handleError(_0x1ff9f7,null));};exports[_0x23e7('0x46')]=function(_0x5b38f2,_0x2b563e){return db[_0x23e7('0x39')]['describe']()[_0x23e7('0x23')](respondWithResult(_0x2b563e,null))[_0x23e7('0x44')](handleError(_0x2b563e,null));};exports[_0x23e7('0x47')]=function(_0x338f81,_0x558864){if(_0x338f81[_0x23e7('0x48')][_0x23e7('0x49')]){delete _0x338f81[_0x23e7('0x48')][_0x23e7('0x49')];}return db[_0x23e7('0x39')][_0x23e7('0x43')]({'where':{'uniqueid':_0x338f81['params']['id']}})['then'](handleEntityNotFound(_0x558864,null))['then'](saveUpdates(_0x338f81[_0x23e7('0x48')],null))[_0x23e7('0x23')](respondWithResult(_0x558864,null))[_0x23e7('0x44')](handleError(_0x558864,null));}; \ No newline at end of file +var _0x0905=['body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','then','sendStatus','error','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','find','create'];(function(_0x53fb70,_0x11937a){var _0x9c753f=function(_0x2c3a05){while(--_0x2c3a05){_0x53fb70['push'](_0x53fb70['shift']());}};_0x9c753f(++_0x11937a);}(_0x0905,0x1d2));var _0x5090=function(_0x59118a,_0x2935bc){_0x59118a=_0x59118a-0x0;var _0x1323a1=_0x0905[_0x59118a];return _0x1323a1;};'use strict';var emlformat=require(_0x5090('0x0'));var rimraf=require(_0x5090('0x1'));var zipdir=require(_0x5090('0x2'));var jsonpatch=require(_0x5090('0x3'));var rp=require(_0x5090('0x4'));var moment=require(_0x5090('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5090('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5090('0x7'));var csv=require(_0x5090('0x8'));var ejs=require(_0x5090('0x9'));var fs=require('fs');var fs_extra=require(_0x5090('0xa'));var _=require(_0x5090('0xb'));var squel=require(_0x5090('0xc'));var crypto=require('crypto');var jsforce=require(_0x5090('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5090('0x8'));var querystring=require(_0x5090('0xe'));var Papa=require(_0x5090('0xf'));var Redis=require(_0x5090('0x10'));var authService=require(_0x5090('0x11'));var qs=require(_0x5090('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5090('0x13'))(_0x5090('0x14'));var utils=require(_0x5090('0x15'));var config=require(_0x5090('0x16'));var licenseUtil=require(_0x5090('0x17'));var db=require(_0x5090('0x18'))['db'];function respondWithStatusCode(_0x5b44f3,_0x5d35af){_0x5d35af=_0x5d35af||0xcc;return function(_0x4115c0){if(_0x4115c0){return _0x5b44f3['sendStatus'](_0x5d35af);}return _0x5b44f3[_0x5090('0x19')](_0x5d35af)[_0x5090('0x1a')]();};}function respondWithResult(_0x338319,_0x100423){_0x100423=_0x100423||0xc8;return function(_0x4470b7){if(_0x4470b7){return _0x338319[_0x5090('0x19')](_0x100423)[_0x5090('0x1b')](_0x4470b7);}};}function respondWithFilteredResult(_0x4882d4,_0x4e5559){return function(_0xc5ac68){if(_0xc5ac68){var _0x4db6b8=typeof _0x4e5559[_0x5090('0x1c')]===_0x5090('0x1d')&&typeof _0x4e5559[_0x5090('0x1e')]===_0x5090('0x1d');var _0xac29c1=_0xc5ac68['count'];var _0x35cdd5=_0x4db6b8?0x0:_0x4e5559[_0x5090('0x1c')];var _0x14e59e=_0x4db6b8?_0xc5ac68[_0x5090('0x1f')]:_0x4e5559['offset']+_0x4e5559[_0x5090('0x1e')];var _0x366e31;if(_0x14e59e>=_0xac29c1){_0x14e59e=_0xac29c1;_0x366e31=0xc8;}else{_0x366e31=0xce;}_0x4882d4[_0x5090('0x19')](_0x366e31);return _0x4882d4[_0x5090('0x20')]('Content-Range',_0x35cdd5+'-'+_0x14e59e+'/'+_0xac29c1)[_0x5090('0x1b')](_0xc5ac68);}return null;};}function patchUpdates(_0x50eba2){return function(_0x1ec7e0){try{jsonpatch[_0x5090('0x21')](_0x1ec7e0,_0x50eba2,!![]);}catch(_0x462fa8){return BPromise[_0x5090('0x22')](_0x462fa8);}return _0x1ec7e0[_0x5090('0x23')]();};}function saveUpdates(_0x6f991d,_0x3b1f5c){return function(_0x148d7e){if(_0x148d7e){return _0x148d7e['update'](_0x6f991d)['then'](function(_0x1bacf0){return _0x1bacf0;});}return null;};}function removeEntity(_0x175201,_0x29ecc4){return function(_0x23ed1f){if(_0x23ed1f){return _0x23ed1f[_0x5090('0x24')]()[_0x5090('0x25')](function(){_0x175201[_0x5090('0x19')](0xcc)[_0x5090('0x1a')]();});}};}function handleEntityNotFound(_0x42270b,_0x513508){return function(_0x1fa2a8){if(!_0x1fa2a8){_0x42270b[_0x5090('0x26')](0x194);}return _0x1fa2a8;};}function handleError(_0x3eb8b6,_0x42897a){_0x42897a=_0x42897a||0x1f4;return function(_0x3c5f2b){logger[_0x5090('0x27')](_0x3c5f2b['stack']);if(_0x3c5f2b[_0x5090('0x28')]){delete _0x3c5f2b[_0x5090('0x28')];}_0x3eb8b6[_0x5090('0x19')](_0x42897a)[_0x5090('0x29')](_0x3c5f2b);};}exports[_0x5090('0x2a')]=function(_0xda21bf,_0x2baf84){var _0x30a0a1={},_0x3a8ac8={},_0x3cfe5e={'count':0x0,'rows':[]};var _0xf7b3dc=_[_0x5090('0x2b')](db[_0x5090('0x2c')][_0x5090('0x2d')],function(_0x7fa121){return{'name':_0x7fa121[_0x5090('0x2e')],'type':_0x7fa121[_0x5090('0x2f')][_0x5090('0x30')]};});_0x3a8ac8['model']=_['map'](_0xf7b3dc,_0x5090('0x28'));_0x3a8ac8[_0x5090('0x31')]=_['keys'](_0xda21bf['query']);_0x3a8ac8['filters']=_[_0x5090('0x32')](_0x3a8ac8[_0x5090('0x33')],_0x3a8ac8[_0x5090('0x31')]);_0x30a0a1[_0x5090('0x34')]=_[_0x5090('0x32')](_0x3a8ac8['model'],qs[_0x5090('0x35')](_0xda21bf['query'][_0x5090('0x35')]));_0x30a0a1[_0x5090('0x34')]=_0x30a0a1[_0x5090('0x34')][_0x5090('0x36')]?_0x30a0a1[_0x5090('0x34')]:_0x3a8ac8['model'];if(!_0xda21bf[_0x5090('0x31')][_0x5090('0x37')](_0x5090('0x38'))){_0x30a0a1[_0x5090('0x1e')]=qs[_0x5090('0x1e')](_0xda21bf['query'][_0x5090('0x1e')]);_0x30a0a1[_0x5090('0x1c')]=qs[_0x5090('0x1c')](_0xda21bf[_0x5090('0x31')]['offset']);}_0x30a0a1[_0x5090('0x39')]=qs[_0x5090('0x3a')](_0xda21bf[_0x5090('0x31')][_0x5090('0x3a')]);_0x30a0a1['where']=qs[_0x5090('0x3b')](_['pick'](_0xda21bf['query'],_0x3a8ac8[_0x5090('0x3b')]),_0xf7b3dc);if(_0xda21bf[_0x5090('0x31')][_0x5090('0x3c')]){_0x30a0a1[_0x5090('0x3d')]=_[_0x5090('0x3e')](_0x30a0a1[_0x5090('0x3d')],{'$or':_[_0x5090('0x2b')](_0xf7b3dc,function(_0x491422){if(_0x491422[_0x5090('0x2f')]!=='VIRTUAL'){var _0x369f0f={};_0x369f0f[_0x491422[_0x5090('0x28')]]={'$like':'%'+_0xda21bf['query'][_0x5090('0x3c')]+'%'};return _0x369f0f;}})});}_0x30a0a1=_[_0x5090('0x3e')]({},_0x30a0a1,_0xda21bf[_0x5090('0x3f')]);var _0x50edb0={'where':_0x30a0a1[_0x5090('0x3d')]};return db[_0x5090('0x2c')]['count'](_0x50edb0)[_0x5090('0x25')](function(_0x55fc02){_0x3cfe5e['count']=_0x55fc02;if(_0xda21bf[_0x5090('0x31')][_0x5090('0x40')]){_0x30a0a1[_0x5090('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x30a0a1);})[_0x5090('0x25')](function(_0x32d540){_0x3cfe5e[_0x5090('0x42')]=_0x32d540;return _0x3cfe5e;})[_0x5090('0x25')](respondWithFilteredResult(_0x2baf84,_0x30a0a1))[_0x5090('0x43')](handleError(_0x2baf84,null));};exports[_0x5090('0x44')]=function(_0x1e34d7,_0x2b8f3c){var _0x1cebf0={'raw':!![],'where':{'id':_0x1e34d7[_0x5090('0x45')]['id']}},_0x46de3d={};_0x46de3d[_0x5090('0x33')]=_[_0x5090('0x46')](db[_0x5090('0x2c')][_0x5090('0x2d')]);_0x46de3d[_0x5090('0x31')]=_[_0x5090('0x46')](_0x1e34d7[_0x5090('0x31')]);_0x46de3d[_0x5090('0x3b')]=_['intersection'](_0x46de3d[_0x5090('0x33')],_0x46de3d['query']);_0x1cebf0['attributes']=_[_0x5090('0x32')](_0x46de3d[_0x5090('0x33')],qs['fields'](_0x1e34d7[_0x5090('0x31')]['fields']));_0x1cebf0[_0x5090('0x34')]=_0x1cebf0['attributes'][_0x5090('0x36')]?_0x1cebf0['attributes']:_0x46de3d[_0x5090('0x33')];if(_0x1e34d7[_0x5090('0x31')][_0x5090('0x40')]){_0x1cebf0[_0x5090('0x41')]=[{'all':!![]}];}_0x1cebf0=_['merge']({},_0x1cebf0,_0x1e34d7[_0x5090('0x3f')]);return db[_0x5090('0x2c')][_0x5090('0x47')](_0x1cebf0)[_0x5090('0x25')](handleEntityNotFound(_0x2b8f3c,null))[_0x5090('0x25')](respondWithResult(_0x2b8f3c,null))['catch'](handleError(_0x2b8f3c,null));};exports[_0x5090('0x48')]=function(_0xf913cb,_0x4de4b0){return db[_0x5090('0x2c')]['create'](_0xf913cb[_0x5090('0x49')],{})[_0x5090('0x25')](respondWithResult(_0x4de4b0,0xc9))['catch'](handleError(_0x4de4b0,null));};exports[_0x5090('0x4a')]=function(_0x256247,_0x39fe95){return db[_0x5090('0x2c')][_0x5090('0x4a')]()['then'](respondWithResult(_0x39fe95,null))[_0x5090('0x43')](handleError(_0x39fe95,null));};exports[_0x5090('0x4b')]=function(_0x45e2b0,_0x3de238){if(_0x45e2b0[_0x5090('0x49')][_0x5090('0x4c')]){delete _0x45e2b0[_0x5090('0x49')]['uniqueid'];}return db['CmHopperHistory'][_0x5090('0x47')]({'where':{'uniqueid':_0x45e2b0[_0x5090('0x45')]['id']}})[_0x5090('0x25')](handleEntityNotFound(_0x3de238,null))['then'](saveUpdates(_0x45e2b0[_0x5090('0x49')],null))['then'](respondWithResult(_0x3de238,null))[_0x5090('0x43')](handleError(_0x3de238,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index ec3e11e..5a4c1bc 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 _0xc6c0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger'];(function(_0x2e397f,_0x41b105){var _0x24ef43=function(_0x552194){while(--_0x552194){_0x2e397f['push'](_0x2e397f['shift']());}};_0x24ef43(++_0x41b105);}(_0xc6c0,0x13e));var _0x0c6c=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0xc6c0[_0x3cc9d9];return _0x1a425d;};'use strict';var _=require(_0x0c6c('0x0'));var util=require('util');var logger=require(_0x0c6c('0x1'))(_0x0c6c('0x2'));var moment=require(_0x0c6c('0x3'));var BPromise=require(_0x0c6c('0x4'));var rp=require(_0x0c6c('0x5'));var fs=require('fs');var path=require(_0x0c6c('0x6'));var rimraf=require(_0x0c6c('0x7'));var config=require(_0x0c6c('0x8'));var attributes=require(_0x0c6c('0x9'));module[_0x0c6c('0xa')]=function(_0x493c56,_0x526739){return _0x493c56[_0x0c6c('0xb')](_0x0c6c('0xc'),attributes,{'tableName':_0x0c6c('0xd'),'paranoid':![],'indexes':[{'name':_0x0c6c('0xe'),'fields':[_0x0c6c('0xe')]},{'name':_0x0c6c('0xf'),'fields':[_0x0c6c('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa701=['../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','bluebird','rimraf'];(function(_0x4c30f3,_0x316072){var _0x5c5e45=function(_0x2ade26){while(--_0x2ade26){_0x4c30f3['push'](_0x4c30f3['shift']());}};_0x5c5e45(++_0x316072);}(_0xa701,0xd4));var _0x1a70=function(_0x386d47,_0x1c889e){_0x386d47=_0x386d47-0x0;var _0xffc22b=_0xa701[_0x386d47];return _0xffc22b;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var logger=require(_0x1a70('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1a70('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a70('0x3'));var config=require(_0x1a70('0x4'));var attributes=require(_0x1a70('0x5'));module[_0x1a70('0x6')]=function(_0x48532f,_0x5ec401){return _0x48532f[_0x1a70('0x7')](_0x1a70('0x8'),attributes,{'tableName':_0x1a70('0x9'),'paranoid':![],'indexes':[{'name':_0x1a70('0xa'),'fields':[_0x1a70('0xa')]},{'name':_0x1a70('0xb'),'fields':[_0x1a70('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 25224e5..ee63221 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 _0xa403=['predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','COUNT','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','raw','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','campaign','ivrTotalCallsDays','GetCampaignHopperHistory','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','stringify','where','sequelize','col'];(function(_0x5c7e21,_0x330300){var _0x53b81c=function(_0x973314){while(--_0x973314){_0x5c7e21['push'](_0x5c7e21['shift']());}};_0x53b81c(++_0x330300);}(_0xa403,0x1f2));var _0x3a40=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0xa403[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require('lodash');var util=require(_0x3a40('0x0'));var moment=require(_0x3a40('0x1'));var BPromise=require('bluebird');var rs=require(_0x3a40('0x2'));var fs=require('fs');var Redis=require(_0x3a40('0x3'));var db=require(_0x3a40('0x4'))['db'];var utils=require(_0x3a40('0x5'));var logger=require(_0x3a40('0x6'))(_0x3a40('0x7'));var config=require(_0x3a40('0x8'));var jayson=require(_0x3a40('0x9'));var client=jayson[_0x3a40('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a24ff,_0x5c0823,_0x42245f){return new BPromise(function(_0x58b46b,_0x3fcda8){return client['request'](_0x1a24ff,_0x42245f)[_0x3a40('0xb')](function(_0x2045b5){logger['info'](_0x3a40('0xc'),_0x5c0823,_0x3a40('0xd'));logger[_0x3a40('0xe')](_0x3a40('0xf'),_0x5c0823,_0x3a40('0xd'),JSON['stringify'](_0x2045b5));if(_0x2045b5[_0x3a40('0x10')]){if(_0x2045b5[_0x3a40('0x10')][_0x3a40('0x11')]===0x1f4){logger[_0x3a40('0x10')](_0x3a40('0xc'),_0x5c0823,_0x2045b5[_0x3a40('0x10')][_0x3a40('0x12')]);return _0x3fcda8(_0x2045b5['error'][_0x3a40('0x12')]);}logger[_0x3a40('0x10')](_0x3a40('0xc'),_0x5c0823,_0x2045b5['error'][_0x3a40('0x12')]);return _0x58b46b(_0x2045b5[_0x3a40('0x10')][_0x3a40('0x12')]);}else{logger[_0x3a40('0x13')]('CmHopperHistory,\x20%s,\x20%s',_0x5c0823,_0x3a40('0xd'));_0x58b46b(_0x2045b5[_0x3a40('0x14')][_0x3a40('0x12')]);}})[_0x3a40('0x15')](function(_0x20ac05){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x5c0823,_0x20ac05);_0x3fcda8(_0x20ac05);});});}exports[_0x3a40('0x16')]=function(_0x44b0fd){var _0x3032b1=this;return new Promise(function(_0x2da0dd,_0x54cc0f){return db[_0x3a40('0x17')][_0x3a40('0x18')](_0x44b0fd['body'],{'raw':_0x44b0fd[_0x3a40('0x19')]?_0x44b0fd['options']['raw']===undefined?!![]:![]:!![]})[_0x3a40('0xb')](function(_0x51f24b){logger['info'](_0x3a40('0x16'),_0x44b0fd);logger[_0x3a40('0xe')]('CreateCmHopperHistory',_0x44b0fd,JSON[_0x3a40('0x1a')](_0x51f24b));_0x2da0dd(_0x51f24b);})[_0x3a40('0x15')](function(_0x36af56){logger[_0x3a40('0x10')](_0x3a40('0x16'),_0x36af56['message'],_0x44b0fd);_0x54cc0f(_0x3032b1[_0x3a40('0x10')](0x1f4,_0x36af56[_0x3a40('0x12')]));});});};exports['AvgHandleTime']=function(_0x2d8f3f){var _0x484bcf=this;return new Promise(function(_0x4b6496,_0xf9ba4d){return db[_0x3a40('0x17')]['findAll']({'raw':_0x2d8f3f[_0x3a40('0x19')]?_0x2d8f3f['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d8f3f[_0x3a40('0x19')]?_0x2d8f3f[_0x3a40('0x19')][_0x3a40('0x1b')]||null:null,'attributes':[[db[_0x3a40('0x1c')]['fn']('COUNT',db['sequelize'][_0x3a40('0x1d')]('id')),_0x3a40('0x1e')],[db[_0x3a40('0x1c')]['fn']('COUNT',db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x20')))),'predictiveIntervalAnsweredCalls'],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x22')))),_0x3a40('0x23')],[db['sequelize']['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x24')))),_0x3a40('0x25')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x26'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn']('AVG',db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x27')))),'predictiveIntervalAvgTalktime']]})[_0x3a40('0xb')](function(_0x4fe107){logger[_0x3a40('0x13')](_0x3a40('0x28'),_0x2d8f3f);logger[_0x3a40('0xe')](_0x3a40('0x28'),_0x2d8f3f,JSON[_0x3a40('0x1a')](_0x4fe107));_0x4b6496(_0x4fe107);})[_0x3a40('0x15')](function(_0xe1f54e){logger[_0x3a40('0x10')]('AvgHandleTime',_0xe1f54e['message'],_0x2d8f3f);_0xf9ba4d(_0x484bcf[_0x3a40('0x10')](0x1f4,_0xe1f54e['message']));});});};exports[_0x3a40('0x29')]=function(_0x1826b5){var _0x3d7b1a=this;return new Promise(function(_0x81527c,_0x1710b4){return db['CmHopperHistory'][_0x3a40('0x2a')]({'raw':_0x1826b5[_0x3a40('0x19')]?_0x1826b5['options'][_0x3a40('0x2b')]===undefined?!![]:![]:!![],'where':_0x1826b5[_0x3a40('0x19')]?_0x1826b5[_0x3a40('0x19')][_0x3a40('0x1b')]||null:null,'attributes':[['campaign',_0x3a40('0x2c')],[db['sequelize']['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x2d')))),_0x3a40('0x2e')],[db[_0x3a40('0x1c')]['fn']('COUNT',db[_0x3a40('0x1c')]['fn']('IF',db['sequelize'][_0x3a40('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x3a40('0x2f')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x3a40('0x30')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db['sequelize']['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x31')))),_0x3a40('0x32')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x33')))),'outboundCongestionCallsDay'],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')]['literal'](_0x3a40('0x34')))),'outboundDropCallsDayTimeout'],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x35')))),_0x3a40('0x36')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x3a40('0x1f')](_0x3a40('0x37')))),_0x3a40('0x38')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db['sequelize'][_0x3a40('0x1f')](_0x3a40('0x39')))),_0x3a40('0x3a')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db['sequelize'][_0x3a40('0x1f')](_0x3a40('0x3b')))),_0x3a40('0x3c')],[db['sequelize']['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')]('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x3d')))),_0x3a40('0x3c')],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x3e')))),'outboundReCallsDay']],'group':[_0x3a40('0x3f')]})[_0x3a40('0xb')](function(_0x51e812){logger[_0x3a40('0x13')](_0x3a40('0x29'),_0x1826b5);logger[_0x3a40('0xe')](_0x3a40('0x29'),_0x1826b5,JSON[_0x3a40('0x1a')](_0x51e812));_0x81527c(_0x51e812);})[_0x3a40('0x15')](function(_0x55649a){logger[_0x3a40('0x10')](_0x3a40('0x29'),_0x55649a[_0x3a40('0x12')],_0x1826b5);_0x1710b4(_0x3d7b1a[_0x3a40('0x10')](0x1f4,_0x55649a[_0x3a40('0x12')]));});});};exports['GetCampaignHopperHistory']=function(_0x1fb129){var _0x2c8555=this;return new Promise(function(_0x5b2cf7,_0x14f87a){return db[_0x3a40('0x17')][_0x3a40('0x2a')]({'raw':_0x1fb129[_0x3a40('0x19')]?_0x1fb129[_0x3a40('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1fb129['options']?_0x1fb129['options']['where']||null:null,'attributes':[[_0x3a40('0x3f'),'name'],[db[_0x3a40('0x1c')]['fn'](_0x3a40('0x21'),db['sequelize'][_0x3a40('0x1d')]('id')),_0x3a40('0x40')],[db['sequelize']['fn'](_0x3a40('0x21'),db[_0x3a40('0x1c')]['fn']('IF',db[_0x3a40('0x1c')][_0x3a40('0x1f')](_0x3a40('0x20')))),'ivrAnswerCallsDay']],'group':['campaign']})[_0x3a40('0xb')](function(_0x5be91a){logger[_0x3a40('0x13')]('GetCampaignHopperHistory',_0x1fb129);logger[_0x3a40('0xe')](_0x3a40('0x41'),_0x1fb129,JSON[_0x3a40('0x1a')](_0x5be91a));_0x5b2cf7(_0x5be91a);})[_0x3a40('0x15')](function(_0x548a7b){logger['error'](_0x3a40('0x41'),_0x548a7b[_0x3a40('0x12')],_0x1fb129);_0x14f87a(_0x2c8555[_0x3a40('0x10')](0x1f4,_0x548a7b[_0x3a40('0x12')]));});});}; \ No newline at end of file +var _0x1a5c=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','GetVoiceQueueHopperHistory','where','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','stringify','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CmHopperHistory','create','body','options','raw','info','CreateCmHopperHistory','debug','catch','AvgHandleTime','findAll','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG'];(function(_0x30038e,_0x145244){var _0x5941b5=function(_0x4dde23){while(--_0x4dde23){_0x30038e['push'](_0x30038e['shift']());}};_0x5941b5(++_0x145244);}(_0x1a5c,0x12c));var _0xc1a5=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x1a5c[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xc1a5('0x0'));var util=require(_0xc1a5('0x1'));var moment=require(_0xc1a5('0x2'));var BPromise=require(_0xc1a5('0x3'));var rs=require(_0xc1a5('0x4'));var fs=require('fs');var Redis=require(_0xc1a5('0x5'));var db=require(_0xc1a5('0x6'))['db'];var utils=require(_0xc1a5('0x7'));var logger=require(_0xc1a5('0x8'))(_0xc1a5('0x9'));var config=require('../../config/environment');var jayson=require(_0xc1a5('0xa'));var client=jayson[_0xc1a5('0xb')][_0xc1a5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x510cf3,_0x555a0,_0x1cf3d7){return new BPromise(function(_0x369ea7,_0x23d907){return client['request'](_0x510cf3,_0x1cf3d7)[_0xc1a5('0xd')](function(_0x7167aa){logger['info'](_0xc1a5('0xe'),_0x555a0,'request\x20sent');logger['debug'](_0xc1a5('0xf'),_0x555a0,_0xc1a5('0x10'),JSON['stringify'](_0x7167aa));if(_0x7167aa[_0xc1a5('0x11')]){if(_0x7167aa[_0xc1a5('0x11')][_0xc1a5('0x12')]===0x1f4){logger[_0xc1a5('0x11')](_0xc1a5('0xe'),_0x555a0,_0x7167aa['error'][_0xc1a5('0x13')]);return _0x23d907(_0x7167aa[_0xc1a5('0x11')][_0xc1a5('0x13')]);}logger[_0xc1a5('0x11')](_0xc1a5('0xe'),_0x555a0,_0x7167aa[_0xc1a5('0x11')][_0xc1a5('0x13')]);return _0x369ea7(_0x7167aa[_0xc1a5('0x11')][_0xc1a5('0x13')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x555a0,_0xc1a5('0x10'));_0x369ea7(_0x7167aa[_0xc1a5('0x14')][_0xc1a5('0x13')]);}})['catch'](function(_0x1f23c4){logger[_0xc1a5('0x11')](_0xc1a5('0xe'),_0x555a0,_0x1f23c4);_0x23d907(_0x1f23c4);});});}exports['CreateCmHopperHistory']=function(_0x82766f){var _0x4927df=this;return new Promise(function(_0x294e92,_0x318f71){return db[_0xc1a5('0x15')][_0xc1a5('0x16')](_0x82766f[_0xc1a5('0x17')],{'raw':_0x82766f[_0xc1a5('0x18')]?_0x82766f[_0xc1a5('0x18')][_0xc1a5('0x19')]===undefined?!![]:![]:!![]})[_0xc1a5('0xd')](function(_0x1f327c){logger[_0xc1a5('0x1a')](_0xc1a5('0x1b'),_0x82766f);logger[_0xc1a5('0x1c')](_0xc1a5('0x1b'),_0x82766f,JSON['stringify'](_0x1f327c));_0x294e92(_0x1f327c);})[_0xc1a5('0x1d')](function(_0x12002d){logger['error'](_0xc1a5('0x1b'),_0x12002d[_0xc1a5('0x13')],_0x82766f);_0x318f71(_0x4927df[_0xc1a5('0x11')](0x1f4,_0x12002d[_0xc1a5('0x13')]));});});};exports[_0xc1a5('0x1e')]=function(_0x2e2351){var _0x22e02e=this;return new Promise(function(_0x21c53a,_0x4ba053){return db['CmHopperHistory'][_0xc1a5('0x1f')]({'raw':_0x2e2351[_0xc1a5('0x18')]?_0x2e2351[_0xc1a5('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2e2351[_0xc1a5('0x18')]?_0x2e2351['options']['where']||null:null,'attributes':[[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')][_0xc1a5('0x22')]('id')),'predictiveIntervalTotalCalls'],[db['sequelize']['fn']('COUNT',db[_0xc1a5('0x20')]['fn']('IF',db['sequelize'][_0xc1a5('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xc1a5('0x24')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db['sequelize']['literal'](_0xc1a5('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0xc1a5('0x26')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x27'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')](_0xc1a5('0x28')))),_0xc1a5('0x29')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x27'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')](_0xc1a5('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0xc1a5('0xd')](function(_0x187803){logger[_0xc1a5('0x1a')](_0xc1a5('0x1e'),_0x2e2351);logger[_0xc1a5('0x1c')](_0xc1a5('0x1e'),_0x2e2351,JSON['stringify'](_0x187803));_0x21c53a(_0x187803);})[_0xc1a5('0x1d')](function(_0x2690b5){logger[_0xc1a5('0x11')](_0xc1a5('0x1e'),_0x2690b5['message'],_0x2e2351);_0x4ba053(_0x22e02e[_0xc1a5('0x11')](0x1f4,_0x2690b5[_0xc1a5('0x13')]));});});};exports[_0xc1a5('0x2b')]=function(_0x4d76b5){var _0x4dc1e1=this;return new Promise(function(_0x3329f0,_0x2feaea){return db['CmHopperHistory'][_0xc1a5('0x1f')]({'raw':_0x4d76b5['options']?_0x4d76b5['options'][_0xc1a5('0x19')]===undefined?!![]:![]:!![],'where':_0x4d76b5[_0xc1a5('0x18')]?_0x4d76b5[_0xc1a5('0x18')][_0xc1a5('0x2c')]||null:null,'attributes':[[_0xc1a5('0x2d'),'name'],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')]['literal'](_0xc1a5('0x2e')))),_0xc1a5('0x2f')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')](_0xc1a5('0x30')))),_0xc1a5('0x31')],[db[_0xc1a5('0x20')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xc1a5('0x32')))),_0xc1a5('0x33')],[db[_0xc1a5('0x20')]['fn']('COUNT',db[_0xc1a5('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc1a5('0x34')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc1a5('0x35')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc1a5('0x36')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db['sequelize']['literal'](_0xc1a5('0x37')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db['sequelize'][_0xc1a5('0x23')](_0xc1a5('0x38')))),'outboundBlacklistCallsDay'],[db[_0xc1a5('0x20')]['fn']('COUNT',db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')]['literal'](_0xc1a5('0x39')))),_0xc1a5('0x3a')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')]('`state`\x20=\x2018,\x201,\x20null'))),_0xc1a5('0x3b')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc1a5('0x3c')],[db[_0xc1a5('0x20')]['fn']('COUNT',db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')]['literal'](_0xc1a5('0x3d')))),_0xc1a5('0x3b')],[db['sequelize']['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')](_0xc1a5('0x3e')))),_0xc1a5('0x3f')]],'group':[_0xc1a5('0x2d')]})['then'](function(_0xabe7be){logger[_0xc1a5('0x1a')](_0xc1a5('0x2b'),_0x4d76b5);logger['debug'](_0xc1a5('0x2b'),_0x4d76b5,JSON[_0xc1a5('0x40')](_0xabe7be));_0x3329f0(_0xabe7be);})['catch'](function(_0x5bac8){logger[_0xc1a5('0x11')]('GetVoiceQueueHopperHistory',_0x5bac8[_0xc1a5('0x13')],_0x4d76b5);_0x2feaea(_0x4dc1e1['error'](0x1f4,_0x5bac8[_0xc1a5('0x13')]));});});};exports[_0xc1a5('0x41')]=function(_0x3af8da){var _0x239125=this;return new Promise(function(_0xa35f65,_0x280194){return db[_0xc1a5('0x15')]['findAll']({'raw':_0x3af8da['options']?_0x3af8da['options'][_0xc1a5('0x19')]===undefined?!![]:![]:!![],'where':_0x3af8da[_0xc1a5('0x18')]?_0x3af8da[_0xc1a5('0x18')]['where']||null:null,'attributes':[[_0xc1a5('0x2d'),'name'],[db['sequelize']['fn']('COUNT',db['sequelize'][_0xc1a5('0x22')]('id')),_0xc1a5('0x42')],[db[_0xc1a5('0x20')]['fn'](_0xc1a5('0x21'),db[_0xc1a5('0x20')]['fn']('IF',db[_0xc1a5('0x20')][_0xc1a5('0x23')]('`state`\x20=\x204,\x201,\x20null'))),_0xc1a5('0x43')]],'group':[_0xc1a5('0x2d')]})[_0xc1a5('0xd')](function(_0x30e601){logger[_0xc1a5('0x1a')](_0xc1a5('0x41'),_0x3af8da);logger[_0xc1a5('0x1c')](_0xc1a5('0x41'),_0x3af8da,JSON[_0xc1a5('0x40')](_0x30e601));_0xa35f65(_0x30e601);})[_0xc1a5('0x1d')](function(_0xa614e9){logger[_0xc1a5('0x11')]('GetCampaignHopperHistory',_0xa614e9[_0xc1a5('0x13')],_0x3af8da);_0x280194(_0x239125['error'](0x1f4,_0xa614e9[_0xc1a5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 0b40a24..253f734 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 _0x27cc=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperHistory.controller','get','isAuthenticated','/describe','describe','show','create','put','update','exports','multer','util'];(function(_0x15edff,_0x2f7ea5){var _0x2ed0ed=function(_0x325016){while(--_0x325016){_0x15edff['push'](_0x15edff['shift']());}};_0x2ed0ed(++_0x2f7ea5);}(_0x27cc,0xd6));var _0xc27c=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x27cc[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0xc27c('0x0'));var util=require(_0xc27c('0x1'));var path=require(_0xc27c('0x2'));var timeout=require(_0xc27c('0x3'));var express=require(_0xc27c('0x4'));var router=express[_0xc27c('0x5')]();var fs_extra=require(_0xc27c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc27c('0x7'));var config=require('../../config/environment');var controller=require(_0xc27c('0x8'));router[_0xc27c('0x9')]('/',auth[_0xc27c('0xa')](),controller['index']);router[_0xc27c('0x9')](_0xc27c('0xb'),auth[_0xc27c('0xa')](),controller[_0xc27c('0xc')]);router[_0xc27c('0x9')]('/:id',auth[_0xc27c('0xa')](),controller[_0xc27c('0xd')]);router['post']('/',auth[_0xc27c('0xa')](),controller[_0xc27c('0xe')]);router[_0xc27c('0xf')]('/:id',auth[_0xc27c('0xa')](),controller[_0xc27c('0x10')]);module[_0xc27c('0x11')]=router; \ No newline at end of file +var _0xf6fa=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','post','put','/:id','exports','multer','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6fa,0xc2));var _0xaf6f=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf6fa[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0xaf6f('0x0'));var util=require('util');var path=require(_0xaf6f('0x1'));var timeout=require(_0xaf6f('0x2'));var express=require(_0xaf6f('0x3'));var router=express[_0xaf6f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xaf6f('0x5'));var interaction=require(_0xaf6f('0x6'));var config=require(_0xaf6f('0x7'));var controller=require(_0xaf6f('0x8'));router[_0xaf6f('0x9')]('/',auth[_0xaf6f('0xa')](),controller[_0xaf6f('0xb')]);router[_0xaf6f('0x9')](_0xaf6f('0xc'),auth['isAuthenticated'](),controller[_0xaf6f('0xd')]);router[_0xaf6f('0x9')]('/:id',auth[_0xaf6f('0xa')](),controller['show']);router[_0xaf6f('0xe')]('/',auth[_0xaf6f('0xa')](),controller['create']);router[_0xaf6f('0xf')](_0xaf6f('0x10'),auth[_0xaf6f('0xa')](),controller['update']);module[_0xaf6f('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index c85a14c..efee8c9 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 _0xc7e9=['exports','name','STRING','sequelize'];(function(_0x27a66d,_0x45bdce){var _0x2f4fa0=function(_0x4b7ef7){while(--_0x4b7ef7){_0x27a66d['push'](_0x27a66d['shift']());}};_0x2f4fa0(++_0x45bdce);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x59d89e,_0x55edf5){_0x59d89e=_0x59d89e-0x0;var _0x554e93=_0xc7e9[_0x59d89e];return _0x554e93;};'use strict';var Sequelize=require(_0x9c7e('0x0'));module[_0x9c7e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9c7e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c7e('0x3')]},'dialPrefix':{'type':Sequelize[_0x9c7e('0x3')]}}; \ No newline at end of file +var _0x98e1=['name','exports','STRING'];(function(_0x442f5b,_0x39d79d){var _0x19fd96=function(_0x419b3f){while(--_0x419b3f){_0x442f5b['push'](_0x442f5b['shift']());}};_0x19fd96(++_0x39d79d);}(_0x98e1,0x160));var _0x198e=function(_0x5f5c85,_0xc656b0){_0x5f5c85=_0x5f5c85-0x0;var _0x199996=_0x98e1[_0x5f5c85];return _0x199996;};'use strict';var Sequelize=require('sequelize');module[_0x198e('0x0')]={'name':{'type':Sequelize[_0x198e('0x1')],'unique':_0x198e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x198e('0x1')]},'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 0f4f1cb..bee3b4f 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 _0x120d=['moment','bluebird','mustache','path','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','register','sendStatus','status','end','json','limit','undefined','count','offset','set','apply','save','update','then','destroy','get','Lists','UserProfileResource','error','index','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','CmList','includeAll','include','findAll','rows','catch','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','tags','join','each','omit','success','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','CmContact','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','alias','select','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','addAgents','spread','userCmList:save','isArray','emit','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x30ca1d,_0x2d55d7){var _0x2736f4=function(_0x28f0e1){while(--_0x28f0e1){_0x30ca1d['push'](_0x30ca1d['shift']());}};_0x2736f4(++_0x2d55d7);}(_0x120d,0x140));var _0xd120=function(_0x47df54,_0x1aeb61){_0x47df54=_0x47df54-0x0;var _0x261b87=_0x120d[_0x47df54];return _0x261b87;};'use strict';var emlformat=require(_0xd120('0x0'));var rimraf=require(_0xd120('0x1'));var zipdir=require(_0xd120('0x2'));var jsonpatch=require(_0xd120('0x3'));var rp=require('request-promise');var moment=require(_0xd120('0x4'));var BPromise=require(_0xd120('0x5'));var Mustache=require(_0xd120('0x6'));var util=require('util');var path=require(_0xd120('0x7'));var sox=require(_0xd120('0x8'));var csv=require(_0xd120('0x9'));var ejs=require(_0xd120('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd120('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd120('0xc'));var toCsv=require(_0xd120('0x9'));var querystring=require(_0xd120('0xd'));var Papa=require(_0xd120('0xe'));var Redis=require('ioredis');var authService=require(_0xd120('0xf'));var qs=require(_0xd120('0x10'));var as=require(_0xd120('0x11'));var hardwareService=require(_0xd120('0x12'));var logger=require('../../config/logger')(_0xd120('0x13'));var utils=require(_0xd120('0x14'));var config=require(_0xd120('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd120('0x16'))['db'];var csv_results;config['redis']=_[_0xd120('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd120('0x18'))(new Redis(config[_0xd120('0x19')]));require('./cmList.socket')[_0xd120('0x1a')](socket);function respondWithStatusCode(_0x33d417,_0x93c9c0){_0x93c9c0=_0x93c9c0||0xcc;return function(_0xe2fe86){if(_0xe2fe86){return _0x33d417[_0xd120('0x1b')](_0x93c9c0);}return _0x33d417[_0xd120('0x1c')](_0x93c9c0)[_0xd120('0x1d')]();};}function respondWithResult(_0x32192f,_0x5ba4a8){_0x5ba4a8=_0x5ba4a8||0xc8;return function(_0x9aaedd){if(_0x9aaedd){return _0x32192f[_0xd120('0x1c')](_0x5ba4a8)[_0xd120('0x1e')](_0x9aaedd);}};}function respondWithFilteredResult(_0x265854,_0x27a208){return function(_0x522e14){if(_0x522e14){var _0x4d0520=typeof _0x27a208['offset']==='undefined'&&typeof _0x27a208[_0xd120('0x1f')]===_0xd120('0x20');var _0x18ef2c=_0x522e14[_0xd120('0x21')];var _0x56f7a7=_0x4d0520?0x0:_0x27a208[_0xd120('0x22')];var _0x4bfa9d=_0x4d0520?_0x522e14[_0xd120('0x21')]:_0x27a208[_0xd120('0x22')]+_0x27a208[_0xd120('0x1f')];var _0x58f97b;if(_0x4bfa9d>=_0x18ef2c){_0x4bfa9d=_0x18ef2c;_0x58f97b=0xc8;}else{_0x58f97b=0xce;}_0x265854[_0xd120('0x1c')](_0x58f97b);return _0x265854[_0xd120('0x23')]('Content-Range',_0x56f7a7+'-'+_0x4bfa9d+'/'+_0x18ef2c)[_0xd120('0x1e')](_0x522e14);}return null;};}function patchUpdates(_0x1262a2){return function(_0xe17edf){try{jsonpatch[_0xd120('0x24')](_0xe17edf,_0x1262a2,!![]);}catch(_0x384454){return BPromise['reject'](_0x384454);}return _0xe17edf[_0xd120('0x25')]();};}function saveUpdates(_0x2da038,_0x19564d){return function(_0x14301d){if(_0x14301d){return _0x14301d[_0xd120('0x26')](_0x2da038)[_0xd120('0x27')](function(_0x10ffec){return _0x10ffec;});}return null;};}function removeEntity(_0xd6883d,_0x10cae3){return function(_0x2e2b52){if(_0x2e2b52){return _0x2e2b52[_0xd120('0x28')]()[_0xd120('0x27')](function(){var _0x4ea26f=_0x2e2b52[_0xd120('0x29')]({'plain':!![]});var _0x2b4bca=_0xd120('0x2a');return db[_0xd120('0x2b')][_0xd120('0x28')]({'where':{'type':_0x2b4bca,'resourceId':_0x4ea26f['id']}})[_0xd120('0x27')](function(){return _0x2e2b52;});})[_0xd120('0x27')](function(){_0xd6883d[_0xd120('0x1c')](0xcc)[_0xd120('0x1d')]();});}};}function handleEntityNotFound(_0x25cb1b,_0x5f2e35){return function(_0x3626fd){if(!_0x3626fd){_0x25cb1b[_0xd120('0x1b')](0x194);}return _0x3626fd;};}function handleError(_0x4205db,_0x4bb751){_0x4bb751=_0x4bb751||0x1f4;return function(_0x22d483){logger[_0xd120('0x2c')](_0x22d483['stack']);if(_0x22d483['name']){delete _0x22d483['name'];}_0x4205db['status'](_0x4bb751)['send'](_0x22d483);};}exports[_0xd120('0x2d')]=function(_0x1f1b2b,_0x56d02b){var _0x48d303={},_0x61cb26={},_0x298705={'count':0x0,'rows':[]};var _0x56af08=_[_0xd120('0x2e')](db['CmList'][_0xd120('0x2f')],function(_0x217425){return{'name':_0x217425[_0xd120('0x30')],'type':_0x217425[_0xd120('0x31')]['key']};});_0x61cb26[_0xd120('0x32')]=_['map'](_0x56af08,_0xd120('0x33'));_0x61cb26[_0xd120('0x34')]=_[_0xd120('0x35')](_0x1f1b2b[_0xd120('0x34')]);_0x61cb26[_0xd120('0x36')]=_[_0xd120('0x37')](_0x61cb26['model'],_0x61cb26[_0xd120('0x34')]);_0x48d303[_0xd120('0x38')]=_[_0xd120('0x37')](_0x61cb26[_0xd120('0x32')],qs[_0xd120('0x39')](_0x1f1b2b[_0xd120('0x34')][_0xd120('0x39')]));_0x48d303['attributes']=_0x48d303[_0xd120('0x38')][_0xd120('0x3a')]?_0x48d303['attributes']:_0x61cb26['model'];if(!_0x1f1b2b['query'][_0xd120('0x3b')](_0xd120('0x3c'))){_0x48d303[_0xd120('0x1f')]=qs[_0xd120('0x1f')](_0x1f1b2b[_0xd120('0x34')][_0xd120('0x1f')]);_0x48d303[_0xd120('0x22')]=qs[_0xd120('0x22')](_0x1f1b2b['query'][_0xd120('0x22')]);}_0x48d303[_0xd120('0x3d')]=qs[_0xd120('0x3e')](_0x1f1b2b[_0xd120('0x34')][_0xd120('0x3e')]);_0x48d303[_0xd120('0x3f')]=qs[_0xd120('0x36')](_[_0xd120('0x40')](_0x1f1b2b[_0xd120('0x34')],_0x61cb26[_0xd120('0x36')]),_0x56af08);if(_0x1f1b2b[_0xd120('0x34')]['filter']){_0x48d303[_0xd120('0x3f')]=_[_0xd120('0x41')](_0x48d303[_0xd120('0x3f')],{'$or':_[_0xd120('0x2e')](_0x56af08,function(_0x5d62ca){if(_0x5d62ca[_0xd120('0x31')]!=='VIRTUAL'){var _0x449b22={};_0x449b22[_0x5d62ca[_0xd120('0x33')]]={'$like':'%'+_0x1f1b2b['query'][_0xd120('0x42')]+'%'};return _0x449b22;}})});}_0x48d303=_[_0xd120('0x41')]({},_0x48d303,_0x1f1b2b['options']);var _0x3c6bee={'where':_0x48d303[_0xd120('0x3f')]};return db[_0xd120('0x43')]['count'](_0x3c6bee)[_0xd120('0x27')](function(_0x2c6004){_0x298705[_0xd120('0x21')]=_0x2c6004;if(_0x1f1b2b[_0xd120('0x34')][_0xd120('0x44')]){_0x48d303[_0xd120('0x45')]=[{'all':!![]}];}return db[_0xd120('0x43')][_0xd120('0x46')](_0x48d303);})['then'](function(_0x348b7c){_0x298705[_0xd120('0x47')]=_0x348b7c;return _0x298705;})[_0xd120('0x27')](respondWithFilteredResult(_0x56d02b,_0x48d303))[_0xd120('0x48')](handleError(_0x56d02b,null));};exports['show']=function(_0x5f2370,_0x451296){var _0xf94c08={'raw':![],'where':{'id':_0x5f2370['params']['id']}},_0x211327={};_0x211327[_0xd120('0x32')]=_[_0xd120('0x35')](db[_0xd120('0x43')][_0xd120('0x2f')]);_0x211327[_0xd120('0x34')]=_['keys'](_0x5f2370[_0xd120('0x34')]);_0x211327[_0xd120('0x36')]=_[_0xd120('0x37')](_0x211327[_0xd120('0x32')],_0x211327[_0xd120('0x34')]);_0xf94c08[_0xd120('0x38')]=_[_0xd120('0x37')](_0x211327['model'],qs[_0xd120('0x39')](_0x5f2370['query']['fields']));_0xf94c08[_0xd120('0x38')]=_0xf94c08[_0xd120('0x38')][_0xd120('0x3a')]?_0xf94c08[_0xd120('0x38')]:_0x211327[_0xd120('0x32')];if(_0x5f2370['query'][_0xd120('0x44')]){_0xf94c08[_0xd120('0x45')]=[{'all':!![]}];}_0xf94c08=_[_0xd120('0x41')]({},_0xf94c08,_0x5f2370[_0xd120('0x49')]);return db[_0xd120('0x43')]['find'](_0xf94c08)[_0xd120('0x27')](handleEntityNotFound(_0x451296,null))[_0xd120('0x27')](respondWithResult(_0x451296,null))[_0xd120('0x48')](handleError(_0x451296,null));};exports['create']=function(_0x22b288,_0x484d6d){return db['CmList'][_0xd120('0x4a')](_0x22b288['body'],{})[_0xd120('0x27')](function(_0x172d2e){var _0x5a15cf=_0x22b288[_0xd120('0x4b')][_0xd120('0x29')]({'plain':!![]});if(!_0x5a15cf)throw new Error(_0xd120('0x4c'));if(_0x5a15cf[_0xd120('0x4d')]===_0xd120('0x4b')){var _0x3662ab=_0x172d2e['get']({'plain':!![]});var _0x347443='Lists';return db[_0xd120('0x4e')][_0xd120('0x4f')]({'where':{'name':_0x347443,'userProfileId':_0x5a15cf[_0xd120('0x50')]},'raw':!![]})['then'](function(_0x1fa42b){if(_0x1fa42b&&_0x1fa42b[_0xd120('0x51')]===0x0){return db['UserProfileResource'][_0xd120('0x4a')]({'name':_0x3662ab[_0xd120('0x33')],'resourceId':_0x3662ab['id'],'type':_0x1fa42b['name'],'sectionId':_0x1fa42b['id']},{})[_0xd120('0x27')](function(){return _0x172d2e;});}else{return _0x172d2e;}})['catch'](function(_0x16ac86){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x16ac86);throw _0x16ac86;});}return _0x172d2e;})[_0xd120('0x27')](respondWithResult(_0x484d6d,0xc9))[_0xd120('0x48')](handleError(_0x484d6d,null));};exports['update']=function(_0x44ddfe,_0x1d0488){if(_0x44ddfe[_0xd120('0x52')]['id']){delete _0x44ddfe['body']['id'];}return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x44ddfe[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x1d0488,null))['then'](saveUpdates(_0x44ddfe[_0xd120('0x52')],null))[_0xd120('0x27')](respondWithResult(_0x1d0488,null))[_0xd120('0x48')](handleError(_0x1d0488,null));};exports[_0xd120('0x28')]=function(_0x5e5ad4,_0x599b5a){return db[_0xd120('0x43')]['find']({'where':{'id':_0x5e5ad4[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x599b5a,null))['then'](removeEntity(_0x599b5a,null))['catch'](handleError(_0x599b5a,null));};exports[_0xd120('0x54')]=function(_0x47211a,_0x32ee7d){return db[_0xd120('0x43')][_0xd120('0x54')]()[_0xd120('0x27')](respondWithResult(_0x32ee7d,null))['catch'](handleError(_0x32ee7d,null));};exports[_0xd120('0x55')]=function(_0x3ed7a0,_0x375ec5,_0x49dcbe){if(_0x3ed7a0[_0xd120('0x52')]['id']){delete _0x3ed7a0[_0xd120('0x52')]['id'];}return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x3ed7a0[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x375ec5,null))[_0xd120('0x27')](function(_0x32ba89){if(_0x32ba89){_0x3ed7a0['body'][_0xd120('0x56')]=_0x32ba89['id'];return db['Disposition']['create'](_0x3ed7a0[_0xd120('0x52')]);}})['then'](respondWithResult(_0x375ec5,null))[_0xd120('0x48')](handleError(_0x375ec5,null));};exports[_0xd120('0x57')]=function(_0xc4249,_0x4cf1df,_0x5bdb69){var _0x29baa4={'raw':![],'where':{}};var _0x4d6e3d={};var _0x29ff1d={'count':0x0,'rows':[]};return db[_0xd120('0x43')][_0xd120('0x58')]({'where':{'id':_0xc4249['params']['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x4cf1df,null))[_0xd120('0x27')](function(_0x748550){if(_0x748550){_0x4d6e3d[_0xd120('0x32')]=_[_0xd120('0x35')](db['Disposition'][_0xd120('0x2f')]);_0x4d6e3d['query']=_['keys'](_0xc4249[_0xd120('0x34')]);_0x4d6e3d[_0xd120('0x36')]=_[_0xd120('0x37')](_0x4d6e3d[_0xd120('0x32')],_0x4d6e3d['query']);_0x29baa4['attributes']=_[_0xd120('0x37')](_0x4d6e3d[_0xd120('0x32')],qs[_0xd120('0x39')](_0xc4249[_0xd120('0x34')]['fields']));_0x29baa4[_0xd120('0x38')]=_0x29baa4[_0xd120('0x38')]['length']?_0x29baa4[_0xd120('0x38')]:_0x4d6e3d[_0xd120('0x32')];if(!_0xc4249[_0xd120('0x34')]['hasOwnProperty']('nolimit')){_0x29baa4[_0xd120('0x1f')]=qs[_0xd120('0x1f')](_0xc4249[_0xd120('0x34')][_0xd120('0x1f')]);_0x29baa4[_0xd120('0x22')]=qs[_0xd120('0x22')](_0xc4249[_0xd120('0x34')]['offset']);}_0x29baa4[_0xd120('0x3d')]=qs[_0xd120('0x3e')](_0xc4249[_0xd120('0x34')][_0xd120('0x3e')]);_0x29baa4[_0xd120('0x3f')]=qs[_0xd120('0x36')](_[_0xd120('0x40')](_0xc4249[_0xd120('0x34')],_0x4d6e3d[_0xd120('0x36')]));_0x29baa4[_0xd120('0x3f')][_0xd120('0x56')]=_0x748550['id'];if(_0xc4249['query'][_0xd120('0x42')]){_0x29baa4[_0xd120('0x3f')]=_[_0xd120('0x41')](_0x29baa4[_0xd120('0x3f')],{'$or':_[_0xd120('0x2e')](_0x29baa4[_0xd120('0x38')],function(_0x119df3){var _0x24f35b={};_0x24f35b[_0x119df3]={'$like':'%'+_0xc4249[_0xd120('0x34')]['filter']+'%'};return _0x24f35b;})});}_0x29baa4=_[_0xd120('0x41')]({},_0x29baa4,_0xc4249[_0xd120('0x49')]);return db[_0xd120('0x59')][_0xd120('0x21')]({'where':_0x29baa4['where']})['then'](function(_0x16489e){_0x29ff1d[_0xd120('0x21')]=_0x16489e;if(_0xc4249[_0xd120('0x34')][_0xd120('0x44')]){_0x29baa4[_0xd120('0x45')]=[{'all':!![]}];}return db[_0xd120('0x59')]['findAll'](_0x29baa4);})[_0xd120('0x27')](function(_0x505ab9){_0x29ff1d[_0xd120('0x47')]=_0x505ab9;return _0x29ff1d;});}})['then'](respondWithFilteredResult(_0x4cf1df,_0x29baa4))[_0xd120('0x48')](handleError(_0x4cf1df,null));};exports['removeDispositions']=function(_0x5c2999,_0x1eb15e,_0xb591f9){return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x5c2999[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x1eb15e,null))[_0xd120('0x27')](function(_0x2fce00){if(_0x2fce00){return _0x2fce00[_0xd120('0x5a')](_0x5c2999['query'][_0xd120('0x5b')]);}})[_0xd120('0x27')](respondWithStatusCode(_0x1eb15e,null))[_0xd120('0x48')](handleError(_0x1eb15e,null));};exports[_0xd120('0x5c')]=function(_0x4dfc22,_0x43cf97,_0x4b27ca){return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x4dfc22[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x43cf97,null))['then'](function(_0x41c517){if(_0x41c517){var _0x5ae78e=[];var _0x5da7f3={'success':[],'errors':[]};return db['CmContact'][_0xd120('0x54')]()[_0xd120('0x27')](function(_0x39fcb3){if(_0x4dfc22[_0xd120('0x52')]['tags']&&_['isArray'](_0x4dfc22[_0xd120('0x52')][_0xd120('0x5d')])){if(_0x4dfc22[_0xd120('0x52')][_0xd120('0x5d')][_0xd120('0x3a')]){_0x4dfc22[_0xd120('0x52')][_0xd120('0x5d')]=_0x4dfc22[_0xd120('0x52')][_0xd120('0x5d')][_0xd120('0x5e')](';')+';';}else{_0x4dfc22[_0xd120('0x52')][_0xd120('0x5d')]=null;}}else{_0x4dfc22[_0xd120('0x52')][_0xd120('0x5d')]=null;}if(_0x4dfc22[_0xd120('0x52')]&&_['isArray'](_0x4dfc22[_0xd120('0x52')])){for(var _0x56777e=0x0;_0x56777e<_0x4dfc22[_0xd120('0x52')][_0xd120('0x3a')];_0x56777e+=0x1){_0x4dfc22['body'][_0x56777e][_0xd120('0x56')]=_0x4dfc22[_0xd120('0x53')]['id'];_0x5ae78e['push'](_0x4dfc22['body'][_0x56777e]);}return BPromise[_0xd120('0x5f')](_0x5ae78e,function(_0x58de79){return db['CmContact']['create'](_[_0xd120('0x60')](_0x58de79,['ids','id'])||{},{'fields':_[_0xd120('0x35')](_0x39fcb3),'raw':!![]})[_0xd120('0x27')](function(_0x2b80a3){_0x5da7f3[_0xd120('0x61')][_0xd120('0x62')](_0x2b80a3[_0xd120('0x63')]);})[_0xd120('0x48')](function(_0x281d21){_0x5da7f3[_0xd120('0x64')][_0xd120('0x62')]({'data':_0x58de79,'error':_0x281d21[_0xd120('0x65')]});});})['then'](function(_0x41744d){return _0x5da7f3;})[_0xd120('0x48')](function(_0x8949b4){return _0x8949b4;});}else{_0x43cf97[_0xd120('0x1c')](0x190)['json']({'message':_0xd120('0x66')});}});}})[_0xd120('0x27')](respondWithResult(_0x43cf97,null))[_0xd120('0x48')](handleError(_0x43cf97,null));};exports[_0xd120('0x67')]=function(_0x35d4bb,_0x3d671f,_0x53a270){var _0x592243;return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x35d4bb[_0xd120('0x53')]['id']},'include':[{'model':db[_0xd120('0x68')],'as':_0xd120('0x69')}]})[_0xd120('0x27')](handleEntityNotFound(_0x3d671f,null))[_0xd120('0x27')](function(_0x4d53cf){if(_0x4d53cf){_0x592243=_0x4d53cf;return db[_0xd120('0x6a')]['rawAttributes'];}})[_0xd120('0x27')](function(_0x408698){if(_0x408698){var _0x537e23={};var _0x50a539={};_0x50a539[_0xd120('0x32')]=_[_0xd120('0x6b')](_[_0xd120('0x35')](_0x408698),_['map'](_0x592243[_0xd120('0x69')],function(_0x4a59db){return util[_0xd120('0x6c')](_0xd120('0x6d'),_0x4a59db['id']);}));_0x50a539[_0xd120('0x34')]=_[_0xd120('0x35')](_0x35d4bb[_0xd120('0x34')]);_0x50a539[_0xd120('0x36')]=_[_0xd120('0x37')](_0x50a539['model'],_0x50a539[_0xd120('0x34')]);_0x537e23[_0xd120('0x38')]=_[_0xd120('0x37')](_0x50a539['model'],qs[_0xd120('0x39')](_0x35d4bb['query'][_0xd120('0x39')]));_0x537e23[_0xd120('0x38')]=_0x537e23[_0xd120('0x38')][_0xd120('0x3a')]?_0x537e23[_0xd120('0x38')]:_0x50a539[_0xd120('0x32')];if(!_0x35d4bb[_0xd120('0x34')][_0xd120('0x3b')](_0xd120('0x3c'))){_0x537e23[_0xd120('0x1f')]=qs['limit'](_0x35d4bb['query'][_0xd120('0x1f')]);_0x537e23[_0xd120('0x22')]=qs['offset'](_0x35d4bb['query'][_0xd120('0x22')]);}_0x537e23[_0xd120('0x3d')]=qs[_0xd120('0x3e')](_0x35d4bb['query']['sort']);_0x537e23['where']=qs['filters'](_[_0xd120('0x40')](_0x35d4bb['query'],_0x50a539['filters']));_0x537e23['raw']=!![];if(_0x35d4bb['query']['filter']){_0x537e23[_0xd120('0x3f')]=_[_0xd120('0x41')](_0x537e23[_0xd120('0x3f')],{'$or':_[_0xd120('0x2e')](_0x537e23['attributes'],function(_0x278e1c){var _0x5ce071={};_0x5ce071[_0x278e1c]={'$like':'%'+_0x35d4bb[_0xd120('0x34')][_0xd120('0x42')]+'%'};return _0x5ce071;})});}_0x537e23=_[_0xd120('0x41')]({},_0x537e23,_0x35d4bb[_0xd120('0x49')]);return _0x592243['getContacts'](_0x537e23);}})[_0xd120('0x27')](respondWithResult(_0x3d671f,null))[_0xd120('0x48')](handleError(_0x3d671f,null));};exports[_0xd120('0x6e')]=function(_0x417737,_0x1c93b3,_0x8f2606){var _0x2fef66;var _0x5c6d01;var _0x3b0d93;var _0x59a078=_0x417737['params']['id'];csv_results=[];return db[_0xd120('0x6f')][_0xd120('0x46')]({'attributes':['id',_0xd120('0x33')],'raw':!![],'order':[_0xd120('0x70')]})[_0xd120('0x27')](function(_0x32b2a5){_0x2fef66=_0x32b2a5;var _0x5f2aa0=_[_0xd120('0x35')](db[_0xd120('0x6a')][_0xd120('0x2f')]);return db['CmCustomField'][_0xd120('0x46')]({'raw':!![],'attributes':['id',_0xd120('0x71')]})['then'](function(_0x2bae79){_0x5c6d01=_0x2bae79;var _0x3c7427=squel[_0xd120('0x72')]()[_0xd120('0x39')](_0x5f2aa0)['from'](_0xd120('0x73'),'c')[_0xd120('0x3f')]('c.ListId\x20=\x20?',_0x59a078)['where'](_0xd120('0x74'))[_0xd120('0x75')]();for(var _0x2d54a6=0x0;_0x2d54a6<_0x5c6d01[_0xd120('0x3a')];_0x2d54a6++){_0x3c7427[_0xd120('0x76')](_0xd120('0x77')+_0x5c6d01[_0x2d54a6]['id'],_0xd120('0x78')+_0x5c6d01[_0x2d54a6]['alias']);}for(var _0x2d54a6=0x0;_0x2d54a6<_0x2fef66['length'];_0x2d54a6++){_0x3c7427[_0xd120('0x76')](squel[_0xd120('0x72')]()[_0xd120('0x76')](_0xd120('0x79'))[_0xd120('0x7a')](_0xd120('0x7b'))['where']('ItemTypeId\x20=\x20?',_0x2fef66[_0x2d54a6]['id'])[_0xd120('0x3f')](_0xd120('0x7c')),_0xd120('0x7d')+_0x2fef66[_0x2d54a6][_0xd120('0x33')]);_0x3c7427[_0xd120('0x76')](squel[_0xd120('0x72')]()[_0xd120('0x76')](_0xd120('0x7e'))[_0xd120('0x7a')](_0xd120('0x7b'))['where'](_0xd120('0x7f'),_0x2fef66[_0x2d54a6]['id'])['where']('CmContactId\x20=\x20c.id'),_0xd120('0x80')+_0x2fef66[_0x2d54a6][_0xd120('0x33')]);}var _0x43751c=[];_0x43751c['push'](_0x3c7427[_0xd120('0x81')]());BPromise[_0xd120('0x5f')](_0x43751c,handleQuery)[_0xd120('0x27')](function(_0x19b1a5){handleQuery(_0x3c7427[_0xd120('0x81')]());var _0x526162=csv_results[0x0];if(!_['isEmpty'](_0x526162)){var _0x560b08=toCsv(_0x526162);var _0x5c78e6=Date[_0xd120('0x82')]();fs[_0xd120('0x83')](util[_0xd120('0x6c')](_0xd120('0x84'),_0x59a078,_0x5c78e6),_0x560b08);_0x1c93b3[_0xd120('0x85')](_0xd120('0x86'),'attachment;\x20filename='+util['format'](_0xd120('0x87'),_0x59a078,_0x5c78e6));_0x1c93b3[_0xd120('0x85')](_0xd120('0x88'),_0xd120('0x89'));return _0x1c93b3[_0xd120('0x8a')](util[_0xd120('0x6c')](_0xd120('0x84'),_0x59a078,_0x5c78e6));}else{return _0x1c93b3['sendStatus'](0xcc);}});});});};exports[_0xd120('0x8b')]=function(_0x4684db,_0x27a58a,_0x3f6497){var _0x487656;delete _0x4684db[_0xd120('0x52')]['id'];return db[_0xd120('0x43')][_0xd120('0x58')]({'where':{'id':_0x4684db[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x27a58a,null))[_0xd120('0x27')](function(_0x134eb9){if(_0x134eb9){return db[_0xd120('0x8c')]['transaction'](function(_0x504bc8){return db[_0xd120('0x68')][_0xd120('0x4a')](_0x4684db[_0xd120('0x52')],{'transaction':_0x504bc8})[_0xd120('0x27')](function(_0x68d7dd){_0x487656=_0x68d7dd;return _0x134eb9[_0xd120('0x8d')](_0x68d7dd,{'transaction':_0x504bc8});})[_0xd120('0x27')](function(){var _0x41ae5c={'type':db[_0xd120('0x8e')][_0xd120('0x8f')],'transaction':_0x504bc8};switch(_0x4684db[_0xd120('0x52')][_0xd120('0x31')]){case _0xd120('0x90'):_0x41ae5c[_0xd120('0x31')]=db[_0xd120('0x8e')]['TEXT'];break;case _0xd120('0x91'):_0x41ae5c[_0xd120('0x31')]=db[_0xd120('0x8e')][_0xd120('0x92')];break;case _0xd120('0x93'):_0x41ae5c[_0xd120('0x31')]=db[_0xd120('0x8e')]['BOOLEAN'];_0x41ae5c[_0xd120('0x94')]=![];break;default:}return db[_0xd120('0x8c')][_0xd120('0x95')][_0xd120('0x96')](_0xd120('0x73'),util[_0xd120('0x6c')](_0xd120('0x97'),_0x487656['id']),_0x41ae5c);})['then'](function(){return _0x487656;});});}})[_0xd120('0x27')](respondWithResult(_0x27a58a,null))[_0xd120('0x48')](handleError(_0x27a58a,null));};exports[_0xd120('0x98')]=function(_0x4fc0fe,_0x359cbb,_0x4acbd5){var _0x1e7590={};var _0x119fb3={};var _0x5dc219;var _0x299733;return db['CmList'][_0xd120('0x58')]({'where':{'id':_0x4fc0fe[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x359cbb,null))[_0xd120('0x27')](function(_0x12a339){if(_0x12a339){_0x5dc219=_0x12a339;_0x119fb3[_0xd120('0x32')]=_['keys'](db[_0xd120('0x68')][_0xd120('0x2f')]);_0x119fb3[_0xd120('0x34')]=_[_0xd120('0x35')](_0x4fc0fe[_0xd120('0x34')]);_0x119fb3[_0xd120('0x36')]=_['intersection'](_0x119fb3[_0xd120('0x32')],_0x119fb3[_0xd120('0x34')]);_0x1e7590[_0xd120('0x38')]=_['intersection'](_0x119fb3[_0xd120('0x32')],qs[_0xd120('0x39')](_0x4fc0fe[_0xd120('0x34')]['fields']));_0x1e7590[_0xd120('0x38')]=_0x1e7590[_0xd120('0x38')][_0xd120('0x3a')]?_0x1e7590[_0xd120('0x38')]:_0x119fb3[_0xd120('0x32')];_0x1e7590[_0xd120('0x3d')]=qs[_0xd120('0x3e')](_0x4fc0fe['query'][_0xd120('0x3e')]);_0x1e7590[_0xd120('0x3f')]=qs[_0xd120('0x36')](_['pick'](_0x4fc0fe[_0xd120('0x34')],_0x119fb3[_0xd120('0x36')]));_0x1e7590['where']=_[_0xd120('0x41')](_0x1e7590[_0xd120('0x3f')],{'$or':[{'ListId':_0x12a339['id']},{'ListId':null}]});if(_0x4fc0fe['query'][_0xd120('0x42')]){_0x1e7590[_0xd120('0x3f')]=_['merge'](_0x1e7590[_0xd120('0x3f')],{'$or':_[_0xd120('0x2e')](_0x1e7590['attributes'],function(_0x30b462){var _0x354078={};_0x354078[_0x30b462]={'$like':'%'+_0x4fc0fe[_0xd120('0x34')]['filter']+'%'};return _0x354078;})});}_0x1e7590=_[_0xd120('0x41')]({},_0x1e7590,_0x4fc0fe[_0xd120('0x49')]);return db[_0xd120('0x68')]['findAndCountAll'](_0x1e7590);}})[_0xd120('0x27')](respondWithResult(_0x359cbb,null))[_0xd120('0x48')](handleError(_0x359cbb,null));};exports[_0xd120('0x99')]=function(_0x455e37,_0x2a8358){return db[_0xd120('0x68')]['findAndCountAll']({'where':{'ListId':null}})[_0xd120('0x27')](handleEntityNotFound(_0x2a8358,null))[_0xd120('0x27')](function(_0x513896){return _0x513896;})['then'](respondWithResult(_0x2a8358,null))[_0xd120('0x48')](handleError(_0x2a8358,null));};exports[_0xd120('0x9a')]=function(_0x1a47f6,_0x4be98e,_0x2d2e59){return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x1a47f6[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x4be98e,null))['then'](function(_0x27edae){if(_0x27edae){return _0x27edae['addAgents'](_0x1a47f6['body'][_0xd120('0x5b')],_[_0xd120('0x60')](_0x1a47f6[_0xd120('0x52')],[_0xd120('0x5b'),'id'])||{})[_0xd120('0x9b')](function(_0x444ed8){for(var _0x4b2082=0x0;_0x4b2082<_0x1a47f6['body'][_0xd120('0x5b')]['length'];_0x4b2082+=0x1){socket['emit'](_0xd120('0x9c'),{'UserId':Number(_0x1a47f6[_0xd120('0x52')][_0xd120('0x5b')][_0x4b2082]),'CmListId':Number(_0x1a47f6['params']['id'])});}return _0x444ed8;});}})['then'](respondWithResult(_0x4be98e,null))[_0xd120('0x48')](handleError(_0x4be98e,null));};exports['removeAgents']=function(_0x3fb465,_0x1406f0,_0x30c742){return db[_0xd120('0x43')][_0xd120('0x4f')]({'where':{'id':_0x3fb465[_0xd120('0x53')]['id']}})['then'](handleEntityNotFound(_0x1406f0,null))[_0xd120('0x27')](function(_0x36ee5a){if(_0x36ee5a){return _0x36ee5a['removeAgents'](_0x3fb465['query']['ids'])[_0xd120('0x27')](function(){if(_[_0xd120('0x9d')](_0x3fb465[_0xd120('0x34')][_0xd120('0x5b')])){for(var _0x127335=0x0;_0x127335<_0x3fb465[_0xd120('0x34')]['ids']['length'];_0x127335+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x3fb465[_0xd120('0x34')][_0xd120('0x5b')][_0x127335]),'CmListId':Number(_0x3fb465[_0xd120('0x53')]['id'])});}}else{socket[_0xd120('0x9e')](_0xd120('0x9f'),{'UserId':Number(_0x3fb465['query'][_0xd120('0x5b')]),'CmListId':Number(_0x3fb465[_0xd120('0x53')]['id'])});}});}})[_0xd120('0x27')](respondWithStatusCode(_0x1406f0,null))[_0xd120('0x48')](handleError(_0x1406f0,null));};exports[_0xd120('0xa0')]=function(_0x232b74,_0x24882b,_0x148023){var _0x55e44e={};var _0xf23bd9={};var _0x150b06;var _0x54ea2f;return db[_0xd120('0x43')][_0xd120('0x58')]({'where':{'id':_0x232b74[_0xd120('0x53')]['id']}})[_0xd120('0x27')](handleEntityNotFound(_0x24882b,null))[_0xd120('0x27')](function(_0x4a2f87){if(_0x4a2f87){_0x150b06=_0x4a2f87;_0xf23bd9[_0xd120('0x32')]=_[_0xd120('0x35')](db['User'][_0xd120('0x2f')]);_0xf23bd9['query']=_[_0xd120('0x35')](_0x232b74[_0xd120('0x34')]);_0xf23bd9[_0xd120('0x36')]=_[_0xd120('0x37')](_0xf23bd9[_0xd120('0x32')],_0xf23bd9[_0xd120('0x34')]);_0x55e44e[_0xd120('0x38')]=_[_0xd120('0x37')](_0xf23bd9[_0xd120('0x32')],qs[_0xd120('0x39')](_0x232b74['query']['fields']));_0x55e44e[_0xd120('0x38')]=_0x55e44e['attributes']['length']?_0x55e44e[_0xd120('0x38')]:_0xf23bd9['model'];_0x55e44e['order']=qs[_0xd120('0x3e')](_0x232b74[_0xd120('0x34')][_0xd120('0x3e')]);_0x55e44e['where']=qs[_0xd120('0x36')](_[_0xd120('0x40')](_0x232b74[_0xd120('0x34')],_0xf23bd9['filters']));if(_0x232b74[_0xd120('0x34')][_0xd120('0x42')]){_0x55e44e[_0xd120('0x3f')]=_['merge'](_0x55e44e[_0xd120('0x3f')],{'$or':_[_0xd120('0x2e')](_0x55e44e[_0xd120('0x38')],function(_0x5d98b8){var _0x332142={};_0x332142[_0x5d98b8]={'$like':'%'+_0x232b74[_0xd120('0x34')]['filter']+'%'};return _0x332142;})});}_0x55e44e=_[_0xd120('0x41')]({},_0x55e44e,_0x232b74[_0xd120('0x49')]);return _0x150b06[_0xd120('0xa0')](_0x55e44e);}})[_0xd120('0x27')](function(_0x4e33d9){if(_0x4e33d9){_0x54ea2f=_0x4e33d9['length'];if(!_0x232b74[_0xd120('0x34')][_0xd120('0x3b')]('nolimit')){_0x55e44e['limit']=qs[_0xd120('0x1f')](_0x232b74[_0xd120('0x34')][_0xd120('0x1f')]);_0x55e44e['offset']=qs[_0xd120('0x22')](_0x232b74['query']['offset']);}return _0x150b06[_0xd120('0xa0')](_0x55e44e);}})[_0xd120('0x27')](function(_0x315e38){if(_0x315e38){return _0x315e38?{'count':_0x54ea2f,'rows':_0x315e38}:null;}})[_0xd120('0x27')](respondWithResult(_0x24882b,null))[_0xd120('0x48')](handleError(_0x24882b,null));};function handleQuery(_0x173492){logger[_0xd120('0xa1')](_0x173492);return db[_0xd120('0x8c')][_0xd120('0x34')](_0x173492)[_0xd120('0x9b')](function(_0x5a0766){csv_results[_0xd120('0x62')](_0x5a0766);})[_0xd120('0x48')](function(_0x72a78f){logger[_0xd120('0x2c')](_0x72a78f['message']);});} \ No newline at end of file +var _0x9fce=['then','destroy','get','Lists','UserProfileResource','stack','name','send','index','map','CmList','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','findOne','nolimit','removeDispositions','ids','CmContact','tags','join','isArray','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','cm_contacts','distinct','c.cf_','field','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','Content-type','text/csv','addCustomField','sequelize','addCustomFields','TEXT','text','number','INTEGER','switch','Sequelize','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','removeAgents','emit','userCmList:remove','getAgents','info','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x9fce,0x74));var _0xe9fc=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x9fce[_0x5f5cce];return _0x705ecf;};'use strict';var emlformat=require(_0xe9fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9fc('0x1'));var jsonpatch=require(_0xe9fc('0x2'));var rp=require(_0xe9fc('0x3'));var moment=require(_0xe9fc('0x4'));var BPromise=require(_0xe9fc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe9fc('0x6'));var sox=require('sox');var csv=require(_0xe9fc('0x7'));var ejs=require(_0xe9fc('0x8'));var fs=require('fs');var fs_extra=require(_0xe9fc('0x9'));var _=require(_0xe9fc('0xa'));var squel=require(_0xe9fc('0xb'));var crypto=require(_0xe9fc('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9fc('0xd'));var toCsv=require(_0xe9fc('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe9fc('0xe'));var qs=require(_0xe9fc('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe9fc('0x10'));var logger=require(_0xe9fc('0x11'))('api');var utils=require(_0xe9fc('0x12'));var config=require(_0xe9fc('0x13'));var licenseUtil=require(_0xe9fc('0x14'));var db=require(_0xe9fc('0x15'))['db'];var csv_results;config['redis']=_[_0xe9fc('0x16')](config[_0xe9fc('0x17')],{'host':_0xe9fc('0x18'),'port':0x18eb});var socket=require(_0xe9fc('0x19'))(new Redis(config[_0xe9fc('0x17')]));require(_0xe9fc('0x1a'))[_0xe9fc('0x1b')](socket);function respondWithStatusCode(_0xdbaca,_0x4eaaa8){_0x4eaaa8=_0x4eaaa8||0xcc;return function(_0x171774){if(_0x171774){return _0xdbaca[_0xe9fc('0x1c')](_0x4eaaa8);}return _0xdbaca[_0xe9fc('0x1d')](_0x4eaaa8)[_0xe9fc('0x1e')]();};}function respondWithResult(_0x5aebfb,_0x5b906b){_0x5b906b=_0x5b906b||0xc8;return function(_0x48cecb){if(_0x48cecb){return _0x5aebfb['status'](_0x5b906b)[_0xe9fc('0x1f')](_0x48cecb);}};}function respondWithFilteredResult(_0x56e1d7,_0x66e25d){return function(_0x59b732){if(_0x59b732){var _0x42f4b9=typeof _0x66e25d[_0xe9fc('0x20')]===_0xe9fc('0x21')&&typeof _0x66e25d[_0xe9fc('0x22')]===_0xe9fc('0x21');var _0x4c671c=_0x59b732[_0xe9fc('0x23')];var _0x2cd92f=_0x42f4b9?0x0:_0x66e25d[_0xe9fc('0x20')];var _0x3651fa=_0x42f4b9?_0x59b732['count']:_0x66e25d[_0xe9fc('0x20')]+_0x66e25d[_0xe9fc('0x22')];var _0x4c4602;if(_0x3651fa>=_0x4c671c){_0x3651fa=_0x4c671c;_0x4c4602=0xc8;}else{_0x4c4602=0xce;}_0x56e1d7['status'](_0x4c4602);return _0x56e1d7[_0xe9fc('0x24')](_0xe9fc('0x25'),_0x2cd92f+'-'+_0x3651fa+'/'+_0x4c671c)[_0xe9fc('0x1f')](_0x59b732);}return null;};}function patchUpdates(_0x84768d){return function(_0x22399f){try{jsonpatch[_0xe9fc('0x26')](_0x22399f,_0x84768d,!![]);}catch(_0x48e4f3){return BPromise[_0xe9fc('0x27')](_0x48e4f3);}return _0x22399f[_0xe9fc('0x28')]();};}function saveUpdates(_0x17fd28,_0xa8a5c4){return function(_0x24f627){if(_0x24f627){return _0x24f627[_0xe9fc('0x29')](_0x17fd28)[_0xe9fc('0x2a')](function(_0x39b4ca){return _0x39b4ca;});}return null;};}function removeEntity(_0x5466af,_0x48d200){return function(_0x143e5f){if(_0x143e5f){return _0x143e5f[_0xe9fc('0x2b')]()[_0xe9fc('0x2a')](function(){var _0x4e4b1b=_0x143e5f[_0xe9fc('0x2c')]({'plain':!![]});var _0x1b3c62=_0xe9fc('0x2d');return db[_0xe9fc('0x2e')][_0xe9fc('0x2b')]({'where':{'type':_0x1b3c62,'resourceId':_0x4e4b1b['id']}})[_0xe9fc('0x2a')](function(){return _0x143e5f;});})['then'](function(){_0x5466af[_0xe9fc('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23dfed,_0x1fcd6d){return function(_0x54da44){if(!_0x54da44){_0x23dfed[_0xe9fc('0x1c')](0x194);}return _0x54da44;};}function handleError(_0x3abadf,_0x59aacf){_0x59aacf=_0x59aacf||0x1f4;return function(_0x5b8bd9){logger['error'](_0x5b8bd9[_0xe9fc('0x2f')]);if(_0x5b8bd9[_0xe9fc('0x30')]){delete _0x5b8bd9[_0xe9fc('0x30')];}_0x3abadf[_0xe9fc('0x1d')](_0x59aacf)[_0xe9fc('0x31')](_0x5b8bd9);};}exports[_0xe9fc('0x32')]=function(_0x445769,_0x77bce4){var _0x28c449={},_0x568243={},_0x4930aa={'count':0x0,'rows':[]};var _0x26ba84=_[_0xe9fc('0x33')](db[_0xe9fc('0x34')]['rawAttributes'],function(_0x2fc8e1){return{'name':_0x2fc8e1['fieldName'],'type':_0x2fc8e1[_0xe9fc('0x35')]['key']};});_0x568243[_0xe9fc('0x36')]=_[_0xe9fc('0x33')](_0x26ba84,'name');_0x568243[_0xe9fc('0x37')]=_[_0xe9fc('0x38')](_0x445769['query']);_0x568243[_0xe9fc('0x39')]=_[_0xe9fc('0x3a')](_0x568243[_0xe9fc('0x36')],_0x568243[_0xe9fc('0x37')]);_0x28c449[_0xe9fc('0x3b')]=_['intersection'](_0x568243[_0xe9fc('0x36')],qs[_0xe9fc('0x3c')](_0x445769['query'][_0xe9fc('0x3c')]));_0x28c449[_0xe9fc('0x3b')]=_0x28c449[_0xe9fc('0x3b')][_0xe9fc('0x3d')]?_0x28c449['attributes']:_0x568243[_0xe9fc('0x36')];if(!_0x445769['query'][_0xe9fc('0x3e')]('nolimit')){_0x28c449['limit']=qs[_0xe9fc('0x22')](_0x445769[_0xe9fc('0x37')]['limit']);_0x28c449[_0xe9fc('0x20')]=qs[_0xe9fc('0x20')](_0x445769[_0xe9fc('0x37')][_0xe9fc('0x20')]);}_0x28c449[_0xe9fc('0x3f')]=qs['sort'](_0x445769[_0xe9fc('0x37')][_0xe9fc('0x40')]);_0x28c449[_0xe9fc('0x41')]=qs[_0xe9fc('0x39')](_[_0xe9fc('0x42')](_0x445769[_0xe9fc('0x37')],_0x568243[_0xe9fc('0x39')]),_0x26ba84);if(_0x445769['query'][_0xe9fc('0x43')]){_0x28c449[_0xe9fc('0x41')]=_['merge'](_0x28c449[_0xe9fc('0x41')],{'$or':_[_0xe9fc('0x33')](_0x26ba84,function(_0x2bb7a8){if(_0x2bb7a8[_0xe9fc('0x35')]!==_0xe9fc('0x44')){var _0x25516b={};_0x25516b[_0x2bb7a8[_0xe9fc('0x30')]]={'$like':'%'+_0x445769[_0xe9fc('0x37')][_0xe9fc('0x43')]+'%'};return _0x25516b;}})});}_0x28c449=_[_0xe9fc('0x45')]({},_0x28c449,_0x445769[_0xe9fc('0x46')]);var _0x4541d4={'where':_0x28c449['where']};return db[_0xe9fc('0x34')][_0xe9fc('0x23')](_0x4541d4)['then'](function(_0xfca78d){_0x4930aa[_0xe9fc('0x23')]=_0xfca78d;if(_0x445769[_0xe9fc('0x37')][_0xe9fc('0x47')]){_0x28c449[_0xe9fc('0x48')]=[{'all':!![]}];}return db[_0xe9fc('0x34')][_0xe9fc('0x49')](_0x28c449);})[_0xe9fc('0x2a')](function(_0x1ea898){_0x4930aa[_0xe9fc('0x4a')]=_0x1ea898;return _0x4930aa;})[_0xe9fc('0x2a')](respondWithFilteredResult(_0x77bce4,_0x28c449))[_0xe9fc('0x4b')](handleError(_0x77bce4,null));};exports[_0xe9fc('0x4c')]=function(_0x288da4,_0x277c51){var _0x2419ea={'raw':![],'where':{'id':_0x288da4[_0xe9fc('0x4d')]['id']}},_0x14ef64={};_0x14ef64[_0xe9fc('0x36')]=_['keys'](db[_0xe9fc('0x34')][_0xe9fc('0x4e')]);_0x14ef64[_0xe9fc('0x37')]=_['keys'](_0x288da4[_0xe9fc('0x37')]);_0x14ef64[_0xe9fc('0x39')]=_[_0xe9fc('0x3a')](_0x14ef64['model'],_0x14ef64[_0xe9fc('0x37')]);_0x2419ea[_0xe9fc('0x3b')]=_[_0xe9fc('0x3a')](_0x14ef64[_0xe9fc('0x36')],qs['fields'](_0x288da4[_0xe9fc('0x37')][_0xe9fc('0x3c')]));_0x2419ea[_0xe9fc('0x3b')]=_0x2419ea['attributes']['length']?_0x2419ea['attributes']:_0x14ef64[_0xe9fc('0x36')];if(_0x288da4[_0xe9fc('0x37')]['includeAll']){_0x2419ea[_0xe9fc('0x48')]=[{'all':!![]}];}_0x2419ea=_['merge']({},_0x2419ea,_0x288da4[_0xe9fc('0x46')]);return db[_0xe9fc('0x34')][_0xe9fc('0x4f')](_0x2419ea)['then'](handleEntityNotFound(_0x277c51,null))[_0xe9fc('0x2a')](respondWithResult(_0x277c51,null))[_0xe9fc('0x4b')](handleError(_0x277c51,null));};exports[_0xe9fc('0x50')]=function(_0x833c89,_0x209d77){return db['CmList'][_0xe9fc('0x50')](_0x833c89[_0xe9fc('0x51')],{})[_0xe9fc('0x2a')](function(_0x33a848){var _0x3d0729=_0x833c89[_0xe9fc('0x52')]['get']({'plain':!![]});if(!_0x3d0729)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3d0729[_0xe9fc('0x53')]==='user'){var _0x1e4c3a=_0x33a848[_0xe9fc('0x2c')]({'plain':!![]});var _0x1ba8b3=_0xe9fc('0x2d');return db[_0xe9fc('0x54')]['find']({'where':{'name':_0x1ba8b3,'userProfileId':_0x3d0729['userProfileId']},'raw':!![]})['then'](function(_0x477968){if(_0x477968&&_0x477968['autoAssociation']===0x0){return db[_0xe9fc('0x2e')][_0xe9fc('0x50')]({'name':_0x1e4c3a[_0xe9fc('0x30')],'resourceId':_0x1e4c3a['id'],'type':_0x477968['name'],'sectionId':_0x477968['id']},{})['then'](function(){return _0x33a848;});}else{return _0x33a848;}})[_0xe9fc('0x4b')](function(_0x1c3e08){logger[_0xe9fc('0x55')](_0xe9fc('0x56'),_0x1c3e08);throw _0x1c3e08;});}return _0x33a848;})[_0xe9fc('0x2a')](respondWithResult(_0x209d77,0xc9))[_0xe9fc('0x4b')](handleError(_0x209d77,null));};exports[_0xe9fc('0x29')]=function(_0x12591b,_0x362732){if(_0x12591b[_0xe9fc('0x51')]['id']){delete _0x12591b['body']['id'];}return db[_0xe9fc('0x34')]['find']({'where':{'id':_0x12591b[_0xe9fc('0x4d')]['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x362732,null))[_0xe9fc('0x2a')](saveUpdates(_0x12591b[_0xe9fc('0x51')],null))['then'](respondWithResult(_0x362732,null))[_0xe9fc('0x4b')](handleError(_0x362732,null));};exports['destroy']=function(_0x2e81cf,_0xff109c){return db[_0xe9fc('0x34')][_0xe9fc('0x4f')]({'where':{'id':_0x2e81cf['params']['id']}})['then'](handleEntityNotFound(_0xff109c,null))[_0xe9fc('0x2a')](removeEntity(_0xff109c,null))[_0xe9fc('0x4b')](handleError(_0xff109c,null));};exports['describe']=function(_0x4ec53f,_0x27fbd8){return db[_0xe9fc('0x34')][_0xe9fc('0x57')]()[_0xe9fc('0x2a')](respondWithResult(_0x27fbd8,null))[_0xe9fc('0x4b')](handleError(_0x27fbd8,null));};exports[_0xe9fc('0x58')]=function(_0x25598c,_0x16c930,_0x43d178){if(_0x25598c[_0xe9fc('0x51')]['id']){delete _0x25598c['body']['id'];}return db[_0xe9fc('0x34')][_0xe9fc('0x4f')]({'where':{'id':_0x25598c[_0xe9fc('0x4d')]['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x16c930,null))[_0xe9fc('0x2a')](function(_0x566594){if(_0x566594){_0x25598c[_0xe9fc('0x51')][_0xe9fc('0x59')]=_0x566594['id'];return db[_0xe9fc('0x5a')][_0xe9fc('0x50')](_0x25598c[_0xe9fc('0x51')]);}})[_0xe9fc('0x2a')](respondWithResult(_0x16c930,null))[_0xe9fc('0x4b')](handleError(_0x16c930,null));};exports['getDispositions']=function(_0x32814d,_0x1d8d21,_0x6707e4){var _0x3820c5={'raw':![],'where':{}};var _0x1ef08e={};var _0x3afb5a={'count':0x0,'rows':[]};return db[_0xe9fc('0x34')][_0xe9fc('0x5b')]({'where':{'id':_0x32814d[_0xe9fc('0x4d')]['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x1d8d21,null))['then'](function(_0x4e880b){if(_0x4e880b){_0x1ef08e[_0xe9fc('0x36')]=_[_0xe9fc('0x38')](db['Disposition'][_0xe9fc('0x4e')]);_0x1ef08e[_0xe9fc('0x37')]=_[_0xe9fc('0x38')](_0x32814d['query']);_0x1ef08e[_0xe9fc('0x39')]=_[_0xe9fc('0x3a')](_0x1ef08e[_0xe9fc('0x36')],_0x1ef08e[_0xe9fc('0x37')]);_0x3820c5[_0xe9fc('0x3b')]=_[_0xe9fc('0x3a')](_0x1ef08e[_0xe9fc('0x36')],qs[_0xe9fc('0x3c')](_0x32814d['query'][_0xe9fc('0x3c')]));_0x3820c5['attributes']=_0x3820c5[_0xe9fc('0x3b')][_0xe9fc('0x3d')]?_0x3820c5['attributes']:_0x1ef08e[_0xe9fc('0x36')];if(!_0x32814d['query'][_0xe9fc('0x3e')](_0xe9fc('0x5c'))){_0x3820c5[_0xe9fc('0x22')]=qs[_0xe9fc('0x22')](_0x32814d[_0xe9fc('0x37')][_0xe9fc('0x22')]);_0x3820c5[_0xe9fc('0x20')]=qs[_0xe9fc('0x20')](_0x32814d[_0xe9fc('0x37')][_0xe9fc('0x20')]);}_0x3820c5['order']=qs[_0xe9fc('0x40')](_0x32814d['query'][_0xe9fc('0x40')]);_0x3820c5[_0xe9fc('0x41')]=qs[_0xe9fc('0x39')](_[_0xe9fc('0x42')](_0x32814d['query'],_0x1ef08e[_0xe9fc('0x39')]));_0x3820c5['where'][_0xe9fc('0x59')]=_0x4e880b['id'];if(_0x32814d[_0xe9fc('0x37')][_0xe9fc('0x43')]){_0x3820c5[_0xe9fc('0x41')]=_[_0xe9fc('0x45')](_0x3820c5['where'],{'$or':_[_0xe9fc('0x33')](_0x3820c5[_0xe9fc('0x3b')],function(_0x4ce7b9){var _0x461b25={};_0x461b25[_0x4ce7b9]={'$like':'%'+_0x32814d[_0xe9fc('0x37')][_0xe9fc('0x43')]+'%'};return _0x461b25;})});}_0x3820c5=_['merge']({},_0x3820c5,_0x32814d[_0xe9fc('0x46')]);return db['Disposition'][_0xe9fc('0x23')]({'where':_0x3820c5[_0xe9fc('0x41')]})['then'](function(_0x82f21){_0x3afb5a[_0xe9fc('0x23')]=_0x82f21;if(_0x32814d[_0xe9fc('0x37')]['includeAll']){_0x3820c5['include']=[{'all':!![]}];}return db[_0xe9fc('0x5a')][_0xe9fc('0x49')](_0x3820c5);})[_0xe9fc('0x2a')](function(_0x2f6eff){_0x3afb5a[_0xe9fc('0x4a')]=_0x2f6eff;return _0x3afb5a;});}})['then'](respondWithFilteredResult(_0x1d8d21,_0x3820c5))[_0xe9fc('0x4b')](handleError(_0x1d8d21,null));};exports[_0xe9fc('0x5d')]=function(_0x55e531,_0x53352f,_0xf94e5f){return db['CmList'][_0xe9fc('0x4f')]({'where':{'id':_0x55e531['params']['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x53352f,null))[_0xe9fc('0x2a')](function(_0x2ef2e7){if(_0x2ef2e7){return _0x2ef2e7['removeDispositions'](_0x55e531[_0xe9fc('0x37')][_0xe9fc('0x5e')]);}})[_0xe9fc('0x2a')](respondWithStatusCode(_0x53352f,null))[_0xe9fc('0x4b')](handleError(_0x53352f,null));};exports['addContacts']=function(_0xe874bb,_0x1198aa,_0x459faa){return db[_0xe9fc('0x34')][_0xe9fc('0x4f')]({'where':{'id':_0xe874bb['params']['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x1198aa,null))[_0xe9fc('0x2a')](function(_0x31c1ba){if(_0x31c1ba){var _0x4d8833=[];var _0x60250d={'success':[],'errors':[]};return db[_0xe9fc('0x5f')][_0xe9fc('0x57')]()[_0xe9fc('0x2a')](function(_0x5a486e){if(_0xe874bb['body']['tags']&&_['isArray'](_0xe874bb[_0xe9fc('0x51')][_0xe9fc('0x60')])){if(_0xe874bb[_0xe9fc('0x51')][_0xe9fc('0x60')][_0xe9fc('0x3d')]){_0xe874bb[_0xe9fc('0x51')][_0xe9fc('0x60')]=_0xe874bb[_0xe9fc('0x51')]['tags'][_0xe9fc('0x61')](';')+';';}else{_0xe874bb[_0xe9fc('0x51')]['tags']=null;}}else{_0xe874bb[_0xe9fc('0x51')][_0xe9fc('0x60')]=null;}if(_0xe874bb['body']&&_[_0xe9fc('0x62')](_0xe874bb['body'])){for(var _0x27e0f1=0x0;_0x27e0f1<_0xe874bb[_0xe9fc('0x51')][_0xe9fc('0x3d')];_0x27e0f1+=0x1){_0xe874bb['body'][_0x27e0f1]['ListId']=_0xe874bb[_0xe9fc('0x4d')]['id'];_0x4d8833[_0xe9fc('0x63')](_0xe874bb['body'][_0x27e0f1]);}return BPromise[_0xe9fc('0x64')](_0x4d8833,function(_0x41e504){return db[_0xe9fc('0x5f')][_0xe9fc('0x50')](_[_0xe9fc('0x65')](_0x41e504,[_0xe9fc('0x5e'),'id'])||{},{'fields':_['keys'](_0x5a486e),'raw':!![]})[_0xe9fc('0x2a')](function(_0xe333c2){_0x60250d[_0xe9fc('0x66')]['push'](_0xe333c2[_0xe9fc('0x67')]);})['catch'](function(_0x56f5f9){_0x60250d['errors'][_0xe9fc('0x63')]({'data':_0x41e504,'error':_0x56f5f9[_0xe9fc('0x68')]});});})[_0xe9fc('0x2a')](function(_0x1b3d6f){return _0x60250d;})['catch'](function(_0x5bcb13){return _0x5bcb13;});}else{_0x1198aa[_0xe9fc('0x1d')](0x190)['json']({'message':_0xe9fc('0x69')});}});}})[_0xe9fc('0x2a')](respondWithResult(_0x1198aa,null))[_0xe9fc('0x4b')](handleError(_0x1198aa,null));};exports['getContacts']=function(_0x3d2f92,_0x2452fa,_0x1795b8){var _0x7b6347;return db[_0xe9fc('0x34')]['find']({'where':{'id':_0x3d2f92['params']['id']},'include':[{'model':db[_0xe9fc('0x6a')],'as':_0xe9fc('0x6b')}]})[_0xe9fc('0x2a')](handleEntityNotFound(_0x2452fa,null))[_0xe9fc('0x2a')](function(_0x597dad){if(_0x597dad){_0x7b6347=_0x597dad;return db['CmContact'][_0xe9fc('0x4e')];}})[_0xe9fc('0x2a')](function(_0x321a7c){if(_0x321a7c){var _0x14b1f7={};var _0xb16f87={};_0xb16f87[_0xe9fc('0x36')]=_[_0xe9fc('0x6c')](_['keys'](_0x321a7c),_[_0xe9fc('0x33')](_0x7b6347[_0xe9fc('0x6b')],function(_0x2ab755){return util[_0xe9fc('0x6d')](_0xe9fc('0x6e'),_0x2ab755['id']);}));_0xb16f87[_0xe9fc('0x37')]=_[_0xe9fc('0x38')](_0x3d2f92['query']);_0xb16f87['filters']=_[_0xe9fc('0x3a')](_0xb16f87[_0xe9fc('0x36')],_0xb16f87[_0xe9fc('0x37')]);_0x14b1f7['attributes']=_[_0xe9fc('0x3a')](_0xb16f87['model'],qs[_0xe9fc('0x3c')](_0x3d2f92['query'][_0xe9fc('0x3c')]));_0x14b1f7[_0xe9fc('0x3b')]=_0x14b1f7[_0xe9fc('0x3b')][_0xe9fc('0x3d')]?_0x14b1f7[_0xe9fc('0x3b')]:_0xb16f87[_0xe9fc('0x36')];if(!_0x3d2f92[_0xe9fc('0x37')][_0xe9fc('0x3e')](_0xe9fc('0x5c'))){_0x14b1f7['limit']=qs[_0xe9fc('0x22')](_0x3d2f92[_0xe9fc('0x37')][_0xe9fc('0x22')]);_0x14b1f7[_0xe9fc('0x20')]=qs[_0xe9fc('0x20')](_0x3d2f92['query'][_0xe9fc('0x20')]);}_0x14b1f7['order']=qs['sort'](_0x3d2f92['query'][_0xe9fc('0x40')]);_0x14b1f7['where']=qs[_0xe9fc('0x39')](_[_0xe9fc('0x42')](_0x3d2f92[_0xe9fc('0x37')],_0xb16f87[_0xe9fc('0x39')]));_0x14b1f7[_0xe9fc('0x6f')]=!![];if(_0x3d2f92['query']['filter']){_0x14b1f7[_0xe9fc('0x41')]=_[_0xe9fc('0x45')](_0x14b1f7['where'],{'$or':_['map'](_0x14b1f7[_0xe9fc('0x3b')],function(_0x219cf0){var _0x91b745={};_0x91b745[_0x219cf0]={'$like':'%'+_0x3d2f92['query'][_0xe9fc('0x43')]+'%'};return _0x91b745;})});}_0x14b1f7=_[_0xe9fc('0x45')]({},_0x14b1f7,_0x3d2f92[_0xe9fc('0x46')]);return _0x7b6347[_0xe9fc('0x70')](_0x14b1f7);}})[_0xe9fc('0x2a')](respondWithResult(_0x2452fa,null))['catch'](handleError(_0x2452fa,null));};exports[_0xe9fc('0x71')]=function(_0x74c75e,_0x1d1178,_0x4853db){var _0x53eb01;var _0x4c8625;var _0x3976b1;var _0x2b12f5=_0x74c75e['params']['id'];csv_results=[];return db[_0xe9fc('0x72')][_0xe9fc('0x49')]({'attributes':['id',_0xe9fc('0x30')],'raw':!![],'order':[_0xe9fc('0x73')]})[_0xe9fc('0x2a')](function(_0x166c46){_0x53eb01=_0x166c46;var _0x3c1a00=_['keys'](db[_0xe9fc('0x5f')]['rawAttributes']);return db['CmCustomField'][_0xe9fc('0x49')]({'raw':!![],'attributes':['id',_0xe9fc('0x74')]})[_0xe9fc('0x2a')](function(_0x540fac){_0x4c8625=_0x540fac;var _0x50a179=squel['select']()[_0xe9fc('0x3c')](_0x3c1a00)['from'](_0xe9fc('0x75'),'c')[_0xe9fc('0x41')]('c.ListId\x20=\x20?',_0x2b12f5)[_0xe9fc('0x41')]('c.deletedAt\x20is\x20null')[_0xe9fc('0x76')]();for(var _0x18e0a1=0x0;_0x18e0a1<_0x4c8625[_0xe9fc('0x3d')];_0x18e0a1++){_0x50a179['field'](_0xe9fc('0x77')+_0x4c8625[_0x18e0a1]['id'],'customField_'+_0x4c8625[_0x18e0a1]['alias']);}for(var _0x18e0a1=0x0;_0x18e0a1<_0x53eb01[_0xe9fc('0x3d')];_0x18e0a1++){_0x50a179[_0xe9fc('0x78')](squel['select']()[_0xe9fc('0x78')](_0xe9fc('0x79'))[_0xe9fc('0x7a')](_0xe9fc('0x7b'))[_0xe9fc('0x41')](_0xe9fc('0x7c'),_0x53eb01[_0x18e0a1]['id'])[_0xe9fc('0x41')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x53eb01[_0x18e0a1][_0xe9fc('0x30')]);_0x50a179[_0xe9fc('0x78')](squel['select']()['field'](_0xe9fc('0x7d'))[_0xe9fc('0x7a')](_0xe9fc('0x7b'))[_0xe9fc('0x41')](_0xe9fc('0x7c'),_0x53eb01[_0x18e0a1]['id'])[_0xe9fc('0x41')](_0xe9fc('0x7e')),_0xe9fc('0x7f')+_0x53eb01[_0x18e0a1][_0xe9fc('0x30')]);}var _0x50ba76=[];_0x50ba76[_0xe9fc('0x63')](_0x50a179[_0xe9fc('0x80')]());BPromise['each'](_0x50ba76,handleQuery)[_0xe9fc('0x2a')](function(_0x25b855){handleQuery(_0x50a179[_0xe9fc('0x80')]());var _0x351feb=csv_results[0x0];if(!_['isEmpty'](_0x351feb)){var _0x1b7233=toCsv(_0x351feb);var _0x4b984a=Date[_0xe9fc('0x81')]();fs['writeFileSync'](util['format'](_0xe9fc('0x82'),_0x2b12f5,_0x4b984a),_0x1b7233);_0x1d1178[_0xe9fc('0x83')](_0xe9fc('0x84'),'attachment;\x20filename='+util[_0xe9fc('0x6d')]('list_%d_%s.csv',_0x2b12f5,_0x4b984a));_0x1d1178[_0xe9fc('0x83')](_0xe9fc('0x85'),_0xe9fc('0x86'));return _0x1d1178['download'](util[_0xe9fc('0x6d')](_0xe9fc('0x82'),_0x2b12f5,_0x4b984a));}else{return _0x1d1178[_0xe9fc('0x1c')](0xcc);}});});});};exports[_0xe9fc('0x87')]=function(_0x2cffb5,_0x22cf65,_0x48479e){var _0x38bec2;delete _0x2cffb5[_0xe9fc('0x51')]['id'];return db[_0xe9fc('0x34')][_0xe9fc('0x5b')]({'where':{'id':_0x2cffb5['params']['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x22cf65,null))['then'](function(_0x38ca0f){if(_0x38ca0f){return db[_0xe9fc('0x88')]['transaction'](function(_0x48b9d2){return db['CmCustomField'][_0xe9fc('0x50')](_0x2cffb5[_0xe9fc('0x51')],{'transaction':_0x48b9d2})[_0xe9fc('0x2a')](function(_0x18377f){_0x38bec2=_0x18377f;return _0x38ca0f[_0xe9fc('0x89')](_0x18377f,{'transaction':_0x48b9d2});})[_0xe9fc('0x2a')](function(){var _0x243b16={'type':db['Sequelize'][_0xe9fc('0x8a')],'transaction':_0x48b9d2};switch(_0x2cffb5[_0xe9fc('0x51')]['type']){case _0xe9fc('0x8b'):_0x243b16[_0xe9fc('0x35')]=db['Sequelize'][_0xe9fc('0x8a')];break;case _0xe9fc('0x8c'):_0x243b16[_0xe9fc('0x35')]=db['Sequelize'][_0xe9fc('0x8d')];break;case _0xe9fc('0x8e'):_0x243b16[_0xe9fc('0x35')]=db[_0xe9fc('0x8f')][_0xe9fc('0x90')];_0x243b16[_0xe9fc('0x91')]=![];break;default:}return db['sequelize'][_0xe9fc('0x92')]['addColumn'](_0xe9fc('0x75'),util[_0xe9fc('0x6d')](_0xe9fc('0x93'),_0x38bec2['id']),_0x243b16);})[_0xe9fc('0x2a')](function(){return _0x38bec2;});});}})['then'](respondWithResult(_0x22cf65,null))['catch'](handleError(_0x22cf65,null));};exports[_0xe9fc('0x94')]=function(_0x3e4229,_0x10da9b,_0x51190d){var _0x15716f={};var _0x517ec1={};var _0x170707;var _0x40730d;return db[_0xe9fc('0x34')][_0xe9fc('0x5b')]({'where':{'id':_0x3e4229[_0xe9fc('0x4d')]['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x10da9b,null))[_0xe9fc('0x2a')](function(_0x578b9e){if(_0x578b9e){_0x170707=_0x578b9e;_0x517ec1['model']=_[_0xe9fc('0x38')](db['CmCustomField'][_0xe9fc('0x4e')]);_0x517ec1[_0xe9fc('0x37')]=_['keys'](_0x3e4229[_0xe9fc('0x37')]);_0x517ec1[_0xe9fc('0x39')]=_[_0xe9fc('0x3a')](_0x517ec1['model'],_0x517ec1[_0xe9fc('0x37')]);_0x15716f[_0xe9fc('0x3b')]=_[_0xe9fc('0x3a')](_0x517ec1[_0xe9fc('0x36')],qs[_0xe9fc('0x3c')](_0x3e4229[_0xe9fc('0x37')][_0xe9fc('0x3c')]));_0x15716f[_0xe9fc('0x3b')]=_0x15716f[_0xe9fc('0x3b')][_0xe9fc('0x3d')]?_0x15716f[_0xe9fc('0x3b')]:_0x517ec1['model'];_0x15716f['order']=qs[_0xe9fc('0x40')](_0x3e4229[_0xe9fc('0x37')][_0xe9fc('0x40')]);_0x15716f[_0xe9fc('0x41')]=qs[_0xe9fc('0x39')](_[_0xe9fc('0x42')](_0x3e4229[_0xe9fc('0x37')],_0x517ec1[_0xe9fc('0x39')]));_0x15716f[_0xe9fc('0x41')]=_['merge'](_0x15716f[_0xe9fc('0x41')],{'$or':[{'ListId':_0x578b9e['id']},{'ListId':null}]});if(_0x3e4229[_0xe9fc('0x37')][_0xe9fc('0x43')]){_0x15716f[_0xe9fc('0x41')]=_[_0xe9fc('0x45')](_0x15716f[_0xe9fc('0x41')],{'$or':_[_0xe9fc('0x33')](_0x15716f[_0xe9fc('0x3b')],function(_0x3f0a90){var _0x57e4e4={};_0x57e4e4[_0x3f0a90]={'$like':'%'+_0x3e4229[_0xe9fc('0x37')][_0xe9fc('0x43')]+'%'};return _0x57e4e4;})});}_0x15716f=_[_0xe9fc('0x45')]({},_0x15716f,_0x3e4229['options']);return db[_0xe9fc('0x6a')][_0xe9fc('0x95')](_0x15716f);}})[_0xe9fc('0x2a')](respondWithResult(_0x10da9b,null))[_0xe9fc('0x4b')](handleError(_0x10da9b,null));};exports[_0xe9fc('0x96')]=function(_0x17d724,_0x255ae4){return db['CmCustomField'][_0xe9fc('0x95')]({'where':{'ListId':null}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x255ae4,null))['then'](function(_0x1199c7){return _0x1199c7;})['then'](respondWithResult(_0x255ae4,null))['catch'](handleError(_0x255ae4,null));};exports[_0xe9fc('0x97')]=function(_0xaba6c7,_0xa511d6,_0x43e3e3){return db[_0xe9fc('0x34')][_0xe9fc('0x4f')]({'where':{'id':_0xaba6c7[_0xe9fc('0x4d')]['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0xa511d6,null))[_0xe9fc('0x2a')](function(_0x3046f4){if(_0x3046f4){return _0x3046f4[_0xe9fc('0x97')](_0xaba6c7[_0xe9fc('0x51')]['ids'],_[_0xe9fc('0x65')](_0xaba6c7[_0xe9fc('0x51')],[_0xe9fc('0x5e'),'id'])||{})[_0xe9fc('0x98')](function(_0x2a2fbd){for(var _0x73e7c6=0x0;_0x73e7c6<_0xaba6c7[_0xe9fc('0x51')][_0xe9fc('0x5e')]['length'];_0x73e7c6+=0x1){socket['emit']('userCmList:save',{'UserId':Number(_0xaba6c7[_0xe9fc('0x51')][_0xe9fc('0x5e')][_0x73e7c6]),'CmListId':Number(_0xaba6c7[_0xe9fc('0x4d')]['id'])});}return _0x2a2fbd;});}})[_0xe9fc('0x2a')](respondWithResult(_0xa511d6,null))[_0xe9fc('0x4b')](handleError(_0xa511d6,null));};exports[_0xe9fc('0x99')]=function(_0x466473,_0x349af2,_0x1a4c3d){return db['CmList'][_0xe9fc('0x4f')]({'where':{'id':_0x466473[_0xe9fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x349af2,null))[_0xe9fc('0x2a')](function(_0x26ef36){if(_0x26ef36){return _0x26ef36[_0xe9fc('0x99')](_0x466473[_0xe9fc('0x37')][_0xe9fc('0x5e')])[_0xe9fc('0x2a')](function(){if(_[_0xe9fc('0x62')](_0x466473['query'][_0xe9fc('0x5e')])){for(var _0x227385=0x0;_0x227385<_0x466473['query'][_0xe9fc('0x5e')][_0xe9fc('0x3d')];_0x227385+=0x1){socket[_0xe9fc('0x9a')]('userCmList:remove',{'UserId':Number(_0x466473[_0xe9fc('0x37')]['ids'][_0x227385]),'CmListId':Number(_0x466473['params']['id'])});}}else{socket[_0xe9fc('0x9a')](_0xe9fc('0x9b'),{'UserId':Number(_0x466473[_0xe9fc('0x37')]['ids']),'CmListId':Number(_0x466473['params']['id'])});}});}})[_0xe9fc('0x2a')](respondWithStatusCode(_0x349af2,null))[_0xe9fc('0x4b')](handleError(_0x349af2,null));};exports[_0xe9fc('0x9c')]=function(_0x56620b,_0x36d9a1,_0x89b6b2){var _0x1bfe15={};var _0x2c677b={};var _0x5837fe;var _0xb67baa;return db['CmList'][_0xe9fc('0x5b')]({'where':{'id':_0x56620b['params']['id']}})[_0xe9fc('0x2a')](handleEntityNotFound(_0x36d9a1,null))[_0xe9fc('0x2a')](function(_0x5b0ad7){if(_0x5b0ad7){_0x5837fe=_0x5b0ad7;_0x2c677b[_0xe9fc('0x36')]=_[_0xe9fc('0x38')](db['User'][_0xe9fc('0x4e')]);_0x2c677b[_0xe9fc('0x37')]=_[_0xe9fc('0x38')](_0x56620b[_0xe9fc('0x37')]);_0x2c677b[_0xe9fc('0x39')]=_[_0xe9fc('0x3a')](_0x2c677b[_0xe9fc('0x36')],_0x2c677b[_0xe9fc('0x37')]);_0x1bfe15[_0xe9fc('0x3b')]=_[_0xe9fc('0x3a')](_0x2c677b[_0xe9fc('0x36')],qs[_0xe9fc('0x3c')](_0x56620b[_0xe9fc('0x37')][_0xe9fc('0x3c')]));_0x1bfe15['attributes']=_0x1bfe15['attributes'][_0xe9fc('0x3d')]?_0x1bfe15[_0xe9fc('0x3b')]:_0x2c677b[_0xe9fc('0x36')];_0x1bfe15[_0xe9fc('0x3f')]=qs['sort'](_0x56620b[_0xe9fc('0x37')]['sort']);_0x1bfe15['where']=qs[_0xe9fc('0x39')](_[_0xe9fc('0x42')](_0x56620b[_0xe9fc('0x37')],_0x2c677b[_0xe9fc('0x39')]));if(_0x56620b[_0xe9fc('0x37')][_0xe9fc('0x43')]){_0x1bfe15[_0xe9fc('0x41')]=_['merge'](_0x1bfe15['where'],{'$or':_[_0xe9fc('0x33')](_0x1bfe15[_0xe9fc('0x3b')],function(_0x5f58bb){var _0x50bac8={};_0x50bac8[_0x5f58bb]={'$like':'%'+_0x56620b[_0xe9fc('0x37')][_0xe9fc('0x43')]+'%'};return _0x50bac8;})});}_0x1bfe15=_[_0xe9fc('0x45')]({},_0x1bfe15,_0x56620b[_0xe9fc('0x46')]);return _0x5837fe[_0xe9fc('0x9c')](_0x1bfe15);}})[_0xe9fc('0x2a')](function(_0x6cb98c){if(_0x6cb98c){_0xb67baa=_0x6cb98c['length'];if(!_0x56620b[_0xe9fc('0x37')]['hasOwnProperty'](_0xe9fc('0x5c'))){_0x1bfe15[_0xe9fc('0x22')]=qs[_0xe9fc('0x22')](_0x56620b[_0xe9fc('0x37')][_0xe9fc('0x22')]);_0x1bfe15[_0xe9fc('0x20')]=qs[_0xe9fc('0x20')](_0x56620b[_0xe9fc('0x37')]['offset']);}return _0x5837fe['getAgents'](_0x1bfe15);}})[_0xe9fc('0x2a')](function(_0x86805e){if(_0x86805e){return _0x86805e?{'count':_0xb67baa,'rows':_0x86805e}:null;}})[_0xe9fc('0x2a')](respondWithResult(_0x36d9a1,null))[_0xe9fc('0x4b')](handleError(_0x36d9a1,null));};function handleQuery(_0x1d9e9a){logger[_0xe9fc('0x9d')](_0x1d9e9a);return db[_0xe9fc('0x88')][_0xe9fc('0x37')](_0x1d9e9a)[_0xe9fc('0x98')](function(_0x5c60ca){csv_results['push'](_0x5c60ca);})[_0xe9fc('0x4b')](function(_0x232c6c){logger[_0xe9fc('0x55')](_0x232c6c[_0xe9fc('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6ff61a0..976748e 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 _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x9b7a2e,_0x31f874){var _0x2e308f=function(_0x47a1d9){while(--_0x47a1d9){_0x9b7a2e['push'](_0x9b7a2e['shift']());}};_0x2e308f(++_0x31f874);}(_0x814b,0x1a2));var _0xb814=function(_0x269e23,_0x14d11c){_0x269e23=_0x269e23-0x0;var _0x69ad53=_0x814b[_0x269e23];return _0x69ad53;};'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 +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe14b,0x93));var _0xbe14=function(_0x9dc619,_0x1f9954){_0x9dc619=_0x9dc619-0x0;var _0xfcc919=_0xe14b[_0x9dc619];return _0xfcc919;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 5fd0a13..9a72ebf 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 _0xf109=['CmList','cm_lists','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define'];(function(_0x2bbbf6,_0x3df6dd){var _0x39a8cb=function(_0x28f22f){while(--_0x28f22f){_0x2bbbf6['push'](_0x2bbbf6['shift']());}};_0x39a8cb(++_0x3df6dd);}(_0xf109,0xce));var _0x9f10=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0xf109[_0x2adbeb];return _0x5e18a6;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','util','../../config/logger','bluebird'];(function(_0x43ae92,_0x294989){var _0x2971c5=function(_0x55641f){while(--_0x55641f){_0x43ae92['push'](_0x43ae92['shift']());}};_0x2971c5(++_0x294989);}(_0xb821,0xa7));var _0x1b82=function(_0x3d32b7,_0x251e65){_0x3d32b7=_0x3d32b7-0x0;var _0x844e43=_0xb821[_0x3d32b7];return _0x844e43;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('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 532c946..f273070 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 _0xc988=['lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','then','info','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0xc988,0x1c2));var _0x8c98=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xc988[_0x27af45];return _0x18df21;};'use strict';var _=require(_0x8c98('0x0'));var util=require(_0x8c98('0x1'));var moment=require('moment');var BPromise=require(_0x8c98('0x2'));var rs=require(_0x8c98('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c98('0x4'));var logger=require(_0x8c98('0x5'))(_0x8c98('0x6'));var config=require(_0x8c98('0x7'));var jayson=require(_0x8c98('0x8'));var client=jayson[_0x8c98('0x9')][_0x8c98('0xa')]({'port':0x232a});config[_0x8c98('0xb')]=_[_0x8c98('0xc')](config[_0x8c98('0xb')],{'host':_0x8c98('0xd'),'port':0x18eb});var socket=require(_0x8c98('0xe'))(new Redis(config['redis']));require(_0x8c98('0xf'))['register'](socket);function respondWithRpcPromise(_0xa4f9d,_0x24b2b4,_0x4b9c76){return new BPromise(function(_0x514fc4,_0x53a328){return client['request'](_0xa4f9d,_0x4b9c76)[_0x8c98('0x10')](function(_0x53ebe4){logger[_0x8c98('0x11')](_0x8c98('0x12'),_0x24b2b4,_0x8c98('0x13'));logger['debug'](_0x8c98('0x14'),_0x24b2b4,_0x8c98('0x13'),JSON[_0x8c98('0x15')](_0x53ebe4));if(_0x53ebe4[_0x8c98('0x16')]){if(_0x53ebe4[_0x8c98('0x16')][_0x8c98('0x17')]===0x1f4){logger[_0x8c98('0x16')](_0x8c98('0x12'),_0x24b2b4,_0x53ebe4[_0x8c98('0x16')][_0x8c98('0x18')]);return _0x53a328(_0x53ebe4[_0x8c98('0x16')][_0x8c98('0x18')]);}logger['error'](_0x8c98('0x12'),_0x24b2b4,_0x53ebe4[_0x8c98('0x16')][_0x8c98('0x18')]);return _0x514fc4(_0x53ebe4[_0x8c98('0x16')][_0x8c98('0x18')]);}else{logger[_0x8c98('0x11')](_0x8c98('0x12'),_0x24b2b4,'request\x20sent');_0x514fc4(_0x53ebe4['result'][_0x8c98('0x18')]);}})['catch'](function(_0x8be3c3){logger['error'](_0x8c98('0x12'),_0x24b2b4,_0x8be3c3);_0x53a328(_0x8be3c3);});});} \ No newline at end of file +var _0x26bf=['CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','localhost','socket.io-emitter','redis','then','info','request\x20sent','debug'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x26bf,0x9d));var _0xf26b=function(_0x7b4739,_0x5bf951){_0x7b4739=_0x7b4739-0x0;var _0x3c6267=_0x26bf[_0x7b4739];return _0x3c6267;};'use strict';var _=require(_0xf26b('0x0'));var util=require('util');var moment=require(_0xf26b('0x1'));var BPromise=require(_0xf26b('0x2'));var rs=require(_0xf26b('0x3'));var fs=require('fs');var Redis=require(_0xf26b('0x4'));var db=require(_0xf26b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf26b('0x6'))(_0xf26b('0x7'));var config=require('../../config/environment');var jayson=require(_0xf26b('0x8'));var client=jayson['client'][_0xf26b('0x9')]({'port':0x232a});config['redis']=_[_0xf26b('0xa')](config['redis'],{'host':_0xf26b('0xb'),'port':0x18eb});var socket=require(_0xf26b('0xc'))(new Redis(config[_0xf26b('0xd')]));require('./cmList.socket')['register'](socket);function respondWithRpcPromise(_0xda1e19,_0x5d81ac,_0x3b7215){return new BPromise(function(_0x12128e,_0x22de3d){return client['request'](_0xda1e19,_0x3b7215)[_0xf26b('0xe')](function(_0x328ba6){logger[_0xf26b('0xf')]('CmList,\x20%s,\x20%s',_0x5d81ac,_0xf26b('0x10'));logger[_0xf26b('0x11')](_0xf26b('0x12'),_0x5d81ac,'request\x20sent',JSON[_0xf26b('0x13')](_0x328ba6));if(_0x328ba6[_0xf26b('0x14')]){if(_0x328ba6[_0xf26b('0x14')][_0xf26b('0x15')]===0x1f4){logger[_0xf26b('0x14')]('CmList,\x20%s,\x20%s',_0x5d81ac,_0x328ba6[_0xf26b('0x14')][_0xf26b('0x16')]);return _0x22de3d(_0x328ba6[_0xf26b('0x14')][_0xf26b('0x16')]);}logger[_0xf26b('0x14')](_0xf26b('0x17'),_0x5d81ac,_0x328ba6[_0xf26b('0x14')]['message']);return _0x12128e(_0x328ba6[_0xf26b('0x14')][_0xf26b('0x16')]);}else{logger[_0xf26b('0xf')](_0xf26b('0x17'),_0x5d81ac,_0xf26b('0x10'));_0x12128e(_0x328ba6[_0xf26b('0x18')][_0xf26b('0x16')]);}})['catch'](function(_0x18d00f){logger[_0xf26b('0x14')](_0xf26b('0x17'),_0x5d81ac,_0x18d00f);_0x22de3d(_0x18d00f);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 4b682c5..02332fe 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 _0xdee6=['remove','emit','removeListener','register','./cmList.events','save'];(function(_0x123ff8,_0x2b9a42){var _0x2d8b5e=function(_0x970b6f){while(--_0x970b6f){_0x123ff8['push'](_0x123ff8['shift']());}};_0x2d8b5e(++_0x2b9a42);}(_0xdee6,0x9a));var _0x6dee=function(_0x173514,_0x5829c2){_0x173514=_0x173514-0x0;var _0x422d0e=_0xdee6[_0x173514];return _0x422d0e;};'use strict';var CmListEvents=require(_0x6dee('0x0'));var events=[_0x6dee('0x1'),_0x6dee('0x2'),'update'];function createListener(_0x37aa8c,_0x125aa0){return function(_0x413850){_0x125aa0[_0x6dee('0x3')](_0x37aa8c,_0x413850);};}function removeListener(_0x522b6b,_0x4816b1){return function(){CmListEvents[_0x6dee('0x4')](_0x522b6b,_0x4816b1);};}exports[_0x6dee('0x5')]=function(_0x244c24){for(var _0x322a72=0x0,_0x10ad06=events['length'];_0x322a72<_0x10ad06;_0x322a72++){var _0x3fd229=events[_0x322a72];var _0x4f7d85=createListener('cmList:'+_0x3fd229,_0x244c24);CmListEvents['on'](_0x3fd229,_0x4f7d85);}}; \ No newline at end of file +var _0x5390=['./cmList.events','save','remove','update','emit','removeListener','register','length','cmList:'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0x5390,0x144));var _0x0539=function(_0x4941ff,_0x2b0c7f){_0x4941ff=_0x4941ff-0x0;var _0x40cca1=_0x5390[_0x4941ff];return _0x40cca1;};'use strict';var CmListEvents=require(_0x0539('0x0'));var events=[_0x0539('0x1'),_0x0539('0x2'),_0x0539('0x3')];function createListener(_0x218943,_0x162982){return function(_0x2a47c6){_0x162982[_0x0539('0x4')](_0x218943,_0x2a47c6);};}function removeListener(_0x155dd2,_0x3e9bf4){return function(){CmListEvents[_0x0539('0x5')](_0x155dd2,_0x3e9bf4);};}exports[_0x0539('0x6')]=function(_0x938168){for(var _0x3429df=0x0,_0x406e17=events[_0x0539('0x7')];_0x3429df<_0x406e17;_0x3429df++){var _0x2e44c1=events[_0x3429df];var _0x2d9b54=createListener(_0x0539('0x8')+_0x2e44c1,_0x938168);CmListEvents['on'](_0x2e44c1,_0x2d9b54);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 32da166..89fb94c 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 _0x93ea=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','multer'];(function(_0x25d43e,_0x2f586d){var _0x2115f2=function(_0x11e70a){while(--_0x11e70a){_0x25d43e['push'](_0x25d43e['shift']());}};_0x2115f2(++_0x2f586d);}(_0x93ea,0x131));var _0xa93e=function(_0x4ab99,_0x219ed2){_0x4ab99=_0x4ab99-0x0;var _0x29e39c=_0x93ea[_0x4ab99];return _0x29e39c;};'use strict';var multer=require(_0xa93e('0x0'));var util=require(_0xa93e('0x1'));var path=require('path');var timeout=require(_0xa93e('0x2'));var express=require(_0xa93e('0x3'));var router=express['Router']();var fs_extra=require(_0xa93e('0x4'));var auth=require(_0xa93e('0x5'));var interaction=require(_0xa93e('0x6'));var config=require(_0xa93e('0x7'));var controller=require(_0xa93e('0x8'));router[_0xa93e('0x9')]('/',auth[_0xa93e('0xa')](),controller[_0xa93e('0xb')]);router[_0xa93e('0x9')](_0xa93e('0xc'),auth[_0xa93e('0xa')](),controller['describe']);router[_0xa93e('0x9')](_0xa93e('0xd'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0xa93e('0x9')]('/:id',auth[_0xa93e('0xa')](),controller['show']);router[_0xa93e('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xa93e('0xe')]);router[_0xa93e('0x9')](_0xa93e('0xf'),auth['isAuthenticated'](),controller[_0xa93e('0x10')]);router[_0xa93e('0x9')](_0xa93e('0x11'),auth[_0xa93e('0xa')](),controller['getContactsCsv']);router[_0xa93e('0x9')]('/:id/fields',auth['isAuthenticated'](),controller['getCustomFields']);router[_0xa93e('0x9')](_0xa93e('0x12'),auth[_0xa93e('0xa')](),controller[_0xa93e('0x13')]);router[_0xa93e('0x14')]('/',auth['isAuthenticated'](),controller[_0xa93e('0x15')]);router[_0xa93e('0x14')](_0xa93e('0x16'),auth['isAuthenticated'](),controller[_0xa93e('0x17')]);router[_0xa93e('0x14')](_0xa93e('0xf'),auth['isAuthenticated'](),controller[_0xa93e('0x18')]);router['post']('/:id/fields',auth[_0xa93e('0xa')](),controller[_0xa93e('0x19')]);router[_0xa93e('0x14')](_0xa93e('0x12'),auth[_0xa93e('0xa')](),controller[_0xa93e('0x1a')]);router[_0xa93e('0x1b')](_0xa93e('0x1c'),auth['isAuthenticated'](),controller[_0xa93e('0x1d')]);router[_0xa93e('0x1e')](_0xa93e('0x1c'),auth[_0xa93e('0xa')](),controller[_0xa93e('0x1f')]);router['delete'](_0xa93e('0x16'),auth[_0xa93e('0xa')](),controller[_0xa93e('0x20')]);router['delete'](_0xa93e('0x12'),auth[_0xa93e('0xa')](),controller[_0xa93e('0x21')]);module['exports']=router; \ No newline at end of file +var _0x59f1=['removeAgents','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','create','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','/:id/users'];(function(_0x1bd5ca,_0x516492){var _0x17c956=function(_0x238292){while(--_0x238292){_0x1bd5ca['push'](_0x1bd5ca['shift']());}};_0x17c956(++_0x516492);}(_0x59f1,0x199));var _0x159f=function(_0x5c41b0,_0x248c29){_0x5c41b0=_0x5c41b0-0x0;var _0x54d4f5=_0x59f1[_0x5c41b0];return _0x54d4f5;};'use strict';var multer=require('multer');var util=require(_0x159f('0x0'));var path=require('path');var timeout=require(_0x159f('0x1'));var express=require(_0x159f('0x2'));var router=express[_0x159f('0x3')]();var fs_extra=require(_0x159f('0x4'));var auth=require(_0x159f('0x5'));var interaction=require(_0x159f('0x6'));var config=require(_0x159f('0x7'));var controller=require(_0x159f('0x8'));router[_0x159f('0x9')]('/',auth[_0x159f('0xa')](),controller[_0x159f('0xb')]);router['get'](_0x159f('0xc'),auth[_0x159f('0xa')](),controller['describe']);router['get'](_0x159f('0xd'),auth['isAuthenticated'](),controller['getGlobalCustomFields']);router[_0x159f('0x9')]('/:id',auth[_0x159f('0xa')](),controller['show']);router[_0x159f('0x9')](_0x159f('0xe'),auth[_0x159f('0xa')](),controller[_0x159f('0xf')]);router[_0x159f('0x9')](_0x159f('0x10'),auth[_0x159f('0xa')](),controller[_0x159f('0x11')]);router['get'](_0x159f('0x12'),auth['isAuthenticated'](),controller[_0x159f('0x13')]);router[_0x159f('0x9')](_0x159f('0x14'),auth[_0x159f('0xa')](),controller['getCustomFields']);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x159f('0x15')]);router[_0x159f('0x16')]('/',auth['isAuthenticated'](),controller[_0x159f('0x17')]);router['post'](_0x159f('0xe'),auth[_0x159f('0xa')](),controller['addDisposition']);router[_0x159f('0x16')](_0x159f('0x10'),auth['isAuthenticated'](),controller[_0x159f('0x18')]);router['post'](_0x159f('0x14'),auth[_0x159f('0xa')](),controller[_0x159f('0x19')]);router['post']('/:id/users',auth[_0x159f('0xa')](),controller[_0x159f('0x1a')]);router[_0x159f('0x1b')]('/:id',auth[_0x159f('0xa')](),controller[_0x159f('0x1c')]);router[_0x159f('0x1d')]('/:id',auth[_0x159f('0xa')](),controller[_0x159f('0x1e')]);router[_0x159f('0x1d')](_0x159f('0xe'),auth[_0x159f('0xa')](),controller[_0x159f('0x1f')]);router[_0x159f('0x1d')](_0x159f('0x20'),auth['isAuthenticated'](),controller[_0x159f('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 78ac725..4191ba3 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 _0x99f0=['exports','VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x192f9e,_0x2f2243){var _0xa4ca85=function(_0x20e383){while(--_0x20e383){_0x192f9e['push'](_0x192f9e['shift']());}};_0xa4ca85(++_0x2f2243);}(_0x99f0,0xb8));var _0x099f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x99f0[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x099f('0x0'));module[_0x099f('0x1')]={'name':{'type':Sequelize[_0x099f('0x2')],'get':function(_0x1cab35){return this[_0x099f('0x3')]('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x099f('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x15f2=['exports','VIRTUAL','field','STRING'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x15f2,0x13c));var _0x215f=function(_0xeec31d,_0x189f0c){_0xeec31d=_0xeec31d-0x0;var _0x5915e1=_0x15f2[_0xeec31d];return _0x5915e1;};'use strict';var Sequelize=require('sequelize');module[_0x215f('0x0')]={'name':{'type':Sequelize[_0x215f('0x1')],'get':function(_0x54acb6){return this['getDataValue'](_0x215f('0x2'));}},'field':{'type':Sequelize[_0x215f('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x215f('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x215f('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 0131330..d1ad85f 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(_0x500ecf,_0x52a959){var _0x4e97c9=function(_0x5bb5ac){while(--_0x5bb5ac){_0x500ecf['push'](_0x500ecf['shift']());}};_0x4e97c9(++_0x52a959);}(_0x7a54,0x106));var _0x47a5=function(_0x46a582,_0x38b82e){_0x46a582=_0x46a582-0x0;var _0x5465e8=_0x7a54[_0x46a582];return _0x5465e8;};'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 _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(_0x18a848,_0x329eff){var _0x122204=function(_0x80b46d){while(--_0x80b46d){_0x18a848['push'](_0x18a848['shift']());}};_0x122204(++_0x329eff);}(_0x7a54,0x106));var _0x47a5=function(_0x26304e,_0x40d631){_0x26304e=_0x26304e-0x0;var _0x5a2ed2=_0x7a54[_0x26304e];return _0x5a2ed2;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 2f28a33..14f4967 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 _0xc01e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','util'];(function(_0x58a600,_0x1f1e79){var _0xc656ef=function(_0x3e5e6b){while(--_0x3e5e6b){_0x58a600['push'](_0x58a600['shift']());}};_0xc656ef(++_0x1f1e79);}(_0xc01e,0x83));var _0xec01=function(_0xf5b5ff,_0x503a3f){_0xf5b5ff=_0xf5b5ff-0x0;var _0x4e032a=_0xc01e[_0xf5b5ff];return _0x4e032a;};'use strict';var _=require('lodash');var util=require(_0xec01('0x0'));var logger=require('../../config/logger')(_0xec01('0x1'));var moment=require(_0xec01('0x2'));var BPromise=require(_0xec01('0x3'));var rp=require(_0xec01('0x4'));var fs=require('fs');var path=require(_0xec01('0x5'));var rimraf=require(_0xec01('0x6'));var config=require(_0xec01('0x7'));var attributes=require(_0xec01('0x8'));module[_0xec01('0x9')]=function(_0x3737bf,_0x328070){return _0x3737bf[_0xec01('0xa')]('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7210=['define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./condition.attributes','exports'];(function(_0x393909,_0x2e0350){var _0x27d291=function(_0xf11057){while(--_0xf11057){_0x393909['push'](_0x393909['shift']());}};_0x27d291(++_0x2e0350);}(_0x7210,0x18f));var _0x0721=function(_0x5b311b,_0x3e0280){_0x5b311b=_0x5b311b-0x0;var _0x4fa0de=_0x7210[_0x5b311b];return _0x4fa0de;};'use strict';var _=require('lodash');var util=require(_0x0721('0x0'));var logger=require(_0x0721('0x1'))(_0x0721('0x2'));var moment=require(_0x0721('0x3'));var BPromise=require(_0x0721('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0721('0x5'));var config=require(_0x0721('0x6'));var attributes=require(_0x0721('0x7'));module[_0x0721('0x8')]=function(_0x3d0c7a,_0x1d614a){return _0x3d0c7a[_0x0721('0x9')](_0x0721('0xa'),attributes,{'tableName':_0x0721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index 61a77dd..5fd021b 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 _0xf5e5=['stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x3d7c97,_0x5a68b2){var _0x1a3a5b=function(_0x4886d2){while(--_0x4886d2){_0x3d7c97['push'](_0x3d7c97['shift']());}};_0x1a3a5b(++_0x5a68b2);}(_0xf5e5,0x7d));var _0x5f5e=function(_0x519401,_0x3c39ab){_0x519401=_0x519401-0x0;var _0x11e911=_0xf5e5[_0x519401];return _0x11e911;};'use strict';var _=require('lodash');var util=require(_0x5f5e('0x0'));var moment=require('moment');var BPromise=require(_0x5f5e('0x1'));var rs=require(_0x5f5e('0x2'));var fs=require('fs');var Redis=require(_0x5f5e('0x3'));var db=require(_0x5f5e('0x4'))['db'];var utils=require(_0x5f5e('0x5'));var logger=require('../../config/logger')(_0x5f5e('0x6'));var config=require(_0x5f5e('0x7'));var jayson=require(_0x5f5e('0x8'));var client=jayson[_0x5f5e('0x9')][_0x5f5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10e671,_0x3f9232,_0xb8fb35){return new BPromise(function(_0x1452b5,_0x5576f0){return client[_0x5f5e('0xb')](_0x10e671,_0xb8fb35)['then'](function(_0x7d9f0d){logger[_0x5f5e('0xc')](_0x5f5e('0xd'),_0x3f9232,_0x5f5e('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x3f9232,_0x5f5e('0xe'),JSON[_0x5f5e('0xf')](_0x7d9f0d));if(_0x7d9f0d['error']){if(_0x7d9f0d[_0x5f5e('0x10')][_0x5f5e('0x11')]===0x1f4){logger[_0x5f5e('0x10')](_0x5f5e('0xd'),_0x3f9232,_0x7d9f0d[_0x5f5e('0x10')][_0x5f5e('0x12')]);return _0x5576f0(_0x7d9f0d[_0x5f5e('0x10')]['message']);}logger[_0x5f5e('0x10')](_0x5f5e('0xd'),_0x3f9232,_0x7d9f0d[_0x5f5e('0x10')][_0x5f5e('0x12')]);return _0x1452b5(_0x7d9f0d['error']['message']);}else{logger[_0x5f5e('0xc')](_0x5f5e('0xd'),_0x3f9232,_0x5f5e('0xe'));_0x1452b5(_0x7d9f0d[_0x5f5e('0x13')][_0x5f5e('0x12')]);}})['catch'](function(_0x34b50c){logger[_0x5f5e('0x10')](_0x5f5e('0xd'),_0x3f9232,_0x34b50c);_0x5576f0(_0x34b50c);});});} \ No newline at end of file +var _0x5aa1=['result','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0x5aa1,0x151));var _0x15aa=function(_0x277821,_0x441826){_0x277821=_0x277821-0x0;var _0x54025f=_0x5aa1[_0x277821];return _0x54025f;};'use strict';var _=require('lodash');var util=require(_0x15aa('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15aa('0x1'));var fs=require('fs');var Redis=require(_0x15aa('0x2'));var db=require(_0x15aa('0x3'))['db'];var utils=require(_0x15aa('0x4'));var logger=require(_0x15aa('0x5'))(_0x15aa('0x6'));var config=require(_0x15aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x15aa('0x8')][_0x15aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x12eaa8,_0x48c818,_0x4b26da){return new BPromise(function(_0x2c06d7,_0x198398){return client[_0x15aa('0xa')](_0x12eaa8,_0x4b26da)[_0x15aa('0xb')](function(_0x1503db){logger[_0x15aa('0xc')]('Condition,\x20%s,\x20%s',_0x48c818,_0x15aa('0xd'));logger['debug'](_0x15aa('0xe'),_0x48c818,_0x15aa('0xd'),JSON[_0x15aa('0xf')](_0x1503db));if(_0x1503db[_0x15aa('0x10')]){if(_0x1503db[_0x15aa('0x10')][_0x15aa('0x11')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x48c818,_0x1503db[_0x15aa('0x10')][_0x15aa('0x12')]);return _0x198398(_0x1503db['error'][_0x15aa('0x12')]);}logger[_0x15aa('0x10')]('Condition,\x20%s,\x20%s',_0x48c818,_0x1503db[_0x15aa('0x10')][_0x15aa('0x12')]);return _0x2c06d7(_0x1503db[_0x15aa('0x10')][_0x15aa('0x12')]);}else{logger[_0x15aa('0xc')](_0x15aa('0x13'),_0x48c818,_0x15aa('0xd'));_0x2c06d7(_0x1503db[_0x15aa('0x14')]['message']);}})['catch'](function(_0x51f5a2){logger[_0x15aa('0x10')](_0x15aa('0x13'),_0x48c818,_0x51f5a2);_0x198398(_0x51f5a2);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index d828e95..bbf152c 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 _0x8dfb=['../../config/environment','./condition.controller','put','/:id','isAuthenticated','update','destroy','multer','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8dfb,0x187));var _0xb8df=function(_0x9a7d08,_0xe9048){_0x9a7d08=_0x9a7d08-0x0;var _0x58e6e8=_0x8dfb[_0x9a7d08];return _0x58e6e8;};'use strict';var multer=require(_0xb8df('0x0'));var util=require('util');var path=require(_0xb8df('0x1'));var timeout=require(_0xb8df('0x2'));var express=require('express');var router=express[_0xb8df('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb8df('0x4'));var config=require(_0xb8df('0x5'));var controller=require(_0xb8df('0x6'));router[_0xb8df('0x7')](_0xb8df('0x8'),auth[_0xb8df('0x9')](),controller[_0xb8df('0xa')]);router['delete']('/:id',auth[_0xb8df('0x9')](),controller[_0xb8df('0xb')]);module['exports']=router; \ No newline at end of file +var _0x18ed=['../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','delete','exports','util','connect-timeout','express','Router'];(function(_0x3f4f08,_0x373541){var _0x390ca0=function(_0x161bd0){while(--_0x161bd0){_0x3f4f08['push'](_0x3f4f08['shift']());}};_0x390ca0(++_0x373541);}(_0x18ed,0x7e));var _0xd18e=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x18ed[_0x1694f5];return _0x5b4321;};'use strict';var multer=require('multer');var util=require(_0xd18e('0x0'));var path=require('path');var timeout=require(_0xd18e('0x1'));var express=require(_0xd18e('0x2'));var router=express[_0xd18e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd18e('0x4'));var interaction=require(_0xd18e('0x5'));var config=require(_0xd18e('0x6'));var controller=require('./condition.controller');router[_0xd18e('0x7')](_0xd18e('0x8'),auth[_0xd18e('0x9')](),controller[_0xd18e('0xa')]);router[_0xd18e('0xb')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd18e('0xc')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 50c4ba2..6a77eee 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 _0xc35f=['exports','STRING','name','sequelize'];(function(_0x3af588,_0x28c263){var _0x46eca2=function(_0x249ea7){while(--_0x249ea7){_0x3af588['push'](_0x3af588['shift']());}};_0x46eca2(++_0x28c263);}(_0xc35f,0x117));var _0xfc35=function(_0x297df7,_0x3e986d){_0x297df7=_0x297df7-0x0;var _0x1e2bf5=_0xc35f[_0x297df7];return _0x1e2bf5;};'use strict';var Sequelize=require(_0xfc35('0x0'));module[_0xfc35('0x1')]={'name':{'type':Sequelize[_0xfc35('0x2')],'allowNull':![],'unique':_0xfc35('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xfc35('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x47db=['exports','STRING','name','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47db,0xb4));var _0xb47d=function(_0x374b8b,_0x227baf){_0x374b8b=_0x374b8b-0x0;var _0x52bd98=_0x47db[_0x374b8b];return _0x52bd98;};'use strict';var Sequelize=require('sequelize');module[_0xb47d('0x0')]={'name':{'type':Sequelize[_0xb47d('0x1')],'allowNull':![],'unique':_0xb47d('0x2')},'OrderBy':{'type':Sequelize[_0xb47d('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb47d('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index ea2d371..f45e012 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 _0xb44a=['where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ContactItemTypes','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','CmContactHasItem','zip-dir','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','error','stack','name','index','ContactItemType','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0xb44a,0x1c2));var _0xab44=function(_0x58de4a,_0x564dbc){_0x58de4a=_0x58de4a-0x0;var _0x178820=_0xb44a[_0x58de4a];return _0x178820;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xab44('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab44('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xab44('0x2'));var util=require('util');var path=require(_0xab44('0x3'));var sox=require(_0xab44('0x4'));var csv=require(_0xab44('0x5'));var ejs=require(_0xab44('0x6'));var fs=require('fs');var fs_extra=require(_0xab44('0x7'));var _=require(_0xab44('0x8'));var squel=require(_0xab44('0x9'));var crypto=require(_0xab44('0xa'));var jsforce=require(_0xab44('0xb'));var deskjs=require(_0xab44('0xc'));var toCsv=require(_0xab44('0x5'));var querystring=require(_0xab44('0xd'));var Papa=require(_0xab44('0xe'));var Redis=require('ioredis');var authService=require(_0xab44('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xab44('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xab44('0x11'));var utils=require(_0xab44('0x12'));var config=require(_0xab44('0x13'));var licenseUtil=require(_0xab44('0x14'));var db=require(_0xab44('0x15'))['db'];function respondWithStatusCode(_0x237c26,_0x52d282){_0x52d282=_0x52d282||0xcc;return function(_0x57fcff){if(_0x57fcff){return _0x237c26[_0xab44('0x16')](_0x52d282);}return _0x237c26['status'](_0x52d282)[_0xab44('0x17')]();};}function respondWithResult(_0x5ae369,_0x25f611){_0x25f611=_0x25f611||0xc8;return function(_0x15b98a){if(_0x15b98a){return _0x5ae369[_0xab44('0x18')](_0x25f611)[_0xab44('0x19')](_0x15b98a);}};}function respondWithFilteredResult(_0x31404d,_0x41701b){return function(_0x4875df){if(_0x4875df){var _0x51251b=typeof _0x41701b[_0xab44('0x1a')]===_0xab44('0x1b')&&typeof _0x41701b[_0xab44('0x1c')]===_0xab44('0x1b');var _0xffdfbc=_0x4875df[_0xab44('0x1d')];var _0x354b09=_0x51251b?0x0:_0x41701b[_0xab44('0x1a')];var _0x310b15=_0x51251b?_0x4875df[_0xab44('0x1d')]:_0x41701b[_0xab44('0x1a')]+_0x41701b['limit'];var _0xb779bb;if(_0x310b15>=_0xffdfbc){_0x310b15=_0xffdfbc;_0xb779bb=0xc8;}else{_0xb779bb=0xce;}_0x31404d[_0xab44('0x18')](_0xb779bb);return _0x31404d[_0xab44('0x1e')](_0xab44('0x1f'),_0x354b09+'-'+_0x310b15+'/'+_0xffdfbc)[_0xab44('0x19')](_0x4875df);}return null;};}function patchUpdates(_0x5123b1){return function(_0xcd426){try{jsonpatch['apply'](_0xcd426,_0x5123b1,!![]);}catch(_0x1f7311){return BPromise[_0xab44('0x20')](_0x1f7311);}return _0xcd426[_0xab44('0x21')]();};}function saveUpdates(_0x355083,_0x486317){return function(_0x3a2b1d){if(_0x3a2b1d){return _0x3a2b1d[_0xab44('0x22')](_0x355083)[_0xab44('0x23')](function(_0x3b17d5){return _0x3b17d5;});}return null;};}function removeEntity(_0x11f0b,_0x402950){return function(_0x43f1c6){if(_0x43f1c6){return _0x43f1c6['destroy']()['then'](function(){var _0x1d4a2f=_0x43f1c6['get']({'plain':!![]});var _0x2439f3='ContactItemTypes';return db[_0xab44('0x24')]['destroy']({'where':{'type':_0x2439f3,'resourceId':_0x1d4a2f['id']}})['then'](function(){return _0x43f1c6;});})[_0xab44('0x23')](function(){_0x11f0b[_0xab44('0x18')](0xcc)[_0xab44('0x17')]();});}};}function handleEntityNotFound(_0x4620ed,_0x132bf6){return function(_0x4e820c){if(!_0x4e820c){_0x4620ed[_0xab44('0x16')](0x194);}return _0x4e820c;};}function handleError(_0x5587fe,_0x5071f3){_0x5071f3=_0x5071f3||0x1f4;return function(_0x887b0d){logger[_0xab44('0x25')](_0x887b0d[_0xab44('0x26')]);if(_0x887b0d[_0xab44('0x27')]){delete _0x887b0d[_0xab44('0x27')];}_0x5587fe[_0xab44('0x18')](_0x5071f3)['send'](_0x887b0d);};}exports[_0xab44('0x28')]=function(_0x43a42d,_0x36f9b6){var _0x47e1be={},_0x54cac8={},_0x106d3a={'count':0x0,'rows':[]};var _0x5082e4=_['map'](db[_0xab44('0x29')][_0xab44('0x2a')],function(_0x160177){return{'name':_0x160177[_0xab44('0x2b')],'type':_0x160177[_0xab44('0x2c')][_0xab44('0x2d')]};});_0x54cac8[_0xab44('0x2e')]=_[_0xab44('0x2f')](_0x5082e4,_0xab44('0x27'));_0x54cac8[_0xab44('0x30')]=_[_0xab44('0x31')](_0x43a42d[_0xab44('0x30')]);_0x54cac8[_0xab44('0x32')]=_[_0xab44('0x33')](_0x54cac8['model'],_0x54cac8['query']);_0x47e1be[_0xab44('0x34')]=_[_0xab44('0x33')](_0x54cac8['model'],qs[_0xab44('0x35')](_0x43a42d[_0xab44('0x30')][_0xab44('0x35')]));_0x47e1be[_0xab44('0x34')]=_0x47e1be[_0xab44('0x34')][_0xab44('0x36')]?_0x47e1be[_0xab44('0x34')]:_0x54cac8[_0xab44('0x2e')];if(!_0x43a42d[_0xab44('0x30')][_0xab44('0x37')](_0xab44('0x38'))){_0x47e1be[_0xab44('0x1c')]=qs[_0xab44('0x1c')](_0x43a42d[_0xab44('0x30')][_0xab44('0x1c')]);_0x47e1be[_0xab44('0x1a')]=qs[_0xab44('0x1a')](_0x43a42d[_0xab44('0x30')]['offset']);}_0x47e1be[_0xab44('0x39')]=qs[_0xab44('0x3a')](_0x43a42d[_0xab44('0x30')][_0xab44('0x3a')]);_0x47e1be['where']=qs[_0xab44('0x32')](_[_0xab44('0x3b')](_0x43a42d[_0xab44('0x30')],_0x54cac8[_0xab44('0x32')]),_0x5082e4);if(_0x43a42d[_0xab44('0x30')]['filter']){_0x47e1be[_0xab44('0x3c')]=_[_0xab44('0x3d')](_0x47e1be[_0xab44('0x3c')],{'$or':_['map'](_0x5082e4,function(_0x3ef5ea){if(_0x3ef5ea[_0xab44('0x2c')]!==_0xab44('0x3e')){var _0xf80acf={};_0xf80acf[_0x3ef5ea[_0xab44('0x27')]]={'$like':'%'+_0x43a42d['query'][_0xab44('0x3f')]+'%'};return _0xf80acf;}})});}_0x47e1be=_['merge']({},_0x47e1be,_0x43a42d[_0xab44('0x40')]);var _0x4f2b94={'where':_0x47e1be['where']};return db['ContactItemType']['count'](_0x4f2b94)['then'](function(_0x120585){_0x106d3a[_0xab44('0x1d')]=_0x120585;if(_0x43a42d[_0xab44('0x30')][_0xab44('0x41')]){_0x47e1be[_0xab44('0x42')]=[{'all':!![]}];}return db[_0xab44('0x29')][_0xab44('0x43')](_0x47e1be);})[_0xab44('0x23')](function(_0x4429e6){_0x106d3a[_0xab44('0x44')]=_0x4429e6;return _0x106d3a;})['then'](respondWithFilteredResult(_0x36f9b6,_0x47e1be))[_0xab44('0x45')](handleError(_0x36f9b6,null));};exports[_0xab44('0x46')]=function(_0x3cb9fc,_0x9a6da5){var _0x54f603={'raw':!![],'where':{'id':_0x3cb9fc[_0xab44('0x47')]['id']}},_0x3e9a79={};_0x3e9a79[_0xab44('0x2e')]=_[_0xab44('0x31')](db[_0xab44('0x29')][_0xab44('0x2a')]);_0x3e9a79['query']=_['keys'](_0x3cb9fc[_0xab44('0x30')]);_0x3e9a79[_0xab44('0x32')]=_[_0xab44('0x33')](_0x3e9a79[_0xab44('0x2e')],_0x3e9a79[_0xab44('0x30')]);_0x54f603['attributes']=_[_0xab44('0x33')](_0x3e9a79[_0xab44('0x2e')],qs[_0xab44('0x35')](_0x3cb9fc[_0xab44('0x30')]['fields']));_0x54f603[_0xab44('0x34')]=_0x54f603[_0xab44('0x34')][_0xab44('0x36')]?_0x54f603['attributes']:_0x3e9a79[_0xab44('0x2e')];if(_0x3cb9fc[_0xab44('0x30')][_0xab44('0x41')]){_0x54f603[_0xab44('0x42')]=[{'all':!![]}];}_0x54f603=_['merge']({},_0x54f603,_0x3cb9fc[_0xab44('0x40')]);return db['ContactItemType'][_0xab44('0x48')](_0x54f603)[_0xab44('0x23')](handleEntityNotFound(_0x9a6da5,null))[_0xab44('0x23')](respondWithResult(_0x9a6da5,null))[_0xab44('0x45')](handleError(_0x9a6da5,null));};exports['create']=function(_0x328891,_0x5497a3){return db[_0xab44('0x29')][_0xab44('0x49')](_0x328891[_0xab44('0x4a')],{})[_0xab44('0x23')](function(_0x14bd54){var _0x4eeef0=_0x328891[_0xab44('0x4b')]['get']({'plain':!![]});if(!_0x4eeef0)throw new Error(_0xab44('0x4c'));if(_0x4eeef0[_0xab44('0x4d')]===_0xab44('0x4b')){var _0x50b705=_0x14bd54[_0xab44('0x4e')]({'plain':!![]});var _0x105a89=_0xab44('0x4f');return db[_0xab44('0x50')][_0xab44('0x48')]({'where':{'name':_0x105a89,'userProfileId':_0x4eeef0['userProfileId']},'raw':!![]})['then'](function(_0xe5302b){if(_0xe5302b&&_0xe5302b[_0xab44('0x51')]===0x0){return db[_0xab44('0x24')]['create']({'name':_0x50b705[_0xab44('0x27')],'resourceId':_0x50b705['id'],'type':_0xe5302b[_0xab44('0x27')],'sectionId':_0xe5302b['id']},{})[_0xab44('0x23')](function(){return _0x14bd54;});}else{return _0x14bd54;}})[_0xab44('0x45')](function(_0x4eb2eb){logger['error'](_0xab44('0x52'),_0x4eb2eb);throw _0x4eb2eb;});}return _0x14bd54;})[_0xab44('0x23')](respondWithResult(_0x5497a3,0xc9))[_0xab44('0x45')](handleError(_0x5497a3,null));};exports[_0xab44('0x22')]=function(_0x109f38,_0x2234c0){if(_0x109f38[_0xab44('0x4a')]['id']){delete _0x109f38[_0xab44('0x4a')]['id'];}return db['ContactItemType']['find']({'where':{'id':_0x109f38[_0xab44('0x47')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x2234c0,null))[_0xab44('0x23')](saveUpdates(_0x109f38[_0xab44('0x4a')],null))[_0xab44('0x23')](respondWithResult(_0x2234c0,null))[_0xab44('0x45')](handleError(_0x2234c0,null));};exports[_0xab44('0x53')]=function(_0x411bac,_0x1e606b){return db['ContactItemType'][_0xab44('0x48')]({'where':{'id':_0x411bac[_0xab44('0x47')]['id']}})[_0xab44('0x23')](handleEntityNotFound(_0x1e606b,null))[_0xab44('0x23')](db[_0xab44('0x54')][_0xab44('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x411bac[_0xab44('0x47')]['id']}}))[_0xab44('0x23')](removeEntity(_0x1e606b,null))['catch'](handleError(_0x1e606b,null));}; \ No newline at end of file +var _0xb574=['model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','ContactItemType','includeAll','findAll','rows','catch','show','params','intersection','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','get','ContactItemTypes','error','stack','name','send','map','rawAttributes','fieldName','type','query','keys','filters'];(function(_0x38d3ff,_0x220a74){var _0x1b8677=function(_0x21abed){while(--_0x21abed){_0x38d3ff['push'](_0x38d3ff['shift']());}};_0x1b8677(++_0x220a74);}(_0xb574,0x106));var _0x4b57=function(_0x826436,_0x4ee00c){_0x826436=_0x826436-0x0;var _0x16a704=_0xb574[_0x826436];return _0x16a704;};'use strict';var emlformat=require(_0x4b57('0x0'));var rimraf=require(_0x4b57('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b57('0x2'));var rp=require(_0x4b57('0x3'));var moment=require('moment');var BPromise=require(_0x4b57('0x4'));var Mustache=require(_0x4b57('0x5'));var util=require(_0x4b57('0x6'));var path=require(_0x4b57('0x7'));var sox=require(_0x4b57('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b57('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4b57('0xa'));var toCsv=require(_0x4b57('0xb'));var querystring=require(_0x4b57('0xc'));var Papa=require(_0x4b57('0xd'));var Redis=require(_0x4b57('0xe'));var authService=require(_0x4b57('0xf'));var qs=require(_0x4b57('0x10'));var as=require(_0x4b57('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b57('0x12'))(_0x4b57('0x13'));var utils=require(_0x4b57('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4b57('0x15'))['db'];function respondWithStatusCode(_0x357c8b,_0x43d066){_0x43d066=_0x43d066||0xcc;return function(_0xf8a6fc){if(_0xf8a6fc){return _0x357c8b[_0x4b57('0x16')](_0x43d066);}return _0x357c8b[_0x4b57('0x17')](_0x43d066)[_0x4b57('0x18')]();};}function respondWithResult(_0xd5ee6d,_0x31cced){_0x31cced=_0x31cced||0xc8;return function(_0x4e15be){if(_0x4e15be){return _0xd5ee6d['status'](_0x31cced)[_0x4b57('0x19')](_0x4e15be);}};}function respondWithFilteredResult(_0x24f776,_0x10b9ff){return function(_0x58d6bd){if(_0x58d6bd){var _0x284640=typeof _0x10b9ff['offset']===_0x4b57('0x1a')&&typeof _0x10b9ff[_0x4b57('0x1b')]===_0x4b57('0x1a');var _0x10eda5=_0x58d6bd[_0x4b57('0x1c')];var _0xfb71cc=_0x284640?0x0:_0x10b9ff['offset'];var _0x1b35ff=_0x284640?_0x58d6bd[_0x4b57('0x1c')]:_0x10b9ff[_0x4b57('0x1d')]+_0x10b9ff[_0x4b57('0x1b')];var _0x4baaeb;if(_0x1b35ff>=_0x10eda5){_0x1b35ff=_0x10eda5;_0x4baaeb=0xc8;}else{_0x4baaeb=0xce;}_0x24f776[_0x4b57('0x17')](_0x4baaeb);return _0x24f776[_0x4b57('0x1e')](_0x4b57('0x1f'),_0xfb71cc+'-'+_0x1b35ff+'/'+_0x10eda5)[_0x4b57('0x19')](_0x58d6bd);}return null;};}function patchUpdates(_0xef1eae){return function(_0x4454c8){try{jsonpatch['apply'](_0x4454c8,_0xef1eae,!![]);}catch(_0x4b504b){return BPromise[_0x4b57('0x20')](_0x4b504b);}return _0x4454c8[_0x4b57('0x21')]();};}function saveUpdates(_0x567d8f,_0x380554){return function(_0x4a34b2){if(_0x4a34b2){return _0x4a34b2[_0x4b57('0x22')](_0x567d8f)[_0x4b57('0x23')](function(_0x56f017){return _0x56f017;});}return null;};}function removeEntity(_0x271361,_0x368c5f){return function(_0x4d07c9){if(_0x4d07c9){return _0x4d07c9[_0x4b57('0x24')]()[_0x4b57('0x23')](function(){var _0x25d190=_0x4d07c9[_0x4b57('0x25')]({'plain':!![]});var _0x540eff=_0x4b57('0x26');return db['UserProfileResource'][_0x4b57('0x24')]({'where':{'type':_0x540eff,'resourceId':_0x25d190['id']}})['then'](function(){return _0x4d07c9;});})[_0x4b57('0x23')](function(){_0x271361[_0x4b57('0x17')](0xcc)[_0x4b57('0x18')]();});}};}function handleEntityNotFound(_0x6584c4,_0x104f52){return function(_0x392e37){if(!_0x392e37){_0x6584c4['sendStatus'](0x194);}return _0x392e37;};}function handleError(_0x5c3c7a,_0x16d196){_0x16d196=_0x16d196||0x1f4;return function(_0x4c58e4){logger[_0x4b57('0x27')](_0x4c58e4[_0x4b57('0x28')]);if(_0x4c58e4[_0x4b57('0x29')]){delete _0x4c58e4[_0x4b57('0x29')];}_0x5c3c7a[_0x4b57('0x17')](_0x16d196)[_0x4b57('0x2a')](_0x4c58e4);};}exports['index']=function(_0xab365c,_0x2e9922){var _0x68be27={},_0x3cd331={},_0x4ccf89={'count':0x0,'rows':[]};var _0xa91ba=_[_0x4b57('0x2b')](db['ContactItemType'][_0x4b57('0x2c')],function(_0xa5b5dc){return{'name':_0xa5b5dc[_0x4b57('0x2d')],'type':_0xa5b5dc[_0x4b57('0x2e')]['key']};});_0x3cd331['model']=_['map'](_0xa91ba,_0x4b57('0x29'));_0x3cd331[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0xab365c[_0x4b57('0x2f')]);_0x3cd331[_0x4b57('0x31')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],_0x3cd331[_0x4b57('0x2f')]);_0x68be27[_0x4b57('0x33')]=_['intersection'](_0x3cd331[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0xab365c[_0x4b57('0x2f')]['fields']));_0x68be27[_0x4b57('0x33')]=_0x68be27[_0x4b57('0x33')]['length']?_0x68be27[_0x4b57('0x33')]:_0x3cd331[_0x4b57('0x32')];if(!_0xab365c[_0x4b57('0x2f')][_0x4b57('0x35')](_0x4b57('0x36'))){_0x68be27[_0x4b57('0x1b')]=qs['limit'](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1b')]);_0x68be27[_0x4b57('0x1d')]=qs[_0x4b57('0x1d')](_0xab365c[_0x4b57('0x2f')][_0x4b57('0x1d')]);}_0x68be27[_0x4b57('0x37')]=qs['sort'](_0xab365c['query'][_0x4b57('0x38')]);_0x68be27[_0x4b57('0x39')]=qs[_0x4b57('0x31')](_['pick'](_0xab365c[_0x4b57('0x2f')],_0x3cd331[_0x4b57('0x31')]),_0xa91ba);if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]){_0x68be27['where']=_[_0x4b57('0x3b')](_0x68be27[_0x4b57('0x39')],{'$or':_[_0x4b57('0x2b')](_0xa91ba,function(_0x2d24ab){if(_0x2d24ab['type']!=='VIRTUAL'){var _0x5d624c={};_0x5d624c[_0x2d24ab[_0x4b57('0x29')]]={'$like':'%'+_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3a')]+'%'};return _0x5d624c;}})});}_0x68be27=_[_0x4b57('0x3b')]({},_0x68be27,_0xab365c['options']);var _0x445353={'where':_0x68be27[_0x4b57('0x39')]};return db[_0x4b57('0x3c')][_0x4b57('0x1c')](_0x445353)[_0x4b57('0x23')](function(_0x453129){_0x4ccf89[_0x4b57('0x1c')]=_0x453129;if(_0xab365c[_0x4b57('0x2f')][_0x4b57('0x3d')]){_0x68be27['include']=[{'all':!![]}];}return db[_0x4b57('0x3c')][_0x4b57('0x3e')](_0x68be27);})[_0x4b57('0x23')](function(_0x5b2f50){_0x4ccf89[_0x4b57('0x3f')]=_0x5b2f50;return _0x4ccf89;})['then'](respondWithFilteredResult(_0x2e9922,_0x68be27))[_0x4b57('0x40')](handleError(_0x2e9922,null));};exports[_0x4b57('0x41')]=function(_0x457273,_0x19ba66){var _0x189fd0={'raw':!![],'where':{'id':_0x457273[_0x4b57('0x42')]['id']}},_0x477352={};_0x477352[_0x4b57('0x32')]=_[_0x4b57('0x30')](db[_0x4b57('0x3c')][_0x4b57('0x2c')]);_0x477352[_0x4b57('0x2f')]=_[_0x4b57('0x30')](_0x457273['query']);_0x477352['filters']=_[_0x4b57('0x43')](_0x477352[_0x4b57('0x32')],_0x477352[_0x4b57('0x2f')]);_0x189fd0[_0x4b57('0x33')]=_['intersection'](_0x477352[_0x4b57('0x32')],qs[_0x4b57('0x34')](_0x457273['query'][_0x4b57('0x34')]));_0x189fd0['attributes']=_0x189fd0[_0x4b57('0x33')]['length']?_0x189fd0['attributes']:_0x477352[_0x4b57('0x32')];if(_0x457273[_0x4b57('0x2f')]['includeAll']){_0x189fd0[_0x4b57('0x44')]=[{'all':!![]}];}_0x189fd0=_[_0x4b57('0x3b')]({},_0x189fd0,_0x457273[_0x4b57('0x45')]);return db[_0x4b57('0x3c')][_0x4b57('0x46')](_0x189fd0)[_0x4b57('0x23')](handleEntityNotFound(_0x19ba66,null))['then'](respondWithResult(_0x19ba66,null))[_0x4b57('0x40')](handleError(_0x19ba66,null));};exports[_0x4b57('0x47')]=function(_0x4a632c,_0xd529fb){return db[_0x4b57('0x3c')][_0x4b57('0x47')](_0x4a632c['body'],{})[_0x4b57('0x23')](function(_0x5cba5f){var _0x213dca=_0x4a632c[_0x4b57('0x48')][_0x4b57('0x25')]({'plain':!![]});if(!_0x213dca)throw new Error(_0x4b57('0x49'));if(_0x213dca[_0x4b57('0x4a')]===_0x4b57('0x48')){var _0x3d1ecd=_0x5cba5f[_0x4b57('0x25')]({'plain':!![]});var _0x5ab120=_0x4b57('0x26');return db[_0x4b57('0x4b')][_0x4b57('0x46')]({'where':{'name':_0x5ab120,'userProfileId':_0x213dca['userProfileId']},'raw':!![]})[_0x4b57('0x23')](function(_0xcf72b6){if(_0xcf72b6&&_0xcf72b6[_0x4b57('0x4c')]===0x0){return db['UserProfileResource'][_0x4b57('0x47')]({'name':_0x3d1ecd[_0x4b57('0x29')],'resourceId':_0x3d1ecd['id'],'type':_0xcf72b6[_0x4b57('0x29')],'sectionId':_0xcf72b6['id']},{})[_0x4b57('0x23')](function(){return _0x5cba5f;});}else{return _0x5cba5f;}})[_0x4b57('0x40')](function(_0xb7c37c){logger[_0x4b57('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xb7c37c);throw _0xb7c37c;});}return _0x5cba5f;})['then'](respondWithResult(_0xd529fb,0xc9))[_0x4b57('0x40')](handleError(_0xd529fb,null));};exports[_0x4b57('0x22')]=function(_0x3b4cbf,_0x2e64c2){if(_0x3b4cbf['body']['id']){delete _0x3b4cbf[_0x4b57('0x4d')]['id'];}return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x3b4cbf[_0x4b57('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e64c2,null))['then'](saveUpdates(_0x3b4cbf[_0x4b57('0x4d')],null))[_0x4b57('0x23')](respondWithResult(_0x2e64c2,null))['catch'](handleError(_0x2e64c2,null));};exports['destroy']=function(_0x451737,_0x5c1082){return db[_0x4b57('0x3c')][_0x4b57('0x46')]({'where':{'id':_0x451737[_0x4b57('0x42')]['id']}})[_0x4b57('0x23')](handleEntityNotFound(_0x5c1082,null))[_0x4b57('0x23')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x451737['params']['id']}}))['then'](removeEntity(_0x5c1082,null))[_0x4b57('0x40')](handleError(_0x5c1082,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 79104f5..c9c7f88 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 _0x173e=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','ContactItemType','lodash'];(function(_0x3b34eb,_0x2da788){var _0x17392f=function(_0x17496e){while(--_0x17496e){_0x3b34eb['push'](_0x3b34eb['shift']());}};_0x17392f(++_0x2da788);}(_0x173e,0xaf));var _0xe173=function(_0x29885a,_0xc575d6){_0x29885a=_0x29885a-0x0;var _0x5d4458=_0x173e[_0x29885a];return _0x5d4458;};'use strict';var _=require(_0xe173('0x0'));var util=require(_0xe173('0x1'));var logger=require(_0xe173('0x2'))(_0xe173('0x3'));var moment=require(_0xe173('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe173('0x5'));var rimraf=require(_0xe173('0x6'));var config=require(_0xe173('0x7'));var attributes=require('./contactItemType.attributes');module[_0xe173('0x8')]=function(_0x3c1134,_0x5595e8){return _0x3c1134[_0xe173('0x9')](_0xe173('0xa'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8eed=['lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','ContactItemType','tools_contact_item_types'];(function(_0x3fd31e,_0xc1e8a3){var _0x35d214=function(_0x18d699){while(--_0x18d699){_0x3fd31e['push'](_0x3fd31e['shift']());}};_0x35d214(++_0xc1e8a3);}(_0x8eed,0xdc));var _0xd8ee=function(_0x2a85e,_0x1d52af){_0x2a85e=_0x2a85e-0x0;var _0x2ca09b=_0x8eed[_0x2a85e];return _0x2ca09b;};'use strict';var _=require(_0xd8ee('0x0'));var util=require('util');var logger=require(_0xd8ee('0x1'))(_0xd8ee('0x2'));var moment=require('moment');var BPromise=require(_0xd8ee('0x3'));var rp=require(_0xd8ee('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8ee('0x5'));var config=require(_0xd8ee('0x6'));var attributes=require('./contactItemType.attributes');module[_0xd8ee('0x7')]=function(_0x2d3bb8,_0x1b1059){return _0x2d3bb8[_0xd8ee('0x8')](_0xd8ee('0x9'),attributes,{'tableName':_0xd8ee('0xa'),'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 07d341d..daddd0b 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 _0xb3f4=['jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x3722b3,_0x18a764){var _0x4614ae=function(_0x522c8e){while(--_0x522c8e){_0x3722b3['push'](_0x3722b3['shift']());}};_0x4614ae(++_0x18a764);}(_0xb3f4,0x69));var _0x4b3f=function(_0xeb04d7,_0x594e19){_0xeb04d7=_0xeb04d7-0x0;var _0x2157e3=_0xb3f4[_0xeb04d7];return _0x2157e3;};'use strict';var _=require(_0x4b3f('0x0'));var util=require(_0x4b3f('0x1'));var moment=require(_0x4b3f('0x2'));var BPromise=require(_0x4b3f('0x3'));var rs=require(_0x4b3f('0x4'));var fs=require('fs');var Redis=require(_0x4b3f('0x5'));var db=require(_0x4b3f('0x6'))['db'];var utils=require(_0x4b3f('0x7'));var logger=require('../../config/logger')(_0x4b3f('0x8'));var config=require(_0x4b3f('0x9'));var jayson=require(_0x4b3f('0xa'));var client=jayson[_0x4b3f('0xb')][_0x4b3f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3317b6,_0x418b93,_0x21ff6e){return new BPromise(function(_0x1d9cfd,_0x4765d1){return client[_0x4b3f('0xd')](_0x3317b6,_0x21ff6e)[_0x4b3f('0xe')](function(_0x18363e){logger['info'](_0x4b3f('0xf'),_0x418b93,_0x4b3f('0x10'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x418b93,'request\x20sent',JSON[_0x4b3f('0x11')](_0x18363e));if(_0x18363e[_0x4b3f('0x12')]){if(_0x18363e[_0x4b3f('0x12')][_0x4b3f('0x13')]===0x1f4){logger[_0x4b3f('0x12')](_0x4b3f('0xf'),_0x418b93,_0x18363e[_0x4b3f('0x12')][_0x4b3f('0x14')]);return _0x4765d1(_0x18363e[_0x4b3f('0x12')][_0x4b3f('0x14')]);}logger[_0x4b3f('0x12')](_0x4b3f('0xf'),_0x418b93,_0x18363e[_0x4b3f('0x12')]['message']);return _0x1d9cfd(_0x18363e[_0x4b3f('0x12')][_0x4b3f('0x14')]);}else{logger['info']('ContactItemType,\x20%s,\x20%s',_0x418b93,'request\x20sent');_0x1d9cfd(_0x18363e[_0x4b3f('0x15')][_0x4b3f('0x14')]);}})[_0x4b3f('0x16')](function(_0x26a37f){logger[_0x4b3f('0x12')](_0x4b3f('0xf'),_0x418b93,_0x26a37f);_0x4765d1(_0x26a37f);});});} \ No newline at end of file +var _0xe8f8=['then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','request'];(function(_0x489243,_0x256a8a){var _0x70acca=function(_0x2d8834){while(--_0x2d8834){_0x489243['push'](_0x489243['shift']());}};_0x70acca(++_0x256a8a);}(_0xe8f8,0x1da));var _0x8e8f=function(_0x57fbf7,_0x2babe8){_0x57fbf7=_0x57fbf7-0x0;var _0x6699e0=_0xe8f8[_0x57fbf7];return _0x6699e0;};'use strict';var _=require(_0x8e8f('0x0'));var util=require('util');var moment=require(_0x8e8f('0x1'));var BPromise=require('bluebird');var rs=require(_0x8e8f('0x2'));var fs=require('fs');var Redis=require(_0x8e8f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8e8f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x8e8f('0x5'));var jayson=require(_0x8e8f('0x6'));var client=jayson['client'][_0x8e8f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x388dc2,_0x1b227d,_0x42cc11){return new BPromise(function(_0x4ff99c,_0x4a64ea){return client[_0x8e8f('0x8')](_0x388dc2,_0x42cc11)[_0x8e8f('0x9')](function(_0x2d0c2c){logger['info'](_0x8e8f('0xa'),_0x1b227d,_0x8e8f('0xb'));logger[_0x8e8f('0xc')](_0x8e8f('0xd'),_0x1b227d,_0x8e8f('0xb'),JSON[_0x8e8f('0xe')](_0x2d0c2c));if(_0x2d0c2c['error']){if(_0x2d0c2c['error'][_0x8e8f('0xf')]===0x1f4){logger[_0x8e8f('0x10')](_0x8e8f('0xa'),_0x1b227d,_0x2d0c2c[_0x8e8f('0x10')][_0x8e8f('0x11')]);return _0x4a64ea(_0x2d0c2c[_0x8e8f('0x10')][_0x8e8f('0x11')]);}logger[_0x8e8f('0x10')](_0x8e8f('0xa'),_0x1b227d,_0x2d0c2c[_0x8e8f('0x10')][_0x8e8f('0x11')]);return _0x4ff99c(_0x2d0c2c[_0x8e8f('0x10')][_0x8e8f('0x11')]);}else{logger[_0x8e8f('0x12')]('ContactItemType,\x20%s,\x20%s',_0x1b227d,_0x8e8f('0xb'));_0x4ff99c(_0x2d0c2c[_0x8e8f('0x13')]['message']);}})[_0x8e8f('0x14')](function(_0x2e0f47){logger[_0x8e8f('0x10')]('ContactItemType,\x20%s,\x20%s',_0x1b227d,_0x2e0f47);_0x4a64ea(_0x2e0f47);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 86c6115..e2ef761 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 _0xd389=['put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','show','post','create'];(function(_0x3af8fa,_0x183e73){var _0x56808e=function(_0x17af3a){while(--_0x17af3a){_0x3af8fa['push'](_0x3af8fa['shift']());}};_0x56808e(++_0x183e73);}(_0xd389,0xe1));var _0x9d38=function(_0x27815d,_0x10ac7d){_0x27815d=_0x27815d-0x0;var _0x4d4f59=_0xd389[_0x27815d];return _0x4d4f59;};'use strict';var multer=require('multer');var util=require(_0x9d38('0x0'));var path=require('path');var timeout=require(_0x9d38('0x1'));var express=require(_0x9d38('0x2'));var router=express[_0x9d38('0x3')]();var fs_extra=require(_0x9d38('0x4'));var auth=require(_0x9d38('0x5'));var interaction=require(_0x9d38('0x6'));var config=require(_0x9d38('0x7'));var controller=require(_0x9d38('0x8'));router[_0x9d38('0x9')]('/',auth[_0x9d38('0xa')](),controller[_0x9d38('0xb')]);router[_0x9d38('0x9')]('/:id',auth[_0x9d38('0xa')](),controller[_0x9d38('0xc')]);router[_0x9d38('0xd')]('/',auth[_0x9d38('0xa')](),controller[_0x9d38('0xe')]);router[_0x9d38('0xf')](_0x9d38('0x10'),auth[_0x9d38('0xa')](),controller['update']);router[_0x9d38('0x11')](_0x9d38('0x10'),auth[_0x9d38('0xa')](),controller[_0x9d38('0x12')]);module[_0x9d38('0x13')]=router; \ No newline at end of file +var _0x503a=['multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x186b3f,_0x486487){var _0x3d34d8=function(_0x34f700){while(--_0x34f700){_0x186b3f['push'](_0x186b3f['shift']());}};_0x3d34d8(++_0x486487);}(_0x503a,0x1b0));var _0xa503=function(_0x1c37a5,_0x59ee51){_0x1c37a5=_0x1c37a5-0x0;var _0x389d03=_0x503a[_0x1c37a5];return _0x389d03;};'use strict';var multer=require(_0xa503('0x0'));var util=require(_0xa503('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa503('0x2'));var router=express[_0xa503('0x3')]();var fs_extra=require(_0xa503('0x4'));var auth=require(_0xa503('0x5'));var interaction=require(_0xa503('0x6'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xa503('0x7')]('/',auth[_0xa503('0x8')](),controller['index']);router[_0xa503('0x7')](_0xa503('0x9'),auth[_0xa503('0x8')](),controller[_0xa503('0xa')]);router[_0xa503('0xb')]('/',auth[_0xa503('0x8')](),controller[_0xa503('0xc')]);router[_0xa503('0xd')]('/:id',auth[_0xa503('0x8')](),controller[_0xa503('0xe')]);router[_0xa503('0xf')]('/:id',auth[_0xa503('0x8')](),controller[_0xa503('0x10')]);module[_0xa503('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1f98cd9..88bf8a5 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 _0x757a=['exports','STRING'];(function(_0x53d1b4,_0x32a040){var _0x246e07=function(_0x3d8b25){while(--_0x3d8b25){_0x53d1b4['push'](_0x53d1b4['shift']());}};_0x246e07(++_0x32a040);}(_0x757a,0xde));var _0xa757=function(_0x218d69,_0x116064){_0x218d69=_0x218d69-0x0;var _0x35f3bb=_0x757a[_0x218d69];return _0x35f3bb;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x26879e,_0x4c5bb5){var _0x28fff2=function(_0x4bd42a){while(--_0x4bd42a){_0x26879e['push'](_0x26879e['shift']());}};_0x28fff2(++_0x4c5bb5);}(_0x757a,0xde));var _0xa757=function(_0x5b62e2,_0x5bfaad){_0x5b62e2=_0x5b62e2-0x0;var _0x5219f5=_0x757a[_0x5b62e2];return _0x5219f5;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b7bdc33..a95a4b2 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 _0xaef3=['update','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','sort','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','UserProfileResource','destroy','name','index','Dashboard','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','get','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0xaef3,0xa5));var _0x3aef=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xaef3[_0x2e58c7];return _0x26eb00;};'use strict';var emlformat=require(_0x3aef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3aef('0x1'));var jsonpatch=require(_0x3aef('0x2'));var rp=require(_0x3aef('0x3'));var moment=require(_0x3aef('0x4'));var BPromise=require(_0x3aef('0x5'));var Mustache=require(_0x3aef('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3aef('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3aef('0x8'));var _=require(_0x3aef('0x9'));var squel=require(_0x3aef('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3aef('0xb'));var toCsv=require(_0x3aef('0x7'));var querystring=require(_0x3aef('0xc'));var Papa=require(_0x3aef('0xd'));var Redis=require(_0x3aef('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3aef('0xf'));var as=require(_0x3aef('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3aef('0x11'))(_0x3aef('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3aef('0x13'))['db'];config[_0x3aef('0x14')]=_[_0x3aef('0x15')](config['redis'],{'host':_0x3aef('0x16'),'port':0x18eb});var socket=require(_0x3aef('0x17'))(new Redis(config[_0x3aef('0x14')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x1de314,_0x1e4da6){_0x1e4da6=_0x1e4da6||0xcc;return function(_0x35850e){if(_0x35850e){return _0x1de314[_0x3aef('0x18')](_0x1e4da6);}return _0x1de314[_0x3aef('0x19')](_0x1e4da6)['end']();};}function respondWithResult(_0x230b6d,_0x29a06b){_0x29a06b=_0x29a06b||0xc8;return function(_0x2b993d){if(_0x2b993d){return _0x230b6d['status'](_0x29a06b)[_0x3aef('0x1a')](_0x2b993d);}};}function respondWithFilteredResult(_0xf31838,_0x1fc9ee){return function(_0x3b8011){if(_0x3b8011){var _0x90a93c=typeof _0x1fc9ee[_0x3aef('0x1b')]===_0x3aef('0x1c')&&typeof _0x1fc9ee['limit']==='undefined';var _0x48f85a=_0x3b8011[_0x3aef('0x1d')];var _0x3d7f82=_0x90a93c?0x0:_0x1fc9ee[_0x3aef('0x1b')];var _0x4958eb=_0x90a93c?_0x3b8011[_0x3aef('0x1d')]:_0x1fc9ee['offset']+_0x1fc9ee[_0x3aef('0x1e')];var _0x13cbb7;if(_0x4958eb>=_0x48f85a){_0x4958eb=_0x48f85a;_0x13cbb7=0xc8;}else{_0x13cbb7=0xce;}_0xf31838['status'](_0x13cbb7);return _0xf31838[_0x3aef('0x1f')](_0x3aef('0x20'),_0x3d7f82+'-'+_0x4958eb+'/'+_0x48f85a)[_0x3aef('0x1a')](_0x3b8011);}return null;};}function patchUpdates(_0x4caa1e){return function(_0x2bea94){try{jsonpatch[_0x3aef('0x21')](_0x2bea94,_0x4caa1e,!![]);}catch(_0x3402dd){return BPromise['reject'](_0x3402dd);}return _0x2bea94[_0x3aef('0x22')]();};}function saveUpdates(_0xc0c2b6,_0x419741){return function(_0x5d904){if(_0x5d904){return _0x5d904['update'](_0xc0c2b6)['then'](function(_0x18b16a){return _0x18b16a;});}return null;};}function removeEntity(_0x1858c9,_0x4b49f3){return function(_0x4d8c75){if(_0x4d8c75){return _0x4d8c75['destroy']()[_0x3aef('0x23')](function(){var _0x23958a=_0x4d8c75['get']({'plain':!![]});var _0x1fe164='CustomDashboards';return db[_0x3aef('0x24')][_0x3aef('0x25')]({'where':{'type':_0x1fe164,'resourceId':_0x23958a['id']}})['then'](function(){return _0x4d8c75;});})['then'](function(){_0x1858c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x98f5c0,_0x1151dd){return function(_0x17a2d5){if(!_0x17a2d5){_0x98f5c0[_0x3aef('0x18')](0x194);}return _0x17a2d5;};}function handleError(_0x39e503,_0x19dc3c){_0x19dc3c=_0x19dc3c||0x1f4;return function(_0x36ca07){logger['error'](_0x36ca07['stack']);if(_0x36ca07['name']){delete _0x36ca07[_0x3aef('0x26')];}_0x39e503[_0x3aef('0x19')](_0x19dc3c)['send'](_0x36ca07);};}exports[_0x3aef('0x27')]=function(_0x12cc8d,_0x39918){var _0x52c3ca={},_0x2c2796={},_0x591fa5={'count':0x0,'rows':[]};var _0x29dc05=_['map'](db[_0x3aef('0x28')]['rawAttributes'],function(_0x3d3155){return{'name':_0x3d3155[_0x3aef('0x29')],'type':_0x3d3155['type'][_0x3aef('0x2a')]};});_0x2c2796[_0x3aef('0x2b')]=_[_0x3aef('0x2c')](_0x29dc05,_0x3aef('0x26'));_0x2c2796[_0x3aef('0x2d')]=_[_0x3aef('0x2e')](_0x12cc8d[_0x3aef('0x2d')]);_0x2c2796[_0x3aef('0x2f')]=_[_0x3aef('0x30')](_0x2c2796[_0x3aef('0x2b')],_0x2c2796[_0x3aef('0x2d')]);_0x52c3ca[_0x3aef('0x31')]=_[_0x3aef('0x30')](_0x2c2796[_0x3aef('0x2b')],qs[_0x3aef('0x32')](_0x12cc8d[_0x3aef('0x2d')][_0x3aef('0x32')]));_0x52c3ca[_0x3aef('0x31')]=_0x52c3ca[_0x3aef('0x31')]['length']?_0x52c3ca[_0x3aef('0x31')]:_0x2c2796['model'];if(!_0x12cc8d[_0x3aef('0x2d')][_0x3aef('0x33')](_0x3aef('0x34'))){_0x52c3ca[_0x3aef('0x1e')]=qs['limit'](_0x12cc8d[_0x3aef('0x2d')]['limit']);_0x52c3ca['offset']=qs[_0x3aef('0x1b')](_0x12cc8d['query'][_0x3aef('0x1b')]);}_0x52c3ca[_0x3aef('0x35')]=qs['sort'](_0x12cc8d[_0x3aef('0x2d')]['sort']);_0x52c3ca[_0x3aef('0x36')]=qs[_0x3aef('0x2f')](_[_0x3aef('0x37')](_0x12cc8d[_0x3aef('0x2d')],_0x2c2796[_0x3aef('0x2f')]),_0x29dc05);if(_0x12cc8d[_0x3aef('0x2d')][_0x3aef('0x38')]){_0x52c3ca[_0x3aef('0x36')]=_[_0x3aef('0x39')](_0x52c3ca[_0x3aef('0x36')],{'$or':_[_0x3aef('0x2c')](_0x29dc05,function(_0x16acfe){if(_0x16acfe['type']!=='VIRTUAL'){var _0x3f2907={};_0x3f2907[_0x16acfe[_0x3aef('0x26')]]={'$like':'%'+_0x12cc8d['query']['filter']+'%'};return _0x3f2907;}})});}_0x52c3ca=_[_0x3aef('0x39')]({},_0x52c3ca,_0x12cc8d[_0x3aef('0x3a')]);var _0x3dfc8b={'where':_0x52c3ca[_0x3aef('0x36')]};return db[_0x3aef('0x28')][_0x3aef('0x1d')](_0x3dfc8b)[_0x3aef('0x23')](function(_0x2018fa){_0x591fa5['count']=_0x2018fa;if(_0x12cc8d[_0x3aef('0x2d')][_0x3aef('0x3b')]){_0x52c3ca[_0x3aef('0x3c')]=[{'all':!![]}];}return db[_0x3aef('0x28')][_0x3aef('0x3d')](_0x52c3ca);})[_0x3aef('0x23')](function(_0x3e2d2b){_0x591fa5[_0x3aef('0x3e')]=_0x3e2d2b;return _0x591fa5;})[_0x3aef('0x23')](respondWithFilteredResult(_0x39918,_0x52c3ca))[_0x3aef('0x3f')](handleError(_0x39918,null));};exports[_0x3aef('0x40')]=function(_0x2fd654,_0x5e7ad1){var _0x485fc3={'raw':![],'where':{'id':_0x2fd654[_0x3aef('0x41')]['id']}},_0x48a792={};_0x48a792[_0x3aef('0x2b')]=_['keys'](db[_0x3aef('0x28')]['rawAttributes']);_0x48a792[_0x3aef('0x2d')]=_[_0x3aef('0x2e')](_0x2fd654[_0x3aef('0x2d')]);_0x48a792[_0x3aef('0x2f')]=_[_0x3aef('0x30')](_0x48a792[_0x3aef('0x2b')],_0x48a792[_0x3aef('0x2d')]);_0x485fc3[_0x3aef('0x31')]=_['intersection'](_0x48a792['model'],qs[_0x3aef('0x32')](_0x2fd654[_0x3aef('0x2d')][_0x3aef('0x32')]));_0x485fc3[_0x3aef('0x31')]=_0x485fc3[_0x3aef('0x31')][_0x3aef('0x42')]?_0x485fc3[_0x3aef('0x31')]:_0x48a792[_0x3aef('0x2b')];if(_0x2fd654[_0x3aef('0x2d')][_0x3aef('0x3b')]){_0x485fc3[_0x3aef('0x3c')]=[{'all':!![]}];}_0x485fc3=_[_0x3aef('0x39')]({},_0x485fc3,_0x2fd654[_0x3aef('0x3a')]);return db[_0x3aef('0x28')]['find'](_0x485fc3)[_0x3aef('0x23')](handleEntityNotFound(_0x5e7ad1,null))['then'](respondWithResult(_0x5e7ad1,null))[_0x3aef('0x3f')](handleError(_0x5e7ad1,null));};exports[_0x3aef('0x43')]=function(_0x1def19,_0x148db6){return db[_0x3aef('0x28')][_0x3aef('0x43')](_0x1def19[_0x3aef('0x44')],{})[_0x3aef('0x23')](function(_0x3379ab){var _0x5543d7=_0x1def19[_0x3aef('0x45')][_0x3aef('0x46')]({'plain':!![]});if(!_0x5543d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5543d7['role']===_0x3aef('0x45')){var _0x58ce92=_0x3379ab[_0x3aef('0x46')]({'plain':!![]});var _0x2044c4=_0x3aef('0x47');return db[_0x3aef('0x48')][_0x3aef('0x49')]({'where':{'name':_0x2044c4,'userProfileId':_0x5543d7[_0x3aef('0x4a')]},'raw':!![]})[_0x3aef('0x23')](function(_0x30bd06){if(_0x30bd06&&_0x30bd06[_0x3aef('0x4b')]===0x0){return db[_0x3aef('0x24')][_0x3aef('0x43')]({'name':_0x58ce92['name'],'resourceId':_0x58ce92['id'],'type':_0x30bd06['name'],'sectionId':_0x30bd06['id']},{})[_0x3aef('0x23')](function(){return _0x3379ab;});}else{return _0x3379ab;}})[_0x3aef('0x3f')](function(_0x4df8c5){logger[_0x3aef('0x4c')](_0x3aef('0x4d'),_0x4df8c5);throw _0x4df8c5;});}return _0x3379ab;})[_0x3aef('0x23')](respondWithResult(_0x148db6,0xc9))[_0x3aef('0x3f')](handleError(_0x148db6,null));};exports[_0x3aef('0x4e')]=function(_0xa5a8bc,_0x467d2c){var _0x1e98f5={'where':{'id':_0xa5a8bc[_0x3aef('0x41')]['id']}},_0xf4d8d6={};_0xf4d8d6[_0x3aef('0x2b')]=_[_0x3aef('0x2e')](db['Dashboard'][_0x3aef('0x4f')]);_0x1e98f5[_0x3aef('0x31')]=_[_0x3aef('0x30')](_0xf4d8d6[_0x3aef('0x2b')],qs[_0x3aef('0x32')](_0xa5a8bc[_0x3aef('0x2d')]['fields']));_0x1e98f5[_0x3aef('0x31')]=_0x1e98f5['attributes']['length']?_0x1e98f5[_0x3aef('0x31')]:_0xf4d8d6[_0x3aef('0x2b')];if(_0xa5a8bc[_0x3aef('0x2d')][_0x3aef('0x3b')]){_0x1e98f5[_0x3aef('0x3c')]=[{'all':!![]}];}_0x1e98f5=_[_0x3aef('0x39')]({},_0x1e98f5,_0xa5a8bc[_0x3aef('0x3a')]);return db[_0x3aef('0x28')]['find'](_0x1e98f5)[_0x3aef('0x23')](handleEntityNotFound(_0x467d2c,null))[_0x3aef('0x23')](function(_0x4a9971){if(_0x4a9971){var _0x92b064=_0x4a9971[_0x3aef('0x46')]({'plain':!![]});_0x92b064=qs[_0x3aef('0x50')](_0x92b064,['id',_0x3aef('0x51'),_0x3aef('0x52')]);_0xa5a8bc[_0x3aef('0x44')]=_[_0x3aef('0x50')](_0xa5a8bc[_0x3aef('0x44')],['id','createdAt',_0x3aef('0x52')]);return db[_0x3aef('0x28')][_0x3aef('0x43')](_['merge'](_0x92b064,_0xa5a8bc[_0x3aef('0x44')]),{'include':_0xa5a8bc[_0x3aef('0x2d')][_0x3aef('0x3b')]?[{'all':!![]}]:undefined})[_0x3aef('0x23')](function(_0x2de7d4){var _0x4e5a59=_0xa5a8bc[_0x3aef('0x45')][_0x3aef('0x46')]({'plain':!![]});if(!_0x4e5a59)throw new Error(_0x3aef('0x53'));if(_0x4e5a59[_0x3aef('0x54')]==='user'){var _0x779391=_0x2de7d4[_0x3aef('0x46')]({'plain':!![]});var _0x3e4a03=_0x3aef('0x47');return db[_0x3aef('0x48')][_0x3aef('0x49')]({'where':{'name':_0x3e4a03,'userProfileId':_0x4e5a59[_0x3aef('0x4a')]},'raw':!![]})['then'](function(_0x56f777){if(_0x56f777&&_0x56f777[_0x3aef('0x4b')]===0x0){return db['UserProfileResource'][_0x3aef('0x43')]({'name':_0x779391[_0x3aef('0x26')],'resourceId':_0x779391['id'],'type':_0x56f777[_0x3aef('0x26')],'sectionId':_0x56f777['id']},{})[_0x3aef('0x23')](function(){return _0x2de7d4;});}else{return _0x2de7d4;}})[_0x3aef('0x3f')](function(_0x5b60f1){logger[_0x3aef('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b60f1);throw _0x5b60f1;});}return _0x2de7d4;});}})[_0x3aef('0x23')](respondWithResult(_0x467d2c,0xc9))[_0x3aef('0x3f')](handleError(_0x467d2c,null));};exports[_0x3aef('0x55')]=function(_0x28a58a,_0x48a59a){if(_0x28a58a[_0x3aef('0x44')]['id']){delete _0x28a58a['body']['id'];}return db['Dashboard'][_0x3aef('0x49')]({'where':{'id':_0x28a58a[_0x3aef('0x41')]['id']}})['then'](handleEntityNotFound(_0x48a59a,null))[_0x3aef('0x23')](saveUpdates(_0x28a58a['body'],null))['then'](respondWithResult(_0x48a59a,null))[_0x3aef('0x3f')](handleError(_0x48a59a,null));};exports[_0x3aef('0x25')]=function(_0x4cc4ba,_0x5912fd){return db[_0x3aef('0x28')]['find']({'where':{'id':_0x4cc4ba[_0x3aef('0x41')]['id']}})['then'](handleEntityNotFound(_0x5912fd,null))[_0x3aef('0x23')](removeEntity(_0x5912fd,null))[_0x3aef('0x3f')](handleError(_0x5912fd,null));};function widgetAttributes(_0x2bc9f6){try{switch(_0x2bc9f6['type']){case _0x3aef('0x56'):return[{'name':_0x3aef('0x57'),'value':_0x2bc9f6[_0x3aef('0x57')]||(_0x2bc9f6['attrs']&&_0x2bc9f6[_0x3aef('0x58')][0x0]?_0x2bc9f6[_0x3aef('0x58')][0x0][_0x3aef('0x59')]:undefined)||_0x3aef('0x5a')}];case _0x3aef('0x5b'):return[{'name':_0x3aef('0x5c'),'value':_0x2bc9f6[_0x3aef('0x5c')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x0]?_0x2bc9f6[_0x3aef('0x58')][0x0][_0x3aef('0x59')]:undefined)||''}];case _0x3aef('0x5d'):return[{'name':_0x3aef('0x5e'),'value':_0x2bc9f6[_0x3aef('0x5e')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6['attrs'][0x0]?_0x2bc9f6['attrs'][0x0][_0x3aef('0x59')]:undefined)||_0x3aef('0x5f')},{'name':_0x3aef('0x60'),'value':_0x2bc9f6['attrTimezone']||(_0x2bc9f6['attrs']&&_0x2bc9f6[_0x3aef('0x58')][0x1]?_0x2bc9f6['attrs'][0x1][_0x3aef('0x59')]:undefined)||_0x3aef('0x61')},{'name':_0x3aef('0x62'),'value':_0x2bc9f6[_0x3aef('0x62')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x2]?_0x2bc9f6[_0x3aef('0x58')][0x2]['value']:undefined)||0xc}];case _0x3aef('0x63'):return[{'name':_0x3aef('0x64'),'value':_0x2bc9f6[_0x3aef('0x64')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x0]?_0x2bc9f6[_0x3aef('0x58')][0x0][_0x3aef('0x59')]:undefined)||_0x3aef('0x65')},{'name':'attrVoiceQueues','value':_0x2bc9f6[_0x3aef('0x66')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x1]?_0x2bc9f6[_0x3aef('0x58')][0x1]['value']:undefined)||[]},{'name':_0x3aef('0x62'),'value':_0x2bc9f6[_0x3aef('0x62')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6['attrs'][0x2]?_0x2bc9f6[_0x3aef('0x58')][0x2]['value']:undefined)||0x14},{'name':_0x3aef('0x67'),'value':_0x2bc9f6[_0x3aef('0x67')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6['attrs'][0x3]?_0x2bc9f6['attrs'][0x3][_0x3aef('0x59')]:undefined)||_0x3aef('0x68')},{'name':_0x3aef('0x69'),'value':_0x2bc9f6['attrEmailAccounts']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x4]?_0x2bc9f6[_0x3aef('0x58')][0x4][_0x3aef('0x59')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2bc9f6[_0x3aef('0x6a')]||(_0x2bc9f6['attrs']&&_0x2bc9f6[_0x3aef('0x58')][0x5]?_0x2bc9f6[_0x3aef('0x58')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x2bc9f6['attrSmsAccounts']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x6]?_0x2bc9f6[_0x3aef('0x58')][0x6]['value']:undefined)||''},{'name':_0x3aef('0x6b'),'value':_0x2bc9f6[_0x3aef('0x6b')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x7]?_0x2bc9f6[_0x3aef('0x58')][0x7][_0x3aef('0x59')]:undefined)||''},{'name':_0x3aef('0x6c'),'value':_0x2bc9f6[_0x3aef('0x6c')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x8]?_0x2bc9f6['attrs'][0x8][_0x3aef('0x59')]:undefined)||''},{'name':_0x3aef('0x6d'),'value':_0x2bc9f6[_0x3aef('0x6d')]||(_0x2bc9f6['attrs']&&_0x2bc9f6[_0x3aef('0x58')][0x9]?_0x2bc9f6[_0x3aef('0x58')][0x9][_0x3aef('0x59')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x3aef('0x6e'),'value':_0x2bc9f6['attrSerie1']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x0]?_0x2bc9f6[_0x3aef('0x58')][0x0][_0x3aef('0x59')]:undefined)||'total'},{'name':_0x3aef('0x6f'),'value':_0x2bc9f6[_0x3aef('0x6f')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x1]?_0x2bc9f6[_0x3aef('0x58')][0x1]['value']:undefined)||null},{'name':_0x3aef('0x70'),'value':_0x2bc9f6[_0x3aef('0x70')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x2]?_0x2bc9f6['attrs'][0x2][_0x3aef('0x59')]:undefined)||null},{'name':_0x3aef('0x66'),'value':_0x2bc9f6[_0x3aef('0x66')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x3]?_0x2bc9f6['attrs'][0x3][_0x3aef('0x59')]:undefined)||[]},{'name':_0x3aef('0x67'),'value':_0x2bc9f6['attrChannel']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x4]?_0x2bc9f6['attrs'][0x4][_0x3aef('0x59')]:undefined)||_0x3aef('0x68')},{'name':_0x3aef('0x69'),'value':_0x2bc9f6['attrEmailAccounts']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6['attrs'][0x5]?_0x2bc9f6[_0x3aef('0x58')][0x5][_0x3aef('0x59')]:undefined)||''},{'name':_0x3aef('0x6a'),'value':_0x2bc9f6[_0x3aef('0x6a')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x6]?_0x2bc9f6[_0x3aef('0x58')][0x6][_0x3aef('0x59')]:undefined)||''},{'name':_0x3aef('0x71'),'value':_0x2bc9f6['attrSmsAccounts']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x7]?_0x2bc9f6[_0x3aef('0x58')][0x7][_0x3aef('0x59')]:undefined)||''},{'name':_0x3aef('0x6b'),'value':_0x2bc9f6[_0x3aef('0x6b')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x8]?_0x2bc9f6[_0x3aef('0x58')][0x8]['value']:undefined)||''},{'name':_0x3aef('0x6c'),'value':_0x2bc9f6[_0x3aef('0x6c')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x9]?_0x2bc9f6[_0x3aef('0x58')][0x9][_0x3aef('0x59')]:undefined)||''},{'name':_0x3aef('0x6d'),'value':_0x2bc9f6[_0x3aef('0x6d')]||(_0x2bc9f6['attrs']&&_0x2bc9f6['attrs'][0xa]?_0x2bc9f6[_0x3aef('0x58')][0xa][_0x3aef('0x59')]:undefined)||''}];case _0x3aef('0x72'):return[{'name':_0x3aef('0x73'),'type':_0x2bc9f6[_0x3aef('0x74')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6['attrs'][0x0]?_0x2bc9f6[_0x3aef('0x58')][0x0]['type']:undefined)||null,'value':_0x2bc9f6[_0x3aef('0x73')]||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x0]?_0x2bc9f6[_0x3aef('0x58')][0x0][_0x3aef('0x59')]:undefined)||null},{'name':'attrRefresh','value':_0x2bc9f6['attrRefresh']||(_0x2bc9f6[_0x3aef('0x58')]&&_0x2bc9f6[_0x3aef('0x58')][0x1]?_0x2bc9f6[_0x3aef('0x58')][0x1][_0x3aef('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x4272bd){logger['error'](_0x3aef('0x75'),JSON[_0x3aef('0x76')](_0x4272bd));return[];}}exports[_0x3aef('0x77')]=function(_0x300787,_0x55b40a,_0x15f92e){if(_0x300787[_0x3aef('0x44')]['id']){delete _0x300787['body']['id'];}return db[_0x3aef('0x28')][_0x3aef('0x49')]({'where':{'id':_0x300787[_0x3aef('0x41')]['id']}})['then'](handleEntityNotFound(_0x55b40a,null))[_0x3aef('0x23')](function(_0x1afe8c){if(_0x1afe8c){_0x300787['body'][_0x3aef('0x78')]=_0x1afe8c['id'];_0x300787[_0x3aef('0x44')][_0x3aef('0x58')]=widgetAttributes(_0x300787['body']);return db[_0x3aef('0x79')][_0x3aef('0x43')](_0x300787[_0x3aef('0x44')]);}})[_0x3aef('0x23')](respondWithResult(_0x55b40a,null))['catch'](handleError(_0x55b40a,null));};exports[_0x3aef('0x7a')]=function(_0x3816f7,_0x16bc80,_0x23decd){var _0x4ec4de={};var _0x1a0282={};var _0x5115e9;var _0x17a2e3;return db['Dashboard'][_0x3aef('0x7b')]({'where':{'id':_0x3816f7[_0x3aef('0x41')]['id']}})[_0x3aef('0x23')](handleEntityNotFound(_0x16bc80,null))[_0x3aef('0x23')](function(_0x43b9d4){if(_0x43b9d4){_0x5115e9=_0x43b9d4;_0x1a0282[_0x3aef('0x2b')]=_[_0x3aef('0x2e')](db['DashboardItem']['rawAttributes']);_0x1a0282[_0x3aef('0x2d')]=_[_0x3aef('0x2e')](_0x3816f7[_0x3aef('0x2d')]);_0x1a0282[_0x3aef('0x2f')]=_[_0x3aef('0x30')](_0x1a0282['model'],_0x1a0282['query']);_0x4ec4de[_0x3aef('0x31')]=_[_0x3aef('0x30')](_0x1a0282[_0x3aef('0x2b')],qs[_0x3aef('0x32')](_0x3816f7[_0x3aef('0x2d')][_0x3aef('0x32')]));_0x4ec4de[_0x3aef('0x31')]=_0x4ec4de[_0x3aef('0x31')][_0x3aef('0x42')]?_0x4ec4de[_0x3aef('0x31')]:_0x1a0282['model'];_0x4ec4de['order']=qs[_0x3aef('0x7c')](_0x3816f7[_0x3aef('0x2d')][_0x3aef('0x7c')]);_0x4ec4de[_0x3aef('0x36')]=qs['filters'](_['pick'](_0x3816f7[_0x3aef('0x2d')],_0x1a0282['filters']));if(_0x3816f7[_0x3aef('0x2d')][_0x3aef('0x38')]){_0x4ec4de[_0x3aef('0x36')]=_[_0x3aef('0x39')](_0x4ec4de[_0x3aef('0x36')],{'$or':_[_0x3aef('0x2c')](_0x4ec4de[_0x3aef('0x31')],function(_0x15e323){var _0x13de22={};_0x13de22[_0x15e323]={'$like':'%'+_0x3816f7[_0x3aef('0x2d')]['filter']+'%'};return _0x13de22;})});}_0x4ec4de=_[_0x3aef('0x39')]({},_0x4ec4de,_0x3816f7[_0x3aef('0x3a')]);return _0x5115e9[_0x3aef('0x7a')](_0x4ec4de);}})[_0x3aef('0x23')](function(_0x21c6f0){if(_0x21c6f0){_0x17a2e3=_0x21c6f0[_0x3aef('0x42')];if(!_0x3816f7[_0x3aef('0x2d')][_0x3aef('0x33')](_0x3aef('0x34'))){_0x4ec4de[_0x3aef('0x1e')]=qs[_0x3aef('0x1e')](_0x3816f7[_0x3aef('0x2d')][_0x3aef('0x1e')]);_0x4ec4de[_0x3aef('0x1b')]=qs[_0x3aef('0x1b')](_0x3816f7[_0x3aef('0x2d')]['offset']);}return _0x5115e9[_0x3aef('0x7a')](_0x4ec4de);}})[_0x3aef('0x23')](function(_0x2b2630){if(_0x2b2630){return _0x2b2630?{'count':_0x17a2e3,'rows':_0x2b2630}:null;}})[_0x3aef('0x23')](respondWithResult(_0x16bc80,null))[_0x3aef('0x3f')](handleError(_0x16bc80,null));}; \ No newline at end of file +var _0x0b05=['value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','web-report','reportType','widgetAttributes:\x20%s','stringify','addItem','getItems','findOne','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','keys','filters','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','autoAssociation','iframe','attrUrl','attrs'];(function(_0x33ff15,_0x2cbb0e){var _0x2866ff=function(_0x1c5ed1){while(--_0x1c5ed1){_0x33ff15['push'](_0x33ff15['shift']());}};_0x2866ff(++_0x2cbb0e);}(_0x0b05,0x19e));var _0x50b0=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0b05[_0xdea41a];return _0x15d0d8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x50b0('0x0'));var jsonpatch=require(_0x50b0('0x1'));var rp=require('request-promise');var moment=require(_0x50b0('0x2'));var BPromise=require(_0x50b0('0x3'));var Mustache=require('mustache');var util=require(_0x50b0('0x4'));var path=require(_0x50b0('0x5'));var sox=require(_0x50b0('0x6'));var csv=require(_0x50b0('0x7'));var ejs=require(_0x50b0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x50b0('0x9'));var squel=require(_0x50b0('0xa'));var crypto=require(_0x50b0('0xb'));var jsforce=require(_0x50b0('0xc'));var deskjs=require(_0x50b0('0xd'));var toCsv=require(_0x50b0('0x7'));var querystring=require(_0x50b0('0xe'));var Papa=require('papaparse');var Redis=require(_0x50b0('0xf'));var authService=require(_0x50b0('0x10'));var qs=require(_0x50b0('0x11'));var as=require(_0x50b0('0x12'));var hardwareService=require(_0x50b0('0x13'));var logger=require(_0x50b0('0x14'))(_0x50b0('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50b0('0x16'))['db'];config[_0x50b0('0x17')]=_[_0x50b0('0x18')](config[_0x50b0('0x17')],{'host':_0x50b0('0x19'),'port':0x18eb});var socket=require(_0x50b0('0x1a'))(new Redis(config[_0x50b0('0x17')]));require(_0x50b0('0x1b'))[_0x50b0('0x1c')](socket);function respondWithStatusCode(_0x4f3971,_0x47c12c){_0x47c12c=_0x47c12c||0xcc;return function(_0x5e5412){if(_0x5e5412){return _0x4f3971[_0x50b0('0x1d')](_0x47c12c);}return _0x4f3971['status'](_0x47c12c)[_0x50b0('0x1e')]();};}function respondWithResult(_0x4ad794,_0x266ee7){_0x266ee7=_0x266ee7||0xc8;return function(_0x2e512f){if(_0x2e512f){return _0x4ad794[_0x50b0('0x1f')](_0x266ee7)[_0x50b0('0x20')](_0x2e512f);}};}function respondWithFilteredResult(_0x59a035,_0x5d6594){return function(_0x3235da){if(_0x3235da){var _0x1e3397=typeof _0x5d6594[_0x50b0('0x21')]===_0x50b0('0x22')&&typeof _0x5d6594[_0x50b0('0x23')]===_0x50b0('0x22');var _0x5bbd17=_0x3235da[_0x50b0('0x24')];var _0x38d8c1=_0x1e3397?0x0:_0x5d6594[_0x50b0('0x21')];var _0x28d2b9=_0x1e3397?_0x3235da[_0x50b0('0x24')]:_0x5d6594['offset']+_0x5d6594[_0x50b0('0x23')];var _0x1ec22a;if(_0x28d2b9>=_0x5bbd17){_0x28d2b9=_0x5bbd17;_0x1ec22a=0xc8;}else{_0x1ec22a=0xce;}_0x59a035[_0x50b0('0x1f')](_0x1ec22a);return _0x59a035[_0x50b0('0x25')](_0x50b0('0x26'),_0x38d8c1+'-'+_0x28d2b9+'/'+_0x5bbd17)[_0x50b0('0x20')](_0x3235da);}return null;};}function patchUpdates(_0x298c03){return function(_0x19a1ba){try{jsonpatch['apply'](_0x19a1ba,_0x298c03,!![]);}catch(_0x40a5bf){return BPromise[_0x50b0('0x27')](_0x40a5bf);}return _0x19a1ba[_0x50b0('0x28')]();};}function saveUpdates(_0x438870,_0x538e96){return function(_0x218354){if(_0x218354){return _0x218354[_0x50b0('0x29')](_0x438870)[_0x50b0('0x2a')](function(_0xc91898){return _0xc91898;});}return null;};}function removeEntity(_0x1dda0d,_0x10741a){return function(_0x1bf898){if(_0x1bf898){return _0x1bf898[_0x50b0('0x2b')]()[_0x50b0('0x2a')](function(){var _0x3cf4d7=_0x1bf898[_0x50b0('0x2c')]({'plain':!![]});var _0x1dcc9a=_0x50b0('0x2d');return db['UserProfileResource']['destroy']({'where':{'type':_0x1dcc9a,'resourceId':_0x3cf4d7['id']}})[_0x50b0('0x2a')](function(){return _0x1bf898;});})[_0x50b0('0x2a')](function(){_0x1dda0d[_0x50b0('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a726c,_0x63f59a){return function(_0x2a131b){if(!_0x2a131b){_0x5a726c['sendStatus'](0x194);}return _0x2a131b;};}function handleError(_0x16149e,_0x4a2d3e){_0x4a2d3e=_0x4a2d3e||0x1f4;return function(_0x4cce61){logger['error'](_0x4cce61[_0x50b0('0x2e')]);if(_0x4cce61[_0x50b0('0x2f')]){delete _0x4cce61['name'];}_0x16149e[_0x50b0('0x1f')](_0x4a2d3e)[_0x50b0('0x30')](_0x4cce61);};}exports[_0x50b0('0x31')]=function(_0x42576c,_0x4fc4ab){var _0x38aba2={},_0x5f536b={},_0x178fbc={'count':0x0,'rows':[]};var _0x48f5e1=_[_0x50b0('0x32')](db[_0x50b0('0x33')][_0x50b0('0x34')],function(_0x5d1733){return{'name':_0x5d1733[_0x50b0('0x35')],'type':_0x5d1733[_0x50b0('0x36')]['key']};});_0x5f536b[_0x50b0('0x37')]=_[_0x50b0('0x32')](_0x48f5e1,_0x50b0('0x2f'));_0x5f536b[_0x50b0('0x38')]=_['keys'](_0x42576c['query']);_0x5f536b['filters']=_['intersection'](_0x5f536b['model'],_0x5f536b['query']);_0x38aba2[_0x50b0('0x39')]=_[_0x50b0('0x3a')](_0x5f536b[_0x50b0('0x37')],qs[_0x50b0('0x3b')](_0x42576c[_0x50b0('0x38')][_0x50b0('0x3b')]));_0x38aba2['attributes']=_0x38aba2[_0x50b0('0x39')][_0x50b0('0x3c')]?_0x38aba2[_0x50b0('0x39')]:_0x5f536b[_0x50b0('0x37')];if(!_0x42576c[_0x50b0('0x38')][_0x50b0('0x3d')](_0x50b0('0x3e'))){_0x38aba2['limit']=qs[_0x50b0('0x23')](_0x42576c[_0x50b0('0x38')]['limit']);_0x38aba2[_0x50b0('0x21')]=qs['offset'](_0x42576c[_0x50b0('0x38')][_0x50b0('0x21')]);}_0x38aba2[_0x50b0('0x3f')]=qs[_0x50b0('0x40')](_0x42576c[_0x50b0('0x38')]['sort']);_0x38aba2[_0x50b0('0x41')]=qs['filters'](_[_0x50b0('0x42')](_0x42576c[_0x50b0('0x38')],_0x5f536b['filters']),_0x48f5e1);if(_0x42576c[_0x50b0('0x38')][_0x50b0('0x43')]){_0x38aba2[_0x50b0('0x41')]=_[_0x50b0('0x44')](_0x38aba2[_0x50b0('0x41')],{'$or':_[_0x50b0('0x32')](_0x48f5e1,function(_0x46ae8e){if(_0x46ae8e['type']!==_0x50b0('0x45')){var _0x386542={};_0x386542[_0x46ae8e[_0x50b0('0x2f')]]={'$like':'%'+_0x42576c[_0x50b0('0x38')][_0x50b0('0x43')]+'%'};return _0x386542;}})});}_0x38aba2=_['merge']({},_0x38aba2,_0x42576c[_0x50b0('0x46')]);var _0x11917e={'where':_0x38aba2[_0x50b0('0x41')]};return db['Dashboard']['count'](_0x11917e)[_0x50b0('0x2a')](function(_0x317d69){_0x178fbc[_0x50b0('0x24')]=_0x317d69;if(_0x42576c[_0x50b0('0x38')][_0x50b0('0x47')]){_0x38aba2[_0x50b0('0x48')]=[{'all':!![]}];}return db[_0x50b0('0x33')]['findAll'](_0x38aba2);})[_0x50b0('0x2a')](function(_0x2867b2){_0x178fbc[_0x50b0('0x49')]=_0x2867b2;return _0x178fbc;})[_0x50b0('0x2a')](respondWithFilteredResult(_0x4fc4ab,_0x38aba2))[_0x50b0('0x4a')](handleError(_0x4fc4ab,null));};exports['show']=function(_0x5a028b,_0x1d8805){var _0x4bc9c4={'raw':![],'where':{'id':_0x5a028b[_0x50b0('0x4b')]['id']}},_0x1e5971={};_0x1e5971[_0x50b0('0x37')]=_[_0x50b0('0x4c')](db['Dashboard'][_0x50b0('0x34')]);_0x1e5971['query']=_[_0x50b0('0x4c')](_0x5a028b[_0x50b0('0x38')]);_0x1e5971[_0x50b0('0x4d')]=_['intersection'](_0x1e5971[_0x50b0('0x37')],_0x1e5971[_0x50b0('0x38')]);_0x4bc9c4[_0x50b0('0x39')]=_[_0x50b0('0x3a')](_0x1e5971[_0x50b0('0x37')],qs[_0x50b0('0x3b')](_0x5a028b[_0x50b0('0x38')][_0x50b0('0x3b')]));_0x4bc9c4['attributes']=_0x4bc9c4[_0x50b0('0x39')][_0x50b0('0x3c')]?_0x4bc9c4[_0x50b0('0x39')]:_0x1e5971[_0x50b0('0x37')];if(_0x5a028b[_0x50b0('0x38')]['includeAll']){_0x4bc9c4['include']=[{'all':!![]}];}_0x4bc9c4=_['merge']({},_0x4bc9c4,_0x5a028b[_0x50b0('0x46')]);return db['Dashboard'][_0x50b0('0x4e')](_0x4bc9c4)[_0x50b0('0x2a')](handleEntityNotFound(_0x1d8805,null))[_0x50b0('0x2a')](respondWithResult(_0x1d8805,null))[_0x50b0('0x4a')](handleError(_0x1d8805,null));};exports[_0x50b0('0x4f')]=function(_0x3c76e0,_0x475c8d){return db[_0x50b0('0x33')]['create'](_0x3c76e0[_0x50b0('0x50')],{})[_0x50b0('0x2a')](function(_0x3875eb){var _0x4dac42=_0x3c76e0[_0x50b0('0x51')]['get']({'plain':!![]});if(!_0x4dac42)throw new Error(_0x50b0('0x52'));if(_0x4dac42['role']===_0x50b0('0x51')){var _0x588812=_0x3875eb['get']({'plain':!![]});var _0x1b433c='CustomDashboards';return db[_0x50b0('0x53')]['find']({'where':{'name':_0x1b433c,'userProfileId':_0x4dac42[_0x50b0('0x54')]},'raw':!![]})['then'](function(_0x15a04c){if(_0x15a04c&&_0x15a04c['autoAssociation']===0x0){return db['UserProfileResource'][_0x50b0('0x4f')]({'name':_0x588812[_0x50b0('0x2f')],'resourceId':_0x588812['id'],'type':_0x15a04c[_0x50b0('0x2f')],'sectionId':_0x15a04c['id']},{})['then'](function(){return _0x3875eb;});}else{return _0x3875eb;}})[_0x50b0('0x4a')](function(_0xf819f1){logger[_0x50b0('0x55')](_0x50b0('0x56'),_0xf819f1);throw _0xf819f1;});}return _0x3875eb;})['then'](respondWithResult(_0x475c8d,0xc9))['catch'](handleError(_0x475c8d,null));};exports['clone']=function(_0x1c1d79,_0x3a9144){var _0x19f1a4={'where':{'id':_0x1c1d79[_0x50b0('0x4b')]['id']}},_0x27605f={};_0x27605f[_0x50b0('0x37')]=_['keys'](db[_0x50b0('0x33')][_0x50b0('0x34')]);_0x19f1a4[_0x50b0('0x39')]=_[_0x50b0('0x3a')](_0x27605f['model'],qs['fields'](_0x1c1d79[_0x50b0('0x38')][_0x50b0('0x3b')]));_0x19f1a4[_0x50b0('0x39')]=_0x19f1a4[_0x50b0('0x39')]['length']?_0x19f1a4[_0x50b0('0x39')]:_0x27605f['model'];if(_0x1c1d79[_0x50b0('0x38')][_0x50b0('0x47')]){_0x19f1a4['include']=[{'all':!![]}];}_0x19f1a4=_[_0x50b0('0x44')]({},_0x19f1a4,_0x1c1d79[_0x50b0('0x46')]);return db[_0x50b0('0x33')][_0x50b0('0x4e')](_0x19f1a4)[_0x50b0('0x2a')](handleEntityNotFound(_0x3a9144,null))[_0x50b0('0x2a')](function(_0x1422ac){if(_0x1422ac){var _0x58df1c=_0x1422ac[_0x50b0('0x2c')]({'plain':!![]});_0x58df1c=qs[_0x50b0('0x57')](_0x58df1c,['id',_0x50b0('0x58'),_0x50b0('0x59')]);_0x1c1d79['body']=_['omit'](_0x1c1d79[_0x50b0('0x50')],['id',_0x50b0('0x58'),_0x50b0('0x59')]);return db['Dashboard']['create'](_[_0x50b0('0x44')](_0x58df1c,_0x1c1d79[_0x50b0('0x50')]),{'include':_0x1c1d79['query'][_0x50b0('0x47')]?[{'all':!![]}]:undefined})[_0x50b0('0x2a')](function(_0x395bc7){var _0x50dccc=_0x1c1d79[_0x50b0('0x51')][_0x50b0('0x2c')]({'plain':!![]});if(!_0x50dccc)throw new Error(_0x50b0('0x52'));if(_0x50dccc['role']===_0x50b0('0x51')){var _0xb9aa24=_0x395bc7[_0x50b0('0x2c')]({'plain':!![]});var _0x430a6a=_0x50b0('0x2d');return db['UserProfileSection'][_0x50b0('0x4e')]({'where':{'name':_0x430a6a,'userProfileId':_0x50dccc['userProfileId']},'raw':!![]})[_0x50b0('0x2a')](function(_0x59836d){if(_0x59836d&&_0x59836d[_0x50b0('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0xb9aa24[_0x50b0('0x2f')],'resourceId':_0xb9aa24['id'],'type':_0x59836d[_0x50b0('0x2f')],'sectionId':_0x59836d['id']},{})['then'](function(){return _0x395bc7;});}else{return _0x395bc7;}})[_0x50b0('0x4a')](function(_0x32546d){logger[_0x50b0('0x55')](_0x50b0('0x56'),_0x32546d);throw _0x32546d;});}return _0x395bc7;});}})[_0x50b0('0x2a')](respondWithResult(_0x3a9144,0xc9))[_0x50b0('0x4a')](handleError(_0x3a9144,null));};exports[_0x50b0('0x29')]=function(_0x4c1766,_0x1704a6){if(_0x4c1766[_0x50b0('0x50')]['id']){delete _0x4c1766[_0x50b0('0x50')]['id'];}return db[_0x50b0('0x33')][_0x50b0('0x4e')]({'where':{'id':_0x4c1766[_0x50b0('0x4b')]['id']}})[_0x50b0('0x2a')](handleEntityNotFound(_0x1704a6,null))[_0x50b0('0x2a')](saveUpdates(_0x4c1766[_0x50b0('0x50')],null))['then'](respondWithResult(_0x1704a6,null))[_0x50b0('0x4a')](handleError(_0x1704a6,null));};exports[_0x50b0('0x2b')]=function(_0x52a3ae,_0x43b6b7){return db[_0x50b0('0x33')][_0x50b0('0x4e')]({'where':{'id':_0x52a3ae[_0x50b0('0x4b')]['id']}})[_0x50b0('0x2a')](handleEntityNotFound(_0x43b6b7,null))[_0x50b0('0x2a')](removeEntity(_0x43b6b7,null))[_0x50b0('0x4a')](handleError(_0x43b6b7,null));};function widgetAttributes(_0x5d59a4){try{switch(_0x5d59a4['type']){case _0x50b0('0x5b'):return[{'name':'attrUrl','value':_0x5d59a4[_0x50b0('0x5c')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0][_0x50b0('0x5e')]:undefined)||_0x50b0('0x5f')}];case _0x50b0('0x60'):return[{'name':'attrPath','value':_0x5d59a4[_0x50b0('0x61')]||(_0x5d59a4['attrs']&&_0x5d59a4['attrs'][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0][_0x50b0('0x5e')]:undefined)||''}];case _0x50b0('0x62'):return[{'name':_0x50b0('0x63'),'value':_0x5d59a4[_0x50b0('0x63')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4['attrs'][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0]['value']:undefined)||_0x50b0('0x64')},{'name':'attrTimezone','value':_0x5d59a4[_0x50b0('0x65')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x1]?_0x5d59a4[_0x50b0('0x5d')][0x1]['value']:undefined)||_0x50b0('0x66')},{'name':_0x50b0('0x67'),'value':_0x5d59a4[_0x50b0('0x67')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x2]?_0x5d59a4[_0x50b0('0x5d')][0x2][_0x50b0('0x5e')]:undefined)||0xc}];case _0x50b0('0x68'):return[{'name':_0x50b0('0x69'),'value':_0x5d59a4[_0x50b0('0x69')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4['attrs'][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0][_0x50b0('0x5e')]:undefined)||_0x50b0('0x6a')},{'name':'attrVoiceQueues','value':_0x5d59a4[_0x50b0('0x6b')]||(_0x5d59a4['attrs']&&_0x5d59a4['attrs'][0x1]?_0x5d59a4['attrs'][0x1][_0x50b0('0x5e')]:undefined)||[]},{'name':'attrFontSize','value':_0x5d59a4[_0x50b0('0x67')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x2]?_0x5d59a4[_0x50b0('0x5d')][0x2]['value']:undefined)||0x14},{'name':_0x50b0('0x6c'),'value':_0x5d59a4['attrChannel']||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x3]?_0x5d59a4[_0x50b0('0x5d')][0x3][_0x50b0('0x5e')]:undefined)||_0x50b0('0x6d')},{'name':_0x50b0('0x6e'),'value':_0x5d59a4[_0x50b0('0x6e')]||(_0x5d59a4['attrs']&&_0x5d59a4['attrs'][0x4]?_0x5d59a4[_0x50b0('0x5d')][0x4][_0x50b0('0x5e')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5d59a4['attrFaxAccounts']||(_0x5d59a4['attrs']&&_0x5d59a4['attrs'][0x5]?_0x5d59a4[_0x50b0('0x5d')][0x5][_0x50b0('0x5e')]:undefined)||''},{'name':_0x50b0('0x6f'),'value':_0x5d59a4[_0x50b0('0x6f')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x6]?_0x5d59a4[_0x50b0('0x5d')][0x6][_0x50b0('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d59a4['attrOpenchannelAccounts']||(_0x5d59a4['attrs']&&_0x5d59a4[_0x50b0('0x5d')][0x7]?_0x5d59a4['attrs'][0x7][_0x50b0('0x5e')]:undefined)||''},{'name':_0x50b0('0x70'),'value':_0x5d59a4[_0x50b0('0x70')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4['attrs'][0x8]?_0x5d59a4[_0x50b0('0x5d')][0x8][_0x50b0('0x5e')]:undefined)||''},{'name':_0x50b0('0x71'),'value':_0x5d59a4['attrChatWebsites']||(_0x5d59a4['attrs']&&_0x5d59a4[_0x50b0('0x5d')][0x9]?_0x5d59a4['attrs'][0x9][_0x50b0('0x5e')]:undefined)||''}];case _0x50b0('0x72'):case _0x50b0('0x73'):return[{'name':'attrSerie1','value':_0x5d59a4[_0x50b0('0x74')]||(_0x5d59a4['attrs']&&_0x5d59a4[_0x50b0('0x5d')][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0]['value']:undefined)||_0x50b0('0x6a')},{'name':_0x50b0('0x75'),'value':_0x5d59a4[_0x50b0('0x75')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x1]?_0x5d59a4['attrs'][0x1]['value']:undefined)||null},{'name':_0x50b0('0x76'),'value':_0x5d59a4[_0x50b0('0x76')]||(_0x5d59a4['attrs']&&_0x5d59a4[_0x50b0('0x5d')][0x2]?_0x5d59a4[_0x50b0('0x5d')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5d59a4[_0x50b0('0x6b')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x3]?_0x5d59a4['attrs'][0x3][_0x50b0('0x5e')]:undefined)||[]},{'name':_0x50b0('0x6c'),'value':_0x5d59a4[_0x50b0('0x6c')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4['attrs'][0x4]?_0x5d59a4['attrs'][0x4][_0x50b0('0x5e')]:undefined)||'voice'},{'name':_0x50b0('0x6e'),'value':_0x5d59a4[_0x50b0('0x6e')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x5]?_0x5d59a4[_0x50b0('0x5d')][0x5][_0x50b0('0x5e')]:undefined)||''},{'name':_0x50b0('0x77'),'value':_0x5d59a4[_0x50b0('0x77')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x6]?_0x5d59a4[_0x50b0('0x5d')][0x6][_0x50b0('0x5e')]:undefined)||''},{'name':_0x50b0('0x6f'),'value':_0x5d59a4[_0x50b0('0x6f')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x7]?_0x5d59a4['attrs'][0x7]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5d59a4['attrOpenchannelAccounts']||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x8]?_0x5d59a4[_0x50b0('0x5d')][0x8][_0x50b0('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x5d59a4['attrWhatsappAccounts']||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x9]?_0x5d59a4[_0x50b0('0x5d')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x5d59a4[_0x50b0('0x71')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0xa]?_0x5d59a4['attrs'][0xa][_0x50b0('0x5e')]:undefined)||''}];case _0x50b0('0x78'):return[{'name':'attrReport','type':_0x5d59a4[_0x50b0('0x79')]||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0]['type']:undefined)||null,'value':_0x5d59a4['attrReport']||(_0x5d59a4['attrs']&&_0x5d59a4['attrs'][0x0]?_0x5d59a4[_0x50b0('0x5d')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x5d59a4['attrRefresh']||(_0x5d59a4[_0x50b0('0x5d')]&&_0x5d59a4[_0x50b0('0x5d')][0x1]?_0x5d59a4[_0x50b0('0x5d')][0x1][_0x50b0('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0x168a50){logger['error'](_0x50b0('0x7a'),JSON[_0x50b0('0x7b')](_0x168a50));return[];}}exports[_0x50b0('0x7c')]=function(_0x469b6f,_0x3b8dec,_0x55629e){if(_0x469b6f[_0x50b0('0x50')]['id']){delete _0x469b6f[_0x50b0('0x50')]['id'];}return db[_0x50b0('0x33')][_0x50b0('0x4e')]({'where':{'id':_0x469b6f[_0x50b0('0x4b')]['id']}})[_0x50b0('0x2a')](handleEntityNotFound(_0x3b8dec,null))['then'](function(_0x2f474d){if(_0x2f474d){_0x469b6f[_0x50b0('0x50')]['DashboardId']=_0x2f474d['id'];_0x469b6f[_0x50b0('0x50')]['attrs']=widgetAttributes(_0x469b6f[_0x50b0('0x50')]);return db['DashboardItem'][_0x50b0('0x4f')](_0x469b6f[_0x50b0('0x50')]);}})[_0x50b0('0x2a')](respondWithResult(_0x3b8dec,null))[_0x50b0('0x4a')](handleError(_0x3b8dec,null));};exports[_0x50b0('0x7d')]=function(_0x247701,_0x469d37,_0x41bc5c){var _0x29eece={};var _0x262e0c={};var _0x38b214;var _0x3e298d;return db[_0x50b0('0x33')][_0x50b0('0x7e')]({'where':{'id':_0x247701[_0x50b0('0x4b')]['id']}})[_0x50b0('0x2a')](handleEntityNotFound(_0x469d37,null))[_0x50b0('0x2a')](function(_0x4427de){if(_0x4427de){_0x38b214=_0x4427de;_0x262e0c[_0x50b0('0x37')]=_['keys'](db['DashboardItem'][_0x50b0('0x34')]);_0x262e0c[_0x50b0('0x38')]=_[_0x50b0('0x4c')](_0x247701[_0x50b0('0x38')]);_0x262e0c['filters']=_[_0x50b0('0x3a')](_0x262e0c[_0x50b0('0x37')],_0x262e0c['query']);_0x29eece[_0x50b0('0x39')]=_[_0x50b0('0x3a')](_0x262e0c[_0x50b0('0x37')],qs[_0x50b0('0x3b')](_0x247701[_0x50b0('0x38')][_0x50b0('0x3b')]));_0x29eece[_0x50b0('0x39')]=_0x29eece[_0x50b0('0x39')]['length']?_0x29eece[_0x50b0('0x39')]:_0x262e0c['model'];_0x29eece[_0x50b0('0x3f')]=qs['sort'](_0x247701['query'][_0x50b0('0x40')]);_0x29eece[_0x50b0('0x41')]=qs[_0x50b0('0x4d')](_['pick'](_0x247701[_0x50b0('0x38')],_0x262e0c[_0x50b0('0x4d')]));if(_0x247701[_0x50b0('0x38')][_0x50b0('0x43')]){_0x29eece[_0x50b0('0x41')]=_[_0x50b0('0x44')](_0x29eece[_0x50b0('0x41')],{'$or':_[_0x50b0('0x32')](_0x29eece['attributes'],function(_0x31a4d7){var _0x5a48a3={};_0x5a48a3[_0x31a4d7]={'$like':'%'+_0x247701['query'][_0x50b0('0x43')]+'%'};return _0x5a48a3;})});}_0x29eece=_['merge']({},_0x29eece,_0x247701[_0x50b0('0x46')]);return _0x38b214[_0x50b0('0x7d')](_0x29eece);}})[_0x50b0('0x2a')](function(_0x1b0cbb){if(_0x1b0cbb){_0x3e298d=_0x1b0cbb[_0x50b0('0x3c')];if(!_0x247701['query'][_0x50b0('0x3d')](_0x50b0('0x3e'))){_0x29eece[_0x50b0('0x23')]=qs[_0x50b0('0x23')](_0x247701[_0x50b0('0x38')][_0x50b0('0x23')]);_0x29eece[_0x50b0('0x21')]=qs[_0x50b0('0x21')](_0x247701[_0x50b0('0x38')][_0x50b0('0x21')]);}return _0x38b214[_0x50b0('0x7d')](_0x29eece);}})[_0x50b0('0x2a')](function(_0x5c24c1){if(_0x5c24c1){return _0x5c24c1?{'count':_0x3e298d,'rows':_0x5c24c1}:null;}})[_0x50b0('0x2a')](respondWithResult(_0x469d37,null))[_0x50b0('0x4a')](handleError(_0x469d37,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index db36741..23be265 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 _0xe1f5=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x6822ce,_0x5f0f96){var _0xd92f58=function(_0x4335ab){while(--_0x4335ab){_0x6822ce['push'](_0x6822ce['shift']());}};_0xd92f58(++_0x5f0f96);}(_0xe1f5,0x1ec));var _0x5e1f=function(_0x541311,_0x451176){_0x541311=_0x541311-0x0;var _0x22f256=_0xe1f5[_0x541311];return _0x22f256;};'use strict';var EventEmitter=require(_0x5e1f('0x0'));var Dashboard=require(_0x5e1f('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x5e1f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e1f('0x3'),'afterDestroy':_0x5e1f('0x4')};function emitEvent(_0x299e6f){return function(_0x699087,_0x5730f1,_0xbf7d60){DashboardEvents[_0x5e1f('0x5')](_0x299e6f+':'+_0x699087['id'],_0x699087);DashboardEvents[_0x5e1f('0x5')](_0x299e6f,_0x699087);_0xbf7d60(null);};}for(var e in events){if(events[_0x5e1f('0x6')](e)){var event=events[e];Dashboard[_0x5e1f('0x7')](e,emitEvent(event));}}module[_0x5e1f('0x8')]=DashboardEvents; \ No newline at end of file +var _0x3c81=['../../mysqldb','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','events'];(function(_0x5dde9b,_0x18d784){var _0x195095=function(_0x291667){while(--_0x291667){_0x5dde9b['push'](_0x5dde9b['shift']());}};_0x195095(++_0x18d784);}(_0x3c81,0x1e5));var _0x13c8=function(_0x3f900b,_0x567442){_0x3f900b=_0x3f900b-0x0;var _0x568dab=_0x3c81[_0x3f900b];return _0x568dab;};'use strict';var EventEmitter=require(_0x13c8('0x0'));var Dashboard=require(_0x13c8('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x13c8('0x2')](0x0);var events={'afterCreate':_0x13c8('0x3'),'afterUpdate':_0x13c8('0x4'),'afterDestroy':_0x13c8('0x5')};function emitEvent(_0x5c050d){return function(_0x49463e,_0x1a652a,_0x37195b){DashboardEvents['emit'](_0x5c050d+':'+_0x49463e['id'],_0x49463e);DashboardEvents['emit'](_0x5c050d,_0x49463e);_0x37195b(null);};}for(var e in events){if(events[_0x13c8('0x6')](e)){var event=events[e];Dashboard[_0x13c8('0x7')](e,emitEvent(event));}}module[_0x13c8('0x8')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 40ee8ac..a21d283 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 _0xf403=['path','rimraf','../../config/environment','define','Dashboard','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x376e90,_0x1bd639){var _0x53395c=function(_0x1dc244){while(--_0x1dc244){_0x376e90['push'](_0x376e90['shift']());}};_0x53395c(++_0x1bd639);}(_0xf403,0x1d3));var _0x3f40=function(_0x250c34,_0x22f4e6){_0x250c34=_0x250c34-0x0;var _0x82d1d=_0xf403[_0x250c34];return _0x82d1d;};'use strict';var _=require(_0x3f40('0x0'));var util=require('util');var logger=require(_0x3f40('0x1'))(_0x3f40('0x2'));var moment=require(_0x3f40('0x3'));var BPromise=require(_0x3f40('0x4'));var rp=require(_0x3f40('0x5'));var fs=require('fs');var path=require(_0x3f40('0x6'));var rimraf=require(_0x3f40('0x7'));var config=require(_0x3f40('0x8'));var attributes=require('./dashboard.attributes');module['exports']=function(_0x33f742,_0x22d5e6){return _0x33f742[_0x3f40('0x9')](_0x3f40('0xa'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x30d9=['../../config/environment','./dashboard.attributes','exports','Dashboard','dashboards','util','api','request-promise','path','rimraf'];(function(_0x40cff9,_0x4a16f3){var _0x247a72=function(_0x5da075){while(--_0x5da075){_0x40cff9['push'](_0x40cff9['shift']());}};_0x247a72(++_0x4a16f3);}(_0x30d9,0xd7));var _0x930d=function(_0x464d7d,_0x5c7a97){_0x464d7d=_0x464d7d-0x0;var _0x2e6921=_0x30d9[_0x464d7d];return _0x2e6921;};'use strict';var _=require('lodash');var util=require(_0x930d('0x0'));var logger=require('../../config/logger')(_0x930d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x930d('0x2'));var fs=require('fs');var path=require(_0x930d('0x3'));var rimraf=require(_0x930d('0x4'));var config=require(_0x930d('0x5'));var attributes=require(_0x930d('0x6'));module[_0x930d('0x7')]=function(_0x540792,_0x17fe34){return _0x540792['define'](_0x930d('0x8'),attributes,{'tableName':_0x930d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 493ff16..2da038a 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 _0x575f=['error','message','result','catch','util','moment','bluebird','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','code'];(function(_0x199b1f,_0x4ed849){var _0x267ac9=function(_0x184ac6){while(--_0x184ac6){_0x199b1f['push'](_0x199b1f['shift']());}};_0x267ac9(++_0x4ed849);}(_0x575f,0x18a));var _0xf575=function(_0xd17fc8,_0x4ea958){_0xd17fc8=_0xd17fc8-0x0;var _0x5ce429=_0x575f[_0xd17fc8];return _0x5ce429;};'use strict';var _=require('lodash');var util=require(_0xf575('0x0'));var moment=require(_0xf575('0x1'));var BPromise=require(_0xf575('0x2'));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(_0xf575('0x3'))(_0xf575('0x4'));var config=require(_0xf575('0x5'));var jayson=require(_0xf575('0x6'));var client=jayson[_0xf575('0x7')][_0xf575('0x8')]({'port':0x232a});config[_0xf575('0x9')]=_[_0xf575('0xa')](config['redis'],{'host':_0xf575('0xb'),'port':0x18eb});var socket=require(_0xf575('0xc'))(new Redis(config[_0xf575('0x9')]));require('./dashboard.socket')[_0xf575('0xd')](socket);function respondWithRpcPromise(_0x141ac2,_0x280eef,_0xf465ee){return new BPromise(function(_0xae364e,_0x3f2382){return client[_0xf575('0xe')](_0x141ac2,_0xf465ee)[_0xf575('0xf')](function(_0x1c6219){logger[_0xf575('0x10')](_0xf575('0x11'),_0x280eef,_0xf575('0x12'));logger[_0xf575('0x13')](_0xf575('0x14'),_0x280eef,_0xf575('0x12'),JSON['stringify'](_0x1c6219));if(_0x1c6219['error']){if(_0x1c6219['error'][_0xf575('0x15')]===0x1f4){logger['error'](_0xf575('0x11'),_0x280eef,_0x1c6219[_0xf575('0x16')][_0xf575('0x17')]);return _0x3f2382(_0x1c6219[_0xf575('0x16')][_0xf575('0x17')]);}logger[_0xf575('0x16')]('Dashboard,\x20%s,\x20%s',_0x280eef,_0x1c6219['error'][_0xf575('0x17')]);return _0xae364e(_0x1c6219['error'][_0xf575('0x17')]);}else{logger[_0xf575('0x10')](_0xf575('0x11'),_0x280eef,_0xf575('0x12'));_0xae364e(_0x1c6219[_0xf575('0x18')][_0xf575('0x17')]);}})[_0xf575('0x19')](function(_0x1c42c9){logger[_0xf575('0x16')]('Dashboard,\x20%s,\x20%s',_0x280eef,_0x1c42c9);_0x3f2382(_0x1c42c9);});});} \ No newline at end of file +var _0x3d8a=['client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','then','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1ff73c,_0x233d2){var _0x3d5bec=function(_0x3691c3){while(--_0x3691c3){_0x1ff73c['push'](_0x1ff73c['shift']());}};_0x3d5bec(++_0x233d2);}(_0x3d8a,0xdf));var _0xa3d8=function(_0x37d546,_0x30348e){_0x37d546=_0x37d546-0x0;var _0x4705ea=_0x3d8a[_0x37d546];return _0x4705ea;};'use strict';var _=require(_0xa3d8('0x0'));var util=require(_0xa3d8('0x1'));var moment=require(_0xa3d8('0x2'));var BPromise=require(_0xa3d8('0x3'));var rs=require(_0xa3d8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3d8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa3d8('0x6'))(_0xa3d8('0x7'));var config=require(_0xa3d8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa3d8('0x9')][_0xa3d8('0xa')]({'port':0x232a});config['redis']=_[_0xa3d8('0xb')](config[_0xa3d8('0xc')],{'host':_0xa3d8('0xd'),'port':0x18eb});var socket=require(_0xa3d8('0xe'))(new Redis(config['redis']));require(_0xa3d8('0xf'))[_0xa3d8('0x10')](socket);function respondWithRpcPromise(_0x59b88f,_0x2cb714,_0x328022){return new BPromise(function(_0x51052b,_0x19141e){return client['request'](_0x59b88f,_0x328022)[_0xa3d8('0x11')](function(_0x2e50f1){logger[_0xa3d8('0x12')](_0xa3d8('0x13'),_0x2cb714,'request\x20sent');logger[_0xa3d8('0x14')](_0xa3d8('0x15'),_0x2cb714,_0xa3d8('0x16'),JSON[_0xa3d8('0x17')](_0x2e50f1));if(_0x2e50f1[_0xa3d8('0x18')]){if(_0x2e50f1[_0xa3d8('0x18')][_0xa3d8('0x19')]===0x1f4){logger[_0xa3d8('0x18')](_0xa3d8('0x13'),_0x2cb714,_0x2e50f1[_0xa3d8('0x18')][_0xa3d8('0x1a')]);return _0x19141e(_0x2e50f1[_0xa3d8('0x18')][_0xa3d8('0x1a')]);}logger[_0xa3d8('0x18')](_0xa3d8('0x13'),_0x2cb714,_0x2e50f1[_0xa3d8('0x18')]['message']);return _0x51052b(_0x2e50f1[_0xa3d8('0x18')]['message']);}else{logger[_0xa3d8('0x12')](_0xa3d8('0x13'),_0x2cb714,_0xa3d8('0x16'));_0x51052b(_0x2e50f1[_0xa3d8('0x1b')][_0xa3d8('0x1a')]);}})[_0xa3d8('0x1c')](function(_0x592c4f){logger[_0xa3d8('0x18')](_0xa3d8('0x13'),_0x2cb714,_0x592c4f);_0x19141e(_0x592c4f);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 0531489..aa0c7a2 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 _0x19fc=['./dashboard.events','save','remove','update','register','length'];(function(_0x15c10d,_0x247c0c){var _0x5c6871=function(_0x15d38a){while(--_0x15d38a){_0x15c10d['push'](_0x15c10d['shift']());}};_0x5c6871(++_0x247c0c);}(_0x19fc,0x174));var _0xc19f=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x19fc[_0x1a7846];return _0x48049;};'use strict';var DashboardEvents=require(_0xc19f('0x0'));var events=[_0xc19f('0x1'),_0xc19f('0x2'),_0xc19f('0x3')];function createListener(_0x4ed0ac,_0x4637e0){return function(_0x2ae4a7){_0x4637e0['emit'](_0x4ed0ac,_0x2ae4a7);};}function removeListener(_0x28328b,_0x327bb2){return function(){DashboardEvents['removeListener'](_0x28328b,_0x327bb2);};}exports[_0xc19f('0x4')]=function(_0x3fece7){for(var _0x3469d5=0x0,_0x3db080=events[_0xc19f('0x5')];_0x3469d5<_0x3db080;_0x3469d5++){var _0x3a6b93=events[_0x3469d5];var _0x4e719c=createListener('dashboard:'+_0x3a6b93,_0x3fece7);DashboardEvents['on'](_0x3a6b93,_0x4e719c);}}; \ No newline at end of file +var _0xcf2f=['./dashboard.events','save','remove','update','register','length'];(function(_0xaeb63d,_0x46dfe2){var _0x4110de=function(_0x26e93e){while(--_0x26e93e){_0xaeb63d['push'](_0xaeb63d['shift']());}};_0x4110de(++_0x46dfe2);}(_0xcf2f,0x18c));var _0xfcf2=function(_0x1e070f,_0x42cca5){_0x1e070f=_0x1e070f-0x0;var _0x411486=_0xcf2f[_0x1e070f];return _0x411486;};'use strict';var DashboardEvents=require(_0xfcf2('0x0'));var events=[_0xfcf2('0x1'),_0xfcf2('0x2'),_0xfcf2('0x3')];function createListener(_0x5f4389,_0x2fa9b9){return function(_0x5b1d03){_0x2fa9b9['emit'](_0x5f4389,_0x5b1d03);};}function removeListener(_0x9cac28,_0x1bcca2){return function(){DashboardEvents['removeListener'](_0x9cac28,_0x1bcca2);};}exports[_0xfcf2('0x4')]=function(_0x14c671){for(var _0x3645f3=0x0,_0x4f7b18=events[_0xfcf2('0x5')];_0x3645f3<_0x4f7b18;_0x3645f3++){var _0x28273a=events[_0x3645f3];var _0x439670=createListener('dashboard:'+_0x28273a,_0x14c671);DashboardEvents['on'](_0x28273a,_0x439670);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index f2c3c42..7816bc9 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 _0xe3c1=['./dashboard.controller','get','/:id','isAuthenticated','show','getItems','post','/:id/clone','clone','/:id/items','addItem','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe3c1,0x148));var _0x1e3c=function(_0xc69f39,_0x2ce0cf){_0xc69f39=_0xc69f39-0x0;var _0x93be41=_0xe3c1[_0xc69f39];return _0x93be41;};'use strict';var multer=require(_0x1e3c('0x0'));var util=require(_0x1e3c('0x1'));var path=require(_0x1e3c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e3c('0x3'));var router=express[_0x1e3c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1e3c('0x5'));var interaction=require(_0x1e3c('0x6'));var config=require(_0x1e3c('0x7'));var controller=require(_0x1e3c('0x8'));router[_0x1e3c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1e3c('0x9')](_0x1e3c('0xa'),auth[_0x1e3c('0xb')](),controller[_0x1e3c('0xc')]);router[_0x1e3c('0x9')]('/:id/items',auth[_0x1e3c('0xb')](),controller[_0x1e3c('0xd')]);router[_0x1e3c('0xe')]('/',auth[_0x1e3c('0xb')](),controller['create']);router[_0x1e3c('0xe')](_0x1e3c('0xf'),auth[_0x1e3c('0xb')](),controller[_0x1e3c('0x10')]);router[_0x1e3c('0xe')](_0x1e3c('0x11'),auth[_0x1e3c('0xb')](),controller[_0x1e3c('0x12')]);router[_0x1e3c('0x13')](_0x1e3c('0xa'),auth[_0x1e3c('0xb')](),controller[_0x1e3c('0x14')]);router[_0x1e3c('0x15')](_0x1e3c('0xa'),auth['isAuthenticated'](),controller[_0x1e3c('0x16')]);module[_0x1e3c('0x17')]=router; \ No newline at end of file +var _0x2540=['./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','clone','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x366b79,_0x13ce14){var _0x2f984c=function(_0x37ef0b){while(--_0x37ef0b){_0x366b79['push'](_0x366b79['shift']());}};_0x2f984c(++_0x13ce14);}(_0x2540,0x11e));var _0x0254=function(_0x8b8564,_0x162976){_0x8b8564=_0x8b8564-0x0;var _0x360c61=_0x2540[_0x8b8564];return _0x360c61;};'use strict';var multer=require(_0x0254('0x0'));var util=require('util');var path=require(_0x0254('0x1'));var timeout=require(_0x0254('0x2'));var express=require(_0x0254('0x3'));var router=express[_0x0254('0x4')]();var fs_extra=require(_0x0254('0x5'));var auth=require(_0x0254('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0254('0x7'));var controller=require(_0x0254('0x8'));router[_0x0254('0x9')]('/',auth[_0x0254('0xa')](),controller[_0x0254('0xb')]);router['get'](_0x0254('0xc'),auth[_0x0254('0xa')](),controller[_0x0254('0xd')]);router['get'](_0x0254('0xe'),auth[_0x0254('0xa')](),controller[_0x0254('0xf')]);router['post']('/',auth[_0x0254('0xa')](),controller['create']);router[_0x0254('0x10')](_0x0254('0x11'),auth[_0x0254('0xa')](),controller[_0x0254('0x12')]);router[_0x0254('0x10')]('/:id/items',auth['isAuthenticated'](),controller['addItem']);router['put']('/:id',auth[_0x0254('0xa')](),controller['update']);router[_0x0254('0x13')](_0x0254('0xc'),auth[_0x0254('0xa')](),controller['destroy']);module[_0x0254('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 9605663..581bb31 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 _0x687b=['sequelize','squel','lodash','exports','TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','STRING','#ffffff','#2196f3'];(function(_0x5af16a,_0x122cd8){var _0x363560=function(_0x492528){while(--_0x492528){_0x5af16a['push'](_0x5af16a['shift']());}};_0x363560(++_0x122cd8);}(_0x687b,0x14a));var _0xb687=function(_0x3ef1dc,_0x210a81){_0x3ef1dc=_0x3ef1dc-0x0;var _0x151f5f=_0x687b[_0x3ef1dc];return _0x151f5f;};'use strict';var Sequelize=require(_0xb687('0x0'));var squel=require(_0xb687('0x1'));var _=require(_0xb687('0x2'));module[_0xb687('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb687('0x4')](_0xb687('0x5')),'get':function(){try{return JSON[_0xb687('0x6')](this[_0xb687('0x7')](_0xb687('0x8')));}catch(_0x194c55){return[];}},'set':function(_0x16ccf3){try{this[_0xb687('0x9')](_0xb687('0x8'),JSON[_0xb687('0xa')](_0x16ccf3));}catch(_0x48942b){this[_0xb687('0x9')](_0xb687('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb687('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb687('0xb')]},'col':{'type':Sequelize[_0xb687('0xb')]},'background':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb687('0xc')],'allowNull':![],'defaultValue':_0xb687('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb687('0xc')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x7a54=['lodash','STRING','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','sequelize','squel'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x7a54,0x106));var _0x47a5=function(_0xf19d61,_0x1e002b){_0xf19d61=_0xf19d61-0x0;var _0x145fb5=_0x7a54[_0xf19d61];return _0x145fb5;};'use strict';var Sequelize=require(_0x47a5('0x0'));var squel=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));module['exports']={'title':{'type':Sequelize[_0x47a5('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x47a5('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x47a5('0x4')),'get':function(){try{return JSON[_0x47a5('0x5')](this[_0x47a5('0x6')](_0x47a5('0x7')));}catch(_0xfdf934){return[];}},'set':function(_0x545a97){try{this[_0x47a5('0x8')]('attrs',JSON[_0x47a5('0x9')](_0x545a97));}catch(_0x30e405){this['setDataValue'](_0x47a5('0x7'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x47a5('0xa')]},'col':{'type':Sequelize[_0x47a5('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x47a5('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x47a5('0x3')]},'titleFontSize':{'type':Sequelize[_0x47a5('0xa')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 243c581..92a7f2d 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 _0x9206=['util','path','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','show','params','model','keys','query','filters','intersection','attributes','includeAll','include','merge','options','DashboardItem','find','catch','type','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x416475,_0x456304){var _0x111146=function(_0x1793bd){while(--_0x1793bd){_0x416475['push'](_0x416475['shift']());}};_0x111146(++_0x456304);}(_0x9206,0x176));var _0x6920=function(_0x9cbf6e,_0x73457b){_0x9cbf6e=_0x9cbf6e-0x0;var _0x17f6c0=_0x9206[_0x9cbf6e];return _0x17f6c0;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];config['redis']=_['defaults'](config[_0x6920('0x1a')],{'host':_0x6920('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6920('0x1a')]));require(_0x6920('0x1c'))[_0x6920('0x1d')](socket);function respondWithStatusCode(_0x2c3a35,_0x17c6e9){_0x17c6e9=_0x17c6e9||0xcc;return function(_0x4b39c4){if(_0x4b39c4){return _0x2c3a35[_0x6920('0x1e')](_0x17c6e9);}return _0x2c3a35[_0x6920('0x1f')](_0x17c6e9)[_0x6920('0x20')]();};}function respondWithResult(_0xa64034,_0x289b73){_0x289b73=_0x289b73||0xc8;return function(_0x3e94ee){if(_0x3e94ee){return _0xa64034[_0x6920('0x1f')](_0x289b73)[_0x6920('0x21')](_0x3e94ee);}};}function respondWithFilteredResult(_0x11ce91,_0x2d04e7){return function(_0x462500){if(_0x462500){var _0x3d0059=typeof _0x2d04e7[_0x6920('0x22')]===_0x6920('0x23')&&typeof _0x2d04e7[_0x6920('0x24')]==='undefined';var _0x3a0c0c=_0x462500[_0x6920('0x25')];var _0x377e25=_0x3d0059?0x0:_0x2d04e7[_0x6920('0x22')];var _0xf4b5bd=_0x3d0059?_0x462500[_0x6920('0x25')]:_0x2d04e7[_0x6920('0x22')]+_0x2d04e7[_0x6920('0x24')];var _0xaf93ba;if(_0xf4b5bd>=_0x3a0c0c){_0xf4b5bd=_0x3a0c0c;_0xaf93ba=0xc8;}else{_0xaf93ba=0xce;}_0x11ce91[_0x6920('0x1f')](_0xaf93ba);return _0x11ce91[_0x6920('0x26')](_0x6920('0x27'),_0x377e25+'-'+_0xf4b5bd+'/'+_0x3a0c0c)[_0x6920('0x21')](_0x462500);}return null;};}function patchUpdates(_0x2dd788){return function(_0x1f68c5){try{jsonpatch[_0x6920('0x28')](_0x1f68c5,_0x2dd788,!![]);}catch(_0x1ae686){return BPromise[_0x6920('0x29')](_0x1ae686);}return _0x1f68c5[_0x6920('0x2a')]();};}function saveUpdates(_0x258986,_0x51cb24){return function(_0x1996f1){if(_0x1996f1){return _0x1996f1['update'](_0x258986)[_0x6920('0x2b')](function(_0x4dd08b){return _0x4dd08b;});}return null;};}function removeEntity(_0x72316a,_0x32a6ae){return function(_0x23e4cd){if(_0x23e4cd){return _0x23e4cd[_0x6920('0x2c')]()['then'](function(){_0x72316a[_0x6920('0x1f')](0xcc)[_0x6920('0x20')]();});}};}function handleEntityNotFound(_0x305129,_0x1ae78f){return function(_0x72e8bc){if(!_0x72e8bc){_0x305129[_0x6920('0x1e')](0x194);}return _0x72e8bc;};}function handleError(_0xdcc5e3,_0x38d0f6){_0x38d0f6=_0x38d0f6||0x1f4;return function(_0x400894){logger[_0x6920('0x2d')](_0x400894[_0x6920('0x2e')]);if(_0x400894[_0x6920('0x2f')]){delete _0x400894['name'];}_0xdcc5e3[_0x6920('0x1f')](_0x38d0f6)['send'](_0x400894);};}exports[_0x6920('0x30')]=function(_0x49534b,_0x31aa90){var _0x25e7ff={'raw':![],'where':{'id':_0x49534b[_0x6920('0x31')]['id']}},_0x595dfe={};_0x595dfe[_0x6920('0x32')]=_[_0x6920('0x33')](db['DashboardItem']['rawAttributes']);_0x595dfe[_0x6920('0x34')]=_['keys'](_0x49534b['query']);_0x595dfe[_0x6920('0x35')]=_[_0x6920('0x36')](_0x595dfe[_0x6920('0x32')],_0x595dfe[_0x6920('0x34')]);_0x25e7ff[_0x6920('0x37')]=_[_0x6920('0x36')](_0x595dfe[_0x6920('0x32')],qs['fields'](_0x49534b[_0x6920('0x34')]['fields']));_0x25e7ff[_0x6920('0x37')]=_0x25e7ff['attributes']['length']?_0x25e7ff[_0x6920('0x37')]:_0x595dfe[_0x6920('0x32')];if(_0x49534b[_0x6920('0x34')][_0x6920('0x38')]){_0x25e7ff[_0x6920('0x39')]=[{'all':!![]}];}_0x25e7ff=_[_0x6920('0x3a')]({},_0x25e7ff,_0x49534b[_0x6920('0x3b')]);return db[_0x6920('0x3c')][_0x6920('0x3d')](_0x25e7ff)[_0x6920('0x2b')](handleEntityNotFound(_0x31aa90,null))[_0x6920('0x2b')](respondWithResult(_0x31aa90,null))[_0x6920('0x3e')](handleError(_0x31aa90,null));};exports['destroy']=function(_0x2a69d3,_0x4c56be){return db[_0x6920('0x3c')][_0x6920('0x3d')]({'where':{'id':_0x2a69d3[_0x6920('0x31')]['id']}})['then'](handleEntityNotFound(_0x4c56be,null))[_0x6920('0x2b')](removeEntity(_0x4c56be,null))[_0x6920('0x3e')](handleError(_0x4c56be,null));};function widgetAttributes(_0x14f841){try{switch(_0x14f841[_0x6920('0x3f')]){case'iframe':return[{'name':_0x6920('0x40'),'value':_0x14f841[_0x6920('0x40')]||(_0x14f841['attrs']&&_0x14f841['attrs'][0x0]?_0x14f841[_0x6920('0x41')][0x0][_0x6920('0x42')]:undefined)||'https://'}];case _0x6920('0x43'):return[{'name':_0x6920('0x44'),'value':_0x14f841['attrPath']||(_0x14f841['attrs']&&_0x14f841[_0x6920('0x41')][0x0]?_0x14f841[_0x6920('0x41')][0x0][_0x6920('0x42')]:undefined)||''}];case _0x6920('0x45'):return[{'name':_0x6920('0x46'),'value':_0x14f841['attrHourFormat']||(_0x14f841['attrs']&&_0x14f841['attrs'][0x0]?_0x14f841[_0x6920('0x41')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0x6920('0x47'),'value':_0x14f841[_0x6920('0x47')]||(_0x14f841['attrs']&&_0x14f841[_0x6920('0x41')][0x1]?_0x14f841['attrs'][0x1][_0x6920('0x42')]:undefined)||_0x6920('0x48')},{'name':_0x6920('0x49'),'value':_0x14f841[_0x6920('0x49')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841['attrs'][0x2]?_0x14f841['attrs'][0x2][_0x6920('0x42')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x14f841['attrMetric']||(_0x14f841['attrs']&&_0x14f841[_0x6920('0x41')][0x0]?_0x14f841[_0x6920('0x41')][0x0][_0x6920('0x42')]:undefined)||'total'},{'name':_0x6920('0x4a'),'value':_0x14f841[_0x6920('0x4a')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x1]?_0x14f841[_0x6920('0x41')][0x1][_0x6920('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x14f841[_0x6920('0x49')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x2]?_0x14f841[_0x6920('0x41')][0x2][_0x6920('0x42')]:undefined)||0x14},{'name':_0x6920('0x4b'),'value':_0x14f841[_0x6920('0x4b')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x3]?_0x14f841[_0x6920('0x41')][0x3][_0x6920('0x42')]:undefined)||_0x6920('0x4c')},{'name':'attrEmailAccounts','value':_0x14f841[_0x6920('0x4d')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841['attrs'][0x4]?_0x14f841['attrs'][0x4][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x4e'),'value':_0x14f841[_0x6920('0x4e')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x5]?_0x14f841['attrs'][0x5][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x4f'),'value':_0x14f841[_0x6920('0x4f')]||(_0x14f841['attrs']&&_0x14f841['attrs'][0x6]?_0x14f841[_0x6920('0x41')][0x6][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x50'),'value':_0x14f841[_0x6920('0x50')]||(_0x14f841['attrs']&&_0x14f841[_0x6920('0x41')][0x7]?_0x14f841[_0x6920('0x41')][0x7][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x51'),'value':_0x14f841[_0x6920('0x51')]||(_0x14f841['attrs']&&_0x14f841[_0x6920('0x41')][0x8]?_0x14f841[_0x6920('0x41')][0x8][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x52'),'value':_0x14f841[_0x6920('0x52')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x9]?_0x14f841[_0x6920('0x41')][0x9][_0x6920('0x42')]:undefined)||''}];case _0x6920('0x53'):case'pie-chart':return[{'name':_0x6920('0x54'),'value':_0x14f841[_0x6920('0x54')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x0]?_0x14f841[_0x6920('0x41')][0x0][_0x6920('0x42')]:undefined)||_0x6920('0x55')},{'name':'attrSerie2','value':_0x14f841[_0x6920('0x56')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x1]?_0x14f841[_0x6920('0x41')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x14f841['attrSerie3']||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x2]?_0x14f841[_0x6920('0x41')][0x2]['value']:undefined)||null},{'name':_0x6920('0x4a'),'value':_0x14f841[_0x6920('0x4a')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x3]?_0x14f841[_0x6920('0x41')][0x3][_0x6920('0x42')]:undefined)||[]},{'name':_0x6920('0x4b'),'value':_0x14f841['attrChannel']||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x4]?_0x14f841['attrs'][0x4][_0x6920('0x42')]:undefined)||_0x6920('0x4c')},{'name':_0x6920('0x4d'),'value':_0x14f841[_0x6920('0x4d')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841['attrs'][0x5]?_0x14f841[_0x6920('0x41')][0x5][_0x6920('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x14f841[_0x6920('0x4e')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841['attrs'][0x6]?_0x14f841['attrs'][0x6][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x4f'),'value':_0x14f841['attrSmsAccounts']||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x7]?_0x14f841[_0x6920('0x41')][0x7][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x50'),'value':_0x14f841[_0x6920('0x50')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841['attrs'][0x8]?_0x14f841[_0x6920('0x41')][0x8][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x51'),'value':_0x14f841[_0x6920('0x51')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x9]?_0x14f841[_0x6920('0x41')][0x9][_0x6920('0x42')]:undefined)||''},{'name':_0x6920('0x52'),'value':_0x14f841['attrChatWebsites']||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0xa]?_0x14f841[_0x6920('0x41')][0xa][_0x6920('0x42')]:undefined)||''}];case'web-report':return[{'name':_0x6920('0x57'),'type':_0x14f841[_0x6920('0x58')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x0]?_0x14f841[_0x6920('0x41')][0x0][_0x6920('0x3f')]:undefined)||null,'value':_0x14f841['attrReport']||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x0]?_0x14f841['attrs'][0x0][_0x6920('0x42')]:undefined)||null},{'name':_0x6920('0x59'),'value':_0x14f841[_0x6920('0x59')]||(_0x14f841[_0x6920('0x41')]&&_0x14f841[_0x6920('0x41')][0x1]?_0x14f841[_0x6920('0x41')][0x1][_0x6920('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x433905){logger[_0x6920('0x2d')](_0x6920('0x5a'),JSON[_0x6920('0x5b')](_0x433905));return[];}}exports[_0x6920('0x5c')]=function(_0x15b24d,_0x394a0b){if(_0x15b24d['body']){_0x15b24d[_0x6920('0x5d')][_0x6920('0x41')]=widgetAttributes(_0x15b24d[_0x6920('0x5d')]);}return db['DashboardItem'][_0x6920('0x5c')](_0x15b24d[_0x6920('0x5d')],{})[_0x6920('0x2b')](respondWithResult(_0x394a0b,0xc9))[_0x6920('0x3e')](handleError(_0x394a0b,null));};exports[_0x6920('0x5e')]=function(_0x56fd3b,_0xc12b4c){if(_0x56fd3b[_0x6920('0x5d')]['id']){delete _0x56fd3b[_0x6920('0x5d')]['id'];}_0x56fd3b['body'][_0x6920('0x41')]=widgetAttributes(_0x56fd3b['body']);return db['DashboardItem'][_0x6920('0x3d')]({'where':{'id':_0x56fd3b['params']['id']}})[_0x6920('0x2b')](handleEntityNotFound(_0xc12b4c,null))[_0x6920('0x2b')](saveUpdates(_0x56fd3b['body'],null))['then'](respondWithResult(_0xc12b4c,null))[_0x6920('0x3e')](handleError(_0xc12b4c,null));}; \ No newline at end of file +var _0x0dee=['defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','show','params','model','keys','DashboardItem','query','filters','attributes','intersection','fields','length','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0x0dee,0xf7));var _0xe0de=function(_0x571843,_0x3e708b){_0x571843=_0x571843-0x0;var _0x24de5e=_0x0dee[_0x571843];return _0x24de5e;};'use strict';var emlformat=require(_0xe0de('0x0'));var rimraf=require(_0xe0de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0de('0x2'));var rp=require('request-promise');var moment=require(_0xe0de('0x3'));var BPromise=require(_0xe0de('0x4'));var Mustache=require('mustache');var util=require(_0xe0de('0x5'));var path=require(_0xe0de('0x6'));var sox=require(_0xe0de('0x7'));var csv=require('to-csv');var ejs=require(_0xe0de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe0de('0x9'));var squel=require(_0xe0de('0xa'));var crypto=require(_0xe0de('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe0de('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe0de('0xd'));var Papa=require('papaparse');var Redis=require(_0xe0de('0xe'));var authService=require(_0xe0de('0xf'));var qs=require(_0xe0de('0x10'));var as=require(_0xe0de('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0de('0x12'))(_0xe0de('0x13'));var utils=require(_0xe0de('0x14'));var config=require(_0xe0de('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe0de('0x16')]=_[_0xe0de('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe0de('0x18'))(new Redis(config[_0xe0de('0x16')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x5e1fd9,_0x4adf3c){_0x4adf3c=_0x4adf3c||0xcc;return function(_0x1188b7){if(_0x1188b7){return _0x5e1fd9[_0xe0de('0x19')](_0x4adf3c);}return _0x5e1fd9[_0xe0de('0x1a')](_0x4adf3c)[_0xe0de('0x1b')]();};}function respondWithResult(_0xb711fb,_0xee0ba8){_0xee0ba8=_0xee0ba8||0xc8;return function(_0x9cd387){if(_0x9cd387){return _0xb711fb[_0xe0de('0x1a')](_0xee0ba8)[_0xe0de('0x1c')](_0x9cd387);}};}function respondWithFilteredResult(_0x22d047,_0x4c41cf){return function(_0x45cecc){if(_0x45cecc){var _0x2f5a2b=typeof _0x4c41cf[_0xe0de('0x1d')]===_0xe0de('0x1e')&&typeof _0x4c41cf[_0xe0de('0x1f')]===_0xe0de('0x1e');var _0x4ea410=_0x45cecc[_0xe0de('0x20')];var _0x2c728e=_0x2f5a2b?0x0:_0x4c41cf[_0xe0de('0x1d')];var _0x509353=_0x2f5a2b?_0x45cecc[_0xe0de('0x20')]:_0x4c41cf['offset']+_0x4c41cf[_0xe0de('0x1f')];var _0x5677f9;if(_0x509353>=_0x4ea410){_0x509353=_0x4ea410;_0x5677f9=0xc8;}else{_0x5677f9=0xce;}_0x22d047[_0xe0de('0x1a')](_0x5677f9);return _0x22d047['set'](_0xe0de('0x21'),_0x2c728e+'-'+_0x509353+'/'+_0x4ea410)[_0xe0de('0x1c')](_0x45cecc);}return null;};}function patchUpdates(_0x2df49c){return function(_0x37cad1){try{jsonpatch[_0xe0de('0x22')](_0x37cad1,_0x2df49c,!![]);}catch(_0x59bb8d){return BPromise[_0xe0de('0x23')](_0x59bb8d);}return _0x37cad1[_0xe0de('0x24')]();};}function saveUpdates(_0x4e0d04,_0x1d7c7d){return function(_0x2e3ab7){if(_0x2e3ab7){return _0x2e3ab7[_0xe0de('0x25')](_0x4e0d04)['then'](function(_0x523891){return _0x523891;});}return null;};}function removeEntity(_0x5877f8,_0x3a41a9){return function(_0x1d1406){if(_0x1d1406){return _0x1d1406['destroy']()[_0xe0de('0x26')](function(){_0x5877f8[_0xe0de('0x1a')](0xcc)[_0xe0de('0x1b')]();});}};}function handleEntityNotFound(_0xb95460,_0x4ef3e3){return function(_0x248fc4){if(!_0x248fc4){_0xb95460[_0xe0de('0x19')](0x194);}return _0x248fc4;};}function handleError(_0x5606b5,_0x182dfc){_0x182dfc=_0x182dfc||0x1f4;return function(_0x32ba02){logger['error'](_0x32ba02['stack']);if(_0x32ba02['name']){delete _0x32ba02['name'];}_0x5606b5[_0xe0de('0x1a')](_0x182dfc)['send'](_0x32ba02);};}exports[_0xe0de('0x27')]=function(_0x2616ca,_0x5745ec){var _0x3f7d5b={'raw':![],'where':{'id':_0x2616ca[_0xe0de('0x28')]['id']}},_0x497183={};_0x497183[_0xe0de('0x29')]=_[_0xe0de('0x2a')](db[_0xe0de('0x2b')]['rawAttributes']);_0x497183['query']=_[_0xe0de('0x2a')](_0x2616ca[_0xe0de('0x2c')]);_0x497183[_0xe0de('0x2d')]=_['intersection'](_0x497183[_0xe0de('0x29')],_0x497183['query']);_0x3f7d5b[_0xe0de('0x2e')]=_[_0xe0de('0x2f')](_0x497183[_0xe0de('0x29')],qs[_0xe0de('0x30')](_0x2616ca[_0xe0de('0x2c')][_0xe0de('0x30')]));_0x3f7d5b[_0xe0de('0x2e')]=_0x3f7d5b[_0xe0de('0x2e')][_0xe0de('0x31')]?_0x3f7d5b[_0xe0de('0x2e')]:_0x497183[_0xe0de('0x29')];if(_0x2616ca[_0xe0de('0x2c')]['includeAll']){_0x3f7d5b[_0xe0de('0x32')]=[{'all':!![]}];}_0x3f7d5b=_[_0xe0de('0x33')]({},_0x3f7d5b,_0x2616ca[_0xe0de('0x34')]);return db['DashboardItem'][_0xe0de('0x35')](_0x3f7d5b)[_0xe0de('0x26')](handleEntityNotFound(_0x5745ec,null))['then'](respondWithResult(_0x5745ec,null))[_0xe0de('0x36')](handleError(_0x5745ec,null));};exports['destroy']=function(_0x24dc35,_0x9255a8){return db[_0xe0de('0x2b')][_0xe0de('0x35')]({'where':{'id':_0x24dc35['params']['id']}})[_0xe0de('0x26')](handleEntityNotFound(_0x9255a8,null))[_0xe0de('0x26')](removeEntity(_0x9255a8,null))[_0xe0de('0x36')](handleError(_0x9255a8,null));};function widgetAttributes(_0x1aaa2c){try{switch(_0x1aaa2c[_0xe0de('0x37')]){case _0xe0de('0x38'):return[{'name':_0xe0de('0x39'),'value':_0x1aaa2c['attrUrl']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x0]?_0x1aaa2c[_0xe0de('0x3a')][0x0][_0xe0de('0x3b')]:undefined)||_0xe0de('0x3c')}];case'custom':return[{'name':_0xe0de('0x3d'),'value':_0x1aaa2c[_0xe0de('0x3d')]||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x0]?_0x1aaa2c['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x1aaa2c[_0xe0de('0x3e')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x0]?_0x1aaa2c[_0xe0de('0x3a')][0x0][_0xe0de('0x3b')]:undefined)||_0xe0de('0x3f')},{'name':_0xe0de('0x40'),'value':_0x1aaa2c['attrTimezone']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x1]?_0x1aaa2c['attrs'][0x1]['value']:undefined)||_0xe0de('0x41')},{'name':'attrFontSize','value':_0x1aaa2c[_0xe0de('0x42')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x2]?_0x1aaa2c['attrs'][0x2][_0xe0de('0x3b')]:undefined)||0xc}];case'counter':return[{'name':_0xe0de('0x43'),'value':_0x1aaa2c[_0xe0de('0x43')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x0]?_0x1aaa2c[_0xe0de('0x3a')][0x0]['value']:undefined)||'total'},{'name':_0xe0de('0x44'),'value':_0x1aaa2c[_0xe0de('0x44')]||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x1]?_0x1aaa2c[_0xe0de('0x3a')][0x1]['value']:undefined)||[]},{'name':_0xe0de('0x42'),'value':_0x1aaa2c[_0xe0de('0x42')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x2]?_0x1aaa2c[_0xe0de('0x3a')][0x2][_0xe0de('0x3b')]:undefined)||0x14},{'name':_0xe0de('0x45'),'value':_0x1aaa2c['attrChannel']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x3]?_0x1aaa2c[_0xe0de('0x3a')][0x3][_0xe0de('0x3b')]:undefined)||_0xe0de('0x46')},{'name':'attrEmailAccounts','value':_0x1aaa2c[_0xe0de('0x47')]||(_0x1aaa2c['attrs']&&_0x1aaa2c['attrs'][0x4]?_0x1aaa2c[_0xe0de('0x3a')][0x4][_0xe0de('0x3b')]:undefined)||''},{'name':_0xe0de('0x48'),'value':_0x1aaa2c[_0xe0de('0x48')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x5]?_0x1aaa2c[_0xe0de('0x3a')][0x5][_0xe0de('0x3b')]:undefined)||''},{'name':_0xe0de('0x49'),'value':_0x1aaa2c['attrSmsAccounts']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x6]?_0x1aaa2c[_0xe0de('0x3a')][0x6]['value']:undefined)||''},{'name':_0xe0de('0x4a'),'value':_0x1aaa2c[_0xe0de('0x4a')]||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x7]?_0x1aaa2c[_0xe0de('0x3a')][0x7]['value']:undefined)||''},{'name':_0xe0de('0x4b'),'value':_0x1aaa2c[_0xe0de('0x4b')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x8]?_0x1aaa2c[_0xe0de('0x3a')][0x8][_0xe0de('0x3b')]:undefined)||''},{'name':_0xe0de('0x4c'),'value':_0x1aaa2c['attrChatWebsites']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x9]?_0x1aaa2c[_0xe0de('0x3a')][0x9]['value']:undefined)||''}];case _0xe0de('0x4d'):case'pie-chart':return[{'name':_0xe0de('0x4e'),'value':_0x1aaa2c['attrSerie1']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x0]?_0x1aaa2c[_0xe0de('0x3a')][0x0][_0xe0de('0x3b')]:undefined)||_0xe0de('0x4f')},{'name':'attrSerie2','value':_0x1aaa2c[_0xe0de('0x50')]||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x1]?_0x1aaa2c['attrs'][0x1][_0xe0de('0x3b')]:undefined)||null},{'name':_0xe0de('0x51'),'value':_0x1aaa2c[_0xe0de('0x51')]||(_0x1aaa2c['attrs']&&_0x1aaa2c['attrs'][0x2]?_0x1aaa2c[_0xe0de('0x3a')][0x2][_0xe0de('0x3b')]:undefined)||null},{'name':_0xe0de('0x44'),'value':_0x1aaa2c['attrVoiceQueues']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x3]?_0x1aaa2c[_0xe0de('0x3a')][0x3]['value']:undefined)||[]},{'name':_0xe0de('0x45'),'value':_0x1aaa2c['attrChannel']||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x4]?_0x1aaa2c[_0xe0de('0x3a')][0x4][_0xe0de('0x3b')]:undefined)||_0xe0de('0x46')},{'name':_0xe0de('0x47'),'value':_0x1aaa2c[_0xe0de('0x47')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x5]?_0x1aaa2c[_0xe0de('0x3a')][0x5]['value']:undefined)||''},{'name':_0xe0de('0x48'),'value':_0x1aaa2c['attrFaxAccounts']||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x6]?_0x1aaa2c['attrs'][0x6]['value']:undefined)||''},{'name':_0xe0de('0x49'),'value':_0x1aaa2c[_0xe0de('0x49')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x7]?_0x1aaa2c['attrs'][0x7]['value']:undefined)||''},{'name':_0xe0de('0x4a'),'value':_0x1aaa2c[_0xe0de('0x4a')]||(_0x1aaa2c['attrs']&&_0x1aaa2c['attrs'][0x8]?_0x1aaa2c[_0xe0de('0x3a')][0x8][_0xe0de('0x3b')]:undefined)||''},{'name':_0xe0de('0x4b'),'value':_0x1aaa2c['attrWhatsappAccounts']||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x9]?_0x1aaa2c['attrs'][0x9][_0xe0de('0x3b')]:undefined)||''},{'name':_0xe0de('0x4c'),'value':_0x1aaa2c[_0xe0de('0x4c')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0xa]?_0x1aaa2c['attrs'][0xa][_0xe0de('0x3b')]:undefined)||''}];case _0xe0de('0x52'):return[{'name':_0xe0de('0x53'),'type':_0x1aaa2c[_0xe0de('0x54')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c['attrs'][0x0]?_0x1aaa2c[_0xe0de('0x3a')][0x0][_0xe0de('0x37')]:undefined)||null,'value':_0x1aaa2c['attrReport']||(_0x1aaa2c['attrs']&&_0x1aaa2c[_0xe0de('0x3a')][0x0]?_0x1aaa2c[_0xe0de('0x3a')][0x0]['value']:undefined)||null},{'name':_0xe0de('0x55'),'value':_0x1aaa2c[_0xe0de('0x55')]||(_0x1aaa2c[_0xe0de('0x3a')]&&_0x1aaa2c[_0xe0de('0x3a')][0x1]?_0x1aaa2c[_0xe0de('0x3a')][0x1][_0xe0de('0x3b')]:undefined)||0x0}];default:return[];}}catch(_0x2b5247){logger[_0xe0de('0x56')](_0xe0de('0x57'),JSON['stringify'](_0x2b5247));return[];}}exports[_0xe0de('0x58')]=function(_0x2934f5,_0x5f30fc){if(_0x2934f5[_0xe0de('0x59')]){_0x2934f5[_0xe0de('0x59')]['attrs']=widgetAttributes(_0x2934f5['body']);}return db[_0xe0de('0x2b')][_0xe0de('0x58')](_0x2934f5[_0xe0de('0x59')],{})[_0xe0de('0x26')](respondWithResult(_0x5f30fc,0xc9))[_0xe0de('0x36')](handleError(_0x5f30fc,null));};exports[_0xe0de('0x25')]=function(_0x30c41a,_0x7d020f){if(_0x30c41a[_0xe0de('0x59')]['id']){delete _0x30c41a['body']['id'];}_0x30c41a[_0xe0de('0x59')]['attrs']=widgetAttributes(_0x30c41a[_0xe0de('0x59')]);return db['DashboardItem'][_0xe0de('0x35')]({'where':{'id':_0x30c41a[_0xe0de('0x28')]['id']}})[_0xe0de('0x26')](handleEntityNotFound(_0x7d020f,null))['then'](saveUpdates(_0x30c41a['body'],null))[_0xe0de('0x26')](respondWithResult(_0x7d020f,null))[_0xe0de('0x36')](handleError(_0x7d020f,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a1274d0..533fc4b 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 _0x8e49=['setMaxListeners','emit','hasOwnProperty','hook','events','DashboardItem'];(function(_0x160ad4,_0x46f844){var _0x104500=function(_0xf18a39){while(--_0xf18a39){_0x160ad4['push'](_0x160ad4['shift']());}};_0x104500(++_0x46f844);}(_0x8e49,0xf4));var _0x98e4=function(_0x1c72b8,_0x104b7e){_0x1c72b8=_0x1c72b8-0x0;var _0x191114=_0x8e49[_0x1c72b8];return _0x191114;};'use strict';var EventEmitter=require(_0x98e4('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x98e4('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x98e4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2e6c3c){return function(_0xbe8ea3,_0x10505d,_0x504b71){DashboardItemEvents[_0x98e4('0x3')](_0x2e6c3c+':'+_0xbe8ea3['id'],_0xbe8ea3);DashboardItemEvents[_0x98e4('0x3')](_0x2e6c3c,_0xbe8ea3);_0x504b71(null);};}for(var e in events){if(events[_0x98e4('0x4')](e)){var event=events[e];DashboardItem[_0x98e4('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0xfe7c=['setMaxListeners','save','update','remove','hasOwnProperty','hook','../../mysqldb','DashboardItem'];(function(_0x173afe,_0x12eb14){var _0xb3e606=function(_0xee5442){while(--_0xee5442){_0x173afe['push'](_0x173afe['shift']());}};_0xb3e606(++_0x12eb14);}(_0xfe7c,0x166));var _0xcfe7=function(_0x5f6215,_0x4c6c1e){_0x5f6215=_0x5f6215-0x0;var _0x19b502=_0xfe7c[_0x5f6215];return _0x19b502;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xcfe7('0x0'))['db'][_0xcfe7('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xcfe7('0x2')](0x0);var events={'afterCreate':_0xcfe7('0x3'),'afterUpdate':_0xcfe7('0x4'),'afterDestroy':_0xcfe7('0x5')};function emitEvent(_0x1347d5){return function(_0x2e54ab,_0x1326fe,_0x257417){DashboardItemEvents['emit'](_0x1347d5+':'+_0x2e54ab['id'],_0x2e54ab);DashboardItemEvents['emit'](_0x1347d5,_0x2e54ab);_0x257417(null);};}for(var e in events){if(events[_0xcfe7('0x6')](e)){var event=events[e];DashboardItem[_0xcfe7('0x7')](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 4a5c1ce..69dda4d 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 _0x5ebe=['moment','bluebird','request-promise','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','../../config/logger','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5ebe,0x69));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0xe5eb('0x0'));var logger=require(_0xe5eb('0x1'))(_0xe5eb('0x2'));var moment=require(_0xe5eb('0x3'));var BPromise=require(_0xe5eb('0x4'));var rp=require(_0xe5eb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe5eb('0x6'));var attributes=require(_0xe5eb('0x7'));module[_0xe5eb('0x8')]=function(_0x1f7414,_0x3055ba){return _0x1f7414[_0xe5eb('0x9')](_0xe5eb('0xa'),attributes,{'tableName':_0xe5eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc6e=['./dashboardItem.attributes','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0xfc6e,0x13b));var _0xefc6=function(_0x4801bd,_0x368071){_0x4801bd=_0x4801bd-0x0;var _0x3cf6fc=_0xfc6e[_0x4801bd];return _0x3cf6fc;};'use strict';var _=require(_0xefc6('0x0'));var util=require(_0xefc6('0x1'));var logger=require(_0xefc6('0x2'))(_0xefc6('0x3'));var moment=require('moment');var BPromise=require(_0xefc6('0x4'));var rp=require(_0xefc6('0x5'));var fs=require('fs');var path=require(_0xefc6('0x6'));var rimraf=require(_0xefc6('0x7'));var config=require(_0xefc6('0x8'));var attributes=require(_0xefc6('0x9'));module['exports']=function(_0x366ea6,_0x2109b2){return _0x366ea6['define'](_0xefc6('0xa'),attributes,{'tableName':_0xefc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index f6f5e21..3cbf92a 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 _0x9475=['../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis'];(function(_0x4544e5,_0x40e821){var _0x1a193c=function(_0x5cb810){while(--_0x5cb810){_0x4544e5['push'](_0x4544e5['shift']());}};_0x1a193c(++_0x40e821);}(_0x9475,0x85));var _0x5947=function(_0x3f9300,_0x2a69e5){_0x3f9300=_0x3f9300-0x0;var _0x37ddba=_0x9475[_0x3f9300];return _0x37ddba;};'use strict';var _=require(_0x5947('0x0'));var util=require(_0x5947('0x1'));var moment=require('moment');var BPromise=require(_0x5947('0x2'));var rs=require(_0x5947('0x3'));var fs=require('fs');var Redis=require(_0x5947('0x4'));var db=require(_0x5947('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5947('0x6'))(_0x5947('0x7'));var config=require(_0x5947('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5947('0x9')]({'port':0x232a});config[_0x5947('0xa')]=_['defaults'](config['redis'],{'host':_0x5947('0xb'),'port':0x18eb});var socket=require(_0x5947('0xc'))(new Redis(config[_0x5947('0xa')]));require(_0x5947('0xd'))[_0x5947('0xe')](socket);function respondWithRpcPromise(_0x3a6ec6,_0x23b1be,_0x3ea4ab){return new BPromise(function(_0x29b487,_0xb02f76){return client['request'](_0x3a6ec6,_0x3ea4ab)['then'](function(_0x59c6d1){logger[_0x5947('0xf')](_0x5947('0x10'),_0x23b1be,_0x5947('0x11'));logger['debug'](_0x5947('0x12'),_0x23b1be,_0x5947('0x11'),JSON[_0x5947('0x13')](_0x59c6d1));if(_0x59c6d1[_0x5947('0x14')]){if(_0x59c6d1[_0x5947('0x14')]['code']===0x1f4){logger[_0x5947('0x14')]('DashboardItem,\x20%s,\x20%s',_0x23b1be,_0x59c6d1[_0x5947('0x14')][_0x5947('0x15')]);return _0xb02f76(_0x59c6d1['error']['message']);}logger[_0x5947('0x14')]('DashboardItem,\x20%s,\x20%s',_0x23b1be,_0x59c6d1[_0x5947('0x14')]['message']);return _0x29b487(_0x59c6d1['error'][_0x5947('0x15')]);}else{logger[_0x5947('0xf')](_0x5947('0x10'),_0x23b1be,_0x5947('0x11'));_0x29b487(_0x59c6d1[_0x5947('0x16')][_0x5947('0x15')]);}})['catch'](function(_0x47f02b){logger[_0x5947('0x14')](_0x5947('0x10'),_0x23b1be,_0x47f02b);_0xb02f76(_0x47f02b);});});} \ No newline at end of file +var _0x7bb1=['redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x184fbf,_0x31173a){var _0x445f1e=function(_0x5aeb29){while(--_0x5aeb29){_0x184fbf['push'](_0x184fbf['shift']());}};_0x445f1e(++_0x31173a);}(_0x7bb1,0xe0));var _0x17bb=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0x7bb1[_0xc67528];return _0x38e26d;};'use strict';var _=require(_0x17bb('0x0'));var util=require(_0x17bb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17bb('0x2'));var fs=require('fs');var Redis=require(_0x17bb('0x3'));var db=require(_0x17bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x17bb('0x5'))(_0x17bb('0x6'));var config=require('../../config/environment');var jayson=require(_0x17bb('0x7'));var client=jayson[_0x17bb('0x8')][_0x17bb('0x9')]({'port':0x232a});config[_0x17bb('0xa')]=_[_0x17bb('0xb')](config[_0x17bb('0xa')],{'host':_0x17bb('0xc'),'port':0x18eb});var socket=require(_0x17bb('0xd'))(new Redis(config[_0x17bb('0xa')]));require(_0x17bb('0xe'))[_0x17bb('0xf')](socket);function respondWithRpcPromise(_0x3bdf37,_0x5b8ce0,_0x295fb0){return new BPromise(function(_0x5d9f24,_0x36864e){return client['request'](_0x3bdf37,_0x295fb0)[_0x17bb('0x10')](function(_0x21f744){logger[_0x17bb('0x11')](_0x17bb('0x12'),_0x5b8ce0,'request\x20sent');logger[_0x17bb('0x13')](_0x17bb('0x14'),_0x5b8ce0,'request\x20sent',JSON[_0x17bb('0x15')](_0x21f744));if(_0x21f744[_0x17bb('0x16')]){if(_0x21f744[_0x17bb('0x16')]['code']===0x1f4){logger[_0x17bb('0x16')]('DashboardItem,\x20%s,\x20%s',_0x5b8ce0,_0x21f744[_0x17bb('0x16')][_0x17bb('0x17')]);return _0x36864e(_0x21f744['error'][_0x17bb('0x17')]);}logger[_0x17bb('0x16')](_0x17bb('0x12'),_0x5b8ce0,_0x21f744['error']['message']);return _0x5d9f24(_0x21f744[_0x17bb('0x16')][_0x17bb('0x17')]);}else{logger[_0x17bb('0x11')](_0x17bb('0x12'),_0x5b8ce0,_0x17bb('0x18'));_0x5d9f24(_0x21f744[_0x17bb('0x19')][_0x17bb('0x17')]);}})['catch'](function(_0xb59e30){logger[_0x17bb('0x16')](_0x17bb('0x12'),_0x5b8ce0,_0xb59e30);_0x36864e(_0xb59e30);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 383a976..f0d666f 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 _0xfcbc=['emit','removeListener','register','length','dashboardItem:','./dashboardItem.events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfcbc,0x107));var _0xcfcb=function(_0x28394f,_0x5ebdd2){_0x28394f=_0x28394f-0x0;var _0x2618d2=_0xfcbc[_0x28394f];return _0x2618d2;};'use strict';var DashboardItemEvents=require(_0xcfcb('0x0'));var events=['save','remove','update'];function createListener(_0x46dd7a,_0x4c0bb3){return function(_0x213e5d){_0x4c0bb3[_0xcfcb('0x1')](_0x46dd7a,_0x213e5d);};}function removeListener(_0x1cd08a,_0x4f22ae){return function(){DashboardItemEvents[_0xcfcb('0x2')](_0x1cd08a,_0x4f22ae);};}exports[_0xcfcb('0x3')]=function(_0x4b5b93){for(var _0x1960e3=0x0,_0x422899=events[_0xcfcb('0x4')];_0x1960e3<_0x422899;_0x1960e3++){var _0x471576=events[_0x1960e3];var _0x496534=createListener(_0xcfcb('0x5')+_0x471576,_0x4b5b93);DashboardItemEvents['on'](_0x471576,_0x496534);}}; \ No newline at end of file +var _0x8a52=['length','dashboardItem:','./dashboardItem.events','save','remove','update','emit','register'];(function(_0x385fa3,_0x132aad){var _0x4d0c04=function(_0x261960){while(--_0x261960){_0x385fa3['push'](_0x385fa3['shift']());}};_0x4d0c04(++_0x132aad);}(_0x8a52,0x1aa));var _0x28a5=function(_0xcec525,_0x2e19a5){_0xcec525=_0xcec525-0x0;var _0x3d5970=_0x8a52[_0xcec525];return _0x3d5970;};'use strict';var DashboardItemEvents=require(_0x28a5('0x0'));var events=[_0x28a5('0x1'),_0x28a5('0x2'),_0x28a5('0x3')];function createListener(_0x5c4bb6,_0x391539){return function(_0x13d71e){_0x391539[_0x28a5('0x4')](_0x5c4bb6,_0x13d71e);};}function removeListener(_0xe645cb,_0x404126){return function(){DashboardItemEvents['removeListener'](_0xe645cb,_0x404126);};}exports[_0x28a5('0x5')]=function(_0x597a23){for(var _0x4438dc=0x0,_0x3ab4d4=events[_0x28a5('0x6')];_0x4438dc<_0x3ab4d4;_0x4438dc++){var _0x1e7e76=events[_0x4438dc];var _0x9a5362=createListener(_0x28a5('0x7')+_0x1e7e76,_0x597a23);DashboardItemEvents['on'](_0x1e7e76,_0x9a5362);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index c3dcf4d..e21f0fa 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 _0xe113=['path','connect-timeout','express','Router','../../config/environment','./dashboardItem.controller','/:id','isAuthenticated','post','create','put','destroy','exports','util'];(function(_0xd44b94,_0x119a9a){var _0x313d40=function(_0x4a0df9){while(--_0x4a0df9){_0xd44b94['push'](_0xd44b94['shift']());}};_0x313d40(++_0x119a9a);}(_0xe113,0xd1));var _0x3e11=function(_0x3106ab,_0x51847c){_0x3106ab=_0x3106ab-0x0;var _0x821142=_0xe113[_0x3106ab];return _0x821142;};'use strict';var multer=require('multer');var util=require(_0x3e11('0x0'));var path=require(_0x3e11('0x1'));var timeout=require(_0x3e11('0x2'));var express=require(_0x3e11('0x3'));var router=express[_0x3e11('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3e11('0x5'));var controller=require(_0x3e11('0x6'));router['get'](_0x3e11('0x7'),auth[_0x3e11('0x8')](),controller['show']);router[_0x3e11('0x9')]('/',auth['isAuthenticated'](),controller[_0x3e11('0xa')]);router[_0x3e11('0xb')](_0x3e11('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x3e11('0x7'),auth[_0x3e11('0x8')](),controller[_0x3e11('0xc')]);module[_0x3e11('0xd')]=router; \ No newline at end of file +var _0xcbd2=['show','post','isAuthenticated','create','put','update','delete','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','get'];(function(_0x3cc723,_0x5a2bc0){var _0x3f1bb4=function(_0x4a7bac){while(--_0x4a7bac){_0x3cc723['push'](_0x3cc723['shift']());}};_0x3f1bb4(++_0x5a2bc0);}(_0xcbd2,0x14e));var _0x2cbd=function(_0x304b67,_0x31cb39){_0x304b67=_0x304b67-0x0;var _0x493afb=_0xcbd2[_0x304b67];return _0x493afb;};'use strict';var multer=require('multer');var util=require(_0x2cbd('0x0'));var path=require('path');var timeout=require(_0x2cbd('0x1'));var express=require(_0x2cbd('0x2'));var router=express[_0x2cbd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2cbd('0x4'));var interaction=require(_0x2cbd('0x5'));var config=require('../../config/environment');var controller=require(_0x2cbd('0x6'));router[_0x2cbd('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2cbd('0x8')]);router[_0x2cbd('0x9')]('/',auth[_0x2cbd('0xa')](),controller[_0x2cbd('0xb')]);router[_0x2cbd('0xc')]('/:id',auth[_0x2cbd('0xa')](),controller[_0x2cbd('0xd')]);router[_0x2cbd('0xe')](_0x2cbd('0xf'),auth['isAuthenticated'](),controller[_0x2cbd('0x10')]);module[_0x2cbd('0x11')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 98eb6d2..18e9c4d 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 _0xc41d=['second','sequelize','STRING','ENUM','first'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0xc41d,0x100));var _0xdc41=function(_0xc2d263,_0xcee46e){_0xc2d263=_0xc2d263-0x0;var _0x29085d=_0xc41d[_0xc2d263];return _0x29085d;};'use strict';var Sequelize=require(_0xdc41('0x0'));module['exports']={'name':{'type':Sequelize[_0xdc41('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xdc41('0x2')](_0xdc41('0x3'),_0xdc41('0x4'),'third'),'allowNull':![],'defaultValue':_0xdc41('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1e9d=['third','second'];(function(_0x17c3c9,_0x5d70b5){var _0x2cc030=function(_0xc26884){while(--_0xc26884){_0x17c3c9['push'](_0x17c3c9['shift']());}};_0x2cc030(++_0x5d70b5);}(_0x1e9d,0x1a3));var _0xd1e9=function(_0x469bda,_0x51b61f){_0x469bda=_0x469bda-0x0;var _0x84914=_0x1e9d[_0x469bda];return _0x84914;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize['ENUM']('first',_0xd1e9('0x0'),_0xd1e9('0x1')),'allowNull':![],'defaultValue':'first'},'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 0ec950c..9625a75 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 _0x2144=['fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Dispositions','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox'];(function(_0x3ca115,_0x286520){var _0x1538bc=function(_0x2f891b){while(--_0x2f891b){_0x3ca115['push'](_0x3ca115['shift']());}};_0x1538bc(++_0x286520);}(_0x2144,0xfa));var _0x4214=function(_0x1a37b2,_0x584b3b){_0x1a37b2=_0x1a37b2-0x0;var _0x130c75=_0x2144[_0x1a37b2];return _0x130c75;};'use strict';var emlformat=require(_0x4214('0x0'));var rimraf=require(_0x4214('0x1'));var zipdir=require(_0x4214('0x2'));var jsonpatch=require(_0x4214('0x3'));var rp=require(_0x4214('0x4'));var moment=require(_0x4214('0x5'));var BPromise=require(_0x4214('0x6'));var Mustache=require(_0x4214('0x7'));var util=require(_0x4214('0x8'));var path=require(_0x4214('0x9'));var sox=require(_0x4214('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4214('0xb'));var _=require(_0x4214('0xc'));var squel=require(_0x4214('0xd'));var crypto=require(_0x4214('0xe'));var jsforce=require(_0x4214('0xf'));var deskjs=require(_0x4214('0x10'));var toCsv=require(_0x4214('0x11'));var querystring=require('querystring');var Papa=require(_0x4214('0x12'));var Redis=require('ioredis');var authService=require(_0x4214('0x13'));var qs=require(_0x4214('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4214('0x15'));var logger=require(_0x4214('0x16'))(_0x4214('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4214('0x18'));var db=require(_0x4214('0x19'))['db'];function respondWithStatusCode(_0x37b0db,_0x529f35){_0x529f35=_0x529f35||0xcc;return function(_0x7bc8df){if(_0x7bc8df){return _0x37b0db[_0x4214('0x1a')](_0x529f35);}return _0x37b0db['status'](_0x529f35)[_0x4214('0x1b')]();};}function respondWithResult(_0x32e60c,_0x521b94){_0x521b94=_0x521b94||0xc8;return function(_0x393288){if(_0x393288){return _0x32e60c[_0x4214('0x1c')](_0x521b94)[_0x4214('0x1d')](_0x393288);}};}function respondWithFilteredResult(_0x585ba6,_0x48019b){return function(_0x3f00d4){if(_0x3f00d4){var _0x1d540f=typeof _0x48019b[_0x4214('0x1e')]===_0x4214('0x1f')&&typeof _0x48019b[_0x4214('0x20')]===_0x4214('0x1f');var _0x3d5134=_0x3f00d4[_0x4214('0x21')];var _0x2b89f1=_0x1d540f?0x0:_0x48019b[_0x4214('0x1e')];var _0x5d8962=_0x1d540f?_0x3f00d4[_0x4214('0x21')]:_0x48019b['offset']+_0x48019b[_0x4214('0x20')];var _0x13c70f;if(_0x5d8962>=_0x3d5134){_0x5d8962=_0x3d5134;_0x13c70f=0xc8;}else{_0x13c70f=0xce;}_0x585ba6[_0x4214('0x1c')](_0x13c70f);return _0x585ba6[_0x4214('0x22')](_0x4214('0x23'),_0x2b89f1+'-'+_0x5d8962+'/'+_0x3d5134)[_0x4214('0x1d')](_0x3f00d4);}return null;};}function patchUpdates(_0x1e78ef){return function(_0xde10dd){try{jsonpatch[_0x4214('0x24')](_0xde10dd,_0x1e78ef,!![]);}catch(_0x4913d2){return BPromise[_0x4214('0x25')](_0x4913d2);}return _0xde10dd[_0x4214('0x26')]();};}function saveUpdates(_0x19fc97,_0x53ed82){return function(_0x435505){if(_0x435505){return _0x435505[_0x4214('0x27')](_0x19fc97)['then'](function(_0x3c434f){return _0x3c434f;});}return null;};}function removeEntity(_0x534e65,_0x51827e){return function(_0x28ee41){if(_0x28ee41){return _0x28ee41[_0x4214('0x28')]()[_0x4214('0x29')](function(){var _0xd07705=_0x28ee41[_0x4214('0x2a')]({'plain':!![]});var _0x31de80='Dispositions';return db[_0x4214('0x2b')][_0x4214('0x28')]({'where':{'type':_0x31de80,'resourceId':_0xd07705['id']}})[_0x4214('0x29')](function(){return _0x28ee41;});})[_0x4214('0x29')](function(){_0x534e65[_0x4214('0x1c')](0xcc)[_0x4214('0x1b')]();});}};}function handleEntityNotFound(_0x4d5547,_0x23cb25){return function(_0x2aa53e){if(!_0x2aa53e){_0x4d5547[_0x4214('0x1a')](0x194);}return _0x2aa53e;};}function handleError(_0x5daacd,_0x4e2ce4){_0x4e2ce4=_0x4e2ce4||0x1f4;return function(_0x3aa179){logger[_0x4214('0x2c')](_0x3aa179[_0x4214('0x2d')]);if(_0x3aa179['name']){delete _0x3aa179[_0x4214('0x2e')];}_0x5daacd['status'](_0x4e2ce4)[_0x4214('0x2f')](_0x3aa179);};}exports['index']=function(_0x467235,_0x4f786d){var _0x3e8faf={},_0x5f52e7={},_0xf0654={'count':0x0,'rows':[]};var _0x25bd45=_[_0x4214('0x30')](db[_0x4214('0x31')][_0x4214('0x32')],function(_0x54a000){return{'name':_0x54a000[_0x4214('0x33')],'type':_0x54a000[_0x4214('0x34')][_0x4214('0x35')]};});_0x5f52e7[_0x4214('0x36')]=_[_0x4214('0x30')](_0x25bd45,_0x4214('0x2e'));_0x5f52e7[_0x4214('0x37')]=_[_0x4214('0x38')](_0x467235[_0x4214('0x37')]);_0x5f52e7[_0x4214('0x39')]=_[_0x4214('0x3a')](_0x5f52e7[_0x4214('0x36')],_0x5f52e7['query']);_0x3e8faf[_0x4214('0x3b')]=_[_0x4214('0x3a')](_0x5f52e7[_0x4214('0x36')],qs[_0x4214('0x3c')](_0x467235[_0x4214('0x37')]['fields']));_0x3e8faf[_0x4214('0x3b')]=_0x3e8faf[_0x4214('0x3b')][_0x4214('0x3d')]?_0x3e8faf[_0x4214('0x3b')]:_0x5f52e7['model'];if(!_0x467235['query'][_0x4214('0x3e')](_0x4214('0x3f'))){_0x3e8faf[_0x4214('0x20')]=qs['limit'](_0x467235['query'][_0x4214('0x20')]);_0x3e8faf['offset']=qs['offset'](_0x467235[_0x4214('0x37')][_0x4214('0x1e')]);}_0x3e8faf[_0x4214('0x40')]=qs[_0x4214('0x41')](_0x467235[_0x4214('0x37')][_0x4214('0x41')]);_0x3e8faf['where']=qs['filters'](_[_0x4214('0x42')](_0x467235[_0x4214('0x37')],_0x5f52e7['filters']),_0x25bd45);if(_0x467235[_0x4214('0x37')][_0x4214('0x43')]){_0x3e8faf[_0x4214('0x44')]=_['merge'](_0x3e8faf[_0x4214('0x44')],{'$or':_[_0x4214('0x30')](_0x25bd45,function(_0x57411e){if(_0x57411e[_0x4214('0x34')]!==_0x4214('0x45')){var _0x3da7d7={};_0x3da7d7[_0x57411e['name']]={'$like':'%'+_0x467235[_0x4214('0x37')]['filter']+'%'};return _0x3da7d7;}})});}_0x3e8faf=_[_0x4214('0x46')]({},_0x3e8faf,_0x467235[_0x4214('0x47')]);var _0x4ba00f={'where':_0x3e8faf[_0x4214('0x44')]};return db[_0x4214('0x31')]['count'](_0x4ba00f)[_0x4214('0x29')](function(_0x36a93e){_0xf0654[_0x4214('0x21')]=_0x36a93e;if(_0x467235['query'][_0x4214('0x48')]){_0x3e8faf[_0x4214('0x49')]=[{'all':!![]}];}return db[_0x4214('0x31')][_0x4214('0x4a')](_0x3e8faf);})[_0x4214('0x29')](function(_0x18c496){_0xf0654[_0x4214('0x4b')]=_0x18c496;return _0xf0654;})[_0x4214('0x29')](respondWithFilteredResult(_0x4f786d,_0x3e8faf))['catch'](handleError(_0x4f786d,null));};exports['show']=function(_0x2056a3,_0x5e662e){var _0xf6d2d8={'raw':!![],'where':{'id':_0x2056a3[_0x4214('0x4c')]['id']}},_0x6e8be3={};_0x6e8be3['model']=_[_0x4214('0x38')](db['Disposition'][_0x4214('0x32')]);_0x6e8be3[_0x4214('0x37')]=_[_0x4214('0x38')](_0x2056a3[_0x4214('0x37')]);_0x6e8be3[_0x4214('0x39')]=_[_0x4214('0x3a')](_0x6e8be3[_0x4214('0x36')],_0x6e8be3[_0x4214('0x37')]);_0xf6d2d8[_0x4214('0x3b')]=_[_0x4214('0x3a')](_0x6e8be3[_0x4214('0x36')],qs[_0x4214('0x3c')](_0x2056a3['query'][_0x4214('0x3c')]));_0xf6d2d8[_0x4214('0x3b')]=_0xf6d2d8['attributes']['length']?_0xf6d2d8[_0x4214('0x3b')]:_0x6e8be3['model'];if(_0x2056a3['query'][_0x4214('0x48')]){_0xf6d2d8[_0x4214('0x49')]=[{'all':!![]}];}_0xf6d2d8=_[_0x4214('0x46')]({},_0xf6d2d8,_0x2056a3[_0x4214('0x47')]);return db[_0x4214('0x31')][_0x4214('0x4d')](_0xf6d2d8)[_0x4214('0x29')](handleEntityNotFound(_0x5e662e,null))[_0x4214('0x29')](respondWithResult(_0x5e662e,null))[_0x4214('0x4e')](handleError(_0x5e662e,null));};exports['create']=function(_0x54530b,_0x1bf709){return db[_0x4214('0x31')]['create'](_0x54530b[_0x4214('0x4f')],{})[_0x4214('0x29')](function(_0x1d80f1){var _0x4da321=_0x54530b[_0x4214('0x50')][_0x4214('0x2a')]({'plain':!![]});if(!_0x4da321)throw new Error(_0x4214('0x51'));if(_0x4da321[_0x4214('0x52')]===_0x4214('0x50')){var _0x3cd82f=_0x1d80f1[_0x4214('0x2a')]({'plain':!![]});var _0x56b0be=_0x4214('0x53');return db[_0x4214('0x54')][_0x4214('0x4d')]({'where':{'name':_0x56b0be,'userProfileId':_0x4da321[_0x4214('0x55')]},'raw':!![]})[_0x4214('0x29')](function(_0x3e897e){if(_0x3e897e&&_0x3e897e['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3cd82f['name'],'resourceId':_0x3cd82f['id'],'type':_0x3e897e[_0x4214('0x2e')],'sectionId':_0x3e897e['id']},{})[_0x4214('0x29')](function(){return _0x1d80f1;});}else{return _0x1d80f1;}})['catch'](function(_0x194ba8){logger[_0x4214('0x2c')](_0x4214('0x56'),_0x194ba8);throw _0x194ba8;});}return _0x1d80f1;})[_0x4214('0x29')](respondWithResult(_0x1bf709,0xc9))[_0x4214('0x4e')](handleError(_0x1bf709,null));};exports[_0x4214('0x27')]=function(_0x2859fe,_0x1f1bf5){if(_0x2859fe['body']['id']){delete _0x2859fe[_0x4214('0x4f')]['id'];}return db['Disposition']['find']({'where':{'id':_0x2859fe[_0x4214('0x4c')]['id']}})[_0x4214('0x29')](handleEntityNotFound(_0x1f1bf5,null))['then'](saveUpdates(_0x2859fe[_0x4214('0x4f')],null))[_0x4214('0x29')](respondWithResult(_0x1f1bf5,null))['catch'](handleError(_0x1f1bf5,null));};exports[_0x4214('0x28')]=function(_0x42c54b,_0x179c7b){return db[_0x4214('0x31')][_0x4214('0x4d')]({'where':{'id':_0x42c54b[_0x4214('0x4c')]['id']}})[_0x4214('0x29')](handleEntityNotFound(_0x179c7b,null))[_0x4214('0x29')](removeEntity(_0x179c7b,null))[_0x4214('0x4e')](handleError(_0x179c7b,null));}; \ No newline at end of file +var _0x30cb=['pick','filter','VIRTUAL','merge','options','findAll','rows','show','keys','intersection','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Dispositions','error','send','map','Disposition','rawAttributes','fieldName','type','key','model','name','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters'];(function(_0x537400,_0x3497dd){var _0x16410c=function(_0x4b2783){while(--_0x4b2783){_0x537400['push'](_0x537400['shift']());}};_0x16410c(++_0x3497dd);}(_0x30cb,0xb8));var _0xb30c=function(_0x17f846,_0x15d839){_0x17f846=_0x17f846-0x0;var _0x224610=_0x30cb[_0x17f846];return _0x224610;};'use strict';var emlformat=require(_0xb30c('0x0'));var rimraf=require(_0xb30c('0x1'));var zipdir=require(_0xb30c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb30c('0x3'));var moment=require(_0xb30c('0x4'));var BPromise=require(_0xb30c('0x5'));var Mustache=require(_0xb30c('0x6'));var util=require('util');var path=require(_0xb30c('0x7'));var sox=require('sox');var csv=require(_0xb30c('0x8'));var ejs=require(_0xb30c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb30c('0xa'));var squel=require('squel');var crypto=require(_0xb30c('0xb'));var jsforce=require(_0xb30c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xb30c('0x8'));var querystring=require('querystring');var Papa=require(_0xb30c('0xd'));var Redis=require(_0xb30c('0xe'));var authService=require(_0xb30c('0xf'));var qs=require(_0xb30c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb30c('0x11'));var logger=require(_0xb30c('0x12'))(_0xb30c('0x13'));var utils=require(_0xb30c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb30c('0x15'))['db'];function respondWithStatusCode(_0x2d68b7,_0x342f0f){_0x342f0f=_0x342f0f||0xcc;return function(_0x4bd15a){if(_0x4bd15a){return _0x2d68b7[_0xb30c('0x16')](_0x342f0f);}return _0x2d68b7[_0xb30c('0x17')](_0x342f0f)[_0xb30c('0x18')]();};}function respondWithResult(_0x2be93e,_0x17ac88){_0x17ac88=_0x17ac88||0xc8;return function(_0x335de2){if(_0x335de2){return _0x2be93e['status'](_0x17ac88)[_0xb30c('0x19')](_0x335de2);}};}function respondWithFilteredResult(_0x16dc3e,_0x8d58b7){return function(_0x3aa4d){if(_0x3aa4d){var _0x34354a=typeof _0x8d58b7[_0xb30c('0x1a')]==='undefined'&&typeof _0x8d58b7[_0xb30c('0x1b')]===_0xb30c('0x1c');var _0x168c0a=_0x3aa4d[_0xb30c('0x1d')];var _0x352f67=_0x34354a?0x0:_0x8d58b7[_0xb30c('0x1a')];var _0x2445df=_0x34354a?_0x3aa4d[_0xb30c('0x1d')]:_0x8d58b7[_0xb30c('0x1a')]+_0x8d58b7[_0xb30c('0x1b')];var _0x426fc4;if(_0x2445df>=_0x168c0a){_0x2445df=_0x168c0a;_0x426fc4=0xc8;}else{_0x426fc4=0xce;}_0x16dc3e[_0xb30c('0x17')](_0x426fc4);return _0x16dc3e[_0xb30c('0x1e')](_0xb30c('0x1f'),_0x352f67+'-'+_0x2445df+'/'+_0x168c0a)[_0xb30c('0x19')](_0x3aa4d);}return null;};}function patchUpdates(_0x3477cd){return function(_0x338e42){try{jsonpatch[_0xb30c('0x20')](_0x338e42,_0x3477cd,!![]);}catch(_0x304c8f){return BPromise[_0xb30c('0x21')](_0x304c8f);}return _0x338e42[_0xb30c('0x22')]();};}function saveUpdates(_0x4570a7,_0x3ef5b1){return function(_0x584786){if(_0x584786){return _0x584786[_0xb30c('0x23')](_0x4570a7)['then'](function(_0x15bc36){return _0x15bc36;});}return null;};}function removeEntity(_0x3c465d,_0x2ce4f8){return function(_0xe7f8c0){if(_0xe7f8c0){return _0xe7f8c0[_0xb30c('0x24')]()[_0xb30c('0x25')](function(){var _0x45668f=_0xe7f8c0[_0xb30c('0x26')]({'plain':!![]});var _0x33dc38=_0xb30c('0x27');return db['UserProfileResource'][_0xb30c('0x24')]({'where':{'type':_0x33dc38,'resourceId':_0x45668f['id']}})['then'](function(){return _0xe7f8c0;});})[_0xb30c('0x25')](function(){_0x3c465d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de009,_0x2e2b93){return function(_0x53029c){if(!_0x53029c){_0x1de009[_0xb30c('0x16')](0x194);}return _0x53029c;};}function handleError(_0x2c11c1,_0x34946b){_0x34946b=_0x34946b||0x1f4;return function(_0x48683e){logger[_0xb30c('0x28')](_0x48683e['stack']);if(_0x48683e['name']){delete _0x48683e['name'];}_0x2c11c1[_0xb30c('0x17')](_0x34946b)[_0xb30c('0x29')](_0x48683e);};}exports['index']=function(_0x56d66d,_0x53681b){var _0x2eb2c9={},_0x401d73={},_0x56037e={'count':0x0,'rows':[]};var _0x27e46c=_[_0xb30c('0x2a')](db[_0xb30c('0x2b')][_0xb30c('0x2c')],function(_0x3f8019){return{'name':_0x3f8019[_0xb30c('0x2d')],'type':_0x3f8019[_0xb30c('0x2e')][_0xb30c('0x2f')]};});_0x401d73[_0xb30c('0x30')]=_[_0xb30c('0x2a')](_0x27e46c,_0xb30c('0x31'));_0x401d73[_0xb30c('0x32')]=_['keys'](_0x56d66d[_0xb30c('0x32')]);_0x401d73['filters']=_['intersection'](_0x401d73[_0xb30c('0x30')],_0x401d73[_0xb30c('0x32')]);_0x2eb2c9[_0xb30c('0x33')]=_['intersection'](_0x401d73[_0xb30c('0x30')],qs[_0xb30c('0x34')](_0x56d66d[_0xb30c('0x32')][_0xb30c('0x34')]));_0x2eb2c9[_0xb30c('0x33')]=_0x2eb2c9[_0xb30c('0x33')][_0xb30c('0x35')]?_0x2eb2c9[_0xb30c('0x33')]:_0x401d73[_0xb30c('0x30')];if(!_0x56d66d[_0xb30c('0x32')][_0xb30c('0x36')](_0xb30c('0x37'))){_0x2eb2c9[_0xb30c('0x1b')]=qs[_0xb30c('0x1b')](_0x56d66d['query']['limit']);_0x2eb2c9[_0xb30c('0x1a')]=qs[_0xb30c('0x1a')](_0x56d66d['query'][_0xb30c('0x1a')]);}_0x2eb2c9[_0xb30c('0x38')]=qs['sort'](_0x56d66d[_0xb30c('0x32')]['sort']);_0x2eb2c9[_0xb30c('0x39')]=qs[_0xb30c('0x3a')](_[_0xb30c('0x3b')](_0x56d66d[_0xb30c('0x32')],_0x401d73[_0xb30c('0x3a')]),_0x27e46c);if(_0x56d66d[_0xb30c('0x32')][_0xb30c('0x3c')]){_0x2eb2c9[_0xb30c('0x39')]=_['merge'](_0x2eb2c9['where'],{'$or':_[_0xb30c('0x2a')](_0x27e46c,function(_0x2064f2){if(_0x2064f2[_0xb30c('0x2e')]!==_0xb30c('0x3d')){var _0x543c87={};_0x543c87[_0x2064f2[_0xb30c('0x31')]]={'$like':'%'+_0x56d66d[_0xb30c('0x32')][_0xb30c('0x3c')]+'%'};return _0x543c87;}})});}_0x2eb2c9=_[_0xb30c('0x3e')]({},_0x2eb2c9,_0x56d66d[_0xb30c('0x3f')]);var _0x4e686b={'where':_0x2eb2c9[_0xb30c('0x39')]};return db['Disposition']['count'](_0x4e686b)[_0xb30c('0x25')](function(_0x29fe37){_0x56037e[_0xb30c('0x1d')]=_0x29fe37;if(_0x56d66d['query']['includeAll']){_0x2eb2c9['include']=[{'all':!![]}];}return db[_0xb30c('0x2b')][_0xb30c('0x40')](_0x2eb2c9);})[_0xb30c('0x25')](function(_0x32dc90){_0x56037e[_0xb30c('0x41')]=_0x32dc90;return _0x56037e;})[_0xb30c('0x25')](respondWithFilteredResult(_0x53681b,_0x2eb2c9))['catch'](handleError(_0x53681b,null));};exports[_0xb30c('0x42')]=function(_0x56a665,_0x1933e0){var _0x1c4ab9={'raw':!![],'where':{'id':_0x56a665['params']['id']}},_0x125457={};_0x125457[_0xb30c('0x30')]=_[_0xb30c('0x43')](db['Disposition'][_0xb30c('0x2c')]);_0x125457[_0xb30c('0x32')]=_[_0xb30c('0x43')](_0x56a665['query']);_0x125457[_0xb30c('0x3a')]=_[_0xb30c('0x44')](_0x125457['model'],_0x125457[_0xb30c('0x32')]);_0x1c4ab9[_0xb30c('0x33')]=_['intersection'](_0x125457['model'],qs[_0xb30c('0x34')](_0x56a665[_0xb30c('0x32')][_0xb30c('0x34')]));_0x1c4ab9[_0xb30c('0x33')]=_0x1c4ab9[_0xb30c('0x33')][_0xb30c('0x35')]?_0x1c4ab9[_0xb30c('0x33')]:_0x125457[_0xb30c('0x30')];if(_0x56a665[_0xb30c('0x32')][_0xb30c('0x45')]){_0x1c4ab9['include']=[{'all':!![]}];}_0x1c4ab9=_[_0xb30c('0x3e')]({},_0x1c4ab9,_0x56a665[_0xb30c('0x3f')]);return db[_0xb30c('0x2b')][_0xb30c('0x46')](_0x1c4ab9)[_0xb30c('0x25')](handleEntityNotFound(_0x1933e0,null))[_0xb30c('0x25')](respondWithResult(_0x1933e0,null))[_0xb30c('0x47')](handleError(_0x1933e0,null));};exports[_0xb30c('0x48')]=function(_0x186768,_0x1cb55c){return db['Disposition'][_0xb30c('0x48')](_0x186768['body'],{})[_0xb30c('0x25')](function(_0x5278e1){var _0x63a5c7=_0x186768[_0xb30c('0x49')][_0xb30c('0x26')]({'plain':!![]});if(!_0x63a5c7)throw new Error(_0xb30c('0x4a'));if(_0x63a5c7[_0xb30c('0x4b')]===_0xb30c('0x49')){var _0x3fb1c0=_0x5278e1[_0xb30c('0x26')]({'plain':!![]});var _0x44d6bf=_0xb30c('0x27');return db[_0xb30c('0x4c')][_0xb30c('0x46')]({'where':{'name':_0x44d6bf,'userProfileId':_0x63a5c7[_0xb30c('0x4d')]},'raw':!![]})['then'](function(_0x2c5f86){if(_0x2c5f86&&_0x2c5f86['autoAssociation']===0x0){return db['UserProfileResource'][_0xb30c('0x48')]({'name':_0x3fb1c0[_0xb30c('0x31')],'resourceId':_0x3fb1c0['id'],'type':_0x2c5f86['name'],'sectionId':_0x2c5f86['id']},{})['then'](function(){return _0x5278e1;});}else{return _0x5278e1;}})[_0xb30c('0x47')](function(_0x323be8){logger['error'](_0xb30c('0x4e'),_0x323be8);throw _0x323be8;});}return _0x5278e1;})[_0xb30c('0x25')](respondWithResult(_0x1cb55c,0xc9))[_0xb30c('0x47')](handleError(_0x1cb55c,null));};exports[_0xb30c('0x23')]=function(_0x54b143,_0x5df0c9){if(_0x54b143['body']['id']){delete _0x54b143[_0xb30c('0x4f')]['id'];}return db['Disposition'][_0xb30c('0x46')]({'where':{'id':_0x54b143['params']['id']}})[_0xb30c('0x25')](handleEntityNotFound(_0x5df0c9,null))[_0xb30c('0x25')](saveUpdates(_0x54b143[_0xb30c('0x4f')],null))['then'](respondWithResult(_0x5df0c9,null))[_0xb30c('0x47')](handleError(_0x5df0c9,null));};exports['destroy']=function(_0x59f325,_0x94dd80){return db['Disposition']['find']({'where':{'id':_0x59f325[_0xb30c('0x50')]['id']}})[_0xb30c('0x25')](handleEntityNotFound(_0x94dd80,null))[_0xb30c('0x25')](removeEntity(_0x94dd80,null))[_0xb30c('0x47')](handleError(_0x94dd80,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 35e95d9..da26a2f 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 _0x46f2=['request-promise','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','bluebird'];(function(_0x222dde,_0x29cc79){var _0x21bd98=function(_0x404bca){while(--_0x404bca){_0x222dde['push'](_0x222dde['shift']());}};_0x21bd98(++_0x29cc79);}(_0x46f2,0x133));var _0x246f=function(_0x335aec,_0x4754a5){_0x335aec=_0x335aec-0x0;var _0x29095f=_0x46f2[_0x335aec];return _0x29095f;};'use strict';var _=require(_0x246f('0x0'));var util=require(_0x246f('0x1'));var logger=require(_0x246f('0x2'))(_0x246f('0x3'));var moment=require('moment');var BPromise=require(_0x246f('0x4'));var rp=require(_0x246f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x246f('0x6'));var config=require(_0x246f('0x7'));var attributes=require(_0x246f('0x8'));module[_0x246f('0x9')]=function(_0x17b6e2,_0x281d90){return _0x17b6e2[_0x246f('0xa')]('Disposition',attributes,{'tableName':_0x246f('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x246f('0xc'),'fields':[_0x246f('0xd'),_0x246f('0xe')]},{'unique':!![],'name':'name_chat','fields':[_0x246f('0xd'),_0x246f('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0x246f('0xd'),_0x246f('0x10')]},{'unique':!![],'name':_0x246f('0x11'),'fields':[_0x246f('0xd'),_0x246f('0x12')]},{'unique':!![],'name':'name_fax','fields':['name',_0x246f('0x13')]},{'unique':!![],'name':_0x246f('0x14'),'fields':['name',_0x246f('0x15')]},{'unique':!![],'name':_0x246f('0x16'),'fields':['name',_0x246f('0x17')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1897=['name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name_voice','ListId'];(function(_0x1a4d35,_0x1005b6){var _0x5c7ed3=function(_0x36043f){while(--_0x36043f){_0x1a4d35['push'](_0x1a4d35['shift']());}};_0x5c7ed3(++_0x1005b6);}(_0x1897,0xfb));var _0x7189=function(_0xbf321b,_0x5da747){_0xbf321b=_0xbf321b-0x0;var _0x1955bc=_0x1897[_0xbf321b];return _0x1955bc;};'use strict';var _=require(_0x7189('0x0'));var util=require('util');var logger=require(_0x7189('0x1'))('api');var moment=require(_0x7189('0x2'));var BPromise=require('bluebird');var rp=require(_0x7189('0x3'));var fs=require('fs');var path=require(_0x7189('0x4'));var rimraf=require(_0x7189('0x5'));var config=require(_0x7189('0x6'));var attributes=require(_0x7189('0x7'));module[_0x7189('0x8')]=function(_0x370a0a,_0xad0661){return _0x370a0a[_0x7189('0x9')]('Disposition',attributes,{'tableName':_0x7189('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x7189('0xb'),'fields':['name',_0x7189('0xc')]},{'unique':!![],'name':_0x7189('0xd'),'fields':['name',_0x7189('0xe')]},{'unique':!![],'name':_0x7189('0xf'),'fields':['name',_0x7189('0x10')]},{'unique':!![],'name':_0x7189('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0x7189('0x12'),_0x7189('0x13')]},{'unique':!![],'name':_0x7189('0x14'),'fields':[_0x7189('0x12'),_0x7189('0x15')]},{'unique':!![],'name':_0x7189('0x16'),'fields':[_0x7189('0x12'),_0x7189('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 7252373..1612e50 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(_0x503b07,_0x29e87f){var _0x4f2141=function(_0x371e8f){while(--_0x371e8f){_0x503b07['push'](_0x503b07['shift']());}};_0x4f2141(++_0x29e87f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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(_0x4fc6c8,_0x5a65f9){var _0x1b0374=function(_0x1215f9){while(--_0x1215f9){_0x4fc6c8['push'](_0x4fc6c8['shift']());}};_0x1b0374(++_0x5a65f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 46cab19..b2e0274 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 _0x8b84=['post','create','/:id','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./disposition.controller','index','get','isAuthenticated','show'];(function(_0x4e7378,_0xdae464){var _0x193158=function(_0x26bf1a){while(--_0x26bf1a){_0x4e7378['push'](_0x4e7378['shift']());}};_0x193158(++_0xdae464);}(_0x8b84,0x1bf));var _0x48b8=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8b84[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require('multer');var util=require(_0x48b8('0x0'));var path=require(_0x48b8('0x1'));var timeout=require(_0x48b8('0x2'));var express=require(_0x48b8('0x3'));var router=express[_0x48b8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x48b8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x48b8('0x6'));var controller=require(_0x48b8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x48b8('0x8')]);router[_0x48b8('0x9')]('/:id',auth[_0x48b8('0xa')](),controller[_0x48b8('0xb')]);router[_0x48b8('0xc')]('/',auth[_0x48b8('0xa')](),controller[_0x48b8('0xd')]);router['put'](_0x48b8('0xe'),auth[_0x48b8('0xa')](),controller[_0x48b8('0xf')]);router['delete'](_0x48b8('0xe'),auth[_0x48b8('0xa')](),controller['destroy']);module[_0x48b8('0x10')]=router; \ No newline at end of file +var _0x1a82=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','show','put','/:id','delete','destroy'];(function(_0x1446fc,_0x13d287){var _0x184ce1=function(_0x607563){while(--_0x607563){_0x1446fc['push'](_0x1446fc['shift']());}};_0x184ce1(++_0x13d287);}(_0x1a82,0x70));var _0x21a8=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0x1a82[_0x5ce8b9];return _0xe34be0;};'use strict';var multer=require(_0x21a8('0x0'));var util=require(_0x21a8('0x1'));var path=require(_0x21a8('0x2'));var timeout=require(_0x21a8('0x3'));var express=require('express');var router=express[_0x21a8('0x4')]();var fs_extra=require(_0x21a8('0x5'));var auth=require(_0x21a8('0x6'));var interaction=require(_0x21a8('0x7'));var config=require(_0x21a8('0x8'));var controller=require('./disposition.controller');router['get']('/',auth[_0x21a8('0x9')](),controller['index']);router[_0x21a8('0xa')]('/:id',auth[_0x21a8('0x9')](),controller[_0x21a8('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x21a8('0xc')](_0x21a8('0xd'),auth[_0x21a8('0x9')](),controller['update']);router[_0x21a8('0xe')]('/:id',auth[_0x21a8('0x9')](),controller[_0x21a8('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 2b7478c..85473f5 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 _0x4559=['SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition','sequelize','exports','ENUM','yes','xCALLY\x20Motion\x20Fax','STRING','localstationid','2400','4800','9600','12000','14400','7200','INTEGER','IAX','DADHI','KHOMP'];(function(_0x36cd6c,_0x4b011e){var _0x16cbd3=function(_0x576d8b){while(--_0x576d8b){_0x36cd6c['push'](_0x36cd6c['shift']());}};_0x16cbd3(++_0x4b011e);}(_0x4559,0x13f));var _0x9455=function(_0x1098a9,_0x2748f9){_0x1098a9=_0x1098a9-0x0;var _0x166c83=_0x4559[_0x1098a9];return _0x166c83;};'use strict';var Sequelize=require(_0x9455('0x0'));module[_0x9455('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x9455('0x2')](_0x9455('0x3'),'no'),'defaultValue':_0x9455('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x9455('0x4')},'localstationid':{'type':Sequelize[_0x9455('0x5')],'unique':_0x9455('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x9455('0x7'),_0x9455('0x8'),'7200',_0x9455('0x9'),_0x9455('0xa'),_0x9455('0xb')),'defaultValue':_0x9455('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0x9455('0x7'),_0x9455('0x8'),_0x9455('0xc'),'9600',_0x9455('0xa'),_0x9455('0xb')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x9455('0x5')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9455('0x5')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9455('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9455('0x2')]('SIP',_0x9455('0xe'),_0x9455('0xf'),_0x9455('0x10')),'defaultValue':_0x9455('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9455('0x12')],'defaultValue':function(){return _0x9455('0x13');}},'notificationSound':{'type':Sequelize[_0x9455('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9455('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9455('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9455('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9455('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9455('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x9455('0x15')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0xf02a5d){if(!_0xf02a5d)this[_0x9455('0x16')]('mandatoryDispositionPauseId',null);this[_0x9455('0x16')](_0x9455('0x17'),_0xf02a5d);}}}; \ No newline at end of file +var _0xe900=['xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe900,0x14b));var _0x0e90=function(_0x42ffaa,_0x4b10d8){_0x42ffaa=_0x42ffaa-0x0;var _0x1342ee=_0xe900[_0x42ffaa];return _0x1342ee;};'use strict';var Sequelize=require(_0x0e90('0x0'));module[_0x0e90('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0e90('0x2')]},'ecm':{'type':Sequelize[_0x0e90('0x3')]('yes','no'),'defaultValue':_0x0e90('0x4')},'headerinfo':{'type':Sequelize[_0x0e90('0x2')],'defaultValue':_0x0e90('0x5')},'localstationid':{'type':Sequelize[_0x0e90('0x2')],'unique':_0x0e90('0x6')},'minrate':{'type':Sequelize[_0x0e90('0x3')](_0x0e90('0x7'),_0x0e90('0x8'),_0x0e90('0x9'),_0x0e90('0xa'),_0x0e90('0xb'),_0x0e90('0xc')),'defaultValue':_0x0e90('0x8')},'maxrate':{'type':Sequelize[_0x0e90('0x3')](_0x0e90('0x7'),'4800',_0x0e90('0x9'),_0x0e90('0xa'),'12000',_0x0e90('0xc')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x0e90('0x2')],'defaultValue':_0x0e90('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x0e90('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM']('SIP','IAX','DADHI',_0x0e90('0xe')),'defaultValue':_0x0e90('0xf')},'key':{'type':Sequelize[_0x0e90('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x0e90('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x0e90('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0e90('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0e90('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0e90('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x0e90('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x0e90('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x0e90('0x11')],'defaultValue':![],'comment':_0x0e90('0x14'),'set':function(_0x385a4a){if(!_0x385a4a)this[_0x0e90('0x15')](_0x0e90('0x16'),null);this['setDataValue'](_0x0e90('0x17'),_0x385a4a);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 8c64d1f..b67d7d6 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 _0x8412=['FaxApplication','bulkCreate','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','headerinfo','maxrate','minrate','modem','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','transaction','VoiceExtension','omit','createdAt','updatedAt','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','server/files/attachments','basename','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxAccount.socket','register','jayson/promise','http','client','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','get','FaxAccounts','UserProfileResource','end','stack','name','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','show','params','mandatoryDispositionPause','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','FaxAccountId','Disposition','findOne','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','Contact','User','Owner','internal','Tag','color','tag','addApplications','sequelize','Transaction'];(function(_0x2f96b6,_0x592500){var _0x48d7b4=function(_0x893ecc){while(--_0x893ecc){_0x2f96b6['push'](_0x2f96b6['shift']());}};_0x48d7b4(++_0x592500);}(_0x8412,0x104));var _0x2841=function(_0xacb1e2,_0x55e0ab){_0xacb1e2=_0xacb1e2-0x0;var _0x463815=_0x8412[_0xacb1e2];return _0x463815;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2841('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2841('0x1'));var rp=require(_0x2841('0x2'));var moment=require(_0x2841('0x3'));var BPromise=require(_0x2841('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2841('0x5'));var sox=require(_0x2841('0x6'));var csv=require(_0x2841('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2841('0x8'));var _=require(_0x2841('0x9'));var squel=require(_0x2841('0xa'));var crypto=require(_0x2841('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2841('0xc'));var toCsv=require(_0x2841('0x7'));var querystring=require('querystring');var Papa=require(_0x2841('0xd'));var Redis=require(_0x2841('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2841('0xf'));var hardwareService=require(_0x2841('0x10'));var logger=require('../../config/logger')(_0x2841('0x11'));var utils=require('../../config/utils');var config=require(_0x2841('0x12'));var licenseUtil=require(_0x2841('0x13'));var db=require(_0x2841('0x14'))['db'];config['redis']=_[_0x2841('0x15')](config[_0x2841('0x16')],{'host':_0x2841('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2841('0x16')]));require(_0x2841('0x18'))[_0x2841('0x19')](socket);var jayson=require(_0x2841('0x1a'));var client=jayson['client'][_0x2841('0x1b')]({'port':0x232c});var client9002=jayson[_0x2841('0x1c')][_0x2841('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x47721f,_0x201adb,_0x1381b3,_0x242952){return new BPromise(function(_0x2c176d,_0x1de521){var _0x52850c=_0x242952||client;return _0x52850c[_0x2841('0x1d')](_0x47721f,_0x1381b3)['then'](function(_0x36e9e9){logger[_0x2841('0x1e')](_0x2841('0x1f'),_0x201adb,'request\x20sent');logger['debug'](_0x2841('0x20'),_0x201adb,_0x2841('0x21'),JSON[_0x2841('0x22')](_0x36e9e9));if(_0x36e9e9[_0x2841('0x23')]){if(_0x36e9e9[_0x2841('0x23')][_0x2841('0x24')]===0x1f4){logger[_0x2841('0x23')]('FaxAccount,\x20%s,\x20%s',_0x201adb,_0x36e9e9[_0x2841('0x23')][_0x2841('0x25')]);return _0x1de521(_0x36e9e9[_0x2841('0x23')][_0x2841('0x25')]);}logger[_0x2841('0x23')](_0x2841('0x1f'),_0x201adb,_0x36e9e9[_0x2841('0x23')]['message']);return _0x2c176d(_0x36e9e9[_0x2841('0x23')]['message']);}else{logger[_0x2841('0x1e')](_0x2841('0x1f'),_0x201adb,'request\x20sent');_0x2c176d(_0x36e9e9[_0x2841('0x26')][_0x2841('0x25')]);}})[_0x2841('0x27')](function(_0x15e22e){logger[_0x2841('0x23')](_0x2841('0x1f'),_0x201adb,_0x15e22e);_0x1de521(_0x15e22e);});});}function respondWithStatusCode(_0x2b48a8,_0x219114){_0x219114=_0x219114||0xcc;return function(_0x519673){if(_0x519673){return _0x2b48a8[_0x2841('0x28')](_0x219114);}return _0x2b48a8[_0x2841('0x29')](_0x219114)['end']();};}function respondWithResult(_0x58834b,_0x547eff){_0x547eff=_0x547eff||0xc8;return function(_0x3e06da){if(_0x3e06da){return _0x58834b['status'](_0x547eff)[_0x2841('0x2a')](_0x3e06da);}};}function respondWithFilteredResult(_0x150204,_0x4e4093){return function(_0x1b5657){if(_0x1b5657){var _0x1f9929=typeof _0x4e4093[_0x2841('0x2b')]===_0x2841('0x2c')&&typeof _0x4e4093[_0x2841('0x2d')]===_0x2841('0x2c');var _0x4d3bc2=_0x1b5657[_0x2841('0x2e')];var _0x4c608d=_0x1f9929?0x0:_0x4e4093[_0x2841('0x2b')];var _0x1f6726=_0x1f9929?_0x1b5657['count']:_0x4e4093['offset']+_0x4e4093['limit'];var _0x28c891;if(_0x1f6726>=_0x4d3bc2){_0x1f6726=_0x4d3bc2;_0x28c891=0xc8;}else{_0x28c891=0xce;}_0x150204[_0x2841('0x29')](_0x28c891);return _0x150204[_0x2841('0x2f')](_0x2841('0x30'),_0x4c608d+'-'+_0x1f6726+'/'+_0x4d3bc2)[_0x2841('0x2a')](_0x1b5657);}return null;};}function patchUpdates(_0x47e2ee){return function(_0x58f184){try{jsonpatch['apply'](_0x58f184,_0x47e2ee,!![]);}catch(_0xc7e045){return BPromise[_0x2841('0x31')](_0xc7e045);}return _0x58f184['save']();};}function saveUpdates(_0x3dab9b,_0xea2828){return function(_0xf77694){if(_0xf77694){return _0xf77694['update'](_0x3dab9b)['then'](function(_0x581a69){return _0x581a69;});}return null;};}function removeEntity(_0x43088f,_0x517059){return function(_0xfe05ba){if(_0xfe05ba){return _0xfe05ba[_0x2841('0x32')]()[_0x2841('0x33')](function(){var _0x22e150=_0xfe05ba[_0x2841('0x34')]({'plain':!![]});var _0x1e7758=_0x2841('0x35');return db[_0x2841('0x36')][_0x2841('0x32')]({'where':{'type':_0x1e7758,'resourceId':_0x22e150['id']}})[_0x2841('0x33')](function(){return _0xfe05ba;});})[_0x2841('0x33')](function(){_0x43088f[_0x2841('0x29')](0xcc)[_0x2841('0x37')]();});}};}function handleEntityNotFound(_0x5b08a1,_0xa88c65){return function(_0x391d8b){if(!_0x391d8b){_0x5b08a1[_0x2841('0x28')](0x194);}return _0x391d8b;};}function handleError(_0x50fd37,_0x38490a){_0x38490a=_0x38490a||0x1f4;return function(_0x26fb39){logger[_0x2841('0x23')](_0x26fb39[_0x2841('0x38')]);if(_0x26fb39['name']){delete _0x26fb39[_0x2841('0x39')];}_0x50fd37[_0x2841('0x29')](_0x38490a)['send'](_0x26fb39);};}exports[_0x2841('0x3a')]=function(_0x21c634,_0x4b9883){var _0x44894e={'include':[{'model':db[_0x2841('0x3b')],'as':'mandatoryDispositionPause'}]},_0x5cdeb2={},_0x6b0bae={'count':0x0,'rows':[]};var _0xf0af72=_[_0x2841('0x3c')](db[_0x2841('0x3d')][_0x2841('0x3e')],function(_0x5f22b7){return{'name':_0x5f22b7[_0x2841('0x3f')],'type':_0x5f22b7[_0x2841('0x40')][_0x2841('0x41')]};});_0x5cdeb2[_0x2841('0x42')]=_['map'](_0xf0af72,_0x2841('0x39'));_0x5cdeb2['query']=_[_0x2841('0x43')](_0x21c634[_0x2841('0x44')]);_0x5cdeb2[_0x2841('0x45')]=_[_0x2841('0x46')](_0x5cdeb2[_0x2841('0x42')],_0x5cdeb2[_0x2841('0x44')]);_0x44894e[_0x2841('0x47')]=_['intersection'](_0x5cdeb2[_0x2841('0x42')],qs[_0x2841('0x48')](_0x21c634[_0x2841('0x44')][_0x2841('0x48')]));_0x44894e[_0x2841('0x47')]=_0x44894e[_0x2841('0x47')][_0x2841('0x49')]?_0x44894e['attributes']:_0x5cdeb2['model'];if(!_0x21c634[_0x2841('0x44')][_0x2841('0x4a')](_0x2841('0x4b'))){_0x44894e[_0x2841('0x2d')]=qs[_0x2841('0x2d')](_0x21c634[_0x2841('0x44')]['limit']);_0x44894e[_0x2841('0x2b')]=qs[_0x2841('0x2b')](_0x21c634['query']['offset']);}_0x44894e[_0x2841('0x4c')]=qs[_0x2841('0x4d')](_0x21c634[_0x2841('0x44')][_0x2841('0x4d')]);_0x44894e[_0x2841('0x4e')]=qs[_0x2841('0x45')](_['pick'](_0x21c634[_0x2841('0x44')],_0x5cdeb2[_0x2841('0x45')]),_0xf0af72);if(_0x21c634[_0x2841('0x44')][_0x2841('0x4f')]){_0x44894e['where']=_[_0x2841('0x50')](_0x44894e[_0x2841('0x4e')],{'$or':_[_0x2841('0x3c')](_0xf0af72,function(_0x374a17){if(_0x374a17[_0x2841('0x40')]!=='VIRTUAL'){var _0x1a7f1c={};_0x1a7f1c[_0x374a17['name']]={'$like':'%'+_0x21c634[_0x2841('0x44')][_0x2841('0x4f')]+'%'};return _0x1a7f1c;}})});}_0x44894e=_['merge']({},_0x44894e,_0x21c634['options']);var _0x4e3e1c={'where':_0x44894e[_0x2841('0x4e')]};return db[_0x2841('0x3d')][_0x2841('0x2e')](_0x4e3e1c)[_0x2841('0x33')](function(_0x3cf745){_0x6b0bae[_0x2841('0x2e')]=_0x3cf745;if(_0x21c634[_0x2841('0x44')][_0x2841('0x51')]){_0x44894e[_0x2841('0x52')]=[{'all':!![]}];}return db[_0x2841('0x3d')][_0x2841('0x53')](_0x44894e);})['then'](function(_0x29b850){_0x6b0bae['rows']=_0x29b850;return _0x6b0bae;})[_0x2841('0x33')](respondWithFilteredResult(_0x4b9883,_0x44894e))[_0x2841('0x27')](handleError(_0x4b9883,null));};exports[_0x2841('0x54')]=function(_0x5d67e3,_0x437fd9){var _0xee9b8e={'raw':![],'where':{'id':_0x5d67e3[_0x2841('0x55')]['id']},'include':[{'model':db[_0x2841('0x3b')],'as':_0x2841('0x56')}]},_0x52962e={};_0x52962e[_0x2841('0x42')]=_[_0x2841('0x43')](db[_0x2841('0x3d')][_0x2841('0x3e')]);_0x52962e[_0x2841('0x44')]=_['keys'](_0x5d67e3['query']);_0x52962e[_0x2841('0x45')]=_[_0x2841('0x46')](_0x52962e[_0x2841('0x42')],_0x52962e[_0x2841('0x44')]);_0xee9b8e[_0x2841('0x47')]=_[_0x2841('0x46')](_0x52962e[_0x2841('0x42')],qs[_0x2841('0x48')](_0x5d67e3[_0x2841('0x44')]['fields']));_0xee9b8e[_0x2841('0x47')]=_0xee9b8e['attributes']['length']?_0xee9b8e[_0x2841('0x47')]:_0x52962e['model'];if(_0x5d67e3[_0x2841('0x44')][_0x2841('0x51')]){_0xee9b8e[_0x2841('0x52')]=[{'all':!![]}];}_0xee9b8e=_['merge']({},_0xee9b8e,_0x5d67e3[_0x2841('0x57')]);return db[_0x2841('0x3d')][_0x2841('0x58')](_0xee9b8e)[_0x2841('0x33')](handleEntityNotFound(_0x437fd9,null))['then'](respondWithResult(_0x437fd9,null))[_0x2841('0x27')](handleError(_0x437fd9,null));};exports[_0x2841('0x59')]=function(_0x51c197,_0x2fd718){return db['FaxAccount'][_0x2841('0x59')](_0x51c197['body'],{})[_0x2841('0x33')](function(_0x36c407){var _0x51e32a=_0x51c197[_0x2841('0x5a')]['get']({'plain':!![]});if(!_0x51e32a)throw new Error(_0x2841('0x5b'));if(_0x51e32a[_0x2841('0x5c')]==='user'){var _0x4ee3b0=_0x36c407['get']({'plain':!![]});var _0x37fba5=_0x2841('0x35');return db[_0x2841('0x5d')][_0x2841('0x58')]({'where':{'name':_0x37fba5,'userProfileId':_0x51e32a['userProfileId']},'raw':!![]})[_0x2841('0x33')](function(_0x4925db){if(_0x4925db&&_0x4925db[_0x2841('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x4ee3b0['name'],'resourceId':_0x4ee3b0['id'],'type':_0x4925db['name'],'sectionId':_0x4925db['id']},{})[_0x2841('0x33')](function(){return _0x36c407;});}else{return _0x36c407;}})[_0x2841('0x27')](function(_0x27bdb0){logger['error'](_0x2841('0x5f'),_0x27bdb0);throw _0x27bdb0;});}return _0x36c407;})['then'](respondWithResult(_0x2fd718,0xc9))[_0x2841('0x27')](handleError(_0x2fd718,null));};exports[_0x2841('0x60')]=function(_0x5ae299,_0x16f58a){if(_0x5ae299[_0x2841('0x61')]['id']){delete _0x5ae299['body']['id'];}return db[_0x2841('0x3d')]['find']({'where':{'id':_0x5ae299[_0x2841('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x2841('0x56')}]})['then'](handleEntityNotFound(_0x16f58a,null))['then'](saveUpdates(_0x5ae299[_0x2841('0x61')],null))['then'](respondWithResult(_0x16f58a,null))[_0x2841('0x27')](handleError(_0x16f58a,null));};exports[_0x2841('0x32')]=function(_0x315957,_0x8df151){return db['FaxAccount'][_0x2841('0x58')]({'where':{'id':_0x315957[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x8df151,null))[_0x2841('0x33')](removeEntity(_0x8df151,null))['catch'](handleError(_0x8df151,null));};exports['describe']=function(_0x18fc7f,_0x123c67){return db[_0x2841('0x3d')][_0x2841('0x62')]()[_0x2841('0x33')](respondWithResult(_0x123c67,null))[_0x2841('0x27')](handleError(_0x123c67,null));};exports[_0x2841('0x63')]=function(_0x278fe5,_0x48016d,_0x24a483){if(_0x278fe5[_0x2841('0x61')]['id']){delete _0x278fe5[_0x2841('0x61')]['id'];}return db[_0x2841('0x3d')][_0x2841('0x58')]({'where':{'id':_0x278fe5[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x48016d,null))['then'](function(_0x210b4a){if(_0x210b4a){_0x278fe5[_0x2841('0x61')][_0x2841('0x64')]=_0x210b4a['id'];return db[_0x2841('0x65')]['create'](_0x278fe5['body']);}})[_0x2841('0x33')](respondWithResult(_0x48016d,null))[_0x2841('0x27')](handleError(_0x48016d,null));};exports['getDispositions']=function(_0x56ad2a,_0x5790fa,_0xe560f0){var _0x323ded={'raw':![],'where':{}};var _0x58972b={};var _0x45c1c2={'count':0x0,'rows':[]};return db[_0x2841('0x3d')][_0x2841('0x66')]({'where':{'id':_0x56ad2a[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x5790fa,null))[_0x2841('0x33')](function(_0x128932){if(_0x128932){_0x58972b[_0x2841('0x42')]=_[_0x2841('0x43')](db[_0x2841('0x65')][_0x2841('0x3e')]);_0x58972b[_0x2841('0x44')]=_[_0x2841('0x43')](_0x56ad2a[_0x2841('0x44')]);_0x58972b['filters']=_['intersection'](_0x58972b[_0x2841('0x42')],_0x58972b[_0x2841('0x44')]);_0x323ded[_0x2841('0x47')]=_[_0x2841('0x46')](_0x58972b[_0x2841('0x42')],qs[_0x2841('0x48')](_0x56ad2a[_0x2841('0x44')][_0x2841('0x48')]));_0x323ded[_0x2841('0x47')]=_0x323ded[_0x2841('0x47')]['length']?_0x323ded['attributes']:_0x58972b[_0x2841('0x42')];if(!_0x56ad2a[_0x2841('0x44')]['hasOwnProperty'](_0x2841('0x4b'))){_0x323ded[_0x2841('0x2d')]=qs[_0x2841('0x2d')](_0x56ad2a[_0x2841('0x44')][_0x2841('0x2d')]);_0x323ded[_0x2841('0x2b')]=qs[_0x2841('0x2b')](_0x56ad2a['query'][_0x2841('0x2b')]);}_0x323ded['order']=qs[_0x2841('0x4d')](_0x56ad2a[_0x2841('0x44')][_0x2841('0x4d')]);_0x323ded[_0x2841('0x4e')]=qs[_0x2841('0x45')](_[_0x2841('0x67')](_0x56ad2a[_0x2841('0x44')],_0x58972b[_0x2841('0x45')]));_0x323ded[_0x2841('0x4e')][_0x2841('0x64')]=_0x128932['id'];if(_0x56ad2a[_0x2841('0x44')][_0x2841('0x4f')]){_0x323ded['where']=_[_0x2841('0x50')](_0x323ded['where'],{'$or':_[_0x2841('0x3c')](_0x323ded[_0x2841('0x47')],function(_0x58b004){var _0x35f060={};_0x35f060[_0x58b004]={'$like':'%'+_0x56ad2a[_0x2841('0x44')][_0x2841('0x4f')]+'%'};return _0x35f060;})});}_0x323ded=_[_0x2841('0x50')]({},_0x323ded,_0x56ad2a[_0x2841('0x57')]);return db[_0x2841('0x65')]['count']({'where':_0x323ded[_0x2841('0x4e')]})['then'](function(_0x15128f){_0x45c1c2['count']=_0x15128f;if(_0x56ad2a[_0x2841('0x44')][_0x2841('0x51')]){_0x323ded[_0x2841('0x52')]=[{'all':!![]}];}return db[_0x2841('0x65')][_0x2841('0x53')](_0x323ded);})['then'](function(_0xa060ed){_0x45c1c2['rows']=_0xa060ed;return _0x45c1c2;});}})['then'](respondWithFilteredResult(_0x5790fa,_0x323ded))[_0x2841('0x27')](handleError(_0x5790fa,null));};exports[_0x2841('0x68')]=function(_0x3b701a,_0x12bba4,_0x43d275){return db['FaxAccount'][_0x2841('0x58')]({'where':{'id':_0x3b701a['params']['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x12bba4,null))[_0x2841('0x33')](function(_0x2a2794){if(_0x2a2794){return _0x2a2794[_0x2841('0x68')](_0x3b701a[_0x2841('0x44')][_0x2841('0x69')]);}})[_0x2841('0x33')](respondWithStatusCode(_0x12bba4,null))[_0x2841('0x27')](handleError(_0x12bba4,null));};exports[_0x2841('0x6a')]=function(_0x29675f,_0x10ca28,_0x27697e){if(_0x29675f[_0x2841('0x61')]['id']){delete _0x29675f[_0x2841('0x61')]['id'];}return db[_0x2841('0x3d')][_0x2841('0x58')]({'where':{'id':_0x29675f[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x10ca28,null))[_0x2841('0x33')](function(_0x44bef0){if(_0x44bef0){_0x29675f[_0x2841('0x61')][_0x2841('0x64')]=_0x44bef0['id'];return db[_0x2841('0x6b')][_0x2841('0x59')](_0x29675f['body']);}})[_0x2841('0x33')](respondWithResult(_0x10ca28,null))[_0x2841('0x27')](handleError(_0x10ca28,null));};exports[_0x2841('0x6c')]=function(_0x4a3eaa,_0x33a90d,_0x352a14){var _0x6c6ac3={'raw':![],'where':{}};var _0x4a7ba={};var _0x454aa1={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x4a3eaa[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x33a90d,null))[_0x2841('0x33')](function(_0x2a7cb7){if(_0x2a7cb7){_0x4a7ba[_0x2841('0x42')]=_[_0x2841('0x43')](db[_0x2841('0x6b')][_0x2841('0x3e')]);_0x4a7ba['query']=_[_0x2841('0x43')](_0x4a3eaa[_0x2841('0x44')]);_0x4a7ba[_0x2841('0x45')]=_[_0x2841('0x46')](_0x4a7ba[_0x2841('0x42')],_0x4a7ba['query']);_0x6c6ac3['attributes']=_[_0x2841('0x46')](_0x4a7ba[_0x2841('0x42')],qs[_0x2841('0x48')](_0x4a3eaa[_0x2841('0x44')]['fields']));_0x6c6ac3['attributes']=_0x6c6ac3['attributes'][_0x2841('0x49')]?_0x6c6ac3[_0x2841('0x47')]:_0x4a7ba[_0x2841('0x42')];if(!_0x4a3eaa['query'][_0x2841('0x4a')](_0x2841('0x4b'))){_0x6c6ac3[_0x2841('0x2d')]=qs[_0x2841('0x2d')](_0x4a3eaa[_0x2841('0x44')]['limit']);_0x6c6ac3[_0x2841('0x2b')]=qs[_0x2841('0x2b')](_0x4a3eaa['query'][_0x2841('0x2b')]);}_0x6c6ac3[_0x2841('0x4c')]=qs['sort'](_0x4a3eaa['query'][_0x2841('0x4d')]);_0x6c6ac3[_0x2841('0x4e')]=qs[_0x2841('0x45')](_[_0x2841('0x67')](_0x4a3eaa[_0x2841('0x44')],_0x4a7ba[_0x2841('0x45')]));_0x6c6ac3[_0x2841('0x4e')][_0x2841('0x64')]=_0x2a7cb7['id'];if(_0x4a3eaa[_0x2841('0x44')][_0x2841('0x4f')]){_0x6c6ac3[_0x2841('0x4e')]=_[_0x2841('0x50')](_0x6c6ac3['where'],{'$or':_[_0x2841('0x3c')](_0x6c6ac3[_0x2841('0x47')],function(_0x3b9475){var _0x45a12f={};_0x45a12f[_0x3b9475]={'$like':'%'+_0x4a3eaa['query']['filter']+'%'};return _0x45a12f;})});}_0x6c6ac3=_['merge']({},_0x6c6ac3,_0x4a3eaa[_0x2841('0x57')]);return db['CannedAnswer']['count']({'where':_0x6c6ac3['where']})[_0x2841('0x33')](function(_0x3b9794){_0x454aa1[_0x2841('0x2e')]=_0x3b9794;if(_0x4a3eaa[_0x2841('0x44')][_0x2841('0x51')]){_0x6c6ac3[_0x2841('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x6c6ac3);})[_0x2841('0x33')](function(_0x103af9){_0x454aa1['rows']=_0x103af9;return _0x454aa1;});}})['then'](respondWithFilteredResult(_0x33a90d,_0x6c6ac3))[_0x2841('0x27')](handleError(_0x33a90d,null));};exports[_0x2841('0x6d')]=function(_0x238d10,_0x231db4,_0x228e25){return db[_0x2841('0x3d')][_0x2841('0x58')]({'where':{'id':_0x238d10[_0x2841('0x55')]['id']}})['then'](handleEntityNotFound(_0x231db4,null))[_0x2841('0x33')](function(_0x584f63){if(_0x584f63){return _0x584f63[_0x2841('0x6d')](_0x238d10[_0x2841('0x44')][_0x2841('0x69')]);}})['then'](respondWithStatusCode(_0x231db4,null))[_0x2841('0x27')](handleError(_0x231db4,null));};exports[_0x2841('0x6e')]=function(_0x20a1f0,_0x52ca66,_0x29d708){return db[_0x2841('0x6f')][_0x2841('0x58')]({'where':{'id':_0x20a1f0[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x52ca66,null))['then'](function(_0x1ba439){if(_0x1ba439){return _0x1ba439[_0x2841('0x6e')](_0x20a1f0[_0x2841('0x61')][_0x2841('0x69')],_['omit'](_0x20a1f0[_0x2841('0x61')],[_0x2841('0x69'),'id'])||{});}})[_0x2841('0x33')](respondWithResult(_0x52ca66,null))[_0x2841('0x27')](handleError(_0x52ca66,null));};exports[_0x2841('0x70')]=function(_0x507dc0,_0x2abcea,_0x4d0395){var _0x5738fc={'raw':![],'where':{}};var _0x26238d={};var _0x3405b9={'count':0x0,'rows':[]};return db[_0x2841('0x3d')][_0x2841('0x66')]({'where':{'id':_0x507dc0['params']['id']}})['then'](handleEntityNotFound(_0x2abcea,null))['then'](function(_0x2c8a5d){if(_0x2c8a5d){_0x26238d['model']=_['keys'](db['FaxInteraction'][_0x2841('0x3e')]);_0x26238d['query']=_[_0x2841('0x43')](_0x507dc0[_0x2841('0x44')]);_0x26238d[_0x2841('0x45')]=_[_0x2841('0x46')](_0x26238d['model'],_0x26238d[_0x2841('0x44')]);_0x5738fc[_0x2841('0x47')]=_[_0x2841('0x46')](_0x26238d[_0x2841('0x42')],qs[_0x2841('0x48')](_0x507dc0[_0x2841('0x44')][_0x2841('0x48')]));_0x5738fc['attributes']=_0x5738fc['attributes'][_0x2841('0x49')]?_0x5738fc['attributes']:_0x26238d[_0x2841('0x42')];if(!_0x507dc0['query']['hasOwnProperty']('nolimit')){_0x5738fc[_0x2841('0x2d')]=qs[_0x2841('0x2d')](_0x507dc0[_0x2841('0x44')]['limit']);_0x5738fc[_0x2841('0x2b')]=qs[_0x2841('0x2b')](_0x507dc0[_0x2841('0x44')]['offset']);}_0x5738fc[_0x2841('0x4c')]=qs[_0x2841('0x4d')](_0x507dc0[_0x2841('0x44')]['sort']);_0x5738fc['where']=qs[_0x2841('0x45')](_[_0x2841('0x67')](_0x507dc0[_0x2841('0x44')],_0x26238d[_0x2841('0x45')]));_0x5738fc['where']['FaxAccountId']=_0x2c8a5d['id'];if(_0x507dc0['query']['filter']){_0x5738fc[_0x2841('0x4e')]=_['merge'](_0x5738fc['where'],{'$or':_[_0x2841('0x3c')](_0x5738fc[_0x2841('0x47')],function(_0x4f3e09){var _0x3af2be={};_0x3af2be[_0x4f3e09]={'$like':'%'+_0x507dc0['query'][_0x2841('0x4f')]+'%'};return _0x3af2be;})});}_0x5738fc=_[_0x2841('0x50')]({},_0x5738fc,_0x507dc0[_0x2841('0x57')]);return db[_0x2841('0x6f')][_0x2841('0x2e')]({'where':_0x5738fc[_0x2841('0x4e')]})[_0x2841('0x33')](function(_0x3c8054){_0x3405b9[_0x2841('0x2e')]=_0x3c8054;if(_0x507dc0[_0x2841('0x44')][_0x2841('0x51')]){_0x5738fc['include']=[{'model':db[_0x2841('0x71')],'as':_0x2841('0x72'),'required':![]},{'model':db[_0x2841('0x73')],'as':_0x2841('0x74'),'attributes':[_0x2841('0x39'),'fullname',_0x2841('0x75')],'required':![]},{'model':db[_0x2841('0x76')],'as':'Tags','attributes':['id','name',_0x2841('0x77')],'where':_0x507dc0[_0x2841('0x44')][_0x2841('0x78')]?{'id':_0x507dc0[_0x2841('0x44')][_0x2841('0x78')]}:undefined,'required':_0x507dc0[_0x2841('0x44')][_0x2841('0x78')]?!![]:![]}];}return db['FaxInteraction']['findAll'](_0x5738fc);})[_0x2841('0x33')](function(_0x224c3e){_0x3405b9['rows']=_0x224c3e;return _0x3405b9;});}})[_0x2841('0x33')](respondWithFilteredResult(_0x2abcea,_0x5738fc))[_0x2841('0x27')](handleError(_0x2abcea,null));};exports[_0x2841('0x79')]=function(_0x2a0983,_0x4c274d){var _0x2c7387=_0x2a0983['params']['id'];var _0x1ca71b=_0x2a0983['body'];var _0x4099eb=0xc8;var _0x40af78=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2841('0x7a')][_0x2841('0x7b')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x35a8c1){return db[_0x2841('0x3d')]['findOne']({'where':{'id':_0x2c7387},'transaction':_0x35a8c1})[_0x2841('0x33')](function(_0x32a4a9){if(_0x32a4a9){return db[_0x2841('0x7c')]['destroy']({'where':{'FaxAccountId':_0x2c7387},'transaction':_0x35a8c1})[_0x2841('0x33')](function(){var _0x1f181f=_[_0x2841('0x3c')](_0x1ca71b,function(_0x272672){_0x272672[_0x2841('0x64')]=_0x2c7387;return _0x272672;});return db[_0x2841('0x7c')][_0x2841('0x7d')](_0x1f181f,{'transaction':_0x35a8c1});});}else{_0x4099eb=0x194;_0x40af78=[];}});})[_0x2841('0x33')](function(){if(_0x4099eb!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x2c7387},'order':_0x2841('0x7e')})[_0x2841('0x33')](function(_0x44a98d){_0x40af78=_0x44a98d;});}})['catch'](function(_0x23abb1){_0x4099eb=0x1f4;logger[_0x2841('0x23')](_0x23abb1[_0x2841('0x38')]);if(_0x23abb1[_0x2841('0x39')]){delete _0x23abb1['name'];}_0x40af78=_0x23abb1;})[_0x2841('0x7f')](function(){if(_0x40af78===null){_0x4c274d[_0x2841('0x28')](_0x4099eb);}else{if(_0x4099eb===0x1f4){_0x4c274d['status'](_0x4099eb)[_0x2841('0x80')](_0x40af78);}else{_0x4c274d[_0x2841('0x29')](_0x4099eb)[_0x2841('0x2a')](_0x40af78);}}});};exports[_0x2841('0x81')]=function(_0x1d8784,_0x317d03,_0x457ba3){var _0xa3720e={};var _0x17edcb={};var _0xca24e6;var _0x575f35;return db[_0x2841('0x3d')]['findOne']({'where':{'id':_0x1d8784['params']['id']}})['then'](handleEntityNotFound(_0x317d03,null))['then'](function(_0x1205c0){if(_0x1205c0){_0xca24e6=_0x1205c0;_0x17edcb[_0x2841('0x42')]=_[_0x2841('0x43')](db['FaxApplication'][_0x2841('0x3e')]);_0x17edcb[_0x2841('0x44')]=_[_0x2841('0x43')](_0x1d8784['query']);_0x17edcb[_0x2841('0x45')]=_[_0x2841('0x46')](_0x17edcb[_0x2841('0x42')],_0x17edcb['query']);_0xa3720e[_0x2841('0x47')]=_[_0x2841('0x46')](_0x17edcb[_0x2841('0x42')],qs[_0x2841('0x48')](_0x1d8784[_0x2841('0x44')][_0x2841('0x48')]));_0xa3720e[_0x2841('0x47')]=_0xa3720e[_0x2841('0x47')][_0x2841('0x49')]?_0xa3720e[_0x2841('0x47')]:_0x17edcb[_0x2841('0x42')];_0xa3720e[_0x2841('0x4c')]=qs['sort'](_0x1d8784[_0x2841('0x44')]['sort']);_0xa3720e[_0x2841('0x4e')]=qs[_0x2841('0x45')](_['pick'](_0x1d8784[_0x2841('0x44')],_0x17edcb[_0x2841('0x45')]));if(_0x1d8784[_0x2841('0x44')][_0x2841('0x4f')]){_0xa3720e[_0x2841('0x4e')]=_[_0x2841('0x50')](_0xa3720e['where'],{'$or':_[_0x2841('0x3c')](_0xa3720e[_0x2841('0x47')],function(_0x4a855b){var _0x3954d4={};_0x3954d4[_0x4a855b]={'$like':'%'+_0x1d8784[_0x2841('0x44')][_0x2841('0x4f')]+'%'};return _0x3954d4;})});}_0xa3720e=_[_0x2841('0x50')]({},_0xa3720e,_0x1d8784['options']);return _0xca24e6[_0x2841('0x81')](_0xa3720e);}})[_0x2841('0x33')](function(_0x3f6119){if(_0x3f6119){_0x575f35=_0x3f6119[_0x2841('0x49')];if(!_0x1d8784['query'][_0x2841('0x4a')](_0x2841('0x4b'))){_0xa3720e[_0x2841('0x2d')]=qs[_0x2841('0x2d')](_0x1d8784['query'][_0x2841('0x2d')]);_0xa3720e['offset']=qs['offset'](_0x1d8784[_0x2841('0x44')]['offset']);}return _0xca24e6[_0x2841('0x81')](_0xa3720e);}})[_0x2841('0x33')](function(_0x19037d){if(_0x19037d){return _0x19037d?{'count':_0x575f35,'rows':_0x19037d}:null;}})['then'](respondWithResult(_0x317d03,null))[_0x2841('0x27')](handleError(_0x317d03,null));};function Extension(_0xe32f5b,_0x5201b6,_0x2a4e10,_0x155dbb){this[_0x2841('0x82')]=_0x2841('0x83');this[_0x2841('0x84')]=_0xe32f5b[_0x2841('0x85')];this[_0x2841('0x86')]=_0x155dbb;this[_0x2841('0x40')]=_0x2841('0x87');this['description']=_0x2841('0x88');this[_0x2841('0x64')]=_0xe32f5b['id'];this['priority']=_0x5201b6;this[_0x2841('0x89')]=_0x2a4e10;}function createExtensionsReciveFax(_0x4872a4){var _0x431e70=0x1;var _0x3f29e3=[];_0x3f29e3[_0x2841('0x8a')](new Extension(_0x4872a4,_0x431e70,'',_0x2841('0x8b')));_0x431e70+=0x1;_0x3f29e3['push'](new Extension(_0x4872a4,_0x431e70,_0x2841('0x8c'),_0x2841('0x8d')));_0x431e70+=0x1;for(var _0x1fb9d3 in _0x4872a4){if(_0x4872a4['hasOwnProperty'](_0x1fb9d3)&&(_0x1fb9d3==='ecm'||_0x1fb9d3===_0x2841('0x85')||_0x1fb9d3===_0x2841('0x8e')||_0x1fb9d3===_0x2841('0x8f')||_0x1fb9d3===_0x2841('0x90')||_0x1fb9d3===_0x2841('0x91')||_0x1fb9d3===_0x2841('0x92')||_0x1fb9d3===_0x2841('0x93')||_0x1fb9d3==='t38timeout')){_0x3f29e3[_0x2841('0x8a')](new Extension(_0x4872a4,_0x431e70,'FAXOPT('+_0x1fb9d3+')='+_0x4872a4[_0x1fb9d3],_0x2841('0x8d')));_0x431e70+=0x1;}}_0x3f29e3[_0x2841('0x8a')](new Extension(_0x4872a4,_0x431e70,'6',_0x2841('0x94')));_0x431e70+=0x1;_0x3f29e3[_0x2841('0x8a')](new Extension(_0x4872a4,_0x431e70,_0x2841('0x95'),_0x2841('0x96')));_0x431e70=0x0;return _0x3f29e3;}exports[_0x2841('0x97')]=function(_0x583788,_0xacdbe6,_0x433031){var _0x4379dc;return db[_0x2841('0x7a')][_0x2841('0x98')](function(_0x3ffa48){return db['FaxAccount'][_0x2841('0x59')](_0x583788[_0x2841('0x61')],{'transaction':_0x3ffa48})[_0x2841('0x33')](function(_0x48bdc0){_0x4379dc=_0x48bdc0[_0x2841('0x34')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x4379dc),{'transaction':_0x3ffa48});});})[_0x2841('0x33')](function(){return _0x4379dc;})[_0x2841('0x33')](respondWithResult(_0xacdbe6,null))[_0x2841('0x27')](handleError(_0xacdbe6,null));};exports['updateAccountApplications']=function(_0x243760,_0x534685,_0x23811a){var _0x58b4d3;return db[_0x2841('0x7a')][_0x2841('0x98')](function(_0x15a8a3){return db[_0x2841('0x3d')][_0x2841('0x60')](_0x243760[_0x2841('0x61')],{'where':{'id':_0x243760[_0x2841('0x61')]['id']},'transaction':_0x15a8a3})[_0x2841('0x33')](function(_0xc649f9){return db['VoiceExtension'][_0x2841('0x32')]({'where':{'FaxAccountId':_0x243760[_0x2841('0x61')]['id']},'transaction':_0x15a8a3})[_0x2841('0x33')](function(_0x4eea74){return db[_0x2841('0x99')][_0x2841('0x7d')](createExtensionsReciveFax(_[_0x2841('0x9a')](_0x243760[_0x2841('0x61')],['tech',_0x2841('0x41'),_0x2841('0x9b'),_0x2841('0x9c'),'TrunkId',_0x2841('0x9d')])),{'transaction':_0x15a8a3});});});})['then'](function(){return db[_0x2841('0x3d')][_0x2841('0x9e')](_0x243760['body']['id']);})[_0x2841('0x33')](respondWithResult(_0x534685,null))[_0x2841('0x27')](handleError(_0x534685,null));};exports[_0x2841('0x9f')]=function(_0x4d07b3,_0x608a44,_0x429eb1){var _0xafe24c={'raw':!![],'where':{}};var _0x1ca58e={};var _0x584497={'count':0x0,'rows':[]};return db['FaxAccount'][_0x2841('0x66')]({'where':{'id':_0x4d07b3[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x608a44,null))[_0x2841('0x33')](function(_0x54a3e8){if(_0x54a3e8){_0x1ca58e[_0x2841('0x42')]=_['keys'](db[_0x2841('0xa0')][_0x2841('0x3e')]);_0x1ca58e[_0x2841('0x44')]=_[_0x2841('0x43')](_0x4d07b3[_0x2841('0x44')]);_0x1ca58e['filters']=_['intersection'](_0x1ca58e[_0x2841('0x42')],_0x1ca58e[_0x2841('0x44')]);_0xafe24c[_0x2841('0x47')]=_[_0x2841('0x46')](_0x1ca58e['model'],qs['fields'](_0x4d07b3[_0x2841('0x44')]['fields']));_0xafe24c['attributes']=_0xafe24c[_0x2841('0x47')]['length']?_0xafe24c[_0x2841('0x47')]:_0x1ca58e[_0x2841('0x42')];if(!_0x4d07b3[_0x2841('0x44')]['hasOwnProperty']('nolimit')){_0xafe24c['limit']=qs[_0x2841('0x2d')](_0x4d07b3[_0x2841('0x44')][_0x2841('0x2d')]);_0xafe24c['offset']=qs[_0x2841('0x2b')](_0x4d07b3['query'][_0x2841('0x2b')]);}_0xafe24c[_0x2841('0x4c')]=qs[_0x2841('0x4d')](_0x4d07b3[_0x2841('0x44')]['sort']);_0xafe24c[_0x2841('0x4e')]=qs[_0x2841('0x45')](_[_0x2841('0x67')](_0x4d07b3[_0x2841('0x44')],_0x1ca58e[_0x2841('0x45')]));_0xafe24c[_0x2841('0x4e')][_0x2841('0x64')]=_0x54a3e8['id'];if(_0x4d07b3[_0x2841('0x44')]['filter']){_0xafe24c[_0x2841('0x4e')]=_[_0x2841('0x50')](_0xafe24c[_0x2841('0x4e')],{'$or':_['map'](_0xafe24c[_0x2841('0x47')],function(_0x3f7934){var _0x49a713={};_0x49a713[_0x3f7934]={'$like':'%'+_0x4d07b3[_0x2841('0x44')]['filter']+'%'};return _0x49a713;})});}if(_0x4d07b3[_0x2841('0x44')][_0x2841('0xa1')]){var _0x2fa3aa=_0x4d07b3['query']['$gte'][_0x2841('0xa2')](',');var _0x36e5eb={};_0x36e5eb[_0x2fa3aa[0x0]]={'$gte':moment(_0x2fa3aa[0x1])[_0x2841('0xa3')](_0x2841('0xa4'))};_0xafe24c[_0x2841('0x4e')]=_[_0x2841('0x50')](_0xafe24c[_0x2841('0x4e')],_0x36e5eb);}_0xafe24c=_[_0x2841('0x50')]({},_0xafe24c,_0x4d07b3[_0x2841('0x57')]);return db['FaxMessage'][_0x2841('0x2e')]({'where':_0xafe24c['where']})[_0x2841('0x33')](function(_0x3105d3){_0x584497['count']=_0x3105d3;if(_0x4d07b3[_0x2841('0x44')][_0x2841('0x51')]){_0xafe24c['include']=[{'all':!![]}];}return db[_0x2841('0xa0')][_0x2841('0x53')](_0xafe24c);})['then'](function(_0x4e216d){_0x584497['rows']=_0x4e216d;return _0x584497;});}})[_0x2841('0x33')](respondWithFilteredResult(_0x608a44,_0xafe24c))['catch'](handleError(_0x608a44,null));};exports[_0x2841('0x80')]=function(_0x1e16f0,_0x3c6528,_0x3ae71c){var _0x34d522,_0x331c48={},_0x301697;if(_0x1e16f0[_0x2841('0x61')]['to']){_0x301697=_0x1e16f0[_0x2841('0x61')]['to'][0x0];}return db['FaxAccount'][_0x2841('0x58')]({'where':{'id':_0x1e16f0[_0x2841('0x55')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x2841('0x71')],'as':_0x2841('0xa5'),'where':{'fax':_0x301697},'limit':0x1,'order':[[_0x2841('0x9c'),_0x2841('0xa6')]]}]}]})[_0x2841('0x33')](handleEntityNotFound(_0x3c6528,null))[_0x2841('0x33')](function(_0x70637e){_0x34d522=_0x70637e;if(_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')]&&_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][_0x2841('0x49')]){for(var _0x4ef70f=0x0;_0x4ef70f<_0x1e16f0['body'][_0x2841('0xa7')]['length'];_0x4ef70f+=0x1){_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][_0x4ef70f]={'filename':_0x1e16f0[_0x2841('0x61')]['attachments'][_0x4ef70f][_0x2841('0x39')],'id':_0x1e16f0[_0x2841('0x61')]['attachments'][_0x4ef70f]['id'],'path':path[_0x2841('0xa8')](config['root'],_0x2841('0xa9'),_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][_0x4ef70f][_0x2841('0xaa')])};}}return respondWithRpcPromise('CheckAfterSend','CheckAfterSend',{'FaxAccountId':_[_0x2841('0xab')](_0x1e16f0['params']['id'])?undefined:_0x1e16f0[_0x2841('0x55')]['id'],'path':_[_0x2841('0xab')](_0x1e16f0['body'][_0x2841('0xa7')][0x0][_0x2841('0x5')])?undefined:_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0][_0x2841('0x5')],'fax':_[_0x2841('0xab')](_0x1e16f0[_0x2841('0x61')]['to'][0x0])?undefined:_0x1e16f0['body']['to'][0x0]},client9002);})[_0x2841('0x33')](function(){if(_0x34d522){if(_[_0x2841('0xab')](_0x1e16f0[_0x2841('0x61')]['from'])){_0x1e16f0[_0x2841('0x61')][_0x2841('0xac')]=util['format'](_0x2841('0xad'),_0x34d522['name'],_0x34d522[_0x2841('0xae')]);}if(_0x34d522['List']){if(_0x34d522[_0x2841('0xaf')][_0x2841('0xa5')][_0x2841('0x49')]){return _0x34d522['List'][_0x2841('0xa5')][0x0];}else{return db[_0x2841('0x71')][_0x2841('0x59')](_['defaults'](_0x1e16f0[_0x2841('0x61')],{'firstName':_0x1e16f0['body']['to'][0x0],'phone':_0x1e16f0[_0x2841('0x61')]['to'][0x0],'fax':_0x1e16f0[_0x2841('0x61')]['to'][0x0],'ListId':_0x34d522[_0x2841('0x9d')]}));}}else{throw new Error(_0x2841('0xb0'));}}else{throw new Error(_0x2841('0xb1'));}})[_0x2841('0x33')](function(_0x41850b){if(_0x41850b){return db[_0x2841('0x6f')][_0x2841('0x58')]({'where':{'ContactId':_0x41850b['id'],'closed':![],'FaxAccountId':_0x34d522['id']}})['then'](function(_0x5ca379){if(_0x5ca379){return[_0x5ca379,![]];}return db['FaxInteraction']['create']({'UserId':_0x1e16f0['user']['id'],'ContactId':_0x41850b['id'],'FaxAccountId':_0x34d522['id'],'fax':_0x1e16f0[_0x2841('0x61')]['to'][0x0],'firstMsgDirection':_0x2841('0xb2'),'Messages':[_[_0x2841('0x50')](_0x1e16f0[_0x2841('0x61')],{'read':![],'body':_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0][_0x2841('0xb3')],'FaxAccountId':_0x34d522['id'],'UserId':_0x1e16f0[_0x2841('0x5a')]['id'],'ContactId':_0x41850b['id'],'AttachmentId':_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0]['id']})]},{'include':[{'model':db[_0x2841('0xa0')],'as':_0x2841('0xb4')}]})[_0x2841('0x33')](function(_0x19268f){return[_0x19268f,!![]];});});}else{throw new Error(_0x2841('0xb5'));}})[_0x2841('0xb6')](function(_0xa188,_0x38ed80){if(_0x38ed80){return _0xa188;}return db[_0x2841('0xa0')][_0x2841('0x59')]({'direction':'out','read':![],'body':_0x1e16f0['body'][_0x2841('0xa7')][0x0][_0x2841('0xb3')],'FaxAccountId':_0x34d522['id'],'FaxInteractionId':_0xa188['id'],'UserId':_0x1e16f0[_0x2841('0x5a')]['id'],'ContactId':_0xa188['ContactId'],'AttachmentId':_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0]['id']})['then'](function(_0x19dfb1){_0xa188['dataValues'][_0x2841('0xb4')]=[];_0xa188[_0x2841('0xb7')][_0x2841('0xb4')]['push'](_0x19dfb1[_0x2841('0xb7')]);return _0xa188;});})[_0x2841('0x33')](function(_0x2a7f89){respondWithRpcPromise(_0x2841('0xb8'),_0x2841('0xb8'),{'FaxAccountId':_['isNil'](_0x1e16f0['params']['id'])?undefined:_0x1e16f0['params']['id'],'path':_['isNil'](_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0][_0x2841('0x5')])?undefined:_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0][_0x2841('0x5')],'fax':_['isNil'](_0x1e16f0[_0x2841('0x61')]['to'][0x0])?undefined:_0x1e16f0[_0x2841('0x61')]['to'][0x0],'AttachmentId':_0x1e16f0[_0x2841('0x61')][_0x2841('0xa7')][0x0]['id']},client9002)[_0x2841('0x33')](function(_0x3428ac){logger[_0x2841('0x1e')](_0x2841('0xb9'),_0x3428ac);})['catch'](function(_0x3b7233){logger[_0x2841('0x1e')](_0x2841('0xb9'),_0x3b7233);});return _0x2a7f89;})[_0x2841('0x33')](respondWithResult(_0x3c6528,null))[_0x2841('0x27')](handleError(_0x3c6528,null));};exports[_0x2841('0xba')]=function(_0x2e973c,_0x24759e,_0x5646a4){return db[_0x2841('0x3d')]['find']({'where':{'id':_0x2e973c[_0x2841('0x55')]['id']}})['then'](handleEntityNotFound(_0x24759e,null))[_0x2841('0x33')](function(_0x24b44f){if(_0x24b44f){return _0x24b44f[_0x2841('0xba')](_0x2e973c['body']['ids'],_['omit'](_0x2e973c['body'],['ids','id'])||{})[_0x2841('0xb6')](function(_0x594b03){for(var _0x7e78d8=0x0;_0x7e78d8<_0x2e973c['body'][_0x2841('0x69')][_0x2841('0x49')];_0x7e78d8+=0x1){socket[_0x2841('0xbb')]('userFaxAccount:save',{'UserId':Number(_0x2e973c[_0x2841('0x61')][_0x2841('0x69')][_0x7e78d8]),'FaxAccountId':Number(_0x2e973c[_0x2841('0x55')]['id'])});}return _0x594b03;});}})['then'](respondWithResult(_0x24759e,null))[_0x2841('0x27')](handleError(_0x24759e,null));};exports[_0x2841('0xbc')]=function(_0x1f8307,_0x47a202,_0x5a5cab){return db[_0x2841('0x3d')][_0x2841('0x58')]({'where':{'id':_0x1f8307[_0x2841('0x55')]['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x47a202,null))[_0x2841('0x33')](function(_0x1f819b){if(_0x1f819b){return _0x1f819b[_0x2841('0xbc')](_0x1f8307[_0x2841('0x44')][_0x2841('0x69')])[_0x2841('0x33')](function(){if(_[_0x2841('0xbd')](_0x1f8307[_0x2841('0x44')][_0x2841('0x69')])){for(var _0x2f4da9=0x0;_0x2f4da9<_0x1f8307[_0x2841('0x44')][_0x2841('0x69')][_0x2841('0x49')];_0x2f4da9+=0x1){socket[_0x2841('0xbb')](_0x2841('0xbe'),{'UserId':Number(_0x1f8307[_0x2841('0x44')][_0x2841('0x69')][_0x2f4da9]),'FaxAccountId':Number(_0x1f8307[_0x2841('0x55')]['id'])});}}else{socket[_0x2841('0xbb')](_0x2841('0xbe'),{'UserId':Number(_0x1f8307[_0x2841('0x44')]['ids']),'FaxAccountId':Number(_0x1f8307['params']['id'])});}});}})[_0x2841('0x33')](respondWithStatusCode(_0x47a202,null))['catch'](handleError(_0x47a202,null));};exports[_0x2841('0xbf')]=function(_0x2df45d,_0x1019ba,_0x1005c2){var _0x1e11a7={};var _0x58d270={};var _0x32e8cf;var _0x4a1f0a;return db['FaxAccount'][_0x2841('0x66')]({'where':{'id':_0x2df45d['params']['id']}})[_0x2841('0x33')](handleEntityNotFound(_0x1019ba,null))['then'](function(_0xfdeb4b){if(_0xfdeb4b){_0x32e8cf=_0xfdeb4b;_0x58d270[_0x2841('0x42')]=_[_0x2841('0x43')](db[_0x2841('0x73')]['rawAttributes']);_0x58d270[_0x2841('0x44')]=_[_0x2841('0x43')](_0x2df45d[_0x2841('0x44')]);_0x58d270[_0x2841('0x45')]=_[_0x2841('0x46')](_0x58d270['model'],_0x58d270['query']);_0x1e11a7['attributes']=_[_0x2841('0x46')](_0x58d270['model'],qs[_0x2841('0x48')](_0x2df45d[_0x2841('0x44')][_0x2841('0x48')]));_0x1e11a7[_0x2841('0x47')]=_0x1e11a7['attributes']['length']?_0x1e11a7[_0x2841('0x47')]:_0x58d270['model'];_0x1e11a7[_0x2841('0x4c')]=qs[_0x2841('0x4d')](_0x2df45d['query'][_0x2841('0x4d')]);_0x1e11a7[_0x2841('0x4e')]=qs[_0x2841('0x45')](_[_0x2841('0x67')](_0x2df45d['query'],_0x58d270[_0x2841('0x45')]));if(_0x2df45d[_0x2841('0x44')][_0x2841('0x4f')]){_0x1e11a7['where']=_[_0x2841('0x50')](_0x1e11a7[_0x2841('0x4e')],{'$or':_[_0x2841('0x3c')](_0x1e11a7[_0x2841('0x47')],function(_0x2e0b02){var _0xba818f={};_0xba818f[_0x2e0b02]={'$like':'%'+_0x2df45d[_0x2841('0x44')]['filter']+'%'};return _0xba818f;})});}_0x1e11a7=_[_0x2841('0x50')]({},_0x1e11a7,_0x2df45d[_0x2841('0x57')]);return _0x32e8cf[_0x2841('0xbf')](_0x1e11a7);}})[_0x2841('0x33')](function(_0x32a2b9){if(_0x32a2b9){_0x4a1f0a=_0x32a2b9['length'];if(!_0x2df45d[_0x2841('0x44')][_0x2841('0x4a')]('nolimit')){_0x1e11a7[_0x2841('0x2d')]=qs[_0x2841('0x2d')](_0x2df45d[_0x2841('0x44')][_0x2841('0x2d')]);_0x1e11a7[_0x2841('0x2b')]=qs[_0x2841('0x2b')](_0x2df45d['query'][_0x2841('0x2b')]);}return _0x32e8cf[_0x2841('0xbf')](_0x1e11a7);}})[_0x2841('0x33')](function(_0x32806b){if(_0x32806b){return _0x32806b?{'count':_0x4a1f0a,'rows':_0x32806b}:null;}})[_0x2841('0x33')](respondWithResult(_0x1019ba,null))[_0x2841('0x27')](handleError(_0x1019ba,null));}; \ No newline at end of file +var _0x39d2=['merge','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','order','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','rows','FaxInteraction','omit','getInteractions','Contact','Owner','internal','Tag','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','FaxApplication','priority','stack','finally','send','getApplications','context','exten','localstationid','app','type','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','createdAt','updatedAt','ListId','findById','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','dataValues','SendFax','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','update','get','FaxAccounts','UserProfileResource','destroy','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39d2,0x12e));var _0x239d=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x39d2[_0x2d9c6a];return _0xf3c918;};'use strict';var emlformat=require(_0x239d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x239d('0x1'));var jsonpatch=require(_0x239d('0x2'));var rp=require(_0x239d('0x3'));var moment=require(_0x239d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x239d('0x5'));var util=require(_0x239d('0x6'));var path=require(_0x239d('0x7'));var sox=require(_0x239d('0x8'));var csv=require(_0x239d('0x9'));var ejs=require(_0x239d('0xa'));var fs=require('fs');var fs_extra=require(_0x239d('0xb'));var _=require(_0x239d('0xc'));var squel=require(_0x239d('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x239d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x239d('0xf'));var Papa=require(_0x239d('0x10'));var Redis=require('ioredis');var authService=require(_0x239d('0x11'));var qs=require(_0x239d('0x12'));var as=require(_0x239d('0x13'));var hardwareService=require(_0x239d('0x14'));var logger=require(_0x239d('0x15'))(_0x239d('0x16'));var utils=require(_0x239d('0x17'));var config=require(_0x239d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x239d('0x19'))['db'];config[_0x239d('0x1a')]=_['defaults'](config[_0x239d('0x1a')],{'host':_0x239d('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x239d('0x1a')]));require(_0x239d('0x1c'))[_0x239d('0x1d')](socket);var jayson=require(_0x239d('0x1e'));var client=jayson[_0x239d('0x1f')][_0x239d('0x20')]({'port':0x232c});var client9002=jayson[_0x239d('0x1f')][_0x239d('0x20')]({'port':0x232a});function respondWithRpcPromise(_0xdb30a9,_0x357125,_0x16de84,_0x15de4e){return new BPromise(function(_0x20cb51,_0x1074b8){var _0x1e15bb=_0x15de4e||client;return _0x1e15bb[_0x239d('0x21')](_0xdb30a9,_0x16de84)[_0x239d('0x22')](function(_0x32ff87){logger[_0x239d('0x23')](_0x239d('0x24'),_0x357125,'request\x20sent');logger[_0x239d('0x25')](_0x239d('0x26'),_0x357125,_0x239d('0x27'),JSON['stringify'](_0x32ff87));if(_0x32ff87[_0x239d('0x28')]){if(_0x32ff87[_0x239d('0x28')][_0x239d('0x29')]===0x1f4){logger[_0x239d('0x28')](_0x239d('0x24'),_0x357125,_0x32ff87[_0x239d('0x28')]['message']);return _0x1074b8(_0x32ff87['error'][_0x239d('0x2a')]);}logger[_0x239d('0x28')](_0x239d('0x24'),_0x357125,_0x32ff87[_0x239d('0x28')]['message']);return _0x20cb51(_0x32ff87[_0x239d('0x28')][_0x239d('0x2a')]);}else{logger[_0x239d('0x23')](_0x239d('0x24'),_0x357125,'request\x20sent');_0x20cb51(_0x32ff87[_0x239d('0x2b')]['message']);}})['catch'](function(_0x560938){logger[_0x239d('0x28')](_0x239d('0x24'),_0x357125,_0x560938);_0x1074b8(_0x560938);});});}function respondWithStatusCode(_0x33a139,_0x3038f1){_0x3038f1=_0x3038f1||0xcc;return function(_0x3305b6){if(_0x3305b6){return _0x33a139[_0x239d('0x2c')](_0x3038f1);}return _0x33a139[_0x239d('0x2d')](_0x3038f1)[_0x239d('0x2e')]();};}function respondWithResult(_0x3a9a75,_0x53f756){_0x53f756=_0x53f756||0xc8;return function(_0x40219f){if(_0x40219f){return _0x3a9a75[_0x239d('0x2d')](_0x53f756)[_0x239d('0x2f')](_0x40219f);}};}function respondWithFilteredResult(_0x244d75,_0x20b078){return function(_0x2e4137){if(_0x2e4137){var _0x30d3b7=typeof _0x20b078['offset']===_0x239d('0x30')&&typeof _0x20b078[_0x239d('0x31')]===_0x239d('0x30');var _0xc4b9e2=_0x2e4137['count'];var _0x491e3b=_0x30d3b7?0x0:_0x20b078['offset'];var _0x5ee9fe=_0x30d3b7?_0x2e4137[_0x239d('0x32')]:_0x20b078[_0x239d('0x33')]+_0x20b078[_0x239d('0x31')];var _0x4a6850;if(_0x5ee9fe>=_0xc4b9e2){_0x5ee9fe=_0xc4b9e2;_0x4a6850=0xc8;}else{_0x4a6850=0xce;}_0x244d75['status'](_0x4a6850);return _0x244d75[_0x239d('0x34')](_0x239d('0x35'),_0x491e3b+'-'+_0x5ee9fe+'/'+_0xc4b9e2)[_0x239d('0x2f')](_0x2e4137);}return null;};}function patchUpdates(_0x52f022){return function(_0x1a6d53){try{jsonpatch[_0x239d('0x36')](_0x1a6d53,_0x52f022,!![]);}catch(_0x5906df){return BPromise['reject'](_0x5906df);}return _0x1a6d53['save']();};}function saveUpdates(_0x46e3c0,_0x33c279){return function(_0x4a058c){if(_0x4a058c){return _0x4a058c[_0x239d('0x37')](_0x46e3c0)[_0x239d('0x22')](function(_0x3ce895){return _0x3ce895;});}return null;};}function removeEntity(_0x201f07,_0x3ac20d){return function(_0xde5850){if(_0xde5850){return _0xde5850['destroy']()['then'](function(){var _0x5678b0=_0xde5850[_0x239d('0x38')]({'plain':!![]});var _0x5b0e0a=_0x239d('0x39');return db[_0x239d('0x3a')][_0x239d('0x3b')]({'where':{'type':_0x5b0e0a,'resourceId':_0x5678b0['id']}})['then'](function(){return _0xde5850;});})[_0x239d('0x22')](function(){_0x201f07[_0x239d('0x2d')](0xcc)[_0x239d('0x2e')]();});}};}function handleEntityNotFound(_0x468d75,_0x384bcb){return function(_0x4339c7){if(!_0x4339c7){_0x468d75[_0x239d('0x2c')](0x194);}return _0x4339c7;};}function handleError(_0x2c6641,_0x2ffdb9){_0x2ffdb9=_0x2ffdb9||0x1f4;return function(_0x1d616e){logger[_0x239d('0x28')](_0x1d616e['stack']);if(_0x1d616e[_0x239d('0x3c')]){delete _0x1d616e[_0x239d('0x3c')];}_0x2c6641[_0x239d('0x2d')](_0x2ffdb9)['send'](_0x1d616e);};}exports[_0x239d('0x3d')]=function(_0x135873,_0x4f53f0){var _0x2a3227={'include':[{'model':db[_0x239d('0x3e')],'as':_0x239d('0x3f')}]},_0x28bc32={},_0x4e4e8d={'count':0x0,'rows':[]};var _0x20be57=_[_0x239d('0x40')](db[_0x239d('0x41')][_0x239d('0x42')],function(_0x5506de){return{'name':_0x5506de[_0x239d('0x43')],'type':_0x5506de['type'][_0x239d('0x44')]};});_0x28bc32[_0x239d('0x45')]=_['map'](_0x20be57,_0x239d('0x3c'));_0x28bc32[_0x239d('0x46')]=_[_0x239d('0x47')](_0x135873[_0x239d('0x46')]);_0x28bc32[_0x239d('0x48')]=_[_0x239d('0x49')](_0x28bc32[_0x239d('0x45')],_0x28bc32['query']);_0x2a3227['attributes']=_[_0x239d('0x49')](_0x28bc32[_0x239d('0x45')],qs['fields'](_0x135873[_0x239d('0x46')][_0x239d('0x4a')]));_0x2a3227[_0x239d('0x4b')]=_0x2a3227[_0x239d('0x4b')][_0x239d('0x4c')]?_0x2a3227[_0x239d('0x4b')]:_0x28bc32[_0x239d('0x45')];if(!_0x135873[_0x239d('0x46')][_0x239d('0x4d')](_0x239d('0x4e'))){_0x2a3227[_0x239d('0x31')]=qs['limit'](_0x135873[_0x239d('0x46')][_0x239d('0x31')]);_0x2a3227['offset']=qs[_0x239d('0x33')](_0x135873[_0x239d('0x46')][_0x239d('0x33')]);}_0x2a3227['order']=qs[_0x239d('0x4f')](_0x135873['query'][_0x239d('0x4f')]);_0x2a3227[_0x239d('0x50')]=qs[_0x239d('0x48')](_[_0x239d('0x51')](_0x135873[_0x239d('0x46')],_0x28bc32[_0x239d('0x48')]),_0x20be57);if(_0x135873[_0x239d('0x46')]['filter']){_0x2a3227[_0x239d('0x50')]=_[_0x239d('0x52')](_0x2a3227['where'],{'$or':_['map'](_0x20be57,function(_0x20db25){if(_0x20db25['type']!=='VIRTUAL'){var _0x3fdf0e={};_0x3fdf0e[_0x20db25[_0x239d('0x3c')]]={'$like':'%'+_0x135873[_0x239d('0x46')][_0x239d('0x53')]+'%'};return _0x3fdf0e;}})});}_0x2a3227=_[_0x239d('0x52')]({},_0x2a3227,_0x135873[_0x239d('0x54')]);var _0x17a83f={'where':_0x2a3227[_0x239d('0x50')]};return db[_0x239d('0x41')]['count'](_0x17a83f)[_0x239d('0x22')](function(_0x5eb348){_0x4e4e8d[_0x239d('0x32')]=_0x5eb348;if(_0x135873[_0x239d('0x46')][_0x239d('0x55')]){_0x2a3227[_0x239d('0x56')]=[{'all':!![]}];}return db[_0x239d('0x41')][_0x239d('0x57')](_0x2a3227);})[_0x239d('0x22')](function(_0xb84f0){_0x4e4e8d['rows']=_0xb84f0;return _0x4e4e8d;})['then'](respondWithFilteredResult(_0x4f53f0,_0x2a3227))[_0x239d('0x58')](handleError(_0x4f53f0,null));};exports[_0x239d('0x59')]=function(_0x36a45e,_0x358295){var _0x2efc7e={'raw':![],'where':{'id':_0x36a45e[_0x239d('0x5a')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x3281a2={};_0x3281a2[_0x239d('0x45')]=_['keys'](db[_0x239d('0x41')][_0x239d('0x42')]);_0x3281a2[_0x239d('0x46')]=_['keys'](_0x36a45e[_0x239d('0x46')]);_0x3281a2[_0x239d('0x48')]=_[_0x239d('0x49')](_0x3281a2[_0x239d('0x45')],_0x3281a2[_0x239d('0x46')]);_0x2efc7e[_0x239d('0x4b')]=_[_0x239d('0x49')](_0x3281a2[_0x239d('0x45')],qs[_0x239d('0x4a')](_0x36a45e[_0x239d('0x46')][_0x239d('0x4a')]));_0x2efc7e[_0x239d('0x4b')]=_0x2efc7e[_0x239d('0x4b')][_0x239d('0x4c')]?_0x2efc7e[_0x239d('0x4b')]:_0x3281a2[_0x239d('0x45')];if(_0x36a45e[_0x239d('0x46')][_0x239d('0x55')]){_0x2efc7e[_0x239d('0x56')]=[{'all':!![]}];}_0x2efc7e=_['merge']({},_0x2efc7e,_0x36a45e['options']);return db[_0x239d('0x41')][_0x239d('0x5b')](_0x2efc7e)[_0x239d('0x22')](handleEntityNotFound(_0x358295,null))['then'](respondWithResult(_0x358295,null))[_0x239d('0x58')](handleError(_0x358295,null));};exports[_0x239d('0x5c')]=function(_0x30966d,_0x4e75ab){return db[_0x239d('0x41')][_0x239d('0x5c')](_0x30966d[_0x239d('0x5d')],{})[_0x239d('0x22')](function(_0x83c207){var _0x5617fe=_0x30966d[_0x239d('0x5e')][_0x239d('0x38')]({'plain':!![]});if(!_0x5617fe)throw new Error(_0x239d('0x5f'));if(_0x5617fe[_0x239d('0x60')]===_0x239d('0x5e')){var _0xb5c5f0=_0x83c207[_0x239d('0x38')]({'plain':!![]});var _0x2b2acb=_0x239d('0x39');return db[_0x239d('0x61')][_0x239d('0x5b')]({'where':{'name':_0x2b2acb,'userProfileId':_0x5617fe['userProfileId']},'raw':!![]})[_0x239d('0x22')](function(_0x507e7b){if(_0x507e7b&&_0x507e7b[_0x239d('0x62')]===0x0){return db['UserProfileResource'][_0x239d('0x5c')]({'name':_0xb5c5f0['name'],'resourceId':_0xb5c5f0['id'],'type':_0x507e7b['name'],'sectionId':_0x507e7b['id']},{})[_0x239d('0x22')](function(){return _0x83c207;});}else{return _0x83c207;}})[_0x239d('0x58')](function(_0x1383aa){logger[_0x239d('0x28')](_0x239d('0x63'),_0x1383aa);throw _0x1383aa;});}return _0x83c207;})['then'](respondWithResult(_0x4e75ab,0xc9))[_0x239d('0x58')](handleError(_0x4e75ab,null));};exports[_0x239d('0x37')]=function(_0x41c5da,_0x4bb7e9){if(_0x41c5da['body']['id']){delete _0x41c5da['body']['id'];}return db[_0x239d('0x41')][_0x239d('0x5b')]({'where':{'id':_0x41c5da[_0x239d('0x5a')]['id']},'include':[{'model':db[_0x239d('0x3e')],'as':_0x239d('0x3f')}]})['then'](handleEntityNotFound(_0x4bb7e9,null))[_0x239d('0x22')](saveUpdates(_0x41c5da[_0x239d('0x5d')],null))[_0x239d('0x22')](respondWithResult(_0x4bb7e9,null))['catch'](handleError(_0x4bb7e9,null));};exports[_0x239d('0x3b')]=function(_0x5000a9,_0x2d54f1){return db[_0x239d('0x41')][_0x239d('0x5b')]({'where':{'id':_0x5000a9[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x2d54f1,null))[_0x239d('0x22')](removeEntity(_0x2d54f1,null))[_0x239d('0x58')](handleError(_0x2d54f1,null));};exports['describe']=function(_0x58c992,_0xd1e506){return db[_0x239d('0x41')][_0x239d('0x64')]()[_0x239d('0x22')](respondWithResult(_0xd1e506,null))['catch'](handleError(_0xd1e506,null));};exports[_0x239d('0x65')]=function(_0x5c0c5f,_0x4bdaf0,_0x1a4df2){if(_0x5c0c5f['body']['id']){delete _0x5c0c5f['body']['id'];}return db[_0x239d('0x41')][_0x239d('0x5b')]({'where':{'id':_0x5c0c5f[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x4bdaf0,null))[_0x239d('0x22')](function(_0x51fdce){if(_0x51fdce){_0x5c0c5f[_0x239d('0x5d')][_0x239d('0x66')]=_0x51fdce['id'];return db[_0x239d('0x67')][_0x239d('0x5c')](_0x5c0c5f[_0x239d('0x5d')]);}})[_0x239d('0x22')](respondWithResult(_0x4bdaf0,null))[_0x239d('0x58')](handleError(_0x4bdaf0,null));};exports[_0x239d('0x68')]=function(_0x1cba07,_0x255f9c,_0x482d74){var _0x4c1217={'raw':![],'where':{}};var _0x50a22a={};var _0xb529ec={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x1cba07['params']['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x255f9c,null))['then'](function(_0x328638){if(_0x328638){_0x50a22a['model']=_['keys'](db[_0x239d('0x67')][_0x239d('0x42')]);_0x50a22a['query']=_[_0x239d('0x47')](_0x1cba07[_0x239d('0x46')]);_0x50a22a['filters']=_[_0x239d('0x49')](_0x50a22a[_0x239d('0x45')],_0x50a22a[_0x239d('0x46')]);_0x4c1217[_0x239d('0x4b')]=_['intersection'](_0x50a22a[_0x239d('0x45')],qs[_0x239d('0x4a')](_0x1cba07['query']['fields']));_0x4c1217['attributes']=_0x4c1217[_0x239d('0x4b')]['length']?_0x4c1217['attributes']:_0x50a22a[_0x239d('0x45')];if(!_0x1cba07[_0x239d('0x46')][_0x239d('0x4d')](_0x239d('0x4e'))){_0x4c1217[_0x239d('0x31')]=qs[_0x239d('0x31')](_0x1cba07['query'][_0x239d('0x31')]);_0x4c1217[_0x239d('0x33')]=qs[_0x239d('0x33')](_0x1cba07[_0x239d('0x46')][_0x239d('0x33')]);}_0x4c1217[_0x239d('0x69')]=qs['sort'](_0x1cba07['query'][_0x239d('0x4f')]);_0x4c1217[_0x239d('0x50')]=qs[_0x239d('0x48')](_[_0x239d('0x51')](_0x1cba07[_0x239d('0x46')],_0x50a22a[_0x239d('0x48')]));_0x4c1217[_0x239d('0x50')][_0x239d('0x66')]=_0x328638['id'];if(_0x1cba07[_0x239d('0x46')][_0x239d('0x53')]){_0x4c1217[_0x239d('0x50')]=_[_0x239d('0x52')](_0x4c1217[_0x239d('0x50')],{'$or':_[_0x239d('0x40')](_0x4c1217['attributes'],function(_0x52cd67){var _0x4503f9={};_0x4503f9[_0x52cd67]={'$like':'%'+_0x1cba07[_0x239d('0x46')][_0x239d('0x53')]+'%'};return _0x4503f9;})});}_0x4c1217=_[_0x239d('0x52')]({},_0x4c1217,_0x1cba07[_0x239d('0x54')]);return db[_0x239d('0x67')][_0x239d('0x32')]({'where':_0x4c1217['where']})['then'](function(_0x36a691){_0xb529ec[_0x239d('0x32')]=_0x36a691;if(_0x1cba07['query'][_0x239d('0x55')]){_0x4c1217[_0x239d('0x56')]=[{'all':!![]}];}return db[_0x239d('0x67')][_0x239d('0x57')](_0x4c1217);})[_0x239d('0x22')](function(_0x2f3c6c){_0xb529ec['rows']=_0x2f3c6c;return _0xb529ec;});}})[_0x239d('0x22')](respondWithFilteredResult(_0x255f9c,_0x4c1217))[_0x239d('0x58')](handleError(_0x255f9c,null));};exports['removeDispositions']=function(_0x127dd4,_0x51f7d9,_0xb1e54d){return db[_0x239d('0x41')][_0x239d('0x5b')]({'where':{'id':_0x127dd4[_0x239d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x51f7d9,null))['then'](function(_0x541c21){if(_0x541c21){return _0x541c21[_0x239d('0x6a')](_0x127dd4[_0x239d('0x46')][_0x239d('0x6b')]);}})[_0x239d('0x22')](respondWithStatusCode(_0x51f7d9,null))[_0x239d('0x58')](handleError(_0x51f7d9,null));};exports[_0x239d('0x6c')]=function(_0x216d02,_0x306538,_0x456981){if(_0x216d02[_0x239d('0x5d')]['id']){delete _0x216d02[_0x239d('0x5d')]['id'];}return db[_0x239d('0x41')][_0x239d('0x5b')]({'where':{'id':_0x216d02['params']['id']}})['then'](handleEntityNotFound(_0x306538,null))[_0x239d('0x22')](function(_0x44620e){if(_0x44620e){_0x216d02[_0x239d('0x5d')][_0x239d('0x66')]=_0x44620e['id'];return db['CannedAnswer']['create'](_0x216d02['body']);}})[_0x239d('0x22')](respondWithResult(_0x306538,null))[_0x239d('0x58')](handleError(_0x306538,null));};exports[_0x239d('0x6d')]=function(_0x1ee982,_0x43bf28,_0x22a621){var _0x37da0e={'raw':![],'where':{}};var _0x35689d={};var _0x159885={'count':0x0,'rows':[]};return db[_0x239d('0x41')][_0x239d('0x6e')]({'where':{'id':_0x1ee982[_0x239d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x43bf28,null))['then'](function(_0x35ca36){if(_0x35ca36){_0x35689d[_0x239d('0x45')]=_[_0x239d('0x47')](db[_0x239d('0x6f')][_0x239d('0x42')]);_0x35689d[_0x239d('0x46')]=_[_0x239d('0x47')](_0x1ee982[_0x239d('0x46')]);_0x35689d[_0x239d('0x48')]=_[_0x239d('0x49')](_0x35689d[_0x239d('0x45')],_0x35689d['query']);_0x37da0e[_0x239d('0x4b')]=_[_0x239d('0x49')](_0x35689d[_0x239d('0x45')],qs[_0x239d('0x4a')](_0x1ee982[_0x239d('0x46')][_0x239d('0x4a')]));_0x37da0e[_0x239d('0x4b')]=_0x37da0e[_0x239d('0x4b')][_0x239d('0x4c')]?_0x37da0e[_0x239d('0x4b')]:_0x35689d[_0x239d('0x45')];if(!_0x1ee982[_0x239d('0x46')][_0x239d('0x4d')](_0x239d('0x4e'))){_0x37da0e['limit']=qs[_0x239d('0x31')](_0x1ee982[_0x239d('0x46')][_0x239d('0x31')]);_0x37da0e[_0x239d('0x33')]=qs['offset'](_0x1ee982[_0x239d('0x46')]['offset']);}_0x37da0e['order']=qs[_0x239d('0x4f')](_0x1ee982[_0x239d('0x46')][_0x239d('0x4f')]);_0x37da0e[_0x239d('0x50')]=qs[_0x239d('0x48')](_['pick'](_0x1ee982[_0x239d('0x46')],_0x35689d[_0x239d('0x48')]));_0x37da0e[_0x239d('0x50')]['FaxAccountId']=_0x35ca36['id'];if(_0x1ee982['query'][_0x239d('0x53')]){_0x37da0e['where']=_['merge'](_0x37da0e['where'],{'$or':_[_0x239d('0x40')](_0x37da0e['attributes'],function(_0x5e1973){var _0x269354={};_0x269354[_0x5e1973]={'$like':'%'+_0x1ee982[_0x239d('0x46')][_0x239d('0x53')]+'%'};return _0x269354;})});}_0x37da0e=_[_0x239d('0x52')]({},_0x37da0e,_0x1ee982[_0x239d('0x54')]);return db[_0x239d('0x6f')][_0x239d('0x32')]({'where':_0x37da0e[_0x239d('0x50')]})[_0x239d('0x22')](function(_0x2da395){_0x159885[_0x239d('0x32')]=_0x2da395;if(_0x1ee982[_0x239d('0x46')][_0x239d('0x55')]){_0x37da0e[_0x239d('0x56')]=[{'all':!![]}];}return db[_0x239d('0x6f')][_0x239d('0x57')](_0x37da0e);})[_0x239d('0x22')](function(_0x5a3ad3){_0x159885[_0x239d('0x70')]=_0x5a3ad3;return _0x159885;});}})[_0x239d('0x22')](respondWithFilteredResult(_0x43bf28,_0x37da0e))['catch'](handleError(_0x43bf28,null));};exports['removeAnswers']=function(_0x1dc9de,_0x156cc0,_0x43255d){return db['FaxAccount'][_0x239d('0x5b')]({'where':{'id':_0x1dc9de[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x156cc0,null))[_0x239d('0x22')](function(_0x3ad59c){if(_0x3ad59c){return _0x3ad59c['removeAnswers'](_0x1dc9de[_0x239d('0x46')][_0x239d('0x6b')]);}})['then'](respondWithStatusCode(_0x156cc0,null))[_0x239d('0x58')](handleError(_0x156cc0,null));};exports['addInteraction']=function(_0x4c194f,_0x480bf3,_0x10eb57){return db[_0x239d('0x71')]['find']({'where':{'id':_0x4c194f[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x480bf3,null))[_0x239d('0x22')](function(_0x511af1){if(_0x511af1){return _0x511af1['addInteraction'](_0x4c194f[_0x239d('0x5d')]['ids'],_[_0x239d('0x72')](_0x4c194f['body'],[_0x239d('0x6b'),'id'])||{});}})[_0x239d('0x22')](respondWithResult(_0x480bf3,null))[_0x239d('0x58')](handleError(_0x480bf3,null));};exports[_0x239d('0x73')]=function(_0x29968d,_0x37e954,_0x10ef65){var _0x1016fe={'raw':![],'where':{}};var _0x9b90b={};var _0x256589={'count':0x0,'rows':[]};return db[_0x239d('0x41')][_0x239d('0x6e')]({'where':{'id':_0x29968d[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x37e954,null))['then'](function(_0x2766f3){if(_0x2766f3){_0x9b90b[_0x239d('0x45')]=_[_0x239d('0x47')](db['FaxInteraction'][_0x239d('0x42')]);_0x9b90b[_0x239d('0x46')]=_[_0x239d('0x47')](_0x29968d[_0x239d('0x46')]);_0x9b90b[_0x239d('0x48')]=_[_0x239d('0x49')](_0x9b90b[_0x239d('0x45')],_0x9b90b[_0x239d('0x46')]);_0x1016fe['attributes']=_[_0x239d('0x49')](_0x9b90b[_0x239d('0x45')],qs['fields'](_0x29968d[_0x239d('0x46')]['fields']));_0x1016fe['attributes']=_0x1016fe[_0x239d('0x4b')][_0x239d('0x4c')]?_0x1016fe[_0x239d('0x4b')]:_0x9b90b['model'];if(!_0x29968d[_0x239d('0x46')]['hasOwnProperty'](_0x239d('0x4e'))){_0x1016fe[_0x239d('0x31')]=qs[_0x239d('0x31')](_0x29968d[_0x239d('0x46')]['limit']);_0x1016fe[_0x239d('0x33')]=qs[_0x239d('0x33')](_0x29968d[_0x239d('0x46')][_0x239d('0x33')]);}_0x1016fe[_0x239d('0x69')]=qs[_0x239d('0x4f')](_0x29968d[_0x239d('0x46')][_0x239d('0x4f')]);_0x1016fe[_0x239d('0x50')]=qs[_0x239d('0x48')](_[_0x239d('0x51')](_0x29968d[_0x239d('0x46')],_0x9b90b[_0x239d('0x48')]));_0x1016fe[_0x239d('0x50')][_0x239d('0x66')]=_0x2766f3['id'];if(_0x29968d[_0x239d('0x46')][_0x239d('0x53')]){_0x1016fe[_0x239d('0x50')]=_[_0x239d('0x52')](_0x1016fe[_0x239d('0x50')],{'$or':_[_0x239d('0x40')](_0x1016fe[_0x239d('0x4b')],function(_0x2105f2){var _0x2c5088={};_0x2c5088[_0x2105f2]={'$like':'%'+_0x29968d['query'][_0x239d('0x53')]+'%'};return _0x2c5088;})});}_0x1016fe=_['merge']({},_0x1016fe,_0x29968d[_0x239d('0x54')]);return db['FaxInteraction']['count']({'where':_0x1016fe['where']})[_0x239d('0x22')](function(_0x5e1df4){_0x256589[_0x239d('0x32')]=_0x5e1df4;if(_0x29968d[_0x239d('0x46')][_0x239d('0x55')]){_0x1016fe[_0x239d('0x56')]=[{'model':db['CmContact'],'as':_0x239d('0x74'),'required':![]},{'model':db['User'],'as':_0x239d('0x75'),'attributes':['name','fullname',_0x239d('0x76')],'required':![]},{'model':db[_0x239d('0x77')],'as':'Tags','attributes':['id','name','color'],'where':_0x29968d['query'][_0x239d('0x78')]?{'id':_0x29968d['query']['tag']}:undefined,'required':_0x29968d[_0x239d('0x46')]['tag']?!![]:![]}];}return db[_0x239d('0x71')][_0x239d('0x57')](_0x1016fe);})[_0x239d('0x22')](function(_0x394e3a){_0x256589[_0x239d('0x70')]=_0x394e3a;return _0x256589;});}})['then'](respondWithFilteredResult(_0x37e954,_0x1016fe))[_0x239d('0x58')](handleError(_0x37e954,null));};exports[_0x239d('0x79')]=function(_0x1f9b09,_0x3e35f0){var _0x2410b9=_0x1f9b09[_0x239d('0x5a')]['id'];var _0x148d9c=_0x1f9b09['body'];var _0x4365f7=0xc8;var _0x5abf98=null;return db[_0x239d('0x7a')][_0x239d('0x7b')]({'isolationLevel':db[_0x239d('0x7a')]['Transaction'][_0x239d('0x7c')]['READ_COMMITTED']},function(_0xcd2269){return db[_0x239d('0x41')][_0x239d('0x6e')]({'where':{'id':_0x2410b9},'transaction':_0xcd2269})[_0x239d('0x22')](function(_0x20750a){if(_0x20750a){return db[_0x239d('0x7d')][_0x239d('0x3b')]({'where':{'FaxAccountId':_0x2410b9},'transaction':_0xcd2269})[_0x239d('0x22')](function(){var _0x4fd527=_[_0x239d('0x40')](_0x148d9c,function(_0x1632b3){_0x1632b3[_0x239d('0x66')]=_0x2410b9;return _0x1632b3;});return db[_0x239d('0x7d')]['bulkCreate'](_0x4fd527,{'transaction':_0xcd2269});});}else{_0x4365f7=0x194;_0x5abf98=[];}});})[_0x239d('0x22')](function(){if(_0x4365f7!==0x194){return db['FaxApplication']['findAndCountAll']({'where':{'FaxAccountId':_0x2410b9},'order':_0x239d('0x7e')})['then'](function(_0x4a64c1){_0x5abf98=_0x4a64c1;});}})[_0x239d('0x58')](function(_0x55ed50){_0x4365f7=0x1f4;logger[_0x239d('0x28')](_0x55ed50[_0x239d('0x7f')]);if(_0x55ed50[_0x239d('0x3c')]){delete _0x55ed50['name'];}_0x5abf98=_0x55ed50;})[_0x239d('0x80')](function(){if(_0x5abf98===null){_0x3e35f0['sendStatus'](_0x4365f7);}else{if(_0x4365f7===0x1f4){_0x3e35f0[_0x239d('0x2d')](_0x4365f7)[_0x239d('0x81')](_0x5abf98);}else{_0x3e35f0[_0x239d('0x2d')](_0x4365f7)['json'](_0x5abf98);}}});};exports[_0x239d('0x82')]=function(_0x1f5f24,_0x117fca,_0x3474e6){var _0x45970b={};var _0x8325c6={};var _0x5355f9;var _0x3286a9;return db[_0x239d('0x41')][_0x239d('0x6e')]({'where':{'id':_0x1f5f24[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x117fca,null))['then'](function(_0x317084){if(_0x317084){_0x5355f9=_0x317084;_0x8325c6[_0x239d('0x45')]=_[_0x239d('0x47')](db['FaxApplication'][_0x239d('0x42')]);_0x8325c6['query']=_[_0x239d('0x47')](_0x1f5f24[_0x239d('0x46')]);_0x8325c6[_0x239d('0x48')]=_[_0x239d('0x49')](_0x8325c6[_0x239d('0x45')],_0x8325c6[_0x239d('0x46')]);_0x45970b['attributes']=_[_0x239d('0x49')](_0x8325c6[_0x239d('0x45')],qs[_0x239d('0x4a')](_0x1f5f24[_0x239d('0x46')][_0x239d('0x4a')]));_0x45970b[_0x239d('0x4b')]=_0x45970b[_0x239d('0x4b')][_0x239d('0x4c')]?_0x45970b[_0x239d('0x4b')]:_0x8325c6[_0x239d('0x45')];_0x45970b['order']=qs[_0x239d('0x4f')](_0x1f5f24[_0x239d('0x46')][_0x239d('0x4f')]);_0x45970b[_0x239d('0x50')]=qs['filters'](_[_0x239d('0x51')](_0x1f5f24[_0x239d('0x46')],_0x8325c6[_0x239d('0x48')]));if(_0x1f5f24[_0x239d('0x46')][_0x239d('0x53')]){_0x45970b['where']=_[_0x239d('0x52')](_0x45970b[_0x239d('0x50')],{'$or':_[_0x239d('0x40')](_0x45970b[_0x239d('0x4b')],function(_0x223d91){var _0x59a75a={};_0x59a75a[_0x223d91]={'$like':'%'+_0x1f5f24[_0x239d('0x46')][_0x239d('0x53')]+'%'};return _0x59a75a;})});}_0x45970b=_['merge']({},_0x45970b,_0x1f5f24['options']);return _0x5355f9[_0x239d('0x82')](_0x45970b);}})[_0x239d('0x22')](function(_0x43764){if(_0x43764){_0x3286a9=_0x43764[_0x239d('0x4c')];if(!_0x1f5f24['query'][_0x239d('0x4d')](_0x239d('0x4e'))){_0x45970b[_0x239d('0x31')]=qs[_0x239d('0x31')](_0x1f5f24[_0x239d('0x46')]['limit']);_0x45970b[_0x239d('0x33')]=qs[_0x239d('0x33')](_0x1f5f24[_0x239d('0x46')]['offset']);}return _0x5355f9[_0x239d('0x82')](_0x45970b);}})[_0x239d('0x22')](function(_0x17bf87){if(_0x17bf87){return _0x17bf87?{'count':_0x3286a9,'rows':_0x17bf87}:null;}})[_0x239d('0x22')](respondWithResult(_0x117fca,null))[_0x239d('0x58')](handleError(_0x117fca,null));};function Extension(_0x33eb9c,_0x6e591c,_0x2b8aed,_0x3084b8){this[_0x239d('0x83')]='from-voip-provider';this[_0x239d('0x84')]=_0x33eb9c[_0x239d('0x85')];this[_0x239d('0x86')]=_0x3084b8;this[_0x239d('0x87')]=_0x239d('0x88');this[_0x239d('0x89')]=_0x239d('0x8a');this[_0x239d('0x66')]=_0x33eb9c['id'];this['priority']=_0x6e591c;this['appdata']=_0x2b8aed;}function createExtensionsReciveFax(_0x5d32b2){var _0x51f052=0x1;var _0x202adb=[];_0x202adb[_0x239d('0x8b')](new Extension(_0x5d32b2,_0x51f052,'',_0x239d('0x8c')));_0x51f052+=0x1;_0x202adb['push'](new Extension(_0x5d32b2,_0x51f052,_0x239d('0x8d'),_0x239d('0x8e')));_0x51f052+=0x1;for(var _0x514e60 in _0x5d32b2){if(_0x5d32b2['hasOwnProperty'](_0x514e60)&&(_0x514e60==='ecm'||_0x514e60===_0x239d('0x85')||_0x514e60==='gateway'||_0x514e60==='faxdetect'||_0x514e60==='headerinfo'||_0x514e60===_0x239d('0x8f')||_0x514e60===_0x239d('0x90')||_0x514e60===_0x239d('0x91')||_0x514e60===_0x239d('0x92'))){_0x202adb[_0x239d('0x8b')](new Extension(_0x5d32b2,_0x51f052,_0x239d('0x93')+_0x514e60+')='+_0x5d32b2[_0x514e60],_0x239d('0x8e')));_0x51f052+=0x1;}}_0x202adb[_0x239d('0x8b')](new Extension(_0x5d32b2,_0x51f052,'6',_0x239d('0x94')));_0x51f052+=0x1;_0x202adb[_0x239d('0x8b')](new Extension(_0x5d32b2,_0x51f052,_0x239d('0x95'),_0x239d('0x96')));_0x51f052=0x0;return _0x202adb;}exports[_0x239d('0x97')]=function(_0x2d7603,_0x203591,_0x46e447){var _0x317a06;return db['sequelize']['transaction'](function(_0x54d366){return db[_0x239d('0x41')]['create'](_0x2d7603[_0x239d('0x5d')],{'transaction':_0x54d366})[_0x239d('0x22')](function(_0x9a8bc){_0x317a06=_0x9a8bc[_0x239d('0x38')]({'plain':!![]});return db[_0x239d('0x98')][_0x239d('0x99')](createExtensionsReciveFax(_0x317a06),{'transaction':_0x54d366});});})['then'](function(){return _0x317a06;})[_0x239d('0x22')](respondWithResult(_0x203591,null))[_0x239d('0x58')](handleError(_0x203591,null));};exports['updateAccountApplications']=function(_0x5ada1a,_0x32e4b8,_0x7d5999){var _0x4d26d4;return db[_0x239d('0x7a')][_0x239d('0x7b')](function(_0x5e0545){return db[_0x239d('0x41')][_0x239d('0x37')](_0x5ada1a[_0x239d('0x5d')],{'where':{'id':_0x5ada1a[_0x239d('0x5d')]['id']},'transaction':_0x5e0545})[_0x239d('0x22')](function(_0x48597e){return db[_0x239d('0x98')][_0x239d('0x3b')]({'where':{'FaxAccountId':_0x5ada1a[_0x239d('0x5d')]['id']},'transaction':_0x5e0545})['then'](function(_0x377e53){return db[_0x239d('0x98')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0x5ada1a[_0x239d('0x5d')],['tech',_0x239d('0x44'),_0x239d('0x9a'),_0x239d('0x9b'),'TrunkId',_0x239d('0x9c')])),{'transaction':_0x5e0545});});});})['then'](function(){return db['FaxAccount'][_0x239d('0x9d')](_0x5ada1a['body']['id']);})[_0x239d('0x22')](respondWithResult(_0x32e4b8,null))['catch'](handleError(_0x32e4b8,null));};exports[_0x239d('0x9e')]=function(_0x5ca78a,_0x14f556,_0x4835c6){var _0x42a1c0={'raw':!![],'where':{}};var _0x157052={};var _0x272c39={'count':0x0,'rows':[]};return db[_0x239d('0x41')]['findOne']({'where':{'id':_0x5ca78a[_0x239d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x14f556,null))[_0x239d('0x22')](function(_0x439170){if(_0x439170){_0x157052[_0x239d('0x45')]=_['keys'](db['FaxMessage'][_0x239d('0x42')]);_0x157052[_0x239d('0x46')]=_[_0x239d('0x47')](_0x5ca78a['query']);_0x157052[_0x239d('0x48')]=_['intersection'](_0x157052[_0x239d('0x45')],_0x157052['query']);_0x42a1c0[_0x239d('0x4b')]=_['intersection'](_0x157052[_0x239d('0x45')],qs[_0x239d('0x4a')](_0x5ca78a[_0x239d('0x46')][_0x239d('0x4a')]));_0x42a1c0[_0x239d('0x4b')]=_0x42a1c0[_0x239d('0x4b')][_0x239d('0x4c')]?_0x42a1c0[_0x239d('0x4b')]:_0x157052[_0x239d('0x45')];if(!_0x5ca78a[_0x239d('0x46')][_0x239d('0x4d')](_0x239d('0x4e'))){_0x42a1c0[_0x239d('0x31')]=qs[_0x239d('0x31')](_0x5ca78a[_0x239d('0x46')][_0x239d('0x31')]);_0x42a1c0[_0x239d('0x33')]=qs[_0x239d('0x33')](_0x5ca78a[_0x239d('0x46')][_0x239d('0x33')]);}_0x42a1c0['order']=qs[_0x239d('0x4f')](_0x5ca78a['query'][_0x239d('0x4f')]);_0x42a1c0[_0x239d('0x50')]=qs['filters'](_[_0x239d('0x51')](_0x5ca78a[_0x239d('0x46')],_0x157052['filters']));_0x42a1c0[_0x239d('0x50')]['FaxAccountId']=_0x439170['id'];if(_0x5ca78a['query'][_0x239d('0x53')]){_0x42a1c0[_0x239d('0x50')]=_[_0x239d('0x52')](_0x42a1c0[_0x239d('0x50')],{'$or':_[_0x239d('0x40')](_0x42a1c0[_0x239d('0x4b')],function(_0x2d9afb){var _0x4f03af={};_0x4f03af[_0x2d9afb]={'$like':'%'+_0x5ca78a[_0x239d('0x46')]['filter']+'%'};return _0x4f03af;})});}if(_0x5ca78a[_0x239d('0x46')]['$gte']){var _0x10b554=_0x5ca78a[_0x239d('0x46')]['$gte']['split'](',');var _0x25f0d1={};_0x25f0d1[_0x10b554[0x0]]={'$gte':moment(_0x10b554[0x1])[_0x239d('0x9f')](_0x239d('0xa0'))};_0x42a1c0[_0x239d('0x50')]=_[_0x239d('0x52')](_0x42a1c0['where'],_0x25f0d1);}_0x42a1c0=_[_0x239d('0x52')]({},_0x42a1c0,_0x5ca78a[_0x239d('0x54')]);return db[_0x239d('0xa1')][_0x239d('0x32')]({'where':_0x42a1c0[_0x239d('0x50')]})[_0x239d('0x22')](function(_0x4c6a71){_0x272c39[_0x239d('0x32')]=_0x4c6a71;if(_0x5ca78a[_0x239d('0x46')][_0x239d('0x55')]){_0x42a1c0[_0x239d('0x56')]=[{'all':!![]}];}return db[_0x239d('0xa1')][_0x239d('0x57')](_0x42a1c0);})[_0x239d('0x22')](function(_0x442b51){_0x272c39[_0x239d('0x70')]=_0x442b51;return _0x272c39;});}})[_0x239d('0x22')](respondWithFilteredResult(_0x14f556,_0x42a1c0))[_0x239d('0x58')](handleError(_0x14f556,null));};exports['send']=function(_0x3a56ed,_0x5ac7a2,_0x2c81dd){var _0x569bc3,_0x28653a={},_0x4fd2c0;if(_0x3a56ed[_0x239d('0x5d')]['to']){_0x4fd2c0=_0x3a56ed['body']['to'][0x0];}return db[_0x239d('0x41')]['find']({'where':{'id':_0x3a56ed[_0x239d('0x5a')]['id']},'include':[{'model':db[_0x239d('0xa2')],'as':_0x239d('0xa3'),'include':[{'model':db[_0x239d('0xa4')],'as':_0x239d('0xa5'),'where':{'fax':_0x4fd2c0},'limit':0x1,'order':[[_0x239d('0x9b'),_0x239d('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x5ac7a2,null))[_0x239d('0x22')](function(_0xc01b87){_0x569bc3=_0xc01b87;if(_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')]&&_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][_0x239d('0x4c')]){for(var _0x1103e9=0x0;_0x1103e9<_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][_0x239d('0x4c')];_0x1103e9+=0x1){_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][_0x1103e9]={'filename':_0x3a56ed[_0x239d('0x5d')]['attachments'][_0x1103e9][_0x239d('0x3c')],'id':_0x3a56ed[_0x239d('0x5d')]['attachments'][_0x1103e9]['id'],'path':path[_0x239d('0xa8')](config[_0x239d('0xa9')],_0x239d('0xaa'),_0x3a56ed['body'][_0x239d('0xa7')][_0x1103e9]['basename'])};}}return respondWithRpcPromise(_0x239d('0xab'),_0x239d('0xab'),{'FaxAccountId':_[_0x239d('0xac')](_0x3a56ed[_0x239d('0x5a')]['id'])?undefined:_0x3a56ed[_0x239d('0x5a')]['id'],'path':_[_0x239d('0xac')](_0x3a56ed['body'][_0x239d('0xa7')][0x0][_0x239d('0x7')])?undefined:_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][0x0][_0x239d('0x7')],'fax':_[_0x239d('0xac')](_0x3a56ed[_0x239d('0x5d')]['to'][0x0])?undefined:_0x3a56ed[_0x239d('0x5d')]['to'][0x0]},client9002);})['then'](function(){if(_0x569bc3){if(_['isNil'](_0x3a56ed[_0x239d('0x5d')][_0x239d('0xad')])){_0x3a56ed[_0x239d('0x5d')][_0x239d('0xad')]=util['format'](_0x239d('0xae'),_0x569bc3['name'],_0x569bc3[_0x239d('0xaf')]);}if(_0x569bc3[_0x239d('0xa3')]){if(_0x569bc3[_0x239d('0xa3')][_0x239d('0xa5')][_0x239d('0x4c')]){return _0x569bc3['List'][_0x239d('0xa5')][0x0];}else{return db[_0x239d('0xa4')][_0x239d('0x5c')](_['defaults'](_0x3a56ed[_0x239d('0x5d')],{'firstName':_0x3a56ed['body']['to'][0x0],'phone':_0x3a56ed[_0x239d('0x5d')]['to'][0x0],'fax':_0x3a56ed[_0x239d('0x5d')]['to'][0x0],'ListId':_0x569bc3['ListId']}));}}else{throw new Error(_0x239d('0xb0'));}}else{throw new Error(_0x239d('0xb1'));}})[_0x239d('0x22')](function(_0x303980){if(_0x303980){return db[_0x239d('0x71')]['find']({'where':{'ContactId':_0x303980['id'],'closed':![],'FaxAccountId':_0x569bc3['id']}})['then'](function(_0x44cee1){if(_0x44cee1){return[_0x44cee1,![]];}return db[_0x239d('0x71')][_0x239d('0x5c')]({'UserId':_0x3a56ed['user']['id'],'ContactId':_0x303980['id'],'FaxAccountId':_0x569bc3['id'],'fax':_0x3a56ed['body']['to'][0x0],'firstMsgDirection':_0x239d('0xb2'),'Messages':[_[_0x239d('0x52')](_0x3a56ed[_0x239d('0x5d')],{'read':![],'body':_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][0x0][_0x239d('0xb3')],'FaxAccountId':_0x569bc3['id'],'UserId':_0x3a56ed[_0x239d('0x5e')]['id'],'ContactId':_0x303980['id'],'AttachmentId':_0x3a56ed['body'][_0x239d('0xa7')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x239d('0x22')](function(_0x1d3074){return[_0x1d3074,!![]];});});}else{throw new Error(_0x239d('0xb4'));}})['spread'](function(_0x1d80c8,_0x3491d2){if(_0x3491d2){return _0x1d80c8;}return db['FaxMessage'][_0x239d('0x5c')]({'direction':'out','read':![],'body':_0x3a56ed['body'][_0x239d('0xa7')][0x0][_0x239d('0xb3')],'FaxAccountId':_0x569bc3['id'],'FaxInteractionId':_0x1d80c8['id'],'UserId':_0x3a56ed[_0x239d('0x5e')]['id'],'ContactId':_0x1d80c8['ContactId'],'AttachmentId':_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][0x0]['id']})[_0x239d('0x22')](function(_0x4bb6d5){_0x1d80c8['dataValues']['Messages']=[];_0x1d80c8[_0x239d('0xb5')]['Messages'][_0x239d('0x8b')](_0x4bb6d5[_0x239d('0xb5')]);return _0x1d80c8;});})[_0x239d('0x22')](function(_0x1427b1){respondWithRpcPromise(_0x239d('0xb6'),_0x239d('0xb6'),{'FaxAccountId':_[_0x239d('0xac')](_0x3a56ed['params']['id'])?undefined:_0x3a56ed[_0x239d('0x5a')]['id'],'path':_[_0x239d('0xac')](_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][0x0][_0x239d('0x7')])?undefined:_0x3a56ed[_0x239d('0x5d')][_0x239d('0xa7')][0x0][_0x239d('0x7')],'fax':_[_0x239d('0xac')](_0x3a56ed[_0x239d('0x5d')]['to'][0x0])?undefined:_0x3a56ed['body']['to'][0x0],'AttachmentId':_0x3a56ed[_0x239d('0x5d')]['attachments'][0x0]['id']},client9002)['then'](function(_0x27cb0d){logger['info']('SendFaxRpc,\x20%s',_0x27cb0d);})['catch'](function(_0x5ccb48){logger[_0x239d('0x23')]('SendFaxRpc,\x20%s',_0x5ccb48);});return _0x1427b1;})['then'](respondWithResult(_0x5ac7a2,null))[_0x239d('0x58')](handleError(_0x5ac7a2,null));};exports['addAgents']=function(_0x4e1977,_0x416291,_0x4bbf79){return db['FaxAccount'][_0x239d('0x5b')]({'where':{'id':_0x4e1977['params']['id']}})['then'](handleEntityNotFound(_0x416291,null))[_0x239d('0x22')](function(_0x15869d){if(_0x15869d){return _0x15869d[_0x239d('0xb7')](_0x4e1977[_0x239d('0x5d')][_0x239d('0x6b')],_[_0x239d('0x72')](_0x4e1977[_0x239d('0x5d')],['ids','id'])||{})[_0x239d('0xb8')](function(_0x1a75c5){for(var _0x14a61a=0x0;_0x14a61a<_0x4e1977[_0x239d('0x5d')][_0x239d('0x6b')]['length'];_0x14a61a+=0x1){socket[_0x239d('0xb9')](_0x239d('0xba'),{'UserId':Number(_0x4e1977[_0x239d('0x5d')][_0x239d('0x6b')][_0x14a61a]),'FaxAccountId':Number(_0x4e1977[_0x239d('0x5a')]['id'])});}return _0x1a75c5;});}})[_0x239d('0x22')](respondWithResult(_0x416291,null))[_0x239d('0x58')](handleError(_0x416291,null));};exports[_0x239d('0xbb')]=function(_0xc61967,_0x3fd242,_0x5de95d){return db['FaxAccount'][_0x239d('0x5b')]({'where':{'id':_0xc61967['params']['id']}})[_0x239d('0x22')](handleEntityNotFound(_0x3fd242,null))[_0x239d('0x22')](function(_0x245a40){if(_0x245a40){return _0x245a40[_0x239d('0xbb')](_0xc61967[_0x239d('0x46')][_0x239d('0x6b')])['then'](function(){if(_[_0x239d('0xbc')](_0xc61967['query'][_0x239d('0x6b')])){for(var _0x228101=0x0;_0x228101<_0xc61967[_0x239d('0x46')][_0x239d('0x6b')]['length'];_0x228101+=0x1){socket[_0x239d('0xb9')](_0x239d('0xbd'),{'UserId':Number(_0xc61967[_0x239d('0x46')][_0x239d('0x6b')][_0x228101]),'FaxAccountId':Number(_0xc61967['params']['id'])});}}else{socket[_0x239d('0xb9')]('userFaxAccount:remove',{'UserId':Number(_0xc61967['query'][_0x239d('0x6b')]),'FaxAccountId':Number(_0xc61967[_0x239d('0x5a')]['id'])});}});}})[_0x239d('0x22')](respondWithStatusCode(_0x3fd242,null))[_0x239d('0x58')](handleError(_0x3fd242,null));};exports[_0x239d('0xbe')]=function(_0x427f9b,_0xd50558,_0x1c0e86){var _0x51cd2d={};var _0x452556={};var _0x4a4414;var _0x19ed0e;return db[_0x239d('0x41')][_0x239d('0x6e')]({'where':{'id':_0x427f9b[_0x239d('0x5a')]['id']}})[_0x239d('0x22')](handleEntityNotFound(_0xd50558,null))[_0x239d('0x22')](function(_0x2bb254){if(_0x2bb254){_0x4a4414=_0x2bb254;_0x452556['model']=_[_0x239d('0x47')](db[_0x239d('0xbf')][_0x239d('0x42')]);_0x452556['query']=_[_0x239d('0x47')](_0x427f9b[_0x239d('0x46')]);_0x452556['filters']=_[_0x239d('0x49')](_0x452556[_0x239d('0x45')],_0x452556[_0x239d('0x46')]);_0x51cd2d[_0x239d('0x4b')]=_['intersection'](_0x452556[_0x239d('0x45')],qs[_0x239d('0x4a')](_0x427f9b[_0x239d('0x46')][_0x239d('0x4a')]));_0x51cd2d[_0x239d('0x4b')]=_0x51cd2d[_0x239d('0x4b')][_0x239d('0x4c')]?_0x51cd2d[_0x239d('0x4b')]:_0x452556[_0x239d('0x45')];_0x51cd2d[_0x239d('0x69')]=qs[_0x239d('0x4f')](_0x427f9b[_0x239d('0x46')]['sort']);_0x51cd2d[_0x239d('0x50')]=qs[_0x239d('0x48')](_[_0x239d('0x51')](_0x427f9b[_0x239d('0x46')],_0x452556[_0x239d('0x48')]));if(_0x427f9b[_0x239d('0x46')][_0x239d('0x53')]){_0x51cd2d['where']=_[_0x239d('0x52')](_0x51cd2d[_0x239d('0x50')],{'$or':_[_0x239d('0x40')](_0x51cd2d[_0x239d('0x4b')],function(_0x8c4d17){var _0x5eb889={};_0x5eb889[_0x8c4d17]={'$like':'%'+_0x427f9b['query'][_0x239d('0x53')]+'%'};return _0x5eb889;})});}_0x51cd2d=_[_0x239d('0x52')]({},_0x51cd2d,_0x427f9b['options']);return _0x4a4414[_0x239d('0xbe')](_0x51cd2d);}})[_0x239d('0x22')](function(_0x1390bb){if(_0x1390bb){_0x19ed0e=_0x1390bb[_0x239d('0x4c')];if(!_0x427f9b[_0x239d('0x46')][_0x239d('0x4d')]('nolimit')){_0x51cd2d[_0x239d('0x31')]=qs[_0x239d('0x31')](_0x427f9b['query'][_0x239d('0x31')]);_0x51cd2d[_0x239d('0x33')]=qs[_0x239d('0x33')](_0x427f9b['query'][_0x239d('0x33')]);}return _0x4a4414[_0x239d('0xbe')](_0x51cd2d);}})[_0x239d('0x22')](function(_0x548547){if(_0x548547){return _0x548547?{'count':_0x19ed0e,'rows':_0x548547}:null;}})[_0x239d('0x22')](respondWithResult(_0xd50558,null))[_0x239d('0x58')](handleError(_0xd50558,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c5b1691..bfae242 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 _0xc47a=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x827661,_0x1d8e22){var _0x5ca2bf=function(_0x3597b2){while(--_0x3597b2){_0x827661['push'](_0x827661['shift']());}};_0x5ca2bf(++_0x1d8e22);}(_0xc47a,0x1ab));var _0xac47=function(_0x15aefd,_0x4576d5){_0x15aefd=_0x15aefd-0x0;var _0x543da9=_0xc47a[_0x15aefd];return _0x543da9;};'use strict';var EventEmitter=require(_0xac47('0x0'));var FaxAccount=require(_0xac47('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xac47('0x2')](0x0);var events={'afterCreate':_0xac47('0x3'),'afterUpdate':_0xac47('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56293c){return function(_0x1274e3,_0x24ec7d,_0x13c8ae){FaxAccountEvents[_0xac47('0x5')](_0x56293c+':'+_0x1274e3['id'],_0x1274e3);FaxAccountEvents[_0xac47('0x5')](_0x56293c,_0x1274e3);_0x13c8ae(null);};}for(var e in events){if(events[_0xac47('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xac47('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0xc878=['setMaxListeners','update','emit','exports','FaxAccount'];(function(_0x517656,_0x55f955){var _0x446a95=function(_0x1db372){while(--_0x1db372){_0x517656['push'](_0x517656['shift']());}};_0x446a95(++_0x55f955);}(_0xc878,0x144));var _0x8c87=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0xc878[_0xf89c3];return _0x274fc8;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x8c87('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x8c87('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c87('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2f70ab){return function(_0x348294,_0x1d25e6,_0x338851){FaxAccountEvents[_0x8c87('0x3')](_0x2f70ab+':'+_0x348294['id'],_0x348294);FaxAccountEvents[_0x8c87('0x3')](_0x2f70ab,_0x348294);_0x338851(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x8c87('0x4')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index f505804..694d898 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 _0x7c25=['api','moment','bluebird','path','../../config/environment','exports','define','fax_accounts','lodash','../../config/logger'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7c25,0x1b6));var _0x57c2=function(_0x189729,_0x5d3dc5){_0x189729=_0x189729-0x0;var _0x574f1f=_0x7c25[_0x189729];return _0x574f1f;};'use strict';var _=require(_0x57c2('0x0'));var util=require('util');var logger=require(_0x57c2('0x1'))(_0x57c2('0x2'));var moment=require(_0x57c2('0x3'));var BPromise=require(_0x57c2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57c2('0x5'));var rimraf=require('rimraf');var config=require(_0x57c2('0x6'));var attributes=require('./faxAccount.attributes');module[_0x57c2('0x7')]=function(_0x5cec3d,_0x3ed237){return _0x5cec3d[_0x57c2('0x8')]('FaxAccount',attributes,{'tableName':_0x57c2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2bad=['api','moment','bluebird','request-promise','path','./faxAccount.attributes','define','FaxAccount','fax_accounts','lodash','util','../../config/logger'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x2bad,0xed));var _0xd2ba=function(_0x2f0274,_0x2dd966){_0x2f0274=_0x2f0274-0x0;var _0x188cca=_0x2bad[_0x2f0274];return _0x188cca;};'use strict';var _=require(_0xd2ba('0x0'));var util=require(_0xd2ba('0x1'));var logger=require(_0xd2ba('0x2'))(_0xd2ba('0x3'));var moment=require(_0xd2ba('0x4'));var BPromise=require(_0xd2ba('0x5'));var rp=require(_0xd2ba('0x6'));var fs=require('fs');var path=require(_0xd2ba('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2ba('0x8'));module['exports']=function(_0x39bc94,_0xd08207){return _0x39bc94[_0xd2ba('0x9')](_0xd2ba('0xa'),attributes,{'tableName':_0xd2ba('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 4de493c..31c9f94 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 _0x41c9=['push','applications','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','create','AttachmentId','User','find','name','unshift','agent','waitForTheAssignedAgent','startRouting','Start','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','findAll','options','raw','where','attributes','include','model','map','fax','CmContact','describe','ValidationError','difference','keys','updatedAt','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','get','account','list','orderBy','asc','contact','FaxInteraction','Contact\x20not\x20found','spread'];(function(_0x552e09,_0x32eea9){var _0x3dd40a=function(_0x471747){while(--_0x471747){_0x552e09['push'](_0x552e09['shift']());}};_0x3dd40a(++_0x32eea9);}(_0x41c9,0x176));var _0x941c=function(_0x201aa6,_0x225b9e){_0x201aa6=_0x201aa6-0x0;var _0x1a1d00=_0x41c9[_0x201aa6];return _0x1a1d00;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x941c('0x0'));var BPromise=require(_0x941c('0x1'));var rs=require(_0x941c('0x2'));var fs=require('fs');var Redis=require(_0x941c('0x3'));var db=require(_0x941c('0x4'))['db'];var utils=require(_0x941c('0x5'));var logger=require('../../config/logger')(_0x941c('0x6'));var config=require(_0x941c('0x7'));var jayson=require(_0x941c('0x8'));var client=jayson[_0x941c('0x9')][_0x941c('0xa')]({'port':0x232c});config[_0x941c('0xb')]=_[_0x941c('0xc')](config[_0x941c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x941c('0xb')]));require(_0x941c('0xd'))['register'](socket);function respondWithRpcPromise(_0x30d817,_0x1fdd45,_0x56f539){return new BPromise(function(_0x26e699,_0x3d190e){return client[_0x941c('0xe')](_0x30d817,_0x56f539)[_0x941c('0xf')](function(_0x19ec03){logger[_0x941c('0x10')](_0x941c('0x11'),_0x1fdd45,_0x941c('0x12'));logger[_0x941c('0x13')](_0x941c('0x14'),_0x1fdd45,'request\x20sent',JSON[_0x941c('0x15')](_0x19ec03));if(_0x19ec03['error']){if(_0x19ec03[_0x941c('0x16')][_0x941c('0x17')]===0x1f4){logger['error'](_0x941c('0x11'),_0x1fdd45,_0x19ec03[_0x941c('0x16')][_0x941c('0x18')]);return _0x3d190e(_0x19ec03[_0x941c('0x16')][_0x941c('0x18')]);}logger[_0x941c('0x16')](_0x941c('0x11'),_0x1fdd45,_0x19ec03[_0x941c('0x16')]['message']);return _0x26e699(_0x19ec03['error'][_0x941c('0x18')]);}else{logger[_0x941c('0x10')](_0x941c('0x11'),_0x1fdd45,_0x941c('0x12'));_0x26e699(_0x19ec03[_0x941c('0x19')][_0x941c('0x18')]);}})[_0x941c('0x1a')](function(_0x553680){logger[_0x941c('0x16')](_0x941c('0x11'),_0x1fdd45,_0x553680);_0x3d190e(_0x553680);});});}exports[_0x941c('0x1b')]=function(_0x343d64){var _0x59bfdc=this;return new Promise(function(_0x2ea786,_0x529665){return db[_0x941c('0x1c')][_0x941c('0x1d')]({'raw':_0x343d64[_0x941c('0x1e')]?_0x343d64[_0x941c('0x1e')][_0x941c('0x1f')]===undefined?!![]:![]:!![],'where':_0x343d64[_0x941c('0x1e')]?_0x343d64[_0x941c('0x1e')][_0x941c('0x20')]||null:null,'attributes':_0x343d64['options']?_0x343d64[_0x941c('0x1e')][_0x941c('0x21')]||null:null,'limit':_0x343d64[_0x941c('0x1e')]?_0x343d64[_0x941c('0x1e')]['limit']||null:null,'include':_0x343d64[_0x941c('0x1e')]?_0x343d64[_0x941c('0x1e')][_0x941c('0x22')]?_['map'](_0x343d64[_0x941c('0x1e')][_0x941c('0x22')],function(_0x554ab6){return{'model':db[_0x554ab6[_0x941c('0x23')]],'as':_0x554ab6['as'],'attributes':_0x554ab6[_0x941c('0x21')],'include':_0x554ab6[_0x941c('0x22')]?_[_0x941c('0x24')](_0x554ab6[_0x941c('0x22')],function(_0x5929d7){return{'model':db[_0x5929d7[_0x941c('0x23')]],'as':_0x5929d7['as'],'attributes':_0x5929d7[_0x941c('0x21')],'include':_0x5929d7['include']?_['map'](_0x5929d7[_0x941c('0x22')],function(_0x20d643){return{'model':db[_0x20d643[_0x941c('0x23')]],'as':_0x20d643['as'],'attributes':_0x20d643['attributes']};}):[]};}):[]};}):[]:[]})[_0x941c('0xf')](function(_0x5dda02){logger[_0x941c('0x10')]('GetFaxAccount',_0x343d64);logger['debug'](_0x941c('0x1b'),_0x343d64,JSON[_0x941c('0x15')](_0x5dda02));_0x2ea786(_0x5dda02);})[_0x941c('0x1a')](function(_0x235793){logger[_0x941c('0x16')](_0x941c('0x1b'),_0x235793[_0x941c('0x18')],_0x343d64);_0x529665(_0x59bfdc[_0x941c('0x16')](0x1f4,_0x235793[_0x941c('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x481d70,_0x421d6d,_0x1e00a2){var _0x82c9b6=this;return new Promise(function(_0x1241e9,_0x7ab123){var _0x2ef6c1={'body':_0x481d70['body'],'channel':_0x941c('0x25')};var _0x1fe69a=[];var _0x1b2080=[];var _0x481a96={};return db[_0x941c('0x26')][_0x941c('0x27')]()['then'](function(_0x5f3073){if(!_0x5f3073){throw new db['Sequelize'][(_0x941c('0x28'))]('no\x20available\x20attributes');}_0x1fe69a=_[_0x941c('0x29')](_[_0x941c('0x2a')](_0x5f3073),['createdAt',_0x941c('0x2b')]);_0x1b2080=_[_0x941c('0x29')](_['keys'](_0x5f3073),[_0x941c('0x2c'),_0x941c('0x2b'),_0x941c('0x2d'),_0x941c('0x2e')]);if(_0x481d70[_0x941c('0x2f')]['id']){delete _0x481d70[_0x941c('0x2f')]['id'];}if(_[_0x941c('0x30')](_0x481d70[_0x941c('0x2f')][_0x941c('0x31')])){throw new db['Sequelize'][(_0x941c('0x28'))](_0x941c('0x32'));}if(_[_0x941c('0x30')](_0x481d70[_0x941c('0x2f')][_0x941c('0x2f')])||_0x481d70[_0x941c('0x2f')][_0x941c('0x2f')]===''){throw new db['Sequelize'][(_0x941c('0x28'))](_0x941c('0x33'));}if(_[_0x941c('0x30')](_0x481d70[_0x941c('0x2f')][_0x941c('0x34')])){throw new db[(_0x941c('0x35'))][(_0x941c('0x28'))](_0x941c('0x36')+_0x1b2080);}if(!_[_0x941c('0x37')](_0x1b2080,_0x481d70[_0x941c('0x2f')][_0x941c('0x34')])){throw new db[(_0x941c('0x35'))][(_0x941c('0x28'))](_0x941c('0x38')+_0x1b2080);}_0x481a96[_0x481d70[_0x941c('0x2f')][_0x941c('0x34')]]=_0x481d70[_0x941c('0x2f')][_0x941c('0x31')];})[_0x941c('0xf')](function(){return db['FaxAccount']['find']({'where':{'id':_0x481d70['account']['id']},'include':[{'model':db[_0x941c('0x39')],'as':_0x941c('0x3a'),'include':[{'model':db[_0x941c('0x26')],'as':_0x941c('0x3b'),'where':_0x481a96,'limit':0x1,'order':[[_0x941c('0x2b'),_0x941c('0x3c')]]}]},{'model':db['FaxApplication'],'as':_0x941c('0x3d')}]});})[_0x941c('0xf')](function(_0x35f95b){if(_0x35f95b&&_0x35f95b[_0x941c('0x3a')]){var _0x425369=_0x35f95b[_0x941c('0x3e')]({'plain':!![]});_0x2ef6c1[_0x941c('0x3f')]=_0x425369;_0x2ef6c1['applications']=_0x425369[_0x941c('0x3d')];_0x2ef6c1[_0x941c('0x40')]=_0x425369[_0x941c('0x3a')];_0x2ef6c1['applications']=_[_0x941c('0x41')](_0x2ef6c1['applications'],['priority'],[_0x941c('0x42')]);if(_0x2ef6c1[_0x941c('0x3f')]['Applications']){delete _0x2ef6c1['account'][_0x941c('0x3d')];}if(_0x2ef6c1['account'][_0x941c('0x3a')]&&_0x2ef6c1['account']['List']['Contacts']['length']){return _0x2ef6c1[_0x941c('0x3f')][_0x941c('0x3a')][_0x941c('0x3b')][0x0];}var _0x67954=_[_0x941c('0xc')](_0x481d70[_0x941c('0x2f')],{'firstName':_0x481d70[_0x941c('0x2f')][_0x941c('0x31')],'ListId':_0x425369['ListId']});_0x67954[_0x481d70[_0x941c('0x2f')][_0x941c('0x34')]]=_0x481d70[_0x941c('0x2f')][_0x941c('0x31')];return db[_0x941c('0x26')]['create'](_0x67954,{'fields':_0x1fe69a,'raw':!![]});}})[_0x941c('0xf')](function(_0x2fedfe){_0x2ef6c1[_0x941c('0x43')]=_0x2fedfe;if(_0x2fedfe){var _0xd2764e={'ContactId':_0x2fedfe['id'],'FaxAccountId':_0x481d70[_0x941c('0x3f')]['id'],'fax':_0x2fedfe[_0x941c('0x25')]};return db[_0x941c('0x44')]['find']({'where':{'ContactId':_0x2fedfe['id'],'closed':![],'FaxAccountId':_0x481d70[_0x941c('0x3f')]['id']}})[_0x941c('0xf')](function(_0x7e0a3d){if(_0x7e0a3d){return[_0x7e0a3d,![]];}return db[_0x941c('0x44')]['create'](_0xd2764e)[_0x941c('0xf')](function(_0x4f39d7){return[_0x4f39d7,!![]];});});}else{throw new Error(_0x941c('0x45'));}})[_0x941c('0x46')](function(_0x57be90,_0x3e05df){var _0x3b003f=_0x57be90[_0x941c('0x3e')]({'plain':!![]});if(_0x3e05df){if(_0x2ef6c1[_0x941c('0x3f')]['autoclose']){_0x2ef6c1['applications'][_0x941c('0x47')]({'id':0x0,'priority':_0x2ef6c1[_0x941c('0x48')]['length']+0x1,'app':_0x941c('0x49'),'appdata':_0x941c('0x4a'),'interval':_0x941c('0x4b')});}_0x3b003f[_0x941c('0x4c')]=!![];}else{_0x3b003f['created']=![];}_0x2ef6c1[_0x941c('0x4d')]=_0x3b003f;return db[_0x941c('0x4e')][_0x941c('0x4f')]({'body':_0x481d70[_0x941c('0x2f')][_0x941c('0x2f')],'FaxAccountId':_0x481d70[_0x941c('0x3f')]['id'],'FaxInteractionId':_0x57be90['id'],'direction':'in','ContactId':_0x57be90['ContactId'],'AttachmentId':_0x481d70[_0x941c('0x2f')][_0x941c('0x50')]});})[_0x941c('0xf')](function(_0x36dfe7){_0x2ef6c1['message']=_0x36dfe7;if(_0x2ef6c1['interaction']['UserId']){return db[_0x941c('0x51')][_0x941c('0x52')]({'attributes':['id',_0x941c('0x53')],'where':{'id':_0x2ef6c1[_0x941c('0x4d')]['UserId']}})[_0x941c('0xf')](function(_0x8e258c){if(_0x8e258c){_0x2ef6c1['applications'][_0x941c('0x54')]({'id':0x0,'priority':0x0,'app':_0x941c('0x55'),'appdata':_0x8e258c['name']+','+(_0x2ef6c1[_0x941c('0x3f')][_0x941c('0x56')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x941c('0x57'),_0x2ef6c1);});}return respondWithRpcPromise(_0x941c('0x58'),_0x941c('0x57'),_0x2ef6c1);})[_0x941c('0xf')](function(_0x2ed0f7){_0x1241e9(_0x2ed0f7);})['catch'](function(_0x2d285e){_0x7ab123(_0x82c9b6['error'](0x1f4,_0x2d285e[_0x941c('0x18')]));});});}; \ No newline at end of file +var _0xfd88=['Contact\x20not\x20found','spread','autoclose','unmanaged','*,*,*,*','created','FaxMessage','ContactId','UserId','User','unshift','name','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFaxAccount','findAll','options','raw','where','limit','include','map','model','attributes','body','fax','CmContact','describe','difference','keys','createdAt','updatedAt','CompanyId','ListId','Sequelize','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','FaxAccount','find','account','CmList','List','get','Applications','applications','orderBy','priority','asc','Contacts','length','create','contact','FaxInteraction'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xfd88,0x113));var _0x8fd8=function(_0x4d7a61,_0x3fb6e6){_0x4d7a61=_0x4d7a61-0x0;var _0x186f73=_0xfd88[_0x4d7a61];return _0x186f73;};'use strict';var _=require(_0x8fd8('0x0'));var util=require('util');var moment=require(_0x8fd8('0x1'));var BPromise=require(_0x8fd8('0x2'));var rs=require(_0x8fd8('0x3'));var fs=require('fs');var Redis=require(_0x8fd8('0x4'));var db=require(_0x8fd8('0x5'))['db'];var utils=require(_0x8fd8('0x6'));var logger=require('../../config/logger')(_0x8fd8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8fd8('0x8')][_0x8fd8('0x9')]({'port':0x232c});config['redis']=_[_0x8fd8('0xa')](config['redis'],{'host':_0x8fd8('0xb'),'port':0x18eb});var socket=require(_0x8fd8('0xc'))(new Redis(config[_0x8fd8('0xd')]));require(_0x8fd8('0xe'))['register'](socket);function respondWithRpcPromise(_0xfbe5a9,_0x18f2e2,_0xfca98c){return new BPromise(function(_0x119b66,_0x108778){return client[_0x8fd8('0xf')](_0xfbe5a9,_0xfca98c)[_0x8fd8('0x10')](function(_0x548d60){logger[_0x8fd8('0x11')](_0x8fd8('0x12'),_0x18f2e2,_0x8fd8('0x13'));logger[_0x8fd8('0x14')](_0x8fd8('0x15'),_0x18f2e2,_0x8fd8('0x13'),JSON[_0x8fd8('0x16')](_0x548d60));if(_0x548d60[_0x8fd8('0x17')]){if(_0x548d60[_0x8fd8('0x17')][_0x8fd8('0x18')]===0x1f4){logger[_0x8fd8('0x17')](_0x8fd8('0x12'),_0x18f2e2,_0x548d60[_0x8fd8('0x17')][_0x8fd8('0x19')]);return _0x108778(_0x548d60[_0x8fd8('0x17')][_0x8fd8('0x19')]);}logger['error'](_0x8fd8('0x12'),_0x18f2e2,_0x548d60['error'][_0x8fd8('0x19')]);return _0x119b66(_0x548d60[_0x8fd8('0x17')][_0x8fd8('0x19')]);}else{logger['info'](_0x8fd8('0x12'),_0x18f2e2,'request\x20sent');_0x119b66(_0x548d60[_0x8fd8('0x1a')][_0x8fd8('0x19')]);}})[_0x8fd8('0x1b')](function(_0x5894f6){logger[_0x8fd8('0x17')](_0x8fd8('0x12'),_0x18f2e2,_0x5894f6);_0x108778(_0x5894f6);});});}exports[_0x8fd8('0x1c')]=function(_0xc38f44){var _0x3af111=this;return new Promise(function(_0x4ebc5d,_0x4a5be0){return db['FaxAccount'][_0x8fd8('0x1d')]({'raw':_0xc38f44[_0x8fd8('0x1e')]?_0xc38f44[_0x8fd8('0x1e')][_0x8fd8('0x1f')]===undefined?!![]:![]:!![],'where':_0xc38f44['options']?_0xc38f44['options'][_0x8fd8('0x20')]||null:null,'attributes':_0xc38f44['options']?_0xc38f44['options']['attributes']||null:null,'limit':_0xc38f44['options']?_0xc38f44[_0x8fd8('0x1e')][_0x8fd8('0x21')]||null:null,'include':_0xc38f44[_0x8fd8('0x1e')]?_0xc38f44['options'][_0x8fd8('0x22')]?_[_0x8fd8('0x23')](_0xc38f44[_0x8fd8('0x1e')][_0x8fd8('0x22')],function(_0xbe0cc3){return{'model':db[_0xbe0cc3[_0x8fd8('0x24')]],'as':_0xbe0cc3['as'],'attributes':_0xbe0cc3[_0x8fd8('0x25')],'include':_0xbe0cc3['include']?_['map'](_0xbe0cc3[_0x8fd8('0x22')],function(_0x243909){return{'model':db[_0x243909[_0x8fd8('0x24')]],'as':_0x243909['as'],'attributes':_0x243909[_0x8fd8('0x25')],'include':_0x243909['include']?_[_0x8fd8('0x23')](_0x243909[_0x8fd8('0x22')],function(_0x161702){return{'model':db[_0x161702['model']],'as':_0x161702['as'],'attributes':_0x161702[_0x8fd8('0x25')]};}):[]};}):[]};}):[]:[]})[_0x8fd8('0x10')](function(_0x33a8bc){logger[_0x8fd8('0x11')]('GetFaxAccount',_0xc38f44);logger[_0x8fd8('0x14')](_0x8fd8('0x1c'),_0xc38f44,JSON[_0x8fd8('0x16')](_0x33a8bc));_0x4ebc5d(_0x33a8bc);})[_0x8fd8('0x1b')](function(_0x3f4290){logger['error'](_0x8fd8('0x1c'),_0x3f4290[_0x8fd8('0x19')],_0xc38f44);_0x4a5be0(_0x3af111[_0x8fd8('0x17')](0x1f4,_0x3f4290['message']));});});};exports['NotifyFaxAccount']=function(_0x24fed8,_0x393b81,_0x3c2d53){var _0x4bf6b2=this;return new Promise(function(_0xccf020,_0x23b2de){var _0x591989={'body':_0x24fed8[_0x8fd8('0x26')],'channel':_0x8fd8('0x27')};var _0x243fc5=[];var _0x5e21e8=[];var _0x6a8a66={};return db[_0x8fd8('0x28')][_0x8fd8('0x29')]()[_0x8fd8('0x10')](function(_0x336b2a){if(!_0x336b2a){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x243fc5=_[_0x8fd8('0x2a')](_[_0x8fd8('0x2b')](_0x336b2a),[_0x8fd8('0x2c'),_0x8fd8('0x2d')]);_0x5e21e8=_[_0x8fd8('0x2a')](_[_0x8fd8('0x2b')](_0x336b2a),[_0x8fd8('0x2c'),_0x8fd8('0x2d'),_0x8fd8('0x2e'),_0x8fd8('0x2f')]);if(_0x24fed8[_0x8fd8('0x26')]['id']){delete _0x24fed8[_0x8fd8('0x26')]['id'];}if(_['isNil'](_0x24fed8[_0x8fd8('0x26')]['from'])){throw new db[(_0x8fd8('0x30'))][(_0x8fd8('0x31'))](_0x8fd8('0x32'));}if(_[_0x8fd8('0x33')](_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x26')])||_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x26')]===''){throw new db[(_0x8fd8('0x30'))][(_0x8fd8('0x31'))](_0x8fd8('0x34'));}if(_[_0x8fd8('0x33')](_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x35')])){throw new db[(_0x8fd8('0x30'))][(_0x8fd8('0x31'))](_0x8fd8('0x36')+_0x5e21e8);}if(!_[_0x8fd8('0x37')](_0x5e21e8,_0x24fed8['body']['mapKey'])){throw new db[(_0x8fd8('0x30'))][(_0x8fd8('0x31'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5e21e8);}_0x6a8a66[_0x24fed8['body'][_0x8fd8('0x35')]]=_0x24fed8['body'][_0x8fd8('0x38')];})[_0x8fd8('0x10')](function(){return db[_0x8fd8('0x39')][_0x8fd8('0x3a')]({'where':{'id':_0x24fed8[_0x8fd8('0x3b')]['id']},'include':[{'model':db[_0x8fd8('0x3c')],'as':_0x8fd8('0x3d'),'include':[{'model':db[_0x8fd8('0x28')],'as':'Contacts','where':_0x6a8a66,'limit':0x1,'order':[[_0x8fd8('0x2d'),'DESC']]}]},{'model':db['FaxApplication'],'as':'Applications'}]});})['then'](function(_0x521562){if(_0x521562&&_0x521562['List']){var _0xb0b90d=_0x521562[_0x8fd8('0x3e')]({'plain':!![]});_0x591989[_0x8fd8('0x3b')]=_0xb0b90d;_0x591989['applications']=_0xb0b90d[_0x8fd8('0x3f')];_0x591989['list']=_0xb0b90d['List'];_0x591989[_0x8fd8('0x40')]=_[_0x8fd8('0x41')](_0x591989[_0x8fd8('0x40')],[_0x8fd8('0x42')],[_0x8fd8('0x43')]);if(_0x591989['account']['Applications']){delete _0x591989[_0x8fd8('0x3b')][_0x8fd8('0x3f')];}if(_0x591989['account'][_0x8fd8('0x3d')]&&_0x591989[_0x8fd8('0x3b')][_0x8fd8('0x3d')][_0x8fd8('0x44')][_0x8fd8('0x45')]){return _0x591989[_0x8fd8('0x3b')][_0x8fd8('0x3d')][_0x8fd8('0x44')][0x0];}var _0x4f35d9=_['defaults'](_0x24fed8[_0x8fd8('0x26')],{'firstName':_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x38')],'ListId':_0xb0b90d[_0x8fd8('0x2f')]});_0x4f35d9[_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x35')]]=_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x38')];return db[_0x8fd8('0x28')][_0x8fd8('0x46')](_0x4f35d9,{'fields':_0x243fc5,'raw':!![]});}})[_0x8fd8('0x10')](function(_0x2ad335){_0x591989[_0x8fd8('0x47')]=_0x2ad335;if(_0x2ad335){var _0x1ad378={'ContactId':_0x2ad335['id'],'FaxAccountId':_0x24fed8[_0x8fd8('0x3b')]['id'],'fax':_0x2ad335[_0x8fd8('0x27')]};return db[_0x8fd8('0x48')][_0x8fd8('0x3a')]({'where':{'ContactId':_0x2ad335['id'],'closed':![],'FaxAccountId':_0x24fed8[_0x8fd8('0x3b')]['id']}})['then'](function(_0xd1a8c9){if(_0xd1a8c9){return[_0xd1a8c9,![]];}return db['FaxInteraction'][_0x8fd8('0x46')](_0x1ad378)[_0x8fd8('0x10')](function(_0x379483){return[_0x379483,!![]];});});}else{throw new Error(_0x8fd8('0x49'));}})[_0x8fd8('0x4a')](function(_0x2ccdb9,_0x1c7447){var _0x38bf18=_0x2ccdb9[_0x8fd8('0x3e')]({'plain':!![]});if(_0x1c7447){if(_0x591989[_0x8fd8('0x3b')][_0x8fd8('0x4b')]){_0x591989[_0x8fd8('0x40')]['push']({'id':0x0,'priority':_0x591989[_0x8fd8('0x40')][_0x8fd8('0x45')]+0x1,'app':'close','appdata':_0x8fd8('0x4c'),'interval':_0x8fd8('0x4d')});}_0x38bf18[_0x8fd8('0x4e')]=!![];}else{_0x38bf18['created']=![];}_0x591989['interaction']=_0x38bf18;return db[_0x8fd8('0x4f')][_0x8fd8('0x46')]({'body':_0x24fed8[_0x8fd8('0x26')][_0x8fd8('0x26')],'FaxAccountId':_0x24fed8[_0x8fd8('0x3b')]['id'],'FaxInteractionId':_0x2ccdb9['id'],'direction':'in','ContactId':_0x2ccdb9[_0x8fd8('0x50')],'AttachmentId':_0x24fed8['body']['AttachmentId']});})[_0x8fd8('0x10')](function(_0x500a02){_0x591989[_0x8fd8('0x19')]=_0x500a02;if(_0x591989['interaction'][_0x8fd8('0x51')]){return db[_0x8fd8('0x52')][_0x8fd8('0x3a')]({'attributes':['id','name'],'where':{'id':_0x591989['interaction']['UserId']}})[_0x8fd8('0x10')](function(_0x26b619){if(_0x26b619){_0x591989[_0x8fd8('0x40')][_0x8fd8('0x53')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x26b619[_0x8fd8('0x54')]+','+(_0x591989[_0x8fd8('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x591989);});}return respondWithRpcPromise(_0x8fd8('0x55'),_0x8fd8('0x56'),_0x591989);})['then'](function(_0x5aa047){_0xccf020(_0x5aa047);})[_0x8fd8('0x1b')](function(_0x255e2a){_0x23b2de(_0x4bf6b2['error'](0x1f4,_0x255e2a[_0x8fd8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 53071d5..3b5e115 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 _0xadec=['length','faxAccount:','./faxAccount.events','save','remove','emit','removeListener','register'];(function(_0x21a5be,_0x5226a0){var _0x1a53a9=function(_0x3b66fc){while(--_0x3b66fc){_0x21a5be['push'](_0x21a5be['shift']());}};_0x1a53a9(++_0x5226a0);}(_0xadec,0x132));var _0xcade=function(_0x462729,_0x226b5a){_0x462729=_0x462729-0x0;var _0x107767=_0xadec[_0x462729];return _0x107767;};'use strict';var FaxAccountEvents=require(_0xcade('0x0'));var events=[_0xcade('0x1'),_0xcade('0x2'),'update'];function createListener(_0x1bf75d,_0x319bfd){return function(_0x2acf64){_0x319bfd[_0xcade('0x3')](_0x1bf75d,_0x2acf64);};}function removeListener(_0x21519f,_0x3ddb28){return function(){FaxAccountEvents[_0xcade('0x4')](_0x21519f,_0x3ddb28);};}exports[_0xcade('0x5')]=function(_0x1c7119){for(var _0xf1cba3=0x0,_0xb220a=events[_0xcade('0x6')];_0xf1cba3<_0xb220a;_0xf1cba3++){var _0x384317=events[_0xf1cba3];var _0x3fd08d=createListener(_0xcade('0x7')+_0x384317,_0x1c7119);FaxAccountEvents['on'](_0x384317,_0x3fd08d);}}; \ No newline at end of file +var _0xd973=['register','length','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x32ce7b,_0x45e5be){var _0x5aba3a=function(_0x4fabe8){while(--_0x4fabe8){_0x32ce7b['push'](_0x32ce7b['shift']());}};_0x5aba3a(++_0x45e5be);}(_0xd973,0xa2));var _0x3d97=function(_0x38fc35,_0x539adc){_0x38fc35=_0x38fc35-0x0;var _0x4988b5=_0xd973[_0x38fc35];return _0x4988b5;};'use strict';var FaxAccountEvents=require(_0x3d97('0x0'));var events=[_0x3d97('0x1'),_0x3d97('0x2'),_0x3d97('0x3')];function createListener(_0x495866,_0x11a654){return function(_0x4496e3){_0x11a654[_0x3d97('0x4')](_0x495866,_0x4496e3);};}function removeListener(_0x4859b3,_0x2db06f){return function(){FaxAccountEvents[_0x3d97('0x5')](_0x4859b3,_0x2db06f);};}exports[_0x3d97('0x6')]=function(_0x93a6c7){for(var _0x2efbd1=0x0,_0x546632=events[_0x3d97('0x7')];_0x2efbd1<_0x546632;_0x2efbd1++){var _0x4ff549=events[_0x2efbd1];var _0x372842=createListener('faxAccount:'+_0x4ff549,_0x93a6c7);FaxAccountEvents['on'](_0x4ff549,_0x372842);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index e7e3479..a0c6fc2 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(_0x5c52b2,_0x449e2b){var _0x2a4943=function(_0x44dc9d){while(--_0x44dc9d){_0x5c52b2['push'](_0x5c52b2['shift']());}};_0x2a4943(++_0x449e2b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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(_0x28a245,_0x1d817a){var _0x1bfce6=function(_0x41558a){while(--_0x41558a){_0x28a245['push'](_0x28a245['shift']());}};_0x1bfce6(++_0x1d817a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'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 b2f7469..88c81ef 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 _0xa1c3=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa1c3,0x161));var _0x3a1c=function(_0x355b28,_0x5d24a2){_0x355b28=_0x355b28-0x0;var _0x525569=_0xa1c3[_0x355b28];return _0x525569;};'use strict';var Sequelize=require(_0x3a1c('0x0'));module[_0x3a1c('0x1')]={'priority':{'type':Sequelize[_0x3a1c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3a1c('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x3a1c('0x4')]()},'description':{'type':Sequelize[_0x3a1c('0x3')]},'interval':{'type':Sequelize[_0x3a1c('0x3')],'defaultValue':_0x3a1c('0x5')}}; \ No newline at end of file +var _0x21f2=['STRING','noop','TEXT','*,*,*,*','exports','INTEGER'];(function(_0x125dbe,_0x219cf5){var _0x1ee87e=function(_0x57a74c){while(--_0x57a74c){_0x125dbe['push'](_0x125dbe['shift']());}};_0x1ee87e(++_0x219cf5);}(_0x21f2,0x14e));var _0x221f=function(_0x599c88,_0x4f2b57){_0x599c88=_0x599c88-0x0;var _0x37ff27=_0x21f2[_0x599c88];return _0x37ff27;};'use strict';var Sequelize=require('sequelize');module[_0x221f('0x0')]={'priority':{'type':Sequelize[_0x221f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x221f('0x2')],'allowNull':![],'defaultValue':_0x221f('0x3')},'appdata':{'type':Sequelize[_0x221f('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x221f('0x2')],'defaultValue':_0x221f('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 4d1f57e..5e3e461 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 _0x9dbc=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','error','name','send','index','map','FaxApplication','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create'];(function(_0xd41286,_0x1251ce){var _0x3a771e=function(_0x832e01){while(--_0x832e01){_0xd41286['push'](_0xd41286['shift']());}};_0x3a771e(++_0x1251ce);}(_0x9dbc,0xe8));var _0xc9db=function(_0x3e0358,_0x11e9f4){_0x3e0358=_0x3e0358-0x0;var _0x1527d0=_0x9dbc[_0x3e0358];return _0x1527d0;};'use strict';var emlformat=require(_0xc9db('0x0'));var rimraf=require(_0xc9db('0x1'));var zipdir=require(_0xc9db('0x2'));var jsonpatch=require(_0xc9db('0x3'));var rp=require(_0xc9db('0x4'));var moment=require(_0xc9db('0x5'));var BPromise=require(_0xc9db('0x6'));var Mustache=require(_0xc9db('0x7'));var util=require('util');var path=require(_0xc9db('0x8'));var sox=require(_0xc9db('0x9'));var csv=require(_0xc9db('0xa'));var ejs=require(_0xc9db('0xb'));var fs=require('fs');var fs_extra=require(_0xc9db('0xc'));var _=require(_0xc9db('0xd'));var squel=require('squel');var crypto=require(_0xc9db('0xe'));var jsforce=require(_0xc9db('0xf'));var deskjs=require(_0xc9db('0x10'));var toCsv=require(_0xc9db('0xa'));var querystring=require('querystring');var Papa=require(_0xc9db('0x11'));var Redis=require('ioredis');var authService=require(_0xc9db('0x12'));var qs=require(_0xc9db('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc9db('0x14'));var logger=require(_0xc9db('0x15'))('api');var utils=require(_0xc9db('0x16'));var config=require(_0xc9db('0x17'));var licenseUtil=require(_0xc9db('0x18'));var db=require(_0xc9db('0x19'))['db'];function respondWithStatusCode(_0x586d99,_0x389a47){_0x389a47=_0x389a47||0xcc;return function(_0x3d737d){if(_0x3d737d){return _0x586d99[_0xc9db('0x1a')](_0x389a47);}return _0x586d99[_0xc9db('0x1b')](_0x389a47)[_0xc9db('0x1c')]();};}function respondWithResult(_0x13c833,_0x49ad85){_0x49ad85=_0x49ad85||0xc8;return function(_0x2cd83e){if(_0x2cd83e){return _0x13c833['status'](_0x49ad85)[_0xc9db('0x1d')](_0x2cd83e);}};}function respondWithFilteredResult(_0x17f01e,_0x3bcd79){return function(_0x52954b){if(_0x52954b){var _0x1fc88c=typeof _0x3bcd79[_0xc9db('0x1e')]===_0xc9db('0x1f')&&typeof _0x3bcd79[_0xc9db('0x20')]===_0xc9db('0x1f');var _0x49b557=_0x52954b[_0xc9db('0x21')];var _0x3109b9=_0x1fc88c?0x0:_0x3bcd79[_0xc9db('0x1e')];var _0x360048=_0x1fc88c?_0x52954b[_0xc9db('0x21')]:_0x3bcd79[_0xc9db('0x1e')]+_0x3bcd79[_0xc9db('0x20')];var _0x1664df;if(_0x360048>=_0x49b557){_0x360048=_0x49b557;_0x1664df=0xc8;}else{_0x1664df=0xce;}_0x17f01e[_0xc9db('0x1b')](_0x1664df);return _0x17f01e['set'](_0xc9db('0x22'),_0x3109b9+'-'+_0x360048+'/'+_0x49b557)[_0xc9db('0x1d')](_0x52954b);}return null;};}function patchUpdates(_0x3390aa){return function(_0x383078){try{jsonpatch['apply'](_0x383078,_0x3390aa,!![]);}catch(_0x46f374){return BPromise[_0xc9db('0x23')](_0x46f374);}return _0x383078['save']();};}function saveUpdates(_0x1ca36b,_0x5b61bd){return function(_0x28a420){if(_0x28a420){return _0x28a420[_0xc9db('0x24')](_0x1ca36b)[_0xc9db('0x25')](function(_0x487b19){return _0x487b19;});}return null;};}function removeEntity(_0x525546,_0x561c47){return function(_0x5218d7){if(_0x5218d7){return _0x5218d7[_0xc9db('0x26')]()['then'](function(){_0x525546[_0xc9db('0x1b')](0xcc)[_0xc9db('0x1c')]();});}};}function handleEntityNotFound(_0x47d01f,_0x37373a){return function(_0x36b323){if(!_0x36b323){_0x47d01f['sendStatus'](0x194);}return _0x36b323;};}function handleError(_0x5a690d,_0x220083){_0x220083=_0x220083||0x1f4;return function(_0x2cc1e6){logger[_0xc9db('0x27')](_0x2cc1e6['stack']);if(_0x2cc1e6['name']){delete _0x2cc1e6[_0xc9db('0x28')];}_0x5a690d[_0xc9db('0x1b')](_0x220083)[_0xc9db('0x29')](_0x2cc1e6);};}exports[_0xc9db('0x2a')]=function(_0x237483,_0x5e2e7b){var _0x30e605={},_0x228c60={},_0x42e2f9={'count':0x0,'rows':[]};var _0x523484=_[_0xc9db('0x2b')](db[_0xc9db('0x2c')]['rawAttributes'],function(_0x1d0b7d){return{'name':_0x1d0b7d[_0xc9db('0x2d')],'type':_0x1d0b7d['type'][_0xc9db('0x2e')]};});_0x228c60[_0xc9db('0x2f')]=_[_0xc9db('0x2b')](_0x523484,'name');_0x228c60[_0xc9db('0x30')]=_[_0xc9db('0x31')](_0x237483['query']);_0x228c60[_0xc9db('0x32')]=_[_0xc9db('0x33')](_0x228c60['model'],_0x228c60[_0xc9db('0x30')]);_0x30e605[_0xc9db('0x34')]=_[_0xc9db('0x33')](_0x228c60[_0xc9db('0x2f')],qs[_0xc9db('0x35')](_0x237483['query']['fields']));_0x30e605['attributes']=_0x30e605['attributes'][_0xc9db('0x36')]?_0x30e605[_0xc9db('0x34')]:_0x228c60[_0xc9db('0x2f')];if(!_0x237483[_0xc9db('0x30')][_0xc9db('0x37')](_0xc9db('0x38'))){_0x30e605[_0xc9db('0x20')]=qs[_0xc9db('0x20')](_0x237483[_0xc9db('0x30')]['limit']);_0x30e605[_0xc9db('0x1e')]=qs['offset'](_0x237483[_0xc9db('0x30')][_0xc9db('0x1e')]);}_0x30e605[_0xc9db('0x39')]=qs[_0xc9db('0x3a')](_0x237483[_0xc9db('0x30')][_0xc9db('0x3a')]);_0x30e605[_0xc9db('0x3b')]=qs['filters'](_[_0xc9db('0x3c')](_0x237483[_0xc9db('0x30')],_0x228c60[_0xc9db('0x32')]),_0x523484);if(_0x237483['query']['filter']){_0x30e605[_0xc9db('0x3b')]=_[_0xc9db('0x3d')](_0x30e605[_0xc9db('0x3b')],{'$or':_[_0xc9db('0x2b')](_0x523484,function(_0x3891c0){if(_0x3891c0[_0xc9db('0x3e')]!==_0xc9db('0x3f')){var _0x40350f={};_0x40350f[_0x3891c0['name']]={'$like':'%'+_0x237483[_0xc9db('0x30')][_0xc9db('0x40')]+'%'};return _0x40350f;}})});}_0x30e605=_[_0xc9db('0x3d')]({},_0x30e605,_0x237483[_0xc9db('0x41')]);var _0x4ef303={'where':_0x30e605[_0xc9db('0x3b')]};return db['FaxApplication'][_0xc9db('0x21')](_0x4ef303)[_0xc9db('0x25')](function(_0x5c7fcc){_0x42e2f9[_0xc9db('0x21')]=_0x5c7fcc;if(_0x237483[_0xc9db('0x30')]['includeAll']){_0x30e605[_0xc9db('0x42')]=[{'all':!![]}];}return db[_0xc9db('0x2c')][_0xc9db('0x43')](_0x30e605);})[_0xc9db('0x25')](function(_0x366c26){_0x42e2f9[_0xc9db('0x44')]=_0x366c26;return _0x42e2f9;})[_0xc9db('0x25')](respondWithFilteredResult(_0x5e2e7b,_0x30e605))[_0xc9db('0x45')](handleError(_0x5e2e7b,null));};exports[_0xc9db('0x46')]=function(_0x53aa11,_0x36c5a3){var _0x59800e={'raw':!![],'where':{'id':_0x53aa11[_0xc9db('0x47')]['id']}},_0x3e12ef={};_0x3e12ef[_0xc9db('0x2f')]=_[_0xc9db('0x31')](db[_0xc9db('0x2c')][_0xc9db('0x48')]);_0x3e12ef[_0xc9db('0x30')]=_[_0xc9db('0x31')](_0x53aa11[_0xc9db('0x30')]);_0x3e12ef[_0xc9db('0x32')]=_[_0xc9db('0x33')](_0x3e12ef[_0xc9db('0x2f')],_0x3e12ef['query']);_0x59800e['attributes']=_[_0xc9db('0x33')](_0x3e12ef[_0xc9db('0x2f')],qs['fields'](_0x53aa11['query']['fields']));_0x59800e[_0xc9db('0x34')]=_0x59800e[_0xc9db('0x34')][_0xc9db('0x36')]?_0x59800e[_0xc9db('0x34')]:_0x3e12ef[_0xc9db('0x2f')];if(_0x53aa11['query'][_0xc9db('0x49')]){_0x59800e[_0xc9db('0x42')]=[{'all':!![]}];}_0x59800e=_['merge']({},_0x59800e,_0x53aa11[_0xc9db('0x41')]);return db[_0xc9db('0x2c')][_0xc9db('0x4a')](_0x59800e)[_0xc9db('0x25')](handleEntityNotFound(_0x36c5a3,null))['then'](respondWithResult(_0x36c5a3,null))[_0xc9db('0x45')](handleError(_0x36c5a3,null));};exports[_0xc9db('0x4b')]=function(_0x2da6cf,_0x132885){return db[_0xc9db('0x2c')]['create'](_0x2da6cf[_0xc9db('0x4c')],{})[_0xc9db('0x25')](respondWithResult(_0x132885,0xc9))[_0xc9db('0x45')](handleError(_0x132885,null));};exports[_0xc9db('0x24')]=function(_0x3f76bd,_0x473cef){if(_0x3f76bd[_0xc9db('0x4c')]['id']){delete _0x3f76bd[_0xc9db('0x4c')]['id'];}return db[_0xc9db('0x2c')][_0xc9db('0x4a')]({'where':{'id':_0x3f76bd[_0xc9db('0x47')]['id']}})[_0xc9db('0x25')](handleEntityNotFound(_0x473cef,null))[_0xc9db('0x25')](saveUpdates(_0x3f76bd[_0xc9db('0x4c')],null))['then'](respondWithResult(_0x473cef,null))['catch'](handleError(_0x473cef,null));};exports[_0xc9db('0x26')]=function(_0x3ca355,_0x5abcbc){return db[_0xc9db('0x2c')][_0xc9db('0x4a')]({'where':{'id':_0x3ca355[_0xc9db('0x47')]['id']}})[_0xc9db('0x25')](handleEntityNotFound(_0x5abcbc,null))[_0xc9db('0x25')](removeEntity(_0x5abcbc,null))[_0xc9db('0x45')](handleError(_0x5abcbc,null));}; \ No newline at end of file +var _0xea97=['length','hasOwnProperty','sort','where','pick','filter','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','eml-format','request-promise','moment','bluebird','mustache','path','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','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','offset','set','reject','update','then','destroy','error','stack','name','index','FaxApplication','fieldName','model','map','keys','query','filters','intersection','attributes','fields'];(function(_0x2a94fe,_0x2ec262){var _0x5c0773=function(_0xd81627){while(--_0xd81627){_0x2a94fe['push'](_0x2a94fe['shift']());}};_0x5c0773(++_0x2ec262);}(_0xea97,0x160));var _0x7ea9=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xea97[_0xa8883];return _0x479426;};'use strict';var emlformat=require(_0x7ea9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7ea9('0x1'));var moment=require(_0x7ea9('0x2'));var BPromise=require(_0x7ea9('0x3'));var Mustache=require(_0x7ea9('0x4'));var util=require('util');var path=require(_0x7ea9('0x5'));var sox=require('sox');var csv=require(_0x7ea9('0x6'));var ejs=require(_0x7ea9('0x7'));var fs=require('fs');var fs_extra=require(_0x7ea9('0x8'));var _=require(_0x7ea9('0x9'));var squel=require(_0x7ea9('0xa'));var crypto=require(_0x7ea9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7ea9('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7ea9('0xd'));var Redis=require(_0x7ea9('0xe'));var authService=require(_0x7ea9('0xf'));var qs=require(_0x7ea9('0x10'));var as=require(_0x7ea9('0x11'));var hardwareService=require(_0x7ea9('0x12'));var logger=require(_0x7ea9('0x13'))(_0x7ea9('0x14'));var utils=require(_0x7ea9('0x15'));var config=require(_0x7ea9('0x16'));var licenseUtil=require(_0x7ea9('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9552,_0x3975b6){_0x3975b6=_0x3975b6||0xcc;return function(_0x21779f){if(_0x21779f){return _0x5e9552['sendStatus'](_0x3975b6);}return _0x5e9552[_0x7ea9('0x18')](_0x3975b6)[_0x7ea9('0x19')]();};}function respondWithResult(_0x3194e7,_0x4af650){_0x4af650=_0x4af650||0xc8;return function(_0x1a7a6b){if(_0x1a7a6b){return _0x3194e7[_0x7ea9('0x18')](_0x4af650)[_0x7ea9('0x1a')](_0x1a7a6b);}};}function respondWithFilteredResult(_0x26a3d1,_0x4583c1){return function(_0xd7f3dd){if(_0xd7f3dd){var _0x5775d1=typeof _0x4583c1['offset']==='undefined'&&typeof _0x4583c1[_0x7ea9('0x1b')]===_0x7ea9('0x1c');var _0x331b14=_0xd7f3dd[_0x7ea9('0x1d')];var _0x1c6d50=_0x5775d1?0x0:_0x4583c1[_0x7ea9('0x1e')];var _0x5a03d1=_0x5775d1?_0xd7f3dd[_0x7ea9('0x1d')]:_0x4583c1[_0x7ea9('0x1e')]+_0x4583c1[_0x7ea9('0x1b')];var _0x211339;if(_0x5a03d1>=_0x331b14){_0x5a03d1=_0x331b14;_0x211339=0xc8;}else{_0x211339=0xce;}_0x26a3d1['status'](_0x211339);return _0x26a3d1[_0x7ea9('0x1f')]('Content-Range',_0x1c6d50+'-'+_0x5a03d1+'/'+_0x331b14)[_0x7ea9('0x1a')](_0xd7f3dd);}return null;};}function patchUpdates(_0x15b193){return function(_0x569198){try{jsonpatch['apply'](_0x569198,_0x15b193,!![]);}catch(_0x445207){return BPromise[_0x7ea9('0x20')](_0x445207);}return _0x569198['save']();};}function saveUpdates(_0x212394,_0x4f4c8e){return function(_0x2ddcaa){if(_0x2ddcaa){return _0x2ddcaa[_0x7ea9('0x21')](_0x212394)[_0x7ea9('0x22')](function(_0x4cea81){return _0x4cea81;});}return null;};}function removeEntity(_0x38786e,_0x7b555b){return function(_0x35acc1){if(_0x35acc1){return _0x35acc1[_0x7ea9('0x23')]()[_0x7ea9('0x22')](function(){_0x38786e['status'](0xcc)[_0x7ea9('0x19')]();});}};}function handleEntityNotFound(_0x1b2f9e,_0xc0aaf8){return function(_0x5af570){if(!_0x5af570){_0x1b2f9e['sendStatus'](0x194);}return _0x5af570;};}function handleError(_0x20e982,_0x9bc8bc){_0x9bc8bc=_0x9bc8bc||0x1f4;return function(_0x48ef19){logger[_0x7ea9('0x24')](_0x48ef19[_0x7ea9('0x25')]);if(_0x48ef19[_0x7ea9('0x26')]){delete _0x48ef19[_0x7ea9('0x26')];}_0x20e982['status'](_0x9bc8bc)['send'](_0x48ef19);};}exports[_0x7ea9('0x27')]=function(_0x4ce596,_0x565f01){var _0x4fb5c4={},_0x4191f7={},_0x2e8cb4={'count':0x0,'rows':[]};var _0x41d453=_['map'](db[_0x7ea9('0x28')]['rawAttributes'],function(_0x496e06){return{'name':_0x496e06[_0x7ea9('0x29')],'type':_0x496e06['type']['key']};});_0x4191f7[_0x7ea9('0x2a')]=_[_0x7ea9('0x2b')](_0x41d453,_0x7ea9('0x26'));_0x4191f7['query']=_[_0x7ea9('0x2c')](_0x4ce596[_0x7ea9('0x2d')]);_0x4191f7[_0x7ea9('0x2e')]=_[_0x7ea9('0x2f')](_0x4191f7[_0x7ea9('0x2a')],_0x4191f7['query']);_0x4fb5c4[_0x7ea9('0x30')]=_['intersection'](_0x4191f7[_0x7ea9('0x2a')],qs['fields'](_0x4ce596[_0x7ea9('0x2d')][_0x7ea9('0x31')]));_0x4fb5c4[_0x7ea9('0x30')]=_0x4fb5c4[_0x7ea9('0x30')][_0x7ea9('0x32')]?_0x4fb5c4[_0x7ea9('0x30')]:_0x4191f7[_0x7ea9('0x2a')];if(!_0x4ce596[_0x7ea9('0x2d')][_0x7ea9('0x33')]('nolimit')){_0x4fb5c4[_0x7ea9('0x1b')]=qs[_0x7ea9('0x1b')](_0x4ce596[_0x7ea9('0x2d')][_0x7ea9('0x1b')]);_0x4fb5c4['offset']=qs[_0x7ea9('0x1e')](_0x4ce596['query'][_0x7ea9('0x1e')]);}_0x4fb5c4['order']=qs[_0x7ea9('0x34')](_0x4ce596[_0x7ea9('0x2d')][_0x7ea9('0x34')]);_0x4fb5c4[_0x7ea9('0x35')]=qs[_0x7ea9('0x2e')](_[_0x7ea9('0x36')](_0x4ce596[_0x7ea9('0x2d')],_0x4191f7['filters']),_0x41d453);if(_0x4ce596[_0x7ea9('0x2d')][_0x7ea9('0x37')]){_0x4fb5c4[_0x7ea9('0x35')]=_['merge'](_0x4fb5c4[_0x7ea9('0x35')],{'$or':_[_0x7ea9('0x2b')](_0x41d453,function(_0xb10eea){if(_0xb10eea['type']!=='VIRTUAL'){var _0x1a8d89={};_0x1a8d89[_0xb10eea[_0x7ea9('0x26')]]={'$like':'%'+_0x4ce596[_0x7ea9('0x2d')][_0x7ea9('0x37')]+'%'};return _0x1a8d89;}})});}_0x4fb5c4=_['merge']({},_0x4fb5c4,_0x4ce596['options']);var _0x3587f3={'where':_0x4fb5c4[_0x7ea9('0x35')]};return db[_0x7ea9('0x28')][_0x7ea9('0x1d')](_0x3587f3)[_0x7ea9('0x22')](function(_0x42ecbc){_0x2e8cb4['count']=_0x42ecbc;if(_0x4ce596[_0x7ea9('0x2d')]['includeAll']){_0x4fb5c4[_0x7ea9('0x38')]=[{'all':!![]}];}return db['FaxApplication'][_0x7ea9('0x39')](_0x4fb5c4);})[_0x7ea9('0x22')](function(_0x1b9436){_0x2e8cb4[_0x7ea9('0x3a')]=_0x1b9436;return _0x2e8cb4;})[_0x7ea9('0x22')](respondWithFilteredResult(_0x565f01,_0x4fb5c4))[_0x7ea9('0x3b')](handleError(_0x565f01,null));};exports[_0x7ea9('0x3c')]=function(_0x4d6a5e,_0x2b1cfc){var _0x1eadb2={'raw':!![],'where':{'id':_0x4d6a5e[_0x7ea9('0x3d')]['id']}},_0x54e693={};_0x54e693[_0x7ea9('0x2a')]=_[_0x7ea9('0x2c')](db[_0x7ea9('0x28')]['rawAttributes']);_0x54e693['query']=_['keys'](_0x4d6a5e[_0x7ea9('0x2d')]);_0x54e693['filters']=_[_0x7ea9('0x2f')](_0x54e693[_0x7ea9('0x2a')],_0x54e693[_0x7ea9('0x2d')]);_0x1eadb2[_0x7ea9('0x30')]=_[_0x7ea9('0x2f')](_0x54e693[_0x7ea9('0x2a')],qs['fields'](_0x4d6a5e[_0x7ea9('0x2d')][_0x7ea9('0x31')]));_0x1eadb2['attributes']=_0x1eadb2[_0x7ea9('0x30')][_0x7ea9('0x32')]?_0x1eadb2[_0x7ea9('0x30')]:_0x54e693[_0x7ea9('0x2a')];if(_0x4d6a5e['query'][_0x7ea9('0x3e')]){_0x1eadb2[_0x7ea9('0x38')]=[{'all':!![]}];}_0x1eadb2=_[_0x7ea9('0x3f')]({},_0x1eadb2,_0x4d6a5e['options']);return db[_0x7ea9('0x28')][_0x7ea9('0x40')](_0x1eadb2)[_0x7ea9('0x22')](handleEntityNotFound(_0x2b1cfc,null))[_0x7ea9('0x22')](respondWithResult(_0x2b1cfc,null))[_0x7ea9('0x3b')](handleError(_0x2b1cfc,null));};exports[_0x7ea9('0x41')]=function(_0x40e008,_0x359bad){return db[_0x7ea9('0x28')][_0x7ea9('0x41')](_0x40e008[_0x7ea9('0x42')],{})[_0x7ea9('0x22')](respondWithResult(_0x359bad,0xc9))[_0x7ea9('0x3b')](handleError(_0x359bad,null));};exports[_0x7ea9('0x21')]=function(_0x282eb2,_0x4d782d){if(_0x282eb2[_0x7ea9('0x42')]['id']){delete _0x282eb2['body']['id'];}return db[_0x7ea9('0x28')]['find']({'where':{'id':_0x282eb2[_0x7ea9('0x3d')]['id']}})[_0x7ea9('0x22')](handleEntityNotFound(_0x4d782d,null))['then'](saveUpdates(_0x282eb2[_0x7ea9('0x42')],null))['then'](respondWithResult(_0x4d782d,null))[_0x7ea9('0x3b')](handleError(_0x4d782d,null));};exports[_0x7ea9('0x23')]=function(_0x165774,_0x1b21e6){return db['FaxApplication'][_0x7ea9('0x40')]({'where':{'id':_0x165774[_0x7ea9('0x3d')]['id']}})[_0x7ea9('0x22')](handleEntityNotFound(_0x1b21e6,null))[_0x7ea9('0x22')](removeEntity(_0x1b21e6,null))['catch'](handleError(_0x1b21e6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 38e250e..6fff73a 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 _0x985a=['utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','request-promise','path','rimraf','./faxApplication.attributes','exports','FaxApplication','fax_applications'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x985a,0x183));var _0xa985=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x985a[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xa985('0x0'));var logger=require(_0xa985('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa985('0x2'));var fs=require('fs');var path=require(_0xa985('0x3'));var rimraf=require(_0xa985('0x4'));var config=require('../../config/environment');var attributes=require(_0xa985('0x5'));module[_0xa985('0x6')]=function(_0x353078,_0x3fdc04){return _0x353078['define'](_0xa985('0x7'),attributes,{'tableName':_0xa985('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa985('0x9'),'collate':_0xa985('0xa')});}; \ No newline at end of file +var _0xaea0=['lodash','api','moment','bluebird','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci'];(function(_0x22c52f,_0x555480){var _0x17630b=function(_0x222cfe){while(--_0x222cfe){_0x22c52f['push'](_0x22c52f['shift']());}};_0x17630b(++_0x555480);}(_0xaea0,0x120));var _0x0aea=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xaea0[_0x1ab0e6];return _0x248815;};'use strict';var _=require(_0x0aea('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x0aea('0x1'));var moment=require(_0x0aea('0x2'));var BPromise=require(_0x0aea('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0aea('0x4'));var attributes=require(_0x0aea('0x5'));module[_0x0aea('0x6')]=function(_0xf2a54c,_0x279c49){return _0xf2a54c[_0x0aea('0x7')](_0x0aea('0x8'),attributes,{'tableName':_0x0aea('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0aea('0xa'),'collate':_0x0aea('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 49a0311..b8ed0ff 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 _0x0aae=['../../config/environment','client','http','request','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','FaxApplication,\x20%s,\x20%s','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x470a5d,_0x230dfc){var _0x90f8b1=function(_0xf10630){while(--_0xf10630){_0x470a5d['push'](_0x470a5d['shift']());}};_0x90f8b1(++_0x230dfc);}(_0x0aae,0x119));var _0xe0aa=function(_0x1785ff,_0xce35a3){_0x1785ff=_0x1785ff-0x0;var _0x518fab=_0x0aae[_0x1785ff];return _0x518fab;};'use strict';var _=require(_0xe0aa('0x0'));var util=require(_0xe0aa('0x1'));var moment=require('moment');var BPromise=require(_0xe0aa('0x2'));var rs=require(_0xe0aa('0x3'));var fs=require('fs');var Redis=require(_0xe0aa('0x4'));var db=require(_0xe0aa('0x5'))['db'];var utils=require(_0xe0aa('0x6'));var logger=require(_0xe0aa('0x7'))(_0xe0aa('0x8'));var config=require(_0xe0aa('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe0aa('0xa')][_0xe0aa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c57b8,_0x14d1a2,_0x398b65){return new BPromise(function(_0x59e332,_0x22561a){return client[_0xe0aa('0xc')](_0x3c57b8,_0x398b65)['then'](function(_0x15c82b){logger[_0xe0aa('0xd')]('FaxApplication,\x20%s,\x20%s',_0x14d1a2,_0xe0aa('0xe'));logger[_0xe0aa('0xf')](_0xe0aa('0x10'),_0x14d1a2,_0xe0aa('0xe'),JSON['stringify'](_0x15c82b));if(_0x15c82b[_0xe0aa('0x11')]){if(_0x15c82b[_0xe0aa('0x11')]['code']===0x1f4){logger[_0xe0aa('0x11')]('FaxApplication,\x20%s,\x20%s',_0x14d1a2,_0x15c82b[_0xe0aa('0x11')][_0xe0aa('0x12')]);return _0x22561a(_0x15c82b[_0xe0aa('0x11')][_0xe0aa('0x12')]);}logger[_0xe0aa('0x11')](_0xe0aa('0x13'),_0x14d1a2,_0x15c82b[_0xe0aa('0x11')][_0xe0aa('0x12')]);return _0x59e332(_0x15c82b[_0xe0aa('0x11')][_0xe0aa('0x12')]);}else{logger['info'](_0xe0aa('0x13'),_0x14d1a2,'request\x20sent');_0x59e332(_0x15c82b[_0xe0aa('0x14')][_0xe0aa('0x12')]);}})[_0xe0aa('0x15')](function(_0x23758c){logger['error'](_0xe0aa('0x13'),_0x14d1a2,_0x23758c);_0x22561a(_0x23758c);});});}exports[_0xe0aa('0x16')]=function(_0x10e064){var _0x4ea5dd=this;return new Promise(function(_0x19fd57,_0x512449){return db[_0xe0aa('0x17')]['update'](_0x10e064[_0xe0aa('0x18')],{'raw':_0x10e064[_0xe0aa('0x19')]?_0x10e064['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e064[_0xe0aa('0x19')]?_0x10e064['options'][_0xe0aa('0x1a')]||null:null,'attributes':_0x10e064[_0xe0aa('0x19')]?_0x10e064[_0xe0aa('0x19')]['attributes']||null:null,'limit':_0x10e064[_0xe0aa('0x19')]?_0x10e064['options']['limit']||null:null})[_0xe0aa('0x1b')](function(_0x3c8b18){logger[_0xe0aa('0xd')](_0xe0aa('0x16'),_0x10e064);logger[_0xe0aa('0xf')](_0xe0aa('0x16'),_0x10e064,JSON[_0xe0aa('0x1c')](_0x3c8b18));_0x19fd57(_0x3c8b18);})['catch'](function(_0x43a070){logger[_0xe0aa('0x11')](_0xe0aa('0x16'),_0x43a070[_0xe0aa('0x12')],_0x10e064);_0x512449(_0x4ea5dd[_0xe0aa('0x11')](0x1f4,_0x43a070['message']));});});}; \ No newline at end of file +var _0xa266=['jayson/promise','client','http','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','catch','UpdateFaxApplication','FaxApplication','update','body','options','where','limit','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4c71a4,_0x2fc8ad){var _0x1c3004=function(_0x4b08ab){while(--_0x4b08ab){_0x4c71a4['push'](_0x4c71a4['shift']());}};_0x1c3004(++_0x2fc8ad);}(_0xa266,0x1e5));var _0x6a26=function(_0x1fc1f9,_0x454fb2){_0x1fc1f9=_0x1fc1f9-0x0;var _0x4987ca=_0xa266[_0x1fc1f9];return _0x4987ca;};'use strict';var _=require(_0x6a26('0x0'));var util=require(_0x6a26('0x1'));var moment=require(_0x6a26('0x2'));var BPromise=require(_0x6a26('0x3'));var rs=require(_0x6a26('0x4'));var fs=require('fs');var Redis=require(_0x6a26('0x5'));var db=require(_0x6a26('0x6'))['db'];var utils=require(_0x6a26('0x7'));var logger=require(_0x6a26('0x8'))(_0x6a26('0x9'));var config=require(_0x6a26('0xa'));var jayson=require(_0x6a26('0xb'));var client=jayson[_0x6a26('0xc')][_0x6a26('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x280254,_0x4c062a,_0x1ed917){return new BPromise(function(_0x207308,_0x40c16b){return client[_0x6a26('0xe')](_0x280254,_0x1ed917)['then'](function(_0x1b98ae){logger[_0x6a26('0xf')](_0x6a26('0x10'),_0x4c062a,_0x6a26('0x11'));logger[_0x6a26('0x12')](_0x6a26('0x13'),_0x4c062a,_0x6a26('0x11'),JSON['stringify'](_0x1b98ae));if(_0x1b98ae['error']){if(_0x1b98ae[_0x6a26('0x14')]['code']===0x1f4){logger[_0x6a26('0x14')]('FaxApplication,\x20%s,\x20%s',_0x4c062a,_0x1b98ae['error'][_0x6a26('0x15')]);return _0x40c16b(_0x1b98ae[_0x6a26('0x14')][_0x6a26('0x15')]);}logger[_0x6a26('0x14')](_0x6a26('0x10'),_0x4c062a,_0x1b98ae['error']['message']);return _0x207308(_0x1b98ae[_0x6a26('0x14')][_0x6a26('0x15')]);}else{logger[_0x6a26('0xf')](_0x6a26('0x10'),_0x4c062a,_0x6a26('0x11'));_0x207308(_0x1b98ae['result'][_0x6a26('0x15')]);}})[_0x6a26('0x16')](function(_0x5ab25b){logger['error'](_0x6a26('0x10'),_0x4c062a,_0x5ab25b);_0x40c16b(_0x5ab25b);});});}exports[_0x6a26('0x17')]=function(_0x2ad05d){var _0x5b1462=this;return new Promise(function(_0x5a81ca,_0x4914fd){return db[_0x6a26('0x18')][_0x6a26('0x19')](_0x2ad05d[_0x6a26('0x1a')],{'raw':_0x2ad05d['options']?_0x2ad05d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ad05d['options']?_0x2ad05d[_0x6a26('0x1b')][_0x6a26('0x1c')]||null:null,'attributes':_0x2ad05d[_0x6a26('0x1b')]?_0x2ad05d[_0x6a26('0x1b')]['attributes']||null:null,'limit':_0x2ad05d[_0x6a26('0x1b')]?_0x2ad05d[_0x6a26('0x1b')][_0x6a26('0x1d')]||null:null})[_0x6a26('0x1e')](function(_0x4bfd86){logger[_0x6a26('0xf')]('UpdateFaxApplication',_0x2ad05d);logger['debug'](_0x6a26('0x17'),_0x2ad05d,JSON['stringify'](_0x4bfd86));_0x5a81ca(_0x4bfd86);})['catch'](function(_0x4838f7){logger[_0x6a26('0x14')]('UpdateFaxApplication',_0x4838f7['message'],_0x2ad05d);_0x4914fd(_0x5b1462[_0x6a26('0x14')](0x1f4,_0x4838f7[_0x6a26('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 2780ed7..e374afd 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 _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./faxApplication.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xe')]);module[_0xc6e6('0xf')]=router; \ No newline at end of file +var _0x0b0e=['./faxApplication.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(_0x18b0a1,_0x535aac){var _0x55005a=function(_0xf42695){while(--_0xf42695){_0x18b0a1['push'](_0x18b0a1['shift']());}};_0x55005a(++_0x535aac);}(_0x0b0e,0x187));var _0xe0b0=function(_0x7dbd65,_0x18da49){_0x7dbd65=_0x7dbd65-0x0;var _0x33d551=_0x0b0e[_0x7dbd65];return _0x33d551;};'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/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 35cfea6..772b468 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 _0x75c3=['STRING','out','ENUM','sequelize','exports','DATE'];(function(_0x126121,_0x35e290){var _0x57d413=function(_0x54e83a){while(--_0x54e83a){_0x126121['push'](_0x126121['shift']());}};_0x57d413(++_0x35e290);}(_0x75c3,0x99));var _0x375c=function(_0x1a48e4,_0x26deff){_0x1a48e4=_0x1a48e4-0x0;var _0x2f062d=_0x75c3[_0x1a48e4];return _0x2f062d;};'use strict';var Sequelize=require(_0x375c('0x0'));module[_0x375c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x375c('0x2')]},'disposition':{'type':Sequelize[_0x375c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x375c('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x375c('0x2')]},'fax':{'type':Sequelize[_0x375c('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x375c('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x375c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x375c('0x5')]('in',_0x375c('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x7bbc=['DATE','STRING','ENUM','out','sequelize','BOOLEAN'];(function(_0x2e1af3,_0x2a077b){var _0x4150cd=function(_0x1e08f3){while(--_0x1e08f3){_0x2e1af3['push'](_0x2e1af3['shift']());}};_0x4150cd(++_0x2a077b);}(_0x7bbc,0x1de));var _0xc7bb=function(_0x231562,_0xab9705){_0x231562=_0x231562-0x0;var _0x3df715=_0x7bbc[_0x231562];return _0x3df715;};'use strict';var Sequelize=require(_0xc7bb('0x0'));module['exports']={'closed':{'type':Sequelize[_0xc7bb('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc7bb('0x2')]},'disposition':{'type':Sequelize[_0xc7bb('0x3')]},'secondDisposition':{'type':Sequelize[_0xc7bb('0x3')]},'thirdDisposition':{'type':Sequelize[_0xc7bb('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xc7bb('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc7bb('0x4')]('in',_0xc7bb('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc7bb('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xc7bb('0x4')]('in',_0xc7bb('0x5')),'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 09c612d..1aff70b 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 _0x9fef=['Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','log','rimraf','bluebird','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','FaxInteraction','type','key','getOptions','fax','user','catch','show','model','keys','rawAttributes','query','filters','intersection','attributes','fields','includeAll','merge','options','create','body','params','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','length','hasOwnProperty','nolimit','sort','where','pick','FaxInteractionId','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','files','tmp','server','attachments','format','transcript-%d-%s.zip','push'];(function(_0x29b68f,_0x33106d){var _0x4e9de5=function(_0x5cf3af){while(--_0x5cf3af){_0x29b68f['push'](_0x29b68f['shift']());}};_0x4e9de5(++_0x33106d);}(_0x9fef,0x1ab));var _0xf9fe=function(_0x5cabac,_0x5ccb08){_0x5cabac=_0x5cabac-0x0;var _0x5f47b8=_0x9fef[_0x5cabac];return _0x5f47b8;};'use strict';var rimraf=require(_0xf9fe('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xf9fe('0x1'));var util=require(_0xf9fe('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xf9fe('0x3'));var Redis=require(_0xf9fe('0x4'));var interaction=require(_0xf9fe('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xf9fe('0x6'))(_0xf9fe('0x7'));var config=require(_0xf9fe('0x8'));var db=require(_0xf9fe('0x9'))['db'];config[_0xf9fe('0xa')]=_['defaults'](config[_0xf9fe('0xa')],{'host':_0xf9fe('0xb'),'port':0x18eb});var socket=require(_0xf9fe('0xc'))(new Redis(config[_0xf9fe('0xa')]));require(_0xf9fe('0xd'))[_0xf9fe('0xe')](socket);function respondWithStatusCode(_0x4763ae,_0x5c2849){_0x5c2849=_0x5c2849||0xcc;return function(_0xb6e408){if(_0xb6e408){return _0x4763ae[_0xf9fe('0xf')](_0x5c2849);}return _0x4763ae[_0xf9fe('0x10')](_0x5c2849)[_0xf9fe('0x11')]();};}function respondWithResult(_0x145ea2,_0x5db758){_0x5db758=_0x5db758||0xc8;return function(_0x47d3f1){if(_0x47d3f1){return _0x145ea2['status'](_0x5db758)[_0xf9fe('0x12')](_0x47d3f1);}};}function respondWithFilteredResult(_0xacb4cf,_0x3026a6){return function(_0x4c194e){if(_0x4c194e){var _0x149b55=typeof _0x3026a6[_0xf9fe('0x13')]===_0xf9fe('0x14')&&typeof _0x3026a6[_0xf9fe('0x15')]===_0xf9fe('0x14');var _0x4ca50a=_0x4c194e[_0xf9fe('0x16')];var _0x92e607=_0x149b55?0x0:_0x3026a6['offset'];var _0x4984ff=_0x149b55?_0x4c194e[_0xf9fe('0x16')]:_0x3026a6[_0xf9fe('0x13')]+_0x3026a6['limit'];var _0x237aa2;if(_0x4984ff>=_0x4ca50a){_0x4984ff=_0x4ca50a;_0x237aa2=0xc8;}else{_0x237aa2=0xce;}_0xacb4cf[_0xf9fe('0x10')](_0x237aa2);return _0xacb4cf['set'](_0xf9fe('0x17'),_0x92e607+'-'+_0x4984ff+'/'+_0x4ca50a)[_0xf9fe('0x12')](_0x4c194e);}return null;};}function saveUpdates(_0x338e84){return function(_0x5525b0){if(_0x5525b0){return _0x5525b0[_0xf9fe('0x18')](_0x338e84)[_0xf9fe('0x19')](function(_0x2fdd2b){return _0x2fdd2b;});}return null;};}function removeEntity(_0x15a7e0){return function(_0x48ba38){if(_0x48ba38){return _0x48ba38[_0xf9fe('0x1a')]()[_0xf9fe('0x19')](function(){_0x15a7e0[_0xf9fe('0x10')](0xcc)[_0xf9fe('0x11')]();});}};}function handleEntityNotFound(_0x53c7c4){return function(_0x3f010c){if(!_0x3f010c){_0x53c7c4['sendStatus'](0x194);}return _0x3f010c;};}function handleError(_0x327a9b,_0x55a9bb){_0x55a9bb=_0x55a9bb||0x1f4;return function(_0x31baf9){logger[_0xf9fe('0x1b')](_0x31baf9[_0xf9fe('0x1c')]);if(_0x31baf9[_0xf9fe('0x1d')]){delete _0x31baf9[_0xf9fe('0x1d')];}_0x327a9b['status'](_0x55a9bb)[_0xf9fe('0x1e')](_0x31baf9);};}exports[_0xf9fe('0x1f')]=function(_0x592174,_0x27aa13){var _0x42ccc0={};var _0x127eb7=_['map'](db[_0xf9fe('0x20')]['rawAttributes'],function(_0x35ab27){return{'name':_0x35ab27['fieldName'],'type':_0x35ab27[_0xf9fe('0x21')][_0xf9fe('0x22')]};});_0x42ccc0=qs[_0xf9fe('0x23')](_0x127eb7,_0x592174);return interaction['findAll'](_0xf9fe('0x24'),_0x592174['query'],_0x592174[_0xf9fe('0x25')],_0x42ccc0,_0x127eb7)['then'](respondWithFilteredResult(_0x27aa13,_0x42ccc0))[_0xf9fe('0x26')](handleError(_0x27aa13,null));};exports[_0xf9fe('0x27')]=function(_0xbaa8,_0x49204d){var _0xed14e7={'raw':![],'where':{'id':_0xbaa8['params']['id']}},_0x12466a={};_0x12466a[_0xf9fe('0x28')]=_[_0xf9fe('0x29')](db['FaxInteraction'][_0xf9fe('0x2a')]);_0x12466a[_0xf9fe('0x2b')]=_[_0xf9fe('0x29')](_0xbaa8[_0xf9fe('0x2b')]);_0x12466a[_0xf9fe('0x2c')]=_[_0xf9fe('0x2d')](_0x12466a[_0xf9fe('0x28')],_0x12466a[_0xf9fe('0x2b')]);_0xed14e7[_0xf9fe('0x2e')]=_[_0xf9fe('0x2d')](_0x12466a[_0xf9fe('0x28')],qs[_0xf9fe('0x2f')](_0xbaa8[_0xf9fe('0x2b')]['fields']));_0xed14e7[_0xf9fe('0x2e')]=_0xed14e7[_0xf9fe('0x2e')]['length']?_0xed14e7[_0xf9fe('0x2e')]:_0x12466a['model'];if(_0xbaa8[_0xf9fe('0x2b')][_0xf9fe('0x30')]){_0xed14e7['include']=[{'all':!![]}];}_0xed14e7=_[_0xf9fe('0x31')]({},_0xed14e7,_0xbaa8[_0xf9fe('0x32')]);return db[_0xf9fe('0x20')]['find'](_0xed14e7)['then'](handleEntityNotFound(_0x49204d,null))[_0xf9fe('0x19')](respondWithResult(_0x49204d,null))[_0xf9fe('0x26')](handleError(_0x49204d,null));};exports[_0xf9fe('0x33')]=function(_0x48beb5,_0x257ea9){return db[_0xf9fe('0x20')][_0xf9fe('0x33')](_0x48beb5['body'],{})['then'](respondWithResult(_0x257ea9,0xc9))[_0xf9fe('0x26')](handleError(_0x257ea9,null));};exports[_0xf9fe('0x18')]=function(_0x4e3014,_0x11861e){if(_0x4e3014['body']['id']){delete _0x4e3014[_0xf9fe('0x34')]['id'];}return db[_0xf9fe('0x20')]['find']({'where':{'id':_0x4e3014[_0xf9fe('0x35')]['id']}})[_0xf9fe('0x19')](handleEntityNotFound(_0x11861e,null))[_0xf9fe('0x19')](saveUpdates(_0x4e3014[_0xf9fe('0x34')],null))[_0xf9fe('0x19')](respondWithResult(_0x11861e,null))['catch'](handleError(_0x11861e,null));};exports['destroy']=function(_0x84ccdb,_0x1fec45){return db[_0xf9fe('0x20')][_0xf9fe('0x36')]({'where':{'id':_0x84ccdb[_0xf9fe('0x35')]['id']}})[_0xf9fe('0x19')](handleEntityNotFound(_0x1fec45,null))['then'](removeEntity(_0x1fec45,null))['catch'](handleError(_0x1fec45,null));};exports[_0xf9fe('0x37')]=function(_0x57333f,_0x369158){return db[_0xf9fe('0x20')]['describe']()[_0xf9fe('0x19')](respondWithResult(_0x369158,null))[_0xf9fe('0x26')](handleError(_0x369158,null));};exports[_0xf9fe('0x38')]=function(_0x28792c,_0x3f3bbe){return db[_0xf9fe('0x39')][_0xf9fe('0x36')]({'where':{'id':_0x28792c[_0xf9fe('0x35')]['id']}})[_0xf9fe('0x19')](handleEntityNotFound(_0x3f3bbe,null))['then'](function(_0x1fba1d){if(_0x1fba1d){return _0x1fba1d[_0xf9fe('0x38')](_0x28792c['body'][_0xf9fe('0x3a')],_[_0xf9fe('0x3b')](_0x28792c[_0xf9fe('0x34')],[_0xf9fe('0x3a'),'id'])||{});}})[_0xf9fe('0x19')](respondWithResult(_0x3f3bbe,null))[_0xf9fe('0x26')](handleError(_0x3f3bbe,null));};exports[_0xf9fe('0x3c')]=function(_0x16cfc7,_0x197f38){var _0x1d185d={'raw':![],'where':{}};var _0x7ce9ac={};var _0x3a0c0f={'count':0x0,'rows':[]};return db['FaxInteraction'][_0xf9fe('0x3d')]({'where':{'id':_0x16cfc7[_0xf9fe('0x35')]['id']}})[_0xf9fe('0x19')](handleEntityNotFound(_0x197f38,null))['then'](function(_0x1f663e){if(_0x1f663e){_0x7ce9ac[_0xf9fe('0x28')]=_[_0xf9fe('0x29')](db[_0xf9fe('0x39')][_0xf9fe('0x2a')]);_0x7ce9ac[_0xf9fe('0x2b')]=_[_0xf9fe('0x29')](_0x16cfc7['query']);_0x7ce9ac[_0xf9fe('0x2c')]=_[_0xf9fe('0x2d')](_0x7ce9ac[_0xf9fe('0x28')],_0x7ce9ac[_0xf9fe('0x2b')]);_0x1d185d[_0xf9fe('0x2e')]=_[_0xf9fe('0x2d')](_0x7ce9ac[_0xf9fe('0x28')],qs[_0xf9fe('0x2f')](_0x16cfc7[_0xf9fe('0x2b')][_0xf9fe('0x2f')]));_0x1d185d['attributes']=_0x1d185d[_0xf9fe('0x2e')][_0xf9fe('0x3e')]?_0x1d185d[_0xf9fe('0x2e')]:_0x7ce9ac[_0xf9fe('0x28')];if(!_0x16cfc7[_0xf9fe('0x2b')][_0xf9fe('0x3f')](_0xf9fe('0x40'))){_0x1d185d[_0xf9fe('0x15')]=qs[_0xf9fe('0x15')](_0x16cfc7[_0xf9fe('0x2b')][_0xf9fe('0x15')]);_0x1d185d[_0xf9fe('0x13')]=qs[_0xf9fe('0x13')](_0x16cfc7['query']['offset']);}_0x1d185d['order']=qs[_0xf9fe('0x41')](_0x16cfc7['query'][_0xf9fe('0x41')]);_0x1d185d[_0xf9fe('0x42')]=qs[_0xf9fe('0x2c')](_[_0xf9fe('0x43')](_0x16cfc7['query'],_0x7ce9ac[_0xf9fe('0x2c')]));_0x1d185d[_0xf9fe('0x42')][_0xf9fe('0x44')]=_0x1f663e['id'];if(_0x16cfc7[_0xf9fe('0x2b')]['filter']){_0x1d185d[_0xf9fe('0x42')]=_[_0xf9fe('0x31')](_0x1d185d[_0xf9fe('0x42')],{'$or':_[_0xf9fe('0x45')](_0x1d185d[_0xf9fe('0x2e')],function(_0x1d1431){var _0x5644f2={};_0x5644f2[_0x1d1431]={'$like':'%'+_0x16cfc7[_0xf9fe('0x2b')]['filter']+'%'};return _0x5644f2;})});}if(_0x16cfc7[_0xf9fe('0x2b')][_0xf9fe('0x46')]){var _0x21059c=_0x16cfc7[_0xf9fe('0x2b')]['$gte'][_0xf9fe('0x47')](',');var _0x56e655={};_0x56e655[_0x21059c[0x0]]={'$gte':moment(_0x21059c[0x1])['format'](_0xf9fe('0x48'))};_0x1d185d['where']=_['merge'](_0x1d185d['where'],_0x56e655);}_0x1d185d=_[_0xf9fe('0x31')]({},_0x1d185d,_0x16cfc7['options']);return db[_0xf9fe('0x39')][_0xf9fe('0x16')]({'where':_0x1d185d['where']})[_0xf9fe('0x19')](function(_0x4a5c4f){_0x3a0c0f[_0xf9fe('0x16')]=_0x4a5c4f;if(_0x16cfc7['query'][_0xf9fe('0x30')]){_0x1d185d[_0xf9fe('0x49')]=[{'all':!![]}];}return db[_0xf9fe('0x39')][_0xf9fe('0x4a')](_0x1d185d);})[_0xf9fe('0x19')](function(_0x93c86f){_0x3a0c0f['rows']=_0x93c86f;return _0x3a0c0f;});}})[_0xf9fe('0x19')](respondWithFilteredResult(_0x197f38,_0x1d185d))['catch'](handleError(_0x197f38,null));};exports[_0xf9fe('0x4b')]=function(_0x3529f8,_0xd70a44){return db[_0xf9fe('0x20')][_0xf9fe('0x36')]({'where':{'id':_0x3529f8[_0xf9fe('0x35')]['id']}})[_0xf9fe('0x19')](handleEntityNotFound(_0xd70a44,null))[_0xf9fe('0x19')](function(_0x4eb473){if(_0x4eb473){return _0x4eb473[_0xf9fe('0x4c')](_0x3529f8[_0xf9fe('0x34')][_0xf9fe('0x3a')],_[_0xf9fe('0x3b')](_0x3529f8[_0xf9fe('0x34')],[_0xf9fe('0x3a'),'id'])||{})[_0xf9fe('0x4d')](function(){return db[_0xf9fe('0x4e')]['findAll']({'attributes':['id',_0xf9fe('0x1d'),_0xf9fe('0x4f')],'where':{'id':_0x3529f8[_0xf9fe('0x34')][_0xf9fe('0x3a')]}});})['then'](function(_0x4ec1f4){socket[_0xf9fe('0x50')](_0xf9fe('0x51'),{'id':Number(_0x3529f8['params']['id']),'tags':_0x4ec1f4||[]});return{'id':Number(_0x3529f8[_0xf9fe('0x35')]['id']),'tags':_0x4ec1f4||[]};});}})['then'](respondWithResult(_0xd70a44,null))[_0xf9fe('0x26')](handleError(_0xd70a44,null));};exports[_0xf9fe('0x52')]=function(_0x33bfda,_0x28aec1){return db[_0xf9fe('0x20')][_0xf9fe('0x36')]({'where':{'id':_0x33bfda[_0xf9fe('0x35')]['id']}})[_0xf9fe('0x19')](handleEntityNotFound(_0x28aec1,null))[_0xf9fe('0x19')](function(_0x370a47){if(_0x370a47){return _0x370a47['removeTags'](_0x33bfda[_0xf9fe('0x2b')][_0xf9fe('0x3a')]);}})['then'](respondWithStatusCode(_0x28aec1,null))[_0xf9fe('0x26')](handleError(_0x28aec1,null));};exports['download']=function(_0x1c3358,_0x2fa2b9){var _0x50af6d=moment()[_0xf9fe('0x53')]()[_0xf9fe('0x54')]();var _0x4349fb=path[_0xf9fe('0x55')](config['root'],'server',_0xf9fe('0x56'),_0xf9fe('0x57'));var _0x4cb6fe=path[_0xf9fe('0x55')](config['root'],_0xf9fe('0x58'),_0xf9fe('0x56'),_0xf9fe('0x59'));var _0x53e93f=path[_0xf9fe('0x55')](_0x4349fb,_0x50af6d);var _0x1895e9=util[_0xf9fe('0x5a')](_0xf9fe('0x5b'),_0x1c3358[_0xf9fe('0x35')]['id'],_0x50af6d);var _0x592040=path[_0xf9fe('0x55')](_0x4349fb,_0x1895e9);var _0x3be7bd=[];_0x3be7bd[_0xf9fe('0x5c')]({'model':db[_0xf9fe('0x5d')],'as':_0xf9fe('0x5d'),'raw':!![]});var _0x2114fb=[{'model':db[_0xf9fe('0x39')],'as':_0xf9fe('0x5e'),'attributes':['id','body',_0xf9fe('0x5f')],'include':_0x3be7bd}];return db[_0xf9fe('0x20')][_0xf9fe('0x36')]({'where':{'id':_0x1c3358[_0xf9fe('0x35')]['id']},'include':_0x2114fb})['then'](handleEntityNotFound(_0x2fa2b9,null))[_0xf9fe('0x19')](function(_0x42ce8a){if(_0x42ce8a&&_0x42ce8a[_0xf9fe('0x5e')]){var _0x4963b5=_0x42ce8a[_0xf9fe('0x60')]({'plain':!![]});fs[_0xf9fe('0x61')](_0x53e93f);for(var _0x1f3461=0x0;_0x1f3461<_0x4963b5[_0xf9fe('0x5e')][_0xf9fe('0x3e')];_0x1f3461++){var _0x281f4f=_0x4963b5[_0xf9fe('0x5e')][_0x1f3461][_0xf9fe('0x5d')];if(_0x281f4f){var _0x4377a5=path[_0xf9fe('0x55')](_0x4cb6fe,_0x281f4f[_0xf9fe('0x62')]);if(fs[_0xf9fe('0x63')](_0x4377a5)){fs[_0xf9fe('0x64')](_0x4377a5)['pipe'](fs[_0xf9fe('0x65')](path['join'](_0x53e93f,_0x281f4f[_0xf9fe('0x62')])));}}}return BPromise[_0xf9fe('0x66')]()[_0xf9fe('0x19')](function(){return new BPromise(function(_0x3fd4a4,_0x4afa23){zipdir(_0x53e93f,{'saveTo':_0x592040},function(_0x1c3065,_0x16221e){if(_0x1c3065)return _0x4afa23(_0x1c3065);return _0x3fd4a4(_0x16221e);});})[_0xf9fe('0x19')](function(){return new BPromise(function(_0x1b5f47,_0x448ae4){rimraf(_0x53e93f,function(_0x30993e){if(_0x30993e)_0x448ae4(_0x30993e);return _0x1b5f47();});});})['then'](function(){return _0x2fa2b9['download'](_0x592040,_0x1895e9,function(_0x42fa65){if(_0x42fa65){console[_0xf9fe('0x67')]('err',_0x42fa65);}else{fs['unlinkSync'](_0x592040);}});});});}else{return _0x2fa2b9[_0xf9fe('0xf')](0xc8);}})[_0xf9fe('0x26')](handleError(_0x2fa2b9,null));}; \ No newline at end of file +var _0x3a0a=['end','sendStatus','error','stack','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user','catch','model','keys','attributes','intersection','includeAll','merge','create','body','params','addMessage','FaxMessage','omit','ids','getMessages','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','FaxInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','addTags','setTags','spread','Tag','name','color','emit','faxInteractionTags:save','removeTags','find','download','unix','toString','join','root','server','tmp','files','Attachment','Messages','createdAt','get','mkdirSync','basename','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','limit','count','set','Content-Range','update','then','destroy'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x3a0a,0x1f2));var _0xa3a0=function(_0x425910,_0x213114){_0x425910=_0x425910-0x0;var _0x152a91=_0x3a0a[_0x425910];return _0x152a91;};'use strict';var rimraf=require(_0xa3a0('0x0'));var zipdir=require(_0xa3a0('0x1'));var moment=require('moment');var BPromise=require(_0xa3a0('0x2'));var util=require(_0xa3a0('0x3'));var path=require(_0xa3a0('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xa3a0('0x5'));var interaction=require(_0xa3a0('0x6'));var qs=require(_0xa3a0('0x7'));var logger=require(_0xa3a0('0x8'))('api');var config=require(_0xa3a0('0x9'));var db=require(_0xa3a0('0xa'))['db'];config[_0xa3a0('0xb')]=_[_0xa3a0('0xc')](config[_0xa3a0('0xb')],{'host':_0xa3a0('0xd'),'port':0x18eb});var socket=require(_0xa3a0('0xe'))(new Redis(config[_0xa3a0('0xb')]));require(_0xa3a0('0xf'))[_0xa3a0('0x10')](socket);function respondWithStatusCode(_0xf161ca,_0x396dbc){_0x396dbc=_0x396dbc||0xcc;return function(_0x417fe5){if(_0x417fe5){return _0xf161ca['sendStatus'](_0x396dbc);}return _0xf161ca[_0xa3a0('0x11')](_0x396dbc)['end']();};}function respondWithResult(_0x272439,_0x3867fc){_0x3867fc=_0x3867fc||0xc8;return function(_0xf8b30f){if(_0xf8b30f){return _0x272439[_0xa3a0('0x11')](_0x3867fc)[_0xa3a0('0x12')](_0xf8b30f);}};}function respondWithFilteredResult(_0x4fcc83,_0x53479f){return function(_0x5ccf82){if(_0x5ccf82){var _0x53b3d2=typeof _0x53479f[_0xa3a0('0x13')]==='undefined'&&typeof _0x53479f[_0xa3a0('0x14')]==='undefined';var _0x48a23c=_0x5ccf82[_0xa3a0('0x15')];var _0x27fb76=_0x53b3d2?0x0:_0x53479f[_0xa3a0('0x13')];var _0xd4ee53=_0x53b3d2?_0x5ccf82[_0xa3a0('0x15')]:_0x53479f['offset']+_0x53479f[_0xa3a0('0x14')];var _0x4392ca;if(_0xd4ee53>=_0x48a23c){_0xd4ee53=_0x48a23c;_0x4392ca=0xc8;}else{_0x4392ca=0xce;}_0x4fcc83['status'](_0x4392ca);return _0x4fcc83[_0xa3a0('0x16')](_0xa3a0('0x17'),_0x27fb76+'-'+_0xd4ee53+'/'+_0x48a23c)[_0xa3a0('0x12')](_0x5ccf82);}return null;};}function saveUpdates(_0x51d2b5){return function(_0x478fe2){if(_0x478fe2){return _0x478fe2[_0xa3a0('0x18')](_0x51d2b5)[_0xa3a0('0x19')](function(_0x58513a){return _0x58513a;});}return null;};}function removeEntity(_0x531deb){return function(_0x1a5e0c){if(_0x1a5e0c){return _0x1a5e0c[_0xa3a0('0x1a')]()[_0xa3a0('0x19')](function(){_0x531deb[_0xa3a0('0x11')](0xcc)[_0xa3a0('0x1b')]();});}};}function handleEntityNotFound(_0x267851){return function(_0x46b5a7){if(!_0x46b5a7){_0x267851[_0xa3a0('0x1c')](0x194);}return _0x46b5a7;};}function handleError(_0x5830eb,_0x37e7ea){_0x37e7ea=_0x37e7ea||0x1f4;return function(_0x4e9f77){logger[_0xa3a0('0x1d')](_0x4e9f77[_0xa3a0('0x1e')]);if(_0x4e9f77['name']){delete _0x4e9f77['name'];}_0x5830eb[_0xa3a0('0x11')](_0x37e7ea)['send'](_0x4e9f77);};}exports[_0xa3a0('0x1f')]=function(_0x3ee1ef,_0x4be714){var _0x2536f3={};var _0x1b7ed0=_[_0xa3a0('0x20')](db[_0xa3a0('0x21')][_0xa3a0('0x22')],function(_0x3894c6){return{'name':_0x3894c6[_0xa3a0('0x23')],'type':_0x3894c6[_0xa3a0('0x24')][_0xa3a0('0x25')]};});_0x2536f3=qs[_0xa3a0('0x26')](_0x1b7ed0,_0x3ee1ef);return interaction[_0xa3a0('0x27')]('fax',_0x3ee1ef[_0xa3a0('0x28')],_0x3ee1ef[_0xa3a0('0x29')],_0x2536f3,_0x1b7ed0)[_0xa3a0('0x19')](respondWithFilteredResult(_0x4be714,_0x2536f3))[_0xa3a0('0x2a')](handleError(_0x4be714,null));};exports['show']=function(_0x3b9753,_0x5bbf60){var _0x3b1007={'raw':![],'where':{'id':_0x3b9753['params']['id']}},_0x1f9a5b={};_0x1f9a5b[_0xa3a0('0x2b')]=_[_0xa3a0('0x2c')](db[_0xa3a0('0x21')][_0xa3a0('0x22')]);_0x1f9a5b[_0xa3a0('0x28')]=_[_0xa3a0('0x2c')](_0x3b9753['query']);_0x1f9a5b['filters']=_['intersection'](_0x1f9a5b[_0xa3a0('0x2b')],_0x1f9a5b[_0xa3a0('0x28')]);_0x3b1007[_0xa3a0('0x2d')]=_[_0xa3a0('0x2e')](_0x1f9a5b[_0xa3a0('0x2b')],qs['fields'](_0x3b9753[_0xa3a0('0x28')]['fields']));_0x3b1007[_0xa3a0('0x2d')]=_0x3b1007[_0xa3a0('0x2d')]['length']?_0x3b1007[_0xa3a0('0x2d')]:_0x1f9a5b['model'];if(_0x3b9753[_0xa3a0('0x28')][_0xa3a0('0x2f')]){_0x3b1007['include']=[{'all':!![]}];}_0x3b1007=_[_0xa3a0('0x30')]({},_0x3b1007,_0x3b9753['options']);return db[_0xa3a0('0x21')]['find'](_0x3b1007)[_0xa3a0('0x19')](handleEntityNotFound(_0x5bbf60,null))['then'](respondWithResult(_0x5bbf60,null))[_0xa3a0('0x2a')](handleError(_0x5bbf60,null));};exports['create']=function(_0x2589e1,_0x3b24e9){return db[_0xa3a0('0x21')][_0xa3a0('0x31')](_0x2589e1[_0xa3a0('0x32')],{})['then'](respondWithResult(_0x3b24e9,0xc9))['catch'](handleError(_0x3b24e9,null));};exports[_0xa3a0('0x18')]=function(_0x161e9d,_0x5b9950){if(_0x161e9d[_0xa3a0('0x32')]['id']){delete _0x161e9d[_0xa3a0('0x32')]['id'];}return db[_0xa3a0('0x21')]['find']({'where':{'id':_0x161e9d[_0xa3a0('0x33')]['id']}})[_0xa3a0('0x19')](handleEntityNotFound(_0x5b9950,null))['then'](saveUpdates(_0x161e9d[_0xa3a0('0x32')],null))[_0xa3a0('0x19')](respondWithResult(_0x5b9950,null))[_0xa3a0('0x2a')](handleError(_0x5b9950,null));};exports['destroy']=function(_0x26333f,_0x44ebc8){return db['FaxInteraction']['find']({'where':{'id':_0x26333f['params']['id']}})[_0xa3a0('0x19')](handleEntityNotFound(_0x44ebc8,null))[_0xa3a0('0x19')](removeEntity(_0x44ebc8,null))[_0xa3a0('0x2a')](handleError(_0x44ebc8,null));};exports['describe']=function(_0x2ff49d,_0x444dfb){return db[_0xa3a0('0x21')]['describe']()[_0xa3a0('0x19')](respondWithResult(_0x444dfb,null))[_0xa3a0('0x2a')](handleError(_0x444dfb,null));};exports[_0xa3a0('0x34')]=function(_0x3aa189,_0x29c1b9){return db[_0xa3a0('0x35')]['find']({'where':{'id':_0x3aa189[_0xa3a0('0x33')]['id']}})[_0xa3a0('0x19')](handleEntityNotFound(_0x29c1b9,null))[_0xa3a0('0x19')](function(_0x5e7401){if(_0x5e7401){return _0x5e7401[_0xa3a0('0x34')](_0x3aa189[_0xa3a0('0x32')]['ids'],_[_0xa3a0('0x36')](_0x3aa189['body'],[_0xa3a0('0x37'),'id'])||{});}})['then'](respondWithResult(_0x29c1b9,null))[_0xa3a0('0x2a')](handleError(_0x29c1b9,null));};exports[_0xa3a0('0x38')]=function(_0x5d0162,_0x3d7ae4){var _0x31e242={'raw':![],'where':{}};var _0x56bcdc={};var _0xab700e={'count':0x0,'rows':[]};return db[_0xa3a0('0x21')]['findOne']({'where':{'id':_0x5d0162[_0xa3a0('0x33')]['id']}})[_0xa3a0('0x19')](handleEntityNotFound(_0x3d7ae4,null))[_0xa3a0('0x19')](function(_0x4aeff1){if(_0x4aeff1){_0x56bcdc[_0xa3a0('0x2b')]=_[_0xa3a0('0x2c')](db[_0xa3a0('0x35')][_0xa3a0('0x22')]);_0x56bcdc[_0xa3a0('0x28')]=_[_0xa3a0('0x2c')](_0x5d0162[_0xa3a0('0x28')]);_0x56bcdc['filters']=_[_0xa3a0('0x2e')](_0x56bcdc[_0xa3a0('0x2b')],_0x56bcdc['query']);_0x31e242[_0xa3a0('0x2d')]=_[_0xa3a0('0x2e')](_0x56bcdc['model'],qs['fields'](_0x5d0162[_0xa3a0('0x28')][_0xa3a0('0x39')]));_0x31e242['attributes']=_0x31e242['attributes']['length']?_0x31e242[_0xa3a0('0x2d')]:_0x56bcdc[_0xa3a0('0x2b')];if(!_0x5d0162[_0xa3a0('0x28')][_0xa3a0('0x3a')](_0xa3a0('0x3b'))){_0x31e242['limit']=qs['limit'](_0x5d0162['query'][_0xa3a0('0x14')]);_0x31e242['offset']=qs[_0xa3a0('0x13')](_0x5d0162[_0xa3a0('0x28')][_0xa3a0('0x13')]);}_0x31e242[_0xa3a0('0x3c')]=qs[_0xa3a0('0x3d')](_0x5d0162['query']['sort']);_0x31e242[_0xa3a0('0x3e')]=qs[_0xa3a0('0x3f')](_[_0xa3a0('0x40')](_0x5d0162[_0xa3a0('0x28')],_0x56bcdc[_0xa3a0('0x3f')]));_0x31e242[_0xa3a0('0x3e')][_0xa3a0('0x41')]=_0x4aeff1['id'];if(_0x5d0162['query']['filter']){_0x31e242['where']=_[_0xa3a0('0x30')](_0x31e242[_0xa3a0('0x3e')],{'$or':_[_0xa3a0('0x20')](_0x31e242[_0xa3a0('0x2d')],function(_0xe09df6){var _0x4731a5={};_0x4731a5[_0xe09df6]={'$like':'%'+_0x5d0162[_0xa3a0('0x28')][_0xa3a0('0x42')]+'%'};return _0x4731a5;})});}if(_0x5d0162['query']['$gte']){var _0x4d2990=_0x5d0162['query'][_0xa3a0('0x43')][_0xa3a0('0x44')](',');var _0x1dccf8={};_0x1dccf8[_0x4d2990[0x0]]={'$gte':moment(_0x4d2990[0x1])[_0xa3a0('0x45')](_0xa3a0('0x46'))};_0x31e242[_0xa3a0('0x3e')]=_['merge'](_0x31e242[_0xa3a0('0x3e')],_0x1dccf8);}_0x31e242=_[_0xa3a0('0x30')]({},_0x31e242,_0x5d0162[_0xa3a0('0x47')]);return db[_0xa3a0('0x35')][_0xa3a0('0x15')]({'where':_0x31e242['where']})[_0xa3a0('0x19')](function(_0x3936a3){_0xab700e[_0xa3a0('0x15')]=_0x3936a3;if(_0x5d0162['query'][_0xa3a0('0x2f')]){_0x31e242[_0xa3a0('0x48')]=[{'all':!![]}];}return db[_0xa3a0('0x35')][_0xa3a0('0x27')](_0x31e242);})[_0xa3a0('0x19')](function(_0x3e3a33){_0xab700e[_0xa3a0('0x49')]=_0x3e3a33;return _0xab700e;});}})['then'](respondWithFilteredResult(_0x3d7ae4,_0x31e242))[_0xa3a0('0x2a')](handleError(_0x3d7ae4,null));};exports[_0xa3a0('0x4a')]=function(_0x5db8ea,_0x2b89b3){return db[_0xa3a0('0x21')]['find']({'where':{'id':_0x5db8ea[_0xa3a0('0x33')]['id']}})[_0xa3a0('0x19')](handleEntityNotFound(_0x2b89b3,null))['then'](function(_0x327b73){if(_0x327b73){return _0x327b73[_0xa3a0('0x4b')](_0x5db8ea[_0xa3a0('0x32')][_0xa3a0('0x37')],_[_0xa3a0('0x36')](_0x5db8ea[_0xa3a0('0x32')],[_0xa3a0('0x37'),'id'])||{})[_0xa3a0('0x4c')](function(){return db[_0xa3a0('0x4d')][_0xa3a0('0x27')]({'attributes':['id',_0xa3a0('0x4e'),_0xa3a0('0x4f')],'where':{'id':_0x5db8ea[_0xa3a0('0x32')][_0xa3a0('0x37')]}});})['then'](function(_0x4c438c){socket[_0xa3a0('0x50')](_0xa3a0('0x51'),{'id':Number(_0x5db8ea[_0xa3a0('0x33')]['id']),'tags':_0x4c438c||[]});return{'id':Number(_0x5db8ea[_0xa3a0('0x33')]['id']),'tags':_0x4c438c||[]};});}})[_0xa3a0('0x19')](respondWithResult(_0x2b89b3,null))[_0xa3a0('0x2a')](handleError(_0x2b89b3,null));};exports[_0xa3a0('0x52')]=function(_0x528391,_0x573245){return db[_0xa3a0('0x21')][_0xa3a0('0x53')]({'where':{'id':_0x528391['params']['id']}})[_0xa3a0('0x19')](handleEntityNotFound(_0x573245,null))['then'](function(_0x5aa6dc){if(_0x5aa6dc){return _0x5aa6dc[_0xa3a0('0x52')](_0x528391[_0xa3a0('0x28')][_0xa3a0('0x37')]);}})[_0xa3a0('0x19')](respondWithStatusCode(_0x573245,null))[_0xa3a0('0x2a')](handleError(_0x573245,null));};exports[_0xa3a0('0x54')]=function(_0x2a6215,_0x3eb1df){var _0x1dc14c=moment()[_0xa3a0('0x55')]()[_0xa3a0('0x56')]();var _0x5ebda4=path[_0xa3a0('0x57')](config[_0xa3a0('0x58')],_0xa3a0('0x59'),'files',_0xa3a0('0x5a'));var _0x47eae4=path[_0xa3a0('0x57')](config[_0xa3a0('0x58')],_0xa3a0('0x59'),_0xa3a0('0x5b'),'attachments');var _0x5091a0=path[_0xa3a0('0x57')](_0x5ebda4,_0x1dc14c);var _0x3c6230=util[_0xa3a0('0x45')]('transcript-%d-%s.zip',_0x2a6215[_0xa3a0('0x33')]['id'],_0x1dc14c);var _0x138c7e=path['join'](_0x5ebda4,_0x3c6230);var _0x5293dd=[];_0x5293dd['push']({'model':db[_0xa3a0('0x5c')],'as':'Attachment','raw':!![]});var _0x2a70f7=[{'model':db[_0xa3a0('0x35')],'as':_0xa3a0('0x5d'),'attributes':['id',_0xa3a0('0x32'),_0xa3a0('0x5e')],'include':_0x5293dd}];return db[_0xa3a0('0x21')][_0xa3a0('0x53')]({'where':{'id':_0x2a6215[_0xa3a0('0x33')]['id']},'include':_0x2a70f7})['then'](handleEntityNotFound(_0x3eb1df,null))[_0xa3a0('0x19')](function(_0xa74bdf){if(_0xa74bdf&&_0xa74bdf[_0xa3a0('0x5d')]){var _0x265fa3=_0xa74bdf[_0xa3a0('0x5f')]({'plain':!![]});fs[_0xa3a0('0x60')](_0x5091a0);for(var _0x1cb808=0x0;_0x1cb808<_0x265fa3[_0xa3a0('0x5d')]['length'];_0x1cb808++){var _0x108d10=_0x265fa3['Messages'][_0x1cb808][_0xa3a0('0x5c')];if(_0x108d10){var _0x2d33ee=path[_0xa3a0('0x57')](_0x47eae4,_0x108d10[_0xa3a0('0x61')]);if(fs['existsSync'](_0x2d33ee)){fs[_0xa3a0('0x62')](_0x2d33ee)[_0xa3a0('0x63')](fs[_0xa3a0('0x64')](path[_0xa3a0('0x57')](_0x5091a0,_0x108d10['basename'])));}}}return BPromise[_0xa3a0('0x65')]()['then'](function(){return new BPromise(function(_0x401bdc,_0x28e9d5){zipdir(_0x5091a0,{'saveTo':_0x138c7e},function(_0x2be46c,_0x324bd7){if(_0x2be46c)return _0x28e9d5(_0x2be46c);return _0x401bdc(_0x324bd7);});})[_0xa3a0('0x19')](function(){return new BPromise(function(_0x3cc897,_0x576a87){rimraf(_0x5091a0,function(_0x24ff7f){if(_0x24ff7f)_0x576a87(_0x24ff7f);return _0x3cc897();});});})[_0xa3a0('0x19')](function(){return _0x3eb1df['download'](_0x138c7e,_0x3c6230,function(_0x421ed4){if(_0x421ed4){console[_0xa3a0('0x66')](_0xa3a0('0x67'),_0x421ed4);}else{fs[_0xa3a0('0x68')](_0x138c7e);}});});});}else{return _0x3eb1df[_0xa3a0('0x1c')](0xc8);}})[_0xa3a0('0x2a')](handleError(_0x3eb1df,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index f97f58c..786137e 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 _0xd902=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','catch','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update'];(function(_0x9df3d8,_0x4074e3){var _0x366da1=function(_0x5af940){while(--_0x5af940){_0x9df3d8['push'](_0x9df3d8['shift']());}};_0x366da1(++_0x4074e3);}(_0xd902,0x103));var _0x2d90=function(_0x3ab0f1,_0x31acba){_0x3ab0f1=_0x3ab0f1-0x0;var _0x2c2fb8=_0xd902[_0x3ab0f1];return _0x2c2fb8;};'use strict';var EventEmitter=require(_0x2d90('0x0'));var FaxInteraction=require(_0x2d90('0x1'))['db'][_0x2d90('0x2')];var FaxMessage=require(_0x2d90('0x1'))['db'][_0x2d90('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x2d90('0x4')](0x0);var events={'afterCreate':_0x2d90('0x5'),'afterUpdate':_0x2d90('0x6'),'afterDestroy':_0x2d90('0x7')};function emitEvent(_0x4111da){return function(_0x501bdd,_0x2742e9,_0xa4ca57){_0x501bdd[_0x2d90('0x8')]({'attributes':['id'],'raw':!![]})[_0x2d90('0x9')](function(_0xa20c71){_0x501bdd[_0x2d90('0xa')](_0x2d90('0xb'),_0xa20c71[_0x2d90('0xc')](function(_0x550c95){return{'id':_0x550c95['id']};}));return FaxMessage[_0x2d90('0xd')]({'where':{'FaxInteractionId':_0x501bdd['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d90('0x9')](function(_0x3c9bd6){_0x501bdd[_0x2d90('0xa')](_0x2d90('0xe'),_0x3c9bd6['length']);FaxInteractionEvents[_0x2d90('0xf')](_0x4111da+':'+_0x501bdd['id'],_0x501bdd);FaxInteractionEvents[_0x2d90('0xf')](_0x4111da,_0x501bdd);_0xa4ca57(null);})[_0x2d90('0x10')](_0xa4ca57(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x2d90('0x11')](e,emitEvent(event));}}module[_0x2d90('0x12')]=FaxInteractionEvents; \ No newline at end of file +var _0xef48=['Users','map','findAll','then','length','catch','hook','events','../../mysqldb','FaxInteraction','FaxMessage','save','remove','getUsers','setDataValue'];(function(_0x56c758,_0x540591){var _0x9bb0db=function(_0xdaa197){while(--_0xdaa197){_0x56c758['push'](_0x56c758['shift']());}};_0x9bb0db(++_0x540591);}(_0xef48,0x106));var _0x8ef4=function(_0x4c4e39,_0x4e9371){_0x4c4e39=_0x4c4e39-0x0;var _0xcdb411=_0xef48[_0x4c4e39];return _0xcdb411;};'use strict';var EventEmitter=require(_0x8ef4('0x0'));var FaxInteraction=require(_0x8ef4('0x1'))['db'][_0x8ef4('0x2')];var FaxMessage=require(_0x8ef4('0x1'))['db'][_0x8ef4('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8ef4('0x4'),'afterUpdate':'update','afterDestroy':_0x8ef4('0x5')};function emitEvent(_0x53a802){return function(_0x1e61b3,_0x1102b2,_0xdef961){_0x1e61b3[_0x8ef4('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3926c4){_0x1e61b3[_0x8ef4('0x7')](_0x8ef4('0x8'),_0x3926c4[_0x8ef4('0x9')](function(_0x293caa){return{'id':_0x293caa['id']};}));return FaxMessage[_0x8ef4('0xa')]({'where':{'FaxInteractionId':_0x1e61b3['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8ef4('0xb')](function(_0x3c9eb5){_0x1e61b3[_0x8ef4('0x7')]('unreadMessages',_0x3c9eb5[_0x8ef4('0xc')]);FaxInteractionEvents['emit'](_0x53a802+':'+_0x1e61b3['id'],_0x1e61b3);FaxInteractionEvents['emit'](_0x53a802,_0x1e61b3);_0xdef961(null);})[_0x8ef4('0xd')](_0xdef961(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x8ef4('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 133fa64..b7493c4 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 _0x252e=['moment','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x12551a,_0x5af080){var _0x6f8fc0=function(_0xe92756){while(--_0xe92756){_0x12551a['push'](_0x12551a['shift']());}};_0x6f8fc0(++_0x5af080);}(_0x252e,0x74));var _0xe252=function(_0x4011bf,_0x5ad0fa){_0x4011bf=_0x4011bf-0x0;var _0x50435a=_0x252e[_0x4011bf];return _0x50435a;};'use strict';var _=require('lodash');var util=require(_0xe252('0x0'));var logger=require(_0xe252('0x1'))(_0xe252('0x2'));var moment=require(_0xe252('0x3'));var BPromise=require('bluebird');var rp=require(_0xe252('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe252('0x5'));var config=require(_0xe252('0x6'));var attributes=require(_0xe252('0x7'));module[_0xe252('0x8')]=function(_0x4cf61c,_0x16900b){return _0x4cf61c[_0xe252('0x9')](_0xe252('0xa'),attributes,{'tableName':_0xe252('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x453f0e,_0x5a710c,_0x1ecbfa){if(_0x453f0e[_0xe252('0xc')](_0xe252('0xd'))){_0x453f0e[_0xe252('0xe')]=moment()[_0xe252('0xf')](_0xe252('0x10'));}_0x1ecbfa(null,_0x453f0e);}}});}; \ No newline at end of file +var _0x87bc=['request-promise','rimraf','define','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x3b66f3,_0x4f5cb3){var _0x129e24=function(_0x5ea919){while(--_0x5ea919){_0x3b66f3['push'](_0x3b66f3['shift']());}};_0x129e24(++_0x4f5cb3);}(_0x87bc,0x189));var _0xc87b=function(_0x41f0b4,_0x3a6d59){_0x41f0b4=_0x41f0b4-0x0;var _0x4cec86=_0x87bc[_0x41f0b4];return _0x4cec86;};'use strict';var _=require(_0xc87b('0x0'));var util=require(_0xc87b('0x1'));var logger=require('../../config/logger')(_0xc87b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc87b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc87b('0x4'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module['exports']=function(_0x1a2172,_0x1dfa75){return _0x1a2172[_0xc87b('0x5')]('FaxInteraction',attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4ed0c5,_0x1999f8,_0x169bbb){if(_0x4ed0c5[_0xc87b('0x6')](_0xc87b('0x7'))){_0x4ed0c5[_0xc87b('0x8')]=moment()[_0xc87b('0x9')](_0xc87b('0xa'));}_0x169bbb(null,_0x4ed0c5);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 13df573..a462c7f 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 _0xd9ee=['http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','error','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','update','body','options','raw','attributes','limit','then','debug','stringify','AddTagsToFaxInteraction','FaxInteraction','find','where','addTags','ids','omit','AddTags','lodash','util','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xd9ee,0x138));var _0xed9e=function(_0x1a226a,_0x5c1ef0){_0x1a226a=_0x1a226a-0x0;var _0x540a6f=_0xd9ee[_0x1a226a];return _0x540a6f;};'use strict';var _=require(_0xed9e('0x0'));var util=require(_0xed9e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xed9e('0x2'));var fs=require('fs');var Redis=require(_0xed9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed9e('0x4'));var config=require(_0xed9e('0x5'));var jayson=require(_0xed9e('0x6'));var client=jayson[_0xed9e('0x7')][_0xed9e('0x8')]({'port':0x232a});config[_0xed9e('0x9')]=_['defaults'](config[_0xed9e('0x9')],{'host':_0xed9e('0xa'),'port':0x18eb});var socket=require(_0xed9e('0xb'))(new Redis(config[_0xed9e('0x9')]));require(_0xed9e('0xc'))[_0xed9e('0xd')](socket);function respondWithRpcPromise(_0x11a813,_0x5d59e1,_0x36206b){return new BPromise(function(_0x31b096,_0x8eed36){return client[_0xed9e('0xe')](_0x11a813,_0x36206b)['then'](function(_0x1a2470){logger[_0xed9e('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5d59e1,_0xed9e('0x10'));logger['debug'](_0xed9e('0x11'),_0x5d59e1,_0xed9e('0x10'),JSON['stringify'](_0x1a2470));if(_0x1a2470[_0xed9e('0x12')]){if(_0x1a2470[_0xed9e('0x12')]['code']===0x1f4){logger[_0xed9e('0x12')](_0xed9e('0x13'),_0x5d59e1,_0x1a2470[_0xed9e('0x12')][_0xed9e('0x14')]);return _0x8eed36(_0x1a2470[_0xed9e('0x12')][_0xed9e('0x14')]);}logger[_0xed9e('0x12')](_0xed9e('0x13'),_0x5d59e1,_0x1a2470[_0xed9e('0x12')]['message']);return _0x31b096(_0x1a2470[_0xed9e('0x12')][_0xed9e('0x14')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5d59e1,_0xed9e('0x10'));_0x31b096(_0x1a2470[_0xed9e('0x15')]['message']);}})['catch'](function(_0x3e5433){logger[_0xed9e('0x12')]('FaxInteraction,\x20%s,\x20%s',_0x5d59e1,_0x3e5433);_0x8eed36(_0x3e5433);});});}exports[_0xed9e('0x16')]=function(_0x2f64b9){var _0x51fe3e=this;return new Promise(function(_0x1b1616,_0x221a67){return db['FaxInteraction'][_0xed9e('0x17')](_0x2f64b9[_0xed9e('0x18')],{'raw':_0x2f64b9['options']?_0x2f64b9[_0xed9e('0x19')][_0xed9e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f64b9[_0xed9e('0x19')]?_0x2f64b9['options']['where']||null:null,'attributes':_0x2f64b9[_0xed9e('0x19')]?_0x2f64b9['options'][_0xed9e('0x1b')]||null:null,'limit':_0x2f64b9[_0xed9e('0x19')]?_0x2f64b9[_0xed9e('0x19')][_0xed9e('0x1c')]||null:null})[_0xed9e('0x1d')](function(_0x3fbf14){logger[_0xed9e('0xf')]('UpdateFaxInteraction',_0x2f64b9);logger[_0xed9e('0x1e')](_0xed9e('0x16'),_0x2f64b9,JSON[_0xed9e('0x1f')](_0x3fbf14));_0x1b1616(_0x3fbf14);})['catch'](function(_0x2d8a06){logger['error'](_0xed9e('0x16'),_0x2d8a06[_0xed9e('0x14')],_0x2f64b9);_0x221a67(_0x51fe3e[_0xed9e('0x12')](0x1f4,_0x2d8a06[_0xed9e('0x14')]));});});};exports[_0xed9e('0x20')]=function(_0x55d35a){return new Promise(function(_0x4ca4af,_0x2d5c74){return db[_0xed9e('0x21')][_0xed9e('0x22')]({'where':_0x55d35a[_0xed9e('0x19')]?_0x55d35a[_0xed9e('0x19')][_0xed9e('0x23')]||null:null})[_0xed9e('0x1d')](function(_0x1a9df5){if(_0x1a9df5){return _0x1a9df5[_0xed9e('0x24')](_0x55d35a['body'][_0xed9e('0x25')],_[_0xed9e('0x26')](_0x55d35a[_0xed9e('0x18')],[_0xed9e('0x25'),'id'])||{});}})['spread'](function(_0x4e2437){logger[_0xed9e('0xf')](_0xed9e('0x27'),_0x55d35a);logger[_0xed9e('0x1e')](_0xed9e('0x27'),_0x55d35a,JSON[_0xed9e('0x1f')](_0x4e2437));_0x4ca4af(_0x4e2437);})['catch'](function(_0x24e940){logger[_0xed9e('0x12')]('AddTags',_0x24e940['message'],_0x55d35a);_0x2d5c74(_this[_0xed9e('0x12')](0x1f4,_0x24e940['message']));});});}; \ No newline at end of file +var _0x7f2f=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','limit','AddTagsToFaxInteraction','where','addTags','ids','spread','AddTags','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x54a9e3,_0x4a3813){var _0x247cce=function(_0x50aa49){while(--_0x50aa49){_0x54a9e3['push'](_0x54a9e3['shift']());}};_0x247cce(++_0x4a3813);}(_0x7f2f,0x97));var _0xf7f2=function(_0x4906ca,_0x7cb8c0){_0x4906ca=_0x4906ca-0x0;var _0x493642=_0x7f2f[_0x4906ca];return _0x493642;};'use strict';var _=require('lodash');var util=require(_0xf7f2('0x0'));var moment=require(_0xf7f2('0x1'));var BPromise=require(_0xf7f2('0x2'));var rs=require(_0xf7f2('0x3'));var fs=require('fs');var Redis=require(_0xf7f2('0x4'));var db=require(_0xf7f2('0x5'))['db'];var utils=require(_0xf7f2('0x6'));var logger=require(_0xf7f2('0x7'))(_0xf7f2('0x8'));var config=require(_0xf7f2('0x9'));var jayson=require(_0xf7f2('0xa'));var client=jayson[_0xf7f2('0xb')][_0xf7f2('0xc')]({'port':0x232a});config[_0xf7f2('0xd')]=_[_0xf7f2('0xe')](config[_0xf7f2('0xd')],{'host':_0xf7f2('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf7f2('0xd')]));require('./faxInteraction.socket')[_0xf7f2('0x10')](socket);function respondWithRpcPromise(_0x152713,_0x3587b0,_0x1657a4){return new BPromise(function(_0x3ac489,_0x1fa680){return client['request'](_0x152713,_0x1657a4)[_0xf7f2('0x11')](function(_0x4140f3){logger[_0xf7f2('0x12')](_0xf7f2('0x13'),_0x3587b0,_0xf7f2('0x14'));logger[_0xf7f2('0x15')](_0xf7f2('0x16'),_0x3587b0,_0xf7f2('0x14'),JSON['stringify'](_0x4140f3));if(_0x4140f3[_0xf7f2('0x17')]){if(_0x4140f3['error'][_0xf7f2('0x18')]===0x1f4){logger[_0xf7f2('0x17')](_0xf7f2('0x13'),_0x3587b0,_0x4140f3['error'][_0xf7f2('0x19')]);return _0x1fa680(_0x4140f3['error']['message']);}logger[_0xf7f2('0x17')](_0xf7f2('0x13'),_0x3587b0,_0x4140f3['error'][_0xf7f2('0x19')]);return _0x3ac489(_0x4140f3[_0xf7f2('0x17')][_0xf7f2('0x19')]);}else{logger['info'](_0xf7f2('0x13'),_0x3587b0,_0xf7f2('0x14'));_0x3ac489(_0x4140f3['result'][_0xf7f2('0x19')]);}})[_0xf7f2('0x1a')](function(_0x54a0df){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x3587b0,_0x54a0df);_0x1fa680(_0x54a0df);});});}exports[_0xf7f2('0x1b')]=function(_0x3b4829){var _0x4360f1=this;return new Promise(function(_0x323857,_0x345619){return db[_0xf7f2('0x1c')]['update'](_0x3b4829[_0xf7f2('0x1d')],{'raw':_0x3b4829[_0xf7f2('0x1e')]?_0x3b4829[_0xf7f2('0x1e')][_0xf7f2('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b4829[_0xf7f2('0x1e')]?_0x3b4829[_0xf7f2('0x1e')]['where']||null:null,'attributes':_0x3b4829[_0xf7f2('0x1e')]?_0x3b4829[_0xf7f2('0x1e')]['attributes']||null:null,'limit':_0x3b4829['options']?_0x3b4829['options'][_0xf7f2('0x20')]||null:null})[_0xf7f2('0x11')](function(_0x169924){logger[_0xf7f2('0x12')]('UpdateFaxInteraction',_0x3b4829);logger[_0xf7f2('0x15')](_0xf7f2('0x1b'),_0x3b4829,JSON['stringify'](_0x169924));_0x323857(_0x169924);})[_0xf7f2('0x1a')](function(_0x298e80){logger['error']('UpdateFaxInteraction',_0x298e80[_0xf7f2('0x19')],_0x3b4829);_0x345619(_0x4360f1[_0xf7f2('0x17')](0x1f4,_0x298e80[_0xf7f2('0x19')]));});});};exports[_0xf7f2('0x21')]=function(_0x5fc893){return new Promise(function(_0x416d79,_0x30a2a9){return db[_0xf7f2('0x1c')]['find']({'where':_0x5fc893['options']?_0x5fc893[_0xf7f2('0x1e')][_0xf7f2('0x22')]||null:null})[_0xf7f2('0x11')](function(_0x435ab1){if(_0x435ab1){return _0x435ab1[_0xf7f2('0x23')](_0x5fc893[_0xf7f2('0x1d')][_0xf7f2('0x24')],_['omit'](_0x5fc893['body'],[_0xf7f2('0x24'),'id'])||{});}})[_0xf7f2('0x25')](function(_0x4ad2dd){logger[_0xf7f2('0x12')](_0xf7f2('0x26'),_0x5fc893);logger[_0xf7f2('0x15')](_0xf7f2('0x26'),_0x5fc893,JSON[_0xf7f2('0x27')](_0x4ad2dd));_0x416d79(_0x4ad2dd);})[_0xf7f2('0x1a')](function(_0x310dcb){logger[_0xf7f2('0x17')](_0xf7f2('0x26'),_0x310dcb['message'],_0x5fc893);_0x30a2a9(_this[_0xf7f2('0x17')](0x1f4,_0x310dcb[_0xf7f2('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index c811566..5a31838 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 _0xf5bc=['faxInteraction:','./faxInteraction.events','save','update','emit','removeListener','register','length'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xf5bc,0x181));var _0xcf5b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xf5bc[_0x3bf83f];return _0x22c4a9;};'use strict';var FaxInteractionEvents=require(_0xcf5b('0x0'));var events=[_0xcf5b('0x1'),'remove',_0xcf5b('0x2')];function createListener(_0x1e7068,_0x3fcac1){return function(_0x11e45c){_0x3fcac1[_0xcf5b('0x3')](_0x1e7068,_0x11e45c);};}function removeListener(_0x2a981b,_0x5476b4){return function(){FaxInteractionEvents[_0xcf5b('0x4')](_0x2a981b,_0x5476b4);};}exports[_0xcf5b('0x5')]=function(_0x125b08){for(var _0x341b86=0x0,_0x2c1607=events[_0xcf5b('0x6')];_0x341b86<_0x2c1607;_0x341b86++){var _0x364b79=events[_0x341b86];var _0x9ee919=createListener(_0xcf5b('0x7')+_0x364b79,_0x125b08);FaxInteractionEvents['on'](_0x364b79,_0x9ee919);}}; \ No newline at end of file +var _0x15f5=['remove','update','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x3df3ea,_0x2ba8b9){var _0x24ef0c=function(_0x5d9c5c){while(--_0x5d9c5c){_0x3df3ea['push'](_0x3df3ea['shift']());}};_0x24ef0c(++_0x2ba8b9);}(_0x15f5,0x9f));var _0x515f=function(_0x2a3f8d,_0x3e37a1){_0x2a3f8d=_0x2a3f8d-0x0;var _0x563d29=_0x15f5[_0x2a3f8d];return _0x563d29;};'use strict';var FaxInteractionEvents=require(_0x515f('0x0'));var events=['save',_0x515f('0x1'),_0x515f('0x2')];function createListener(_0x70b6d0,_0x3fee0a){return function(_0x40e85b){_0x3fee0a[_0x515f('0x3')](_0x70b6d0,_0x40e85b);};}function removeListener(_0x1fe040,_0x53d459){return function(){FaxInteractionEvents[_0x515f('0x4')](_0x1fe040,_0x53d459);};}exports[_0x515f('0x5')]=function(_0x3bac94){for(var _0x237d26=0x0,_0x438bc1=events[_0x515f('0x6')];_0x237d26<_0x438bc1;_0x237d26++){var _0x3a903e=events[_0x237d26];var _0x1de085=createListener(_0x515f('0x7')+_0x3a903e,_0x3bac94);FaxInteractionEvents['on'](_0x3a903e,_0x1de085);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 1a9eb9b..990d5ff 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 _0xfae1=['put','update','delete','faxinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','index','get','/describe','/:id','/:id/download','download','create','post','/:id/tags','tracked','fax','faxinteraction:addtags','addTags'];(function(_0x12decd,_0xc24bce){var _0x2485a0=function(_0x4ca181){while(--_0x4ca181){_0x12decd['push'](_0x12decd['shift']());}};_0x2485a0(++_0xc24bce);}(_0xfae1,0x16e));var _0x1fae=function(_0x511efb,_0x3dcbd7){_0x511efb=_0x511efb-0x0;var _0xa423d2=_0xfae1[_0x511efb];return _0xa423d2;};'use strict';var multer=require(_0x1fae('0x0'));var util=require(_0x1fae('0x1'));var path=require(_0x1fae('0x2'));var timeout=require(_0x1fae('0x3'));var express=require(_0x1fae('0x4'));var router=express[_0x1fae('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x1fae('0x6'));var interaction=require(_0x1fae('0x7'));var config=require(_0x1fae('0x8'));var controller=require(_0x1fae('0x9'));router['get']('/',auth[_0x1fae('0xa')](),controller[_0x1fae('0xb')]);router[_0x1fae('0xc')](_0x1fae('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x1fae('0xc')](_0x1fae('0xe'),auth[_0x1fae('0xa')](),controller['show']);router['get']('/:id/messages',auth[_0x1fae('0xa')](),controller['getMessages']);router[_0x1fae('0xc')](_0x1fae('0xf'),auth[_0x1fae('0xa')](),controller[_0x1fae('0x10')]);router['post']('/',auth[_0x1fae('0xa')](),controller[_0x1fae('0x11')]);router[_0x1fae('0x12')]('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router[_0x1fae('0x12')](_0x1fae('0x13'),auth[_0x1fae('0xa')](),interaction[_0x1fae('0x14')](_0x1fae('0x15'),_0x1fae('0x16')),controller[_0x1fae('0x17')]);router[_0x1fae('0x18')]('/:id',auth[_0x1fae('0xa')](),interaction[_0x1fae('0x14')](_0x1fae('0x15'),'faxinteraction:update'),controller[_0x1fae('0x19')]);router[_0x1fae('0x1a')]('/:id',auth['isAuthenticated'](),interaction[_0x1fae('0x14')](_0x1fae('0x15'),_0x1fae('0x1b')),controller['destroy']);router[_0x1fae('0x1a')](_0x1fae('0x13'),auth['isAuthenticated'](),controller[_0x1fae('0x1c')]);module[_0x1fae('0x1d')]=router; \ No newline at end of file +var _0x6f74=['delete','faxinteraction:destroy','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','faxinteraction:update','update'];(function(_0x1465ee,_0x4fd0fc){var _0x4526d1=function(_0x4d975a){while(--_0x4d975a){_0x1465ee['push'](_0x1465ee['shift']());}};_0x4526d1(++_0x4fd0fc);}(_0x6f74,0x16f));var _0x46f7=function(_0x399bb9,_0x3aafa8){_0x399bb9=_0x399bb9-0x0;var _0x2c53be=_0x6f74[_0x399bb9];return _0x2c53be;};'use strict';var multer=require(_0x46f7('0x0'));var util=require(_0x46f7('0x1'));var path=require('path');var timeout=require(_0x46f7('0x2'));var express=require(_0x46f7('0x3'));var router=express[_0x46f7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46f7('0x5'));var interaction=require(_0x46f7('0x6'));var config=require('../../config/environment');var controller=require(_0x46f7('0x7'));router[_0x46f7('0x8')]('/',auth['isAuthenticated'](),controller[_0x46f7('0x9')]);router['get'](_0x46f7('0xa'),auth[_0x46f7('0xb')](),controller[_0x46f7('0xc')]);router[_0x46f7('0x8')](_0x46f7('0xd'),auth[_0x46f7('0xb')](),controller[_0x46f7('0xe')]);router[_0x46f7('0x8')]('/:id/messages',auth[_0x46f7('0xb')](),controller[_0x46f7('0xf')]);router['get'](_0x46f7('0x10'),auth[_0x46f7('0xb')](),controller[_0x46f7('0x11')]);router[_0x46f7('0x12')]('/',auth[_0x46f7('0xb')](),controller[_0x46f7('0x13')]);router[_0x46f7('0x12')](_0x46f7('0x14'),auth[_0x46f7('0xb')](),controller[_0x46f7('0x15')]);router[_0x46f7('0x12')](_0x46f7('0x16'),auth[_0x46f7('0xb')](),interaction[_0x46f7('0x17')](_0x46f7('0x18'),_0x46f7('0x19')),controller[_0x46f7('0x1a')]);router['put']('/:id',auth[_0x46f7('0xb')](),interaction[_0x46f7('0x17')](_0x46f7('0x18'),_0x46f7('0x1b')),controller[_0x46f7('0x1c')]);router[_0x46f7('0x1d')](_0x46f7('0xd'),auth[_0x46f7('0xb')](),interaction[_0x46f7('0x17')](_0x46f7('0x18'),_0x46f7('0x1e')),controller['destroy']);router[_0x46f7('0x1d')](_0x46f7('0x16'),auth['isAuthenticated'](),controller[_0x46f7('0x1f')]);module[_0x46f7('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index ac8d113..2d5fcf1 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 _0x2fed=['TEXT','medium','BOOLEAN','out','sequelize','exports'];(function(_0x527939,_0x32c1b2){var _0x3d21b3=function(_0x3c7e48){while(--_0x3c7e48){_0x527939['push'](_0x527939['shift']());}};_0x3d21b3(++_0x32c1b2);}(_0x2fed,0x7c));var _0xd2fe=function(_0x22249e,_0x59a2f3){_0x22249e=_0x22249e-0x0;var _0x4a9a30=_0x2fed[_0x22249e];return _0x4a9a30;};'use strict';var Sequelize=require(_0xd2fe('0x0'));module[_0xd2fe('0x1')]={'body':{'type':Sequelize[_0xd2fe('0x2')](_0xd2fe('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd2fe('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd2fe('0x5')),'defaultValue':_0xd2fe('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xf25a=['exports','TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x2ff5b1,_0x52b88c){var _0xd4438=function(_0x45039f){while(--_0x45039f){_0x2ff5b1['push'](_0x2ff5b1['shift']());}};_0xd4438(++_0x52b88c);}(_0xf25a,0x195));var _0xaf25=function(_0x57a747,_0x501377){_0x57a747=_0x57a747-0x0;var _0x2a1dc8=_0xf25a[_0x57a747];return _0x2a1dc8;};'use strict';var Sequelize=require(_0xaf25('0x0'));module[_0xaf25('0x1')]={'body':{'type':Sequelize[_0xaf25('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaf25('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaf25('0x4')]('in',_0xaf25('0x5')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0xaf25('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xaf25('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 8c723e3..7b5e269 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 _0x0441=['name','send','index','map','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','VIRTUAL','merge','options','FaxMessage','includeAll','findAll','rows','show','params','include','find','update','body','destroy','describe','accept','fax','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','FaxInteractionId','format','interaction','get','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','EventManager','fax-interactions','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','motionChannel','event','create','CmContact','findOne','isNil','Attachment','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','zip-dir','moment','mustache','lodash','squel','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','limit','count','offset','set','Content-Range','apply','reject','save','then','end','stack'];(function(_0xa3f3e9,_0x530c20){var _0x5c21d4=function(_0x1b51e7){while(--_0x1b51e7){_0xa3f3e9['push'](_0xa3f3e9['shift']());}};_0x5c21d4(++_0x530c20);}(_0x0441,0xd3));var _0x1044=function(_0x28fbe3,_0x4ac6f8){_0x28fbe3=_0x28fbe3-0x0;var _0x45db6a=_0x0441[_0x28fbe3];return _0x45db6a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1044('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1044('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x1044('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1044('0x3'));var squel=require(_0x1044('0x4'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x1044('0x5'));var toCsv=require(_0x1044('0x6'));var querystring=require('querystring');var Papa=require(_0x1044('0x7'));var Redis=require(_0x1044('0x8'));var authService=require(_0x1044('0x9'));var qs=require(_0x1044('0xa'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1044('0xb'))(_0x1044('0xc'));var utils=require(_0x1044('0xd'));var config=require(_0x1044('0xe'));var licenseUtil=require(_0x1044('0xf'));var db=require(_0x1044('0x10'))['db'];config[_0x1044('0x11')]=_[_0x1044('0x12')](config[_0x1044('0x11')],{'host':_0x1044('0x13'),'port':0x18eb});var socket=require(_0x1044('0x14'))(new Redis(config['redis']));require(_0x1044('0x15'))[_0x1044('0x16')](socket);var jayson=require('jayson/promise');var client=jayson[_0x1044('0x17')]['http']({'port':0x232c});var client9002=jayson[_0x1044('0x17')][_0x1044('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3ed028,_0x47e580,_0x53e8a6,_0x36e2aa){return new BPromise(function(_0x2f985b,_0x267341){var _0x2186e7=_0x36e2aa||client;return _0x2186e7[_0x1044('0x19')](_0x3ed028,_0x53e8a6)['then'](function(_0x160a31){logger[_0x1044('0x1a')](_0x1044('0x1b'),_0x47e580,_0x1044('0x1c'));logger[_0x1044('0x1d')](_0x1044('0x1e'),_0x47e580,_0x1044('0x1c'),JSON[_0x1044('0x1f')](_0x160a31));if(_0x160a31['error']){if(_0x160a31[_0x1044('0x20')]['code']===0x1f4){logger[_0x1044('0x20')](_0x1044('0x1b'),_0x47e580,_0x160a31['error'][_0x1044('0x21')]);return _0x267341(_0x160a31['error'][_0x1044('0x21')]);}logger[_0x1044('0x20')](_0x1044('0x1b'),_0x47e580,_0x160a31[_0x1044('0x20')][_0x1044('0x21')]);return _0x2f985b(_0x160a31[_0x1044('0x20')][_0x1044('0x21')]);}else{logger[_0x1044('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x47e580,_0x1044('0x1c'));_0x2f985b(_0x160a31[_0x1044('0x22')][_0x1044('0x21')]);}})[_0x1044('0x23')](function(_0x8008e7){logger['error'](_0x1044('0x1b'),_0x47e580,_0x8008e7);_0x267341(_0x8008e7);});});}function respondWithStatusCode(_0xb5fd1e,_0x151ca4){_0x151ca4=_0x151ca4||0xcc;return function(_0x3925ae){if(_0x3925ae){return _0xb5fd1e[_0x1044('0x24')](_0x151ca4);}return _0xb5fd1e[_0x1044('0x25')](_0x151ca4)['end']();};}function respondWithResult(_0x3c2b9a,_0x5a147c){_0x5a147c=_0x5a147c||0xc8;return function(_0x3c81e2){if(_0x3c81e2){return _0x3c2b9a[_0x1044('0x25')](_0x5a147c)['json'](_0x3c81e2);}};}function respondWithFilteredResult(_0x16f8f4,_0x12a69c){return function(_0x3e8c83){if(_0x3e8c83){var _0xa0eaf7=typeof _0x12a69c['offset']==='undefined'&&typeof _0x12a69c[_0x1044('0x26')]==='undefined';var _0xd907f6=_0x3e8c83[_0x1044('0x27')];var _0x5cd865=_0xa0eaf7?0x0:_0x12a69c[_0x1044('0x28')];var _0x295b9f=_0xa0eaf7?_0x3e8c83[_0x1044('0x27')]:_0x12a69c[_0x1044('0x28')]+_0x12a69c[_0x1044('0x26')];var _0x42a617;if(_0x295b9f>=_0xd907f6){_0x295b9f=_0xd907f6;_0x42a617=0xc8;}else{_0x42a617=0xce;}_0x16f8f4[_0x1044('0x25')](_0x42a617);return _0x16f8f4[_0x1044('0x29')](_0x1044('0x2a'),_0x5cd865+'-'+_0x295b9f+'/'+_0xd907f6)['json'](_0x3e8c83);}return null;};}function patchUpdates(_0x3de7b2){return function(_0x598b98){try{jsonpatch[_0x1044('0x2b')](_0x598b98,_0x3de7b2,!![]);}catch(_0x489952){return BPromise[_0x1044('0x2c')](_0x489952);}return _0x598b98[_0x1044('0x2d')]();};}function saveUpdates(_0x399b2d,_0x1b73ac){return function(_0x55b15b){if(_0x55b15b){return _0x55b15b['update'](_0x399b2d)[_0x1044('0x2e')](function(_0x5d0b2e){return _0x5d0b2e;});}return null;};}function removeEntity(_0x50e6d6,_0x1f23cb){return function(_0x353c5d){if(_0x353c5d){return _0x353c5d['destroy']()[_0x1044('0x2e')](function(){_0x50e6d6['status'](0xcc)[_0x1044('0x2f')]();});}};}function handleEntityNotFound(_0x4ecf0f,_0x3e4470){return function(_0x5c5cb6){if(!_0x5c5cb6){_0x4ecf0f[_0x1044('0x24')](0x194);}return _0x5c5cb6;};}function handleError(_0x4c16f6,_0x46ff03){_0x46ff03=_0x46ff03||0x1f4;return function(_0x1dad64){logger['error'](_0x1dad64[_0x1044('0x30')]);if(_0x1dad64[_0x1044('0x31')]){delete _0x1dad64[_0x1044('0x31')];}_0x4c16f6[_0x1044('0x25')](_0x46ff03)[_0x1044('0x32')](_0x1dad64);};}exports[_0x1044('0x33')]=function(_0x45664a,_0x464b77){var _0x134c18={},_0x4a02a3={},_0x5d1b71={'count':0x0,'rows':[]};var _0x1d1278=_[_0x1044('0x34')](db['FaxMessage']['rawAttributes'],function(_0x361387){return{'name':_0x361387['fieldName'],'type':_0x361387[_0x1044('0x35')][_0x1044('0x36')]};});_0x4a02a3[_0x1044('0x37')]=_[_0x1044('0x34')](_0x1d1278,_0x1044('0x31'));_0x4a02a3['query']=_[_0x1044('0x38')](_0x45664a[_0x1044('0x39')]);_0x4a02a3['filters']=_[_0x1044('0x3a')](_0x4a02a3['model'],_0x4a02a3[_0x1044('0x39')]);_0x134c18[_0x1044('0x3b')]=_[_0x1044('0x3a')](_0x4a02a3[_0x1044('0x37')],qs[_0x1044('0x3c')](_0x45664a[_0x1044('0x39')]['fields']));_0x134c18['attributes']=_0x134c18[_0x1044('0x3b')][_0x1044('0x3d')]?_0x134c18[_0x1044('0x3b')]:_0x4a02a3['model'];if(!_0x45664a[_0x1044('0x39')][_0x1044('0x3e')](_0x1044('0x3f'))){_0x134c18['limit']=qs[_0x1044('0x26')](_0x45664a[_0x1044('0x39')]['limit']);_0x134c18[_0x1044('0x28')]=qs['offset'](_0x45664a['query']['offset']);}_0x134c18['order']=qs[_0x1044('0x40')](_0x45664a[_0x1044('0x39')][_0x1044('0x40')]);_0x134c18[_0x1044('0x41')]=qs[_0x1044('0x42')](_['pick'](_0x45664a[_0x1044('0x39')],_0x4a02a3[_0x1044('0x42')]),_0x1d1278);if(_0x45664a[_0x1044('0x39')]['filter']){_0x134c18[_0x1044('0x41')]=_['merge'](_0x134c18[_0x1044('0x41')],{'$or':_[_0x1044('0x34')](_0x1d1278,function(_0x3e1075){if(_0x3e1075[_0x1044('0x35')]!==_0x1044('0x43')){var _0x3ea6c6={};_0x3ea6c6[_0x3e1075[_0x1044('0x31')]]={'$like':'%'+_0x45664a['query']['filter']+'%'};return _0x3ea6c6;}})});}_0x134c18=_[_0x1044('0x44')]({},_0x134c18,_0x45664a[_0x1044('0x45')]);var _0x596ae4={'where':_0x134c18[_0x1044('0x41')]};return db[_0x1044('0x46')][_0x1044('0x27')](_0x596ae4)[_0x1044('0x2e')](function(_0x4dfd95){_0x5d1b71['count']=_0x4dfd95;if(_0x45664a['query'][_0x1044('0x47')]){_0x134c18['include']=[{'all':!![]}];}return db[_0x1044('0x46')][_0x1044('0x48')](_0x134c18);})[_0x1044('0x2e')](function(_0x427f58){_0x5d1b71[_0x1044('0x49')]=_0x427f58;return _0x5d1b71;})[_0x1044('0x2e')](respondWithFilteredResult(_0x464b77,_0x134c18))['catch'](handleError(_0x464b77,null));};exports[_0x1044('0x4a')]=function(_0x5646c1,_0x4a5a77){var _0x7a743c={'raw':!![],'where':{'id':_0x5646c1[_0x1044('0x4b')]['id']}},_0x285e32={};_0x285e32['model']=_['keys'](db[_0x1044('0x46')]['rawAttributes']);_0x285e32[_0x1044('0x39')]=_[_0x1044('0x38')](_0x5646c1[_0x1044('0x39')]);_0x285e32['filters']=_[_0x1044('0x3a')](_0x285e32[_0x1044('0x37')],_0x285e32[_0x1044('0x39')]);_0x7a743c['attributes']=_[_0x1044('0x3a')](_0x285e32[_0x1044('0x37')],qs[_0x1044('0x3c')](_0x5646c1[_0x1044('0x39')][_0x1044('0x3c')]));_0x7a743c[_0x1044('0x3b')]=_0x7a743c[_0x1044('0x3b')]['length']?_0x7a743c[_0x1044('0x3b')]:_0x285e32['model'];if(_0x5646c1[_0x1044('0x39')][_0x1044('0x47')]){_0x7a743c[_0x1044('0x4c')]=[{'all':!![]}];}_0x7a743c=_[_0x1044('0x44')]({},_0x7a743c,_0x5646c1['options']);return db[_0x1044('0x46')][_0x1044('0x4d')](_0x7a743c)[_0x1044('0x2e')](handleEntityNotFound(_0x4a5a77,null))[_0x1044('0x2e')](respondWithResult(_0x4a5a77,null))[_0x1044('0x23')](handleError(_0x4a5a77,null));};exports[_0x1044('0x4e')]=function(_0x2e3ff0,_0x49731b){if(_0x2e3ff0[_0x1044('0x4f')]['id']){delete _0x2e3ff0[_0x1044('0x4f')]['id'];}return db[_0x1044('0x46')][_0x1044('0x4d')]({'where':{'id':_0x2e3ff0[_0x1044('0x4b')]['id']}})[_0x1044('0x2e')](handleEntityNotFound(_0x49731b,null))[_0x1044('0x2e')](saveUpdates(_0x2e3ff0[_0x1044('0x4f')],null))[_0x1044('0x2e')](respondWithResult(_0x49731b,null))[_0x1044('0x23')](handleError(_0x49731b,null));};exports[_0x1044('0x50')]=function(_0x29df76,_0x43e06c){return db[_0x1044('0x46')]['find']({'where':{'id':_0x29df76['params']['id']}})[_0x1044('0x2e')](handleEntityNotFound(_0x43e06c,null))[_0x1044('0x2e')](removeEntity(_0x43e06c,null))['catch'](handleError(_0x43e06c,null));};exports[_0x1044('0x51')]=function(_0x2b43c8,_0x589203){return db[_0x1044('0x46')][_0x1044('0x51')]()[_0x1044('0x2e')](respondWithResult(_0x589203,null))[_0x1044('0x23')](handleError(_0x589203,null));};var interaction_log=require(_0x1044('0xb'))('fax-interactions');exports[_0x1044('0x52')]=function(_0x263894,_0x427b9a,_0x9ea5d3){var _0xcb7ad3={'agent':{},'channel':_0x1044('0x53')};if(_0x263894[_0x1044('0x4f')]['id']){delete _0x263894[_0x1044('0x4f')]['id'];}_0x263894[_0x1044('0x4f')][_0x1044('0x54')]=!![];_0x263894[_0x1044('0x4f')]['readAt']=moment()['format'](_0x1044('0x55'));_0x263894[_0x1044('0x4f')]['UserId']=_0x263894[_0x1044('0x4f')][_0x1044('0x56')]||_0x263894[_0x1044('0x57')]['id'];_0xcb7ad3[_0x1044('0x58')]['id']=_0x263894[_0x1044('0x4f')][_0x1044('0x56')];return db['FaxMessage'][_0x1044('0x4d')]({'where':{'id':_0x263894[_0x1044('0x4b')]['id'],'UserId':null}})[_0x1044('0x2e')](handleEntityNotFound(_0x427b9a,null))[_0x1044('0x2e')](saveUpdates(_0x263894['body'],null))[_0x1044('0x2e')](function(_0x34c476){if(_0x34c476){_0xcb7ad3[_0x1044('0x21')]=_0x34c476['get']({'plain':!![]});return db['FaxInteraction'][_0x1044('0x4d')]({'where':{'id':_0x34c476[_0x1044('0x59')]}});}return null;})[_0x1044('0x2e')](handleEntityNotFound(_0x427b9a,null))[_0x1044('0x2e')](function(_0x249926){if(_0x249926){return _0x249926[_0x1044('0x4e')]({'UserId':_0x263894[_0x1044('0x4f')][_0x1044('0x56')],'read1stAt':_['isNil'](_0x249926['read1stAt'])?moment()[_0x1044('0x5a')](_0x1044('0x55')):undefined});}return null;})[_0x1044('0x2e')](function(_0x359052){if(_0x359052){_0xcb7ad3[_0x1044('0x5b')]=_0x359052[_0x1044('0x5c')]({'plain':!![]});interaction_log[_0x1044('0x1a')]('[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x263894[_0x1044('0x57')]['id'],_0x263894['user']['name'],_0x263894[_0x1044('0x57')][_0x1044('0x5d')],_0xcb7ad3[_0x1044('0x5b')]['id'],_0x263894['body']?JSON[_0x1044('0x1f')](_0x263894[_0x1044('0x4f')]):_0x1044('0x5e'));return respondWithRpcPromise(_0x1044('0x5f'),_0x1044('0x60'),_0xcb7ad3);}return null;})['then'](function(_0x37cac8){var _0x4cf0b1='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37cac8['message'][_0x1044('0x61')];return db[_0x1044('0x62')]['query'](_0x4cf0b1,{'type':db[_0x1044('0x63')]['QueryTypes'][_0x1044('0x64')],'raw':!![]})[_0x1044('0x2e')](function(_0x28d606){return _0x28d606;});})[_0x1044('0x2e')](function(_0xc3ace1){if(_0xc3ace1){_0xcb7ad3[_0x1044('0x21')][_0x1044('0x65')]=_0xc3ace1[0x0];if(!_0x263894['body'][_0x1044('0x56')])return;return db[_0x1044('0x66')]['find']({'where':{'id':_0x263894['body'][_0x1044('0x56')],'role':'agent'},'attributes':['id',_0x1044('0x31'),_0x1044('0x67'),_0x1044('0x68'),_0x1044('0x69')],'raw':!![]});}return null;})[_0x1044('0x2e')](function(_0x792992){if(!_0x792992)return null;_0xcb7ad3[_0x1044('0x21')]['agent']=_0x792992;return _0xcb7ad3;})[_0x1044('0x2e')](function(_0x33b734){if(_0x33b734){if(_0x263894['body'][_0x1044('0x6a')]){_0xcb7ad3['message']['interface']=util['format'](_0x1044('0x6b'),_0x263894[_0x1044('0x57')][_0x1044('0x31')]);_0xcb7ad3['message']['channel']=_0xcb7ad3[_0x1044('0x6c')];_0xcb7ad3[_0x1044('0x21')]['motionChannel']=_0xcb7ad3['channel'];_0xcb7ad3['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x1044('0x6d'),{'event':'acceptmessage','message':_0xcb7ad3[_0x1044('0x21')]},client9002)[_0x1044('0x2e')](function(){return _0xcb7ad3;});}return _0xcb7ad3;}return null;})[_0x1044('0x2e')](respondWithResult(_0x427b9a,null))[_0x1044('0x23')](handleError(_0x427b9a,null));};var interaction_log=require(_0x1044('0xb'))(_0x1044('0x6e'));exports[_0x1044('0x2c')]=function(_0x16b961,_0x382981,_0x462e7c){var _0x213062={'agent':{},'channel':_0x1044('0x53')};if(_0x16b961['body']['id']){delete _0x16b961['body']['id'];}_0x16b961[_0x1044('0x4f')][_0x1044('0x56')]=_0x16b961[_0x1044('0x4f')][_0x1044('0x56')]||_0x16b961[_0x1044('0x57')]['id'];_0x213062[_0x1044('0x58')]['id']=_0x16b961[_0x1044('0x4f')]['UserId'];return db[_0x1044('0x46')]['find']({'where':{'id':_0x16b961[_0x1044('0x4b')]['id'],'UserId':null}})[_0x1044('0x2e')](handleEntityNotFound(_0x382981,null))[_0x1044('0x2e')](function(_0x1e6db2){if(_0x1e6db2){_0x213062['message']=_0x1e6db2[_0x1044('0x5c')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x1e6db2['FaxInteractionId']}});}return null;})[_0x1044('0x2e')](handleEntityNotFound(_0x382981,null))['then'](function(_0x3c4188){if(_0x3c4188){_0x213062[_0x1044('0x5b')]=_0x3c4188[_0x1044('0x5c')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x16b961[_0x1044('0x57')]['id'],_0x16b961[_0x1044('0x57')][_0x1044('0x31')],_0x16b961[_0x1044('0x57')][_0x1044('0x5d')],_0x213062['interaction']['id'],_0x16b961[_0x1044('0x4f')]?JSON[_0x1044('0x1f')](_0x16b961[_0x1044('0x4f')]):_0x1044('0x5e'));return respondWithRpcPromise(_0x1044('0x6f'),'rejectMessage',_0x213062);}return null;})[_0x1044('0x2e')](function(_0xa8bdac){var _0x225d0c=_0x1044('0x70')+_0xa8bdac[_0x1044('0x21')][_0x1044('0x61')];return db[_0x1044('0x62')][_0x1044('0x39')](_0x225d0c,{'type':db['Sequelize'][_0x1044('0x71')]['SELECT'],'raw':!![]})['then'](function(_0x5624b5){return _0x5624b5;});})[_0x1044('0x2e')](function(_0x973b19){if(_0x973b19){_0x213062['message'][_0x1044('0x65')]=_0x973b19[0x0];if(!_0x16b961[_0x1044('0x4f')][_0x1044('0x56')])return;return db[_0x1044('0x66')][_0x1044('0x4d')]({'where':{'id':_0x16b961[_0x1044('0x4f')]['UserId'],'role':_0x1044('0x58')},'attributes':['id',_0x1044('0x31'),_0x1044('0x67'),_0x1044('0x68'),_0x1044('0x69')],'raw':!![]});}return null;})[_0x1044('0x2e')](function(_0x41bff4){if(!_0x41bff4)return null;_0x213062[_0x1044('0x21')][_0x1044('0x58')]=_0x41bff4;return _0x213062;})[_0x1044('0x2e')](function(_0xf07c11){if(_0xf07c11){_0xf07c11[_0x1044('0x21')]['interface']=util[_0x1044('0x5a')](_0x1044('0x6b'),_0x16b961[_0x1044('0x57')][_0x1044('0x31')]);_0xf07c11[_0x1044('0x21')][_0x1044('0x6c')]=_0x213062[_0x1044('0x6c')];_0xf07c11['message'][_0x1044('0x72')]=_0x213062[_0x1044('0x6c')];_0xf07c11[_0x1044('0x21')][_0x1044('0x73')]=_0x1044('0x2c');respondWithRpcPromise(_0x1044('0x6d'),_0x1044('0x6d'),{'event':'rejectmessage','message':_0xf07c11['message']},client9002);return _0x213062;}return null;})[_0x1044('0x2e')](respondWithResult(_0x382981,null))[_0x1044('0x23')](handleError(_0x382981,null));};exports['create']=function(_0x3acca4,_0x5ef6ef){var _0x1517bb;return db[_0x1044('0x46')][_0x1044('0x74')](_0x3acca4['body'],{})[_0x1044('0x2e')](function(_0x5e7da1){_0x1517bb=_0x5e7da1;return db[_0x1044('0x75')][_0x1044('0x76')]({'where':{'id':_0x1517bb['ContactId']}});})[_0x1044('0x2e')](function(_0x589195){if(_[_0x1044('0x77')](_0x589195)){return;}else{_0x1517bb[_0x1044('0x53')]=_0x589195['fax'];return db[_0x1044('0x78')][_0x1044('0x76')]({'where':{'id':_0x1517bb['AttachmentId']}});}})[_0x1044('0x2e')](function(_0xd15edb){return respondWithRpcPromise(_0x1044('0x79'),_0x1044('0x79'),{'FaxAccountId':_[_0x1044('0x77')](_0x3acca4[_0x1044('0x4f')])?undefined:_0x3acca4['body']['FaxAccountId'],'path':_['isNil'](_0xd15edb)?undefined:util[_0x1044('0x5a')](_0x1044('0x7a'),_0xd15edb[_0x1044('0x7b')]),'fax':_['isNil'](_0x1517bb[_0x1044('0x53')])?undefined:_0x1517bb[_0x1044('0x53')],'AttachmentId':_0x1517bb[_0x1044('0x7c')]},client9002);})[_0x1044('0x2e')](respondWithResult(_0x5ef6ef,0xc9))[_0x1044('0x23')](handleError(_0x5ef6ef,null));};exports[_0x1044('0x7d')]=function(_0x342587,_0x116521){var _0x5a6416=path[_0x1044('0x7e')](config[_0x1044('0x7f')],_0x1044('0x80'),_0x1044('0x81'),'attachments');return db[_0x1044('0x46')][_0x1044('0x4d')]({'where':{'id':_0x342587[_0x1044('0x4b')]['id']},'include':[{'model':db[_0x1044('0x78')],'as':_0x1044('0x78')}]})['then'](handleEntityNotFound(_0x116521,null))[_0x1044('0x2e')](function(_0xd4cec8){if(_0xd4cec8){return _0x116521[_0x1044('0x7d')](path[_0x1044('0x7e')](_0x5a6416,_0xd4cec8[_0x1044('0x78')][_0x1044('0x7b')]));}})[_0x1044('0x23')](handleError(_0x116521,null));}; \ No newline at end of file +var _0x71c6=['FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','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','order','sort','where','filter','merge','VIRTUAL','options','FaxMessage','count','includeAll','include','rows','show','params','body','find','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteractionId','isNil','read1stAt','interaction','[FAXMESSAGE: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','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','fax','FaxInteraction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','Sequelize','motionChannel','rejectmessage','create','findOne','Attachment','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','download','join','root','server','files','attachments','basename','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./faxMessage.socket','http','client','request','then'];(function(_0x2cb3eb,_0x4d83aa){var _0x2759ee=function(_0x4108a0){while(--_0x4108a0){_0x2cb3eb['push'](_0x2cb3eb['shift']());}};_0x2759ee(++_0x4d83aa);}(_0x71c6,0x71));var _0x671c=function(_0x249ebb,_0xd151d1){_0x249ebb=_0x249ebb-0x0;var _0x98813a=_0x71c6[_0x249ebb];return _0x98813a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x671c('0x0'));var jsonpatch=require(_0x671c('0x1'));var rp=require('request-promise');var moment=require(_0x671c('0x2'));var BPromise=require(_0x671c('0x3'));var Mustache=require(_0x671c('0x4'));var util=require(_0x671c('0x5'));var path=require(_0x671c('0x6'));var sox=require(_0x671c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x671c('0x8'));var squel=require(_0x671c('0x9'));var crypto=require(_0x671c('0xa'));var jsforce=require(_0x671c('0xb'));var deskjs=require(_0x671c('0xc'));var toCsv=require(_0x671c('0xd'));var querystring=require(_0x671c('0xe'));var Papa=require(_0x671c('0xf'));var Redis=require(_0x671c('0x10'));var authService=require(_0x671c('0x11'));var qs=require(_0x671c('0x12'));var as=require(_0x671c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x671c('0x14'))(_0x671c('0x15'));var utils=require(_0x671c('0x16'));var config=require(_0x671c('0x17'));var licenseUtil=require(_0x671c('0x18'));var db=require(_0x671c('0x19'))['db'];config['redis']=_[_0x671c('0x1a')](config[_0x671c('0x1b')],{'host':_0x671c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x671c('0x1b')]));require(_0x671c('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x671c('0x1e')]({'port':0x232c});var client9002=jayson[_0x671c('0x1f')][_0x671c('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x79d291,_0x15e271,_0x49df38,_0x30e20e){return new BPromise(function(_0xf3a0a7,_0x194cd1){var _0x17c801=_0x30e20e||client;return _0x17c801[_0x671c('0x20')](_0x79d291,_0x49df38)[_0x671c('0x21')](function(_0x56a7c7){logger['info'](_0x671c('0x22'),_0x15e271,_0x671c('0x23'));logger[_0x671c('0x24')](_0x671c('0x25'),_0x15e271,_0x671c('0x23'),JSON[_0x671c('0x26')](_0x56a7c7));if(_0x56a7c7[_0x671c('0x27')]){if(_0x56a7c7['error']['code']===0x1f4){logger[_0x671c('0x27')]('FaxMessage,\x20%s,\x20%s',_0x15e271,_0x56a7c7[_0x671c('0x27')][_0x671c('0x28')]);return _0x194cd1(_0x56a7c7['error'][_0x671c('0x28')]);}logger['error'](_0x671c('0x22'),_0x15e271,_0x56a7c7['error'][_0x671c('0x28')]);return _0xf3a0a7(_0x56a7c7[_0x671c('0x27')][_0x671c('0x28')]);}else{logger[_0x671c('0x29')](_0x671c('0x22'),_0x15e271,_0x671c('0x23'));_0xf3a0a7(_0x56a7c7[_0x671c('0x2a')][_0x671c('0x28')]);}})[_0x671c('0x2b')](function(_0x1c0b2a){logger[_0x671c('0x27')](_0x671c('0x22'),_0x15e271,_0x1c0b2a);_0x194cd1(_0x1c0b2a);});});}function respondWithStatusCode(_0x473542,_0x37c137){_0x37c137=_0x37c137||0xcc;return function(_0x463ea3){if(_0x463ea3){return _0x473542[_0x671c('0x2c')](_0x37c137);}return _0x473542[_0x671c('0x2d')](_0x37c137)[_0x671c('0x2e')]();};}function respondWithResult(_0x22a679,_0x176307){_0x176307=_0x176307||0xc8;return function(_0x5ba091){if(_0x5ba091){return _0x22a679[_0x671c('0x2d')](_0x176307)[_0x671c('0x2f')](_0x5ba091);}};}function respondWithFilteredResult(_0x1a4ec8,_0x5a74f8){return function(_0x55ea4e){if(_0x55ea4e){var _0x22ad98=typeof _0x5a74f8[_0x671c('0x30')]===_0x671c('0x31')&&typeof _0x5a74f8[_0x671c('0x32')]==='undefined';var _0x40563d=_0x55ea4e['count'];var _0x311e69=_0x22ad98?0x0:_0x5a74f8['offset'];var _0x34b8d1=_0x22ad98?_0x55ea4e['count']:_0x5a74f8['offset']+_0x5a74f8[_0x671c('0x32')];var _0x4258cb;if(_0x34b8d1>=_0x40563d){_0x34b8d1=_0x40563d;_0x4258cb=0xc8;}else{_0x4258cb=0xce;}_0x1a4ec8[_0x671c('0x2d')](_0x4258cb);return _0x1a4ec8['set'](_0x671c('0x33'),_0x311e69+'-'+_0x34b8d1+'/'+_0x40563d)[_0x671c('0x2f')](_0x55ea4e);}return null;};}function patchUpdates(_0x1b2499){return function(_0x3ac007){try{jsonpatch[_0x671c('0x34')](_0x3ac007,_0x1b2499,!![]);}catch(_0x26c4f3){return BPromise[_0x671c('0x35')](_0x26c4f3);}return _0x3ac007['save']();};}function saveUpdates(_0x1d6063,_0x1332df){return function(_0x3b18d4){if(_0x3b18d4){return _0x3b18d4[_0x671c('0x36')](_0x1d6063)[_0x671c('0x21')](function(_0x496a80){return _0x496a80;});}return null;};}function removeEntity(_0x518b6f,_0x17ecf9){return function(_0x3c706e){if(_0x3c706e){return _0x3c706e[_0x671c('0x37')]()[_0x671c('0x21')](function(){_0x518b6f[_0x671c('0x2d')](0xcc)[_0x671c('0x2e')]();});}};}function handleEntityNotFound(_0x4dc7c1,_0x1a6076){return function(_0x310e0d){if(!_0x310e0d){_0x4dc7c1[_0x671c('0x2c')](0x194);}return _0x310e0d;};}function handleError(_0x22182a,_0x3e471e){_0x3e471e=_0x3e471e||0x1f4;return function(_0x10902f){logger['error'](_0x10902f[_0x671c('0x38')]);if(_0x10902f['name']){delete _0x10902f[_0x671c('0x39')];}_0x22182a[_0x671c('0x2d')](_0x3e471e)[_0x671c('0x3a')](_0x10902f);};}exports[_0x671c('0x3b')]=function(_0x5edd2f,_0x59fbe2){var _0x33c913={},_0x4d9b10={},_0x3ad2c9={'count':0x0,'rows':[]};var _0x4ad762=_[_0x671c('0x3c')](db['FaxMessage'][_0x671c('0x3d')],function(_0x26ee36){return{'name':_0x26ee36[_0x671c('0x3e')],'type':_0x26ee36[_0x671c('0x3f')][_0x671c('0x40')]};});_0x4d9b10[_0x671c('0x41')]=_[_0x671c('0x3c')](_0x4ad762,_0x671c('0x39'));_0x4d9b10[_0x671c('0x42')]=_[_0x671c('0x43')](_0x5edd2f[_0x671c('0x42')]);_0x4d9b10[_0x671c('0x44')]=_[_0x671c('0x45')](_0x4d9b10['model'],_0x4d9b10[_0x671c('0x42')]);_0x33c913['attributes']=_[_0x671c('0x45')](_0x4d9b10[_0x671c('0x41')],qs[_0x671c('0x46')](_0x5edd2f['query'][_0x671c('0x46')]));_0x33c913[_0x671c('0x47')]=_0x33c913[_0x671c('0x47')][_0x671c('0x48')]?_0x33c913['attributes']:_0x4d9b10[_0x671c('0x41')];if(!_0x5edd2f['query'][_0x671c('0x49')](_0x671c('0x4a'))){_0x33c913['limit']=qs[_0x671c('0x32')](_0x5edd2f['query'][_0x671c('0x32')]);_0x33c913[_0x671c('0x30')]=qs[_0x671c('0x30')](_0x5edd2f[_0x671c('0x42')]['offset']);}_0x33c913[_0x671c('0x4b')]=qs[_0x671c('0x4c')](_0x5edd2f[_0x671c('0x42')][_0x671c('0x4c')]);_0x33c913[_0x671c('0x4d')]=qs[_0x671c('0x44')](_['pick'](_0x5edd2f[_0x671c('0x42')],_0x4d9b10['filters']),_0x4ad762);if(_0x5edd2f[_0x671c('0x42')][_0x671c('0x4e')]){_0x33c913[_0x671c('0x4d')]=_[_0x671c('0x4f')](_0x33c913[_0x671c('0x4d')],{'$or':_['map'](_0x4ad762,function(_0x3e3ffa){if(_0x3e3ffa[_0x671c('0x3f')]!==_0x671c('0x50')){var _0x26e2cc={};_0x26e2cc[_0x3e3ffa[_0x671c('0x39')]]={'$like':'%'+_0x5edd2f['query'][_0x671c('0x4e')]+'%'};return _0x26e2cc;}})});}_0x33c913=_['merge']({},_0x33c913,_0x5edd2f[_0x671c('0x51')]);var _0x34a08e={'where':_0x33c913[_0x671c('0x4d')]};return db[_0x671c('0x52')][_0x671c('0x53')](_0x34a08e)[_0x671c('0x21')](function(_0x558324){_0x3ad2c9[_0x671c('0x53')]=_0x558324;if(_0x5edd2f[_0x671c('0x42')][_0x671c('0x54')]){_0x33c913[_0x671c('0x55')]=[{'all':!![]}];}return db[_0x671c('0x52')]['findAll'](_0x33c913);})[_0x671c('0x21')](function(_0xcb6fc4){_0x3ad2c9[_0x671c('0x56')]=_0xcb6fc4;return _0x3ad2c9;})[_0x671c('0x21')](respondWithFilteredResult(_0x59fbe2,_0x33c913))[_0x671c('0x2b')](handleError(_0x59fbe2,null));};exports[_0x671c('0x57')]=function(_0xbe87de,_0x1a3bf8){var _0xe073ad={'raw':!![],'where':{'id':_0xbe87de[_0x671c('0x58')]['id']}},_0x4888c2={};_0x4888c2[_0x671c('0x41')]=_[_0x671c('0x43')](db[_0x671c('0x52')]['rawAttributes']);_0x4888c2[_0x671c('0x42')]=_['keys'](_0xbe87de[_0x671c('0x42')]);_0x4888c2['filters']=_[_0x671c('0x45')](_0x4888c2[_0x671c('0x41')],_0x4888c2[_0x671c('0x42')]);_0xe073ad[_0x671c('0x47')]=_[_0x671c('0x45')](_0x4888c2[_0x671c('0x41')],qs[_0x671c('0x46')](_0xbe87de[_0x671c('0x42')]['fields']));_0xe073ad[_0x671c('0x47')]=_0xe073ad['attributes'][_0x671c('0x48')]?_0xe073ad[_0x671c('0x47')]:_0x4888c2[_0x671c('0x41')];if(_0xbe87de[_0x671c('0x42')][_0x671c('0x54')]){_0xe073ad[_0x671c('0x55')]=[{'all':!![]}];}_0xe073ad=_[_0x671c('0x4f')]({},_0xe073ad,_0xbe87de['options']);return db[_0x671c('0x52')]['find'](_0xe073ad)['then'](handleEntityNotFound(_0x1a3bf8,null))[_0x671c('0x21')](respondWithResult(_0x1a3bf8,null))[_0x671c('0x2b')](handleError(_0x1a3bf8,null));};exports[_0x671c('0x36')]=function(_0x5b4906,_0x3840a5){if(_0x5b4906[_0x671c('0x59')]['id']){delete _0x5b4906['body']['id'];}return db['FaxMessage'][_0x671c('0x5a')]({'where':{'id':_0x5b4906[_0x671c('0x58')]['id']}})[_0x671c('0x21')](handleEntityNotFound(_0x3840a5,null))[_0x671c('0x21')](saveUpdates(_0x5b4906[_0x671c('0x59')],null))[_0x671c('0x21')](respondWithResult(_0x3840a5,null))[_0x671c('0x2b')](handleError(_0x3840a5,null));};exports[_0x671c('0x37')]=function(_0x12d381,_0x437734){return db['FaxMessage']['find']({'where':{'id':_0x12d381['params']['id']}})[_0x671c('0x21')](handleEntityNotFound(_0x437734,null))['then'](removeEntity(_0x437734,null))[_0x671c('0x2b')](handleError(_0x437734,null));};exports[_0x671c('0x5b')]=function(_0x3bad1c,_0x5c56bf){return db[_0x671c('0x52')][_0x671c('0x5b')]()[_0x671c('0x21')](respondWithResult(_0x5c56bf,null))[_0x671c('0x2b')](handleError(_0x5c56bf,null));};var interaction_log=require(_0x671c('0x14'))(_0x671c('0x5c'));exports[_0x671c('0x5d')]=function(_0x3a61d6,_0x52bf24,_0x4ee3af){var _0x2b21db={'agent':{},'channel':'fax'};if(_0x3a61d6[_0x671c('0x59')]['id']){delete _0x3a61d6[_0x671c('0x59')]['id'];}_0x3a61d6[_0x671c('0x59')][_0x671c('0x5e')]=!![];_0x3a61d6[_0x671c('0x59')][_0x671c('0x5f')]=moment()[_0x671c('0x60')](_0x671c('0x61'));_0x3a61d6[_0x671c('0x59')][_0x671c('0x62')]=_0x3a61d6[_0x671c('0x59')]['UserId']||_0x3a61d6[_0x671c('0x63')]['id'];_0x2b21db[_0x671c('0x64')]['id']=_0x3a61d6[_0x671c('0x59')][_0x671c('0x62')];return db[_0x671c('0x52')]['find']({'where':{'id':_0x3a61d6[_0x671c('0x58')]['id'],'UserId':null}})[_0x671c('0x21')](handleEntityNotFound(_0x52bf24,null))[_0x671c('0x21')](saveUpdates(_0x3a61d6[_0x671c('0x59')],null))[_0x671c('0x21')](function(_0x38ab94){if(_0x38ab94){_0x2b21db[_0x671c('0x28')]=_0x38ab94[_0x671c('0x65')]({'plain':!![]});return db['FaxInteraction'][_0x671c('0x5a')]({'where':{'id':_0x38ab94[_0x671c('0x66')]}});}return null;})[_0x671c('0x21')](handleEntityNotFound(_0x52bf24,null))['then'](function(_0x3c7864){if(_0x3c7864){return _0x3c7864[_0x671c('0x36')]({'UserId':_0x3a61d6[_0x671c('0x59')][_0x671c('0x62')],'read1stAt':_[_0x671c('0x67')](_0x3c7864[_0x671c('0x68')])?moment()[_0x671c('0x60')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x671c('0x21')](function(_0x403fda){if(_0x403fda){_0x2b21db[_0x671c('0x69')]=_0x403fda[_0x671c('0x65')]({'plain':!![]});interaction_log[_0x671c('0x29')](_0x671c('0x6a'),_0x3a61d6[_0x671c('0x63')]['id'],_0x3a61d6[_0x671c('0x63')][_0x671c('0x39')],_0x3a61d6[_0x671c('0x63')][_0x671c('0x6b')],_0x2b21db[_0x671c('0x69')]['id'],_0x3a61d6[_0x671c('0x59')]?JSON[_0x671c('0x26')](_0x3a61d6[_0x671c('0x59')]):_0x671c('0x6c'));return respondWithRpcPromise(_0x671c('0x6d'),_0x671c('0x6e'),_0x2b21db);}return null;})[_0x671c('0x21')](function(_0x4ba702){var _0x70b9bc=_0x671c('0x6f')+_0x4ba702[_0x671c('0x28')][_0x671c('0x70')];return db[_0x671c('0x71')]['query'](_0x70b9bc,{'type':db['Sequelize'][_0x671c('0x72')]['SELECT'],'raw':!![]})[_0x671c('0x21')](function(_0x10c4a5){return _0x10c4a5;});})['then'](function(_0x6f5c62){if(_0x6f5c62){_0x2b21db[_0x671c('0x28')][_0x671c('0x73')]=_0x6f5c62[0x0];if(!_0x3a61d6[_0x671c('0x59')][_0x671c('0x62')])return;return db[_0x671c('0x74')][_0x671c('0x5a')]({'where':{'id':_0x3a61d6['body'][_0x671c('0x62')],'role':_0x671c('0x64')},'attributes':['id',_0x671c('0x39'),_0x671c('0x75'),_0x671c('0x76'),_0x671c('0x77')],'raw':!![]});}return null;})['then'](function(_0x270bfe){if(!_0x270bfe)return null;_0x2b21db[_0x671c('0x28')][_0x671c('0x64')]=_0x270bfe;return _0x2b21db;})[_0x671c('0x21')](function(_0x3f1fc8){if(_0x3f1fc8){if(_0x3a61d6[_0x671c('0x59')][_0x671c('0x78')]){_0x2b21db['message'][_0x671c('0x79')]=util[_0x671c('0x60')](_0x671c('0x7a'),_0x3a61d6[_0x671c('0x63')][_0x671c('0x39')]);_0x2b21db[_0x671c('0x28')][_0x671c('0x7b')]=_0x2b21db[_0x671c('0x7b')];_0x2b21db[_0x671c('0x28')]['motionChannel']=_0x2b21db[_0x671c('0x7b')];_0x2b21db[_0x671c('0x28')][_0x671c('0x7c')]=_0x671c('0x5d');return respondWithRpcPromise(_0x671c('0x7d'),_0x671c('0x7d'),{'event':'acceptmessage','message':_0x2b21db[_0x671c('0x28')]},client9002)[_0x671c('0x21')](function(){return _0x2b21db;});}return _0x2b21db;}return null;})['then'](respondWithResult(_0x52bf24,null))[_0x671c('0x2b')](handleError(_0x52bf24,null));};var interaction_log=require(_0x671c('0x14'))(_0x671c('0x5c'));exports[_0x671c('0x35')]=function(_0x5e4221,_0x2abc55,_0x12ba0b){var _0x114566={'agent':{},'channel':_0x671c('0x7e')};if(_0x5e4221[_0x671c('0x59')]['id']){delete _0x5e4221[_0x671c('0x59')]['id'];}_0x5e4221['body'][_0x671c('0x62')]=_0x5e4221[_0x671c('0x59')]['UserId']||_0x5e4221['user']['id'];_0x114566['agent']['id']=_0x5e4221[_0x671c('0x59')]['UserId'];return db[_0x671c('0x52')]['find']({'where':{'id':_0x5e4221[_0x671c('0x58')]['id'],'UserId':null}})[_0x671c('0x21')](handleEntityNotFound(_0x2abc55,null))[_0x671c('0x21')](function(_0x347bc7){if(_0x347bc7){_0x114566[_0x671c('0x28')]=_0x347bc7['get']({'plain':!![]});return db[_0x671c('0x7f')]['find']({'where':{'id':_0x347bc7[_0x671c('0x66')]}});}return null;})['then'](handleEntityNotFound(_0x2abc55,null))[_0x671c('0x21')](function(_0x24c712){if(_0x24c712){_0x114566[_0x671c('0x69')]=_0x24c712[_0x671c('0x65')]({'plain':!![]});interaction_log[_0x671c('0x29')](_0x671c('0x80'),_0x5e4221['user']['id'],_0x5e4221[_0x671c('0x63')][_0x671c('0x39')],_0x5e4221[_0x671c('0x63')][_0x671c('0x6b')],_0x114566['interaction']['id'],_0x5e4221['body']?JSON[_0x671c('0x26')](_0x5e4221[_0x671c('0x59')]):_0x671c('0x6c'));return respondWithRpcPromise(_0x671c('0x81'),_0x671c('0x82'),_0x114566);}return null;})[_0x671c('0x21')](function(_0x303a80){var _0x58a629=_0x671c('0x6f')+_0x303a80[_0x671c('0x28')]['ContactId'];return db[_0x671c('0x71')][_0x671c('0x42')](_0x58a629,{'type':db[_0x671c('0x83')][_0x671c('0x72')]['SELECT'],'raw':!![]})[_0x671c('0x21')](function(_0x34b156){return _0x34b156;});})[_0x671c('0x21')](function(_0x3aa8b0){if(_0x3aa8b0){_0x114566[_0x671c('0x28')]['contact']=_0x3aa8b0[0x0];if(!_0x5e4221[_0x671c('0x59')][_0x671c('0x62')])return;return db[_0x671c('0x74')][_0x671c('0x5a')]({'where':{'id':_0x5e4221['body'][_0x671c('0x62')],'role':_0x671c('0x64')},'attributes':['id',_0x671c('0x39'),_0x671c('0x75'),_0x671c('0x76'),_0x671c('0x77')],'raw':!![]});}return null;})[_0x671c('0x21')](function(_0x499c12){if(!_0x499c12)return null;_0x114566[_0x671c('0x28')][_0x671c('0x64')]=_0x499c12;return _0x114566;})[_0x671c('0x21')](function(_0x1742c0){if(_0x1742c0){_0x1742c0[_0x671c('0x28')][_0x671c('0x79')]=util[_0x671c('0x60')](_0x671c('0x7a'),_0x5e4221[_0x671c('0x63')][_0x671c('0x39')]);_0x1742c0[_0x671c('0x28')][_0x671c('0x7b')]=_0x114566[_0x671c('0x7b')];_0x1742c0[_0x671c('0x28')][_0x671c('0x84')]=_0x114566[_0x671c('0x7b')];_0x1742c0[_0x671c('0x28')][_0x671c('0x7c')]=_0x671c('0x35');respondWithRpcPromise('EventManager',_0x671c('0x7d'),{'event':_0x671c('0x85'),'message':_0x1742c0['message']},client9002);return _0x114566;}return null;})['then'](respondWithResult(_0x2abc55,null))[_0x671c('0x2b')](handleError(_0x2abc55,null));};exports['create']=function(_0x3d57fa,_0x1b2c60){var _0x1a8d5d;return db[_0x671c('0x52')][_0x671c('0x86')](_0x3d57fa[_0x671c('0x59')],{})[_0x671c('0x21')](function(_0x272f7e){_0x1a8d5d=_0x272f7e;return db['CmContact'][_0x671c('0x87')]({'where':{'id':_0x1a8d5d['ContactId']}});})[_0x671c('0x21')](function(_0x49c16c){if(_[_0x671c('0x67')](_0x49c16c)){return;}else{_0x1a8d5d['fax']=_0x49c16c[_0x671c('0x7e')];return db[_0x671c('0x88')][_0x671c('0x87')]({'where':{'id':_0x1a8d5d[_0x671c('0x89')]}});}})[_0x671c('0x21')](function(_0x1c5aac){return respondWithRpcPromise(_0x671c('0x8a'),_0x671c('0x8a'),{'FaxAccountId':_[_0x671c('0x67')](_0x3d57fa[_0x671c('0x59')])?undefined:_0x3d57fa[_0x671c('0x59')]['FaxAccountId'],'path':_[_0x671c('0x67')](_0x1c5aac)?undefined:util[_0x671c('0x60')](_0x671c('0x8b'),_0x1c5aac['basename']),'fax':_[_0x671c('0x67')](_0x1a8d5d[_0x671c('0x7e')])?undefined:_0x1a8d5d['fax'],'AttachmentId':_0x1a8d5d[_0x671c('0x89')]},client9002);})['then'](respondWithResult(_0x1b2c60,0xc9))[_0x671c('0x2b')](handleError(_0x1b2c60,null));};exports[_0x671c('0x8c')]=function(_0x32ed75,_0x301663){var _0x1de7dd=path[_0x671c('0x8d')](config[_0x671c('0x8e')],_0x671c('0x8f'),_0x671c('0x90'),_0x671c('0x91'));return db['FaxMessage'][_0x671c('0x5a')]({'where':{'id':_0x32ed75['params']['id']},'include':[{'model':db[_0x671c('0x88')],'as':_0x671c('0x88')}]})[_0x671c('0x21')](handleEntityNotFound(_0x301663,null))[_0x671c('0x21')](function(_0x269f65){if(_0x269f65){return _0x301663[_0x671c('0x8c')](path['join'](_0x1de7dd,_0x269f65[_0x671c('0x88')][_0x671c('0x92')]));}})[_0x671c('0x2b')](handleError(_0x301663,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 5c444d0..e1df726 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 _0x2087=['events','../../mysqldb','FaxMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x4920f2,_0xa4bfbf){var _0x1f27cf=function(_0x4d94ad){while(--_0x4d94ad){_0x4920f2['push'](_0x4920f2['shift']());}};_0x1f27cf(++_0xa4bfbf);}(_0x2087,0xf3));var _0x7208=function(_0x1eaf5e,_0x333d16){_0x1eaf5e=_0x1eaf5e-0x0;var _0x409fa2=_0x2087[_0x1eaf5e];return _0x409fa2;};'use strict';var EventEmitter=require(_0x7208('0x0'));var FaxMessage=require(_0x7208('0x1'))['db'][_0x7208('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7208('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7208('0x4'),'afterDestroy':_0x7208('0x5')};function emitEvent(_0x4503f7){return function(_0x1d5d58,_0x4d7cd4,_0x57509e){FaxMessageEvents[_0x7208('0x6')](_0x4503f7+':'+_0x1d5d58['id'],_0x1d5d58);FaxMessageEvents['emit'](_0x4503f7,_0x1d5d58);_0x57509e(null);};}for(var e in events){if(events[_0x7208('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x7208('0x8')]=FaxMessageEvents; \ No newline at end of file +var _0x9e6d=['save','remove','emit','exports','events','FaxMessage','setMaxListeners'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x9e6d,0x1d2));var _0xd9e6=function(_0x2de613,_0x2ccda8){_0x2de613=_0x2de613-0x0;var _0x4f0035=_0x9e6d[_0x2de613];return _0x4f0035;};'use strict';var EventEmitter=require(_0xd9e6('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xd9e6('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd9e6('0x2')](0x0);var events={'afterCreate':_0xd9e6('0x3'),'afterUpdate':'update','afterDestroy':_0xd9e6('0x4')};function emitEvent(_0x1d5756){return function(_0x2f1c0,_0x3b2951,_0x5e363d){FaxMessageEvents[_0xd9e6('0x5')](_0x1d5756+':'+_0x2f1c0['id'],_0x2f1c0);FaxMessageEvents[_0xd9e6('0x5')](_0x1d5756,_0x2f1c0);_0x5e363d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xd9e6('0x6')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 293beda..c89f777 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 _0x01e3=['FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','define','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','isNil'];(function(_0x275f92,_0xf6eb4c){var _0x51556=function(_0xb96bab){while(--_0xb96bab){_0x275f92['push'](_0x275f92['shift']());}};_0x51556(++_0xf6eb4c);}(_0x01e3,0xaa));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x301e('0x0'));var util=require(_0x301e('0x1'));var logger=require('../../config/logger')(_0x301e('0x2'));var moment=require('moment');var BPromise=require(_0x301e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x301e('0x4'));var rimraf=require(_0x301e('0x5'));var config=require(_0x301e('0x6'));var attributes=require('./faxMessage.attributes');module[_0x301e('0x7')]=function(_0x539501,_0x506e61){return _0x539501[_0x301e('0x8')]('FaxMessage',attributes,{'tableName':_0x301e('0x9'),'paranoid':![],'indexes':[{'name':_0x301e('0xa'),'fields':[_0x301e('0xb')],'type':_0x301e('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7c8fa7,_0x3bfc6c,_0xf1c0e1){var _0x523452=_0x539501[_0x301e('0xd')];var _0x1e7427=_0x7c8fa7[_0x301e('0xe')]({'plain':!![]});if(_0x1e7427['direction'][_0x301e('0xf')]()==='in'||_0x1e7427[_0x301e('0x10')][_0x301e('0xf')]()===_0x301e('0x11')&&!_0x1e7427['secret']&&!_[_0x301e('0x12')](_0x1e7427['UserId'])){_0x523452[_0x301e('0x13')]['findOne']({'where':{'id':_0x1e7427[_0x301e('0x14')]}})[_0x301e('0x15')](function(_0x141070){if(_0x141070){_0x141070[_0x301e('0x16')]({'lastMsgAt':_0x1e7427[_0x301e('0x17')],'lastMsgDirection':_0x1e7427[_0x301e('0x10')][_0x301e('0xf')]()});}})[_0x301e('0x18')](function(_0x1fc0fc){console[_0x301e('0x19')](_0x1fc0fc);});}_0xf1c0e1();}},'charset':_0x301e('0x1a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x9f07=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','toLowerCase','out','secret','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','direction','catch'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x9f07,0xc3));var _0x79f0=function(_0x2a9636,_0x1978c6){_0x2a9636=_0x2a9636-0x0;var _0x1e3ccc=_0x9f07[_0x2a9636];return _0x1e3ccc;};'use strict';var _=require(_0x79f0('0x0'));var util=require(_0x79f0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x79f0('0x2'));var BPromise=require(_0x79f0('0x3'));var rp=require(_0x79f0('0x4'));var fs=require('fs');var path=require(_0x79f0('0x5'));var rimraf=require(_0x79f0('0x6'));var config=require(_0x79f0('0x7'));var attributes=require(_0x79f0('0x8'));module[_0x79f0('0x9')]=function(_0x107926,_0x897e9){return _0x107926[_0x79f0('0xa')](_0x79f0('0xb'),attributes,{'tableName':_0x79f0('0xc'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x79f0('0xd')],'type':_0x79f0('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ed162,_0x170fe8,_0x3d30b0){var _0x534afa=_0x107926[_0x79f0('0xf')];var _0x19faed=_0x4ed162[_0x79f0('0x10')]({'plain':!![]});if(_0x19faed['direction'][_0x79f0('0x11')]()==='in'||_0x19faed['direction'][_0x79f0('0x11')]()===_0x79f0('0x12')&&!_0x19faed[_0x79f0('0x13')]&&!_['isNil'](_0x19faed[_0x79f0('0x14')])){_0x534afa[_0x79f0('0x15')][_0x79f0('0x16')]({'where':{'id':_0x19faed[_0x79f0('0x17')]}})[_0x79f0('0x18')](function(_0x448467){if(_0x448467){_0x448467[_0x79f0('0x19')]({'lastMsgAt':_0x19faed[_0x79f0('0x1a')],'lastMsgDirection':_0x19faed[_0x79f0('0x1b')][_0x79f0('0x11')]()});}})[_0x79f0('0x1c')](function(_0x4e22d5){console[_0x79f0('0x1d')](_0x4e22d5);});}_0x3d30b0();}},'charset':_0x79f0('0x1e'),'collate':_0x79f0('0x1f')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 97e33de..a9b9ecd 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 _0x4c4e=['localhost','socket.io-emitter','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','debug','stringify','attributes','limit','UpdateFaxMessage','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults'];(function(_0x4aa21e,_0x2c62c8){var _0x4ac58e=function(_0x1d03a1){while(--_0x1d03a1){_0x4aa21e['push'](_0x4aa21e['shift']());}};_0x4ac58e(++_0x2c62c8);}(_0x4c4e,0x152));var _0xe4c4=function(_0x2b609f,_0x5ab2c9){_0x2b609f=_0x2b609f-0x0;var _0x161c41=_0x4c4e[_0x2b609f];return _0x161c41;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});config[_0xe4c4('0xa')]=_[_0xe4c4('0xb')](config[_0xe4c4('0xa')],{'host':_0xe4c4('0xc'),'port':0x18eb});var socket=require(_0xe4c4('0xd'))(new Redis(config[_0xe4c4('0xa')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x31f879,_0x6f2545,_0x27ad42){return new BPromise(function(_0x1bc786,_0x333c08){return client[_0xe4c4('0xe')](_0x31f879,_0x27ad42)['then'](function(_0x303d89){logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));logger['debug'](_0xe4c4('0x12'),_0x6f2545,_0xe4c4('0x11'),JSON['stringify'](_0x303d89));if(_0x303d89[_0xe4c4('0x13')]){if(_0x303d89[_0xe4c4('0x13')]['code']===0x1f4){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89['error'][_0xe4c4('0x14')]);return _0x333c08(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);return _0x1bc786(_0x303d89[_0xe4c4('0x13')][_0xe4c4('0x14')]);}else{logger[_0xe4c4('0xf')](_0xe4c4('0x10'),_0x6f2545,_0xe4c4('0x11'));_0x1bc786(_0x303d89[_0xe4c4('0x15')][_0xe4c4('0x14')]);}})[_0xe4c4('0x16')](function(_0x5a32b5){logger[_0xe4c4('0x13')](_0xe4c4('0x10'),_0x6f2545,_0x5a32b5);_0x333c08(_0x5a32b5);});});}exports[_0xe4c4('0x17')]=function(_0x317cc8){var _0x5da165=this;return new Promise(function(_0x3d5856,_0x1cad5d){return db[_0xe4c4('0x18')][_0xe4c4('0x19')](_0x317cc8[_0xe4c4('0x1a')],{'raw':_0x317cc8[_0xe4c4('0x1b')]?_0x317cc8[_0xe4c4('0x1b')][_0xe4c4('0x1c')]===undefined?!![]:![]:!![]})[_0xe4c4('0x1d')](function(_0x1a7690){logger[_0xe4c4('0xf')](_0xe4c4('0x17'),_0x317cc8);logger[_0xe4c4('0x1e')](_0xe4c4('0x17'),_0x317cc8,JSON[_0xe4c4('0x1f')](_0x1a7690));_0x3d5856(_0x1a7690);})['catch'](function(_0x49cadc){logger[_0xe4c4('0x13')]('CreateFaxMessage',_0x49cadc[_0xe4c4('0x14')],_0x317cc8);_0x1cad5d(_0x5da165['error'](0x1f4,_0x49cadc[_0xe4c4('0x14')]));});});};exports['UpdateFaxMessage']=function(_0x34d667){var _0x583393=this;return new Promise(function(_0xba53ef,_0x4a0199){return db['FaxMessage']['update'](_0x34d667['body'],{'raw':_0x34d667[_0xe4c4('0x1b')]?_0x34d667['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34d667[_0xe4c4('0x1b')]?_0x34d667[_0xe4c4('0x1b')]['where']||null:null,'attributes':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x20')]||null:null,'limit':_0x34d667['options']?_0x34d667[_0xe4c4('0x1b')][_0xe4c4('0x21')]||null:null})[_0xe4c4('0x1d')](function(_0x48060e){logger['info'](_0xe4c4('0x22'),_0x34d667);logger[_0xe4c4('0x1e')](_0xe4c4('0x22'),_0x34d667,JSON[_0xe4c4('0x1f')](_0x48060e));_0xba53ef(_0x48060e);})['catch'](function(_0x49c913){logger[_0xe4c4('0x13')](_0xe4c4('0x22'),_0x49c913['message'],_0x34d667);_0x4a0199(_0x583393[_0xe4c4('0x13')](0x1f4,_0x49c913[_0xe4c4('0x14')]));});});}; \ No newline at end of file +var _0x81bd=['debug','request\x20sent','stringify','error','message','result','catch','CreateFaxMessage','create','body','options','raw','FaxMessage','update','limit','UpdateFaxMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s'];(function(_0x376b80,_0x5c15b9){var _0x588df2=function(_0x146fb){while(--_0x146fb){_0x376b80['push'](_0x376b80['shift']());}};_0x588df2(++_0x5c15b9);}(_0x81bd,0x7c));var _0xd81b=function(_0x2a2d4c,_0x421c0b){_0x2a2d4c=_0x2a2d4c-0x0;var _0x281be4=_0x81bd[_0x2a2d4c];return _0x281be4;};'use strict';var _=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var moment=require(_0xd81b('0x2'));var BPromise=require(_0xd81b('0x3'));var rs=require(_0xd81b('0x4'));var fs=require('fs');var Redis=require(_0xd81b('0x5'));var db=require(_0xd81b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd81b('0xa')][_0xd81b('0xb')]({'port':0x232a});config[_0xd81b('0xc')]=_['defaults'](config['redis'],{'host':_0xd81b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd81b('0xc')]));require(_0xd81b('0xe'))[_0xd81b('0xf')](socket);function respondWithRpcPromise(_0x86dab6,_0x17fba4,_0x1ff60f){return new BPromise(function(_0x4391be,_0x17e09f){return client[_0xd81b('0x10')](_0x86dab6,_0x1ff60f)[_0xd81b('0x11')](function(_0x215b92){logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,'request\x20sent');logger[_0xd81b('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x17fba4,_0xd81b('0x15'),JSON[_0xd81b('0x16')](_0x215b92));if(_0x215b92['error']){if(_0x215b92[_0xd81b('0x17')]['code']===0x1f4){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);return _0x17e09f(_0x215b92[_0xd81b('0x17')]['message']);}logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x215b92['error'][_0xd81b('0x18')]);return _0x4391be(_0x215b92[_0xd81b('0x17')][_0xd81b('0x18')]);}else{logger[_0xd81b('0x12')](_0xd81b('0x13'),_0x17fba4,_0xd81b('0x15'));_0x4391be(_0x215b92[_0xd81b('0x19')][_0xd81b('0x18')]);}})[_0xd81b('0x1a')](function(_0x285164){logger[_0xd81b('0x17')](_0xd81b('0x13'),_0x17fba4,_0x285164);_0x17e09f(_0x285164);});});}exports[_0xd81b('0x1b')]=function(_0x3518f0){var _0x156894=this;return new Promise(function(_0x4f8c0b,_0x5f101a){return db['FaxMessage'][_0xd81b('0x1c')](_0x3518f0[_0xd81b('0x1d')],{'raw':_0x3518f0[_0xd81b('0x1e')]?_0x3518f0['options'][_0xd81b('0x1f')]===undefined?!![]:![]:!![]})[_0xd81b('0x11')](function(_0x542ee2){logger[_0xd81b('0x12')](_0xd81b('0x1b'),_0x3518f0);logger[_0xd81b('0x14')](_0xd81b('0x1b'),_0x3518f0,JSON[_0xd81b('0x16')](_0x542ee2));_0x4f8c0b(_0x542ee2);})[_0xd81b('0x1a')](function(_0x255011){logger[_0xd81b('0x17')](_0xd81b('0x1b'),_0x255011[_0xd81b('0x18')],_0x3518f0);_0x5f101a(_0x156894[_0xd81b('0x17')](0x1f4,_0x255011[_0xd81b('0x18')]));});});};exports['UpdateFaxMessage']=function(_0x28768f){var _0x99dbc9=this;return new Promise(function(_0xe3637a,_0x31b9fd){return db[_0xd81b('0x20')][_0xd81b('0x21')](_0x28768f[_0xd81b('0x1d')],{'raw':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28768f[_0xd81b('0x1e')]?_0x28768f['options']['where']||null:null,'attributes':_0x28768f[_0xd81b('0x1e')]?_0x28768f[_0xd81b('0x1e')]['attributes']||null:null,'limit':_0x28768f['options']?_0x28768f[_0xd81b('0x1e')][_0xd81b('0x22')]||null:null})[_0xd81b('0x11')](function(_0x289f54){logger[_0xd81b('0x12')](_0xd81b('0x23'),_0x28768f);logger['debug'](_0xd81b('0x23'),_0x28768f,JSON[_0xd81b('0x16')](_0x289f54));_0xe3637a(_0x289f54);})['catch'](function(_0x56d80b){logger[_0xd81b('0x17')](_0xd81b('0x23'),_0x56d80b['message'],_0x28768f);_0x31b9fd(_0x99dbc9['error'](0x1f4,_0x56d80b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 26e3eba..13a116e 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 _0xe72a=['register','faxMessage:','./faxMessage.events','save','update','removeListener'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe72a,0xfe));var _0xae72=function(_0x5c8b70,_0x4fa574){_0x5c8b70=_0x5c8b70-0x0;var _0x239ecb=_0xe72a[_0x5c8b70];return _0x239ecb;};'use strict';var FaxMessageEvents=require(_0xae72('0x0'));var events=[_0xae72('0x1'),'remove',_0xae72('0x2')];function createListener(_0x5e10c2,_0x32f61a){return function(_0x21f78f){_0x32f61a['emit'](_0x5e10c2,_0x21f78f);};}function removeListener(_0x3fdc58,_0xccff9a){return function(){FaxMessageEvents[_0xae72('0x3')](_0x3fdc58,_0xccff9a);};}exports[_0xae72('0x4')]=function(_0x2d498e){for(var _0x1e1765=0x0,_0x183d9e=events['length'];_0x1e1765<_0x183d9e;_0x1e1765++){var _0x22b701=events[_0x1e1765];var _0x40b038=createListener(_0xae72('0x5')+_0x22b701,_0x2d498e);FaxMessageEvents['on'](_0x22b701,_0x40b038);}}; \ No newline at end of file +var _0xbf5e=['remove','update','emit','register','faxMessage:','save'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0xbf5e,0x131));var _0xebf5=function(_0x481efb,_0x3c2c8b){_0x481efb=_0x481efb-0x0;var _0x185dd6=_0xbf5e[_0x481efb];return _0x185dd6;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xebf5('0x0'),_0xebf5('0x1'),_0xebf5('0x2')];function createListener(_0x50b9ec,_0x1d71d5){return function(_0x52adfa){_0x1d71d5[_0xebf5('0x3')](_0x50b9ec,_0x52adfa);};}function removeListener(_0x5a3188,_0x1d3b49){return function(){FaxMessageEvents['removeListener'](_0x5a3188,_0x1d3b49);};}exports[_0xebf5('0x4')]=function(_0x460a0d){for(var _0x53d81c=0x0,_0x2ae90a=events['length'];_0x53d81c<_0x2ae90a;_0x53d81c++){var _0x45cafa=events[_0x53d81c];var _0x5cd268=createListener(_0xebf5('0x5')+_0x45cafa,_0x460a0d);FaxMessageEvents['on'](_0x45cafa,_0x5cd268);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 84ab877..b245aaa 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 _0x9354=['describe','/:id','show','/:id/download','download','post','fax','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1d1e94,_0x2ebb10){var _0x3f2ac4=function(_0x2d671c){while(--_0x2d671c){_0x1d1e94['push'](_0x1d1e94['shift']());}};_0x3f2ac4(++_0x2ebb10);}(_0x9354,0x96));var _0x4935=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x9354[_0x4828b1];return _0x1fec1b;};'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['get'](_0x4935('0xd'),auth['isAuthenticated'](),controller[_0x4935('0xe')]);router[_0x4935('0x8')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x10')]);router[_0x4935('0x11')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x4935('0x12'),'faxmessage:create'),controller['create']);router[_0x4935('0x13')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x16')]);router[_0x4935('0x13')](_0x4935('0x17'),auth[_0x4935('0x9')](),controller[_0x4935('0x18')]);router[_0x4935('0x19')](_0x4935('0xd'),auth[_0x4935('0x9')](),controller[_0x4935('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x4e81=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','download','post','tracked','fax','faxmessage:create','create','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','fs-extra'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x4e81,0x1bc));var _0x14e8=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x4e81[_0x3dee92];return _0x44d36e;};'use strict';var multer=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var path=require(_0x14e8('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x14e8('0x3'));var auth=require(_0x14e8('0x4'));var interaction=require(_0x14e8('0x5'));var config=require(_0x14e8('0x6'));var controller=require(_0x14e8('0x7'));router[_0x14e8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x14e8('0x8')](_0x14e8('0x9'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xb')]);router[_0x14e8('0x8')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller[_0x14e8('0xd')]);router[_0x14e8('0x8')]('/:id/download',auth[_0x14e8('0xa')](),controller[_0x14e8('0xe')]);router[_0x14e8('0xf')]('/',auth[_0x14e8('0xa')](),interaction[_0x14e8('0x10')](_0x14e8('0x11'),_0x14e8('0x12')),controller[_0x14e8('0x13')]);router['put'](_0x14e8('0xc'),auth['isAuthenticated'](),controller[_0x14e8('0x14')]);router[_0x14e8('0x15')](_0x14e8('0x16'),auth['isAuthenticated'](),controller[_0x14e8('0x17')]);router['put'](_0x14e8('0x18'),auth['isAuthenticated'](),controller[_0x14e8('0x19')]);router[_0x14e8('0x1a')](_0x14e8('0xc'),auth[_0x14e8('0xa')](),controller['destroy']);module[_0x14e8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index feb4ac0..127eaf4 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 _0x3599=['exports','STRING','name','beepall','sequelize'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x3599,0x185));var _0x9359=function(_0x52f68d,_0x3d27bc){_0x52f68d=_0x52f68d-0x0;var _0x21be54=_0x3599[_0x52f68d];return _0x21be54;};'use strict';var Sequelize=require(_0x9359('0x0'));module[_0x9359('0x1')]={'name':{'type':Sequelize[_0x9359('0x2')],'unique':_0x9359('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9359('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x9359('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d29=['INTEGER','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x47fa28,_0x368316){var _0x26795e=function(_0x163f05){while(--_0x163f05){_0x47fa28['push'](_0x47fa28['shift']());}};_0x26795e(++_0x368316);}(_0x7d29,0x1a0));var _0x97d2=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7d29[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0x97d2('0x0'));module[_0x97d2('0x1')]={'name':{'type':Sequelize[_0x97d2('0x2')],'unique':_0x97d2('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97d2('0x2')]},'timeout':{'type':Sequelize[_0x97d2('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x97d2('0x5'),_0x97d2('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x97d2('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 133d4d1..2a18eb2 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 _0x55de=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','user','role','FaxQueues','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserFaxQueue','FaxQueueId','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','isArray','userFaxQueue:remove','getAgents','rimraf','fast-json-patch','moment','bluebird','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','undefined','limit','count','offset','set','Content-Range','save','update','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','key','model','query','keys','filters'];(function(_0x2feb70,_0x534ea1){var _0x54697f=function(_0x221ec5){while(--_0x221ec5){_0x2feb70['push'](_0x2feb70['shift']());}};_0x54697f(++_0x534ea1);}(_0x55de,0xdc));var _0xe55d=function(_0x311c92,_0x9166a3){_0x311c92=_0x311c92-0x0;var _0x2914d0=_0x55de[_0x311c92];return _0x2914d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe55d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe55d('0x1'));var rp=require('request-promise');var moment=require(_0xe55d('0x2'));var BPromise=require(_0xe55d('0x3'));var Mustache=require(_0xe55d('0x4'));var util=require(_0xe55d('0x5'));var path=require(_0xe55d('0x6'));var sox=require(_0xe55d('0x7'));var csv=require(_0xe55d('0x8'));var ejs=require(_0xe55d('0x9'));var fs=require('fs');var fs_extra=require(_0xe55d('0xa'));var _=require(_0xe55d('0xb'));var squel=require(_0xe55d('0xc'));var crypto=require(_0xe55d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xe55d('0xe'));var toCsv=require(_0xe55d('0x8'));var querystring=require(_0xe55d('0xf'));var Papa=require('papaparse');var Redis=require(_0xe55d('0x10'));var authService=require(_0xe55d('0x11'));var qs=require(_0xe55d('0x12'));var as=require(_0xe55d('0x13'));var hardwareService=require(_0xe55d('0x14'));var logger=require(_0xe55d('0x15'))(_0xe55d('0x16'));var utils=require('../../config/utils');var config=require(_0xe55d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe55d('0x18'))['db'];config[_0xe55d('0x19')]=_[_0xe55d('0x1a')](config[_0xe55d('0x19')],{'host':_0xe55d('0x1b'),'port':0x18eb});var socket=require(_0xe55d('0x1c'))(new Redis(config[_0xe55d('0x19')]));require(_0xe55d('0x1d'))[_0xe55d('0x1e')](socket);function respondWithStatusCode(_0x3c7ee8,_0x159f15){_0x159f15=_0x159f15||0xcc;return function(_0x22090a){if(_0x22090a){return _0x3c7ee8['sendStatus'](_0x159f15);}return _0x3c7ee8[_0xe55d('0x1f')](_0x159f15)[_0xe55d('0x20')]();};}function respondWithResult(_0x1f3642,_0xb09071){_0xb09071=_0xb09071||0xc8;return function(_0xeeb5db){if(_0xeeb5db){return _0x1f3642[_0xe55d('0x1f')](_0xb09071)[_0xe55d('0x21')](_0xeeb5db);}};}function respondWithFilteredResult(_0x3a34c3,_0x1e68c0){return function(_0x2b18b){if(_0x2b18b){var _0x1da7ec=typeof _0x1e68c0['offset']===_0xe55d('0x22')&&typeof _0x1e68c0[_0xe55d('0x23')]===_0xe55d('0x22');var _0x1dc6bb=_0x2b18b['count'];var _0x566808=_0x1da7ec?0x0:_0x1e68c0['offset'];var _0x25d554=_0x1da7ec?_0x2b18b[_0xe55d('0x24')]:_0x1e68c0[_0xe55d('0x25')]+_0x1e68c0[_0xe55d('0x23')];var _0x1ca569;if(_0x25d554>=_0x1dc6bb){_0x25d554=_0x1dc6bb;_0x1ca569=0xc8;}else{_0x1ca569=0xce;}_0x3a34c3[_0xe55d('0x1f')](_0x1ca569);return _0x3a34c3[_0xe55d('0x26')](_0xe55d('0x27'),_0x566808+'-'+_0x25d554+'/'+_0x1dc6bb)['json'](_0x2b18b);}return null;};}function patchUpdates(_0xbeeda9){return function(_0x4fa17e){try{jsonpatch['apply'](_0x4fa17e,_0xbeeda9,!![]);}catch(_0x468854){return BPromise['reject'](_0x468854);}return _0x4fa17e[_0xe55d('0x28')]();};}function saveUpdates(_0x24c392,_0x23068b){return function(_0x438917){if(_0x438917){return _0x438917[_0xe55d('0x29')](_0x24c392)[_0xe55d('0x2a')](function(_0x11dfab){return _0x11dfab;});}return null;};}function removeEntity(_0x28d7cd,_0x5ed742){return function(_0x3e07bd){if(_0x3e07bd){return _0x3e07bd['destroy']()[_0xe55d('0x2a')](function(){var _0x1594a3=_0x3e07bd[_0xe55d('0x2b')]({'plain':!![]});var _0x57ce91='FaxQueues';return db[_0xe55d('0x2c')][_0xe55d('0x2d')]({'where':{'type':_0x57ce91,'resourceId':_0x1594a3['id']}})[_0xe55d('0x2a')](function(){return _0x3e07bd;});})[_0xe55d('0x2a')](function(){_0x28d7cd[_0xe55d('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53ff6d,_0x3cab74){return function(_0x3780d4){if(!_0x3780d4){_0x53ff6d[_0xe55d('0x2e')](0x194);}return _0x3780d4;};}function handleError(_0x496a32,_0xf6f2cd){_0xf6f2cd=_0xf6f2cd||0x1f4;return function(_0x8edbed){logger[_0xe55d('0x2f')](_0x8edbed[_0xe55d('0x30')]);if(_0x8edbed[_0xe55d('0x31')]){delete _0x8edbed[_0xe55d('0x31')];}_0x496a32[_0xe55d('0x1f')](_0xf6f2cd)[_0xe55d('0x32')](_0x8edbed);};}exports[_0xe55d('0x33')]=function(_0x2a05b3,_0x209446){var _0x13f87a={},_0x3d0fde={},_0x4c84fd={'count':0x0,'rows':[]};var _0x89f547=_[_0xe55d('0x34')](db[_0xe55d('0x35')][_0xe55d('0x36')],function(_0x324d16){return{'name':_0x324d16['fieldName'],'type':_0x324d16['type'][_0xe55d('0x37')]};});_0x3d0fde[_0xe55d('0x38')]=_[_0xe55d('0x34')](_0x89f547,_0xe55d('0x31'));_0x3d0fde[_0xe55d('0x39')]=_[_0xe55d('0x3a')](_0x2a05b3[_0xe55d('0x39')]);_0x3d0fde[_0xe55d('0x3b')]=_[_0xe55d('0x3c')](_0x3d0fde['model'],_0x3d0fde[_0xe55d('0x39')]);_0x13f87a[_0xe55d('0x3d')]=_[_0xe55d('0x3c')](_0x3d0fde[_0xe55d('0x38')],qs[_0xe55d('0x3e')](_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x3e')]));_0x13f87a[_0xe55d('0x3d')]=_0x13f87a[_0xe55d('0x3d')][_0xe55d('0x3f')]?_0x13f87a['attributes']:_0x3d0fde['model'];if(!_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x40')](_0xe55d('0x41'))){_0x13f87a[_0xe55d('0x23')]=qs[_0xe55d('0x23')](_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x23')]);_0x13f87a[_0xe55d('0x25')]=qs['offset'](_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x25')]);}_0x13f87a[_0xe55d('0x42')]=qs[_0xe55d('0x43')](_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x43')]);_0x13f87a[_0xe55d('0x44')]=qs[_0xe55d('0x3b')](_[_0xe55d('0x45')](_0x2a05b3[_0xe55d('0x39')],_0x3d0fde[_0xe55d('0x3b')]),_0x89f547);if(_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x46')]){_0x13f87a[_0xe55d('0x44')]=_[_0xe55d('0x47')](_0x13f87a['where'],{'$or':_['map'](_0x89f547,function(_0x5f075e){if(_0x5f075e[_0xe55d('0x48')]!==_0xe55d('0x49')){var _0xbd7df9={};_0xbd7df9[_0x5f075e[_0xe55d('0x31')]]={'$like':'%'+_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x46')]+'%'};return _0xbd7df9;}})});}_0x13f87a=_[_0xe55d('0x47')]({},_0x13f87a,_0x2a05b3['options']);var _0x81f86c={'where':_0x13f87a[_0xe55d('0x44')]};return db[_0xe55d('0x35')]['count'](_0x81f86c)[_0xe55d('0x2a')](function(_0x3d808f){_0x4c84fd['count']=_0x3d808f;if(_0x2a05b3[_0xe55d('0x39')][_0xe55d('0x4a')]){_0x13f87a['include']=[{'all':!![]}];}return db[_0xe55d('0x35')][_0xe55d('0x4b')](_0x13f87a);})[_0xe55d('0x2a')](function(_0x13f0eb){_0x4c84fd[_0xe55d('0x4c')]=_0x13f0eb;return _0x4c84fd;})[_0xe55d('0x2a')](respondWithFilteredResult(_0x209446,_0x13f87a))['catch'](handleError(_0x209446,null));};exports[_0xe55d('0x4d')]=function(_0x26f81a,_0x1d295b){var _0x523781={'raw':!![],'where':{'id':_0x26f81a[_0xe55d('0x4e')]['id']}},_0x35cd69={};_0x35cd69[_0xe55d('0x38')]=_[_0xe55d('0x3a')](db[_0xe55d('0x35')]['rawAttributes']);_0x35cd69['query']=_[_0xe55d('0x3a')](_0x26f81a['query']);_0x35cd69['filters']=_[_0xe55d('0x3c')](_0x35cd69['model'],_0x35cd69[_0xe55d('0x39')]);_0x523781[_0xe55d('0x3d')]=_['intersection'](_0x35cd69[_0xe55d('0x38')],qs['fields'](_0x26f81a[_0xe55d('0x39')][_0xe55d('0x3e')]));_0x523781['attributes']=_0x523781[_0xe55d('0x3d')][_0xe55d('0x3f')]?_0x523781[_0xe55d('0x3d')]:_0x35cd69[_0xe55d('0x38')];if(_0x26f81a[_0xe55d('0x39')][_0xe55d('0x4a')]){_0x523781[_0xe55d('0x4f')]=[{'all':!![]}];}_0x523781=_[_0xe55d('0x47')]({},_0x523781,_0x26f81a[_0xe55d('0x50')]);return db[_0xe55d('0x35')][_0xe55d('0x51')](_0x523781)[_0xe55d('0x2a')](handleEntityNotFound(_0x1d295b,null))['then'](respondWithResult(_0x1d295b,null))[_0xe55d('0x52')](handleError(_0x1d295b,null));};exports[_0xe55d('0x53')]=function(_0x374ce2,_0x4ea3eb){return db[_0xe55d('0x35')][_0xe55d('0x53')](_0x374ce2[_0xe55d('0x54')],{})[_0xe55d('0x2a')](function(_0x822dd7){var _0x5958a7=_0x374ce2[_0xe55d('0x55')][_0xe55d('0x2b')]({'plain':!![]});if(!_0x5958a7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5958a7[_0xe55d('0x56')]===_0xe55d('0x55')){var _0x2d3129=_0x822dd7['get']({'plain':!![]});var _0x5a7d7c=_0xe55d('0x57');return db['UserProfileSection'][_0xe55d('0x51')]({'where':{'name':_0x5a7d7c,'userProfileId':_0x5958a7[_0xe55d('0x58')]},'raw':!![]})['then'](function(_0x5e239a){if(_0x5e239a&&_0x5e239a['autoAssociation']===0x0){return db[_0xe55d('0x2c')]['create']({'name':_0x2d3129['name'],'resourceId':_0x2d3129['id'],'type':_0x5e239a[_0xe55d('0x31')],'sectionId':_0x5e239a['id']},{})[_0xe55d('0x2a')](function(){return _0x822dd7;});}else{return _0x822dd7;}})['catch'](function(_0x46bffe){logger[_0xe55d('0x2f')](_0xe55d('0x59'),_0x46bffe);throw _0x46bffe;});}return _0x822dd7;})[_0xe55d('0x2a')](respondWithResult(_0x4ea3eb,0xc9))[_0xe55d('0x52')](handleError(_0x4ea3eb,null));};exports[_0xe55d('0x29')]=function(_0xdd8228,_0x4f14f9){if(_0xdd8228[_0xe55d('0x54')]['id']){delete _0xdd8228[_0xe55d('0x54')]['id'];}return db[_0xe55d('0x35')][_0xe55d('0x51')]({'where':{'id':_0xdd8228[_0xe55d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4f14f9,null))[_0xe55d('0x2a')](saveUpdates(_0xdd8228[_0xe55d('0x54')],null))[_0xe55d('0x2a')](respondWithResult(_0x4f14f9,null))['catch'](handleError(_0x4f14f9,null));};exports['destroy']=function(_0x4a2525,_0x8b7934){return db['FaxQueue'][_0xe55d('0x51')]({'where':{'id':_0x4a2525['params']['id']}})[_0xe55d('0x2a')](handleEntityNotFound(_0x8b7934,null))[_0xe55d('0x2a')](removeEntity(_0x8b7934,null))[_0xe55d('0x52')](handleError(_0x8b7934,null));};exports[_0xe55d('0x5a')]=function(_0x3402b5,_0x42de19){return db[_0xe55d('0x35')][_0xe55d('0x5a')]()['then'](respondWithResult(_0x42de19,null))[_0xe55d('0x52')](handleError(_0x42de19,null));};exports['getMembers']=function(_0x387356,_0x17da09,_0x5fa478){var _0x378ad3={'raw':!![],'where':{}},_0x558040={},_0x15a661;return db['FaxQueue'][_0xe55d('0x5b')]({'where':{'id':_0x387356['params']['id']}})[_0xe55d('0x2a')](handleEntityNotFound(_0x17da09,null))[_0xe55d('0x2a')](function(_0x1df8a1){if(_0x1df8a1){_0x15a661=_0x1df8a1[_0xe55d('0x2b')]({'plain':!![]});_0x558040['model']=_[_0xe55d('0x3a')](db[_0xe55d('0x5c')]['rawAttributes']);_0x558040[_0xe55d('0x39')]=_[_0xe55d('0x3a')](_0x387356[_0xe55d('0x39')]);_0x558040[_0xe55d('0x3b')]=_[_0xe55d('0x3c')](_0x558040[_0xe55d('0x38')],_0x558040[_0xe55d('0x39')]);_0x378ad3[_0xe55d('0x3d')]=_[_0xe55d('0x3c')](_0x558040[_0xe55d('0x38')],qs[_0xe55d('0x3e')](_0x387356['query'][_0xe55d('0x3e')]));_0x378ad3[_0xe55d('0x3d')]=_0x378ad3[_0xe55d('0x3d')][_0xe55d('0x3f')]?_0x378ad3['attributes']:_0x558040[_0xe55d('0x38')];if(!_0x387356[_0xe55d('0x39')][_0xe55d('0x40')](_0xe55d('0x41'))){_0x378ad3['limit']=qs[_0xe55d('0x23')](_0x387356[_0xe55d('0x39')][_0xe55d('0x23')]);_0x378ad3[_0xe55d('0x25')]=qs['offset'](_0x387356[_0xe55d('0x39')][_0xe55d('0x25')]);}_0x378ad3[_0xe55d('0x42')]=qs['sort'](_0x387356[_0xe55d('0x39')][_0xe55d('0x43')]);_0x378ad3[_0xe55d('0x44')]=qs[_0xe55d('0x3b')](_['pick'](_0x387356['query'],_0x558040[_0xe55d('0x3b')]));_0x378ad3[_0xe55d('0x44')][_0xe55d('0x5d')]=_0x1df8a1['id'];if(_0x387356[_0xe55d('0x39')][_0xe55d('0x46')]){_0x378ad3[_0xe55d('0x44')]=_['merge'](_0x378ad3[_0xe55d('0x44')],{'$or':_['map'](_0x378ad3['attributes'],function(_0x347f56){var _0x319077={};_0x319077[_0x347f56]={'$like':'%'+_0x387356['query'][_0xe55d('0x46')]+'%'};return _0x319077;})});}_0x378ad3=_[_0xe55d('0x47')]({},_0x378ad3,_0x387356[_0xe55d('0x50')]);return db['UserFaxQueue'][_0xe55d('0x4b')](_0x378ad3);}})[_0xe55d('0x2a')](function(_0x5670f1){if(_0x5670f1){return db['User']['findAndCountAll']({'where':{'id':_['map'](_0x5670f1,_0xe55d('0x5e')),'role':_0xe55d('0x5f')},'attributes':['id',_0xe55d('0x31'),_0xe55d('0x60'),'updatedAt',_0xe55d('0x61')]});}})['then'](function(_0x4d6fc5){if(_0x4d6fc5){return{'count':_0x4d6fc5['count'],'rows':_[_0xe55d('0x34')](_0x4d6fc5[_0xe55d('0x4c')],function(_0x20f387){return{'membername':_0x20f387['name'],'UserId':_0x20f387['id'],'queue_name':_0x15a661[_0xe55d('0x31')],'FaxQueueId':_0x15a661['id'],'interface':util[_0xe55d('0x62')](_0xe55d('0x63'),_0xe55d('0x64'),_0x20f387['name']),'penalty':0x0,'paused':_0x20f387[_0xe55d('0x60')],'createdAt':_0x20f387['createdAt'],'updatedAt':_0x20f387['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xe55d('0x2a')](respondWithFilteredResult(_0x17da09,_0x378ad3))['catch'](handleError(_0x17da09,null));};exports[_0xe55d('0x65')]=function(_0x2e195d,_0x1f2147,_0x32db63){var _0xeb23a3={};var _0x51357b={};var _0x534f31;var _0x186734;return db[_0xe55d('0x35')][_0xe55d('0x5b')]({'where':{'id':_0x2e195d[_0xe55d('0x4e')]['id']}})[_0xe55d('0x2a')](handleEntityNotFound(_0x1f2147,null))[_0xe55d('0x2a')](function(_0x86ae77){if(_0x86ae77){_0x534f31=_0x86ae77;_0x51357b[_0xe55d('0x38')]=_[_0xe55d('0x3a')](db[_0xe55d('0x66')][_0xe55d('0x36')]);_0x51357b[_0xe55d('0x39')]=_[_0xe55d('0x3a')](_0x2e195d[_0xe55d('0x39')]);_0x51357b[_0xe55d('0x3b')]=_[_0xe55d('0x3c')](_0x51357b[_0xe55d('0x38')],_0x51357b[_0xe55d('0x39')]);_0xeb23a3['attributes']=_['intersection'](_0x51357b[_0xe55d('0x38')],qs[_0xe55d('0x3e')](_0x2e195d[_0xe55d('0x39')]['fields']));_0xeb23a3[_0xe55d('0x3d')]=_0xeb23a3[_0xe55d('0x3d')]['length']?_0xeb23a3[_0xe55d('0x3d')]:_0x51357b[_0xe55d('0x38')];_0xeb23a3[_0xe55d('0x42')]=qs[_0xe55d('0x43')](_0x2e195d[_0xe55d('0x39')][_0xe55d('0x43')]);_0xeb23a3[_0xe55d('0x44')]=qs['filters'](_[_0xe55d('0x45')](_0x2e195d[_0xe55d('0x39')],_0x51357b[_0xe55d('0x3b')]));if(_0x2e195d['query'][_0xe55d('0x46')]){_0xeb23a3[_0xe55d('0x44')]=_[_0xe55d('0x47')](_0xeb23a3[_0xe55d('0x44')],{'$or':_['map'](_0xeb23a3[_0xe55d('0x3d')],function(_0x3e1e2f){var _0x1da5b3={};_0x1da5b3[_0x3e1e2f]={'$like':'%'+_0x2e195d[_0xe55d('0x39')][_0xe55d('0x46')]+'%'};return _0x1da5b3;})});}_0xeb23a3=_[_0xe55d('0x47')]({},_0xeb23a3,_0x2e195d['options']);return _0x534f31[_0xe55d('0x65')](_0xeb23a3);}})[_0xe55d('0x2a')](function(_0x3ee9e7){if(_0x3ee9e7){_0x186734=_0x3ee9e7[_0xe55d('0x3f')];if(!_0x2e195d['query'][_0xe55d('0x40')](_0xe55d('0x41'))){_0xeb23a3['limit']=qs['limit'](_0x2e195d['query'][_0xe55d('0x23')]);_0xeb23a3[_0xe55d('0x25')]=qs[_0xe55d('0x25')](_0x2e195d[_0xe55d('0x39')][_0xe55d('0x25')]);}return _0x534f31[_0xe55d('0x65')](_0xeb23a3);}})[_0xe55d('0x2a')](function(_0xd188af){if(_0xd188af){return _0xd188af?{'count':_0x186734,'rows':_0xd188af}:null;}})[_0xe55d('0x2a')](respondWithResult(_0x1f2147,null))['catch'](handleError(_0x1f2147,null));};exports[_0xe55d('0x67')]=function(_0x5c5957,_0x576476,_0x4aa5e2){var _0x69aab7=_0x5c5957['body'][_0xe55d('0x68')];return db[_0xe55d('0x66')][_0xe55d('0x4b')]({'where':{'id':_0x69aab7},'attributes':['id'],'include':[{'model':db[_0xe55d('0x69')],'as':_0xe55d('0x6a'),'attributes':['id','name',_0xe55d('0x6b'),_0xe55d('0x6c'),_0xe55d('0x6d')],'raw':!![]}]})[_0xe55d('0x2a')](function(_0x24e9e5){if(_0x24e9e5){var _0x4396dd=_[_0xe55d('0x6e')](_0x24e9e5,function(_0x1db6db){var _0x152d00=_0x1db6db[_0xe55d('0x2b')]({'plain':!![]});return _0x152d00['Agents'];});return db[_0xe55d('0x35')][_0xe55d('0x51')]({'where':{'id':_0x5c5957[_0xe55d('0x4e')]['id']}})[_0xe55d('0x2a')](function(_0x421813){return db[_0xe55d('0x6f')][_0xe55d('0x70')](function(_0x3de861){return _0x421813[_0xe55d('0x67')](_0x69aab7,{'transaction':_0x3de861})[_0xe55d('0x2a')](function(){return BPromise['each'](_0x4396dd,function(_0x257b37){return db[_0xe55d('0x5c')]['findOrCreate']({'where':{'UserId':_0x257b37['id'],'FaxQueueId':_0x5c5957[_0xe55d('0x4e')]['id']},'transaction':_0x3de861});});})['then'](function(){_0x4396dd['forEach'](function(_0x5ec8cc){socket[_0xe55d('0x71')](_0xe55d('0x72'),{'UserId':_0x5ec8cc['id'],'FaxQueueId':_0x421813['id']});});});});});}})[_0xe55d('0x2a')](respondWithStatusCode(_0x576476,null))['catch'](handleError(_0x576476,null));};exports[_0xe55d('0x73')]=function(_0x2a5a13,_0x9932c4,_0x443e1e){return db[_0xe55d('0x66')][_0xe55d('0x4b')]({'where':{'id':_0x2a5a13[_0xe55d('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xe55d('0x69')],'as':_0xe55d('0x6a'),'attributes':['id'],'raw':!![]}]})[_0xe55d('0x2a')](handleEntityNotFound(_0x9932c4,null))[_0xe55d('0x2a')](function(_0x4c091d){var _0xe2671a=_[_0xe55d('0x34')](_0x4c091d,'id');var _0x4cf6bf=[];var _0x33d42f=[];var _0x401264=squel[_0xe55d('0x74')]();_0x401264[_0xe55d('0x75')](_0xe55d('0x76'))[_0xe55d('0x77')](_0xe55d('0x78'),'tq')[_0xe55d('0x79')]('user_has_teams','ut',_0xe55d('0x7a'))[_0xe55d('0x44')]('FaxQueueId\x20=\x20?',_0x2a5a13[_0xe55d('0x4e')]['id']);for(var _0x297d42=0x0;_0x297d42<_0x4c091d['length'];_0x297d42+=0x1){let _0x591641=_0x4c091d[_0x297d42];for(var _0x344856=0x0;_0x344856<_0x591641[_0xe55d('0x6a')][_0xe55d('0x3f')];_0x344856+=0x1){let _0x504c01=_0x591641['Agents'][_0x344856];var _0x396d78=_0x401264[_0xe55d('0x7b')]();_0x396d78[_0xe55d('0x44')](_0xe55d('0x7c'),_0x504c01['id']);_0x33d42f[_0xe55d('0x7d')](db[_0xe55d('0x6f')][_0xe55d('0x39')](_0x396d78[_0xe55d('0x7e')](),{'type':db['sequelize'][_0xe55d('0x7f')][_0xe55d('0x80')]})[_0xe55d('0x2a')](function(_0x2e97b6){if(_0x2e97b6[_0xe55d('0x3f')]===0x1){return _0x504c01['id'];}else{var _0x28f0f9=_[_0xe55d('0x81')](_[_0xe55d('0x34')](_0x2e97b6,'TeamId'),function(_0x39a518){return _[_0xe55d('0x82')](_0xe2671a,_0x39a518);});if(_0x28f0f9){return _0x504c01['id'];}}}));}}return BPromise[_0xe55d('0x83')](_0x33d42f)['then'](function(_0x3b63d0){_0x4cf6bf=_(_0x4cf6bf)[_0xe55d('0x84')](_0x3b63d0)[_0xe55d('0x85')]()[_0xe55d('0x86')]();return db[_0xe55d('0x35')][_0xe55d('0x51')]({'where':{'id':_0x2a5a13['params']['id']}})['then'](function(_0x40788c){return db[_0xe55d('0x6f')][_0xe55d('0x70')](function(_0x393214){return _0x40788c[_0xe55d('0x73')](_0x2a5a13[_0xe55d('0x39')]['ids'],{'transaction':_0x393214})[_0xe55d('0x2a')](function(){if(!_[_0xe55d('0x87')](_0x4cf6bf)){return _0x40788c[_0xe55d('0x88')](_0x4cf6bf,{'transaction':_0x393214});}})[_0xe55d('0x2a')](function(){_0x4cf6bf['forEach'](function(_0x51fc26){socket['emit']('userFaxQueue:remove',{'UserId':_0x51fc26,'FaxQueueId':_0x40788c['id']});});});});});});})['then'](respondWithStatusCode(_0x9932c4,null))[_0xe55d('0x52')](handleError(_0x9932c4,null));};exports['addAgents']=function(_0x4c49ff,_0xe9bf1b,_0x545a21){return db['FaxQueue'][_0xe55d('0x51')]({'where':{'id':_0x4c49ff[_0xe55d('0x4e')]['id']}})['then'](handleEntityNotFound(_0xe9bf1b,null))[_0xe55d('0x2a')](function(_0x50f700){if(_0x50f700){return _0x50f700['addAgents'](_0x4c49ff[_0xe55d('0x54')][_0xe55d('0x68')],_['omit'](_0x4c49ff['body'],[_0xe55d('0x68'),'id'])||{})['spread'](function(_0x13904e){for(var _0xc4cba=0x0;_0xc4cba<_0x4c49ff[_0xe55d('0x54')][_0xe55d('0x68')][_0xe55d('0x3f')];_0xc4cba+=0x1){socket[_0xe55d('0x71')](_0xe55d('0x72'),{'UserId':Number(_0x4c49ff[_0xe55d('0x54')]['ids'][_0xc4cba]),'FaxQueueId':Number(_0x4c49ff['params']['id'])});}return _0x13904e;});}})[_0xe55d('0x2a')](respondWithResult(_0xe9bf1b,null))[_0xe55d('0x52')](handleError(_0xe9bf1b,null));};exports[_0xe55d('0x88')]=function(_0x382026,_0x903847,_0x4975b0){return db[_0xe55d('0x35')]['find']({'where':{'id':_0x382026[_0xe55d('0x4e')]['id']}})[_0xe55d('0x2a')](handleEntityNotFound(_0x903847,null))[_0xe55d('0x2a')](function(_0x5544e0){if(_0x5544e0){return _0x5544e0[_0xe55d('0x88')](_0x382026[_0xe55d('0x39')][_0xe55d('0x68')])[_0xe55d('0x2a')](function(){if(_[_0xe55d('0x89')](_0x382026[_0xe55d('0x39')]['ids'])){for(var _0x34a0dc=0x0;_0x34a0dc<_0x382026['query'][_0xe55d('0x68')][_0xe55d('0x3f')];_0x34a0dc+=0x1){socket[_0xe55d('0x71')](_0xe55d('0x8a'),{'UserId':Number(_0x382026[_0xe55d('0x39')][_0xe55d('0x68')][_0x34a0dc]),'FaxQueueId':Number(_0x382026[_0xe55d('0x4e')]['id'])});}}else{socket[_0xe55d('0x71')](_0xe55d('0x8a'),{'UserId':Number(_0x382026['query'][_0xe55d('0x68')]),'FaxQueueId':Number(_0x382026[_0xe55d('0x4e')]['id'])});}});}})[_0xe55d('0x2a')](respondWithStatusCode(_0x903847,null))[_0xe55d('0x52')](handleError(_0x903847,null));};exports[_0xe55d('0x8b')]=function(_0x15a6ea,_0x20c8c3,_0x383264){var _0x32053d={};var _0x4dca65={};var _0xd0c52;var _0x5491cb;return db[_0xe55d('0x35')]['findOne']({'where':{'id':_0x15a6ea[_0xe55d('0x4e')]['id']}})[_0xe55d('0x2a')](handleEntityNotFound(_0x20c8c3,null))[_0xe55d('0x2a')](function(_0x5dcace){if(_0x5dcace){_0xd0c52=_0x5dcace;_0x4dca65[_0xe55d('0x38')]=_['keys'](db[_0xe55d('0x69')]['rawAttributes']);_0x4dca65[_0xe55d('0x39')]=_[_0xe55d('0x3a')](_0x15a6ea[_0xe55d('0x39')]);_0x4dca65[_0xe55d('0x3b')]=_[_0xe55d('0x3c')](_0x4dca65[_0xe55d('0x38')],_0x4dca65[_0xe55d('0x39')]);_0x32053d['attributes']=_[_0xe55d('0x3c')](_0x4dca65[_0xe55d('0x38')],qs[_0xe55d('0x3e')](_0x15a6ea['query'][_0xe55d('0x3e')]));_0x32053d['attributes']=_0x32053d[_0xe55d('0x3d')][_0xe55d('0x3f')]?_0x32053d[_0xe55d('0x3d')]:_0x4dca65[_0xe55d('0x38')];_0x32053d[_0xe55d('0x42')]=qs['sort'](_0x15a6ea[_0xe55d('0x39')][_0xe55d('0x43')]);_0x32053d[_0xe55d('0x44')]=qs[_0xe55d('0x3b')](_[_0xe55d('0x45')](_0x15a6ea['query'],_0x4dca65[_0xe55d('0x3b')]));if(_0x15a6ea[_0xe55d('0x39')][_0xe55d('0x46')]){_0x32053d[_0xe55d('0x44')]=_[_0xe55d('0x47')](_0x32053d[_0xe55d('0x44')],{'$or':_[_0xe55d('0x34')](_0x32053d[_0xe55d('0x3d')],function(_0x588798){var _0x411b25={};_0x411b25[_0x588798]={'$like':'%'+_0x15a6ea[_0xe55d('0x39')]['filter']+'%'};return _0x411b25;})});}_0x32053d=_[_0xe55d('0x47')]({},_0x32053d,_0x15a6ea[_0xe55d('0x50')]);return _0xd0c52[_0xe55d('0x8b')](_0x32053d);}})[_0xe55d('0x2a')](function(_0x2f61bc){if(_0x2f61bc){_0x5491cb=_0x2f61bc['length'];if(!_0x15a6ea[_0xe55d('0x39')][_0xe55d('0x40')](_0xe55d('0x41'))){_0x32053d[_0xe55d('0x23')]=qs['limit'](_0x15a6ea[_0xe55d('0x39')][_0xe55d('0x23')]);_0x32053d[_0xe55d('0x25')]=qs[_0xe55d('0x25')](_0x15a6ea[_0xe55d('0x39')]['offset']);}return _0xd0c52['getAgents'](_0x32053d);}})[_0xe55d('0x2a')](function(_0x5ca031){if(_0x5ca031){return _0x5ca031?{'count':_0x5491cb,'rows':_0x5ca031}:null;}})[_0xe55d('0x2a')](respondWithResult(_0x20c8c3,null))[_0xe55d('0x52')](handleError(_0x20c8c3,null));}; \ No newline at end of file +var _0xd5e3=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./faxQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','FaxQueue','rows','show','params','includeAll','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','order','FaxQueueId','findAll','User','UserId','agent','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','addTeams','ids','Agents','sequelize','transaction','each','UserFaxQueue','findOrCreate','emit','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','spread','userFaxQueue:remove','getAgents','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x47cf0b,_0x538972){var _0x58f96a=function(_0x27ac42){while(--_0x27ac42){_0x47cf0b['push'](_0x47cf0b['shift']());}};_0x58f96a(++_0x538972);}(_0xd5e3,0x104));var _0x3d5e=function(_0x5c2f1e,_0x10a084){_0x5c2f1e=_0x5c2f1e-0x0;var _0x30a402=_0xd5e3[_0x5c2f1e];return _0x30a402;};'use strict';var emlformat=require(_0x3d5e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3d5e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3d5e('0x2'));var moment=require(_0x3d5e('0x3'));var BPromise=require(_0x3d5e('0x4'));var Mustache=require(_0x3d5e('0x5'));var util=require(_0x3d5e('0x6'));var path=require(_0x3d5e('0x7'));var sox=require('sox');var csv=require(_0x3d5e('0x8'));var ejs=require(_0x3d5e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3d5e('0xa'));var crypto=require(_0x3d5e('0xb'));var jsforce=require(_0x3d5e('0xc'));var deskjs=require(_0x3d5e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x3d5e('0xe'));var Papa=require(_0x3d5e('0xf'));var Redis=require('ioredis');var authService=require(_0x3d5e('0x10'));var qs=require(_0x3d5e('0x11'));var as=require(_0x3d5e('0x12'));var hardwareService=require(_0x3d5e('0x13'));var logger=require(_0x3d5e('0x14'))(_0x3d5e('0x15'));var utils=require(_0x3d5e('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3d5e('0x17'));var db=require(_0x3d5e('0x18'))['db'];config['redis']=_[_0x3d5e('0x19')](config['redis'],{'host':_0x3d5e('0x1a'),'port':0x18eb});var socket=require(_0x3d5e('0x1b'))(new Redis(config[_0x3d5e('0x1c')]));require(_0x3d5e('0x1d'))['register'](socket);function respondWithStatusCode(_0x339284,_0x2c04f1){_0x2c04f1=_0x2c04f1||0xcc;return function(_0x281d66){if(_0x281d66){return _0x339284[_0x3d5e('0x1e')](_0x2c04f1);}return _0x339284[_0x3d5e('0x1f')](_0x2c04f1)[_0x3d5e('0x20')]();};}function respondWithResult(_0x40bd57,_0x4ac337){_0x4ac337=_0x4ac337||0xc8;return function(_0x2c4798){if(_0x2c4798){return _0x40bd57['status'](_0x4ac337)[_0x3d5e('0x21')](_0x2c4798);}};}function respondWithFilteredResult(_0x9257d1,_0x5a2876){return function(_0x55efeb){if(_0x55efeb){var _0x151f70=typeof _0x5a2876[_0x3d5e('0x22')]===_0x3d5e('0x23')&&typeof _0x5a2876[_0x3d5e('0x24')]===_0x3d5e('0x23');var _0x407e29=_0x55efeb[_0x3d5e('0x25')];var _0x4e47ae=_0x151f70?0x0:_0x5a2876[_0x3d5e('0x22')];var _0x29bc7e=_0x151f70?_0x55efeb['count']:_0x5a2876[_0x3d5e('0x22')]+_0x5a2876[_0x3d5e('0x24')];var _0x3cc5fa;if(_0x29bc7e>=_0x407e29){_0x29bc7e=_0x407e29;_0x3cc5fa=0xc8;}else{_0x3cc5fa=0xce;}_0x9257d1[_0x3d5e('0x1f')](_0x3cc5fa);return _0x9257d1[_0x3d5e('0x26')](_0x3d5e('0x27'),_0x4e47ae+'-'+_0x29bc7e+'/'+_0x407e29)[_0x3d5e('0x21')](_0x55efeb);}return null;};}function patchUpdates(_0x350b30){return function(_0x33f912){try{jsonpatch['apply'](_0x33f912,_0x350b30,!![]);}catch(_0x34f629){return BPromise[_0x3d5e('0x28')](_0x34f629);}return _0x33f912[_0x3d5e('0x29')]();};}function saveUpdates(_0x4cba73,_0x3a32c1){return function(_0x42220c){if(_0x42220c){return _0x42220c[_0x3d5e('0x2a')](_0x4cba73)[_0x3d5e('0x2b')](function(_0x13fd5a){return _0x13fd5a;});}return null;};}function removeEntity(_0x3ecc40,_0x4c4bf0){return function(_0x59d555){if(_0x59d555){return _0x59d555[_0x3d5e('0x2c')]()[_0x3d5e('0x2b')](function(){var _0x5977bf=_0x59d555[_0x3d5e('0x2d')]({'plain':!![]});var _0x451fe4='FaxQueues';return db[_0x3d5e('0x2e')][_0x3d5e('0x2c')]({'where':{'type':_0x451fe4,'resourceId':_0x5977bf['id']}})[_0x3d5e('0x2b')](function(){return _0x59d555;});})[_0x3d5e('0x2b')](function(){_0x3ecc40[_0x3d5e('0x1f')](0xcc)[_0x3d5e('0x20')]();});}};}function handleEntityNotFound(_0x5aa550,_0x4d9cb3){return function(_0x17d12d){if(!_0x17d12d){_0x5aa550[_0x3d5e('0x1e')](0x194);}return _0x17d12d;};}function handleError(_0x52da65,_0x1afe25){_0x1afe25=_0x1afe25||0x1f4;return function(_0x4a9d35){logger[_0x3d5e('0x2f')](_0x4a9d35[_0x3d5e('0x30')]);if(_0x4a9d35['name']){delete _0x4a9d35[_0x3d5e('0x31')];}_0x52da65['status'](_0x1afe25)[_0x3d5e('0x32')](_0x4a9d35);};}exports['index']=function(_0x1eab50,_0xdbaaf5){var _0x1a4058={},_0x348100={},_0x26b609={'count':0x0,'rows':[]};var _0x5c5f71=_['map'](db['FaxQueue'][_0x3d5e('0x33')],function(_0x210809){return{'name':_0x210809[_0x3d5e('0x34')],'type':_0x210809[_0x3d5e('0x35')]['key']};});_0x348100[_0x3d5e('0x36')]=_[_0x3d5e('0x37')](_0x5c5f71,_0x3d5e('0x31'));_0x348100[_0x3d5e('0x38')]=_[_0x3d5e('0x39')](_0x1eab50[_0x3d5e('0x38')]);_0x348100[_0x3d5e('0x3a')]=_[_0x3d5e('0x3b')](_0x348100[_0x3d5e('0x36')],_0x348100[_0x3d5e('0x38')]);_0x1a4058[_0x3d5e('0x3c')]=_[_0x3d5e('0x3b')](_0x348100['model'],qs['fields'](_0x1eab50[_0x3d5e('0x38')][_0x3d5e('0x3d')]));_0x1a4058[_0x3d5e('0x3c')]=_0x1a4058[_0x3d5e('0x3c')][_0x3d5e('0x3e')]?_0x1a4058[_0x3d5e('0x3c')]:_0x348100['model'];if(!_0x1eab50[_0x3d5e('0x38')]['hasOwnProperty'](_0x3d5e('0x3f'))){_0x1a4058[_0x3d5e('0x24')]=qs[_0x3d5e('0x24')](_0x1eab50[_0x3d5e('0x38')][_0x3d5e('0x24')]);_0x1a4058['offset']=qs[_0x3d5e('0x22')](_0x1eab50[_0x3d5e('0x38')][_0x3d5e('0x22')]);}_0x1a4058['order']=qs[_0x3d5e('0x40')](_0x1eab50[_0x3d5e('0x38')][_0x3d5e('0x40')]);_0x1a4058[_0x3d5e('0x41')]=qs[_0x3d5e('0x3a')](_[_0x3d5e('0x42')](_0x1eab50['query'],_0x348100[_0x3d5e('0x3a')]),_0x5c5f71);if(_0x1eab50[_0x3d5e('0x38')][_0x3d5e('0x43')]){_0x1a4058[_0x3d5e('0x41')]=_[_0x3d5e('0x44')](_0x1a4058[_0x3d5e('0x41')],{'$or':_['map'](_0x5c5f71,function(_0x3cabbe){if(_0x3cabbe[_0x3d5e('0x35')]!==_0x3d5e('0x45')){var _0x47a61c={};_0x47a61c[_0x3cabbe[_0x3d5e('0x31')]]={'$like':'%'+_0x1eab50[_0x3d5e('0x38')][_0x3d5e('0x43')]+'%'};return _0x47a61c;}})});}_0x1a4058=_['merge']({},_0x1a4058,_0x1eab50[_0x3d5e('0x46')]);var _0x3c1a5f={'where':_0x1a4058[_0x3d5e('0x41')]};return db['FaxQueue'][_0x3d5e('0x25')](_0x3c1a5f)[_0x3d5e('0x2b')](function(_0x2e9765){_0x26b609['count']=_0x2e9765;if(_0x1eab50[_0x3d5e('0x38')]['includeAll']){_0x1a4058[_0x3d5e('0x47')]=[{'all':!![]}];}return db[_0x3d5e('0x48')]['findAll'](_0x1a4058);})[_0x3d5e('0x2b')](function(_0x2fb490){_0x26b609[_0x3d5e('0x49')]=_0x2fb490;return _0x26b609;})[_0x3d5e('0x2b')](respondWithFilteredResult(_0xdbaaf5,_0x1a4058))['catch'](handleError(_0xdbaaf5,null));};exports[_0x3d5e('0x4a')]=function(_0x3e2361,_0x36fed8){var _0x41ea59={'raw':!![],'where':{'id':_0x3e2361[_0x3d5e('0x4b')]['id']}},_0x87d1a0={};_0x87d1a0['model']=_[_0x3d5e('0x39')](db[_0x3d5e('0x48')][_0x3d5e('0x33')]);_0x87d1a0['query']=_[_0x3d5e('0x39')](_0x3e2361[_0x3d5e('0x38')]);_0x87d1a0[_0x3d5e('0x3a')]=_['intersection'](_0x87d1a0[_0x3d5e('0x36')],_0x87d1a0[_0x3d5e('0x38')]);_0x41ea59[_0x3d5e('0x3c')]=_['intersection'](_0x87d1a0['model'],qs['fields'](_0x3e2361[_0x3d5e('0x38')][_0x3d5e('0x3d')]));_0x41ea59[_0x3d5e('0x3c')]=_0x41ea59['attributes'][_0x3d5e('0x3e')]?_0x41ea59[_0x3d5e('0x3c')]:_0x87d1a0[_0x3d5e('0x36')];if(_0x3e2361['query'][_0x3d5e('0x4c')]){_0x41ea59[_0x3d5e('0x47')]=[{'all':!![]}];}_0x41ea59=_[_0x3d5e('0x44')]({},_0x41ea59,_0x3e2361[_0x3d5e('0x46')]);return db['FaxQueue']['find'](_0x41ea59)['then'](handleEntityNotFound(_0x36fed8,null))[_0x3d5e('0x2b')](respondWithResult(_0x36fed8,null))[_0x3d5e('0x4d')](handleError(_0x36fed8,null));};exports[_0x3d5e('0x4e')]=function(_0x15bf64,_0x534089){return db[_0x3d5e('0x48')][_0x3d5e('0x4e')](_0x15bf64[_0x3d5e('0x4f')],{})[_0x3d5e('0x2b')](function(_0x3c20dc){var _0x31feef=_0x15bf64[_0x3d5e('0x50')]['get']({'plain':!![]});if(!_0x31feef)throw new Error(_0x3d5e('0x51'));if(_0x31feef[_0x3d5e('0x52')]===_0x3d5e('0x50')){var _0xc28eb9=_0x3c20dc['get']({'plain':!![]});var _0x279487=_0x3d5e('0x53');return db[_0x3d5e('0x54')][_0x3d5e('0x55')]({'where':{'name':_0x279487,'userProfileId':_0x31feef[_0x3d5e('0x56')]},'raw':!![]})['then'](function(_0x48b32a){if(_0x48b32a&&_0x48b32a[_0x3d5e('0x57')]===0x0){return db[_0x3d5e('0x2e')]['create']({'name':_0xc28eb9[_0x3d5e('0x31')],'resourceId':_0xc28eb9['id'],'type':_0x48b32a[_0x3d5e('0x31')],'sectionId':_0x48b32a['id']},{})['then'](function(){return _0x3c20dc;});}else{return _0x3c20dc;}})[_0x3d5e('0x4d')](function(_0x4ad9c1){logger[_0x3d5e('0x2f')](_0x3d5e('0x58'),_0x4ad9c1);throw _0x4ad9c1;});}return _0x3c20dc;})[_0x3d5e('0x2b')](respondWithResult(_0x534089,0xc9))[_0x3d5e('0x4d')](handleError(_0x534089,null));};exports[_0x3d5e('0x2a')]=function(_0x478e10,_0x4fec4d){if(_0x478e10[_0x3d5e('0x4f')]['id']){delete _0x478e10[_0x3d5e('0x4f')]['id'];}return db['FaxQueue'][_0x3d5e('0x55')]({'where':{'id':_0x478e10[_0x3d5e('0x4b')]['id']}})[_0x3d5e('0x2b')](handleEntityNotFound(_0x4fec4d,null))[_0x3d5e('0x2b')](saveUpdates(_0x478e10[_0x3d5e('0x4f')],null))[_0x3d5e('0x2b')](respondWithResult(_0x4fec4d,null))['catch'](handleError(_0x4fec4d,null));};exports[_0x3d5e('0x2c')]=function(_0xf5b2a0,_0x14c572){return db['FaxQueue'][_0x3d5e('0x55')]({'where':{'id':_0xf5b2a0['params']['id']}})[_0x3d5e('0x2b')](handleEntityNotFound(_0x14c572,null))[_0x3d5e('0x2b')](removeEntity(_0x14c572,null))[_0x3d5e('0x4d')](handleError(_0x14c572,null));};exports[_0x3d5e('0x59')]=function(_0x1b1c28,_0x4fbf3a){return db[_0x3d5e('0x48')][_0x3d5e('0x59')]()[_0x3d5e('0x2b')](respondWithResult(_0x4fbf3a,null))[_0x3d5e('0x4d')](handleError(_0x4fbf3a,null));};exports['getMembers']=function(_0x36cd63,_0x3b4aa5,_0x1f441f){var _0x1895db={'raw':!![],'where':{}},_0x25dc0a={},_0x2817ee;return db[_0x3d5e('0x48')]['findOne']({'where':{'id':_0x36cd63[_0x3d5e('0x4b')]['id']}})[_0x3d5e('0x2b')](handleEntityNotFound(_0x3b4aa5,null))[_0x3d5e('0x2b')](function(_0x5ff5f4){if(_0x5ff5f4){_0x2817ee=_0x5ff5f4[_0x3d5e('0x2d')]({'plain':!![]});_0x25dc0a['model']=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x25dc0a[_0x3d5e('0x38')]=_['keys'](_0x36cd63[_0x3d5e('0x38')]);_0x25dc0a[_0x3d5e('0x3a')]=_['intersection'](_0x25dc0a[_0x3d5e('0x36')],_0x25dc0a[_0x3d5e('0x38')]);_0x1895db[_0x3d5e('0x3c')]=_[_0x3d5e('0x3b')](_0x25dc0a[_0x3d5e('0x36')],qs[_0x3d5e('0x3d')](_0x36cd63[_0x3d5e('0x38')][_0x3d5e('0x3d')]));_0x1895db['attributes']=_0x1895db[_0x3d5e('0x3c')][_0x3d5e('0x3e')]?_0x1895db['attributes']:_0x25dc0a[_0x3d5e('0x36')];if(!_0x36cd63[_0x3d5e('0x38')]['hasOwnProperty'](_0x3d5e('0x3f'))){_0x1895db[_0x3d5e('0x24')]=qs[_0x3d5e('0x24')](_0x36cd63[_0x3d5e('0x38')]['limit']);_0x1895db[_0x3d5e('0x22')]=qs[_0x3d5e('0x22')](_0x36cd63[_0x3d5e('0x38')][_0x3d5e('0x22')]);}_0x1895db[_0x3d5e('0x5a')]=qs['sort'](_0x36cd63['query'][_0x3d5e('0x40')]);_0x1895db[_0x3d5e('0x41')]=qs[_0x3d5e('0x3a')](_[_0x3d5e('0x42')](_0x36cd63[_0x3d5e('0x38')],_0x25dc0a[_0x3d5e('0x3a')]));_0x1895db[_0x3d5e('0x41')][_0x3d5e('0x5b')]=_0x5ff5f4['id'];if(_0x36cd63[_0x3d5e('0x38')][_0x3d5e('0x43')]){_0x1895db['where']=_[_0x3d5e('0x44')](_0x1895db[_0x3d5e('0x41')],{'$or':_['map'](_0x1895db[_0x3d5e('0x3c')],function(_0x371cba){var _0x3ed6e7={};_0x3ed6e7[_0x371cba]={'$like':'%'+_0x36cd63[_0x3d5e('0x38')]['filter']+'%'};return _0x3ed6e7;})});}_0x1895db=_[_0x3d5e('0x44')]({},_0x1895db,_0x36cd63[_0x3d5e('0x46')]);return db['UserFaxQueue'][_0x3d5e('0x5c')](_0x1895db);}})[_0x3d5e('0x2b')](function(_0x5435f0){if(_0x5435f0){return db[_0x3d5e('0x5d')]['findAndCountAll']({'where':{'id':_[_0x3d5e('0x37')](_0x5435f0,_0x3d5e('0x5e')),'role':_0x3d5e('0x5f')},'attributes':['id','name','faxPause','updatedAt',_0x3d5e('0x60')]});}})[_0x3d5e('0x2b')](function(_0x56ca84){if(_0x56ca84){return{'count':_0x56ca84[_0x3d5e('0x25')],'rows':_[_0x3d5e('0x37')](_0x56ca84['rows'],function(_0x281c9a){return{'membername':_0x281c9a['name'],'UserId':_0x281c9a['id'],'queue_name':_0x2817ee['name'],'FaxQueueId':_0x2817ee['id'],'interface':util[_0x3d5e('0x61')](_0x3d5e('0x62'),_0x3d5e('0x63'),_0x281c9a[_0x3d5e('0x31')]),'penalty':0x0,'paused':_0x281c9a['faxPause'],'createdAt':_0x281c9a[_0x3d5e('0x60')],'updatedAt':_0x281c9a[_0x3d5e('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d5e('0x2b')](respondWithFilteredResult(_0x3b4aa5,_0x1895db))[_0x3d5e('0x4d')](handleError(_0x3b4aa5,null));};exports[_0x3d5e('0x65')]=function(_0x40168e,_0x30520d,_0x139955){var _0x3fb7a2={};var _0x22bdd2={};var _0x536074;var _0x558c1f;return db[_0x3d5e('0x48')][_0x3d5e('0x66')]({'where':{'id':_0x40168e['params']['id']}})[_0x3d5e('0x2b')](handleEntityNotFound(_0x30520d,null))['then'](function(_0x57af8b){if(_0x57af8b){_0x536074=_0x57af8b;_0x22bdd2[_0x3d5e('0x36')]=_[_0x3d5e('0x39')](db[_0x3d5e('0x67')][_0x3d5e('0x33')]);_0x22bdd2[_0x3d5e('0x38')]=_[_0x3d5e('0x39')](_0x40168e[_0x3d5e('0x38')]);_0x22bdd2[_0x3d5e('0x3a')]=_[_0x3d5e('0x3b')](_0x22bdd2[_0x3d5e('0x36')],_0x22bdd2[_0x3d5e('0x38')]);_0x3fb7a2[_0x3d5e('0x3c')]=_['intersection'](_0x22bdd2[_0x3d5e('0x36')],qs[_0x3d5e('0x3d')](_0x40168e[_0x3d5e('0x38')][_0x3d5e('0x3d')]));_0x3fb7a2[_0x3d5e('0x3c')]=_0x3fb7a2[_0x3d5e('0x3c')]['length']?_0x3fb7a2[_0x3d5e('0x3c')]:_0x22bdd2[_0x3d5e('0x36')];_0x3fb7a2[_0x3d5e('0x5a')]=qs[_0x3d5e('0x40')](_0x40168e['query']['sort']);_0x3fb7a2[_0x3d5e('0x41')]=qs[_0x3d5e('0x3a')](_[_0x3d5e('0x42')](_0x40168e['query'],_0x22bdd2['filters']));if(_0x40168e[_0x3d5e('0x38')][_0x3d5e('0x43')]){_0x3fb7a2[_0x3d5e('0x41')]=_[_0x3d5e('0x44')](_0x3fb7a2['where'],{'$or':_[_0x3d5e('0x37')](_0x3fb7a2[_0x3d5e('0x3c')],function(_0x4f3d72){var _0x496075={};_0x496075[_0x4f3d72]={'$like':'%'+_0x40168e['query'][_0x3d5e('0x43')]+'%'};return _0x496075;})});}_0x3fb7a2=_[_0x3d5e('0x44')]({},_0x3fb7a2,_0x40168e[_0x3d5e('0x46')]);return _0x536074['getTeams'](_0x3fb7a2);}})[_0x3d5e('0x2b')](function(_0x18bdb4){if(_0x18bdb4){_0x558c1f=_0x18bdb4[_0x3d5e('0x3e')];if(!_0x40168e[_0x3d5e('0x38')]['hasOwnProperty'](_0x3d5e('0x3f'))){_0x3fb7a2[_0x3d5e('0x24')]=qs['limit'](_0x40168e[_0x3d5e('0x38')]['limit']);_0x3fb7a2[_0x3d5e('0x22')]=qs['offset'](_0x40168e[_0x3d5e('0x38')][_0x3d5e('0x22')]);}return _0x536074[_0x3d5e('0x65')](_0x3fb7a2);}})[_0x3d5e('0x2b')](function(_0x3931a3){if(_0x3931a3){return _0x3931a3?{'count':_0x558c1f,'rows':_0x3931a3}:null;}})[_0x3d5e('0x2b')](respondWithResult(_0x30520d,null))['catch'](handleError(_0x30520d,null));};exports[_0x3d5e('0x68')]=function(_0x141dca,_0x8b243c,_0x474f3c){var _0x1971bd=_0x141dca['body'][_0x3d5e('0x69')];return db[_0x3d5e('0x67')][_0x3d5e('0x5c')]({'where':{'id':_0x1971bd},'attributes':['id'],'include':[{'model':db[_0x3d5e('0x5d')],'as':_0x3d5e('0x6a'),'attributes':['id','name','online','voicePause','interface'],'raw':!![]}]})[_0x3d5e('0x2b')](function(_0x211878){if(_0x211878){var _0x432ce5=_['flatMap'](_0x211878,function(_0x47fc0d){var _0x32864e=_0x47fc0d[_0x3d5e('0x2d')]({'plain':!![]});return _0x32864e[_0x3d5e('0x6a')];});return db[_0x3d5e('0x48')][_0x3d5e('0x55')]({'where':{'id':_0x141dca[_0x3d5e('0x4b')]['id']}})[_0x3d5e('0x2b')](function(_0x50f98a){return db[_0x3d5e('0x6b')][_0x3d5e('0x6c')](function(_0x5c7086){return _0x50f98a[_0x3d5e('0x68')](_0x1971bd,{'transaction':_0x5c7086})[_0x3d5e('0x2b')](function(){return BPromise[_0x3d5e('0x6d')](_0x432ce5,function(_0xf6f5dc){return db[_0x3d5e('0x6e')][_0x3d5e('0x6f')]({'where':{'UserId':_0xf6f5dc['id'],'FaxQueueId':_0x141dca[_0x3d5e('0x4b')]['id']},'transaction':_0x5c7086});});})[_0x3d5e('0x2b')](function(){_0x432ce5['forEach'](function(_0x48cc58){socket[_0x3d5e('0x70')]('userFaxQueue:save',{'UserId':_0x48cc58['id'],'FaxQueueId':_0x50f98a['id']});});});});});}})[_0x3d5e('0x2b')](respondWithStatusCode(_0x8b243c,null))[_0x3d5e('0x4d')](handleError(_0x8b243c,null));};exports[_0x3d5e('0x71')]=function(_0x291efd,_0x570c55,_0x13fe24){return db[_0x3d5e('0x67')][_0x3d5e('0x5c')]({'where':{'id':_0x291efd[_0x3d5e('0x38')][_0x3d5e('0x69')]},'attributes':['id'],'include':[{'model':db[_0x3d5e('0x5d')],'as':_0x3d5e('0x6a'),'attributes':['id'],'raw':!![]}]})[_0x3d5e('0x2b')](handleEntityNotFound(_0x570c55,null))[_0x3d5e('0x2b')](function(_0x1bc7b6){var _0x45dd62=_[_0x3d5e('0x37')](_0x1bc7b6,'id');var _0x4bce3f=[];var _0x14858b=[];var _0x2f488f=squel[_0x3d5e('0x72')]();_0x2f488f['field'](_0x3d5e('0x73'))[_0x3d5e('0x74')](_0x3d5e('0x75'),'tq')[_0x3d5e('0x76')](_0x3d5e('0x77'),'ut',_0x3d5e('0x78'))[_0x3d5e('0x41')]('FaxQueueId\x20=\x20?',_0x291efd[_0x3d5e('0x4b')]['id']);for(var _0x52dd1d=0x0;_0x52dd1d<_0x1bc7b6[_0x3d5e('0x3e')];_0x52dd1d+=0x1){let _0x382aab=_0x1bc7b6[_0x52dd1d];for(var _0x42d6bc=0x0;_0x42d6bc<_0x382aab[_0x3d5e('0x6a')][_0x3d5e('0x3e')];_0x42d6bc+=0x1){let _0x44fe77=_0x382aab[_0x3d5e('0x6a')][_0x42d6bc];var _0x9613c9=_0x2f488f[_0x3d5e('0x79')]();_0x9613c9[_0x3d5e('0x41')](_0x3d5e('0x7a'),_0x44fe77['id']);_0x14858b['push'](db[_0x3d5e('0x6b')]['query'](_0x9613c9[_0x3d5e('0x7b')](),{'type':db[_0x3d5e('0x6b')][_0x3d5e('0x7c')][_0x3d5e('0x7d')]})['then'](function(_0x12be5c){if(_0x12be5c['length']===0x1){return _0x44fe77['id'];}else{var _0x32d10c=_[_0x3d5e('0x7e')](_['map'](_0x12be5c,_0x3d5e('0x7f')),function(_0x36ff62){return _[_0x3d5e('0x80')](_0x45dd62,_0x36ff62);});if(_0x32d10c){return _0x44fe77['id'];}}}));}}return BPromise[_0x3d5e('0x81')](_0x14858b)[_0x3d5e('0x2b')](function(_0x24556c){_0x4bce3f=_(_0x4bce3f)[_0x3d5e('0x82')](_0x24556c)[_0x3d5e('0x83')]()[_0x3d5e('0x84')]();return db['FaxQueue'][_0x3d5e('0x55')]({'where':{'id':_0x291efd[_0x3d5e('0x4b')]['id']}})[_0x3d5e('0x2b')](function(_0x2d0a9d){return db['sequelize'][_0x3d5e('0x6c')](function(_0x3f9406){return _0x2d0a9d[_0x3d5e('0x71')](_0x291efd[_0x3d5e('0x38')][_0x3d5e('0x69')],{'transaction':_0x3f9406})['then'](function(){if(!_[_0x3d5e('0x85')](_0x4bce3f)){return _0x2d0a9d[_0x3d5e('0x86')](_0x4bce3f,{'transaction':_0x3f9406});}})['then'](function(){_0x4bce3f['forEach'](function(_0x4a4103){socket[_0x3d5e('0x70')]('userFaxQueue:remove',{'UserId':_0x4a4103,'FaxQueueId':_0x2d0a9d['id']});});});});});});})['then'](respondWithStatusCode(_0x570c55,null))['catch'](handleError(_0x570c55,null));};exports['addAgents']=function(_0x103b06,_0x51a2fb,_0xefc12c){return db[_0x3d5e('0x48')][_0x3d5e('0x55')]({'where':{'id':_0x103b06[_0x3d5e('0x4b')]['id']}})[_0x3d5e('0x2b')](handleEntityNotFound(_0x51a2fb,null))[_0x3d5e('0x2b')](function(_0x103032){if(_0x103032){return _0x103032[_0x3d5e('0x87')](_0x103b06[_0x3d5e('0x4f')][_0x3d5e('0x69')],_['omit'](_0x103b06[_0x3d5e('0x4f')],[_0x3d5e('0x69'),'id'])||{})[_0x3d5e('0x88')](function(_0x3d6512){for(var _0x489600=0x0;_0x489600<_0x103b06[_0x3d5e('0x4f')][_0x3d5e('0x69')][_0x3d5e('0x3e')];_0x489600+=0x1){socket[_0x3d5e('0x70')]('userFaxQueue:save',{'UserId':Number(_0x103b06[_0x3d5e('0x4f')][_0x3d5e('0x69')][_0x489600]),'FaxQueueId':Number(_0x103b06['params']['id'])});}return _0x3d6512;});}})['then'](respondWithResult(_0x51a2fb,null))[_0x3d5e('0x4d')](handleError(_0x51a2fb,null));};exports[_0x3d5e('0x86')]=function(_0x52a555,_0x4c2caf,_0x4b14e8){return db[_0x3d5e('0x48')][_0x3d5e('0x55')]({'where':{'id':_0x52a555['params']['id']}})['then'](handleEntityNotFound(_0x4c2caf,null))['then'](function(_0x4804dd){if(_0x4804dd){return _0x4804dd['removeAgents'](_0x52a555[_0x3d5e('0x38')]['ids'])[_0x3d5e('0x2b')](function(){if(_['isArray'](_0x52a555[_0x3d5e('0x38')][_0x3d5e('0x69')])){for(var _0x5b4be7=0x0;_0x5b4be7<_0x52a555['query'][_0x3d5e('0x69')][_0x3d5e('0x3e')];_0x5b4be7+=0x1){socket[_0x3d5e('0x70')](_0x3d5e('0x89'),{'UserId':Number(_0x52a555[_0x3d5e('0x38')][_0x3d5e('0x69')][_0x5b4be7]),'FaxQueueId':Number(_0x52a555[_0x3d5e('0x4b')]['id'])});}}else{socket[_0x3d5e('0x70')]('userFaxQueue:remove',{'UserId':Number(_0x52a555[_0x3d5e('0x38')][_0x3d5e('0x69')]),'FaxQueueId':Number(_0x52a555['params']['id'])});}});}})[_0x3d5e('0x2b')](respondWithStatusCode(_0x4c2caf,null))[_0x3d5e('0x4d')](handleError(_0x4c2caf,null));};exports[_0x3d5e('0x8a')]=function(_0x4d39fa,_0x3375e,_0x10a816){var _0x10f9fa={};var _0x4ca338={};var _0x551771;var _0x152e8c;return db[_0x3d5e('0x48')]['findOne']({'where':{'id':_0x4d39fa[_0x3d5e('0x4b')]['id']}})[_0x3d5e('0x2b')](handleEntityNotFound(_0x3375e,null))[_0x3d5e('0x2b')](function(_0x401d80){if(_0x401d80){_0x551771=_0x401d80;_0x4ca338['model']=_['keys'](db['User'][_0x3d5e('0x33')]);_0x4ca338[_0x3d5e('0x38')]=_['keys'](_0x4d39fa[_0x3d5e('0x38')]);_0x4ca338[_0x3d5e('0x3a')]=_['intersection'](_0x4ca338['model'],_0x4ca338['query']);_0x10f9fa[_0x3d5e('0x3c')]=_[_0x3d5e('0x3b')](_0x4ca338[_0x3d5e('0x36')],qs[_0x3d5e('0x3d')](_0x4d39fa[_0x3d5e('0x38')][_0x3d5e('0x3d')]));_0x10f9fa['attributes']=_0x10f9fa['attributes']['length']?_0x10f9fa[_0x3d5e('0x3c')]:_0x4ca338[_0x3d5e('0x36')];_0x10f9fa[_0x3d5e('0x5a')]=qs[_0x3d5e('0x40')](_0x4d39fa[_0x3d5e('0x38')][_0x3d5e('0x40')]);_0x10f9fa[_0x3d5e('0x41')]=qs[_0x3d5e('0x3a')](_[_0x3d5e('0x42')](_0x4d39fa[_0x3d5e('0x38')],_0x4ca338[_0x3d5e('0x3a')]));if(_0x4d39fa['query'][_0x3d5e('0x43')]){_0x10f9fa[_0x3d5e('0x41')]=_['merge'](_0x10f9fa[_0x3d5e('0x41')],{'$or':_['map'](_0x10f9fa[_0x3d5e('0x3c')],function(_0x1024a2){var _0x3eed01={};_0x3eed01[_0x1024a2]={'$like':'%'+_0x4d39fa[_0x3d5e('0x38')][_0x3d5e('0x43')]+'%'};return _0x3eed01;})});}_0x10f9fa=_[_0x3d5e('0x44')]({},_0x10f9fa,_0x4d39fa[_0x3d5e('0x46')]);return _0x551771[_0x3d5e('0x8a')](_0x10f9fa);}})[_0x3d5e('0x2b')](function(_0x55d094){if(_0x55d094){_0x152e8c=_0x55d094['length'];if(!_0x4d39fa['query'][_0x3d5e('0x8b')](_0x3d5e('0x3f'))){_0x10f9fa[_0x3d5e('0x24')]=qs[_0x3d5e('0x24')](_0x4d39fa[_0x3d5e('0x38')][_0x3d5e('0x24')]);_0x10f9fa[_0x3d5e('0x22')]=qs[_0x3d5e('0x22')](_0x4d39fa[_0x3d5e('0x38')][_0x3d5e('0x22')]);}return _0x551771[_0x3d5e('0x8a')](_0x10f9fa);}})[_0x3d5e('0x2b')](function(_0x303f0e){if(_0x303f0e){return _0x303f0e?{'count':_0x152e8c,'rows':_0x303f0e}:null;}})[_0x3d5e('0x2b')](respondWithResult(_0x3375e,null))[_0x3d5e('0x4d')](handleError(_0x3375e,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e0f1932..8fc1a51 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 _0x6b03=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove'];(function(_0x26eadb,_0x246399){var _0x1c5a00=function(_0x3c1b4f){while(--_0x3c1b4f){_0x26eadb['push'](_0x26eadb['shift']());}};_0x1c5a00(++_0x246399);}(_0x6b03,0xea));var _0x36b0=function(_0x495a4d,_0x58bc54){_0x495a4d=_0x495a4d-0x0;var _0xa6cdd7=_0x6b03[_0x495a4d];return _0xa6cdd7;};'use strict';var EventEmitter=require(_0x36b0('0x0'));var FaxQueue=require(_0x36b0('0x1'))['db'][_0x36b0('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x36b0('0x3')](0x0);var events={'afterCreate':_0x36b0('0x4'),'afterUpdate':'update','afterDestroy':_0x36b0('0x5')};function emitEvent(_0x2b27a3){return function(_0x1bc70b,_0x447b78,_0x51728e){FaxQueueEvents[_0x36b0('0x6')](_0x2b27a3+':'+_0x1bc70b['id'],_0x1bc70b);FaxQueueEvents[_0x36b0('0x6')](_0x2b27a3,_0x1bc70b);_0x51728e(null);};}for(var e in events){if(events[_0x36b0('0x7')](e)){var event=events[e];FaxQueue[_0x36b0('0x8')](e,emitEvent(event));}}module[_0x36b0('0x9')]=FaxQueueEvents; \ No newline at end of file +var _0x658b=['../../mysqldb','FaxQueue','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x4a630b,_0x576220){var _0x16bb40=function(_0xaa91ea){while(--_0xaa91ea){_0x4a630b['push'](_0x4a630b['shift']());}};_0x16bb40(++_0x576220);}(_0x658b,0x155));var _0xb658=function(_0x5620e5,_0x214b64){_0x5620e5=_0x5620e5-0x0;var _0x11954f=_0x658b[_0x5620e5];return _0x11954f;};'use strict';var EventEmitter=require(_0xb658('0x0'));var FaxQueue=require(_0xb658('0x1'))['db'][_0xb658('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xb658('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xb658('0x4')};function emitEvent(_0x12e092){return function(_0x17889e,_0x18a775,_0x1f39e7){FaxQueueEvents[_0xb658('0x5')](_0x12e092+':'+_0x17889e['id'],_0x17889e);FaxQueueEvents['emit'](_0x12e092,_0x17889e);_0x1f39e7(null);};}for(var e in events){if(events[_0xb658('0x6')](e)){var event=events[e];FaxQueue[_0xb658('0x7')](e,emitEvent(event));}}module[_0xb658('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 757c056..8dc6280 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 _0x0eaa=['FaxQueue','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x41bfa8,_0x2222f0){var _0x5a689e=function(_0x9c9b27){while(--_0x9c9b27){_0x41bfa8['push'](_0x41bfa8['shift']());}};_0x5a689e(++_0x2222f0);}(_0x0eaa,0x12d));var _0xa0ea=function(_0x2b84a7,_0xedf6d6){_0x2b84a7=_0x2b84a7-0x0;var _0x209cd4=_0x0eaa[_0x2b84a7];return _0x209cd4;};'use strict';var _=require('lodash');var util=require(_0xa0ea('0x0'));var logger=require(_0xa0ea('0x1'))(_0xa0ea('0x2'));var moment=require(_0xa0ea('0x3'));var BPromise=require(_0xa0ea('0x4'));var rp=require(_0xa0ea('0x5'));var fs=require('fs');var path=require(_0xa0ea('0x6'));var rimraf=require(_0xa0ea('0x7'));var config=require(_0xa0ea('0x8'));var attributes=require(_0xa0ea('0x9'));module[_0xa0ea('0xa')]=function(_0x1269fc,_0x3a0999){return _0x1269fc['define'](_0xa0ea('0xb'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3f4e=['define','FaxQueue','fax_queues','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x4ac078,_0x290476){var _0x100d43=function(_0xe5d72e){while(--_0xe5d72e){_0x4ac078['push'](_0x4ac078['shift']());}};_0x100d43(++_0x290476);}(_0x3f4e,0x114));var _0xe3f4=function(_0x47aef8,_0x1acbea){_0x47aef8=_0x47aef8-0x0;var _0x43d389=_0x3f4e[_0x47aef8];return _0x43d389;};'use strict';var _=require(_0xe3f4('0x0'));var util=require(_0xe3f4('0x1'));var logger=require('../../config/logger')(_0xe3f4('0x2'));var moment=require(_0xe3f4('0x3'));var BPromise=require(_0xe3f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe3f4('0x5'));var rimraf=require(_0xe3f4('0x6'));var config=require(_0xe3f4('0x7'));var attributes=require(_0xe3f4('0x8'));module[_0xe3f4('0x9')]=function(_0x76327d,_0x340665){return _0x76327d[_0xe3f4('0xa')](_0xe3f4('0xb'),attributes,{'tableName':_0xe3f4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index da1fad8..118499b 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 _0x0318=['request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','FaxQueue','findAll','options','raw','where','limit','include','map','model','attributes','then','GetFaxQueue','catch','ShowFaxQueue','find','moment','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','./faxQueue.socket','request','FaxQueue,\x20%s,\x20%s'];(function(_0xa539ee,_0x3fdac5){var _0x22166c=function(_0x18d644){while(--_0x18d644){_0xa539ee['push'](_0xa539ee['shift']());}};_0x22166c(++_0x3fdac5);}(_0x0318,0xf0));var _0x8031=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0318[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8031('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8031('0x1'))['db'];var utils=require(_0x8031('0x2'));var logger=require('../../config/logger')('rpc');var config=require(_0x8031('0x3'));var jayson=require(_0x8031('0x4'));var client=jayson[_0x8031('0x5')][_0x8031('0x6')]({'port':0x232a});config[_0x8031('0x7')]=_[_0x8031('0x8')](config[_0x8031('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8031('0x7')]));require(_0x8031('0x9'))['register'](socket);function respondWithRpcPromise(_0x269fc8,_0x42b0dc,_0x5860fe){return new BPromise(function(_0x20c7e8,_0x149c76){return client[_0x8031('0xa')](_0x269fc8,_0x5860fe)['then'](function(_0x2cbb3c){logger['info'](_0x8031('0xb'),_0x42b0dc,_0x8031('0xc'));logger[_0x8031('0xd')](_0x8031('0xe'),_0x42b0dc,_0x8031('0xc'),JSON[_0x8031('0xf')](_0x2cbb3c));if(_0x2cbb3c['error']){if(_0x2cbb3c[_0x8031('0x10')][_0x8031('0x11')]===0x1f4){logger[_0x8031('0x10')](_0x8031('0xb'),_0x42b0dc,_0x2cbb3c[_0x8031('0x10')]['message']);return _0x149c76(_0x2cbb3c['error']['message']);}logger[_0x8031('0x10')]('FaxQueue,\x20%s,\x20%s',_0x42b0dc,_0x2cbb3c['error'][_0x8031('0x12')]);return _0x20c7e8(_0x2cbb3c[_0x8031('0x10')][_0x8031('0x12')]);}else{logger[_0x8031('0x13')](_0x8031('0xb'),_0x42b0dc,_0x8031('0xc'));_0x20c7e8(_0x2cbb3c[_0x8031('0x14')]['message']);}})['catch'](function(_0x3c57ca){logger[_0x8031('0x10')](_0x8031('0xb'),_0x42b0dc,_0x3c57ca);_0x149c76(_0x3c57ca);});});}exports['GetFaxQueue']=function(_0x259129){var _0x1fb8cb=this;return new Promise(function(_0x542e21,_0x22b0e3){return db[_0x8031('0x15')][_0x8031('0x16')]({'raw':_0x259129[_0x8031('0x17')]?_0x259129['options'][_0x8031('0x18')]===undefined?!![]:![]:!![],'where':_0x259129[_0x8031('0x17')]?_0x259129['options'][_0x8031('0x19')]||null:null,'attributes':_0x259129[_0x8031('0x17')]?_0x259129[_0x8031('0x17')]['attributes']||null:null,'limit':_0x259129['options']?_0x259129[_0x8031('0x17')][_0x8031('0x1a')]||null:null,'include':_0x259129[_0x8031('0x17')]?_0x259129[_0x8031('0x17')][_0x8031('0x1b')]?_[_0x8031('0x1c')](_0x259129[_0x8031('0x17')][_0x8031('0x1b')],function(_0x27592a){return{'model':db[_0x27592a[_0x8031('0x1d')]],'as':_0x27592a['as'],'attributes':_0x27592a[_0x8031('0x1e')],'include':_0x27592a['include']?_[_0x8031('0x1c')](_0x27592a[_0x8031('0x1b')],function(_0x47967e){return{'model':db[_0x47967e['model']],'as':_0x47967e['as'],'attributes':_0x47967e[_0x8031('0x1e')],'include':_0x47967e['include']?_[_0x8031('0x1c')](_0x47967e[_0x8031('0x1b')],function(_0x55d2db){return{'model':db[_0x55d2db['model']],'as':_0x55d2db['as'],'attributes':_0x55d2db[_0x8031('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8031('0x1f')](function(_0x1de114){logger[_0x8031('0x13')](_0x8031('0x20'),_0x259129);logger[_0x8031('0xd')](_0x8031('0x20'),_0x259129,JSON['stringify'](_0x1de114));_0x542e21(_0x1de114);})[_0x8031('0x21')](function(_0x10b869){logger[_0x8031('0x10')](_0x8031('0x20'),_0x10b869['message'],_0x259129);_0x22b0e3(_0x1fb8cb['error'](0x1f4,_0x10b869[_0x8031('0x12')]));});});};exports[_0x8031('0x22')]=function(_0x3ce075){var _0x4c3798=this;return new Promise(function(_0x19e560,_0x2a60aa){return db[_0x8031('0x15')][_0x8031('0x23')]({'raw':_0x3ce075['options']?_0x3ce075[_0x8031('0x17')][_0x8031('0x18')]===undefined?!![]:![]:!![],'where':_0x3ce075[_0x8031('0x17')]?_0x3ce075['options']['where']||null:null,'attributes':_0x3ce075[_0x8031('0x17')]?_0x3ce075['options'][_0x8031('0x1e')]||null:null,'include':_0x3ce075['options']?_0x3ce075[_0x8031('0x17')][_0x8031('0x1b')]?_['map'](_0x3ce075[_0x8031('0x17')][_0x8031('0x1b')],function(_0x1125ae){return{'model':db[_0x1125ae[_0x8031('0x1d')]],'as':_0x1125ae['as'],'attributes':_0x1125ae['attributes'],'include':_0x1125ae[_0x8031('0x1b')]?_[_0x8031('0x1c')](_0x1125ae['include'],function(_0x3a1752){return{'model':db[_0x3a1752[_0x8031('0x1d')]],'as':_0x3a1752['as'],'attributes':_0x3a1752[_0x8031('0x1e')],'include':_0x3a1752[_0x8031('0x1b')]?_['map'](_0x3a1752[_0x8031('0x1b')],function(_0x7ea953){return{'model':db[_0x7ea953[_0x8031('0x1d')]],'as':_0x7ea953['as'],'attributes':_0x7ea953[_0x8031('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x8031('0x1f')](function(_0x36bedd){logger[_0x8031('0x13')](_0x8031('0x22'),_0x3ce075);logger['debug'](_0x8031('0x22'),_0x3ce075,JSON[_0x8031('0xf')](_0x36bedd));_0x19e560(_0x36bedd);})[_0x8031('0x21')](function(_0x197215){logger['error'](_0x8031('0x22'),_0x197215['message'],_0x3ce075);_0x2a60aa(_0x4c3798[_0x8031('0x10')](0x1f4,_0x197215[_0x8031('0x12')]));});});}; \ No newline at end of file +var _0xef21=['result','FaxQueue','findAll','options','raw','attributes','limit','include','map','model','then','GetFaxQueue','catch','ShowFaxQueue','where','stringify','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0xef21,0x100));var _0x1ef2=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xef21[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x1ef2('0x0'));var util=require(_0x1ef2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1ef2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ef2('0x3'))['db'];var utils=require(_0x1ef2('0x4'));var logger=require(_0x1ef2('0x5'))(_0x1ef2('0x6'));var config=require(_0x1ef2('0x7'));var jayson=require(_0x1ef2('0x8'));var client=jayson[_0x1ef2('0x9')][_0x1ef2('0xa')]({'port':0x232a});config[_0x1ef2('0xb')]=_[_0x1ef2('0xc')](config['redis'],{'host':_0x1ef2('0xd'),'port':0x18eb});var socket=require(_0x1ef2('0xe'))(new Redis(config[_0x1ef2('0xb')]));require(_0x1ef2('0xf'))['register'](socket);function respondWithRpcPromise(_0x382ca6,_0x736bef,_0xab5a1a){return new BPromise(function(_0x16124d,_0x2bd40c){return client[_0x1ef2('0x10')](_0x382ca6,_0xab5a1a)['then'](function(_0x4755ea){logger[_0x1ef2('0x11')](_0x1ef2('0x12'),_0x736bef,_0x1ef2('0x13'));logger[_0x1ef2('0x14')](_0x1ef2('0x15'),_0x736bef,_0x1ef2('0x13'),JSON['stringify'](_0x4755ea));if(_0x4755ea[_0x1ef2('0x16')]){if(_0x4755ea[_0x1ef2('0x16')]['code']===0x1f4){logger[_0x1ef2('0x16')](_0x1ef2('0x12'),_0x736bef,_0x4755ea['error'][_0x1ef2('0x17')]);return _0x2bd40c(_0x4755ea['error'][_0x1ef2('0x17')]);}logger[_0x1ef2('0x16')](_0x1ef2('0x12'),_0x736bef,_0x4755ea[_0x1ef2('0x16')][_0x1ef2('0x17')]);return _0x16124d(_0x4755ea['error']['message']);}else{logger[_0x1ef2('0x11')](_0x1ef2('0x12'),_0x736bef,'request\x20sent');_0x16124d(_0x4755ea[_0x1ef2('0x18')]['message']);}})['catch'](function(_0xd9553d){logger['error'](_0x1ef2('0x12'),_0x736bef,_0xd9553d);_0x2bd40c(_0xd9553d);});});}exports['GetFaxQueue']=function(_0x554d46){var _0x347991=this;return new Promise(function(_0x2a31b8,_0x7ceadc){return db[_0x1ef2('0x19')][_0x1ef2('0x1a')]({'raw':_0x554d46[_0x1ef2('0x1b')]?_0x554d46['options'][_0x1ef2('0x1c')]===undefined?!![]:![]:!![],'where':_0x554d46[_0x1ef2('0x1b')]?_0x554d46[_0x1ef2('0x1b')]['where']||null:null,'attributes':_0x554d46[_0x1ef2('0x1b')]?_0x554d46[_0x1ef2('0x1b')][_0x1ef2('0x1d')]||null:null,'limit':_0x554d46['options']?_0x554d46['options'][_0x1ef2('0x1e')]||null:null,'include':_0x554d46[_0x1ef2('0x1b')]?_0x554d46[_0x1ef2('0x1b')][_0x1ef2('0x1f')]?_[_0x1ef2('0x20')](_0x554d46['options'][_0x1ef2('0x1f')],function(_0x5ab679){return{'model':db[_0x5ab679[_0x1ef2('0x21')]],'as':_0x5ab679['as'],'attributes':_0x5ab679['attributes'],'include':_0x5ab679[_0x1ef2('0x1f')]?_[_0x1ef2('0x20')](_0x5ab679[_0x1ef2('0x1f')],function(_0x4c2b6f){return{'model':db[_0x4c2b6f[_0x1ef2('0x21')]],'as':_0x4c2b6f['as'],'attributes':_0x4c2b6f[_0x1ef2('0x1d')],'include':_0x4c2b6f[_0x1ef2('0x1f')]?_[_0x1ef2('0x20')](_0x4c2b6f[_0x1ef2('0x1f')],function(_0x490c22){return{'model':db[_0x490c22[_0x1ef2('0x21')]],'as':_0x490c22['as'],'attributes':_0x490c22[_0x1ef2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1ef2('0x22')](function(_0x54d384){logger[_0x1ef2('0x11')](_0x1ef2('0x23'),_0x554d46);logger['debug']('GetFaxQueue',_0x554d46,JSON['stringify'](_0x54d384));_0x2a31b8(_0x54d384);})[_0x1ef2('0x24')](function(_0x3dc4a4){logger[_0x1ef2('0x16')](_0x1ef2('0x23'),_0x3dc4a4['message'],_0x554d46);_0x7ceadc(_0x347991['error'](0x1f4,_0x3dc4a4[_0x1ef2('0x17')]));});});};exports[_0x1ef2('0x25')]=function(_0x513884){var _0x2c3e32=this;return new Promise(function(_0x874622,_0x31095a){return db[_0x1ef2('0x19')]['find']({'raw':_0x513884[_0x1ef2('0x1b')]?_0x513884[_0x1ef2('0x1b')][_0x1ef2('0x1c')]===undefined?!![]:![]:!![],'where':_0x513884[_0x1ef2('0x1b')]?_0x513884[_0x1ef2('0x1b')][_0x1ef2('0x26')]||null:null,'attributes':_0x513884[_0x1ef2('0x1b')]?_0x513884['options'][_0x1ef2('0x1d')]||null:null,'include':_0x513884[_0x1ef2('0x1b')]?_0x513884[_0x1ef2('0x1b')][_0x1ef2('0x1f')]?_[_0x1ef2('0x20')](_0x513884[_0x1ef2('0x1b')][_0x1ef2('0x1f')],function(_0x29f729){return{'model':db[_0x29f729[_0x1ef2('0x21')]],'as':_0x29f729['as'],'attributes':_0x29f729['attributes'],'include':_0x29f729[_0x1ef2('0x1f')]?_[_0x1ef2('0x20')](_0x29f729[_0x1ef2('0x1f')],function(_0x17ccc3){return{'model':db[_0x17ccc3[_0x1ef2('0x21')]],'as':_0x17ccc3['as'],'attributes':_0x17ccc3[_0x1ef2('0x1d')],'include':_0x17ccc3['include']?_[_0x1ef2('0x20')](_0x17ccc3[_0x1ef2('0x1f')],function(_0x4e96a5){return{'model':db[_0x4e96a5[_0x1ef2('0x21')]],'as':_0x4e96a5['as'],'attributes':_0x4e96a5['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ef2('0x22')](function(_0x206e0b){logger[_0x1ef2('0x11')](_0x1ef2('0x25'),_0x513884);logger['debug']('ShowFaxQueue',_0x513884,JSON[_0x1ef2('0x27')](_0x206e0b));_0x874622(_0x206e0b);})[_0x1ef2('0x24')](function(_0x4b7c74){logger['error']('ShowFaxQueue',_0x4b7c74[_0x1ef2('0x17')],_0x513884);_0x31095a(_0x2c3e32['error'](0x1f4,_0x4b7c74[_0x1ef2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index aaf8a39..a2a44fc 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 _0xe7e4=['update','emit','removeListener','register','length','faxQueue:','./faxQueue.events','remove'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0xe7e4,0x1be));var _0x4e7e=function(_0x3a3295,_0x572ab8){_0x3a3295=_0x3a3295-0x0;var _0x2fc7ff=_0xe7e4[_0x3a3295];return _0x2fc7ff;};'use strict';var FaxQueueEvents=require(_0x4e7e('0x0'));var events=['save',_0x4e7e('0x1'),_0x4e7e('0x2')];function createListener(_0x149bc2,_0x4adcf4){return function(_0x281097){_0x4adcf4[_0x4e7e('0x3')](_0x149bc2,_0x281097);};}function removeListener(_0x1afc5d,_0x59fd25){return function(){FaxQueueEvents[_0x4e7e('0x4')](_0x1afc5d,_0x59fd25);};}exports[_0x4e7e('0x5')]=function(_0x5cd189){for(var _0x4a6a07=0x0,_0x1f0fe3=events[_0x4e7e('0x6')];_0x4a6a07<_0x1f0fe3;_0x4a6a07++){var _0x508127=events[_0x4a6a07];var _0xec99b3=createListener(_0x4e7e('0x7')+_0x508127,_0x5cd189);FaxQueueEvents['on'](_0x508127,_0xec99b3);}}; \ No newline at end of file +var _0x6a93=['length','faxQueue:','./faxQueue.events','save','remove','removeListener','register'];(function(_0x5b5d7b,_0x153682){var _0x1aa11e=function(_0x7c82b4){while(--_0x7c82b4){_0x5b5d7b['push'](_0x5b5d7b['shift']());}};_0x1aa11e(++_0x153682);}(_0x6a93,0x1d7));var _0x36a9=function(_0x11a657,_0x54f4c3){_0x11a657=_0x11a657-0x0;var _0x38ba18=_0x6a93[_0x11a657];return _0x38ba18;};'use strict';var FaxQueueEvents=require(_0x36a9('0x0'));var events=[_0x36a9('0x1'),_0x36a9('0x2'),'update'];function createListener(_0x508291,_0x3d1196){return function(_0x209444){_0x3d1196['emit'](_0x508291,_0x209444);};}function removeListener(_0x2deb45,_0x2127e0){return function(){FaxQueueEvents[_0x36a9('0x3')](_0x2deb45,_0x2127e0);};}exports[_0x36a9('0x4')]=function(_0x2c1be3){for(var _0x6de7d=0x0,_0x258db9=events[_0x36a9('0x5')];_0x6de7d<_0x258db9;_0x6de7d++){var _0x156951=events[_0x6de7d];var _0x444d75=createListener(_0x36a9('0x6')+_0x156951,_0x2c1be3);FaxQueueEvents['on'](_0x156951,_0x444d75);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 32ece54..c3df5fe 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8aad=['removeAgents','exports','multer','util','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','delete','destroy','/:id/teams','removeTeams'];(function(_0x3a6dc7,_0x3c29b3){var _0x32dcb9=function(_0x2179e2){while(--_0x2179e2){_0x3a6dc7['push'](_0x3a6dc7['shift']());}};_0x32dcb9(++_0x3c29b3);}(_0x8aad,0x146));var _0xd8aa=function(_0x5962d9,_0x5cfa3b){_0x5962d9=_0x5962d9-0x0;var _0x11d8b9=_0x8aad[_0x5962d9];return _0x11d8b9;};'use strict';var multer=require(_0xd8aa('0x0'));var util=require(_0xd8aa('0x1'));var path=require('path');var timeout=require(_0xd8aa('0x2'));var express=require('express');var router=express[_0xd8aa('0x3')]();var fs_extra=require(_0xd8aa('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8aa('0x5'));var controller=require('./faxQueue.controller');router['get']('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x7')]);router[_0xd8aa('0x8')]('/describe',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x9')]);router[_0xd8aa('0x8')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd8aa('0x8')](_0xd8aa('0xb'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xc')]);router[_0xd8aa('0x8')]('/:id/teams',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xd')]);router[_0xd8aa('0x8')](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0xf')]);router[_0xd8aa('0x10')]('/',auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x11')]);router[_0xd8aa('0x10')]('/:id/teams',auth['isAuthenticated'](),controller[_0xd8aa('0x12')]);router[_0xd8aa('0x10')](_0xd8aa('0xe'),auth['isAuthenticated'](),controller[_0xd8aa('0x13')]);router[_0xd8aa('0x14')](_0xd8aa('0xa'),auth[_0xd8aa('0x6')](),controller['update']);router[_0xd8aa('0x15')](_0xd8aa('0xa'),auth['isAuthenticated'](),controller[_0xd8aa('0x16')]);router[_0xd8aa('0x15')](_0xd8aa('0x17'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x18')]);router['delete'](_0xd8aa('0xe'),auth[_0xd8aa('0x6')](),controller[_0xd8aa('0x19')]);module[_0xd8aa('0x1a')]=router; \ No newline at end of file +var _0x2da6=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','/:id','update','delete','removeTeams','removeAgents','multer','util','path'];(function(_0x46ed3f,_0x3b0371){var _0x52686a=function(_0x1d30b7){while(--_0x1d30b7){_0x46ed3f['push'](_0x46ed3f['shift']());}};_0x52686a(++_0x3b0371);}(_0x2da6,0x1dd));var _0x62da=function(_0x331714,_0x1a620c){_0x331714=_0x331714-0x0;var _0x327cf2=_0x2da6[_0x331714];return _0x327cf2;};'use strict';var multer=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var path=require(_0x62da('0x2'));var timeout=require(_0x62da('0x3'));var express=require(_0x62da('0x4'));var router=express[_0x62da('0x5')]();var fs_extra=require(_0x62da('0x6'));var auth=require(_0x62da('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62da('0x8'));router[_0x62da('0x9')]('/',auth[_0x62da('0xa')](),controller[_0x62da('0xb')]);router[_0x62da('0x9')](_0x62da('0xc'),auth[_0x62da('0xa')](),controller[_0x62da('0xd')]);router[_0x62da('0x9')]('/:id',auth[_0x62da('0xa')](),controller[_0x62da('0xe')]);router[_0x62da('0x9')](_0x62da('0xf'),auth['isAuthenticated'](),controller[_0x62da('0x10')]);router[_0x62da('0x9')](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x12')]);router['get'](_0x62da('0x13'),auth[_0x62da('0xa')](),controller[_0x62da('0x14')]);router[_0x62da('0x15')]('/',auth[_0x62da('0xa')](),controller['create']);router['post'](_0x62da('0x11'),auth[_0x62da('0xa')](),controller[_0x62da('0x16')]);router[_0x62da('0x15')](_0x62da('0x13'),auth[_0x62da('0xa')](),controller[_0x62da('0x17')]);router[_0x62da('0x18')](_0x62da('0x19'),auth[_0x62da('0xa')](),controller[_0x62da('0x1a')]);router[_0x62da('0x1b')](_0x62da('0x19'),auth[_0x62da('0xa')](),controller['destroy']);router['delete'](_0x62da('0x11'),auth['isAuthenticated'](),controller[_0x62da('0x1c')]);router[_0x62da('0x1b')](_0x62da('0x13'),auth['isAuthenticated'](),controller[_0x62da('0x1d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index cdf0723..ef8deb1 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 _0xa8f4=['STRING','DATE','sequelize','exports'];(function(_0x2db3d3,_0x5dc096){var _0xf00dbd=function(_0x172849){while(--_0x172849){_0x2db3d3['push'](_0x2db3d3['shift']());}};_0xf00dbd(++_0x5dc096);}(_0xa8f4,0x13e));var _0x4a8f=function(_0x5c76c5,_0x487ba7){_0x5c76c5=_0x5c76c5-0x0;var _0x102e10=_0xa8f4[_0x5c76c5];return _0x102e10;};'use strict';var moment=require('moment');var Sequelize=require(_0x4a8f('0x0'));module[_0x4a8f('0x1')]={'uniqueid':{'type':Sequelize[_0x4a8f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4a8f('0x3')]},'leaveAt':{'type':Sequelize[_0x4a8f('0x3')]},'acceptAt':{'type':Sequelize[_0x4a8f('0x3')]},'exitAt':{'type':Sequelize[_0x4a8f('0x3')]},'reason':{'type':Sequelize[_0x4a8f('0x2')]}}; \ No newline at end of file +var _0x06d7=['STRING','DATE','moment','sequelize','exports'];(function(_0x90e9ab,_0x426802){var _0xdfa58b=function(_0x3d760e){while(--_0x3d760e){_0x90e9ab['push'](_0x90e9ab['shift']());}};_0xdfa58b(++_0x426802);}(_0x06d7,0x19c));var _0x706d=function(_0x54fd1c,_0x511bb0){_0x54fd1c=_0x54fd1c-0x0;var _0x402c9e=_0x06d7[_0x54fd1c];return _0x402c9e;};'use strict';var moment=require(_0x706d('0x0'));var Sequelize=require(_0x706d('0x1'));module[_0x706d('0x2')]={'uniqueid':{'type':Sequelize[_0x706d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x706d('0x3')]},'joinAt':{'type':Sequelize[_0x706d('0x4')]},'leaveAt':{'type':Sequelize[_0x706d('0x4')]},'acceptAt':{'type':Sequelize[_0x706d('0x4')]},'exitAt':{'type':Sequelize[_0x706d('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 905355f..69e3f20 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 _0xd6ce=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','reject','save','then','destroy','end','error','stack','name','send','index','FaxQueueReport','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','limit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','length','find','create','body','update','params','describe','eml-format'];(function(_0x5c91b3,_0xe53bfc){var _0x22e42b=function(_0x2b1014){while(--_0x2b1014){_0x5c91b3['push'](_0x5c91b3['shift']());}};_0x22e42b(++_0xe53bfc);}(_0xd6ce,0x127));var _0xed6c=function(_0x1e8a0c,_0x53521a){_0x1e8a0c=_0x1e8a0c-0x0;var _0x31223e=_0xd6ce[_0x1e8a0c];return _0x31223e;};'use strict';var emlformat=require(_0xed6c('0x0'));var rimraf=require(_0xed6c('0x1'));var zipdir=require(_0xed6c('0x2'));var jsonpatch=require(_0xed6c('0x3'));var rp=require(_0xed6c('0x4'));var moment=require(_0xed6c('0x5'));var BPromise=require(_0xed6c('0x6'));var Mustache=require(_0xed6c('0x7'));var util=require('util');var path=require('path');var sox=require(_0xed6c('0x8'));var csv=require(_0xed6c('0x9'));var ejs=require(_0xed6c('0xa'));var fs=require('fs');var fs_extra=require(_0xed6c('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xed6c('0xc'));var jsforce=require(_0xed6c('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xed6c('0xe'));var Papa=require(_0xed6c('0xf'));var Redis=require(_0xed6c('0x10'));var authService=require(_0xed6c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed6c('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xed6c('0x13'));var db=require(_0xed6c('0x14'))['db'];function respondWithStatusCode(_0x4efd40,_0x17e109){_0x17e109=_0x17e109||0xcc;return function(_0x55ea5e){if(_0x55ea5e){return _0x4efd40[_0xed6c('0x15')](_0x17e109);}return _0x4efd40[_0xed6c('0x16')](_0x17e109)['end']();};}function respondWithResult(_0x3f3126,_0x32a8c9){_0x32a8c9=_0x32a8c9||0xc8;return function(_0x46d807){if(_0x46d807){return _0x3f3126[_0xed6c('0x16')](_0x32a8c9)['json'](_0x46d807);}};}function respondWithFilteredResult(_0x57ec05,_0x2034d4){return function(_0x3d99b8){if(_0x3d99b8){var _0x156e84=typeof _0x2034d4['offset']===_0xed6c('0x17')&&typeof _0x2034d4['limit']===_0xed6c('0x17');var _0x326350=_0x3d99b8[_0xed6c('0x18')];var _0x1fe8c0=_0x156e84?0x0:_0x2034d4['offset'];var _0x387ba1=_0x156e84?_0x3d99b8[_0xed6c('0x18')]:_0x2034d4[_0xed6c('0x19')]+_0x2034d4['limit'];var _0x3f32a3;if(_0x387ba1>=_0x326350){_0x387ba1=_0x326350;_0x3f32a3=0xc8;}else{_0x3f32a3=0xce;}_0x57ec05[_0xed6c('0x16')](_0x3f32a3);return _0x57ec05[_0xed6c('0x1a')](_0xed6c('0x1b'),_0x1fe8c0+'-'+_0x387ba1+'/'+_0x326350)[_0xed6c('0x1c')](_0x3d99b8);}return null;};}function patchUpdates(_0x5e86ad){return function(_0x85aedf){try{jsonpatch['apply'](_0x85aedf,_0x5e86ad,!![]);}catch(_0x4a3fae){return BPromise[_0xed6c('0x1d')](_0x4a3fae);}return _0x85aedf[_0xed6c('0x1e')]();};}function saveUpdates(_0x34faac,_0x49a583){return function(_0x2fd94b){if(_0x2fd94b){return _0x2fd94b['update'](_0x34faac)[_0xed6c('0x1f')](function(_0x5ea6f4){return _0x5ea6f4;});}return null;};}function removeEntity(_0x7882e0,_0x21e0ba){return function(_0x51876b){if(_0x51876b){return _0x51876b[_0xed6c('0x20')]()[_0xed6c('0x1f')](function(){_0x7882e0[_0xed6c('0x16')](0xcc)[_0xed6c('0x21')]();});}};}function handleEntityNotFound(_0x27fb6c,_0x328af2){return function(_0x2bb6fc){if(!_0x2bb6fc){_0x27fb6c[_0xed6c('0x15')](0x194);}return _0x2bb6fc;};}function handleError(_0x58538b,_0x319d61){_0x319d61=_0x319d61||0x1f4;return function(_0x27484c){logger[_0xed6c('0x22')](_0x27484c[_0xed6c('0x23')]);if(_0x27484c[_0xed6c('0x24')]){delete _0x27484c[_0xed6c('0x24')];}_0x58538b['status'](_0x319d61)[_0xed6c('0x25')](_0x27484c);};}exports[_0xed6c('0x26')]=function(_0x3182ce,_0x4e0a5a){var _0x4e4373={},_0x531cd0={},_0x5172b2={'count':0x0,'rows':[]};var _0xb88247=_['map'](db[_0xed6c('0x27')]['rawAttributes'],function(_0x202b96){return{'name':_0x202b96[_0xed6c('0x28')],'type':_0x202b96['type'][_0xed6c('0x29')]};});_0x531cd0[_0xed6c('0x2a')]=_[_0xed6c('0x2b')](_0xb88247,_0xed6c('0x24'));_0x531cd0[_0xed6c('0x2c')]=_[_0xed6c('0x2d')](_0x3182ce['query']);_0x531cd0[_0xed6c('0x2e')]=_[_0xed6c('0x2f')](_0x531cd0['model'],_0x531cd0[_0xed6c('0x2c')]);_0x4e4373['attributes']=_[_0xed6c('0x2f')](_0x531cd0[_0xed6c('0x2a')],qs[_0xed6c('0x30')](_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x30')]));_0x4e4373[_0xed6c('0x31')]=_0x4e4373['attributes']['length']?_0x4e4373['attributes']:_0x531cd0[_0xed6c('0x2a')];if(!_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x32')]('nolimit')){_0x4e4373[_0xed6c('0x33')]=qs[_0xed6c('0x33')](_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x33')]);_0x4e4373[_0xed6c('0x19')]=qs[_0xed6c('0x19')](_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x19')]);}_0x4e4373[_0xed6c('0x34')]=qs[_0xed6c('0x35')](_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x35')]);_0x4e4373['where']=qs[_0xed6c('0x2e')](_[_0xed6c('0x36')](_0x3182ce[_0xed6c('0x2c')],_0x531cd0[_0xed6c('0x2e')]),_0xb88247);if(_0x3182ce['query'][_0xed6c('0x37')]){_0x4e4373[_0xed6c('0x38')]=_[_0xed6c('0x39')](_0x4e4373['where'],{'$or':_[_0xed6c('0x2b')](_0xb88247,function(_0x50381e){if(_0x50381e[_0xed6c('0x3a')]!==_0xed6c('0x3b')){var _0xbacc3c={};_0xbacc3c[_0x50381e['name']]={'$like':'%'+_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x37')]+'%'};return _0xbacc3c;}})});}_0x4e4373=_[_0xed6c('0x39')]({},_0x4e4373,_0x3182ce[_0xed6c('0x3c')]);var _0x18504a={'where':_0x4e4373[_0xed6c('0x38')]};return db[_0xed6c('0x27')][_0xed6c('0x18')](_0x18504a)[_0xed6c('0x1f')](function(_0x210aac){_0x5172b2[_0xed6c('0x18')]=_0x210aac;if(_0x3182ce[_0xed6c('0x2c')][_0xed6c('0x3d')]){_0x4e4373[_0xed6c('0x3e')]=[{'all':!![]}];}return db[_0xed6c('0x27')][_0xed6c('0x3f')](_0x4e4373);})['then'](function(_0x10d810){_0x5172b2[_0xed6c('0x40')]=_0x10d810;return _0x5172b2;})['then'](respondWithFilteredResult(_0x4e0a5a,_0x4e4373))[_0xed6c('0x41')](handleError(_0x4e0a5a,null));};exports[_0xed6c('0x42')]=function(_0x569d1c,_0x4afcd3){var _0x6bc8dc={'raw':!![],'where':{'id':_0x569d1c['params']['id']}},_0x177544={};_0x177544[_0xed6c('0x2a')]=_[_0xed6c('0x2d')](db['FaxQueueReport']['rawAttributes']);_0x177544[_0xed6c('0x2c')]=_[_0xed6c('0x2d')](_0x569d1c[_0xed6c('0x2c')]);_0x177544[_0xed6c('0x2e')]=_['intersection'](_0x177544[_0xed6c('0x2a')],_0x177544[_0xed6c('0x2c')]);_0x6bc8dc[_0xed6c('0x31')]=_[_0xed6c('0x2f')](_0x177544[_0xed6c('0x2a')],qs[_0xed6c('0x30')](_0x569d1c[_0xed6c('0x2c')][_0xed6c('0x30')]));_0x6bc8dc[_0xed6c('0x31')]=_0x6bc8dc['attributes'][_0xed6c('0x43')]?_0x6bc8dc['attributes']:_0x177544[_0xed6c('0x2a')];if(_0x569d1c[_0xed6c('0x2c')][_0xed6c('0x3d')]){_0x6bc8dc[_0xed6c('0x3e')]=[{'all':!![]}];}_0x6bc8dc=_['merge']({},_0x6bc8dc,_0x569d1c[_0xed6c('0x3c')]);return db['FaxQueueReport'][_0xed6c('0x44')](_0x6bc8dc)[_0xed6c('0x1f')](handleEntityNotFound(_0x4afcd3,null))[_0xed6c('0x1f')](respondWithResult(_0x4afcd3,null))[_0xed6c('0x41')](handleError(_0x4afcd3,null));};exports['create']=function(_0x160148,_0x369481){return db[_0xed6c('0x27')][_0xed6c('0x45')](_0x160148[_0xed6c('0x46')],{})[_0xed6c('0x1f')](respondWithResult(_0x369481,0xc9))[_0xed6c('0x41')](handleError(_0x369481,null));};exports[_0xed6c('0x47')]=function(_0x2475eb,_0x124616){if(_0x2475eb[_0xed6c('0x46')]['id']){delete _0x2475eb[_0xed6c('0x46')]['id'];}return db[_0xed6c('0x27')][_0xed6c('0x44')]({'where':{'id':_0x2475eb[_0xed6c('0x48')]['id']}})[_0xed6c('0x1f')](handleEntityNotFound(_0x124616,null))[_0xed6c('0x1f')](saveUpdates(_0x2475eb['body'],null))[_0xed6c('0x1f')](respondWithResult(_0x124616,null))[_0xed6c('0x41')](handleError(_0x124616,null));};exports[_0xed6c('0x20')]=function(_0x3ce893,_0x2301fd){return db[_0xed6c('0x27')][_0xed6c('0x44')]({'where':{'id':_0x3ce893[_0xed6c('0x48')]['id']}})['then'](handleEntityNotFound(_0x2301fd,null))[_0xed6c('0x1f')](removeEntity(_0x2301fd,null))[_0xed6c('0x41')](handleError(_0x2301fd,null));};exports[_0xed6c('0x49')]=function(_0x366b0e,_0x2438aa){return db[_0xed6c('0x27')]['describe']()[_0xed6c('0x1f')](respondWithResult(_0x2438aa,null))[_0xed6c('0x41')](handleError(_0x2438aa,null));}; \ No newline at end of file +var _0xb205=['model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','options','FaxQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','offset','limit','undefined','count','set','json','reject','update','destroy','then','end','error','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xb205,0xf0));var _0x5b20=function(_0x878ba1,_0x16c59e){_0x878ba1=_0x878ba1-0x0;var _0x1ddd4a=_0xb205[_0x878ba1];return _0x1ddd4a;};'use strict';var emlformat=require(_0x5b20('0x0'));var rimraf=require(_0x5b20('0x1'));var zipdir=require(_0x5b20('0x2'));var jsonpatch=require(_0x5b20('0x3'));var rp=require(_0x5b20('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5b20('0x5'));var util=require('util');var path=require(_0x5b20('0x6'));var sox=require(_0x5b20('0x7'));var csv=require('to-csv');var ejs=require(_0x5b20('0x8'));var fs=require('fs');var fs_extra=require(_0x5b20('0x9'));var _=require(_0x5b20('0xa'));var squel=require('squel');var crypto=require(_0x5b20('0xb'));var jsforce=require(_0x5b20('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5b20('0xd'));var Papa=require(_0x5b20('0xe'));var Redis=require(_0x5b20('0xf'));var authService=require(_0x5b20('0x10'));var qs=require(_0x5b20('0x11'));var as=require(_0x5b20('0x12'));var hardwareService=require(_0x5b20('0x13'));var logger=require('../../config/logger')(_0x5b20('0x14'));var utils=require(_0x5b20('0x15'));var config=require(_0x5b20('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a13ac,_0x374632){_0x374632=_0x374632||0xcc;return function(_0xf721a0){if(_0xf721a0){return _0x2a13ac[_0x5b20('0x17')](_0x374632);}return _0x2a13ac[_0x5b20('0x18')](_0x374632)['end']();};}function respondWithResult(_0x42fbb0,_0x32c2df){_0x32c2df=_0x32c2df||0xc8;return function(_0x180185){if(_0x180185){return _0x42fbb0[_0x5b20('0x18')](_0x32c2df)['json'](_0x180185);}};}function respondWithFilteredResult(_0x5247f9,_0x25b9ab){return function(_0x47e80f){if(_0x47e80f){var _0x5ac9db=typeof _0x25b9ab[_0x5b20('0x19')]==='undefined'&&typeof _0x25b9ab[_0x5b20('0x1a')]===_0x5b20('0x1b');var _0x3b9e74=_0x47e80f['count'];var _0x44ac15=_0x5ac9db?0x0:_0x25b9ab[_0x5b20('0x19')];var _0x3e37ef=_0x5ac9db?_0x47e80f[_0x5b20('0x1c')]:_0x25b9ab['offset']+_0x25b9ab[_0x5b20('0x1a')];var _0x55ae4d;if(_0x3e37ef>=_0x3b9e74){_0x3e37ef=_0x3b9e74;_0x55ae4d=0xc8;}else{_0x55ae4d=0xce;}_0x5247f9[_0x5b20('0x18')](_0x55ae4d);return _0x5247f9[_0x5b20('0x1d')]('Content-Range',_0x44ac15+'-'+_0x3e37ef+'/'+_0x3b9e74)[_0x5b20('0x1e')](_0x47e80f);}return null;};}function patchUpdates(_0x54cdf3){return function(_0x3b7aea){try{jsonpatch['apply'](_0x3b7aea,_0x54cdf3,!![]);}catch(_0x28fd12){return BPromise[_0x5b20('0x1f')](_0x28fd12);}return _0x3b7aea['save']();};}function saveUpdates(_0x2d404f,_0x52e27f){return function(_0x4f291e){if(_0x4f291e){return _0x4f291e[_0x5b20('0x20')](_0x2d404f)['then'](function(_0x4b4076){return _0x4b4076;});}return null;};}function removeEntity(_0x37ab76,_0x18f555){return function(_0x9301c7){if(_0x9301c7){return _0x9301c7[_0x5b20('0x21')]()[_0x5b20('0x22')](function(){_0x37ab76[_0x5b20('0x18')](0xcc)[_0x5b20('0x23')]();});}};}function handleEntityNotFound(_0x3bcee0,_0x56aa6a){return function(_0x285249){if(!_0x285249){_0x3bcee0[_0x5b20('0x17')](0x194);}return _0x285249;};}function handleError(_0x205c11,_0x18281d){_0x18281d=_0x18281d||0x1f4;return function(_0x1ea098){logger[_0x5b20('0x24')](_0x1ea098['stack']);if(_0x1ea098[_0x5b20('0x25')]){delete _0x1ea098['name'];}_0x205c11[_0x5b20('0x18')](_0x18281d)[_0x5b20('0x26')](_0x1ea098);};}exports[_0x5b20('0x27')]=function(_0x516f16,_0x492342){var _0x15981f={},_0x27aefb={},_0x508618={'count':0x0,'rows':[]};var _0x551224=_[_0x5b20('0x28')](db['FaxQueueReport'][_0x5b20('0x29')],function(_0x13d302){return{'name':_0x13d302[_0x5b20('0x2a')],'type':_0x13d302[_0x5b20('0x2b')]['key']};});_0x27aefb[_0x5b20('0x2c')]=_[_0x5b20('0x28')](_0x551224,_0x5b20('0x25'));_0x27aefb[_0x5b20('0x2d')]=_['keys'](_0x516f16[_0x5b20('0x2d')]);_0x27aefb[_0x5b20('0x2e')]=_[_0x5b20('0x2f')](_0x27aefb[_0x5b20('0x2c')],_0x27aefb[_0x5b20('0x2d')]);_0x15981f[_0x5b20('0x30')]=_[_0x5b20('0x2f')](_0x27aefb[_0x5b20('0x2c')],qs[_0x5b20('0x31')](_0x516f16[_0x5b20('0x2d')][_0x5b20('0x31')]));_0x15981f[_0x5b20('0x30')]=_0x15981f[_0x5b20('0x30')][_0x5b20('0x32')]?_0x15981f[_0x5b20('0x30')]:_0x27aefb['model'];if(!_0x516f16['query']['hasOwnProperty'](_0x5b20('0x33'))){_0x15981f[_0x5b20('0x1a')]=qs[_0x5b20('0x1a')](_0x516f16[_0x5b20('0x2d')][_0x5b20('0x1a')]);_0x15981f['offset']=qs[_0x5b20('0x19')](_0x516f16[_0x5b20('0x2d')][_0x5b20('0x19')]);}_0x15981f[_0x5b20('0x34')]=qs[_0x5b20('0x35')](_0x516f16[_0x5b20('0x2d')][_0x5b20('0x35')]);_0x15981f['where']=qs['filters'](_['pick'](_0x516f16[_0x5b20('0x2d')],_0x27aefb[_0x5b20('0x2e')]),_0x551224);if(_0x516f16[_0x5b20('0x2d')][_0x5b20('0x36')]){_0x15981f[_0x5b20('0x37')]=_[_0x5b20('0x38')](_0x15981f['where'],{'$or':_['map'](_0x551224,function(_0x1c3b28){if(_0x1c3b28[_0x5b20('0x2b')]!=='VIRTUAL'){var _0x44fd6c={};_0x44fd6c[_0x1c3b28[_0x5b20('0x25')]]={'$like':'%'+_0x516f16[_0x5b20('0x2d')][_0x5b20('0x36')]+'%'};return _0x44fd6c;}})});}_0x15981f=_[_0x5b20('0x38')]({},_0x15981f,_0x516f16[_0x5b20('0x39')]);var _0x1e047b={'where':_0x15981f[_0x5b20('0x37')]};return db[_0x5b20('0x3a')][_0x5b20('0x1c')](_0x1e047b)[_0x5b20('0x22')](function(_0x2efcc7){_0x508618['count']=_0x2efcc7;if(_0x516f16[_0x5b20('0x2d')][_0x5b20('0x3b')]){_0x15981f[_0x5b20('0x3c')]=[{'all':!![]}];}return db[_0x5b20('0x3a')][_0x5b20('0x3d')](_0x15981f);})[_0x5b20('0x22')](function(_0x452560){_0x508618[_0x5b20('0x3e')]=_0x452560;return _0x508618;})[_0x5b20('0x22')](respondWithFilteredResult(_0x492342,_0x15981f))[_0x5b20('0x3f')](handleError(_0x492342,null));};exports[_0x5b20('0x40')]=function(_0x4096cf,_0x1d9d75){var _0x2ea494={'raw':!![],'where':{'id':_0x4096cf[_0x5b20('0x41')]['id']}},_0x831edd={};_0x831edd[_0x5b20('0x2c')]=_[_0x5b20('0x42')](db[_0x5b20('0x3a')][_0x5b20('0x29')]);_0x831edd[_0x5b20('0x2d')]=_[_0x5b20('0x42')](_0x4096cf[_0x5b20('0x2d')]);_0x831edd[_0x5b20('0x2e')]=_[_0x5b20('0x2f')](_0x831edd[_0x5b20('0x2c')],_0x831edd[_0x5b20('0x2d')]);_0x2ea494['attributes']=_[_0x5b20('0x2f')](_0x831edd[_0x5b20('0x2c')],qs[_0x5b20('0x31')](_0x4096cf[_0x5b20('0x2d')][_0x5b20('0x31')]));_0x2ea494[_0x5b20('0x30')]=_0x2ea494[_0x5b20('0x30')]['length']?_0x2ea494[_0x5b20('0x30')]:_0x831edd[_0x5b20('0x2c')];if(_0x4096cf[_0x5b20('0x2d')][_0x5b20('0x3b')]){_0x2ea494[_0x5b20('0x3c')]=[{'all':!![]}];}_0x2ea494=_[_0x5b20('0x38')]({},_0x2ea494,_0x4096cf[_0x5b20('0x39')]);return db['FaxQueueReport'][_0x5b20('0x43')](_0x2ea494)[_0x5b20('0x22')](handleEntityNotFound(_0x1d9d75,null))['then'](respondWithResult(_0x1d9d75,null))[_0x5b20('0x3f')](handleError(_0x1d9d75,null));};exports[_0x5b20('0x44')]=function(_0x542c13,_0x2b726c){return db[_0x5b20('0x3a')][_0x5b20('0x44')](_0x542c13[_0x5b20('0x45')],{})[_0x5b20('0x22')](respondWithResult(_0x2b726c,0xc9))[_0x5b20('0x3f')](handleError(_0x2b726c,null));};exports[_0x5b20('0x20')]=function(_0x36c204,_0x58bd13){if(_0x36c204[_0x5b20('0x45')]['id']){delete _0x36c204[_0x5b20('0x45')]['id'];}return db[_0x5b20('0x3a')][_0x5b20('0x43')]({'where':{'id':_0x36c204[_0x5b20('0x41')]['id']}})[_0x5b20('0x22')](handleEntityNotFound(_0x58bd13,null))['then'](saveUpdates(_0x36c204[_0x5b20('0x45')],null))[_0x5b20('0x22')](respondWithResult(_0x58bd13,null))['catch'](handleError(_0x58bd13,null));};exports[_0x5b20('0x21')]=function(_0x48d5f2,_0x110480){return db[_0x5b20('0x3a')][_0x5b20('0x43')]({'where':{'id':_0x48d5f2[_0x5b20('0x41')]['id']}})['then'](handleEntityNotFound(_0x110480,null))[_0x5b20('0x22')](removeEntity(_0x110480,null))[_0x5b20('0x3f')](handleError(_0x110480,null));};exports[_0x5b20('0x46')]=function(_0x1830f1,_0x2cd012){return db[_0x5b20('0x3a')][_0x5b20('0x46')]()['then'](respondWithResult(_0x2cd012,null))['catch'](handleError(_0x2cd012,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 9c50f17..dbdbc6f 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x256d6a,_0x2f002f){var _0x460058=function(_0x195be7){while(--_0x195be7){_0x256d6a['push'](_0x256d6a['shift']());}};_0x460058(++_0x2f002f);}(_0x1cb9,0x14e));var _0x91cb=function(_0x57fa26,_0x28112c){_0x57fa26=_0x57fa26-0x0;var _0x52b014=_0x1cb9[_0x57fa26];return _0x52b014;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x28f342,_0x223a64){var _0x15d557=function(_0x446adf){while(--_0x446adf){_0x28f342['push'](_0x28f342['shift']());}};_0x15d557(++_0x223a64);}(_0xf494,0x1c6));var _0x4f49=function(_0x111557,_0x4671f4){_0x111557=_0x111557-0x0;var _0xc99165=_0xf494[_0x111557];return _0xc99165;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index b857709..1137682 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 _0x326f=['options','raw','where','attributes','limit','UpdateFaxQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body'];(function(_0x4ceaaf,_0x31053e){var _0x40ff6f=function(_0x4c6d30){while(--_0x4c6d30){_0x4ceaaf['push'](_0x4ceaaf['shift']());}};_0x40ff6f(++_0x31053e);}(_0x326f,0x188));var _0xf326=function(_0x21d250,_0x4d416c){_0x21d250=_0x21d250-0x0;var _0x10b8a4=_0x326f[_0x21d250];return _0x10b8a4;};'use strict';var _=require(_0xf326('0x0'));var util=require(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rs=require(_0xf326('0x4'));var fs=require('fs');var Redis=require(_0xf326('0x5'));var db=require(_0xf326('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')][_0xf326('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x57248c,_0x391414,_0x541746){return new BPromise(function(_0x43f895,_0x550c3f){return client[_0xf326('0xc')](_0x57248c,_0x541746)[_0xf326('0xd')](function(_0x143854){logger[_0xf326('0xe')](_0xf326('0xf'),_0x391414,_0xf326('0x10'));logger[_0xf326('0x11')](_0xf326('0x12'),_0x391414,_0xf326('0x10'),JSON['stringify'](_0x143854));if(_0x143854[_0xf326('0x13')]){if(_0x143854['error'][_0xf326('0x14')]===0x1f4){logger[_0xf326('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x391414,_0x143854['error'][_0xf326('0x15')]);return _0x550c3f(_0x143854[_0xf326('0x13')][_0xf326('0x15')]);}logger[_0xf326('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x391414,_0x143854[_0xf326('0x13')][_0xf326('0x15')]);return _0x43f895(_0x143854[_0xf326('0x13')][_0xf326('0x15')]);}else{logger[_0xf326('0xe')](_0xf326('0xf'),_0x391414,'request\x20sent');_0x43f895(_0x143854[_0xf326('0x16')][_0xf326('0x15')]);}})[_0xf326('0x17')](function(_0x13489a){logger[_0xf326('0x13')]('FaxQueueReport,\x20%s,\x20%s',_0x391414,_0x13489a);_0x550c3f(_0x13489a);});});}exports[_0xf326('0x18')]=function(_0x295dbd){var _0x121ee6=this;return new Promise(function(_0x43fb77,_0x2e710d){return db[_0xf326('0x19')][_0xf326('0x1a')](_0x295dbd[_0xf326('0x1b')],{'raw':_0x295dbd[_0xf326('0x1c')]?_0x295dbd['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x30cc90){logger[_0xf326('0xe')](_0xf326('0x18'),_0x295dbd);logger[_0xf326('0x11')](_0xf326('0x18'),_0x295dbd,JSON['stringify'](_0x30cc90));_0x43fb77(_0x30cc90);})[_0xf326('0x17')](function(_0x195b0b){logger[_0xf326('0x13')]('CreateFaxQueueReport',_0x195b0b[_0xf326('0x15')],_0x295dbd);_0x2e710d(_0x121ee6[_0xf326('0x13')](0x1f4,_0x195b0b['message']));});});};exports['UpdateFaxQueueReport']=function(_0x20f9bd){var _0x5e3058=this;return new Promise(function(_0x2217e3,_0x3edef8){return db['FaxQueueReport']['update'](_0x20f9bd[_0xf326('0x1b')],{'raw':_0x20f9bd[_0xf326('0x1c')]?_0x20f9bd[_0xf326('0x1c')][_0xf326('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20f9bd['options']?_0x20f9bd[_0xf326('0x1c')][_0xf326('0x1e')]||null:null,'attributes':_0x20f9bd[_0xf326('0x1c')]?_0x20f9bd[_0xf326('0x1c')][_0xf326('0x1f')]||null:null,'limit':_0x20f9bd['options']?_0x20f9bd[_0xf326('0x1c')][_0xf326('0x20')]||null:null})[_0xf326('0xd')](function(_0x48e324){logger[_0xf326('0xe')](_0xf326('0x21'),_0x20f9bd);logger['debug'](_0xf326('0x21'),_0x20f9bd,JSON[_0xf326('0x22')](_0x48e324));_0x2217e3(_0x48e324);})[_0xf326('0x17')](function(_0x1fb89f){logger[_0xf326('0x13')]('UpdateFaxQueueReport',_0x1fb89f[_0xf326('0x15')],_0x20f9bd);_0x3edef8(_0x5e3058[_0xf326('0x13')](0x1f4,_0x1fb89f['message']));});});}; \ No newline at end of file +var _0x84d3=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','where','attributes','util','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x84d3,0x1de));var _0x384d=function(_0x434499,_0x5f4ab0){_0x434499=_0x434499-0x0;var _0x2b09f7=_0x84d3[_0x434499];return _0x2b09f7;};'use strict';var _=require('lodash');var util=require(_0x384d('0x0'));var moment=require(_0x384d('0x1'));var BPromise=require(_0x384d('0x2'));var rs=require(_0x384d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x384d('0x4'))['db'];var utils=require(_0x384d('0x5'));var logger=require(_0x384d('0x6'))('rpc');var config=require(_0x384d('0x7'));var jayson=require(_0x384d('0x8'));var client=jayson['client'][_0x384d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c41bb,_0x3a62c4,_0x2d7ec4){return new BPromise(function(_0x32b776,_0x47c588){return client[_0x384d('0xa')](_0x1c41bb,_0x2d7ec4)[_0x384d('0xb')](function(_0x5b23f5){logger['info'](_0x384d('0xc'),_0x3a62c4,_0x384d('0xd'));logger[_0x384d('0xe')](_0x384d('0xf'),_0x3a62c4,_0x384d('0xd'),JSON[_0x384d('0x10')](_0x5b23f5));if(_0x5b23f5['error']){if(_0x5b23f5[_0x384d('0x11')]['code']===0x1f4){logger[_0x384d('0x11')](_0x384d('0xc'),_0x3a62c4,_0x5b23f5['error'][_0x384d('0x12')]);return _0x47c588(_0x5b23f5[_0x384d('0x11')][_0x384d('0x12')]);}logger[_0x384d('0x11')](_0x384d('0xc'),_0x3a62c4,_0x5b23f5['error'][_0x384d('0x12')]);return _0x32b776(_0x5b23f5[_0x384d('0x11')]['message']);}else{logger[_0x384d('0x13')](_0x384d('0xc'),_0x3a62c4,_0x384d('0xd'));_0x32b776(_0x5b23f5[_0x384d('0x14')][_0x384d('0x12')]);}})[_0x384d('0x15')](function(_0x3fe140){logger['error'](_0x384d('0xc'),_0x3a62c4,_0x3fe140);_0x47c588(_0x3fe140);});});}exports[_0x384d('0x16')]=function(_0x53c36f){var _0x1e03f3=this;return new Promise(function(_0x43fb09,_0x1e26ab){return db['FaxQueueReport'][_0x384d('0x17')](_0x53c36f[_0x384d('0x18')],{'raw':_0x53c36f['options']?_0x53c36f[_0x384d('0x19')][_0x384d('0x1a')]===undefined?!![]:![]:!![]})[_0x384d('0xb')](function(_0x281977){logger['info'](_0x384d('0x16'),_0x53c36f);logger['debug'](_0x384d('0x16'),_0x53c36f,JSON['stringify'](_0x281977));_0x43fb09(_0x281977);})[_0x384d('0x15')](function(_0x1f338b){logger[_0x384d('0x11')](_0x384d('0x16'),_0x1f338b[_0x384d('0x12')],_0x53c36f);_0x1e26ab(_0x1e03f3[_0x384d('0x11')](0x1f4,_0x1f338b[_0x384d('0x12')]));});});};exports[_0x384d('0x1b')]=function(_0x1a4e01){var _0x3cface=this;return new Promise(function(_0x12d663,_0x53e1e9){return db[_0x384d('0x1c')][_0x384d('0x1d')](_0x1a4e01['body'],{'raw':_0x1a4e01[_0x384d('0x19')]?_0x1a4e01[_0x384d('0x19')][_0x384d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a4e01[_0x384d('0x19')]?_0x1a4e01['options'][_0x384d('0x1e')]||null:null,'attributes':_0x1a4e01[_0x384d('0x19')]?_0x1a4e01[_0x384d('0x19')][_0x384d('0x1f')]||null:null,'limit':_0x1a4e01[_0x384d('0x19')]?_0x1a4e01[_0x384d('0x19')]['limit']||null:null})['then'](function(_0x6869e4){logger[_0x384d('0x13')](_0x384d('0x1b'),_0x1a4e01);logger['debug'](_0x384d('0x1b'),_0x1a4e01,JSON[_0x384d('0x10')](_0x6869e4));_0x12d663(_0x6869e4);})['catch'](function(_0x23260a){logger['error'](_0x384d('0x1b'),_0x23260a[_0x384d('0x12')],_0x1a4e01);_0x53e1e9(_0x3cface[_0x384d('0x11')](0x1f4,_0x23260a[_0x384d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c85884f..9dba0eb 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 _0xd853=['../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','/:id','update','delete','exports','multer','util','Router','../../components/auth/service'];(function(_0x26eead,_0x821bc8){var _0x24e4ac=function(_0x51b4b1){while(--_0x51b4b1){_0x26eead['push'](_0x26eead['shift']());}};_0x24e4ac(++_0x821bc8);}(_0xd853,0xea));var _0x3d85=function(_0x2f0bf1,_0x183ef1){_0x2f0bf1=_0x2f0bf1-0x0;var _0xf1df38=_0xd853[_0x2f0bf1];return _0xf1df38;};'use strict';var multer=require(_0x3d85('0x0'));var util=require(_0x3d85('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3d85('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x3d85('0x3'));var interaction=require(_0x3d85('0x4'));var config=require('../../config/environment');var controller=require(_0x3d85('0x5'));router[_0x3d85('0x6')]('/',auth[_0x3d85('0x7')](),controller[_0x3d85('0x8')]);router['get'](_0x3d85('0x9'),auth[_0x3d85('0x7')](),controller[_0x3d85('0xa')]);router[_0x3d85('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3d85('0xb')]('/',auth['isAuthenticated'](),controller[_0x3d85('0xc')]);router['put'](_0x3d85('0xd'),auth[_0x3d85('0x7')](),controller[_0x3d85('0xe')]);router[_0x3d85('0xf')](_0x3d85('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3d85('0x10')]=router; \ No newline at end of file +var _0xaf69=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','show','post','create','/:id','update'];(function(_0x2c0c8a,_0x2bbd87){var _0x46e7b7=function(_0x3fa6b1){while(--_0x3fa6b1){_0x2c0c8a['push'](_0x2c0c8a['shift']());}};_0x46e7b7(++_0x2bbd87);}(_0xaf69,0x89));var _0x9af6=function(_0x2233b9,_0x1415b8){_0x2233b9=_0x2233b9-0x0;var _0x18918b=_0xaf69[_0x2233b9];return _0x18918b;};'use strict';var multer=require(_0x9af6('0x0'));var util=require(_0x9af6('0x1'));var path=require(_0x9af6('0x2'));var timeout=require(_0x9af6('0x3'));var express=require(_0x9af6('0x4'));var router=express[_0x9af6('0x5')]();var fs_extra=require(_0x9af6('0x6'));var auth=require(_0x9af6('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxQueueReport.controller');router[_0x9af6('0x8')]('/',auth[_0x9af6('0x9')](),controller[_0x9af6('0xa')]);router[_0x9af6('0x8')]('/describe',auth[_0x9af6('0x9')](),controller['describe']);router[_0x9af6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x9af6('0xb')]);router[_0x9af6('0xc')]('/',auth[_0x9af6('0x9')](),controller[_0x9af6('0xd')]);router['put'](_0x9af6('0xe'),auth[_0x9af6('0x9')](),controller[_0x9af6('0xf')]);router[_0x9af6('0x10')]('/:id',auth[_0x9af6('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 45ff128..7ffb420 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 _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x36238d,_0x25543e){var _0x141fad=function(_0x285507){while(--_0x285507){_0x36238d['push'](_0x36238d['shift']());}};_0x141fad(++_0x25543e);}(_0xedd9,0xfc));var _0x9edd=function(_0x7d6eca,_0x59d54a){_0x7d6eca=_0x7d6eca-0x0;var _0x128263=_0xedd9[_0x7d6eca];return _0x128263;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x1d220f,_0x5b7a0f){var _0x10816c=function(_0x1f537d){while(--_0x1f537d){_0x1d220f['push'](_0x1d220f['shift']());}};_0x10816c(++_0x5b7a0f);}(_0xedd9,0xfc));var _0x9edd=function(_0x3def3c,_0x1d66d2){_0x3def3c=_0x3def3c-0x0;var _0x9cc736=_0xedd9[_0x3def3c];return _0x9cc736;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index e9845e4..e9d121e 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 _0x6bc6=['catch','params','include','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','limit','set','Content-Range','apply','reject','update','destroy','then','name','index','map','FaxTransferReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','rows'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x6bc6,0x15b));var _0x66bc=function(_0x467b5d,_0x22ca71){_0x467b5d=_0x467b5d-0x0;var _0x3a64da=_0x6bc6[_0x467b5d];return _0x3a64da;};'use strict';var emlformat=require(_0x66bc('0x0'));var rimraf=require(_0x66bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x66bc('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x66bc('0x3'));var Mustache=require(_0x66bc('0x4'));var util=require('util');var path=require('path');var sox=require(_0x66bc('0x5'));var csv=require(_0x66bc('0x6'));var ejs=require(_0x66bc('0x7'));var fs=require('fs');var fs_extra=require(_0x66bc('0x8'));var _=require(_0x66bc('0x9'));var squel=require('squel');var crypto=require(_0x66bc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x66bc('0xb'));var toCsv=require(_0x66bc('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x66bc('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x66bc('0xd'));var hardwareService=require(_0x66bc('0xe'));var logger=require(_0x66bc('0xf'))(_0x66bc('0x10'));var utils=require(_0x66bc('0x11'));var config=require(_0x66bc('0x12'));var licenseUtil=require(_0x66bc('0x13'));var db=require(_0x66bc('0x14'))['db'];function respondWithStatusCode(_0x515515,_0x9078fd){_0x9078fd=_0x9078fd||0xcc;return function(_0x5de75a){if(_0x5de75a){return _0x515515[_0x66bc('0x15')](_0x9078fd);}return _0x515515[_0x66bc('0x16')](_0x9078fd)['end']();};}function respondWithResult(_0x7cff71,_0x3a5175){_0x3a5175=_0x3a5175||0xc8;return function(_0x18b5f1){if(_0x18b5f1){return _0x7cff71[_0x66bc('0x16')](_0x3a5175)[_0x66bc('0x17')](_0x18b5f1);}};}function respondWithFilteredResult(_0x580689,_0x3a3633){return function(_0x346879){if(_0x346879){var _0xed7875=typeof _0x3a3633['offset']===_0x66bc('0x18')&&typeof _0x3a3633['limit']==='undefined';var _0x22c59e=_0x346879['count'];var _0x13c8b8=_0xed7875?0x0:_0x3a3633[_0x66bc('0x19')];var _0x5c905a=_0xed7875?_0x346879['count']:_0x3a3633[_0x66bc('0x19')]+_0x3a3633[_0x66bc('0x1a')];var _0x53223c;if(_0x5c905a>=_0x22c59e){_0x5c905a=_0x22c59e;_0x53223c=0xc8;}else{_0x53223c=0xce;}_0x580689[_0x66bc('0x16')](_0x53223c);return _0x580689[_0x66bc('0x1b')](_0x66bc('0x1c'),_0x13c8b8+'-'+_0x5c905a+'/'+_0x22c59e)[_0x66bc('0x17')](_0x346879);}return null;};}function patchUpdates(_0x17faaa){return function(_0x548eae){try{jsonpatch[_0x66bc('0x1d')](_0x548eae,_0x17faaa,!![]);}catch(_0x400142){return BPromise[_0x66bc('0x1e')](_0x400142);}return _0x548eae['save']();};}function saveUpdates(_0x2f42a9,_0x4da2b9){return function(_0x36d19b){if(_0x36d19b){return _0x36d19b[_0x66bc('0x1f')](_0x2f42a9)['then'](function(_0x4dce89){return _0x4dce89;});}return null;};}function removeEntity(_0x4ac2cd,_0x1a2b45){return function(_0x396117){if(_0x396117){return _0x396117[_0x66bc('0x20')]()[_0x66bc('0x21')](function(){_0x4ac2cd[_0x66bc('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x488e73,_0x303ef1){return function(_0xc3c31f){if(!_0xc3c31f){_0x488e73[_0x66bc('0x15')](0x194);}return _0xc3c31f;};}function handleError(_0x385f67,_0x576acb){_0x576acb=_0x576acb||0x1f4;return function(_0x3cfdd9){logger['error'](_0x3cfdd9['stack']);if(_0x3cfdd9['name']){delete _0x3cfdd9[_0x66bc('0x22')];}_0x385f67[_0x66bc('0x16')](_0x576acb)['send'](_0x3cfdd9);};}exports[_0x66bc('0x23')]=function(_0x45ae1,_0x479d47){var _0x3fece8={},_0xbd90b7={},_0x509bbc={'count':0x0,'rows':[]};var _0x5a50d9=_[_0x66bc('0x24')](db[_0x66bc('0x25')][_0x66bc('0x26')],function(_0x1cae76){return{'name':_0x1cae76['fieldName'],'type':_0x1cae76['type'][_0x66bc('0x27')]};});_0xbd90b7[_0x66bc('0x28')]=_['map'](_0x5a50d9,_0x66bc('0x22'));_0xbd90b7[_0x66bc('0x29')]=_[_0x66bc('0x2a')](_0x45ae1[_0x66bc('0x29')]);_0xbd90b7[_0x66bc('0x2b')]=_[_0x66bc('0x2c')](_0xbd90b7[_0x66bc('0x28')],_0xbd90b7[_0x66bc('0x29')]);_0x3fece8[_0x66bc('0x2d')]=_[_0x66bc('0x2c')](_0xbd90b7[_0x66bc('0x28')],qs[_0x66bc('0x2e')](_0x45ae1['query']['fields']));_0x3fece8[_0x66bc('0x2d')]=_0x3fece8[_0x66bc('0x2d')][_0x66bc('0x2f')]?_0x3fece8['attributes']:_0xbd90b7[_0x66bc('0x28')];if(!_0x45ae1[_0x66bc('0x29')][_0x66bc('0x30')]('nolimit')){_0x3fece8[_0x66bc('0x1a')]=qs[_0x66bc('0x1a')](_0x45ae1[_0x66bc('0x29')]['limit']);_0x3fece8[_0x66bc('0x19')]=qs['offset'](_0x45ae1['query']['offset']);}_0x3fece8['order']=qs[_0x66bc('0x31')](_0x45ae1[_0x66bc('0x29')][_0x66bc('0x31')]);_0x3fece8[_0x66bc('0x32')]=qs[_0x66bc('0x2b')](_[_0x66bc('0x33')](_0x45ae1['query'],_0xbd90b7['filters']),_0x5a50d9);if(_0x45ae1[_0x66bc('0x29')][_0x66bc('0x34')]){_0x3fece8[_0x66bc('0x32')]=_[_0x66bc('0x35')](_0x3fece8['where'],{'$or':_[_0x66bc('0x24')](_0x5a50d9,function(_0x3baa45){if(_0x3baa45[_0x66bc('0x36')]!==_0x66bc('0x37')){var _0xb8de97={};_0xb8de97[_0x3baa45[_0x66bc('0x22')]]={'$like':'%'+_0x45ae1[_0x66bc('0x29')][_0x66bc('0x34')]+'%'};return _0xb8de97;}})});}_0x3fece8=_[_0x66bc('0x35')]({},_0x3fece8,_0x45ae1[_0x66bc('0x38')]);var _0x5fab68={'where':_0x3fece8[_0x66bc('0x32')]};return db[_0x66bc('0x25')][_0x66bc('0x39')](_0x5fab68)[_0x66bc('0x21')](function(_0x2c91c3){_0x509bbc['count']=_0x2c91c3;if(_0x45ae1[_0x66bc('0x29')][_0x66bc('0x3a')]){_0x3fece8['include']=[{'all':!![]}];}return db[_0x66bc('0x25')][_0x66bc('0x3b')](_0x3fece8);})[_0x66bc('0x21')](function(_0x37120){_0x509bbc[_0x66bc('0x3c')]=_0x37120;return _0x509bbc;})[_0x66bc('0x21')](respondWithFilteredResult(_0x479d47,_0x3fece8))[_0x66bc('0x3d')](handleError(_0x479d47,null));};exports['show']=function(_0x1ae816,_0x13752d){var _0x184489={'raw':!![],'where':{'id':_0x1ae816[_0x66bc('0x3e')]['id']}},_0x55780f={};_0x55780f[_0x66bc('0x28')]=_[_0x66bc('0x2a')](db[_0x66bc('0x25')][_0x66bc('0x26')]);_0x55780f[_0x66bc('0x29')]=_['keys'](_0x1ae816[_0x66bc('0x29')]);_0x55780f[_0x66bc('0x2b')]=_[_0x66bc('0x2c')](_0x55780f['model'],_0x55780f[_0x66bc('0x29')]);_0x184489[_0x66bc('0x2d')]=_[_0x66bc('0x2c')](_0x55780f[_0x66bc('0x28')],qs['fields'](_0x1ae816['query']['fields']));_0x184489['attributes']=_0x184489[_0x66bc('0x2d')]['length']?_0x184489['attributes']:_0x55780f[_0x66bc('0x28')];if(_0x1ae816[_0x66bc('0x29')][_0x66bc('0x3a')]){_0x184489[_0x66bc('0x3f')]=[{'all':!![]}];}_0x184489=_[_0x66bc('0x35')]({},_0x184489,_0x1ae816[_0x66bc('0x38')]);return db['FaxTransferReport'][_0x66bc('0x40')](_0x184489)[_0x66bc('0x21')](handleEntityNotFound(_0x13752d,null))[_0x66bc('0x21')](respondWithResult(_0x13752d,null))[_0x66bc('0x3d')](handleError(_0x13752d,null));};exports[_0x66bc('0x41')]=function(_0x397462,_0x3588f4){return db[_0x66bc('0x25')]['create'](_0x397462[_0x66bc('0x42')],{})[_0x66bc('0x21')](respondWithResult(_0x3588f4,0xc9))[_0x66bc('0x3d')](handleError(_0x3588f4,null));};exports[_0x66bc('0x1f')]=function(_0x52d772,_0x421605){if(_0x52d772[_0x66bc('0x42')]['id']){delete _0x52d772[_0x66bc('0x42')]['id'];}return db[_0x66bc('0x25')][_0x66bc('0x40')]({'where':{'id':_0x52d772['params']['id']}})[_0x66bc('0x21')](handleEntityNotFound(_0x421605,null))[_0x66bc('0x21')](saveUpdates(_0x52d772[_0x66bc('0x42')],null))['then'](respondWithResult(_0x421605,null))[_0x66bc('0x3d')](handleError(_0x421605,null));};exports[_0x66bc('0x20')]=function(_0x51661e,_0x40a694){return db[_0x66bc('0x25')][_0x66bc('0x40')]({'where':{'id':_0x51661e[_0x66bc('0x3e')]['id']}})[_0x66bc('0x21')](handleEntityNotFound(_0x40a694,null))[_0x66bc('0x21')](removeEntity(_0x40a694,null))[_0x66bc('0x3d')](handleError(_0x40a694,null));};exports[_0x66bc('0x43')]=function(_0x40fdc7,_0x1a4a9d){return db['FaxTransferReport'][_0x66bc('0x43')]()[_0x66bc('0x21')](respondWithResult(_0x1a4a9d,null))[_0x66bc('0x3d')](handleError(_0x1a4a9d,null));}; \ No newline at end of file +var _0xb40d=['moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x310d10,_0x3fe887){var _0x1fb8af=function(_0x42965b){while(--_0x42965b){_0x310d10['push'](_0x310d10['shift']());}};_0x1fb8af(++_0x3fe887);}(_0xb40d,0x12c));var _0xdb40=function(_0x3291fd,_0x44aa2f){_0x3291fd=_0x3291fd-0x0;var _0x1f243a=_0xb40d[_0x3291fd];return _0x1f243a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdb40('0x0'));var zipdir=require(_0xdb40('0x1'));var jsonpatch=require(_0xdb40('0x2'));var rp=require(_0xdb40('0x3'));var moment=require(_0xdb40('0x4'));var BPromise=require(_0xdb40('0x5'));var Mustache=require(_0xdb40('0x6'));var util=require(_0xdb40('0x7'));var path=require(_0xdb40('0x8'));var sox=require('sox');var csv=require(_0xdb40('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb40('0xa'));var _=require(_0xdb40('0xb'));var squel=require(_0xdb40('0xc'));var crypto=require(_0xdb40('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdb40('0x9'));var querystring=require(_0xdb40('0xe'));var Papa=require(_0xdb40('0xf'));var Redis=require(_0xdb40('0x10'));var authService=require(_0xdb40('0x11'));var qs=require(_0xdb40('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb40('0x13'));var utils=require('../../config/utils');var config=require(_0xdb40('0x14'));var licenseUtil=require(_0xdb40('0x15'));var db=require(_0xdb40('0x16'))['db'];function respondWithStatusCode(_0x1fabb2,_0xe6b49d){_0xe6b49d=_0xe6b49d||0xcc;return function(_0x5ad540){if(_0x5ad540){return _0x1fabb2[_0xdb40('0x17')](_0xe6b49d);}return _0x1fabb2[_0xdb40('0x18')](_0xe6b49d)[_0xdb40('0x19')]();};}function respondWithResult(_0x424cbd,_0x2eba3f){_0x2eba3f=_0x2eba3f||0xc8;return function(_0x150b88){if(_0x150b88){return _0x424cbd[_0xdb40('0x18')](_0x2eba3f)[_0xdb40('0x1a')](_0x150b88);}};}function respondWithFilteredResult(_0x57a1be,_0x284718){return function(_0x21d316){if(_0x21d316){var _0x5f02ab=typeof _0x284718[_0xdb40('0x1b')]===_0xdb40('0x1c')&&typeof _0x284718[_0xdb40('0x1d')]===_0xdb40('0x1c');var _0x236449=_0x21d316[_0xdb40('0x1e')];var _0x52c8fb=_0x5f02ab?0x0:_0x284718[_0xdb40('0x1b')];var _0xbfe454=_0x5f02ab?_0x21d316[_0xdb40('0x1e')]:_0x284718['offset']+_0x284718['limit'];var _0x128137;if(_0xbfe454>=_0x236449){_0xbfe454=_0x236449;_0x128137=0xc8;}else{_0x128137=0xce;}_0x57a1be['status'](_0x128137);return _0x57a1be[_0xdb40('0x1f')]('Content-Range',_0x52c8fb+'-'+_0xbfe454+'/'+_0x236449)[_0xdb40('0x1a')](_0x21d316);}return null;};}function patchUpdates(_0x10bc26){return function(_0x4fdc90){try{jsonpatch[_0xdb40('0x20')](_0x4fdc90,_0x10bc26,!![]);}catch(_0x36c3f5){return BPromise[_0xdb40('0x21')](_0x36c3f5);}return _0x4fdc90['save']();};}function saveUpdates(_0x5e6bcd,_0x30bba8){return function(_0xe85454){if(_0xe85454){return _0xe85454[_0xdb40('0x22')](_0x5e6bcd)['then'](function(_0x27241f){return _0x27241f;});}return null;};}function removeEntity(_0x286ef1,_0x323e1b){return function(_0x449db4){if(_0x449db4){return _0x449db4[_0xdb40('0x23')]()[_0xdb40('0x24')](function(){_0x286ef1[_0xdb40('0x18')](0xcc)[_0xdb40('0x19')]();});}};}function handleEntityNotFound(_0x190ae5,_0x49a3e8){return function(_0x4af02f){if(!_0x4af02f){_0x190ae5['sendStatus'](0x194);}return _0x4af02f;};}function handleError(_0x3932a0,_0x38c5bc){_0x38c5bc=_0x38c5bc||0x1f4;return function(_0x5a3a03){logger[_0xdb40('0x25')](_0x5a3a03[_0xdb40('0x26')]);if(_0x5a3a03[_0xdb40('0x27')]){delete _0x5a3a03['name'];}_0x3932a0[_0xdb40('0x18')](_0x38c5bc)[_0xdb40('0x28')](_0x5a3a03);};}exports[_0xdb40('0x29')]=function(_0x414c56,_0x5c03cf){var _0x6a541a={},_0x1c8f29={},_0x5161da={'count':0x0,'rows':[]};var _0x362804=_[_0xdb40('0x2a')](db[_0xdb40('0x2b')][_0xdb40('0x2c')],function(_0x50e758){return{'name':_0x50e758[_0xdb40('0x2d')],'type':_0x50e758['type'][_0xdb40('0x2e')]};});_0x1c8f29[_0xdb40('0x2f')]=_[_0xdb40('0x2a')](_0x362804,_0xdb40('0x27'));_0x1c8f29[_0xdb40('0x30')]=_[_0xdb40('0x31')](_0x414c56[_0xdb40('0x30')]);_0x1c8f29[_0xdb40('0x32')]=_['intersection'](_0x1c8f29[_0xdb40('0x2f')],_0x1c8f29[_0xdb40('0x30')]);_0x6a541a[_0xdb40('0x33')]=_[_0xdb40('0x34')](_0x1c8f29[_0xdb40('0x2f')],qs[_0xdb40('0x35')](_0x414c56[_0xdb40('0x30')]['fields']));_0x6a541a[_0xdb40('0x33')]=_0x6a541a[_0xdb40('0x33')][_0xdb40('0x36')]?_0x6a541a[_0xdb40('0x33')]:_0x1c8f29['model'];if(!_0x414c56[_0xdb40('0x30')]['hasOwnProperty'](_0xdb40('0x37'))){_0x6a541a[_0xdb40('0x1d')]=qs[_0xdb40('0x1d')](_0x414c56[_0xdb40('0x30')][_0xdb40('0x1d')]);_0x6a541a[_0xdb40('0x1b')]=qs[_0xdb40('0x1b')](_0x414c56[_0xdb40('0x30')][_0xdb40('0x1b')]);}_0x6a541a[_0xdb40('0x38')]=qs[_0xdb40('0x39')](_0x414c56[_0xdb40('0x30')][_0xdb40('0x39')]);_0x6a541a[_0xdb40('0x3a')]=qs[_0xdb40('0x32')](_[_0xdb40('0x3b')](_0x414c56[_0xdb40('0x30')],_0x1c8f29[_0xdb40('0x32')]),_0x362804);if(_0x414c56[_0xdb40('0x30')]['filter']){_0x6a541a[_0xdb40('0x3a')]=_[_0xdb40('0x3c')](_0x6a541a[_0xdb40('0x3a')],{'$or':_['map'](_0x362804,function(_0x152966){if(_0x152966[_0xdb40('0x3d')]!==_0xdb40('0x3e')){var _0x3bb4b0={};_0x3bb4b0[_0x152966[_0xdb40('0x27')]]={'$like':'%'+_0x414c56[_0xdb40('0x30')][_0xdb40('0x3f')]+'%'};return _0x3bb4b0;}})});}_0x6a541a=_[_0xdb40('0x3c')]({},_0x6a541a,_0x414c56[_0xdb40('0x40')]);var _0x2df02c={'where':_0x6a541a['where']};return db[_0xdb40('0x2b')]['count'](_0x2df02c)[_0xdb40('0x24')](function(_0x40ef4a){_0x5161da[_0xdb40('0x1e')]=_0x40ef4a;if(_0x414c56[_0xdb40('0x30')][_0xdb40('0x41')]){_0x6a541a[_0xdb40('0x42')]=[{'all':!![]}];}return db['FaxTransferReport'][_0xdb40('0x43')](_0x6a541a);})[_0xdb40('0x24')](function(_0x44f042){_0x5161da[_0xdb40('0x44')]=_0x44f042;return _0x5161da;})['then'](respondWithFilteredResult(_0x5c03cf,_0x6a541a))['catch'](handleError(_0x5c03cf,null));};exports[_0xdb40('0x45')]=function(_0x6214ad,_0x3e2d4e){var _0x100f8b={'raw':!![],'where':{'id':_0x6214ad[_0xdb40('0x46')]['id']}},_0x509c25={};_0x509c25[_0xdb40('0x2f')]=_[_0xdb40('0x31')](db['FaxTransferReport'][_0xdb40('0x2c')]);_0x509c25['query']=_[_0xdb40('0x31')](_0x6214ad[_0xdb40('0x30')]);_0x509c25[_0xdb40('0x32')]=_['intersection'](_0x509c25['model'],_0x509c25[_0xdb40('0x30')]);_0x100f8b[_0xdb40('0x33')]=_[_0xdb40('0x34')](_0x509c25[_0xdb40('0x2f')],qs['fields'](_0x6214ad[_0xdb40('0x30')]['fields']));_0x100f8b[_0xdb40('0x33')]=_0x100f8b[_0xdb40('0x33')][_0xdb40('0x36')]?_0x100f8b[_0xdb40('0x33')]:_0x509c25[_0xdb40('0x2f')];if(_0x6214ad[_0xdb40('0x30')][_0xdb40('0x41')]){_0x100f8b[_0xdb40('0x42')]=[{'all':!![]}];}_0x100f8b=_['merge']({},_0x100f8b,_0x6214ad[_0xdb40('0x40')]);return db['FaxTransferReport'][_0xdb40('0x47')](_0x100f8b)[_0xdb40('0x24')](handleEntityNotFound(_0x3e2d4e,null))['then'](respondWithResult(_0x3e2d4e,null))[_0xdb40('0x48')](handleError(_0x3e2d4e,null));};exports[_0xdb40('0x49')]=function(_0x5be7ae,_0x44adf4){return db[_0xdb40('0x2b')][_0xdb40('0x49')](_0x5be7ae[_0xdb40('0x4a')],{})[_0xdb40('0x24')](respondWithResult(_0x44adf4,0xc9))[_0xdb40('0x48')](handleError(_0x44adf4,null));};exports[_0xdb40('0x22')]=function(_0x24e4e2,_0x5d3a9e){if(_0x24e4e2[_0xdb40('0x4a')]['id']){delete _0x24e4e2[_0xdb40('0x4a')]['id'];}return db[_0xdb40('0x2b')][_0xdb40('0x47')]({'where':{'id':_0x24e4e2[_0xdb40('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d3a9e,null))[_0xdb40('0x24')](saveUpdates(_0x24e4e2['body'],null))['then'](respondWithResult(_0x5d3a9e,null))['catch'](handleError(_0x5d3a9e,null));};exports[_0xdb40('0x23')]=function(_0x2427f6,_0x5caa23){return db[_0xdb40('0x2b')][_0xdb40('0x47')]({'where':{'id':_0x2427f6['params']['id']}})[_0xdb40('0x24')](handleEntityNotFound(_0x5caa23,null))[_0xdb40('0x24')](removeEntity(_0x5caa23,null))['catch'](handleError(_0x5caa23,null));};exports[_0xdb40('0x4b')]=function(_0x3aa27c,_0x360bc1){return db['FaxTransferReport'][_0xdb40('0x4b')]()['then'](respondWithResult(_0x360bc1,null))[_0xdb40('0x48')](handleError(_0x360bc1,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 777eb09..e785ca8 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 _0xbc1c=['../../config/logger','api','bluebird','path','./faxTransferReport.attributes','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x254761,_0x550307){var _0x4236de=function(_0x13968e){while(--_0x13968e){_0x254761['push'](_0x254761['shift']());}};_0x4236de(++_0x550307);}(_0xbc1c,0x98));var _0xcbc1=function(_0x589eb4,_0xaa2019){_0x589eb4=_0x589eb4-0x0;var _0xf50816=_0xbc1c[_0x589eb4];return _0xf50816;};'use strict';var _=require(_0xcbc1('0x0'));var util=require(_0xcbc1('0x1'));var logger=require(_0xcbc1('0x2'))(_0xcbc1('0x3'));var moment=require('moment');var BPromise=require(_0xcbc1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcbc1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcbc1('0x6'));module['exports']=function(_0x533988,_0x2e4f2b){return _0x533988[_0xcbc1('0x7')](_0xcbc1('0x8'),attributes,{'tableName':_0xcbc1('0x9'),'paranoid':![],'indexes':[{'name':_0xcbc1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b78=['../../config/environment','exports','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x4c836d,_0x144891){var _0x299319=function(_0x5ea7a1){while(--_0x5ea7a1){_0x4c836d['push'](_0x4c836d['shift']());}};_0x299319(++_0x144891);}(_0x8b78,0xaa));var _0x88b7=function(_0x2a2680,_0x25cf0a){_0x2a2680=_0x2a2680-0x0;var _0x297ca0=_0x8b78[_0x2a2680];return _0x297ca0;};'use strict';var _=require(_0x88b7('0x0'));var util=require('util');var logger=require(_0x88b7('0x1'))('api');var moment=require(_0x88b7('0x2'));var BPromise=require(_0x88b7('0x3'));var rp=require(_0x88b7('0x4'));var fs=require('fs');var path=require(_0x88b7('0x5'));var rimraf=require('rimraf');var config=require(_0x88b7('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x88b7('0x7')]=function(_0x288734,_0x23ceac){return _0x288734['define'](_0x88b7('0x8'),attributes,{'tableName':_0x88b7('0x9'),'paranoid':![],'indexes':[{'name':_0x88b7('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index d4bca40..b3ba9a8 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 _0xf7c4=['FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','stringify','error','code'];(function(_0x3f4f26,_0x1f3919){var _0x5753d5=function(_0x315eec){while(--_0x315eec){_0x3f4f26['push'](_0x3f4f26['shift']());}};_0x5753d5(++_0x1f3919);}(_0xf7c4,0x12a));var _0x4f7c=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf7c4[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x4f7c('0x0'));var util=require(_0x4f7c('0x1'));var moment=require(_0x4f7c('0x2'));var BPromise=require(_0x4f7c('0x3'));var rs=require(_0x4f7c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f7c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f7c('0x6'))(_0x4f7c('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4f7c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b7247,_0x45f34f,_0xf04068){return new BPromise(function(_0x4a3a3c,_0xf4fded){return client[_0x4f7c('0x9')](_0x1b7247,_0xf04068)[_0x4f7c('0xa')](function(_0x10e2d5){logger[_0x4f7c('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x45f34f,_0x4f7c('0xc'));logger[_0x4f7c('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x45f34f,'request\x20sent',JSON[_0x4f7c('0xe')](_0x10e2d5));if(_0x10e2d5[_0x4f7c('0xf')]){if(_0x10e2d5[_0x4f7c('0xf')][_0x4f7c('0x10')]===0x1f4){logger[_0x4f7c('0xf')](_0x4f7c('0x11'),_0x45f34f,_0x10e2d5['error'][_0x4f7c('0x12')]);return _0xf4fded(_0x10e2d5[_0x4f7c('0xf')]['message']);}logger[_0x4f7c('0xf')](_0x4f7c('0x11'),_0x45f34f,_0x10e2d5[_0x4f7c('0xf')][_0x4f7c('0x12')]);return _0x4a3a3c(_0x10e2d5['error'][_0x4f7c('0x12')]);}else{logger[_0x4f7c('0xb')]('FaxTransferReport,\x20%s,\x20%s',_0x45f34f,_0x4f7c('0xc'));_0x4a3a3c(_0x10e2d5[_0x4f7c('0x13')]['message']);}})[_0x4f7c('0x14')](function(_0x329ebc){logger['error'](_0x4f7c('0x11'),_0x45f34f,_0x329ebc);_0xf4fded(_0x329ebc);});});} \ No newline at end of file +var _0xe6de=['rpc','../../config/environment','client','http','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger'];(function(_0xc8ea77,_0x41d0b4){var _0x2abbde=function(_0x2cd022){while(--_0x2cd022){_0xc8ea77['push'](_0xc8ea77['shift']());}};_0x2abbde(++_0x41d0b4);}(_0xe6de,0x1dd));var _0xee6d=function(_0x288782,_0x419280){_0x288782=_0x288782-0x0;var _0x34d1b1=_0xe6de[_0x288782];return _0x34d1b1;};'use strict';var _=require(_0xee6d('0x0'));var util=require(_0xee6d('0x1'));var moment=require(_0xee6d('0x2'));var BPromise=require('bluebird');var rs=require(_0xee6d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xee6d('0x4'));var logger=require(_0xee6d('0x5'))(_0xee6d('0x6'));var config=require(_0xee6d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xee6d('0x8')][_0xee6d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49847d,_0x4d1387,_0x46e8e7){return new BPromise(function(_0x1d5e15,_0x1215f6){return client[_0xee6d('0xa')](_0x49847d,_0x46e8e7)[_0xee6d('0xb')](function(_0x5bb0c7){logger['info'](_0xee6d('0xc'),_0x4d1387,_0xee6d('0xd'));logger[_0xee6d('0xe')](_0xee6d('0xf'),_0x4d1387,_0xee6d('0xd'),JSON[_0xee6d('0x10')](_0x5bb0c7));if(_0x5bb0c7[_0xee6d('0x11')]){if(_0x5bb0c7[_0xee6d('0x11')][_0xee6d('0x12')]===0x1f4){logger[_0xee6d('0x11')](_0xee6d('0xc'),_0x4d1387,_0x5bb0c7[_0xee6d('0x11')][_0xee6d('0x13')]);return _0x1215f6(_0x5bb0c7[_0xee6d('0x11')][_0xee6d('0x13')]);}logger[_0xee6d('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x4d1387,_0x5bb0c7['error'][_0xee6d('0x13')]);return _0x1d5e15(_0x5bb0c7['error'][_0xee6d('0x13')]);}else{logger[_0xee6d('0x14')](_0xee6d('0xc'),_0x4d1387,_0xee6d('0xd'));_0x1d5e15(_0x5bb0c7[_0xee6d('0x15')]['message']);}})[_0xee6d('0x16')](function(_0x3295a7){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x4d1387,_0x3295a7);_0x1215f6(_0x3295a7);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index fef5dbf..8daab40 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 _0xff85=['express','Router','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','create','put','delete','destroy','exports','multer','path'];(function(_0x5ae1af,_0x3a3c68){var _0x57769c=function(_0x31e76b){while(--_0x31e76b){_0x5ae1af['push'](_0x5ae1af['shift']());}};_0x57769c(++_0x3a3c68);}(_0xff85,0x1b8));var _0x5ff8=function(_0x35e3eb,_0x2cb9dd){_0x35e3eb=_0x35e3eb-0x0;var _0x354733=_0xff85[_0x35e3eb];return _0x354733;};'use strict';var multer=require(_0x5ff8('0x0'));var util=require('util');var path=require(_0x5ff8('0x1'));var timeout=require('connect-timeout');var express=require(_0x5ff8('0x2'));var router=express[_0x5ff8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5ff8('0x4'));var config=require(_0x5ff8('0x5'));var controller=require('./faxTransferReport.controller');router[_0x5ff8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5ff8('0x7'),auth[_0x5ff8('0x8')](),controller[_0x5ff8('0x9')]);router['get'](_0x5ff8('0xa'),auth[_0x5ff8('0x8')](),controller[_0x5ff8('0xb')]);router['post']('/',auth[_0x5ff8('0x8')](),controller[_0x5ff8('0xc')]);router[_0x5ff8('0xd')](_0x5ff8('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x5ff8('0xe')](_0x5ff8('0xa'),auth['isAuthenticated'](),controller[_0x5ff8('0xf')]);module[_0x5ff8('0x10')]=router; \ No newline at end of file +var _0xc5c0=['/:id','isAuthenticated','show','post','create','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','describe'];(function(_0x1f96f6,_0x4d0d84){var _0x5b0526=function(_0x43d9ec){while(--_0x43d9ec){_0x1f96f6['push'](_0x1f96f6['shift']());}};_0x5b0526(++_0x4d0d84);}(_0xc5c0,0x148));var _0x0c5c=function(_0x43cacf,_0x14515b){_0x43cacf=_0x43cacf-0x0;var _0x41d24d=_0xc5c0[_0x43cacf];return _0x41d24d;};'use strict';var multer=require(_0x0c5c('0x0'));var util=require('util');var path=require(_0x0c5c('0x1'));var timeout=require(_0x0c5c('0x2'));var express=require('express');var router=express[_0x0c5c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c5c('0x4'));var interaction=require(_0x0c5c('0x5'));var config=require(_0x0c5c('0x6'));var controller=require(_0x0c5c('0x7'));router[_0x0c5c('0x8')]('/',auth['isAuthenticated'](),controller[_0x0c5c('0x9')]);router[_0x0c5c('0x8')](_0x0c5c('0xa'),auth['isAuthenticated'](),controller[_0x0c5c('0xb')]);router[_0x0c5c('0x8')](_0x0c5c('0xc'),auth[_0x0c5c('0xd')](),controller[_0x0c5c('0xe')]);router[_0x0c5c('0xf')]('/',auth[_0x0c5c('0xd')](),controller[_0x0c5c('0x10')]);router['put'](_0x0c5c('0xc'),auth[_0x0c5c('0xd')](),controller['update']);router['delete'](_0x0c5c('0xc'),auth[_0x0c5c('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 960b759..b378952 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 _0x6c78=['isAuthenticated','index','get','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../config/environment','./intDeskAccount.controller'];(function(_0x349367,_0x1cede2){var _0x14179b=function(_0x38a191){while(--_0x38a191){_0x349367['push'](_0x349367['shift']());}};_0x14179b(++_0x1cede2);}(_0x6c78,0x1d9));var _0x86c7=function(_0x3d6e1d,_0x575ffa){_0x3d6e1d=_0x3d6e1d-0x0;var _0x1f6645=_0x6c78[_0x3d6e1d];return _0x1f6645;};'use strict';var multer=require(_0x86c7('0x0'));var util=require(_0x86c7('0x1'));var path=require(_0x86c7('0x2'));var timeout=require(_0x86c7('0x3'));var express=require('express');var router=express[_0x86c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x86c7('0x5'));var controller=require(_0x86c7('0x6'));router['get']('/',auth[_0x86c7('0x7')](),controller[_0x86c7('0x8')]);router[_0x86c7('0x9')]('/:id',auth[_0x86c7('0x7')](),controller[_0x86c7('0xa')]);router[_0x86c7('0x9')](_0x86c7('0xb'),auth[_0x86c7('0x7')](),controller[_0x86c7('0xc')]);router[_0x86c7('0x9')]('/:id/fields',auth[_0x86c7('0x7')](),controller[_0x86c7('0xd')]);router[_0x86c7('0xe')]('/',auth[_0x86c7('0x7')](),controller[_0x86c7('0xf')]);router['post'](_0x86c7('0xb'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x86c7('0x10')]('/:id',auth[_0x86c7('0x7')](),controller[_0x86c7('0x11')]);router[_0x86c7('0x12')]('/:id',auth[_0x86c7('0x7')](),controller[_0x86c7('0x13')]);module['exports']=router; \ No newline at end of file +var _0x34a4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x34a4,0x1c1));var _0x434a=function(_0x28107d,_0x2ec8b3){_0x28107d=_0x28107d-0x0;var _0x2b1cbe=_0x34a4[_0x28107d];return _0x2b1cbe;};'use strict';var multer=require(_0x434a('0x0'));var util=require(_0x434a('0x1'));var path=require(_0x434a('0x2'));var timeout=require(_0x434a('0x3'));var express=require(_0x434a('0x4'));var router=express[_0x434a('0x5')]();var fs_extra=require(_0x434a('0x6'));var auth=require(_0x434a('0x7'));var interaction=require(_0x434a('0x8'));var config=require(_0x434a('0x9'));var controller=require(_0x434a('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x434a('0xb')]);router[_0x434a('0xc')](_0x434a('0xd'),auth[_0x434a('0xe')](),controller['show']);router[_0x434a('0xc')](_0x434a('0xf'),auth['isAuthenticated'](),controller[_0x434a('0x10')]);router[_0x434a('0xc')](_0x434a('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x434a('0x12')]('/',auth['isAuthenticated'](),controller[_0x434a('0x13')]);router[_0x434a('0x12')](_0x434a('0xf'),auth['isAuthenticated'](),controller[_0x434a('0x14')]);router[_0x434a('0x15')](_0x434a('0xd'),auth[_0x434a('0xe')](),controller[_0x434a('0x16')]);router[_0x434a('0x17')](_0x434a('0xd'),auth[_0x434a('0xe')](),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 96733ae..4e8f253 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 _0xa2f5=['newTab','integrationTab','STRING','ENUM','basic'];(function(_0x72c924,_0x21ba61){var _0x5a56a8=function(_0x2f20ed){while(--_0x2f20ed){_0x72c924['push'](_0x72c924['shift']());}};_0x5a56a8(++_0x21ba61);}(_0xa2f5,0x1e2));var _0x5a2f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa2f5[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5a2f('0x0')]},'username':{'type':Sequelize[_0x5a2f('0x0')]},'remoteUri':{'type':Sequelize[_0x5a2f('0x0')]},'authType':{'type':Sequelize[_0x5a2f('0x1')]('basic'),'defaultValue':_0x5a2f('0x2')},'password':{'type':Sequelize[_0x5a2f('0x0')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x5a2f('0x0')]},'token':{'type':Sequelize[_0x5a2f('0x0')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5a2f('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x5a2f('0x1')]('integrationTab',_0x5a2f('0x3')),'defaultValue':_0x5a2f('0x4')}}; \ No newline at end of file +var _0x4dfe=['ENUM','basic','integrationTab','newTab','exports','STRING'];(function(_0x3011dd,_0x57209a){var _0x56e951=function(_0x35cb76){while(--_0x35cb76){_0x3011dd['push'](_0x3011dd['shift']());}};_0x56e951(++_0x57209a);}(_0x4dfe,0x19c));var _0xe4df=function(_0x54564a,_0x24bc1b){_0x54564a=_0x54564a-0x0;var _0x3c86dc=_0x4dfe[_0x54564a];return _0x3c86dc;};'use strict';var Sequelize=require('sequelize');module[_0xe4df('0x0')]={'name':{'type':Sequelize[_0xe4df('0x1')]},'description':{'type':Sequelize[_0xe4df('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe4df('0x1')]},'authType':{'type':Sequelize[_0xe4df('0x2')](_0xe4df('0x3')),'defaultValue':_0xe4df('0x3')},'password':{'type':Sequelize[_0xe4df('0x1')]},'consumerKey':{'type':Sequelize[_0xe4df('0x1')]},'consumerSecret':{'type':Sequelize[_0xe4df('0x1')]},'token':{'type':Sequelize[_0xe4df('0x1')]},'tokenSecret':{'type':Sequelize[_0xe4df('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xe4df('0x2')](_0xe4df('0x4'),_0xe4df('0x5')),'defaultValue':_0xe4df('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index b59fa57..5e4a7c1 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 _0x9439=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','send','index','map','DeskAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','include','catch','show','params','create','body','update','find','findOne','DeskConfiguration','rawAttributes','length','filter','getConfigurations','Subjects','getSubjects','Descriptions','getDescriptions','channel','DeskField','getFields','priority','remoteUri','authType','username','consumerKey','consumerSecret','token','tokenSecret','substring','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','password','toString','concat','_embedded','entries','label','test','statusCode','stringify','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x1f4984,_0x4311a2){var _0x4432a0=function(_0x57729a){while(--_0x57729a){_0x1f4984['push'](_0x1f4984['shift']());}};_0x4432a0(++_0x4311a2);}(_0x9439,0xc9));var _0x9943=function(_0x2ebe8f,_0x51953d){_0x2ebe8f=_0x2ebe8f-0x0;var _0x1abba9=_0x9439[_0x2ebe8f];return _0x1abba9;};'use strict';var emlformat=require(_0x9943('0x0'));var rimraf=require(_0x9943('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9943('0x2'));var rp=require(_0x9943('0x3'));var moment=require(_0x9943('0x4'));var BPromise=require(_0x9943('0x5'));var Mustache=require(_0x9943('0x6'));var util=require(_0x9943('0x7'));var path=require(_0x9943('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9943('0x9'));var fs=require('fs');var fs_extra=require(_0x9943('0xa'));var _=require(_0x9943('0xb'));var squel=require(_0x9943('0xc'));var crypto=require(_0x9943('0xd'));var jsforce=require(_0x9943('0xe'));var deskjs=require(_0x9943('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9943('0x10'));var Redis=require(_0x9943('0x11'));var authService=require(_0x9943('0x12'));var qs=require(_0x9943('0x13'));var as=require(_0x9943('0x14'));var hardwareService=require(_0x9943('0x15'));var logger=require(_0x9943('0x16'))(_0x9943('0x17'));var utils=require('../../config/utils');var config=require(_0x9943('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9943('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56cdad,_0x4b93f2){_0x4b93f2=_0x4b93f2||0xcc;return function(_0x244bcc){if(_0x244bcc){return _0x56cdad['sendStatus'](_0x4b93f2);}return _0x56cdad[_0x9943('0x1a')](_0x4b93f2)['end']();};}function respondWithResult(_0x1f836c,_0x3cf200){_0x3cf200=_0x3cf200||0xc8;return function(_0x50e17e){if(_0x50e17e){return _0x1f836c[_0x9943('0x1a')](_0x3cf200)['json'](_0x50e17e);}};}function respondWithFilteredResult(_0x5a883b,_0x4184c6){return function(_0x329941){if(_0x329941){var _0x4aa196=typeof _0x4184c6[_0x9943('0x1b')]===_0x9943('0x1c')&&typeof _0x4184c6[_0x9943('0x1d')]===_0x9943('0x1c');var _0x4149ae=_0x329941[_0x9943('0x1e')];var _0x2287f8=_0x4aa196?0x0:_0x4184c6['offset'];var _0x4323e7=_0x4aa196?_0x329941[_0x9943('0x1e')]:_0x4184c6['offset']+_0x4184c6[_0x9943('0x1d')];var _0x484228;if(_0x4323e7>=_0x4149ae){_0x4323e7=_0x4149ae;_0x484228=0xc8;}else{_0x484228=0xce;}_0x5a883b[_0x9943('0x1a')](_0x484228);return _0x5a883b[_0x9943('0x1f')](_0x9943('0x20'),_0x2287f8+'-'+_0x4323e7+'/'+_0x4149ae)[_0x9943('0x21')](_0x329941);}return null;};}function patchUpdates(_0x264be6){return function(_0x55b2c3){try{jsonpatch['apply'](_0x55b2c3,_0x264be6,!![]);}catch(_0x2cb980){return BPromise[_0x9943('0x22')](_0x2cb980);}return _0x55b2c3[_0x9943('0x23')]();};}function saveUpdates(_0x357de3,_0x163f33){return function(_0x3c9583){if(_0x3c9583){return _0x3c9583['update'](_0x357de3)[_0x9943('0x24')](function(_0x111e78){return _0x111e78;});}return null;};}function removeEntity(_0x2b792c,_0x4f6310){return function(_0x2b204e){if(_0x2b204e){return _0x2b204e[_0x9943('0x25')]()[_0x9943('0x24')](function(){_0x2b792c[_0x9943('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e630b,_0x2d2f59){return function(_0x2283e3){if(!_0x2283e3){_0x2e630b[_0x9943('0x26')](0x194);}return _0x2283e3;};}function handleError(_0x3c1b98,_0x23b252){_0x23b252=_0x23b252||0x1f4;return function(_0x52aa98){logger['error'](_0x52aa98[_0x9943('0x27')]);if(_0x52aa98[_0x9943('0x28')]){delete _0x52aa98[_0x9943('0x28')];}_0x3c1b98['status'](_0x23b252)[_0x9943('0x29')](_0x52aa98);};}exports[_0x9943('0x2a')]=function(_0x942e28,_0x3a3018){var _0x2a3dc2={},_0x3f2220={},_0x31a6e3={'count':0x0,'rows':[]};var _0x371b0e=_[_0x9943('0x2b')](db[_0x9943('0x2c')]['rawAttributes'],function(_0x5ce3fa){return{'name':_0x5ce3fa[_0x9943('0x2d')],'type':_0x5ce3fa[_0x9943('0x2e')]['key']};});_0x3f2220[_0x9943('0x2f')]=_['map'](_0x371b0e,_0x9943('0x28'));_0x3f2220[_0x9943('0x30')]=_[_0x9943('0x31')](_0x942e28['query']);_0x3f2220[_0x9943('0x32')]=_[_0x9943('0x33')](_0x3f2220[_0x9943('0x2f')],_0x3f2220[_0x9943('0x30')]);_0x2a3dc2['attributes']=_['intersection'](_0x3f2220['model'],qs['fields'](_0x942e28[_0x9943('0x30')][_0x9943('0x34')]));_0x2a3dc2[_0x9943('0x35')]=_0x2a3dc2[_0x9943('0x35')]['length']?_0x2a3dc2['attributes']:_0x3f2220[_0x9943('0x2f')];if(!_0x942e28[_0x9943('0x30')][_0x9943('0x36')](_0x9943('0x37'))){_0x2a3dc2['limit']=qs[_0x9943('0x1d')](_0x942e28[_0x9943('0x30')][_0x9943('0x1d')]);_0x2a3dc2[_0x9943('0x1b')]=qs['offset'](_0x942e28[_0x9943('0x30')]['offset']);}_0x2a3dc2[_0x9943('0x38')]=qs[_0x9943('0x39')](_0x942e28['query']['sort']);_0x2a3dc2['where']=qs[_0x9943('0x32')](_[_0x9943('0x3a')](_0x942e28[_0x9943('0x30')],_0x3f2220[_0x9943('0x32')]),_0x371b0e);if(_0x942e28[_0x9943('0x30')]['filter']){_0x2a3dc2['where']=_[_0x9943('0x3b')](_0x2a3dc2[_0x9943('0x3c')],{'$or':_[_0x9943('0x2b')](_0x371b0e,function(_0x5799e8){if(_0x5799e8['type']!=='VIRTUAL'){var _0x47029a={};_0x47029a[_0x5799e8[_0x9943('0x28')]]={'$like':'%'+_0x942e28[_0x9943('0x30')]['filter']+'%'};return _0x47029a;}})});}_0x2a3dc2=_[_0x9943('0x3b')]({},_0x2a3dc2,_0x942e28[_0x9943('0x3d')]);var _0x9d12f5={'where':_0x2a3dc2['where']};return db[_0x9943('0x2c')]['count'](_0x9d12f5)['then'](function(_0x3fb4d1){_0x31a6e3[_0x9943('0x1e')]=_0x3fb4d1;if(_0x942e28[_0x9943('0x30')][_0x9943('0x3e')]){_0x2a3dc2[_0x9943('0x3f')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2a3dc2);})[_0x9943('0x24')](function(_0x1a0162){_0x31a6e3['rows']=_0x1a0162;return _0x31a6e3;})['then'](respondWithFilteredResult(_0x3a3018,_0x2a3dc2))[_0x9943('0x40')](handleError(_0x3a3018,null));};exports[_0x9943('0x41')]=function(_0x17b5bf,_0x581681){var _0xed2d={'raw':![],'where':{'id':_0x17b5bf[_0x9943('0x42')]['id']}},_0x5856dd={};_0x5856dd['model']=_['keys'](db['DeskAccount']['rawAttributes']);_0x5856dd['query']=_[_0x9943('0x31')](_0x17b5bf[_0x9943('0x30')]);_0x5856dd[_0x9943('0x32')]=_[_0x9943('0x33')](_0x5856dd[_0x9943('0x2f')],_0x5856dd[_0x9943('0x30')]);_0xed2d['attributes']=_[_0x9943('0x33')](_0x5856dd[_0x9943('0x2f')],qs[_0x9943('0x34')](_0x17b5bf[_0x9943('0x30')][_0x9943('0x34')]));_0xed2d[_0x9943('0x35')]=_0xed2d[_0x9943('0x35')]['length']?_0xed2d[_0x9943('0x35')]:_0x5856dd['model'];if(_0x17b5bf[_0x9943('0x30')][_0x9943('0x3e')]){_0xed2d[_0x9943('0x3f')]=[{'all':!![]}];}_0xed2d=_[_0x9943('0x3b')]({},_0xed2d,_0x17b5bf[_0x9943('0x3d')]);return db[_0x9943('0x2c')]['find'](_0xed2d)[_0x9943('0x24')](handleEntityNotFound(_0x581681,null))[_0x9943('0x24')](respondWithResult(_0x581681,null))[_0x9943('0x40')](handleError(_0x581681,null));};exports[_0x9943('0x43')]=function(_0x29a881,_0x22015e){return db[_0x9943('0x2c')][_0x9943('0x43')](_0x29a881[_0x9943('0x44')],{})[_0x9943('0x24')](respondWithResult(_0x22015e,0xc9))[_0x9943('0x40')](handleError(_0x22015e,null));};exports[_0x9943('0x45')]=function(_0x33528f,_0x564c64){if(_0x33528f[_0x9943('0x44')]['id']){delete _0x33528f[_0x9943('0x44')]['id'];}return db[_0x9943('0x2c')][_0x9943('0x46')]({'where':{'id':_0x33528f[_0x9943('0x42')]['id']}})[_0x9943('0x24')](handleEntityNotFound(_0x564c64,null))[_0x9943('0x24')](saveUpdates(_0x33528f[_0x9943('0x44')],null))[_0x9943('0x24')](respondWithResult(_0x564c64,null))[_0x9943('0x40')](handleError(_0x564c64,null));};exports['destroy']=function(_0x59dbf8,_0x14b909){return db[_0x9943('0x2c')]['find']({'where':{'id':_0x59dbf8[_0x9943('0x42')]['id']}})[_0x9943('0x24')](handleEntityNotFound(_0x14b909,null))[_0x9943('0x24')](removeEntity(_0x14b909,null))[_0x9943('0x40')](handleError(_0x14b909,null));};exports['getConfigurations']=function(_0x4a290b,_0x5de52a,_0x567a40){var _0x3097c9={};var _0x599356={};var _0x5ebc21;var _0x42b8e2;return db[_0x9943('0x2c')][_0x9943('0x47')]({'where':{'id':_0x4a290b[_0x9943('0x42')]['id']}})[_0x9943('0x24')](handleEntityNotFound(_0x5de52a,null))[_0x9943('0x24')](function(_0x3bd02d){if(_0x3bd02d){_0x5ebc21=_0x3bd02d;_0x599356[_0x9943('0x2f')]=_[_0x9943('0x31')](db[_0x9943('0x48')][_0x9943('0x49')]);_0x599356[_0x9943('0x30')]=_[_0x9943('0x31')](_0x4a290b[_0x9943('0x30')]);_0x599356['filters']=_[_0x9943('0x33')](_0x599356[_0x9943('0x2f')],_0x599356[_0x9943('0x30')]);_0x3097c9[_0x9943('0x35')]=_[_0x9943('0x33')](_0x599356[_0x9943('0x2f')],qs[_0x9943('0x34')](_0x4a290b[_0x9943('0x30')][_0x9943('0x34')]));_0x3097c9['attributes']=_0x3097c9[_0x9943('0x35')][_0x9943('0x4a')]?_0x3097c9['attributes']:_0x599356[_0x9943('0x2f')];_0x3097c9['order']=qs[_0x9943('0x39')](_0x4a290b[_0x9943('0x30')][_0x9943('0x39')]);_0x3097c9[_0x9943('0x3c')]=qs[_0x9943('0x32')](_['pick'](_0x4a290b[_0x9943('0x30')],_0x599356['filters']));if(_0x4a290b['query'][_0x9943('0x4b')]){_0x3097c9[_0x9943('0x3c')]=_[_0x9943('0x3b')](_0x3097c9[_0x9943('0x3c')],{'$or':_['map'](_0x3097c9[_0x9943('0x35')],function(_0x2961d9){var _0x2bfd47={};_0x2bfd47[_0x2961d9]={'$like':'%'+_0x4a290b[_0x9943('0x30')][_0x9943('0x4b')]+'%'};return _0x2bfd47;})});}_0x3097c9=_[_0x9943('0x3b')]({},_0x3097c9,_0x4a290b[_0x9943('0x3d')]);return _0x5ebc21[_0x9943('0x4c')](_0x3097c9);}})[_0x9943('0x24')](function(_0x3ca617){if(_0x3ca617){_0x42b8e2=_0x3ca617[_0x9943('0x4a')];if(!_0x4a290b[_0x9943('0x30')][_0x9943('0x36')](_0x9943('0x37'))){_0x3097c9[_0x9943('0x1d')]=qs[_0x9943('0x1d')](_0x4a290b[_0x9943('0x30')][_0x9943('0x1d')]);_0x3097c9['offset']=qs[_0x9943('0x1b')](_0x4a290b['query'][_0x9943('0x1b')]);}return _0x5ebc21[_0x9943('0x4c')](_0x3097c9);}})[_0x9943('0x24')](function(_0x2d1fc8){if(_0x2d1fc8){return _0x2d1fc8?{'count':_0x42b8e2,'rows':_0x2d1fc8}:null;}})[_0x9943('0x24')](respondWithResult(_0x5de52a,null))[_0x9943('0x40')](handleError(_0x5de52a,null));};exports['addConfiguration']=function(_0x38f0fd,_0x17aa42,_0xda3b12){if(_0x38f0fd[_0x9943('0x44')]['id']){delete _0x38f0fd[_0x9943('0x44')]['id'];}return db['DeskAccount'][_0x9943('0x47')]({'where':{'id':_0x38f0fd['params']['id']}})[_0x9943('0x24')](handleEntityNotFound(_0x17aa42,null))[_0x9943('0x24')](function(_0x51542a){if(_0x51542a){_0x38f0fd[_0x9943('0x44')]['AccountId']=_0x51542a['id'];_0x38f0fd[_0x9943('0x44')][_0x9943('0x4d')]=integrations[_0x9943('0x4e')](_0x38f0fd[_0x9943('0x44')]['channel'],_0x38f0fd[_0x9943('0x44')]['type']);_0x38f0fd['body'][_0x9943('0x4f')]=integrations[_0x9943('0x50')](_0x38f0fd['body'][_0x9943('0x51')],_0x38f0fd['body'][_0x9943('0x2e')]);return db[_0x9943('0x48')][_0x9943('0x43')](_0x38f0fd[_0x9943('0x44')],{'include':[{'model':db[_0x9943('0x52')],'as':_0x9943('0x4d')},{'model':db[_0x9943('0x52')],'as':_0x9943('0x4f')}]});}return null;})['then'](respondWithResult(_0x17aa42,null))[_0x9943('0x40')](handleError(_0x17aa42,null));};exports[_0x9943('0x53')]=function(_0x25e252,_0x545540,_0x5edd6d){var _0x23ed6a=[{'name':_0x9943('0x54'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x57a521='';return db[_0x9943('0x2c')][_0x9943('0x47')]({'where':{'id':_0x25e252[_0x9943('0x42')]['id']},'attributes':['id',_0x9943('0x55'),_0x9943('0x56'),_0x9943('0x57'),'password',_0x9943('0x58'),_0x9943('0x59'),_0x9943('0x5a'),_0x9943('0x5b')]})[_0x9943('0x24')](handleEntityNotFound(_0x545540,null))[_0x9943('0x24')](function(_0x24388b){if(_0x24388b){_0x57a521=_0x24388b[_0x9943('0x55')];var _0x4d77b4=_0x57a521['slice'](-0x1);if(_0x4d77b4==='/'){_0x57a521=_0x57a521[_0x9943('0x5c')](0x0,_0x57a521['lastIndexOf'](_0x4d77b4));}var _0x5c539a={'method':_0x9943('0x5d'),'uri':util[_0x9943('0x5e')](_0x9943('0x5f'),_0x57a521),'headers':{'Content-Type':_0x9943('0x60'),'Accept':_0x9943('0x60')},'json':!![]};if(_0x24388b[_0x9943('0x56')]===_0x9943('0x61')){_0x5c539a['headers'][_0x9943('0x62')]=util[_0x9943('0x5e')](_0x9943('0x63'),new Buffer(util[_0x9943('0x5e')](_0x9943('0x64'),_0x24388b['username'],_0x24388b[_0x9943('0x65')]))[_0x9943('0x66')]('base64'));}return rp(_0x5c539a)[_0x9943('0x24')](function(_0x2d9ab7){return _0x23ed6a[_0x9943('0x67')](_['map'](_0x2d9ab7[_0x9943('0x68')][_0x9943('0x69')],function(_0x45523f){return{'id':_0x45523f[_0x9943('0x28')],'name':_0x45523f[_0x9943('0x28')],'type':_0x45523f['type'],'active':_0x45523f['active'],'label':_0x45523f[_0x9943('0x6a')],'custom':!![]};}));});}})[_0x9943('0x24')](function(_0x2caac4){return{'count':_0x2caac4[_0x9943('0x4a')],'rows':_0x2caac4};})[_0x9943('0x24')](respondWithResult(_0x545540,null))[_0x9943('0x40')](function(_0x11ffea){var _0x398694=_0x25e252[_0x9943('0x30')][_0x9943('0x6b')]?0x1f4:_0x11ffea[_0x9943('0x6c')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x9943('0x53'),_0x398694,JSON[_0x9943('0x6d')](_0x11ffea));delete _0x11ffea[_0x9943('0x28')];if(_0x398694===0x191){_0x398694=0x190;}_0x545540[_0x9943('0x1a')](_0x398694)['send'](_0x25e252['query'][_0x9943('0x6b')]?{'message':'Wrong\x20credentials','statusCode':_0x11ffea[_0x9943('0x6c')]}:_0x11ffea);});}; \ No newline at end of file +var _0x6e09=['fieldName','type','key','model','keys','filters','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','intersection','options','DeskAccount','find','create','update','body','params','findOne','length','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskConfiguration','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','lastIndexOf','GET','format','%s/custom_fields','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','active','test','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','json','undefined','limit','count','offset','set','apply','reject','then','destroy','end','sendStatus','error','stack','name','index','map','rawAttributes'];(function(_0x209fff,_0x32deaa){var _0x5467d7=function(_0x591b9d){while(--_0x591b9d){_0x209fff['push'](_0x209fff['shift']());}};_0x5467d7(++_0x32deaa);}(_0x6e09,0x128));var _0x96e0=function(_0x5f4abc,_0x1692ac){_0x5f4abc=_0x5f4abc-0x0;var _0x3c29a6=_0x6e09[_0x5f4abc];return _0x3c29a6;};'use strict';var emlformat=require(_0x96e0('0x0'));var rimraf=require(_0x96e0('0x1'));var zipdir=require(_0x96e0('0x2'));var jsonpatch=require(_0x96e0('0x3'));var rp=require(_0x96e0('0x4'));var moment=require(_0x96e0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x96e0('0x6'));var util=require(_0x96e0('0x7'));var path=require(_0x96e0('0x8'));var sox=require('sox');var csv=require(_0x96e0('0x9'));var ejs=require(_0x96e0('0xa'));var fs=require('fs');var fs_extra=require(_0x96e0('0xb'));var _=require(_0x96e0('0xc'));var squel=require('squel');var crypto=require(_0x96e0('0xd'));var jsforce=require(_0x96e0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x96e0('0x9'));var querystring=require(_0x96e0('0xf'));var Papa=require(_0x96e0('0x10'));var Redis=require(_0x96e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x96e0('0x12'));var as=require(_0x96e0('0x13'));var hardwareService=require(_0x96e0('0x14'));var logger=require('../../config/logger')(_0x96e0('0x15'));var utils=require(_0x96e0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x96e0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x470094,_0xeabd1d){_0xeabd1d=_0xeabd1d||0xcc;return function(_0x17671e){if(_0x17671e){return _0x470094['sendStatus'](_0xeabd1d);}return _0x470094[_0x96e0('0x18')](_0xeabd1d)['end']();};}function respondWithResult(_0x4179cd,_0x5483fa){_0x5483fa=_0x5483fa||0xc8;return function(_0x3131e9){if(_0x3131e9){return _0x4179cd['status'](_0x5483fa)[_0x96e0('0x19')](_0x3131e9);}};}function respondWithFilteredResult(_0xf82173,_0x592301){return function(_0x3640cd){if(_0x3640cd){var _0x26bd4b=typeof _0x592301['offset']===_0x96e0('0x1a')&&typeof _0x592301[_0x96e0('0x1b')]===_0x96e0('0x1a');var _0x2d78a9=_0x3640cd[_0x96e0('0x1c')];var _0x44e4f6=_0x26bd4b?0x0:_0x592301[_0x96e0('0x1d')];var _0x3a3204=_0x26bd4b?_0x3640cd[_0x96e0('0x1c')]:_0x592301[_0x96e0('0x1d')]+_0x592301[_0x96e0('0x1b')];var _0x577323;if(_0x3a3204>=_0x2d78a9){_0x3a3204=_0x2d78a9;_0x577323=0xc8;}else{_0x577323=0xce;}_0xf82173[_0x96e0('0x18')](_0x577323);return _0xf82173[_0x96e0('0x1e')]('Content-Range',_0x44e4f6+'-'+_0x3a3204+'/'+_0x2d78a9)['json'](_0x3640cd);}return null;};}function patchUpdates(_0x42bc5e){return function(_0x2c596f){try{jsonpatch[_0x96e0('0x1f')](_0x2c596f,_0x42bc5e,!![]);}catch(_0x507945){return BPromise[_0x96e0('0x20')](_0x507945);}return _0x2c596f['save']();};}function saveUpdates(_0x321956,_0x3c07ad){return function(_0x1352ee){if(_0x1352ee){return _0x1352ee['update'](_0x321956)[_0x96e0('0x21')](function(_0x4dbe10){return _0x4dbe10;});}return null;};}function removeEntity(_0x58b1fa,_0x3dc50a){return function(_0x45eabe){if(_0x45eabe){return _0x45eabe[_0x96e0('0x22')]()[_0x96e0('0x21')](function(){_0x58b1fa[_0x96e0('0x18')](0xcc)[_0x96e0('0x23')]();});}};}function handleEntityNotFound(_0x28117f,_0x44e85f){return function(_0x40a050){if(!_0x40a050){_0x28117f[_0x96e0('0x24')](0x194);}return _0x40a050;};}function handleError(_0x3c6985,_0xd7438c){_0xd7438c=_0xd7438c||0x1f4;return function(_0x348ac5){logger[_0x96e0('0x25')](_0x348ac5[_0x96e0('0x26')]);if(_0x348ac5[_0x96e0('0x27')]){delete _0x348ac5[_0x96e0('0x27')];}_0x3c6985[_0x96e0('0x18')](_0xd7438c)['send'](_0x348ac5);};}exports[_0x96e0('0x28')]=function(_0x1279be,_0x574173){var _0x2a6ecd={},_0x35f3bf={},_0x4398e9={'count':0x0,'rows':[]};var _0x114aaa=_[_0x96e0('0x29')](db['DeskAccount'][_0x96e0('0x2a')],function(_0x446ecd){return{'name':_0x446ecd[_0x96e0('0x2b')],'type':_0x446ecd[_0x96e0('0x2c')][_0x96e0('0x2d')]};});_0x35f3bf[_0x96e0('0x2e')]=_[_0x96e0('0x29')](_0x114aaa,_0x96e0('0x27'));_0x35f3bf['query']=_[_0x96e0('0x2f')](_0x1279be['query']);_0x35f3bf[_0x96e0('0x30')]=_['intersection'](_0x35f3bf[_0x96e0('0x2e')],_0x35f3bf[_0x96e0('0x31')]);_0x2a6ecd[_0x96e0('0x32')]=_['intersection'](_0x35f3bf[_0x96e0('0x2e')],qs[_0x96e0('0x33')](_0x1279be[_0x96e0('0x31')]['fields']));_0x2a6ecd[_0x96e0('0x32')]=_0x2a6ecd[_0x96e0('0x32')]['length']?_0x2a6ecd[_0x96e0('0x32')]:_0x35f3bf[_0x96e0('0x2e')];if(!_0x1279be['query'][_0x96e0('0x34')](_0x96e0('0x35'))){_0x2a6ecd[_0x96e0('0x1b')]=qs[_0x96e0('0x1b')](_0x1279be[_0x96e0('0x31')]['limit']);_0x2a6ecd[_0x96e0('0x1d')]=qs[_0x96e0('0x1d')](_0x1279be[_0x96e0('0x31')][_0x96e0('0x1d')]);}_0x2a6ecd[_0x96e0('0x36')]=qs[_0x96e0('0x37')](_0x1279be[_0x96e0('0x31')][_0x96e0('0x37')]);_0x2a6ecd[_0x96e0('0x38')]=qs[_0x96e0('0x30')](_[_0x96e0('0x39')](_0x1279be[_0x96e0('0x31')],_0x35f3bf['filters']),_0x114aaa);if(_0x1279be[_0x96e0('0x31')]['filter']){_0x2a6ecd[_0x96e0('0x38')]=_[_0x96e0('0x3a')](_0x2a6ecd[_0x96e0('0x38')],{'$or':_['map'](_0x114aaa,function(_0x35745d){if(_0x35745d['type']!==_0x96e0('0x3b')){var _0xee7974={};_0xee7974[_0x35745d['name']]={'$like':'%'+_0x1279be['query'][_0x96e0('0x3c')]+'%'};return _0xee7974;}})});}_0x2a6ecd=_[_0x96e0('0x3a')]({},_0x2a6ecd,_0x1279be['options']);var _0x268363={'where':_0x2a6ecd[_0x96e0('0x38')]};return db['DeskAccount'][_0x96e0('0x1c')](_0x268363)['then'](function(_0x5f8579){_0x4398e9[_0x96e0('0x1c')]=_0x5f8579;if(_0x1279be[_0x96e0('0x31')][_0x96e0('0x3d')]){_0x2a6ecd[_0x96e0('0x3e')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x2a6ecd);})['then'](function(_0x385779){_0x4398e9['rows']=_0x385779;return _0x4398e9;})[_0x96e0('0x21')](respondWithFilteredResult(_0x574173,_0x2a6ecd))[_0x96e0('0x3f')](handleError(_0x574173,null));};exports[_0x96e0('0x40')]=function(_0x13b7d5,_0x262cef){var _0x2851e7={'raw':![],'where':{'id':_0x13b7d5['params']['id']}},_0x145b2e={};_0x145b2e[_0x96e0('0x2e')]=_['keys'](db['DeskAccount'][_0x96e0('0x2a')]);_0x145b2e[_0x96e0('0x31')]=_[_0x96e0('0x2f')](_0x13b7d5[_0x96e0('0x31')]);_0x145b2e[_0x96e0('0x30')]=_[_0x96e0('0x41')](_0x145b2e[_0x96e0('0x2e')],_0x145b2e[_0x96e0('0x31')]);_0x2851e7[_0x96e0('0x32')]=_[_0x96e0('0x41')](_0x145b2e[_0x96e0('0x2e')],qs[_0x96e0('0x33')](_0x13b7d5[_0x96e0('0x31')][_0x96e0('0x33')]));_0x2851e7[_0x96e0('0x32')]=_0x2851e7[_0x96e0('0x32')]['length']?_0x2851e7[_0x96e0('0x32')]:_0x145b2e[_0x96e0('0x2e')];if(_0x13b7d5[_0x96e0('0x31')]['includeAll']){_0x2851e7['include']=[{'all':!![]}];}_0x2851e7=_[_0x96e0('0x3a')]({},_0x2851e7,_0x13b7d5[_0x96e0('0x42')]);return db[_0x96e0('0x43')][_0x96e0('0x44')](_0x2851e7)[_0x96e0('0x21')](handleEntityNotFound(_0x262cef,null))[_0x96e0('0x21')](respondWithResult(_0x262cef,null))[_0x96e0('0x3f')](handleError(_0x262cef,null));};exports['create']=function(_0x5ee86e,_0x5b9904){return db[_0x96e0('0x43')][_0x96e0('0x45')](_0x5ee86e['body'],{})[_0x96e0('0x21')](respondWithResult(_0x5b9904,0xc9))[_0x96e0('0x3f')](handleError(_0x5b9904,null));};exports[_0x96e0('0x46')]=function(_0xc5d05d,_0x5e92df){if(_0xc5d05d[_0x96e0('0x47')]['id']){delete _0xc5d05d[_0x96e0('0x47')]['id'];}return db[_0x96e0('0x43')]['find']({'where':{'id':_0xc5d05d[_0x96e0('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e92df,null))[_0x96e0('0x21')](saveUpdates(_0xc5d05d[_0x96e0('0x47')],null))[_0x96e0('0x21')](respondWithResult(_0x5e92df,null))[_0x96e0('0x3f')](handleError(_0x5e92df,null));};exports['destroy']=function(_0x5cc296,_0x5cf78b){return db[_0x96e0('0x43')]['find']({'where':{'id':_0x5cc296[_0x96e0('0x48')]['id']}})[_0x96e0('0x21')](handleEntityNotFound(_0x5cf78b,null))[_0x96e0('0x21')](removeEntity(_0x5cf78b,null))[_0x96e0('0x3f')](handleError(_0x5cf78b,null));};exports['getConfigurations']=function(_0xacea4e,_0x188931,_0x2d71dc){var _0x9d9c37={};var _0x47c629={};var _0x2f12d2;var _0x5c3d3a;return db['DeskAccount'][_0x96e0('0x49')]({'where':{'id':_0xacea4e[_0x96e0('0x48')]['id']}})[_0x96e0('0x21')](handleEntityNotFound(_0x188931,null))['then'](function(_0x24172b){if(_0x24172b){_0x2f12d2=_0x24172b;_0x47c629['model']=_[_0x96e0('0x2f')](db['DeskConfiguration'][_0x96e0('0x2a')]);_0x47c629[_0x96e0('0x31')]=_['keys'](_0xacea4e['query']);_0x47c629['filters']=_[_0x96e0('0x41')](_0x47c629[_0x96e0('0x2e')],_0x47c629[_0x96e0('0x31')]);_0x9d9c37[_0x96e0('0x32')]=_[_0x96e0('0x41')](_0x47c629[_0x96e0('0x2e')],qs[_0x96e0('0x33')](_0xacea4e[_0x96e0('0x31')][_0x96e0('0x33')]));_0x9d9c37[_0x96e0('0x32')]=_0x9d9c37[_0x96e0('0x32')][_0x96e0('0x4a')]?_0x9d9c37['attributes']:_0x47c629[_0x96e0('0x2e')];_0x9d9c37[_0x96e0('0x36')]=qs[_0x96e0('0x37')](_0xacea4e[_0x96e0('0x31')][_0x96e0('0x37')]);_0x9d9c37[_0x96e0('0x38')]=qs[_0x96e0('0x30')](_[_0x96e0('0x39')](_0xacea4e[_0x96e0('0x31')],_0x47c629[_0x96e0('0x30')]));if(_0xacea4e[_0x96e0('0x31')][_0x96e0('0x3c')]){_0x9d9c37['where']=_[_0x96e0('0x3a')](_0x9d9c37[_0x96e0('0x38')],{'$or':_['map'](_0x9d9c37[_0x96e0('0x32')],function(_0x4d874e){var _0x2e16ec={};_0x2e16ec[_0x4d874e]={'$like':'%'+_0xacea4e[_0x96e0('0x31')]['filter']+'%'};return _0x2e16ec;})});}_0x9d9c37=_[_0x96e0('0x3a')]({},_0x9d9c37,_0xacea4e[_0x96e0('0x42')]);return _0x2f12d2[_0x96e0('0x4b')](_0x9d9c37);}})[_0x96e0('0x21')](function(_0x2afae4){if(_0x2afae4){_0x5c3d3a=_0x2afae4[_0x96e0('0x4a')];if(!_0xacea4e[_0x96e0('0x31')][_0x96e0('0x34')]('nolimit')){_0x9d9c37[_0x96e0('0x1b')]=qs[_0x96e0('0x1b')](_0xacea4e[_0x96e0('0x31')][_0x96e0('0x1b')]);_0x9d9c37[_0x96e0('0x1d')]=qs[_0x96e0('0x1d')](_0xacea4e['query'][_0x96e0('0x1d')]);}return _0x2f12d2[_0x96e0('0x4b')](_0x9d9c37);}})['then'](function(_0x1091c4){if(_0x1091c4){return _0x1091c4?{'count':_0x5c3d3a,'rows':_0x1091c4}:null;}})['then'](respondWithResult(_0x188931,null))[_0x96e0('0x3f')](handleError(_0x188931,null));};exports[_0x96e0('0x4c')]=function(_0x5a277b,_0x2c83aa,_0x12814a){if(_0x5a277b[_0x96e0('0x47')]['id']){delete _0x5a277b[_0x96e0('0x47')]['id'];}return db['DeskAccount'][_0x96e0('0x49')]({'where':{'id':_0x5a277b[_0x96e0('0x48')]['id']}})[_0x96e0('0x21')](handleEntityNotFound(_0x2c83aa,null))[_0x96e0('0x21')](function(_0x5c48a9){if(_0x5c48a9){_0x5a277b[_0x96e0('0x47')][_0x96e0('0x4d')]=_0x5c48a9['id'];_0x5a277b['body'][_0x96e0('0x4e')]=integrations[_0x96e0('0x4f')](_0x5a277b['body'][_0x96e0('0x50')],_0x5a277b[_0x96e0('0x47')][_0x96e0('0x2c')]);_0x5a277b[_0x96e0('0x47')][_0x96e0('0x51')]=integrations[_0x96e0('0x52')](_0x5a277b[_0x96e0('0x47')][_0x96e0('0x50')],_0x5a277b[_0x96e0('0x47')][_0x96e0('0x2c')]);return db[_0x96e0('0x53')][_0x96e0('0x45')](_0x5a277b['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db[_0x96e0('0x54')],'as':_0x96e0('0x51')}]});}return null;})['then'](respondWithResult(_0x2c83aa,null))[_0x96e0('0x3f')](handleError(_0x2c83aa,null));};exports[_0x96e0('0x55')]=function(_0x34f73e,_0x52b27e,_0x47943f){var _0x370ccf=[{'name':_0x96e0('0x56'),'label':_0x96e0('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x4cfa55='';return db['DeskAccount']['findOne']({'where':{'id':_0x34f73e[_0x96e0('0x48')]['id']},'attributes':['id',_0x96e0('0x57'),_0x96e0('0x58'),_0x96e0('0x59'),_0x96e0('0x5a'),_0x96e0('0x5b'),_0x96e0('0x5c'),_0x96e0('0x5d'),'tokenSecret']})['then'](handleEntityNotFound(_0x52b27e,null))['then'](function(_0x3acae2){if(_0x3acae2){_0x4cfa55=_0x3acae2[_0x96e0('0x57')];var _0x562140=_0x4cfa55[_0x96e0('0x5e')](-0x1);if(_0x562140==='/'){_0x4cfa55=_0x4cfa55[_0x96e0('0x5f')](0x0,_0x4cfa55[_0x96e0('0x60')](_0x562140));}var _0x59b690={'method':_0x96e0('0x61'),'uri':util[_0x96e0('0x62')](_0x96e0('0x63'),_0x4cfa55),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x3acae2[_0x96e0('0x58')]==='basic'){_0x59b690[_0x96e0('0x64')][_0x96e0('0x65')]=util[_0x96e0('0x62')](_0x96e0('0x66'),new Buffer(util[_0x96e0('0x62')](_0x96e0('0x67'),_0x3acae2[_0x96e0('0x59')],_0x3acae2['password']))[_0x96e0('0x68')](_0x96e0('0x69')));}return rp(_0x59b690)[_0x96e0('0x21')](function(_0x5ac968){return _0x370ccf[_0x96e0('0x6a')](_[_0x96e0('0x29')](_0x5ac968['_embedded']['entries'],function(_0x2ca2d3){return{'id':_0x2ca2d3['name'],'name':_0x2ca2d3['name'],'type':_0x2ca2d3[_0x96e0('0x2c')],'active':_0x2ca2d3[_0x96e0('0x6b')],'label':_0x2ca2d3['label'],'custom':!![]};}));});}})[_0x96e0('0x21')](function(_0x3df44b){return{'count':_0x3df44b[_0x96e0('0x4a')],'rows':_0x3df44b};})['then'](respondWithResult(_0x52b27e,null))['catch'](function(_0x23ba16){var _0x52393f=_0x34f73e[_0x96e0('0x31')][_0x96e0('0x6c')]?0x1f4:_0x23ba16['statusCode']||0x1f4;logger[_0x96e0('0x25')](_0x96e0('0x6d'),'getFields',_0x52393f,JSON['stringify'](_0x23ba16));delete _0x23ba16[_0x96e0('0x27')];if(_0x52393f===0x191){_0x52393f=0x190;}_0x52b27e['status'](_0x52393f)[_0x96e0('0x6e')](_0x34f73e[_0x96e0('0x31')][_0x96e0('0x6c')]?{'message':_0x96e0('0x6f'),'statusCode':_0x23ba16[_0x96e0('0x70')]}:_0x23ba16);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index cf23a1c..5d44009 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 _0x258b=['bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','DeskAccount','int_desk_accounts','lodash','api'];(function(_0x4cd1b2,_0x4b1212){var _0x114055=function(_0x5090ef){while(--_0x5090ef){_0x4cd1b2['push'](_0x4cd1b2['shift']());}};_0x114055(++_0x4b1212);}(_0x258b,0x136));var _0xb258=function(_0x53ea58,_0x1ae292){_0x53ea58=_0x53ea58-0x0;var _0x5a35e2=_0x258b[_0x53ea58];return _0x5a35e2;};'use strict';var _=require(_0xb258('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb258('0x1'));var moment=require('moment');var BPromise=require(_0xb258('0x2'));var rp=require(_0xb258('0x3'));var fs=require('fs');var path=require(_0xb258('0x4'));var rimraf=require(_0xb258('0x5'));var config=require(_0xb258('0x6'));var attributes=require(_0xb258('0x7'));var integrations=require(_0xb258('0x8'));module[_0xb258('0x9')]=function(_0x291314,_0x1f58f6){return _0x291314['define'](_0xb258('0xa'),attributes,{'tableName':_0xb258('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf632=['bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','moment'];(function(_0x461e6d,_0x3bcc94){var _0x2c5e61=function(_0xea4854){while(--_0xea4854){_0x461e6d['push'](_0x461e6d['shift']());}};_0x2c5e61(++_0x3bcc94);}(_0xf632,0x8d));var _0x2f63=function(_0x34ab10,_0x29464f){_0x34ab10=_0x34ab10-0x0;var _0x4f5128=_0xf632[_0x34ab10];return _0x4f5128;};'use strict';var _=require(_0x2f63('0x0'));var util=require('util');var logger=require(_0x2f63('0x1'))('api');var moment=require(_0x2f63('0x2'));var BPromise=require(_0x2f63('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2f63('0x4'));var rimraf=require(_0x2f63('0x5'));var config=require(_0x2f63('0x6'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x2f63('0x7'));module[_0x2f63('0x8')]=function(_0x2d2e54,_0x1782f5){return _0x2d2e54[_0x2f63('0x9')](_0x2f63('0xa'),attributes,{'tableName':_0x2f63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index cdc8a0b..a3755b6 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 _0x909a=['util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','DeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','GetDeskAccount','ShowDeskAccount','find','lodash'];(function(_0x45d25f,_0x414062){var _0x5eedff=function(_0x3bd135){while(--_0x3bd135){_0x45d25f['push'](_0x45d25f['shift']());}};_0x5eedff(++_0x414062);}(_0x909a,0x83));var _0xa909=function(_0x570496,_0x26a150){_0x570496=_0x570496-0x0;var _0x1d4204=_0x909a[_0x570496];return _0x1d4204;};'use strict';var _=require(_0xa909('0x0'));var util=require(_0xa909('0x1'));var moment=require('moment');var BPromise=require(_0xa909('0x2'));var rs=require(_0xa909('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa909('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa909('0x5'))('rpc');var config=require(_0xa909('0x6'));var jayson=require(_0xa909('0x7'));var client=jayson['client'][_0xa909('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b8ab0,_0x57950a,_0x418f39){return new BPromise(function(_0x31f880,_0x4dabd7){return client['request'](_0x5b8ab0,_0x418f39)['then'](function(_0x5e5189){logger[_0xa909('0x9')](_0xa909('0xa'),_0x57950a,_0xa909('0xb'));logger[_0xa909('0xc')](_0xa909('0xd'),_0x57950a,_0xa909('0xb'),JSON[_0xa909('0xe')](_0x5e5189));if(_0x5e5189[_0xa909('0xf')]){if(_0x5e5189[_0xa909('0xf')][_0xa909('0x10')]===0x1f4){logger[_0xa909('0xf')]('DeskAccount,\x20%s,\x20%s',_0x57950a,_0x5e5189['error']['message']);return _0x4dabd7(_0x5e5189[_0xa909('0xf')][_0xa909('0x11')]);}logger[_0xa909('0xf')](_0xa909('0xa'),_0x57950a,_0x5e5189[_0xa909('0xf')][_0xa909('0x11')]);return _0x31f880(_0x5e5189['error'][_0xa909('0x11')]);}else{logger[_0xa909('0x9')](_0xa909('0xa'),_0x57950a,_0xa909('0xb'));_0x31f880(_0x5e5189['result']['message']);}})[_0xa909('0x12')](function(_0x18c770){logger['error'](_0xa909('0xa'),_0x57950a,_0x18c770);_0x4dabd7(_0x18c770);});});}exports['GetDeskAccount']=function(_0x5ee1de){var _0x55abf3=this;return new Promise(function(_0x559be4,_0x17b5cb){return db[_0xa909('0x13')][_0xa909('0x14')]({'raw':_0x5ee1de[_0xa909('0x15')]?_0x5ee1de[_0xa909('0x15')][_0xa909('0x16')]===undefined?!![]:![]:!![],'where':_0x5ee1de['options']?_0x5ee1de[_0xa909('0x15')][_0xa909('0x17')]||null:null,'attributes':_0x5ee1de['options']?_0x5ee1de[_0xa909('0x15')][_0xa909('0x18')]||null:null,'limit':_0x5ee1de[_0xa909('0x15')]?_0x5ee1de[_0xa909('0x15')][_0xa909('0x19')]||null:null,'include':_0x5ee1de[_0xa909('0x15')]?_0x5ee1de['options'][_0xa909('0x1a')]?_[_0xa909('0x1b')](_0x5ee1de['options'][_0xa909('0x1a')],function(_0x24e8b2){return{'model':db[_0x24e8b2[_0xa909('0x1c')]],'as':_0x24e8b2['as'],'attributes':_0x24e8b2[_0xa909('0x18')],'include':_0x24e8b2['include']?_[_0xa909('0x1b')](_0x24e8b2['include'],function(_0x5d1a7e){return{'model':db[_0x5d1a7e[_0xa909('0x1c')]],'as':_0x5d1a7e['as'],'attributes':_0x5d1a7e[_0xa909('0x18')],'include':_0x5d1a7e[_0xa909('0x1a')]?_[_0xa909('0x1b')](_0x5d1a7e['include'],function(_0x238d46){return{'model':db[_0x238d46[_0xa909('0x1c')]],'as':_0x238d46['as'],'attributes':_0x238d46[_0xa909('0x18')]};}):[]};}):[]};}):[]:[]})[_0xa909('0x1d')](function(_0x5dc00a){logger[_0xa909('0x9')]('GetDeskAccount',_0x5ee1de);logger[_0xa909('0xc')](_0xa909('0x1e'),_0x5ee1de,JSON['stringify'](_0x5dc00a));_0x559be4(_0x5dc00a);})[_0xa909('0x12')](function(_0x33f9bf){logger[_0xa909('0xf')](_0xa909('0x1e'),_0x33f9bf['message'],_0x5ee1de);_0x17b5cb(_0x55abf3[_0xa909('0xf')](0x1f4,_0x33f9bf[_0xa909('0x11')]));});});};exports[_0xa909('0x1f')]=function(_0x5199a5){var _0x170bdf=this;return new Promise(function(_0xe4e62d,_0x5989dd){return db['DeskAccount'][_0xa909('0x20')]({'raw':_0x5199a5['options']?_0x5199a5[_0xa909('0x15')][_0xa909('0x16')]===undefined?!![]:![]:!![],'where':_0x5199a5['options']?_0x5199a5['options'][_0xa909('0x17')]||null:null,'attributes':_0x5199a5['options']?_0x5199a5['options']['attributes']||null:null,'include':_0x5199a5['options']?_0x5199a5[_0xa909('0x15')][_0xa909('0x1a')]?_[_0xa909('0x1b')](_0x5199a5[_0xa909('0x15')][_0xa909('0x1a')],function(_0x1daff3){return{'model':db[_0x1daff3[_0xa909('0x1c')]],'as':_0x1daff3['as'],'attributes':_0x1daff3[_0xa909('0x18')],'include':_0x1daff3[_0xa909('0x1a')]?_[_0xa909('0x1b')](_0x1daff3['include'],function(_0x5331ab){return{'model':db[_0x5331ab[_0xa909('0x1c')]],'as':_0x5331ab['as'],'attributes':_0x5331ab[_0xa909('0x18')],'include':_0x5331ab[_0xa909('0x1a')]?_['map'](_0x5331ab[_0xa909('0x1a')],function(_0x4eb005){return{'model':db[_0x4eb005[_0xa909('0x1c')]],'as':_0x4eb005['as'],'attributes':_0x4eb005[_0xa909('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9ad5){logger['info'](_0xa909('0x1f'),_0x5199a5);logger['debug'](_0xa909('0x1f'),_0x5199a5,JSON[_0xa909('0xe')](_0x1f9ad5));_0xe4e62d(_0x1f9ad5);})[_0xa909('0x12')](function(_0x4876bd){logger[_0xa909('0xf')]('ShowDeskAccount',_0x4876bd[_0xa909('0x11')],_0x5199a5);_0x5989dd(_0x170bdf[_0xa909('0xf')](0x1f4,_0x4876bd[_0xa909('0x11')]));});});}; \ No newline at end of file +var _0x4786=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','DeskAccount','options','raw','where','attributes','include','map','model','GetDeskAccount','stringify','ShowDeskAccount','find','lodash','util'];(function(_0x4fc79e,_0x3b1919){var _0x301cba=function(_0x39ed05){while(--_0x39ed05){_0x4fc79e['push'](_0x4fc79e['shift']());}};_0x301cba(++_0x3b1919);}(_0x4786,0xbe));var _0x6478=function(_0x26efea,_0x4d5f6f){_0x26efea=_0x26efea-0x0;var _0x14cfdf=_0x4786[_0x26efea];return _0x14cfdf;};'use strict';var _=require(_0x6478('0x0'));var util=require(_0x6478('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6478('0x2'));var fs=require('fs');var Redis=require(_0x6478('0x3'));var db=require(_0x6478('0x4'))['db'];var utils=require(_0x6478('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6478('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6478('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5245be,_0x4dcc45,_0x559415){return new BPromise(function(_0x1f13da,_0x3510be){return client[_0x6478('0x8')](_0x5245be,_0x559415)[_0x6478('0x9')](function(_0x1eb9a2){logger[_0x6478('0xa')](_0x6478('0xb'),_0x4dcc45,_0x6478('0xc'));logger[_0x6478('0xd')](_0x6478('0xe'),_0x4dcc45,_0x6478('0xc'),JSON['stringify'](_0x1eb9a2));if(_0x1eb9a2['error']){if(_0x1eb9a2[_0x6478('0xf')][_0x6478('0x10')]===0x1f4){logger['error'](_0x6478('0xb'),_0x4dcc45,_0x1eb9a2[_0x6478('0xf')][_0x6478('0x11')]);return _0x3510be(_0x1eb9a2[_0x6478('0xf')][_0x6478('0x11')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x4dcc45,_0x1eb9a2['error']['message']);return _0x1f13da(_0x1eb9a2[_0x6478('0xf')][_0x6478('0x11')]);}else{logger[_0x6478('0xa')](_0x6478('0xb'),_0x4dcc45,'request\x20sent');_0x1f13da(_0x1eb9a2[_0x6478('0x12')][_0x6478('0x11')]);}})[_0x6478('0x13')](function(_0x569e2f){logger[_0x6478('0xf')]('DeskAccount,\x20%s,\x20%s',_0x4dcc45,_0x569e2f);_0x3510be(_0x569e2f);});});}exports['GetDeskAccount']=function(_0x306841){var _0x106857=this;return new Promise(function(_0x568e1c,_0x5eb1b6){return db[_0x6478('0x14')]['findAll']({'raw':_0x306841[_0x6478('0x15')]?_0x306841[_0x6478('0x15')][_0x6478('0x16')]===undefined?!![]:![]:!![],'where':_0x306841[_0x6478('0x15')]?_0x306841[_0x6478('0x15')][_0x6478('0x17')]||null:null,'attributes':_0x306841[_0x6478('0x15')]?_0x306841[_0x6478('0x15')][_0x6478('0x18')]||null:null,'limit':_0x306841['options']?_0x306841[_0x6478('0x15')]['limit']||null:null,'include':_0x306841[_0x6478('0x15')]?_0x306841[_0x6478('0x15')][_0x6478('0x19')]?_[_0x6478('0x1a')](_0x306841[_0x6478('0x15')][_0x6478('0x19')],function(_0x5a3188){return{'model':db[_0x5a3188[_0x6478('0x1b')]],'as':_0x5a3188['as'],'attributes':_0x5a3188[_0x6478('0x18')],'include':_0x5a3188['include']?_['map'](_0x5a3188[_0x6478('0x19')],function(_0x25f2d4){return{'model':db[_0x25f2d4[_0x6478('0x1b')]],'as':_0x25f2d4['as'],'attributes':_0x25f2d4['attributes'],'include':_0x25f2d4[_0x6478('0x19')]?_['map'](_0x25f2d4[_0x6478('0x19')],function(_0x385372){return{'model':db[_0x385372[_0x6478('0x1b')]],'as':_0x385372['as'],'attributes':_0x385372[_0x6478('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6478('0x9')](function(_0x3eadca){logger[_0x6478('0xa')](_0x6478('0x1c'),_0x306841);logger[_0x6478('0xd')](_0x6478('0x1c'),_0x306841,JSON[_0x6478('0x1d')](_0x3eadca));_0x568e1c(_0x3eadca);})[_0x6478('0x13')](function(_0x36f50d){logger[_0x6478('0xf')](_0x6478('0x1c'),_0x36f50d[_0x6478('0x11')],_0x306841);_0x5eb1b6(_0x106857[_0x6478('0xf')](0x1f4,_0x36f50d[_0x6478('0x11')]));});});};exports[_0x6478('0x1e')]=function(_0x365e75){var _0x12b589=this;return new Promise(function(_0x3d50cd,_0x474f48){return db[_0x6478('0x14')][_0x6478('0x1f')]({'raw':_0x365e75[_0x6478('0x15')]?_0x365e75[_0x6478('0x15')][_0x6478('0x16')]===undefined?!![]:![]:!![],'where':_0x365e75[_0x6478('0x15')]?_0x365e75[_0x6478('0x15')][_0x6478('0x17')]||null:null,'attributes':_0x365e75[_0x6478('0x15')]?_0x365e75[_0x6478('0x15')][_0x6478('0x18')]||null:null,'include':_0x365e75['options']?_0x365e75[_0x6478('0x15')]['include']?_[_0x6478('0x1a')](_0x365e75[_0x6478('0x15')]['include'],function(_0x520ad4){return{'model':db[_0x520ad4[_0x6478('0x1b')]],'as':_0x520ad4['as'],'attributes':_0x520ad4[_0x6478('0x18')],'include':_0x520ad4[_0x6478('0x19')]?_[_0x6478('0x1a')](_0x520ad4[_0x6478('0x19')],function(_0x62168c){return{'model':db[_0x62168c[_0x6478('0x1b')]],'as':_0x62168c['as'],'attributes':_0x62168c[_0x6478('0x18')],'include':_0x62168c[_0x6478('0x19')]?_[_0x6478('0x1a')](_0x62168c['include'],function(_0x2b3f78){return{'model':db[_0x2b3f78[_0x6478('0x1b')]],'as':_0x2b3f78['as'],'attributes':_0x2b3f78[_0x6478('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20e89d){logger[_0x6478('0xa')](_0x6478('0x1e'),_0x365e75);logger[_0x6478('0xd')](_0x6478('0x1e'),_0x365e75,JSON[_0x6478('0x1d')](_0x20e89d));_0x3d50cd(_0x20e89d);})[_0x6478('0x13')](function(_0x561ef6){logger[_0x6478('0xf')](_0x6478('0x1e'),_0x561ef6['message'],_0x365e75);_0x474f48(_0x12b589[_0x6478('0xf')](0x1f4,_0x561ef6['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index f0b70ca..64d60c7 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x55ca,0x126));var _0xa55c=function(_0x1d2f68,_0x280a21){_0x1d2f68=_0x1d2f68-0x0;var _0x3cbf0a=_0x55ca[_0x1d2f68];return _0x3cbf0a;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +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(_0x4f7caa,_0x4f7704){var _0xd76e96=function(_0xe0635){while(--_0xe0635){_0x4f7caa['push'](_0x4f7caa['shift']());}};_0xd76e96(++_0x4f7704);}(_0xedd9,0xfc));var _0x9edd=function(_0xd831af,_0x152bc5){_0xd831af=_0xd831af-0x0;var _0x5b7fd8=_0xedd9[_0xd831af];return _0x5b7fd8;};'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 b309e45..c67f28b 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 _0x0207=['sequelize','exports','STRING'];(function(_0x20061d,_0x3b49e4){var _0x27f99b=function(_0x30a58b){while(--_0x30a58b){_0x20061d['push'](_0x20061d['shift']());}};_0x27f99b(++_0x3b49e4);}(_0x0207,0x93));var _0x7020=function(_0xb347b9,_0x3c4105){_0xb347b9=_0xb347b9-0x0;var _0x40091b=_0x0207[_0xb347b9];return _0x40091b;};'use strict';var Sequelize=require(_0x7020('0x0'));module[_0x7020('0x1')]={'name':{'type':Sequelize[_0x7020('0x2')]},'description':{'type':Sequelize[_0x7020('0x2')]}}; \ No newline at end of file +var _0xa080=['STRING','sequelize'];(function(_0x1a28ee,_0x103ece){var _0xd44a61=function(_0x1d0a76){while(--_0x1d0a76){_0x1a28ee['push'](_0x1a28ee['shift']());}};_0xd44a61(++_0x103ece);}(_0xa080,0xe7));var _0x0a08=function(_0x39edb2,_0x1c7caf){_0x39edb2=_0x39edb2-0x0;var _0x3de77d=_0xa080[_0x39edb2];return _0x3de77d;};'use strict';var Sequelize=require(_0x0a08('0x0'));module['exports']={'name':{'type':Sequelize[_0x0a08('0x1')]},'description':{'type':Sequelize[_0x0a08('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index bd2aded..a93927b 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 _0x335e=['getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','DeskConfiguration','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','show','find','catch','create','body','params','getFields','DeskField','rawAttributes','getSubjects','getDescriptions','findOne'];(function(_0x189fee,_0x278c9c){var _0x4d87d3=function(_0x401d0f){while(--_0x401d0f){_0x189fee['push'](_0x189fee['shift']());}};_0x4d87d3(++_0x278c9c);}(_0x335e,0xb2));var _0xe335=function(_0x3e8588,_0x2efec5){_0x3e8588=_0x3e8588-0x0;var _0x352103=_0x335e[_0x3e8588];return _0x352103;};'use strict';var emlformat=require(_0xe335('0x0'));var rimraf=require(_0xe335('0x1'));var zipdir=require(_0xe335('0x2'));var jsonpatch=require(_0xe335('0x3'));var rp=require(_0xe335('0x4'));var moment=require(_0xe335('0x5'));var BPromise=require(_0xe335('0x6'));var Mustache=require(_0xe335('0x7'));var util=require(_0xe335('0x8'));var path=require(_0xe335('0x9'));var sox=require(_0xe335('0xa'));var csv=require(_0xe335('0xb'));var ejs=require(_0xe335('0xc'));var fs=require('fs');var fs_extra=require(_0xe335('0xd'));var _=require(_0xe335('0xe'));var squel=require(_0xe335('0xf'));var crypto=require('crypto');var jsforce=require(_0xe335('0x10'));var deskjs=require(_0xe335('0x11'));var toCsv=require(_0xe335('0xb'));var querystring=require('querystring');var Papa=require(_0xe335('0x12'));var Redis=require('ioredis');var authService=require(_0xe335('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe335('0x14'));var hardwareService=require(_0xe335('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xe335('0x16'));var config=require(_0xe335('0x17'));var licenseUtil=require(_0xe335('0x18'));var db=require(_0xe335('0x19'))['db'];function respondWithStatusCode(_0x532ab7,_0x152b9d){_0x152b9d=_0x152b9d||0xcc;return function(_0x192cc8){if(_0x192cc8){return _0x532ab7['sendStatus'](_0x152b9d);}return _0x532ab7['status'](_0x152b9d)['end']();};}function respondWithResult(_0x3c91df,_0x50d2d3){_0x50d2d3=_0x50d2d3||0xc8;return function(_0x40021a){if(_0x40021a){return _0x3c91df[_0xe335('0x1a')](_0x50d2d3)[_0xe335('0x1b')](_0x40021a);}};}function respondWithFilteredResult(_0x1a3880,_0x4987ef){return function(_0x70c99d){if(_0x70c99d){var _0x4a19d1=typeof _0x4987ef['offset']===_0xe335('0x1c')&&typeof _0x4987ef[_0xe335('0x1d')]===_0xe335('0x1c');var _0x494ed4=_0x70c99d['count'];var _0x596eae=_0x4a19d1?0x0:_0x4987ef['offset'];var _0x3f99bc=_0x4a19d1?_0x70c99d[_0xe335('0x1e')]:_0x4987ef[_0xe335('0x1f')]+_0x4987ef[_0xe335('0x1d')];var _0x4f62cf;if(_0x3f99bc>=_0x494ed4){_0x3f99bc=_0x494ed4;_0x4f62cf=0xc8;}else{_0x4f62cf=0xce;}_0x1a3880['status'](_0x4f62cf);return _0x1a3880[_0xe335('0x20')](_0xe335('0x21'),_0x596eae+'-'+_0x3f99bc+'/'+_0x494ed4)[_0xe335('0x1b')](_0x70c99d);}return null;};}function patchUpdates(_0x4d2f1c){return function(_0x2113c8){try{jsonpatch[_0xe335('0x22')](_0x2113c8,_0x4d2f1c,!![]);}catch(_0x2c589f){return BPromise[_0xe335('0x23')](_0x2c589f);}return _0x2113c8[_0xe335('0x24')]();};}function saveUpdates(_0x3110b8,_0x4db267){return function(_0x3233c9){if(_0x3233c9){return _0x3233c9[_0xe335('0x25')](_0x3110b8)[_0xe335('0x26')](function(_0x972a8e){return _0x972a8e;});}return null;};}function removeEntity(_0xddb677,_0xd4f5a0){return function(_0xfd5c62){if(_0xfd5c62){return _0xfd5c62[_0xe335('0x27')]()[_0xe335('0x26')](function(){_0xddb677[_0xe335('0x1a')](0xcc)[_0xe335('0x28')]();});}};}function handleEntityNotFound(_0x37fc68,_0x4b265e){return function(_0x52de3e){if(!_0x52de3e){_0x37fc68[_0xe335('0x29')](0x194);}return _0x52de3e;};}function handleError(_0x410419,_0x3994f3){_0x3994f3=_0x3994f3||0x1f4;return function(_0x448471){logger[_0xe335('0x2a')](_0x448471[_0xe335('0x2b')]);if(_0x448471[_0xe335('0x2c')]){delete _0x448471[_0xe335('0x2c')];}_0x410419['status'](_0x3994f3)[_0xe335('0x2d')](_0x448471);};}exports[_0xe335('0x2e')]=function(_0x5ae075,_0x595a9d){var _0x456905={},_0x530c6c={},_0x237e72={'count':0x0,'rows':[]};var _0x3c404d=_[_0xe335('0x2f')](db[_0xe335('0x30')]['rawAttributes'],function(_0x344e2b){return{'name':_0x344e2b[_0xe335('0x31')],'type':_0x344e2b[_0xe335('0x32')]['key']};});_0x530c6c[_0xe335('0x33')]=_[_0xe335('0x2f')](_0x3c404d,_0xe335('0x2c'));_0x530c6c[_0xe335('0x34')]=_[_0xe335('0x35')](_0x5ae075[_0xe335('0x34')]);_0x530c6c['filters']=_[_0xe335('0x36')](_0x530c6c['model'],_0x530c6c[_0xe335('0x34')]);_0x456905[_0xe335('0x37')]=_[_0xe335('0x36')](_0x530c6c['model'],qs[_0xe335('0x38')](_0x5ae075[_0xe335('0x34')][_0xe335('0x38')]));_0x456905[_0xe335('0x37')]=_0x456905['attributes'][_0xe335('0x39')]?_0x456905[_0xe335('0x37')]:_0x530c6c['model'];if(!_0x5ae075[_0xe335('0x34')][_0xe335('0x3a')](_0xe335('0x3b'))){_0x456905[_0xe335('0x1d')]=qs[_0xe335('0x1d')](_0x5ae075['query']['limit']);_0x456905[_0xe335('0x1f')]=qs[_0xe335('0x1f')](_0x5ae075[_0xe335('0x34')][_0xe335('0x1f')]);}_0x456905[_0xe335('0x3c')]=qs[_0xe335('0x3d')](_0x5ae075[_0xe335('0x34')][_0xe335('0x3d')]);_0x456905[_0xe335('0x3e')]=qs[_0xe335('0x3f')](_[_0xe335('0x40')](_0x5ae075[_0xe335('0x34')],_0x530c6c[_0xe335('0x3f')]),_0x3c404d);if(_0x5ae075['query'][_0xe335('0x41')]){_0x456905['where']=_['merge'](_0x456905[_0xe335('0x3e')],{'$or':_[_0xe335('0x2f')](_0x3c404d,function(_0x328a50){if(_0x328a50[_0xe335('0x32')]!=='VIRTUAL'){var _0x40d691={};_0x40d691[_0x328a50[_0xe335('0x2c')]]={'$like':'%'+_0x5ae075[_0xe335('0x34')][_0xe335('0x41')]+'%'};return _0x40d691;}})});}_0x456905=_[_0xe335('0x42')]({},_0x456905,_0x5ae075[_0xe335('0x43')]);var _0xb53704={'where':_0x456905[_0xe335('0x3e')]};return db[_0xe335('0x30')][_0xe335('0x1e')](_0xb53704)[_0xe335('0x26')](function(_0x512786){_0x237e72[_0xe335('0x1e')]=_0x512786;if(_0x5ae075['query'][_0xe335('0x44')]){_0x456905[_0xe335('0x45')]=[{'all':!![]}];}return db[_0xe335('0x30')][_0xe335('0x46')](_0x456905);})[_0xe335('0x26')](function(_0x1ed108){_0x237e72['rows']=_0x1ed108;return _0x237e72;})[_0xe335('0x26')](respondWithFilteredResult(_0x595a9d,_0x456905))['catch'](handleError(_0x595a9d,null));};exports[_0xe335('0x47')]=function(_0x2a9d25,_0xa8cca0){var _0x116c60={'raw':![],'where':{'id':_0x2a9d25['params']['id']}},_0x5c1ee8={};_0x5c1ee8[_0xe335('0x33')]=_[_0xe335('0x35')](db[_0xe335('0x30')]['rawAttributes']);_0x5c1ee8[_0xe335('0x34')]=_[_0xe335('0x35')](_0x2a9d25['query']);_0x5c1ee8[_0xe335('0x3f')]=_['intersection'](_0x5c1ee8[_0xe335('0x33')],_0x5c1ee8[_0xe335('0x34')]);_0x116c60[_0xe335('0x37')]=_[_0xe335('0x36')](_0x5c1ee8[_0xe335('0x33')],qs[_0xe335('0x38')](_0x2a9d25[_0xe335('0x34')][_0xe335('0x38')]));_0x116c60[_0xe335('0x37')]=_0x116c60['attributes']['length']?_0x116c60[_0xe335('0x37')]:_0x5c1ee8['model'];if(_0x2a9d25[_0xe335('0x34')][_0xe335('0x44')]){_0x116c60[_0xe335('0x45')]=[{'all':!![]}];}_0x116c60=_[_0xe335('0x42')]({},_0x116c60,_0x2a9d25[_0xe335('0x43')]);return db[_0xe335('0x30')][_0xe335('0x48')](_0x116c60)[_0xe335('0x26')](handleEntityNotFound(_0xa8cca0,null))[_0xe335('0x26')](respondWithResult(_0xa8cca0,null))[_0xe335('0x49')](handleError(_0xa8cca0,null));};exports[_0xe335('0x4a')]=function(_0xc2e788,_0x4e7d54){return db[_0xe335('0x30')][_0xe335('0x4a')](_0xc2e788[_0xe335('0x4b')],{})[_0xe335('0x26')](respondWithResult(_0x4e7d54,0xc9))[_0xe335('0x49')](handleError(_0x4e7d54,null));};exports[_0xe335('0x25')]=function(_0x6b8ac3,_0x58591d){if(_0x6b8ac3[_0xe335('0x4b')]['id']){delete _0x6b8ac3['body']['id'];}return db[_0xe335('0x30')][_0xe335('0x48')]({'where':{'id':_0x6b8ac3[_0xe335('0x4c')]['id']}})[_0xe335('0x26')](handleEntityNotFound(_0x58591d,null))[_0xe335('0x26')](saveUpdates(_0x6b8ac3['body'],null))[_0xe335('0x26')](respondWithResult(_0x58591d,null))['catch'](handleError(_0x58591d,null));};exports[_0xe335('0x27')]=function(_0x2458c0,_0x47cd5f){return db['DeskConfiguration'][_0xe335('0x48')]({'where':{'id':_0x2458c0[_0xe335('0x4c')]['id']}})[_0xe335('0x26')](handleEntityNotFound(_0x47cd5f,null))[_0xe335('0x26')](removeEntity(_0x47cd5f,null))['catch'](handleError(_0x47cd5f,null));};exports[_0xe335('0x4d')]=function(_0x5dc80f,_0x626f17,_0x332902){var _0xd6cb9f={};var _0x255305={};var _0x4a8168;var _0x540bd0;return db[_0xe335('0x30')]['findOne']({'where':{'id':_0x5dc80f[_0xe335('0x4c')]['id']}})[_0xe335('0x26')](handleEntityNotFound(_0x626f17,null))[_0xe335('0x26')](function(_0x554f2a){if(_0x554f2a){_0x4a8168=_0x554f2a;_0x255305[_0xe335('0x33')]=_[_0xe335('0x35')](db[_0xe335('0x4e')][_0xe335('0x4f')]);_0x255305[_0xe335('0x34')]=_[_0xe335('0x35')](_0x5dc80f[_0xe335('0x34')]);_0x255305['filters']=_[_0xe335('0x36')](_0x255305[_0xe335('0x33')],_0x255305[_0xe335('0x34')]);_0xd6cb9f[_0xe335('0x37')]=_[_0xe335('0x36')](_0x255305[_0xe335('0x33')],qs['fields'](_0x5dc80f['query'][_0xe335('0x38')]));_0xd6cb9f[_0xe335('0x37')]=_0xd6cb9f[_0xe335('0x37')][_0xe335('0x39')]?_0xd6cb9f[_0xe335('0x37')]:_0x255305[_0xe335('0x33')];_0xd6cb9f[_0xe335('0x3c')]=qs['sort'](_0x5dc80f['query'][_0xe335('0x3d')]);_0xd6cb9f['where']=qs[_0xe335('0x3f')](_[_0xe335('0x40')](_0x5dc80f[_0xe335('0x34')],_0x255305[_0xe335('0x3f')]));if(_0x5dc80f[_0xe335('0x34')][_0xe335('0x41')]){_0xd6cb9f[_0xe335('0x3e')]=_[_0xe335('0x42')](_0xd6cb9f['where'],{'$or':_[_0xe335('0x2f')](_0xd6cb9f[_0xe335('0x37')],function(_0x4f7b90){var _0x493c15={};_0x493c15[_0x4f7b90]={'$like':'%'+_0x5dc80f[_0xe335('0x34')][_0xe335('0x41')]+'%'};return _0x493c15;})});}_0xd6cb9f=_[_0xe335('0x42')]({},_0xd6cb9f,_0x5dc80f[_0xe335('0x43')]);return _0x4a8168[_0xe335('0x4d')](_0xd6cb9f);}})[_0xe335('0x26')](function(_0x22119b){if(_0x22119b){_0x540bd0=_0x22119b[_0xe335('0x39')];if(!_0x5dc80f[_0xe335('0x34')]['hasOwnProperty']('nolimit')){_0xd6cb9f['limit']=qs[_0xe335('0x1d')](_0x5dc80f[_0xe335('0x34')][_0xe335('0x1d')]);_0xd6cb9f['offset']=qs[_0xe335('0x1f')](_0x5dc80f['query'][_0xe335('0x1f')]);}return _0x4a8168[_0xe335('0x4d')](_0xd6cb9f);}})[_0xe335('0x26')](function(_0x5b226c){if(_0x5b226c){return _0x5b226c?{'count':_0x540bd0,'rows':_0x5b226c}:null;}})[_0xe335('0x26')](respondWithResult(_0x626f17,null))[_0xe335('0x49')](handleError(_0x626f17,null));};exports['getSubjects']=function(_0x575466,_0x4cea8b,_0x54530a){var _0x44d21d={};var _0x58d532={};var _0x1837c2;var _0x20de63;return db[_0xe335('0x30')]['findOne']({'where':{'id':_0x575466[_0xe335('0x4c')]['id']}})[_0xe335('0x26')](handleEntityNotFound(_0x4cea8b,null))[_0xe335('0x26')](function(_0x2c0053){if(_0x2c0053){_0x1837c2=_0x2c0053;_0x58d532['model']=_['keys'](db[_0xe335('0x4e')][_0xe335('0x4f')]);_0x58d532[_0xe335('0x34')]=_[_0xe335('0x35')](_0x575466['query']);_0x58d532['filters']=_[_0xe335('0x36')](_0x58d532[_0xe335('0x33')],_0x58d532[_0xe335('0x34')]);_0x44d21d['attributes']=_['intersection'](_0x58d532[_0xe335('0x33')],qs['fields'](_0x575466['query'][_0xe335('0x38')]));_0x44d21d[_0xe335('0x37')]=_0x44d21d[_0xe335('0x37')]['length']?_0x44d21d[_0xe335('0x37')]:_0x58d532[_0xe335('0x33')];_0x44d21d[_0xe335('0x3c')]=qs[_0xe335('0x3d')](_0x575466['query'][_0xe335('0x3d')]);_0x44d21d[_0xe335('0x3e')]=qs[_0xe335('0x3f')](_[_0xe335('0x40')](_0x575466['query'],_0x58d532[_0xe335('0x3f')]));if(_0x575466[_0xe335('0x34')][_0xe335('0x41')]){_0x44d21d[_0xe335('0x3e')]=_[_0xe335('0x42')](_0x44d21d[_0xe335('0x3e')],{'$or':_[_0xe335('0x2f')](_0x44d21d[_0xe335('0x37')],function(_0x56df20){var _0x5a532f={};_0x5a532f[_0x56df20]={'$like':'%'+_0x575466[_0xe335('0x34')][_0xe335('0x41')]+'%'};return _0x5a532f;})});}_0x44d21d=_[_0xe335('0x42')]({},_0x44d21d,_0x575466[_0xe335('0x43')]);return _0x1837c2['getSubjects'](_0x44d21d);}})['then'](function(_0x317b4e){if(_0x317b4e){_0x20de63=_0x317b4e[_0xe335('0x39')];if(!_0x575466[_0xe335('0x34')][_0xe335('0x3a')](_0xe335('0x3b'))){_0x44d21d[_0xe335('0x1d')]=qs[_0xe335('0x1d')](_0x575466[_0xe335('0x34')][_0xe335('0x1d')]);_0x44d21d[_0xe335('0x1f')]=qs['offset'](_0x575466['query'][_0xe335('0x1f')]);}return _0x1837c2[_0xe335('0x50')](_0x44d21d);}})[_0xe335('0x26')](function(_0x17765e){if(_0x17765e){return _0x17765e?{'count':_0x20de63,'rows':_0x17765e}:null;}})[_0xe335('0x26')](respondWithResult(_0x4cea8b,null))[_0xe335('0x49')](handleError(_0x4cea8b,null));};exports[_0xe335('0x51')]=function(_0x416335,_0x1a3f6e,_0x196d4a){var _0x3eff63={};var _0x198c18={};var _0x1644b2;var _0x5dd5bd;return db[_0xe335('0x30')][_0xe335('0x52')]({'where':{'id':_0x416335[_0xe335('0x4c')]['id']}})[_0xe335('0x26')](handleEntityNotFound(_0x1a3f6e,null))[_0xe335('0x26')](function(_0x3dbf9b){if(_0x3dbf9b){_0x1644b2=_0x3dbf9b;_0x198c18[_0xe335('0x33')]=_[_0xe335('0x35')](db[_0xe335('0x4e')]['rawAttributes']);_0x198c18[_0xe335('0x34')]=_[_0xe335('0x35')](_0x416335[_0xe335('0x34')]);_0x198c18['filters']=_[_0xe335('0x36')](_0x198c18[_0xe335('0x33')],_0x198c18['query']);_0x3eff63['attributes']=_[_0xe335('0x36')](_0x198c18[_0xe335('0x33')],qs[_0xe335('0x38')](_0x416335[_0xe335('0x34')][_0xe335('0x38')]));_0x3eff63[_0xe335('0x37')]=_0x3eff63[_0xe335('0x37')][_0xe335('0x39')]?_0x3eff63[_0xe335('0x37')]:_0x198c18[_0xe335('0x33')];_0x3eff63[_0xe335('0x3c')]=qs[_0xe335('0x3d')](_0x416335[_0xe335('0x34')][_0xe335('0x3d')]);_0x3eff63['where']=qs[_0xe335('0x3f')](_[_0xe335('0x40')](_0x416335[_0xe335('0x34')],_0x198c18[_0xe335('0x3f')]));if(_0x416335[_0xe335('0x34')][_0xe335('0x41')]){_0x3eff63['where']=_[_0xe335('0x42')](_0x3eff63[_0xe335('0x3e')],{'$or':_['map'](_0x3eff63[_0xe335('0x37')],function(_0x128e05){var _0x4c1345={};_0x4c1345[_0x128e05]={'$like':'%'+_0x416335[_0xe335('0x34')]['filter']+'%'};return _0x4c1345;})});}_0x3eff63=_[_0xe335('0x42')]({},_0x3eff63,_0x416335[_0xe335('0x43')]);return _0x1644b2[_0xe335('0x51')](_0x3eff63);}})[_0xe335('0x26')](function(_0x364d3a){if(_0x364d3a){_0x5dd5bd=_0x364d3a[_0xe335('0x39')];if(!_0x416335[_0xe335('0x34')]['hasOwnProperty'](_0xe335('0x3b'))){_0x3eff63[_0xe335('0x1d')]=qs['limit'](_0x416335['query'][_0xe335('0x1d')]);_0x3eff63[_0xe335('0x1f')]=qs[_0xe335('0x1f')](_0x416335[_0xe335('0x34')]['offset']);}return _0x1644b2[_0xe335('0x51')](_0x3eff63);}})['then'](function(_0x263568){if(_0x263568){return _0x263568?{'count':_0x5dd5bd,'rows':_0x263568}:null;}})[_0xe335('0x26')](respondWithResult(_0x1a3f6e,null))[_0xe335('0x49')](handleError(_0x1a3f6e,null));};exports[_0xe335('0x53')]=function(_0x53d8a4,_0xbcd911,_0x5e0cdb){var _0x519d2a={};var _0x1ae172={};var _0x37152d;var _0x39f670;return db['DeskConfiguration'][_0xe335('0x52')]({'where':{'id':_0x53d8a4['params']['id']}})['then'](handleEntityNotFound(_0xbcd911,null))[_0xe335('0x26')](function(_0x11c355){if(_0x11c355){_0x37152d=_0x11c355;_0x1ae172[_0xe335('0x33')]=_[_0xe335('0x35')](db[_0xe335('0x54')][_0xe335('0x4f')]);_0x1ae172[_0xe335('0x34')]=_[_0xe335('0x35')](_0x53d8a4[_0xe335('0x34')]);_0x1ae172[_0xe335('0x3f')]=_[_0xe335('0x36')](_0x1ae172[_0xe335('0x33')],_0x1ae172['query']);_0x519d2a['attributes']=_[_0xe335('0x36')](_0x1ae172[_0xe335('0x33')],qs[_0xe335('0x38')](_0x53d8a4['query'][_0xe335('0x38')]));_0x519d2a['attributes']=_0x519d2a[_0xe335('0x37')]['length']?_0x519d2a[_0xe335('0x37')]:_0x1ae172[_0xe335('0x33')];_0x519d2a[_0xe335('0x3c')]=qs[_0xe335('0x3d')](_0x53d8a4[_0xe335('0x34')][_0xe335('0x3d')]);_0x519d2a['where']=qs[_0xe335('0x3f')](_[_0xe335('0x40')](_0x53d8a4[_0xe335('0x34')],_0x1ae172[_0xe335('0x3f')]));if(_0x53d8a4[_0xe335('0x34')]['filter']){_0x519d2a[_0xe335('0x3e')]=_['merge'](_0x519d2a[_0xe335('0x3e')],{'$or':_[_0xe335('0x2f')](_0x519d2a[_0xe335('0x37')],function(_0x1bba33){var _0x562efd={};_0x562efd[_0x1bba33]={'$like':'%'+_0x53d8a4[_0xe335('0x34')][_0xe335('0x41')]+'%'};return _0x562efd;})});}_0x519d2a=_['merge']({},_0x519d2a,_0x53d8a4[_0xe335('0x43')]);return _0x37152d[_0xe335('0x53')](_0x519d2a);}})[_0xe335('0x26')](function(_0x5c3cce){if(_0x5c3cce){_0x39f670=_0x5c3cce['length'];if(!_0x53d8a4[_0xe335('0x34')][_0xe335('0x3a')](_0xe335('0x3b'))){_0x519d2a[_0xe335('0x1d')]=qs['limit'](_0x53d8a4[_0xe335('0x34')][_0xe335('0x1d')]);_0x519d2a['offset']=qs[_0xe335('0x1f')](_0x53d8a4['query'][_0xe335('0x1f')]);}return _0x37152d[_0xe335('0x53')](_0x519d2a);}})[_0xe335('0x26')](function(_0x303898){if(_0x303898){return _0x303898?{'count':_0x39f670,'rows':_0x303898}:null;}})[_0xe335('0x26')](respondWithResult(_0xbcd911,null))[_0xe335('0x49')](handleError(_0xbcd911,null));};exports[_0xe335('0x55')]=function(_0x3dee0b,_0x53d94b,_0x2584ca){if(_0x3dee0b['body']['id']){delete _0x3dee0b['body']['id'];}return db[_0xe335('0x30')][_0xe335('0x52')]({'where':{'id':_0x3dee0b[_0xe335('0x4c')]['id']}})[_0xe335('0x26')](handleEntityNotFound(_0x53d94b,null))[_0xe335('0x26')](function(_0x453daa){if(_0x453daa){return _0x453daa[_0xe335('0x55')](_0x3dee0b[_0xe335('0x4b')][_0xe335('0x56')]||[]);}return null;})[_0xe335('0x26')](respondWithResult(_0x53d94b,null))[_0xe335('0x49')](handleError(_0x53d94b,null));}; \ No newline at end of file +var _0xf240=['error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','length','find','create','body','getFields','findOne','DeskField','pick','nolimit','getSubjects','getDescriptions','getTags','setTags','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xf240,0x11d));var _0x0f24=function(_0x2ed8d3,_0x2cf898){_0x2ed8d3=_0x2ed8d3-0x0;var _0xc228f6=_0xf240[_0x2ed8d3];return _0xc228f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0f24('0x0'));var zipdir=require(_0x0f24('0x1'));var jsonpatch=require(_0x0f24('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0f24('0x3'));var Mustache=require(_0x0f24('0x4'));var util=require(_0x0f24('0x5'));var path=require(_0x0f24('0x6'));var sox=require('sox');var csv=require(_0x0f24('0x7'));var ejs=require(_0x0f24('0x8'));var fs=require('fs');var fs_extra=require(_0x0f24('0x9'));var _=require(_0x0f24('0xa'));var squel=require(_0x0f24('0xb'));var crypto=require(_0x0f24('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f24('0xd'));var toCsv=require(_0x0f24('0x7'));var querystring=require(_0x0f24('0xe'));var Papa=require('papaparse');var Redis=require(_0x0f24('0xf'));var authService=require(_0x0f24('0x10'));var qs=require(_0x0f24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0f24('0x12'));var logger=require(_0x0f24('0x13'))(_0x0f24('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0f24('0x15'));var db=require(_0x0f24('0x16'))['db'];function respondWithStatusCode(_0x2fa9f6,_0x51b0df){_0x51b0df=_0x51b0df||0xcc;return function(_0xb88399){if(_0xb88399){return _0x2fa9f6[_0x0f24('0x17')](_0x51b0df);}return _0x2fa9f6[_0x0f24('0x18')](_0x51b0df)[_0x0f24('0x19')]();};}function respondWithResult(_0x4b8ce5,_0x37c37e){_0x37c37e=_0x37c37e||0xc8;return function(_0x173206){if(_0x173206){return _0x4b8ce5[_0x0f24('0x18')](_0x37c37e)[_0x0f24('0x1a')](_0x173206);}};}function respondWithFilteredResult(_0x3bc7f9,_0x155ffd){return function(_0x32ede8){if(_0x32ede8){var _0x55f53c=typeof _0x155ffd[_0x0f24('0x1b')]===_0x0f24('0x1c')&&typeof _0x155ffd['limit']===_0x0f24('0x1c');var _0x1bf219=_0x32ede8[_0x0f24('0x1d')];var _0x46c04b=_0x55f53c?0x0:_0x155ffd[_0x0f24('0x1b')];var _0x405027=_0x55f53c?_0x32ede8['count']:_0x155ffd[_0x0f24('0x1b')]+_0x155ffd[_0x0f24('0x1e')];var _0x21f3e1;if(_0x405027>=_0x1bf219){_0x405027=_0x1bf219;_0x21f3e1=0xc8;}else{_0x21f3e1=0xce;}_0x3bc7f9[_0x0f24('0x18')](_0x21f3e1);return _0x3bc7f9[_0x0f24('0x1f')](_0x0f24('0x20'),_0x46c04b+'-'+_0x405027+'/'+_0x1bf219)[_0x0f24('0x1a')](_0x32ede8);}return null;};}function patchUpdates(_0x30acb4){return function(_0x4c21a4){try{jsonpatch[_0x0f24('0x21')](_0x4c21a4,_0x30acb4,!![]);}catch(_0x212075){return BPromise[_0x0f24('0x22')](_0x212075);}return _0x4c21a4[_0x0f24('0x23')]();};}function saveUpdates(_0x4a1080,_0x189fcb){return function(_0x441e25){if(_0x441e25){return _0x441e25[_0x0f24('0x24')](_0x4a1080)['then'](function(_0x2841a0){return _0x2841a0;});}return null;};}function removeEntity(_0x98aa9b,_0x414055){return function(_0x1b615a){if(_0x1b615a){return _0x1b615a[_0x0f24('0x25')]()[_0x0f24('0x26')](function(){_0x98aa9b[_0x0f24('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8508,_0x88930f){return function(_0x351137){if(!_0x351137){_0x4b8508['sendStatus'](0x194);}return _0x351137;};}function handleError(_0x3c379d,_0x8a2bfd){_0x8a2bfd=_0x8a2bfd||0x1f4;return function(_0x906582){logger[_0x0f24('0x27')](_0x906582[_0x0f24('0x28')]);if(_0x906582[_0x0f24('0x29')]){delete _0x906582[_0x0f24('0x29')];}_0x3c379d[_0x0f24('0x18')](_0x8a2bfd)['send'](_0x906582);};}exports[_0x0f24('0x2a')]=function(_0x4c2883,_0x52f08c){var _0x358799={},_0x419358={},_0x49c5ab={'count':0x0,'rows':[]};var _0x4b01f6=_[_0x0f24('0x2b')](db[_0x0f24('0x2c')][_0x0f24('0x2d')],function(_0xaaa9fb){return{'name':_0xaaa9fb[_0x0f24('0x2e')],'type':_0xaaa9fb[_0x0f24('0x2f')]['key']};});_0x419358['model']=_[_0x0f24('0x2b')](_0x4b01f6,'name');_0x419358[_0x0f24('0x30')]=_[_0x0f24('0x31')](_0x4c2883['query']);_0x419358[_0x0f24('0x32')]=_[_0x0f24('0x33')](_0x419358[_0x0f24('0x34')],_0x419358[_0x0f24('0x30')]);_0x358799[_0x0f24('0x35')]=_[_0x0f24('0x33')](_0x419358[_0x0f24('0x34')],qs['fields'](_0x4c2883['query'][_0x0f24('0x36')]));_0x358799[_0x0f24('0x35')]=_0x358799[_0x0f24('0x35')]['length']?_0x358799[_0x0f24('0x35')]:_0x419358[_0x0f24('0x34')];if(!_0x4c2883[_0x0f24('0x30')][_0x0f24('0x37')]('nolimit')){_0x358799['limit']=qs['limit'](_0x4c2883[_0x0f24('0x30')][_0x0f24('0x1e')]);_0x358799[_0x0f24('0x1b')]=qs['offset'](_0x4c2883['query'][_0x0f24('0x1b')]);}_0x358799[_0x0f24('0x38')]=qs[_0x0f24('0x39')](_0x4c2883[_0x0f24('0x30')][_0x0f24('0x39')]);_0x358799['where']=qs[_0x0f24('0x32')](_['pick'](_0x4c2883[_0x0f24('0x30')],_0x419358[_0x0f24('0x32')]),_0x4b01f6);if(_0x4c2883[_0x0f24('0x30')][_0x0f24('0x3a')]){_0x358799['where']=_['merge'](_0x358799[_0x0f24('0x3b')],{'$or':_[_0x0f24('0x2b')](_0x4b01f6,function(_0x5cbf1b){if(_0x5cbf1b['type']!==_0x0f24('0x3c')){var _0x19bc22={};_0x19bc22[_0x5cbf1b['name']]={'$like':'%'+_0x4c2883[_0x0f24('0x30')][_0x0f24('0x3a')]+'%'};return _0x19bc22;}})});}_0x358799=_[_0x0f24('0x3d')]({},_0x358799,_0x4c2883[_0x0f24('0x3e')]);var _0x1b819e={'where':_0x358799[_0x0f24('0x3b')]};return db['DeskConfiguration']['count'](_0x1b819e)[_0x0f24('0x26')](function(_0x2457c1){_0x49c5ab['count']=_0x2457c1;if(_0x4c2883['query'][_0x0f24('0x3f')]){_0x358799[_0x0f24('0x40')]=[{'all':!![]}];}return db[_0x0f24('0x2c')][_0x0f24('0x41')](_0x358799);})['then'](function(_0x122ab5){_0x49c5ab['rows']=_0x122ab5;return _0x49c5ab;})[_0x0f24('0x26')](respondWithFilteredResult(_0x52f08c,_0x358799))[_0x0f24('0x42')](handleError(_0x52f08c,null));};exports['show']=function(_0x3bfb14,_0x51217d){var _0x30b233={'raw':![],'where':{'id':_0x3bfb14[_0x0f24('0x43')]['id']}},_0x475de9={};_0x475de9[_0x0f24('0x34')]=_[_0x0f24('0x31')](db[_0x0f24('0x2c')]['rawAttributes']);_0x475de9[_0x0f24('0x30')]=_[_0x0f24('0x31')](_0x3bfb14[_0x0f24('0x30')]);_0x475de9[_0x0f24('0x32')]=_[_0x0f24('0x33')](_0x475de9[_0x0f24('0x34')],_0x475de9[_0x0f24('0x30')]);_0x30b233[_0x0f24('0x35')]=_[_0x0f24('0x33')](_0x475de9[_0x0f24('0x34')],qs[_0x0f24('0x36')](_0x3bfb14['query'][_0x0f24('0x36')]));_0x30b233[_0x0f24('0x35')]=_0x30b233[_0x0f24('0x35')][_0x0f24('0x44')]?_0x30b233[_0x0f24('0x35')]:_0x475de9['model'];if(_0x3bfb14[_0x0f24('0x30')][_0x0f24('0x3f')]){_0x30b233[_0x0f24('0x40')]=[{'all':!![]}];}_0x30b233=_[_0x0f24('0x3d')]({},_0x30b233,_0x3bfb14['options']);return db[_0x0f24('0x2c')][_0x0f24('0x45')](_0x30b233)[_0x0f24('0x26')](handleEntityNotFound(_0x51217d,null))[_0x0f24('0x26')](respondWithResult(_0x51217d,null))[_0x0f24('0x42')](handleError(_0x51217d,null));};exports[_0x0f24('0x46')]=function(_0x319394,_0x10cc4a){return db[_0x0f24('0x2c')]['create'](_0x319394[_0x0f24('0x47')],{})[_0x0f24('0x26')](respondWithResult(_0x10cc4a,0xc9))[_0x0f24('0x42')](handleError(_0x10cc4a,null));};exports[_0x0f24('0x24')]=function(_0x2d471a,_0x30a098){if(_0x2d471a[_0x0f24('0x47')]['id']){delete _0x2d471a['body']['id'];}return db[_0x0f24('0x2c')]['find']({'where':{'id':_0x2d471a[_0x0f24('0x43')]['id']}})[_0x0f24('0x26')](handleEntityNotFound(_0x30a098,null))[_0x0f24('0x26')](saveUpdates(_0x2d471a[_0x0f24('0x47')],null))[_0x0f24('0x26')](respondWithResult(_0x30a098,null))[_0x0f24('0x42')](handleError(_0x30a098,null));};exports[_0x0f24('0x25')]=function(_0x1a4f67,_0x230c3b){return db[_0x0f24('0x2c')][_0x0f24('0x45')]({'where':{'id':_0x1a4f67['params']['id']}})[_0x0f24('0x26')](handleEntityNotFound(_0x230c3b,null))[_0x0f24('0x26')](removeEntity(_0x230c3b,null))[_0x0f24('0x42')](handleError(_0x230c3b,null));};exports[_0x0f24('0x48')]=function(_0x3da674,_0x121cba,_0x439c4c){var _0x5ab5ec={};var _0x4632d0={};var _0xa27e0;var _0x4d3c8e;return db['DeskConfiguration'][_0x0f24('0x49')]({'where':{'id':_0x3da674[_0x0f24('0x43')]['id']}})['then'](handleEntityNotFound(_0x121cba,null))[_0x0f24('0x26')](function(_0x361c21){if(_0x361c21){_0xa27e0=_0x361c21;_0x4632d0['model']=_[_0x0f24('0x31')](db[_0x0f24('0x4a')][_0x0f24('0x2d')]);_0x4632d0[_0x0f24('0x30')]=_['keys'](_0x3da674[_0x0f24('0x30')]);_0x4632d0['filters']=_[_0x0f24('0x33')](_0x4632d0[_0x0f24('0x34')],_0x4632d0[_0x0f24('0x30')]);_0x5ab5ec[_0x0f24('0x35')]=_[_0x0f24('0x33')](_0x4632d0[_0x0f24('0x34')],qs['fields'](_0x3da674[_0x0f24('0x30')][_0x0f24('0x36')]));_0x5ab5ec[_0x0f24('0x35')]=_0x5ab5ec[_0x0f24('0x35')]['length']?_0x5ab5ec['attributes']:_0x4632d0[_0x0f24('0x34')];_0x5ab5ec[_0x0f24('0x38')]=qs[_0x0f24('0x39')](_0x3da674[_0x0f24('0x30')]['sort']);_0x5ab5ec[_0x0f24('0x3b')]=qs[_0x0f24('0x32')](_[_0x0f24('0x4b')](_0x3da674['query'],_0x4632d0['filters']));if(_0x3da674[_0x0f24('0x30')]['filter']){_0x5ab5ec[_0x0f24('0x3b')]=_[_0x0f24('0x3d')](_0x5ab5ec[_0x0f24('0x3b')],{'$or':_[_0x0f24('0x2b')](_0x5ab5ec['attributes'],function(_0xdaafb9){var _0x1b7428={};_0x1b7428[_0xdaafb9]={'$like':'%'+_0x3da674['query']['filter']+'%'};return _0x1b7428;})});}_0x5ab5ec=_[_0x0f24('0x3d')]({},_0x5ab5ec,_0x3da674[_0x0f24('0x3e')]);return _0xa27e0['getFields'](_0x5ab5ec);}})[_0x0f24('0x26')](function(_0x5ca8d6){if(_0x5ca8d6){_0x4d3c8e=_0x5ca8d6[_0x0f24('0x44')];if(!_0x3da674[_0x0f24('0x30')][_0x0f24('0x37')](_0x0f24('0x4c'))){_0x5ab5ec[_0x0f24('0x1e')]=qs[_0x0f24('0x1e')](_0x3da674[_0x0f24('0x30')]['limit']);_0x5ab5ec[_0x0f24('0x1b')]=qs[_0x0f24('0x1b')](_0x3da674['query']['offset']);}return _0xa27e0[_0x0f24('0x48')](_0x5ab5ec);}})[_0x0f24('0x26')](function(_0x4165a9){if(_0x4165a9){return _0x4165a9?{'count':_0x4d3c8e,'rows':_0x4165a9}:null;}})[_0x0f24('0x26')](respondWithResult(_0x121cba,null))['catch'](handleError(_0x121cba,null));};exports[_0x0f24('0x4d')]=function(_0x27b746,_0xacc164,_0x3f0e49){var _0x5db6a6={};var _0x1496f5={};var _0x57b8d8;var _0x44e6b1;return db[_0x0f24('0x2c')][_0x0f24('0x49')]({'where':{'id':_0x27b746[_0x0f24('0x43')]['id']}})['then'](handleEntityNotFound(_0xacc164,null))[_0x0f24('0x26')](function(_0x67facb){if(_0x67facb){_0x57b8d8=_0x67facb;_0x1496f5[_0x0f24('0x34')]=_['keys'](db[_0x0f24('0x4a')][_0x0f24('0x2d')]);_0x1496f5[_0x0f24('0x30')]=_[_0x0f24('0x31')](_0x27b746[_0x0f24('0x30')]);_0x1496f5[_0x0f24('0x32')]=_['intersection'](_0x1496f5[_0x0f24('0x34')],_0x1496f5['query']);_0x5db6a6[_0x0f24('0x35')]=_['intersection'](_0x1496f5[_0x0f24('0x34')],qs[_0x0f24('0x36')](_0x27b746[_0x0f24('0x30')]['fields']));_0x5db6a6['attributes']=_0x5db6a6[_0x0f24('0x35')]['length']?_0x5db6a6['attributes']:_0x1496f5['model'];_0x5db6a6['order']=qs[_0x0f24('0x39')](_0x27b746[_0x0f24('0x30')][_0x0f24('0x39')]);_0x5db6a6[_0x0f24('0x3b')]=qs['filters'](_[_0x0f24('0x4b')](_0x27b746[_0x0f24('0x30')],_0x1496f5[_0x0f24('0x32')]));if(_0x27b746[_0x0f24('0x30')][_0x0f24('0x3a')]){_0x5db6a6[_0x0f24('0x3b')]=_[_0x0f24('0x3d')](_0x5db6a6['where'],{'$or':_[_0x0f24('0x2b')](_0x5db6a6[_0x0f24('0x35')],function(_0x214b9b){var _0x43e0b1={};_0x43e0b1[_0x214b9b]={'$like':'%'+_0x27b746[_0x0f24('0x30')][_0x0f24('0x3a')]+'%'};return _0x43e0b1;})});}_0x5db6a6=_['merge']({},_0x5db6a6,_0x27b746[_0x0f24('0x3e')]);return _0x57b8d8[_0x0f24('0x4d')](_0x5db6a6);}})[_0x0f24('0x26')](function(_0x4094a2){if(_0x4094a2){_0x44e6b1=_0x4094a2['length'];if(!_0x27b746[_0x0f24('0x30')]['hasOwnProperty'](_0x0f24('0x4c'))){_0x5db6a6['limit']=qs[_0x0f24('0x1e')](_0x27b746[_0x0f24('0x30')][_0x0f24('0x1e')]);_0x5db6a6[_0x0f24('0x1b')]=qs[_0x0f24('0x1b')](_0x27b746[_0x0f24('0x30')]['offset']);}return _0x57b8d8[_0x0f24('0x4d')](_0x5db6a6);}})[_0x0f24('0x26')](function(_0x5a47e0){if(_0x5a47e0){return _0x5a47e0?{'count':_0x44e6b1,'rows':_0x5a47e0}:null;}})[_0x0f24('0x26')](respondWithResult(_0xacc164,null))[_0x0f24('0x42')](handleError(_0xacc164,null));};exports[_0x0f24('0x4e')]=function(_0x592758,_0x3b132d,_0x5c9b23){var _0x36c30f={};var _0x351771={};var _0x3ba2da;var _0x3755de;return db['DeskConfiguration'][_0x0f24('0x49')]({'where':{'id':_0x592758[_0x0f24('0x43')]['id']}})['then'](handleEntityNotFound(_0x3b132d,null))[_0x0f24('0x26')](function(_0x313557){if(_0x313557){_0x3ba2da=_0x313557;_0x351771[_0x0f24('0x34')]=_['keys'](db[_0x0f24('0x4a')][_0x0f24('0x2d')]);_0x351771[_0x0f24('0x30')]=_[_0x0f24('0x31')](_0x592758[_0x0f24('0x30')]);_0x351771[_0x0f24('0x32')]=_['intersection'](_0x351771['model'],_0x351771[_0x0f24('0x30')]);_0x36c30f['attributes']=_[_0x0f24('0x33')](_0x351771[_0x0f24('0x34')],qs['fields'](_0x592758[_0x0f24('0x30')][_0x0f24('0x36')]));_0x36c30f[_0x0f24('0x35')]=_0x36c30f[_0x0f24('0x35')][_0x0f24('0x44')]?_0x36c30f[_0x0f24('0x35')]:_0x351771['model'];_0x36c30f[_0x0f24('0x38')]=qs[_0x0f24('0x39')](_0x592758[_0x0f24('0x30')][_0x0f24('0x39')]);_0x36c30f[_0x0f24('0x3b')]=qs[_0x0f24('0x32')](_[_0x0f24('0x4b')](_0x592758[_0x0f24('0x30')],_0x351771[_0x0f24('0x32')]));if(_0x592758[_0x0f24('0x30')][_0x0f24('0x3a')]){_0x36c30f['where']=_[_0x0f24('0x3d')](_0x36c30f[_0x0f24('0x3b')],{'$or':_[_0x0f24('0x2b')](_0x36c30f[_0x0f24('0x35')],function(_0x5b6787){var _0x29249f={};_0x29249f[_0x5b6787]={'$like':'%'+_0x592758[_0x0f24('0x30')][_0x0f24('0x3a')]+'%'};return _0x29249f;})});}_0x36c30f=_[_0x0f24('0x3d')]({},_0x36c30f,_0x592758['options']);return _0x3ba2da[_0x0f24('0x4e')](_0x36c30f);}})[_0x0f24('0x26')](function(_0x1fa7c7){if(_0x1fa7c7){_0x3755de=_0x1fa7c7[_0x0f24('0x44')];if(!_0x592758['query'][_0x0f24('0x37')](_0x0f24('0x4c'))){_0x36c30f[_0x0f24('0x1e')]=qs['limit'](_0x592758[_0x0f24('0x30')][_0x0f24('0x1e')]);_0x36c30f[_0x0f24('0x1b')]=qs['offset'](_0x592758[_0x0f24('0x30')][_0x0f24('0x1b')]);}return _0x3ba2da[_0x0f24('0x4e')](_0x36c30f);}})[_0x0f24('0x26')](function(_0x2e32af){if(_0x2e32af){return _0x2e32af?{'count':_0x3755de,'rows':_0x2e32af}:null;}})[_0x0f24('0x26')](respondWithResult(_0x3b132d,null))['catch'](handleError(_0x3b132d,null));};exports['getTags']=function(_0xd58147,_0x287539,_0x5cb7ae){var _0x570d1e={};var _0x159e4d={};var _0xa757;var _0x3068da;return db[_0x0f24('0x2c')][_0x0f24('0x49')]({'where':{'id':_0xd58147['params']['id']}})[_0x0f24('0x26')](handleEntityNotFound(_0x287539,null))[_0x0f24('0x26')](function(_0x25df9d){if(_0x25df9d){_0xa757=_0x25df9d;_0x159e4d[_0x0f24('0x34')]=_['keys'](db['Tag'][_0x0f24('0x2d')]);_0x159e4d[_0x0f24('0x30')]=_['keys'](_0xd58147[_0x0f24('0x30')]);_0x159e4d[_0x0f24('0x32')]=_[_0x0f24('0x33')](_0x159e4d[_0x0f24('0x34')],_0x159e4d['query']);_0x570d1e[_0x0f24('0x35')]=_[_0x0f24('0x33')](_0x159e4d[_0x0f24('0x34')],qs['fields'](_0xd58147['query'][_0x0f24('0x36')]));_0x570d1e[_0x0f24('0x35')]=_0x570d1e[_0x0f24('0x35')][_0x0f24('0x44')]?_0x570d1e[_0x0f24('0x35')]:_0x159e4d[_0x0f24('0x34')];_0x570d1e[_0x0f24('0x38')]=qs[_0x0f24('0x39')](_0xd58147[_0x0f24('0x30')]['sort']);_0x570d1e[_0x0f24('0x3b')]=qs['filters'](_['pick'](_0xd58147[_0x0f24('0x30')],_0x159e4d[_0x0f24('0x32')]));if(_0xd58147[_0x0f24('0x30')][_0x0f24('0x3a')]){_0x570d1e['where']=_[_0x0f24('0x3d')](_0x570d1e[_0x0f24('0x3b')],{'$or':_[_0x0f24('0x2b')](_0x570d1e[_0x0f24('0x35')],function(_0x4a5170){var _0xbcbadf={};_0xbcbadf[_0x4a5170]={'$like':'%'+_0xd58147['query'][_0x0f24('0x3a')]+'%'};return _0xbcbadf;})});}_0x570d1e=_[_0x0f24('0x3d')]({},_0x570d1e,_0xd58147[_0x0f24('0x3e')]);return _0xa757[_0x0f24('0x4f')](_0x570d1e);}})[_0x0f24('0x26')](function(_0x22dd60){if(_0x22dd60){_0x3068da=_0x22dd60[_0x0f24('0x44')];if(!_0xd58147[_0x0f24('0x30')][_0x0f24('0x37')](_0x0f24('0x4c'))){_0x570d1e[_0x0f24('0x1e')]=qs[_0x0f24('0x1e')](_0xd58147['query'][_0x0f24('0x1e')]);_0x570d1e[_0x0f24('0x1b')]=qs[_0x0f24('0x1b')](_0xd58147[_0x0f24('0x30')][_0x0f24('0x1b')]);}return _0xa757[_0x0f24('0x4f')](_0x570d1e);}})['then'](function(_0x6b5836){if(_0x6b5836){return _0x6b5836?{'count':_0x3068da,'rows':_0x6b5836}:null;}})[_0x0f24('0x26')](respondWithResult(_0x287539,null))[_0x0f24('0x42')](handleError(_0x287539,null));};exports[_0x0f24('0x50')]=function(_0xafe64d,_0x415234,_0x5aa2f0){if(_0xafe64d[_0x0f24('0x47')]['id']){delete _0xafe64d[_0x0f24('0x47')]['id'];}return db[_0x0f24('0x2c')]['findOne']({'where':{'id':_0xafe64d[_0x0f24('0x43')]['id']}})[_0x0f24('0x26')](handleEntityNotFound(_0x415234,null))[_0x0f24('0x26')](function(_0x359d65){if(_0x359d65){return _0x359d65[_0x0f24('0x50')](_0xafe64d[_0x0f24('0x47')]['ids']||[]);}return null;})['then'](respondWithResult(_0x415234,null))['catch'](handleError(_0x415234,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index ed88cd1..b0c820e 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 _0xd39b=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util'];(function(_0x299a26,_0x474a6c){var _0x43923b=function(_0x4bf774){while(--_0x4bf774){_0x299a26['push'](_0x299a26['shift']());}};_0x43923b(++_0x474a6c);}(_0xd39b,0xec));var _0xbd39=function(_0x4a8bbf,_0x37889c){_0x4a8bbf=_0x4a8bbf-0x0;var _0x22e263=_0xd39b[_0x4a8bbf];return _0x22e263;};'use strict';var _=require(_0xbd39('0x0'));var util=require(_0xbd39('0x1'));var logger=require(_0xbd39('0x2'))(_0xbd39('0x3'));var moment=require(_0xbd39('0x4'));var BPromise=require(_0xbd39('0x5'));var rp=require(_0xbd39('0x6'));var fs=require('fs');var path=require(_0xbd39('0x7'));var rimraf=require(_0xbd39('0x8'));var config=require(_0xbd39('0x9'));var attributes=require(_0xbd39('0xa'));module[_0xbd39('0xb')]=function(_0x1c5f75,_0x58d371){return _0x1c5f75[_0xbd39('0xc')]('DeskConfiguration',attributes,{'tableName':_0xbd39('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa631=['./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x48422a,_0x143564){var _0x14fec5=function(_0x4ece1e){while(--_0x4ece1e){_0x48422a['push'](_0x48422a['shift']());}};_0x14fec5(++_0x143564);}(_0xa631,0xb8));var _0x1a63=function(_0x3c7fb8,_0x3dd564){_0x3c7fb8=_0x3c7fb8-0x0;var _0x197a1f=_0xa631[_0x3c7fb8];return _0x197a1f;};'use strict';var _=require(_0x1a63('0x0'));var util=require('util');var logger=require(_0x1a63('0x1'))(_0x1a63('0x2'));var moment=require(_0x1a63('0x3'));var BPromise=require('bluebird');var rp=require(_0x1a63('0x4'));var fs=require('fs');var path=require(_0x1a63('0x5'));var rimraf=require(_0x1a63('0x6'));var config=require(_0x1a63('0x7'));var attributes=require(_0x1a63('0x8'));module[_0x1a63('0x9')]=function(_0x3f02f0,_0x171ed0){return _0x3f02f0[_0x1a63('0xa')]('DeskConfiguration',attributes,{'tableName':_0x1a63('0xb'),'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 02d6602..aaaa69a 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 _0xb03e=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb03e,0x1eb));var _0xeb03=function(_0x103e7f,_0x413d27){_0x103e7f=_0x103e7f-0x0;var _0x4622bc=_0xb03e[_0x103e7f];return _0x4622bc;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58a2,_0x3d3322,_0x3a6e31){return new BPromise(function(_0x246c6e,_0x3f2c74){return client[_0xeb03('0xc')](_0x3b58a2,_0x3a6e31)['then'](function(_0x403b77){logger[_0xeb03('0xd')](_0xeb03('0xe'),_0x3d3322,'request\x20sent');logger[_0xeb03('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3d3322,_0xeb03('0x10'),JSON[_0xeb03('0x11')](_0x403b77));if(_0x403b77[_0xeb03('0x12')]){if(_0x403b77[_0xeb03('0x12')][_0xeb03('0x13')]===0x1f4){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x3f2c74(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}logger[_0xeb03('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x3d3322,_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);return _0x246c6e(_0x403b77[_0xeb03('0x12')][_0xeb03('0x14')]);}else{logger['info'](_0xeb03('0xe'),_0x3d3322,_0xeb03('0x10'));_0x246c6e(_0x403b77[_0xeb03('0x15')]['message']);}})[_0xeb03('0x16')](function(_0x46dd1b){logger[_0xeb03('0x12')](_0xeb03('0xe'),_0x3d3322,_0x46dd1b);_0x3f2c74(_0x46dd1b);});});} \ No newline at end of file +var _0x48ac=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','randomstring','ioredis'];(function(_0x9c29c6,_0xf763b0){var _0x4d87a5=function(_0x22c328){while(--_0x22c328){_0x9c29c6['push'](_0x9c29c6['shift']());}};_0x4d87a5(++_0xf763b0);}(_0x48ac,0xe0));var _0xc48a=function(_0xa2a6d0,_0x9adb77){_0xa2a6d0=_0xa2a6d0-0x0;var _0x32dadf=_0x48ac[_0xa2a6d0];return _0x32dadf;};'use strict';var _=require('lodash');var util=require(_0xc48a('0x0'));var moment=require('moment');var BPromise=require(_0xc48a('0x1'));var rs=require(_0xc48a('0x2'));var fs=require('fs');var Redis=require(_0xc48a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc48a('0x4'));var logger=require(_0xc48a('0x5'))(_0xc48a('0x6'));var config=require(_0xc48a('0x7'));var jayson=require(_0xc48a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5df462,_0x5cffd4,_0x1e1e1a){return new BPromise(function(_0xf0c31b,_0x2c3285){return client['request'](_0x5df462,_0x1e1e1a)[_0xc48a('0x9')](function(_0x43461a){logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,_0xc48a('0xc'));logger[_0xc48a('0xd')](_0xc48a('0xe'),_0x5cffd4,_0xc48a('0xc'),JSON[_0xc48a('0xf')](_0x43461a));if(_0x43461a[_0xc48a('0x10')]){if(_0x43461a[_0xc48a('0x10')]['code']===0x1f4){logger[_0xc48a('0x10')](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')]['message']);return _0x2c3285(_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);}logger['error'](_0xc48a('0xb'),_0x5cffd4,_0x43461a[_0xc48a('0x10')][_0xc48a('0x11')]);return _0xf0c31b(_0x43461a['error'][_0xc48a('0x11')]);}else{logger[_0xc48a('0xa')](_0xc48a('0xb'),_0x5cffd4,'request\x20sent');_0xf0c31b(_0x43461a[_0xc48a('0x12')][_0xc48a('0x11')]);}})['catch'](function(_0x5c319b){logger[_0xc48a('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x5cffd4,_0x5c319b);_0x2c3285(_0x5c319b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 9aea90a..14375cb 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 _0x9679=['/:id','show','isAuthenticated','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x9ec8dd,_0x222146){var _0x54a46d=function(_0x47d258){while(--_0x47d258){_0x9ec8dd['push'](_0x9ec8dd['shift']());}};_0x54a46d(++_0x222146);}(_0x9679,0x15f));var _0x9967=function(_0x53bf37,_0x4f62a7){_0x53bf37=_0x53bf37-0x0;var _0x139195=_0x9679[_0x53bf37];return _0x139195;};'use strict';var multer=require(_0x9967('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9967('0x1'));var express=require(_0x9967('0x2'));var router=express[_0x9967('0x3')]();var fs_extra=require(_0x9967('0x4'));var auth=require(_0x9967('0x5'));var interaction=require(_0x9967('0x6'));var config=require(_0x9967('0x7'));var controller=require(_0x9967('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x9967('0x9')](_0x9967('0xa'),auth['isAuthenticated'](),controller[_0x9967('0xb')]);router['post']('/',auth[_0x9967('0xc')](),controller[_0x9967('0xd')]);router[_0x9967('0xe')](_0x9967('0xa'),auth[_0x9967('0xc')](),controller[_0x9967('0xf')]);router[_0x9967('0x10')](_0x9967('0xa'),auth[_0x9967('0xc')](),controller[_0x9967('0x11')]);module[_0x9967('0x12')]=router; \ No newline at end of file +var _0xec18=['./intDeskField.controller','get','index','/:id','isAuthenticated','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d090,_0x4fc0c7){var _0x1c89b8=function(_0x22b90a){while(--_0x22b90a){_0x17d090['push'](_0x17d090['shift']());}};_0x1c89b8(++_0x4fc0c7);}(_0xec18,0x12a));var _0x8ec1=function(_0x367cf2,_0x44883e){_0x367cf2=_0x367cf2-0x0;var _0x426347=_0xec18[_0x367cf2];return _0x426347;};'use strict';var multer=require('multer');var util=require(_0x8ec1('0x0'));var path=require(_0x8ec1('0x1'));var timeout=require(_0x8ec1('0x2'));var express=require('express');var router=express[_0x8ec1('0x3')]();var fs_extra=require(_0x8ec1('0x4'));var auth=require(_0x8ec1('0x5'));var interaction=require(_0x8ec1('0x6'));var config=require(_0x8ec1('0x7'));var controller=require(_0x8ec1('0x8'));router[_0x8ec1('0x9')]('/',auth['isAuthenticated'](),controller[_0x8ec1('0xa')]);router[_0x8ec1('0x9')](_0x8ec1('0xb'),auth[_0x8ec1('0xc')](),controller['show']);router['post']('/',auth[_0x8ec1('0xc')](),controller[_0x8ec1('0xd')]);router[_0x8ec1('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8ec1('0xf')]);router['delete'](_0x8ec1('0xb'),auth[_0x8ec1('0xc')](),controller[_0x8ec1('0x10')]);module[_0x8ec1('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index f118293..c7f6626 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 _0x81db=['BOOLEAN','ENUM','variable','customVariable','keyValue','picklist','STRING','string'];(function(_0x400257,_0x1b9c00){var _0x3456f4=function(_0x28cd5e){while(--_0x28cd5e){_0x400257['push'](_0x400257['shift']());}};_0x3456f4(++_0x1b9c00);}(_0x81db,0x1d9));var _0xb81d=function(_0x2bd750,_0x39be0a){_0x2bd750=_0x2bd750-0x0;var _0xf32aab=_0x81db[_0x2bd750];return _0xf32aab;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb81d('0x0')]('string',_0xb81d('0x1'),_0xb81d('0x2'),_0xb81d('0x3'),_0xb81d('0x4')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb81d('0x5')]},'keyType':{'type':Sequelize[_0xb81d('0x0')](_0xb81d('0x6'),_0xb81d('0x1'),_0xb81d('0x2'))},'keyContent':{'type':Sequelize[_0xb81d('0x5')]},'idField':{'type':Sequelize[_0xb81d('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xb81d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb81d('0x5')]}}; \ No newline at end of file +var _0x0362=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0x0362,0xbd));var _0x2036=function(_0x5a1cee,_0x4ca88d){_0x5a1cee=_0x5a1cee-0x0;var _0x347c1c=_0x0362[_0x5a1cee];return _0x347c1c;};'use strict';var Sequelize=require(_0x2036('0x0'));module[_0x2036('0x1')]={'type':{'type':Sequelize[_0x2036('0x2')](_0x2036('0x3'),_0x2036('0x4'),_0x2036('0x5'),_0x2036('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x2036('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x2036('0x2')](_0x2036('0x3'),'variable',_0x2036('0x5'))},'keyContent':{'type':Sequelize[_0x2036('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2036('0x7')]},'customField':{'type':Sequelize[_0x2036('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index d988306..dba9228 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 _0xc99e=['stack','name','send','index','map','DeskField','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','filter','merge','where','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','reject','save','update','then','destroy'];(function(_0x50cf5b,_0x19b129){var _0x5d1a3a=function(_0x206bb4){while(--_0x206bb4){_0x50cf5b['push'](_0x50cf5b['shift']());}};_0x5d1a3a(++_0x19b129);}(_0xc99e,0x6e));var _0xec99=function(_0x4c4b21,_0x2e40d1){_0x4c4b21=_0x4c4b21-0x0;var _0x260480=_0xc99e[_0x4c4b21];return _0x260480;};'use strict';var emlformat=require(_0xec99('0x0'));var rimraf=require(_0xec99('0x1'));var zipdir=require(_0xec99('0x2'));var jsonpatch=require(_0xec99('0x3'));var rp=require(_0xec99('0x4'));var moment=require(_0xec99('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xec99('0x6'));var util=require(_0xec99('0x7'));var path=require(_0xec99('0x8'));var sox=require(_0xec99('0x9'));var csv=require(_0xec99('0xa'));var ejs=require(_0xec99('0xb'));var fs=require('fs');var fs_extra=require(_0xec99('0xc'));var _=require(_0xec99('0xd'));var squel=require('squel');var crypto=require(_0xec99('0xe'));var jsforce=require(_0xec99('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xec99('0xa'));var querystring=require(_0xec99('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xec99('0x11'));var qs=require(_0xec99('0x12'));var as=require(_0xec99('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xec99('0x14'))(_0xec99('0x15'));var utils=require(_0xec99('0x16'));var config=require(_0xec99('0x17'));var licenseUtil=require(_0xec99('0x18'));var db=require(_0xec99('0x19'))['db'];function respondWithStatusCode(_0x580b34,_0xd5aa6f){_0xd5aa6f=_0xd5aa6f||0xcc;return function(_0x549ba9){if(_0x549ba9){return _0x580b34[_0xec99('0x1a')](_0xd5aa6f);}return _0x580b34['status'](_0xd5aa6f)[_0xec99('0x1b')]();};}function respondWithResult(_0x57bf4c,_0x59374e){_0x59374e=_0x59374e||0xc8;return function(_0xc7627){if(_0xc7627){return _0x57bf4c['status'](_0x59374e)[_0xec99('0x1c')](_0xc7627);}};}function respondWithFilteredResult(_0x159c47,_0x3946b3){return function(_0x3d70fb){if(_0x3d70fb){var _0x3350f9=typeof _0x3946b3[_0xec99('0x1d')]===_0xec99('0x1e')&&typeof _0x3946b3['limit']===_0xec99('0x1e');var _0x52d9a7=_0x3d70fb[_0xec99('0x1f')];var _0x387e3d=_0x3350f9?0x0:_0x3946b3[_0xec99('0x1d')];var _0x7eb76b=_0x3350f9?_0x3d70fb['count']:_0x3946b3['offset']+_0x3946b3['limit'];var _0x1a6d8e;if(_0x7eb76b>=_0x52d9a7){_0x7eb76b=_0x52d9a7;_0x1a6d8e=0xc8;}else{_0x1a6d8e=0xce;}_0x159c47[_0xec99('0x20')](_0x1a6d8e);return _0x159c47[_0xec99('0x21')](_0xec99('0x22'),_0x387e3d+'-'+_0x7eb76b+'/'+_0x52d9a7)[_0xec99('0x1c')](_0x3d70fb);}return null;};}function patchUpdates(_0x1edaf9){return function(_0x1644a8){try{jsonpatch['apply'](_0x1644a8,_0x1edaf9,!![]);}catch(_0x56b54b){return BPromise[_0xec99('0x23')](_0x56b54b);}return _0x1644a8[_0xec99('0x24')]();};}function saveUpdates(_0x5364ee,_0xdb6cd1){return function(_0x1be97d){if(_0x1be97d){return _0x1be97d[_0xec99('0x25')](_0x5364ee)[_0xec99('0x26')](function(_0x18e065){return _0x18e065;});}return null;};}function removeEntity(_0x3c2e16,_0x1b32c6){return function(_0x10ab73){if(_0x10ab73){return _0x10ab73[_0xec99('0x27')]()[_0xec99('0x26')](function(){_0x3c2e16['status'](0xcc)[_0xec99('0x1b')]();});}};}function handleEntityNotFound(_0x588f27,_0x5aeb8f){return function(_0x5eebc1){if(!_0x5eebc1){_0x588f27[_0xec99('0x1a')](0x194);}return _0x5eebc1;};}function handleError(_0x39754c,_0x21ff98){_0x21ff98=_0x21ff98||0x1f4;return function(_0x26cd07){logger['error'](_0x26cd07[_0xec99('0x28')]);if(_0x26cd07[_0xec99('0x29')]){delete _0x26cd07[_0xec99('0x29')];}_0x39754c[_0xec99('0x20')](_0x21ff98)[_0xec99('0x2a')](_0x26cd07);};}exports[_0xec99('0x2b')]=function(_0x34f1f5,_0x185bee){var _0x12a3d6={},_0x373666={},_0x153bde={'count':0x0,'rows':[]};var _0x575ab4=_[_0xec99('0x2c')](db[_0xec99('0x2d')]['rawAttributes'],function(_0x22c264){return{'name':_0x22c264[_0xec99('0x2e')],'type':_0x22c264[_0xec99('0x2f')]['key']};});_0x373666[_0xec99('0x30')]=_[_0xec99('0x2c')](_0x575ab4,_0xec99('0x29'));_0x373666[_0xec99('0x31')]=_[_0xec99('0x32')](_0x34f1f5[_0xec99('0x31')]);_0x373666['filters']=_[_0xec99('0x33')](_0x373666[_0xec99('0x30')],_0x373666[_0xec99('0x31')]);_0x12a3d6['attributes']=_['intersection'](_0x373666['model'],qs[_0xec99('0x34')](_0x34f1f5['query'][_0xec99('0x34')]));_0x12a3d6[_0xec99('0x35')]=_0x12a3d6[_0xec99('0x35')][_0xec99('0x36')]?_0x12a3d6[_0xec99('0x35')]:_0x373666['model'];if(!_0x34f1f5[_0xec99('0x31')][_0xec99('0x37')](_0xec99('0x38'))){_0x12a3d6[_0xec99('0x39')]=qs['limit'](_0x34f1f5[_0xec99('0x31')]['limit']);_0x12a3d6['offset']=qs[_0xec99('0x1d')](_0x34f1f5['query'][_0xec99('0x1d')]);}_0x12a3d6[_0xec99('0x3a')]=qs[_0xec99('0x3b')](_0x34f1f5[_0xec99('0x31')]['sort']);_0x12a3d6['where']=qs[_0xec99('0x3c')](_['pick'](_0x34f1f5[_0xec99('0x31')],_0x373666[_0xec99('0x3c')]),_0x575ab4);if(_0x34f1f5[_0xec99('0x31')][_0xec99('0x3d')]){_0x12a3d6['where']=_[_0xec99('0x3e')](_0x12a3d6[_0xec99('0x3f')],{'$or':_[_0xec99('0x2c')](_0x575ab4,function(_0x2a40ae){if(_0x2a40ae[_0xec99('0x2f')]!=='VIRTUAL'){var _0x476b13={};_0x476b13[_0x2a40ae[_0xec99('0x29')]]={'$like':'%'+_0x34f1f5['query'][_0xec99('0x3d')]+'%'};return _0x476b13;}})});}_0x12a3d6=_[_0xec99('0x3e')]({},_0x12a3d6,_0x34f1f5[_0xec99('0x40')]);var _0x1f9f55={'where':_0x12a3d6[_0xec99('0x3f')]};return db[_0xec99('0x2d')][_0xec99('0x1f')](_0x1f9f55)[_0xec99('0x26')](function(_0x127714){_0x153bde['count']=_0x127714;if(_0x34f1f5[_0xec99('0x31')][_0xec99('0x41')]){_0x12a3d6[_0xec99('0x42')]=[{'all':!![]}];}return db[_0xec99('0x2d')][_0xec99('0x43')](_0x12a3d6);})[_0xec99('0x26')](function(_0x553d42){_0x153bde[_0xec99('0x44')]=_0x553d42;return _0x153bde;})[_0xec99('0x26')](respondWithFilteredResult(_0x185bee,_0x12a3d6))[_0xec99('0x45')](handleError(_0x185bee,null));};exports[_0xec99('0x46')]=function(_0x14a5f7,_0x1f246d){var _0x244cca={'raw':!![],'where':{'id':_0x14a5f7['params']['id']}},_0x129cc1={};_0x129cc1[_0xec99('0x30')]=_['keys'](db[_0xec99('0x2d')]['rawAttributes']);_0x129cc1[_0xec99('0x31')]=_[_0xec99('0x32')](_0x14a5f7[_0xec99('0x31')]);_0x129cc1[_0xec99('0x3c')]=_[_0xec99('0x33')](_0x129cc1[_0xec99('0x30')],_0x129cc1[_0xec99('0x31')]);_0x244cca[_0xec99('0x35')]=_[_0xec99('0x33')](_0x129cc1[_0xec99('0x30')],qs[_0xec99('0x34')](_0x14a5f7['query'][_0xec99('0x34')]));_0x244cca[_0xec99('0x35')]=_0x244cca[_0xec99('0x35')][_0xec99('0x36')]?_0x244cca['attributes']:_0x129cc1[_0xec99('0x30')];if(_0x14a5f7[_0xec99('0x31')][_0xec99('0x41')]){_0x244cca[_0xec99('0x42')]=[{'all':!![]}];}_0x244cca=_[_0xec99('0x3e')]({},_0x244cca,_0x14a5f7[_0xec99('0x40')]);return db[_0xec99('0x2d')][_0xec99('0x47')](_0x244cca)[_0xec99('0x26')](handleEntityNotFound(_0x1f246d,null))[_0xec99('0x26')](respondWithResult(_0x1f246d,null))['catch'](handleError(_0x1f246d,null));};exports[_0xec99('0x48')]=function(_0xe0672b,_0x417a09){return db[_0xec99('0x2d')][_0xec99('0x48')](_0xe0672b['body'],{})[_0xec99('0x26')](respondWithResult(_0x417a09,0xc9))[_0xec99('0x45')](handleError(_0x417a09,null));};exports['update']=function(_0x44fc7e,_0x579b41){if(_0x44fc7e[_0xec99('0x49')]['id']){delete _0x44fc7e['body']['id'];}return db[_0xec99('0x2d')][_0xec99('0x47')]({'where':{'id':_0x44fc7e[_0xec99('0x4a')]['id']}})['then'](handleEntityNotFound(_0x579b41,null))[_0xec99('0x26')](saveUpdates(_0x44fc7e[_0xec99('0x49')],null))['then'](respondWithResult(_0x579b41,null))[_0xec99('0x45')](handleError(_0x579b41,null));};exports[_0xec99('0x27')]=function(_0x4f7a71,_0xa63f76){return db['DeskField']['find']({'where':{'id':_0x4f7a71[_0xec99('0x4a')]['id']}})[_0xec99('0x26')](handleEntityNotFound(_0xa63f76,null))[_0xec99('0x26')](removeEntity(_0xa63f76,null))[_0xec99('0x45')](handleError(_0xa63f76,null));}; \ No newline at end of file +var _0xb416=['options','create','catch','update','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','count','limit','status','set','apply','reject','save','then','destroy','name','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','params'];(function(_0x3f1c3a,_0x4b023f){var _0x5246cb=function(_0x54fbe1){while(--_0x54fbe1){_0x3f1c3a['push'](_0x3f1c3a['shift']());}};_0x5246cb(++_0x4b023f);}(_0xb416,0x173));var _0x6b41=function(_0x4b0b57,_0x43f780){_0x4b0b57=_0x4b0b57-0x0;var _0x44b2ca=_0xb416[_0x4b0b57];return _0x44b2ca;};'use strict';var emlformat=require(_0x6b41('0x0'));var rimraf=require(_0x6b41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6b41('0x2'));var rp=require(_0x6b41('0x3'));var moment=require(_0x6b41('0x4'));var BPromise=require(_0x6b41('0x5'));var Mustache=require('mustache');var util=require(_0x6b41('0x6'));var path=require(_0x6b41('0x7'));var sox=require(_0x6b41('0x8'));var csv=require(_0x6b41('0x9'));var ejs=require(_0x6b41('0xa'));var fs=require('fs');var fs_extra=require(_0x6b41('0xb'));var _=require('lodash');var squel=require(_0x6b41('0xc'));var crypto=require(_0x6b41('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6b41('0x9'));var querystring=require('querystring');var Papa=require(_0x6b41('0xe'));var Redis=require(_0x6b41('0xf'));var authService=require(_0x6b41('0x10'));var qs=require(_0x6b41('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6b41('0x12'));var utils=require(_0x6b41('0x13'));var config=require(_0x6b41('0x14'));var licenseUtil=require(_0x6b41('0x15'));var db=require(_0x6b41('0x16'))['db'];function respondWithStatusCode(_0x32c134,_0xfb09c0){_0xfb09c0=_0xfb09c0||0xcc;return function(_0x3fca37){if(_0x3fca37){return _0x32c134[_0x6b41('0x17')](_0xfb09c0);}return _0x32c134['status'](_0xfb09c0)[_0x6b41('0x18')]();};}function respondWithResult(_0x514800,_0x29ee83){_0x29ee83=_0x29ee83||0xc8;return function(_0x2509ac){if(_0x2509ac){return _0x514800['status'](_0x29ee83)[_0x6b41('0x19')](_0x2509ac);}};}function respondWithFilteredResult(_0x16ddd7,_0x50c559){return function(_0x4c1b85){if(_0x4c1b85){var _0x4c629f=typeof _0x50c559[_0x6b41('0x1a')]==='undefined'&&typeof _0x50c559['limit']==='undefined';var _0x1d0a9c=_0x4c1b85['count'];var _0x3e5e57=_0x4c629f?0x0:_0x50c559['offset'];var _0x510604=_0x4c629f?_0x4c1b85[_0x6b41('0x1b')]:_0x50c559[_0x6b41('0x1a')]+_0x50c559[_0x6b41('0x1c')];var _0x3b6dca;if(_0x510604>=_0x1d0a9c){_0x510604=_0x1d0a9c;_0x3b6dca=0xc8;}else{_0x3b6dca=0xce;}_0x16ddd7[_0x6b41('0x1d')](_0x3b6dca);return _0x16ddd7[_0x6b41('0x1e')]('Content-Range',_0x3e5e57+'-'+_0x510604+'/'+_0x1d0a9c)[_0x6b41('0x19')](_0x4c1b85);}return null;};}function patchUpdates(_0x6c5388){return function(_0x44959f){try{jsonpatch[_0x6b41('0x1f')](_0x44959f,_0x6c5388,!![]);}catch(_0x3b914b){return BPromise[_0x6b41('0x20')](_0x3b914b);}return _0x44959f[_0x6b41('0x21')]();};}function saveUpdates(_0xd603be,_0x17eb9d){return function(_0x311fec){if(_0x311fec){return _0x311fec['update'](_0xd603be)[_0x6b41('0x22')](function(_0x3b97f0){return _0x3b97f0;});}return null;};}function removeEntity(_0x4289af,_0x3a4ad7){return function(_0x4e7a1f){if(_0x4e7a1f){return _0x4e7a1f[_0x6b41('0x23')]()[_0x6b41('0x22')](function(){_0x4289af[_0x6b41('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x87086e,_0x51fa40){return function(_0x5abf32){if(!_0x5abf32){_0x87086e[_0x6b41('0x17')](0x194);}return _0x5abf32;};}function handleError(_0x5295a2,_0x6287d8){_0x6287d8=_0x6287d8||0x1f4;return function(_0x19ff99){logger['error'](_0x19ff99['stack']);if(_0x19ff99[_0x6b41('0x24')]){delete _0x19ff99[_0x6b41('0x24')];}_0x5295a2[_0x6b41('0x1d')](_0x6287d8)[_0x6b41('0x25')](_0x19ff99);};}exports[_0x6b41('0x26')]=function(_0x44ccee,_0x5af3ae){var _0x1ba921={},_0x1eef51={},_0x693c3d={'count':0x0,'rows':[]};var _0x42d182=_[_0x6b41('0x27')](db[_0x6b41('0x28')][_0x6b41('0x29')],function(_0x4a0748){return{'name':_0x4a0748[_0x6b41('0x2a')],'type':_0x4a0748['type'][_0x6b41('0x2b')]};});_0x1eef51[_0x6b41('0x2c')]=_[_0x6b41('0x27')](_0x42d182,_0x6b41('0x24'));_0x1eef51['query']=_[_0x6b41('0x2d')](_0x44ccee['query']);_0x1eef51[_0x6b41('0x2e')]=_[_0x6b41('0x2f')](_0x1eef51[_0x6b41('0x2c')],_0x1eef51[_0x6b41('0x30')]);_0x1ba921[_0x6b41('0x31')]=_[_0x6b41('0x2f')](_0x1eef51['model'],qs[_0x6b41('0x32')](_0x44ccee[_0x6b41('0x30')][_0x6b41('0x32')]));_0x1ba921[_0x6b41('0x31')]=_0x1ba921[_0x6b41('0x31')][_0x6b41('0x33')]?_0x1ba921[_0x6b41('0x31')]:_0x1eef51[_0x6b41('0x2c')];if(!_0x44ccee[_0x6b41('0x30')][_0x6b41('0x34')](_0x6b41('0x35'))){_0x1ba921['limit']=qs[_0x6b41('0x1c')](_0x44ccee['query'][_0x6b41('0x1c')]);_0x1ba921[_0x6b41('0x1a')]=qs[_0x6b41('0x1a')](_0x44ccee[_0x6b41('0x30')][_0x6b41('0x1a')]);}_0x1ba921[_0x6b41('0x36')]=qs[_0x6b41('0x37')](_0x44ccee[_0x6b41('0x30')][_0x6b41('0x37')]);_0x1ba921['where']=qs['filters'](_['pick'](_0x44ccee['query'],_0x1eef51[_0x6b41('0x2e')]),_0x42d182);if(_0x44ccee[_0x6b41('0x30')][_0x6b41('0x38')]){_0x1ba921[_0x6b41('0x39')]=_[_0x6b41('0x3a')](_0x1ba921[_0x6b41('0x39')],{'$or':_[_0x6b41('0x27')](_0x42d182,function(_0x4fb61b){if(_0x4fb61b[_0x6b41('0x3b')]!==_0x6b41('0x3c')){var _0x2073ab={};_0x2073ab[_0x4fb61b['name']]={'$like':'%'+_0x44ccee['query'][_0x6b41('0x38')]+'%'};return _0x2073ab;}})});}_0x1ba921=_[_0x6b41('0x3a')]({},_0x1ba921,_0x44ccee['options']);var _0x19e66b={'where':_0x1ba921[_0x6b41('0x39')]};return db[_0x6b41('0x28')]['count'](_0x19e66b)[_0x6b41('0x22')](function(_0x2d44f3){_0x693c3d[_0x6b41('0x1b')]=_0x2d44f3;if(_0x44ccee[_0x6b41('0x30')][_0x6b41('0x3d')]){_0x1ba921[_0x6b41('0x3e')]=[{'all':!![]}];}return db[_0x6b41('0x28')][_0x6b41('0x3f')](_0x1ba921);})[_0x6b41('0x22')](function(_0x5051da){_0x693c3d[_0x6b41('0x40')]=_0x5051da;return _0x693c3d;})['then'](respondWithFilteredResult(_0x5af3ae,_0x1ba921))['catch'](handleError(_0x5af3ae,null));};exports[_0x6b41('0x41')]=function(_0x2a1ee8,_0x34abda){var _0x4d1695={'raw':!![],'where':{'id':_0x2a1ee8[_0x6b41('0x42')]['id']}},_0x4bda39={};_0x4bda39[_0x6b41('0x2c')]=_[_0x6b41('0x2d')](db[_0x6b41('0x28')][_0x6b41('0x29')]);_0x4bda39[_0x6b41('0x30')]=_[_0x6b41('0x2d')](_0x2a1ee8[_0x6b41('0x30')]);_0x4bda39[_0x6b41('0x2e')]=_[_0x6b41('0x2f')](_0x4bda39[_0x6b41('0x2c')],_0x4bda39[_0x6b41('0x30')]);_0x4d1695[_0x6b41('0x31')]=_[_0x6b41('0x2f')](_0x4bda39[_0x6b41('0x2c')],qs[_0x6b41('0x32')](_0x2a1ee8['query'][_0x6b41('0x32')]));_0x4d1695[_0x6b41('0x31')]=_0x4d1695['attributes'][_0x6b41('0x33')]?_0x4d1695[_0x6b41('0x31')]:_0x4bda39['model'];if(_0x2a1ee8['query']['includeAll']){_0x4d1695[_0x6b41('0x3e')]=[{'all':!![]}];}_0x4d1695=_[_0x6b41('0x3a')]({},_0x4d1695,_0x2a1ee8[_0x6b41('0x43')]);return db[_0x6b41('0x28')]['find'](_0x4d1695)['then'](handleEntityNotFound(_0x34abda,null))[_0x6b41('0x22')](respondWithResult(_0x34abda,null))['catch'](handleError(_0x34abda,null));};exports[_0x6b41('0x44')]=function(_0x559557,_0x30d514){return db[_0x6b41('0x28')][_0x6b41('0x44')](_0x559557['body'],{})['then'](respondWithResult(_0x30d514,0xc9))[_0x6b41('0x45')](handleError(_0x30d514,null));};exports[_0x6b41('0x46')]=function(_0x2d78d8,_0x226331){if(_0x2d78d8[_0x6b41('0x47')]['id']){delete _0x2d78d8[_0x6b41('0x47')]['id'];}return db[_0x6b41('0x28')][_0x6b41('0x48')]({'where':{'id':_0x2d78d8[_0x6b41('0x42')]['id']}})[_0x6b41('0x22')](handleEntityNotFound(_0x226331,null))[_0x6b41('0x22')](saveUpdates(_0x2d78d8['body'],null))[_0x6b41('0x22')](respondWithResult(_0x226331,null))['catch'](handleError(_0x226331,null));};exports[_0x6b41('0x23')]=function(_0xeca2a7,_0x1956f5){return db[_0x6b41('0x28')][_0x6b41('0x48')]({'where':{'id':_0xeca2a7[_0x6b41('0x42')]['id']}})[_0x6b41('0x22')](handleEntityNotFound(_0x1956f5,null))[_0x6b41('0x22')](removeEntity(_0x1956f5,null))[_0x6b41('0x45')](handleError(_0x1956f5,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ab865f3..ebb55bc 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 _0x0304=['../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x26e449,_0x4b987c){var _0xcdb366=function(_0x197cbc){while(--_0x197cbc){_0x26e449['push'](_0x26e449['shift']());}};_0xcdb366(++_0x4b987c);}(_0x0304,0xa1));var _0x4030=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x0304[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x4030('0x0'));var util=require(_0x4030('0x1'));var logger=require(_0x4030('0x2'))(_0x4030('0x3'));var moment=require(_0x4030('0x4'));var BPromise=require(_0x4030('0x5'));var rp=require(_0x4030('0x6'));var fs=require('fs');var path=require(_0x4030('0x7'));var rimraf=require(_0x4030('0x8'));var config=require(_0x4030('0x9'));var attributes=require(_0x4030('0xa'));module[_0x4030('0xb')]=function(_0x4d9c5f,_0x3818f5){return _0x4d9c5f[_0x4030('0xc')](_0x4030('0xd'),attributes,{'tableName':_0x4030('0xe'),'paranoid':![],'indexes':[{'name':_0x4030('0xf'),'fields':[_0x4030('0x10'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb39e=['bluebird','rimraf','../../config/environment','./intDeskField.attributes','define','idField','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x1a286f,_0x374d52){var _0x33e8b0=function(_0xc49f77){while(--_0xc49f77){_0x1a286f['push'](_0x1a286f['shift']());}};_0x33e8b0(++_0x374d52);}(_0xb39e,0xf7));var _0xeb39=function(_0x3cb979,_0x21bbfd){_0x3cb979=_0x3cb979-0x0;var _0x3a5e5f=_0xb39e[_0x3cb979];return _0x3a5e5f;};'use strict';var _=require(_0xeb39('0x0'));var util=require(_0xeb39('0x1'));var logger=require(_0xeb39('0x2'))(_0xeb39('0x3'));var moment=require(_0xeb39('0x4'));var BPromise=require(_0xeb39('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xeb39('0x6'));var config=require(_0xeb39('0x7'));var attributes=require(_0xeb39('0x8'));module['exports']=function(_0xd838ce,_0x48b40a){return _0xd838ce[_0xeb39('0x9')]('DeskField',attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xeb39('0xa'),_0xeb39('0xb')],'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 63a3e1e..4a83057 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 _0xed08=['randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','result','lodash','moment','bluebird'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xed08,0x6b));var _0x8ed0=function(_0x32a9b2,_0x372806){_0x32a9b2=_0x32a9b2-0x0;var _0xe495fd=_0xed08[_0x32a9b2];return _0xe495fd;};'use strict';var _=require(_0x8ed0('0x0'));var util=require('util');var moment=require(_0x8ed0('0x1'));var BPromise=require(_0x8ed0('0x2'));var rs=require(_0x8ed0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ed0('0x4'))['db'];var utils=require(_0x8ed0('0x5'));var logger=require(_0x8ed0('0x6'))('rpc');var config=require(_0x8ed0('0x7'));var jayson=require(_0x8ed0('0x8'));var client=jayson[_0x8ed0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ca9c1,_0x5b76e0,_0x1f87cb){return new BPromise(function(_0x4ebd89,_0x48788b){return client[_0x8ed0('0xa')](_0x3ca9c1,_0x1f87cb)[_0x8ed0('0xb')](function(_0x29db59){logger[_0x8ed0('0xc')]('DeskField,\x20%s,\x20%s',_0x5b76e0,_0x8ed0('0xd'));logger[_0x8ed0('0xe')](_0x8ed0('0xf'),_0x5b76e0,_0x8ed0('0xd'),JSON[_0x8ed0('0x10')](_0x29db59));if(_0x29db59[_0x8ed0('0x11')]){if(_0x29db59['error'][_0x8ed0('0x12')]===0x1f4){logger[_0x8ed0('0x11')](_0x8ed0('0x13'),_0x5b76e0,_0x29db59[_0x8ed0('0x11')][_0x8ed0('0x14')]);return _0x48788b(_0x29db59['error'][_0x8ed0('0x14')]);}logger['error'](_0x8ed0('0x13'),_0x5b76e0,_0x29db59[_0x8ed0('0x11')][_0x8ed0('0x14')]);return _0x4ebd89(_0x29db59[_0x8ed0('0x11')]['message']);}else{logger[_0x8ed0('0xc')](_0x8ed0('0x13'),_0x5b76e0,_0x8ed0('0xd'));_0x4ebd89(_0x29db59[_0x8ed0('0x15')][_0x8ed0('0x14')]);}})['catch'](function(_0x2b854f){logger[_0x8ed0('0x11')](_0x8ed0('0x13'),_0x5b76e0,_0x2b854f);_0x48788b(_0x2b854f);});});} \ No newline at end of file +var _0x4477=['../../config/logger','jayson/promise','client','http','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4477,0x19e));var _0x7447=function(_0x369c7e,_0x6893de){_0x369c7e=_0x369c7e-0x0;var _0x9f68d6=_0x4477[_0x369c7e];return _0x9f68d6;};'use strict';var _=require(_0x7447('0x0'));var util=require(_0x7447('0x1'));var moment=require('moment');var BPromise=require(_0x7447('0x2'));var rs=require(_0x7447('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7447('0x4'))['db'];var utils=require(_0x7447('0x5'));var logger=require(_0x7447('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7447('0x7'));var client=jayson[_0x7447('0x8')][_0x7447('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xab0b39,_0x2641ea,_0x1b8272){return new BPromise(function(_0x28e90a,_0x2bcdc1){return client['request'](_0xab0b39,_0x1b8272)['then'](function(_0x513b3f){logger[_0x7447('0xa')](_0x7447('0xb'),_0x2641ea,_0x7447('0xc'));logger[_0x7447('0xd')](_0x7447('0xe'),_0x2641ea,_0x7447('0xc'),JSON[_0x7447('0xf')](_0x513b3f));if(_0x513b3f['error']){if(_0x513b3f[_0x7447('0x10')][_0x7447('0x11')]===0x1f4){logger['error'](_0x7447('0xb'),_0x2641ea,_0x513b3f[_0x7447('0x10')][_0x7447('0x12')]);return _0x2bcdc1(_0x513b3f[_0x7447('0x10')][_0x7447('0x12')]);}logger[_0x7447('0x10')]('DeskField,\x20%s,\x20%s',_0x2641ea,_0x513b3f[_0x7447('0x10')]['message']);return _0x28e90a(_0x513b3f[_0x7447('0x10')]['message']);}else{logger[_0x7447('0xa')](_0x7447('0xb'),_0x2641ea,_0x7447('0xc'));_0x28e90a(_0x513b3f[_0x7447('0x13')]['message']);}})['catch'](function(_0x39632a){logger[_0x7447('0x10')](_0x7447('0xb'),_0x2641ea,_0x39632a);_0x2bcdc1(_0x39632a);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index c28166f..1bbfad9 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 _0x937b=['Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Account.controller','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','create','post','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x87cc4f,_0x5445d6){var _0x34e783=function(_0x496275){while(--_0x496275){_0x87cc4f['push'](_0x87cc4f['shift']());}};_0x34e783(++_0x5445d6);}(_0x937b,0x1c9));var _0xb937=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x937b[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xb937('0x0'));var util=require(_0xb937('0x1'));var path=require(_0xb937('0x2'));var timeout=require(_0xb937('0x3'));var express=require(_0xb937('0x4'));var router=express[_0xb937('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb937('0x6'));var interaction=require(_0xb937('0x7'));var config=require('../../config/environment');var controller=require(_0xb937('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb937('0x9')]);router[_0xb937('0xa')](_0xb937('0xb'),auth[_0xb937('0xc')](),controller['show']);router[_0xb937('0xa')](_0xb937('0xd'),auth[_0xb937('0xc')](),controller[_0xb937('0xe')]);router[_0xb937('0xa')](_0xb937('0xf'),auth[_0xb937('0xc')](),controller['getFields']);router['post']('/',auth[_0xb937('0xc')](),controller[_0xb937('0x10')]);router[_0xb937('0x11')](_0xb937('0xd'),auth[_0xb937('0xc')](),controller[_0xb937('0x12')]);router[_0xb937('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xb937('0x14')]);router['delete']('/:id',auth[_0xb937('0xc')](),controller[_0xb937('0x15')]);module['exports']=router; \ No newline at end of file +var _0x9fce=['../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4ddb4e,_0x38c020){var _0x1c2f4c=function(_0x4cf0cb){while(--_0x4cf0cb){_0x4ddb4e['push'](_0x4ddb4e['shift']());}};_0x1c2f4c(++_0x38c020);}(_0x9fce,0x130));var _0xe9fc=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x9fce[_0x1f1a97];return _0x29fc6a;};'use strict';var multer=require(_0xe9fc('0x0'));var util=require(_0xe9fc('0x1'));var path=require(_0xe9fc('0x2'));var timeout=require(_0xe9fc('0x3'));var express=require(_0xe9fc('0x4'));var router=express['Router']();var fs_extra=require(_0xe9fc('0x5'));var auth=require(_0xe9fc('0x6'));var interaction=require(_0xe9fc('0x7'));var config=require(_0xe9fc('0x8'));var controller=require(_0xe9fc('0x9'));router[_0xe9fc('0xa')]('/',auth[_0xe9fc('0xb')](),controller[_0xe9fc('0xc')]);router[_0xe9fc('0xa')](_0xe9fc('0xd'),auth['isAuthenticated'](),controller[_0xe9fc('0xe')]);router[_0xe9fc('0xa')]('/:id/configurations',auth[_0xe9fc('0xb')](),controller[_0xe9fc('0xf')]);router[_0xe9fc('0xa')](_0xe9fc('0x10'),auth[_0xe9fc('0xb')](),controller['getFields']);router[_0xe9fc('0x11')]('/',auth[_0xe9fc('0xb')](),controller[_0xe9fc('0x12')]);router[_0xe9fc('0x11')](_0xe9fc('0x13'),auth[_0xe9fc('0xb')](),controller[_0xe9fc('0x14')]);router[_0xe9fc('0x15')](_0xe9fc('0xd'),auth[_0xe9fc('0xb')](),controller[_0xe9fc('0x16')]);router[_0xe9fc('0x17')]('/:id',auth[_0xe9fc('0xb')](),controller[_0xe9fc('0x18')]);module[_0xe9fc('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index e64a305..9283bdf 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 _0x576b=['BOOLEAN','STRING'];(function(_0x3af8b0,_0x48c27c){var _0x17aa44=function(_0x27fc8a){while(--_0x27fc8a){_0x3af8b0['push'](_0x3af8b0['shift']());}};_0x17aa44(++_0x48c27c);}(_0x576b,0x1d9));var _0xb576=function(_0x3349cb,_0xce2eb2){_0x3349cb=_0x3349cb-0x0;var _0x15df5a=_0x576b[_0x3349cb];return _0x15df5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb576('0x0')]},'password':{'type':Sequelize[_0xb576('0x0')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize[_0xb576('0x0')]},'clientId':{'type':Sequelize[_0xb576('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb576('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0xb576('0x0')]},'modernAuthentication':{'type':Sequelize[_0xb576('0x1')],'defaultValue':!![]}}; \ No newline at end of file +var _0x5395=['sequelize','STRING','BOOLEAN'];(function(_0x1fd5eb,_0x235203){var _0x102365=function(_0x54de1f){while(--_0x54de1f){_0x1fd5eb['push'](_0x1fd5eb['shift']());}};_0x102365(++_0x235203);}(_0x5395,0x150));var _0x5539=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x5395[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x5539('0x0'));module['exports']={'name':{'type':Sequelize[_0x5539('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5539('0x1')]},'tenantId':{'type':Sequelize[_0x5539('0x1')]},'clientId':{'type':Sequelize[_0x5539('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x5539('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x5539('0x1')]},'modernAuthentication':{'type':Sequelize[_0x5539('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index a701f86..8c67c82 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 _0xed27=['TrueOption','FalseOption','false','DisplayName',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','Dynamics365Account','fields','includeAll','find','create','body','catch','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','socialprofileidname','statecode','statuscode','transactioncurrencyidname','traversedpath','versionnumber','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','password','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','LogicalName','@odata.type','push','lastIndexOf','BooleanAttributeMetadata','all','forEach','StringAttributeMetadata','DoubleAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','error','test','Wrong\x20credentials','EntityDefinitions(',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Value','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)'];(function(_0x514235,_0x52dedb){var _0x27827b=function(_0x17b9da){while(--_0x17b9da){_0x514235['push'](_0x514235['shift']());}};_0x27827b(++_0x52dedb);}(_0xed27,0x183));var _0x7ed2=function(_0x2c8c59,_0x2637bd){_0x2c8c59=_0x2c8c59-0x0;var _0x3316c1=_0xed27[_0x2c8c59];return _0x3316c1;};'use strict';var rp=require(_0x7ed2('0x0'));var util=require(_0x7ed2('0x1'));var _=require(_0x7ed2('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x7ed2('0x3'))(_0x7ed2('0x4'));var db=require(_0x7ed2('0x5'))['db'];var integrations=require(_0x7ed2('0x6'));function respondWithResult(_0x2ceee1,_0x4a0c79){_0x4a0c79=_0x4a0c79||0xc8;return function(_0x1b1903){if(_0x1b1903){return _0x2ceee1[_0x7ed2('0x7')](_0x4a0c79)[_0x7ed2('0x8')](_0x1b1903);}};}function respondWithFilteredResult(_0x26bea2,_0x38d82a){return function(_0x1b23d9){if(_0x1b23d9){var _0x3e362f=typeof _0x38d82a[_0x7ed2('0x9')]===_0x7ed2('0xa')&&typeof _0x38d82a[_0x7ed2('0xb')]==='undefined';var _0x3e8c53=_0x1b23d9['count'];var _0x445ff7=_0x3e362f?0x0:_0x38d82a['offset'];var _0x506e69=_0x3e362f?_0x1b23d9[_0x7ed2('0xc')]:_0x38d82a[_0x7ed2('0x9')]+_0x38d82a[_0x7ed2('0xb')];var _0x384d31;if(_0x506e69>=_0x3e8c53){_0x506e69=_0x3e8c53;_0x384d31=0xc8;}else{_0x384d31=0xce;}_0x26bea2[_0x7ed2('0x7')](_0x384d31);return _0x26bea2[_0x7ed2('0xd')](_0x7ed2('0xe'),_0x445ff7+'-'+_0x506e69+'/'+_0x3e8c53)[_0x7ed2('0x8')](_0x1b23d9);}return null;};}function saveUpdates(_0x33ac72){return function(_0x4a2842){if(_0x4a2842){return _0x4a2842['update'](_0x33ac72)['then'](function(_0xd96d51){return _0xd96d51;});}return null;};}function removeEntity(_0xeb2003){return function(_0x1920d8){if(_0x1920d8){return _0x1920d8[_0x7ed2('0xf')]()[_0x7ed2('0x10')](function(){_0xeb2003[_0x7ed2('0x7')](0xcc)[_0x7ed2('0x11')]();});}};}function handleEntityNotFound(_0x5b7d69){return function(_0x55fce7){if(!_0x55fce7){_0x5b7d69[_0x7ed2('0x12')](0x194);}return _0x55fce7;};}function handleError(_0x4676c1,_0x3da3c9){_0x3da3c9=_0x3da3c9||0x1f4;return function(_0x10bf53){logger['error'](_0x10bf53[_0x7ed2('0x13')]);if(_0x10bf53[_0x7ed2('0x14')]){delete _0x10bf53[_0x7ed2('0x14')];}_0x4676c1[_0x7ed2('0x7')](_0x3da3c9)[_0x7ed2('0x15')](_0x10bf53);};}exports[_0x7ed2('0x16')]=function(_0x2cb9f4,_0x3c3760){var _0x508d2a={},_0x5457f2={},_0x510e54={'count':0x0,'rows':[]};var _0x3b2e20=_[_0x7ed2('0x17')](db['Dynamics365Account'][_0x7ed2('0x18')],function(_0x4fcbc5){return{'name':_0x4fcbc5[_0x7ed2('0x19')],'type':_0x4fcbc5[_0x7ed2('0x1a')]['key']};});_0x5457f2[_0x7ed2('0x1b')]=_[_0x7ed2('0x17')](_0x3b2e20,_0x7ed2('0x14'));_0x5457f2[_0x7ed2('0x1c')]=_[_0x7ed2('0x1d')](_0x2cb9f4['query']);_0x5457f2['filters']=_[_0x7ed2('0x1e')](_0x5457f2[_0x7ed2('0x1b')],_0x5457f2[_0x7ed2('0x1c')]);_0x508d2a[_0x7ed2('0x1f')]=_[_0x7ed2('0x1e')](_0x5457f2[_0x7ed2('0x1b')],qs['fields'](_0x2cb9f4[_0x7ed2('0x1c')]['fields']));_0x508d2a[_0x7ed2('0x1f')]=_0x508d2a[_0x7ed2('0x1f')][_0x7ed2('0x20')]?_0x508d2a['attributes']:_0x5457f2[_0x7ed2('0x1b')];if(!_0x2cb9f4['query'][_0x7ed2('0x21')](_0x7ed2('0x22'))){_0x508d2a[_0x7ed2('0xb')]=qs[_0x7ed2('0xb')](_0x2cb9f4['query']['limit']);_0x508d2a['offset']=qs[_0x7ed2('0x9')](_0x2cb9f4[_0x7ed2('0x1c')][_0x7ed2('0x9')]);}_0x508d2a[_0x7ed2('0x23')]=qs['sort'](_0x2cb9f4[_0x7ed2('0x1c')][_0x7ed2('0x24')]);_0x508d2a[_0x7ed2('0x25')]=qs[_0x7ed2('0x26')](_['pick'](_0x2cb9f4[_0x7ed2('0x1c')],_0x5457f2[_0x7ed2('0x26')]),_0x3b2e20);if(_0x2cb9f4['query'][_0x7ed2('0x27')]){_0x508d2a[_0x7ed2('0x25')]=_['merge'](_0x508d2a['where'],{'$or':_[_0x7ed2('0x17')](_0x3b2e20,function(_0x2775f6){if(_0x2775f6[_0x7ed2('0x1a')]!==_0x7ed2('0x28')){var _0x720e36={};_0x720e36[_0x2775f6['name']]={'$like':'%'+_0x2cb9f4[_0x7ed2('0x1c')][_0x7ed2('0x27')]+'%'};return _0x720e36;}})});}_0x508d2a=_[_0x7ed2('0x29')]({},_0x508d2a,_0x2cb9f4[_0x7ed2('0x2a')]);var _0x11c365={'where':_0x508d2a[_0x7ed2('0x25')]};return db['Dynamics365Account'][_0x7ed2('0xc')](_0x11c365)[_0x7ed2('0x10')](function(_0x572ccf){_0x510e54[_0x7ed2('0xc')]=_0x572ccf;if(_0x2cb9f4[_0x7ed2('0x1c')]['includeAll']){_0x508d2a[_0x7ed2('0x2b')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x7ed2('0x2c')](_0x508d2a);})[_0x7ed2('0x10')](function(_0x4cc0a5){_0x510e54[_0x7ed2('0x2d')]=_0x4cc0a5;return _0x510e54;})[_0x7ed2('0x10')](respondWithFilteredResult(_0x3c3760,_0x508d2a))['catch'](handleError(_0x3c3760,null));};exports[_0x7ed2('0x2e')]=function(_0x387ad6,_0x12712b){var _0x397cd2={'raw':![],'where':{'id':_0x387ad6[_0x7ed2('0x2f')]['id']}},_0x1efced={};_0x1efced['model']=_[_0x7ed2('0x1d')](db[_0x7ed2('0x30')][_0x7ed2('0x18')]);_0x1efced[_0x7ed2('0x1c')]=_[_0x7ed2('0x1d')](_0x387ad6[_0x7ed2('0x1c')]);_0x1efced[_0x7ed2('0x26')]=_[_0x7ed2('0x1e')](_0x1efced[_0x7ed2('0x1b')],_0x1efced[_0x7ed2('0x1c')]);_0x397cd2[_0x7ed2('0x1f')]=_[_0x7ed2('0x1e')](_0x1efced[_0x7ed2('0x1b')],qs[_0x7ed2('0x31')](_0x387ad6[_0x7ed2('0x1c')][_0x7ed2('0x31')]));_0x397cd2[_0x7ed2('0x1f')]=_0x397cd2['attributes']['length']?_0x397cd2[_0x7ed2('0x1f')]:_0x1efced[_0x7ed2('0x1b')];if(_0x387ad6[_0x7ed2('0x1c')][_0x7ed2('0x32')]){_0x397cd2[_0x7ed2('0x2b')]=[{'all':!![]}];}_0x397cd2=_[_0x7ed2('0x29')]({},_0x397cd2,_0x387ad6[_0x7ed2('0x2a')]);return db[_0x7ed2('0x30')][_0x7ed2('0x33')](_0x397cd2)[_0x7ed2('0x10')](handleEntityNotFound(_0x12712b,null))[_0x7ed2('0x10')](respondWithResult(_0x12712b,null))['catch'](handleError(_0x12712b,null));};exports[_0x7ed2('0x34')]=function(_0x2a197f,_0x372a70){return db['Dynamics365Account'][_0x7ed2('0x34')](_0x2a197f[_0x7ed2('0x35')],{})[_0x7ed2('0x10')](respondWithResult(_0x372a70,0xc9))[_0x7ed2('0x36')](handleError(_0x372a70,null));};exports['update']=function(_0x8583df,_0x3ea897){if(_0x8583df[_0x7ed2('0x35')]['id']){delete _0x8583df[_0x7ed2('0x35')]['id'];}return db[_0x7ed2('0x30')][_0x7ed2('0x33')]({'where':{'id':_0x8583df[_0x7ed2('0x2f')]['id']}})[_0x7ed2('0x10')](handleEntityNotFound(_0x3ea897,null))['then'](saveUpdates(_0x8583df[_0x7ed2('0x35')],null))[_0x7ed2('0x10')](respondWithResult(_0x3ea897,null))[_0x7ed2('0x36')](handleError(_0x3ea897,null));};exports[_0x7ed2('0xf')]=function(_0x260bba,_0x56faa6){return db['Dynamics365Account'][_0x7ed2('0x33')]({'where':{'id':_0x260bba['params']['id']}})[_0x7ed2('0x10')](handleEntityNotFound(_0x56faa6,null))[_0x7ed2('0x10')](removeEntity(_0x56faa6,null))['catch'](handleError(_0x56faa6,null));};exports[_0x7ed2('0x37')]=function(_0x122a85,_0x479f00){var _0x15bb05={};var _0x1b4cbd={};var _0x5d5fbf;var _0x5b2fe2;return db[_0x7ed2('0x30')]['findOne']({'where':{'id':_0x122a85[_0x7ed2('0x2f')]['id']}})[_0x7ed2('0x10')](handleEntityNotFound(_0x479f00,null))['then'](function(_0x30acd0){if(_0x30acd0){_0x5d5fbf=_0x30acd0;_0x1b4cbd[_0x7ed2('0x1b')]=_[_0x7ed2('0x1d')](db[_0x7ed2('0x38')][_0x7ed2('0x18')]);_0x1b4cbd[_0x7ed2('0x1c')]=_[_0x7ed2('0x1d')](_0x122a85[_0x7ed2('0x1c')]);_0x1b4cbd[_0x7ed2('0x26')]=_[_0x7ed2('0x1e')](_0x1b4cbd[_0x7ed2('0x1b')],_0x1b4cbd[_0x7ed2('0x1c')]);_0x15bb05[_0x7ed2('0x1f')]=_[_0x7ed2('0x1e')](_0x1b4cbd['model'],qs['fields'](_0x122a85['query'][_0x7ed2('0x31')]));_0x15bb05[_0x7ed2('0x1f')]=_0x15bb05[_0x7ed2('0x1f')]['length']?_0x15bb05['attributes']:_0x1b4cbd[_0x7ed2('0x1b')];_0x15bb05['order']=qs[_0x7ed2('0x24')](_0x122a85[_0x7ed2('0x1c')]['sort']);_0x15bb05[_0x7ed2('0x25')]=qs['filters'](_['pick'](_0x122a85[_0x7ed2('0x1c')],_0x1b4cbd[_0x7ed2('0x26')]));if(_0x122a85['query'][_0x7ed2('0x27')]){_0x15bb05[_0x7ed2('0x25')]=_[_0x7ed2('0x29')](_0x15bb05[_0x7ed2('0x25')],{'$or':_[_0x7ed2('0x17')](_0x15bb05['attributes'],function(_0x371038){var _0x248dbf={};_0x248dbf[_0x371038]={'$like':'%'+_0x122a85[_0x7ed2('0x1c')][_0x7ed2('0x27')]+'%'};return _0x248dbf;})});}_0x15bb05=_[_0x7ed2('0x29')]({},_0x15bb05,_0x122a85['options']);return _0x5d5fbf['getConfigurations'](_0x15bb05);}})[_0x7ed2('0x10')](function(_0x105df5){if(_0x105df5){_0x5b2fe2=_0x105df5[_0x7ed2('0x20')];if(!_0x122a85[_0x7ed2('0x1c')][_0x7ed2('0x21')](_0x7ed2('0x22'))){_0x15bb05[_0x7ed2('0xb')]=qs[_0x7ed2('0xb')](_0x122a85['query'][_0x7ed2('0xb')]);_0x15bb05['offset']=qs['offset'](_0x122a85[_0x7ed2('0x1c')][_0x7ed2('0x9')]);}return _0x5d5fbf['getConfigurations'](_0x15bb05);}})['then'](function(_0x1caab3){if(_0x1caab3){return _0x1caab3?{'count':_0x5b2fe2,'rows':_0x1caab3}:null;}})[_0x7ed2('0x10')](respondWithResult(_0x479f00,null))['catch'](handleError(_0x479f00,null));};exports[_0x7ed2('0x39')]=function(_0x28b10d,_0x241831){if(_0x28b10d[_0x7ed2('0x35')]['id']){delete _0x28b10d[_0x7ed2('0x35')]['id'];}return db[_0x7ed2('0x30')][_0x7ed2('0x3a')]({'where':{'id':_0x28b10d[_0x7ed2('0x2f')]['id']}})[_0x7ed2('0x10')](handleEntityNotFound(_0x241831,null))[_0x7ed2('0x10')](function(_0x49b846){if(_0x49b846){_0x28b10d[_0x7ed2('0x35')]['AccountId']=_0x49b846['id'];_0x28b10d['body'][_0x7ed2('0x3b')]=integrations[_0x7ed2('0x3c')](_0x28b10d[_0x7ed2('0x35')][_0x7ed2('0x3d')],_0x28b10d[_0x7ed2('0x35')][_0x7ed2('0x1a')]);_0x28b10d['body'][_0x7ed2('0x3e')]=integrations['getDescriptions'](_0x28b10d['body']['channel'],_0x28b10d[_0x7ed2('0x35')][_0x7ed2('0x1a')]);return db[_0x7ed2('0x38')][_0x7ed2('0x34')](_0x28b10d['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x7ed2('0x3b')},{'model':db[_0x7ed2('0x3f')],'as':'Descriptions'}]});}return null;})[_0x7ed2('0x10')](respondWithResult(_0x241831,null))[_0x7ed2('0x36')](handleError(_0x241831,null));};function sanitizeRemoteUri(_0x1cce92){var _0x31aa9a=_0x1cce92[_0x7ed2('0x40')](-0x1);if(_0x31aa9a==='/')return _0x1cce92[_0x7ed2('0x41')](0x0,_0x1cce92['lastIndexOf'](_0x31aa9a));return _0x1cce92;}function getWebApiUrl(_0xf09329){return util[_0x7ed2('0x42')](_0x7ed2('0x43'),_0xf09329);}exports[_0x7ed2('0x44')]=function(_0x522adb,_0x34d415){var _0x2aaa26=_0x522adb[_0x7ed2('0x1c')][_0x7ed2('0x45')];var _0x19b607=_0x2aaa26===_0x7ed2('0x46')?_0x7ed2('0x47'):_0x7ed2('0x48');var _0x2cc47c='';var _0x38cd0d='';var _0x28e20a='';var _0x95479d='';var _0x46548c='';var _0xd013a9='';var _0x18a678='';var _0x249fe2='';var _0x729722=[_0x7ed2('0x49'),_0x7ed2('0x4a'),_0x7ed2('0x4b'),'ownerid',_0x7ed2('0x4c'),_0x7ed2('0x4d'),_0x7ed2('0x4e'),_0x7ed2('0x4f'),'directioncode',_0x7ed2('0x50')];var _0x281098=[_0x7ed2('0x51'),_0x7ed2('0x52'),_0x7ed2('0x53'),'billedserviceunits',_0x7ed2('0x54'),'contactidyominame',_0x7ed2('0x55'),_0x7ed2('0x56'),_0x7ed2('0x57'),'createdbyexternalpartyyominame',_0x7ed2('0x58'),_0x7ed2('0x59'),_0x7ed2('0x5a'),_0x7ed2('0x5b'),_0x7ed2('0x5c'),_0x7ed2('0x5d'),_0x7ed2('0x5e'),_0x7ed2('0x5f'),_0x7ed2('0x60'),_0x7ed2('0x61'),_0x7ed2('0x62'),'entityimage_url',_0x7ed2('0x63'),_0x7ed2('0x64'),_0x7ed2('0x65'),_0x7ed2('0x66'),'importsequencenumber',_0x7ed2('0x67'),_0x7ed2('0x68'),_0x7ed2('0x69'),_0x7ed2('0x6a'),_0x7ed2('0x6b'),_0x7ed2('0x6c'),'modifiedbyname',_0x7ed2('0x6d'),_0x7ed2('0x6e'),'modifiedonbehalfbyname',_0x7ed2('0x6f'),_0x7ed2('0x70'),_0x7ed2('0x71'),_0x7ed2('0x72'),'onholdtime',_0x7ed2('0x73'),_0x7ed2('0x74'),_0x7ed2('0x75'),_0x7ed2('0x76'),_0x7ed2('0x77'),_0x7ed2('0x78'),_0x7ed2('0x79'),_0x7ed2('0x7a'),_0x7ed2('0x7b'),_0x7ed2('0x7c'),_0x7ed2('0x7d'),_0x7ed2('0x7e'),'responseby',_0x7ed2('0x7f'),_0x7ed2('0x80'),_0x7ed2('0x81'),'slainvokedidname',_0x7ed2('0x82'),_0x7ed2('0x83'),_0x7ed2('0x84'),_0x7ed2('0x85'),'subjectidname','ticketnumber','timezoneruleversionnumber',_0x7ed2('0x86'),_0x7ed2('0x87'),'utcconversiontimezonecode',_0x7ed2('0x88')];var _0x96b3f0=_0x729722[_0x7ed2('0x89')](_0x281098);return db[_0x7ed2('0x30')][_0x7ed2('0x3a')]({'where':{'id':_0x522adb[_0x7ed2('0x2f')]['id']},'attributes':['id',_0x7ed2('0x8a'),'password',_0x7ed2('0x8b'),_0x7ed2('0x8c'),'clientId',_0x7ed2('0x8d'),_0x7ed2('0x8e')],'include':[{'model':db[_0x7ed2('0x8f')],'as':_0x7ed2('0x8f'),'attributes':['id',_0x7ed2('0x90'),_0x7ed2('0x91')]}]})[_0x7ed2('0x10')](handleEntityNotFound(_0x34d415,null))[_0x7ed2('0x10')](function(_0x292b20){if(_0x292b20){if(_0x292b20['modernAuthentication']){_0x292b20[_0x7ed2('0x92')]=_0x292b20[_0x7ed2('0x8f')][_0x7ed2('0x90')];_0x249fe2=sanitizeRemoteUri(_0x292b20[_0x7ed2('0x8f')][_0x7ed2('0x91')]);_0x18a678=getWebApiUrl(_0x249fe2);return _0x292b20;}_0x249fe2=sanitizeRemoteUri(_0x292b20[_0x7ed2('0x8b')]);_0x18a678=getWebApiUrl(_0x249fe2);var _0x3dd1a7={'method':_0x7ed2('0x93'),'uri':_0x7ed2('0x94')+_0x292b20[_0x7ed2('0x8c')]+_0x7ed2('0x95'),'form':{'client_id':_0x292b20['clientId'],'resource':_0x249fe2,'username':_0x292b20[_0x7ed2('0x8a')],'password':_0x292b20[_0x7ed2('0x96')],'grant_type':'password','client_secret':_0x292b20[_0x7ed2('0x8d')]},'json':!![]};return rp(_0x3dd1a7);}})['then'](function(_0x52cb5e){_0xd013a9=_0x52cb5e['access_token'];var _0x1dadc4={'method':'GET','uri':encodeURI(_0x18a678+_0x7ed2('0x97')+_0x19b607+'\x27'),'headers':{'Authorization':_0x7ed2('0x98')+_0xd013a9,'If-None-Match':null,'OData-Version':_0x7ed2('0x99')},'json':!![]};return rp(_0x1dadc4);})['then'](function(_0x1b7fa5){var _0x52f29c=_0x1b7fa5[_0x7ed2('0x9a')][0x0];var _0x229fe3=_0x52f29c[_0x7ed2('0x9b')];var _0x49b753={'method':_0x7ed2('0x9c'),'uri':_0x18a678+'EntityDefinitions('+_0x229fe3+_0x7ed2('0x9d'),'headers':{'Authorization':_0x7ed2('0x98')+_0xd013a9,'If-None-Match':null,'OData-Version':_0x7ed2('0x99')},'json':!![]};return rp(_0x49b753);})['then'](function(_0x324684){_0x2cc47c=_0x324684;_0x38cd0d=_0x2cc47c['Attributes'];_0x38cd0d=_[_0x7ed2('0x9e')](_0x38cd0d,function(_0x254036){return!_0x96b3f0[_0x7ed2('0x9f')](_0x254036[_0x7ed2('0xa0')]);});var _0x3ac394=[];var _0x5ddb9a=[];_0x38cd0d['forEach'](function(_0x27b83f){if(_0x27b83f['@odata.type']){var _0x8338fe=_0x27b83f[_0x7ed2('0xa1')][_0x7ed2('0x41')](_0x27b83f[_0x7ed2('0xa1')]['lastIndexOf']('.')+0x1);if(_0x8338fe==='PicklistAttributeMetadata'){_0x3ac394[_0x7ed2('0xa2')](getSelectList(_0x18a678,_0x2aaa26,_0x5ddb9a,_0x2cc47c['MetadataId'],_0x27b83f[_0x7ed2('0x9b')],_0xd013a9));}}});return Promise['all'](_0x3ac394);})[_0x7ed2('0x10')](function(_0xada27e){_0x28e20a=_0xada27e[0x0];var _0x45c0bd=[];var _0x1eb405=[];_0x38cd0d['forEach'](function(_0x1916a2){if(!_['isNil'](_0x1916a2[_0x7ed2('0xa1')])){var _0x5d0772=_0x1916a2[_0x7ed2('0xa1')]['substring'](_0x1916a2[_0x7ed2('0xa1')][_0x7ed2('0xa3')]('.')+0x1);if(_0x5d0772===_0x7ed2('0xa4')){_0x45c0bd['push'](getBooleanList(_0x18a678,_0x2aaa26,_0x1eb405,_0x2cc47c['MetadataId'],_0x1916a2[_0x7ed2('0x9b')],_0xd013a9));}}});return Promise[_0x7ed2('0xa5')](_0x45c0bd);})[_0x7ed2('0x10')](function(_0x39cc61){_0x95479d=_0x39cc61[0x0];var _0x5b0405=[];var _0x24edb8=[];_0x38cd0d[_0x7ed2('0xa6')](function(_0x5c9b25){if(_0x5c9b25[_0x7ed2('0xa1')]){var _0x45f9e8=_0x5c9b25[_0x7ed2('0xa1')][_0x7ed2('0x41')](_0x5c9b25[_0x7ed2('0xa1')][_0x7ed2('0xa3')]('.')+0x1);if(_0x45f9e8===_0x7ed2('0xa7')||_0x45f9e8===_0x7ed2('0xa8')||_0x45f9e8==='BigIntAttributeMetadata'||_0x45f9e8==='IntegerAttributeMetadata'||_0x45f9e8===_0x7ed2('0xa9')||_0x45f9e8==='DateTimeAttributeMetadata'||_0x45f9e8===_0x7ed2('0xaa')||_0x45f9e8===_0x7ed2('0xab')||_0x45f9e8===_0x7ed2('0xac')||_0x45f9e8===_0x7ed2('0xad')){_0x5b0405['push'](getInputList(_0x18a678,_0x2aaa26,_0x45f9e8,_0x24edb8,_0x2cc47c[_0x7ed2('0x9b')],_0x5c9b25[_0x7ed2('0x9b')],_0xd013a9));}}});return Promise[_0x7ed2('0xa5')](_0x5b0405);})[_0x7ed2('0x10')](function(_0x102119){_0x46548c=_0x102119[0x0];var _0x25c73e=_0x28e20a['concat'](_0x95479d)[_0x7ed2('0x89')](_0x46548c);var _0x324b83={'count':_0x25c73e['length'],'rows':_0x25c73e};return _0x324b83;})[_0x7ed2('0x10')](respondWithResult(_0x34d415,null))[_0x7ed2('0x36')](function(_0x3c6c00){var _0x3d667b=_0x522adb[_0x7ed2('0x1c')]['test']?0x1f4:_0x3c6c00['statusCode']||0x1f4;logger[_0x7ed2('0xae')](_0x3c6c00[_0x7ed2('0x13')]);delete _0x3c6c00[_0x7ed2('0x14')];if(_0x3d667b===0x191){_0x3d667b=0x190;}_0x34d415[_0x7ed2('0x7')](_0x3d667b)['send'](_0x522adb[_0x7ed2('0x1c')][_0x7ed2('0xaf')]?{'message':_0x7ed2('0xb0'),'statusCode':_0x3c6c00['statusCode']}:_0x3c6c00);});};function getSelectList(_0x5d2245,_0x11489b,_0x19a149,_0x202b14,_0x4267d2,_0x14454a){var _0x5426d3={'method':'GET','uri':_0x5d2245+_0x7ed2('0xb1')+_0x202b14+_0x7ed2('0xb2')+_0x4267d2+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x7ed2('0xb3'),'headers':{'Authorization':_0x7ed2('0x98')+_0x14454a,'If-None-Match':null,'OData-Version':_0x7ed2('0x99')},'json':!![]};return rp(_0x5426d3)[_0x7ed2('0x10')](function(_0x22cd36){var _0x19440c=[];var _0x37f1a4=_0x22cd36[_0x7ed2('0xb4')][_0x7ed2('0xb5')];_0x37f1a4['forEach'](function(_0x404ce9){_0x19440c['push']({'name':_0x404ce9['Label'][_0x7ed2('0xb6')]['Label'],'value':String(_0x404ce9[_0x7ed2('0xb7')])});});var _0x2128e0={'id':_0x11489b+'_'+_0x22cd36[_0x7ed2('0xa0')],'name':_0x22cd36['DisplayName'][_0x7ed2('0xb6')][_0x7ed2('0xb8')],'custom':![],'options':_0x19440c};_0x19a149[_0x7ed2('0xa2')](_0x2128e0);return _0x19a149;});}function getBooleanList(_0x448266,_0x46b81e,_0x5d721d,_0x1d08ad,_0x4afab2,_0x32641a){var _0x688bd6={'method':_0x7ed2('0x9c'),'uri':_0x448266+_0x7ed2('0xb1')+_0x1d08ad+')/Attributes('+_0x4afab2+_0x7ed2('0xb9'),'headers':{'Authorization':'Bearer\x20'+_0x32641a,'If-None-Match':null,'OData-Version':_0x7ed2('0x99')},'json':!![]};return rp(_0x688bd6)[_0x7ed2('0x10')](function(_0x183969){var _0x5a9870=[];_0x5a9870['push']({'name':_0x183969[_0x7ed2('0xb4')][_0x7ed2('0xba')][_0x7ed2('0xb8')]['UserLocalizedLabel'][_0x7ed2('0xb8')],'value':'true'},{'name':_0x183969[_0x7ed2('0xb4')][_0x7ed2('0xbb')][_0x7ed2('0xb8')][_0x7ed2('0xb6')][_0x7ed2('0xb8')],'value':_0x7ed2('0xbc')});var _0xb87d4c={'id':_0x46b81e+'_'+_0x183969[_0x7ed2('0xa0')],'name':_0x183969[_0x7ed2('0xbd')]['UserLocalizedLabel'][_0x7ed2('0xb8')],'custom':![],'options':_0x5a9870};_0x5d721d['push'](_0xb87d4c);return _0x5d721d;});}function getInputList(_0x552eab,_0xaafa09,_0x30f41e,_0x5a1c01,_0x54a278,_0x17ceb0,_0x4a2da3){var _0x531f5e={'method':_0x7ed2('0x9c'),'uri':_0x552eab+_0x7ed2('0xb1')+_0x54a278+_0x7ed2('0xb2')+_0x17ceb0+_0x7ed2('0xbe')+_0x30f41e+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x7ed2('0x98')+_0x4a2da3,'If-None-Match':null,'OData-Version':_0x7ed2('0x99')},'json':!![]};return rp(_0x531f5e)[_0x7ed2('0x10')](function(_0x6c461d){var _0x4111be={'id':_0xaafa09+'_'+_0x6c461d[_0x7ed2('0xa0')],'name':_0x6c461d['DisplayName'][_0x7ed2('0xb6')]?_0x6c461d[_0x7ed2('0xbd')][_0x7ed2('0xb6')]['Label']:_0x6c461d[_0x7ed2('0xa0')],'custom':![],'options':[]};_0x5a1c01['push'](_0x4111be);return _0x5a1c01;});} \ No newline at end of file +var _0x56a4=['phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyname','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data7','access_token','data5','POST','https://login.microsoftonline.com/','/oauth2/token','username','password','GET','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','@odata.type','substring','lastIndexOf','push','MetadataId','BooleanAttributeMetadata','all','forEach','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','stack',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','UserLocalizedLabel','Value','LogicalName','DisplayName','Label',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','util','lodash','../../components/parsers/qs','../../mysqldb','../../components/integrations/configuration','status','json','limit','count','offset','set','Content-Range','update','then','end','error','name','send','map','Dynamics365Account','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters','pick','filter','options','rows','catch','show','params','length','includeAll','include','merge','find','create','body','destroy','getConfigurations','findOne','Dynamics365Configuration','getSubjects','channel','Subjects','Descriptions','format','incident','PhoneCall','title','description','customerid','ownerid','subject'];(function(_0x151fa3,_0x310d5e){var _0x151f77=function(_0x3f8b3e){while(--_0x3f8b3e){_0x151fa3['push'](_0x151fa3['shift']());}};_0x151f77(++_0x310d5e);}(_0x56a4,0x73));var _0x456a=function(_0x159f8e,_0x258d08){_0x159f8e=_0x159f8e-0x0;var _0x458e17=_0x56a4[_0x159f8e];return _0x458e17;};'use strict';var rp=require('request-promise');var util=require(_0x456a('0x0'));var _=require(_0x456a('0x1'));var qs=require(_0x456a('0x2'));var logger=require('../../config/logger')('api');var db=require(_0x456a('0x3'))['db'];var integrations=require(_0x456a('0x4'));function respondWithResult(_0x27aedf,_0x83a845){_0x83a845=_0x83a845||0xc8;return function(_0x1d44b5){if(_0x1d44b5){return _0x27aedf[_0x456a('0x5')](_0x83a845)[_0x456a('0x6')](_0x1d44b5);}};}function respondWithFilteredResult(_0x3a2f76,_0x4f7f60){return function(_0x490cbc){if(_0x490cbc){var _0x13d017=typeof _0x4f7f60['offset']==='undefined'&&typeof _0x4f7f60[_0x456a('0x7')]==='undefined';var _0x317f3e=_0x490cbc[_0x456a('0x8')];var _0x177988=_0x13d017?0x0:_0x4f7f60[_0x456a('0x9')];var _0x12f945=_0x13d017?_0x490cbc['count']:_0x4f7f60[_0x456a('0x9')]+_0x4f7f60['limit'];var _0x59f11c;if(_0x12f945>=_0x317f3e){_0x12f945=_0x317f3e;_0x59f11c=0xc8;}else{_0x59f11c=0xce;}_0x3a2f76[_0x456a('0x5')](_0x59f11c);return _0x3a2f76[_0x456a('0xa')](_0x456a('0xb'),_0x177988+'-'+_0x12f945+'/'+_0x317f3e)[_0x456a('0x6')](_0x490cbc);}return null;};}function saveUpdates(_0x12fbca){return function(_0x152b83){if(_0x152b83){return _0x152b83[_0x456a('0xc')](_0x12fbca)['then'](function(_0x42477f){return _0x42477f;});}return null;};}function removeEntity(_0x4d4c05){return function(_0x3bd5b9){if(_0x3bd5b9){return _0x3bd5b9['destroy']()[_0x456a('0xd')](function(){_0x4d4c05['status'](0xcc)[_0x456a('0xe')]();});}};}function handleEntityNotFound(_0x56a209){return function(_0x2591a6){if(!_0x2591a6){_0x56a209['sendStatus'](0x194);}return _0x2591a6;};}function handleError(_0x1f6dee,_0x3178ec){_0x3178ec=_0x3178ec||0x1f4;return function(_0x280952){logger[_0x456a('0xf')](_0x280952['stack']);if(_0x280952['name']){delete _0x280952[_0x456a('0x10')];}_0x1f6dee[_0x456a('0x5')](_0x3178ec)[_0x456a('0x11')](_0x280952);};}exports['index']=function(_0x5aaf40,_0x20858c){var _0x12d8d3={},_0x38874a={},_0x5aff8b={'count':0x0,'rows':[]};var _0x202877=_[_0x456a('0x12')](db[_0x456a('0x13')]['rawAttributes'],function(_0x5f011a){return{'name':_0x5f011a['fieldName'],'type':_0x5f011a[_0x456a('0x14')]['key']};});_0x38874a[_0x456a('0x15')]=_['map'](_0x202877,_0x456a('0x10'));_0x38874a[_0x456a('0x16')]=_[_0x456a('0x17')](_0x5aaf40['query']);_0x38874a['filters']=_[_0x456a('0x18')](_0x38874a['model'],_0x38874a[_0x456a('0x16')]);_0x12d8d3[_0x456a('0x19')]=_['intersection'](_0x38874a[_0x456a('0x15')],qs[_0x456a('0x1a')](_0x5aaf40[_0x456a('0x16')][_0x456a('0x1a')]));_0x12d8d3[_0x456a('0x19')]=_0x12d8d3[_0x456a('0x19')]['length']?_0x12d8d3[_0x456a('0x19')]:_0x38874a['model'];if(!_0x5aaf40[_0x456a('0x16')][_0x456a('0x1b')]('nolimit')){_0x12d8d3[_0x456a('0x7')]=qs['limit'](_0x5aaf40[_0x456a('0x16')][_0x456a('0x7')]);_0x12d8d3[_0x456a('0x9')]=qs['offset'](_0x5aaf40[_0x456a('0x16')][_0x456a('0x9')]);}_0x12d8d3[_0x456a('0x1c')]=qs[_0x456a('0x1d')](_0x5aaf40[_0x456a('0x16')][_0x456a('0x1d')]);_0x12d8d3[_0x456a('0x1e')]=qs[_0x456a('0x1f')](_[_0x456a('0x20')](_0x5aaf40[_0x456a('0x16')],_0x38874a['filters']),_0x202877);if(_0x5aaf40[_0x456a('0x16')][_0x456a('0x21')]){_0x12d8d3[_0x456a('0x1e')]=_['merge'](_0x12d8d3[_0x456a('0x1e')],{'$or':_[_0x456a('0x12')](_0x202877,function(_0x40445d){if(_0x40445d[_0x456a('0x14')]!=='VIRTUAL'){var _0x3abe69={};_0x3abe69[_0x40445d[_0x456a('0x10')]]={'$like':'%'+_0x5aaf40[_0x456a('0x16')][_0x456a('0x21')]+'%'};return _0x3abe69;}})});}_0x12d8d3=_['merge']({},_0x12d8d3,_0x5aaf40[_0x456a('0x22')]);var _0x5ee2ce={'where':_0x12d8d3[_0x456a('0x1e')]};return db[_0x456a('0x13')][_0x456a('0x8')](_0x5ee2ce)['then'](function(_0x4e61d3){_0x5aff8b[_0x456a('0x8')]=_0x4e61d3;if(_0x5aaf40[_0x456a('0x16')]['includeAll']){_0x12d8d3['include']=[{'all':!![]}];}return db[_0x456a('0x13')]['findAll'](_0x12d8d3);})[_0x456a('0xd')](function(_0x5beee7){_0x5aff8b[_0x456a('0x23')]=_0x5beee7;return _0x5aff8b;})[_0x456a('0xd')](respondWithFilteredResult(_0x20858c,_0x12d8d3))[_0x456a('0x24')](handleError(_0x20858c,null));};exports[_0x456a('0x25')]=function(_0xe4b7a4,_0x9ade3f){var _0x13121d={'raw':![],'where':{'id':_0xe4b7a4[_0x456a('0x26')]['id']}},_0xaef477={};_0xaef477['model']=_['keys'](db['Dynamics365Account']['rawAttributes']);_0xaef477['query']=_[_0x456a('0x17')](_0xe4b7a4[_0x456a('0x16')]);_0xaef477[_0x456a('0x1f')]=_[_0x456a('0x18')](_0xaef477[_0x456a('0x15')],_0xaef477[_0x456a('0x16')]);_0x13121d[_0x456a('0x19')]=_[_0x456a('0x18')](_0xaef477['model'],qs[_0x456a('0x1a')](_0xe4b7a4[_0x456a('0x16')]['fields']));_0x13121d[_0x456a('0x19')]=_0x13121d[_0x456a('0x19')][_0x456a('0x27')]?_0x13121d['attributes']:_0xaef477[_0x456a('0x15')];if(_0xe4b7a4[_0x456a('0x16')][_0x456a('0x28')]){_0x13121d[_0x456a('0x29')]=[{'all':!![]}];}_0x13121d=_[_0x456a('0x2a')]({},_0x13121d,_0xe4b7a4[_0x456a('0x22')]);return db[_0x456a('0x13')][_0x456a('0x2b')](_0x13121d)['then'](handleEntityNotFound(_0x9ade3f,null))[_0x456a('0xd')](respondWithResult(_0x9ade3f,null))['catch'](handleError(_0x9ade3f,null));};exports[_0x456a('0x2c')]=function(_0x10e099,_0x2fd6ba){return db[_0x456a('0x13')][_0x456a('0x2c')](_0x10e099[_0x456a('0x2d')],{})[_0x456a('0xd')](respondWithResult(_0x2fd6ba,0xc9))[_0x456a('0x24')](handleError(_0x2fd6ba,null));};exports[_0x456a('0xc')]=function(_0x3c76c6,_0x4d0af9){if(_0x3c76c6['body']['id']){delete _0x3c76c6[_0x456a('0x2d')]['id'];}return db['Dynamics365Account'][_0x456a('0x2b')]({'where':{'id':_0x3c76c6[_0x456a('0x26')]['id']}})['then'](handleEntityNotFound(_0x4d0af9,null))['then'](saveUpdates(_0x3c76c6[_0x456a('0x2d')],null))['then'](respondWithResult(_0x4d0af9,null))[_0x456a('0x24')](handleError(_0x4d0af9,null));};exports[_0x456a('0x2e')]=function(_0x5494fa,_0x582031){return db[_0x456a('0x13')][_0x456a('0x2b')]({'where':{'id':_0x5494fa[_0x456a('0x26')]['id']}})[_0x456a('0xd')](handleEntityNotFound(_0x582031,null))[_0x456a('0xd')](removeEntity(_0x582031,null))[_0x456a('0x24')](handleError(_0x582031,null));};exports[_0x456a('0x2f')]=function(_0x4c3952,_0x2ac1b9){var _0x2dd34b={};var _0x1344b9={};var _0x2b304f;var _0x557e9b;return db[_0x456a('0x13')][_0x456a('0x30')]({'where':{'id':_0x4c3952[_0x456a('0x26')]['id']}})[_0x456a('0xd')](handleEntityNotFound(_0x2ac1b9,null))[_0x456a('0xd')](function(_0x5ce82f){if(_0x5ce82f){_0x2b304f=_0x5ce82f;_0x1344b9[_0x456a('0x15')]=_['keys'](db[_0x456a('0x31')]['rawAttributes']);_0x1344b9[_0x456a('0x16')]=_[_0x456a('0x17')](_0x4c3952['query']);_0x1344b9[_0x456a('0x1f')]=_[_0x456a('0x18')](_0x1344b9[_0x456a('0x15')],_0x1344b9['query']);_0x2dd34b[_0x456a('0x19')]=_[_0x456a('0x18')](_0x1344b9[_0x456a('0x15')],qs[_0x456a('0x1a')](_0x4c3952[_0x456a('0x16')][_0x456a('0x1a')]));_0x2dd34b[_0x456a('0x19')]=_0x2dd34b[_0x456a('0x19')][_0x456a('0x27')]?_0x2dd34b[_0x456a('0x19')]:_0x1344b9[_0x456a('0x15')];_0x2dd34b[_0x456a('0x1c')]=qs[_0x456a('0x1d')](_0x4c3952[_0x456a('0x16')][_0x456a('0x1d')]);_0x2dd34b[_0x456a('0x1e')]=qs[_0x456a('0x1f')](_[_0x456a('0x20')](_0x4c3952[_0x456a('0x16')],_0x1344b9[_0x456a('0x1f')]));if(_0x4c3952[_0x456a('0x16')][_0x456a('0x21')]){_0x2dd34b[_0x456a('0x1e')]=_[_0x456a('0x2a')](_0x2dd34b[_0x456a('0x1e')],{'$or':_[_0x456a('0x12')](_0x2dd34b[_0x456a('0x19')],function(_0x5799f0){var _0x4fae8b={};_0x4fae8b[_0x5799f0]={'$like':'%'+_0x4c3952[_0x456a('0x16')]['filter']+'%'};return _0x4fae8b;})});}_0x2dd34b=_[_0x456a('0x2a')]({},_0x2dd34b,_0x4c3952[_0x456a('0x22')]);return _0x2b304f[_0x456a('0x2f')](_0x2dd34b);}})[_0x456a('0xd')](function(_0xb5f207){if(_0xb5f207){_0x557e9b=_0xb5f207[_0x456a('0x27')];if(!_0x4c3952[_0x456a('0x16')][_0x456a('0x1b')]('nolimit')){_0x2dd34b['limit']=qs[_0x456a('0x7')](_0x4c3952['query'][_0x456a('0x7')]);_0x2dd34b[_0x456a('0x9')]=qs['offset'](_0x4c3952[_0x456a('0x16')][_0x456a('0x9')]);}return _0x2b304f['getConfigurations'](_0x2dd34b);}})[_0x456a('0xd')](function(_0x4163d0){if(_0x4163d0){return _0x4163d0?{'count':_0x557e9b,'rows':_0x4163d0}:null;}})[_0x456a('0xd')](respondWithResult(_0x2ac1b9,null))[_0x456a('0x24')](handleError(_0x2ac1b9,null));};exports['addConfiguration']=function(_0x2723b2,_0x39c545){if(_0x2723b2[_0x456a('0x2d')]['id']){delete _0x2723b2['body']['id'];}return db[_0x456a('0x13')][_0x456a('0x30')]({'where':{'id':_0x2723b2['params']['id']}})['then'](handleEntityNotFound(_0x39c545,null))[_0x456a('0xd')](function(_0x372af1){if(_0x372af1){_0x2723b2[_0x456a('0x2d')]['AccountId']=_0x372af1['id'];_0x2723b2[_0x456a('0x2d')]['Subjects']=integrations[_0x456a('0x32')](_0x2723b2['body'][_0x456a('0x33')],_0x2723b2[_0x456a('0x2d')][_0x456a('0x14')]);_0x2723b2[_0x456a('0x2d')]['Descriptions']=integrations['getDescriptions'](_0x2723b2[_0x456a('0x2d')][_0x456a('0x33')],_0x2723b2[_0x456a('0x2d')][_0x456a('0x14')]);return db[_0x456a('0x31')][_0x456a('0x2c')](_0x2723b2[_0x456a('0x2d')],{'include':[{'model':db['Dynamics365Field'],'as':_0x456a('0x34')},{'model':db['Dynamics365Field'],'as':_0x456a('0x35')}]});}return null;})[_0x456a('0xd')](respondWithResult(_0x39c545,null))[_0x456a('0x24')](handleError(_0x39c545,null));};function sanitizeRemoteUri(_0x382949){var _0x1764e8=_0x382949['slice'](-0x1);if(_0x1764e8==='/')return _0x382949['substring'](0x0,_0x382949['lastIndexOf'](_0x1764e8));return _0x382949;}function getWebApiUrl(_0x23ef25){return util[_0x456a('0x36')]('%s/api/data/v9.0/',_0x23ef25);}exports['getFields']=function(_0x33e06a,_0x429b7f){var _0x5a8a10=_0x33e06a[_0x456a('0x16')]['ticketType'];var _0xe2b27=_0x5a8a10===_0x456a('0x37')?'Incident':_0x456a('0x38');var _0x4ebae3='';var _0x13b7e6='';var _0x235796='';var _0x35e3c2='';var _0x787dec='';var _0xed024a='';var _0x457e9f='';var _0x518f66='';var _0x5ddfa7=[_0x456a('0x39'),_0x456a('0x3a'),_0x456a('0x3b'),_0x456a('0x3c'),'caseorigincode',_0x456a('0x3d'),_0x456a('0x3e'),_0x456a('0x3f'),_0x456a('0x40'),_0x456a('0x41')];var _0x1de103=['accountidname','accountidyominame','actualserviceunits',_0x456a('0x42'),_0x456a('0x43'),_0x456a('0x44'),'contractdetailidname',_0x456a('0x45'),_0x456a('0x46'),'createdbyexternalpartyyominame',_0x456a('0x47'),_0x456a('0x48'),'createdon',_0x456a('0x49'),_0x456a('0x4a'),_0x456a('0x4b'),'customeridtype','customeridyominame','emailaddress','entitlementidname',_0x456a('0x4c'),'entityimage_url',_0x456a('0x4d'),_0x456a('0x4e'),_0x456a('0x4f'),_0x456a('0x50'),'importsequencenumber',_0x456a('0x51'),_0x456a('0x52'),_0x456a('0x53'),_0x456a('0x54'),_0x456a('0x55'),'modifiedbyexternalpartyyominame',_0x456a('0x56'),_0x456a('0x57'),_0x456a('0x58'),_0x456a('0x59'),_0x456a('0x5a'),_0x456a('0x5b'),_0x456a('0x5c'),_0x456a('0x5d'),_0x456a('0x5e'),_0x456a('0x5f'),_0x456a('0x60'),'owneridtype','owneridyominame',_0x456a('0x61'),_0x456a('0x62'),_0x456a('0x63'),_0x456a('0x64'),_0x456a('0x65'),_0x456a('0x66'),_0x456a('0x67'),_0x456a('0x68'),_0x456a('0x69'),_0x456a('0x6a'),_0x456a('0x6b'),_0x456a('0x6c'),_0x456a('0x6d'),_0x456a('0x6e'),_0x456a('0x6f'),_0x456a('0x70'),_0x456a('0x71'),_0x456a('0x72'),_0x456a('0x73'),_0x456a('0x74'),_0x456a('0x75'),_0x456a('0x76'),'utcconversiontimezonecode',_0x456a('0x77')];var _0x2d733=_0x5ddfa7[_0x456a('0x78')](_0x1de103);return db[_0x456a('0x13')][_0x456a('0x30')]({'where':{'id':_0x33e06a['params']['id']},'attributes':['id','username','password',_0x456a('0x79'),_0x456a('0x7a'),'clientId',_0x456a('0x7b'),_0x456a('0x7c')],'include':[{'model':db[_0x456a('0x7d')],'as':_0x456a('0x7d'),'attributes':['id','data5',_0x456a('0x7e')]}]})[_0x456a('0xd')](handleEntityNotFound(_0x429b7f,null))[_0x456a('0xd')](function(_0x179df0){if(_0x179df0){if(_0x179df0[_0x456a('0x7c')]){_0x179df0[_0x456a('0x7f')]=_0x179df0[_0x456a('0x7d')][_0x456a('0x80')];_0x518f66=sanitizeRemoteUri(_0x179df0[_0x456a('0x7d')]['data7']);_0x457e9f=getWebApiUrl(_0x518f66);return _0x179df0;}_0x518f66=sanitizeRemoteUri(_0x179df0[_0x456a('0x79')]);_0x457e9f=getWebApiUrl(_0x518f66);var _0x7be1fe={'method':_0x456a('0x81'),'uri':_0x456a('0x82')+_0x179df0[_0x456a('0x7a')]+_0x456a('0x83'),'form':{'client_id':_0x179df0['clientId'],'resource':_0x518f66,'username':_0x179df0[_0x456a('0x84')],'password':_0x179df0[_0x456a('0x85')],'grant_type':_0x456a('0x85'),'client_secret':_0x179df0[_0x456a('0x7b')]},'json':!![]};return rp(_0x7be1fe);}})['then'](function(_0x249708){_0xed024a=_0x249708['access_token'];var _0x3357d5={'method':_0x456a('0x86'),'uri':encodeURI(_0x457e9f+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xe2b27+'\x27'),'headers':{'Authorization':_0x456a('0x87')+_0xed024a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3357d5);})['then'](function(_0x278397){var _0x6296bf=_0x278397[_0x456a('0x88')][0x0];var _0x146e79=_0x6296bf['MetadataId'];var _0x666ad6={'method':_0x456a('0x86'),'uri':_0x457e9f+_0x456a('0x89')+_0x146e79+_0x456a('0x8a'),'headers':{'Authorization':_0x456a('0x87')+_0xed024a,'If-None-Match':null,'OData-Version':_0x456a('0x8b')},'json':!![]};return rp(_0x666ad6);})[_0x456a('0xd')](function(_0x89dbc8){_0x4ebae3=_0x89dbc8;_0x13b7e6=_0x4ebae3[_0x456a('0x8c')];_0x13b7e6=_[_0x456a('0x8d')](_0x13b7e6,function(_0x1543b8){return!_0x2d733[_0x456a('0x8e')](_0x1543b8['LogicalName']);});var _0x17b290=[];var _0x352f2d=[];_0x13b7e6['forEach'](function(_0x5b3914){if(_0x5b3914[_0x456a('0x8f')]){var _0x19b5f5=_0x5b3914[_0x456a('0x8f')][_0x456a('0x90')](_0x5b3914['@odata.type'][_0x456a('0x91')]('.')+0x1);if(_0x19b5f5==='PicklistAttributeMetadata'){_0x17b290[_0x456a('0x92')](getSelectList(_0x457e9f,_0x5a8a10,_0x352f2d,_0x4ebae3[_0x456a('0x93')],_0x5b3914[_0x456a('0x93')],_0xed024a));}}});return Promise['all'](_0x17b290);})['then'](function(_0x1acba4){_0x235796=_0x1acba4[0x0];var _0x483e8d=[];var _0x3b0a73=[];_0x13b7e6['forEach'](function(_0x247907){if(!_['isNil'](_0x247907['@odata.type'])){var _0xc4cb24=_0x247907[_0x456a('0x8f')]['substring'](_0x247907[_0x456a('0x8f')][_0x456a('0x91')]('.')+0x1);if(_0xc4cb24===_0x456a('0x94')){_0x483e8d['push'](getBooleanList(_0x457e9f,_0x5a8a10,_0x3b0a73,_0x4ebae3[_0x456a('0x93')],_0x247907[_0x456a('0x93')],_0xed024a));}}});return Promise[_0x456a('0x95')](_0x483e8d);})[_0x456a('0xd')](function(_0x3744a9){_0x35e3c2=_0x3744a9[0x0];var _0x210e1e=[];var _0x396cb1=[];_0x13b7e6[_0x456a('0x96')](function(_0x2f98fa){if(_0x2f98fa['@odata.type']){var _0x336992=_0x2f98fa[_0x456a('0x8f')][_0x456a('0x90')](_0x2f98fa[_0x456a('0x8f')]['lastIndexOf']('.')+0x1);if(_0x336992===_0x456a('0x97')||_0x336992==='DoubleAttributeMetadata'||_0x336992===_0x456a('0x98')||_0x336992===_0x456a('0x99')||_0x336992===_0x456a('0x9a')||_0x336992===_0x456a('0x9b')||_0x336992===_0x456a('0x9c')||_0x336992===_0x456a('0x9d')||_0x336992===_0x456a('0x9e')||_0x336992===_0x456a('0x9f')){_0x210e1e[_0x456a('0x92')](getInputList(_0x457e9f,_0x5a8a10,_0x336992,_0x396cb1,_0x4ebae3[_0x456a('0x93')],_0x2f98fa[_0x456a('0x93')],_0xed024a));}}});return Promise[_0x456a('0x95')](_0x210e1e);})[_0x456a('0xd')](function(_0x255527){_0x787dec=_0x255527[0x0];var _0x34413b=_0x235796[_0x456a('0x78')](_0x35e3c2)['concat'](_0x787dec);var _0x1c15fc={'count':_0x34413b[_0x456a('0x27')],'rows':_0x34413b};return _0x1c15fc;})[_0x456a('0xd')](respondWithResult(_0x429b7f,null))[_0x456a('0x24')](function(_0x2fb9da){var _0x429904=_0x33e06a['query'][_0x456a('0xa0')]?0x1f4:_0x2fb9da[_0x456a('0xa1')]||0x1f4;logger[_0x456a('0xf')](_0x2fb9da[_0x456a('0xa2')]);delete _0x2fb9da['name'];if(_0x429904===0x191){_0x429904=0x190;}_0x429b7f[_0x456a('0x5')](_0x429904)[_0x456a('0x11')](_0x33e06a[_0x456a('0x16')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2fb9da[_0x456a('0xa1')]}:_0x2fb9da);});};function getSelectList(_0x1521ff,_0x46f108,_0x409a67,_0x5a41bd,_0x26e5f3,_0x5ebf86){var _0x74873d={'method':_0x456a('0x86'),'uri':_0x1521ff+_0x456a('0x89')+_0x5a41bd+_0x456a('0xa3')+_0x26e5f3+_0x456a('0xa4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x5ebf86,'If-None-Match':null,'OData-Version':_0x456a('0x8b')},'json':!![]};return rp(_0x74873d)[_0x456a('0xd')](function(_0x3f45aa){var _0x256a05=[];var _0x1a8f0b=_0x3f45aa[_0x456a('0xa5')][_0x456a('0xa6')];_0x1a8f0b[_0x456a('0x96')](function(_0x4de26c){_0x256a05[_0x456a('0x92')]({'name':_0x4de26c['Label'][_0x456a('0xa7')]['Label'],'value':String(_0x4de26c[_0x456a('0xa8')])});});var _0x14de88={'id':_0x46f108+'_'+_0x3f45aa[_0x456a('0xa9')],'name':_0x3f45aa[_0x456a('0xaa')][_0x456a('0xa7')][_0x456a('0xab')],'custom':![],'options':_0x256a05};_0x409a67[_0x456a('0x92')](_0x14de88);return _0x409a67;});}function getBooleanList(_0x2c0c91,_0x3ab0b4,_0x390053,_0x957136,_0x22424e,_0x22e9a2){var _0xfcb64d={'method':_0x456a('0x86'),'uri':_0x2c0c91+_0x456a('0x89')+_0x957136+')/Attributes('+_0x22424e+_0x456a('0xac'),'headers':{'Authorization':'Bearer\x20'+_0x22e9a2,'If-None-Match':null,'OData-Version':_0x456a('0x8b')},'json':!![]};return rp(_0xfcb64d)[_0x456a('0xd')](function(_0x16fc42){var _0x2c1f16=[];_0x2c1f16['push']({'name':_0x16fc42[_0x456a('0xa5')]['TrueOption']['Label'][_0x456a('0xa7')][_0x456a('0xab')],'value':_0x456a('0xad')},{'name':_0x16fc42[_0x456a('0xa5')][_0x456a('0xae')][_0x456a('0xab')][_0x456a('0xa7')]['Label'],'value':_0x456a('0xaf')});var _0x5474c9={'id':_0x3ab0b4+'_'+_0x16fc42[_0x456a('0xa9')],'name':_0x16fc42[_0x456a('0xaa')][_0x456a('0xa7')][_0x456a('0xab')],'custom':![],'options':_0x2c1f16};_0x390053[_0x456a('0x92')](_0x5474c9);return _0x390053;});}function getInputList(_0x23beb3,_0x2b9465,_0x3592f5,_0x44e3c3,_0x2f46a4,_0x54f86c,_0x212e66){var _0x2667a5={'method':'GET','uri':_0x23beb3+'EntityDefinitions('+_0x2f46a4+_0x456a('0xa3')+_0x54f86c+_0x456a('0xb0')+_0x3592f5+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x212e66,'If-None-Match':null,'OData-Version':_0x456a('0x8b')},'json':!![]};return rp(_0x2667a5)[_0x456a('0xd')](function(_0x46003b){var _0x12fa0a={'id':_0x2b9465+'_'+_0x46003b[_0x456a('0xa9')],'name':_0x46003b[_0x456a('0xaa')][_0x456a('0xa7')]?_0x46003b[_0x456a('0xaa')]['UserLocalizedLabel'][_0x456a('0xab')]:_0x46003b['LogicalName'],'custom':![],'options':[]};_0x44e3c3['push'](_0x12fa0a);return _0x44e3c3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c0fdc9c..ebce4db 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3a2424,_0x1afcc7){var _0x68fc05=function(_0x475dac){while(--_0x475dac){_0x3a2424['push'](_0x3a2424['shift']());}};_0x68fc05(++_0x1afcc7);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1304d3,_0x553cf0){var _0xcd99dd=function(_0x12cc06){while(--_0x12cc06){_0x1304d3['push'](_0x1304d3['shift']());}};_0xcd99dd(++_0x553cf0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 3d9052d..2562343 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 _0xdee1=['then','Dynamics365Account,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','Dynamics365Account','findAll','options','where','map','include','model','attributes','GetDynamics365Account','catch','ShowDynamics365Account','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5c6c64,_0x12d4cb){var _0x172174=function(_0x3f49c3){while(--_0x3f49c3){_0x5c6c64['push'](_0x5c6c64['shift']());}};_0x172174(++_0x12d4cb);}(_0xdee1,0x18c));var _0x1dee=function(_0x311c92,_0x9166a3){_0x311c92=_0x311c92-0x0;var _0x2914d0=_0xdee1[_0x311c92];return _0x2914d0;};'use strict';var _=require(_0x1dee('0x0'));var util=require(_0x1dee('0x1'));var moment=require(_0x1dee('0x2'));var BPromise=require(_0x1dee('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1dee('0x4'));var db=require(_0x1dee('0x5'))['db'];var utils=require(_0x1dee('0x6'));var logger=require(_0x1dee('0x7'))(_0x1dee('0x8'));var config=require(_0x1dee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1dee('0xa')][_0x1dee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15c8fa,_0x11704a,_0x5400d4){return new BPromise(function(_0x652329,_0x32e340){return client['request'](_0x15c8fa,_0x5400d4)[_0x1dee('0xc')](function(_0x448018){logger['info'](_0x1dee('0xd'),_0x11704a,'request\x20sent');logger[_0x1dee('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x11704a,_0x1dee('0xf'),JSON[_0x1dee('0x10')](_0x448018));if(_0x448018[_0x1dee('0x11')]){if(_0x448018[_0x1dee('0x11')][_0x1dee('0x12')]===0x1f4){logger[_0x1dee('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x11704a,_0x448018[_0x1dee('0x11')][_0x1dee('0x13')]);return _0x32e340(_0x448018[_0x1dee('0x11')]['message']);}logger[_0x1dee('0x11')](_0x1dee('0xd'),_0x11704a,_0x448018['error']['message']);return _0x652329(_0x448018[_0x1dee('0x11')][_0x1dee('0x13')]);}else{logger[_0x1dee('0x14')](_0x1dee('0xd'),_0x11704a,'request\x20sent');_0x652329(_0x448018['result']['message']);}})['catch'](function(_0x1489bf){logger[_0x1dee('0x11')](_0x1dee('0xd'),_0x11704a,_0x1489bf);_0x32e340(_0x1489bf);});});}exports['GetDynamics365Account']=function(_0xa8b04){var _0x53e19a=this;return new Promise(function(_0x4faa9e,_0x282746){return db[_0x1dee('0x15')][_0x1dee('0x16')]({'raw':_0xa8b04['options']?_0xa8b04['options']['raw']===undefined?!![]:![]:!![],'where':_0xa8b04[_0x1dee('0x17')]?_0xa8b04[_0x1dee('0x17')][_0x1dee('0x18')]||null:null,'attributes':_0xa8b04[_0x1dee('0x17')]?_0xa8b04[_0x1dee('0x17')]['attributes']||null:null,'limit':_0xa8b04[_0x1dee('0x17')]?_0xa8b04['options']['limit']||null:null,'include':_0xa8b04[_0x1dee('0x17')]?_0xa8b04[_0x1dee('0x17')]['include']?_[_0x1dee('0x19')](_0xa8b04['options'][_0x1dee('0x1a')],function(_0x5c18be){return{'model':db[_0x5c18be[_0x1dee('0x1b')]],'as':_0x5c18be['as'],'attributes':_0x5c18be[_0x1dee('0x1c')],'include':_0x5c18be[_0x1dee('0x1a')]?_[_0x1dee('0x19')](_0x5c18be[_0x1dee('0x1a')],function(_0x2452fa){return{'model':db[_0x2452fa[_0x1dee('0x1b')]],'as':_0x2452fa['as'],'attributes':_0x2452fa[_0x1dee('0x1c')],'include':_0x2452fa[_0x1dee('0x1a')]?_[_0x1dee('0x19')](_0x2452fa[_0x1dee('0x1a')],function(_0x45b917){return{'model':db[_0x45b917['model']],'as':_0x45b917['as'],'attributes':_0x45b917['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ddf58){logger[_0x1dee('0x14')]('GetDynamics365Account',_0xa8b04);logger['debug'](_0x1dee('0x1d'),_0xa8b04,JSON['stringify'](_0x1ddf58));_0x4faa9e(_0x1ddf58);})[_0x1dee('0x1e')](function(_0xdda33c){logger[_0x1dee('0x11')](_0x1dee('0x1d'),_0xdda33c[_0x1dee('0x13')],_0xa8b04);_0x282746(_0x53e19a[_0x1dee('0x11')](0x1f4,_0xdda33c[_0x1dee('0x13')]));});});};exports[_0x1dee('0x1f')]=function(_0x59a07d){var _0x33b8e7=this;return new Promise(function(_0x124bb0,_0x1bdfdf){return db[_0x1dee('0x15')][_0x1dee('0x20')]({'raw':_0x59a07d[_0x1dee('0x17')]?_0x59a07d[_0x1dee('0x17')][_0x1dee('0x21')]===undefined?!![]:![]:!![],'where':_0x59a07d[_0x1dee('0x17')]?_0x59a07d['options']['where']||null:null,'attributes':_0x59a07d['options']?_0x59a07d[_0x1dee('0x17')][_0x1dee('0x1c')]||null:null,'include':_0x59a07d[_0x1dee('0x17')]?_0x59a07d[_0x1dee('0x17')][_0x1dee('0x1a')]?_[_0x1dee('0x19')](_0x59a07d[_0x1dee('0x17')][_0x1dee('0x1a')],function(_0x194d15){return{'model':db[_0x194d15[_0x1dee('0x1b')]],'as':_0x194d15['as'],'attributes':_0x194d15[_0x1dee('0x1c')],'include':_0x194d15['include']?_[_0x1dee('0x19')](_0x194d15[_0x1dee('0x1a')],function(_0x4016b9){return{'model':db[_0x4016b9[_0x1dee('0x1b')]],'as':_0x4016b9['as'],'attributes':_0x4016b9[_0x1dee('0x1c')],'include':_0x4016b9[_0x1dee('0x1a')]?_[_0x1dee('0x19')](_0x4016b9[_0x1dee('0x1a')],function(_0x1b84a2){return{'model':db[_0x1b84a2[_0x1dee('0x1b')]],'as':_0x1b84a2['as'],'attributes':_0x1b84a2['attributes']};}):[]};}):[]};}):[]:[]})[_0x1dee('0xc')](function(_0x21a481){logger['info'](_0x1dee('0x1f'),_0x59a07d);logger[_0x1dee('0xe')](_0x1dee('0x1f'),_0x59a07d,JSON[_0x1dee('0x10')](_0x21a481));_0x124bb0(_0x21a481);})[_0x1dee('0x1e')](function(_0x75a95a){logger['error'](_0x1dee('0x1f'),_0x75a95a[_0x1dee('0x13')],_0x59a07d);_0x1bdfdf(_0x33b8e7[_0x1dee('0x11')](0x1f4,_0x75a95a[_0x1dee('0x13')]));});});}; \ No newline at end of file +var _0xc7df=['ShowDynamics365Account','debug','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','where'];(function(_0x3d8756,_0x23f0e3){var _0x2388a5=function(_0x459163){while(--_0x459163){_0x3d8756['push'](_0x3d8756['shift']());}};_0x2388a5(++_0x23f0e3);}(_0xc7df,0xf0));var _0xfc7d=function(_0x5b6b16,_0x49e87e){_0x5b6b16=_0x5b6b16-0x0;var _0x53dbcc=_0xc7df[_0x5b6b16];return _0x53dbcc;};'use strict';var _=require('lodash');var util=require(_0xfc7d('0x0'));var moment=require('moment');var BPromise=require(_0xfc7d('0x1'));var rs=require(_0xfc7d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc7d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfc7d('0x4'))(_0xfc7d('0x5'));var config=require(_0xfc7d('0x6'));var jayson=require(_0xfc7d('0x7'));var client=jayson[_0xfc7d('0x8')][_0xfc7d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17e50f,_0x311ce0,_0x362f9e){return new BPromise(function(_0x11edd2,_0x362d5e){return client[_0xfc7d('0xa')](_0x17e50f,_0x362f9e)[_0xfc7d('0xb')](function(_0x21e7b4){logger[_0xfc7d('0xc')](_0xfc7d('0xd'),_0x311ce0,_0xfc7d('0xe'));logger['debug'](_0xfc7d('0xf'),_0x311ce0,_0xfc7d('0xe'),JSON[_0xfc7d('0x10')](_0x21e7b4));if(_0x21e7b4[_0xfc7d('0x11')]){if(_0x21e7b4[_0xfc7d('0x11')][_0xfc7d('0x12')]===0x1f4){logger[_0xfc7d('0x11')](_0xfc7d('0xd'),_0x311ce0,_0x21e7b4[_0xfc7d('0x11')][_0xfc7d('0x13')]);return _0x362d5e(_0x21e7b4['error'][_0xfc7d('0x13')]);}logger[_0xfc7d('0x11')](_0xfc7d('0xd'),_0x311ce0,_0x21e7b4[_0xfc7d('0x11')][_0xfc7d('0x13')]);return _0x11edd2(_0x21e7b4[_0xfc7d('0x11')][_0xfc7d('0x13')]);}else{logger[_0xfc7d('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x311ce0,_0xfc7d('0xe'));_0x11edd2(_0x21e7b4[_0xfc7d('0x14')][_0xfc7d('0x13')]);}})[_0xfc7d('0x15')](function(_0x3e6583){logger[_0xfc7d('0x11')](_0xfc7d('0xd'),_0x311ce0,_0x3e6583);_0x362d5e(_0x3e6583);});});}exports['GetDynamics365Account']=function(_0x2af456){var _0x513c70=this;return new Promise(function(_0x49ec24,_0x4f3a04){return db[_0xfc7d('0x16')][_0xfc7d('0x17')]({'raw':_0x2af456[_0xfc7d('0x18')]?_0x2af456[_0xfc7d('0x18')][_0xfc7d('0x19')]===undefined?!![]:![]:!![],'where':_0x2af456[_0xfc7d('0x18')]?_0x2af456[_0xfc7d('0x18')]['where']||null:null,'attributes':_0x2af456['options']?_0x2af456['options'][_0xfc7d('0x1a')]||null:null,'limit':_0x2af456[_0xfc7d('0x18')]?_0x2af456[_0xfc7d('0x18')][_0xfc7d('0x1b')]||null:null,'include':_0x2af456[_0xfc7d('0x18')]?_0x2af456[_0xfc7d('0x18')][_0xfc7d('0x1c')]?_[_0xfc7d('0x1d')](_0x2af456['options'][_0xfc7d('0x1c')],function(_0x13b8ab){return{'model':db[_0x13b8ab['model']],'as':_0x13b8ab['as'],'attributes':_0x13b8ab['attributes'],'include':_0x13b8ab[_0xfc7d('0x1c')]?_[_0xfc7d('0x1d')](_0x13b8ab[_0xfc7d('0x1c')],function(_0x4da285){return{'model':db[_0x4da285['model']],'as':_0x4da285['as'],'attributes':_0x4da285[_0xfc7d('0x1a')],'include':_0x4da285['include']?_['map'](_0x4da285[_0xfc7d('0x1c')],function(_0x49bd4f){return{'model':db[_0x49bd4f[_0xfc7d('0x1e')]],'as':_0x49bd4f['as'],'attributes':_0x49bd4f[_0xfc7d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44efad){logger[_0xfc7d('0xc')]('GetDynamics365Account',_0x2af456);logger['debug']('GetDynamics365Account',_0x2af456,JSON[_0xfc7d('0x10')](_0x44efad));_0x49ec24(_0x44efad);})[_0xfc7d('0x15')](function(_0x4849a0){logger['error']('GetDynamics365Account',_0x4849a0[_0xfc7d('0x13')],_0x2af456);_0x4f3a04(_0x513c70[_0xfc7d('0x11')](0x1f4,_0x4849a0[_0xfc7d('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x1b70f2){var _0x4fcd5d=this;return new Promise(function(_0x593c93,_0x1b8fa9){return db['Dynamics365Account']['find']({'raw':_0x1b70f2['options']?_0x1b70f2['options'][_0xfc7d('0x19')]===undefined?!![]:![]:!![],'where':_0x1b70f2[_0xfc7d('0x18')]?_0x1b70f2['options'][_0xfc7d('0x1f')]||null:null,'attributes':_0x1b70f2[_0xfc7d('0x18')]?_0x1b70f2[_0xfc7d('0x18')][_0xfc7d('0x1a')]||null:null,'include':_0x1b70f2['options']?_0x1b70f2['options']['include']?_[_0xfc7d('0x1d')](_0x1b70f2[_0xfc7d('0x18')][_0xfc7d('0x1c')],function(_0x412824){return{'model':db[_0x412824[_0xfc7d('0x1e')]],'as':_0x412824['as'],'attributes':_0x412824[_0xfc7d('0x1a')],'include':_0x412824[_0xfc7d('0x1c')]?_[_0xfc7d('0x1d')](_0x412824['include'],function(_0x10da8d){return{'model':db[_0x10da8d[_0xfc7d('0x1e')]],'as':_0x10da8d['as'],'attributes':_0x10da8d['attributes'],'include':_0x10da8d[_0xfc7d('0x1c')]?_[_0xfc7d('0x1d')](_0x10da8d[_0xfc7d('0x1c')],function(_0x4e59a1){return{'model':db[_0x4e59a1['model']],'as':_0x4e59a1['as'],'attributes':_0x4e59a1[_0xfc7d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x161fa9){logger[_0xfc7d('0xc')](_0xfc7d('0x20'),_0x1b70f2);logger[_0xfc7d('0x21')](_0xfc7d('0x20'),_0x1b70f2,JSON[_0xfc7d('0x10')](_0x161fa9));_0x593c93(_0x161fa9);})[_0xfc7d('0x15')](function(_0x34318f){logger['error'](_0xfc7d('0x20'),_0x34318f[_0xfc7d('0x13')],_0x1b70f2);_0x1b8fa9(_0x4fcd5d[_0xfc7d('0x11')](0x1f4,_0x34318f['message']));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 4a2bf4d..e2defa7 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 _0x8889=['isAuthenticated','index','/:id','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x8889,0x1d9));var _0x9888=function(_0x22ae02,_0x3dd837){_0x22ae02=_0x22ae02-0x0;var _0x27e17e=_0x8889[_0x22ae02];return _0x27e17e;};'use strict';var multer=require(_0x9888('0x0'));var util=require(_0x9888('0x1'));var path=require(_0x9888('0x2'));var timeout=require(_0x9888('0x3'));var express=require(_0x9888('0x4'));var router=express[_0x9888('0x5')]();var fs_extra=require(_0x9888('0x6'));var auth=require(_0x9888('0x7'));var interaction=require(_0x9888('0x8'));var config=require('../../config/environment');var controller=require('./intDynamics365Configuration.controller');router[_0x9888('0x9')]('/',auth[_0x9888('0xa')](),controller[_0x9888('0xb')]);router['get'](_0x9888('0xc'),auth[_0x9888('0xa')](),controller['show']);router[_0x9888('0x9')](_0x9888('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x9888('0x9')](_0x9888('0xe'),auth[_0x9888('0xa')](),controller['getSubjects']);router[_0x9888('0x9')](_0x9888('0xf'),auth[_0x9888('0xa')](),controller[_0x9888('0x10')]);router[_0x9888('0x11')]('/',auth[_0x9888('0xa')](),controller[_0x9888('0x12')]);router[_0x9888('0x13')](_0x9888('0xc'),auth[_0x9888('0xa')](),controller[_0x9888('0x14')]);router['delete'](_0x9888('0xc'),auth[_0x9888('0xa')](),controller[_0x9888('0x15')]);module[_0x9888('0x16')]=router; \ No newline at end of file +var _0xe667=['create','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xf09968,_0x33e8d8){var _0x27f17f=function(_0x529d7c){while(--_0x529d7c){_0xf09968['push'](_0xf09968['shift']());}};_0x27f17f(++_0x33e8d8);}(_0xe667,0x17c));var _0x7e66=function(_0x8d0cc4,_0x1a9148){_0x8d0cc4=_0x8d0cc4-0x0;var _0x1e0afa=_0xe667[_0x8d0cc4];return _0x1e0afa;};'use strict';var multer=require('multer');var util=require(_0x7e66('0x0'));var path=require(_0x7e66('0x1'));var timeout=require(_0x7e66('0x2'));var express=require(_0x7e66('0x3'));var router=express[_0x7e66('0x4')]();var fs_extra=require(_0x7e66('0x5'));var auth=require(_0x7e66('0x6'));var interaction=require(_0x7e66('0x7'));var config=require(_0x7e66('0x8'));var controller=require(_0x7e66('0x9'));router[_0x7e66('0xa')]('/',auth[_0x7e66('0xb')](),controller[_0x7e66('0xc')]);router[_0x7e66('0xa')](_0x7e66('0xd'),auth[_0x7e66('0xb')](),controller[_0x7e66('0xe')]);router['get'](_0x7e66('0xf'),auth[_0x7e66('0xb')](),controller[_0x7e66('0x10')]);router[_0x7e66('0xa')](_0x7e66('0x11'),auth['isAuthenticated'](),controller[_0x7e66('0x12')]);router[_0x7e66('0xa')](_0x7e66('0x13'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x7e66('0xb')](),controller[_0x7e66('0x14')]);router['put']('/:id',auth[_0x7e66('0xb')](),controller[_0x7e66('0x15')]);router[_0x7e66('0x16')]('/:id',auth[_0x7e66('0xb')](),controller[_0x7e66('0x17')]);module[_0x7e66('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0439116..5632a3c 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 _0x15d9=['incident','contact','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x2ae2bc,_0x177514){var _0x53c290=function(_0x3ac4c0){while(--_0x3ac4c0){_0x2ae2bc['push'](_0x2ae2bc['shift']());}};_0x53c290(++_0x177514);}(_0x15d9,0xc0));var _0x915d=function(_0x472266,_0x13b9aa){_0x472266=_0x472266-0x0;var _0x5ed7ef=_0x15d9[_0x472266];return _0x5ed7ef;};'use strict';var Sequelize=require(_0x915d('0x0'));module[_0x915d('0x1')]={'name':{'type':Sequelize[_0x915d('0x2')]},'description':{'type':Sequelize[_0x915d('0x2')]},'ticketType':{'type':Sequelize[_0x915d('0x3')]('incident','phonecall'),'defaultValue':_0x915d('0x4')},'moduleCreate':{'type':Sequelize[_0x915d('0x3')](_0x915d('0x5'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x915d('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x915d('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x9728=['exports','STRING','ENUM','phonecall','incident','contact','nothing','BOOLEAN','sequelize'];(function(_0x346ac3,_0x5671a4){var _0x4dc9e5=function(_0x23da31){while(--_0x23da31){_0x346ac3['push'](_0x346ac3['shift']());}};_0x4dc9e5(++_0x5671a4);}(_0x9728,0x143));var _0x8972=function(_0x9b5db4,_0x2b8251){_0x9b5db4=_0x9b5db4-0x0;var _0x1cf4b7=_0x9728[_0x9b5db4];return _0x1cf4b7;};'use strict';var Sequelize=require(_0x8972('0x0'));module[_0x8972('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8972('0x2')]},'ticketType':{'type':Sequelize[_0x8972('0x3')]('incident',_0x8972('0x4')),'defaultValue':_0x8972('0x5')},'moduleCreate':{'type':Sequelize[_0x8972('0x3')](_0x8972('0x6'),_0x8972('0x7')),'defaultValue':_0x8972('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8972('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8972('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 68ce888..98ece1f 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 _0x8f0e=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','Dynamics365Configuration','type','key','model','query','keys','intersection','fields','attributes','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','rawAttributes','filters','include','find','create','body','getFields','findOne','Dynamics365Field','length','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','set'];(function(_0x1341a6,_0x23816a){var _0x37658e=function(_0xbe0a4d){while(--_0xbe0a4d){_0x1341a6['push'](_0x1341a6['shift']());}};_0x37658e(++_0x23816a);}(_0x8f0e,0x118));var _0xe8f0=function(_0x485255,_0x4c782b){_0x485255=_0x485255-0x0;var _0x5b84b4=_0x8f0e[_0x485255];return _0x5b84b4;};'use strict';var emlformat=require(_0xe8f0('0x0'));var rimraf=require(_0xe8f0('0x1'));var zipdir=require(_0xe8f0('0x2'));var jsonpatch=require(_0xe8f0('0x3'));var rp=require('request-promise');var moment=require(_0xe8f0('0x4'));var BPromise=require(_0xe8f0('0x5'));var Mustache=require('mustache');var util=require(_0xe8f0('0x6'));var path=require('path');var sox=require(_0xe8f0('0x7'));var csv=require(_0xe8f0('0x8'));var ejs=require(_0xe8f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe8f0('0xa'));var crypto=require('crypto');var jsforce=require(_0xe8f0('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe8f0('0xc'));var Papa=require('papaparse');var Redis=require(_0xe8f0('0xd'));var authService=require(_0xe8f0('0xe'));var qs=require(_0xe8f0('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8f0('0x10'));var logger=require(_0xe8f0('0x11'))(_0xe8f0('0x12'));var utils=require(_0xe8f0('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xe8f0('0x14'));var db=require(_0xe8f0('0x15'))['db'];function respondWithStatusCode(_0x2bc05f,_0x2b16bb){_0x2b16bb=_0x2b16bb||0xcc;return function(_0x155227){if(_0x155227){return _0x2bc05f['sendStatus'](_0x2b16bb);}return _0x2bc05f[_0xe8f0('0x16')](_0x2b16bb)['end']();};}function respondWithResult(_0x4e9327,_0x2e1136){_0x2e1136=_0x2e1136||0xc8;return function(_0x24e023){if(_0x24e023){return _0x4e9327[_0xe8f0('0x16')](_0x2e1136)[_0xe8f0('0x17')](_0x24e023);}};}function respondWithFilteredResult(_0x504a95,_0x494029){return function(_0x32032d){if(_0x32032d){var _0x405d69=typeof _0x494029[_0xe8f0('0x18')]===_0xe8f0('0x19')&&typeof _0x494029['limit']===_0xe8f0('0x19');var _0x46a51d=_0x32032d[_0xe8f0('0x1a')];var _0x395525=_0x405d69?0x0:_0x494029[_0xe8f0('0x18')];var _0x411c48=_0x405d69?_0x32032d[_0xe8f0('0x1a')]:_0x494029[_0xe8f0('0x18')]+_0x494029['limit'];var _0x30087f;if(_0x411c48>=_0x46a51d){_0x411c48=_0x46a51d;_0x30087f=0xc8;}else{_0x30087f=0xce;}_0x504a95[_0xe8f0('0x16')](_0x30087f);return _0x504a95[_0xe8f0('0x1b')](_0xe8f0('0x1c'),_0x395525+'-'+_0x411c48+'/'+_0x46a51d)[_0xe8f0('0x17')](_0x32032d);}return null;};}function patchUpdates(_0x56c51f){return function(_0x3ee3aa){try{jsonpatch[_0xe8f0('0x1d')](_0x3ee3aa,_0x56c51f,!![]);}catch(_0x2dd50d){return BPromise[_0xe8f0('0x1e')](_0x2dd50d);}return _0x3ee3aa[_0xe8f0('0x1f')]();};}function saveUpdates(_0x1fba9b,_0x2e4be4){return function(_0x3d0a22){if(_0x3d0a22){return _0x3d0a22[_0xe8f0('0x20')](_0x1fba9b)[_0xe8f0('0x21')](function(_0x41365e){return _0x41365e;});}return null;};}function removeEntity(_0x937086,_0x374bd4){return function(_0x540bd1){if(_0x540bd1){return _0x540bd1[_0xe8f0('0x22')]()['then'](function(){_0x937086['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2791b9,_0x3a6bc4){return function(_0x56e214){if(!_0x56e214){_0x2791b9[_0xe8f0('0x23')](0x194);}return _0x56e214;};}function handleError(_0x4f16ff,_0x1d9f52){_0x1d9f52=_0x1d9f52||0x1f4;return function(_0x31e382){logger[_0xe8f0('0x24')](_0x31e382['stack']);if(_0x31e382[_0xe8f0('0x25')]){delete _0x31e382[_0xe8f0('0x25')];}_0x4f16ff[_0xe8f0('0x16')](_0x1d9f52)[_0xe8f0('0x26')](_0x31e382);};}exports[_0xe8f0('0x27')]=function(_0x3fca1e,_0x3e06dd){var _0x82cf70={},_0x45aea5={},_0x50f1ac={'count':0x0,'rows':[]};var _0x48f761=_[_0xe8f0('0x28')](db[_0xe8f0('0x29')]['rawAttributes'],function(_0x4f816f){return{'name':_0x4f816f['fieldName'],'type':_0x4f816f[_0xe8f0('0x2a')][_0xe8f0('0x2b')]};});_0x45aea5[_0xe8f0('0x2c')]=_[_0xe8f0('0x28')](_0x48f761,'name');_0x45aea5[_0xe8f0('0x2d')]=_[_0xe8f0('0x2e')](_0x3fca1e[_0xe8f0('0x2d')]);_0x45aea5['filters']=_[_0xe8f0('0x2f')](_0x45aea5[_0xe8f0('0x2c')],_0x45aea5[_0xe8f0('0x2d')]);_0x82cf70['attributes']=_['intersection'](_0x45aea5[_0xe8f0('0x2c')],qs['fields'](_0x3fca1e[_0xe8f0('0x2d')][_0xe8f0('0x30')]));_0x82cf70[_0xe8f0('0x31')]=_0x82cf70['attributes']['length']?_0x82cf70[_0xe8f0('0x31')]:_0x45aea5['model'];if(!_0x3fca1e['query']['hasOwnProperty'](_0xe8f0('0x32'))){_0x82cf70['limit']=qs[_0xe8f0('0x33')](_0x3fca1e['query'][_0xe8f0('0x33')]);_0x82cf70[_0xe8f0('0x18')]=qs[_0xe8f0('0x18')](_0x3fca1e[_0xe8f0('0x2d')][_0xe8f0('0x18')]);}_0x82cf70[_0xe8f0('0x34')]=qs[_0xe8f0('0x35')](_0x3fca1e['query'][_0xe8f0('0x35')]);_0x82cf70[_0xe8f0('0x36')]=qs['filters'](_[_0xe8f0('0x37')](_0x3fca1e['query'],_0x45aea5['filters']),_0x48f761);if(_0x3fca1e[_0xe8f0('0x2d')][_0xe8f0('0x38')]){_0x82cf70[_0xe8f0('0x36')]=_[_0xe8f0('0x39')](_0x82cf70[_0xe8f0('0x36')],{'$or':_['map'](_0x48f761,function(_0x3044b4){if(_0x3044b4['type']!=='VIRTUAL'){var _0x17874a={};_0x17874a[_0x3044b4[_0xe8f0('0x25')]]={'$like':'%'+_0x3fca1e[_0xe8f0('0x2d')][_0xe8f0('0x38')]+'%'};return _0x17874a;}})});}_0x82cf70=_['merge']({},_0x82cf70,_0x3fca1e[_0xe8f0('0x3a')]);var _0x37b951={'where':_0x82cf70[_0xe8f0('0x36')]};return db['Dynamics365Configuration']['count'](_0x37b951)[_0xe8f0('0x21')](function(_0x49218a){_0x50f1ac['count']=_0x49218a;if(_0x3fca1e[_0xe8f0('0x2d')][_0xe8f0('0x3b')]){_0x82cf70['include']=[{'all':!![]}];}return db[_0xe8f0('0x29')][_0xe8f0('0x3c')](_0x82cf70);})['then'](function(_0x5ae8a1){_0x50f1ac['rows']=_0x5ae8a1;return _0x50f1ac;})[_0xe8f0('0x21')](respondWithFilteredResult(_0x3e06dd,_0x82cf70))[_0xe8f0('0x3d')](handleError(_0x3e06dd,null));};exports[_0xe8f0('0x3e')]=function(_0x3344fb,_0x435936){var _0x3c3a49={'raw':![],'where':{'id':_0x3344fb[_0xe8f0('0x3f')]['id']}},_0x36edd5={};_0x36edd5['model']=_['keys'](db[_0xe8f0('0x29')][_0xe8f0('0x40')]);_0x36edd5[_0xe8f0('0x2d')]=_[_0xe8f0('0x2e')](_0x3344fb[_0xe8f0('0x2d')]);_0x36edd5[_0xe8f0('0x41')]=_[_0xe8f0('0x2f')](_0x36edd5[_0xe8f0('0x2c')],_0x36edd5[_0xe8f0('0x2d')]);_0x3c3a49[_0xe8f0('0x31')]=_[_0xe8f0('0x2f')](_0x36edd5['model'],qs[_0xe8f0('0x30')](_0x3344fb[_0xe8f0('0x2d')][_0xe8f0('0x30')]));_0x3c3a49[_0xe8f0('0x31')]=_0x3c3a49[_0xe8f0('0x31')]['length']?_0x3c3a49[_0xe8f0('0x31')]:_0x36edd5[_0xe8f0('0x2c')];if(_0x3344fb[_0xe8f0('0x2d')][_0xe8f0('0x3b')]){_0x3c3a49[_0xe8f0('0x42')]=[{'all':!![]}];}_0x3c3a49=_['merge']({},_0x3c3a49,_0x3344fb[_0xe8f0('0x3a')]);return db[_0xe8f0('0x29')][_0xe8f0('0x43')](_0x3c3a49)[_0xe8f0('0x21')](handleEntityNotFound(_0x435936,null))[_0xe8f0('0x21')](respondWithResult(_0x435936,null))[_0xe8f0('0x3d')](handleError(_0x435936,null));};exports['create']=function(_0x526691,_0x258833){return db['Dynamics365Configuration'][_0xe8f0('0x44')](_0x526691[_0xe8f0('0x45')],{})[_0xe8f0('0x21')](respondWithResult(_0x258833,0xc9))[_0xe8f0('0x3d')](handleError(_0x258833,null));};exports[_0xe8f0('0x20')]=function(_0x527c4d,_0xd15f5){if(_0x527c4d[_0xe8f0('0x45')]['id']){delete _0x527c4d[_0xe8f0('0x45')]['id'];}return db[_0xe8f0('0x29')][_0xe8f0('0x43')]({'where':{'id':_0x527c4d[_0xe8f0('0x3f')]['id']}})[_0xe8f0('0x21')](handleEntityNotFound(_0xd15f5,null))[_0xe8f0('0x21')](saveUpdates(_0x527c4d[_0xe8f0('0x45')],null))[_0xe8f0('0x21')](respondWithResult(_0xd15f5,null))[_0xe8f0('0x3d')](handleError(_0xd15f5,null));};exports['destroy']=function(_0x28e055,_0x41046f){return db[_0xe8f0('0x29')][_0xe8f0('0x43')]({'where':{'id':_0x28e055[_0xe8f0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x41046f,null))[_0xe8f0('0x21')](removeEntity(_0x41046f,null))[_0xe8f0('0x3d')](handleError(_0x41046f,null));};exports[_0xe8f0('0x46')]=function(_0x144a6b,_0x4c6629,_0x1c93ef){var _0x3af676={};var _0x56a9e6={};var _0x2e9493;var _0x2ef01d;return db[_0xe8f0('0x29')][_0xe8f0('0x47')]({'where':{'id':_0x144a6b[_0xe8f0('0x3f')]['id']}})[_0xe8f0('0x21')](handleEntityNotFound(_0x4c6629,null))[_0xe8f0('0x21')](function(_0x2293d3){if(_0x2293d3){_0x2e9493=_0x2293d3;_0x56a9e6[_0xe8f0('0x2c')]=_[_0xe8f0('0x2e')](db[_0xe8f0('0x48')][_0xe8f0('0x40')]);_0x56a9e6[_0xe8f0('0x2d')]=_[_0xe8f0('0x2e')](_0x144a6b[_0xe8f0('0x2d')]);_0x56a9e6[_0xe8f0('0x41')]=_['intersection'](_0x56a9e6[_0xe8f0('0x2c')],_0x56a9e6['query']);_0x3af676['attributes']=_[_0xe8f0('0x2f')](_0x56a9e6[_0xe8f0('0x2c')],qs[_0xe8f0('0x30')](_0x144a6b[_0xe8f0('0x2d')][_0xe8f0('0x30')]));_0x3af676[_0xe8f0('0x31')]=_0x3af676['attributes'][_0xe8f0('0x49')]?_0x3af676[_0xe8f0('0x31')]:_0x56a9e6[_0xe8f0('0x2c')];_0x3af676[_0xe8f0('0x34')]=qs[_0xe8f0('0x35')](_0x144a6b[_0xe8f0('0x2d')][_0xe8f0('0x35')]);_0x3af676[_0xe8f0('0x36')]=qs[_0xe8f0('0x41')](_[_0xe8f0('0x37')](_0x144a6b[_0xe8f0('0x2d')],_0x56a9e6[_0xe8f0('0x41')]));if(_0x144a6b[_0xe8f0('0x2d')][_0xe8f0('0x38')]){_0x3af676[_0xe8f0('0x36')]=_[_0xe8f0('0x39')](_0x3af676[_0xe8f0('0x36')],{'$or':_[_0xe8f0('0x28')](_0x3af676[_0xe8f0('0x31')],function(_0x269014){var _0x3d0001={};_0x3d0001[_0x269014]={'$like':'%'+_0x144a6b['query'][_0xe8f0('0x38')]+'%'};return _0x3d0001;})});}_0x3af676=_['merge']({},_0x3af676,_0x144a6b[_0xe8f0('0x3a')]);return _0x2e9493[_0xe8f0('0x46')](_0x3af676);}})['then'](function(_0x5d40e8){if(_0x5d40e8){_0x2ef01d=_0x5d40e8[_0xe8f0('0x49')];if(!_0x144a6b[_0xe8f0('0x2d')][_0xe8f0('0x4a')](_0xe8f0('0x32'))){_0x3af676[_0xe8f0('0x33')]=qs[_0xe8f0('0x33')](_0x144a6b['query'][_0xe8f0('0x33')]);_0x3af676[_0xe8f0('0x18')]=qs[_0xe8f0('0x18')](_0x144a6b[_0xe8f0('0x2d')][_0xe8f0('0x18')]);}return _0x2e9493['getFields'](_0x3af676);}})[_0xe8f0('0x21')](function(_0x5bd180){if(_0x5bd180){return _0x5bd180?{'count':_0x2ef01d,'rows':_0x5bd180}:null;}})['then'](respondWithResult(_0x4c6629,null))[_0xe8f0('0x3d')](handleError(_0x4c6629,null));};exports[_0xe8f0('0x4b')]=function(_0x5b44aa,_0x282e72,_0x1647c0){var _0x364da9={};var _0x50e78d={};var _0x11c244;var _0x50e39b;return db[_0xe8f0('0x29')][_0xe8f0('0x47')]({'where':{'id':_0x5b44aa[_0xe8f0('0x3f')]['id']}})[_0xe8f0('0x21')](handleEntityNotFound(_0x282e72,null))[_0xe8f0('0x21')](function(_0x447bb2){if(_0x447bb2){_0x11c244=_0x447bb2;_0x50e78d['model']=_[_0xe8f0('0x2e')](db[_0xe8f0('0x48')][_0xe8f0('0x40')]);_0x50e78d[_0xe8f0('0x2d')]=_['keys'](_0x5b44aa[_0xe8f0('0x2d')]);_0x50e78d[_0xe8f0('0x41')]=_[_0xe8f0('0x2f')](_0x50e78d['model'],_0x50e78d[_0xe8f0('0x2d')]);_0x364da9[_0xe8f0('0x31')]=_[_0xe8f0('0x2f')](_0x50e78d[_0xe8f0('0x2c')],qs[_0xe8f0('0x30')](_0x5b44aa[_0xe8f0('0x2d')][_0xe8f0('0x30')]));_0x364da9[_0xe8f0('0x31')]=_0x364da9[_0xe8f0('0x31')][_0xe8f0('0x49')]?_0x364da9[_0xe8f0('0x31')]:_0x50e78d[_0xe8f0('0x2c')];_0x364da9[_0xe8f0('0x34')]=qs[_0xe8f0('0x35')](_0x5b44aa[_0xe8f0('0x2d')][_0xe8f0('0x35')]);_0x364da9[_0xe8f0('0x36')]=qs[_0xe8f0('0x41')](_['pick'](_0x5b44aa[_0xe8f0('0x2d')],_0x50e78d[_0xe8f0('0x41')]));if(_0x5b44aa['query'][_0xe8f0('0x38')]){_0x364da9['where']=_[_0xe8f0('0x39')](_0x364da9['where'],{'$or':_['map'](_0x364da9[_0xe8f0('0x31')],function(_0x1cfffe){var _0x53af8b={};_0x53af8b[_0x1cfffe]={'$like':'%'+_0x5b44aa[_0xe8f0('0x2d')][_0xe8f0('0x38')]+'%'};return _0x53af8b;})});}_0x364da9=_['merge']({},_0x364da9,_0x5b44aa[_0xe8f0('0x3a')]);return _0x11c244[_0xe8f0('0x4b')](_0x364da9);}})[_0xe8f0('0x21')](function(_0x6924f1){if(_0x6924f1){_0x50e39b=_0x6924f1[_0xe8f0('0x49')];if(!_0x5b44aa[_0xe8f0('0x2d')]['hasOwnProperty'](_0xe8f0('0x32'))){_0x364da9['limit']=qs[_0xe8f0('0x33')](_0x5b44aa['query'][_0xe8f0('0x33')]);_0x364da9[_0xe8f0('0x18')]=qs[_0xe8f0('0x18')](_0x5b44aa[_0xe8f0('0x2d')]['offset']);}return _0x11c244[_0xe8f0('0x4b')](_0x364da9);}})[_0xe8f0('0x21')](function(_0x8fe4b9){if(_0x8fe4b9){return _0x8fe4b9?{'count':_0x50e39b,'rows':_0x8fe4b9}:null;}})[_0xe8f0('0x21')](respondWithResult(_0x282e72,null))[_0xe8f0('0x3d')](handleError(_0x282e72,null));};exports[_0xe8f0('0x4c')]=function(_0xd1dea0,_0x53e5d8,_0x1a58b0){var _0x46f005={};var _0xd1d374={};var _0x23413d;var _0xd7716b;return db['Dynamics365Configuration'][_0xe8f0('0x47')]({'where':{'id':_0xd1dea0[_0xe8f0('0x3f')]['id']}})['then'](handleEntityNotFound(_0x53e5d8,null))[_0xe8f0('0x21')](function(_0x48dca9){if(_0x48dca9){_0x23413d=_0x48dca9;_0xd1d374[_0xe8f0('0x2c')]=_[_0xe8f0('0x2e')](db[_0xe8f0('0x48')][_0xe8f0('0x40')]);_0xd1d374[_0xe8f0('0x2d')]=_[_0xe8f0('0x2e')](_0xd1dea0['query']);_0xd1d374[_0xe8f0('0x41')]=_[_0xe8f0('0x2f')](_0xd1d374[_0xe8f0('0x2c')],_0xd1d374[_0xe8f0('0x2d')]);_0x46f005[_0xe8f0('0x31')]=_[_0xe8f0('0x2f')](_0xd1d374[_0xe8f0('0x2c')],qs[_0xe8f0('0x30')](_0xd1dea0[_0xe8f0('0x2d')][_0xe8f0('0x30')]));_0x46f005['attributes']=_0x46f005[_0xe8f0('0x31')][_0xe8f0('0x49')]?_0x46f005[_0xe8f0('0x31')]:_0xd1d374['model'];_0x46f005[_0xe8f0('0x34')]=qs[_0xe8f0('0x35')](_0xd1dea0['query'][_0xe8f0('0x35')]);_0x46f005[_0xe8f0('0x36')]=qs[_0xe8f0('0x41')](_['pick'](_0xd1dea0[_0xe8f0('0x2d')],_0xd1d374[_0xe8f0('0x41')]));if(_0xd1dea0[_0xe8f0('0x2d')][_0xe8f0('0x38')]){_0x46f005[_0xe8f0('0x36')]=_['merge'](_0x46f005['where'],{'$or':_['map'](_0x46f005[_0xe8f0('0x31')],function(_0x41faca){var _0x2ef2d0={};_0x2ef2d0[_0x41faca]={'$like':'%'+_0xd1dea0[_0xe8f0('0x2d')][_0xe8f0('0x38')]+'%'};return _0x2ef2d0;})});}_0x46f005=_['merge']({},_0x46f005,_0xd1dea0[_0xe8f0('0x3a')]);return _0x23413d['getDescriptions'](_0x46f005);}})[_0xe8f0('0x21')](function(_0x76fdf8){if(_0x76fdf8){_0xd7716b=_0x76fdf8[_0xe8f0('0x49')];if(!_0xd1dea0[_0xe8f0('0x2d')][_0xe8f0('0x4a')](_0xe8f0('0x32'))){_0x46f005[_0xe8f0('0x33')]=qs[_0xe8f0('0x33')](_0xd1dea0['query'][_0xe8f0('0x33')]);_0x46f005[_0xe8f0('0x18')]=qs[_0xe8f0('0x18')](_0xd1dea0[_0xe8f0('0x2d')][_0xe8f0('0x18')]);}return _0x23413d[_0xe8f0('0x4c')](_0x46f005);}})[_0xe8f0('0x21')](function(_0x48c107){if(_0x48c107){return _0x48c107?{'count':_0xd7716b,'rows':_0x48c107}:null;}})[_0xe8f0('0x21')](respondWithResult(_0x53e5d8,null))['catch'](handleError(_0x53e5d8,null));}; \ No newline at end of file +var _0xa324=['mustache','util','path','sox','to-csv','fs-extra','lodash','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','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Dynamics365Configuration','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','Dynamics365Field','where','getFields','findOne','length','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa324,0xeb));var _0x4a32=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xa324[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0x4a32('0x0'));var rimraf=require(_0x4a32('0x1'));var zipdir=require(_0x4a32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4a32('0x3'));var moment=require('moment');var BPromise=require(_0x4a32('0x4'));var Mustache=require(_0x4a32('0x5'));var util=require(_0x4a32('0x6'));var path=require(_0x4a32('0x7'));var sox=require(_0x4a32('0x8'));var csv=require(_0x4a32('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4a32('0xa'));var _=require(_0x4a32('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4a32('0xc'));var deskjs=require(_0x4a32('0xd'));var toCsv=require(_0x4a32('0x9'));var querystring=require(_0x4a32('0xe'));var Papa=require(_0x4a32('0xf'));var Redis=require(_0x4a32('0x10'));var authService=require(_0x4a32('0x11'));var qs=require(_0x4a32('0x12'));var as=require(_0x4a32('0x13'));var hardwareService=require(_0x4a32('0x14'));var logger=require(_0x4a32('0x15'))(_0x4a32('0x16'));var utils=require('../../config/utils');var config=require(_0x4a32('0x17'));var licenseUtil=require(_0x4a32('0x18'));var db=require(_0x4a32('0x19'))['db'];function respondWithStatusCode(_0x1bf53b,_0xa4478c){_0xa4478c=_0xa4478c||0xcc;return function(_0x25d98d){if(_0x25d98d){return _0x1bf53b[_0x4a32('0x1a')](_0xa4478c);}return _0x1bf53b['status'](_0xa4478c)['end']();};}function respondWithResult(_0x1cdc3d,_0x42d1a3){_0x42d1a3=_0x42d1a3||0xc8;return function(_0x5a2c70){if(_0x5a2c70){return _0x1cdc3d[_0x4a32('0x1b')](_0x42d1a3)['json'](_0x5a2c70);}};}function respondWithFilteredResult(_0x13107b,_0x31d176){return function(_0x334ad7){if(_0x334ad7){var _0x491ec0=typeof _0x31d176[_0x4a32('0x1c')]===_0x4a32('0x1d')&&typeof _0x31d176[_0x4a32('0x1e')]==='undefined';var _0x38f0fc=_0x334ad7[_0x4a32('0x1f')];var _0x16fd6f=_0x491ec0?0x0:_0x31d176['offset'];var _0x55116b=_0x491ec0?_0x334ad7['count']:_0x31d176[_0x4a32('0x1c')]+_0x31d176[_0x4a32('0x1e')];var _0x1a9605;if(_0x55116b>=_0x38f0fc){_0x55116b=_0x38f0fc;_0x1a9605=0xc8;}else{_0x1a9605=0xce;}_0x13107b['status'](_0x1a9605);return _0x13107b['set'](_0x4a32('0x20'),_0x16fd6f+'-'+_0x55116b+'/'+_0x38f0fc)['json'](_0x334ad7);}return null;};}function patchUpdates(_0x13d277){return function(_0x5aad5e){try{jsonpatch[_0x4a32('0x21')](_0x5aad5e,_0x13d277,!![]);}catch(_0x41078a){return BPromise[_0x4a32('0x22')](_0x41078a);}return _0x5aad5e[_0x4a32('0x23')]();};}function saveUpdates(_0x463d48,_0x2eface){return function(_0x4235d9){if(_0x4235d9){return _0x4235d9[_0x4a32('0x24')](_0x463d48)[_0x4a32('0x25')](function(_0x25a133){return _0x25a133;});}return null;};}function removeEntity(_0x317de5,_0x2efe91){return function(_0x2eaae3){if(_0x2eaae3){return _0x2eaae3[_0x4a32('0x26')]()[_0x4a32('0x25')](function(){_0x317de5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e77e4,_0x501627){return function(_0x5a672f){if(!_0x5a672f){_0x1e77e4[_0x4a32('0x1a')](0x194);}return _0x5a672f;};}function handleError(_0x3b06ba,_0x1ae2e8){_0x1ae2e8=_0x1ae2e8||0x1f4;return function(_0x2f2bc6){logger[_0x4a32('0x27')](_0x2f2bc6[_0x4a32('0x28')]);if(_0x2f2bc6[_0x4a32('0x29')]){delete _0x2f2bc6['name'];}_0x3b06ba[_0x4a32('0x1b')](_0x1ae2e8)[_0x4a32('0x2a')](_0x2f2bc6);};}exports[_0x4a32('0x2b')]=function(_0x1be63e,_0x41febd){var _0x1c47f7={},_0xd772c6={},_0x6d6164={'count':0x0,'rows':[]};var _0x6be54c=_['map'](db[_0x4a32('0x2c')][_0x4a32('0x2d')],function(_0x3025cd){return{'name':_0x3025cd['fieldName'],'type':_0x3025cd['type']['key']};});_0xd772c6[_0x4a32('0x2e')]=_[_0x4a32('0x2f')](_0x6be54c,_0x4a32('0x29'));_0xd772c6[_0x4a32('0x30')]=_[_0x4a32('0x31')](_0x1be63e[_0x4a32('0x30')]);_0xd772c6[_0x4a32('0x32')]=_[_0x4a32('0x33')](_0xd772c6[_0x4a32('0x2e')],_0xd772c6[_0x4a32('0x30')]);_0x1c47f7[_0x4a32('0x34')]=_[_0x4a32('0x33')](_0xd772c6['model'],qs[_0x4a32('0x35')](_0x1be63e[_0x4a32('0x30')][_0x4a32('0x35')]));_0x1c47f7[_0x4a32('0x34')]=_0x1c47f7[_0x4a32('0x34')]['length']?_0x1c47f7[_0x4a32('0x34')]:_0xd772c6[_0x4a32('0x2e')];if(!_0x1be63e[_0x4a32('0x30')][_0x4a32('0x36')](_0x4a32('0x37'))){_0x1c47f7[_0x4a32('0x1e')]=qs[_0x4a32('0x1e')](_0x1be63e[_0x4a32('0x30')][_0x4a32('0x1e')]);_0x1c47f7[_0x4a32('0x1c')]=qs[_0x4a32('0x1c')](_0x1be63e[_0x4a32('0x30')][_0x4a32('0x1c')]);}_0x1c47f7[_0x4a32('0x38')]=qs[_0x4a32('0x39')](_0x1be63e[_0x4a32('0x30')]['sort']);_0x1c47f7['where']=qs['filters'](_[_0x4a32('0x3a')](_0x1be63e[_0x4a32('0x30')],_0xd772c6[_0x4a32('0x32')]),_0x6be54c);if(_0x1be63e[_0x4a32('0x30')][_0x4a32('0x3b')]){_0x1c47f7['where']=_[_0x4a32('0x3c')](_0x1c47f7['where'],{'$or':_[_0x4a32('0x2f')](_0x6be54c,function(_0x51e23d){if(_0x51e23d[_0x4a32('0x3d')]!==_0x4a32('0x3e')){var _0x125a39={};_0x125a39[_0x51e23d[_0x4a32('0x29')]]={'$like':'%'+_0x1be63e[_0x4a32('0x30')]['filter']+'%'};return _0x125a39;}})});}_0x1c47f7=_[_0x4a32('0x3c')]({},_0x1c47f7,_0x1be63e[_0x4a32('0x3f')]);var _0x5a47c3={'where':_0x1c47f7['where']};return db['Dynamics365Configuration']['count'](_0x5a47c3)[_0x4a32('0x25')](function(_0x385759){_0x6d6164[_0x4a32('0x1f')]=_0x385759;if(_0x1be63e[_0x4a32('0x30')][_0x4a32('0x40')]){_0x1c47f7[_0x4a32('0x41')]=[{'all':!![]}];}return db[_0x4a32('0x2c')][_0x4a32('0x42')](_0x1c47f7);})[_0x4a32('0x25')](function(_0x104460){_0x6d6164[_0x4a32('0x43')]=_0x104460;return _0x6d6164;})[_0x4a32('0x25')](respondWithFilteredResult(_0x41febd,_0x1c47f7))[_0x4a32('0x44')](handleError(_0x41febd,null));};exports['show']=function(_0x480517,_0x5b742c){var _0x344211={'raw':![],'where':{'id':_0x480517[_0x4a32('0x45')]['id']}},_0x282fd9={};_0x282fd9['model']=_['keys'](db['Dynamics365Configuration'][_0x4a32('0x2d')]);_0x282fd9['query']=_[_0x4a32('0x31')](_0x480517[_0x4a32('0x30')]);_0x282fd9[_0x4a32('0x32')]=_[_0x4a32('0x33')](_0x282fd9[_0x4a32('0x2e')],_0x282fd9[_0x4a32('0x30')]);_0x344211[_0x4a32('0x34')]=_[_0x4a32('0x33')](_0x282fd9[_0x4a32('0x2e')],qs['fields'](_0x480517['query'][_0x4a32('0x35')]));_0x344211['attributes']=_0x344211['attributes']['length']?_0x344211[_0x4a32('0x34')]:_0x282fd9['model'];if(_0x480517[_0x4a32('0x30')]['includeAll']){_0x344211[_0x4a32('0x41')]=[{'all':!![]}];}_0x344211=_[_0x4a32('0x3c')]({},_0x344211,_0x480517[_0x4a32('0x3f')]);return db[_0x4a32('0x2c')][_0x4a32('0x46')](_0x344211)['then'](handleEntityNotFound(_0x5b742c,null))[_0x4a32('0x25')](respondWithResult(_0x5b742c,null))[_0x4a32('0x44')](handleError(_0x5b742c,null));};exports[_0x4a32('0x47')]=function(_0x410a0c,_0x2941bf){return db[_0x4a32('0x2c')]['create'](_0x410a0c[_0x4a32('0x48')],{})[_0x4a32('0x25')](respondWithResult(_0x2941bf,0xc9))[_0x4a32('0x44')](handleError(_0x2941bf,null));};exports['update']=function(_0x2728dd,_0x26111b){if(_0x2728dd[_0x4a32('0x48')]['id']){delete _0x2728dd[_0x4a32('0x48')]['id'];}return db[_0x4a32('0x2c')][_0x4a32('0x46')]({'where':{'id':_0x2728dd['params']['id']}})[_0x4a32('0x25')](handleEntityNotFound(_0x26111b,null))[_0x4a32('0x25')](saveUpdates(_0x2728dd[_0x4a32('0x48')],null))[_0x4a32('0x25')](respondWithResult(_0x26111b,null))[_0x4a32('0x44')](handleError(_0x26111b,null));};exports[_0x4a32('0x26')]=function(_0x315925,_0x205027){return db[_0x4a32('0x2c')][_0x4a32('0x46')]({'where':{'id':_0x315925['params']['id']}})[_0x4a32('0x25')](handleEntityNotFound(_0x205027,null))[_0x4a32('0x25')](removeEntity(_0x205027,null))[_0x4a32('0x44')](handleError(_0x205027,null));};exports['getFields']=function(_0x1bd7ef,_0x136768,_0x536dac){var _0x55dea2={};var _0x1c0df1={};var _0x1c77ce;var _0x1bb657;return db[_0x4a32('0x2c')]['findOne']({'where':{'id':_0x1bd7ef[_0x4a32('0x45')]['id']}})[_0x4a32('0x25')](handleEntityNotFound(_0x136768,null))[_0x4a32('0x25')](function(_0x29abb9){if(_0x29abb9){_0x1c77ce=_0x29abb9;_0x1c0df1['model']=_[_0x4a32('0x31')](db[_0x4a32('0x49')][_0x4a32('0x2d')]);_0x1c0df1[_0x4a32('0x30')]=_[_0x4a32('0x31')](_0x1bd7ef[_0x4a32('0x30')]);_0x1c0df1[_0x4a32('0x32')]=_[_0x4a32('0x33')](_0x1c0df1[_0x4a32('0x2e')],_0x1c0df1['query']);_0x55dea2[_0x4a32('0x34')]=_['intersection'](_0x1c0df1[_0x4a32('0x2e')],qs[_0x4a32('0x35')](_0x1bd7ef[_0x4a32('0x30')][_0x4a32('0x35')]));_0x55dea2['attributes']=_0x55dea2[_0x4a32('0x34')]['length']?_0x55dea2[_0x4a32('0x34')]:_0x1c0df1[_0x4a32('0x2e')];_0x55dea2[_0x4a32('0x38')]=qs[_0x4a32('0x39')](_0x1bd7ef[_0x4a32('0x30')][_0x4a32('0x39')]);_0x55dea2[_0x4a32('0x4a')]=qs[_0x4a32('0x32')](_[_0x4a32('0x3a')](_0x1bd7ef[_0x4a32('0x30')],_0x1c0df1[_0x4a32('0x32')]));if(_0x1bd7ef['query'][_0x4a32('0x3b')]){_0x55dea2[_0x4a32('0x4a')]=_['merge'](_0x55dea2['where'],{'$or':_[_0x4a32('0x2f')](_0x55dea2[_0x4a32('0x34')],function(_0x1e2940){var _0x19ecfd={};_0x19ecfd[_0x1e2940]={'$like':'%'+_0x1bd7ef[_0x4a32('0x30')][_0x4a32('0x3b')]+'%'};return _0x19ecfd;})});}_0x55dea2=_[_0x4a32('0x3c')]({},_0x55dea2,_0x1bd7ef[_0x4a32('0x3f')]);return _0x1c77ce[_0x4a32('0x4b')](_0x55dea2);}})[_0x4a32('0x25')](function(_0x4d173c){if(_0x4d173c){_0x1bb657=_0x4d173c['length'];if(!_0x1bd7ef[_0x4a32('0x30')][_0x4a32('0x36')](_0x4a32('0x37'))){_0x55dea2[_0x4a32('0x1e')]=qs['limit'](_0x1bd7ef[_0x4a32('0x30')][_0x4a32('0x1e')]);_0x55dea2[_0x4a32('0x1c')]=qs[_0x4a32('0x1c')](_0x1bd7ef['query']['offset']);}return _0x1c77ce[_0x4a32('0x4b')](_0x55dea2);}})['then'](function(_0xcceb3c){if(_0xcceb3c){return _0xcceb3c?{'count':_0x1bb657,'rows':_0xcceb3c}:null;}})['then'](respondWithResult(_0x136768,null))[_0x4a32('0x44')](handleError(_0x136768,null));};exports['getSubjects']=function(_0x30b906,_0x2b4f5b,_0x17363e){var _0x4dc664={};var _0x361ccf={};var _0x33a9a7;var _0x189a74;return db[_0x4a32('0x2c')][_0x4a32('0x4c')]({'where':{'id':_0x30b906[_0x4a32('0x45')]['id']}})[_0x4a32('0x25')](handleEntityNotFound(_0x2b4f5b,null))['then'](function(_0x515a4c){if(_0x515a4c){_0x33a9a7=_0x515a4c;_0x361ccf[_0x4a32('0x2e')]=_[_0x4a32('0x31')](db[_0x4a32('0x49')]['rawAttributes']);_0x361ccf[_0x4a32('0x30')]=_[_0x4a32('0x31')](_0x30b906[_0x4a32('0x30')]);_0x361ccf[_0x4a32('0x32')]=_[_0x4a32('0x33')](_0x361ccf[_0x4a32('0x2e')],_0x361ccf[_0x4a32('0x30')]);_0x4dc664[_0x4a32('0x34')]=_[_0x4a32('0x33')](_0x361ccf[_0x4a32('0x2e')],qs[_0x4a32('0x35')](_0x30b906[_0x4a32('0x30')]['fields']));_0x4dc664['attributes']=_0x4dc664['attributes'][_0x4a32('0x4d')]?_0x4dc664['attributes']:_0x361ccf['model'];_0x4dc664[_0x4a32('0x38')]=qs['sort'](_0x30b906[_0x4a32('0x30')][_0x4a32('0x39')]);_0x4dc664[_0x4a32('0x4a')]=qs[_0x4a32('0x32')](_['pick'](_0x30b906[_0x4a32('0x30')],_0x361ccf['filters']));if(_0x30b906[_0x4a32('0x30')][_0x4a32('0x3b')]){_0x4dc664[_0x4a32('0x4a')]=_[_0x4a32('0x3c')](_0x4dc664[_0x4a32('0x4a')],{'$or':_['map'](_0x4dc664[_0x4a32('0x34')],function(_0x195e53){var _0x43e38a={};_0x43e38a[_0x195e53]={'$like':'%'+_0x30b906['query'][_0x4a32('0x3b')]+'%'};return _0x43e38a;})});}_0x4dc664=_[_0x4a32('0x3c')]({},_0x4dc664,_0x30b906[_0x4a32('0x3f')]);return _0x33a9a7[_0x4a32('0x4e')](_0x4dc664);}})['then'](function(_0x14e0e8){if(_0x14e0e8){_0x189a74=_0x14e0e8[_0x4a32('0x4d')];if(!_0x30b906['query'][_0x4a32('0x36')](_0x4a32('0x37'))){_0x4dc664[_0x4a32('0x1e')]=qs['limit'](_0x30b906['query'][_0x4a32('0x1e')]);_0x4dc664[_0x4a32('0x1c')]=qs[_0x4a32('0x1c')](_0x30b906[_0x4a32('0x30')][_0x4a32('0x1c')]);}return _0x33a9a7[_0x4a32('0x4e')](_0x4dc664);}})[_0x4a32('0x25')](function(_0x44e68c){if(_0x44e68c){return _0x44e68c?{'count':_0x189a74,'rows':_0x44e68c}:null;}})[_0x4a32('0x25')](respondWithResult(_0x2b4f5b,null))[_0x4a32('0x44')](handleError(_0x2b4f5b,null));};exports[_0x4a32('0x4f')]=function(_0x4dbbf7,_0x134447,_0x378455){var _0x3267c7={};var _0x3ab478={};var _0x243db9;var _0x5006eb;return db[_0x4a32('0x2c')][_0x4a32('0x4c')]({'where':{'id':_0x4dbbf7[_0x4a32('0x45')]['id']}})[_0x4a32('0x25')](handleEntityNotFound(_0x134447,null))[_0x4a32('0x25')](function(_0xbdc6e4){if(_0xbdc6e4){_0x243db9=_0xbdc6e4;_0x3ab478[_0x4a32('0x2e')]=_[_0x4a32('0x31')](db[_0x4a32('0x49')][_0x4a32('0x2d')]);_0x3ab478['query']=_[_0x4a32('0x31')](_0x4dbbf7[_0x4a32('0x30')]);_0x3ab478[_0x4a32('0x32')]=_[_0x4a32('0x33')](_0x3ab478[_0x4a32('0x2e')],_0x3ab478[_0x4a32('0x30')]);_0x3267c7[_0x4a32('0x34')]=_[_0x4a32('0x33')](_0x3ab478[_0x4a32('0x2e')],qs[_0x4a32('0x35')](_0x4dbbf7[_0x4a32('0x30')][_0x4a32('0x35')]));_0x3267c7[_0x4a32('0x34')]=_0x3267c7[_0x4a32('0x34')][_0x4a32('0x4d')]?_0x3267c7['attributes']:_0x3ab478[_0x4a32('0x2e')];_0x3267c7['order']=qs[_0x4a32('0x39')](_0x4dbbf7[_0x4a32('0x30')]['sort']);_0x3267c7['where']=qs[_0x4a32('0x32')](_[_0x4a32('0x3a')](_0x4dbbf7[_0x4a32('0x30')],_0x3ab478['filters']));if(_0x4dbbf7[_0x4a32('0x30')][_0x4a32('0x3b')]){_0x3267c7[_0x4a32('0x4a')]=_['merge'](_0x3267c7[_0x4a32('0x4a')],{'$or':_[_0x4a32('0x2f')](_0x3267c7[_0x4a32('0x34')],function(_0x2ec08c){var _0x51c105={};_0x51c105[_0x2ec08c]={'$like':'%'+_0x4dbbf7[_0x4a32('0x30')][_0x4a32('0x3b')]+'%'};return _0x51c105;})});}_0x3267c7=_[_0x4a32('0x3c')]({},_0x3267c7,_0x4dbbf7[_0x4a32('0x3f')]);return _0x243db9['getDescriptions'](_0x3267c7);}})[_0x4a32('0x25')](function(_0x293b75){if(_0x293b75){_0x5006eb=_0x293b75['length'];if(!_0x4dbbf7[_0x4a32('0x30')]['hasOwnProperty']('nolimit')){_0x3267c7['limit']=qs[_0x4a32('0x1e')](_0x4dbbf7['query'][_0x4a32('0x1e')]);_0x3267c7['offset']=qs[_0x4a32('0x1c')](_0x4dbbf7[_0x4a32('0x30')][_0x4a32('0x1c')]);}return _0x243db9[_0x4a32('0x4f')](_0x3267c7);}})[_0x4a32('0x25')](function(_0x3b25c0){if(_0x3b25c0){return _0x3b25c0?{'count':_0x5006eb,'rows':_0x3b25c0}:null;}})[_0x4a32('0x25')](respondWithResult(_0x134447,null))[_0x4a32('0x44')](handleError(_0x134447,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 452943a..04b7cd1 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 _0xf3cd=['path','rimraf','../../config/environment','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x19697a,_0x57e223){var _0x5a4ca5=function(_0x378bb5){while(--_0x378bb5){_0x19697a['push'](_0x19697a['shift']());}};_0x5a4ca5(++_0x57e223);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3c42ff,_0x45ee1f){_0x3c42ff=_0x3c42ff-0x0;var _0x4c0f6d=_0xf3cd[_0x3c42ff];return _0x4c0f6d;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./intDynamics365Configuration.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd6d6=['path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x29fc95,_0x54b5c9){var _0x19cc97=function(_0x3c6e00){while(--_0x3c6e00){_0x29fc95['push'](_0x29fc95['shift']());}};_0x19cc97(++_0x54b5c9);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x285d16,_0x300661){_0x285d16=_0x285d16-0x0;var _0xaf62e8=_0xd6d6[_0x285d16];return _0xaf62e8;};'use strict';var _=require(_0x6d6d('0x0'));var util=require(_0x6d6d('0x1'));var logger=require(_0x6d6d('0x2'))(_0x6d6d('0x3'));var moment=require('moment');var BPromise=require(_0x6d6d('0x4'));var rp=require(_0x6d6d('0x5'));var fs=require('fs');var path=require(_0x6d6d('0x6'));var rimraf=require(_0x6d6d('0x7'));var config=require(_0x6d6d('0x8'));var attributes=require(_0x6d6d('0x9'));module[_0x6d6d('0xa')]=function(_0x5702dc,_0x210ff7){return _0x5702dc[_0x6d6d('0xb')](_0x6d6d('0xc'),attributes,{'tableName':_0x6d6d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 87464c0..2947b80 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 _0x6233=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x31204d,_0x565509){var _0x1830e9=function(_0x5b5376){while(--_0x5b5376){_0x31204d['push'](_0x31204d['shift']());}};_0x1830e9(++_0x565509);}(_0x6233,0x112));var _0x3623=function(_0x321b59,_0x629e28){_0x321b59=_0x321b59-0x0;var _0x437086=_0x6233[_0x321b59];return _0x437086;};'use strict';var _=require(_0x3623('0x0'));var util=require(_0x3623('0x1'));var moment=require('moment');var BPromise=require(_0x3623('0x2'));var rs=require(_0x3623('0x3'));var fs=require('fs');var Redis=require(_0x3623('0x4'));var db=require(_0x3623('0x5'))['db'];var utils=require(_0x3623('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3623('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3623('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53e08c,_0x5890e5,_0x362011){return new BPromise(function(_0x1acd03,_0x92ac68){return client[_0x3623('0x9')](_0x53e08c,_0x362011)['then'](function(_0x5e0f6f){logger[_0x3623('0xa')](_0x3623('0xb'),_0x5890e5,_0x3623('0xc'));logger[_0x3623('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5890e5,'request\x20sent',JSON['stringify'](_0x5e0f6f));if(_0x5e0f6f[_0x3623('0xe')]){if(_0x5e0f6f[_0x3623('0xe')]['code']===0x1f4){logger[_0x3623('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5890e5,_0x5e0f6f[_0x3623('0xe')][_0x3623('0xf')]);return _0x92ac68(_0x5e0f6f[_0x3623('0xe')]['message']);}logger[_0x3623('0xe')](_0x3623('0xb'),_0x5890e5,_0x5e0f6f['error'][_0x3623('0xf')]);return _0x1acd03(_0x5e0f6f[_0x3623('0xe')]['message']);}else{logger[_0x3623('0xa')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5890e5,_0x3623('0xc'));_0x1acd03(_0x5e0f6f['result'][_0x3623('0xf')]);}})[_0x3623('0x10')](function(_0x319a53){logger[_0x3623('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5890e5,_0x319a53);_0x92ac68(_0x319a53);});});} \ No newline at end of file +var _0x6451=['message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xda5095,_0x380fba){var _0x3b1c0b=function(_0x497beb){while(--_0x497beb){_0xda5095['push'](_0xda5095['shift']());}};_0x3b1c0b(++_0x380fba);}(_0x6451,0xd4));var _0x1645=function(_0x49b3a9,_0x5a6673){_0x49b3a9=_0x49b3a9-0x0;var _0x500b0c=_0x6451[_0x49b3a9];return _0x500b0c;};'use strict';var _=require(_0x1645('0x0'));var util=require(_0x1645('0x1'));var moment=require('moment');var BPromise=require(_0x1645('0x2'));var rs=require(_0x1645('0x3'));var fs=require('fs');var Redis=require(_0x1645('0x4'));var db=require(_0x1645('0x5'))['db'];var utils=require(_0x1645('0x6'));var logger=require('../../config/logger')(_0x1645('0x7'));var config=require('../../config/environment');var jayson=require(_0x1645('0x8'));var client=jayson[_0x1645('0x9')][_0x1645('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2510c1,_0x10151c,_0x3afa80){return new BPromise(function(_0x1fea53,_0x46323b){return client[_0x1645('0xb')](_0x2510c1,_0x3afa80)['then'](function(_0x230c61){logger[_0x1645('0xc')](_0x1645('0xd'),_0x10151c,_0x1645('0xe'));logger[_0x1645('0xf')](_0x1645('0x10'),_0x10151c,_0x1645('0xe'),JSON['stringify'](_0x230c61));if(_0x230c61['error']){if(_0x230c61[_0x1645('0x11')][_0x1645('0x12')]===0x1f4){logger['error'](_0x1645('0xd'),_0x10151c,_0x230c61[_0x1645('0x11')][_0x1645('0x13')]);return _0x46323b(_0x230c61[_0x1645('0x11')]['message']);}logger[_0x1645('0x11')](_0x1645('0xd'),_0x10151c,_0x230c61['error'][_0x1645('0x13')]);return _0x1fea53(_0x230c61['error'][_0x1645('0x13')]);}else{logger[_0x1645('0xc')](_0x1645('0xd'),_0x10151c,_0x1645('0xe'));_0x1fea53(_0x230c61['result'][_0x1645('0x13')]);}})[_0x1645('0x14')](function(_0x1ac684){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x10151c,_0x1ac684);_0x46323b(_0x1ac684);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index a4cca38..445a1b5 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 _0x3440=['connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Field.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','multer','util'];(function(_0x38d91b,_0x45a1d6){var _0x1027e0=function(_0xb1b5f5){while(--_0xb1b5f5){_0x38d91b['push'](_0x38d91b['shift']());}};_0x1027e0(++_0x45a1d6);}(_0x3440,0x7c));var _0x0344=function(_0x2f441a,_0x5b836b){_0x2f441a=_0x2f441a-0x0;var _0x5997e6=_0x3440[_0x2f441a];return _0x5997e6;};'use strict';var multer=require(_0x0344('0x0'));var util=require(_0x0344('0x1'));var path=require('path');var timeout=require(_0x0344('0x2'));var express=require('express');var router=express[_0x0344('0x3')]();var fs_extra=require(_0x0344('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0344('0x5'));var controller=require(_0x0344('0x6'));router[_0x0344('0x7')]('/',auth['isAuthenticated'](),controller[_0x0344('0x8')]);router['get'](_0x0344('0x9'),auth['isAuthenticated'](),controller[_0x0344('0xa')]);router[_0x0344('0xb')]('/',auth[_0x0344('0xc')](),controller[_0x0344('0xd')]);router[_0x0344('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0344('0xf')]);router[_0x0344('0x10')](_0x0344('0x9'),auth[_0x0344('0xc')](),controller[_0x0344('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9533=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x428565,_0x23fb73){var _0x49b7d7=function(_0x4f3fac){while(--_0x4f3fac){_0x428565['push'](_0x428565['shift']());}};_0x49b7d7(++_0x23fb73);}(_0x9533,0xb5));var _0x3953=function(_0x216d32,_0x57baa5){_0x216d32=_0x216d32-0x0;var _0x4a6700=_0x9533[_0x216d32];return _0x4a6700;};'use strict';var multer=require(_0x3953('0x0'));var util=require(_0x3953('0x1'));var path=require(_0x3953('0x2'));var timeout=require(_0x3953('0x3'));var express=require(_0x3953('0x4'));var router=express[_0x3953('0x5')]();var fs_extra=require(_0x3953('0x6'));var auth=require(_0x3953('0x7'));var interaction=require(_0x3953('0x8'));var config=require('../../config/environment');var controller=require(_0x3953('0x9'));router[_0x3953('0xa')]('/',auth[_0x3953('0xb')](),controller['index']);router[_0x3953('0xa')](_0x3953('0xc'),auth[_0x3953('0xb')](),controller[_0x3953('0xd')]);router[_0x3953('0xe')]('/',auth[_0x3953('0xb')](),controller[_0x3953('0xf')]);router[_0x3953('0x10')](_0x3953('0xc'),auth[_0x3953('0xb')](),controller[_0x3953('0x11')]);router['delete'](_0x3953('0xc'),auth[_0x3953('0xb')](),controller[_0x3953('0x12')]);module[_0x3953('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 32063a5..2d3ae77 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 _0xb7e4=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb7e4,0x156));var _0x4b7e=function(_0x42e7f4,_0x1813a6){_0x42e7f4=_0x42e7f4-0x0;var _0x225359=_0xb7e4[_0x42e7f4];return _0x225359;};'use strict';var Sequelize=require(_0x4b7e('0x0'));module[_0x4b7e('0x1')]={'type':{'type':Sequelize[_0x4b7e('0x2')](_0x4b7e('0x3'),_0x4b7e('0x4'),_0x4b7e('0x5'),_0x4b7e('0x6'),'picklist'),'defaultValue':_0x4b7e('0x3')},'content':{'type':Sequelize[_0x4b7e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x4b7e('0x3'),'variable',_0x4b7e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4b7e('0x7')]},'nameField':{'type':Sequelize[_0x4b7e('0x7')]},'customField':{'type':Sequelize[_0x4b7e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4b7e('0x7')]}}; \ No newline at end of file +var _0xa083=['picklist','string','STRING','ENUM','variable','BOOLEAN','sequelize','exports','customVariable','keyValue'];(function(_0x15ada6,_0x4e4620){var _0x568e0f=function(_0xa7ee48){while(--_0xa7ee48){_0x15ada6['push'](_0x15ada6['shift']());}};_0x568e0f(++_0x4e4620);}(_0xa083,0x114));var _0x3a08=function(_0x49a613,_0x27ad0b){_0x49a613=_0x49a613-0x0;var _0x4ed260=_0xa083[_0x49a613];return _0x4ed260;};'use strict';var Sequelize=require(_0x3a08('0x0'));module[_0x3a08('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x3a08('0x2'),_0x3a08('0x3'),_0x3a08('0x4')),'defaultValue':_0x3a08('0x5')},'content':{'type':Sequelize[_0x3a08('0x6')]},'key':{'type':Sequelize[_0x3a08('0x6')]},'keyType':{'type':Sequelize[_0x3a08('0x7')](_0x3a08('0x5'),_0x3a08('0x8'),_0x3a08('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3a08('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3a08('0x9')],'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 01c20f8..af528b0 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 _0xe996=['rawAttributes','options','create','body','find','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Dynamics365Field','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','filter','includeAll','include','findAll','catch','show','params'];(function(_0x2e8436,_0x60d207){var _0x41a31a=function(_0x5aa6cf){while(--_0x5aa6cf){_0x2e8436['push'](_0x2e8436['shift']());}};_0x41a31a(++_0x60d207);}(_0xe996,0x172));var _0x6e99=function(_0x15fb94,_0x5bccef){_0x15fb94=_0x15fb94-0x0;var _0x3b66d1=_0xe996[_0x15fb94];return _0x3b66d1;};'use strict';var emlformat=require(_0x6e99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6e99('0x1'));var rp=require('request-promise');var moment=require(_0x6e99('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x6e99('0x3'));var util=require(_0x6e99('0x4'));var path=require(_0x6e99('0x5'));var sox=require(_0x6e99('0x6'));var csv=require(_0x6e99('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e99('0x8'));var squel=require(_0x6e99('0x9'));var crypto=require(_0x6e99('0xa'));var jsforce=require(_0x6e99('0xb'));var deskjs=require(_0x6e99('0xc'));var toCsv=require(_0x6e99('0x7'));var querystring=require('querystring');var Papa=require(_0x6e99('0xd'));var Redis=require(_0x6e99('0xe'));var authService=require(_0x6e99('0xf'));var qs=require(_0x6e99('0x10'));var as=require(_0x6e99('0x11'));var hardwareService=require(_0x6e99('0x12'));var logger=require(_0x6e99('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6e99('0x14'));var licenseUtil=require(_0x6e99('0x15'));var db=require(_0x6e99('0x16'))['db'];function respondWithStatusCode(_0xf288e7,_0x2fc9ca){_0x2fc9ca=_0x2fc9ca||0xcc;return function(_0x2533b9){if(_0x2533b9){return _0xf288e7['sendStatus'](_0x2fc9ca);}return _0xf288e7[_0x6e99('0x17')](_0x2fc9ca)[_0x6e99('0x18')]();};}function respondWithResult(_0x570e32,_0x1174d3){_0x1174d3=_0x1174d3||0xc8;return function(_0x53f971){if(_0x53f971){return _0x570e32[_0x6e99('0x17')](_0x1174d3)[_0x6e99('0x19')](_0x53f971);}};}function respondWithFilteredResult(_0x893d33,_0x403f8a){return function(_0x101f0f){if(_0x101f0f){var _0x44a80b=typeof _0x403f8a[_0x6e99('0x1a')]===_0x6e99('0x1b')&&typeof _0x403f8a[_0x6e99('0x1c')]===_0x6e99('0x1b');var _0x100b06=_0x101f0f[_0x6e99('0x1d')];var _0x49fb33=_0x44a80b?0x0:_0x403f8a[_0x6e99('0x1a')];var _0x4fbf44=_0x44a80b?_0x101f0f['count']:_0x403f8a[_0x6e99('0x1a')]+_0x403f8a[_0x6e99('0x1c')];var _0x1b35d7;if(_0x4fbf44>=_0x100b06){_0x4fbf44=_0x100b06;_0x1b35d7=0xc8;}else{_0x1b35d7=0xce;}_0x893d33[_0x6e99('0x17')](_0x1b35d7);return _0x893d33[_0x6e99('0x1e')](_0x6e99('0x1f'),_0x49fb33+'-'+_0x4fbf44+'/'+_0x100b06)[_0x6e99('0x19')](_0x101f0f);}return null;};}function patchUpdates(_0x30b6f7){return function(_0x46205b){try{jsonpatch[_0x6e99('0x20')](_0x46205b,_0x30b6f7,!![]);}catch(_0xe616d9){return BPromise[_0x6e99('0x21')](_0xe616d9);}return _0x46205b[_0x6e99('0x22')]();};}function saveUpdates(_0x37a354,_0x2f80cc){return function(_0x17472){if(_0x17472){return _0x17472[_0x6e99('0x23')](_0x37a354)[_0x6e99('0x24')](function(_0x317ee8){return _0x317ee8;});}return null;};}function removeEntity(_0x347cd6,_0x363592){return function(_0x20b8bd){if(_0x20b8bd){return _0x20b8bd[_0x6e99('0x25')]()[_0x6e99('0x24')](function(){_0x347cd6['status'](0xcc)[_0x6e99('0x18')]();});}};}function handleEntityNotFound(_0x21090c,_0x1362cd){return function(_0xe3c25a){if(!_0xe3c25a){_0x21090c[_0x6e99('0x26')](0x194);}return _0xe3c25a;};}function handleError(_0xe1bb6d,_0x56d23b){_0x56d23b=_0x56d23b||0x1f4;return function(_0x22ae3d){logger[_0x6e99('0x27')](_0x22ae3d[_0x6e99('0x28')]);if(_0x22ae3d[_0x6e99('0x29')]){delete _0x22ae3d[_0x6e99('0x29')];}_0xe1bb6d['status'](_0x56d23b)[_0x6e99('0x2a')](_0x22ae3d);};}exports[_0x6e99('0x2b')]=function(_0x51cd3d,_0x2741bd){var _0x98f58b={},_0x35017={},_0x48e308={'count':0x0,'rows':[]};var _0x40ad43=_[_0x6e99('0x2c')](db[_0x6e99('0x2d')]['rawAttributes'],function(_0x294b44){return{'name':_0x294b44[_0x6e99('0x2e')],'type':_0x294b44[_0x6e99('0x2f')]['key']};});_0x35017['model']=_['map'](_0x40ad43,'name');_0x35017[_0x6e99('0x30')]=_[_0x6e99('0x31')](_0x51cd3d[_0x6e99('0x30')]);_0x35017[_0x6e99('0x32')]=_[_0x6e99('0x33')](_0x35017[_0x6e99('0x34')],_0x35017[_0x6e99('0x30')]);_0x98f58b[_0x6e99('0x35')]=_[_0x6e99('0x33')](_0x35017[_0x6e99('0x34')],qs['fields'](_0x51cd3d[_0x6e99('0x30')][_0x6e99('0x36')]));_0x98f58b[_0x6e99('0x35')]=_0x98f58b[_0x6e99('0x35')][_0x6e99('0x37')]?_0x98f58b[_0x6e99('0x35')]:_0x35017[_0x6e99('0x34')];if(!_0x51cd3d[_0x6e99('0x30')][_0x6e99('0x38')](_0x6e99('0x39'))){_0x98f58b[_0x6e99('0x1c')]=qs[_0x6e99('0x1c')](_0x51cd3d['query'][_0x6e99('0x1c')]);_0x98f58b[_0x6e99('0x1a')]=qs[_0x6e99('0x1a')](_0x51cd3d['query'][_0x6e99('0x1a')]);}_0x98f58b['order']=qs[_0x6e99('0x3a')](_0x51cd3d['query'][_0x6e99('0x3a')]);_0x98f58b['where']=qs['filters'](_['pick'](_0x51cd3d[_0x6e99('0x30')],_0x35017['filters']),_0x40ad43);if(_0x51cd3d[_0x6e99('0x30')]['filter']){_0x98f58b[_0x6e99('0x3b')]=_[_0x6e99('0x3c')](_0x98f58b[_0x6e99('0x3b')],{'$or':_[_0x6e99('0x2c')](_0x40ad43,function(_0x3e9a3c){if(_0x3e9a3c['type']!=='VIRTUAL'){var _0x26e20a={};_0x26e20a[_0x3e9a3c[_0x6e99('0x29')]]={'$like':'%'+_0x51cd3d[_0x6e99('0x30')][_0x6e99('0x3d')]+'%'};return _0x26e20a;}})});}_0x98f58b=_[_0x6e99('0x3c')]({},_0x98f58b,_0x51cd3d['options']);var _0x2384d6={'where':_0x98f58b['where']};return db['Dynamics365Field'][_0x6e99('0x1d')](_0x2384d6)['then'](function(_0x83aed5){_0x48e308['count']=_0x83aed5;if(_0x51cd3d[_0x6e99('0x30')][_0x6e99('0x3e')]){_0x98f58b[_0x6e99('0x3f')]=[{'all':!![]}];}return db[_0x6e99('0x2d')][_0x6e99('0x40')](_0x98f58b);})['then'](function(_0x2698af){_0x48e308['rows']=_0x2698af;return _0x48e308;})[_0x6e99('0x24')](respondWithFilteredResult(_0x2741bd,_0x98f58b))[_0x6e99('0x41')](handleError(_0x2741bd,null));};exports[_0x6e99('0x42')]=function(_0x44df34,_0xe826ee){var _0x4f687d={'raw':!![],'where':{'id':_0x44df34[_0x6e99('0x43')]['id']}},_0x1ba629={};_0x1ba629['model']=_[_0x6e99('0x31')](db[_0x6e99('0x2d')][_0x6e99('0x44')]);_0x1ba629[_0x6e99('0x30')]=_[_0x6e99('0x31')](_0x44df34['query']);_0x1ba629[_0x6e99('0x32')]=_[_0x6e99('0x33')](_0x1ba629[_0x6e99('0x34')],_0x1ba629['query']);_0x4f687d['attributes']=_[_0x6e99('0x33')](_0x1ba629[_0x6e99('0x34')],qs[_0x6e99('0x36')](_0x44df34[_0x6e99('0x30')][_0x6e99('0x36')]));_0x4f687d[_0x6e99('0x35')]=_0x4f687d[_0x6e99('0x35')][_0x6e99('0x37')]?_0x4f687d[_0x6e99('0x35')]:_0x1ba629[_0x6e99('0x34')];if(_0x44df34[_0x6e99('0x30')]['includeAll']){_0x4f687d[_0x6e99('0x3f')]=[{'all':!![]}];}_0x4f687d=_[_0x6e99('0x3c')]({},_0x4f687d,_0x44df34[_0x6e99('0x45')]);return db['Dynamics365Field']['find'](_0x4f687d)[_0x6e99('0x24')](handleEntityNotFound(_0xe826ee,null))[_0x6e99('0x24')](respondWithResult(_0xe826ee,null))['catch'](handleError(_0xe826ee,null));};exports[_0x6e99('0x46')]=function(_0x354909,_0x1b7536){return db['Dynamics365Field'][_0x6e99('0x46')](_0x354909[_0x6e99('0x47')],{})[_0x6e99('0x24')](respondWithResult(_0x1b7536,0xc9))[_0x6e99('0x41')](handleError(_0x1b7536,null));};exports[_0x6e99('0x23')]=function(_0x357f5e,_0x136cd0){if(_0x357f5e['body']['id']){delete _0x357f5e[_0x6e99('0x47')]['id'];}return db[_0x6e99('0x2d')][_0x6e99('0x48')]({'where':{'id':_0x357f5e['params']['id']}})[_0x6e99('0x24')](handleEntityNotFound(_0x136cd0,null))[_0x6e99('0x24')](saveUpdates(_0x357f5e['body'],null))[_0x6e99('0x24')](respondWithResult(_0x136cd0,null))['catch'](handleError(_0x136cd0,null));};exports[_0x6e99('0x25')]=function(_0x27cf43,_0x135acb){return db[_0x6e99('0x2d')][_0x6e99('0x48')]({'where':{'id':_0x27cf43['params']['id']}})['then'](handleEntityNotFound(_0x135acb,null))['then'](removeEntity(_0x135acb,null))[_0x6e99('0x41')](handleError(_0x135acb,null));}; \ No newline at end of file +var _0x5129=['api','../../config/utils','../../config/environment','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','map','Dynamics365Field','rawAttributes','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x3161e3,_0x4455ae){var _0x4b9b0b=function(_0x330eaa){while(--_0x330eaa){_0x3161e3['push'](_0x3161e3['shift']());}};_0x4b9b0b(++_0x4455ae);}(_0x5129,0x18a));var _0x9512=function(_0x2b2ab9,_0x2fb335){_0x2b2ab9=_0x2b2ab9-0x0;var _0x56b6d7=_0x5129[_0x2b2ab9];return _0x56b6d7;};'use strict';var emlformat=require(_0x9512('0x0'));var rimraf=require(_0x9512('0x1'));var zipdir=require(_0x9512('0x2'));var jsonpatch=require(_0x9512('0x3'));var rp=require(_0x9512('0x4'));var moment=require('moment');var BPromise=require(_0x9512('0x5'));var Mustache=require(_0x9512('0x6'));var util=require(_0x9512('0x7'));var path=require(_0x9512('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9512('0x9'));var _=require('lodash');var squel=require(_0x9512('0xa'));var crypto=require('crypto');var jsforce=require(_0x9512('0xb'));var deskjs=require(_0x9512('0xc'));var toCsv=require(_0x9512('0xd'));var querystring=require(_0x9512('0xe'));var Papa=require(_0x9512('0xf'));var Redis=require(_0x9512('0x10'));var authService=require(_0x9512('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9512('0x12'));var logger=require(_0x9512('0x13'))(_0x9512('0x14'));var utils=require(_0x9512('0x15'));var config=require(_0x9512('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1bd94c,_0x523abe){_0x523abe=_0x523abe||0xcc;return function(_0x18b976){if(_0x18b976){return _0x1bd94c['sendStatus'](_0x523abe);}return _0x1bd94c['status'](_0x523abe)[_0x9512('0x17')]();};}function respondWithResult(_0xde77,_0x590638){_0x590638=_0x590638||0xc8;return function(_0x1529b6){if(_0x1529b6){return _0xde77[_0x9512('0x18')](_0x590638)[_0x9512('0x19')](_0x1529b6);}};}function respondWithFilteredResult(_0x552090,_0xb3a758){return function(_0x180771){if(_0x180771){var _0x1bd26c=typeof _0xb3a758[_0x9512('0x1a')]===_0x9512('0x1b')&&typeof _0xb3a758[_0x9512('0x1c')]===_0x9512('0x1b');var _0x38a946=_0x180771[_0x9512('0x1d')];var _0x54a487=_0x1bd26c?0x0:_0xb3a758['offset'];var _0x15645a=_0x1bd26c?_0x180771[_0x9512('0x1d')]:_0xb3a758[_0x9512('0x1a')]+_0xb3a758[_0x9512('0x1c')];var _0xc66ade;if(_0x15645a>=_0x38a946){_0x15645a=_0x38a946;_0xc66ade=0xc8;}else{_0xc66ade=0xce;}_0x552090[_0x9512('0x18')](_0xc66ade);return _0x552090[_0x9512('0x1e')](_0x9512('0x1f'),_0x54a487+'-'+_0x15645a+'/'+_0x38a946)[_0x9512('0x19')](_0x180771);}return null;};}function patchUpdates(_0x414d6f){return function(_0x38dd0a){try{jsonpatch[_0x9512('0x20')](_0x38dd0a,_0x414d6f,!![]);}catch(_0x3f5e60){return BPromise[_0x9512('0x21')](_0x3f5e60);}return _0x38dd0a[_0x9512('0x22')]();};}function saveUpdates(_0x42e113,_0xa84417){return function(_0x116331){if(_0x116331){return _0x116331[_0x9512('0x23')](_0x42e113)[_0x9512('0x24')](function(_0x28cbd3){return _0x28cbd3;});}return null;};}function removeEntity(_0x41dad3,_0x3fea03){return function(_0x2ed7be){if(_0x2ed7be){return _0x2ed7be[_0x9512('0x25')]()['then'](function(){_0x41dad3[_0x9512('0x18')](0xcc)[_0x9512('0x17')]();});}};}function handleEntityNotFound(_0x20a60d,_0x18cc48){return function(_0x2c7504){if(!_0x2c7504){_0x20a60d[_0x9512('0x26')](0x194);}return _0x2c7504;};}function handleError(_0x3d8199,_0x4d805c){_0x4d805c=_0x4d805c||0x1f4;return function(_0x2262c7){logger['error'](_0x2262c7[_0x9512('0x27')]);if(_0x2262c7[_0x9512('0x28')]){delete _0x2262c7[_0x9512('0x28')];}_0x3d8199[_0x9512('0x18')](_0x4d805c)['send'](_0x2262c7);};}exports['index']=function(_0x20c197,_0x3ffa70){var _0x4092b5={},_0x8a1be6={},_0x221ea6={'count':0x0,'rows':[]};var _0x17f494=_[_0x9512('0x29')](db[_0x9512('0x2a')][_0x9512('0x2b')],function(_0x10f962){return{'name':_0x10f962['fieldName'],'type':_0x10f962['type']['key']};});_0x8a1be6[_0x9512('0x2c')]=_[_0x9512('0x29')](_0x17f494,_0x9512('0x28'));_0x8a1be6[_0x9512('0x2d')]=_[_0x9512('0x2e')](_0x20c197[_0x9512('0x2d')]);_0x8a1be6['filters']=_[_0x9512('0x2f')](_0x8a1be6[_0x9512('0x2c')],_0x8a1be6[_0x9512('0x2d')]);_0x4092b5[_0x9512('0x30')]=_[_0x9512('0x2f')](_0x8a1be6[_0x9512('0x2c')],qs[_0x9512('0x31')](_0x20c197['query'][_0x9512('0x31')]));_0x4092b5[_0x9512('0x30')]=_0x4092b5[_0x9512('0x30')][_0x9512('0x32')]?_0x4092b5[_0x9512('0x30')]:_0x8a1be6['model'];if(!_0x20c197[_0x9512('0x2d')]['hasOwnProperty'](_0x9512('0x33'))){_0x4092b5[_0x9512('0x1c')]=qs['limit'](_0x20c197[_0x9512('0x2d')][_0x9512('0x1c')]);_0x4092b5[_0x9512('0x1a')]=qs[_0x9512('0x1a')](_0x20c197[_0x9512('0x2d')]['offset']);}_0x4092b5[_0x9512('0x34')]=qs[_0x9512('0x35')](_0x20c197[_0x9512('0x2d')]['sort']);_0x4092b5[_0x9512('0x36')]=qs['filters'](_[_0x9512('0x37')](_0x20c197[_0x9512('0x2d')],_0x8a1be6[_0x9512('0x38')]),_0x17f494);if(_0x20c197[_0x9512('0x2d')][_0x9512('0x39')]){_0x4092b5[_0x9512('0x36')]=_['merge'](_0x4092b5['where'],{'$or':_[_0x9512('0x29')](_0x17f494,function(_0x3d9852){if(_0x3d9852['type']!=='VIRTUAL'){var _0x22fa7b={};_0x22fa7b[_0x3d9852[_0x9512('0x28')]]={'$like':'%'+_0x20c197[_0x9512('0x2d')][_0x9512('0x39')]+'%'};return _0x22fa7b;}})});}_0x4092b5=_['merge']({},_0x4092b5,_0x20c197[_0x9512('0x3a')]);var _0x365d7e={'where':_0x4092b5[_0x9512('0x36')]};return db[_0x9512('0x2a')][_0x9512('0x1d')](_0x365d7e)[_0x9512('0x24')](function(_0x351b9b){_0x221ea6[_0x9512('0x1d')]=_0x351b9b;if(_0x20c197[_0x9512('0x2d')]['includeAll']){_0x4092b5[_0x9512('0x3b')]=[{'all':!![]}];}return db[_0x9512('0x2a')][_0x9512('0x3c')](_0x4092b5);})[_0x9512('0x24')](function(_0x30cf6b){_0x221ea6[_0x9512('0x3d')]=_0x30cf6b;return _0x221ea6;})[_0x9512('0x24')](respondWithFilteredResult(_0x3ffa70,_0x4092b5))[_0x9512('0x3e')](handleError(_0x3ffa70,null));};exports[_0x9512('0x3f')]=function(_0x37b964,_0x4035b9){var _0x256a7e={'raw':!![],'where':{'id':_0x37b964[_0x9512('0x40')]['id']}},_0x28b71a={};_0x28b71a[_0x9512('0x2c')]=_['keys'](db[_0x9512('0x2a')]['rawAttributes']);_0x28b71a['query']=_['keys'](_0x37b964[_0x9512('0x2d')]);_0x28b71a[_0x9512('0x38')]=_['intersection'](_0x28b71a[_0x9512('0x2c')],_0x28b71a[_0x9512('0x2d')]);_0x256a7e[_0x9512('0x30')]=_['intersection'](_0x28b71a[_0x9512('0x2c')],qs[_0x9512('0x31')](_0x37b964['query'][_0x9512('0x31')]));_0x256a7e['attributes']=_0x256a7e[_0x9512('0x30')][_0x9512('0x32')]?_0x256a7e[_0x9512('0x30')]:_0x28b71a[_0x9512('0x2c')];if(_0x37b964['query'][_0x9512('0x41')]){_0x256a7e[_0x9512('0x3b')]=[{'all':!![]}];}_0x256a7e=_['merge']({},_0x256a7e,_0x37b964[_0x9512('0x3a')]);return db['Dynamics365Field']['find'](_0x256a7e)[_0x9512('0x24')](handleEntityNotFound(_0x4035b9,null))[_0x9512('0x24')](respondWithResult(_0x4035b9,null))[_0x9512('0x3e')](handleError(_0x4035b9,null));};exports[_0x9512('0x42')]=function(_0x3b1723,_0x427725){return db[_0x9512('0x2a')][_0x9512('0x42')](_0x3b1723[_0x9512('0x43')],{})[_0x9512('0x24')](respondWithResult(_0x427725,0xc9))[_0x9512('0x3e')](handleError(_0x427725,null));};exports['update']=function(_0x998f2e,_0x30229f){if(_0x998f2e['body']['id']){delete _0x998f2e[_0x9512('0x43')]['id'];}return db[_0x9512('0x2a')][_0x9512('0x44')]({'where':{'id':_0x998f2e['params']['id']}})[_0x9512('0x24')](handleEntityNotFound(_0x30229f,null))[_0x9512('0x24')](saveUpdates(_0x998f2e[_0x9512('0x43')],null))[_0x9512('0x24')](respondWithResult(_0x30229f,null))['catch'](handleError(_0x30229f,null));};exports['destroy']=function(_0x374322,_0x5a2fa8){return db['Dynamics365Field'][_0x9512('0x44')]({'where':{'id':_0x374322[_0x9512('0x40')]['id']}})[_0x9512('0x24')](handleEntityNotFound(_0x5a2fa8,null))['then'](removeEntity(_0x5a2fa8,null))[_0x9512('0x3e')](handleError(_0x5a2fa8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index f4e2e5c..83766c3 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 _0x56a9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','api'];(function(_0x560551,_0xce9fe7){var _0x1e06b6=function(_0x19a9ab){while(--_0x19a9ab){_0x560551['push'](_0x560551['shift']());}};_0x1e06b6(++_0xce9fe7);}(_0x56a9,0x140));var _0x956a=function(_0x5c468f,_0x2e5c25){_0x5c468f=_0x5c468f-0x0;var _0x2136b0=_0x56a9[_0x5c468f];return _0x2136b0;};'use strict';var _=require(_0x956a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x956a('0x1'));var moment=require(_0x956a('0x2'));var BPromise=require(_0x956a('0x3'));var rp=require(_0x956a('0x4'));var fs=require('fs');var path=require(_0x956a('0x5'));var rimraf=require(_0x956a('0x6'));var config=require(_0x956a('0x7'));var attributes=require('./intDynamics365Field.attributes');module['exports']=function(_0x104cb7,_0x1f8737){return _0x104cb7[_0x956a('0x8')](_0x956a('0x9'),attributes,{'tableName':_0x956a('0xa'),'paranoid':![],'indexes':[{'name':_0x956a('0xb'),'fields':[_0x956a('0xc'),_0x956a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf8e6=['api','path','../../config/environment','exports','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','../../config/logger'];(function(_0x48a1c1,_0x72f8f1){var _0x437b49=function(_0x522492){while(--_0x522492){_0x48a1c1['push'](_0x48a1c1['shift']());}};_0x437b49(++_0x72f8f1);}(_0xf8e6,0x1c0));var _0x6f8e=function(_0x5627a0,_0x5807f7){_0x5627a0=_0x5627a0-0x0;var _0x30ad3c=_0xf8e6[_0x5627a0];return _0x30ad3c;};'use strict';var _=require(_0x6f8e('0x0'));var util=require('util');var logger=require(_0x6f8e('0x1'))(_0x6f8e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f8e('0x3'));var rimraf=require('rimraf');var config=require(_0x6f8e('0x4'));var attributes=require('./intDynamics365Field.attributes');module[_0x6f8e('0x5')]=function(_0x7e766f,_0x2a3cc0){return _0x7e766f['define'](_0x6f8e('0x6'),attributes,{'tableName':_0x6f8e('0x7'),'paranoid':![],'indexes':[{'name':_0x6f8e('0x8'),'fields':[_0x6f8e('0x9'),'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 5e6a3bb..ea2be9a 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 _0x5300=['message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x104d3f,_0xd485d7){var _0x2fa844=function(_0x3d3861){while(--_0x3d3861){_0x104d3f['push'](_0x104d3f['shift']());}};_0x2fa844(++_0xd485d7);}(_0x5300,0xa5));var _0x0530=function(_0x3bd0ca,_0x3c2a6d){_0x3bd0ca=_0x3bd0ca-0x0;var _0x21dca1=_0x5300[_0x3bd0ca];return _0x21dca1;};'use strict';var _=require(_0x0530('0x0'));var util=require(_0x0530('0x1'));var moment=require(_0x0530('0x2'));var BPromise=require('bluebird');var rs=require(_0x0530('0x3'));var fs=require('fs');var Redis=require(_0x0530('0x4'));var db=require(_0x0530('0x5'))['db'];var utils=require(_0x0530('0x6'));var logger=require(_0x0530('0x7'))(_0x0530('0x8'));var config=require('../../config/environment');var jayson=require(_0x0530('0x9'));var client=jayson[_0x0530('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x491f84,_0x3932fe,_0x502e88){return new BPromise(function(_0x323da2,_0x291acf){return client[_0x0530('0xb')](_0x491f84,_0x502e88)[_0x0530('0xc')](function(_0x34f472){logger[_0x0530('0xd')](_0x0530('0xe'),_0x3932fe,'request\x20sent');logger[_0x0530('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3932fe,'request\x20sent',JSON[_0x0530('0x10')](_0x34f472));if(_0x34f472[_0x0530('0x11')]){if(_0x34f472[_0x0530('0x11')][_0x0530('0x12')]===0x1f4){logger[_0x0530('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x3932fe,_0x34f472[_0x0530('0x11')][_0x0530('0x13')]);return _0x291acf(_0x34f472[_0x0530('0x11')][_0x0530('0x13')]);}logger['error'](_0x0530('0xe'),_0x3932fe,_0x34f472[_0x0530('0x11')][_0x0530('0x13')]);return _0x323da2(_0x34f472[_0x0530('0x11')][_0x0530('0x13')]);}else{logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x3932fe,_0x0530('0x14'));_0x323da2(_0x34f472[_0x0530('0x15')][_0x0530('0x13')]);}})[_0x0530('0x16')](function(_0x17260c){logger[_0x0530('0x11')]('Dynamics365Field,\x20%s,\x20%s',_0x3932fe,_0x17260c);_0x291acf(_0x17260c);});});} \ No newline at end of file +var _0x7db0=['request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7db0,0xca));var _0x07db=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x7db0[_0x4ec520];return _0xed49d7;};'use strict';var _=require(_0x07db('0x0'));var util=require(_0x07db('0x1'));var moment=require(_0x07db('0x2'));var BPromise=require('bluebird');var rs=require(_0x07db('0x3'));var fs=require('fs');var Redis=require(_0x07db('0x4'));var db=require(_0x07db('0x5'))['db'];var utils=require(_0x07db('0x6'));var logger=require(_0x07db('0x7'))(_0x07db('0x8'));var config=require(_0x07db('0x9'));var jayson=require(_0x07db('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x189690,_0x593d74,_0x30dfb6){return new BPromise(function(_0x2e2ac9,_0x32b331){return client[_0x07db('0xb')](_0x189690,_0x30dfb6)[_0x07db('0xc')](function(_0x11c56c){logger[_0x07db('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x593d74,_0x07db('0xe'));logger[_0x07db('0xf')](_0x07db('0x10'),_0x593d74,'request\x20sent',JSON[_0x07db('0x11')](_0x11c56c));if(_0x11c56c[_0x07db('0x12')]){if(_0x11c56c[_0x07db('0x12')][_0x07db('0x13')]===0x1f4){logger['error'](_0x07db('0x14'),_0x593d74,_0x11c56c['error']['message']);return _0x32b331(_0x11c56c[_0x07db('0x12')]['message']);}logger[_0x07db('0x12')](_0x07db('0x14'),_0x593d74,_0x11c56c[_0x07db('0x12')]['message']);return _0x2e2ac9(_0x11c56c['error'][_0x07db('0x15')]);}else{logger[_0x07db('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x593d74,_0x07db('0xe'));_0x2e2ac9(_0x11c56c[_0x07db('0x16')]['message']);}})[_0x07db('0x17')](function(_0x71bc33){logger[_0x07db('0x12')](_0x07db('0x14'),_0x593d74,_0x71bc33);_0x32b331(_0x71bc33);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 7a0ed9f..af1ffe0 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 _0x0a52=['create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x30dedb,_0x534bf5){var _0x4f3869=function(_0x995cb0){while(--_0x995cb0){_0x30dedb['push'](_0x30dedb['shift']());}};_0x4f3869(++_0x534bf5);}(_0x0a52,0x89));var _0x20a5=function(_0x433774,_0x399331){_0x433774=_0x433774-0x0;var _0x34900a=_0x0a52[_0x433774];return _0x34900a;};'use strict';var multer=require(_0x20a5('0x0'));var util=require(_0x20a5('0x1'));var path=require(_0x20a5('0x2'));var timeout=require(_0x20a5('0x3'));var express=require(_0x20a5('0x4'));var router=express[_0x20a5('0x5')]();var fs_extra=require(_0x20a5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x20a5('0x7'));var config=require(_0x20a5('0x8'));var controller=require(_0x20a5('0x9'));router['get']('/',auth[_0x20a5('0xa')](),controller[_0x20a5('0xb')]);router[_0x20a5('0xc')](_0x20a5('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x20a5('0xe'),auth['isAuthenticated'](),controller[_0x20a5('0xf')]);router[_0x20a5('0xc')](_0x20a5('0x10'),auth[_0x20a5('0xa')](),controller[_0x20a5('0x11')]);router[_0x20a5('0x12')]('/',auth[_0x20a5('0xa')](),controller[_0x20a5('0x13')]);router['post']('/:id/configurations',auth[_0x20a5('0xa')](),controller[_0x20a5('0x14')]);router[_0x20a5('0x15')](_0x20a5('0xd'),auth[_0x20a5('0xa')](),controller[_0x20a5('0x16')]);router[_0x20a5('0x17')]('/:id',auth[_0x20a5('0xa')](),controller[_0x20a5('0x18')]);module[_0x20a5('0x19')]=router; \ No newline at end of file +var _0x51e7=['getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','destroy','multer','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0x51e7,0x135));var _0x751e=function(_0x4cf389,_0x27ef49){_0x4cf389=_0x4cf389-0x0;var _0x476a5b=_0x51e7[_0x4cf389];return _0x476a5b;};'use strict';var multer=require(_0x751e('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x751e('0x1')]();var fs_extra=require(_0x751e('0x2'));var auth=require(_0x751e('0x3'));var interaction=require(_0x751e('0x4'));var config=require(_0x751e('0x5'));var controller=require(_0x751e('0x6'));router[_0x751e('0x7')]('/',auth[_0x751e('0x8')](),controller['index']);router[_0x751e('0x7')](_0x751e('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x751e('0x7')](_0x751e('0xa'),auth[_0x751e('0x8')](),controller[_0x751e('0xb')]);router[_0x751e('0x7')](_0x751e('0xc'),auth[_0x751e('0x8')](),controller[_0x751e('0xd')]);router[_0x751e('0xe')]('/',auth[_0x751e('0x8')](),controller[_0x751e('0xf')]);router[_0x751e('0xe')]('/:id/configurations',auth[_0x751e('0x8')](),controller[_0x751e('0x10')]);router[_0x751e('0x11')](_0x751e('0x9'),auth[_0x751e('0x8')](),controller['update']);router[_0x751e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x751e('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 14361a0..9ec316b 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 _0x896e=['exports','STRING','username','remoteUri','sequelize'];(function(_0x542a5d,_0x27e6c8){var _0x251378=function(_0x295247){while(--_0x295247){_0x542a5d['push'](_0x542a5d['shift']());}};_0x251378(++_0x27e6c8);}(_0x896e,0x1e9));var _0xe896=function(_0x3a317b,_0x8e4b4a){_0x3a317b=_0x3a317b-0x0;var _0x29cba6=_0x896e[_0x3a317b];return _0x29cba6;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')]},'description':{'type':Sequelize[_0xe896('0x2')]},'username':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x3')},'apiKey':{'type':Sequelize[_0xe896('0x2')]},'remoteUri':{'type':Sequelize[_0xe896('0x2')],'unique':_0xe896('0x4')},'serverUrl':{'type':Sequelize[_0xe896('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa456=['STRING','username','sequelize','exports'];(function(_0x409375,_0x327fa8){var _0x5da910=function(_0x96cf7){while(--_0x96cf7){_0x409375['push'](_0x409375['shift']());}};_0x5da910(++_0x327fa8);}(_0xa456,0x142));var _0x6a45=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xa456[_0x341e0f];return _0x59555a;};'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 diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index d42a5ec..053fcb0 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 _0xa699=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','error','stack','name','send','FreshdeskAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','length','options','find','create','body','update','params','getConfigurations','findOne','FreshdeskConfiguration','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','%s:X','toString','base64','subject','agent','description','priority','source','ticket_type','group','company','remove','includes','label','default','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa699,0x6b));var _0x9a69=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0xa699[_0x2c1114];return _0x2b877c;};'use strict';var emlformat=require(_0x9a69('0x0'));var rimraf=require(_0x9a69('0x1'));var zipdir=require(_0x9a69('0x2'));var jsonpatch=require(_0x9a69('0x3'));var rp=require(_0x9a69('0x4'));var moment=require(_0x9a69('0x5'));var BPromise=require(_0x9a69('0x6'));var Mustache=require(_0x9a69('0x7'));var util=require(_0x9a69('0x8'));var path=require(_0x9a69('0x9'));var sox=require(_0x9a69('0xa'));var csv=require(_0x9a69('0xb'));var ejs=require(_0x9a69('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a69('0xd'));var squel=require(_0x9a69('0xe'));var crypto=require(_0x9a69('0xf'));var jsforce=require(_0x9a69('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9a69('0xb'));var querystring=require(_0x9a69('0x11'));var Papa=require(_0x9a69('0x12'));var Redis=require(_0x9a69('0x13'));var authService=require(_0x9a69('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a69('0x15'));var logger=require('../../config/logger')(_0x9a69('0x16'));var utils=require(_0x9a69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9a69('0x18'));var db=require(_0x9a69('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x81dfb1,_0x2e613e){_0x2e613e=_0x2e613e||0xcc;return function(_0x57e34){if(_0x57e34){return _0x81dfb1[_0x9a69('0x1a')](_0x2e613e);}return _0x81dfb1[_0x9a69('0x1b')](_0x2e613e)[_0x9a69('0x1c')]();};}function respondWithResult(_0x34b5b0,_0x2a5b83){_0x2a5b83=_0x2a5b83||0xc8;return function(_0x1581d6){if(_0x1581d6){return _0x34b5b0['status'](_0x2a5b83)[_0x9a69('0x1d')](_0x1581d6);}};}function respondWithFilteredResult(_0x17de41,_0x2be3ec){return function(_0x5e982d){if(_0x5e982d){var _0x13fd7=typeof _0x2be3ec[_0x9a69('0x1e')]===_0x9a69('0x1f')&&typeof _0x2be3ec[_0x9a69('0x20')]===_0x9a69('0x1f');var _0x5b5161=_0x5e982d[_0x9a69('0x21')];var _0x2a6a0d=_0x13fd7?0x0:_0x2be3ec[_0x9a69('0x1e')];var _0x334474=_0x13fd7?_0x5e982d[_0x9a69('0x21')]:_0x2be3ec[_0x9a69('0x1e')]+_0x2be3ec[_0x9a69('0x20')];var _0x45cae5;if(_0x334474>=_0x5b5161){_0x334474=_0x5b5161;_0x45cae5=0xc8;}else{_0x45cae5=0xce;}_0x17de41[_0x9a69('0x1b')](_0x45cae5);return _0x17de41[_0x9a69('0x22')]('Content-Range',_0x2a6a0d+'-'+_0x334474+'/'+_0x5b5161)['json'](_0x5e982d);}return null;};}function patchUpdates(_0x5ebb09){return function(_0x426f72){try{jsonpatch[_0x9a69('0x23')](_0x426f72,_0x5ebb09,!![]);}catch(_0x518620){return BPromise[_0x9a69('0x24')](_0x518620);}return _0x426f72[_0x9a69('0x25')]();};}function saveUpdates(_0x265291,_0x4d6a93){return function(_0x4b9b28){if(_0x4b9b28){return _0x4b9b28['update'](_0x265291)[_0x9a69('0x26')](function(_0x5f4138){return _0x5f4138;});}return null;};}function removeEntity(_0x140cbe,_0x28f5f7){return function(_0x256cc1){if(_0x256cc1){return _0x256cc1[_0x9a69('0x27')]()['then'](function(){_0x140cbe[_0x9a69('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203d32,_0x4ef126){return function(_0x5ac01c){if(!_0x5ac01c){_0x203d32[_0x9a69('0x1a')](0x194);}return _0x5ac01c;};}function handleError(_0xf6fea2,_0x268cef){_0x268cef=_0x268cef||0x1f4;return function(_0xbe0597){logger[_0x9a69('0x28')](_0xbe0597[_0x9a69('0x29')]);if(_0xbe0597[_0x9a69('0x2a')]){delete _0xbe0597[_0x9a69('0x2a')];}_0xf6fea2[_0x9a69('0x1b')](_0x268cef)[_0x9a69('0x2b')](_0xbe0597);};}exports['index']=function(_0x1ff48e,_0x165a87){var _0x5433b3={},_0x54e643={},_0x4b3539={'count':0x0,'rows':[]};var _0x1f976b=_['map'](db[_0x9a69('0x2c')][_0x9a69('0x2d')],function(_0x31b83b){return{'name':_0x31b83b[_0x9a69('0x2e')],'type':_0x31b83b[_0x9a69('0x2f')][_0x9a69('0x30')]};});_0x54e643[_0x9a69('0x31')]=_[_0x9a69('0x32')](_0x1f976b,_0x9a69('0x2a'));_0x54e643[_0x9a69('0x33')]=_[_0x9a69('0x34')](_0x1ff48e[_0x9a69('0x33')]);_0x54e643[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x54e643[_0x9a69('0x31')],_0x54e643[_0x9a69('0x33')]);_0x5433b3[_0x9a69('0x37')]=_['intersection'](_0x54e643['model'],qs[_0x9a69('0x38')](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x38')]));_0x5433b3[_0x9a69('0x37')]=_0x5433b3[_0x9a69('0x37')]['length']?_0x5433b3['attributes']:_0x54e643['model'];if(!_0x1ff48e['query'][_0x9a69('0x39')](_0x9a69('0x3a'))){_0x5433b3[_0x9a69('0x20')]=qs[_0x9a69('0x20')](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x20')]);_0x5433b3['offset']=qs['offset'](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x1e')]);}_0x5433b3[_0x9a69('0x3b')]=qs['sort'](_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x3c')]);_0x5433b3[_0x9a69('0x3d')]=qs[_0x9a69('0x35')](_[_0x9a69('0x3e')](_0x1ff48e[_0x9a69('0x33')],_0x54e643[_0x9a69('0x35')]),_0x1f976b);if(_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x3f')]){_0x5433b3[_0x9a69('0x3d')]=_[_0x9a69('0x40')](_0x5433b3['where'],{'$or':_[_0x9a69('0x32')](_0x1f976b,function(_0x524958){if(_0x524958['type']!=='VIRTUAL'){var _0x5dd195={};_0x5dd195[_0x524958[_0x9a69('0x2a')]]={'$like':'%'+_0x1ff48e[_0x9a69('0x33')]['filter']+'%'};return _0x5dd195;}})});}_0x5433b3=_['merge']({},_0x5433b3,_0x1ff48e['options']);var _0x28100b={'where':_0x5433b3[_0x9a69('0x3d')]};return db[_0x9a69('0x2c')]['count'](_0x28100b)[_0x9a69('0x26')](function(_0x36aa5f){_0x4b3539[_0x9a69('0x21')]=_0x36aa5f;if(_0x1ff48e[_0x9a69('0x33')][_0x9a69('0x41')]){_0x5433b3[_0x9a69('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x9a69('0x43')](_0x5433b3);})[_0x9a69('0x26')](function(_0x1d54c9){_0x4b3539[_0x9a69('0x44')]=_0x1d54c9;return _0x4b3539;})['then'](respondWithFilteredResult(_0x165a87,_0x5433b3))[_0x9a69('0x45')](handleError(_0x165a87,null));};exports[_0x9a69('0x46')]=function(_0x5b309a,_0x318de1){var _0x3c78e2={'raw':![],'where':{'id':_0x5b309a['params']['id']}},_0x23b174={};_0x23b174['model']=_['keys'](db[_0x9a69('0x2c')][_0x9a69('0x2d')]);_0x23b174[_0x9a69('0x33')]=_[_0x9a69('0x34')](_0x5b309a['query']);_0x23b174[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x23b174[_0x9a69('0x31')],_0x23b174[_0x9a69('0x33')]);_0x3c78e2['attributes']=_[_0x9a69('0x36')](_0x23b174[_0x9a69('0x31')],qs[_0x9a69('0x38')](_0x5b309a[_0x9a69('0x33')]['fields']));_0x3c78e2[_0x9a69('0x37')]=_0x3c78e2['attributes'][_0x9a69('0x47')]?_0x3c78e2['attributes']:_0x23b174[_0x9a69('0x31')];if(_0x5b309a['query'][_0x9a69('0x41')]){_0x3c78e2['include']=[{'all':!![]}];}_0x3c78e2=_[_0x9a69('0x40')]({},_0x3c78e2,_0x5b309a[_0x9a69('0x48')]);return db[_0x9a69('0x2c')][_0x9a69('0x49')](_0x3c78e2)['then'](handleEntityNotFound(_0x318de1,null))[_0x9a69('0x26')](respondWithResult(_0x318de1,null))[_0x9a69('0x45')](handleError(_0x318de1,null));};exports[_0x9a69('0x4a')]=function(_0x2537b0,_0x18b0be){return db[_0x9a69('0x2c')][_0x9a69('0x4a')](_0x2537b0[_0x9a69('0x4b')],{})[_0x9a69('0x26')](respondWithResult(_0x18b0be,0xc9))['catch'](handleError(_0x18b0be,null));};exports[_0x9a69('0x4c')]=function(_0x6046a7,_0x1a104f){if(_0x6046a7[_0x9a69('0x4b')]['id']){delete _0x6046a7[_0x9a69('0x4b')]['id'];}return db[_0x9a69('0x2c')][_0x9a69('0x49')]({'where':{'id':_0x6046a7[_0x9a69('0x4d')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x1a104f,null))[_0x9a69('0x26')](saveUpdates(_0x6046a7[_0x9a69('0x4b')],null))[_0x9a69('0x26')](respondWithResult(_0x1a104f,null))[_0x9a69('0x45')](handleError(_0x1a104f,null));};exports[_0x9a69('0x27')]=function(_0x18ab7a,_0x4c5b25){return db[_0x9a69('0x2c')][_0x9a69('0x49')]({'where':{'id':_0x18ab7a[_0x9a69('0x4d')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x4c5b25,null))[_0x9a69('0x26')](removeEntity(_0x4c5b25,null))[_0x9a69('0x45')](handleError(_0x4c5b25,null));};exports[_0x9a69('0x4e')]=function(_0x52a75f,_0x15100e,_0xf378fd){var _0x2b7b66={};var _0x9a7c34={};var _0x18c353;var _0x32c826;return db[_0x9a69('0x2c')][_0x9a69('0x4f')]({'where':{'id':_0x52a75f[_0x9a69('0x4d')]['id']}})[_0x9a69('0x26')](handleEntityNotFound(_0x15100e,null))[_0x9a69('0x26')](function(_0x546243){if(_0x546243){_0x18c353=_0x546243;_0x9a7c34[_0x9a69('0x31')]=_[_0x9a69('0x34')](db[_0x9a69('0x50')]['rawAttributes']);_0x9a7c34[_0x9a69('0x33')]=_['keys'](_0x52a75f['query']);_0x9a7c34[_0x9a69('0x35')]=_[_0x9a69('0x36')](_0x9a7c34[_0x9a69('0x31')],_0x9a7c34[_0x9a69('0x33')]);_0x2b7b66['attributes']=_['intersection'](_0x9a7c34[_0x9a69('0x31')],qs['fields'](_0x52a75f[_0x9a69('0x33')]['fields']));_0x2b7b66['attributes']=_0x2b7b66[_0x9a69('0x37')][_0x9a69('0x47')]?_0x2b7b66[_0x9a69('0x37')]:_0x9a7c34[_0x9a69('0x31')];_0x2b7b66[_0x9a69('0x3b')]=qs[_0x9a69('0x3c')](_0x52a75f[_0x9a69('0x33')]['sort']);_0x2b7b66[_0x9a69('0x3d')]=qs[_0x9a69('0x35')](_[_0x9a69('0x3e')](_0x52a75f[_0x9a69('0x33')],_0x9a7c34['filters']));if(_0x52a75f[_0x9a69('0x33')][_0x9a69('0x3f')]){_0x2b7b66[_0x9a69('0x3d')]=_['merge'](_0x2b7b66[_0x9a69('0x3d')],{'$or':_[_0x9a69('0x32')](_0x2b7b66['attributes'],function(_0x533dcd){var _0x34ee21={};_0x34ee21[_0x533dcd]={'$like':'%'+_0x52a75f[_0x9a69('0x33')][_0x9a69('0x3f')]+'%'};return _0x34ee21;})});}_0x2b7b66=_[_0x9a69('0x40')]({},_0x2b7b66,_0x52a75f['options']);return _0x18c353['getConfigurations'](_0x2b7b66);}})[_0x9a69('0x26')](function(_0x37a9b6){if(_0x37a9b6){_0x32c826=_0x37a9b6['length'];if(!_0x52a75f[_0x9a69('0x33')][_0x9a69('0x39')]('nolimit')){_0x2b7b66[_0x9a69('0x20')]=qs['limit'](_0x52a75f[_0x9a69('0x33')]['limit']);_0x2b7b66['offset']=qs[_0x9a69('0x1e')](_0x52a75f[_0x9a69('0x33')][_0x9a69('0x1e')]);}return _0x18c353['getConfigurations'](_0x2b7b66);}})[_0x9a69('0x26')](function(_0x269cd7){if(_0x269cd7){return _0x269cd7?{'count':_0x32c826,'rows':_0x269cd7}:null;}})[_0x9a69('0x26')](respondWithResult(_0x15100e,null))[_0x9a69('0x45')](handleError(_0x15100e,null));};exports['addConfiguration']=function(_0x420057,_0x45549e,_0x665d9e){if(_0x420057[_0x9a69('0x4b')]['id']){delete _0x420057[_0x9a69('0x4b')]['id'];}return db[_0x9a69('0x2c')][_0x9a69('0x4f')]({'where':{'id':_0x420057[_0x9a69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45549e,null))[_0x9a69('0x26')](function(_0x51bf8d){if(_0x51bf8d){_0x420057['body']['AccountId']=_0x51bf8d['id'];_0x420057[_0x9a69('0x4b')][_0x9a69('0x51')]=integrations[_0x9a69('0x52')](_0x420057[_0x9a69('0x4b')][_0x9a69('0x53')],_0x420057[_0x9a69('0x4b')]['type']);_0x420057[_0x9a69('0x4b')]['Descriptions']=integrations[_0x9a69('0x54')](_0x420057[_0x9a69('0x4b')][_0x9a69('0x53')],_0x420057[_0x9a69('0x4b')][_0x9a69('0x2f')]);return db[_0x9a69('0x50')][_0x9a69('0x4a')](_0x420057['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x9a69('0x51')},{'model':db[_0x9a69('0x55')],'as':_0x9a69('0x56')}]});}return null;})['then'](respondWithResult(_0x45549e,null))[_0x9a69('0x45')](handleError(_0x45549e,null));};exports[_0x9a69('0x57')]=function(_0xb93218,_0x270e6b,_0xbbc647){var _0x2a7f48='';return db[_0x9a69('0x2c')]['findOne']({'where':{'id':_0xb93218['params']['id']},'attributes':['id',_0x9a69('0x58'),'apiKey']})['then'](handleEntityNotFound(_0x270e6b,null))[_0x9a69('0x26')](function(_0x428f46){if(_0x428f46){_0x2a7f48=_0x428f46[_0x9a69('0x58')];var _0x857872=_0x2a7f48[_0x9a69('0x59')](-0x1);if(_0x857872==='/'){_0x2a7f48=_0x2a7f48[_0x9a69('0x5a')](0x0,_0x2a7f48[_0x9a69('0x5b')](_0x857872));}return rp({'method':_0x9a69('0x5c'),'uri':util[_0x9a69('0x5d')](_0x9a69('0x5e'),_0x2a7f48,'api/v2/ticket_fields'),'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x9a69('0x5d')](_0x9a69('0x5f'),_0x428f46['apiKey']))[_0x9a69('0x60')](_0x9a69('0x61')))},'json':!![]});}})[_0x9a69('0x26')](function(_0x1e2948){if(_0x1e2948){var _0x180683=['requester',_0x9a69('0x62'),_0x9a69('0x63'),_0x9a69('0x64'),_0x9a69('0x1b'),_0x9a69('0x65'),'group',_0x9a69('0x66'),_0x9a69('0x67'),_0x9a69('0x68'),_0x9a69('0x69')];_[_0x9a69('0x6a')](_0x1e2948,function(_0x27dc6b){return _0x180683[_0x9a69('0x6b')](_0x27dc6b[_0x9a69('0x2a')])||!_0x27dc6b['default']&&_0x27dc6b[_0x9a69('0x2f')]!=='custom_text'&&_0x27dc6b[_0x9a69('0x2f')]!=='custom_dropdown';});return{'count':_0x1e2948[_0x9a69('0x47')],'rows':_[_0x9a69('0x32')](_0x1e2948,function(_0x3425ce){return{'id':_0x3425ce['name'],'name':_0x3425ce[_0x9a69('0x6c')],'custom':!_0x3425ce[_0x9a69('0x6d')],'options':_0x3425ce['choices']?_[_0x9a69('0x32')](_0x3425ce[_0x9a69('0x6e')],function(_0x29e6c4){return{'name':_[_0x9a69('0x6f')](_0x29e6c4),'value':_0x29e6c4};}):[]};})};}})['then'](respondWithResult(_0x270e6b,null))['catch'](function(_0x2abc56){var _0x5d4e64=_0xb93218[_0x9a69('0x33')][_0x9a69('0x70')]?0x1f4:_0x2abc56[_0x9a69('0x71')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x5d4e64,JSON[_0x9a69('0x72')](_0x2abc56));delete _0x2abc56['name'];if(_0x5d4e64===0x191){_0x5d4e64=0x190;}_0x270e6b['status'](_0x5d4e64)[_0x9a69('0x2b')](_0xb93218['query']['test']?{'message':_0x9a69('0x73'),'statusCode':_0x2abc56[_0x9a69('0x71')]}:_0x2abc56);});}; \ No newline at end of file +var _0xbdb7=['reject','save','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','FreshdeskAccount','include','findAll','rows','intersection','length','includeAll','options','catch','create','body','update','find','params','destroy','getConfigurations','hasOwnProperty','nolimit','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskConfiguration','FreshdeskField','getFields','apiKey','remoteUri','slice','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','requester','subject','agent','description','group','ticket_type','company','remove','includes','custom_text','label','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','Content-Range','apply'];(function(_0x13248d,_0x35184a){var _0x564f27=function(_0x32ce2c){while(--_0x32ce2c){_0x13248d['push'](_0x13248d['shift']());}};_0x564f27(++_0x35184a);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1ddd0,_0x15f9f4){_0x1ddd0=_0x1ddd0-0x0;var _0x4d86d0=_0xbdb7[_0x1ddd0];return _0x4d86d0;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];var integrations=require(_0x7bdb('0x17'));function respondWithStatusCode(_0x496613,_0x8d74ff){_0x8d74ff=_0x8d74ff||0xcc;return function(_0x53021d){if(_0x53021d){return _0x496613['sendStatus'](_0x8d74ff);}return _0x496613[_0x7bdb('0x18')](_0x8d74ff)[_0x7bdb('0x19')]();};}function respondWithResult(_0x4fd91a,_0x50eeca){_0x50eeca=_0x50eeca||0xc8;return function(_0x4e98f7){if(_0x4e98f7){return _0x4fd91a[_0x7bdb('0x18')](_0x50eeca)[_0x7bdb('0x1a')](_0x4e98f7);}};}function respondWithFilteredResult(_0xe9919f,_0x25d417){return function(_0x31c909){if(_0x31c909){var _0xbde12a=typeof _0x25d417[_0x7bdb('0x1b')]===_0x7bdb('0x1c')&&typeof _0x25d417['limit']===_0x7bdb('0x1c');var _0x43f352=_0x31c909[_0x7bdb('0x1d')];var _0x2aff6a=_0xbde12a?0x0:_0x25d417['offset'];var _0x41f540=_0xbde12a?_0x31c909[_0x7bdb('0x1d')]:_0x25d417['offset']+_0x25d417[_0x7bdb('0x1e')];var _0x31f78e;if(_0x41f540>=_0x43f352){_0x41f540=_0x43f352;_0x31f78e=0xc8;}else{_0x31f78e=0xce;}_0xe9919f[_0x7bdb('0x18')](_0x31f78e);return _0xe9919f[_0x7bdb('0x1f')](_0x7bdb('0x20'),_0x2aff6a+'-'+_0x41f540+'/'+_0x43f352)['json'](_0x31c909);}return null;};}function patchUpdates(_0x49f353){return function(_0x677825){try{jsonpatch[_0x7bdb('0x21')](_0x677825,_0x49f353,!![]);}catch(_0x5daea4){return BPromise[_0x7bdb('0x22')](_0x5daea4);}return _0x677825[_0x7bdb('0x23')]();};}function saveUpdates(_0x346c72,_0x3f53e7){return function(_0x3a1d0f){if(_0x3a1d0f){return _0x3a1d0f['update'](_0x346c72)[_0x7bdb('0x24')](function(_0xdad53d){return _0xdad53d;});}return null;};}function removeEntity(_0x40c447,_0x3a456f){return function(_0x481f4b){if(_0x481f4b){return _0x481f4b['destroy']()[_0x7bdb('0x24')](function(){_0x40c447['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9e02,_0x2abef6){return function(_0x51ab04){if(!_0x51ab04){_0x4a9e02[_0x7bdb('0x25')](0x194);}return _0x51ab04;};}function handleError(_0x72ba69,_0x3ec129){_0x3ec129=_0x3ec129||0x1f4;return function(_0x7c09cf){logger[_0x7bdb('0x26')](_0x7c09cf['stack']);if(_0x7c09cf[_0x7bdb('0x27')]){delete _0x7c09cf[_0x7bdb('0x27')];}_0x72ba69[_0x7bdb('0x18')](_0x3ec129)[_0x7bdb('0x28')](_0x7c09cf);};}exports[_0x7bdb('0x29')]=function(_0x2e8e65,_0x1e9996){var _0xd2d7be={},_0x25a1fe={},_0x365c02={'count':0x0,'rows':[]};var _0x9ec48d=_[_0x7bdb('0x2a')](db['FreshdeskAccount'][_0x7bdb('0x2b')],function(_0x23fc3a){return{'name':_0x23fc3a[_0x7bdb('0x2c')],'type':_0x23fc3a[_0x7bdb('0x2d')][_0x7bdb('0x2e')]};});_0x25a1fe['model']=_[_0x7bdb('0x2a')](_0x9ec48d,_0x7bdb('0x27'));_0x25a1fe[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x2e8e65['query']);_0x25a1fe['filters']=_['intersection'](_0x25a1fe[_0x7bdb('0x31')],_0x25a1fe['query']);_0xd2d7be[_0x7bdb('0x32')]=_['intersection'](_0x25a1fe[_0x7bdb('0x31')],qs[_0x7bdb('0x33')](_0x2e8e65[_0x7bdb('0x2f')]['fields']));_0xd2d7be[_0x7bdb('0x32')]=_0xd2d7be['attributes']['length']?_0xd2d7be[_0x7bdb('0x32')]:_0x25a1fe['model'];if(!_0x2e8e65[_0x7bdb('0x2f')]['hasOwnProperty']('nolimit')){_0xd2d7be[_0x7bdb('0x1e')]=qs[_0x7bdb('0x1e')](_0x2e8e65[_0x7bdb('0x2f')][_0x7bdb('0x1e')]);_0xd2d7be[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x2e8e65['query'][_0x7bdb('0x1b')]);}_0xd2d7be[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x2e8e65[_0x7bdb('0x2f')][_0x7bdb('0x35')]);_0xd2d7be[_0x7bdb('0x36')]=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x2e8e65[_0x7bdb('0x2f')],_0x25a1fe['filters']),_0x9ec48d);if(_0x2e8e65['query'][_0x7bdb('0x39')]){_0xd2d7be[_0x7bdb('0x36')]=_[_0x7bdb('0x3a')](_0xd2d7be[_0x7bdb('0x36')],{'$or':_[_0x7bdb('0x2a')](_0x9ec48d,function(_0x509e90){if(_0x509e90['type']!==_0x7bdb('0x3b')){var _0x5d7c1f={};_0x5d7c1f[_0x509e90[_0x7bdb('0x27')]]={'$like':'%'+_0x2e8e65['query'][_0x7bdb('0x39')]+'%'};return _0x5d7c1f;}})});}_0xd2d7be=_['merge']({},_0xd2d7be,_0x2e8e65['options']);var _0x21dae7={'where':_0xd2d7be[_0x7bdb('0x36')]};return db[_0x7bdb('0x3c')][_0x7bdb('0x1d')](_0x21dae7)[_0x7bdb('0x24')](function(_0x2b4829){_0x365c02[_0x7bdb('0x1d')]=_0x2b4829;if(_0x2e8e65['query']['includeAll']){_0xd2d7be[_0x7bdb('0x3d')]=[{'all':!![]}];}return db[_0x7bdb('0x3c')][_0x7bdb('0x3e')](_0xd2d7be);})[_0x7bdb('0x24')](function(_0x39fbca){_0x365c02[_0x7bdb('0x3f')]=_0x39fbca;return _0x365c02;})[_0x7bdb('0x24')](respondWithFilteredResult(_0x1e9996,_0xd2d7be))['catch'](handleError(_0x1e9996,null));};exports['show']=function(_0x1bcbcd,_0x8e893e){var _0x4636f8={'raw':![],'where':{'id':_0x1bcbcd['params']['id']}},_0x72a81c={};_0x72a81c[_0x7bdb('0x31')]=_['keys'](db[_0x7bdb('0x3c')][_0x7bdb('0x2b')]);_0x72a81c[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x1bcbcd[_0x7bdb('0x2f')]);_0x72a81c[_0x7bdb('0x37')]=_[_0x7bdb('0x40')](_0x72a81c[_0x7bdb('0x31')],_0x72a81c[_0x7bdb('0x2f')]);_0x4636f8['attributes']=_[_0x7bdb('0x40')](_0x72a81c[_0x7bdb('0x31')],qs['fields'](_0x1bcbcd[_0x7bdb('0x2f')]['fields']));_0x4636f8[_0x7bdb('0x32')]=_0x4636f8[_0x7bdb('0x32')][_0x7bdb('0x41')]?_0x4636f8[_0x7bdb('0x32')]:_0x72a81c[_0x7bdb('0x31')];if(_0x1bcbcd['query'][_0x7bdb('0x42')]){_0x4636f8[_0x7bdb('0x3d')]=[{'all':!![]}];}_0x4636f8=_[_0x7bdb('0x3a')]({},_0x4636f8,_0x1bcbcd[_0x7bdb('0x43')]);return db[_0x7bdb('0x3c')]['find'](_0x4636f8)[_0x7bdb('0x24')](handleEntityNotFound(_0x8e893e,null))[_0x7bdb('0x24')](respondWithResult(_0x8e893e,null))[_0x7bdb('0x44')](handleError(_0x8e893e,null));};exports[_0x7bdb('0x45')]=function(_0x259007,_0x25c534){return db[_0x7bdb('0x3c')][_0x7bdb('0x45')](_0x259007[_0x7bdb('0x46')],{})[_0x7bdb('0x24')](respondWithResult(_0x25c534,0xc9))['catch'](handleError(_0x25c534,null));};exports[_0x7bdb('0x47')]=function(_0x58c4bc,_0x47cccd){if(_0x58c4bc[_0x7bdb('0x46')]['id']){delete _0x58c4bc[_0x7bdb('0x46')]['id'];}return db['FreshdeskAccount'][_0x7bdb('0x48')]({'where':{'id':_0x58c4bc[_0x7bdb('0x49')]['id']}})['then'](handleEntityNotFound(_0x47cccd,null))['then'](saveUpdates(_0x58c4bc['body'],null))[_0x7bdb('0x24')](respondWithResult(_0x47cccd,null))[_0x7bdb('0x44')](handleError(_0x47cccd,null));};exports[_0x7bdb('0x4a')]=function(_0x46410c,_0x33687b){return db[_0x7bdb('0x3c')][_0x7bdb('0x48')]({'where':{'id':_0x46410c[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x33687b,null))[_0x7bdb('0x24')](removeEntity(_0x33687b,null))['catch'](handleError(_0x33687b,null));};exports[_0x7bdb('0x4b')]=function(_0x4806e0,_0x240425,_0x27358d){var _0x5d564d={};var _0x457886={};var _0x493d23;var _0x258f29;return db['FreshdeskAccount']['findOne']({'where':{'id':_0x4806e0[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x240425,null))['then'](function(_0x4e17f3){if(_0x4e17f3){_0x493d23=_0x4e17f3;_0x457886['model']=_[_0x7bdb('0x30')](db['FreshdeskConfiguration']['rawAttributes']);_0x457886[_0x7bdb('0x2f')]=_[_0x7bdb('0x30')](_0x4806e0[_0x7bdb('0x2f')]);_0x457886[_0x7bdb('0x37')]=_['intersection'](_0x457886[_0x7bdb('0x31')],_0x457886['query']);_0x5d564d[_0x7bdb('0x32')]=_[_0x7bdb('0x40')](_0x457886[_0x7bdb('0x31')],qs[_0x7bdb('0x33')](_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x33')]));_0x5d564d['attributes']=_0x5d564d[_0x7bdb('0x32')][_0x7bdb('0x41')]?_0x5d564d[_0x7bdb('0x32')]:_0x457886['model'];_0x5d564d[_0x7bdb('0x34')]=qs[_0x7bdb('0x35')](_0x4806e0['query'][_0x7bdb('0x35')]);_0x5d564d['where']=qs[_0x7bdb('0x37')](_[_0x7bdb('0x38')](_0x4806e0['query'],_0x457886['filters']));if(_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x39')]){_0x5d564d['where']=_[_0x7bdb('0x3a')](_0x5d564d['where'],{'$or':_[_0x7bdb('0x2a')](_0x5d564d['attributes'],function(_0x496cc3){var _0x22ef9c={};_0x22ef9c[_0x496cc3]={'$like':'%'+_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x39')]+'%'};return _0x22ef9c;})});}_0x5d564d=_[_0x7bdb('0x3a')]({},_0x5d564d,_0x4806e0[_0x7bdb('0x43')]);return _0x493d23[_0x7bdb('0x4b')](_0x5d564d);}})[_0x7bdb('0x24')](function(_0x8cf13a){if(_0x8cf13a){_0x258f29=_0x8cf13a[_0x7bdb('0x41')];if(!_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x4c')](_0x7bdb('0x4d'))){_0x5d564d['limit']=qs[_0x7bdb('0x1e')](_0x4806e0[_0x7bdb('0x2f')]['limit']);_0x5d564d[_0x7bdb('0x1b')]=qs[_0x7bdb('0x1b')](_0x4806e0[_0x7bdb('0x2f')][_0x7bdb('0x1b')]);}return _0x493d23[_0x7bdb('0x4b')](_0x5d564d);}})['then'](function(_0xa5624f){if(_0xa5624f){return _0xa5624f?{'count':_0x258f29,'rows':_0xa5624f}:null;}})[_0x7bdb('0x24')](respondWithResult(_0x240425,null))[_0x7bdb('0x44')](handleError(_0x240425,null));};exports['addConfiguration']=function(_0x3dbcf,_0x2c2fb7,_0x33b93a){if(_0x3dbcf[_0x7bdb('0x46')]['id']){delete _0x3dbcf[_0x7bdb('0x46')]['id'];}return db[_0x7bdb('0x3c')][_0x7bdb('0x4e')]({'where':{'id':_0x3dbcf[_0x7bdb('0x49')]['id']}})[_0x7bdb('0x24')](handleEntityNotFound(_0x2c2fb7,null))['then'](function(_0x7a7c4a){if(_0x7a7c4a){_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x4f')]=_0x7a7c4a['id'];_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x50')]=integrations[_0x7bdb('0x51')](_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x52')],_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x2d')]);_0x3dbcf[_0x7bdb('0x46')][_0x7bdb('0x53')]=integrations[_0x7bdb('0x54')](_0x3dbcf['body'][_0x7bdb('0x52')],_0x3dbcf['body'][_0x7bdb('0x2d')]);return db[_0x7bdb('0x55')][_0x7bdb('0x45')](_0x3dbcf['body'],{'include':[{'model':db[_0x7bdb('0x56')],'as':_0x7bdb('0x50')},{'model':db['FreshdeskField'],'as':_0x7bdb('0x53')}]});}return null;})[_0x7bdb('0x24')](respondWithResult(_0x2c2fb7,null))['catch'](handleError(_0x2c2fb7,null));};exports[_0x7bdb('0x57')]=function(_0x1a706b,_0x579caa,_0x291fd3){var _0x237688='';return db['FreshdeskAccount'][_0x7bdb('0x4e')]({'where':{'id':_0x1a706b[_0x7bdb('0x49')]['id']},'attributes':['id','remoteUri',_0x7bdb('0x58')]})['then'](handleEntityNotFound(_0x579caa,null))[_0x7bdb('0x24')](function(_0x25136b){if(_0x25136b){_0x237688=_0x25136b[_0x7bdb('0x59')];var _0x21dd9a=_0x237688[_0x7bdb('0x5a')](-0x1);if(_0x21dd9a==='/'){_0x237688=_0x237688['substring'](0x0,_0x237688['lastIndexOf'](_0x21dd9a));}return rp({'method':'GET','uri':util[_0x7bdb('0x5b')]('%s/%s',_0x237688,_0x7bdb('0x5c')),'headers':{'Authorization':util[_0x7bdb('0x5b')](_0x7bdb('0x5d'),new Buffer(util['format']('%s:X',_0x25136b[_0x7bdb('0x58')]))[_0x7bdb('0x5e')](_0x7bdb('0x5f')))},'json':!![]});}})[_0x7bdb('0x24')](function(_0x572cbe){if(_0x572cbe){var _0x194908=[_0x7bdb('0x60'),_0x7bdb('0x61'),_0x7bdb('0x62'),_0x7bdb('0x63'),_0x7bdb('0x18'),'priority',_0x7bdb('0x64'),'source',_0x7bdb('0x65'),'group',_0x7bdb('0x66')];_[_0x7bdb('0x67')](_0x572cbe,function(_0xee6d78){return _0x194908[_0x7bdb('0x68')](_0xee6d78[_0x7bdb('0x27')])||!_0xee6d78['default']&&_0xee6d78['type']!==_0x7bdb('0x69')&&_0xee6d78[_0x7bdb('0x2d')]!=='custom_dropdown';});return{'count':_0x572cbe[_0x7bdb('0x41')],'rows':_[_0x7bdb('0x2a')](_0x572cbe,function(_0x5a674b){return{'id':_0x5a674b[_0x7bdb('0x27')],'name':_0x5a674b[_0x7bdb('0x6a')],'custom':!_0x5a674b['default'],'options':_0x5a674b[_0x7bdb('0x6b')]?_['map'](_0x5a674b['choices'],function(_0x18d686){return{'name':_[_0x7bdb('0x6c')](_0x18d686),'value':_0x18d686};}):[]};})};}})['then'](respondWithResult(_0x579caa,null))['catch'](function(_0xd5881e){var _0x566a9e=_0x1a706b[_0x7bdb('0x2f')]['test']?0x1f4:_0xd5881e[_0x7bdb('0x6d')]||0x1f4;logger[_0x7bdb('0x26')](_0x7bdb('0x6e'),_0x7bdb('0x57'),_0x566a9e,JSON['stringify'](_0xd5881e));delete _0xd5881e[_0x7bdb('0x27')];if(_0x566a9e===0x191){_0x566a9e=0x190;}_0x579caa[_0x7bdb('0x18')](_0x566a9e)['send'](_0x1a706b[_0x7bdb('0x2f')][_0x7bdb('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0xd5881e[_0x7bdb('0x6d')]}:_0xd5881e);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index fb2083f..fecb371 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 _0xdabb=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','../../config/logger','api'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xdabb,0x1d9));var _0xbdab=function(_0x54a892,_0x1a4eeb){_0x54a892=_0x54a892-0x0;var _0x1f24f1=_0xdabb[_0x54a892];return _0x1f24f1;};'use strict';var _=require(_0xbdab('0x0'));var util=require('util');var logger=require(_0xbdab('0x1'))(_0xbdab('0x2'));var moment=require(_0xbdab('0x3'));var BPromise=require(_0xbdab('0x4'));var rp=require(_0xbdab('0x5'));var fs=require('fs');var path=require(_0xbdab('0x6'));var rimraf=require(_0xbdab('0x7'));var config=require(_0xbdab('0x8'));var attributes=require(_0xbdab('0x9'));var integrations=require(_0xbdab('0xa'));module[_0xbdab('0xb')]=function(_0x3d2b94,_0x279654){return _0x3d2b94[_0xbdab('0xc')](_0xbdab('0xd'),attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50ac=['lodash','util','moment','bluebird','path','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0x50ac,0x195));var _0xc50a=function(_0x3680bd,_0x47acd5){_0x3680bd=_0x3680bd-0x0;var _0x55c431=_0x50ac[_0x3680bd];return _0x55c431;};'use strict';var _=require(_0xc50a('0x0'));var util=require(_0xc50a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc50a('0x2'));var BPromise=require(_0xc50a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc50a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc50a('0x5'));var integrations=require('../../components/integrations/configuration');module[_0xc50a('0x6')]=function(_0x1d6b07,_0x34459b){return _0x1d6b07[_0xc50a('0x7')](_0xc50a('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 4f00701..8c22023 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 _0x233b=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','FreshdeskAccount,\x20%s,\x20%s','message','findAll','options','raw','where','attributes','limit','include','map','model','then','GetFreshdeskAccount','catch','FreshdeskAccount','ShowFreshdeskAccount','lodash','util','randomstring','ioredis'];(function(_0x3a7155,_0x3683f5){var _0x24b0e1=function(_0x399e7d){while(--_0x399e7d){_0x3a7155['push'](_0x3a7155['shift']());}};_0x24b0e1(++_0x3683f5);}(_0x233b,0xe3));var _0xb233=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x233b[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xb233('0x0'));var util=require(_0xb233('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb233('0x2'));var fs=require('fs');var Redis=require(_0xb233('0x3'));var db=require(_0xb233('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb233('0x5'))(_0xb233('0x6'));var config=require(_0xb233('0x7'));var jayson=require(_0xb233('0x8'));var client=jayson[_0xb233('0x9')][_0xb233('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b5bfa,_0x248133,_0x2c41b0){return new BPromise(function(_0x315c0c,_0x393f4e){return client[_0xb233('0xb')](_0x2b5bfa,_0x2c41b0)['then'](function(_0x2ac84f){logger[_0xb233('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x248133,_0xb233('0xd'));logger[_0xb233('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x248133,_0xb233('0xd'),JSON[_0xb233('0xf')](_0x2ac84f));if(_0x2ac84f[_0xb233('0x10')]){if(_0x2ac84f[_0xb233('0x10')]['code']===0x1f4){logger[_0xb233('0x10')](_0xb233('0x11'),_0x248133,_0x2ac84f[_0xb233('0x10')][_0xb233('0x12')]);return _0x393f4e(_0x2ac84f[_0xb233('0x10')][_0xb233('0x12')]);}logger['error'](_0xb233('0x11'),_0x248133,_0x2ac84f[_0xb233('0x10')][_0xb233('0x12')]);return _0x315c0c(_0x2ac84f[_0xb233('0x10')]['message']);}else{logger[_0xb233('0xc')](_0xb233('0x11'),_0x248133,_0xb233('0xd'));_0x315c0c(_0x2ac84f['result'][_0xb233('0x12')]);}})['catch'](function(_0x1ca838){logger[_0xb233('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x248133,_0x1ca838);_0x393f4e(_0x1ca838);});});}exports['GetFreshdeskAccount']=function(_0x1efa3c){var _0x1e828b=this;return new Promise(function(_0x4c47b8,_0x4df4a0){return db['FreshdeskAccount'][_0xb233('0x13')]({'raw':_0x1efa3c[_0xb233('0x14')]?_0x1efa3c[_0xb233('0x14')][_0xb233('0x15')]===undefined?!![]:![]:!![],'where':_0x1efa3c[_0xb233('0x14')]?_0x1efa3c[_0xb233('0x14')][_0xb233('0x16')]||null:null,'attributes':_0x1efa3c[_0xb233('0x14')]?_0x1efa3c[_0xb233('0x14')][_0xb233('0x17')]||null:null,'limit':_0x1efa3c[_0xb233('0x14')]?_0x1efa3c[_0xb233('0x14')][_0xb233('0x18')]||null:null,'include':_0x1efa3c[_0xb233('0x14')]?_0x1efa3c[_0xb233('0x14')][_0xb233('0x19')]?_[_0xb233('0x1a')](_0x1efa3c[_0xb233('0x14')][_0xb233('0x19')],function(_0x26d66d){return{'model':db[_0x26d66d[_0xb233('0x1b')]],'as':_0x26d66d['as'],'attributes':_0x26d66d[_0xb233('0x17')],'include':_0x26d66d[_0xb233('0x19')]?_['map'](_0x26d66d['include'],function(_0x153f03){return{'model':db[_0x153f03[_0xb233('0x1b')]],'as':_0x153f03['as'],'attributes':_0x153f03[_0xb233('0x17')],'include':_0x153f03[_0xb233('0x19')]?_[_0xb233('0x1a')](_0x153f03[_0xb233('0x19')],function(_0x422adc){return{'model':db[_0x422adc[_0xb233('0x1b')]],'as':_0x422adc['as'],'attributes':_0x422adc[_0xb233('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb233('0x1c')](function(_0x190a7e){logger['info'](_0xb233('0x1d'),_0x1efa3c);logger[_0xb233('0xe')](_0xb233('0x1d'),_0x1efa3c,JSON[_0xb233('0xf')](_0x190a7e));_0x4c47b8(_0x190a7e);})[_0xb233('0x1e')](function(_0x2469b5){logger[_0xb233('0x10')](_0xb233('0x1d'),_0x2469b5[_0xb233('0x12')],_0x1efa3c);_0x4df4a0(_0x1e828b['error'](0x1f4,_0x2469b5[_0xb233('0x12')]));});});};exports['ShowFreshdeskAccount']=function(_0x24b331){var _0x30907d=this;return new Promise(function(_0x59d478,_0x4cfb94){return db[_0xb233('0x1f')]['find']({'raw':_0x24b331[_0xb233('0x14')]?_0x24b331[_0xb233('0x14')][_0xb233('0x15')]===undefined?!![]:![]:!![],'where':_0x24b331[_0xb233('0x14')]?_0x24b331[_0xb233('0x14')][_0xb233('0x16')]||null:null,'attributes':_0x24b331['options']?_0x24b331['options']['attributes']||null:null,'include':_0x24b331[_0xb233('0x14')]?_0x24b331[_0xb233('0x14')][_0xb233('0x19')]?_[_0xb233('0x1a')](_0x24b331[_0xb233('0x14')]['include'],function(_0x226c1c){return{'model':db[_0x226c1c[_0xb233('0x1b')]],'as':_0x226c1c['as'],'attributes':_0x226c1c[_0xb233('0x17')],'include':_0x226c1c[_0xb233('0x19')]?_[_0xb233('0x1a')](_0x226c1c[_0xb233('0x19')],function(_0x19c18c){return{'model':db[_0x19c18c[_0xb233('0x1b')]],'as':_0x19c18c['as'],'attributes':_0x19c18c['attributes'],'include':_0x19c18c[_0xb233('0x19')]?_[_0xb233('0x1a')](_0x19c18c['include'],function(_0x350570){return{'model':db[_0x350570[_0xb233('0x1b')]],'as':_0x350570['as'],'attributes':_0x350570[_0xb233('0x17')]};}):[]};}):[]};}):[]:[]})[_0xb233('0x1c')](function(_0x51bf34){logger['info']('ShowFreshdeskAccount',_0x24b331);logger[_0xb233('0xe')](_0xb233('0x20'),_0x24b331,JSON['stringify'](_0x51bf34));_0x59d478(_0x51bf34);})[_0xb233('0x1e')](function(_0x55b7e5){logger[_0xb233('0x10')](_0xb233('0x20'),_0x55b7e5[_0xb233('0x12')],_0x24b331);_0x4cfb94(_0x30907d['error'](0x1f4,_0x55b7e5['message']));});});}; \ No newline at end of file +var _0x7a2c=['attributes','FreshdeskAccount','find','then','ShowFreshdeskAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','limit','include','map','model'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x5ee03f,_0x443523){_0x5ee03f=_0x5ee03f-0x0;var _0x1dfc7b=_0x7a2c[_0x5ee03f];return _0x1dfc7b;};'use strict';var _=require(_0xc7a2('0x0'));var util=require('util');var moment=require(_0xc7a2('0x1'));var BPromise=require(_0xc7a2('0x2'));var rs=require(_0xc7a2('0x3'));var fs=require('fs');var Redis=require(_0xc7a2('0x4'));var db=require(_0xc7a2('0x5'))['db'];var utils=require(_0xc7a2('0x6'));var logger=require(_0xc7a2('0x7'))(_0xc7a2('0x8'));var config=require('../../config/environment');var jayson=require(_0xc7a2('0x9'));var client=jayson[_0xc7a2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481430,_0x48773c,_0x1dd150){return new BPromise(function(_0x3de428,_0x3f0573){return client[_0xc7a2('0xb')](_0x481430,_0x1dd150)['then'](function(_0x38518b){logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,'request\x20sent');logger[_0xc7a2('0xe')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x48773c,_0xc7a2('0xf'),JSON[_0xc7a2('0x10')](_0x38518b));if(_0x38518b[_0xc7a2('0x11')]){if(_0x38518b['error'][_0xc7a2('0x12')]===0x1f4){logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b['error'][_0xc7a2('0x13')]);return _0x3f0573(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}logger[_0xc7a2('0x11')](_0xc7a2('0xd'),_0x48773c,_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);return _0x3de428(_0x38518b[_0xc7a2('0x11')][_0xc7a2('0x13')]);}else{logger[_0xc7a2('0xc')](_0xc7a2('0xd'),_0x48773c,_0xc7a2('0xf'));_0x3de428(_0x38518b[_0xc7a2('0x14')][_0xc7a2('0x13')]);}})[_0xc7a2('0x15')](function(_0x506396){logger[_0xc7a2('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x48773c,_0x506396);_0x3f0573(_0x506396);});});}exports[_0xc7a2('0x16')]=function(_0x302d54){var _0x293343=this;return new Promise(function(_0x3da373,_0x4e50fb){return db['FreshdeskAccount'][_0xc7a2('0x17')]({'raw':_0x302d54[_0xc7a2('0x18')]?_0x302d54['options']['raw']===undefined?!![]:![]:!![],'where':_0x302d54['options']?_0x302d54[_0xc7a2('0x18')]['where']||null:null,'attributes':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')]['attributes']||null:null,'limit':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')][_0xc7a2('0x19')]||null:null,'include':_0x302d54[_0xc7a2('0x18')]?_0x302d54[_0xc7a2('0x18')][_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x302d54['options']['include'],function(_0x194ca4){return{'model':db[_0x194ca4[_0xc7a2('0x1c')]],'as':_0x194ca4['as'],'attributes':_0x194ca4['attributes'],'include':_0x194ca4[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x194ca4[_0xc7a2('0x1a')],function(_0x2c2281){return{'model':db[_0x2c2281[_0xc7a2('0x1c')]],'as':_0x2c2281['as'],'attributes':_0x2c2281[_0xc7a2('0x1d')],'include':_0x2c2281[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x2c2281['include'],function(_0x35a6e0){return{'model':db[_0x35a6e0['model']],'as':_0x35a6e0['as'],'attributes':_0x35a6e0[_0xc7a2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20404b){logger[_0xc7a2('0xc')](_0xc7a2('0x16'),_0x302d54);logger[_0xc7a2('0xe')]('GetFreshdeskAccount',_0x302d54,JSON['stringify'](_0x20404b));_0x3da373(_0x20404b);})[_0xc7a2('0x15')](function(_0x2f3097){logger[_0xc7a2('0x11')](_0xc7a2('0x16'),_0x2f3097[_0xc7a2('0x13')],_0x302d54);_0x4e50fb(_0x293343[_0xc7a2('0x11')](0x1f4,_0x2f3097[_0xc7a2('0x13')]));});});};exports['ShowFreshdeskAccount']=function(_0x8cb6bf){var _0x926b6c=this;return new Promise(function(_0x496386,_0xe8c061){return db[_0xc7a2('0x1e')][_0xc7a2('0x1f')]({'raw':_0x8cb6bf['options']?_0x8cb6bf[_0xc7a2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options']['where']||null:null,'attributes':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options']['attributes']||null:null,'include':_0x8cb6bf[_0xc7a2('0x18')]?_0x8cb6bf['options'][_0xc7a2('0x1a')]?_['map'](_0x8cb6bf[_0xc7a2('0x18')][_0xc7a2('0x1a')],function(_0x13ee53){return{'model':db[_0x13ee53[_0xc7a2('0x1c')]],'as':_0x13ee53['as'],'attributes':_0x13ee53[_0xc7a2('0x1d')],'include':_0x13ee53[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x13ee53[_0xc7a2('0x1a')],function(_0x29771b){return{'model':db[_0x29771b[_0xc7a2('0x1c')]],'as':_0x29771b['as'],'attributes':_0x29771b['attributes'],'include':_0x29771b[_0xc7a2('0x1a')]?_[_0xc7a2('0x1b')](_0x29771b['include'],function(_0x31a8d2){return{'model':db[_0x31a8d2[_0xc7a2('0x1c')]],'as':_0x31a8d2['as'],'attributes':_0x31a8d2[_0xc7a2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc7a2('0x20')](function(_0x178c3e){logger[_0xc7a2('0xc')](_0xc7a2('0x21'),_0x8cb6bf);logger['debug'](_0xc7a2('0x21'),_0x8cb6bf,JSON[_0xc7a2('0x10')](_0x178c3e));_0x496386(_0x178c3e);})[_0xc7a2('0x15')](function(_0x49ad1f){logger[_0xc7a2('0x11')](_0xc7a2('0x21'),_0x49ad1f['message'],_0x8cb6bf);_0xe8c061(_0x926b6c[_0xc7a2('0x11')](0x1f4,_0x49ad1f[_0xc7a2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index d9ff158..22b923d 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 _0xfc73=['isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x499d15,_0x5376c1){var _0x189291=function(_0x52884f){while(--_0x52884f){_0x499d15['push'](_0x499d15['shift']());}};_0x189291(++_0x5376c1);}(_0xfc73,0x8d));var _0x3fc7=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xfc73[_0x36ed48];return _0x51c63a;};'use strict';var multer=require(_0x3fc7('0x0'));var util=require(_0x3fc7('0x1'));var path=require(_0x3fc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x3fc7('0x3'));var router=express[_0x3fc7('0x4')]();var fs_extra=require(_0x3fc7('0x5'));var auth=require(_0x3fc7('0x6'));var interaction=require(_0x3fc7('0x7'));var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router[_0x3fc7('0x8')]('/',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xa')]);router[_0x3fc7('0x8')](_0x3fc7('0xb'),auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xc')]);router[_0x3fc7('0x8')](_0x3fc7('0xd'),auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xe')]);router[_0x3fc7('0x8')]('/:id/subjects',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0xf')]);router['get'](_0x3fc7('0x10'),auth[_0x3fc7('0x9')](),controller['getDescriptions']);router[_0x3fc7('0x8')](_0x3fc7('0x11'),auth[_0x3fc7('0x9')](),controller[_0x3fc7('0x12')]);router[_0x3fc7('0x13')]('/',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0x14')]);router[_0x3fc7('0x13')](_0x3fc7('0x11'),auth[_0x3fc7('0x9')](),controller[_0x3fc7('0x15')]);router[_0x3fc7('0x16')](_0x3fc7('0xb'),auth[_0x3fc7('0x9')](),controller[_0x3fc7('0x17')]);router['delete']('/:id',auth[_0x3fc7('0x9')](),controller[_0x3fc7('0x18')]);module['exports']=router; \ No newline at end of file +var _0x203d=['getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','Router','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects'];(function(_0x18f73f,_0x4caa58){var _0x7f4a7c=function(_0x26ee5b){while(--_0x26ee5b){_0x18f73f['push'](_0x18f73f['shift']());}};_0x7f4a7c(++_0x4caa58);}(_0x203d,0x6f));var _0xd203=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x203d[_0x28a5ad];return _0x176b8a;};'use strict';var multer=require(_0xd203('0x0'));var util=require(_0xd203('0x1'));var path=require(_0xd203('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd203('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd203('0x4'));var config=require('../../config/environment');var controller=require(_0xd203('0x5'));router[_0xd203('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd203('0x7'),auth['isAuthenticated'](),controller[_0xd203('0x8')]);router['get'](_0xd203('0x9'),auth[_0xd203('0xa')](),controller[_0xd203('0xb')]);router[_0xd203('0x6')](_0xd203('0xc'),auth[_0xd203('0xa')](),controller[_0xd203('0xd')]);router[_0xd203('0x6')]('/:id/descriptions',auth[_0xd203('0xa')](),controller[_0xd203('0xe')]);router[_0xd203('0x6')](_0xd203('0xf'),auth[_0xd203('0xa')](),controller[_0xd203('0x10')]);router[_0xd203('0x11')]('/',auth[_0xd203('0xa')](),controller[_0xd203('0x12')]);router['post'](_0xd203('0xf'),auth[_0xd203('0xa')](),controller[_0xd203('0x13')]);router[_0xd203('0x14')](_0xd203('0x7'),auth['isAuthenticated'](),controller[_0xd203('0x15')]);router[_0xd203('0x16')](_0xd203('0x7'),auth['isAuthenticated'](),controller[_0xd203('0x17')]);module[_0xd203('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index ac3f9ff..441288b 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 _0x1b56=['STRING','sequelize','exports'];(function(_0x1fc84d,_0x3f469d){var _0x2658fa=function(_0x189ad0){while(--_0x189ad0){_0x1fc84d['push'](_0x1fc84d['shift']());}};_0x2658fa(++_0x3f469d);}(_0x1b56,0x1a5));var _0x61b5=function(_0xfedc72,_0x292f02){_0xfedc72=_0xfedc72-0x0;var _0x2c7c78=_0x1b56[_0xfedc72];return _0x2c7c78;};'use strict';var Sequelize=require(_0x61b5('0x0'));module[_0x61b5('0x1')]={'name':{'type':Sequelize[_0x61b5('0x2')]},'description':{'type':Sequelize[_0x61b5('0x2')]}}; \ No newline at end of file +var _0x69d0=['sequelize','STRING'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x69d0,0x122));var _0x069d=function(_0x16fc43,_0x2cf7c4){_0x16fc43=_0x16fc43-0x0;var _0x160427=_0x69d0[_0x16fc43];return _0x160427;};'use strict';var Sequelize=require(_0x069d('0x0'));module['exports']={'name':{'type':Sequelize[_0x069d('0x1')]},'description':{'type':Sequelize[_0x069d('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d10e756..dc8f2d3 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 _0xb777=['to-csv','fs-extra','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','update','then','end','error','stack','name','send','index','FreshdeskConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','length','order','sort','pick','VIRTUAL','merge','options','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','FreshdeskField','getFields','hasOwnProperty','nolimit','getSubjects','findOne','filter','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','mustache','util','path','sox'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xb777,0x95));var _0x7b77=function(_0x5b04a3,_0xfda4fd){_0x5b04a3=_0x5b04a3-0x0;var _0x1adf11=_0xb777[_0x5b04a3];return _0x1adf11;};'use strict';var emlformat=require(_0x7b77('0x0'));var rimraf=require(_0x7b77('0x1'));var zipdir=require(_0x7b77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7b77('0x3'));var util=require(_0x7b77('0x4'));var path=require(_0x7b77('0x5'));var sox=require(_0x7b77('0x6'));var csv=require(_0x7b77('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7b77('0x8'));var _=require('lodash');var squel=require(_0x7b77('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b77('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7b77('0xb'));var Papa=require(_0x7b77('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7b77('0xd'));var as=require(_0x7b77('0xe'));var hardwareService=require(_0x7b77('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x7b77('0x10'));var config=require(_0x7b77('0x11'));var licenseUtil=require(_0x7b77('0x12'));var db=require(_0x7b77('0x13'))['db'];function respondWithStatusCode(_0x1836dd,_0x4d9289){_0x4d9289=_0x4d9289||0xcc;return function(_0x19239b){if(_0x19239b){return _0x1836dd[_0x7b77('0x14')](_0x4d9289);}return _0x1836dd[_0x7b77('0x15')](_0x4d9289)['end']();};}function respondWithResult(_0x85fd2,_0x32af2c){_0x32af2c=_0x32af2c||0xc8;return function(_0x573a44){if(_0x573a44){return _0x85fd2[_0x7b77('0x15')](_0x32af2c)['json'](_0x573a44);}};}function respondWithFilteredResult(_0x504c39,_0x46f179){return function(_0x2185de){if(_0x2185de){var _0x4f210a=typeof _0x46f179[_0x7b77('0x16')]===_0x7b77('0x17')&&typeof _0x46f179[_0x7b77('0x18')]==='undefined';var _0x1965fc=_0x2185de[_0x7b77('0x19')];var _0x5065d4=_0x4f210a?0x0:_0x46f179['offset'];var _0x24fe92=_0x4f210a?_0x2185de['count']:_0x46f179['offset']+_0x46f179[_0x7b77('0x18')];var _0xb558c4;if(_0x24fe92>=_0x1965fc){_0x24fe92=_0x1965fc;_0xb558c4=0xc8;}else{_0xb558c4=0xce;}_0x504c39[_0x7b77('0x15')](_0xb558c4);return _0x504c39[_0x7b77('0x1a')]('Content-Range',_0x5065d4+'-'+_0x24fe92+'/'+_0x1965fc)['json'](_0x2185de);}return null;};}function patchUpdates(_0x83d663){return function(_0x5971d9){try{jsonpatch['apply'](_0x5971d9,_0x83d663,!![]);}catch(_0x321c45){return BPromise[_0x7b77('0x1b')](_0x321c45);}return _0x5971d9[_0x7b77('0x1c')]();};}function saveUpdates(_0x198ecc,_0x1342d9){return function(_0x12040f){if(_0x12040f){return _0x12040f[_0x7b77('0x1d')](_0x198ecc)[_0x7b77('0x1e')](function(_0x3713b8){return _0x3713b8;});}return null;};}function removeEntity(_0x20b573,_0x31e4f6){return function(_0x27d79d){if(_0x27d79d){return _0x27d79d['destroy']()[_0x7b77('0x1e')](function(){_0x20b573[_0x7b77('0x15')](0xcc)[_0x7b77('0x1f')]();});}};}function handleEntityNotFound(_0x4e9f4d,_0x103243){return function(_0x35ef4a){if(!_0x35ef4a){_0x4e9f4d['sendStatus'](0x194);}return _0x35ef4a;};}function handleError(_0x4bea56,_0xdef8e4){_0xdef8e4=_0xdef8e4||0x1f4;return function(_0x29ae8d){logger[_0x7b77('0x20')](_0x29ae8d[_0x7b77('0x21')]);if(_0x29ae8d[_0x7b77('0x22')]){delete _0x29ae8d[_0x7b77('0x22')];}_0x4bea56[_0x7b77('0x15')](_0xdef8e4)[_0x7b77('0x23')](_0x29ae8d);};}exports[_0x7b77('0x24')]=function(_0x2dac24,_0x10ffeb){var _0x10bd88={},_0x3e18f3={},_0x49cd8e={'count':0x0,'rows':[]};var _0x158d89=_['map'](db[_0x7b77('0x25')]['rawAttributes'],function(_0x234e13){return{'name':_0x234e13['fieldName'],'type':_0x234e13[_0x7b77('0x26')][_0x7b77('0x27')]};});_0x3e18f3[_0x7b77('0x28')]=_[_0x7b77('0x29')](_0x158d89,_0x7b77('0x22'));_0x3e18f3[_0x7b77('0x2a')]=_[_0x7b77('0x2b')](_0x2dac24[_0x7b77('0x2a')]);_0x3e18f3[_0x7b77('0x2c')]=_[_0x7b77('0x2d')](_0x3e18f3[_0x7b77('0x28')],_0x3e18f3[_0x7b77('0x2a')]);_0x10bd88[_0x7b77('0x2e')]=_[_0x7b77('0x2d')](_0x3e18f3['model'],qs['fields'](_0x2dac24[_0x7b77('0x2a')]['fields']));_0x10bd88[_0x7b77('0x2e')]=_0x10bd88[_0x7b77('0x2e')][_0x7b77('0x2f')]?_0x10bd88[_0x7b77('0x2e')]:_0x3e18f3[_0x7b77('0x28')];if(!_0x2dac24[_0x7b77('0x2a')]['hasOwnProperty']('nolimit')){_0x10bd88[_0x7b77('0x18')]=qs[_0x7b77('0x18')](_0x2dac24[_0x7b77('0x2a')][_0x7b77('0x18')]);_0x10bd88[_0x7b77('0x16')]=qs['offset'](_0x2dac24[_0x7b77('0x2a')][_0x7b77('0x16')]);}_0x10bd88[_0x7b77('0x30')]=qs['sort'](_0x2dac24[_0x7b77('0x2a')][_0x7b77('0x31')]);_0x10bd88['where']=qs[_0x7b77('0x2c')](_[_0x7b77('0x32')](_0x2dac24[_0x7b77('0x2a')],_0x3e18f3[_0x7b77('0x2c')]),_0x158d89);if(_0x2dac24[_0x7b77('0x2a')]['filter']){_0x10bd88['where']=_['merge'](_0x10bd88['where'],{'$or':_[_0x7b77('0x29')](_0x158d89,function(_0x245fcf){if(_0x245fcf[_0x7b77('0x26')]!==_0x7b77('0x33')){var _0x410ffa={};_0x410ffa[_0x245fcf[_0x7b77('0x22')]]={'$like':'%'+_0x2dac24['query']['filter']+'%'};return _0x410ffa;}})});}_0x10bd88=_[_0x7b77('0x34')]({},_0x10bd88,_0x2dac24[_0x7b77('0x35')]);var _0xf660cb={'where':_0x10bd88[_0x7b77('0x36')]};return db[_0x7b77('0x25')][_0x7b77('0x19')](_0xf660cb)[_0x7b77('0x1e')](function(_0x103ce6){_0x49cd8e[_0x7b77('0x19')]=_0x103ce6;if(_0x2dac24[_0x7b77('0x2a')][_0x7b77('0x37')]){_0x10bd88[_0x7b77('0x38')]=[{'all':!![]}];}return db[_0x7b77('0x25')][_0x7b77('0x39')](_0x10bd88);})[_0x7b77('0x1e')](function(_0x49e726){_0x49cd8e[_0x7b77('0x3a')]=_0x49e726;return _0x49cd8e;})[_0x7b77('0x1e')](respondWithFilteredResult(_0x10ffeb,_0x10bd88))[_0x7b77('0x3b')](handleError(_0x10ffeb,null));};exports[_0x7b77('0x3c')]=function(_0x1dd2f4,_0x1e4fcd){var _0x100965={'raw':![],'where':{'id':_0x1dd2f4[_0x7b77('0x3d')]['id']}},_0x118e05={};_0x118e05['model']=_[_0x7b77('0x2b')](db[_0x7b77('0x25')][_0x7b77('0x3e')]);_0x118e05[_0x7b77('0x2a')]=_['keys'](_0x1dd2f4[_0x7b77('0x2a')]);_0x118e05['filters']=_['intersection'](_0x118e05[_0x7b77('0x28')],_0x118e05[_0x7b77('0x2a')]);_0x100965[_0x7b77('0x2e')]=_[_0x7b77('0x2d')](_0x118e05[_0x7b77('0x28')],qs[_0x7b77('0x3f')](_0x1dd2f4[_0x7b77('0x2a')][_0x7b77('0x3f')]));_0x100965[_0x7b77('0x2e')]=_0x100965[_0x7b77('0x2e')][_0x7b77('0x2f')]?_0x100965[_0x7b77('0x2e')]:_0x118e05[_0x7b77('0x28')];if(_0x1dd2f4['query'][_0x7b77('0x37')]){_0x100965[_0x7b77('0x38')]=[{'all':!![]}];}_0x100965=_[_0x7b77('0x34')]({},_0x100965,_0x1dd2f4[_0x7b77('0x35')]);return db['FreshdeskConfiguration'][_0x7b77('0x40')](_0x100965)['then'](handleEntityNotFound(_0x1e4fcd,null))[_0x7b77('0x1e')](respondWithResult(_0x1e4fcd,null))[_0x7b77('0x3b')](handleError(_0x1e4fcd,null));};exports[_0x7b77('0x41')]=function(_0x10daff,_0xd6b91f){return db[_0x7b77('0x25')][_0x7b77('0x41')](_0x10daff[_0x7b77('0x42')],{})['then'](respondWithResult(_0xd6b91f,0xc9))[_0x7b77('0x3b')](handleError(_0xd6b91f,null));};exports[_0x7b77('0x1d')]=function(_0x5d1d1e,_0x5b2148){if(_0x5d1d1e[_0x7b77('0x42')]['id']){delete _0x5d1d1e['body']['id'];}return db[_0x7b77('0x25')][_0x7b77('0x40')]({'where':{'id':_0x5d1d1e['params']['id']}})['then'](handleEntityNotFound(_0x5b2148,null))[_0x7b77('0x1e')](saveUpdates(_0x5d1d1e[_0x7b77('0x42')],null))['then'](respondWithResult(_0x5b2148,null))[_0x7b77('0x3b')](handleError(_0x5b2148,null));};exports['destroy']=function(_0x2efeaf,_0x5cd22f){return db[_0x7b77('0x25')][_0x7b77('0x40')]({'where':{'id':_0x2efeaf['params']['id']}})['then'](handleEntityNotFound(_0x5cd22f,null))[_0x7b77('0x1e')](removeEntity(_0x5cd22f,null))[_0x7b77('0x3b')](handleError(_0x5cd22f,null));};exports['getFields']=function(_0x24d8e3,_0x3ab4aa,_0x14203b){var _0x1639ee={};var _0x36796f={};var _0x3670a0;var _0x41ae79;return db[_0x7b77('0x25')]['findOne']({'where':{'id':_0x24d8e3[_0x7b77('0x3d')]['id']}})[_0x7b77('0x1e')](handleEntityNotFound(_0x3ab4aa,null))[_0x7b77('0x1e')](function(_0x21bc08){if(_0x21bc08){_0x3670a0=_0x21bc08;_0x36796f['model']=_[_0x7b77('0x2b')](db[_0x7b77('0x43')][_0x7b77('0x3e')]);_0x36796f[_0x7b77('0x2a')]=_[_0x7b77('0x2b')](_0x24d8e3[_0x7b77('0x2a')]);_0x36796f['filters']=_['intersection'](_0x36796f[_0x7b77('0x28')],_0x36796f[_0x7b77('0x2a')]);_0x1639ee[_0x7b77('0x2e')]=_[_0x7b77('0x2d')](_0x36796f[_0x7b77('0x28')],qs[_0x7b77('0x3f')](_0x24d8e3['query'][_0x7b77('0x3f')]));_0x1639ee['attributes']=_0x1639ee['attributes']['length']?_0x1639ee[_0x7b77('0x2e')]:_0x36796f['model'];_0x1639ee[_0x7b77('0x30')]=qs['sort'](_0x24d8e3[_0x7b77('0x2a')][_0x7b77('0x31')]);_0x1639ee[_0x7b77('0x36')]=qs[_0x7b77('0x2c')](_[_0x7b77('0x32')](_0x24d8e3[_0x7b77('0x2a')],_0x36796f[_0x7b77('0x2c')]));if(_0x24d8e3[_0x7b77('0x2a')]['filter']){_0x1639ee['where']=_[_0x7b77('0x34')](_0x1639ee['where'],{'$or':_[_0x7b77('0x29')](_0x1639ee[_0x7b77('0x2e')],function(_0xb8272d){var _0x236c00={};_0x236c00[_0xb8272d]={'$like':'%'+_0x24d8e3[_0x7b77('0x2a')]['filter']+'%'};return _0x236c00;})});}_0x1639ee=_[_0x7b77('0x34')]({},_0x1639ee,_0x24d8e3[_0x7b77('0x35')]);return _0x3670a0[_0x7b77('0x44')](_0x1639ee);}})[_0x7b77('0x1e')](function(_0x2b78eb){if(_0x2b78eb){_0x41ae79=_0x2b78eb['length'];if(!_0x24d8e3['query'][_0x7b77('0x45')](_0x7b77('0x46'))){_0x1639ee[_0x7b77('0x18')]=qs[_0x7b77('0x18')](_0x24d8e3['query'][_0x7b77('0x18')]);_0x1639ee[_0x7b77('0x16')]=qs['offset'](_0x24d8e3['query'][_0x7b77('0x16')]);}return _0x3670a0[_0x7b77('0x44')](_0x1639ee);}})[_0x7b77('0x1e')](function(_0x185f06){if(_0x185f06){return _0x185f06?{'count':_0x41ae79,'rows':_0x185f06}:null;}})[_0x7b77('0x1e')](respondWithResult(_0x3ab4aa,null))[_0x7b77('0x3b')](handleError(_0x3ab4aa,null));};exports[_0x7b77('0x47')]=function(_0x200dc1,_0x4013a1,_0x5669d3){var _0x4b1fd9={};var _0x41681a={};var _0x253900;var _0x1d782b;return db['FreshdeskConfiguration'][_0x7b77('0x48')]({'where':{'id':_0x200dc1[_0x7b77('0x3d')]['id']}})[_0x7b77('0x1e')](handleEntityNotFound(_0x4013a1,null))[_0x7b77('0x1e')](function(_0x426dc6){if(_0x426dc6){_0x253900=_0x426dc6;_0x41681a[_0x7b77('0x28')]=_[_0x7b77('0x2b')](db[_0x7b77('0x43')][_0x7b77('0x3e')]);_0x41681a['query']=_['keys'](_0x200dc1[_0x7b77('0x2a')]);_0x41681a[_0x7b77('0x2c')]=_[_0x7b77('0x2d')](_0x41681a[_0x7b77('0x28')],_0x41681a[_0x7b77('0x2a')]);_0x4b1fd9[_0x7b77('0x2e')]=_['intersection'](_0x41681a[_0x7b77('0x28')],qs[_0x7b77('0x3f')](_0x200dc1[_0x7b77('0x2a')][_0x7b77('0x3f')]));_0x4b1fd9[_0x7b77('0x2e')]=_0x4b1fd9['attributes'][_0x7b77('0x2f')]?_0x4b1fd9[_0x7b77('0x2e')]:_0x41681a['model'];_0x4b1fd9[_0x7b77('0x30')]=qs[_0x7b77('0x31')](_0x200dc1[_0x7b77('0x2a')]['sort']);_0x4b1fd9[_0x7b77('0x36')]=qs['filters'](_[_0x7b77('0x32')](_0x200dc1[_0x7b77('0x2a')],_0x41681a[_0x7b77('0x2c')]));if(_0x200dc1['query']['filter']){_0x4b1fd9[_0x7b77('0x36')]=_[_0x7b77('0x34')](_0x4b1fd9[_0x7b77('0x36')],{'$or':_[_0x7b77('0x29')](_0x4b1fd9[_0x7b77('0x2e')],function(_0x26285a){var _0x1ef81e={};_0x1ef81e[_0x26285a]={'$like':'%'+_0x200dc1[_0x7b77('0x2a')][_0x7b77('0x49')]+'%'};return _0x1ef81e;})});}_0x4b1fd9=_['merge']({},_0x4b1fd9,_0x200dc1[_0x7b77('0x35')]);return _0x253900['getSubjects'](_0x4b1fd9);}})['then'](function(_0x55eaaa){if(_0x55eaaa){_0x1d782b=_0x55eaaa[_0x7b77('0x2f')];if(!_0x200dc1[_0x7b77('0x2a')][_0x7b77('0x45')]('nolimit')){_0x4b1fd9[_0x7b77('0x18')]=qs[_0x7b77('0x18')](_0x200dc1['query']['limit']);_0x4b1fd9[_0x7b77('0x16')]=qs[_0x7b77('0x16')](_0x200dc1[_0x7b77('0x2a')][_0x7b77('0x16')]);}return _0x253900[_0x7b77('0x47')](_0x4b1fd9);}})['then'](function(_0x5110b2){if(_0x5110b2){return _0x5110b2?{'count':_0x1d782b,'rows':_0x5110b2}:null;}})[_0x7b77('0x1e')](respondWithResult(_0x4013a1,null))[_0x7b77('0x3b')](handleError(_0x4013a1,null));};exports[_0x7b77('0x4a')]=function(_0x561f92,_0x1d5954,_0xad5523){var _0x387656={};var _0x558c28={};var _0x503fb7;var _0x1b0029;return db[_0x7b77('0x25')]['findOne']({'where':{'id':_0x561f92[_0x7b77('0x3d')]['id']}})[_0x7b77('0x1e')](handleEntityNotFound(_0x1d5954,null))[_0x7b77('0x1e')](function(_0x1b996d){if(_0x1b996d){_0x503fb7=_0x1b996d;_0x558c28[_0x7b77('0x28')]=_[_0x7b77('0x2b')](db[_0x7b77('0x43')][_0x7b77('0x3e')]);_0x558c28[_0x7b77('0x2a')]=_['keys'](_0x561f92['query']);_0x558c28[_0x7b77('0x2c')]=_[_0x7b77('0x2d')](_0x558c28[_0x7b77('0x28')],_0x558c28[_0x7b77('0x2a')]);_0x387656[_0x7b77('0x2e')]=_[_0x7b77('0x2d')](_0x558c28[_0x7b77('0x28')],qs[_0x7b77('0x3f')](_0x561f92['query'][_0x7b77('0x3f')]));_0x387656['attributes']=_0x387656[_0x7b77('0x2e')][_0x7b77('0x2f')]?_0x387656[_0x7b77('0x2e')]:_0x558c28[_0x7b77('0x28')];_0x387656[_0x7b77('0x30')]=qs[_0x7b77('0x31')](_0x561f92[_0x7b77('0x2a')][_0x7b77('0x31')]);_0x387656[_0x7b77('0x36')]=qs[_0x7b77('0x2c')](_[_0x7b77('0x32')](_0x561f92[_0x7b77('0x2a')],_0x558c28['filters']));if(_0x561f92[_0x7b77('0x2a')][_0x7b77('0x49')]){_0x387656[_0x7b77('0x36')]=_['merge'](_0x387656[_0x7b77('0x36')],{'$or':_['map'](_0x387656['attributes'],function(_0x28cefd){var _0x5db674={};_0x5db674[_0x28cefd]={'$like':'%'+_0x561f92[_0x7b77('0x2a')][_0x7b77('0x49')]+'%'};return _0x5db674;})});}_0x387656=_[_0x7b77('0x34')]({},_0x387656,_0x561f92[_0x7b77('0x35')]);return _0x503fb7[_0x7b77('0x4a')](_0x387656);}})[_0x7b77('0x1e')](function(_0x55262b){if(_0x55262b){_0x1b0029=_0x55262b['length'];if(!_0x561f92[_0x7b77('0x2a')][_0x7b77('0x45')](_0x7b77('0x46'))){_0x387656[_0x7b77('0x18')]=qs[_0x7b77('0x18')](_0x561f92[_0x7b77('0x2a')][_0x7b77('0x18')]);_0x387656[_0x7b77('0x16')]=qs['offset'](_0x561f92[_0x7b77('0x2a')][_0x7b77('0x16')]);}return _0x503fb7[_0x7b77('0x4a')](_0x387656);}})[_0x7b77('0x1e')](function(_0x2a6263){if(_0x2a6263){return _0x2a6263?{'count':_0x1b0029,'rows':_0x2a6263}:null;}})['then'](respondWithResult(_0x1d5954,null))[_0x7b77('0x3b')](handleError(_0x1d5954,null));};exports[_0x7b77('0x4b')]=function(_0xee2623,_0x307c25,_0x4427be){var _0x427ba3={};var _0x14cecf={};var _0x3f7c70;var _0xb165a7;return db[_0x7b77('0x25')][_0x7b77('0x48')]({'where':{'id':_0xee2623[_0x7b77('0x3d')]['id']}})[_0x7b77('0x1e')](handleEntityNotFound(_0x307c25,null))[_0x7b77('0x1e')](function(_0x548609){if(_0x548609){_0x3f7c70=_0x548609;_0x14cecf[_0x7b77('0x28')]=_[_0x7b77('0x2b')](db['Tag'][_0x7b77('0x3e')]);_0x14cecf[_0x7b77('0x2a')]=_[_0x7b77('0x2b')](_0xee2623['query']);_0x14cecf['filters']=_[_0x7b77('0x2d')](_0x14cecf[_0x7b77('0x28')],_0x14cecf[_0x7b77('0x2a')]);_0x427ba3[_0x7b77('0x2e')]=_[_0x7b77('0x2d')](_0x14cecf['model'],qs['fields'](_0xee2623[_0x7b77('0x2a')][_0x7b77('0x3f')]));_0x427ba3[_0x7b77('0x2e')]=_0x427ba3[_0x7b77('0x2e')][_0x7b77('0x2f')]?_0x427ba3[_0x7b77('0x2e')]:_0x14cecf['model'];_0x427ba3[_0x7b77('0x30')]=qs[_0x7b77('0x31')](_0xee2623[_0x7b77('0x2a')][_0x7b77('0x31')]);_0x427ba3['where']=qs[_0x7b77('0x2c')](_[_0x7b77('0x32')](_0xee2623[_0x7b77('0x2a')],_0x14cecf[_0x7b77('0x2c')]));if(_0xee2623[_0x7b77('0x2a')][_0x7b77('0x49')]){_0x427ba3[_0x7b77('0x36')]=_[_0x7b77('0x34')](_0x427ba3[_0x7b77('0x36')],{'$or':_['map'](_0x427ba3[_0x7b77('0x2e')],function(_0x40f4e7){var _0x15aff1={};_0x15aff1[_0x40f4e7]={'$like':'%'+_0xee2623[_0x7b77('0x2a')][_0x7b77('0x49')]+'%'};return _0x15aff1;})});}_0x427ba3=_['merge']({},_0x427ba3,_0xee2623[_0x7b77('0x35')]);return _0x3f7c70[_0x7b77('0x4b')](_0x427ba3);}})[_0x7b77('0x1e')](function(_0x3c3725){if(_0x3c3725){_0xb165a7=_0x3c3725[_0x7b77('0x2f')];if(!_0xee2623[_0x7b77('0x2a')][_0x7b77('0x45')](_0x7b77('0x46'))){_0x427ba3[_0x7b77('0x18')]=qs[_0x7b77('0x18')](_0xee2623[_0x7b77('0x2a')][_0x7b77('0x18')]);_0x427ba3[_0x7b77('0x16')]=qs[_0x7b77('0x16')](_0xee2623[_0x7b77('0x2a')]['offset']);}return _0x3f7c70['getTags'](_0x427ba3);}})['then'](function(_0x95cc7b){if(_0x95cc7b){return _0x95cc7b?{'count':_0xb165a7,'rows':_0x95cc7b}:null;}})[_0x7b77('0x1e')](respondWithResult(_0x307c25,null))[_0x7b77('0x3b')](handleError(_0x307c25,null));};exports[_0x7b77('0x4c')]=function(_0x560aed,_0x4450b7,_0x4bc055){if(_0x560aed[_0x7b77('0x42')]['id']){delete _0x560aed['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x560aed['params']['id']}})['then'](handleEntityNotFound(_0x4450b7,null))[_0x7b77('0x1e')](function(_0x492004){if(_0x492004){return _0x492004['setTags'](_0x560aed[_0x7b77('0x42')][_0x7b77('0x4d')]||[]);}return null;})[_0x7b77('0x1e')](respondWithResult(_0x4450b7,null))['catch'](handleError(_0x4450b7,null));}; \ No newline at end of file +var _0xb94b=['stack','name','send','FreshdeskConfiguration','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','FreshdeskField','rawAttributes','order','pick','getSubjects','getDescriptions','findOne','getTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','squel','crypto','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error'];(function(_0x14059f,_0x38bce0){var _0x4a39f7=function(_0x31fa01){while(--_0x31fa01){_0x14059f['push'](_0x14059f['shift']());}};_0x4a39f7(++_0x38bce0);}(_0xb94b,0x1c0));var _0xbb94=function(_0x348b3e,_0x323fba){_0x348b3e=_0x348b3e-0x0;var _0x8da268=_0xb94b[_0x348b3e];return _0x8da268;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb94('0x0'));var zipdir=require(_0xbb94('0x1'));var jsonpatch=require(_0xbb94('0x2'));var rp=require(_0xbb94('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xbb94('0x4'));var util=require(_0xbb94('0x5'));var path=require(_0xbb94('0x6'));var sox=require(_0xbb94('0x7'));var csv=require(_0xbb94('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xbb94('0x9'));var crypto=require(_0xbb94('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbb94('0x8'));var querystring=require('querystring');var Papa=require(_0xbb94('0xb'));var Redis=require(_0xbb94('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xbb94('0xd'));var hardwareService=require(_0xbb94('0xe'));var logger=require(_0xbb94('0xf'))(_0xbb94('0x10'));var utils=require(_0xbb94('0x11'));var config=require(_0xbb94('0x12'));var licenseUtil=require(_0xbb94('0x13'));var db=require(_0xbb94('0x14'))['db'];function respondWithStatusCode(_0x153229,_0x38b2e6){_0x38b2e6=_0x38b2e6||0xcc;return function(_0x2bdce8){if(_0x2bdce8){return _0x153229[_0xbb94('0x15')](_0x38b2e6);}return _0x153229['status'](_0x38b2e6)['end']();};}function respondWithResult(_0x491ebd,_0x3eec51){_0x3eec51=_0x3eec51||0xc8;return function(_0x1a0e15){if(_0x1a0e15){return _0x491ebd[_0xbb94('0x16')](_0x3eec51)[_0xbb94('0x17')](_0x1a0e15);}};}function respondWithFilteredResult(_0x458914,_0x4a2cc7){return function(_0x324706){if(_0x324706){var _0x482935=typeof _0x4a2cc7[_0xbb94('0x18')]==='undefined'&&typeof _0x4a2cc7[_0xbb94('0x19')]===_0xbb94('0x1a');var _0x514897=_0x324706[_0xbb94('0x1b')];var _0x431823=_0x482935?0x0:_0x4a2cc7[_0xbb94('0x18')];var _0x3bff94=_0x482935?_0x324706['count']:_0x4a2cc7['offset']+_0x4a2cc7[_0xbb94('0x19')];var _0x45875e;if(_0x3bff94>=_0x514897){_0x3bff94=_0x514897;_0x45875e=0xc8;}else{_0x45875e=0xce;}_0x458914['status'](_0x45875e);return _0x458914[_0xbb94('0x1c')](_0xbb94('0x1d'),_0x431823+'-'+_0x3bff94+'/'+_0x514897)[_0xbb94('0x17')](_0x324706);}return null;};}function patchUpdates(_0x157ed6){return function(_0x65c512){try{jsonpatch[_0xbb94('0x1e')](_0x65c512,_0x157ed6,!![]);}catch(_0x5d699e){return BPromise[_0xbb94('0x1f')](_0x5d699e);}return _0x65c512[_0xbb94('0x20')]();};}function saveUpdates(_0x1e7226,_0x169646){return function(_0x325e43){if(_0x325e43){return _0x325e43[_0xbb94('0x21')](_0x1e7226)[_0xbb94('0x22')](function(_0x1ed8d9){return _0x1ed8d9;});}return null;};}function removeEntity(_0x311020,_0x45fd60){return function(_0x29a690){if(_0x29a690){return _0x29a690[_0xbb94('0x23')]()['then'](function(){_0x311020[_0xbb94('0x16')](0xcc)[_0xbb94('0x24')]();});}};}function handleEntityNotFound(_0x4476d2,_0x4dde53){return function(_0x2f8a01){if(!_0x2f8a01){_0x4476d2[_0xbb94('0x15')](0x194);}return _0x2f8a01;};}function handleError(_0x460e2c,_0x55e959){_0x55e959=_0x55e959||0x1f4;return function(_0x173dfc){logger[_0xbb94('0x25')](_0x173dfc[_0xbb94('0x26')]);if(_0x173dfc[_0xbb94('0x27')]){delete _0x173dfc[_0xbb94('0x27')];}_0x460e2c['status'](_0x55e959)[_0xbb94('0x28')](_0x173dfc);};}exports['index']=function(_0x2714a8,_0x23e2f5){var _0x15c58c={},_0x5e870a={},_0x50a2ac={'count':0x0,'rows':[]};var _0x1c0652=_['map'](db[_0xbb94('0x29')]['rawAttributes'],function(_0x1a7e09){return{'name':_0x1a7e09[_0xbb94('0x2a')],'type':_0x1a7e09[_0xbb94('0x2b')][_0xbb94('0x2c')]};});_0x5e870a[_0xbb94('0x2d')]=_[_0xbb94('0x2e')](_0x1c0652,'name');_0x5e870a[_0xbb94('0x2f')]=_[_0xbb94('0x30')](_0x2714a8[_0xbb94('0x2f')]);_0x5e870a[_0xbb94('0x31')]=_[_0xbb94('0x32')](_0x5e870a[_0xbb94('0x2d')],_0x5e870a['query']);_0x15c58c[_0xbb94('0x33')]=_['intersection'](_0x5e870a['model'],qs[_0xbb94('0x34')](_0x2714a8['query'][_0xbb94('0x34')]));_0x15c58c[_0xbb94('0x33')]=_0x15c58c['attributes'][_0xbb94('0x35')]?_0x15c58c[_0xbb94('0x33')]:_0x5e870a[_0xbb94('0x2d')];if(!_0x2714a8[_0xbb94('0x2f')][_0xbb94('0x36')](_0xbb94('0x37'))){_0x15c58c[_0xbb94('0x19')]=qs[_0xbb94('0x19')](_0x2714a8[_0xbb94('0x2f')][_0xbb94('0x19')]);_0x15c58c['offset']=qs[_0xbb94('0x18')](_0x2714a8[_0xbb94('0x2f')]['offset']);}_0x15c58c['order']=qs[_0xbb94('0x38')](_0x2714a8[_0xbb94('0x2f')][_0xbb94('0x38')]);_0x15c58c[_0xbb94('0x39')]=qs['filters'](_['pick'](_0x2714a8[_0xbb94('0x2f')],_0x5e870a[_0xbb94('0x31')]),_0x1c0652);if(_0x2714a8[_0xbb94('0x2f')][_0xbb94('0x3a')]){_0x15c58c[_0xbb94('0x39')]=_['merge'](_0x15c58c[_0xbb94('0x39')],{'$or':_[_0xbb94('0x2e')](_0x1c0652,function(_0x2e2875){if(_0x2e2875['type']!=='VIRTUAL'){var _0x24d44e={};_0x24d44e[_0x2e2875['name']]={'$like':'%'+_0x2714a8[_0xbb94('0x2f')][_0xbb94('0x3a')]+'%'};return _0x24d44e;}})});}_0x15c58c=_[_0xbb94('0x3b')]({},_0x15c58c,_0x2714a8[_0xbb94('0x3c')]);var _0x5a117b={'where':_0x15c58c[_0xbb94('0x39')]};return db['FreshdeskConfiguration'][_0xbb94('0x1b')](_0x5a117b)[_0xbb94('0x22')](function(_0x81c6f){_0x50a2ac['count']=_0x81c6f;if(_0x2714a8['query'][_0xbb94('0x3d')]){_0x15c58c[_0xbb94('0x3e')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xbb94('0x3f')](_0x15c58c);})[_0xbb94('0x22')](function(_0x1b2be0){_0x50a2ac[_0xbb94('0x40')]=_0x1b2be0;return _0x50a2ac;})[_0xbb94('0x22')](respondWithFilteredResult(_0x23e2f5,_0x15c58c))[_0xbb94('0x41')](handleError(_0x23e2f5,null));};exports[_0xbb94('0x42')]=function(_0x52f115,_0x5df186){var _0x2c5ab1={'raw':![],'where':{'id':_0x52f115[_0xbb94('0x43')]['id']}},_0x362859={};_0x362859['model']=_[_0xbb94('0x30')](db[_0xbb94('0x29')]['rawAttributes']);_0x362859['query']=_['keys'](_0x52f115[_0xbb94('0x2f')]);_0x362859[_0xbb94('0x31')]=_['intersection'](_0x362859[_0xbb94('0x2d')],_0x362859[_0xbb94('0x2f')]);_0x2c5ab1[_0xbb94('0x33')]=_[_0xbb94('0x32')](_0x362859[_0xbb94('0x2d')],qs[_0xbb94('0x34')](_0x52f115[_0xbb94('0x2f')][_0xbb94('0x34')]));_0x2c5ab1[_0xbb94('0x33')]=_0x2c5ab1[_0xbb94('0x33')][_0xbb94('0x35')]?_0x2c5ab1[_0xbb94('0x33')]:_0x362859[_0xbb94('0x2d')];if(_0x52f115[_0xbb94('0x2f')][_0xbb94('0x3d')]){_0x2c5ab1[_0xbb94('0x3e')]=[{'all':!![]}];}_0x2c5ab1=_['merge']({},_0x2c5ab1,_0x52f115[_0xbb94('0x3c')]);return db['FreshdeskConfiguration'][_0xbb94('0x44')](_0x2c5ab1)[_0xbb94('0x22')](handleEntityNotFound(_0x5df186,null))[_0xbb94('0x22')](respondWithResult(_0x5df186,null))[_0xbb94('0x41')](handleError(_0x5df186,null));};exports[_0xbb94('0x45')]=function(_0x1ee463,_0x1bd04a){return db[_0xbb94('0x29')][_0xbb94('0x45')](_0x1ee463['body'],{})[_0xbb94('0x22')](respondWithResult(_0x1bd04a,0xc9))[_0xbb94('0x41')](handleError(_0x1bd04a,null));};exports[_0xbb94('0x21')]=function(_0x35872d,_0x9e175a){if(_0x35872d[_0xbb94('0x46')]['id']){delete _0x35872d[_0xbb94('0x46')]['id'];}return db[_0xbb94('0x29')]['find']({'where':{'id':_0x35872d['params']['id']}})['then'](handleEntityNotFound(_0x9e175a,null))[_0xbb94('0x22')](saveUpdates(_0x35872d[_0xbb94('0x46')],null))[_0xbb94('0x22')](respondWithResult(_0x9e175a,null))[_0xbb94('0x41')](handleError(_0x9e175a,null));};exports[_0xbb94('0x23')]=function(_0x20a280,_0x529bcf){return db[_0xbb94('0x29')]['find']({'where':{'id':_0x20a280['params']['id']}})[_0xbb94('0x22')](handleEntityNotFound(_0x529bcf,null))[_0xbb94('0x22')](removeEntity(_0x529bcf,null))['catch'](handleError(_0x529bcf,null));};exports[_0xbb94('0x47')]=function(_0x32f5b4,_0x9a983b,_0x2e81ca){var _0x494b6a={};var _0x3c216d={};var _0x1ef68b;var _0x549c32;return db[_0xbb94('0x29')]['findOne']({'where':{'id':_0x32f5b4[_0xbb94('0x43')]['id']}})[_0xbb94('0x22')](handleEntityNotFound(_0x9a983b,null))[_0xbb94('0x22')](function(_0x377b73){if(_0x377b73){_0x1ef68b=_0x377b73;_0x3c216d['model']=_[_0xbb94('0x30')](db[_0xbb94('0x48')][_0xbb94('0x49')]);_0x3c216d['query']=_[_0xbb94('0x30')](_0x32f5b4[_0xbb94('0x2f')]);_0x3c216d[_0xbb94('0x31')]=_[_0xbb94('0x32')](_0x3c216d[_0xbb94('0x2d')],_0x3c216d[_0xbb94('0x2f')]);_0x494b6a[_0xbb94('0x33')]=_[_0xbb94('0x32')](_0x3c216d['model'],qs[_0xbb94('0x34')](_0x32f5b4[_0xbb94('0x2f')][_0xbb94('0x34')]));_0x494b6a[_0xbb94('0x33')]=_0x494b6a[_0xbb94('0x33')][_0xbb94('0x35')]?_0x494b6a[_0xbb94('0x33')]:_0x3c216d[_0xbb94('0x2d')];_0x494b6a[_0xbb94('0x4a')]=qs['sort'](_0x32f5b4[_0xbb94('0x2f')][_0xbb94('0x38')]);_0x494b6a[_0xbb94('0x39')]=qs[_0xbb94('0x31')](_[_0xbb94('0x4b')](_0x32f5b4['query'],_0x3c216d[_0xbb94('0x31')]));if(_0x32f5b4['query'][_0xbb94('0x3a')]){_0x494b6a[_0xbb94('0x39')]=_[_0xbb94('0x3b')](_0x494b6a[_0xbb94('0x39')],{'$or':_[_0xbb94('0x2e')](_0x494b6a[_0xbb94('0x33')],function(_0x44bd8c){var _0x3ab3ca={};_0x3ab3ca[_0x44bd8c]={'$like':'%'+_0x32f5b4[_0xbb94('0x2f')][_0xbb94('0x3a')]+'%'};return _0x3ab3ca;})});}_0x494b6a=_['merge']({},_0x494b6a,_0x32f5b4[_0xbb94('0x3c')]);return _0x1ef68b[_0xbb94('0x47')](_0x494b6a);}})['then'](function(_0x5c0862){if(_0x5c0862){_0x549c32=_0x5c0862[_0xbb94('0x35')];if(!_0x32f5b4[_0xbb94('0x2f')][_0xbb94('0x36')]('nolimit')){_0x494b6a[_0xbb94('0x19')]=qs[_0xbb94('0x19')](_0x32f5b4[_0xbb94('0x2f')][_0xbb94('0x19')]);_0x494b6a[_0xbb94('0x18')]=qs[_0xbb94('0x18')](_0x32f5b4['query'][_0xbb94('0x18')]);}return _0x1ef68b[_0xbb94('0x47')](_0x494b6a);}})[_0xbb94('0x22')](function(_0x4ec412){if(_0x4ec412){return _0x4ec412?{'count':_0x549c32,'rows':_0x4ec412}:null;}})['then'](respondWithResult(_0x9a983b,null))['catch'](handleError(_0x9a983b,null));};exports[_0xbb94('0x4c')]=function(_0x9f138a,_0x15ae8d,_0x30259b){var _0xa6f25a={};var _0x36081b={};var _0x114f00;var _0x1bf8a3;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x9f138a['params']['id']}})['then'](handleEntityNotFound(_0x15ae8d,null))[_0xbb94('0x22')](function(_0xeb0939){if(_0xeb0939){_0x114f00=_0xeb0939;_0x36081b['model']=_[_0xbb94('0x30')](db[_0xbb94('0x48')][_0xbb94('0x49')]);_0x36081b[_0xbb94('0x2f')]=_[_0xbb94('0x30')](_0x9f138a[_0xbb94('0x2f')]);_0x36081b[_0xbb94('0x31')]=_[_0xbb94('0x32')](_0x36081b[_0xbb94('0x2d')],_0x36081b[_0xbb94('0x2f')]);_0xa6f25a[_0xbb94('0x33')]=_[_0xbb94('0x32')](_0x36081b[_0xbb94('0x2d')],qs[_0xbb94('0x34')](_0x9f138a['query']['fields']));_0xa6f25a[_0xbb94('0x33')]=_0xa6f25a[_0xbb94('0x33')][_0xbb94('0x35')]?_0xa6f25a[_0xbb94('0x33')]:_0x36081b[_0xbb94('0x2d')];_0xa6f25a[_0xbb94('0x4a')]=qs[_0xbb94('0x38')](_0x9f138a['query'][_0xbb94('0x38')]);_0xa6f25a[_0xbb94('0x39')]=qs[_0xbb94('0x31')](_[_0xbb94('0x4b')](_0x9f138a[_0xbb94('0x2f')],_0x36081b['filters']));if(_0x9f138a[_0xbb94('0x2f')][_0xbb94('0x3a')]){_0xa6f25a[_0xbb94('0x39')]=_[_0xbb94('0x3b')](_0xa6f25a[_0xbb94('0x39')],{'$or':_[_0xbb94('0x2e')](_0xa6f25a[_0xbb94('0x33')],function(_0x2b223b){var _0x4c79a3={};_0x4c79a3[_0x2b223b]={'$like':'%'+_0x9f138a[_0xbb94('0x2f')]['filter']+'%'};return _0x4c79a3;})});}_0xa6f25a=_[_0xbb94('0x3b')]({},_0xa6f25a,_0x9f138a[_0xbb94('0x3c')]);return _0x114f00[_0xbb94('0x4c')](_0xa6f25a);}})[_0xbb94('0x22')](function(_0x33effd){if(_0x33effd){_0x1bf8a3=_0x33effd[_0xbb94('0x35')];if(!_0x9f138a[_0xbb94('0x2f')][_0xbb94('0x36')](_0xbb94('0x37'))){_0xa6f25a[_0xbb94('0x19')]=qs['limit'](_0x9f138a[_0xbb94('0x2f')][_0xbb94('0x19')]);_0xa6f25a[_0xbb94('0x18')]=qs['offset'](_0x9f138a[_0xbb94('0x2f')][_0xbb94('0x18')]);}return _0x114f00[_0xbb94('0x4c')](_0xa6f25a);}})[_0xbb94('0x22')](function(_0x25d968){if(_0x25d968){return _0x25d968?{'count':_0x1bf8a3,'rows':_0x25d968}:null;}})[_0xbb94('0x22')](respondWithResult(_0x15ae8d,null))[_0xbb94('0x41')](handleError(_0x15ae8d,null));};exports[_0xbb94('0x4d')]=function(_0x1916e1,_0x2321f7,_0x542bba){var _0x6fb2bf={};var _0xa1d22b={};var _0x8bb8c2;var _0x56dafe;return db['FreshdeskConfiguration'][_0xbb94('0x4e')]({'where':{'id':_0x1916e1[_0xbb94('0x43')]['id']}})[_0xbb94('0x22')](handleEntityNotFound(_0x2321f7,null))['then'](function(_0x53f795){if(_0x53f795){_0x8bb8c2=_0x53f795;_0xa1d22b[_0xbb94('0x2d')]=_[_0xbb94('0x30')](db[_0xbb94('0x48')]['rawAttributes']);_0xa1d22b[_0xbb94('0x2f')]=_[_0xbb94('0x30')](_0x1916e1[_0xbb94('0x2f')]);_0xa1d22b[_0xbb94('0x31')]=_['intersection'](_0xa1d22b['model'],_0xa1d22b[_0xbb94('0x2f')]);_0x6fb2bf[_0xbb94('0x33')]=_[_0xbb94('0x32')](_0xa1d22b[_0xbb94('0x2d')],qs[_0xbb94('0x34')](_0x1916e1['query'][_0xbb94('0x34')]));_0x6fb2bf[_0xbb94('0x33')]=_0x6fb2bf[_0xbb94('0x33')]['length']?_0x6fb2bf[_0xbb94('0x33')]:_0xa1d22b[_0xbb94('0x2d')];_0x6fb2bf[_0xbb94('0x4a')]=qs[_0xbb94('0x38')](_0x1916e1[_0xbb94('0x2f')][_0xbb94('0x38')]);_0x6fb2bf['where']=qs[_0xbb94('0x31')](_['pick'](_0x1916e1[_0xbb94('0x2f')],_0xa1d22b[_0xbb94('0x31')]));if(_0x1916e1[_0xbb94('0x2f')][_0xbb94('0x3a')]){_0x6fb2bf['where']=_[_0xbb94('0x3b')](_0x6fb2bf[_0xbb94('0x39')],{'$or':_[_0xbb94('0x2e')](_0x6fb2bf['attributes'],function(_0x25ae95){var _0xb0945f={};_0xb0945f[_0x25ae95]={'$like':'%'+_0x1916e1[_0xbb94('0x2f')][_0xbb94('0x3a')]+'%'};return _0xb0945f;})});}_0x6fb2bf=_[_0xbb94('0x3b')]({},_0x6fb2bf,_0x1916e1[_0xbb94('0x3c')]);return _0x8bb8c2['getDescriptions'](_0x6fb2bf);}})[_0xbb94('0x22')](function(_0x5df0e2){if(_0x5df0e2){_0x56dafe=_0x5df0e2[_0xbb94('0x35')];if(!_0x1916e1[_0xbb94('0x2f')][_0xbb94('0x36')](_0xbb94('0x37'))){_0x6fb2bf[_0xbb94('0x19')]=qs[_0xbb94('0x19')](_0x1916e1[_0xbb94('0x2f')][_0xbb94('0x19')]);_0x6fb2bf['offset']=qs['offset'](_0x1916e1['query']['offset']);}return _0x8bb8c2[_0xbb94('0x4d')](_0x6fb2bf);}})[_0xbb94('0x22')](function(_0x33fbc7){if(_0x33fbc7){return _0x33fbc7?{'count':_0x56dafe,'rows':_0x33fbc7}:null;}})[_0xbb94('0x22')](respondWithResult(_0x2321f7,null))[_0xbb94('0x41')](handleError(_0x2321f7,null));};exports['getTags']=function(_0x479378,_0x24ee28,_0x3061c1){var _0xe1a6cd={};var _0xd176f3={};var _0x57b235;var _0x565072;return db['FreshdeskConfiguration'][_0xbb94('0x4e')]({'where':{'id':_0x479378[_0xbb94('0x43')]['id']}})['then'](handleEntityNotFound(_0x24ee28,null))['then'](function(_0x1d5894){if(_0x1d5894){_0x57b235=_0x1d5894;_0xd176f3[_0xbb94('0x2d')]=_[_0xbb94('0x30')](db['Tag'][_0xbb94('0x49')]);_0xd176f3[_0xbb94('0x2f')]=_[_0xbb94('0x30')](_0x479378['query']);_0xd176f3[_0xbb94('0x31')]=_[_0xbb94('0x32')](_0xd176f3[_0xbb94('0x2d')],_0xd176f3[_0xbb94('0x2f')]);_0xe1a6cd[_0xbb94('0x33')]=_[_0xbb94('0x32')](_0xd176f3[_0xbb94('0x2d')],qs[_0xbb94('0x34')](_0x479378[_0xbb94('0x2f')][_0xbb94('0x34')]));_0xe1a6cd[_0xbb94('0x33')]=_0xe1a6cd['attributes'][_0xbb94('0x35')]?_0xe1a6cd[_0xbb94('0x33')]:_0xd176f3[_0xbb94('0x2d')];_0xe1a6cd[_0xbb94('0x4a')]=qs['sort'](_0x479378[_0xbb94('0x2f')][_0xbb94('0x38')]);_0xe1a6cd[_0xbb94('0x39')]=qs[_0xbb94('0x31')](_[_0xbb94('0x4b')](_0x479378[_0xbb94('0x2f')],_0xd176f3[_0xbb94('0x31')]));if(_0x479378[_0xbb94('0x2f')][_0xbb94('0x3a')]){_0xe1a6cd['where']=_[_0xbb94('0x3b')](_0xe1a6cd[_0xbb94('0x39')],{'$or':_['map'](_0xe1a6cd['attributes'],function(_0x44b711){var _0x55b0e4={};_0x55b0e4[_0x44b711]={'$like':'%'+_0x479378[_0xbb94('0x2f')][_0xbb94('0x3a')]+'%'};return _0x55b0e4;})});}_0xe1a6cd=_[_0xbb94('0x3b')]({},_0xe1a6cd,_0x479378[_0xbb94('0x3c')]);return _0x57b235[_0xbb94('0x4f')](_0xe1a6cd);}})[_0xbb94('0x22')](function(_0x5a1eb9){if(_0x5a1eb9){_0x565072=_0x5a1eb9[_0xbb94('0x35')];if(!_0x479378['query'][_0xbb94('0x36')](_0xbb94('0x37'))){_0xe1a6cd[_0xbb94('0x19')]=qs[_0xbb94('0x19')](_0x479378[_0xbb94('0x2f')]['limit']);_0xe1a6cd[_0xbb94('0x18')]=qs[_0xbb94('0x18')](_0x479378[_0xbb94('0x2f')][_0xbb94('0x18')]);}return _0x57b235['getTags'](_0xe1a6cd);}})[_0xbb94('0x22')](function(_0x1fb788){if(_0x1fb788){return _0x1fb788?{'count':_0x565072,'rows':_0x1fb788}:null;}})[_0xbb94('0x22')](respondWithResult(_0x24ee28,null))['catch'](handleError(_0x24ee28,null));};exports['setTags']=function(_0x3ecdbf,_0x2a1ba3,_0xa32267){if(_0x3ecdbf[_0xbb94('0x46')]['id']){delete _0x3ecdbf[_0xbb94('0x46')]['id'];}return db[_0xbb94('0x29')][_0xbb94('0x4e')]({'where':{'id':_0x3ecdbf[_0xbb94('0x43')]['id']}})[_0xbb94('0x22')](handleEntityNotFound(_0x2a1ba3,null))['then'](function(_0x58be55){if(_0x58be55){return _0x58be55['setTags'](_0x3ecdbf[_0xbb94('0x46')][_0xbb94('0x50')]||[]);}return null;})[_0xbb94('0x22')](respondWithResult(_0x2a1ba3,null))[_0xbb94('0x41')](handleError(_0x2a1ba3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 21860e8..2cea5e4 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 _0x505b=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x505b,0x11e));var _0xb505=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x505b[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0xb505('0x0'));var util=require(_0xb505('0x1'));var logger=require(_0xb505('0x2'))('api');var moment=require(_0xb505('0x3'));var BPromise=require(_0xb505('0x4'));var rp=require(_0xb505('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb505('0x6'));var config=require(_0xb505('0x7'));var attributes=require(_0xb505('0x8'));module['exports']=function(_0x39c482,_0x2f2bba){return _0x39c482[_0xb505('0x9')](_0xb505('0xa'),attributes,{'tableName':_0xb505('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc03=['moment','bluebird','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','../../config/logger','api'];(function(_0x12e00b,_0x1b04c7){var _0x59f376=function(_0x5d9c6f){while(--_0x5d9c6f){_0x12e00b['push'](_0x12e00b['shift']());}};_0x59f376(++_0x1b04c7);}(_0xbc03,0xd5));var _0x3bc0=function(_0x10c51f,_0x11270f){_0x10c51f=_0x10c51f-0x0;var _0x56a0cd=_0xbc03[_0x10c51f];return _0x56a0cd;};'use strict';var _=require(_0x3bc0('0x0'));var util=require('util');var logger=require(_0x3bc0('0x1'))(_0x3bc0('0x2'));var moment=require(_0x3bc0('0x3'));var BPromise=require(_0x3bc0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3bc0('0x5'));var config=require(_0x3bc0('0x6'));var attributes=require(_0x3bc0('0x7'));module[_0x3bc0('0x8')]=function(_0x1335ee,_0x127864){return _0x1335ee[_0x3bc0('0x9')](_0x3bc0('0xa'),attributes,{'tableName':_0x3bc0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index caec30c..273edf1 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 _0xabad=['../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x430469,_0x20e783){var _0x1ca55e=function(_0x42e6e6){while(--_0x42e6e6){_0x430469['push'](_0x430469['shift']());}};_0x1ca55e(++_0x20e783);}(_0xabad,0x12f));var _0xdaba=function(_0x3da312,_0x391ccd){_0x3da312=_0x3da312-0x0;var _0x28fb08=_0xabad[_0x3da312];return _0x28fb08;};'use strict';var _=require(_0xdaba('0x0'));var util=require(_0xdaba('0x1'));var moment=require(_0xdaba('0x2'));var BPromise=require(_0xdaba('0x3'));var rs=require(_0xdaba('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdaba('0x5'))['db'];var utils=require(_0xdaba('0x6'));var logger=require(_0xdaba('0x7'))(_0xdaba('0x8'));var config=require(_0xdaba('0x9'));var jayson=require(_0xdaba('0xa'));var client=jayson[_0xdaba('0xb')][_0xdaba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb1dfd4,_0x42ec98,_0x32030d){return new BPromise(function(_0x141cb0,_0x2c4477){return client[_0xdaba('0xd')](_0xb1dfd4,_0x32030d)[_0xdaba('0xe')](function(_0x3bb424){logger[_0xdaba('0xf')](_0xdaba('0x10'),_0x42ec98,_0xdaba('0x11'));logger[_0xdaba('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42ec98,_0xdaba('0x11'),JSON[_0xdaba('0x13')](_0x3bb424));if(_0x3bb424['error']){if(_0x3bb424['error'][_0xdaba('0x14')]===0x1f4){logger['error'](_0xdaba('0x10'),_0x42ec98,_0x3bb424[_0xdaba('0x15')]['message']);return _0x2c4477(_0x3bb424[_0xdaba('0x15')][_0xdaba('0x16')]);}logger[_0xdaba('0x15')](_0xdaba('0x10'),_0x42ec98,_0x3bb424['error'][_0xdaba('0x16')]);return _0x141cb0(_0x3bb424['error'][_0xdaba('0x16')]);}else{logger['info'](_0xdaba('0x10'),_0x42ec98,_0xdaba('0x11'));_0x141cb0(_0x3bb424['result'][_0xdaba('0x16')]);}})[_0xdaba('0x17')](function(_0x1ead01){logger['error'](_0xdaba('0x10'),_0x42ec98,_0x1ead01);_0x2c4477(_0x1ead01);});});} \ No newline at end of file +var _0x6643=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x6643,0xe7));var _0x3664=function(_0x12627d,_0x51d3f2){_0x12627d=_0x12627d-0x0;var _0x129575=_0x6643[_0x12627d];return _0x129575;};'use strict';var _=require('lodash');var util=require(_0x3664('0x0'));var moment=require(_0x3664('0x1'));var BPromise=require(_0x3664('0x2'));var rs=require(_0x3664('0x3'));var fs=require('fs');var Redis=require(_0x3664('0x4'));var db=require(_0x3664('0x5'))['db'];var utils=require(_0x3664('0x6'));var logger=require(_0x3664('0x7'))('rpc');var config=require(_0x3664('0x8'));var jayson=require(_0x3664('0x9'));var client=jayson[_0x3664('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x88e720,_0x30cee4,_0x1886c2){return new BPromise(function(_0x59cf08,_0x1b773b){return client[_0x3664('0xb')](_0x88e720,_0x1886c2)['then'](function(_0x45386b){logger[_0x3664('0xc')](_0x3664('0xd'),_0x30cee4,_0x3664('0xe'));logger[_0x3664('0xf')](_0x3664('0x10'),_0x30cee4,_0x3664('0xe'),JSON[_0x3664('0x11')](_0x45386b));if(_0x45386b[_0x3664('0x12')]){if(_0x45386b[_0x3664('0x12')][_0x3664('0x13')]===0x1f4){logger[_0x3664('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30cee4,_0x45386b['error'][_0x3664('0x14')]);return _0x1b773b(_0x45386b[_0x3664('0x12')][_0x3664('0x14')]);}logger[_0x3664('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30cee4,_0x45386b[_0x3664('0x12')][_0x3664('0x14')]);return _0x59cf08(_0x45386b['error'][_0x3664('0x14')]);}else{logger[_0x3664('0xc')](_0x3664('0xd'),_0x30cee4,'request\x20sent');_0x59cf08(_0x45386b[_0x3664('0x15')][_0x3664('0x14')]);}})[_0x3664('0x16')](function(_0x2fe7fb){logger[_0x3664('0x12')](_0x3664('0xd'),_0x30cee4,_0x2fe7fb);_0x1b773b(_0x2fe7fb);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e0d742a..fe74186 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 _0x88fb=['/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index'];(function(_0x53fcb5,_0x32d66b){var _0x503f06=function(_0xca0354){while(--_0xca0354){_0x53fcb5['push'](_0x53fcb5['shift']());}};_0x503f06(++_0x32d66b);}(_0x88fb,0x198));var _0xb88f=function(_0x319ab2,_0xaa1204){_0x319ab2=_0x319ab2-0x0;var _0x11c590=_0x88fb[_0x319ab2];return _0x11c590;};'use strict';var multer=require(_0xb88f('0x0'));var util=require('util');var path=require(_0xb88f('0x1'));var timeout=require(_0xb88f('0x2'));var express=require(_0xb88f('0x3'));var router=express[_0xb88f('0x4')]();var fs_extra=require(_0xb88f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb88f('0x6'));var config=require(_0xb88f('0x7'));var controller=require(_0xb88f('0x8'));router[_0xb88f('0x9')]('/',auth[_0xb88f('0xa')](),controller[_0xb88f('0xb')]);router[_0xb88f('0x9')](_0xb88f('0xc'),auth[_0xb88f('0xa')](),controller[_0xb88f('0xd')]);router[_0xb88f('0xe')]('/',auth['isAuthenticated'](),controller[_0xb88f('0xf')]);router[_0xb88f('0x10')](_0xb88f('0xc'),auth[_0xb88f('0xa')](),controller['update']);router[_0xb88f('0x11')](_0xb88f('0xc'),auth[_0xb88f('0xa')](),controller[_0xb88f('0x12')]);module[_0xb88f('0x13')]=router; \ No newline at end of file +var _0x8655=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','post','update','destroy','exports','multer','util','path'];(function(_0x17fed0,_0x281f6f){var _0x49fb26=function(_0x43e431){while(--_0x43e431){_0x17fed0['push'](_0x17fed0['shift']());}};_0x49fb26(++_0x281f6f);}(_0x8655,0x1c9));var _0x5865=function(_0x33cf3e,_0x26541f){_0x33cf3e=_0x33cf3e-0x0;var _0x1780ca=_0x8655[_0x33cf3e];return _0x1780ca;};'use strict';var multer=require(_0x5865('0x0'));var util=require(_0x5865('0x1'));var path=require(_0x5865('0x2'));var timeout=require(_0x5865('0x3'));var express=require(_0x5865('0x4'));var router=express[_0x5865('0x5')]();var fs_extra=require(_0x5865('0x6'));var auth=require(_0x5865('0x7'));var interaction=require(_0x5865('0x8'));var config=require(_0x5865('0x9'));var controller=require(_0x5865('0xa'));router[_0x5865('0xb')]('/',auth['isAuthenticated'](),controller[_0x5865('0xc')]);router[_0x5865('0xb')](_0x5865('0xd'),auth[_0x5865('0xe')](),controller[_0x5865('0xf')]);router[_0x5865('0x10')]('/',auth[_0x5865('0xe')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5865('0x11')]);router['delete']('/:id',auth[_0x5865('0xe')](),controller[_0x5865('0x12')]);module[_0x5865('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 65ca1c4..41b1030 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 _0xc92b=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x398294,_0x5ceb9d){var _0x2a872d=function(_0x390883){while(--_0x390883){_0x398294['push'](_0x398294['shift']());}};_0x2a872d(++_0x5ceb9d);}(_0xc92b,0x183));var _0xbc92=function(_0x5e8610,_0x2025d5){_0x5e8610=_0x5e8610-0x0;var _0x669eac=_0xc92b[_0x5e8610];return _0x669eac;};'use strict';var Sequelize=require(_0xbc92('0x0'));module[_0xbc92('0x1')]={'type':{'type':Sequelize[_0xbc92('0x2')](_0xbc92('0x3'),_0xbc92('0x4'),_0xbc92('0x5'),_0xbc92('0x6'),'picklist'),'defaultValue':_0xbc92('0x3')},'content':{'type':Sequelize[_0xbc92('0x7')]},'key':{'type':Sequelize[_0xbc92('0x7')]},'keyType':{'type':Sequelize[_0xbc92('0x2')](_0xbc92('0x3'),_0xbc92('0x4'),_0xbc92('0x5'))},'keyContent':{'type':Sequelize[_0xbc92('0x7')]},'idField':{'type':Sequelize[_0xbc92('0x7')]},'nameField':{'type':Sequelize[_0xbc92('0x7')]},'customField':{'type':Sequelize[_0xbc92('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd8e1=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd8e1,0x103));var _0x1d8e=function(_0x51f1a5,_0x4fecc4){_0x51f1a5=_0x51f1a5-0x0;var _0xdcf7f2=_0xd8e1[_0x51f1a5];return _0xdcf7f2;};'use strict';var Sequelize=require(_0x1d8e('0x0'));module[_0x1d8e('0x1')]={'type':{'type':Sequelize[_0x1d8e('0x2')](_0x1d8e('0x3'),_0x1d8e('0x4'),_0x1d8e('0x5'),'keyValue',_0x1d8e('0x6')),'defaultValue':_0x1d8e('0x3')},'content':{'type':Sequelize[_0x1d8e('0x7')]},'key':{'type':Sequelize[_0x1d8e('0x7')]},'keyType':{'type':Sequelize[_0x1d8e('0x2')](_0x1d8e('0x3'),'variable',_0x1d8e('0x5'))},'keyContent':{'type':Sequelize[_0x1d8e('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x1d8e('0x7')]},'customField':{'type':Sequelize[_0x1d8e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1d8e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index a6db36e..9085d7a 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 _0x0713=['request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','params','keys','find','catch','body','zip-dir','fast-json-patch'];(function(_0x5a14b6,_0xa71c7e){var _0x26bd86=function(_0x109087){while(--_0x109087){_0x5a14b6['push'](_0x5a14b6['shift']());}};_0x26bd86(++_0xa71c7e);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={},_0x292205={},_0x254fc8={'count':0x0,'rows':[]};var _0x5aba96=_['map'](db[_0x3071('0x2d')][_0x3071('0x2e')],function(_0x6ddf96){return{'name':_0x6ddf96[_0x3071('0x2f')],'type':_0x6ddf96[_0x3071('0x30')][_0x3071('0x31')]};});_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x5aba96,'name');_0x292205['query']=_['keys'](_0x177b5f[_0x3071('0x34')]);_0x292205[_0x3071('0x35')]=_['intersection'](_0x292205[_0x3071('0x32')],_0x292205[_0x3071('0x34')]);_0x32f1b4[_0x3071('0x36')]=_[_0x3071('0x37')](_0x292205['model'],qs[_0x3071('0x38')](_0x177b5f[_0x3071('0x34')][_0x3071('0x38')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x39')]?_0x32f1b4[_0x3071('0x36')]:_0x292205[_0x3071('0x32')];if(!_0x177b5f['query'][_0x3071('0x3a')]('nolimit')){_0x32f1b4['limit']=qs[_0x3071('0x20')](_0x177b5f[_0x3071('0x34')]['limit']);_0x32f1b4[_0x3071('0x1e')]=qs[_0x3071('0x1e')](_0x177b5f[_0x3071('0x34')][_0x3071('0x1e')]);}_0x32f1b4[_0x3071('0x3b')]=qs[_0x3071('0x3c')](_0x177b5f['query'][_0x3071('0x3c')]);_0x32f1b4[_0x3071('0x3d')]=qs['filters'](_[_0x3071('0x3e')](_0x177b5f['query'],_0x292205[_0x3071('0x35')]),_0x5aba96);if(_0x177b5f[_0x3071('0x34')]['filter']){_0x32f1b4['where']=_[_0x3071('0x3f')](_0x32f1b4[_0x3071('0x3d')],{'$or':_[_0x3071('0x33')](_0x5aba96,function(_0x55afa6){if(_0x55afa6[_0x3071('0x30')]!=='VIRTUAL'){var _0x1ac90a={};_0x1ac90a[_0x55afa6['name']]={'$like':'%'+_0x177b5f[_0x3071('0x34')][_0x3071('0x40')]+'%'};return _0x1ac90a;}})});}_0x32f1b4=_[_0x3071('0x3f')]({},_0x32f1b4,_0x177b5f[_0x3071('0x41')]);var _0x30ab68={'where':_0x32f1b4['where']};return db['FreshdeskField'][_0x3071('0x21')](_0x30ab68)[_0x3071('0x27')](function(_0x1455be){_0x254fc8[_0x3071('0x21')]=_0x1455be;if(_0x177b5f['query'][_0x3071('0x42')]){_0x32f1b4[_0x3071('0x43')]=[{'all':!![]}];}return db[_0x3071('0x2d')][_0x3071('0x44')](_0x32f1b4);})[_0x3071('0x27')](function(_0xb9a4b8){_0x254fc8['rows']=_0xb9a4b8;return _0x254fc8;})[_0x3071('0x27')](respondWithFilteredResult(_0x3921a1,_0x32f1b4))['catch'](handleError(_0x3921a1,null));};exports['show']=function(_0x4dc9d1,_0x47ceaf){var _0x2992e6={'raw':!![],'where':{'id':_0x4dc9d1[_0x3071('0x45')]['id']}},_0x1be8b6={};_0x1be8b6[_0x3071('0x32')]=_[_0x3071('0x46')](db[_0x3071('0x2d')][_0x3071('0x2e')]);_0x1be8b6[_0x3071('0x34')]=_['keys'](_0x4dc9d1[_0x3071('0x34')]);_0x1be8b6[_0x3071('0x35')]=_[_0x3071('0x37')](_0x1be8b6[_0x3071('0x32')],_0x1be8b6[_0x3071('0x34')]);_0x2992e6['attributes']=_['intersection'](_0x1be8b6[_0x3071('0x32')],qs[_0x3071('0x38')](_0x4dc9d1[_0x3071('0x34')][_0x3071('0x38')]));_0x2992e6[_0x3071('0x36')]=_0x2992e6['attributes'][_0x3071('0x39')]?_0x2992e6['attributes']:_0x1be8b6[_0x3071('0x32')];if(_0x4dc9d1['query']['includeAll']){_0x2992e6[_0x3071('0x43')]=[{'all':!![]}];}_0x2992e6=_['merge']({},_0x2992e6,_0x4dc9d1[_0x3071('0x41')]);return db['FreshdeskField'][_0x3071('0x47')](_0x2992e6)[_0x3071('0x27')](handleEntityNotFound(_0x47ceaf,null))[_0x3071('0x27')](respondWithResult(_0x47ceaf,null))[_0x3071('0x48')](handleError(_0x47ceaf,null));};exports['create']=function(_0x2d70bf,_0x575c12){return db[_0x3071('0x2d')]['create'](_0x2d70bf[_0x3071('0x49')],{})[_0x3071('0x27')](respondWithResult(_0x575c12,0xc9))['catch'](handleError(_0x575c12,null));};exports[_0x3071('0x26')]=function(_0x117e73,_0x224a70){if(_0x117e73[_0x3071('0x49')]['id']){delete _0x117e73[_0x3071('0x49')]['id'];}return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x117e73['params']['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x224a70,null))[_0x3071('0x27')](saveUpdates(_0x117e73[_0x3071('0x49')],null))[_0x3071('0x27')](respondWithResult(_0x224a70,null))['catch'](handleError(_0x224a70,null));};exports[_0x3071('0x28')]=function(_0x2aea37,_0x1b832e){return db[_0x3071('0x2d')][_0x3071('0x47')]({'where':{'id':_0x2aea37[_0x3071('0x45')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1b832e,null))[_0x3071('0x27')](removeEntity(_0x1b832e,null))[_0x3071('0x48')](handleError(_0x1b832e,null));}; \ No newline at end of file +var _0xe205=['merge','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','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','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','FreshdeskField','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x5a30fb,_0x206270){var _0x3b86aa=function(_0x67ea17){while(--_0x67ea17){_0x5a30fb['push'](_0x5a30fb['shift']());}};_0x3b86aa(++_0x206270);}(_0xe205,0xa7));var _0x5e20=function(_0x50852f,_0x416cc8){_0x50852f=_0x50852f-0x0;var _0x4b8e9f=_0xe205[_0x50852f];return _0x4b8e9f;};'use strict';var emlformat=require(_0x5e20('0x0'));var rimraf=require(_0x5e20('0x1'));var zipdir=require(_0x5e20('0x2'));var jsonpatch=require(_0x5e20('0x3'));var rp=require(_0x5e20('0x4'));var moment=require(_0x5e20('0x5'));var BPromise=require(_0x5e20('0x6'));var Mustache=require(_0x5e20('0x7'));var util=require(_0x5e20('0x8'));var path=require('path');var sox=require(_0x5e20('0x9'));var csv=require(_0x5e20('0xa'));var ejs=require(_0x5e20('0xb'));var fs=require('fs');var fs_extra=require(_0x5e20('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xa'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var licenseUtil=require(_0x5e20('0x17'));var db=require(_0x5e20('0x18'))['db'];function respondWithStatusCode(_0x54deee,_0x19eacf){_0x19eacf=_0x19eacf||0xcc;return function(_0x29b7a2){if(_0x29b7a2){return _0x54deee[_0x5e20('0x19')](_0x19eacf);}return _0x54deee['status'](_0x19eacf)[_0x5e20('0x1a')]();};}function respondWithResult(_0x5d827e,_0x1f47f3){_0x1f47f3=_0x1f47f3||0xc8;return function(_0x5ba833){if(_0x5ba833){return _0x5d827e[_0x5e20('0x1b')](_0x1f47f3)[_0x5e20('0x1c')](_0x5ba833);}};}function respondWithFilteredResult(_0x275026,_0x148ada){return function(_0x294df8){if(_0x294df8){var _0x542b3c=typeof _0x148ada[_0x5e20('0x1d')]===_0x5e20('0x1e')&&typeof _0x148ada[_0x5e20('0x1f')]===_0x5e20('0x1e');var _0x2f194b=_0x294df8[_0x5e20('0x20')];var _0x1cc706=_0x542b3c?0x0:_0x148ada[_0x5e20('0x1d')];var _0x4d3e4a=_0x542b3c?_0x294df8[_0x5e20('0x20')]:_0x148ada[_0x5e20('0x1d')]+_0x148ada['limit'];var _0x295eb3;if(_0x4d3e4a>=_0x2f194b){_0x4d3e4a=_0x2f194b;_0x295eb3=0xc8;}else{_0x295eb3=0xce;}_0x275026[_0x5e20('0x1b')](_0x295eb3);return _0x275026[_0x5e20('0x21')](_0x5e20('0x22'),_0x1cc706+'-'+_0x4d3e4a+'/'+_0x2f194b)['json'](_0x294df8);}return null;};}function patchUpdates(_0x2954fc){return function(_0x50f222){try{jsonpatch['apply'](_0x50f222,_0x2954fc,!![]);}catch(_0x57c7c5){return BPromise['reject'](_0x57c7c5);}return _0x50f222[_0x5e20('0x23')]();};}function saveUpdates(_0x5cca90,_0x3d89e4){return function(_0x29b111){if(_0x29b111){return _0x29b111[_0x5e20('0x24')](_0x5cca90)[_0x5e20('0x25')](function(_0x3ef7fa){return _0x3ef7fa;});}return null;};}function removeEntity(_0x2d4614,_0x4c5732){return function(_0x15705f){if(_0x15705f){return _0x15705f['destroy']()['then'](function(){_0x2d4614[_0x5e20('0x1b')](0xcc)[_0x5e20('0x1a')]();});}};}function handleEntityNotFound(_0x2bae08,_0x1b01af){return function(_0xbf7a24){if(!_0xbf7a24){_0x2bae08[_0x5e20('0x19')](0x194);}return _0xbf7a24;};}function handleError(_0x2973b3,_0x5809fd){_0x5809fd=_0x5809fd||0x1f4;return function(_0x3bf4f4){logger[_0x5e20('0x26')](_0x3bf4f4[_0x5e20('0x27')]);if(_0x3bf4f4[_0x5e20('0x28')]){delete _0x3bf4f4['name'];}_0x2973b3[_0x5e20('0x1b')](_0x5809fd)[_0x5e20('0x29')](_0x3bf4f4);};}exports[_0x5e20('0x2a')]=function(_0x222e7a,_0xbed73a){var _0x19709b={},_0x5ec45b={},_0xbc2b0e={'count':0x0,'rows':[]};var _0x34a3d6=_['map'](db[_0x5e20('0x2b')][_0x5e20('0x2c')],function(_0x335f1e){return{'name':_0x335f1e[_0x5e20('0x2d')],'type':_0x335f1e[_0x5e20('0x2e')][_0x5e20('0x2f')]};});_0x5ec45b['model']=_[_0x5e20('0x30')](_0x34a3d6,_0x5e20('0x28'));_0x5ec45b[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0x222e7a[_0x5e20('0x31')]);_0x5ec45b[_0x5e20('0x33')]=_[_0x5e20('0x34')](_0x5ec45b[_0x5e20('0x35')],_0x5ec45b[_0x5e20('0x31')]);_0x19709b[_0x5e20('0x36')]=_[_0x5e20('0x34')](_0x5ec45b['model'],qs[_0x5e20('0x37')](_0x222e7a[_0x5e20('0x31')][_0x5e20('0x37')]));_0x19709b['attributes']=_0x19709b[_0x5e20('0x36')][_0x5e20('0x38')]?_0x19709b[_0x5e20('0x36')]:_0x5ec45b[_0x5e20('0x35')];if(!_0x222e7a[_0x5e20('0x31')][_0x5e20('0x39')](_0x5e20('0x3a'))){_0x19709b[_0x5e20('0x1f')]=qs[_0x5e20('0x1f')](_0x222e7a[_0x5e20('0x31')][_0x5e20('0x1f')]);_0x19709b[_0x5e20('0x1d')]=qs[_0x5e20('0x1d')](_0x222e7a[_0x5e20('0x31')]['offset']);}_0x19709b[_0x5e20('0x3b')]=qs['sort'](_0x222e7a['query'][_0x5e20('0x3c')]);_0x19709b[_0x5e20('0x3d')]=qs['filters'](_[_0x5e20('0x3e')](_0x222e7a[_0x5e20('0x31')],_0x5ec45b['filters']),_0x34a3d6);if(_0x222e7a[_0x5e20('0x31')][_0x5e20('0x3f')]){_0x19709b[_0x5e20('0x3d')]=_[_0x5e20('0x40')](_0x19709b[_0x5e20('0x3d')],{'$or':_[_0x5e20('0x30')](_0x34a3d6,function(_0x94925e){if(_0x94925e[_0x5e20('0x2e')]!==_0x5e20('0x41')){var _0x20be56={};_0x20be56[_0x94925e[_0x5e20('0x28')]]={'$like':'%'+_0x222e7a[_0x5e20('0x31')][_0x5e20('0x3f')]+'%'};return _0x20be56;}})});}_0x19709b=_[_0x5e20('0x40')]({},_0x19709b,_0x222e7a[_0x5e20('0x42')]);var _0x3d618c={'where':_0x19709b[_0x5e20('0x3d')]};return db[_0x5e20('0x2b')]['count'](_0x3d618c)[_0x5e20('0x25')](function(_0x29215f){_0xbc2b0e[_0x5e20('0x20')]=_0x29215f;if(_0x222e7a[_0x5e20('0x31')][_0x5e20('0x43')]){_0x19709b['include']=[{'all':!![]}];}return db[_0x5e20('0x2b')][_0x5e20('0x44')](_0x19709b);})[_0x5e20('0x25')](function(_0x24c05f){_0xbc2b0e[_0x5e20('0x45')]=_0x24c05f;return _0xbc2b0e;})[_0x5e20('0x25')](respondWithFilteredResult(_0xbed73a,_0x19709b))['catch'](handleError(_0xbed73a,null));};exports[_0x5e20('0x46')]=function(_0xc24cce,_0xa52d83){var _0x5a21f0={'raw':!![],'where':{'id':_0xc24cce[_0x5e20('0x47')]['id']}},_0x2b031d={};_0x2b031d[_0x5e20('0x35')]=_[_0x5e20('0x32')](db[_0x5e20('0x2b')][_0x5e20('0x2c')]);_0x2b031d[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0xc24cce['query']);_0x2b031d[_0x5e20('0x33')]=_[_0x5e20('0x34')](_0x2b031d[_0x5e20('0x35')],_0x2b031d['query']);_0x5a21f0[_0x5e20('0x36')]=_['intersection'](_0x2b031d[_0x5e20('0x35')],qs[_0x5e20('0x37')](_0xc24cce[_0x5e20('0x31')][_0x5e20('0x37')]));_0x5a21f0[_0x5e20('0x36')]=_0x5a21f0['attributes'][_0x5e20('0x38')]?_0x5a21f0['attributes']:_0x2b031d['model'];if(_0xc24cce[_0x5e20('0x31')][_0x5e20('0x43')]){_0x5a21f0[_0x5e20('0x48')]=[{'all':!![]}];}_0x5a21f0=_[_0x5e20('0x40')]({},_0x5a21f0,_0xc24cce[_0x5e20('0x42')]);return db[_0x5e20('0x2b')][_0x5e20('0x49')](_0x5a21f0)['then'](handleEntityNotFound(_0xa52d83,null))['then'](respondWithResult(_0xa52d83,null))[_0x5e20('0x4a')](handleError(_0xa52d83,null));};exports[_0x5e20('0x4b')]=function(_0x5e84bd,_0x22b84e){return db[_0x5e20('0x2b')][_0x5e20('0x4b')](_0x5e84bd[_0x5e20('0x4c')],{})[_0x5e20('0x25')](respondWithResult(_0x22b84e,0xc9))['catch'](handleError(_0x22b84e,null));};exports[_0x5e20('0x24')]=function(_0x245b52,_0x25491e){if(_0x245b52[_0x5e20('0x4c')]['id']){delete _0x245b52[_0x5e20('0x4c')]['id'];}return db[_0x5e20('0x2b')][_0x5e20('0x49')]({'where':{'id':_0x245b52[_0x5e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x25491e,null))['then'](saveUpdates(_0x245b52['body'],null))[_0x5e20('0x25')](respondWithResult(_0x25491e,null))[_0x5e20('0x4a')](handleError(_0x25491e,null));};exports['destroy']=function(_0x4392ca,_0x4bfea7){return db[_0x5e20('0x2b')]['find']({'where':{'id':_0x4392ca[_0x5e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bfea7,null))[_0x5e20('0x25')](removeEntity(_0x4bfea7,null))[_0x5e20('0x4a')](handleError(_0x4bfea7,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 85b844e..b4763b6 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 _0x2cb4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','util'];(function(_0x363dac,_0x300b7e){var _0x53de00=function(_0x1d0d45){while(--_0x1d0d45){_0x363dac['push'](_0x363dac['shift']());}};_0x53de00(++_0x300b7e);}(_0x2cb4,0x13e));var _0x42cb=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0x2cb4[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0x42cb('0x0'));var util=require(_0x42cb('0x1'));var logger=require(_0x42cb('0x2'))(_0x42cb('0x3'));var moment=require(_0x42cb('0x4'));var BPromise=require(_0x42cb('0x5'));var rp=require(_0x42cb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x42cb('0x7'));var config=require(_0x42cb('0x8'));var attributes=require(_0x42cb('0x9'));module[_0x42cb('0xa')]=function(_0x1a3c33,_0x492a40){return _0x1a3c33[_0x42cb('0xb')](_0x42cb('0xc'),attributes,{'tableName':_0x42cb('0xd'),'paranoid':![],'indexes':[{'name':_0x42cb('0xe'),'fields':['idField',_0x42cb('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8b=['rimraf','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash','api','bluebird','request-promise'];(function(_0x17a0f9,_0x2f90a8){var _0x18039c=function(_0x39d9b5){while(--_0x39d9b5){_0x17a0f9['push'](_0x17a0f9['shift']());}};_0x18039c(++_0x2f90a8);}(_0x2c8b,0x8b));var _0xb2c8=function(_0x253434,_0x224f02){_0x253434=_0x253434-0x0;var _0x230da8=_0x2c8b[_0x253434];return _0x230da8;};'use strict';var _=require(_0xb2c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb2c8('0x1'));var moment=require('moment');var BPromise=require(_0xb2c8('0x2'));var rp=require(_0xb2c8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2c8('0x4'));var config=require('../../config/environment');var attributes=require(_0xb2c8('0x5'));module['exports']=function(_0x29619a,_0x203a99){return _0x29619a[_0xb2c8('0x6')](_0xb2c8('0x7'),attributes,{'tableName':_0xb2c8('0x8'),'paranoid':![],'indexes':[{'name':_0xb2c8('0x9'),'fields':['idField',_0xb2c8('0xa')],'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 646a3b1..78e15bc 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 _0xedf3=['info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xedf3,0x17a));var _0x3edf=function(_0x5a8aa3,_0x2294d5){_0x5a8aa3=_0x5a8aa3-0x0;var _0x5d0458=_0xedf3[_0x5a8aa3];return _0x5d0458;};'use strict';var _=require('lodash');var util=require(_0x3edf('0x0'));var moment=require(_0x3edf('0x1'));var BPromise=require(_0x3edf('0x2'));var rs=require(_0x3edf('0x3'));var fs=require('fs');var Redis=require(_0x3edf('0x4'));var db=require(_0x3edf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3edf('0x6'))(_0x3edf('0x7'));var config=require(_0x3edf('0x8'));var jayson=require(_0x3edf('0x9'));var client=jayson['client'][_0x3edf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ebb50,_0x50f7fe,_0x290673){return new BPromise(function(_0x27f076,_0x370588){return client[_0x3edf('0xb')](_0x4ebb50,_0x290673)[_0x3edf('0xc')](function(_0x551336){logger[_0x3edf('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x50f7fe,_0x3edf('0xe'));logger[_0x3edf('0xf')](_0x3edf('0x10'),_0x50f7fe,_0x3edf('0xe'),JSON[_0x3edf('0x11')](_0x551336));if(_0x551336[_0x3edf('0x12')]){if(_0x551336[_0x3edf('0x12')][_0x3edf('0x13')]===0x1f4){logger[_0x3edf('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x50f7fe,_0x551336['error'][_0x3edf('0x14')]);return _0x370588(_0x551336['error'][_0x3edf('0x14')]);}logger[_0x3edf('0x12')]('FreshdeskField,\x20%s,\x20%s',_0x50f7fe,_0x551336[_0x3edf('0x12')][_0x3edf('0x14')]);return _0x27f076(_0x551336['error'][_0x3edf('0x14')]);}else{logger[_0x3edf('0xd')](_0x3edf('0x15'),_0x50f7fe,_0x3edf('0xe'));_0x27f076(_0x551336[_0x3edf('0x16')][_0x3edf('0x14')]);}})['catch'](function(_0x3fd722){logger[_0x3edf('0x12')](_0x3edf('0x15'),_0x50f7fe,_0x3fd722);_0x370588(_0x3fd722);});});} \ No newline at end of file +var _0x6545=['client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x18e8be,_0x584769){var _0x47e356=function(_0x2ff8e7){while(--_0x2ff8e7){_0x18e8be['push'](_0x18e8be['shift']());}};_0x47e356(++_0x584769);}(_0x6545,0x15f));var _0x5654=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6545[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x5654('0x0'));var util=require(_0x5654('0x1'));var moment=require(_0x5654('0x2'));var BPromise=require(_0x5654('0x3'));var rs=require(_0x5654('0x4'));var fs=require('fs');var Redis=require(_0x5654('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5654('0x6'));var logger=require(_0x5654('0x7'))('rpc');var config=require(_0x5654('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5654('0x9')][_0x5654('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12f789,_0x347ebf,_0x21e886){return new BPromise(function(_0x3ec521,_0x209108){return client[_0x5654('0xb')](_0x12f789,_0x21e886)[_0x5654('0xc')](function(_0x140263){logger[_0x5654('0xd')](_0x5654('0xe'),_0x347ebf,_0x5654('0xf'));logger[_0x5654('0x10')](_0x5654('0x11'),_0x347ebf,_0x5654('0xf'),JSON[_0x5654('0x12')](_0x140263));if(_0x140263['error']){if(_0x140263['error'][_0x5654('0x13')]===0x1f4){logger[_0x5654('0x14')](_0x5654('0xe'),_0x347ebf,_0x140263[_0x5654('0x14')][_0x5654('0x15')]);return _0x209108(_0x140263[_0x5654('0x14')][_0x5654('0x15')]);}logger[_0x5654('0x14')](_0x5654('0xe'),_0x347ebf,_0x140263['error'][_0x5654('0x15')]);return _0x3ec521(_0x140263[_0x5654('0x14')]['message']);}else{logger[_0x5654('0xd')](_0x5654('0xe'),_0x347ebf,_0x5654('0xf'));_0x3ec521(_0x140263[_0x5654('0x16')][_0x5654('0x15')]);}})[_0x5654('0x17')](function(_0x1cee61){logger[_0x5654('0x14')](_0x5654('0xe'),_0x347ebf,_0x1cee61);_0x209108(_0x1cee61);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index a01e7d9..303d037 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 _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x1cab1b,_0x38ec24){var _0x32da8e=function(_0x164822){while(--_0x164822){_0x1cab1b['push'](_0x1cab1b['shift']());}};_0x32da8e(++_0x38ec24);}(_0xa478,0x136));var _0x8a47=function(_0xed6f46,_0x1c9006){_0xed6f46=_0xed6f46-0x0;var _0x5b267c=_0xa478[_0xed6f46];return _0x5b267c;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file +var _0x4483=['../../components/auth/service','../../components/interaction/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x4eb957,_0x5af043){var _0x33b09a=function(_0x5c5cb4){while(--_0x5c5cb4){_0x4eb957['push'](_0x4eb957['shift']());}};_0x33b09a(++_0x5af043);}(_0x4483,0x1a3));var _0x3448=function(_0x938bec,_0x559de2){_0x938bec=_0x938bec-0x0;var _0x240a74=_0x4483[_0x938bec];return _0x240a74;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/configurations',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x11')](_0x3448('0x13'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x3448('0x14')](_0x3448('0xc'),auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x16')](_0x3448('0xc'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);module[_0x3448('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c3105cb..0fccd78 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 _0x524e=['username','remoteUri','STRING'];(function(_0x243217,_0x522951){var _0x478029=function(_0x18d053){while(--_0x18d053){_0x243217['push'](_0x243217['shift']());}};_0x478029(++_0x522951);}(_0x524e,0x15e));var _0xe524=function(_0x2c3ce6,_0x364884){_0x2c3ce6=_0x2c3ce6-0x0;var _0x60e8bb=_0x524e[_0x2c3ce6];return _0x60e8bb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x1a696a,_0xed4aef){var _0x401386=function(_0x47550e){while(--_0x47550e){_0x1a696a['push'](_0x1a696a['shift']());}};_0x401386(++_0xed4aef);}(_0x0120,0x6f));var _0x0012=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0120[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('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 6e3cd8e..6d5e993 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 _0x0111=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','count','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','nolimit','order','sort','where','filters','filter','VIRTUAL','options','FreshsalesAccount','includeAll','include','catch','show','params','merge','find','create','body','getConfigurations','findOne','FreshsalesConfiguration','length','hasOwnProperty','Subjects','getSubjects','Descriptions','getDescriptions','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0xb3ae42,_0x4b0299){var _0x2f5eb7=function(_0x3eab8e){while(--_0x3eab8e){_0xb3ae42['push'](_0xb3ae42['shift']());}};_0x2f5eb7(++_0x4b0299);}(_0x0111,0x127));var _0x1011=function(_0x2141c2,_0x15c6bd){_0x2141c2=_0x2141c2-0x0;var _0x1c0c29=_0x0111[_0x2141c2];return _0x1c0c29;};'use strict';var emlformat=require(_0x1011('0x0'));var rimraf=require(_0x1011('0x1'));var zipdir=require(_0x1011('0x2'));var jsonpatch=require(_0x1011('0x3'));var rp=require(_0x1011('0x4'));var moment=require(_0x1011('0x5'));var BPromise=require(_0x1011('0x6'));var Mustache=require(_0x1011('0x7'));var util=require(_0x1011('0x8'));var path=require('path');var sox=require(_0x1011('0x9'));var csv=require(_0x1011('0xa'));var ejs=require(_0x1011('0xb'));var fs=require('fs');var fs_extra=require(_0x1011('0xc'));var _=require(_0x1011('0xd'));var squel=require(_0x1011('0xe'));var crypto=require('crypto');var jsforce=require(_0x1011('0xf'));var deskjs=require(_0x1011('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1011('0x11'));var Redis=require(_0x1011('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1011('0x13'));var as=require(_0x1011('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1011('0x15'))('api');var utils=require(_0x1011('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1011('0x17'));var db=require(_0x1011('0x18'))['db'];var integrations=require(_0x1011('0x19'));function respondWithStatusCode(_0x192c88,_0x5ea7c1){_0x5ea7c1=_0x5ea7c1||0xcc;return function(_0x51a86c){if(_0x51a86c){return _0x192c88[_0x1011('0x1a')](_0x5ea7c1);}return _0x192c88['status'](_0x5ea7c1)[_0x1011('0x1b')]();};}function respondWithResult(_0x2e897b,_0x5d7387){_0x5d7387=_0x5d7387||0xc8;return function(_0x3f0770){if(_0x3f0770){return _0x2e897b[_0x1011('0x1c')](_0x5d7387)[_0x1011('0x1d')](_0x3f0770);}};}function respondWithFilteredResult(_0x2dd523,_0x85cd0c){return function(_0x23c452){if(_0x23c452){var _0x5f34ff=typeof _0x85cd0c['offset']==='undefined'&&typeof _0x85cd0c['limit']==='undefined';var _0x3621b9=_0x23c452['count'];var _0x5777b7=_0x5f34ff?0x0:_0x85cd0c[_0x1011('0x1e')];var _0x53b8a3=_0x5f34ff?_0x23c452[_0x1011('0x1f')]:_0x85cd0c[_0x1011('0x1e')]+_0x85cd0c[_0x1011('0x20')];var _0x5a9823;if(_0x53b8a3>=_0x3621b9){_0x53b8a3=_0x3621b9;_0x5a9823=0xc8;}else{_0x5a9823=0xce;}_0x2dd523[_0x1011('0x1c')](_0x5a9823);return _0x2dd523[_0x1011('0x21')](_0x1011('0x22'),_0x5777b7+'-'+_0x53b8a3+'/'+_0x3621b9)[_0x1011('0x1d')](_0x23c452);}return null;};}function patchUpdates(_0x282fa6){return function(_0x459a47){try{jsonpatch[_0x1011('0x23')](_0x459a47,_0x282fa6,!![]);}catch(_0x280f5d){return BPromise['reject'](_0x280f5d);}return _0x459a47['save']();};}function saveUpdates(_0x9ea05b,_0x268dc6){return function(_0x5dc46d){if(_0x5dc46d){return _0x5dc46d[_0x1011('0x24')](_0x9ea05b)[_0x1011('0x25')](function(_0x864d1b){return _0x864d1b;});}return null;};}function removeEntity(_0x188e10,_0x25f239){return function(_0x232eba){if(_0x232eba){return _0x232eba[_0x1011('0x26')]()[_0x1011('0x25')](function(){_0x188e10[_0x1011('0x1c')](0xcc)[_0x1011('0x1b')]();});}};}function handleEntityNotFound(_0xce3b8a,_0x2629ad){return function(_0x3cfa86){if(!_0x3cfa86){_0xce3b8a['sendStatus'](0x194);}return _0x3cfa86;};}function handleError(_0x5f0169,_0x48a83d){_0x48a83d=_0x48a83d||0x1f4;return function(_0x31aaba){logger[_0x1011('0x27')](_0x31aaba[_0x1011('0x28')]);if(_0x31aaba[_0x1011('0x29')]){delete _0x31aaba[_0x1011('0x29')];}_0x5f0169['status'](_0x48a83d)['send'](_0x31aaba);};}exports[_0x1011('0x2a')]=function(_0x455799,_0x18fa1c){var _0x22dc1a={},_0x56f082={},_0x4cf9ed={'count':0x0,'rows':[]};var _0xc98480=_[_0x1011('0x2b')](db['FreshsalesAccount'][_0x1011('0x2c')],function(_0x3c4e88){return{'name':_0x3c4e88['fieldName'],'type':_0x3c4e88[_0x1011('0x2d')][_0x1011('0x2e')]};});_0x56f082[_0x1011('0x2f')]=_[_0x1011('0x2b')](_0xc98480,_0x1011('0x29'));_0x56f082[_0x1011('0x30')]=_[_0x1011('0x31')](_0x455799[_0x1011('0x30')]);_0x56f082['filters']=_[_0x1011('0x32')](_0x56f082['model'],_0x56f082[_0x1011('0x30')]);_0x22dc1a[_0x1011('0x33')]=_[_0x1011('0x32')](_0x56f082[_0x1011('0x2f')],qs['fields'](_0x455799[_0x1011('0x30')][_0x1011('0x34')]));_0x22dc1a['attributes']=_0x22dc1a['attributes']['length']?_0x22dc1a[_0x1011('0x33')]:_0x56f082['model'];if(!_0x455799['query']['hasOwnProperty'](_0x1011('0x35'))){_0x22dc1a[_0x1011('0x20')]=qs[_0x1011('0x20')](_0x455799[_0x1011('0x30')][_0x1011('0x20')]);_0x22dc1a[_0x1011('0x1e')]=qs[_0x1011('0x1e')](_0x455799[_0x1011('0x30')][_0x1011('0x1e')]);}_0x22dc1a[_0x1011('0x36')]=qs[_0x1011('0x37')](_0x455799['query']['sort']);_0x22dc1a[_0x1011('0x38')]=qs['filters'](_['pick'](_0x455799[_0x1011('0x30')],_0x56f082[_0x1011('0x39')]),_0xc98480);if(_0x455799[_0x1011('0x30')][_0x1011('0x3a')]){_0x22dc1a[_0x1011('0x38')]=_['merge'](_0x22dc1a[_0x1011('0x38')],{'$or':_[_0x1011('0x2b')](_0xc98480,function(_0x796439){if(_0x796439[_0x1011('0x2d')]!==_0x1011('0x3b')){var _0x22dbb6={};_0x22dbb6[_0x796439[_0x1011('0x29')]]={'$like':'%'+_0x455799[_0x1011('0x30')]['filter']+'%'};return _0x22dbb6;}})});}_0x22dc1a=_['merge']({},_0x22dc1a,_0x455799[_0x1011('0x3c')]);var _0x2339ee={'where':_0x22dc1a[_0x1011('0x38')]};return db[_0x1011('0x3d')]['count'](_0x2339ee)[_0x1011('0x25')](function(_0x432425){_0x4cf9ed[_0x1011('0x1f')]=_0x432425;if(_0x455799[_0x1011('0x30')][_0x1011('0x3e')]){_0x22dc1a[_0x1011('0x3f')]=[{'all':!![]}];}return db[_0x1011('0x3d')]['findAll'](_0x22dc1a);})[_0x1011('0x25')](function(_0x5e5695){_0x4cf9ed['rows']=_0x5e5695;return _0x4cf9ed;})[_0x1011('0x25')](respondWithFilteredResult(_0x18fa1c,_0x22dc1a))[_0x1011('0x40')](handleError(_0x18fa1c,null));};exports[_0x1011('0x41')]=function(_0x11e42f,_0x233322){var _0x1c7267={'raw':![],'where':{'id':_0x11e42f[_0x1011('0x42')]['id']}},_0x24be80={};_0x24be80[_0x1011('0x2f')]=_['keys'](db[_0x1011('0x3d')][_0x1011('0x2c')]);_0x24be80['query']=_['keys'](_0x11e42f['query']);_0x24be80['filters']=_['intersection'](_0x24be80[_0x1011('0x2f')],_0x24be80[_0x1011('0x30')]);_0x1c7267[_0x1011('0x33')]=_[_0x1011('0x32')](_0x24be80[_0x1011('0x2f')],qs['fields'](_0x11e42f[_0x1011('0x30')][_0x1011('0x34')]));_0x1c7267[_0x1011('0x33')]=_0x1c7267['attributes']['length']?_0x1c7267[_0x1011('0x33')]:_0x24be80['model'];if(_0x11e42f[_0x1011('0x30')][_0x1011('0x3e')]){_0x1c7267[_0x1011('0x3f')]=[{'all':!![]}];}_0x1c7267=_[_0x1011('0x43')]({},_0x1c7267,_0x11e42f['options']);return db[_0x1011('0x3d')][_0x1011('0x44')](_0x1c7267)[_0x1011('0x25')](handleEntityNotFound(_0x233322,null))[_0x1011('0x25')](respondWithResult(_0x233322,null))[_0x1011('0x40')](handleError(_0x233322,null));};exports[_0x1011('0x45')]=function(_0x2fcd3e,_0xd9fe96){return db[_0x1011('0x3d')][_0x1011('0x45')](_0x2fcd3e[_0x1011('0x46')],{})[_0x1011('0x25')](respondWithResult(_0xd9fe96,0xc9))[_0x1011('0x40')](handleError(_0xd9fe96,null));};exports[_0x1011('0x24')]=function(_0x1fb7af,_0x4b8a22){if(_0x1fb7af[_0x1011('0x46')]['id']){delete _0x1fb7af[_0x1011('0x46')]['id'];}return db[_0x1011('0x3d')][_0x1011('0x44')]({'where':{'id':_0x1fb7af[_0x1011('0x42')]['id']}})[_0x1011('0x25')](handleEntityNotFound(_0x4b8a22,null))[_0x1011('0x25')](saveUpdates(_0x1fb7af[_0x1011('0x46')],null))['then'](respondWithResult(_0x4b8a22,null))[_0x1011('0x40')](handleError(_0x4b8a22,null));};exports[_0x1011('0x26')]=function(_0x35329,_0x2a19b6){return db['FreshsalesAccount'][_0x1011('0x44')]({'where':{'id':_0x35329[_0x1011('0x42')]['id']}})[_0x1011('0x25')](handleEntityNotFound(_0x2a19b6,null))[_0x1011('0x25')](removeEntity(_0x2a19b6,null))[_0x1011('0x40')](handleError(_0x2a19b6,null));};exports[_0x1011('0x47')]=function(_0xe4f534,_0x1ade8e,_0x47a88f){var _0x1ffee2={};var _0x3d0bae={};var _0x583155;var _0x166974;return db[_0x1011('0x3d')][_0x1011('0x48')]({'where':{'id':_0xe4f534[_0x1011('0x42')]['id']}})['then'](handleEntityNotFound(_0x1ade8e,null))[_0x1011('0x25')](function(_0x1aae2a){if(_0x1aae2a){_0x583155=_0x1aae2a;_0x3d0bae[_0x1011('0x2f')]=_['keys'](db[_0x1011('0x49')][_0x1011('0x2c')]);_0x3d0bae[_0x1011('0x30')]=_[_0x1011('0x31')](_0xe4f534[_0x1011('0x30')]);_0x3d0bae[_0x1011('0x39')]=_[_0x1011('0x32')](_0x3d0bae[_0x1011('0x2f')],_0x3d0bae[_0x1011('0x30')]);_0x1ffee2[_0x1011('0x33')]=_[_0x1011('0x32')](_0x3d0bae[_0x1011('0x2f')],qs[_0x1011('0x34')](_0xe4f534[_0x1011('0x30')]['fields']));_0x1ffee2[_0x1011('0x33')]=_0x1ffee2['attributes'][_0x1011('0x4a')]?_0x1ffee2[_0x1011('0x33')]:_0x3d0bae['model'];_0x1ffee2[_0x1011('0x36')]=qs[_0x1011('0x37')](_0xe4f534[_0x1011('0x30')][_0x1011('0x37')]);_0x1ffee2[_0x1011('0x38')]=qs[_0x1011('0x39')](_['pick'](_0xe4f534[_0x1011('0x30')],_0x3d0bae['filters']));if(_0xe4f534[_0x1011('0x30')][_0x1011('0x3a')]){_0x1ffee2[_0x1011('0x38')]=_['merge'](_0x1ffee2['where'],{'$or':_[_0x1011('0x2b')](_0x1ffee2[_0x1011('0x33')],function(_0x38499b){var _0x29c76c={};_0x29c76c[_0x38499b]={'$like':'%'+_0xe4f534[_0x1011('0x30')][_0x1011('0x3a')]+'%'};return _0x29c76c;})});}_0x1ffee2=_[_0x1011('0x43')]({},_0x1ffee2,_0xe4f534['options']);return _0x583155[_0x1011('0x47')](_0x1ffee2);}})[_0x1011('0x25')](function(_0x2e573f){if(_0x2e573f){_0x166974=_0x2e573f[_0x1011('0x4a')];if(!_0xe4f534[_0x1011('0x30')][_0x1011('0x4b')](_0x1011('0x35'))){_0x1ffee2['limit']=qs[_0x1011('0x20')](_0xe4f534[_0x1011('0x30')]['limit']);_0x1ffee2[_0x1011('0x1e')]=qs['offset'](_0xe4f534[_0x1011('0x30')][_0x1011('0x1e')]);}return _0x583155[_0x1011('0x47')](_0x1ffee2);}})['then'](function(_0x436f70){if(_0x436f70){return _0x436f70?{'count':_0x166974,'rows':_0x436f70}:null;}})['then'](respondWithResult(_0x1ade8e,null))[_0x1011('0x40')](handleError(_0x1ade8e,null));};exports['addConfiguration']=function(_0x426836,_0xe09e7e,_0x11e942){if(_0x426836[_0x1011('0x46')]['id']){delete _0x426836[_0x1011('0x46')]['id'];}return db[_0x1011('0x3d')][_0x1011('0x48')]({'where':{'id':_0x426836[_0x1011('0x42')]['id']}})['then'](handleEntityNotFound(_0xe09e7e,null))['then'](function(_0x482249){if(_0x482249){_0x426836[_0x1011('0x46')]['AccountId']=_0x482249['id'];_0x426836[_0x1011('0x46')][_0x1011('0x4c')]=integrations[_0x1011('0x4d')](_0x426836[_0x1011('0x46')]['channel'],_0x426836['body'][_0x1011('0x2d')]);_0x426836[_0x1011('0x46')][_0x1011('0x4e')]=integrations[_0x1011('0x4f')](_0x426836['body']['channel'],_0x426836[_0x1011('0x46')][_0x1011('0x2d')]);return db[_0x1011('0x49')][_0x1011('0x45')](_0x426836[_0x1011('0x46')],{'include':[{'model':db['FreshsalesField'],'as':'Subjects'},{'model':db[_0x1011('0x50')],'as':'Descriptions'}]});}return null;})[_0x1011('0x25')](respondWithResult(_0xe09e7e,null))['catch'](handleError(_0xe09e7e,null));};exports[_0x1011('0x51')]=function(_0x2cbe30,_0x2c1aa7,_0xf12d69){var _0x3d4eb2='';var _0x5e232e='';return db[_0x1011('0x3d')]['findOne']({'where':{'id':_0x2cbe30['params']['id']},'attributes':['id',_0x1011('0x52'),_0x1011('0x53'),_0x1011('0x54')]})[_0x1011('0x25')](handleEntityNotFound(_0x2c1aa7,null))['then'](function(_0x45ef7e){if(_0x45ef7e){_0x5e232e=_0x45ef7e[_0x1011('0x52')];_0x3d4eb2=_0x45ef7e['remoteUri'];var _0x167a9d=_0x45ef7e['remoteUri'][_0x1011('0x55')](-0x1);if(_0x167a9d==='/'){_0x3d4eb2=_0x3d4eb2['substring'](0x0,_0x3d4eb2[_0x1011('0x56')](_0x167a9d));}return rp({'method':_0x1011('0x57'),'uri':util[_0x1011('0x58')](_0x1011('0x59'),_0x3d4eb2,_0x1011('0x5a')),'headers':{'Authorization':_0x1011('0x5b')+_0x45ef7e[_0x1011('0x54')]},'json':!![]});}})[_0x1011('0x25')](function(_0x1b112d){if(_0x1b112d){var _0x35929d=_0x1b112d[_0x1011('0x5c')];var _0x338e67=![];var _0x45e59a=null;for(_0x45e59a=0x0;_0x45e59a<_0x35929d[_0x1011('0x4a')];_0x45e59a++){if(_0x35929d[_0x45e59a][_0x1011('0x5d')]===_0x5e232e){_0x338e67=!![];}}if(_0x338e67){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1011('0x5e')});}}})[_0x1011('0x25')](respondWithResult(_0x2c1aa7,null))[_0x1011('0x40')](function(_0x4b2136){var _0x392fc5=_0x2cbe30[_0x1011('0x30')][_0x1011('0x5f')]?0x1f4:_0x4b2136[_0x1011('0x60')]||0x1f4;logger[_0x1011('0x27')](_0x1011('0x61'),_0x1011('0x51'),_0x392fc5,JSON[_0x1011('0x62')](_0x4b2136));delete _0x4b2136[_0x1011('0x29')];if(_0x392fc5===0x191){_0x392fc5=0x190;}_0x2c1aa7[_0x1011('0x1c')](_0x392fc5)[_0x1011('0x63')](_0x2cbe30[_0x1011('0x30')]['test']?{'message':_0x1011('0x64'),'statusCode':_0x4b2136['statusCode']}:_0x4b2136);});}; \ No newline at end of file +var _0x26d7=['getConfigurations','FreshsalesConfiguration','options','addConfiguration','findOne','AccountId','Subjects','getDescriptions','channel','FreshsalesField','Descriptions','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','keys','find','create','body'];(function(_0x187102,_0x55d7c3){var _0x686cd5=function(_0x2cb0ad){while(--_0x2cb0ad){_0x187102['push'](_0x187102['shift']());}};_0x686cd5(++_0x55d7c3);}(_0x26d7,0x156));var _0x726d=function(_0x4fb408,_0x42331a){_0x4fb408=_0x4fb408-0x0;var _0x1935aa=_0x26d7[_0x4fb408];return _0x1935aa;};'use strict';var emlformat=require(_0x726d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x726d('0x1'));var jsonpatch=require(_0x726d('0x2'));var rp=require(_0x726d('0x3'));var moment=require(_0x726d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x726d('0x5'));var path=require('path');var sox=require(_0x726d('0x6'));var csv=require(_0x726d('0x7'));var ejs=require(_0x726d('0x8'));var fs=require('fs');var fs_extra=require(_0x726d('0x9'));var _=require(_0x726d('0xa'));var squel=require(_0x726d('0xb'));var crypto=require(_0x726d('0xc'));var jsforce=require(_0x726d('0xd'));var deskjs=require(_0x726d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x726d('0xf'));var Papa=require(_0x726d('0x10'));var Redis=require(_0x726d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x726d('0x12'));var as=require(_0x726d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x726d('0x14'));var config=require(_0x726d('0x15'));var licenseUtil=require(_0x726d('0x16'));var db=require(_0x726d('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4becc0,_0x54d105){_0x54d105=_0x54d105||0xcc;return function(_0xa9177f){if(_0xa9177f){return _0x4becc0[_0x726d('0x18')](_0x54d105);}return _0x4becc0[_0x726d('0x19')](_0x54d105)[_0x726d('0x1a')]();};}function respondWithResult(_0x317ba5,_0x2212c3){_0x2212c3=_0x2212c3||0xc8;return function(_0x217460){if(_0x217460){return _0x317ba5[_0x726d('0x19')](_0x2212c3)[_0x726d('0x1b')](_0x217460);}};}function respondWithFilteredResult(_0x44bc9f,_0x34b736){return function(_0x5d7a40){if(_0x5d7a40){var _0x302b74=typeof _0x34b736['offset']===_0x726d('0x1c')&&typeof _0x34b736[_0x726d('0x1d')]===_0x726d('0x1c');var _0x1c7f8b=_0x5d7a40['count'];var _0x14544b=_0x302b74?0x0:_0x34b736['offset'];var _0x2a371c=_0x302b74?_0x5d7a40[_0x726d('0x1e')]:_0x34b736[_0x726d('0x1f')]+_0x34b736[_0x726d('0x1d')];var _0x4b98fd;if(_0x2a371c>=_0x1c7f8b){_0x2a371c=_0x1c7f8b;_0x4b98fd=0xc8;}else{_0x4b98fd=0xce;}_0x44bc9f['status'](_0x4b98fd);return _0x44bc9f['set'](_0x726d('0x20'),_0x14544b+'-'+_0x2a371c+'/'+_0x1c7f8b)[_0x726d('0x1b')](_0x5d7a40);}return null;};}function patchUpdates(_0x29b489){return function(_0x530947){try{jsonpatch[_0x726d('0x21')](_0x530947,_0x29b489,!![]);}catch(_0x2d40fd){return BPromise[_0x726d('0x22')](_0x2d40fd);}return _0x530947['save']();};}function saveUpdates(_0x4d51c7,_0x250b45){return function(_0x2edcad){if(_0x2edcad){return _0x2edcad[_0x726d('0x23')](_0x4d51c7)[_0x726d('0x24')](function(_0x522bb3){return _0x522bb3;});}return null;};}function removeEntity(_0x5356c3,_0x35f606){return function(_0x654cbd){if(_0x654cbd){return _0x654cbd[_0x726d('0x25')]()[_0x726d('0x24')](function(){_0x5356c3[_0x726d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44206b,_0x4700f8){return function(_0x1f07d2){if(!_0x1f07d2){_0x44206b['sendStatus'](0x194);}return _0x1f07d2;};}function handleError(_0x7cfb4a,_0x3e3b52){_0x3e3b52=_0x3e3b52||0x1f4;return function(_0xe862dc){logger[_0x726d('0x26')](_0xe862dc[_0x726d('0x27')]);if(_0xe862dc[_0x726d('0x28')]){delete _0xe862dc[_0x726d('0x28')];}_0x7cfb4a[_0x726d('0x19')](_0x3e3b52)[_0x726d('0x29')](_0xe862dc);};}exports[_0x726d('0x2a')]=function(_0xf7d54b,_0x12eecc){var _0x23b64e={},_0x2c3d05={},_0xea362e={'count':0x0,'rows':[]};var _0x43b8e5=_[_0x726d('0x2b')](db[_0x726d('0x2c')][_0x726d('0x2d')],function(_0x4b1dac){return{'name':_0x4b1dac[_0x726d('0x2e')],'type':_0x4b1dac[_0x726d('0x2f')][_0x726d('0x30')]};});_0x2c3d05[_0x726d('0x31')]=_[_0x726d('0x2b')](_0x43b8e5,_0x726d('0x28'));_0x2c3d05[_0x726d('0x32')]=_['keys'](_0xf7d54b['query']);_0x2c3d05['filters']=_[_0x726d('0x33')](_0x2c3d05[_0x726d('0x31')],_0x2c3d05[_0x726d('0x32')]);_0x23b64e[_0x726d('0x34')]=_[_0x726d('0x33')](_0x2c3d05[_0x726d('0x31')],qs[_0x726d('0x35')](_0xf7d54b[_0x726d('0x32')]['fields']));_0x23b64e[_0x726d('0x34')]=_0x23b64e[_0x726d('0x34')][_0x726d('0x36')]?_0x23b64e[_0x726d('0x34')]:_0x2c3d05[_0x726d('0x31')];if(!_0xf7d54b[_0x726d('0x32')][_0x726d('0x37')](_0x726d('0x38'))){_0x23b64e['limit']=qs['limit'](_0xf7d54b[_0x726d('0x32')]['limit']);_0x23b64e[_0x726d('0x1f')]=qs[_0x726d('0x1f')](_0xf7d54b['query'][_0x726d('0x1f')]);}_0x23b64e[_0x726d('0x39')]=qs[_0x726d('0x3a')](_0xf7d54b[_0x726d('0x32')]['sort']);_0x23b64e[_0x726d('0x3b')]=qs[_0x726d('0x3c')](_[_0x726d('0x3d')](_0xf7d54b[_0x726d('0x32')],_0x2c3d05['filters']),_0x43b8e5);if(_0xf7d54b[_0x726d('0x32')][_0x726d('0x3e')]){_0x23b64e[_0x726d('0x3b')]=_[_0x726d('0x3f')](_0x23b64e[_0x726d('0x3b')],{'$or':_[_0x726d('0x2b')](_0x43b8e5,function(_0x4ba96a){if(_0x4ba96a['type']!==_0x726d('0x40')){var _0x4f868d={};_0x4f868d[_0x4ba96a[_0x726d('0x28')]]={'$like':'%'+_0xf7d54b[_0x726d('0x32')][_0x726d('0x3e')]+'%'};return _0x4f868d;}})});}_0x23b64e=_[_0x726d('0x3f')]({},_0x23b64e,_0xf7d54b['options']);var _0x24067f={'where':_0x23b64e[_0x726d('0x3b')]};return db['FreshsalesAccount'][_0x726d('0x1e')](_0x24067f)['then'](function(_0x5ce22e){_0xea362e['count']=_0x5ce22e;if(_0xf7d54b['query']['includeAll']){_0x23b64e[_0x726d('0x41')]=[{'all':!![]}];}return db[_0x726d('0x2c')][_0x726d('0x42')](_0x23b64e);})['then'](function(_0x1d19ac){_0xea362e['rows']=_0x1d19ac;return _0xea362e;})['then'](respondWithFilteredResult(_0x12eecc,_0x23b64e))[_0x726d('0x43')](handleError(_0x12eecc,null));};exports[_0x726d('0x44')]=function(_0x215615,_0x134ccd){var _0x5399b0={'raw':![],'where':{'id':_0x215615[_0x726d('0x45')]['id']}},_0x3cd7a3={};_0x3cd7a3[_0x726d('0x31')]=_[_0x726d('0x46')](db['FreshsalesAccount'][_0x726d('0x2d')]);_0x3cd7a3[_0x726d('0x32')]=_[_0x726d('0x46')](_0x215615[_0x726d('0x32')]);_0x3cd7a3[_0x726d('0x3c')]=_[_0x726d('0x33')](_0x3cd7a3[_0x726d('0x31')],_0x3cd7a3[_0x726d('0x32')]);_0x5399b0[_0x726d('0x34')]=_[_0x726d('0x33')](_0x3cd7a3[_0x726d('0x31')],qs['fields'](_0x215615[_0x726d('0x32')][_0x726d('0x35')]));_0x5399b0[_0x726d('0x34')]=_0x5399b0[_0x726d('0x34')][_0x726d('0x36')]?_0x5399b0['attributes']:_0x3cd7a3[_0x726d('0x31')];if(_0x215615[_0x726d('0x32')]['includeAll']){_0x5399b0[_0x726d('0x41')]=[{'all':!![]}];}_0x5399b0=_[_0x726d('0x3f')]({},_0x5399b0,_0x215615['options']);return db[_0x726d('0x2c')][_0x726d('0x47')](_0x5399b0)[_0x726d('0x24')](handleEntityNotFound(_0x134ccd,null))[_0x726d('0x24')](respondWithResult(_0x134ccd,null))[_0x726d('0x43')](handleError(_0x134ccd,null));};exports[_0x726d('0x48')]=function(_0xe70efb,_0x336663){return db[_0x726d('0x2c')][_0x726d('0x48')](_0xe70efb[_0x726d('0x49')],{})[_0x726d('0x24')](respondWithResult(_0x336663,0xc9))[_0x726d('0x43')](handleError(_0x336663,null));};exports[_0x726d('0x23')]=function(_0x5ced81,_0x53e869){if(_0x5ced81[_0x726d('0x49')]['id']){delete _0x5ced81[_0x726d('0x49')]['id'];}return db[_0x726d('0x2c')][_0x726d('0x47')]({'where':{'id':_0x5ced81['params']['id']}})[_0x726d('0x24')](handleEntityNotFound(_0x53e869,null))[_0x726d('0x24')](saveUpdates(_0x5ced81['body'],null))['then'](respondWithResult(_0x53e869,null))['catch'](handleError(_0x53e869,null));};exports[_0x726d('0x25')]=function(_0x5c328d,_0x815f76){return db[_0x726d('0x2c')]['find']({'where':{'id':_0x5c328d[_0x726d('0x45')]['id']}})['then'](handleEntityNotFound(_0x815f76,null))[_0x726d('0x24')](removeEntity(_0x815f76,null))['catch'](handleError(_0x815f76,null));};exports[_0x726d('0x4a')]=function(_0x132268,_0x17f6dd,_0x249dc9){var _0x3f9eb1={};var _0x370ca6={};var _0xf9e177;var _0x510483;return db[_0x726d('0x2c')]['findOne']({'where':{'id':_0x132268[_0x726d('0x45')]['id']}})[_0x726d('0x24')](handleEntityNotFound(_0x17f6dd,null))[_0x726d('0x24')](function(_0x3e6447){if(_0x3e6447){_0xf9e177=_0x3e6447;_0x370ca6['model']=_[_0x726d('0x46')](db[_0x726d('0x4b')]['rawAttributes']);_0x370ca6[_0x726d('0x32')]=_[_0x726d('0x46')](_0x132268[_0x726d('0x32')]);_0x370ca6[_0x726d('0x3c')]=_[_0x726d('0x33')](_0x370ca6[_0x726d('0x31')],_0x370ca6['query']);_0x3f9eb1[_0x726d('0x34')]=_[_0x726d('0x33')](_0x370ca6['model'],qs[_0x726d('0x35')](_0x132268['query'][_0x726d('0x35')]));_0x3f9eb1[_0x726d('0x34')]=_0x3f9eb1['attributes']['length']?_0x3f9eb1[_0x726d('0x34')]:_0x370ca6['model'];_0x3f9eb1[_0x726d('0x39')]=qs[_0x726d('0x3a')](_0x132268['query'][_0x726d('0x3a')]);_0x3f9eb1[_0x726d('0x3b')]=qs['filters'](_[_0x726d('0x3d')](_0x132268[_0x726d('0x32')],_0x370ca6['filters']));if(_0x132268[_0x726d('0x32')][_0x726d('0x3e')]){_0x3f9eb1[_0x726d('0x3b')]=_['merge'](_0x3f9eb1[_0x726d('0x3b')],{'$or':_[_0x726d('0x2b')](_0x3f9eb1[_0x726d('0x34')],function(_0x2e5ca6){var _0x1e868c={};_0x1e868c[_0x2e5ca6]={'$like':'%'+_0x132268[_0x726d('0x32')]['filter']+'%'};return _0x1e868c;})});}_0x3f9eb1=_[_0x726d('0x3f')]({},_0x3f9eb1,_0x132268[_0x726d('0x4c')]);return _0xf9e177[_0x726d('0x4a')](_0x3f9eb1);}})[_0x726d('0x24')](function(_0x355ab3){if(_0x355ab3){_0x510483=_0x355ab3[_0x726d('0x36')];if(!_0x132268[_0x726d('0x32')][_0x726d('0x37')](_0x726d('0x38'))){_0x3f9eb1['limit']=qs[_0x726d('0x1d')](_0x132268[_0x726d('0x32')][_0x726d('0x1d')]);_0x3f9eb1[_0x726d('0x1f')]=qs[_0x726d('0x1f')](_0x132268[_0x726d('0x32')]['offset']);}return _0xf9e177[_0x726d('0x4a')](_0x3f9eb1);}})['then'](function(_0x5153a0){if(_0x5153a0){return _0x5153a0?{'count':_0x510483,'rows':_0x5153a0}:null;}})[_0x726d('0x24')](respondWithResult(_0x17f6dd,null))[_0x726d('0x43')](handleError(_0x17f6dd,null));};exports[_0x726d('0x4d')]=function(_0x171474,_0x3208c1,_0xf03d3b){if(_0x171474[_0x726d('0x49')]['id']){delete _0x171474[_0x726d('0x49')]['id'];}return db[_0x726d('0x2c')][_0x726d('0x4e')]({'where':{'id':_0x171474[_0x726d('0x45')]['id']}})[_0x726d('0x24')](handleEntityNotFound(_0x3208c1,null))[_0x726d('0x24')](function(_0x34131a){if(_0x34131a){_0x171474[_0x726d('0x49')][_0x726d('0x4f')]=_0x34131a['id'];_0x171474['body'][_0x726d('0x50')]=integrations['getSubjects'](_0x171474['body']['channel'],_0x171474['body']['type']);_0x171474['body']['Descriptions']=integrations[_0x726d('0x51')](_0x171474[_0x726d('0x49')][_0x726d('0x52')],_0x171474[_0x726d('0x49')]['type']);return db[_0x726d('0x4b')][_0x726d('0x48')](_0x171474[_0x726d('0x49')],{'include':[{'model':db[_0x726d('0x53')],'as':_0x726d('0x50')},{'model':db[_0x726d('0x53')],'as':_0x726d('0x54')}]});}return null;})['then'](respondWithResult(_0x3208c1,null))[_0x726d('0x43')](handleError(_0x3208c1,null));};exports['getFields']=function(_0x239ad2,_0x47bab7,_0x28f9d2){var _0x53df6e='';var _0x2b984e='';return db[_0x726d('0x2c')][_0x726d('0x4e')]({'where':{'id':_0x239ad2[_0x726d('0x45')]['id']},'attributes':['id',_0x726d('0x55'),_0x726d('0x56'),_0x726d('0x57')]})[_0x726d('0x24')](handleEntityNotFound(_0x47bab7,null))[_0x726d('0x24')](function(_0x34dca9){if(_0x34dca9){_0x2b984e=_0x34dca9[_0x726d('0x55')];_0x53df6e=_0x34dca9[_0x726d('0x56')];var _0x4e2c8e=_0x34dca9[_0x726d('0x56')]['slice'](-0x1);if(_0x4e2c8e==='/'){_0x53df6e=_0x53df6e[_0x726d('0x58')](0x0,_0x53df6e[_0x726d('0x59')](_0x4e2c8e));}return rp({'method':_0x726d('0x5a'),'uri':util[_0x726d('0x5b')](_0x726d('0x5c'),_0x53df6e,_0x726d('0x5d')),'headers':{'Authorization':_0x726d('0x5e')+_0x34dca9[_0x726d('0x57')]},'json':!![]});}})[_0x726d('0x24')](function(_0x508615){if(_0x508615){var _0x1d1ea4=_0x508615[_0x726d('0x5f')];var _0x1e3e9c=![];var _0xba0dfd=null;for(_0xba0dfd=0x0;_0xba0dfd<_0x1d1ea4[_0x726d('0x36')];_0xba0dfd++){if(_0x1d1ea4[_0xba0dfd][_0x726d('0x60')]===_0x2b984e){_0x1e3e9c=!![];}}if(_0x1e3e9c){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x726d('0x61')});}}})[_0x726d('0x24')](respondWithResult(_0x47bab7,null))[_0x726d('0x43')](function(_0x248598){var _0x5d5ec8=_0x239ad2[_0x726d('0x32')][_0x726d('0x62')]?0x1f4:_0x248598[_0x726d('0x63')]||0x1f4;logger[_0x726d('0x26')](_0x726d('0x64'),_0x726d('0x65'),_0x5d5ec8,JSON[_0x726d('0x66')](_0x248598));delete _0x248598[_0x726d('0x28')];if(_0x5d5ec8===0x191){_0x5d5ec8=0x190;}_0x47bab7[_0x726d('0x19')](_0x5d5ec8)['send'](_0x239ad2[_0x726d('0x32')][_0x726d('0x62')]?{'message':_0x726d('0x67'),'statusCode':_0x248598[_0x726d('0x63')]}:_0x248598);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 4916bdd..9e2eb53 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 _0x1a85=['moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','../../config/logger','api'];(function(_0x3d1dba,_0x2a42bb){var _0x15d472=function(_0x5c8951){while(--_0x5c8951){_0x3d1dba['push'](_0x3d1dba['shift']());}};_0x15d472(++_0x2a42bb);}(_0x1a85,0x178));var _0x51a8=function(_0x232cbf,_0x3e2f33){_0x232cbf=_0x232cbf-0x0;var _0x1cd460=_0x1a85[_0x232cbf];return _0x1cd460;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x51a8('0x0'))(_0x51a8('0x1'));var moment=require(_0x51a8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x51a8('0x3'));var rimraf=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x51a8('0x6'));module['exports']=function(_0x2c1180,_0x5cf430){return _0x2c1180[_0x51a8('0x7')](_0x51a8('0x8'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['define','util','bluebird','request-promise','path','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x81c6,0x1d5));var _0x681c=function(_0x23d160,_0x15e4dc){_0x23d160=_0x23d160-0x0;var _0x5df430=_0x81c6[_0x23d160];return _0x5df430;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));var integrations=require(_0x681c('0x6'));module[_0x681c('0x7')]=function(_0x4ea522,_0x45331){return _0x4ea522[_0x681c('0x8')]('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index 27e5537..83dc642 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 _0x583c=['raw','where','attributes','limit','map','include','model','debug','stringify','catch','ShowFreshsalesAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x583c,0x12b));var _0xc583=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x583c[_0xd050c6];return _0x7278a;};'use strict';var _=require(_0xc583('0x0'));var util=require(_0xc583('0x1'));var moment=require(_0xc583('0x2'));var BPromise=require(_0xc583('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc583('0x4'));var db=require(_0xc583('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc583('0x6'));var config=require(_0xc583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc583('0x8')][_0xc583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2719df,_0x1dd37c,_0x48a8d4){return new BPromise(function(_0x21ed88,_0x26cec0){return client['request'](_0x2719df,_0x48a8d4)[_0xc583('0xa')](function(_0x24ab4f){logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,_0xc583('0xd'));logger['debug'](_0xc583('0xe'),_0x1dd37c,_0xc583('0xd'),JSON['stringify'](_0x24ab4f));if(_0x24ab4f[_0xc583('0xf')]){if(_0x24ab4f[_0xc583('0xf')]['code']===0x1f4){logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);return _0x26cec0(_0x24ab4f[_0xc583('0xf')][_0xc583('0x10')]);}logger[_0xc583('0xf')](_0xc583('0xc'),_0x1dd37c,_0x24ab4f[_0xc583('0xf')]['message']);return _0x21ed88(_0x24ab4f[_0xc583('0xf')]['message']);}else{logger[_0xc583('0xb')](_0xc583('0xc'),_0x1dd37c,'request\x20sent');_0x21ed88(_0x24ab4f[_0xc583('0x11')][_0xc583('0x10')]);}})['catch'](function(_0x7d1690){logger[_0xc583('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x1dd37c,_0x7d1690);_0x26cec0(_0x7d1690);});});}exports[_0xc583('0x12')]=function(_0x8a2d84){var _0x12aac2=this;return new Promise(function(_0x36e0fd,_0x5433ec){return db[_0xc583('0x13')]['findAll']({'raw':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x15')]===undefined?!![]:![]:!![],'where':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x17')]||null:null,'limit':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84[_0xc583('0x14')][_0xc583('0x18')]||null:null,'include':_0x8a2d84[_0xc583('0x14')]?_0x8a2d84['options']['include']?_[_0xc583('0x19')](_0x8a2d84[_0xc583('0x14')][_0xc583('0x1a')],function(_0x5ceef1){return{'model':db[_0x5ceef1[_0xc583('0x1b')]],'as':_0x5ceef1['as'],'attributes':_0x5ceef1[_0xc583('0x17')],'include':_0x5ceef1[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x5ceef1[_0xc583('0x1a')],function(_0x48c95e){return{'model':db[_0x48c95e['model']],'as':_0x48c95e['as'],'attributes':_0x48c95e[_0xc583('0x17')],'include':_0x48c95e['include']?_[_0xc583('0x19')](_0x48c95e[_0xc583('0x1a')],function(_0xbabf24){return{'model':db[_0xbabf24[_0xc583('0x1b')]],'as':_0xbabf24['as'],'attributes':_0xbabf24[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2dafb4){logger[_0xc583('0xb')]('GetFreshsalesAccount',_0x8a2d84);logger[_0xc583('0x1c')]('GetFreshsalesAccount',_0x8a2d84,JSON[_0xc583('0x1d')](_0x2dafb4));_0x36e0fd(_0x2dafb4);})[_0xc583('0x1e')](function(_0x1c80b1){logger[_0xc583('0xf')](_0xc583('0x12'),_0x1c80b1[_0xc583('0x10')],_0x8a2d84);_0x5433ec(_0x12aac2[_0xc583('0xf')](0x1f4,_0x1c80b1['message']));});});};exports[_0xc583('0x1f')]=function(_0x390bc3){var _0x23f3a4=this;return new Promise(function(_0xcbf1f1,_0x1dd665){return db[_0xc583('0x13')]['find']({'raw':_0x390bc3[_0xc583('0x14')]?_0x390bc3['options']['raw']===undefined?!![]:![]:!![],'where':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x16')]||null:null,'attributes':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')]['attributes']||null:null,'include':_0x390bc3[_0xc583('0x14')]?_0x390bc3[_0xc583('0x14')][_0xc583('0x1a')]?_['map'](_0x390bc3[_0xc583('0x14')]['include'],function(_0x1aa62a){return{'model':db[_0x1aa62a[_0xc583('0x1b')]],'as':_0x1aa62a['as'],'attributes':_0x1aa62a[_0xc583('0x17')],'include':_0x1aa62a[_0xc583('0x1a')]?_[_0xc583('0x19')](_0x1aa62a['include'],function(_0x242728){return{'model':db[_0x242728['model']],'as':_0x242728['as'],'attributes':_0x242728[_0xc583('0x17')],'include':_0x242728['include']?_[_0xc583('0x19')](_0x242728[_0xc583('0x1a')],function(_0x7d89d0){return{'model':db[_0x7d89d0[_0xc583('0x1b')]],'as':_0x7d89d0['as'],'attributes':_0x7d89d0[_0xc583('0x17')]};}):[]};}):[]};}):[]:[]})[_0xc583('0xa')](function(_0x54200c){logger['info'](_0xc583('0x1f'),_0x390bc3);logger[_0xc583('0x1c')]('ShowFreshsalesAccount',_0x390bc3,JSON[_0xc583('0x1d')](_0x54200c));_0xcbf1f1(_0x54200c);})[_0xc583('0x1e')](function(_0x22de5a){logger[_0xc583('0xf')](_0xc583('0x1f'),_0x22de5a[_0xc583('0x10')],_0x390bc3);_0x1dd665(_0x23f3a4['error'](0x1f4,_0x22de5a[_0xc583('0x10')]));});});}; \ No newline at end of file +var _0x1623=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','limit','include','map','model','attributes','find','ShowFreshsalesAccount','lodash','bluebird','randomstring','ioredis'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x1623,0xab));var _0x3162=function(_0x3c79f7,_0x4a67ba){_0x3c79f7=_0x3c79f7-0x0;var _0x462b61=_0x1623[_0x3c79f7];return _0x462b61;};'use strict';var _=require(_0x3162('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3162('0x1'));var rs=require(_0x3162('0x2'));var fs=require('fs');var Redis=require(_0x3162('0x3'));var db=require(_0x3162('0x4'))['db'];var utils=require(_0x3162('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3162('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3162('0x7')][_0x3162('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53260d,_0xffe9b6,_0x2dc07e){return new BPromise(function(_0x26ee32,_0x36609e){return client[_0x3162('0x9')](_0x53260d,_0x2dc07e)[_0x3162('0xa')](function(_0xe43099){logger[_0x3162('0xb')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,'request\x20sent');logger[_0x3162('0xc')](_0x3162('0xd'),_0xffe9b6,_0x3162('0xe'),JSON[_0x3162('0xf')](_0xe43099));if(_0xe43099[_0x3162('0x10')]){if(_0xe43099[_0x3162('0x10')][_0x3162('0x11')]===0x1f4){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x36609e(_0xe43099['error'][_0x3162('0x13')]);}logger[_0x3162('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0xffe9b6,_0xe43099['error'][_0x3162('0x13')]);return _0x26ee32(_0xe43099[_0x3162('0x10')][_0x3162('0x13')]);}else{logger['info'](_0x3162('0x12'),_0xffe9b6,_0x3162('0xe'));_0x26ee32(_0xe43099[_0x3162('0x14')]['message']);}})[_0x3162('0x15')](function(_0x42cf7d){logger[_0x3162('0x10')](_0x3162('0x12'),_0xffe9b6,_0x42cf7d);_0x36609e(_0x42cf7d);});});}exports[_0x3162('0x16')]=function(_0x1eed46){var _0x391d97=this;return new Promise(function(_0x4b2bf3,_0x42f283){return db[_0x3162('0x17')][_0x3162('0x18')]({'raw':_0x1eed46[_0x3162('0x19')]?_0x1eed46['options'][_0x3162('0x1a')]===undefined?!![]:![]:!![],'where':_0x1eed46['options']?_0x1eed46['options'][_0x3162('0x1b')]||null:null,'attributes':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')]['attributes']||null:null,'limit':_0x1eed46['options']?_0x1eed46[_0x3162('0x19')][_0x3162('0x1c')]||null:null,'include':_0x1eed46[_0x3162('0x19')]?_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x1eed46[_0x3162('0x19')][_0x3162('0x1d')],function(_0x5a4994){return{'model':db[_0x5a4994[_0x3162('0x1f')]],'as':_0x5a4994['as'],'attributes':_0x5a4994[_0x3162('0x20')],'include':_0x5a4994[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x5a4994[_0x3162('0x1d')],function(_0x3c543e){return{'model':db[_0x3c543e[_0x3162('0x1f')]],'as':_0x3c543e['as'],'attributes':_0x3c543e[_0x3162('0x20')],'include':_0x3c543e[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x3c543e[_0x3162('0x1d')],function(_0x2f62d7){return{'model':db[_0x2f62d7[_0x3162('0x1f')]],'as':_0x2f62d7['as'],'attributes':_0x2f62d7['attributes']};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x552469){logger[_0x3162('0xb')](_0x3162('0x16'),_0x1eed46);logger[_0x3162('0xc')]('GetFreshsalesAccount',_0x1eed46,JSON['stringify'](_0x552469));_0x4b2bf3(_0x552469);})[_0x3162('0x15')](function(_0xaa1f35){logger[_0x3162('0x10')](_0x3162('0x16'),_0xaa1f35[_0x3162('0x13')],_0x1eed46);_0x42f283(_0x391d97['error'](0x1f4,_0xaa1f35[_0x3162('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xf11765){var _0x3a188e=this;return new Promise(function(_0x41e933,_0x221b38){return db[_0x3162('0x17')][_0x3162('0x21')]({'raw':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['where']||null:null,'attributes':_0xf11765[_0x3162('0x19')]?_0xf11765[_0x3162('0x19')]['attributes']||null:null,'include':_0xf11765['options']?_0xf11765[_0x3162('0x19')]['include']?_[_0x3162('0x1e')](_0xf11765[_0x3162('0x19')][_0x3162('0x1d')],function(_0x551442){return{'model':db[_0x551442['model']],'as':_0x551442['as'],'attributes':_0x551442[_0x3162('0x20')],'include':_0x551442[_0x3162('0x1d')]?_['map'](_0x551442[_0x3162('0x1d')],function(_0x4d4f74){return{'model':db[_0x4d4f74[_0x3162('0x1f')]],'as':_0x4d4f74['as'],'attributes':_0x4d4f74[_0x3162('0x20')],'include':_0x4d4f74[_0x3162('0x1d')]?_[_0x3162('0x1e')](_0x4d4f74[_0x3162('0x1d')],function(_0x3b6c91){return{'model':db[_0x3b6c91[_0x3162('0x1f')]],'as':_0x3b6c91['as'],'attributes':_0x3b6c91[_0x3162('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3162('0xa')](function(_0x16c5d6){logger[_0x3162('0xb')]('ShowFreshsalesAccount',_0xf11765);logger[_0x3162('0xc')](_0x3162('0x22'),_0xf11765,JSON[_0x3162('0xf')](_0x16c5d6));_0x41e933(_0x16c5d6);})['catch'](function(_0x59759d){logger[_0x3162('0x10')](_0x3162('0x22'),_0x59759d[_0x3162('0x13')],_0xf11765);_0x221b38(_0x3a188e[_0x3162('0x10')](0x1f4,_0x59759d['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 677e375..18367b7 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 _0x62d3=['path','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','delete','destroy','multer','util'];(function(_0x2766e9,_0x59e726){var _0x287b14=function(_0x4a529d){while(--_0x4a529d){_0x2766e9['push'](_0x2766e9['shift']());}};_0x287b14(++_0x59e726);}(_0x62d3,0x18e));var _0x362d=function(_0x2a2c81,_0x30e8f7){_0x2a2c81=_0x2a2c81-0x0;var _0x18fc65=_0x62d3[_0x2a2c81];return _0x18fc65;};'use strict';var multer=require(_0x362d('0x0'));var util=require(_0x362d('0x1'));var path=require(_0x362d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x362d('0x3'));var interaction=require(_0x362d('0x4'));var config=require(_0x362d('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x362d('0x6')](),controller[_0x362d('0x7')]);router[_0x362d('0x8')](_0x362d('0x9'),auth[_0x362d('0x6')](),controller['show']);router[_0x362d('0x8')](_0x362d('0xa'),auth[_0x362d('0x6')](),controller[_0x362d('0xb')]);router[_0x362d('0x8')](_0x362d('0xc'),auth['isAuthenticated'](),controller[_0x362d('0xd')]);router[_0x362d('0x8')](_0x362d('0xe'),auth[_0x362d('0x6')](),controller[_0x362d('0xf')]);router[_0x362d('0x10')]('/',auth['isAuthenticated'](),controller[_0x362d('0x11')]);router['put'](_0x362d('0x9'),auth[_0x362d('0x6')](),controller['update']);router[_0x362d('0x12')](_0x362d('0x9'),auth[_0x362d('0x6')](),controller[_0x362d('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0f26=['show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x260c93,_0x1919e6){var _0x129a3d=function(_0x3d3a63){while(--_0x3d3a63){_0x260c93['push'](_0x260c93['shift']());}};_0x129a3d(++_0x1919e6);}(_0x0f26,0x1ea));var _0x60f2=function(_0x2466cb,_0x563f9b){_0x2466cb=_0x2466cb-0x0;var _0x42b093=_0x0f26[_0x2466cb];return _0x42b093;};'use strict';var multer=require(_0x60f2('0x0'));var util=require(_0x60f2('0x1'));var path=require(_0x60f2('0x2'));var timeout=require(_0x60f2('0x3'));var express=require(_0x60f2('0x4'));var router=express[_0x60f2('0x5')]();var fs_extra=require(_0x60f2('0x6'));var auth=require(_0x60f2('0x7'));var interaction=require(_0x60f2('0x8'));var config=require('../../config/environment');var controller=require(_0x60f2('0x9'));router[_0x60f2('0xa')]('/',auth[_0x60f2('0xb')](),controller[_0x60f2('0xc')]);router[_0x60f2('0xa')](_0x60f2('0xd'),auth[_0x60f2('0xb')](),controller[_0x60f2('0xe')]);router[_0x60f2('0xa')]('/:id/subjects',auth[_0x60f2('0xb')](),controller[_0x60f2('0xf')]);router[_0x60f2('0xa')](_0x60f2('0x10'),auth['isAuthenticated'](),controller[_0x60f2('0x11')]);router['get'](_0x60f2('0x12'),auth[_0x60f2('0xb')](),controller[_0x60f2('0x13')]);router[_0x60f2('0x14')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x60f2('0xd'),auth[_0x60f2('0xb')](),controller[_0x60f2('0x15')]);router[_0x60f2('0x16')](_0x60f2('0xd'),auth[_0x60f2('0xb')](),controller['destroy']);module[_0x60f2('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index cefea2e..382c391 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 _0x737e=['sequelize','exports','STRING'];(function(_0x4329f3,_0x4f3ade){var _0x4ff413=function(_0x16ed06){while(--_0x16ed06){_0x4329f3['push'](_0x4329f3['shift']());}};_0x4ff413(++_0x4f3ade);}(_0x737e,0x14a));var _0xe737=function(_0x46fc15,_0x1d6053){_0x46fc15=_0x46fc15-0x0;var _0x48b3dc=_0x737e[_0x46fc15];return _0x48b3dc;};'use strict';var Sequelize=require(_0xe737('0x0'));module[_0xe737('0x1')]={'name':{'type':Sequelize[_0xe737('0x2')]},'description':{'type':Sequelize[_0xe737('0x2')]}}; \ No newline at end of file +var _0xbe31=['STRING'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0xbe31,0x18e));var _0x1be3=function(_0x4cadc5,_0x5cfe40){_0x4cadc5=_0x4cadc5-0x0;var _0xdb6000=_0xbe31[_0x4cadc5];return _0xdb6000;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1be3('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 0e3d3e0..61603f4 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 _0x762f=['undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','stack','send','index','map','fieldName','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','name','merge','options','findAll','rows','catch','FreshsalesConfiguration','include','find','create','body','params','getSubjects','findOne','rawAttributes','getDescriptions','getFields','FreshsalesField','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x762f,0x122));var _0xf762=function(_0x434b74,_0x358bca){_0x434b74=_0x434b74-0x0;var _0x43abb1=_0x762f[_0x434b74];return _0x43abb1;};'use strict';var emlformat=require(_0xf762('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf762('0x1'));var jsonpatch=require(_0xf762('0x2'));var rp=require(_0xf762('0x3'));var moment=require(_0xf762('0x4'));var BPromise=require(_0xf762('0x5'));var Mustache=require('mustache');var util=require(_0xf762('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf762('0x7'));var ejs=require(_0xf762('0x8'));var fs=require('fs');var fs_extra=require(_0xf762('0x9'));var _=require(_0xf762('0xa'));var squel=require(_0xf762('0xb'));var crypto=require(_0xf762('0xc'));var jsforce=require(_0xf762('0xd'));var deskjs=require(_0xf762('0xe'));var toCsv=require(_0xf762('0x7'));var querystring=require(_0xf762('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf762('0x10'));var as=require(_0xf762('0x11'));var hardwareService=require(_0xf762('0x12'));var logger=require(_0xf762('0x13'))(_0xf762('0x14'));var utils=require(_0xf762('0x15'));var config=require(_0xf762('0x16'));var licenseUtil=require(_0xf762('0x17'));var db=require(_0xf762('0x18'))['db'];function respondWithStatusCode(_0x9e3de9,_0xcccef4){_0xcccef4=_0xcccef4||0xcc;return function(_0xff99aa){if(_0xff99aa){return _0x9e3de9[_0xf762('0x19')](_0xcccef4);}return _0x9e3de9['status'](_0xcccef4)[_0xf762('0x1a')]();};}function respondWithResult(_0x2cc795,_0x25cfed){_0x25cfed=_0x25cfed||0xc8;return function(_0x41dbe3){if(_0x41dbe3){return _0x2cc795[_0xf762('0x1b')](_0x25cfed)[_0xf762('0x1c')](_0x41dbe3);}};}function respondWithFilteredResult(_0x4a077d,_0x3703e7){return function(_0xfc3fb4){if(_0xfc3fb4){var _0x58db4c=typeof _0x3703e7[_0xf762('0x1d')]==='undefined'&&typeof _0x3703e7['limit']===_0xf762('0x1e');var _0x40d060=_0xfc3fb4[_0xf762('0x1f')];var _0x4d3d8b=_0x58db4c?0x0:_0x3703e7[_0xf762('0x1d')];var _0x29de24=_0x58db4c?_0xfc3fb4[_0xf762('0x1f')]:_0x3703e7[_0xf762('0x1d')]+_0x3703e7[_0xf762('0x20')];var _0x139c50;if(_0x29de24>=_0x40d060){_0x29de24=_0x40d060;_0x139c50=0xc8;}else{_0x139c50=0xce;}_0x4a077d[_0xf762('0x1b')](_0x139c50);return _0x4a077d[_0xf762('0x21')](_0xf762('0x22'),_0x4d3d8b+'-'+_0x29de24+'/'+_0x40d060)[_0xf762('0x1c')](_0xfc3fb4);}return null;};}function patchUpdates(_0x5bf95f){return function(_0x59d2c7){try{jsonpatch[_0xf762('0x23')](_0x59d2c7,_0x5bf95f,!![]);}catch(_0x1692f7){return BPromise['reject'](_0x1692f7);}return _0x59d2c7[_0xf762('0x24')]();};}function saveUpdates(_0x13f2b,_0x59348f){return function(_0x9b6385){if(_0x9b6385){return _0x9b6385[_0xf762('0x25')](_0x13f2b)[_0xf762('0x26')](function(_0x350e0c){return _0x350e0c;});}return null;};}function removeEntity(_0x2a988f,_0x10c8cd){return function(_0x52a9d3){if(_0x52a9d3){return _0x52a9d3[_0xf762('0x27')]()[_0xf762('0x26')](function(){_0x2a988f[_0xf762('0x1b')](0xcc)[_0xf762('0x1a')]();});}};}function handleEntityNotFound(_0x5bbb2c,_0x36dc06){return function(_0x53780a){if(!_0x53780a){_0x5bbb2c[_0xf762('0x19')](0x194);}return _0x53780a;};}function handleError(_0x17c3aa,_0x50bfab){_0x50bfab=_0x50bfab||0x1f4;return function(_0x4f3923){logger['error'](_0x4f3923[_0xf762('0x28')]);if(_0x4f3923['name']){delete _0x4f3923['name'];}_0x17c3aa[_0xf762('0x1b')](_0x50bfab)[_0xf762('0x29')](_0x4f3923);};}exports[_0xf762('0x2a')]=function(_0x55ac9f,_0x30e1ff){var _0x552eb9={},_0xf6f7a6={},_0x35e2c1={'count':0x0,'rows':[]};var _0x208c44=_[_0xf762('0x2b')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x4da3c8){return{'name':_0x4da3c8[_0xf762('0x2c')],'type':_0x4da3c8['type']['key']};});_0xf6f7a6['model']=_[_0xf762('0x2b')](_0x208c44,'name');_0xf6f7a6['query']=_[_0xf762('0x2d')](_0x55ac9f[_0xf762('0x2e')]);_0xf6f7a6[_0xf762('0x2f')]=_[_0xf762('0x30')](_0xf6f7a6[_0xf762('0x31')],_0xf6f7a6['query']);_0x552eb9[_0xf762('0x32')]=_[_0xf762('0x30')](_0xf6f7a6[_0xf762('0x31')],qs['fields'](_0x55ac9f[_0xf762('0x2e')][_0xf762('0x33')]));_0x552eb9[_0xf762('0x32')]=_0x552eb9[_0xf762('0x32')][_0xf762('0x34')]?_0x552eb9[_0xf762('0x32')]:_0xf6f7a6[_0xf762('0x31')];if(!_0x55ac9f[_0xf762('0x2e')][_0xf762('0x35')](_0xf762('0x36'))){_0x552eb9[_0xf762('0x20')]=qs[_0xf762('0x20')](_0x55ac9f['query'][_0xf762('0x20')]);_0x552eb9[_0xf762('0x1d')]=qs[_0xf762('0x1d')](_0x55ac9f[_0xf762('0x2e')][_0xf762('0x1d')]);}_0x552eb9[_0xf762('0x37')]=qs[_0xf762('0x38')](_0x55ac9f[_0xf762('0x2e')][_0xf762('0x38')]);_0x552eb9[_0xf762('0x39')]=qs[_0xf762('0x2f')](_[_0xf762('0x3a')](_0x55ac9f[_0xf762('0x2e')],_0xf6f7a6[_0xf762('0x2f')]),_0x208c44);if(_0x55ac9f[_0xf762('0x2e')][_0xf762('0x3b')]){_0x552eb9[_0xf762('0x39')]=_['merge'](_0x552eb9['where'],{'$or':_[_0xf762('0x2b')](_0x208c44,function(_0x6b37cc){if(_0x6b37cc[_0xf762('0x3c')]!==_0xf762('0x3d')){var _0x2746ba={};_0x2746ba[_0x6b37cc[_0xf762('0x3e')]]={'$like':'%'+_0x55ac9f[_0xf762('0x2e')][_0xf762('0x3b')]+'%'};return _0x2746ba;}})});}_0x552eb9=_[_0xf762('0x3f')]({},_0x552eb9,_0x55ac9f[_0xf762('0x40')]);var _0x24ea9d={'where':_0x552eb9[_0xf762('0x39')]};return db['FreshsalesConfiguration'][_0xf762('0x1f')](_0x24ea9d)[_0xf762('0x26')](function(_0x4c73ad){_0x35e2c1[_0xf762('0x1f')]=_0x4c73ad;if(_0x55ac9f['query']['includeAll']){_0x552eb9['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xf762('0x41')](_0x552eb9);})[_0xf762('0x26')](function(_0x98336){_0x35e2c1[_0xf762('0x42')]=_0x98336;return _0x35e2c1;})[_0xf762('0x26')](respondWithFilteredResult(_0x30e1ff,_0x552eb9))[_0xf762('0x43')](handleError(_0x30e1ff,null));};exports['show']=function(_0x5eb274,_0x5cea96){var _0x38fcb6={'raw':![],'where':{'id':_0x5eb274['params']['id']}},_0x1a7ac5={};_0x1a7ac5[_0xf762('0x31')]=_['keys'](db[_0xf762('0x44')]['rawAttributes']);_0x1a7ac5['query']=_['keys'](_0x5eb274[_0xf762('0x2e')]);_0x1a7ac5['filters']=_[_0xf762('0x30')](_0x1a7ac5['model'],_0x1a7ac5[_0xf762('0x2e')]);_0x38fcb6[_0xf762('0x32')]=_[_0xf762('0x30')](_0x1a7ac5[_0xf762('0x31')],qs[_0xf762('0x33')](_0x5eb274[_0xf762('0x2e')][_0xf762('0x33')]));_0x38fcb6[_0xf762('0x32')]=_0x38fcb6[_0xf762('0x32')][_0xf762('0x34')]?_0x38fcb6['attributes']:_0x1a7ac5[_0xf762('0x31')];if(_0x5eb274[_0xf762('0x2e')]['includeAll']){_0x38fcb6[_0xf762('0x45')]=[{'all':!![]}];}_0x38fcb6=_[_0xf762('0x3f')]({},_0x38fcb6,_0x5eb274['options']);return db['FreshsalesConfiguration'][_0xf762('0x46')](_0x38fcb6)[_0xf762('0x26')](handleEntityNotFound(_0x5cea96,null))[_0xf762('0x26')](respondWithResult(_0x5cea96,null))[_0xf762('0x43')](handleError(_0x5cea96,null));};exports[_0xf762('0x47')]=function(_0x445f84,_0x5c99f8){return db[_0xf762('0x44')]['create'](_0x445f84[_0xf762('0x48')],{})['then'](respondWithResult(_0x5c99f8,0xc9))[_0xf762('0x43')](handleError(_0x5c99f8,null));};exports[_0xf762('0x25')]=function(_0x18d0d5,_0x50f473){if(_0x18d0d5[_0xf762('0x48')]['id']){delete _0x18d0d5[_0xf762('0x48')]['id'];}return db[_0xf762('0x44')]['find']({'where':{'id':_0x18d0d5[_0xf762('0x49')]['id']}})['then'](handleEntityNotFound(_0x50f473,null))[_0xf762('0x26')](saveUpdates(_0x18d0d5['body'],null))[_0xf762('0x26')](respondWithResult(_0x50f473,null))['catch'](handleError(_0x50f473,null));};exports[_0xf762('0x27')]=function(_0x1df682,_0x43908c){return db['FreshsalesConfiguration'][_0xf762('0x46')]({'where':{'id':_0x1df682['params']['id']}})['then'](handleEntityNotFound(_0x43908c,null))[_0xf762('0x26')](removeEntity(_0x43908c,null))[_0xf762('0x43')](handleError(_0x43908c,null));};exports[_0xf762('0x4a')]=function(_0x5c31fe,_0xb945ca,_0x598992){var _0x3ec788={};var _0x301792={};var _0x3db2af;var _0x48838e;return db[_0xf762('0x44')][_0xf762('0x4b')]({'where':{'id':_0x5c31fe[_0xf762('0x49')]['id']}})['then'](handleEntityNotFound(_0xb945ca,null))[_0xf762('0x26')](function(_0xa974d1){if(_0xa974d1){_0x3db2af=_0xa974d1;_0x301792[_0xf762('0x31')]=_[_0xf762('0x2d')](db['FreshsalesField'][_0xf762('0x4c')]);_0x301792[_0xf762('0x2e')]=_[_0xf762('0x2d')](_0x5c31fe[_0xf762('0x2e')]);_0x301792['filters']=_[_0xf762('0x30')](_0x301792['model'],_0x301792[_0xf762('0x2e')]);_0x3ec788[_0xf762('0x32')]=_[_0xf762('0x30')](_0x301792[_0xf762('0x31')],qs[_0xf762('0x33')](_0x5c31fe[_0xf762('0x2e')][_0xf762('0x33')]));_0x3ec788[_0xf762('0x32')]=_0x3ec788[_0xf762('0x32')][_0xf762('0x34')]?_0x3ec788['attributes']:_0x301792[_0xf762('0x31')];_0x3ec788[_0xf762('0x37')]=qs[_0xf762('0x38')](_0x5c31fe[_0xf762('0x2e')][_0xf762('0x38')]);_0x3ec788[_0xf762('0x39')]=qs[_0xf762('0x2f')](_[_0xf762('0x3a')](_0x5c31fe['query'],_0x301792[_0xf762('0x2f')]));if(_0x5c31fe[_0xf762('0x2e')]['filter']){_0x3ec788[_0xf762('0x39')]=_[_0xf762('0x3f')](_0x3ec788[_0xf762('0x39')],{'$or':_[_0xf762('0x2b')](_0x3ec788[_0xf762('0x32')],function(_0x2d6b59){var _0x10fc3e={};_0x10fc3e[_0x2d6b59]={'$like':'%'+_0x5c31fe[_0xf762('0x2e')][_0xf762('0x3b')]+'%'};return _0x10fc3e;})});}_0x3ec788=_[_0xf762('0x3f')]({},_0x3ec788,_0x5c31fe['options']);return _0x3db2af[_0xf762('0x4a')](_0x3ec788);}})['then'](function(_0x2ee288){if(_0x2ee288){_0x48838e=_0x2ee288[_0xf762('0x34')];if(!_0x5c31fe[_0xf762('0x2e')][_0xf762('0x35')](_0xf762('0x36'))){_0x3ec788[_0xf762('0x20')]=qs['limit'](_0x5c31fe[_0xf762('0x2e')]['limit']);_0x3ec788['offset']=qs[_0xf762('0x1d')](_0x5c31fe['query'][_0xf762('0x1d')]);}return _0x3db2af[_0xf762('0x4a')](_0x3ec788);}})[_0xf762('0x26')](function(_0x3be46d){if(_0x3be46d){return _0x3be46d?{'count':_0x48838e,'rows':_0x3be46d}:null;}})[_0xf762('0x26')](respondWithResult(_0xb945ca,null))[_0xf762('0x43')](handleError(_0xb945ca,null));};exports['getDescriptions']=function(_0x5787a8,_0x1c3956,_0x3f6bd8){var _0x39f3af={};var _0x5b6a61={};var _0x4c990a;var _0x226ad6;return db['FreshsalesConfiguration'][_0xf762('0x4b')]({'where':{'id':_0x5787a8[_0xf762('0x49')]['id']}})[_0xf762('0x26')](handleEntityNotFound(_0x1c3956,null))[_0xf762('0x26')](function(_0x2de9cf){if(_0x2de9cf){_0x4c990a=_0x2de9cf;_0x5b6a61['model']=_[_0xf762('0x2d')](db['FreshsalesField'][_0xf762('0x4c')]);_0x5b6a61[_0xf762('0x2e')]=_['keys'](_0x5787a8[_0xf762('0x2e')]);_0x5b6a61['filters']=_[_0xf762('0x30')](_0x5b6a61[_0xf762('0x31')],_0x5b6a61[_0xf762('0x2e')]);_0x39f3af[_0xf762('0x32')]=_[_0xf762('0x30')](_0x5b6a61[_0xf762('0x31')],qs[_0xf762('0x33')](_0x5787a8['query'][_0xf762('0x33')]));_0x39f3af[_0xf762('0x32')]=_0x39f3af[_0xf762('0x32')][_0xf762('0x34')]?_0x39f3af[_0xf762('0x32')]:_0x5b6a61[_0xf762('0x31')];_0x39f3af[_0xf762('0x37')]=qs[_0xf762('0x38')](_0x5787a8[_0xf762('0x2e')]['sort']);_0x39f3af[_0xf762('0x39')]=qs['filters'](_['pick'](_0x5787a8[_0xf762('0x2e')],_0x5b6a61['filters']));if(_0x5787a8['query']['filter']){_0x39f3af[_0xf762('0x39')]=_[_0xf762('0x3f')](_0x39f3af['where'],{'$or':_[_0xf762('0x2b')](_0x39f3af[_0xf762('0x32')],function(_0x470686){var _0x1ef67c={};_0x1ef67c[_0x470686]={'$like':'%'+_0x5787a8[_0xf762('0x2e')]['filter']+'%'};return _0x1ef67c;})});}_0x39f3af=_[_0xf762('0x3f')]({},_0x39f3af,_0x5787a8[_0xf762('0x40')]);return _0x4c990a['getDescriptions'](_0x39f3af);}})[_0xf762('0x26')](function(_0x424ea0){if(_0x424ea0){_0x226ad6=_0x424ea0['length'];if(!_0x5787a8[_0xf762('0x2e')][_0xf762('0x35')](_0xf762('0x36'))){_0x39f3af[_0xf762('0x20')]=qs[_0xf762('0x20')](_0x5787a8['query'][_0xf762('0x20')]);_0x39f3af[_0xf762('0x1d')]=qs['offset'](_0x5787a8[_0xf762('0x2e')][_0xf762('0x1d')]);}return _0x4c990a[_0xf762('0x4d')](_0x39f3af);}})[_0xf762('0x26')](function(_0x57fe1e){if(_0x57fe1e){return _0x57fe1e?{'count':_0x226ad6,'rows':_0x57fe1e}:null;}})[_0xf762('0x26')](respondWithResult(_0x1c3956,null))[_0xf762('0x43')](handleError(_0x1c3956,null));};exports[_0xf762('0x4e')]=function(_0x3d589a,_0x125793,_0xc294c8){var _0x158001={};var _0x3858f9={};var _0x425151;var _0x527af2;return db[_0xf762('0x44')]['findOne']({'where':{'id':_0x3d589a[_0xf762('0x49')]['id']}})['then'](handleEntityNotFound(_0x125793,null))[_0xf762('0x26')](function(_0x17c09f){if(_0x17c09f){_0x425151=_0x17c09f;_0x3858f9[_0xf762('0x31')]=_['keys'](db[_0xf762('0x4f')][_0xf762('0x4c')]);_0x3858f9[_0xf762('0x2e')]=_[_0xf762('0x2d')](_0x3d589a['query']);_0x3858f9['filters']=_[_0xf762('0x30')](_0x3858f9[_0xf762('0x31')],_0x3858f9['query']);_0x158001['attributes']=_[_0xf762('0x30')](_0x3858f9['model'],qs[_0xf762('0x33')](_0x3d589a[_0xf762('0x2e')]['fields']));_0x158001['attributes']=_0x158001[_0xf762('0x32')][_0xf762('0x34')]?_0x158001['attributes']:_0x3858f9['model'];_0x158001['order']=qs[_0xf762('0x38')](_0x3d589a[_0xf762('0x2e')][_0xf762('0x38')]);_0x158001[_0xf762('0x39')]=qs[_0xf762('0x2f')](_[_0xf762('0x3a')](_0x3d589a['query'],_0x3858f9[_0xf762('0x2f')]));if(_0x3d589a[_0xf762('0x2e')][_0xf762('0x3b')]){_0x158001[_0xf762('0x39')]=_[_0xf762('0x3f')](_0x158001[_0xf762('0x39')],{'$or':_['map'](_0x158001[_0xf762('0x32')],function(_0xdd4217){var _0x42d0bd={};_0x42d0bd[_0xdd4217]={'$like':'%'+_0x3d589a[_0xf762('0x2e')]['filter']+'%'};return _0x42d0bd;})});}_0x158001=_['merge']({},_0x158001,_0x3d589a[_0xf762('0x40')]);return _0x425151[_0xf762('0x4e')](_0x158001);}})[_0xf762('0x26')](function(_0x38a9e6){if(_0x38a9e6){_0x527af2=_0x38a9e6[_0xf762('0x34')];if(!_0x3d589a['query']['hasOwnProperty'](_0xf762('0x36'))){_0x158001[_0xf762('0x20')]=qs[_0xf762('0x20')](_0x3d589a[_0xf762('0x2e')][_0xf762('0x20')]);_0x158001[_0xf762('0x1d')]=qs[_0xf762('0x1d')](_0x3d589a['query'][_0xf762('0x1d')]);}return _0x425151[_0xf762('0x4e')](_0x158001);}})['then'](function(_0x180823){if(_0x180823){return _0x180823?{'count':_0x527af2,'rows':_0x180823}:null;}})[_0xf762('0x26')](respondWithResult(_0x125793,null))[_0xf762('0x43')](handleError(_0x125793,null));}; \ No newline at end of file +var _0x1995=['getDescriptions','getFields','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','index','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','FreshsalesConfiguration','includeAll','include','findAll','catch','show','params','rawAttributes','keys','options','find','create','body','getSubjects','findOne','FreshsalesField','nolimit'];(function(_0x16ed3c,_0xc181eb){var _0x40d124=function(_0x5c4c26){while(--_0x5c4c26){_0x16ed3c['push'](_0x16ed3c['shift']());}};_0x40d124(++_0xc181eb);}(_0x1995,0xf2));var _0x5199=function(_0x309f55,_0x4661b8){_0x309f55=_0x309f55-0x0;var _0x21a430=_0x1995[_0x309f55];return _0x21a430;};'use strict';var emlformat=require(_0x5199('0x0'));var rimraf=require(_0x5199('0x1'));var zipdir=require(_0x5199('0x2'));var jsonpatch=require(_0x5199('0x3'));var rp=require('request-promise');var moment=require(_0x5199('0x4'));var BPromise=require(_0x5199('0x5'));var Mustache=require('mustache');var util=require(_0x5199('0x6'));var path=require(_0x5199('0x7'));var sox=require(_0x5199('0x8'));var csv=require(_0x5199('0x9'));var ejs=require(_0x5199('0xa'));var fs=require('fs');var fs_extra=require(_0x5199('0xb'));var _=require('lodash');var squel=require(_0x5199('0xc'));var crypto=require(_0x5199('0xd'));var jsforce=require(_0x5199('0xe'));var deskjs=require(_0x5199('0xf'));var toCsv=require(_0x5199('0x9'));var querystring=require('querystring');var Papa=require(_0x5199('0x10'));var Redis=require('ioredis');var authService=require(_0x5199('0x11'));var qs=require(_0x5199('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5199('0x13'));var logger=require(_0x5199('0x14'))(_0x5199('0x15'));var utils=require(_0x5199('0x16'));var config=require(_0x5199('0x17'));var licenseUtil=require(_0x5199('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d6092,_0x34e9f6){_0x34e9f6=_0x34e9f6||0xcc;return function(_0x36bd1b){if(_0x36bd1b){return _0x1d6092[_0x5199('0x19')](_0x34e9f6);}return _0x1d6092[_0x5199('0x1a')](_0x34e9f6)[_0x5199('0x1b')]();};}function respondWithResult(_0x47f888,_0x20bfb3){_0x20bfb3=_0x20bfb3||0xc8;return function(_0x21828b){if(_0x21828b){return _0x47f888[_0x5199('0x1a')](_0x20bfb3)[_0x5199('0x1c')](_0x21828b);}};}function respondWithFilteredResult(_0x3cc630,_0x384730){return function(_0x5ba69e){if(_0x5ba69e){var _0x34e653=typeof _0x384730[_0x5199('0x1d')]==='undefined'&&typeof _0x384730['limit']==='undefined';var _0x13161d=_0x5ba69e['count'];var _0x2df2c1=_0x34e653?0x0:_0x384730['offset'];var _0x5cfe0a=_0x34e653?_0x5ba69e[_0x5199('0x1e')]:_0x384730[_0x5199('0x1d')]+_0x384730[_0x5199('0x1f')];var _0x1f30b8;if(_0x5cfe0a>=_0x13161d){_0x5cfe0a=_0x13161d;_0x1f30b8=0xc8;}else{_0x1f30b8=0xce;}_0x3cc630[_0x5199('0x1a')](_0x1f30b8);return _0x3cc630[_0x5199('0x20')](_0x5199('0x21'),_0x2df2c1+'-'+_0x5cfe0a+'/'+_0x13161d)['json'](_0x5ba69e);}return null;};}function patchUpdates(_0x3450df){return function(_0xc0a75c){try{jsonpatch[_0x5199('0x22')](_0xc0a75c,_0x3450df,!![]);}catch(_0x104344){return BPromise['reject'](_0x104344);}return _0xc0a75c['save']();};}function saveUpdates(_0x5ab403,_0x2dc86a){return function(_0x25d613){if(_0x25d613){return _0x25d613[_0x5199('0x23')](_0x5ab403)['then'](function(_0x4c8fa8){return _0x4c8fa8;});}return null;};}function removeEntity(_0x278184,_0x496ac1){return function(_0x160724){if(_0x160724){return _0x160724[_0x5199('0x24')]()[_0x5199('0x25')](function(){_0x278184[_0x5199('0x1a')](0xcc)[_0x5199('0x1b')]();});}};}function handleEntityNotFound(_0x51b1cc,_0x46686e){return function(_0xd8a65c){if(!_0xd8a65c){_0x51b1cc['sendStatus'](0x194);}return _0xd8a65c;};}function handleError(_0x2f1321,_0x9fa0b0){_0x9fa0b0=_0x9fa0b0||0x1f4;return function(_0x52ba28){logger[_0x5199('0x26')](_0x52ba28[_0x5199('0x27')]);if(_0x52ba28[_0x5199('0x28')]){delete _0x52ba28[_0x5199('0x28')];}_0x2f1321['status'](_0x9fa0b0)['send'](_0x52ba28);};}exports[_0x5199('0x29')]=function(_0x4a9541,_0x28c66e){var _0x43adda={},_0x4592a3={},_0x5ccd40={'count':0x0,'rows':[]};var _0xcc1991=_['map'](db['FreshsalesConfiguration']['rawAttributes'],function(_0x23b296){return{'name':_0x23b296[_0x5199('0x2a')],'type':_0x23b296[_0x5199('0x2b')][_0x5199('0x2c')]};});_0x4592a3[_0x5199('0x2d')]=_['map'](_0xcc1991,_0x5199('0x28'));_0x4592a3[_0x5199('0x2e')]=_['keys'](_0x4a9541['query']);_0x4592a3['filters']=_['intersection'](_0x4592a3[_0x5199('0x2d')],_0x4592a3[_0x5199('0x2e')]);_0x43adda[_0x5199('0x2f')]=_[_0x5199('0x30')](_0x4592a3['model'],qs['fields'](_0x4a9541[_0x5199('0x2e')][_0x5199('0x31')]));_0x43adda['attributes']=_0x43adda[_0x5199('0x2f')][_0x5199('0x32')]?_0x43adda[_0x5199('0x2f')]:_0x4592a3[_0x5199('0x2d')];if(!_0x4a9541[_0x5199('0x2e')][_0x5199('0x33')]('nolimit')){_0x43adda['limit']=qs[_0x5199('0x1f')](_0x4a9541['query']['limit']);_0x43adda[_0x5199('0x1d')]=qs[_0x5199('0x1d')](_0x4a9541[_0x5199('0x2e')][_0x5199('0x1d')]);}_0x43adda[_0x5199('0x34')]=qs[_0x5199('0x35')](_0x4a9541[_0x5199('0x2e')][_0x5199('0x35')]);_0x43adda['where']=qs[_0x5199('0x36')](_[_0x5199('0x37')](_0x4a9541[_0x5199('0x2e')],_0x4592a3[_0x5199('0x36')]),_0xcc1991);if(_0x4a9541[_0x5199('0x2e')][_0x5199('0x38')]){_0x43adda[_0x5199('0x39')]=_[_0x5199('0x3a')](_0x43adda[_0x5199('0x39')],{'$or':_[_0x5199('0x3b')](_0xcc1991,function(_0x474730){if(_0x474730[_0x5199('0x2b')]!==_0x5199('0x3c')){var _0x4a8f59={};_0x4a8f59[_0x474730[_0x5199('0x28')]]={'$like':'%'+_0x4a9541[_0x5199('0x2e')]['filter']+'%'};return _0x4a8f59;}})});}_0x43adda=_[_0x5199('0x3a')]({},_0x43adda,_0x4a9541['options']);var _0x557b3c={'where':_0x43adda[_0x5199('0x39')]};return db[_0x5199('0x3d')][_0x5199('0x1e')](_0x557b3c)[_0x5199('0x25')](function(_0x37e91a){_0x5ccd40[_0x5199('0x1e')]=_0x37e91a;if(_0x4a9541[_0x5199('0x2e')][_0x5199('0x3e')]){_0x43adda[_0x5199('0x3f')]=[{'all':!![]}];}return db[_0x5199('0x3d')][_0x5199('0x40')](_0x43adda);})[_0x5199('0x25')](function(_0x2dd955){_0x5ccd40['rows']=_0x2dd955;return _0x5ccd40;})[_0x5199('0x25')](respondWithFilteredResult(_0x28c66e,_0x43adda))[_0x5199('0x41')](handleError(_0x28c66e,null));};exports[_0x5199('0x42')]=function(_0xc7cf89,_0x2298d2){var _0x33f80b={'raw':![],'where':{'id':_0xc7cf89[_0x5199('0x43')]['id']}},_0x2d0d80={};_0x2d0d80[_0x5199('0x2d')]=_['keys'](db[_0x5199('0x3d')][_0x5199('0x44')]);_0x2d0d80[_0x5199('0x2e')]=_[_0x5199('0x45')](_0xc7cf89['query']);_0x2d0d80['filters']=_[_0x5199('0x30')](_0x2d0d80[_0x5199('0x2d')],_0x2d0d80[_0x5199('0x2e')]);_0x33f80b[_0x5199('0x2f')]=_['intersection'](_0x2d0d80[_0x5199('0x2d')],qs['fields'](_0xc7cf89[_0x5199('0x2e')][_0x5199('0x31')]));_0x33f80b[_0x5199('0x2f')]=_0x33f80b[_0x5199('0x2f')]['length']?_0x33f80b['attributes']:_0x2d0d80['model'];if(_0xc7cf89[_0x5199('0x2e')][_0x5199('0x3e')]){_0x33f80b[_0x5199('0x3f')]=[{'all':!![]}];}_0x33f80b=_[_0x5199('0x3a')]({},_0x33f80b,_0xc7cf89[_0x5199('0x46')]);return db['FreshsalesConfiguration'][_0x5199('0x47')](_0x33f80b)[_0x5199('0x25')](handleEntityNotFound(_0x2298d2,null))[_0x5199('0x25')](respondWithResult(_0x2298d2,null))[_0x5199('0x41')](handleError(_0x2298d2,null));};exports[_0x5199('0x48')]=function(_0x319193,_0x4e615a){return db[_0x5199('0x3d')][_0x5199('0x48')](_0x319193[_0x5199('0x49')],{})[_0x5199('0x25')](respondWithResult(_0x4e615a,0xc9))['catch'](handleError(_0x4e615a,null));};exports['update']=function(_0x406a93,_0x4b1338){if(_0x406a93[_0x5199('0x49')]['id']){delete _0x406a93['body']['id'];}return db['FreshsalesConfiguration'][_0x5199('0x47')]({'where':{'id':_0x406a93[_0x5199('0x43')]['id']}})[_0x5199('0x25')](handleEntityNotFound(_0x4b1338,null))[_0x5199('0x25')](saveUpdates(_0x406a93['body'],null))[_0x5199('0x25')](respondWithResult(_0x4b1338,null))[_0x5199('0x41')](handleError(_0x4b1338,null));};exports[_0x5199('0x24')]=function(_0x489cfe,_0x560e01){return db[_0x5199('0x3d')][_0x5199('0x47')]({'where':{'id':_0x489cfe[_0x5199('0x43')]['id']}})[_0x5199('0x25')](handleEntityNotFound(_0x560e01,null))[_0x5199('0x25')](removeEntity(_0x560e01,null))[_0x5199('0x41')](handleError(_0x560e01,null));};exports[_0x5199('0x4a')]=function(_0x27bc48,_0x171ec0,_0x197651){var _0xd0ac90={};var _0xba9e6c={};var _0x3e191d;var _0x184d75;return db[_0x5199('0x3d')][_0x5199('0x4b')]({'where':{'id':_0x27bc48[_0x5199('0x43')]['id']}})[_0x5199('0x25')](handleEntityNotFound(_0x171ec0,null))[_0x5199('0x25')](function(_0xcad271){if(_0xcad271){_0x3e191d=_0xcad271;_0xba9e6c[_0x5199('0x2d')]=_[_0x5199('0x45')](db[_0x5199('0x4c')][_0x5199('0x44')]);_0xba9e6c[_0x5199('0x2e')]=_[_0x5199('0x45')](_0x27bc48[_0x5199('0x2e')]);_0xba9e6c['filters']=_[_0x5199('0x30')](_0xba9e6c[_0x5199('0x2d')],_0xba9e6c[_0x5199('0x2e')]);_0xd0ac90['attributes']=_[_0x5199('0x30')](_0xba9e6c['model'],qs[_0x5199('0x31')](_0x27bc48[_0x5199('0x2e')][_0x5199('0x31')]));_0xd0ac90[_0x5199('0x2f')]=_0xd0ac90['attributes'][_0x5199('0x32')]?_0xd0ac90[_0x5199('0x2f')]:_0xba9e6c['model'];_0xd0ac90[_0x5199('0x34')]=qs['sort'](_0x27bc48[_0x5199('0x2e')][_0x5199('0x35')]);_0xd0ac90[_0x5199('0x39')]=qs[_0x5199('0x36')](_[_0x5199('0x37')](_0x27bc48[_0x5199('0x2e')],_0xba9e6c['filters']));if(_0x27bc48[_0x5199('0x2e')][_0x5199('0x38')]){_0xd0ac90[_0x5199('0x39')]=_[_0x5199('0x3a')](_0xd0ac90[_0x5199('0x39')],{'$or':_[_0x5199('0x3b')](_0xd0ac90[_0x5199('0x2f')],function(_0x41f078){var _0x125ad4={};_0x125ad4[_0x41f078]={'$like':'%'+_0x27bc48[_0x5199('0x2e')][_0x5199('0x38')]+'%'};return _0x125ad4;})});}_0xd0ac90=_[_0x5199('0x3a')]({},_0xd0ac90,_0x27bc48[_0x5199('0x46')]);return _0x3e191d['getSubjects'](_0xd0ac90);}})[_0x5199('0x25')](function(_0x224a01){if(_0x224a01){_0x184d75=_0x224a01[_0x5199('0x32')];if(!_0x27bc48[_0x5199('0x2e')][_0x5199('0x33')](_0x5199('0x4d'))){_0xd0ac90['limit']=qs[_0x5199('0x1f')](_0x27bc48[_0x5199('0x2e')]['limit']);_0xd0ac90['offset']=qs[_0x5199('0x1d')](_0x27bc48[_0x5199('0x2e')][_0x5199('0x1d')]);}return _0x3e191d['getSubjects'](_0xd0ac90);}})[_0x5199('0x25')](function(_0x4f6f84){if(_0x4f6f84){return _0x4f6f84?{'count':_0x184d75,'rows':_0x4f6f84}:null;}})[_0x5199('0x25')](respondWithResult(_0x171ec0,null))[_0x5199('0x41')](handleError(_0x171ec0,null));};exports['getDescriptions']=function(_0x2f0de8,_0x209833,_0x552520){var _0x5058f4={};var _0x1aa050={};var _0x2fd205;var _0x54f11a;return db[_0x5199('0x3d')][_0x5199('0x4b')]({'where':{'id':_0x2f0de8[_0x5199('0x43')]['id']}})[_0x5199('0x25')](handleEntityNotFound(_0x209833,null))[_0x5199('0x25')](function(_0x44b3aa){if(_0x44b3aa){_0x2fd205=_0x44b3aa;_0x1aa050[_0x5199('0x2d')]=_[_0x5199('0x45')](db[_0x5199('0x4c')][_0x5199('0x44')]);_0x1aa050[_0x5199('0x2e')]=_[_0x5199('0x45')](_0x2f0de8[_0x5199('0x2e')]);_0x1aa050[_0x5199('0x36')]=_[_0x5199('0x30')](_0x1aa050[_0x5199('0x2d')],_0x1aa050[_0x5199('0x2e')]);_0x5058f4[_0x5199('0x2f')]=_[_0x5199('0x30')](_0x1aa050['model'],qs[_0x5199('0x31')](_0x2f0de8['query'][_0x5199('0x31')]));_0x5058f4['attributes']=_0x5058f4['attributes'][_0x5199('0x32')]?_0x5058f4['attributes']:_0x1aa050[_0x5199('0x2d')];_0x5058f4[_0x5199('0x34')]=qs[_0x5199('0x35')](_0x2f0de8[_0x5199('0x2e')][_0x5199('0x35')]);_0x5058f4[_0x5199('0x39')]=qs[_0x5199('0x36')](_[_0x5199('0x37')](_0x2f0de8[_0x5199('0x2e')],_0x1aa050[_0x5199('0x36')]));if(_0x2f0de8[_0x5199('0x2e')][_0x5199('0x38')]){_0x5058f4[_0x5199('0x39')]=_[_0x5199('0x3a')](_0x5058f4[_0x5199('0x39')],{'$or':_[_0x5199('0x3b')](_0x5058f4[_0x5199('0x2f')],function(_0x529dc8){var _0xc61c7d={};_0xc61c7d[_0x529dc8]={'$like':'%'+_0x2f0de8[_0x5199('0x2e')][_0x5199('0x38')]+'%'};return _0xc61c7d;})});}_0x5058f4=_[_0x5199('0x3a')]({},_0x5058f4,_0x2f0de8[_0x5199('0x46')]);return _0x2fd205[_0x5199('0x4e')](_0x5058f4);}})[_0x5199('0x25')](function(_0x7040ff){if(_0x7040ff){_0x54f11a=_0x7040ff['length'];if(!_0x2f0de8['query'][_0x5199('0x33')]('nolimit')){_0x5058f4['limit']=qs['limit'](_0x2f0de8['query']['limit']);_0x5058f4[_0x5199('0x1d')]=qs[_0x5199('0x1d')](_0x2f0de8[_0x5199('0x2e')][_0x5199('0x1d')]);}return _0x2fd205[_0x5199('0x4e')](_0x5058f4);}})['then'](function(_0x192fc1){if(_0x192fc1){return _0x192fc1?{'count':_0x54f11a,'rows':_0x192fc1}:null;}})['then'](respondWithResult(_0x209833,null))[_0x5199('0x41')](handleError(_0x209833,null));};exports[_0x5199('0x4f')]=function(_0x42d17f,_0x24b4b3,_0x25a4b7){var _0x190a6c={};var _0x3d893a={};var _0x2e77f5;var _0x31a38d;return db[_0x5199('0x3d')][_0x5199('0x4b')]({'where':{'id':_0x42d17f[_0x5199('0x43')]['id']}})[_0x5199('0x25')](handleEntityNotFound(_0x24b4b3,null))[_0x5199('0x25')](function(_0x106bd1){if(_0x106bd1){_0x2e77f5=_0x106bd1;_0x3d893a[_0x5199('0x2d')]=_['keys'](db[_0x5199('0x4c')][_0x5199('0x44')]);_0x3d893a[_0x5199('0x2e')]=_[_0x5199('0x45')](_0x42d17f[_0x5199('0x2e')]);_0x3d893a[_0x5199('0x36')]=_[_0x5199('0x30')](_0x3d893a[_0x5199('0x2d')],_0x3d893a['query']);_0x190a6c[_0x5199('0x2f')]=_[_0x5199('0x30')](_0x3d893a['model'],qs[_0x5199('0x31')](_0x42d17f[_0x5199('0x2e')][_0x5199('0x31')]));_0x190a6c[_0x5199('0x2f')]=_0x190a6c[_0x5199('0x2f')][_0x5199('0x32')]?_0x190a6c[_0x5199('0x2f')]:_0x3d893a['model'];_0x190a6c[_0x5199('0x34')]=qs['sort'](_0x42d17f[_0x5199('0x2e')][_0x5199('0x35')]);_0x190a6c[_0x5199('0x39')]=qs[_0x5199('0x36')](_[_0x5199('0x37')](_0x42d17f[_0x5199('0x2e')],_0x3d893a['filters']));if(_0x42d17f[_0x5199('0x2e')][_0x5199('0x38')]){_0x190a6c['where']=_['merge'](_0x190a6c['where'],{'$or':_['map'](_0x190a6c['attributes'],function(_0x2fbd00){var _0x29bdb9={};_0x29bdb9[_0x2fbd00]={'$like':'%'+_0x42d17f['query'][_0x5199('0x38')]+'%'};return _0x29bdb9;})});}_0x190a6c=_[_0x5199('0x3a')]({},_0x190a6c,_0x42d17f[_0x5199('0x46')]);return _0x2e77f5[_0x5199('0x4f')](_0x190a6c);}})[_0x5199('0x25')](function(_0x39a35a){if(_0x39a35a){_0x31a38d=_0x39a35a[_0x5199('0x32')];if(!_0x42d17f[_0x5199('0x2e')][_0x5199('0x33')](_0x5199('0x4d'))){_0x190a6c[_0x5199('0x1f')]=qs[_0x5199('0x1f')](_0x42d17f[_0x5199('0x2e')][_0x5199('0x1f')]);_0x190a6c[_0x5199('0x1d')]=qs[_0x5199('0x1d')](_0x42d17f[_0x5199('0x2e')]['offset']);}return _0x2e77f5['getFields'](_0x190a6c);}})[_0x5199('0x25')](function(_0x5747f8){if(_0x5747f8){return _0x5747f8?{'count':_0x31a38d,'rows':_0x5747f8}:null;}})[_0x5199('0x25')](respondWithResult(_0x24b4b3,null))[_0x5199('0x41')](handleError(_0x24b4b3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e737415..7005c73 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 _0xd711=['moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xd711,0xcf));var _0x1d71=function(_0x21a1ad,_0x4eab02){_0x21a1ad=_0x21a1ad-0x0;var _0x59e9cc=_0xd711[_0x21a1ad];return _0x59e9cc;};'use strict';var _=require(_0x1d71('0x0'));var util=require('util');var logger=require(_0x1d71('0x1'))('api');var moment=require(_0x1d71('0x2'));var BPromise=require(_0x1d71('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1d71('0x4'));var rimraf=require(_0x1d71('0x5'));var config=require(_0x1d71('0x6'));var attributes=require(_0x1d71('0x7'));module['exports']=function(_0x36da1b,_0x2eef96){return _0x36da1b[_0x1d71('0x8')](_0x1d71('0x9'),attributes,{'tableName':_0x1d71('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda9c=['../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x13eee4,_0x3c04bd){var _0x304709=function(_0x549eb6){while(--_0x549eb6){_0x13eee4['push'](_0x13eee4['shift']());}};_0x304709(++_0x3c04bd);}(_0xda9c,0x113));var _0xcda9=function(_0x22360f,_0x122778){_0x22360f=_0x22360f-0x0;var _0x4dae0f=_0xda9c[_0x22360f];return _0x4dae0f;};'use strict';var _=require(_0xcda9('0x0'));var util=require(_0xcda9('0x1'));var logger=require(_0xcda9('0x2'))('api');var moment=require(_0xcda9('0x3'));var BPromise=require(_0xcda9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcda9('0x5'));var attributes=require(_0xcda9('0x6'));module[_0xcda9('0x7')]=function(_0x4171f3,_0x52cd4b){return _0x4171f3['define'](_0xcda9('0x8'),attributes,{'tableName':_0xcda9('0x9'),'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 d05bf91..28c8f17 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 _0x83dd=['FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x83dd,0xfa));var _0xd83d=function(_0x7fcd74,_0x4a03db){_0x7fcd74=_0x7fcd74-0x0;var _0x5715b8=_0x83dd[_0x7fcd74];return _0x5715b8;};'use strict';var _=require(_0xd83d('0x0'));var util=require(_0xd83d('0x1'));var moment=require(_0xd83d('0x2'));var BPromise=require(_0xd83d('0x3'));var rs=require(_0xd83d('0x4'));var fs=require('fs');var Redis=require(_0xd83d('0x5'));var db=require(_0xd83d('0x6'))['db'];var utils=require(_0xd83d('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xd83d('0x8'));var client=jayson[_0xd83d('0x9')][_0xd83d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x477950,_0x390493,_0x4806da){return new BPromise(function(_0x31c4b4,_0x569222){return client[_0xd83d('0xb')](_0x477950,_0x4806da)[_0xd83d('0xc')](function(_0x549752){logger[_0xd83d('0xd')](_0xd83d('0xe'),_0x390493,'request\x20sent');logger[_0xd83d('0xf')](_0xd83d('0x10'),_0x390493,_0xd83d('0x11'),JSON['stringify'](_0x549752));if(_0x549752[_0xd83d('0x12')]){if(_0x549752[_0xd83d('0x12')]['code']===0x1f4){logger[_0xd83d('0x12')](_0xd83d('0xe'),_0x390493,_0x549752['error']['message']);return _0x569222(_0x549752[_0xd83d('0x12')][_0xd83d('0x13')]);}logger[_0xd83d('0x12')](_0xd83d('0xe'),_0x390493,_0x549752[_0xd83d('0x12')][_0xd83d('0x13')]);return _0x31c4b4(_0x549752[_0xd83d('0x12')][_0xd83d('0x13')]);}else{logger[_0xd83d('0xd')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x390493,_0xd83d('0x11'));_0x31c4b4(_0x549752[_0xd83d('0x14')][_0xd83d('0x13')]);}})[_0xd83d('0x15')](function(_0x489bb2){logger[_0xd83d('0x12')](_0xd83d('0xe'),_0x390493,_0x489bb2);_0x569222(_0x489bb2);});});} \ No newline at end of file +var _0xda0e=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4fd2a7,_0x4850f6){var _0x559441=function(_0xdba54b){while(--_0xdba54b){_0x4fd2a7['push'](_0x4fd2a7['shift']());}};_0x559441(++_0x4850f6);}(_0xda0e,0x76));var _0xeda0=function(_0x1e5814,_0x2af6a1){_0x1e5814=_0x1e5814-0x0;var _0x3182ac=_0xda0e[_0x1e5814];return _0x3182ac;};'use strict';var _=require(_0xeda0('0x0'));var util=require(_0xeda0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeda0('0x2'));var fs=require('fs');var Redis=require(_0xeda0('0x3'));var db=require(_0xeda0('0x4'))['db'];var utils=require(_0xeda0('0x5'));var logger=require(_0xeda0('0x6'))(_0xeda0('0x7'));var config=require(_0xeda0('0x8'));var jayson=require(_0xeda0('0x9'));var client=jayson['client'][_0xeda0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130aa0,_0x5eb367,_0x34f8b4){return new BPromise(function(_0x269c9d,_0x3fc0af){return client[_0xeda0('0xb')](_0x130aa0,_0x34f8b4)[_0xeda0('0xc')](function(_0x2300de){logger[_0xeda0('0xd')](_0xeda0('0xe'),_0x5eb367,_0xeda0('0xf'));logger[_0xeda0('0x10')](_0xeda0('0x11'),_0x5eb367,_0xeda0('0xf'),JSON[_0xeda0('0x12')](_0x2300de));if(_0x2300de[_0xeda0('0x13')]){if(_0x2300de[_0xeda0('0x13')]['code']===0x1f4){logger[_0xeda0('0x13')](_0xeda0('0xe'),_0x5eb367,_0x2300de[_0xeda0('0x13')][_0xeda0('0x14')]);return _0x3fc0af(_0x2300de['error'][_0xeda0('0x14')]);}logger[_0xeda0('0x13')](_0xeda0('0xe'),_0x5eb367,_0x2300de[_0xeda0('0x13')][_0xeda0('0x14')]);return _0x269c9d(_0x2300de['error'][_0xeda0('0x14')]);}else{logger[_0xeda0('0xd')](_0xeda0('0xe'),_0x5eb367,_0xeda0('0xf'));_0x269c9d(_0x2300de[_0xeda0('0x15')][_0xeda0('0x14')]);}})[_0xeda0('0x16')](function(_0x12d91b){logger[_0xeda0('0x13')](_0xeda0('0xe'),_0x5eb367,_0x12d91b);_0x3fc0af(_0x12d91b);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 8d1a010..e8232ec 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 _0x58e5=['util','path','connect-timeout','express','Router','../../components/auth/service','./intFreshsalesField.controller','isAuthenticated','get','/:id','put','update','delete','exports','multer'];(function(_0x1779d1,_0x55acb6){var _0x2884e3=function(_0x2ec4be){while(--_0x2ec4be){_0x1779d1['push'](_0x1779d1['shift']());}};_0x2884e3(++_0x55acb6);}(_0x58e5,0xd1));var _0x558e=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x58e5[_0x2adbeb];return _0x5e18a6;};'use strict';var multer=require(_0x558e('0x0'));var util=require(_0x558e('0x1'));var path=require(_0x558e('0x2'));var timeout=require(_0x558e('0x3'));var express=require(_0x558e('0x4'));var router=express[_0x558e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x558e('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x558e('0x7'));router['get']('/',auth[_0x558e('0x8')](),controller['index']);router[_0x558e('0x9')](_0x558e('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x558e('0xb')](_0x558e('0xa'),auth['isAuthenticated'](),controller[_0x558e('0xc')]);router[_0x558e('0xd')](_0x558e('0xa'),auth[_0x558e('0x8')](),controller['destroy']);module[_0x558e('0xe')]=router; \ No newline at end of file +var _0x3299=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x3299,0x1bc));var _0x9329=function(_0x49a2ce,_0x1f53c8){_0x49a2ce=_0x49a2ce-0x0;var _0x49be22=_0x3299[_0x49a2ce];return _0x49be22;};'use strict';var multer=require('multer');var util=require(_0x9329('0x0'));var path=require(_0x9329('0x1'));var timeout=require(_0x9329('0x2'));var express=require(_0x9329('0x3'));var router=express[_0x9329('0x4')]();var fs_extra=require(_0x9329('0x5'));var auth=require(_0x9329('0x6'));var interaction=require(_0x9329('0x7'));var config=require(_0x9329('0x8'));var controller=require(_0x9329('0x9'));router[_0x9329('0xa')]('/',auth[_0x9329('0xb')](),controller[_0x9329('0xc')]);router[_0x9329('0xa')](_0x9329('0xd'),auth[_0x9329('0xb')](),controller[_0x9329('0xe')]);router['post']('/',auth[_0x9329('0xb')](),controller[_0x9329('0xf')]);router[_0x9329('0x10')](_0x9329('0xd'),auth[_0x9329('0xb')](),controller['update']);router[_0x9329('0x11')](_0x9329('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c5a4b79..f0f5afe 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 _0xb50c=['sequelize','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb50c,0xc0));var _0xcb50=function(_0x2dbcea,_0x5e578d){_0x2dbcea=_0x2dbcea-0x0;var _0x2227e0=_0xb50c[_0x2dbcea];return _0x2227e0;};'use strict';var Sequelize=require(_0xcb50('0x0'));module['exports']={'type':{'type':Sequelize[_0xcb50('0x1')](_0xcb50('0x2'),_0xcb50('0x3'),_0xcb50('0x4'),_0xcb50('0x5'),'picklist'),'defaultValue':_0xcb50('0x2')},'content':{'type':Sequelize[_0xcb50('0x6')]},'key':{'type':Sequelize[_0xcb50('0x6')]},'keyType':{'type':Sequelize[_0xcb50('0x1')](_0xcb50('0x2'),_0xcb50('0x3'),_0xcb50('0x4'))},'keyContent':{'type':Sequelize[_0xcb50('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xcb50('0x6')]},'customField':{'type':Sequelize[_0xcb50('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcb50('0x6')]}}; \ No newline at end of file +var _0x8bc8=['BOOLEAN','exports','ENUM','customVariable','keyValue','picklist','string','STRING'];(function(_0x4833b1,_0x1d3e50){var _0x68972=function(_0x42d75e){while(--_0x42d75e){_0x4833b1['push'](_0x4833b1['shift']());}};_0x68972(++_0x1d3e50);}(_0x8bc8,0x1f1));var _0x88bc=function(_0x4426df,_0x16ca67){_0x4426df=_0x4426df-0x0;var _0x35f87e=_0x8bc8[_0x4426df];return _0x35f87e;};'use strict';var Sequelize=require('sequelize');module[_0x88bc('0x0')]={'type':{'type':Sequelize[_0x88bc('0x1')]('string','variable',_0x88bc('0x2'),_0x88bc('0x3'),_0x88bc('0x4')),'defaultValue':_0x88bc('0x5')},'content':{'type':Sequelize[_0x88bc('0x6')]},'key':{'type':Sequelize[_0x88bc('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x88bc('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x88bc('0x6')]},'customField':{'type':Sequelize[_0x88bc('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x88bc('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 05d0ba1..9f1a588 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 _0x8fa8=['keys','includeAll','include','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','update','destroy','then','error','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','findAll','rows','catch','show','params'];(function(_0x561197,_0x2d7d64){var _0x191270=function(_0x32d6e2){while(--_0x32d6e2){_0x561197['push'](_0x561197['shift']());}};_0x191270(++_0x2d7d64);}(_0x8fa8,0xe2));var _0x88fa=function(_0xb08769,_0xed91e5){_0xb08769=_0xb08769-0x0;var _0x5afe05=_0x8fa8[_0xb08769];return _0x5afe05;};'use strict';var emlformat=require(_0x88fa('0x0'));var rimraf=require(_0x88fa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88fa('0x2'));var rp=require(_0x88fa('0x3'));var moment=require(_0x88fa('0x4'));var BPromise=require(_0x88fa('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x88fa('0x6'));var sox=require(_0x88fa('0x7'));var csv=require(_0x88fa('0x8'));var ejs=require(_0x88fa('0x9'));var fs=require('fs');var fs_extra=require(_0x88fa('0xa'));var _=require(_0x88fa('0xb'));var squel=require(_0x88fa('0xc'));var crypto=require('crypto');var jsforce=require(_0x88fa('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x88fa('0x8'));var querystring=require(_0x88fa('0xe'));var Papa=require(_0x88fa('0xf'));var Redis=require(_0x88fa('0x10'));var authService=require(_0x88fa('0x11'));var qs=require(_0x88fa('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88fa('0x13'));var logger=require('../../config/logger')(_0x88fa('0x14'));var utils=require(_0x88fa('0x15'));var config=require(_0x88fa('0x16'));var licenseUtil=require(_0x88fa('0x17'));var db=require(_0x88fa('0x18'))['db'];function respondWithStatusCode(_0x59c204,_0x1358e0){_0x1358e0=_0x1358e0||0xcc;return function(_0x1da5d5){if(_0x1da5d5){return _0x59c204[_0x88fa('0x19')](_0x1358e0);}return _0x59c204[_0x88fa('0x1a')](_0x1358e0)[_0x88fa('0x1b')]();};}function respondWithResult(_0x5ebbb5,_0x5f59f8){_0x5f59f8=_0x5f59f8||0xc8;return function(_0x30c712){if(_0x30c712){return _0x5ebbb5[_0x88fa('0x1a')](_0x5f59f8)[_0x88fa('0x1c')](_0x30c712);}};}function respondWithFilteredResult(_0x133555,_0x48b0ac){return function(_0x4783fb){if(_0x4783fb){var _0x796525=typeof _0x48b0ac['offset']==='undefined'&&typeof _0x48b0ac[_0x88fa('0x1d')]===_0x88fa('0x1e');var _0x270142=_0x4783fb[_0x88fa('0x1f')];var _0x27e4da=_0x796525?0x0:_0x48b0ac[_0x88fa('0x20')];var _0x49e780=_0x796525?_0x4783fb['count']:_0x48b0ac['offset']+_0x48b0ac[_0x88fa('0x1d')];var _0x2c6113;if(_0x49e780>=_0x270142){_0x49e780=_0x270142;_0x2c6113=0xc8;}else{_0x2c6113=0xce;}_0x133555[_0x88fa('0x1a')](_0x2c6113);return _0x133555[_0x88fa('0x21')](_0x88fa('0x22'),_0x27e4da+'-'+_0x49e780+'/'+_0x270142)['json'](_0x4783fb);}return null;};}function patchUpdates(_0x3a9784){return function(_0x2fa9be){try{jsonpatch['apply'](_0x2fa9be,_0x3a9784,!![]);}catch(_0x3b63d8){return BPromise['reject'](_0x3b63d8);}return _0x2fa9be['save']();};}function saveUpdates(_0x2cd91c,_0x1acc6d){return function(_0x21a211){if(_0x21a211){return _0x21a211[_0x88fa('0x23')](_0x2cd91c)['then'](function(_0x57eee6){return _0x57eee6;});}return null;};}function removeEntity(_0x5a42ae,_0x5b91a3){return function(_0x3b9a37){if(_0x3b9a37){return _0x3b9a37[_0x88fa('0x24')]()[_0x88fa('0x25')](function(){_0x5a42ae[_0x88fa('0x1a')](0xcc)[_0x88fa('0x1b')]();});}};}function handleEntityNotFound(_0x7b785b,_0x443695){return function(_0x5b17fc){if(!_0x5b17fc){_0x7b785b[_0x88fa('0x19')](0x194);}return _0x5b17fc;};}function handleError(_0x2c5262,_0x21d590){_0x21d590=_0x21d590||0x1f4;return function(_0x16089a){logger[_0x88fa('0x26')](_0x16089a['stack']);if(_0x16089a[_0x88fa('0x27')]){delete _0x16089a['name'];}_0x2c5262['status'](_0x21d590)[_0x88fa('0x28')](_0x16089a);};}exports[_0x88fa('0x29')]=function(_0x2263c1,_0x5ed14f){var _0x3b01e3={},_0x5da788={},_0x4e77aa={'count':0x0,'rows':[]};var _0x24e8c0=_[_0x88fa('0x2a')](db[_0x88fa('0x2b')][_0x88fa('0x2c')],function(_0x398e5f){return{'name':_0x398e5f[_0x88fa('0x2d')],'type':_0x398e5f[_0x88fa('0x2e')][_0x88fa('0x2f')]};});_0x5da788[_0x88fa('0x30')]=_[_0x88fa('0x2a')](_0x24e8c0,_0x88fa('0x27'));_0x5da788['query']=_['keys'](_0x2263c1[_0x88fa('0x31')]);_0x5da788[_0x88fa('0x32')]=_[_0x88fa('0x33')](_0x5da788[_0x88fa('0x30')],_0x5da788[_0x88fa('0x31')]);_0x3b01e3[_0x88fa('0x34')]=_[_0x88fa('0x33')](_0x5da788['model'],qs[_0x88fa('0x35')](_0x2263c1[_0x88fa('0x31')]['fields']));_0x3b01e3[_0x88fa('0x34')]=_0x3b01e3[_0x88fa('0x34')][_0x88fa('0x36')]?_0x3b01e3[_0x88fa('0x34')]:_0x5da788['model'];if(!_0x2263c1[_0x88fa('0x31')]['hasOwnProperty'](_0x88fa('0x37'))){_0x3b01e3['limit']=qs[_0x88fa('0x1d')](_0x2263c1[_0x88fa('0x31')]['limit']);_0x3b01e3[_0x88fa('0x20')]=qs[_0x88fa('0x20')](_0x2263c1['query']['offset']);}_0x3b01e3[_0x88fa('0x38')]=qs[_0x88fa('0x39')](_0x2263c1['query'][_0x88fa('0x39')]);_0x3b01e3[_0x88fa('0x3a')]=qs['filters'](_['pick'](_0x2263c1[_0x88fa('0x31')],_0x5da788[_0x88fa('0x32')]),_0x24e8c0);if(_0x2263c1[_0x88fa('0x31')]['filter']){_0x3b01e3[_0x88fa('0x3a')]=_[_0x88fa('0x3b')](_0x3b01e3[_0x88fa('0x3a')],{'$or':_[_0x88fa('0x2a')](_0x24e8c0,function(_0x515942){if(_0x515942[_0x88fa('0x2e')]!==_0x88fa('0x3c')){var _0x3622d9={};_0x3622d9[_0x515942[_0x88fa('0x27')]]={'$like':'%'+_0x2263c1[_0x88fa('0x31')]['filter']+'%'};return _0x3622d9;}})});}_0x3b01e3=_['merge']({},_0x3b01e3,_0x2263c1['options']);var _0x48e683={'where':_0x3b01e3[_0x88fa('0x3a')]};return db['FreshsalesField'][_0x88fa('0x1f')](_0x48e683)[_0x88fa('0x25')](function(_0x1f3070){_0x4e77aa[_0x88fa('0x1f')]=_0x1f3070;if(_0x2263c1['query']['includeAll']){_0x3b01e3['include']=[{'all':!![]}];}return db[_0x88fa('0x2b')][_0x88fa('0x3d')](_0x3b01e3);})[_0x88fa('0x25')](function(_0x41e02f){_0x4e77aa[_0x88fa('0x3e')]=_0x41e02f;return _0x4e77aa;})[_0x88fa('0x25')](respondWithFilteredResult(_0x5ed14f,_0x3b01e3))[_0x88fa('0x3f')](handleError(_0x5ed14f,null));};exports[_0x88fa('0x40')]=function(_0x47d173,_0x42b4e8){var _0x57dfa7={'raw':!![],'where':{'id':_0x47d173[_0x88fa('0x41')]['id']}},_0x1ccaad={};_0x1ccaad[_0x88fa('0x30')]=_[_0x88fa('0x42')](db[_0x88fa('0x2b')][_0x88fa('0x2c')]);_0x1ccaad[_0x88fa('0x31')]=_[_0x88fa('0x42')](_0x47d173['query']);_0x1ccaad[_0x88fa('0x32')]=_[_0x88fa('0x33')](_0x1ccaad['model'],_0x1ccaad[_0x88fa('0x31')]);_0x57dfa7[_0x88fa('0x34')]=_['intersection'](_0x1ccaad[_0x88fa('0x30')],qs[_0x88fa('0x35')](_0x47d173['query'][_0x88fa('0x35')]));_0x57dfa7[_0x88fa('0x34')]=_0x57dfa7[_0x88fa('0x34')][_0x88fa('0x36')]?_0x57dfa7['attributes']:_0x1ccaad[_0x88fa('0x30')];if(_0x47d173[_0x88fa('0x31')][_0x88fa('0x43')]){_0x57dfa7[_0x88fa('0x44')]=[{'all':!![]}];}_0x57dfa7=_[_0x88fa('0x3b')]({},_0x57dfa7,_0x47d173[_0x88fa('0x45')]);return db['FreshsalesField']['find'](_0x57dfa7)[_0x88fa('0x25')](handleEntityNotFound(_0x42b4e8,null))[_0x88fa('0x25')](respondWithResult(_0x42b4e8,null))[_0x88fa('0x3f')](handleError(_0x42b4e8,null));};exports[_0x88fa('0x46')]=function(_0x21e44b,_0x56a781){return db[_0x88fa('0x2b')][_0x88fa('0x46')](_0x21e44b[_0x88fa('0x47')],{})[_0x88fa('0x25')](respondWithResult(_0x56a781,0xc9))[_0x88fa('0x3f')](handleError(_0x56a781,null));};exports[_0x88fa('0x23')]=function(_0x208f6c,_0x250a39){if(_0x208f6c[_0x88fa('0x47')]['id']){delete _0x208f6c['body']['id'];}return db[_0x88fa('0x2b')][_0x88fa('0x48')]({'where':{'id':_0x208f6c['params']['id']}})[_0x88fa('0x25')](handleEntityNotFound(_0x250a39,null))[_0x88fa('0x25')](saveUpdates(_0x208f6c['body'],null))[_0x88fa('0x25')](respondWithResult(_0x250a39,null))[_0x88fa('0x3f')](handleError(_0x250a39,null));};exports[_0x88fa('0x24')]=function(_0x32a94a,_0x451252){return db[_0x88fa('0x2b')][_0x88fa('0x48')]({'where':{'id':_0x32a94a[_0x88fa('0x41')]['id']}})[_0x88fa('0x25')](handleEntityNotFound(_0x451252,null))['then'](removeEntity(_0x451252,null))[_0x88fa('0x3f')](handleError(_0x451252,null));}; \ No newline at end of file +var _0x7cf6=['util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x15aed3,_0x1b4972){var _0x164032=function(_0x30dc83){while(--_0x30dc83){_0x15aed3['push'](_0x15aed3['shift']());}};_0x164032(++_0x1b4972);}(_0x7cf6,0x86));var _0x67cf=function(_0x1adc6e,_0x342b49){_0x1adc6e=_0x1adc6e-0x0;var _0x330348=_0x7cf6[_0x1adc6e];return _0x330348;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x67cf('0x0'));var zipdir=require(_0x67cf('0x1'));var jsonpatch=require(_0x67cf('0x2'));var rp=require(_0x67cf('0x3'));var moment=require(_0x67cf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x67cf('0x5'));var util=require(_0x67cf('0x6'));var path=require(_0x67cf('0x7'));var sox=require('sox');var csv=require(_0x67cf('0x8'));var ejs=require(_0x67cf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x67cf('0xa'));var crypto=require(_0x67cf('0xb'));var jsforce=require(_0x67cf('0xc'));var deskjs=require(_0x67cf('0xd'));var toCsv=require('to-csv');var querystring=require(_0x67cf('0xe'));var Papa=require(_0x67cf('0xf'));var Redis=require(_0x67cf('0x10'));var authService=require(_0x67cf('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x67cf('0x12'));var hardwareService=require(_0x67cf('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x67cf('0x14'));var config=require(_0x67cf('0x15'));var licenseUtil=require(_0x67cf('0x16'));var db=require(_0x67cf('0x17'))['db'];function respondWithStatusCode(_0x671cf4,_0x49c62a){_0x49c62a=_0x49c62a||0xcc;return function(_0x1a1abf){if(_0x1a1abf){return _0x671cf4[_0x67cf('0x18')](_0x49c62a);}return _0x671cf4['status'](_0x49c62a)[_0x67cf('0x19')]();};}function respondWithResult(_0x37a4aa,_0x1b4920){_0x1b4920=_0x1b4920||0xc8;return function(_0x56167e){if(_0x56167e){return _0x37a4aa[_0x67cf('0x1a')](_0x1b4920)[_0x67cf('0x1b')](_0x56167e);}};}function respondWithFilteredResult(_0x2ad82d,_0x5466e5){return function(_0xd966cf){if(_0xd966cf){var _0x5271e6=typeof _0x5466e5[_0x67cf('0x1c')]===_0x67cf('0x1d')&&typeof _0x5466e5['limit']===_0x67cf('0x1d');var _0x4f8fae=_0xd966cf[_0x67cf('0x1e')];var _0x428360=_0x5271e6?0x0:_0x5466e5['offset'];var _0x886c20=_0x5271e6?_0xd966cf[_0x67cf('0x1e')]:_0x5466e5['offset']+_0x5466e5['limit'];var _0x28c93a;if(_0x886c20>=_0x4f8fae){_0x886c20=_0x4f8fae;_0x28c93a=0xc8;}else{_0x28c93a=0xce;}_0x2ad82d[_0x67cf('0x1a')](_0x28c93a);return _0x2ad82d[_0x67cf('0x1f')]('Content-Range',_0x428360+'-'+_0x886c20+'/'+_0x4f8fae)[_0x67cf('0x1b')](_0xd966cf);}return null;};}function patchUpdates(_0x999a09){return function(_0x27e99e){try{jsonpatch['apply'](_0x27e99e,_0x999a09,!![]);}catch(_0x1ee1dc){return BPromise['reject'](_0x1ee1dc);}return _0x27e99e[_0x67cf('0x20')]();};}function saveUpdates(_0xdc2428,_0x4c49d4){return function(_0x3e0b27){if(_0x3e0b27){return _0x3e0b27[_0x67cf('0x21')](_0xdc2428)[_0x67cf('0x22')](function(_0x14ff05){return _0x14ff05;});}return null;};}function removeEntity(_0x29c5a4,_0x1cace3){return function(_0x2bad4f){if(_0x2bad4f){return _0x2bad4f[_0x67cf('0x23')]()['then'](function(){_0x29c5a4[_0x67cf('0x1a')](0xcc)[_0x67cf('0x19')]();});}};}function handleEntityNotFound(_0x369822,_0x25a57f){return function(_0x2e5cab){if(!_0x2e5cab){_0x369822[_0x67cf('0x18')](0x194);}return _0x2e5cab;};}function handleError(_0x27825e,_0x2812e3){_0x2812e3=_0x2812e3||0x1f4;return function(_0x28214f){logger[_0x67cf('0x24')](_0x28214f[_0x67cf('0x25')]);if(_0x28214f[_0x67cf('0x26')]){delete _0x28214f[_0x67cf('0x26')];}_0x27825e[_0x67cf('0x1a')](_0x2812e3)[_0x67cf('0x27')](_0x28214f);};}exports['index']=function(_0x34e2fb,_0x26becd){var _0x43a3f4={},_0x525115={},_0x314e6f={'count':0x0,'rows':[]};var _0x5a38cc=_[_0x67cf('0x28')](db[_0x67cf('0x29')][_0x67cf('0x2a')],function(_0x5a7618){return{'name':_0x5a7618[_0x67cf('0x2b')],'type':_0x5a7618[_0x67cf('0x2c')][_0x67cf('0x2d')]};});_0x525115['model']=_[_0x67cf('0x28')](_0x5a38cc,_0x67cf('0x26'));_0x525115[_0x67cf('0x2e')]=_[_0x67cf('0x2f')](_0x34e2fb[_0x67cf('0x2e')]);_0x525115[_0x67cf('0x30')]=_[_0x67cf('0x31')](_0x525115['model'],_0x525115['query']);_0x43a3f4['attributes']=_[_0x67cf('0x31')](_0x525115[_0x67cf('0x32')],qs[_0x67cf('0x33')](_0x34e2fb[_0x67cf('0x2e')][_0x67cf('0x33')]));_0x43a3f4[_0x67cf('0x34')]=_0x43a3f4[_0x67cf('0x34')][_0x67cf('0x35')]?_0x43a3f4[_0x67cf('0x34')]:_0x525115['model'];if(!_0x34e2fb[_0x67cf('0x2e')][_0x67cf('0x36')]('nolimit')){_0x43a3f4[_0x67cf('0x37')]=qs[_0x67cf('0x37')](_0x34e2fb[_0x67cf('0x2e')][_0x67cf('0x37')]);_0x43a3f4[_0x67cf('0x1c')]=qs[_0x67cf('0x1c')](_0x34e2fb[_0x67cf('0x2e')][_0x67cf('0x1c')]);}_0x43a3f4['order']=qs['sort'](_0x34e2fb['query'][_0x67cf('0x38')]);_0x43a3f4[_0x67cf('0x39')]=qs[_0x67cf('0x30')](_['pick'](_0x34e2fb[_0x67cf('0x2e')],_0x525115[_0x67cf('0x30')]),_0x5a38cc);if(_0x34e2fb['query'][_0x67cf('0x3a')]){_0x43a3f4[_0x67cf('0x39')]=_[_0x67cf('0x3b')](_0x43a3f4[_0x67cf('0x39')],{'$or':_[_0x67cf('0x28')](_0x5a38cc,function(_0x5394d5){if(_0x5394d5[_0x67cf('0x2c')]!=='VIRTUAL'){var _0x3c3720={};_0x3c3720[_0x5394d5[_0x67cf('0x26')]]={'$like':'%'+_0x34e2fb[_0x67cf('0x2e')][_0x67cf('0x3a')]+'%'};return _0x3c3720;}})});}_0x43a3f4=_[_0x67cf('0x3b')]({},_0x43a3f4,_0x34e2fb[_0x67cf('0x3c')]);var _0x426f33={'where':_0x43a3f4[_0x67cf('0x39')]};return db[_0x67cf('0x29')][_0x67cf('0x1e')](_0x426f33)[_0x67cf('0x22')](function(_0x62923d){_0x314e6f[_0x67cf('0x1e')]=_0x62923d;if(_0x34e2fb[_0x67cf('0x2e')][_0x67cf('0x3d')]){_0x43a3f4[_0x67cf('0x3e')]=[{'all':!![]}];}return db[_0x67cf('0x29')][_0x67cf('0x3f')](_0x43a3f4);})[_0x67cf('0x22')](function(_0x3d4f99){_0x314e6f[_0x67cf('0x40')]=_0x3d4f99;return _0x314e6f;})[_0x67cf('0x22')](respondWithFilteredResult(_0x26becd,_0x43a3f4))[_0x67cf('0x41')](handleError(_0x26becd,null));};exports['show']=function(_0x4dee5b,_0x1b4f36){var _0x3cd582={'raw':!![],'where':{'id':_0x4dee5b['params']['id']}},_0x20c0c4={};_0x20c0c4[_0x67cf('0x32')]=_[_0x67cf('0x2f')](db[_0x67cf('0x29')][_0x67cf('0x2a')]);_0x20c0c4[_0x67cf('0x2e')]=_[_0x67cf('0x2f')](_0x4dee5b['query']);_0x20c0c4[_0x67cf('0x30')]=_['intersection'](_0x20c0c4['model'],_0x20c0c4[_0x67cf('0x2e')]);_0x3cd582[_0x67cf('0x34')]=_[_0x67cf('0x31')](_0x20c0c4[_0x67cf('0x32')],qs[_0x67cf('0x33')](_0x4dee5b['query'][_0x67cf('0x33')]));_0x3cd582['attributes']=_0x3cd582['attributes']['length']?_0x3cd582[_0x67cf('0x34')]:_0x20c0c4[_0x67cf('0x32')];if(_0x4dee5b[_0x67cf('0x2e')][_0x67cf('0x3d')]){_0x3cd582[_0x67cf('0x3e')]=[{'all':!![]}];}_0x3cd582=_[_0x67cf('0x3b')]({},_0x3cd582,_0x4dee5b[_0x67cf('0x3c')]);return db[_0x67cf('0x29')][_0x67cf('0x42')](_0x3cd582)[_0x67cf('0x22')](handleEntityNotFound(_0x1b4f36,null))[_0x67cf('0x22')](respondWithResult(_0x1b4f36,null))[_0x67cf('0x41')](handleError(_0x1b4f36,null));};exports[_0x67cf('0x43')]=function(_0x19414e,_0x2f59a2){return db[_0x67cf('0x29')][_0x67cf('0x43')](_0x19414e[_0x67cf('0x44')],{})[_0x67cf('0x22')](respondWithResult(_0x2f59a2,0xc9))[_0x67cf('0x41')](handleError(_0x2f59a2,null));};exports['update']=function(_0x451241,_0x1c4e3c){if(_0x451241[_0x67cf('0x44')]['id']){delete _0x451241[_0x67cf('0x44')]['id'];}return db[_0x67cf('0x29')]['find']({'where':{'id':_0x451241[_0x67cf('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c4e3c,null))[_0x67cf('0x22')](saveUpdates(_0x451241['body'],null))['then'](respondWithResult(_0x1c4e3c,null))[_0x67cf('0x41')](handleError(_0x1c4e3c,null));};exports['destroy']=function(_0x3031b8,_0x450e67){return db[_0x67cf('0x29')][_0x67cf('0x42')]({'where':{'id':_0x3031b8['params']['id']}})[_0x67cf('0x22')](handleEntityNotFound(_0x450e67,null))[_0x67cf('0x22')](removeEntity(_0x450e67,null))[_0x67cf('0x41')](handleError(_0x450e67,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index e1cc16d..b7b8c32 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 _0xcdd2=['int_freshsales_fields','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes','exports','define','FreshsalesField'];(function(_0x1cd7f1,_0x44236f){var _0x5adfde=function(_0x409537){while(--_0x409537){_0x1cd7f1['push'](_0x1cd7f1['shift']());}};_0x5adfde(++_0x44236f);}(_0xcdd2,0x83));var _0x2cdd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcdd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2cdd('0x0'));var util=require(_0x2cdd('0x1'));var logger=require(_0x2cdd('0x2'))(_0x2cdd('0x3'));var moment=require('moment');var BPromise=require(_0x2cdd('0x4'));var rp=require(_0x2cdd('0x5'));var fs=require('fs');var path=require(_0x2cdd('0x6'));var rimraf=require(_0x2cdd('0x7'));var config=require('../../config/environment');var attributes=require(_0x2cdd('0x8'));module[_0x2cdd('0x9')]=function(_0x5f3b53,_0x1cc1ac){return _0x5f3b53[_0x2cdd('0xa')](_0x2cdd('0xb'),attributes,{'tableName':_0x2cdd('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x566f=['FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','exports','define'];(function(_0x4b0c66,_0x1d53a8){var _0x8d9c34=function(_0x425d90){while(--_0x425d90){_0x4b0c66['push'](_0x4b0c66['shift']());}};_0x8d9c34(++_0x1d53a8);}(_0x566f,0x124));var _0xf566=function(_0x48b02c,_0x20e1ef){_0x48b02c=_0x48b02c-0x0;var _0x5d8dae=_0x566f[_0x48b02c];return _0x5d8dae;};'use strict';var _=require(_0xf566('0x0'));var util=require(_0xf566('0x1'));var logger=require(_0xf566('0x2'))(_0xf566('0x3'));var moment=require(_0xf566('0x4'));var BPromise=require(_0xf566('0x5'));var rp=require(_0xf566('0x6'));var fs=require('fs');var path=require(_0xf566('0x7'));var rimraf=require('rimraf');var config=require(_0xf566('0x8'));var attributes=require(_0xf566('0x9'));module[_0xf566('0xa')]=function(_0x117398,_0x5898ea){return _0x117398[_0xf566('0xb')](_0xf566('0xc'),attributes,{'tableName':_0xf566('0xd'),'paranoid':![],'indexes':[{'name':_0xf566('0xe'),'fields':['idField',_0xf566('0xf')],'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 110f661..b0251d9 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 _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3c307c,_0x1b06c4){var _0x32cf08=function(_0x371144){while(--_0x371144){_0x3c307c['push'](_0x3c307c['shift']());}};_0x32cf08(++_0x1b06c4);}(_0x5d17,0x114));var _0x75d1=function(_0x31d6c2,_0x422dcd){_0x31d6c2=_0x31d6c2-0x0;var _0x295dd0=_0x5d17[_0x31d6c2];return _0x295dd0;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x28741a,_0x58c5d2){var _0x103145=function(_0x336a63){while(--_0x336a63){_0x28741a['push'](_0x28741a['shift']());}};_0x103145(++_0x58c5d2);}(_0x2675,0x75));var _0x5267=function(_0x1d16c3,_0x3ad9c9){_0x1d16c3=_0x1d16c3-0x0;var _0x20b15a=_0x2675[_0x1d16c3];return _0x20b15a;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5096279..8f76890 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(_0x5b093d,_0x1ad1ae){var _0x12b8ea=function(_0x553acf){while(--_0x553acf){_0x5b093d['push'](_0x5b093d['shift']());}};_0x12b8ea(++_0x1ad1ae);}(_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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x46ef72,_0xe659ff){var _0x3f708f=function(_0x525a9a){while(--_0x525a9a){_0x46ef72['push'](_0x46ef72['shift']());}};_0x3f708f(++_0xe659ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 799ae21..f90ab8f 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 _0xaebd=['ENUM','newTab','integrationTab','sequelize','STRING','username'];(function(_0x1c3df7,_0x27c1f4){var _0x414eea=function(_0x56cc92){while(--_0x56cc92){_0x1c3df7['push'](_0x1c3df7['shift']());}};_0x414eea(++_0x27c1f4);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x534b5a,_0x2ed076){_0x534b5a=_0x534b5a-0x0;var _0x311184=_0xaebd[_0x534b5a];return _0x311184;};'use strict';var Sequelize=require(_0xdaeb('0x0'));module['exports']={'name':{'type':Sequelize[_0xdaeb('0x1')]},'description':{'type':Sequelize[_0xdaeb('0x1')]},'username':{'type':Sequelize[_0xdaeb('0x1')],'unique':_0xdaeb('0x2')},'remoteUri':{'type':Sequelize[_0xdaeb('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xdaeb('0x1')]},'clientSecret':{'type':Sequelize[_0xdaeb('0x1')]},'securityToken':{'type':Sequelize[_0xdaeb('0x1')]},'serverUrl':{'type':Sequelize[_0xdaeb('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xdaeb('0x3')]('integrationTab',_0xdaeb('0x4')),'defaultValue':_0xdaeb('0x5')}}; \ No newline at end of file +var _0x94c2=['integrationTab','exports','STRING','username'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x94c2,0x13d));var _0x294c=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x94c2[_0x279d37];return _0x530173;};'use strict';var Sequelize=require('sequelize');module[_0x294c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x294c('0x1')]},'username':{'type':Sequelize[_0x294c('0x1')],'unique':_0x294c('0x2')},'remoteUri':{'type':Sequelize[_0x294c('0x1')]},'password':{'type':Sequelize[_0x294c('0x1')]},'clientId':{'type':Sequelize[_0x294c('0x1')]},'clientSecret':{'type':Sequelize[_0x294c('0x1')]},'securityToken':{'type':Sequelize[_0x294c('0x1')]},'serverUrl':{'type':Sequelize[_0x294c('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x294c('0x3'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 0e37360..929e052 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 _0xf35d=['findAll','then','catch','show','params','includeAll','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','addConfiguration','Subjects','channel','Descriptions','SalesforceField','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','Connection','login','username','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','email','textarea','phone','name','includes','label','picklistValues','value','boolean','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xf35d,0x135));var _0xdf35=function(_0x3ee451,_0x2edd11){_0x3ee451=_0x3ee451-0x0;var _0x3de1cb=_0xf35d[_0x3ee451];return _0x3de1cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf35('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf35('0x1'));var moment=require(_0xdf35('0x2'));var BPromise=require(_0xdf35('0x3'));var Mustache=require('mustache');var util=require(_0xdf35('0x4'));var path=require(_0xdf35('0x5'));var sox=require(_0xdf35('0x6'));var csv=require(_0xdf35('0x7'));var ejs=require(_0xdf35('0x8'));var fs=require('fs');var fs_extra=require(_0xdf35('0x9'));var _=require(_0xdf35('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdf35('0xb'));var deskjs=require(_0xdf35('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdf35('0xd'));var Papa=require(_0xdf35('0xe'));var Redis=require('ioredis');var authService=require(_0xdf35('0xf'));var qs=require(_0xdf35('0x10'));var as=require(_0xdf35('0x11'));var hardwareService=require(_0xdf35('0x12'));var logger=require('../../config/logger')(_0xdf35('0x13'));var utils=require(_0xdf35('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xdf35('0x15'));var db=require(_0xdf35('0x16'))['db'];var integrations=require(_0xdf35('0x17'));function respondWithStatusCode(_0x5981bf,_0x5199dd){_0x5199dd=_0x5199dd||0xcc;return function(_0x151ccb){if(_0x151ccb){return _0x5981bf[_0xdf35('0x18')](_0x5199dd);}return _0x5981bf['status'](_0x5199dd)[_0xdf35('0x19')]();};}function respondWithResult(_0x45b9f6,_0x3ceb56){_0x3ceb56=_0x3ceb56||0xc8;return function(_0x559e40){if(_0x559e40){return _0x45b9f6[_0xdf35('0x1a')](_0x3ceb56)[_0xdf35('0x1b')](_0x559e40);}};}function respondWithFilteredResult(_0x17366d,_0x50821b){return function(_0x4e7875){if(_0x4e7875){var _0x4592f9=typeof _0x50821b[_0xdf35('0x1c')]===_0xdf35('0x1d')&&typeof _0x50821b[_0xdf35('0x1e')]===_0xdf35('0x1d');var _0x2dff6=_0x4e7875['count'];var _0x3e3227=_0x4592f9?0x0:_0x50821b[_0xdf35('0x1c')];var _0x4928cd=_0x4592f9?_0x4e7875[_0xdf35('0x1f')]:_0x50821b[_0xdf35('0x1c')]+_0x50821b[_0xdf35('0x1e')];var _0x3e5a3f;if(_0x4928cd>=_0x2dff6){_0x4928cd=_0x2dff6;_0x3e5a3f=0xc8;}else{_0x3e5a3f=0xce;}_0x17366d['status'](_0x3e5a3f);return _0x17366d[_0xdf35('0x20')](_0xdf35('0x21'),_0x3e3227+'-'+_0x4928cd+'/'+_0x2dff6)[_0xdf35('0x1b')](_0x4e7875);}return null;};}function patchUpdates(_0x48d4ae){return function(_0x52a061){try{jsonpatch[_0xdf35('0x22')](_0x52a061,_0x48d4ae,!![]);}catch(_0x4b550f){return BPromise['reject'](_0x4b550f);}return _0x52a061[_0xdf35('0x23')]();};}function saveUpdates(_0x11c9f6,_0x4d19b7){return function(_0xdf0ff7){if(_0xdf0ff7){return _0xdf0ff7[_0xdf35('0x24')](_0x11c9f6)['then'](function(_0x2dfa0b){return _0x2dfa0b;});}return null;};}function removeEntity(_0x1c96dd,_0x23d191){return function(_0x288907){if(_0x288907){return _0x288907[_0xdf35('0x25')]()['then'](function(){_0x1c96dd[_0xdf35('0x1a')](0xcc)[_0xdf35('0x19')]();});}};}function handleEntityNotFound(_0x518206,_0x177831){return function(_0x213d3a){if(!_0x213d3a){_0x518206[_0xdf35('0x18')](0x194);}return _0x213d3a;};}function handleError(_0x8e75d0,_0x5acf07){_0x5acf07=_0x5acf07||0x1f4;return function(_0xac31c3){logger[_0xdf35('0x26')](_0xac31c3[_0xdf35('0x27')]);if(_0xac31c3['name']){delete _0xac31c3['name'];}_0x8e75d0[_0xdf35('0x1a')](_0x5acf07)[_0xdf35('0x28')](_0xac31c3);};}exports[_0xdf35('0x29')]=function(_0x284c2f,_0x5c59f1){var _0x27bb4f={},_0x2e00ce={},_0x13c39d={'count':0x0,'rows':[]};var _0x8444d0=_[_0xdf35('0x2a')](db[_0xdf35('0x2b')][_0xdf35('0x2c')],function(_0x3967be){return{'name':_0x3967be[_0xdf35('0x2d')],'type':_0x3967be[_0xdf35('0x2e')][_0xdf35('0x2f')]};});_0x2e00ce['model']=_[_0xdf35('0x2a')](_0x8444d0,'name');_0x2e00ce['query']=_[_0xdf35('0x30')](_0x284c2f[_0xdf35('0x31')]);_0x2e00ce[_0xdf35('0x32')]=_[_0xdf35('0x33')](_0x2e00ce[_0xdf35('0x34')],_0x2e00ce[_0xdf35('0x31')]);_0x27bb4f[_0xdf35('0x35')]=_[_0xdf35('0x33')](_0x2e00ce[_0xdf35('0x34')],qs[_0xdf35('0x36')](_0x284c2f[_0xdf35('0x31')]['fields']));_0x27bb4f['attributes']=_0x27bb4f[_0xdf35('0x35')][_0xdf35('0x37')]?_0x27bb4f['attributes']:_0x2e00ce['model'];if(!_0x284c2f[_0xdf35('0x31')]['hasOwnProperty'](_0xdf35('0x38'))){_0x27bb4f[_0xdf35('0x1e')]=qs[_0xdf35('0x1e')](_0x284c2f[_0xdf35('0x31')][_0xdf35('0x1e')]);_0x27bb4f[_0xdf35('0x1c')]=qs[_0xdf35('0x1c')](_0x284c2f[_0xdf35('0x31')][_0xdf35('0x1c')]);}_0x27bb4f['order']=qs['sort'](_0x284c2f['query'][_0xdf35('0x39')]);_0x27bb4f[_0xdf35('0x3a')]=qs[_0xdf35('0x32')](_[_0xdf35('0x3b')](_0x284c2f['query'],_0x2e00ce[_0xdf35('0x32')]),_0x8444d0);if(_0x284c2f[_0xdf35('0x31')][_0xdf35('0x3c')]){_0x27bb4f[_0xdf35('0x3a')]=_[_0xdf35('0x3d')](_0x27bb4f[_0xdf35('0x3a')],{'$or':_[_0xdf35('0x2a')](_0x8444d0,function(_0x2750f2){if(_0x2750f2[_0xdf35('0x2e')]!=='VIRTUAL'){var _0x23639b={};_0x23639b[_0x2750f2['name']]={'$like':'%'+_0x284c2f[_0xdf35('0x31')][_0xdf35('0x3c')]+'%'};return _0x23639b;}})});}_0x27bb4f=_['merge']({},_0x27bb4f,_0x284c2f[_0xdf35('0x3e')]);var _0x40a0d7={'where':_0x27bb4f[_0xdf35('0x3a')]};return db[_0xdf35('0x2b')][_0xdf35('0x1f')](_0x40a0d7)['then'](function(_0x55eded){_0x13c39d[_0xdf35('0x1f')]=_0x55eded;if(_0x284c2f['query']['includeAll']){_0x27bb4f['include']=[{'all':!![]}];}return db[_0xdf35('0x2b')][_0xdf35('0x3f')](_0x27bb4f);})[_0xdf35('0x40')](function(_0x132696){_0x13c39d['rows']=_0x132696;return _0x13c39d;})[_0xdf35('0x40')](respondWithFilteredResult(_0x5c59f1,_0x27bb4f))[_0xdf35('0x41')](handleError(_0x5c59f1,null));};exports[_0xdf35('0x42')]=function(_0x6c716e,_0x23e9d5){var _0x9b4d50={'raw':![],'where':{'id':_0x6c716e[_0xdf35('0x43')]['id']}},_0x45a7c6={};_0x45a7c6[_0xdf35('0x34')]=_[_0xdf35('0x30')](db[_0xdf35('0x2b')][_0xdf35('0x2c')]);_0x45a7c6[_0xdf35('0x31')]=_[_0xdf35('0x30')](_0x6c716e[_0xdf35('0x31')]);_0x45a7c6[_0xdf35('0x32')]=_[_0xdf35('0x33')](_0x45a7c6[_0xdf35('0x34')],_0x45a7c6[_0xdf35('0x31')]);_0x9b4d50[_0xdf35('0x35')]=_[_0xdf35('0x33')](_0x45a7c6[_0xdf35('0x34')],qs[_0xdf35('0x36')](_0x6c716e[_0xdf35('0x31')]['fields']));_0x9b4d50[_0xdf35('0x35')]=_0x9b4d50[_0xdf35('0x35')]['length']?_0x9b4d50[_0xdf35('0x35')]:_0x45a7c6[_0xdf35('0x34')];if(_0x6c716e[_0xdf35('0x31')][_0xdf35('0x44')]){_0x9b4d50['include']=[{'all':!![]}];}_0x9b4d50=_[_0xdf35('0x3d')]({},_0x9b4d50,_0x6c716e[_0xdf35('0x3e')]);return db[_0xdf35('0x2b')][_0xdf35('0x45')](_0x9b4d50)[_0xdf35('0x40')](handleEntityNotFound(_0x23e9d5,null))['then'](respondWithResult(_0x23e9d5,null))[_0xdf35('0x41')](handleError(_0x23e9d5,null));};exports[_0xdf35('0x46')]=function(_0x30445b,_0x55030d){return db['SalesforceAccount'][_0xdf35('0x46')](_0x30445b[_0xdf35('0x47')],{})['then'](respondWithResult(_0x55030d,0xc9))[_0xdf35('0x41')](handleError(_0x55030d,null));};exports[_0xdf35('0x24')]=function(_0x25d7bd,_0x2f0c20){if(_0x25d7bd[_0xdf35('0x47')]['id']){delete _0x25d7bd[_0xdf35('0x47')]['id'];}return db[_0xdf35('0x2b')][_0xdf35('0x45')]({'where':{'id':_0x25d7bd[_0xdf35('0x43')]['id']}})['then'](handleEntityNotFound(_0x2f0c20,null))[_0xdf35('0x40')](saveUpdates(_0x25d7bd[_0xdf35('0x47')],null))['then'](respondWithResult(_0x2f0c20,null))[_0xdf35('0x41')](handleError(_0x2f0c20,null));};exports[_0xdf35('0x25')]=function(_0x1c1efb,_0x237fee){return db[_0xdf35('0x2b')][_0xdf35('0x45')]({'where':{'id':_0x1c1efb[_0xdf35('0x43')]['id']}})['then'](handleEntityNotFound(_0x237fee,null))['then'](removeEntity(_0x237fee,null))[_0xdf35('0x41')](handleError(_0x237fee,null));};exports[_0xdf35('0x48')]=function(_0x502557,_0x5278a3,_0x3b9bef){var _0x9892e2={};var _0x1b9d02={};var _0x38aca4;var _0x3cdf4b;return db[_0xdf35('0x2b')][_0xdf35('0x49')]({'where':{'id':_0x502557[_0xdf35('0x43')]['id']}})['then'](handleEntityNotFound(_0x5278a3,null))['then'](function(_0x453366){if(_0x453366){_0x38aca4=_0x453366;_0x1b9d02[_0xdf35('0x34')]=_[_0xdf35('0x30')](db[_0xdf35('0x4a')][_0xdf35('0x2c')]);_0x1b9d02['query']=_[_0xdf35('0x30')](_0x502557[_0xdf35('0x31')]);_0x1b9d02[_0xdf35('0x32')]=_[_0xdf35('0x33')](_0x1b9d02[_0xdf35('0x34')],_0x1b9d02[_0xdf35('0x31')]);_0x9892e2[_0xdf35('0x35')]=_[_0xdf35('0x33')](_0x1b9d02[_0xdf35('0x34')],qs[_0xdf35('0x36')](_0x502557[_0xdf35('0x31')][_0xdf35('0x36')]));_0x9892e2['attributes']=_0x9892e2[_0xdf35('0x35')][_0xdf35('0x37')]?_0x9892e2['attributes']:_0x1b9d02[_0xdf35('0x34')];_0x9892e2[_0xdf35('0x4b')]=qs[_0xdf35('0x39')](_0x502557[_0xdf35('0x31')][_0xdf35('0x39')]);_0x9892e2[_0xdf35('0x3a')]=qs['filters'](_['pick'](_0x502557[_0xdf35('0x31')],_0x1b9d02[_0xdf35('0x32')]));if(_0x502557[_0xdf35('0x31')][_0xdf35('0x3c')]){_0x9892e2[_0xdf35('0x3a')]=_['merge'](_0x9892e2[_0xdf35('0x3a')],{'$or':_[_0xdf35('0x2a')](_0x9892e2[_0xdf35('0x35')],function(_0x230f4e){var _0xc2ffbf={};_0xc2ffbf[_0x230f4e]={'$like':'%'+_0x502557[_0xdf35('0x31')][_0xdf35('0x3c')]+'%'};return _0xc2ffbf;})});}_0x9892e2=_[_0xdf35('0x3d')]({},_0x9892e2,_0x502557[_0xdf35('0x3e')]);return _0x38aca4[_0xdf35('0x48')](_0x9892e2);}})[_0xdf35('0x40')](function(_0x72b6f5){if(_0x72b6f5){_0x3cdf4b=_0x72b6f5[_0xdf35('0x37')];if(!_0x502557[_0xdf35('0x31')]['hasOwnProperty'](_0xdf35('0x38'))){_0x9892e2[_0xdf35('0x1e')]=qs[_0xdf35('0x1e')](_0x502557[_0xdf35('0x31')]['limit']);_0x9892e2[_0xdf35('0x1c')]=qs[_0xdf35('0x1c')](_0x502557[_0xdf35('0x31')]['offset']);}return _0x38aca4['getConfigurations'](_0x9892e2);}})['then'](function(_0x36b3c7){if(_0x36b3c7){return _0x36b3c7?{'count':_0x3cdf4b,'rows':_0x36b3c7}:null;}})['then'](respondWithResult(_0x5278a3,null))[_0xdf35('0x41')](handleError(_0x5278a3,null));};exports[_0xdf35('0x4c')]=function(_0x5af98b,_0x12664e,_0x313be5){if(_0x5af98b['body']['id']){delete _0x5af98b['body']['id'];}return db[_0xdf35('0x2b')][_0xdf35('0x49')]({'where':{'id':_0x5af98b[_0xdf35('0x43')]['id']}})[_0xdf35('0x40')](handleEntityNotFound(_0x12664e,null))[_0xdf35('0x40')](function(_0x419456){if(_0x419456){_0x5af98b['body']['AccountId']=_0x419456['id'];_0x5af98b[_0xdf35('0x47')][_0xdf35('0x4d')]=integrations['getSubjects'](_0x5af98b['body'][_0xdf35('0x4e')],_0x5af98b[_0xdf35('0x47')][_0xdf35('0x2e')]);_0x5af98b['body'][_0xdf35('0x4f')]=integrations['getDescriptions'](_0x5af98b[_0xdf35('0x47')]['channel'],_0x5af98b['body'][_0xdf35('0x2e')]);return db[_0xdf35('0x4a')][_0xdf35('0x46')](_0x5af98b[_0xdf35('0x47')],{'include':[{'model':db[_0xdf35('0x50')],'as':_0xdf35('0x4d')},{'model':db[_0xdf35('0x50')],'as':_0xdf35('0x4f')}]});}return null;})[_0xdf35('0x40')](respondWithResult(_0x12664e,null))[_0xdf35('0x41')](handleError(_0x12664e,null));};exports['getFields']=function(_0x5b3275,_0x587e39,_0x411ef4){var _0x4abba9;var _0x2c4e3e='';var _0x362127=_0xdf35('0x51');return db[_0xdf35('0x2b')][_0xdf35('0x49')]({'where':{'id':_0x5b3275['params']['id']},'attributes':['id',_0xdf35('0x52'),_0xdf35('0x53'),_0xdf35('0x54'),'username',_0xdf35('0x55'),_0xdf35('0x56')]})[_0xdf35('0x40')](handleEntityNotFound(_0x587e39,null))[_0xdf35('0x40')](function(_0x39c02b){if(_0x39c02b){_0x2c4e3e=_0x39c02b[_0xdf35('0x52')];var _0x25dd12=_0x2c4e3e['slice'](-0x1);if(_0x25dd12==='/'){_0x2c4e3e=_0x2c4e3e[_0xdf35('0x57')](0x0,_0x2c4e3e['lastIndexOf'](_0x25dd12));}_0x4abba9=new jsforce[(_0xdf35('0x58'))]({'oauth2':{'loginUrl':_0x2c4e3e,'clientId':_0x39c02b[_0xdf35('0x53')],'clientSecret':_0x39c02b['clientSecret']}});return _0x4abba9[_0xdf35('0x59')](_0x39c02b[_0xdf35('0x5a')],_0x39c02b[_0xdf35('0x55')][_0xdf35('0x5b')](_0x39c02b[_0xdf35('0x56')]));}})['then'](function(_0x14c502){if(_0x14c502){if(!_[_0xdf35('0x5c')](_0x5b3275[_0xdf35('0x31')]['ticketType'])){_0x362127=_0x5b3275[_0xdf35('0x31')][_0xdf35('0x5d')];}return _0x4abba9[_0xdf35('0x5e')](_0x362127)[_0xdf35('0x5f')]();}})['then'](function(_0x2fda3c){var _0x5ea5f3=[_0xdf35('0x60'),_0xdf35('0x61'),_0xdf35('0x62'),_0xdf35('0x63'),_0xdf35('0x64'),_0xdf35('0x65')];var _0x8c6d02=[_0xdf35('0x66'),_0xdf35('0x67'),_0xdf35('0x68'),'boolean',_0xdf35('0x69'),_0xdf35('0x6a'),_0xdf35('0x6b')];if(_0x2fda3c){_['remove'](_0x2fda3c['fields'],function(_0x1475c6){return _0x5ea5f3['includes'](_0x1475c6[_0xdf35('0x6c')])||!_0x8c6d02[_0xdf35('0x6d')](_0x1475c6[_0xdf35('0x2e')]);});return{'count':_0x2fda3c[_0xdf35('0x36')][_0xdf35('0x37')],'rows':_[_0xdf35('0x2a')](_0x2fda3c['fields'],function(_0x53f930){return{'id':_0x53f930[_0xdf35('0x6c')],'name':_0x53f930[_0xdf35('0x6e')],'custom':_0x53f930['custom'],'options':_0x53f930[_0xdf35('0x6f')][_0xdf35('0x37')]>0x0?_[_0xdf35('0x2a')](_0x53f930[_0xdf35('0x6f')],function(_0x294dc1){return{'name':_0x294dc1[_0xdf35('0x6e')],'value':_0x294dc1[_0xdf35('0x70')]};}):_0x53f930[_0xdf35('0x2e')]==_0xdf35('0x71')?[{'name':_0xdf35('0x72'),'value':_0xdf35('0x73')},{'name':_0xdf35('0x74'),'value':_0xdf35('0x75')}]:[]};})};}})[_0xdf35('0x40')](respondWithResult(_0x587e39,null))[_0xdf35('0x41')](function(_0xd672e1){var _0x2cfec4=_0x5b3275[_0xdf35('0x31')][_0xdf35('0x76')]?0x1f4:_0xd672e1[_0xdf35('0x77')]||0x1f4;logger[_0xdf35('0x26')](_0xdf35('0x78'),_0xdf35('0x79'),_0x2cfec4,JSON[_0xdf35('0x7a')](_0xd672e1));delete _0xd672e1[_0xdf35('0x6c')];if(_0x2cfec4===0x191){_0x2cfec4=0x190;}_0x587e39[_0xdf35('0x1a')](_0x2cfec4)[_0xdf35('0x28')](_0x5b3275[_0xdf35('0x31')][_0xdf35('0x76')]?{'message':_0xdf35('0x7b'),'statusCode':_0xd672e1['statusCode']}:_0xd672e1);});}; \ No newline at end of file +var _0xe577=['filters','filter','merge','options','count','includeAll','include','findAll','rows','catch','fields','create','body','params','find','getConfigurations','findOne','SalesforceConfiguration','Subjects','getDescriptions','channel','SalesforceField','Descriptions','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','apply','reject','save','then','destroy','error','name','send','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x2bca1f,_0x430789){var _0x802033=function(_0x1fdaaf){while(--_0x1fdaaf){_0x2bca1f['push'](_0x2bca1f['shift']());}};_0x802033(++_0x430789);}(_0xe577,0xb6));var _0x7e57=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xe577[_0x550d12];return _0x12103d;};'use strict';var emlformat=require(_0x7e57('0x0'));var rimraf=require(_0x7e57('0x1'));var zipdir=require(_0x7e57('0x2'));var jsonpatch=require(_0x7e57('0x3'));var rp=require('request-promise');var moment=require(_0x7e57('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7e57('0x5'));var path=require('path');var sox=require(_0x7e57('0x6'));var csv=require('to-csv');var ejs=require(_0x7e57('0x7'));var fs=require('fs');var fs_extra=require(_0x7e57('0x8'));var _=require(_0x7e57('0x9'));var squel=require(_0x7e57('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7e57('0xb'));var toCsv=require(_0x7e57('0xc'));var querystring=require(_0x7e57('0xd'));var Papa=require(_0x7e57('0xe'));var Redis=require(_0x7e57('0xf'));var authService=require(_0x7e57('0x10'));var qs=require(_0x7e57('0x11'));var as=require(_0x7e57('0x12'));var hardwareService=require(_0x7e57('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7e57('0x14'));var config=require(_0x7e57('0x15'));var licenseUtil=require(_0x7e57('0x16'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7a2eef,_0x46cd7e){_0x46cd7e=_0x46cd7e||0xcc;return function(_0x1e6cdc){if(_0x1e6cdc){return _0x7a2eef[_0x7e57('0x17')](_0x46cd7e);}return _0x7a2eef['status'](_0x46cd7e)[_0x7e57('0x18')]();};}function respondWithResult(_0x2c442b,_0x3dd233){_0x3dd233=_0x3dd233||0xc8;return function(_0x483b46){if(_0x483b46){return _0x2c442b[_0x7e57('0x19')](_0x3dd233)[_0x7e57('0x1a')](_0x483b46);}};}function respondWithFilteredResult(_0x3d084f,_0xd55ca5){return function(_0x2f45a8){if(_0x2f45a8){var _0xa0e939=typeof _0xd55ca5[_0x7e57('0x1b')]===_0x7e57('0x1c')&&typeof _0xd55ca5[_0x7e57('0x1d')]==='undefined';var _0x2ff8ca=_0x2f45a8['count'];var _0xdb7e7f=_0xa0e939?0x0:_0xd55ca5[_0x7e57('0x1b')];var _0x1d3d38=_0xa0e939?_0x2f45a8['count']:_0xd55ca5[_0x7e57('0x1b')]+_0xd55ca5[_0x7e57('0x1d')];var _0x279f8e;if(_0x1d3d38>=_0x2ff8ca){_0x1d3d38=_0x2ff8ca;_0x279f8e=0xc8;}else{_0x279f8e=0xce;}_0x3d084f['status'](_0x279f8e);return _0x3d084f[_0x7e57('0x1e')]('Content-Range',_0xdb7e7f+'-'+_0x1d3d38+'/'+_0x2ff8ca)['json'](_0x2f45a8);}return null;};}function patchUpdates(_0x5a2878){return function(_0x56b9cc){try{jsonpatch[_0x7e57('0x1f')](_0x56b9cc,_0x5a2878,!![]);}catch(_0x251640){return BPromise[_0x7e57('0x20')](_0x251640);}return _0x56b9cc[_0x7e57('0x21')]();};}function saveUpdates(_0x3d183a,_0x3a0792){return function(_0x331d3a){if(_0x331d3a){return _0x331d3a['update'](_0x3d183a)[_0x7e57('0x22')](function(_0xcaa95c){return _0xcaa95c;});}return null;};}function removeEntity(_0x34abc0,_0x5d80fd){return function(_0x224e59){if(_0x224e59){return _0x224e59[_0x7e57('0x23')]()[_0x7e57('0x22')](function(){_0x34abc0['status'](0xcc)[_0x7e57('0x18')]();});}};}function handleEntityNotFound(_0x2fd5f9,_0x5e28fb){return function(_0x14f179){if(!_0x14f179){_0x2fd5f9[_0x7e57('0x17')](0x194);}return _0x14f179;};}function handleError(_0x521564,_0x22203a){_0x22203a=_0x22203a||0x1f4;return function(_0x498e13){logger[_0x7e57('0x24')](_0x498e13['stack']);if(_0x498e13['name']){delete _0x498e13[_0x7e57('0x25')];}_0x521564[_0x7e57('0x19')](_0x22203a)[_0x7e57('0x26')](_0x498e13);};}exports['index']=function(_0x3977a3,_0xfcb027){var _0x5cfe7b={},_0x18fe86={},_0x3fa8d1={'count':0x0,'rows':[]};var _0x331539=_[_0x7e57('0x27')](db[_0x7e57('0x28')][_0x7e57('0x29')],function(_0x17c822){return{'name':_0x17c822[_0x7e57('0x2a')],'type':_0x17c822[_0x7e57('0x2b')][_0x7e57('0x2c')]};});_0x18fe86[_0x7e57('0x2d')]=_[_0x7e57('0x27')](_0x331539,_0x7e57('0x25'));_0x18fe86[_0x7e57('0x2e')]=_[_0x7e57('0x2f')](_0x3977a3['query']);_0x18fe86['filters']=_['intersection'](_0x18fe86[_0x7e57('0x2d')],_0x18fe86[_0x7e57('0x2e')]);_0x5cfe7b[_0x7e57('0x30')]=_[_0x7e57('0x31')](_0x18fe86[_0x7e57('0x2d')],qs['fields'](_0x3977a3[_0x7e57('0x2e')]['fields']));_0x5cfe7b[_0x7e57('0x30')]=_0x5cfe7b[_0x7e57('0x30')][_0x7e57('0x32')]?_0x5cfe7b[_0x7e57('0x30')]:_0x18fe86[_0x7e57('0x2d')];if(!_0x3977a3[_0x7e57('0x2e')][_0x7e57('0x33')](_0x7e57('0x34'))){_0x5cfe7b['limit']=qs['limit'](_0x3977a3[_0x7e57('0x2e')]['limit']);_0x5cfe7b['offset']=qs['offset'](_0x3977a3['query']['offset']);}_0x5cfe7b[_0x7e57('0x35')]=qs[_0x7e57('0x36')](_0x3977a3[_0x7e57('0x2e')][_0x7e57('0x36')]);_0x5cfe7b[_0x7e57('0x37')]=qs[_0x7e57('0x38')](_['pick'](_0x3977a3[_0x7e57('0x2e')],_0x18fe86['filters']),_0x331539);if(_0x3977a3[_0x7e57('0x2e')]['filter']){_0x5cfe7b[_0x7e57('0x37')]=_['merge'](_0x5cfe7b[_0x7e57('0x37')],{'$or':_[_0x7e57('0x27')](_0x331539,function(_0x4606b9){if(_0x4606b9[_0x7e57('0x2b')]!=='VIRTUAL'){var _0x32df96={};_0x32df96[_0x4606b9[_0x7e57('0x25')]]={'$like':'%'+_0x3977a3[_0x7e57('0x2e')][_0x7e57('0x39')]+'%'};return _0x32df96;}})});}_0x5cfe7b=_[_0x7e57('0x3a')]({},_0x5cfe7b,_0x3977a3[_0x7e57('0x3b')]);var _0x807cc5={'where':_0x5cfe7b[_0x7e57('0x37')]};return db['SalesforceAccount'][_0x7e57('0x3c')](_0x807cc5)['then'](function(_0x300289){_0x3fa8d1[_0x7e57('0x3c')]=_0x300289;if(_0x3977a3[_0x7e57('0x2e')][_0x7e57('0x3d')]){_0x5cfe7b[_0x7e57('0x3e')]=[{'all':!![]}];}return db[_0x7e57('0x28')][_0x7e57('0x3f')](_0x5cfe7b);})['then'](function(_0x3c717d){_0x3fa8d1[_0x7e57('0x40')]=_0x3c717d;return _0x3fa8d1;})[_0x7e57('0x22')](respondWithFilteredResult(_0xfcb027,_0x5cfe7b))[_0x7e57('0x41')](handleError(_0xfcb027,null));};exports['show']=function(_0x244dfc,_0x330f1d){var _0x1f07a3={'raw':![],'where':{'id':_0x244dfc['params']['id']}},_0x4bbb04={};_0x4bbb04[_0x7e57('0x2d')]=_[_0x7e57('0x2f')](db[_0x7e57('0x28')][_0x7e57('0x29')]);_0x4bbb04[_0x7e57('0x2e')]=_[_0x7e57('0x2f')](_0x244dfc[_0x7e57('0x2e')]);_0x4bbb04['filters']=_['intersection'](_0x4bbb04[_0x7e57('0x2d')],_0x4bbb04['query']);_0x1f07a3[_0x7e57('0x30')]=_[_0x7e57('0x31')](_0x4bbb04[_0x7e57('0x2d')],qs[_0x7e57('0x42')](_0x244dfc[_0x7e57('0x2e')][_0x7e57('0x42')]));_0x1f07a3[_0x7e57('0x30')]=_0x1f07a3[_0x7e57('0x30')]['length']?_0x1f07a3[_0x7e57('0x30')]:_0x4bbb04['model'];if(_0x244dfc['query'][_0x7e57('0x3d')]){_0x1f07a3[_0x7e57('0x3e')]=[{'all':!![]}];}_0x1f07a3=_[_0x7e57('0x3a')]({},_0x1f07a3,_0x244dfc[_0x7e57('0x3b')]);return db[_0x7e57('0x28')]['find'](_0x1f07a3)['then'](handleEntityNotFound(_0x330f1d,null))[_0x7e57('0x22')](respondWithResult(_0x330f1d,null))[_0x7e57('0x41')](handleError(_0x330f1d,null));};exports[_0x7e57('0x43')]=function(_0x42f6d4,_0x295611){return db[_0x7e57('0x28')][_0x7e57('0x43')](_0x42f6d4['body'],{})[_0x7e57('0x22')](respondWithResult(_0x295611,0xc9))[_0x7e57('0x41')](handleError(_0x295611,null));};exports['update']=function(_0x3f6593,_0x5ed661){if(_0x3f6593[_0x7e57('0x44')]['id']){delete _0x3f6593[_0x7e57('0x44')]['id'];}return db[_0x7e57('0x28')]['find']({'where':{'id':_0x3f6593[_0x7e57('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ed661,null))[_0x7e57('0x22')](saveUpdates(_0x3f6593[_0x7e57('0x44')],null))[_0x7e57('0x22')](respondWithResult(_0x5ed661,null))['catch'](handleError(_0x5ed661,null));};exports[_0x7e57('0x23')]=function(_0xcca672,_0x3a28ac){return db[_0x7e57('0x28')][_0x7e57('0x46')]({'where':{'id':_0xcca672[_0x7e57('0x45')]['id']}})[_0x7e57('0x22')](handleEntityNotFound(_0x3a28ac,null))['then'](removeEntity(_0x3a28ac,null))[_0x7e57('0x41')](handleError(_0x3a28ac,null));};exports[_0x7e57('0x47')]=function(_0x4134ea,_0x296996,_0x29cc17){var _0x294aa8={};var _0xd2dae1={};var _0x43caa1;var _0x54ab4d;return db[_0x7e57('0x28')][_0x7e57('0x48')]({'where':{'id':_0x4134ea['params']['id']}})[_0x7e57('0x22')](handleEntityNotFound(_0x296996,null))[_0x7e57('0x22')](function(_0x1e0f4a){if(_0x1e0f4a){_0x43caa1=_0x1e0f4a;_0xd2dae1[_0x7e57('0x2d')]=_['keys'](db[_0x7e57('0x49')][_0x7e57('0x29')]);_0xd2dae1[_0x7e57('0x2e')]=_[_0x7e57('0x2f')](_0x4134ea[_0x7e57('0x2e')]);_0xd2dae1['filters']=_[_0x7e57('0x31')](_0xd2dae1[_0x7e57('0x2d')],_0xd2dae1[_0x7e57('0x2e')]);_0x294aa8[_0x7e57('0x30')]=_[_0x7e57('0x31')](_0xd2dae1['model'],qs['fields'](_0x4134ea['query'][_0x7e57('0x42')]));_0x294aa8['attributes']=_0x294aa8[_0x7e57('0x30')][_0x7e57('0x32')]?_0x294aa8[_0x7e57('0x30')]:_0xd2dae1[_0x7e57('0x2d')];_0x294aa8['order']=qs['sort'](_0x4134ea[_0x7e57('0x2e')]['sort']);_0x294aa8[_0x7e57('0x37')]=qs[_0x7e57('0x38')](_['pick'](_0x4134ea[_0x7e57('0x2e')],_0xd2dae1[_0x7e57('0x38')]));if(_0x4134ea['query'][_0x7e57('0x39')]){_0x294aa8['where']=_[_0x7e57('0x3a')](_0x294aa8[_0x7e57('0x37')],{'$or':_['map'](_0x294aa8[_0x7e57('0x30')],function(_0x3566ba){var _0x4bcaa5={};_0x4bcaa5[_0x3566ba]={'$like':'%'+_0x4134ea[_0x7e57('0x2e')][_0x7e57('0x39')]+'%'};return _0x4bcaa5;})});}_0x294aa8=_[_0x7e57('0x3a')]({},_0x294aa8,_0x4134ea[_0x7e57('0x3b')]);return _0x43caa1['getConfigurations'](_0x294aa8);}})[_0x7e57('0x22')](function(_0x179dd2){if(_0x179dd2){_0x54ab4d=_0x179dd2['length'];if(!_0x4134ea[_0x7e57('0x2e')][_0x7e57('0x33')](_0x7e57('0x34'))){_0x294aa8[_0x7e57('0x1d')]=qs[_0x7e57('0x1d')](_0x4134ea[_0x7e57('0x2e')][_0x7e57('0x1d')]);_0x294aa8['offset']=qs[_0x7e57('0x1b')](_0x4134ea[_0x7e57('0x2e')][_0x7e57('0x1b')]);}return _0x43caa1[_0x7e57('0x47')](_0x294aa8);}})[_0x7e57('0x22')](function(_0x38af5b){if(_0x38af5b){return _0x38af5b?{'count':_0x54ab4d,'rows':_0x38af5b}:null;}})[_0x7e57('0x22')](respondWithResult(_0x296996,null))['catch'](handleError(_0x296996,null));};exports['addConfiguration']=function(_0x2ca4a4,_0x42881f,_0x5e680a){if(_0x2ca4a4[_0x7e57('0x44')]['id']){delete _0x2ca4a4[_0x7e57('0x44')]['id'];}return db[_0x7e57('0x28')][_0x7e57('0x48')]({'where':{'id':_0x2ca4a4['params']['id']}})['then'](handleEntityNotFound(_0x42881f,null))[_0x7e57('0x22')](function(_0x44703b){if(_0x44703b){_0x2ca4a4['body']['AccountId']=_0x44703b['id'];_0x2ca4a4[_0x7e57('0x44')][_0x7e57('0x4a')]=integrations['getSubjects'](_0x2ca4a4[_0x7e57('0x44')]['channel'],_0x2ca4a4['body'][_0x7e57('0x2b')]);_0x2ca4a4['body']['Descriptions']=integrations[_0x7e57('0x4b')](_0x2ca4a4[_0x7e57('0x44')][_0x7e57('0x4c')],_0x2ca4a4['body'][_0x7e57('0x2b')]);return db['SalesforceConfiguration'][_0x7e57('0x43')](_0x2ca4a4[_0x7e57('0x44')],{'include':[{'model':db['SalesforceField'],'as':'Subjects'},{'model':db[_0x7e57('0x4d')],'as':_0x7e57('0x4e')}]});}return null;})[_0x7e57('0x22')](respondWithResult(_0x42881f,null))[_0x7e57('0x41')](handleError(_0x42881f,null));};exports['getFields']=function(_0x315455,_0x4b4a5b,_0xc74782){var _0x285406;var _0x2d218b='';var _0x2b33a3=_0x7e57('0x4f');return db[_0x7e57('0x28')][_0x7e57('0x48')]({'where':{'id':_0x315455[_0x7e57('0x45')]['id']},'attributes':['id','remoteUri',_0x7e57('0x50'),_0x7e57('0x51'),_0x7e57('0x52'),_0x7e57('0x53'),_0x7e57('0x54')]})[_0x7e57('0x22')](handleEntityNotFound(_0x4b4a5b,null))[_0x7e57('0x22')](function(_0x549511){if(_0x549511){_0x2d218b=_0x549511[_0x7e57('0x55')];var _0x11316d=_0x2d218b[_0x7e57('0x56')](-0x1);if(_0x11316d==='/'){_0x2d218b=_0x2d218b[_0x7e57('0x57')](0x0,_0x2d218b[_0x7e57('0x58')](_0x11316d));}_0x285406=new jsforce[(_0x7e57('0x59'))]({'oauth2':{'loginUrl':_0x2d218b,'clientId':_0x549511[_0x7e57('0x50')],'clientSecret':_0x549511['clientSecret']}});return _0x285406[_0x7e57('0x5a')](_0x549511[_0x7e57('0x52')],_0x549511['password'][_0x7e57('0x5b')](_0x549511[_0x7e57('0x54')]));}})[_0x7e57('0x22')](function(_0xca5cc9){if(_0xca5cc9){if(!_[_0x7e57('0x5c')](_0x315455[_0x7e57('0x2e')][_0x7e57('0x5d')])){_0x2b33a3=_0x315455['query']['ticketType'];}return _0x285406[_0x7e57('0x5e')](_0x2b33a3)['describe']();}})['then'](function(_0x13d349){var _0x499b4c=[_0x7e57('0x5f'),_0x7e57('0x60'),_0x7e57('0x61'),_0x7e57('0x62'),_0x7e57('0x63'),_0x7e57('0x64')];var _0x5529b4=['string',_0x7e57('0x65'),_0x7e57('0x66'),_0x7e57('0x67'),_0x7e57('0x68'),_0x7e57('0x69'),_0x7e57('0x6a')];if(_0x13d349){_[_0x7e57('0x6b')](_0x13d349[_0x7e57('0x42')],function(_0x4e865e){return _0x499b4c[_0x7e57('0x6c')](_0x4e865e[_0x7e57('0x25')])||!_0x5529b4[_0x7e57('0x6c')](_0x4e865e[_0x7e57('0x2b')]);});return{'count':_0x13d349['fields'][_0x7e57('0x32')],'rows':_[_0x7e57('0x27')](_0x13d349[_0x7e57('0x42')],function(_0x44127d){return{'id':_0x44127d['name'],'name':_0x44127d[_0x7e57('0x6d')],'custom':_0x44127d[_0x7e57('0x6e')],'options':_0x44127d[_0x7e57('0x6f')][_0x7e57('0x32')]>0x0?_[_0x7e57('0x27')](_0x44127d['picklistValues'],function(_0x43e20f){return{'name':_0x43e20f[_0x7e57('0x6d')],'value':_0x43e20f['value']};}):_0x44127d['type']==_0x7e57('0x67')?[{'name':_0x7e57('0x70'),'value':_0x7e57('0x71')},{'name':_0x7e57('0x72'),'value':'false'}]:[]};})};}})[_0x7e57('0x22')](respondWithResult(_0x4b4a5b,null))[_0x7e57('0x41')](function(_0x25ea72){var _0x289f9d=_0x315455[_0x7e57('0x2e')][_0x7e57('0x73')]?0x1f4:_0x25ea72[_0x7e57('0x74')]||0x1f4;logger['error'](_0x7e57('0x75'),'getFields',_0x289f9d,JSON[_0x7e57('0x76')](_0x25ea72));delete _0x25ea72[_0x7e57('0x25')];if(_0x289f9d===0x191){_0x289f9d=0x190;}_0x4b4a5b[_0x7e57('0x19')](_0x289f9d)[_0x7e57('0x26')](_0x315455[_0x7e57('0x2e')][_0x7e57('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x25ea72[_0x7e57('0x74')]}:_0x25ea72);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 1c25f84..b0151bf 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 _0xc385=['rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','SalesforceAccount','int_salesforce_accounts','lodash','util','api','bluebird','request-promise'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xc385,0xa0));var _0x5c38=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0xc385[_0xc8a931];return _0x28bd27;};'use strict';var _=require(_0x5c38('0x0'));var util=require(_0x5c38('0x1'));var logger=require('../../config/logger')(_0x5c38('0x2'));var moment=require('moment');var BPromise=require(_0x5c38('0x3'));var rp=require(_0x5c38('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c38('0x5'));var config=require('../../config/environment');var attributes=require(_0x5c38('0x6'));var integrations=require(_0x5c38('0x7'));module[_0x5c38('0x8')]=function(_0x11dcc6,_0x355863){return _0x11dcc6['define'](_0x5c38('0x9'),attributes,{'tableName':_0x5c38('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4731=['SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4731,0xce));var _0x1473=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x4731[_0x5f3f88];return _0xd08119;};'use strict';var _=require(_0x1473('0x0'));var util=require(_0x1473('0x1'));var logger=require(_0x1473('0x2'))(_0x1473('0x3'));var moment=require(_0x1473('0x4'));var BPromise=require('bluebird');var rp=require(_0x1473('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1473('0x6'));var attributes=require(_0x1473('0x7'));var integrations=require(_0x1473('0x8'));module['exports']=function(_0x169ee1,_0x2c210a){return _0x169ee1[_0x1473('0x9')](_0x1473('0xa'),attributes,{'tableName':_0x1473('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 f5bfc04..5673fb3 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 _0x2611=['message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','limit','include','model','map','then','debug','find','where','ShowSalesforceAccount','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55e8ef,_0x57618b){var _0x937802=function(_0x54a5a6){while(--_0x54a5a6){_0x55e8ef['push'](_0x55e8ef['shift']());}};_0x937802(++_0x57618b);}(_0x2611,0xd7));var _0x1261=function(_0x5a28d8,_0x6440fb){_0x5a28d8=_0x5a28d8-0x0;var _0x170c8a=_0x2611[_0x5a28d8];return _0x170c8a;};'use strict';var _=require('lodash');var util=require(_0x1261('0x0'));var moment=require(_0x1261('0x1'));var BPromise=require('bluebird');var rs=require(_0x1261('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1261('0x3'));var logger=require(_0x1261('0x4'))(_0x1261('0x5'));var config=require('../../config/environment');var jayson=require(_0x1261('0x6'));var client=jayson[_0x1261('0x7')][_0x1261('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25ecd4,_0x394efe,_0x13bfb8){return new BPromise(function(_0x2aa117,_0x20d6f){return client['request'](_0x25ecd4,_0x13bfb8)['then'](function(_0x15ad66){logger[_0x1261('0x9')](_0x1261('0xa'),_0x394efe,_0x1261('0xb'));logger['debug'](_0x1261('0xc'),_0x394efe,'request\x20sent',JSON[_0x1261('0xd')](_0x15ad66));if(_0x15ad66['error']){if(_0x15ad66[_0x1261('0xe')][_0x1261('0xf')]===0x1f4){logger[_0x1261('0xe')](_0x1261('0xa'),_0x394efe,_0x15ad66[_0x1261('0xe')]['message']);return _0x20d6f(_0x15ad66[_0x1261('0xe')][_0x1261('0x10')]);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x394efe,_0x15ad66[_0x1261('0xe')]['message']);return _0x2aa117(_0x15ad66[_0x1261('0xe')]['message']);}else{logger['info'](_0x1261('0xa'),_0x394efe,_0x1261('0xb'));_0x2aa117(_0x15ad66['result'][_0x1261('0x10')]);}})[_0x1261('0x11')](function(_0x42da0e){logger[_0x1261('0xe')]('SalesforceAccount,\x20%s,\x20%s',_0x394efe,_0x42da0e);_0x20d6f(_0x42da0e);});});}exports[_0x1261('0x12')]=function(_0x3e16e8){var _0xd176e8=this;return new Promise(function(_0x482265,_0x55eac3){return db[_0x1261('0x13')][_0x1261('0x14')]({'raw':_0x3e16e8[_0x1261('0x15')]?_0x3e16e8['options'][_0x1261('0x16')]===undefined?!![]:![]:!![],'where':_0x3e16e8[_0x1261('0x15')]?_0x3e16e8[_0x1261('0x15')]['where']||null:null,'attributes':_0x3e16e8[_0x1261('0x15')]?_0x3e16e8['options'][_0x1261('0x17')]||null:null,'limit':_0x3e16e8[_0x1261('0x15')]?_0x3e16e8['options'][_0x1261('0x18')]||null:null,'include':_0x3e16e8[_0x1261('0x15')]?_0x3e16e8[_0x1261('0x15')][_0x1261('0x19')]?_['map'](_0x3e16e8['options']['include'],function(_0xd9c065){return{'model':db[_0xd9c065[_0x1261('0x1a')]],'as':_0xd9c065['as'],'attributes':_0xd9c065[_0x1261('0x17')],'include':_0xd9c065[_0x1261('0x19')]?_[_0x1261('0x1b')](_0xd9c065[_0x1261('0x19')],function(_0x2c22cf){return{'model':db[_0x2c22cf['model']],'as':_0x2c22cf['as'],'attributes':_0x2c22cf[_0x1261('0x17')],'include':_0x2c22cf[_0x1261('0x19')]?_['map'](_0x2c22cf[_0x1261('0x19')],function(_0x4ebdab){return{'model':db[_0x4ebdab[_0x1261('0x1a')]],'as':_0x4ebdab['as'],'attributes':_0x4ebdab[_0x1261('0x17')]};}):[]};}):[]};}):[]:[]})[_0x1261('0x1c')](function(_0x1b9ebe){logger[_0x1261('0x9')](_0x1261('0x12'),_0x3e16e8);logger[_0x1261('0x1d')]('GetSalesforceAccount',_0x3e16e8,JSON['stringify'](_0x1b9ebe));_0x482265(_0x1b9ebe);})[_0x1261('0x11')](function(_0xc1b8b2){logger['error'](_0x1261('0x12'),_0xc1b8b2[_0x1261('0x10')],_0x3e16e8);_0x55eac3(_0xd176e8['error'](0x1f4,_0xc1b8b2['message']));});});};exports['ShowSalesforceAccount']=function(_0xf57c06){var _0x5305b3=this;return new Promise(function(_0x4b2668,_0x30165b){return db[_0x1261('0x13')][_0x1261('0x1e')]({'raw':_0xf57c06[_0x1261('0x15')]?_0xf57c06[_0x1261('0x15')][_0x1261('0x16')]===undefined?!![]:![]:!![],'where':_0xf57c06['options']?_0xf57c06[_0x1261('0x15')][_0x1261('0x1f')]||null:null,'attributes':_0xf57c06[_0x1261('0x15')]?_0xf57c06[_0x1261('0x15')][_0x1261('0x17')]||null:null,'include':_0xf57c06['options']?_0xf57c06[_0x1261('0x15')]['include']?_[_0x1261('0x1b')](_0xf57c06[_0x1261('0x15')]['include'],function(_0x21fc88){return{'model':db[_0x21fc88[_0x1261('0x1a')]],'as':_0x21fc88['as'],'attributes':_0x21fc88[_0x1261('0x17')],'include':_0x21fc88[_0x1261('0x19')]?_[_0x1261('0x1b')](_0x21fc88[_0x1261('0x19')],function(_0x1d6e10){return{'model':db[_0x1d6e10['model']],'as':_0x1d6e10['as'],'attributes':_0x1d6e10['attributes'],'include':_0x1d6e10['include']?_[_0x1261('0x1b')](_0x1d6e10[_0x1261('0x19')],function(_0x57a913){return{'model':db[_0x57a913[_0x1261('0x1a')]],'as':_0x57a913['as'],'attributes':_0x57a913['attributes']};}):[]};}):[]};}):[]:[]})[_0x1261('0x1c')](function(_0x4a96be){logger['info'](_0x1261('0x20'),_0xf57c06);logger[_0x1261('0x1d')](_0x1261('0x20'),_0xf57c06,JSON[_0x1261('0xd')](_0x4a96be));_0x4b2668(_0x4a96be);})[_0x1261('0x11')](function(_0x41d1f0){logger[_0x1261('0xe')](_0x1261('0x20'),_0x41d1f0[_0x1261('0x10')],_0xf57c06);_0x30165b(_0x5305b3[_0x1261('0xe')](0x1f4,_0x41d1f0[_0x1261('0x10')]));});});}; \ No newline at end of file +var _0x24de=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','request','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowSalesforceAccount','SalesforceAccount','find','lodash','bluebird'];(function(_0x1f28b3,_0x4da519){var _0x210638=function(_0x3749d4){while(--_0x3749d4){_0x1f28b3['push'](_0x1f28b3['shift']());}};_0x210638(++_0x4da519);}(_0x24de,0x7e));var _0xe24d=function(_0x2f093e,_0x37bfd7){_0x2f093e=_0x2f093e-0x0;var _0x11f2d3=_0x24de[_0x2f093e];return _0x11f2d3;};'use strict';var _=require(_0xe24d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe24d('0x1'));var rs=require(_0xe24d('0x2'));var fs=require('fs');var Redis=require(_0xe24d('0x3'));var db=require(_0xe24d('0x4'))['db'];var utils=require(_0xe24d('0x5'));var logger=require(_0xe24d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe24d('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xa0cb1d,_0x2a0df8,_0xab34f6){return new BPromise(function(_0xd08f5,_0x41a21a){return client[_0xe24d('0x8')](_0xa0cb1d,_0xab34f6)[_0xe24d('0x9')](function(_0x4ebb81){logger[_0xe24d('0xa')](_0xe24d('0xb'),_0x2a0df8,'request\x20sent');logger[_0xe24d('0xc')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x2a0df8,_0xe24d('0xd'),JSON[_0xe24d('0xe')](_0x4ebb81));if(_0x4ebb81[_0xe24d('0xf')]){if(_0x4ebb81[_0xe24d('0xf')]['code']===0x1f4){logger[_0xe24d('0xf')]('SalesforceAccount,\x20%s,\x20%s',_0x2a0df8,_0x4ebb81['error'][_0xe24d('0x10')]);return _0x41a21a(_0x4ebb81[_0xe24d('0xf')][_0xe24d('0x10')]);}logger[_0xe24d('0xf')](_0xe24d('0xb'),_0x2a0df8,_0x4ebb81[_0xe24d('0xf')][_0xe24d('0x10')]);return _0xd08f5(_0x4ebb81[_0xe24d('0xf')][_0xe24d('0x10')]);}else{logger[_0xe24d('0xa')]('SalesforceAccount,\x20%s,\x20%s',_0x2a0df8,_0xe24d('0xd'));_0xd08f5(_0x4ebb81[_0xe24d('0x11')]['message']);}})[_0xe24d('0x12')](function(_0x2b0cc7){logger[_0xe24d('0xf')](_0xe24d('0xb'),_0x2a0df8,_0x2b0cc7);_0x41a21a(_0x2b0cc7);});});}exports[_0xe24d('0x13')]=function(_0x4aa83e){var _0xd30eda=this;return new Promise(function(_0x513c10,_0x5d1058){return db['SalesforceAccount'][_0xe24d('0x14')]({'raw':_0x4aa83e[_0xe24d('0x15')]?_0x4aa83e[_0xe24d('0x15')][_0xe24d('0x16')]===undefined?!![]:![]:!![],'where':_0x4aa83e['options']?_0x4aa83e[_0xe24d('0x15')][_0xe24d('0x17')]||null:null,'attributes':_0x4aa83e[_0xe24d('0x15')]?_0x4aa83e[_0xe24d('0x15')]['attributes']||null:null,'limit':_0x4aa83e[_0xe24d('0x15')]?_0x4aa83e[_0xe24d('0x15')][_0xe24d('0x18')]||null:null,'include':_0x4aa83e[_0xe24d('0x15')]?_0x4aa83e[_0xe24d('0x15')][_0xe24d('0x19')]?_[_0xe24d('0x1a')](_0x4aa83e[_0xe24d('0x15')][_0xe24d('0x19')],function(_0x2b2194){return{'model':db[_0x2b2194['model']],'as':_0x2b2194['as'],'attributes':_0x2b2194['attributes'],'include':_0x2b2194[_0xe24d('0x19')]?_['map'](_0x2b2194[_0xe24d('0x19')],function(_0x4526e8){return{'model':db[_0x4526e8[_0xe24d('0x1b')]],'as':_0x4526e8['as'],'attributes':_0x4526e8['attributes'],'include':_0x4526e8[_0xe24d('0x19')]?_[_0xe24d('0x1a')](_0x4526e8['include'],function(_0x106dd7){return{'model':db[_0x106dd7[_0xe24d('0x1b')]],'as':_0x106dd7['as'],'attributes':_0x106dd7[_0xe24d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe24d('0x9')](function(_0x534da1){logger[_0xe24d('0xa')](_0xe24d('0x13'),_0x4aa83e);logger[_0xe24d('0xc')](_0xe24d('0x13'),_0x4aa83e,JSON[_0xe24d('0xe')](_0x534da1));_0x513c10(_0x534da1);})['catch'](function(_0x4b74b4){logger[_0xe24d('0xf')]('GetSalesforceAccount',_0x4b74b4[_0xe24d('0x10')],_0x4aa83e);_0x5d1058(_0xd30eda[_0xe24d('0xf')](0x1f4,_0x4b74b4[_0xe24d('0x10')]));});});};exports[_0xe24d('0x1d')]=function(_0x3fe079){var _0x1746cc=this;return new Promise(function(_0x330e1e,_0x4e5310){return db[_0xe24d('0x1e')][_0xe24d('0x1f')]({'raw':_0x3fe079[_0xe24d('0x15')]?_0x3fe079[_0xe24d('0x15')][_0xe24d('0x16')]===undefined?!![]:![]:!![],'where':_0x3fe079[_0xe24d('0x15')]?_0x3fe079[_0xe24d('0x15')][_0xe24d('0x17')]||null:null,'attributes':_0x3fe079['options']?_0x3fe079['options'][_0xe24d('0x1c')]||null:null,'include':_0x3fe079[_0xe24d('0x15')]?_0x3fe079[_0xe24d('0x15')]['include']?_['map'](_0x3fe079[_0xe24d('0x15')][_0xe24d('0x19')],function(_0x404327){return{'model':db[_0x404327[_0xe24d('0x1b')]],'as':_0x404327['as'],'attributes':_0x404327[_0xe24d('0x1c')],'include':_0x404327['include']?_[_0xe24d('0x1a')](_0x404327[_0xe24d('0x19')],function(_0x1bd5b){return{'model':db[_0x1bd5b[_0xe24d('0x1b')]],'as':_0x1bd5b['as'],'attributes':_0x1bd5b[_0xe24d('0x1c')],'include':_0x1bd5b[_0xe24d('0x19')]?_[_0xe24d('0x1a')](_0x1bd5b['include'],function(_0x403868){return{'model':db[_0x403868[_0xe24d('0x1b')]],'as':_0x403868['as'],'attributes':_0x403868[_0xe24d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe24d('0x9')](function(_0x5bbefb){logger[_0xe24d('0xa')](_0xe24d('0x1d'),_0x3fe079);logger['debug']('ShowSalesforceAccount',_0x3fe079,JSON['stringify'](_0x5bbefb));_0x330e1e(_0x5bbefb);})[_0xe24d('0x12')](function(_0x1c072d){logger[_0xe24d('0xf')](_0xe24d('0x1d'),_0x1c072d[_0xe24d('0x10')],_0x3fe079);_0x4e5310(_0x1746cc[_0xe24d('0xf')](0x1f4,_0x1c072d[_0xe24d('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 4143ea4..8f0368d 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 _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(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xdb28,0x106));var _0x8db2=function(_0x2c3673,_0x1b98c8){_0x2c3673=_0x2c3673-0x0;var _0x238157=_0xdb28[_0x2c3673];return _0x238157;};'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 +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x33fcd2,_0x42b713){var _0x19a46f=function(_0xb2a0cc){while(--_0xb2a0cc){_0x33fcd2['push'](_0x33fcd2['shift']());}};_0x19a46f(++_0x42b713);}(_0x2ef3,0xba));var _0x32ef=function(_0x2176d0,_0x4d1fc8){_0x2176d0=_0x2176d0-0x0;var _0xbe6be2=_0x2ef3[_0x2176d0];return _0xbe6be2;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 24f7353..5d23ea6 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 _0xf315=['account_contact_lead','account','nothing','contact','sequelize','exports','STRING','ENUM','Case','Task','contact_lead','lead'];(function(_0x346f5a,_0x33de62){var _0x2c1254=function(_0x20c734){while(--_0x20c734){_0x346f5a['push'](_0x346f5a['shift']());}};_0x2c1254(++_0x33de62);}(_0xf315,0x130));var _0x5f31=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf315[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x5f31('0x0'));module[_0x5f31('0x1')]={'name':{'type':Sequelize[_0x5f31('0x2')]},'description':{'type':Sequelize[_0x5f31('0x2')]},'ticketType':{'type':Sequelize[_0x5f31('0x3')]('Task',_0x5f31('0x4')),'defaultValue':_0x5f31('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0x5f31('0x6'),'contact',_0x5f31('0x7'),_0x5f31('0x8'),_0x5f31('0x9')),'defaultValue':_0x5f31('0x6')},'moduleCreate':{'type':Sequelize[_0x5f31('0x3')](_0x5f31('0xa'),_0x5f31('0xb'),'lead',_0x5f31('0x9')),'defaultValue':_0x5f31('0x7')},'leadId':{'type':Sequelize[_0x5f31('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x5f31('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x5f31('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5f31('0x2')]}}; \ No newline at end of file +var _0xcfef=['contact','account_contact_lead','account','nothing','lead','exports','STRING','Task','Case','ENUM','contact_lead'];(function(_0x5d31a5,_0x398f97){var _0x3b903b=function(_0x4b8ff0){while(--_0x4b8ff0){_0x5d31a5['push'](_0x5d31a5['shift']());}};_0x3b903b(++_0x398f97);}(_0xcfef,0x19c));var _0xfcfe=function(_0x7dd3c0,_0x43d5b7){_0x7dd3c0=_0x7dd3c0-0x0;var _0x30cbf8=_0xcfef[_0x7dd3c0];return _0x30cbf8;};'use strict';var Sequelize=require('sequelize');module[_0xfcfe('0x0')]={'name':{'type':Sequelize[_0xfcfe('0x1')]},'description':{'type':Sequelize[_0xfcfe('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xfcfe('0x2'),_0xfcfe('0x3')),'defaultValue':_0xfcfe('0x2')},'moduleSearch':{'type':Sequelize[_0xfcfe('0x4')](_0xfcfe('0x5'),_0xfcfe('0x6'),'lead',_0xfcfe('0x7'),_0xfcfe('0x8')),'defaultValue':_0xfcfe('0x5')},'moduleCreate':{'type':Sequelize[_0xfcfe('0x4')](_0xfcfe('0x9'),_0xfcfe('0x6'),_0xfcfe('0xa'),'account'),'defaultValue':_0xfcfe('0xa')},'leadId':{'type':Sequelize[_0xfcfe('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0xfcfe('0x1')]},'additionalSearchContact':{'type':Sequelize[_0xfcfe('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xfcfe('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 6b32718..3ac2ae8 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 _0x0896=['filter','merge','where','includeAll','include','SalesforceConfiguration','rows','params','options','find','catch','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick'];(function(_0x955204,_0x563ef8){var _0x4d1f7e=function(_0xe81a02){while(--_0xe81a02){_0x955204['push'](_0x955204['shift']());}};_0x4d1f7e(++_0x563ef8);}(_0x0896,0x12a));var _0x6089=function(_0x35f41c,_0x124e77){_0x35f41c=_0x35f41c-0x0;var _0x1f25fb=_0x0896[_0x35f41c];return _0x1f25fb;};'use strict';var emlformat=require(_0x6089('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6089('0x1'));var jsonpatch=require(_0x6089('0x2'));var rp=require('request-promise');var moment=require(_0x6089('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6089('0x4'));var path=require(_0x6089('0x5'));var sox=require(_0x6089('0x6'));var csv=require('to-csv');var ejs=require(_0x6089('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6089('0x8'));var crypto=require(_0x6089('0x9'));var jsforce=require(_0x6089('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6089('0xb'));var querystring=require(_0x6089('0xc'));var Papa=require(_0x6089('0xd'));var Redis=require('ioredis');var authService=require(_0x6089('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6089('0xf'))('api');var utils=require(_0x6089('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6089('0x11'))['db'];function respondWithStatusCode(_0x47456e,_0x1ab9fc){_0x1ab9fc=_0x1ab9fc||0xcc;return function(_0x32f056){if(_0x32f056){return _0x47456e[_0x6089('0x12')](_0x1ab9fc);}return _0x47456e[_0x6089('0x13')](_0x1ab9fc)['end']();};}function respondWithResult(_0x1e4a10,_0x193bb2){_0x193bb2=_0x193bb2||0xc8;return function(_0x4635fd){if(_0x4635fd){return _0x1e4a10[_0x6089('0x13')](_0x193bb2)[_0x6089('0x14')](_0x4635fd);}};}function respondWithFilteredResult(_0x27e913,_0x3761a2){return function(_0x2c8c6f){if(_0x2c8c6f){var _0x31681b=typeof _0x3761a2[_0x6089('0x15')]===_0x6089('0x16')&&typeof _0x3761a2[_0x6089('0x17')]===_0x6089('0x16');var _0x52608c=_0x2c8c6f[_0x6089('0x18')];var _0x3b06a=_0x31681b?0x0:_0x3761a2['offset'];var _0x146246=_0x31681b?_0x2c8c6f[_0x6089('0x18')]:_0x3761a2[_0x6089('0x15')]+_0x3761a2[_0x6089('0x17')];var _0x4a138e;if(_0x146246>=_0x52608c){_0x146246=_0x52608c;_0x4a138e=0xc8;}else{_0x4a138e=0xce;}_0x27e913[_0x6089('0x13')](_0x4a138e);return _0x27e913['set'](_0x6089('0x19'),_0x3b06a+'-'+_0x146246+'/'+_0x52608c)[_0x6089('0x14')](_0x2c8c6f);}return null;};}function patchUpdates(_0x3203bf){return function(_0x19003a){try{jsonpatch[_0x6089('0x1a')](_0x19003a,_0x3203bf,!![]);}catch(_0x249188){return BPromise[_0x6089('0x1b')](_0x249188);}return _0x19003a[_0x6089('0x1c')]();};}function saveUpdates(_0x5010ff,_0x358cc1){return function(_0x44c230){if(_0x44c230){return _0x44c230[_0x6089('0x1d')](_0x5010ff)['then'](function(_0x349a54){return _0x349a54;});}return null;};}function removeEntity(_0x2653e4,_0x2e2bf4){return function(_0x513a53){if(_0x513a53){return _0x513a53[_0x6089('0x1e')]()[_0x6089('0x1f')](function(){_0x2653e4[_0x6089('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28c61d,_0x1bda9c){return function(_0x48626){if(!_0x48626){_0x28c61d['sendStatus'](0x194);}return _0x48626;};}function handleError(_0x2a0919,_0x5e98c5){_0x5e98c5=_0x5e98c5||0x1f4;return function(_0x2e39ea){logger['error'](_0x2e39ea['stack']);if(_0x2e39ea[_0x6089('0x20')]){delete _0x2e39ea['name'];}_0x2a0919['status'](_0x5e98c5)['send'](_0x2e39ea);};}exports[_0x6089('0x21')]=function(_0x2b2fee,_0x369085){var _0x40b434={},_0x3c2d9b={},_0x2ceb82={'count':0x0,'rows':[]};var _0xd07eed=_[_0x6089('0x22')](db['SalesforceConfiguration'][_0x6089('0x23')],function(_0x14ba25){return{'name':_0x14ba25[_0x6089('0x24')],'type':_0x14ba25[_0x6089('0x25')][_0x6089('0x26')]};});_0x3c2d9b[_0x6089('0x27')]=_[_0x6089('0x22')](_0xd07eed,_0x6089('0x20'));_0x3c2d9b[_0x6089('0x28')]=_[_0x6089('0x29')](_0x2b2fee['query']);_0x3c2d9b[_0x6089('0x2a')]=_[_0x6089('0x2b')](_0x3c2d9b['model'],_0x3c2d9b[_0x6089('0x28')]);_0x40b434[_0x6089('0x2c')]=_[_0x6089('0x2b')](_0x3c2d9b[_0x6089('0x27')],qs['fields'](_0x2b2fee['query'][_0x6089('0x2d')]));_0x40b434[_0x6089('0x2c')]=_0x40b434[_0x6089('0x2c')][_0x6089('0x2e')]?_0x40b434[_0x6089('0x2c')]:_0x3c2d9b['model'];if(!_0x2b2fee[_0x6089('0x28')][_0x6089('0x2f')](_0x6089('0x30'))){_0x40b434['limit']=qs[_0x6089('0x17')](_0x2b2fee[_0x6089('0x28')][_0x6089('0x17')]);_0x40b434['offset']=qs[_0x6089('0x15')](_0x2b2fee[_0x6089('0x28')]['offset']);}_0x40b434[_0x6089('0x31')]=qs['sort'](_0x2b2fee[_0x6089('0x28')][_0x6089('0x32')]);_0x40b434['where']=qs[_0x6089('0x2a')](_[_0x6089('0x33')](_0x2b2fee[_0x6089('0x28')],_0x3c2d9b[_0x6089('0x2a')]),_0xd07eed);if(_0x2b2fee['query'][_0x6089('0x34')]){_0x40b434['where']=_[_0x6089('0x35')](_0x40b434[_0x6089('0x36')],{'$or':_[_0x6089('0x22')](_0xd07eed,function(_0xa95df){if(_0xa95df[_0x6089('0x25')]!=='VIRTUAL'){var _0x397eec={};_0x397eec[_0xa95df['name']]={'$like':'%'+_0x2b2fee[_0x6089('0x28')][_0x6089('0x34')]+'%'};return _0x397eec;}})});}_0x40b434=_[_0x6089('0x35')]({},_0x40b434,_0x2b2fee['options']);var _0xf6a004={'where':_0x40b434[_0x6089('0x36')]};return db['SalesforceConfiguration'][_0x6089('0x18')](_0xf6a004)[_0x6089('0x1f')](function(_0x117970){_0x2ceb82[_0x6089('0x18')]=_0x117970;if(_0x2b2fee['query'][_0x6089('0x37')]){_0x40b434[_0x6089('0x38')]=[{'all':!![]}];}return db[_0x6089('0x39')]['findAll'](_0x40b434);})[_0x6089('0x1f')](function(_0x60278b){_0x2ceb82[_0x6089('0x3a')]=_0x60278b;return _0x2ceb82;})[_0x6089('0x1f')](respondWithFilteredResult(_0x369085,_0x40b434))['catch'](handleError(_0x369085,null));};exports['show']=function(_0x56e228,_0x236750){var _0x4e00d9={'raw':![],'where':{'id':_0x56e228[_0x6089('0x3b')]['id']}},_0x2dda91={};_0x2dda91['model']=_[_0x6089('0x29')](db[_0x6089('0x39')][_0x6089('0x23')]);_0x2dda91['query']=_[_0x6089('0x29')](_0x56e228[_0x6089('0x28')]);_0x2dda91[_0x6089('0x2a')]=_['intersection'](_0x2dda91[_0x6089('0x27')],_0x2dda91['query']);_0x4e00d9['attributes']=_['intersection'](_0x2dda91[_0x6089('0x27')],qs[_0x6089('0x2d')](_0x56e228[_0x6089('0x28')]['fields']));_0x4e00d9[_0x6089('0x2c')]=_0x4e00d9[_0x6089('0x2c')]['length']?_0x4e00d9[_0x6089('0x2c')]:_0x2dda91[_0x6089('0x27')];if(_0x56e228[_0x6089('0x28')]['includeAll']){_0x4e00d9[_0x6089('0x38')]=[{'all':!![]}];}_0x4e00d9=_['merge']({},_0x4e00d9,_0x56e228[_0x6089('0x3c')]);return db['SalesforceConfiguration'][_0x6089('0x3d')](_0x4e00d9)[_0x6089('0x1f')](handleEntityNotFound(_0x236750,null))['then'](respondWithResult(_0x236750,null))[_0x6089('0x3e')](handleError(_0x236750,null));};exports[_0x6089('0x3f')]=function(_0x1dcbf8,_0x5dbddd){return db[_0x6089('0x39')][_0x6089('0x3f')](_0x1dcbf8[_0x6089('0x40')],{})[_0x6089('0x1f')](respondWithResult(_0x5dbddd,0xc9))['catch'](handleError(_0x5dbddd,null));};exports['update']=function(_0x4b753a,_0x57de78){if(_0x4b753a[_0x6089('0x40')]['id']){delete _0x4b753a[_0x6089('0x40')]['id'];}return db['SalesforceConfiguration'][_0x6089('0x3d')]({'where':{'id':_0x4b753a[_0x6089('0x3b')]['id']}})[_0x6089('0x1f')](handleEntityNotFound(_0x57de78,null))[_0x6089('0x1f')](saveUpdates(_0x4b753a[_0x6089('0x40')],null))[_0x6089('0x1f')](respondWithResult(_0x57de78,null))[_0x6089('0x3e')](handleError(_0x57de78,null));};exports[_0x6089('0x1e')]=function(_0x2bf0de,_0x165d00){return db[_0x6089('0x39')]['find']({'where':{'id':_0x2bf0de['params']['id']}})[_0x6089('0x1f')](handleEntityNotFound(_0x165d00,null))[_0x6089('0x1f')](removeEntity(_0x165d00,null))[_0x6089('0x3e')](handleError(_0x165d00,null));};exports[_0x6089('0x41')]=function(_0x3dd8f4,_0x1c5427,_0x5de6d9){var _0x45a74e={};var _0x47ff83={};var _0x4aa132;var _0x117ff7;return db[_0x6089('0x39')][_0x6089('0x42')]({'where':{'id':_0x3dd8f4[_0x6089('0x3b')]['id']}})[_0x6089('0x1f')](handleEntityNotFound(_0x1c5427,null))[_0x6089('0x1f')](function(_0x3d2ca5){if(_0x3d2ca5){_0x4aa132=_0x3d2ca5;_0x47ff83[_0x6089('0x27')]=_[_0x6089('0x29')](db[_0x6089('0x43')][_0x6089('0x23')]);_0x47ff83[_0x6089('0x28')]=_[_0x6089('0x29')](_0x3dd8f4[_0x6089('0x28')]);_0x47ff83[_0x6089('0x2a')]=_[_0x6089('0x2b')](_0x47ff83['model'],_0x47ff83[_0x6089('0x28')]);_0x45a74e[_0x6089('0x2c')]=_[_0x6089('0x2b')](_0x47ff83[_0x6089('0x27')],qs[_0x6089('0x2d')](_0x3dd8f4['query'][_0x6089('0x2d')]));_0x45a74e[_0x6089('0x2c')]=_0x45a74e[_0x6089('0x2c')][_0x6089('0x2e')]?_0x45a74e['attributes']:_0x47ff83[_0x6089('0x27')];_0x45a74e[_0x6089('0x31')]=qs[_0x6089('0x32')](_0x3dd8f4[_0x6089('0x28')][_0x6089('0x32')]);_0x45a74e['where']=qs[_0x6089('0x2a')](_[_0x6089('0x33')](_0x3dd8f4['query'],_0x47ff83[_0x6089('0x2a')]));if(_0x3dd8f4[_0x6089('0x28')]['filter']){_0x45a74e['where']=_[_0x6089('0x35')](_0x45a74e['where'],{'$or':_['map'](_0x45a74e[_0x6089('0x2c')],function(_0x2d8e5c){var _0x56db1d={};_0x56db1d[_0x2d8e5c]={'$like':'%'+_0x3dd8f4[_0x6089('0x28')][_0x6089('0x34')]+'%'};return _0x56db1d;})});}_0x45a74e=_[_0x6089('0x35')]({},_0x45a74e,_0x3dd8f4[_0x6089('0x3c')]);return _0x4aa132[_0x6089('0x41')](_0x45a74e);}})['then'](function(_0x2158eb){if(_0x2158eb){_0x117ff7=_0x2158eb[_0x6089('0x2e')];if(!_0x3dd8f4[_0x6089('0x28')]['hasOwnProperty'](_0x6089('0x30'))){_0x45a74e[_0x6089('0x17')]=qs['limit'](_0x3dd8f4['query'][_0x6089('0x17')]);_0x45a74e[_0x6089('0x15')]=qs[_0x6089('0x15')](_0x3dd8f4[_0x6089('0x28')][_0x6089('0x15')]);}return _0x4aa132[_0x6089('0x41')](_0x45a74e);}})[_0x6089('0x1f')](function(_0x5af530){if(_0x5af530){return _0x5af530?{'count':_0x117ff7,'rows':_0x5af530}:null;}})[_0x6089('0x1f')](respondWithResult(_0x1c5427,null))[_0x6089('0x3e')](handleError(_0x1c5427,null));};exports['getSubjects']=function(_0x1677a3,_0x325c5a,_0x2ec896){var _0x5cae0c={};var _0xe9ad12={};var _0x354769;var _0x2f55d4;return db[_0x6089('0x39')][_0x6089('0x42')]({'where':{'id':_0x1677a3[_0x6089('0x3b')]['id']}})[_0x6089('0x1f')](handleEntityNotFound(_0x325c5a,null))[_0x6089('0x1f')](function(_0x4777eb){if(_0x4777eb){_0x354769=_0x4777eb;_0xe9ad12[_0x6089('0x27')]=_[_0x6089('0x29')](db['SalesforceField']['rawAttributes']);_0xe9ad12['query']=_[_0x6089('0x29')](_0x1677a3[_0x6089('0x28')]);_0xe9ad12[_0x6089('0x2a')]=_[_0x6089('0x2b')](_0xe9ad12['model'],_0xe9ad12[_0x6089('0x28')]);_0x5cae0c['attributes']=_[_0x6089('0x2b')](_0xe9ad12[_0x6089('0x27')],qs[_0x6089('0x2d')](_0x1677a3[_0x6089('0x28')][_0x6089('0x2d')]));_0x5cae0c[_0x6089('0x2c')]=_0x5cae0c[_0x6089('0x2c')][_0x6089('0x2e')]?_0x5cae0c[_0x6089('0x2c')]:_0xe9ad12[_0x6089('0x27')];_0x5cae0c[_0x6089('0x31')]=qs['sort'](_0x1677a3[_0x6089('0x28')][_0x6089('0x32')]);_0x5cae0c[_0x6089('0x36')]=qs[_0x6089('0x2a')](_['pick'](_0x1677a3[_0x6089('0x28')],_0xe9ad12[_0x6089('0x2a')]));if(_0x1677a3['query'][_0x6089('0x34')]){_0x5cae0c['where']=_[_0x6089('0x35')](_0x5cae0c['where'],{'$or':_['map'](_0x5cae0c[_0x6089('0x2c')],function(_0x4b7a82){var _0x4565cb={};_0x4565cb[_0x4b7a82]={'$like':'%'+_0x1677a3[_0x6089('0x28')][_0x6089('0x34')]+'%'};return _0x4565cb;})});}_0x5cae0c=_[_0x6089('0x35')]({},_0x5cae0c,_0x1677a3[_0x6089('0x3c')]);return _0x354769[_0x6089('0x44')](_0x5cae0c);}})['then'](function(_0x30c202){if(_0x30c202){_0x2f55d4=_0x30c202[_0x6089('0x2e')];if(!_0x1677a3['query'][_0x6089('0x2f')](_0x6089('0x30'))){_0x5cae0c['limit']=qs['limit'](_0x1677a3[_0x6089('0x28')][_0x6089('0x17')]);_0x5cae0c['offset']=qs[_0x6089('0x15')](_0x1677a3[_0x6089('0x28')][_0x6089('0x15')]);}return _0x354769['getSubjects'](_0x5cae0c);}})[_0x6089('0x1f')](function(_0x982d6){if(_0x982d6){return _0x982d6?{'count':_0x2f55d4,'rows':_0x982d6}:null;}})[_0x6089('0x1f')](respondWithResult(_0x325c5a,null))[_0x6089('0x3e')](handleError(_0x325c5a,null));};exports[_0x6089('0x45')]=function(_0x132984,_0x5065e8,_0x5b6a6e){var _0x7992b5={};var _0x21e563={};var _0x1fa727;var _0x3ce183;return db['SalesforceConfiguration'][_0x6089('0x42')]({'where':{'id':_0x132984['params']['id']}})[_0x6089('0x1f')](handleEntityNotFound(_0x5065e8,null))[_0x6089('0x1f')](function(_0x25899f){if(_0x25899f){_0x1fa727=_0x25899f;_0x21e563[_0x6089('0x27')]=_['keys'](db[_0x6089('0x43')][_0x6089('0x23')]);_0x21e563['query']=_[_0x6089('0x29')](_0x132984[_0x6089('0x28')]);_0x21e563[_0x6089('0x2a')]=_['intersection'](_0x21e563[_0x6089('0x27')],_0x21e563[_0x6089('0x28')]);_0x7992b5[_0x6089('0x2c')]=_[_0x6089('0x2b')](_0x21e563[_0x6089('0x27')],qs[_0x6089('0x2d')](_0x132984['query'][_0x6089('0x2d')]));_0x7992b5[_0x6089('0x2c')]=_0x7992b5[_0x6089('0x2c')][_0x6089('0x2e')]?_0x7992b5[_0x6089('0x2c')]:_0x21e563[_0x6089('0x27')];_0x7992b5['order']=qs['sort'](_0x132984['query'][_0x6089('0x32')]);_0x7992b5[_0x6089('0x36')]=qs[_0x6089('0x2a')](_[_0x6089('0x33')](_0x132984[_0x6089('0x28')],_0x21e563[_0x6089('0x2a')]));if(_0x132984[_0x6089('0x28')][_0x6089('0x34')]){_0x7992b5[_0x6089('0x36')]=_[_0x6089('0x35')](_0x7992b5[_0x6089('0x36')],{'$or':_['map'](_0x7992b5[_0x6089('0x2c')],function(_0x50561c){var _0x1e3d73={};_0x1e3d73[_0x50561c]={'$like':'%'+_0x132984[_0x6089('0x28')][_0x6089('0x34')]+'%'};return _0x1e3d73;})});}_0x7992b5=_[_0x6089('0x35')]({},_0x7992b5,_0x132984[_0x6089('0x3c')]);return _0x1fa727[_0x6089('0x45')](_0x7992b5);}})['then'](function(_0xca76ee){if(_0xca76ee){_0x3ce183=_0xca76ee['length'];if(!_0x132984[_0x6089('0x28')]['hasOwnProperty'](_0x6089('0x30'))){_0x7992b5['limit']=qs['limit'](_0x132984[_0x6089('0x28')][_0x6089('0x17')]);_0x7992b5['offset']=qs[_0x6089('0x15')](_0x132984[_0x6089('0x28')][_0x6089('0x15')]);}return _0x1fa727[_0x6089('0x45')](_0x7992b5);}})[_0x6089('0x1f')](function(_0x12da3c){if(_0x12da3c){return _0x12da3c?{'count':_0x3ce183,'rows':_0x12da3c}:null;}})[_0x6089('0x1f')](respondWithResult(_0x5065e8,null))[_0x6089('0x3e')](handleError(_0x5065e8,null));}; \ No newline at end of file +var _0xbdce=['reject','update','then','destroy','error','name','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','SalesforceConfiguration','includeAll','include','findAll','rows','show','find','catch','create','body','params','getFields','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','undefined','count','Content-Range','apply'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xbdce,0x163));var _0xebdc=function(_0x3892d7,_0x55cae){_0x3892d7=_0x3892d7-0x0;var _0x130780=_0xbdce[_0x3892d7];return _0x130780;};'use strict';var emlformat=require(_0xebdc('0x0'));var rimraf=require(_0xebdc('0x1'));var zipdir=require(_0xebdc('0x2'));var jsonpatch=require(_0xebdc('0x3'));var rp=require(_0xebdc('0x4'));var moment=require(_0xebdc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xebdc('0x6'));var util=require('util');var path=require(_0xebdc('0x7'));var sox=require('sox');var csv=require(_0xebdc('0x8'));var ejs=require(_0xebdc('0x9'));var fs=require('fs');var fs_extra=require(_0xebdc('0xa'));var _=require(_0xebdc('0xb'));var squel=require(_0xebdc('0xc'));var crypto=require('crypto');var jsforce=require(_0xebdc('0xd'));var deskjs=require(_0xebdc('0xe'));var toCsv=require(_0xebdc('0x8'));var querystring=require(_0xebdc('0xf'));var Papa=require(_0xebdc('0x10'));var Redis=require(_0xebdc('0x11'));var authService=require(_0xebdc('0x12'));var qs=require(_0xebdc('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebdc('0x14'));var logger=require(_0xebdc('0x15'))(_0xebdc('0x16'));var utils=require(_0xebdc('0x17'));var config=require(_0xebdc('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xebdc('0x19'))['db'];function respondWithStatusCode(_0x31a99a,_0x454c5a){_0x454c5a=_0x454c5a||0xcc;return function(_0x22219c){if(_0x22219c){return _0x31a99a['sendStatus'](_0x454c5a);}return _0x31a99a['status'](_0x454c5a)[_0xebdc('0x1a')]();};}function respondWithResult(_0x1d7f87,_0x265f96){_0x265f96=_0x265f96||0xc8;return function(_0x3f53d1){if(_0x3f53d1){return _0x1d7f87[_0xebdc('0x1b')](_0x265f96)[_0xebdc('0x1c')](_0x3f53d1);}};}function respondWithFilteredResult(_0x2606fd,_0x44830e){return function(_0x1a1b27){if(_0x1a1b27){var _0x56c49f=typeof _0x44830e[_0xebdc('0x1d')]==='undefined'&&typeof _0x44830e[_0xebdc('0x1e')]===_0xebdc('0x1f');var _0x5efbb4=_0x1a1b27[_0xebdc('0x20')];var _0x563c67=_0x56c49f?0x0:_0x44830e['offset'];var _0x4ee1ce=_0x56c49f?_0x1a1b27[_0xebdc('0x20')]:_0x44830e[_0xebdc('0x1d')]+_0x44830e['limit'];var _0x2b948c;if(_0x4ee1ce>=_0x5efbb4){_0x4ee1ce=_0x5efbb4;_0x2b948c=0xc8;}else{_0x2b948c=0xce;}_0x2606fd[_0xebdc('0x1b')](_0x2b948c);return _0x2606fd['set'](_0xebdc('0x21'),_0x563c67+'-'+_0x4ee1ce+'/'+_0x5efbb4)[_0xebdc('0x1c')](_0x1a1b27);}return null;};}function patchUpdates(_0x22b06e){return function(_0x557fab){try{jsonpatch[_0xebdc('0x22')](_0x557fab,_0x22b06e,!![]);}catch(_0x2dab){return BPromise[_0xebdc('0x23')](_0x2dab);}return _0x557fab['save']();};}function saveUpdates(_0x502ebb,_0x106de2){return function(_0x4f069f){if(_0x4f069f){return _0x4f069f[_0xebdc('0x24')](_0x502ebb)[_0xebdc('0x25')](function(_0x93636d){return _0x93636d;});}return null;};}function removeEntity(_0xda5443,_0x4b8803){return function(_0x25212c){if(_0x25212c){return _0x25212c[_0xebdc('0x26')]()[_0xebdc('0x25')](function(){_0xda5443[_0xebdc('0x1b')](0xcc)[_0xebdc('0x1a')]();});}};}function handleEntityNotFound(_0x2028de,_0x19eb64){return function(_0xb2f79e){if(!_0xb2f79e){_0x2028de['sendStatus'](0x194);}return _0xb2f79e;};}function handleError(_0x10443b,_0x5197b1){_0x5197b1=_0x5197b1||0x1f4;return function(_0x106613){logger[_0xebdc('0x27')](_0x106613['stack']);if(_0x106613[_0xebdc('0x28')]){delete _0x106613[_0xebdc('0x28')];}_0x10443b[_0xebdc('0x1b')](_0x5197b1)['send'](_0x106613);};}exports['index']=function(_0x22851b,_0x38ea30){var _0xb27b01={},_0x3f24f3={},_0x369801={'count':0x0,'rows':[]};var _0x4f91cc=_[_0xebdc('0x29')](db['SalesforceConfiguration'][_0xebdc('0x2a')],function(_0x7e7cb8){return{'name':_0x7e7cb8['fieldName'],'type':_0x7e7cb8[_0xebdc('0x2b')][_0xebdc('0x2c')]};});_0x3f24f3['model']=_[_0xebdc('0x29')](_0x4f91cc,'name');_0x3f24f3[_0xebdc('0x2d')]=_[_0xebdc('0x2e')](_0x22851b[_0xebdc('0x2d')]);_0x3f24f3[_0xebdc('0x2f')]=_[_0xebdc('0x30')](_0x3f24f3[_0xebdc('0x31')],_0x3f24f3[_0xebdc('0x2d')]);_0xb27b01[_0xebdc('0x32')]=_[_0xebdc('0x30')](_0x3f24f3[_0xebdc('0x31')],qs[_0xebdc('0x33')](_0x22851b[_0xebdc('0x2d')][_0xebdc('0x33')]));_0xb27b01['attributes']=_0xb27b01[_0xebdc('0x32')][_0xebdc('0x34')]?_0xb27b01['attributes']:_0x3f24f3['model'];if(!_0x22851b[_0xebdc('0x2d')][_0xebdc('0x35')](_0xebdc('0x36'))){_0xb27b01[_0xebdc('0x1e')]=qs[_0xebdc('0x1e')](_0x22851b[_0xebdc('0x2d')][_0xebdc('0x1e')]);_0xb27b01[_0xebdc('0x1d')]=qs[_0xebdc('0x1d')](_0x22851b[_0xebdc('0x2d')][_0xebdc('0x1d')]);}_0xb27b01[_0xebdc('0x37')]=qs[_0xebdc('0x38')](_0x22851b[_0xebdc('0x2d')][_0xebdc('0x38')]);_0xb27b01[_0xebdc('0x39')]=qs[_0xebdc('0x2f')](_[_0xebdc('0x3a')](_0x22851b[_0xebdc('0x2d')],_0x3f24f3[_0xebdc('0x2f')]),_0x4f91cc);if(_0x22851b[_0xebdc('0x2d')][_0xebdc('0x3b')]){_0xb27b01[_0xebdc('0x39')]=_[_0xebdc('0x3c')](_0xb27b01[_0xebdc('0x39')],{'$or':_[_0xebdc('0x29')](_0x4f91cc,function(_0x1c56d5){if(_0x1c56d5[_0xebdc('0x2b')]!=='VIRTUAL'){var _0x1947a7={};_0x1947a7[_0x1c56d5[_0xebdc('0x28')]]={'$like':'%'+_0x22851b[_0xebdc('0x2d')][_0xebdc('0x3b')]+'%'};return _0x1947a7;}})});}_0xb27b01=_[_0xebdc('0x3c')]({},_0xb27b01,_0x22851b[_0xebdc('0x3d')]);var _0x176e0a={'where':_0xb27b01[_0xebdc('0x39')]};return db[_0xebdc('0x3e')][_0xebdc('0x20')](_0x176e0a)[_0xebdc('0x25')](function(_0x533a3e){_0x369801[_0xebdc('0x20')]=_0x533a3e;if(_0x22851b['query'][_0xebdc('0x3f')]){_0xb27b01[_0xebdc('0x40')]=[{'all':!![]}];}return db[_0xebdc('0x3e')][_0xebdc('0x41')](_0xb27b01);})[_0xebdc('0x25')](function(_0x343368){_0x369801[_0xebdc('0x42')]=_0x343368;return _0x369801;})[_0xebdc('0x25')](respondWithFilteredResult(_0x38ea30,_0xb27b01))['catch'](handleError(_0x38ea30,null));};exports[_0xebdc('0x43')]=function(_0x29ada7,_0x1d250a){var _0x5d705f={'raw':![],'where':{'id':_0x29ada7['params']['id']}},_0x36ef83={};_0x36ef83[_0xebdc('0x31')]=_[_0xebdc('0x2e')](db[_0xebdc('0x3e')][_0xebdc('0x2a')]);_0x36ef83['query']=_['keys'](_0x29ada7[_0xebdc('0x2d')]);_0x36ef83['filters']=_[_0xebdc('0x30')](_0x36ef83['model'],_0x36ef83[_0xebdc('0x2d')]);_0x5d705f[_0xebdc('0x32')]=_['intersection'](_0x36ef83['model'],qs[_0xebdc('0x33')](_0x29ada7[_0xebdc('0x2d')][_0xebdc('0x33')]));_0x5d705f[_0xebdc('0x32')]=_0x5d705f[_0xebdc('0x32')][_0xebdc('0x34')]?_0x5d705f[_0xebdc('0x32')]:_0x36ef83[_0xebdc('0x31')];if(_0x29ada7[_0xebdc('0x2d')][_0xebdc('0x3f')]){_0x5d705f[_0xebdc('0x40')]=[{'all':!![]}];}_0x5d705f=_[_0xebdc('0x3c')]({},_0x5d705f,_0x29ada7[_0xebdc('0x3d')]);return db[_0xebdc('0x3e')][_0xebdc('0x44')](_0x5d705f)[_0xebdc('0x25')](handleEntityNotFound(_0x1d250a,null))[_0xebdc('0x25')](respondWithResult(_0x1d250a,null))[_0xebdc('0x45')](handleError(_0x1d250a,null));};exports[_0xebdc('0x46')]=function(_0x240c28,_0x5423d1){return db[_0xebdc('0x3e')][_0xebdc('0x46')](_0x240c28[_0xebdc('0x47')],{})[_0xebdc('0x25')](respondWithResult(_0x5423d1,0xc9))[_0xebdc('0x45')](handleError(_0x5423d1,null));};exports[_0xebdc('0x24')]=function(_0x2c1864,_0x5b1014){if(_0x2c1864[_0xebdc('0x47')]['id']){delete _0x2c1864[_0xebdc('0x47')]['id'];}return db[_0xebdc('0x3e')]['find']({'where':{'id':_0x2c1864['params']['id']}})[_0xebdc('0x25')](handleEntityNotFound(_0x5b1014,null))[_0xebdc('0x25')](saveUpdates(_0x2c1864['body'],null))['then'](respondWithResult(_0x5b1014,null))[_0xebdc('0x45')](handleError(_0x5b1014,null));};exports[_0xebdc('0x26')]=function(_0x37f4b2,_0xc90ec7){return db[_0xebdc('0x3e')][_0xebdc('0x44')]({'where':{'id':_0x37f4b2[_0xebdc('0x48')]['id']}})[_0xebdc('0x25')](handleEntityNotFound(_0xc90ec7,null))[_0xebdc('0x25')](removeEntity(_0xc90ec7,null))['catch'](handleError(_0xc90ec7,null));};exports[_0xebdc('0x49')]=function(_0x3c84cc,_0x1c104f,_0x241a97){var _0x4bdcee={};var _0x14eadb={};var _0x29bc5c;var _0x61f790;return db[_0xebdc('0x3e')][_0xebdc('0x4a')]({'where':{'id':_0x3c84cc[_0xebdc('0x48')]['id']}})[_0xebdc('0x25')](handleEntityNotFound(_0x1c104f,null))[_0xebdc('0x25')](function(_0x1cf107){if(_0x1cf107){_0x29bc5c=_0x1cf107;_0x14eadb[_0xebdc('0x31')]=_[_0xebdc('0x2e')](db[_0xebdc('0x4b')][_0xebdc('0x2a')]);_0x14eadb[_0xebdc('0x2d')]=_[_0xebdc('0x2e')](_0x3c84cc[_0xebdc('0x2d')]);_0x14eadb[_0xebdc('0x2f')]=_[_0xebdc('0x30')](_0x14eadb[_0xebdc('0x31')],_0x14eadb[_0xebdc('0x2d')]);_0x4bdcee['attributes']=_[_0xebdc('0x30')](_0x14eadb[_0xebdc('0x31')],qs[_0xebdc('0x33')](_0x3c84cc[_0xebdc('0x2d')][_0xebdc('0x33')]));_0x4bdcee[_0xebdc('0x32')]=_0x4bdcee[_0xebdc('0x32')][_0xebdc('0x34')]?_0x4bdcee['attributes']:_0x14eadb['model'];_0x4bdcee[_0xebdc('0x37')]=qs[_0xebdc('0x38')](_0x3c84cc[_0xebdc('0x2d')]['sort']);_0x4bdcee[_0xebdc('0x39')]=qs[_0xebdc('0x2f')](_[_0xebdc('0x3a')](_0x3c84cc[_0xebdc('0x2d')],_0x14eadb[_0xebdc('0x2f')]));if(_0x3c84cc[_0xebdc('0x2d')][_0xebdc('0x3b')]){_0x4bdcee[_0xebdc('0x39')]=_['merge'](_0x4bdcee[_0xebdc('0x39')],{'$or':_[_0xebdc('0x29')](_0x4bdcee[_0xebdc('0x32')],function(_0x6e1283){var _0x37cc40={};_0x37cc40[_0x6e1283]={'$like':'%'+_0x3c84cc[_0xebdc('0x2d')]['filter']+'%'};return _0x37cc40;})});}_0x4bdcee=_[_0xebdc('0x3c')]({},_0x4bdcee,_0x3c84cc[_0xebdc('0x3d')]);return _0x29bc5c[_0xebdc('0x49')](_0x4bdcee);}})[_0xebdc('0x25')](function(_0x324ea4){if(_0x324ea4){_0x61f790=_0x324ea4[_0xebdc('0x34')];if(!_0x3c84cc[_0xebdc('0x2d')][_0xebdc('0x35')]('nolimit')){_0x4bdcee['limit']=qs[_0xebdc('0x1e')](_0x3c84cc[_0xebdc('0x2d')][_0xebdc('0x1e')]);_0x4bdcee[_0xebdc('0x1d')]=qs[_0xebdc('0x1d')](_0x3c84cc['query'][_0xebdc('0x1d')]);}return _0x29bc5c[_0xebdc('0x49')](_0x4bdcee);}})['then'](function(_0x5b50f6){if(_0x5b50f6){return _0x5b50f6?{'count':_0x61f790,'rows':_0x5b50f6}:null;}})[_0xebdc('0x25')](respondWithResult(_0x1c104f,null))[_0xebdc('0x45')](handleError(_0x1c104f,null));};exports[_0xebdc('0x4c')]=function(_0x24ac50,_0x8ae12e,_0x39e71c){var _0x57efc6={};var _0x18efdb={};var _0x424d0d;var _0x545dc9;return db[_0xebdc('0x3e')][_0xebdc('0x4a')]({'where':{'id':_0x24ac50['params']['id']}})['then'](handleEntityNotFound(_0x8ae12e,null))[_0xebdc('0x25')](function(_0x1525c4){if(_0x1525c4){_0x424d0d=_0x1525c4;_0x18efdb[_0xebdc('0x31')]=_[_0xebdc('0x2e')](db['SalesforceField'][_0xebdc('0x2a')]);_0x18efdb[_0xebdc('0x2d')]=_[_0xebdc('0x2e')](_0x24ac50[_0xebdc('0x2d')]);_0x18efdb['filters']=_[_0xebdc('0x30')](_0x18efdb[_0xebdc('0x31')],_0x18efdb['query']);_0x57efc6[_0xebdc('0x32')]=_[_0xebdc('0x30')](_0x18efdb['model'],qs[_0xebdc('0x33')](_0x24ac50[_0xebdc('0x2d')]['fields']));_0x57efc6['attributes']=_0x57efc6[_0xebdc('0x32')][_0xebdc('0x34')]?_0x57efc6[_0xebdc('0x32')]:_0x18efdb[_0xebdc('0x31')];_0x57efc6[_0xebdc('0x37')]=qs['sort'](_0x24ac50[_0xebdc('0x2d')][_0xebdc('0x38')]);_0x57efc6[_0xebdc('0x39')]=qs[_0xebdc('0x2f')](_[_0xebdc('0x3a')](_0x24ac50['query'],_0x18efdb[_0xebdc('0x2f')]));if(_0x24ac50[_0xebdc('0x2d')][_0xebdc('0x3b')]){_0x57efc6['where']=_[_0xebdc('0x3c')](_0x57efc6[_0xebdc('0x39')],{'$or':_[_0xebdc('0x29')](_0x57efc6[_0xebdc('0x32')],function(_0x3a749f){var _0x353600={};_0x353600[_0x3a749f]={'$like':'%'+_0x24ac50[_0xebdc('0x2d')][_0xebdc('0x3b')]+'%'};return _0x353600;})});}_0x57efc6=_[_0xebdc('0x3c')]({},_0x57efc6,_0x24ac50[_0xebdc('0x3d')]);return _0x424d0d['getSubjects'](_0x57efc6);}})[_0xebdc('0x25')](function(_0x1b37e9){if(_0x1b37e9){_0x545dc9=_0x1b37e9[_0xebdc('0x34')];if(!_0x24ac50[_0xebdc('0x2d')][_0xebdc('0x35')]('nolimit')){_0x57efc6[_0xebdc('0x1e')]=qs[_0xebdc('0x1e')](_0x24ac50[_0xebdc('0x2d')][_0xebdc('0x1e')]);_0x57efc6[_0xebdc('0x1d')]=qs[_0xebdc('0x1d')](_0x24ac50['query'][_0xebdc('0x1d')]);}return _0x424d0d[_0xebdc('0x4c')](_0x57efc6);}})['then'](function(_0x37a502){if(_0x37a502){return _0x37a502?{'count':_0x545dc9,'rows':_0x37a502}:null;}})[_0xebdc('0x25')](respondWithResult(_0x8ae12e,null))[_0xebdc('0x45')](handleError(_0x8ae12e,null));};exports[_0xebdc('0x4d')]=function(_0x295dc7,_0x2d5f87,_0x20737e){var _0x5c4c68={};var _0x5eacc4={};var _0x24a396;var _0x24256c;return db[_0xebdc('0x3e')]['findOne']({'where':{'id':_0x295dc7['params']['id']}})[_0xebdc('0x25')](handleEntityNotFound(_0x2d5f87,null))[_0xebdc('0x25')](function(_0x3169bd){if(_0x3169bd){_0x24a396=_0x3169bd;_0x5eacc4['model']=_[_0xebdc('0x2e')](db[_0xebdc('0x4b')]['rawAttributes']);_0x5eacc4['query']=_[_0xebdc('0x2e')](_0x295dc7['query']);_0x5eacc4[_0xebdc('0x2f')]=_['intersection'](_0x5eacc4[_0xebdc('0x31')],_0x5eacc4['query']);_0x5c4c68[_0xebdc('0x32')]=_[_0xebdc('0x30')](_0x5eacc4['model'],qs[_0xebdc('0x33')](_0x295dc7[_0xebdc('0x2d')][_0xebdc('0x33')]));_0x5c4c68[_0xebdc('0x32')]=_0x5c4c68[_0xebdc('0x32')]['length']?_0x5c4c68[_0xebdc('0x32')]:_0x5eacc4['model'];_0x5c4c68[_0xebdc('0x37')]=qs[_0xebdc('0x38')](_0x295dc7[_0xebdc('0x2d')][_0xebdc('0x38')]);_0x5c4c68[_0xebdc('0x39')]=qs['filters'](_[_0xebdc('0x3a')](_0x295dc7[_0xebdc('0x2d')],_0x5eacc4['filters']));if(_0x295dc7[_0xebdc('0x2d')][_0xebdc('0x3b')]){_0x5c4c68[_0xebdc('0x39')]=_[_0xebdc('0x3c')](_0x5c4c68['where'],{'$or':_[_0xebdc('0x29')](_0x5c4c68[_0xebdc('0x32')],function(_0x371e29){var _0x3a3316={};_0x3a3316[_0x371e29]={'$like':'%'+_0x295dc7[_0xebdc('0x2d')][_0xebdc('0x3b')]+'%'};return _0x3a3316;})});}_0x5c4c68=_[_0xebdc('0x3c')]({},_0x5c4c68,_0x295dc7[_0xebdc('0x3d')]);return _0x24a396[_0xebdc('0x4d')](_0x5c4c68);}})[_0xebdc('0x25')](function(_0x2e05ea){if(_0x2e05ea){_0x24256c=_0x2e05ea['length'];if(!_0x295dc7[_0xebdc('0x2d')][_0xebdc('0x35')]('nolimit')){_0x5c4c68['limit']=qs[_0xebdc('0x1e')](_0x295dc7[_0xebdc('0x2d')][_0xebdc('0x1e')]);_0x5c4c68[_0xebdc('0x1d')]=qs[_0xebdc('0x1d')](_0x295dc7[_0xebdc('0x2d')]['offset']);}return _0x24a396[_0xebdc('0x4d')](_0x5c4c68);}})['then'](function(_0x1b2bf3){if(_0x1b2bf3){return _0x1b2bf3?{'count':_0x24256c,'rows':_0x1b2bf3}:null;}})['then'](respondWithResult(_0x2d5f87,null))[_0xebdc('0x45')](handleError(_0x2d5f87,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2a865da..74acb7e 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 _0x82e1=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash'];(function(_0x579f0c,_0x34c753){var _0x204b6c=function(_0xf7e537){while(--_0xf7e537){_0x579f0c['push'](_0x579f0c['shift']());}};_0x204b6c(++_0x34c753);}(_0x82e1,0x14f));var _0x182e=function(_0x1f6691,_0x3a3d46){_0x1f6691=_0x1f6691-0x0;var _0xf786b6=_0x82e1[_0x1f6691];return _0xf786b6;};'use strict';var _=require(_0x182e('0x0'));var util=require(_0x182e('0x1'));var logger=require(_0x182e('0x2'))(_0x182e('0x3'));var moment=require(_0x182e('0x4'));var BPromise=require(_0x182e('0x5'));var rp=require(_0x182e('0x6'));var fs=require('fs');var path=require(_0x182e('0x7'));var rimraf=require(_0x182e('0x8'));var config=require('../../config/environment');var attributes=require(_0x182e('0x9'));module[_0x182e('0xa')]=function(_0xff8683,_0x43e01f){return _0xff8683[_0x182e('0xb')](_0x182e('0xc'),attributes,{'tableName':_0x182e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc61=['bluebird','request-promise','path','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0xfc61,0xcd));var _0x1fc6=function(_0x2f4d5f,_0xda7f63){_0x2f4d5f=_0x2f4d5f-0x0;var _0x13dfeb=_0xfc61[_0x2f4d5f];return _0x13dfeb;};'use strict';var _=require(_0x1fc6('0x0'));var util=require('util');var logger=require(_0x1fc6('0x1'))(_0x1fc6('0x2'));var moment=require(_0x1fc6('0x3'));var BPromise=require(_0x1fc6('0x4'));var rp=require(_0x1fc6('0x5'));var fs=require('fs');var path=require(_0x1fc6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1fc6('0x7'));module[_0x1fc6('0x8')]=function(_0x494c4b,_0x19ec57){return _0x494c4b['define'](_0x1fc6('0x9'),attributes,{'tableName':_0x1fc6('0xa'),'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 deeb041..2a0277d 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 _0xf3bc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x3fa779,_0x5ddb62){var _0x115a7a=function(_0x4acda7){while(--_0x4acda7){_0x3fa779['push'](_0x3fa779['shift']());}};_0x115a7a(++_0x5ddb62);}(_0xf3bc,0xf9));var _0xcf3b=function(_0x432ff4,_0x5ba032){_0x432ff4=_0x432ff4-0x0;var _0x43e649=_0xf3bc[_0x432ff4];return _0x43e649;};'use strict';var _=require(_0xcf3b('0x0'));var util=require('util');var moment=require(_0xcf3b('0x1'));var BPromise=require('bluebird');var rs=require(_0xcf3b('0x2'));var fs=require('fs');var Redis=require(_0xcf3b('0x3'));var db=require(_0xcf3b('0x4'))['db'];var utils=require(_0xcf3b('0x5'));var logger=require(_0xcf3b('0x6'))(_0xcf3b('0x7'));var config=require(_0xcf3b('0x8'));var jayson=require(_0xcf3b('0x9'));var client=jayson[_0xcf3b('0xa')][_0xcf3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc565,_0x5d9240,_0x4d4fcb){return new BPromise(function(_0x4080c3,_0x13081f){return client[_0xcf3b('0xc')](_0x2cc565,_0x4d4fcb)['then'](function(_0xfd65fa){logger[_0xcf3b('0xd')](_0xcf3b('0xe'),_0x5d9240,'request\x20sent');logger['debug'](_0xcf3b('0xf'),_0x5d9240,_0xcf3b('0x10'),JSON[_0xcf3b('0x11')](_0xfd65fa));if(_0xfd65fa['error']){if(_0xfd65fa[_0xcf3b('0x12')][_0xcf3b('0x13')]===0x1f4){logger[_0xcf3b('0x12')](_0xcf3b('0xe'),_0x5d9240,_0xfd65fa[_0xcf3b('0x12')][_0xcf3b('0x14')]);return _0x13081f(_0xfd65fa[_0xcf3b('0x12')][_0xcf3b('0x14')]);}logger['error'](_0xcf3b('0xe'),_0x5d9240,_0xfd65fa[_0xcf3b('0x12')][_0xcf3b('0x14')]);return _0x4080c3(_0xfd65fa[_0xcf3b('0x12')][_0xcf3b('0x14')]);}else{logger[_0xcf3b('0xd')](_0xcf3b('0xe'),_0x5d9240,_0xcf3b('0x10'));_0x4080c3(_0xfd65fa[_0xcf3b('0x15')]['message']);}})[_0xcf3b('0x16')](function(_0xf62ac2){logger[_0xcf3b('0x12')](_0xcf3b('0xe'),_0x5d9240,_0xf62ac2);_0x13081f(_0xf62ac2);});});} \ No newline at end of file +var _0x7a5a=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x148339,_0x1f2f0c){var _0xf5f5b8=function(_0x83763d){while(--_0x83763d){_0x148339['push'](_0x148339['shift']());}};_0xf5f5b8(++_0x1f2f0c);}(_0x7a5a,0x1de));var _0xa7a5=function(_0x4dedbf,_0x97fc78){_0x4dedbf=_0x4dedbf-0x0;var _0x558421=_0x7a5a[_0x4dedbf];return _0x558421;};'use strict';var _=require(_0xa7a5('0x0'));var util=require(_0xa7a5('0x1'));var moment=require(_0xa7a5('0x2'));var BPromise=require('bluebird');var rs=require(_0xa7a5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa7a5('0x4'))['db'];var utils=require(_0xa7a5('0x5'));var logger=require(_0xa7a5('0x6'))('rpc');var config=require(_0xa7a5('0x7'));var jayson=require(_0xa7a5('0x8'));var client=jayson[_0xa7a5('0x9')][_0xa7a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b3193,_0x33bbca,_0x5e3758){return new BPromise(function(_0x4e4625,_0x44a951){return client[_0xa7a5('0xb')](_0x4b3193,_0x5e3758)[_0xa7a5('0xc')](function(_0x4b4ae0){logger[_0xa7a5('0xd')](_0xa7a5('0xe'),_0x33bbca,_0xa7a5('0xf'));logger[_0xa7a5('0x10')](_0xa7a5('0x11'),_0x33bbca,_0xa7a5('0xf'),JSON['stringify'](_0x4b4ae0));if(_0x4b4ae0['error']){if(_0x4b4ae0[_0xa7a5('0x12')]['code']===0x1f4){logger[_0xa7a5('0x12')](_0xa7a5('0xe'),_0x33bbca,_0x4b4ae0[_0xa7a5('0x12')][_0xa7a5('0x13')]);return _0x44a951(_0x4b4ae0[_0xa7a5('0x12')]['message']);}logger['error'](_0xa7a5('0xe'),_0x33bbca,_0x4b4ae0['error'][_0xa7a5('0x13')]);return _0x4e4625(_0x4b4ae0[_0xa7a5('0x12')][_0xa7a5('0x13')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x33bbca,_0xa7a5('0xf'));_0x4e4625(_0x4b4ae0['result'][_0xa7a5('0x13')]);}})[_0xa7a5('0x14')](function(_0x13a362){logger['error'](_0xa7a5('0xe'),_0x33bbca,_0x13a362);_0x44a951(_0x13a362);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index b54f28f..1e0e7a3 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 _0x5b41=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','put','update','destroy','multer','util'];(function(_0x2b0ae8,_0x52c16e){var _0x5b05d0=function(_0x37076c){while(--_0x37076c){_0x2b0ae8['push'](_0x2b0ae8['shift']());}};_0x5b05d0(++_0x52c16e);}(_0x5b41,0x19e));var _0x15b4=function(_0x57546d,_0x3def56){_0x57546d=_0x57546d-0x0;var _0x22b6a3=_0x5b41[_0x57546d];return _0x22b6a3;};'use strict';var multer=require(_0x15b4('0x0'));var util=require(_0x15b4('0x1'));var path=require(_0x15b4('0x2'));var timeout=require('connect-timeout');var express=require(_0x15b4('0x3'));var router=express[_0x15b4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15b4('0x5'));var config=require(_0x15b4('0x6'));var controller=require('./intSalesforceField.controller');router[_0x15b4('0x7')]('/',auth[_0x15b4('0x8')](),controller[_0x15b4('0x9')]);router[_0x15b4('0x7')](_0x15b4('0xa'),auth['isAuthenticated'](),controller[_0x15b4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x15b4('0xc')]);router[_0x15b4('0xd')]('/:id',auth[_0x15b4('0x8')](),controller[_0x15b4('0xe')]);router['delete'](_0x15b4('0xa'),auth[_0x15b4('0x8')](),controller[_0x15b4('0xf')]);module['exports']=router; \ No newline at end of file +var _0xe4c7=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','isAuthenticated','index','get','show','post','create','put','/:id','destroy'];(function(_0x122404,_0x57f4bc){var _0x52e833=function(_0x2ef210){while(--_0x2ef210){_0x122404['push'](_0x122404['shift']());}};_0x52e833(++_0x57f4bc);}(_0xe4c7,0x17d));var _0x7e4c=function(_0x4b784d,_0x5efb2f){_0x4b784d=_0x4b784d-0x0;var _0x2cdeaf=_0xe4c7[_0x4b784d];return _0x2cdeaf;};'use strict';var multer=require(_0x7e4c('0x0'));var util=require(_0x7e4c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7e4c('0x2'));var router=express[_0x7e4c('0x3')]();var fs_extra=require(_0x7e4c('0x4'));var auth=require(_0x7e4c('0x5'));var interaction=require(_0x7e4c('0x6'));var config=require(_0x7e4c('0x7'));var controller=require(_0x7e4c('0x8'));router['get']('/',auth[_0x7e4c('0x9')](),controller[_0x7e4c('0xa')]);router[_0x7e4c('0xb')]('/:id',auth[_0x7e4c('0x9')](),controller[_0x7e4c('0xc')]);router[_0x7e4c('0xd')]('/',auth[_0x7e4c('0x9')](),controller[_0x7e4c('0xe')]);router[_0x7e4c('0xf')]('/:id',auth[_0x7e4c('0x9')](),controller['update']);router['delete'](_0x7e4c('0x10'),auth[_0x7e4c('0x9')](),controller[_0x7e4c('0x11')]);module[_0x7e4c('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 90b09d0..9d64d47 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 _0x9c71=['STRING','ENUM','variable','sequelize','exports','string','customVariable','keyValue','picklist'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x9c71,0xd2));var _0x19c7=function(_0x5cf550,_0x44c563){_0x5cf550=_0x5cf550-0x0;var _0x378411=_0x9c71[_0x5cf550];return _0x378411;};'use strict';var Sequelize=require(_0x19c7('0x0'));module[_0x19c7('0x1')]={'type':{'type':Sequelize['ENUM'](_0x19c7('0x2'),'variable',_0x19c7('0x3'),_0x19c7('0x4'),_0x19c7('0x5')),'defaultValue':_0x19c7('0x2')},'content':{'type':Sequelize[_0x19c7('0x6')]},'key':{'type':Sequelize[_0x19c7('0x6')]},'keyType':{'type':Sequelize[_0x19c7('0x7')]('string',_0x19c7('0x8'),'customVariable')},'keyContent':{'type':Sequelize[_0x19c7('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x19c7('0x6')]}}; \ No newline at end of file +var _0x5c2b=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x506285,_0x9a53a0){var _0x5dfd01=function(_0x52cd16){while(--_0x52cd16){_0x506285['push'](_0x506285['shift']());}};_0x5dfd01(++_0x9a53a0);}(_0x5c2b,0x1e0));var _0xb5c2=function(_0x59eccc,_0x44827a){_0x59eccc=_0x59eccc-0x0;var _0x3623fa=_0x5c2b[_0x59eccc];return _0x3623fa;};'use strict';var Sequelize=require(_0xb5c2('0x0'));module[_0xb5c2('0x1')]={'type':{'type':Sequelize['ENUM'](_0xb5c2('0x2'),'variable',_0xb5c2('0x3'),_0xb5c2('0x4'),_0xb5c2('0x5')),'defaultValue':_0xb5c2('0x2')},'content':{'type':Sequelize[_0xb5c2('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xb5c2('0x2'),_0xb5c2('0x7'),_0xb5c2('0x3'))},'keyContent':{'type':Sequelize[_0xb5c2('0x6')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xb5c2('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 02ed904..a015781 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 _0xcc5a=['util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceField','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','rawAttributes','options','find','create','catch','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache'];(function(_0x476499,_0x233a48){var _0x1311e3=function(_0x22c672){while(--_0x22c672){_0x476499['push'](_0x476499['shift']());}};_0x1311e3(++_0x233a48);}(_0xcc5a,0x92));var _0xacc5=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xcc5a[_0x37d0bc];return _0x170e60;};'use strict';var emlformat=require(_0xacc5('0x0'));var rimraf=require(_0xacc5('0x1'));var zipdir=require(_0xacc5('0x2'));var jsonpatch=require(_0xacc5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xacc5('0x4'));var Mustache=require(_0xacc5('0x5'));var util=require(_0xacc5('0x6'));var path=require('path');var sox=require(_0xacc5('0x7'));var csv=require('to-csv');var ejs=require(_0xacc5('0x8'));var fs=require('fs');var fs_extra=require(_0xacc5('0x9'));var _=require(_0xacc5('0xa'));var squel=require(_0xacc5('0xb'));var crypto=require(_0xacc5('0xc'));var jsforce=require(_0xacc5('0xd'));var deskjs=require(_0xacc5('0xe'));var toCsv=require('to-csv');var querystring=require(_0xacc5('0xf'));var Papa=require(_0xacc5('0x10'));var Redis=require(_0xacc5('0x11'));var authService=require(_0xacc5('0x12'));var qs=require(_0xacc5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xacc5('0x14'));var logger=require(_0xacc5('0x15'))('api');var utils=require(_0xacc5('0x16'));var config=require(_0xacc5('0x17'));var licenseUtil=require(_0xacc5('0x18'));var db=require(_0xacc5('0x19'))['db'];function respondWithStatusCode(_0x50019e,_0x3e6a88){_0x3e6a88=_0x3e6a88||0xcc;return function(_0xfda569){if(_0xfda569){return _0x50019e[_0xacc5('0x1a')](_0x3e6a88);}return _0x50019e[_0xacc5('0x1b')](_0x3e6a88)[_0xacc5('0x1c')]();};}function respondWithResult(_0x2ff792,_0xf5b3ca){_0xf5b3ca=_0xf5b3ca||0xc8;return function(_0x18fe7f){if(_0x18fe7f){return _0x2ff792[_0xacc5('0x1b')](_0xf5b3ca)['json'](_0x18fe7f);}};}function respondWithFilteredResult(_0x245d75,_0x1aeeab){return function(_0x3d6dba){if(_0x3d6dba){var _0x1cd58c=typeof _0x1aeeab['offset']==='undefined'&&typeof _0x1aeeab[_0xacc5('0x1d')]===_0xacc5('0x1e');var _0x435049=_0x3d6dba[_0xacc5('0x1f')];var _0x5dfa31=_0x1cd58c?0x0:_0x1aeeab[_0xacc5('0x20')];var _0x2792e1=_0x1cd58c?_0x3d6dba[_0xacc5('0x1f')]:_0x1aeeab['offset']+_0x1aeeab['limit'];var _0x393c53;if(_0x2792e1>=_0x435049){_0x2792e1=_0x435049;_0x393c53=0xc8;}else{_0x393c53=0xce;}_0x245d75['status'](_0x393c53);return _0x245d75[_0xacc5('0x21')]('Content-Range',_0x5dfa31+'-'+_0x2792e1+'/'+_0x435049)['json'](_0x3d6dba);}return null;};}function patchUpdates(_0x50afd7){return function(_0x497f67){try{jsonpatch[_0xacc5('0x22')](_0x497f67,_0x50afd7,!![]);}catch(_0x5ef92a){return BPromise[_0xacc5('0x23')](_0x5ef92a);}return _0x497f67[_0xacc5('0x24')]();};}function saveUpdates(_0x51354c,_0x336fc5){return function(_0x2e7234){if(_0x2e7234){return _0x2e7234[_0xacc5('0x25')](_0x51354c)[_0xacc5('0x26')](function(_0x2f104d){return _0x2f104d;});}return null;};}function removeEntity(_0x5c9cab,_0x5bee70){return function(_0x19878d){if(_0x19878d){return _0x19878d[_0xacc5('0x27')]()[_0xacc5('0x26')](function(){_0x5c9cab['status'](0xcc)[_0xacc5('0x1c')]();});}};}function handleEntityNotFound(_0x5d5b19,_0x155d17){return function(_0x13c3e8){if(!_0x13c3e8){_0x5d5b19['sendStatus'](0x194);}return _0x13c3e8;};}function handleError(_0x1f9c01,_0x1fa07c){_0x1fa07c=_0x1fa07c||0x1f4;return function(_0x5a559a){logger[_0xacc5('0x28')](_0x5a559a[_0xacc5('0x29')]);if(_0x5a559a[_0xacc5('0x2a')]){delete _0x5a559a[_0xacc5('0x2a')];}_0x1f9c01[_0xacc5('0x1b')](_0x1fa07c)[_0xacc5('0x2b')](_0x5a559a);};}exports[_0xacc5('0x2c')]=function(_0x286798,_0x2489db){var _0x34bbb3={},_0x534ceb={},_0x53f29e={'count':0x0,'rows':[]};var _0x203728=_[_0xacc5('0x2d')](db[_0xacc5('0x2e')]['rawAttributes'],function(_0x197a38){return{'name':_0x197a38['fieldName'],'type':_0x197a38[_0xacc5('0x2f')][_0xacc5('0x30')]};});_0x534ceb[_0xacc5('0x31')]=_['map'](_0x203728,'name');_0x534ceb[_0xacc5('0x32')]=_[_0xacc5('0x33')](_0x286798['query']);_0x534ceb[_0xacc5('0x34')]=_[_0xacc5('0x35')](_0x534ceb['model'],_0x534ceb['query']);_0x34bbb3[_0xacc5('0x36')]=_[_0xacc5('0x35')](_0x534ceb[_0xacc5('0x31')],qs[_0xacc5('0x37')](_0x286798[_0xacc5('0x32')]['fields']));_0x34bbb3[_0xacc5('0x36')]=_0x34bbb3[_0xacc5('0x36')][_0xacc5('0x38')]?_0x34bbb3[_0xacc5('0x36')]:_0x534ceb[_0xacc5('0x31')];if(!_0x286798['query'][_0xacc5('0x39')]('nolimit')){_0x34bbb3[_0xacc5('0x1d')]=qs[_0xacc5('0x1d')](_0x286798[_0xacc5('0x32')][_0xacc5('0x1d')]);_0x34bbb3[_0xacc5('0x20')]=qs[_0xacc5('0x20')](_0x286798[_0xacc5('0x32')][_0xacc5('0x20')]);}_0x34bbb3[_0xacc5('0x3a')]=qs[_0xacc5('0x3b')](_0x286798['query'][_0xacc5('0x3b')]);_0x34bbb3[_0xacc5('0x3c')]=qs[_0xacc5('0x34')](_[_0xacc5('0x3d')](_0x286798['query'],_0x534ceb[_0xacc5('0x34')]),_0x203728);if(_0x286798[_0xacc5('0x32')][_0xacc5('0x3e')]){_0x34bbb3[_0xacc5('0x3c')]=_[_0xacc5('0x3f')](_0x34bbb3[_0xacc5('0x3c')],{'$or':_[_0xacc5('0x2d')](_0x203728,function(_0x4a515f){if(_0x4a515f[_0xacc5('0x2f')]!=='VIRTUAL'){var _0x50d7d8={};_0x50d7d8[_0x4a515f[_0xacc5('0x2a')]]={'$like':'%'+_0x286798['query']['filter']+'%'};return _0x50d7d8;}})});}_0x34bbb3=_[_0xacc5('0x3f')]({},_0x34bbb3,_0x286798['options']);var _0x448227={'where':_0x34bbb3[_0xacc5('0x3c')]};return db[_0xacc5('0x2e')][_0xacc5('0x1f')](_0x448227)[_0xacc5('0x26')](function(_0xa3e0ae){_0x53f29e[_0xacc5('0x1f')]=_0xa3e0ae;if(_0x286798[_0xacc5('0x32')][_0xacc5('0x40')]){_0x34bbb3[_0xacc5('0x41')]=[{'all':!![]}];}return db[_0xacc5('0x2e')][_0xacc5('0x42')](_0x34bbb3);})[_0xacc5('0x26')](function(_0x2db864){_0x53f29e[_0xacc5('0x43')]=_0x2db864;return _0x53f29e;})[_0xacc5('0x26')](respondWithFilteredResult(_0x2489db,_0x34bbb3))['catch'](handleError(_0x2489db,null));};exports[_0xacc5('0x44')]=function(_0x59b008,_0xb14e3e){var _0x3954ea={'raw':!![],'where':{'id':_0x59b008[_0xacc5('0x45')]['id']}},_0x4f7c05={};_0x4f7c05[_0xacc5('0x31')]=_[_0xacc5('0x33')](db[_0xacc5('0x2e')][_0xacc5('0x46')]);_0x4f7c05[_0xacc5('0x32')]=_[_0xacc5('0x33')](_0x59b008[_0xacc5('0x32')]);_0x4f7c05[_0xacc5('0x34')]=_[_0xacc5('0x35')](_0x4f7c05['model'],_0x4f7c05['query']);_0x3954ea['attributes']=_[_0xacc5('0x35')](_0x4f7c05[_0xacc5('0x31')],qs[_0xacc5('0x37')](_0x59b008[_0xacc5('0x32')][_0xacc5('0x37')]));_0x3954ea[_0xacc5('0x36')]=_0x3954ea[_0xacc5('0x36')][_0xacc5('0x38')]?_0x3954ea[_0xacc5('0x36')]:_0x4f7c05[_0xacc5('0x31')];if(_0x59b008[_0xacc5('0x32')]['includeAll']){_0x3954ea[_0xacc5('0x41')]=[{'all':!![]}];}_0x3954ea=_[_0xacc5('0x3f')]({},_0x3954ea,_0x59b008[_0xacc5('0x47')]);return db[_0xacc5('0x2e')][_0xacc5('0x48')](_0x3954ea)[_0xacc5('0x26')](handleEntityNotFound(_0xb14e3e,null))[_0xacc5('0x26')](respondWithResult(_0xb14e3e,null))['catch'](handleError(_0xb14e3e,null));};exports[_0xacc5('0x49')]=function(_0xc8727a,_0x57147a){return db[_0xacc5('0x2e')][_0xacc5('0x49')](_0xc8727a['body'],{})[_0xacc5('0x26')](respondWithResult(_0x57147a,0xc9))[_0xacc5('0x4a')](handleError(_0x57147a,null));};exports[_0xacc5('0x25')]=function(_0x548b3d,_0x5aec93){if(_0x548b3d[_0xacc5('0x4b')]['id']){delete _0x548b3d['body']['id'];}return db[_0xacc5('0x2e')][_0xacc5('0x48')]({'where':{'id':_0x548b3d[_0xacc5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aec93,null))[_0xacc5('0x26')](saveUpdates(_0x548b3d[_0xacc5('0x4b')],null))[_0xacc5('0x26')](respondWithResult(_0x5aec93,null))['catch'](handleError(_0x5aec93,null));};exports[_0xacc5('0x27')]=function(_0x38031d,_0x537be8){return db[_0xacc5('0x2e')][_0xacc5('0x48')]({'where':{'id':_0x38031d['params']['id']}})['then'](handleEntityNotFound(_0x537be8,null))[_0xacc5('0x26')](removeEntity(_0x537be8,null))[_0xacc5('0x4a')](handleError(_0x537be8,null));}; \ No newline at end of file +var _0xc029=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','map','type','options','includeAll','include','then','rows','catch','show','params','length','merge','find','create','body','update','destroy','eml-format','zip-dir','request-promise','moment','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','error','stack','name','send','index','SalesforceField','rawAttributes','model','keys','query','filters'];(function(_0x36087c,_0x34daad){var _0x24563e=function(_0x485aa8){while(--_0x485aa8){_0x36087c['push'](_0x36087c['shift']());}};_0x24563e(++_0x34daad);}(_0xc029,0xe3));var _0x9c02=function(_0x11dfbb,_0x1f4c8a){_0x11dfbb=_0x11dfbb-0x0;var _0x22d016=_0xc029[_0x11dfbb];return _0x22d016;};'use strict';var emlformat=require(_0x9c02('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9c02('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9c02('0x2'));var moment=require(_0x9c02('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9c02('0x4'));var sox=require('sox');var csv=require(_0x9c02('0x5'));var ejs=require(_0x9c02('0x6'));var fs=require('fs');var fs_extra=require(_0x9c02('0x7'));var _=require('lodash');var squel=require(_0x9c02('0x8'));var crypto=require(_0x9c02('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9c02('0xa'));var toCsv=require('to-csv');var querystring=require(_0x9c02('0xb'));var Papa=require('papaparse');var Redis=require(_0x9c02('0xc'));var authService=require(_0x9c02('0xd'));var qs=require(_0x9c02('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c02('0xf'));var logger=require('../../config/logger')(_0x9c02('0x10'));var utils=require('../../config/utils');var config=require(_0x9c02('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30596d,_0x2214c1){_0x2214c1=_0x2214c1||0xcc;return function(_0x413079){if(_0x413079){return _0x30596d[_0x9c02('0x12')](_0x2214c1);}return _0x30596d[_0x9c02('0x13')](_0x2214c1)[_0x9c02('0x14')]();};}function respondWithResult(_0x44c5df,_0x51e6e7){_0x51e6e7=_0x51e6e7||0xc8;return function(_0x1e1b83){if(_0x1e1b83){return _0x44c5df[_0x9c02('0x13')](_0x51e6e7)[_0x9c02('0x15')](_0x1e1b83);}};}function respondWithFilteredResult(_0x1581e4,_0x31935c){return function(_0x3d099b){if(_0x3d099b){var _0x28d47e=typeof _0x31935c[_0x9c02('0x16')]===_0x9c02('0x17')&&typeof _0x31935c[_0x9c02('0x18')]==='undefined';var _0x5e5d59=_0x3d099b[_0x9c02('0x19')];var _0x3ac835=_0x28d47e?0x0:_0x31935c['offset'];var _0x314e38=_0x28d47e?_0x3d099b[_0x9c02('0x19')]:_0x31935c[_0x9c02('0x16')]+_0x31935c[_0x9c02('0x18')];var _0x10f11c;if(_0x314e38>=_0x5e5d59){_0x314e38=_0x5e5d59;_0x10f11c=0xc8;}else{_0x10f11c=0xce;}_0x1581e4[_0x9c02('0x13')](_0x10f11c);return _0x1581e4['set'](_0x9c02('0x1a'),_0x3ac835+'-'+_0x314e38+'/'+_0x5e5d59)[_0x9c02('0x15')](_0x3d099b);}return null;};}function patchUpdates(_0x1405b6){return function(_0x57187c){try{jsonpatch[_0x9c02('0x1b')](_0x57187c,_0x1405b6,!![]);}catch(_0x2a6933){return BPromise[_0x9c02('0x1c')](_0x2a6933);}return _0x57187c[_0x9c02('0x1d')]();};}function saveUpdates(_0x346579,_0x1cd264){return function(_0x65121){if(_0x65121){return _0x65121['update'](_0x346579)['then'](function(_0xfad90c){return _0xfad90c;});}return null;};}function removeEntity(_0x1a0cb1,_0x3767f7){return function(_0x405bf1){if(_0x405bf1){return _0x405bf1['destroy']()['then'](function(){_0x1a0cb1[_0x9c02('0x13')](0xcc)[_0x9c02('0x14')]();});}};}function handleEntityNotFound(_0x262bb8,_0x33fc4c){return function(_0xb14714){if(!_0xb14714){_0x262bb8[_0x9c02('0x12')](0x194);}return _0xb14714;};}function handleError(_0x5cd08f,_0x3ca637){_0x3ca637=_0x3ca637||0x1f4;return function(_0x35a3b6){logger[_0x9c02('0x1e')](_0x35a3b6[_0x9c02('0x1f')]);if(_0x35a3b6[_0x9c02('0x20')]){delete _0x35a3b6[_0x9c02('0x20')];}_0x5cd08f[_0x9c02('0x13')](_0x3ca637)[_0x9c02('0x21')](_0x35a3b6);};}exports[_0x9c02('0x22')]=function(_0x1ed3b2,_0x3e9c56){var _0x58b33b={},_0x3d78cd={},_0x3e918a={'count':0x0,'rows':[]};var _0x2fbda2=_['map'](db[_0x9c02('0x23')][_0x9c02('0x24')],function(_0x363852){return{'name':_0x363852['fieldName'],'type':_0x363852['type']['key']};});_0x3d78cd[_0x9c02('0x25')]=_['map'](_0x2fbda2,_0x9c02('0x20'));_0x3d78cd['query']=_[_0x9c02('0x26')](_0x1ed3b2[_0x9c02('0x27')]);_0x3d78cd[_0x9c02('0x28')]=_[_0x9c02('0x29')](_0x3d78cd[_0x9c02('0x25')],_0x3d78cd[_0x9c02('0x27')]);_0x58b33b[_0x9c02('0x2a')]=_[_0x9c02('0x29')](_0x3d78cd['model'],qs[_0x9c02('0x2b')](_0x1ed3b2[_0x9c02('0x27')][_0x9c02('0x2b')]));_0x58b33b[_0x9c02('0x2a')]=_0x58b33b['attributes']['length']?_0x58b33b[_0x9c02('0x2a')]:_0x3d78cd['model'];if(!_0x1ed3b2[_0x9c02('0x27')][_0x9c02('0x2c')](_0x9c02('0x2d'))){_0x58b33b[_0x9c02('0x18')]=qs[_0x9c02('0x18')](_0x1ed3b2['query'][_0x9c02('0x18')]);_0x58b33b[_0x9c02('0x16')]=qs['offset'](_0x1ed3b2[_0x9c02('0x27')][_0x9c02('0x16')]);}_0x58b33b['order']=qs[_0x9c02('0x2e')](_0x1ed3b2[_0x9c02('0x27')][_0x9c02('0x2e')]);_0x58b33b[_0x9c02('0x2f')]=qs[_0x9c02('0x28')](_[_0x9c02('0x30')](_0x1ed3b2['query'],_0x3d78cd[_0x9c02('0x28')]),_0x2fbda2);if(_0x1ed3b2[_0x9c02('0x27')][_0x9c02('0x31')]){_0x58b33b[_0x9c02('0x2f')]=_['merge'](_0x58b33b[_0x9c02('0x2f')],{'$or':_[_0x9c02('0x32')](_0x2fbda2,function(_0x537aaf){if(_0x537aaf[_0x9c02('0x33')]!=='VIRTUAL'){var _0x5d6233={};_0x5d6233[_0x537aaf['name']]={'$like':'%'+_0x1ed3b2['query'][_0x9c02('0x31')]+'%'};return _0x5d6233;}})});}_0x58b33b=_['merge']({},_0x58b33b,_0x1ed3b2[_0x9c02('0x34')]);var _0x262dfd={'where':_0x58b33b[_0x9c02('0x2f')]};return db[_0x9c02('0x23')]['count'](_0x262dfd)['then'](function(_0x15fb33){_0x3e918a[_0x9c02('0x19')]=_0x15fb33;if(_0x1ed3b2[_0x9c02('0x27')][_0x9c02('0x35')]){_0x58b33b[_0x9c02('0x36')]=[{'all':!![]}];}return db[_0x9c02('0x23')]['findAll'](_0x58b33b);})[_0x9c02('0x37')](function(_0x49711a){_0x3e918a[_0x9c02('0x38')]=_0x49711a;return _0x3e918a;})[_0x9c02('0x37')](respondWithFilteredResult(_0x3e9c56,_0x58b33b))[_0x9c02('0x39')](handleError(_0x3e9c56,null));};exports[_0x9c02('0x3a')]=function(_0x14a835,_0x2ddef2){var _0x247c06={'raw':!![],'where':{'id':_0x14a835[_0x9c02('0x3b')]['id']}},_0x1c9f91={};_0x1c9f91[_0x9c02('0x25')]=_[_0x9c02('0x26')](db[_0x9c02('0x23')][_0x9c02('0x24')]);_0x1c9f91[_0x9c02('0x27')]=_[_0x9c02('0x26')](_0x14a835[_0x9c02('0x27')]);_0x1c9f91[_0x9c02('0x28')]=_[_0x9c02('0x29')](_0x1c9f91[_0x9c02('0x25')],_0x1c9f91[_0x9c02('0x27')]);_0x247c06[_0x9c02('0x2a')]=_[_0x9c02('0x29')](_0x1c9f91[_0x9c02('0x25')],qs[_0x9c02('0x2b')](_0x14a835['query'][_0x9c02('0x2b')]));_0x247c06[_0x9c02('0x2a')]=_0x247c06['attributes'][_0x9c02('0x3c')]?_0x247c06[_0x9c02('0x2a')]:_0x1c9f91[_0x9c02('0x25')];if(_0x14a835[_0x9c02('0x27')][_0x9c02('0x35')]){_0x247c06[_0x9c02('0x36')]=[{'all':!![]}];}_0x247c06=_[_0x9c02('0x3d')]({},_0x247c06,_0x14a835[_0x9c02('0x34')]);return db[_0x9c02('0x23')][_0x9c02('0x3e')](_0x247c06)[_0x9c02('0x37')](handleEntityNotFound(_0x2ddef2,null))[_0x9c02('0x37')](respondWithResult(_0x2ddef2,null))[_0x9c02('0x39')](handleError(_0x2ddef2,null));};exports[_0x9c02('0x3f')]=function(_0x49db8f,_0x242b9e){return db[_0x9c02('0x23')]['create'](_0x49db8f[_0x9c02('0x40')],{})['then'](respondWithResult(_0x242b9e,0xc9))[_0x9c02('0x39')](handleError(_0x242b9e,null));};exports[_0x9c02('0x41')]=function(_0x5ec274,_0x1f8e29){if(_0x5ec274[_0x9c02('0x40')]['id']){delete _0x5ec274['body']['id'];}return db[_0x9c02('0x23')]['find']({'where':{'id':_0x5ec274[_0x9c02('0x3b')]['id']}})[_0x9c02('0x37')](handleEntityNotFound(_0x1f8e29,null))[_0x9c02('0x37')](saveUpdates(_0x5ec274['body'],null))['then'](respondWithResult(_0x1f8e29,null))['catch'](handleError(_0x1f8e29,null));};exports[_0x9c02('0x42')]=function(_0x10e342,_0x2262f2){return db['SalesforceField'][_0x9c02('0x3e')]({'where':{'id':_0x10e342[_0x9c02('0x3b')]['id']}})[_0x9c02('0x37')](handleEntityNotFound(_0x2262f2,null))[_0x9c02('0x37')](removeEntity(_0x2262f2,null))[_0x9c02('0x39')](handleError(_0x2262f2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2c94b3e..d85bc9c 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 _0x8da5=['./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x59eacf,_0x56ec4a){var _0x5d74f2=function(_0x5476ed){while(--_0x5476ed){_0x59eacf['push'](_0x59eacf['shift']());}};_0x5d74f2(++_0x56ec4a);}(_0x8da5,0x129));var _0x58da=function(_0x407891,_0x40afa0){_0x407891=_0x407891-0x0;var _0x387672=_0x8da5[_0x407891];return _0x387672;};'use strict';var _=require(_0x58da('0x0'));var util=require('util');var logger=require(_0x58da('0x1'))(_0x58da('0x2'));var moment=require(_0x58da('0x3'));var BPromise=require(_0x58da('0x4'));var rp=require(_0x58da('0x5'));var fs=require('fs');var path=require(_0x58da('0x6'));var rimraf=require(_0x58da('0x7'));var config=require(_0x58da('0x8'));var attributes=require(_0x58da('0x9'));module[_0x58da('0xa')]=function(_0x5f3be9,_0x1acad1){return _0x5f3be9[_0x58da('0xb')](_0x58da('0xc'),attributes,{'tableName':_0x58da('0xd'),'paranoid':![],'indexes':[{'name':_0x58da('0xe'),'fields':[_0x58da('0xf'),_0x58da('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f6a=['moment','request-promise','path','rimraf','./intSalesforceField.attributes','exports','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x5ce3df,_0x3cf5e6){var _0x5e8330=function(_0x189452){while(--_0x189452){_0x5ce3df['push'](_0x5ce3df['shift']());}};_0x5e8330(++_0x3cf5e6);}(_0x5f6a,0x7b));var _0xa5f6=function(_0x34faa0,_0x501bd7){_0x34faa0=_0x34faa0-0x0;var _0x4a4aa9=_0x5f6a[_0x34faa0];return _0x4a4aa9;};'use strict';var _=require(_0xa5f6('0x0'));var util=require(_0xa5f6('0x1'));var logger=require(_0xa5f6('0x2'))('api');var moment=require(_0xa5f6('0x3'));var BPromise=require('bluebird');var rp=require(_0xa5f6('0x4'));var fs=require('fs');var path=require(_0xa5f6('0x5'));var rimraf=require(_0xa5f6('0x6'));var config=require('../../config/environment');var attributes=require(_0xa5f6('0x7'));module[_0xa5f6('0x8')]=function(_0x27c0fe,_0xd4243c){return _0x27c0fe[_0xa5f6('0x9')]('SalesforceField',attributes,{'tableName':_0xa5f6('0xa'),'paranoid':![],'indexes':[{'name':_0xa5f6('0xb'),'fields':[_0xa5f6('0xc'),_0xa5f6('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 7df8abb..17a4ae2 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 _0xac22=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x219550,_0x1a3481){var _0x32b10d=function(_0x2c97bd){while(--_0x2c97bd){_0x219550['push'](_0x219550['shift']());}};_0x32b10d(++_0x1a3481);}(_0xac22,0x156));var _0x2ac2=function(_0xac36f5,_0x48df2a){_0xac36f5=_0xac36f5-0x0;var _0x4ecfa1=_0xac22[_0xac36f5];return _0x4ecfa1;};'use strict';var _=require(_0x2ac2('0x0'));var util=require(_0x2ac2('0x1'));var moment=require(_0x2ac2('0x2'));var BPromise=require(_0x2ac2('0x3'));var rs=require(_0x2ac2('0x4'));var fs=require('fs');var Redis=require(_0x2ac2('0x5'));var db=require(_0x2ac2('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ac2('0x7'))('rpc');var config=require(_0x2ac2('0x8'));var jayson=require(_0x2ac2('0x9'));var client=jayson[_0x2ac2('0xa')][_0x2ac2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x36225b,_0x4dc971,_0x2309ea){return new BPromise(function(_0x90b5cd,_0x4e6ce5){return client['request'](_0x36225b,_0x2309ea)['then'](function(_0x4534a1){logger[_0x2ac2('0xc')](_0x2ac2('0xd'),_0x4dc971,'request\x20sent');logger[_0x2ac2('0xe')](_0x2ac2('0xf'),_0x4dc971,_0x2ac2('0x10'),JSON[_0x2ac2('0x11')](_0x4534a1));if(_0x4534a1['error']){if(_0x4534a1[_0x2ac2('0x12')]['code']===0x1f4){logger['error'](_0x2ac2('0xd'),_0x4dc971,_0x4534a1[_0x2ac2('0x12')][_0x2ac2('0x13')]);return _0x4e6ce5(_0x4534a1['error']['message']);}logger['error']('SalesforceField,\x20%s,\x20%s',_0x4dc971,_0x4534a1[_0x2ac2('0x12')][_0x2ac2('0x13')]);return _0x90b5cd(_0x4534a1[_0x2ac2('0x12')][_0x2ac2('0x13')]);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x4dc971,_0x2ac2('0x10'));_0x90b5cd(_0x4534a1[_0x2ac2('0x14')][_0x2ac2('0x13')]);}})['catch'](function(_0x402c3d){logger[_0x2ac2('0x12')](_0x2ac2('0xd'),_0x4dc971,_0x402c3d);_0x4e6ce5(_0x402c3d);});});} \ No newline at end of file +var _0xc367=['error','SalesforceField,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xdf5cd5,_0x4276de){var _0x474328=function(_0x4d2939){while(--_0x4d2939){_0xdf5cd5['push'](_0xdf5cd5['shift']());}};_0x474328(++_0x4276de);}(_0xc367,0x1bd));var _0x7c36=function(_0x480d8f,_0x472134){_0x480d8f=_0x480d8f-0x0;var _0x1b1b08=_0xc367[_0x480d8f];return _0x1b1b08;};'use strict';var _=require('lodash');var util=require(_0x7c36('0x0'));var moment=require(_0x7c36('0x1'));var BPromise=require(_0x7c36('0x2'));var rs=require(_0x7c36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c36('0x4'))['db'];var utils=require(_0x7c36('0x5'));var logger=require(_0x7c36('0x6'))('rpc');var config=require(_0x7c36('0x7'));var jayson=require(_0x7c36('0x8'));var client=jayson[_0x7c36('0x9')][_0x7c36('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16d9c7,_0x534ef2,_0x4d3708){return new BPromise(function(_0x2608f6,_0x5a7231){return client['request'](_0x16d9c7,_0x4d3708)[_0x7c36('0xb')](function(_0x11da28){logger[_0x7c36('0xc')]('SalesforceField,\x20%s,\x20%s',_0x534ef2,_0x7c36('0xd'));logger[_0x7c36('0xe')](_0x7c36('0xf'),_0x534ef2,_0x7c36('0xd'),JSON[_0x7c36('0x10')](_0x11da28));if(_0x11da28[_0x7c36('0x11')]){if(_0x11da28[_0x7c36('0x11')]['code']===0x1f4){logger['error'](_0x7c36('0x12'),_0x534ef2,_0x11da28[_0x7c36('0x11')][_0x7c36('0x13')]);return _0x5a7231(_0x11da28[_0x7c36('0x11')][_0x7c36('0x13')]);}logger[_0x7c36('0x11')](_0x7c36('0x12'),_0x534ef2,_0x11da28[_0x7c36('0x11')][_0x7c36('0x13')]);return _0x2608f6(_0x11da28[_0x7c36('0x11')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x534ef2,'request\x20sent');_0x2608f6(_0x11da28['result']['message']);}})[_0x7c36('0x14')](function(_0x28f27d){logger['error'](_0x7c36('0x12'),_0x534ef2,_0x28f27d);_0x5a7231(_0x28f27d);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 3c81254..e1fed7a 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 _0xd45b=['show','/:id/configurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id'];(function(_0x112cba,_0x2131fa){var _0x1ab284=function(_0x348b4b){while(--_0x348b4b){_0x112cba['push'](_0x112cba['shift']());}};_0x1ab284(++_0x2131fa);}(_0xd45b,0x11f));var _0xbd45=function(_0x20c29f,_0x5d4801){_0x20c29f=_0x20c29f-0x0;var _0x302b4a=_0xd45b[_0x20c29f];return _0x302b4a;};'use strict';var multer=require(_0xbd45('0x0'));var util=require(_0xbd45('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbd45('0x2'));var router=express[_0xbd45('0x3')]();var fs_extra=require(_0xbd45('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbd45('0x5'));var config=require(_0xbd45('0x6'));var controller=require(_0xbd45('0x7'));router[_0xbd45('0x8')]('/',auth[_0xbd45('0x9')](),controller[_0xbd45('0xa')]);router[_0xbd45('0x8')](_0xbd45('0xb'),auth['isAuthenticated'](),controller[_0xbd45('0xc')]);router[_0xbd45('0x8')](_0xbd45('0xd'),auth[_0xbd45('0x9')](),controller['getConfigurations']);router[_0xbd45('0x8')](_0xbd45('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0xbd45('0xf')]('/',auth[_0xbd45('0x9')](),controller[_0xbd45('0x10')]);router[_0xbd45('0xf')](_0xbd45('0xd'),auth[_0xbd45('0x9')](),controller[_0xbd45('0x11')]);router[_0xbd45('0x12')]('/:id',auth[_0xbd45('0x9')](),controller[_0xbd45('0x13')]);router[_0xbd45('0x14')]('/:id',auth[_0xbd45('0x9')](),controller[_0xbd45('0x15')]);module[_0xbd45('0x16')]=router; \ No newline at end of file +var _0x0e4f=['express','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x289330,_0x54f85a){var _0x22d2d0=function(_0x4bdcf9){while(--_0x4bdcf9){_0x289330['push'](_0x289330['shift']());}};_0x22d2d0(++_0x54f85a);}(_0x0e4f,0x1f4));var _0xf0e4=function(_0x38a42d,_0x3c9085){_0x38a42d=_0x38a42d-0x0;var _0x2670fe=_0x0e4f[_0x38a42d];return _0x2670fe;};'use strict';var multer=require(_0xf0e4('0x0'));var util=require(_0xf0e4('0x1'));var path=require(_0xf0e4('0x2'));var timeout=require(_0xf0e4('0x3'));var express=require(_0xf0e4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf0e4('0x5'));var interaction=require(_0xf0e4('0x6'));var config=require('../../config/environment');var controller=require(_0xf0e4('0x7'));router[_0xf0e4('0x8')]('/',auth[_0xf0e4('0x9')](),controller[_0xf0e4('0xa')]);router[_0xf0e4('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf0e4('0xb')]);router[_0xf0e4('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xf0e4('0xc')]);router[_0xf0e4('0x8')](_0xf0e4('0xd'),auth[_0xf0e4('0x9')](),controller[_0xf0e4('0xe')]);router[_0xf0e4('0xf')]('/',auth[_0xf0e4('0x9')](),controller[_0xf0e4('0x10')]);router[_0xf0e4('0xf')](_0xf0e4('0x11'),auth['isAuthenticated'](),controller[_0xf0e4('0x12')]);router[_0xf0e4('0x13')]('/:id',auth[_0xf0e4('0x9')](),controller['update']);router[_0xf0e4('0x14')](_0xf0e4('0x15'),auth[_0xf0e4('0x9')](),controller[_0xf0e4('0x16')]);module[_0xf0e4('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 188b445..1b3d9df 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 _0x308d=['sequelize','exports','STRING','username'];(function(_0x15ef74,_0x1a57a0){var _0x6ae279=function(_0x440acd){while(--_0x440acd){_0x15ef74['push'](_0x15ef74['shift']());}};_0x6ae279(++_0x1a57a0);}(_0x308d,0x1cc));var _0xd308=function(_0x3c0007,_0x55170c){_0x3c0007=_0x3c0007-0x0;var _0x4404b0=_0x308d[_0x3c0007];return _0x4404b0;};'use strict';var Sequelize=require(_0xd308('0x0'));module[_0xd308('0x1')]={'name':{'type':Sequelize[_0xd308('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd308('0x2')],'unique':_0xd308('0x3')},'password':{'type':Sequelize[_0xd308('0x2')]},'email':{'type':Sequelize[_0xd308('0x2')]},'remoteUri':{'type':Sequelize[_0xd308('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xc4f1=['STRING','remoteUri','sequelize','exports'];(function(_0x233b2a,_0x440cd1){var _0x4e828a=function(_0x5ea850){while(--_0x5ea850){_0x233b2a['push'](_0x233b2a['shift']());}};_0x4e828a(++_0x440cd1);}(_0xc4f1,0x1b2));var _0x1c4f=function(_0x2826c6,_0x481561){_0x2826c6=_0x2826c6-0x0;var _0x2f1996=_0xc4f1[_0x2826c6];return _0x2f1996;};'use strict';var Sequelize=require(_0x1c4f('0x0'));module[_0x1c4f('0x1')]={'name':{'type':Sequelize[_0x1c4f('0x2')]},'description':{'type':Sequelize[_0x1c4f('0x2')]},'username':{'type':Sequelize[_0x1c4f('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1c4f('0x2')]},'email':{'type':Sequelize[_0x1c4f('0x2')]},'remoteUri':{'type':Sequelize[_0x1c4f('0x2')],'unique':_0x1c4f('0x3')},'serverUrl':{'type':Sequelize[_0x1c4f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 376fb34..0179949 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 _0x7bf5=['attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','catch','params','options','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','close_code','notify','incident_state','severity','category','made_sla','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','knowledge','closed_at','cmdb_ci','impact','active','business_service','priority','rfc','time_worked','expected_start','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','closed_by','parent_incident','sys_id','reopened_by','urgency','problem_id','company','assigned_to','comments','sla_due','approval','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','upon_approval','correlation_id','location','password','email','serverUrl','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','internalType','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','push','concat','ServiceNow\x20error:\x20','statusCode','send','test','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','apply','reject','save','update','destroy','error','stack','name','index','map','ServicenowAccount','rawAttributes','type','key','query','keys','filters','intersection','model'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x7bf5,0x82));var _0x57bf=function(_0x4539af,_0xff049f){_0x4539af=_0x4539af-0x0;var _0x5e1d3e=_0x7bf5[_0x4539af];return _0x5e1d3e;};'use strict';var emlformat=require(_0x57bf('0x0'));var rimraf=require(_0x57bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x57bf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x57bf('0x3'));var util=require(_0x57bf('0x4'));var path=require(_0x57bf('0x5'));var sox=require(_0x57bf('0x6'));var csv=require('to-csv');var ejs=require(_0x57bf('0x7'));var fs=require('fs');var fs_extra=require(_0x57bf('0x8'));var _=require(_0x57bf('0x9'));var squel=require('squel');var crypto=require(_0x57bf('0xa'));var jsforce=require(_0x57bf('0xb'));var deskjs=require(_0x57bf('0xc'));var toCsv=require(_0x57bf('0xd'));var querystring=require(_0x57bf('0xe'));var Papa=require(_0x57bf('0xf'));var Redis=require(_0x57bf('0x10'));var authService=require(_0x57bf('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x57bf('0x12'));var logger=require('../../config/logger')(_0x57bf('0x13'));var utils=require('../../config/utils');var config=require(_0x57bf('0x14'));var licenseUtil=require(_0x57bf('0x15'));var db=require(_0x57bf('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3fc112,_0xa94d5b){_0xa94d5b=_0xa94d5b||0xcc;return function(_0x394327){if(_0x394327){return _0x3fc112[_0x57bf('0x17')](_0xa94d5b);}return _0x3fc112['status'](_0xa94d5b)[_0x57bf('0x18')]();};}function respondWithResult(_0x10c70b,_0x20cf50){_0x20cf50=_0x20cf50||0xc8;return function(_0xdebdb5){if(_0xdebdb5){return _0x10c70b[_0x57bf('0x19')](_0x20cf50)[_0x57bf('0x1a')](_0xdebdb5);}};}function respondWithFilteredResult(_0xf946e6,_0x2cb865){return function(_0x2ca282){if(_0x2ca282){var _0x1b8df4=typeof _0x2cb865[_0x57bf('0x1b')]===_0x57bf('0x1c')&&typeof _0x2cb865['limit']===_0x57bf('0x1c');var _0x950aae=_0x2ca282[_0x57bf('0x1d')];var _0x17025c=_0x1b8df4?0x0:_0x2cb865['offset'];var _0x3bde66=_0x1b8df4?_0x2ca282['count']:_0x2cb865[_0x57bf('0x1b')]+_0x2cb865['limit'];var _0x21ef62;if(_0x3bde66>=_0x950aae){_0x3bde66=_0x950aae;_0x21ef62=0xc8;}else{_0x21ef62=0xce;}_0xf946e6[_0x57bf('0x19')](_0x21ef62);return _0xf946e6['set']('Content-Range',_0x17025c+'-'+_0x3bde66+'/'+_0x950aae)[_0x57bf('0x1a')](_0x2ca282);}return null;};}function patchUpdates(_0x3fb28f){return function(_0x142a40){try{jsonpatch[_0x57bf('0x1e')](_0x142a40,_0x3fb28f,!![]);}catch(_0x40b8df){return BPromise[_0x57bf('0x1f')](_0x40b8df);}return _0x142a40[_0x57bf('0x20')]();};}function saveUpdates(_0x3851b7,_0x5081e2){return function(_0x50a17f){if(_0x50a17f){return _0x50a17f[_0x57bf('0x21')](_0x3851b7)['then'](function(_0x1531bd){return _0x1531bd;});}return null;};}function removeEntity(_0x2d843a,_0x17057b){return function(_0x242634){if(_0x242634){return _0x242634[_0x57bf('0x22')]()['then'](function(){_0x2d843a['status'](0xcc)[_0x57bf('0x18')]();});}};}function handleEntityNotFound(_0x476b56,_0x54f3af){return function(_0x3c173d){if(!_0x3c173d){_0x476b56[_0x57bf('0x17')](0x194);}return _0x3c173d;};}function handleError(_0x1fa65d,_0x1ee7f6){_0x1ee7f6=_0x1ee7f6||0x1f4;return function(_0x3292ce){logger[_0x57bf('0x23')](_0x3292ce[_0x57bf('0x24')]);if(_0x3292ce[_0x57bf('0x25')]){delete _0x3292ce[_0x57bf('0x25')];}_0x1fa65d[_0x57bf('0x19')](_0x1ee7f6)['send'](_0x3292ce);};}exports[_0x57bf('0x26')]=function(_0x2cec39,_0x370178){var _0x2991f2={},_0x5e3278={},_0xf95a00={'count':0x0,'rows':[]};var _0x17aaf9=_[_0x57bf('0x27')](db[_0x57bf('0x28')][_0x57bf('0x29')],function(_0x16b7c9){return{'name':_0x16b7c9['fieldName'],'type':_0x16b7c9[_0x57bf('0x2a')][_0x57bf('0x2b')]};});_0x5e3278['model']=_[_0x57bf('0x27')](_0x17aaf9,_0x57bf('0x25'));_0x5e3278[_0x57bf('0x2c')]=_[_0x57bf('0x2d')](_0x2cec39[_0x57bf('0x2c')]);_0x5e3278[_0x57bf('0x2e')]=_[_0x57bf('0x2f')](_0x5e3278[_0x57bf('0x30')],_0x5e3278['query']);_0x2991f2[_0x57bf('0x31')]=_[_0x57bf('0x2f')](_0x5e3278['model'],qs[_0x57bf('0x32')](_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x32')]));_0x2991f2[_0x57bf('0x31')]=_0x2991f2[_0x57bf('0x31')][_0x57bf('0x33')]?_0x2991f2[_0x57bf('0x31')]:_0x5e3278['model'];if(!_0x2cec39['query'][_0x57bf('0x34')](_0x57bf('0x35'))){_0x2991f2[_0x57bf('0x36')]=qs[_0x57bf('0x36')](_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x36')]);_0x2991f2[_0x57bf('0x1b')]=qs['offset'](_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x1b')]);}_0x2991f2[_0x57bf('0x37')]=qs[_0x57bf('0x38')](_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x38')]);_0x2991f2[_0x57bf('0x39')]=qs['filters'](_[_0x57bf('0x3a')](_0x2cec39[_0x57bf('0x2c')],_0x5e3278['filters']),_0x17aaf9);if(_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x3b')]){_0x2991f2[_0x57bf('0x39')]=_[_0x57bf('0x3c')](_0x2991f2[_0x57bf('0x39')],{'$or':_[_0x57bf('0x27')](_0x17aaf9,function(_0x5cd5d1){if(_0x5cd5d1[_0x57bf('0x2a')]!==_0x57bf('0x3d')){var _0x509eb8={};_0x509eb8[_0x5cd5d1['name']]={'$like':'%'+_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x3b')]+'%'};return _0x509eb8;}})});}_0x2991f2=_['merge']({},_0x2991f2,_0x2cec39['options']);var _0x184974={'where':_0x2991f2[_0x57bf('0x39')]};return db[_0x57bf('0x28')]['count'](_0x184974)[_0x57bf('0x3e')](function(_0x3d4a9e){_0xf95a00[_0x57bf('0x1d')]=_0x3d4a9e;if(_0x2cec39[_0x57bf('0x2c')][_0x57bf('0x3f')]){_0x2991f2[_0x57bf('0x40')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x2991f2);})[_0x57bf('0x3e')](function(_0x16ad7c){_0xf95a00['rows']=_0x16ad7c;return _0xf95a00;})[_0x57bf('0x3e')](respondWithFilteredResult(_0x370178,_0x2991f2))[_0x57bf('0x41')](handleError(_0x370178,null));};exports['show']=function(_0xea5295,_0x52ae24){var _0x531c29={'raw':![],'where':{'id':_0xea5295[_0x57bf('0x42')]['id']}},_0x8eef64={};_0x8eef64[_0x57bf('0x30')]=_[_0x57bf('0x2d')](db['ServicenowAccount'][_0x57bf('0x29')]);_0x8eef64[_0x57bf('0x2c')]=_['keys'](_0xea5295[_0x57bf('0x2c')]);_0x8eef64[_0x57bf('0x2e')]=_[_0x57bf('0x2f')](_0x8eef64[_0x57bf('0x30')],_0x8eef64[_0x57bf('0x2c')]);_0x531c29[_0x57bf('0x31')]=_[_0x57bf('0x2f')](_0x8eef64['model'],qs[_0x57bf('0x32')](_0xea5295['query'][_0x57bf('0x32')]));_0x531c29[_0x57bf('0x31')]=_0x531c29[_0x57bf('0x31')][_0x57bf('0x33')]?_0x531c29[_0x57bf('0x31')]:_0x8eef64[_0x57bf('0x30')];if(_0xea5295[_0x57bf('0x2c')][_0x57bf('0x3f')]){_0x531c29['include']=[{'all':!![]}];}_0x531c29=_['merge']({},_0x531c29,_0xea5295[_0x57bf('0x43')]);return db['ServicenowAccount'][_0x57bf('0x44')](_0x531c29)[_0x57bf('0x3e')](handleEntityNotFound(_0x52ae24,null))['then'](respondWithResult(_0x52ae24,null))['catch'](handleError(_0x52ae24,null));};exports[_0x57bf('0x45')]=function(_0x27c023,_0x173685){return db['ServicenowAccount'][_0x57bf('0x45')](_0x27c023['body'],{})[_0x57bf('0x3e')](respondWithResult(_0x173685,0xc9))['catch'](handleError(_0x173685,null));};exports['update']=function(_0x363cb0,_0x9e70c4){if(_0x363cb0[_0x57bf('0x46')]['id']){delete _0x363cb0[_0x57bf('0x46')]['id'];}return db[_0x57bf('0x28')][_0x57bf('0x44')]({'where':{'id':_0x363cb0[_0x57bf('0x42')]['id']}})[_0x57bf('0x3e')](handleEntityNotFound(_0x9e70c4,null))['then'](saveUpdates(_0x363cb0[_0x57bf('0x46')],null))[_0x57bf('0x3e')](respondWithResult(_0x9e70c4,null))['catch'](handleError(_0x9e70c4,null));};exports[_0x57bf('0x22')]=function(_0x3b3891,_0x421a9e){return db['ServicenowAccount'][_0x57bf('0x44')]({'where':{'id':_0x3b3891[_0x57bf('0x42')]['id']}})[_0x57bf('0x3e')](handleEntityNotFound(_0x421a9e,null))['then'](removeEntity(_0x421a9e,null))[_0x57bf('0x41')](handleError(_0x421a9e,null));};exports['getConfigurations']=function(_0x5d1df0,_0x5ef29e,_0x3ebd7c){var _0x1bb073={};var _0x4dd66f={};var _0x410d47;var _0x5add9d;return db[_0x57bf('0x28')][_0x57bf('0x47')]({'where':{'id':_0x5d1df0[_0x57bf('0x42')]['id']}})[_0x57bf('0x3e')](handleEntityNotFound(_0x5ef29e,null))[_0x57bf('0x3e')](function(_0x827ed9){if(_0x827ed9){_0x410d47=_0x827ed9;_0x4dd66f[_0x57bf('0x30')]=_[_0x57bf('0x2d')](db['ServicenowConfiguration'][_0x57bf('0x29')]);_0x4dd66f[_0x57bf('0x2c')]=_['keys'](_0x5d1df0[_0x57bf('0x2c')]);_0x4dd66f[_0x57bf('0x2e')]=_[_0x57bf('0x2f')](_0x4dd66f[_0x57bf('0x30')],_0x4dd66f['query']);_0x1bb073[_0x57bf('0x31')]=_[_0x57bf('0x2f')](_0x4dd66f[_0x57bf('0x30')],qs['fields'](_0x5d1df0['query'][_0x57bf('0x32')]));_0x1bb073['attributes']=_0x1bb073[_0x57bf('0x31')]['length']?_0x1bb073['attributes']:_0x4dd66f['model'];_0x1bb073[_0x57bf('0x37')]=qs[_0x57bf('0x38')](_0x5d1df0[_0x57bf('0x2c')][_0x57bf('0x38')]);_0x1bb073[_0x57bf('0x39')]=qs[_0x57bf('0x2e')](_[_0x57bf('0x3a')](_0x5d1df0[_0x57bf('0x2c')],_0x4dd66f['filters']));if(_0x5d1df0[_0x57bf('0x2c')][_0x57bf('0x3b')]){_0x1bb073[_0x57bf('0x39')]=_[_0x57bf('0x3c')](_0x1bb073[_0x57bf('0x39')],{'$or':_[_0x57bf('0x27')](_0x1bb073[_0x57bf('0x31')],function(_0x4f386d){var _0x42083b={};_0x42083b[_0x4f386d]={'$like':'%'+_0x5d1df0[_0x57bf('0x2c')][_0x57bf('0x3b')]+'%'};return _0x42083b;})});}_0x1bb073=_[_0x57bf('0x3c')]({},_0x1bb073,_0x5d1df0[_0x57bf('0x43')]);return _0x410d47['getConfigurations'](_0x1bb073);}})[_0x57bf('0x3e')](function(_0x2812f6){if(_0x2812f6){_0x5add9d=_0x2812f6[_0x57bf('0x33')];if(!_0x5d1df0[_0x57bf('0x2c')][_0x57bf('0x34')]('nolimit')){_0x1bb073[_0x57bf('0x36')]=qs[_0x57bf('0x36')](_0x5d1df0[_0x57bf('0x2c')]['limit']);_0x1bb073[_0x57bf('0x1b')]=qs[_0x57bf('0x1b')](_0x5d1df0['query'][_0x57bf('0x1b')]);}return _0x410d47[_0x57bf('0x48')](_0x1bb073);}})['then'](function(_0xfb6a51){if(_0xfb6a51){return _0xfb6a51?{'count':_0x5add9d,'rows':_0xfb6a51}:null;}})[_0x57bf('0x3e')](respondWithResult(_0x5ef29e,null))['catch'](handleError(_0x5ef29e,null));};exports[_0x57bf('0x49')]=function(_0x3b3e3e,_0x43fe09,_0x143e28){if(_0x3b3e3e[_0x57bf('0x46')]['id']){delete _0x3b3e3e[_0x57bf('0x46')]['id'];}return db[_0x57bf('0x28')][_0x57bf('0x47')]({'where':{'id':_0x3b3e3e['params']['id']}})[_0x57bf('0x3e')](handleEntityNotFound(_0x43fe09,null))[_0x57bf('0x3e')](function(_0x48301b){if(_0x48301b){_0x3b3e3e['body'][_0x57bf('0x4a')]=_0x48301b['id'];_0x3b3e3e['body'][_0x57bf('0x4b')]=integrations['getSubjects'](_0x3b3e3e['body'][_0x57bf('0x4c')],_0x3b3e3e[_0x57bf('0x46')]['type']);_0x3b3e3e['body'][_0x57bf('0x4d')]=integrations[_0x57bf('0x4e')](_0x3b3e3e[_0x57bf('0x46')][_0x57bf('0x4c')],_0x3b3e3e[_0x57bf('0x46')]['type']);return db[_0x57bf('0x4f')][_0x57bf('0x45')](_0x3b3e3e[_0x57bf('0x46')],{'include':[{'model':db[_0x57bf('0x50')],'as':_0x57bf('0x4b')},{'model':db['ServicenowField'],'as':_0x57bf('0x4d')}]});}return null;})[_0x57bf('0x3e')](respondWithResult(_0x43fe09,null))[_0x57bf('0x41')](handleError(_0x43fe09,null));};exports[_0x57bf('0x51')]=function(_0x423698,_0x47c544,_0x167041){var _0x538edb=['made_sla',_0x57bf('0x52'),'knowledge','subcategory',_0x57bf('0x53'),_0x57bf('0x54'),_0x57bf('0x55'),_0x57bf('0x56'),_0x57bf('0x57')];var _0x2ba4aa=['parent',_0x57bf('0x58'),'caused_by',_0x57bf('0x59'),_0x57bf('0x5a'),_0x57bf('0x5b'),'child_incidents','hold_reason',_0x57bf('0x5c'),_0x57bf('0x5d'),_0x57bf('0x5e'),_0x57bf('0x5f'),'opened_by',_0x57bf('0x60'),'sys_created_on',_0x57bf('0x61'),_0x57bf('0x62'),'sys_created_by',_0x57bf('0x63'),_0x57bf('0x37'),'calendar_stc',_0x57bf('0x64'),_0x57bf('0x65'),'delivery_plan',_0x57bf('0x66'),_0x57bf('0x67'),'work_notes_list',_0x57bf('0x68'),_0x57bf('0x69'),'sys_domain_path',_0x57bf('0x6a'),_0x57bf('0x6b'),_0x57bf('0x6c'),'opened_at','business_duration',_0x57bf('0x6d'),_0x57bf('0x6e'),_0x57bf('0x6f'),_0x57bf('0x70'),_0x57bf('0x71'),_0x57bf('0x72'),_0x57bf('0x73'),_0x57bf('0x74'),_0x57bf('0x75'),'close_code',_0x57bf('0x76'),_0x57bf('0x77'),_0x57bf('0x78'),_0x57bf('0x79'),_0x57bf('0x7a'),_0x57bf('0x7b'),_0x57bf('0x7c'),_0x57bf('0x7d'),_0x57bf('0x54'),'sys_class_name','close_notes',_0x57bf('0x7e'),'follow_up',_0x57bf('0x7f'),_0x57bf('0x80'),'contact_type',_0x57bf('0x81'),'incident_state',_0x57bf('0x82'),_0x57bf('0x83'),_0x57bf('0x84'),'reassignment_count','activity_due',_0x57bf('0x85'),_0x57bf('0x56'),_0x57bf('0x86'),_0x57bf('0x87'),_0x57bf('0x88'),_0x57bf('0x89'),'due_date',_0x57bf('0x8a'),_0x57bf('0x8b'),_0x57bf('0x8c'),'escalation',_0x57bf('0x8d'),_0x57bf('0x8e'),_0x57bf('0x8f'),_0x57bf('0x57')];var _0x1b91f3='';var _0x10bb76='';var _0x189790=[];var _0x27d0c6='';var _0x31da8f='';var _0x4c631a=[];var _0x5d41e8='';var _0x3cbddf='';var _0x1c7cae={};var _0x10ba08='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x423698['params']['id']},'attributes':['id','username',_0x57bf('0x90'),_0x57bf('0x91'),'remoteUri',_0x57bf('0x92')]})[_0x57bf('0x3e')](handleEntityNotFound(_0x47c544,null))[_0x57bf('0x3e')](function(_0x54097c){if(_0x54097c){_0x10ba08=_0x54097c[_0x57bf('0x93')];var _0x279516=_0x10ba08[_0x57bf('0x94')](-0x1);if(_0x279516==='/'){_0x10ba08=_0x10ba08[_0x57bf('0x95')](0x0,_0x10ba08['lastIndexOf'](_0x279516));}_0x3cbddf=util[_0x57bf('0x96')](_0x57bf('0x97'),_0x10ba08);_0x5d41e8=util[_0x57bf('0x96')](_0x57bf('0x98'),_0x10ba08);_0x1c7cae={'user':_0x54097c['username'],'pass':_0x54097c[_0x57bf('0x90')]};var _0xd09ad9={'method':_0x57bf('0x99'),'uri':_0x3cbddf+_0x57bf('0x9a'),'auth':_0x1c7cae,'json':!![]};return rp(_0xd09ad9);}})[_0x57bf('0x3e')](function(_0x14c8a6){if(_0x14c8a6[_0x57bf('0x9b')][_0x57bf('0x33')]>0x0){_0x1b91f3=_0x14c8a6[_0x57bf('0x9b')];}console[_0x57bf('0x9c')](_0x57bf('0x9d'),_0x1b91f3);_0x4c631a=[];_0x10bb76=Object[_0x57bf('0x9e')]([],_0x1b91f3);_['remove'](_0x10bb76,function(_0x25a235){return!_0x538edb[_0x57bf('0x9f')](_0x25a235[_0x57bf('0x25')]);});_0x10bb76[_0x57bf('0xa0')](function(_0x4f94d3){var _0x3a6e5c=createFieldObject(_0x5d41e8,_0x1c7cae,_0x4f94d3[_0x57bf('0xa1')],_0x4f94d3['name'],_0x4f94d3['label'],![]);_0x4c631a['push'](_0x3a6e5c);});return Promise[_0x57bf('0xa2')](_0x4c631a);})[_0x57bf('0x3e')](function(_0x5e30ea){_0x189790=_0x5e30ea;_0x27d0c6=Object[_0x57bf('0x9e')]([],_0x1b91f3);console['log'](_0x57bf('0xa3'),_0x1b91f3);_[_0x57bf('0xa4')](_0x27d0c6,function(_0x54af6b){return _0x2ba4aa['includes'](_0x54af6b[_0x57bf('0x25')]);});console[_0x57bf('0x9c')](_0x57bf('0xa5'),_0x27d0c6);_0x4c631a=[];_0x27d0c6['forEach'](function(_0x47f302){var _0x4fc897=createFieldObject(_0x5d41e8,_0x1c7cae,_0x47f302[_0x57bf('0xa1')],_0x47f302[_0x57bf('0x25')],_0x47f302[_0x57bf('0xa6')],!![]);_0x4c631a[_0x57bf('0xa7')](_0x4fc897);});return Promise['all'](_0x4c631a);})['then'](function(_0x2e39f6){_0x31da8f=_0x2e39f6;var _0x5b82ee=_0x189790[_0x57bf('0xa8')](_0x31da8f);return{'count':_0x5b82ee[_0x57bf('0x33')],'rows':_0x5b82ee};})[_0x57bf('0x3e')](respondWithResult(_0x47c544,null))[_0x57bf('0x41')](function(_0x2d0406){console[_0x57bf('0x9c')](_0x57bf('0xa9')+_0x2d0406);var _0x4b8e42=_0x423698[_0x57bf('0x2c')]['test']?0x1f4:_0x2d0406[_0x57bf('0xaa')]||0x1f4;logger[_0x57bf('0x23')](_0x2d0406[_0x57bf('0x24')]);delete _0x2d0406[_0x57bf('0x25')];if(_0x4b8e42===0x191){_0x4b8e42=0x190;}_0x47c544[_0x57bf('0x19')](_0x4b8e42)[_0x57bf('0xab')](_0x423698[_0x57bf('0x2c')][_0x57bf('0xac')]?{'message':'Wrong\x20credentials','statusCode':_0x2d0406[_0x57bf('0xaa')]}:_0x2d0406);});};function createFieldObject(_0x527f61,_0x49a2bb,_0x2059cf,_0x2a607d,_0x5e8091,_0x4d7315){return new Promise(function(_0x366234,_0x3bd95e){var _0x375858={'id':_0x2a607d,'name':_0x5e8091,'custom':_0x4d7315};if(_0x2059cf===_0x57bf('0xad')){_0x375858[_0x57bf('0x43')]=[{'name':'True','value':'true'},{'name':_0x57bf('0xae'),'value':_0x57bf('0xaf')}];_0x366234(_0x375858);}else{var _0x210933={'method':_0x57bf('0x99'),'uri':_0x527f61+_0x57bf('0xb0')+_0x2a607d,'auth':_0x49a2bb,'json':!![]};return rp(_0x210933)['then'](function(_0x78fe90){var _0x35b016=[];if(_0x78fe90['result'][_0x57bf('0x33')]>0x0){_0x78fe90['result'][_0x57bf('0xa0')](function(_0x3f048f){if(_0x3f048f[_0x57bf('0xb1')]===_0x57bf('0xaf')){var _0x59734d={'name':_0x3f048f[_0x57bf('0xa6')],'value':_0x3f048f[_0x57bf('0xb2')]};_0x35b016['push'](_0x59734d);}});}_0x375858[_0x57bf('0x43')]=_0x35b016;if(_0x375858[_0x57bf('0x43')]['length']>0x0){_0x366234(_0x375858);}else{if(_0x4d7315==![]){_0x366234();}else{_0x366234(_0x375858);}}});}});} \ No newline at end of file +var _0x4cdc=['test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','inactive','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','merge','find','create','body','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','getSubjects','Descriptions','Subjects','ServicenowField','getFields','made_sla','hold_reason','knowledge','close_code','notify','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','expected_start','opened_at','group_list','work_end','caller_id','approval_set','subcategory','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','incident_state','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','password','email','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','username','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','remove','includes','label','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','internalType','push','concat'];(function(_0x11dcd0,_0x409321){var _0x52a7e6=function(_0x430ce2){while(--_0x430ce2){_0x11dcd0['push'](_0x11dcd0['shift']());}};_0x52a7e6(++_0x409321);}(_0x4cdc,0xc6));var _0xc4cd=function(_0x2ff954,_0x2ab001){_0x2ff954=_0x2ff954-0x0;var _0x4a53ff=_0x4cdc[_0x2ff954];return _0x4a53ff;};'use strict';var emlformat=require(_0xc4cd('0x0'));var rimraf=require(_0xc4cd('0x1'));var zipdir=require(_0xc4cd('0x2'));var jsonpatch=require(_0xc4cd('0x3'));var rp=require(_0xc4cd('0x4'));var moment=require('moment');var BPromise=require(_0xc4cd('0x5'));var Mustache=require(_0xc4cd('0x6'));var util=require(_0xc4cd('0x7'));var path=require(_0xc4cd('0x8'));var sox=require('sox');var csv=require(_0xc4cd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4cd('0xa'));var _=require(_0xc4cd('0xb'));var squel=require(_0xc4cd('0xc'));var crypto=require(_0xc4cd('0xd'));var jsforce=require(_0xc4cd('0xe'));var deskjs=require(_0xc4cd('0xf'));var toCsv=require(_0xc4cd('0x9'));var querystring=require('querystring');var Papa=require(_0xc4cd('0x10'));var Redis=require(_0xc4cd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc4cd('0x12'));var as=require(_0xc4cd('0x13'));var hardwareService=require(_0xc4cd('0x14'));var logger=require(_0xc4cd('0x15'))('api');var utils=require(_0xc4cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc4cd('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xc4cd('0x18'));function respondWithStatusCode(_0x3b0f58,_0x18d33a){_0x18d33a=_0x18d33a||0xcc;return function(_0x1ef84f){if(_0x1ef84f){return _0x3b0f58[_0xc4cd('0x19')](_0x18d33a);}return _0x3b0f58[_0xc4cd('0x1a')](_0x18d33a)[_0xc4cd('0x1b')]();};}function respondWithResult(_0x136b58,_0x4a07e8){_0x4a07e8=_0x4a07e8||0xc8;return function(_0x2f4657){if(_0x2f4657){return _0x136b58[_0xc4cd('0x1a')](_0x4a07e8)[_0xc4cd('0x1c')](_0x2f4657);}};}function respondWithFilteredResult(_0x157eb3,_0x5b7ac4){return function(_0x67fb77){if(_0x67fb77){var _0x19b4c8=typeof _0x5b7ac4[_0xc4cd('0x1d')]===_0xc4cd('0x1e')&&typeof _0x5b7ac4[_0xc4cd('0x1f')]===_0xc4cd('0x1e');var _0x3c6e5b=_0x67fb77[_0xc4cd('0x20')];var _0x57f826=_0x19b4c8?0x0:_0x5b7ac4[_0xc4cd('0x1d')];var _0x27264c=_0x19b4c8?_0x67fb77[_0xc4cd('0x20')]:_0x5b7ac4['offset']+_0x5b7ac4[_0xc4cd('0x1f')];var _0xaeff07;if(_0x27264c>=_0x3c6e5b){_0x27264c=_0x3c6e5b;_0xaeff07=0xc8;}else{_0xaeff07=0xce;}_0x157eb3[_0xc4cd('0x1a')](_0xaeff07);return _0x157eb3[_0xc4cd('0x21')](_0xc4cd('0x22'),_0x57f826+'-'+_0x27264c+'/'+_0x3c6e5b)[_0xc4cd('0x1c')](_0x67fb77);}return null;};}function patchUpdates(_0x241efc){return function(_0xec898c){try{jsonpatch[_0xc4cd('0x23')](_0xec898c,_0x241efc,!![]);}catch(_0x187963){return BPromise[_0xc4cd('0x24')](_0x187963);}return _0xec898c[_0xc4cd('0x25')]();};}function saveUpdates(_0x670233,_0x5d3ae8){return function(_0x272305){if(_0x272305){return _0x272305[_0xc4cd('0x26')](_0x670233)[_0xc4cd('0x27')](function(_0x482636){return _0x482636;});}return null;};}function removeEntity(_0x1ee94d,_0x3f4520){return function(_0x543575){if(_0x543575){return _0x543575[_0xc4cd('0x28')]()[_0xc4cd('0x27')](function(){_0x1ee94d[_0xc4cd('0x1a')](0xcc)[_0xc4cd('0x1b')]();});}};}function handleEntityNotFound(_0x52ed9e,_0x58e833){return function(_0x27d830){if(!_0x27d830){_0x52ed9e[_0xc4cd('0x19')](0x194);}return _0x27d830;};}function handleError(_0x215569,_0x1359a7){_0x1359a7=_0x1359a7||0x1f4;return function(_0x57f106){logger[_0xc4cd('0x29')](_0x57f106[_0xc4cd('0x2a')]);if(_0x57f106[_0xc4cd('0x2b')]){delete _0x57f106['name'];}_0x215569[_0xc4cd('0x1a')](_0x1359a7)[_0xc4cd('0x2c')](_0x57f106);};}exports[_0xc4cd('0x2d')]=function(_0x46de90,_0x221511){var _0x3a2b04={},_0x3dee55={},_0x1e1105={'count':0x0,'rows':[]};var _0x3c95f1=_['map'](db[_0xc4cd('0x2e')][_0xc4cd('0x2f')],function(_0x57546c){return{'name':_0x57546c[_0xc4cd('0x30')],'type':_0x57546c[_0xc4cd('0x31')][_0xc4cd('0x32')]};});_0x3dee55[_0xc4cd('0x33')]=_['map'](_0x3c95f1,'name');_0x3dee55[_0xc4cd('0x34')]=_['keys'](_0x46de90[_0xc4cd('0x34')]);_0x3dee55[_0xc4cd('0x35')]=_[_0xc4cd('0x36')](_0x3dee55[_0xc4cd('0x33')],_0x3dee55[_0xc4cd('0x34')]);_0x3a2b04[_0xc4cd('0x37')]=_[_0xc4cd('0x36')](_0x3dee55['model'],qs[_0xc4cd('0x38')](_0x46de90[_0xc4cd('0x34')][_0xc4cd('0x38')]));_0x3a2b04[_0xc4cd('0x37')]=_0x3a2b04[_0xc4cd('0x37')][_0xc4cd('0x39')]?_0x3a2b04['attributes']:_0x3dee55[_0xc4cd('0x33')];if(!_0x46de90[_0xc4cd('0x34')]['hasOwnProperty'](_0xc4cd('0x3a'))){_0x3a2b04[_0xc4cd('0x1f')]=qs[_0xc4cd('0x1f')](_0x46de90[_0xc4cd('0x34')]['limit']);_0x3a2b04[_0xc4cd('0x1d')]=qs[_0xc4cd('0x1d')](_0x46de90[_0xc4cd('0x34')][_0xc4cd('0x1d')]);}_0x3a2b04['order']=qs[_0xc4cd('0x3b')](_0x46de90[_0xc4cd('0x34')]['sort']);_0x3a2b04[_0xc4cd('0x3c')]=qs[_0xc4cd('0x35')](_[_0xc4cd('0x3d')](_0x46de90[_0xc4cd('0x34')],_0x3dee55[_0xc4cd('0x35')]),_0x3c95f1);if(_0x46de90[_0xc4cd('0x34')][_0xc4cd('0x3e')]){_0x3a2b04['where']=_['merge'](_0x3a2b04[_0xc4cd('0x3c')],{'$or':_['map'](_0x3c95f1,function(_0x5778fc){if(_0x5778fc[_0xc4cd('0x31')]!==_0xc4cd('0x3f')){var _0x5c9f78={};_0x5c9f78[_0x5778fc[_0xc4cd('0x2b')]]={'$like':'%'+_0x46de90[_0xc4cd('0x34')][_0xc4cd('0x3e')]+'%'};return _0x5c9f78;}})});}_0x3a2b04=_['merge']({},_0x3a2b04,_0x46de90[_0xc4cd('0x40')]);var _0x28e2da={'where':_0x3a2b04[_0xc4cd('0x3c')]};return db[_0xc4cd('0x2e')][_0xc4cd('0x20')](_0x28e2da)[_0xc4cd('0x27')](function(_0x80853c){_0x1e1105[_0xc4cd('0x20')]=_0x80853c;if(_0x46de90[_0xc4cd('0x34')][_0xc4cd('0x41')]){_0x3a2b04[_0xc4cd('0x42')]=[{'all':!![]}];}return db[_0xc4cd('0x2e')][_0xc4cd('0x43')](_0x3a2b04);})[_0xc4cd('0x27')](function(_0x4ad6fb){_0x1e1105[_0xc4cd('0x44')]=_0x4ad6fb;return _0x1e1105;})[_0xc4cd('0x27')](respondWithFilteredResult(_0x221511,_0x3a2b04))[_0xc4cd('0x45')](handleError(_0x221511,null));};exports[_0xc4cd('0x46')]=function(_0x4ac88b,_0x492004){var _0x49f6ca={'raw':![],'where':{'id':_0x4ac88b[_0xc4cd('0x47')]['id']}},_0x1f0f24={};_0x1f0f24[_0xc4cd('0x33')]=_[_0xc4cd('0x48')](db[_0xc4cd('0x2e')][_0xc4cd('0x2f')]);_0x1f0f24['query']=_[_0xc4cd('0x48')](_0x4ac88b['query']);_0x1f0f24[_0xc4cd('0x35')]=_['intersection'](_0x1f0f24[_0xc4cd('0x33')],_0x1f0f24[_0xc4cd('0x34')]);_0x49f6ca[_0xc4cd('0x37')]=_['intersection'](_0x1f0f24['model'],qs[_0xc4cd('0x38')](_0x4ac88b[_0xc4cd('0x34')][_0xc4cd('0x38')]));_0x49f6ca[_0xc4cd('0x37')]=_0x49f6ca[_0xc4cd('0x37')][_0xc4cd('0x39')]?_0x49f6ca[_0xc4cd('0x37')]:_0x1f0f24[_0xc4cd('0x33')];if(_0x4ac88b[_0xc4cd('0x34')][_0xc4cd('0x41')]){_0x49f6ca[_0xc4cd('0x42')]=[{'all':!![]}];}_0x49f6ca=_[_0xc4cd('0x49')]({},_0x49f6ca,_0x4ac88b[_0xc4cd('0x40')]);return db[_0xc4cd('0x2e')][_0xc4cd('0x4a')](_0x49f6ca)[_0xc4cd('0x27')](handleEntityNotFound(_0x492004,null))[_0xc4cd('0x27')](respondWithResult(_0x492004,null))[_0xc4cd('0x45')](handleError(_0x492004,null));};exports['create']=function(_0x48b1d1,_0x578873){return db['ServicenowAccount'][_0xc4cd('0x4b')](_0x48b1d1[_0xc4cd('0x4c')],{})['then'](respondWithResult(_0x578873,0xc9))[_0xc4cd('0x45')](handleError(_0x578873,null));};exports[_0xc4cd('0x26')]=function(_0x5d3934,_0x134902){if(_0x5d3934[_0xc4cd('0x4c')]['id']){delete _0x5d3934[_0xc4cd('0x4c')]['id'];}return db[_0xc4cd('0x2e')]['find']({'where':{'id':_0x5d3934['params']['id']}})['then'](handleEntityNotFound(_0x134902,null))[_0xc4cd('0x27')](saveUpdates(_0x5d3934['body'],null))[_0xc4cd('0x27')](respondWithResult(_0x134902,null))['catch'](handleError(_0x134902,null));};exports[_0xc4cd('0x28')]=function(_0x141d2f,_0x11826c){return db['ServicenowAccount']['find']({'where':{'id':_0x141d2f[_0xc4cd('0x47')]['id']}})['then'](handleEntityNotFound(_0x11826c,null))['then'](removeEntity(_0x11826c,null))[_0xc4cd('0x45')](handleError(_0x11826c,null));};exports[_0xc4cd('0x4d')]=function(_0x172789,_0x52c737,_0x34f7ec){var _0x454bff={};var _0x598e1f={};var _0x5f568d;var _0x1de885;return db['ServicenowAccount'][_0xc4cd('0x4e')]({'where':{'id':_0x172789[_0xc4cd('0x47')]['id']}})[_0xc4cd('0x27')](handleEntityNotFound(_0x52c737,null))['then'](function(_0x1fdf4e){if(_0x1fdf4e){_0x5f568d=_0x1fdf4e;_0x598e1f[_0xc4cd('0x33')]=_[_0xc4cd('0x48')](db[_0xc4cd('0x4f')][_0xc4cd('0x2f')]);_0x598e1f[_0xc4cd('0x34')]=_[_0xc4cd('0x48')](_0x172789['query']);_0x598e1f[_0xc4cd('0x35')]=_[_0xc4cd('0x36')](_0x598e1f['model'],_0x598e1f[_0xc4cd('0x34')]);_0x454bff[_0xc4cd('0x37')]=_[_0xc4cd('0x36')](_0x598e1f[_0xc4cd('0x33')],qs[_0xc4cd('0x38')](_0x172789[_0xc4cd('0x34')][_0xc4cd('0x38')]));_0x454bff[_0xc4cd('0x37')]=_0x454bff[_0xc4cd('0x37')]['length']?_0x454bff[_0xc4cd('0x37')]:_0x598e1f[_0xc4cd('0x33')];_0x454bff[_0xc4cd('0x50')]=qs[_0xc4cd('0x3b')](_0x172789[_0xc4cd('0x34')]['sort']);_0x454bff[_0xc4cd('0x3c')]=qs['filters'](_[_0xc4cd('0x3d')](_0x172789[_0xc4cd('0x34')],_0x598e1f[_0xc4cd('0x35')]));if(_0x172789[_0xc4cd('0x34')][_0xc4cd('0x3e')]){_0x454bff[_0xc4cd('0x3c')]=_[_0xc4cd('0x49')](_0x454bff[_0xc4cd('0x3c')],{'$or':_['map'](_0x454bff['attributes'],function(_0x2709f7){var _0x106b7c={};_0x106b7c[_0x2709f7]={'$like':'%'+_0x172789[_0xc4cd('0x34')][_0xc4cd('0x3e')]+'%'};return _0x106b7c;})});}_0x454bff=_[_0xc4cd('0x49')]({},_0x454bff,_0x172789[_0xc4cd('0x40')]);return _0x5f568d[_0xc4cd('0x4d')](_0x454bff);}})[_0xc4cd('0x27')](function(_0x4bbfe6){if(_0x4bbfe6){_0x1de885=_0x4bbfe6[_0xc4cd('0x39')];if(!_0x172789[_0xc4cd('0x34')][_0xc4cd('0x51')]('nolimit')){_0x454bff[_0xc4cd('0x1f')]=qs[_0xc4cd('0x1f')](_0x172789[_0xc4cd('0x34')]['limit']);_0x454bff[_0xc4cd('0x1d')]=qs[_0xc4cd('0x1d')](_0x172789[_0xc4cd('0x34')][_0xc4cd('0x1d')]);}return _0x5f568d['getConfigurations'](_0x454bff);}})[_0xc4cd('0x27')](function(_0x306389){if(_0x306389){return _0x306389?{'count':_0x1de885,'rows':_0x306389}:null;}})[_0xc4cd('0x27')](respondWithResult(_0x52c737,null))['catch'](handleError(_0x52c737,null));};exports[_0xc4cd('0x52')]=function(_0x189cc6,_0x240b00,_0x12b35c){if(_0x189cc6[_0xc4cd('0x4c')]['id']){delete _0x189cc6[_0xc4cd('0x4c')]['id'];}return db[_0xc4cd('0x2e')][_0xc4cd('0x4e')]({'where':{'id':_0x189cc6['params']['id']}})['then'](handleEntityNotFound(_0x240b00,null))[_0xc4cd('0x27')](function(_0x451ba5){if(_0x451ba5){_0x189cc6['body']['AccountId']=_0x451ba5['id'];_0x189cc6['body']['Subjects']=integrations[_0xc4cd('0x53')](_0x189cc6[_0xc4cd('0x4c')]['channel'],_0x189cc6[_0xc4cd('0x4c')][_0xc4cd('0x31')]);_0x189cc6[_0xc4cd('0x4c')][_0xc4cd('0x54')]=integrations['getDescriptions'](_0x189cc6['body']['channel'],_0x189cc6[_0xc4cd('0x4c')]['type']);return db['ServicenowConfiguration'][_0xc4cd('0x4b')](_0x189cc6[_0xc4cd('0x4c')],{'include':[{'model':db['ServicenowField'],'as':_0xc4cd('0x55')},{'model':db[_0xc4cd('0x56')],'as':_0xc4cd('0x54')}]});}return null;})[_0xc4cd('0x27')](respondWithResult(_0x240b00,null))[_0xc4cd('0x45')](handleError(_0x240b00,null));};exports[_0xc4cd('0x57')]=function(_0x3a5cab,_0x1cc503,_0x588e9d){var _0x1d78d3=[_0xc4cd('0x58'),_0xc4cd('0x59'),_0xc4cd('0x5a'),'subcategory',_0xc4cd('0x5b'),_0xc4cd('0x5c'),'incident_state',_0xc4cd('0x5d'),_0xc4cd('0x5e')];var _0x1913cf=[_0xc4cd('0x5f'),_0xc4cd('0x58'),'caused_by',_0xc4cd('0x60'),_0xc4cd('0x61'),_0xc4cd('0x62'),_0xc4cd('0x63'),'hold_reason','approval_history',_0xc4cd('0x64'),_0xc4cd('0x65'),_0xc4cd('0x66'),_0xc4cd('0x67'),_0xc4cd('0x68'),_0xc4cd('0x69'),_0xc4cd('0x6a'),_0xc4cd('0x6b'),_0xc4cd('0x6c'),_0xc4cd('0x5a'),_0xc4cd('0x50'),'calendar_stc','closed_at',_0xc4cd('0x6d'),_0xc4cd('0x6e'),_0xc4cd('0x6f'),_0xc4cd('0x70'),_0xc4cd('0x71'),_0xc4cd('0x72'),_0xc4cd('0x73'),'sys_domain_path',_0xc4cd('0x74'),'time_worked',_0xc4cd('0x75'),_0xc4cd('0x76'),'business_duration',_0xc4cd('0x77'),_0xc4cd('0x78'),'reopened_time','resolved_at',_0xc4cd('0x79'),_0xc4cd('0x7a'),_0xc4cd('0x7b'),_0xc4cd('0x7c'),_0xc4cd('0x7d'),'close_code',_0xc4cd('0x7e'),_0xc4cd('0x7f'),_0xc4cd('0x80'),_0xc4cd('0x81'),_0xc4cd('0x82'),_0xc4cd('0x83'),_0xc4cd('0x84'),_0xc4cd('0x85'),_0xc4cd('0x5c'),_0xc4cd('0x86'),'close_notes',_0xc4cd('0x87'),_0xc4cd('0x88'),_0xc4cd('0x89'),_0xc4cd('0x8a'),_0xc4cd('0x8b'),_0xc4cd('0x8c'),_0xc4cd('0x8d'),_0xc4cd('0x8e'),_0xc4cd('0x8f'),_0xc4cd('0x90'),_0xc4cd('0x91'),'activity_due',_0xc4cd('0x92'),'severity',_0xc4cd('0x93'),_0xc4cd('0x94'),_0xc4cd('0x95'),_0xc4cd('0x96'),_0xc4cd('0x97'),'sys_mod_count',_0xc4cd('0x98'),_0xc4cd('0x99'),_0xc4cd('0x9a'),_0xc4cd('0x9b'),_0xc4cd('0x9c'),_0xc4cd('0x9d'),_0xc4cd('0x5e')];var _0x218476='';var _0x1c91cb='';var _0x459866=[];var _0x3e34a8='';var _0x47650f='';var _0x2fc6af=[];var _0x4ed947='';var _0x3d48da='';var _0x36861d={};var _0x303f16='';return db[_0xc4cd('0x2e')][_0xc4cd('0x4e')]({'where':{'id':_0x3a5cab[_0xc4cd('0x47')]['id']},'attributes':['id','username',_0xc4cd('0x9e'),_0xc4cd('0x9f'),'remoteUri',_0xc4cd('0xa0')]})[_0xc4cd('0x27')](handleEntityNotFound(_0x1cc503,null))[_0xc4cd('0x27')](function(_0x7a41e){if(_0x7a41e){_0x303f16=_0x7a41e['remoteUri'];var _0x3082bb=_0x303f16['slice'](-0x1);if(_0x3082bb==='/'){_0x303f16=_0x303f16[_0xc4cd('0xa1')](0x0,_0x303f16[_0xc4cd('0xa2')](_0x3082bb));}_0x3d48da=util[_0xc4cd('0xa3')](_0xc4cd('0xa4'),_0x303f16);_0x4ed947=util[_0xc4cd('0xa3')]('%s/api/now/table/',_0x303f16);_0x36861d={'user':_0x7a41e[_0xc4cd('0xa5')],'pass':_0x7a41e[_0xc4cd('0x9e')]};var _0x3ebd98={'method':_0xc4cd('0xa6'),'uri':_0x3d48da+_0xc4cd('0xa7'),'auth':_0x36861d,'json':!![]};return rp(_0x3ebd98);}})['then'](function(_0x21b8a8){if(_0x21b8a8[_0xc4cd('0xa8')][_0xc4cd('0x39')]>0x0){_0x218476=_0x21b8a8[_0xc4cd('0xa8')];}console[_0xc4cd('0xa9')](_0xc4cd('0xaa'),_0x218476);_0x2fc6af=[];_0x1c91cb=Object['assign']([],_0x218476);_[_0xc4cd('0xab')](_0x1c91cb,function(_0x384752){return!_0x1d78d3[_0xc4cd('0xac')](_0x384752[_0xc4cd('0x2b')]);});_0x1c91cb['forEach'](function(_0x247090){var _0x3823b4=createFieldObject(_0x4ed947,_0x36861d,_0x247090['internalType'],_0x247090['name'],_0x247090[_0xc4cd('0xad')],![]);_0x2fc6af['push'](_0x3823b4);});return Promise[_0xc4cd('0xae')](_0x2fc6af);})['then'](function(_0x5e3883){_0x459866=_0x5e3883;_0x3e34a8=Object['assign']([],_0x218476);console[_0xc4cd('0xa9')]('TCL:\x20_object',_0x218476);_[_0xc4cd('0xab')](_0x3e34a8,function(_0xda614d){return _0x1913cf[_0xc4cd('0xac')](_0xda614d['name']);});console[_0xc4cd('0xa9')](_0xc4cd('0xaf'),_0x3e34a8);_0x2fc6af=[];_0x3e34a8[_0xc4cd('0xb0')](function(_0x3ee989){var _0x7963bd=createFieldObject(_0x4ed947,_0x36861d,_0x3ee989[_0xc4cd('0xb1')],_0x3ee989[_0xc4cd('0x2b')],_0x3ee989[_0xc4cd('0xad')],!![]);_0x2fc6af[_0xc4cd('0xb2')](_0x7963bd);});return Promise[_0xc4cd('0xae')](_0x2fc6af);})[_0xc4cd('0x27')](function(_0x2cccca){_0x47650f=_0x2cccca;var _0x3b5195=_0x459866[_0xc4cd('0xb3')](_0x47650f);return{'count':_0x3b5195['length'],'rows':_0x3b5195};})[_0xc4cd('0x27')](respondWithResult(_0x1cc503,null))['catch'](function(_0x43481c){console[_0xc4cd('0xa9')]('ServiceNow\x20error:\x20'+_0x43481c);var _0x3ca9f5=_0x3a5cab[_0xc4cd('0x34')][_0xc4cd('0xb4')]?0x1f4:_0x43481c[_0xc4cd('0xb5')]||0x1f4;logger[_0xc4cd('0x29')](_0x43481c[_0xc4cd('0x2a')]);delete _0x43481c[_0xc4cd('0x2b')];if(_0x3ca9f5===0x191){_0x3ca9f5=0x190;}_0x1cc503['status'](_0x3ca9f5)[_0xc4cd('0x2c')](_0x3a5cab[_0xc4cd('0x34')]['test']?{'message':_0xc4cd('0xb6'),'statusCode':_0x43481c['statusCode']}:_0x43481c);});};function createFieldObject(_0x11b575,_0x35e9ad,_0x4122d9,_0x4f65f5,_0x3786bb,_0x3467f0){return new Promise(function(_0x358162,_0x57ae10){var _0x867bd0={'id':_0x4f65f5,'name':_0x3786bb,'custom':_0x3467f0};if(_0x4122d9===_0xc4cd('0xb7')){_0x867bd0[_0xc4cd('0x40')]=[{'name':_0xc4cd('0xb8'),'value':_0xc4cd('0xb9')},{'name':_0xc4cd('0xba'),'value':_0xc4cd('0xbb')}];_0x358162(_0x867bd0);}else{var _0x5e676f={'method':_0xc4cd('0xa6'),'uri':_0x11b575+'sys_choice?sysparm_query=name=incident^element='+_0x4f65f5,'auth':_0x35e9ad,'json':!![]};return rp(_0x5e676f)[_0xc4cd('0x27')](function(_0x1b4ad3){var _0x3c2cb9=[];if(_0x1b4ad3[_0xc4cd('0xa8')][_0xc4cd('0x39')]>0x0){_0x1b4ad3[_0xc4cd('0xa8')][_0xc4cd('0xb0')](function(_0x5b8900){if(_0x5b8900[_0xc4cd('0xbc')]===_0xc4cd('0xbb')){var _0x456863={'name':_0x5b8900[_0xc4cd('0xad')],'value':_0x5b8900['value']};_0x3c2cb9[_0xc4cd('0xb2')](_0x456863);}});}_0x867bd0['options']=_0x3c2cb9;if(_0x867bd0[_0xc4cd('0x40')][_0xc4cd('0x39')]>0x0){_0x358162(_0x867bd0);}else{if(_0x3467f0==![]){_0x358162();}else{_0x358162(_0x867bd0);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index be8fa9b..563f703 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x326f,0xd1));var _0xf326=function(_0x5c1217,_0x56ae9a){_0x5c1217=_0x5c1217-0x0;var _0xda594f=_0x326f[_0x5c1217];return _0xda594f;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));var integrations=require(_0xf326('0x9'));module[_0xf326('0xa')]=function(_0x4c2249,_0x3c254d){return _0x4c2249[_0xf326('0xb')](_0xf326('0xc'),attributes,{'tableName':_0xf326('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1623=['path','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','api','moment','bluebird','request-promise'];(function(_0x846de3,_0x5a04b3){var _0x34bcf8=function(_0x4b5d18){while(--_0x4b5d18){_0x846de3['push'](_0x846de3['shift']());}};_0x34bcf8(++_0x5a04b3);}(_0x1623,0xab));var _0x3162=function(_0x478f33,_0x2d3600){_0x478f33=_0x478f33-0x0;var _0x355979=_0x1623[_0x478f33];return _0x355979;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x3162('0x7')]=function(_0x428de6,_0x53260d){return _0x428de6[_0x3162('0x8')](_0x3162('0x9'),attributes,{'tableName':_0x3162('0xa'),'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 773bc45..4abc3d3 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 _0xaded=['raw','where','attributes','include','map','model','debug','ShowServicenowAccount','find','then','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ServicenowAccount,\x20%s,\x20%s','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options'];(function(_0x52a6e3,_0x4a73b4){var _0x8910d0=function(_0x57e5ef){while(--_0x57e5ef){_0x52a6e3['push'](_0x52a6e3['shift']());}};_0x8910d0(++_0x4a73b4);}(_0xaded,0x175));var _0xdade=function(_0x51d764,_0x2f7761){_0x51d764=_0x51d764-0x0;var _0x45f63a=_0xaded[_0x51d764];return _0x45f63a;};'use strict';var _=require('lodash');var util=require(_0xdade('0x0'));var moment=require('moment');var BPromise=require(_0xdade('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdade('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xdade('0x3'));var logger=require(_0xdade('0x4'))(_0xdade('0x5'));var config=require('../../config/environment');var jayson=require(_0xdade('0x6'));var client=jayson[_0xdade('0x7')][_0xdade('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fb3ee,_0x30db78,_0x3bf331){return new BPromise(function(_0x1b92c1,_0x17441d){return client[_0xdade('0x9')](_0x3fb3ee,_0x3bf331)['then'](function(_0x3efd0d){logger[_0xdade('0xa')](_0xdade('0xb'),_0x30db78,'request\x20sent');logger['debug'](_0xdade('0xc'),_0x30db78,'request\x20sent',JSON[_0xdade('0xd')](_0x3efd0d));if(_0x3efd0d[_0xdade('0xe')]){if(_0x3efd0d[_0xdade('0xe')]['code']===0x1f4){logger[_0xdade('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x30db78,_0x3efd0d['error']['message']);return _0x17441d(_0x3efd0d['error'][_0xdade('0xf')]);}logger[_0xdade('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x30db78,_0x3efd0d['error'][_0xdade('0xf')]);return _0x1b92c1(_0x3efd0d[_0xdade('0xe')]['message']);}else{logger[_0xdade('0xa')](_0xdade('0xb'),_0x30db78,_0xdade('0x10'));_0x1b92c1(_0x3efd0d[_0xdade('0x11')][_0xdade('0xf')]);}})[_0xdade('0x12')](function(_0x3dd600){logger[_0xdade('0xe')](_0xdade('0xb'),_0x30db78,_0x3dd600);_0x17441d(_0x3dd600);});});}exports[_0xdade('0x13')]=function(_0x193323){var _0x9ebd0=this;return new Promise(function(_0x1adce4,_0x10f33b){return db[_0xdade('0x14')][_0xdade('0x15')]({'raw':_0x193323['options']?_0x193323[_0xdade('0x16')][_0xdade('0x17')]===undefined?!![]:![]:!![],'where':_0x193323['options']?_0x193323['options'][_0xdade('0x18')]||null:null,'attributes':_0x193323[_0xdade('0x16')]?_0x193323[_0xdade('0x16')][_0xdade('0x19')]||null:null,'limit':_0x193323[_0xdade('0x16')]?_0x193323[_0xdade('0x16')]['limit']||null:null,'include':_0x193323['options']?_0x193323[_0xdade('0x16')][_0xdade('0x1a')]?_[_0xdade('0x1b')](_0x193323['options'][_0xdade('0x1a')],function(_0x371da1){return{'model':db[_0x371da1['model']],'as':_0x371da1['as'],'attributes':_0x371da1[_0xdade('0x19')],'include':_0x371da1[_0xdade('0x1a')]?_['map'](_0x371da1['include'],function(_0x50df9c){return{'model':db[_0x50df9c[_0xdade('0x1c')]],'as':_0x50df9c['as'],'attributes':_0x50df9c['attributes'],'include':_0x50df9c[_0xdade('0x1a')]?_[_0xdade('0x1b')](_0x50df9c[_0xdade('0x1a')],function(_0x48462e){return{'model':db[_0x48462e[_0xdade('0x1c')]],'as':_0x48462e['as'],'attributes':_0x48462e[_0xdade('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b1c6){logger['info']('GetServicenowAccount',_0x193323);logger[_0xdade('0x1d')](_0xdade('0x13'),_0x193323,JSON[_0xdade('0xd')](_0x36b1c6));_0x1adce4(_0x36b1c6);})[_0xdade('0x12')](function(_0x41fdd5){logger[_0xdade('0xe')](_0xdade('0x13'),_0x41fdd5[_0xdade('0xf')],_0x193323);_0x10f33b(_0x9ebd0[_0xdade('0xe')](0x1f4,_0x41fdd5['message']));});});};exports[_0xdade('0x1e')]=function(_0x560a65){var _0x6edca5=this;return new Promise(function(_0x24021e,_0x47db20){return db[_0xdade('0x14')][_0xdade('0x1f')]({'raw':_0x560a65[_0xdade('0x16')]?_0x560a65[_0xdade('0x16')][_0xdade('0x17')]===undefined?!![]:![]:!![],'where':_0x560a65[_0xdade('0x16')]?_0x560a65['options']['where']||null:null,'attributes':_0x560a65['options']?_0x560a65[_0xdade('0x16')][_0xdade('0x19')]||null:null,'include':_0x560a65[_0xdade('0x16')]?_0x560a65['options']['include']?_[_0xdade('0x1b')](_0x560a65['options'][_0xdade('0x1a')],function(_0x5360ad){return{'model':db[_0x5360ad[_0xdade('0x1c')]],'as':_0x5360ad['as'],'attributes':_0x5360ad[_0xdade('0x19')],'include':_0x5360ad[_0xdade('0x1a')]?_[_0xdade('0x1b')](_0x5360ad['include'],function(_0x138895){return{'model':db[_0x138895[_0xdade('0x1c')]],'as':_0x138895['as'],'attributes':_0x138895[_0xdade('0x19')],'include':_0x138895[_0xdade('0x1a')]?_[_0xdade('0x1b')](_0x138895[_0xdade('0x1a')],function(_0x33f2bb){return{'model':db[_0x33f2bb[_0xdade('0x1c')]],'as':_0x33f2bb['as'],'attributes':_0x33f2bb[_0xdade('0x19')]};}):[]};}):[]};}):[]:[]})[_0xdade('0x20')](function(_0x1cd6c1){logger[_0xdade('0xa')](_0xdade('0x1e'),_0x560a65);logger[_0xdade('0x1d')]('ShowServicenowAccount',_0x560a65,JSON[_0xdade('0xd')](_0x1cd6c1));_0x24021e(_0x1cd6c1);})[_0xdade('0x12')](function(_0x5de7ed){logger[_0xdade('0xe')](_0xdade('0x1e'),_0x5de7ed['message'],_0x560a65);_0x47db20(_0x6edca5['error'](0x1f4,_0x5de7ed[_0xdade('0xf')]));});});}; \ No newline at end of file +var _0xfcc8=['message','catch','GetServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','ServicenowAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ddfe1,_0x35939d){var _0x4aaf51=function(_0x1e99a0){while(--_0x1e99a0){_0x4ddfe1['push'](_0x4ddfe1['shift']());}};_0x4aaf51(++_0x35939d);}(_0xfcc8,0xfb));var _0x8fcc=function(_0x4f9673,_0x4313bd){_0x4f9673=_0x4f9673-0x0;var _0x337e5e=_0xfcc8[_0x4f9673];return _0x337e5e;};'use strict';var _=require(_0x8fcc('0x0'));var util=require(_0x8fcc('0x1'));var moment=require('moment');var BPromise=require(_0x8fcc('0x2'));var rs=require(_0x8fcc('0x3'));var fs=require('fs');var Redis=require(_0x8fcc('0x4'));var db=require(_0x8fcc('0x5'))['db'];var utils=require(_0x8fcc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8fcc('0x7'));var jayson=require(_0x8fcc('0x8'));var client=jayson[_0x8fcc('0x9')][_0x8fcc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x239d61,_0x14bfd8,_0x4b63a7){return new BPromise(function(_0x5bc811,_0x5b4ea4){return client[_0x8fcc('0xb')](_0x239d61,_0x4b63a7)[_0x8fcc('0xc')](function(_0x3602d1){logger[_0x8fcc('0xd')](_0x8fcc('0xe'),_0x14bfd8,_0x8fcc('0xf'));logger[_0x8fcc('0x10')](_0x8fcc('0x11'),_0x14bfd8,_0x8fcc('0xf'),JSON[_0x8fcc('0x12')](_0x3602d1));if(_0x3602d1['error']){if(_0x3602d1[_0x8fcc('0x13')][_0x8fcc('0x14')]===0x1f4){logger[_0x8fcc('0x13')](_0x8fcc('0xe'),_0x14bfd8,_0x3602d1[_0x8fcc('0x13')][_0x8fcc('0x15')]);return _0x5b4ea4(_0x3602d1[_0x8fcc('0x13')]['message']);}logger[_0x8fcc('0x13')](_0x8fcc('0xe'),_0x14bfd8,_0x3602d1[_0x8fcc('0x13')][_0x8fcc('0x15')]);return _0x5bc811(_0x3602d1['error'][_0x8fcc('0x15')]);}else{logger[_0x8fcc('0xd')](_0x8fcc('0xe'),_0x14bfd8,_0x8fcc('0xf'));_0x5bc811(_0x3602d1['result'][_0x8fcc('0x15')]);}})[_0x8fcc('0x16')](function(_0x174121){logger[_0x8fcc('0x13')](_0x8fcc('0xe'),_0x14bfd8,_0x174121);_0x5b4ea4(_0x174121);});});}exports[_0x8fcc('0x17')]=function(_0x1b3cad){var _0x209c44=this;return new Promise(function(_0x476621,_0x3e58a6){return db['ServicenowAccount'][_0x8fcc('0x18')]({'raw':_0x1b3cad[_0x8fcc('0x19')]?_0x1b3cad[_0x8fcc('0x19')][_0x8fcc('0x1a')]===undefined?!![]:![]:!![],'where':_0x1b3cad[_0x8fcc('0x19')]?_0x1b3cad['options'][_0x8fcc('0x1b')]||null:null,'attributes':_0x1b3cad[_0x8fcc('0x19')]?_0x1b3cad[_0x8fcc('0x19')][_0x8fcc('0x1c')]||null:null,'limit':_0x1b3cad['options']?_0x1b3cad[_0x8fcc('0x19')][_0x8fcc('0x1d')]||null:null,'include':_0x1b3cad['options']?_0x1b3cad[_0x8fcc('0x19')][_0x8fcc('0x1e')]?_[_0x8fcc('0x1f')](_0x1b3cad[_0x8fcc('0x19')][_0x8fcc('0x1e')],function(_0x3eef25){return{'model':db[_0x3eef25[_0x8fcc('0x20')]],'as':_0x3eef25['as'],'attributes':_0x3eef25[_0x8fcc('0x1c')],'include':_0x3eef25[_0x8fcc('0x1e')]?_['map'](_0x3eef25[_0x8fcc('0x1e')],function(_0x410303){return{'model':db[_0x410303[_0x8fcc('0x20')]],'as':_0x410303['as'],'attributes':_0x410303[_0x8fcc('0x1c')],'include':_0x410303[_0x8fcc('0x1e')]?_[_0x8fcc('0x1f')](_0x410303[_0x8fcc('0x1e')],function(_0x1ac1e5){return{'model':db[_0x1ac1e5['model']],'as':_0x1ac1e5['as'],'attributes':_0x1ac1e5[_0x8fcc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8fcc('0xc')](function(_0x52133f){logger[_0x8fcc('0xd')](_0x8fcc('0x17'),_0x1b3cad);logger[_0x8fcc('0x10')](_0x8fcc('0x17'),_0x1b3cad,JSON[_0x8fcc('0x12')](_0x52133f));_0x476621(_0x52133f);})[_0x8fcc('0x16')](function(_0x47ae9e){logger[_0x8fcc('0x13')](_0x8fcc('0x17'),_0x47ae9e[_0x8fcc('0x15')],_0x1b3cad);_0x3e58a6(_0x209c44[_0x8fcc('0x13')](0x1f4,_0x47ae9e[_0x8fcc('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x4d76b6){var _0x570598=this;return new Promise(function(_0x1e4207,_0x29c794){return db[_0x8fcc('0x21')]['find']({'raw':_0x4d76b6['options']?_0x4d76b6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d76b6[_0x8fcc('0x19')]?_0x4d76b6[_0x8fcc('0x19')]['where']||null:null,'attributes':_0x4d76b6['options']?_0x4d76b6[_0x8fcc('0x19')][_0x8fcc('0x1c')]||null:null,'include':_0x4d76b6[_0x8fcc('0x19')]?_0x4d76b6[_0x8fcc('0x19')][_0x8fcc('0x1e')]?_[_0x8fcc('0x1f')](_0x4d76b6[_0x8fcc('0x19')][_0x8fcc('0x1e')],function(_0x878f07){return{'model':db[_0x878f07[_0x8fcc('0x20')]],'as':_0x878f07['as'],'attributes':_0x878f07[_0x8fcc('0x1c')],'include':_0x878f07['include']?_['map'](_0x878f07[_0x8fcc('0x1e')],function(_0x4fdb29){return{'model':db[_0x4fdb29[_0x8fcc('0x20')]],'as':_0x4fdb29['as'],'attributes':_0x4fdb29[_0x8fcc('0x1c')],'include':_0x4fdb29[_0x8fcc('0x1e')]?_[_0x8fcc('0x1f')](_0x4fdb29[_0x8fcc('0x1e')],function(_0x568042){return{'model':db[_0x568042[_0x8fcc('0x20')]],'as':_0x568042['as'],'attributes':_0x568042[_0x8fcc('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8fcc('0xc')](function(_0x5f1dcd){logger[_0x8fcc('0xd')]('ShowServicenowAccount',_0x4d76b6);logger[_0x8fcc('0x10')]('ShowServicenowAccount',_0x4d76b6,JSON['stringify'](_0x5f1dcd));_0x1e4207(_0x5f1dcd);})[_0x8fcc('0x16')](function(_0x26fab7){logger[_0x8fcc('0x13')]('ShowServicenowAccount',_0x26fab7['message'],_0x4d76b6);_0x29c794(_0x570598[_0x8fcc('0x13')](0x1f4,_0x26fab7[_0x8fcc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index ae12733..7fb59a9 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 _0x40ad=['./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x190218,_0x1e7e8d){var _0xb2f213=function(_0x13b0a5){while(--_0x13b0a5){_0x190218['push'](_0x190218['shift']());}};_0xb2f213(++_0x1e7e8d);}(_0x40ad,0x19d));var _0xd40a=function(_0x2a37a4,_0x464b98){_0x2a37a4=_0x2a37a4-0x0;var _0x29d935=_0x40ad[_0x2a37a4];return _0x29d935;};'use strict';var multer=require(_0xd40a('0x0'));var util=require(_0xd40a('0x1'));var path=require(_0xd40a('0x2'));var timeout=require(_0xd40a('0x3'));var express=require('express');var router=express[_0xd40a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd40a('0x5'));var config=require(_0xd40a('0x6'));var controller=require(_0xd40a('0x7'));router['get']('/',auth[_0xd40a('0x8')](),controller[_0xd40a('0x9')]);router[_0xd40a('0xa')](_0xd40a('0xb'),auth['isAuthenticated'](),controller[_0xd40a('0xc')]);router['get']('/:id/fields',auth[_0xd40a('0x8')](),controller[_0xd40a('0xd')]);router[_0xd40a('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xd40a('0xe')]);router[_0xd40a('0xa')](_0xd40a('0xf'),auth[_0xd40a('0x8')](),controller[_0xd40a('0x10')]);router[_0xd40a('0x11')]('/',auth[_0xd40a('0x8')](),controller[_0xd40a('0x12')]);router[_0xd40a('0x13')](_0xd40a('0xb'),auth[_0xd40a('0x8')](),controller[_0xd40a('0x14')]);router['delete'](_0xd40a('0xb'),auth[_0xd40a('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4a66=['../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/descriptions','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra'];(function(_0x579928,_0x3f6ae3){var _0x36b5e1=function(_0x23b04e){while(--_0x23b04e){_0x579928['push'](_0x579928['shift']());}};_0x36b5e1(++_0x3f6ae3);}(_0x4a66,0xfe));var _0x64a6=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0x4a66[_0x39caaa];return _0x9b9c7d;};'use strict';var multer=require(_0x64a6('0x0'));var util=require(_0x64a6('0x1'));var path=require(_0x64a6('0x2'));var timeout=require(_0x64a6('0x3'));var express=require(_0x64a6('0x4'));var router=express['Router']();var fs_extra=require(_0x64a6('0x5'));var auth=require(_0x64a6('0x6'));var interaction=require(_0x64a6('0x7'));var config=require('../../config/environment');var controller=require(_0x64a6('0x8'));router[_0x64a6('0x9')]('/',auth[_0x64a6('0xa')](),controller[_0x64a6('0xb')]);router['get'](_0x64a6('0xc'),auth[_0x64a6('0xa')](),controller[_0x64a6('0xd')]);router[_0x64a6('0x9')]('/:id/fields',auth[_0x64a6('0xa')](),controller['getFields']);router[_0x64a6('0x9')](_0x64a6('0xe'),auth['isAuthenticated'](),controller[_0x64a6('0xf')]);router[_0x64a6('0x9')](_0x64a6('0x10'),auth[_0x64a6('0xa')](),controller['getDescriptions']);router['post']('/',auth[_0x64a6('0xa')](),controller['create']);router[_0x64a6('0x11')](_0x64a6('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x64a6('0x12')](_0x64a6('0xc'),auth[_0x64a6('0xa')](),controller[_0x64a6('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 9435e50..470c6a0 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 _0xbfe4=['sequelize','exports','STRING'];(function(_0x2276f4,_0x4b0ee5){var _0x17186c=function(_0x59ccfc){while(--_0x59ccfc){_0x2276f4['push'](_0x2276f4['shift']());}};_0x17186c(++_0x4b0ee5);}(_0xbfe4,0x1c5));var _0x4bfe=function(_0x5d76a1,_0x39c5e3){_0x5d76a1=_0x5d76a1-0x0;var _0x15aa06=_0xbfe4[_0x5d76a1];return _0x15aa06;};'use strict';var Sequelize=require(_0x4bfe('0x0'));module[_0x4bfe('0x1')]={'name':{'type':Sequelize[_0x4bfe('0x2')]},'description':{'type':Sequelize[_0x4bfe('0x2')]}}; \ No newline at end of file +var _0xb212=['STRING','sequelize','exports'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xb212,0x1bd));var _0x2b21=function(_0x17561b,_0x4c8680){_0x17561b=_0x17561b-0x0;var _0x2df1ef=_0xb212[_0x17561b];return _0x2df1ef;};'use strict';var Sequelize=require(_0x2b21('0x0'));module[_0x2b21('0x1')]={'name':{'type':Sequelize[_0x2b21('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 75cc916..2fc7f66 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 _0x9ae6=['length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','map','VIRTUAL','options','include','findAll','catch','show','params','fields','includeAll','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes'];(function(_0xf5cf27,_0x184af9){var _0x29538e=function(_0x5e2676){while(--_0x5e2676){_0xf5cf27['push'](_0xf5cf27['shift']());}};_0x29538e(++_0x184af9);}(_0x9ae6,0x16c));var _0x69ae=function(_0x146a97,_0x2d8483){_0x146a97=_0x146a97-0x0;var _0x259d5c=_0x9ae6[_0x146a97];return _0x259d5c;};'use strict';var emlformat=require(_0x69ae('0x0'));var rimraf=require(_0x69ae('0x1'));var zipdir=require(_0x69ae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69ae('0x3'));var BPromise=require(_0x69ae('0x4'));var Mustache=require('mustache');var util=require(_0x69ae('0x5'));var path=require(_0x69ae('0x6'));var sox=require(_0x69ae('0x7'));var csv=require(_0x69ae('0x8'));var ejs=require(_0x69ae('0x9'));var fs=require('fs');var fs_extra=require(_0x69ae('0xa'));var _=require(_0x69ae('0xb'));var squel=require(_0x69ae('0xc'));var crypto=require(_0x69ae('0xd'));var jsforce=require(_0x69ae('0xe'));var deskjs=require(_0x69ae('0xf'));var toCsv=require(_0x69ae('0x8'));var querystring=require(_0x69ae('0x10'));var Papa=require('papaparse');var Redis=require(_0x69ae('0x11'));var authService=require(_0x69ae('0x12'));var qs=require(_0x69ae('0x13'));var as=require(_0x69ae('0x14'));var hardwareService=require(_0x69ae('0x15'));var logger=require(_0x69ae('0x16'))(_0x69ae('0x17'));var utils=require(_0x69ae('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x69ae('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fb47f,_0x3c80f2){_0x3c80f2=_0x3c80f2||0xcc;return function(_0x362027){if(_0x362027){return _0x2fb47f[_0x69ae('0x1a')](_0x3c80f2);}return _0x2fb47f[_0x69ae('0x1b')](_0x3c80f2)[_0x69ae('0x1c')]();};}function respondWithResult(_0x47f207,_0x2547aa){_0x2547aa=_0x2547aa||0xc8;return function(_0x38350d){if(_0x38350d){return _0x47f207[_0x69ae('0x1b')](_0x2547aa)[_0x69ae('0x1d')](_0x38350d);}};}function respondWithFilteredResult(_0xa43c3d,_0x2f3bb0){return function(_0x435a52){if(_0x435a52){var _0xe0e6d2=typeof _0x2f3bb0[_0x69ae('0x1e')]==='undefined'&&typeof _0x2f3bb0[_0x69ae('0x1f')]===_0x69ae('0x20');var _0x4186b8=_0x435a52['count'];var _0x250da9=_0xe0e6d2?0x0:_0x2f3bb0[_0x69ae('0x1e')];var _0xedd2ff=_0xe0e6d2?_0x435a52[_0x69ae('0x21')]:_0x2f3bb0['offset']+_0x2f3bb0[_0x69ae('0x1f')];var _0x3d52c5;if(_0xedd2ff>=_0x4186b8){_0xedd2ff=_0x4186b8;_0x3d52c5=0xc8;}else{_0x3d52c5=0xce;}_0xa43c3d[_0x69ae('0x1b')](_0x3d52c5);return _0xa43c3d[_0x69ae('0x22')](_0x69ae('0x23'),_0x250da9+'-'+_0xedd2ff+'/'+_0x4186b8)[_0x69ae('0x1d')](_0x435a52);}return null;};}function patchUpdates(_0x21ed46){return function(_0x3a4348){try{jsonpatch[_0x69ae('0x24')](_0x3a4348,_0x21ed46,!![]);}catch(_0xcb849b){return BPromise['reject'](_0xcb849b);}return _0x3a4348[_0x69ae('0x25')]();};}function saveUpdates(_0x4f6068,_0x22721a){return function(_0x1aca91){if(_0x1aca91){return _0x1aca91[_0x69ae('0x26')](_0x4f6068)[_0x69ae('0x27')](function(_0x5404bd){return _0x5404bd;});}return null;};}function removeEntity(_0x1c608f,_0x18a1a2){return function(_0x2abd61){if(_0x2abd61){return _0x2abd61[_0x69ae('0x28')]()[_0x69ae('0x27')](function(){_0x1c608f[_0x69ae('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x551897,_0x591fe8){return function(_0x3d3305){if(!_0x3d3305){_0x551897[_0x69ae('0x1a')](0x194);}return _0x3d3305;};}function handleError(_0x3be398,_0x5de586){_0x5de586=_0x5de586||0x1f4;return function(_0x4fd150){logger[_0x69ae('0x29')](_0x4fd150[_0x69ae('0x2a')]);if(_0x4fd150[_0x69ae('0x2b')]){delete _0x4fd150[_0x69ae('0x2b')];}_0x3be398[_0x69ae('0x1b')](_0x5de586)[_0x69ae('0x2c')](_0x4fd150);};}exports[_0x69ae('0x2d')]=function(_0x211503,_0x1ca4e9){var _0x2cb59c={},_0x10bf82={},_0x3e6153={'count':0x0,'rows':[]};var _0x5da588=_['map'](db[_0x69ae('0x2e')][_0x69ae('0x2f')],function(_0x38d329){return{'name':_0x38d329[_0x69ae('0x30')],'type':_0x38d329[_0x69ae('0x31')][_0x69ae('0x32')]};});_0x10bf82['model']=_['map'](_0x5da588,'name');_0x10bf82['query']=_[_0x69ae('0x33')](_0x211503[_0x69ae('0x34')]);_0x10bf82['filters']=_[_0x69ae('0x35')](_0x10bf82[_0x69ae('0x36')],_0x10bf82[_0x69ae('0x34')]);_0x2cb59c[_0x69ae('0x37')]=_['intersection'](_0x10bf82[_0x69ae('0x36')],qs['fields'](_0x211503[_0x69ae('0x34')]['fields']));_0x2cb59c['attributes']=_0x2cb59c['attributes'][_0x69ae('0x38')]?_0x2cb59c['attributes']:_0x10bf82[_0x69ae('0x36')];if(!_0x211503[_0x69ae('0x34')][_0x69ae('0x39')](_0x69ae('0x3a'))){_0x2cb59c[_0x69ae('0x1f')]=qs[_0x69ae('0x1f')](_0x211503['query'][_0x69ae('0x1f')]);_0x2cb59c[_0x69ae('0x1e')]=qs[_0x69ae('0x1e')](_0x211503[_0x69ae('0x34')]['offset']);}_0x2cb59c[_0x69ae('0x3b')]=qs[_0x69ae('0x3c')](_0x211503[_0x69ae('0x34')][_0x69ae('0x3c')]);_0x2cb59c['where']=qs[_0x69ae('0x3d')](_[_0x69ae('0x3e')](_0x211503[_0x69ae('0x34')],_0x10bf82[_0x69ae('0x3d')]),_0x5da588);if(_0x211503['query'][_0x69ae('0x3f')]){_0x2cb59c[_0x69ae('0x40')]=_[_0x69ae('0x41')](_0x2cb59c[_0x69ae('0x40')],{'$or':_[_0x69ae('0x42')](_0x5da588,function(_0x545a3a){if(_0x545a3a[_0x69ae('0x31')]!==_0x69ae('0x43')){var _0x34027b={};_0x34027b[_0x545a3a['name']]={'$like':'%'+_0x211503[_0x69ae('0x34')][_0x69ae('0x3f')]+'%'};return _0x34027b;}})});}_0x2cb59c=_[_0x69ae('0x41')]({},_0x2cb59c,_0x211503[_0x69ae('0x44')]);var _0x54a26e={'where':_0x2cb59c[_0x69ae('0x40')]};return db['ServicenowConfiguration'][_0x69ae('0x21')](_0x54a26e)['then'](function(_0x58afd4){_0x3e6153[_0x69ae('0x21')]=_0x58afd4;if(_0x211503[_0x69ae('0x34')]['includeAll']){_0x2cb59c[_0x69ae('0x45')]=[{'all':!![]}];}return db[_0x69ae('0x2e')][_0x69ae('0x46')](_0x2cb59c);})[_0x69ae('0x27')](function(_0x3d0ffa){_0x3e6153['rows']=_0x3d0ffa;return _0x3e6153;})[_0x69ae('0x27')](respondWithFilteredResult(_0x1ca4e9,_0x2cb59c))[_0x69ae('0x47')](handleError(_0x1ca4e9,null));};exports[_0x69ae('0x48')]=function(_0x22d7ad,_0x4a59e4){var _0x33284a={'raw':![],'where':{'id':_0x22d7ad[_0x69ae('0x49')]['id']}},_0x2212a0={};_0x2212a0[_0x69ae('0x36')]=_[_0x69ae('0x33')](db['ServicenowConfiguration'][_0x69ae('0x2f')]);_0x2212a0['query']=_[_0x69ae('0x33')](_0x22d7ad[_0x69ae('0x34')]);_0x2212a0[_0x69ae('0x3d')]=_[_0x69ae('0x35')](_0x2212a0['model'],_0x2212a0['query']);_0x33284a[_0x69ae('0x37')]=_[_0x69ae('0x35')](_0x2212a0[_0x69ae('0x36')],qs[_0x69ae('0x4a')](_0x22d7ad['query'][_0x69ae('0x4a')]));_0x33284a['attributes']=_0x33284a['attributes'][_0x69ae('0x38')]?_0x33284a['attributes']:_0x2212a0[_0x69ae('0x36')];if(_0x22d7ad[_0x69ae('0x34')][_0x69ae('0x4b')]){_0x33284a[_0x69ae('0x45')]=[{'all':!![]}];}_0x33284a=_['merge']({},_0x33284a,_0x22d7ad[_0x69ae('0x44')]);return db[_0x69ae('0x2e')][_0x69ae('0x4c')](_0x33284a)[_0x69ae('0x27')](handleEntityNotFound(_0x4a59e4,null))[_0x69ae('0x27')](respondWithResult(_0x4a59e4,null))[_0x69ae('0x47')](handleError(_0x4a59e4,null));};exports['create']=function(_0x1e3b41,_0x22cc41){return db['ServicenowConfiguration'][_0x69ae('0x4d')](_0x1e3b41[_0x69ae('0x4e')],{})[_0x69ae('0x27')](respondWithResult(_0x22cc41,0xc9))[_0x69ae('0x47')](handleError(_0x22cc41,null));};exports[_0x69ae('0x26')]=function(_0x10a355,_0xee125b){if(_0x10a355[_0x69ae('0x4e')]['id']){delete _0x10a355[_0x69ae('0x4e')]['id'];}return db[_0x69ae('0x2e')][_0x69ae('0x4c')]({'where':{'id':_0x10a355[_0x69ae('0x49')]['id']}})[_0x69ae('0x27')](handleEntityNotFound(_0xee125b,null))[_0x69ae('0x27')](saveUpdates(_0x10a355[_0x69ae('0x4e')],null))[_0x69ae('0x27')](respondWithResult(_0xee125b,null))[_0x69ae('0x47')](handleError(_0xee125b,null));};exports[_0x69ae('0x28')]=function(_0x3aeb7a,_0x4bd056){return db[_0x69ae('0x2e')][_0x69ae('0x4c')]({'where':{'id':_0x3aeb7a[_0x69ae('0x49')]['id']}})[_0x69ae('0x27')](handleEntityNotFound(_0x4bd056,null))[_0x69ae('0x27')](removeEntity(_0x4bd056,null))[_0x69ae('0x47')](handleError(_0x4bd056,null));};exports[_0x69ae('0x4f')]=function(_0x43d916,_0x185596,_0x43c664){var _0x57ab32={};var _0x71c3a7={};var _0x2d5e56;var _0x47a9d0;return db['ServicenowConfiguration'][_0x69ae('0x50')]({'where':{'id':_0x43d916['params']['id']}})['then'](handleEntityNotFound(_0x185596,null))[_0x69ae('0x27')](function(_0x2ab753){if(_0x2ab753){_0x2d5e56=_0x2ab753;_0x71c3a7[_0x69ae('0x36')]=_[_0x69ae('0x33')](db[_0x69ae('0x51')][_0x69ae('0x2f')]);_0x71c3a7['query']=_[_0x69ae('0x33')](_0x43d916[_0x69ae('0x34')]);_0x71c3a7[_0x69ae('0x3d')]=_[_0x69ae('0x35')](_0x71c3a7[_0x69ae('0x36')],_0x71c3a7[_0x69ae('0x34')]);_0x57ab32[_0x69ae('0x37')]=_[_0x69ae('0x35')](_0x71c3a7['model'],qs[_0x69ae('0x4a')](_0x43d916[_0x69ae('0x34')][_0x69ae('0x4a')]));_0x57ab32[_0x69ae('0x37')]=_0x57ab32[_0x69ae('0x37')][_0x69ae('0x38')]?_0x57ab32[_0x69ae('0x37')]:_0x71c3a7[_0x69ae('0x36')];_0x57ab32[_0x69ae('0x3b')]=qs['sort'](_0x43d916['query']['sort']);_0x57ab32[_0x69ae('0x40')]=qs[_0x69ae('0x3d')](_['pick'](_0x43d916[_0x69ae('0x34')],_0x71c3a7[_0x69ae('0x3d')]));if(_0x43d916['query']['filter']){_0x57ab32[_0x69ae('0x40')]=_[_0x69ae('0x41')](_0x57ab32[_0x69ae('0x40')],{'$or':_[_0x69ae('0x42')](_0x57ab32[_0x69ae('0x37')],function(_0x82fd9a){var _0x115637={};_0x115637[_0x82fd9a]={'$like':'%'+_0x43d916[_0x69ae('0x34')][_0x69ae('0x3f')]+'%'};return _0x115637;})});}_0x57ab32=_['merge']({},_0x57ab32,_0x43d916[_0x69ae('0x44')]);return _0x2d5e56[_0x69ae('0x4f')](_0x57ab32);}})[_0x69ae('0x27')](function(_0x48e789){if(_0x48e789){_0x47a9d0=_0x48e789['length'];if(!_0x43d916[_0x69ae('0x34')][_0x69ae('0x39')](_0x69ae('0x3a'))){_0x57ab32[_0x69ae('0x1f')]=qs['limit'](_0x43d916['query'][_0x69ae('0x1f')]);_0x57ab32[_0x69ae('0x1e')]=qs['offset'](_0x43d916['query'][_0x69ae('0x1e')]);}return _0x2d5e56[_0x69ae('0x4f')](_0x57ab32);}})[_0x69ae('0x27')](function(_0x1de5b9){if(_0x1de5b9){return _0x1de5b9?{'count':_0x47a9d0,'rows':_0x1de5b9}:null;}})[_0x69ae('0x27')](respondWithResult(_0x185596,null))[_0x69ae('0x47')](handleError(_0x185596,null));};exports[_0x69ae('0x52')]=function(_0x2f8bb4,_0x1a92ce,_0x27b2ed){var _0x227d44={};var _0x4fbfc2={};var _0x64f361;var _0x1a576f;return db[_0x69ae('0x2e')][_0x69ae('0x50')]({'where':{'id':_0x2f8bb4[_0x69ae('0x49')]['id']}})[_0x69ae('0x27')](handleEntityNotFound(_0x1a92ce,null))[_0x69ae('0x27')](function(_0x9384e7){if(_0x9384e7){_0x64f361=_0x9384e7;_0x4fbfc2[_0x69ae('0x36')]=_[_0x69ae('0x33')](db[_0x69ae('0x51')][_0x69ae('0x2f')]);_0x4fbfc2[_0x69ae('0x34')]=_['keys'](_0x2f8bb4[_0x69ae('0x34')]);_0x4fbfc2['filters']=_[_0x69ae('0x35')](_0x4fbfc2[_0x69ae('0x36')],_0x4fbfc2[_0x69ae('0x34')]);_0x227d44[_0x69ae('0x37')]=_[_0x69ae('0x35')](_0x4fbfc2[_0x69ae('0x36')],qs[_0x69ae('0x4a')](_0x2f8bb4['query'][_0x69ae('0x4a')]));_0x227d44[_0x69ae('0x37')]=_0x227d44[_0x69ae('0x37')][_0x69ae('0x38')]?_0x227d44[_0x69ae('0x37')]:_0x4fbfc2['model'];_0x227d44[_0x69ae('0x3b')]=qs[_0x69ae('0x3c')](_0x2f8bb4[_0x69ae('0x34')][_0x69ae('0x3c')]);_0x227d44['where']=qs[_0x69ae('0x3d')](_['pick'](_0x2f8bb4[_0x69ae('0x34')],_0x4fbfc2[_0x69ae('0x3d')]));if(_0x2f8bb4[_0x69ae('0x34')][_0x69ae('0x3f')]){_0x227d44[_0x69ae('0x40')]=_[_0x69ae('0x41')](_0x227d44[_0x69ae('0x40')],{'$or':_[_0x69ae('0x42')](_0x227d44['attributes'],function(_0x49abfd){var _0x34651d={};_0x34651d[_0x49abfd]={'$like':'%'+_0x2f8bb4[_0x69ae('0x34')][_0x69ae('0x3f')]+'%'};return _0x34651d;})});}_0x227d44=_['merge']({},_0x227d44,_0x2f8bb4['options']);return _0x64f361['getSubjects'](_0x227d44);}})['then'](function(_0x3bfee7){if(_0x3bfee7){_0x1a576f=_0x3bfee7[_0x69ae('0x38')];if(!_0x2f8bb4[_0x69ae('0x34')][_0x69ae('0x39')](_0x69ae('0x3a'))){_0x227d44[_0x69ae('0x1f')]=qs[_0x69ae('0x1f')](_0x2f8bb4[_0x69ae('0x34')][_0x69ae('0x1f')]);_0x227d44['offset']=qs[_0x69ae('0x1e')](_0x2f8bb4['query']['offset']);}return _0x64f361[_0x69ae('0x52')](_0x227d44);}})['then'](function(_0x49f66f){if(_0x49f66f){return _0x49f66f?{'count':_0x1a576f,'rows':_0x49f66f}:null;}})[_0x69ae('0x27')](respondWithResult(_0x1a92ce,null))[_0x69ae('0x47')](handleError(_0x1a92ce,null));};exports[_0x69ae('0x53')]=function(_0xf07d47,_0x5c7625,_0x26ecee){var _0x4b4d8d={};var _0x7d5788={};var _0x2f644e;var _0x47171d;return db[_0x69ae('0x2e')][_0x69ae('0x50')]({'where':{'id':_0xf07d47[_0x69ae('0x49')]['id']}})[_0x69ae('0x27')](handleEntityNotFound(_0x5c7625,null))[_0x69ae('0x27')](function(_0x2d1396){if(_0x2d1396){_0x2f644e=_0x2d1396;_0x7d5788['model']=_[_0x69ae('0x33')](db[_0x69ae('0x51')][_0x69ae('0x2f')]);_0x7d5788['query']=_[_0x69ae('0x33')](_0xf07d47[_0x69ae('0x34')]);_0x7d5788['filters']=_[_0x69ae('0x35')](_0x7d5788[_0x69ae('0x36')],_0x7d5788[_0x69ae('0x34')]);_0x4b4d8d[_0x69ae('0x37')]=_['intersection'](_0x7d5788[_0x69ae('0x36')],qs[_0x69ae('0x4a')](_0xf07d47[_0x69ae('0x34')][_0x69ae('0x4a')]));_0x4b4d8d['attributes']=_0x4b4d8d[_0x69ae('0x37')][_0x69ae('0x38')]?_0x4b4d8d[_0x69ae('0x37')]:_0x7d5788[_0x69ae('0x36')];_0x4b4d8d[_0x69ae('0x3b')]=qs[_0x69ae('0x3c')](_0xf07d47[_0x69ae('0x34')][_0x69ae('0x3c')]);_0x4b4d8d[_0x69ae('0x40')]=qs[_0x69ae('0x3d')](_[_0x69ae('0x3e')](_0xf07d47[_0x69ae('0x34')],_0x7d5788[_0x69ae('0x3d')]));if(_0xf07d47[_0x69ae('0x34')][_0x69ae('0x3f')]){_0x4b4d8d[_0x69ae('0x40')]=_[_0x69ae('0x41')](_0x4b4d8d[_0x69ae('0x40')],{'$or':_['map'](_0x4b4d8d[_0x69ae('0x37')],function(_0x12fc65){var _0x480f90={};_0x480f90[_0x12fc65]={'$like':'%'+_0xf07d47['query']['filter']+'%'};return _0x480f90;})});}_0x4b4d8d=_[_0x69ae('0x41')]({},_0x4b4d8d,_0xf07d47['options']);return _0x2f644e[_0x69ae('0x53')](_0x4b4d8d);}})['then'](function(_0x262a4f){if(_0x262a4f){_0x47171d=_0x262a4f[_0x69ae('0x38')];if(!_0xf07d47['query'][_0x69ae('0x39')](_0x69ae('0x3a'))){_0x4b4d8d[_0x69ae('0x1f')]=qs[_0x69ae('0x1f')](_0xf07d47['query']['limit']);_0x4b4d8d[_0x69ae('0x1e')]=qs[_0x69ae('0x1e')](_0xf07d47['query'][_0x69ae('0x1e')]);}return _0x2f644e['getDescriptions'](_0x4b4d8d);}})[_0x69ae('0x27')](function(_0x1661bf){if(_0x1661bf){return _0x1661bf?{'count':_0x47171d,'rows':_0x1661bf}:null;}})[_0x69ae('0x27')](respondWithResult(_0x5c7625,null))['catch'](handleError(_0x5c7625,null));}; \ No newline at end of file +var _0x261b=['getFields','findOne','ServicenowField','nolimit','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','query','keys','model','attributes','intersection','fields','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','length','merge','options','find','create','body','params'];(function(_0x393796,_0x1a399d){var _0x2e74ba=function(_0x52c11c){while(--_0x52c11c){_0x393796['push'](_0x393796['shift']());}};_0x2e74ba(++_0x1a399d);}(_0x261b,0x1f3));var _0xb261=function(_0x30fc4d,_0xd9f313){_0x30fc4d=_0x30fc4d-0x0;var _0x445de2=_0x261b[_0x30fc4d];return _0x445de2;};'use strict';var emlformat=require(_0xb261('0x0'));var rimraf=require(_0xb261('0x1'));var zipdir=require(_0xb261('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb261('0x3'));var moment=require(_0xb261('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb261('0x5'));var path=require(_0xb261('0x6'));var sox=require('sox');var csv=require(_0xb261('0x7'));var ejs=require(_0xb261('0x8'));var fs=require('fs');var fs_extra=require(_0xb261('0x9'));var _=require(_0xb261('0xa'));var squel=require('squel');var crypto=require(_0xb261('0xb'));var jsforce=require(_0xb261('0xc'));var deskjs=require(_0xb261('0xd'));var toCsv=require(_0xb261('0x7'));var querystring=require(_0xb261('0xe'));var Papa=require(_0xb261('0xf'));var Redis=require(_0xb261('0x10'));var authService=require(_0xb261('0x11'));var qs=require(_0xb261('0x12'));var as=require(_0xb261('0x13'));var hardwareService=require(_0xb261('0x14'));var logger=require(_0xb261('0x15'))(_0xb261('0x16'));var utils=require('../../config/utils');var config=require(_0xb261('0x17'));var licenseUtil=require(_0xb261('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe19b76,_0x2c344a){_0x2c344a=_0x2c344a||0xcc;return function(_0x38d0b0){if(_0x38d0b0){return _0xe19b76[_0xb261('0x19')](_0x2c344a);}return _0xe19b76[_0xb261('0x1a')](_0x2c344a)[_0xb261('0x1b')]();};}function respondWithResult(_0x2020e1,_0x4dabd0){_0x4dabd0=_0x4dabd0||0xc8;return function(_0x51e0de){if(_0x51e0de){return _0x2020e1[_0xb261('0x1a')](_0x4dabd0)[_0xb261('0x1c')](_0x51e0de);}};}function respondWithFilteredResult(_0xb0d67c,_0x2e2a86){return function(_0x9587b7){if(_0x9587b7){var _0x3ae1fb=typeof _0x2e2a86[_0xb261('0x1d')]===_0xb261('0x1e')&&typeof _0x2e2a86[_0xb261('0x1f')]===_0xb261('0x1e');var _0x148544=_0x9587b7['count'];var _0x5dc7e2=_0x3ae1fb?0x0:_0x2e2a86[_0xb261('0x1d')];var _0x4bf177=_0x3ae1fb?_0x9587b7[_0xb261('0x20')]:_0x2e2a86['offset']+_0x2e2a86['limit'];var _0x16dd1a;if(_0x4bf177>=_0x148544){_0x4bf177=_0x148544;_0x16dd1a=0xc8;}else{_0x16dd1a=0xce;}_0xb0d67c[_0xb261('0x1a')](_0x16dd1a);return _0xb0d67c['set'](_0xb261('0x21'),_0x5dc7e2+'-'+_0x4bf177+'/'+_0x148544)[_0xb261('0x1c')](_0x9587b7);}return null;};}function patchUpdates(_0x262537){return function(_0x45f768){try{jsonpatch[_0xb261('0x22')](_0x45f768,_0x262537,!![]);}catch(_0x3b3802){return BPromise[_0xb261('0x23')](_0x3b3802);}return _0x45f768[_0xb261('0x24')]();};}function saveUpdates(_0x3d40c4,_0x7f9d3f){return function(_0x1b8599){if(_0x1b8599){return _0x1b8599[_0xb261('0x25')](_0x3d40c4)[_0xb261('0x26')](function(_0x2fe8cc){return _0x2fe8cc;});}return null;};}function removeEntity(_0xc14205,_0x511bdf){return function(_0x35b246){if(_0x35b246){return _0x35b246[_0xb261('0x27')]()[_0xb261('0x26')](function(){_0xc14205[_0xb261('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x275f3b,_0x4572f9){return function(_0x16d387){if(!_0x16d387){_0x275f3b[_0xb261('0x19')](0x194);}return _0x16d387;};}function handleError(_0x543bca,_0x49c025){_0x49c025=_0x49c025||0x1f4;return function(_0x1d31a2){logger['error'](_0x1d31a2[_0xb261('0x28')]);if(_0x1d31a2[_0xb261('0x29')]){delete _0x1d31a2[_0xb261('0x29')];}_0x543bca[_0xb261('0x1a')](_0x49c025)[_0xb261('0x2a')](_0x1d31a2);};}exports[_0xb261('0x2b')]=function(_0x5dfcbb,_0x5ae1b6){var _0x5346af={},_0x3eef9d={},_0x5ed048={'count':0x0,'rows':[]};var _0x55fd9a=_['map'](db[_0xb261('0x2c')][_0xb261('0x2d')],function(_0x19cd9b){return{'name':_0x19cd9b[_0xb261('0x2e')],'type':_0x19cd9b[_0xb261('0x2f')][_0xb261('0x30')]};});_0x3eef9d['model']=_[_0xb261('0x31')](_0x55fd9a,_0xb261('0x29'));_0x3eef9d[_0xb261('0x32')]=_[_0xb261('0x33')](_0x5dfcbb[_0xb261('0x32')]);_0x3eef9d['filters']=_['intersection'](_0x3eef9d[_0xb261('0x34')],_0x3eef9d['query']);_0x5346af[_0xb261('0x35')]=_[_0xb261('0x36')](_0x3eef9d['model'],qs['fields'](_0x5dfcbb[_0xb261('0x32')][_0xb261('0x37')]));_0x5346af[_0xb261('0x35')]=_0x5346af[_0xb261('0x35')]['length']?_0x5346af[_0xb261('0x35')]:_0x3eef9d[_0xb261('0x34')];if(!_0x5dfcbb[_0xb261('0x32')]['hasOwnProperty']('nolimit')){_0x5346af['limit']=qs[_0xb261('0x1f')](_0x5dfcbb[_0xb261('0x32')][_0xb261('0x1f')]);_0x5346af['offset']=qs[_0xb261('0x1d')](_0x5dfcbb['query'][_0xb261('0x1d')]);}_0x5346af[_0xb261('0x38')]=qs[_0xb261('0x39')](_0x5dfcbb['query']['sort']);_0x5346af[_0xb261('0x3a')]=qs[_0xb261('0x3b')](_[_0xb261('0x3c')](_0x5dfcbb['query'],_0x3eef9d[_0xb261('0x3b')]),_0x55fd9a);if(_0x5dfcbb[_0xb261('0x32')][_0xb261('0x3d')]){_0x5346af[_0xb261('0x3a')]=_['merge'](_0x5346af[_0xb261('0x3a')],{'$or':_[_0xb261('0x31')](_0x55fd9a,function(_0x1e2f0b){if(_0x1e2f0b['type']!==_0xb261('0x3e')){var _0x2b7a66={};_0x2b7a66[_0x1e2f0b[_0xb261('0x29')]]={'$like':'%'+_0x5dfcbb[_0xb261('0x32')]['filter']+'%'};return _0x2b7a66;}})});}_0x5346af=_['merge']({},_0x5346af,_0x5dfcbb['options']);var _0x51ca37={'where':_0x5346af[_0xb261('0x3a')]};return db[_0xb261('0x2c')][_0xb261('0x20')](_0x51ca37)['then'](function(_0x388fc7){_0x5ed048[_0xb261('0x20')]=_0x388fc7;if(_0x5dfcbb[_0xb261('0x32')][_0xb261('0x3f')]){_0x5346af[_0xb261('0x40')]=[{'all':!![]}];}return db[_0xb261('0x2c')][_0xb261('0x41')](_0x5346af);})[_0xb261('0x26')](function(_0x2a6cb8){_0x5ed048[_0xb261('0x42')]=_0x2a6cb8;return _0x5ed048;})[_0xb261('0x26')](respondWithFilteredResult(_0x5ae1b6,_0x5346af))[_0xb261('0x43')](handleError(_0x5ae1b6,null));};exports['show']=function(_0x23e8ab,_0x10aa7c){var _0x80b04a={'raw':![],'where':{'id':_0x23e8ab['params']['id']}},_0x33db0d={};_0x33db0d[_0xb261('0x34')]=_['keys'](db[_0xb261('0x2c')][_0xb261('0x2d')]);_0x33db0d['query']=_[_0xb261('0x33')](_0x23e8ab[_0xb261('0x32')]);_0x33db0d[_0xb261('0x3b')]=_[_0xb261('0x36')](_0x33db0d['model'],_0x33db0d[_0xb261('0x32')]);_0x80b04a[_0xb261('0x35')]=_[_0xb261('0x36')](_0x33db0d[_0xb261('0x34')],qs[_0xb261('0x37')](_0x23e8ab[_0xb261('0x32')][_0xb261('0x37')]));_0x80b04a[_0xb261('0x35')]=_0x80b04a[_0xb261('0x35')][_0xb261('0x44')]?_0x80b04a['attributes']:_0x33db0d[_0xb261('0x34')];if(_0x23e8ab['query'][_0xb261('0x3f')]){_0x80b04a[_0xb261('0x40')]=[{'all':!![]}];}_0x80b04a=_[_0xb261('0x45')]({},_0x80b04a,_0x23e8ab[_0xb261('0x46')]);return db[_0xb261('0x2c')][_0xb261('0x47')](_0x80b04a)[_0xb261('0x26')](handleEntityNotFound(_0x10aa7c,null))[_0xb261('0x26')](respondWithResult(_0x10aa7c,null))[_0xb261('0x43')](handleError(_0x10aa7c,null));};exports[_0xb261('0x48')]=function(_0x49c0b3,_0x3ff16f){return db[_0xb261('0x2c')][_0xb261('0x48')](_0x49c0b3['body'],{})[_0xb261('0x26')](respondWithResult(_0x3ff16f,0xc9))[_0xb261('0x43')](handleError(_0x3ff16f,null));};exports[_0xb261('0x25')]=function(_0x3eeb46,_0x10b77e){if(_0x3eeb46[_0xb261('0x49')]['id']){delete _0x3eeb46[_0xb261('0x49')]['id'];}return db[_0xb261('0x2c')]['find']({'where':{'id':_0x3eeb46[_0xb261('0x4a')]['id']}})[_0xb261('0x26')](handleEntityNotFound(_0x10b77e,null))[_0xb261('0x26')](saveUpdates(_0x3eeb46[_0xb261('0x49')],null))[_0xb261('0x26')](respondWithResult(_0x10b77e,null))[_0xb261('0x43')](handleError(_0x10b77e,null));};exports[_0xb261('0x27')]=function(_0x327007,_0x2e705f){return db[_0xb261('0x2c')][_0xb261('0x47')]({'where':{'id':_0x327007[_0xb261('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2e705f,null))[_0xb261('0x26')](removeEntity(_0x2e705f,null))['catch'](handleError(_0x2e705f,null));};exports[_0xb261('0x4b')]=function(_0x460c09,_0x55636c,_0xe5a65a){var _0x5f5b43={};var _0x291b10={};var _0x48862f;var _0x5d63c6;return db[_0xb261('0x2c')][_0xb261('0x4c')]({'where':{'id':_0x460c09[_0xb261('0x4a')]['id']}})[_0xb261('0x26')](handleEntityNotFound(_0x55636c,null))[_0xb261('0x26')](function(_0x356a41){if(_0x356a41){_0x48862f=_0x356a41;_0x291b10[_0xb261('0x34')]=_[_0xb261('0x33')](db[_0xb261('0x4d')]['rawAttributes']);_0x291b10[_0xb261('0x32')]=_[_0xb261('0x33')](_0x460c09[_0xb261('0x32')]);_0x291b10['filters']=_[_0xb261('0x36')](_0x291b10[_0xb261('0x34')],_0x291b10[_0xb261('0x32')]);_0x5f5b43[_0xb261('0x35')]=_[_0xb261('0x36')](_0x291b10['model'],qs[_0xb261('0x37')](_0x460c09[_0xb261('0x32')][_0xb261('0x37')]));_0x5f5b43[_0xb261('0x35')]=_0x5f5b43[_0xb261('0x35')]['length']?_0x5f5b43['attributes']:_0x291b10[_0xb261('0x34')];_0x5f5b43[_0xb261('0x38')]=qs[_0xb261('0x39')](_0x460c09[_0xb261('0x32')][_0xb261('0x39')]);_0x5f5b43[_0xb261('0x3a')]=qs['filters'](_[_0xb261('0x3c')](_0x460c09[_0xb261('0x32')],_0x291b10[_0xb261('0x3b')]));if(_0x460c09[_0xb261('0x32')][_0xb261('0x3d')]){_0x5f5b43['where']=_[_0xb261('0x45')](_0x5f5b43[_0xb261('0x3a')],{'$or':_[_0xb261('0x31')](_0x5f5b43[_0xb261('0x35')],function(_0x38646e){var _0xa53b54={};_0xa53b54[_0x38646e]={'$like':'%'+_0x460c09['query'][_0xb261('0x3d')]+'%'};return _0xa53b54;})});}_0x5f5b43=_['merge']({},_0x5f5b43,_0x460c09['options']);return _0x48862f[_0xb261('0x4b')](_0x5f5b43);}})[_0xb261('0x26')](function(_0x1bc9ae){if(_0x1bc9ae){_0x5d63c6=_0x1bc9ae[_0xb261('0x44')];if(!_0x460c09[_0xb261('0x32')]['hasOwnProperty'](_0xb261('0x4e'))){_0x5f5b43['limit']=qs[_0xb261('0x1f')](_0x460c09[_0xb261('0x32')][_0xb261('0x1f')]);_0x5f5b43[_0xb261('0x1d')]=qs[_0xb261('0x1d')](_0x460c09[_0xb261('0x32')][_0xb261('0x1d')]);}return _0x48862f[_0xb261('0x4b')](_0x5f5b43);}})[_0xb261('0x26')](function(_0x8ac971){if(_0x8ac971){return _0x8ac971?{'count':_0x5d63c6,'rows':_0x8ac971}:null;}})[_0xb261('0x26')](respondWithResult(_0x55636c,null))['catch'](handleError(_0x55636c,null));};exports[_0xb261('0x4f')]=function(_0x176128,_0x5dc70a,_0x4a0c6e){var _0x23f177={};var _0x222fc0={};var _0x2db46f;var _0x4f6402;return db[_0xb261('0x2c')]['findOne']({'where':{'id':_0x176128[_0xb261('0x4a')]['id']}})[_0xb261('0x26')](handleEntityNotFound(_0x5dc70a,null))['then'](function(_0x269669){if(_0x269669){_0x2db46f=_0x269669;_0x222fc0[_0xb261('0x34')]=_[_0xb261('0x33')](db[_0xb261('0x4d')][_0xb261('0x2d')]);_0x222fc0['query']=_[_0xb261('0x33')](_0x176128[_0xb261('0x32')]);_0x222fc0[_0xb261('0x3b')]=_['intersection'](_0x222fc0['model'],_0x222fc0[_0xb261('0x32')]);_0x23f177[_0xb261('0x35')]=_[_0xb261('0x36')](_0x222fc0[_0xb261('0x34')],qs[_0xb261('0x37')](_0x176128[_0xb261('0x32')][_0xb261('0x37')]));_0x23f177['attributes']=_0x23f177['attributes']['length']?_0x23f177[_0xb261('0x35')]:_0x222fc0[_0xb261('0x34')];_0x23f177[_0xb261('0x38')]=qs[_0xb261('0x39')](_0x176128[_0xb261('0x32')][_0xb261('0x39')]);_0x23f177[_0xb261('0x3a')]=qs['filters'](_[_0xb261('0x3c')](_0x176128[_0xb261('0x32')],_0x222fc0[_0xb261('0x3b')]));if(_0x176128[_0xb261('0x32')][_0xb261('0x3d')]){_0x23f177['where']=_[_0xb261('0x45')](_0x23f177[_0xb261('0x3a')],{'$or':_[_0xb261('0x31')](_0x23f177[_0xb261('0x35')],function(_0x3d8427){var _0x502950={};_0x502950[_0x3d8427]={'$like':'%'+_0x176128['query']['filter']+'%'};return _0x502950;})});}_0x23f177=_[_0xb261('0x45')]({},_0x23f177,_0x176128[_0xb261('0x46')]);return _0x2db46f[_0xb261('0x4f')](_0x23f177);}})[_0xb261('0x26')](function(_0x3fa829){if(_0x3fa829){_0x4f6402=_0x3fa829[_0xb261('0x44')];if(!_0x176128[_0xb261('0x32')][_0xb261('0x50')](_0xb261('0x4e'))){_0x23f177['limit']=qs[_0xb261('0x1f')](_0x176128[_0xb261('0x32')]['limit']);_0x23f177[_0xb261('0x1d')]=qs[_0xb261('0x1d')](_0x176128['query']['offset']);}return _0x2db46f['getSubjects'](_0x23f177);}})[_0xb261('0x26')](function(_0x2f0026){if(_0x2f0026){return _0x2f0026?{'count':_0x4f6402,'rows':_0x2f0026}:null;}})[_0xb261('0x26')](respondWithResult(_0x5dc70a,null))[_0xb261('0x43')](handleError(_0x5dc70a,null));};exports['getDescriptions']=function(_0x6b68c,_0xf6eab0,_0x496eab){var _0x585310={};var _0x4be745={};var _0x1fb6b6;var _0x5c0717;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x6b68c[_0xb261('0x4a')]['id']}})[_0xb261('0x26')](handleEntityNotFound(_0xf6eab0,null))[_0xb261('0x26')](function(_0x2f2936){if(_0x2f2936){_0x1fb6b6=_0x2f2936;_0x4be745[_0xb261('0x34')]=_[_0xb261('0x33')](db[_0xb261('0x4d')][_0xb261('0x2d')]);_0x4be745['query']=_[_0xb261('0x33')](_0x6b68c['query']);_0x4be745[_0xb261('0x3b')]=_[_0xb261('0x36')](_0x4be745[_0xb261('0x34')],_0x4be745[_0xb261('0x32')]);_0x585310[_0xb261('0x35')]=_[_0xb261('0x36')](_0x4be745[_0xb261('0x34')],qs[_0xb261('0x37')](_0x6b68c[_0xb261('0x32')]['fields']));_0x585310[_0xb261('0x35')]=_0x585310[_0xb261('0x35')]['length']?_0x585310['attributes']:_0x4be745[_0xb261('0x34')];_0x585310[_0xb261('0x38')]=qs[_0xb261('0x39')](_0x6b68c[_0xb261('0x32')][_0xb261('0x39')]);_0x585310[_0xb261('0x3a')]=qs['filters'](_['pick'](_0x6b68c[_0xb261('0x32')],_0x4be745[_0xb261('0x3b')]));if(_0x6b68c['query'][_0xb261('0x3d')]){_0x585310[_0xb261('0x3a')]=_['merge'](_0x585310['where'],{'$or':_[_0xb261('0x31')](_0x585310[_0xb261('0x35')],function(_0x6acd8a){var _0x464e91={};_0x464e91[_0x6acd8a]={'$like':'%'+_0x6b68c['query']['filter']+'%'};return _0x464e91;})});}_0x585310=_[_0xb261('0x45')]({},_0x585310,_0x6b68c['options']);return _0x1fb6b6[_0xb261('0x51')](_0x585310);}})[_0xb261('0x26')](function(_0xec2bb2){if(_0xec2bb2){_0x5c0717=_0xec2bb2[_0xb261('0x44')];if(!_0x6b68c[_0xb261('0x32')][_0xb261('0x50')](_0xb261('0x4e'))){_0x585310[_0xb261('0x1f')]=qs[_0xb261('0x1f')](_0x6b68c[_0xb261('0x32')][_0xb261('0x1f')]);_0x585310[_0xb261('0x1d')]=qs[_0xb261('0x1d')](_0x6b68c[_0xb261('0x32')][_0xb261('0x1d')]);}return _0x1fb6b6['getDescriptions'](_0x585310);}})[_0xb261('0x26')](function(_0x1e65f5){if(_0x1e65f5){return _0x1e65f5?{'count':_0x5c0717,'rows':_0x1e65f5}:null;}})[_0xb261('0x26')](respondWithResult(_0xf6eab0,null))[_0xb261('0x43')](handleError(_0xf6eab0,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e4fd79b..9e11ec1 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 _0x2964=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x2964,0x108));var _0x4296=function(_0x4fcc9f,_0x4d0877){_0x4fcc9f=_0x4fcc9f-0x0;var _0x46fd56=_0x2964[_0x4fcc9f];return _0x46fd56;};'use strict';var _=require(_0x4296('0x0'));var util=require(_0x4296('0x1'));var logger=require(_0x4296('0x2'))(_0x4296('0x3'));var moment=require(_0x4296('0x4'));var BPromise=require(_0x4296('0x5'));var rp=require(_0x4296('0x6'));var fs=require('fs');var path=require(_0x4296('0x7'));var rimraf=require(_0x4296('0x8'));var config=require('../../config/environment');var attributes=require(_0x4296('0x9'));module[_0x4296('0xa')]=function(_0x23dfb1,_0x10a454){return _0x23dfb1[_0x4296('0xb')](_0x4296('0xc'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa571=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x396033,_0x580005){var _0xaaf767=function(_0x11dbd6){while(--_0x11dbd6){_0x396033['push'](_0x396033['shift']());}};_0xaaf767(++_0x580005);}(_0xa571,0x107));var _0x1a57=function(_0x1d5bb7,_0x5a5ebf){_0x1d5bb7=_0x1d5bb7-0x0;var _0x5a85d1=_0xa571[_0x1d5bb7];return _0x5a85d1;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var logger=require(_0x1a57('0x2'))(_0x1a57('0x3'));var moment=require('moment');var BPromise=require(_0x1a57('0x4'));var rp=require(_0x1a57('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a57('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x1a57('0x7')]=function(_0xd97a33,_0x22ca20){return _0xd97a33[_0x1a57('0x8')](_0x1a57('0x9'),attributes,{'tableName':_0x1a57('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 c876bb9..4161d4e 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 _0x494e=['ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x168740,_0x2a96b5){var _0x303be3=function(_0x9615a6){while(--_0x9615a6){_0x168740['push'](_0x168740['shift']());}};_0x303be3(++_0x2a96b5);}(_0x494e,0xd6));var _0xe494=function(_0x5822bd,_0x4114fd){_0x5822bd=_0x5822bd-0x0;var _0xfc7ecd=_0x494e[_0x5822bd];return _0xfc7ecd;};'use strict';var _=require(_0xe494('0x0'));var util=require('util');var moment=require(_0xe494('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe494('0x2'));var db=require(_0xe494('0x3'))['db'];var utils=require(_0xe494('0x4'));var logger=require(_0xe494('0x5'))(_0xe494('0x6'));var config=require(_0xe494('0x7'));var jayson=require(_0xe494('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16773d,_0x298248,_0x7c1e3e){return new BPromise(function(_0x1c477d,_0x39bca1){return client[_0xe494('0x9')](_0x16773d,_0x7c1e3e)[_0xe494('0xa')](function(_0x58de64){logger[_0xe494('0xb')]('ServicenowConfiguration,\x20%s,\x20%s',_0x298248,'request\x20sent');logger[_0xe494('0xc')](_0xe494('0xd'),_0x298248,_0xe494('0xe'),JSON[_0xe494('0xf')](_0x58de64));if(_0x58de64['error']){if(_0x58de64['error']['code']===0x1f4){logger[_0xe494('0x10')](_0xe494('0x11'),_0x298248,_0x58de64[_0xe494('0x10')]['message']);return _0x39bca1(_0x58de64[_0xe494('0x10')][_0xe494('0x12')]);}logger[_0xe494('0x10')](_0xe494('0x11'),_0x298248,_0x58de64['error'][_0xe494('0x12')]);return _0x1c477d(_0x58de64['error']['message']);}else{logger[_0xe494('0xb')](_0xe494('0x11'),_0x298248,_0xe494('0xe'));_0x1c477d(_0x58de64[_0xe494('0x13')]['message']);}})[_0xe494('0x14')](function(_0x283602){logger[_0xe494('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x298248,_0x283602);_0x39bca1(_0x283602);});});} \ No newline at end of file +var _0x55f6=['stringify','error','code','message','catch','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3ae2b9,_0x320e18){var _0x467022=function(_0x43356d){while(--_0x43356d){_0x3ae2b9['push'](_0x3ae2b9['shift']());}};_0x467022(++_0x320e18);}(_0x55f6,0x159));var _0x655f=function(_0x3f01dd,_0x128e0f){_0x3f01dd=_0x3f01dd-0x0;var _0x4bae40=_0x55f6[_0x3f01dd];return _0x4bae40;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x655f('0x0'));var BPromise=require(_0x655f('0x1'));var rs=require(_0x655f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x655f('0x3'));var logger=require(_0x655f('0x4'))(_0x655f('0x5'));var config=require(_0x655f('0x6'));var jayson=require(_0x655f('0x7'));var client=jayson[_0x655f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x127eb1,_0x55ec6c,_0x5bd3d9){return new BPromise(function(_0x4378d7,_0x1cef29){return client[_0x655f('0x9')](_0x127eb1,_0x5bd3d9)[_0x655f('0xa')](function(_0x4d6158){logger[_0x655f('0xb')](_0x655f('0xc'),_0x55ec6c,'request\x20sent');logger[_0x655f('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x55ec6c,_0x655f('0xe'),JSON[_0x655f('0xf')](_0x4d6158));if(_0x4d6158[_0x655f('0x10')]){if(_0x4d6158[_0x655f('0x10')][_0x655f('0x11')]===0x1f4){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x55ec6c,_0x4d6158['error'][_0x655f('0x12')]);return _0x1cef29(_0x4d6158[_0x655f('0x10')][_0x655f('0x12')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x55ec6c,_0x4d6158[_0x655f('0x10')][_0x655f('0x12')]);return _0x4378d7(_0x4d6158['error'][_0x655f('0x12')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x55ec6c,_0x655f('0xe'));_0x4378d7(_0x4d6158['result'][_0x655f('0x12')]);}})[_0x655f('0x13')](function(_0x20d42f){logger['error'](_0x655f('0xc'),_0x55ec6c,_0x20d42f);_0x1cef29(_0x20d42f);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index ce3d814..5cb550c 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 _0x68ce=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x68ce,0x1e5));var _0xe68c=function(_0x5c2748,_0x564960){_0x5c2748=_0x5c2748-0x0;var _0x59761d=_0x68ce[_0x5c2748];return _0x59761d;};'use strict';var multer=require(_0xe68c('0x0'));var util=require(_0xe68c('0x1'));var path=require(_0xe68c('0x2'));var timeout=require(_0xe68c('0x3'));var express=require(_0xe68c('0x4'));var router=express[_0xe68c('0x5')]();var fs_extra=require(_0xe68c('0x6'));var auth=require(_0xe68c('0x7'));var interaction=require(_0xe68c('0x8'));var config=require(_0xe68c('0x9'));var controller=require('./intServicenowField.controller');router[_0xe68c('0xa')]('/',auth[_0xe68c('0xb')](),controller['index']);router[_0xe68c('0xa')](_0xe68c('0xc'),auth[_0xe68c('0xb')](),controller[_0xe68c('0xd')]);router[_0xe68c('0xe')]('/',auth['isAuthenticated'](),controller[_0xe68c('0xf')]);router[_0xe68c('0x10')](_0xe68c('0xc'),auth[_0xe68c('0xb')](),controller[_0xe68c('0x11')]);router[_0xe68c('0x12')]('/:id',auth[_0xe68c('0xb')](),controller[_0xe68c('0x13')]);module[_0xe68c('0x14')]=router; \ No newline at end of file +var _0xa239=['/:id','show','create','put','update','delete','exports','multer','util','express','fs-extra','../../components/interaction/service','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x23fd61,_0x58c31d){var _0x27a797=function(_0x52c793){while(--_0x52c793){_0x23fd61['push'](_0x23fd61['shift']());}};_0x27a797(++_0x58c31d);}(_0xa239,0x197));var _0x9a23=function(_0x1ec8a0,_0x5b2c3b){_0x1ec8a0=_0x1ec8a0-0x0;var _0x40eea1=_0xa239[_0x1ec8a0];return _0x40eea1;};'use strict';var multer=require(_0x9a23('0x0'));var util=require(_0x9a23('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9a23('0x2'));var router=express['Router']();var fs_extra=require(_0x9a23('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9a23('0x4'));var config=require('../../config/environment');var controller=require(_0x9a23('0x5'));router[_0x9a23('0x6')]('/',auth[_0x9a23('0x7')](),controller[_0x9a23('0x8')]);router[_0x9a23('0x6')](_0x9a23('0x9'),auth[_0x9a23('0x7')](),controller[_0x9a23('0xa')]);router['post']('/',auth[_0x9a23('0x7')](),controller[_0x9a23('0xb')]);router[_0x9a23('0xc')]('/:id',auth[_0x9a23('0x7')](),controller[_0x9a23('0xd')]);router[_0x9a23('0xe')](_0x9a23('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x9a23('0xf')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 6dcd678..1a78630 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 _0x2f07=['STRING','BOOLEAN','ENUM','variable','customVariable','picklist','string'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x2f07,0x121));var _0x72f0=function(_0xb52305,_0x5c2329){_0xb52305=_0xb52305-0x0;var _0x5dc8ed=_0x2f07[_0xb52305];return _0x5dc8ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x72f0('0x0')]('string',_0x72f0('0x1'),_0x72f0('0x2'),'keyValue',_0x72f0('0x3')),'defaultValue':_0x72f0('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x72f0('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0x72f0('0x4'),_0x72f0('0x1'),_0x72f0('0x2'))},'keyContent':{'type':Sequelize[_0x72f0('0x5')]},'idField':{'type':Sequelize[_0x72f0('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x72f0('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x72f0('0x5')]}}; \ No newline at end of file +var _0xf26d=['keyValue','picklist','string','STRING','sequelize','exports','ENUM','variable','customVariable'];(function(_0x3c47bc,_0x5d9c7a){var _0x112482=function(_0x7a450e){while(--_0x7a450e){_0x3c47bc['push'](_0x3c47bc['shift']());}};_0x112482(++_0x5d9c7a);}(_0xf26d,0x199));var _0xdf26=function(_0x3c5d82,_0x3d9231){_0x3c5d82=_0x3c5d82-0x0;var _0x1df62a=_0xf26d[_0x3c5d82];return _0x1df62a;};'use strict';var Sequelize=require(_0xdf26('0x0'));module[_0xdf26('0x1')]={'type':{'type':Sequelize[_0xdf26('0x2')]('string',_0xdf26('0x3'),_0xdf26('0x4'),_0xdf26('0x5'),_0xdf26('0x6')),'defaultValue':_0xdf26('0x7')},'content':{'type':Sequelize[_0xdf26('0x8')]},'key':{'type':Sequelize[_0xdf26('0x8')]},'keyType':{'type':Sequelize[_0xdf26('0x2')](_0xdf26('0x7'),'variable',_0xdf26('0x4'))},'keyContent':{'type':Sequelize[_0xdf26('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdf26('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'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 ef790be..dc86ff4 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 _0x4777=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','update','params','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x39d38e,_0x3da1f7){var _0x18e737=function(_0x373eef){while(--_0x373eef){_0x39d38e['push'](_0x39d38e['shift']());}};_0x18e737(++_0x3da1f7);}(_0x4777,0x170));var _0x7477=function(_0x30a31e,_0x31f766){_0x30a31e=_0x30a31e-0x0;var _0x170879=_0x4777[_0x30a31e];return _0x170879;};'use strict';var emlformat=require(_0x7477('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7477('0x1'));var rp=require(_0x7477('0x2'));var moment=require(_0x7477('0x3'));var BPromise=require(_0x7477('0x4'));var Mustache=require(_0x7477('0x5'));var util=require(_0x7477('0x6'));var path=require(_0x7477('0x7'));var sox=require(_0x7477('0x8'));var csv=require(_0x7477('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7477('0xa'));var _=require(_0x7477('0xb'));var squel=require(_0x7477('0xc'));var crypto=require(_0x7477('0xd'));var jsforce=require(_0x7477('0xe'));var deskjs=require(_0x7477('0xf'));var toCsv=require(_0x7477('0x9'));var querystring=require(_0x7477('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7477('0x11'));var qs=require(_0x7477('0x12'));var as=require(_0x7477('0x13'));var hardwareService=require(_0x7477('0x14'));var logger=require(_0x7477('0x15'))(_0x7477('0x16'));var utils=require(_0x7477('0x17'));var config=require(_0x7477('0x18'));var licenseUtil=require(_0x7477('0x19'));var db=require(_0x7477('0x1a'))['db'];function respondWithStatusCode(_0x36c05f,_0x15fa95){_0x15fa95=_0x15fa95||0xcc;return function(_0x576d97){if(_0x576d97){return _0x36c05f[_0x7477('0x1b')](_0x15fa95);}return _0x36c05f[_0x7477('0x1c')](_0x15fa95)[_0x7477('0x1d')]();};}function respondWithResult(_0x1b2052,_0x558c00){_0x558c00=_0x558c00||0xc8;return function(_0x39fe4e){if(_0x39fe4e){return _0x1b2052['status'](_0x558c00)[_0x7477('0x1e')](_0x39fe4e);}};}function respondWithFilteredResult(_0x22202d,_0x30265d){return function(_0x2c641d){if(_0x2c641d){var _0x307365=typeof _0x30265d[_0x7477('0x1f')]===_0x7477('0x20')&&typeof _0x30265d[_0x7477('0x21')]===_0x7477('0x20');var _0x17b565=_0x2c641d[_0x7477('0x22')];var _0x369e60=_0x307365?0x0:_0x30265d[_0x7477('0x1f')];var _0xfe4320=_0x307365?_0x2c641d[_0x7477('0x22')]:_0x30265d['offset']+_0x30265d[_0x7477('0x21')];var _0x339a8a;if(_0xfe4320>=_0x17b565){_0xfe4320=_0x17b565;_0x339a8a=0xc8;}else{_0x339a8a=0xce;}_0x22202d[_0x7477('0x1c')](_0x339a8a);return _0x22202d[_0x7477('0x23')](_0x7477('0x24'),_0x369e60+'-'+_0xfe4320+'/'+_0x17b565)[_0x7477('0x1e')](_0x2c641d);}return null;};}function patchUpdates(_0x16bfe7){return function(_0x4d3ab7){try{jsonpatch['apply'](_0x4d3ab7,_0x16bfe7,!![]);}catch(_0x599fbd){return BPromise['reject'](_0x599fbd);}return _0x4d3ab7[_0x7477('0x25')]();};}function saveUpdates(_0x56f584,_0x298bc5){return function(_0x330325){if(_0x330325){return _0x330325['update'](_0x56f584)[_0x7477('0x26')](function(_0x52174a){return _0x52174a;});}return null;};}function removeEntity(_0x16bed7,_0x3937fa){return function(_0x26a6be){if(_0x26a6be){return _0x26a6be[_0x7477('0x27')]()[_0x7477('0x26')](function(){_0x16bed7[_0x7477('0x1c')](0xcc)[_0x7477('0x1d')]();});}};}function handleEntityNotFound(_0x2a9f3e,_0x20e66f){return function(_0x2a49e8){if(!_0x2a49e8){_0x2a9f3e[_0x7477('0x1b')](0x194);}return _0x2a49e8;};}function handleError(_0x45e9b8,_0x2ae360){_0x2ae360=_0x2ae360||0x1f4;return function(_0x74113a){logger['error'](_0x74113a[_0x7477('0x28')]);if(_0x74113a['name']){delete _0x74113a[_0x7477('0x29')];}_0x45e9b8[_0x7477('0x1c')](_0x2ae360)[_0x7477('0x2a')](_0x74113a);};}exports[_0x7477('0x2b')]=function(_0x5079ea,_0x4fccfc){var _0x486a13={},_0x1357a2={},_0x17d276={'count':0x0,'rows':[]};var _0x203838=_[_0x7477('0x2c')](db[_0x7477('0x2d')][_0x7477('0x2e')],function(_0x1e0a7a){return{'name':_0x1e0a7a[_0x7477('0x2f')],'type':_0x1e0a7a[_0x7477('0x30')]['key']};});_0x1357a2[_0x7477('0x31')]=_['map'](_0x203838,_0x7477('0x29'));_0x1357a2[_0x7477('0x32')]=_['keys'](_0x5079ea[_0x7477('0x32')]);_0x1357a2['filters']=_[_0x7477('0x33')](_0x1357a2[_0x7477('0x31')],_0x1357a2[_0x7477('0x32')]);_0x486a13['attributes']=_[_0x7477('0x33')](_0x1357a2[_0x7477('0x31')],qs[_0x7477('0x34')](_0x5079ea[_0x7477('0x32')][_0x7477('0x34')]));_0x486a13[_0x7477('0x35')]=_0x486a13[_0x7477('0x35')][_0x7477('0x36')]?_0x486a13[_0x7477('0x35')]:_0x1357a2[_0x7477('0x31')];if(!_0x5079ea[_0x7477('0x32')]['hasOwnProperty'](_0x7477('0x37'))){_0x486a13[_0x7477('0x21')]=qs[_0x7477('0x21')](_0x5079ea['query'][_0x7477('0x21')]);_0x486a13[_0x7477('0x1f')]=qs[_0x7477('0x1f')](_0x5079ea[_0x7477('0x32')][_0x7477('0x1f')]);}_0x486a13[_0x7477('0x38')]=qs['sort'](_0x5079ea[_0x7477('0x32')][_0x7477('0x39')]);_0x486a13[_0x7477('0x3a')]=qs[_0x7477('0x3b')](_[_0x7477('0x3c')](_0x5079ea[_0x7477('0x32')],_0x1357a2['filters']),_0x203838);if(_0x5079ea[_0x7477('0x32')][_0x7477('0x3d')]){_0x486a13[_0x7477('0x3a')]=_['merge'](_0x486a13['where'],{'$or':_[_0x7477('0x2c')](_0x203838,function(_0x2aae46){if(_0x2aae46[_0x7477('0x30')]!==_0x7477('0x3e')){var _0x22cc0a={};_0x22cc0a[_0x2aae46[_0x7477('0x29')]]={'$like':'%'+_0x5079ea[_0x7477('0x32')][_0x7477('0x3d')]+'%'};return _0x22cc0a;}})});}_0x486a13=_['merge']({},_0x486a13,_0x5079ea[_0x7477('0x3f')]);var _0x334bcf={'where':_0x486a13['where']};return db[_0x7477('0x2d')][_0x7477('0x22')](_0x334bcf)[_0x7477('0x26')](function(_0x1bee75){_0x17d276['count']=_0x1bee75;if(_0x5079ea['query'][_0x7477('0x40')]){_0x486a13[_0x7477('0x41')]=[{'all':!![]}];}return db[_0x7477('0x2d')][_0x7477('0x42')](_0x486a13);})[_0x7477('0x26')](function(_0x1dd3df){_0x17d276[_0x7477('0x43')]=_0x1dd3df;return _0x17d276;})['then'](respondWithFilteredResult(_0x4fccfc,_0x486a13))[_0x7477('0x44')](handleError(_0x4fccfc,null));};exports[_0x7477('0x45')]=function(_0x42ebec,_0x1a2dc6){var _0xf1d7ae={'raw':!![],'where':{'id':_0x42ebec['params']['id']}},_0x3466b0={};_0x3466b0[_0x7477('0x31')]=_[_0x7477('0x46')](db['ServicenowField'][_0x7477('0x2e')]);_0x3466b0[_0x7477('0x32')]=_['keys'](_0x42ebec['query']);_0x3466b0[_0x7477('0x3b')]=_[_0x7477('0x33')](_0x3466b0[_0x7477('0x31')],_0x3466b0[_0x7477('0x32')]);_0xf1d7ae[_0x7477('0x35')]=_['intersection'](_0x3466b0[_0x7477('0x31')],qs[_0x7477('0x34')](_0x42ebec[_0x7477('0x32')][_0x7477('0x34')]));_0xf1d7ae[_0x7477('0x35')]=_0xf1d7ae[_0x7477('0x35')][_0x7477('0x36')]?_0xf1d7ae['attributes']:_0x3466b0[_0x7477('0x31')];if(_0x42ebec['query']['includeAll']){_0xf1d7ae[_0x7477('0x41')]=[{'all':!![]}];}_0xf1d7ae=_[_0x7477('0x47')]({},_0xf1d7ae,_0x42ebec[_0x7477('0x3f')]);return db['ServicenowField'][_0x7477('0x48')](_0xf1d7ae)[_0x7477('0x26')](handleEntityNotFound(_0x1a2dc6,null))['then'](respondWithResult(_0x1a2dc6,null))[_0x7477('0x44')](handleError(_0x1a2dc6,null));};exports[_0x7477('0x49')]=function(_0x50a798,_0x1a236b){return db[_0x7477('0x2d')][_0x7477('0x49')](_0x50a798[_0x7477('0x4a')],{})[_0x7477('0x26')](respondWithResult(_0x1a236b,0xc9))[_0x7477('0x44')](handleError(_0x1a236b,null));};exports[_0x7477('0x4b')]=function(_0x32f190,_0x20545b){if(_0x32f190['body']['id']){delete _0x32f190[_0x7477('0x4a')]['id'];}return db['ServicenowField'][_0x7477('0x48')]({'where':{'id':_0x32f190['params']['id']}})[_0x7477('0x26')](handleEntityNotFound(_0x20545b,null))[_0x7477('0x26')](saveUpdates(_0x32f190['body'],null))['then'](respondWithResult(_0x20545b,null))[_0x7477('0x44')](handleError(_0x20545b,null));};exports[_0x7477('0x27')]=function(_0x2c1f28,_0x25d024){return db[_0x7477('0x2d')][_0x7477('0x48')]({'where':{'id':_0x2c1f28[_0x7477('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25d024,null))[_0x7477('0x26')](removeEntity(_0x25d024,null))[_0x7477('0x44')](handleError(_0x25d024,null));}; \ No newline at end of file +var _0x0c04=['path','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','destroy','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x0c04,0x1f2));var _0x40c0=function(_0x957bf3,_0x373a7e){_0x957bf3=_0x957bf3-0x0;var _0x452e76=_0x0c04[_0x957bf3];return _0x452e76;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x40c0('0x0'));var jsonpatch=require(_0x40c0('0x1'));var rp=require(_0x40c0('0x2'));var moment=require(_0x40c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x40c0('0x4'));var util=require(_0x40c0('0x5'));var path=require(_0x40c0('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x40c0('0x7'));var squel=require(_0x40c0('0x8'));var crypto=require(_0x40c0('0x9'));var jsforce=require(_0x40c0('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x40c0('0xb'));var Papa=require(_0x40c0('0xc'));var Redis=require('ioredis');var authService=require(_0x40c0('0xd'));var qs=require(_0x40c0('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x40c0('0xf'));var config=require(_0x40c0('0x10'));var licenseUtil=require(_0x40c0('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x12f85f,_0x286b31){_0x286b31=_0x286b31||0xcc;return function(_0x36e066){if(_0x36e066){return _0x12f85f[_0x40c0('0x12')](_0x286b31);}return _0x12f85f['status'](_0x286b31)[_0x40c0('0x13')]();};}function respondWithResult(_0x5cb870,_0x359807){_0x359807=_0x359807||0xc8;return function(_0x4ce020){if(_0x4ce020){return _0x5cb870[_0x40c0('0x14')](_0x359807)[_0x40c0('0x15')](_0x4ce020);}};}function respondWithFilteredResult(_0x35e532,_0x4248a0){return function(_0x1c1e8d){if(_0x1c1e8d){var _0x1b093c=typeof _0x4248a0['offset']===_0x40c0('0x16')&&typeof _0x4248a0[_0x40c0('0x17')]===_0x40c0('0x16');var _0x37b3d6=_0x1c1e8d[_0x40c0('0x18')];var _0x86b4d2=_0x1b093c?0x0:_0x4248a0['offset'];var _0x55d735=_0x1b093c?_0x1c1e8d[_0x40c0('0x18')]:_0x4248a0[_0x40c0('0x19')]+_0x4248a0[_0x40c0('0x17')];var _0x34ea57;if(_0x55d735>=_0x37b3d6){_0x55d735=_0x37b3d6;_0x34ea57=0xc8;}else{_0x34ea57=0xce;}_0x35e532[_0x40c0('0x14')](_0x34ea57);return _0x35e532[_0x40c0('0x1a')](_0x40c0('0x1b'),_0x86b4d2+'-'+_0x55d735+'/'+_0x37b3d6)[_0x40c0('0x15')](_0x1c1e8d);}return null;};}function patchUpdates(_0x5470b5){return function(_0x508171){try{jsonpatch[_0x40c0('0x1c')](_0x508171,_0x5470b5,!![]);}catch(_0x30f622){return BPromise[_0x40c0('0x1d')](_0x30f622);}return _0x508171[_0x40c0('0x1e')]();};}function saveUpdates(_0x86a4e4,_0x1456e4){return function(_0x295e7e){if(_0x295e7e){return _0x295e7e['update'](_0x86a4e4)[_0x40c0('0x1f')](function(_0x2b37e5){return _0x2b37e5;});}return null;};}function removeEntity(_0x28520a,_0x17f053){return function(_0x1949ed){if(_0x1949ed){return _0x1949ed['destroy']()[_0x40c0('0x1f')](function(){_0x28520a[_0x40c0('0x14')](0xcc)[_0x40c0('0x13')]();});}};}function handleEntityNotFound(_0x109831,_0x523443){return function(_0x3f2757){if(!_0x3f2757){_0x109831[_0x40c0('0x12')](0x194);}return _0x3f2757;};}function handleError(_0x4e8f3d,_0x153442){_0x153442=_0x153442||0x1f4;return function(_0x213f88){logger[_0x40c0('0x20')](_0x213f88[_0x40c0('0x21')]);if(_0x213f88[_0x40c0('0x22')]){delete _0x213f88['name'];}_0x4e8f3d[_0x40c0('0x14')](_0x153442)[_0x40c0('0x23')](_0x213f88);};}exports[_0x40c0('0x24')]=function(_0x2ec266,_0x452481){var _0x2987c6={},_0x50997e={},_0x424e46={'count':0x0,'rows':[]};var _0x3a5c66=_[_0x40c0('0x25')](db[_0x40c0('0x26')][_0x40c0('0x27')],function(_0x2dc56d){return{'name':_0x2dc56d[_0x40c0('0x28')],'type':_0x2dc56d[_0x40c0('0x29')]['key']};});_0x50997e[_0x40c0('0x2a')]=_[_0x40c0('0x25')](_0x3a5c66,_0x40c0('0x22'));_0x50997e[_0x40c0('0x2b')]=_[_0x40c0('0x2c')](_0x2ec266[_0x40c0('0x2b')]);_0x50997e[_0x40c0('0x2d')]=_[_0x40c0('0x2e')](_0x50997e[_0x40c0('0x2a')],_0x50997e[_0x40c0('0x2b')]);_0x2987c6[_0x40c0('0x2f')]=_[_0x40c0('0x2e')](_0x50997e[_0x40c0('0x2a')],qs['fields'](_0x2ec266[_0x40c0('0x2b')]['fields']));_0x2987c6[_0x40c0('0x2f')]=_0x2987c6[_0x40c0('0x2f')][_0x40c0('0x30')]?_0x2987c6['attributes']:_0x50997e[_0x40c0('0x2a')];if(!_0x2ec266[_0x40c0('0x2b')][_0x40c0('0x31')](_0x40c0('0x32'))){_0x2987c6['limit']=qs[_0x40c0('0x17')](_0x2ec266[_0x40c0('0x2b')][_0x40c0('0x17')]);_0x2987c6[_0x40c0('0x19')]=qs[_0x40c0('0x19')](_0x2ec266[_0x40c0('0x2b')][_0x40c0('0x19')]);}_0x2987c6[_0x40c0('0x33')]=qs[_0x40c0('0x34')](_0x2ec266[_0x40c0('0x2b')][_0x40c0('0x34')]);_0x2987c6['where']=qs[_0x40c0('0x2d')](_[_0x40c0('0x35')](_0x2ec266[_0x40c0('0x2b')],_0x50997e[_0x40c0('0x2d')]),_0x3a5c66);if(_0x2ec266[_0x40c0('0x2b')][_0x40c0('0x36')]){_0x2987c6[_0x40c0('0x37')]=_[_0x40c0('0x38')](_0x2987c6['where'],{'$or':_[_0x40c0('0x25')](_0x3a5c66,function(_0x32790c){if(_0x32790c['type']!==_0x40c0('0x39')){var _0x5b3b35={};_0x5b3b35[_0x32790c[_0x40c0('0x22')]]={'$like':'%'+_0x2ec266[_0x40c0('0x2b')][_0x40c0('0x36')]+'%'};return _0x5b3b35;}})});}_0x2987c6=_['merge']({},_0x2987c6,_0x2ec266[_0x40c0('0x3a')]);var _0x52ba37={'where':_0x2987c6[_0x40c0('0x37')]};return db[_0x40c0('0x26')][_0x40c0('0x18')](_0x52ba37)[_0x40c0('0x1f')](function(_0x4acb75){_0x424e46[_0x40c0('0x18')]=_0x4acb75;if(_0x2ec266['query'][_0x40c0('0x3b')]){_0x2987c6[_0x40c0('0x3c')]=[{'all':!![]}];}return db[_0x40c0('0x26')][_0x40c0('0x3d')](_0x2987c6);})[_0x40c0('0x1f')](function(_0x10bf68){_0x424e46[_0x40c0('0x3e')]=_0x10bf68;return _0x424e46;})[_0x40c0('0x1f')](respondWithFilteredResult(_0x452481,_0x2987c6))[_0x40c0('0x3f')](handleError(_0x452481,null));};exports[_0x40c0('0x40')]=function(_0xc3b77,_0x5d14ff){var _0x36a04d={'raw':!![],'where':{'id':_0xc3b77[_0x40c0('0x41')]['id']}},_0x1443bf={};_0x1443bf[_0x40c0('0x2a')]=_[_0x40c0('0x2c')](db['ServicenowField'][_0x40c0('0x27')]);_0x1443bf['query']=_[_0x40c0('0x2c')](_0xc3b77['query']);_0x1443bf[_0x40c0('0x2d')]=_[_0x40c0('0x2e')](_0x1443bf[_0x40c0('0x2a')],_0x1443bf[_0x40c0('0x2b')]);_0x36a04d[_0x40c0('0x2f')]=_[_0x40c0('0x2e')](_0x1443bf[_0x40c0('0x2a')],qs[_0x40c0('0x42')](_0xc3b77[_0x40c0('0x2b')][_0x40c0('0x42')]));_0x36a04d['attributes']=_0x36a04d['attributes'][_0x40c0('0x30')]?_0x36a04d[_0x40c0('0x2f')]:_0x1443bf['model'];if(_0xc3b77[_0x40c0('0x2b')][_0x40c0('0x3b')]){_0x36a04d[_0x40c0('0x3c')]=[{'all':!![]}];}_0x36a04d=_[_0x40c0('0x38')]({},_0x36a04d,_0xc3b77[_0x40c0('0x3a')]);return db[_0x40c0('0x26')][_0x40c0('0x43')](_0x36a04d)['then'](handleEntityNotFound(_0x5d14ff,null))[_0x40c0('0x1f')](respondWithResult(_0x5d14ff,null))[_0x40c0('0x3f')](handleError(_0x5d14ff,null));};exports[_0x40c0('0x44')]=function(_0x521c63,_0x4b98e6){return db[_0x40c0('0x26')]['create'](_0x521c63[_0x40c0('0x45')],{})['then'](respondWithResult(_0x4b98e6,0xc9))[_0x40c0('0x3f')](handleError(_0x4b98e6,null));};exports[_0x40c0('0x46')]=function(_0x1c8435,_0x26579d){if(_0x1c8435['body']['id']){delete _0x1c8435['body']['id'];}return db[_0x40c0('0x26')][_0x40c0('0x43')]({'where':{'id':_0x1c8435[_0x40c0('0x41')]['id']}})[_0x40c0('0x1f')](handleEntityNotFound(_0x26579d,null))['then'](saveUpdates(_0x1c8435[_0x40c0('0x45')],null))[_0x40c0('0x1f')](respondWithResult(_0x26579d,null))[_0x40c0('0x3f')](handleError(_0x26579d,null));};exports[_0x40c0('0x47')]=function(_0x3a9ab5,_0x4659b7){return db[_0x40c0('0x26')][_0x40c0('0x43')]({'where':{'id':_0x3a9ab5[_0x40c0('0x41')]['id']}})[_0x40c0('0x1f')](handleEntityNotFound(_0x4659b7,null))['then'](removeEntity(_0x4659b7,null))['catch'](handleError(_0x4659b7,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b0e604d..1c0297f 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 _0x39e6=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','moment','bluebird','request-promise','path','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x39e6,0xee));var _0x639e=function(_0x242460,_0x1ddfba){_0x242460=_0x242460-0x0;var _0x38e869=_0x39e6[_0x242460];return _0x38e869;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x639e('0x0'));var BPromise=require(_0x639e('0x1'));var rp=require(_0x639e('0x2'));var fs=require('fs');var path=require(_0x639e('0x3'));var rimraf=require('rimraf');var config=require(_0x639e('0x4'));var attributes=require(_0x639e('0x5'));module[_0x639e('0x6')]=function(_0x24e694,_0x48818f){return _0x24e694[_0x639e('0x7')](_0x639e('0x8'),attributes,{'tableName':_0x639e('0x9'),'paranoid':![],'indexes':[{'name':_0x639e('0xa'),'fields':[_0x639e('0xb'),_0x639e('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1f47=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField','servicenow_unique_index','idField'];(function(_0x373d89,_0x3512bb){var _0x372432=function(_0x32d9ca){while(--_0x32d9ca){_0x373d89['push'](_0x373d89['shift']());}};_0x372432(++_0x3512bb);}(_0x1f47,0x16c));var _0x71f4=function(_0x2a6e57,_0x54100f){_0x2a6e57=_0x2a6e57-0x0;var _0x25efad=_0x1f47[_0x2a6e57];return _0x25efad;};'use strict';var _=require(_0x71f4('0x0'));var util=require(_0x71f4('0x1'));var logger=require('../../config/logger')(_0x71f4('0x2'));var moment=require(_0x71f4('0x3'));var BPromise=require(_0x71f4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x71f4('0x5'));var rimraf=require(_0x71f4('0x6'));var config=require(_0x71f4('0x7'));var attributes=require(_0x71f4('0x8'));module[_0x71f4('0x9')]=function(_0x1f047f,_0x188aaa){return _0x1f047f[_0x71f4('0xa')](_0x71f4('0xb'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x71f4('0xc'),'fields':[_0x71f4('0xd'),'FieldId'],'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 46ba500..451337f 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5b3044,_0x5dbd51){var _0x4896d5=function(_0x1b1c79){while(--_0x1b1c79){_0x5b3044['push'](_0x5b3044['shift']());}};_0x4896d5(++_0x5dbd51);}(_0xaa88,0x137));var _0x8aa8=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xaa88[_0x55abd9];return _0x3e5669;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xda3f,0xec));var _0xfda3=function(_0x1d0fbb,_0x1d8bc6){_0x1d0fbb=_0x1d0fbb-0x0;var _0x5191d2=_0xda3f[_0x1d0fbb];return _0x5191d2;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index c651b1e..fc5156f 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x453b31,_0x2a2aec){var _0x4569af=function(_0x37e721){while(--_0x37e721){_0x453b31['push'](_0x453b31['shift']());}};_0x4569af(++_0x2a2aec);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x492040,_0x308f61){var _0x2ad5bf=function(_0x1bed92){while(--_0x1bed92){_0x492040['push'](_0x492040['shift']());}};_0x2ad5bf(++_0x308f61);}(_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('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index a4ed038..8ef22fb 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(_0x57ed2c,_0x56ebf5){var _0x3d4e39=function(_0x3ce8f3){while(--_0x3ce8f3){_0x57ed2c['push'](_0x57ed2c['shift']());}};_0x3d4e39(++_0x56ebf5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'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(_0x2589ef,_0x4e07ff){var _0x243d14=function(_0x3a31e8){while(--_0x3a31e8){_0x2589ef['push'](_0x2589ef['shift']());}};_0x243d14(++_0x4e07ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 a551eb0..2c5243c 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 _0xb7ce=['params','includeAll','find','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','order','filter','options','hasOwnProperty','nolimit','AccountId','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_type','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','format','%s%s','get_module_fields','Calls','values','module_fields','remove','includes','label','test','statusCode','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','error','stack','name','send','SugarcrmAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','limit','sort','where','pick','VIRTUAL','merge','include','findAll','catch'];(function(_0x479e9c,_0x5a2a73){var _0x38aee9=function(_0x10f78c){while(--_0x10f78c){_0x479e9c['push'](_0x479e9c['shift']());}};_0x38aee9(++_0x5a2a73);}(_0xb7ce,0x1a3));var _0xeb7c=function(_0x4280a8,_0x57fe80){_0x4280a8=_0x4280a8-0x0;var _0x32180e=_0xb7ce[_0x4280a8];return _0x32180e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb7c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xeb7c('0x1'));var rp=require(_0xeb7c('0x2'));var moment=require(_0xeb7c('0x3'));var BPromise=require(_0xeb7c('0x4'));var Mustache=require(_0xeb7c('0x5'));var util=require('util');var path=require(_0xeb7c('0x6'));var sox=require(_0xeb7c('0x7'));var csv=require(_0xeb7c('0x8'));var ejs=require(_0xeb7c('0x9'));var fs=require('fs');var fs_extra=require(_0xeb7c('0xa'));var _=require(_0xeb7c('0xb'));var squel=require(_0xeb7c('0xc'));var crypto=require('crypto');var jsforce=require(_0xeb7c('0xd'));var deskjs=require(_0xeb7c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xeb7c('0xf'));var Papa=require(_0xeb7c('0x10'));var Redis=require(_0xeb7c('0x11'));var authService=require(_0xeb7c('0x12'));var qs=require(_0xeb7c('0x13'));var as=require(_0xeb7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xeb7c('0x15'));var utils=require('../../config/utils');var config=require(_0xeb7c('0x16'));var licenseUtil=require(_0xeb7c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xeb7c('0x18'));function respondWithStatusCode(_0xb26420,_0x280e13){_0x280e13=_0x280e13||0xcc;return function(_0x276c75){if(_0x276c75){return _0xb26420[_0xeb7c('0x19')](_0x280e13);}return _0xb26420[_0xeb7c('0x1a')](_0x280e13)[_0xeb7c('0x1b')]();};}function respondWithResult(_0x374317,_0x63c3d3){_0x63c3d3=_0x63c3d3||0xc8;return function(_0x27d613){if(_0x27d613){return _0x374317[_0xeb7c('0x1a')](_0x63c3d3)[_0xeb7c('0x1c')](_0x27d613);}};}function respondWithFilteredResult(_0x4cddce,_0x289d39){return function(_0x58b598){if(_0x58b598){var _0x44e1c9=typeof _0x289d39[_0xeb7c('0x1d')]===_0xeb7c('0x1e')&&typeof _0x289d39['limit']===_0xeb7c('0x1e');var _0x2cb16c=_0x58b598[_0xeb7c('0x1f')];var _0x2b911b=_0x44e1c9?0x0:_0x289d39[_0xeb7c('0x1d')];var _0x374ced=_0x44e1c9?_0x58b598['count']:_0x289d39[_0xeb7c('0x1d')]+_0x289d39['limit'];var _0xc0b3e7;if(_0x374ced>=_0x2cb16c){_0x374ced=_0x2cb16c;_0xc0b3e7=0xc8;}else{_0xc0b3e7=0xce;}_0x4cddce[_0xeb7c('0x1a')](_0xc0b3e7);return _0x4cddce[_0xeb7c('0x20')]('Content-Range',_0x2b911b+'-'+_0x374ced+'/'+_0x2cb16c)[_0xeb7c('0x1c')](_0x58b598);}return null;};}function patchUpdates(_0x451f12){return function(_0x380ead){try{jsonpatch[_0xeb7c('0x21')](_0x380ead,_0x451f12,!![]);}catch(_0x5c4fcc){return BPromise[_0xeb7c('0x22')](_0x5c4fcc);}return _0x380ead[_0xeb7c('0x23')]();};}function saveUpdates(_0xfcc8f0,_0x983d57){return function(_0x5d6049){if(_0x5d6049){return _0x5d6049['update'](_0xfcc8f0)[_0xeb7c('0x24')](function(_0xbecbe2){return _0xbecbe2;});}return null;};}function removeEntity(_0x52102,_0x245fac){return function(_0x1a8946){if(_0x1a8946){return _0x1a8946[_0xeb7c('0x25')]()[_0xeb7c('0x24')](function(){_0x52102[_0xeb7c('0x1a')](0xcc)[_0xeb7c('0x1b')]();});}};}function handleEntityNotFound(_0x141dd1,_0x113066){return function(_0x3c2d89){if(!_0x3c2d89){_0x141dd1[_0xeb7c('0x19')](0x194);}return _0x3c2d89;};}function handleError(_0x255be1,_0x3c0274){_0x3c0274=_0x3c0274||0x1f4;return function(_0x3de17f){logger[_0xeb7c('0x26')](_0x3de17f[_0xeb7c('0x27')]);if(_0x3de17f[_0xeb7c('0x28')]){delete _0x3de17f[_0xeb7c('0x28')];}_0x255be1[_0xeb7c('0x1a')](_0x3c0274)[_0xeb7c('0x29')](_0x3de17f);};}exports['index']=function(_0x42cc9c,_0x192668){var _0x197c38={},_0x14e73f={},_0x5d952d={'count':0x0,'rows':[]};var _0xd44836=_['map'](db[_0xeb7c('0x2a')][_0xeb7c('0x2b')],function(_0x18af5e){return{'name':_0x18af5e[_0xeb7c('0x2c')],'type':_0x18af5e[_0xeb7c('0x2d')][_0xeb7c('0x2e')]};});_0x14e73f['model']=_[_0xeb7c('0x2f')](_0xd44836,'name');_0x14e73f[_0xeb7c('0x30')]=_[_0xeb7c('0x31')](_0x42cc9c['query']);_0x14e73f[_0xeb7c('0x32')]=_[_0xeb7c('0x33')](_0x14e73f[_0xeb7c('0x34')],_0x14e73f[_0xeb7c('0x30')]);_0x197c38['attributes']=_[_0xeb7c('0x33')](_0x14e73f['model'],qs[_0xeb7c('0x35')](_0x42cc9c[_0xeb7c('0x30')][_0xeb7c('0x35')]));_0x197c38[_0xeb7c('0x36')]=_0x197c38[_0xeb7c('0x36')][_0xeb7c('0x37')]?_0x197c38[_0xeb7c('0x36')]:_0x14e73f[_0xeb7c('0x34')];if(!_0x42cc9c['query']['hasOwnProperty']('nolimit')){_0x197c38[_0xeb7c('0x38')]=qs['limit'](_0x42cc9c[_0xeb7c('0x30')]['limit']);_0x197c38[_0xeb7c('0x1d')]=qs[_0xeb7c('0x1d')](_0x42cc9c[_0xeb7c('0x30')][_0xeb7c('0x1d')]);}_0x197c38['order']=qs[_0xeb7c('0x39')](_0x42cc9c['query'][_0xeb7c('0x39')]);_0x197c38[_0xeb7c('0x3a')]=qs[_0xeb7c('0x32')](_[_0xeb7c('0x3b')](_0x42cc9c['query'],_0x14e73f[_0xeb7c('0x32')]),_0xd44836);if(_0x42cc9c['query']['filter']){_0x197c38[_0xeb7c('0x3a')]=_['merge'](_0x197c38[_0xeb7c('0x3a')],{'$or':_[_0xeb7c('0x2f')](_0xd44836,function(_0x420df0){if(_0x420df0['type']!==_0xeb7c('0x3c')){var _0x1a9960={};_0x1a9960[_0x420df0[_0xeb7c('0x28')]]={'$like':'%'+_0x42cc9c[_0xeb7c('0x30')]['filter']+'%'};return _0x1a9960;}})});}_0x197c38=_[_0xeb7c('0x3d')]({},_0x197c38,_0x42cc9c['options']);var _0x5a1af4={'where':_0x197c38[_0xeb7c('0x3a')]};return db[_0xeb7c('0x2a')][_0xeb7c('0x1f')](_0x5a1af4)[_0xeb7c('0x24')](function(_0x181f94){_0x5d952d[_0xeb7c('0x1f')]=_0x181f94;if(_0x42cc9c[_0xeb7c('0x30')]['includeAll']){_0x197c38[_0xeb7c('0x3e')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xeb7c('0x3f')](_0x197c38);})['then'](function(_0x274562){_0x5d952d['rows']=_0x274562;return _0x5d952d;})[_0xeb7c('0x24')](respondWithFilteredResult(_0x192668,_0x197c38))[_0xeb7c('0x40')](handleError(_0x192668,null));};exports['show']=function(_0xf160c7,_0x3e0e4e){var _0xa1df96={'raw':![],'where':{'id':_0xf160c7[_0xeb7c('0x41')]['id']}},_0x14d837={};_0x14d837[_0xeb7c('0x34')]=_[_0xeb7c('0x31')](db['SugarcrmAccount'][_0xeb7c('0x2b')]);_0x14d837[_0xeb7c('0x30')]=_['keys'](_0xf160c7[_0xeb7c('0x30')]);_0x14d837[_0xeb7c('0x32')]=_[_0xeb7c('0x33')](_0x14d837['model'],_0x14d837[_0xeb7c('0x30')]);_0xa1df96[_0xeb7c('0x36')]=_[_0xeb7c('0x33')](_0x14d837[_0xeb7c('0x34')],qs[_0xeb7c('0x35')](_0xf160c7[_0xeb7c('0x30')][_0xeb7c('0x35')]));_0xa1df96[_0xeb7c('0x36')]=_0xa1df96[_0xeb7c('0x36')]['length']?_0xa1df96[_0xeb7c('0x36')]:_0x14d837['model'];if(_0xf160c7[_0xeb7c('0x30')][_0xeb7c('0x42')]){_0xa1df96[_0xeb7c('0x3e')]=[{'all':!![]}];}_0xa1df96=_[_0xeb7c('0x3d')]({},_0xa1df96,_0xf160c7['options']);return db[_0xeb7c('0x2a')][_0xeb7c('0x43')](_0xa1df96)[_0xeb7c('0x24')](handleEntityNotFound(_0x3e0e4e,null))[_0xeb7c('0x24')](respondWithResult(_0x3e0e4e,null))[_0xeb7c('0x40')](handleError(_0x3e0e4e,null));};exports[_0xeb7c('0x44')]=function(_0x2e2f9b,_0x2a71d7){return db[_0xeb7c('0x2a')]['create'](_0x2e2f9b[_0xeb7c('0x45')],{})[_0xeb7c('0x24')](respondWithResult(_0x2a71d7,0xc9))['catch'](handleError(_0x2a71d7,null));};exports[_0xeb7c('0x46')]=function(_0x498511,_0x324543){if(_0x498511['body']['id']){delete _0x498511['body']['id'];}return db[_0xeb7c('0x2a')]['find']({'where':{'id':_0x498511[_0xeb7c('0x41')]['id']}})['then'](handleEntityNotFound(_0x324543,null))[_0xeb7c('0x24')](saveUpdates(_0x498511[_0xeb7c('0x45')],null))['then'](respondWithResult(_0x324543,null))[_0xeb7c('0x40')](handleError(_0x324543,null));};exports[_0xeb7c('0x25')]=function(_0x6f619c,_0x577066){return db[_0xeb7c('0x2a')]['find']({'where':{'id':_0x6f619c[_0xeb7c('0x41')]['id']}})[_0xeb7c('0x24')](handleEntityNotFound(_0x577066,null))[_0xeb7c('0x24')](removeEntity(_0x577066,null))[_0xeb7c('0x40')](handleError(_0x577066,null));};exports[_0xeb7c('0x47')]=function(_0x5db353,_0xf2e321,_0x1a0353){var _0x389271={};var _0x4e0ed8={};var _0x5a2099;var _0x1611ac;return db[_0xeb7c('0x2a')][_0xeb7c('0x48')]({'where':{'id':_0x5db353[_0xeb7c('0x41')]['id']}})[_0xeb7c('0x24')](handleEntityNotFound(_0xf2e321,null))[_0xeb7c('0x24')](function(_0x3f2739){if(_0x3f2739){_0x5a2099=_0x3f2739;_0x4e0ed8[_0xeb7c('0x34')]=_[_0xeb7c('0x31')](db[_0xeb7c('0x49')][_0xeb7c('0x2b')]);_0x4e0ed8[_0xeb7c('0x30')]=_[_0xeb7c('0x31')](_0x5db353[_0xeb7c('0x30')]);_0x4e0ed8[_0xeb7c('0x32')]=_[_0xeb7c('0x33')](_0x4e0ed8['model'],_0x4e0ed8[_0xeb7c('0x30')]);_0x389271[_0xeb7c('0x36')]=_['intersection'](_0x4e0ed8[_0xeb7c('0x34')],qs[_0xeb7c('0x35')](_0x5db353[_0xeb7c('0x30')][_0xeb7c('0x35')]));_0x389271['attributes']=_0x389271['attributes'][_0xeb7c('0x37')]?_0x389271[_0xeb7c('0x36')]:_0x4e0ed8[_0xeb7c('0x34')];_0x389271[_0xeb7c('0x4a')]=qs[_0xeb7c('0x39')](_0x5db353[_0xeb7c('0x30')]['sort']);_0x389271[_0xeb7c('0x3a')]=qs[_0xeb7c('0x32')](_[_0xeb7c('0x3b')](_0x5db353[_0xeb7c('0x30')],_0x4e0ed8[_0xeb7c('0x32')]));if(_0x5db353['query'][_0xeb7c('0x4b')]){_0x389271[_0xeb7c('0x3a')]=_[_0xeb7c('0x3d')](_0x389271[_0xeb7c('0x3a')],{'$or':_[_0xeb7c('0x2f')](_0x389271['attributes'],function(_0x180ced){var _0x714883={};_0x714883[_0x180ced]={'$like':'%'+_0x5db353[_0xeb7c('0x30')][_0xeb7c('0x4b')]+'%'};return _0x714883;})});}_0x389271=_[_0xeb7c('0x3d')]({},_0x389271,_0x5db353[_0xeb7c('0x4c')]);return _0x5a2099[_0xeb7c('0x47')](_0x389271);}})[_0xeb7c('0x24')](function(_0x2f6edf){if(_0x2f6edf){_0x1611ac=_0x2f6edf[_0xeb7c('0x37')];if(!_0x5db353[_0xeb7c('0x30')][_0xeb7c('0x4d')](_0xeb7c('0x4e'))){_0x389271[_0xeb7c('0x38')]=qs['limit'](_0x5db353[_0xeb7c('0x30')][_0xeb7c('0x38')]);_0x389271['offset']=qs[_0xeb7c('0x1d')](_0x5db353[_0xeb7c('0x30')][_0xeb7c('0x1d')]);}return _0x5a2099['getConfigurations'](_0x389271);}})[_0xeb7c('0x24')](function(_0x21a81c){if(_0x21a81c){return _0x21a81c?{'count':_0x1611ac,'rows':_0x21a81c}:null;}})[_0xeb7c('0x24')](respondWithResult(_0xf2e321,null))[_0xeb7c('0x40')](handleError(_0xf2e321,null));};exports['addConfiguration']=function(_0xf2b8b,_0x4713e9,_0x54c07c){if(_0xf2b8b[_0xeb7c('0x45')]['id']){delete _0xf2b8b[_0xeb7c('0x45')]['id'];}return db['SugarcrmAccount'][_0xeb7c('0x48')]({'where':{'id':_0xf2b8b['params']['id']}})[_0xeb7c('0x24')](handleEntityNotFound(_0x4713e9,null))[_0xeb7c('0x24')](function(_0x1018ed){if(_0x1018ed){_0xf2b8b[_0xeb7c('0x45')][_0xeb7c('0x4f')]=_0x1018ed['id'];_0xf2b8b[_0xeb7c('0x45')]['Subjects']=integrations['getSubjects'](_0xf2b8b[_0xeb7c('0x45')][_0xeb7c('0x50')],_0xf2b8b[_0xeb7c('0x45')][_0xeb7c('0x2d')]);_0xf2b8b['body'][_0xeb7c('0x51')]=integrations[_0xeb7c('0x52')](_0xf2b8b[_0xeb7c('0x45')][_0xeb7c('0x50')],_0xf2b8b[_0xeb7c('0x45')][_0xeb7c('0x2d')]);return db[_0xeb7c('0x49')]['create'](_0xf2b8b[_0xeb7c('0x45')],{'include':[{'model':db[_0xeb7c('0x53')],'as':_0xeb7c('0x54')},{'model':db['SugarcrmField'],'as':_0xeb7c('0x51')}]});}return null;})['then'](respondWithResult(_0x4713e9,null))[_0xeb7c('0x40')](handleError(_0x4713e9,null));};exports[_0xeb7c('0x55')]=function(_0x4cb3b9,_0x2e6499,_0x47ce18){var _0xd7516d='';var _0x5b9828=['id','name',_0xeb7c('0x56'),_0xeb7c('0x57'),_0xeb7c('0x58'),_0xeb7c('0x59'),_0xeb7c('0x5a'),_0xeb7c('0x5b'),'parent_id',_0xeb7c('0x5c'),_0xeb7c('0x5d'),_0xeb7c('0x5e')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x4cb3b9['params']['id']},'attributes':['id',_0xeb7c('0x5f'),_0xeb7c('0x60'),_0xeb7c('0x61')]})[_0xeb7c('0x24')](handleEntityNotFound(_0x2e6499,null))[_0xeb7c('0x24')](function(_0x1b6e99){if(_0x1b6e99){_0xd7516d=_0x1b6e99[_0xeb7c('0x61')];var _0x475486=_0xd7516d[_0xeb7c('0x62')](-0x1);if(_0x475486==='/'){_0xd7516d=_0xd7516d[_0xeb7c('0x63')](0x0,_0xd7516d[_0xeb7c('0x64')](_0x475486));}return rp({'method':_0xeb7c('0x65'),'uri':util['format']('%s%s',_0xd7516d,_0xeb7c('0x66')),'json':!![],'form':{'method':_0xeb7c('0x67'),'input_type':'JSON','response_type':_0xeb7c('0x68'),'rest_data':JSON[_0xeb7c('0x69')]({'user_auth':{'user_name':_0x1b6e99[_0xeb7c('0x5f')],'password':_0x1b6e99[_0xeb7c('0x60')],'encryption':_0xeb7c('0x6a')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0xeb7c('0x24')](function(_0x3c9a66){if(_0x3c9a66&&_0x3c9a66['name']!==_0xeb7c('0x6b')&&_0x3c9a66['name']!==_0xeb7c('0x6c')){return rp({'method':_0xeb7c('0x65'),'uri':util[_0xeb7c('0x6d')](_0xeb7c('0x6e'),_0xd7516d,_0xeb7c('0x66')),'json':!![],'form':{'method':_0xeb7c('0x6f'),'input_type':'JSON','response_type':_0xeb7c('0x68'),'rest_data':JSON[_0xeb7c('0x69')]({'session':_0x3c9a66['id'],'module_name':_0xeb7c('0x70')})}})[_0xeb7c('0x24')](function(_0x363b2b){if(_0x363b2b){var _0x14c0c5=_[_0xeb7c('0x71')](_0x363b2b[_0xeb7c('0x72')]);_[_0xeb7c('0x73')](_0x14c0c5,function(_0x292d2f){return _0x5b9828[_0xeb7c('0x74')](_0x292d2f[_0xeb7c('0x28')]);});return{'count':_0x14c0c5[_0xeb7c('0x37')],'rows':_['map'](_0x14c0c5,function(_0x1ed791){return{'id':_0x1ed791[_0xeb7c('0x28')],'name':_0x1ed791[_0xeb7c('0x75')],'custom':_['endsWith'](_0x1ed791[_0xeb7c('0x28')],'_c')?!![]:![],'options':_0x1ed791[_0xeb7c('0x4c')]?_[_0xeb7c('0x2f')](_[_0xeb7c('0x71')](_0x1ed791['options']),function(_0x77925a){return{'name':_0x77925a['value'],'value':_0x77925a[_0xeb7c('0x28')]};}):[]};})};}})['then'](respondWithResult(_0x2e6499,null))[_0xeb7c('0x40')](function(_0x466a92){var _0x2235e6=_0x4cb3b9[_0xeb7c('0x30')][_0xeb7c('0x76')]?0x1f4:_0x466a92[_0xeb7c('0x77')]||0x1f4;logger[_0xeb7c('0x26')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x2235e6,JSON[_0xeb7c('0x69')](_0x466a92));delete _0x466a92[_0xeb7c('0x28')];if(_0x2235e6===0x191){_0x2235e6=0x190;}_0x2e6499['status'](_0x2235e6)[_0xeb7c('0x29')](_0x4cb3b9['query'][_0xeb7c('0x76')]?{'message':_0xeb7c('0x78'),'statusCode':_0x466a92[_0xeb7c('0x77')]}:_0x466a92);});}else{var _0x5b381c=0x1f4;_0x2e6499[_0xeb7c('0x1a')](_0x5b381c)[_0xeb7c('0x29')]({'message':_0xeb7c('0x78'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x3dc4=['papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','limit','set','reject','save','update','then','stack','name','index','map','SugarcrmAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','params','keys','rawAttributes','length','includeAll','create','body','find','findOne','SugarcrmConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','getFields','assigned_user_id','description','duration_hours','duration_minutes','parent_type','parent_name','direction','password','remoteUri','lastIndexOf','POST','format','%s%s','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove','includes','label','endsWith','values','value','test','error','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x429bfd,_0x36aa0c){var _0x1f4422=function(_0x5dd867){while(--_0x5dd867){_0x429bfd['push'](_0x429bfd['shift']());}};_0x1f4422(++_0x36aa0c);}(_0x3dc4,0x1cd));var _0x43dc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3dc4[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x43dc('0x0'));var rimraf=require(_0x43dc('0x1'));var zipdir=require(_0x43dc('0x2'));var jsonpatch=require(_0x43dc('0x3'));var rp=require(_0x43dc('0x4'));var moment=require(_0x43dc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x43dc('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x43dc('0x7'));var ejs=require(_0x43dc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x43dc('0x9'));var squel=require(_0x43dc('0xa'));var crypto=require(_0x43dc('0xb'));var jsforce=require(_0x43dc('0xc'));var deskjs=require(_0x43dc('0xd'));var toCsv=require(_0x43dc('0x7'));var querystring=require(_0x43dc('0xe'));var Papa=require(_0x43dc('0xf'));var Redis=require(_0x43dc('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x43dc('0x11'));var hardwareService=require(_0x43dc('0x12'));var logger=require(_0x43dc('0x13'))(_0x43dc('0x14'));var utils=require(_0x43dc('0x15'));var config=require(_0x43dc('0x16'));var licenseUtil=require(_0x43dc('0x17'));var db=require(_0x43dc('0x18'))['db'];var integrations=require(_0x43dc('0x19'));function respondWithStatusCode(_0x3466a4,_0x4d8a4c){_0x4d8a4c=_0x4d8a4c||0xcc;return function(_0x520336){if(_0x520336){return _0x3466a4[_0x43dc('0x1a')](_0x4d8a4c);}return _0x3466a4[_0x43dc('0x1b')](_0x4d8a4c)[_0x43dc('0x1c')]();};}function respondWithResult(_0x232441,_0x79e218){_0x79e218=_0x79e218||0xc8;return function(_0x382101){if(_0x382101){return _0x232441[_0x43dc('0x1b')](_0x79e218)[_0x43dc('0x1d')](_0x382101);}};}function respondWithFilteredResult(_0x4aab58,_0x155a2e){return function(_0x5b05be){if(_0x5b05be){var _0x323eb5=typeof _0x155a2e['offset']===_0x43dc('0x1e')&&typeof _0x155a2e['limit']==='undefined';var _0x36afd7=_0x5b05be['count'];var _0x390210=_0x323eb5?0x0:_0x155a2e[_0x43dc('0x1f')];var _0x4633ac=_0x323eb5?_0x5b05be['count']:_0x155a2e['offset']+_0x155a2e[_0x43dc('0x20')];var _0x3e9ea6;if(_0x4633ac>=_0x36afd7){_0x4633ac=_0x36afd7;_0x3e9ea6=0xc8;}else{_0x3e9ea6=0xce;}_0x4aab58[_0x43dc('0x1b')](_0x3e9ea6);return _0x4aab58[_0x43dc('0x21')]('Content-Range',_0x390210+'-'+_0x4633ac+'/'+_0x36afd7)[_0x43dc('0x1d')](_0x5b05be);}return null;};}function patchUpdates(_0x4edec4){return function(_0x3f1e35){try{jsonpatch['apply'](_0x3f1e35,_0x4edec4,!![]);}catch(_0x3bdc8d){return BPromise[_0x43dc('0x22')](_0x3bdc8d);}return _0x3f1e35[_0x43dc('0x23')]();};}function saveUpdates(_0x50c6fa,_0x3e1e90){return function(_0xf52154){if(_0xf52154){return _0xf52154[_0x43dc('0x24')](_0x50c6fa)[_0x43dc('0x25')](function(_0x397321){return _0x397321;});}return null;};}function removeEntity(_0x3f3b7d,_0x84461c){return function(_0x2c7dfe){if(_0x2c7dfe){return _0x2c7dfe['destroy']()[_0x43dc('0x25')](function(){_0x3f3b7d[_0x43dc('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19d5b9,_0x4c0ed7){return function(_0x1e1074){if(!_0x1e1074){_0x19d5b9[_0x43dc('0x1a')](0x194);}return _0x1e1074;};}function handleError(_0x17e8ab,_0x66897c){_0x66897c=_0x66897c||0x1f4;return function(_0x39f414){logger['error'](_0x39f414[_0x43dc('0x26')]);if(_0x39f414[_0x43dc('0x27')]){delete _0x39f414[_0x43dc('0x27')];}_0x17e8ab[_0x43dc('0x1b')](_0x66897c)['send'](_0x39f414);};}exports[_0x43dc('0x28')]=function(_0x27d24b,_0x3349dd){var _0x2b1410={},_0x133874={},_0xaf2cfa={'count':0x0,'rows':[]};var _0x26355c=_[_0x43dc('0x29')](db[_0x43dc('0x2a')]['rawAttributes'],function(_0x4e106f){return{'name':_0x4e106f[_0x43dc('0x2b')],'type':_0x4e106f[_0x43dc('0x2c')][_0x43dc('0x2d')]};});_0x133874[_0x43dc('0x2e')]=_[_0x43dc('0x29')](_0x26355c,'name');_0x133874['query']=_['keys'](_0x27d24b[_0x43dc('0x2f')]);_0x133874[_0x43dc('0x30')]=_[_0x43dc('0x31')](_0x133874[_0x43dc('0x2e')],_0x133874[_0x43dc('0x2f')]);_0x2b1410[_0x43dc('0x32')]=_[_0x43dc('0x31')](_0x133874[_0x43dc('0x2e')],qs[_0x43dc('0x33')](_0x27d24b[_0x43dc('0x2f')][_0x43dc('0x33')]));_0x2b1410[_0x43dc('0x32')]=_0x2b1410[_0x43dc('0x32')]['length']?_0x2b1410[_0x43dc('0x32')]:_0x133874[_0x43dc('0x2e')];if(!_0x27d24b[_0x43dc('0x2f')]['hasOwnProperty'](_0x43dc('0x34'))){_0x2b1410[_0x43dc('0x20')]=qs['limit'](_0x27d24b[_0x43dc('0x2f')][_0x43dc('0x20')]);_0x2b1410[_0x43dc('0x1f')]=qs['offset'](_0x27d24b['query'][_0x43dc('0x1f')]);}_0x2b1410[_0x43dc('0x35')]=qs[_0x43dc('0x36')](_0x27d24b[_0x43dc('0x2f')][_0x43dc('0x36')]);_0x2b1410[_0x43dc('0x37')]=qs[_0x43dc('0x30')](_[_0x43dc('0x38')](_0x27d24b[_0x43dc('0x2f')],_0x133874['filters']),_0x26355c);if(_0x27d24b[_0x43dc('0x2f')][_0x43dc('0x39')]){_0x2b1410[_0x43dc('0x37')]=_[_0x43dc('0x3a')](_0x2b1410['where'],{'$or':_['map'](_0x26355c,function(_0x4bb646){if(_0x4bb646['type']!==_0x43dc('0x3b')){var _0x15bfab={};_0x15bfab[_0x4bb646['name']]={'$like':'%'+_0x27d24b[_0x43dc('0x2f')][_0x43dc('0x39')]+'%'};return _0x15bfab;}})});}_0x2b1410=_[_0x43dc('0x3a')]({},_0x2b1410,_0x27d24b[_0x43dc('0x3c')]);var _0x2dd331={'where':_0x2b1410['where']};return db[_0x43dc('0x2a')][_0x43dc('0x3d')](_0x2dd331)['then'](function(_0x14d64c){_0xaf2cfa[_0x43dc('0x3d')]=_0x14d64c;if(_0x27d24b['query']['includeAll']){_0x2b1410[_0x43dc('0x3e')]=[{'all':!![]}];}return db[_0x43dc('0x2a')][_0x43dc('0x3f')](_0x2b1410);})[_0x43dc('0x25')](function(_0x24ca0d){_0xaf2cfa[_0x43dc('0x40')]=_0x24ca0d;return _0xaf2cfa;})['then'](respondWithFilteredResult(_0x3349dd,_0x2b1410))[_0x43dc('0x41')](handleError(_0x3349dd,null));};exports[_0x43dc('0x42')]=function(_0x6a7254,_0x5a5d14){var _0x816da={'raw':![],'where':{'id':_0x6a7254[_0x43dc('0x43')]['id']}},_0x33f75e={};_0x33f75e[_0x43dc('0x2e')]=_[_0x43dc('0x44')](db[_0x43dc('0x2a')][_0x43dc('0x45')]);_0x33f75e[_0x43dc('0x2f')]=_[_0x43dc('0x44')](_0x6a7254[_0x43dc('0x2f')]);_0x33f75e[_0x43dc('0x30')]=_['intersection'](_0x33f75e['model'],_0x33f75e[_0x43dc('0x2f')]);_0x816da[_0x43dc('0x32')]=_[_0x43dc('0x31')](_0x33f75e[_0x43dc('0x2e')],qs[_0x43dc('0x33')](_0x6a7254['query']['fields']));_0x816da[_0x43dc('0x32')]=_0x816da[_0x43dc('0x32')][_0x43dc('0x46')]?_0x816da[_0x43dc('0x32')]:_0x33f75e[_0x43dc('0x2e')];if(_0x6a7254[_0x43dc('0x2f')][_0x43dc('0x47')]){_0x816da[_0x43dc('0x3e')]=[{'all':!![]}];}_0x816da=_['merge']({},_0x816da,_0x6a7254[_0x43dc('0x3c')]);return db[_0x43dc('0x2a')]['find'](_0x816da)[_0x43dc('0x25')](handleEntityNotFound(_0x5a5d14,null))[_0x43dc('0x25')](respondWithResult(_0x5a5d14,null))['catch'](handleError(_0x5a5d14,null));};exports[_0x43dc('0x48')]=function(_0x4cb58d,_0x36e926){return db[_0x43dc('0x2a')][_0x43dc('0x48')](_0x4cb58d[_0x43dc('0x49')],{})[_0x43dc('0x25')](respondWithResult(_0x36e926,0xc9))[_0x43dc('0x41')](handleError(_0x36e926,null));};exports[_0x43dc('0x24')]=function(_0x3e6b23,_0x406cb1){if(_0x3e6b23[_0x43dc('0x49')]['id']){delete _0x3e6b23[_0x43dc('0x49')]['id'];}return db[_0x43dc('0x2a')]['find']({'where':{'id':_0x3e6b23[_0x43dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x406cb1,null))[_0x43dc('0x25')](saveUpdates(_0x3e6b23[_0x43dc('0x49')],null))['then'](respondWithResult(_0x406cb1,null))['catch'](handleError(_0x406cb1,null));};exports['destroy']=function(_0x31bc2f,_0x4ea972){return db['SugarcrmAccount'][_0x43dc('0x4a')]({'where':{'id':_0x31bc2f[_0x43dc('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ea972,null))[_0x43dc('0x25')](removeEntity(_0x4ea972,null))['catch'](handleError(_0x4ea972,null));};exports['getConfigurations']=function(_0x2ef029,_0x3d0977,_0x5f599c){var _0x5ba0e1={};var _0x4b9ac1={};var _0x5e0a60;var _0x3c0db7;return db[_0x43dc('0x2a')][_0x43dc('0x4b')]({'where':{'id':_0x2ef029[_0x43dc('0x43')]['id']}})[_0x43dc('0x25')](handleEntityNotFound(_0x3d0977,null))[_0x43dc('0x25')](function(_0x2b53e6){if(_0x2b53e6){_0x5e0a60=_0x2b53e6;_0x4b9ac1['model']=_[_0x43dc('0x44')](db[_0x43dc('0x4c')]['rawAttributes']);_0x4b9ac1[_0x43dc('0x2f')]=_[_0x43dc('0x44')](_0x2ef029[_0x43dc('0x2f')]);_0x4b9ac1[_0x43dc('0x30')]=_[_0x43dc('0x31')](_0x4b9ac1[_0x43dc('0x2e')],_0x4b9ac1['query']);_0x5ba0e1['attributes']=_['intersection'](_0x4b9ac1[_0x43dc('0x2e')],qs[_0x43dc('0x33')](_0x2ef029[_0x43dc('0x2f')][_0x43dc('0x33')]));_0x5ba0e1['attributes']=_0x5ba0e1['attributes'][_0x43dc('0x46')]?_0x5ba0e1['attributes']:_0x4b9ac1[_0x43dc('0x2e')];_0x5ba0e1[_0x43dc('0x35')]=qs['sort'](_0x2ef029['query'][_0x43dc('0x36')]);_0x5ba0e1[_0x43dc('0x37')]=qs[_0x43dc('0x30')](_[_0x43dc('0x38')](_0x2ef029[_0x43dc('0x2f')],_0x4b9ac1[_0x43dc('0x30')]));if(_0x2ef029[_0x43dc('0x2f')][_0x43dc('0x39')]){_0x5ba0e1['where']=_[_0x43dc('0x3a')](_0x5ba0e1['where'],{'$or':_['map'](_0x5ba0e1[_0x43dc('0x32')],function(_0x37b6f6){var _0x16d540={};_0x16d540[_0x37b6f6]={'$like':'%'+_0x2ef029[_0x43dc('0x2f')][_0x43dc('0x39')]+'%'};return _0x16d540;})});}_0x5ba0e1=_[_0x43dc('0x3a')]({},_0x5ba0e1,_0x2ef029[_0x43dc('0x3c')]);return _0x5e0a60[_0x43dc('0x4d')](_0x5ba0e1);}})['then'](function(_0x6c7425){if(_0x6c7425){_0x3c0db7=_0x6c7425[_0x43dc('0x46')];if(!_0x2ef029[_0x43dc('0x2f')]['hasOwnProperty'](_0x43dc('0x34'))){_0x5ba0e1[_0x43dc('0x20')]=qs[_0x43dc('0x20')](_0x2ef029[_0x43dc('0x2f')][_0x43dc('0x20')]);_0x5ba0e1['offset']=qs[_0x43dc('0x1f')](_0x2ef029['query'][_0x43dc('0x1f')]);}return _0x5e0a60[_0x43dc('0x4d')](_0x5ba0e1);}})['then'](function(_0x342cd7){if(_0x342cd7){return _0x342cd7?{'count':_0x3c0db7,'rows':_0x342cd7}:null;}})[_0x43dc('0x25')](respondWithResult(_0x3d0977,null))['catch'](handleError(_0x3d0977,null));};exports[_0x43dc('0x4e')]=function(_0x1c7dae,_0x289e52,_0x349d94){if(_0x1c7dae[_0x43dc('0x49')]['id']){delete _0x1c7dae[_0x43dc('0x49')]['id'];}return db['SugarcrmAccount'][_0x43dc('0x4b')]({'where':{'id':_0x1c7dae[_0x43dc('0x43')]['id']}})[_0x43dc('0x25')](handleEntityNotFound(_0x289e52,null))[_0x43dc('0x25')](function(_0x587642){if(_0x587642){_0x1c7dae[_0x43dc('0x49')][_0x43dc('0x4f')]=_0x587642['id'];_0x1c7dae['body'][_0x43dc('0x50')]=integrations[_0x43dc('0x51')](_0x1c7dae[_0x43dc('0x49')]['channel'],_0x1c7dae[_0x43dc('0x49')][_0x43dc('0x2c')]);_0x1c7dae[_0x43dc('0x49')][_0x43dc('0x52')]=integrations[_0x43dc('0x53')](_0x1c7dae['body'][_0x43dc('0x54')],_0x1c7dae[_0x43dc('0x49')][_0x43dc('0x2c')]);return db[_0x43dc('0x4c')][_0x43dc('0x48')](_0x1c7dae['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x43dc('0x50')},{'model':db['SugarcrmField'],'as':_0x43dc('0x52')}]});}return null;})[_0x43dc('0x25')](respondWithResult(_0x289e52,null))[_0x43dc('0x41')](handleError(_0x289e52,null));};exports[_0x43dc('0x55')]=function(_0x2aae86,_0xf4b577,_0xa44bd2){var _0x2cd99f='';var _0x111db5=['id',_0x43dc('0x27'),_0x43dc('0x56'),'created_by',_0x43dc('0x57'),'date_start',_0x43dc('0x58'),_0x43dc('0x59'),'parent_id',_0x43dc('0x5a'),_0x43dc('0x5b'),_0x43dc('0x5c')];return db[_0x43dc('0x2a')][_0x43dc('0x4b')]({'where':{'id':_0x2aae86[_0x43dc('0x43')]['id']},'attributes':['id','username',_0x43dc('0x5d'),_0x43dc('0x5e')]})[_0x43dc('0x25')](handleEntityNotFound(_0xf4b577,null))[_0x43dc('0x25')](function(_0x4b798c){if(_0x4b798c){_0x2cd99f=_0x4b798c[_0x43dc('0x5e')];var _0x3fab61=_0x2cd99f['slice'](-0x1);if(_0x3fab61==='/'){_0x2cd99f=_0x2cd99f['substring'](0x0,_0x2cd99f[_0x43dc('0x5f')](_0x3fab61));}return rp({'method':_0x43dc('0x60'),'uri':util[_0x43dc('0x61')](_0x43dc('0x62'),_0x2cd99f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x43dc('0x63'),'response_type':_0x43dc('0x63'),'rest_data':JSON[_0x43dc('0x64')]({'user_auth':{'user_name':_0x4b798c[_0x43dc('0x65')],'password':_0x4b798c['password'],'encryption':_0x43dc('0x66')},'application':_0x43dc('0x67')})}});}})[_0x43dc('0x25')](function(_0x3a4b02){if(_0x3a4b02&&_0x3a4b02[_0x43dc('0x27')]!==_0x43dc('0x68')&&_0x3a4b02[_0x43dc('0x27')]!==_0x43dc('0x69')){return rp({'method':_0x43dc('0x60'),'uri':util[_0x43dc('0x61')](_0x43dc('0x62'),_0x2cd99f,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x43dc('0x63'),'rest_data':JSON[_0x43dc('0x64')]({'session':_0x3a4b02['id'],'module_name':_0x43dc('0x6a')})}})[_0x43dc('0x25')](function(_0xac343e){if(_0xac343e){var _0x4e7b55=_['values'](_0xac343e[_0x43dc('0x6b')]);_[_0x43dc('0x6c')](_0x4e7b55,function(_0x485d2f){return _0x111db5[_0x43dc('0x6d')](_0x485d2f['name']);});return{'count':_0x4e7b55[_0x43dc('0x46')],'rows':_['map'](_0x4e7b55,function(_0x5632c8){return{'id':_0x5632c8[_0x43dc('0x27')],'name':_0x5632c8[_0x43dc('0x6e')],'custom':_[_0x43dc('0x6f')](_0x5632c8[_0x43dc('0x27')],'_c')?!![]:![],'options':_0x5632c8['options']?_['map'](_[_0x43dc('0x70')](_0x5632c8[_0x43dc('0x3c')]),function(_0x15a333){return{'name':_0x15a333[_0x43dc('0x71')],'value':_0x15a333['name']};}):[]};})};}})[_0x43dc('0x25')](respondWithResult(_0xf4b577,null))['catch'](function(_0xbf3504){var _0x322c90=_0x2aae86[_0x43dc('0x2f')][_0x43dc('0x72')]?0x1f4:_0xbf3504['statusCode']||0x1f4;logger[_0x43dc('0x73')](_0x43dc('0x74'),_0x43dc('0x55'),_0x322c90,JSON[_0x43dc('0x64')](_0xbf3504));delete _0xbf3504[_0x43dc('0x27')];if(_0x322c90===0x191){_0x322c90=0x190;}_0xf4b577['status'](_0x322c90)['send'](_0x2aae86[_0x43dc('0x2f')][_0x43dc('0x72')]?{'message':_0x43dc('0x75'),'statusCode':_0xbf3504['statusCode']}:_0xbf3504);});}else{var _0x122c84=0x1f4;_0xf4b577[_0x43dc('0x1b')](_0x122c84)[_0x43dc('0x76')]({'message':_0x43dc('0x75'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 8c2624d..8254304 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 _0x8535=['api','bluebird','request-promise','path','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','lodash','util','../../config/logger'];(function(_0x234bb5,_0xee1d0f){var _0x2a8046=function(_0x473365){while(--_0x473365){_0x234bb5['push'](_0x234bb5['shift']());}};_0x2a8046(++_0xee1d0f);}(_0x8535,0xbd));var _0x5853=function(_0x719323,_0x37500e){_0x719323=_0x719323-0x0;var _0xe1a983=_0x8535[_0x719323];return _0xe1a983;};'use strict';var _=require(_0x5853('0x0'));var util=require(_0x5853('0x1'));var logger=require(_0x5853('0x2'))(_0x5853('0x3'));var moment=require('moment');var BPromise=require(_0x5853('0x4'));var rp=require(_0x5853('0x5'));var fs=require('fs');var path=require(_0x5853('0x6'));var rimraf=require('rimraf');var config=require(_0x5853('0x7'));var attributes=require(_0x5853('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x5853('0x9')]=function(_0x1e0dab,_0x2ac469){return _0x1e0dab[_0x5853('0xa')](_0x5853('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cdb=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8cdb,0x193));var _0xb8cd=function(_0x41b182,_0x439c61){_0x41b182=_0x41b182-0x0;var _0x2b182e=_0x8cdb[_0x41b182];return _0x2b182e;};'use strict';var _=require(_0xb8cd('0x0'));var util=require(_0xb8cd('0x1'));var logger=require(_0xb8cd('0x2'))(_0xb8cd('0x3'));var moment=require('moment');var BPromise=require(_0xb8cd('0x4'));var rp=require(_0xb8cd('0x5'));var fs=require('fs');var path=require(_0xb8cd('0x6'));var rimraf=require(_0xb8cd('0x7'));var config=require(_0xb8cd('0x8'));var attributes=require(_0xb8cd('0x9'));var integrations=require(_0xb8cd('0xa'));module['exports']=function(_0x39931b,_0x16194f){return _0x39931b[_0xb8cd('0xb')](_0xb8cd('0xc'),attributes,{'tableName':_0xb8cd('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 1fb4377..fdeb21c 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 _0x1e5b=['raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','options','where','limit','include','map','attributes','model','debug','ShowSugarcrmAccount','find'];(function(_0x2c5c3d,_0x136e2c){var _0x1acf55=function(_0x2adfaf){while(--_0x2adfaf){_0x2c5c3d['push'](_0x2c5c3d['shift']());}};_0x1acf55(++_0x136e2c);}(_0x1e5b,0x1bd));var _0xb1e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e5b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb1e5('0x0'));var moment=require(_0xb1e5('0x1'));var BPromise=require(_0xb1e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb1e5('0x3'));var db=require(_0xb1e5('0x4'))['db'];var utils=require(_0xb1e5('0x5'));var logger=require(_0xb1e5('0x6'))(_0xb1e5('0x7'));var config=require(_0xb1e5('0x8'));var jayson=require(_0xb1e5('0x9'));var client=jayson[_0xb1e5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b0357,_0x57822c,_0x12912b){return new BPromise(function(_0x4d906e,_0x4d4d5a){return client[_0xb1e5('0xb')](_0x5b0357,_0x12912b)[_0xb1e5('0xc')](function(_0xbe05c1){logger['info'](_0xb1e5('0xd'),_0x57822c,_0xb1e5('0xe'));logger['debug'](_0xb1e5('0xf'),_0x57822c,_0xb1e5('0xe'),JSON[_0xb1e5('0x10')](_0xbe05c1));if(_0xbe05c1[_0xb1e5('0x11')]){if(_0xbe05c1['error'][_0xb1e5('0x12')]===0x1f4){logger['error'](_0xb1e5('0xd'),_0x57822c,_0xbe05c1[_0xb1e5('0x11')][_0xb1e5('0x13')]);return _0x4d4d5a(_0xbe05c1[_0xb1e5('0x11')]['message']);}logger[_0xb1e5('0x11')](_0xb1e5('0xd'),_0x57822c,_0xbe05c1[_0xb1e5('0x11')][_0xb1e5('0x13')]);return _0x4d906e(_0xbe05c1['error'][_0xb1e5('0x13')]);}else{logger[_0xb1e5('0x14')](_0xb1e5('0xd'),_0x57822c,_0xb1e5('0xe'));_0x4d906e(_0xbe05c1[_0xb1e5('0x15')]['message']);}})[_0xb1e5('0x16')](function(_0x4c788a){logger[_0xb1e5('0x11')](_0xb1e5('0xd'),_0x57822c,_0x4c788a);_0x4d4d5a(_0x4c788a);});});}exports[_0xb1e5('0x17')]=function(_0x399412){var _0x496a19=this;return new Promise(function(_0x15eb04,_0x4e6fa6){return db[_0xb1e5('0x18')][_0xb1e5('0x19')]({'raw':_0x399412[_0xb1e5('0x1a')]?_0x399412[_0xb1e5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x399412['options']?_0x399412['options'][_0xb1e5('0x1b')]||null:null,'attributes':_0x399412[_0xb1e5('0x1a')]?_0x399412[_0xb1e5('0x1a')]['attributes']||null:null,'limit':_0x399412[_0xb1e5('0x1a')]?_0x399412[_0xb1e5('0x1a')][_0xb1e5('0x1c')]||null:null,'include':_0x399412['options']?_0x399412['options'][_0xb1e5('0x1d')]?_[_0xb1e5('0x1e')](_0x399412[_0xb1e5('0x1a')][_0xb1e5('0x1d')],function(_0x558756){return{'model':db[_0x558756['model']],'as':_0x558756['as'],'attributes':_0x558756[_0xb1e5('0x1f')],'include':_0x558756[_0xb1e5('0x1d')]?_[_0xb1e5('0x1e')](_0x558756['include'],function(_0x2e682a){return{'model':db[_0x2e682a[_0xb1e5('0x20')]],'as':_0x2e682a['as'],'attributes':_0x2e682a[_0xb1e5('0x1f')],'include':_0x2e682a[_0xb1e5('0x1d')]?_[_0xb1e5('0x1e')](_0x2e682a['include'],function(_0xfcb2d9){return{'model':db[_0xfcb2d9[_0xb1e5('0x20')]],'as':_0xfcb2d9['as'],'attributes':_0xfcb2d9[_0xb1e5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb1e5('0xc')](function(_0xf0e7f2){logger[_0xb1e5('0x14')](_0xb1e5('0x17'),_0x399412);logger[_0xb1e5('0x21')](_0xb1e5('0x17'),_0x399412,JSON[_0xb1e5('0x10')](_0xf0e7f2));_0x15eb04(_0xf0e7f2);})[_0xb1e5('0x16')](function(_0x2a1ac9){logger[_0xb1e5('0x11')](_0xb1e5('0x17'),_0x2a1ac9[_0xb1e5('0x13')],_0x399412);_0x4e6fa6(_0x496a19[_0xb1e5('0x11')](0x1f4,_0x2a1ac9[_0xb1e5('0x13')]));});});};exports[_0xb1e5('0x22')]=function(_0x3ed07c){var _0x46ef97=this;return new Promise(function(_0x3d168e,_0x5a60b3){return db[_0xb1e5('0x18')][_0xb1e5('0x23')]({'raw':_0x3ed07c[_0xb1e5('0x1a')]?_0x3ed07c['options'][_0xb1e5('0x24')]===undefined?!![]:![]:!![],'where':_0x3ed07c[_0xb1e5('0x1a')]?_0x3ed07c['options'][_0xb1e5('0x1b')]||null:null,'attributes':_0x3ed07c[_0xb1e5('0x1a')]?_0x3ed07c[_0xb1e5('0x1a')][_0xb1e5('0x1f')]||null:null,'include':_0x3ed07c['options']?_0x3ed07c[_0xb1e5('0x1a')][_0xb1e5('0x1d')]?_['map'](_0x3ed07c[_0xb1e5('0x1a')]['include'],function(_0x30d0d4){return{'model':db[_0x30d0d4['model']],'as':_0x30d0d4['as'],'attributes':_0x30d0d4[_0xb1e5('0x1f')],'include':_0x30d0d4[_0xb1e5('0x1d')]?_[_0xb1e5('0x1e')](_0x30d0d4[_0xb1e5('0x1d')],function(_0x146ab8){return{'model':db[_0x146ab8[_0xb1e5('0x20')]],'as':_0x146ab8['as'],'attributes':_0x146ab8[_0xb1e5('0x1f')],'include':_0x146ab8['include']?_[_0xb1e5('0x1e')](_0x146ab8[_0xb1e5('0x1d')],function(_0x2b5f3a){return{'model':db[_0x2b5f3a[_0xb1e5('0x20')]],'as':_0x2b5f3a['as'],'attributes':_0x2b5f3a[_0xb1e5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb1e5('0xc')](function(_0x479c){logger[_0xb1e5('0x14')]('ShowSugarcrmAccount',_0x3ed07c);logger[_0xb1e5('0x21')](_0xb1e5('0x22'),_0x3ed07c,JSON[_0xb1e5('0x10')](_0x479c));_0x3d168e(_0x479c);})[_0xb1e5('0x16')](function(_0x2ff4d3){logger[_0xb1e5('0x11')](_0xb1e5('0x22'),_0x2ff4d3['message'],_0x3ed07c);_0x5a60b3(_0x46ef97[_0xb1e5('0x11')](0x1f4,_0x2ff4d3[_0xb1e5('0x13')]));});});}; \ No newline at end of file +var _0xb1e5=['result','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','stringify','ShowSugarcrmAccount','SugarcrmAccount','find','then','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xb1e5,0xbb));var _0x5b1e=function(_0x352350,_0x149399){_0x352350=_0x352350-0x0;var _0x463e50=_0xb1e5[_0x352350];return _0x463e50;};'use strict';var _=require('lodash');var util=require(_0x5b1e('0x0'));var moment=require(_0x5b1e('0x1'));var BPromise=require(_0x5b1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b1e('0x3'))['db'];var utils=require(_0x5b1e('0x4'));var logger=require(_0x5b1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5b1e('0x6'));var client=jayson[_0x5b1e('0x7')][_0x5b1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x60bd6c,_0x26ce89,_0x4bbe06){return new BPromise(function(_0x5a7916,_0x115aca){return client[_0x5b1e('0x9')](_0x60bd6c,_0x4bbe06)['then'](function(_0x59a159){logger[_0x5b1e('0xa')](_0x5b1e('0xb'),_0x26ce89,_0x5b1e('0xc'));logger[_0x5b1e('0xd')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x26ce89,_0x5b1e('0xc'),JSON['stringify'](_0x59a159));if(_0x59a159[_0x5b1e('0xe')]){if(_0x59a159[_0x5b1e('0xe')][_0x5b1e('0xf')]===0x1f4){logger[_0x5b1e('0xe')](_0x5b1e('0xb'),_0x26ce89,_0x59a159[_0x5b1e('0xe')]['message']);return _0x115aca(_0x59a159['error'][_0x5b1e('0x10')]);}logger[_0x5b1e('0xe')](_0x5b1e('0xb'),_0x26ce89,_0x59a159[_0x5b1e('0xe')][_0x5b1e('0x10')]);return _0x5a7916(_0x59a159['error'][_0x5b1e('0x10')]);}else{logger[_0x5b1e('0xa')](_0x5b1e('0xb'),_0x26ce89,'request\x20sent');_0x5a7916(_0x59a159[_0x5b1e('0x11')]['message']);}})[_0x5b1e('0x12')](function(_0x182e51){logger['error'](_0x5b1e('0xb'),_0x26ce89,_0x182e51);_0x115aca(_0x182e51);});});}exports['GetSugarcrmAccount']=function(_0x29f0ab){var _0x144c17=this;return new Promise(function(_0x42fe8d,_0xc09949){return db['SugarcrmAccount'][_0x5b1e('0x13')]({'raw':_0x29f0ab[_0x5b1e('0x14')]?_0x29f0ab[_0x5b1e('0x14')][_0x5b1e('0x15')]===undefined?!![]:![]:!![],'where':_0x29f0ab[_0x5b1e('0x14')]?_0x29f0ab[_0x5b1e('0x14')][_0x5b1e('0x16')]||null:null,'attributes':_0x29f0ab['options']?_0x29f0ab[_0x5b1e('0x14')][_0x5b1e('0x17')]||null:null,'limit':_0x29f0ab[_0x5b1e('0x14')]?_0x29f0ab[_0x5b1e('0x14')][_0x5b1e('0x18')]||null:null,'include':_0x29f0ab[_0x5b1e('0x14')]?_0x29f0ab[_0x5b1e('0x14')][_0x5b1e('0x19')]?_[_0x5b1e('0x1a')](_0x29f0ab[_0x5b1e('0x14')][_0x5b1e('0x19')],function(_0x39596a){return{'model':db[_0x39596a[_0x5b1e('0x1b')]],'as':_0x39596a['as'],'attributes':_0x39596a[_0x5b1e('0x17')],'include':_0x39596a[_0x5b1e('0x19')]?_[_0x5b1e('0x1a')](_0x39596a[_0x5b1e('0x19')],function(_0x17c5bf){return{'model':db[_0x17c5bf[_0x5b1e('0x1b')]],'as':_0x17c5bf['as'],'attributes':_0x17c5bf['attributes'],'include':_0x17c5bf[_0x5b1e('0x19')]?_[_0x5b1e('0x1a')](_0x17c5bf[_0x5b1e('0x19')],function(_0xd46b9a){return{'model':db[_0xd46b9a[_0x5b1e('0x1b')]],'as':_0xd46b9a['as'],'attributes':_0xd46b9a[_0x5b1e('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24ec0a){logger[_0x5b1e('0xa')](_0x5b1e('0x1c'),_0x29f0ab);logger['debug'](_0x5b1e('0x1c'),_0x29f0ab,JSON[_0x5b1e('0x1d')](_0x24ec0a));_0x42fe8d(_0x24ec0a);})['catch'](function(_0x43e765){logger[_0x5b1e('0xe')](_0x5b1e('0x1c'),_0x43e765['message'],_0x29f0ab);_0xc09949(_0x144c17[_0x5b1e('0xe')](0x1f4,_0x43e765[_0x5b1e('0x10')]));});});};exports[_0x5b1e('0x1e')]=function(_0x42a69e){var _0x5f87c4=this;return new Promise(function(_0x477b72,_0x30d920){return db[_0x5b1e('0x1f')][_0x5b1e('0x20')]({'raw':_0x42a69e[_0x5b1e('0x14')]?_0x42a69e['options'][_0x5b1e('0x15')]===undefined?!![]:![]:!![],'where':_0x42a69e['options']?_0x42a69e[_0x5b1e('0x14')][_0x5b1e('0x16')]||null:null,'attributes':_0x42a69e[_0x5b1e('0x14')]?_0x42a69e['options'][_0x5b1e('0x17')]||null:null,'include':_0x42a69e[_0x5b1e('0x14')]?_0x42a69e[_0x5b1e('0x14')][_0x5b1e('0x19')]?_['map'](_0x42a69e[_0x5b1e('0x14')]['include'],function(_0x12dfcd){return{'model':db[_0x12dfcd[_0x5b1e('0x1b')]],'as':_0x12dfcd['as'],'attributes':_0x12dfcd['attributes'],'include':_0x12dfcd['include']?_[_0x5b1e('0x1a')](_0x12dfcd[_0x5b1e('0x19')],function(_0x55e937){return{'model':db[_0x55e937[_0x5b1e('0x1b')]],'as':_0x55e937['as'],'attributes':_0x55e937['attributes'],'include':_0x55e937[_0x5b1e('0x19')]?_[_0x5b1e('0x1a')](_0x55e937[_0x5b1e('0x19')],function(_0x28d30e){return{'model':db[_0x28d30e['model']],'as':_0x28d30e['as'],'attributes':_0x28d30e['attributes']};}):[]};}):[]};}):[]:[]})[_0x5b1e('0x21')](function(_0x16d57c){logger[_0x5b1e('0xa')](_0x5b1e('0x1e'),_0x42a69e);logger[_0x5b1e('0xd')](_0x5b1e('0x1e'),_0x42a69e,JSON[_0x5b1e('0x1d')](_0x16d57c));_0x477b72(_0x16d57c);})[_0x5b1e('0x12')](function(_0x3877c7){logger[_0x5b1e('0xe')](_0x5b1e('0x1e'),_0x3877c7[_0x5b1e('0x10')],_0x42a69e);_0x30d920(_0x5f87c4['error'](0x1f4,_0x3877c7[_0x5b1e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index bb19dc3..453895f 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 _0xb23b=['/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0xbb8078,_0x3a80e8){var _0x511e5e=function(_0x1b180a){while(--_0x1b180a){_0xbb8078['push'](_0xbb8078['shift']());}};_0x511e5e(++_0x3a80e8);}(_0xb23b,0x181));var _0xbb23=function(_0x4731b0,_0x384141){_0x4731b0=_0x4731b0-0x0;var _0x4a5525=_0xb23b[_0x4731b0];return _0x4a5525;};'use strict';var multer=require(_0xbb23('0x0'));var util=require(_0xbb23('0x1'));var path=require(_0xbb23('0x2'));var timeout=require(_0xbb23('0x3'));var express=require(_0xbb23('0x4'));var router=express[_0xbb23('0x5')]();var fs_extra=require(_0xbb23('0x6'));var auth=require(_0xbb23('0x7'));var interaction=require(_0xbb23('0x8'));var config=require('../../config/environment');var controller=require(_0xbb23('0x9'));router[_0xbb23('0xa')]('/',auth[_0xbb23('0xb')](),controller[_0xbb23('0xc')]);router['get'](_0xbb23('0xd'),auth[_0xbb23('0xb')](),controller[_0xbb23('0xe')]);router[_0xbb23('0xa')](_0xbb23('0xf'),auth[_0xbb23('0xb')](),controller['getFields']);router['get'](_0xbb23('0x10'),auth[_0xbb23('0xb')](),controller[_0xbb23('0x11')]);router[_0xbb23('0xa')](_0xbb23('0x12'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xbb23('0x13')]('/',auth[_0xbb23('0xb')](),controller[_0xbb23('0x14')]);router[_0xbb23('0x15')](_0xbb23('0xd'),auth[_0xbb23('0xb')](),controller['update']);router[_0xbb23('0x16')]('/:id',auth[_0xbb23('0xb')](),controller[_0xbb23('0x17')]);module[_0xbb23('0x18')]=router; \ No newline at end of file +var _0xff17=['/:id/descriptions','getDescriptions','post','put','/:id','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x27a3cb,_0x4af597){var _0x54ff38=function(_0x3a82d2){while(--_0x3a82d2){_0x27a3cb['push'](_0x27a3cb['shift']());}};_0x54ff38(++_0x4af597);}(_0xff17,0x92));var _0x7ff1=function(_0x11108a,_0x24477f){_0x11108a=_0x11108a-0x0;var _0x1f359e=_0xff17[_0x11108a];return _0x1f359e;};'use strict';var multer=require(_0x7ff1('0x0'));var util=require(_0x7ff1('0x1'));var path=require(_0x7ff1('0x2'));var timeout=require('connect-timeout');var express=require(_0x7ff1('0x3'));var router=express['Router']();var fs_extra=require(_0x7ff1('0x4'));var auth=require(_0x7ff1('0x5'));var interaction=require(_0x7ff1('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router[_0x7ff1('0x7')]('/',auth[_0x7ff1('0x8')](),controller[_0x7ff1('0x9')]);router['get']('/:id',auth[_0x7ff1('0x8')](),controller[_0x7ff1('0xa')]);router[_0x7ff1('0x7')](_0x7ff1('0xb'),auth['isAuthenticated'](),controller[_0x7ff1('0xc')]);router[_0x7ff1('0x7')](_0x7ff1('0xd'),auth['isAuthenticated'](),controller[_0x7ff1('0xe')]);router[_0x7ff1('0x7')](_0x7ff1('0xf'),auth[_0x7ff1('0x8')](),controller[_0x7ff1('0x10')]);router[_0x7ff1('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7ff1('0x12')](_0x7ff1('0x13'),auth[_0x7ff1('0x8')](),controller['update']);router[_0x7ff1('0x14')](_0x7ff1('0x13'),auth[_0x7ff1('0x8')](),controller[_0x7ff1('0x15')]);module[_0x7ff1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 480ecee..defae57 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 _0xa9f4=['sequelize','exports','STRING'];(function(_0x20a20b,_0x215379){var _0x4bcf18=function(_0x2eecc3){while(--_0x2eecc3){_0x20a20b['push'](_0x20a20b['shift']());}};_0x4bcf18(++_0x215379);}(_0xa9f4,0xf6));var _0x4a9f=function(_0x2d46bb,_0x4f801f){_0x2d46bb=_0x2d46bb-0x0;var _0x4fbeb9=_0xa9f4[_0x2d46bb];return _0x4fbeb9;};'use strict';var Sequelize=require(_0x4a9f('0x0'));module[_0x4a9f('0x1')]={'name':{'type':Sequelize[_0x4a9f('0x2')]},'description':{'type':Sequelize[_0x4a9f('0x2')]}}; \ No newline at end of file +var _0x4117=['sequelize','STRING'];(function(_0x4e37bc,_0x8174e7){var _0x48a8b7=function(_0x458409){while(--_0x458409){_0x4e37bc['push'](_0x4e37bc['shift']());}};_0x48a8b7(++_0x8174e7);}(_0x4117,0xc6));var _0x7411=function(_0x159473,_0x57fa14){_0x159473=_0x159473-0x0;var _0x402788=_0x4117[_0x159473];return _0x402788;};'use strict';var Sequelize=require(_0x7411('0x0'));module['exports']={'name':{'type':Sequelize[_0x7411('0x1')]},'description':{'type':Sequelize[_0x7411('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index b9db617..e0dd620 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 _0x2e96=['undefined','count','offset','limit','status','set','Content-Range','apply','reject','update','destroy','end','error','stack','name','send','map','rawAttributes','type','model','keys','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','then','includeAll','findAll','catch','show','fields','length','include','find','create','body','getFields','findOne','params','SugarcrmField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json'];(function(_0x49c1fc,_0x32948f){var _0x1f5f58=function(_0x48e8c4){while(--_0x48e8c4){_0x49c1fc['push'](_0x49c1fc['shift']());}};_0x1f5f58(++_0x32948f);}(_0x2e96,0xd5));var _0x62e9=function(_0x40e21e,_0x30181e){_0x40e21e=_0x40e21e-0x0;var _0x56c454=_0x2e96[_0x40e21e];return _0x56c454;};'use strict';var emlformat=require(_0x62e9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x62e9('0x1'));var jsonpatch=require(_0x62e9('0x2'));var rp=require('request-promise');var moment=require(_0x62e9('0x3'));var BPromise=require(_0x62e9('0x4'));var Mustache=require('mustache');var util=require(_0x62e9('0x5'));var path=require(_0x62e9('0x6'));var sox=require(_0x62e9('0x7'));var csv=require('to-csv');var ejs=require(_0x62e9('0x8'));var fs=require('fs');var fs_extra=require(_0x62e9('0x9'));var _=require(_0x62e9('0xa'));var squel=require(_0x62e9('0xb'));var crypto=require(_0x62e9('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x62e9('0xd'));var querystring=require(_0x62e9('0xe'));var Papa=require(_0x62e9('0xf'));var Redis=require(_0x62e9('0x10'));var authService=require(_0x62e9('0x11'));var qs=require(_0x62e9('0x12'));var as=require(_0x62e9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62e9('0x14'))(_0x62e9('0x15'));var utils=require(_0x62e9('0x16'));var config=require(_0x62e9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x62e9('0x18'))['db'];function respondWithStatusCode(_0x31a5b7,_0x43279b){_0x43279b=_0x43279b||0xcc;return function(_0x37dc3c){if(_0x37dc3c){return _0x31a5b7[_0x62e9('0x19')](_0x43279b);}return _0x31a5b7['status'](_0x43279b)['end']();};}function respondWithResult(_0x3d988f,_0x3669ea){_0x3669ea=_0x3669ea||0xc8;return function(_0x27deb9){if(_0x27deb9){return _0x3d988f['status'](_0x3669ea)[_0x62e9('0x1a')](_0x27deb9);}};}function respondWithFilteredResult(_0xa5b304,_0x5edc39){return function(_0xa888b4){if(_0xa888b4){var _0x2f1972=typeof _0x5edc39['offset']===_0x62e9('0x1b')&&typeof _0x5edc39['limit']===_0x62e9('0x1b');var _0x240d89=_0xa888b4[_0x62e9('0x1c')];var _0x1ecadb=_0x2f1972?0x0:_0x5edc39['offset'];var _0x2027d7=_0x2f1972?_0xa888b4[_0x62e9('0x1c')]:_0x5edc39[_0x62e9('0x1d')]+_0x5edc39[_0x62e9('0x1e')];var _0x3ce144;if(_0x2027d7>=_0x240d89){_0x2027d7=_0x240d89;_0x3ce144=0xc8;}else{_0x3ce144=0xce;}_0xa5b304[_0x62e9('0x1f')](_0x3ce144);return _0xa5b304[_0x62e9('0x20')](_0x62e9('0x21'),_0x1ecadb+'-'+_0x2027d7+'/'+_0x240d89)[_0x62e9('0x1a')](_0xa888b4);}return null;};}function patchUpdates(_0x1fea8b){return function(_0x3af4f9){try{jsonpatch[_0x62e9('0x22')](_0x3af4f9,_0x1fea8b,!![]);}catch(_0x37caa4){return BPromise[_0x62e9('0x23')](_0x37caa4);}return _0x3af4f9['save']();};}function saveUpdates(_0x4a63b0,_0x41ff4f){return function(_0x53abac){if(_0x53abac){return _0x53abac[_0x62e9('0x24')](_0x4a63b0)['then'](function(_0x533aec){return _0x533aec;});}return null;};}function removeEntity(_0x462d89,_0x454315){return function(_0xd7c5a8){if(_0xd7c5a8){return _0xd7c5a8[_0x62e9('0x25')]()['then'](function(){_0x462d89['status'](0xcc)[_0x62e9('0x26')]();});}};}function handleEntityNotFound(_0x9ef552,_0x39b99d){return function(_0x240f60){if(!_0x240f60){_0x9ef552['sendStatus'](0x194);}return _0x240f60;};}function handleError(_0x444309,_0x328319){_0x328319=_0x328319||0x1f4;return function(_0x36263e){logger[_0x62e9('0x27')](_0x36263e[_0x62e9('0x28')]);if(_0x36263e[_0x62e9('0x29')]){delete _0x36263e[_0x62e9('0x29')];}_0x444309['status'](_0x328319)[_0x62e9('0x2a')](_0x36263e);};}exports['index']=function(_0x48deea,_0x6b77c8){var _0x340562={},_0x3638ed={},_0xf42843={'count':0x0,'rows':[]};var _0x4e35a1=_[_0x62e9('0x2b')](db['SugarcrmConfiguration'][_0x62e9('0x2c')],function(_0x6e302c){return{'name':_0x6e302c['fieldName'],'type':_0x6e302c[_0x62e9('0x2d')]['key']};});_0x3638ed[_0x62e9('0x2e')]=_[_0x62e9('0x2b')](_0x4e35a1,_0x62e9('0x29'));_0x3638ed['query']=_[_0x62e9('0x2f')](_0x48deea[_0x62e9('0x30')]);_0x3638ed[_0x62e9('0x31')]=_['intersection'](_0x3638ed[_0x62e9('0x2e')],_0x3638ed[_0x62e9('0x30')]);_0x340562['attributes']=_[_0x62e9('0x32')](_0x3638ed[_0x62e9('0x2e')],qs['fields'](_0x48deea[_0x62e9('0x30')]['fields']));_0x340562[_0x62e9('0x33')]=_0x340562['attributes']['length']?_0x340562[_0x62e9('0x33')]:_0x3638ed['model'];if(!_0x48deea[_0x62e9('0x30')][_0x62e9('0x34')](_0x62e9('0x35'))){_0x340562[_0x62e9('0x1e')]=qs[_0x62e9('0x1e')](_0x48deea['query'][_0x62e9('0x1e')]);_0x340562[_0x62e9('0x1d')]=qs['offset'](_0x48deea[_0x62e9('0x30')][_0x62e9('0x1d')]);}_0x340562[_0x62e9('0x36')]=qs[_0x62e9('0x37')](_0x48deea[_0x62e9('0x30')][_0x62e9('0x37')]);_0x340562['where']=qs[_0x62e9('0x31')](_[_0x62e9('0x38')](_0x48deea['query'],_0x3638ed[_0x62e9('0x31')]),_0x4e35a1);if(_0x48deea[_0x62e9('0x30')][_0x62e9('0x39')]){_0x340562[_0x62e9('0x3a')]=_[_0x62e9('0x3b')](_0x340562['where'],{'$or':_[_0x62e9('0x2b')](_0x4e35a1,function(_0x30da2c){if(_0x30da2c['type']!==_0x62e9('0x3c')){var _0x5a6926={};_0x5a6926[_0x30da2c[_0x62e9('0x29')]]={'$like':'%'+_0x48deea[_0x62e9('0x30')]['filter']+'%'};return _0x5a6926;}})});}_0x340562=_[_0x62e9('0x3b')]({},_0x340562,_0x48deea[_0x62e9('0x3d')]);var _0x42257b={'where':_0x340562[_0x62e9('0x3a')]};return db[_0x62e9('0x3e')]['count'](_0x42257b)[_0x62e9('0x3f')](function(_0x234f62){_0xf42843['count']=_0x234f62;if(_0x48deea[_0x62e9('0x30')][_0x62e9('0x40')]){_0x340562['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0x62e9('0x41')](_0x340562);})[_0x62e9('0x3f')](function(_0x3f0dd0){_0xf42843['rows']=_0x3f0dd0;return _0xf42843;})[_0x62e9('0x3f')](respondWithFilteredResult(_0x6b77c8,_0x340562))[_0x62e9('0x42')](handleError(_0x6b77c8,null));};exports[_0x62e9('0x43')]=function(_0x5f3738,_0x10d9a5){var _0x5f24c1={'raw':![],'where':{'id':_0x5f3738['params']['id']}},_0x1bfcd0={};_0x1bfcd0[_0x62e9('0x2e')]=_['keys'](db[_0x62e9('0x3e')][_0x62e9('0x2c')]);_0x1bfcd0['query']=_[_0x62e9('0x2f')](_0x5f3738[_0x62e9('0x30')]);_0x1bfcd0[_0x62e9('0x31')]=_[_0x62e9('0x32')](_0x1bfcd0[_0x62e9('0x2e')],_0x1bfcd0['query']);_0x5f24c1[_0x62e9('0x33')]=_[_0x62e9('0x32')](_0x1bfcd0['model'],qs['fields'](_0x5f3738[_0x62e9('0x30')][_0x62e9('0x44')]));_0x5f24c1[_0x62e9('0x33')]=_0x5f24c1[_0x62e9('0x33')][_0x62e9('0x45')]?_0x5f24c1[_0x62e9('0x33')]:_0x1bfcd0['model'];if(_0x5f3738[_0x62e9('0x30')]['includeAll']){_0x5f24c1[_0x62e9('0x46')]=[{'all':!![]}];}_0x5f24c1=_['merge']({},_0x5f24c1,_0x5f3738[_0x62e9('0x3d')]);return db[_0x62e9('0x3e')][_0x62e9('0x47')](_0x5f24c1)[_0x62e9('0x3f')](handleEntityNotFound(_0x10d9a5,null))[_0x62e9('0x3f')](respondWithResult(_0x10d9a5,null))[_0x62e9('0x42')](handleError(_0x10d9a5,null));};exports[_0x62e9('0x48')]=function(_0x1ffbf6,_0x8f753b){return db[_0x62e9('0x3e')]['create'](_0x1ffbf6['body'],{})[_0x62e9('0x3f')](respondWithResult(_0x8f753b,0xc9))[_0x62e9('0x42')](handleError(_0x8f753b,null));};exports[_0x62e9('0x24')]=function(_0x569175,_0x3b6c19){if(_0x569175[_0x62e9('0x49')]['id']){delete _0x569175['body']['id'];}return db[_0x62e9('0x3e')][_0x62e9('0x47')]({'where':{'id':_0x569175['params']['id']}})[_0x62e9('0x3f')](handleEntityNotFound(_0x3b6c19,null))[_0x62e9('0x3f')](saveUpdates(_0x569175[_0x62e9('0x49')],null))['then'](respondWithResult(_0x3b6c19,null))[_0x62e9('0x42')](handleError(_0x3b6c19,null));};exports[_0x62e9('0x25')]=function(_0x144e94,_0x22bfcc){return db[_0x62e9('0x3e')][_0x62e9('0x47')]({'where':{'id':_0x144e94['params']['id']}})[_0x62e9('0x3f')](handleEntityNotFound(_0x22bfcc,null))[_0x62e9('0x3f')](removeEntity(_0x22bfcc,null))[_0x62e9('0x42')](handleError(_0x22bfcc,null));};exports[_0x62e9('0x4a')]=function(_0x6d2df9,_0x3e9815,_0xf5af91){var _0x3c2cc5={};var _0x5ab16c={};var _0x205529;var _0x46dfc3;return db[_0x62e9('0x3e')][_0x62e9('0x4b')]({'where':{'id':_0x6d2df9[_0x62e9('0x4c')]['id']}})[_0x62e9('0x3f')](handleEntityNotFound(_0x3e9815,null))[_0x62e9('0x3f')](function(_0x19b0db){if(_0x19b0db){_0x205529=_0x19b0db;_0x5ab16c[_0x62e9('0x2e')]=_['keys'](db[_0x62e9('0x4d')][_0x62e9('0x2c')]);_0x5ab16c['query']=_[_0x62e9('0x2f')](_0x6d2df9[_0x62e9('0x30')]);_0x5ab16c[_0x62e9('0x31')]=_[_0x62e9('0x32')](_0x5ab16c[_0x62e9('0x2e')],_0x5ab16c[_0x62e9('0x30')]);_0x3c2cc5[_0x62e9('0x33')]=_['intersection'](_0x5ab16c[_0x62e9('0x2e')],qs[_0x62e9('0x44')](_0x6d2df9[_0x62e9('0x30')][_0x62e9('0x44')]));_0x3c2cc5[_0x62e9('0x33')]=_0x3c2cc5[_0x62e9('0x33')][_0x62e9('0x45')]?_0x3c2cc5['attributes']:_0x5ab16c[_0x62e9('0x2e')];_0x3c2cc5[_0x62e9('0x36')]=qs[_0x62e9('0x37')](_0x6d2df9['query'][_0x62e9('0x37')]);_0x3c2cc5['where']=qs[_0x62e9('0x31')](_['pick'](_0x6d2df9[_0x62e9('0x30')],_0x5ab16c['filters']));if(_0x6d2df9[_0x62e9('0x30')][_0x62e9('0x39')]){_0x3c2cc5[_0x62e9('0x3a')]=_[_0x62e9('0x3b')](_0x3c2cc5['where'],{'$or':_['map'](_0x3c2cc5[_0x62e9('0x33')],function(_0x57212d){var _0x937265={};_0x937265[_0x57212d]={'$like':'%'+_0x6d2df9[_0x62e9('0x30')][_0x62e9('0x39')]+'%'};return _0x937265;})});}_0x3c2cc5=_['merge']({},_0x3c2cc5,_0x6d2df9[_0x62e9('0x3d')]);return _0x205529[_0x62e9('0x4a')](_0x3c2cc5);}})['then'](function(_0x46b992){if(_0x46b992){_0x46dfc3=_0x46b992[_0x62e9('0x45')];if(!_0x6d2df9['query'][_0x62e9('0x34')]('nolimit')){_0x3c2cc5[_0x62e9('0x1e')]=qs[_0x62e9('0x1e')](_0x6d2df9['query']['limit']);_0x3c2cc5[_0x62e9('0x1d')]=qs[_0x62e9('0x1d')](_0x6d2df9[_0x62e9('0x30')][_0x62e9('0x1d')]);}return _0x205529['getFields'](_0x3c2cc5);}})['then'](function(_0x6b4700){if(_0x6b4700){return _0x6b4700?{'count':_0x46dfc3,'rows':_0x6b4700}:null;}})[_0x62e9('0x3f')](respondWithResult(_0x3e9815,null))['catch'](handleError(_0x3e9815,null));};exports[_0x62e9('0x4e')]=function(_0x3db006,_0x943a81,_0xa5f7cf){var _0x33cb77={};var _0x2e7976={};var _0x37d54e;var _0x9724ed;return db[_0x62e9('0x3e')][_0x62e9('0x4b')]({'where':{'id':_0x3db006['params']['id']}})[_0x62e9('0x3f')](handleEntityNotFound(_0x943a81,null))[_0x62e9('0x3f')](function(_0x459139){if(_0x459139){_0x37d54e=_0x459139;_0x2e7976['model']=_[_0x62e9('0x2f')](db[_0x62e9('0x4d')][_0x62e9('0x2c')]);_0x2e7976[_0x62e9('0x30')]=_[_0x62e9('0x2f')](_0x3db006[_0x62e9('0x30')]);_0x2e7976[_0x62e9('0x31')]=_['intersection'](_0x2e7976['model'],_0x2e7976[_0x62e9('0x30')]);_0x33cb77[_0x62e9('0x33')]=_[_0x62e9('0x32')](_0x2e7976[_0x62e9('0x2e')],qs['fields'](_0x3db006[_0x62e9('0x30')]['fields']));_0x33cb77['attributes']=_0x33cb77[_0x62e9('0x33')][_0x62e9('0x45')]?_0x33cb77[_0x62e9('0x33')]:_0x2e7976[_0x62e9('0x2e')];_0x33cb77['order']=qs[_0x62e9('0x37')](_0x3db006[_0x62e9('0x30')][_0x62e9('0x37')]);_0x33cb77['where']=qs[_0x62e9('0x31')](_[_0x62e9('0x38')](_0x3db006['query'],_0x2e7976['filters']));if(_0x3db006[_0x62e9('0x30')][_0x62e9('0x39')]){_0x33cb77['where']=_[_0x62e9('0x3b')](_0x33cb77['where'],{'$or':_[_0x62e9('0x2b')](_0x33cb77['attributes'],function(_0x36ef84){var _0xd6f59a={};_0xd6f59a[_0x36ef84]={'$like':'%'+_0x3db006[_0x62e9('0x30')]['filter']+'%'};return _0xd6f59a;})});}_0x33cb77=_[_0x62e9('0x3b')]({},_0x33cb77,_0x3db006['options']);return _0x37d54e[_0x62e9('0x4e')](_0x33cb77);}})['then'](function(_0x422ef1){if(_0x422ef1){_0x9724ed=_0x422ef1[_0x62e9('0x45')];if(!_0x3db006[_0x62e9('0x30')]['hasOwnProperty'](_0x62e9('0x35'))){_0x33cb77[_0x62e9('0x1e')]=qs['limit'](_0x3db006[_0x62e9('0x30')][_0x62e9('0x1e')]);_0x33cb77[_0x62e9('0x1d')]=qs[_0x62e9('0x1d')](_0x3db006[_0x62e9('0x30')]['offset']);}return _0x37d54e[_0x62e9('0x4e')](_0x33cb77);}})[_0x62e9('0x3f')](function(_0x12e01b){if(_0x12e01b){return _0x12e01b?{'count':_0x9724ed,'rows':_0x12e01b}:null;}})[_0x62e9('0x3f')](respondWithResult(_0x943a81,null))[_0x62e9('0x42')](handleError(_0x943a81,null));};exports[_0x62e9('0x4f')]=function(_0x344987,_0x7fa38e,_0x1b1766){var _0x32373e={};var _0x575901={};var _0x12471e;var _0x2e5c2c;return db[_0x62e9('0x3e')][_0x62e9('0x4b')]({'where':{'id':_0x344987[_0x62e9('0x4c')]['id']}})['then'](handleEntityNotFound(_0x7fa38e,null))[_0x62e9('0x3f')](function(_0xf621a){if(_0xf621a){_0x12471e=_0xf621a;_0x575901[_0x62e9('0x2e')]=_[_0x62e9('0x2f')](db[_0x62e9('0x4d')][_0x62e9('0x2c')]);_0x575901[_0x62e9('0x30')]=_[_0x62e9('0x2f')](_0x344987['query']);_0x575901['filters']=_[_0x62e9('0x32')](_0x575901[_0x62e9('0x2e')],_0x575901['query']);_0x32373e['attributes']=_[_0x62e9('0x32')](_0x575901[_0x62e9('0x2e')],qs['fields'](_0x344987[_0x62e9('0x30')][_0x62e9('0x44')]));_0x32373e[_0x62e9('0x33')]=_0x32373e[_0x62e9('0x33')]['length']?_0x32373e[_0x62e9('0x33')]:_0x575901['model'];_0x32373e['order']=qs[_0x62e9('0x37')](_0x344987['query'][_0x62e9('0x37')]);_0x32373e[_0x62e9('0x3a')]=qs[_0x62e9('0x31')](_['pick'](_0x344987['query'],_0x575901[_0x62e9('0x31')]));if(_0x344987['query']['filter']){_0x32373e['where']=_[_0x62e9('0x3b')](_0x32373e[_0x62e9('0x3a')],{'$or':_[_0x62e9('0x2b')](_0x32373e[_0x62e9('0x33')],function(_0x27f17f){var _0x36f75a={};_0x36f75a[_0x27f17f]={'$like':'%'+_0x344987[_0x62e9('0x30')]['filter']+'%'};return _0x36f75a;})});}_0x32373e=_['merge']({},_0x32373e,_0x344987[_0x62e9('0x3d')]);return _0x12471e['getDescriptions'](_0x32373e);}})[_0x62e9('0x3f')](function(_0x239914){if(_0x239914){_0x2e5c2c=_0x239914[_0x62e9('0x45')];if(!_0x344987['query'][_0x62e9('0x34')](_0x62e9('0x35'))){_0x32373e[_0x62e9('0x1e')]=qs[_0x62e9('0x1e')](_0x344987[_0x62e9('0x30')][_0x62e9('0x1e')]);_0x32373e[_0x62e9('0x1d')]=qs[_0x62e9('0x1d')](_0x344987[_0x62e9('0x30')][_0x62e9('0x1d')]);}return _0x12471e[_0x62e9('0x4f')](_0x32373e);}})[_0x62e9('0x3f')](function(_0x48d38d){if(_0x48d38d){return _0x48d38d?{'count':_0x2e5c2c,'rows':_0x48d38d}:null;}})[_0x62e9('0x3f')](respondWithResult(_0x7fa38e,null))[_0x62e9('0x42')](handleError(_0x7fa38e,null));}; \ No newline at end of file +var _0xc3f0=['where','filters','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','findOne','getFields','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','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/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort'];(function(_0x3c17f1,_0x5bd639){var _0x5ec099=function(_0x39694a){while(--_0x39694a){_0x3c17f1['push'](_0x3c17f1['shift']());}};_0x5ec099(++_0x5bd639);}(_0xc3f0,0x170));var _0x0c3f=function(_0x34daaf,_0x11df92){_0x34daaf=_0x34daaf-0x0;var _0x3d49d1=_0xc3f0[_0x34daaf];return _0x3d49d1;};'use strict';var emlformat=require(_0x0c3f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c3f('0x1'));var jsonpatch=require(_0x0c3f('0x2'));var rp=require(_0x0c3f('0x3'));var moment=require(_0x0c3f('0x4'));var BPromise=require(_0x0c3f('0x5'));var Mustache=require(_0x0c3f('0x6'));var util=require(_0x0c3f('0x7'));var path=require(_0x0c3f('0x8'));var sox=require(_0x0c3f('0x9'));var csv=require(_0x0c3f('0xa'));var ejs=require(_0x0c3f('0xb'));var fs=require('fs');var fs_extra=require(_0x0c3f('0xc'));var _=require(_0x0c3f('0xd'));var squel=require(_0x0c3f('0xe'));var crypto=require(_0x0c3f('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0c3f('0x10'));var toCsv=require(_0x0c3f('0xa'));var querystring=require('querystring');var Papa=require(_0x0c3f('0x11'));var Redis=require(_0x0c3f('0x12'));var authService=require(_0x0c3f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0c3f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c3f('0x15'))(_0x0c3f('0x16'));var utils=require('../../config/utils');var config=require(_0x0c3f('0x17'));var licenseUtil=require(_0x0c3f('0x18'));var db=require(_0x0c3f('0x19'))['db'];function respondWithStatusCode(_0x2b4f5b,_0x39bbff){_0x39bbff=_0x39bbff||0xcc;return function(_0x228890){if(_0x228890){return _0x2b4f5b[_0x0c3f('0x1a')](_0x39bbff);}return _0x2b4f5b[_0x0c3f('0x1b')](_0x39bbff)[_0x0c3f('0x1c')]();};}function respondWithResult(_0x49ef0b,_0x554635){_0x554635=_0x554635||0xc8;return function(_0x8bb5f8){if(_0x8bb5f8){return _0x49ef0b[_0x0c3f('0x1b')](_0x554635)[_0x0c3f('0x1d')](_0x8bb5f8);}};}function respondWithFilteredResult(_0x19072f,_0x10aad8){return function(_0xecb8c8){if(_0xecb8c8){var _0x5842dc=typeof _0x10aad8[_0x0c3f('0x1e')]===_0x0c3f('0x1f')&&typeof _0x10aad8[_0x0c3f('0x20')]===_0x0c3f('0x1f');var _0x527612=_0xecb8c8['count'];var _0xd3c160=_0x5842dc?0x0:_0x10aad8[_0x0c3f('0x1e')];var _0x32f262=_0x5842dc?_0xecb8c8['count']:_0x10aad8['offset']+_0x10aad8['limit'];var _0xe204ed;if(_0x32f262>=_0x527612){_0x32f262=_0x527612;_0xe204ed=0xc8;}else{_0xe204ed=0xce;}_0x19072f[_0x0c3f('0x1b')](_0xe204ed);return _0x19072f[_0x0c3f('0x21')](_0x0c3f('0x22'),_0xd3c160+'-'+_0x32f262+'/'+_0x527612)['json'](_0xecb8c8);}return null;};}function patchUpdates(_0x407601){return function(_0x38a703){try{jsonpatch[_0x0c3f('0x23')](_0x38a703,_0x407601,!![]);}catch(_0xf643ec){return BPromise[_0x0c3f('0x24')](_0xf643ec);}return _0x38a703[_0x0c3f('0x25')]();};}function saveUpdates(_0x22aa9d,_0x3a93a2){return function(_0x12e785){if(_0x12e785){return _0x12e785[_0x0c3f('0x26')](_0x22aa9d)[_0x0c3f('0x27')](function(_0x387984){return _0x387984;});}return null;};}function removeEntity(_0x11ff10,_0x5c1a90){return function(_0x4bb93b){if(_0x4bb93b){return _0x4bb93b[_0x0c3f('0x28')]()[_0x0c3f('0x27')](function(){_0x11ff10[_0x0c3f('0x1b')](0xcc)[_0x0c3f('0x1c')]();});}};}function handleEntityNotFound(_0x33fb44,_0x47e9fc){return function(_0x443728){if(!_0x443728){_0x33fb44[_0x0c3f('0x1a')](0x194);}return _0x443728;};}function handleError(_0xff4b23,_0x482576){_0x482576=_0x482576||0x1f4;return function(_0x28b6f3){logger[_0x0c3f('0x29')](_0x28b6f3[_0x0c3f('0x2a')]);if(_0x28b6f3['name']){delete _0x28b6f3[_0x0c3f('0x2b')];}_0xff4b23[_0x0c3f('0x1b')](_0x482576)[_0x0c3f('0x2c')](_0x28b6f3);};}exports[_0x0c3f('0x2d')]=function(_0x57edb7,_0x60f17e){var _0xfcb22={},_0x37e4e3={},_0x5c1b1e={'count':0x0,'rows':[]};var _0x39d3bb=_[_0x0c3f('0x2e')](db[_0x0c3f('0x2f')][_0x0c3f('0x30')],function(_0x103edb){return{'name':_0x103edb[_0x0c3f('0x31')],'type':_0x103edb[_0x0c3f('0x32')][_0x0c3f('0x33')]};});_0x37e4e3['model']=_[_0x0c3f('0x2e')](_0x39d3bb,_0x0c3f('0x2b'));_0x37e4e3[_0x0c3f('0x34')]=_[_0x0c3f('0x35')](_0x57edb7['query']);_0x37e4e3['filters']=_['intersection'](_0x37e4e3['model'],_0x37e4e3[_0x0c3f('0x34')]);_0xfcb22['attributes']=_[_0x0c3f('0x36')](_0x37e4e3[_0x0c3f('0x37')],qs[_0x0c3f('0x38')](_0x57edb7['query'][_0x0c3f('0x38')]));_0xfcb22['attributes']=_0xfcb22[_0x0c3f('0x39')][_0x0c3f('0x3a')]?_0xfcb22[_0x0c3f('0x39')]:_0x37e4e3[_0x0c3f('0x37')];if(!_0x57edb7[_0x0c3f('0x34')]['hasOwnProperty'](_0x0c3f('0x3b'))){_0xfcb22[_0x0c3f('0x20')]=qs[_0x0c3f('0x20')](_0x57edb7['query'][_0x0c3f('0x20')]);_0xfcb22[_0x0c3f('0x1e')]=qs[_0x0c3f('0x1e')](_0x57edb7[_0x0c3f('0x34')][_0x0c3f('0x1e')]);}_0xfcb22[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x57edb7[_0x0c3f('0x34')][_0x0c3f('0x3d')]);_0xfcb22[_0x0c3f('0x3e')]=qs[_0x0c3f('0x3f')](_[_0x0c3f('0x40')](_0x57edb7[_0x0c3f('0x34')],_0x37e4e3['filters']),_0x39d3bb);if(_0x57edb7[_0x0c3f('0x34')][_0x0c3f('0x41')]){_0xfcb22[_0x0c3f('0x3e')]=_['merge'](_0xfcb22['where'],{'$or':_[_0x0c3f('0x2e')](_0x39d3bb,function(_0x498671){if(_0x498671[_0x0c3f('0x32')]!==_0x0c3f('0x42')){var _0x44ff9e={};_0x44ff9e[_0x498671[_0x0c3f('0x2b')]]={'$like':'%'+_0x57edb7[_0x0c3f('0x34')][_0x0c3f('0x41')]+'%'};return _0x44ff9e;}})});}_0xfcb22=_[_0x0c3f('0x43')]({},_0xfcb22,_0x57edb7[_0x0c3f('0x44')]);var _0x1f7cc2={'where':_0xfcb22[_0x0c3f('0x3e')]};return db['SugarcrmConfiguration'][_0x0c3f('0x45')](_0x1f7cc2)[_0x0c3f('0x27')](function(_0x20d2bf){_0x5c1b1e['count']=_0x20d2bf;if(_0x57edb7['query']['includeAll']){_0xfcb22[_0x0c3f('0x46')]=[{'all':!![]}];}return db[_0x0c3f('0x2f')][_0x0c3f('0x47')](_0xfcb22);})['then'](function(_0x1fc343){_0x5c1b1e[_0x0c3f('0x48')]=_0x1fc343;return _0x5c1b1e;})[_0x0c3f('0x27')](respondWithFilteredResult(_0x60f17e,_0xfcb22))[_0x0c3f('0x49')](handleError(_0x60f17e,null));};exports[_0x0c3f('0x4a')]=function(_0x4f8fe0,_0x24df71){var _0x27cc1c={'raw':![],'where':{'id':_0x4f8fe0[_0x0c3f('0x4b')]['id']}},_0x378e54={};_0x378e54['model']=_[_0x0c3f('0x35')](db[_0x0c3f('0x2f')]['rawAttributes']);_0x378e54[_0x0c3f('0x34')]=_['keys'](_0x4f8fe0['query']);_0x378e54[_0x0c3f('0x3f')]=_[_0x0c3f('0x36')](_0x378e54[_0x0c3f('0x37')],_0x378e54['query']);_0x27cc1c[_0x0c3f('0x39')]=_[_0x0c3f('0x36')](_0x378e54[_0x0c3f('0x37')],qs['fields'](_0x4f8fe0[_0x0c3f('0x34')]['fields']));_0x27cc1c[_0x0c3f('0x39')]=_0x27cc1c[_0x0c3f('0x39')][_0x0c3f('0x3a')]?_0x27cc1c[_0x0c3f('0x39')]:_0x378e54['model'];if(_0x4f8fe0[_0x0c3f('0x34')][_0x0c3f('0x4c')]){_0x27cc1c[_0x0c3f('0x46')]=[{'all':!![]}];}_0x27cc1c=_[_0x0c3f('0x43')]({},_0x27cc1c,_0x4f8fe0['options']);return db[_0x0c3f('0x2f')][_0x0c3f('0x4d')](_0x27cc1c)[_0x0c3f('0x27')](handleEntityNotFound(_0x24df71,null))['then'](respondWithResult(_0x24df71,null))['catch'](handleError(_0x24df71,null));};exports[_0x0c3f('0x4e')]=function(_0x2eba77,_0x4814a6){return db[_0x0c3f('0x2f')][_0x0c3f('0x4e')](_0x2eba77[_0x0c3f('0x4f')],{})['then'](respondWithResult(_0x4814a6,0xc9))[_0x0c3f('0x49')](handleError(_0x4814a6,null));};exports[_0x0c3f('0x26')]=function(_0x1d0b51,_0x28f1ff){if(_0x1d0b51['body']['id']){delete _0x1d0b51[_0x0c3f('0x4f')]['id'];}return db['SugarcrmConfiguration']['find']({'where':{'id':_0x1d0b51[_0x0c3f('0x4b')]['id']}})[_0x0c3f('0x27')](handleEntityNotFound(_0x28f1ff,null))[_0x0c3f('0x27')](saveUpdates(_0x1d0b51[_0x0c3f('0x4f')],null))[_0x0c3f('0x27')](respondWithResult(_0x28f1ff,null))[_0x0c3f('0x49')](handleError(_0x28f1ff,null));};exports[_0x0c3f('0x28')]=function(_0x3d3348,_0x1ac507){return db[_0x0c3f('0x2f')][_0x0c3f('0x4d')]({'where':{'id':_0x3d3348[_0x0c3f('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1ac507,null))[_0x0c3f('0x27')](removeEntity(_0x1ac507,null))['catch'](handleError(_0x1ac507,null));};exports['getFields']=function(_0xd9a6d6,_0x29668e,_0x174a34){var _0x3f019d={};var _0x166a64={};var _0x44e2d7;var _0x88772a;return db[_0x0c3f('0x2f')][_0x0c3f('0x50')]({'where':{'id':_0xd9a6d6[_0x0c3f('0x4b')]['id']}})[_0x0c3f('0x27')](handleEntityNotFound(_0x29668e,null))[_0x0c3f('0x27')](function(_0x31b443){if(_0x31b443){_0x44e2d7=_0x31b443;_0x166a64[_0x0c3f('0x37')]=_[_0x0c3f('0x35')](db['SugarcrmField'][_0x0c3f('0x30')]);_0x166a64[_0x0c3f('0x34')]=_[_0x0c3f('0x35')](_0xd9a6d6[_0x0c3f('0x34')]);_0x166a64['filters']=_['intersection'](_0x166a64[_0x0c3f('0x37')],_0x166a64['query']);_0x3f019d[_0x0c3f('0x39')]=_[_0x0c3f('0x36')](_0x166a64[_0x0c3f('0x37')],qs[_0x0c3f('0x38')](_0xd9a6d6[_0x0c3f('0x34')]['fields']));_0x3f019d['attributes']=_0x3f019d[_0x0c3f('0x39')][_0x0c3f('0x3a')]?_0x3f019d[_0x0c3f('0x39')]:_0x166a64[_0x0c3f('0x37')];_0x3f019d[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0xd9a6d6[_0x0c3f('0x34')][_0x0c3f('0x3d')]);_0x3f019d[_0x0c3f('0x3e')]=qs[_0x0c3f('0x3f')](_[_0x0c3f('0x40')](_0xd9a6d6[_0x0c3f('0x34')],_0x166a64[_0x0c3f('0x3f')]));if(_0xd9a6d6[_0x0c3f('0x34')]['filter']){_0x3f019d[_0x0c3f('0x3e')]=_['merge'](_0x3f019d[_0x0c3f('0x3e')],{'$or':_[_0x0c3f('0x2e')](_0x3f019d[_0x0c3f('0x39')],function(_0x186884){var _0x473e74={};_0x473e74[_0x186884]={'$like':'%'+_0xd9a6d6[_0x0c3f('0x34')][_0x0c3f('0x41')]+'%'};return _0x473e74;})});}_0x3f019d=_[_0x0c3f('0x43')]({},_0x3f019d,_0xd9a6d6['options']);return _0x44e2d7[_0x0c3f('0x51')](_0x3f019d);}})[_0x0c3f('0x27')](function(_0x195c08){if(_0x195c08){_0x88772a=_0x195c08[_0x0c3f('0x3a')];if(!_0xd9a6d6[_0x0c3f('0x34')]['hasOwnProperty'](_0x0c3f('0x3b'))){_0x3f019d[_0x0c3f('0x20')]=qs[_0x0c3f('0x20')](_0xd9a6d6[_0x0c3f('0x34')][_0x0c3f('0x20')]);_0x3f019d['offset']=qs[_0x0c3f('0x1e')](_0xd9a6d6[_0x0c3f('0x34')][_0x0c3f('0x1e')]);}return _0x44e2d7[_0x0c3f('0x51')](_0x3f019d);}})[_0x0c3f('0x27')](function(_0x3cb406){if(_0x3cb406){return _0x3cb406?{'count':_0x88772a,'rows':_0x3cb406}:null;}})[_0x0c3f('0x27')](respondWithResult(_0x29668e,null))['catch'](handleError(_0x29668e,null));};exports['getSubjects']=function(_0x30e5a0,_0x472acf,_0x526305){var _0x2625ed={};var _0x2bd369={};var _0x3e1c71;var _0x3d8a2d;return db['SugarcrmConfiguration'][_0x0c3f('0x50')]({'where':{'id':_0x30e5a0['params']['id']}})[_0x0c3f('0x27')](handleEntityNotFound(_0x472acf,null))[_0x0c3f('0x27')](function(_0x1971d2){if(_0x1971d2){_0x3e1c71=_0x1971d2;_0x2bd369[_0x0c3f('0x37')]=_[_0x0c3f('0x35')](db[_0x0c3f('0x52')][_0x0c3f('0x30')]);_0x2bd369[_0x0c3f('0x34')]=_['keys'](_0x30e5a0[_0x0c3f('0x34')]);_0x2bd369['filters']=_[_0x0c3f('0x36')](_0x2bd369[_0x0c3f('0x37')],_0x2bd369['query']);_0x2625ed[_0x0c3f('0x39')]=_[_0x0c3f('0x36')](_0x2bd369[_0x0c3f('0x37')],qs[_0x0c3f('0x38')](_0x30e5a0[_0x0c3f('0x34')][_0x0c3f('0x38')]));_0x2625ed[_0x0c3f('0x39')]=_0x2625ed[_0x0c3f('0x39')][_0x0c3f('0x3a')]?_0x2625ed[_0x0c3f('0x39')]:_0x2bd369['model'];_0x2625ed[_0x0c3f('0x3c')]=qs[_0x0c3f('0x3d')](_0x30e5a0[_0x0c3f('0x34')]['sort']);_0x2625ed[_0x0c3f('0x3e')]=qs[_0x0c3f('0x3f')](_['pick'](_0x30e5a0[_0x0c3f('0x34')],_0x2bd369['filters']));if(_0x30e5a0[_0x0c3f('0x34')][_0x0c3f('0x41')]){_0x2625ed['where']=_[_0x0c3f('0x43')](_0x2625ed['where'],{'$or':_[_0x0c3f('0x2e')](_0x2625ed[_0x0c3f('0x39')],function(_0xdcc94d){var _0xda9ea2={};_0xda9ea2[_0xdcc94d]={'$like':'%'+_0x30e5a0[_0x0c3f('0x34')]['filter']+'%'};return _0xda9ea2;})});}_0x2625ed=_['merge']({},_0x2625ed,_0x30e5a0[_0x0c3f('0x44')]);return _0x3e1c71['getSubjects'](_0x2625ed);}})[_0x0c3f('0x27')](function(_0xaafcb2){if(_0xaafcb2){_0x3d8a2d=_0xaafcb2[_0x0c3f('0x3a')];if(!_0x30e5a0[_0x0c3f('0x34')][_0x0c3f('0x53')](_0x0c3f('0x3b'))){_0x2625ed[_0x0c3f('0x20')]=qs[_0x0c3f('0x20')](_0x30e5a0['query'][_0x0c3f('0x20')]);_0x2625ed['offset']=qs[_0x0c3f('0x1e')](_0x30e5a0['query'][_0x0c3f('0x1e')]);}return _0x3e1c71[_0x0c3f('0x54')](_0x2625ed);}})[_0x0c3f('0x27')](function(_0x1044af){if(_0x1044af){return _0x1044af?{'count':_0x3d8a2d,'rows':_0x1044af}:null;}})[_0x0c3f('0x27')](respondWithResult(_0x472acf,null))[_0x0c3f('0x49')](handleError(_0x472acf,null));};exports['getDescriptions']=function(_0x17dc09,_0x46c3d9,_0x456169){var _0x50878e={};var _0x1294a5={};var _0x95ee20;var _0x86a64d;return db['SugarcrmConfiguration'][_0x0c3f('0x50')]({'where':{'id':_0x17dc09[_0x0c3f('0x4b')]['id']}})[_0x0c3f('0x27')](handleEntityNotFound(_0x46c3d9,null))[_0x0c3f('0x27')](function(_0x16c6f6){if(_0x16c6f6){_0x95ee20=_0x16c6f6;_0x1294a5['model']=_[_0x0c3f('0x35')](db[_0x0c3f('0x52')][_0x0c3f('0x30')]);_0x1294a5[_0x0c3f('0x34')]=_['keys'](_0x17dc09[_0x0c3f('0x34')]);_0x1294a5[_0x0c3f('0x3f')]=_['intersection'](_0x1294a5[_0x0c3f('0x37')],_0x1294a5['query']);_0x50878e[_0x0c3f('0x39')]=_['intersection'](_0x1294a5[_0x0c3f('0x37')],qs['fields'](_0x17dc09[_0x0c3f('0x34')][_0x0c3f('0x38')]));_0x50878e[_0x0c3f('0x39')]=_0x50878e[_0x0c3f('0x39')][_0x0c3f('0x3a')]?_0x50878e[_0x0c3f('0x39')]:_0x1294a5[_0x0c3f('0x37')];_0x50878e[_0x0c3f('0x3c')]=qs['sort'](_0x17dc09[_0x0c3f('0x34')][_0x0c3f('0x3d')]);_0x50878e[_0x0c3f('0x3e')]=qs[_0x0c3f('0x3f')](_[_0x0c3f('0x40')](_0x17dc09[_0x0c3f('0x34')],_0x1294a5['filters']));if(_0x17dc09[_0x0c3f('0x34')][_0x0c3f('0x41')]){_0x50878e[_0x0c3f('0x3e')]=_['merge'](_0x50878e['where'],{'$or':_['map'](_0x50878e[_0x0c3f('0x39')],function(_0x32a2b1){var _0x3fd317={};_0x3fd317[_0x32a2b1]={'$like':'%'+_0x17dc09[_0x0c3f('0x34')]['filter']+'%'};return _0x3fd317;})});}_0x50878e=_[_0x0c3f('0x43')]({},_0x50878e,_0x17dc09[_0x0c3f('0x44')]);return _0x95ee20[_0x0c3f('0x55')](_0x50878e);}})[_0x0c3f('0x27')](function(_0x3743ac){if(_0x3743ac){_0x86a64d=_0x3743ac[_0x0c3f('0x3a')];if(!_0x17dc09[_0x0c3f('0x34')][_0x0c3f('0x53')]('nolimit')){_0x50878e['limit']=qs[_0x0c3f('0x20')](_0x17dc09['query'][_0x0c3f('0x20')]);_0x50878e[_0x0c3f('0x1e')]=qs[_0x0c3f('0x1e')](_0x17dc09[_0x0c3f('0x34')][_0x0c3f('0x1e')]);}return _0x95ee20[_0x0c3f('0x55')](_0x50878e);}})[_0x0c3f('0x27')](function(_0x1e491f){if(_0x1e491f){return _0x1e491f?{'count':_0x86a64d,'rows':_0x1e491f}:null;}})[_0x0c3f('0x27')](respondWithResult(_0x46c3d9,null))[_0x0c3f('0x49')](handleError(_0x46c3d9,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5cfc619..22af6bc 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 _0x0df2=['./intSugarcrmConfiguration.attributes','define','int_sugarcrm_configurations','lodash','util','api','request-promise','rimraf','../../config/environment'];(function(_0x4bf19e,_0x229ad1){var _0x50825e=function(_0x19f6f2){while(--_0x19f6f2){_0x4bf19e['push'](_0x4bf19e['shift']());}};_0x50825e(++_0x229ad1);}(_0x0df2,0x1f2));var _0x20df=function(_0x2cd3a7,_0x278f96){_0x2cd3a7=_0x2cd3a7-0x0;var _0x1aeb9b=_0x0df2[_0x2cd3a7];return _0x1aeb9b;};'use strict';var _=require(_0x20df('0x0'));var util=require(_0x20df('0x1'));var logger=require('../../config/logger')(_0x20df('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x20df('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x20df('0x4'));var config=require(_0x20df('0x5'));var attributes=require(_0x20df('0x6'));module['exports']=function(_0x25220d,_0x336851){return _0x25220d[_0x20df('0x7')]('SugarcrmConfiguration',attributes,{'tableName':_0x20df('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9a96=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x30133e,_0x1a7f1b){var _0x1814cd=function(_0x21bf98){while(--_0x21bf98){_0x30133e['push'](_0x30133e['shift']());}};_0x1814cd(++_0x1a7f1b);}(_0x9a96,0xd0));var _0x69a9=function(_0x10e863,_0x1e7a82){_0x10e863=_0x10e863-0x0;var _0x529127=_0x9a96[_0x10e863];return _0x529127;};'use strict';var _=require(_0x69a9('0x0'));var util=require(_0x69a9('0x1'));var logger=require(_0x69a9('0x2'))(_0x69a9('0x3'));var moment=require(_0x69a9('0x4'));var BPromise=require(_0x69a9('0x5'));var rp=require(_0x69a9('0x6'));var fs=require('fs');var path=require(_0x69a9('0x7'));var rimraf=require(_0x69a9('0x8'));var config=require(_0x69a9('0x9'));var attributes=require(_0x69a9('0xa'));module[_0x69a9('0xb')]=function(_0x5a48bf,_0x245072){return _0x5a48bf[_0x69a9('0xc')](_0x69a9('0xd'),attributes,{'tableName':_0x69a9('0xe'),'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 1028a63..0855c7d 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 _0x9e5a=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util'];(function(_0x4ec2e2,_0x25c82e){var _0x57bc19=function(_0x169cd3){while(--_0x169cd3){_0x4ec2e2['push'](_0x4ec2e2['shift']());}};_0x57bc19(++_0x25c82e);}(_0x9e5a,0x12b));var _0xa9e5=function(_0x58f136,_0xd3fc31){_0x58f136=_0x58f136-0x0;var _0x2be7a8=_0x9e5a[_0x58f136];return _0x2be7a8;};'use strict';var _=require('lodash');var util=require(_0xa9e5('0x0'));var moment=require(_0xa9e5('0x1'));var BPromise=require(_0xa9e5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa9e5('0x3'));var db=require(_0xa9e5('0x4'))['db'];var utils=require(_0xa9e5('0x5'));var logger=require('../../config/logger')(_0xa9e5('0x6'));var config=require(_0xa9e5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa9e5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x16cd9f,_0xee2eae,_0x303842){return new BPromise(function(_0x3fd732,_0xd3b035){return client[_0xa9e5('0x9')](_0x16cd9f,_0x303842)[_0xa9e5('0xa')](function(_0xc427ba){logger[_0xa9e5('0xb')](_0xa9e5('0xc'),_0xee2eae,_0xa9e5('0xd'));logger[_0xa9e5('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xee2eae,_0xa9e5('0xd'),JSON[_0xa9e5('0xf')](_0xc427ba));if(_0xc427ba[_0xa9e5('0x10')]){if(_0xc427ba['error'][_0xa9e5('0x11')]===0x1f4){logger[_0xa9e5('0x10')](_0xa9e5('0xc'),_0xee2eae,_0xc427ba['error'][_0xa9e5('0x12')]);return _0xd3b035(_0xc427ba['error'][_0xa9e5('0x12')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xee2eae,_0xc427ba[_0xa9e5('0x10')][_0xa9e5('0x12')]);return _0x3fd732(_0xc427ba[_0xa9e5('0x10')]['message']);}else{logger['info'](_0xa9e5('0xc'),_0xee2eae,_0xa9e5('0xd'));_0x3fd732(_0xc427ba[_0xa9e5('0x13')][_0xa9e5('0x12')]);}})['catch'](function(_0x222eb0){logger['error'](_0xa9e5('0xc'),_0xee2eae,_0x222eb0);_0xd3b035(_0x222eb0);});});} \ No newline at end of file +var _0xa769=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x487473,_0x1c95a8){var _0x49697c=function(_0x504c7c){while(--_0x504c7c){_0x487473['push'](_0x487473['shift']());}};_0x49697c(++_0x1c95a8);}(_0xa769,0x17a));var _0x9a76=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa769[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9a76('0x0'));var util=require(_0x9a76('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9a76('0x2'));var fs=require('fs');var Redis=require(_0x9a76('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9a76('0x4'));var logger=require(_0x9a76('0x5'))(_0x9a76('0x6'));var config=require(_0x9a76('0x7'));var jayson=require(_0x9a76('0x8'));var client=jayson['client'][_0x9a76('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d6bb6,_0x254526,_0x1730de){return new BPromise(function(_0x9359ed,_0x1e617f){return client[_0x9a76('0xa')](_0x3d6bb6,_0x1730de)[_0x9a76('0xb')](function(_0x2b3c8e){logger[_0x9a76('0xc')](_0x9a76('0xd'),_0x254526,_0x9a76('0xe'));logger[_0x9a76('0xf')](_0x9a76('0x10'),_0x254526,_0x9a76('0xe'),JSON[_0x9a76('0x11')](_0x2b3c8e));if(_0x2b3c8e[_0x9a76('0x12')]){if(_0x2b3c8e[_0x9a76('0x12')][_0x9a76('0x13')]===0x1f4){logger[_0x9a76('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x254526,_0x2b3c8e['error'][_0x9a76('0x14')]);return _0x1e617f(_0x2b3c8e[_0x9a76('0x12')][_0x9a76('0x14')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x254526,_0x2b3c8e['error'][_0x9a76('0x14')]);return _0x9359ed(_0x2b3c8e[_0x9a76('0x12')][_0x9a76('0x14')]);}else{logger['info'](_0x9a76('0xd'),_0x254526,_0x9a76('0xe'));_0x9359ed(_0x2b3c8e[_0x9a76('0x15')]['message']);}})[_0x9a76('0x16')](function(_0x37e0cc){logger[_0x9a76('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x254526,_0x37e0cc);_0x1e617f(_0x37e0cc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 88084eb..7d6960f 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 _0x6514=['show','put','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','/:id'];(function(_0x2434c0,_0xc33b8a){var _0x439905=function(_0x822bd1){while(--_0x822bd1){_0x2434c0['push'](_0x2434c0['shift']());}};_0x439905(++_0xc33b8a);}(_0x6514,0x146));var _0x4651=function(_0x55400f,_0x4a7639){_0x55400f=_0x55400f-0x0;var _0x20c175=_0x6514[_0x55400f];return _0x20c175;};'use strict';var multer=require('multer');var util=require(_0x4651('0x0'));var path=require(_0x4651('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4651('0x2')]();var fs_extra=require(_0x4651('0x3'));var auth=require(_0x4651('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4651('0x5'));var controller=require(_0x4651('0x6'));router[_0x4651('0x7')]('/',auth[_0x4651('0x8')](),controller['index']);router[_0x4651('0x7')](_0x4651('0x9'),auth[_0x4651('0x8')](),controller[_0x4651('0xa')]);router['post']('/',auth[_0x4651('0x8')](),controller['create']);router[_0x4651('0xb')](_0x4651('0x9'),auth[_0x4651('0x8')](),controller[_0x4651('0xc')]);router[_0x4651('0xd')](_0x4651('0x9'),auth['isAuthenticated'](),controller[_0x4651('0xe')]);module[_0x4651('0xf')]=router; \ No newline at end of file +var _0xf749=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf749,0xd8));var _0x9f74=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xf749[_0x5d6456];return _0x4d66c1;};'use strict';var multer=require('multer');var util=require(_0x9f74('0x0'));var path=require(_0x9f74('0x1'));var timeout=require(_0x9f74('0x2'));var express=require(_0x9f74('0x3'));var router=express[_0x9f74('0x4')]();var fs_extra=require(_0x9f74('0x5'));var auth=require(_0x9f74('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9f74('0x7'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9f74('0x8'),auth[_0x9f74('0x9')](),controller[_0x9f74('0xa')]);router[_0x9f74('0xb')]('/',auth[_0x9f74('0x9')](),controller[_0x9f74('0xc')]);router[_0x9f74('0xd')](_0x9f74('0x8'),auth[_0x9f74('0x9')](),controller[_0x9f74('0xe')]);router[_0x9f74('0xf')](_0x9f74('0x8'),auth['isAuthenticated'](),controller[_0x9f74('0x10')]);module[_0x9f74('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 97ebde6..81185d1 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 _0x6116=['ENUM','string','variable','customVariable','picklist','STRING','exports'];(function(_0x1e5cc3,_0x238a87){var _0x15c596=function(_0x27bb04){while(--_0x27bb04){_0x1e5cc3['push'](_0x1e5cc3['shift']());}};_0x15c596(++_0x238a87);}(_0x6116,0x109));var _0x6611=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x6116[_0x2be8c2];return _0x97f531;};'use strict';var Sequelize=require('sequelize');module[_0x6611('0x0')]={'type':{'type':Sequelize[_0x6611('0x1')](_0x6611('0x2'),_0x6611('0x3'),_0x6611('0x4'),'keyValue',_0x6611('0x5')),'defaultValue':_0x6611('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6611('0x6')]},'keyType':{'type':Sequelize[_0x6611('0x1')](_0x6611('0x2'),_0x6611('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6611('0x6')]},'idField':{'type':Sequelize[_0x6611('0x6')]},'nameField':{'type':Sequelize[_0x6611('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6611('0x6')]}}; \ No newline at end of file +var _0x3808=['string','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM'];(function(_0x58c851,_0x1f3d96){var _0x534d8a=function(_0x10c1a0){while(--_0x10c1a0){_0x58c851['push'](_0x58c851['shift']());}};_0x534d8a(++_0x1f3d96);}(_0x3808,0x14d));var _0x8380=function(_0x1555d9,_0x13f5b2){_0x1555d9=_0x1555d9-0x0;var _0x17b54f=_0x3808[_0x1555d9];return _0x17b54f;};'use strict';var Sequelize=require(_0x8380('0x0'));module[_0x8380('0x1')]={'type':{'type':Sequelize[_0x8380('0x2')](_0x8380('0x3'),'variable','customVariable',_0x8380('0x4'),_0x8380('0x5')),'defaultValue':_0x8380('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8380('0x6')]},'keyType':{'type':Sequelize[_0x8380('0x2')](_0x8380('0x3'),'variable',_0x8380('0x7'))},'keyContent':{'type':Sequelize[_0x8380('0x6')]},'idField':{'type':Sequelize[_0x8380('0x6')]},'nameField':{'type':Sequelize[_0x8380('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 86f5662..9b6e7f1 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 _0x8c23=['where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','length','includeAll','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','end','json','offset','limit','undefined','count','Content-Range','save','update','then','destroy','name','send','index','map','SugarcrmField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort'];(function(_0x3e36b6,_0x43de3b){var _0x4a3a36=function(_0x13f6a0){while(--_0x13f6a0){_0x3e36b6['push'](_0x3e36b6['shift']());}};_0x4a3a36(++_0x43de3b);}(_0x8c23,0xf1));var _0x38c2=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x8c23[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0x38c2('0x0'));var rimraf=require(_0x38c2('0x1'));var zipdir=require(_0x38c2('0x2'));var jsonpatch=require(_0x38c2('0x3'));var rp=require('request-promise');var moment=require(_0x38c2('0x4'));var BPromise=require(_0x38c2('0x5'));var Mustache=require(_0x38c2('0x6'));var util=require('util');var path=require('path');var sox=require(_0x38c2('0x7'));var csv=require(_0x38c2('0x8'));var ejs=require(_0x38c2('0x9'));var fs=require('fs');var fs_extra=require(_0x38c2('0xa'));var _=require(_0x38c2('0xb'));var squel=require(_0x38c2('0xc'));var crypto=require(_0x38c2('0xd'));var jsforce=require(_0x38c2('0xe'));var deskjs=require(_0x38c2('0xf'));var toCsv=require(_0x38c2('0x8'));var querystring=require(_0x38c2('0x10'));var Papa=require(_0x38c2('0x11'));var Redis=require('ioredis');var authService=require(_0x38c2('0x12'));var qs=require(_0x38c2('0x13'));var as=require(_0x38c2('0x14'));var hardwareService=require(_0x38c2('0x15'));var logger=require(_0x38c2('0x16'))(_0x38c2('0x17'));var utils=require(_0x38c2('0x18'));var config=require(_0x38c2('0x19'));var licenseUtil=require(_0x38c2('0x1a'));var db=require(_0x38c2('0x1b'))['db'];function respondWithStatusCode(_0xb4e309,_0x3bd40a){_0x3bd40a=_0x3bd40a||0xcc;return function(_0x49319e){if(_0x49319e){return _0xb4e309[_0x38c2('0x1c')](_0x3bd40a);}return _0xb4e309[_0x38c2('0x1d')](_0x3bd40a)[_0x38c2('0x1e')]();};}function respondWithResult(_0x5ac8a5,_0x1e9761){_0x1e9761=_0x1e9761||0xc8;return function(_0x173f04){if(_0x173f04){return _0x5ac8a5[_0x38c2('0x1d')](_0x1e9761)[_0x38c2('0x1f')](_0x173f04);}};}function respondWithFilteredResult(_0x3c6bde,_0x18f160){return function(_0x30aedb){if(_0x30aedb){var _0x47d7aa=typeof _0x18f160[_0x38c2('0x20')]==='undefined'&&typeof _0x18f160[_0x38c2('0x21')]===_0x38c2('0x22');var _0xa8fcf0=_0x30aedb[_0x38c2('0x23')];var _0x2a07b3=_0x47d7aa?0x0:_0x18f160[_0x38c2('0x20')];var _0x2e641f=_0x47d7aa?_0x30aedb['count']:_0x18f160[_0x38c2('0x20')]+_0x18f160[_0x38c2('0x21')];var _0x50ec0f;if(_0x2e641f>=_0xa8fcf0){_0x2e641f=_0xa8fcf0;_0x50ec0f=0xc8;}else{_0x50ec0f=0xce;}_0x3c6bde[_0x38c2('0x1d')](_0x50ec0f);return _0x3c6bde['set'](_0x38c2('0x24'),_0x2a07b3+'-'+_0x2e641f+'/'+_0xa8fcf0)[_0x38c2('0x1f')](_0x30aedb);}return null;};}function patchUpdates(_0x3bf1e0){return function(_0x16d16a){try{jsonpatch['apply'](_0x16d16a,_0x3bf1e0,!![]);}catch(_0x43e7ef){return BPromise['reject'](_0x43e7ef);}return _0x16d16a[_0x38c2('0x25')]();};}function saveUpdates(_0x19cc7b,_0x3e32ea){return function(_0x38c97d){if(_0x38c97d){return _0x38c97d[_0x38c2('0x26')](_0x19cc7b)[_0x38c2('0x27')](function(_0x2026b1){return _0x2026b1;});}return null;};}function removeEntity(_0x353b22,_0x2238de){return function(_0x27be66){if(_0x27be66){return _0x27be66[_0x38c2('0x28')]()['then'](function(){_0x353b22[_0x38c2('0x1d')](0xcc)[_0x38c2('0x1e')]();});}};}function handleEntityNotFound(_0xb1e016,_0x3aff3a){return function(_0x40b7b4){if(!_0x40b7b4){_0xb1e016[_0x38c2('0x1c')](0x194);}return _0x40b7b4;};}function handleError(_0x1bb1dd,_0x21a8c9){_0x21a8c9=_0x21a8c9||0x1f4;return function(_0x22b852){logger['error'](_0x22b852['stack']);if(_0x22b852[_0x38c2('0x29')]){delete _0x22b852[_0x38c2('0x29')];}_0x1bb1dd[_0x38c2('0x1d')](_0x21a8c9)[_0x38c2('0x2a')](_0x22b852);};}exports[_0x38c2('0x2b')]=function(_0x59dfc7,_0x222382){var _0x35479c={},_0x21480c={},_0x59eaa3={'count':0x0,'rows':[]};var _0x302131=_[_0x38c2('0x2c')](db[_0x38c2('0x2d')][_0x38c2('0x2e')],function(_0x33ab8c){return{'name':_0x33ab8c[_0x38c2('0x2f')],'type':_0x33ab8c['type'][_0x38c2('0x30')]};});_0x21480c[_0x38c2('0x31')]=_['map'](_0x302131,'name');_0x21480c[_0x38c2('0x32')]=_[_0x38c2('0x33')](_0x59dfc7[_0x38c2('0x32')]);_0x21480c[_0x38c2('0x34')]=_[_0x38c2('0x35')](_0x21480c[_0x38c2('0x31')],_0x21480c[_0x38c2('0x32')]);_0x35479c['attributes']=_[_0x38c2('0x35')](_0x21480c[_0x38c2('0x31')],qs[_0x38c2('0x36')](_0x59dfc7['query']['fields']));_0x35479c[_0x38c2('0x37')]=_0x35479c[_0x38c2('0x37')]['length']?_0x35479c[_0x38c2('0x37')]:_0x21480c[_0x38c2('0x31')];if(!_0x59dfc7['query']['hasOwnProperty'](_0x38c2('0x38'))){_0x35479c[_0x38c2('0x21')]=qs[_0x38c2('0x21')](_0x59dfc7[_0x38c2('0x32')][_0x38c2('0x21')]);_0x35479c[_0x38c2('0x20')]=qs[_0x38c2('0x20')](_0x59dfc7['query'][_0x38c2('0x20')]);}_0x35479c[_0x38c2('0x39')]=qs[_0x38c2('0x3a')](_0x59dfc7[_0x38c2('0x32')][_0x38c2('0x3a')]);_0x35479c[_0x38c2('0x3b')]=qs[_0x38c2('0x34')](_[_0x38c2('0x3c')](_0x59dfc7[_0x38c2('0x32')],_0x21480c[_0x38c2('0x34')]),_0x302131);if(_0x59dfc7[_0x38c2('0x32')][_0x38c2('0x3d')]){_0x35479c[_0x38c2('0x3b')]=_[_0x38c2('0x3e')](_0x35479c[_0x38c2('0x3b')],{'$or':_['map'](_0x302131,function(_0x1722dd){if(_0x1722dd['type']!==_0x38c2('0x3f')){var _0x5b8719={};_0x5b8719[_0x1722dd['name']]={'$like':'%'+_0x59dfc7['query'][_0x38c2('0x3d')]+'%'};return _0x5b8719;}})});}_0x35479c=_[_0x38c2('0x3e')]({},_0x35479c,_0x59dfc7[_0x38c2('0x40')]);var _0x3c0993={'where':_0x35479c[_0x38c2('0x3b')]};return db[_0x38c2('0x2d')]['count'](_0x3c0993)[_0x38c2('0x27')](function(_0x177ace){_0x59eaa3[_0x38c2('0x23')]=_0x177ace;if(_0x59dfc7[_0x38c2('0x32')]['includeAll']){_0x35479c[_0x38c2('0x41')]=[{'all':!![]}];}return db[_0x38c2('0x2d')][_0x38c2('0x42')](_0x35479c);})['then'](function(_0x55ddb8){_0x59eaa3[_0x38c2('0x43')]=_0x55ddb8;return _0x59eaa3;})['then'](respondWithFilteredResult(_0x222382,_0x35479c))['catch'](handleError(_0x222382,null));};exports[_0x38c2('0x44')]=function(_0x2891aa,_0x151a55){var _0x287c41={'raw':!![],'where':{'id':_0x2891aa['params']['id']}},_0x4bb787={};_0x4bb787[_0x38c2('0x31')]=_[_0x38c2('0x33')](db['SugarcrmField'][_0x38c2('0x2e')]);_0x4bb787[_0x38c2('0x32')]=_[_0x38c2('0x33')](_0x2891aa[_0x38c2('0x32')]);_0x4bb787[_0x38c2('0x34')]=_['intersection'](_0x4bb787[_0x38c2('0x31')],_0x4bb787[_0x38c2('0x32')]);_0x287c41[_0x38c2('0x37')]=_[_0x38c2('0x35')](_0x4bb787['model'],qs[_0x38c2('0x36')](_0x2891aa[_0x38c2('0x32')][_0x38c2('0x36')]));_0x287c41[_0x38c2('0x37')]=_0x287c41[_0x38c2('0x37')][_0x38c2('0x45')]?_0x287c41[_0x38c2('0x37')]:_0x4bb787[_0x38c2('0x31')];if(_0x2891aa[_0x38c2('0x32')][_0x38c2('0x46')]){_0x287c41[_0x38c2('0x41')]=[{'all':!![]}];}_0x287c41=_[_0x38c2('0x3e')]({},_0x287c41,_0x2891aa[_0x38c2('0x40')]);return db['SugarcrmField'][_0x38c2('0x47')](_0x287c41)[_0x38c2('0x27')](handleEntityNotFound(_0x151a55,null))[_0x38c2('0x27')](respondWithResult(_0x151a55,null))['catch'](handleError(_0x151a55,null));};exports[_0x38c2('0x48')]=function(_0x41c99b,_0x518c45){return db[_0x38c2('0x2d')][_0x38c2('0x48')](_0x41c99b[_0x38c2('0x49')],{})['then'](respondWithResult(_0x518c45,0xc9))[_0x38c2('0x4a')](handleError(_0x518c45,null));};exports['update']=function(_0x26d3e3,_0x3aa3a1){if(_0x26d3e3['body']['id']){delete _0x26d3e3[_0x38c2('0x49')]['id'];}return db[_0x38c2('0x2d')][_0x38c2('0x47')]({'where':{'id':_0x26d3e3['params']['id']}})[_0x38c2('0x27')](handleEntityNotFound(_0x3aa3a1,null))['then'](saveUpdates(_0x26d3e3['body'],null))['then'](respondWithResult(_0x3aa3a1,null))[_0x38c2('0x4a')](handleError(_0x3aa3a1,null));};exports[_0x38c2('0x28')]=function(_0x45ef5a,_0x5c733e){return db[_0x38c2('0x2d')][_0x38c2('0x47')]({'where':{'id':_0x45ef5a['params']['id']}})['then'](handleEntityNotFound(_0x5c733e,null))[_0x38c2('0x27')](removeEntity(_0x5c733e,null))[_0x38c2('0x4a')](handleError(_0x5c733e,null));}; \ No newline at end of file +var _0x580c=['include','findAll','catch','show','params','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','count','limit','status','set','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','SugarcrmField','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll'];(function(_0x189094,_0x229998){var _0x3b8fd5=function(_0x555203){while(--_0x555203){_0x189094['push'](_0x189094['shift']());}};_0x3b8fd5(++_0x229998);}(_0x580c,0xf6));var _0xc580=function(_0x445255,_0x3cdd4f){_0x445255=_0x445255-0x0;var _0x9ce6fc=_0x580c[_0x445255];return _0x9ce6fc;};'use strict';var emlformat=require(_0xc580('0x0'));var rimraf=require(_0xc580('0x1'));var zipdir=require(_0xc580('0x2'));var jsonpatch=require(_0xc580('0x3'));var rp=require(_0xc580('0x4'));var moment=require(_0xc580('0x5'));var BPromise=require(_0xc580('0x6'));var Mustache=require(_0xc580('0x7'));var util=require(_0xc580('0x8'));var path=require(_0xc580('0x9'));var sox=require(_0xc580('0xa'));var csv=require('to-csv');var ejs=require(_0xc580('0xb'));var fs=require('fs');var fs_extra=require(_0xc580('0xc'));var _=require(_0xc580('0xd'));var squel=require(_0xc580('0xe'));var crypto=require(_0xc580('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xc580('0x10'));var toCsv=require(_0xc580('0x11'));var querystring=require('querystring');var Papa=require(_0xc580('0x12'));var Redis=require(_0xc580('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xc580('0x14'));var as=require(_0xc580('0x15'));var hardwareService=require(_0xc580('0x16'));var logger=require(_0xc580('0x17'))(_0xc580('0x18'));var utils=require(_0xc580('0x19'));var config=require(_0xc580('0x1a'));var licenseUtil=require(_0xc580('0x1b'));var db=require(_0xc580('0x1c'))['db'];function respondWithStatusCode(_0x3d5087,_0x188da4){_0x188da4=_0x188da4||0xcc;return function(_0x382837){if(_0x382837){return _0x3d5087['sendStatus'](_0x188da4);}return _0x3d5087['status'](_0x188da4)[_0xc580('0x1d')]();};}function respondWithResult(_0xd072cd,_0x8048c2){_0x8048c2=_0x8048c2||0xc8;return function(_0xcc407b){if(_0xcc407b){return _0xd072cd['status'](_0x8048c2)[_0xc580('0x1e')](_0xcc407b);}};}function respondWithFilteredResult(_0x1684c2,_0x1af74c){return function(_0x569636){if(_0x569636){var _0x538f6e=typeof _0x1af74c[_0xc580('0x1f')]===_0xc580('0x20')&&typeof _0x1af74c['limit']==='undefined';var _0x32a18d=_0x569636[_0xc580('0x21')];var _0x27934f=_0x538f6e?0x0:_0x1af74c[_0xc580('0x1f')];var _0x317030=_0x538f6e?_0x569636['count']:_0x1af74c['offset']+_0x1af74c[_0xc580('0x22')];var _0x542c34;if(_0x317030>=_0x32a18d){_0x317030=_0x32a18d;_0x542c34=0xc8;}else{_0x542c34=0xce;}_0x1684c2[_0xc580('0x23')](_0x542c34);return _0x1684c2[_0xc580('0x24')]('Content-Range',_0x27934f+'-'+_0x317030+'/'+_0x32a18d)[_0xc580('0x1e')](_0x569636);}return null;};}function patchUpdates(_0x71027d){return function(_0xe784c5){try{jsonpatch[_0xc580('0x25')](_0xe784c5,_0x71027d,!![]);}catch(_0x2d9261){return BPromise[_0xc580('0x26')](_0x2d9261);}return _0xe784c5[_0xc580('0x27')]();};}function saveUpdates(_0x4b617f,_0x44e79b){return function(_0x12213e){if(_0x12213e){return _0x12213e[_0xc580('0x28')](_0x4b617f)['then'](function(_0xf98b4a){return _0xf98b4a;});}return null;};}function removeEntity(_0x5526b2,_0x45ecc1){return function(_0x4798a8){if(_0x4798a8){return _0x4798a8[_0xc580('0x29')]()[_0xc580('0x2a')](function(){_0x5526b2['status'](0xcc)[_0xc580('0x1d')]();});}};}function handleEntityNotFound(_0x43bc70,_0x22d9c1){return function(_0x507695){if(!_0x507695){_0x43bc70[_0xc580('0x2b')](0x194);}return _0x507695;};}function handleError(_0x375cde,_0x470ba9){_0x470ba9=_0x470ba9||0x1f4;return function(_0x11c3d5){logger[_0xc580('0x2c')](_0x11c3d5[_0xc580('0x2d')]);if(_0x11c3d5[_0xc580('0x2e')]){delete _0x11c3d5[_0xc580('0x2e')];}_0x375cde['status'](_0x470ba9)[_0xc580('0x2f')](_0x11c3d5);};}exports[_0xc580('0x30')]=function(_0x457aa5,_0x23b786){var _0x171ec5={},_0x1af71d={},_0x502804={'count':0x0,'rows':[]};var _0x1abfeb=_['map'](db[_0xc580('0x31')]['rawAttributes'],function(_0x314236){return{'name':_0x314236[_0xc580('0x32')],'type':_0x314236[_0xc580('0x33')][_0xc580('0x34')]};});_0x1af71d[_0xc580('0x35')]=_[_0xc580('0x36')](_0x1abfeb,_0xc580('0x2e'));_0x1af71d[_0xc580('0x37')]=_[_0xc580('0x38')](_0x457aa5[_0xc580('0x37')]);_0x1af71d[_0xc580('0x39')]=_[_0xc580('0x3a')](_0x1af71d[_0xc580('0x35')],_0x1af71d[_0xc580('0x37')]);_0x171ec5[_0xc580('0x3b')]=_[_0xc580('0x3a')](_0x1af71d[_0xc580('0x35')],qs[_0xc580('0x3c')](_0x457aa5[_0xc580('0x37')][_0xc580('0x3c')]));_0x171ec5[_0xc580('0x3b')]=_0x171ec5['attributes'][_0xc580('0x3d')]?_0x171ec5['attributes']:_0x1af71d[_0xc580('0x35')];if(!_0x457aa5[_0xc580('0x37')][_0xc580('0x3e')]('nolimit')){_0x171ec5['limit']=qs[_0xc580('0x22')](_0x457aa5[_0xc580('0x37')][_0xc580('0x22')]);_0x171ec5[_0xc580('0x1f')]=qs[_0xc580('0x1f')](_0x457aa5[_0xc580('0x37')][_0xc580('0x1f')]);}_0x171ec5[_0xc580('0x3f')]=qs[_0xc580('0x40')](_0x457aa5['query']['sort']);_0x171ec5[_0xc580('0x41')]=qs[_0xc580('0x39')](_[_0xc580('0x42')](_0x457aa5[_0xc580('0x37')],_0x1af71d[_0xc580('0x39')]),_0x1abfeb);if(_0x457aa5[_0xc580('0x37')]['filter']){_0x171ec5[_0xc580('0x41')]=_[_0xc580('0x43')](_0x171ec5[_0xc580('0x41')],{'$or':_[_0xc580('0x36')](_0x1abfeb,function(_0x4ad581){if(_0x4ad581[_0xc580('0x33')]!=='VIRTUAL'){var _0x206952={};_0x206952[_0x4ad581[_0xc580('0x2e')]]={'$like':'%'+_0x457aa5['query']['filter']+'%'};return _0x206952;}})});}_0x171ec5=_[_0xc580('0x43')]({},_0x171ec5,_0x457aa5[_0xc580('0x44')]);var _0x34e199={'where':_0x171ec5['where']};return db[_0xc580('0x31')]['count'](_0x34e199)[_0xc580('0x2a')](function(_0x5072b7){_0x502804[_0xc580('0x21')]=_0x5072b7;if(_0x457aa5[_0xc580('0x37')][_0xc580('0x45')]){_0x171ec5[_0xc580('0x46')]=[{'all':!![]}];}return db['SugarcrmField'][_0xc580('0x47')](_0x171ec5);})['then'](function(_0x20c991){_0x502804['rows']=_0x20c991;return _0x502804;})[_0xc580('0x2a')](respondWithFilteredResult(_0x23b786,_0x171ec5))[_0xc580('0x48')](handleError(_0x23b786,null));};exports[_0xc580('0x49')]=function(_0x3c9fcb,_0x295475){var _0x5cb109={'raw':!![],'where':{'id':_0x3c9fcb[_0xc580('0x4a')]['id']}},_0x2d65bc={};_0x2d65bc['model']=_['keys'](db[_0xc580('0x31')][_0xc580('0x4b')]);_0x2d65bc[_0xc580('0x37')]=_['keys'](_0x3c9fcb[_0xc580('0x37')]);_0x2d65bc[_0xc580('0x39')]=_[_0xc580('0x3a')](_0x2d65bc[_0xc580('0x35')],_0x2d65bc['query']);_0x5cb109[_0xc580('0x3b')]=_[_0xc580('0x3a')](_0x2d65bc[_0xc580('0x35')],qs[_0xc580('0x3c')](_0x3c9fcb['query'][_0xc580('0x3c')]));_0x5cb109[_0xc580('0x3b')]=_0x5cb109[_0xc580('0x3b')][_0xc580('0x3d')]?_0x5cb109[_0xc580('0x3b')]:_0x2d65bc[_0xc580('0x35')];if(_0x3c9fcb[_0xc580('0x37')]['includeAll']){_0x5cb109[_0xc580('0x46')]=[{'all':!![]}];}_0x5cb109=_[_0xc580('0x43')]({},_0x5cb109,_0x3c9fcb['options']);return db[_0xc580('0x31')]['find'](_0x5cb109)[_0xc580('0x2a')](handleEntityNotFound(_0x295475,null))[_0xc580('0x2a')](respondWithResult(_0x295475,null))[_0xc580('0x48')](handleError(_0x295475,null));};exports['create']=function(_0x43f740,_0x4b6bbc){return db[_0xc580('0x31')][_0xc580('0x4c')](_0x43f740['body'],{})[_0xc580('0x2a')](respondWithResult(_0x4b6bbc,0xc9))[_0xc580('0x48')](handleError(_0x4b6bbc,null));};exports[_0xc580('0x28')]=function(_0x2bcdd8,_0x4fe6c2){if(_0x2bcdd8[_0xc580('0x4d')]['id']){delete _0x2bcdd8['body']['id'];}return db[_0xc580('0x31')][_0xc580('0x4e')]({'where':{'id':_0x2bcdd8[_0xc580('0x4a')]['id']}})[_0xc580('0x2a')](handleEntityNotFound(_0x4fe6c2,null))[_0xc580('0x2a')](saveUpdates(_0x2bcdd8['body'],null))[_0xc580('0x2a')](respondWithResult(_0x4fe6c2,null))[_0xc580('0x48')](handleError(_0x4fe6c2,null));};exports['destroy']=function(_0x2de6ad,_0x44352e){return db['SugarcrmField'][_0xc580('0x4e')]({'where':{'id':_0x2de6ad['params']['id']}})['then'](handleEntityNotFound(_0x44352e,null))[_0xc580('0x2a')](removeEntity(_0x44352e,null))[_0xc580('0x48')](handleError(_0x44352e,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 20cb9c2..3c5f66c 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 _0x4ce9=['path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x38c632,_0x14e8e6){var _0x12737e=function(_0x3e0fe4){while(--_0x3e0fe4){_0x38c632['push'](_0x38c632['shift']());}};_0x12737e(++_0x14e8e6);}(_0x4ce9,0x180));var _0x94ce=function(_0x53e83f,_0x58e90c){_0x53e83f=_0x53e83f-0x0;var _0x57d1e7=_0x4ce9[_0x53e83f];return _0x57d1e7;};'use strict';var _=require(_0x94ce('0x0'));var util=require(_0x94ce('0x1'));var logger=require(_0x94ce('0x2'))(_0x94ce('0x3'));var moment=require('moment');var BPromise=require(_0x94ce('0x4'));var rp=require(_0x94ce('0x5'));var fs=require('fs');var path=require(_0x94ce('0x6'));var rimraf=require(_0x94ce('0x7'));var config=require(_0x94ce('0x8'));var attributes=require(_0x94ce('0x9'));module[_0x94ce('0xa')]=function(_0x5dc46c,_0x2ecddd){return _0x5dc46c[_0x94ce('0xb')](_0x94ce('0xc'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x94ce('0xd'),'fields':[_0x94ce('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8008=['define','int_sugarcrm_fields','sugarcrm_unique_index','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./intSugarcrmField.attributes'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8008,0x9d));var _0x8800=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8008[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8800('0x0'));var util=require(_0x8800('0x1'));var logger=require(_0x8800('0x2'))(_0x8800('0x3'));var moment=require(_0x8800('0x4'));var BPromise=require('bluebird');var rp=require(_0x8800('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8800('0x6'));var config=require('../../config/environment');var attributes=require(_0x8800('0x7'));module['exports']=function(_0x5c01eb,_0x1f019a){return _0x5c01eb[_0x8800('0x8')]('SugarcrmField',attributes,{'tableName':_0x8800('0x9'),'paranoid':![],'indexes':[{'name':_0x8800('0xa'),'fields':['idField','FieldId'],'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 1b29570..05a0a36 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 _0xa766=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x353f02,_0x47c044){var _0x269378=function(_0x2b3cdd){while(--_0x2b3cdd){_0x353f02['push'](_0x353f02['shift']());}};_0x269378(++_0x47c044);}(_0xa766,0x152));var _0x6a76=function(_0x3478d6,_0x4ea2c7){_0x3478d6=_0x3478d6-0x0;var _0x398620=_0xa766[_0x3478d6];return _0x398620;};'use strict';var _=require(_0x6a76('0x0'));var util=require(_0x6a76('0x1'));var moment=require(_0x6a76('0x2'));var BPromise=require(_0x6a76('0x3'));var rs=require(_0x6a76('0x4'));var fs=require('fs');var Redis=require(_0x6a76('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6a76('0x6'))(_0x6a76('0x7'));var config=require(_0x6a76('0x8'));var jayson=require(_0x6a76('0x9'));var client=jayson[_0x6a76('0xa')][_0x6a76('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x461ef5,_0x52c954,_0x4bf0d4){return new BPromise(function(_0x473251,_0x2d8b42){return client[_0x6a76('0xc')](_0x461ef5,_0x4bf0d4)[_0x6a76('0xd')](function(_0x1e057f){logger[_0x6a76('0xe')](_0x6a76('0xf'),_0x52c954,_0x6a76('0x10'));logger[_0x6a76('0x11')](_0x6a76('0x12'),_0x52c954,'request\x20sent',JSON['stringify'](_0x1e057f));if(_0x1e057f[_0x6a76('0x13')]){if(_0x1e057f['error'][_0x6a76('0x14')]===0x1f4){logger[_0x6a76('0x13')](_0x6a76('0xf'),_0x52c954,_0x1e057f['error'][_0x6a76('0x15')]);return _0x2d8b42(_0x1e057f[_0x6a76('0x13')][_0x6a76('0x15')]);}logger[_0x6a76('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x52c954,_0x1e057f[_0x6a76('0x13')][_0x6a76('0x15')]);return _0x473251(_0x1e057f[_0x6a76('0x13')][_0x6a76('0x15')]);}else{logger[_0x6a76('0xe')](_0x6a76('0xf'),_0x52c954,_0x6a76('0x10'));_0x473251(_0x1e057f[_0x6a76('0x16')][_0x6a76('0x15')]);}})[_0x6a76('0x17')](function(_0x56f133){logger[_0x6a76('0x13')](_0x6a76('0xf'),_0x52c954,_0x56f133);_0x2d8b42(_0x56f133);});});} \ No newline at end of file +var _0x6cca=['bluebird','randomstring','../../config/environment','jayson/promise','client','http','request','then','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0x6cca,0xc5));var _0xa6cc=function(_0x101ed6,_0x2b3e39){_0x101ed6=_0x101ed6-0x0;var _0x583e84=_0x6cca[_0x101ed6];return _0x583e84;};'use strict';var _=require(_0xa6cc('0x0'));var util=require(_0xa6cc('0x1'));var moment=require(_0xa6cc('0x2'));var BPromise=require(_0xa6cc('0x3'));var rs=require(_0xa6cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa6cc('0x5'));var jayson=require(_0xa6cc('0x6'));var client=jayson[_0xa6cc('0x7')][_0xa6cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1fbe20,_0x438c86,_0x5e268c){return new BPromise(function(_0x4d7152,_0x26334d){return client[_0xa6cc('0x9')](_0x1fbe20,_0x5e268c)[_0xa6cc('0xa')](function(_0x402254){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x438c86,'request\x20sent');logger[_0xa6cc('0xb')](_0xa6cc('0xc'),_0x438c86,_0xa6cc('0xd'),JSON[_0xa6cc('0xe')](_0x402254));if(_0x402254[_0xa6cc('0xf')]){if(_0x402254[_0xa6cc('0xf')]['code']===0x1f4){logger['error'](_0xa6cc('0x10'),_0x438c86,_0x402254['error'][_0xa6cc('0x11')]);return _0x26334d(_0x402254['error']['message']);}logger[_0xa6cc('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x438c86,_0x402254['error'][_0xa6cc('0x11')]);return _0x4d7152(_0x402254[_0xa6cc('0xf')][_0xa6cc('0x11')]);}else{logger['info'](_0xa6cc('0x10'),_0x438c86,_0xa6cc('0xd'));_0x4d7152(_0x402254[_0xa6cc('0x12')][_0xa6cc('0x11')]);}})[_0xa6cc('0x13')](function(_0x692408){logger[_0xa6cc('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x438c86,_0x692408);_0x26334d(_0x692408);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 41d55f1..49fbb40 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 _0x544f=['isAuthenticated','/:id','post','create','/:id/configurations','addConfiguration','put','update','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x3f51cf,_0x869ab7){var _0x3f96eb=function(_0x162724){while(--_0x162724){_0x3f51cf['push'](_0x3f51cf['shift']());}};_0x3f96eb(++_0x869ab7);}(_0x544f,0x14c));var _0xf544=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x544f[_0x211632];return _0x5a1da1;};'use strict';var multer=require(_0xf544('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf544('0x1'));var express=require(_0xf544('0x2'));var router=express[_0xf544('0x3')]();var fs_extra=require(_0xf544('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf544('0x5'));var config=require(_0xf544('0x6'));var controller=require('./intVtigerAccount.controller');router[_0xf544('0x7')]('/',auth[_0xf544('0x8')](),controller['index']);router[_0xf544('0x7')](_0xf544('0x9'),auth[_0xf544('0x8')](),controller['show']);router[_0xf544('0x7')]('/:id/configurations',auth[_0xf544('0x8')](),controller['getConfigurations']);router[_0xf544('0x7')]('/:id/fields',auth[_0xf544('0x8')](),controller['getFields']);router[_0xf544('0xa')]('/',auth[_0xf544('0x8')](),controller[_0xf544('0xb')]);router[_0xf544('0xa')](_0xf544('0xc'),auth[_0xf544('0x8')](),controller[_0xf544('0xd')]);router[_0xf544('0xe')]('/:id',auth[_0xf544('0x8')](),controller[_0xf544('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf544('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2da1=['delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','post','create','update'];(function(_0x5774af,_0x411c94){var _0x480589=function(_0x414114){while(--_0x414114){_0x5774af['push'](_0x5774af['shift']());}};_0x480589(++_0x411c94);}(_0x2da1,0xca));var _0x12da=function(_0x5d5d25,_0x3b8c9d){_0x5d5d25=_0x5d5d25-0x0;var _0x4b25ca=_0x2da1[_0x5d5d25];return _0x4b25ca;};'use strict';var multer=require(_0x12da('0x0'));var util=require(_0x12da('0x1'));var path=require('path');var timeout=require(_0x12da('0x2'));var express=require('express');var router=express[_0x12da('0x3')]();var fs_extra=require(_0x12da('0x4'));var auth=require(_0x12da('0x5'));var interaction=require(_0x12da('0x6'));var config=require('../../config/environment');var controller=require(_0x12da('0x7'));router[_0x12da('0x8')]('/',auth[_0x12da('0x9')](),controller[_0x12da('0xa')]);router[_0x12da('0x8')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['show']);router[_0x12da('0x8')](_0x12da('0xc'),auth[_0x12da('0x9')](),controller['getConfigurations']);router[_0x12da('0x8')](_0x12da('0xd'),auth[_0x12da('0x9')](),controller[_0x12da('0xe')]);router[_0x12da('0xf')]('/',auth['isAuthenticated'](),controller[_0x12da('0x10')]);router['post'](_0x12da('0xc'),auth[_0x12da('0x9')](),controller['addConfiguration']);router['put'](_0x12da('0xb'),auth['isAuthenticated'](),controller[_0x12da('0x11')]);router[_0x12da('0x12')](_0x12da('0xb'),auth[_0x12da('0x9')](),controller['destroy']);module[_0x12da('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index e2ab9a6..ae55cb3 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 _0xcbc6=['HelpDesk','STRING'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xcbc6,0xb9));var _0x6cbc=function(_0xa368d,_0x501d61){_0xa368d=_0xa368d-0x0;var _0x3499fa=_0xcbc6[_0xa368d];return _0x3499fa;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6cbc('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x6cbc('0x0')]},'username':{'type':Sequelize[_0x6cbc('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x6cbc('0x0')],'allowNull':![],'defaultValue':_0x6cbc('0x1')},'remoteUri':{'type':Sequelize[_0x6cbc('0x0')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x6cbc('0x0')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x6cbc('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x3035=['STRING','HelpDesk','sequelize','exports'];(function(_0x2dcdff,_0x199c86){var _0x5f771c=function(_0x6a6b7){while(--_0x6a6b7){_0x2dcdff['push'](_0x2dcdff['shift']());}};_0x5f771c(++_0x199c86);}(_0x3035,0x136));var _0x5303=function(_0x3f5fba,_0x5f9722){_0x3f5fba=_0x3f5fba-0x0;var _0x3258f6=_0x3035[_0x3f5fba];return _0x3258f6;};'use strict';var Sequelize=require(_0x5303('0x0'));module[_0x5303('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x5303('0x2')]},'username':{'type':Sequelize[_0x5303('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5303('0x3')},'remoteUri':{'type':Sequelize[_0x5303('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x5303('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5303('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 a5d3c66..d010c6b 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 _0xa1c3=['substring','lastIndexOf','GET','getchallenge','success','POST','login','result','token','describe','sessionName','autogenerated','reference','editable','false','startsWith','cf_','picklist','picklistValues','label','value','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','sort','map','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa1c3,0x102));var _0x3a1c=function(_0x4579cc,_0x199999){_0x4579cc=_0x4579cc-0x0;var _0x318362=_0xa1c3[_0x4579cc];return _0x318362;};'use strict';var emlformat=require(_0x3a1c('0x0'));var rimraf=require(_0x3a1c('0x1'));var zipdir=require(_0x3a1c('0x2'));var jsonpatch=require(_0x3a1c('0x3'));var rp=require(_0x3a1c('0x4'));var moment=require(_0x3a1c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3a1c('0x6'));var util=require('util');var path=require(_0x3a1c('0x7'));var sox=require('sox');var csv=require(_0x3a1c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3a1c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3a1c('0xa'));var toCsv=require(_0x3a1c('0x8'));var querystring=require(_0x3a1c('0xb'));var Papa=require(_0x3a1c('0xc'));var Redis=require(_0x3a1c('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3a1c('0xe'));var as=require(_0x3a1c('0xf'));var hardwareService=require(_0x3a1c('0x10'));var logger=require(_0x3a1c('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x3a1c('0x12'));var licenseUtil=require(_0x3a1c('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x3a1c('0x14'));function respondWithStatusCode(_0x138883,_0x47f092){_0x47f092=_0x47f092||0xcc;return function(_0x4d0f0d){if(_0x4d0f0d){return _0x138883[_0x3a1c('0x15')](_0x47f092);}return _0x138883[_0x3a1c('0x16')](_0x47f092)[_0x3a1c('0x17')]();};}function respondWithResult(_0x3150c2,_0x54babe){_0x54babe=_0x54babe||0xc8;return function(_0x4ec9c1){if(_0x4ec9c1){return _0x3150c2[_0x3a1c('0x16')](_0x54babe)[_0x3a1c('0x18')](_0x4ec9c1);}};}function respondWithFilteredResult(_0x2d7c4c,_0x52f2e5){return function(_0x2092f0){if(_0x2092f0){var _0x2c253e=typeof _0x52f2e5[_0x3a1c('0x19')]===_0x3a1c('0x1a')&&typeof _0x52f2e5[_0x3a1c('0x1b')]===_0x3a1c('0x1a');var _0x4863a0=_0x2092f0['count'];var _0x27d013=_0x2c253e?0x0:_0x52f2e5[_0x3a1c('0x19')];var _0xc7ba25=_0x2c253e?_0x2092f0[_0x3a1c('0x1c')]:_0x52f2e5['offset']+_0x52f2e5[_0x3a1c('0x1b')];var _0x457063;if(_0xc7ba25>=_0x4863a0){_0xc7ba25=_0x4863a0;_0x457063=0xc8;}else{_0x457063=0xce;}_0x2d7c4c[_0x3a1c('0x16')](_0x457063);return _0x2d7c4c['set'](_0x3a1c('0x1d'),_0x27d013+'-'+_0xc7ba25+'/'+_0x4863a0)[_0x3a1c('0x18')](_0x2092f0);}return null;};}function patchUpdates(_0x35ff70){return function(_0x10fdf4){try{jsonpatch[_0x3a1c('0x1e')](_0x10fdf4,_0x35ff70,!![]);}catch(_0x4b2010){return BPromise[_0x3a1c('0x1f')](_0x4b2010);}return _0x10fdf4['save']();};}function saveUpdates(_0x12012c,_0x2c0449){return function(_0x58e1e3){if(_0x58e1e3){return _0x58e1e3[_0x3a1c('0x20')](_0x12012c)[_0x3a1c('0x21')](function(_0x548ddd){return _0x548ddd;});}return null;};}function removeEntity(_0x157b1f,_0x548d7e){return function(_0x1fc851){if(_0x1fc851){return _0x1fc851[_0x3a1c('0x22')]()[_0x3a1c('0x21')](function(){_0x157b1f[_0x3a1c('0x16')](0xcc)[_0x3a1c('0x17')]();});}};}function handleEntityNotFound(_0x29aae7,_0x19ea33){return function(_0x4cf4d0){if(!_0x4cf4d0){_0x29aae7[_0x3a1c('0x15')](0x194);}return _0x4cf4d0;};}function handleError(_0x1a9721,_0x161ce5){_0x161ce5=_0x161ce5||0x1f4;return function(_0x5f30c6){logger[_0x3a1c('0x23')](_0x5f30c6[_0x3a1c('0x24')]);if(_0x5f30c6[_0x3a1c('0x25')]){delete _0x5f30c6[_0x3a1c('0x25')];}_0x1a9721[_0x3a1c('0x16')](_0x161ce5)[_0x3a1c('0x26')](_0x5f30c6);};}exports[_0x3a1c('0x27')]=function(_0x1132e0,_0x51fef6){var _0x2002a6={},_0x54958f={},_0x58650c={'count':0x0,'rows':[]};var _0x5e7412=_['map'](db[_0x3a1c('0x28')][_0x3a1c('0x29')],function(_0xd70df5){return{'name':_0xd70df5[_0x3a1c('0x2a')],'type':_0xd70df5['type'][_0x3a1c('0x2b')]};});_0x54958f['model']=_['map'](_0x5e7412,_0x3a1c('0x25'));_0x54958f[_0x3a1c('0x2c')]=_[_0x3a1c('0x2d')](_0x1132e0[_0x3a1c('0x2c')]);_0x54958f[_0x3a1c('0x2e')]=_[_0x3a1c('0x2f')](_0x54958f[_0x3a1c('0x30')],_0x54958f[_0x3a1c('0x2c')]);_0x2002a6[_0x3a1c('0x31')]=_[_0x3a1c('0x2f')](_0x54958f['model'],qs[_0x3a1c('0x32')](_0x1132e0[_0x3a1c('0x2c')]['fields']));_0x2002a6[_0x3a1c('0x31')]=_0x2002a6['attributes'][_0x3a1c('0x33')]?_0x2002a6[_0x3a1c('0x31')]:_0x54958f[_0x3a1c('0x30')];if(!_0x1132e0[_0x3a1c('0x2c')][_0x3a1c('0x34')](_0x3a1c('0x35'))){_0x2002a6[_0x3a1c('0x1b')]=qs[_0x3a1c('0x1b')](_0x1132e0['query']['limit']);_0x2002a6[_0x3a1c('0x19')]=qs[_0x3a1c('0x19')](_0x1132e0[_0x3a1c('0x2c')][_0x3a1c('0x19')]);}_0x2002a6['order']=qs['sort'](_0x1132e0[_0x3a1c('0x2c')]['sort']);_0x2002a6[_0x3a1c('0x36')]=qs['filters'](_[_0x3a1c('0x37')](_0x1132e0['query'],_0x54958f['filters']),_0x5e7412);if(_0x1132e0[_0x3a1c('0x2c')][_0x3a1c('0x38')]){_0x2002a6[_0x3a1c('0x36')]=_['merge'](_0x2002a6[_0x3a1c('0x36')],{'$or':_['map'](_0x5e7412,function(_0x76de32){if(_0x76de32[_0x3a1c('0x39')]!=='VIRTUAL'){var _0x322dc2={};_0x322dc2[_0x76de32[_0x3a1c('0x25')]]={'$like':'%'+_0x1132e0['query']['filter']+'%'};return _0x322dc2;}})});}_0x2002a6=_[_0x3a1c('0x3a')]({},_0x2002a6,_0x1132e0[_0x3a1c('0x3b')]);var _0x211aa1={'where':_0x2002a6['where']};return db[_0x3a1c('0x28')]['count'](_0x211aa1)[_0x3a1c('0x21')](function(_0xa80a79){_0x58650c[_0x3a1c('0x1c')]=_0xa80a79;if(_0x1132e0['query'][_0x3a1c('0x3c')]){_0x2002a6[_0x3a1c('0x3d')]=[{'all':!![]}];}return db['VtigerAccount'][_0x3a1c('0x3e')](_0x2002a6);})['then'](function(_0x8f49a6){_0x58650c[_0x3a1c('0x3f')]=_0x8f49a6;return _0x58650c;})[_0x3a1c('0x21')](respondWithFilteredResult(_0x51fef6,_0x2002a6))[_0x3a1c('0x40')](handleError(_0x51fef6,null));};exports['show']=function(_0x34e46d,_0x20775e){var _0x1615fb={'raw':![],'where':{'id':_0x34e46d['params']['id']}},_0x189735={};_0x189735['model']=_[_0x3a1c('0x2d')](db[_0x3a1c('0x28')]['rawAttributes']);_0x189735[_0x3a1c('0x2c')]=_[_0x3a1c('0x2d')](_0x34e46d['query']);_0x189735[_0x3a1c('0x2e')]=_[_0x3a1c('0x2f')](_0x189735[_0x3a1c('0x30')],_0x189735[_0x3a1c('0x2c')]);_0x1615fb['attributes']=_[_0x3a1c('0x2f')](_0x189735['model'],qs[_0x3a1c('0x32')](_0x34e46d['query'][_0x3a1c('0x32')]));_0x1615fb[_0x3a1c('0x31')]=_0x1615fb['attributes'][_0x3a1c('0x33')]?_0x1615fb[_0x3a1c('0x31')]:_0x189735[_0x3a1c('0x30')];if(_0x34e46d[_0x3a1c('0x2c')][_0x3a1c('0x3c')]){_0x1615fb['include']=[{'all':!![]}];}_0x1615fb=_['merge']({},_0x1615fb,_0x34e46d[_0x3a1c('0x3b')]);return db[_0x3a1c('0x28')][_0x3a1c('0x41')](_0x1615fb)['then'](handleEntityNotFound(_0x20775e,null))[_0x3a1c('0x21')](respondWithResult(_0x20775e,null))[_0x3a1c('0x40')](handleError(_0x20775e,null));};exports[_0x3a1c('0x42')]=function(_0x229f62,_0x2b19da){return db['VtigerAccount'][_0x3a1c('0x42')](_0x229f62[_0x3a1c('0x43')],{})['then'](respondWithResult(_0x2b19da,0xc9))[_0x3a1c('0x40')](handleError(_0x2b19da,null));};exports[_0x3a1c('0x20')]=function(_0x58b400,_0x382e8f){if(_0x58b400[_0x3a1c('0x43')]['id']){delete _0x58b400[_0x3a1c('0x43')]['id'];}return db[_0x3a1c('0x28')]['find']({'where':{'id':_0x58b400[_0x3a1c('0x44')]['id']}})[_0x3a1c('0x21')](handleEntityNotFound(_0x382e8f,null))[_0x3a1c('0x21')](saveUpdates(_0x58b400['body'],null))[_0x3a1c('0x21')](respondWithResult(_0x382e8f,null))[_0x3a1c('0x40')](handleError(_0x382e8f,null));};exports[_0x3a1c('0x22')]=function(_0x14353a,_0x454554){return db['VtigerAccount']['find']({'where':{'id':_0x14353a[_0x3a1c('0x44')]['id']}})[_0x3a1c('0x21')](handleEntityNotFound(_0x454554,null))[_0x3a1c('0x21')](removeEntity(_0x454554,null))[_0x3a1c('0x40')](handleError(_0x454554,null));};exports[_0x3a1c('0x45')]=function(_0x15851d,_0x4a56ba,_0x43c7b7){var _0x5be5d4={};var _0x4053e2={};var _0x30a77a;var _0x40a08b;return db[_0x3a1c('0x28')][_0x3a1c('0x46')]({'where':{'id':_0x15851d[_0x3a1c('0x44')]['id']}})[_0x3a1c('0x21')](handleEntityNotFound(_0x4a56ba,null))[_0x3a1c('0x21')](function(_0x39eb9c){if(_0x39eb9c){_0x30a77a=_0x39eb9c;_0x4053e2[_0x3a1c('0x30')]=_[_0x3a1c('0x2d')](db[_0x3a1c('0x47')][_0x3a1c('0x29')]);_0x4053e2['query']=_[_0x3a1c('0x2d')](_0x15851d['query']);_0x4053e2[_0x3a1c('0x2e')]=_[_0x3a1c('0x2f')](_0x4053e2[_0x3a1c('0x30')],_0x4053e2[_0x3a1c('0x2c')]);_0x5be5d4[_0x3a1c('0x31')]=_['intersection'](_0x4053e2[_0x3a1c('0x30')],qs[_0x3a1c('0x32')](_0x15851d[_0x3a1c('0x2c')][_0x3a1c('0x32')]));_0x5be5d4['attributes']=_0x5be5d4[_0x3a1c('0x31')][_0x3a1c('0x33')]?_0x5be5d4[_0x3a1c('0x31')]:_0x4053e2[_0x3a1c('0x30')];_0x5be5d4['order']=qs[_0x3a1c('0x48')](_0x15851d['query'][_0x3a1c('0x48')]);_0x5be5d4[_0x3a1c('0x36')]=qs[_0x3a1c('0x2e')](_['pick'](_0x15851d[_0x3a1c('0x2c')],_0x4053e2['filters']));if(_0x15851d[_0x3a1c('0x2c')]['filter']){_0x5be5d4[_0x3a1c('0x36')]=_[_0x3a1c('0x3a')](_0x5be5d4['where'],{'$or':_[_0x3a1c('0x49')](_0x5be5d4[_0x3a1c('0x31')],function(_0x338a8f){var _0x209d5f={};_0x209d5f[_0x338a8f]={'$like':'%'+_0x15851d[_0x3a1c('0x2c')][_0x3a1c('0x38')]+'%'};return _0x209d5f;})});}_0x5be5d4=_[_0x3a1c('0x3a')]({},_0x5be5d4,_0x15851d[_0x3a1c('0x3b')]);return _0x30a77a[_0x3a1c('0x45')](_0x5be5d4);}})['then'](function(_0x2c2e72){if(_0x2c2e72){_0x40a08b=_0x2c2e72['length'];if(!_0x15851d[_0x3a1c('0x2c')][_0x3a1c('0x34')](_0x3a1c('0x35'))){_0x5be5d4[_0x3a1c('0x1b')]=qs[_0x3a1c('0x1b')](_0x15851d[_0x3a1c('0x2c')][_0x3a1c('0x1b')]);_0x5be5d4[_0x3a1c('0x19')]=qs[_0x3a1c('0x19')](_0x15851d[_0x3a1c('0x2c')][_0x3a1c('0x19')]);}return _0x30a77a[_0x3a1c('0x45')](_0x5be5d4);}})[_0x3a1c('0x21')](function(_0x573e46){if(_0x573e46){return _0x573e46?{'count':_0x40a08b,'rows':_0x573e46}:null;}})[_0x3a1c('0x21')](respondWithResult(_0x4a56ba,null))[_0x3a1c('0x40')](handleError(_0x4a56ba,null));};exports['addConfiguration']=function(_0x1de0e0,_0x2257df,_0x1dd885){if(_0x1de0e0[_0x3a1c('0x43')]['id']){delete _0x1de0e0[_0x3a1c('0x43')]['id'];}return db[_0x3a1c('0x28')][_0x3a1c('0x46')]({'where':{'id':_0x1de0e0[_0x3a1c('0x44')]['id']}})[_0x3a1c('0x21')](handleEntityNotFound(_0x2257df,null))['then'](function(_0x2bd5cb){if(_0x2bd5cb){_0x1de0e0[_0x3a1c('0x43')][_0x3a1c('0x4a')]=_0x2bd5cb['id'];_0x1de0e0[_0x3a1c('0x43')][_0x3a1c('0x4b')]=integrations[_0x3a1c('0x4c')](_0x1de0e0[_0x3a1c('0x43')][_0x3a1c('0x4d')],_0x1de0e0[_0x3a1c('0x43')][_0x3a1c('0x39')]);_0x1de0e0[_0x3a1c('0x43')][_0x3a1c('0x4e')]=integrations[_0x3a1c('0x4f')](_0x1de0e0[_0x3a1c('0x43')][_0x3a1c('0x4d')],_0x1de0e0['body'][_0x3a1c('0x39')]);return db[_0x3a1c('0x47')][_0x3a1c('0x42')](_0x1de0e0[_0x3a1c('0x43')],{'include':[{'model':db[_0x3a1c('0x50')],'as':_0x3a1c('0x4b')},{'model':db[_0x3a1c('0x50')],'as':_0x3a1c('0x4e')}]});}return null;})[_0x3a1c('0x21')](respondWithResult(_0x2257df,null))[_0x3a1c('0x40')](handleError(_0x2257df,null));};var md5=require(_0x3a1c('0x51'));exports[_0x3a1c('0x52')]=function(_0x4edfa8,_0x59ead5,_0x1dfb83){var _0x52086f=null;var _0x56a6aa=null;var _0x548404=null;var _0x41dbc1=null;var _0x32036a='';return db[_0x3a1c('0x28')][_0x3a1c('0x46')]({'where':{'id':_0x4edfa8[_0x3a1c('0x44')]['id']},'attributes':['id',_0x3a1c('0x25'),_0x3a1c('0x53'),_0x3a1c('0x54'),_0x3a1c('0x55'),_0x3a1c('0x56'),_0x3a1c('0x57'),_0x3a1c('0x58')]})[_0x3a1c('0x21')](handleEntityNotFound(_0x59ead5,null))[_0x3a1c('0x21')](function(_0x20e0d4){if(_0x20e0d4){_0x52086f=_0x20e0d4[_0x3a1c('0x53')];_0x56a6aa=_0x20e0d4[_0x3a1c('0x58')];_0x548404=_0x20e0d4[_0x3a1c('0x55')];_0x32036a=_0x20e0d4[_0x3a1c('0x56')];var _0xc578d9=_0x32036a[_0x3a1c('0x59')](-0x1);if(_0xc578d9==='/'){_0x32036a=_0x32036a[_0x3a1c('0x5a')](0x0,_0x32036a[_0x3a1c('0x5b')](_0xc578d9));}_0x41dbc1=util['format']('%s/webservice.php',_0x32036a);var _0x257ed7={'method':_0x3a1c('0x5c'),'uri':_0x41dbc1,'qs':{'operation':_0x3a1c('0x5d'),'username':_0x20e0d4['username']},'json':!![]};return rp(_0x257ed7);}})[_0x3a1c('0x21')](function(_0x2fde14){if(_0x2fde14[_0x3a1c('0x5e')]){var _0x15e9ef={'method':_0x3a1c('0x5f'),'uri':_0x41dbc1,'form':{'operation':_0x3a1c('0x60'),'username':_0x52086f,'accessKey':md5(_0x2fde14[_0x3a1c('0x61')][_0x3a1c('0x62')]+_0x56a6aa)},'json':!![]};return rp(_0x15e9ef);}})[_0x3a1c('0x21')](function(_0x16eddf){if(_0x16eddf[_0x3a1c('0x5e')]){var _0xb5151c={'method':'GET','uri':_0x41dbc1,'qs':{'operation':_0x3a1c('0x63'),'username':_0x52086f,'sessionName':_0x16eddf[_0x3a1c('0x61')][_0x3a1c('0x64')],'elementType':_0x548404},'json':!![]};return rp(_0xb5151c);}})[_0x3a1c('0x21')](function(_0x11fd02){if(_0x11fd02[_0x3a1c('0x5e')]){var _0x397b08=[_0x3a1c('0x65'),_0x3a1c('0x66'),'owner'];_['remove'](_0x11fd02[_0x3a1c('0x61')][_0x3a1c('0x32')],function(_0x404560){return _0x397b08['includes'](_0x404560[_0x3a1c('0x39')][_0x3a1c('0x25')]);});_['remove'](_0x11fd02[_0x3a1c('0x61')][_0x3a1c('0x32')],function(_0x3903a8){return _0x3903a8[_0x3a1c('0x67')]===_0x3a1c('0x68');});return{'count':_0x11fd02[_0x3a1c('0x61')][_0x3a1c('0x32')]['length'],'rows':_[_0x3a1c('0x49')](_0x11fd02[_0x3a1c('0x61')]['fields'],function(_0x8a1e6d){return{'id':_0x8a1e6d['name'],'name':_0x8a1e6d['label'],'custom':_[_0x3a1c('0x69')](_0x8a1e6d[_0x3a1c('0x25')],_0x3a1c('0x6a'))?!![]:![],'options':_0x8a1e6d[_0x3a1c('0x39')][_0x3a1c('0x25')]===_0x3a1c('0x6b')&&_0x8a1e6d[_0x3a1c('0x39')][_0x3a1c('0x6c')][_0x3a1c('0x33')]>0x0?_['map'](_0x8a1e6d[_0x3a1c('0x39')][_0x3a1c('0x6c')],function(_0x25cca1){return{'name':_0x25cca1[_0x3a1c('0x6d')],'value':_0x25cca1[_0x3a1c('0x6e')]};}):[]};})};}})[_0x3a1c('0x21')](respondWithResult(_0x59ead5,null))[_0x3a1c('0x40')](function(_0x313d0c){console[_0x3a1c('0x6f')](_0x3a1c('0x70')+_0x313d0c);var _0x4bec32=_0x4edfa8[_0x3a1c('0x2c')][_0x3a1c('0x71')]?0x1f4:_0x313d0c['statusCode']||0x1f4;logger['error'](_0x3a1c('0x72'),_0x3a1c('0x52'),_0x4bec32,JSON[_0x3a1c('0x73')](_0x313d0c));delete _0x313d0c[_0x3a1c('0x25')];if(_0x4bec32===0x191){_0x4bec32=0x190;}_0x59ead5['status'](_0x4bec32)['send'](_0x4edfa8['query'][_0x3a1c('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x313d0c['statusCode']}:_0x313d0c);});}; \ No newline at end of file +var _0x5d20=['count','set','apply','reject','save','then','destroy','end','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','options','includeAll','include','rows','catch','show','params','merge','find','create','body','VtigerConfiguration','order','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','getDescriptions','VtigerField','Subjects','Descriptions','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','result','token','success','describe','autogenerated','reference','remove','editable','false','startsWith','cf_','picklistValues','value','log','vTiger\x20error:\x20','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit'];(function(_0x40648d,_0x5ddbcf){var _0x521402=function(_0x376f3c){while(--_0x376f3c){_0x40648d['push'](_0x40648d['shift']());}};_0x521402(++_0x5ddbcf);}(_0x5d20,0xcf));var _0x05d2=function(_0x1152c9,_0x1dd7d1){_0x1152c9=_0x1152c9-0x0;var _0x3d2583=_0x5d20[_0x1152c9];return _0x3d2583;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x05d2('0x0'));var jsonpatch=require(_0x05d2('0x1'));var rp=require(_0x05d2('0x2'));var moment=require(_0x05d2('0x3'));var BPromise=require(_0x05d2('0x4'));var Mustache=require(_0x05d2('0x5'));var util=require(_0x05d2('0x6'));var path=require(_0x05d2('0x7'));var sox=require(_0x05d2('0x8'));var csv=require('to-csv');var ejs=require(_0x05d2('0x9'));var fs=require('fs');var fs_extra=require(_0x05d2('0xa'));var _=require('lodash');var squel=require(_0x05d2('0xb'));var crypto=require(_0x05d2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x05d2('0xd'));var toCsv=require('to-csv');var querystring=require(_0x05d2('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x05d2('0xf'));var qs=require(_0x05d2('0x10'));var as=require(_0x05d2('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x05d2('0x12'))(_0x05d2('0x13'));var utils=require(_0x05d2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x05d2('0x15'));var db=require(_0x05d2('0x16'))['db'];var integrations=require(_0x05d2('0x17'));function respondWithStatusCode(_0x3e39bc,_0x2efd64){_0x2efd64=_0x2efd64||0xcc;return function(_0x56b7dd){if(_0x56b7dd){return _0x3e39bc['sendStatus'](_0x2efd64);}return _0x3e39bc['status'](_0x2efd64)['end']();};}function respondWithResult(_0x176f80,_0x37b7fe){_0x37b7fe=_0x37b7fe||0xc8;return function(_0x37e285){if(_0x37e285){return _0x176f80[_0x05d2('0x18')](_0x37b7fe)[_0x05d2('0x19')](_0x37e285);}};}function respondWithFilteredResult(_0x588ab1,_0x223fa6){return function(_0x36f40e){if(_0x36f40e){var _0x529d6e=typeof _0x223fa6[_0x05d2('0x1a')]===_0x05d2('0x1b')&&typeof _0x223fa6[_0x05d2('0x1c')]===_0x05d2('0x1b');var _0x4805c2=_0x36f40e[_0x05d2('0x1d')];var _0x4d48e4=_0x529d6e?0x0:_0x223fa6[_0x05d2('0x1a')];var _0x566ba6=_0x529d6e?_0x36f40e['count']:_0x223fa6[_0x05d2('0x1a')]+_0x223fa6[_0x05d2('0x1c')];var _0x21bb4b;if(_0x566ba6>=_0x4805c2){_0x566ba6=_0x4805c2;_0x21bb4b=0xc8;}else{_0x21bb4b=0xce;}_0x588ab1[_0x05d2('0x18')](_0x21bb4b);return _0x588ab1[_0x05d2('0x1e')]('Content-Range',_0x4d48e4+'-'+_0x566ba6+'/'+_0x4805c2)[_0x05d2('0x19')](_0x36f40e);}return null;};}function patchUpdates(_0x12a5a4){return function(_0x22ff60){try{jsonpatch[_0x05d2('0x1f')](_0x22ff60,_0x12a5a4,!![]);}catch(_0x112d7b){return BPromise[_0x05d2('0x20')](_0x112d7b);}return _0x22ff60[_0x05d2('0x21')]();};}function saveUpdates(_0x11377f,_0x5ac6a4){return function(_0x4d45e1){if(_0x4d45e1){return _0x4d45e1['update'](_0x11377f)[_0x05d2('0x22')](function(_0x457191){return _0x457191;});}return null;};}function removeEntity(_0x47b958,_0x3fa9f2){return function(_0x3949e7){if(_0x3949e7){return _0x3949e7[_0x05d2('0x23')]()[_0x05d2('0x22')](function(){_0x47b958[_0x05d2('0x18')](0xcc)[_0x05d2('0x24')]();});}};}function handleEntityNotFound(_0xa7a4d9,_0x26300e){return function(_0x15609b){if(!_0x15609b){_0xa7a4d9['sendStatus'](0x194);}return _0x15609b;};}function handleError(_0x1d28ab,_0x574634){_0x574634=_0x574634||0x1f4;return function(_0x461449){logger['error'](_0x461449[_0x05d2('0x25')]);if(_0x461449[_0x05d2('0x26')]){delete _0x461449[_0x05d2('0x26')];}_0x1d28ab['status'](_0x574634)[_0x05d2('0x27')](_0x461449);};}exports[_0x05d2('0x28')]=function(_0x988b4b,_0x4d7da9){var _0x2b9a69={},_0x29fbcf={},_0x2040e9={'count':0x0,'rows':[]};var _0x9150b2=_['map'](db[_0x05d2('0x29')][_0x05d2('0x2a')],function(_0x23c624){return{'name':_0x23c624[_0x05d2('0x2b')],'type':_0x23c624[_0x05d2('0x2c')]['key']};});_0x29fbcf[_0x05d2('0x2d')]=_[_0x05d2('0x2e')](_0x9150b2,_0x05d2('0x26'));_0x29fbcf[_0x05d2('0x2f')]=_[_0x05d2('0x30')](_0x988b4b[_0x05d2('0x2f')]);_0x29fbcf[_0x05d2('0x31')]=_[_0x05d2('0x32')](_0x29fbcf['model'],_0x29fbcf[_0x05d2('0x2f')]);_0x2b9a69[_0x05d2('0x33')]=_['intersection'](_0x29fbcf[_0x05d2('0x2d')],qs['fields'](_0x988b4b[_0x05d2('0x2f')][_0x05d2('0x34')]));_0x2b9a69[_0x05d2('0x33')]=_0x2b9a69[_0x05d2('0x33')][_0x05d2('0x35')]?_0x2b9a69[_0x05d2('0x33')]:_0x29fbcf[_0x05d2('0x2d')];if(!_0x988b4b[_0x05d2('0x2f')]['hasOwnProperty'](_0x05d2('0x36'))){_0x2b9a69[_0x05d2('0x1c')]=qs[_0x05d2('0x1c')](_0x988b4b['query'][_0x05d2('0x1c')]);_0x2b9a69[_0x05d2('0x1a')]=qs['offset'](_0x988b4b[_0x05d2('0x2f')][_0x05d2('0x1a')]);}_0x2b9a69['order']=qs[_0x05d2('0x37')](_0x988b4b['query'][_0x05d2('0x37')]);_0x2b9a69[_0x05d2('0x38')]=qs[_0x05d2('0x31')](_[_0x05d2('0x39')](_0x988b4b['query'],_0x29fbcf[_0x05d2('0x31')]),_0x9150b2);if(_0x988b4b[_0x05d2('0x2f')]['filter']){_0x2b9a69[_0x05d2('0x38')]=_['merge'](_0x2b9a69[_0x05d2('0x38')],{'$or':_[_0x05d2('0x2e')](_0x9150b2,function(_0x2dd030){if(_0x2dd030[_0x05d2('0x2c')]!=='VIRTUAL'){var _0x4691b5={};_0x4691b5[_0x2dd030['name']]={'$like':'%'+_0x988b4b[_0x05d2('0x2f')][_0x05d2('0x3a')]+'%'};return _0x4691b5;}})});}_0x2b9a69=_['merge']({},_0x2b9a69,_0x988b4b[_0x05d2('0x3b')]);var _0x573235={'where':_0x2b9a69[_0x05d2('0x38')]};return db['VtigerAccount'][_0x05d2('0x1d')](_0x573235)[_0x05d2('0x22')](function(_0x3afe05){_0x2040e9[_0x05d2('0x1d')]=_0x3afe05;if(_0x988b4b[_0x05d2('0x2f')][_0x05d2('0x3c')]){_0x2b9a69[_0x05d2('0x3d')]=[{'all':!![]}];}return db[_0x05d2('0x29')]['findAll'](_0x2b9a69);})[_0x05d2('0x22')](function(_0x29a3e8){_0x2040e9[_0x05d2('0x3e')]=_0x29a3e8;return _0x2040e9;})[_0x05d2('0x22')](respondWithFilteredResult(_0x4d7da9,_0x2b9a69))[_0x05d2('0x3f')](handleError(_0x4d7da9,null));};exports[_0x05d2('0x40')]=function(_0x179637,_0x12d178){var _0x279622={'raw':![],'where':{'id':_0x179637[_0x05d2('0x41')]['id']}},_0x28eba5={};_0x28eba5[_0x05d2('0x2d')]=_[_0x05d2('0x30')](db[_0x05d2('0x29')][_0x05d2('0x2a')]);_0x28eba5[_0x05d2('0x2f')]=_[_0x05d2('0x30')](_0x179637[_0x05d2('0x2f')]);_0x28eba5[_0x05d2('0x31')]=_[_0x05d2('0x32')](_0x28eba5[_0x05d2('0x2d')],_0x28eba5['query']);_0x279622[_0x05d2('0x33')]=_[_0x05d2('0x32')](_0x28eba5[_0x05d2('0x2d')],qs['fields'](_0x179637[_0x05d2('0x2f')]['fields']));_0x279622['attributes']=_0x279622[_0x05d2('0x33')]['length']?_0x279622[_0x05d2('0x33')]:_0x28eba5[_0x05d2('0x2d')];if(_0x179637[_0x05d2('0x2f')][_0x05d2('0x3c')]){_0x279622['include']=[{'all':!![]}];}_0x279622=_[_0x05d2('0x42')]({},_0x279622,_0x179637[_0x05d2('0x3b')]);return db[_0x05d2('0x29')][_0x05d2('0x43')](_0x279622)[_0x05d2('0x22')](handleEntityNotFound(_0x12d178,null))[_0x05d2('0x22')](respondWithResult(_0x12d178,null))[_0x05d2('0x3f')](handleError(_0x12d178,null));};exports['create']=function(_0x3336f0,_0x6bd5e2){return db[_0x05d2('0x29')][_0x05d2('0x44')](_0x3336f0['body'],{})[_0x05d2('0x22')](respondWithResult(_0x6bd5e2,0xc9))[_0x05d2('0x3f')](handleError(_0x6bd5e2,null));};exports['update']=function(_0x35471b,_0x3bc3eb){if(_0x35471b['body']['id']){delete _0x35471b['body']['id'];}return db[_0x05d2('0x29')][_0x05d2('0x43')]({'where':{'id':_0x35471b[_0x05d2('0x41')]['id']}})[_0x05d2('0x22')](handleEntityNotFound(_0x3bc3eb,null))[_0x05d2('0x22')](saveUpdates(_0x35471b[_0x05d2('0x45')],null))[_0x05d2('0x22')](respondWithResult(_0x3bc3eb,null))[_0x05d2('0x3f')](handleError(_0x3bc3eb,null));};exports['destroy']=function(_0x325c60,_0x224bff){return db[_0x05d2('0x29')][_0x05d2('0x43')]({'where':{'id':_0x325c60[_0x05d2('0x41')]['id']}})[_0x05d2('0x22')](handleEntityNotFound(_0x224bff,null))[_0x05d2('0x22')](removeEntity(_0x224bff,null))['catch'](handleError(_0x224bff,null));};exports['getConfigurations']=function(_0x2a0273,_0x363c50,_0x18b540){var _0x58a713={};var _0x4aae6a={};var _0x3bc2fe;var _0x44c175;return db[_0x05d2('0x29')]['findOne']({'where':{'id':_0x2a0273[_0x05d2('0x41')]['id']}})[_0x05d2('0x22')](handleEntityNotFound(_0x363c50,null))[_0x05d2('0x22')](function(_0x262960){if(_0x262960){_0x3bc2fe=_0x262960;_0x4aae6a['model']=_[_0x05d2('0x30')](db[_0x05d2('0x46')][_0x05d2('0x2a')]);_0x4aae6a[_0x05d2('0x2f')]=_[_0x05d2('0x30')](_0x2a0273['query']);_0x4aae6a[_0x05d2('0x31')]=_['intersection'](_0x4aae6a[_0x05d2('0x2d')],_0x4aae6a[_0x05d2('0x2f')]);_0x58a713[_0x05d2('0x33')]=_[_0x05d2('0x32')](_0x4aae6a[_0x05d2('0x2d')],qs[_0x05d2('0x34')](_0x2a0273[_0x05d2('0x2f')][_0x05d2('0x34')]));_0x58a713[_0x05d2('0x33')]=_0x58a713['attributes']['length']?_0x58a713['attributes']:_0x4aae6a[_0x05d2('0x2d')];_0x58a713[_0x05d2('0x47')]=qs[_0x05d2('0x37')](_0x2a0273[_0x05d2('0x2f')]['sort']);_0x58a713[_0x05d2('0x38')]=qs[_0x05d2('0x31')](_['pick'](_0x2a0273['query'],_0x4aae6a[_0x05d2('0x31')]));if(_0x2a0273[_0x05d2('0x2f')][_0x05d2('0x3a')]){_0x58a713[_0x05d2('0x38')]=_[_0x05d2('0x42')](_0x58a713['where'],{'$or':_[_0x05d2('0x2e')](_0x58a713[_0x05d2('0x33')],function(_0x1f58ff){var _0x4d179f={};_0x4d179f[_0x1f58ff]={'$like':'%'+_0x2a0273['query'][_0x05d2('0x3a')]+'%'};return _0x4d179f;})});}_0x58a713=_[_0x05d2('0x42')]({},_0x58a713,_0x2a0273[_0x05d2('0x3b')]);return _0x3bc2fe[_0x05d2('0x48')](_0x58a713);}})[_0x05d2('0x22')](function(_0x1ea498){if(_0x1ea498){_0x44c175=_0x1ea498[_0x05d2('0x35')];if(!_0x2a0273[_0x05d2('0x2f')]['hasOwnProperty']('nolimit')){_0x58a713[_0x05d2('0x1c')]=qs[_0x05d2('0x1c')](_0x2a0273[_0x05d2('0x2f')]['limit']);_0x58a713[_0x05d2('0x1a')]=qs[_0x05d2('0x1a')](_0x2a0273[_0x05d2('0x2f')][_0x05d2('0x1a')]);}return _0x3bc2fe['getConfigurations'](_0x58a713);}})['then'](function(_0x32bf04){if(_0x32bf04){return _0x32bf04?{'count':_0x44c175,'rows':_0x32bf04}:null;}})[_0x05d2('0x22')](respondWithResult(_0x363c50,null))[_0x05d2('0x3f')](handleError(_0x363c50,null));};exports[_0x05d2('0x49')]=function(_0x802827,_0x24f6f4,_0x4bf5b9){if(_0x802827[_0x05d2('0x45')]['id']){delete _0x802827[_0x05d2('0x45')]['id'];}return db[_0x05d2('0x29')][_0x05d2('0x4a')]({'where':{'id':_0x802827['params']['id']}})[_0x05d2('0x22')](handleEntityNotFound(_0x24f6f4,null))[_0x05d2('0x22')](function(_0x480e20){if(_0x480e20){_0x802827['body'][_0x05d2('0x4b')]=_0x480e20['id'];_0x802827[_0x05d2('0x45')]['Subjects']=integrations[_0x05d2('0x4c')](_0x802827[_0x05d2('0x45')]['channel'],_0x802827['body'][_0x05d2('0x2c')]);_0x802827[_0x05d2('0x45')]['Descriptions']=integrations[_0x05d2('0x4d')](_0x802827[_0x05d2('0x45')]['channel'],_0x802827[_0x05d2('0x45')][_0x05d2('0x2c')]);return db[_0x05d2('0x46')][_0x05d2('0x44')](_0x802827[_0x05d2('0x45')],{'include':[{'model':db[_0x05d2('0x4e')],'as':_0x05d2('0x4f')},{'model':db[_0x05d2('0x4e')],'as':_0x05d2('0x50')}]});}return null;})[_0x05d2('0x22')](respondWithResult(_0x24f6f4,null))[_0x05d2('0x3f')](handleError(_0x24f6f4,null));};var md5=require('md5');exports[_0x05d2('0x51')]=function(_0x2379d5,_0xc77194,_0x2f3153){var _0x18f8c1=null;var _0x10208d=null;var _0x4adee6=null;var _0xfa3a42=null;var _0x56285d='';return db[_0x05d2('0x29')]['findOne']({'where':{'id':_0x2379d5[_0x05d2('0x41')]['id']},'attributes':['id',_0x05d2('0x26'),'username',_0x05d2('0x52'),_0x05d2('0x53'),_0x05d2('0x54'),_0x05d2('0x55'),_0x05d2('0x56')]})[_0x05d2('0x22')](handleEntityNotFound(_0xc77194,null))[_0x05d2('0x22')](function(_0x4ee0ec){if(_0x4ee0ec){_0x18f8c1=_0x4ee0ec[_0x05d2('0x57')];_0x10208d=_0x4ee0ec[_0x05d2('0x56')];_0x4adee6=_0x4ee0ec['moduleName'];_0x56285d=_0x4ee0ec[_0x05d2('0x54')];var _0xbe4cb5=_0x56285d[_0x05d2('0x58')](-0x1);if(_0xbe4cb5==='/'){_0x56285d=_0x56285d[_0x05d2('0x59')](0x0,_0x56285d[_0x05d2('0x5a')](_0xbe4cb5));}_0xfa3a42=util[_0x05d2('0x5b')](_0x05d2('0x5c'),_0x56285d);var _0x61a88={'method':_0x05d2('0x5d'),'uri':_0xfa3a42,'qs':{'operation':_0x05d2('0x5e'),'username':_0x4ee0ec['username']},'json':!![]};return rp(_0x61a88);}})[_0x05d2('0x22')](function(_0x45a21b){if(_0x45a21b['success']){var _0x2d07e6={'method':_0x05d2('0x5f'),'uri':_0xfa3a42,'form':{'operation':_0x05d2('0x60'),'username':_0x18f8c1,'accessKey':md5(_0x45a21b[_0x05d2('0x61')][_0x05d2('0x62')]+_0x10208d)},'json':!![]};return rp(_0x2d07e6);}})[_0x05d2('0x22')](function(_0x482607){if(_0x482607[_0x05d2('0x63')]){var _0x3cd9df={'method':_0x05d2('0x5d'),'uri':_0xfa3a42,'qs':{'operation':_0x05d2('0x64'),'username':_0x18f8c1,'sessionName':_0x482607[_0x05d2('0x61')]['sessionName'],'elementType':_0x4adee6},'json':!![]};return rp(_0x3cd9df);}})['then'](function(_0xded116){if(_0xded116[_0x05d2('0x63')]){var _0x2cf4d9=[_0x05d2('0x65'),_0x05d2('0x66'),'owner'];_[_0x05d2('0x67')](_0xded116[_0x05d2('0x61')]['fields'],function(_0x5430d2){return _0x2cf4d9['includes'](_0x5430d2[_0x05d2('0x2c')][_0x05d2('0x26')]);});_['remove'](_0xded116[_0x05d2('0x61')][_0x05d2('0x34')],function(_0x2977e3){return _0x2977e3[_0x05d2('0x68')]===_0x05d2('0x69');});return{'count':_0xded116['result'][_0x05d2('0x34')][_0x05d2('0x35')],'rows':_[_0x05d2('0x2e')](_0xded116[_0x05d2('0x61')]['fields'],function(_0x21d4cf){return{'id':_0x21d4cf[_0x05d2('0x26')],'name':_0x21d4cf['label'],'custom':_[_0x05d2('0x6a')](_0x21d4cf[_0x05d2('0x26')],_0x05d2('0x6b'))?!![]:![],'options':_0x21d4cf[_0x05d2('0x2c')][_0x05d2('0x26')]==='picklist'&&_0x21d4cf[_0x05d2('0x2c')][_0x05d2('0x6c')][_0x05d2('0x35')]>0x0?_[_0x05d2('0x2e')](_0x21d4cf['type'][_0x05d2('0x6c')],function(_0x463409){return{'name':_0x463409['label'],'value':_0x463409[_0x05d2('0x6d')]};}):[]};})};}})['then'](respondWithResult(_0xc77194,null))[_0x05d2('0x3f')](function(_0x4b1587){console[_0x05d2('0x6e')](_0x05d2('0x6f')+_0x4b1587);var _0x1bd75e=_0x2379d5[_0x05d2('0x2f')]['test']?0x1f4:_0x4b1587[_0x05d2('0x70')]||0x1f4;logger[_0x05d2('0x71')](_0x05d2('0x72'),'getFields',_0x1bd75e,JSON[_0x05d2('0x73')](_0x4b1587));delete _0x4b1587[_0x05d2('0x26')];if(_0x1bd75e===0x191){_0x1bd75e=0x190;}_0xc77194['status'](_0x1bd75e)[_0x05d2('0x27')](_0x2379d5[_0x05d2('0x2f')][_0x05d2('0x74')]?{'message':_0x05d2('0x75'),'statusCode':_0x4b1587[_0x05d2('0x70')]}:_0x4b1587);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index a956578..0c371fd 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 _0xcdac=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger','moment'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xcdac,0x6c));var _0xccda=function(_0x553f18,_0x5df993){_0x553f18=_0x553f18-0x0;var _0x17a25e=_0xcdac[_0x553f18];return _0x17a25e;};'use strict';var _=require(_0xccda('0x0'));var util=require(_0xccda('0x1'));var logger=require(_0xccda('0x2'))('api');var moment=require(_0xccda('0x3'));var BPromise=require('bluebird');var rp=require(_0xccda('0x4'));var fs=require('fs');var path=require(_0xccda('0x5'));var rimraf=require(_0xccda('0x6'));var config=require(_0xccda('0x7'));var attributes=require(_0xccda('0x8'));var integrations=require(_0xccda('0x9'));module[_0xccda('0xa')]=function(_0x9b25ce,_0x554525){return _0x9b25ce[_0xccda('0xb')](_0xccda('0xc'),attributes,{'tableName':_0xccda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c0=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','../../components/integrations/configuration','define','VtigerAccount'];(function(_0x108d03,_0x18a273){var _0x17326d=function(_0x4879c6){while(--_0x4879c6){_0x108d03['push'](_0x108d03['shift']());}};_0x17326d(++_0x18a273);}(_0x95c0,0x6e));var _0x095c=function(_0x4a2052,_0x295886){_0x4a2052=_0x4a2052-0x0;var _0x36bf9e=_0x95c0[_0x4a2052];return _0x36bf9e;};'use strict';var _=require(_0x095c('0x0'));var util=require(_0x095c('0x1'));var logger=require(_0x095c('0x2'))(_0x095c('0x3'));var moment=require(_0x095c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x095c('0x5'));var rimraf=require(_0x095c('0x6'));var config=require(_0x095c('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0x095c('0x8'));module['exports']=function(_0x33c1ab,_0x424ae8){return _0x33c1ab[_0x095c('0x9')](_0x095c('0xa'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 8960791..250ab76 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 _0x5c00=['where','limit','include','map','model','attributes','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw'];(function(_0x399dfd,_0xee1e3e){var _0x4ac388=function(_0x5d0689){while(--_0x5d0689){_0x399dfd['push'](_0x399dfd['shift']());}};_0x4ac388(++_0xee1e3e);}(_0x5c00,0x17e));var _0x05c0=function(_0x47c902,_0x220fd2){_0x47c902=_0x47c902-0x0;var _0x1ad6a0=_0x5c00[_0x47c902];return _0x1ad6a0;};'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')]('VtigerAccount,\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')]('VtigerAccount,\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['VtigerAccount'][_0x05c0('0x17')]({'raw':_0x521cbd[_0x05c0('0x18')]?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x19')]===undefined?!![]:![]:!![],'where':_0x521cbd[_0x05c0('0x18')]?_0x521cbd['options'][_0x05c0('0x1a')]||null:null,'attributes':_0x521cbd[_0x05c0('0x18')]?_0x521cbd['options']['attributes']||null:null,'limit':_0x521cbd['options']?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x1b')]||null:null,'include':_0x521cbd[_0x05c0('0x18')]?_0x521cbd[_0x05c0('0x18')][_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x521cbd[_0x05c0('0x18')]['include'],function(_0x9b4930){return{'model':db[_0x9b4930[_0x05c0('0x1e')]],'as':_0x9b4930['as'],'attributes':_0x9b4930['attributes'],'include':_0x9b4930['include']?_['map'](_0x9b4930['include'],function(_0x56aa78){return{'model':db[_0x56aa78[_0x05c0('0x1e')]],'as':_0x56aa78['as'],'attributes':_0x56aa78[_0x05c0('0x1f')],'include':_0x56aa78['include']?_[_0x05c0('0x1d')](_0x56aa78[_0x05c0('0x1c')],function(_0x3617dc){return{'model':db[_0x3617dc[_0x05c0('0x1e')]],'as':_0x3617dc['as'],'attributes':_0x3617dc['attributes']};}):[]};}):[]};}):[]:[]})[_0x05c0('0xb')](function(_0x1c14b1){logger[_0x05c0('0xc')](_0x05c0('0x16'),_0x521cbd);logger[_0x05c0('0xf')](_0x05c0('0x16'),_0x521cbd,JSON['stringify'](_0x1c14b1));_0x1230e5(_0x1c14b1);})['catch'](function(_0x2df109){logger[_0x05c0('0x11')](_0x05c0('0x16'),_0x2df109[_0x05c0('0x13')],_0x521cbd);_0x4613c0(_0x422401[_0x05c0('0x11')](0x1f4,_0x2df109[_0x05c0('0x13')]));});});};exports[_0x05c0('0x20')]=function(_0x3c9eb1){var _0x33eff3=this;return new Promise(function(_0x87b07c,_0x3e38f0){return db[_0x05c0('0x21')]['find']({'raw':_0x3c9eb1['options']?_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x19')]===undefined?!![]:![]:!![],'where':_0x3c9eb1[_0x05c0('0x18')]?_0x3c9eb1['options'][_0x05c0('0x1a')]||null:null,'attributes':_0x3c9eb1[_0x05c0('0x18')]?_0x3c9eb1['options'][_0x05c0('0x1f')]||null:null,'include':_0x3c9eb1['options']?_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x3c9eb1[_0x05c0('0x18')][_0x05c0('0x1c')],function(_0x2a9e82){return{'model':db[_0x2a9e82[_0x05c0('0x1e')]],'as':_0x2a9e82['as'],'attributes':_0x2a9e82[_0x05c0('0x1f')],'include':_0x2a9e82[_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x2a9e82[_0x05c0('0x1c')],function(_0x3a9c63){return{'model':db[_0x3a9c63[_0x05c0('0x1e')]],'as':_0x3a9c63['as'],'attributes':_0x3a9c63[_0x05c0('0x1f')],'include':_0x3a9c63[_0x05c0('0x1c')]?_[_0x05c0('0x1d')](_0x3a9c63[_0x05c0('0x1c')],function(_0x21c22){return{'model':db[_0x21c22[_0x05c0('0x1e')]],'as':_0x21c22['as'],'attributes':_0x21c22[_0x05c0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x05c0('0xb')](function(_0x337847){logger[_0x05c0('0xc')](_0x05c0('0x20'),_0x3c9eb1);logger[_0x05c0('0xf')](_0x05c0('0x20'),_0x3c9eb1,JSON[_0x05c0('0x10')](_0x337847));_0x87b07c(_0x337847);})[_0x05c0('0x15')](function(_0x40d4db){logger[_0x05c0('0x11')](_0x05c0('0x20'),_0x40d4db[_0x05c0('0x13')],_0x3c9eb1);_0x3e38f0(_0x33eff3[_0x05c0('0x11')](0x1f4,_0x40d4db['message']));});});}; \ No newline at end of file +var _0x58a4=['include','model','then','VtigerAccount','find','ShowVtigerAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','map'];(function(_0x19828e,_0x31a9bb){var _0x164839=function(_0x30df9d){while(--_0x30df9d){_0x19828e['push'](_0x19828e['shift']());}};_0x164839(++_0x31a9bb);}(_0x58a4,0xbf));var _0x458a=function(_0xfdec06,_0x9fa2f4){_0xfdec06=_0xfdec06-0x0;var _0x58a539=_0x58a4[_0xfdec06];return _0x58a539;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var moment=require(_0x458a('0x2'));var BPromise=require(_0x458a('0x3'));var rs=require(_0x458a('0x4'));var fs=require('fs');var Redis=require(_0x458a('0x5'));var db=require(_0x458a('0x6'))['db'];var utils=require(_0x458a('0x7'));var logger=require(_0x458a('0x8'))(_0x458a('0x9'));var config=require(_0x458a('0xa'));var jayson=require(_0x458a('0xb'));var client=jayson[_0x458a('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5358c2,_0x30b095,_0x11fcaa){return new BPromise(function(_0x2029bc,_0x1e658e){return client[_0x458a('0xd')](_0x5358c2,_0x11fcaa)['then'](function(_0x4bedce){logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,_0x458a('0x10'));logger[_0x458a('0x11')](_0x458a('0x12'),_0x30b095,'request\x20sent',JSON[_0x458a('0x13')](_0x4bedce));if(_0x4bedce[_0x458a('0x14')]){if(_0x4bedce['error'][_0x458a('0x15')]===0x1f4){logger[_0x458a('0x14')](_0x458a('0xf'),_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x1e658e(_0x4bedce['error']['message']);}logger[_0x458a('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x30b095,_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);return _0x2029bc(_0x4bedce[_0x458a('0x14')][_0x458a('0x16')]);}else{logger[_0x458a('0xe')](_0x458a('0xf'),_0x30b095,'request\x20sent');_0x2029bc(_0x4bedce['result']['message']);}})[_0x458a('0x17')](function(_0x3fd6d4){logger[_0x458a('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x30b095,_0x3fd6d4);_0x1e658e(_0x3fd6d4);});});}exports[_0x458a('0x18')]=function(_0x260c87){var _0x18504d=this;return new Promise(function(_0x392986,_0xa91473){return db['VtigerAccount']['findAll']({'raw':_0x260c87[_0x458a('0x19')]?_0x260c87['options'][_0x458a('0x1a')]===undefined?!![]:![]:!![],'where':_0x260c87[_0x458a('0x19')]?_0x260c87['options'][_0x458a('0x1b')]||null:null,'attributes':_0x260c87['options']?_0x260c87[_0x458a('0x19')][_0x458a('0x1c')]||null:null,'limit':_0x260c87['options']?_0x260c87[_0x458a('0x19')][_0x458a('0x1d')]||null:null,'include':_0x260c87['options']?_0x260c87[_0x458a('0x19')]['include']?_[_0x458a('0x1e')](_0x260c87['options'][_0x458a('0x1f')],function(_0x5dfc6c){return{'model':db[_0x5dfc6c[_0x458a('0x20')]],'as':_0x5dfc6c['as'],'attributes':_0x5dfc6c[_0x458a('0x1c')],'include':_0x5dfc6c[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x5dfc6c[_0x458a('0x1f')],function(_0x19bd5){return{'model':db[_0x19bd5[_0x458a('0x20')]],'as':_0x19bd5['as'],'attributes':_0x19bd5[_0x458a('0x1c')],'include':_0x19bd5[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x19bd5[_0x458a('0x1f')],function(_0x327fcb){return{'model':db[_0x327fcb[_0x458a('0x20')]],'as':_0x327fcb['as'],'attributes':_0x327fcb['attributes']};}):[]};}):[]};}):[]:[]})[_0x458a('0x21')](function(_0x112fa6){logger['info']('GetVtigerAccount',_0x260c87);logger[_0x458a('0x11')]('GetVtigerAccount',_0x260c87,JSON[_0x458a('0x13')](_0x112fa6));_0x392986(_0x112fa6);})[_0x458a('0x17')](function(_0x223f73){logger['error'](_0x458a('0x18'),_0x223f73[_0x458a('0x16')],_0x260c87);_0xa91473(_0x18504d[_0x458a('0x14')](0x1f4,_0x223f73['message']));});});};exports['ShowVtigerAccount']=function(_0x18c890){var _0x4cf059=this;return new Promise(function(_0x185f1c,_0x56e0b9){return db[_0x458a('0x22')][_0x458a('0x23')]({'raw':_0x18c890['options']?_0x18c890[_0x458a('0x19')][_0x458a('0x1a')]===undefined?!![]:![]:!![],'where':_0x18c890[_0x458a('0x19')]?_0x18c890['options'][_0x458a('0x1b')]||null:null,'attributes':_0x18c890[_0x458a('0x19')]?_0x18c890[_0x458a('0x19')][_0x458a('0x1c')]||null:null,'include':_0x18c890[_0x458a('0x19')]?_0x18c890['options'][_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x18c890[_0x458a('0x19')][_0x458a('0x1f')],function(_0x35ec8f){return{'model':db[_0x35ec8f[_0x458a('0x20')]],'as':_0x35ec8f['as'],'attributes':_0x35ec8f['attributes'],'include':_0x35ec8f[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x35ec8f[_0x458a('0x1f')],function(_0x2f9b7b){return{'model':db[_0x2f9b7b[_0x458a('0x20')]],'as':_0x2f9b7b['as'],'attributes':_0x2f9b7b[_0x458a('0x1c')],'include':_0x2f9b7b[_0x458a('0x1f')]?_[_0x458a('0x1e')](_0x2f9b7b[_0x458a('0x1f')],function(_0x4cb8be){return{'model':db[_0x4cb8be[_0x458a('0x20')]],'as':_0x4cb8be['as'],'attributes':_0x4cb8be[_0x458a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x458a('0x21')](function(_0x101ece){logger[_0x458a('0xe')](_0x458a('0x24'),_0x18c890);logger[_0x458a('0x11')](_0x458a('0x24'),_0x18c890,JSON[_0x458a('0x13')](_0x101ece));_0x185f1c(_0x101ece);})[_0x458a('0x17')](function(_0x1a4011){logger[_0x458a('0x14')](_0x458a('0x24'),_0x1a4011[_0x458a('0x16')],_0x18c890);_0x56e0b9(_0x4cf059[_0x458a('0x14')](0x1f4,_0x1a4011['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 4035d0b..1f560d1 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 _0xfe6e=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id'];(function(_0x2fc2a2,_0xeb4a23){var _0x31350d=function(_0x4c1cbc){while(--_0x4c1cbc){_0x2fc2a2['push'](_0x2fc2a2['shift']());}};_0x31350d(++_0xeb4a23);}(_0xfe6e,0xe4));var _0xefe6=function(_0x1f7926,_0x4fae96){_0x1f7926=_0x1f7926-0x0;var _0x1ead31=_0xfe6e[_0x1f7926];return _0x1ead31;};'use strict';var multer=require('multer');var util=require(_0xefe6('0x0'));var path=require(_0xefe6('0x1'));var timeout=require(_0xefe6('0x2'));var express=require(_0xefe6('0x3'));var router=express[_0xefe6('0x4')]();var fs_extra=require(_0xefe6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xefe6('0x6'));var config=require(_0xefe6('0x7'));var controller=require(_0xefe6('0x8'));router['get']('/',auth[_0xefe6('0x9')](),controller[_0xefe6('0xa')]);router[_0xefe6('0xb')]('/:id',auth[_0xefe6('0x9')](),controller[_0xefe6('0xc')]);router[_0xefe6('0xb')](_0xefe6('0xd'),auth[_0xefe6('0x9')](),controller[_0xefe6('0xe')]);router[_0xefe6('0xb')](_0xefe6('0xf'),auth[_0xefe6('0x9')](),controller['getSubjects']);router[_0xefe6('0xb')](_0xefe6('0x10'),auth[_0xefe6('0x9')](),controller[_0xefe6('0x11')]);router[_0xefe6('0x12')]('/',auth['isAuthenticated'](),controller[_0xefe6('0x13')]);router[_0xefe6('0x14')](_0xefe6('0x15'),auth[_0xefe6('0x9')](),controller['update']);router[_0xefe6('0x16')](_0xefe6('0x15'),auth[_0xefe6('0x9')](),controller[_0xefe6('0x17')]);module[_0xefe6('0x18')]=router; \ No newline at end of file +var _0xe7b5=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3e2c14,_0x19dc4c){var _0x36941a=function(_0xa306de){while(--_0xa306de){_0x3e2c14['push'](_0x3e2c14['shift']());}};_0x36941a(++_0x19dc4c);}(_0xe7b5,0xad));var _0x5e7b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xe7b5[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x5e7b('0x0'));var util=require(_0x5e7b('0x1'));var path=require('path');var timeout=require(_0x5e7b('0x2'));var express=require(_0x5e7b('0x3'));var router=express[_0x5e7b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5e7b('0x5'));var interaction=require(_0x5e7b('0x6'));var config=require(_0x5e7b('0x7'));var controller=require(_0x5e7b('0x8'));router['get']('/',auth[_0x5e7b('0x9')](),controller[_0x5e7b('0xa')]);router[_0x5e7b('0xb')](_0x5e7b('0xc'),auth['isAuthenticated'](),controller[_0x5e7b('0xd')]);router[_0x5e7b('0xb')](_0x5e7b('0xe'),auth[_0x5e7b('0x9')](),controller[_0x5e7b('0xf')]);router[_0x5e7b('0xb')](_0x5e7b('0x10'),auth[_0x5e7b('0x9')](),controller['getSubjects']);router[_0x5e7b('0xb')](_0x5e7b('0x11'),auth[_0x5e7b('0x9')](),controller[_0x5e7b('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5e7b('0x13')]);router[_0x5e7b('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x5e7b('0x15')]);router[_0x5e7b('0x16')]('/:id',auth[_0x5e7b('0x9')](),controller[_0x5e7b('0x17')]);module[_0x5e7b('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index ed3d40b..04e217a 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 _0x5516=['exports','STRING','sequelize'];(function(_0x28d7b5,_0x1305a4){var _0x1ed035=function(_0x57e1f6){while(--_0x57e1f6){_0x28d7b5['push'](_0x28d7b5['shift']());}};_0x1ed035(++_0x1305a4);}(_0x5516,0x9e));var _0x6551=function(_0x1a21ff,_0x4a7550){_0x1a21ff=_0x1a21ff-0x0;var _0x25afc1=_0x5516[_0x1a21ff];return _0x25afc1;};'use strict';var Sequelize=require(_0x6551('0x0'));module[_0x6551('0x1')]={'name':{'type':Sequelize[_0x6551('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xeac8=['STRING','sequelize','exports'];(function(_0x3eb713,_0x437874){var _0x1d7128=function(_0x2b9cea){while(--_0x2b9cea){_0x3eb713['push'](_0x3eb713['shift']());}};_0x1d7128(++_0x437874);}(_0xeac8,0x14b));var _0x8eac=function(_0x12541d,_0x51b087){_0x12541d=_0x12541d-0x0;var _0x1bf91a=_0xeac8[_0x12541d];return _0x1bf91a;};'use strict';var Sequelize=require(_0x8eac('0x0'));module[_0x8eac('0x1')]={'name':{'type':Sequelize[_0x8eac('0x2')]},'description':{'type':Sequelize[_0x8eac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 57eb13e..830e365 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 _0x85b2=['map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','getFields','order','pick','filter','getSubjects','findOne','VtigerField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','error','stack','name','send','index'];(function(_0x388e15,_0x49788b){var _0x51b23c=function(_0x234bff){while(--_0x234bff){_0x388e15['push'](_0x388e15['shift']());}};_0x51b23c(++_0x49788b);}(_0x85b2,0x11a));var _0x285b=function(_0x4a5ec4,_0x24fa15){_0x4a5ec4=_0x4a5ec4-0x0;var _0x3bd782=_0x85b2[_0x4a5ec4];return _0x3bd782;};'use strict';var emlformat=require(_0x285b('0x0'));var rimraf=require(_0x285b('0x1'));var zipdir=require(_0x285b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x285b('0x3'));var moment=require(_0x285b('0x4'));var BPromise=require(_0x285b('0x5'));var Mustache=require(_0x285b('0x6'));var util=require(_0x285b('0x7'));var path=require(_0x285b('0x8'));var sox=require(_0x285b('0x9'));var csv=require(_0x285b('0xa'));var ejs=require(_0x285b('0xb'));var fs=require('fs');var fs_extra=require(_0x285b('0xc'));var _=require('lodash');var squel=require(_0x285b('0xd'));var crypto=require('crypto');var jsforce=require(_0x285b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x285b('0xa'));var querystring=require(_0x285b('0xf'));var Papa=require(_0x285b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x285b('0x11'));var as=require(_0x285b('0x12'));var hardwareService=require(_0x285b('0x13'));var logger=require(_0x285b('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x285b('0x15'));var db=require(_0x285b('0x16'))['db'];function respondWithStatusCode(_0x3aaf3a,_0x14ae0d){_0x14ae0d=_0x14ae0d||0xcc;return function(_0x513b65){if(_0x513b65){return _0x3aaf3a['sendStatus'](_0x14ae0d);}return _0x3aaf3a[_0x285b('0x17')](_0x14ae0d)[_0x285b('0x18')]();};}function respondWithResult(_0x491001,_0x1b0874){_0x1b0874=_0x1b0874||0xc8;return function(_0x3a6839){if(_0x3a6839){return _0x491001[_0x285b('0x17')](_0x1b0874)[_0x285b('0x19')](_0x3a6839);}};}function respondWithFilteredResult(_0x34805f,_0x3b61d6){return function(_0x406911){if(_0x406911){var _0x230ade=typeof _0x3b61d6[_0x285b('0x1a')]===_0x285b('0x1b')&&typeof _0x3b61d6[_0x285b('0x1c')]==='undefined';var _0x3dfa1d=_0x406911[_0x285b('0x1d')];var _0x46df50=_0x230ade?0x0:_0x3b61d6['offset'];var _0x3c91f4=_0x230ade?_0x406911[_0x285b('0x1d')]:_0x3b61d6[_0x285b('0x1a')]+_0x3b61d6[_0x285b('0x1c')];var _0x28fcc7;if(_0x3c91f4>=_0x3dfa1d){_0x3c91f4=_0x3dfa1d;_0x28fcc7=0xc8;}else{_0x28fcc7=0xce;}_0x34805f[_0x285b('0x17')](_0x28fcc7);return _0x34805f[_0x285b('0x1e')](_0x285b('0x1f'),_0x46df50+'-'+_0x3c91f4+'/'+_0x3dfa1d)[_0x285b('0x19')](_0x406911);}return null;};}function patchUpdates(_0xa42e50){return function(_0x32d74e){try{jsonpatch[_0x285b('0x20')](_0x32d74e,_0xa42e50,!![]);}catch(_0x124f08){return BPromise[_0x285b('0x21')](_0x124f08);}return _0x32d74e['save']();};}function saveUpdates(_0x53a1b0,_0x184d18){return function(_0xb5649d){if(_0xb5649d){return _0xb5649d[_0x285b('0x22')](_0x53a1b0)[_0x285b('0x23')](function(_0x3babf6){return _0x3babf6;});}return null;};}function removeEntity(_0x3330da,_0x3c7a78){return function(_0x317873){if(_0x317873){return _0x317873['destroy']()['then'](function(){_0x3330da[_0x285b('0x17')](0xcc)[_0x285b('0x18')]();});}};}function handleEntityNotFound(_0x441c64,_0x4c05af){return function(_0x414b10){if(!_0x414b10){_0x441c64[_0x285b('0x24')](0x194);}return _0x414b10;};}function handleError(_0x1b467d,_0x4f6608){_0x4f6608=_0x4f6608||0x1f4;return function(_0xd5103c){logger[_0x285b('0x25')](_0xd5103c[_0x285b('0x26')]);if(_0xd5103c[_0x285b('0x27')]){delete _0xd5103c[_0x285b('0x27')];}_0x1b467d['status'](_0x4f6608)[_0x285b('0x28')](_0xd5103c);};}exports[_0x285b('0x29')]=function(_0x201095,_0x587ebf){var _0x4e7526={},_0x3fc567={},_0x3fb61a={'count':0x0,'rows':[]};var _0x10874e=_[_0x285b('0x2a')](db['VtigerConfiguration'][_0x285b('0x2b')],function(_0x54cbf0){return{'name':_0x54cbf0[_0x285b('0x2c')],'type':_0x54cbf0[_0x285b('0x2d')][_0x285b('0x2e')]};});_0x3fc567[_0x285b('0x2f')]=_[_0x285b('0x2a')](_0x10874e,_0x285b('0x27'));_0x3fc567[_0x285b('0x30')]=_[_0x285b('0x31')](_0x201095['query']);_0x3fc567[_0x285b('0x32')]=_[_0x285b('0x33')](_0x3fc567[_0x285b('0x2f')],_0x3fc567[_0x285b('0x30')]);_0x4e7526[_0x285b('0x34')]=_[_0x285b('0x33')](_0x3fc567[_0x285b('0x2f')],qs[_0x285b('0x35')](_0x201095['query'][_0x285b('0x35')]));_0x4e7526['attributes']=_0x4e7526[_0x285b('0x34')]['length']?_0x4e7526['attributes']:_0x3fc567[_0x285b('0x2f')];if(!_0x201095[_0x285b('0x30')][_0x285b('0x36')](_0x285b('0x37'))){_0x4e7526[_0x285b('0x1c')]=qs[_0x285b('0x1c')](_0x201095[_0x285b('0x30')]['limit']);_0x4e7526['offset']=qs[_0x285b('0x1a')](_0x201095['query']['offset']);}_0x4e7526['order']=qs['sort'](_0x201095['query'][_0x285b('0x38')]);_0x4e7526['where']=qs['filters'](_['pick'](_0x201095[_0x285b('0x30')],_0x3fc567[_0x285b('0x32')]),_0x10874e);if(_0x201095[_0x285b('0x30')]['filter']){_0x4e7526[_0x285b('0x39')]=_[_0x285b('0x3a')](_0x4e7526[_0x285b('0x39')],{'$or':_[_0x285b('0x2a')](_0x10874e,function(_0x282cf1){if(_0x282cf1[_0x285b('0x2d')]!==_0x285b('0x3b')){var _0xc117cb={};_0xc117cb[_0x282cf1[_0x285b('0x27')]]={'$like':'%'+_0x201095[_0x285b('0x30')]['filter']+'%'};return _0xc117cb;}})});}_0x4e7526=_[_0x285b('0x3a')]({},_0x4e7526,_0x201095[_0x285b('0x3c')]);var _0x3b4b26={'where':_0x4e7526['where']};return db[_0x285b('0x3d')][_0x285b('0x1d')](_0x3b4b26)[_0x285b('0x23')](function(_0x17649b){_0x3fb61a[_0x285b('0x1d')]=_0x17649b;if(_0x201095[_0x285b('0x30')][_0x285b('0x3e')]){_0x4e7526[_0x285b('0x3f')]=[{'all':!![]}];}return db[_0x285b('0x3d')]['findAll'](_0x4e7526);})[_0x285b('0x23')](function(_0x4f61c5){_0x3fb61a[_0x285b('0x40')]=_0x4f61c5;return _0x3fb61a;})['then'](respondWithFilteredResult(_0x587ebf,_0x4e7526))[_0x285b('0x41')](handleError(_0x587ebf,null));};exports[_0x285b('0x42')]=function(_0x4ad0ac,_0x445101){var _0x556015={'raw':![],'where':{'id':_0x4ad0ac[_0x285b('0x43')]['id']}},_0x485546={};_0x485546[_0x285b('0x2f')]=_[_0x285b('0x31')](db['VtigerConfiguration'][_0x285b('0x2b')]);_0x485546['query']=_['keys'](_0x4ad0ac[_0x285b('0x30')]);_0x485546[_0x285b('0x32')]=_[_0x285b('0x33')](_0x485546[_0x285b('0x2f')],_0x485546[_0x285b('0x30')]);_0x556015[_0x285b('0x34')]=_[_0x285b('0x33')](_0x485546['model'],qs[_0x285b('0x35')](_0x4ad0ac['query'][_0x285b('0x35')]));_0x556015[_0x285b('0x34')]=_0x556015[_0x285b('0x34')][_0x285b('0x44')]?_0x556015[_0x285b('0x34')]:_0x485546[_0x285b('0x2f')];if(_0x4ad0ac[_0x285b('0x30')]['includeAll']){_0x556015[_0x285b('0x3f')]=[{'all':!![]}];}_0x556015=_[_0x285b('0x3a')]({},_0x556015,_0x4ad0ac['options']);return db[_0x285b('0x3d')][_0x285b('0x45')](_0x556015)[_0x285b('0x23')](handleEntityNotFound(_0x445101,null))['then'](respondWithResult(_0x445101,null))[_0x285b('0x41')](handleError(_0x445101,null));};exports[_0x285b('0x46')]=function(_0x413fa1,_0x288b81){return db[_0x285b('0x3d')][_0x285b('0x46')](_0x413fa1[_0x285b('0x47')],{})[_0x285b('0x23')](respondWithResult(_0x288b81,0xc9))[_0x285b('0x41')](handleError(_0x288b81,null));};exports[_0x285b('0x22')]=function(_0x1b4208,_0x40178d){if(_0x1b4208[_0x285b('0x47')]['id']){delete _0x1b4208[_0x285b('0x47')]['id'];}return db[_0x285b('0x3d')][_0x285b('0x45')]({'where':{'id':_0x1b4208[_0x285b('0x43')]['id']}})['then'](handleEntityNotFound(_0x40178d,null))[_0x285b('0x23')](saveUpdates(_0x1b4208[_0x285b('0x47')],null))['then'](respondWithResult(_0x40178d,null))[_0x285b('0x41')](handleError(_0x40178d,null));};exports[_0x285b('0x48')]=function(_0x26655a,_0x38b0c6){return db[_0x285b('0x3d')]['find']({'where':{'id':_0x26655a[_0x285b('0x43')]['id']}})['then'](handleEntityNotFound(_0x38b0c6,null))[_0x285b('0x23')](removeEntity(_0x38b0c6,null))[_0x285b('0x41')](handleError(_0x38b0c6,null));};exports[_0x285b('0x49')]=function(_0x414a57,_0x3f8dd1,_0x3b76af){var _0x2c4675={};var _0x2de847={};var _0x410c8f;var _0x15e672;return db[_0x285b('0x3d')]['findOne']({'where':{'id':_0x414a57['params']['id']}})[_0x285b('0x23')](handleEntityNotFound(_0x3f8dd1,null))['then'](function(_0x424839){if(_0x424839){_0x410c8f=_0x424839;_0x2de847['model']=_[_0x285b('0x31')](db['VtigerField']['rawAttributes']);_0x2de847[_0x285b('0x30')]=_[_0x285b('0x31')](_0x414a57[_0x285b('0x30')]);_0x2de847['filters']=_['intersection'](_0x2de847[_0x285b('0x2f')],_0x2de847[_0x285b('0x30')]);_0x2c4675['attributes']=_[_0x285b('0x33')](_0x2de847[_0x285b('0x2f')],qs[_0x285b('0x35')](_0x414a57[_0x285b('0x30')]['fields']));_0x2c4675[_0x285b('0x34')]=_0x2c4675[_0x285b('0x34')][_0x285b('0x44')]?_0x2c4675[_0x285b('0x34')]:_0x2de847[_0x285b('0x2f')];_0x2c4675[_0x285b('0x4a')]=qs[_0x285b('0x38')](_0x414a57[_0x285b('0x30')][_0x285b('0x38')]);_0x2c4675[_0x285b('0x39')]=qs['filters'](_[_0x285b('0x4b')](_0x414a57[_0x285b('0x30')],_0x2de847[_0x285b('0x32')]));if(_0x414a57['query'][_0x285b('0x4c')]){_0x2c4675[_0x285b('0x39')]=_[_0x285b('0x3a')](_0x2c4675[_0x285b('0x39')],{'$or':_[_0x285b('0x2a')](_0x2c4675[_0x285b('0x34')],function(_0x247f4c){var _0x9ab633={};_0x9ab633[_0x247f4c]={'$like':'%'+_0x414a57['query'][_0x285b('0x4c')]+'%'};return _0x9ab633;})});}_0x2c4675=_[_0x285b('0x3a')]({},_0x2c4675,_0x414a57['options']);return _0x410c8f[_0x285b('0x49')](_0x2c4675);}})[_0x285b('0x23')](function(_0x3c5b28){if(_0x3c5b28){_0x15e672=_0x3c5b28[_0x285b('0x44')];if(!_0x414a57['query'][_0x285b('0x36')](_0x285b('0x37'))){_0x2c4675[_0x285b('0x1c')]=qs[_0x285b('0x1c')](_0x414a57['query'][_0x285b('0x1c')]);_0x2c4675['offset']=qs[_0x285b('0x1a')](_0x414a57[_0x285b('0x30')][_0x285b('0x1a')]);}return _0x410c8f[_0x285b('0x49')](_0x2c4675);}})[_0x285b('0x23')](function(_0x4544fb){if(_0x4544fb){return _0x4544fb?{'count':_0x15e672,'rows':_0x4544fb}:null;}})[_0x285b('0x23')](respondWithResult(_0x3f8dd1,null))[_0x285b('0x41')](handleError(_0x3f8dd1,null));};exports[_0x285b('0x4d')]=function(_0x1f5bd4,_0x411b79,_0x36e48f){var _0x3060d2={};var _0x37caf4={};var _0x167ce9;var _0x37dace;return db[_0x285b('0x3d')][_0x285b('0x4e')]({'where':{'id':_0x1f5bd4['params']['id']}})[_0x285b('0x23')](handleEntityNotFound(_0x411b79,null))['then'](function(_0x552d21){if(_0x552d21){_0x167ce9=_0x552d21;_0x37caf4[_0x285b('0x2f')]=_[_0x285b('0x31')](db[_0x285b('0x4f')][_0x285b('0x2b')]);_0x37caf4[_0x285b('0x30')]=_[_0x285b('0x31')](_0x1f5bd4[_0x285b('0x30')]);_0x37caf4[_0x285b('0x32')]=_[_0x285b('0x33')](_0x37caf4['model'],_0x37caf4['query']);_0x3060d2[_0x285b('0x34')]=_[_0x285b('0x33')](_0x37caf4[_0x285b('0x2f')],qs['fields'](_0x1f5bd4[_0x285b('0x30')][_0x285b('0x35')]));_0x3060d2[_0x285b('0x34')]=_0x3060d2[_0x285b('0x34')][_0x285b('0x44')]?_0x3060d2[_0x285b('0x34')]:_0x37caf4['model'];_0x3060d2[_0x285b('0x4a')]=qs[_0x285b('0x38')](_0x1f5bd4[_0x285b('0x30')]['sort']);_0x3060d2[_0x285b('0x39')]=qs[_0x285b('0x32')](_['pick'](_0x1f5bd4['query'],_0x37caf4[_0x285b('0x32')]));if(_0x1f5bd4[_0x285b('0x30')][_0x285b('0x4c')]){_0x3060d2[_0x285b('0x39')]=_[_0x285b('0x3a')](_0x3060d2['where'],{'$or':_[_0x285b('0x2a')](_0x3060d2[_0x285b('0x34')],function(_0x319d7f){var _0x54e86f={};_0x54e86f[_0x319d7f]={'$like':'%'+_0x1f5bd4[_0x285b('0x30')][_0x285b('0x4c')]+'%'};return _0x54e86f;})});}_0x3060d2=_['merge']({},_0x3060d2,_0x1f5bd4[_0x285b('0x3c')]);return _0x167ce9[_0x285b('0x4d')](_0x3060d2);}})[_0x285b('0x23')](function(_0x149355){if(_0x149355){_0x37dace=_0x149355[_0x285b('0x44')];if(!_0x1f5bd4[_0x285b('0x30')][_0x285b('0x36')](_0x285b('0x37'))){_0x3060d2['limit']=qs[_0x285b('0x1c')](_0x1f5bd4[_0x285b('0x30')][_0x285b('0x1c')]);_0x3060d2[_0x285b('0x1a')]=qs[_0x285b('0x1a')](_0x1f5bd4[_0x285b('0x30')][_0x285b('0x1a')]);}return _0x167ce9[_0x285b('0x4d')](_0x3060d2);}})[_0x285b('0x23')](function(_0x4d1937){if(_0x4d1937){return _0x4d1937?{'count':_0x37dace,'rows':_0x4d1937}:null;}})['then'](respondWithResult(_0x411b79,null))[_0x285b('0x41')](handleError(_0x411b79,null));};exports[_0x285b('0x50')]=function(_0x2d187c,_0x223e90,_0x464f27){var _0x38a150={};var _0x338a31={};var _0x1ee1c3;var _0x57d966;return db[_0x285b('0x3d')][_0x285b('0x4e')]({'where':{'id':_0x2d187c[_0x285b('0x43')]['id']}})[_0x285b('0x23')](handleEntityNotFound(_0x223e90,null))[_0x285b('0x23')](function(_0x3b4e94){if(_0x3b4e94){_0x1ee1c3=_0x3b4e94;_0x338a31[_0x285b('0x2f')]=_['keys'](db[_0x285b('0x4f')][_0x285b('0x2b')]);_0x338a31[_0x285b('0x30')]=_['keys'](_0x2d187c[_0x285b('0x30')]);_0x338a31[_0x285b('0x32')]=_[_0x285b('0x33')](_0x338a31['model'],_0x338a31[_0x285b('0x30')]);_0x38a150[_0x285b('0x34')]=_[_0x285b('0x33')](_0x338a31['model'],qs[_0x285b('0x35')](_0x2d187c[_0x285b('0x30')][_0x285b('0x35')]));_0x38a150[_0x285b('0x34')]=_0x38a150[_0x285b('0x34')]['length']?_0x38a150['attributes']:_0x338a31[_0x285b('0x2f')];_0x38a150['order']=qs[_0x285b('0x38')](_0x2d187c['query'][_0x285b('0x38')]);_0x38a150[_0x285b('0x39')]=qs['filters'](_[_0x285b('0x4b')](_0x2d187c['query'],_0x338a31['filters']));if(_0x2d187c[_0x285b('0x30')][_0x285b('0x4c')]){_0x38a150['where']=_[_0x285b('0x3a')](_0x38a150[_0x285b('0x39')],{'$or':_[_0x285b('0x2a')](_0x38a150['attributes'],function(_0x4ea66f){var _0x37baff={};_0x37baff[_0x4ea66f]={'$like':'%'+_0x2d187c[_0x285b('0x30')][_0x285b('0x4c')]+'%'};return _0x37baff;})});}_0x38a150=_[_0x285b('0x3a')]({},_0x38a150,_0x2d187c[_0x285b('0x3c')]);return _0x1ee1c3['getDescriptions'](_0x38a150);}})[_0x285b('0x23')](function(_0x20b588){if(_0x20b588){_0x57d966=_0x20b588['length'];if(!_0x2d187c['query'][_0x285b('0x36')](_0x285b('0x37'))){_0x38a150['limit']=qs[_0x285b('0x1c')](_0x2d187c[_0x285b('0x30')][_0x285b('0x1c')]);_0x38a150[_0x285b('0x1a')]=qs['offset'](_0x2d187c[_0x285b('0x30')][_0x285b('0x1a')]);}return _0x1ee1c3[_0x285b('0x50')](_0x38a150);}})['then'](function(_0x254a7e){if(_0x254a7e){return _0x254a7e?{'count':_0x57d966,'rows':_0x254a7e}:null;}})[_0x285b('0x23')](respondWithResult(_0x223e90,null))[_0x285b('0x41')](handleError(_0x223e90,null));}; \ No newline at end of file +var _0x4a81=['index','map','VtigerConfiguration','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','filters','merge','where','filter','options','include','findAll','rows','show','keys','includeAll','find','create','body','catch','params','getFields','VtigerField','pick','length','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','apply','reject','update','destroy','then','sendStatus','error','stack','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a81,0x1b7));var _0x14a8=function(_0x3717fa,_0x27f6c5){_0x3717fa=_0x3717fa-0x0;var _0x85b2e7=_0x4a81[_0x3717fa];return _0x85b2e7;};'use strict';var emlformat=require(_0x14a8('0x0'));var rimraf=require(_0x14a8('0x1'));var zipdir=require(_0x14a8('0x2'));var jsonpatch=require(_0x14a8('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14a8('0x4'));var Mustache=require('mustache');var util=require(_0x14a8('0x5'));var path=require(_0x14a8('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x14a8('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14a8('0x8'));var squel=require('squel');var crypto=require(_0x14a8('0x9'));var jsforce=require(_0x14a8('0xa'));var deskjs=require(_0x14a8('0xb'));var toCsv=require(_0x14a8('0xc'));var querystring=require(_0x14a8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x14a8('0xe'));var qs=require(_0x14a8('0xf'));var as=require(_0x14a8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x14a8('0x11'))(_0x14a8('0x12'));var utils=require(_0x14a8('0x13'));var config=require(_0x14a8('0x14'));var licenseUtil=require(_0x14a8('0x15'));var db=require(_0x14a8('0x16'))['db'];function respondWithStatusCode(_0x260a55,_0x1f43f7){_0x1f43f7=_0x1f43f7||0xcc;return function(_0x5e41f9){if(_0x5e41f9){return _0x260a55['sendStatus'](_0x1f43f7);}return _0x260a55[_0x14a8('0x17')](_0x1f43f7)[_0x14a8('0x18')]();};}function respondWithResult(_0x531ff8,_0x19d25e){_0x19d25e=_0x19d25e||0xc8;return function(_0x54223b){if(_0x54223b){return _0x531ff8[_0x14a8('0x17')](_0x19d25e)[_0x14a8('0x19')](_0x54223b);}};}function respondWithFilteredResult(_0x3dc509,_0x3f0c93){return function(_0x31ce02){if(_0x31ce02){var _0x3a7152=typeof _0x3f0c93['offset']===_0x14a8('0x1a')&&typeof _0x3f0c93[_0x14a8('0x1b')]==='undefined';var _0x3b8a59=_0x31ce02['count'];var _0x98e1d5=_0x3a7152?0x0:_0x3f0c93[_0x14a8('0x1c')];var _0x456b7f=_0x3a7152?_0x31ce02[_0x14a8('0x1d')]:_0x3f0c93[_0x14a8('0x1c')]+_0x3f0c93[_0x14a8('0x1b')];var _0x4a87f7;if(_0x456b7f>=_0x3b8a59){_0x456b7f=_0x3b8a59;_0x4a87f7=0xc8;}else{_0x4a87f7=0xce;}_0x3dc509[_0x14a8('0x17')](_0x4a87f7);return _0x3dc509[_0x14a8('0x1e')]('Content-Range',_0x98e1d5+'-'+_0x456b7f+'/'+_0x3b8a59)['json'](_0x31ce02);}return null;};}function patchUpdates(_0x1956a2){return function(_0x4ee380){try{jsonpatch[_0x14a8('0x1f')](_0x4ee380,_0x1956a2,!![]);}catch(_0x5c0f41){return BPromise[_0x14a8('0x20')](_0x5c0f41);}return _0x4ee380['save']();};}function saveUpdates(_0x190189,_0x3afd58){return function(_0x182f2b){if(_0x182f2b){return _0x182f2b[_0x14a8('0x21')](_0x190189)['then'](function(_0x3d8cd1){return _0x3d8cd1;});}return null;};}function removeEntity(_0x5a624f,_0x2cee5e){return function(_0x250055){if(_0x250055){return _0x250055[_0x14a8('0x22')]()[_0x14a8('0x23')](function(){_0x5a624f[_0x14a8('0x17')](0xcc)[_0x14a8('0x18')]();});}};}function handleEntityNotFound(_0x1f251a,_0x242a10){return function(_0x505655){if(!_0x505655){_0x1f251a[_0x14a8('0x24')](0x194);}return _0x505655;};}function handleError(_0x2e61c9,_0xc762cc){_0xc762cc=_0xc762cc||0x1f4;return function(_0x26f11b){logger[_0x14a8('0x25')](_0x26f11b[_0x14a8('0x26')]);if(_0x26f11b[_0x14a8('0x27')]){delete _0x26f11b[_0x14a8('0x27')];}_0x2e61c9[_0x14a8('0x17')](_0xc762cc)[_0x14a8('0x28')](_0x26f11b);};}exports[_0x14a8('0x29')]=function(_0x1c378a,_0x41d8f1){var _0x5bc378={},_0x380e9a={},_0x2fdaed={'count':0x0,'rows':[]};var _0x4d71a1=_[_0x14a8('0x2a')](db[_0x14a8('0x2b')][_0x14a8('0x2c')],function(_0x486f3f){return{'name':_0x486f3f[_0x14a8('0x2d')],'type':_0x486f3f[_0x14a8('0x2e')][_0x14a8('0x2f')]};});_0x380e9a[_0x14a8('0x30')]=_[_0x14a8('0x2a')](_0x4d71a1,_0x14a8('0x27'));_0x380e9a[_0x14a8('0x31')]=_['keys'](_0x1c378a[_0x14a8('0x31')]);_0x380e9a['filters']=_['intersection'](_0x380e9a[_0x14a8('0x30')],_0x380e9a['query']);_0x5bc378['attributes']=_[_0x14a8('0x32')](_0x380e9a[_0x14a8('0x30')],qs[_0x14a8('0x33')](_0x1c378a['query'][_0x14a8('0x33')]));_0x5bc378[_0x14a8('0x34')]=_0x5bc378[_0x14a8('0x34')]['length']?_0x5bc378[_0x14a8('0x34')]:_0x380e9a[_0x14a8('0x30')];if(!_0x1c378a[_0x14a8('0x31')][_0x14a8('0x35')](_0x14a8('0x36'))){_0x5bc378['limit']=qs['limit'](_0x1c378a[_0x14a8('0x31')][_0x14a8('0x1b')]);_0x5bc378[_0x14a8('0x1c')]=qs[_0x14a8('0x1c')](_0x1c378a[_0x14a8('0x31')][_0x14a8('0x1c')]);}_0x5bc378[_0x14a8('0x37')]=qs['sort'](_0x1c378a[_0x14a8('0x31')][_0x14a8('0x38')]);_0x5bc378['where']=qs[_0x14a8('0x39')](_['pick'](_0x1c378a['query'],_0x380e9a[_0x14a8('0x39')]),_0x4d71a1);if(_0x1c378a[_0x14a8('0x31')]['filter']){_0x5bc378['where']=_[_0x14a8('0x3a')](_0x5bc378[_0x14a8('0x3b')],{'$or':_[_0x14a8('0x2a')](_0x4d71a1,function(_0x1659c2){if(_0x1659c2[_0x14a8('0x2e')]!=='VIRTUAL'){var _0x14190b={};_0x14190b[_0x1659c2['name']]={'$like':'%'+_0x1c378a['query'][_0x14a8('0x3c')]+'%'};return _0x14190b;}})});}_0x5bc378=_[_0x14a8('0x3a')]({},_0x5bc378,_0x1c378a[_0x14a8('0x3d')]);var _0x4e0fc8={'where':_0x5bc378[_0x14a8('0x3b')]};return db[_0x14a8('0x2b')][_0x14a8('0x1d')](_0x4e0fc8)[_0x14a8('0x23')](function(_0x539dde){_0x2fdaed[_0x14a8('0x1d')]=_0x539dde;if(_0x1c378a[_0x14a8('0x31')]['includeAll']){_0x5bc378[_0x14a8('0x3e')]=[{'all':!![]}];}return db[_0x14a8('0x2b')][_0x14a8('0x3f')](_0x5bc378);})[_0x14a8('0x23')](function(_0x20764e){_0x2fdaed[_0x14a8('0x40')]=_0x20764e;return _0x2fdaed;})[_0x14a8('0x23')](respondWithFilteredResult(_0x41d8f1,_0x5bc378))['catch'](handleError(_0x41d8f1,null));};exports[_0x14a8('0x41')]=function(_0x85011a,_0x553e44){var _0x1c28a1={'raw':![],'where':{'id':_0x85011a['params']['id']}},_0x472362={};_0x472362[_0x14a8('0x30')]=_[_0x14a8('0x42')](db[_0x14a8('0x2b')][_0x14a8('0x2c')]);_0x472362[_0x14a8('0x31')]=_[_0x14a8('0x42')](_0x85011a[_0x14a8('0x31')]);_0x472362[_0x14a8('0x39')]=_['intersection'](_0x472362[_0x14a8('0x30')],_0x472362[_0x14a8('0x31')]);_0x1c28a1[_0x14a8('0x34')]=_[_0x14a8('0x32')](_0x472362[_0x14a8('0x30')],qs[_0x14a8('0x33')](_0x85011a[_0x14a8('0x31')]['fields']));_0x1c28a1[_0x14a8('0x34')]=_0x1c28a1[_0x14a8('0x34')]['length']?_0x1c28a1['attributes']:_0x472362[_0x14a8('0x30')];if(_0x85011a['query'][_0x14a8('0x43')]){_0x1c28a1['include']=[{'all':!![]}];}_0x1c28a1=_[_0x14a8('0x3a')]({},_0x1c28a1,_0x85011a[_0x14a8('0x3d')]);return db[_0x14a8('0x2b')][_0x14a8('0x44')](_0x1c28a1)[_0x14a8('0x23')](handleEntityNotFound(_0x553e44,null))[_0x14a8('0x23')](respondWithResult(_0x553e44,null))['catch'](handleError(_0x553e44,null));};exports['create']=function(_0x568f38,_0x14138c){return db[_0x14a8('0x2b')][_0x14a8('0x45')](_0x568f38[_0x14a8('0x46')],{})['then'](respondWithResult(_0x14138c,0xc9))[_0x14a8('0x47')](handleError(_0x14138c,null));};exports[_0x14a8('0x21')]=function(_0xb3a3a0,_0x205307){if(_0xb3a3a0['body']['id']){delete _0xb3a3a0['body']['id'];}return db[_0x14a8('0x2b')][_0x14a8('0x44')]({'where':{'id':_0xb3a3a0[_0x14a8('0x48')]['id']}})[_0x14a8('0x23')](handleEntityNotFound(_0x205307,null))['then'](saveUpdates(_0xb3a3a0[_0x14a8('0x46')],null))[_0x14a8('0x23')](respondWithResult(_0x205307,null))[_0x14a8('0x47')](handleError(_0x205307,null));};exports[_0x14a8('0x22')]=function(_0x33b86f,_0x1053db){return db[_0x14a8('0x2b')][_0x14a8('0x44')]({'where':{'id':_0x33b86f[_0x14a8('0x48')]['id']}})[_0x14a8('0x23')](handleEntityNotFound(_0x1053db,null))[_0x14a8('0x23')](removeEntity(_0x1053db,null))[_0x14a8('0x47')](handleError(_0x1053db,null));};exports[_0x14a8('0x49')]=function(_0x36b69f,_0x54ee4e,_0x295484){var _0x9a808d={};var _0x314431={};var _0xfb197b;var _0x4af05d;return db[_0x14a8('0x2b')]['findOne']({'where':{'id':_0x36b69f[_0x14a8('0x48')]['id']}})[_0x14a8('0x23')](handleEntityNotFound(_0x54ee4e,null))['then'](function(_0x4cc314){if(_0x4cc314){_0xfb197b=_0x4cc314;_0x314431[_0x14a8('0x30')]=_[_0x14a8('0x42')](db[_0x14a8('0x4a')]['rawAttributes']);_0x314431[_0x14a8('0x31')]=_[_0x14a8('0x42')](_0x36b69f['query']);_0x314431['filters']=_[_0x14a8('0x32')](_0x314431[_0x14a8('0x30')],_0x314431['query']);_0x9a808d['attributes']=_['intersection'](_0x314431['model'],qs[_0x14a8('0x33')](_0x36b69f[_0x14a8('0x31')]['fields']));_0x9a808d[_0x14a8('0x34')]=_0x9a808d['attributes']['length']?_0x9a808d[_0x14a8('0x34')]:_0x314431[_0x14a8('0x30')];_0x9a808d['order']=qs[_0x14a8('0x38')](_0x36b69f[_0x14a8('0x31')][_0x14a8('0x38')]);_0x9a808d[_0x14a8('0x3b')]=qs[_0x14a8('0x39')](_[_0x14a8('0x4b')](_0x36b69f[_0x14a8('0x31')],_0x314431['filters']));if(_0x36b69f[_0x14a8('0x31')][_0x14a8('0x3c')]){_0x9a808d['where']=_[_0x14a8('0x3a')](_0x9a808d[_0x14a8('0x3b')],{'$or':_[_0x14a8('0x2a')](_0x9a808d[_0x14a8('0x34')],function(_0x4cf86b){var _0x15625e={};_0x15625e[_0x4cf86b]={'$like':'%'+_0x36b69f[_0x14a8('0x31')]['filter']+'%'};return _0x15625e;})});}_0x9a808d=_['merge']({},_0x9a808d,_0x36b69f[_0x14a8('0x3d')]);return _0xfb197b['getFields'](_0x9a808d);}})['then'](function(_0x448afd){if(_0x448afd){_0x4af05d=_0x448afd[_0x14a8('0x4c')];if(!_0x36b69f[_0x14a8('0x31')]['hasOwnProperty']('nolimit')){_0x9a808d[_0x14a8('0x1b')]=qs['limit'](_0x36b69f['query']['limit']);_0x9a808d['offset']=qs[_0x14a8('0x1c')](_0x36b69f['query'][_0x14a8('0x1c')]);}return _0xfb197b[_0x14a8('0x49')](_0x9a808d);}})['then'](function(_0x37f726){if(_0x37f726){return _0x37f726?{'count':_0x4af05d,'rows':_0x37f726}:null;}})[_0x14a8('0x23')](respondWithResult(_0x54ee4e,null))[_0x14a8('0x47')](handleError(_0x54ee4e,null));};exports[_0x14a8('0x4d')]=function(_0xedbbee,_0x235d80,_0xdfccd6){var _0x5f14d9={};var _0x2c12ee={};var _0x4d3de9;var _0x1758ab;return db[_0x14a8('0x2b')][_0x14a8('0x4e')]({'where':{'id':_0xedbbee[_0x14a8('0x48')]['id']}})['then'](handleEntityNotFound(_0x235d80,null))[_0x14a8('0x23')](function(_0x4f3b46){if(_0x4f3b46){_0x4d3de9=_0x4f3b46;_0x2c12ee['model']=_[_0x14a8('0x42')](db[_0x14a8('0x4a')][_0x14a8('0x2c')]);_0x2c12ee['query']=_[_0x14a8('0x42')](_0xedbbee['query']);_0x2c12ee[_0x14a8('0x39')]=_[_0x14a8('0x32')](_0x2c12ee[_0x14a8('0x30')],_0x2c12ee[_0x14a8('0x31')]);_0x5f14d9[_0x14a8('0x34')]=_[_0x14a8('0x32')](_0x2c12ee[_0x14a8('0x30')],qs[_0x14a8('0x33')](_0xedbbee['query']['fields']));_0x5f14d9['attributes']=_0x5f14d9[_0x14a8('0x34')][_0x14a8('0x4c')]?_0x5f14d9[_0x14a8('0x34')]:_0x2c12ee[_0x14a8('0x30')];_0x5f14d9['order']=qs[_0x14a8('0x38')](_0xedbbee[_0x14a8('0x31')][_0x14a8('0x38')]);_0x5f14d9['where']=qs[_0x14a8('0x39')](_[_0x14a8('0x4b')](_0xedbbee[_0x14a8('0x31')],_0x2c12ee[_0x14a8('0x39')]));if(_0xedbbee[_0x14a8('0x31')][_0x14a8('0x3c')]){_0x5f14d9[_0x14a8('0x3b')]=_['merge'](_0x5f14d9[_0x14a8('0x3b')],{'$or':_[_0x14a8('0x2a')](_0x5f14d9[_0x14a8('0x34')],function(_0x353cbf){var _0x108554={};_0x108554[_0x353cbf]={'$like':'%'+_0xedbbee['query']['filter']+'%'};return _0x108554;})});}_0x5f14d9=_[_0x14a8('0x3a')]({},_0x5f14d9,_0xedbbee[_0x14a8('0x3d')]);return _0x4d3de9['getSubjects'](_0x5f14d9);}})[_0x14a8('0x23')](function(_0x6541d6){if(_0x6541d6){_0x1758ab=_0x6541d6[_0x14a8('0x4c')];if(!_0xedbbee[_0x14a8('0x31')]['hasOwnProperty'](_0x14a8('0x36'))){_0x5f14d9[_0x14a8('0x1b')]=qs[_0x14a8('0x1b')](_0xedbbee[_0x14a8('0x31')]['limit']);_0x5f14d9[_0x14a8('0x1c')]=qs['offset'](_0xedbbee[_0x14a8('0x31')][_0x14a8('0x1c')]);}return _0x4d3de9[_0x14a8('0x4d')](_0x5f14d9);}})['then'](function(_0x528c2f){if(_0x528c2f){return _0x528c2f?{'count':_0x1758ab,'rows':_0x528c2f}:null;}})[_0x14a8('0x23')](respondWithResult(_0x235d80,null))['catch'](handleError(_0x235d80,null));};exports[_0x14a8('0x4f')]=function(_0x4f5333,_0x5883e1,_0x26d19c){var _0x26bcee={};var _0x441f58={};var _0x2d81bc;var _0x10104a;return db[_0x14a8('0x2b')][_0x14a8('0x4e')]({'where':{'id':_0x4f5333[_0x14a8('0x48')]['id']}})[_0x14a8('0x23')](handleEntityNotFound(_0x5883e1,null))[_0x14a8('0x23')](function(_0x12c1f0){if(_0x12c1f0){_0x2d81bc=_0x12c1f0;_0x441f58[_0x14a8('0x30')]=_[_0x14a8('0x42')](db[_0x14a8('0x4a')][_0x14a8('0x2c')]);_0x441f58[_0x14a8('0x31')]=_[_0x14a8('0x42')](_0x4f5333[_0x14a8('0x31')]);_0x441f58[_0x14a8('0x39')]=_[_0x14a8('0x32')](_0x441f58[_0x14a8('0x30')],_0x441f58[_0x14a8('0x31')]);_0x26bcee[_0x14a8('0x34')]=_['intersection'](_0x441f58[_0x14a8('0x30')],qs[_0x14a8('0x33')](_0x4f5333[_0x14a8('0x31')][_0x14a8('0x33')]));_0x26bcee['attributes']=_0x26bcee['attributes'][_0x14a8('0x4c')]?_0x26bcee[_0x14a8('0x34')]:_0x441f58[_0x14a8('0x30')];_0x26bcee[_0x14a8('0x37')]=qs[_0x14a8('0x38')](_0x4f5333[_0x14a8('0x31')][_0x14a8('0x38')]);_0x26bcee[_0x14a8('0x3b')]=qs['filters'](_['pick'](_0x4f5333[_0x14a8('0x31')],_0x441f58[_0x14a8('0x39')]));if(_0x4f5333[_0x14a8('0x31')][_0x14a8('0x3c')]){_0x26bcee[_0x14a8('0x3b')]=_[_0x14a8('0x3a')](_0x26bcee['where'],{'$or':_['map'](_0x26bcee[_0x14a8('0x34')],function(_0x28cf8f){var _0x59bf93={};_0x59bf93[_0x28cf8f]={'$like':'%'+_0x4f5333['query'][_0x14a8('0x3c')]+'%'};return _0x59bf93;})});}_0x26bcee=_[_0x14a8('0x3a')]({},_0x26bcee,_0x4f5333[_0x14a8('0x3d')]);return _0x2d81bc[_0x14a8('0x4f')](_0x26bcee);}})['then'](function(_0x46f43f){if(_0x46f43f){_0x10104a=_0x46f43f[_0x14a8('0x4c')];if(!_0x4f5333['query'][_0x14a8('0x35')]('nolimit')){_0x26bcee[_0x14a8('0x1b')]=qs[_0x14a8('0x1b')](_0x4f5333['query']['limit']);_0x26bcee[_0x14a8('0x1c')]=qs[_0x14a8('0x1c')](_0x4f5333[_0x14a8('0x31')]['offset']);}return _0x2d81bc[_0x14a8('0x4f')](_0x26bcee);}})[_0x14a8('0x23')](function(_0x57442b){if(_0x57442b){return _0x57442b?{'count':_0x10104a,'rows':_0x57442b}:null;}})[_0x14a8('0x23')](respondWithResult(_0x5883e1,null))[_0x14a8('0x47')](handleError(_0x5883e1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d94140d..be77739 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 _0xd1eb=['./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37c199,_0x5740c7){var _0x279b3b=function(_0xe16e78){while(--_0xe16e78){_0x37c199['push'](_0x37c199['shift']());}};_0x279b3b(++_0x5740c7);}(_0xd1eb,0x18d));var _0xbd1e=function(_0x2c51d8,_0x1c53c0){_0x2c51d8=_0x2c51d8-0x0;var _0x546e7b=_0xd1eb[_0x2c51d8];return _0x546e7b;};'use strict';var _=require(_0xbd1e('0x0'));var util=require(_0xbd1e('0x1'));var logger=require(_0xbd1e('0x2'))('api');var moment=require(_0xbd1e('0x3'));var BPromise=require(_0xbd1e('0x4'));var rp=require(_0xbd1e('0x5'));var fs=require('fs');var path=require(_0xbd1e('0x6'));var rimraf=require(_0xbd1e('0x7'));var config=require(_0xbd1e('0x8'));var attributes=require(_0xbd1e('0x9'));module[_0xbd1e('0xa')]=function(_0x2da33f,_0x3eb447){return _0x2da33f[_0xbd1e('0xb')](_0xbd1e('0xc'),attributes,{'tableName':_0xbd1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfb8e=['define','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x3d6b4a,_0x3607f2){var _0x522316=function(_0x434d1c){while(--_0x434d1c){_0x3d6b4a['push'](_0x3d6b4a['shift']());}};_0x522316(++_0x3607f2);}(_0xfb8e,0x14d));var _0xefb8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfb8e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefb8('0x0'));var util=require(_0xefb8('0x1'));var logger=require(_0xefb8('0x2'))(_0xefb8('0x3'));var moment=require(_0xefb8('0x4'));var BPromise=require(_0xefb8('0x5'));var rp=require(_0xefb8('0x6'));var fs=require('fs');var path=require(_0xefb8('0x7'));var rimraf=require(_0xefb8('0x8'));var config=require(_0xefb8('0x9'));var attributes=require(_0xefb8('0xa'));module[_0xefb8('0xb')]=function(_0x53935e,_0x3334be){return _0x53935e[_0xefb8('0xc')](_0xefb8('0xd'),attributes,{'tableName':_0xefb8('0xe'),'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 746de6e..ed62fbf 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 _0x6406=['http','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x329ba9,_0x14e4b4){var _0x5217e8=function(_0x1aae2b){while(--_0x1aae2b){_0x329ba9['push'](_0x329ba9['shift']());}};_0x5217e8(++_0x14e4b4);}(_0x6406,0x19a));var _0x6640=function(_0x568427,_0x742280){_0x568427=_0x568427-0x0;var _0x3c2f86=_0x6406[_0x568427];return _0x3c2f86;};'use strict';var _=require('lodash');var util=require(_0x6640('0x0'));var moment=require(_0x6640('0x1'));var BPromise=require(_0x6640('0x2'));var rs=require(_0x6640('0x3'));var fs=require('fs');var Redis=require(_0x6640('0x4'));var db=require(_0x6640('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6640('0x6'))(_0x6640('0x7'));var config=require(_0x6640('0x8'));var jayson=require(_0x6640('0x9'));var client=jayson['client'][_0x6640('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11f1da,_0x1cb404,_0x41cf89){return new BPromise(function(_0x1a9bc4,_0x42b9ab){return client['request'](_0x11f1da,_0x41cf89)[_0x6640('0xb')](function(_0xde4b71){logger[_0x6640('0xc')](_0x6640('0xd'),_0x1cb404,_0x6640('0xe'));logger[_0x6640('0xf')](_0x6640('0x10'),_0x1cb404,_0x6640('0xe'),JSON['stringify'](_0xde4b71));if(_0xde4b71[_0x6640('0x11')]){if(_0xde4b71[_0x6640('0x11')]['code']===0x1f4){logger['error'](_0x6640('0xd'),_0x1cb404,_0xde4b71[_0x6640('0x11')][_0x6640('0x12')]);return _0x42b9ab(_0xde4b71[_0x6640('0x11')]['message']);}logger[_0x6640('0x11')](_0x6640('0xd'),_0x1cb404,_0xde4b71['error'][_0x6640('0x12')]);return _0x1a9bc4(_0xde4b71['error'][_0x6640('0x12')]);}else{logger[_0x6640('0xc')](_0x6640('0xd'),_0x1cb404,_0x6640('0xe'));_0x1a9bc4(_0xde4b71[_0x6640('0x13')][_0x6640('0x12')]);}})[_0x6640('0x14')](function(_0x596d3d){logger[_0x6640('0x11')](_0x6640('0xd'),_0x1cb404,_0x596d3d);_0x42b9ab(_0x596d3d);});});} \ No newline at end of file +var _0xc4ab=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2b2148,_0x55c818){var _0x26208c=function(_0x418575){while(--_0x418575){_0x2b2148['push'](_0x2b2148['shift']());}};_0x26208c(++_0x55c818);}(_0xc4ab,0x1eb));var _0xbc4a=function(_0x5547d3,_0x3bcfb1){_0x5547d3=_0x5547d3-0x0;var _0x2ae119=_0xc4ab[_0x5547d3];return _0x2ae119;};'use strict';var _=require(_0xbc4a('0x0'));var util=require(_0xbc4a('0x1'));var moment=require(_0xbc4a('0x2'));var BPromise=require(_0xbc4a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbc4a('0x4'));var db=require(_0xbc4a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbc4a('0x6'))(_0xbc4a('0x7'));var config=require(_0xbc4a('0x8'));var jayson=require(_0xbc4a('0x9'));var client=jayson[_0xbc4a('0xa')][_0xbc4a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x266b46,_0x2557bc,_0x52fab3){return new BPromise(function(_0x2b6c0a,_0x25b70d){return client[_0xbc4a('0xc')](_0x266b46,_0x52fab3)[_0xbc4a('0xd')](function(_0x165441){logger[_0xbc4a('0xe')](_0xbc4a('0xf'),_0x2557bc,_0xbc4a('0x10'));logger['debug'](_0xbc4a('0x11'),_0x2557bc,_0xbc4a('0x10'),JSON['stringify'](_0x165441));if(_0x165441[_0xbc4a('0x12')]){if(_0x165441[_0xbc4a('0x12')][_0xbc4a('0x13')]===0x1f4){logger[_0xbc4a('0x12')](_0xbc4a('0xf'),_0x2557bc,_0x165441[_0xbc4a('0x12')][_0xbc4a('0x14')]);return _0x25b70d(_0x165441[_0xbc4a('0x12')][_0xbc4a('0x14')]);}logger[_0xbc4a('0x12')](_0xbc4a('0xf'),_0x2557bc,_0x165441['error']['message']);return _0x2b6c0a(_0x165441[_0xbc4a('0x12')]['message']);}else{logger[_0xbc4a('0xe')](_0xbc4a('0xf'),_0x2557bc,_0xbc4a('0x10'));_0x2b6c0a(_0x165441[_0xbc4a('0x15')]['message']);}})[_0xbc4a('0x16')](function(_0x24b054){logger[_0xbc4a('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x2557bc,_0x24b054);_0x25b70d(_0x24b054);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 0999ce3..97f05de 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 _0x8b01=['index','show','post','create','/:id','update','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated'];(function(_0x93e6a1,_0x11e83d){var _0x37a194=function(_0x40144b){while(--_0x40144b){_0x93e6a1['push'](_0x93e6a1['shift']());}};_0x37a194(++_0x11e83d);}(_0x8b01,0x116));var _0x18b0=function(_0x3ac634,_0x353e18){_0x3ac634=_0x3ac634-0x0;var _0x4efc55=_0x8b01[_0x3ac634];return _0x4efc55;};'use strict';var multer=require(_0x18b0('0x0'));var util=require('util');var path=require(_0x18b0('0x1'));var timeout=require(_0x18b0('0x2'));var express=require(_0x18b0('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x18b0('0x4'));var interaction=require(_0x18b0('0x5'));var config=require(_0x18b0('0x6'));var controller=require(_0x18b0('0x7'));router[_0x18b0('0x8')]('/',auth[_0x18b0('0x9')](),controller[_0x18b0('0xa')]);router[_0x18b0('0x8')]('/:id',auth[_0x18b0('0x9')](),controller[_0x18b0('0xb')]);router[_0x18b0('0xc')]('/',auth[_0x18b0('0x9')](),controller[_0x18b0('0xd')]);router['put'](_0x18b0('0xe'),auth[_0x18b0('0x9')](),controller[_0x18b0('0xf')]);router['delete'](_0x18b0('0xe'),auth['isAuthenticated'](),controller[_0x18b0('0x10')]);module[_0x18b0('0x11')]=router; \ No newline at end of file +var _0xb11b=['delete','exports','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x2a7d79,_0x230977){var _0x16a5a7=function(_0x97e2da){while(--_0x97e2da){_0x2a7d79['push'](_0x2a7d79['shift']());}};_0x16a5a7(++_0x230977);}(_0xb11b,0x123));var _0xbb11=function(_0x44c568,_0x416971){_0x44c568=_0x44c568-0x0;var _0x3d5021=_0xb11b[_0x44c568];return _0x3d5021;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbb11('0x0'));var timeout=require(_0xbb11('0x1'));var express=require('express');var router=express[_0xbb11('0x2')]();var fs_extra=require(_0xbb11('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbb11('0x4'));var config=require(_0xbb11('0x5'));var controller=require(_0xbb11('0x6'));router[_0xbb11('0x7')]('/',auth[_0xbb11('0x8')](),controller[_0xbb11('0x9')]);router[_0xbb11('0x7')](_0xbb11('0xa'),auth[_0xbb11('0x8')](),controller[_0xbb11('0xb')]);router['post']('/',auth[_0xbb11('0x8')](),controller[_0xbb11('0xc')]);router[_0xbb11('0xd')](_0xbb11('0xa'),auth['isAuthenticated'](),controller[_0xbb11('0xe')]);router[_0xbb11('0xf')](_0xbb11('0xa'),auth[_0xbb11('0x8')](),controller['destroy']);module[_0xbb11('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f34339c..b2ca976 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 _0x8afa=['STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','string'];(function(_0x2f4f25,_0x592d31){var _0x6a112a=function(_0x112d68){while(--_0x112d68){_0x2f4f25['push'](_0x2f4f25['shift']());}};_0x6a112a(++_0x592d31);}(_0x8afa,0x1a1));var _0xa8af=function(_0x318c43,_0x40ae1e){_0x318c43=_0x318c43-0x0;var _0xda449a=_0x8afa[_0x318c43];return _0xda449a;};'use strict';var Sequelize=require(_0xa8af('0x0'));module[_0xa8af('0x1')]={'type':{'type':Sequelize[_0xa8af('0x2')]('string',_0xa8af('0x3'),'customVariable',_0xa8af('0x4'),'picklist'),'defaultValue':_0xa8af('0x5')},'content':{'type':Sequelize[_0xa8af('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0xa8af('0x3'),_0xa8af('0x7'))},'keyContent':{'type':Sequelize[_0xa8af('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa8af('0x6')]},'customField':{'type':Sequelize[_0xa8af('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa8af('0x6')]}}; \ No newline at end of file +var _0xd339=['ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x526074,_0x5e5d09){var _0x83c6c8=function(_0x571483){while(--_0x571483){_0x526074['push'](_0x526074['shift']());}};_0x83c6c8(++_0x5e5d09);}(_0xd339,0x103));var _0x9d33=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xd339[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x9d33('0x0'));module[_0x9d33('0x1')]={'type':{'type':Sequelize[_0x9d33('0x2')]('string',_0x9d33('0x3'),_0x9d33('0x4'),_0x9d33('0x5'),'picklist'),'defaultValue':_0x9d33('0x6')},'content':{'type':Sequelize[_0x9d33('0x7')]},'key':{'type':Sequelize[_0x9d33('0x7')]},'keyType':{'type':Sequelize[_0x9d33('0x2')](_0x9d33('0x6'),_0x9d33('0x3'),_0x9d33('0x4'))},'keyContent':{'type':Sequelize[_0x9d33('0x7')]},'idField':{'type':Sequelize[_0x9d33('0x7')]},'nameField':{'type':Sequelize[_0x9d33('0x7')]},'customField':{'type':Sequelize[_0x9d33('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9d33('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index be5194c..dfe4eda 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 _0xc0d9=['path','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','end','error','stack','name','map','VtigerField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4f5dfd,_0x39ea52){var _0x315d44=function(_0x3056f6){while(--_0x3056f6){_0x4f5dfd['push'](_0x4f5dfd['shift']());}};_0x315d44(++_0x39ea52);}(_0xc0d9,0x123));var _0x9c0d=function(_0x5c3b49,_0x3fd746){_0x5c3b49=_0x5c3b49-0x0;var _0x1e2dfa=_0xc0d9[_0x5c3b49];return _0x1e2dfa;};'use strict';var emlformat=require(_0x9c0d('0x0'));var rimraf=require(_0x9c0d('0x1'));var zipdir=require(_0x9c0d('0x2'));var jsonpatch=require(_0x9c0d('0x3'));var rp=require(_0x9c0d('0x4'));var moment=require(_0x9c0d('0x5'));var BPromise=require(_0x9c0d('0x6'));var Mustache=require(_0x9c0d('0x7'));var util=require(_0x9c0d('0x8'));var path=require(_0x9c0d('0x9'));var sox=require('sox');var csv=require(_0x9c0d('0xa'));var ejs=require(_0x9c0d('0xb'));var fs=require('fs');var fs_extra=require(_0x9c0d('0xc'));var _=require(_0x9c0d('0xd'));var squel=require(_0x9c0d('0xe'));var crypto=require(_0x9c0d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x9c0d('0x10'));var toCsv=require(_0x9c0d('0xa'));var querystring=require('querystring');var Papa=require(_0x9c0d('0x11'));var Redis=require(_0x9c0d('0x12'));var authService=require(_0x9c0d('0x13'));var qs=require(_0x9c0d('0x14'));var as=require(_0x9c0d('0x15'));var hardwareService=require(_0x9c0d('0x16'));var logger=require(_0x9c0d('0x17'))(_0x9c0d('0x18'));var utils=require(_0x9c0d('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9c0d('0x1a'));var db=require(_0x9c0d('0x1b'))['db'];function respondWithStatusCode(_0x35d6be,_0x202c68){_0x202c68=_0x202c68||0xcc;return function(_0x2ca7af){if(_0x2ca7af){return _0x35d6be[_0x9c0d('0x1c')](_0x202c68);}return _0x35d6be['status'](_0x202c68)['end']();};}function respondWithResult(_0x544069,_0x3c1fde){_0x3c1fde=_0x3c1fde||0xc8;return function(_0xf8fa90){if(_0xf8fa90){return _0x544069[_0x9c0d('0x1d')](_0x3c1fde)[_0x9c0d('0x1e')](_0xf8fa90);}};}function respondWithFilteredResult(_0x2a7062,_0x303777){return function(_0x48f6c1){if(_0x48f6c1){var _0x1ea224=typeof _0x303777[_0x9c0d('0x1f')]===_0x9c0d('0x20')&&typeof _0x303777['limit']===_0x9c0d('0x20');var _0x172162=_0x48f6c1[_0x9c0d('0x21')];var _0x2be453=_0x1ea224?0x0:_0x303777[_0x9c0d('0x1f')];var _0x1f1d0a=_0x1ea224?_0x48f6c1[_0x9c0d('0x21')]:_0x303777[_0x9c0d('0x1f')]+_0x303777[_0x9c0d('0x22')];var _0x2383e8;if(_0x1f1d0a>=_0x172162){_0x1f1d0a=_0x172162;_0x2383e8=0xc8;}else{_0x2383e8=0xce;}_0x2a7062[_0x9c0d('0x1d')](_0x2383e8);return _0x2a7062[_0x9c0d('0x23')]('Content-Range',_0x2be453+'-'+_0x1f1d0a+'/'+_0x172162)[_0x9c0d('0x1e')](_0x48f6c1);}return null;};}function patchUpdates(_0x52610c){return function(_0x574bc8){try{jsonpatch['apply'](_0x574bc8,_0x52610c,!![]);}catch(_0x4ce60a){return BPromise[_0x9c0d('0x24')](_0x4ce60a);}return _0x574bc8[_0x9c0d('0x25')]();};}function saveUpdates(_0x2a21f7,_0x452039){return function(_0x4ea1ea){if(_0x4ea1ea){return _0x4ea1ea[_0x9c0d('0x26')](_0x2a21f7)['then'](function(_0x4baa51){return _0x4baa51;});}return null;};}function removeEntity(_0xafc4e,_0x102575){return function(_0x18cf36){if(_0x18cf36){return _0x18cf36[_0x9c0d('0x27')]()[_0x9c0d('0x28')](function(){_0xafc4e[_0x9c0d('0x1d')](0xcc)[_0x9c0d('0x29')]();});}};}function handleEntityNotFound(_0x576879,_0x33245b){return function(_0x31c1b8){if(!_0x31c1b8){_0x576879['sendStatus'](0x194);}return _0x31c1b8;};}function handleError(_0x4ebceb,_0x4e6194){_0x4e6194=_0x4e6194||0x1f4;return function(_0x42482f){logger[_0x9c0d('0x2a')](_0x42482f[_0x9c0d('0x2b')]);if(_0x42482f['name']){delete _0x42482f[_0x9c0d('0x2c')];}_0x4ebceb[_0x9c0d('0x1d')](_0x4e6194)['send'](_0x42482f);};}exports['index']=function(_0xc7daca,_0x324e23){var _0x5c4d14={},_0x4f7327={},_0x64c4f0={'count':0x0,'rows':[]};var _0x192e7e=_[_0x9c0d('0x2d')](db[_0x9c0d('0x2e')][_0x9c0d('0x2f')],function(_0x54d501){return{'name':_0x54d501[_0x9c0d('0x30')],'type':_0x54d501[_0x9c0d('0x31')][_0x9c0d('0x32')]};});_0x4f7327['model']=_[_0x9c0d('0x2d')](_0x192e7e,_0x9c0d('0x2c'));_0x4f7327[_0x9c0d('0x33')]=_[_0x9c0d('0x34')](_0xc7daca[_0x9c0d('0x33')]);_0x4f7327[_0x9c0d('0x35')]=_[_0x9c0d('0x36')](_0x4f7327['model'],_0x4f7327['query']);_0x5c4d14['attributes']=_['intersection'](_0x4f7327[_0x9c0d('0x37')],qs[_0x9c0d('0x38')](_0xc7daca[_0x9c0d('0x33')]['fields']));_0x5c4d14['attributes']=_0x5c4d14[_0x9c0d('0x39')][_0x9c0d('0x3a')]?_0x5c4d14['attributes']:_0x4f7327[_0x9c0d('0x37')];if(!_0xc7daca[_0x9c0d('0x33')]['hasOwnProperty'](_0x9c0d('0x3b'))){_0x5c4d14[_0x9c0d('0x22')]=qs[_0x9c0d('0x22')](_0xc7daca['query'][_0x9c0d('0x22')]);_0x5c4d14[_0x9c0d('0x1f')]=qs[_0x9c0d('0x1f')](_0xc7daca[_0x9c0d('0x33')][_0x9c0d('0x1f')]);}_0x5c4d14['order']=qs[_0x9c0d('0x3c')](_0xc7daca[_0x9c0d('0x33')][_0x9c0d('0x3c')]);_0x5c4d14[_0x9c0d('0x3d')]=qs[_0x9c0d('0x35')](_['pick'](_0xc7daca['query'],_0x4f7327[_0x9c0d('0x35')]),_0x192e7e);if(_0xc7daca[_0x9c0d('0x33')][_0x9c0d('0x3e')]){_0x5c4d14[_0x9c0d('0x3d')]=_[_0x9c0d('0x3f')](_0x5c4d14[_0x9c0d('0x3d')],{'$or':_[_0x9c0d('0x2d')](_0x192e7e,function(_0x59e99c){if(_0x59e99c[_0x9c0d('0x31')]!==_0x9c0d('0x40')){var _0x2965c3={};_0x2965c3[_0x59e99c[_0x9c0d('0x2c')]]={'$like':'%'+_0xc7daca['query'][_0x9c0d('0x3e')]+'%'};return _0x2965c3;}})});}_0x5c4d14=_['merge']({},_0x5c4d14,_0xc7daca[_0x9c0d('0x41')]);var _0x2dc99d={'where':_0x5c4d14[_0x9c0d('0x3d')]};return db[_0x9c0d('0x2e')][_0x9c0d('0x21')](_0x2dc99d)[_0x9c0d('0x28')](function(_0x1a69af){_0x64c4f0[_0x9c0d('0x21')]=_0x1a69af;if(_0xc7daca[_0x9c0d('0x33')]['includeAll']){_0x5c4d14[_0x9c0d('0x42')]=[{'all':!![]}];}return db[_0x9c0d('0x2e')][_0x9c0d('0x43')](_0x5c4d14);})['then'](function(_0x3edde3){_0x64c4f0[_0x9c0d('0x44')]=_0x3edde3;return _0x64c4f0;})[_0x9c0d('0x28')](respondWithFilteredResult(_0x324e23,_0x5c4d14))[_0x9c0d('0x45')](handleError(_0x324e23,null));};exports['show']=function(_0x549537,_0x262a67){var _0x4779ce={'raw':!![],'where':{'id':_0x549537[_0x9c0d('0x46')]['id']}},_0x2eec52={};_0x2eec52[_0x9c0d('0x37')]=_['keys'](db[_0x9c0d('0x2e')][_0x9c0d('0x2f')]);_0x2eec52['query']=_[_0x9c0d('0x34')](_0x549537[_0x9c0d('0x33')]);_0x2eec52[_0x9c0d('0x35')]=_[_0x9c0d('0x36')](_0x2eec52[_0x9c0d('0x37')],_0x2eec52['query']);_0x4779ce['attributes']=_['intersection'](_0x2eec52[_0x9c0d('0x37')],qs['fields'](_0x549537['query']['fields']));_0x4779ce[_0x9c0d('0x39')]=_0x4779ce[_0x9c0d('0x39')][_0x9c0d('0x3a')]?_0x4779ce[_0x9c0d('0x39')]:_0x2eec52[_0x9c0d('0x37')];if(_0x549537[_0x9c0d('0x33')][_0x9c0d('0x47')]){_0x4779ce[_0x9c0d('0x42')]=[{'all':!![]}];}_0x4779ce=_['merge']({},_0x4779ce,_0x549537['options']);return db[_0x9c0d('0x2e')][_0x9c0d('0x48')](_0x4779ce)[_0x9c0d('0x28')](handleEntityNotFound(_0x262a67,null))[_0x9c0d('0x28')](respondWithResult(_0x262a67,null))[_0x9c0d('0x45')](handleError(_0x262a67,null));};exports[_0x9c0d('0x49')]=function(_0x443f3a,_0x147a8f){return db[_0x9c0d('0x2e')][_0x9c0d('0x49')](_0x443f3a[_0x9c0d('0x4a')],{})['then'](respondWithResult(_0x147a8f,0xc9))[_0x9c0d('0x45')](handleError(_0x147a8f,null));};exports['update']=function(_0x4eb794,_0xe8bc26){if(_0x4eb794[_0x9c0d('0x4a')]['id']){delete _0x4eb794['body']['id'];}return db[_0x9c0d('0x2e')][_0x9c0d('0x48')]({'where':{'id':_0x4eb794[_0x9c0d('0x46')]['id']}})[_0x9c0d('0x28')](handleEntityNotFound(_0xe8bc26,null))['then'](saveUpdates(_0x4eb794[_0x9c0d('0x4a')],null))['then'](respondWithResult(_0xe8bc26,null))['catch'](handleError(_0xe8bc26,null));};exports[_0x9c0d('0x27')]=function(_0x33d909,_0x5e6fcb){return db['VtigerField']['find']({'where':{'id':_0x33d909[_0x9c0d('0x46')]['id']}})[_0x9c0d('0x28')](handleEntityNotFound(_0x5e6fcb,null))['then'](removeEntity(_0x5e6fcb,null))[_0x9c0d('0x45')](handleError(_0x5e6fcb,null));}; \ No newline at end of file +var _0x4c03=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','options','then','includeAll','include','rows','show','catch','create','body','update','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x4dc849,_0x16684c){var _0x530af8=function(_0x182b7c){while(--_0x182b7c){_0x4dc849['push'](_0x4dc849['shift']());}};_0x530af8(++_0x16684c);}(_0x4c03,0x17d));var _0x34c0=function(_0x446f5a,_0x1d910e){_0x446f5a=_0x446f5a-0x0;var _0x328276=_0x4c03[_0x446f5a];return _0x328276;};'use strict';var emlformat=require(_0x34c0('0x0'));var rimraf=require(_0x34c0('0x1'));var zipdir=require(_0x34c0('0x2'));var jsonpatch=require(_0x34c0('0x3'));var rp=require(_0x34c0('0x4'));var moment=require(_0x34c0('0x5'));var BPromise=require(_0x34c0('0x6'));var Mustache=require(_0x34c0('0x7'));var util=require(_0x34c0('0x8'));var path=require(_0x34c0('0x9'));var sox=require('sox');var csv=require(_0x34c0('0xa'));var ejs=require(_0x34c0('0xb'));var fs=require('fs');var fs_extra=require(_0x34c0('0xc'));var _=require(_0x34c0('0xd'));var squel=require(_0x34c0('0xe'));var crypto=require(_0x34c0('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x34c0('0x10'));var toCsv=require('to-csv');var querystring=require(_0x34c0('0x11'));var Papa=require(_0x34c0('0x12'));var Redis=require(_0x34c0('0x13'));var authService=require(_0x34c0('0x14'));var qs=require(_0x34c0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x34c0('0x16'));var logger=require(_0x34c0('0x17'))(_0x34c0('0x18'));var utils=require(_0x34c0('0x19'));var config=require(_0x34c0('0x1a'));var licenseUtil=require(_0x34c0('0x1b'));var db=require(_0x34c0('0x1c'))['db'];function respondWithStatusCode(_0x2e86fa,_0x4b1acd){_0x4b1acd=_0x4b1acd||0xcc;return function(_0x4824a8){if(_0x4824a8){return _0x2e86fa[_0x34c0('0x1d')](_0x4b1acd);}return _0x2e86fa[_0x34c0('0x1e')](_0x4b1acd)[_0x34c0('0x1f')]();};}function respondWithResult(_0x44a1d1,_0x6c05b1){_0x6c05b1=_0x6c05b1||0xc8;return function(_0x1324ba){if(_0x1324ba){return _0x44a1d1[_0x34c0('0x1e')](_0x6c05b1)[_0x34c0('0x20')](_0x1324ba);}};}function respondWithFilteredResult(_0x1e83cf,_0x29f4cf){return function(_0x3961e2){if(_0x3961e2){var _0x36ae29=typeof _0x29f4cf[_0x34c0('0x21')]===_0x34c0('0x22')&&typeof _0x29f4cf[_0x34c0('0x23')]===_0x34c0('0x22');var _0x32cb08=_0x3961e2['count'];var _0x141f3c=_0x36ae29?0x0:_0x29f4cf[_0x34c0('0x21')];var _0x582943=_0x36ae29?_0x3961e2[_0x34c0('0x24')]:_0x29f4cf[_0x34c0('0x21')]+_0x29f4cf['limit'];var _0x32f665;if(_0x582943>=_0x32cb08){_0x582943=_0x32cb08;_0x32f665=0xc8;}else{_0x32f665=0xce;}_0x1e83cf[_0x34c0('0x1e')](_0x32f665);return _0x1e83cf[_0x34c0('0x25')](_0x34c0('0x26'),_0x141f3c+'-'+_0x582943+'/'+_0x32cb08)[_0x34c0('0x20')](_0x3961e2);}return null;};}function patchUpdates(_0x21e099){return function(_0xa554ea){try{jsonpatch['apply'](_0xa554ea,_0x21e099,!![]);}catch(_0x20b031){return BPromise[_0x34c0('0x27')](_0x20b031);}return _0xa554ea[_0x34c0('0x28')]();};}function saveUpdates(_0x227889,_0x236610){return function(_0x49b586){if(_0x49b586){return _0x49b586['update'](_0x227889)['then'](function(_0x6a7428){return _0x6a7428;});}return null;};}function removeEntity(_0x485675,_0x525814){return function(_0x569fe6){if(_0x569fe6){return _0x569fe6[_0x34c0('0x29')]()['then'](function(){_0x485675[_0x34c0('0x1e')](0xcc)[_0x34c0('0x1f')]();});}};}function handleEntityNotFound(_0x47efff,_0x3b5a4d){return function(_0x52b5e7){if(!_0x52b5e7){_0x47efff['sendStatus'](0x194);}return _0x52b5e7;};}function handleError(_0xcfbca0,_0x2067c5){_0x2067c5=_0x2067c5||0x1f4;return function(_0x7e90b7){logger[_0x34c0('0x2a')](_0x7e90b7[_0x34c0('0x2b')]);if(_0x7e90b7[_0x34c0('0x2c')]){delete _0x7e90b7['name'];}_0xcfbca0[_0x34c0('0x1e')](_0x2067c5)[_0x34c0('0x2d')](_0x7e90b7);};}exports[_0x34c0('0x2e')]=function(_0x8d5e25,_0x1e0f3b){var _0x57ec1d={},_0x3e39c0={},_0x1a8367={'count':0x0,'rows':[]};var _0x3a6aea=_[_0x34c0('0x2f')](db[_0x34c0('0x30')][_0x34c0('0x31')],function(_0x1ecef3){return{'name':_0x1ecef3[_0x34c0('0x32')],'type':_0x1ecef3['type']['key']};});_0x3e39c0[_0x34c0('0x33')]=_['map'](_0x3a6aea,_0x34c0('0x2c'));_0x3e39c0[_0x34c0('0x34')]=_[_0x34c0('0x35')](_0x8d5e25['query']);_0x3e39c0['filters']=_[_0x34c0('0x36')](_0x3e39c0['model'],_0x3e39c0[_0x34c0('0x34')]);_0x57ec1d[_0x34c0('0x37')]=_[_0x34c0('0x36')](_0x3e39c0[_0x34c0('0x33')],qs[_0x34c0('0x38')](_0x8d5e25[_0x34c0('0x34')][_0x34c0('0x38')]));_0x57ec1d[_0x34c0('0x37')]=_0x57ec1d[_0x34c0('0x37')][_0x34c0('0x39')]?_0x57ec1d[_0x34c0('0x37')]:_0x3e39c0[_0x34c0('0x33')];if(!_0x8d5e25[_0x34c0('0x34')][_0x34c0('0x3a')](_0x34c0('0x3b'))){_0x57ec1d[_0x34c0('0x23')]=qs['limit'](_0x8d5e25[_0x34c0('0x34')][_0x34c0('0x23')]);_0x57ec1d['offset']=qs[_0x34c0('0x21')](_0x8d5e25[_0x34c0('0x34')]['offset']);}_0x57ec1d[_0x34c0('0x3c')]=qs['sort'](_0x8d5e25[_0x34c0('0x34')][_0x34c0('0x3d')]);_0x57ec1d['where']=qs['filters'](_[_0x34c0('0x3e')](_0x8d5e25[_0x34c0('0x34')],_0x3e39c0[_0x34c0('0x3f')]),_0x3a6aea);if(_0x8d5e25['query'][_0x34c0('0x40')]){_0x57ec1d[_0x34c0('0x41')]=_[_0x34c0('0x42')](_0x57ec1d['where'],{'$or':_[_0x34c0('0x2f')](_0x3a6aea,function(_0x5918a9){if(_0x5918a9[_0x34c0('0x43')]!=='VIRTUAL'){var _0x5e8526={};_0x5e8526[_0x5918a9[_0x34c0('0x2c')]]={'$like':'%'+_0x8d5e25[_0x34c0('0x34')][_0x34c0('0x40')]+'%'};return _0x5e8526;}})});}_0x57ec1d=_['merge']({},_0x57ec1d,_0x8d5e25[_0x34c0('0x44')]);var _0x5493b1={'where':_0x57ec1d[_0x34c0('0x41')]};return db[_0x34c0('0x30')][_0x34c0('0x24')](_0x5493b1)[_0x34c0('0x45')](function(_0x2cce0e){_0x1a8367[_0x34c0('0x24')]=_0x2cce0e;if(_0x8d5e25[_0x34c0('0x34')][_0x34c0('0x46')]){_0x57ec1d[_0x34c0('0x47')]=[{'all':!![]}];}return db[_0x34c0('0x30')]['findAll'](_0x57ec1d);})[_0x34c0('0x45')](function(_0x9b1926){_0x1a8367[_0x34c0('0x48')]=_0x9b1926;return _0x1a8367;})[_0x34c0('0x45')](respondWithFilteredResult(_0x1e0f3b,_0x57ec1d))['catch'](handleError(_0x1e0f3b,null));};exports[_0x34c0('0x49')]=function(_0x47cc32,_0x39058f){var _0x28a37b={'raw':!![],'where':{'id':_0x47cc32['params']['id']}},_0x49632b={};_0x49632b[_0x34c0('0x33')]=_[_0x34c0('0x35')](db[_0x34c0('0x30')][_0x34c0('0x31')]);_0x49632b[_0x34c0('0x34')]=_[_0x34c0('0x35')](_0x47cc32[_0x34c0('0x34')]);_0x49632b['filters']=_[_0x34c0('0x36')](_0x49632b[_0x34c0('0x33')],_0x49632b[_0x34c0('0x34')]);_0x28a37b[_0x34c0('0x37')]=_[_0x34c0('0x36')](_0x49632b['model'],qs[_0x34c0('0x38')](_0x47cc32[_0x34c0('0x34')][_0x34c0('0x38')]));_0x28a37b[_0x34c0('0x37')]=_0x28a37b[_0x34c0('0x37')][_0x34c0('0x39')]?_0x28a37b[_0x34c0('0x37')]:_0x49632b[_0x34c0('0x33')];if(_0x47cc32[_0x34c0('0x34')][_0x34c0('0x46')]){_0x28a37b[_0x34c0('0x47')]=[{'all':!![]}];}_0x28a37b=_[_0x34c0('0x42')]({},_0x28a37b,_0x47cc32[_0x34c0('0x44')]);return db['VtigerField']['find'](_0x28a37b)['then'](handleEntityNotFound(_0x39058f,null))['then'](respondWithResult(_0x39058f,null))[_0x34c0('0x4a')](handleError(_0x39058f,null));};exports[_0x34c0('0x4b')]=function(_0x2d31e5,_0x3c7e87){return db[_0x34c0('0x30')][_0x34c0('0x4b')](_0x2d31e5[_0x34c0('0x4c')],{})[_0x34c0('0x45')](respondWithResult(_0x3c7e87,0xc9))[_0x34c0('0x4a')](handleError(_0x3c7e87,null));};exports[_0x34c0('0x4d')]=function(_0x17a3a7,_0x33f4e8){if(_0x17a3a7['body']['id']){delete _0x17a3a7[_0x34c0('0x4c')]['id'];}return db[_0x34c0('0x30')][_0x34c0('0x4e')]({'where':{'id':_0x17a3a7[_0x34c0('0x4f')]['id']}})[_0x34c0('0x45')](handleEntityNotFound(_0x33f4e8,null))[_0x34c0('0x45')](saveUpdates(_0x17a3a7[_0x34c0('0x4c')],null))[_0x34c0('0x45')](respondWithResult(_0x33f4e8,null))[_0x34c0('0x4a')](handleError(_0x33f4e8,null));};exports['destroy']=function(_0x312146,_0x4a72b1){return db[_0x34c0('0x30')][_0x34c0('0x4e')]({'where':{'id':_0x312146[_0x34c0('0x4f')]['id']}})[_0x34c0('0x45')](handleEntityNotFound(_0x4a72b1,null))[_0x34c0('0x45')](removeEntity(_0x4a72b1,null))['catch'](handleError(_0x4a72b1,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 62eedda..23535d7 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 _0xd4a0=['rimraf','../../config/environment','./intVtigerField.attributes','exports','define','VtigerField','vtiger_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xd4a0,0x1bb));var _0x0d4a=function(_0x35bf99,_0x15a389){_0x35bf99=_0x35bf99-0x0;var _0x205da0=_0xd4a0[_0x35bf99];return _0x205da0;};'use strict';var _=require(_0x0d4a('0x0'));var util=require(_0x0d4a('0x1'));var logger=require(_0x0d4a('0x2'))(_0x0d4a('0x3'));var moment=require(_0x0d4a('0x4'));var BPromise=require(_0x0d4a('0x5'));var rp=require(_0x0d4a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0d4a('0x7'));var config=require(_0x0d4a('0x8'));var attributes=require(_0x0d4a('0x9'));module[_0x0d4a('0xa')]=function(_0x250450,_0x4d9cf8){return _0x250450[_0x0d4a('0xb')](_0x0d4a('0xc'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x0d4a('0xd'),'fields':['idField',_0x0d4a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa136=['moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerField.attributes','exports','define','vtiger_unique_index','idField','FieldId','util'];(function(_0x2d9945,_0x314a2d){var _0x2ba671=function(_0x120d2e){while(--_0x120d2e){_0x2d9945['push'](_0x2d9945['shift']());}};_0x2ba671(++_0x314a2d);}(_0xa136,0xfb));var _0x6a13=function(_0xe2dc9e,_0xeb3bc6){_0xe2dc9e=_0xe2dc9e-0x0;var _0x279417=_0xa136[_0xe2dc9e];return _0x279417;};'use strict';var _=require('lodash');var util=require(_0x6a13('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x6a13('0x1'));var BPromise=require(_0x6a13('0x2'));var rp=require(_0x6a13('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a13('0x4'));var config=require(_0x6a13('0x5'));var attributes=require(_0x6a13('0x6'));module[_0x6a13('0x7')]=function(_0x456408,_0x11da2c){return _0x456408[_0x6a13('0x8')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x6a13('0x9'),'fields':[_0x6a13('0xa'),_0x6a13('0xb')],'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 ea53aec..9ef3e19 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 _0x4843=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','error','message','info'];(function(_0x4b7391,_0x586f07){var _0x581212=function(_0x4e92c0){while(--_0x4e92c0){_0x4b7391['push'](_0x4b7391['shift']());}};_0x581212(++_0x586f07);}(_0x4843,0x12d));var _0x3484=function(_0x36a951,_0x1d62d){_0x36a951=_0x36a951-0x0;var _0x4964e7=_0x4843[_0x36a951];return _0x4964e7;};'use strict';var _=require(_0x3484('0x0'));var util=require(_0x3484('0x1'));var moment=require('moment');var BPromise=require(_0x3484('0x2'));var rs=require(_0x3484('0x3'));var fs=require('fs');var Redis=require(_0x3484('0x4'));var db=require(_0x3484('0x5'))['db'];var utils=require(_0x3484('0x6'));var logger=require(_0x3484('0x7'))('rpc');var config=require(_0x3484('0x8'));var jayson=require(_0x3484('0x9'));var client=jayson[_0x3484('0xa')][_0x3484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ea1f1,_0x16178e,_0x214dc6){return new BPromise(function(_0x32d339,_0x505d90){return client[_0x3484('0xc')](_0x4ea1f1,_0x214dc6)[_0x3484('0xd')](function(_0x69540f){logger['info'](_0x3484('0xe'),_0x16178e,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x16178e,_0x3484('0xf'),JSON['stringify'](_0x69540f));if(_0x69540f[_0x3484('0x10')]){if(_0x69540f[_0x3484('0x10')]['code']===0x1f4){logger[_0x3484('0x10')]('VtigerField,\x20%s,\x20%s',_0x16178e,_0x69540f['error'][_0x3484('0x11')]);return _0x505d90(_0x69540f[_0x3484('0x10')][_0x3484('0x11')]);}logger['error'](_0x3484('0xe'),_0x16178e,_0x69540f[_0x3484('0x10')][_0x3484('0x11')]);return _0x32d339(_0x69540f['error'][_0x3484('0x11')]);}else{logger[_0x3484('0x12')](_0x3484('0xe'),_0x16178e,'request\x20sent');_0x32d339(_0x69540f[_0x3484('0x13')][_0x3484('0x11')]);}})['catch'](function(_0x4c3649){logger[_0x3484('0x10')](_0x3484('0xe'),_0x16178e,_0x4c3649);_0x505d90(_0x4c3649);});});} \ No newline at end of file +var _0xb8ef=['request','info','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0x151922,_0x2a7f97){var _0x10d46b=function(_0x5d0de2){while(--_0x5d0de2){_0x151922['push'](_0x151922['shift']());}};_0x10d46b(++_0x2a7f97);}(_0xb8ef,0x129));var _0xfb8e=function(_0x320c85,_0x5282ae){_0x320c85=_0x320c85-0x0;var _0x318a3d=_0xb8ef[_0x320c85];return _0x318a3d;};'use strict';var _=require(_0xfb8e('0x0'));var util=require(_0xfb8e('0x1'));var moment=require('moment');var BPromise=require(_0xfb8e('0x2'));var rs=require(_0xfb8e('0x3'));var fs=require('fs');var Redis=require(_0xfb8e('0x4'));var db=require(_0xfb8e('0x5'))['db'];var utils=require(_0xfb8e('0x6'));var logger=require(_0xfb8e('0x7'))('rpc');var config=require(_0xfb8e('0x8'));var jayson=require(_0xfb8e('0x9'));var client=jayson['client'][_0xfb8e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3efd7c,_0x2f027a,_0x5d5703){return new BPromise(function(_0xbc535c,_0x52abab){return client[_0xfb8e('0xb')](_0x3efd7c,_0x5d5703)['then'](function(_0x2273c4){logger[_0xfb8e('0xc')]('VtigerField,\x20%s,\x20%s',_0x2f027a,_0xfb8e('0xd'));logger[_0xfb8e('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x2f027a,'request\x20sent',JSON[_0xfb8e('0xf')](_0x2273c4));if(_0x2273c4[_0xfb8e('0x10')]){if(_0x2273c4['error'][_0xfb8e('0x11')]===0x1f4){logger[_0xfb8e('0x10')](_0xfb8e('0x12'),_0x2f027a,_0x2273c4[_0xfb8e('0x10')][_0xfb8e('0x13')]);return _0x52abab(_0x2273c4[_0xfb8e('0x10')][_0xfb8e('0x13')]);}logger[_0xfb8e('0x10')](_0xfb8e('0x12'),_0x2f027a,_0x2273c4[_0xfb8e('0x10')][_0xfb8e('0x13')]);return _0xbc535c(_0x2273c4['error'][_0xfb8e('0x13')]);}else{logger[_0xfb8e('0xc')]('VtigerField,\x20%s,\x20%s',_0x2f027a,_0xfb8e('0xd'));_0xbc535c(_0x2273c4[_0xfb8e('0x14')][_0xfb8e('0x13')]);}})[_0xfb8e('0x15')](function(_0x35020d){logger[_0xfb8e('0x10')]('VtigerField,\x20%s,\x20%s',_0x2f027a,_0x35020d);_0x52abab(_0x35020d);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 887a621..44ecd8b 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 _0x15b5=['../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','post','create','addConfiguration','delete','destroy','exports','multer','fs-extra','../../components/auth/service'];(function(_0x15c93b,_0x52f50f){var _0x544bba=function(_0x40fcb7){while(--_0x40fcb7){_0x15c93b['push'](_0x15c93b['shift']());}};_0x544bba(++_0x52f50f);}(_0x15b5,0x1bf));var _0x515b=function(_0x31c19c,_0xbe4b70){_0x31c19c=_0x31c19c-0x0;var _0x1a87f7=_0x15b5[_0x31c19c];return _0x1a87f7;};'use strict';var multer=require(_0x515b('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x515b('0x1'));var auth=require(_0x515b('0x2'));var interaction=require(_0x515b('0x3'));var config=require(_0x515b('0x4'));var controller=require(_0x515b('0x5'));router[_0x515b('0x6')]('/',auth[_0x515b('0x7')](),controller[_0x515b('0x8')]);router['get'](_0x515b('0x9'),auth[_0x515b('0x7')](),controller['show']);router[_0x515b('0x6')](_0x515b('0xa'),auth[_0x515b('0x7')](),controller['getConfigurations']);router[_0x515b('0x6')](_0x515b('0xb'),auth[_0x515b('0x7')](),controller['getFields']);router[_0x515b('0xc')]('/',auth['isAuthenticated'](),controller[_0x515b('0xd')]);router[_0x515b('0xc')](_0x515b('0xa'),auth[_0x515b('0x7')](),controller[_0x515b('0xe')]);router['put'](_0x515b('0x9'),auth[_0x515b('0x7')](),controller['update']);router[_0x515b('0xf')](_0x515b('0x9'),auth[_0x515b('0x7')](),controller[_0x515b('0x10')]);module[_0x515b('0x11')]=router; \ No newline at end of file +var _0x94aa=['exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x94aa,0x65));var _0xa94a=function(_0xa973b6,_0x2ebd82){_0xa973b6=_0xa973b6-0x0;var _0x443b9e=_0x94aa[_0xa973b6];return _0x443b9e;};'use strict';var multer=require(_0xa94a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa94a('0x1'));var router=express[_0xa94a('0x2')]();var fs_extra=require(_0xa94a('0x3'));var auth=require(_0xa94a('0x4'));var interaction=require(_0xa94a('0x5'));var config=require('../../config/environment');var controller=require(_0xa94a('0x6'));router[_0xa94a('0x7')]('/',auth[_0xa94a('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa94a('0x7')](_0xa94a('0x9'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0xa94a('0xa'),auth[_0xa94a('0x8')](),controller[_0xa94a('0xb')]);router[_0xa94a('0xc')]('/',auth[_0xa94a('0x8')](),controller[_0xa94a('0xd')]);router['post'](_0xa94a('0x9'),auth[_0xa94a('0x8')](),controller[_0xa94a('0xe')]);router['put'](_0xa94a('0xf'),auth[_0xa94a('0x8')](),controller[_0xa94a('0x10')]);router[_0xa94a('0x11')]('/:id',auth[_0xa94a('0x8')](),controller[_0xa94a('0x12')]);module[_0xa94a('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4606c4e..9b3afb4 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 _0x7b84=['sequelize','exports','STRING','username','remoteUri','ENUM','password','token','integrationTab','newTab'];(function(_0x33a694,_0x9b6640){var _0x41ff01=function(_0x4c38b7){while(--_0x4c38b7){_0x33a694['push'](_0x33a694['shift']());}};_0x41ff01(++_0x9b6640);}(_0x7b84,0x17c));var _0x47b8=function(_0x42e338,_0x3e36a0){_0x42e338=_0x42e338-0x0;var _0x6770d3=_0x7b84[_0x42e338];return _0x6770d3;};'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')},'password':{'type':Sequelize[_0x47b8('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x47b8('0x2')],'unique':_0x47b8('0x4')},'authType':{'type':Sequelize[_0x47b8('0x5')](_0x47b8('0x6'),_0x47b8('0x7')),'defaultValue':_0x47b8('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x47b8('0x5')](_0x47b8('0x8'),_0x47b8('0x9')),'defaultValue':_0x47b8('0x8')}}; \ No newline at end of file +var _0xa24d=['integrationTab','sequelize','exports','STRING','username','remoteUri','ENUM','password'];(function(_0x98e821,_0x1725e0){var _0x4f27e9=function(_0x518a96){while(--_0x518a96){_0x98e821['push'](_0x98e821['shift']());}};_0x4f27e9(++_0x1725e0);}(_0xa24d,0x1c1));var _0xda24=function(_0x458709,_0x1981ea){_0x458709=_0x458709-0x0;var _0x48cbd7=_0xa24d[_0x458709];return _0x48cbd7;};'use strict';var Sequelize=require(_0xda24('0x0'));module[_0xda24('0x1')]={'name':{'type':Sequelize[_0xda24('0x2')]},'description':{'type':Sequelize[_0xda24('0x2')]},'username':{'type':Sequelize[_0xda24('0x2')],'unique':_0xda24('0x3')},'password':{'type':Sequelize[_0xda24('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xda24('0x2')],'unique':_0xda24('0x4')},'authType':{'type':Sequelize[_0xda24('0x5')](_0xda24('0x6'),'token'),'defaultValue':_0xda24('0x6')},'serverUrl':{'type':Sequelize[_0xda24('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xda24('0x7'),'newTab'),'defaultValue':_0xda24('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 07db731..8f804e1 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 _0x57f8=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','Basic\x20%s','headers','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','end','error','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x57f8,0x198));var _0x857f=function(_0xca8958,_0x25eed8){_0xca8958=_0xca8958-0x0;var _0x3d7165=_0x57f8[_0xca8958];return _0x3d7165;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e1eda,_0x2d5e26){_0x2d5e26=_0x2d5e26||0xcc;return function(_0x373333){if(_0x373333){return _0x2e1eda[_0x857f('0x1b')](_0x2d5e26);}return _0x2e1eda[_0x857f('0x1c')](_0x2d5e26)['end']();};}function respondWithResult(_0x4bc590,_0x3b09d9){_0x3b09d9=_0x3b09d9||0xc8;return function(_0x5f27b2){if(_0x5f27b2){return _0x4bc590[_0x857f('0x1c')](_0x3b09d9)['json'](_0x5f27b2);}};}function respondWithFilteredResult(_0x1d47bf,_0x134a4f){return function(_0x5c3a69){if(_0x5c3a69){var _0x27e8f1=typeof _0x134a4f[_0x857f('0x1d')]===_0x857f('0x1e')&&typeof _0x134a4f[_0x857f('0x1f')]===_0x857f('0x1e');var _0x38a3c2=_0x5c3a69[_0x857f('0x20')];var _0x429e23=_0x27e8f1?0x0:_0x134a4f[_0x857f('0x1d')];var _0x38a242=_0x27e8f1?_0x5c3a69[_0x857f('0x20')]:_0x134a4f['offset']+_0x134a4f[_0x857f('0x1f')];var _0x1e8fd4;if(_0x38a242>=_0x38a3c2){_0x38a242=_0x38a3c2;_0x1e8fd4=0xc8;}else{_0x1e8fd4=0xce;}_0x1d47bf['status'](_0x1e8fd4);return _0x1d47bf[_0x857f('0x21')](_0x857f('0x22'),_0x429e23+'-'+_0x38a242+'/'+_0x38a3c2)[_0x857f('0x23')](_0x5c3a69);}return null;};}function patchUpdates(_0x484035){return function(_0x57fa8b){try{jsonpatch[_0x857f('0x24')](_0x57fa8b,_0x484035,!![]);}catch(_0x8f278){return BPromise[_0x857f('0x25')](_0x8f278);}return _0x57fa8b['save']();};}function saveUpdates(_0x118237,_0x17a98e){return function(_0xdf8ac3){if(_0xdf8ac3){return _0xdf8ac3['update'](_0x118237)[_0x857f('0x26')](function(_0x14a8ce){return _0x14a8ce;});}return null;};}function removeEntity(_0x50bfb7,_0x3bc543){return function(_0x1a651f){if(_0x1a651f){return _0x1a651f[_0x857f('0x27')]()[_0x857f('0x26')](function(){_0x50bfb7[_0x857f('0x1c')](0xcc)[_0x857f('0x28')]();});}};}function handleEntityNotFound(_0x233a68,_0x2a89ba){return function(_0x181a9e){if(!_0x181a9e){_0x233a68[_0x857f('0x1b')](0x194);}return _0x181a9e;};}function handleError(_0x72f0aa,_0x4782ab){_0x4782ab=_0x4782ab||0x1f4;return function(_0x250731){logger[_0x857f('0x29')](_0x250731['stack']);if(_0x250731[_0x857f('0x2a')]){delete _0x250731[_0x857f('0x2a')];}_0x72f0aa[_0x857f('0x1c')](_0x4782ab)[_0x857f('0x2b')](_0x250731);};}exports['index']=function(_0x40c306,_0x57ceaa){var _0x1b405a={},_0x234048={},_0x45a37f={'count':0x0,'rows':[]};var _0x2ab814=_[_0x857f('0x2c')](db[_0x857f('0x2d')][_0x857f('0x2e')],function(_0xe79241){return{'name':_0xe79241[_0x857f('0x2f')],'type':_0xe79241[_0x857f('0x30')][_0x857f('0x31')]};});_0x234048[_0x857f('0x32')]=_[_0x857f('0x2c')](_0x2ab814,'name');_0x234048[_0x857f('0x33')]=_[_0x857f('0x34')](_0x40c306['query']);_0x234048[_0x857f('0x35')]=_[_0x857f('0x36')](_0x234048['model'],_0x234048[_0x857f('0x33')]);_0x1b405a[_0x857f('0x37')]=_['intersection'](_0x234048[_0x857f('0x32')],qs[_0x857f('0x38')](_0x40c306[_0x857f('0x33')][_0x857f('0x38')]));_0x1b405a['attributes']=_0x1b405a['attributes'][_0x857f('0x39')]?_0x1b405a[_0x857f('0x37')]:_0x234048['model'];if(!_0x40c306[_0x857f('0x33')]['hasOwnProperty'](_0x857f('0x3a'))){_0x1b405a[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x40c306[_0x857f('0x33')][_0x857f('0x1f')]);_0x1b405a['offset']=qs['offset'](_0x40c306[_0x857f('0x33')]['offset']);}_0x1b405a[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x40c306[_0x857f('0x33')]['sort']);_0x1b405a[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x40c306[_0x857f('0x33')],_0x234048[_0x857f('0x35')]),_0x2ab814);if(_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]){_0x1b405a['where']=_[_0x857f('0x40')](_0x1b405a[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x2ab814,function(_0x28ffe4){if(_0x28ffe4[_0x857f('0x30')]!==_0x857f('0x41')){var _0x447f28={};_0x447f28[_0x28ffe4['name']]={'$like':'%'+_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x447f28;}})});}_0x1b405a=_[_0x857f('0x40')]({},_0x1b405a,_0x40c306[_0x857f('0x42')]);var _0x196c95={'where':_0x1b405a[_0x857f('0x3d')]};return db['ZendeskAccount'][_0x857f('0x20')](_0x196c95)[_0x857f('0x26')](function(_0x167e9d){_0x45a37f[_0x857f('0x20')]=_0x167e9d;if(_0x40c306[_0x857f('0x33')][_0x857f('0x43')]){_0x1b405a[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2d')]['findAll'](_0x1b405a);})[_0x857f('0x26')](function(_0x223095){_0x45a37f[_0x857f('0x45')]=_0x223095;return _0x45a37f;})[_0x857f('0x26')](respondWithFilteredResult(_0x57ceaa,_0x1b405a))[_0x857f('0x46')](handleError(_0x57ceaa,null));};exports[_0x857f('0x47')]=function(_0x374b9f,_0x42d922){var _0xb4d7c2={'raw':![],'where':{'id':_0x374b9f[_0x857f('0x48')]['id']}},_0x3e2079={};_0x3e2079[_0x857f('0x32')]=_[_0x857f('0x34')](db[_0x857f('0x2d')]['rawAttributes']);_0x3e2079[_0x857f('0x33')]=_['keys'](_0x374b9f[_0x857f('0x33')]);_0x3e2079[_0x857f('0x35')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],_0x3e2079[_0x857f('0x33')]);_0xb4d7c2[_0x857f('0x37')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],qs[_0x857f('0x38')](_0x374b9f[_0x857f('0x33')][_0x857f('0x38')]));_0xb4d7c2['attributes']=_0xb4d7c2['attributes'][_0x857f('0x39')]?_0xb4d7c2['attributes']:_0x3e2079[_0x857f('0x32')];if(_0x374b9f['query'][_0x857f('0x43')]){_0xb4d7c2[_0x857f('0x44')]=[{'all':!![]}];}_0xb4d7c2=_[_0x857f('0x40')]({},_0xb4d7c2,_0x374b9f[_0x857f('0x42')]);return db[_0x857f('0x2d')][_0x857f('0x49')](_0xb4d7c2)[_0x857f('0x26')](handleEntityNotFound(_0x42d922,null))[_0x857f('0x26')](respondWithResult(_0x42d922,null))['catch'](handleError(_0x42d922,null));};exports[_0x857f('0x4a')]=function(_0x3b431d,_0x3806d4){return db[_0x857f('0x2d')]['create'](_0x3b431d[_0x857f('0x4b')],{})[_0x857f('0x26')](respondWithResult(_0x3806d4,0xc9))[_0x857f('0x46')](handleError(_0x3806d4,null));};exports[_0x857f('0x4c')]=function(_0x67563,_0x53baae){if(_0x67563[_0x857f('0x4b')]['id']){delete _0x67563[_0x857f('0x4b')]['id'];}return db['ZendeskAccount'][_0x857f('0x49')]({'where':{'id':_0x67563[_0x857f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53baae,null))[_0x857f('0x26')](saveUpdates(_0x67563['body'],null))[_0x857f('0x26')](respondWithResult(_0x53baae,null))[_0x857f('0x46')](handleError(_0x53baae,null));};exports[_0x857f('0x27')]=function(_0x2008d5,_0x58bf27){return db[_0x857f('0x2d')][_0x857f('0x49')]({'where':{'id':_0x2008d5[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x58bf27,null))[_0x857f('0x26')](removeEntity(_0x58bf27,null))['catch'](handleError(_0x58bf27,null));};exports[_0x857f('0x4d')]=function(_0x13ef75,_0x9d8273,_0x2670e6){var _0x3e24a5={};var _0x9edee5={};var _0x12712a;var _0x59164a;return db[_0x857f('0x2d')][_0x857f('0x4e')]({'where':{'id':_0x13ef75[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x9d8273,null))[_0x857f('0x26')](function(_0x153e4e){if(_0x153e4e){_0x12712a=_0x153e4e;_0x9edee5['model']=_[_0x857f('0x34')](db[_0x857f('0x4f')][_0x857f('0x2e')]);_0x9edee5[_0x857f('0x33')]=_[_0x857f('0x34')](_0x13ef75[_0x857f('0x33')]);_0x9edee5[_0x857f('0x35')]=_[_0x857f('0x36')](_0x9edee5['model'],_0x9edee5['query']);_0x3e24a5[_0x857f('0x37')]=_[_0x857f('0x36')](_0x9edee5[_0x857f('0x32')],qs[_0x857f('0x38')](_0x13ef75[_0x857f('0x33')][_0x857f('0x38')]));_0x3e24a5['attributes']=_0x3e24a5[_0x857f('0x37')][_0x857f('0x39')]?_0x3e24a5['attributes']:_0x9edee5[_0x857f('0x32')];_0x3e24a5['order']=qs[_0x857f('0x3c')](_0x13ef75[_0x857f('0x33')]['sort']);_0x3e24a5[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x13ef75[_0x857f('0x33')],_0x9edee5[_0x857f('0x35')]));if(_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]){_0x3e24a5[_0x857f('0x3d')]=_['merge'](_0x3e24a5[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x3e24a5[_0x857f('0x37')],function(_0x7cc7f7){var _0x3c612f={};_0x3c612f[_0x7cc7f7]={'$like':'%'+_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x3c612f;})});}_0x3e24a5=_[_0x857f('0x40')]({},_0x3e24a5,_0x13ef75[_0x857f('0x42')]);return _0x12712a[_0x857f('0x4d')](_0x3e24a5);}})[_0x857f('0x26')](function(_0x5631fb){if(_0x5631fb){_0x59164a=_0x5631fb[_0x857f('0x39')];if(!_0x13ef75[_0x857f('0x33')][_0x857f('0x50')](_0x857f('0x3a'))){_0x3e24a5['limit']=qs[_0x857f('0x1f')](_0x13ef75['query'][_0x857f('0x1f')]);_0x3e24a5[_0x857f('0x1d')]=qs[_0x857f('0x1d')](_0x13ef75[_0x857f('0x33')]['offset']);}return _0x12712a['getConfigurations'](_0x3e24a5);}})[_0x857f('0x26')](function(_0x3ee981){if(_0x3ee981){return _0x3ee981?{'count':_0x59164a,'rows':_0x3ee981}:null;}})[_0x857f('0x26')](respondWithResult(_0x9d8273,null))['catch'](handleError(_0x9d8273,null));};exports[_0x857f('0x51')]=function(_0x5e42bc,_0x5b505,_0x1d6c1c){if(_0x5e42bc[_0x857f('0x4b')]['id']){delete _0x5e42bc['body']['id'];}return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x5e42bc[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x5b505,null))[_0x857f('0x26')](function(_0x41f9d8){if(_0x41f9d8){_0x5e42bc[_0x857f('0x4b')][_0x857f('0x52')]=_0x41f9d8['id'];_0x5e42bc[_0x857f('0x4b')]['Subjects']=integrations['getSubjects'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);_0x5e42bc[_0x857f('0x4b')][_0x857f('0x54')]=integrations['getDescriptions'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);return db[_0x857f('0x4f')][_0x857f('0x4a')](_0x5e42bc[_0x857f('0x4b')],{'include':[{'model':db[_0x857f('0x55')],'as':_0x857f('0x56')},{'model':db[_0x857f('0x55')],'as':'Descriptions'}]});}return null;})[_0x857f('0x26')](respondWithResult(_0x5b505,null))['catch'](handleError(_0x5b505,null));};exports['getFields']=function(_0x35cd3e,_0x48e588,_0x5e5fd9){var _0x2e2cf3='';return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x35cd3e['params']['id']},'attributes':['id',_0x857f('0x57'),_0x857f('0x58'),_0x857f('0x59'),_0x857f('0x5a'),'remoteUri']})[_0x857f('0x26')](handleEntityNotFound(_0x48e588,null))[_0x857f('0x26')](function(_0x3100aa){if(_0x3100aa){_0x2e2cf3=_0x3100aa[_0x857f('0x5b')];var _0x387aaa=_0x2e2cf3[_0x857f('0x5c')](-0x1);if(_0x387aaa==='/'){_0x2e2cf3=_0x2e2cf3[_0x857f('0x5d')](0x0,_0x2e2cf3['lastIndexOf'](_0x387aaa));}var _0x54e75d={'method':_0x857f('0x5e'),'uri':util[_0x857f('0x5f')](_0x857f('0x60'),_0x2e2cf3,_0x857f('0x61')),'json':!![]};switch(_0x3100aa[_0x857f('0x5a')]){case _0x857f('0x58'):_0x54e75d['headers']={'Authorization':util[_0x857f('0x5f')](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s:%s',_0x3100aa['username'],_0x3100aa[_0x857f('0x58')]))['toString']('base64'))};break;case _0x857f('0x59'):_0x54e75d[_0x857f('0x63')]={'Authorization':util['format'](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s/token:%s',_0x3100aa[_0x857f('0x57')],_0x3100aa[_0x857f('0x59')]))[_0x857f('0x64')](_0x857f('0x65')))};break;default:throw new db[(_0x857f('0x66'))][(_0x857f('0x67'))](_0x857f('0x68'));}return rp(_0x54e75d);}})[_0x857f('0x26')](function(_0x415fd3){if(_0x415fd3){var _0x465857=[_0x857f('0x69'),_0x857f('0x6a'),'group','assignee'];_['remove'](_0x415fd3[_0x857f('0x61')],function(_0x310b18){return _0x465857[_0x857f('0x6b')](_0x310b18[_0x857f('0x30')]);});return{'count':_0x415fd3[_0x857f('0x61')][_0x857f('0x39')],'rows':_[_0x857f('0x2c')](_0x415fd3['ticket_fields'],function(_0x40077e){return{'id':_0x40077e['id'],'name':_0x40077e['position']>0x7?_0x40077e[_0x857f('0x6c')]:_0x40077e['type'],'custom':_0x40077e['position']>0x7?!![]:![],'options':_0x40077e[_0x857f('0x6d')]?_0x40077e['system_field_options']:_0x40077e[_0x857f('0x6e')]?_0x40077e[_0x857f('0x6e')]:[]};})};}})[_0x857f('0x26')](respondWithResult(_0x48e588,null))['catch'](function(_0x45be3d){var _0x19456f=_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?0x1f4:_0x45be3d[_0x857f('0x70')]||0x1f4;logger[_0x857f('0x29')](_0x857f('0x71'),_0x857f('0x72'),_0x19456f,JSON[_0x857f('0x73')](_0x45be3d));delete _0x45be3d['name'];if(_0x19456f===0x191){_0x19456f=0x190;}_0x48e588[_0x857f('0x1c')](_0x19456f)[_0x857f('0x2b')](_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x45be3d[_0x857f('0x70')]}:_0x45be3d);});}; \ No newline at end of file +var _0x236c=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','name','index','map','type','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','fields','order','nolimit','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','ZendeskField','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','%s:%s','toString','Basic\x20%s','%s/token:%s','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','Wrong\x20credentials','eml-format'];(function(_0x35e84b,_0x454479){var _0x4fb29e=function(_0x551707){while(--_0x551707){_0x35e84b['push'](_0x35e84b['shift']());}};_0x4fb29e(++_0x454479);}(_0x236c,0x155));var _0xc236=function(_0x33b48d,_0x520883){_0x33b48d=_0x33b48d-0x0;var _0x4cb46c=_0x236c[_0x33b48d];return _0x4cb46c;};'use strict';var emlformat=require(_0xc236('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc236('0x1'));var jsonpatch=require(_0xc236('0x2'));var rp=require(_0xc236('0x3'));var moment=require(_0xc236('0x4'));var BPromise=require(_0xc236('0x5'));var Mustache=require('mustache');var util=require(_0xc236('0x6'));var path=require(_0xc236('0x7'));var sox=require(_0xc236('0x8'));var csv=require(_0xc236('0x9'));var ejs=require(_0xc236('0xa'));var fs=require('fs');var fs_extra=require(_0xc236('0xb'));var _=require('lodash');var squel=require(_0xc236('0xc'));var crypto=require(_0xc236('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc236('0xe'));var Papa=require('papaparse');var Redis=require(_0xc236('0xf'));var authService=require(_0xc236('0x10'));var qs=require(_0xc236('0x11'));var as=require(_0xc236('0x12'));var hardwareService=require(_0xc236('0x13'));var logger=require('../../config/logger')(_0xc236('0x14'));var utils=require(_0xc236('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xc236('0x16'));var db=require(_0xc236('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b9638,_0x5bce83){_0x5bce83=_0x5bce83||0xcc;return function(_0x599d36){if(_0x599d36){return _0x5b9638[_0xc236('0x18')](_0x5bce83);}return _0x5b9638[_0xc236('0x19')](_0x5bce83)[_0xc236('0x1a')]();};}function respondWithResult(_0x71bce2,_0x5052db){_0x5052db=_0x5052db||0xc8;return function(_0x13a42b){if(_0x13a42b){return _0x71bce2['status'](_0x5052db)['json'](_0x13a42b);}};}function respondWithFilteredResult(_0x9a65e8,_0x32f2fd){return function(_0x443a46){if(_0x443a46){var _0x1aeafc=typeof _0x32f2fd[_0xc236('0x1b')]==='undefined'&&typeof _0x32f2fd['limit']==='undefined';var _0x3f5884=_0x443a46[_0xc236('0x1c')];var _0x11ec65=_0x1aeafc?0x0:_0x32f2fd['offset'];var _0x13b432=_0x1aeafc?_0x443a46['count']:_0x32f2fd['offset']+_0x32f2fd[_0xc236('0x1d')];var _0x30adeb;if(_0x13b432>=_0x3f5884){_0x13b432=_0x3f5884;_0x30adeb=0xc8;}else{_0x30adeb=0xce;}_0x9a65e8[_0xc236('0x19')](_0x30adeb);return _0x9a65e8[_0xc236('0x1e')](_0xc236('0x1f'),_0x11ec65+'-'+_0x13b432+'/'+_0x3f5884)[_0xc236('0x20')](_0x443a46);}return null;};}function patchUpdates(_0x3f0e2f){return function(_0x27c96a){try{jsonpatch[_0xc236('0x21')](_0x27c96a,_0x3f0e2f,!![]);}catch(_0x32876d){return BPromise[_0xc236('0x22')](_0x32876d);}return _0x27c96a['save']();};}function saveUpdates(_0x208c3f,_0x34d73a){return function(_0x3bd41b){if(_0x3bd41b){return _0x3bd41b[_0xc236('0x23')](_0x208c3f)[_0xc236('0x24')](function(_0x21fab8){return _0x21fab8;});}return null;};}function removeEntity(_0x3a315b,_0xf921e6){return function(_0x1d65e2){if(_0x1d65e2){return _0x1d65e2[_0xc236('0x25')]()[_0xc236('0x24')](function(){_0x3a315b['status'](0xcc)[_0xc236('0x1a')]();});}};}function handleEntityNotFound(_0x21d78f,_0x356042){return function(_0x9017ec){if(!_0x9017ec){_0x21d78f['sendStatus'](0x194);}return _0x9017ec;};}function handleError(_0x42f248,_0x5da4b2){_0x5da4b2=_0x5da4b2||0x1f4;return function(_0x5351bc){logger[_0xc236('0x26')](_0x5351bc['stack']);if(_0x5351bc[_0xc236('0x27')]){delete _0x5351bc['name'];}_0x42f248[_0xc236('0x19')](_0x5da4b2)['send'](_0x5351bc);};}exports[_0xc236('0x28')]=function(_0x1d144b,_0x4f5175){var _0x5a61b5={},_0x265c8d={},_0x1fd31d={'count':0x0,'rows':[]};var _0x1f4995=_[_0xc236('0x29')](db['ZendeskAccount']['rawAttributes'],function(_0x28ffa5){return{'name':_0x28ffa5['fieldName'],'type':_0x28ffa5[_0xc236('0x2a')]['key']};});_0x265c8d[_0xc236('0x2b')]=_[_0xc236('0x29')](_0x1f4995,'name');_0x265c8d['query']=_[_0xc236('0x2c')](_0x1d144b[_0xc236('0x2d')]);_0x265c8d[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],_0x265c8d[_0xc236('0x2d')]);_0x5a61b5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x265c8d[_0xc236('0x2b')],qs['fields'](_0x1d144b['query']['fields']));_0x5a61b5[_0xc236('0x30')]=_0x5a61b5[_0xc236('0x30')][_0xc236('0x31')]?_0x5a61b5[_0xc236('0x30')]:_0x265c8d[_0xc236('0x2b')];if(!_0x1d144b[_0xc236('0x2d')][_0xc236('0x32')]('nolimit')){_0x5a61b5[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x1d144b[_0xc236('0x2d')]['limit']);_0x5a61b5[_0xc236('0x1b')]=qs[_0xc236('0x1b')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x1b')]);}_0x5a61b5['order']=qs[_0xc236('0x33')](_0x1d144b[_0xc236('0x2d')][_0xc236('0x33')]);_0x5a61b5[_0xc236('0x34')]=qs[_0xc236('0x2e')](_[_0xc236('0x35')](_0x1d144b[_0xc236('0x2d')],_0x265c8d[_0xc236('0x2e')]),_0x1f4995);if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x36')]){_0x5a61b5[_0xc236('0x34')]=_[_0xc236('0x37')](_0x5a61b5[_0xc236('0x34')],{'$or':_[_0xc236('0x29')](_0x1f4995,function(_0x12e802){if(_0x12e802[_0xc236('0x2a')]!==_0xc236('0x38')){var _0x4f5490={};_0x4f5490[_0x12e802['name']]={'$like':'%'+_0x1d144b['query']['filter']+'%'};return _0x4f5490;}})});}_0x5a61b5=_[_0xc236('0x37')]({},_0x5a61b5,_0x1d144b['options']);var _0x35905c={'where':_0x5a61b5[_0xc236('0x34')]};return db[_0xc236('0x39')][_0xc236('0x1c')](_0x35905c)[_0xc236('0x24')](function(_0x3b95ec){_0x1fd31d[_0xc236('0x1c')]=_0x3b95ec;if(_0x1d144b[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5a61b5[_0xc236('0x3b')]=[{'all':!![]}];}return db[_0xc236('0x39')][_0xc236('0x3c')](_0x5a61b5);})[_0xc236('0x24')](function(_0x3df25e){_0x1fd31d[_0xc236('0x3d')]=_0x3df25e;return _0x1fd31d;})['then'](respondWithFilteredResult(_0x4f5175,_0x5a61b5))[_0xc236('0x3e')](handleError(_0x4f5175,null));};exports[_0xc236('0x3f')]=function(_0x506ba0,_0xb90a83){var _0x5b0bc5={'raw':![],'where':{'id':_0x506ba0['params']['id']}},_0x1cecc5={};_0x1cecc5[_0xc236('0x2b')]=_[_0xc236('0x2c')](db[_0xc236('0x39')]['rawAttributes']);_0x1cecc5[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x506ba0[_0xc236('0x2d')]);_0x1cecc5['filters']=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],_0x1cecc5[_0xc236('0x2d')]);_0x5b0bc5[_0xc236('0x30')]=_[_0xc236('0x2f')](_0x1cecc5[_0xc236('0x2b')],qs['fields'](_0x506ba0[_0xc236('0x2d')]['fields']));_0x5b0bc5[_0xc236('0x30')]=_0x5b0bc5[_0xc236('0x30')][_0xc236('0x31')]?_0x5b0bc5[_0xc236('0x30')]:_0x1cecc5[_0xc236('0x2b')];if(_0x506ba0[_0xc236('0x2d')][_0xc236('0x3a')]){_0x5b0bc5['include']=[{'all':!![]}];}_0x5b0bc5=_[_0xc236('0x37')]({},_0x5b0bc5,_0x506ba0['options']);return db[_0xc236('0x39')][_0xc236('0x40')](_0x5b0bc5)['then'](handleEntityNotFound(_0xb90a83,null))[_0xc236('0x24')](respondWithResult(_0xb90a83,null))[_0xc236('0x3e')](handleError(_0xb90a83,null));};exports[_0xc236('0x41')]=function(_0x161890,_0x181dd6){return db[_0xc236('0x39')][_0xc236('0x41')](_0x161890['body'],{})['then'](respondWithResult(_0x181dd6,0xc9))[_0xc236('0x3e')](handleError(_0x181dd6,null));};exports[_0xc236('0x23')]=function(_0x510f7f,_0xcfaa44){if(_0x510f7f[_0xc236('0x42')]['id']){delete _0x510f7f[_0xc236('0x42')]['id'];}return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x510f7f[_0xc236('0x43')]['id']}})[_0xc236('0x24')](handleEntityNotFound(_0xcfaa44,null))[_0xc236('0x24')](saveUpdates(_0x510f7f[_0xc236('0x42')],null))['then'](respondWithResult(_0xcfaa44,null))[_0xc236('0x3e')](handleError(_0xcfaa44,null));};exports[_0xc236('0x25')]=function(_0x41b7d5,_0x447a83){return db[_0xc236('0x39')][_0xc236('0x40')]({'where':{'id':_0x41b7d5[_0xc236('0x43')]['id']}})['then'](handleEntityNotFound(_0x447a83,null))[_0xc236('0x24')](removeEntity(_0x447a83,null))[_0xc236('0x3e')](handleError(_0x447a83,null));};exports[_0xc236('0x44')]=function(_0x16ff63,_0x4860d8,_0xa34c01){var _0x3e6da6={};var _0xad71ea={};var _0x2f3d08;var _0x9d81c8;return db['ZendeskAccount'][_0xc236('0x45')]({'where':{'id':_0x16ff63['params']['id']}})[_0xc236('0x24')](handleEntityNotFound(_0x4860d8,null))[_0xc236('0x24')](function(_0x3f9e85){if(_0x3f9e85){_0x2f3d08=_0x3f9e85;_0xad71ea[_0xc236('0x2b')]=_[_0xc236('0x2c')](db['ZendeskConfiguration']['rawAttributes']);_0xad71ea[_0xc236('0x2d')]=_[_0xc236('0x2c')](_0x16ff63[_0xc236('0x2d')]);_0xad71ea[_0xc236('0x2e')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],_0xad71ea[_0xc236('0x2d')]);_0x3e6da6[_0xc236('0x30')]=_[_0xc236('0x2f')](_0xad71ea[_0xc236('0x2b')],qs['fields'](_0x16ff63['query'][_0xc236('0x46')]));_0x3e6da6[_0xc236('0x30')]=_0x3e6da6[_0xc236('0x30')][_0xc236('0x31')]?_0x3e6da6['attributes']:_0xad71ea[_0xc236('0x2b')];_0x3e6da6[_0xc236('0x47')]=qs['sort'](_0x16ff63[_0xc236('0x2d')][_0xc236('0x33')]);_0x3e6da6[_0xc236('0x34')]=qs[_0xc236('0x2e')](_['pick'](_0x16ff63[_0xc236('0x2d')],_0xad71ea[_0xc236('0x2e')]));if(_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]){_0x3e6da6[_0xc236('0x34')]=_[_0xc236('0x37')](_0x3e6da6[_0xc236('0x34')],{'$or':_['map'](_0x3e6da6[_0xc236('0x30')],function(_0x4c99a4){var _0x4289c5={};_0x4289c5[_0x4c99a4]={'$like':'%'+_0x16ff63[_0xc236('0x2d')][_0xc236('0x36')]+'%'};return _0x4289c5;})});}_0x3e6da6=_[_0xc236('0x37')]({},_0x3e6da6,_0x16ff63['options']);return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x379e99){if(_0x379e99){_0x9d81c8=_0x379e99['length'];if(!_0x16ff63[_0xc236('0x2d')][_0xc236('0x32')](_0xc236('0x48'))){_0x3e6da6[_0xc236('0x1d')]=qs[_0xc236('0x1d')](_0x16ff63[_0xc236('0x2d')]['limit']);_0x3e6da6['offset']=qs[_0xc236('0x1b')](_0x16ff63[_0xc236('0x2d')][_0xc236('0x1b')]);}return _0x2f3d08[_0xc236('0x44')](_0x3e6da6);}})[_0xc236('0x24')](function(_0x4649a3){if(_0x4649a3){return _0x4649a3?{'count':_0x9d81c8,'rows':_0x4649a3}:null;}})[_0xc236('0x24')](respondWithResult(_0x4860d8,null))['catch'](handleError(_0x4860d8,null));};exports['addConfiguration']=function(_0x4b59d3,_0x119710,_0x3c11da){if(_0x4b59d3[_0xc236('0x42')]['id']){delete _0x4b59d3[_0xc236('0x42')]['id'];}return db['ZendeskAccount']['findOne']({'where':{'id':_0x4b59d3['params']['id']}})['then'](handleEntityNotFound(_0x119710,null))[_0xc236('0x24')](function(_0x5df2ba){if(_0x5df2ba){_0x4b59d3[_0xc236('0x42')]['AccountId']=_0x5df2ba['id'];_0x4b59d3[_0xc236('0x42')][_0xc236('0x49')]=integrations[_0xc236('0x4a')](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);_0x4b59d3['body'][_0xc236('0x4c')]=integrations['getDescriptions'](_0x4b59d3[_0xc236('0x42')][_0xc236('0x4b')],_0x4b59d3[_0xc236('0x42')][_0xc236('0x2a')]);return db[_0xc236('0x4d')][_0xc236('0x41')](_0x4b59d3['body'],{'include':[{'model':db[_0xc236('0x4e')],'as':_0xc236('0x49')},{'model':db['ZendeskField'],'as':_0xc236('0x4c')}]});}return null;})[_0xc236('0x24')](respondWithResult(_0x119710,null))[_0xc236('0x3e')](handleError(_0x119710,null));};exports['getFields']=function(_0x226573,_0x45fe5a,_0x5897a1){var _0x2c8f89='';return db[_0xc236('0x39')][_0xc236('0x45')]({'where':{'id':_0x226573[_0xc236('0x43')]['id']},'attributes':['id',_0xc236('0x4f'),_0xc236('0x50'),_0xc236('0x51'),_0xc236('0x52'),_0xc236('0x53')]})['then'](handleEntityNotFound(_0x45fe5a,null))[_0xc236('0x24')](function(_0x2b9fd8){if(_0x2b9fd8){_0x2c8f89=_0x2b9fd8[_0xc236('0x53')];var _0x5d395b=_0x2c8f89[_0xc236('0x54')](-0x1);if(_0x5d395b==='/'){_0x2c8f89=_0x2c8f89[_0xc236('0x55')](0x0,_0x2c8f89[_0xc236('0x56')](_0x5d395b));}var _0x4ef002={'method':'GET','uri':util[_0xc236('0x57')]('%s/%s',_0x2c8f89,_0xc236('0x58')),'json':!![]};switch(_0x2b9fd8['authType']){case _0xc236('0x50'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xc236('0x5a'),_0x2b9fd8['username'],_0x2b9fd8[_0xc236('0x50')]))[_0xc236('0x5b')]('base64'))};break;case _0xc236('0x51'):_0x4ef002[_0xc236('0x59')]={'Authorization':util['format'](_0xc236('0x5c'),new Buffer(util[_0xc236('0x57')](_0xc236('0x5d'),_0x2b9fd8[_0xc236('0x4f')],_0x2b9fd8['token']))[_0xc236('0x5b')](_0xc236('0x5e')))};break;default:throw new db[(_0xc236('0x5f'))][(_0xc236('0x60'))](_0xc236('0x61'));}return rp(_0x4ef002);}})[_0xc236('0x24')](function(_0x141497){if(_0x141497){var _0x509f3b=['subject',_0xc236('0x62'),_0xc236('0x63'),_0xc236('0x64')];_[_0xc236('0x65')](_0x141497[_0xc236('0x58')],function(_0x49e417){return _0x509f3b[_0xc236('0x66')](_0x49e417[_0xc236('0x2a')]);});return{'count':_0x141497['ticket_fields']['length'],'rows':_[_0xc236('0x29')](_0x141497['ticket_fields'],function(_0x35e0d8){return{'id':_0x35e0d8['id'],'name':_0x35e0d8[_0xc236('0x67')]>0x7?_0x35e0d8[_0xc236('0x68')]:_0x35e0d8['type'],'custom':_0x35e0d8[_0xc236('0x67')]>0x7?!![]:![],'options':_0x35e0d8['system_field_options']?_0x35e0d8[_0xc236('0x69')]:_0x35e0d8[_0xc236('0x6a')]?_0x35e0d8[_0xc236('0x6a')]:[]};})};}})[_0xc236('0x24')](respondWithResult(_0x45fe5a,null))['catch'](function(_0x41c76d){var _0x22b942=_0x226573['query'][_0xc236('0x6b')]?0x1f4:_0x41c76d[_0xc236('0x6c')]||0x1f4;logger[_0xc236('0x26')](_0xc236('0x6d'),_0xc236('0x6e'),_0x22b942,JSON[_0xc236('0x6f')](_0x41c76d));delete _0x41c76d[_0xc236('0x27')];if(_0x22b942===0x191){_0x22b942=0x190;}_0x45fe5a['status'](_0x22b942)[_0xc236('0x70')](_0x226573[_0xc236('0x2d')][_0xc236('0x6b')]?{'message':_0xc236('0x71'),'statusCode':_0x41c76d['statusCode']}:_0x41c76d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index f1c40e2..ab2ada5 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 _0x983f=['../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x45ce57,_0x75c39e){var _0x5aa756=function(_0xb68f75){while(--_0xb68f75){_0x45ce57['push'](_0x45ce57['shift']());}};_0x5aa756(++_0x75c39e);}(_0x983f,0x1b1));var _0xf983=function(_0x440d65,_0x4938b7){_0x440d65=_0x440d65-0x0;var _0x2172e4=_0x983f[_0x440d65];return _0x2172e4;};'use strict';var _=require(_0xf983('0x0'));var util=require(_0xf983('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf983('0x2'));var BPromise=require(_0xf983('0x3'));var rp=require(_0xf983('0x4'));var fs=require('fs');var path=require(_0xf983('0x5'));var rimraf=require('rimraf');var config=require(_0xf983('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xf983('0x7'));module['exports']=function(_0x4e8834,_0x38dbc2){return _0x4e8834[_0xf983('0x8')](_0xf983('0x9'),attributes,{'tableName':_0xf983('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f36=['../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x30af55,_0x58fde0){var _0x4784bf=function(_0x26e911){while(--_0x26e911){_0x30af55['push'](_0x30af55['shift']());}};_0x4784bf(++_0x58fde0);}(_0x1f36,0x109));var _0x61f3=function(_0x41af7c,_0x1ffcfa){_0x41af7c=_0x41af7c-0x0;var _0x3ee1a2=_0x1f36[_0x41af7c];return _0x3ee1a2;};'use strict';var _=require(_0x61f3('0x0'));var util=require(_0x61f3('0x1'));var logger=require(_0x61f3('0x2'))('api');var moment=require(_0x61f3('0x3'));var BPromise=require('bluebird');var rp=require(_0x61f3('0x4'));var fs=require('fs');var path=require(_0x61f3('0x5'));var rimraf=require(_0x61f3('0x6'));var config=require(_0x61f3('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x61f3('0x8'));module[_0x61f3('0x9')]=function(_0x31b095,_0x44b249){return _0x31b095[_0x61f3('0xa')](_0x61f3('0xb'),attributes,{'tableName':_0x61f3('0xc'),'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 2eb3e0a..4d51fb2 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 _0x1c0c=['where','limit','include','map','model','attributes','ShowZendeskAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetZendeskAccount','ZendeskAccount','findAll','options'];(function(_0x20f76d,_0x5f12b3){var _0x2b2080=function(_0x287f90){while(--_0x287f90){_0x20f76d['push'](_0x20f76d['shift']());}};_0x2b2080(++_0x5f12b3);}(_0x1c0c,0x1c5));var _0xc1c0=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x1c0c[_0xb0f7c3];return _0x28ea68;};'use strict';var _=require(_0xc1c0('0x0'));var util=require(_0xc1c0('0x1'));var moment=require(_0xc1c0('0x2'));var BPromise=require(_0xc1c0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc1c0('0x4'));var db=require(_0xc1c0('0x5'))['db'];var utils=require(_0xc1c0('0x6'));var logger=require(_0xc1c0('0x7'))(_0xc1c0('0x8'));var config=require(_0xc1c0('0x9'));var jayson=require(_0xc1c0('0xa'));var client=jayson['client'][_0xc1c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ecbf4,_0x31e6e0,_0x4de445){return new BPromise(function(_0x59d8be,_0x2a82c){return client[_0xc1c0('0xc')](_0x2ecbf4,_0x4de445)[_0xc1c0('0xd')](function(_0x4139df){logger['info'](_0xc1c0('0xe'),_0x31e6e0,_0xc1c0('0xf'));logger[_0xc1c0('0x10')](_0xc1c0('0x11'),_0x31e6e0,'request\x20sent',JSON[_0xc1c0('0x12')](_0x4139df));if(_0x4139df[_0xc1c0('0x13')]){if(_0x4139df[_0xc1c0('0x13')][_0xc1c0('0x14')]===0x1f4){logger[_0xc1c0('0x13')](_0xc1c0('0xe'),_0x31e6e0,_0x4139df[_0xc1c0('0x13')][_0xc1c0('0x15')]);return _0x2a82c(_0x4139df[_0xc1c0('0x13')][_0xc1c0('0x15')]);}logger[_0xc1c0('0x13')](_0xc1c0('0xe'),_0x31e6e0,_0x4139df[_0xc1c0('0x13')][_0xc1c0('0x15')]);return _0x59d8be(_0x4139df['error'][_0xc1c0('0x15')]);}else{logger[_0xc1c0('0x16')]('ZendeskAccount,\x20%s,\x20%s',_0x31e6e0,_0xc1c0('0xf'));_0x59d8be(_0x4139df['result']['message']);}})[_0xc1c0('0x17')](function(_0x2bbcfc){logger['error'](_0xc1c0('0xe'),_0x31e6e0,_0x2bbcfc);_0x2a82c(_0x2bbcfc);});});}exports[_0xc1c0('0x18')]=function(_0xc21080){var _0x160154=this;return new Promise(function(_0x3986e2,_0x482a59){return db[_0xc1c0('0x19')][_0xc1c0('0x1a')]({'raw':_0xc21080['options']?_0xc21080[_0xc1c0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0xc21080[_0xc1c0('0x1b')]?_0xc21080['options'][_0xc1c0('0x1c')]||null:null,'attributes':_0xc21080[_0xc1c0('0x1b')]?_0xc21080[_0xc1c0('0x1b')]['attributes']||null:null,'limit':_0xc21080[_0xc1c0('0x1b')]?_0xc21080[_0xc1c0('0x1b')][_0xc1c0('0x1d')]||null:null,'include':_0xc21080['options']?_0xc21080['options'][_0xc1c0('0x1e')]?_[_0xc1c0('0x1f')](_0xc21080['options'][_0xc1c0('0x1e')],function(_0x5dbb14){return{'model':db[_0x5dbb14[_0xc1c0('0x20')]],'as':_0x5dbb14['as'],'attributes':_0x5dbb14['attributes'],'include':_0x5dbb14[_0xc1c0('0x1e')]?_[_0xc1c0('0x1f')](_0x5dbb14[_0xc1c0('0x1e')],function(_0x59fe9f){return{'model':db[_0x59fe9f[_0xc1c0('0x20')]],'as':_0x59fe9f['as'],'attributes':_0x59fe9f[_0xc1c0('0x21')],'include':_0x59fe9f[_0xc1c0('0x1e')]?_[_0xc1c0('0x1f')](_0x59fe9f[_0xc1c0('0x1e')],function(_0x480edb){return{'model':db[_0x480edb[_0xc1c0('0x20')]],'as':_0x480edb['as'],'attributes':_0x480edb[_0xc1c0('0x21')]};}):[]};}):[]};}):[]:[]})[_0xc1c0('0xd')](function(_0x47bb7e){logger['info'](_0xc1c0('0x18'),_0xc21080);logger[_0xc1c0('0x10')](_0xc1c0('0x18'),_0xc21080,JSON[_0xc1c0('0x12')](_0x47bb7e));_0x3986e2(_0x47bb7e);})[_0xc1c0('0x17')](function(_0x2c5fed){logger[_0xc1c0('0x13')](_0xc1c0('0x18'),_0x2c5fed['message'],_0xc21080);_0x482a59(_0x160154[_0xc1c0('0x13')](0x1f4,_0x2c5fed[_0xc1c0('0x15')]));});});};exports[_0xc1c0('0x22')]=function(_0x2df501){var _0xfd1891=this;return new Promise(function(_0x1229be,_0x4a361d){return db['ZendeskAccount'][_0xc1c0('0x23')]({'raw':_0x2df501[_0xc1c0('0x1b')]?_0x2df501[_0xc1c0('0x1b')][_0xc1c0('0x24')]===undefined?!![]:![]:!![],'where':_0x2df501['options']?_0x2df501[_0xc1c0('0x1b')][_0xc1c0('0x1c')]||null:null,'attributes':_0x2df501[_0xc1c0('0x1b')]?_0x2df501[_0xc1c0('0x1b')][_0xc1c0('0x21')]||null:null,'include':_0x2df501[_0xc1c0('0x1b')]?_0x2df501[_0xc1c0('0x1b')][_0xc1c0('0x1e')]?_[_0xc1c0('0x1f')](_0x2df501[_0xc1c0('0x1b')][_0xc1c0('0x1e')],function(_0xff2611){return{'model':db[_0xff2611[_0xc1c0('0x20')]],'as':_0xff2611['as'],'attributes':_0xff2611[_0xc1c0('0x21')],'include':_0xff2611[_0xc1c0('0x1e')]?_['map'](_0xff2611[_0xc1c0('0x1e')],function(_0xb08aa8){return{'model':db[_0xb08aa8['model']],'as':_0xb08aa8['as'],'attributes':_0xb08aa8['attributes'],'include':_0xb08aa8[_0xc1c0('0x1e')]?_[_0xc1c0('0x1f')](_0xb08aa8['include'],function(_0xe1506e){return{'model':db[_0xe1506e[_0xc1c0('0x20')]],'as':_0xe1506e['as'],'attributes':_0xe1506e['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1c0('0xd')](function(_0x5a7605){logger[_0xc1c0('0x16')](_0xc1c0('0x22'),_0x2df501);logger['debug'](_0xc1c0('0x22'),_0x2df501,JSON[_0xc1c0('0x12')](_0x5a7605));_0x1229be(_0x5a7605);})['catch'](function(_0xd8705a){logger[_0xc1c0('0x13')]('ShowZendeskAccount',_0xd8705a[_0xc1c0('0x15')],_0x2df501);_0x4a361d(_0xfd1891['error'](0x1f4,_0xd8705a['message']));});});}; \ No newline at end of file +var _0x2cb7=['rpc','../../config/environment','client','http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','ZendeskAccount,\x20%s,\x20%s','request\x20sent','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','map','include','model','stringify','catch','raw','ShowZendeskAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f0159,_0x17cc58){var _0xaa427a=function(_0x89873f){while(--_0x89873f){_0x2f0159['push'](_0x2f0159['shift']());}};_0xaa427a(++_0x17cc58);}(_0x2cb7,0x64));var _0x72cb=function(_0x643b2,_0x14e495){_0x643b2=_0x643b2-0x0;var _0x2e5346=_0x2cb7[_0x643b2];return _0x2e5346;};'use strict';var _=require(_0x72cb('0x0'));var util=require(_0x72cb('0x1'));var moment=require(_0x72cb('0x2'));var BPromise=require('bluebird');var rs=require(_0x72cb('0x3'));var fs=require('fs');var Redis=require(_0x72cb('0x4'));var db=require(_0x72cb('0x5'))['db'];var utils=require(_0x72cb('0x6'));var logger=require(_0x72cb('0x7'))(_0x72cb('0x8'));var config=require(_0x72cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x72cb('0xa')][_0x72cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5656ad,_0x305db6,_0xaed876){return new BPromise(function(_0x41d3ad,_0x4b1c3d){return client[_0x72cb('0xc')](_0x5656ad,_0xaed876)[_0x72cb('0xd')](function(_0x573b9c){logger[_0x72cb('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x305db6,'request\x20sent');logger[_0x72cb('0xf')](_0x72cb('0x10'),_0x305db6,'request\x20sent',JSON['stringify'](_0x573b9c));if(_0x573b9c[_0x72cb('0x11')]){if(_0x573b9c[_0x72cb('0x11')][_0x72cb('0x12')]===0x1f4){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x305db6,_0x573b9c[_0x72cb('0x11')][_0x72cb('0x13')]);return _0x4b1c3d(_0x573b9c[_0x72cb('0x11')]['message']);}logger[_0x72cb('0x11')](_0x72cb('0x14'),_0x305db6,_0x573b9c['error'][_0x72cb('0x13')]);return _0x41d3ad(_0x573b9c[_0x72cb('0x11')][_0x72cb('0x13')]);}else{logger[_0x72cb('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x305db6,_0x72cb('0x15'));_0x41d3ad(_0x573b9c['result'][_0x72cb('0x13')]);}})['catch'](function(_0x1265d4){logger[_0x72cb('0x11')](_0x72cb('0x14'),_0x305db6,_0x1265d4);_0x4b1c3d(_0x1265d4);});});}exports[_0x72cb('0x16')]=function(_0x24980b){var _0x3fb99c=this;return new Promise(function(_0x53b964,_0x217cb3){return db[_0x72cb('0x17')][_0x72cb('0x18')]({'raw':_0x24980b[_0x72cb('0x19')]?_0x24980b[_0x72cb('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x24980b['options']?_0x24980b['options'][_0x72cb('0x1a')]||null:null,'attributes':_0x24980b[_0x72cb('0x19')]?_0x24980b[_0x72cb('0x19')][_0x72cb('0x1b')]||null:null,'limit':_0x24980b[_0x72cb('0x19')]?_0x24980b[_0x72cb('0x19')][_0x72cb('0x1c')]||null:null,'include':_0x24980b[_0x72cb('0x19')]?_0x24980b[_0x72cb('0x19')]['include']?_[_0x72cb('0x1d')](_0x24980b[_0x72cb('0x19')][_0x72cb('0x1e')],function(_0x2a4da7){return{'model':db[_0x2a4da7[_0x72cb('0x1f')]],'as':_0x2a4da7['as'],'attributes':_0x2a4da7[_0x72cb('0x1b')],'include':_0x2a4da7[_0x72cb('0x1e')]?_[_0x72cb('0x1d')](_0x2a4da7[_0x72cb('0x1e')],function(_0x5ad761){return{'model':db[_0x5ad761[_0x72cb('0x1f')]],'as':_0x5ad761['as'],'attributes':_0x5ad761[_0x72cb('0x1b')],'include':_0x5ad761[_0x72cb('0x1e')]?_[_0x72cb('0x1d')](_0x5ad761[_0x72cb('0x1e')],function(_0x136514){return{'model':db[_0x136514[_0x72cb('0x1f')]],'as':_0x136514['as'],'attributes':_0x136514[_0x72cb('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f05a1){logger[_0x72cb('0xe')](_0x72cb('0x16'),_0x24980b);logger['debug']('GetZendeskAccount',_0x24980b,JSON[_0x72cb('0x20')](_0x4f05a1));_0x53b964(_0x4f05a1);})[_0x72cb('0x21')](function(_0x19045a){logger[_0x72cb('0x11')](_0x72cb('0x16'),_0x19045a[_0x72cb('0x13')],_0x24980b);_0x217cb3(_0x3fb99c[_0x72cb('0x11')](0x1f4,_0x19045a[_0x72cb('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x17d709){var _0x28b1a9=this;return new Promise(function(_0x1584f6,_0x3cb163){return db['ZendeskAccount']['find']({'raw':_0x17d709[_0x72cb('0x19')]?_0x17d709[_0x72cb('0x19')][_0x72cb('0x22')]===undefined?!![]:![]:!![],'where':_0x17d709['options']?_0x17d709[_0x72cb('0x19')]['where']||null:null,'attributes':_0x17d709[_0x72cb('0x19')]?_0x17d709[_0x72cb('0x19')][_0x72cb('0x1b')]||null:null,'include':_0x17d709[_0x72cb('0x19')]?_0x17d709[_0x72cb('0x19')][_0x72cb('0x1e')]?_['map'](_0x17d709['options']['include'],function(_0x3973e7){return{'model':db[_0x3973e7['model']],'as':_0x3973e7['as'],'attributes':_0x3973e7['attributes'],'include':_0x3973e7[_0x72cb('0x1e')]?_['map'](_0x3973e7[_0x72cb('0x1e')],function(_0x2d27f6){return{'model':db[_0x2d27f6[_0x72cb('0x1f')]],'as':_0x2d27f6['as'],'attributes':_0x2d27f6[_0x72cb('0x1b')],'include':_0x2d27f6['include']?_[_0x72cb('0x1d')](_0x2d27f6[_0x72cb('0x1e')],function(_0x347c41){return{'model':db[_0x347c41[_0x72cb('0x1f')]],'as':_0x347c41['as'],'attributes':_0x347c41[_0x72cb('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x72cb('0xd')](function(_0x31a337){logger[_0x72cb('0xe')](_0x72cb('0x23'),_0x17d709);logger[_0x72cb('0xf')](_0x72cb('0x23'),_0x17d709,JSON[_0x72cb('0x20')](_0x31a337));_0x1584f6(_0x31a337);})[_0x72cb('0x21')](function(_0x2aa1fb){logger[_0x72cb('0x11')](_0x72cb('0x23'),_0x2aa1fb[_0x72cb('0x13')],_0x17d709);_0x3cb163(_0x28b1a9[_0x72cb('0x11')](0x1f4,_0x2aa1fb[_0x72cb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 1d50d89..46ec55c 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','put','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x447892,_0x122909){var _0x32e9bf=function(_0x3dd93d){while(--_0x3dd93d){_0x447892['push'](_0x447892['shift']());}};_0x32e9bf(++_0x122909);}(_0xda3f,0xec));var _0xfda3=function(_0x4159b8,_0xa680d3){_0x4159b8=_0x4159b8-0x0;var _0x349a0c=_0xda3f[_0x4159b8];return _0x349a0c;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./intZendeskConfiguration.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x5')](_0xfda3('0x9'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0x5')](_0xfda3('0xb'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0x5')]('/:id/descriptions',auth[_0xfda3('0x6')](),controller[_0xfda3('0xd')]);router[_0xfda3('0x5')](_0xfda3('0xe'),auth[_0xfda3('0x6')](),controller['getTags']);router[_0xfda3('0xf')]('/',auth['isAuthenticated'](),controller[_0xfda3('0x10')]);router[_0xfda3('0xf')]('/:id/tags',auth['isAuthenticated'](),controller['setTags']);router[_0xfda3('0x11')](_0xfda3('0x7'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x12')]);module[_0xfda3('0x13')]=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0xfb6829,_0x2b3871){var _0x3992df=function(_0xa19b0){while(--_0xa19b0){_0xfb6829['push'](_0xfb6829['shift']());}};_0x3992df(++_0x2b3871);}(_0xa571,0x107));var _0x1a57=function(_0x580030,_0x3c5095){_0x580030=_0x580030-0x0;var _0x5512a1=_0xa571[_0x580030];return _0x5512a1;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 426f2d3..88a386c 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 _0xba7a=['sequelize','STRING'];(function(_0x124f88,_0x3ad501){var _0xed0e3b=function(_0x43a67d){while(--_0x43a67d){_0x124f88['push'](_0x124f88['shift']());}};_0xed0e3b(++_0x3ad501);}(_0xba7a,0x1d8));var _0xaba7=function(_0x4e79ad,_0x21ef9f){_0x4e79ad=_0x4e79ad-0x0;var _0x2cec9d=_0xba7a[_0x4e79ad];return _0x2cec9d;};'use strict';var Sequelize=require(_0xaba7('0x0'));module['exports']={'name':{'type':Sequelize[_0xaba7('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9eef=['sequelize','exports','STRING'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9eef,0xf3));var _0xf9ee=function(_0x32b50d,_0x4e0723){_0x32b50d=_0x32b50d-0x0;var _0x1b4bfd=_0x9eef[_0x32b50d];return _0x1b4bfd;};'use strict';var Sequelize=require(_0xf9ee('0x0'));module[_0xf9ee('0x1')]={'name':{'type':Sequelize[_0xf9ee('0x2')]},'description':{'type':Sequelize[_0xf9ee('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index f4db3d6..92aa2ca 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 _0x034e=['fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','ZendeskConfiguration','length','includeAll','find','create','body','findOne','ZendeskField','rawAttributes','getFields','nolimit','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','save','update','then','error','stack','name','index','map'];(function(_0x1c67a2,_0x599648){var _0x4fbd8e=function(_0x2e465b){while(--_0x2e465b){_0x1c67a2['push'](_0x1c67a2['shift']());}};_0x4fbd8e(++_0x599648);}(_0x034e,0x11c));var _0xe034=function(_0x2e2f34,_0x24d010){_0x2e2f34=_0x2e2f34-0x0;var _0x84096=_0x034e[_0x2e2f34];return _0x84096;};'use strict';var emlformat=require(_0xe034('0x0'));var rimraf=require(_0xe034('0x1'));var zipdir=require(_0xe034('0x2'));var jsonpatch=require(_0xe034('0x3'));var rp=require(_0xe034('0x4'));var moment=require('moment');var BPromise=require(_0xe034('0x5'));var Mustache=require(_0xe034('0x6'));var util=require('util');var path=require(_0xe034('0x7'));var sox=require('sox');var csv=require(_0xe034('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe034('0x9'));var _=require(_0xe034('0xa'));var squel=require(_0xe034('0xb'));var crypto=require('crypto');var jsforce=require(_0xe034('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe034('0x8'));var querystring=require(_0xe034('0xd'));var Papa=require(_0xe034('0xe'));var Redis=require('ioredis');var authService=require(_0xe034('0xf'));var qs=require(_0xe034('0x10'));var as=require(_0xe034('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe034('0x12'))(_0xe034('0x13'));var utils=require(_0xe034('0x14'));var config=require(_0xe034('0x15'));var licenseUtil=require(_0xe034('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x285792,_0x20556a){_0x20556a=_0x20556a||0xcc;return function(_0x1ad854){if(_0x1ad854){return _0x285792[_0xe034('0x17')](_0x20556a);}return _0x285792[_0xe034('0x18')](_0x20556a)[_0xe034('0x19')]();};}function respondWithResult(_0x27bbbd,_0x65ffc8){_0x65ffc8=_0x65ffc8||0xc8;return function(_0x4e0261){if(_0x4e0261){return _0x27bbbd[_0xe034('0x18')](_0x65ffc8)['json'](_0x4e0261);}};}function respondWithFilteredResult(_0x328afa,_0x36d73f){return function(_0x371b97){if(_0x371b97){var _0x2a0671=typeof _0x36d73f[_0xe034('0x1a')]===_0xe034('0x1b')&&typeof _0x36d73f['limit']==='undefined';var _0x55f0f5=_0x371b97['count'];var _0x535d9e=_0x2a0671?0x0:_0x36d73f[_0xe034('0x1a')];var _0x16d935=_0x2a0671?_0x371b97[_0xe034('0x1c')]:_0x36d73f[_0xe034('0x1a')]+_0x36d73f['limit'];var _0x35d5e2;if(_0x16d935>=_0x55f0f5){_0x16d935=_0x55f0f5;_0x35d5e2=0xc8;}else{_0x35d5e2=0xce;}_0x328afa[_0xe034('0x18')](_0x35d5e2);return _0x328afa[_0xe034('0x1d')](_0xe034('0x1e'),_0x535d9e+'-'+_0x16d935+'/'+_0x55f0f5)[_0xe034('0x1f')](_0x371b97);}return null;};}function patchUpdates(_0x1d18d9){return function(_0x71a434){try{jsonpatch['apply'](_0x71a434,_0x1d18d9,!![]);}catch(_0xe3840c){return BPromise['reject'](_0xe3840c);}return _0x71a434[_0xe034('0x20')]();};}function saveUpdates(_0x12fdec,_0x361e61){return function(_0x275a73){if(_0x275a73){return _0x275a73[_0xe034('0x21')](_0x12fdec)[_0xe034('0x22')](function(_0x115113){return _0x115113;});}return null;};}function removeEntity(_0x47c78a,_0x2451bf){return function(_0x17bd72){if(_0x17bd72){return _0x17bd72['destroy']()[_0xe034('0x22')](function(){_0x47c78a['status'](0xcc)[_0xe034('0x19')]();});}};}function handleEntityNotFound(_0x15153c,_0x10da05){return function(_0x23514b){if(!_0x23514b){_0x15153c[_0xe034('0x17')](0x194);}return _0x23514b;};}function handleError(_0x55742b,_0x451a53){_0x451a53=_0x451a53||0x1f4;return function(_0x180777){logger[_0xe034('0x23')](_0x180777[_0xe034('0x24')]);if(_0x180777['name']){delete _0x180777[_0xe034('0x25')];}_0x55742b[_0xe034('0x18')](_0x451a53)['send'](_0x180777);};}exports[_0xe034('0x26')]=function(_0x25445d,_0x3746d1){var _0x578d3d={},_0x164dca={},_0x14b765={'count':0x0,'rows':[]};var _0x4d9243=_[_0xe034('0x27')](db['ZendeskConfiguration']['rawAttributes'],function(_0x12635c){return{'name':_0x12635c[_0xe034('0x28')],'type':_0x12635c[_0xe034('0x29')][_0xe034('0x2a')]};});_0x164dca['model']=_[_0xe034('0x27')](_0x4d9243,_0xe034('0x25'));_0x164dca['query']=_[_0xe034('0x2b')](_0x25445d[_0xe034('0x2c')]);_0x164dca[_0xe034('0x2d')]=_['intersection'](_0x164dca[_0xe034('0x2e')],_0x164dca[_0xe034('0x2c')]);_0x578d3d[_0xe034('0x2f')]=_[_0xe034('0x30')](_0x164dca[_0xe034('0x2e')],qs[_0xe034('0x31')](_0x25445d[_0xe034('0x2c')][_0xe034('0x31')]));_0x578d3d['attributes']=_0x578d3d[_0xe034('0x2f')]['length']?_0x578d3d['attributes']:_0x164dca[_0xe034('0x2e')];if(!_0x25445d[_0xe034('0x2c')][_0xe034('0x32')]('nolimit')){_0x578d3d[_0xe034('0x33')]=qs['limit'](_0x25445d['query'][_0xe034('0x33')]);_0x578d3d[_0xe034('0x1a')]=qs['offset'](_0x25445d[_0xe034('0x2c')]['offset']);}_0x578d3d[_0xe034('0x34')]=qs[_0xe034('0x35')](_0x25445d[_0xe034('0x2c')][_0xe034('0x35')]);_0x578d3d[_0xe034('0x36')]=qs['filters'](_[_0xe034('0x37')](_0x25445d[_0xe034('0x2c')],_0x164dca['filters']),_0x4d9243);if(_0x25445d['query']['filter']){_0x578d3d['where']=_['merge'](_0x578d3d[_0xe034('0x36')],{'$or':_[_0xe034('0x27')](_0x4d9243,function(_0x453336){if(_0x453336[_0xe034('0x29')]!==_0xe034('0x38')){var _0x125829={};_0x125829[_0x453336[_0xe034('0x25')]]={'$like':'%'+_0x25445d[_0xe034('0x2c')][_0xe034('0x39')]+'%'};return _0x125829;}})});}_0x578d3d=_[_0xe034('0x3a')]({},_0x578d3d,_0x25445d[_0xe034('0x3b')]);var _0x1d3407={'where':_0x578d3d[_0xe034('0x36')]};return db['ZendeskConfiguration'][_0xe034('0x1c')](_0x1d3407)[_0xe034('0x22')](function(_0x54c685){_0x14b765[_0xe034('0x1c')]=_0x54c685;if(_0x25445d[_0xe034('0x2c')]['includeAll']){_0x578d3d[_0xe034('0x3c')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xe034('0x3d')](_0x578d3d);})['then'](function(_0x2a409e){_0x14b765[_0xe034('0x3e')]=_0x2a409e;return _0x14b765;})[_0xe034('0x22')](respondWithFilteredResult(_0x3746d1,_0x578d3d))[_0xe034('0x3f')](handleError(_0x3746d1,null));};exports[_0xe034('0x40')]=function(_0x1949ae,_0x2fe878){var _0x426314={'raw':![],'where':{'id':_0x1949ae[_0xe034('0x41')]['id']}},_0x22215a={};_0x22215a[_0xe034('0x2e')]=_[_0xe034('0x2b')](db[_0xe034('0x42')]['rawAttributes']);_0x22215a[_0xe034('0x2c')]=_[_0xe034('0x2b')](_0x1949ae['query']);_0x22215a['filters']=_['intersection'](_0x22215a[_0xe034('0x2e')],_0x22215a[_0xe034('0x2c')]);_0x426314[_0xe034('0x2f')]=_[_0xe034('0x30')](_0x22215a['model'],qs[_0xe034('0x31')](_0x1949ae['query'][_0xe034('0x31')]));_0x426314['attributes']=_0x426314['attributes'][_0xe034('0x43')]?_0x426314[_0xe034('0x2f')]:_0x22215a[_0xe034('0x2e')];if(_0x1949ae['query'][_0xe034('0x44')]){_0x426314['include']=[{'all':!![]}];}_0x426314=_[_0xe034('0x3a')]({},_0x426314,_0x1949ae[_0xe034('0x3b')]);return db[_0xe034('0x42')][_0xe034('0x45')](_0x426314)[_0xe034('0x22')](handleEntityNotFound(_0x2fe878,null))[_0xe034('0x22')](respondWithResult(_0x2fe878,null))[_0xe034('0x3f')](handleError(_0x2fe878,null));};exports[_0xe034('0x46')]=function(_0x352cde,_0x2d7195){return db['ZendeskConfiguration'][_0xe034('0x46')](_0x352cde[_0xe034('0x47')],{})['then'](respondWithResult(_0x2d7195,0xc9))[_0xe034('0x3f')](handleError(_0x2d7195,null));};exports[_0xe034('0x21')]=function(_0x17b5a6,_0x1d3e71){if(_0x17b5a6[_0xe034('0x47')]['id']){delete _0x17b5a6[_0xe034('0x47')]['id'];}return db[_0xe034('0x42')][_0xe034('0x45')]({'where':{'id':_0x17b5a6[_0xe034('0x41')]['id']}})[_0xe034('0x22')](handleEntityNotFound(_0x1d3e71,null))[_0xe034('0x22')](saveUpdates(_0x17b5a6[_0xe034('0x47')],null))[_0xe034('0x22')](respondWithResult(_0x1d3e71,null))['catch'](handleError(_0x1d3e71,null));};exports['destroy']=function(_0x2e5adb,_0x53f4c4){return db[_0xe034('0x42')][_0xe034('0x45')]({'where':{'id':_0x2e5adb[_0xe034('0x41')]['id']}})[_0xe034('0x22')](handleEntityNotFound(_0x53f4c4,null))[_0xe034('0x22')](removeEntity(_0x53f4c4,null))[_0xe034('0x3f')](handleError(_0x53f4c4,null));};exports['getFields']=function(_0xf6b145,_0x1d8fde,_0x1bf109){var _0x970b67={};var _0xe719a1={};var _0x34df4f;var _0x5d0472;return db['ZendeskConfiguration'][_0xe034('0x48')]({'where':{'id':_0xf6b145[_0xe034('0x41')]['id']}})['then'](handleEntityNotFound(_0x1d8fde,null))[_0xe034('0x22')](function(_0x165aff){if(_0x165aff){_0x34df4f=_0x165aff;_0xe719a1[_0xe034('0x2e')]=_[_0xe034('0x2b')](db[_0xe034('0x49')][_0xe034('0x4a')]);_0xe719a1[_0xe034('0x2c')]=_[_0xe034('0x2b')](_0xf6b145[_0xe034('0x2c')]);_0xe719a1[_0xe034('0x2d')]=_[_0xe034('0x30')](_0xe719a1[_0xe034('0x2e')],_0xe719a1[_0xe034('0x2c')]);_0x970b67['attributes']=_['intersection'](_0xe719a1['model'],qs[_0xe034('0x31')](_0xf6b145['query'][_0xe034('0x31')]));_0x970b67[_0xe034('0x2f')]=_0x970b67[_0xe034('0x2f')][_0xe034('0x43')]?_0x970b67[_0xe034('0x2f')]:_0xe719a1['model'];_0x970b67[_0xe034('0x34')]=qs[_0xe034('0x35')](_0xf6b145[_0xe034('0x2c')][_0xe034('0x35')]);_0x970b67[_0xe034('0x36')]=qs[_0xe034('0x2d')](_[_0xe034('0x37')](_0xf6b145[_0xe034('0x2c')],_0xe719a1[_0xe034('0x2d')]));if(_0xf6b145[_0xe034('0x2c')][_0xe034('0x39')]){_0x970b67[_0xe034('0x36')]=_['merge'](_0x970b67[_0xe034('0x36')],{'$or':_['map'](_0x970b67['attributes'],function(_0x1bb3a7){var _0x190aff={};_0x190aff[_0x1bb3a7]={'$like':'%'+_0xf6b145['query'][_0xe034('0x39')]+'%'};return _0x190aff;})});}_0x970b67=_[_0xe034('0x3a')]({},_0x970b67,_0xf6b145[_0xe034('0x3b')]);return _0x34df4f[_0xe034('0x4b')](_0x970b67);}})[_0xe034('0x22')](function(_0x561a58){if(_0x561a58){_0x5d0472=_0x561a58['length'];if(!_0xf6b145[_0xe034('0x2c')]['hasOwnProperty'](_0xe034('0x4c'))){_0x970b67['limit']=qs[_0xe034('0x33')](_0xf6b145['query'][_0xe034('0x33')]);_0x970b67[_0xe034('0x1a')]=qs['offset'](_0xf6b145[_0xe034('0x2c')][_0xe034('0x1a')]);}return _0x34df4f[_0xe034('0x4b')](_0x970b67);}})[_0xe034('0x22')](function(_0x4d567b){if(_0x4d567b){return _0x4d567b?{'count':_0x5d0472,'rows':_0x4d567b}:null;}})[_0xe034('0x22')](respondWithResult(_0x1d8fde,null))['catch'](handleError(_0x1d8fde,null));};exports[_0xe034('0x4d')]=function(_0x59afa1,_0x1c0df5,_0x1f9a53){var _0xec5fb1={};var _0x355c6d={};var _0x352873;var _0x516c02;return db[_0xe034('0x42')][_0xe034('0x48')]({'where':{'id':_0x59afa1[_0xe034('0x41')]['id']}})[_0xe034('0x22')](handleEntityNotFound(_0x1c0df5,null))[_0xe034('0x22')](function(_0x1783fd){if(_0x1783fd){_0x352873=_0x1783fd;_0x355c6d['model']=_[_0xe034('0x2b')](db['ZendeskField'][_0xe034('0x4a')]);_0x355c6d[_0xe034('0x2c')]=_[_0xe034('0x2b')](_0x59afa1[_0xe034('0x2c')]);_0x355c6d[_0xe034('0x2d')]=_[_0xe034('0x30')](_0x355c6d[_0xe034('0x2e')],_0x355c6d[_0xe034('0x2c')]);_0xec5fb1[_0xe034('0x2f')]=_[_0xe034('0x30')](_0x355c6d[_0xe034('0x2e')],qs[_0xe034('0x31')](_0x59afa1['query']['fields']));_0xec5fb1[_0xe034('0x2f')]=_0xec5fb1['attributes'][_0xe034('0x43')]?_0xec5fb1[_0xe034('0x2f')]:_0x355c6d[_0xe034('0x2e')];_0xec5fb1[_0xe034('0x34')]=qs['sort'](_0x59afa1['query']['sort']);_0xec5fb1[_0xe034('0x36')]=qs['filters'](_[_0xe034('0x37')](_0x59afa1['query'],_0x355c6d[_0xe034('0x2d')]));if(_0x59afa1[_0xe034('0x2c')][_0xe034('0x39')]){_0xec5fb1[_0xe034('0x36')]=_[_0xe034('0x3a')](_0xec5fb1['where'],{'$or':_[_0xe034('0x27')](_0xec5fb1[_0xe034('0x2f')],function(_0x5a1381){var _0xfb502b={};_0xfb502b[_0x5a1381]={'$like':'%'+_0x59afa1['query']['filter']+'%'};return _0xfb502b;})});}_0xec5fb1=_['merge']({},_0xec5fb1,_0x59afa1[_0xe034('0x3b')]);return _0x352873['getSubjects'](_0xec5fb1);}})[_0xe034('0x22')](function(_0x4b79b4){if(_0x4b79b4){_0x516c02=_0x4b79b4[_0xe034('0x43')];if(!_0x59afa1[_0xe034('0x2c')][_0xe034('0x32')](_0xe034('0x4c'))){_0xec5fb1[_0xe034('0x33')]=qs[_0xe034('0x33')](_0x59afa1[_0xe034('0x2c')]['limit']);_0xec5fb1[_0xe034('0x1a')]=qs[_0xe034('0x1a')](_0x59afa1[_0xe034('0x2c')][_0xe034('0x1a')]);}return _0x352873[_0xe034('0x4d')](_0xec5fb1);}})['then'](function(_0x40cfc7){if(_0x40cfc7){return _0x40cfc7?{'count':_0x516c02,'rows':_0x40cfc7}:null;}})['then'](respondWithResult(_0x1c0df5,null))[_0xe034('0x3f')](handleError(_0x1c0df5,null));};exports['getDescriptions']=function(_0x568608,_0x189cb4,_0x482fd6){var _0x1c77eb={};var _0x28d546={};var _0x3d858b;var _0x45edca;return db[_0xe034('0x42')][_0xe034('0x48')]({'where':{'id':_0x568608[_0xe034('0x41')]['id']}})[_0xe034('0x22')](handleEntityNotFound(_0x189cb4,null))[_0xe034('0x22')](function(_0x288d74){if(_0x288d74){_0x3d858b=_0x288d74;_0x28d546[_0xe034('0x2e')]=_[_0xe034('0x2b')](db['ZendeskField'][_0xe034('0x4a')]);_0x28d546[_0xe034('0x2c')]=_['keys'](_0x568608[_0xe034('0x2c')]);_0x28d546[_0xe034('0x2d')]=_['intersection'](_0x28d546['model'],_0x28d546[_0xe034('0x2c')]);_0x1c77eb[_0xe034('0x2f')]=_['intersection'](_0x28d546['model'],qs['fields'](_0x568608[_0xe034('0x2c')][_0xe034('0x31')]));_0x1c77eb['attributes']=_0x1c77eb[_0xe034('0x2f')]['length']?_0x1c77eb['attributes']:_0x28d546[_0xe034('0x2e')];_0x1c77eb['order']=qs[_0xe034('0x35')](_0x568608['query'][_0xe034('0x35')]);_0x1c77eb[_0xe034('0x36')]=qs[_0xe034('0x2d')](_[_0xe034('0x37')](_0x568608[_0xe034('0x2c')],_0x28d546[_0xe034('0x2d')]));if(_0x568608[_0xe034('0x2c')][_0xe034('0x39')]){_0x1c77eb[_0xe034('0x36')]=_['merge'](_0x1c77eb['where'],{'$or':_[_0xe034('0x27')](_0x1c77eb[_0xe034('0x2f')],function(_0xf2a15a){var _0x40d23b={};_0x40d23b[_0xf2a15a]={'$like':'%'+_0x568608[_0xe034('0x2c')]['filter']+'%'};return _0x40d23b;})});}_0x1c77eb=_['merge']({},_0x1c77eb,_0x568608[_0xe034('0x3b')]);return _0x3d858b[_0xe034('0x4e')](_0x1c77eb);}})[_0xe034('0x22')](function(_0x504556){if(_0x504556){_0x45edca=_0x504556[_0xe034('0x43')];if(!_0x568608['query'][_0xe034('0x32')](_0xe034('0x4c'))){_0x1c77eb[_0xe034('0x33')]=qs[_0xe034('0x33')](_0x568608[_0xe034('0x2c')][_0xe034('0x33')]);_0x1c77eb[_0xe034('0x1a')]=qs[_0xe034('0x1a')](_0x568608[_0xe034('0x2c')][_0xe034('0x1a')]);}return _0x3d858b[_0xe034('0x4e')](_0x1c77eb);}})[_0xe034('0x22')](function(_0x58600a){if(_0x58600a){return _0x58600a?{'count':_0x45edca,'rows':_0x58600a}:null;}})[_0xe034('0x22')](respondWithResult(_0x189cb4,null))[_0xe034('0x3f')](handleError(_0x189cb4,null));};exports[_0xe034('0x4f')]=function(_0xd52b84,_0x53d8a9,_0x53334a){var _0x3a0b7e={};var _0x2dd50d={};var _0x5ed2f8;var _0x22a02f;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xd52b84[_0xe034('0x41')]['id']}})[_0xe034('0x22')](handleEntityNotFound(_0x53d8a9,null))[_0xe034('0x22')](function(_0x530394){if(_0x530394){_0x5ed2f8=_0x530394;_0x2dd50d[_0xe034('0x2e')]=_['keys'](db['Tag'][_0xe034('0x4a')]);_0x2dd50d['query']=_[_0xe034('0x2b')](_0xd52b84[_0xe034('0x2c')]);_0x2dd50d[_0xe034('0x2d')]=_[_0xe034('0x30')](_0x2dd50d[_0xe034('0x2e')],_0x2dd50d['query']);_0x3a0b7e[_0xe034('0x2f')]=_[_0xe034('0x30')](_0x2dd50d[_0xe034('0x2e')],qs['fields'](_0xd52b84[_0xe034('0x2c')]['fields']));_0x3a0b7e[_0xe034('0x2f')]=_0x3a0b7e[_0xe034('0x2f')][_0xe034('0x43')]?_0x3a0b7e['attributes']:_0x2dd50d[_0xe034('0x2e')];_0x3a0b7e[_0xe034('0x34')]=qs[_0xe034('0x35')](_0xd52b84[_0xe034('0x2c')][_0xe034('0x35')]);_0x3a0b7e[_0xe034('0x36')]=qs['filters'](_[_0xe034('0x37')](_0xd52b84[_0xe034('0x2c')],_0x2dd50d[_0xe034('0x2d')]));if(_0xd52b84[_0xe034('0x2c')][_0xe034('0x39')]){_0x3a0b7e['where']=_[_0xe034('0x3a')](_0x3a0b7e['where'],{'$or':_[_0xe034('0x27')](_0x3a0b7e[_0xe034('0x2f')],function(_0x1e99b1){var _0x39b507={};_0x39b507[_0x1e99b1]={'$like':'%'+_0xd52b84[_0xe034('0x2c')]['filter']+'%'};return _0x39b507;})});}_0x3a0b7e=_[_0xe034('0x3a')]({},_0x3a0b7e,_0xd52b84[_0xe034('0x3b')]);return _0x5ed2f8[_0xe034('0x4f')](_0x3a0b7e);}})[_0xe034('0x22')](function(_0x156c77){if(_0x156c77){_0x22a02f=_0x156c77[_0xe034('0x43')];if(!_0xd52b84[_0xe034('0x2c')][_0xe034('0x32')](_0xe034('0x4c'))){_0x3a0b7e[_0xe034('0x33')]=qs[_0xe034('0x33')](_0xd52b84[_0xe034('0x2c')][_0xe034('0x33')]);_0x3a0b7e[_0xe034('0x1a')]=qs['offset'](_0xd52b84[_0xe034('0x2c')]['offset']);}return _0x5ed2f8[_0xe034('0x4f')](_0x3a0b7e);}})[_0xe034('0x22')](function(_0x4ac44){if(_0x4ac44){return _0x4ac44?{'count':_0x22a02f,'rows':_0x4ac44}:null;}})[_0xe034('0x22')](respondWithResult(_0x53d8a9,null))[_0xe034('0x3f')](handleError(_0x53d8a9,null));};exports['setTags']=function(_0x590629,_0x66cb83,_0x5eeb6a){if(_0x590629['body']['id']){delete _0x590629[_0xe034('0x47')]['id'];}return db[_0xe034('0x42')]['findOne']({'where':{'id':_0x590629[_0xe034('0x41')]['id']}})[_0xe034('0x22')](handleEntityNotFound(_0x66cb83,null))[_0xe034('0x22')](function(_0x27ef8b){if(_0x27ef8b){return _0x27ef8b[_0xe034('0x50')](_0x590629[_0xe034('0x47')]['ids']||[]);}return null;})['then'](respondWithResult(_0x66cb83,null))[_0xe034('0x3f')](handleError(_0x66cb83,null));}; \ No newline at end of file +var _0x452d=['getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','getFields','findOne','filter','ZendeskField','getSubjects'];(function(_0x4c10f9,_0x3ca0b9){var _0xf8689=function(_0x408cdb){while(--_0x408cdb){_0x4c10f9['push'](_0x4c10f9['shift']());}};_0xf8689(++_0x3ca0b9);}(_0x452d,0x109));var _0xd452=function(_0x134377,_0x458667){_0x134377=_0x134377-0x0;var _0x2d22df=_0x452d[_0x134377];return _0x2d22df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd452('0x0'));var zipdir=require(_0xd452('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd452('0x2'));var moment=require(_0xd452('0x3'));var BPromise=require(_0xd452('0x4'));var Mustache=require('mustache');var util=require(_0xd452('0x5'));var path=require(_0xd452('0x6'));var sox=require(_0xd452('0x7'));var csv=require(_0xd452('0x8'));var ejs=require(_0xd452('0x9'));var fs=require('fs');var fs_extra=require(_0xd452('0xa'));var _=require(_0xd452('0xb'));var squel=require('squel');var crypto=require(_0xd452('0xc'));var jsforce=require(_0xd452('0xd'));var deskjs=require(_0xd452('0xe'));var toCsv=require(_0xd452('0x8'));var querystring=require(_0xd452('0xf'));var Papa=require('papaparse');var Redis=require(_0xd452('0x10'));var authService=require(_0xd452('0x11'));var qs=require(_0xd452('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd452('0x13'))(_0xd452('0x14'));var utils=require(_0xd452('0x15'));var config=require(_0xd452('0x16'));var licenseUtil=require(_0xd452('0x17'));var db=require(_0xd452('0x18'))['db'];function respondWithStatusCode(_0x2a899c,_0x3fc3df){_0x3fc3df=_0x3fc3df||0xcc;return function(_0x49c456){if(_0x49c456){return _0x2a899c['sendStatus'](_0x3fc3df);}return _0x2a899c[_0xd452('0x19')](_0x3fc3df)[_0xd452('0x1a')]();};}function respondWithResult(_0x498133,_0x3e93bc){_0x3e93bc=_0x3e93bc||0xc8;return function(_0x3c24b2){if(_0x3c24b2){return _0x498133['status'](_0x3e93bc)[_0xd452('0x1b')](_0x3c24b2);}};}function respondWithFilteredResult(_0x7c1730,_0x674a47){return function(_0x5356f1){if(_0x5356f1){var _0x2eabb4=typeof _0x674a47[_0xd452('0x1c')]===_0xd452('0x1d')&&typeof _0x674a47[_0xd452('0x1e')]===_0xd452('0x1d');var _0x2e0421=_0x5356f1[_0xd452('0x1f')];var _0x3040dd=_0x2eabb4?0x0:_0x674a47[_0xd452('0x1c')];var _0x57cfd1=_0x2eabb4?_0x5356f1['count']:_0x674a47[_0xd452('0x1c')]+_0x674a47[_0xd452('0x1e')];var _0xd5e86f;if(_0x57cfd1>=_0x2e0421){_0x57cfd1=_0x2e0421;_0xd5e86f=0xc8;}else{_0xd5e86f=0xce;}_0x7c1730[_0xd452('0x19')](_0xd5e86f);return _0x7c1730[_0xd452('0x20')](_0xd452('0x21'),_0x3040dd+'-'+_0x57cfd1+'/'+_0x2e0421)[_0xd452('0x1b')](_0x5356f1);}return null;};}function patchUpdates(_0x1a60fd){return function(_0x212003){try{jsonpatch[_0xd452('0x22')](_0x212003,_0x1a60fd,!![]);}catch(_0x121966){return BPromise[_0xd452('0x23')](_0x121966);}return _0x212003[_0xd452('0x24')]();};}function saveUpdates(_0x18274f,_0x2ce10c){return function(_0x19cb94){if(_0x19cb94){return _0x19cb94[_0xd452('0x25')](_0x18274f)[_0xd452('0x26')](function(_0x3c26bc){return _0x3c26bc;});}return null;};}function removeEntity(_0x4066ae,_0x2f9eab){return function(_0x3da7dc){if(_0x3da7dc){return _0x3da7dc['destroy']()[_0xd452('0x26')](function(){_0x4066ae[_0xd452('0x19')](0xcc)[_0xd452('0x1a')]();});}};}function handleEntityNotFound(_0x55a885,_0x32fc4c){return function(_0x3a472d){if(!_0x3a472d){_0x55a885[_0xd452('0x27')](0x194);}return _0x3a472d;};}function handleError(_0x59772b,_0x34caad){_0x34caad=_0x34caad||0x1f4;return function(_0x316b02){logger[_0xd452('0x28')](_0x316b02[_0xd452('0x29')]);if(_0x316b02[_0xd452('0x2a')]){delete _0x316b02['name'];}_0x59772b[_0xd452('0x19')](_0x34caad)[_0xd452('0x2b')](_0x316b02);};}exports[_0xd452('0x2c')]=function(_0x4b341c,_0x1d61da){var _0x15135c={},_0x49ea79={},_0x395ba3={'count':0x0,'rows':[]};var _0x11da13=_[_0xd452('0x2d')](db[_0xd452('0x2e')][_0xd452('0x2f')],function(_0x11043e){return{'name':_0x11043e[_0xd452('0x30')],'type':_0x11043e[_0xd452('0x31')]['key']};});_0x49ea79['model']=_[_0xd452('0x2d')](_0x11da13,_0xd452('0x2a'));_0x49ea79[_0xd452('0x32')]=_[_0xd452('0x33')](_0x4b341c['query']);_0x49ea79[_0xd452('0x34')]=_[_0xd452('0x35')](_0x49ea79['model'],_0x49ea79['query']);_0x15135c[_0xd452('0x36')]=_[_0xd452('0x35')](_0x49ea79['model'],qs['fields'](_0x4b341c[_0xd452('0x32')][_0xd452('0x37')]));_0x15135c[_0xd452('0x36')]=_0x15135c[_0xd452('0x36')][_0xd452('0x38')]?_0x15135c[_0xd452('0x36')]:_0x49ea79[_0xd452('0x39')];if(!_0x4b341c['query'][_0xd452('0x3a')](_0xd452('0x3b'))){_0x15135c['limit']=qs[_0xd452('0x1e')](_0x4b341c[_0xd452('0x32')][_0xd452('0x1e')]);_0x15135c[_0xd452('0x1c')]=qs[_0xd452('0x1c')](_0x4b341c[_0xd452('0x32')][_0xd452('0x1c')]);}_0x15135c[_0xd452('0x3c')]=qs[_0xd452('0x3d')](_0x4b341c['query'][_0xd452('0x3d')]);_0x15135c[_0xd452('0x3e')]=qs[_0xd452('0x34')](_[_0xd452('0x3f')](_0x4b341c['query'],_0x49ea79['filters']),_0x11da13);if(_0x4b341c[_0xd452('0x32')]['filter']){_0x15135c[_0xd452('0x3e')]=_['merge'](_0x15135c['where'],{'$or':_['map'](_0x11da13,function(_0x5dea12){if(_0x5dea12[_0xd452('0x31')]!==_0xd452('0x40')){var _0x5b9342={};_0x5b9342[_0x5dea12[_0xd452('0x2a')]]={'$like':'%'+_0x4b341c['query']['filter']+'%'};return _0x5b9342;}})});}_0x15135c=_[_0xd452('0x41')]({},_0x15135c,_0x4b341c[_0xd452('0x42')]);var _0x23d028={'where':_0x15135c[_0xd452('0x3e')]};return db[_0xd452('0x2e')][_0xd452('0x1f')](_0x23d028)[_0xd452('0x26')](function(_0x1b3eea){_0x395ba3[_0xd452('0x1f')]=_0x1b3eea;if(_0x4b341c[_0xd452('0x32')][_0xd452('0x43')]){_0x15135c[_0xd452('0x44')]=[{'all':!![]}];}return db[_0xd452('0x2e')][_0xd452('0x45')](_0x15135c);})[_0xd452('0x26')](function(_0x8b6109){_0x395ba3[_0xd452('0x46')]=_0x8b6109;return _0x395ba3;})['then'](respondWithFilteredResult(_0x1d61da,_0x15135c))[_0xd452('0x47')](handleError(_0x1d61da,null));};exports[_0xd452('0x48')]=function(_0x34c0cf,_0x4f6a76){var _0x1cd87a={'raw':![],'where':{'id':_0x34c0cf[_0xd452('0x49')]['id']}},_0x33cc1d={};_0x33cc1d[_0xd452('0x39')]=_['keys'](db[_0xd452('0x2e')][_0xd452('0x2f')]);_0x33cc1d[_0xd452('0x32')]=_[_0xd452('0x33')](_0x34c0cf[_0xd452('0x32')]);_0x33cc1d[_0xd452('0x34')]=_[_0xd452('0x35')](_0x33cc1d[_0xd452('0x39')],_0x33cc1d[_0xd452('0x32')]);_0x1cd87a['attributes']=_['intersection'](_0x33cc1d[_0xd452('0x39')],qs[_0xd452('0x37')](_0x34c0cf[_0xd452('0x32')]['fields']));_0x1cd87a['attributes']=_0x1cd87a[_0xd452('0x36')][_0xd452('0x38')]?_0x1cd87a['attributes']:_0x33cc1d[_0xd452('0x39')];if(_0x34c0cf['query'][_0xd452('0x43')]){_0x1cd87a[_0xd452('0x44')]=[{'all':!![]}];}_0x1cd87a=_[_0xd452('0x41')]({},_0x1cd87a,_0x34c0cf['options']);return db[_0xd452('0x2e')]['find'](_0x1cd87a)[_0xd452('0x26')](handleEntityNotFound(_0x4f6a76,null))[_0xd452('0x26')](respondWithResult(_0x4f6a76,null))[_0xd452('0x47')](handleError(_0x4f6a76,null));};exports[_0xd452('0x4a')]=function(_0x6af269,_0x4113a1){return db[_0xd452('0x2e')][_0xd452('0x4a')](_0x6af269['body'],{})['then'](respondWithResult(_0x4113a1,0xc9))[_0xd452('0x47')](handleError(_0x4113a1,null));};exports[_0xd452('0x25')]=function(_0xcab5ac,_0xd7733f){if(_0xcab5ac[_0xd452('0x4b')]['id']){delete _0xcab5ac['body']['id'];}return db[_0xd452('0x2e')][_0xd452('0x4c')]({'where':{'id':_0xcab5ac[_0xd452('0x49')]['id']}})[_0xd452('0x26')](handleEntityNotFound(_0xd7733f,null))['then'](saveUpdates(_0xcab5ac['body'],null))[_0xd452('0x26')](respondWithResult(_0xd7733f,null))[_0xd452('0x47')](handleError(_0xd7733f,null));};exports[_0xd452('0x4d')]=function(_0x1398c3,_0x1463bc){return db['ZendeskConfiguration']['find']({'where':{'id':_0x1398c3[_0xd452('0x49')]['id']}})[_0xd452('0x26')](handleEntityNotFound(_0x1463bc,null))[_0xd452('0x26')](removeEntity(_0x1463bc,null))[_0xd452('0x47')](handleError(_0x1463bc,null));};exports[_0xd452('0x4e')]=function(_0x27c928,_0x5c5f27,_0x40813e){var _0x1e381b={};var _0x3526f7={};var _0x12647f;var _0x3979b1;return db[_0xd452('0x2e')][_0xd452('0x4f')]({'where':{'id':_0x27c928[_0xd452('0x49')]['id']}})[_0xd452('0x26')](handleEntityNotFound(_0x5c5f27,null))[_0xd452('0x26')](function(_0x5e29e6){if(_0x5e29e6){_0x12647f=_0x5e29e6;_0x3526f7[_0xd452('0x39')]=_[_0xd452('0x33')](db['ZendeskField']['rawAttributes']);_0x3526f7[_0xd452('0x32')]=_[_0xd452('0x33')](_0x27c928['query']);_0x3526f7[_0xd452('0x34')]=_['intersection'](_0x3526f7[_0xd452('0x39')],_0x3526f7[_0xd452('0x32')]);_0x1e381b[_0xd452('0x36')]=_[_0xd452('0x35')](_0x3526f7[_0xd452('0x39')],qs[_0xd452('0x37')](_0x27c928[_0xd452('0x32')]['fields']));_0x1e381b[_0xd452('0x36')]=_0x1e381b[_0xd452('0x36')][_0xd452('0x38')]?_0x1e381b[_0xd452('0x36')]:_0x3526f7[_0xd452('0x39')];_0x1e381b['order']=qs[_0xd452('0x3d')](_0x27c928[_0xd452('0x32')][_0xd452('0x3d')]);_0x1e381b[_0xd452('0x3e')]=qs[_0xd452('0x34')](_[_0xd452('0x3f')](_0x27c928[_0xd452('0x32')],_0x3526f7[_0xd452('0x34')]));if(_0x27c928['query'][_0xd452('0x50')]){_0x1e381b['where']=_[_0xd452('0x41')](_0x1e381b['where'],{'$or':_[_0xd452('0x2d')](_0x1e381b['attributes'],function(_0x4cf384){var _0x306987={};_0x306987[_0x4cf384]={'$like':'%'+_0x27c928[_0xd452('0x32')]['filter']+'%'};return _0x306987;})});}_0x1e381b=_['merge']({},_0x1e381b,_0x27c928[_0xd452('0x42')]);return _0x12647f[_0xd452('0x4e')](_0x1e381b);}})[_0xd452('0x26')](function(_0x52eab5){if(_0x52eab5){_0x3979b1=_0x52eab5['length'];if(!_0x27c928[_0xd452('0x32')]['hasOwnProperty'](_0xd452('0x3b'))){_0x1e381b['limit']=qs['limit'](_0x27c928[_0xd452('0x32')][_0xd452('0x1e')]);_0x1e381b[_0xd452('0x1c')]=qs[_0xd452('0x1c')](_0x27c928[_0xd452('0x32')][_0xd452('0x1c')]);}return _0x12647f[_0xd452('0x4e')](_0x1e381b);}})[_0xd452('0x26')](function(_0x338516){if(_0x338516){return _0x338516?{'count':_0x3979b1,'rows':_0x338516}:null;}})['then'](respondWithResult(_0x5c5f27,null))[_0xd452('0x47')](handleError(_0x5c5f27,null));};exports['getSubjects']=function(_0x42e74c,_0x11d261,_0xf8cca3){var _0x5e2381={};var _0x39508d={};var _0xc08c0d;var _0x533fec;return db[_0xd452('0x2e')][_0xd452('0x4f')]({'where':{'id':_0x42e74c['params']['id']}})[_0xd452('0x26')](handleEntityNotFound(_0x11d261,null))[_0xd452('0x26')](function(_0x36ea4a){if(_0x36ea4a){_0xc08c0d=_0x36ea4a;_0x39508d['model']=_[_0xd452('0x33')](db[_0xd452('0x51')][_0xd452('0x2f')]);_0x39508d[_0xd452('0x32')]=_['keys'](_0x42e74c['query']);_0x39508d['filters']=_[_0xd452('0x35')](_0x39508d[_0xd452('0x39')],_0x39508d[_0xd452('0x32')]);_0x5e2381[_0xd452('0x36')]=_[_0xd452('0x35')](_0x39508d[_0xd452('0x39')],qs[_0xd452('0x37')](_0x42e74c[_0xd452('0x32')][_0xd452('0x37')]));_0x5e2381[_0xd452('0x36')]=_0x5e2381[_0xd452('0x36')][_0xd452('0x38')]?_0x5e2381[_0xd452('0x36')]:_0x39508d[_0xd452('0x39')];_0x5e2381['order']=qs[_0xd452('0x3d')](_0x42e74c['query'][_0xd452('0x3d')]);_0x5e2381[_0xd452('0x3e')]=qs['filters'](_[_0xd452('0x3f')](_0x42e74c[_0xd452('0x32')],_0x39508d['filters']));if(_0x42e74c['query'][_0xd452('0x50')]){_0x5e2381[_0xd452('0x3e')]=_[_0xd452('0x41')](_0x5e2381[_0xd452('0x3e')],{'$or':_[_0xd452('0x2d')](_0x5e2381['attributes'],function(_0x448f4a){var _0x5db8ef={};_0x5db8ef[_0x448f4a]={'$like':'%'+_0x42e74c[_0xd452('0x32')][_0xd452('0x50')]+'%'};return _0x5db8ef;})});}_0x5e2381=_[_0xd452('0x41')]({},_0x5e2381,_0x42e74c[_0xd452('0x42')]);return _0xc08c0d[_0xd452('0x52')](_0x5e2381);}})[_0xd452('0x26')](function(_0x33417a){if(_0x33417a){_0x533fec=_0x33417a[_0xd452('0x38')];if(!_0x42e74c[_0xd452('0x32')][_0xd452('0x3a')](_0xd452('0x3b'))){_0x5e2381[_0xd452('0x1e')]=qs[_0xd452('0x1e')](_0x42e74c[_0xd452('0x32')][_0xd452('0x1e')]);_0x5e2381[_0xd452('0x1c')]=qs[_0xd452('0x1c')](_0x42e74c[_0xd452('0x32')][_0xd452('0x1c')]);}return _0xc08c0d[_0xd452('0x52')](_0x5e2381);}})[_0xd452('0x26')](function(_0x14f3a2){if(_0x14f3a2){return _0x14f3a2?{'count':_0x533fec,'rows':_0x14f3a2}:null;}})[_0xd452('0x26')](respondWithResult(_0x11d261,null))['catch'](handleError(_0x11d261,null));};exports[_0xd452('0x53')]=function(_0xd65623,_0x897250,_0x15d21c){var _0x595398={};var _0x1735ea={};var _0x2c1b74;var _0x44079e;return db[_0xd452('0x2e')][_0xd452('0x4f')]({'where':{'id':_0xd65623[_0xd452('0x49')]['id']}})[_0xd452('0x26')](handleEntityNotFound(_0x897250,null))[_0xd452('0x26')](function(_0x115dd4){if(_0x115dd4){_0x2c1b74=_0x115dd4;_0x1735ea[_0xd452('0x39')]=_[_0xd452('0x33')](db[_0xd452('0x51')][_0xd452('0x2f')]);_0x1735ea[_0xd452('0x32')]=_[_0xd452('0x33')](_0xd65623['query']);_0x1735ea[_0xd452('0x34')]=_['intersection'](_0x1735ea[_0xd452('0x39')],_0x1735ea[_0xd452('0x32')]);_0x595398[_0xd452('0x36')]=_[_0xd452('0x35')](_0x1735ea['model'],qs[_0xd452('0x37')](_0xd65623[_0xd452('0x32')][_0xd452('0x37')]));_0x595398[_0xd452('0x36')]=_0x595398['attributes']['length']?_0x595398[_0xd452('0x36')]:_0x1735ea[_0xd452('0x39')];_0x595398[_0xd452('0x3c')]=qs[_0xd452('0x3d')](_0xd65623[_0xd452('0x32')][_0xd452('0x3d')]);_0x595398['where']=qs[_0xd452('0x34')](_[_0xd452('0x3f')](_0xd65623['query'],_0x1735ea[_0xd452('0x34')]));if(_0xd65623[_0xd452('0x32')][_0xd452('0x50')]){_0x595398['where']=_[_0xd452('0x41')](_0x595398['where'],{'$or':_[_0xd452('0x2d')](_0x595398[_0xd452('0x36')],function(_0x54f262){var _0x17b543={};_0x17b543[_0x54f262]={'$like':'%'+_0xd65623['query'][_0xd452('0x50')]+'%'};return _0x17b543;})});}_0x595398=_[_0xd452('0x41')]({},_0x595398,_0xd65623['options']);return _0x2c1b74[_0xd452('0x53')](_0x595398);}})[_0xd452('0x26')](function(_0x402637){if(_0x402637){_0x44079e=_0x402637['length'];if(!_0xd65623[_0xd452('0x32')][_0xd452('0x3a')](_0xd452('0x3b'))){_0x595398[_0xd452('0x1e')]=qs[_0xd452('0x1e')](_0xd65623['query'][_0xd452('0x1e')]);_0x595398[_0xd452('0x1c')]=qs[_0xd452('0x1c')](_0xd65623[_0xd452('0x32')]['offset']);}return _0x2c1b74['getDescriptions'](_0x595398);}})[_0xd452('0x26')](function(_0x59d49e){if(_0x59d49e){return _0x59d49e?{'count':_0x44079e,'rows':_0x59d49e}:null;}})[_0xd452('0x26')](respondWithResult(_0x897250,null))[_0xd452('0x47')](handleError(_0x897250,null));};exports[_0xd452('0x54')]=function(_0x1392bb,_0x13e0c5,_0xc863c3){var _0xcff05d={};var _0x49cc8f={};var _0x197c96;var _0x403f0a;return db['ZendeskConfiguration'][_0xd452('0x4f')]({'where':{'id':_0x1392bb[_0xd452('0x49')]['id']}})[_0xd452('0x26')](handleEntityNotFound(_0x13e0c5,null))[_0xd452('0x26')](function(_0xfff3d3){if(_0xfff3d3){_0x197c96=_0xfff3d3;_0x49cc8f[_0xd452('0x39')]=_[_0xd452('0x33')](db['Tag'][_0xd452('0x2f')]);_0x49cc8f['query']=_['keys'](_0x1392bb[_0xd452('0x32')]);_0x49cc8f[_0xd452('0x34')]=_[_0xd452('0x35')](_0x49cc8f[_0xd452('0x39')],_0x49cc8f[_0xd452('0x32')]);_0xcff05d['attributes']=_[_0xd452('0x35')](_0x49cc8f[_0xd452('0x39')],qs['fields'](_0x1392bb['query'][_0xd452('0x37')]));_0xcff05d[_0xd452('0x36')]=_0xcff05d[_0xd452('0x36')][_0xd452('0x38')]?_0xcff05d[_0xd452('0x36')]:_0x49cc8f[_0xd452('0x39')];_0xcff05d[_0xd452('0x3c')]=qs[_0xd452('0x3d')](_0x1392bb[_0xd452('0x32')][_0xd452('0x3d')]);_0xcff05d['where']=qs['filters'](_[_0xd452('0x3f')](_0x1392bb['query'],_0x49cc8f[_0xd452('0x34')]));if(_0x1392bb[_0xd452('0x32')][_0xd452('0x50')]){_0xcff05d[_0xd452('0x3e')]=_[_0xd452('0x41')](_0xcff05d[_0xd452('0x3e')],{'$or':_[_0xd452('0x2d')](_0xcff05d[_0xd452('0x36')],function(_0x345b16){var _0x31a267={};_0x31a267[_0x345b16]={'$like':'%'+_0x1392bb[_0xd452('0x32')]['filter']+'%'};return _0x31a267;})});}_0xcff05d=_[_0xd452('0x41')]({},_0xcff05d,_0x1392bb['options']);return _0x197c96[_0xd452('0x54')](_0xcff05d);}})['then'](function(_0x51ec08){if(_0x51ec08){_0x403f0a=_0x51ec08[_0xd452('0x38')];if(!_0x1392bb['query'][_0xd452('0x3a')](_0xd452('0x3b'))){_0xcff05d[_0xd452('0x1e')]=qs['limit'](_0x1392bb[_0xd452('0x32')]['limit']);_0xcff05d['offset']=qs[_0xd452('0x1c')](_0x1392bb[_0xd452('0x32')][_0xd452('0x1c')]);}return _0x197c96[_0xd452('0x54')](_0xcff05d);}})[_0xd452('0x26')](function(_0x54bf40){if(_0x54bf40){return _0x54bf40?{'count':_0x403f0a,'rows':_0x54bf40}:null;}})['then'](respondWithResult(_0x13e0c5,null))[_0xd452('0x47')](handleError(_0x13e0c5,null));};exports[_0xd452('0x55')]=function(_0x30573a,_0x45138,_0x189ece){if(_0x30573a[_0xd452('0x4b')]['id']){delete _0x30573a['body']['id'];}return db[_0xd452('0x2e')][_0xd452('0x4f')]({'where':{'id':_0x30573a[_0xd452('0x49')]['id']}})[_0xd452('0x26')](handleEntityNotFound(_0x45138,null))[_0xd452('0x26')](function(_0x3ec7c5){if(_0x3ec7c5){return _0x3ec7c5['setTags'](_0x30573a['body'][_0xd452('0x56')]||[]);}return null;})[_0xd452('0x26')](respondWithResult(_0x45138,null))[_0xd452('0x47')](handleError(_0x45138,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 553e453..57dcc40 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 _0x1c9a=['moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x5057ff,_0x2ed29e){var _0x4ccfd4=function(_0x64684f){while(--_0x64684f){_0x5057ff['push'](_0x5057ff['shift']());}};_0x4ccfd4(++_0x2ed29e);}(_0x1c9a,0x98));var _0xa1c9=function(_0x322a54,_0x5b4337){_0x322a54=_0x322a54-0x0;var _0x189e73=_0x1c9a[_0x322a54];return _0x189e73;};'use strict';var _=require(_0xa1c9('0x0'));var util=require('util');var logger=require(_0xa1c9('0x1'))('api');var moment=require(_0xa1c9('0x2'));var BPromise=require(_0xa1c9('0x3'));var rp=require(_0xa1c9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa1c9('0x5'));var config=require(_0xa1c9('0x6'));var attributes=require(_0xa1c9('0x7'));module[_0xa1c9('0x8')]=function(_0x572229,_0x144e91){return _0x572229['define'](_0xa1c9('0x9'),attributes,{'tableName':_0xa1c9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x373d=['define','ZendeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x373d,0x1e2));var _0xd373=function(_0xdaffc7,_0x453662){_0xdaffc7=_0xdaffc7-0x0;var _0x503d65=_0x373d[_0xdaffc7];return _0x503d65;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),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 7748d0a..ffa1f55 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 _0x3c1d=['result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','request\x20sent','debug','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','info'];(function(_0x33bea0,_0x35b285){var _0x29c325=function(_0x15a1f4){while(--_0x15a1f4){_0x33bea0['push'](_0x33bea0['shift']());}};_0x29c325(++_0x35b285);}(_0x3c1d,0xaa));var _0xd3c1=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x3c1d[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0xd3c1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd3c1('0x1'));var rs=require(_0xd3c1('0x2'));var fs=require('fs');var Redis=require(_0xd3c1('0x3'));var db=require(_0xd3c1('0x4'))['db'];var utils=require(_0xd3c1('0x5'));var logger=require(_0xd3c1('0x6'))('rpc');var config=require(_0xd3c1('0x7'));var jayson=require(_0xd3c1('0x8'));var client=jayson[_0xd3c1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x482f8d,_0x56a6f2,_0x4a0b27){return new BPromise(function(_0x30364d,_0x2f617e){return client['request'](_0x482f8d,_0x4a0b27)[_0xd3c1('0xa')](function(_0x5af1a7){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x56a6f2,_0xd3c1('0xb'));logger[_0xd3c1('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x56a6f2,_0xd3c1('0xb'),JSON[_0xd3c1('0xd')](_0x5af1a7));if(_0x5af1a7['error']){if(_0x5af1a7[_0xd3c1('0xe')][_0xd3c1('0xf')]===0x1f4){logger[_0xd3c1('0xe')](_0xd3c1('0x10'),_0x56a6f2,_0x5af1a7[_0xd3c1('0xe')][_0xd3c1('0x11')]);return _0x2f617e(_0x5af1a7[_0xd3c1('0xe')][_0xd3c1('0x11')]);}logger[_0xd3c1('0xe')](_0xd3c1('0x10'),_0x56a6f2,_0x5af1a7[_0xd3c1('0xe')]['message']);return _0x30364d(_0x5af1a7[_0xd3c1('0xe')]['message']);}else{logger[_0xd3c1('0x12')]('ZendeskConfiguration,\x20%s,\x20%s',_0x56a6f2,'request\x20sent');_0x30364d(_0x5af1a7[_0xd3c1('0x13')][_0xd3c1('0x11')]);}})[_0xd3c1('0x14')](function(_0x2f736e){logger[_0xd3c1('0xe')](_0xd3c1('0x10'),_0x56a6f2,_0x2f736e);_0x2f617e(_0x2f736e);});});} \ No newline at end of file +var _0x1a56=['rpc','../../config/environment','jayson/promise','http','request','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x563206,_0x778955){var _0x41dbb0=function(_0x463d66){while(--_0x463d66){_0x563206['push'](_0x563206['shift']());}};_0x41dbb0(++_0x778955);}(_0x1a56,0x1c5));var _0x61a5=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x1a56[_0x23b655];return _0x364b32;};'use strict';var _=require('lodash');var util=require(_0x61a5('0x0'));var moment=require('moment');var BPromise=require(_0x61a5('0x1'));var rs=require(_0x61a5('0x2'));var fs=require('fs');var Redis=require(_0x61a5('0x3'));var db=require(_0x61a5('0x4'))['db'];var utils=require(_0x61a5('0x5'));var logger=require(_0x61a5('0x6'))(_0x61a5('0x7'));var config=require(_0x61a5('0x8'));var jayson=require(_0x61a5('0x9'));var client=jayson['client'][_0x61a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a1eef,_0x27b3e4,_0x5503b6){return new BPromise(function(_0xe70cbe,_0x5b3b6b){return client[_0x61a5('0xb')](_0x2a1eef,_0x5503b6)['then'](function(_0x4ee8a1){logger['info'](_0x61a5('0xc'),_0x27b3e4,_0x61a5('0xd'));logger['debug'](_0x61a5('0xe'),_0x27b3e4,_0x61a5('0xd'),JSON[_0x61a5('0xf')](_0x4ee8a1));if(_0x4ee8a1['error']){if(_0x4ee8a1['error'][_0x61a5('0x10')]===0x1f4){logger[_0x61a5('0x11')](_0x61a5('0xc'),_0x27b3e4,_0x4ee8a1[_0x61a5('0x11')][_0x61a5('0x12')]);return _0x5b3b6b(_0x4ee8a1[_0x61a5('0x11')][_0x61a5('0x12')]);}logger[_0x61a5('0x11')](_0x61a5('0xc'),_0x27b3e4,_0x4ee8a1['error']['message']);return _0xe70cbe(_0x4ee8a1[_0x61a5('0x11')][_0x61a5('0x12')]);}else{logger[_0x61a5('0x13')](_0x61a5('0xc'),_0x27b3e4,_0x61a5('0xd'));_0xe70cbe(_0x4ee8a1['result']['message']);}})['catch'](function(_0x1248b4){logger[_0x61a5('0x11')](_0x61a5('0xc'),_0x27b3e4,_0x1248b4);_0x5b3b6b(_0x1248b4);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 00a6a1d..747bc16 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 _0x7841=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','update','delete','destroy','exports','multer'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x7841,0x11f));var _0x1784=function(_0x20259c,_0xe43fb2){_0x20259c=_0x20259c-0x0;var _0x4d988e=_0x7841[_0x20259c];return _0x4d988e;};'use strict';var multer=require(_0x1784('0x0'));var util=require(_0x1784('0x1'));var path=require(_0x1784('0x2'));var timeout=require('connect-timeout');var express=require(_0x1784('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1784('0x4'));var interaction=require(_0x1784('0x5'));var config=require(_0x1784('0x6'));var controller=require('./intZendeskField.controller');router[_0x1784('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1784('0x7')]('/:id',auth[_0x1784('0x8')](),controller[_0x1784('0x9')]);router[_0x1784('0xa')]('/',auth[_0x1784('0x8')](),controller[_0x1784('0xb')]);router['put']('/:id',auth[_0x1784('0x8')](),controller[_0x1784('0xc')]);router[_0x1784('0xd')]('/:id',auth[_0x1784('0x8')](),controller[_0x1784('0xe')]);module[_0x1784('0xf')]=router; \ No newline at end of file +var _0x890f=['index','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x483bc6,_0x22e656){var _0x50940d=function(_0x88ed09){while(--_0x88ed09){_0x483bc6['push'](_0x483bc6['shift']());}};_0x50940d(++_0x22e656);}(_0x890f,0xcd));var _0xf890=function(_0xfdf7a4,_0x37da46){_0xfdf7a4=_0xfdf7a4-0x0;var _0x59ec89=_0x890f[_0xfdf7a4];return _0x59ec89;};'use strict';var multer=require(_0xf890('0x0'));var util=require(_0xf890('0x1'));var path=require(_0xf890('0x2'));var timeout=require(_0xf890('0x3'));var express=require(_0xf890('0x4'));var router=express[_0xf890('0x5')]();var fs_extra=require(_0xf890('0x6'));var auth=require(_0xf890('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf890('0x8'));var controller=require('./intZendeskField.controller');router[_0xf890('0x9')]('/',auth[_0xf890('0xa')](),controller[_0xf890('0xb')]);router[_0xf890('0x9')](_0xf890('0xc'),auth[_0xf890('0xa')](),controller[_0xf890('0xd')]);router['post']('/',auth[_0xf890('0xa')](),controller[_0xf890('0xe')]);router['put'](_0xf890('0xc'),auth[_0xf890('0xa')](),controller['update']);router[_0xf890('0xf')](_0xf890('0xc'),auth[_0xf890('0xa')](),controller[_0xf890('0x10')]);module[_0xf890('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 6a78c45..01b8428 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 _0x01f9=['picklist','STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x01f9,0x1cc));var _0x901f=function(_0x2d17af,_0x2ded06){_0x2d17af=_0x2d17af-0x0;var _0x4d8e00=_0x01f9[_0x2d17af];return _0x4d8e00;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x901f('0x0')](_0x901f('0x1'),_0x901f('0x2'),'customVariable',_0x901f('0x3'),_0x901f('0x4')),'defaultValue':_0x901f('0x1')},'content':{'type':Sequelize[_0x901f('0x5')]},'key':{'type':Sequelize[_0x901f('0x5')]},'keyType':{'type':Sequelize[_0x901f('0x0')]('string',_0x901f('0x2'),_0x901f('0x6'))},'keyContent':{'type':Sequelize[_0x901f('0x5')]},'idField':{'type':Sequelize[_0x901f('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x901f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x901f('0x5')]}}; \ No newline at end of file +var _0x77d4=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x77d4,0x125));var _0x477d=function(_0x4da3f6,_0x536e60){_0x4da3f6=_0x4da3f6-0x0;var _0x1d63ee=_0x77d4[_0x4da3f6];return _0x1d63ee;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'type':{'type':Sequelize[_0x477d('0x1')](_0x477d('0x2'),_0x477d('0x3'),_0x477d('0x4'),_0x477d('0x5'),_0x477d('0x6')),'defaultValue':_0x477d('0x2')},'content':{'type':Sequelize[_0x477d('0x7')]},'key':{'type':Sequelize[_0x477d('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x477d('0x2'),_0x477d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x477d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x477d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x477d('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 6ae9e02..1a9bb35 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 _0x08d2=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','send','ZendeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','map','type','includeAll','findAll','catch','params','options','find','create','body','eml-format','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash'];(function(_0x32c85c,_0x24cefb){var _0x49cc2d=function(_0x581741){while(--_0x581741){_0x32c85c['push'](_0x32c85c['shift']());}};_0x49cc2d(++_0x24cefb);}(_0x08d2,0x182));var _0x208d=function(_0x7cfc38,_0xde796f){_0x7cfc38=_0x7cfc38-0x0;var _0x33907c=_0x08d2[_0x7cfc38];return _0x33907c;};'use strict';var emlformat=require(_0x208d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x208d('0x1'));var rp=require(_0x208d('0x2'));var moment=require(_0x208d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x208d('0x4'));var util=require(_0x208d('0x5'));var path=require('path');var sox=require(_0x208d('0x6'));var csv=require(_0x208d('0x7'));var ejs=require(_0x208d('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x208d('0x9'));var squel=require(_0x208d('0xa'));var crypto=require(_0x208d('0xb'));var jsforce=require(_0x208d('0xc'));var deskjs=require(_0x208d('0xd'));var toCsv=require(_0x208d('0x7'));var querystring=require(_0x208d('0xe'));var Papa=require(_0x208d('0xf'));var Redis=require('ioredis');var authService=require(_0x208d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x208d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x208d('0x12'));var config=require(_0x208d('0x13'));var licenseUtil=require(_0x208d('0x14'));var db=require(_0x208d('0x15'))['db'];function respondWithStatusCode(_0x1c1d9f,_0x107efe){_0x107efe=_0x107efe||0xcc;return function(_0x6a6204){if(_0x6a6204){return _0x1c1d9f[_0x208d('0x16')](_0x107efe);}return _0x1c1d9f[_0x208d('0x17')](_0x107efe)[_0x208d('0x18')]();};}function respondWithResult(_0x3e3878,_0x3e824f){_0x3e824f=_0x3e824f||0xc8;return function(_0x2c6dbc){if(_0x2c6dbc){return _0x3e3878[_0x208d('0x17')](_0x3e824f)[_0x208d('0x19')](_0x2c6dbc);}};}function respondWithFilteredResult(_0x4f836d,_0x2a578d){return function(_0x3521e5){if(_0x3521e5){var _0x49fb75=typeof _0x2a578d['offset']===_0x208d('0x1a')&&typeof _0x2a578d[_0x208d('0x1b')]==='undefined';var _0x1125bb=_0x3521e5[_0x208d('0x1c')];var _0x48e6f3=_0x49fb75?0x0:_0x2a578d[_0x208d('0x1d')];var _0xc56b9a=_0x49fb75?_0x3521e5['count']:_0x2a578d[_0x208d('0x1d')]+_0x2a578d['limit'];var _0x59646d;if(_0xc56b9a>=_0x1125bb){_0xc56b9a=_0x1125bb;_0x59646d=0xc8;}else{_0x59646d=0xce;}_0x4f836d[_0x208d('0x17')](_0x59646d);return _0x4f836d[_0x208d('0x1e')](_0x208d('0x1f'),_0x48e6f3+'-'+_0xc56b9a+'/'+_0x1125bb)['json'](_0x3521e5);}return null;};}function patchUpdates(_0x59e8b7){return function(_0x45daea){try{jsonpatch[_0x208d('0x20')](_0x45daea,_0x59e8b7,!![]);}catch(_0x5505c3){return BPromise['reject'](_0x5505c3);}return _0x45daea[_0x208d('0x21')]();};}function saveUpdates(_0x1c5a0b,_0x59f566){return function(_0x1832fd){if(_0x1832fd){return _0x1832fd[_0x208d('0x22')](_0x1c5a0b)[_0x208d('0x23')](function(_0x73ee9c){return _0x73ee9c;});}return null;};}function removeEntity(_0x186151,_0x158889){return function(_0x42b881){if(_0x42b881){return _0x42b881['destroy']()[_0x208d('0x23')](function(){_0x186151['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae4a6,_0x4bf1fe){return function(_0x3b9257){if(!_0x3b9257){_0x1ae4a6['sendStatus'](0x194);}return _0x3b9257;};}function handleError(_0x2ab1c6,_0x472704){_0x472704=_0x472704||0x1f4;return function(_0x14e7e5){logger[_0x208d('0x24')](_0x14e7e5[_0x208d('0x25')]);if(_0x14e7e5[_0x208d('0x26')]){delete _0x14e7e5[_0x208d('0x26')];}_0x2ab1c6['status'](_0x472704)[_0x208d('0x27')](_0x14e7e5);};}exports['index']=function(_0x5b3acf,_0x13c75c){var _0x41e091={},_0x3e9063={},_0x1d49cc={'count':0x0,'rows':[]};var _0x5c0c4f=_['map'](db[_0x208d('0x28')][_0x208d('0x29')],function(_0x474895){return{'name':_0x474895[_0x208d('0x2a')],'type':_0x474895['type']['key']};});_0x3e9063[_0x208d('0x2b')]=_['map'](_0x5c0c4f,_0x208d('0x26'));_0x3e9063[_0x208d('0x2c')]=_[_0x208d('0x2d')](_0x5b3acf[_0x208d('0x2c')]);_0x3e9063[_0x208d('0x2e')]=_[_0x208d('0x2f')](_0x3e9063[_0x208d('0x2b')],_0x3e9063['query']);_0x41e091[_0x208d('0x30')]=_['intersection'](_0x3e9063['model'],qs[_0x208d('0x31')](_0x5b3acf[_0x208d('0x2c')][_0x208d('0x31')]));_0x41e091[_0x208d('0x30')]=_0x41e091[_0x208d('0x30')][_0x208d('0x32')]?_0x41e091['attributes']:_0x3e9063[_0x208d('0x2b')];if(!_0x5b3acf[_0x208d('0x2c')][_0x208d('0x33')](_0x208d('0x34'))){_0x41e091['limit']=qs[_0x208d('0x1b')](_0x5b3acf[_0x208d('0x2c')][_0x208d('0x1b')]);_0x41e091[_0x208d('0x1d')]=qs['offset'](_0x5b3acf[_0x208d('0x2c')][_0x208d('0x1d')]);}_0x41e091[_0x208d('0x35')]=qs['sort'](_0x5b3acf[_0x208d('0x2c')]['sort']);_0x41e091[_0x208d('0x36')]=qs[_0x208d('0x2e')](_['pick'](_0x5b3acf[_0x208d('0x2c')],_0x3e9063[_0x208d('0x2e')]),_0x5c0c4f);if(_0x5b3acf[_0x208d('0x2c')]['filter']){_0x41e091['where']=_[_0x208d('0x37')](_0x41e091[_0x208d('0x36')],{'$or':_[_0x208d('0x38')](_0x5c0c4f,function(_0x26991f){if(_0x26991f[_0x208d('0x39')]!=='VIRTUAL'){var _0x57743b={};_0x57743b[_0x26991f[_0x208d('0x26')]]={'$like':'%'+_0x5b3acf[_0x208d('0x2c')]['filter']+'%'};return _0x57743b;}})});}_0x41e091=_[_0x208d('0x37')]({},_0x41e091,_0x5b3acf['options']);var _0x4bb1fd={'where':_0x41e091['where']};return db[_0x208d('0x28')]['count'](_0x4bb1fd)['then'](function(_0x4006e0){_0x1d49cc['count']=_0x4006e0;if(_0x5b3acf[_0x208d('0x2c')][_0x208d('0x3a')]){_0x41e091['include']=[{'all':!![]}];}return db['ZendeskField'][_0x208d('0x3b')](_0x41e091);})['then'](function(_0x2d08a8){_0x1d49cc['rows']=_0x2d08a8;return _0x1d49cc;})[_0x208d('0x23')](respondWithFilteredResult(_0x13c75c,_0x41e091))[_0x208d('0x3c')](handleError(_0x13c75c,null));};exports['show']=function(_0x10e3fc,_0x500148){var _0xb7af3={'raw':!![],'where':{'id':_0x10e3fc[_0x208d('0x3d')]['id']}},_0x52bdd5={};_0x52bdd5[_0x208d('0x2b')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x52bdd5['query']=_[_0x208d('0x2d')](_0x10e3fc[_0x208d('0x2c')]);_0x52bdd5['filters']=_[_0x208d('0x2f')](_0x52bdd5[_0x208d('0x2b')],_0x52bdd5[_0x208d('0x2c')]);_0xb7af3[_0x208d('0x30')]=_[_0x208d('0x2f')](_0x52bdd5['model'],qs[_0x208d('0x31')](_0x10e3fc['query']['fields']));_0xb7af3[_0x208d('0x30')]=_0xb7af3[_0x208d('0x30')]['length']?_0xb7af3[_0x208d('0x30')]:_0x52bdd5[_0x208d('0x2b')];if(_0x10e3fc[_0x208d('0x2c')]['includeAll']){_0xb7af3['include']=[{'all':!![]}];}_0xb7af3=_[_0x208d('0x37')]({},_0xb7af3,_0x10e3fc[_0x208d('0x3e')]);return db[_0x208d('0x28')][_0x208d('0x3f')](_0xb7af3)[_0x208d('0x23')](handleEntityNotFound(_0x500148,null))[_0x208d('0x23')](respondWithResult(_0x500148,null))[_0x208d('0x3c')](handleError(_0x500148,null));};exports[_0x208d('0x40')]=function(_0x3d284f,_0x3fceb4){return db[_0x208d('0x28')]['create'](_0x3d284f[_0x208d('0x41')],{})[_0x208d('0x23')](respondWithResult(_0x3fceb4,0xc9))[_0x208d('0x3c')](handleError(_0x3fceb4,null));};exports[_0x208d('0x22')]=function(_0x4e6402,_0x21afaf){if(_0x4e6402['body']['id']){delete _0x4e6402[_0x208d('0x41')]['id'];}return db[_0x208d('0x28')][_0x208d('0x3f')]({'where':{'id':_0x4e6402[_0x208d('0x3d')]['id']}})[_0x208d('0x23')](handleEntityNotFound(_0x21afaf,null))[_0x208d('0x23')](saveUpdates(_0x4e6402[_0x208d('0x41')],null))[_0x208d('0x23')](respondWithResult(_0x21afaf,null))[_0x208d('0x3c')](handleError(_0x21afaf,null));};exports['destroy']=function(_0xa20efa,_0xc8ad03){return db['ZendeskField'][_0x208d('0x3f')]({'where':{'id':_0xa20efa[_0x208d('0x3d')]['id']}})[_0x208d('0x23')](handleEntityNotFound(_0xc8ad03,null))[_0x208d('0x23')](removeEntity(_0xc8ad03,null))[_0x208d('0x3c')](handleError(_0xc8ad03,null));}; \ No newline at end of file +var _0xd96d=['offset','undefined','limit','count','set','json','reject','save','update','then','destroy','sendStatus','name','index','map','ZendeskField','type','query','keys','intersection','attributes','model','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end'];(function(_0x50a4dd,_0x2ecc28){var _0x3961a3=function(_0x375cc5){while(--_0x375cc5){_0x50a4dd['push'](_0x50a4dd['shift']());}};_0x3961a3(++_0x2ecc28);}(_0xd96d,0x180));var _0xdd96=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xd96d[_0x5bd426];return _0x23a7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd96('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd96('0x1'));var rp=require(_0xdd96('0x2'));var moment=require('moment');var BPromise=require(_0xdd96('0x3'));var Mustache=require('mustache');var util=require(_0xdd96('0x4'));var path=require(_0xdd96('0x5'));var sox=require(_0xdd96('0x6'));var csv=require(_0xdd96('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdd96('0x8'));var _=require(_0xdd96('0x9'));var squel=require('squel');var crypto=require(_0xdd96('0xa'));var jsforce=require(_0xdd96('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xdd96('0x7'));var querystring=require('querystring');var Papa=require(_0xdd96('0xc'));var Redis=require(_0xdd96('0xd'));var authService=require(_0xdd96('0xe'));var qs=require(_0xdd96('0xf'));var as=require(_0xdd96('0x10'));var hardwareService=require(_0xdd96('0x11'));var logger=require(_0xdd96('0x12'))('api');var utils=require(_0xdd96('0x13'));var config=require(_0xdd96('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xdd96('0x15'))['db'];function respondWithStatusCode(_0x3dd4ec,_0x33b4e4){_0x33b4e4=_0x33b4e4||0xcc;return function(_0x306a10){if(_0x306a10){return _0x3dd4ec['sendStatus'](_0x33b4e4);}return _0x3dd4ec[_0xdd96('0x16')](_0x33b4e4)[_0xdd96('0x17')]();};}function respondWithResult(_0x205c28,_0x3674fe){_0x3674fe=_0x3674fe||0xc8;return function(_0x566d87){if(_0x566d87){return _0x205c28['status'](_0x3674fe)['json'](_0x566d87);}};}function respondWithFilteredResult(_0xe79468,_0xd19d36){return function(_0xba578){if(_0xba578){var _0x2eef06=typeof _0xd19d36[_0xdd96('0x18')]===_0xdd96('0x19')&&typeof _0xd19d36[_0xdd96('0x1a')]===_0xdd96('0x19');var _0x2bc1b6=_0xba578[_0xdd96('0x1b')];var _0x15585f=_0x2eef06?0x0:_0xd19d36['offset'];var _0x322815=_0x2eef06?_0xba578[_0xdd96('0x1b')]:_0xd19d36['offset']+_0xd19d36['limit'];var _0x7fa7bf;if(_0x322815>=_0x2bc1b6){_0x322815=_0x2bc1b6;_0x7fa7bf=0xc8;}else{_0x7fa7bf=0xce;}_0xe79468[_0xdd96('0x16')](_0x7fa7bf);return _0xe79468[_0xdd96('0x1c')]('Content-Range',_0x15585f+'-'+_0x322815+'/'+_0x2bc1b6)[_0xdd96('0x1d')](_0xba578);}return null;};}function patchUpdates(_0x18fb5f){return function(_0x465ee5){try{jsonpatch['apply'](_0x465ee5,_0x18fb5f,!![]);}catch(_0x3d1df1){return BPromise[_0xdd96('0x1e')](_0x3d1df1);}return _0x465ee5[_0xdd96('0x1f')]();};}function saveUpdates(_0x39db3c,_0x3843ee){return function(_0x16d08b){if(_0x16d08b){return _0x16d08b[_0xdd96('0x20')](_0x39db3c)[_0xdd96('0x21')](function(_0x3f045f){return _0x3f045f;});}return null;};}function removeEntity(_0x46b1fc,_0x54546c){return function(_0x1daa07){if(_0x1daa07){return _0x1daa07[_0xdd96('0x22')]()[_0xdd96('0x21')](function(){_0x46b1fc['status'](0xcc)[_0xdd96('0x17')]();});}};}function handleEntityNotFound(_0x56bd65,_0x34de31){return function(_0x4ca661){if(!_0x4ca661){_0x56bd65[_0xdd96('0x23')](0x194);}return _0x4ca661;};}function handleError(_0x5747ce,_0x5ddeda){_0x5ddeda=_0x5ddeda||0x1f4;return function(_0x430221){logger['error'](_0x430221['stack']);if(_0x430221[_0xdd96('0x24')]){delete _0x430221['name'];}_0x5747ce[_0xdd96('0x16')](_0x5ddeda)['send'](_0x430221);};}exports[_0xdd96('0x25')]=function(_0x36c8c5,_0x331472){var _0x133954={},_0x3e37bf={},_0x85deb1={'count':0x0,'rows':[]};var _0xab86b4=_[_0xdd96('0x26')](db[_0xdd96('0x27')]['rawAttributes'],function(_0x4c8511){return{'name':_0x4c8511['fieldName'],'type':_0x4c8511[_0xdd96('0x28')]['key']};});_0x3e37bf['model']=_[_0xdd96('0x26')](_0xab86b4,'name');_0x3e37bf[_0xdd96('0x29')]=_[_0xdd96('0x2a')](_0x36c8c5['query']);_0x3e37bf['filters']=_[_0xdd96('0x2b')](_0x3e37bf['model'],_0x3e37bf[_0xdd96('0x29')]);_0x133954[_0xdd96('0x2c')]=_[_0xdd96('0x2b')](_0x3e37bf[_0xdd96('0x2d')],qs['fields'](_0x36c8c5[_0xdd96('0x29')][_0xdd96('0x2e')]));_0x133954['attributes']=_0x133954[_0xdd96('0x2c')][_0xdd96('0x2f')]?_0x133954['attributes']:_0x3e37bf[_0xdd96('0x2d')];if(!_0x36c8c5['query']['hasOwnProperty'](_0xdd96('0x30'))){_0x133954['limit']=qs['limit'](_0x36c8c5[_0xdd96('0x29')][_0xdd96('0x1a')]);_0x133954[_0xdd96('0x18')]=qs[_0xdd96('0x18')](_0x36c8c5[_0xdd96('0x29')][_0xdd96('0x18')]);}_0x133954[_0xdd96('0x31')]=qs[_0xdd96('0x32')](_0x36c8c5['query'][_0xdd96('0x32')]);_0x133954[_0xdd96('0x33')]=qs[_0xdd96('0x34')](_[_0xdd96('0x35')](_0x36c8c5[_0xdd96('0x29')],_0x3e37bf['filters']),_0xab86b4);if(_0x36c8c5[_0xdd96('0x29')][_0xdd96('0x36')]){_0x133954[_0xdd96('0x33')]=_[_0xdd96('0x37')](_0x133954[_0xdd96('0x33')],{'$or':_[_0xdd96('0x26')](_0xab86b4,function(_0x46babd){if(_0x46babd[_0xdd96('0x28')]!=='VIRTUAL'){var _0x45addb={};_0x45addb[_0x46babd[_0xdd96('0x24')]]={'$like':'%'+_0x36c8c5[_0xdd96('0x29')][_0xdd96('0x36')]+'%'};return _0x45addb;}})});}_0x133954=_[_0xdd96('0x37')]({},_0x133954,_0x36c8c5[_0xdd96('0x38')]);var _0x4d6be1={'where':_0x133954[_0xdd96('0x33')]};return db[_0xdd96('0x27')]['count'](_0x4d6be1)['then'](function(_0x38ecf0){_0x85deb1[_0xdd96('0x1b')]=_0x38ecf0;if(_0x36c8c5[_0xdd96('0x29')][_0xdd96('0x39')]){_0x133954[_0xdd96('0x3a')]=[{'all':!![]}];}return db[_0xdd96('0x27')][_0xdd96('0x3b')](_0x133954);})[_0xdd96('0x21')](function(_0x10ecc7){_0x85deb1[_0xdd96('0x3c')]=_0x10ecc7;return _0x85deb1;})['then'](respondWithFilteredResult(_0x331472,_0x133954))['catch'](handleError(_0x331472,null));};exports[_0xdd96('0x3d')]=function(_0x41d8df,_0x44a58f){var _0x29ad61={'raw':!![],'where':{'id':_0x41d8df[_0xdd96('0x3e')]['id']}},_0x301c96={};_0x301c96[_0xdd96('0x2d')]=_['keys'](db[_0xdd96('0x27')][_0xdd96('0x3f')]);_0x301c96[_0xdd96('0x29')]=_[_0xdd96('0x2a')](_0x41d8df['query']);_0x301c96[_0xdd96('0x34')]=_[_0xdd96('0x2b')](_0x301c96['model'],_0x301c96[_0xdd96('0x29')]);_0x29ad61[_0xdd96('0x2c')]=_[_0xdd96('0x2b')](_0x301c96[_0xdd96('0x2d')],qs[_0xdd96('0x2e')](_0x41d8df[_0xdd96('0x29')]['fields']));_0x29ad61[_0xdd96('0x2c')]=_0x29ad61['attributes'][_0xdd96('0x2f')]?_0x29ad61[_0xdd96('0x2c')]:_0x301c96['model'];if(_0x41d8df['query'][_0xdd96('0x39')]){_0x29ad61[_0xdd96('0x3a')]=[{'all':!![]}];}_0x29ad61=_[_0xdd96('0x37')]({},_0x29ad61,_0x41d8df['options']);return db[_0xdd96('0x27')][_0xdd96('0x40')](_0x29ad61)[_0xdd96('0x21')](handleEntityNotFound(_0x44a58f,null))[_0xdd96('0x21')](respondWithResult(_0x44a58f,null))[_0xdd96('0x41')](handleError(_0x44a58f,null));};exports[_0xdd96('0x42')]=function(_0x3db1c6,_0x90abe){return db[_0xdd96('0x27')]['create'](_0x3db1c6[_0xdd96('0x43')],{})[_0xdd96('0x21')](respondWithResult(_0x90abe,0xc9))[_0xdd96('0x41')](handleError(_0x90abe,null));};exports['update']=function(_0x59c687,_0x2445ef){if(_0x59c687['body']['id']){delete _0x59c687[_0xdd96('0x43')]['id'];}return db[_0xdd96('0x27')]['find']({'where':{'id':_0x59c687[_0xdd96('0x3e')]['id']}})[_0xdd96('0x21')](handleEntityNotFound(_0x2445ef,null))['then'](saveUpdates(_0x59c687['body'],null))[_0xdd96('0x21')](respondWithResult(_0x2445ef,null))[_0xdd96('0x41')](handleError(_0x2445ef,null));};exports['destroy']=function(_0x2cea87,_0x5e1ce1){return db[_0xdd96('0x27')]['find']({'where':{'id':_0x2cea87[_0xdd96('0x3e')]['id']}})[_0xdd96('0x21')](handleEntityNotFound(_0x5e1ce1,null))[_0xdd96('0x21')](removeEntity(_0x5e1ce1,null))['catch'](handleError(_0x5e1ce1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index ac0fb40..01a9784 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 _0x6b96=['request-promise','path','rimraf','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4efa28,_0x4e1805){var _0x599196=function(_0x2e80d9){while(--_0x2e80d9){_0x4efa28['push'](_0x4efa28['shift']());}};_0x599196(++_0x4e1805);}(_0x6b96,0x16a));var _0x66b9=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6b96[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x66b9('0x0'));var util=require(_0x66b9('0x1'));var logger=require(_0x66b9('0x2'))(_0x66b9('0x3'));var moment=require(_0x66b9('0x4'));var BPromise=require(_0x66b9('0x5'));var rp=require(_0x66b9('0x6'));var fs=require('fs');var path=require(_0x66b9('0x7'));var rimraf=require(_0x66b9('0x8'));var config=require('../../config/environment');var attributes=require(_0x66b9('0x9'));module[_0x66b9('0xa')]=function(_0x4d904e,_0x38435d){return _0x4d904e[_0x66b9('0xb')](_0x66b9('0xc'),attributes,{'tableName':_0x66b9('0xd'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x66b9('0xe'),_0x66b9('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2a4=['bluebird','request-promise','path','define','zendesk_unique_index','idField','FieldId','lodash','util','api','moment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xb2a4,0x125));var _0x4b2a=function(_0x5e1b3e,_0x5e37e4){_0x5e1b3e=_0x5e1b3e-0x0;var _0x4cdc96=_0xb2a4[_0x5e1b3e];return _0x4cdc96;};'use strict';var _=require(_0x4b2a('0x0'));var util=require(_0x4b2a('0x1'));var logger=require('../../config/logger')(_0x4b2a('0x2'));var moment=require(_0x4b2a('0x3'));var BPromise=require(_0x4b2a('0x4'));var rp=require(_0x4b2a('0x5'));var fs=require('fs');var path=require(_0x4b2a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x3f2882,_0x204a7c){return _0x3f2882[_0x4b2a('0x7')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4b2a('0x8'),'fields':[_0x4b2a('0x9'),_0x4b2a('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 4f0c3d6..bded53d 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 _0xb241=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','info'];(function(_0x2f793b,_0x17cb9d){var _0x2cb054=function(_0x507abc){while(--_0x507abc){_0x2f793b['push'](_0x2f793b['shift']());}};_0x2cb054(++_0x17cb9d);}(_0xb241,0x1b7));var _0x1b24=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb241[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x1b24('0x0'));var util=require('util');var moment=require(_0x1b24('0x1'));var BPromise=require(_0x1b24('0x2'));var rs=require(_0x1b24('0x3'));var fs=require('fs');var Redis=require(_0x1b24('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b24('0x5'));var logger=require('../../config/logger')(_0x1b24('0x6'));var config=require(_0x1b24('0x7'));var jayson=require(_0x1b24('0x8'));var client=jayson[_0x1b24('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5cfea4,_0x59d155,_0x2b0370){return new BPromise(function(_0xff00aa,_0x1c2916){return client[_0x1b24('0xa')](_0x5cfea4,_0x2b0370)[_0x1b24('0xb')](function(_0x3568f0){logger['info']('ZendeskField,\x20%s,\x20%s',_0x59d155,_0x1b24('0xc'));logger[_0x1b24('0xd')](_0x1b24('0xe'),_0x59d155,_0x1b24('0xc'),JSON[_0x1b24('0xf')](_0x3568f0));if(_0x3568f0['error']){if(_0x3568f0[_0x1b24('0x10')][_0x1b24('0x11')]===0x1f4){logger[_0x1b24('0x10')](_0x1b24('0x12'),_0x59d155,_0x3568f0[_0x1b24('0x10')]['message']);return _0x1c2916(_0x3568f0[_0x1b24('0x10')][_0x1b24('0x13')]);}logger[_0x1b24('0x10')](_0x1b24('0x12'),_0x59d155,_0x3568f0[_0x1b24('0x10')][_0x1b24('0x13')]);return _0xff00aa(_0x3568f0[_0x1b24('0x10')][_0x1b24('0x13')]);}else{logger[_0x1b24('0x14')](_0x1b24('0x12'),_0x59d155,_0x1b24('0xc'));_0xff00aa(_0x3568f0[_0x1b24('0x15')]['message']);}})[_0x1b24('0x16')](function(_0x1c343d){logger[_0x1b24('0x10')]('ZendeskField,\x20%s,\x20%s',_0x59d155,_0x1c343d);_0x1c2916(_0x1c343d);});});} \ No newline at end of file +var _0xaac5=['error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x51ccc6,_0x3955f6){var _0xb6774=function(_0x15c035){while(--_0x15c035){_0x51ccc6['push'](_0x51ccc6['shift']());}};_0xb6774(++_0x3955f6);}(_0xaac5,0xe0));var _0x5aac=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xaac5[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x5aac('0x0'));var util=require(_0x5aac('0x1'));var moment=require(_0x5aac('0x2'));var BPromise=require('bluebird');var rs=require(_0x5aac('0x3'));var fs=require('fs');var Redis=require(_0x5aac('0x4'));var db=require(_0x5aac('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5aac('0x6'))(_0x5aac('0x7'));var config=require(_0x5aac('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5aac('0x9')][_0x5aac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x599210,_0x310a93,_0x24007b){return new BPromise(function(_0x3704d0,_0x2057c5){return client[_0x5aac('0xb')](_0x599210,_0x24007b)['then'](function(_0x20b466){logger[_0x5aac('0xc')](_0x5aac('0xd'),_0x310a93,_0x5aac('0xe'));logger[_0x5aac('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x310a93,_0x5aac('0xe'),JSON['stringify'](_0x20b466));if(_0x20b466[_0x5aac('0x10')]){if(_0x20b466[_0x5aac('0x10')][_0x5aac('0x11')]===0x1f4){logger[_0x5aac('0x10')](_0x5aac('0xd'),_0x310a93,_0x20b466[_0x5aac('0x10')]['message']);return _0x2057c5(_0x20b466['error'][_0x5aac('0x12')]);}logger[_0x5aac('0x10')](_0x5aac('0xd'),_0x310a93,_0x20b466['error'][_0x5aac('0x12')]);return _0x3704d0(_0x20b466[_0x5aac('0x10')]['message']);}else{logger[_0x5aac('0xc')](_0x5aac('0xd'),_0x310a93,'request\x20sent');_0x3704d0(_0x20b466['result'][_0x5aac('0x12')]);}})[_0x5aac('0x13')](function(_0x2b101e){logger['error']('ZendeskField,\x20%s,\x20%s',_0x310a93,_0x2b101e);_0x2057c5(_0x2b101e);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 14ba424..26843ec 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 _0xaa79=['post','addConfiguration','put','update','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id/configurations','/:id/fields','getFields','create'];(function(_0x46aae3,_0x11d46c){var _0x4e5ff6=function(_0x465dd9){while(--_0x465dd9){_0x46aae3['push'](_0x46aae3['shift']());}};_0x4e5ff6(++_0x11d46c);}(_0xaa79,0x10b));var _0x9aa7=function(_0x51149a,_0x3e2829){_0x51149a=_0x51149a-0x0;var _0x4af506=_0xaa79[_0x51149a];return _0x4af506;};'use strict';var multer=require(_0x9aa7('0x0'));var util=require(_0x9aa7('0x1'));var path=require(_0x9aa7('0x2'));var timeout=require(_0x9aa7('0x3'));var express=require('express');var router=express[_0x9aa7('0x4')]();var fs_extra=require(_0x9aa7('0x5'));var auth=require(_0x9aa7('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0x9aa7('0x7')]('/',auth[_0x9aa7('0x8')](),controller['index']);router[_0x9aa7('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9aa7('0x7')](_0x9aa7('0x9'),auth[_0x9aa7('0x8')](),controller['getConfigurations']);router[_0x9aa7('0x7')](_0x9aa7('0xa'),auth['isAuthenticated'](),controller[_0x9aa7('0xb')]);router['post']('/',auth[_0x9aa7('0x8')](),controller[_0x9aa7('0xc')]);router[_0x9aa7('0xd')](_0x9aa7('0x9'),auth[_0x9aa7('0x8')](),controller[_0x9aa7('0xe')]);router[_0x9aa7('0xf')]('/:id',auth[_0x9aa7('0x8')](),controller[_0x9aa7('0x10')]);router['delete'](_0x9aa7('0x11'),auth['isAuthenticated'](),controller[_0x9aa7('0x12')]);module[_0x9aa7('0x13')]=router; \ No newline at end of file +var _0x156f=['update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x156f,0x9d));var _0xf156=function(_0x555b3b,_0x3ed706){_0x555b3b=_0x555b3b-0x0;var _0x43bf5d=_0x156f[_0x555b3b];return _0x43bf5d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf156('0x0'));var timeout=require(_0xf156('0x1'));var express=require(_0xf156('0x2'));var router=express[_0xf156('0x3')]();var fs_extra=require(_0xf156('0x4'));var auth=require(_0xf156('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf156('0x6'));var controller=require(_0xf156('0x7'));router[_0xf156('0x8')]('/',auth[_0xf156('0x9')](),controller[_0xf156('0xa')]);router[_0xf156('0x8')](_0xf156('0xb'),auth[_0xf156('0x9')](),controller['show']);router['get'](_0xf156('0xc'),auth[_0xf156('0x9')](),controller[_0xf156('0xd')]);router['get'](_0xf156('0xe'),auth['isAuthenticated'](),controller[_0xf156('0xf')]);router['post']('/',auth[_0xf156('0x9')](),controller[_0xf156('0x10')]);router[_0xf156('0x11')](_0xf156('0xc'),auth[_0xf156('0x9')](),controller[_0xf156('0x12')]);router['put'](_0xf156('0xb'),auth['isAuthenticated'](),controller[_0xf156('0x13')]);router[_0xf156('0x14')](_0xf156('0xb'),auth[_0xf156('0x9')](),controller[_0xf156('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 776ad48..fd520b6 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 _0xe14d=['exports','STRING','sequelize'];(function(_0x5d201b,_0x5f6711){var _0x4431c5=function(_0x4d1b7c){while(--_0x4d1b7c){_0x5d201b['push'](_0x5d201b['shift']());}};_0x4431c5(++_0x5f6711);}(_0xe14d,0x1ee));var _0xde14=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0xe14d[_0x257642];return _0x3d813b;};'use strict';var Sequelize=require(_0xde14('0x0'));module[_0xde14('0x1')]={'name':{'type':Sequelize[_0xde14('0x2')]},'description':{'type':Sequelize[_0xde14('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xde14('0x2')]},'clientId':{'type':Sequelize[_0xde14('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xde14('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xde14('0x2')]},'refreshToken':{'type':Sequelize[_0xde14('0x2')]}}; \ No newline at end of file +var _0x34e8=['sequelize','exports','STRING'];(function(_0x305b12,_0x5ecd09){var _0x4141de=function(_0x3e7044){while(--_0x3e7044){_0x305b12['push'](_0x305b12['shift']());}};_0x4141de(++_0x5ecd09);}(_0x34e8,0x12c));var _0x834e=function(_0xfbf46e,_0x3f602c){_0xfbf46e=_0xfbf46e-0x0;var _0x506942=_0x34e8[_0xfbf46e];return _0x506942;};'use strict';var Sequelize=require(_0x834e('0x0'));module[_0x834e('0x1')]={'name':{'type':Sequelize[_0x834e('0x2')]},'description':{'type':Sequelize[_0x834e('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x834e('0x2')]},'clientId':{'type':Sequelize[_0x834e('0x2')]},'clientSecret':{'type':Sequelize[_0x834e('0x2')]},'serverUrl':{'type':Sequelize[_0x834e('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0x834e('0x2')]},'refreshToken':{'type':Sequelize[_0x834e('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index cc23bd9..b2b91fe 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 _0x8ac0=['Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','undefined','limit','count','status','set','reject','save','update','destroy','then','error','stack','name','send','index','map','ZohoAccount','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include','find','create','body','params','getConfigurations','findOne','Subjects','getSubjects','getDescriptions','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','code','host','zoho.eu','com','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls'];(function(_0x4ddc7e,_0xcb9b8){var _0xfbf0ec=function(_0x32b673){while(--_0x32b673){_0x4ddc7e['push'](_0x4ddc7e['shift']());}};_0xfbf0ec(++_0xcb9b8);}(_0x8ac0,0x9e));var _0x08ac=function(_0x19bed3,_0x4099e1){_0x19bed3=_0x19bed3-0x0;var _0x51f424=_0x8ac0[_0x19bed3];return _0x51f424;};'use strict';var emlformat=require(_0x08ac('0x0'));var rimraf=require(_0x08ac('0x1'));var zipdir=require(_0x08ac('0x2'));var jsonpatch=require(_0x08ac('0x3'));var rp=require('request-promise');var moment=require(_0x08ac('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x08ac('0x5'));var path=require(_0x08ac('0x6'));var sox=require(_0x08ac('0x7'));var csv=require(_0x08ac('0x8'));var ejs=require(_0x08ac('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x08ac('0xa'));var jsforce=require(_0x08ac('0xb'));var deskjs=require(_0x08ac('0xc'));var toCsv=require('to-csv');var querystring=require(_0x08ac('0xd'));var Papa=require(_0x08ac('0xe'));var Redis=require(_0x08ac('0xf'));var authService=require(_0x08ac('0x10'));var qs=require(_0x08ac('0x11'));var as=require(_0x08ac('0x12'));var hardwareService=require(_0x08ac('0x13'));var logger=require(_0x08ac('0x14'))(_0x08ac('0x15'));var utils=require(_0x08ac('0x16'));var config=require(_0x08ac('0x17'));var licenseUtil=require(_0x08ac('0x18'));var db=require(_0x08ac('0x19'))['db'];var integrations=require(_0x08ac('0x1a'));function respondWithStatusCode(_0x2c7180,_0x19f6d0){_0x19f6d0=_0x19f6d0||0xcc;return function(_0x3a27cf){if(_0x3a27cf){return _0x2c7180[_0x08ac('0x1b')](_0x19f6d0);}return _0x2c7180['status'](_0x19f6d0)[_0x08ac('0x1c')]();};}function respondWithResult(_0x44eeb0,_0x4c8aa5){_0x4c8aa5=_0x4c8aa5||0xc8;return function(_0x4ce983){if(_0x4ce983){return _0x44eeb0['status'](_0x4c8aa5)[_0x08ac('0x1d')](_0x4ce983);}};}function respondWithFilteredResult(_0x3b5be6,_0x1653fb){return function(_0x5577a6){if(_0x5577a6){var _0x2bd5de=typeof _0x1653fb[_0x08ac('0x1e')]===_0x08ac('0x1f')&&typeof _0x1653fb[_0x08ac('0x20')]==='undefined';var _0x281155=_0x5577a6['count'];var _0x2086bd=_0x2bd5de?0x0:_0x1653fb['offset'];var _0x49df46=_0x2bd5de?_0x5577a6[_0x08ac('0x21')]:_0x1653fb[_0x08ac('0x1e')]+_0x1653fb[_0x08ac('0x20')];var _0x15ae06;if(_0x49df46>=_0x281155){_0x49df46=_0x281155;_0x15ae06=0xc8;}else{_0x15ae06=0xce;}_0x3b5be6[_0x08ac('0x22')](_0x15ae06);return _0x3b5be6[_0x08ac('0x23')]('Content-Range',_0x2086bd+'-'+_0x49df46+'/'+_0x281155)[_0x08ac('0x1d')](_0x5577a6);}return null;};}function patchUpdates(_0x5189de){return function(_0x36b8f1){try{jsonpatch['apply'](_0x36b8f1,_0x5189de,!![]);}catch(_0x504468){return BPromise[_0x08ac('0x24')](_0x504468);}return _0x36b8f1[_0x08ac('0x25')]();};}function saveUpdates(_0x2f0c30,_0x47d56a){return function(_0x2f1340){if(_0x2f1340){return _0x2f1340[_0x08ac('0x26')](_0x2f0c30)['then'](function(_0x4cd840){return _0x4cd840;});}return null;};}function removeEntity(_0x507ca8,_0x2db3da){return function(_0x55c9d8){if(_0x55c9d8){return _0x55c9d8[_0x08ac('0x27')]()[_0x08ac('0x28')](function(){_0x507ca8[_0x08ac('0x22')](0xcc)[_0x08ac('0x1c')]();});}};}function handleEntityNotFound(_0x2ada1e,_0x4f9b50){return function(_0x1f3f4b){if(!_0x1f3f4b){_0x2ada1e[_0x08ac('0x1b')](0x194);}return _0x1f3f4b;};}function handleError(_0x24a7a6,_0xb1b023){_0xb1b023=_0xb1b023||0x1f4;return function(_0x5568ca){logger[_0x08ac('0x29')](_0x5568ca[_0x08ac('0x2a')]);if(_0x5568ca[_0x08ac('0x2b')]){delete _0x5568ca[_0x08ac('0x2b')];}_0x24a7a6[_0x08ac('0x22')](_0xb1b023)[_0x08ac('0x2c')](_0x5568ca);};}exports[_0x08ac('0x2d')]=function(_0x284de1,_0x35b640){var _0x326207={},_0x1b7536={},_0x3c8f89={'count':0x0,'rows':[]};var _0x32a04a=_[_0x08ac('0x2e')](db[_0x08ac('0x2f')]['rawAttributes'],function(_0x290d89){return{'name':_0x290d89[_0x08ac('0x30')],'type':_0x290d89[_0x08ac('0x31')][_0x08ac('0x32')]};});_0x1b7536[_0x08ac('0x33')]=_[_0x08ac('0x2e')](_0x32a04a,_0x08ac('0x2b'));_0x1b7536['query']=_['keys'](_0x284de1[_0x08ac('0x34')]);_0x1b7536[_0x08ac('0x35')]=_[_0x08ac('0x36')](_0x1b7536['model'],_0x1b7536['query']);_0x326207[_0x08ac('0x37')]=_['intersection'](_0x1b7536['model'],qs['fields'](_0x284de1[_0x08ac('0x34')][_0x08ac('0x38')]));_0x326207['attributes']=_0x326207['attributes'][_0x08ac('0x39')]?_0x326207[_0x08ac('0x37')]:_0x1b7536[_0x08ac('0x33')];if(!_0x284de1[_0x08ac('0x34')][_0x08ac('0x3a')]('nolimit')){_0x326207[_0x08ac('0x20')]=qs[_0x08ac('0x20')](_0x284de1[_0x08ac('0x34')][_0x08ac('0x20')]);_0x326207[_0x08ac('0x1e')]=qs['offset'](_0x284de1[_0x08ac('0x34')][_0x08ac('0x1e')]);}_0x326207[_0x08ac('0x3b')]=qs['sort'](_0x284de1[_0x08ac('0x34')][_0x08ac('0x3c')]);_0x326207[_0x08ac('0x3d')]=qs[_0x08ac('0x35')](_[_0x08ac('0x3e')](_0x284de1[_0x08ac('0x34')],_0x1b7536[_0x08ac('0x35')]),_0x32a04a);if(_0x284de1[_0x08ac('0x34')][_0x08ac('0x3f')]){_0x326207['where']=_[_0x08ac('0x40')](_0x326207[_0x08ac('0x3d')],{'$or':_['map'](_0x32a04a,function(_0x11224b){if(_0x11224b['type']!==_0x08ac('0x41')){var _0x292222={};_0x292222[_0x11224b[_0x08ac('0x2b')]]={'$like':'%'+_0x284de1[_0x08ac('0x34')][_0x08ac('0x3f')]+'%'};return _0x292222;}})});}_0x326207=_['merge']({},_0x326207,_0x284de1[_0x08ac('0x42')]);var _0x10a2e4={'where':_0x326207[_0x08ac('0x3d')]};return db[_0x08ac('0x2f')][_0x08ac('0x21')](_0x10a2e4)[_0x08ac('0x28')](function(_0x324e49){_0x3c8f89[_0x08ac('0x21')]=_0x324e49;if(_0x284de1[_0x08ac('0x34')][_0x08ac('0x43')]){_0x326207['include']=[{'all':!![]}];}return db[_0x08ac('0x2f')][_0x08ac('0x44')](_0x326207);})[_0x08ac('0x28')](function(_0x453c7e){_0x3c8f89[_0x08ac('0x45')]=_0x453c7e;return _0x3c8f89;})[_0x08ac('0x28')](respondWithFilteredResult(_0x35b640,_0x326207))[_0x08ac('0x46')](handleError(_0x35b640,null));};exports[_0x08ac('0x47')]=function(_0x21a3e4,_0x3178a3){var _0x7a1839={'raw':![],'where':{'id':_0x21a3e4['params']['id']}},_0x37d394={};_0x37d394[_0x08ac('0x33')]=_[_0x08ac('0x48')](db[_0x08ac('0x2f')][_0x08ac('0x49')]);_0x37d394[_0x08ac('0x34')]=_[_0x08ac('0x48')](_0x21a3e4[_0x08ac('0x34')]);_0x37d394[_0x08ac('0x35')]=_[_0x08ac('0x36')](_0x37d394[_0x08ac('0x33')],_0x37d394[_0x08ac('0x34')]);_0x7a1839[_0x08ac('0x37')]=_[_0x08ac('0x36')](_0x37d394[_0x08ac('0x33')],qs['fields'](_0x21a3e4[_0x08ac('0x34')][_0x08ac('0x38')]));_0x7a1839[_0x08ac('0x37')]=_0x7a1839['attributes'][_0x08ac('0x39')]?_0x7a1839[_0x08ac('0x37')]:_0x37d394[_0x08ac('0x33')];if(_0x21a3e4[_0x08ac('0x34')][_0x08ac('0x43')]){_0x7a1839[_0x08ac('0x4a')]=[{'all':!![]}];}_0x7a1839=_[_0x08ac('0x40')]({},_0x7a1839,_0x21a3e4['options']);return db['ZohoAccount'][_0x08ac('0x4b')](_0x7a1839)['then'](handleEntityNotFound(_0x3178a3,null))[_0x08ac('0x28')](respondWithResult(_0x3178a3,null))['catch'](handleError(_0x3178a3,null));};exports['create']=function(_0x1f943f,_0x49e519){return db[_0x08ac('0x2f')][_0x08ac('0x4c')](_0x1f943f[_0x08ac('0x4d')],{})[_0x08ac('0x28')](respondWithResult(_0x49e519,0xc9))[_0x08ac('0x46')](handleError(_0x49e519,null));};exports['update']=function(_0x40e6d3,_0x591242){if(_0x40e6d3[_0x08ac('0x4d')]['id']){delete _0x40e6d3['body']['id'];}return db[_0x08ac('0x2f')][_0x08ac('0x4b')]({'where':{'id':_0x40e6d3['params']['id']}})[_0x08ac('0x28')](handleEntityNotFound(_0x591242,null))[_0x08ac('0x28')](saveUpdates(_0x40e6d3[_0x08ac('0x4d')],null))[_0x08ac('0x28')](respondWithResult(_0x591242,null))['catch'](handleError(_0x591242,null));};exports['destroy']=function(_0x50e242,_0x275670){return db[_0x08ac('0x2f')][_0x08ac('0x4b')]({'where':{'id':_0x50e242[_0x08ac('0x4e')]['id']}})[_0x08ac('0x28')](handleEntityNotFound(_0x275670,null))[_0x08ac('0x28')](removeEntity(_0x275670,null))['catch'](handleError(_0x275670,null));};exports[_0x08ac('0x4f')]=function(_0x1466a4,_0xf73cb5,_0x58a0f5){var _0x5a2b59={};var _0x2ffda4={};var _0x3dbdc4;var _0x54f8ca;return db['ZohoAccount'][_0x08ac('0x50')]({'where':{'id':_0x1466a4[_0x08ac('0x4e')]['id']}})[_0x08ac('0x28')](handleEntityNotFound(_0xf73cb5,null))['then'](function(_0x48d90b){if(_0x48d90b){_0x3dbdc4=_0x48d90b;_0x2ffda4[_0x08ac('0x33')]=_[_0x08ac('0x48')](db['ZohoConfiguration'][_0x08ac('0x49')]);_0x2ffda4[_0x08ac('0x34')]=_[_0x08ac('0x48')](_0x1466a4[_0x08ac('0x34')]);_0x2ffda4[_0x08ac('0x35')]=_[_0x08ac('0x36')](_0x2ffda4[_0x08ac('0x33')],_0x2ffda4['query']);_0x5a2b59['attributes']=_[_0x08ac('0x36')](_0x2ffda4[_0x08ac('0x33')],qs[_0x08ac('0x38')](_0x1466a4[_0x08ac('0x34')][_0x08ac('0x38')]));_0x5a2b59[_0x08ac('0x37')]=_0x5a2b59['attributes']['length']?_0x5a2b59[_0x08ac('0x37')]:_0x2ffda4['model'];_0x5a2b59[_0x08ac('0x3b')]=qs[_0x08ac('0x3c')](_0x1466a4[_0x08ac('0x34')][_0x08ac('0x3c')]);_0x5a2b59['where']=qs[_0x08ac('0x35')](_[_0x08ac('0x3e')](_0x1466a4['query'],_0x2ffda4['filters']));if(_0x1466a4['query'][_0x08ac('0x3f')]){_0x5a2b59[_0x08ac('0x3d')]=_[_0x08ac('0x40')](_0x5a2b59['where'],{'$or':_[_0x08ac('0x2e')](_0x5a2b59[_0x08ac('0x37')],function(_0x145ad4){var _0x23db52={};_0x23db52[_0x145ad4]={'$like':'%'+_0x1466a4[_0x08ac('0x34')][_0x08ac('0x3f')]+'%'};return _0x23db52;})});}_0x5a2b59=_[_0x08ac('0x40')]({},_0x5a2b59,_0x1466a4[_0x08ac('0x42')]);return _0x3dbdc4[_0x08ac('0x4f')](_0x5a2b59);}})[_0x08ac('0x28')](function(_0x1505de){if(_0x1505de){_0x54f8ca=_0x1505de[_0x08ac('0x39')];if(!_0x1466a4[_0x08ac('0x34')]['hasOwnProperty']('nolimit')){_0x5a2b59[_0x08ac('0x20')]=qs[_0x08ac('0x20')](_0x1466a4[_0x08ac('0x34')][_0x08ac('0x20')]);_0x5a2b59['offset']=qs[_0x08ac('0x1e')](_0x1466a4[_0x08ac('0x34')][_0x08ac('0x1e')]);}return _0x3dbdc4[_0x08ac('0x4f')](_0x5a2b59);}})[_0x08ac('0x28')](function(_0x57ca6e){if(_0x57ca6e){return _0x57ca6e?{'count':_0x54f8ca,'rows':_0x57ca6e}:null;}})['then'](respondWithResult(_0xf73cb5,null))[_0x08ac('0x46')](handleError(_0xf73cb5,null));};exports['addConfiguration']=function(_0x47ada2,_0x5af53,_0x4d0360){if(_0x47ada2[_0x08ac('0x4d')]['id']){delete _0x47ada2[_0x08ac('0x4d')]['id'];}return db[_0x08ac('0x2f')][_0x08ac('0x50')]({'where':{'id':_0x47ada2[_0x08ac('0x4e')]['id']}})[_0x08ac('0x28')](handleEntityNotFound(_0x5af53,null))[_0x08ac('0x28')](function(_0xd367a6){if(_0xd367a6){_0x47ada2['body']['AccountId']=_0xd367a6['id'];_0x47ada2[_0x08ac('0x4d')][_0x08ac('0x51')]=integrations[_0x08ac('0x52')](_0x47ada2['body']['channel'],_0x47ada2[_0x08ac('0x4d')][_0x08ac('0x31')]);_0x47ada2[_0x08ac('0x4d')]['Descriptions']=integrations[_0x08ac('0x53')](_0x47ada2['body']['channel'],_0x47ada2[_0x08ac('0x4d')]['type']);return db['ZohoConfiguration'][_0x08ac('0x4c')](_0x47ada2[_0x08ac('0x4d')],{'include':[{'model':db[_0x08ac('0x54')],'as':'Subjects'},{'model':db['ZohoField'],'as':_0x08ac('0x55')}]});}return null;})[_0x08ac('0x28')](respondWithResult(_0x5af53,null))[_0x08ac('0x46')](handleError(_0x5af53,null));};function getAccessToken(_0x4d9684){return new Promise(function(_0x22382c,_0x208fc0){var _0x316ab2;switch(_0x4d9684[_0x08ac('0x56')]){case'US':_0x316ab2=_0x08ac('0x57');break;case'AU':_0x316ab2=_0x08ac('0x58');break;case'EU':_0x316ab2=_0x08ac('0x59');break;case'IN':_0x316ab2=_0x08ac('0x5a');break;case'CN':_0x316ab2=_0x08ac('0x5b');break;default:_0x316ab2='https://accounts.zoho.eu';break;}var _0x466759={'method':_0x08ac('0x5c'),'uri':_0x316ab2+_0x08ac('0x5d'),'qs':{'refresh_token':_0x4d9684[_0x08ac('0x5e')],'client_id':_0x4d9684[_0x08ac('0x5f')],'client_secret':_0x4d9684[_0x08ac('0x60')],'grant_type':_0x08ac('0x61')},'json':!![]};return rp(_0x466759)[_0x08ac('0x28')](function(_0x356660){if(_0x356660[_0x08ac('0x62')]){_0x22382c(_0x356660[_0x08ac('0x62')]);}else{_0x208fc0(_0x08ac('0x63'));}})[_0x08ac('0x46')](function(_0x1b3cc3){_0x208fc0(_0x1b3cc3);});});}exports[_0x08ac('0x64')]=function(_0xec2a5,_0x5a719e,_0x5af2af){var _0x7cb17a,_0x5c8475,_0x2efd79,_0x5e0486,_0xb87eb9;return db[_0x08ac('0x2f')][_0x08ac('0x50')]({'where':{'id':_0xec2a5['params']['id']},'attributes':['id','host',_0x08ac('0x56'),_0x08ac('0x5f'),'clientSecret','serverUrl',_0x08ac('0x65'),'refreshToken']})['then'](handleEntityNotFound(_0x5a719e,null))[_0x08ac('0x28')](function(_0x449878){_0xb87eb9=_0x449878;_0x7cb17a=_0xb87eb9[_0x08ac('0x66')];_0x5c8475=_0x7cb17a===_0x08ac('0x67')?'eu':_0x08ac('0x68');_0x2efd79=_0xb87eb9['serverUrl'];var _0x157740=_0x2efd79[_0x08ac('0x69')](-0x1);if(_0x157740==='/'||_0x157740==='\x5c'||_0x157740===':'){_0x2efd79=_0x2efd79['substring'](0x0,_0x2efd79[_0x08ac('0x6a')](_0x157740));}if(!_0xb87eb9[_0x08ac('0x5e')]){throw new Error(_0x08ac('0x6b'));}return getAccessToken(_0xb87eb9);})[_0x08ac('0x28')](function(_0x24a1f8){if(_0x24a1f8){return rp({'method':_0x08ac('0x6c'),'uri':util[_0x08ac('0x6d')](_0x08ac('0x6e'),_0x5c8475),'qs':{'module':_0x08ac('0x6f')},'headers':{'Authorization':_0x08ac('0x70')+_0x24a1f8},'json':!![]});}})[_0x08ac('0x28')](function(_0x1c3ea0){if(_0x1c3ea0){if(_0x1c3ea0[_0x08ac('0x71')]&&_0x1c3ea0[_0x08ac('0x71')][_0x08ac('0x29')]){throw new Error(_0x1c3ea0['response']['error'][_0x08ac('0x72')]);}var _0x36b782=[];var _0xc63007=[];var _0x321f5c=[_0x08ac('0x73'),_0x08ac('0x74'),_0x08ac('0x75'),_0x08ac('0x76'),'Call_Duration',_0x08ac('0x77'),_0x08ac('0x78'),_0x08ac('0x79')];_0xc63007=_[_0x08ac('0x7a')](_0x1c3ea0[_0x08ac('0x38')],function(_0x5add38){return _0x321f5c[_0x08ac('0x7b')](_0x5add38[_0x08ac('0x7c')]);});for(var _0x50deef=0x0;_0x50deef<_0xc63007[_0x08ac('0x39')];_0x50deef++){if(_0xc63007[_0x50deef][_0x08ac('0x7d')]===![]){_0x36b782[_0x08ac('0x7e')]({'id':_0xc63007[_0x50deef]['id'],'name':_0xc63007[_0x50deef]['display_label'],'custom':_0xc63007[_0x50deef][_0x08ac('0x7f')],'options':_0xc63007[_0x50deef][_0x08ac('0x80')]===_0x08ac('0x81')&&_0xc63007[_0x50deef][_0x08ac('0x82')][_0x08ac('0x39')]>-0x1?_['map'](_0xc63007[_0x50deef][_0x08ac('0x82')],function(_0x39feeb){return{'name':_0x39feeb,'value':_0x39feeb};}):[]});}}return{'count':_0x36b782['length'],'rows':_0x36b782};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x5a719e,null))[_0x08ac('0x46')](function(_0x33b1bd){var _0x4b8d2a=_0xec2a5[_0x08ac('0x34')][_0x08ac('0x83')]?0x1f4:_0x33b1bd[_0x08ac('0x84')]||0x1f4;logger[_0x08ac('0x29')](_0x08ac('0x85'),'getFields',_0x4b8d2a,JSON[_0x08ac('0x86')](_0x33b1bd));delete _0x33b1bd[_0x08ac('0x2b')];if(_0x4b8d2a===0x191){_0x4b8d2a=0x190;}_0x5a719e[_0x08ac('0x22')](_0x4b8d2a)['send'](_0xec2a5[_0x08ac('0x34')][_0x08ac('0x83')]?{'message':'Wrong\x20credentials','statusCode':_0x33b1bd[_0x08ac('0x84')]}:_0x33b1bd);});}; \ No newline at end of file +var _0xf361=['map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','intersection','create','body','find','getConfigurations','ZohoConfiguration','order','options','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','code','zoho.eu','com','serverUrl','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','Call_Duration','Call_Type','remove','includes','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','index'];(function(_0x15ab61,_0x2e1df1){var _0x35fd48=function(_0x440e96){while(--_0x440e96){_0x15ab61['push'](_0x15ab61['shift']());}};_0x35fd48(++_0x2e1df1);}(_0xf361,0x1e0));var _0x1f36=function(_0x88d24,_0x19459d){_0x88d24=_0x88d24-0x0;var _0xcdf8ae=_0xf361[_0x88d24];return _0xcdf8ae;};'use strict';var emlformat=require(_0x1f36('0x0'));var rimraf=require(_0x1f36('0x1'));var zipdir=require(_0x1f36('0x2'));var jsonpatch=require(_0x1f36('0x3'));var rp=require('request-promise');var moment=require(_0x1f36('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1f36('0x5'));var util=require(_0x1f36('0x6'));var path=require(_0x1f36('0x7'));var sox=require('sox');var csv=require(_0x1f36('0x8'));var ejs=require(_0x1f36('0x9'));var fs=require('fs');var fs_extra=require(_0x1f36('0xa'));var _=require(_0x1f36('0xb'));var squel=require(_0x1f36('0xc'));var crypto=require(_0x1f36('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1f36('0xe'));var toCsv=require(_0x1f36('0x8'));var querystring=require(_0x1f36('0xf'));var Papa=require(_0x1f36('0x10'));var Redis=require('ioredis');var authService=require(_0x1f36('0x11'));var qs=require(_0x1f36('0x12'));var as=require(_0x1f36('0x13'));var hardwareService=require(_0x1f36('0x14'));var logger=require('../../config/logger')(_0x1f36('0x15'));var utils=require('../../config/utils');var config=require(_0x1f36('0x16'));var licenseUtil=require(_0x1f36('0x17'));var db=require(_0x1f36('0x18'))['db'];var integrations=require(_0x1f36('0x19'));function respondWithStatusCode(_0x32a501,_0xf427d){_0xf427d=_0xf427d||0xcc;return function(_0x40a556){if(_0x40a556){return _0x32a501[_0x1f36('0x1a')](_0xf427d);}return _0x32a501['status'](_0xf427d)[_0x1f36('0x1b')]();};}function respondWithResult(_0x3cb5dc,_0x1996c4){_0x1996c4=_0x1996c4||0xc8;return function(_0x4a0495){if(_0x4a0495){return _0x3cb5dc[_0x1f36('0x1c')](_0x1996c4)[_0x1f36('0x1d')](_0x4a0495);}};}function respondWithFilteredResult(_0x3be9fc,_0x34e6de){return function(_0x4b1392){if(_0x4b1392){var _0x2e0dcc=typeof _0x34e6de['offset']==='undefined'&&typeof _0x34e6de[_0x1f36('0x1e')]===_0x1f36('0x1f');var _0xd59666=_0x4b1392[_0x1f36('0x20')];var _0x47ba35=_0x2e0dcc?0x0:_0x34e6de[_0x1f36('0x21')];var _0x4c6371=_0x2e0dcc?_0x4b1392[_0x1f36('0x20')]:_0x34e6de['offset']+_0x34e6de[_0x1f36('0x1e')];var _0x55e776;if(_0x4c6371>=_0xd59666){_0x4c6371=_0xd59666;_0x55e776=0xc8;}else{_0x55e776=0xce;}_0x3be9fc[_0x1f36('0x1c')](_0x55e776);return _0x3be9fc[_0x1f36('0x22')](_0x1f36('0x23'),_0x47ba35+'-'+_0x4c6371+'/'+_0xd59666)['json'](_0x4b1392);}return null;};}function patchUpdates(_0x179ca6){return function(_0x448782){try{jsonpatch[_0x1f36('0x24')](_0x448782,_0x179ca6,!![]);}catch(_0x19d141){return BPromise[_0x1f36('0x25')](_0x19d141);}return _0x448782['save']();};}function saveUpdates(_0x2c2166,_0x1d5d4d){return function(_0x567128){if(_0x567128){return _0x567128[_0x1f36('0x26')](_0x2c2166)[_0x1f36('0x27')](function(_0x2cd4f7){return _0x2cd4f7;});}return null;};}function removeEntity(_0x1e0b55,_0x2487c8){return function(_0x54dd98){if(_0x54dd98){return _0x54dd98[_0x1f36('0x28')]()[_0x1f36('0x27')](function(){_0x1e0b55[_0x1f36('0x1c')](0xcc)[_0x1f36('0x1b')]();});}};}function handleEntityNotFound(_0x5b2ca1,_0x486ce8){return function(_0x4aabef){if(!_0x4aabef){_0x5b2ca1[_0x1f36('0x1a')](0x194);}return _0x4aabef;};}function handleError(_0x4bf237,_0x444bd3){_0x444bd3=_0x444bd3||0x1f4;return function(_0xeebf78){logger['error'](_0xeebf78[_0x1f36('0x29')]);if(_0xeebf78[_0x1f36('0x2a')]){delete _0xeebf78['name'];}_0x4bf237[_0x1f36('0x1c')](_0x444bd3)['send'](_0xeebf78);};}exports[_0x1f36('0x2b')]=function(_0x2e51e8,_0x463c71){var _0x36bad4={},_0x141e31={},_0x4da7ec={'count':0x0,'rows':[]};var _0x5976ba=_[_0x1f36('0x2c')](db[_0x1f36('0x2d')][_0x1f36('0x2e')],function(_0x2ac547){return{'name':_0x2ac547[_0x1f36('0x2f')],'type':_0x2ac547[_0x1f36('0x30')][_0x1f36('0x31')]};});_0x141e31[_0x1f36('0x32')]=_[_0x1f36('0x2c')](_0x5976ba,'name');_0x141e31[_0x1f36('0x33')]=_['keys'](_0x2e51e8['query']);_0x141e31[_0x1f36('0x34')]=_['intersection'](_0x141e31[_0x1f36('0x32')],_0x141e31['query']);_0x36bad4[_0x1f36('0x35')]=_['intersection'](_0x141e31[_0x1f36('0x32')],qs[_0x1f36('0x36')](_0x2e51e8[_0x1f36('0x33')]['fields']));_0x36bad4[_0x1f36('0x35')]=_0x36bad4['attributes'][_0x1f36('0x37')]?_0x36bad4[_0x1f36('0x35')]:_0x141e31[_0x1f36('0x32')];if(!_0x2e51e8['query'][_0x1f36('0x38')](_0x1f36('0x39'))){_0x36bad4[_0x1f36('0x1e')]=qs[_0x1f36('0x1e')](_0x2e51e8[_0x1f36('0x33')][_0x1f36('0x1e')]);_0x36bad4[_0x1f36('0x21')]=qs[_0x1f36('0x21')](_0x2e51e8['query'][_0x1f36('0x21')]);}_0x36bad4['order']=qs[_0x1f36('0x3a')](_0x2e51e8[_0x1f36('0x33')][_0x1f36('0x3a')]);_0x36bad4[_0x1f36('0x3b')]=qs[_0x1f36('0x34')](_[_0x1f36('0x3c')](_0x2e51e8['query'],_0x141e31[_0x1f36('0x34')]),_0x5976ba);if(_0x2e51e8[_0x1f36('0x33')][_0x1f36('0x3d')]){_0x36bad4[_0x1f36('0x3b')]=_[_0x1f36('0x3e')](_0x36bad4['where'],{'$or':_['map'](_0x5976ba,function(_0x39c349){if(_0x39c349[_0x1f36('0x30')]!==_0x1f36('0x3f')){var _0x5d85df={};_0x5d85df[_0x39c349['name']]={'$like':'%'+_0x2e51e8['query'][_0x1f36('0x3d')]+'%'};return _0x5d85df;}})});}_0x36bad4=_['merge']({},_0x36bad4,_0x2e51e8['options']);var _0x42e4b4={'where':_0x36bad4[_0x1f36('0x3b')]};return db[_0x1f36('0x2d')][_0x1f36('0x20')](_0x42e4b4)[_0x1f36('0x27')](function(_0x4f58a4){_0x4da7ec['count']=_0x4f58a4;if(_0x2e51e8[_0x1f36('0x33')][_0x1f36('0x40')]){_0x36bad4[_0x1f36('0x41')]=[{'all':!![]}];}return db[_0x1f36('0x2d')][_0x1f36('0x42')](_0x36bad4);})[_0x1f36('0x27')](function(_0xe5f13c){_0x4da7ec[_0x1f36('0x43')]=_0xe5f13c;return _0x4da7ec;})[_0x1f36('0x27')](respondWithFilteredResult(_0x463c71,_0x36bad4))[_0x1f36('0x44')](handleError(_0x463c71,null));};exports[_0x1f36('0x45')]=function(_0x428300,_0x2b393a){var _0x5f44d7={'raw':![],'where':{'id':_0x428300[_0x1f36('0x46')]['id']}},_0x389b15={};_0x389b15[_0x1f36('0x32')]=_['keys'](db[_0x1f36('0x2d')][_0x1f36('0x2e')]);_0x389b15[_0x1f36('0x33')]=_[_0x1f36('0x47')](_0x428300[_0x1f36('0x33')]);_0x389b15['filters']=_[_0x1f36('0x48')](_0x389b15[_0x1f36('0x32')],_0x389b15[_0x1f36('0x33')]);_0x5f44d7[_0x1f36('0x35')]=_[_0x1f36('0x48')](_0x389b15[_0x1f36('0x32')],qs[_0x1f36('0x36')](_0x428300[_0x1f36('0x33')][_0x1f36('0x36')]));_0x5f44d7[_0x1f36('0x35')]=_0x5f44d7[_0x1f36('0x35')]['length']?_0x5f44d7[_0x1f36('0x35')]:_0x389b15[_0x1f36('0x32')];if(_0x428300['query'][_0x1f36('0x40')]){_0x5f44d7[_0x1f36('0x41')]=[{'all':!![]}];}_0x5f44d7=_[_0x1f36('0x3e')]({},_0x5f44d7,_0x428300['options']);return db[_0x1f36('0x2d')]['find'](_0x5f44d7)['then'](handleEntityNotFound(_0x2b393a,null))[_0x1f36('0x27')](respondWithResult(_0x2b393a,null))[_0x1f36('0x44')](handleError(_0x2b393a,null));};exports[_0x1f36('0x49')]=function(_0x363a0d,_0x3dc0c9){return db[_0x1f36('0x2d')][_0x1f36('0x49')](_0x363a0d[_0x1f36('0x4a')],{})[_0x1f36('0x27')](respondWithResult(_0x3dc0c9,0xc9))[_0x1f36('0x44')](handleError(_0x3dc0c9,null));};exports[_0x1f36('0x26')]=function(_0x183f76,_0x6f3bd2){if(_0x183f76[_0x1f36('0x4a')]['id']){delete _0x183f76[_0x1f36('0x4a')]['id'];}return db['ZohoAccount'][_0x1f36('0x4b')]({'where':{'id':_0x183f76['params']['id']}})[_0x1f36('0x27')](handleEntityNotFound(_0x6f3bd2,null))[_0x1f36('0x27')](saveUpdates(_0x183f76[_0x1f36('0x4a')],null))[_0x1f36('0x27')](respondWithResult(_0x6f3bd2,null))[_0x1f36('0x44')](handleError(_0x6f3bd2,null));};exports[_0x1f36('0x28')]=function(_0x4f4103,_0x4df831){return db['ZohoAccount'][_0x1f36('0x4b')]({'where':{'id':_0x4f4103['params']['id']}})['then'](handleEntityNotFound(_0x4df831,null))[_0x1f36('0x27')](removeEntity(_0x4df831,null))[_0x1f36('0x44')](handleError(_0x4df831,null));};exports[_0x1f36('0x4c')]=function(_0x41bd00,_0x4749ef,_0x1549bd){var _0x3daced={};var _0x58069c={};var _0x5aa6a4;var _0x5dffa4;return db['ZohoAccount']['findOne']({'where':{'id':_0x41bd00['params']['id']}})['then'](handleEntityNotFound(_0x4749ef,null))[_0x1f36('0x27')](function(_0x3b18b0){if(_0x3b18b0){_0x5aa6a4=_0x3b18b0;_0x58069c[_0x1f36('0x32')]=_['keys'](db[_0x1f36('0x4d')]['rawAttributes']);_0x58069c['query']=_[_0x1f36('0x47')](_0x41bd00[_0x1f36('0x33')]);_0x58069c['filters']=_[_0x1f36('0x48')](_0x58069c['model'],_0x58069c[_0x1f36('0x33')]);_0x3daced[_0x1f36('0x35')]=_['intersection'](_0x58069c['model'],qs[_0x1f36('0x36')](_0x41bd00[_0x1f36('0x33')]['fields']));_0x3daced[_0x1f36('0x35')]=_0x3daced[_0x1f36('0x35')]['length']?_0x3daced['attributes']:_0x58069c['model'];_0x3daced[_0x1f36('0x4e')]=qs[_0x1f36('0x3a')](_0x41bd00['query']['sort']);_0x3daced[_0x1f36('0x3b')]=qs[_0x1f36('0x34')](_[_0x1f36('0x3c')](_0x41bd00[_0x1f36('0x33')],_0x58069c[_0x1f36('0x34')]));if(_0x41bd00[_0x1f36('0x33')][_0x1f36('0x3d')]){_0x3daced[_0x1f36('0x3b')]=_[_0x1f36('0x3e')](_0x3daced[_0x1f36('0x3b')],{'$or':_[_0x1f36('0x2c')](_0x3daced['attributes'],function(_0x4041c2){var _0xd0eb14={};_0xd0eb14[_0x4041c2]={'$like':'%'+_0x41bd00[_0x1f36('0x33')][_0x1f36('0x3d')]+'%'};return _0xd0eb14;})});}_0x3daced=_[_0x1f36('0x3e')]({},_0x3daced,_0x41bd00[_0x1f36('0x4f')]);return _0x5aa6a4['getConfigurations'](_0x3daced);}})['then'](function(_0x12a482){if(_0x12a482){_0x5dffa4=_0x12a482[_0x1f36('0x37')];if(!_0x41bd00[_0x1f36('0x33')][_0x1f36('0x38')](_0x1f36('0x39'))){_0x3daced[_0x1f36('0x1e')]=qs[_0x1f36('0x1e')](_0x41bd00['query'][_0x1f36('0x1e')]);_0x3daced['offset']=qs[_0x1f36('0x21')](_0x41bd00[_0x1f36('0x33')]['offset']);}return _0x5aa6a4[_0x1f36('0x4c')](_0x3daced);}})[_0x1f36('0x27')](function(_0x22ad1d){if(_0x22ad1d){return _0x22ad1d?{'count':_0x5dffa4,'rows':_0x22ad1d}:null;}})['then'](respondWithResult(_0x4749ef,null))['catch'](handleError(_0x4749ef,null));};exports[_0x1f36('0x50')]=function(_0x3b6f59,_0x9c5339,_0x17d420){if(_0x3b6f59[_0x1f36('0x4a')]['id']){delete _0x3b6f59[_0x1f36('0x4a')]['id'];}return db[_0x1f36('0x2d')][_0x1f36('0x51')]({'where':{'id':_0x3b6f59[_0x1f36('0x46')]['id']}})['then'](handleEntityNotFound(_0x9c5339,null))['then'](function(_0x496d06){if(_0x496d06){_0x3b6f59[_0x1f36('0x4a')][_0x1f36('0x52')]=_0x496d06['id'];_0x3b6f59[_0x1f36('0x4a')][_0x1f36('0x53')]=integrations[_0x1f36('0x54')](_0x3b6f59[_0x1f36('0x4a')][_0x1f36('0x55')],_0x3b6f59['body'][_0x1f36('0x30')]);_0x3b6f59[_0x1f36('0x4a')][_0x1f36('0x56')]=integrations[_0x1f36('0x57')](_0x3b6f59[_0x1f36('0x4a')][_0x1f36('0x55')],_0x3b6f59[_0x1f36('0x4a')]['type']);return db['ZohoConfiguration']['create'](_0x3b6f59[_0x1f36('0x4a')],{'include':[{'model':db[_0x1f36('0x58')],'as':_0x1f36('0x53')},{'model':db[_0x1f36('0x58')],'as':'Descriptions'}]});}return null;})[_0x1f36('0x27')](respondWithResult(_0x9c5339,null))[_0x1f36('0x44')](handleError(_0x9c5339,null));};function getAccessToken(_0x4db8a9){return new Promise(function(_0x14b0ce,_0x514e9c){var _0x5b2b22;switch(_0x4db8a9[_0x1f36('0x59')]){case'US':_0x5b2b22=_0x1f36('0x5a');break;case'AU':_0x5b2b22=_0x1f36('0x5b');break;case'EU':_0x5b2b22=_0x1f36('0x5c');break;case'IN':_0x5b2b22=_0x1f36('0x5d');break;case'CN':_0x5b2b22='https://accounts.zoho.com.cn';break;default:_0x5b2b22=_0x1f36('0x5c');break;}var _0x13403b={'method':'POST','uri':_0x5b2b22+'/oauth/v2/token','qs':{'refresh_token':_0x4db8a9[_0x1f36('0x5e')],'client_id':_0x4db8a9['clientId'],'client_secret':_0x4db8a9[_0x1f36('0x5f')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x13403b)[_0x1f36('0x27')](function(_0xae0f6b){if(_0xae0f6b[_0x1f36('0x60')]){_0x14b0ce(_0xae0f6b[_0x1f36('0x60')]);}else{_0x514e9c(_0x1f36('0x61'));}})[_0x1f36('0x44')](function(_0x263149){_0x514e9c(_0x263149);});});}exports[_0x1f36('0x62')]=function(_0x3dc0be,_0xcf0194,_0x1acb00){var _0x16d073,_0x5411ec,_0x2c6d03,_0x4760a9,_0x5a28b3;return db[_0x1f36('0x2d')][_0x1f36('0x51')]({'where':{'id':_0x3dc0be[_0x1f36('0x46')]['id']},'attributes':['id',_0x1f36('0x63'),'zone',_0x1f36('0x64'),_0x1f36('0x5f'),'serverUrl',_0x1f36('0x65'),_0x1f36('0x5e')]})[_0x1f36('0x27')](handleEntityNotFound(_0xcf0194,null))[_0x1f36('0x27')](function(_0x4059fa){_0x5a28b3=_0x4059fa;_0x16d073=_0x5a28b3[_0x1f36('0x63')];_0x5411ec=_0x16d073===_0x1f36('0x66')?'eu':_0x1f36('0x67');_0x2c6d03=_0x5a28b3[_0x1f36('0x68')];var _0x3604ef=_0x2c6d03['slice'](-0x1);if(_0x3604ef==='/'||_0x3604ef==='\x5c'||_0x3604ef===':'){_0x2c6d03=_0x2c6d03[_0x1f36('0x69')](0x0,_0x2c6d03['lastIndexOf'](_0x3604ef));}if(!_0x5a28b3[_0x1f36('0x5e')]){throw new Error(_0x1f36('0x6a'));}return getAccessToken(_0x5a28b3);})[_0x1f36('0x27')](function(_0x595926){if(_0x595926){return rp({'method':_0x1f36('0x6b'),'uri':util[_0x1f36('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5411ec),'qs':{'module':_0x1f36('0x6d')},'headers':{'Authorization':_0x1f36('0x6e')+_0x595926},'json':!![]});}})[_0x1f36('0x27')](function(_0xf72731){if(_0xf72731){if(_0xf72731[_0x1f36('0x6f')]&&_0xf72731[_0x1f36('0x6f')][_0x1f36('0x70')]){throw new Error(_0xf72731[_0x1f36('0x6f')][_0x1f36('0x70')][_0x1f36('0x71')]);}var _0xde5a41=[];var _0x285a1d=[];var _0x17a5f6=[_0x1f36('0x72'),_0x1f36('0x73'),_0x1f36('0x74'),'WhoId',_0x1f36('0x75'),'Call_Result','Call_Start_Time',_0x1f36('0x76')];_0x285a1d=_[_0x1f36('0x77')](_0xf72731[_0x1f36('0x36')],function(_0x18c247){return _0x17a5f6[_0x1f36('0x78')](_0x18c247['api_name']);});for(var _0x596cf6=0x0;_0x596cf6<_0x285a1d['length'];_0x596cf6++){if(_0x285a1d[_0x596cf6]['system_mandatory']===![]){_0xde5a41[_0x1f36('0x79')]({'id':_0x285a1d[_0x596cf6]['id'],'name':_0x285a1d[_0x596cf6][_0x1f36('0x7a')],'custom':_0x285a1d[_0x596cf6][_0x1f36('0x7b')],'options':_0x285a1d[_0x596cf6][_0x1f36('0x7c')]===_0x1f36('0x7d')&&_0x285a1d[_0x596cf6][_0x1f36('0x7e')]['length']>-0x1?_['map'](_0x285a1d[_0x596cf6][_0x1f36('0x7e')],function(_0x28c766){return{'name':_0x28c766,'value':_0x28c766};}):[]});}}return{'count':_0xde5a41[_0x1f36('0x37')],'rows':_0xde5a41};}else{return{'count':0x0,'rows':[]};}})[_0x1f36('0x27')](respondWithResult(_0xcf0194,null))[_0x1f36('0x44')](function(_0x103e3b){var _0x4eeae6=_0x3dc0be[_0x1f36('0x33')]['test']?0x1f4:_0x103e3b[_0x1f36('0x7f')]||0x1f4;logger[_0x1f36('0x70')](_0x1f36('0x80'),_0x1f36('0x62'),_0x4eeae6,JSON['stringify'](_0x103e3b));delete _0x103e3b[_0x1f36('0x2a')];if(_0x4eeae6===0x191){_0x4eeae6=0x190;}_0xcf0194[_0x1f36('0x1c')](_0x4eeae6)[_0x1f36('0x81')](_0x3dc0be['query']['test']?{'message':_0x1f36('0x82'),'statusCode':_0x103e3b[_0x1f36('0x7f')]}:_0x103e3b);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 62ab410..59792aa 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 _0xa59a=['application/x-www-form-urlencoded','then','refresh_token','refreshToken','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZohoAccount.attributes','define','ZohoAccount','changed','serverUrl','clientId','host','slice','substring','zone','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','code'];(function(_0x24d72c,_0x24fe61){var _0x39c9d6=function(_0x265058){while(--_0x265058){_0x24d72c['push'](_0x24d72c['shift']());}};_0x39c9d6(++_0x24fe61);}(_0xa59a,0x1a9));var _0xaa59=function(_0x55430d,_0x27a795){_0x55430d=_0x55430d-0x0;var _0x5ad12e=_0xa59a[_0x55430d];return _0x5ad12e;};'use strict';var _=require(_0xaa59('0x0'));var util=require(_0xaa59('0x1'));var logger=require(_0xaa59('0x2'))(_0xaa59('0x3'));var moment=require(_0xaa59('0x4'));var BPromise=require(_0xaa59('0x5'));var rp=require(_0xaa59('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaa59('0x7'));var config=require(_0xaa59('0x8'));var attributes=require(_0xaa59('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0xb51b83,_0x455d9a){return _0xb51b83[_0xaa59('0xa')](_0xaa59('0xb'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21e9c2,_0x2d7c2b,_0xb81e24){if(_0x21e9c2[_0xaa59('0xc')]('zone')||_0x21e9c2['changed'](_0xaa59('0xd'))||_0x21e9c2[_0xaa59('0xc')](_0xaa59('0xe'))||_0x21e9c2[_0xaa59('0xc')]('clientSecret')||_0x21e9c2[_0xaa59('0xc')]('code')||_0x21e9c2[_0xaa59('0xc')](_0xaa59('0xf'))){var _0x35c21b,_0x14a6d2;_0x35c21b=_0x21e9c2[_0xaa59('0xd')];var _0x388e23=_0x35c21b[_0xaa59('0x10')](-0x1);if(_0x388e23==='/'||_0x388e23==='\x5c'||_0x388e23===':'){_0x35c21b=_0x35c21b[_0xaa59('0x11')](0x0,_0x35c21b['lastIndexOf'](_0x388e23));}switch(_0x21e9c2[_0xaa59('0x12')]){case'US':_0x14a6d2='https://accounts.zoho.com';break;case'AU':_0x14a6d2='https://accounts.zoho.com.au';break;case'IN':_0x14a6d2=_0xaa59('0x13');break;case'CN':_0x14a6d2='https://accounts.zoho.com.cn';break;default:_0x14a6d2=_0xaa59('0x14');break;}var _0x1f0843={'method':_0xaa59('0x15'),'uri':_0x14a6d2+_0xaa59('0x16'),'form':{'grant_type':_0xaa59('0x17'),'client_id':_0x21e9c2['clientId'],'client_secret':_0x21e9c2[_0xaa59('0x18')],'redirect_uri':_0x21e9c2[_0xaa59('0xd')],'code':_0x21e9c2[_0xaa59('0x19')]},'headers':{'Content-Type':_0xaa59('0x1a')}};return rp(_0x1f0843)[_0xaa59('0x1b')](function(_0x5f4708){var _0x1b7951=JSON['parse'](_0x5f4708);if(_0x1b7951[_0xaa59('0x1c')]){_0x21e9c2[_0xaa59('0x1d')]=_0x1b7951[_0xaa59('0x1c')];logger['info'](util[_0xaa59('0x1e')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x21e9c2[_0xaa59('0x1f')],_0x21e9c2['id']));}else{logger[_0xaa59('0x20')](util[_0xaa59('0x1e')](_0xaa59('0x21'),_0x21e9c2['name'],_0x21e9c2['id']),util[_0xaa59('0x22')](_0x1b7951,{'showHidden':![],'depth':null}));}return _0xb81e24(null,_0x2d7c2b);})[_0xaa59('0x23')](function(_0x24e069){logger['error'](util[_0xaa59('0x1e')](_0xaa59('0x21'),_0x21e9c2[_0xaa59('0x1f')],_0x21e9c2['id']),util[_0xaa59('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0xb81e24(_0x24e069);});}else{return _0xb81e24(null,_0x2d7c2b);}},'beforeUpdate':function(_0x5633e1,_0x172728,_0x32fb29){if(_0x5633e1[_0xaa59('0xc')]('zone')||_0x5633e1[_0xaa59('0xc')]('serverUrl')||_0x5633e1[_0xaa59('0xc')](_0xaa59('0xe'))||_0x5633e1[_0xaa59('0xc')](_0xaa59('0x18'))||_0x5633e1[_0xaa59('0xc')]('code')||_0x5633e1[_0xaa59('0xc')]('host')){var _0x45183d,_0x3d139c;_0x45183d=_0x5633e1[_0xaa59('0xd')];var _0x32e7e0=_0x45183d[_0xaa59('0x10')](-0x1);if(_0x32e7e0==='/'||_0x32e7e0==='\x5c'||_0x32e7e0===':'){_0x45183d=_0x45183d['substring'](0x0,_0x45183d[_0xaa59('0x24')](_0x32e7e0));}switch(_0x5633e1[_0xaa59('0x12')]){case'US':_0x3d139c='https://accounts.zoho.com';break;case'AU':_0x3d139c=_0xaa59('0x25');break;case'IN':_0x3d139c=_0xaa59('0x13');break;case'CN':_0x3d139c=_0xaa59('0x26');break;default:_0x3d139c=_0xaa59('0x14');break;}var _0x4d99c4={'method':'POST','uri':_0x3d139c+'/oauth/v2/token','form':{'grant_type':_0xaa59('0x17'),'client_id':_0x5633e1[_0xaa59('0xe')],'client_secret':_0x5633e1[_0xaa59('0x18')],'redirect_uri':_0x5633e1[_0xaa59('0xd')],'code':_0x5633e1['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4d99c4)[_0xaa59('0x1b')](function(_0x1e6325){var _0x38d3cb=JSON[_0xaa59('0x27')](_0x1e6325);if(_0x38d3cb['refresh_token']){_0x5633e1['refreshToken']=_0x38d3cb[_0xaa59('0x1c')];logger['info'](util[_0xaa59('0x1e')](_0xaa59('0x28'),_0x5633e1[_0xaa59('0x1f')],_0x5633e1['id']));}else{logger[_0xaa59('0x20')](util[_0xaa59('0x1e')](_0xaa59('0x21'),_0x5633e1[_0xaa59('0x1f')],_0x5633e1['id']),util['inspect'](_0x38d3cb,{'showHidden':![],'depth':null}));}return _0x32fb29(null,_0x172728);})[_0xaa59('0x23')](function(_0x36ec44){logger['error'](util[_0xaa59('0x1e')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5633e1[_0xaa59('0x1f')],_0x5633e1['id']),util[_0xaa59('0x22')](parsedResult,{'showHidden':![],'depth':null}));return _0x32fb29(_0x36ec44);});}else{return _0x32fb29(null,_0x172728);}}}});}; \ No newline at end of file +var _0x9169=['then','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','clientSecret','host','serverUrl','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','code','application/x-www-form-urlencoded','refresh_token','refreshToken','info','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','authorization_code'];(function(_0x11e503,_0x437b7f){var _0x85d313=function(_0x25be0f){while(--_0x25be0f){_0x11e503['push'](_0x11e503['shift']());}};_0x85d313(++_0x437b7f);}(_0x9169,0xd3));var _0x9916=function(_0x274925,_0x2e0b2d){_0x274925=_0x274925-0x0;var _0x121109=_0x9169[_0x274925];return _0x121109;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9916('0x0'))(_0x9916('0x1'));var moment=require(_0x9916('0x2'));var BPromise=require(_0x9916('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9916('0x4'));var rimraf=require('rimraf');var config=require(_0x9916('0x5'));var attributes=require(_0x9916('0x6'));var integrations=require(_0x9916('0x7'));module[_0x9916('0x8')]=function(_0x2ec8b8,_0x45b0b0){return _0x2ec8b8[_0x9916('0x9')](_0x9916('0xa'),attributes,{'tableName':_0x9916('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1a07dc,_0x6f1214,_0x21bdd6){if(_0x1a07dc[_0x9916('0xc')]('zone')||_0x1a07dc[_0x9916('0xc')]('serverUrl')||_0x1a07dc[_0x9916('0xc')]('clientId')||_0x1a07dc[_0x9916('0xc')](_0x9916('0xd'))||_0x1a07dc[_0x9916('0xc')]('code')||_0x1a07dc['changed'](_0x9916('0xe'))){var _0x2c62ed,_0x5c5a9d;_0x2c62ed=_0x1a07dc[_0x9916('0xf')];var _0x42396a=_0x2c62ed[_0x9916('0x10')](-0x1);if(_0x42396a==='/'||_0x42396a==='\x5c'||_0x42396a===':'){_0x2c62ed=_0x2c62ed[_0x9916('0x11')](0x0,_0x2c62ed['lastIndexOf'](_0x42396a));}switch(_0x1a07dc[_0x9916('0x12')]){case'US':_0x5c5a9d=_0x9916('0x13');break;case'AU':_0x5c5a9d='https://accounts.zoho.com.au';break;case'IN':_0x5c5a9d=_0x9916('0x14');break;case'CN':_0x5c5a9d='https://accounts.zoho.com.cn';break;default:_0x5c5a9d=_0x9916('0x15');break;}var _0x5ca1df={'method':_0x9916('0x16'),'uri':_0x5c5a9d+_0x9916('0x17'),'form':{'grant_type':'authorization_code','client_id':_0x1a07dc[_0x9916('0x18')],'client_secret':_0x1a07dc[_0x9916('0xd')],'redirect_uri':_0x1a07dc[_0x9916('0xf')],'code':_0x1a07dc[_0x9916('0x19')]},'headers':{'Content-Type':_0x9916('0x1a')}};return rp(_0x5ca1df)['then'](function(_0x2c500c){var _0x6d8fe1=JSON['parse'](_0x2c500c);if(_0x6d8fe1[_0x9916('0x1b')]){_0x1a07dc[_0x9916('0x1c')]=_0x6d8fe1['refresh_token'];logger[_0x9916('0x1d')](util['format'](_0x9916('0x1e'),_0x1a07dc[_0x9916('0x1f')],_0x1a07dc['id']));}else{logger[_0x9916('0x20')](util[_0x9916('0x21')](_0x9916('0x22'),_0x1a07dc[_0x9916('0x1f')],_0x1a07dc['id']),util[_0x9916('0x23')](_0x6d8fe1,{'showHidden':![],'depth':null}));}return _0x21bdd6(null,_0x6f1214);})[_0x9916('0x24')](function(_0x9ce99f){logger[_0x9916('0x20')](util['format'](_0x9916('0x22'),_0x1a07dc['name'],_0x1a07dc['id']),util[_0x9916('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x21bdd6(_0x9ce99f);});}else{return _0x21bdd6(null,_0x6f1214);}},'beforeUpdate':function(_0x4542c3,_0x48e099,_0x5b9652){if(_0x4542c3[_0x9916('0xc')](_0x9916('0x12'))||_0x4542c3['changed'](_0x9916('0xf'))||_0x4542c3[_0x9916('0xc')](_0x9916('0x18'))||_0x4542c3[_0x9916('0xc')](_0x9916('0xd'))||_0x4542c3[_0x9916('0xc')](_0x9916('0x19'))||_0x4542c3['changed'](_0x9916('0xe'))){var _0x248dfb,_0xecbb05;_0x248dfb=_0x4542c3[_0x9916('0xf')];var _0x12d4af=_0x248dfb[_0x9916('0x10')](-0x1);if(_0x12d4af==='/'||_0x12d4af==='\x5c'||_0x12d4af===':'){_0x248dfb=_0x248dfb[_0x9916('0x11')](0x0,_0x248dfb[_0x9916('0x25')](_0x12d4af));}switch(_0x4542c3['zone']){case'US':_0xecbb05=_0x9916('0x13');break;case'AU':_0xecbb05=_0x9916('0x26');break;case'IN':_0xecbb05=_0x9916('0x14');break;case'CN':_0xecbb05=_0x9916('0x27');break;default:_0xecbb05=_0x9916('0x15');break;}var _0x32d735={'method':_0x9916('0x16'),'uri':_0xecbb05+_0x9916('0x17'),'form':{'grant_type':_0x9916('0x28'),'client_id':_0x4542c3[_0x9916('0x18')],'client_secret':_0x4542c3[_0x9916('0xd')],'redirect_uri':_0x4542c3[_0x9916('0xf')],'code':_0x4542c3[_0x9916('0x19')]},'headers':{'Content-Type':_0x9916('0x1a')}};return rp(_0x32d735)[_0x9916('0x29')](function(_0x1ea849){var _0x12a580=JSON['parse'](_0x1ea849);if(_0x12a580[_0x9916('0x1b')]){_0x4542c3[_0x9916('0x1c')]=_0x12a580[_0x9916('0x1b')];logger[_0x9916('0x1d')](util[_0x9916('0x21')](_0x9916('0x1e'),_0x4542c3[_0x9916('0x1f')],_0x4542c3['id']));}else{logger['error'](util[_0x9916('0x21')](_0x9916('0x22'),_0x4542c3[_0x9916('0x1f')],_0x4542c3['id']),util['inspect'](_0x12a580,{'showHidden':![],'depth':null}));}return _0x5b9652(null,_0x48e099);})[_0x9916('0x24')](function(_0xc4c57e){logger[_0x9916('0x20')](util[_0x9916('0x21')](_0x9916('0x22'),_0x4542c3['name'],_0x4542c3['id']),util[_0x9916('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b9652(_0xc4c57e);});}else{return _0x5b9652(null,_0x48e099);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 9227bfd..94f7ba0 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 _0x7292=['where','attributes','include','map','model','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ZohoAccount,\x20%s,\x20%s','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw'];(function(_0x1da017,_0x440f48){var _0x2e989c=function(_0x913545){while(--_0x913545){_0x1da017['push'](_0x1da017['shift']());}};_0x2e989c(++_0x440f48);}(_0x7292,0x6d));var _0x2729=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7292[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x2729('0x0'));var util=require(_0x2729('0x1'));var moment=require(_0x2729('0x2'));var BPromise=require(_0x2729('0x3'));var rs=require(_0x2729('0x4'));var fs=require('fs');var Redis=require(_0x2729('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2729('0x6'));var logger=require(_0x2729('0x7'))(_0x2729('0x8'));var config=require(_0x2729('0x9'));var jayson=require(_0x2729('0xa'));var client=jayson['client'][_0x2729('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3e9245,_0x32c498,_0x15612c){return new BPromise(function(_0x3b4f90,_0x33d118){return client['request'](_0x3e9245,_0x15612c)[_0x2729('0xc')](function(_0x5b3014){logger[_0x2729('0xd')]('ZohoAccount,\x20%s,\x20%s',_0x32c498,'request\x20sent');logger[_0x2729('0xe')](_0x2729('0xf'),_0x32c498,_0x2729('0x10'),JSON[_0x2729('0x11')](_0x5b3014));if(_0x5b3014[_0x2729('0x12')]){if(_0x5b3014[_0x2729('0x12')]['code']===0x1f4){logger['error'](_0x2729('0x13'),_0x32c498,_0x5b3014[_0x2729('0x12')][_0x2729('0x14')]);return _0x33d118(_0x5b3014['error']['message']);}logger[_0x2729('0x12')](_0x2729('0x13'),_0x32c498,_0x5b3014[_0x2729('0x12')]['message']);return _0x3b4f90(_0x5b3014[_0x2729('0x12')][_0x2729('0x14')]);}else{logger[_0x2729('0xd')](_0x2729('0x13'),_0x32c498,_0x2729('0x10'));_0x3b4f90(_0x5b3014['result'][_0x2729('0x14')]);}})[_0x2729('0x15')](function(_0x1a2333){logger[_0x2729('0x12')](_0x2729('0x13'),_0x32c498,_0x1a2333);_0x33d118(_0x1a2333);});});}exports[_0x2729('0x16')]=function(_0x2b5bad){var _0x418b89=this;return new Promise(function(_0x807abf,_0xe4dc1d){return db[_0x2729('0x17')][_0x2729('0x18')]({'raw':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1a')]===undefined?!![]:![]:!![],'where':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1b')]||null:null,'attributes':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1c')]||null:null,'limit':_0x2b5bad[_0x2729('0x19')]?_0x2b5bad[_0x2729('0x19')]['limit']||null:null,'include':_0x2b5bad['options']?_0x2b5bad[_0x2729('0x19')][_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x2b5bad[_0x2729('0x19')]['include'],function(_0x16d69f){return{'model':db[_0x16d69f['model']],'as':_0x16d69f['as'],'attributes':_0x16d69f[_0x2729('0x1c')],'include':_0x16d69f[_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x16d69f['include'],function(_0x320de3){return{'model':db[_0x320de3['model']],'as':_0x320de3['as'],'attributes':_0x320de3[_0x2729('0x1c')],'include':_0x320de3['include']?_[_0x2729('0x1e')](_0x320de3[_0x2729('0x1d')],function(_0x56e64d){return{'model':db[_0x56e64d[_0x2729('0x1f')]],'as':_0x56e64d['as'],'attributes':_0x56e64d[_0x2729('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5b40bd){logger[_0x2729('0xd')](_0x2729('0x16'),_0x2b5bad);logger[_0x2729('0xe')](_0x2729('0x16'),_0x2b5bad,JSON['stringify'](_0x5b40bd));_0x807abf(_0x5b40bd);})[_0x2729('0x15')](function(_0x23d7ed){logger[_0x2729('0x12')](_0x2729('0x16'),_0x23d7ed[_0x2729('0x14')],_0x2b5bad);_0xe4dc1d(_0x418b89[_0x2729('0x12')](0x1f4,_0x23d7ed[_0x2729('0x14')]));});});};exports[_0x2729('0x20')]=function(_0x16c700){var _0x38cbab=this;return new Promise(function(_0x5e122f,_0x4dd9e2){return db[_0x2729('0x17')][_0x2729('0x21')]({'raw':_0x16c700[_0x2729('0x19')]?_0x16c700['options']['raw']===undefined?!![]:![]:!![],'where':_0x16c700['options']?_0x16c700[_0x2729('0x19')][_0x2729('0x1b')]||null:null,'attributes':_0x16c700[_0x2729('0x19')]?_0x16c700['options'][_0x2729('0x1c')]||null:null,'include':_0x16c700[_0x2729('0x19')]?_0x16c700[_0x2729('0x19')][_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x16c700['options'][_0x2729('0x1d')],function(_0x4aa819){return{'model':db[_0x4aa819[_0x2729('0x1f')]],'as':_0x4aa819['as'],'attributes':_0x4aa819[_0x2729('0x1c')],'include':_0x4aa819['include']?_['map'](_0x4aa819[_0x2729('0x1d')],function(_0x508efc){return{'model':db[_0x508efc['model']],'as':_0x508efc['as'],'attributes':_0x508efc['attributes'],'include':_0x508efc[_0x2729('0x1d')]?_[_0x2729('0x1e')](_0x508efc[_0x2729('0x1d')],function(_0x22fdbb){return{'model':db[_0x22fdbb[_0x2729('0x1f')]],'as':_0x22fdbb['as'],'attributes':_0x22fdbb[_0x2729('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2729('0xc')](function(_0x1fc20d){logger['info']('ShowZohoAccount',_0x16c700);logger[_0x2729('0xe')](_0x2729('0x20'),_0x16c700,JSON['stringify'](_0x1fc20d));_0x5e122f(_0x1fc20d);})['catch'](function(_0x41fa5c){logger[_0x2729('0x12')](_0x2729('0x20'),_0x41fa5c[_0x2729('0x14')],_0x16c700);_0x4dd9e2(_0x38cbab[_0x2729('0x12')](0x1f4,_0x41fa5c[_0x2729('0x14')]));});});}; \ No newline at end of file +var _0xa817=['stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','include','map','model','info','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5e1248,_0x42b862){var _0x1b4201=function(_0x534a23){while(--_0x534a23){_0x5e1248['push'](_0x5e1248['shift']());}};_0x1b4201(++_0x42b862);}(_0xa817,0x7b));var _0x7a81=function(_0x2f3824,_0x12ca3a){_0x2f3824=_0x2f3824-0x0;var _0x1de74f=_0xa817[_0x2f3824];return _0x1de74f;};'use strict';var _=require(_0x7a81('0x0'));var util=require(_0x7a81('0x1'));var moment=require(_0x7a81('0x2'));var BPromise=require(_0x7a81('0x3'));var rs=require(_0x7a81('0x4'));var fs=require('fs');var Redis=require(_0x7a81('0x5'));var db=require(_0x7a81('0x6'))['db'];var utils=require(_0x7a81('0x7'));var logger=require(_0x7a81('0x8'))('rpc');var config=require(_0x7a81('0x9'));var jayson=require(_0x7a81('0xa'));var client=jayson['client'][_0x7a81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35c35a,_0x3ab25c,_0x705d4e){return new BPromise(function(_0x1869fb,_0x18f6f6){return client['request'](_0x35c35a,_0x705d4e)[_0x7a81('0xc')](function(_0x5b3b66){logger['info'](_0x7a81('0xd'),_0x3ab25c,'request\x20sent');logger[_0x7a81('0xe')](_0x7a81('0xf'),_0x3ab25c,_0x7a81('0x10'),JSON[_0x7a81('0x11')](_0x5b3b66));if(_0x5b3b66[_0x7a81('0x12')]){if(_0x5b3b66[_0x7a81('0x12')][_0x7a81('0x13')]===0x1f4){logger['error'](_0x7a81('0xd'),_0x3ab25c,_0x5b3b66[_0x7a81('0x12')][_0x7a81('0x14')]);return _0x18f6f6(_0x5b3b66['error'][_0x7a81('0x14')]);}logger[_0x7a81('0x12')](_0x7a81('0xd'),_0x3ab25c,_0x5b3b66[_0x7a81('0x12')][_0x7a81('0x14')]);return _0x1869fb(_0x5b3b66[_0x7a81('0x12')]['message']);}else{logger['info'](_0x7a81('0xd'),_0x3ab25c,_0x7a81('0x10'));_0x1869fb(_0x5b3b66['result'][_0x7a81('0x14')]);}})[_0x7a81('0x15')](function(_0x179afd){logger[_0x7a81('0x12')](_0x7a81('0xd'),_0x3ab25c,_0x179afd);_0x18f6f6(_0x179afd);});});}exports[_0x7a81('0x16')]=function(_0x114cfa){var _0x3d9a4f=this;return new Promise(function(_0x2b5720,_0x220da9){return db[_0x7a81('0x17')][_0x7a81('0x18')]({'raw':_0x114cfa[_0x7a81('0x19')]?_0x114cfa['options'][_0x7a81('0x1a')]===undefined?!![]:![]:!![],'where':_0x114cfa[_0x7a81('0x19')]?_0x114cfa[_0x7a81('0x19')][_0x7a81('0x1b')]||null:null,'attributes':_0x114cfa[_0x7a81('0x19')]?_0x114cfa[_0x7a81('0x19')][_0x7a81('0x1c')]||null:null,'limit':_0x114cfa[_0x7a81('0x19')]?_0x114cfa[_0x7a81('0x19')]['limit']||null:null,'include':_0x114cfa[_0x7a81('0x19')]?_0x114cfa[_0x7a81('0x19')][_0x7a81('0x1d')]?_[_0x7a81('0x1e')](_0x114cfa[_0x7a81('0x19')][_0x7a81('0x1d')],function(_0x249ae1){return{'model':db[_0x249ae1[_0x7a81('0x1f')]],'as':_0x249ae1['as'],'attributes':_0x249ae1['attributes'],'include':_0x249ae1[_0x7a81('0x1d')]?_['map'](_0x249ae1['include'],function(_0x1e2476){return{'model':db[_0x1e2476[_0x7a81('0x1f')]],'as':_0x1e2476['as'],'attributes':_0x1e2476[_0x7a81('0x1c')],'include':_0x1e2476['include']?_[_0x7a81('0x1e')](_0x1e2476[_0x7a81('0x1d')],function(_0x87e708){return{'model':db[_0x87e708[_0x7a81('0x1f')]],'as':_0x87e708['as'],'attributes':_0x87e708[_0x7a81('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38de7c){logger[_0x7a81('0x20')](_0x7a81('0x16'),_0x114cfa);logger[_0x7a81('0xe')](_0x7a81('0x16'),_0x114cfa,JSON[_0x7a81('0x11')](_0x38de7c));_0x2b5720(_0x38de7c);})[_0x7a81('0x15')](function(_0x551c14){logger[_0x7a81('0x12')]('GetZohoAccount',_0x551c14[_0x7a81('0x14')],_0x114cfa);_0x220da9(_0x3d9a4f[_0x7a81('0x12')](0x1f4,_0x551c14[_0x7a81('0x14')]));});});};exports['ShowZohoAccount']=function(_0x3f7e20){var _0x4fc73a=this;return new Promise(function(_0x5e9589,_0x1441bf){return db[_0x7a81('0x17')][_0x7a81('0x21')]({'raw':_0x3f7e20[_0x7a81('0x19')]?_0x3f7e20[_0x7a81('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3f7e20[_0x7a81('0x19')]?_0x3f7e20[_0x7a81('0x19')][_0x7a81('0x1b')]||null:null,'attributes':_0x3f7e20[_0x7a81('0x19')]?_0x3f7e20[_0x7a81('0x19')][_0x7a81('0x1c')]||null:null,'include':_0x3f7e20[_0x7a81('0x19')]?_0x3f7e20['options'][_0x7a81('0x1d')]?_[_0x7a81('0x1e')](_0x3f7e20[_0x7a81('0x19')]['include'],function(_0x3161fe){return{'model':db[_0x3161fe[_0x7a81('0x1f')]],'as':_0x3161fe['as'],'attributes':_0x3161fe[_0x7a81('0x1c')],'include':_0x3161fe[_0x7a81('0x1d')]?_['map'](_0x3161fe[_0x7a81('0x1d')],function(_0x262a0f){return{'model':db[_0x262a0f[_0x7a81('0x1f')]],'as':_0x262a0f['as'],'attributes':_0x262a0f[_0x7a81('0x1c')],'include':_0x262a0f[_0x7a81('0x1d')]?_['map'](_0x262a0f[_0x7a81('0x1d')],function(_0x200b03){return{'model':db[_0x200b03[_0x7a81('0x1f')]],'as':_0x200b03['as'],'attributes':_0x200b03[_0x7a81('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7a81('0xc')](function(_0x41a124){logger[_0x7a81('0x20')]('ShowZohoAccount',_0x3f7e20);logger['debug'](_0x7a81('0x22'),_0x3f7e20,JSON[_0x7a81('0x11')](_0x41a124));_0x5e9589(_0x41a124);})['catch'](function(_0x11c809){logger[_0x7a81('0x12')](_0x7a81('0x22'),_0x11c809['message'],_0x3f7e20);_0x1441bf(_0x4fc73a[_0x7a81('0x12')](0x1f4,_0x11c809[_0x7a81('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index d53640a..e943cf2 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 _0xd37f=['/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0xc95e52,_0x3c4532){var _0x1d747f=function(_0x427918){while(--_0x427918){_0xc95e52['push'](_0xc95e52['shift']());}};_0x1d747f(++_0x3c4532);}(_0xd37f,0x67));var _0xfd37=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xd37f[_0x433a86];return _0x23000c;};'use strict';var multer=require(_0xfd37('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xfd37('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfd37('0x2'));var auth=require(_0xfd37('0x3'));var interaction=require(_0xfd37('0x4'));var config=require(_0xfd37('0x5'));var controller=require(_0xfd37('0x6'));router[_0xfd37('0x7')]('/',auth[_0xfd37('0x8')](),controller[_0xfd37('0x9')]);router[_0xfd37('0x7')](_0xfd37('0xa'),auth[_0xfd37('0x8')](),controller[_0xfd37('0xb')]);router[_0xfd37('0x7')](_0xfd37('0xc'),auth['isAuthenticated'](),controller[_0xfd37('0xd')]);router[_0xfd37('0x7')](_0xfd37('0xe'),auth[_0xfd37('0x8')](),controller[_0xfd37('0xf')]);router[_0xfd37('0x7')]('/:id/descriptions',auth[_0xfd37('0x8')](),controller[_0xfd37('0x10')]);router[_0xfd37('0x11')]('/',auth[_0xfd37('0x8')](),controller['create']);router[_0xfd37('0x12')](_0xfd37('0xa'),auth[_0xfd37('0x8')](),controller[_0xfd37('0x13')]);router[_0xfd37('0x14')](_0xfd37('0xa'),auth[_0xfd37('0x8')](),controller[_0xfd37('0x15')]);module[_0xfd37('0x16')]=router; \ No newline at end of file +var _0x4135=['put','update','destroy','multer','express','Router','../../components/auth/service','../../components/interaction/service','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create'];(function(_0xf7bf02,_0x13da13){var _0x4f263f=function(_0x3b5603){while(--_0x3b5603){_0xf7bf02['push'](_0xf7bf02['shift']());}};_0x4f263f(++_0x13da13);}(_0x4135,0x1cb));var _0x5413=function(_0x1f3e17,_0x463ee8){_0x1f3e17=_0x1f3e17-0x0;var _0x55ba4b=_0x4135[_0x1f3e17];return _0x55ba4b;};'use strict';var multer=require(_0x5413('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5413('0x1'));var router=express[_0x5413('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x5413('0x3'));var interaction=require(_0x5413('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5413('0x5')](_0x5413('0x6'),auth['isAuthenticated'](),controller[_0x5413('0x7')]);router[_0x5413('0x5')](_0x5413('0x8'),auth[_0x5413('0x9')](),controller['getFields']);router[_0x5413('0x5')](_0x5413('0xa'),auth[_0x5413('0x9')](),controller[_0x5413('0xb')]);router[_0x5413('0x5')](_0x5413('0xc'),auth[_0x5413('0x9')](),controller[_0x5413('0xd')]);router[_0x5413('0xe')]('/',auth['isAuthenticated'](),controller[_0x5413('0xf')]);router[_0x5413('0x10')](_0x5413('0x6'),auth[_0x5413('0x9')](),controller[_0x5413('0x11')]);router['delete']('/:id',auth[_0x5413('0x9')](),controller[_0x5413('0x12')]);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 0f4c835..5483ef6 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 _0x2138=['STRING','lead','contact','nothing','ENUM','contact_lead','sequelize','exports'];(function(_0x4a68a4,_0x1e587a){var _0xf2940e=function(_0x3021dc){while(--_0x3021dc){_0x4a68a4['push'](_0x4a68a4['shift']());}};_0xf2940e(++_0x1e587a);}(_0x2138,0x1ce));var _0x8213=function(_0x3d018f,_0x245821){_0x3d018f=_0x3d018f-0x0;var _0x859012=_0x2138[_0x3d018f];return _0x859012;};'use strict';var Sequelize=require(_0x8213('0x0'));module[_0x8213('0x1')]={'name':{'type':Sequelize[_0x8213('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x8213('0x3'),_0x8213('0x4'),_0x8213('0x5')),'defaultValue':_0x8213('0x3')},'moduleSearch':{'type':Sequelize[_0x8213('0x6')](_0x8213('0x7'),'contact','lead'),'defaultValue':_0x8213('0x7')},'description':{'type':Sequelize[_0x8213('0x2')]}}; \ No newline at end of file +var _0x00d8=['ENUM','contact_lead','sequelize','exports','lead','contact','nothing'];(function(_0x1a1d8d,_0x1b7384){var _0x403d3a=function(_0x573a55){while(--_0x573a55){_0x1a1d8d['push'](_0x1a1d8d['shift']());}};_0x403d3a(++_0x1b7384);}(_0x00d8,0xe2));var _0x800d=function(_0x40ad05,_0x18c3ae){_0x40ad05=_0x40ad05-0x0;var _0x5cc00f=_0x00d8[_0x40ad05];return _0x5cc00f;};'use strict';var Sequelize=require(_0x800d('0x0'));module[_0x800d('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize['ENUM'](_0x800d('0x2'),_0x800d('0x3'),_0x800d('0x4')),'defaultValue':_0x800d('0x2')},'moduleSearch':{'type':Sequelize[_0x800d('0x5')](_0x800d('0x6'),'contact','lead'),'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 1cc3cc6..5a8fbaf 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 _0x94a4=['json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','ZohoConfiguration','rawAttributes','fieldName','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','intersection','find','create','body','update','findOne','getFields','getSubjects','ZohoField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x4efb98,_0x4175a4){var _0x225966=function(_0xa50adb){while(--_0xa50adb){_0x4efb98['push'](_0x4efb98['shift']());}};_0x225966(++_0x4175a4);}(_0x94a4,0x83));var _0x494a=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x94a4[_0x2b9b7f];return _0x4ed19a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x494a('0x0'));var zipdir=require(_0x494a('0x1'));var jsonpatch=require(_0x494a('0x2'));var rp=require(_0x494a('0x3'));var moment=require(_0x494a('0x4'));var BPromise=require(_0x494a('0x5'));var Mustache=require('mustache');var util=require(_0x494a('0x6'));var path=require(_0x494a('0x7'));var sox=require(_0x494a('0x8'));var csv=require(_0x494a('0x9'));var ejs=require(_0x494a('0xa'));var fs=require('fs');var fs_extra=require(_0x494a('0xb'));var _=require(_0x494a('0xc'));var squel=require(_0x494a('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x494a('0xe'));var toCsv=require(_0x494a('0x9'));var querystring=require(_0x494a('0xf'));var Papa=require(_0x494a('0x10'));var Redis=require(_0x494a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x494a('0x12'));var hardwareService=require(_0x494a('0x13'));var logger=require(_0x494a('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x494a('0x15'));var licenseUtil=require(_0x494a('0x16'));var db=require(_0x494a('0x17'))['db'];function respondWithStatusCode(_0x15756d,_0x3a7950){_0x3a7950=_0x3a7950||0xcc;return function(_0x1ac138){if(_0x1ac138){return _0x15756d[_0x494a('0x18')](_0x3a7950);}return _0x15756d[_0x494a('0x19')](_0x3a7950)[_0x494a('0x1a')]();};}function respondWithResult(_0x32e204,_0xe5e310){_0xe5e310=_0xe5e310||0xc8;return function(_0x597dcf){if(_0x597dcf){return _0x32e204[_0x494a('0x19')](_0xe5e310)[_0x494a('0x1b')](_0x597dcf);}};}function respondWithFilteredResult(_0x4af607,_0x387e5f){return function(_0x27679c){if(_0x27679c){var _0x5f4053=typeof _0x387e5f[_0x494a('0x1c')]===_0x494a('0x1d')&&typeof _0x387e5f['limit']===_0x494a('0x1d');var _0x5029ac=_0x27679c[_0x494a('0x1e')];var _0x5d54f7=_0x5f4053?0x0:_0x387e5f[_0x494a('0x1c')];var _0x334020=_0x5f4053?_0x27679c[_0x494a('0x1e')]:_0x387e5f['offset']+_0x387e5f[_0x494a('0x1f')];var _0xe1f0f7;if(_0x334020>=_0x5029ac){_0x334020=_0x5029ac;_0xe1f0f7=0xc8;}else{_0xe1f0f7=0xce;}_0x4af607[_0x494a('0x19')](_0xe1f0f7);return _0x4af607[_0x494a('0x20')](_0x494a('0x21'),_0x5d54f7+'-'+_0x334020+'/'+_0x5029ac)['json'](_0x27679c);}return null;};}function patchUpdates(_0x277ba0){return function(_0x19184b){try{jsonpatch[_0x494a('0x22')](_0x19184b,_0x277ba0,!![]);}catch(_0x5519fd){return BPromise[_0x494a('0x23')](_0x5519fd);}return _0x19184b[_0x494a('0x24')]();};}function saveUpdates(_0x406b54,_0x389b9f){return function(_0x403b3b){if(_0x403b3b){return _0x403b3b['update'](_0x406b54)[_0x494a('0x25')](function(_0x216f4c){return _0x216f4c;});}return null;};}function removeEntity(_0x1d3f5a,_0x14ef71){return function(_0x225b8b){if(_0x225b8b){return _0x225b8b[_0x494a('0x26')]()[_0x494a('0x25')](function(){_0x1d3f5a['status'](0xcc)[_0x494a('0x1a')]();});}};}function handleEntityNotFound(_0x11c4f1,_0x3311fd){return function(_0x2b20d3){if(!_0x2b20d3){_0x11c4f1[_0x494a('0x18')](0x194);}return _0x2b20d3;};}function handleError(_0x8fef6e,_0x321ea0){_0x321ea0=_0x321ea0||0x1f4;return function(_0x2d3ead){logger[_0x494a('0x27')](_0x2d3ead[_0x494a('0x28')]);if(_0x2d3ead[_0x494a('0x29')]){delete _0x2d3ead[_0x494a('0x29')];}_0x8fef6e[_0x494a('0x19')](_0x321ea0)[_0x494a('0x2a')](_0x2d3ead);};}exports['index']=function(_0xc5ea5f,_0x3e2bea){var _0x4fefb9={},_0x11b4fb={},_0x572d1b={'count':0x0,'rows':[]};var _0x2da527=_['map'](db[_0x494a('0x2b')][_0x494a('0x2c')],function(_0x6c2879){return{'name':_0x6c2879[_0x494a('0x2d')],'type':_0x6c2879['type']['key']};});_0x11b4fb[_0x494a('0x2e')]=_[_0x494a('0x2f')](_0x2da527,_0x494a('0x29'));_0x11b4fb[_0x494a('0x30')]=_[_0x494a('0x31')](_0xc5ea5f['query']);_0x11b4fb['filters']=_['intersection'](_0x11b4fb[_0x494a('0x2e')],_0x11b4fb['query']);_0x4fefb9['attributes']=_['intersection'](_0x11b4fb[_0x494a('0x2e')],qs[_0x494a('0x32')](_0xc5ea5f[_0x494a('0x30')][_0x494a('0x32')]));_0x4fefb9[_0x494a('0x33')]=_0x4fefb9[_0x494a('0x33')][_0x494a('0x34')]?_0x4fefb9[_0x494a('0x33')]:_0x11b4fb['model'];if(!_0xc5ea5f[_0x494a('0x30')][_0x494a('0x35')](_0x494a('0x36'))){_0x4fefb9[_0x494a('0x1f')]=qs[_0x494a('0x1f')](_0xc5ea5f['query']['limit']);_0x4fefb9[_0x494a('0x1c')]=qs['offset'](_0xc5ea5f[_0x494a('0x30')]['offset']);}_0x4fefb9[_0x494a('0x37')]=qs[_0x494a('0x38')](_0xc5ea5f[_0x494a('0x30')][_0x494a('0x38')]);_0x4fefb9[_0x494a('0x39')]=qs[_0x494a('0x3a')](_[_0x494a('0x3b')](_0xc5ea5f[_0x494a('0x30')],_0x11b4fb[_0x494a('0x3a')]),_0x2da527);if(_0xc5ea5f[_0x494a('0x30')][_0x494a('0x3c')]){_0x4fefb9['where']=_[_0x494a('0x3d')](_0x4fefb9[_0x494a('0x39')],{'$or':_['map'](_0x2da527,function(_0x3c894c){if(_0x3c894c['type']!==_0x494a('0x3e')){var _0x19c04b={};_0x19c04b[_0x3c894c[_0x494a('0x29')]]={'$like':'%'+_0xc5ea5f[_0x494a('0x30')][_0x494a('0x3c')]+'%'};return _0x19c04b;}})});}_0x4fefb9=_[_0x494a('0x3d')]({},_0x4fefb9,_0xc5ea5f[_0x494a('0x3f')]);var _0x137ce2={'where':_0x4fefb9[_0x494a('0x39')]};return db[_0x494a('0x2b')]['count'](_0x137ce2)[_0x494a('0x25')](function(_0x24be3f){_0x572d1b[_0x494a('0x1e')]=_0x24be3f;if(_0xc5ea5f[_0x494a('0x30')][_0x494a('0x40')]){_0x4fefb9[_0x494a('0x41')]=[{'all':!![]}];}return db[_0x494a('0x2b')]['findAll'](_0x4fefb9);})[_0x494a('0x25')](function(_0x33eb6f){_0x572d1b[_0x494a('0x42')]=_0x33eb6f;return _0x572d1b;})[_0x494a('0x25')](respondWithFilteredResult(_0x3e2bea,_0x4fefb9))[_0x494a('0x43')](handleError(_0x3e2bea,null));};exports['show']=function(_0x61054e,_0x352fbf){var _0xf183c0={'raw':![],'where':{'id':_0x61054e[_0x494a('0x44')]['id']}},_0x18ccf8={};_0x18ccf8['model']=_[_0x494a('0x31')](db['ZohoConfiguration']['rawAttributes']);_0x18ccf8[_0x494a('0x30')]=_['keys'](_0x61054e['query']);_0x18ccf8[_0x494a('0x3a')]=_[_0x494a('0x45')](_0x18ccf8[_0x494a('0x2e')],_0x18ccf8['query']);_0xf183c0[_0x494a('0x33')]=_[_0x494a('0x45')](_0x18ccf8[_0x494a('0x2e')],qs['fields'](_0x61054e['query']['fields']));_0xf183c0[_0x494a('0x33')]=_0xf183c0[_0x494a('0x33')][_0x494a('0x34')]?_0xf183c0[_0x494a('0x33')]:_0x18ccf8[_0x494a('0x2e')];if(_0x61054e[_0x494a('0x30')][_0x494a('0x40')]){_0xf183c0[_0x494a('0x41')]=[{'all':!![]}];}_0xf183c0=_[_0x494a('0x3d')]({},_0xf183c0,_0x61054e[_0x494a('0x3f')]);return db[_0x494a('0x2b')][_0x494a('0x46')](_0xf183c0)[_0x494a('0x25')](handleEntityNotFound(_0x352fbf,null))[_0x494a('0x25')](respondWithResult(_0x352fbf,null))['catch'](handleError(_0x352fbf,null));};exports[_0x494a('0x47')]=function(_0x57dd27,_0x55d910){return db[_0x494a('0x2b')][_0x494a('0x47')](_0x57dd27[_0x494a('0x48')],{})[_0x494a('0x25')](respondWithResult(_0x55d910,0xc9))[_0x494a('0x43')](handleError(_0x55d910,null));};exports[_0x494a('0x49')]=function(_0x5fffe1,_0x15c36b){if(_0x5fffe1['body']['id']){delete _0x5fffe1[_0x494a('0x48')]['id'];}return db[_0x494a('0x2b')][_0x494a('0x46')]({'where':{'id':_0x5fffe1[_0x494a('0x44')]['id']}})[_0x494a('0x25')](handleEntityNotFound(_0x15c36b,null))[_0x494a('0x25')](saveUpdates(_0x5fffe1['body'],null))['then'](respondWithResult(_0x15c36b,null))[_0x494a('0x43')](handleError(_0x15c36b,null));};exports[_0x494a('0x26')]=function(_0x4a5dd2,_0x55c2fc){return db[_0x494a('0x2b')][_0x494a('0x46')]({'where':{'id':_0x4a5dd2[_0x494a('0x44')]['id']}})['then'](handleEntityNotFound(_0x55c2fc,null))[_0x494a('0x25')](removeEntity(_0x55c2fc,null))[_0x494a('0x43')](handleError(_0x55c2fc,null));};exports['getFields']=function(_0x3501cd,_0x5e0e4a,_0x479ee8){var _0x32ac76={};var _0x2db087={};var _0x3fd16b;var _0x3c26a0;return db['ZohoConfiguration'][_0x494a('0x4a')]({'where':{'id':_0x3501cd[_0x494a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e0e4a,null))[_0x494a('0x25')](function(_0x160dda){if(_0x160dda){_0x3fd16b=_0x160dda;_0x2db087[_0x494a('0x2e')]=_[_0x494a('0x31')](db['ZohoField'][_0x494a('0x2c')]);_0x2db087[_0x494a('0x30')]=_[_0x494a('0x31')](_0x3501cd['query']);_0x2db087[_0x494a('0x3a')]=_[_0x494a('0x45')](_0x2db087[_0x494a('0x2e')],_0x2db087['query']);_0x32ac76[_0x494a('0x33')]=_[_0x494a('0x45')](_0x2db087[_0x494a('0x2e')],qs[_0x494a('0x32')](_0x3501cd['query']['fields']));_0x32ac76[_0x494a('0x33')]=_0x32ac76[_0x494a('0x33')][_0x494a('0x34')]?_0x32ac76[_0x494a('0x33')]:_0x2db087[_0x494a('0x2e')];_0x32ac76[_0x494a('0x37')]=qs[_0x494a('0x38')](_0x3501cd[_0x494a('0x30')][_0x494a('0x38')]);_0x32ac76[_0x494a('0x39')]=qs[_0x494a('0x3a')](_['pick'](_0x3501cd['query'],_0x2db087['filters']));if(_0x3501cd[_0x494a('0x30')][_0x494a('0x3c')]){_0x32ac76[_0x494a('0x39')]=_[_0x494a('0x3d')](_0x32ac76[_0x494a('0x39')],{'$or':_['map'](_0x32ac76[_0x494a('0x33')],function(_0x4c8280){var _0x277903={};_0x277903[_0x4c8280]={'$like':'%'+_0x3501cd['query'][_0x494a('0x3c')]+'%'};return _0x277903;})});}_0x32ac76=_[_0x494a('0x3d')]({},_0x32ac76,_0x3501cd[_0x494a('0x3f')]);return _0x3fd16b[_0x494a('0x4b')](_0x32ac76);}})[_0x494a('0x25')](function(_0xeee670){if(_0xeee670){_0x3c26a0=_0xeee670['length'];if(!_0x3501cd[_0x494a('0x30')]['hasOwnProperty'](_0x494a('0x36'))){_0x32ac76[_0x494a('0x1f')]=qs[_0x494a('0x1f')](_0x3501cd[_0x494a('0x30')][_0x494a('0x1f')]);_0x32ac76[_0x494a('0x1c')]=qs[_0x494a('0x1c')](_0x3501cd[_0x494a('0x30')][_0x494a('0x1c')]);}return _0x3fd16b[_0x494a('0x4b')](_0x32ac76);}})[_0x494a('0x25')](function(_0x17cb65){if(_0x17cb65){return _0x17cb65?{'count':_0x3c26a0,'rows':_0x17cb65}:null;}})[_0x494a('0x25')](respondWithResult(_0x5e0e4a,null))[_0x494a('0x43')](handleError(_0x5e0e4a,null));};exports[_0x494a('0x4c')]=function(_0x26f937,_0x3c09a7,_0x4076f){var _0x3a55bb={};var _0x1bfc20={};var _0x3bdb52;var _0x21eb74;return db[_0x494a('0x2b')][_0x494a('0x4a')]({'where':{'id':_0x26f937[_0x494a('0x44')]['id']}})[_0x494a('0x25')](handleEntityNotFound(_0x3c09a7,null))['then'](function(_0x184c1f){if(_0x184c1f){_0x3bdb52=_0x184c1f;_0x1bfc20[_0x494a('0x2e')]=_[_0x494a('0x31')](db[_0x494a('0x4d')]['rawAttributes']);_0x1bfc20['query']=_[_0x494a('0x31')](_0x26f937[_0x494a('0x30')]);_0x1bfc20['filters']=_[_0x494a('0x45')](_0x1bfc20['model'],_0x1bfc20[_0x494a('0x30')]);_0x3a55bb['attributes']=_[_0x494a('0x45')](_0x1bfc20[_0x494a('0x2e')],qs[_0x494a('0x32')](_0x26f937[_0x494a('0x30')]['fields']));_0x3a55bb['attributes']=_0x3a55bb[_0x494a('0x33')][_0x494a('0x34')]?_0x3a55bb[_0x494a('0x33')]:_0x1bfc20['model'];_0x3a55bb[_0x494a('0x37')]=qs[_0x494a('0x38')](_0x26f937[_0x494a('0x30')]['sort']);_0x3a55bb[_0x494a('0x39')]=qs[_0x494a('0x3a')](_[_0x494a('0x3b')](_0x26f937['query'],_0x1bfc20[_0x494a('0x3a')]));if(_0x26f937['query'][_0x494a('0x3c')]){_0x3a55bb[_0x494a('0x39')]=_[_0x494a('0x3d')](_0x3a55bb[_0x494a('0x39')],{'$or':_[_0x494a('0x2f')](_0x3a55bb['attributes'],function(_0x405c87){var _0x4c3177={};_0x4c3177[_0x405c87]={'$like':'%'+_0x26f937[_0x494a('0x30')][_0x494a('0x3c')]+'%'};return _0x4c3177;})});}_0x3a55bb=_[_0x494a('0x3d')]({},_0x3a55bb,_0x26f937[_0x494a('0x3f')]);return _0x3bdb52['getSubjects'](_0x3a55bb);}})[_0x494a('0x25')](function(_0x43a25c){if(_0x43a25c){_0x21eb74=_0x43a25c[_0x494a('0x34')];if(!_0x26f937[_0x494a('0x30')][_0x494a('0x35')]('nolimit')){_0x3a55bb['limit']=qs[_0x494a('0x1f')](_0x26f937[_0x494a('0x30')][_0x494a('0x1f')]);_0x3a55bb[_0x494a('0x1c')]=qs[_0x494a('0x1c')](_0x26f937[_0x494a('0x30')][_0x494a('0x1c')]);}return _0x3bdb52[_0x494a('0x4c')](_0x3a55bb);}})['then'](function(_0xb7e900){if(_0xb7e900){return _0xb7e900?{'count':_0x21eb74,'rows':_0xb7e900}:null;}})[_0x494a('0x25')](respondWithResult(_0x3c09a7,null))[_0x494a('0x43')](handleError(_0x3c09a7,null));};exports[_0x494a('0x4e')]=function(_0x4b8540,_0x4ed295,_0x175fb0){var _0x4ba00f={};var _0x3a6c93={};var _0x137b0c;var _0x25059e;return db['ZohoConfiguration'][_0x494a('0x4a')]({'where':{'id':_0x4b8540[_0x494a('0x44')]['id']}})[_0x494a('0x25')](handleEntityNotFound(_0x4ed295,null))[_0x494a('0x25')](function(_0x269e2a){if(_0x269e2a){_0x137b0c=_0x269e2a;_0x3a6c93[_0x494a('0x2e')]=_['keys'](db[_0x494a('0x4d')][_0x494a('0x2c')]);_0x3a6c93['query']=_[_0x494a('0x31')](_0x4b8540[_0x494a('0x30')]);_0x3a6c93[_0x494a('0x3a')]=_[_0x494a('0x45')](_0x3a6c93[_0x494a('0x2e')],_0x3a6c93[_0x494a('0x30')]);_0x4ba00f['attributes']=_[_0x494a('0x45')](_0x3a6c93[_0x494a('0x2e')],qs['fields'](_0x4b8540[_0x494a('0x30')]['fields']));_0x4ba00f['attributes']=_0x4ba00f[_0x494a('0x33')][_0x494a('0x34')]?_0x4ba00f['attributes']:_0x3a6c93[_0x494a('0x2e')];_0x4ba00f[_0x494a('0x37')]=qs['sort'](_0x4b8540[_0x494a('0x30')][_0x494a('0x38')]);_0x4ba00f['where']=qs[_0x494a('0x3a')](_[_0x494a('0x3b')](_0x4b8540[_0x494a('0x30')],_0x3a6c93[_0x494a('0x3a')]));if(_0x4b8540[_0x494a('0x30')]['filter']){_0x4ba00f[_0x494a('0x39')]=_[_0x494a('0x3d')](_0x4ba00f[_0x494a('0x39')],{'$or':_[_0x494a('0x2f')](_0x4ba00f['attributes'],function(_0x601ca4){var _0x366351={};_0x366351[_0x601ca4]={'$like':'%'+_0x4b8540['query'][_0x494a('0x3c')]+'%'};return _0x366351;})});}_0x4ba00f=_[_0x494a('0x3d')]({},_0x4ba00f,_0x4b8540[_0x494a('0x3f')]);return _0x137b0c['getDescriptions'](_0x4ba00f);}})['then'](function(_0x1b4caa){if(_0x1b4caa){_0x25059e=_0x1b4caa[_0x494a('0x34')];if(!_0x4b8540['query'][_0x494a('0x35')](_0x494a('0x36'))){_0x4ba00f['limit']=qs['limit'](_0x4b8540['query'][_0x494a('0x1f')]);_0x4ba00f['offset']=qs[_0x494a('0x1c')](_0x4b8540['query'][_0x494a('0x1c')]);}return _0x137b0c[_0x494a('0x4e')](_0x4ba00f);}})[_0x494a('0x25')](function(_0x2763ec){if(_0x2763ec){return _0x2763ec?{'count':_0x25059e,'rows':_0x2763ec}:null;}})[_0x494a('0x25')](respondWithResult(_0x4ed295,null))['catch'](handleError(_0x4ed295,null));}; \ No newline at end of file +var _0x9f7c=['ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZohoConfiguration','includeAll','findAll','rows','catch','params','include','options','find','create','body','getFields','findOne','nolimit','getSubjects'];(function(_0x36cc78,_0x548604){var _0xc8546=function(_0x4b38a2){while(--_0x4b38a2){_0x36cc78['push'](_0x36cc78['shift']());}};_0xc8546(++_0x548604);}(_0x9f7c,0xe9));var _0xc9f7=function(_0x1197e0,_0x3322d8){_0x1197e0=_0x1197e0-0x0;var _0x5ab6e0=_0x9f7c[_0x1197e0];return _0x5ab6e0;};'use strict';var emlformat=require(_0xc9f7('0x0'));var rimraf=require(_0xc9f7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc9f7('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc9f7('0x3'));var Mustache=require(_0xc9f7('0x4'));var util=require(_0xc9f7('0x5'));var path=require(_0xc9f7('0x6'));var sox=require(_0xc9f7('0x7'));var csv=require(_0xc9f7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9f7('0x9'));var _=require(_0xc9f7('0xa'));var squel=require(_0xc9f7('0xb'));var crypto=require(_0xc9f7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc9f7('0xd'));var toCsv=require(_0xc9f7('0x8'));var querystring=require('querystring');var Papa=require(_0xc9f7('0xe'));var Redis=require('ioredis');var authService=require(_0xc9f7('0xf'));var qs=require(_0xc9f7('0x10'));var as=require(_0xc9f7('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9f7('0x12'))(_0xc9f7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc9f7('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x287666,_0x37c52c){_0x37c52c=_0x37c52c||0xcc;return function(_0x5e5651){if(_0x5e5651){return _0x287666[_0xc9f7('0x15')](_0x37c52c);}return _0x287666[_0xc9f7('0x16')](_0x37c52c)[_0xc9f7('0x17')]();};}function respondWithResult(_0x4953ed,_0x42b59){_0x42b59=_0x42b59||0xc8;return function(_0x61a63){if(_0x61a63){return _0x4953ed[_0xc9f7('0x16')](_0x42b59)[_0xc9f7('0x18')](_0x61a63);}};}function respondWithFilteredResult(_0x40bee0,_0x5053e2){return function(_0x2ac6ed){if(_0x2ac6ed){var _0x366591=typeof _0x5053e2[_0xc9f7('0x19')]===_0xc9f7('0x1a')&&typeof _0x5053e2[_0xc9f7('0x1b')]===_0xc9f7('0x1a');var _0x295827=_0x2ac6ed[_0xc9f7('0x1c')];var _0xed700c=_0x366591?0x0:_0x5053e2[_0xc9f7('0x19')];var _0x4cf435=_0x366591?_0x2ac6ed[_0xc9f7('0x1c')]:_0x5053e2[_0xc9f7('0x19')]+_0x5053e2[_0xc9f7('0x1b')];var _0x2c382b;if(_0x4cf435>=_0x295827){_0x4cf435=_0x295827;_0x2c382b=0xc8;}else{_0x2c382b=0xce;}_0x40bee0['status'](_0x2c382b);return _0x40bee0[_0xc9f7('0x1d')](_0xc9f7('0x1e'),_0xed700c+'-'+_0x4cf435+'/'+_0x295827)[_0xc9f7('0x18')](_0x2ac6ed);}return null;};}function patchUpdates(_0x3cb694){return function(_0x400aaf){try{jsonpatch[_0xc9f7('0x1f')](_0x400aaf,_0x3cb694,!![]);}catch(_0x57e57f){return BPromise['reject'](_0x57e57f);}return _0x400aaf[_0xc9f7('0x20')]();};}function saveUpdates(_0x55299f,_0x24ac86){return function(_0x5d733f){if(_0x5d733f){return _0x5d733f[_0xc9f7('0x21')](_0x55299f)['then'](function(_0x3b6f3f){return _0x3b6f3f;});}return null;};}function removeEntity(_0x581c44,_0x2f664c){return function(_0x2d936a){if(_0x2d936a){return _0x2d936a[_0xc9f7('0x22')]()[_0xc9f7('0x23')](function(){_0x581c44[_0xc9f7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c98ca,_0x50b4b8){return function(_0x1ff10c){if(!_0x1ff10c){_0x2c98ca[_0xc9f7('0x15')](0x194);}return _0x1ff10c;};}function handleError(_0x457945,_0x24bfaa){_0x24bfaa=_0x24bfaa||0x1f4;return function(_0x3bdaf6){logger['error'](_0x3bdaf6[_0xc9f7('0x24')]);if(_0x3bdaf6['name']){delete _0x3bdaf6[_0xc9f7('0x25')];}_0x457945[_0xc9f7('0x16')](_0x24bfaa)[_0xc9f7('0x26')](_0x3bdaf6);};}exports[_0xc9f7('0x27')]=function(_0x1ef7c3,_0x449bf8){var _0x1d6113={},_0x493b76={},_0xd16abf={'count':0x0,'rows':[]};var _0x22937e=_[_0xc9f7('0x28')](db['ZohoConfiguration'][_0xc9f7('0x29')],function(_0x34b9a2){return{'name':_0x34b9a2['fieldName'],'type':_0x34b9a2[_0xc9f7('0x2a')][_0xc9f7('0x2b')]};});_0x493b76[_0xc9f7('0x2c')]=_[_0xc9f7('0x28')](_0x22937e,'name');_0x493b76[_0xc9f7('0x2d')]=_[_0xc9f7('0x2e')](_0x1ef7c3[_0xc9f7('0x2d')]);_0x493b76[_0xc9f7('0x2f')]=_[_0xc9f7('0x30')](_0x493b76[_0xc9f7('0x2c')],_0x493b76[_0xc9f7('0x2d')]);_0x1d6113['attributes']=_[_0xc9f7('0x30')](_0x493b76[_0xc9f7('0x2c')],qs[_0xc9f7('0x31')](_0x1ef7c3['query']['fields']));_0x1d6113[_0xc9f7('0x32')]=_0x1d6113['attributes'][_0xc9f7('0x33')]?_0x1d6113[_0xc9f7('0x32')]:_0x493b76[_0xc9f7('0x2c')];if(!_0x1ef7c3[_0xc9f7('0x2d')][_0xc9f7('0x34')]('nolimit')){_0x1d6113[_0xc9f7('0x1b')]=qs[_0xc9f7('0x1b')](_0x1ef7c3[_0xc9f7('0x2d')][_0xc9f7('0x1b')]);_0x1d6113[_0xc9f7('0x19')]=qs['offset'](_0x1ef7c3[_0xc9f7('0x2d')][_0xc9f7('0x19')]);}_0x1d6113[_0xc9f7('0x35')]=qs[_0xc9f7('0x36')](_0x1ef7c3['query'][_0xc9f7('0x36')]);_0x1d6113[_0xc9f7('0x37')]=qs[_0xc9f7('0x2f')](_[_0xc9f7('0x38')](_0x1ef7c3[_0xc9f7('0x2d')],_0x493b76[_0xc9f7('0x2f')]),_0x22937e);if(_0x1ef7c3['query'][_0xc9f7('0x39')]){_0x1d6113[_0xc9f7('0x37')]=_[_0xc9f7('0x3a')](_0x1d6113[_0xc9f7('0x37')],{'$or':_[_0xc9f7('0x28')](_0x22937e,function(_0x492f8b){if(_0x492f8b[_0xc9f7('0x2a')]!==_0xc9f7('0x3b')){var _0x3c0cc4={};_0x3c0cc4[_0x492f8b[_0xc9f7('0x25')]]={'$like':'%'+_0x1ef7c3[_0xc9f7('0x2d')][_0xc9f7('0x39')]+'%'};return _0x3c0cc4;}})});}_0x1d6113=_[_0xc9f7('0x3a')]({},_0x1d6113,_0x1ef7c3['options']);var _0xbf053a={'where':_0x1d6113['where']};return db[_0xc9f7('0x3c')]['count'](_0xbf053a)[_0xc9f7('0x23')](function(_0x3b7671){_0xd16abf[_0xc9f7('0x1c')]=_0x3b7671;if(_0x1ef7c3[_0xc9f7('0x2d')][_0xc9f7('0x3d')]){_0x1d6113['include']=[{'all':!![]}];}return db[_0xc9f7('0x3c')][_0xc9f7('0x3e')](_0x1d6113);})[_0xc9f7('0x23')](function(_0x2345fa){_0xd16abf[_0xc9f7('0x3f')]=_0x2345fa;return _0xd16abf;})[_0xc9f7('0x23')](respondWithFilteredResult(_0x449bf8,_0x1d6113))[_0xc9f7('0x40')](handleError(_0x449bf8,null));};exports['show']=function(_0x59cd9b,_0x5151c9){var _0x2f37ea={'raw':![],'where':{'id':_0x59cd9b[_0xc9f7('0x41')]['id']}},_0x3bb950={};_0x3bb950['model']=_[_0xc9f7('0x2e')](db[_0xc9f7('0x3c')][_0xc9f7('0x29')]);_0x3bb950[_0xc9f7('0x2d')]=_[_0xc9f7('0x2e')](_0x59cd9b[_0xc9f7('0x2d')]);_0x3bb950['filters']=_[_0xc9f7('0x30')](_0x3bb950['model'],_0x3bb950[_0xc9f7('0x2d')]);_0x2f37ea[_0xc9f7('0x32')]=_[_0xc9f7('0x30')](_0x3bb950[_0xc9f7('0x2c')],qs[_0xc9f7('0x31')](_0x59cd9b[_0xc9f7('0x2d')][_0xc9f7('0x31')]));_0x2f37ea['attributes']=_0x2f37ea[_0xc9f7('0x32')][_0xc9f7('0x33')]?_0x2f37ea[_0xc9f7('0x32')]:_0x3bb950[_0xc9f7('0x2c')];if(_0x59cd9b[_0xc9f7('0x2d')][_0xc9f7('0x3d')]){_0x2f37ea[_0xc9f7('0x42')]=[{'all':!![]}];}_0x2f37ea=_[_0xc9f7('0x3a')]({},_0x2f37ea,_0x59cd9b[_0xc9f7('0x43')]);return db[_0xc9f7('0x3c')][_0xc9f7('0x44')](_0x2f37ea)[_0xc9f7('0x23')](handleEntityNotFound(_0x5151c9,null))[_0xc9f7('0x23')](respondWithResult(_0x5151c9,null))[_0xc9f7('0x40')](handleError(_0x5151c9,null));};exports[_0xc9f7('0x45')]=function(_0x10043d,_0x956b01){return db['ZohoConfiguration'][_0xc9f7('0x45')](_0x10043d[_0xc9f7('0x46')],{})[_0xc9f7('0x23')](respondWithResult(_0x956b01,0xc9))[_0xc9f7('0x40')](handleError(_0x956b01,null));};exports[_0xc9f7('0x21')]=function(_0x52f93b,_0x5cbd76){if(_0x52f93b[_0xc9f7('0x46')]['id']){delete _0x52f93b[_0xc9f7('0x46')]['id'];}return db[_0xc9f7('0x3c')][_0xc9f7('0x44')]({'where':{'id':_0x52f93b[_0xc9f7('0x41')]['id']}})[_0xc9f7('0x23')](handleEntityNotFound(_0x5cbd76,null))[_0xc9f7('0x23')](saveUpdates(_0x52f93b['body'],null))[_0xc9f7('0x23')](respondWithResult(_0x5cbd76,null))[_0xc9f7('0x40')](handleError(_0x5cbd76,null));};exports[_0xc9f7('0x22')]=function(_0x3f98ab,_0x200f88){return db[_0xc9f7('0x3c')][_0xc9f7('0x44')]({'where':{'id':_0x3f98ab[_0xc9f7('0x41')]['id']}})[_0xc9f7('0x23')](handleEntityNotFound(_0x200f88,null))[_0xc9f7('0x23')](removeEntity(_0x200f88,null))[_0xc9f7('0x40')](handleError(_0x200f88,null));};exports[_0xc9f7('0x47')]=function(_0x36ca1b,_0x205f96,_0x3a199a){var _0x4bb1d2={};var _0x1102dc={};var _0x14c55a;var _0x558d50;return db['ZohoConfiguration'][_0xc9f7('0x48')]({'where':{'id':_0x36ca1b[_0xc9f7('0x41')]['id']}})['then'](handleEntityNotFound(_0x205f96,null))[_0xc9f7('0x23')](function(_0x1c12f6){if(_0x1c12f6){_0x14c55a=_0x1c12f6;_0x1102dc[_0xc9f7('0x2c')]=_[_0xc9f7('0x2e')](db['ZohoField']['rawAttributes']);_0x1102dc[_0xc9f7('0x2d')]=_[_0xc9f7('0x2e')](_0x36ca1b[_0xc9f7('0x2d')]);_0x1102dc[_0xc9f7('0x2f')]=_[_0xc9f7('0x30')](_0x1102dc[_0xc9f7('0x2c')],_0x1102dc[_0xc9f7('0x2d')]);_0x4bb1d2['attributes']=_[_0xc9f7('0x30')](_0x1102dc[_0xc9f7('0x2c')],qs['fields'](_0x36ca1b[_0xc9f7('0x2d')][_0xc9f7('0x31')]));_0x4bb1d2[_0xc9f7('0x32')]=_0x4bb1d2[_0xc9f7('0x32')][_0xc9f7('0x33')]?_0x4bb1d2[_0xc9f7('0x32')]:_0x1102dc['model'];_0x4bb1d2[_0xc9f7('0x35')]=qs[_0xc9f7('0x36')](_0x36ca1b[_0xc9f7('0x2d')]['sort']);_0x4bb1d2[_0xc9f7('0x37')]=qs[_0xc9f7('0x2f')](_['pick'](_0x36ca1b[_0xc9f7('0x2d')],_0x1102dc[_0xc9f7('0x2f')]));if(_0x36ca1b[_0xc9f7('0x2d')][_0xc9f7('0x39')]){_0x4bb1d2[_0xc9f7('0x37')]=_[_0xc9f7('0x3a')](_0x4bb1d2[_0xc9f7('0x37')],{'$or':_[_0xc9f7('0x28')](_0x4bb1d2[_0xc9f7('0x32')],function(_0x2a6ea2){var _0x48a285={};_0x48a285[_0x2a6ea2]={'$like':'%'+_0x36ca1b[_0xc9f7('0x2d')][_0xc9f7('0x39')]+'%'};return _0x48a285;})});}_0x4bb1d2=_[_0xc9f7('0x3a')]({},_0x4bb1d2,_0x36ca1b[_0xc9f7('0x43')]);return _0x14c55a['getFields'](_0x4bb1d2);}})[_0xc9f7('0x23')](function(_0x5b9654){if(_0x5b9654){_0x558d50=_0x5b9654[_0xc9f7('0x33')];if(!_0x36ca1b[_0xc9f7('0x2d')][_0xc9f7('0x34')](_0xc9f7('0x49'))){_0x4bb1d2[_0xc9f7('0x1b')]=qs['limit'](_0x36ca1b[_0xc9f7('0x2d')][_0xc9f7('0x1b')]);_0x4bb1d2[_0xc9f7('0x19')]=qs[_0xc9f7('0x19')](_0x36ca1b[_0xc9f7('0x2d')][_0xc9f7('0x19')]);}return _0x14c55a['getFields'](_0x4bb1d2);}})[_0xc9f7('0x23')](function(_0x54b174){if(_0x54b174){return _0x54b174?{'count':_0x558d50,'rows':_0x54b174}:null;}})[_0xc9f7('0x23')](respondWithResult(_0x205f96,null))[_0xc9f7('0x40')](handleError(_0x205f96,null));};exports[_0xc9f7('0x4a')]=function(_0x38edda,_0x7d0f99,_0xe28bf4){var _0x3a0b99={};var _0x15f788={};var _0x3429ed;var _0x55f946;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x38edda[_0xc9f7('0x41')]['id']}})[_0xc9f7('0x23')](handleEntityNotFound(_0x7d0f99,null))['then'](function(_0x5ca704){if(_0x5ca704){_0x3429ed=_0x5ca704;_0x15f788[_0xc9f7('0x2c')]=_['keys'](db[_0xc9f7('0x4b')][_0xc9f7('0x29')]);_0x15f788[_0xc9f7('0x2d')]=_[_0xc9f7('0x2e')](_0x38edda['query']);_0x15f788[_0xc9f7('0x2f')]=_[_0xc9f7('0x30')](_0x15f788[_0xc9f7('0x2c')],_0x15f788[_0xc9f7('0x2d')]);_0x3a0b99[_0xc9f7('0x32')]=_[_0xc9f7('0x30')](_0x15f788[_0xc9f7('0x2c')],qs['fields'](_0x38edda[_0xc9f7('0x2d')][_0xc9f7('0x31')]));_0x3a0b99[_0xc9f7('0x32')]=_0x3a0b99[_0xc9f7('0x32')][_0xc9f7('0x33')]?_0x3a0b99[_0xc9f7('0x32')]:_0x15f788[_0xc9f7('0x2c')];_0x3a0b99['order']=qs[_0xc9f7('0x36')](_0x38edda[_0xc9f7('0x2d')][_0xc9f7('0x36')]);_0x3a0b99['where']=qs[_0xc9f7('0x2f')](_[_0xc9f7('0x38')](_0x38edda[_0xc9f7('0x2d')],_0x15f788[_0xc9f7('0x2f')]));if(_0x38edda[_0xc9f7('0x2d')][_0xc9f7('0x39')]){_0x3a0b99['where']=_['merge'](_0x3a0b99[_0xc9f7('0x37')],{'$or':_[_0xc9f7('0x28')](_0x3a0b99['attributes'],function(_0x1a5c47){var _0x54737c={};_0x54737c[_0x1a5c47]={'$like':'%'+_0x38edda[_0xc9f7('0x2d')]['filter']+'%'};return _0x54737c;})});}_0x3a0b99=_[_0xc9f7('0x3a')]({},_0x3a0b99,_0x38edda[_0xc9f7('0x43')]);return _0x3429ed[_0xc9f7('0x4a')](_0x3a0b99);}})[_0xc9f7('0x23')](function(_0x4f1a36){if(_0x4f1a36){_0x55f946=_0x4f1a36['length'];if(!_0x38edda[_0xc9f7('0x2d')][_0xc9f7('0x34')]('nolimit')){_0x3a0b99[_0xc9f7('0x1b')]=qs[_0xc9f7('0x1b')](_0x38edda['query'][_0xc9f7('0x1b')]);_0x3a0b99[_0xc9f7('0x19')]=qs['offset'](_0x38edda['query'][_0xc9f7('0x19')]);}return _0x3429ed[_0xc9f7('0x4a')](_0x3a0b99);}})[_0xc9f7('0x23')](function(_0x1d2ec9){if(_0x1d2ec9){return _0x1d2ec9?{'count':_0x55f946,'rows':_0x1d2ec9}:null;}})['then'](respondWithResult(_0x7d0f99,null))[_0xc9f7('0x40')](handleError(_0x7d0f99,null));};exports['getDescriptions']=function(_0x82121f,_0x5b4a66,_0x5055ed){var _0x1718ad={};var _0x63eb92={};var _0x122a87;var _0x1beaed;return db[_0xc9f7('0x3c')][_0xc9f7('0x48')]({'where':{'id':_0x82121f[_0xc9f7('0x41')]['id']}})[_0xc9f7('0x23')](handleEntityNotFound(_0x5b4a66,null))[_0xc9f7('0x23')](function(_0x353b85){if(_0x353b85){_0x122a87=_0x353b85;_0x63eb92[_0xc9f7('0x2c')]=_['keys'](db[_0xc9f7('0x4b')][_0xc9f7('0x29')]);_0x63eb92[_0xc9f7('0x2d')]=_[_0xc9f7('0x2e')](_0x82121f[_0xc9f7('0x2d')]);_0x63eb92[_0xc9f7('0x2f')]=_[_0xc9f7('0x30')](_0x63eb92[_0xc9f7('0x2c')],_0x63eb92[_0xc9f7('0x2d')]);_0x1718ad[_0xc9f7('0x32')]=_[_0xc9f7('0x30')](_0x63eb92['model'],qs[_0xc9f7('0x31')](_0x82121f[_0xc9f7('0x2d')]['fields']));_0x1718ad[_0xc9f7('0x32')]=_0x1718ad[_0xc9f7('0x32')]['length']?_0x1718ad[_0xc9f7('0x32')]:_0x63eb92[_0xc9f7('0x2c')];_0x1718ad[_0xc9f7('0x35')]=qs[_0xc9f7('0x36')](_0x82121f['query'][_0xc9f7('0x36')]);_0x1718ad['where']=qs[_0xc9f7('0x2f')](_[_0xc9f7('0x38')](_0x82121f[_0xc9f7('0x2d')],_0x63eb92[_0xc9f7('0x2f')]));if(_0x82121f['query']['filter']){_0x1718ad[_0xc9f7('0x37')]=_[_0xc9f7('0x3a')](_0x1718ad[_0xc9f7('0x37')],{'$or':_[_0xc9f7('0x28')](_0x1718ad[_0xc9f7('0x32')],function(_0x1c63b5){var _0x39631f={};_0x39631f[_0x1c63b5]={'$like':'%'+_0x82121f[_0xc9f7('0x2d')][_0xc9f7('0x39')]+'%'};return _0x39631f;})});}_0x1718ad=_['merge']({},_0x1718ad,_0x82121f[_0xc9f7('0x43')]);return _0x122a87[_0xc9f7('0x4c')](_0x1718ad);}})[_0xc9f7('0x23')](function(_0x479730){if(_0x479730){_0x1beaed=_0x479730[_0xc9f7('0x33')];if(!_0x82121f['query'][_0xc9f7('0x34')](_0xc9f7('0x49'))){_0x1718ad[_0xc9f7('0x1b')]=qs[_0xc9f7('0x1b')](_0x82121f[_0xc9f7('0x2d')]['limit']);_0x1718ad['offset']=qs['offset'](_0x82121f[_0xc9f7('0x2d')]['offset']);}return _0x122a87['getDescriptions'](_0x1718ad);}})[_0xc9f7('0x23')](function(_0x5d0b5a){if(_0x5d0b5a){return _0x5d0b5a?{'count':_0x1beaed,'rows':_0x5d0b5a}:null;}})[_0xc9f7('0x23')](respondWithResult(_0x5b4a66,null))['catch'](handleError(_0x5b4a66,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 8cfac51..8b57fbe 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 _0x4fa2=['moment','bluebird','path','rimraf','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api'];(function(_0x3b0b37,_0x29e258){var _0x28644c=function(_0x4aa04b){while(--_0x4aa04b){_0x3b0b37['push'](_0x3b0b37['shift']());}};_0x28644c(++_0x29e258);}(_0x4fa2,0x96));var _0x24fa=function(_0x56bef9,_0x40a34d){_0x56bef9=_0x56bef9-0x0;var _0x225efc=_0x4fa2[_0x56bef9];return _0x225efc;};'use strict';var _=require(_0x24fa('0x0'));var util=require(_0x24fa('0x1'));var logger=require(_0x24fa('0x2'))(_0x24fa('0x3'));var moment=require(_0x24fa('0x4'));var BPromise=require(_0x24fa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24fa('0x6'));var rimraf=require(_0x24fa('0x7'));var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x24fa('0x8')]=function(_0x335553,_0xf5c901){return _0x335553['define'](_0x24fa('0x9'),attributes,{'tableName':_0x24fa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3de7=['define','int_zoho_configurations','util','../../config/logger','api','request-promise','path','rimraf','./intZohoConfiguration.attributes','exports'];(function(_0x35a533,_0x1448a6){var _0x2c1867=function(_0x3de5d0){while(--_0x3de5d0){_0x35a533['push'](_0x35a533['shift']());}};_0x2c1867(++_0x1448a6);}(_0x3de7,0x84));var _0x73de=function(_0x2d3cec,_0x3bfbc3){_0x2d3cec=_0x2d3cec-0x0;var _0x3ec537=_0x3de7[_0x2d3cec];return _0x3ec537;};'use strict';var _=require('lodash');var util=require(_0x73de('0x0'));var logger=require(_0x73de('0x1'))(_0x73de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x73de('0x3'));var fs=require('fs');var path=require(_0x73de('0x4'));var rimraf=require(_0x73de('0x5'));var config=require('../../config/environment');var attributes=require(_0x73de('0x6'));module[_0x73de('0x7')]=function(_0x55f1b3,_0x3fe48b){return _0x55f1b3[_0x73de('0x8')]('ZohoConfiguration',attributes,{'tableName':_0x73de('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 4ed40ae..37978bb 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 _0x5ba1=['message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xce2d7e,_0x56dac4){var _0x3143d9=function(_0x52633b){while(--_0x52633b){_0xce2d7e['push'](_0xce2d7e['shift']());}};_0x3143d9(++_0x56dac4);}(_0x5ba1,0x1a4));var _0x15ba=function(_0x7381ae,_0x2af148){_0x7381ae=_0x7381ae-0x0;var _0x48f3f5=_0x5ba1[_0x7381ae];return _0x48f3f5;};'use strict';var _=require(_0x15ba('0x0'));var util=require('util');var moment=require(_0x15ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x15ba('0x2'));var fs=require('fs');var Redis=require(_0x15ba('0x3'));var db=require(_0x15ba('0x4'))['db'];var utils=require(_0x15ba('0x5'));var logger=require(_0x15ba('0x6'))(_0x15ba('0x7'));var config=require('../../config/environment');var jayson=require(_0x15ba('0x8'));var client=jayson[_0x15ba('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eb151,_0x35182f,_0x1fb067){return new BPromise(function(_0x3cc979,_0x16d9a4){return client[_0x15ba('0xa')](_0x5eb151,_0x1fb067)[_0x15ba('0xb')](function(_0x4ebac4){logger[_0x15ba('0xc')](_0x15ba('0xd'),_0x35182f,'request\x20sent');logger[_0x15ba('0xe')](_0x15ba('0xf'),_0x35182f,_0x15ba('0x10'),JSON[_0x15ba('0x11')](_0x4ebac4));if(_0x4ebac4[_0x15ba('0x12')]){if(_0x4ebac4[_0x15ba('0x12')][_0x15ba('0x13')]===0x1f4){logger[_0x15ba('0x12')](_0x15ba('0xd'),_0x35182f,_0x4ebac4['error'][_0x15ba('0x14')]);return _0x16d9a4(_0x4ebac4['error']['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x35182f,_0x4ebac4['error'][_0x15ba('0x14')]);return _0x3cc979(_0x4ebac4[_0x15ba('0x12')][_0x15ba('0x14')]);}else{logger[_0x15ba('0xc')](_0x15ba('0xd'),_0x35182f,_0x15ba('0x10'));_0x3cc979(_0x4ebac4[_0x15ba('0x15')][_0x15ba('0x14')]);}})['catch'](function(_0x1f6b89){logger[_0x15ba('0x12')]('ZohoConfiguration,\x20%s,\x20%s',_0x35182f,_0x1f6b89);_0x16d9a4(_0x1f6b89);});});} \ No newline at end of file +var _0xc490=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','catch','util','moment','bluebird'];(function(_0x119860,_0x143703){var _0xbb96bf=function(_0x348bc3){while(--_0x348bc3){_0x119860['push'](_0x119860['shift']());}};_0xbb96bf(++_0x143703);}(_0xc490,0x1cb));var _0x0c49=function(_0x463359,_0x4b5c9a){_0x463359=_0x463359-0x0;var _0x500183=_0xc490[_0x463359];return _0x500183;};'use strict';var _=require('lodash');var util=require(_0x0c49('0x0'));var moment=require(_0x0c49('0x1'));var BPromise=require(_0x0c49('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c49('0x3'));var db=require(_0x0c49('0x4'))['db'];var utils=require(_0x0c49('0x5'));var logger=require(_0x0c49('0x6'))(_0x0c49('0x7'));var config=require('../../config/environment');var jayson=require(_0x0c49('0x8'));var client=jayson[_0x0c49('0x9')][_0x0c49('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x125f81,_0x37cfa1,_0x54fe67){return new BPromise(function(_0x598cf1,_0x229e7a){return client['request'](_0x125f81,_0x54fe67)[_0x0c49('0xb')](function(_0x2bbba7){logger[_0x0c49('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x37cfa1,_0x0c49('0xd'));logger[_0x0c49('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x37cfa1,_0x0c49('0xd'),JSON[_0x0c49('0xf')](_0x2bbba7));if(_0x2bbba7['error']){if(_0x2bbba7[_0x0c49('0x10')][_0x0c49('0x11')]===0x1f4){logger[_0x0c49('0x10')](_0x0c49('0x12'),_0x37cfa1,_0x2bbba7[_0x0c49('0x10')][_0x0c49('0x13')]);return _0x229e7a(_0x2bbba7[_0x0c49('0x10')][_0x0c49('0x13')]);}logger[_0x0c49('0x10')](_0x0c49('0x12'),_0x37cfa1,_0x2bbba7['error'][_0x0c49('0x13')]);return _0x598cf1(_0x2bbba7['error'][_0x0c49('0x13')]);}else{logger[_0x0c49('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x37cfa1,_0x0c49('0xd'));_0x598cf1(_0x2bbba7['result'][_0x0c49('0x13')]);}})[_0x0c49('0x14')](function(_0x28825a){logger[_0x0c49('0x10')](_0x0c49('0x12'),_0x37cfa1,_0x28825a);_0x229e7a(_0x28825a);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 13e7aae..77d9496 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 _0xb27e=['fs-extra','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x91fc59,_0x256231){var _0x5dea63=function(_0x19bdbf){while(--_0x19bdbf){_0x91fc59['push'](_0x91fc59['shift']());}};_0x5dea63(++_0x256231);}(_0xb27e,0x109));var _0xeb27=function(_0x258cf0,_0x26050a){_0x258cf0=_0x258cf0-0x0;var _0x484378=_0xb27e[_0x258cf0];return _0x484378;};'use strict';var multer=require(_0xeb27('0x0'));var util=require(_0xeb27('0x1'));var path=require(_0xeb27('0x2'));var timeout=require(_0xeb27('0x3'));var express=require(_0xeb27('0x4'));var router=express['Router']();var fs_extra=require(_0xeb27('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xeb27('0x6'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0xeb27('0x7')]('/',auth['isAuthenticated'](),controller[_0xeb27('0x8')]);router['get'](_0xeb27('0x9'),auth[_0xeb27('0xa')](),controller[_0xeb27('0xb')]);router[_0xeb27('0xc')]('/',auth[_0xeb27('0xa')](),controller[_0xeb27('0xd')]);router['put'](_0xeb27('0x9'),auth[_0xeb27('0xa')](),controller[_0xeb27('0xe')]);router[_0xeb27('0xf')](_0xeb27('0x9'),auth['isAuthenticated'](),controller[_0xeb27('0x10')]);module[_0xeb27('0x11')]=router; \ No newline at end of file +var _0x9f93=['get','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x9f93,0xee));var _0x39f9=function(_0xd6ba1a,_0x2e37e9){_0xd6ba1a=_0xd6ba1a-0x0;var _0x5ce10b=_0x9f93[_0xd6ba1a];return _0x5ce10b;};'use strict';var multer=require(_0x39f9('0x0'));var util=require(_0x39f9('0x1'));var path=require(_0x39f9('0x2'));var timeout=require(_0x39f9('0x3'));var express=require(_0x39f9('0x4'));var router=express[_0x39f9('0x5')]();var fs_extra=require(_0x39f9('0x6'));var auth=require(_0x39f9('0x7'));var interaction=require(_0x39f9('0x8'));var config=require('../../config/environment');var controller=require('./intZohoField.controller');router[_0x39f9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x39f9('0x9')]('/:id',auth[_0x39f9('0xa')](),controller[_0x39f9('0xb')]);router[_0x39f9('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x39f9('0xd')]('/:id',auth[_0x39f9('0xa')](),controller[_0x39f9('0xe')]);router[_0x39f9('0xf')](_0x39f9('0x10'),auth[_0x39f9('0xa')](),controller[_0x39f9('0x11')]);module[_0x39f9('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index f6835db..d308e6b 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 _0xd5db=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xd5db,0x1d1));var _0xbd5d=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0xd5db[_0x44a64f];return _0x52024b;};'use strict';var Sequelize=require(_0xbd5d('0x0'));module[_0xbd5d('0x1')]={'type':{'type':Sequelize[_0xbd5d('0x2')](_0xbd5d('0x3'),_0xbd5d('0x4'),_0xbd5d('0x5'),_0xbd5d('0x6'),'picklist'),'defaultValue':_0xbd5d('0x3')},'content':{'type':Sequelize[_0xbd5d('0x7')]},'key':{'type':Sequelize[_0xbd5d('0x7')]},'keyType':{'type':Sequelize[_0xbd5d('0x2')]('string',_0xbd5d('0x4'),_0xbd5d('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xbd5d('0x7')]},'customField':{'type':Sequelize[_0xbd5d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbd5d('0x7')]}}; \ No newline at end of file +var _0xe281=['customVariable','BOOLEAN','ENUM','variable','picklist','STRING'];(function(_0x210569,_0x3fe1a9){var _0x279340=function(_0x450b2a){while(--_0x450b2a){_0x210569['push'](_0x210569['shift']());}};_0x279340(++_0x3fe1a9);}(_0xe281,0x1be));var _0x1e28=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe281[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x1e28('0x0')]('string',_0x1e28('0x1'),'customVariable','keyValue',_0x1e28('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x1e28('0x3')]},'key':{'type':Sequelize[_0x1e28('0x3')]},'keyType':{'type':Sequelize[_0x1e28('0x0')]('string','variable',_0x1e28('0x4'))},'keyContent':{'type':Sequelize[_0x1e28('0x3')]},'idField':{'type':Sequelize[_0x1e28('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1e28('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1e28('0x3')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 0fe6f06..dc1d028 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 _0x5483=['index','map','ZohoField','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send'];(function(_0x13bd92,_0x4eea2b){var _0x4a35c2=function(_0x216c70){while(--_0x216c70){_0x13bd92['push'](_0x13bd92['shift']());}};_0x4a35c2(++_0x4eea2b);}(_0x5483,0x6b));var _0x3548=function(_0x15dbca,_0x1d7c3c){_0x15dbca=_0x15dbca-0x0;var _0x326533=_0x5483[_0x15dbca];return _0x326533;};'use strict';var emlformat=require(_0x3548('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3548('0x1'));var jsonpatch=require(_0x3548('0x2'));var rp=require(_0x3548('0x3'));var moment=require(_0x3548('0x4'));var BPromise=require(_0x3548('0x5'));var Mustache=require(_0x3548('0x6'));var util=require(_0x3548('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3548('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3548('0x9'));var squel=require(_0x3548('0xa'));var crypto=require(_0x3548('0xb'));var jsforce=require(_0x3548('0xc'));var deskjs=require(_0x3548('0xd'));var toCsv=require(_0x3548('0xe'));var querystring=require(_0x3548('0xf'));var Papa=require(_0x3548('0x10'));var Redis=require(_0x3548('0x11'));var authService=require(_0x3548('0x12'));var qs=require(_0x3548('0x13'));var as=require(_0x3548('0x14'));var hardwareService=require(_0x3548('0x15'));var logger=require(_0x3548('0x16'))(_0x3548('0x17'));var utils=require(_0x3548('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x3548('0x19'));var db=require(_0x3548('0x1a'))['db'];function respondWithStatusCode(_0x2183a2,_0x1f627d){_0x1f627d=_0x1f627d||0xcc;return function(_0x53733e){if(_0x53733e){return _0x2183a2[_0x3548('0x1b')](_0x1f627d);}return _0x2183a2[_0x3548('0x1c')](_0x1f627d)[_0x3548('0x1d')]();};}function respondWithResult(_0x43d556,_0x34d5ab){_0x34d5ab=_0x34d5ab||0xc8;return function(_0x5bfd8d){if(_0x5bfd8d){return _0x43d556[_0x3548('0x1c')](_0x34d5ab)[_0x3548('0x1e')](_0x5bfd8d);}};}function respondWithFilteredResult(_0x14adee,_0x37dcfe){return function(_0xb0707a){if(_0xb0707a){var _0x118843=typeof _0x37dcfe[_0x3548('0x1f')]===_0x3548('0x20')&&typeof _0x37dcfe[_0x3548('0x21')]===_0x3548('0x20');var _0x5f5bab=_0xb0707a[_0x3548('0x22')];var _0x2ae65c=_0x118843?0x0:_0x37dcfe[_0x3548('0x1f')];var _0x21b3ab=_0x118843?_0xb0707a[_0x3548('0x22')]:_0x37dcfe[_0x3548('0x1f')]+_0x37dcfe[_0x3548('0x21')];var _0x507a99;if(_0x21b3ab>=_0x5f5bab){_0x21b3ab=_0x5f5bab;_0x507a99=0xc8;}else{_0x507a99=0xce;}_0x14adee['status'](_0x507a99);return _0x14adee[_0x3548('0x23')](_0x3548('0x24'),_0x2ae65c+'-'+_0x21b3ab+'/'+_0x5f5bab)[_0x3548('0x1e')](_0xb0707a);}return null;};}function patchUpdates(_0x2cbcaa){return function(_0x4a8a65){try{jsonpatch[_0x3548('0x25')](_0x4a8a65,_0x2cbcaa,!![]);}catch(_0x54fc0b){return BPromise[_0x3548('0x26')](_0x54fc0b);}return _0x4a8a65['save']();};}function saveUpdates(_0x5c3329,_0x1ac2ff){return function(_0x4c0b97){if(_0x4c0b97){return _0x4c0b97[_0x3548('0x27')](_0x5c3329)[_0x3548('0x28')](function(_0x3ae375){return _0x3ae375;});}return null;};}function removeEntity(_0x3c3be8,_0x1ff9d7){return function(_0x1f59b1){if(_0x1f59b1){return _0x1f59b1[_0x3548('0x29')]()[_0x3548('0x28')](function(){_0x3c3be8[_0x3548('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xafd458,_0x40036e){return function(_0x12fef8){if(!_0x12fef8){_0xafd458[_0x3548('0x1b')](0x194);}return _0x12fef8;};}function handleError(_0x268c1e,_0x155bf4){_0x155bf4=_0x155bf4||0x1f4;return function(_0x2515f4){logger[_0x3548('0x2a')](_0x2515f4['stack']);if(_0x2515f4[_0x3548('0x2b')]){delete _0x2515f4[_0x3548('0x2b')];}_0x268c1e['status'](_0x155bf4)[_0x3548('0x2c')](_0x2515f4);};}exports[_0x3548('0x2d')]=function(_0x4a62e8,_0x5de806){var _0x3a67c9={},_0x4cca50={},_0x55af52={'count':0x0,'rows':[]};var _0x5d4784=_[_0x3548('0x2e')](db[_0x3548('0x2f')]['rawAttributes'],function(_0x384437){return{'name':_0x384437[_0x3548('0x30')],'type':_0x384437[_0x3548('0x31')]['key']};});_0x4cca50[_0x3548('0x32')]=_[_0x3548('0x2e')](_0x5d4784,'name');_0x4cca50[_0x3548('0x33')]=_[_0x3548('0x34')](_0x4a62e8[_0x3548('0x33')]);_0x4cca50[_0x3548('0x35')]=_[_0x3548('0x36')](_0x4cca50['model'],_0x4cca50[_0x3548('0x33')]);_0x3a67c9[_0x3548('0x37')]=_['intersection'](_0x4cca50['model'],qs[_0x3548('0x38')](_0x4a62e8['query'][_0x3548('0x38')]));_0x3a67c9[_0x3548('0x37')]=_0x3a67c9[_0x3548('0x37')][_0x3548('0x39')]?_0x3a67c9[_0x3548('0x37')]:_0x4cca50['model'];if(!_0x4a62e8['query'][_0x3548('0x3a')]('nolimit')){_0x3a67c9[_0x3548('0x21')]=qs['limit'](_0x4a62e8[_0x3548('0x33')][_0x3548('0x21')]);_0x3a67c9[_0x3548('0x1f')]=qs[_0x3548('0x1f')](_0x4a62e8[_0x3548('0x33')][_0x3548('0x1f')]);}_0x3a67c9[_0x3548('0x3b')]=qs['sort'](_0x4a62e8['query'][_0x3548('0x3c')]);_0x3a67c9['where']=qs[_0x3548('0x35')](_[_0x3548('0x3d')](_0x4a62e8['query'],_0x4cca50['filters']),_0x5d4784);if(_0x4a62e8['query'][_0x3548('0x3e')]){_0x3a67c9[_0x3548('0x3f')]=_[_0x3548('0x40')](_0x3a67c9['where'],{'$or':_[_0x3548('0x2e')](_0x5d4784,function(_0x23072f){if(_0x23072f['type']!==_0x3548('0x41')){var _0x90b4b1={};_0x90b4b1[_0x23072f[_0x3548('0x2b')]]={'$like':'%'+_0x4a62e8[_0x3548('0x33')]['filter']+'%'};return _0x90b4b1;}})});}_0x3a67c9=_[_0x3548('0x40')]({},_0x3a67c9,_0x4a62e8[_0x3548('0x42')]);var _0x54358a={'where':_0x3a67c9[_0x3548('0x3f')]};return db[_0x3548('0x2f')]['count'](_0x54358a)['then'](function(_0x3679d3){_0x55af52[_0x3548('0x22')]=_0x3679d3;if(_0x4a62e8[_0x3548('0x33')][_0x3548('0x43')]){_0x3a67c9['include']=[{'all':!![]}];}return db[_0x3548('0x2f')][_0x3548('0x44')](_0x3a67c9);})[_0x3548('0x28')](function(_0x3478f1){_0x55af52[_0x3548('0x45')]=_0x3478f1;return _0x55af52;})[_0x3548('0x28')](respondWithFilteredResult(_0x5de806,_0x3a67c9))[_0x3548('0x46')](handleError(_0x5de806,null));};exports[_0x3548('0x47')]=function(_0x209cd7,_0x688717){var _0x2b72b7={'raw':!![],'where':{'id':_0x209cd7[_0x3548('0x48')]['id']}},_0x4e251a={};_0x4e251a['model']=_[_0x3548('0x34')](db[_0x3548('0x2f')]['rawAttributes']);_0x4e251a[_0x3548('0x33')]=_[_0x3548('0x34')](_0x209cd7[_0x3548('0x33')]);_0x4e251a['filters']=_[_0x3548('0x36')](_0x4e251a[_0x3548('0x32')],_0x4e251a[_0x3548('0x33')]);_0x2b72b7[_0x3548('0x37')]=_[_0x3548('0x36')](_0x4e251a[_0x3548('0x32')],qs['fields'](_0x209cd7[_0x3548('0x33')][_0x3548('0x38')]));_0x2b72b7[_0x3548('0x37')]=_0x2b72b7[_0x3548('0x37')][_0x3548('0x39')]?_0x2b72b7[_0x3548('0x37')]:_0x4e251a[_0x3548('0x32')];if(_0x209cd7[_0x3548('0x33')][_0x3548('0x43')]){_0x2b72b7['include']=[{'all':!![]}];}_0x2b72b7=_[_0x3548('0x40')]({},_0x2b72b7,_0x209cd7[_0x3548('0x42')]);return db[_0x3548('0x2f')][_0x3548('0x49')](_0x2b72b7)[_0x3548('0x28')](handleEntityNotFound(_0x688717,null))['then'](respondWithResult(_0x688717,null))[_0x3548('0x46')](handleError(_0x688717,null));};exports[_0x3548('0x4a')]=function(_0x3fc997,_0x3c5c96){return db[_0x3548('0x2f')][_0x3548('0x4a')](_0x3fc997[_0x3548('0x4b')],{})['then'](respondWithResult(_0x3c5c96,0xc9))['catch'](handleError(_0x3c5c96,null));};exports[_0x3548('0x27')]=function(_0xf91f3a,_0x3ac729){if(_0xf91f3a['body']['id']){delete _0xf91f3a[_0x3548('0x4b')]['id'];}return db[_0x3548('0x2f')]['find']({'where':{'id':_0xf91f3a[_0x3548('0x48')]['id']}})[_0x3548('0x28')](handleEntityNotFound(_0x3ac729,null))['then'](saveUpdates(_0xf91f3a[_0x3548('0x4b')],null))[_0x3548('0x28')](respondWithResult(_0x3ac729,null))[_0x3548('0x46')](handleError(_0x3ac729,null));};exports[_0x3548('0x29')]=function(_0x3aa1f9,_0x31c63d){return db[_0x3548('0x2f')][_0x3548('0x49')]({'where':{'id':_0x3aa1f9['params']['id']}})[_0x3548('0x28')](handleEntityNotFound(_0x31c63d,null))[_0x3548('0x28')](removeEntity(_0x31c63d,null))['catch'](handleError(_0x31c63d,null));}; \ No newline at end of file +var _0xd5fc=['then','destroy','error','stack','name','index','map','ZohoField','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','filters','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','params','includeAll','find','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','apply','update'];(function(_0x31842c,_0x39618e){var _0x112191=function(_0x34313b){while(--_0x34313b){_0x31842c['push'](_0x31842c['shift']());}};_0x112191(++_0x39618e);}(_0xd5fc,0xae));var _0xcd5f=function(_0x48a149,_0x4a2925){_0x48a149=_0x48a149-0x0;var _0x3f494f=_0xd5fc[_0x48a149];return _0x3f494f;};'use strict';var emlformat=require(_0xcd5f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcd5f('0x1'));var moment=require(_0xcd5f('0x2'));var BPromise=require(_0xcd5f('0x3'));var Mustache=require(_0xcd5f('0x4'));var util=require(_0xcd5f('0x5'));var path=require(_0xcd5f('0x6'));var sox=require('sox');var csv=require(_0xcd5f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd5f('0x8'));var _=require(_0xcd5f('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcd5f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xcd5f('0xb'));var Papa=require(_0xcd5f('0xc'));var Redis=require('ioredis');var authService=require(_0xcd5f('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xcd5f('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd5f('0xf'))(_0xcd5f('0x10'));var utils=require(_0xcd5f('0x11'));var config=require(_0xcd5f('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xcd5f('0x13'))['db'];function respondWithStatusCode(_0x2cba91,_0x4f309a){_0x4f309a=_0x4f309a||0xcc;return function(_0x14125f){if(_0x14125f){return _0x2cba91[_0xcd5f('0x14')](_0x4f309a);}return _0x2cba91[_0xcd5f('0x15')](_0x4f309a)[_0xcd5f('0x16')]();};}function respondWithResult(_0x327de2,_0x4d2d39){_0x4d2d39=_0x4d2d39||0xc8;return function(_0x2ff7e1){if(_0x2ff7e1){return _0x327de2[_0xcd5f('0x15')](_0x4d2d39)[_0xcd5f('0x17')](_0x2ff7e1);}};}function respondWithFilteredResult(_0x4242db,_0x18581d){return function(_0xb4503d){if(_0xb4503d){var _0x29a1c8=typeof _0x18581d['offset']===_0xcd5f('0x18')&&typeof _0x18581d[_0xcd5f('0x19')]===_0xcd5f('0x18');var _0x14da31=_0xb4503d['count'];var _0x1a4cb6=_0x29a1c8?0x0:_0x18581d['offset'];var _0xb23761=_0x29a1c8?_0xb4503d[_0xcd5f('0x1a')]:_0x18581d['offset']+_0x18581d[_0xcd5f('0x19')];var _0x2e8fde;if(_0xb23761>=_0x14da31){_0xb23761=_0x14da31;_0x2e8fde=0xc8;}else{_0x2e8fde=0xce;}_0x4242db['status'](_0x2e8fde);return _0x4242db[_0xcd5f('0x1b')]('Content-Range',_0x1a4cb6+'-'+_0xb23761+'/'+_0x14da31)[_0xcd5f('0x17')](_0xb4503d);}return null;};}function patchUpdates(_0x5c3c9f){return function(_0x50ca56){try{jsonpatch[_0xcd5f('0x1c')](_0x50ca56,_0x5c3c9f,!![]);}catch(_0x5e7a24){return BPromise['reject'](_0x5e7a24);}return _0x50ca56['save']();};}function saveUpdates(_0x408e30,_0x5c03b9){return function(_0x154449){if(_0x154449){return _0x154449[_0xcd5f('0x1d')](_0x408e30)[_0xcd5f('0x1e')](function(_0x233323){return _0x233323;});}return null;};}function removeEntity(_0x2a671a,_0x50d4c3){return function(_0x388290){if(_0x388290){return _0x388290[_0xcd5f('0x1f')]()[_0xcd5f('0x1e')](function(){_0x2a671a[_0xcd5f('0x15')](0xcc)[_0xcd5f('0x16')]();});}};}function handleEntityNotFound(_0x221adc,_0x3f5cd6){return function(_0x97fff9){if(!_0x97fff9){_0x221adc[_0xcd5f('0x14')](0x194);}return _0x97fff9;};}function handleError(_0x41ba4a,_0x41f682){_0x41f682=_0x41f682||0x1f4;return function(_0xba8d02){logger[_0xcd5f('0x20')](_0xba8d02[_0xcd5f('0x21')]);if(_0xba8d02[_0xcd5f('0x22')]){delete _0xba8d02[_0xcd5f('0x22')];}_0x41ba4a[_0xcd5f('0x15')](_0x41f682)['send'](_0xba8d02);};}exports[_0xcd5f('0x23')]=function(_0x3ae2f1,_0x561414){var _0xd7f50f={},_0x54789f={},_0x3bc913={'count':0x0,'rows':[]};var _0x139b5a=_[_0xcd5f('0x24')](db[_0xcd5f('0x25')][_0xcd5f('0x26')],function(_0x22e87e){return{'name':_0x22e87e['fieldName'],'type':_0x22e87e['type'][_0xcd5f('0x27')]};});_0x54789f[_0xcd5f('0x28')]=_[_0xcd5f('0x24')](_0x139b5a,_0xcd5f('0x22'));_0x54789f[_0xcd5f('0x29')]=_[_0xcd5f('0x2a')](_0x3ae2f1[_0xcd5f('0x29')]);_0x54789f['filters']=_[_0xcd5f('0x2b')](_0x54789f[_0xcd5f('0x28')],_0x54789f[_0xcd5f('0x29')]);_0xd7f50f[_0xcd5f('0x2c')]=_['intersection'](_0x54789f[_0xcd5f('0x28')],qs[_0xcd5f('0x2d')](_0x3ae2f1[_0xcd5f('0x29')]['fields']));_0xd7f50f[_0xcd5f('0x2c')]=_0xd7f50f[_0xcd5f('0x2c')][_0xcd5f('0x2e')]?_0xd7f50f[_0xcd5f('0x2c')]:_0x54789f[_0xcd5f('0x28')];if(!_0x3ae2f1[_0xcd5f('0x29')][_0xcd5f('0x2f')](_0xcd5f('0x30'))){_0xd7f50f['limit']=qs['limit'](_0x3ae2f1[_0xcd5f('0x29')]['limit']);_0xd7f50f[_0xcd5f('0x31')]=qs[_0xcd5f('0x31')](_0x3ae2f1[_0xcd5f('0x29')]['offset']);}_0xd7f50f[_0xcd5f('0x32')]=qs[_0xcd5f('0x33')](_0x3ae2f1[_0xcd5f('0x29')][_0xcd5f('0x33')]);_0xd7f50f['where']=qs[_0xcd5f('0x34')](_['pick'](_0x3ae2f1[_0xcd5f('0x29')],_0x54789f[_0xcd5f('0x34')]),_0x139b5a);if(_0x3ae2f1[_0xcd5f('0x29')][_0xcd5f('0x35')]){_0xd7f50f[_0xcd5f('0x36')]=_[_0xcd5f('0x37')](_0xd7f50f['where'],{'$or':_[_0xcd5f('0x24')](_0x139b5a,function(_0x59c00a){if(_0x59c00a[_0xcd5f('0x38')]!==_0xcd5f('0x39')){var _0x5bc9a3={};_0x5bc9a3[_0x59c00a['name']]={'$like':'%'+_0x3ae2f1[_0xcd5f('0x29')][_0xcd5f('0x35')]+'%'};return _0x5bc9a3;}})});}_0xd7f50f=_[_0xcd5f('0x37')]({},_0xd7f50f,_0x3ae2f1[_0xcd5f('0x3a')]);var _0x1bd291={'where':_0xd7f50f[_0xcd5f('0x36')]};return db[_0xcd5f('0x25')]['count'](_0x1bd291)[_0xcd5f('0x1e')](function(_0x1b4fcc){_0x3bc913[_0xcd5f('0x1a')]=_0x1b4fcc;if(_0x3ae2f1['query']['includeAll']){_0xd7f50f[_0xcd5f('0x3b')]=[{'all':!![]}];}return db['ZohoField'][_0xcd5f('0x3c')](_0xd7f50f);})[_0xcd5f('0x1e')](function(_0x395692){_0x3bc913[_0xcd5f('0x3d')]=_0x395692;return _0x3bc913;})['then'](respondWithFilteredResult(_0x561414,_0xd7f50f))[_0xcd5f('0x3e')](handleError(_0x561414,null));};exports['show']=function(_0x45bf1d,_0x2f1c4d){var _0x1a02c7={'raw':!![],'where':{'id':_0x45bf1d[_0xcd5f('0x3f')]['id']}},_0x4ef112={};_0x4ef112[_0xcd5f('0x28')]=_[_0xcd5f('0x2a')](db[_0xcd5f('0x25')][_0xcd5f('0x26')]);_0x4ef112[_0xcd5f('0x29')]=_[_0xcd5f('0x2a')](_0x45bf1d[_0xcd5f('0x29')]);_0x4ef112[_0xcd5f('0x34')]=_[_0xcd5f('0x2b')](_0x4ef112['model'],_0x4ef112['query']);_0x1a02c7[_0xcd5f('0x2c')]=_[_0xcd5f('0x2b')](_0x4ef112[_0xcd5f('0x28')],qs[_0xcd5f('0x2d')](_0x45bf1d['query'][_0xcd5f('0x2d')]));_0x1a02c7['attributes']=_0x1a02c7[_0xcd5f('0x2c')][_0xcd5f('0x2e')]?_0x1a02c7[_0xcd5f('0x2c')]:_0x4ef112['model'];if(_0x45bf1d['query'][_0xcd5f('0x40')]){_0x1a02c7[_0xcd5f('0x3b')]=[{'all':!![]}];}_0x1a02c7=_[_0xcd5f('0x37')]({},_0x1a02c7,_0x45bf1d[_0xcd5f('0x3a')]);return db[_0xcd5f('0x25')][_0xcd5f('0x41')](_0x1a02c7)[_0xcd5f('0x1e')](handleEntityNotFound(_0x2f1c4d,null))[_0xcd5f('0x1e')](respondWithResult(_0x2f1c4d,null))[_0xcd5f('0x3e')](handleError(_0x2f1c4d,null));};exports['create']=function(_0x47c9ff,_0x3de234){return db[_0xcd5f('0x25')][_0xcd5f('0x42')](_0x47c9ff['body'],{})[_0xcd5f('0x1e')](respondWithResult(_0x3de234,0xc9))[_0xcd5f('0x3e')](handleError(_0x3de234,null));};exports[_0xcd5f('0x1d')]=function(_0x21e87c,_0x112c30){if(_0x21e87c['body']['id']){delete _0x21e87c[_0xcd5f('0x43')]['id'];}return db[_0xcd5f('0x25')][_0xcd5f('0x41')]({'where':{'id':_0x21e87c[_0xcd5f('0x3f')]['id']}})[_0xcd5f('0x1e')](handleEntityNotFound(_0x112c30,null))[_0xcd5f('0x1e')](saveUpdates(_0x21e87c[_0xcd5f('0x43')],null))['then'](respondWithResult(_0x112c30,null))['catch'](handleError(_0x112c30,null));};exports[_0xcd5f('0x1f')]=function(_0x5dfca6,_0x2bc851){return db['ZohoField'][_0xcd5f('0x41')]({'where':{'id':_0x5dfca6[_0xcd5f('0x3f')]['id']}})[_0xcd5f('0x1e')](handleEntityNotFound(_0x2bc851,null))[_0xcd5f('0x1e')](removeEntity(_0x2bc851,null))[_0xcd5f('0x3e')](handleError(_0x2bc851,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 3ed2607..f6e6975 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 _0xd046=['util','../../config/logger','api','bluebird','rimraf','./intZohoField.attributes','define','zoho_unique_index','idField'];(function(_0xededfa,_0x35f3f0){var _0x5b8f86=function(_0x3a108a){while(--_0x3a108a){_0xededfa['push'](_0xededfa['shift']());}};_0x5b8f86(++_0x35f3f0);}(_0xd046,0x129));var _0x6d04=function(_0x1b51c7,_0x2862b4){_0x1b51c7=_0x1b51c7-0x0;var _0x3a4b=_0xd046[_0x1b51c7];return _0x3a4b;};'use strict';var _=require('lodash');var util=require(_0x6d04('0x0'));var logger=require(_0x6d04('0x1'))(_0x6d04('0x2'));var moment=require('moment');var BPromise=require(_0x6d04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d04('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d04('0x5'));module['exports']=function(_0x4bacb1,_0xf3b4e7){return _0x4bacb1[_0x6d04('0x6')]('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0x6d04('0x7'),'fields':[_0x6d04('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4991=['exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0x4991,0xf7));var _0x1499=function(_0x5b0df7,_0x42e3eb){_0x5b0df7=_0x5b0df7-0x0;var _0x419fd7=_0x4991[_0x5b0df7];return _0x419fd7;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));module[_0x1499('0x9')]=function(_0x4b6154,_0x2a8e96){return _0x4b6154[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'paranoid':![],'indexes':[{'name':_0x1499('0xd'),'fields':[_0x1499('0xe'),_0x1499('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index d589f36..9569fb5 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 _0x0451=['request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x4fb196,_0x47fcf5){var _0x5817fb=function(_0x34cd4f){while(--_0x34cd4f){_0x4fb196['push'](_0x4fb196['shift']());}};_0x5817fb(++_0x47fcf5);}(_0x0451,0x9c));var _0x1045=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x0451[_0x32b542];return _0x554d54;};'use strict';var _=require(_0x1045('0x0'));var util=require(_0x1045('0x1'));var moment=require('moment');var BPromise=require(_0x1045('0x2'));var rs=require(_0x1045('0x3'));var fs=require('fs');var Redis=require(_0x1045('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1045('0x5'));var logger=require(_0x1045('0x6'))(_0x1045('0x7'));var config=require(_0x1045('0x8'));var jayson=require(_0x1045('0x9'));var client=jayson[_0x1045('0xa')][_0x1045('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d6aa6,_0x15fe91,_0x4c1699){return new BPromise(function(_0x2c6e28,_0x4d2cee){return client[_0x1045('0xc')](_0x4d6aa6,_0x4c1699)[_0x1045('0xd')](function(_0x279856){logger[_0x1045('0xe')](_0x1045('0xf'),_0x15fe91,_0x1045('0x10'));logger[_0x1045('0x11')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x15fe91,'request\x20sent',JSON[_0x1045('0x12')](_0x279856));if(_0x279856[_0x1045('0x13')]){if(_0x279856['error'][_0x1045('0x14')]===0x1f4){logger[_0x1045('0x13')]('ZohoField,\x20%s,\x20%s',_0x15fe91,_0x279856[_0x1045('0x13')][_0x1045('0x15')]);return _0x4d2cee(_0x279856[_0x1045('0x13')]['message']);}logger[_0x1045('0x13')]('ZohoField,\x20%s,\x20%s',_0x15fe91,_0x279856[_0x1045('0x13')][_0x1045('0x15')]);return _0x2c6e28(_0x279856[_0x1045('0x13')]['message']);}else{logger['info'](_0x1045('0xf'),_0x15fe91,_0x1045('0x10'));_0x2c6e28(_0x279856[_0x1045('0x16')][_0x1045('0x15')]);}})[_0x1045('0x17')](function(_0x23e734){logger[_0x1045('0x13')](_0x1045('0xf'),_0x15fe91,_0x23e734);_0x4d2cee(_0x23e734);});});} \ No newline at end of file +var _0x119b=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','ioredis'];(function(_0x2390fd,_0x9b17e9){var _0x359d8c=function(_0x2229f2){while(--_0x2229f2){_0x2390fd['push'](_0x2390fd['shift']());}};_0x359d8c(++_0x9b17e9);}(_0x119b,0x14c));var _0xb119=function(_0x5df033,_0x29458b){_0x5df033=_0x5df033-0x0;var _0x445829=_0x119b[_0x5df033];return _0x445829;};'use strict';var _=require(_0xb119('0x0'));var util=require(_0xb119('0x1'));var moment=require(_0xb119('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb119('0x3'));var db=require(_0xb119('0x4'))['db'];var utils=require(_0xb119('0x5'));var logger=require(_0xb119('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb119('0x7'));var client=jayson['client'][_0xb119('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e3605,_0x54e2a3,_0x2fe426){return new BPromise(function(_0x155ffc,_0xfa36d1){return client[_0xb119('0x9')](_0x5e3605,_0x2fe426)[_0xb119('0xa')](function(_0x4d78be){logger[_0xb119('0xb')](_0xb119('0xc'),_0x54e2a3,_0xb119('0xd'));logger[_0xb119('0xe')](_0xb119('0xf'),_0x54e2a3,_0xb119('0xd'),JSON[_0xb119('0x10')](_0x4d78be));if(_0x4d78be['error']){if(_0x4d78be[_0xb119('0x11')]['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x54e2a3,_0x4d78be[_0xb119('0x11')][_0xb119('0x12')]);return _0xfa36d1(_0x4d78be[_0xb119('0x11')][_0xb119('0x12')]);}logger['error'](_0xb119('0xc'),_0x54e2a3,_0x4d78be[_0xb119('0x11')][_0xb119('0x12')]);return _0x155ffc(_0x4d78be[_0xb119('0x11')][_0xb119('0x12')]);}else{logger[_0xb119('0xb')](_0xb119('0xc'),_0x54e2a3,_0xb119('0xd'));_0x155ffc(_0x4d78be[_0xb119('0x13')][_0xb119('0x12')]);}})[_0xb119('0x14')](function(_0x3c3d12){logger[_0xb119('0x11')]('ZohoField,\x20%s,\x20%s',_0x54e2a3,_0x3c3d12);_0xfa36d1(_0x3c3d12);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 4c5a36a..222372f 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x439af6,_0x479095){var _0x259601=function(_0x375ea9){while(--_0x375ea9){_0x439af6['push'](_0x439af6['shift']());}};_0x259601(++_0x479095);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4ff0b3,_0x34cc15){var _0x430487=function(_0x684f7){while(--_0x684f7){_0x4ff0b3['push'](_0x4ff0b3['shift']());}};_0x430487(++_0x34cc15);}(_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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 4658efc..865d361 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 _0x1b4d=['STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state','sequelize','exports'];(function(_0x44f8c3,_0x27f4e5){var _0x39d91d=function(_0x2b7464){while(--_0x2b7464){_0x44f8c3['push'](_0x44f8c3['shift']());}};_0x39d91d(++_0x27f4e5);}(_0x1b4d,0xce));var _0xd1b4=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1b4d[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xd1b4('0x0'));module[_0xd1b4('0x1')]={'name':{'type':Sequelize[_0xd1b4('0x2')],'allowNull':![],'unique':_0xd1b4('0x3')},'version':{'type':Sequelize[_0xd1b4('0x2')],'allowNull':![],'unique':_0xd1b4('0x3')},'main':{'type':Sequelize[_0xd1b4('0x2')],'defaultValue':_0xd1b4('0x4')},'filename':{'type':Sequelize[_0xd1b4('0x2')]},'path':{'type':Sequelize[_0xd1b4('0x2')]},'type':{'type':Sequelize[_0xd1b4('0x2')]},'size':{'type':Sequelize[_0xd1b4('0x5')]},'active':{'type':Sequelize[_0xd1b4('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xd1b4('0x2')]},'logo':{'type':Sequelize[_0xd1b4('0x2')]},'state':{'type':Sequelize[_0xd1b4('0x2')],'unique':_0xd1b4('0x7')},'description':{'type':Sequelize[_0xd1b4('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xd1b4('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xd87e=['exports','unique_name_and_version','STRING','app.js','BOOLEAN','state','sequelize'];(function(_0x3bcdf5,_0x98a292){var _0x54d24e=function(_0x1b23e3){while(--_0x1b23e3){_0x3bcdf5['push'](_0x3bcdf5['shift']());}};_0x54d24e(++_0x98a292);}(_0xd87e,0x1bf));var _0xed87=function(_0x166f43,_0x3bc8cb){_0x166f43=_0x166f43-0x0;var _0x43ae50=_0xd87e[_0x166f43];return _0x43ae50;};'use strict';var Sequelize=require(_0xed87('0x0'));module[_0xed87('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xed87('0x2')},'version':{'type':Sequelize[_0xed87('0x3')],'allowNull':![],'unique':_0xed87('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0xed87('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xed87('0x3')]},'type':{'type':Sequelize[_0xed87('0x3')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xed87('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xed87('0x3')],'unique':_0xed87('0x6')},'description':{'type':Sequelize[_0xed87('0x3')]},'title':{'type':Sequelize[_0xed87('0x3')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0xed87('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 8d57bbc..12f55e3 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 _0x01d9=['map','Integration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','index'];(function(_0x1803bb,_0x28d69e){var _0x27f820=function(_0x36ca4a){while(--_0x36ca4a){_0x1803bb['push'](_0x1803bb['shift']());}};_0x27f820(++_0x28d69e);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x901d('0x0'));var rimraf=require(_0x901d('0x1'));var zipdir=require(_0x901d('0x2'));var jsonpatch=require(_0x901d('0x3'));var rp=require('request-promise');var moment=require(_0x901d('0x4'));var BPromise=require(_0x901d('0x5'));var Mustache=require(_0x901d('0x6'));var util=require(_0x901d('0x7'));var path=require(_0x901d('0x8'));var sox=require(_0x901d('0x9'));var csv=require(_0x901d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x901d('0xb'));var _=require(_0x901d('0xc'));var squel=require(_0x901d('0xd'));var crypto=require(_0x901d('0xe'));var jsforce=require(_0x901d('0xf'));var deskjs=require(_0x901d('0x10'));var toCsv=require(_0x901d('0xa'));var querystring=require(_0x901d('0x11'));var Papa=require(_0x901d('0x12'));var Redis=require(_0x901d('0x13'));var authService=require(_0x901d('0x14'));var qs=require(_0x901d('0x15'));var as=require(_0x901d('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x901d('0x17'))('api');var utils=require(_0x901d('0x18'));var config=require(_0x901d('0x19'));var licenseUtil=require(_0x901d('0x1a'));var db=require(_0x901d('0x1b'))['db'];function respondWithStatusCode(_0x15ebaf,_0x5d2345){_0x5d2345=_0x5d2345||0xcc;return function(_0x1d8117){if(_0x1d8117){return _0x15ebaf[_0x901d('0x1c')](_0x5d2345);}return _0x15ebaf[_0x901d('0x1d')](_0x5d2345)[_0x901d('0x1e')]();};}function respondWithResult(_0xb8869a,_0x14d99b){_0x14d99b=_0x14d99b||0xc8;return function(_0x530a2b){if(_0x530a2b){return _0xb8869a[_0x901d('0x1d')](_0x14d99b)[_0x901d('0x1f')](_0x530a2b);}};}function respondWithFilteredResult(_0x11b0cc,_0x17d451){return function(_0x1aba97){if(_0x1aba97){var _0x7dd5f4=typeof _0x17d451[_0x901d('0x20')]===_0x901d('0x21')&&typeof _0x17d451[_0x901d('0x22')]===_0x901d('0x21');var _0x28caae=_0x1aba97[_0x901d('0x23')];var _0x285353=_0x7dd5f4?0x0:_0x17d451[_0x901d('0x20')];var _0x38f42b=_0x7dd5f4?_0x1aba97[_0x901d('0x23')]:_0x17d451[_0x901d('0x20')]+_0x17d451[_0x901d('0x22')];var _0x57d518;if(_0x38f42b>=_0x28caae){_0x38f42b=_0x28caae;_0x57d518=0xc8;}else{_0x57d518=0xce;}_0x11b0cc[_0x901d('0x1d')](_0x57d518);return _0x11b0cc[_0x901d('0x24')]('Content-Range',_0x285353+'-'+_0x38f42b+'/'+_0x28caae)['json'](_0x1aba97);}return null;};}function patchUpdates(_0x496a06){return function(_0x53f8ae){try{jsonpatch[_0x901d('0x25')](_0x53f8ae,_0x496a06,!![]);}catch(_0x44ea6f){return BPromise['reject'](_0x44ea6f);}return _0x53f8ae[_0x901d('0x26')]();};}function saveUpdates(_0x3ea3f6,_0x488e24){return function(_0x20778b){if(_0x20778b){return _0x20778b[_0x901d('0x27')](_0x3ea3f6)[_0x901d('0x28')](function(_0x3f80b9){return _0x3f80b9;});}return null;};}function removeEntity(_0x1e7d36,_0x1818d3){return function(_0x46e5c6){if(_0x46e5c6){return _0x46e5c6[_0x901d('0x29')]()['then'](function(){_0x1e7d36[_0x901d('0x1d')](0xcc)[_0x901d('0x1e')]();});}};}function handleEntityNotFound(_0xbc89a5,_0x1f0ee5){return function(_0x557809){if(!_0x557809){_0xbc89a5[_0x901d('0x1c')](0x194);}return _0x557809;};}function handleError(_0x23fd43,_0x27f4ca){_0x27f4ca=_0x27f4ca||0x1f4;return function(_0x3cbe43){logger[_0x901d('0x2a')](_0x3cbe43['stack']);if(_0x3cbe43[_0x901d('0x2b')]){delete _0x3cbe43[_0x901d('0x2b')];}_0x23fd43[_0x901d('0x1d')](_0x27f4ca)[_0x901d('0x2c')](_0x3cbe43);};}exports[_0x901d('0x2d')]=function(_0x3de9b9,_0x48e86e){var _0xae6dfe={},_0x533038={},_0x128830={'count':0x0,'rows':[]};var _0x389fd9=_[_0x901d('0x2e')](db[_0x901d('0x2f')][_0x901d('0x30')],function(_0x20df02){return{'name':_0x20df02[_0x901d('0x31')],'type':_0x20df02[_0x901d('0x32')][_0x901d('0x33')]};});_0x533038[_0x901d('0x34')]=_[_0x901d('0x2e')](_0x389fd9,_0x901d('0x2b'));_0x533038[_0x901d('0x35')]=_[_0x901d('0x36')](_0x3de9b9[_0x901d('0x35')]);_0x533038['filters']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],_0x533038[_0x901d('0x35')]);_0xae6dfe['attributes']=_[_0x901d('0x37')](_0x533038[_0x901d('0x34')],qs[_0x901d('0x38')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x38')]));_0xae6dfe[_0x901d('0x39')]=_0xae6dfe[_0x901d('0x39')][_0x901d('0x3a')]?_0xae6dfe[_0x901d('0x39')]:_0x533038[_0x901d('0x34')];if(!_0x3de9b9['query']['hasOwnProperty'](_0x901d('0x3b'))){_0xae6dfe['limit']=qs[_0x901d('0x22')](_0x3de9b9[_0x901d('0x35')]['limit']);_0xae6dfe[_0x901d('0x20')]=qs[_0x901d('0x20')](_0x3de9b9[_0x901d('0x35')]['offset']);}_0xae6dfe[_0x901d('0x3c')]=qs[_0x901d('0x3d')](_0x3de9b9[_0x901d('0x35')][_0x901d('0x3d')]);_0xae6dfe[_0x901d('0x3e')]=qs[_0x901d('0x3f')](_[_0x901d('0x40')](_0x3de9b9[_0x901d('0x35')],_0x533038[_0x901d('0x3f')]),_0x389fd9);if(_0x3de9b9[_0x901d('0x35')][_0x901d('0x41')]){_0xae6dfe[_0x901d('0x3e')]=_[_0x901d('0x42')](_0xae6dfe[_0x901d('0x3e')],{'$or':_[_0x901d('0x2e')](_0x389fd9,function(_0x1644d8){if(_0x1644d8['type']!==_0x901d('0x43')){var _0x423cab={};_0x423cab[_0x1644d8['name']]={'$like':'%'+_0x3de9b9['query'][_0x901d('0x41')]+'%'};return _0x423cab;}})});}_0xae6dfe=_['merge']({},_0xae6dfe,_0x3de9b9[_0x901d('0x44')]);var _0x3d0556={'where':_0xae6dfe[_0x901d('0x3e')]};return db[_0x901d('0x2f')][_0x901d('0x23')](_0x3d0556)[_0x901d('0x28')](function(_0x5df4cb){_0x128830['count']=_0x5df4cb;if(_0x3de9b9['query']['includeAll']){_0xae6dfe[_0x901d('0x45')]=[{'all':!![]}];}return db[_0x901d('0x2f')]['findAll'](_0xae6dfe);})[_0x901d('0x28')](function(_0x22fc44){_0x128830['rows']=_0x22fc44;return _0x128830;})[_0x901d('0x28')](respondWithFilteredResult(_0x48e86e,_0xae6dfe))[_0x901d('0x46')](handleError(_0x48e86e,null));};exports[_0x901d('0x47')]=function(_0x2c1895,_0x53663d){var _0x5aeb41={'raw':![],'where':{'id':_0x2c1895[_0x901d('0x48')]['id']}},_0xa9c008={};_0xa9c008[_0x901d('0x34')]=_[_0x901d('0x36')](db[_0x901d('0x2f')][_0x901d('0x30')]);_0xa9c008[_0x901d('0x35')]=_[_0x901d('0x36')](_0x2c1895[_0x901d('0x35')]);_0xa9c008[_0x901d('0x3f')]=_[_0x901d('0x37')](_0xa9c008['model'],_0xa9c008[_0x901d('0x35')]);_0x5aeb41['attributes']=_[_0x901d('0x37')](_0xa9c008['model'],qs[_0x901d('0x38')](_0x2c1895['query'][_0x901d('0x38')]));_0x5aeb41[_0x901d('0x39')]=_0x5aeb41[_0x901d('0x39')][_0x901d('0x3a')]?_0x5aeb41[_0x901d('0x39')]:_0xa9c008[_0x901d('0x34')];if(_0x2c1895[_0x901d('0x35')][_0x901d('0x49')]){_0x5aeb41[_0x901d('0x45')]=[{'all':!![]}];}_0x5aeb41=_[_0x901d('0x42')]({},_0x5aeb41,_0x2c1895[_0x901d('0x44')]);return db['Integration'][_0x901d('0x4a')](_0x5aeb41)[_0x901d('0x28')](handleEntityNotFound(_0x53663d,null))[_0x901d('0x28')](respondWithResult(_0x53663d,null))[_0x901d('0x46')](handleError(_0x53663d,null));};exports[_0x901d('0x4b')]=function(_0x24b6fa,_0x27459b){return db[_0x901d('0x2f')][_0x901d('0x4b')](_0x24b6fa[_0x901d('0x4c')],{})[_0x901d('0x28')](respondWithResult(_0x27459b,0xc9))[_0x901d('0x46')](handleError(_0x27459b,null));};exports[_0x901d('0x27')]=function(_0x23f2a9,_0x4888e8){if(_0x23f2a9['body']['id']){delete _0x23f2a9[_0x901d('0x4c')]['id'];}return db[_0x901d('0x2f')][_0x901d('0x4a')]({'where':{'id':_0x23f2a9[_0x901d('0x48')]['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x4888e8,null))['then'](saveUpdates(_0x23f2a9['body'],null))[_0x901d('0x28')](respondWithResult(_0x4888e8,null))[_0x901d('0x46')](handleError(_0x4888e8,null));};exports['destroy']=function(_0x23673d,_0x165207){return db['Integration'][_0x901d('0x4a')]({'where':{'id':_0x23673d['params']['id']}})[_0x901d('0x28')](handleEntityNotFound(_0x165207,null))[_0x901d('0x28')](removeEntity(_0x165207,null))[_0x901d('0x46')](handleError(_0x165207,null));}; \ No newline at end of file +var _0x4991=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','Integration','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','rawAttributes','fieldName','key','model','query','filters'];(function(_0x1322b1,_0x34df7c){var _0x33e327=function(_0x19910f){while(--_0x19910f){_0x1322b1['push'](_0x1322b1['shift']());}};_0x33e327(++_0x34df7c);}(_0x4991,0xf7));var _0x1499=function(_0x2fa1e0,_0x4364e8){_0x2fa1e0=_0x2fa1e0-0x0;var _0x177529=_0x4991[_0x2fa1e0];return _0x177529;};'use strict';var emlformat=require(_0x1499('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1499('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1499('0x2'));var moment=require(_0x1499('0x3'));var BPromise=require(_0x1499('0x4'));var Mustache=require(_0x1499('0x5'));var util=require(_0x1499('0x6'));var path=require(_0x1499('0x7'));var sox=require(_0x1499('0x8'));var csv=require(_0x1499('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1499('0xa'));var _=require(_0x1499('0xb'));var squel=require(_0x1499('0xc'));var crypto=require(_0x1499('0xd'));var jsforce=require(_0x1499('0xe'));var deskjs=require(_0x1499('0xf'));var toCsv=require(_0x1499('0x9'));var querystring=require(_0x1499('0x10'));var Papa=require('papaparse');var Redis=require(_0x1499('0x11'));var authService=require(_0x1499('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1499('0x13'));var hardwareService=require(_0x1499('0x14'));var logger=require('../../config/logger')(_0x1499('0x15'));var utils=require(_0x1499('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3039ce,_0x274bc1){_0x274bc1=_0x274bc1||0xcc;return function(_0x34a928){if(_0x34a928){return _0x3039ce[_0x1499('0x17')](_0x274bc1);}return _0x3039ce[_0x1499('0x18')](_0x274bc1)['end']();};}function respondWithResult(_0x5f34f2,_0x308177){_0x308177=_0x308177||0xc8;return function(_0x4e5195){if(_0x4e5195){return _0x5f34f2[_0x1499('0x18')](_0x308177)[_0x1499('0x19')](_0x4e5195);}};}function respondWithFilteredResult(_0x308318,_0x3ab605){return function(_0x48f654){if(_0x48f654){var _0x1ed43b=typeof _0x3ab605[_0x1499('0x1a')]==='undefined'&&typeof _0x3ab605[_0x1499('0x1b')]===_0x1499('0x1c');var _0x46b364=_0x48f654[_0x1499('0x1d')];var _0x1e45a9=_0x1ed43b?0x0:_0x3ab605[_0x1499('0x1a')];var _0x5b9859=_0x1ed43b?_0x48f654['count']:_0x3ab605['offset']+_0x3ab605[_0x1499('0x1b')];var _0xad534b;if(_0x5b9859>=_0x46b364){_0x5b9859=_0x46b364;_0xad534b=0xc8;}else{_0xad534b=0xce;}_0x308318['status'](_0xad534b);return _0x308318[_0x1499('0x1e')](_0x1499('0x1f'),_0x1e45a9+'-'+_0x5b9859+'/'+_0x46b364)[_0x1499('0x19')](_0x48f654);}return null;};}function patchUpdates(_0x18e4a6){return function(_0x21e887){try{jsonpatch[_0x1499('0x20')](_0x21e887,_0x18e4a6,!![]);}catch(_0x2b0458){return BPromise[_0x1499('0x21')](_0x2b0458);}return _0x21e887[_0x1499('0x22')]();};}function saveUpdates(_0x15bcd4,_0x2bb71f){return function(_0x836081){if(_0x836081){return _0x836081[_0x1499('0x23')](_0x15bcd4)[_0x1499('0x24')](function(_0x4ec57a){return _0x4ec57a;});}return null;};}function removeEntity(_0x1e2c51,_0x2c7f57){return function(_0x5615b4){if(_0x5615b4){return _0x5615b4[_0x1499('0x25')]()[_0x1499('0x24')](function(){_0x1e2c51[_0x1499('0x18')](0xcc)[_0x1499('0x26')]();});}};}function handleEntityNotFound(_0x3968e0,_0x16d036){return function(_0x54f3c2){if(!_0x54f3c2){_0x3968e0['sendStatus'](0x194);}return _0x54f3c2;};}function handleError(_0x12739b,_0x3c9aca){_0x3c9aca=_0x3c9aca||0x1f4;return function(_0x3b9259){logger[_0x1499('0x27')](_0x3b9259[_0x1499('0x28')]);if(_0x3b9259['name']){delete _0x3b9259[_0x1499('0x29')];}_0x12739b['status'](_0x3c9aca)['send'](_0x3b9259);};}exports['index']=function(_0x21d204,_0x103efa){var _0x40932a={},_0x1b460b={},_0x3dad86={'count':0x0,'rows':[]};var _0x388513=_[_0x1499('0x2a')](db['Integration'][_0x1499('0x2b')],function(_0x1a2c99){return{'name':_0x1a2c99[_0x1499('0x2c')],'type':_0x1a2c99['type'][_0x1499('0x2d')]};});_0x1b460b[_0x1499('0x2e')]=_['map'](_0x388513,_0x1499('0x29'));_0x1b460b[_0x1499('0x2f')]=_['keys'](_0x21d204[_0x1499('0x2f')]);_0x1b460b[_0x1499('0x30')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],_0x1b460b[_0x1499('0x2f')]);_0x40932a[_0x1499('0x32')]=_[_0x1499('0x31')](_0x1b460b[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x21d204[_0x1499('0x2f')][_0x1499('0x33')]));_0x40932a[_0x1499('0x32')]=_0x40932a[_0x1499('0x32')][_0x1499('0x34')]?_0x40932a[_0x1499('0x32')]:_0x1b460b[_0x1499('0x2e')];if(!_0x21d204[_0x1499('0x2f')][_0x1499('0x35')](_0x1499('0x36'))){_0x40932a[_0x1499('0x1b')]=qs['limit'](_0x21d204[_0x1499('0x2f')][_0x1499('0x1b')]);_0x40932a[_0x1499('0x1a')]=qs[_0x1499('0x1a')](_0x21d204[_0x1499('0x2f')][_0x1499('0x1a')]);}_0x40932a[_0x1499('0x37')]=qs[_0x1499('0x38')](_0x21d204[_0x1499('0x2f')][_0x1499('0x38')]);_0x40932a[_0x1499('0x39')]=qs['filters'](_['pick'](_0x21d204[_0x1499('0x2f')],_0x1b460b['filters']),_0x388513);if(_0x21d204[_0x1499('0x2f')]['filter']){_0x40932a[_0x1499('0x39')]=_[_0x1499('0x3a')](_0x40932a[_0x1499('0x39')],{'$or':_[_0x1499('0x2a')](_0x388513,function(_0x531933){if(_0x531933[_0x1499('0x3b')]!=='VIRTUAL'){var _0x2f9c59={};_0x2f9c59[_0x531933[_0x1499('0x29')]]={'$like':'%'+_0x21d204[_0x1499('0x2f')][_0x1499('0x3c')]+'%'};return _0x2f9c59;}})});}_0x40932a=_['merge']({},_0x40932a,_0x21d204[_0x1499('0x3d')]);var _0x815a99={'where':_0x40932a[_0x1499('0x39')]};return db[_0x1499('0x3e')]['count'](_0x815a99)[_0x1499('0x24')](function(_0x4cc411){_0x3dad86[_0x1499('0x1d')]=_0x4cc411;if(_0x21d204[_0x1499('0x2f')][_0x1499('0x3f')]){_0x40932a[_0x1499('0x40')]=[{'all':!![]}];}return db[_0x1499('0x3e')][_0x1499('0x41')](_0x40932a);})[_0x1499('0x24')](function(_0xcb85eb){_0x3dad86[_0x1499('0x42')]=_0xcb85eb;return _0x3dad86;})[_0x1499('0x24')](respondWithFilteredResult(_0x103efa,_0x40932a))['catch'](handleError(_0x103efa,null));};exports[_0x1499('0x43')]=function(_0x5dd36c,_0x2cfdaf){var _0x1af1a1={'raw':![],'where':{'id':_0x5dd36c[_0x1499('0x44')]['id']}},_0x5646cf={};_0x5646cf[_0x1499('0x2e')]=_[_0x1499('0x45')](db[_0x1499('0x3e')][_0x1499('0x2b')]);_0x5646cf['query']=_['keys'](_0x5dd36c[_0x1499('0x2f')]);_0x5646cf[_0x1499('0x30')]=_['intersection'](_0x5646cf[_0x1499('0x2e')],_0x5646cf[_0x1499('0x2f')]);_0x1af1a1['attributes']=_['intersection'](_0x5646cf[_0x1499('0x2e')],qs[_0x1499('0x33')](_0x5dd36c[_0x1499('0x2f')]['fields']));_0x1af1a1[_0x1499('0x32')]=_0x1af1a1[_0x1499('0x32')][_0x1499('0x34')]?_0x1af1a1[_0x1499('0x32')]:_0x5646cf['model'];if(_0x5dd36c[_0x1499('0x2f')][_0x1499('0x3f')]){_0x1af1a1[_0x1499('0x40')]=[{'all':!![]}];}_0x1af1a1=_[_0x1499('0x3a')]({},_0x1af1a1,_0x5dd36c['options']);return db[_0x1499('0x3e')][_0x1499('0x46')](_0x1af1a1)[_0x1499('0x24')](handleEntityNotFound(_0x2cfdaf,null))['then'](respondWithResult(_0x2cfdaf,null))['catch'](handleError(_0x2cfdaf,null));};exports[_0x1499('0x47')]=function(_0x491777,_0x7fa101){return db[_0x1499('0x3e')][_0x1499('0x47')](_0x491777[_0x1499('0x48')],{})[_0x1499('0x24')](respondWithResult(_0x7fa101,0xc9))[_0x1499('0x49')](handleError(_0x7fa101,null));};exports[_0x1499('0x23')]=function(_0x591aa8,_0x420d16){if(_0x591aa8['body']['id']){delete _0x591aa8[_0x1499('0x48')]['id'];}return db[_0x1499('0x3e')]['find']({'where':{'id':_0x591aa8[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x420d16,null))[_0x1499('0x24')](saveUpdates(_0x591aa8['body'],null))[_0x1499('0x24')](respondWithResult(_0x420d16,null))[_0x1499('0x49')](handleError(_0x420d16,null));};exports[_0x1499('0x25')]=function(_0x29ac0f,_0x305599){return db[_0x1499('0x3e')][_0x1499('0x46')]({'where':{'id':_0x29ac0f[_0x1499('0x44')]['id']}})[_0x1499('0x24')](handleEntityNotFound(_0x305599,null))[_0x1499('0x24')](removeEntity(_0x305599,null))['catch'](handleError(_0x305599,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index ec00dce..7d6a453 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 _0x9928=['Integration','integrations','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x85979c,_0x437e71){var _0x96e676=function(_0x2b3b6c){while(--_0x2b3b6c){_0x85979c['push'](_0x85979c['shift']());}};_0x96e676(++_0x437e71);}(_0x9928,0xc8));var _0x8992=function(_0x1cdf19,_0x2c4b46){_0x1cdf19=_0x1cdf19-0x0;var _0x340a02=_0x9928[_0x1cdf19];return _0x340a02;};'use strict';var _=require(_0x8992('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8992('0x1'));var moment=require(_0x8992('0x2'));var BPromise=require(_0x8992('0x3'));var rp=require(_0x8992('0x4'));var fs=require('fs');var path=require(_0x8992('0x5'));var rimraf=require(_0x8992('0x6'));var config=require(_0x8992('0x7'));var attributes=require('./integration.attributes');module['exports']=function(_0x53e77d,_0xb722a5){return _0x53e77d[_0x8992('0x8')](_0x8992('0x9'),attributes,{'tableName':_0x8992('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6653=['rimraf','./integration.attributes','exports','define','Integration','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x14672a,_0x36d1b1){var _0x44575b=function(_0x4fd803){while(--_0x4fd803){_0x14672a['push'](_0x14672a['shift']());}};_0x44575b(++_0x36d1b1);}(_0x6653,0x19c));var _0x3665=function(_0x350c54,_0x4fb4d9){_0x350c54=_0x350c54-0x0;var _0x4a9274=_0x6653[_0x350c54];return _0x4a9274;};'use strict';var _=require(_0x3665('0x0'));var util=require(_0x3665('0x1'));var logger=require(_0x3665('0x2'))(_0x3665('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3665('0x4'));var fs=require('fs');var path=require(_0x3665('0x5'));var rimraf=require(_0x3665('0x6'));var config=require('../../config/environment');var attributes=require(_0x3665('0x7'));module[_0x3665('0x8')]=function(_0xa3d759,_0x29132d){return _0xa3d759[_0x3665('0x9')](_0x3665('0xa'),attributes,{'tableName':'integrations','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 ebdcb00..728a70e 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 _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x278acd,_0x16d3fc){var _0x330bc8=function(_0x416d16){while(--_0x416d16){_0x278acd['push'](_0x278acd['shift']());}};_0x330bc8(++_0x16d3fc);}(_0xd943,0x15d));var _0x3d94=function(_0x4e1cec,_0x21af7d){_0x4e1cec=_0x4e1cec-0x0;var _0x417046=_0xd943[_0x4e1cec];return _0x417046;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('Integration,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x3dce17,_0xf1cbbb){var _0x53d608=function(_0x1c56e5){while(--_0x1c56e5){_0x3dce17['push'](_0x3dce17['shift']());}};_0x53d608(++_0xf1cbbb);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('Integration,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d8ea760..a5564e7 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 _0x0b0e=['get','isAuthenticated','index','describe','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x4b3d60,_0x23596d){var _0x3e437a=function(_0x17e6a4){while(--_0x17e6a4){_0x4b3d60['push'](_0x4b3d60['shift']());}};_0x3e437a(++_0x23596d);}(_0x0b0e,0x187));var _0xe0b0=function(_0x108db1,_0x89896d){_0x108db1=_0x108db1-0x0;var _0x16848d=_0x0b0e[_0x108db1];return _0x16848d;};'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')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0xe')]('/',auth[_0xe0b0('0xa')](),controller['create']);router[_0xe0b0('0xf')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x11')](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);module[_0xe0b0('0x13')]=router; \ No newline at end of file +var _0xc2c7=['/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe'];(function(_0x251184,_0x470e89){var _0x53f88e=function(_0x17e6d1){while(--_0x17e6d1){_0x251184['push'](_0x251184['shift']());}};_0x53f88e(++_0x470e89);}(_0xc2c7,0x134));var _0x7c2c=function(_0xe5da1d,_0x529764){_0xe5da1d=_0xe5da1d-0x0;var _0x330544=_0xc2c7[_0xe5da1d];return _0x330544;};'use strict';var multer=require('multer');var util=require(_0x7c2c('0x0'));var path=require(_0x7c2c('0x1'));var timeout=require(_0x7c2c('0x2'));var express=require(_0x7c2c('0x3'));var router=express[_0x7c2c('0x4')]();var fs_extra=require(_0x7c2c('0x5'));var auth=require(_0x7c2c('0x6'));var interaction=require(_0x7c2c('0x7'));var config=require('../../config/environment');var controller=require('./integrationReport.controller');router[_0x7c2c('0x8')]('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7c2c('0xb')]);router[_0x7c2c('0x8')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xd')]);router['post']('/',auth[_0x7c2c('0x9')](),controller[_0x7c2c('0xe')]);router[_0x7c2c('0xf')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x10')]);router[_0x7c2c('0x11')](_0x7c2c('0xc'),auth[_0x7c2c('0x9')](),controller[_0x7c2c('0x12')]);module[_0x7c2c('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 747b90a..b58df34 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 _0x510b=['BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x588280,_0x456cee){var _0x5a2fb4=function(_0x55e85e){while(--_0x55e85e){_0x588280['push'](_0x588280['shift']());}};_0x5a2fb4(++_0x456cee);}(_0x510b,0xa0));var _0xb510=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x510b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb510('0x0'));module[_0xb510('0x1')]={'integration':{'type':Sequelize[_0xb510('0x2')]},'eventChannel':{'type':Sequelize[_0xb510('0x2')]},'exitStatus':{'type':Sequelize[_0xb510('0x2')]},'ticketId':{'type':Sequelize[_0xb510('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xb510('0x2')]},'uniqueid':{'type':Sequelize[_0xb510('0x2')]},'calleridnum':{'type':Sequelize[_0xb510('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xb510('0x2')]},'interface':{'type':Sequelize[_0xb510('0x2')]},'membername':{'type':Sequelize[_0xb510('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb510('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb510('0x3')]},'holdtime':{'type':Sequelize[_0xb510('0x4')]},'agentcomplete':{'type':Sequelize[_0xb510('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xb510('0x4')]},'agentacw':{'type':Sequelize[_0xb510('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb510('0x4')]},'reason':{'type':Sequelize[_0xb510('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb510('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb510('0x3')]},'agentdump':{'type':Sequelize[_0xb510('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0xb510('0x2')]},'channel':{'type':Sequelize[_0xb510('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb510('0x2')]},'language':{'type':Sequelize[_0xb510('0x2')]},'accountcode':{'type':Sequelize[_0xb510('0x2')]},'context':{'type':Sequelize[_0xb510('0x2')]},'exten':{'type':Sequelize[_0xb510('0x2')]},'priority':{'type':Sequelize[_0xb510('0x2')]},'destchannel':{'type':Sequelize[_0xb510('0x2')]},'destchannelstate':{'type':Sequelize[_0xb510('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xb510('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xb510('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0xb510('0x2')]},'destaccountcode':{'type':Sequelize[_0xb510('0x2')]},'destcontext':{'type':Sequelize[_0xb510('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb510('0x2')]},'destuniqueid':{'type':Sequelize[_0xb510('0x2')]},'messageId':{'type':Sequelize[_0xb510('0x2')]},'inReplyTo':{'type':Sequelize[_0xb510('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xb510('0x2')]},'to':{'type':Sequelize[_0xb510('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xb510('0x6')]},'html':{'type':Sequelize[_0xb510('0x6')]},'text':{'type':Sequelize[_0xb510('0x6')]},'status':{'type':Sequelize['ENUM'](_0xb510('0x7'),_0xb510('0x8'),_0xb510('0x9'),_0xb510('0xa'))},'url':{'type':Sequelize[_0xb510('0x2')]},'app':{'type':Sequelize[_0xb510('0x2')]},'appdata':{'type':Sequelize[_0xb510('0x2')]},'projectId':{'type':Sequelize[_0xb510('0x4')]}}; \ No newline at end of file +var _0x9d83=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','INTEGER','BOOLEAN','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9d83,0x1a9));var _0x39d8=function(_0x521378,_0x2f8004){_0x521378=_0x521378-0x0;var _0x4b2fc4=_0x9d83[_0x521378];return _0x4b2fc4;};'use strict';var Sequelize=require(_0x39d8('0x0'));module[_0x39d8('0x1')]={'integration':{'type':Sequelize[_0x39d8('0x2')]},'eventChannel':{'type':Sequelize[_0x39d8('0x2')]},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x39d8('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x39d8('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x39d8('0x2')]},'queue':{'type':Sequelize[_0x39d8('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x39d8('0x2')]},'agentcalledAt':{'type':Sequelize[_0x39d8('0x3')]},'agentconnectAt':{'type':Sequelize[_0x39d8('0x3')]},'holdtime':{'type':Sequelize[_0x39d8('0x4')]},'agentcomplete':{'type':Sequelize[_0x39d8('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x39d8('0x3')]},'talktime':{'type':Sequelize[_0x39d8('0x4')]},'agentacw':{'type':Sequelize[_0x39d8('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x39d8('0x4')]},'reason':{'type':Sequelize[_0x39d8('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x39d8('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x39d8('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x39d8('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x39d8('0x2')]},'connectedlinenum':{'type':Sequelize[_0x39d8('0x2')]},'connectedlinename':{'type':Sequelize[_0x39d8('0x2')]},'language':{'type':Sequelize[_0x39d8('0x2')]},'accountcode':{'type':Sequelize[_0x39d8('0x2')]},'context':{'type':Sequelize[_0x39d8('0x2')]},'exten':{'type':Sequelize[_0x39d8('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x39d8('0x2')]},'destchannelstate':{'type':Sequelize[_0x39d8('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x39d8('0x2')]},'destcalleridnum':{'type':Sequelize[_0x39d8('0x2')]},'destcalleridname':{'type':Sequelize[_0x39d8('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x39d8('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x39d8('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x39d8('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x39d8('0x2')]},'destpriority':{'type':Sequelize[_0x39d8('0x2')]},'destuniqueid':{'type':Sequelize[_0x39d8('0x2')]},'messageId':{'type':Sequelize[_0x39d8('0x2')]},'inReplyTo':{'type':Sequelize[_0x39d8('0x2')]},'subject':{'type':Sequelize[_0x39d8('0x2')]},'from':{'type':Sequelize[_0x39d8('0x2')]},'to':{'type':Sequelize[_0x39d8('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x39d8('0x6')]},'html':{'type':Sequelize[_0x39d8('0x6')]},'text':{'type':Sequelize[_0x39d8('0x6')]},'status':{'type':Sequelize[_0x39d8('0x7')](_0x39d8('0x8'),_0x39d8('0x9'),_0x39d8('0xa'),_0x39d8('0xb'))},'url':{'type':Sequelize[_0x39d8('0x2')]},'app':{'type':Sequelize[_0x39d8('0x2')]},'appdata':{'type':Sequelize[_0x39d8('0x2')]},'projectId':{'type':Sequelize[_0x39d8('0x4')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0478272..eae06cd 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 _0xe9ee=['catch','options','create','body','update','find','params','eml-format','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','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','IntegrationReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows'];(function(_0x2ce3d0,_0xd94815){var _0x3c35d3=function(_0x16670d){while(--_0x16670d){_0x2ce3d0['push'](_0x2ce3d0['shift']());}};_0x3c35d3(++_0xd94815);}(_0xe9ee,0xf7));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xee9e('0x0'));var rimraf=require(_0xee9e('0x1'));var zipdir=require(_0xee9e('0x2'));var jsonpatch=require(_0xee9e('0x3'));var rp=require(_0xee9e('0x4'));var moment=require(_0xee9e('0x5'));var BPromise=require(_0xee9e('0x6'));var Mustache=require(_0xee9e('0x7'));var util=require(_0xee9e('0x8'));var path=require(_0xee9e('0x9'));var sox=require(_0xee9e('0xa'));var csv=require(_0xee9e('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xee9e('0xc'));var _=require(_0xee9e('0xd'));var squel=require(_0xee9e('0xe'));var crypto=require(_0xee9e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xee9e('0x10'));var toCsv=require(_0xee9e('0xb'));var querystring=require(_0xee9e('0x11'));var Papa=require(_0xee9e('0x12'));var Redis=require(_0xee9e('0x13'));var authService=require(_0xee9e('0x14'));var qs=require(_0xee9e('0x15'));var as=require(_0xee9e('0x16'));var hardwareService=require(_0xee9e('0x17'));var logger=require(_0xee9e('0x18'))(_0xee9e('0x19'));var utils=require(_0xee9e('0x1a'));var config=require(_0xee9e('0x1b'));var licenseUtil=require(_0xee9e('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44e8ca,_0xf75238){_0xf75238=_0xf75238||0xcc;return function(_0x3ea62a){if(_0x3ea62a){return _0x44e8ca[_0xee9e('0x1d')](_0xf75238);}return _0x44e8ca['status'](_0xf75238)[_0xee9e('0x1e')]();};}function respondWithResult(_0x5a3f7e,_0x4fe61b){_0x4fe61b=_0x4fe61b||0xc8;return function(_0x53427a){if(_0x53427a){return _0x5a3f7e['status'](_0x4fe61b)[_0xee9e('0x1f')](_0x53427a);}};}function respondWithFilteredResult(_0x108199,_0x4fe13d){return function(_0x106354){if(_0x106354){var _0x1e8795=typeof _0x4fe13d[_0xee9e('0x20')]==='undefined'&&typeof _0x4fe13d[_0xee9e('0x21')]===_0xee9e('0x22');var _0x383c1d=_0x106354['count'];var _0x70eb4d=_0x1e8795?0x0:_0x4fe13d['offset'];var _0x13dbf5=_0x1e8795?_0x106354[_0xee9e('0x23')]:_0x4fe13d[_0xee9e('0x20')]+_0x4fe13d[_0xee9e('0x21')];var _0x53b297;if(_0x13dbf5>=_0x383c1d){_0x13dbf5=_0x383c1d;_0x53b297=0xc8;}else{_0x53b297=0xce;}_0x108199[_0xee9e('0x24')](_0x53b297);return _0x108199[_0xee9e('0x25')](_0xee9e('0x26'),_0x70eb4d+'-'+_0x13dbf5+'/'+_0x383c1d)['json'](_0x106354);}return null;};}function patchUpdates(_0x5eb802){return function(_0x5e01dc){try{jsonpatch[_0xee9e('0x27')](_0x5e01dc,_0x5eb802,!![]);}catch(_0x2ee93a){return BPromise[_0xee9e('0x28')](_0x2ee93a);}return _0x5e01dc[_0xee9e('0x29')]();};}function saveUpdates(_0x151097,_0x1ec3ae){return function(_0x4e4727){if(_0x4e4727){return _0x4e4727['update'](_0x151097)[_0xee9e('0x2a')](function(_0x54414f){return _0x54414f;});}return null;};}function removeEntity(_0x459e8d,_0x29c857){return function(_0x5d3643){if(_0x5d3643){return _0x5d3643[_0xee9e('0x2b')]()[_0xee9e('0x2a')](function(){_0x459e8d[_0xee9e('0x24')](0xcc)[_0xee9e('0x1e')]();});}};}function handleEntityNotFound(_0x5cc3af,_0x43c61e){return function(_0x191d29){if(!_0x191d29){_0x5cc3af[_0xee9e('0x1d')](0x194);}return _0x191d29;};}function handleError(_0x14a9c7,_0x40eb37){_0x40eb37=_0x40eb37||0x1f4;return function(_0xd24213){logger[_0xee9e('0x2c')](_0xd24213[_0xee9e('0x2d')]);if(_0xd24213[_0xee9e('0x2e')]){delete _0xd24213[_0xee9e('0x2e')];}_0x14a9c7[_0xee9e('0x24')](_0x40eb37)[_0xee9e('0x2f')](_0xd24213);};}exports['index']=function(_0x411bef,_0x5a61cb){var _0x2d5f9a={},_0xafbea5={},_0x2d6d5b={'count':0x0,'rows':[]};var _0x10cb3c=_[_0xee9e('0x30')](db[_0xee9e('0x31')][_0xee9e('0x32')],function(_0x3c6779){return{'name':_0x3c6779[_0xee9e('0x33')],'type':_0x3c6779[_0xee9e('0x34')]['key']};});_0xafbea5[_0xee9e('0x35')]=_[_0xee9e('0x30')](_0x10cb3c,'name');_0xafbea5[_0xee9e('0x36')]=_[_0xee9e('0x37')](_0x411bef[_0xee9e('0x36')]);_0xafbea5[_0xee9e('0x38')]=_['intersection'](_0xafbea5[_0xee9e('0x35')],_0xafbea5[_0xee9e('0x36')]);_0x2d5f9a[_0xee9e('0x39')]=_[_0xee9e('0x3a')](_0xafbea5[_0xee9e('0x35')],qs[_0xee9e('0x3b')](_0x411bef['query']['fields']));_0x2d5f9a[_0xee9e('0x39')]=_0x2d5f9a[_0xee9e('0x39')][_0xee9e('0x3c')]?_0x2d5f9a[_0xee9e('0x39')]:_0xafbea5['model'];if(!_0x411bef[_0xee9e('0x36')][_0xee9e('0x3d')](_0xee9e('0x3e'))){_0x2d5f9a[_0xee9e('0x21')]=qs[_0xee9e('0x21')](_0x411bef['query'][_0xee9e('0x21')]);_0x2d5f9a[_0xee9e('0x20')]=qs[_0xee9e('0x20')](_0x411bef[_0xee9e('0x36')][_0xee9e('0x20')]);}_0x2d5f9a[_0xee9e('0x3f')]=qs[_0xee9e('0x40')](_0x411bef[_0xee9e('0x36')][_0xee9e('0x40')]);_0x2d5f9a['where']=qs[_0xee9e('0x38')](_[_0xee9e('0x41')](_0x411bef[_0xee9e('0x36')],_0xafbea5['filters']),_0x10cb3c);if(_0x411bef['query'][_0xee9e('0x42')]){_0x2d5f9a[_0xee9e('0x43')]=_['merge'](_0x2d5f9a[_0xee9e('0x43')],{'$or':_['map'](_0x10cb3c,function(_0x15744d){if(_0x15744d[_0xee9e('0x34')]!==_0xee9e('0x44')){var _0x4ed052={};_0x4ed052[_0x15744d[_0xee9e('0x2e')]]={'$like':'%'+_0x411bef[_0xee9e('0x36')]['filter']+'%'};return _0x4ed052;}})});}_0x2d5f9a=_[_0xee9e('0x45')]({},_0x2d5f9a,_0x411bef['options']);var _0x444310={'where':_0x2d5f9a[_0xee9e('0x43')]};return db['IntegrationReport'][_0xee9e('0x23')](_0x444310)[_0xee9e('0x2a')](function(_0x59ae45){_0x2d6d5b['count']=_0x59ae45;if(_0x411bef[_0xee9e('0x36')]['includeAll']){_0x2d5f9a[_0xee9e('0x46')]=[{'all':!![]}];}return db[_0xee9e('0x31')][_0xee9e('0x47')](_0x2d5f9a);})[_0xee9e('0x2a')](function(_0x51061d){_0x2d6d5b[_0xee9e('0x48')]=_0x51061d;return _0x2d6d5b;})[_0xee9e('0x2a')](respondWithFilteredResult(_0x5a61cb,_0x2d5f9a))[_0xee9e('0x49')](handleError(_0x5a61cb,null));};exports['show']=function(_0x2d5dd6,_0x16b180){var _0x2afa41={'raw':![],'where':{'id':_0x2d5dd6['params']['id']}},_0x52de40={};_0x52de40['model']=_[_0xee9e('0x37')](db['IntegrationReport']['rawAttributes']);_0x52de40[_0xee9e('0x36')]=_[_0xee9e('0x37')](_0x2d5dd6[_0xee9e('0x36')]);_0x52de40[_0xee9e('0x38')]=_[_0xee9e('0x3a')](_0x52de40['model'],_0x52de40[_0xee9e('0x36')]);_0x2afa41[_0xee9e('0x39')]=_[_0xee9e('0x3a')](_0x52de40[_0xee9e('0x35')],qs[_0xee9e('0x3b')](_0x2d5dd6[_0xee9e('0x36')][_0xee9e('0x3b')]));_0x2afa41['attributes']=_0x2afa41[_0xee9e('0x39')]['length']?_0x2afa41[_0xee9e('0x39')]:_0x52de40[_0xee9e('0x35')];if(_0x2d5dd6[_0xee9e('0x36')]['includeAll']){_0x2afa41[_0xee9e('0x46')]=[{'all':!![]}];}_0x2afa41=_[_0xee9e('0x45')]({},_0x2afa41,_0x2d5dd6[_0xee9e('0x4a')]);return db[_0xee9e('0x31')]['find'](_0x2afa41)[_0xee9e('0x2a')](handleEntityNotFound(_0x16b180,null))[_0xee9e('0x2a')](respondWithResult(_0x16b180,null))['catch'](handleError(_0x16b180,null));};exports[_0xee9e('0x4b')]=function(_0xac269a,_0x4c16c2){return db['IntegrationReport']['create'](_0xac269a[_0xee9e('0x4c')],{})[_0xee9e('0x2a')](respondWithResult(_0x4c16c2,0xc9))[_0xee9e('0x49')](handleError(_0x4c16c2,null));};exports[_0xee9e('0x4d')]=function(_0x287e43,_0x56cdca){if(_0x287e43[_0xee9e('0x4c')]['id']){delete _0x287e43[_0xee9e('0x4c')]['id'];}return db[_0xee9e('0x31')][_0xee9e('0x4e')]({'where':{'id':_0x287e43[_0xee9e('0x4f')]['id']}})[_0xee9e('0x2a')](handleEntityNotFound(_0x56cdca,null))[_0xee9e('0x2a')](saveUpdates(_0x287e43['body'],null))[_0xee9e('0x2a')](respondWithResult(_0x56cdca,null))['catch'](handleError(_0x56cdca,null));};exports[_0xee9e('0x2b')]=function(_0x17fbea,_0x9dcdfa){return db[_0xee9e('0x31')][_0xee9e('0x4e')]({'where':{'id':_0x17fbea[_0xee9e('0x4f')]['id']}})[_0xee9e('0x2a')](handleEntityNotFound(_0x9dcdfa,null))[_0xee9e('0x2a')](removeEntity(_0x9dcdfa,null))[_0xee9e('0x49')](handleError(_0x9dcdfa,null));};exports['describe']=function(_0x33daa9,_0x2df625){return db[_0xee9e('0x31')]['describe']()[_0xee9e('0x2a')](respondWithResult(_0x2df625,null))['catch'](handleError(_0x2df625,null));}; \ No newline at end of file +var _0xb7f3=['VIRTUAL','options','count','includeAll','include','findAll','show','length','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','offset','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','index','map','IntegrationReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge'];(function(_0x5a65e9,_0x5caf5d){var _0x95de87=function(_0x172bb0){while(--_0x172bb0){_0x5a65e9['push'](_0x5a65e9['shift']());}};_0x95de87(++_0x5caf5d);}(_0xb7f3,0x1ca));var _0x3b7f=function(_0x34a257,_0x5ec624){_0x34a257=_0x34a257-0x0;var _0x1e8bd0=_0xb7f3[_0x34a257];return _0x1e8bd0;};'use strict';var emlformat=require(_0x3b7f('0x0'));var rimraf=require(_0x3b7f('0x1'));var zipdir=require(_0x3b7f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3b7f('0x3'));var moment=require(_0x3b7f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3b7f('0x5'));var util=require('util');var path=require(_0x3b7f('0x6'));var sox=require(_0x3b7f('0x7'));var csv=require(_0x3b7f('0x8'));var ejs=require(_0x3b7f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3b7f('0xa'));var squel=require(_0x3b7f('0xb'));var crypto=require(_0x3b7f('0xc'));var jsforce=require(_0x3b7f('0xd'));var deskjs=require(_0x3b7f('0xe'));var toCsv=require(_0x3b7f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3b7f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x3b7f('0x10'));var hardwareService=require(_0x3b7f('0x11'));var logger=require(_0x3b7f('0x12'))(_0x3b7f('0x13'));var utils=require(_0x3b7f('0x14'));var config=require(_0x3b7f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b7f('0x16'))['db'];function respondWithStatusCode(_0x14ae5a,_0x2933d3){_0x2933d3=_0x2933d3||0xcc;return function(_0x59020c){if(_0x59020c){return _0x14ae5a[_0x3b7f('0x17')](_0x2933d3);}return _0x14ae5a[_0x3b7f('0x18')](_0x2933d3)['end']();};}function respondWithResult(_0x4f3575,_0x14b4eb){_0x14b4eb=_0x14b4eb||0xc8;return function(_0x4f7637){if(_0x4f7637){return _0x4f3575['status'](_0x14b4eb)[_0x3b7f('0x19')](_0x4f7637);}};}function respondWithFilteredResult(_0x2bca47,_0x1655b7){return function(_0x58168c){if(_0x58168c){var _0x10421f=typeof _0x1655b7['offset']===_0x3b7f('0x1a')&&typeof _0x1655b7[_0x3b7f('0x1b')]==='undefined';var _0x16dac8=_0x58168c['count'];var _0x52ae3b=_0x10421f?0x0:_0x1655b7['offset'];var _0x574fcb=_0x10421f?_0x58168c['count']:_0x1655b7[_0x3b7f('0x1c')]+_0x1655b7[_0x3b7f('0x1b')];var _0x4d7d0f;if(_0x574fcb>=_0x16dac8){_0x574fcb=_0x16dac8;_0x4d7d0f=0xc8;}else{_0x4d7d0f=0xce;}_0x2bca47[_0x3b7f('0x18')](_0x4d7d0f);return _0x2bca47[_0x3b7f('0x1d')](_0x3b7f('0x1e'),_0x52ae3b+'-'+_0x574fcb+'/'+_0x16dac8)[_0x3b7f('0x19')](_0x58168c);}return null;};}function patchUpdates(_0x1ac5c0){return function(_0x4bdb0d){try{jsonpatch[_0x3b7f('0x1f')](_0x4bdb0d,_0x1ac5c0,!![]);}catch(_0x2d8017){return BPromise['reject'](_0x2d8017);}return _0x4bdb0d[_0x3b7f('0x20')]();};}function saveUpdates(_0x47f92e,_0x49db50){return function(_0x73dbda){if(_0x73dbda){return _0x73dbda[_0x3b7f('0x21')](_0x47f92e)['then'](function(_0x167a68){return _0x167a68;});}return null;};}function removeEntity(_0x236ad4,_0x259655){return function(_0x3a8847){if(_0x3a8847){return _0x3a8847[_0x3b7f('0x22')]()[_0x3b7f('0x23')](function(){_0x236ad4[_0x3b7f('0x18')](0xcc)[_0x3b7f('0x24')]();});}};}function handleEntityNotFound(_0x23e78f,_0x5d9655){return function(_0x2800ae){if(!_0x2800ae){_0x23e78f['sendStatus'](0x194);}return _0x2800ae;};}function handleError(_0x2695be,_0x331273){_0x331273=_0x331273||0x1f4;return function(_0x46e1c9){logger[_0x3b7f('0x25')](_0x46e1c9[_0x3b7f('0x26')]);if(_0x46e1c9[_0x3b7f('0x27')]){delete _0x46e1c9[_0x3b7f('0x27')];}_0x2695be[_0x3b7f('0x18')](_0x331273)['send'](_0x46e1c9);};}exports[_0x3b7f('0x28')]=function(_0x2d4beb,_0x527f74){var _0x5f5016={},_0x1cd398={},_0x1325a7={'count':0x0,'rows':[]};var _0x3d9fc4=_[_0x3b7f('0x29')](db[_0x3b7f('0x2a')][_0x3b7f('0x2b')],function(_0x264f0b){return{'name':_0x264f0b['fieldName'],'type':_0x264f0b[_0x3b7f('0x2c')][_0x3b7f('0x2d')]};});_0x1cd398[_0x3b7f('0x2e')]=_[_0x3b7f('0x29')](_0x3d9fc4,_0x3b7f('0x27'));_0x1cd398[_0x3b7f('0x2f')]=_[_0x3b7f('0x30')](_0x2d4beb['query']);_0x1cd398[_0x3b7f('0x31')]=_[_0x3b7f('0x32')](_0x1cd398['model'],_0x1cd398['query']);_0x5f5016[_0x3b7f('0x33')]=_['intersection'](_0x1cd398[_0x3b7f('0x2e')],qs[_0x3b7f('0x34')](_0x2d4beb['query'][_0x3b7f('0x34')]));_0x5f5016['attributes']=_0x5f5016['attributes']['length']?_0x5f5016[_0x3b7f('0x33')]:_0x1cd398[_0x3b7f('0x2e')];if(!_0x2d4beb['query'][_0x3b7f('0x35')](_0x3b7f('0x36'))){_0x5f5016[_0x3b7f('0x1b')]=qs['limit'](_0x2d4beb[_0x3b7f('0x2f')][_0x3b7f('0x1b')]);_0x5f5016[_0x3b7f('0x1c')]=qs[_0x3b7f('0x1c')](_0x2d4beb['query'][_0x3b7f('0x1c')]);}_0x5f5016[_0x3b7f('0x37')]=qs['sort'](_0x2d4beb[_0x3b7f('0x2f')]['sort']);_0x5f5016[_0x3b7f('0x38')]=qs[_0x3b7f('0x31')](_[_0x3b7f('0x39')](_0x2d4beb[_0x3b7f('0x2f')],_0x1cd398[_0x3b7f('0x31')]),_0x3d9fc4);if(_0x2d4beb[_0x3b7f('0x2f')][_0x3b7f('0x3a')]){_0x5f5016['where']=_[_0x3b7f('0x3b')](_0x5f5016['where'],{'$or':_[_0x3b7f('0x29')](_0x3d9fc4,function(_0x910eb0){if(_0x910eb0[_0x3b7f('0x2c')]!==_0x3b7f('0x3c')){var _0x5e039e={};_0x5e039e[_0x910eb0[_0x3b7f('0x27')]]={'$like':'%'+_0x2d4beb[_0x3b7f('0x2f')][_0x3b7f('0x3a')]+'%'};return _0x5e039e;}})});}_0x5f5016=_['merge']({},_0x5f5016,_0x2d4beb[_0x3b7f('0x3d')]);var _0x1b2930={'where':_0x5f5016['where']};return db['IntegrationReport'][_0x3b7f('0x3e')](_0x1b2930)[_0x3b7f('0x23')](function(_0x267e65){_0x1325a7[_0x3b7f('0x3e')]=_0x267e65;if(_0x2d4beb[_0x3b7f('0x2f')][_0x3b7f('0x3f')]){_0x5f5016[_0x3b7f('0x40')]=[{'all':!![]}];}return db[_0x3b7f('0x2a')][_0x3b7f('0x41')](_0x5f5016);})[_0x3b7f('0x23')](function(_0x1b8fcc){_0x1325a7['rows']=_0x1b8fcc;return _0x1325a7;})[_0x3b7f('0x23')](respondWithFilteredResult(_0x527f74,_0x5f5016))['catch'](handleError(_0x527f74,null));};exports[_0x3b7f('0x42')]=function(_0x599d5d,_0x5edca3){var _0x5611c3={'raw':![],'where':{'id':_0x599d5d['params']['id']}},_0x3b41dd={};_0x3b41dd[_0x3b7f('0x2e')]=_[_0x3b7f('0x30')](db['IntegrationReport'][_0x3b7f('0x2b')]);_0x3b41dd['query']=_['keys'](_0x599d5d[_0x3b7f('0x2f')]);_0x3b41dd[_0x3b7f('0x31')]=_['intersection'](_0x3b41dd[_0x3b7f('0x2e')],_0x3b41dd[_0x3b7f('0x2f')]);_0x5611c3[_0x3b7f('0x33')]=_[_0x3b7f('0x32')](_0x3b41dd[_0x3b7f('0x2e')],qs['fields'](_0x599d5d['query'][_0x3b7f('0x34')]));_0x5611c3[_0x3b7f('0x33')]=_0x5611c3['attributes'][_0x3b7f('0x43')]?_0x5611c3['attributes']:_0x3b41dd['model'];if(_0x599d5d['query'][_0x3b7f('0x3f')]){_0x5611c3[_0x3b7f('0x40')]=[{'all':!![]}];}_0x5611c3=_['merge']({},_0x5611c3,_0x599d5d['options']);return db[_0x3b7f('0x2a')][_0x3b7f('0x44')](_0x5611c3)[_0x3b7f('0x23')](handleEntityNotFound(_0x5edca3,null))[_0x3b7f('0x23')](respondWithResult(_0x5edca3,null))[_0x3b7f('0x45')](handleError(_0x5edca3,null));};exports['create']=function(_0x5722a1,_0x46741e){return db['IntegrationReport'][_0x3b7f('0x46')](_0x5722a1[_0x3b7f('0x47')],{})[_0x3b7f('0x23')](respondWithResult(_0x46741e,0xc9))[_0x3b7f('0x45')](handleError(_0x46741e,null));};exports['update']=function(_0x5d9e9d,_0x24f9dd){if(_0x5d9e9d['body']['id']){delete _0x5d9e9d[_0x3b7f('0x47')]['id'];}return db['IntegrationReport'][_0x3b7f('0x44')]({'where':{'id':_0x5d9e9d[_0x3b7f('0x48')]['id']}})[_0x3b7f('0x23')](handleEntityNotFound(_0x24f9dd,null))[_0x3b7f('0x23')](saveUpdates(_0x5d9e9d[_0x3b7f('0x47')],null))[_0x3b7f('0x23')](respondWithResult(_0x24f9dd,null))['catch'](handleError(_0x24f9dd,null));};exports[_0x3b7f('0x22')]=function(_0x33aa01,_0x5b0afa){return db[_0x3b7f('0x2a')][_0x3b7f('0x44')]({'where':{'id':_0x33aa01[_0x3b7f('0x48')]['id']}})['then'](handleEntityNotFound(_0x5b0afa,null))[_0x3b7f('0x23')](removeEntity(_0x5b0afa,null))[_0x3b7f('0x45')](handleError(_0x5b0afa,null));};exports[_0x3b7f('0x49')]=function(_0x3983d0,_0x408213){return db['IntegrationReport'][_0x3b7f('0x49')]()[_0x3b7f('0x23')](respondWithResult(_0x408213,null))[_0x3b7f('0x45')](handleError(_0x408213,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 348b810..8f9cdc2 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 _0xcdaa=['api','moment','bluebird','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','util','../../config/logger'];(function(_0x4e8f5b,_0x3386be){var _0xb477f4=function(_0x417ddd){while(--_0x417ddd){_0x4e8f5b['push'](_0x4e8f5b['shift']());}};_0xb477f4(++_0x3386be);}(_0xcdaa,0x13d));var _0xacda=function(_0x42f502,_0x4db706){_0x42f502=_0x42f502-0x0;var _0x520e70=_0xcdaa[_0x42f502];return _0x520e70;};'use strict';var _=require('lodash');var util=require(_0xacda('0x0'));var logger=require(_0xacda('0x1'))(_0xacda('0x2'));var moment=require(_0xacda('0x3'));var BPromise=require(_0xacda('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xacda('0x5'));var rimraf=require(_0xacda('0x6'));var config=require('../../config/environment');var attributes=require(_0xacda('0x7'));module[_0xacda('0x8')]=function(_0x57e2d3,_0x2920c8){return _0x57e2d3[_0xacda('0x9')](_0xacda('0xa'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe47f=['./integrationReport.attributes','exports','define','report_integration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x4cc76f,_0x42dcc7){var _0x22437f=function(_0x1c37af){while(--_0x1c37af){_0x4cc76f['push'](_0x4cc76f['shift']());}};_0x22437f(++_0x42dcc7);}(_0xe47f,0xac));var _0xfe47=function(_0x5eaa8a,_0x396d27){_0x5eaa8a=_0x5eaa8a-0x0;var _0x558bc8=_0xe47f[_0x5eaa8a];return _0x558bc8;};'use strict';var _=require('lodash');var util=require(_0xfe47('0x0'));var logger=require(_0xfe47('0x1'))(_0xfe47('0x2'));var moment=require(_0xfe47('0x3'));var BPromise=require(_0xfe47('0x4'));var rp=require(_0xfe47('0x5'));var fs=require('fs');var path=require(_0xfe47('0x6'));var rimraf=require(_0xfe47('0x7'));var config=require('../../config/environment');var attributes=require(_0xfe47('0x8'));module[_0xfe47('0x9')]=function(_0x20f903,_0x1116cd){return _0x20f903[_0xfe47('0xa')]('IntegrationReport',attributes,{'tableName':_0xfe47('0xb'),'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 57e4a29..1d63768 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1d5cbb,_0x425e7f){var _0x1da5d5=function(_0x462f8d){while(--_0x462f8d){_0x1d5cbb['push'](_0x1d5cbb['shift']());}};_0x1da5d5(++_0x425e7f);}(_0x5fab,0x177));var _0xb5fa=function(_0xc3b08e,_0x427235){_0xc3b08e=_0xc3b08e-0x0;var _0x4c5e08=_0x5fab[_0xc3b08e];return _0x4c5e08;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x0295=['client','http','then','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','IntegrationReport,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x15eb90,_0x396dd6){var _0x2e7fc1=function(_0x3bf765){while(--_0x3bf765){_0x15eb90['push'](_0x15eb90['shift']());}};_0x2e7fc1(++_0x396dd6);}(_0x0295,0x1f0));var _0x5029=function(_0x20d713,_0x955578){_0x20d713=_0x20d713-0x0;var _0xc4f054=_0x0295[_0x20d713];return _0xc4f054;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('IntegrationReport,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 99c8516..8eb6322 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 _0x13c5=['show','/:id/sub_intervals','getIntervals','post','/:id/sub_intervals/create_many','/:id','update','delete','destroy','exports','multer','../../components/auth/service','./interval.controller','get','isAuthenticated','index'];(function(_0xf5bda0,_0x2589e1){var _0x5303cb=function(_0xdb9afe){while(--_0xdb9afe){_0xf5bda0['push'](_0xf5bda0['shift']());}};_0x5303cb(++_0x2589e1);}(_0x13c5,0x7a));var _0x513c=function(_0x483800,_0x15ef76){_0x483800=_0x483800-0x0;var _0x3ae709=_0x13c5[_0x483800];return _0x3ae709;};'use strict';var multer=require(_0x513c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x513c('0x1'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x513c('0x2'));router[_0x513c('0x3')]('/',auth[_0x513c('0x4')](),controller[_0x513c('0x5')]);router['get']('/:id',auth[_0x513c('0x4')](),controller[_0x513c('0x6')]);router[_0x513c('0x3')](_0x513c('0x7'),auth[_0x513c('0x4')](),controller[_0x513c('0x8')]);router[_0x513c('0x9')]('/',auth[_0x513c('0x4')](),controller['create']);router[_0x513c('0x9')](_0x513c('0x7'),auth['isAuthenticated'](),controller['addInterval']);router[_0x513c('0x9')](_0x513c('0xa'),auth['isAuthenticated'](),controller['addIntervals']);router['put'](_0x513c('0xb'),auth['isAuthenticated'](),controller[_0x513c('0xc')]);router[_0x513c('0xd')]('/:id',auth[_0x513c('0x4')](),controller[_0x513c('0xe')]);module[_0x513c('0xf')]=router; \ No newline at end of file +var _0x7dfd=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post'];(function(_0x4b0c47,_0x3ac1d6){var _0x3637a2=function(_0xcfd98a){while(--_0xcfd98a){_0x4b0c47['push'](_0x4b0c47['shift']());}};_0x3637a2(++_0x3ac1d6);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require(_0xd7df('0x6'));var auth=require(_0xd7df('0x7'));var interaction=require(_0xd7df('0x8'));var config=require(_0xd7df('0x9'));var controller=require(_0xd7df('0xa'));router[_0xd7df('0xb')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xb')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['show']);router[_0xd7df('0xb')](_0xd7df('0xf'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x10')]);router['post']('/',auth[_0xd7df('0xc')](),controller['create']);router[_0xd7df('0x11')]('/:id/sub_intervals',auth[_0xd7df('0xc')](),controller[_0xd7df('0x12')]);router[_0xd7df('0x11')](_0xd7df('0x13'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x14')]);router[_0xd7df('0x15')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x16')]);router[_0xd7df('0x17')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x18')]);module[_0xd7df('0x19')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index c412ed2..87674e9 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 _0x105f=['sequelize','exports','STRING'];(function(_0x461eaa,_0x5b9604){var _0x3f2756=function(_0xddf81a){while(--_0xddf81a){_0x461eaa['push'](_0x461eaa['shift']());}};_0x3f2756(++_0x5b9604);}(_0x105f,0x1a1));var _0xf105=function(_0x3b60c7,_0xb85ee7){_0x3b60c7=_0x3b60c7-0x0;var _0x32f39b=_0x105f[_0x3b60c7];return _0x32f39b;};'use strict';var Sequelize=require(_0xf105('0x0'));module[_0xf105('0x1')]={'name':{'type':Sequelize[_0xf105('0x2')]},'description':{'type':Sequelize[_0xf105('0x2')]},'interval':{'type':Sequelize[_0xf105('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xef03=['exports','STRING','sequelize'];(function(_0x54d561,_0x18b976){var _0x508f1e=function(_0x4e104c){while(--_0x4e104c){_0x54d561['push'](_0x54d561['shift']());}};_0x508f1e(++_0x18b976);}(_0xef03,0x173));var _0x3ef0=function(_0x507a62,_0x356d79){_0x507a62=_0x507a62-0x0;var _0x56d042=_0xef03[_0x507a62];return _0x56d042;};'use strict';var Sequelize=require(_0x3ef0('0x0'));module[_0x3ef0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3ef0('0x2')]},'interval':{'type':Sequelize[_0x3ef0('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 7696c59..098ce59 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 _0x807c=['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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Intervals','sendStatus','error','stack','name','send','index','Interval','rawAttributes','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','addInterval','IntervalId','getIntervals','findOne','pick','addIntervals','sequelize','bulkCreate','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x45c34b,_0xe6c9ec){var _0x1c914a=function(_0x3167eb){while(--_0x3167eb){_0x45c34b['push'](_0x45c34b['shift']());}};_0x1c914a(++_0xe6c9ec);}(_0x807c,0x170));var _0xc807=function(_0x5b035f,_0x2d6591){_0x5b035f=_0x5b035f-0x0;var _0x4634b8=_0x807c[_0x5b035f];return _0x4634b8;};'use strict';var emlformat=require(_0xc807('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc807('0x1'));var jsonpatch=require(_0xc807('0x2'));var rp=require('request-promise');var moment=require(_0xc807('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc807('0x4'));var util=require(_0xc807('0x5'));var path=require(_0xc807('0x6'));var sox=require(_0xc807('0x7'));var csv=require(_0xc807('0x8'));var ejs=require(_0xc807('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc807('0xa'));var squel=require(_0xc807('0xb'));var crypto=require(_0xc807('0xc'));var jsforce=require(_0xc807('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc807('0x8'));var querystring=require(_0xc807('0xe'));var Papa=require(_0xc807('0xf'));var Redis=require(_0xc807('0x10'));var authService=require(_0xc807('0x11'));var qs=require(_0xc807('0x12'));var as=require(_0xc807('0x13'));var hardwareService=require(_0xc807('0x14'));var logger=require(_0xc807('0x15'))(_0xc807('0x16'));var utils=require(_0xc807('0x17'));var config=require(_0xc807('0x18'));var licenseUtil=require(_0xc807('0x19'));var db=require(_0xc807('0x1a'))['db'];var extensions=require(_0xc807('0x1b'));function respondWithStatusCode(_0x8cdfe3,_0x35ce60){_0x35ce60=_0x35ce60||0xcc;return function(_0x144677){if(_0x144677){return _0x8cdfe3['sendStatus'](_0x35ce60);}return _0x8cdfe3[_0xc807('0x1c')](_0x35ce60)[_0xc807('0x1d')]();};}function respondWithResult(_0x1140b8,_0x3a6a11){_0x3a6a11=_0x3a6a11||0xc8;return function(_0x27c88a){if(_0x27c88a){return _0x1140b8[_0xc807('0x1c')](_0x3a6a11)[_0xc807('0x1e')](_0x27c88a);}};}function respondWithFilteredResult(_0x1383e5,_0x2a3567){return function(_0x4ba815){if(_0x4ba815){var _0x1b5435=typeof _0x2a3567[_0xc807('0x1f')]===_0xc807('0x20')&&typeof _0x2a3567[_0xc807('0x21')]===_0xc807('0x20');var _0x476b61=_0x4ba815[_0xc807('0x22')];var _0x2f12a7=_0x1b5435?0x0:_0x2a3567[_0xc807('0x1f')];var _0x107846=_0x1b5435?_0x4ba815[_0xc807('0x22')]:_0x2a3567[_0xc807('0x1f')]+_0x2a3567['limit'];var _0x136d8e;if(_0x107846>=_0x476b61){_0x107846=_0x476b61;_0x136d8e=0xc8;}else{_0x136d8e=0xce;}_0x1383e5[_0xc807('0x1c')](_0x136d8e);return _0x1383e5[_0xc807('0x23')](_0xc807('0x24'),_0x2f12a7+'-'+_0x107846+'/'+_0x476b61)['json'](_0x4ba815);}return null;};}function patchUpdates(_0x4e6f93){return function(_0x58a13f){try{jsonpatch[_0xc807('0x25')](_0x58a13f,_0x4e6f93,!![]);}catch(_0x4632dc){return BPromise[_0xc807('0x26')](_0x4632dc);}return _0x58a13f[_0xc807('0x27')]();};}function saveUpdates(_0x490d61,_0x5d15b9){return function(_0x3ac41c){if(_0x3ac41c){return _0x3ac41c['update'](_0x490d61)[_0xc807('0x28')](function(_0x232315){return _0x232315;});}return null;};}function removeEntity(_0x121b2d,_0x18a336){return function(_0xe97f3e){if(_0xe97f3e){return _0xe97f3e[_0xc807('0x29')]()[_0xc807('0x28')](function(){var _0x3117be=_0xe97f3e[_0xc807('0x2a')]({'plain':!![]});var _0x3d4960=_0xc807('0x2b');return db['UserProfileResource'][_0xc807('0x29')]({'where':{'type':_0x3d4960,'resourceId':_0x3117be['id']}})['then'](function(){return _0xe97f3e;});})[_0xc807('0x28')](function(){_0x121b2d[_0xc807('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2047e0,_0x5bfa7b){return function(_0x4e867e){if(!_0x4e867e){_0x2047e0[_0xc807('0x2c')](0x194);}return _0x4e867e;};}function handleError(_0x49e2c9,_0x3b8c71){_0x3b8c71=_0x3b8c71||0x1f4;return function(_0x2229a2){logger[_0xc807('0x2d')](_0x2229a2[_0xc807('0x2e')]);if(_0x2229a2[_0xc807('0x2f')]){delete _0x2229a2[_0xc807('0x2f')];}_0x49e2c9[_0xc807('0x1c')](_0x3b8c71)[_0xc807('0x30')](_0x2229a2);};}exports[_0xc807('0x31')]=function(_0x3adf9f,_0x170bda){var _0x37dd8b={},_0x165013={},_0x4c2aab={'count':0x0,'rows':[]};var _0x1f882f=_['map'](db[_0xc807('0x32')][_0xc807('0x33')],function(_0x214b34){return{'name':_0x214b34['fieldName'],'type':_0x214b34[_0xc807('0x34')][_0xc807('0x35')]};});_0x165013['model']=_[_0xc807('0x36')](_0x1f882f,_0xc807('0x2f'));_0x165013[_0xc807('0x37')]=_[_0xc807('0x38')](_0x3adf9f[_0xc807('0x37')]);_0x165013[_0xc807('0x39')]=_[_0xc807('0x3a')](_0x165013['model'],_0x165013[_0xc807('0x37')]);_0x37dd8b[_0xc807('0x3b')]=_[_0xc807('0x3a')](_0x165013[_0xc807('0x3c')],qs[_0xc807('0x3d')](_0x3adf9f[_0xc807('0x37')][_0xc807('0x3d')]));_0x37dd8b[_0xc807('0x3b')]=_0x37dd8b[_0xc807('0x3b')][_0xc807('0x3e')]?_0x37dd8b[_0xc807('0x3b')]:_0x165013[_0xc807('0x3c')];if(!_0x3adf9f[_0xc807('0x37')][_0xc807('0x3f')](_0xc807('0x40'))){_0x37dd8b[_0xc807('0x21')]=qs[_0xc807('0x21')](_0x3adf9f[_0xc807('0x37')][_0xc807('0x21')]);_0x37dd8b['offset']=qs[_0xc807('0x1f')](_0x3adf9f['query'][_0xc807('0x1f')]);}_0x37dd8b[_0xc807('0x41')]=qs[_0xc807('0x42')](_0x3adf9f[_0xc807('0x37')][_0xc807('0x42')]);_0x37dd8b[_0xc807('0x43')]=qs[_0xc807('0x39')](_['pick'](_0x3adf9f[_0xc807('0x37')],_0x165013[_0xc807('0x39')]),_0x1f882f);if(_0x3adf9f[_0xc807('0x37')][_0xc807('0x44')]){_0x37dd8b['where']=_[_0xc807('0x45')](_0x37dd8b[_0xc807('0x43')],{'$or':_['map'](_0x1f882f,function(_0x34a55f){if(_0x34a55f[_0xc807('0x34')]!==_0xc807('0x46')){var _0x370f23={};_0x370f23[_0x34a55f['name']]={'$like':'%'+_0x3adf9f[_0xc807('0x37')][_0xc807('0x44')]+'%'};return _0x370f23;}})});}_0x37dd8b=_[_0xc807('0x45')]({},_0x37dd8b,_0x3adf9f[_0xc807('0x47')]);var _0x36773d={'where':_0x37dd8b[_0xc807('0x43')]};return db['Interval'][_0xc807('0x22')](_0x36773d)[_0xc807('0x28')](function(_0xdc0c90){_0x4c2aab['count']=_0xdc0c90;if(_0x3adf9f[_0xc807('0x37')][_0xc807('0x48')]){_0x37dd8b['include']=[{'all':!![]}];}return db[_0xc807('0x32')][_0xc807('0x49')](_0x37dd8b);})['then'](function(_0x25b794){_0x4c2aab[_0xc807('0x4a')]=_0x25b794;return _0x4c2aab;})[_0xc807('0x28')](respondWithFilteredResult(_0x170bda,_0x37dd8b))['catch'](handleError(_0x170bda,null));};exports[_0xc807('0x4b')]=function(_0x1c1a41,_0x56e61b){var _0xa0a0={'raw':!![],'where':{'id':_0x1c1a41['params']['id']}},_0x14ea35={};_0x14ea35[_0xc807('0x3c')]=_['keys'](db[_0xc807('0x32')][_0xc807('0x33')]);_0x14ea35[_0xc807('0x37')]=_[_0xc807('0x38')](_0x1c1a41[_0xc807('0x37')]);_0x14ea35[_0xc807('0x39')]=_[_0xc807('0x3a')](_0x14ea35[_0xc807('0x3c')],_0x14ea35[_0xc807('0x37')]);_0xa0a0['attributes']=_[_0xc807('0x3a')](_0x14ea35[_0xc807('0x3c')],qs[_0xc807('0x3d')](_0x1c1a41[_0xc807('0x37')][_0xc807('0x3d')]));_0xa0a0[_0xc807('0x3b')]=_0xa0a0[_0xc807('0x3b')]['length']?_0xa0a0[_0xc807('0x3b')]:_0x14ea35[_0xc807('0x3c')];if(_0x1c1a41[_0xc807('0x37')][_0xc807('0x48')]){_0xa0a0[_0xc807('0x4c')]=[{'all':!![]}];}_0xa0a0=_[_0xc807('0x45')]({},_0xa0a0,_0x1c1a41[_0xc807('0x47')]);return db[_0xc807('0x32')][_0xc807('0x4d')](_0xa0a0)[_0xc807('0x28')](handleEntityNotFound(_0x56e61b,null))[_0xc807('0x28')](respondWithResult(_0x56e61b,null))[_0xc807('0x4e')](handleError(_0x56e61b,null));};exports['create']=function(_0x14c968,_0x49cb00){return db[_0xc807('0x32')][_0xc807('0x4f')](_0x14c968[_0xc807('0x50')],{})[_0xc807('0x28')](function(_0x3bc152){var _0x5d0117=_0x14c968[_0xc807('0x51')][_0xc807('0x2a')]({'plain':!![]});if(!_0x5d0117)throw new Error(_0xc807('0x52'));if(_0x5d0117[_0xc807('0x53')]===_0xc807('0x51')){var _0x1bd4e6=_0x3bc152['get']({'plain':!![]});var _0x4e5f10=_0xc807('0x2b');return db[_0xc807('0x54')][_0xc807('0x4d')]({'where':{'name':_0x4e5f10,'userProfileId':_0x5d0117[_0xc807('0x55')]},'raw':!![]})[_0xc807('0x28')](function(_0x2e859d){if(_0x2e859d&&_0x2e859d[_0xc807('0x56')]===0x0){return db['UserProfileResource'][_0xc807('0x4f')]({'name':_0x1bd4e6['name'],'resourceId':_0x1bd4e6['id'],'type':_0x2e859d[_0xc807('0x2f')],'sectionId':_0x2e859d['id']},{})[_0xc807('0x28')](function(){return _0x3bc152;});}else{return _0x3bc152;}})[_0xc807('0x4e')](function(_0x559f1a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x559f1a);throw _0x559f1a;});}return _0x3bc152;})[_0xc807('0x28')](respondWithResult(_0x49cb00,0xc9))[_0xc807('0x4e')](handleError(_0x49cb00,null));};exports['update']=function(_0x3e795d,_0x3b7459){if(_0x3e795d[_0xc807('0x50')]['id']){delete _0x3e795d[_0xc807('0x50')]['id'];}return db[_0xc807('0x32')][_0xc807('0x4d')]({'where':{'id':_0x3e795d[_0xc807('0x57')]['id']}})['then'](handleEntityNotFound(_0x3b7459,null))['then'](saveUpdates(_0x3e795d[_0xc807('0x50')],null))['then'](respondWithResult(_0x3b7459,null))['catch'](handleError(_0x3b7459,null));};exports[_0xc807('0x29')]=function(_0x3d0837,_0x4880c6){return db['Interval'][_0xc807('0x4d')]({'where':{'id':_0x3d0837['params']['id']}})[_0xc807('0x28')](handleEntityNotFound(_0x4880c6,null))[_0xc807('0x28')](removeEntity(_0x4880c6,null))[_0xc807('0x4e')](handleError(_0x4880c6,null));};exports[_0xc807('0x58')]=function(_0x2696dd,_0x58e12f,_0x1bf921){if(_0x2696dd[_0xc807('0x50')]['id']){delete _0x2696dd[_0xc807('0x50')]['id'];}return db[_0xc807('0x32')][_0xc807('0x4d')]({'where':{'id':_0x2696dd[_0xc807('0x57')]['id']}})[_0xc807('0x28')](handleEntityNotFound(_0x58e12f,null))[_0xc807('0x28')](function(_0x4c2066){if(_0x4c2066){_0x2696dd[_0xc807('0x50')][_0xc807('0x59')]=_0x4c2066['id'];return db[_0xc807('0x32')]['create'](_0x2696dd[_0xc807('0x50')]);}})[_0xc807('0x28')](respondWithResult(_0x58e12f,null))[_0xc807('0x4e')](handleError(_0x58e12f,null));};exports[_0xc807('0x5a')]=function(_0x3ddc1b,_0x288811,_0x52b85e){var _0x5bfc48={};var _0x40b7b2={};var _0x47543b;var _0x4f8f01;return db[_0xc807('0x32')][_0xc807('0x5b')]({'where':{'id':_0x3ddc1b[_0xc807('0x57')]['id']}})[_0xc807('0x28')](handleEntityNotFound(_0x288811,null))['then'](function(_0x353d54){if(_0x353d54){_0x47543b=_0x353d54;_0x40b7b2['model']=_[_0xc807('0x38')](db[_0xc807('0x32')][_0xc807('0x33')]);_0x40b7b2[_0xc807('0x37')]=_['keys'](_0x3ddc1b[_0xc807('0x37')]);_0x40b7b2[_0xc807('0x39')]=_['intersection'](_0x40b7b2[_0xc807('0x3c')],_0x40b7b2[_0xc807('0x37')]);_0x5bfc48[_0xc807('0x3b')]=_['intersection'](_0x40b7b2[_0xc807('0x3c')],qs[_0xc807('0x3d')](_0x3ddc1b['query'][_0xc807('0x3d')]));_0x5bfc48['attributes']=_0x5bfc48['attributes']['length']?_0x5bfc48['attributes']:_0x40b7b2[_0xc807('0x3c')];_0x5bfc48[_0xc807('0x41')]=qs[_0xc807('0x42')](_0x3ddc1b['query'][_0xc807('0x42')]);_0x5bfc48['where']=qs[_0xc807('0x39')](_[_0xc807('0x5c')](_0x3ddc1b['query'],_0x40b7b2['filters']));if(_0x3ddc1b[_0xc807('0x37')][_0xc807('0x44')]){_0x5bfc48[_0xc807('0x43')]=_['merge'](_0x5bfc48[_0xc807('0x43')],{'$or':_[_0xc807('0x36')](_0x5bfc48[_0xc807('0x3b')],function(_0x479259){var _0x49c8c9={};_0x49c8c9[_0x479259]={'$like':'%'+_0x3ddc1b[_0xc807('0x37')][_0xc807('0x44')]+'%'};return _0x49c8c9;})});}_0x5bfc48=_[_0xc807('0x45')]({},_0x5bfc48,_0x3ddc1b[_0xc807('0x47')]);return _0x47543b[_0xc807('0x5a')](_0x5bfc48);}})[_0xc807('0x28')](function(_0x243b18){if(_0x243b18){_0x4f8f01=_0x243b18['length'];if(!_0x3ddc1b[_0xc807('0x37')][_0xc807('0x3f')](_0xc807('0x40'))){_0x5bfc48[_0xc807('0x21')]=qs[_0xc807('0x21')](_0x3ddc1b[_0xc807('0x37')][_0xc807('0x21')]);_0x5bfc48[_0xc807('0x1f')]=qs[_0xc807('0x1f')](_0x3ddc1b['query'][_0xc807('0x1f')]);}return _0x47543b[_0xc807('0x5a')](_0x5bfc48);}})['then'](function(_0x2d8258){if(_0x2d8258){return _0x2d8258?{'count':_0x4f8f01,'rows':_0x2d8258}:null;}})[_0xc807('0x28')](respondWithResult(_0x288811,null))[_0xc807('0x4e')](handleError(_0x288811,null));};exports[_0xc807('0x5d')]=function(_0x47df49,_0x2d5794,_0x3fbcb9){return db[_0xc807('0x32')]['findOne']({'where':{'id':_0x47df49['params']['id']}})[_0xc807('0x28')](handleEntityNotFound(_0x2d5794,null))['then'](function(_0x3defda){if(_0x3defda){return db[_0xc807('0x5e')]['transaction'](function(_0x1f6442){return db[_0xc807('0x32')][_0xc807('0x29')]({'where':{'IntervalId':_0x47df49[_0xc807('0x57')]['id']},'transaction':_0x1f6442})[_0xc807('0x28')](function(_0x3df8f7){var _0x343b23=_['map'](_0x47df49[_0xc807('0x50')],function(_0x5f3f12){delete _0x5f3f12['id'];_0x5f3f12['IntervalId']=_0x47df49[_0xc807('0x57')]['id'];return _0x5f3f12;});return db['Interval'][_0xc807('0x5f')](_0x343b23,{'transaction':_0x1f6442});});})[_0xc807('0x28')](function(){return db[_0xc807('0x32')][_0xc807('0x49')]({'where':{'IntervalId':_0x47df49['params']['id']}});});}})[_0xc807('0x28')](respondWithResult(_0x2d5794,null))['catch'](handleError(_0x2d5794,null));}; \ No newline at end of file +var _0xade4=['reject','destroy','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addInterval','IntervalId','getIntervals','findOne','length','pick','sequelize','transaction','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x1e7935,_0x3bb652){var _0x3eb2aa=function(_0x665b78){while(--_0x665b78){_0x1e7935['push'](_0x1e7935['shift']());}};_0x3eb2aa(++_0x3bb652);}(_0xade4,0x15e));var _0x4ade=function(_0x4c2df6,_0xb5a887){_0x4c2df6=_0x4c2df6-0x0;var _0x129ced=_0xade4[_0x4c2df6];return _0x129ced;};'use strict';var emlformat=require(_0x4ade('0x0'));var rimraf=require(_0x4ade('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4ade('0x2'));var rp=require(_0x4ade('0x3'));var moment=require(_0x4ade('0x4'));var BPromise=require(_0x4ade('0x5'));var Mustache=require(_0x4ade('0x6'));var util=require(_0x4ade('0x7'));var path=require(_0x4ade('0x8'));var sox=require(_0x4ade('0x9'));var csv=require('to-csv');var ejs=require(_0x4ade('0xa'));var fs=require('fs');var fs_extra=require(_0x4ade('0xb'));var _=require(_0x4ade('0xc'));var squel=require(_0x4ade('0xd'));var crypto=require('crypto');var jsforce=require(_0x4ade('0xe'));var deskjs=require(_0x4ade('0xf'));var toCsv=require(_0x4ade('0x10'));var querystring=require(_0x4ade('0x11'));var Papa=require(_0x4ade('0x12'));var Redis=require(_0x4ade('0x13'));var authService=require(_0x4ade('0x14'));var qs=require(_0x4ade('0x15'));var as=require(_0x4ade('0x16'));var hardwareService=require(_0x4ade('0x17'));var logger=require(_0x4ade('0x18'))(_0x4ade('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4ade('0x1a'));var db=require(_0x4ade('0x1b'))['db'];var extensions=require(_0x4ade('0x1c'));function respondWithStatusCode(_0x3117d0,_0x17eac1){_0x17eac1=_0x17eac1||0xcc;return function(_0x27a073){if(_0x27a073){return _0x3117d0['sendStatus'](_0x17eac1);}return _0x3117d0[_0x4ade('0x1d')](_0x17eac1)[_0x4ade('0x1e')]();};}function respondWithResult(_0x5f4425,_0x524377){_0x524377=_0x524377||0xc8;return function(_0x3c8b7e){if(_0x3c8b7e){return _0x5f4425[_0x4ade('0x1d')](_0x524377)[_0x4ade('0x1f')](_0x3c8b7e);}};}function respondWithFilteredResult(_0x253e67,_0x3a1969){return function(_0x547376){if(_0x547376){var _0x2f7af2=typeof _0x3a1969['offset']===_0x4ade('0x20')&&typeof _0x3a1969[_0x4ade('0x21')]===_0x4ade('0x20');var _0xee7a5d=_0x547376[_0x4ade('0x22')];var _0x3405c5=_0x2f7af2?0x0:_0x3a1969['offset'];var _0x180e7f=_0x2f7af2?_0x547376['count']:_0x3a1969[_0x4ade('0x23')]+_0x3a1969[_0x4ade('0x21')];var _0x32551c;if(_0x180e7f>=_0xee7a5d){_0x180e7f=_0xee7a5d;_0x32551c=0xc8;}else{_0x32551c=0xce;}_0x253e67[_0x4ade('0x1d')](_0x32551c);return _0x253e67[_0x4ade('0x24')](_0x4ade('0x25'),_0x3405c5+'-'+_0x180e7f+'/'+_0xee7a5d)[_0x4ade('0x1f')](_0x547376);}return null;};}function patchUpdates(_0x2f6e90){return function(_0x1486f6){try{jsonpatch['apply'](_0x1486f6,_0x2f6e90,!![]);}catch(_0x122cd5){return BPromise[_0x4ade('0x26')](_0x122cd5);}return _0x1486f6['save']();};}function saveUpdates(_0x115602,_0x29e1fa){return function(_0x5f49fc){if(_0x5f49fc){return _0x5f49fc['update'](_0x115602)['then'](function(_0x4385ba){return _0x4385ba;});}return null;};}function removeEntity(_0x5efe00,_0x263538){return function(_0x40668d){if(_0x40668d){return _0x40668d[_0x4ade('0x27')]()[_0x4ade('0x28')](function(){var _0x5bf7f8=_0x40668d[_0x4ade('0x29')]({'plain':!![]});var _0x2338d5=_0x4ade('0x2a');return db[_0x4ade('0x2b')]['destroy']({'where':{'type':_0x2338d5,'resourceId':_0x5bf7f8['id']}})[_0x4ade('0x28')](function(){return _0x40668d;});})[_0x4ade('0x28')](function(){_0x5efe00[_0x4ade('0x1d')](0xcc)[_0x4ade('0x1e')]();});}};}function handleEntityNotFound(_0x15d4f9,_0x362271){return function(_0x85093f){if(!_0x85093f){_0x15d4f9[_0x4ade('0x2c')](0x194);}return _0x85093f;};}function handleError(_0x23b230,_0x234df9){_0x234df9=_0x234df9||0x1f4;return function(_0x231053){logger[_0x4ade('0x2d')](_0x231053[_0x4ade('0x2e')]);if(_0x231053[_0x4ade('0x2f')]){delete _0x231053[_0x4ade('0x2f')];}_0x23b230['status'](_0x234df9)[_0x4ade('0x30')](_0x231053);};}exports[_0x4ade('0x31')]=function(_0x476826,_0x250420){var _0x1dda5a={},_0x205d1a={},_0x34cdc4={'count':0x0,'rows':[]};var _0x386cae=_[_0x4ade('0x32')](db[_0x4ade('0x33')][_0x4ade('0x34')],function(_0x55d709){return{'name':_0x55d709[_0x4ade('0x35')],'type':_0x55d709['type'][_0x4ade('0x36')]};});_0x205d1a[_0x4ade('0x37')]=_['map'](_0x386cae,_0x4ade('0x2f'));_0x205d1a[_0x4ade('0x38')]=_[_0x4ade('0x39')](_0x476826['query']);_0x205d1a[_0x4ade('0x3a')]=_[_0x4ade('0x3b')](_0x205d1a[_0x4ade('0x37')],_0x205d1a[_0x4ade('0x38')]);_0x1dda5a[_0x4ade('0x3c')]=_[_0x4ade('0x3b')](_0x205d1a[_0x4ade('0x37')],qs[_0x4ade('0x3d')](_0x476826['query']['fields']));_0x1dda5a['attributes']=_0x1dda5a[_0x4ade('0x3c')]['length']?_0x1dda5a[_0x4ade('0x3c')]:_0x205d1a['model'];if(!_0x476826[_0x4ade('0x38')][_0x4ade('0x3e')](_0x4ade('0x3f'))){_0x1dda5a['limit']=qs[_0x4ade('0x21')](_0x476826[_0x4ade('0x38')][_0x4ade('0x21')]);_0x1dda5a[_0x4ade('0x23')]=qs[_0x4ade('0x23')](_0x476826[_0x4ade('0x38')][_0x4ade('0x23')]);}_0x1dda5a[_0x4ade('0x40')]=qs['sort'](_0x476826[_0x4ade('0x38')][_0x4ade('0x41')]);_0x1dda5a[_0x4ade('0x42')]=qs[_0x4ade('0x3a')](_['pick'](_0x476826[_0x4ade('0x38')],_0x205d1a['filters']),_0x386cae);if(_0x476826[_0x4ade('0x38')]['filter']){_0x1dda5a[_0x4ade('0x42')]=_[_0x4ade('0x43')](_0x1dda5a[_0x4ade('0x42')],{'$or':_[_0x4ade('0x32')](_0x386cae,function(_0x2f8da9){if(_0x2f8da9[_0x4ade('0x44')]!==_0x4ade('0x45')){var _0x379b26={};_0x379b26[_0x2f8da9[_0x4ade('0x2f')]]={'$like':'%'+_0x476826['query'][_0x4ade('0x46')]+'%'};return _0x379b26;}})});}_0x1dda5a=_[_0x4ade('0x43')]({},_0x1dda5a,_0x476826[_0x4ade('0x47')]);var _0x187cba={'where':_0x1dda5a[_0x4ade('0x42')]};return db[_0x4ade('0x33')][_0x4ade('0x22')](_0x187cba)[_0x4ade('0x28')](function(_0x549675){_0x34cdc4[_0x4ade('0x22')]=_0x549675;if(_0x476826[_0x4ade('0x38')][_0x4ade('0x48')]){_0x1dda5a[_0x4ade('0x49')]=[{'all':!![]}];}return db[_0x4ade('0x33')][_0x4ade('0x4a')](_0x1dda5a);})[_0x4ade('0x28')](function(_0x3afa4b){_0x34cdc4[_0x4ade('0x4b')]=_0x3afa4b;return _0x34cdc4;})[_0x4ade('0x28')](respondWithFilteredResult(_0x250420,_0x1dda5a))[_0x4ade('0x4c')](handleError(_0x250420,null));};exports[_0x4ade('0x4d')]=function(_0x1d0d5a,_0x2b61d4){var _0x14c60c={'raw':!![],'where':{'id':_0x1d0d5a['params']['id']}},_0x1e17fb={};_0x1e17fb['model']=_[_0x4ade('0x39')](db[_0x4ade('0x33')][_0x4ade('0x34')]);_0x1e17fb['query']=_[_0x4ade('0x39')](_0x1d0d5a['query']);_0x1e17fb[_0x4ade('0x3a')]=_[_0x4ade('0x3b')](_0x1e17fb['model'],_0x1e17fb['query']);_0x14c60c[_0x4ade('0x3c')]=_[_0x4ade('0x3b')](_0x1e17fb[_0x4ade('0x37')],qs['fields'](_0x1d0d5a[_0x4ade('0x38')][_0x4ade('0x3d')]));_0x14c60c[_0x4ade('0x3c')]=_0x14c60c[_0x4ade('0x3c')]['length']?_0x14c60c[_0x4ade('0x3c')]:_0x1e17fb[_0x4ade('0x37')];if(_0x1d0d5a[_0x4ade('0x38')][_0x4ade('0x48')]){_0x14c60c['include']=[{'all':!![]}];}_0x14c60c=_[_0x4ade('0x43')]({},_0x14c60c,_0x1d0d5a[_0x4ade('0x47')]);return db[_0x4ade('0x33')][_0x4ade('0x4e')](_0x14c60c)[_0x4ade('0x28')](handleEntityNotFound(_0x2b61d4,null))['then'](respondWithResult(_0x2b61d4,null))['catch'](handleError(_0x2b61d4,null));};exports[_0x4ade('0x4f')]=function(_0x4b24ac,_0x4a217b){return db[_0x4ade('0x33')]['create'](_0x4b24ac[_0x4ade('0x50')],{})[_0x4ade('0x28')](function(_0x1346b3){var _0x4ad0b8=_0x4b24ac[_0x4ade('0x51')][_0x4ade('0x29')]({'plain':!![]});if(!_0x4ad0b8)throw new Error(_0x4ade('0x52'));if(_0x4ad0b8['role']===_0x4ade('0x51')){var _0x21a6c6=_0x1346b3[_0x4ade('0x29')]({'plain':!![]});var _0x46f25f=_0x4ade('0x2a');return db[_0x4ade('0x53')][_0x4ade('0x4e')]({'where':{'name':_0x46f25f,'userProfileId':_0x4ad0b8[_0x4ade('0x54')]},'raw':!![]})[_0x4ade('0x28')](function(_0x54b6f4){if(_0x54b6f4&&_0x54b6f4[_0x4ade('0x55')]===0x0){return db['UserProfileResource'][_0x4ade('0x4f')]({'name':_0x21a6c6['name'],'resourceId':_0x21a6c6['id'],'type':_0x54b6f4['name'],'sectionId':_0x54b6f4['id']},{})[_0x4ade('0x28')](function(){return _0x1346b3;});}else{return _0x1346b3;}})[_0x4ade('0x4c')](function(_0x387b56){logger[_0x4ade('0x2d')](_0x4ade('0x56'),_0x387b56);throw _0x387b56;});}return _0x1346b3;})[_0x4ade('0x28')](respondWithResult(_0x4a217b,0xc9))['catch'](handleError(_0x4a217b,null));};exports[_0x4ade('0x57')]=function(_0x18377a,_0x163d19){if(_0x18377a[_0x4ade('0x50')]['id']){delete _0x18377a[_0x4ade('0x50')]['id'];}return db['Interval'][_0x4ade('0x4e')]({'where':{'id':_0x18377a[_0x4ade('0x58')]['id']}})[_0x4ade('0x28')](handleEntityNotFound(_0x163d19,null))[_0x4ade('0x28')](saveUpdates(_0x18377a[_0x4ade('0x50')],null))[_0x4ade('0x28')](respondWithResult(_0x163d19,null))[_0x4ade('0x4c')](handleError(_0x163d19,null));};exports[_0x4ade('0x27')]=function(_0x5bdacb,_0x588192){return db[_0x4ade('0x33')]['find']({'where':{'id':_0x5bdacb[_0x4ade('0x58')]['id']}})[_0x4ade('0x28')](handleEntityNotFound(_0x588192,null))[_0x4ade('0x28')](removeEntity(_0x588192,null))[_0x4ade('0x4c')](handleError(_0x588192,null));};exports[_0x4ade('0x59')]=function(_0x11356d,_0x10bd69,_0x3ed738){if(_0x11356d[_0x4ade('0x50')]['id']){delete _0x11356d[_0x4ade('0x50')]['id'];}return db[_0x4ade('0x33')]['find']({'where':{'id':_0x11356d[_0x4ade('0x58')]['id']}})[_0x4ade('0x28')](handleEntityNotFound(_0x10bd69,null))[_0x4ade('0x28')](function(_0x2ebed5){if(_0x2ebed5){_0x11356d['body'][_0x4ade('0x5a')]=_0x2ebed5['id'];return db[_0x4ade('0x33')][_0x4ade('0x4f')](_0x11356d['body']);}})[_0x4ade('0x28')](respondWithResult(_0x10bd69,null))['catch'](handleError(_0x10bd69,null));};exports[_0x4ade('0x5b')]=function(_0x6dca88,_0x55becf,_0x5ba45b){var _0x4c72da={};var _0x591a99={};var _0x1dd09c;var _0x5c6563;return db['Interval'][_0x4ade('0x5c')]({'where':{'id':_0x6dca88[_0x4ade('0x58')]['id']}})[_0x4ade('0x28')](handleEntityNotFound(_0x55becf,null))[_0x4ade('0x28')](function(_0x15f1e5){if(_0x15f1e5){_0x1dd09c=_0x15f1e5;_0x591a99['model']=_[_0x4ade('0x39')](db[_0x4ade('0x33')][_0x4ade('0x34')]);_0x591a99[_0x4ade('0x38')]=_[_0x4ade('0x39')](_0x6dca88[_0x4ade('0x38')]);_0x591a99[_0x4ade('0x3a')]=_['intersection'](_0x591a99[_0x4ade('0x37')],_0x591a99[_0x4ade('0x38')]);_0x4c72da['attributes']=_[_0x4ade('0x3b')](_0x591a99[_0x4ade('0x37')],qs[_0x4ade('0x3d')](_0x6dca88[_0x4ade('0x38')][_0x4ade('0x3d')]));_0x4c72da[_0x4ade('0x3c')]=_0x4c72da[_0x4ade('0x3c')][_0x4ade('0x5d')]?_0x4c72da[_0x4ade('0x3c')]:_0x591a99[_0x4ade('0x37')];_0x4c72da[_0x4ade('0x40')]=qs[_0x4ade('0x41')](_0x6dca88[_0x4ade('0x38')][_0x4ade('0x41')]);_0x4c72da[_0x4ade('0x42')]=qs[_0x4ade('0x3a')](_[_0x4ade('0x5e')](_0x6dca88[_0x4ade('0x38')],_0x591a99[_0x4ade('0x3a')]));if(_0x6dca88['query'][_0x4ade('0x46')]){_0x4c72da[_0x4ade('0x42')]=_[_0x4ade('0x43')](_0x4c72da['where'],{'$or':_[_0x4ade('0x32')](_0x4c72da[_0x4ade('0x3c')],function(_0x4b3377){var _0xf9d46a={};_0xf9d46a[_0x4b3377]={'$like':'%'+_0x6dca88['query'][_0x4ade('0x46')]+'%'};return _0xf9d46a;})});}_0x4c72da=_[_0x4ade('0x43')]({},_0x4c72da,_0x6dca88[_0x4ade('0x47')]);return _0x1dd09c[_0x4ade('0x5b')](_0x4c72da);}})['then'](function(_0x7d44f7){if(_0x7d44f7){_0x5c6563=_0x7d44f7[_0x4ade('0x5d')];if(!_0x6dca88[_0x4ade('0x38')][_0x4ade('0x3e')](_0x4ade('0x3f'))){_0x4c72da['limit']=qs[_0x4ade('0x21')](_0x6dca88['query'][_0x4ade('0x21')]);_0x4c72da[_0x4ade('0x23')]=qs[_0x4ade('0x23')](_0x6dca88['query'][_0x4ade('0x23')]);}return _0x1dd09c[_0x4ade('0x5b')](_0x4c72da);}})[_0x4ade('0x28')](function(_0x26458f){if(_0x26458f){return _0x26458f?{'count':_0x5c6563,'rows':_0x26458f}:null;}})['then'](respondWithResult(_0x55becf,null))[_0x4ade('0x4c')](handleError(_0x55becf,null));};exports['addIntervals']=function(_0x145b7e,_0x7915f0,_0x4d6a84){return db[_0x4ade('0x33')][_0x4ade('0x5c')]({'where':{'id':_0x145b7e['params']['id']}})[_0x4ade('0x28')](handleEntityNotFound(_0x7915f0,null))['then'](function(_0x5f47b7){if(_0x5f47b7){return db[_0x4ade('0x5f')][_0x4ade('0x60')](function(_0x3a145a){return db['Interval']['destroy']({'where':{'IntervalId':_0x145b7e[_0x4ade('0x58')]['id']},'transaction':_0x3a145a})[_0x4ade('0x28')](function(_0x4ec3de){var _0x39f2f0=_[_0x4ade('0x32')](_0x145b7e[_0x4ade('0x50')],function(_0x2d4231){delete _0x2d4231['id'];_0x2d4231[_0x4ade('0x5a')]=_0x145b7e[_0x4ade('0x58')]['id'];return _0x2d4231;});return db[_0x4ade('0x33')]['bulkCreate'](_0x39f2f0,{'transaction':_0x3a145a});});})[_0x4ade('0x28')](function(){return db[_0x4ade('0x33')][_0x4ade('0x4a')]({'where':{'IntervalId':_0x145b7e[_0x4ade('0x58')]['id']}});});}})['then'](respondWithResult(_0x7915f0,null))[_0x4ade('0x4c')](handleError(_0x7915f0,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index f50507b..24a3b9d 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 _0x1309=['then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','all','map','ifTime'];(function(_0x226251,_0x8bf103){var _0x217c24=function(_0x7f8e0f){while(--_0x7f8e0f){_0x226251['push'](_0x226251['shift']());}};_0x217c24(++_0x8bf103);}(_0x1309,0x172));var _0x9130=function(_0x96e224,_0x111076){_0x96e224=_0x96e224-0x0;var _0x79a9c9=_0x1309[_0x96e224];return _0x79a9c9;};'use strict';var attributes=require(_0x9130('0x0'));var extensions=require(_0x9130('0x1'));var iftime=require(_0x9130('0x2'))['iftime'];module[_0x9130('0x3')]=function(_0x55ad59){return _0x55ad59[_0x9130('0x4')](_0x9130('0x5'),attributes,{'tableName':_0x9130('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3f7143){extensions['rewrite'](_0x55ad59,_0x3f7143);},'afterBulkCreate':function(_0x1ab990,_0x36791d,_0x5495f1){_0x5495f1();extensions[_0x9130('0x7')](_0x55ad59,_0x1ab990[0x0]);},'afterUpdate':function(_0x56586c){extensions['rewrite'](_0x55ad59,_0x56586c);},'afterDestroy':function(_0x2825b3){extensions[_0x9130('0x7')](_0x55ad59,_0x2825b3);}},'instanceMethods':{'ifTime':function(_0xeaeb0a=undefined,_0x35121a=new Date()){if(typeof this[_0x9130('0x8')]===_0x9130('0x9')){return iftime(this[_0x9130('0x8')],_0xeaeb0a,_0x35121a);}else{return this[_0x9130('0xa')]()['then'](function(_0x9fe096){return Promise[_0x9130('0xb')](_0x9fe096[_0x9130('0xc')](function(_0x30b25a){return _0x30b25a[_0x9130('0xd')](_0xeaeb0a,_0x35121a);}));})[_0x9130('0xe')](function(_0x27d9fe){return _0x27d9fe[_0x9130('0xf')](function(_0x2df63e,_0x77e4a4){return _0x2df63e||_0x77e4a4;},![]);});}}}});}; \ No newline at end of file +var _0x1fd5=['../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','rewrite','interval','string','getIntervals','then','map','ifTime','reduce','./interval.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1fd5,0x176));var _0x51fd=function(_0xe619be,_0x5ab7d2){_0xe619be=_0xe619be-0x0;var _0x7f3bc5=_0x1fd5[_0xe619be];return _0x7f3bc5;};'use strict';var attributes=require(_0x51fd('0x0'));var extensions=require(_0x51fd('0x1'));var iftime=require(_0x51fd('0x2'))[_0x51fd('0x3')];module[_0x51fd('0x4')]=function(_0x3a759f){return _0x3a759f[_0x51fd('0x5')](_0x51fd('0x6'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f4e8f){extensions['rewrite'](_0x3a759f,_0x4f4e8f);},'afterBulkCreate':function(_0x2ad93e,_0x274f48,_0x2ed609){_0x2ed609();extensions['rewrite'](_0x3a759f,_0x2ad93e[0x0]);},'afterUpdate':function(_0x21ce56){extensions['rewrite'](_0x3a759f,_0x21ce56);},'afterDestroy':function(_0x1abd2d){extensions[_0x51fd('0x7')](_0x3a759f,_0x1abd2d);}},'instanceMethods':{'ifTime':function(_0x2689b3=undefined,_0x437ff7=new Date()){if(typeof this[_0x51fd('0x8')]===_0x51fd('0x9')){return iftime(this[_0x51fd('0x8')],_0x2689b3,_0x437ff7);}else{return this[_0x51fd('0xa')]()[_0x51fd('0xb')](function(_0x3a830f){return Promise['all'](_0x3a830f[_0x51fd('0xc')](function(_0x4b5465){return _0x4b5465[_0x51fd('0xd')](_0x2689b3,_0x437ff7);}));})[_0x51fd('0xb')](function(_0x2d27e1){return _0x2d27e1[_0x51fd('0xe')](function(_0x1f616c,_0x1e05b1){return _0x1f616c||_0x1e05b1;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 7f123d5..6b4e1b0 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 _0xfe76=['../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowInterval','Interval','find','stringify','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','ifTime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','IntervalIftime','lodash','util','../../mysqldb'];(function(_0x17a3f0,_0x4266a1){var _0x4b5d61=function(_0x1bee11){while(--_0x1bee11){_0x17a3f0['push'](_0x17a3f0['shift']());}};_0x4b5d61(++_0x4266a1);}(_0xfe76,0x1b5));var _0x6fe7=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0xfe76[_0x33bc64];return _0x3fdd34;};'use strict';var _=require(_0x6fe7('0x0'));var util=require(_0x6fe7('0x1'));var db=require(_0x6fe7('0x2'))['db'];var iftime=require(_0x6fe7('0x3'))[_0x6fe7('0x4')];var logger=require(_0x6fe7('0x5'))(_0x6fe7('0x6'));exports[_0x6fe7('0x7')]=function(_0x49f862){var _0x1e4b05=this;return new Promise(function(_0x42eec4,_0x28e220){return db['Interval'][_0x6fe7('0x8')]({'raw':_0x49f862[_0x6fe7('0x9')]?_0x49f862['options'][_0x6fe7('0xa')]===undefined?!![]:![]:!![],'where':_0x49f862[_0x6fe7('0x9')]?_0x49f862[_0x6fe7('0x9')][_0x6fe7('0xb')]||null:null,'attributes':_0x49f862[_0x6fe7('0x9')]?_0x49f862['options'][_0x6fe7('0xc')]||null:null,'limit':_0x49f862[_0x6fe7('0x9')]?_0x49f862[_0x6fe7('0x9')][_0x6fe7('0xd')]||null:null,'include':_0x49f862[_0x6fe7('0x9')]?_0x49f862[_0x6fe7('0x9')][_0x6fe7('0xe')]?_[_0x6fe7('0xf')](_0x49f862['options'][_0x6fe7('0xe')],function(_0x29f830){return{'model':db[_0x29f830[_0x6fe7('0x10')]],'as':_0x29f830['as'],'attributes':_0x29f830[_0x6fe7('0xc')],'include':_0x29f830[_0x6fe7('0xe')]?_[_0x6fe7('0xf')](_0x29f830[_0x6fe7('0xe')],function(_0x57388f){return{'model':db[_0x57388f[_0x6fe7('0x10')]],'as':_0x57388f['as'],'attributes':_0x57388f[_0x6fe7('0xc')],'include':_0x57388f[_0x6fe7('0xe')]?_[_0x6fe7('0xf')](_0x57388f[_0x6fe7('0xe')],function(_0xa342da){return{'model':db[_0xa342da[_0x6fe7('0x10')]],'as':_0xa342da['as'],'attributes':_0xa342da[_0x6fe7('0xc')]};}):[]};}):[]};}):[]:[]})[_0x6fe7('0x11')](function(_0xcff013){logger[_0x6fe7('0x12')]('GetInterval',_0x49f862);logger[_0x6fe7('0x13')](_0x6fe7('0x7'),_0x49f862,JSON['stringify'](_0xcff013));_0x42eec4(_0xcff013);})[_0x6fe7('0x14')](function(_0x93c683){logger[_0x6fe7('0x15')](_0x6fe7('0x7'),_0x93c683[_0x6fe7('0x16')],_0x49f862);_0x28e220(_0x1e4b05['error'](0x1f4,_0x93c683[_0x6fe7('0x16')]));});});};exports[_0x6fe7('0x17')]=function(_0x3a179f){var _0x4b310e=this;return new Promise(function(_0x272d15,_0x22f607){return db[_0x6fe7('0x18')][_0x6fe7('0x19')]({'raw':_0x3a179f[_0x6fe7('0x9')]?_0x3a179f['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a179f[_0x6fe7('0x9')]?_0x3a179f[_0x6fe7('0x9')][_0x6fe7('0xb')]||null:null,'attributes':_0x3a179f[_0x6fe7('0x9')]?_0x3a179f[_0x6fe7('0x9')]['attributes']||null:null,'include':_0x3a179f[_0x6fe7('0x9')]?_0x3a179f[_0x6fe7('0x9')][_0x6fe7('0xe')]?_['map'](_0x3a179f[_0x6fe7('0x9')][_0x6fe7('0xe')],function(_0x31be25){return{'model':db[_0x31be25[_0x6fe7('0x10')]],'as':_0x31be25['as'],'attributes':_0x31be25['attributes'],'include':_0x31be25[_0x6fe7('0xe')]?_[_0x6fe7('0xf')](_0x31be25[_0x6fe7('0xe')],function(_0x3f422d){return{'model':db[_0x3f422d[_0x6fe7('0x10')]],'as':_0x3f422d['as'],'attributes':_0x3f422d[_0x6fe7('0xc')],'include':_0x3f422d[_0x6fe7('0xe')]?_[_0x6fe7('0xf')](_0x3f422d['include'],function(_0xf9bafa){return{'model':db[_0xf9bafa[_0x6fe7('0x10')]],'as':_0xf9bafa['as'],'attributes':_0xf9bafa[_0x6fe7('0xc')]};}):[]};}):[]};}):[]:[]})[_0x6fe7('0x11')](function(_0x11d301){logger[_0x6fe7('0x12')](_0x6fe7('0x17'),_0x3a179f);logger[_0x6fe7('0x13')](_0x6fe7('0x17'),_0x3a179f,JSON[_0x6fe7('0x1a')](_0x11d301));_0x272d15(_0x11d301);})[_0x6fe7('0x14')](function(_0x24b80e){logger[_0x6fe7('0x15')](_0x6fe7('0x17'),_0x24b80e['message'],_0x3a179f);_0x22f607(_0x4b310e[_0x6fe7('0x15')](0x1f4,_0x24b80e['message']));});});};function checkArrayOfIntervals(_0x237a5b,_0xd1cf9f){var _0x10a15a=[];return db[_0x6fe7('0x18')][_0x6fe7('0x8')]({'where':{'id':_0x237a5b}})[_0x6fe7('0x11')](function(_0xfbc470){_0x10a15a=_0xfbc470;return Promise['all'](_0x10a15a[_0x6fe7('0xf')](function(_0x429880){return _0x429880['ifTime'](_0xd1cf9f);}));})['then'](function(_0x4e6b82){var _0x4c9be2=_0x4e6b82[_0x6fe7('0x1b')](function(_0xb20feb,_0x432b29){return _0xb20feb||_0x432b29;},![]);logger[_0x6fe7('0x12')](util[_0x6fe7('0x1c')](_0x6fe7('0x1d'),_0x10a15a['map'](function(_0x199449){return _0x199449['name'];})[_0x6fe7('0x1e')](',\x20'),_0x10a15a[_0x6fe7('0xf')](function(_0x49c18e){return _0x49c18e['id'];})['join'](',\x20')));return _0x4c9be2;});}function checkSingleInterval(_0x48be80,_0x1e5943){return db[_0x6fe7('0x18')][_0x6fe7('0x1f')](_0x48be80)[_0x6fe7('0x11')](function(_0x144c23){if(_0x144c23){logger[_0x6fe7('0x12')](util[_0x6fe7('0x1c')](_0x6fe7('0x20'),_0x144c23[_0x6fe7('0x21')],_0x144c23['id']));return _0x144c23[_0x6fe7('0x22')](_0x1e5943);}});}exports['IntervalIftime']=function(_0x64a889){var _0x37c1d4=_0x64a889[_0x6fe7('0x23')];var _0x1139d2=Array[_0x6fe7('0x24')](_0x64a889[_0x6fe7('0x25')])?_0x64a889['intervals']:typeof _0x64a889[_0x6fe7('0x25')]===_0x6fe7('0x26')?[_0x64a889['intervals']]:[];var _0x57e7ba=_0x64a889[_0x6fe7('0x27')]||undefined;var _0x5b4a1e=![];if(_0x1139d2[_0x6fe7('0x28')]){logger[_0x6fe7('0x12')](util[_0x6fe7('0x1c')](_0x6fe7('0x29'),_0x1139d2['join'](';\x20')));}if(_0x57e7ba){logger[_0x6fe7('0x12')](util[_0x6fe7('0x1c')](_0x6fe7('0x2a'),_0x57e7ba));}logger[_0x6fe7('0x13')]('Iftime',_0x5b4a1e);logger['silly'](_0x6fe7('0x2b'),_0x64a889);return Promise['resolve']()['then'](function(){if(Array[_0x6fe7('0x24')](_0x37c1d4)){return checkArrayOfIntervals(_0x37c1d4,_0x57e7ba);}else if(_0x37c1d4){return checkSingleInterval(_0x37c1d4,_0x57e7ba);}})['then'](function(_0xd02996){var _0x1808cb=_0x1139d2[_0x6fe7('0x1b')](function(_0x14ec9c,_0x1c58bd){return _0x14ec9c||iftime(_0x1c58bd,_0x57e7ba);},![]);_0x5b4a1e=_0xd02996||_0x1808cb;return _0x5b4a1e;})[_0x6fe7('0x14')](function(_0x493a42){logger[_0x6fe7('0x15')](_0x6fe7('0x2b'),_0x64a889,_0x493a42);throw this[_0x6fe7('0x15')](0x1f4,_0x493a42['message']);});}; \ No newline at end of file +var _0xb91e=['name','IntervalIftime','intervalIds','isArray','intervals','string','IntervalIftime:\x20interval\x20strings\x20=\x20%s','silly','resolve','reduce','lodash','util','iftime','rpc','GetInterval','Interval','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','stringify','catch','error','message','info','all','ifTime','format','join'];(function(_0x3ae5fe,_0x19fecf){var _0x10e4a9=function(_0x44f10f){while(--_0x44f10f){_0x3ae5fe['push'](_0x3ae5fe['shift']());}};_0x10e4a9(++_0x19fecf);}(_0xb91e,0x9a));var _0xeb91=function(_0x2d386a,_0x9f95d0){_0x2d386a=_0x2d386a-0x0;var _0x5523b7=_0xb91e[_0x2d386a];return _0x5523b7;};'use strict';var _=require(_0xeb91('0x0'));var util=require(_0xeb91('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')[_0xeb91('0x2')];var logger=require('../../config/logger')(_0xeb91('0x3'));exports[_0xeb91('0x4')]=function(_0xa8773f){var _0x30179f=this;return new Promise(function(_0x4e2f85,_0x8651f3){return db[_0xeb91('0x5')][_0xeb91('0x6')]({'raw':_0xa8773f[_0xeb91('0x7')]?_0xa8773f[_0xeb91('0x7')][_0xeb91('0x8')]===undefined?!![]:![]:!![],'where':_0xa8773f[_0xeb91('0x7')]?_0xa8773f[_0xeb91('0x7')][_0xeb91('0x9')]||null:null,'attributes':_0xa8773f['options']?_0xa8773f[_0xeb91('0x7')][_0xeb91('0xa')]||null:null,'limit':_0xa8773f[_0xeb91('0x7')]?_0xa8773f['options'][_0xeb91('0xb')]||null:null,'include':_0xa8773f['options']?_0xa8773f[_0xeb91('0x7')]['include']?_[_0xeb91('0xc')](_0xa8773f[_0xeb91('0x7')][_0xeb91('0xd')],function(_0x27b770){return{'model':db[_0x27b770['model']],'as':_0x27b770['as'],'attributes':_0x27b770[_0xeb91('0xa')],'include':_0x27b770[_0xeb91('0xd')]?_[_0xeb91('0xc')](_0x27b770[_0xeb91('0xd')],function(_0x10535e){return{'model':db[_0x10535e[_0xeb91('0xe')]],'as':_0x10535e['as'],'attributes':_0x10535e[_0xeb91('0xa')],'include':_0x10535e[_0xeb91('0xd')]?_[_0xeb91('0xc')](_0x10535e[_0xeb91('0xd')],function(_0x3dfb61){return{'model':db[_0x3dfb61[_0xeb91('0xe')]],'as':_0x3dfb61['as'],'attributes':_0x3dfb61[_0xeb91('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeb91('0xf')](function(_0x36adc6){logger['info'](_0xeb91('0x4'),_0xa8773f);logger[_0xeb91('0x10')]('GetInterval',_0xa8773f,JSON[_0xeb91('0x11')](_0x36adc6));_0x4e2f85(_0x36adc6);})[_0xeb91('0x12')](function(_0x494dff){logger[_0xeb91('0x13')](_0xeb91('0x4'),_0x494dff[_0xeb91('0x14')],_0xa8773f);_0x8651f3(_0x30179f[_0xeb91('0x13')](0x1f4,_0x494dff[_0xeb91('0x14')]));});});};exports['ShowInterval']=function(_0x5cf7ef){var _0x6a12b1=this;return new Promise(function(_0x42e883,_0x3be5a5){return db[_0xeb91('0x5')]['find']({'raw':_0x5cf7ef[_0xeb91('0x7')]?_0x5cf7ef['options'][_0xeb91('0x8')]===undefined?!![]:![]:!![],'where':_0x5cf7ef['options']?_0x5cf7ef[_0xeb91('0x7')][_0xeb91('0x9')]||null:null,'attributes':_0x5cf7ef[_0xeb91('0x7')]?_0x5cf7ef[_0xeb91('0x7')]['attributes']||null:null,'include':_0x5cf7ef[_0xeb91('0x7')]?_0x5cf7ef['options'][_0xeb91('0xd')]?_['map'](_0x5cf7ef['options'][_0xeb91('0xd')],function(_0xf9df26){return{'model':db[_0xf9df26[_0xeb91('0xe')]],'as':_0xf9df26['as'],'attributes':_0xf9df26[_0xeb91('0xa')],'include':_0xf9df26[_0xeb91('0xd')]?_[_0xeb91('0xc')](_0xf9df26[_0xeb91('0xd')],function(_0x11f292){return{'model':db[_0x11f292['model']],'as':_0x11f292['as'],'attributes':_0x11f292[_0xeb91('0xa')],'include':_0x11f292['include']?_[_0xeb91('0xc')](_0x11f292[_0xeb91('0xd')],function(_0x4c56a7){return{'model':db[_0x4c56a7[_0xeb91('0xe')]],'as':_0x4c56a7['as'],'attributes':_0x4c56a7[_0xeb91('0xa')]};}):[]};}):[]};}):[]:[]})[_0xeb91('0xf')](function(_0x4a7703){logger[_0xeb91('0x15')]('ShowInterval',_0x5cf7ef);logger[_0xeb91('0x10')]('ShowInterval',_0x5cf7ef,JSON[_0xeb91('0x11')](_0x4a7703));_0x42e883(_0x4a7703);})[_0xeb91('0x12')](function(_0x43596a){logger[_0xeb91('0x13')]('ShowInterval',_0x43596a[_0xeb91('0x14')],_0x5cf7ef);_0x3be5a5(_0x6a12b1[_0xeb91('0x13')](0x1f4,_0x43596a['message']));});});};function checkArrayOfIntervals(_0x22375c,_0x17f4a9){var _0x5343d7=[];return db[_0xeb91('0x5')][_0xeb91('0x6')]({'where':{'id':_0x22375c}})[_0xeb91('0xf')](function(_0x1d6037){_0x5343d7=_0x1d6037;return Promise[_0xeb91('0x16')](_0x5343d7[_0xeb91('0xc')](function(_0x7261c5){return _0x7261c5[_0xeb91('0x17')](_0x17f4a9);}));})[_0xeb91('0xf')](function(_0x334413){var _0x1bb5fd=_0x334413['reduce'](function(_0x513ab2,_0x4ef321){return _0x513ab2||_0x4ef321;},![]);logger['info'](util[_0xeb91('0x18')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x5343d7[_0xeb91('0xc')](function(_0x5f0591){return _0x5f0591['name'];})[_0xeb91('0x19')](',\x20'),_0x5343d7[_0xeb91('0xc')](function(_0x1573ea){return _0x1573ea['id'];})[_0xeb91('0x19')](',\x20')));return _0x1bb5fd;});}function checkSingleInterval(_0x503106,_0x15835f){return db['Interval']['findById'](_0x503106)[_0xeb91('0xf')](function(_0x1cf95d){if(_0x1cf95d){logger['info'](util['format']('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x1cf95d[_0xeb91('0x1a')],_0x1cf95d['id']));return _0x1cf95d[_0xeb91('0x17')](_0x15835f);}});}exports[_0xeb91('0x1b')]=function(_0x39fc29){var _0x2e5ecb=_0x39fc29[_0xeb91('0x1c')];var _0x474e09=Array[_0xeb91('0x1d')](_0x39fc29[_0xeb91('0x1e')])?_0x39fc29['intervals']:typeof _0x39fc29['intervals']===_0xeb91('0x1f')?[_0x39fc29[_0xeb91('0x1e')]]:[];var _0x8d4bc9=_0x39fc29['timezone']||undefined;var _0x576d0c=![];if(_0x474e09['length']){logger[_0xeb91('0x15')](util[_0xeb91('0x18')](_0xeb91('0x20'),_0x474e09['join'](';\x20')));}if(_0x8d4bc9){logger['info'](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x8d4bc9));}logger[_0xeb91('0x10')]('Iftime',_0x576d0c);logger[_0xeb91('0x21')](_0xeb91('0x1b'),_0x39fc29);return Promise[_0xeb91('0x22')]()['then'](function(){if(Array['isArray'](_0x2e5ecb)){return checkArrayOfIntervals(_0x2e5ecb,_0x8d4bc9);}else if(_0x2e5ecb){return checkSingleInterval(_0x2e5ecb,_0x8d4bc9);}})[_0xeb91('0xf')](function(_0x100f4f){var _0x3cc6d6=_0x474e09[_0xeb91('0x23')](function(_0x5d1416,_0x346952){return _0x5d1416||iftime(_0x346952,_0x8d4bc9);},![]);_0x576d0c=_0x100f4f||_0x3cc6d6;return _0x576d0c;})[_0xeb91('0x12')](function(_0x452deb){logger[_0xeb91('0x13')]('IntervalIftime',_0x39fc29,_0x452deb);throw this[_0xeb91('0x13')](0x1f4,_0x452deb[_0xeb91('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 089c227..6fd7f72 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 _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb10b,0x12a));var _0xbb10=function(_0x160cd7,_0x315362){_0x160cd7=_0x160cd7-0x0;var _0x4c34f2=_0xb10b[_0x160cd7];return _0x4c34f2;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('0x5')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0xebdc19,_0x1949c7){var _0x3ad4e8=function(_0x1082c1){while(--_0x1082c1){_0xebdc19['push'](_0xebdc19['shift']());}};_0x3ad4e8(++_0x1949c7);}(_0x2ef3,0xba));var _0x32ef=function(_0x16124c,_0x289af9){_0x16124c=_0x16124c-0x0;var _0x3b8654=_0x2ef3[_0x16124c];return _0x3b8654;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 8bdc330..c150d7c 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 _0x3662=['error','status','api.jira','end','openIssue','send','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','description','stringify','Bug','fields','email','customfield_11501','oldToken','customfield_11502','customfield_11503','customfield_11504','reason','customfield_10102','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','statusCode','json'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x3662,0x15b));var _0x2366=function(_0x1a9521,_0x473bcb){_0x1a9521=_0x1a9521-0x0;var _0x2134f7=_0x3662[_0x1a9521];return _0x2134f7;};'use strict';var BPromise=require(_0x2366('0x0'));var https=require('https');var logger=require('../../config/logger')(_0x2366('0x1'));var USERNAME=_0x2366('0x2');var PASSWORD=_0x2366('0x3');function openIssue(_0x50822d,_0x1caa6c){var _0x5c76f1={'fields':{'project':{'key':_0x50822d[_0x2366('0x4')]||_0x2366('0x5')},'summary':(_0x50822d[_0x2366('0x6')]||_0x2366('0x7'))+_0x2366('0x8')+_0x50822d['ip'],'description':_0x50822d[_0x2366('0x9')]||JSON[_0x2366('0xa')](_0x50822d),'issuetype':{'name':_0x50822d['issuetype']||_0x2366('0xb')}}};_0x5c76f1[_0x2366('0xc')]['customfield_11500']=_0x50822d[_0x2366('0xd')];_0x5c76f1['fields'][_0x2366('0xe')]=_0x50822d[_0x2366('0xf')];_0x5c76f1['fields'][_0x2366('0x10')]=_0x50822d['newToken'];_0x5c76f1[_0x2366('0xc')][_0x2366('0x11')]=_0x50822d['name'];_0x5c76f1[_0x2366('0xc')][_0x2366('0x12')]=_0x50822d[_0x2366('0x13')];_0x5c76f1[_0x2366('0xc')][_0x2366('0x14')]=_0x50822d['ip'];var _0x339c0a={'host':'track.xcallymotion.com','port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x2366('0x15'),'Authorization':_0x2366('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0x2366('0x17')](_0x2366('0x18'))}};var _0x44ff75=JSON[_0x2366('0xa')](_0x5c76f1);var _0x26986b=https[_0x2366('0x19')](_0x339c0a,function(_0x13e174){_0x13e174[_0x2366('0x1a')](_0x2366('0x1b'));var _0x110011='';_0x13e174['on'](_0x2366('0x1c'),function(_0x51180c){_0x110011+=_0x51180c;});_0x13e174['on']('end',function(){if(_0x1caa6c){return _0x1caa6c['status'](_0x13e174[_0x2366('0x1d')])[_0x2366('0x1e')](JSON['parse'](_0x110011));}});});_0x26986b['on'](_0x2366('0x1f'),function(_0x15a96d){if(_0x1caa6c){return _0x1caa6c[_0x2366('0x20')](0x1f4)[_0x2366('0x1e')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x2366('0x21')}]});}});_0x26986b['write'](_0x44ff75);_0x26986b[_0x2366('0x22')]();}exports[_0x2366('0x23')]=openIssue;exports[_0x2366('0x24')]=function(_0x3c289b,_0x43d1fa){_0x3c289b[_0x2366('0x25')]['ip']=_0x3c289b['headers'][_0x2366('0x26')]||_0x3c289b['connection'][_0x2366('0x27')]||_0x3c289b[_0x2366('0x28')][_0x2366('0x27')]||_0x3c289b[_0x2366('0x29')][_0x2366('0x28')][_0x2366('0x27')];return openIssue(_0x3c289b['body'],_0x43d1fa);}; \ No newline at end of file +var _0xf6c6=['end','status','statusCode','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','request','setEncoding','utf8'];(function(_0x3bfd53,_0x568b4b){var _0x2d2b69=function(_0x49499b){while(--_0x49499b){_0x3bfd53['push'](_0x3bfd53['shift']());}};_0x2d2b69(++_0x568b4b);}(_0xf6c6,0x100));var _0x6f6c=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xf6c6[_0x5a776b];return _0xbbef59;};'use strict';var BPromise=require(_0x6f6c('0x0'));var https=require(_0x6f6c('0x1'));var logger=require(_0x6f6c('0x2'))(_0x6f6c('0x3'));var USERNAME=_0x6f6c('0x4');var PASSWORD=_0x6f6c('0x5');function openIssue(_0x10d7c4,_0x3e4e5d){var _0x4c6bb0={'fields':{'project':{'key':_0x10d7c4['key']||_0x6f6c('0x6')},'summary':(_0x10d7c4[_0x6f6c('0x7')]||'Report')+_0x6f6c('0x8')+_0x10d7c4['ip'],'description':_0x10d7c4[_0x6f6c('0x9')]||JSON[_0x6f6c('0xa')](_0x10d7c4),'issuetype':{'name':_0x10d7c4[_0x6f6c('0xb')]||_0x6f6c('0xc')}}};_0x4c6bb0[_0x6f6c('0xd')][_0x6f6c('0xe')]=_0x10d7c4[_0x6f6c('0xf')];_0x4c6bb0['fields'][_0x6f6c('0x10')]=_0x10d7c4[_0x6f6c('0x11')];_0x4c6bb0[_0x6f6c('0xd')]['customfield_11502']=_0x10d7c4[_0x6f6c('0x12')];_0x4c6bb0[_0x6f6c('0xd')][_0x6f6c('0x13')]=_0x10d7c4[_0x6f6c('0x14')];_0x4c6bb0[_0x6f6c('0xd')][_0x6f6c('0x15')]=_0x10d7c4[_0x6f6c('0x16')];_0x4c6bb0['fields'][_0x6f6c('0x17')]=_0x10d7c4['ip'];var _0x30c056={'host':_0x6f6c('0x18'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x6f6c('0x19'),'timeout':0x4e20,'headers':{'Content-Type':_0x6f6c('0x1a'),'Authorization':_0x6f6c('0x1b')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x6f6c('0x1c'))}};var _0xb9d56d=JSON[_0x6f6c('0xa')](_0x4c6bb0);var _0x96891d=https[_0x6f6c('0x1d')](_0x30c056,function(_0x4ec733){_0x4ec733[_0x6f6c('0x1e')](_0x6f6c('0x1f'));var _0x5197f4='';_0x4ec733['on']('data',function(_0x5cd380){_0x5197f4+=_0x5cd380;});_0x4ec733['on'](_0x6f6c('0x20'),function(){if(_0x3e4e5d){return _0x3e4e5d[_0x6f6c('0x21')](_0x4ec733[_0x6f6c('0x22')])['json'](JSON[_0x6f6c('0x23')](_0x5197f4));}});});_0x96891d['on'](_0x6f6c('0x24'),function(_0x5b3806){if(_0x3e4e5d){return _0x3e4e5d[_0x6f6c('0x21')](0x1f4)['json']({'errors':[{'message':_0x6f6c('0x25'),'type':_0x6f6c('0x26')}]});}});_0x96891d[_0x6f6c('0x27')](_0xb9d56d);_0x96891d[_0x6f6c('0x20')]();}exports[_0x6f6c('0x28')]=openIssue;exports[_0x6f6c('0x29')]=function(_0x1a1f9d,_0x454659){_0x1a1f9d[_0x6f6c('0x2a')]['ip']=_0x1a1f9d[_0x6f6c('0x2b')][_0x6f6c('0x2c')]||_0x1a1f9d[_0x6f6c('0x2d')]['remoteAddress']||_0x1a1f9d[_0x6f6c('0x2e')][_0x6f6c('0x2f')]||_0x1a1f9d['connection'][_0x6f6c('0x2e')]['remoteAddress'];return openIssue(_0x1a1f9d[_0x6f6c('0x2a')],_0x454659);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 57d0f06..4c03689 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 _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x286832,_0x1bebf8){var _0x16bac4=function(_0x57df40){while(--_0x57df40){_0x286832['push'](_0x286832['shift']());}};_0x16bac4(++_0x1bebf8);}(_0x41bb,0xc5));var _0xb41b=function(_0x26189f,_0x32e2a3){_0x26189f=_0x26189f-0x0;var _0x2571c1=_0x41bb[_0x26189f];return _0x2571c1;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy','exports'];(function(_0x15c5c7,_0x5b7ff2){var _0x2739cb=function(_0x438daf){while(--_0x438daf){_0x15c5c7['push'](_0x15c5c7['shift']());}};_0x2739cb(++_0x5b7ff2);}(_0xedd9,0xfc));var _0x9edd=function(_0x362a0a,_0x1c9a59){_0x362a0a=_0x362a0a-0x0;var _0x5063dc=_0xedd9[_0x362a0a];return _0x5063dc;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['show']);router[_0x9edd('0xf')]('/',auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router['delete'](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x13')]);module[_0x9edd('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index b142604..0a8aa05 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(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x7a54,0x106));var _0x47a5=function(_0x3f5d05,_0x135420){_0x3f5d05=_0x3f5d05-0x0;var _0x37fb61=_0x7a54[_0x3f5d05];return _0x37fb61;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x7a54,0x106));var _0x47a5=function(_0x697b3d,_0x2f52bd){_0x697b3d=_0x697b3d-0x0;var _0x16b913=_0x7a54[_0x697b3d];return _0x16b913;};'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 8b98855..ec218f4 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 _0x2494=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','count','limit','Content-Range','reject','save','update','then','destroy','error','stack','name','send','JscriptyAnswerReport','key','model','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','intersection','length','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x30c92b,_0x154324){var _0x33837b=function(_0x3366e6){while(--_0x3366e6){_0x30c92b['push'](_0x30c92b['shift']());}};_0x33837b(++_0x154324);}(_0x2494,0x82));var _0x4249=function(_0x5578cf,_0x2a8f9d){_0x5578cf=_0x5578cf-0x0;var _0x4f5371=_0x2494[_0x5578cf];return _0x4f5371;};'use strict';var emlformat=require(_0x4249('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4249('0x1'));var jsonpatch=require(_0x4249('0x2'));var rp=require(_0x4249('0x3'));var moment=require(_0x4249('0x4'));var BPromise=require(_0x4249('0x5'));var Mustache=require(_0x4249('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4249('0x7'));var csv=require('to-csv');var ejs=require(_0x4249('0x8'));var fs=require('fs');var fs_extra=require(_0x4249('0x9'));var _=require(_0x4249('0xa'));var squel=require('squel');var crypto=require(_0x4249('0xb'));var jsforce=require(_0x4249('0xc'));var deskjs=require(_0x4249('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4249('0xe'));var Redis=require(_0x4249('0xf'));var authService=require(_0x4249('0x10'));var qs=require(_0x4249('0x11'));var as=require(_0x4249('0x12'));var hardwareService=require(_0x4249('0x13'));var logger=require(_0x4249('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4249('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4249('0x16'))['db'];function respondWithStatusCode(_0x40b7ac,_0x57c3c7){_0x57c3c7=_0x57c3c7||0xcc;return function(_0x3cde97){if(_0x3cde97){return _0x40b7ac[_0x4249('0x17')](_0x57c3c7);}return _0x40b7ac['status'](_0x57c3c7)[_0x4249('0x18')]();};}function respondWithResult(_0x40ce9c,_0x2348f7){_0x2348f7=_0x2348f7||0xc8;return function(_0x3a514b){if(_0x3a514b){return _0x40ce9c[_0x4249('0x19')](_0x2348f7)[_0x4249('0x1a')](_0x3a514b);}};}function respondWithFilteredResult(_0x49eede,_0x7da5cf){return function(_0x32d170){if(_0x32d170){var _0x58ebd9=typeof _0x7da5cf[_0x4249('0x1b')]==='undefined'&&typeof _0x7da5cf['limit']==='undefined';var _0x39a6df=_0x32d170[_0x4249('0x1c')];var _0x1dbb4d=_0x58ebd9?0x0:_0x7da5cf[_0x4249('0x1b')];var _0x345606=_0x58ebd9?_0x32d170['count']:_0x7da5cf['offset']+_0x7da5cf[_0x4249('0x1d')];var _0x1333e1;if(_0x345606>=_0x39a6df){_0x345606=_0x39a6df;_0x1333e1=0xc8;}else{_0x1333e1=0xce;}_0x49eede[_0x4249('0x19')](_0x1333e1);return _0x49eede['set'](_0x4249('0x1e'),_0x1dbb4d+'-'+_0x345606+'/'+_0x39a6df)[_0x4249('0x1a')](_0x32d170);}return null;};}function patchUpdates(_0x4e5208){return function(_0x17399e){try{jsonpatch['apply'](_0x17399e,_0x4e5208,!![]);}catch(_0x4513d9){return BPromise[_0x4249('0x1f')](_0x4513d9);}return _0x17399e[_0x4249('0x20')]();};}function saveUpdates(_0x170fb2,_0x42d0d9){return function(_0x157354){if(_0x157354){return _0x157354[_0x4249('0x21')](_0x170fb2)[_0x4249('0x22')](function(_0x4032f7){return _0x4032f7;});}return null;};}function removeEntity(_0x15561d,_0x9da8){return function(_0x453667){if(_0x453667){return _0x453667[_0x4249('0x23')]()[_0x4249('0x22')](function(){_0x15561d[_0x4249('0x19')](0xcc)[_0x4249('0x18')]();});}};}function handleEntityNotFound(_0x35b6ec,_0x2e5843){return function(_0x4f970e){if(!_0x4f970e){_0x35b6ec[_0x4249('0x17')](0x194);}return _0x4f970e;};}function handleError(_0x43dc25,_0x1d4fb9){_0x1d4fb9=_0x1d4fb9||0x1f4;return function(_0x4ce9af){logger[_0x4249('0x24')](_0x4ce9af[_0x4249('0x25')]);if(_0x4ce9af[_0x4249('0x26')]){delete _0x4ce9af[_0x4249('0x26')];}_0x43dc25['status'](_0x1d4fb9)[_0x4249('0x27')](_0x4ce9af);};}exports['index']=function(_0x2dbac8,_0x16e141){var _0x3780ba={},_0x4eba42={},_0xb4d4d8={'count':0x0,'rows':[]};var _0x3b3cb5=_['map'](db[_0x4249('0x28')]['rawAttributes'],function(_0x4e7761){return{'name':_0x4e7761['fieldName'],'type':_0x4e7761['type'][_0x4249('0x29')]};});_0x4eba42[_0x4249('0x2a')]=_['map'](_0x3b3cb5,_0x4249('0x26'));_0x4eba42[_0x4249('0x2b')]=_['keys'](_0x2dbac8[_0x4249('0x2b')]);_0x4eba42['filters']=_['intersection'](_0x4eba42[_0x4249('0x2a')],_0x4eba42[_0x4249('0x2b')]);_0x3780ba[_0x4249('0x2c')]=_['intersection'](_0x4eba42[_0x4249('0x2a')],qs['fields'](_0x2dbac8['query'][_0x4249('0x2d')]));_0x3780ba[_0x4249('0x2c')]=_0x3780ba['attributes']['length']?_0x3780ba[_0x4249('0x2c')]:_0x4eba42[_0x4249('0x2a')];if(!_0x2dbac8[_0x4249('0x2b')][_0x4249('0x2e')](_0x4249('0x2f'))){_0x3780ba[_0x4249('0x1d')]=qs[_0x4249('0x1d')](_0x2dbac8[_0x4249('0x2b')][_0x4249('0x1d')]);_0x3780ba[_0x4249('0x1b')]=qs[_0x4249('0x1b')](_0x2dbac8[_0x4249('0x2b')][_0x4249('0x1b')]);}_0x3780ba[_0x4249('0x30')]=qs[_0x4249('0x31')](_0x2dbac8['query']['sort']);_0x3780ba[_0x4249('0x32')]=qs[_0x4249('0x33')](_[_0x4249('0x34')](_0x2dbac8[_0x4249('0x2b')],_0x4eba42['filters']),_0x3b3cb5);if(_0x2dbac8[_0x4249('0x2b')][_0x4249('0x35')]){_0x3780ba[_0x4249('0x32')]=_[_0x4249('0x36')](_0x3780ba[_0x4249('0x32')],{'$or':_[_0x4249('0x37')](_0x3b3cb5,function(_0xb51eb2){if(_0xb51eb2[_0x4249('0x38')]!==_0x4249('0x39')){var _0x42725d={};_0x42725d[_0xb51eb2['name']]={'$like':'%'+_0x2dbac8['query']['filter']+'%'};return _0x42725d;}})});}_0x3780ba=_[_0x4249('0x36')]({},_0x3780ba,_0x2dbac8[_0x4249('0x3a')]);var _0x1b6afd={'where':_0x3780ba[_0x4249('0x32')]};return db['JscriptyAnswerReport'][_0x4249('0x1c')](_0x1b6afd)['then'](function(_0xd71464){_0xb4d4d8[_0x4249('0x1c')]=_0xd71464;if(_0x2dbac8['query'][_0x4249('0x3b')]){_0x3780ba[_0x4249('0x3c')]=[{'all':!![]}];}return db[_0x4249('0x28')][_0x4249('0x3d')](_0x3780ba);})[_0x4249('0x22')](function(_0x872aaa){_0xb4d4d8[_0x4249('0x3e')]=_0x872aaa;return _0xb4d4d8;})[_0x4249('0x22')](respondWithFilteredResult(_0x16e141,_0x3780ba))[_0x4249('0x3f')](handleError(_0x16e141,null));};exports[_0x4249('0x40')]=function(_0x513cd7,_0x1f73a0){var _0x3d30eb={'raw':!![],'where':{'id':_0x513cd7[_0x4249('0x41')]['id']}},_0x2e08b4={};_0x2e08b4[_0x4249('0x2a')]=_[_0x4249('0x42')](db[_0x4249('0x28')][_0x4249('0x43')]);_0x2e08b4[_0x4249('0x2b')]=_[_0x4249('0x42')](_0x513cd7[_0x4249('0x2b')]);_0x2e08b4['filters']=_[_0x4249('0x44')](_0x2e08b4[_0x4249('0x2a')],_0x2e08b4[_0x4249('0x2b')]);_0x3d30eb[_0x4249('0x2c')]=_[_0x4249('0x44')](_0x2e08b4[_0x4249('0x2a')],qs['fields'](_0x513cd7[_0x4249('0x2b')][_0x4249('0x2d')]));_0x3d30eb['attributes']=_0x3d30eb[_0x4249('0x2c')][_0x4249('0x45')]?_0x3d30eb['attributes']:_0x2e08b4[_0x4249('0x2a')];if(_0x513cd7['query']['includeAll']){_0x3d30eb[_0x4249('0x3c')]=[{'all':!![]}];}_0x3d30eb=_['merge']({},_0x3d30eb,_0x513cd7[_0x4249('0x3a')]);return db[_0x4249('0x28')][_0x4249('0x46')](_0x3d30eb)[_0x4249('0x22')](handleEntityNotFound(_0x1f73a0,null))['then'](respondWithResult(_0x1f73a0,null))[_0x4249('0x3f')](handleError(_0x1f73a0,null));};exports[_0x4249('0x47')]=function(_0x4c63fa,_0x28ad9b){return db[_0x4249('0x28')][_0x4249('0x47')](_0x4c63fa[_0x4249('0x48')],{})[_0x4249('0x22')](respondWithResult(_0x28ad9b,0xc9))[_0x4249('0x3f')](handleError(_0x28ad9b,null));};exports[_0x4249('0x21')]=function(_0xeab8f7,_0x35222b){if(_0xeab8f7[_0x4249('0x48')]['id']){delete _0xeab8f7[_0x4249('0x48')]['id'];}return db['JscriptyAnswerReport'][_0x4249('0x46')]({'where':{'id':_0xeab8f7[_0x4249('0x41')]['id']}})[_0x4249('0x22')](handleEntityNotFound(_0x35222b,null))[_0x4249('0x22')](saveUpdates(_0xeab8f7['body'],null))['then'](respondWithResult(_0x35222b,null))[_0x4249('0x3f')](handleError(_0x35222b,null));};exports[_0x4249('0x23')]=function(_0x4d163f,_0x36a67f){return db[_0x4249('0x28')][_0x4249('0x46')]({'where':{'id':_0x4d163f['params']['id']}})['then'](handleEntityNotFound(_0x36a67f,null))[_0x4249('0x22')](removeEntity(_0x36a67f,null))['catch'](handleError(_0x36a67f,null));};exports[_0x4249('0x49')]=function(_0x58a075,_0x4554ac){return db[_0x4249('0x28')]['describe']()[_0x4249('0x22')](respondWithResult(_0x4554ac,null))[_0x4249('0x3f')](handleError(_0x4554ac,null));}; \ No newline at end of file +var _0x1203=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','update','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','includeAll','include','findAll','then','rows','catch','show','keys','JscriptyAnswerReport','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2523a4,_0xb7208d){var _0x153f35=function(_0x8e3d66){while(--_0x8e3d66){_0x2523a4['push'](_0x2523a4['shift']());}};_0x153f35(++_0xb7208d);}(_0x1203,0x8c));var _0x3120=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1203[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x3120('0x0'));var rimraf=require(_0x3120('0x1'));var zipdir=require(_0x3120('0x2'));var jsonpatch=require(_0x3120('0x3'));var rp=require(_0x3120('0x4'));var moment=require(_0x3120('0x5'));var BPromise=require(_0x3120('0x6'));var Mustache=require(_0x3120('0x7'));var util=require(_0x3120('0x8'));var path=require(_0x3120('0x9'));var sox=require(_0x3120('0xa'));var csv=require(_0x3120('0xb'));var ejs=require(_0x3120('0xc'));var fs=require('fs');var fs_extra=require(_0x3120('0xd'));var _=require(_0x3120('0xe'));var squel=require(_0x3120('0xf'));var crypto=require('crypto');var jsforce=require(_0x3120('0x10'));var deskjs=require(_0x3120('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3120('0x12'));var authService=require(_0x3120('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3120('0x14'));var hardwareService=require(_0x3120('0x15'));var logger=require(_0x3120('0x16'))(_0x3120('0x17'));var utils=require('../../config/utils');var config=require(_0x3120('0x18'));var licenseUtil=require(_0x3120('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4a4312,_0x41a236){_0x41a236=_0x41a236||0xcc;return function(_0x2b1879){if(_0x2b1879){return _0x4a4312[_0x3120('0x1a')](_0x41a236);}return _0x4a4312[_0x3120('0x1b')](_0x41a236)[_0x3120('0x1c')]();};}function respondWithResult(_0x1f05b6,_0x1ef350){_0x1ef350=_0x1ef350||0xc8;return function(_0x4a2b20){if(_0x4a2b20){return _0x1f05b6[_0x3120('0x1b')](_0x1ef350)[_0x3120('0x1d')](_0x4a2b20);}};}function respondWithFilteredResult(_0xcda8,_0x18357e){return function(_0x1d919e){if(_0x1d919e){var _0x335d6b=typeof _0x18357e[_0x3120('0x1e')]==='undefined'&&typeof _0x18357e[_0x3120('0x1f')]==='undefined';var _0x1eb41f=_0x1d919e[_0x3120('0x20')];var _0x2bbdb7=_0x335d6b?0x0:_0x18357e[_0x3120('0x1e')];var _0x3c8c9b=_0x335d6b?_0x1d919e[_0x3120('0x20')]:_0x18357e[_0x3120('0x1e')]+_0x18357e['limit'];var _0xb16dcd;if(_0x3c8c9b>=_0x1eb41f){_0x3c8c9b=_0x1eb41f;_0xb16dcd=0xc8;}else{_0xb16dcd=0xce;}_0xcda8['status'](_0xb16dcd);return _0xcda8[_0x3120('0x21')](_0x3120('0x22'),_0x2bbdb7+'-'+_0x3c8c9b+'/'+_0x1eb41f)[_0x3120('0x1d')](_0x1d919e);}return null;};}function patchUpdates(_0x5bfd37){return function(_0x5a0bce){try{jsonpatch['apply'](_0x5a0bce,_0x5bfd37,!![]);}catch(_0x44a04c){return BPromise[_0x3120('0x23')](_0x44a04c);}return _0x5a0bce['save']();};}function saveUpdates(_0x1358e0,_0x2cf3be){return function(_0x3fbd05){if(_0x3fbd05){return _0x3fbd05[_0x3120('0x24')](_0x1358e0)['then'](function(_0x4739c3){return _0x4739c3;});}return null;};}function removeEntity(_0x5977b2,_0x444b3b){return function(_0xb762e2){if(_0xb762e2){return _0xb762e2[_0x3120('0x25')]()['then'](function(){_0x5977b2['status'](0xcc)[_0x3120('0x1c')]();});}};}function handleEntityNotFound(_0x7d0b5f,_0x5e0f82){return function(_0xc88506){if(!_0xc88506){_0x7d0b5f[_0x3120('0x1a')](0x194);}return _0xc88506;};}function handleError(_0x2493ca,_0x4bc011){_0x4bc011=_0x4bc011||0x1f4;return function(_0x2636b5){logger[_0x3120('0x26')](_0x2636b5[_0x3120('0x27')]);if(_0x2636b5[_0x3120('0x28')]){delete _0x2636b5['name'];}_0x2493ca['status'](_0x4bc011)['send'](_0x2636b5);};}exports[_0x3120('0x29')]=function(_0x5444ec,_0x2bc753){var _0x303055={},_0x3de290={},_0x3399fd={'count':0x0,'rows':[]};var _0x186ace=_[_0x3120('0x2a')](db['JscriptyAnswerReport'][_0x3120('0x2b')],function(_0xeed487){return{'name':_0xeed487[_0x3120('0x2c')],'type':_0xeed487[_0x3120('0x2d')][_0x3120('0x2e')]};});_0x3de290[_0x3120('0x2f')]=_[_0x3120('0x2a')](_0x186ace,_0x3120('0x28'));_0x3de290['query']=_['keys'](_0x5444ec[_0x3120('0x30')]);_0x3de290[_0x3120('0x31')]=_[_0x3120('0x32')](_0x3de290[_0x3120('0x2f')],_0x3de290[_0x3120('0x30')]);_0x303055[_0x3120('0x33')]=_['intersection'](_0x3de290[_0x3120('0x2f')],qs[_0x3120('0x34')](_0x5444ec[_0x3120('0x30')][_0x3120('0x34')]));_0x303055[_0x3120('0x33')]=_0x303055[_0x3120('0x33')][_0x3120('0x35')]?_0x303055['attributes']:_0x3de290[_0x3120('0x2f')];if(!_0x5444ec[_0x3120('0x30')][_0x3120('0x36')](_0x3120('0x37'))){_0x303055[_0x3120('0x1f')]=qs[_0x3120('0x1f')](_0x5444ec[_0x3120('0x30')][_0x3120('0x1f')]);_0x303055[_0x3120('0x1e')]=qs[_0x3120('0x1e')](_0x5444ec[_0x3120('0x30')][_0x3120('0x1e')]);}_0x303055[_0x3120('0x38')]=qs['sort'](_0x5444ec['query'][_0x3120('0x39')]);_0x303055[_0x3120('0x3a')]=qs[_0x3120('0x31')](_['pick'](_0x5444ec[_0x3120('0x30')],_0x3de290[_0x3120('0x31')]),_0x186ace);if(_0x5444ec[_0x3120('0x30')]['filter']){_0x303055[_0x3120('0x3a')]=_[_0x3120('0x3b')](_0x303055[_0x3120('0x3a')],{'$or':_[_0x3120('0x2a')](_0x186ace,function(_0x8b0a5a){if(_0x8b0a5a[_0x3120('0x2d')]!=='VIRTUAL'){var _0x5e5200={};_0x5e5200[_0x8b0a5a['name']]={'$like':'%'+_0x5444ec[_0x3120('0x30')]['filter']+'%'};return _0x5e5200;}})});}_0x303055=_[_0x3120('0x3b')]({},_0x303055,_0x5444ec[_0x3120('0x3c')]);var _0x20bde7={'where':_0x303055[_0x3120('0x3a')]};return db['JscriptyAnswerReport'][_0x3120('0x20')](_0x20bde7)['then'](function(_0x31bf0f){_0x3399fd[_0x3120('0x20')]=_0x31bf0f;if(_0x5444ec[_0x3120('0x30')][_0x3120('0x3d')]){_0x303055[_0x3120('0x3e')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3120('0x3f')](_0x303055);})[_0x3120('0x40')](function(_0x19a317){_0x3399fd[_0x3120('0x41')]=_0x19a317;return _0x3399fd;})['then'](respondWithFilteredResult(_0x2bc753,_0x303055))[_0x3120('0x42')](handleError(_0x2bc753,null));};exports[_0x3120('0x43')]=function(_0x513276,_0x1f7b81){var _0x30dfd1={'raw':!![],'where':{'id':_0x513276['params']['id']}},_0x1680cc={};_0x1680cc[_0x3120('0x2f')]=_[_0x3120('0x44')](db['JscriptyAnswerReport'][_0x3120('0x2b')]);_0x1680cc[_0x3120('0x30')]=_['keys'](_0x513276['query']);_0x1680cc[_0x3120('0x31')]=_[_0x3120('0x32')](_0x1680cc[_0x3120('0x2f')],_0x1680cc[_0x3120('0x30')]);_0x30dfd1[_0x3120('0x33')]=_[_0x3120('0x32')](_0x1680cc[_0x3120('0x2f')],qs[_0x3120('0x34')](_0x513276[_0x3120('0x30')][_0x3120('0x34')]));_0x30dfd1['attributes']=_0x30dfd1[_0x3120('0x33')][_0x3120('0x35')]?_0x30dfd1[_0x3120('0x33')]:_0x1680cc[_0x3120('0x2f')];if(_0x513276['query']['includeAll']){_0x30dfd1[_0x3120('0x3e')]=[{'all':!![]}];}_0x30dfd1=_['merge']({},_0x30dfd1,_0x513276[_0x3120('0x3c')]);return db[_0x3120('0x45')][_0x3120('0x46')](_0x30dfd1)[_0x3120('0x40')](handleEntityNotFound(_0x1f7b81,null))[_0x3120('0x40')](respondWithResult(_0x1f7b81,null))[_0x3120('0x42')](handleError(_0x1f7b81,null));};exports[_0x3120('0x47')]=function(_0x22ac87,_0x5a741c){return db[_0x3120('0x45')][_0x3120('0x47')](_0x22ac87[_0x3120('0x48')],{})[_0x3120('0x40')](respondWithResult(_0x5a741c,0xc9))[_0x3120('0x42')](handleError(_0x5a741c,null));};exports['update']=function(_0x4bcb78,_0x5bbe60){if(_0x4bcb78[_0x3120('0x48')]['id']){delete _0x4bcb78[_0x3120('0x48')]['id'];}return db[_0x3120('0x45')][_0x3120('0x46')]({'where':{'id':_0x4bcb78['params']['id']}})[_0x3120('0x40')](handleEntityNotFound(_0x5bbe60,null))[_0x3120('0x40')](saveUpdates(_0x4bcb78[_0x3120('0x48')],null))[_0x3120('0x40')](respondWithResult(_0x5bbe60,null))[_0x3120('0x42')](handleError(_0x5bbe60,null));};exports[_0x3120('0x25')]=function(_0x297134,_0x2f7ae8){return db[_0x3120('0x45')]['find']({'where':{'id':_0x297134['params']['id']}})['then'](handleEntityNotFound(_0x2f7ae8,null))[_0x3120('0x40')](removeEntity(_0x2f7ae8,null))['catch'](handleError(_0x2f7ae8,null));};exports[_0x3120('0x49')]=function(_0x2efdb9,_0x36081b){return db[_0x3120('0x45')][_0x3120('0x49')]()[_0x3120('0x40')](respondWithResult(_0x36081b,null))[_0x3120('0x42')](handleError(_0x36081b,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 80dd90f..0ef43e7 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 _0xfbed=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','lodash','util'];(function(_0x56018e,_0x309ad5){var _0x5cb725=function(_0x5c90cd){while(--_0x5c90cd){_0x56018e['push'](_0x56018e['shift']());}};_0x5cb725(++_0x309ad5);}(_0xfbed,0x116));var _0xdfbe=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfbed[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xdfbe('0x0'));var util=require(_0xdfbe('0x1'));var logger=require(_0xdfbe('0x2'))(_0xdfbe('0x3'));var moment=require(_0xdfbe('0x4'));var BPromise=require(_0xdfbe('0x5'));var rp=require(_0xdfbe('0x6'));var fs=require('fs');var path=require(_0xdfbe('0x7'));var rimraf=require(_0xdfbe('0x8'));var config=require(_0xdfbe('0x9'));var attributes=require(_0xdfbe('0xa'));module[_0xdfbe('0xb')]=function(_0x4560b0,_0x571399){return _0x4560b0[_0xdfbe('0xc')](_0xdfbe('0xd'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1a6=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','lodash','../../config/logger','api','moment'];(function(_0x34dcb8,_0x28c732){var _0x621d85=function(_0x285fbd){while(--_0x285fbd){_0x34dcb8['push'](_0x34dcb8['shift']());}};_0x621d85(++_0x28c732);}(_0xd1a6,0xa4));var _0x6d1a=function(_0x5b6988,_0x67e002){_0x5b6988=_0x5b6988-0x0;var _0x4e2cc9=_0xd1a6[_0x5b6988];return _0x4e2cc9;};'use strict';var _=require(_0x6d1a('0x0'));var util=require('util');var logger=require(_0x6d1a('0x1'))(_0x6d1a('0x2'));var moment=require(_0x6d1a('0x3'));var BPromise=require(_0x6d1a('0x4'));var rp=require(_0x6d1a('0x5'));var fs=require('fs');var path=require(_0x6d1a('0x6'));var rimraf=require(_0x6d1a('0x7'));var config=require(_0x6d1a('0x8'));var attributes=require(_0x6d1a('0x9'));module['exports']=function(_0x267619,_0x8a954b){return _0x267619[_0x6d1a('0xa')](_0x6d1a('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 60a3d95..06d98a0 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 _0xeaba=['jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xee4ba3,_0x354cec){var _0x571a72=function(_0x26b43e){while(--_0x26b43e){_0xee4ba3['push'](_0xee4ba3['shift']());}};_0x571a72(++_0x354cec);}(_0xeaba,0x150));var _0xaeab=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xeaba[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0xaeab('0x0'));var util=require(_0xaeab('0x1'));var moment=require(_0xaeab('0x2'));var BPromise=require('bluebird');var rs=require(_0xaeab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaeab('0x4'))['db'];var utils=require(_0xaeab('0x5'));var logger=require(_0xaeab('0x6'))(_0xaeab('0x7'));var config=require(_0xaeab('0x8'));var jayson=require(_0xaeab('0x9'));var client=jayson[_0xaeab('0xa')][_0xaeab('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a743f,_0xbfbc39,_0x148fd2){return new BPromise(function(_0x4b6f81,_0x703a7d){return client[_0xaeab('0xc')](_0x5a743f,_0x148fd2)[_0xaeab('0xd')](function(_0x5a27e0){logger[_0xaeab('0xe')](_0xaeab('0xf'),_0xbfbc39,_0xaeab('0x10'));logger[_0xaeab('0x11')](_0xaeab('0x12'),_0xbfbc39,'request\x20sent',JSON['stringify'](_0x5a27e0));if(_0x5a27e0[_0xaeab('0x13')]){if(_0x5a27e0['error'][_0xaeab('0x14')]===0x1f4){logger[_0xaeab('0x13')](_0xaeab('0xf'),_0xbfbc39,_0x5a27e0[_0xaeab('0x13')]['message']);return _0x703a7d(_0x5a27e0[_0xaeab('0x13')]['message']);}logger['error'](_0xaeab('0xf'),_0xbfbc39,_0x5a27e0[_0xaeab('0x13')][_0xaeab('0x15')]);return _0x4b6f81(_0x5a27e0['error'][_0xaeab('0x15')]);}else{logger[_0xaeab('0xe')](_0xaeab('0xf'),_0xbfbc39,_0xaeab('0x10'));_0x4b6f81(_0x5a27e0['result']['message']);}})[_0xaeab('0x16')](function(_0x2fac1d){logger[_0xaeab('0x13')](_0xaeab('0xf'),_0xbfbc39,_0x2fac1d);_0x703a7d(_0x2fac1d);});});} \ No newline at end of file +var _0xbfce=['error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x494a0f,_0x1c2dd8){var _0x339b67=function(_0x344816){while(--_0x344816){_0x494a0f['push'](_0x494a0f['shift']());}};_0x339b67(++_0x1c2dd8);}(_0xbfce,0xcb));var _0xebfc=function(_0x38f093,_0x34321c){_0x38f093=_0x38f093-0x0;var _0x44bf0f=_0xbfce[_0x38f093];return _0x44bf0f;};'use strict';var _=require(_0xebfc('0x0'));var util=require('util');var moment=require(_0xebfc('0x1'));var BPromise=require('bluebird');var rs=require(_0xebfc('0x2'));var fs=require('fs');var Redis=require(_0xebfc('0x3'));var db=require(_0xebfc('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xebfc('0x5'));var config=require(_0xebfc('0x6'));var jayson=require(_0xebfc('0x7'));var client=jayson[_0xebfc('0x8')][_0xebfc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547bde,_0x859602,_0x4eda93){return new BPromise(function(_0x4a8bcd,_0x4716fd){return client[_0xebfc('0xa')](_0x547bde,_0x4eda93)[_0xebfc('0xb')](function(_0x550079){logger[_0xebfc('0xc')](_0xebfc('0xd'),_0x859602,_0xebfc('0xe'));logger[_0xebfc('0xf')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x859602,_0xebfc('0xe'),JSON[_0xebfc('0x10')](_0x550079));if(_0x550079[_0xebfc('0x11')]){if(_0x550079[_0xebfc('0x11')][_0xebfc('0x12')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x859602,_0x550079[_0xebfc('0x11')][_0xebfc('0x13')]);return _0x4716fd(_0x550079[_0xebfc('0x11')][_0xebfc('0x13')]);}logger[_0xebfc('0x11')](_0xebfc('0xd'),_0x859602,_0x550079[_0xebfc('0x11')][_0xebfc('0x13')]);return _0x4a8bcd(_0x550079[_0xebfc('0x11')]['message']);}else{logger[_0xebfc('0xc')](_0xebfc('0xd'),_0x859602,_0xebfc('0xe'));_0x4a8bcd(_0x550079[_0xebfc('0x14')][_0xebfc('0x13')]);}})[_0xebfc('0x15')](function(_0x2cdfd7){logger[_0xebfc('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x859602,_0x2cdfd7);_0x4716fd(_0x2cdfd7);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index eea605a..c6ba329 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 _0xd755=['/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show','/:id/sessions','/:id/answers','getAnswers','/:id/summary','getSummary','post','create','/:id/clone','clone','put'];(function(_0x99e801,_0xa53f83){var _0x8cac87=function(_0x203a4a){while(--_0x203a4a){_0x99e801['push'](_0x99e801['shift']());}};_0x8cac87(++_0xa53f83);}(_0xd755,0x12d));var _0x5d75=function(_0x13f0a2,_0x1b3623){_0x13f0a2=_0x13f0a2-0x0;var _0x4cd0b4=_0xd755[_0x13f0a2];return _0x4cd0b4;};'use strict';var multer=require(_0x5d75('0x0'));var util=require(_0x5d75('0x1'));var path=require(_0x5d75('0x2'));var timeout=require(_0x5d75('0x3'));var express=require('express');var router=express[_0x5d75('0x4')]();var fs_extra=require(_0x5d75('0x5'));var auth=require(_0x5d75('0x6'));var interaction=require(_0x5d75('0x7'));var config=require(_0x5d75('0x8'));var controller=require('./jscriptyProject.controller');router[_0x5d75('0x9')]('/',auth['isAuthenticated'](),controller[_0x5d75('0xa')]);router['get']('/:id',auth[_0x5d75('0xb')](),controller[_0x5d75('0xc')]);router['get'](_0x5d75('0xd'),auth['isAuthenticated'](),controller['getSessions']);router['get'](_0x5d75('0xe'),auth[_0x5d75('0xb')](),controller[_0x5d75('0xf')]);router[_0x5d75('0x9')](_0x5d75('0x10'),auth[_0x5d75('0xb')](),timeout('30s'),controller[_0x5d75('0x11')]);router[_0x5d75('0x12')]('/',auth['isAuthenticated'](),controller[_0x5d75('0x13')]);router[_0x5d75('0x12')](_0x5d75('0x14'),auth[_0x5d75('0xb')](),controller[_0x5d75('0x15')]);router[_0x5d75('0x16')](_0x5d75('0x17'),auth[_0x5d75('0xb')](),controller['update']);router[_0x5d75('0x18')]('/:id',auth['isAuthenticated'](),controller[_0x5d75('0x19')]);module[_0x5d75('0x1a')]=router; \ No newline at end of file +var _0x1e0d=['isAuthenticated','/:id/sessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','create','/:id/clone','clone','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./jscriptyProject.controller','index','get','/:id'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x1e0d,0xbd));var _0xd1e0=function(_0x5d09b2,_0x49ebb4){_0x5d09b2=_0x5d09b2-0x0;var _0x2c5287=_0x1e0d[_0x5d09b2];return _0x2c5287;};'use strict';var multer=require(_0xd1e0('0x0'));var util=require('util');var path=require(_0xd1e0('0x1'));var timeout=require(_0xd1e0('0x2'));var express=require(_0xd1e0('0x3'));var router=express[_0xd1e0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd1e0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd1e0('0x6'));var controller=require(_0xd1e0('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd1e0('0x8')]);router[_0xd1e0('0x9')](_0xd1e0('0xa'),auth[_0xd1e0('0xb')](),controller['show']);router[_0xd1e0('0x9')](_0xd1e0('0xc'),auth[_0xd1e0('0xb')](),controller['getSessions']);router[_0xd1e0('0x9')](_0xd1e0('0xd'),auth[_0xd1e0('0xb')](),controller[_0xd1e0('0xe')]);router[_0xd1e0('0x9')](_0xd1e0('0xf'),auth[_0xd1e0('0xb')](),timeout(_0xd1e0('0x10')),controller[_0xd1e0('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd1e0('0x12')]);router['post'](_0xd1e0('0x13'),auth[_0xd1e0('0xb')](),controller[_0xd1e0('0x14')]);router[_0xd1e0('0x15')](_0xd1e0('0xa'),auth[_0xd1e0('0xb')](),controller['update']);router[_0xd1e0('0x16')](_0xd1e0('0xa'),auth[_0xd1e0('0xb')](),controller[_0xd1e0('0x17')]);module[_0xd1e0('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 32cb871..84da127 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 _0x9ce1=['description','BOOLEAN','sequelize','lodash','util','exports','STRING','TEXT','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','name'];(function(_0x584513,_0x37c6c9){var _0xe4a14e=function(_0x4aadc0){while(--_0x4aadc0){_0x584513['push'](_0x584513['shift']());}};_0xe4a14e(++_0x37c6c9);}(_0x9ce1,0x82));var _0x19ce=function(_0x18c731,_0x5a7e88){_0x18c731=_0x18c731-0x0;var _0x33d5cf=_0x9ce1[_0x18c731];return _0x33d5cf;};'use strict';var Sequelize=require(_0x19ce('0x0'));var _=require(_0x19ce('0x1'));var util=require(_0x19ce('0x2'));module[_0x19ce('0x3')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x19ce('0x4')]},'formData':{'type':Sequelize[_0x19ce('0x5')](_0x19ce('0x6')),'set':function(_0x3bcc7f){if(_['isObjectLike'](_0x3bcc7f)){this[_0x19ce('0x7')](_0x19ce('0x8'),JSON[_0x19ce('0x9')](_0x3bcc7f));}else if(_['isString'](_0x3bcc7f)){this['setDataValue'](_0x19ce('0x8'),_0x3bcc7f);}else{this[_0x19ce('0x7')](_0x19ce('0x8'),util[_0x19ce('0xa')](_0x19ce('0xb'),this[_0x19ce('0xc')](_0x19ce('0xd'))||'',this[_0x19ce('0xc')](_0x19ce('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x19ce('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x1997=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData'];(function(_0x4c9db2,_0x1ab07f){var _0xc6f9b0=function(_0x83e8ce){while(--_0x83e8ce){_0x4c9db2['push'](_0x4c9db2['shift']());}};_0xc6f9b0(++_0x1ab07f);}(_0x1997,0x116));var _0x7199=function(_0x1ad021,_0x15edc8){_0x1ad021=_0x1ad021-0x0;var _0xe167d7=_0x1997[_0x1ad021];return _0xe167d7;};'use strict';var Sequelize=require('sequelize');var _=require(_0x7199('0x0'));var util=require(_0x7199('0x1'));module[_0x7199('0x2')]={'name':{'type':Sequelize[_0x7199('0x3')],'unique':_0x7199('0x4')},'description':{'type':Sequelize[_0x7199('0x3')]},'formData':{'type':Sequelize[_0x7199('0x5')](_0x7199('0x6')),'set':function(_0x462678){if(_[_0x7199('0x7')](_0x462678)){this[_0x7199('0x8')](_0x7199('0x9'),JSON['stringify'](_0x462678));}else if(_[_0x7199('0xa')](_0x462678)){this['setDataValue'](_0x7199('0x9'),_0x462678);}else{this[_0x7199('0x8')](_0x7199('0x9'),util[_0x7199('0xb')](_0x7199('0xc'),this['getDataValue'](_0x7199('0x4'))||'',this[_0x7199('0xd')](_0x7199('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x7199('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x7199('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 93d4651..21d2487 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 _0x5523=['Projects','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyProject','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','findOne','JscriptySessionReport','nolimit','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','questionId','question','format','SessionId','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','download','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy'];(function(_0x879e31,_0x139d02){var _0x3467e8=function(_0x544fc6){while(--_0x544fc6){_0x879e31['push'](_0x879e31['shift']());}};_0x3467e8(++_0x139d02);}(_0x5523,0x137));var _0x3552=function(_0x3e47d0,_0x5e7626){_0x3e47d0=_0x3e47d0-0x0;var _0x2a68e1=_0x5523[_0x3e47d0];return _0x2a68e1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3552('0x0'));var jsonpatch=require(_0x3552('0x1'));var rp=require(_0x3552('0x2'));var moment=require(_0x3552('0x3'));var BPromise=require(_0x3552('0x4'));var Mustache=require(_0x3552('0x5'));var util=require(_0x3552('0x6'));var path=require(_0x3552('0x7'));var sox=require(_0x3552('0x8'));var csv=require(_0x3552('0x9'));var ejs=require(_0x3552('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3552('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3552('0xc'));var toCsv=require(_0x3552('0x9'));var querystring=require(_0x3552('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3552('0xe'));var qs=require(_0x3552('0xf'));var as=require(_0x3552('0x10'));var hardwareService=require(_0x3552('0x11'));var logger=require(_0x3552('0x12'))(_0x3552('0x13'));var utils=require(_0x3552('0x14'));var config=require(_0x3552('0x15'));var licenseUtil=require(_0x3552('0x16'));var db=require(_0x3552('0x17'))['db'];function respondWithStatusCode(_0xae728b,_0x549df0){_0x549df0=_0x549df0||0xcc;return function(_0x295d0d){if(_0x295d0d){return _0xae728b[_0x3552('0x18')](_0x549df0);}return _0xae728b[_0x3552('0x19')](_0x549df0)['end']();};}function respondWithResult(_0x538549,_0x123c8e){_0x123c8e=_0x123c8e||0xc8;return function(_0x3e90fc){if(_0x3e90fc){return _0x538549[_0x3552('0x19')](_0x123c8e)[_0x3552('0x1a')](_0x3e90fc);}};}function respondWithFilteredResult(_0x50813d,_0x3b9f0a){return function(_0x268d39){if(_0x268d39){var _0x31dd12=typeof _0x3b9f0a[_0x3552('0x1b')]==='undefined'&&typeof _0x3b9f0a[_0x3552('0x1c')]===_0x3552('0x1d');var _0xcc111c=_0x268d39['count'];var _0x2375c9=_0x31dd12?0x0:_0x3b9f0a[_0x3552('0x1b')];var _0x586e1f=_0x31dd12?_0x268d39[_0x3552('0x1e')]:_0x3b9f0a[_0x3552('0x1b')]+_0x3b9f0a[_0x3552('0x1c')];var _0x42fe33;if(_0x586e1f>=_0xcc111c){_0x586e1f=_0xcc111c;_0x42fe33=0xc8;}else{_0x42fe33=0xce;}_0x50813d['status'](_0x42fe33);return _0x50813d[_0x3552('0x1f')](_0x3552('0x20'),_0x2375c9+'-'+_0x586e1f+'/'+_0xcc111c)['json'](_0x268d39);}return null;};}function patchUpdates(_0x26984c){return function(_0x443bab){try{jsonpatch[_0x3552('0x21')](_0x443bab,_0x26984c,!![]);}catch(_0x404b40){return BPromise[_0x3552('0x22')](_0x404b40);}return _0x443bab['save']();};}function saveUpdates(_0x2fe62c,_0x4ea201){return function(_0x42a3d3){if(_0x42a3d3){return _0x42a3d3['update'](_0x2fe62c)[_0x3552('0x23')](function(_0x3ddfb3){return _0x3ddfb3;});}return null;};}function removeEntity(_0x5355e4,_0x1f80b5){return function(_0x534c68){if(_0x534c68){return _0x534c68[_0x3552('0x24')]()['then'](function(){var _0x1972b7=_0x534c68['get']({'plain':!![]});var _0x11c23f=_0x3552('0x25');return db[_0x3552('0x26')][_0x3552('0x24')]({'where':{'type':_0x11c23f,'resourceId':_0x1972b7['id']}})[_0x3552('0x23')](function(){return _0x534c68;});})[_0x3552('0x23')](function(){_0x5355e4[_0x3552('0x19')](0xcc)[_0x3552('0x27')]();});}};}function handleEntityNotFound(_0x5028e1,_0x5d93f6){return function(_0x7d75aa){if(!_0x7d75aa){_0x5028e1['sendStatus'](0x194);}return _0x7d75aa;};}function handleError(_0x29dc07,_0x43d239){_0x43d239=_0x43d239||0x1f4;return function(_0x914ffc){logger[_0x3552('0x28')](_0x914ffc[_0x3552('0x29')]);if(_0x914ffc['name']){delete _0x914ffc[_0x3552('0x2a')];}_0x29dc07[_0x3552('0x19')](_0x43d239)[_0x3552('0x2b')](_0x914ffc);};}exports[_0x3552('0x2c')]=function(_0x212185,_0x52220d){var _0x32b45f={},_0x144d92={},_0x4bbe07={'count':0x0,'rows':[]};var _0xa8952e=_['map'](db['JscriptyProject'][_0x3552('0x2d')],function(_0xe41ad6){return{'name':_0xe41ad6[_0x3552('0x2e')],'type':_0xe41ad6[_0x3552('0x2f')][_0x3552('0x30')]};});_0x144d92[_0x3552('0x31')]=_[_0x3552('0x32')](_0xa8952e,_0x3552('0x2a'));_0x144d92['query']=_['keys'](_0x212185['query']);_0x144d92[_0x3552('0x33')]=_[_0x3552('0x34')](_0x144d92['model'],_0x144d92['query']);_0x32b45f[_0x3552('0x35')]=_[_0x3552('0x34')](_0x144d92[_0x3552('0x31')],qs[_0x3552('0x36')](_0x212185[_0x3552('0x37')][_0x3552('0x36')]));_0x32b45f[_0x3552('0x35')]=_0x32b45f['attributes'][_0x3552('0x38')]?_0x32b45f[_0x3552('0x35')]:_0x144d92[_0x3552('0x31')];if(!_0x212185[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x32b45f[_0x3552('0x1c')]=qs['limit'](_0x212185[_0x3552('0x37')]['limit']);_0x32b45f[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x212185[_0x3552('0x37')][_0x3552('0x1b')]);}_0x32b45f[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x212185[_0x3552('0x37')][_0x3552('0x3b')]);_0x32b45f[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x212185[_0x3552('0x37')],_0x144d92['filters']),_0xa8952e);if(_0x212185[_0x3552('0x37')][_0x3552('0x3e')]){_0x32b45f[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x32b45f[_0x3552('0x3c')],{'$or':_['map'](_0xa8952e,function(_0x36d84b){if(_0x36d84b['type']!==_0x3552('0x40')){var _0x1e8d10={};_0x1e8d10[_0x36d84b['name']]={'$like':'%'+_0x212185[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x1e8d10;}})});}_0x32b45f=_[_0x3552('0x3f')]({},_0x32b45f,_0x212185[_0x3552('0x41')]);var _0xaab25d={'where':_0x32b45f[_0x3552('0x3c')]};return db[_0x3552('0x42')][_0x3552('0x1e')](_0xaab25d)[_0x3552('0x23')](function(_0x142da0){_0x4bbe07[_0x3552('0x1e')]=_0x142da0;if(_0x212185[_0x3552('0x37')]['includeAll']){_0x32b45f[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x42')][_0x3552('0x44')](_0x32b45f);})[_0x3552('0x23')](function(_0x45973b){_0x4bbe07[_0x3552('0x45')]=_0x45973b;return _0x4bbe07;})[_0x3552('0x23')](respondWithFilteredResult(_0x52220d,_0x32b45f))[_0x3552('0x46')](handleError(_0x52220d,null));};exports['show']=function(_0x1631d0,_0x3e9921){var _0x200fe8={'raw':![],'where':{'id':_0x1631d0[_0x3552('0x47')]['id']}},_0x38290f={};_0x38290f[_0x3552('0x31')]=_[_0x3552('0x48')](db['JscriptyProject'][_0x3552('0x2d')]);_0x38290f[_0x3552('0x37')]=_[_0x3552('0x48')](_0x1631d0[_0x3552('0x37')]);_0x38290f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],_0x38290f[_0x3552('0x37')]);_0x200fe8['attributes']=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],qs[_0x3552('0x36')](_0x1631d0[_0x3552('0x37')][_0x3552('0x36')]));_0x200fe8[_0x3552('0x35')]=_0x200fe8[_0x3552('0x35')][_0x3552('0x38')]?_0x200fe8[_0x3552('0x35')]:_0x38290f['model'];if(_0x1631d0[_0x3552('0x37')]['includeAll']){_0x200fe8[_0x3552('0x43')]=[{'all':!![]}];}_0x200fe8=_[_0x3552('0x3f')]({},_0x200fe8,_0x1631d0['options']);return db['JscriptyProject'][_0x3552('0x49')](_0x200fe8)[_0x3552('0x23')](handleEntityNotFound(_0x3e9921,null))['then'](respondWithResult(_0x3e9921,null))[_0x3552('0x46')](handleError(_0x3e9921,null));};exports[_0x3552('0x4a')]=function(_0x68222b,_0x71ca89){return db[_0x3552('0x42')]['create'](_0x68222b[_0x3552('0x4b')],{})[_0x3552('0x23')](function(_0x40c412){var _0x4eff7a=_0x68222b[_0x3552('0x4c')][_0x3552('0x4d')]({'plain':!![]});if(!_0x4eff7a)throw new Error(_0x3552('0x4e'));if(_0x4eff7a[_0x3552('0x4f')]===_0x3552('0x4c')){var _0x2f94e4=_0x40c412[_0x3552('0x4d')]({'plain':!![]});var _0x3b78b8=_0x3552('0x25');return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x3b78b8,'userProfileId':_0x4eff7a[_0x3552('0x51')]},'raw':!![]})['then'](function(_0x1bfc84){if(_0x1bfc84&&_0x1bfc84[_0x3552('0x52')]===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x2f94e4[_0x3552('0x2a')],'resourceId':_0x2f94e4['id'],'type':_0x1bfc84['name'],'sectionId':_0x1bfc84['id']},{})['then'](function(){return _0x40c412;});}else{return _0x40c412;}})[_0x3552('0x46')](function(_0x42c63d){logger[_0x3552('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42c63d);throw _0x42c63d;});}return _0x40c412;})['then'](respondWithResult(_0x71ca89,0xc9))['catch'](handleError(_0x71ca89,null));};exports[_0x3552('0x53')]=function(_0x4ad6e5,_0x5daef7){var _0xc7d21e={'where':{'id':_0x4ad6e5[_0x3552('0x47')]['id']}},_0x2e43eb={};_0x2e43eb[_0x3552('0x31')]=_['keys'](db[_0x3552('0x42')][_0x3552('0x2d')]);_0xc7d21e[_0x3552('0x35')]=_[_0x3552('0x34')](_0x2e43eb[_0x3552('0x31')],qs[_0x3552('0x36')](_0x4ad6e5['query'][_0x3552('0x36')]));_0xc7d21e[_0x3552('0x35')]=_0xc7d21e[_0x3552('0x35')][_0x3552('0x38')]?_0xc7d21e['attributes']:_0x2e43eb[_0x3552('0x31')];if(_0x4ad6e5[_0x3552('0x37')][_0x3552('0x54')]){_0xc7d21e[_0x3552('0x43')]=[{'all':!![]}];}_0xc7d21e=_[_0x3552('0x3f')]({},_0xc7d21e,_0x4ad6e5[_0x3552('0x41')]);return db['JscriptyProject'][_0x3552('0x49')](_0xc7d21e)['then'](handleEntityNotFound(_0x5daef7,null))['then'](function(_0x2a7d99){if(_0x2a7d99){var _0x306e98=_0x2a7d99[_0x3552('0x4d')]({'plain':!![]});_0x306e98=qs['omit'](_0x306e98,['id','createdAt','updatedAt']);_0x4ad6e5['body']=_['omit'](_0x4ad6e5[_0x3552('0x4b')],['id',_0x3552('0x55'),_0x3552('0x56')]);return db[_0x3552('0x42')][_0x3552('0x4a')](_[_0x3552('0x3f')](_0x306e98,_0x4ad6e5['body']),{'include':_0x4ad6e5['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3552('0x23')](function(_0x318e4c){var _0x4a40a3=_0x4ad6e5['user'][_0x3552('0x4d')]({'plain':!![]});if(!_0x4a40a3)throw new Error(_0x3552('0x4e'));if(_0x4a40a3['role']==='user'){var _0x1039b0=_0x318e4c[_0x3552('0x4d')]({'plain':!![]});var _0x28e503='Projects';return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x28e503,'userProfileId':_0x4a40a3['userProfileId']},'raw':!![]})['then'](function(_0x5e1181){if(_0x5e1181&&_0x5e1181['autoAssociation']===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x1039b0[_0x3552('0x2a')],'resourceId':_0x1039b0['id'],'type':_0x5e1181[_0x3552('0x2a')],'sectionId':_0x5e1181['id']},{})[_0x3552('0x23')](function(){return _0x318e4c;});}else{return _0x318e4c;}})['catch'](function(_0x4eaaa8){logger['error'](_0x3552('0x57'),_0x4eaaa8);throw _0x4eaaa8;});}return _0x318e4c;});}})['then'](respondWithResult(_0x5daef7,0xc9))[_0x3552('0x46')](handleError(_0x5daef7,null));};exports[_0x3552('0x58')]=function(_0x8a4545,_0x4bf9ff){if(_0x8a4545[_0x3552('0x4b')]['id']){delete _0x8a4545[_0x3552('0x4b')]['id'];}return db[_0x3552('0x42')]['find']({'where':{'id':_0x8a4545[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4bf9ff,null))[_0x3552('0x23')](saveUpdates(_0x8a4545['body'],null))[_0x3552('0x23')](respondWithResult(_0x4bf9ff,null))['catch'](handleError(_0x4bf9ff,null));};exports[_0x3552('0x24')]=function(_0x4e37d0,_0x571322){return db[_0x3552('0x42')]['find']({'where':{'id':_0x4e37d0['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x571322,null))[_0x3552('0x23')](removeEntity(_0x571322,null))[_0x3552('0x46')](handleError(_0x571322,null));};exports[_0x3552('0x59')]=function(_0x763317,_0x1da9c0,_0x1d345c){var _0x4702bc={'raw':!![],'where':{}};var _0x27aa33={};var _0x1eacba={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x763317['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x1da9c0,null))[_0x3552('0x23')](function(_0x185a1a){if(_0x185a1a){_0x27aa33[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x5b')]['rawAttributes']);_0x27aa33['query']=_[_0x3552('0x48')](_0x763317[_0x3552('0x37')]);_0x27aa33[_0x3552('0x33')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],_0x27aa33['query']);_0x4702bc[_0x3552('0x35')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],qs[_0x3552('0x36')](_0x763317[_0x3552('0x37')][_0x3552('0x36')]));_0x4702bc[_0x3552('0x35')]=_0x4702bc[_0x3552('0x35')][_0x3552('0x38')]?_0x4702bc[_0x3552('0x35')]:_0x27aa33[_0x3552('0x31')];if(!_0x763317[_0x3552('0x37')]['hasOwnProperty'](_0x3552('0x5c'))){_0x4702bc[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x763317[_0x3552('0x37')]['limit']);_0x4702bc[_0x3552('0x1b')]=qs['offset'](_0x763317[_0x3552('0x37')][_0x3552('0x1b')]);}_0x4702bc['order']=qs['sort'](_0x763317[_0x3552('0x37')][_0x3552('0x3b')]);_0x4702bc[_0x3552('0x3c')]=qs['filters'](_['pick'](_0x763317[_0x3552('0x37')],_0x27aa33[_0x3552('0x33')]));_0x4702bc[_0x3552('0x3c')][_0x3552('0x5d')]=_0x185a1a['id'];if(_0x763317[_0x3552('0x37')]['filter']){_0x4702bc[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x4702bc[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x4702bc[_0x3552('0x35')],function(_0x17d06f){var _0x49f6ba={};_0x49f6ba[_0x17d06f]={'$like':'%'+_0x763317[_0x3552('0x37')]['filter']+'%'};return _0x49f6ba;})});}_0x4702bc=_[_0x3552('0x3f')]({},_0x4702bc,_0x763317[_0x3552('0x41')]);return db[_0x3552('0x5b')]['count']({'where':_0x4702bc[_0x3552('0x3c')]})['then'](function(_0x497a35){_0x1eacba[_0x3552('0x1e')]=_0x497a35;if(_0x763317[_0x3552('0x37')]['includeAll']){_0x4702bc['include']=[{'all':!![]}];}return db[_0x3552('0x5b')]['findAll'](_0x4702bc);})['then'](function(_0x1a43b4){_0x1eacba['rows']=_0x1a43b4;return _0x1eacba;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x1da9c0,_0x4702bc))[_0x3552('0x46')](handleError(_0x1da9c0,null));};exports['getAnswers']=function(_0x2960a2,_0x53bf9e,_0x39efa7){var _0x3db63d={'raw':!![],'where':{}};var _0x1566ab={};var _0x46c6f1={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x2960a2[_0x3552('0x47')]['id']}})['then'](handleEntityNotFound(_0x53bf9e,null))[_0x3552('0x23')](function(_0x336b58){if(_0x336b58){_0x1566ab['model']=_['keys'](db['JscriptyAnswerReport'][_0x3552('0x2d')]);_0x1566ab[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2960a2[_0x3552('0x37')]);_0x1566ab[_0x3552('0x33')]=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],_0x1566ab[_0x3552('0x37')]);_0x3db63d['attributes']=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2960a2['query'][_0x3552('0x36')]));_0x3db63d[_0x3552('0x35')]=_0x3db63d[_0x3552('0x35')][_0x3552('0x38')]?_0x3db63d[_0x3552('0x35')]:_0x1566ab['model'];if(!_0x2960a2['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x3db63d[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2960a2[_0x3552('0x37')]['limit']);_0x3db63d[_0x3552('0x1b')]=qs['offset'](_0x2960a2[_0x3552('0x37')][_0x3552('0x1b')]);}_0x3db63d['order']=qs[_0x3552('0x3b')](_0x2960a2[_0x3552('0x37')]['sort']);_0x3db63d['where']=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2960a2['query'],_0x1566ab[_0x3552('0x33')]));_0x3db63d[_0x3552('0x3c')][_0x3552('0x5d')]=_0x336b58['id'];if(_0x2960a2[_0x3552('0x37')][_0x3552('0x3e')]){_0x3db63d[_0x3552('0x3c')]=_['merge'](_0x3db63d[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x3db63d[_0x3552('0x35')],function(_0x88b8a2){var _0x45f44a={};_0x45f44a[_0x88b8a2]={'$like':'%'+_0x2960a2['query'][_0x3552('0x3e')]+'%'};return _0x45f44a;})});}_0x3db63d=_[_0x3552('0x3f')]({},_0x3db63d,_0x2960a2[_0x3552('0x41')]);return db[_0x3552('0x5e')][_0x3552('0x1e')]({'where':_0x3db63d[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0xe4f31d){_0x46c6f1[_0x3552('0x1e')]=_0xe4f31d;if(_0x2960a2[_0x3552('0x37')][_0x3552('0x54')]){_0x3db63d[_0x3552('0x43')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x3552('0x44')](_0x3db63d);})[_0x3552('0x23')](function(_0x4044c5){_0x46c6f1[_0x3552('0x45')]=_0x4044c5;return _0x46c6f1;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x53bf9e,_0x3db63d))[_0x3552('0x46')](handleError(_0x53bf9e,null));};function char(_0x373121){return _0x3552('0x5f')===typeof _0x373121?String[_0x3552('0x60')][_0x3552('0x21')](null,arguments):_0x373121;}function needsEncapsulation(_0x36c4af){return!!_0x36c4af&&(_0x36c4af[_0x3552('0x61')]()[_0x3552('0x62')](char(0xd))>=0x0||_0x36c4af[_0x3552('0x61')]()[_0x3552('0x62')](char(0xa))>=0x0||_0x36c4af[_0x3552('0x61')]()[_0x3552('0x62')](char(0x2c))>=0x0||_0x36c4af['toString']()[_0x3552('0x62')](char(0x22))>=0x0);}function encapsulate(_0x1c6a62){var _0x46e1a5=char(0x22),_0x5b1502='\x5c'+char(0x22),_0x302218=_0x1c6a62['toString']()[_0x3552('0x63')](new RegExp(_0x46e1a5,'g'),_0x5b1502);return _0x46e1a5+_0x302218+_0x46e1a5;}exports[_0x3552('0x64')]=function(_0x1b4abd,_0x2c13c8,_0x4927c5){var _0x3bebe7,_0x59ed12;var _0x14b488={'where':{'ProjectId':_0x1b4abd['params']['id']}};if(_0x1b4abd[_0x3552('0x37')][_0x3552('0x65')]){_0x14b488[_0x3552('0x3c')][_0x3552('0x66')]=JSON['parse'](_0x1b4abd[_0x3552('0x37')][_0x3552('0x65')]);}return db[_0x3552('0x5b')][_0x3552('0x44')](_0x14b488)[_0x3552('0x23')](handleEntityNotFound(_0x2c13c8,null))[_0x3552('0x23')](function(_0x181d72){if(_0x181d72){_0x3bebe7=_0x181d72;return db[_0x3552('0x67')]['findAll']({'where':{'SessionId':{'$in':_[_0x3552('0x32')](_0x3bebe7,'id')},'ProjectId':_0x1b4abd[_0x3552('0x47')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x2c13c8,null))[_0x3552('0x23')](function(_0x10729c){if(_0x10729c){_0x59ed12=_0x10729c;var _0x3541a5={};for(var _0x567cb6=0x0,_0x2708b6=_0x59ed12['length'];_0x567cb6<_0x2708b6;_0x567cb6++){if(!_0x3541a5[_0x3552('0x39')](_0x59ed12[_0x567cb6]['questionId'])){_0x3541a5[_0x59ed12[_0x567cb6][_0x3552('0x68')]]=needsEncapsulation(_0x59ed12[_0x567cb6][_0x3552('0x69')])?encapsulate(_0x59ed12[_0x567cb6]['question']):_0x59ed12[_0x567cb6][_0x3552('0x69')];}}var _0x21278b=[],_0x2c8446={};for(var _0x3b9f80=0x0,_0x47ca2b=_0x3bebe7[_0x3552('0x38')];_0x3b9f80<_0x47ca2b;_0x3b9f80++){_0x2c8446={'ProjectId':_0x1b4abd[_0x3552('0x47')]['id'],'SessionId':_0x3bebe7[_0x3b9f80]['id'],'StartTime':moment(_0x3bebe7[_0x3b9f80][_0x3552('0x66')])[_0x3552('0x6a')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3d97c8=0x0,_0x1f58b7=_0x59ed12[_0x3552('0x38')];_0x3d97c8<_0x1f58b7;_0x3d97c8++){if(_0x59ed12[_0x3d97c8][_0x3552('0x6b')]==_0x3bebe7[_0x3b9f80]['id']&&_0x3541a5[_0x3552('0x39')](_0x59ed12[_0x3d97c8][_0x3552('0x68')])){_0x2c8446[_0x3541a5[_0x59ed12[_0x3d97c8][_0x3552('0x68')]]]=_0x59ed12[_0x3d97c8]['answer'];}}for(var _0x193c08 in _0x3541a5){if(!_0x2c8446[_0x3552('0x39')](_0x3541a5[_0x193c08])){_0x2c8446[_0x3541a5[_0x193c08]]=null;}}_0x21278b['push'](_0x2c8446);}return _0x21278b;}})['then'](function(_0x53e9c9){if(!_[_0x3552('0x6c')](_0x53e9c9)){var _0x36ce25=toCsv(_0x53e9c9);var _0x1df6d7=Date[_0x3552('0x6d')]();fs[_0x3552('0x6e')](util[_0x3552('0x6a')](_0x3552('0x6f'),_0x1b4abd[_0x3552('0x47')]['id'],_0x1df6d7),_0x36ce25);_0x2c13c8[_0x3552('0x70')](_0x3552('0x71'),_0x3552('0x72')+util[_0x3552('0x6a')]('Jscripty_Project_%d_Summary_%s.csv',_0x1b4abd[_0x3552('0x47')]['id'],_0x1df6d7));_0x2c13c8[_0x3552('0x70')]('Content-type','text/csv');return _0x2c13c8[_0x3552('0x73')](util[_0x3552('0x6a')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1b4abd[_0x3552('0x47')]['id'],_0x1df6d7));}else{return _0x2c13c8[_0x3552('0x18')](0xcc);}})[_0x3552('0x46')](handleError(_0x2c13c8,null));}; \ No newline at end of file +var _0x32d3=['writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','download','sendStatus','eml-format','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','rows','show','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','error','clone','params','length','updatedAt','omit','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','findAll','getAnswers','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now'];(function(_0x3d1244,_0x156028){var _0x5d6372=function(_0x509c76){while(--_0x509c76){_0x3d1244['push'](_0x3d1244['shift']());}};_0x5d6372(++_0x156028);}(_0x32d3,0xee));var _0x332d=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x32d3[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x332d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x332d('0x1'));var BPromise=require(_0x332d('0x2'));var Mustache=require(_0x332d('0x3'));var util=require(_0x332d('0x4'));var path=require('path');var sox=require(_0x332d('0x5'));var csv=require('to-csv');var ejs=require(_0x332d('0x6'));var fs=require('fs');var fs_extra=require(_0x332d('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x332d('0x8'));var jsforce=require(_0x332d('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x332d('0xa'));var querystring=require('querystring');var Papa=require(_0x332d('0xb'));var Redis=require(_0x332d('0xc'));var authService=require(_0x332d('0xd'));var qs=require(_0x332d('0xe'));var as=require(_0x332d('0xf'));var hardwareService=require(_0x332d('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x332d('0x11'));var config=require(_0x332d('0x12'));var licenseUtil=require(_0x332d('0x13'));var db=require(_0x332d('0x14'))['db'];function respondWithStatusCode(_0x40a446,_0xc71fba){_0xc71fba=_0xc71fba||0xcc;return function(_0x295245){if(_0x295245){return _0x40a446['sendStatus'](_0xc71fba);}return _0x40a446[_0x332d('0x15')](_0xc71fba)[_0x332d('0x16')]();};}function respondWithResult(_0x3db576,_0x528377){_0x528377=_0x528377||0xc8;return function(_0x38dc23){if(_0x38dc23){return _0x3db576[_0x332d('0x15')](_0x528377)[_0x332d('0x17')](_0x38dc23);}};}function respondWithFilteredResult(_0x1a4330,_0x118a6d){return function(_0x2896a9){if(_0x2896a9){var _0x5092ca=typeof _0x118a6d[_0x332d('0x18')]==='undefined'&&typeof _0x118a6d['limit']===_0x332d('0x19');var _0xbdb53d=_0x2896a9[_0x332d('0x1a')];var _0xc63cba=_0x5092ca?0x0:_0x118a6d[_0x332d('0x18')];var _0x2edae3=_0x5092ca?_0x2896a9[_0x332d('0x1a')]:_0x118a6d[_0x332d('0x18')]+_0x118a6d['limit'];var _0x5bd6f3;if(_0x2edae3>=_0xbdb53d){_0x2edae3=_0xbdb53d;_0x5bd6f3=0xc8;}else{_0x5bd6f3=0xce;}_0x1a4330[_0x332d('0x15')](_0x5bd6f3);return _0x1a4330[_0x332d('0x1b')]('Content-Range',_0xc63cba+'-'+_0x2edae3+'/'+_0xbdb53d)[_0x332d('0x17')](_0x2896a9);}return null;};}function patchUpdates(_0x46b208){return function(_0x1983e9){try{jsonpatch[_0x332d('0x1c')](_0x1983e9,_0x46b208,!![]);}catch(_0x1c589d){return BPromise['reject'](_0x1c589d);}return _0x1983e9['save']();};}function saveUpdates(_0x56aee9,_0x14fa2f){return function(_0x2dcb2c){if(_0x2dcb2c){return _0x2dcb2c[_0x332d('0x1d')](_0x56aee9)[_0x332d('0x1e')](function(_0x3f421e){return _0x3f421e;});}return null;};}function removeEntity(_0x237fa4,_0x12a398){return function(_0x3b32f0){if(_0x3b32f0){return _0x3b32f0[_0x332d('0x1f')]()[_0x332d('0x1e')](function(){var _0x5263d4=_0x3b32f0[_0x332d('0x20')]({'plain':!![]});var _0x43ce73=_0x332d('0x21');return db[_0x332d('0x22')][_0x332d('0x1f')]({'where':{'type':_0x43ce73,'resourceId':_0x5263d4['id']}})[_0x332d('0x1e')](function(){return _0x3b32f0;});})[_0x332d('0x1e')](function(){_0x237fa4[_0x332d('0x15')](0xcc)[_0x332d('0x16')]();});}};}function handleEntityNotFound(_0x46b5ab,_0x1a3163){return function(_0x599e4f){if(!_0x599e4f){_0x46b5ab['sendStatus'](0x194);}return _0x599e4f;};}function handleError(_0x46c268,_0x1a4a24){_0x1a4a24=_0x1a4a24||0x1f4;return function(_0x2cd43e){logger['error'](_0x2cd43e[_0x332d('0x23')]);if(_0x2cd43e[_0x332d('0x24')]){delete _0x2cd43e[_0x332d('0x24')];}_0x46c268[_0x332d('0x15')](_0x1a4a24)[_0x332d('0x25')](_0x2cd43e);};}exports['index']=function(_0x4367f1,_0xcdd271){var _0x3ff2a3={},_0x233362={},_0x1f53de={'count':0x0,'rows':[]};var _0x47efa1=_[_0x332d('0x26')](db['JscriptyProject'][_0x332d('0x27')],function(_0x166be6){return{'name':_0x166be6[_0x332d('0x28')],'type':_0x166be6[_0x332d('0x29')][_0x332d('0x2a')]};});_0x233362[_0x332d('0x2b')]=_[_0x332d('0x26')](_0x47efa1,'name');_0x233362[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x4367f1['query']);_0x233362['filters']=_[_0x332d('0x2e')](_0x233362['model'],_0x233362['query']);_0x3ff2a3[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x233362[_0x332d('0x2b')],qs['fields'](_0x4367f1[_0x332d('0x2c')][_0x332d('0x30')]));_0x3ff2a3[_0x332d('0x2f')]=_0x3ff2a3[_0x332d('0x2f')]['length']?_0x3ff2a3[_0x332d('0x2f')]:_0x233362[_0x332d('0x2b')];if(!_0x4367f1[_0x332d('0x2c')][_0x332d('0x31')](_0x332d('0x32'))){_0x3ff2a3['limit']=qs[_0x332d('0x33')](_0x4367f1['query'][_0x332d('0x33')]);_0x3ff2a3[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x4367f1[_0x332d('0x2c')]['offset']);}_0x3ff2a3[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x4367f1[_0x332d('0x2c')][_0x332d('0x35')]);_0x3ff2a3[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x4367f1['query'],_0x233362[_0x332d('0x37')]),_0x47efa1);if(_0x4367f1[_0x332d('0x2c')][_0x332d('0x39')]){_0x3ff2a3['where']=_[_0x332d('0x3a')](_0x3ff2a3['where'],{'$or':_[_0x332d('0x26')](_0x47efa1,function(_0x33d38c){if(_0x33d38c[_0x332d('0x29')]!==_0x332d('0x3b')){var _0xb8859c={};_0xb8859c[_0x33d38c[_0x332d('0x24')]]={'$like':'%'+_0x4367f1['query'][_0x332d('0x39')]+'%'};return _0xb8859c;}})});}_0x3ff2a3=_[_0x332d('0x3a')]({},_0x3ff2a3,_0x4367f1[_0x332d('0x3c')]);var _0x36ad78={'where':_0x3ff2a3[_0x332d('0x36')]};return db[_0x332d('0x3d')][_0x332d('0x1a')](_0x36ad78)[_0x332d('0x1e')](function(_0x5e97e3){_0x1f53de[_0x332d('0x1a')]=_0x5e97e3;if(_0x4367f1[_0x332d('0x2c')][_0x332d('0x3e')]){_0x3ff2a3[_0x332d('0x3f')]=[{'all':!![]}];}return db[_0x332d('0x3d')]['findAll'](_0x3ff2a3);})[_0x332d('0x1e')](function(_0x4074e9){_0x1f53de[_0x332d('0x40')]=_0x4074e9;return _0x1f53de;})[_0x332d('0x1e')](respondWithFilteredResult(_0xcdd271,_0x3ff2a3))['catch'](handleError(_0xcdd271,null));};exports[_0x332d('0x41')]=function(_0x192c0a,_0x2df00f){var _0x23bd55={'raw':![],'where':{'id':_0x192c0a['params']['id']}},_0x3fa8fe={};_0x3fa8fe[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['JscriptyProject'][_0x332d('0x27')]);_0x3fa8fe[_0x332d('0x2c')]=_[_0x332d('0x2d')](_0x192c0a[_0x332d('0x2c')]);_0x3fa8fe[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x3fa8fe[_0x332d('0x2b')],_0x3fa8fe[_0x332d('0x2c')]);_0x23bd55[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x3fa8fe[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x192c0a[_0x332d('0x2c')][_0x332d('0x30')]));_0x23bd55[_0x332d('0x2f')]=_0x23bd55['attributes']['length']?_0x23bd55['attributes']:_0x3fa8fe[_0x332d('0x2b')];if(_0x192c0a['query'][_0x332d('0x3e')]){_0x23bd55[_0x332d('0x3f')]=[{'all':!![]}];}_0x23bd55=_['merge']({},_0x23bd55,_0x192c0a['options']);return db[_0x332d('0x3d')][_0x332d('0x42')](_0x23bd55)[_0x332d('0x1e')](handleEntityNotFound(_0x2df00f,null))[_0x332d('0x1e')](respondWithResult(_0x2df00f,null))[_0x332d('0x43')](handleError(_0x2df00f,null));};exports[_0x332d('0x44')]=function(_0x2770b8,_0x39c240){return db[_0x332d('0x3d')]['create'](_0x2770b8[_0x332d('0x45')],{})[_0x332d('0x1e')](function(_0x1f9cb3){var _0x350cb0=_0x2770b8['user'][_0x332d('0x20')]({'plain':!![]});if(!_0x350cb0)throw new Error(_0x332d('0x46'));if(_0x350cb0[_0x332d('0x47')]===_0x332d('0x48')){var _0x35699e=_0x1f9cb3['get']({'plain':!![]});var _0x5438f2=_0x332d('0x21');return db[_0x332d('0x49')][_0x332d('0x42')]({'where':{'name':_0x5438f2,'userProfileId':_0x350cb0['userProfileId']},'raw':!![]})['then'](function(_0x12c21f){if(_0x12c21f&&_0x12c21f[_0x332d('0x4a')]===0x0){return db['UserProfileResource'][_0x332d('0x44')]({'name':_0x35699e[_0x332d('0x24')],'resourceId':_0x35699e['id'],'type':_0x12c21f[_0x332d('0x24')],'sectionId':_0x12c21f['id']},{})[_0x332d('0x1e')](function(){return _0x1f9cb3;});}else{return _0x1f9cb3;}})[_0x332d('0x43')](function(_0x5b6a92){logger[_0x332d('0x4b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b6a92);throw _0x5b6a92;});}return _0x1f9cb3;})['then'](respondWithResult(_0x39c240,0xc9))[_0x332d('0x43')](handleError(_0x39c240,null));};exports[_0x332d('0x4c')]=function(_0xcdc4b6,_0x17ec91){var _0x53daba={'where':{'id':_0xcdc4b6[_0x332d('0x4d')]['id']}},_0x1b8c55={};_0x1b8c55[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['JscriptyProject'][_0x332d('0x27')]);_0x53daba['attributes']=_[_0x332d('0x2e')](_0x1b8c55[_0x332d('0x2b')],qs[_0x332d('0x30')](_0xcdc4b6[_0x332d('0x2c')]['fields']));_0x53daba[_0x332d('0x2f')]=_0x53daba[_0x332d('0x2f')][_0x332d('0x4e')]?_0x53daba[_0x332d('0x2f')]:_0x1b8c55[_0x332d('0x2b')];if(_0xcdc4b6['query'][_0x332d('0x3e')]){_0x53daba[_0x332d('0x3f')]=[{'all':!![]}];}_0x53daba=_[_0x332d('0x3a')]({},_0x53daba,_0xcdc4b6[_0x332d('0x3c')]);return db[_0x332d('0x3d')][_0x332d('0x42')](_0x53daba)[_0x332d('0x1e')](handleEntityNotFound(_0x17ec91,null))[_0x332d('0x1e')](function(_0x5af047){if(_0x5af047){var _0x341bd8=_0x5af047[_0x332d('0x20')]({'plain':!![]});_0x341bd8=qs['omit'](_0x341bd8,['id','createdAt',_0x332d('0x4f')]);_0xcdc4b6[_0x332d('0x45')]=_[_0x332d('0x50')](_0xcdc4b6[_0x332d('0x45')],['id','createdAt',_0x332d('0x4f')]);return db[_0x332d('0x3d')][_0x332d('0x44')](_[_0x332d('0x3a')](_0x341bd8,_0xcdc4b6[_0x332d('0x45')]),{'include':_0xcdc4b6['query'][_0x332d('0x3e')]?[{'all':!![]}]:undefined})[_0x332d('0x1e')](function(_0x2ab79e){var _0x2ad064=_0xcdc4b6[_0x332d('0x48')]['get']({'plain':!![]});if(!_0x2ad064)throw new Error(_0x332d('0x46'));if(_0x2ad064[_0x332d('0x47')]===_0x332d('0x48')){var _0x14c073=_0x2ab79e['get']({'plain':!![]});var _0x41129a=_0x332d('0x21');return db[_0x332d('0x49')][_0x332d('0x42')]({'where':{'name':_0x41129a,'userProfileId':_0x2ad064[_0x332d('0x51')]},'raw':!![]})[_0x332d('0x1e')](function(_0x3c456a){if(_0x3c456a&&_0x3c456a['autoAssociation']===0x0){return db[_0x332d('0x22')]['create']({'name':_0x14c073[_0x332d('0x24')],'resourceId':_0x14c073['id'],'type':_0x3c456a[_0x332d('0x24')],'sectionId':_0x3c456a['id']},{})['then'](function(){return _0x2ab79e;});}else{return _0x2ab79e;}})[_0x332d('0x43')](function(_0x589544){logger[_0x332d('0x4b')](_0x332d('0x52'),_0x589544);throw _0x589544;});}return _0x2ab79e;});}})['then'](respondWithResult(_0x17ec91,0xc9))[_0x332d('0x43')](handleError(_0x17ec91,null));};exports['update']=function(_0x205b02,_0x580ac6){if(_0x205b02[_0x332d('0x45')]['id']){delete _0x205b02['body']['id'];}return db[_0x332d('0x3d')][_0x332d('0x42')]({'where':{'id':_0x205b02['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x580ac6,null))[_0x332d('0x1e')](saveUpdates(_0x205b02['body'],null))[_0x332d('0x1e')](respondWithResult(_0x580ac6,null))[_0x332d('0x43')](handleError(_0x580ac6,null));};exports['destroy']=function(_0x240c54,_0x13cd68){return db['JscriptyProject']['find']({'where':{'id':_0x240c54['params']['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x13cd68,null))[_0x332d('0x1e')](removeEntity(_0x13cd68,null))[_0x332d('0x43')](handleError(_0x13cd68,null));};exports[_0x332d('0x53')]=function(_0x4ebc83,_0x346657,_0x439c1f){var _0x5cc33e={'raw':!![],'where':{}};var _0x32167e={};var _0x162068={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x4ebc83[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x346657,null))[_0x332d('0x1e')](function(_0x2c2915){if(_0x2c2915){_0x32167e[_0x332d('0x2b')]=_[_0x332d('0x2d')](db[_0x332d('0x55')]['rawAttributes']);_0x32167e[_0x332d('0x2c')]=_['keys'](_0x4ebc83['query']);_0x32167e[_0x332d('0x37')]=_[_0x332d('0x2e')](_0x32167e[_0x332d('0x2b')],_0x32167e[_0x332d('0x2c')]);_0x5cc33e[_0x332d('0x2f')]=_[_0x332d('0x2e')](_0x32167e[_0x332d('0x2b')],qs['fields'](_0x4ebc83[_0x332d('0x2c')]['fields']));_0x5cc33e['attributes']=_0x5cc33e[_0x332d('0x2f')][_0x332d('0x4e')]?_0x5cc33e[_0x332d('0x2f')]:_0x32167e[_0x332d('0x2b')];if(!_0x4ebc83[_0x332d('0x2c')][_0x332d('0x31')](_0x332d('0x32'))){_0x5cc33e['limit']=qs[_0x332d('0x33')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x33')]);_0x5cc33e[_0x332d('0x18')]=qs[_0x332d('0x18')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x18')]);}_0x5cc33e[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x4ebc83[_0x332d('0x2c')][_0x332d('0x35')]);_0x5cc33e[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x4ebc83['query'],_0x32167e['filters']));_0x5cc33e[_0x332d('0x36')]['ProjectId']=_0x2c2915['id'];if(_0x4ebc83['query'][_0x332d('0x39')]){_0x5cc33e[_0x332d('0x36')]=_[_0x332d('0x3a')](_0x5cc33e['where'],{'$or':_[_0x332d('0x26')](_0x5cc33e[_0x332d('0x2f')],function(_0x54ed46){var _0x472a48={};_0x472a48[_0x54ed46]={'$like':'%'+_0x4ebc83[_0x332d('0x2c')]['filter']+'%'};return _0x472a48;})});}_0x5cc33e=_[_0x332d('0x3a')]({},_0x5cc33e,_0x4ebc83[_0x332d('0x3c')]);return db[_0x332d('0x55')][_0x332d('0x1a')]({'where':_0x5cc33e[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x54d861){_0x162068[_0x332d('0x1a')]=_0x54d861;if(_0x4ebc83[_0x332d('0x2c')][_0x332d('0x3e')]){_0x5cc33e[_0x332d('0x3f')]=[{'all':!![]}];}return db[_0x332d('0x55')][_0x332d('0x56')](_0x5cc33e);})[_0x332d('0x1e')](function(_0x50d7c7){_0x162068['rows']=_0x50d7c7;return _0x162068;});}})[_0x332d('0x1e')](respondWithFilteredResult(_0x346657,_0x5cc33e))[_0x332d('0x43')](handleError(_0x346657,null));};exports[_0x332d('0x57')]=function(_0x28b42d,_0x2a14bd,_0x1594f1){var _0x8bcfea={'raw':!![],'where':{}};var _0x42464d={};var _0x41700b={'count':0x0,'rows':[]};return db[_0x332d('0x3d')][_0x332d('0x54')]({'where':{'id':_0x28b42d[_0x332d('0x4d')]['id']}})[_0x332d('0x1e')](handleEntityNotFound(_0x2a14bd,null))['then'](function(_0x5646df){if(_0x5646df){_0x42464d[_0x332d('0x2b')]=_[_0x332d('0x2d')](db['JscriptyAnswerReport'][_0x332d('0x27')]);_0x42464d['query']=_[_0x332d('0x2d')](_0x28b42d[_0x332d('0x2c')]);_0x42464d['filters']=_[_0x332d('0x2e')](_0x42464d[_0x332d('0x2b')],_0x42464d[_0x332d('0x2c')]);_0x8bcfea['attributes']=_['intersection'](_0x42464d[_0x332d('0x2b')],qs[_0x332d('0x30')](_0x28b42d['query'][_0x332d('0x30')]));_0x8bcfea[_0x332d('0x2f')]=_0x8bcfea[_0x332d('0x2f')][_0x332d('0x4e')]?_0x8bcfea['attributes']:_0x42464d['model'];if(!_0x28b42d[_0x332d('0x2c')]['hasOwnProperty'](_0x332d('0x32'))){_0x8bcfea[_0x332d('0x33')]=qs[_0x332d('0x33')](_0x28b42d['query'][_0x332d('0x33')]);_0x8bcfea['offset']=qs['offset'](_0x28b42d[_0x332d('0x2c')][_0x332d('0x18')]);}_0x8bcfea[_0x332d('0x34')]=qs[_0x332d('0x35')](_0x28b42d[_0x332d('0x2c')][_0x332d('0x35')]);_0x8bcfea[_0x332d('0x36')]=qs[_0x332d('0x37')](_[_0x332d('0x38')](_0x28b42d[_0x332d('0x2c')],_0x42464d[_0x332d('0x37')]));_0x8bcfea['where'][_0x332d('0x58')]=_0x5646df['id'];if(_0x28b42d[_0x332d('0x2c')][_0x332d('0x39')]){_0x8bcfea[_0x332d('0x36')]=_['merge'](_0x8bcfea[_0x332d('0x36')],{'$or':_[_0x332d('0x26')](_0x8bcfea[_0x332d('0x2f')],function(_0x4c37cf){var _0x56f9a9={};_0x56f9a9[_0x4c37cf]={'$like':'%'+_0x28b42d[_0x332d('0x2c')]['filter']+'%'};return _0x56f9a9;})});}_0x8bcfea=_[_0x332d('0x3a')]({},_0x8bcfea,_0x28b42d['options']);return db[_0x332d('0x59')][_0x332d('0x1a')]({'where':_0x8bcfea[_0x332d('0x36')]})[_0x332d('0x1e')](function(_0x505e78){_0x41700b['count']=_0x505e78;if(_0x28b42d[_0x332d('0x2c')]['includeAll']){_0x8bcfea[_0x332d('0x3f')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x332d('0x56')](_0x8bcfea);})[_0x332d('0x1e')](function(_0x576836){_0x41700b[_0x332d('0x40')]=_0x576836;return _0x41700b;});}})['then'](respondWithFilteredResult(_0x2a14bd,_0x8bcfea))[_0x332d('0x43')](handleError(_0x2a14bd,null));};function char(_0x40ccef){return _0x332d('0x5a')===typeof _0x40ccef?String[_0x332d('0x5b')]['apply'](null,arguments):_0x40ccef;}function needsEncapsulation(_0x2d4354){return!!_0x2d4354&&(_0x2d4354['toString']()['indexOf'](char(0xd))>=0x0||_0x2d4354['toString']()['indexOf'](char(0xa))>=0x0||_0x2d4354[_0x332d('0x5c')]()[_0x332d('0x5d')](char(0x2c))>=0x0||_0x2d4354[_0x332d('0x5c')]()[_0x332d('0x5d')](char(0x22))>=0x0);}function encapsulate(_0x147919){var _0x2ec517=char(0x22),_0x32952a='\x5c'+char(0x22),_0x2d5e9c=_0x147919['toString']()['replace'](new RegExp(_0x2ec517,'g'),_0x32952a);return _0x2ec517+_0x2d5e9c+_0x2ec517;}exports[_0x332d('0x5e')]=function(_0x1af9ba,_0x5df938,_0x33bbbd){var _0x45fa51,_0x5d4717;var _0x36cce0={'where':{'ProjectId':_0x1af9ba[_0x332d('0x4d')]['id']}};if(_0x1af9ba[_0x332d('0x2c')][_0x332d('0x5f')]){_0x36cce0[_0x332d('0x36')][_0x332d('0x60')]=JSON['parse'](_0x1af9ba['query']['startTime']);}return db[_0x332d('0x55')]['findAll'](_0x36cce0)['then'](handleEntityNotFound(_0x5df938,null))[_0x332d('0x1e')](function(_0x1d7b1a){if(_0x1d7b1a){_0x45fa51=_0x1d7b1a;return db[_0x332d('0x61')][_0x332d('0x56')]({'where':{'SessionId':{'$in':_[_0x332d('0x26')](_0x45fa51,'id')},'ProjectId':_0x1af9ba[_0x332d('0x4d')]['id']},'order':_0x332d('0x62')});}})[_0x332d('0x1e')](handleEntityNotFound(_0x5df938,null))[_0x332d('0x1e')](function(_0x1cc669){if(_0x1cc669){_0x5d4717=_0x1cc669;var _0xfdaf29={};for(var _0xdc17a=0x0,_0xedcf5f=_0x5d4717[_0x332d('0x4e')];_0xdc17a<_0xedcf5f;_0xdc17a++){if(!_0xfdaf29[_0x332d('0x31')](_0x5d4717[_0xdc17a][_0x332d('0x63')])){_0xfdaf29[_0x5d4717[_0xdc17a][_0x332d('0x63')]]=needsEncapsulation(_0x5d4717[_0xdc17a][_0x332d('0x64')])?encapsulate(_0x5d4717[_0xdc17a][_0x332d('0x64')]):_0x5d4717[_0xdc17a]['question'];}}var _0x5bc8a3=[],_0x11b311={};for(var _0x54afb5=0x0,_0x296f7e=_0x45fa51[_0x332d('0x4e')];_0x54afb5<_0x296f7e;_0x54afb5++){_0x11b311={'ProjectId':_0x1af9ba[_0x332d('0x4d')]['id'],'SessionId':_0x45fa51[_0x54afb5]['id'],'StartTime':moment(_0x45fa51[_0x54afb5]['starttime'])[_0x332d('0x65')](_0x332d('0x66'))};for(var _0x14c744=0x0,_0x3dd3c0=_0x5d4717[_0x332d('0x4e')];_0x14c744<_0x3dd3c0;_0x14c744++){if(_0x5d4717[_0x14c744][_0x332d('0x67')]==_0x45fa51[_0x54afb5]['id']&&_0xfdaf29[_0x332d('0x31')](_0x5d4717[_0x14c744]['questionId'])){_0x11b311[_0xfdaf29[_0x5d4717[_0x14c744][_0x332d('0x63')]]]=_0x5d4717[_0x14c744][_0x332d('0x68')];}}for(var _0x2d2438 in _0xfdaf29){if(!_0x11b311[_0x332d('0x31')](_0xfdaf29[_0x2d2438])){_0x11b311[_0xfdaf29[_0x2d2438]]=null;}}_0x5bc8a3[_0x332d('0x69')](_0x11b311);}return _0x5bc8a3;}})[_0x332d('0x1e')](function(_0x188128){if(!_['isEmpty'](_0x188128)){var _0x55db63=toCsv(_0x188128);var _0x478424=Date[_0x332d('0x6a')]();fs[_0x332d('0x6b')](util[_0x332d('0x65')](_0x332d('0x6c'),_0x1af9ba[_0x332d('0x4d')]['id'],_0x478424),_0x55db63);_0x5df938[_0x332d('0x6d')]('Content-disposition',_0x332d('0x6e')+util['format'](_0x332d('0x6f'),_0x1af9ba[_0x332d('0x4d')]['id'],_0x478424));_0x5df938[_0x332d('0x6d')](_0x332d('0x70'),'text/csv');return _0x5df938[_0x332d('0x71')](util[_0x332d('0x65')](_0x332d('0x6c'),_0x1af9ba[_0x332d('0x4d')]['id'],_0x478424));}else{return _0x5df938[_0x332d('0x72')](0xcc);}})[_0x332d('0x43')](handleError(_0x5df938,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 6ca5c05..1a99e03 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 _0x7edb=['define','JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','path','./jscriptyProject.attributes','exports'];(function(_0xc7add,_0xd8e89c){var _0x39d0a0=function(_0x18f387){while(--_0x18f387){_0xc7add['push'](_0xc7add['shift']());}};_0x39d0a0(++_0xd8e89c);}(_0x7edb,0x158));var _0xb7ed=function(_0x59ad14,_0x47f930){_0x59ad14=_0x59ad14-0x0;var _0x27e236=_0x7edb[_0x59ad14];return _0x27e236;};'use strict';var _=require('lodash');var util=require(_0xb7ed('0x0'));var logger=require(_0xb7ed('0x1'))(_0xb7ed('0x2'));var moment=require(_0xb7ed('0x3'));var BPromise=require(_0xb7ed('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7ed('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb7ed('0x6'));module[_0xb7ed('0x7')]=function(_0x2aa67d,_0x246cfa){return _0x2aa67d[_0xb7ed('0x8')](_0xb7ed('0x9'),attributes,{'tableName':_0xb7ed('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce1a=['jscripty_projects','lodash','moment','bluebird','request-promise','path','rimraf','./jscriptyProject.attributes','define','JscriptyProject'];(function(_0x5a2ccb,_0x4e11be){var _0x3c0045=function(_0xe182af){while(--_0xe182af){_0x5a2ccb['push'](_0x5a2ccb['shift']());}};_0x3c0045(++_0x4e11be);}(_0xce1a,0xbf));var _0xace1=function(_0x2ad665,_0x228972){_0x2ad665=_0x2ad665-0x0;var _0x561be0=_0xce1a[_0x2ad665];return _0x561be0;};'use strict';var _=require(_0xace1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xace1('0x1'));var BPromise=require(_0xace1('0x2'));var rp=require(_0xace1('0x3'));var fs=require('fs');var path=require(_0xace1('0x4'));var rimraf=require(_0xace1('0x5'));var config=require('../../config/environment');var attributes=require(_0xace1('0x6'));module['exports']=function(_0x4becaf,_0x55bc3e){return _0x4becaf[_0xace1('0x7')](_0xace1('0x8'),attributes,{'tableName':_0xace1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 68e2b61..f0afd24 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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x32c8ed,_0x45fef2){var _0x580764=function(_0xeb440e){while(--_0xeb440e){_0x32c8ed['push'](_0x32c8ed['shift']());}};_0x580764(++_0x45fef2);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 6d32c95..bb1c602 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 _0x5d77=['isAuthenticated','index','/describe','show','create','delete','/:id','destroy','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get'];(function(_0x3d2e4f,_0x139a5e){var _0x4ae0ec=function(_0x3eea67){while(--_0x3eea67){_0x3d2e4f['push'](_0x3d2e4f['shift']());}};_0x4ae0ec(++_0x139a5e);}(_0x5d77,0xda));var _0x75d7=function(_0x201a67,_0x2688e7){_0x201a67=_0x201a67-0x0;var _0x123634=_0x5d77[_0x201a67];return _0x123634;};'use strict';var multer=require('multer');var util=require(_0x75d7('0x0'));var path=require(_0x75d7('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x75d7('0x2'));var interaction=require(_0x75d7('0x3'));var config=require(_0x75d7('0x4'));var controller=require(_0x75d7('0x5'));router[_0x75d7('0x6')]('/',auth[_0x75d7('0x7')](),controller[_0x75d7('0x8')]);router[_0x75d7('0x6')](_0x75d7('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x75d7('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x75d7('0xa')]);router['post']('/',auth[_0x75d7('0x7')](),controller[_0x75d7('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x75d7('0xc')](_0x75d7('0xd'),auth['isAuthenticated'](),controller[_0x75d7('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8b0a=['/describe','isAuthenticated','/:id','show','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8b0a,0x14c));var _0xa8b0=function(_0x4ff121,_0x3ade9c){_0x4ff121=_0x4ff121-0x0;var _0x2987cf=_0x8b0a[_0x4ff121];return _0x2987cf;};'use strict';var multer=require('multer');var util=require(_0xa8b0('0x0'));var path=require(_0xa8b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8b0('0x2'));var router=express[_0xa8b0('0x3')]();var fs_extra=require(_0xa8b0('0x4'));var auth=require(_0xa8b0('0x5'));var interaction=require(_0xa8b0('0x6'));var config=require('../../config/environment');var controller=require(_0xa8b0('0x7'));router[_0xa8b0('0x8')]('/',auth['isAuthenticated'](),controller[_0xa8b0('0x9')]);router[_0xa8b0('0x8')](_0xa8b0('0xa'),auth[_0xa8b0('0xb')](),controller['describe']);router['get'](_0xa8b0('0xc'),auth['isAuthenticated'](),controller[_0xa8b0('0xd')]);router['post']('/',auth[_0xa8b0('0xb')](),controller['create']);router[_0xa8b0('0xe')](_0xa8b0('0xc'),auth[_0xa8b0('0xb')](),controller[_0xa8b0('0xf')]);router[_0xa8b0('0x10')](_0xa8b0('0xc'),auth[_0xa8b0('0xb')](),controller[_0xa8b0('0x11')]);module[_0xa8b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index eb746a2..856d531 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(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7a54,0x106));var _0x47a5=function(_0x31cb80,_0x1dafdf){_0x31cb80=_0x31cb80-0x0;var _0xe9ee79=_0x7a54[_0x31cb80];return _0xe9ee79;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x7a54,0x106));var _0x47a5=function(_0xb66c01,_0x295aaf){_0xb66c01=_0xb66c01-0x0;var _0x4f62f3=_0x7a54[_0xb66c01];return _0x4f62f3;};'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 954b57d..1a5e807 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 _0x7c19=['body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','name','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','create'];(function(_0x34032c,_0x5c591b){var _0x320c6e=function(_0x4effb5){while(--_0x4effb5){_0x34032c['push'](_0x34032c['shift']());}};_0x320c6e(++_0x5c591b);}(_0x7c19,0x9c));var _0x97c1=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x7c19[_0x1762b4];return _0x29beda;};'use strict';var emlformat=require(_0x97c1('0x0'));var rimraf=require(_0x97c1('0x1'));var zipdir=require(_0x97c1('0x2'));var jsonpatch=require(_0x97c1('0x3'));var rp=require(_0x97c1('0x4'));var moment=require(_0x97c1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x97c1('0x6'));var util=require(_0x97c1('0x7'));var path=require(_0x97c1('0x8'));var sox=require('sox');var csv=require(_0x97c1('0x9'));var ejs=require(_0x97c1('0xa'));var fs=require('fs');var fs_extra=require(_0x97c1('0xb'));var _=require(_0x97c1('0xc'));var squel=require(_0x97c1('0xd'));var crypto=require(_0x97c1('0xe'));var jsforce=require(_0x97c1('0xf'));var deskjs=require(_0x97c1('0x10'));var toCsv=require(_0x97c1('0x9'));var querystring=require(_0x97c1('0x11'));var Papa=require('papaparse');var Redis=require(_0x97c1('0x12'));var authService=require(_0x97c1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x97c1('0x14'));var hardwareService=require(_0x97c1('0x15'));var logger=require(_0x97c1('0x16'))('api');var utils=require(_0x97c1('0x17'));var config=require(_0x97c1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x97c1('0x19'))['db'];function respondWithStatusCode(_0x52841f,_0x5f22f6){_0x5f22f6=_0x5f22f6||0xcc;return function(_0x126581){if(_0x126581){return _0x52841f['sendStatus'](_0x5f22f6);}return _0x52841f[_0x97c1('0x1a')](_0x5f22f6)[_0x97c1('0x1b')]();};}function respondWithResult(_0x5ac805,_0x1a01cb){_0x1a01cb=_0x1a01cb||0xc8;return function(_0x419711){if(_0x419711){return _0x5ac805[_0x97c1('0x1a')](_0x1a01cb)[_0x97c1('0x1c')](_0x419711);}};}function respondWithFilteredResult(_0x16eafb,_0x40ac08){return function(_0xe764bd){if(_0xe764bd){var _0x37fc99=typeof _0x40ac08[_0x97c1('0x1d')]==='undefined'&&typeof _0x40ac08[_0x97c1('0x1e')]===_0x97c1('0x1f');var _0x550a90=_0xe764bd['count'];var _0x21e38f=_0x37fc99?0x0:_0x40ac08['offset'];var _0xe373a1=_0x37fc99?_0xe764bd[_0x97c1('0x20')]:_0x40ac08[_0x97c1('0x1d')]+_0x40ac08['limit'];var _0x18b0e5;if(_0xe373a1>=_0x550a90){_0xe373a1=_0x550a90;_0x18b0e5=0xc8;}else{_0x18b0e5=0xce;}_0x16eafb[_0x97c1('0x1a')](_0x18b0e5);return _0x16eafb[_0x97c1('0x21')](_0x97c1('0x22'),_0x21e38f+'-'+_0xe373a1+'/'+_0x550a90)[_0x97c1('0x1c')](_0xe764bd);}return null;};}function patchUpdates(_0x5203ab){return function(_0x31877d){try{jsonpatch[_0x97c1('0x23')](_0x31877d,_0x5203ab,!![]);}catch(_0x33dc2d){return BPromise[_0x97c1('0x24')](_0x33dc2d);}return _0x31877d['save']();};}function saveUpdates(_0x5f5568,_0x1a095b){return function(_0x4106ef){if(_0x4106ef){return _0x4106ef[_0x97c1('0x25')](_0x5f5568)[_0x97c1('0x26')](function(_0x445dd8){return _0x445dd8;});}return null;};}function removeEntity(_0x4db508,_0x1ba2ef){return function(_0x2d3e3c){if(_0x2d3e3c){return _0x2d3e3c[_0x97c1('0x27')]()[_0x97c1('0x26')](function(){_0x4db508[_0x97c1('0x1a')](0xcc)[_0x97c1('0x1b')]();});}};}function handleEntityNotFound(_0x4b096f,_0x40dde3){return function(_0x255da2){if(!_0x255da2){_0x4b096f['sendStatus'](0x194);}return _0x255da2;};}function handleError(_0x10f76a,_0x1a8bdf){_0x1a8bdf=_0x1a8bdf||0x1f4;return function(_0x5374f1){logger[_0x97c1('0x28')](_0x5374f1['stack']);if(_0x5374f1[_0x97c1('0x29')]){delete _0x5374f1[_0x97c1('0x29')];}_0x10f76a[_0x97c1('0x1a')](_0x1a8bdf)['send'](_0x5374f1);};}exports[_0x97c1('0x2a')]=function(_0x258b55,_0x310ad0){var _0x43a1b0={},_0x1f55dc={},_0x51b46f={'count':0x0,'rows':[]};var _0x46b0ee=_[_0x97c1('0x2b')](db[_0x97c1('0x2c')][_0x97c1('0x2d')],function(_0x976b80){return{'name':_0x976b80[_0x97c1('0x2e')],'type':_0x976b80[_0x97c1('0x2f')][_0x97c1('0x30')]};});_0x1f55dc[_0x97c1('0x31')]=_[_0x97c1('0x2b')](_0x46b0ee,'name');_0x1f55dc[_0x97c1('0x32')]=_[_0x97c1('0x33')](_0x258b55['query']);_0x1f55dc['filters']=_[_0x97c1('0x34')](_0x1f55dc['model'],_0x1f55dc[_0x97c1('0x32')]);_0x43a1b0['attributes']=_['intersection'](_0x1f55dc[_0x97c1('0x31')],qs[_0x97c1('0x35')](_0x258b55[_0x97c1('0x32')]['fields']));_0x43a1b0[_0x97c1('0x36')]=_0x43a1b0[_0x97c1('0x36')][_0x97c1('0x37')]?_0x43a1b0[_0x97c1('0x36')]:_0x1f55dc[_0x97c1('0x31')];if(!_0x258b55[_0x97c1('0x32')][_0x97c1('0x38')](_0x97c1('0x39'))){_0x43a1b0[_0x97c1('0x1e')]=qs[_0x97c1('0x1e')](_0x258b55[_0x97c1('0x32')][_0x97c1('0x1e')]);_0x43a1b0[_0x97c1('0x1d')]=qs[_0x97c1('0x1d')](_0x258b55[_0x97c1('0x32')][_0x97c1('0x1d')]);}_0x43a1b0[_0x97c1('0x3a')]=qs['sort'](_0x258b55[_0x97c1('0x32')][_0x97c1('0x3b')]);_0x43a1b0[_0x97c1('0x3c')]=qs[_0x97c1('0x3d')](_['pick'](_0x258b55['query'],_0x1f55dc[_0x97c1('0x3d')]),_0x46b0ee);if(_0x258b55['query'][_0x97c1('0x3e')]){_0x43a1b0['where']=_[_0x97c1('0x3f')](_0x43a1b0[_0x97c1('0x3c')],{'$or':_[_0x97c1('0x2b')](_0x46b0ee,function(_0x28a911){if(_0x28a911[_0x97c1('0x2f')]!==_0x97c1('0x40')){var _0x30b326={};_0x30b326[_0x28a911[_0x97c1('0x29')]]={'$like':'%'+_0x258b55[_0x97c1('0x32')][_0x97c1('0x3e')]+'%'};return _0x30b326;}})});}_0x43a1b0=_[_0x97c1('0x3f')]({},_0x43a1b0,_0x258b55[_0x97c1('0x41')]);var _0x280207={'where':_0x43a1b0[_0x97c1('0x3c')]};return db['JscriptyQuestionReport'][_0x97c1('0x20')](_0x280207)[_0x97c1('0x26')](function(_0x52d9c9){_0x51b46f['count']=_0x52d9c9;if(_0x258b55[_0x97c1('0x32')][_0x97c1('0x42')]){_0x43a1b0[_0x97c1('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x43a1b0);})[_0x97c1('0x26')](function(_0x380aff){_0x51b46f[_0x97c1('0x44')]=_0x380aff;return _0x51b46f;})['then'](respondWithFilteredResult(_0x310ad0,_0x43a1b0))[_0x97c1('0x45')](handleError(_0x310ad0,null));};exports[_0x97c1('0x46')]=function(_0x21da70,_0x3d630f){var _0x50c92c={'raw':!![],'where':{'id':_0x21da70['params']['id']}},_0xb267b0={};_0xb267b0['model']=_[_0x97c1('0x33')](db[_0x97c1('0x2c')][_0x97c1('0x2d')]);_0xb267b0['query']=_[_0x97c1('0x33')](_0x21da70[_0x97c1('0x32')]);_0xb267b0['filters']=_[_0x97c1('0x34')](_0xb267b0[_0x97c1('0x31')],_0xb267b0[_0x97c1('0x32')]);_0x50c92c[_0x97c1('0x36')]=_[_0x97c1('0x34')](_0xb267b0['model'],qs[_0x97c1('0x35')](_0x21da70['query'][_0x97c1('0x35')]));_0x50c92c['attributes']=_0x50c92c[_0x97c1('0x36')][_0x97c1('0x37')]?_0x50c92c[_0x97c1('0x36')]:_0xb267b0[_0x97c1('0x31')];if(_0x21da70[_0x97c1('0x32')]['includeAll']){_0x50c92c[_0x97c1('0x43')]=[{'all':!![]}];}_0x50c92c=_[_0x97c1('0x3f')]({},_0x50c92c,_0x21da70[_0x97c1('0x41')]);return db[_0x97c1('0x2c')]['find'](_0x50c92c)[_0x97c1('0x26')](handleEntityNotFound(_0x3d630f,null))[_0x97c1('0x26')](respondWithResult(_0x3d630f,null))[_0x97c1('0x45')](handleError(_0x3d630f,null));};exports[_0x97c1('0x47')]=function(_0x5a9d4c,_0x1ac7b8){return db[_0x97c1('0x2c')]['create'](_0x5a9d4c[_0x97c1('0x48')],{})['then'](respondWithResult(_0x1ac7b8,0xc9))[_0x97c1('0x45')](handleError(_0x1ac7b8,null));};exports['update']=function(_0x2159a4,_0x5f03a6){if(_0x2159a4[_0x97c1('0x48')]['id']){delete _0x2159a4[_0x97c1('0x48')]['id'];}return db[_0x97c1('0x2c')][_0x97c1('0x49')]({'where':{'id':_0x2159a4[_0x97c1('0x4a')]['id']}})[_0x97c1('0x26')](handleEntityNotFound(_0x5f03a6,null))[_0x97c1('0x26')](saveUpdates(_0x2159a4[_0x97c1('0x48')],null))['then'](respondWithResult(_0x5f03a6,null))[_0x97c1('0x45')](handleError(_0x5f03a6,null));};exports[_0x97c1('0x27')]=function(_0x485a0c,_0x19382d){return db['JscriptyQuestionReport'][_0x97c1('0x49')]({'where':{'id':_0x485a0c['params']['id']}})[_0x97c1('0x26')](handleEntityNotFound(_0x19382d,null))['then'](removeEntity(_0x19382d,null))[_0x97c1('0x45')](handleError(_0x19382d,null));};exports[_0x97c1('0x4b')]=function(_0x4db4b3,_0x367c3c){return db['JscriptyQuestionReport'][_0x97c1('0x4b')]()[_0x97c1('0x26')](respondWithResult(_0x367c3c,null))['catch'](handleError(_0x367c3c,null));}; \ No newline at end of file +var _0x9c34=['nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','show','params','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','name','send','map','JscriptyQuestionReport','rawAttributes','fieldName','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x9c34,0x1a6));var _0x49c3=function(_0x2acc11,_0x477b1c){_0x2acc11=_0x2acc11-0x0;var _0x3b1244=_0x9c34[_0x2acc11];return _0x3b1244;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x49c3('0x0'));var zipdir=require(_0x49c3('0x1'));var jsonpatch=require(_0x49c3('0x2'));var rp=require(_0x49c3('0x3'));var moment=require(_0x49c3('0x4'));var BPromise=require(_0x49c3('0x5'));var Mustache=require(_0x49c3('0x6'));var util=require(_0x49c3('0x7'));var path=require(_0x49c3('0x8'));var sox=require(_0x49c3('0x9'));var csv=require(_0x49c3('0xa'));var ejs=require(_0x49c3('0xb'));var fs=require('fs');var fs_extra=require(_0x49c3('0xc'));var _=require(_0x49c3('0xd'));var squel=require(_0x49c3('0xe'));var crypto=require(_0x49c3('0xf'));var jsforce=require(_0x49c3('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x49c3('0x11'));var Papa=require(_0x49c3('0x12'));var Redis=require(_0x49c3('0x13'));var authService=require(_0x49c3('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c3('0x15'))(_0x49c3('0x16'));var utils=require(_0x49c3('0x17'));var config=require(_0x49c3('0x18'));var licenseUtil=require(_0x49c3('0x19'));var db=require(_0x49c3('0x1a'))['db'];function respondWithStatusCode(_0x373542,_0x2b6a36){_0x2b6a36=_0x2b6a36||0xcc;return function(_0x3b5a31){if(_0x3b5a31){return _0x373542['sendStatus'](_0x2b6a36);}return _0x373542[_0x49c3('0x1b')](_0x2b6a36)[_0x49c3('0x1c')]();};}function respondWithResult(_0x4289cd,_0x3aab03){_0x3aab03=_0x3aab03||0xc8;return function(_0x490b01){if(_0x490b01){return _0x4289cd[_0x49c3('0x1b')](_0x3aab03)[_0x49c3('0x1d')](_0x490b01);}};}function respondWithFilteredResult(_0x5eca54,_0x15f949){return function(_0xefd9e5){if(_0xefd9e5){var _0x561a03=typeof _0x15f949[_0x49c3('0x1e')]===_0x49c3('0x1f')&&typeof _0x15f949[_0x49c3('0x20')]===_0x49c3('0x1f');var _0x969a29=_0xefd9e5[_0x49c3('0x21')];var _0x582012=_0x561a03?0x0:_0x15f949[_0x49c3('0x1e')];var _0x2a1435=_0x561a03?_0xefd9e5[_0x49c3('0x21')]:_0x15f949[_0x49c3('0x1e')]+_0x15f949[_0x49c3('0x20')];var _0xbc479f;if(_0x2a1435>=_0x969a29){_0x2a1435=_0x969a29;_0xbc479f=0xc8;}else{_0xbc479f=0xce;}_0x5eca54['status'](_0xbc479f);return _0x5eca54[_0x49c3('0x22')](_0x49c3('0x23'),_0x582012+'-'+_0x2a1435+'/'+_0x969a29)['json'](_0xefd9e5);}return null;};}function patchUpdates(_0x49b493){return function(_0x355e10){try{jsonpatch[_0x49c3('0x24')](_0x355e10,_0x49b493,!![]);}catch(_0x33a7a5){return BPromise[_0x49c3('0x25')](_0x33a7a5);}return _0x355e10[_0x49c3('0x26')]();};}function saveUpdates(_0x3b46cd,_0x23d2fc){return function(_0x597407){if(_0x597407){return _0x597407[_0x49c3('0x27')](_0x3b46cd)['then'](function(_0x4dac8d){return _0x4dac8d;});}return null;};}function removeEntity(_0x3303e3,_0x34b058){return function(_0x49dd41){if(_0x49dd41){return _0x49dd41[_0x49c3('0x28')]()['then'](function(){_0x3303e3[_0x49c3('0x1b')](0xcc)[_0x49c3('0x1c')]();});}};}function handleEntityNotFound(_0x5784c8,_0x554571){return function(_0x2b605e){if(!_0x2b605e){_0x5784c8[_0x49c3('0x29')](0x194);}return _0x2b605e;};}function handleError(_0xe58c42,_0x7404f9){_0x7404f9=_0x7404f9||0x1f4;return function(_0x45c1e4){logger[_0x49c3('0x2a')](_0x45c1e4['stack']);if(_0x45c1e4[_0x49c3('0x2b')]){delete _0x45c1e4[_0x49c3('0x2b')];}_0xe58c42[_0x49c3('0x1b')](_0x7404f9)[_0x49c3('0x2c')](_0x45c1e4);};}exports['index']=function(_0x2f15a1,_0x5b4e76){var _0x53ba27={},_0x1e1013={},_0x12c363={'count':0x0,'rows':[]};var _0x4863f8=_[_0x49c3('0x2d')](db[_0x49c3('0x2e')][_0x49c3('0x2f')],function(_0x4db6b0){return{'name':_0x4db6b0[_0x49c3('0x30')],'type':_0x4db6b0[_0x49c3('0x31')]['key']};});_0x1e1013['model']=_[_0x49c3('0x2d')](_0x4863f8,_0x49c3('0x2b'));_0x1e1013[_0x49c3('0x32')]=_[_0x49c3('0x33')](_0x2f15a1[_0x49c3('0x32')]);_0x1e1013['filters']=_[_0x49c3('0x34')](_0x1e1013[_0x49c3('0x35')],_0x1e1013[_0x49c3('0x32')]);_0x53ba27['attributes']=_[_0x49c3('0x34')](_0x1e1013[_0x49c3('0x35')],qs[_0x49c3('0x36')](_0x2f15a1[_0x49c3('0x32')][_0x49c3('0x36')]));_0x53ba27[_0x49c3('0x37')]=_0x53ba27[_0x49c3('0x37')][_0x49c3('0x38')]?_0x53ba27[_0x49c3('0x37')]:_0x1e1013[_0x49c3('0x35')];if(!_0x2f15a1[_0x49c3('0x32')][_0x49c3('0x39')](_0x49c3('0x3a'))){_0x53ba27[_0x49c3('0x20')]=qs['limit'](_0x2f15a1[_0x49c3('0x32')][_0x49c3('0x20')]);_0x53ba27[_0x49c3('0x1e')]=qs[_0x49c3('0x1e')](_0x2f15a1['query'][_0x49c3('0x1e')]);}_0x53ba27[_0x49c3('0x3b')]=qs['sort'](_0x2f15a1[_0x49c3('0x32')][_0x49c3('0x3c')]);_0x53ba27[_0x49c3('0x3d')]=qs[_0x49c3('0x3e')](_[_0x49c3('0x3f')](_0x2f15a1['query'],_0x1e1013[_0x49c3('0x3e')]),_0x4863f8);if(_0x2f15a1[_0x49c3('0x32')]['filter']){_0x53ba27[_0x49c3('0x3d')]=_[_0x49c3('0x40')](_0x53ba27[_0x49c3('0x3d')],{'$or':_[_0x49c3('0x2d')](_0x4863f8,function(_0x180a94){if(_0x180a94[_0x49c3('0x31')]!==_0x49c3('0x41')){var _0x468f8c={};_0x468f8c[_0x180a94[_0x49c3('0x2b')]]={'$like':'%'+_0x2f15a1['query'][_0x49c3('0x42')]+'%'};return _0x468f8c;}})});}_0x53ba27=_[_0x49c3('0x40')]({},_0x53ba27,_0x2f15a1[_0x49c3('0x43')]);var _0x32f288={'where':_0x53ba27[_0x49c3('0x3d')]};return db[_0x49c3('0x2e')][_0x49c3('0x21')](_0x32f288)[_0x49c3('0x44')](function(_0x430d62){_0x12c363[_0x49c3('0x21')]=_0x430d62;if(_0x2f15a1[_0x49c3('0x32')][_0x49c3('0x45')]){_0x53ba27[_0x49c3('0x46')]=[{'all':!![]}];}return db[_0x49c3('0x2e')][_0x49c3('0x47')](_0x53ba27);})[_0x49c3('0x44')](function(_0x1d5ab6){_0x12c363[_0x49c3('0x48')]=_0x1d5ab6;return _0x12c363;})[_0x49c3('0x44')](respondWithFilteredResult(_0x5b4e76,_0x53ba27))['catch'](handleError(_0x5b4e76,null));};exports[_0x49c3('0x49')]=function(_0x3f63c5,_0x411c76){var _0x1fdd68={'raw':!![],'where':{'id':_0x3f63c5[_0x49c3('0x4a')]['id']}},_0x2edf8e={};_0x2edf8e['model']=_[_0x49c3('0x33')](db[_0x49c3('0x2e')]['rawAttributes']);_0x2edf8e['query']=_[_0x49c3('0x33')](_0x3f63c5['query']);_0x2edf8e[_0x49c3('0x3e')]=_[_0x49c3('0x34')](_0x2edf8e[_0x49c3('0x35')],_0x2edf8e['query']);_0x1fdd68[_0x49c3('0x37')]=_[_0x49c3('0x34')](_0x2edf8e[_0x49c3('0x35')],qs[_0x49c3('0x36')](_0x3f63c5[_0x49c3('0x32')][_0x49c3('0x36')]));_0x1fdd68[_0x49c3('0x37')]=_0x1fdd68['attributes'][_0x49c3('0x38')]?_0x1fdd68[_0x49c3('0x37')]:_0x2edf8e[_0x49c3('0x35')];if(_0x3f63c5[_0x49c3('0x32')][_0x49c3('0x45')]){_0x1fdd68[_0x49c3('0x46')]=[{'all':!![]}];}_0x1fdd68=_['merge']({},_0x1fdd68,_0x3f63c5['options']);return db[_0x49c3('0x2e')]['find'](_0x1fdd68)['then'](handleEntityNotFound(_0x411c76,null))[_0x49c3('0x44')](respondWithResult(_0x411c76,null))[_0x49c3('0x4b')](handleError(_0x411c76,null));};exports[_0x49c3('0x4c')]=function(_0x255e8e,_0x5d9ac3){return db[_0x49c3('0x2e')][_0x49c3('0x4c')](_0x255e8e[_0x49c3('0x4d')],{})[_0x49c3('0x44')](respondWithResult(_0x5d9ac3,0xc9))['catch'](handleError(_0x5d9ac3,null));};exports[_0x49c3('0x27')]=function(_0x2906fc,_0x13e8d0){if(_0x2906fc[_0x49c3('0x4d')]['id']){delete _0x2906fc['body']['id'];}return db[_0x49c3('0x2e')]['find']({'where':{'id':_0x2906fc[_0x49c3('0x4a')]['id']}})[_0x49c3('0x44')](handleEntityNotFound(_0x13e8d0,null))[_0x49c3('0x44')](saveUpdates(_0x2906fc[_0x49c3('0x4d')],null))['then'](respondWithResult(_0x13e8d0,null))[_0x49c3('0x4b')](handleError(_0x13e8d0,null));};exports[_0x49c3('0x28')]=function(_0x54b23a,_0x32fe7f){return db[_0x49c3('0x2e')][_0x49c3('0x4e')]({'where':{'id':_0x54b23a[_0x49c3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32fe7f,null))[_0x49c3('0x44')](removeEntity(_0x32fe7f,null))[_0x49c3('0x4b')](handleError(_0x32fe7f,null));};exports[_0x49c3('0x4f')]=function(_0x419daa,_0x45c3c0){return db[_0x49c3('0x2e')]['describe']()[_0x49c3('0x44')](respondWithResult(_0x45c3c0,null))[_0x49c3('0x4b')](handleError(_0x45c3c0,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 1a160a0..ef458cd 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 _0xe80e=['moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api'];(function(_0x38efde,_0x76f75c){var _0x2c1be8=function(_0x4e309c){while(--_0x4e309c){_0x38efde['push'](_0x38efde['shift']());}};_0x2c1be8(++_0x76f75c);}(_0xe80e,0x65));var _0xee80=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xe80e[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xee80('0x0'));var util=require('util');var logger=require(_0xee80('0x1'))(_0xee80('0x2'));var moment=require(_0xee80('0x3'));var BPromise=require(_0xee80('0x4'));var rp=require(_0xee80('0x5'));var fs=require('fs');var path=require(_0xee80('0x6'));var rimraf=require(_0xee80('0x7'));var config=require('../../config/environment');var attributes=require(_0xee80('0x8'));module[_0xee80('0x9')]=function(_0x46c803,_0x48b862){return _0x46c803[_0xee80('0xa')](_0xee80('0xb'),attributes,{'tableName':_0xee80('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9a8=['moment','bluebird','request-promise','./jscriptyQuestionReport.attributes','util','api'];(function(_0x3199a3,_0x12d786){var _0x19fc30=function(_0x2e9926){while(--_0x2e9926){_0x3199a3['push'](_0x3199a3['shift']());}};_0x19fc30(++_0x12d786);}(_0xb9a8,0xca));var _0x8b9a=function(_0x17bd7c,_0x7b76f6){_0x17bd7c=_0x17bd7c-0x0;var _0x16e8e7=_0xb9a8[_0x17bd7c];return _0x16e8e7;};'use strict';var _=require('lodash');var util=require(_0x8b9a('0x0'));var logger=require('../../config/logger')(_0x8b9a('0x1'));var moment=require(_0x8b9a('0x2'));var BPromise=require(_0x8b9a('0x3'));var rp=require(_0x8b9a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8b9a('0x5'));module['exports']=function(_0x3bbab0,_0x19b7c1){return _0x3bbab0['define']('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index f5d2219..eed6b64 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 _0x0741=['request','then','info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x23fcff,_0x5f38de){var _0x290d35=function(_0x383287){while(--_0x383287){_0x23fcff['push'](_0x23fcff['shift']());}};_0x290d35(++_0x5f38de);}(_0x0741,0x6c));var _0x1074=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x0741[_0x484e36];return _0xafc85d;};'use strict';var _=require('lodash');var util=require(_0x1074('0x0'));var moment=require(_0x1074('0x1'));var BPromise=require(_0x1074('0x2'));var rs=require(_0x1074('0x3'));var fs=require('fs');var Redis=require(_0x1074('0x4'));var db=require(_0x1074('0x5'))['db'];var utils=require(_0x1074('0x6'));var logger=require('../../config/logger')(_0x1074('0x7'));var config=require(_0x1074('0x8'));var jayson=require(_0x1074('0x9'));var client=jayson[_0x1074('0xa')][_0x1074('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x246c4b,_0x5cf91c,_0xebcd3e){return new BPromise(function(_0x1d7b55,_0x3ed85b){return client[_0x1074('0xc')](_0x246c4b,_0xebcd3e)[_0x1074('0xd')](function(_0x5d97fa){logger[_0x1074('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5cf91c,_0x1074('0xf'));logger['debug'](_0x1074('0x10'),_0x5cf91c,_0x1074('0xf'),JSON[_0x1074('0x11')](_0x5d97fa));if(_0x5d97fa[_0x1074('0x12')]){if(_0x5d97fa[_0x1074('0x12')][_0x1074('0x13')]===0x1f4){logger[_0x1074('0x12')](_0x1074('0x14'),_0x5cf91c,_0x5d97fa[_0x1074('0x12')][_0x1074('0x15')]);return _0x3ed85b(_0x5d97fa[_0x1074('0x12')][_0x1074('0x15')]);}logger[_0x1074('0x12')](_0x1074('0x14'),_0x5cf91c,_0x5d97fa[_0x1074('0x12')][_0x1074('0x15')]);return _0x1d7b55(_0x5d97fa[_0x1074('0x12')][_0x1074('0x15')]);}else{logger[_0x1074('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x5cf91c,_0x1074('0xf'));_0x1d7b55(_0x5d97fa[_0x1074('0x16')][_0x1074('0x15')]);}})[_0x1074('0x17')](function(_0x5c8398){logger[_0x1074('0x12')](_0x1074('0x14'),_0x5cf91c,_0x5c8398);_0x3ed85b(_0x5c8398);});});} \ No newline at end of file +var _0x6137=['message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x13b010,_0x5b869d){var _0xcdb923=function(_0x5ed641){while(--_0x5ed641){_0x13b010['push'](_0x13b010['shift']());}};_0xcdb923(++_0x5b869d);}(_0x6137,0x11c));var _0x7613=function(_0x343173,_0x667d1b){_0x343173=_0x343173-0x0;var _0x28be61=_0x6137[_0x343173];return _0x28be61;};'use strict';var _=require(_0x7613('0x0'));var util=require('util');var moment=require(_0x7613('0x1'));var BPromise=require(_0x7613('0x2'));var rs=require(_0x7613('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7613('0x4'))['db'];var utils=require(_0x7613('0x5'));var logger=require(_0x7613('0x6'))('rpc');var config=require(_0x7613('0x7'));var jayson=require(_0x7613('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x283b3b,_0x1e07d0,_0x38bb53){return new BPromise(function(_0x236678,_0x3a6e13){return client['request'](_0x283b3b,_0x38bb53)[_0x7613('0x9')](function(_0x486862){logger[_0x7613('0xa')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e07d0,'request\x20sent');logger[_0x7613('0xb')](_0x7613('0xc'),_0x1e07d0,_0x7613('0xd'),JSON[_0x7613('0xe')](_0x486862));if(_0x486862['error']){if(_0x486862[_0x7613('0xf')]['code']===0x1f4){logger[_0x7613('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e07d0,_0x486862[_0x7613('0xf')][_0x7613('0x10')]);return _0x3a6e13(_0x486862[_0x7613('0xf')][_0x7613('0x10')]);}logger[_0x7613('0xf')](_0x7613('0x11'),_0x1e07d0,_0x486862[_0x7613('0xf')]['message']);return _0x236678(_0x486862[_0x7613('0xf')][_0x7613('0x10')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1e07d0,_0x7613('0xd'));_0x236678(_0x486862[_0x7613('0x12')][_0x7613('0x10')]);}})[_0x7613('0x13')](function(_0x5b5485){logger['error'](_0x7613('0x11'),_0x1e07d0,_0x5b5485);_0x3a6e13(_0x5b5485);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 033dd1d..2f24028 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 _0x9822=['multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/questions','getQuestions','post','create','put','/:id','update','destroy','exports'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x9822,0x1a4));var _0x2982=function(_0x440516,_0xd84b69){_0x440516=_0x440516-0x0;var _0x570f72=_0x9822[_0x440516];return _0x570f72;};'use strict';var multer=require(_0x2982('0x0'));var util=require(_0x2982('0x1'));var path=require(_0x2982('0x2'));var timeout=require(_0x2982('0x3'));var express=require(_0x2982('0x4'));var router=express[_0x2982('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2982('0x6'));var config=require(_0x2982('0x7'));var controller=require('./jscriptySessionReport.controller');router[_0x2982('0x8')]('/',auth[_0x2982('0x9')](),controller['index']);router[_0x2982('0x8')](_0x2982('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x2982('0x8')]('/:id',auth[_0x2982('0x9')](),controller[_0x2982('0xb')]);router[_0x2982('0x8')](_0x2982('0xc'),auth[_0x2982('0x9')](),controller[_0x2982('0xd')]);router[_0x2982('0xe')]('/',auth[_0x2982('0x9')](),controller[_0x2982('0xf')]);router[_0x2982('0x10')](_0x2982('0x11'),auth['isAuthenticated'](),controller[_0x2982('0x12')]);router['delete'](_0x2982('0x11'),auth[_0x2982('0x9')](),controller[_0x2982('0x13')]);module[_0x2982('0x14')]=router; \ No newline at end of file +var _0x908b=['multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/questions','getQuestions','post','create','put','update','delete','destroy','exports'];(function(_0x55af8d,_0x4ad9a7){var _0x1bb7b5=function(_0x4bb105){while(--_0x4bb105){_0x55af8d['push'](_0x55af8d['shift']());}};_0x1bb7b5(++_0x4ad9a7);}(_0x908b,0x15e));var _0xb908=function(_0x11b9d1,_0x575179){_0x11b9d1=_0x11b9d1-0x0;var _0x4778db=_0x908b[_0x11b9d1];return _0x4778db;};'use strict';var multer=require(_0xb908('0x0'));var util=require('util');var path=require(_0xb908('0x1'));var timeout=require(_0xb908('0x2'));var express=require('express');var router=express[_0xb908('0x3')]();var fs_extra=require(_0xb908('0x4'));var auth=require(_0xb908('0x5'));var interaction=require(_0xb908('0x6'));var config=require(_0xb908('0x7'));var controller=require(_0xb908('0x8'));router[_0xb908('0x9')]('/',auth[_0xb908('0xa')](),controller[_0xb908('0xb')]);router[_0xb908('0x9')](_0xb908('0xc'),auth['isAuthenticated'](),controller[_0xb908('0xd')]);router[_0xb908('0x9')](_0xb908('0xe'),auth['isAuthenticated'](),controller[_0xb908('0xf')]);router['get'](_0xb908('0x10'),auth[_0xb908('0xa')](),controller[_0xb908('0x11')]);router[_0xb908('0x12')]('/',auth[_0xb908('0xa')](),controller[_0xb908('0x13')]);router[_0xb908('0x14')](_0xb908('0xe'),auth[_0xb908('0xa')](),controller[_0xb908('0x15')]);router[_0xb908('0x16')]('/:id',auth[_0xb908('0xa')](),controller[_0xb908('0x17')]);module[_0xb908('0x18')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index efba35f..7c6dd57 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 _0x3971=['YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format'];(function(_0x331298,_0x12341a){var _0x3824bc=function(_0x19449f){while(--_0x19449f){_0x331298['push'](_0x331298['shift']());}};_0x3824bc(++_0x12341a);}(_0x3971,0x7a));var _0x1397=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x3971[_0x5a776b];return _0xbbef59;};'use strict';var moment=require(_0x1397('0x0'));var Sequelize=require(_0x1397('0x1'));module[_0x1397('0x2')]={'starttime':{'type':Sequelize[_0x1397('0x3')],'set':function(_0x16184c){this[_0x1397('0x4')](_0x1397('0x5'),_0x16184c);this[_0x1397('0x4')](_0x1397('0x6'),moment()[_0x1397('0x7')](_0x1397('0x8')));}},'endtime':{'type':Sequelize[_0x1397('0x3')]},'membername':{'type':Sequelize[_0x1397('0x9')]},'projectname':{'type':Sequelize[_0x1397('0x9')]},'queue':{'type':Sequelize[_0x1397('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1397('0x9')]},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd260=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xd260,0x1a4));var _0x0d26=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xd260[_0x489b87];return _0x1823b6;};'use strict';var moment=require(_0x0d26('0x0'));var Sequelize=require(_0x0d26('0x1'));module[_0x0d26('0x2')]={'starttime':{'type':Sequelize[_0x0d26('0x3')],'set':function(_0x4afd2a){this[_0x0d26('0x4')](_0x0d26('0x5'),_0x4afd2a);this[_0x0d26('0x4')](_0x0d26('0x6'),moment()[_0x0d26('0x7')](_0x0d26('0x8')));}},'endtime':{'type':Sequelize[_0x0d26('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x0d26('0x9')]},'queue':{'type':Sequelize[_0x0d26('0x9')]},'uniqueid':{'type':Sequelize[_0x0d26('0x9')]},'calleridname':{'type':Sequelize[_0x0d26('0x9')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index d63d42b..e7256c4 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 _0xccd6=['filter','type','merge','options','then','includeAll','rows','catch','show','rawAttributes','length','find','create','body','params','describe','findOne','JscriptyQuestionReport','nolimit','SessionId','include','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','JscriptySessionReport','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','order','sort','where','filters'];(function(_0x520c97,_0x4f5aea){var _0x3b0655=function(_0x5b2c08){while(--_0x5b2c08){_0x520c97['push'](_0x520c97['shift']());}};_0x3b0655(++_0x4f5aea);}(_0xccd6,0xb1));var _0x6ccd=function(_0x4e04a8,_0x2f2d6a){_0x4e04a8=_0x4e04a8-0x0;var _0x6c3e6f=_0xccd6[_0x4e04a8];return _0x6c3e6f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6ccd('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6ccd('0x1'));var moment=require(_0x6ccd('0x2'));var BPromise=require(_0x6ccd('0x3'));var Mustache=require(_0x6ccd('0x4'));var util=require(_0x6ccd('0x5'));var path=require(_0x6ccd('0x6'));var sox=require(_0x6ccd('0x7'));var csv=require(_0x6ccd('0x8'));var ejs=require(_0x6ccd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ccd('0xa'));var squel=require(_0x6ccd('0xb'));var crypto=require(_0x6ccd('0xc'));var jsforce=require(_0x6ccd('0xd'));var deskjs=require(_0x6ccd('0xe'));var toCsv=require(_0x6ccd('0x8'));var querystring=require('querystring');var Papa=require(_0x6ccd('0xf'));var Redis=require(_0x6ccd('0x10'));var authService=require(_0x6ccd('0x11'));var qs=require(_0x6ccd('0x12'));var as=require(_0x6ccd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ccd('0x14'))('api');var utils=require(_0x6ccd('0x15'));var config=require(_0x6ccd('0x16'));var licenseUtil=require(_0x6ccd('0x17'));var db=require(_0x6ccd('0x18'))['db'];function respondWithStatusCode(_0x1907e0,_0x38d477){_0x38d477=_0x38d477||0xcc;return function(_0x5cfc40){if(_0x5cfc40){return _0x1907e0[_0x6ccd('0x19')](_0x38d477);}return _0x1907e0[_0x6ccd('0x1a')](_0x38d477)[_0x6ccd('0x1b')]();};}function respondWithResult(_0x5aa218,_0x27a979){_0x27a979=_0x27a979||0xc8;return function(_0x520225){if(_0x520225){return _0x5aa218[_0x6ccd('0x1a')](_0x27a979)['json'](_0x520225);}};}function respondWithFilteredResult(_0x460192,_0x4226fb){return function(_0x560993){if(_0x560993){var _0x3ec62b=typeof _0x4226fb['offset']===_0x6ccd('0x1c')&&typeof _0x4226fb['limit']===_0x6ccd('0x1c');var _0x3af6dd=_0x560993[_0x6ccd('0x1d')];var _0x45e4fa=_0x3ec62b?0x0:_0x4226fb[_0x6ccd('0x1e')];var _0x318d41=_0x3ec62b?_0x560993[_0x6ccd('0x1d')]:_0x4226fb[_0x6ccd('0x1e')]+_0x4226fb[_0x6ccd('0x1f')];var _0x587ad0;if(_0x318d41>=_0x3af6dd){_0x318d41=_0x3af6dd;_0x587ad0=0xc8;}else{_0x587ad0=0xce;}_0x460192[_0x6ccd('0x1a')](_0x587ad0);return _0x460192[_0x6ccd('0x20')](_0x6ccd('0x21'),_0x45e4fa+'-'+_0x318d41+'/'+_0x3af6dd)['json'](_0x560993);}return null;};}function patchUpdates(_0x4d152b){return function(_0x114ad7){try{jsonpatch[_0x6ccd('0x22')](_0x114ad7,_0x4d152b,!![]);}catch(_0x5e5946){return BPromise[_0x6ccd('0x23')](_0x5e5946);}return _0x114ad7[_0x6ccd('0x24')]();};}function saveUpdates(_0x11e674,_0x353d27){return function(_0xe85b30){if(_0xe85b30){return _0xe85b30[_0x6ccd('0x25')](_0x11e674)['then'](function(_0x23cdd0){return _0x23cdd0;});}return null;};}function removeEntity(_0x5881e7,_0x33406c){return function(_0xac5d8c){if(_0xac5d8c){return _0xac5d8c[_0x6ccd('0x26')]()['then'](function(){_0x5881e7[_0x6ccd('0x1a')](0xcc)[_0x6ccd('0x1b')]();});}};}function handleEntityNotFound(_0x252aee,_0x18661d){return function(_0x345b72){if(!_0x345b72){_0x252aee[_0x6ccd('0x19')](0x194);}return _0x345b72;};}function handleError(_0x92167f,_0x2c965c){_0x2c965c=_0x2c965c||0x1f4;return function(_0x47996e){logger[_0x6ccd('0x27')](_0x47996e[_0x6ccd('0x28')]);if(_0x47996e[_0x6ccd('0x29')]){delete _0x47996e[_0x6ccd('0x29')];}_0x92167f[_0x6ccd('0x1a')](_0x2c965c)[_0x6ccd('0x2a')](_0x47996e);};}exports['index']=function(_0x441576,_0x279dfb){var _0x5c5870={},_0x23dcc2={},_0x51f647={'count':0x0,'rows':[]};var _0x475b34=_[_0x6ccd('0x2b')](db[_0x6ccd('0x2c')]['rawAttributes'],function(_0x4a3045){return{'name':_0x4a3045[_0x6ccd('0x2d')],'type':_0x4a3045['type']['key']};});_0x23dcc2[_0x6ccd('0x2e')]=_[_0x6ccd('0x2b')](_0x475b34,_0x6ccd('0x29'));_0x23dcc2[_0x6ccd('0x2f')]=_[_0x6ccd('0x30')](_0x441576[_0x6ccd('0x2f')]);_0x23dcc2['filters']=_[_0x6ccd('0x31')](_0x23dcc2[_0x6ccd('0x2e')],_0x23dcc2[_0x6ccd('0x2f')]);_0x5c5870['attributes']=_[_0x6ccd('0x31')](_0x23dcc2[_0x6ccd('0x2e')],qs[_0x6ccd('0x32')](_0x441576[_0x6ccd('0x2f')]['fields']));_0x5c5870[_0x6ccd('0x33')]=_0x5c5870['attributes']['length']?_0x5c5870[_0x6ccd('0x33')]:_0x23dcc2[_0x6ccd('0x2e')];if(!_0x441576[_0x6ccd('0x2f')][_0x6ccd('0x34')]('nolimit')){_0x5c5870[_0x6ccd('0x1f')]=qs[_0x6ccd('0x1f')](_0x441576[_0x6ccd('0x2f')][_0x6ccd('0x1f')]);_0x5c5870[_0x6ccd('0x1e')]=qs[_0x6ccd('0x1e')](_0x441576['query'][_0x6ccd('0x1e')]);}_0x5c5870[_0x6ccd('0x35')]=qs[_0x6ccd('0x36')](_0x441576[_0x6ccd('0x2f')][_0x6ccd('0x36')]);_0x5c5870[_0x6ccd('0x37')]=qs[_0x6ccd('0x38')](_['pick'](_0x441576[_0x6ccd('0x2f')],_0x23dcc2[_0x6ccd('0x38')]),_0x475b34);if(_0x441576[_0x6ccd('0x2f')][_0x6ccd('0x39')]){_0x5c5870['where']=_['merge'](_0x5c5870[_0x6ccd('0x37')],{'$or':_[_0x6ccd('0x2b')](_0x475b34,function(_0x2341be){if(_0x2341be[_0x6ccd('0x3a')]!=='VIRTUAL'){var _0x1198bf={};_0x1198bf[_0x2341be['name']]={'$like':'%'+_0x441576[_0x6ccd('0x2f')][_0x6ccd('0x39')]+'%'};return _0x1198bf;}})});}_0x5c5870=_[_0x6ccd('0x3b')]({},_0x5c5870,_0x441576[_0x6ccd('0x3c')]);var _0x443b4d={'where':_0x5c5870[_0x6ccd('0x37')]};return db[_0x6ccd('0x2c')][_0x6ccd('0x1d')](_0x443b4d)[_0x6ccd('0x3d')](function(_0x5f10fb){_0x51f647[_0x6ccd('0x1d')]=_0x5f10fb;if(_0x441576[_0x6ccd('0x2f')][_0x6ccd('0x3e')]){_0x5c5870['include']=[{'all':!![]}];}return db[_0x6ccd('0x2c')]['findAll'](_0x5c5870);})[_0x6ccd('0x3d')](function(_0xc60cf){_0x51f647[_0x6ccd('0x3f')]=_0xc60cf;return _0x51f647;})[_0x6ccd('0x3d')](respondWithFilteredResult(_0x279dfb,_0x5c5870))[_0x6ccd('0x40')](handleError(_0x279dfb,null));};exports[_0x6ccd('0x41')]=function(_0x256e97,_0xa5e8bb){var _0x23876f={'raw':!![],'where':{'id':_0x256e97['params']['id']}},_0x5d1759={};_0x5d1759[_0x6ccd('0x2e')]=_[_0x6ccd('0x30')](db[_0x6ccd('0x2c')][_0x6ccd('0x42')]);_0x5d1759[_0x6ccd('0x2f')]=_[_0x6ccd('0x30')](_0x256e97[_0x6ccd('0x2f')]);_0x5d1759[_0x6ccd('0x38')]=_[_0x6ccd('0x31')](_0x5d1759[_0x6ccd('0x2e')],_0x5d1759['query']);_0x23876f['attributes']=_['intersection'](_0x5d1759[_0x6ccd('0x2e')],qs[_0x6ccd('0x32')](_0x256e97['query']['fields']));_0x23876f['attributes']=_0x23876f[_0x6ccd('0x33')][_0x6ccd('0x43')]?_0x23876f[_0x6ccd('0x33')]:_0x5d1759['model'];if(_0x256e97[_0x6ccd('0x2f')][_0x6ccd('0x3e')]){_0x23876f['include']=[{'all':!![]}];}_0x23876f=_['merge']({},_0x23876f,_0x256e97[_0x6ccd('0x3c')]);return db[_0x6ccd('0x2c')][_0x6ccd('0x44')](_0x23876f)[_0x6ccd('0x3d')](handleEntityNotFound(_0xa5e8bb,null))[_0x6ccd('0x3d')](respondWithResult(_0xa5e8bb,null))['catch'](handleError(_0xa5e8bb,null));};exports[_0x6ccd('0x45')]=function(_0x2bf6ff,_0x61e9b4){return db[_0x6ccd('0x2c')][_0x6ccd('0x45')](_0x2bf6ff[_0x6ccd('0x46')],{})[_0x6ccd('0x3d')](respondWithResult(_0x61e9b4,0xc9))[_0x6ccd('0x40')](handleError(_0x61e9b4,null));};exports['update']=function(_0x5f2fb9,_0x1cc171){if(_0x5f2fb9[_0x6ccd('0x46')]['id']){delete _0x5f2fb9['body']['id'];}return db[_0x6ccd('0x2c')][_0x6ccd('0x44')]({'where':{'id':_0x5f2fb9[_0x6ccd('0x47')]['id']}})[_0x6ccd('0x3d')](handleEntityNotFound(_0x1cc171,null))[_0x6ccd('0x3d')](saveUpdates(_0x5f2fb9['body'],null))['then'](respondWithResult(_0x1cc171,null))[_0x6ccd('0x40')](handleError(_0x1cc171,null));};exports[_0x6ccd('0x26')]=function(_0x1a6646,_0x6c0c74){return db[_0x6ccd('0x2c')][_0x6ccd('0x44')]({'where':{'id':_0x1a6646['params']['id']}})['then'](handleEntityNotFound(_0x6c0c74,null))[_0x6ccd('0x3d')](removeEntity(_0x6c0c74,null))[_0x6ccd('0x40')](handleError(_0x6c0c74,null));};exports['describe']=function(_0x363349,_0x3350c0){return db[_0x6ccd('0x2c')][_0x6ccd('0x48')]()[_0x6ccd('0x3d')](respondWithResult(_0x3350c0,null))[_0x6ccd('0x40')](handleError(_0x3350c0,null));};exports['getQuestions']=function(_0x2ea512,_0xd22ad5,_0x2493f8){var _0x3297eb={'raw':!![],'where':{}};var _0x17f910={};var _0x34fff5={'count':0x0,'rows':[]};return db[_0x6ccd('0x2c')][_0x6ccd('0x49')]({'where':{'id':_0x2ea512[_0x6ccd('0x47')]['id']}})['then'](handleEntityNotFound(_0xd22ad5,null))['then'](function(_0x5e274b){if(_0x5e274b){_0x17f910[_0x6ccd('0x2e')]=_[_0x6ccd('0x30')](db[_0x6ccd('0x4a')]['rawAttributes']);_0x17f910['query']=_[_0x6ccd('0x30')](_0x2ea512[_0x6ccd('0x2f')]);_0x17f910[_0x6ccd('0x38')]=_[_0x6ccd('0x31')](_0x17f910['model'],_0x17f910['query']);_0x3297eb[_0x6ccd('0x33')]=_[_0x6ccd('0x31')](_0x17f910[_0x6ccd('0x2e')],qs['fields'](_0x2ea512['query'][_0x6ccd('0x32')]));_0x3297eb[_0x6ccd('0x33')]=_0x3297eb[_0x6ccd('0x33')]['length']?_0x3297eb[_0x6ccd('0x33')]:_0x17f910[_0x6ccd('0x2e')];if(!_0x2ea512[_0x6ccd('0x2f')]['hasOwnProperty'](_0x6ccd('0x4b'))){_0x3297eb[_0x6ccd('0x1f')]=qs[_0x6ccd('0x1f')](_0x2ea512['query'][_0x6ccd('0x1f')]);_0x3297eb[_0x6ccd('0x1e')]=qs['offset'](_0x2ea512['query'][_0x6ccd('0x1e')]);}_0x3297eb[_0x6ccd('0x35')]=qs['sort'](_0x2ea512[_0x6ccd('0x2f')][_0x6ccd('0x36')]);_0x3297eb[_0x6ccd('0x37')]=qs[_0x6ccd('0x38')](_['pick'](_0x2ea512[_0x6ccd('0x2f')],_0x17f910['filters']));_0x3297eb['where'][_0x6ccd('0x4c')]=_0x5e274b['id'];if(_0x2ea512[_0x6ccd('0x2f')]['filter']){_0x3297eb[_0x6ccd('0x37')]=_[_0x6ccd('0x3b')](_0x3297eb[_0x6ccd('0x37')],{'$or':_[_0x6ccd('0x2b')](_0x3297eb['attributes'],function(_0x2289a7){var _0x4d857f={};_0x4d857f[_0x2289a7]={'$like':'%'+_0x2ea512['query']['filter']+'%'};return _0x4d857f;})});}_0x3297eb=_[_0x6ccd('0x3b')]({},_0x3297eb,_0x2ea512['options']);return db[_0x6ccd('0x4a')][_0x6ccd('0x1d')]({'where':_0x3297eb[_0x6ccd('0x37')]})[_0x6ccd('0x3d')](function(_0x2cd15d){_0x34fff5[_0x6ccd('0x1d')]=_0x2cd15d;if(_0x2ea512[_0x6ccd('0x2f')][_0x6ccd('0x3e')]){_0x3297eb[_0x6ccd('0x4d')]=[{'all':!![]}];}return db[_0x6ccd('0x4a')]['findAll'](_0x3297eb);})[_0x6ccd('0x3d')](function(_0x5302a5){_0x34fff5[_0x6ccd('0x3f')]=_0x5302a5;return _0x34fff5;});}})[_0x6ccd('0x3d')](respondWithFilteredResult(_0xd22ad5,_0x3297eb))[_0x6ccd('0x40')](handleError(_0xd22ad5,null));}; \ No newline at end of file +var _0xdf30=['attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','getQuestions','JscriptyQuestionReport','order','pick','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x59c731,_0x3e18da){var _0x4a8e8c=function(_0xc82454){while(--_0xc82454){_0x59c731['push'](_0x59c731['shift']());}};_0x4a8e8c(++_0x3e18da);}(_0xdf30,0x1e1));var _0x0df3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf30[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0df3('0x0'));var jsonpatch=require(_0x0df3('0x1'));var rp=require(_0x0df3('0x2'));var moment=require(_0x0df3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0df3('0x4'));var util=require(_0x0df3('0x5'));var path=require('path');var sox=require(_0x0df3('0x6'));var csv=require('to-csv');var ejs=require(_0x0df3('0x7'));var fs=require('fs');var fs_extra=require(_0x0df3('0x8'));var _=require('lodash');var squel=require(_0x0df3('0x9'));var crypto=require(_0x0df3('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0df3('0xb'));var querystring=require(_0x0df3('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0df3('0xd'));var qs=require(_0x0df3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0df3('0xf'));var logger=require(_0x0df3('0x10'))(_0x0df3('0x11'));var utils=require(_0x0df3('0x12'));var config=require(_0x0df3('0x13'));var licenseUtil=require(_0x0df3('0x14'));var db=require(_0x0df3('0x15'))['db'];function respondWithStatusCode(_0x1a23b0,_0x1b4a8c){_0x1b4a8c=_0x1b4a8c||0xcc;return function(_0x1215e8){if(_0x1215e8){return _0x1a23b0[_0x0df3('0x16')](_0x1b4a8c);}return _0x1a23b0[_0x0df3('0x17')](_0x1b4a8c)[_0x0df3('0x18')]();};}function respondWithResult(_0x19f687,_0x56f52e){_0x56f52e=_0x56f52e||0xc8;return function(_0x5776d6){if(_0x5776d6){return _0x19f687[_0x0df3('0x17')](_0x56f52e)['json'](_0x5776d6);}};}function respondWithFilteredResult(_0x3b018f,_0x1b7616){return function(_0x509701){if(_0x509701){var _0x3977ca=typeof _0x1b7616[_0x0df3('0x19')]===_0x0df3('0x1a')&&typeof _0x1b7616[_0x0df3('0x1b')]===_0x0df3('0x1a');var _0x4a11c3=_0x509701[_0x0df3('0x1c')];var _0x236aff=_0x3977ca?0x0:_0x1b7616[_0x0df3('0x19')];var _0x18e4eb=_0x3977ca?_0x509701['count']:_0x1b7616['offset']+_0x1b7616[_0x0df3('0x1b')];var _0x3ec4f7;if(_0x18e4eb>=_0x4a11c3){_0x18e4eb=_0x4a11c3;_0x3ec4f7=0xc8;}else{_0x3ec4f7=0xce;}_0x3b018f['status'](_0x3ec4f7);return _0x3b018f[_0x0df3('0x1d')](_0x0df3('0x1e'),_0x236aff+'-'+_0x18e4eb+'/'+_0x4a11c3)['json'](_0x509701);}return null;};}function patchUpdates(_0x4d0422){return function(_0x3d3c31){try{jsonpatch[_0x0df3('0x1f')](_0x3d3c31,_0x4d0422,!![]);}catch(_0x2160eb){return BPromise[_0x0df3('0x20')](_0x2160eb);}return _0x3d3c31[_0x0df3('0x21')]();};}function saveUpdates(_0x342eee,_0x57f7b2){return function(_0x3f643d){if(_0x3f643d){return _0x3f643d[_0x0df3('0x22')](_0x342eee)[_0x0df3('0x23')](function(_0x10afbf){return _0x10afbf;});}return null;};}function removeEntity(_0x233cdc,_0x81f7d6){return function(_0x3b3385){if(_0x3b3385){return _0x3b3385[_0x0df3('0x24')]()['then'](function(){_0x233cdc[_0x0df3('0x17')](0xcc)[_0x0df3('0x18')]();});}};}function handleEntityNotFound(_0x965e54,_0x22b253){return function(_0x144fdb){if(!_0x144fdb){_0x965e54['sendStatus'](0x194);}return _0x144fdb;};}function handleError(_0x12813c,_0x1a22c3){_0x1a22c3=_0x1a22c3||0x1f4;return function(_0x53ed19){logger['error'](_0x53ed19[_0x0df3('0x25')]);if(_0x53ed19[_0x0df3('0x26')]){delete _0x53ed19[_0x0df3('0x26')];}_0x12813c[_0x0df3('0x17')](_0x1a22c3)['send'](_0x53ed19);};}exports[_0x0df3('0x27')]=function(_0x3f1332,_0x1d66cc){var _0x7ec89b={},_0xd9d8d4={},_0x1567b6={'count':0x0,'rows':[]};var _0x469711=_[_0x0df3('0x28')](db[_0x0df3('0x29')][_0x0df3('0x2a')],function(_0x39237e){return{'name':_0x39237e[_0x0df3('0x2b')],'type':_0x39237e[_0x0df3('0x2c')][_0x0df3('0x2d')]};});_0xd9d8d4[_0x0df3('0x2e')]=_[_0x0df3('0x28')](_0x469711,_0x0df3('0x26'));_0xd9d8d4[_0x0df3('0x2f')]=_[_0x0df3('0x30')](_0x3f1332[_0x0df3('0x2f')]);_0xd9d8d4[_0x0df3('0x31')]=_[_0x0df3('0x32')](_0xd9d8d4[_0x0df3('0x2e')],_0xd9d8d4['query']);_0x7ec89b[_0x0df3('0x33')]=_['intersection'](_0xd9d8d4['model'],qs[_0x0df3('0x34')](_0x3f1332[_0x0df3('0x2f')][_0x0df3('0x34')]));_0x7ec89b['attributes']=_0x7ec89b[_0x0df3('0x33')][_0x0df3('0x35')]?_0x7ec89b[_0x0df3('0x33')]:_0xd9d8d4[_0x0df3('0x2e')];if(!_0x3f1332[_0x0df3('0x2f')][_0x0df3('0x36')](_0x0df3('0x37'))){_0x7ec89b[_0x0df3('0x1b')]=qs[_0x0df3('0x1b')](_0x3f1332['query'][_0x0df3('0x1b')]);_0x7ec89b['offset']=qs['offset'](_0x3f1332['query']['offset']);}_0x7ec89b['order']=qs[_0x0df3('0x38')](_0x3f1332[_0x0df3('0x2f')][_0x0df3('0x38')]);_0x7ec89b[_0x0df3('0x39')]=qs[_0x0df3('0x31')](_['pick'](_0x3f1332[_0x0df3('0x2f')],_0xd9d8d4['filters']),_0x469711);if(_0x3f1332[_0x0df3('0x2f')][_0x0df3('0x3a')]){_0x7ec89b['where']=_['merge'](_0x7ec89b['where'],{'$or':_['map'](_0x469711,function(_0x277bba){if(_0x277bba[_0x0df3('0x2c')]!==_0x0df3('0x3b')){var _0x470945={};_0x470945[_0x277bba[_0x0df3('0x26')]]={'$like':'%'+_0x3f1332['query']['filter']+'%'};return _0x470945;}})});}_0x7ec89b=_[_0x0df3('0x3c')]({},_0x7ec89b,_0x3f1332[_0x0df3('0x3d')]);var _0x3d9de8={'where':_0x7ec89b[_0x0df3('0x39')]};return db['JscriptySessionReport'][_0x0df3('0x1c')](_0x3d9de8)[_0x0df3('0x23')](function(_0x19791c){_0x1567b6[_0x0df3('0x1c')]=_0x19791c;if(_0x3f1332[_0x0df3('0x2f')][_0x0df3('0x3e')]){_0x7ec89b[_0x0df3('0x3f')]=[{'all':!![]}];}return db[_0x0df3('0x29')][_0x0df3('0x40')](_0x7ec89b);})['then'](function(_0x2daf10){_0x1567b6[_0x0df3('0x41')]=_0x2daf10;return _0x1567b6;})[_0x0df3('0x23')](respondWithFilteredResult(_0x1d66cc,_0x7ec89b))[_0x0df3('0x42')](handleError(_0x1d66cc,null));};exports[_0x0df3('0x43')]=function(_0x236f61,_0x42cf8e){var _0x1c4f1b={'raw':!![],'where':{'id':_0x236f61['params']['id']}},_0x2e1175={};_0x2e1175[_0x0df3('0x2e')]=_[_0x0df3('0x30')](db['JscriptySessionReport'][_0x0df3('0x2a')]);_0x2e1175['query']=_[_0x0df3('0x30')](_0x236f61[_0x0df3('0x2f')]);_0x2e1175[_0x0df3('0x31')]=_[_0x0df3('0x32')](_0x2e1175[_0x0df3('0x2e')],_0x2e1175['query']);_0x1c4f1b[_0x0df3('0x33')]=_[_0x0df3('0x32')](_0x2e1175['model'],qs[_0x0df3('0x34')](_0x236f61[_0x0df3('0x2f')][_0x0df3('0x34')]));_0x1c4f1b['attributes']=_0x1c4f1b[_0x0df3('0x33')]['length']?_0x1c4f1b['attributes']:_0x2e1175[_0x0df3('0x2e')];if(_0x236f61[_0x0df3('0x2f')]['includeAll']){_0x1c4f1b[_0x0df3('0x3f')]=[{'all':!![]}];}_0x1c4f1b=_['merge']({},_0x1c4f1b,_0x236f61[_0x0df3('0x3d')]);return db[_0x0df3('0x29')][_0x0df3('0x44')](_0x1c4f1b)[_0x0df3('0x23')](handleEntityNotFound(_0x42cf8e,null))[_0x0df3('0x23')](respondWithResult(_0x42cf8e,null))['catch'](handleError(_0x42cf8e,null));};exports['create']=function(_0x9aec56,_0x1a3060){return db['JscriptySessionReport']['create'](_0x9aec56[_0x0df3('0x45')],{})[_0x0df3('0x23')](respondWithResult(_0x1a3060,0xc9))[_0x0df3('0x42')](handleError(_0x1a3060,null));};exports['update']=function(_0x3b2161,_0x2578d8){if(_0x3b2161[_0x0df3('0x45')]['id']){delete _0x3b2161[_0x0df3('0x45')]['id'];}return db[_0x0df3('0x29')][_0x0df3('0x44')]({'where':{'id':_0x3b2161[_0x0df3('0x46')]['id']}})['then'](handleEntityNotFound(_0x2578d8,null))['then'](saveUpdates(_0x3b2161[_0x0df3('0x45')],null))[_0x0df3('0x23')](respondWithResult(_0x2578d8,null))[_0x0df3('0x42')](handleError(_0x2578d8,null));};exports[_0x0df3('0x24')]=function(_0x269550,_0x49f5cf){return db[_0x0df3('0x29')][_0x0df3('0x44')]({'where':{'id':_0x269550[_0x0df3('0x46')]['id']}})['then'](handleEntityNotFound(_0x49f5cf,null))[_0x0df3('0x23')](removeEntity(_0x49f5cf,null))[_0x0df3('0x42')](handleError(_0x49f5cf,null));};exports['describe']=function(_0x140197,_0x58ea5d){return db['JscriptySessionReport'][_0x0df3('0x47')]()[_0x0df3('0x23')](respondWithResult(_0x58ea5d,null))['catch'](handleError(_0x58ea5d,null));};exports[_0x0df3('0x48')]=function(_0x117766,_0x2dddb9,_0x226199){var _0x46ec99={'raw':!![],'where':{}};var _0x348d5b={};var _0x39bda8={'count':0x0,'rows':[]};return db[_0x0df3('0x29')]['findOne']({'where':{'id':_0x117766['params']['id']}})['then'](handleEntityNotFound(_0x2dddb9,null))['then'](function(_0x5426fb){if(_0x5426fb){_0x348d5b[_0x0df3('0x2e')]=_[_0x0df3('0x30')](db[_0x0df3('0x49')][_0x0df3('0x2a')]);_0x348d5b[_0x0df3('0x2f')]=_[_0x0df3('0x30')](_0x117766[_0x0df3('0x2f')]);_0x348d5b['filters']=_[_0x0df3('0x32')](_0x348d5b[_0x0df3('0x2e')],_0x348d5b['query']);_0x46ec99[_0x0df3('0x33')]=_['intersection'](_0x348d5b[_0x0df3('0x2e')],qs[_0x0df3('0x34')](_0x117766[_0x0df3('0x2f')][_0x0df3('0x34')]));_0x46ec99[_0x0df3('0x33')]=_0x46ec99[_0x0df3('0x33')][_0x0df3('0x35')]?_0x46ec99['attributes']:_0x348d5b[_0x0df3('0x2e')];if(!_0x117766['query'][_0x0df3('0x36')](_0x0df3('0x37'))){_0x46ec99[_0x0df3('0x1b')]=qs[_0x0df3('0x1b')](_0x117766[_0x0df3('0x2f')][_0x0df3('0x1b')]);_0x46ec99[_0x0df3('0x19')]=qs[_0x0df3('0x19')](_0x117766[_0x0df3('0x2f')][_0x0df3('0x19')]);}_0x46ec99[_0x0df3('0x4a')]=qs[_0x0df3('0x38')](_0x117766[_0x0df3('0x2f')][_0x0df3('0x38')]);_0x46ec99[_0x0df3('0x39')]=qs[_0x0df3('0x31')](_[_0x0df3('0x4b')](_0x117766[_0x0df3('0x2f')],_0x348d5b[_0x0df3('0x31')]));_0x46ec99['where']['SessionId']=_0x5426fb['id'];if(_0x117766['query'][_0x0df3('0x3a')]){_0x46ec99[_0x0df3('0x39')]=_[_0x0df3('0x3c')](_0x46ec99[_0x0df3('0x39')],{'$or':_[_0x0df3('0x28')](_0x46ec99[_0x0df3('0x33')],function(_0x2c5cb0){var _0x536990={};_0x536990[_0x2c5cb0]={'$like':'%'+_0x117766[_0x0df3('0x2f')][_0x0df3('0x3a')]+'%'};return _0x536990;})});}_0x46ec99=_['merge']({},_0x46ec99,_0x117766[_0x0df3('0x3d')]);return db[_0x0df3('0x49')][_0x0df3('0x1c')]({'where':_0x46ec99[_0x0df3('0x39')]})[_0x0df3('0x23')](function(_0x2e30c2){_0x39bda8[_0x0df3('0x1c')]=_0x2e30c2;if(_0x117766[_0x0df3('0x2f')]['includeAll']){_0x46ec99[_0x0df3('0x3f')]=[{'all':!![]}];}return db[_0x0df3('0x49')][_0x0df3('0x40')](_0x46ec99);})['then'](function(_0x31c38d){_0x39bda8[_0x0df3('0x41')]=_0x31c38d;return _0x39bda8;});}})[_0x0df3('0x23')](respondWithFilteredResult(_0x2dddb9,_0x46ec99))['catch'](handleError(_0x2dddb9,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 20a90f3..64c7915 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 _0x0f4d=['api','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x0f4d,0x12c));var _0xd0f4=function(_0x1bc72b,_0x51ce5a){_0x1bc72b=_0x1bc72b-0x0;var _0x4ad09d=_0x0f4d[_0x1bc72b];return _0x4ad09d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd0f4('0x0'));var moment=require('moment');var BPromise=require(_0xd0f4('0x1'));var rp=require(_0xd0f4('0x2'));var fs=require('fs');var path=require(_0xd0f4('0x3'));var rimraf=require(_0xd0f4('0x4'));var config=require(_0xd0f4('0x5'));var attributes=require(_0xd0f4('0x6'));module[_0xd0f4('0x7')]=function(_0x1d9a9d,_0x531f85){return _0x1d9a9d[_0xd0f4('0x8')](_0xd0f4('0x9'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions'];(function(_0xb21cb7,_0x308d22){var _0x33eb15=function(_0x3cf845){while(--_0x3cf845){_0xb21cb7['push'](_0xb21cb7['shift']());}};_0x33eb15(++_0x308d22);}(_0x5fc3,0xa8));var _0x35fc=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x5fc3[_0x59e821];return _0x5333f6;};'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')]('JscriptySessionReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 36dadcf..5e3845a 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 _0x8952=['JscriptySessionReport,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error'];(function(_0x48f8c4,_0x4e3dba){var _0x118849=function(_0x4f9838){while(--_0x4f9838){_0x48f8c4['push'](_0x48f8c4['shift']());}};_0x118849(++_0x4e3dba);}(_0x8952,0x17e));var _0x2895=function(_0x3e9d46,_0x3e72ad){_0x3e9d46=_0x3e9d46-0x0;var _0x493cb2=_0x8952[_0x3e9d46];return _0x493cb2;};'use strict';var _=require('lodash');var util=require(_0x2895('0x0'));var moment=require(_0x2895('0x1'));var BPromise=require(_0x2895('0x2'));var rs=require(_0x2895('0x3'));var fs=require('fs');var Redis=require(_0x2895('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2895('0x5'));var logger=require(_0x2895('0x6'))(_0x2895('0x7'));var config=require('../../config/environment');var jayson=require(_0x2895('0x8'));var client=jayson[_0x2895('0x9')][_0x2895('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ea619,_0x526c32,_0x238b4a){return new BPromise(function(_0x335002,_0x159f86){return client[_0x2895('0xb')](_0x4ea619,_0x238b4a)[_0x2895('0xc')](function(_0x4952fa){logger[_0x2895('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x526c32,_0x2895('0xe'));logger['debug']('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x526c32,'request\x20sent',JSON[_0x2895('0xf')](_0x4952fa));if(_0x4952fa[_0x2895('0x10')]){if(_0x4952fa[_0x2895('0x10')]['code']===0x1f4){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x4952fa['error'][_0x2895('0x12')]);return _0x159f86(_0x4952fa[_0x2895('0x10')]['message']);}logger['error'](_0x2895('0x11'),_0x526c32,_0x4952fa[_0x2895('0x10')]['message']);return _0x335002(_0x4952fa[_0x2895('0x10')][_0x2895('0x12')]);}else{logger[_0x2895('0xd')](_0x2895('0x11'),_0x526c32,_0x2895('0xe'));_0x335002(_0x4952fa[_0x2895('0x13')][_0x2895('0x12')]);}})[_0x2895('0x14')](function(_0x3e96d7){logger[_0x2895('0x10')](_0x2895('0x11'),_0x526c32,_0x3e96d7);_0x159f86(_0x3e96d7);});});} \ No newline at end of file +var _0x3e24=['info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1f1f3b,_0x227aa9){var _0x2e63aa=function(_0x165a34){while(--_0x165a34){_0x1f1f3b['push'](_0x1f1f3b['shift']());}};_0x2e63aa(++_0x227aa9);}(_0x3e24,0x167));var _0x43e2=function(_0x8eac1c,_0x4369d6){_0x8eac1c=_0x8eac1c-0x0;var _0x77e112=_0x3e24[_0x8eac1c];return _0x77e112;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d4d1507..7836e0d 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 _0xa2b2=['update','/download_log_file','downloadLogFile','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./license.controller','get','put','/:id','isAuthenticated'];(function(_0x37452f,_0x17a04c){var _0xd5b34f=function(_0x4a0f68){while(--_0x4a0f68){_0x37452f['push'](_0x37452f['shift']());}};_0xd5b34f(++_0x17a04c);}(_0xa2b2,0x1df));var _0x2a2b=function(_0x4c291e,_0x3a22a7){_0x4c291e=_0x4c291e-0x0;var _0x5e4848=_0xa2b2[_0x4c291e];return _0x5e4848;};'use strict';var multer=require('multer');var util=require(_0x2a2b('0x0'));var path=require('path');var timeout=require(_0x2a2b('0x1'));var express=require(_0x2a2b('0x2'));var router=express[_0x2a2b('0x3')]();var fs_extra=require(_0x2a2b('0x4'));var auth=require(_0x2a2b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2a2b('0x6'));router[_0x2a2b('0x7')]('/',controller['index']);router[_0x2a2b('0x8')](_0x2a2b('0x9'),auth[_0x2a2b('0xa')](),controller[_0x2a2b('0xb')]);router[_0x2a2b('0x7')](_0x2a2b('0xc'),auth[_0x2a2b('0xa')](),controller[_0x2a2b('0xd')]);module['exports']=router; \ No newline at end of file +var _0x4472=['../../config/environment','./license.controller','get','index','put','/:id','isAuthenticated','update','downloadLogFile','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x56fbf4,_0x29109f){var _0x6c9f48=function(_0x84db9c){while(--_0x84db9c){_0x56fbf4['push'](_0x56fbf4['shift']());}};_0x6c9f48(++_0x29109f);}(_0x4472,0x92));var _0x2447=function(_0x39caaf,_0x43efd4){_0x39caaf=_0x39caaf-0x0;var _0x175c4e=_0x4472[_0x39caaf];return _0x175c4e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2447('0x0'));var timeout=require(_0x2447('0x1'));var express=require(_0x2447('0x2'));var router=express[_0x2447('0x3')]();var fs_extra=require(_0x2447('0x4'));var auth=require(_0x2447('0x5'));var interaction=require(_0x2447('0x6'));var config=require(_0x2447('0x7'));var controller=require(_0x2447('0x8'));router[_0x2447('0x9')]('/',controller[_0x2447('0xa')]);router[_0x2447('0xb')](_0x2447('0xc'),auth[_0x2447('0xd')](),controller[_0x2447('0xe')]);router[_0x2447('0x9')]('/download_log_file',auth['isAuthenticated'](),controller[_0x2447('0xf')]);module[_0x2447('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index d302f9d..7f20a98 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 _0xf28f=['exports','TEXT','STRING'];(function(_0x552eda,_0x965e93){var _0x353e80=function(_0x9a2178){while(--_0x9a2178){_0x552eda['push'](_0x552eda['shift']());}};_0x353e80(++_0x965e93);}(_0xf28f,0xed));var _0xff28=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xf28f[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require('sequelize');module[_0xff28('0x0')]={'license':{'type':Sequelize[_0xff28('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xff28('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xbb0a=['STRING','INTEGER','exports','TEXT'];(function(_0x2a065f,_0x3bdaa8){var _0x38a222=function(_0x4a15ce){while(--_0x4a15ce){_0x2a065f['push'](_0x2a065f['shift']());}};_0x38a222(++_0x3bdaa8);}(_0xbb0a,0x122));var _0xabb0=function(_0x1bf20b,_0x9aeb1f){_0x1bf20b=_0x1bf20b-0x0;var _0x21c9e3=_0xbb0a[_0x1bf20b];return _0x21c9e3;};'use strict';var Sequelize=require('sequelize');module[_0xabb0('0x0')]={'license':{'type':Sequelize[_0xabb0('0x1')]},'data1':{'type':Sequelize[_0xabb0('0x2')]},'data2':{'type':Sequelize[_0xabb0('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xabb0('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index 5bb6ac2..ce2455e 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 _0x7cc6=['eml-format','rimraf','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','status','end','sendStatus','error','name','index','model','keys','rawAttributes','query','filters','intersection','attributes','fields','merge','options','update','body','License','params','get','checkLicense','key','demo','catch','downloadLogFile','license-info.log','log','xcally','setHeader','Content-disposition','set','Content-Type','text/plain','download'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0x7cc6,0x19e));var _0x67cc=function(_0x128c2a,_0xcec374){_0x128c2a=_0x128c2a-0x0;var _0x1621b4=_0x7cc6[_0x128c2a];return _0x1621b4;};'use strict';var emlformat=require(_0x67cc('0x0'));var rimraf=require(_0x67cc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x67cc('0x2'));var moment=require('moment');var BPromise=require(_0x67cc('0x3'));var Mustache=require(_0x67cc('0x4'));var util=require(_0x67cc('0x5'));var path=require(_0x67cc('0x6'));var sox=require('sox');var csv=require(_0x67cc('0x7'));var ejs=require(_0x67cc('0x8'));var fs=require('fs');var fs_extra=require(_0x67cc('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x67cc('0xa'));var jsforce=require(_0x67cc('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x67cc('0xc'));var Papa=require(_0x67cc('0xd'));var Redis=require(_0x67cc('0xe'));var authService=require(_0x67cc('0xf'));var qs=require(_0x67cc('0x10'));var as=require(_0x67cc('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x67cc('0x12'))(_0x67cc('0x13'));var utils=require(_0x67cc('0x14'));var config=require(_0x67cc('0x15'));var licenseUtil=require(_0x67cc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x562679,_0x1b4a9b){_0x1b4a9b=_0x1b4a9b||0xcc;return function(_0x27b4eb){if(_0x27b4eb){return _0x562679['sendStatus'](_0x1b4a9b);}return _0x562679['status'](_0x1b4a9b)['end']();};}function respondWithResult(_0x3e6cec,_0xcead3f){_0xcead3f=_0xcead3f||0xc8;return function(_0x3c12da){if(_0x3c12da){return _0x3e6cec['status'](_0xcead3f)[_0x67cc('0x17')](_0x3c12da);}};}function respondWithFilteredResult(_0x2e7182,_0xafec8a){return function(_0xab0d64){if(_0xab0d64){var _0x1336c=typeof _0xafec8a[_0x67cc('0x18')]===_0x67cc('0x19')&&typeof _0xafec8a[_0x67cc('0x1a')]===_0x67cc('0x19');var _0x3b1be7=_0xab0d64[_0x67cc('0x1b')];var _0x45c87f=_0x1336c?0x0:_0xafec8a[_0x67cc('0x18')];var _0x5ba303=_0x1336c?_0xab0d64[_0x67cc('0x1b')]:_0xafec8a[_0x67cc('0x18')]+_0xafec8a['limit'];var _0x4da884;if(_0x5ba303>=_0x3b1be7){_0x5ba303=_0x3b1be7;_0x4da884=0xc8;}else{_0x4da884=0xce;}_0x2e7182['status'](_0x4da884);return _0x2e7182['set'](_0x67cc('0x1c'),_0x45c87f+'-'+_0x5ba303+'/'+_0x3b1be7)[_0x67cc('0x17')](_0xab0d64);}return null;};}function patchUpdates(_0x240281){return function(_0x58f095){try{jsonpatch[_0x67cc('0x1d')](_0x58f095,_0x240281,!![]);}catch(_0x23549a){return BPromise[_0x67cc('0x1e')](_0x23549a);}return _0x58f095[_0x67cc('0x1f')]();};}function saveUpdates(_0x215f85,_0x5d35be){return function(_0xd2d6dd){if(_0xd2d6dd){return _0xd2d6dd['update'](_0x215f85)[_0x67cc('0x20')](function(_0x2dbfa4){return _0x2dbfa4;});}return null;};}function removeEntity(_0x557c10,_0x10c8c9){return function(_0x3f84c8){if(_0x3f84c8){return _0x3f84c8[_0x67cc('0x21')]()['then'](function(){_0x557c10[_0x67cc('0x22')](0xcc)[_0x67cc('0x23')]();});}};}function handleEntityNotFound(_0x1985af,_0xdb220e){return function(_0x44664b){if(!_0x44664b){_0x1985af[_0x67cc('0x24')](0x194);}return _0x44664b;};}function handleError(_0x221bbd,_0x1a7ac7){_0x1a7ac7=_0x1a7ac7||0x1f4;return function(_0x27b9d2){logger[_0x67cc('0x25')](_0x27b9d2['stack']);if(_0x27b9d2[_0x67cc('0x26')]){delete _0x27b9d2[_0x67cc('0x26')];}_0x221bbd[_0x67cc('0x22')](_0x1a7ac7)['send'](_0x27b9d2);};}var utilLicense=require(_0x67cc('0x16'));exports[_0x67cc('0x27')]=function(_0x311a71,_0x2dedf5){var _0x10afe9={'raw':!![],'where':{'id':0x1}},_0x5929e0={};_0x5929e0[_0x67cc('0x28')]=_[_0x67cc('0x29')](db['License'][_0x67cc('0x2a')]);_0x5929e0[_0x67cc('0x2b')]=_['keys'](_0x311a71[_0x67cc('0x2b')]);_0x5929e0[_0x67cc('0x2c')]=_[_0x67cc('0x2d')](_0x5929e0[_0x67cc('0x28')],_0x5929e0[_0x67cc('0x2b')]);_0x10afe9[_0x67cc('0x2e')]=_[_0x67cc('0x2d')](_0x5929e0['model'],qs[_0x67cc('0x2f')](_0x311a71[_0x67cc('0x2b')]['fields']));_0x10afe9[_0x67cc('0x2e')]=_0x10afe9[_0x67cc('0x2e')]['length']?_0x10afe9[_0x67cc('0x2e')]:_0x5929e0['model'];_0x10afe9=_[_0x67cc('0x30')]({},_0x10afe9,_0x311a71[_0x67cc('0x31')]);return utilLicense['getLicense'](_0x10afe9)[_0x67cc('0x20')](respondWithResult(_0x2dedf5,null))['catch'](handleError(_0x2dedf5,null));};exports[_0x67cc('0x32')]=function(_0xf10042,_0x3cd851){if(_0xf10042[_0x67cc('0x33')]['id']){delete _0xf10042['body']['id'];}return db[_0x67cc('0x34')]['find']({'where':{'id':_0xf10042[_0x67cc('0x35')]['id']}})[_0x67cc('0x20')](handleEntityNotFound(_0x3cd851,null))[_0x67cc('0x20')](function(_0x484070){var _0x448973=_0x484070[_0x67cc('0x36')]({'plain':!![]});return utilLicense[_0x67cc('0x37')](_0x448973,_0xf10042['body'][_0x67cc('0x38')]);})['then'](function(_0x28d9f3){if(!_0x28d9f3[_0x67cc('0x39')]){return saveUpdates(_0xf10042[_0x67cc('0x33')],null);}return _0x28d9f3;})['then'](respondWithResult(_0x3cd851,null))[_0x67cc('0x3a')](handleError(_0x3cd851,null));};exports[_0x67cc('0x3b')]=function(_0xc96d07,_0x41a17c){var _0x36d765=_0x67cc('0x3c');var _0x6ba379=path['join']('/var',_0x67cc('0x3d'),_0x67cc('0x3e'),_0x36d765);_0x41a17c[_0x67cc('0x3f')](_0x67cc('0x40'),'attachment;\x20filename='+_0x36d765);_0x41a17c[_0x67cc('0x41')](_0x67cc('0x42'),_0x67cc('0x43'));_0x41a17c[_0x67cc('0x44')](_0x6ba379);}; \ No newline at end of file +var _0x534c=['send','../../config/license/util','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','License','find','then','get','checkLicense','key','demo','downloadLogFile','/var','setHeader','Content-disposition','Content-Type','text/plain','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','end','sendStatus','error','stack','name'];(function(_0x4423b6,_0x50dfd6){var _0x3e2997=function(_0x459d84){while(--_0x459d84){_0x4423b6['push'](_0x4423b6['shift']());}};_0x3e2997(++_0x50dfd6);}(_0x534c,0x64));var _0xc534=function(_0x17360d,_0x1a58ea){_0x17360d=_0x17360d-0x0;var _0x15cc81=_0x534c[_0x17360d];return _0x15cc81;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc534('0x0'));var zipdir=require(_0xc534('0x1'));var jsonpatch=require(_0xc534('0x2'));var rp=require(_0xc534('0x3'));var moment=require(_0xc534('0x4'));var BPromise=require(_0xc534('0x5'));var Mustache=require(_0xc534('0x6'));var util=require(_0xc534('0x7'));var path=require(_0xc534('0x8'));var sox=require(_0xc534('0x9'));var csv=require(_0xc534('0xa'));var ejs=require(_0xc534('0xb'));var fs=require('fs');var fs_extra=require(_0xc534('0xc'));var _=require(_0xc534('0xd'));var squel=require(_0xc534('0xe'));var crypto=require('crypto');var jsforce=require(_0xc534('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc534('0xa'));var querystring=require(_0xc534('0x10'));var Papa=require(_0xc534('0x11'));var Redis=require(_0xc534('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xc534('0x13'));var hardwareService=require(_0xc534('0x14'));var logger=require(_0xc534('0x15'))('api');var utils=require(_0xc534('0x16'));var config=require(_0xc534('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc534('0x18'))['db'];function respondWithStatusCode(_0xcc1a51,_0x124057){_0x124057=_0x124057||0xcc;return function(_0x1b94b9){if(_0x1b94b9){return _0xcc1a51['sendStatus'](_0x124057);}return _0xcc1a51[_0xc534('0x19')](_0x124057)['end']();};}function respondWithResult(_0x4115a0,_0x174b44){_0x174b44=_0x174b44||0xc8;return function(_0x53b027){if(_0x53b027){return _0x4115a0[_0xc534('0x19')](_0x174b44)[_0xc534('0x1a')](_0x53b027);}};}function respondWithFilteredResult(_0x214f6a,_0x5fbdd9){return function(_0xdde94){if(_0xdde94){var _0xdb046=typeof _0x5fbdd9[_0xc534('0x1b')]===_0xc534('0x1c')&&typeof _0x5fbdd9[_0xc534('0x1d')]===_0xc534('0x1c');var _0x2a37f7=_0xdde94[_0xc534('0x1e')];var _0x585924=_0xdb046?0x0:_0x5fbdd9[_0xc534('0x1b')];var _0x1e57d6=_0xdb046?_0xdde94[_0xc534('0x1e')]:_0x5fbdd9['offset']+_0x5fbdd9['limit'];var _0x3dc2d2;if(_0x1e57d6>=_0x2a37f7){_0x1e57d6=_0x2a37f7;_0x3dc2d2=0xc8;}else{_0x3dc2d2=0xce;}_0x214f6a[_0xc534('0x19')](_0x3dc2d2);return _0x214f6a[_0xc534('0x1f')](_0xc534('0x20'),_0x585924+'-'+_0x1e57d6+'/'+_0x2a37f7)[_0xc534('0x1a')](_0xdde94);}return null;};}function patchUpdates(_0x1acbd2){return function(_0x60a56f){try{jsonpatch['apply'](_0x60a56f,_0x1acbd2,!![]);}catch(_0x33f848){return BPromise[_0xc534('0x21')](_0x33f848);}return _0x60a56f[_0xc534('0x22')]();};}function saveUpdates(_0x2cf3a6,_0x5cc8d4){return function(_0x37eebd){if(_0x37eebd){return _0x37eebd[_0xc534('0x23')](_0x2cf3a6)['then'](function(_0x35f149){return _0x35f149;});}return null;};}function removeEntity(_0x55a4ff,_0x2ea020){return function(_0x5ae01d){if(_0x5ae01d){return _0x5ae01d[_0xc534('0x24')]()['then'](function(){_0x55a4ff['status'](0xcc)[_0xc534('0x25')]();});}};}function handleEntityNotFound(_0x2e7457,_0x3f0a34){return function(_0x3759ab){if(!_0x3759ab){_0x2e7457[_0xc534('0x26')](0x194);}return _0x3759ab;};}function handleError(_0x538836,_0x869c79){_0x869c79=_0x869c79||0x1f4;return function(_0x39ef0d){logger[_0xc534('0x27')](_0x39ef0d[_0xc534('0x28')]);if(_0x39ef0d[_0xc534('0x29')]){delete _0x39ef0d[_0xc534('0x29')];}_0x538836[_0xc534('0x19')](_0x869c79)[_0xc534('0x2a')](_0x39ef0d);};}var utilLicense=require(_0xc534('0x2b'));exports['index']=function(_0x2112f7,_0x6b6798){var _0x539716={'raw':!![],'where':{'id':0x1}},_0x3db396={};_0x3db396[_0xc534('0x2c')]=_[_0xc534('0x2d')](db['License'][_0xc534('0x2e')]);_0x3db396[_0xc534('0x2f')]=_[_0xc534('0x2d')](_0x2112f7[_0xc534('0x2f')]);_0x3db396[_0xc534('0x30')]=_[_0xc534('0x31')](_0x3db396['model'],_0x3db396[_0xc534('0x2f')]);_0x539716[_0xc534('0x32')]=_[_0xc534('0x31')](_0x3db396['model'],qs[_0xc534('0x33')](_0x2112f7[_0xc534('0x2f')][_0xc534('0x33')]));_0x539716[_0xc534('0x32')]=_0x539716[_0xc534('0x32')][_0xc534('0x34')]?_0x539716[_0xc534('0x32')]:_0x3db396[_0xc534('0x2c')];_0x539716=_[_0xc534('0x35')]({},_0x539716,_0x2112f7[_0xc534('0x36')]);return utilLicense[_0xc534('0x37')](_0x539716)['then'](respondWithResult(_0x6b6798,null))[_0xc534('0x38')](handleError(_0x6b6798,null));};exports[_0xc534('0x23')]=function(_0x5c1014,_0x1aeda7){if(_0x5c1014[_0xc534('0x39')]['id']){delete _0x5c1014[_0xc534('0x39')]['id'];}return db[_0xc534('0x3a')][_0xc534('0x3b')]({'where':{'id':_0x5c1014['params']['id']}})[_0xc534('0x3c')](handleEntityNotFound(_0x1aeda7,null))['then'](function(_0x2699cd){var _0x56c79b=_0x2699cd[_0xc534('0x3d')]({'plain':!![]});return utilLicense[_0xc534('0x3e')](_0x56c79b,_0x5c1014[_0xc534('0x39')][_0xc534('0x3f')]);})[_0xc534('0x3c')](function(_0x5decde){if(!_0x5decde[_0xc534('0x40')]){return saveUpdates(_0x5c1014[_0xc534('0x39')],null);}return _0x5decde;})['then'](respondWithResult(_0x1aeda7,null))['catch'](handleError(_0x1aeda7,null));};exports[_0xc534('0x41')]=function(_0x38559c,_0x36e2c2){var _0x51f262='license-info.log';var _0x3c785d=path['join'](_0xc534('0x42'),'log','xcally',_0x51f262);_0x36e2c2[_0xc534('0x43')](_0xc534('0x44'),'attachment;\x20filename='+_0x51f262);_0x36e2c2['set'](_0xc534('0x45'),_0xc534('0x46'));_0x36e2c2['download'](_0x3c785d);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 16c5695..54965b2 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 _0xc016=['License','license','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./license.attributes','exports'];(function(_0x351af1,_0x2770f7){var _0x2aaafd=function(_0x149d25){while(--_0x149d25){_0x351af1['push'](_0x351af1['shift']());}};_0x2aaafd(++_0x2770f7);}(_0xc016,0x13a));var _0x6c01=function(_0x5610b4,_0x4cc595){_0x5610b4=_0x5610b4-0x0;var _0x28d5e8=_0xc016[_0x5610b4];return _0x28d5e8;};'use strict';var _=require(_0x6c01('0x0'));var util=require(_0x6c01('0x1'));var logger=require(_0x6c01('0x2'))(_0x6c01('0x3'));var moment=require(_0x6c01('0x4'));var BPromise=require(_0x6c01('0x5'));var rp=require(_0x6c01('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6c01('0x7'));var attributes=require(_0x6c01('0x8'));module[_0x6c01('0x9')]=function(_0x2a52e1,_0x1a5df2){return _0x2a52e1['define'](_0x6c01('0xa'),attributes,{'tableName':_0x6c01('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd553=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./license.attributes','exports','License','license'];(function(_0x2d839a,_0x53b26b){var _0x54a7a6=function(_0x4d2af9){while(--_0x4d2af9){_0x2d839a['push'](_0x2d839a['shift']());}};_0x54a7a6(++_0x53b26b);}(_0xd553,0xc8));var _0x3d55=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0xd553[_0x74892f];return _0x10ee61;};'use strict';var _=require('lodash');var util=require(_0x3d55('0x0'));var logger=require(_0x3d55('0x1'))('api');var moment=require(_0x3d55('0x2'));var BPromise=require(_0x3d55('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3d55('0x4'));var config=require(_0x3d55('0x5'));var attributes=require(_0x3d55('0x6'));module[_0x3d55('0x7')]=function(_0x1e0eb8,_0x5e1d23){return _0x1e0eb8['define'](_0x3d55('0x8'),attributes,{'tableName':_0x3d55('0x9'),'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 7ec5b43..959bf63 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 _0x3ef9=['info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then'];(function(_0x8d2138,_0x3ce98f){var _0x1c6aa1=function(_0x55c20a){while(--_0x55c20a){_0x8d2138['push'](_0x8d2138['shift']());}};_0x1c6aa1(++_0x3ce98f);}(_0x3ef9,0xdb));var _0x93ef=function(_0x425c62,_0x457991){_0x425c62=_0x425c62-0x0;var _0x5eb48f=_0x3ef9[_0x425c62];return _0x5eb48f;};'use strict';var _=require(_0x93ef('0x0'));var util=require(_0x93ef('0x1'));var moment=require(_0x93ef('0x2'));var BPromise=require('bluebird');var rs=require(_0x93ef('0x3'));var fs=require('fs');var Redis=require(_0x93ef('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93ef('0x5'));var logger=require(_0x93ef('0x6'))('rpc');var config=require(_0x93ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93ef('0x8')][_0x93ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1f4f0a,_0x56c140,_0x25cbf0){return new BPromise(function(_0x3cfb8a,_0x129449){return client[_0x93ef('0xa')](_0x1f4f0a,_0x25cbf0)[_0x93ef('0xb')](function(_0x495e56){logger[_0x93ef('0xc')](_0x93ef('0xd'),_0x56c140,_0x93ef('0xe'));logger[_0x93ef('0xf')](_0x93ef('0x10'),_0x56c140,_0x93ef('0xe'),JSON['stringify'](_0x495e56));if(_0x495e56['error']){if(_0x495e56['error']['code']===0x1f4){logger['error'](_0x93ef('0xd'),_0x56c140,_0x495e56[_0x93ef('0x11')][_0x93ef('0x12')]);return _0x129449(_0x495e56[_0x93ef('0x11')]['message']);}logger['error'](_0x93ef('0xd'),_0x56c140,_0x495e56['error'][_0x93ef('0x12')]);return _0x3cfb8a(_0x495e56[_0x93ef('0x11')][_0x93ef('0x12')]);}else{logger[_0x93ef('0xc')](_0x93ef('0xd'),_0x56c140,'request\x20sent');_0x3cfb8a(_0x495e56[_0x93ef('0x13')]['message']);}})[_0x93ef('0x14')](function(_0x96084f){logger[_0x93ef('0x11')](_0x93ef('0xd'),_0x56c140,_0x96084f);_0x129449(_0x96084f);});});} \ No newline at end of file +var _0x70ed=['jayson/promise','client','http','then','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x17a020,_0x1b7d52){var _0x41c51c=function(_0x1a2078){while(--_0x1a2078){_0x17a020['push'](_0x17a020['shift']());}};_0x41c51c(++_0x1b7d52);}(_0x70ed,0xa0));var _0xd70e=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x70ed[_0x1e2080];return _0x260111;};'use strict';var _=require('lodash');var util=require(_0xd70e('0x0'));var moment=require('moment');var BPromise=require(_0xd70e('0x1'));var rs=require(_0xd70e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd70e('0x3'))['db'];var utils=require(_0xd70e('0x4'));var logger=require(_0xd70e('0x5'))(_0xd70e('0x6'));var config=require(_0xd70e('0x7'));var jayson=require(_0xd70e('0x8'));var client=jayson[_0xd70e('0x9')][_0xd70e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f93d3,_0x5b0df3,_0x2d1f8e){return new BPromise(function(_0x133e93,_0x101c10){return client['request'](_0x2f93d3,_0x2d1f8e)[_0xd70e('0xb')](function(_0x25b023){logger['info'](_0xd70e('0xc'),_0x5b0df3,'request\x20sent');logger[_0xd70e('0xd')](_0xd70e('0xe'),_0x5b0df3,_0xd70e('0xf'),JSON[_0xd70e('0x10')](_0x25b023));if(_0x25b023[_0xd70e('0x11')]){if(_0x25b023['error']['code']===0x1f4){logger[_0xd70e('0x11')](_0xd70e('0xc'),_0x5b0df3,_0x25b023['error'][_0xd70e('0x12')]);return _0x101c10(_0x25b023[_0xd70e('0x11')]['message']);}logger['error'](_0xd70e('0xc'),_0x5b0df3,_0x25b023[_0xd70e('0x11')][_0xd70e('0x12')]);return _0x133e93(_0x25b023[_0xd70e('0x11')][_0xd70e('0x12')]);}else{logger[_0xd70e('0x13')](_0xd70e('0xc'),_0x5b0df3,_0xd70e('0xf'));_0x133e93(_0x25b023[_0xd70e('0x14')][_0xd70e('0x12')]);}})['catch'](function(_0x51f9af){logger[_0xd70e('0x11')](_0xd70e('0xc'),_0x5b0df3,_0x51f9af);_0x101c10(_0x51f9af);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 4ab7c00..746efd9 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 _0x5bcf=['addApplications','/:id/send','addAgents','put','delete','removeAnswers','removeSmtp','/:id','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','/:id/interactions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addSmtp','addInteraction','/:id/applications'];(function(_0x547ea0,_0x58254c){var _0x36e258=function(_0x288a1a){while(--_0x288a1a){_0x547ea0['push'](_0x547ea0['shift']());}};_0x36e258(++_0x58254c);}(_0x5bcf,0x12f));var _0xf5bc=function(_0x5ad1d7,_0x2dd2cf){_0x5ad1d7=_0x5ad1d7-0x0;var _0xcf4632=_0x5bcf[_0x5ad1d7];return _0xcf4632;};'use strict';var multer=require(_0xf5bc('0x0'));var util=require(_0xf5bc('0x1'));var path=require('path');var timeout=require(_0xf5bc('0x2'));var express=require(_0xf5bc('0x3'));var router=express[_0xf5bc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf5bc('0x5'));var interaction=require(_0xf5bc('0x6'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xf5bc('0x7')]('/',auth[_0xf5bc('0x8')](),controller['index']);router[_0xf5bc('0x7')](_0xf5bc('0x9'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0xa')]);router[_0xf5bc('0x7')]('/:id',auth[_0xf5bc('0x8')](),controller[_0xf5bc('0xb')]);router[_0xf5bc('0x7')](_0xf5bc('0xc'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0xd')]);router[_0xf5bc('0x7')](_0xf5bc('0xe'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0xf')]);router[_0xf5bc('0x7')](_0xf5bc('0x10'),auth['isAuthenticated'](),controller['getImap']);router[_0xf5bc('0x7')](_0xf5bc('0x11'),auth[_0xf5bc('0x8')](),controller['getSmtp']);router[_0xf5bc('0x7')](_0xf5bc('0x12'),auth[_0xf5bc('0x8')](),controller['getInteractions']);router[_0xf5bc('0x7')]('/:id/applications',auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x13')]);router[_0xf5bc('0x7')](_0xf5bc('0x14'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x15')]);router[_0xf5bc('0x7')]('/:id/verify',auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x16')]);router['get'](_0xf5bc('0x17'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x18')]);router[_0xf5bc('0x19')](_0xf5bc('0xc'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x1a')]);router[_0xf5bc('0x19')](_0xf5bc('0xe'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x1b')]);router[_0xf5bc('0x19')]('/',auth['isAuthenticated'](),controller[_0xf5bc('0x1c')]);router['post'](_0xf5bc('0x10'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x1d')]);router['post']('/:id/out_servers',auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x1e')]);router[_0xf5bc('0x19')](_0xf5bc('0x12'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x1f')]);router['post'](_0xf5bc('0x20'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x21')]);router[_0xf5bc('0x19')](_0xf5bc('0x22'),auth[_0xf5bc('0x8')](),controller['send']);router[_0xf5bc('0x19')](_0xf5bc('0x17'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x23')]);router[_0xf5bc('0x24')]('/:id',auth[_0xf5bc('0x8')](),controller['update']);router[_0xf5bc('0x25')](_0xf5bc('0xc'),auth[_0xf5bc('0x8')](),controller['removeDispositions']);router[_0xf5bc('0x25')](_0xf5bc('0xe'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x26')]);router[_0xf5bc('0x25')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0xf5bc('0x25')](_0xf5bc('0x11'),auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x27')]);router[_0xf5bc('0x25')](_0xf5bc('0x28'),auth['isAuthenticated'](),controller['destroy']);router[_0xf5bc('0x25')]('/:id/users',auth[_0xf5bc('0x8')](),controller[_0xf5bc('0x29')]);module['exports']=router; \ No newline at end of file +var _0xcb7d=['getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','removeDispositions','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','/:id/messages'];(function(_0x207666,_0xa5858a){var _0x43eb15=function(_0x457ca2){while(--_0x457ca2){_0x207666['push'](_0x207666['shift']());}};_0x43eb15(++_0xa5858a);}(_0xcb7d,0x77));var _0xdcb7=function(_0x5ca5fe,_0xdc6c50){_0x5ca5fe=_0x5ca5fe-0x0;var _0x4a1d15=_0xcb7d[_0x5ca5fe];return _0x4a1d15;};'use strict';var multer=require(_0xdcb7('0x0'));var util=require(_0xdcb7('0x1'));var path=require('path');var timeout=require(_0xdcb7('0x2'));var express=require(_0xdcb7('0x3'));var router=express['Router']();var fs_extra=require(_0xdcb7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xdcb7('0x5'));var config=require('../../config/environment');var controller=require('./mailAccount.controller');router[_0xdcb7('0x6')]('/',auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x8')]);router[_0xdcb7('0x6')]('/describe',auth[_0xdcb7('0x7')](),controller['describe']);router[_0xdcb7('0x6')](_0xdcb7('0x9'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0xa')]);router[_0xdcb7('0x6')](_0xdcb7('0xb'),auth['isAuthenticated'](),controller[_0xdcb7('0xc')]);router['get'](_0xdcb7('0xd'),auth['isAuthenticated'](),controller[_0xdcb7('0xe')]);router['get'](_0xdcb7('0xf'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x10')]);router[_0xdcb7('0x6')]('/:id/out_servers',auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x11')]);router[_0xdcb7('0x6')](_0xdcb7('0x12'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x13')]);router['get'](_0xdcb7('0x14'),auth[_0xdcb7('0x7')](),controller['getApplications']);router[_0xdcb7('0x6')](_0xdcb7('0x15'),auth['isAuthenticated'](),controller[_0xdcb7('0x16')]);router[_0xdcb7('0x6')](_0xdcb7('0x17'),auth[_0xdcb7('0x7')](),controller['verifySmtp']);router[_0xdcb7('0x6')](_0xdcb7('0x18'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x19')]);router[_0xdcb7('0x1a')](_0xdcb7('0xb'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x1b')]);router[_0xdcb7('0x1a')](_0xdcb7('0xd'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x1c')]);router['post']('/',auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x1d')]);router[_0xdcb7('0x1a')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xdcb7('0x1e')]);router[_0xdcb7('0x1a')](_0xdcb7('0x1f'),auth['isAuthenticated'](),controller[_0xdcb7('0x20')]);router[_0xdcb7('0x1a')](_0xdcb7('0x12'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x21')]);router[_0xdcb7('0x1a')](_0xdcb7('0x14'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x22')]);router[_0xdcb7('0x1a')](_0xdcb7('0x23'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x24')]);router[_0xdcb7('0x1a')]('/:id/users',auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x25')]);router[_0xdcb7('0x26')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0xdcb7('0xb'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x27')]);router[_0xdcb7('0x28')](_0xdcb7('0xd'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x29')]);router[_0xdcb7('0x28')]('/:id/in_servers',auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x2a')]);router[_0xdcb7('0x28')](_0xdcb7('0x1f'),auth['isAuthenticated'](),controller[_0xdcb7('0x2b')]);router['delete'](_0xdcb7('0x9'),auth[_0xdcb7('0x7')](),controller[_0xdcb7('0x2c')]);router[_0xdcb7('0x28')](_0xdcb7('0x18'),auth['isAuthenticated'](),controller[_0xdcb7('0x2d')]);module[_0xdcb7('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 2af3a57..a5279f1 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 _0x90d1=['INTEGER','UNSIGNED','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x2de699,_0x29ccd8){var _0x1754b7=function(_0x4f70ee){while(--_0x4f70ee){_0x2de699['push'](_0x2de699['shift']());}};_0x1754b7(++_0x29ccd8);}(_0x90d1,0xc1));var _0x190d=function(_0x5a6d3b,_0x15a93b){_0x5a6d3b=_0x5a6d3b-0x0;var _0x3aaf17=_0x90d1[_0x5a6d3b];return _0x3aaf17;};'use strict';var Sequelize=require(_0x190d('0x0'));module['exports']={'description':{'type':Sequelize[_0x190d('0x1')]},'name':{'type':Sequelize[_0x190d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x190d('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x190d('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0x190d('0x3')]},'markAsUnread':{'type':Sequelize[_0x190d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x190d('0x1')],'allowNull':![],'defaultValue':_0x190d('0x4')},'fontSize':{'type':Sequelize[_0x190d('0x5')](0x2)[_0x190d('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x190d('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x190d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x190d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x190d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x190d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x190d('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x190d('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x190d('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x190d('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x489960){if(!_0x489960)this[_0x190d('0x8')](_0x190d('0x9'),null);this['setDataValue'](_0x190d('0xa'),_0x489960);}},'provider':{'type':Sequelize['ENUM'](_0x190d('0xb'),_0x190d('0xc'),_0x190d('0xd'),_0x190d('0xe')),'defaultValue':null,'get':function(){if(!this[_0x190d('0xf')](_0x190d('0x10')))return _0x190d('0x11');return this[_0x190d('0xf')](_0x190d('0x10'));},'set':function(_0x12c90c){if(_0x12c90c===_0x190d('0x11'))_0x12c90c=null;return this[_0x190d('0x8')]('provider',_0x12c90c);}}}; \ No newline at end of file +var _0x0a33=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','gmail','hotmail','yahoo','getDataValue','provider','custom','exports','STRING'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0a33,0x1ae));var _0x30a3=function(_0x507e46,_0x4166c1){_0x507e46=_0x507e46-0x0;var _0x3604d3=_0x0a33[_0x507e46];return _0x3604d3;};'use strict';var Sequelize=require('sequelize');module[_0x30a3('0x0')]={'description':{'type':Sequelize[_0x30a3('0x1')]},'name':{'type':Sequelize[_0x30a3('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x30a3('0x2')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x30a3('0x1')],'allowNull':![],'defaultValue':_0x30a3('0x3')},'fontSize':{'type':Sequelize[_0x30a3('0x4')](0x2)[_0x30a3('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x30a3('0x2')],'defaultValue':function(){return _0x30a3('0x6');}},'notificationSound':{'type':Sequelize[_0x30a3('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x30a3('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x30a3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x30a3('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x30a3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x30a3('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x30a3('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x30a3('0x4')],'allowNull':!![],'defaultValue':null,'comment':_0x30a3('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x30a3('0x7')],'defaultValue':![],'comment':_0x30a3('0x9'),'set':function(_0x461a2a){if(!_0x461a2a)this[_0x30a3('0xa')](_0x30a3('0xb'),null);this[_0x30a3('0xa')]('mandatoryDisposition',_0x461a2a);}},'provider':{'type':Sequelize['ENUM'](_0x30a3('0xc'),_0x30a3('0xd'),_0x30a3('0xe'),'outlook365'),'defaultValue':null,'get':function(){if(!this[_0x30a3('0xf')](_0x30a3('0x10')))return _0x30a3('0x11');return this['getDataValue'](_0x30a3('0x10'));},'set':function(_0x595a11){if(_0x595a11===_0x30a3('0x11'))_0x595a11=null;return this['setDataValue'](_0x30a3('0x10'),_0x595a11);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 0ad4a23..a8b991a 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 _0xa376=['sort','where','pick','filter','merge','options','findAll','rows','MailServerIn','fields','includeAll','include','find','body','provider','custom','params','Mail\x20Account\x20not\x20found','describe','MailAccountId','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','order','removeDispositions','ids','CannedAnswer','getAnswers','nolimit','removeAnswers','email','ListId','isNil','active','description','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','transaction','sequelize','Transaction','ISOLATION_LEVELS','MailApplication','bulkCreate','priority','getApplications','MailMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','CloudProvider','Smtp\x20configuration\x20not\x20found','from','format','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','util','path','lodash','juice','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','get','UserProfileResource','destroy','sendStatus','stack','name','send','gmail','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','modernAuthentication','CloudProviderId','pass','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','length'];(function(_0x499123,_0x345139){var _0xb511bf=function(_0x21fdac){while(--_0x21fdac){_0x499123['push'](_0x499123['shift']());}};_0xb511bf(++_0x345139);}(_0xa376,0x129));var _0x6a37=function(_0x19b347,_0x383da8){_0x19b347=_0x19b347-0x0;var _0x1dc07d=_0xa376[_0x19b347];return _0x1dc07d;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x6a37('0x0'));var path=require(_0x6a37('0x1'));var _=require(_0x6a37('0x2'));var juice=require(_0x6a37('0x3'));var Redis=require(_0x6a37('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x6a37('0x5'))(_0x6a37('0x6'));var config=require(_0x6a37('0x7'));var db=require(_0x6a37('0x8'))['db'];config['redis']=_[_0x6a37('0x9')](config[_0x6a37('0xa')],{'host':_0x6a37('0xb'),'port':0x18eb});var socket=require(_0x6a37('0xc'))(new Redis(config[_0x6a37('0xa')]));require(_0x6a37('0xd'))['register'](socket);var jayson=require(_0x6a37('0xe'));var client=jayson[_0x6a37('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x5e58c9,_0x52c910,_0x205af8,_0x34cb50){return new BPromise(function(_0x49be25,_0x3809d5){var _0x1772bd=_0x34cb50||client;return _0x1772bd['request'](_0x5e58c9,_0x205af8)[_0x6a37('0x10')](function(_0x2302a3){logger[_0x6a37('0x11')](_0x6a37('0x12'),_0x52c910,_0x6a37('0x13'));logger['debug'](_0x6a37('0x14'),_0x52c910,'request\x20sent',JSON['stringify'](_0x2302a3));if(_0x2302a3['error']){if(_0x2302a3['error'][_0x6a37('0x15')]===0x1f4){logger[_0x6a37('0x16')](_0x6a37('0x12'),_0x52c910,_0x2302a3['error'][_0x6a37('0x17')]);return _0x3809d5(_0x2302a3[_0x6a37('0x16')][_0x6a37('0x17')]);}logger[_0x6a37('0x16')](_0x6a37('0x12'),_0x52c910,_0x2302a3[_0x6a37('0x16')][_0x6a37('0x17')]);return _0x49be25(_0x2302a3['error'][_0x6a37('0x17')]);}else{logger[_0x6a37('0x11')](_0x6a37('0x12'),_0x52c910,'request\x20sent');_0x49be25(_0x2302a3[_0x6a37('0x18')][_0x6a37('0x17')]);}})[_0x6a37('0x19')](function(_0x2a1676){logger[_0x6a37('0x16')](_0x6a37('0x12'),_0x52c910,_0x2a1676);_0x3809d5(_0x2a1676);});});}function respondWithStatusCode(_0x4ef50f,_0x593d67){_0x593d67=_0x593d67||0xcc;return function(_0x30ffff){if(_0x30ffff){return _0x4ef50f['sendStatus'](_0x593d67);}return _0x4ef50f[_0x6a37('0x1a')](_0x593d67)[_0x6a37('0x1b')]();};}function respondWithResult(_0x1361cd,_0x51f775){_0x51f775=_0x51f775||0xc8;return function(_0x249f4f){if(_0x249f4f){return _0x1361cd[_0x6a37('0x1a')](_0x51f775)[_0x6a37('0x1c')](_0x249f4f);}};}function respondWithFilteredResult(_0x402f47,_0x1d4007){return function(_0x335d8c){if(_0x335d8c){var _0x4cee87=typeof _0x1d4007[_0x6a37('0x1d')]===_0x6a37('0x1e')&&typeof _0x1d4007[_0x6a37('0x1f')]===_0x6a37('0x1e');var _0x42d47a=_0x335d8c[_0x6a37('0x20')];var _0x581127=_0x4cee87?0x0:_0x1d4007[_0x6a37('0x1d')];var _0x287ee2=_0x4cee87?_0x335d8c[_0x6a37('0x20')]:_0x1d4007[_0x6a37('0x1d')]+_0x1d4007[_0x6a37('0x1f')];var _0x1369f3;if(_0x287ee2>=_0x42d47a){_0x287ee2=_0x42d47a;_0x1369f3=0xc8;}else{_0x1369f3=0xce;}_0x402f47[_0x6a37('0x1a')](_0x1369f3);return _0x402f47[_0x6a37('0x21')](_0x6a37('0x22'),_0x581127+'-'+_0x287ee2+'/'+_0x42d47a)[_0x6a37('0x1c')](_0x335d8c);}return null;};}function saveUpdates(_0x3cf866){return function(_0x147747){if(_0x147747){return _0x147747[_0x6a37('0x23')](_0x3cf866)[_0x6a37('0x10')](function(_0x60c0f1){return _0x60c0f1;});}return null;};}function removeEntity(_0x2ef930){return function(_0x57937d){if(_0x57937d){return _0x57937d['destroy']()['then'](function(){var _0x477827=_0x57937d[_0x6a37('0x24')]({'plain':!![]});var _0x39e704='MailAccounts';return db[_0x6a37('0x25')][_0x6a37('0x26')]({'where':{'type':_0x39e704,'resourceId':_0x477827['id']}})[_0x6a37('0x10')](function(){return _0x57937d;});})[_0x6a37('0x10')](function(){_0x2ef930[_0x6a37('0x1a')](0xcc)[_0x6a37('0x1b')]();});}};}function handleEntityNotFound(_0x2258ba){return function(_0x11ee46){if(!_0x11ee46){_0x2258ba[_0x6a37('0x27')](0x194);}return _0x11ee46;};}function handleError(_0x1d8f9d,_0x16cfbb){_0x16cfbb=_0x16cfbb||0x1f4;return function(_0x46023d){logger[_0x6a37('0x16')](_0x46023d[_0x6a37('0x28')]);if(_0x46023d[_0x6a37('0x29')]){delete _0x46023d[_0x6a37('0x29')];}_0x1d8f9d['status'](_0x16cfbb)[_0x6a37('0x2a')](_0x46023d);};}function getImapHost(_0x18c0a7){switch(_0x18c0a7){case _0x6a37('0x2b'):return'imap.gmail.com';case _0x6a37('0x2c'):return'imap.mail.yahoo.com';case'hotmail':return _0x6a37('0x2d');case _0x6a37('0x2e'):return _0x6a37('0x2f');}throw new Error(_0x6a37('0x30'),_0x18c0a7);}function getSmtpHost(_0x5534a5){switch(_0x5534a5){case _0x6a37('0x2b'):return _0x6a37('0x31');case _0x6a37('0x2c'):return _0x6a37('0x32');case'hotmail':return _0x6a37('0x33');case'outlook365':return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x5534a5);}function getAuthenticationOptions(_0x2b4887,_0x47547c){var _0x473959={};var _0x2197de={};if(_0x2b4887){_0x473959['user']=_0x2197de[_0x6a37('0x34')]=_0x47547c[_0x6a37('0x35')];_0x473959[_0x6a37('0x36')]=_0x2197de['pass']=_0x47547c[_0x6a37('0x36')];if(_0x47547c[_0x6a37('0x37')]){_0x473959['modernAuthentication']=_0x2197de[_0x6a37('0x37')]=!![];_0x473959[_0x6a37('0x38')]=_0x2197de[_0x6a37('0x38')]=_0x47547c[_0x6a37('0x38')];_0x473959[_0x6a37('0x36')]=_0x2197de[_0x6a37('0x39')]=null;}else{_0x473959['CloudProviderId']=_0x2197de[_0x6a37('0x38')]=null;}_0x473959[_0x6a37('0x3a')]=getImapHost(_0x2b4887);_0x473959[_0x6a37('0x3b')]=0x3e1;_0x2197de['host']=getSmtpHost(_0x2b4887);_0x2197de[_0x6a37('0x3b')]=0x24b;_0x2197de[_0x6a37('0x3c')]=![];_0x473959[_0x6a37('0x3d')]=_0x2197de['service']=null;}else{if(_0x47547c['authentication']){_0x473959[_0x6a37('0x34')]=_0x2197de[_0x6a37('0x34')]=_0x47547c['username'];_0x473959[_0x6a37('0x36')]=_0x2197de['pass']=_0x47547c[_0x6a37('0x36')];}else{_0x473959['authentication']=_0x2197de[_0x6a37('0x3e')]=![];_0x473959[_0x6a37('0x34')]=_0x2197de[_0x6a37('0x34')]=null;_0x473959['password']=_0x2197de['pass']=null;}_0x473959[_0x6a37('0x3a')]=_0x47547c[_0x6a37('0x3f')]['host'];_0x473959['port']=_0x47547c[_0x6a37('0x3f')][_0x6a37('0x3b')];_0x2197de[_0x6a37('0x3a')]=_0x47547c[_0x6a37('0x40')][_0x6a37('0x3a')];_0x2197de[_0x6a37('0x3b')]=_0x47547c[_0x6a37('0x40')][_0x6a37('0x3b')];}return{'Imap':_0x473959,'Smtp':_0x2197de};}exports[_0x6a37('0x41')]=function(_0x326284,_0x3c9cb9){var _0x2fe5d8={'include':[{'model':db['MailServerIn'],'as':_0x6a37('0x3f')},{'model':db[_0x6a37('0x42')],'as':'Smtp'},{'model':db[_0x6a37('0x43')],'as':_0x6a37('0x44')}]},_0xe531b4={},_0x2af5f0={'count':0x0,'rows':[]};var _0x4de060=_[_0x6a37('0x45')](db[_0x6a37('0x46')]['rawAttributes'],function(_0x1c85e3){return{'name':_0x1c85e3[_0x6a37('0x47')],'type':_0x1c85e3[_0x6a37('0x48')][_0x6a37('0x49')]};});_0xe531b4[_0x6a37('0x4a')]=_[_0x6a37('0x45')](_0x4de060,_0x6a37('0x29'));_0xe531b4[_0x6a37('0x4b')]=_[_0x6a37('0x4c')](_0x326284['query']);_0xe531b4[_0x6a37('0x4d')]=_[_0x6a37('0x4e')](_0xe531b4['model'],_0xe531b4['query']);_0x2fe5d8[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0xe531b4['model'],qs['fields'](_0x326284['query']['fields']));_0x2fe5d8[_0x6a37('0x4f')]=_0x2fe5d8[_0x6a37('0x4f')][_0x6a37('0x50')]?_0x2fe5d8[_0x6a37('0x4f')]:_0xe531b4['model'];if(!_0x326284['query']['hasOwnProperty']('nolimit')){_0x2fe5d8[_0x6a37('0x1f')]=qs['limit'](_0x326284[_0x6a37('0x4b')][_0x6a37('0x1f')]);_0x2fe5d8[_0x6a37('0x1d')]=qs[_0x6a37('0x1d')](_0x326284[_0x6a37('0x4b')][_0x6a37('0x1d')]);}_0x2fe5d8['order']=qs[_0x6a37('0x51')](_0x326284[_0x6a37('0x4b')][_0x6a37('0x51')]);_0x2fe5d8[_0x6a37('0x52')]=qs[_0x6a37('0x4d')](_[_0x6a37('0x53')](_0x326284[_0x6a37('0x4b')],_0xe531b4[_0x6a37('0x4d')]),_0x4de060);if(_0x326284[_0x6a37('0x4b')]['filter']){_0x2fe5d8[_0x6a37('0x52')]=_['merge'](_0x2fe5d8[_0x6a37('0x52')],{'$or':_[_0x6a37('0x45')](_0x4de060,function(_0x3f580c){if(_0x3f580c[_0x6a37('0x48')]!=='VIRTUAL'){var _0x4a5756={};_0x4a5756[_0x3f580c[_0x6a37('0x29')]]={'$like':'%'+_0x326284[_0x6a37('0x4b')][_0x6a37('0x54')]+'%'};return _0x4a5756;}})});}_0x2fe5d8=_[_0x6a37('0x55')]({},_0x2fe5d8,_0x326284[_0x6a37('0x56')]);var _0x22e32f={'where':_0x2fe5d8[_0x6a37('0x52')]};return db[_0x6a37('0x46')]['count'](_0x22e32f)[_0x6a37('0x10')](function(_0x290735){_0x2af5f0[_0x6a37('0x20')]=_0x290735;if(_0x326284[_0x6a37('0x4b')]['includeAll']){_0x2fe5d8['include']=[{'all':!![]}];}return db['MailAccount'][_0x6a37('0x57')](_0x2fe5d8);})[_0x6a37('0x10')](function(_0x5ee2d3){_0x2af5f0[_0x6a37('0x58')]=_0x5ee2d3;return _0x2af5f0;})[_0x6a37('0x10')](respondWithFilteredResult(_0x3c9cb9,_0x2fe5d8))[_0x6a37('0x19')](handleError(_0x3c9cb9,null));};exports['show']=function(_0x33c07f,_0x5b5c4b){var _0xfdd581={'raw':![],'where':{'id':_0x33c07f['params']['id']},'include':[{'model':db[_0x6a37('0x59')],'as':_0x6a37('0x3f')},{'model':db['MailServerOut'],'as':_0x6a37('0x40')},{'model':db[_0x6a37('0x43')],'as':_0x6a37('0x44')}]},_0x105e1d={};_0x105e1d[_0x6a37('0x4a')]=_[_0x6a37('0x4c')](db[_0x6a37('0x46')]['rawAttributes']);_0x105e1d[_0x6a37('0x4b')]=_[_0x6a37('0x4c')](_0x33c07f['query']);_0x105e1d[_0x6a37('0x4d')]=_['intersection'](_0x105e1d[_0x6a37('0x4a')],_0x105e1d[_0x6a37('0x4b')]);_0xfdd581[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0x105e1d['model'],qs['fields'](_0x33c07f[_0x6a37('0x4b')][_0x6a37('0x5a')]));_0xfdd581[_0x6a37('0x4f')]=_0xfdd581[_0x6a37('0x4f')]['length']?_0xfdd581[_0x6a37('0x4f')]:_0x105e1d[_0x6a37('0x4a')];if(_0x33c07f[_0x6a37('0x4b')][_0x6a37('0x5b')]){_0xfdd581[_0x6a37('0x5c')]=[{'all':!![]}];}_0xfdd581=_[_0x6a37('0x55')]({},_0xfdd581,_0x33c07f[_0x6a37('0x56')]);return db[_0x6a37('0x46')][_0x6a37('0x5d')](_0xfdd581)['then'](handleEntityNotFound(_0x5b5c4b,null))[_0x6a37('0x10')](respondWithResult(_0x5b5c4b,null))[_0x6a37('0x19')](handleError(_0x5b5c4b,null));};exports[_0x6a37('0x23')]=function(_0xe843eb,_0x26dee){if(_0xe843eb[_0x6a37('0x5e')]['id']){delete _0xe843eb['body']['id'];}var _0x31dad6=_0xe843eb[_0x6a37('0x5e')][_0x6a37('0x5f')]===_0x6a37('0x60')?null:_0xe843eb[_0x6a37('0x5e')][_0x6a37('0x5f')];var _0x4562d7=_0xe843eb[_0x6a37('0x5e')][_0x6a37('0x3f')]||{};var _0x54546c=_0xe843eb[_0x6a37('0x5e')][_0x6a37('0x40')]||{};if(_0x31dad6){_0x4562d7[_0x6a37('0x3a')]=getImapHost(_0x31dad6);_0x4562d7[_0x6a37('0x3b')]=0x3e1;_0x54546c['host']=getSmtpHost(_0x31dad6);_0x54546c[_0x6a37('0x3b')]=0x24b;_0x54546c[_0x6a37('0x3c')]=![];}if(_0x54546c['modernAuthentication']){_0x54546c[_0x6a37('0x3c')]=![];}else{_0x54546c[_0x6a37('0x38')]=null;}if(!_0x4562d7[_0x6a37('0x37')])_0x4562d7[_0x6a37('0x38')]=null;_0xe843eb['body'][_0x6a37('0x3f')]=_0x4562d7;_0xe843eb[_0x6a37('0x5e')]['Smtp']=_0x54546c;return db['MailAccount'][_0x6a37('0x5d')]({'where':{'id':_0xe843eb[_0x6a37('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x6a37('0x3f')},{'model':db[_0x6a37('0x42')],'as':_0x6a37('0x40')},{'model':db[_0x6a37('0x43')],'as':_0x6a37('0x44')}]})[_0x6a37('0x10')](handleEntityNotFound(_0x26dee,null))[_0x6a37('0x10')](function(_0x28d0c6){if(!_0x28d0c6)throw new Error(_0x6a37('0x62'));if(_0x28d0c6[_0x6a37('0x3d')])delete _0xe843eb[_0x6a37('0x5e')][_0x6a37('0x3f')];return _0x28d0c6;})[_0x6a37('0x10')](saveUpdates(_0xe843eb[_0x6a37('0x5e')],null))[_0x6a37('0x10')](function(_0x108f70){if(!_0xe843eb[_0x6a37('0x5e')][_0x6a37('0x3f')])return _0x108f70;return db[_0x6a37('0x59')][_0x6a37('0x23')](_0xe843eb[_0x6a37('0x5e')]['Imap'],{'where':{'MailAccountId':_0x108f70['id']}})['then'](function(){return _0x108f70;});})['then'](function(_0x431048){if(!_0xe843eb[_0x6a37('0x5e')][_0x6a37('0x40')])return _0x431048;return db[_0x6a37('0x42')][_0x6a37('0x23')](_0xe843eb[_0x6a37('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x431048['id']}})[_0x6a37('0x10')](function(){return _0x431048;});})[_0x6a37('0x10')](respondWithResult(_0x26dee,null))[_0x6a37('0x19')](handleError(_0x26dee,null));};exports[_0x6a37('0x63')]=function(_0xa134be,_0x151a91){return db[_0x6a37('0x46')]['describe']()[_0x6a37('0x10')](respondWithResult(_0x151a91,null))[_0x6a37('0x19')](handleError(_0x151a91,null));};exports['addDisposition']=function(_0x4e0ef3,_0x29283c){if(_0x4e0ef3[_0x6a37('0x5e')]['id']){delete _0x4e0ef3[_0x6a37('0x5e')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x4e0ef3[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x29283c,null))['then'](function(_0xf87203){if(_0xf87203){_0x4e0ef3[_0x6a37('0x5e')][_0x6a37('0x64')]=_0xf87203['id'];return db[_0x6a37('0x65')][_0x6a37('0x66')](_0x4e0ef3[_0x6a37('0x5e')]);}})[_0x6a37('0x10')](respondWithResult(_0x29283c,null))[_0x6a37('0x19')](handleError(_0x29283c,null));};exports[_0x6a37('0x67')]=function(_0x9114ac,_0x378910){var _0x130ff1={'raw':![],'where':{}};var _0x3dbcb8={};var _0x1ecd2f={'count':0x0,'rows':[]};return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x9114ac[_0x6a37('0x61')]['id']}})['then'](handleEntityNotFound(_0x378910,null))['then'](function(_0x1117f3){if(_0x1117f3){_0x3dbcb8['model']=_['keys'](db[_0x6a37('0x65')][_0x6a37('0x69')]);_0x3dbcb8[_0x6a37('0x4b')]=_['keys'](_0x9114ac[_0x6a37('0x4b')]);_0x3dbcb8[_0x6a37('0x4d')]=_[_0x6a37('0x4e')](_0x3dbcb8[_0x6a37('0x4a')],_0x3dbcb8['query']);_0x130ff1[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0x3dbcb8[_0x6a37('0x4a')],qs['fields'](_0x9114ac['query'][_0x6a37('0x5a')]));_0x130ff1[_0x6a37('0x4f')]=_0x130ff1['attributes'][_0x6a37('0x50')]?_0x130ff1['attributes']:_0x3dbcb8[_0x6a37('0x4a')];if(!_0x9114ac[_0x6a37('0x4b')][_0x6a37('0x6a')]('nolimit')){_0x130ff1[_0x6a37('0x1f')]=qs[_0x6a37('0x1f')](_0x9114ac[_0x6a37('0x4b')][_0x6a37('0x1f')]);_0x130ff1[_0x6a37('0x1d')]=qs[_0x6a37('0x1d')](_0x9114ac['query'][_0x6a37('0x1d')]);}_0x130ff1[_0x6a37('0x6b')]=qs[_0x6a37('0x51')](_0x9114ac[_0x6a37('0x4b')][_0x6a37('0x51')]);_0x130ff1[_0x6a37('0x52')]=qs[_0x6a37('0x4d')](_['pick'](_0x9114ac[_0x6a37('0x4b')],_0x3dbcb8[_0x6a37('0x4d')]));_0x130ff1[_0x6a37('0x52')][_0x6a37('0x64')]=_0x1117f3['id'];if(_0x9114ac[_0x6a37('0x4b')][_0x6a37('0x54')]){_0x130ff1[_0x6a37('0x52')]=_['merge'](_0x130ff1[_0x6a37('0x52')],{'$or':_[_0x6a37('0x45')](_0x130ff1[_0x6a37('0x4f')],function(_0x37b97a){var _0x17f762={};_0x17f762[_0x37b97a]={'$like':'%'+_0x9114ac['query'][_0x6a37('0x54')]+'%'};return _0x17f762;})});}_0x130ff1=_['merge']({},_0x130ff1,_0x9114ac[_0x6a37('0x56')]);return db['Disposition'][_0x6a37('0x20')]({'where':_0x130ff1[_0x6a37('0x52')]})['then'](function(_0xe2bbd9){_0x1ecd2f[_0x6a37('0x20')]=_0xe2bbd9;if(_0x9114ac[_0x6a37('0x4b')][_0x6a37('0x5b')]){_0x130ff1['include']=[{'all':!![]}];}return db['Disposition'][_0x6a37('0x57')](_0x130ff1);})[_0x6a37('0x10')](function(_0x4f7673){_0x1ecd2f[_0x6a37('0x58')]=_0x4f7673;return _0x1ecd2f;});}})[_0x6a37('0x10')](respondWithFilteredResult(_0x378910,_0x130ff1))[_0x6a37('0x19')](handleError(_0x378910,null));};exports[_0x6a37('0x6c')]=function(_0x12187d,_0x16a6e3){return db['MailAccount'][_0x6a37('0x5d')]({'where':{'id':_0x12187d[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x16a6e3,null))[_0x6a37('0x10')](function(_0xb9b497){if(_0xb9b497){return _0xb9b497[_0x6a37('0x6c')](_0x12187d[_0x6a37('0x4b')][_0x6a37('0x6d')]);}})['then'](respondWithStatusCode(_0x16a6e3,null))[_0x6a37('0x19')](handleError(_0x16a6e3,null));};exports['addAnswer']=function(_0x46deb4,_0x5ba3f3){if(_0x46deb4[_0x6a37('0x5e')]['id']){delete _0x46deb4['body']['id'];}return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x46deb4[_0x6a37('0x61')]['id']}})['then'](handleEntityNotFound(_0x5ba3f3,null))[_0x6a37('0x10')](function(_0x437ef8){if(_0x437ef8){_0x46deb4['body'][_0x6a37('0x64')]=_0x437ef8['id'];return db[_0x6a37('0x6e')][_0x6a37('0x66')](_0x46deb4[_0x6a37('0x5e')]);}})['then'](respondWithResult(_0x5ba3f3,null))[_0x6a37('0x19')](handleError(_0x5ba3f3,null));};exports[_0x6a37('0x6f')]=function(_0x33344e,_0x1e695c){var _0x1f382b={'raw':![],'where':{}};var _0x493486={};var _0x3fc491={'count':0x0,'rows':[]};return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x33344e[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x1e695c,null))[_0x6a37('0x10')](function(_0x4e4fa6){if(_0x4e4fa6){_0x493486[_0x6a37('0x4a')]=_['keys'](db[_0x6a37('0x6e')][_0x6a37('0x69')]);_0x493486[_0x6a37('0x4b')]=_[_0x6a37('0x4c')](_0x33344e[_0x6a37('0x4b')]);_0x493486[_0x6a37('0x4d')]=_[_0x6a37('0x4e')](_0x493486['model'],_0x493486[_0x6a37('0x4b')]);_0x1f382b[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0x493486[_0x6a37('0x4a')],qs[_0x6a37('0x5a')](_0x33344e[_0x6a37('0x4b')]['fields']));_0x1f382b[_0x6a37('0x4f')]=_0x1f382b[_0x6a37('0x4f')][_0x6a37('0x50')]?_0x1f382b['attributes']:_0x493486[_0x6a37('0x4a')];if(!_0x33344e['query'][_0x6a37('0x6a')](_0x6a37('0x70'))){_0x1f382b[_0x6a37('0x1f')]=qs['limit'](_0x33344e[_0x6a37('0x4b')][_0x6a37('0x1f')]);_0x1f382b[_0x6a37('0x1d')]=qs[_0x6a37('0x1d')](_0x33344e[_0x6a37('0x4b')]['offset']);}_0x1f382b[_0x6a37('0x6b')]=qs[_0x6a37('0x51')](_0x33344e['query'][_0x6a37('0x51')]);_0x1f382b['where']=qs[_0x6a37('0x4d')](_[_0x6a37('0x53')](_0x33344e[_0x6a37('0x4b')],_0x493486[_0x6a37('0x4d')]));_0x1f382b[_0x6a37('0x52')]['MailAccountId']=_0x4e4fa6['id'];if(_0x33344e[_0x6a37('0x4b')][_0x6a37('0x54')]){_0x1f382b[_0x6a37('0x52')]=_[_0x6a37('0x55')](_0x1f382b[_0x6a37('0x52')],{'$or':_['map'](_0x1f382b[_0x6a37('0x4f')],function(_0x116d65){var _0x4b6da5={};_0x4b6da5[_0x116d65]={'$like':'%'+_0x33344e[_0x6a37('0x4b')][_0x6a37('0x54')]+'%'};return _0x4b6da5;})});}_0x1f382b=_[_0x6a37('0x55')]({},_0x1f382b,_0x33344e[_0x6a37('0x56')]);return db[_0x6a37('0x6e')][_0x6a37('0x20')]({'where':_0x1f382b[_0x6a37('0x52')]})[_0x6a37('0x10')](function(_0x211864){_0x3fc491[_0x6a37('0x20')]=_0x211864;if(_0x33344e[_0x6a37('0x4b')][_0x6a37('0x5b')]){_0x1f382b['include']=[{'all':!![]}];}return db[_0x6a37('0x6e')]['findAll'](_0x1f382b);})[_0x6a37('0x10')](function(_0x55fff7){_0x3fc491[_0x6a37('0x58')]=_0x55fff7;return _0x3fc491;});}})['then'](respondWithFilteredResult(_0x1e695c,_0x1f382b))['catch'](handleError(_0x1e695c,null));};exports[_0x6a37('0x71')]=function(_0x4a356c,_0x581e63){return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x4a356c[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x581e63,null))[_0x6a37('0x10')](function(_0x4e9a85){if(_0x4e9a85){return _0x4e9a85[_0x6a37('0x71')](_0x4a356c['query'][_0x6a37('0x6d')]);}})[_0x6a37('0x10')](respondWithStatusCode(_0x581e63,null))['catch'](handleError(_0x581e63,null));};exports[_0x6a37('0x66')]=function(_0x3dd2c2,_0x1a82cc){var _0x2f533f={'name':_0x3dd2c2[_0x6a37('0x5e')]['name'],'key':_0x3dd2c2[_0x6a37('0x5e')][_0x6a37('0x49')],'provider':_0x3dd2c2['body']['provider']===_0x6a37('0x60')?null:_0x3dd2c2['body'][_0x6a37('0x5f')],'email':_0x3dd2c2['body'][_0x6a37('0x72')],'ListId':_0x3dd2c2[_0x6a37('0x5e')][_0x6a37('0x73')],'active':!_[_0x6a37('0x74')](_0x3dd2c2[_0x6a37('0x5e')][_0x6a37('0x75')])?_0x3dd2c2[_0x6a37('0x5e')][_0x6a37('0x75')]:!![],'description':_0x3dd2c2['body'][_0x6a37('0x76')]||null};var _0x42b535=getAuthenticationOptions(_0x2f533f[_0x6a37('0x5f')],_0x3dd2c2[_0x6a37('0x5e')]);_0x2f533f[_0x6a37('0x3f')]=_0x42b535[_0x6a37('0x3f')];_0x2f533f[_0x6a37('0x40')]=_0x42b535['Smtp'];return db[_0x6a37('0x46')][_0x6a37('0x66')](_0x2f533f,{'include':[{'model':db['MailServerOut'],'as':_0x6a37('0x40')},{'model':db[_0x6a37('0x59')],'as':_0x6a37('0x3f')}]})[_0x6a37('0x10')](function(_0x419851){var _0x4255f5=_0x3dd2c2['user'][_0x6a37('0x24')]({'plain':!![]});if(!_0x4255f5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4255f5[_0x6a37('0x77')]===_0x6a37('0x34')){var _0x29c628=_0x419851['get']({'plain':!![]});return db['UserProfileSection'][_0x6a37('0x5d')]({'where':{'name':'MailAccounts','userProfileId':_0x4255f5[_0x6a37('0x78')]},'raw':!![]})[_0x6a37('0x10')](function(_0x50f4cb){if(_0x50f4cb&&_0x50f4cb[_0x6a37('0x79')]===0x0){return db[_0x6a37('0x25')][_0x6a37('0x66')]({'name':_0x29c628[_0x6a37('0x29')],'resourceId':_0x29c628['id'],'type':_0x50f4cb[_0x6a37('0x29')],'sectionId':_0x50f4cb['id']},{})['then'](function(){return _0x419851;});}else{return _0x419851;}})['catch'](function(_0x21b3d0){logger['error'](_0x6a37('0x7a'),_0x21b3d0);throw _0x21b3d0;});}return _0x419851;})[_0x6a37('0x10')](respondWithResult(_0x1a82cc,0xc9))[_0x6a37('0x19')](handleError(_0x1a82cc,null));};exports[_0x6a37('0x7b')]=function(_0x2db2f6,_0x328ef9){return db['MailAccount']['findOne']({'where':{'id':_0x2db2f6[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x328ef9,null))[_0x6a37('0x10')](function(_0x169b00){if(_0x169b00){return _0x169b00[_0x6a37('0x7b')]();}return null;})[_0x6a37('0x10')](respondWithResult(_0x328ef9,null))[_0x6a37('0x19')](handleError(_0x328ef9,null));};exports[_0x6a37('0x7c')]=function(_0x37b213,_0x450ce9){if(_0x37b213[_0x6a37('0x5e')]['id']){delete _0x37b213[_0x6a37('0x5e')]['id'];}return db['MailAccount'][_0x6a37('0x5d')]({'where':{'id':_0x37b213[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x450ce9,null))['then'](function(_0x302d93){if(_0x302d93){_0x37b213[_0x6a37('0x5e')][_0x6a37('0x64')]=_0x302d93['id'];return db[_0x6a37('0x59')][_0x6a37('0x66')](_0x37b213[_0x6a37('0x5e')]);}})[_0x6a37('0x10')](respondWithResult(_0x450ce9,null))[_0x6a37('0x19')](handleError(_0x450ce9,null));};exports[_0x6a37('0x7d')]=function(_0x544f7a,_0xa06061){return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x544f7a[_0x6a37('0x61')]['id']}})['then'](handleEntityNotFound(_0xa06061,null))[_0x6a37('0x10')](function(_0x429532){if(_0x429532){return _0x429532[_0x6a37('0x7e')](null);}return null;})[_0x6a37('0x10')](respondWithStatusCode(_0xa06061,null))[_0x6a37('0x19')](handleError(_0xa06061,null));};exports[_0x6a37('0x7f')]=function(_0x142ad3,_0x56de08){return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x142ad3[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x56de08,null))['then'](function(_0xf9b0b6){if(_0xf9b0b6){return _0xf9b0b6[_0x6a37('0x7f')]();}return null;})[_0x6a37('0x10')](respondWithResult(_0x56de08,null))[_0x6a37('0x19')](handleError(_0x56de08,null));};exports[_0x6a37('0x80')]=function(_0x3bb829,_0x2d94f0){if(_0x3bb829[_0x6a37('0x5e')]['id']){delete _0x3bb829[_0x6a37('0x5e')]['id'];}return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x3bb829[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x2d94f0,null))['then'](function(_0x1417ee){if(_0x1417ee){_0x3bb829[_0x6a37('0x5e')][_0x6a37('0x64')]=_0x1417ee['id'];return db['MailServerOut'][_0x6a37('0x66')](_0x3bb829[_0x6a37('0x5e')]);}})['then'](respondWithResult(_0x2d94f0,null))[_0x6a37('0x19')](handleError(_0x2d94f0,null));};exports[_0x6a37('0x81')]=function(_0x4fb643,_0x58991d){return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x4fb643[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x58991d,null))['then'](function(_0x38cdcc){if(_0x38cdcc){return _0x38cdcc[_0x6a37('0x82')](null);}return null;})['then'](respondWithStatusCode(_0x58991d,null))['catch'](handleError(_0x58991d,null));};exports[_0x6a37('0x83')]=function(_0x162b97,_0x507ff6){return db[_0x6a37('0x84')][_0x6a37('0x5d')]({'where':{'id':_0x162b97[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x507ff6,null))[_0x6a37('0x10')](function(_0x355caa){if(_0x355caa){return _0x355caa[_0x6a37('0x83')](_0x162b97['body'][_0x6a37('0x6d')],_[_0x6a37('0x85')](_0x162b97[_0x6a37('0x5e')],[_0x6a37('0x6d'),'id'])||{});}})[_0x6a37('0x10')](respondWithResult(_0x507ff6,null))[_0x6a37('0x19')](handleError(_0x507ff6,null));};exports[_0x6a37('0x86')]=function(_0x80c3bf,_0x5c3af1){var _0x591228={'raw':![],'where':{}};var _0x43ea16={};var _0x4b338a={'count':0x0,'rows':[]};return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x80c3bf['params']['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x5c3af1,null))[_0x6a37('0x10')](function(_0x1641dc){if(_0x1641dc){_0x43ea16[_0x6a37('0x4a')]=_[_0x6a37('0x4c')](db['MailInteraction'][_0x6a37('0x69')]);_0x43ea16['query']=_['keys'](_0x80c3bf[_0x6a37('0x4b')]);_0x43ea16[_0x6a37('0x4d')]=_[_0x6a37('0x4e')](_0x43ea16[_0x6a37('0x4a')],_0x43ea16[_0x6a37('0x4b')]);_0x591228[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0x43ea16[_0x6a37('0x4a')],qs['fields'](_0x80c3bf['query'][_0x6a37('0x5a')]));_0x591228['attributes']=_0x591228[_0x6a37('0x4f')][_0x6a37('0x50')]?_0x591228['attributes']:_0x43ea16[_0x6a37('0x4a')];if(!_0x80c3bf[_0x6a37('0x4b')][_0x6a37('0x6a')](_0x6a37('0x70'))){_0x591228['limit']=qs[_0x6a37('0x1f')](_0x80c3bf[_0x6a37('0x4b')][_0x6a37('0x1f')]);_0x591228['offset']=qs['offset'](_0x80c3bf[_0x6a37('0x4b')][_0x6a37('0x1d')]);}_0x591228[_0x6a37('0x6b')]=qs['sort'](_0x80c3bf['query'][_0x6a37('0x51')]);_0x591228[_0x6a37('0x52')]=qs['filters'](_[_0x6a37('0x53')](_0x80c3bf[_0x6a37('0x4b')],_0x43ea16['filters']));_0x591228[_0x6a37('0x52')][_0x6a37('0x64')]=_0x1641dc['id'];if(_0x80c3bf['query']['filter']){_0x591228[_0x6a37('0x52')]=_[_0x6a37('0x55')](_0x591228[_0x6a37('0x52')],{'$or':_[_0x6a37('0x45')](_0x591228[_0x6a37('0x4f')],function(_0x24bd5a){var _0x5015c0={};_0x5015c0[_0x24bd5a]={'$like':'%'+_0x80c3bf['query'][_0x6a37('0x54')]+'%'};return _0x5015c0;})});}_0x591228=_[_0x6a37('0x55')]({},_0x591228,_0x80c3bf[_0x6a37('0x56')]);return db['MailInteraction']['count']({'where':_0x591228[_0x6a37('0x52')]})[_0x6a37('0x10')](function(_0x185ae9){_0x4b338a[_0x6a37('0x20')]=_0x185ae9;if(_0x80c3bf[_0x6a37('0x4b')][_0x6a37('0x5b')]){_0x591228[_0x6a37('0x5c')]=[{'model':db['CmContact'],'as':_0x6a37('0x87'),'required':![]},{'model':db[_0x6a37('0x88')],'as':_0x6a37('0x89'),'attributes':[_0x6a37('0x29'),_0x6a37('0x8a'),_0x6a37('0x8b')],'required':![]},{'model':db[_0x6a37('0x8c')],'as':_0x6a37('0x8d'),'attributes':['id',_0x6a37('0x29'),'color'],'where':_0x80c3bf['query'][_0x6a37('0x8e')]?{'id':_0x80c3bf[_0x6a37('0x4b')][_0x6a37('0x8e')]}:undefined,'required':_0x80c3bf[_0x6a37('0x4b')]['tag']?!![]:![]}];}return db['MailInteraction'][_0x6a37('0x57')](_0x591228);})[_0x6a37('0x10')](function(_0x825c18){_0x4b338a[_0x6a37('0x58')]=_0x825c18;return _0x4b338a;});}})[_0x6a37('0x10')](respondWithFilteredResult(_0x5c3af1,_0x591228))['catch'](handleError(_0x5c3af1,null));};exports['addApplications']=function addApplications(_0x1de802,_0x45952d){var _0x5b9c8e=_0x1de802['params']['id'];var _0x17c18a=_0x1de802[_0x6a37('0x5e')];var _0x249bca=0xc8;var _0x144af3=null;return db['sequelize'][_0x6a37('0x8f')]({'isolationLevel':db[_0x6a37('0x90')][_0x6a37('0x91')][_0x6a37('0x92')]['READ_COMMITTED']},function(_0x1a25ce){return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x5b9c8e},'transaction':_0x1a25ce})[_0x6a37('0x10')](function(_0x1b194a){if(_0x1b194a){return db[_0x6a37('0x93')]['destroy']({'where':{'MailAccountId':_0x5b9c8e},'transaction':_0x1a25ce})[_0x6a37('0x10')](function(){var _0x1ae1d4=_[_0x6a37('0x45')](_0x17c18a,function(_0x4d03e8){_0x4d03e8['MailAccountId']=_0x5b9c8e;return _0x4d03e8;});return db[_0x6a37('0x93')][_0x6a37('0x94')](_0x1ae1d4,{'transaction':_0x1a25ce});});}else{_0x249bca=0x194;_0x144af3=[];}});})[_0x6a37('0x10')](function(){if(_0x249bca!==0x194){return db[_0x6a37('0x93')]['findAndCountAll']({'where':{'MailAccountId':_0x5b9c8e},'order':_0x6a37('0x95')})['then'](function(_0x290c15){_0x144af3=_0x290c15;});}})[_0x6a37('0x19')](function(_0x126d27){_0x249bca=0x1f4;logger[_0x6a37('0x16')](_0x126d27[_0x6a37('0x28')]);if(_0x126d27[_0x6a37('0x29')]){delete _0x126d27[_0x6a37('0x29')];}_0x144af3=_0x126d27;})['finally'](function(){if(_0x144af3===null){_0x45952d[_0x6a37('0x27')](_0x249bca);}else{if(_0x249bca===0x1f4){_0x45952d['status'](_0x249bca)[_0x6a37('0x2a')](_0x144af3);}else{_0x45952d['status'](_0x249bca)[_0x6a37('0x1c')](_0x144af3);}}});};exports['getApplications']=function(_0x310ee9,_0x54011e){var _0x3b5d10={};var _0x2d84f1={};var _0x34f87f;var _0x4cf0b8;return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0x310ee9[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x54011e,null))['then'](function(_0x4e5055){if(_0x4e5055){_0x34f87f=_0x4e5055;_0x2d84f1[_0x6a37('0x4a')]=_[_0x6a37('0x4c')](db[_0x6a37('0x93')][_0x6a37('0x69')]);_0x2d84f1[_0x6a37('0x4b')]=_[_0x6a37('0x4c')](_0x310ee9[_0x6a37('0x4b')]);_0x2d84f1['filters']=_[_0x6a37('0x4e')](_0x2d84f1[_0x6a37('0x4a')],_0x2d84f1[_0x6a37('0x4b')]);_0x3b5d10['attributes']=_[_0x6a37('0x4e')](_0x2d84f1[_0x6a37('0x4a')],qs['fields'](_0x310ee9[_0x6a37('0x4b')][_0x6a37('0x5a')]));_0x3b5d10[_0x6a37('0x4f')]=_0x3b5d10[_0x6a37('0x4f')]['length']?_0x3b5d10[_0x6a37('0x4f')]:_0x2d84f1[_0x6a37('0x4a')];_0x3b5d10[_0x6a37('0x6b')]=qs[_0x6a37('0x51')](_0x310ee9[_0x6a37('0x4b')]['sort']);_0x3b5d10[_0x6a37('0x52')]=qs[_0x6a37('0x4d')](_[_0x6a37('0x53')](_0x310ee9[_0x6a37('0x4b')],_0x2d84f1[_0x6a37('0x4d')]));if(_0x310ee9[_0x6a37('0x4b')][_0x6a37('0x54')]){_0x3b5d10[_0x6a37('0x52')]=_['merge'](_0x3b5d10['where'],{'$or':_[_0x6a37('0x45')](_0x3b5d10[_0x6a37('0x4f')],function(_0xd3e928){var _0x525185={};_0x525185[_0xd3e928]={'$like':'%'+_0x310ee9[_0x6a37('0x4b')][_0x6a37('0x54')]+'%'};return _0x525185;})});}_0x3b5d10=_[_0x6a37('0x55')]({},_0x3b5d10,_0x310ee9['options']);return _0x34f87f[_0x6a37('0x96')](_0x3b5d10);}})[_0x6a37('0x10')](function(_0x170e1c){if(_0x170e1c){_0x4cf0b8=_0x170e1c['length'];if(!_0x310ee9[_0x6a37('0x4b')][_0x6a37('0x6a')](_0x6a37('0x70'))){_0x3b5d10[_0x6a37('0x1f')]=qs[_0x6a37('0x1f')](_0x310ee9['query'][_0x6a37('0x1f')]);_0x3b5d10[_0x6a37('0x1d')]=qs['offset'](_0x310ee9[_0x6a37('0x4b')][_0x6a37('0x1d')]);}return _0x34f87f[_0x6a37('0x96')](_0x3b5d10);}})['then'](function(_0x441e55){if(_0x441e55){return _0x441e55?{'count':_0x4cf0b8,'rows':_0x441e55}:null;}})[_0x6a37('0x10')](respondWithResult(_0x54011e,null))[_0x6a37('0x19')](handleError(_0x54011e,null));};exports['getMessages']=function(_0xef6e58,_0x29ddd7){var _0x1de79e={'raw':!![],'where':{}};var _0x4caa31={};var _0x4d4473={'count':0x0,'rows':[]};return db[_0x6a37('0x46')][_0x6a37('0x68')]({'where':{'id':_0xef6e58[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x29ddd7,null))[_0x6a37('0x10')](function(_0x2bed08){if(_0x2bed08){_0x4caa31['model']=_[_0x6a37('0x4c')](db[_0x6a37('0x97')][_0x6a37('0x69')]);_0x4caa31[_0x6a37('0x4b')]=_[_0x6a37('0x4c')](_0xef6e58[_0x6a37('0x4b')]);_0x4caa31[_0x6a37('0x4d')]=_[_0x6a37('0x4e')](_0x4caa31[_0x6a37('0x4a')],_0x4caa31['query']);_0x1de79e[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0x4caa31[_0x6a37('0x4a')],qs['fields'](_0xef6e58[_0x6a37('0x4b')][_0x6a37('0x5a')]));_0x1de79e[_0x6a37('0x4f')]=_0x1de79e['attributes']['length']?_0x1de79e[_0x6a37('0x4f')]:_0x4caa31[_0x6a37('0x4a')];if(!_0xef6e58[_0x6a37('0x4b')][_0x6a37('0x6a')](_0x6a37('0x70'))){_0x1de79e[_0x6a37('0x1f')]=qs[_0x6a37('0x1f')](_0xef6e58['query']['limit']);_0x1de79e[_0x6a37('0x1d')]=qs['offset'](_0xef6e58['query']['offset']);}_0x1de79e[_0x6a37('0x6b')]=qs[_0x6a37('0x51')](_0xef6e58[_0x6a37('0x4b')][_0x6a37('0x51')]);_0x1de79e[_0x6a37('0x52')]=qs[_0x6a37('0x4d')](_[_0x6a37('0x53')](_0xef6e58[_0x6a37('0x4b')],_0x4caa31[_0x6a37('0x4d')]));_0x1de79e[_0x6a37('0x52')][_0x6a37('0x64')]=_0x2bed08['id'];if(_0xef6e58['query'][_0x6a37('0x54')]){_0x1de79e[_0x6a37('0x52')]=_[_0x6a37('0x55')](_0x1de79e[_0x6a37('0x52')],{'$or':_[_0x6a37('0x45')](_0x1de79e[_0x6a37('0x4f')],function(_0x36c3ba){var _0x167958={};_0x167958[_0x36c3ba]={'$like':'%'+_0xef6e58['query'][_0x6a37('0x54')]+'%'};return _0x167958;})});}if(_0xef6e58[_0x6a37('0x4b')]['$gte']){var _0x1b9b19=_0xef6e58['query'][_0x6a37('0x98')][_0x6a37('0x99')](',');var _0x57f4f0={};_0x57f4f0[_0x1b9b19[0x0]]={'$gte':moment(_0x1b9b19[0x1])['format'](_0x6a37('0x9a'))};_0x1de79e[_0x6a37('0x52')]=_['merge'](_0x1de79e['where'],_0x57f4f0);}_0x1de79e=_[_0x6a37('0x55')]({},_0x1de79e,_0xef6e58['options']);return db[_0x6a37('0x97')][_0x6a37('0x20')]({'where':_0x1de79e[_0x6a37('0x52')]})[_0x6a37('0x10')](function(_0x58d31a){_0x4d4473['count']=_0x58d31a;if(_0xef6e58[_0x6a37('0x4b')][_0x6a37('0x5b')]){_0x1de79e['include']=[{'all':!![]}];}return db[_0x6a37('0x97')]['findAll'](_0x1de79e);})[_0x6a37('0x10')](function(_0x339a66){if(_0xef6e58[_0x6a37('0x4b')][_0x6a37('0x9b')]===_0x6a37('0x9c')){for(var _0x30333c=0x0;_0x30333c<_0x339a66[_0x6a37('0x50')];_0x30333c++){_0x339a66[_0x30333c][_0x6a37('0x5e')]=juice(_0x339a66[_0x30333c][_0x6a37('0x5e')]);}}_0x4d4473[_0x6a37('0x58')]=_0x339a66;return _0x4d4473;});}})['then'](respondWithFilteredResult(_0x29ddd7,_0x1de79e))[_0x6a37('0x19')](handleError(_0x29ddd7,null));};exports[_0x6a37('0x2a')]=function(_0x214b04,_0x196ddf){var _0x5dd41a,_0x1f5d2f={},_0x34ca6c;if(_0x214b04['body']['to']){_0x34ca6c=_0x214b04['body']['to'][_0x6a37('0x99')](',')[0x0];}return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x214b04[_0x6a37('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x6a37('0x9d'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x34ca6c},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0x6a37('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6a37('0x9e'),'raw':!![]}]}]})[_0x6a37('0x10')](handleEntityNotFound(_0x196ddf,null))[_0x6a37('0x10')](function(_0x5298d3){if(!_0x5298d3)return;_0x5dd41a=_0x5298d3;if(!_0x5298d3[_0x6a37('0x40')])throw new Error(_0x6a37('0x9f'));if(_[_0x6a37('0x74')](_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa0')])){_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa0')]=util[_0x6a37('0xa1')]('%s\x20<%s>',_0x5298d3['name'],_0x5298d3[_0x6a37('0x72')]||_0x5298d3[_0x6a37('0x40')][_0x6a37('0x34')]);}if(_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa2')]&&_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa2')][_0x6a37('0x50')]){for(var _0x4a4fbd=0x0;_0x4a4fbd<_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa2')][_0x6a37('0x50')];_0x4a4fbd+=0x1){_0x214b04['body']['attachments'][_0x4a4fbd]={'filename':_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa2')][_0x4a4fbd][_0x6a37('0x29')],'path':path[_0x6a37('0xa3')](config[_0x6a37('0xa4')],_0x6a37('0xa5'),_0x214b04[_0x6a37('0x5e')]['attachments'][_0x4a4fbd][_0x6a37('0xa6')])};}}var _0x10b45b=_0x5298d3[_0x6a37('0xa7')]();return respondWithRpcPromise(_0x6a37('0xa8'),_0x6a37('0xa9'),{'account':_0x10b45b,'message':_0x214b04['body']});})[_0x6a37('0x10')](function(_0x18d323){if(!_0x18d323)return;_0x1f5d2f=_0x18d323;if(!_0x5dd41a[_0x6a37('0x9d')])throw new Error(_0x6a37('0xaa'));if(_0x5dd41a[_0x6a37('0x9d')][_0x6a37('0xab')]['length'])return _0x5dd41a['List'][_0x6a37('0xab')][0x0];return db['CmContact']['create'](_['defaults'](_0x214b04[_0x6a37('0x5e')],{'firstName':_0x214b04[_0x6a37('0x5e')]['to'],'email':_0x214b04[_0x6a37('0x5e')]['to'],'phone':_0x214b04[_0x6a37('0x5e')]['to'],'ListId':_0x5dd41a[_0x6a37('0x73')]}));})[_0x6a37('0x10')](function(_0x494bfa){if(!_0x494bfa)return;var _0x44a102={'UserId':_0x214b04[_0x6a37('0x34')]['id'],'ContactId':_0x494bfa['id'],'MailAccountId':_0x5dd41a['id'],'inReplyTo':_0x1f5d2f['messageId'],'to':_0x214b04[_0x6a37('0x5e')][_0x6a37('0xa0')],'cc':_0x214b04[_0x6a37('0x5e')]['cc'],'subject':_0x214b04[_0x6a37('0x5e')]['subject'],'attach':_0x214b04[_0x6a37('0x5e')][_0x6a37('0xac')],'firstMsgDirection':_0x6a37('0xad'),'lastMsgAt':moment()[_0x6a37('0xa1')](_0x6a37('0x9a')),'lastMsgDirection':_0x6a37('0xad'),'Messages':[_[_0x6a37('0x55')](_0x214b04[_0x6a37('0x5e')],{'messageId':_0x1f5d2f['messageId'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x5dd41a['id'],'UserId':_0x214b04['user']['id'],'ContactId':_0x494bfa['id']})]};if(_0x214b04[_0x6a37('0x5e')]['Interaction']){_0x44a102=_[_0x6a37('0x55')](_0x44a102,_0x214b04[_0x6a37('0x5e')][_0x6a37('0xae')]);}return db[_0x6a37('0x84')][_0x6a37('0x66')](_0x44a102,{'include':[{'model':db[_0x6a37('0x97')],'as':_0x6a37('0xaf')}]});})[_0x6a37('0x10')](respondWithResult(_0x196ddf,null))[_0x6a37('0x19')](handleError(_0x196ddf,null));};exports['verifySmtp']=function(_0x39fc07,_0x2c3755){return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x39fc07['params']['id']},'include':[{'model':db[_0x6a37('0x42')],'as':_0x6a37('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6a37('0x9e'),'raw':!![]}]}]})[_0x6a37('0x10')](handleEntityNotFound(_0x2c3755,null))[_0x6a37('0x10')](function(_0x56d2d5){if(!_0x56d2d5[_0x6a37('0x40')])return;var _0x1bd1da=_0x56d2d5[_0x6a37('0xa7')]();return respondWithRpcPromise(_0x6a37('0xb0'),_0x6a37('0xb1'),{'account':_0x1bd1da});})['then'](respondWithResult(_0x2c3755,null))[_0x6a37('0x19')](handleError(_0x2c3755,null));};exports[_0x6a37('0x26')]=function(_0x16dc18,_0x3d2160){return db['MailAccount'][_0x6a37('0x5d')]({'where':{'id':_0x16dc18['params']['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x3d2160,null))[_0x6a37('0x10')](function(_0x430393){if(_0x430393&&_0x430393[_0x6a37('0x3d')]){throw new db[(_0x6a37('0xb2'))][(_0x6a37('0xb3'))](_0x6a37('0xb4'));}return _0x430393;})[_0x6a37('0x10')](removeEntity(_0x3d2160,null))['catch'](handleError(_0x3d2160,null));};exports[_0x6a37('0xb5')]=function(_0x22dba4,_0x2c928e){return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x22dba4['params']['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x2c928e,null))[_0x6a37('0x10')](function(_0x53f7ad){if(_0x53f7ad){return _0x53f7ad[_0x6a37('0xb5')](_0x22dba4['body']['ids'],_[_0x6a37('0x85')](_0x22dba4['body'],[_0x6a37('0x6d'),'id'])||{})[_0x6a37('0xb6')](function(_0x79a81b){for(var _0x5d648c=0x0;_0x5d648c<_0x22dba4[_0x6a37('0x5e')][_0x6a37('0x6d')][_0x6a37('0x50')];_0x5d648c+=0x1){socket[_0x6a37('0xb7')](_0x6a37('0xb8'),{'UserId':Number(_0x22dba4[_0x6a37('0x5e')]['ids'][_0x5d648c]),'MailAccountId':Number(_0x22dba4['params']['id'])});}return _0x79a81b;});}})[_0x6a37('0x10')](respondWithResult(_0x2c928e,null))[_0x6a37('0x19')](handleError(_0x2c928e,null));};exports[_0x6a37('0xb9')]=function(_0x1eff32,_0x1f92a8){return db[_0x6a37('0x46')][_0x6a37('0x5d')]({'where':{'id':_0x1eff32[_0x6a37('0x61')]['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x1f92a8,null))[_0x6a37('0x10')](function(_0x44c5d8){if(_0x44c5d8){return _0x44c5d8[_0x6a37('0xb9')](_0x1eff32[_0x6a37('0x4b')]['ids'])['then'](function(){if(_[_0x6a37('0xba')](_0x1eff32['query'][_0x6a37('0x6d')])){for(var _0xe57347=0x0;_0xe57347<_0x1eff32['query'][_0x6a37('0x6d')]['length'];_0xe57347+=0x1){socket['emit'](_0x6a37('0xbb'),{'UserId':Number(_0x1eff32[_0x6a37('0x4b')]['ids'][_0xe57347]),'MailAccountId':Number(_0x1eff32[_0x6a37('0x61')]['id'])});}}else{socket[_0x6a37('0xb7')](_0x6a37('0xbb'),{'UserId':Number(_0x1eff32[_0x6a37('0x4b')]['ids']),'MailAccountId':Number(_0x1eff32[_0x6a37('0x61')]['id'])});}});}})[_0x6a37('0x10')](respondWithStatusCode(_0x1f92a8,null))[_0x6a37('0x19')](handleError(_0x1f92a8,null));};exports[_0x6a37('0xbc')]=function(_0x2b8852,_0x2e644f){var _0x298a59={};var _0x11b6f6={};var _0x3c5876;var _0x3cf4f8;return db['MailAccount'][_0x6a37('0x68')]({'where':{'id':_0x2b8852['params']['id']}})[_0x6a37('0x10')](handleEntityNotFound(_0x2e644f,null))['then'](function(_0x595ab2){if(_0x595ab2){_0x3c5876=_0x595ab2;_0x11b6f6[_0x6a37('0x4a')]=_[_0x6a37('0x4c')](db[_0x6a37('0x88')][_0x6a37('0x69')]);_0x11b6f6['query']=_[_0x6a37('0x4c')](_0x2b8852[_0x6a37('0x4b')]);_0x11b6f6[_0x6a37('0x4d')]=_[_0x6a37('0x4e')](_0x11b6f6[_0x6a37('0x4a')],_0x11b6f6['query']);_0x298a59[_0x6a37('0x4f')]=_[_0x6a37('0x4e')](_0x11b6f6[_0x6a37('0x4a')],qs[_0x6a37('0x5a')](_0x2b8852['query'][_0x6a37('0x5a')]));_0x298a59[_0x6a37('0x4f')]=_0x298a59['attributes'][_0x6a37('0x50')]?_0x298a59[_0x6a37('0x4f')]:_0x11b6f6['model'];_0x298a59['order']=qs[_0x6a37('0x51')](_0x2b8852[_0x6a37('0x4b')][_0x6a37('0x51')]);_0x298a59[_0x6a37('0x52')]=qs[_0x6a37('0x4d')](_[_0x6a37('0x53')](_0x2b8852['query'],_0x11b6f6[_0x6a37('0x4d')]));if(_0x2b8852[_0x6a37('0x4b')][_0x6a37('0x54')]){_0x298a59[_0x6a37('0x52')]=_[_0x6a37('0x55')](_0x298a59[_0x6a37('0x52')],{'$or':_[_0x6a37('0x45')](_0x298a59[_0x6a37('0x4f')],function(_0x29c566){var _0x146483={};_0x146483[_0x29c566]={'$like':'%'+_0x2b8852['query'][_0x6a37('0x54')]+'%'};return _0x146483;})});}_0x298a59=_[_0x6a37('0x55')]({},_0x298a59,_0x2b8852[_0x6a37('0x56')]);return _0x3c5876[_0x6a37('0xbc')](_0x298a59);}})['then'](function(_0x24fed6){if(_0x24fed6){_0x3cf4f8=_0x24fed6[_0x6a37('0x50')];if(!_0x2b8852[_0x6a37('0x4b')]['hasOwnProperty'](_0x6a37('0x70'))){_0x298a59[_0x6a37('0x1f')]=qs[_0x6a37('0x1f')](_0x2b8852[_0x6a37('0x4b')][_0x6a37('0x1f')]);_0x298a59['offset']=qs[_0x6a37('0x1d')](_0x2b8852[_0x6a37('0x4b')]['offset']);}return _0x3c5876['getAgents'](_0x298a59);}})[_0x6a37('0x10')](function(_0x4b6c70){if(_0x4b6c70){return _0x4b6c70?{'count':_0x3cf4f8,'rows':_0x4b6c70}:null;}})[_0x6a37('0x10')](respondWithResult(_0x2e644f,null))[_0x6a37('0x19')](handleError(_0x2e644f,null));}; \ No newline at end of file +var _0x82b4=['isNil','from','format','%s\x20<%s>','attachments','join','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','ListId','messageId','subject','attach','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','verifySmtp','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','getAgents','bluebird','util','path','lodash','juice','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','client','http','request','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','UserProfileResource','stack','name','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','VIRTUAL','includeAll','include','rows','show','params','MailServerIn','options','find','body','provider','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','findAll','removeDispositions','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','ids','custom','email','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','getSmtp','addSmtp','setSmtp','MailInteraction','addInteraction','omit','getInteractions','CmContact','Contact','User','Tag','Tags','color','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getMessages','MailMessage','$gte','inlineCss','true','split','CmList','List','Contacts','updatedAt','DESC','CloudProvider'];(function(_0x439185,_0x4c8100){var _0x469f49=function(_0x3e3728){while(--_0x3e3728){_0x439185['push'](_0x439185['shift']());}};_0x469f49(++_0x4c8100);}(_0x82b4,0xe4));var _0x482b=function(_0x5e9c0e,_0x143e7d){_0x5e9c0e=_0x5e9c0e-0x0;var _0x3b2a0c=_0x82b4[_0x5e9c0e];return _0x3b2a0c;};'use strict';var moment=require('moment');var BPromise=require(_0x482b('0x0'));var util=require(_0x482b('0x1'));var path=require(_0x482b('0x2'));var _=require(_0x482b('0x3'));var juice=require(_0x482b('0x4'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x482b('0x5'))(_0x482b('0x6'));var config=require('../../config/environment');var db=require(_0x482b('0x7'))['db'];config[_0x482b('0x8')]=_['defaults'](config[_0x482b('0x8')],{'host':_0x482b('0x9'),'port':0x18eb});var socket=require(_0x482b('0xa'))(new Redis(config[_0x482b('0x8')]));require(_0x482b('0xb'))['register'](socket);var jayson=require(_0x482b('0xc'));var client=jayson[_0x482b('0xd')][_0x482b('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x1ca69e,_0x403b3f,_0x574f41,_0x1594e7){return new BPromise(function(_0xa54ded,_0x175fff){var _0x1a1450=_0x1594e7||client;return _0x1a1450[_0x482b('0xf')](_0x1ca69e,_0x574f41)['then'](function(_0x461159){logger[_0x482b('0x10')]('MailAccount,\x20%s,\x20%s',_0x403b3f,_0x482b('0x11'));logger[_0x482b('0x12')](_0x482b('0x13'),_0x403b3f,_0x482b('0x11'),JSON['stringify'](_0x461159));if(_0x461159[_0x482b('0x14')]){if(_0x461159['error'][_0x482b('0x15')]===0x1f4){logger[_0x482b('0x14')](_0x482b('0x16'),_0x403b3f,_0x461159[_0x482b('0x14')]['message']);return _0x175fff(_0x461159[_0x482b('0x14')][_0x482b('0x17')]);}logger[_0x482b('0x14')]('MailAccount,\x20%s,\x20%s',_0x403b3f,_0x461159[_0x482b('0x14')][_0x482b('0x17')]);return _0xa54ded(_0x461159['error'][_0x482b('0x17')]);}else{logger['info'](_0x482b('0x16'),_0x403b3f,'request\x20sent');_0xa54ded(_0x461159[_0x482b('0x18')][_0x482b('0x17')]);}})[_0x482b('0x19')](function(_0x13ab3f){logger[_0x482b('0x14')](_0x482b('0x16'),_0x403b3f,_0x13ab3f);_0x175fff(_0x13ab3f);});});}function respondWithStatusCode(_0x1dbbfa,_0x5e0db8){_0x5e0db8=_0x5e0db8||0xcc;return function(_0x17c023){if(_0x17c023){return _0x1dbbfa[_0x482b('0x1a')](_0x5e0db8);}return _0x1dbbfa[_0x482b('0x1b')](_0x5e0db8)[_0x482b('0x1c')]();};}function respondWithResult(_0x10f9eb,_0x5dfa34){_0x5dfa34=_0x5dfa34||0xc8;return function(_0x2045b9){if(_0x2045b9){return _0x10f9eb[_0x482b('0x1b')](_0x5dfa34)[_0x482b('0x1d')](_0x2045b9);}};}function respondWithFilteredResult(_0x3a4e36,_0x4c19a0){return function(_0x5c02cd){if(_0x5c02cd){var _0x5c3df9=typeof _0x4c19a0[_0x482b('0x1e')]===_0x482b('0x1f')&&typeof _0x4c19a0[_0x482b('0x20')]===_0x482b('0x1f');var _0x17bd26=_0x5c02cd[_0x482b('0x21')];var _0x5e26bf=_0x5c3df9?0x0:_0x4c19a0[_0x482b('0x1e')];var _0x460d95=_0x5c3df9?_0x5c02cd[_0x482b('0x21')]:_0x4c19a0['offset']+_0x4c19a0[_0x482b('0x20')];var _0x40fc39;if(_0x460d95>=_0x17bd26){_0x460d95=_0x17bd26;_0x40fc39=0xc8;}else{_0x40fc39=0xce;}_0x3a4e36['status'](_0x40fc39);return _0x3a4e36[_0x482b('0x22')](_0x482b('0x23'),_0x5e26bf+'-'+_0x460d95+'/'+_0x17bd26)[_0x482b('0x1d')](_0x5c02cd);}return null;};}function saveUpdates(_0x5bee5b){return function(_0x2ca81d){if(_0x2ca81d){return _0x2ca81d[_0x482b('0x24')](_0x5bee5b)[_0x482b('0x25')](function(_0x5e4387){return _0x5e4387;});}return null;};}function removeEntity(_0x3257f3){return function(_0x3d13c3){if(_0x3d13c3){return _0x3d13c3[_0x482b('0x26')]()['then'](function(){var _0x514436=_0x3d13c3['get']({'plain':!![]});var _0x4101c0='MailAccounts';return db[_0x482b('0x27')][_0x482b('0x26')]({'where':{'type':_0x4101c0,'resourceId':_0x514436['id']}})[_0x482b('0x25')](function(){return _0x3d13c3;});})['then'](function(){_0x3257f3[_0x482b('0x1b')](0xcc)[_0x482b('0x1c')]();});}};}function handleEntityNotFound(_0x8daba8){return function(_0xf3a51f){if(!_0xf3a51f){_0x8daba8[_0x482b('0x1a')](0x194);}return _0xf3a51f;};}function handleError(_0x4d5494,_0x47bf54){_0x47bf54=_0x47bf54||0x1f4;return function(_0x2024dd){logger[_0x482b('0x14')](_0x2024dd[_0x482b('0x28')]);if(_0x2024dd[_0x482b('0x29')]){delete _0x2024dd[_0x482b('0x29')];}_0x4d5494[_0x482b('0x1b')](_0x47bf54)['send'](_0x2024dd);};}function getImapHost(_0xe8820f){switch(_0xe8820f){case _0x482b('0x2a'):return'imap.gmail.com';case _0x482b('0x2b'):return _0x482b('0x2c');case _0x482b('0x2d'):return'imap-mail.outlook.com';case'outlook365':return _0x482b('0x2e');}throw new Error(_0x482b('0x2f'),_0xe8820f);}function getSmtpHost(_0x1e8e4a){switch(_0x1e8e4a){case _0x482b('0x2a'):return _0x482b('0x30');case _0x482b('0x2b'):return _0x482b('0x31');case _0x482b('0x2d'):return _0x482b('0x32');case _0x482b('0x33'):return _0x482b('0x34');}throw new Error(_0x482b('0x2f'),_0x1e8e4a);}function getAuthenticationOptions(_0x1165aa,_0x49197e){var _0x765b54={};var _0x47e24e={};if(_0x1165aa){_0x765b54['user']=_0x47e24e[_0x482b('0x35')]=_0x49197e[_0x482b('0x36')];_0x765b54[_0x482b('0x37')]=_0x47e24e[_0x482b('0x38')]=_0x49197e[_0x482b('0x37')];if(_0x49197e[_0x482b('0x39')]){_0x765b54['modernAuthentication']=_0x47e24e[_0x482b('0x39')]=!![];_0x765b54[_0x482b('0x3a')]=_0x47e24e['CloudProviderId']=_0x49197e['CloudProviderId'];_0x765b54['password']=_0x47e24e['pass']=null;}else{_0x765b54['CloudProviderId']=_0x47e24e['CloudProviderId']=null;}_0x765b54['host']=getImapHost(_0x1165aa);_0x765b54['port']=0x3e1;_0x47e24e[_0x482b('0x3b')]=getSmtpHost(_0x1165aa);_0x47e24e[_0x482b('0x3c')]=0x24b;_0x47e24e[_0x482b('0x3d')]=![];_0x765b54[_0x482b('0x3e')]=_0x47e24e[_0x482b('0x3e')]=null;}else{if(_0x49197e[_0x482b('0x3f')]){_0x765b54['user']=_0x47e24e[_0x482b('0x35')]=_0x49197e['username'];_0x765b54[_0x482b('0x37')]=_0x47e24e[_0x482b('0x38')]=_0x49197e[_0x482b('0x37')];}else{_0x765b54[_0x482b('0x3f')]=_0x47e24e['authentication']=![];_0x765b54['user']=_0x47e24e[_0x482b('0x35')]=null;_0x765b54['password']=_0x47e24e[_0x482b('0x38')]=null;}_0x765b54[_0x482b('0x3b')]=_0x49197e[_0x482b('0x40')][_0x482b('0x3b')];_0x765b54[_0x482b('0x3c')]=_0x49197e[_0x482b('0x40')][_0x482b('0x3c')];_0x47e24e[_0x482b('0x3b')]=_0x49197e['Smtp']['host'];_0x47e24e[_0x482b('0x3c')]=_0x49197e[_0x482b('0x41')][_0x482b('0x3c')];}return{'Imap':_0x765b54,'Smtp':_0x47e24e};}exports[_0x482b('0x42')]=function(_0x321595,_0x3a0095){var _0x4a9fcf={'include':[{'model':db['MailServerIn'],'as':_0x482b('0x40')},{'model':db[_0x482b('0x43')],'as':'Smtp'},{'model':db[_0x482b('0x44')],'as':_0x482b('0x45')}]},_0x516944={},_0x2f81ce={'count':0x0,'rows':[]};var _0x37e715=_[_0x482b('0x46')](db[_0x482b('0x47')][_0x482b('0x48')],function(_0x42e9d0){return{'name':_0x42e9d0[_0x482b('0x49')],'type':_0x42e9d0['type'][_0x482b('0x4a')]};});_0x516944[_0x482b('0x4b')]=_[_0x482b('0x46')](_0x37e715,_0x482b('0x29'));_0x516944[_0x482b('0x4c')]=_[_0x482b('0x4d')](_0x321595[_0x482b('0x4c')]);_0x516944['filters']=_[_0x482b('0x4e')](_0x516944[_0x482b('0x4b')],_0x516944['query']);_0x4a9fcf[_0x482b('0x4f')]=_['intersection'](_0x516944['model'],qs[_0x482b('0x50')](_0x321595[_0x482b('0x4c')][_0x482b('0x50')]));_0x4a9fcf['attributes']=_0x4a9fcf['attributes'][_0x482b('0x51')]?_0x4a9fcf[_0x482b('0x4f')]:_0x516944[_0x482b('0x4b')];if(!_0x321595[_0x482b('0x4c')][_0x482b('0x52')](_0x482b('0x53'))){_0x4a9fcf[_0x482b('0x20')]=qs[_0x482b('0x20')](_0x321595['query']['limit']);_0x4a9fcf[_0x482b('0x1e')]=qs[_0x482b('0x1e')](_0x321595[_0x482b('0x4c')]['offset']);}_0x4a9fcf[_0x482b('0x54')]=qs[_0x482b('0x55')](_0x321595[_0x482b('0x4c')]['sort']);_0x4a9fcf[_0x482b('0x56')]=qs['filters'](_[_0x482b('0x57')](_0x321595['query'],_0x516944[_0x482b('0x58')]),_0x37e715);if(_0x321595[_0x482b('0x4c')][_0x482b('0x59')]){_0x4a9fcf[_0x482b('0x56')]=_[_0x482b('0x5a')](_0x4a9fcf[_0x482b('0x56')],{'$or':_[_0x482b('0x46')](_0x37e715,function(_0x3013a9){if(_0x3013a9[_0x482b('0x5b')]!==_0x482b('0x5c')){var _0x16d579={};_0x16d579[_0x3013a9[_0x482b('0x29')]]={'$like':'%'+_0x321595['query'][_0x482b('0x59')]+'%'};return _0x16d579;}})});}_0x4a9fcf=_[_0x482b('0x5a')]({},_0x4a9fcf,_0x321595['options']);var _0x1aed9f={'where':_0x4a9fcf[_0x482b('0x56')]};return db[_0x482b('0x47')]['count'](_0x1aed9f)[_0x482b('0x25')](function(_0x51692d){_0x2f81ce[_0x482b('0x21')]=_0x51692d;if(_0x321595['query'][_0x482b('0x5d')]){_0x4a9fcf[_0x482b('0x5e')]=[{'all':!![]}];}return db[_0x482b('0x47')]['findAll'](_0x4a9fcf);})['then'](function(_0x2af33a){_0x2f81ce[_0x482b('0x5f')]=_0x2af33a;return _0x2f81ce;})[_0x482b('0x25')](respondWithFilteredResult(_0x3a0095,_0x4a9fcf))[_0x482b('0x19')](handleError(_0x3a0095,null));};exports[_0x482b('0x60')]=function(_0x7ab90a,_0x1c2e18){var _0x5032e4={'raw':![],'where':{'id':_0x7ab90a[_0x482b('0x61')]['id']},'include':[{'model':db[_0x482b('0x62')],'as':_0x482b('0x40')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0x482b('0x44')],'as':_0x482b('0x45')}]},_0x543711={};_0x543711['model']=_['keys'](db[_0x482b('0x47')][_0x482b('0x48')]);_0x543711['query']=_['keys'](_0x7ab90a[_0x482b('0x4c')]);_0x543711[_0x482b('0x58')]=_['intersection'](_0x543711[_0x482b('0x4b')],_0x543711['query']);_0x5032e4['attributes']=_['intersection'](_0x543711[_0x482b('0x4b')],qs['fields'](_0x7ab90a[_0x482b('0x4c')][_0x482b('0x50')]));_0x5032e4[_0x482b('0x4f')]=_0x5032e4[_0x482b('0x4f')][_0x482b('0x51')]?_0x5032e4[_0x482b('0x4f')]:_0x543711['model'];if(_0x7ab90a['query']['includeAll']){_0x5032e4[_0x482b('0x5e')]=[{'all':!![]}];}_0x5032e4=_['merge']({},_0x5032e4,_0x7ab90a[_0x482b('0x63')]);return db[_0x482b('0x47')][_0x482b('0x64')](_0x5032e4)[_0x482b('0x25')](handleEntityNotFound(_0x1c2e18,null))[_0x482b('0x25')](respondWithResult(_0x1c2e18,null))[_0x482b('0x19')](handleError(_0x1c2e18,null));};exports[_0x482b('0x24')]=function(_0xc3c7db,_0x52fc6d){if(_0xc3c7db[_0x482b('0x65')]['id']){delete _0xc3c7db[_0x482b('0x65')]['id'];}var _0x59eee3=_0xc3c7db[_0x482b('0x65')]['provider']==='custom'?null:_0xc3c7db[_0x482b('0x65')][_0x482b('0x66')];var _0x18812f=_0xc3c7db[_0x482b('0x65')][_0x482b('0x40')]||{};var _0x4b3350=_0xc3c7db[_0x482b('0x65')]['Smtp']||{};if(_0x59eee3){_0x18812f[_0x482b('0x3b')]=getImapHost(_0x59eee3);_0x18812f[_0x482b('0x3c')]=0x3e1;_0x4b3350['host']=getSmtpHost(_0x59eee3);_0x4b3350[_0x482b('0x3c')]=0x24b;_0x4b3350[_0x482b('0x3d')]=![];}if(_0x4b3350[_0x482b('0x39')]){_0x4b3350[_0x482b('0x3d')]=![];}else{_0x4b3350['CloudProviderId']=null;}if(!_0x18812f['modernAuthentication'])_0x18812f[_0x482b('0x3a')]=null;_0xc3c7db[_0x482b('0x65')][_0x482b('0x40')]=_0x18812f;_0xc3c7db[_0x482b('0x65')][_0x482b('0x41')]=_0x4b3350;return db['MailAccount'][_0x482b('0x64')]({'where':{'id':_0xc3c7db[_0x482b('0x61')]['id']},'include':[{'model':db[_0x482b('0x62')],'as':_0x482b('0x40')},{'model':db[_0x482b('0x43')],'as':_0x482b('0x41')},{'model':db[_0x482b('0x44')],'as':_0x482b('0x45')}]})[_0x482b('0x25')](handleEntityNotFound(_0x52fc6d,null))['then'](function(_0x5ded95){if(!_0x5ded95)throw new Error(_0x482b('0x67'));if(_0x5ded95[_0x482b('0x3e')])delete _0xc3c7db['body'][_0x482b('0x40')];return _0x5ded95;})[_0x482b('0x25')](saveUpdates(_0xc3c7db[_0x482b('0x65')],null))[_0x482b('0x25')](function(_0x3b3d36){if(!_0xc3c7db[_0x482b('0x65')][_0x482b('0x40')])return _0x3b3d36;return db['MailServerIn']['update'](_0xc3c7db[_0x482b('0x65')]['Imap'],{'where':{'MailAccountId':_0x3b3d36['id']}})[_0x482b('0x25')](function(){return _0x3b3d36;});})['then'](function(_0x1c03b0){if(!_0xc3c7db[_0x482b('0x65')]['Smtp'])return _0x1c03b0;return db['MailServerOut']['update'](_0xc3c7db[_0x482b('0x65')][_0x482b('0x41')],{'where':{'MailAccountId':_0x1c03b0['id']}})[_0x482b('0x25')](function(){return _0x1c03b0;});})[_0x482b('0x25')](respondWithResult(_0x52fc6d,null))['catch'](handleError(_0x52fc6d,null));};exports[_0x482b('0x68')]=function(_0x1a718e,_0x3de9d6){return db[_0x482b('0x47')]['describe']()[_0x482b('0x25')](respondWithResult(_0x3de9d6,null))[_0x482b('0x19')](handleError(_0x3de9d6,null));};exports[_0x482b('0x69')]=function(_0x5f19f2,_0x152a10){if(_0x5f19f2[_0x482b('0x65')]['id']){delete _0x5f19f2[_0x482b('0x65')]['id'];}return db[_0x482b('0x47')]['find']({'where':{'id':_0x5f19f2[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x152a10,null))[_0x482b('0x25')](function(_0x5ca856){if(_0x5ca856){_0x5f19f2[_0x482b('0x65')][_0x482b('0x6a')]=_0x5ca856['id'];return db['Disposition'][_0x482b('0x6b')](_0x5f19f2[_0x482b('0x65')]);}})['then'](respondWithResult(_0x152a10,null))[_0x482b('0x19')](handleError(_0x152a10,null));};exports[_0x482b('0x6c')]=function(_0x4f1c7b,_0x312c56){var _0x3bb156={'raw':![],'where':{}};var _0xd22083={};var _0x3dde2b={'count':0x0,'rows':[]};return db[_0x482b('0x47')]['findOne']({'where':{'id':_0x4f1c7b['params']['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x312c56,null))[_0x482b('0x25')](function(_0x55992d){if(_0x55992d){_0xd22083[_0x482b('0x4b')]=_[_0x482b('0x4d')](db[_0x482b('0x6d')][_0x482b('0x48')]);_0xd22083[_0x482b('0x4c')]=_['keys'](_0x4f1c7b[_0x482b('0x4c')]);_0xd22083['filters']=_[_0x482b('0x4e')](_0xd22083[_0x482b('0x4b')],_0xd22083[_0x482b('0x4c')]);_0x3bb156['attributes']=_[_0x482b('0x4e')](_0xd22083['model'],qs[_0x482b('0x50')](_0x4f1c7b[_0x482b('0x4c')][_0x482b('0x50')]));_0x3bb156[_0x482b('0x4f')]=_0x3bb156['attributes'][_0x482b('0x51')]?_0x3bb156[_0x482b('0x4f')]:_0xd22083[_0x482b('0x4b')];if(!_0x4f1c7b[_0x482b('0x4c')][_0x482b('0x52')]('nolimit')){_0x3bb156[_0x482b('0x20')]=qs['limit'](_0x4f1c7b[_0x482b('0x4c')][_0x482b('0x20')]);_0x3bb156[_0x482b('0x1e')]=qs['offset'](_0x4f1c7b[_0x482b('0x4c')][_0x482b('0x1e')]);}_0x3bb156[_0x482b('0x54')]=qs[_0x482b('0x55')](_0x4f1c7b[_0x482b('0x4c')]['sort']);_0x3bb156[_0x482b('0x56')]=qs['filters'](_[_0x482b('0x57')](_0x4f1c7b[_0x482b('0x4c')],_0xd22083[_0x482b('0x58')]));_0x3bb156[_0x482b('0x56')][_0x482b('0x6a')]=_0x55992d['id'];if(_0x4f1c7b['query']['filter']){_0x3bb156['where']=_['merge'](_0x3bb156[_0x482b('0x56')],{'$or':_[_0x482b('0x46')](_0x3bb156['attributes'],function(_0x2444db){var _0x1eef1b={};_0x1eef1b[_0x2444db]={'$like':'%'+_0x4f1c7b[_0x482b('0x4c')][_0x482b('0x59')]+'%'};return _0x1eef1b;})});}_0x3bb156=_[_0x482b('0x5a')]({},_0x3bb156,_0x4f1c7b[_0x482b('0x63')]);return db[_0x482b('0x6d')]['count']({'where':_0x3bb156['where']})['then'](function(_0x2fa4b8){_0x3dde2b[_0x482b('0x21')]=_0x2fa4b8;if(_0x4f1c7b[_0x482b('0x4c')][_0x482b('0x5d')]){_0x3bb156[_0x482b('0x5e')]=[{'all':!![]}];}return db[_0x482b('0x6d')][_0x482b('0x6e')](_0x3bb156);})[_0x482b('0x25')](function(_0x53ffbb){_0x3dde2b[_0x482b('0x5f')]=_0x53ffbb;return _0x3dde2b;});}})[_0x482b('0x25')](respondWithFilteredResult(_0x312c56,_0x3bb156))[_0x482b('0x19')](handleError(_0x312c56,null));};exports['removeDispositions']=function(_0x39e6b7,_0x2bfbdd){return db['MailAccount'][_0x482b('0x64')]({'where':{'id':_0x39e6b7[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x2bfbdd,null))['then'](function(_0x59f812){if(_0x59f812){return _0x59f812[_0x482b('0x6f')](_0x39e6b7[_0x482b('0x4c')]['ids']);}})[_0x482b('0x25')](respondWithStatusCode(_0x2bfbdd,null))[_0x482b('0x19')](handleError(_0x2bfbdd,null));};exports[_0x482b('0x70')]=function(_0x197e46,_0x5c1d2e){if(_0x197e46[_0x482b('0x65')]['id']){delete _0x197e46[_0x482b('0x65')]['id'];}return db[_0x482b('0x47')][_0x482b('0x64')]({'where':{'id':_0x197e46[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x5c1d2e,null))[_0x482b('0x25')](function(_0x5484f4){if(_0x5484f4){_0x197e46[_0x482b('0x65')][_0x482b('0x6a')]=_0x5484f4['id'];return db['CannedAnswer'][_0x482b('0x6b')](_0x197e46[_0x482b('0x65')]);}})[_0x482b('0x25')](respondWithResult(_0x5c1d2e,null))[_0x482b('0x19')](handleError(_0x5c1d2e,null));};exports[_0x482b('0x71')]=function(_0x1cd317,_0x1c576b){var _0x4a22e7={'raw':![],'where':{}};var _0x1d2222={};var _0x42758a={'count':0x0,'rows':[]};return db['MailAccount'][_0x482b('0x72')]({'where':{'id':_0x1cd317['params']['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x1c576b,null))[_0x482b('0x25')](function(_0x414dc4){if(_0x414dc4){_0x1d2222['model']=_[_0x482b('0x4d')](db[_0x482b('0x73')][_0x482b('0x48')]);_0x1d2222[_0x482b('0x4c')]=_['keys'](_0x1cd317[_0x482b('0x4c')]);_0x1d2222['filters']=_['intersection'](_0x1d2222['model'],_0x1d2222[_0x482b('0x4c')]);_0x4a22e7[_0x482b('0x4f')]=_['intersection'](_0x1d2222[_0x482b('0x4b')],qs['fields'](_0x1cd317[_0x482b('0x4c')][_0x482b('0x50')]));_0x4a22e7[_0x482b('0x4f')]=_0x4a22e7[_0x482b('0x4f')][_0x482b('0x51')]?_0x4a22e7[_0x482b('0x4f')]:_0x1d2222['model'];if(!_0x1cd317[_0x482b('0x4c')][_0x482b('0x52')](_0x482b('0x53'))){_0x4a22e7[_0x482b('0x20')]=qs['limit'](_0x1cd317['query'][_0x482b('0x20')]);_0x4a22e7[_0x482b('0x1e')]=qs[_0x482b('0x1e')](_0x1cd317[_0x482b('0x4c')]['offset']);}_0x4a22e7[_0x482b('0x54')]=qs['sort'](_0x1cd317['query'][_0x482b('0x55')]);_0x4a22e7[_0x482b('0x56')]=qs[_0x482b('0x58')](_['pick'](_0x1cd317[_0x482b('0x4c')],_0x1d2222[_0x482b('0x58')]));_0x4a22e7[_0x482b('0x56')][_0x482b('0x6a')]=_0x414dc4['id'];if(_0x1cd317[_0x482b('0x4c')]['filter']){_0x4a22e7[_0x482b('0x56')]=_[_0x482b('0x5a')](_0x4a22e7[_0x482b('0x56')],{'$or':_[_0x482b('0x46')](_0x4a22e7['attributes'],function(_0x59d9f1){var _0x25ea6b={};_0x25ea6b[_0x59d9f1]={'$like':'%'+_0x1cd317[_0x482b('0x4c')][_0x482b('0x59')]+'%'};return _0x25ea6b;})});}_0x4a22e7=_['merge']({},_0x4a22e7,_0x1cd317[_0x482b('0x63')]);return db[_0x482b('0x73')][_0x482b('0x21')]({'where':_0x4a22e7[_0x482b('0x56')]})[_0x482b('0x25')](function(_0x21bc86){_0x42758a[_0x482b('0x21')]=_0x21bc86;if(_0x1cd317['query'][_0x482b('0x5d')]){_0x4a22e7[_0x482b('0x5e')]=[{'all':!![]}];}return db['CannedAnswer'][_0x482b('0x6e')](_0x4a22e7);})[_0x482b('0x25')](function(_0x5399dc){_0x42758a['rows']=_0x5399dc;return _0x42758a;});}})[_0x482b('0x25')](respondWithFilteredResult(_0x1c576b,_0x4a22e7))[_0x482b('0x19')](handleError(_0x1c576b,null));};exports[_0x482b('0x74')]=function(_0x555cad,_0x4ff917){return db[_0x482b('0x47')][_0x482b('0x64')]({'where':{'id':_0x555cad[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x4ff917,null))[_0x482b('0x25')](function(_0x595ceb){if(_0x595ceb){return _0x595ceb['removeAnswers'](_0x555cad['query'][_0x482b('0x75')]);}})[_0x482b('0x25')](respondWithStatusCode(_0x4ff917,null))[_0x482b('0x19')](handleError(_0x4ff917,null));};exports['create']=function(_0x588469,_0x3d1a5b){var _0x204539={'name':_0x588469[_0x482b('0x65')]['name'],'key':_0x588469[_0x482b('0x65')]['key'],'provider':_0x588469['body'][_0x482b('0x66')]===_0x482b('0x76')?null:_0x588469[_0x482b('0x65')][_0x482b('0x66')],'email':_0x588469['body'][_0x482b('0x77')],'ListId':_0x588469[_0x482b('0x65')]['ListId'],'active':!_['isNil'](_0x588469[_0x482b('0x65')][_0x482b('0x78')])?_0x588469[_0x482b('0x65')][_0x482b('0x78')]:!![],'description':_0x588469[_0x482b('0x65')][_0x482b('0x79')]||null};var _0x4d1b81=getAuthenticationOptions(_0x204539[_0x482b('0x66')],_0x588469[_0x482b('0x65')]);_0x204539[_0x482b('0x40')]=_0x4d1b81[_0x482b('0x40')];_0x204539[_0x482b('0x41')]=_0x4d1b81[_0x482b('0x41')];return db[_0x482b('0x47')][_0x482b('0x6b')](_0x204539,{'include':[{'model':db[_0x482b('0x43')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x482b('0x25')](function(_0x11cff7){var _0x509d87=_0x588469[_0x482b('0x35')][_0x482b('0x7a')]({'plain':!![]});if(!_0x509d87)throw new Error(_0x482b('0x7b'));if(_0x509d87['role']===_0x482b('0x35')){var _0x47b62f=_0x11cff7[_0x482b('0x7a')]({'plain':!![]});return db[_0x482b('0x7c')]['find']({'where':{'name':_0x482b('0x7d'),'userProfileId':_0x509d87['userProfileId']},'raw':!![]})[_0x482b('0x25')](function(_0x3873d9){if(_0x3873d9&&_0x3873d9['autoAssociation']===0x0){return db[_0x482b('0x27')]['create']({'name':_0x47b62f[_0x482b('0x29')],'resourceId':_0x47b62f['id'],'type':_0x3873d9[_0x482b('0x29')],'sectionId':_0x3873d9['id']},{})[_0x482b('0x25')](function(){return _0x11cff7;});}else{return _0x11cff7;}})[_0x482b('0x19')](function(_0x5940bd){logger[_0x482b('0x14')](_0x482b('0x7e'),_0x5940bd);throw _0x5940bd;});}return _0x11cff7;})[_0x482b('0x25')](respondWithResult(_0x3d1a5b,0xc9))['catch'](handleError(_0x3d1a5b,null));};exports['getImap']=function(_0x33e109,_0x55c59a){return db[_0x482b('0x47')][_0x482b('0x72')]({'where':{'id':_0x33e109[_0x482b('0x61')]['id']}})['then'](handleEntityNotFound(_0x55c59a,null))['then'](function(_0x52499a){if(_0x52499a){return _0x52499a[_0x482b('0x7f')]();}return null;})['then'](respondWithResult(_0x55c59a,null))[_0x482b('0x19')](handleError(_0x55c59a,null));};exports[_0x482b('0x80')]=function(_0x1dacd8,_0x4973a2){if(_0x1dacd8[_0x482b('0x65')]['id']){delete _0x1dacd8[_0x482b('0x65')]['id'];}return db['MailAccount'][_0x482b('0x64')]({'where':{'id':_0x1dacd8[_0x482b('0x61')]['id']}})['then'](handleEntityNotFound(_0x4973a2,null))[_0x482b('0x25')](function(_0x19cfaa){if(_0x19cfaa){_0x1dacd8[_0x482b('0x65')][_0x482b('0x6a')]=_0x19cfaa['id'];return db[_0x482b('0x62')][_0x482b('0x6b')](_0x1dacd8['body']);}})[_0x482b('0x25')](respondWithResult(_0x4973a2,null))[_0x482b('0x19')](handleError(_0x4973a2,null));};exports[_0x482b('0x81')]=function(_0x4cfc7c,_0x32ccfb){return db['MailAccount']['findOne']({'where':{'id':_0x4cfc7c[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x32ccfb,null))[_0x482b('0x25')](function(_0x24e796){if(_0x24e796){return _0x24e796['setImap'](null);}return null;})[_0x482b('0x25')](respondWithStatusCode(_0x32ccfb,null))['catch'](handleError(_0x32ccfb,null));};exports[_0x482b('0x82')]=function(_0x274779,_0x5b9a4d){return db[_0x482b('0x47')][_0x482b('0x72')]({'where':{'id':_0x274779[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x5b9a4d,null))['then'](function(_0x406d3f){if(_0x406d3f){return _0x406d3f[_0x482b('0x82')]();}return null;})['then'](respondWithResult(_0x5b9a4d,null))[_0x482b('0x19')](handleError(_0x5b9a4d,null));};exports[_0x482b('0x83')]=function(_0x37fd04,_0x112c70){if(_0x37fd04[_0x482b('0x65')]['id']){delete _0x37fd04['body']['id'];}return db[_0x482b('0x47')][_0x482b('0x64')]({'where':{'id':_0x37fd04[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x112c70,null))[_0x482b('0x25')](function(_0x480225){if(_0x480225){_0x37fd04[_0x482b('0x65')][_0x482b('0x6a')]=_0x480225['id'];return db[_0x482b('0x43')][_0x482b('0x6b')](_0x37fd04[_0x482b('0x65')]);}})[_0x482b('0x25')](respondWithResult(_0x112c70,null))[_0x482b('0x19')](handleError(_0x112c70,null));};exports['removeSmtp']=function(_0x2b2a60,_0x1bc68a){return db[_0x482b('0x47')][_0x482b('0x72')]({'where':{'id':_0x2b2a60[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x1bc68a,null))[_0x482b('0x25')](function(_0x5aff2d){if(_0x5aff2d){return _0x5aff2d[_0x482b('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x1bc68a,null))[_0x482b('0x19')](handleError(_0x1bc68a,null));};exports['addInteraction']=function(_0x53c6f5,_0x403c80){return db[_0x482b('0x85')][_0x482b('0x64')]({'where':{'id':_0x53c6f5['params']['id']}})['then'](handleEntityNotFound(_0x403c80,null))[_0x482b('0x25')](function(_0x2fa361){if(_0x2fa361){return _0x2fa361[_0x482b('0x86')](_0x53c6f5['body'][_0x482b('0x75')],_[_0x482b('0x87')](_0x53c6f5['body'],[_0x482b('0x75'),'id'])||{});}})[_0x482b('0x25')](respondWithResult(_0x403c80,null))[_0x482b('0x19')](handleError(_0x403c80,null));};exports[_0x482b('0x88')]=function(_0x2f1ac1,_0x2aba71){var _0x22a9f8={'raw':![],'where':{}};var _0x2e49ef={};var _0x1446b7={'count':0x0,'rows':[]};return db[_0x482b('0x47')][_0x482b('0x72')]({'where':{'id':_0x2f1ac1[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x2aba71,null))[_0x482b('0x25')](function(_0x134f60){if(_0x134f60){_0x2e49ef[_0x482b('0x4b')]=_['keys'](db[_0x482b('0x85')]['rawAttributes']);_0x2e49ef[_0x482b('0x4c')]=_[_0x482b('0x4d')](_0x2f1ac1[_0x482b('0x4c')]);_0x2e49ef[_0x482b('0x58')]=_[_0x482b('0x4e')](_0x2e49ef[_0x482b('0x4b')],_0x2e49ef['query']);_0x22a9f8[_0x482b('0x4f')]=_[_0x482b('0x4e')](_0x2e49ef[_0x482b('0x4b')],qs['fields'](_0x2f1ac1[_0x482b('0x4c')]['fields']));_0x22a9f8[_0x482b('0x4f')]=_0x22a9f8[_0x482b('0x4f')][_0x482b('0x51')]?_0x22a9f8[_0x482b('0x4f')]:_0x2e49ef[_0x482b('0x4b')];if(!_0x2f1ac1['query']['hasOwnProperty']('nolimit')){_0x22a9f8[_0x482b('0x20')]=qs['limit'](_0x2f1ac1[_0x482b('0x4c')][_0x482b('0x20')]);_0x22a9f8[_0x482b('0x1e')]=qs[_0x482b('0x1e')](_0x2f1ac1[_0x482b('0x4c')][_0x482b('0x1e')]);}_0x22a9f8[_0x482b('0x54')]=qs['sort'](_0x2f1ac1[_0x482b('0x4c')][_0x482b('0x55')]);_0x22a9f8['where']=qs['filters'](_[_0x482b('0x57')](_0x2f1ac1[_0x482b('0x4c')],_0x2e49ef[_0x482b('0x58')]));_0x22a9f8['where'][_0x482b('0x6a')]=_0x134f60['id'];if(_0x2f1ac1[_0x482b('0x4c')][_0x482b('0x59')]){_0x22a9f8[_0x482b('0x56')]=_[_0x482b('0x5a')](_0x22a9f8[_0x482b('0x56')],{'$or':_['map'](_0x22a9f8[_0x482b('0x4f')],function(_0x36f301){var _0x701a80={};_0x701a80[_0x36f301]={'$like':'%'+_0x2f1ac1[_0x482b('0x4c')][_0x482b('0x59')]+'%'};return _0x701a80;})});}_0x22a9f8=_[_0x482b('0x5a')]({},_0x22a9f8,_0x2f1ac1[_0x482b('0x63')]);return db[_0x482b('0x85')][_0x482b('0x21')]({'where':_0x22a9f8[_0x482b('0x56')]})[_0x482b('0x25')](function(_0x2db3f5){_0x1446b7[_0x482b('0x21')]=_0x2db3f5;if(_0x2f1ac1[_0x482b('0x4c')][_0x482b('0x5d')]){_0x22a9f8['include']=[{'model':db[_0x482b('0x89')],'as':_0x482b('0x8a'),'required':![]},{'model':db[_0x482b('0x8b')],'as':'Owner','attributes':[_0x482b('0x29'),'fullname','internal'],'required':![]},{'model':db[_0x482b('0x8c')],'as':_0x482b('0x8d'),'attributes':['id',_0x482b('0x29'),_0x482b('0x8e')],'where':_0x2f1ac1[_0x482b('0x4c')]['tag']?{'id':_0x2f1ac1[_0x482b('0x4c')]['tag']}:undefined,'required':_0x2f1ac1['query']['tag']?!![]:![]}];}return db[_0x482b('0x85')][_0x482b('0x6e')](_0x22a9f8);})[_0x482b('0x25')](function(_0x3395ba){_0x1446b7['rows']=_0x3395ba;return _0x1446b7;});}})[_0x482b('0x25')](respondWithFilteredResult(_0x2aba71,_0x22a9f8))[_0x482b('0x19')](handleError(_0x2aba71,null));};exports[_0x482b('0x8f')]=function addApplications(_0x3fb838,_0x2edcd1){var _0x29cb66=_0x3fb838[_0x482b('0x61')]['id'];var _0xa05e7a=_0x3fb838[_0x482b('0x65')];var _0x59a71c=0xc8;var _0x321ee8=null;return db[_0x482b('0x90')][_0x482b('0x91')]({'isolationLevel':db['sequelize'][_0x482b('0x92')]['ISOLATION_LEVELS'][_0x482b('0x93')]},function(_0x4c2a4e){return db[_0x482b('0x47')][_0x482b('0x72')]({'where':{'id':_0x29cb66},'transaction':_0x4c2a4e})['then'](function(_0x287ab4){if(_0x287ab4){return db[_0x482b('0x94')][_0x482b('0x26')]({'where':{'MailAccountId':_0x29cb66},'transaction':_0x4c2a4e})[_0x482b('0x25')](function(){var _0x2c5407=_[_0x482b('0x46')](_0xa05e7a,function(_0x155479){_0x155479[_0x482b('0x6a')]=_0x29cb66;return _0x155479;});return db[_0x482b('0x94')][_0x482b('0x95')](_0x2c5407,{'transaction':_0x4c2a4e});});}else{_0x59a71c=0x194;_0x321ee8=[];}});})[_0x482b('0x25')](function(){if(_0x59a71c!==0x194){return db[_0x482b('0x94')][_0x482b('0x96')]({'where':{'MailAccountId':_0x29cb66},'order':_0x482b('0x97')})['then'](function(_0x55e2e5){_0x321ee8=_0x55e2e5;});}})[_0x482b('0x19')](function(_0x3d02fd){_0x59a71c=0x1f4;logger[_0x482b('0x14')](_0x3d02fd[_0x482b('0x28')]);if(_0x3d02fd['name']){delete _0x3d02fd[_0x482b('0x29')];}_0x321ee8=_0x3d02fd;})[_0x482b('0x98')](function(){if(_0x321ee8===null){_0x2edcd1[_0x482b('0x1a')](_0x59a71c);}else{if(_0x59a71c===0x1f4){_0x2edcd1[_0x482b('0x1b')](_0x59a71c)[_0x482b('0x99')](_0x321ee8);}else{_0x2edcd1[_0x482b('0x1b')](_0x59a71c)[_0x482b('0x1d')](_0x321ee8);}}});};exports['getApplications']=function(_0x2b1a5c,_0x5611b5){var _0x4baab9={};var _0x5b0030={};var _0x5511df;var _0x56eddb;return db[_0x482b('0x47')][_0x482b('0x72')]({'where':{'id':_0x2b1a5c[_0x482b('0x61')]['id']}})['then'](handleEntityNotFound(_0x5611b5,null))[_0x482b('0x25')](function(_0x1eb726){if(_0x1eb726){_0x5511df=_0x1eb726;_0x5b0030['model']=_['keys'](db[_0x482b('0x94')]['rawAttributes']);_0x5b0030['query']=_[_0x482b('0x4d')](_0x2b1a5c[_0x482b('0x4c')]);_0x5b0030[_0x482b('0x58')]=_[_0x482b('0x4e')](_0x5b0030[_0x482b('0x4b')],_0x5b0030[_0x482b('0x4c')]);_0x4baab9[_0x482b('0x4f')]=_[_0x482b('0x4e')](_0x5b0030['model'],qs[_0x482b('0x50')](_0x2b1a5c[_0x482b('0x4c')][_0x482b('0x50')]));_0x4baab9[_0x482b('0x4f')]=_0x4baab9['attributes'][_0x482b('0x51')]?_0x4baab9[_0x482b('0x4f')]:_0x5b0030[_0x482b('0x4b')];_0x4baab9[_0x482b('0x54')]=qs[_0x482b('0x55')](_0x2b1a5c[_0x482b('0x4c')][_0x482b('0x55')]);_0x4baab9[_0x482b('0x56')]=qs[_0x482b('0x58')](_[_0x482b('0x57')](_0x2b1a5c[_0x482b('0x4c')],_0x5b0030['filters']));if(_0x2b1a5c[_0x482b('0x4c')][_0x482b('0x59')]){_0x4baab9['where']=_['merge'](_0x4baab9['where'],{'$or':_[_0x482b('0x46')](_0x4baab9[_0x482b('0x4f')],function(_0x230055){var _0x38c253={};_0x38c253[_0x230055]={'$like':'%'+_0x2b1a5c['query']['filter']+'%'};return _0x38c253;})});}_0x4baab9=_['merge']({},_0x4baab9,_0x2b1a5c[_0x482b('0x63')]);return _0x5511df['getApplications'](_0x4baab9);}})[_0x482b('0x25')](function(_0x2b3b0a){if(_0x2b3b0a){_0x56eddb=_0x2b3b0a[_0x482b('0x51')];if(!_0x2b1a5c[_0x482b('0x4c')][_0x482b('0x52')](_0x482b('0x53'))){_0x4baab9[_0x482b('0x20')]=qs[_0x482b('0x20')](_0x2b1a5c[_0x482b('0x4c')][_0x482b('0x20')]);_0x4baab9[_0x482b('0x1e')]=qs['offset'](_0x2b1a5c[_0x482b('0x4c')][_0x482b('0x1e')]);}return _0x5511df['getApplications'](_0x4baab9);}})['then'](function(_0x4e9b3f){if(_0x4e9b3f){return _0x4e9b3f?{'count':_0x56eddb,'rows':_0x4e9b3f}:null;}})[_0x482b('0x25')](respondWithResult(_0x5611b5,null))[_0x482b('0x19')](handleError(_0x5611b5,null));};exports[_0x482b('0x9a')]=function(_0x3b0815,_0x2c59e3){var _0x20fbbe={'raw':!![],'where':{}};var _0x2c3418={};var _0x82d1a6={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x3b0815[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x2c59e3,null))[_0x482b('0x25')](function(_0x201223){if(_0x201223){_0x2c3418[_0x482b('0x4b')]=_[_0x482b('0x4d')](db[_0x482b('0x9b')][_0x482b('0x48')]);_0x2c3418[_0x482b('0x4c')]=_[_0x482b('0x4d')](_0x3b0815['query']);_0x2c3418[_0x482b('0x58')]=_[_0x482b('0x4e')](_0x2c3418['model'],_0x2c3418[_0x482b('0x4c')]);_0x20fbbe[_0x482b('0x4f')]=_[_0x482b('0x4e')](_0x2c3418[_0x482b('0x4b')],qs[_0x482b('0x50')](_0x3b0815['query'][_0x482b('0x50')]));_0x20fbbe[_0x482b('0x4f')]=_0x20fbbe['attributes'][_0x482b('0x51')]?_0x20fbbe[_0x482b('0x4f')]:_0x2c3418['model'];if(!_0x3b0815['query'][_0x482b('0x52')]('nolimit')){_0x20fbbe[_0x482b('0x20')]=qs['limit'](_0x3b0815[_0x482b('0x4c')][_0x482b('0x20')]);_0x20fbbe[_0x482b('0x1e')]=qs[_0x482b('0x1e')](_0x3b0815[_0x482b('0x4c')][_0x482b('0x1e')]);}_0x20fbbe['order']=qs[_0x482b('0x55')](_0x3b0815[_0x482b('0x4c')][_0x482b('0x55')]);_0x20fbbe['where']=qs[_0x482b('0x58')](_[_0x482b('0x57')](_0x3b0815[_0x482b('0x4c')],_0x2c3418[_0x482b('0x58')]));_0x20fbbe[_0x482b('0x56')][_0x482b('0x6a')]=_0x201223['id'];if(_0x3b0815[_0x482b('0x4c')][_0x482b('0x59')]){_0x20fbbe[_0x482b('0x56')]=_[_0x482b('0x5a')](_0x20fbbe[_0x482b('0x56')],{'$or':_['map'](_0x20fbbe[_0x482b('0x4f')],function(_0x5c78c9){var _0x27ad07={};_0x27ad07[_0x5c78c9]={'$like':'%'+_0x3b0815['query'][_0x482b('0x59')]+'%'};return _0x27ad07;})});}if(_0x3b0815[_0x482b('0x4c')][_0x482b('0x9c')]){var _0x249278=_0x3b0815[_0x482b('0x4c')][_0x482b('0x9c')]['split'](',');var _0x5429dc={};_0x5429dc[_0x249278[0x0]]={'$gte':moment(_0x249278[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x20fbbe[_0x482b('0x56')]=_[_0x482b('0x5a')](_0x20fbbe[_0x482b('0x56')],_0x5429dc);}_0x20fbbe=_[_0x482b('0x5a')]({},_0x20fbbe,_0x3b0815[_0x482b('0x63')]);return db[_0x482b('0x9b')][_0x482b('0x21')]({'where':_0x20fbbe['where']})[_0x482b('0x25')](function(_0x57befb){_0x82d1a6[_0x482b('0x21')]=_0x57befb;if(_0x3b0815[_0x482b('0x4c')][_0x482b('0x5d')]){_0x20fbbe['include']=[{'all':!![]}];}return db[_0x482b('0x9b')][_0x482b('0x6e')](_0x20fbbe);})[_0x482b('0x25')](function(_0x5cfebd){if(_0x3b0815[_0x482b('0x4c')][_0x482b('0x9d')]===_0x482b('0x9e')){for(var _0x4ebbcb=0x0;_0x4ebbcb<_0x5cfebd[_0x482b('0x51')];_0x4ebbcb++){_0x5cfebd[_0x4ebbcb]['body']=juice(_0x5cfebd[_0x4ebbcb][_0x482b('0x65')]);}}_0x82d1a6['rows']=_0x5cfebd;return _0x82d1a6;});}})[_0x482b('0x25')](respondWithFilteredResult(_0x2c59e3,_0x20fbbe))[_0x482b('0x19')](handleError(_0x2c59e3,null));};exports[_0x482b('0x99')]=function(_0x5c4017,_0x19f986){var _0x2ed3f4,_0x410486={},_0x167b63;if(_0x5c4017[_0x482b('0x65')]['to']){_0x167b63=_0x5c4017[_0x482b('0x65')]['to'][_0x482b('0x9f')](',')[0x0];}return db[_0x482b('0x47')][_0x482b('0x64')]({'where':{'id':_0x5c4017[_0x482b('0x61')]['id']},'include':[{'model':db[_0x482b('0xa0')],'as':_0x482b('0xa1'),'include':[{'model':db[_0x482b('0x89')],'as':_0x482b('0xa2'),'where':{'email':_0x167b63},'limit':0x1,'order':[[_0x482b('0xa3'),_0x482b('0xa4')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x482b('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0x482b('0x25')](handleEntityNotFound(_0x19f986,null))[_0x482b('0x25')](function(_0x581536){if(!_0x581536)return;_0x2ed3f4=_0x581536;if(!_0x581536[_0x482b('0x41')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x482b('0xa6')](_0x5c4017[_0x482b('0x65')][_0x482b('0xa7')])){_0x5c4017['body']['from']=util[_0x482b('0xa8')](_0x482b('0xa9'),_0x581536[_0x482b('0x29')],_0x581536['email']||_0x581536[_0x482b('0x41')][_0x482b('0x35')]);}if(_0x5c4017['body'][_0x482b('0xaa')]&&_0x5c4017[_0x482b('0x65')]['attachments'][_0x482b('0x51')]){for(var _0x295618=0x0;_0x295618<_0x5c4017[_0x482b('0x65')][_0x482b('0xaa')][_0x482b('0x51')];_0x295618+=0x1){_0x5c4017[_0x482b('0x65')]['attachments'][_0x295618]={'filename':_0x5c4017[_0x482b('0x65')][_0x482b('0xaa')][_0x295618]['name'],'path':path[_0x482b('0xab')](config['root'],_0x482b('0xac'),_0x5c4017[_0x482b('0x65')]['attachments'][_0x295618]['basename'])};}}var _0x713c27=_0x581536[_0x482b('0xad')]();return respondWithRpcPromise(_0x482b('0xae'),_0x482b('0xaf'),{'account':_0x713c27,'message':_0x5c4017[_0x482b('0x65')]});})['then'](function(_0x2b978c){if(!_0x2b978c)return;_0x410486=_0x2b978c;if(!_0x2ed3f4[_0x482b('0xa1')])throw new Error(_0x482b('0xb0'));if(_0x2ed3f4[_0x482b('0xa1')][_0x482b('0xa2')][_0x482b('0x51')])return _0x2ed3f4['List'][_0x482b('0xa2')][0x0];return db['CmContact'][_0x482b('0x6b')](_[_0x482b('0xb1')](_0x5c4017[_0x482b('0x65')],{'firstName':_0x5c4017['body']['to'],'email':_0x5c4017[_0x482b('0x65')]['to'],'phone':_0x5c4017[_0x482b('0x65')]['to'],'ListId':_0x2ed3f4[_0x482b('0xb2')]}));})[_0x482b('0x25')](function(_0x3ad3db){if(!_0x3ad3db)return;var _0x31d7b9={'UserId':_0x5c4017[_0x482b('0x35')]['id'],'ContactId':_0x3ad3db['id'],'MailAccountId':_0x2ed3f4['id'],'inReplyTo':_0x410486[_0x482b('0xb3')],'to':_0x5c4017['body'][_0x482b('0xa7')],'cc':_0x5c4017[_0x482b('0x65')]['cc'],'subject':_0x5c4017['body'][_0x482b('0xb4')],'attach':_0x5c4017['body'][_0x482b('0xb5')],'firstMsgDirection':'out','lastMsgAt':moment()[_0x482b('0xa8')](_0x482b('0xb6')),'lastMsgDirection':_0x482b('0xb7'),'Messages':[_[_0x482b('0x5a')](_0x5c4017[_0x482b('0x65')],{'messageId':_0x410486[_0x482b('0xb3')],'sentAt':moment()[_0x482b('0xa8')](_0x482b('0xb6')),'read':!![],'MailAccountId':_0x2ed3f4['id'],'UserId':_0x5c4017[_0x482b('0x35')]['id'],'ContactId':_0x3ad3db['id']})]};if(_0x5c4017[_0x482b('0x65')][_0x482b('0xb8')]){_0x31d7b9=_[_0x482b('0x5a')](_0x31d7b9,_0x5c4017['body'][_0x482b('0xb8')]);}return db['MailInteraction'][_0x482b('0x6b')](_0x31d7b9,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x482b('0x25')](respondWithResult(_0x19f986,null))[_0x482b('0x19')](handleError(_0x19f986,null));};exports[_0x482b('0xb9')]=function(_0x1fb0fe,_0x2dc7b3){return db[_0x482b('0x47')]['find']({'where':{'id':_0x1fb0fe[_0x482b('0x61')]['id']},'include':[{'model':db[_0x482b('0x43')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x482b('0xa5'),'raw':!![]}]}]})[_0x482b('0x25')](handleEntityNotFound(_0x2dc7b3,null))[_0x482b('0x25')](function(_0x391685){if(!_0x391685[_0x482b('0x41')])return;var _0x163ccf=_0x391685[_0x482b('0xad')]();return respondWithRpcPromise(_0x482b('0xba'),_0x482b('0xb9'),{'account':_0x163ccf});})[_0x482b('0x25')](respondWithResult(_0x2dc7b3,null))[_0x482b('0x19')](handleError(_0x2dc7b3,null));};exports[_0x482b('0x26')]=function(_0x212780,_0x1eb8a2){return db['MailAccount'][_0x482b('0x64')]({'where':{'id':_0x212780[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x1eb8a2,null))[_0x482b('0x25')](function(_0x597d85){if(_0x597d85&&_0x597d85[_0x482b('0x3e')]){throw new db[(_0x482b('0xbb'))][(_0x482b('0xbc'))](_0x482b('0xbd'));}return _0x597d85;})[_0x482b('0x25')](removeEntity(_0x1eb8a2,null))[_0x482b('0x19')](handleError(_0x1eb8a2,null));};exports['addAgents']=function(_0x48a52c,_0x4ba407){return db[_0x482b('0x47')][_0x482b('0x64')]({'where':{'id':_0x48a52c[_0x482b('0x61')]['id']}})[_0x482b('0x25')](handleEntityNotFound(_0x4ba407,null))[_0x482b('0x25')](function(_0x128722){if(_0x128722){return _0x128722[_0x482b('0xbe')](_0x48a52c[_0x482b('0x65')][_0x482b('0x75')],_[_0x482b('0x87')](_0x48a52c[_0x482b('0x65')],[_0x482b('0x75'),'id'])||{})[_0x482b('0xbf')](function(_0x3f6c6e){for(var _0x28062c=0x0;_0x28062c<_0x48a52c[_0x482b('0x65')][_0x482b('0x75')][_0x482b('0x51')];_0x28062c+=0x1){socket[_0x482b('0xc0')](_0x482b('0xc1'),{'UserId':Number(_0x48a52c['body'][_0x482b('0x75')][_0x28062c]),'MailAccountId':Number(_0x48a52c[_0x482b('0x61')]['id'])});}return _0x3f6c6e;});}})[_0x482b('0x25')](respondWithResult(_0x4ba407,null))[_0x482b('0x19')](handleError(_0x4ba407,null));};exports['removeAgents']=function(_0x2ca53e,_0x4625e8){return db[_0x482b('0x47')]['find']({'where':{'id':_0x2ca53e[_0x482b('0x61')]['id']}})['then'](handleEntityNotFound(_0x4625e8,null))['then'](function(_0x5cd6a6){if(_0x5cd6a6){return _0x5cd6a6[_0x482b('0xc2')](_0x2ca53e['query'][_0x482b('0x75')])['then'](function(){if(_[_0x482b('0xc3')](_0x2ca53e[_0x482b('0x4c')]['ids'])){for(var _0x341a80=0x0;_0x341a80<_0x2ca53e['query'][_0x482b('0x75')]['length'];_0x341a80+=0x1){socket[_0x482b('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2ca53e['query'][_0x482b('0x75')][_0x341a80]),'MailAccountId':Number(_0x2ca53e['params']['id'])});}}else{socket[_0x482b('0xc0')]('userMailAccount:remove',{'UserId':Number(_0x2ca53e[_0x482b('0x4c')][_0x482b('0x75')]),'MailAccountId':Number(_0x2ca53e[_0x482b('0x61')]['id'])});}});}})[_0x482b('0x25')](respondWithStatusCode(_0x4625e8,null))[_0x482b('0x19')](handleError(_0x4625e8,null));};exports[_0x482b('0xc4')]=function(_0x1a29ae,_0x575fb9){var _0x25bc98={};var _0x36a81d={};var _0x33e29c;var _0x2b5abe;return db[_0x482b('0x47')]['findOne']({'where':{'id':_0x1a29ae[_0x482b('0x61')]['id']}})['then'](handleEntityNotFound(_0x575fb9,null))[_0x482b('0x25')](function(_0x1f1b60){if(_0x1f1b60){_0x33e29c=_0x1f1b60;_0x36a81d['model']=_[_0x482b('0x4d')](db[_0x482b('0x8b')]['rawAttributes']);_0x36a81d['query']=_[_0x482b('0x4d')](_0x1a29ae[_0x482b('0x4c')]);_0x36a81d[_0x482b('0x58')]=_[_0x482b('0x4e')](_0x36a81d[_0x482b('0x4b')],_0x36a81d[_0x482b('0x4c')]);_0x25bc98[_0x482b('0x4f')]=_[_0x482b('0x4e')](_0x36a81d[_0x482b('0x4b')],qs[_0x482b('0x50')](_0x1a29ae[_0x482b('0x4c')][_0x482b('0x50')]));_0x25bc98['attributes']=_0x25bc98[_0x482b('0x4f')][_0x482b('0x51')]?_0x25bc98[_0x482b('0x4f')]:_0x36a81d[_0x482b('0x4b')];_0x25bc98[_0x482b('0x54')]=qs[_0x482b('0x55')](_0x1a29ae[_0x482b('0x4c')][_0x482b('0x55')]);_0x25bc98[_0x482b('0x56')]=qs[_0x482b('0x58')](_[_0x482b('0x57')](_0x1a29ae[_0x482b('0x4c')],_0x36a81d[_0x482b('0x58')]));if(_0x1a29ae[_0x482b('0x4c')][_0x482b('0x59')]){_0x25bc98[_0x482b('0x56')]=_[_0x482b('0x5a')](_0x25bc98[_0x482b('0x56')],{'$or':_['map'](_0x25bc98[_0x482b('0x4f')],function(_0x4953d2){var _0x2a987a={};_0x2a987a[_0x4953d2]={'$like':'%'+_0x1a29ae[_0x482b('0x4c')][_0x482b('0x59')]+'%'};return _0x2a987a;})});}_0x25bc98=_[_0x482b('0x5a')]({},_0x25bc98,_0x1a29ae[_0x482b('0x63')]);return _0x33e29c['getAgents'](_0x25bc98);}})['then'](function(_0x2394b8){if(_0x2394b8){_0x2b5abe=_0x2394b8[_0x482b('0x51')];if(!_0x1a29ae[_0x482b('0x4c')][_0x482b('0x52')](_0x482b('0x53'))){_0x25bc98[_0x482b('0x20')]=qs[_0x482b('0x20')](_0x1a29ae['query'][_0x482b('0x20')]);_0x25bc98[_0x482b('0x1e')]=qs[_0x482b('0x1e')](_0x1a29ae[_0x482b('0x4c')]['offset']);}return _0x33e29c[_0x482b('0xc4')](_0x25bc98);}})['then'](function(_0x1201e3){if(_0x1201e3){return _0x1201e3?{'count':_0x2b5abe,'rows':_0x1201e3}:null;}})['then'](respondWithResult(_0x575fb9,null))[_0x482b('0x19')](handleError(_0x575fb9,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index da78c72..ee6f415 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 _0x79a3=['emit','hasOwnProperty','events','MailAccount','setMaxListeners','update'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x79a3,0x80));var _0x379a=function(_0x363c5d,_0x4ac556){_0x363c5d=_0x363c5d-0x0;var _0x3e4017=_0x79a3[_0x363c5d];return _0x3e4017;};'use strict';var EventEmitter=require(_0x379a('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x379a('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x379a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x379a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x484729){return function(_0x4c456f,_0x187d55,_0x24dda6){MailAccountEvents[_0x379a('0x4')](_0x484729+':'+_0x4c456f['id'],_0x4c456f);MailAccountEvents[_0x379a('0x4')](_0x484729,_0x4c456f);_0x24dda6(null);};}for(var e in events){if(events[_0x379a('0x5')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0x8921=['exports','events','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3e9d74,_0x205166){var _0xf15a50=function(_0xcf26f4){while(--_0xcf26f4){_0x3e9d74['push'](_0x3e9d74['shift']());}};_0xf15a50(++_0x205166);}(_0x8921,0x9a));var _0x1892=function(_0x1e30c2,_0x1a7c4e){_0x1e30c2=_0x1e30c2-0x0;var _0x4209e7=_0x8921[_0x1e30c2];return _0x4209e7;};'use strict';var EventEmitter=require(_0x1892('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x1892('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x1892('0x2')](0x0);var events={'afterCreate':_0x1892('0x3'),'afterUpdate':_0x1892('0x4'),'afterDestroy':_0x1892('0x5')};function emitEvent(_0x110b75){return function(_0x28a89b,_0x15aa1b,_0x2790a1){MailAccountEvents[_0x1892('0x6')](_0x110b75+':'+_0x28a89b['id'],_0x28a89b);MailAccountEvents[_0x1892('0x6')](_0x110b75,_0x28a89b);_0x2790a1(null);};}for(var e in events){if(events[_0x1892('0x7')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x1892('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 dfedb55..598d425 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 _0x5963=['data5','auth','pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user'];(function(_0x358f87,_0x5a4d20){var _0x4b2fdb=function(_0x384222){while(--_0x384222){_0x358f87['push'](_0x358f87['shift']());}};_0x4b2fdb(++_0x5a4d20);}(_0x5963,0xc0));var _0x3596=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5963[_0x4a9fb1];return _0x348672;};'use strict';var attributes=require(_0x3596('0x0'));module[_0x3596('0x1')]=function(_0x14847f){return _0x14847f[_0x3596('0x2')](_0x3596('0x3'),attributes,{'tableName':_0x3596('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x22b5d4=this;var _0x462ec3={'id':_0x22b5d4['id'],'tls':{'rejectUnauthorized':![]}};if(_0x22b5d4[_0x3596('0x5')]!==_0x3596('0x6')){_0x462ec3[_0x3596('0x7')]=_0x22b5d4['provider'];}else{_0x462ec3['host']=_0x22b5d4[_0x3596('0x8')][_0x3596('0x9')];_0x462ec3[_0x3596('0xa')]=_0x22b5d4[_0x3596('0x8')][_0x3596('0xa')];_0x462ec3[_0x3596('0xb')]=_0x22b5d4['Smtp'][_0x3596('0xb')];}if(_0x22b5d4[_0x3596('0x8')][_0x3596('0xc')]){if(_0x22b5d4[_0x3596('0x8')][_0x3596('0xd')]){if(!_0x22b5d4[_0x3596('0x8')][_0x3596('0xe')])throw new Error(_0x3596('0xf'));_0x462ec3['auth']={'type':_0x3596('0x10'),'user':_0x22b5d4[_0x3596('0x8')][_0x3596('0x11')],'accessToken':_0x22b5d4[_0x3596('0x8')][_0x3596('0xe')][_0x3596('0x12')]};}else{_0x462ec3[_0x3596('0x13')]={'user':_0x22b5d4['Smtp']['user'],'pass':_0x22b5d4[_0x3596('0x8')][_0x3596('0x14')]};}}return _0x462ec3;}}});}; \ No newline at end of file +var _0x4b0a=['auth','OAuth2','user','CloudProvider','data5','./mailAccount.attributes','exports','MailAccount','custom','service','provider','host','port','secure','Smtp','modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found'];(function(_0x50f21f,_0x26c387){var _0x42334a=function(_0x420c94){while(--_0x420c94){_0x50f21f['push'](_0x50f21f['shift']());}};_0x42334a(++_0x26c387);}(_0x4b0a,0x17b));var _0xa4b0=function(_0x40f6c6,_0x4bcf97){_0x40f6c6=_0x40f6c6-0x0;var _0x243159=_0x4b0a[_0x40f6c6];return _0x243159;};'use strict';var attributes=require(_0xa4b0('0x0'));module[_0xa4b0('0x1')]=function(_0x19a29b){return _0x19a29b['define'](_0xa4b0('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x1301d2=this;var _0x119686={'id':_0x1301d2['id'],'tls':{'rejectUnauthorized':![]}};if(_0x1301d2['provider']!==_0xa4b0('0x3')){_0x119686[_0xa4b0('0x4')]=_0x1301d2[_0xa4b0('0x5')];}else{_0x119686[_0xa4b0('0x6')]=_0x1301d2['Smtp'][_0xa4b0('0x6')];_0x119686[_0xa4b0('0x7')]=_0x1301d2['Smtp'][_0xa4b0('0x7')];_0x119686[_0xa4b0('0x8')]=_0x1301d2['Smtp'][_0xa4b0('0x8')];}if(_0x1301d2[_0xa4b0('0x9')]['authentication']){if(_0x1301d2['Smtp'][_0xa4b0('0xa')]){if(!_0x1301d2[_0xa4b0('0x9')]['CloudProvider'])throw new Error(_0xa4b0('0xb'));_0x119686[_0xa4b0('0xc')]={'type':_0xa4b0('0xd'),'user':_0x1301d2[_0xa4b0('0x9')][_0xa4b0('0xe')],'accessToken':_0x1301d2[_0xa4b0('0x9')][_0xa4b0('0xf')][_0xa4b0('0x10')]};}else{_0x119686[_0xa4b0('0xc')]={'user':_0x1301d2[_0xa4b0('0x9')][_0xa4b0('0xe')],'pass':_0x1301d2[_0xa4b0('0x9')]['pass']};}}return _0x119686;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0d124ed..450e0df 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 _0x1967=['getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','rawAttributes','createdAt','CompanyId','ListId','isNil','from','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmContact','updatedAt','Applications','CloudProvider','List','get','applications','list','priority','asc','autoclose','push','close','*,*,*,*','Contacts','length','create','messageId','generate','subject','attach','format','MailInteraction','MailMessage','inReplyTo','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','attachments','originTo','originCc','bcc','ChatOfflineMessageId','Attachments','UserId','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailAccount','findAll','options','where','attributes','limit','map','include','model','ShowMailAccount','MailAccount','find','smtp','setDataValue','smtpOptions'];(function(_0x4fa4fd,_0x4c656b){var _0x3c50d0=function(_0x223600){while(--_0x223600){_0x4fa4fd['push'](_0x4fa4fd['shift']());}};_0x3c50d0(++_0x4c656b);}(_0x1967,0x173));var _0x7196=function(_0x2e8545,_0x4e1458){_0x2e8545=_0x2e8545-0x0;var _0x32ca12=_0x1967[_0x2e8545];return _0x32ca12;};'use strict';var _=require('lodash');var moment=require(_0x7196('0x0'));var BPromise=require(_0x7196('0x1'));var rs=require(_0x7196('0x2'));var Redis=require(_0x7196('0x3'));var db=require(_0x7196('0x4'))['db'];var logger=require(_0x7196('0x5'))(_0x7196('0x6'));var config=require(_0x7196('0x7'));var jayson=require(_0x7196('0x8'));var client=jayson[_0x7196('0x9')]['http']({'port':0x232c});config[_0x7196('0xa')]=_[_0x7196('0xb')](config[_0x7196('0xa')],{'host':_0x7196('0xc'),'port':0x18eb});var socket=require(_0x7196('0xd'))(new Redis(config[_0x7196('0xa')]));require('./mailAccount.socket')[_0x7196('0xe')](socket);function respondWithRpcPromise(_0xc6366f,_0x3f846e,_0x259b18){return new BPromise(function(_0x1e862d,_0x503070){return client['request'](_0xc6366f,_0x259b18)[_0x7196('0xf')](function(_0x10459b){logger[_0x7196('0x10')](_0x7196('0x11'),_0x3f846e,_0x7196('0x12'));logger[_0x7196('0x13')](_0x7196('0x14'),_0x3f846e,_0x7196('0x12'),JSON[_0x7196('0x15')](_0x10459b));if(_0x10459b[_0x7196('0x16')]){if(_0x10459b[_0x7196('0x16')]['code']===0x1f4){logger[_0x7196('0x16')](_0x7196('0x11'),_0x3f846e,_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);return _0x503070(_0x10459b['error'][_0x7196('0x17')]);}logger['error'](_0x7196('0x11'),_0x3f846e,_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);return _0x1e862d(_0x10459b[_0x7196('0x16')][_0x7196('0x17')]);}else{logger[_0x7196('0x10')](_0x7196('0x11'),_0x3f846e,_0x7196('0x12'));_0x1e862d(_0x10459b[_0x7196('0x18')][_0x7196('0x17')]);}})[_0x7196('0x19')](function(_0x5b716a){logger['error'](_0x7196('0x11'),_0x3f846e,_0x5b716a);_0x503070(_0x5b716a);});});}exports[_0x7196('0x1a')]=function(_0x40418d){var _0x517a3e=this;return new Promise(function(_0x39b944,_0x539d8b){return db['MailAccount'][_0x7196('0x1b')]({'raw':_0x40418d[_0x7196('0x1c')]?_0x40418d[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x40418d['options']?_0x40418d[_0x7196('0x1c')][_0x7196('0x1d')]||null:null,'attributes':_0x40418d['options']?_0x40418d[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'limit':_0x40418d[_0x7196('0x1c')]?_0x40418d[_0x7196('0x1c')][_0x7196('0x1f')]||null:null,'include':_0x40418d['options']?_0x40418d[_0x7196('0x1c')]['include']?_[_0x7196('0x20')](_0x40418d[_0x7196('0x1c')][_0x7196('0x21')],function(_0xa69810){return{'model':db[_0xa69810[_0x7196('0x22')]],'as':_0xa69810['as'],'attributes':_0xa69810[_0x7196('0x1e')],'include':_0xa69810['include']?_['map'](_0xa69810[_0x7196('0x21')],function(_0x2d284f){return{'model':db[_0x2d284f[_0x7196('0x22')]],'as':_0x2d284f['as'],'attributes':_0x2d284f['attributes'],'include':_0x2d284f['include']?_[_0x7196('0x20')](_0x2d284f[_0x7196('0x21')],function(_0x675e64){return{'model':db[_0x675e64['model']],'as':_0x675e64['as'],'attributes':_0x675e64[_0x7196('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4fd339){logger['info'](_0x7196('0x1a'),_0x40418d);logger[_0x7196('0x13')](_0x7196('0x1a'),_0x40418d,JSON['stringify'](_0x4fd339));_0x39b944(_0x4fd339);})[_0x7196('0x19')](function(_0x45d567){logger[_0x7196('0x16')](_0x7196('0x1a'),_0x45d567['message'],_0x40418d);_0x539d8b(_0x517a3e[_0x7196('0x16')](0x1f4,_0x45d567[_0x7196('0x17')]));});});};exports[_0x7196('0x23')]=function(_0x651d7e){var _0x4780e1=this;return new Promise(function(_0x2786f3,_0x15c5f0){return db[_0x7196('0x24')][_0x7196('0x25')]({'raw':_0x651d7e[_0x7196('0x1c')]?_0x651d7e[_0x7196('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x651d7e[_0x7196('0x1c')]?_0x651d7e['options'][_0x7196('0x1d')]||null:null,'attributes':_0x651d7e['options']?_0x651d7e[_0x7196('0x1c')][_0x7196('0x1e')]||null:null,'include':_0x651d7e['options']?_0x651d7e[_0x7196('0x1c')][_0x7196('0x21')]?_[_0x7196('0x20')](_0x651d7e[_0x7196('0x1c')][_0x7196('0x21')],function(_0x4a8580){return{'model':db[_0x4a8580[_0x7196('0x22')]],'as':_0x4a8580['as'],'attributes':_0x4a8580[_0x7196('0x1e')],'include':_0x4a8580[_0x7196('0x21')]?_[_0x7196('0x20')](_0x4a8580[_0x7196('0x21')],function(_0x123cad){return{'model':db[_0x123cad['model']],'as':_0x123cad['as'],'attributes':_0x123cad[_0x7196('0x1e')],'include':_0x123cad[_0x7196('0x21')]?_[_0x7196('0x20')](_0x123cad['include'],function(_0x33831a){return{'model':db[_0x33831a[_0x7196('0x22')]],'as':_0x33831a['as'],'attributes':_0x33831a[_0x7196('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7196('0xf')](function(_0x11d4ec){if(_0x651d7e[_0x7196('0x1c')][_0x7196('0x26')]===!![])_0x11d4ec[_0x7196('0x27')](_0x7196('0x28'),_0x11d4ec[_0x7196('0x29')]());logger['info'](_0x7196('0x23'),_0x651d7e);logger[_0x7196('0x13')]('ShowMailAccount',_0x651d7e,JSON[_0x7196('0x15')](_0x11d4ec));_0x2786f3(_0x11d4ec);})['catch'](function(_0x5bd701){logger[_0x7196('0x16')](_0x7196('0x23'),_0x5bd701['message'],_0x651d7e);_0x15c5f0(_0x4780e1['error'](0x1f4,_0x5bd701[_0x7196('0x17')]));});});};exports[_0x7196('0x2a')]=function(_0xed32cd){var _0x4c2341=this;return new Promise(function(_0x36a990,_0x2d13a5){var _0x29ba1c={'body':_0xed32cd[_0x7196('0x2b')],'channel':_0x7196('0x2c')};var _0x428d76=_[_0x7196('0x2d')](_[_0x7196('0x2e')](db['CmContact'][_0x7196('0x2f')]),[_0x7196('0x30'),'updatedAt',_0x7196('0x31'),_0x7196('0x32')]);var _0x48178f=![];if(_0xed32cd[_0x7196('0x2b')]['id']){delete _0xed32cd[_0x7196('0x2b')]['id'];}if(_[_0x7196('0x33')](_0xed32cd['body'][_0x7196('0x34')])){return _0x2d13a5(_0x4c2341[_0x7196('0x16')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x7196('0x33')](_0xed32cd[_0x7196('0x2b')]['body'])||_0xed32cd[_0x7196('0x2b')]['body']===''){return _0x2d13a5(_0x4c2341['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0xed32cd['body'][_0x7196('0x35')])){return _0x2d13a5(_0x4c2341['error'](0x1f4,_0x7196('0x36')+_0x428d76));}if(!_[_0x7196('0x37')](_0x428d76,_0xed32cd[_0x7196('0x2b')][_0x7196('0x35')])){return _0x2d13a5(_0x4c2341['error'](0x1f4,_0x7196('0x38')+_0x428d76));}var _0x56ffdd={};_0x56ffdd[_0xed32cd[_0x7196('0x2b')][_0x7196('0x35')]]=_0xed32cd[_0x7196('0x2b')]['from'];return db[_0x7196('0x24')][_0x7196('0x25')]({'where':{'id':_0xed32cd[_0x7196('0x39')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x7196('0x3a')],'as':'Contacts','where':_0x56ffdd,'limit':0x1,'order':[[_0x7196('0x3b'),'DESC']]}]},{'model':db['MailApplication'],'as':_0x7196('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0x7196('0x3d')}]}]})['then'](function(_0x48e3b5){if(_0x48e3b5&&_0x48e3b5[_0x7196('0x3e')]){var _0x182c8b=_0x48e3b5[_0x7196('0x3f')]({'plain':!![]});_0x29ba1c[_0x7196('0x39')]=_['omit'](_0x182c8b,[_0x7196('0x3c'),'List']);_0x29ba1c[_0x7196('0x39')][_0x7196('0x28')]=_0x48e3b5['getSmtpOptions']();_0x29ba1c[_0x7196('0x40')]=_0x182c8b[_0x7196('0x3c')];_0x29ba1c[_0x7196('0x41')]=_0x182c8b['List'];_0x29ba1c[_0x7196('0x40')]=_['orderBy'](_0x29ba1c[_0x7196('0x40')],[_0x7196('0x42')],[_0x7196('0x43')]);if(_0x29ba1c[_0x7196('0x39')]&&_0x29ba1c[_0x7196('0x39')][_0x7196('0x44')]){_0x29ba1c[_0x7196('0x40')][_0x7196('0x45')]({'id':0x0,'priority':_0x29ba1c['applications']['length']+0x1,'app':_0x7196('0x46'),'appdata':_0x7196('0x44'),'interval':_0x7196('0x47')});}if(_0x29ba1c[_0x7196('0x39')]['Applications']){delete _0x29ba1c[_0x7196('0x39')][_0x7196('0x3c')];}if(_0x29ba1c[_0x7196('0x39')][_0x7196('0x3e')]){delete _0x29ba1c[_0x7196('0x39')][_0x7196('0x3e')];}if(_0x182c8b[_0x7196('0x3e')][_0x7196('0x48')][_0x7196('0x49')]){return _0x182c8b[_0x7196('0x3e')][_0x7196('0x48')][0x0];}var _0x4940a2=_[_0x7196('0xb')](_0xed32cd[_0x7196('0x2b')],{'firstName':_0xed32cd[_0x7196('0x2b')]['from'],'ListId':_0x182c8b[_0x7196('0x32')]});_0x4940a2[_0xed32cd['body'][_0x7196('0x35')]]=_0xed32cd[_0x7196('0x2b')][_0x7196('0x34')];return db[_0x7196('0x3a')][_0x7196('0x4a')](_0x4940a2);}else{throw new Error('List\x20not\x20found');}})[_0x7196('0xf')](function(_0x5b77fc){_0x29ba1c['contact']=_0x5b77fc;if(_0x5b77fc){if(!_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x4b')]){_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4b')]=rs[_0x7196('0x4c')]()+'\x20'+_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x34')];}var _0x14dc43={'ContactId':_0x5b77fc['id'],'MailAccountId':_0xed32cd[_0x7196('0x39')]['id'],'inReplyTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['messageId'],'to':_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x34')],'cc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['cc'],'subject':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4d')],'attach':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'lastMsgAt':moment()[_0x7196('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x7196('0x50')][_0x7196('0x25')]({'where':{'closed':![],'MailAccountId':_0xed32cd[_0x7196('0x39')]['id']},'include':[{'model':db[_0x7196('0x51')],'as':'Messages','attributes':[_0x7196('0x4b')],'where':{'messageId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x52')]}}]})[_0x7196('0xf')](function(_0x3c3d64){if(_0x3c3d64){return[_0x3c3d64,![]];}return db[_0x7196('0x50')]['create'](_0x14dc43)[_0x7196('0xf')](function(_0x2c5cba){return[_0x2c5cba,!![]];});});}else{throw new Error(_0x7196('0x53'));}})[_0x7196('0x54')](function(_0x52827f,_0x418a7a){if(_0x52827f){_0x48178f=_0x418a7a;if(!_0x418a7a){return _0x52827f[_0x7196('0x55')]({'inReplyTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4b')],'to':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['from'],'cc':_0xed32cd['body']['message']['cc'],'subject':_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x4d')],'attach':_0x52827f[_0x7196('0x4e')]?_0x52827f[_0x7196('0x4e')]:_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'substatus':null,'substatusAt':moment()[_0x7196('0x4f')](_0x7196('0x56')),'lastMsgAt':moment()[_0x7196('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x52827f;}}})['then'](function(_0x4542c1){_0x29ba1c[_0x7196('0x57')]=_0x4542c1[_0x7196('0x3f')]({'plain':!![]});_0x29ba1c[_0x7196('0x57')][_0x7196('0x58')]=_0x48178f;return db[_0x7196('0x51')][_0x7196('0x4a')]({'body':_0xed32cd[_0x7196('0x2b')]['body'],'MailAccountId':_0xed32cd['account']['id'],'MailInteractionId':_0x4542c1['id'],'direction':'in','ContactId':_0x29ba1c[_0x7196('0x59')]['id'],'messageId':_0xed32cd['body'][_0x7196('0x17')]['messageId'],'from':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x34')],'to':_0xed32cd[_0x7196('0x2b')]['message']['to'],'cc':_0xed32cd['body'][_0x7196('0x17')]['cc'],'subject':_0xed32cd['body'][_0x7196('0x17')][_0x7196('0x4d')],'attach':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x4e')],'Attachments':_0xed32cd[_0x7196('0x2b')]['message'][_0x7196('0x5a')],'originTo':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5b')],'originCc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5c')],'bcc':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5d')],'ChatWebsiteId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['ChatWebsiteId']||null,'originChannel':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')]['originChannel']||'Email','ChatOfflineMessageId':_0xed32cd[_0x7196('0x2b')][_0x7196('0x17')][_0x7196('0x5e')]||null},{'include':[{'model':db['Attachment'],'as':_0x7196('0x5f')}]});})['then'](function(_0x218396){_0x29ba1c[_0x7196('0x17')]=_0x218396;if(_0x29ba1c['interaction'][_0x7196('0x60')]){return db['User']['find']({'attributes':['id',_0x7196('0x61')],'where':{'id':_0x29ba1c[_0x7196('0x57')][_0x7196('0x60')]}})['then'](function(_0x423b83){if(_0x423b83){_0x29ba1c['applications'][_0x7196('0x62')]({'id':0x0,'priority':0x0,'app':_0x7196('0x63'),'appdata':_0x423b83[_0x7196('0x61')]+','+(_0x29ba1c[_0x7196('0x39')][_0x7196('0x64')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x7196('0x65'),_0x7196('0x66'),_0x29ba1c);});}return respondWithRpcPromise(_0x7196('0x65'),_0x7196('0x66'),_0x29ba1c);})[_0x7196('0xf')](function(_0x29bafd){_0x36a990(_0x29bafd);})[_0x7196('0x19')](function(_0x34633a){_0x2d13a5(_0x4c2341['error'](0x1f4,_0x34633a[_0x7196('0x17')]));});});}; \ No newline at end of file +var _0xd943=['MailServerOut','Smtp','CloudProvider','get','account','omit','smtpOptions','applications','list','asc','autoclose','close','Contacts','length','defaults','ListId','List\x20not\x20found','contact','messageId','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','create','spread','attach','interaction','created','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','MailAccount','findAll','options','where','attributes','limit','include','map','model','stringify','GetMailAccount','ShowMailAccount','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','isNil','from','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','List','DESC','MailApplication','Applications'];(function(_0x45411e,_0x5d799f){var _0x336b83=function(_0x4bf77b){while(--_0x4bf77b){_0x45411e['push'](_0x45411e['shift']());}};_0x336b83(++_0x5d799f);}(_0xd943,0x15d));var _0x3d94=function(_0x38146c,_0x1e36b2){_0x38146c=_0x38146c-0x0;var _0x11771f=_0xd943[_0x38146c];return _0x11771f;};'use strict';var _=require(_0x3d94('0x0'));var moment=require(_0x3d94('0x1'));var BPromise=require(_0x3d94('0x2'));var rs=require(_0x3d94('0x3'));var Redis=require('ioredis');var db=require(_0x3d94('0x4'))['db'];var logger=require(_0x3d94('0x5'))(_0x3d94('0x6'));var config=require(_0x3d94('0x7'));var jayson=require(_0x3d94('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x3d94('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3d94('0xa'))(new Redis(config[_0x3d94('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x3984a3,_0x27e381,_0x1cc58c){return new BPromise(function(_0x5908a7,_0x182066){return client['request'](_0x3984a3,_0x1cc58c)[_0x3d94('0xb')](function(_0x301536){logger['info'](_0x3d94('0xc'),_0x27e381,_0x3d94('0xd'));logger[_0x3d94('0xe')](_0x3d94('0xf'),_0x27e381,_0x3d94('0xd'),JSON['stringify'](_0x301536));if(_0x301536[_0x3d94('0x10')]){if(_0x301536[_0x3d94('0x10')][_0x3d94('0x11')]===0x1f4){logger['error'](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x182066(_0x301536['error'][_0x3d94('0x12')]);}logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);return _0x5908a7(_0x301536[_0x3d94('0x10')][_0x3d94('0x12')]);}else{logger[_0x3d94('0x13')]('MailAccount,\x20%s,\x20%s',_0x27e381,_0x3d94('0xd'));_0x5908a7(_0x301536[_0x3d94('0x14')][_0x3d94('0x12')]);}})[_0x3d94('0x15')](function(_0x4afc92){logger[_0x3d94('0x10')](_0x3d94('0xc'),_0x27e381,_0x4afc92);_0x182066(_0x4afc92);});});}exports['GetMailAccount']=function(_0x9bca24){var _0x59b741=this;return new Promise(function(_0x28bead,_0x193934){return db[_0x3d94('0x16')][_0x3d94('0x17')]({'raw':_0x9bca24[_0x3d94('0x18')]?_0x9bca24['options']['raw']===undefined?!![]:![]:!![],'where':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x9bca24['options']?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1a')]||null:null,'limit':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1b')]||null:null,'include':_0x9bca24[_0x3d94('0x18')]?_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x9bca24[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x192839){return{'model':db[_0x192839[_0x3d94('0x1e')]],'as':_0x192839['as'],'attributes':_0x192839[_0x3d94('0x1a')],'include':_0x192839[_0x3d94('0x1c')]?_['map'](_0x192839[_0x3d94('0x1c')],function(_0x558fd2){return{'model':db[_0x558fd2[_0x3d94('0x1e')]],'as':_0x558fd2['as'],'attributes':_0x558fd2[_0x3d94('0x1a')],'include':_0x558fd2[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x558fd2[_0x3d94('0x1c')],function(_0x82b568){return{'model':db[_0x82b568[_0x3d94('0x1e')]],'as':_0x82b568['as'],'attributes':_0x82b568['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x362642){logger['info']('GetMailAccount',_0x9bca24);logger[_0x3d94('0xe')]('GetMailAccount',_0x9bca24,JSON[_0x3d94('0x1f')](_0x362642));_0x28bead(_0x362642);})[_0x3d94('0x15')](function(_0x32403a){logger['error'](_0x3d94('0x20'),_0x32403a['message'],_0x9bca24);_0x193934(_0x59b741[_0x3d94('0x10')](0x1f4,_0x32403a['message']));});});};exports[_0x3d94('0x21')]=function(_0x215ad7){var _0x29b1ff=this;return new Promise(function(_0x246f88,_0x50560c){return db[_0x3d94('0x16')]['find']({'raw':_0x215ad7[_0x3d94('0x18')]?_0x215ad7[_0x3d94('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x215ad7['options']?_0x215ad7[_0x3d94('0x18')][_0x3d94('0x19')]||null:null,'attributes':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1a')]||null:null,'include':_0x215ad7[_0x3d94('0x18')]?_0x215ad7['options'][_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x215ad7[_0x3d94('0x18')][_0x3d94('0x1c')],function(_0x782c1){return{'model':db[_0x782c1['model']],'as':_0x782c1['as'],'attributes':_0x782c1[_0x3d94('0x1a')],'include':_0x782c1[_0x3d94('0x1c')]?_[_0x3d94('0x1d')](_0x782c1[_0x3d94('0x1c')],function(_0xb493f1){return{'model':db[_0xb493f1[_0x3d94('0x1e')]],'as':_0xb493f1['as'],'attributes':_0xb493f1['attributes'],'include':_0xb493f1['include']?_[_0x3d94('0x1d')](_0xb493f1[_0x3d94('0x1c')],function(_0x1c1b25){return{'model':db[_0x1c1b25[_0x3d94('0x1e')]],'as':_0x1c1b25['as'],'attributes':_0x1c1b25[_0x3d94('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3d94('0xb')](function(_0x2ef743){if(_0x215ad7[_0x3d94('0x18')][_0x3d94('0x22')]===!![])_0x2ef743[_0x3d94('0x23')]('smtpOptions',_0x2ef743[_0x3d94('0x24')]());logger[_0x3d94('0x13')](_0x3d94('0x21'),_0x215ad7);logger[_0x3d94('0xe')]('ShowMailAccount',_0x215ad7,JSON[_0x3d94('0x1f')](_0x2ef743));_0x246f88(_0x2ef743);})[_0x3d94('0x15')](function(_0x35e0e6){logger[_0x3d94('0x10')](_0x3d94('0x21'),_0x35e0e6['message'],_0x215ad7);_0x50560c(_0x29b1ff[_0x3d94('0x10')](0x1f4,_0x35e0e6[_0x3d94('0x12')]));});});};exports[_0x3d94('0x25')]=function(_0x485066){var _0x4eee4d=this;return new Promise(function(_0x4d8a8f,_0x47905e){var _0x3b3550={'body':_0x485066[_0x3d94('0x26')],'channel':_0x3d94('0x27')};var _0x146ccb=_[_0x3d94('0x28')](_[_0x3d94('0x29')](db[_0x3d94('0x2a')]['rawAttributes']),['createdAt',_0x3d94('0x2b'),_0x3d94('0x2c'),'ListId']);var _0x2d0aa2=![];if(_0x485066['body']['id']){delete _0x485066[_0x3d94('0x26')]['id'];}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'from\x20is\x20mandatory'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x26')])||_0x485066['body'][_0x3d94('0x26')]===''){return _0x47905e(_0x4eee4d['error'](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x3d94('0x2d')](_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x146ccb));}if(!_[_0x3d94('0x30')](_0x146ccb,_0x485066['body'][_0x3d94('0x2f')])){return _0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x3d94('0x31')+_0x146ccb));}var _0x15c8e7={};_0x15c8e7[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')]['from'];return db[_0x3d94('0x16')][_0x3d94('0x32')]({'where':{'id':_0x485066['account']['id']},'include':[{'model':db['CmList'],'as':_0x3d94('0x33'),'include':[{'model':db[_0x3d94('0x2a')],'as':'Contacts','where':_0x15c8e7,'limit':0x1,'order':[[_0x3d94('0x2b'),_0x3d94('0x34')]]}]},{'model':db[_0x3d94('0x35')],'as':_0x3d94('0x36')},{'model':db[_0x3d94('0x37')],'as':_0x3d94('0x38'),'include':[{'model':db[_0x3d94('0x39')],'as':_0x3d94('0x39')}]}]})[_0x3d94('0xb')](function(_0x2429bc){if(_0x2429bc&&_0x2429bc[_0x3d94('0x33')]){var _0x29682b=_0x2429bc[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x3b')]=_[_0x3d94('0x3c')](_0x29682b,['Applications',_0x3d94('0x33')]);_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x3d')]=_0x2429bc[_0x3d94('0x24')]();_0x3b3550[_0x3d94('0x3e')]=_0x29682b[_0x3d94('0x36')];_0x3b3550[_0x3d94('0x3f')]=_0x29682b[_0x3d94('0x33')];_0x3b3550[_0x3d94('0x3e')]=_['orderBy'](_0x3b3550[_0x3d94('0x3e')],['priority'],[_0x3d94('0x40')]);if(_0x3b3550[_0x3d94('0x3b')]&&_0x3b3550['account'][_0x3d94('0x41')]){_0x3b3550['applications']['push']({'id':0x0,'priority':_0x3b3550[_0x3d94('0x3e')]['length']+0x1,'app':_0x3d94('0x42'),'appdata':_0x3d94('0x41'),'interval':'*,*,*,*'});}if(_0x3b3550[_0x3d94('0x3b')]['Applications']){delete _0x3b3550['account'][_0x3d94('0x36')];}if(_0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')]){delete _0x3b3550[_0x3d94('0x3b')][_0x3d94('0x33')];}if(_0x29682b[_0x3d94('0x33')][_0x3d94('0x43')][_0x3d94('0x44')]){return _0x29682b[_0x3d94('0x33')]['Contacts'][0x0];}var _0x28cfbb=_[_0x3d94('0x45')](_0x485066[_0x3d94('0x26')],{'firstName':_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')],'ListId':_0x29682b[_0x3d94('0x46')]});_0x28cfbb[_0x485066[_0x3d94('0x26')][_0x3d94('0x2f')]]=_0x485066[_0x3d94('0x26')][_0x3d94('0x2e')];return db[_0x3d94('0x2a')]['create'](_0x28cfbb);}else{throw new Error(_0x3d94('0x47'));}})['then'](function(_0x709841){_0x3b3550[_0x3d94('0x48')]=_0x709841;if(_0x709841){if(!_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]){_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')]=rs[_0x3d94('0x4a')]()+'\x20'+_0x485066['body']['message'][_0x3d94('0x2e')];}var _0x4bd97c={'ContactId':_0x709841['id'],'MailAccountId':_0x485066[_0x3d94('0x3b')]['id'],'inReplyTo':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x49')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['attach'],'lastMsgAt':moment()[_0x3d94('0x4c')](_0x3d94('0x4d')),'lastMsgDirection':'in'};return db[_0x3d94('0x4e')][_0x3d94('0x32')]({'where':{'closed':![],'MailAccountId':_0x485066['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x3d94('0x4f'),'attributes':[_0x3d94('0x49')],'where':{'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['inReplyTo']}}]})[_0x3d94('0xb')](function(_0x1c99d1){if(_0x1c99d1){return[_0x1c99d1,![]];}return db['MailInteraction'][_0x3d94('0x50')](_0x4bd97c)[_0x3d94('0xb')](function(_0x336e36){return[_0x336e36,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x3d94('0x51')](function(_0x227372,_0x585531){if(_0x227372){_0x2d0aa2=_0x585531;if(!_0x585531){return _0x227372['update']({'inReplyTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['messageId'],'to':_0x485066['body']['message'][_0x3d94('0x2e')],'cc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['cc'],'subject':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['subject'],'attach':_0x227372[_0x3d94('0x52')]?_0x227372[_0x3d94('0x52')]:_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x52')],'substatus':null,'substatusAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x3d94('0x4c')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x227372;}}})[_0x3d94('0xb')](function(_0x41d561){_0x3b3550[_0x3d94('0x53')]=_0x41d561[_0x3d94('0x3a')]({'plain':!![]});_0x3b3550[_0x3d94('0x53')][_0x3d94('0x54')]=_0x2d0aa2;return db['MailMessage']['create']({'body':_0x485066[_0x3d94('0x26')]['body'],'MailAccountId':_0x485066['account']['id'],'MailInteractionId':_0x41d561['id'],'direction':'in','ContactId':_0x3b3550['contact']['id'],'messageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x49')],'from':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x2e')],'to':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['to'],'cc':_0x485066['body'][_0x3d94('0x12')]['cc'],'subject':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x4b')],'attach':_0x485066[_0x3d94('0x26')]['message']['attach'],'Attachments':_0x485066['body'][_0x3d94('0x12')][_0x3d94('0x55')],'originTo':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x56')],'originCc':_0x485066['body']['message'][_0x3d94('0x57')],'bcc':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')]['bcc'],'ChatWebsiteId':_0x485066[_0x3d94('0x26')]['message'][_0x3d94('0x58')]||null,'originChannel':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x59')]||_0x3d94('0x5a'),'ChatOfflineMessageId':_0x485066[_0x3d94('0x26')][_0x3d94('0x12')][_0x3d94('0x5b')]||null},{'include':[{'model':db[_0x3d94('0x5c')],'as':_0x3d94('0x5d')}]});})[_0x3d94('0xb')](function(_0xe6cfd1){_0x3b3550[_0x3d94('0x12')]=_0xe6cfd1;if(_0x3b3550['interaction'][_0x3d94('0x5e')]){return db[_0x3d94('0x5f')][_0x3d94('0x32')]({'attributes':['id',_0x3d94('0x60')],'where':{'id':_0x3b3550['interaction'][_0x3d94('0x5e')]}})['then'](function(_0x4f217f){if(_0x4f217f){_0x3b3550[_0x3d94('0x3e')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3d94('0x61'),'appdata':_0x4f217f[_0x3d94('0x60')]+','+(_0x3b3550['account'][_0x3d94('0x62')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x3d94('0x63'),_0x3d94('0x64'),_0x3b3550);});}return respondWithRpcPromise('Start','startRouting',_0x3b3550);})['then'](function(_0x833d96){_0x4d8a8f(_0x833d96);})['catch'](function(_0x5a8114){_0x47905e(_0x4eee4d[_0x3d94('0x10')](0x1f4,_0x5a8114[_0x3d94('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 7f6a863..9642a88 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 _0x5d6f=['removeListener','register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x22ba1a,_0x477ca4){var _0x4af049=function(_0x50509b){while(--_0x50509b){_0x22ba1a['push'](_0x22ba1a['shift']());}};_0x4af049(++_0x477ca4);}(_0x5d6f,0x1d8));var _0xf5d6=function(_0x5a2d98,_0x1ddeeb){_0x5a2d98=_0x5a2d98-0x0;var _0x4a159f=_0x5d6f[_0x5a2d98];return _0x4a159f;};'use strict';var MailAccountEvents=require(_0xf5d6('0x0'));var events=[_0xf5d6('0x1'),_0xf5d6('0x2'),_0xf5d6('0x3')];function createListener(_0x3f3ce7,_0x2b5943){return function(_0x517458){_0x2b5943[_0xf5d6('0x4')](_0x3f3ce7,_0x517458);};}function removeListener(_0xa760b4,_0x12d2cc){return function(){MailAccountEvents[_0xf5d6('0x5')](_0xa760b4,_0x12d2cc);};}exports[_0xf5d6('0x6')]=function(_0x224c7c){for(var _0x3438d0=0x0,_0x2759e4=events[_0xf5d6('0x7')];_0x3438d0<_0x2759e4;_0x3438d0++){var _0x4b21bc=events[_0x3438d0];var _0x3ab16a=createListener(_0xf5d6('0x8')+_0x4b21bc,_0x224c7c);MailAccountEvents['on'](_0x4b21bc,_0x3ab16a);}}; \ No newline at end of file +var _0x0ca8=['removeListener','register','./mailAccount.events','save','update','emit'];(function(_0x3443d3,_0xf1bb82){var _0x3de675=function(_0x3d4692){while(--_0x3d4692){_0x3443d3['push'](_0x3443d3['shift']());}};_0x3de675(++_0xf1bb82);}(_0x0ca8,0xe6));var _0x80ca=function(_0x5779c1,_0x710575){_0x5779c1=_0x5779c1-0x0;var _0x53ec55=_0x0ca8[_0x5779c1];return _0x53ec55;};'use strict';var MailAccountEvents=require(_0x80ca('0x0'));var events=[_0x80ca('0x1'),'remove',_0x80ca('0x2')];function createListener(_0x38e8be,_0x495e30){return function(_0x263c00){_0x495e30[_0x80ca('0x3')](_0x38e8be,_0x263c00);};}function removeListener(_0x8b7cab,_0x2f9379){return function(){MailAccountEvents[_0x80ca('0x4')](_0x8b7cab,_0x2f9379);};}exports[_0x80ca('0x5')]=function(_0x19a21c){for(var _0x4ad6ad=0x0,_0x1c98e5=events['length'];_0x4ad6ad<_0x1c98e5;_0x4ad6ad++){var _0x9881d8=events[_0x4ad6ad];var _0x52aac6=createListener('mailAccount:'+_0x9881d8,_0x19a21c);MailAccountEvents['on'](_0x9881d8,_0x52aac6);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 9ee4879..5e6dcfa 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 _0x6409=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','/:id','isAuthenticated','update','delete','exports','multer','util','path','express'];(function(_0x19eff5,_0x4499b0){var _0x189cd3=function(_0x5bf9c9){while(--_0x5bf9c9){_0x19eff5['push'](_0x19eff5['shift']());}};_0x189cd3(++_0x4499b0);}(_0x6409,0x19c));var _0x9640=function(_0x33300d,_0x5b632a){_0x33300d=_0x33300d-0x0;var _0x4db2ed=_0x6409[_0x33300d];return _0x4db2ed;};'use strict';var multer=require(_0x9640('0x0'));var util=require(_0x9640('0x1'));var path=require(_0x9640('0x2'));var timeout=require('connect-timeout');var express=require(_0x9640('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9640('0x4'));var interaction=require(_0x9640('0x5'));var config=require(_0x9640('0x6'));var controller=require(_0x9640('0x7'));router['get'](_0x9640('0x8'),auth[_0x9640('0x9')](),controller['show']);router['put'](_0x9640('0x8'),auth[_0x9640('0x9')](),controller[_0x9640('0xa')]);router[_0x9640('0xb')](_0x9640('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x9640('0xc')]=router; \ No newline at end of file +var _0x128e=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','show','put','/:id','isAuthenticated','update','delete','destroy','exports','multer','util','path'];(function(_0x22e2c0,_0x7d75b9){var _0x2dbcfb=function(_0x515705){while(--_0x515705){_0x22e2c0['push'](_0x22e2c0['shift']());}};_0x2dbcfb(++_0x7d75b9);}(_0x128e,0x179));var _0xe128=function(_0x33bb77,_0x8d0630){_0x33bb77=_0x33bb77-0x0;var _0x201d14=_0x128e[_0x33bb77];return _0x201d14;};'use strict';var multer=require(_0xe128('0x0'));var util=require(_0xe128('0x1'));var path=require(_0xe128('0x2'));var timeout=require(_0xe128('0x3'));var express=require(_0xe128('0x4'));var router=express[_0xe128('0x5')]();var fs_extra=require(_0xe128('0x6'));var auth=require(_0xe128('0x7'));var interaction=require(_0xe128('0x8'));var config=require(_0xe128('0x9'));var controller=require(_0xe128('0xa'));router[_0xe128('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe128('0xc')]);router[_0xe128('0xd')](_0xe128('0xe'),auth[_0xe128('0xf')](),controller[_0xe128('0x10')]);router[_0xe128('0x11')](_0xe128('0xe'),auth[_0xe128('0xf')](),controller[_0xe128('0x12')]);module[_0xe128('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index e1ca84b..659903d 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 _0x2641=['STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x34bbc3,_0x23fa64){var _0x263a12=function(_0x274969){while(--_0x274969){_0x34bbc3['push'](_0x34bbc3['shift']());}};_0x263a12(++_0x23fa64);}(_0x2641,0xd0));var _0x1264=function(_0x32b4b3,_0x485040){_0x32b4b3=_0x32b4b3-0x0;var _0x291048=_0x2641[_0x32b4b3];return _0x291048;};'use strict';var Sequelize=require(_0x1264('0x0'));module[_0x1264('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x1264('0x2')],'allowNull':![],'defaultValue':_0x1264('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x1264('0x2')]},'interval':{'type':Sequelize[_0x1264('0x2')],'defaultValue':_0x1264('0x4')}}; \ No newline at end of file +var _0xcb1e=['sequelize','noop','TEXT','STRING','*,*,*,*'];(function(_0x334d1e,_0x28a488){var _0x3b33ba=function(_0x25afca){while(--_0x25afca){_0x334d1e['push'](_0x334d1e['shift']());}};_0x3b33ba(++_0x28a488);}(_0xcb1e,0x1b8));var _0xecb1=function(_0x30f5bb,_0x4db4bd){_0x30f5bb=_0x30f5bb-0x0;var _0x1cfc00=_0xcb1e[_0x30f5bb];return _0x1cfc00;};'use strict';var Sequelize=require(_0xecb1('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xecb1('0x1')},'appdata':{'type':Sequelize[_0xecb1('0x2')]()},'description':{'type':Sequelize[_0xecb1('0x3')]},'interval':{'type':Sequelize[_0xecb1('0x3')],'defaultValue':_0xecb1('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 9de266a..51ee18f 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 _0xa9e0=['includeAll','merge','options','find','catch','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x291324,_0x252b89){var _0x404cd9=function(_0x4f8e93){while(--_0x4f8e93){_0x291324['push'](_0x291324['shift']());}};_0x404cd9(++_0x252b89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file +var _0xedd9=['query','filters','intersection','model','attributes','fields','length','includeAll','include','merge','options','find','catch','update','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','show','params','keys','MailApplication','rawAttributes'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d035b,_0x22e9d3){_0x5d035b=_0x5d035b-0x0;var _0x3b538a=_0xedd9[_0x5d035b];return _0x3b538a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={'raw':!![],'where':{'id':_0x52746a[_0x9edd('0x27')]['id']}},_0x2ae8dd={};_0x2ae8dd['model']=_[_0x9edd('0x28')](db[_0x9edd('0x29')][_0x9edd('0x2a')]);_0x2ae8dd[_0x9edd('0x2b')]=_[_0x9edd('0x28')](_0x52746a[_0x9edd('0x2b')]);_0x2ae8dd[_0x9edd('0x2c')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],_0x2ae8dd[_0x9edd('0x2b')]);_0x28cfae[_0x9edd('0x2f')]=_[_0x9edd('0x2d')](_0x2ae8dd[_0x9edd('0x2e')],qs[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2b')]['fields']));_0x28cfae[_0x9edd('0x2f')]=_0x28cfae[_0x9edd('0x2f')][_0x9edd('0x31')]?_0x28cfae['attributes']:_0x2ae8dd[_0x9edd('0x2e')];if(_0x52746a[_0x9edd('0x2b')][_0x9edd('0x32')]){_0x28cfae[_0x9edd('0x33')]=[{'all':!![]}];}_0x28cfae=_[_0x9edd('0x34')]({},_0x28cfae,_0x52746a[_0x9edd('0x35')]);return db[_0x9edd('0x29')][_0x9edd('0x36')](_0x28cfae)[_0x9edd('0x21')](handleEntityNotFound(_0x238b22,null))[_0x9edd('0x21')](respondWithResult(_0x238b22,null))[_0x9edd('0x37')](handleError(_0x238b22,null));};exports[_0x9edd('0x38')]=function(_0x27eb7e,_0x14f780){if(_0x27eb7e['body']['id']){delete _0x27eb7e[_0x9edd('0x39')]['id'];}return db['MailApplication'][_0x9edd('0x36')]({'where':{'id':_0x27eb7e[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x14f780,null))[_0x9edd('0x21')](saveUpdates(_0x27eb7e[_0x9edd('0x39')],null))['then'](respondWithResult(_0x14f780,null))[_0x9edd('0x37')](handleError(_0x14f780,null));};exports[_0x9edd('0x3a')]=function(_0x2b3469,_0x38e9be){return db[_0x9edd('0x29')][_0x9edd('0x36')]({'where':{'id':_0x2b3469[_0x9edd('0x27')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x38e9be,null))[_0x9edd('0x21')](removeEntity(_0x38e9be,null))[_0x9edd('0x37')](handleError(_0x38e9be,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 57436c2..9ab385f 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 _0x4201=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','rimraf','./mailApplication.attributes','exports','MailApplication'];(function(_0xe6967a,_0x4cd660){var _0x1547c0=function(_0x789c9c){while(--_0x789c9c){_0xe6967a['push'](_0xe6967a['shift']());}};_0x1547c0(++_0x4cd660);}(_0x4201,0x1ce));var _0x1420=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x4201[_0x912d27];return _0x31b918;};'use strict';var _=require(_0x1420('0x0'));var util=require(_0x1420('0x1'));var logger=require(_0x1420('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1420('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1420('0x4'));var config=require('../../config/environment');var attributes=require(_0x1420('0x5'));module[_0x1420('0x6')]=function(_0x37a985,_0xb458de){return _0x37a985['define'](_0x1420('0x7'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1420('0x8'),'collate':_0x1420('0x9')});}; \ No newline at end of file +var _0xe67f=['../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','path','rimraf'];(function(_0x54cfae,_0x166257){var _0x55af19=function(_0x19201e){while(--_0x19201e){_0x54cfae['push'](_0x54cfae['shift']());}};_0x55af19(++_0x166257);}(_0xe67f,0xf1));var _0xfe67=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe67f[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xfe67('0x0'));var util=require(_0xfe67('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xfe67('0x2'));var rp=require(_0xfe67('0x3'));var fs=require('fs');var path=require(_0xfe67('0x4'));var rimraf=require(_0xfe67('0x5'));var config=require(_0xfe67('0x6'));var attributes=require(_0xfe67('0x7'));module[_0xfe67('0x8')]=function(_0x2c11e0,_0x1f3e9d){return _0x2c11e0[_0xfe67('0x9')](_0xfe67('0xa'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe67('0xb'),'collate':_0xfe67('0xc')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6b1b67d..9a4e975 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 _0x51f9=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','attributes','lodash','util','bluebird','randomstring'];(function(_0x4de3d2,_0x2dc474){var _0x4a02e2=function(_0x244f67){while(--_0x244f67){_0x4de3d2['push'](_0x4de3d2['shift']());}};_0x4a02e2(++_0x2dc474);}(_0x51f9,0x132));var _0x951f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x51f9[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x951f('0x0'));var util=require(_0x951f('0x1'));var moment=require('moment');var BPromise=require(_0x951f('0x2'));var rs=require(_0x951f('0x3'));var fs=require('fs');var Redis=require(_0x951f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x951f('0x5'));var logger=require(_0x951f('0x6'))(_0x951f('0x7'));var config=require(_0x951f('0x8'));var jayson=require(_0x951f('0x9'));var client=jayson[_0x951f('0xa')][_0x951f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4aca31,_0x2b3eb2,_0x1ad764){return new BPromise(function(_0x1c8fc1,_0x347c9c){return client[_0x951f('0xc')](_0x4aca31,_0x1ad764)[_0x951f('0xd')](function(_0x3c5518){logger[_0x951f('0xe')](_0x951f('0xf'),_0x2b3eb2,_0x951f('0x10'));logger[_0x951f('0x11')](_0x951f('0x12'),_0x2b3eb2,_0x951f('0x10'),JSON[_0x951f('0x13')](_0x3c5518));if(_0x3c5518[_0x951f('0x14')]){if(_0x3c5518[_0x951f('0x14')]['code']===0x1f4){logger['error'](_0x951f('0xf'),_0x2b3eb2,_0x3c5518[_0x951f('0x14')][_0x951f('0x15')]);return _0x347c9c(_0x3c5518['error'][_0x951f('0x15')]);}logger['error'](_0x951f('0xf'),_0x2b3eb2,_0x3c5518[_0x951f('0x14')][_0x951f('0x15')]);return _0x1c8fc1(_0x3c5518[_0x951f('0x14')][_0x951f('0x15')]);}else{logger['info'](_0x951f('0xf'),_0x2b3eb2,_0x951f('0x10'));_0x1c8fc1(_0x3c5518[_0x951f('0x16')][_0x951f('0x15')]);}})[_0x951f('0x17')](function(_0x1aba07){logger[_0x951f('0x14')](_0x951f('0xf'),_0x2b3eb2,_0x1aba07);_0x347c9c(_0x1aba07);});});}exports[_0x951f('0x18')]=function(_0x43b0f4){var _0x21f443=this;return new Promise(function(_0x7b3d7b,_0x5da2ba){return db[_0x951f('0x19')][_0x951f('0x1a')](_0x43b0f4[_0x951f('0x1b')],{'raw':_0x43b0f4[_0x951f('0x1c')]?_0x43b0f4[_0x951f('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43b0f4[_0x951f('0x1c')]?_0x43b0f4['options'][_0x951f('0x1d')]||null:null,'attributes':_0x43b0f4[_0x951f('0x1c')]?_0x43b0f4['options'][_0x951f('0x1e')]||null:null,'limit':_0x43b0f4[_0x951f('0x1c')]?_0x43b0f4[_0x951f('0x1c')]['limit']||null:null})[_0x951f('0xd')](function(_0x1bd0cd){logger['info']('UpdateMailApplication',_0x43b0f4);logger[_0x951f('0x11')](_0x951f('0x18'),_0x43b0f4,JSON[_0x951f('0x13')](_0x1bd0cd));_0x7b3d7b(_0x1bd0cd);})[_0x951f('0x17')](function(_0x2840f2){logger['error']('UpdateMailApplication',_0x2840f2[_0x951f('0x15')],_0x43b0f4);_0x5da2ba(_0x21f443[_0x951f('0x14')](0x1f4,_0x2840f2['message']));});});}; \ No newline at end of file +var _0x8da8=['then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','UpdateMailApplication','update','body','raw','options','where','attributes','limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5d416e,_0x3bb9ba){var _0x31b4b2=function(_0x4e2902){while(--_0x4e2902){_0x5d416e['push'](_0x5d416e['shift']());}};_0x31b4b2(++_0x3bb9ba);}(_0x8da8,0x187));var _0x88da=function(_0xd80868,_0x3e3f3b){_0xd80868=_0xd80868-0x0;var _0x2aaac0=_0x8da8[_0xd80868];return _0x2aaac0;};'use strict';var _=require(_0x88da('0x0'));var util=require(_0x88da('0x1'));var moment=require(_0x88da('0x2'));var BPromise=require(_0x88da('0x3'));var rs=require(_0x88da('0x4'));var fs=require('fs');var Redis=require(_0x88da('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x88da('0x6'));var logger=require(_0x88da('0x7'))(_0x88da('0x8'));var config=require(_0x88da('0x9'));var jayson=require(_0x88da('0xa'));var client=jayson[_0x88da('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6baa96,_0x33e3be,_0x3de109){return new BPromise(function(_0x3b2868,_0x58a969){return client['request'](_0x6baa96,_0x3de109)[_0x88da('0xc')](function(_0x10db86){logger[_0x88da('0xd')](_0x88da('0xe'),_0x33e3be,_0x88da('0xf'));logger[_0x88da('0x10')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x33e3be,_0x88da('0xf'),JSON[_0x88da('0x11')](_0x10db86));if(_0x10db86['error']){if(_0x10db86[_0x88da('0x12')][_0x88da('0x13')]===0x1f4){logger[_0x88da('0x12')](_0x88da('0xe'),_0x33e3be,_0x10db86['error'][_0x88da('0x14')]);return _0x58a969(_0x10db86['error']['message']);}logger['error'](_0x88da('0xe'),_0x33e3be,_0x10db86[_0x88da('0x12')][_0x88da('0x14')]);return _0x3b2868(_0x10db86[_0x88da('0x12')]['message']);}else{logger[_0x88da('0xd')]('MailApplication,\x20%s,\x20%s',_0x33e3be,'request\x20sent');_0x3b2868(_0x10db86[_0x88da('0x15')][_0x88da('0x14')]);}})['catch'](function(_0x4d9ffd){logger[_0x88da('0x12')](_0x88da('0xe'),_0x33e3be,_0x4d9ffd);_0x58a969(_0x4d9ffd);});});}exports[_0x88da('0x16')]=function(_0x5d1932){var _0x20b272=this;return new Promise(function(_0xa20d60,_0x31891f){return db['MailApplication'][_0x88da('0x17')](_0x5d1932[_0x88da('0x18')],{'raw':_0x5d1932['options']?_0x5d1932['options'][_0x88da('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d1932[_0x88da('0x1a')]?_0x5d1932[_0x88da('0x1a')][_0x88da('0x1b')]||null:null,'attributes':_0x5d1932['options']?_0x5d1932[_0x88da('0x1a')][_0x88da('0x1c')]||null:null,'limit':_0x5d1932[_0x88da('0x1a')]?_0x5d1932[_0x88da('0x1a')][_0x88da('0x1d')]||null:null})[_0x88da('0xc')](function(_0x3f173b){logger[_0x88da('0xd')](_0x88da('0x16'),_0x5d1932);logger['debug'](_0x88da('0x16'),_0x5d1932,JSON[_0x88da('0x11')](_0x3f173b));_0xa20d60(_0x3f173b);})[_0x88da('0x1e')](function(_0x1e266e){logger['error'](_0x88da('0x16'),_0x1e266e[_0x88da('0x14')],_0x5d1932);_0x31891f(_0x20b272[_0x88da('0x12')](0x1f4,_0x1e266e[_0x88da('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 8d41f83..d16df28 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 _0x791f=['mail','addTags','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','/:id/tags','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','getMessages','/:id/download','download','post','addMessage'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x791f,0x118));var _0xf791=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0x791f[_0x541a67];return _0x45da2a;};'use strict';var express=require(_0xf791('0x0'));var router=express[_0xf791('0x1')]();var auth=require(_0xf791('0x2'));var interaction=require(_0xf791('0x3'));var controller=require('./mailInteraction.controller');router[_0xf791('0x4')]('/',auth['isAuthenticated'](),controller[_0xf791('0x5')]);router[_0xf791('0x4')](_0xf791('0x6'),auth['isAuthenticated'](),controller[_0xf791('0x7')]);router[_0xf791('0x4')](_0xf791('0x8'),auth[_0xf791('0x9')](),controller[_0xf791('0xa')]);router[_0xf791('0x4')](_0xf791('0xb'),auth[_0xf791('0x9')](),controller[_0xf791('0xc')]);router['get'](_0xf791('0xd'),auth[_0xf791('0x9')](),controller[_0xf791('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xf791('0xf')]('/:id/messages',auth[_0xf791('0x9')](),controller[_0xf791('0x10')]);router['post']('/:id/tags',auth['isAuthenticated'](),interaction['tracked'](_0xf791('0x11'),'mailinteraction:addtags'),controller[_0xf791('0x12')]);router['put'](_0xf791('0x8'),auth[_0xf791('0x9')](),interaction[_0xf791('0x13')](_0xf791('0x11'),_0xf791('0x14')),controller[_0xf791('0x15')]);router[_0xf791('0x16')](_0xf791('0x8'),auth[_0xf791('0x9')](),interaction['tracked'](_0xf791('0x11'),_0xf791('0x17')),controller[_0xf791('0x18')]);router[_0xf791('0x16')](_0xf791('0x19'),auth['isAuthenticated'](),controller['removeTags']);module[_0xf791('0x1a')]=router; \ No newline at end of file +var _0x366a=['index','describe','/:id','isAuthenticated','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','addTags','put','mail','mailinteraction:update','mailinteraction:destroy','delete','removeTags','exports','express','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x366a,0xcb));var _0xa366=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x366a[_0x265003];return _0x33c743;};'use strict';var express=require(_0xa366('0x0'));var router=express['Router']();var auth=require(_0xa366('0x1'));var interaction=require(_0xa366('0x2'));var controller=require(_0xa366('0x3'));router[_0xa366('0x4')]('/',auth['isAuthenticated'](),controller[_0xa366('0x5')]);router[_0xa366('0x4')]('/describe',auth['isAuthenticated'](),controller[_0xa366('0x6')]);router['get'](_0xa366('0x7'),auth[_0xa366('0x8')](),controller[_0xa366('0x9')]);router['get']('/:id/messages',auth[_0xa366('0x8')](),controller[_0xa366('0xa')]);router[_0xa366('0x4')](_0xa366('0xb'),auth[_0xa366('0x8')](),controller[_0xa366('0xc')]);router[_0xa366('0xd')]('/',auth[_0xa366('0x8')](),controller[_0xa366('0xe')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xa366('0xf')]);router[_0xa366('0xd')](_0xa366('0x10'),auth[_0xa366('0x8')](),interaction[_0xa366('0x11')]('mail','mailinteraction:addtags'),controller[_0xa366('0x12')]);router[_0xa366('0x13')]('/:id',auth[_0xa366('0x8')](),interaction[_0xa366('0x11')](_0xa366('0x14'),_0xa366('0x15')),controller['update']);router['delete'](_0xa366('0x7'),auth[_0xa366('0x8')](),interaction[_0xa366('0x11')](_0xa366('0x14'),_0xa366('0x16')),controller['destroy']);router[_0xa366('0x17')](_0xa366('0x10'),auth[_0xa366('0x8')](),controller[_0xa366('0x18')]);module[_0xa366('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3cead9e..69420d3 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 _0x4e3d=['out','BOOLEAN','sequelize','iconv','DATE','STRING','TEXT','long','ENUM'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0x4e3d,0x12b));var _0xd4e3=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4e3d[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xd4e3('0x0'));var iconv=require(_0xd4e3('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd4e3('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd4e3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd4e3('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0xd4e3('0x3')]},'cc':{'type':Sequelize[_0xd4e3('0x4')](_0xd4e3('0x5'))},'subject':{'type':Sequelize[_0xd4e3('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xd4e3('0x2')]},'substatus':{'type':Sequelize[_0xd4e3('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0xd4e3('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xd4e3('0x6')]('in',_0xd4e3('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd4e3('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xd4e3('0x6')]('in',_0xd4e3('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd4e3('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x6e1f=['DATE','STRING','long','TEXT','ENUM','out','exports'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x6e1f,0x110));var _0xf6e1=function(_0x6aa5ba,_0x45cee1){_0x6aa5ba=_0x6aa5ba-0x0;var _0x523eb8=_0x6e1f[_0x6aa5ba];return _0x523eb8;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0xf6e1('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf6e1('0x1')]},'disposition':{'type':Sequelize[_0xf6e1('0x2')]},'secondDisposition':{'type':Sequelize[_0xf6e1('0x2')]},'thirdDisposition':{'type':Sequelize[_0xf6e1('0x2')]},'note':{'type':Sequelize[_0xf6e1('0x2')]},'inReplyTo':{'type':Sequelize[_0xf6e1('0x2')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0xf6e1('0x3'))},'subject':{'type':Sequelize[_0xf6e1('0x4')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xf6e1('0x1')]},'substatus':{'type':Sequelize[_0xf6e1('0x2')](0x3c)},'substatusAt':{'type':Sequelize[_0xf6e1('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xf6e1('0x5')]('in',_0xf6e1('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf6e1('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xf6e1('0x5')]('in',_0xf6e1('0x6')),'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 f3b1a1b..32d35a6 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 _0x3fb9=['./mailInteraction.socket','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','findAll','mail','query','user','catch','show','params','keys','filters','intersection','fields','attributes','length','model','includeAll','include','merge','options','MailInteraction','find','create','body','update','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','true','rows','addTags','Tag','color','mailInteractionTags:save','removeTags','download','files','tmp','root','server','attachments','transcript-%d-%s.zip','join','Attachment','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','push','type','readFileSync','writeFileSync','message%d.eml','eml-format','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','socket.io-emitter'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3fb9,0x1b0));var _0x93fb=function(_0x5ba491,_0x9cedc4){_0x5ba491=_0x5ba491-0x0;var _0x51bdfd=_0x3fb9[_0x5ba491];return _0x51bdfd;};'use strict';var emlformat=require(_0x93fb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x93fb('0x1'));var util=require('util');var path=require(_0x93fb('0x2'));var fs=require('fs');var _=require(_0x93fb('0x3'));var juice=require(_0x93fb('0x4'));var Redis=require(_0x93fb('0x5'));var interaction=require(_0x93fb('0x6'));var qs=require(_0x93fb('0x7'));var logger=require(_0x93fb('0x8'))('api');var config=require(_0x93fb('0x9'));var db=require(_0x93fb('0xa'))['db'];var htmlEntities=require(_0x93fb('0xb'));config[_0x93fb('0xc')]=_[_0x93fb('0xd')](config[_0x93fb('0xc')],{'host':_0x93fb('0xe'),'port':0x18eb});var socket=require(_0x93fb('0xf'))(new Redis(config[_0x93fb('0xc')]));require(_0x93fb('0x10'))['register'](socket);function respondWithStatusCode(_0x17638d,_0x23700a){_0x23700a=_0x23700a||0xcc;return function(_0x3f9b0a){if(_0x3f9b0a){return _0x17638d[_0x93fb('0x11')](_0x23700a);}return _0x17638d['status'](_0x23700a)[_0x93fb('0x12')]();};}function respondWithResult(_0x4c0e9e,_0x4387ee){_0x4387ee=_0x4387ee||0xc8;return function(_0xa3c194){if(_0xa3c194){return _0x4c0e9e[_0x93fb('0x13')](_0x4387ee)[_0x93fb('0x14')](_0xa3c194);}};}function respondWithFilteredResult(_0x35bccd,_0xd5c7fd){return function(_0xd84247){if(_0xd84247){var _0x569ffe=typeof _0xd5c7fd['offset']===_0x93fb('0x15')&&typeof _0xd5c7fd['limit']===_0x93fb('0x15');var _0x531239=_0xd84247['count'];var _0x388773=_0x569ffe?0x0:_0xd5c7fd[_0x93fb('0x16')];var _0x52aa2c=_0x569ffe?_0xd84247[_0x93fb('0x17')]:_0xd5c7fd['offset']+_0xd5c7fd[_0x93fb('0x18')];var _0x21cbb7;if(_0x52aa2c>=_0x531239){_0x52aa2c=_0x531239;_0x21cbb7=0xc8;}else{_0x21cbb7=0xce;}_0x35bccd[_0x93fb('0x13')](_0x21cbb7);return _0x35bccd[_0x93fb('0x19')](_0x93fb('0x1a'),_0x388773+'-'+_0x52aa2c+'/'+_0x531239)[_0x93fb('0x14')](_0xd84247);}return null;};}function saveUpdates(_0x3ea1e5){return function(_0x20d973){if(_0x20d973){return _0x20d973['update'](_0x3ea1e5)[_0x93fb('0x1b')](function(_0x244b69){return _0x244b69;});}return null;};}function removeEntity(_0x3b76f3){return function(_0x484155){if(_0x484155){return _0x484155[_0x93fb('0x1c')]()[_0x93fb('0x1b')](function(){_0x3b76f3[_0x93fb('0x13')](0xcc)[_0x93fb('0x12')]();});}};}function handleEntityNotFound(_0x4ad104){return function(_0xcb76a6){if(!_0xcb76a6){_0x4ad104[_0x93fb('0x11')](0x194);}return _0xcb76a6;};}function handleError(_0x5b2cd8,_0x2643a7){_0x2643a7=_0x2643a7||0x1f4;return function(_0x28d4ff){logger[_0x93fb('0x1d')](_0x28d4ff[_0x93fb('0x1e')]);if(_0x28d4ff[_0x93fb('0x1f')]){delete _0x28d4ff[_0x93fb('0x1f')];}_0x5b2cd8['status'](_0x2643a7)[_0x93fb('0x20')](_0x28d4ff);};}exports['index']=function(_0x316151,_0x16aa81){var _0x35660d={};var _0x4cea5b=_[_0x93fb('0x21')](db['MailInteraction'][_0x93fb('0x22')],function(_0x23d626){return{'name':_0x23d626[_0x93fb('0x23')],'type':_0x23d626['type']['key']};});_0x35660d=qs['getOptions'](_0x4cea5b,_0x316151);return interaction[_0x93fb('0x24')](_0x93fb('0x25'),_0x316151[_0x93fb('0x26')],_0x316151[_0x93fb('0x27')],_0x35660d,_0x4cea5b)[_0x93fb('0x1b')](respondWithFilteredResult(_0x16aa81,_0x35660d))[_0x93fb('0x28')](handleError(_0x16aa81,null));};exports[_0x93fb('0x29')]=function(_0x2a2de4,_0x306582){var _0x4172f6={'raw':![],'where':{'id':_0x2a2de4[_0x93fb('0x2a')]['id']}},_0xaf09e7={};_0xaf09e7['model']=_[_0x93fb('0x2b')](db['MailInteraction'][_0x93fb('0x22')]);_0xaf09e7['query']=_[_0x93fb('0x2b')](_0x2a2de4[_0x93fb('0x26')]);_0xaf09e7[_0x93fb('0x2c')]=_[_0x93fb('0x2d')](_0xaf09e7['model'],_0xaf09e7['query']);_0x4172f6['attributes']=_[_0x93fb('0x2d')](_0xaf09e7['model'],qs[_0x93fb('0x2e')](_0x2a2de4[_0x93fb('0x26')][_0x93fb('0x2e')]));_0x4172f6[_0x93fb('0x2f')]=_0x4172f6[_0x93fb('0x2f')][_0x93fb('0x30')]?_0x4172f6[_0x93fb('0x2f')]:_0xaf09e7[_0x93fb('0x31')];if(_0x2a2de4[_0x93fb('0x26')][_0x93fb('0x32')]){_0x4172f6[_0x93fb('0x33')]=[{'all':!![]}];}_0x4172f6=_[_0x93fb('0x34')]({},_0x4172f6,_0x2a2de4[_0x93fb('0x35')]);return db[_0x93fb('0x36')][_0x93fb('0x37')](_0x4172f6)[_0x93fb('0x1b')](handleEntityNotFound(_0x306582,null))[_0x93fb('0x1b')](respondWithResult(_0x306582,null))[_0x93fb('0x28')](handleError(_0x306582,null));};exports[_0x93fb('0x38')]=function(_0x5da17d,_0x5beda0){return db[_0x93fb('0x36')][_0x93fb('0x38')](_0x5da17d[_0x93fb('0x39')],{})[_0x93fb('0x1b')](respondWithResult(_0x5beda0,0xc9))['catch'](handleError(_0x5beda0,null));};exports[_0x93fb('0x3a')]=function(_0x489260,_0x7a9ce4){if(_0x489260[_0x93fb('0x39')]['id']){delete _0x489260['body']['id'];}return db[_0x93fb('0x36')][_0x93fb('0x37')]({'where':{'id':_0x489260['params']['id']}})['then'](handleEntityNotFound(_0x7a9ce4,null))['then'](saveUpdates(_0x489260[_0x93fb('0x39')],null))[_0x93fb('0x1b')](respondWithResult(_0x7a9ce4,null))[_0x93fb('0x28')](handleError(_0x7a9ce4,null));};exports[_0x93fb('0x1c')]=function(_0x135df9,_0x28b730){return db[_0x93fb('0x36')][_0x93fb('0x37')]({'where':{'id':_0x135df9[_0x93fb('0x2a')]['id']}})[_0x93fb('0x1b')](handleEntityNotFound(_0x28b730,null))[_0x93fb('0x1b')](removeEntity(_0x28b730,null))['catch'](handleError(_0x28b730,null));};exports[_0x93fb('0x3b')]=function(_0x121094,_0x57cc45){return db[_0x93fb('0x36')][_0x93fb('0x3b')]()[_0x93fb('0x1b')](respondWithResult(_0x57cc45,null))[_0x93fb('0x28')](handleError(_0x57cc45,null));};exports[_0x93fb('0x3c')]=function(_0x3d8777,_0x781ab){return db[_0x93fb('0x3d')][_0x93fb('0x37')]({'where':{'id':_0x3d8777[_0x93fb('0x2a')]['id']}})['then'](handleEntityNotFound(_0x781ab,null))[_0x93fb('0x1b')](function(_0x332f85){if(_0x332f85){return _0x332f85['addMessage'](_0x3d8777[_0x93fb('0x39')][_0x93fb('0x3e')],_[_0x93fb('0x3f')](_0x3d8777[_0x93fb('0x39')],['ids','id'])||{});}})[_0x93fb('0x1b')](respondWithResult(_0x781ab,null))['catch'](handleError(_0x781ab,null));};exports[_0x93fb('0x40')]=function(_0x914341,_0x2f0656){var _0x482026={'raw':![],'where':{}};var _0x35e8c1={};var _0x20cb30={'count':0x0,'rows':[]};return db[_0x93fb('0x36')][_0x93fb('0x41')]({'where':{'id':_0x914341[_0x93fb('0x2a')]['id']}})[_0x93fb('0x1b')](handleEntityNotFound(_0x2f0656,null))['then'](function(_0x3f4074){if(_0x3f4074){_0x35e8c1[_0x93fb('0x31')]=_[_0x93fb('0x2b')](db['MailMessage'][_0x93fb('0x22')]);_0x35e8c1[_0x93fb('0x26')]=_[_0x93fb('0x2b')](_0x914341[_0x93fb('0x26')]);_0x35e8c1['filters']=_[_0x93fb('0x2d')](_0x35e8c1[_0x93fb('0x31')],_0x35e8c1['query']);_0x482026[_0x93fb('0x2f')]=_[_0x93fb('0x2d')](_0x35e8c1[_0x93fb('0x31')],qs[_0x93fb('0x2e')](_0x914341[_0x93fb('0x26')][_0x93fb('0x2e')]));_0x482026[_0x93fb('0x2f')]=_0x482026[_0x93fb('0x2f')]['length']?_0x482026[_0x93fb('0x2f')]:_0x35e8c1['model'];if(!_0x914341[_0x93fb('0x26')][_0x93fb('0x42')](_0x93fb('0x43'))){_0x482026[_0x93fb('0x18')]=qs[_0x93fb('0x18')](_0x914341['query'][_0x93fb('0x18')]);_0x482026[_0x93fb('0x16')]=qs[_0x93fb('0x16')](_0x914341[_0x93fb('0x26')][_0x93fb('0x16')]);}_0x482026[_0x93fb('0x44')]=qs[_0x93fb('0x45')](_0x914341[_0x93fb('0x26')][_0x93fb('0x45')]);_0x482026[_0x93fb('0x46')]=qs[_0x93fb('0x2c')](_[_0x93fb('0x47')](_0x914341['query'],_0x35e8c1['filters']));_0x482026[_0x93fb('0x46')]['MailInteractionId']=_0x3f4074['id'];if(_0x914341[_0x93fb('0x26')]['filter']){_0x482026[_0x93fb('0x46')]=_[_0x93fb('0x34')](_0x482026[_0x93fb('0x46')],{'$or':_[_0x93fb('0x21')](_0x482026['attributes'],function(_0x3ff7b0){var _0x22ea8f={};_0x22ea8f[_0x3ff7b0]={'$like':'%'+_0x914341[_0x93fb('0x26')][_0x93fb('0x48')]+'%'};return _0x22ea8f;})});}if(_0x914341[_0x93fb('0x26')][_0x93fb('0x49')]){var _0x493d01=_0x914341['query'][_0x93fb('0x49')][_0x93fb('0x4a')](',');var _0x1dadb0={};_0x1dadb0[_0x493d01[0x0]]={'$gte':moment(_0x493d01[0x1])[_0x93fb('0x4b')](_0x93fb('0x4c'))};_0x482026[_0x93fb('0x46')]=_['merge'](_0x482026[_0x93fb('0x46')],_0x1dadb0);}_0x482026=_[_0x93fb('0x34')]({},_0x482026,_0x914341['options']);return db['MailMessage'][_0x93fb('0x17')]({'where':_0x482026['where']})['then'](function(_0xdf3ec7){_0x20cb30[_0x93fb('0x17')]=_0xdf3ec7;if(_0x914341['query'][_0x93fb('0x32')]){_0x482026['include']=[{'all':!![]}];}return db[_0x93fb('0x3d')][_0x93fb('0x24')](_0x482026);})[_0x93fb('0x1b')](function(_0x140fd5){if(_0x914341['query']['inlineCss']===_0x93fb('0x4d')){for(var _0x3eb5f5=0x0;_0x3eb5f5<_0x140fd5[_0x93fb('0x30')];_0x3eb5f5++){_0x140fd5[_0x3eb5f5][_0x93fb('0x39')]=juice(_0x140fd5[_0x3eb5f5][_0x93fb('0x39')]);}}_0x20cb30[_0x93fb('0x4e')]=_0x140fd5;return _0x20cb30;});}})[_0x93fb('0x1b')](respondWithFilteredResult(_0x2f0656,_0x482026))[_0x93fb('0x28')](handleError(_0x2f0656,null));};exports[_0x93fb('0x4f')]=function(_0x82a9ad,_0x3e08e1){return db[_0x93fb('0x36')][_0x93fb('0x37')]({'where':{'id':_0x82a9ad[_0x93fb('0x2a')]['id']}})[_0x93fb('0x1b')](handleEntityNotFound(_0x3e08e1,null))[_0x93fb('0x1b')](function(_0x19f1b2){if(_0x19f1b2){return _0x19f1b2['setTags'](_0x82a9ad[_0x93fb('0x39')][_0x93fb('0x3e')],_[_0x93fb('0x3f')](_0x82a9ad['body'],['ids','id'])||{})['spread'](function(){return db[_0x93fb('0x50')][_0x93fb('0x24')]({'attributes':['id',_0x93fb('0x1f'),_0x93fb('0x51')],'where':{'id':_0x82a9ad[_0x93fb('0x39')][_0x93fb('0x3e')]}});})[_0x93fb('0x1b')](function(_0x55c352){socket['emit'](_0x93fb('0x52'),{'id':Number(_0x82a9ad[_0x93fb('0x2a')]['id']),'tags':_0x55c352||[]});return{'id':Number(_0x82a9ad[_0x93fb('0x2a')]['id']),'tags':_0x55c352||[]};});}})[_0x93fb('0x1b')](respondWithResult(_0x3e08e1,null))[_0x93fb('0x28')](handleError(_0x3e08e1,null));};exports[_0x93fb('0x53')]=function(_0x3cda88,_0x671d41){return db[_0x93fb('0x36')][_0x93fb('0x37')]({'where':{'id':_0x3cda88[_0x93fb('0x2a')]['id']}})[_0x93fb('0x1b')](handleEntityNotFound(_0x671d41,null))[_0x93fb('0x1b')](function(_0x1465e0){if(_0x1465e0){return _0x1465e0[_0x93fb('0x53')](_0x3cda88[_0x93fb('0x26')]['ids']);}})['then'](respondWithStatusCode(_0x671d41,null))[_0x93fb('0x28')](handleError(_0x671d41,null));};exports[_0x93fb('0x54')]=function(_0x117930,_0x1cd7b8){var _0x12760f=moment()['unix']()['toString']();var _0x251b76=path['join'](config['root'],'server',_0x93fb('0x55'),_0x93fb('0x56'));var _0x22c64f=path['join'](config[_0x93fb('0x57')],_0x93fb('0x58'),_0x93fb('0x55'),_0x93fb('0x59'));var _0xb4da3f=path['join'](_0x251b76,_0x12760f);var _0x2b38bd=util[_0x93fb('0x4b')](_0x93fb('0x5a'),_0x117930[_0x93fb('0x2a')]['id'],_0x12760f);var _0x7d9ca0=path[_0x93fb('0x5b')](_0x251b76,_0x2b38bd);var _0x39555b=[];if(_0x117930['query']['attachments']){_0x39555b['push']({'model':db[_0x93fb('0x5c')],'as':'Attachments','raw':!![]});}var _0x2b4b90=[{'model':db[_0x93fb('0x3d')],'as':_0x93fb('0x5d'),'attributes':['id',_0x93fb('0x39'),_0x93fb('0x5e'),'to','cc','bcc',_0x93fb('0x5f'),_0x93fb('0x60')],'where':{'secret':![]},'order':qs[_0x93fb('0x45')]('id'),'include':_0x39555b}];return db[_0x93fb('0x36')][_0x93fb('0x37')]({'where':{'id':_0x117930[_0x93fb('0x2a')]['id']},'include':_0x2b4b90})[_0x93fb('0x1b')](handleEntityNotFound(_0x1cd7b8,null))['then'](function(_0xbd8a24){if(_0xbd8a24&&_0xbd8a24[_0x93fb('0x5d')]){var _0x2fd890=_0xbd8a24[_0x93fb('0x61')]({'plain':!![]});fs[_0x93fb('0x62')](_0xb4da3f);return BPromise[_0x93fb('0x63')](_0x2fd890[_0x93fb('0x5d')],function(_0x31bc46,_0xff5324){var _0x3dda9d={'from':_0x31bc46[_0x93fb('0x5e')],'to':_0x31bc46['to']||_0x93fb('0x64'),'subject':_0x31bc46['subject'],'html':htmlEntities['decode'](_0x31bc46[_0x93fb('0x39')]),'headers':{'Date':moment(_0x31bc46[_0x93fb('0x60')])[_0x93fb('0x4b')](_0x93fb('0x65'))},'attachments':[]};if(_0x31bc46['cc']){_0x3dda9d[_0x93fb('0x66')]['Cc']=_0x31bc46['cc'];}if(_0x31bc46['bcc']){_0x3dda9d['headers'][_0x93fb('0x67')]=_0x31bc46['bcc'];}return new BPromise(function(_0x32514a,_0x291f72){if(_0x31bc46[_0x93fb('0x68')]){for(var _0x56ae24=0x0;_0x56ae24<_0x31bc46[_0x93fb('0x68')]['length'];_0x56ae24++){var _0x54c419=_0x31bc46[_0x93fb('0x68')][_0x56ae24];var _0x55bb56=path['join'](_0x22c64f,_0x54c419[_0x93fb('0x69')]);if(fs[_0x93fb('0x6a')](_0x55bb56)){_0x3dda9d['attachments'][_0x93fb('0x6b')]({'name':_0x54c419['name'],'contentType':_0x54c419[_0x93fb('0x6c')],'data':fs[_0x93fb('0x6d')](_0x55bb56)});}}}emlformat['build'](_0x3dda9d,function(_0x83107d,_0xee7803){if(_0x83107d)return _0x291f72(_0x83107d);fs[_0x93fb('0x6e')](path[_0x93fb('0x5b')](_0xb4da3f,util[_0x93fb('0x4b')](_0x93fb('0x6f'),_0xff5324)),_0xee7803);return _0x32514a(_0xee7803);});});})[_0x93fb('0x1b')](function(){return new BPromise(function(_0x6e4ac8,_0x51024a){zipdir(_0xb4da3f,{'saveTo':_0x7d9ca0},function(_0x462677,_0x16ce5a){if(_0x462677)return _0x51024a(_0x462677);return _0x6e4ac8(_0x16ce5a);});})[_0x93fb('0x1b')](function(){return new BPromise(function(_0x24d698,_0x43aa4a){rimraf(_0xb4da3f,function(_0xe7583f){if(_0xe7583f)_0x43aa4a(_0xe7583f);return _0x24d698();});});})[_0x93fb('0x1b')](function(){return _0x1cd7b8[_0x93fb('0x54')](_0x7d9ca0,_0x2b38bd,function(_0x39863f){if(!_0x39863f)fs['unlinkSync'](_0x7d9ca0);});});});}else{return _0x1cd7b8[_0x93fb('0x11')](0xc8);}})[_0x93fb('0x28')](handleError(_0x1cd7b8,null));}; \ No newline at end of file +var _0x83c2=['emit','mailInteractionTags:save','removeTags','unix','toString','join','root','server','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','createdAt','get','mkdirSync','each','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','push','readFileSync','build','message%d.eml','download','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','html-entities','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','error','stack','name','index','map','MailInteraction','rawAttributes','fieldName','type','findAll','mail','query','then','catch','show','model','keys','filters','attributes','intersection','length','merge','create','body','find','params','describe','addMessage','MailMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','include','inlineCss','true','rows','addTags','spread','Tag','color'];(function(_0x53da4d,_0x1ed803){var _0x220bba=function(_0x56db4d){while(--_0x56db4d){_0x53da4d['push'](_0x53da4d['shift']());}};_0x220bba(++_0x1ed803);}(_0x83c2,0x105));var _0x283c=function(_0x13b330,_0x297092){_0x13b330=_0x13b330-0x0;var _0x1f666c=_0x83c2[_0x13b330];return _0x1f666c;};'use strict';var emlformat=require(_0x283c('0x0'));var rimraf=require(_0x283c('0x1'));var zipdir=require(_0x283c('0x2'));var moment=require(_0x283c('0x3'));var BPromise=require(_0x283c('0x4'));var util=require(_0x283c('0x5'));var path=require(_0x283c('0x6'));var fs=require('fs');var _=require(_0x283c('0x7'));var juice=require(_0x283c('0x8'));var Redis=require(_0x283c('0x9'));var interaction=require('../../components/interaction/service');var qs=require(_0x283c('0xa'));var logger=require(_0x283c('0xb'))(_0x283c('0xc'));var config=require(_0x283c('0xd'));var db=require(_0x283c('0xe'))['db'];var htmlEntities=require(_0x283c('0xf'));config['redis']=_['defaults'](config[_0x283c('0x10')],{'host':_0x283c('0x11'),'port':0x18eb});var socket=require(_0x283c('0x12'))(new Redis(config[_0x283c('0x10')]));require(_0x283c('0x13'))[_0x283c('0x14')](socket);function respondWithStatusCode(_0x4b4815,_0x58910f){_0x58910f=_0x58910f||0xcc;return function(_0x115f07){if(_0x115f07){return _0x4b4815[_0x283c('0x15')](_0x58910f);}return _0x4b4815[_0x283c('0x16')](_0x58910f)[_0x283c('0x17')]();};}function respondWithResult(_0x229766,_0x1954e6){_0x1954e6=_0x1954e6||0xc8;return function(_0x37ee65){if(_0x37ee65){return _0x229766['status'](_0x1954e6)[_0x283c('0x18')](_0x37ee65);}};}function respondWithFilteredResult(_0x576f4a,_0x498d02){return function(_0x31cef4){if(_0x31cef4){var _0x42dc2e=typeof _0x498d02[_0x283c('0x19')]===_0x283c('0x1a')&&typeof _0x498d02[_0x283c('0x1b')]===_0x283c('0x1a');var _0x1cf9d5=_0x31cef4[_0x283c('0x1c')];var _0x2047e4=_0x42dc2e?0x0:_0x498d02[_0x283c('0x19')];var _0x4bb99e=_0x42dc2e?_0x31cef4['count']:_0x498d02[_0x283c('0x19')]+_0x498d02['limit'];var _0x3f1ebe;if(_0x4bb99e>=_0x1cf9d5){_0x4bb99e=_0x1cf9d5;_0x3f1ebe=0xc8;}else{_0x3f1ebe=0xce;}_0x576f4a[_0x283c('0x16')](_0x3f1ebe);return _0x576f4a['set'](_0x283c('0x1d'),_0x2047e4+'-'+_0x4bb99e+'/'+_0x1cf9d5)['json'](_0x31cef4);}return null;};}function saveUpdates(_0x4f3b74){return function(_0x101b0d){if(_0x101b0d){return _0x101b0d[_0x283c('0x1e')](_0x4f3b74)['then'](function(_0x411053){return _0x411053;});}return null;};}function removeEntity(_0xb68eed){return function(_0x446a2c){if(_0x446a2c){return _0x446a2c[_0x283c('0x1f')]()['then'](function(){_0xb68eed['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xeb4146){return function(_0x2227b4){if(!_0x2227b4){_0xeb4146[_0x283c('0x15')](0x194);}return _0x2227b4;};}function handleError(_0x289d5d,_0x1182aa){_0x1182aa=_0x1182aa||0x1f4;return function(_0x487276){logger[_0x283c('0x20')](_0x487276[_0x283c('0x21')]);if(_0x487276['name']){delete _0x487276[_0x283c('0x22')];}_0x289d5d[_0x283c('0x16')](_0x1182aa)['send'](_0x487276);};}exports[_0x283c('0x23')]=function(_0x1d71b8,_0x789d5){var _0xecd95={};var _0x5da3fa=_[_0x283c('0x24')](db[_0x283c('0x25')][_0x283c('0x26')],function(_0x57367a){return{'name':_0x57367a[_0x283c('0x27')],'type':_0x57367a[_0x283c('0x28')]['key']};});_0xecd95=qs['getOptions'](_0x5da3fa,_0x1d71b8);return interaction[_0x283c('0x29')](_0x283c('0x2a'),_0x1d71b8[_0x283c('0x2b')],_0x1d71b8['user'],_0xecd95,_0x5da3fa)[_0x283c('0x2c')](respondWithFilteredResult(_0x789d5,_0xecd95))[_0x283c('0x2d')](handleError(_0x789d5,null));};exports[_0x283c('0x2e')]=function(_0x44dd42,_0x1c48d7){var _0x47daec={'raw':![],'where':{'id':_0x44dd42['params']['id']}},_0x5c4209={};_0x5c4209[_0x283c('0x2f')]=_[_0x283c('0x30')](db[_0x283c('0x25')][_0x283c('0x26')]);_0x5c4209['query']=_[_0x283c('0x30')](_0x44dd42[_0x283c('0x2b')]);_0x5c4209[_0x283c('0x31')]=_['intersection'](_0x5c4209[_0x283c('0x2f')],_0x5c4209[_0x283c('0x2b')]);_0x47daec[_0x283c('0x32')]=_[_0x283c('0x33')](_0x5c4209[_0x283c('0x2f')],qs['fields'](_0x44dd42[_0x283c('0x2b')]['fields']));_0x47daec[_0x283c('0x32')]=_0x47daec[_0x283c('0x32')][_0x283c('0x34')]?_0x47daec[_0x283c('0x32')]:_0x5c4209['model'];if(_0x44dd42[_0x283c('0x2b')]['includeAll']){_0x47daec['include']=[{'all':!![]}];}_0x47daec=_[_0x283c('0x35')]({},_0x47daec,_0x44dd42['options']);return db['MailInteraction']['find'](_0x47daec)[_0x283c('0x2c')](handleEntityNotFound(_0x1c48d7,null))[_0x283c('0x2c')](respondWithResult(_0x1c48d7,null))[_0x283c('0x2d')](handleError(_0x1c48d7,null));};exports[_0x283c('0x36')]=function(_0x594e2d,_0x34eea0){return db[_0x283c('0x25')][_0x283c('0x36')](_0x594e2d[_0x283c('0x37')],{})['then'](respondWithResult(_0x34eea0,0xc9))['catch'](handleError(_0x34eea0,null));};exports[_0x283c('0x1e')]=function(_0x2213bc,_0x3dd587){if(_0x2213bc[_0x283c('0x37')]['id']){delete _0x2213bc[_0x283c('0x37')]['id'];}return db[_0x283c('0x25')][_0x283c('0x38')]({'where':{'id':_0x2213bc['params']['id']}})['then'](handleEntityNotFound(_0x3dd587,null))['then'](saveUpdates(_0x2213bc['body'],null))[_0x283c('0x2c')](respondWithResult(_0x3dd587,null))[_0x283c('0x2d')](handleError(_0x3dd587,null));};exports[_0x283c('0x1f')]=function(_0x26fe52,_0x324110){return db[_0x283c('0x25')][_0x283c('0x38')]({'where':{'id':_0x26fe52[_0x283c('0x39')]['id']}})[_0x283c('0x2c')](handleEntityNotFound(_0x324110,null))['then'](removeEntity(_0x324110,null))[_0x283c('0x2d')](handleError(_0x324110,null));};exports[_0x283c('0x3a')]=function(_0x35aa08,_0xc5b519){return db[_0x283c('0x25')][_0x283c('0x3a')]()[_0x283c('0x2c')](respondWithResult(_0xc5b519,null))[_0x283c('0x2d')](handleError(_0xc5b519,null));};exports[_0x283c('0x3b')]=function(_0xb79f0e,_0x5874a7){return db[_0x283c('0x3c')][_0x283c('0x38')]({'where':{'id':_0xb79f0e[_0x283c('0x39')]['id']}})[_0x283c('0x2c')](handleEntityNotFound(_0x5874a7,null))[_0x283c('0x2c')](function(_0x80cca9){if(_0x80cca9){return _0x80cca9['addMessage'](_0xb79f0e['body'][_0x283c('0x3d')],_[_0x283c('0x3e')](_0xb79f0e['body'],[_0x283c('0x3d'),'id'])||{});}})[_0x283c('0x2c')](respondWithResult(_0x5874a7,null))['catch'](handleError(_0x5874a7,null));};exports[_0x283c('0x3f')]=function(_0x1365f1,_0x3f25a2){var _0x10589e={'raw':![],'where':{}};var _0x46655c={};var _0x154a0d={'count':0x0,'rows':[]};return db[_0x283c('0x25')][_0x283c('0x40')]({'where':{'id':_0x1365f1[_0x283c('0x39')]['id']}})[_0x283c('0x2c')](handleEntityNotFound(_0x3f25a2,null))[_0x283c('0x2c')](function(_0xcd5519){if(_0xcd5519){_0x46655c[_0x283c('0x2f')]=_[_0x283c('0x30')](db[_0x283c('0x3c')][_0x283c('0x26')]);_0x46655c['query']=_[_0x283c('0x30')](_0x1365f1[_0x283c('0x2b')]);_0x46655c[_0x283c('0x31')]=_['intersection'](_0x46655c[_0x283c('0x2f')],_0x46655c[_0x283c('0x2b')]);_0x10589e[_0x283c('0x32')]=_['intersection'](_0x46655c[_0x283c('0x2f')],qs['fields'](_0x1365f1[_0x283c('0x2b')][_0x283c('0x41')]));_0x10589e[_0x283c('0x32')]=_0x10589e['attributes']['length']?_0x10589e[_0x283c('0x32')]:_0x46655c['model'];if(!_0x1365f1[_0x283c('0x2b')][_0x283c('0x42')](_0x283c('0x43'))){_0x10589e['limit']=qs[_0x283c('0x1b')](_0x1365f1[_0x283c('0x2b')]['limit']);_0x10589e['offset']=qs[_0x283c('0x19')](_0x1365f1['query'][_0x283c('0x19')]);}_0x10589e[_0x283c('0x44')]=qs[_0x283c('0x45')](_0x1365f1[_0x283c('0x2b')][_0x283c('0x45')]);_0x10589e[_0x283c('0x46')]=qs['filters'](_[_0x283c('0x47')](_0x1365f1[_0x283c('0x2b')],_0x46655c[_0x283c('0x31')]));_0x10589e[_0x283c('0x46')][_0x283c('0x48')]=_0xcd5519['id'];if(_0x1365f1[_0x283c('0x2b')]['filter']){_0x10589e[_0x283c('0x46')]=_[_0x283c('0x35')](_0x10589e[_0x283c('0x46')],{'$or':_[_0x283c('0x24')](_0x10589e['attributes'],function(_0x31ba93){var _0x5de53b={};_0x5de53b[_0x31ba93]={'$like':'%'+_0x1365f1[_0x283c('0x2b')][_0x283c('0x49')]+'%'};return _0x5de53b;})});}if(_0x1365f1[_0x283c('0x2b')][_0x283c('0x4a')]){var _0x337711=_0x1365f1[_0x283c('0x2b')]['$gte']['split'](',');var _0x52b819={};_0x52b819[_0x337711[0x0]]={'$gte':moment(_0x337711[0x1])[_0x283c('0x4b')](_0x283c('0x4c'))};_0x10589e[_0x283c('0x46')]=_[_0x283c('0x35')](_0x10589e[_0x283c('0x46')],_0x52b819);}_0x10589e=_[_0x283c('0x35')]({},_0x10589e,_0x1365f1[_0x283c('0x4d')]);return db['MailMessage']['count']({'where':_0x10589e[_0x283c('0x46')]})['then'](function(_0x2b9037){_0x154a0d[_0x283c('0x1c')]=_0x2b9037;if(_0x1365f1[_0x283c('0x2b')][_0x283c('0x4e')]){_0x10589e[_0x283c('0x4f')]=[{'all':!![]}];}return db[_0x283c('0x3c')]['findAll'](_0x10589e);})['then'](function(_0xed886d){if(_0x1365f1[_0x283c('0x2b')][_0x283c('0x50')]===_0x283c('0x51')){for(var _0x2b9673=0x0;_0x2b9673<_0xed886d[_0x283c('0x34')];_0x2b9673++){_0xed886d[_0x2b9673]['body']=juice(_0xed886d[_0x2b9673][_0x283c('0x37')]);}}_0x154a0d[_0x283c('0x52')]=_0xed886d;return _0x154a0d;});}})[_0x283c('0x2c')](respondWithFilteredResult(_0x3f25a2,_0x10589e))[_0x283c('0x2d')](handleError(_0x3f25a2,null));};exports[_0x283c('0x53')]=function(_0x457d20,_0x5672a0){return db['MailInteraction']['find']({'where':{'id':_0x457d20['params']['id']}})[_0x283c('0x2c')](handleEntityNotFound(_0x5672a0,null))[_0x283c('0x2c')](function(_0x234721){if(_0x234721){return _0x234721['setTags'](_0x457d20[_0x283c('0x37')][_0x283c('0x3d')],_[_0x283c('0x3e')](_0x457d20[_0x283c('0x37')],[_0x283c('0x3d'),'id'])||{})[_0x283c('0x54')](function(){return db[_0x283c('0x55')][_0x283c('0x29')]({'attributes':['id',_0x283c('0x22'),_0x283c('0x56')],'where':{'id':_0x457d20[_0x283c('0x37')][_0x283c('0x3d')]}});})['then'](function(_0x3292b2){socket[_0x283c('0x57')](_0x283c('0x58'),{'id':Number(_0x457d20['params']['id']),'tags':_0x3292b2||[]});return{'id':Number(_0x457d20[_0x283c('0x39')]['id']),'tags':_0x3292b2||[]};});}})[_0x283c('0x2c')](respondWithResult(_0x5672a0,null))['catch'](handleError(_0x5672a0,null));};exports['removeTags']=function(_0x2bc101,_0x248754){return db[_0x283c('0x25')][_0x283c('0x38')]({'where':{'id':_0x2bc101[_0x283c('0x39')]['id']}})['then'](handleEntityNotFound(_0x248754,null))['then'](function(_0x45f94e){if(_0x45f94e){return _0x45f94e[_0x283c('0x59')](_0x2bc101[_0x283c('0x2b')][_0x283c('0x3d')]);}})[_0x283c('0x2c')](respondWithStatusCode(_0x248754,null))[_0x283c('0x2d')](handleError(_0x248754,null));};exports['download']=function(_0x3448d8,_0x244a80){var _0x27a73b=moment()[_0x283c('0x5a')]()[_0x283c('0x5b')]();var _0x1c3724=path[_0x283c('0x5c')](config[_0x283c('0x5d')],_0x283c('0x5e'),'files','tmp');var _0x4d0865=path[_0x283c('0x5c')](config[_0x283c('0x5d')],_0x283c('0x5e'),'files',_0x283c('0x5f'));var _0x1382ae=path[_0x283c('0x5c')](_0x1c3724,_0x27a73b);var _0x564a1e=util[_0x283c('0x4b')](_0x283c('0x60'),_0x3448d8[_0x283c('0x39')]['id'],_0x27a73b);var _0x6e2428=path['join'](_0x1c3724,_0x564a1e);var _0x431a6b=[];if(_0x3448d8[_0x283c('0x2b')][_0x283c('0x5f')]){_0x431a6b['push']({'model':db[_0x283c('0x61')],'as':'Attachments','raw':!![]});}var _0x5a4505=[{'model':db['MailMessage'],'as':_0x283c('0x62'),'attributes':['id','body','from','to','cc',_0x283c('0x63'),_0x283c('0x64'),_0x283c('0x65')],'where':{'secret':![]},'order':qs[_0x283c('0x45')]('id'),'include':_0x431a6b}];return db[_0x283c('0x25')]['find']({'where':{'id':_0x3448d8['params']['id']},'include':_0x5a4505})[_0x283c('0x2c')](handleEntityNotFound(_0x244a80,null))[_0x283c('0x2c')](function(_0x4e2a78){if(_0x4e2a78&&_0x4e2a78[_0x283c('0x62')]){var _0x5abae3=_0x4e2a78[_0x283c('0x66')]({'plain':!![]});fs[_0x283c('0x67')](_0x1382ae);return BPromise[_0x283c('0x68')](_0x5abae3[_0x283c('0x62')],function(_0x178b54,_0x2d6a51){var _0x3c3e33={'from':_0x178b54[_0x283c('0x69')],'to':_0x178b54['to']||'missing.recipient@your.company.com','subject':_0x178b54[_0x283c('0x64')],'html':htmlEntities[_0x283c('0x6a')](_0x178b54[_0x283c('0x37')]),'headers':{'Date':moment(_0x178b54[_0x283c('0x65')])[_0x283c('0x4b')](_0x283c('0x6b'))},'attachments':[]};if(_0x178b54['cc']){_0x3c3e33[_0x283c('0x6c')]['Cc']=_0x178b54['cc'];}if(_0x178b54['bcc']){_0x3c3e33[_0x283c('0x6c')][_0x283c('0x6d')]=_0x178b54[_0x283c('0x63')];}return new BPromise(function(_0x4b81e2,_0x516769){if(_0x178b54[_0x283c('0x6e')]){for(var _0x1ab655=0x0;_0x1ab655<_0x178b54[_0x283c('0x6e')][_0x283c('0x34')];_0x1ab655++){var _0x5d15a2=_0x178b54[_0x283c('0x6e')][_0x1ab655];var _0x4244e5=path['join'](_0x4d0865,_0x5d15a2['basename']);if(fs['existsSync'](_0x4244e5)){_0x3c3e33[_0x283c('0x5f')][_0x283c('0x6f')]({'name':_0x5d15a2[_0x283c('0x22')],'contentType':_0x5d15a2[_0x283c('0x28')],'data':fs[_0x283c('0x70')](_0x4244e5)});}}}emlformat[_0x283c('0x71')](_0x3c3e33,function(_0xb6203c,_0x2e3505){if(_0xb6203c)return _0x516769(_0xb6203c);fs['writeFileSync'](path[_0x283c('0x5c')](_0x1382ae,util['format'](_0x283c('0x72'),_0x2d6a51)),_0x2e3505);return _0x4b81e2(_0x2e3505);});});})[_0x283c('0x2c')](function(){return new BPromise(function(_0x4bde77,_0x289813){zipdir(_0x1382ae,{'saveTo':_0x6e2428},function(_0x5d5c59,_0xa0b54b){if(_0x5d5c59)return _0x289813(_0x5d5c59);return _0x4bde77(_0xa0b54b);});})[_0x283c('0x2c')](function(){return new BPromise(function(_0x525b63,_0x58c5f7){rimraf(_0x1382ae,function(_0xfd084c){if(_0xfd084c)_0x58c5f7(_0xfd084c);return _0x525b63();});});})['then'](function(){return _0x244a80[_0x283c('0x73')](_0x6e2428,_0x564a1e,function(_0x38a302){if(!_0x38a302)fs['unlinkSync'](_0x6e2428);});});});}else{return _0x244a80[_0x283c('0x15')](0xc8);}})[_0x283c('0x2d')](handleError(_0x244a80,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 3d7a846..0f51cd2 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 _0x3f67=['getUsers','then','setDataValue','Users','map','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x3f67,0x1e9));var _0x73f6=function(_0x9105f4,_0x3bf6f7){_0x9105f4=_0x9105f4-0x0;var _0x57a818=_0x3f67[_0x9105f4];return _0x57a818;};'use strict';var EventEmitter=require(_0x73f6('0x0'));var MailInteraction=require(_0x73f6('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x73f6('0x1'))['db'][_0x73f6('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x73f6('0x3')](0x0);var events={'afterCreate':_0x73f6('0x4'),'afterUpdate':'update','afterDestroy':_0x73f6('0x5')};function emitEvent(_0x2bc761){return function(_0x1b5ac5,_0x590f81,_0x1984eb){_0x1b5ac5[_0x73f6('0x6')]({'attributes':['id'],'raw':!![]})[_0x73f6('0x7')](function(_0x2d4543){_0x1b5ac5[_0x73f6('0x8')](_0x73f6('0x9'),_0x2d4543[_0x73f6('0xa')](function(_0xf1ce5b){return{'id':_0xf1ce5b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x1b5ac5['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1196af){_0x1b5ac5['setDataValue']('unreadMessages',_0x1196af['length']);MailInteractionEvents[_0x73f6('0xb')](_0x2bc761+':'+_0x1b5ac5['id'],_0x1b5ac5);MailInteractionEvents[_0x73f6('0xb')](_0x2bc761,_0x1b5ac5);_0x1984eb(null);})['catch'](_0x1984eb(null));};}for(var e in events){if(events[_0x73f6('0xc')](e)){var event=events[e];MailInteraction[_0x73f6('0xd')](e,emitEvent(event));}}module[_0x73f6('0xe')]=MailInteractionEvents; \ No newline at end of file +var _0xab32=['map','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailMessage','setMaxListeners','save','update','remove','getUsers','Users'];(function(_0x29dfb5,_0x318d82){var _0x4f1bd2=function(_0x1da6a4){while(--_0x1da6a4){_0x29dfb5['push'](_0x29dfb5['shift']());}};_0x4f1bd2(++_0x318d82);}(_0xab32,0x105));var _0x2ab3=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xab32[_0x4d337e];return _0x247963;};'use strict';var EventEmitter=require(_0x2ab3('0x0'));var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0x2ab3('0x1'))['db'][_0x2ab3('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x2ab3('0x3')](0x0);var events={'afterCreate':_0x2ab3('0x4'),'afterUpdate':_0x2ab3('0x5'),'afterDestroy':_0x2ab3('0x6')};function emitEvent(_0x173537){return function(_0x58726d,_0x119c7a,_0x133516){_0x58726d[_0x2ab3('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x47cbde){_0x58726d['setDataValue'](_0x2ab3('0x8'),_0x47cbde[_0x2ab3('0x9')](function(_0x5318c4){return{'id':_0x5318c4['id']};}));return MailMessage[_0x2ab3('0xa')]({'where':{'MailInteractionId':_0x58726d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2ab3('0xb')](function(_0x15ba48){_0x58726d['setDataValue'](_0x2ab3('0xc'),_0x15ba48[_0x2ab3('0xd')]);MailInteractionEvents[_0x2ab3('0xe')](_0x173537+':'+_0x58726d['id'],_0x58726d);MailInteractionEvents[_0x2ab3('0xe')](_0x173537,_0x58726d);_0x133516(null);})[_0x2ab3('0xf')](_0x133516(null));};}for(var e in events){if(events[_0x2ab3('0x10')](e)){var event=events[e];MailInteraction[_0x2ab3('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 3cef777..2c07e12 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 _0xf2be=['moment','bluebird','request-promise','path','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','models','get','update','then','catch','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x80f51a,_0x32e95e){var _0x327148=function(_0x16f788){while(--_0x16f788){_0x80f51a['push'](_0x80f51a['shift']());}};_0x327148(++_0x32e95e);}(_0xf2be,0x192));var _0xef2b=function(_0x49925a,_0x24eb11){_0x49925a=_0x49925a-0x0;var _0x2dfaed=_0xf2be[_0x49925a];return _0x2dfaed;};'use strict';var _=require(_0xef2b('0x0'));var util=require(_0xef2b('0x1'));var logger=require(_0xef2b('0x2'))(_0xef2b('0x3'));var moment=require(_0xef2b('0x4'));var BPromise=require(_0xef2b('0x5'));var rp=require(_0xef2b('0x6'));var fs=require('fs');var path=require(_0xef2b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef2b('0x8'));module[_0xef2b('0x9')]=function(_0x443a99,_0xf6a0b4){return _0x443a99[_0xef2b('0xa')](_0xef2b('0xb'),attributes,{'tableName':_0xef2b('0xc'),'paranoid':![],'indexes':[{'name':_0xef2b('0xd'),'fields':[_0xef2b('0xe'),'to'],'type':_0xef2b('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x25d723,_0x537404,_0x28641f){if(_0x25d723[_0xef2b('0x10')]){_0x25d723[_0xef2b('0x11')]=moment()['format'](_0xef2b('0x12'));}if(_0x25d723[_0xef2b('0x13')]){_0x25d723[_0xef2b('0x14')]=moment()[_0xef2b('0x15')](_0xef2b('0x12'));}_0x28641f(null,_0x537404);},'beforeUpdate':function(_0x3d8662,_0x3e93b6,_0x1e479f){if(_0x3d8662['changed'](_0xef2b('0x10'))){_0x3d8662[_0xef2b('0x11')]=_0x3d8662['substatus']?moment()['format'](_0xef2b('0x12')):null;}if(_0x3d8662[_0xef2b('0x16')](_0xef2b('0x13'))){_0x3d8662['closedAt']=moment()[_0xef2b('0x15')](_0xef2b('0x12'));_0x3d8662[_0xef2b('0x10')]=null;_0x3d8662['substatusAt']=null;}_0x1e479f(null,_0x3d8662);},'afterUpdate':function(_0x4f00d3,_0x418d86,_0x184164){var _0x34cfa5=_0x443a99[_0xef2b('0x17')];var _0x255c29=_0x4f00d3[_0xef2b('0x18')]({'plain':!![]});if(_0x255c29[_0xef2b('0x13')]){return _0x34cfa5['MailMessage'][_0xef2b('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x255c29['id']}})[_0xef2b('0x1a')](function(){_0x184164();})[_0xef2b('0x1b')](function(_0x5da290){_0x184164(_0x5da290);});}else{_0x184164();}}},'charset':_0xef2b('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x53ab=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','substatus','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','MailMessage','update','then','catch'];(function(_0x32b9aa,_0x1fcf50){var _0xc396ae=function(_0x2ef553){while(--_0x2ef553){_0x32b9aa['push'](_0x32b9aa['shift']());}};_0xc396ae(++_0x1fcf50);}(_0x53ab,0x178));var _0xb53a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x53ab[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb53a('0x0'));var util=require(_0xb53a('0x1'));var logger=require(_0xb53a('0x2'))(_0xb53a('0x3'));var moment=require(_0xb53a('0x4'));var BPromise=require(_0xb53a('0x5'));var rp=require(_0xb53a('0x6'));var fs=require('fs');var path=require(_0xb53a('0x7'));var rimraf=require(_0xb53a('0x8'));var config=require(_0xb53a('0x9'));var attributes=require(_0xb53a('0xa'));module[_0xb53a('0xb')]=function(_0x397403,_0x332623){return _0x397403[_0xb53a('0xc')](_0xb53a('0xd'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0xb53a('0xe'),'fields':['subject','to'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5a08b3,_0x586e86,_0x52db96){if(_0x5a08b3[_0xb53a('0xf')]){_0x5a08b3['substatusAt']=moment()[_0xb53a('0x10')](_0xb53a('0x11'));}if(_0x5a08b3['closed']){_0x5a08b3['closedAt']=moment()[_0xb53a('0x10')](_0xb53a('0x11'));}_0x52db96(null,_0x586e86);},'beforeUpdate':function(_0x27c7c1,_0x5cd5b7,_0x2580c1){if(_0x27c7c1[_0xb53a('0x12')](_0xb53a('0xf'))){_0x27c7c1['substatusAt']=_0x27c7c1[_0xb53a('0xf')]?moment()[_0xb53a('0x10')](_0xb53a('0x11')):null;}if(_0x27c7c1[_0xb53a('0x12')]('closed')){_0x27c7c1['closedAt']=moment()[_0xb53a('0x10')](_0xb53a('0x11'));_0x27c7c1[_0xb53a('0xf')]=null;_0x27c7c1['substatusAt']=null;}_0x2580c1(null,_0x27c7c1);},'afterUpdate':function(_0x49d8df,_0x35b3b2,_0x142d98){var _0x290833=_0x397403['models'];var _0x688a63=_0x49d8df['get']({'plain':!![]});if(_0x688a63[_0xb53a('0x13')]){return _0x290833[_0xb53a('0x14')][_0xb53a('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x688a63['id']}})[_0xb53a('0x16')](function(){_0x142d98();})[_0xb53a('0x17')](function(_0x50d4a6){_0x142d98(_0x50d4a6);});}else{_0x142d98();}}},'charset':'utf8mb4','collate':_0xb53a('0x18')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 5981860..73e76f1 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 _0x59ec=['register','request','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','UpdateMailInteraction','MailInteraction','body','options','where','limit','find','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x32ba0f,_0xc0919b){var _0xacfb86=function(_0x2a90e8){while(--_0x2a90e8){_0x32ba0f['push'](_0x32ba0f['shift']());}};_0xacfb86(++_0xc0919b);}(_0x59ec,0x102));var _0xc59e=function(_0xb1c22d,_0x14cb11){_0xb1c22d=_0xb1c22d-0x0;var _0x292ffd=_0x59ec[_0xb1c22d];return _0x292ffd;};'use strict';var _=require(_0xc59e('0x0'));var util=require(_0xc59e('0x1'));var moment=require('moment');var BPromise=require(_0xc59e('0x2'));var rs=require(_0xc59e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc59e('0x4'))['db'];var utils=require(_0xc59e('0x5'));var logger=require(_0xc59e('0x6'))(_0xc59e('0x7'));var config=require(_0xc59e('0x8'));var jayson=require(_0xc59e('0x9'));var client=jayson[_0xc59e('0xa')][_0xc59e('0xb')]({'port':0x232a});config[_0xc59e('0xc')]=_[_0xc59e('0xd')](config[_0xc59e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xc59e('0xe'))(new Redis(config[_0xc59e('0xc')]));require('./mailInteraction.socket')[_0xc59e('0xf')](socket);function respondWithRpcPromise(_0x57fa06,_0x3b365a,_0x5e0dff){return new BPromise(function(_0x5690be,_0x19d954){return client[_0xc59e('0x10')](_0x57fa06,_0x5e0dff)[_0xc59e('0x11')](function(_0x78d23a){logger['info'](_0xc59e('0x12'),_0x3b365a,'request\x20sent');logger[_0xc59e('0x13')](_0xc59e('0x14'),_0x3b365a,'request\x20sent',JSON[_0xc59e('0x15')](_0x78d23a));if(_0x78d23a[_0xc59e('0x16')]){if(_0x78d23a[_0xc59e('0x16')]['code']===0x1f4){logger['error'](_0xc59e('0x12'),_0x3b365a,_0x78d23a['error'][_0xc59e('0x17')]);return _0x19d954(_0x78d23a[_0xc59e('0x16')]['message']);}logger['error'](_0xc59e('0x12'),_0x3b365a,_0x78d23a[_0xc59e('0x16')]['message']);return _0x5690be(_0x78d23a[_0xc59e('0x16')][_0xc59e('0x17')]);}else{logger[_0xc59e('0x18')]('MailInteraction,\x20%s,\x20%s',_0x3b365a,_0xc59e('0x19'));_0x5690be(_0x78d23a['result'][_0xc59e('0x17')]);}})[_0xc59e('0x1a')](function(_0x5aa256){logger['error'](_0xc59e('0x12'),_0x3b365a,_0x5aa256);_0x19d954(_0x5aa256);});});}exports[_0xc59e('0x1b')]=function(_0x53333d){var _0x73efd2=this;return new Promise(function(_0x43bbf2,_0x15cb06){return db[_0xc59e('0x1c')]['update'](_0x53333d[_0xc59e('0x1d')],{'raw':_0x53333d[_0xc59e('0x1e')]?_0x53333d[_0xc59e('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53333d[_0xc59e('0x1e')]?_0x53333d[_0xc59e('0x1e')][_0xc59e('0x1f')]||null:null,'attributes':_0x53333d[_0xc59e('0x1e')]?_0x53333d[_0xc59e('0x1e')]['attributes']||null:null,'limit':_0x53333d[_0xc59e('0x1e')]?_0x53333d[_0xc59e('0x1e')][_0xc59e('0x20')]||null:null})[_0xc59e('0x11')](function(_0x267ff3){logger['info'](_0xc59e('0x1b'),_0x53333d);logger[_0xc59e('0x13')](_0xc59e('0x1b'),_0x53333d,JSON[_0xc59e('0x15')](_0x267ff3));_0x43bbf2(_0x267ff3);})[_0xc59e('0x1a')](function(_0x4a93fc){logger[_0xc59e('0x16')](_0xc59e('0x1b'),_0x4a93fc[_0xc59e('0x17')],_0x53333d);_0x15cb06(_0x73efd2[_0xc59e('0x16')](0x1f4,_0x4a93fc[_0xc59e('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x2f4168){return new Promise(function(_0x260108,_0xf8c3c0){return db[_0xc59e('0x1c')][_0xc59e('0x21')]({'where':_0x2f4168[_0xc59e('0x1e')]?_0x2f4168['options']['where']||null:null})[_0xc59e('0x11')](function(_0x2f01ba){if(_0x2f01ba){return _0x2f01ba[_0xc59e('0x22')](_0x2f4168[_0xc59e('0x1d')][_0xc59e('0x23')],_[_0xc59e('0x24')](_0x2f4168[_0xc59e('0x1d')],[_0xc59e('0x23'),'id'])||{});}})[_0xc59e('0x25')](function(_0x1d94ec){logger[_0xc59e('0x18')](_0xc59e('0x26'),_0x2f4168);logger[_0xc59e('0x13')](_0xc59e('0x26'),_0x2f4168,JSON[_0xc59e('0x15')](_0x1d94ec));_0x260108(_0x1d94ec);})[_0xc59e('0x1a')](function(_0x213a50){logger[_0xc59e('0x16')](_0xc59e('0x26'),_0x213a50['message'],_0x2f4168);_0xf8c3c0(_this[_0xc59e('0x16')](0x1f4,_0x213a50[_0xc59e('0x17')]));});});}; \ No newline at end of file +var _0xfd6e=['message','result','catch','MailInteraction','update','options','where','attributes','UpdateMailInteraction','AddTagsToMailInteraction','body','ids','omit','spread','AddTags','stringify','lodash','moment','randomstring','ioredis','rpc','client','http','redis','defaults','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x5567cd,_0x35ca37){var _0x559621=function(_0x133b94){while(--_0x133b94){_0x5567cd['push'](_0x5567cd['shift']());}};_0x559621(++_0x35ca37);}(_0xfd6e,0x16e));var _0xefd6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xefd6('0x0'));var util=require('util');var moment=require(_0xefd6('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd6('0x2'));var fs=require('fs');var Redis=require(_0xefd6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xefd6('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xefd6('0x5')][_0xefd6('0x6')]({'port':0x232a});config[_0xefd6('0x7')]=_[_0xefd6('0x8')](config[_0xefd6('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xefd6('0x7')]));require(_0xefd6('0x9'))[_0xefd6('0xa')](socket);function respondWithRpcPromise(_0x4896c7,_0x19378f,_0x2c4942){return new BPromise(function(_0x10fe07,_0x3aad2b){return client['request'](_0x4896c7,_0x2c4942)[_0xefd6('0xb')](function(_0x298249){logger[_0xefd6('0xc')](_0xefd6('0xd'),_0x19378f,_0xefd6('0xe'));logger[_0xefd6('0xf')](_0xefd6('0x10'),_0x19378f,_0xefd6('0xe'),JSON['stringify'](_0x298249));if(_0x298249[_0xefd6('0x11')]){if(_0x298249[_0xefd6('0x11')][_0xefd6('0x12')]===0x1f4){logger[_0xefd6('0x11')](_0xefd6('0xd'),_0x19378f,_0x298249['error'][_0xefd6('0x13')]);return _0x3aad2b(_0x298249['error'][_0xefd6('0x13')]);}logger['error'](_0xefd6('0xd'),_0x19378f,_0x298249[_0xefd6('0x11')]['message']);return _0x10fe07(_0x298249[_0xefd6('0x11')][_0xefd6('0x13')]);}else{logger[_0xefd6('0xc')](_0xefd6('0xd'),_0x19378f,_0xefd6('0xe'));_0x10fe07(_0x298249[_0xefd6('0x14')][_0xefd6('0x13')]);}})[_0xefd6('0x15')](function(_0x7d7c5d){logger[_0xefd6('0x11')](_0xefd6('0xd'),_0x19378f,_0x7d7c5d);_0x3aad2b(_0x7d7c5d);});});}exports['UpdateMailInteraction']=function(_0x46468a){var _0x1a6271=this;return new Promise(function(_0x1e9449,_0x3a26c5){return db[_0xefd6('0x16')][_0xefd6('0x17')](_0x46468a['body'],{'raw':_0x46468a[_0xefd6('0x18')]?_0x46468a[_0xefd6('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46468a[_0xefd6('0x18')]?_0x46468a[_0xefd6('0x18')][_0xefd6('0x19')]||null:null,'attributes':_0x46468a['options']?_0x46468a['options'][_0xefd6('0x1a')]||null:null,'limit':_0x46468a[_0xefd6('0x18')]?_0x46468a[_0xefd6('0x18')]['limit']||null:null})[_0xefd6('0xb')](function(_0x351a6d){logger[_0xefd6('0xc')]('UpdateMailInteraction',_0x46468a);logger[_0xefd6('0xf')](_0xefd6('0x1b'),_0x46468a,JSON['stringify'](_0x351a6d));_0x1e9449(_0x351a6d);})[_0xefd6('0x15')](function(_0x2d71df){logger[_0xefd6('0x11')]('UpdateMailInteraction',_0x2d71df[_0xefd6('0x13')],_0x46468a);_0x3a26c5(_0x1a6271[_0xefd6('0x11')](0x1f4,_0x2d71df[_0xefd6('0x13')]));});});};exports[_0xefd6('0x1c')]=function(_0x281a84){return new Promise(function(_0x160139,_0x320e4f){return db[_0xefd6('0x16')]['find']({'where':_0x281a84[_0xefd6('0x18')]?_0x281a84[_0xefd6('0x18')][_0xefd6('0x19')]||null:null})[_0xefd6('0xb')](function(_0x355d1b){if(_0x355d1b){return _0x355d1b['addTags'](_0x281a84[_0xefd6('0x1d')][_0xefd6('0x1e')],_[_0xefd6('0x1f')](_0x281a84[_0xefd6('0x1d')],[_0xefd6('0x1e'),'id'])||{});}})[_0xefd6('0x20')](function(_0x5f3379){logger[_0xefd6('0xc')](_0xefd6('0x21'),_0x281a84);logger[_0xefd6('0xf')](_0xefd6('0x21'),_0x281a84,JSON[_0xefd6('0x22')](_0x5f3379));_0x160139(_0x5f3379);})[_0xefd6('0x15')](function(_0x3cd80a){logger['error'](_0xefd6('0x21'),_0x3cd80a[_0xefd6('0x13')],_0x281a84);_0x320e4f(_this[_0xefd6('0x11')](0x1f4,_0x3cd80a[_0xefd6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 26daad3..6aba1a2 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 _0x8129=['length','mailInteraction:','./mailInteraction.events','remove','update','emit','removeListener','register'];(function(_0x1f28de,_0x39455f){var _0x1b4211=function(_0x569c5d){while(--_0x569c5d){_0x1f28de['push'](_0x1f28de['shift']());}};_0x1b4211(++_0x39455f);}(_0x8129,0x1ea));var _0x9812=function(_0x1b105b,_0x23adf1){_0x1b105b=_0x1b105b-0x0;var _0x338022=_0x8129[_0x1b105b];return _0x338022;};'use strict';var MailInteractionEvents=require(_0x9812('0x0'));var events=['save',_0x9812('0x1'),_0x9812('0x2')];function createListener(_0x468890,_0x534dcd){return function(_0x52107f){_0x534dcd[_0x9812('0x3')](_0x468890,_0x52107f);};}function removeListener(_0xa80ede,_0x3207c0){return function(){MailInteractionEvents[_0x9812('0x4')](_0xa80ede,_0x3207c0);};}exports[_0x9812('0x5')]=function(_0x5ccb4e){for(var _0x26b711=0x0,_0x19f314=events[_0x9812('0x6')];_0x26b711<_0x19f314;_0x26b711++){var _0x4821d5=events[_0x26b711];var _0x4562a3=createListener(_0x9812('0x7')+_0x4821d5,_0x5ccb4e);MailInteractionEvents['on'](_0x4821d5,_0x4562a3);}}; \ No newline at end of file +var _0x1b33=['save','remove','emit','register','mailInteraction:','./mailInteraction.events'];(function(_0x3811f6,_0xf99c12){var _0x430b76=function(_0x38a673){while(--_0x38a673){_0x3811f6['push'](_0x3811f6['shift']());}};_0x430b76(++_0xf99c12);}(_0x1b33,0x8f));var _0x31b3=function(_0x4b87ef,_0x1aa1ab){_0x4b87ef=_0x4b87ef-0x0;var _0x287e5e=_0x1b33[_0x4b87ef];return _0x287e5e;};'use strict';var MailInteractionEvents=require(_0x31b3('0x0'));var events=[_0x31b3('0x1'),_0x31b3('0x2'),'update'];function createListener(_0x39eb08,_0x2c0206){return function(_0x30e756){_0x2c0206[_0x31b3('0x3')](_0x39eb08,_0x30e756);};}function removeListener(_0x54b0b6,_0x87d8f8){return function(){MailInteractionEvents['removeListener'](_0x54b0b6,_0x87d8f8);};}exports[_0x31b3('0x4')]=function(_0x1877ce){for(var _0x1125ac=0x0,_0x566a9c=events['length'];_0x1125ac<_0x566a9c;_0x1125ac++){var _0x4eb897=events[_0x1125ac];var _0x262a6b=createListener(_0x31b3('0x5')+_0x4eb897,_0x1877ce);MailInteractionEvents['on'](_0x4eb897,_0x262a6b);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index bf58675..282d04a 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 _0xe59f=['connect-timeout','Router','fs-extra','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post','mail','mailmessage:create','create','put','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path'];(function(_0x39a5b4,_0x5e60c7){var _0x1200dd=function(_0x3ba066){while(--_0x3ba066){_0x39a5b4['push'](_0x39a5b4['shift']());}};_0x1200dd(++_0x5e60c7);}(_0xe59f,0x1c5));var _0xfe59=function(_0x5b85e4,_0x482eae){_0x5b85e4=_0x5b85e4-0x0;var _0xc4e97e=_0xe59f[_0x5b85e4];return _0xc4e97e;};'use strict';var multer=require(_0xfe59('0x0'));var util=require(_0xfe59('0x1'));var path=require(_0xfe59('0x2'));var timeout=require(_0xfe59('0x3'));var express=require('express');var router=express[_0xfe59('0x4')]();var fs_extra=require(_0xfe59('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xfe59('0x6'));router[_0xfe59('0x7')]('/',auth[_0xfe59('0x8')](),controller[_0xfe59('0x9')]);router[_0xfe59('0x7')](_0xfe59('0xa'),auth[_0xfe59('0x8')](),controller[_0xfe59('0xb')]);router[_0xfe59('0x7')](_0xfe59('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xfe59('0x7')]('/:id/download',auth[_0xfe59('0x8')](),controller['download']);router[_0xfe59('0xd')]('/',auth[_0xfe59('0x8')](),interaction['tracked'](_0xfe59('0xe'),_0xfe59('0xf')),controller[_0xfe59('0x10')]);router[_0xfe59('0x11')](_0xfe59('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xfe59('0x11')]('/:id/accept',auth[_0xfe59('0x8')](),controller[_0xfe59('0x12')]);router[_0xfe59('0x11')](_0xfe59('0x13'),auth['isAuthenticated'](),controller[_0xfe59('0x14')]);router[_0xfe59('0x15')](_0xfe59('0xc'),auth['isAuthenticated'](),controller[_0xfe59('0x16')]);module[_0xfe59('0x17')]=router; \ No newline at end of file +var _0xf7c3=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/download','download','tracked','mail','create','put','/:id/accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x5e212b,_0x4e1fbe){var _0x3222c6=function(_0x5366be){while(--_0x5366be){_0x5e212b['push'](_0x5e212b['shift']());}};_0x3222c6(++_0x4e1fbe);}(_0xf7c3,0x154));var _0x3f7c=function(_0x2e4f5d,_0x5cc9ce){_0x2e4f5d=_0x2e4f5d-0x0;var _0x315af2=_0xf7c3[_0x2e4f5d];return _0x315af2;};'use strict';var multer=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var path=require(_0x3f7c('0x2'));var timeout=require(_0x3f7c('0x3'));var express=require('express');var router=express[_0x3f7c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f7c('0x5'));var interaction=require(_0x3f7c('0x6'));var config=require(_0x3f7c('0x7'));var controller=require('./mailMessage.controller');router[_0x3f7c('0x8')]('/',auth[_0x3f7c('0x9')](),controller['index']);router[_0x3f7c('0x8')]('/describe',auth[_0x3f7c('0x9')](),controller['describe']);router[_0x3f7c('0x8')](_0x3f7c('0xa'),auth[_0x3f7c('0x9')](),controller['show']);router[_0x3f7c('0x8')](_0x3f7c('0xb'),auth[_0x3f7c('0x9')](),controller[_0x3f7c('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3f7c('0xd')](_0x3f7c('0xe'),'mailmessage:create'),controller[_0x3f7c('0xf')]);router[_0x3f7c('0x10')](_0x3f7c('0xa'),auth[_0x3f7c('0x9')](),controller['update']);router[_0x3f7c('0x10')](_0x3f7c('0x11'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x3f7c('0x12'),auth[_0x3f7c('0x9')](),controller[_0x3f7c('0x13')]);router[_0x3f7c('0x14')](_0x3f7c('0xa'),auth['isAuthenticated'](),controller[_0x3f7c('0x15')]);module[_0x3f7c('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index d838f2b..b4d701f 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 _0xf08f=['INTEGER','ENUM','Email','Chat','sequelize','lodash','exports','long','TEXT','BOOLEAN','DATE'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0xf08f,0x7d));var _0xff08=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0xf08f[_0x58d5ac];return _0x37985c;};'use strict';var Sequelize=require(_0xff08('0x0'));var _=require(_0xff08('0x1'));module[_0xff08('0x2')]={'body':{'type':Sequelize['TEXT'](_0xff08('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xff08('0x4')]('medium')},'read':{'type':Sequelize[_0xff08('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['TEXT'](_0xff08('0x3'))},'cc':{'type':Sequelize[_0xff08('0x4')](_0xff08('0x3'))},'bcc':{'type':Sequelize[_0xff08('0x4')](_0xff08('0x3'))},'subject':{'type':Sequelize[_0xff08('0x4')]},'sentAt':{'type':Sequelize[_0xff08('0x6')]},'attach':{'type':Sequelize[_0xff08('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xff08('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xff08('0x6')]},'originTo':{'type':Sequelize[_0xff08('0x4')](_0xff08('0x3'))},'originCc':{'type':Sequelize[_0xff08('0x4')](_0xff08('0x3'))},'originChannel':{'type':Sequelize[_0xff08('0x8')](_0xff08('0x9'),_0xff08('0xa')),'defaultValue':_0xff08('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x6018=['out','STRING','DATE','Chat','Email','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x2b68a0,_0x58ea0d){var _0x30fd86=function(_0x4440f5){while(--_0x4440f5){_0x2b68a0['push'](_0x2b68a0['shift']());}};_0x30fd86(++_0x58ea0d);}(_0x6018,0x1cc));var _0x8601=function(_0x3c470b,_0x330170){_0x3c470b=_0x3c470b-0x0;var _0x372030=_0x6018[_0x3c470b];return _0x372030;};'use strict';var Sequelize=require(_0x8601('0x0'));var _=require(_0x8601('0x1'));module[_0x8601('0x2')]={'body':{'type':Sequelize[_0x8601('0x3')](_0x8601('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x8601('0x3')](_0x8601('0x5'))},'read':{'type':Sequelize[_0x8601('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8601('0x7')]('in','out'),'defaultValue':_0x8601('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8601('0x9')](0x1fe)},'from':{'type':Sequelize[_0x8601('0x9')]},'to':{'type':Sequelize['TEXT'](_0x8601('0x4'))},'cc':{'type':Sequelize[_0x8601('0x3')](_0x8601('0x4'))},'bcc':{'type':Sequelize[_0x8601('0x3')](_0x8601('0x4'))},'subject':{'type':Sequelize[_0x8601('0x3')]},'sentAt':{'type':Sequelize[_0x8601('0xa')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0x8601('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x8601('0xa')]},'originTo':{'type':Sequelize[_0x8601('0x3')](_0x8601('0x4'))},'originCc':{'type':Sequelize['TEXT'](_0x8601('0x4'))},'originChannel':{'type':Sequelize[_0x8601('0x7')]('Email',_0x8601('0xb')),'defaultValue':_0x8601('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 849edb5..1ee60f9 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 _0x476c=['rejectMessage','User','email','rejectmessage','download','root','server','files','tmp','message-%s.eml','bcc','createdAt','Attachment','Attachments','from','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','push','unlinkSync','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','MailMessage,\x20%s,\x20%s','result','status','json','undefined','count','offset','limit','set','Content-Range','destroy','end','stack','name','send','index','map','MailMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','update','body','describe','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','updatedAt','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','basename','Contacts','CmContact','create','List\x20not\x20found','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','read','readAt','user','UserId','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE: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','agent','fullname','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','mail','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x3b688c,_0x57f2f0){var _0x2d45a6=function(_0x2f9d82){while(--_0x2f9d82){_0x3b688c['push'](_0x3b688c['shift']());}};_0x2d45a6(++_0x57f2f0);}(_0x476c,0x154));var _0xc476=function(_0x4fa0ae,_0x154356){_0x4fa0ae=_0x4fa0ae-0x0;var _0x198f42=_0x476c[_0x4fa0ae];return _0x198f42;};'use strict';var emlformat=require('eml-format');var moment=require(_0xc476('0x0'));var BPromise=require(_0xc476('0x1'));var util=require(_0xc476('0x2'));var path=require('path');var fs=require('fs');var _=require(_0xc476('0x3'));var Redis=require(_0xc476('0x4'));var htmlToText=require(_0xc476('0x5'));var qs=require(_0xc476('0x6'));var logger=require('../../config/logger')(_0xc476('0x7'));var interaction_log=require(_0xc476('0x8'))(_0xc476('0x9'));var config=require(_0xc476('0xa'));var db=require(_0xc476('0xb'))['db'];config[_0xc476('0xc')]=_[_0xc476('0xd')](config[_0xc476('0xc')],{'host':_0xc476('0xe'),'port':0x18eb});var socket=require(_0xc476('0xf'))(new Redis(config[_0xc476('0xc')]));var htmlEntities=require('html-entities');require('./mailMessage.socket')[_0xc476('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc476('0x11')][_0xc476('0x12')]({'port':0x232c});var client9003=jayson[_0xc476('0x11')]['http']({'port':0x232b});var client9002=jayson[_0xc476('0x11')][_0xc476('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x4a674e,_0x4bdaa7,_0x473b2d,_0x5bc1f5){return new BPromise(function(_0x4c84f3,_0x425fee){var _0x4ad4c0=_0x5bc1f5||client;return _0x4ad4c0[_0xc476('0x13')](_0x4a674e,_0x473b2d)[_0xc476('0x14')](function(_0x15ec8a){logger[_0xc476('0x15')]('MailMessage,\x20%s,\x20%s',_0x4bdaa7,_0xc476('0x16'));logger[_0xc476('0x17')](_0xc476('0x18'),_0x4bdaa7,_0xc476('0x16'),JSON['stringify'](_0x15ec8a));if(_0x15ec8a[_0xc476('0x19')]){if(_0x15ec8a[_0xc476('0x19')][_0xc476('0x1a')]===0x1f4){logger[_0xc476('0x19')]('MailMessage,\x20%s,\x20%s',_0x4bdaa7,_0x15ec8a['error'][_0xc476('0x1b')]);return _0x425fee(_0x15ec8a[_0xc476('0x19')][_0xc476('0x1b')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x4bdaa7,_0x15ec8a[_0xc476('0x19')]['message']);return _0x4c84f3(_0x15ec8a[_0xc476('0x19')][_0xc476('0x1b')]);}else{logger[_0xc476('0x15')](_0xc476('0x1c'),_0x4bdaa7,_0xc476('0x16'));_0x4c84f3(_0x15ec8a[_0xc476('0x1d')][_0xc476('0x1b')]);}})['catch'](function(_0xed80a4){logger[_0xc476('0x19')](_0xc476('0x1c'),_0x4bdaa7,_0xed80a4);_0x425fee(_0xed80a4);});});}function respondWithResult(_0x1f6c49,_0x2082c0){_0x2082c0=_0x2082c0||0xc8;return function(_0x4038ee){if(_0x4038ee){return _0x1f6c49[_0xc476('0x1e')](_0x2082c0)[_0xc476('0x1f')](_0x4038ee);}};}function respondWithFilteredResult(_0xb2dbeb,_0x362869){return function(_0x398d5a){if(_0x398d5a){var _0x3fddcc=typeof _0x362869['offset']===_0xc476('0x20')&&typeof _0x362869['limit']===_0xc476('0x20');var _0x2e872f=_0x398d5a[_0xc476('0x21')];var _0x24bf10=_0x3fddcc?0x0:_0x362869[_0xc476('0x22')];var _0x57be72=_0x3fddcc?_0x398d5a[_0xc476('0x21')]:_0x362869['offset']+_0x362869[_0xc476('0x23')];var _0x34107a;if(_0x57be72>=_0x2e872f){_0x57be72=_0x2e872f;_0x34107a=0xc8;}else{_0x34107a=0xce;}_0xb2dbeb['status'](_0x34107a);return _0xb2dbeb[_0xc476('0x24')](_0xc476('0x25'),_0x24bf10+'-'+_0x57be72+'/'+_0x2e872f)[_0xc476('0x1f')](_0x398d5a);}return null;};}function saveUpdates(_0x43c080){return function(_0x20398d){if(_0x20398d){return _0x20398d['update'](_0x43c080)[_0xc476('0x14')](function(_0x415fd4){return _0x415fd4;});}return null;};}function removeEntity(_0x36a119){return function(_0x701157){if(_0x701157){return _0x701157[_0xc476('0x26')]()[_0xc476('0x14')](function(){_0x36a119[_0xc476('0x1e')](0xcc)[_0xc476('0x27')]();});}};}function handleEntityNotFound(_0x3019c0){return function(_0x24963d){if(!_0x24963d){_0x3019c0['sendStatus'](0x194);}return _0x24963d;};}function handleError(_0x4535af,_0x5d157e){_0x5d157e=_0x5d157e||0x1f4;return function(_0x455f51){logger[_0xc476('0x19')](_0x455f51[_0xc476('0x28')]);if(_0x455f51[_0xc476('0x29')]){delete _0x455f51['name'];}_0x4535af[_0xc476('0x1e')](_0x5d157e)[_0xc476('0x2a')](_0x455f51);};}exports[_0xc476('0x2b')]=function(_0x4a0fa1,_0x3ad035){var _0x1edd1d={},_0x47df17={},_0xf7b0e2={'count':0x0,'rows':[]};var _0x6b0a82=_[_0xc476('0x2c')](db[_0xc476('0x2d')][_0xc476('0x2e')],function(_0x2a07b3){return{'name':_0x2a07b3[_0xc476('0x2f')],'type':_0x2a07b3[_0xc476('0x30')][_0xc476('0x31')]};});_0x47df17[_0xc476('0x32')]=_[_0xc476('0x2c')](_0x6b0a82,_0xc476('0x29'));_0x47df17[_0xc476('0x33')]=_[_0xc476('0x34')](_0x4a0fa1[_0xc476('0x33')]);_0x47df17[_0xc476('0x35')]=_['intersection'](_0x47df17[_0xc476('0x32')],_0x47df17[_0xc476('0x33')]);_0x1edd1d['attributes']=_[_0xc476('0x36')](_0x47df17[_0xc476('0x32')],qs[_0xc476('0x37')](_0x4a0fa1['query'][_0xc476('0x37')]));_0x1edd1d['attributes']=_0x1edd1d['attributes']['length']?_0x1edd1d[_0xc476('0x38')]:_0x47df17['model'];if(!_0x4a0fa1['query'][_0xc476('0x39')](_0xc476('0x3a'))){_0x1edd1d['limit']=qs[_0xc476('0x23')](_0x4a0fa1[_0xc476('0x33')][_0xc476('0x23')]);_0x1edd1d[_0xc476('0x22')]=qs[_0xc476('0x22')](_0x4a0fa1[_0xc476('0x33')][_0xc476('0x22')]);}_0x1edd1d['order']=qs[_0xc476('0x3b')](_0x4a0fa1[_0xc476('0x33')]['sort']);_0x1edd1d[_0xc476('0x3c')]=qs['filters'](_['pick'](_0x4a0fa1['query'],_0x47df17[_0xc476('0x35')]),_0x6b0a82);if(_0x4a0fa1[_0xc476('0x33')]['filter']){_0x1edd1d[_0xc476('0x3c')]=_[_0xc476('0x3d')](_0x1edd1d[_0xc476('0x3c')],{'$or':_['map'](_0x6b0a82,function(_0x3ada72){if(_0x3ada72[_0xc476('0x30')]!=='VIRTUAL'){var _0x4c9d1a={};_0x4c9d1a[_0x3ada72[_0xc476('0x29')]]={'$like':'%'+_0x4a0fa1[_0xc476('0x33')][_0xc476('0x3e')]+'%'};return _0x4c9d1a;}})});}_0x1edd1d=_['merge']({},_0x1edd1d,_0x4a0fa1[_0xc476('0x3f')]);var _0x1acfb0={'where':_0x1edd1d[_0xc476('0x3c')]};return db[_0xc476('0x2d')][_0xc476('0x21')](_0x1acfb0)[_0xc476('0x14')](function(_0x507b06){_0xf7b0e2[_0xc476('0x21')]=_0x507b06;if(_0x4a0fa1[_0xc476('0x33')][_0xc476('0x40')]){_0x1edd1d[_0xc476('0x41')]=[{'all':!![]}];}return db[_0xc476('0x2d')][_0xc476('0x42')](_0x1edd1d);})[_0xc476('0x14')](function(_0x9c98b4){_0xf7b0e2[_0xc476('0x43')]=_0x9c98b4;return _0xf7b0e2;})['then'](respondWithFilteredResult(_0x3ad035,_0x1edd1d))[_0xc476('0x44')](handleError(_0x3ad035,null));};exports[_0xc476('0x45')]=function(_0x2327a5,_0x356bcf){var _0x142069={'raw':!![],'where':{'id':_0x2327a5[_0xc476('0x46')]['id']}},_0x24a102={};_0x24a102[_0xc476('0x32')]=_['keys'](db[_0xc476('0x2d')]['rawAttributes']);_0x24a102['query']=_[_0xc476('0x34')](_0x2327a5[_0xc476('0x33')]);_0x24a102['filters']=_[_0xc476('0x36')](_0x24a102[_0xc476('0x32')],_0x24a102[_0xc476('0x33')]);_0x142069['attributes']=_[_0xc476('0x36')](_0x24a102[_0xc476('0x32')],qs[_0xc476('0x37')](_0x2327a5[_0xc476('0x33')][_0xc476('0x37')]));_0x142069[_0xc476('0x38')]=_0x142069[_0xc476('0x38')][_0xc476('0x47')]?_0x142069[_0xc476('0x38')]:_0x24a102[_0xc476('0x32')];if(_0x2327a5[_0xc476('0x33')][_0xc476('0x40')]){_0x142069[_0xc476('0x41')]=[{'all':!![]}];}_0x142069=_[_0xc476('0x3d')]({},_0x142069,_0x2327a5[_0xc476('0x3f')]);return db[_0xc476('0x2d')][_0xc476('0x48')](_0x142069)[_0xc476('0x14')](handleEntityNotFound(_0x356bcf,null))[_0xc476('0x14')](respondWithResult(_0x356bcf,null))['catch'](handleError(_0x356bcf,null));};exports[_0xc476('0x49')]=function(_0x372685,_0x263a28){if(_0x372685[_0xc476('0x4a')]['id']){delete _0x372685[_0xc476('0x4a')]['id'];}return db[_0xc476('0x2d')][_0xc476('0x48')]({'where':{'id':_0x372685[_0xc476('0x46')]['id']}})[_0xc476('0x14')](handleEntityNotFound(_0x263a28,null))['then'](saveUpdates(_0x372685[_0xc476('0x4a')],null))['then'](respondWithResult(_0x263a28,null))['catch'](handleError(_0x263a28,null));};exports[_0xc476('0x26')]=function(_0x4bbb2c,_0x1255d5){return db[_0xc476('0x2d')][_0xc476('0x48')]({'where':{'id':_0x4bbb2c[_0xc476('0x46')]['id']}})[_0xc476('0x14')](handleEntityNotFound(_0x1255d5,null))[_0xc476('0x14')](removeEntity(_0x1255d5,null))[_0xc476('0x44')](handleError(_0x1255d5,null));};exports[_0xc476('0x4b')]=function(_0x36bb08,_0x292b9c){return db[_0xc476('0x2d')]['describe']()['then'](respondWithResult(_0x292b9c,null))['catch'](handleError(_0x292b9c,null));};exports['create']=function(_0x4212a9,_0x29e4d7){return db[_0xc476('0x2d')]['create'](_0x4212a9[_0xc476('0x4a')])['then'](function(_0x221c03){if(_0x221c03){if(_0x221c03[_0xc476('0x4c')]===_0xc476('0x4d')&&!_0x221c03[_0xc476('0x4e')]){var _0x43cb47,_0x160c65,_0x3af3de;if(_0x4212a9[_0xc476('0x4a')]['to']){_0x160c65=_0x4212a9['body']['to'][_0xc476('0x4f')](',')[0x0];}return db[_0xc476('0x50')][_0xc476('0x51')]({'where':{'id':_0x221c03[_0xc476('0x52')]},'include':[{'model':db[_0xc476('0x53')],'as':_0xc476('0x54'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x160c65},'limit':0x1,'order':[[_0xc476('0x55'),'DESC']]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc476('0x56'),'raw':!![]}]}]})[_0xc476('0x14')](function(_0x31344f){_0x43cb47=_0x31344f;if(!_0x43cb47||!_0x43cb47['Smtp'])return;var _0x3059e2=_0x43cb47[_0xc476('0x57')]();if(_0x4212a9[_0xc476('0x4a')][_0xc476('0x58')]&&_0x4212a9[_0xc476('0x4a')][_0xc476('0x58')][_0xc476('0x47')]){for(var _0x4db7e5=0x0;_0x4db7e5<_0x4212a9['body']['attachments'][_0xc476('0x47')];_0x4db7e5+=0x1){_0x4212a9[_0xc476('0x4a')][_0xc476('0x58')][_0x4db7e5]={'filename':_0x4212a9['body'][_0xc476('0x58')][_0x4db7e5]['name'],'path':path[_0xc476('0x59')](config['root'],_0xc476('0x5a'),_0x4212a9['body']['attachments'][_0x4db7e5][_0xc476('0x5b')])};}}_0x3af3de={'account':_0x3059e2,'message':_0x4212a9[_0xc476('0x4a')]};return;})[_0xc476('0x14')](function(){if(_0x43cb47['List']){if(_0x43cb47[_0xc476('0x54')][_0xc476('0x5c')][_0xc476('0x47')]){return _0x43cb47[_0xc476('0x54')][_0xc476('0x5c')][0x0];}else{return db[_0xc476('0x5d')][_0xc476('0x5e')](_[_0xc476('0xd')](_0x4212a9[_0xc476('0x4a')],{'firstName':_0x4212a9['body']['to'],'email':_0x4212a9[_0xc476('0x4a')]['to'],'phone':_0x4212a9[_0xc476('0x4a')]['to'],'ListId':_0x43cb47['ListId']}));}}else{throw new Error(_0xc476('0x5f'));}})[_0xc476('0x14')](function(){if(_0x3af3de){return respondWithRpcPromise('SendMail',_0xc476('0x60'),_0x3af3de,client9003)[_0xc476('0x14')](function(_0x29a4c3){return _0x221c03['update']({'read':!![],'messageId':_0x29a4c3['messageId'],'sentAt':moment()[_0xc476('0x61')](_0xc476('0x62'))});})['catch'](function(_0x10d0ba){logger[_0xc476('0x19')]('%s',JSON[_0xc476('0x63')](_0x10d0ba));return _0x221c03;});}return _0x221c03;});}return _0x221c03;}})[_0xc476('0x14')](respondWithResult(_0x29e4d7,0xc9))[_0xc476('0x44')](handleError(_0x29e4d7,null));};exports[_0xc476('0x64')]=function(_0x1a64b2,_0xd78b84){var _0x14e303={'agent':{},'channel':'mail'};if(_0x1a64b2[_0xc476('0x4a')]['id']){delete _0x1a64b2[_0xc476('0x4a')]['id'];}_0x1a64b2[_0xc476('0x4a')][_0xc476('0x65')]=!![];_0x1a64b2[_0xc476('0x4a')][_0xc476('0x66')]=moment()[_0xc476('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x1a64b2[_0xc476('0x4a')]['UserId']=_0x1a64b2[_0xc476('0x4a')]['UserId']||_0x1a64b2[_0xc476('0x67')]['id'];_0x14e303['agent']['id']=_0x1a64b2[_0xc476('0x4a')][_0xc476('0x68')];return db[_0xc476('0x2d')]['find']({'where':{'id':_0x1a64b2[_0xc476('0x46')]['id'],'UserId':null}})[_0xc476('0x14')](handleEntityNotFound(_0xd78b84,null))['then'](saveUpdates(_0x1a64b2[_0xc476('0x4a')],null))[_0xc476('0x14')](function(_0x1d2293){if(_0x1d2293){_0x14e303[_0xc476('0x1b')]=_0x1d2293[_0xc476('0x69')]({'plain':!![]});return db[_0xc476('0x6a')][_0xc476('0x48')]({'where':{'id':_0x1d2293[_0xc476('0x6b')]}});}return null;})[_0xc476('0x14')](handleEntityNotFound(_0xd78b84,null))['then'](function(_0x881d5c){if(_0x881d5c){return _0x881d5c[_0xc476('0x49')]({'UserId':_0x1a64b2['body']['UserId'],'read1stAt':_['isNil'](_0x881d5c[_0xc476('0x6c')])?moment()[_0xc476('0x61')](_0xc476('0x62')):undefined});}return null;})['then'](function(_0x30af77){if(_0x30af77){_0x14e303[_0xc476('0x6d')]=_0x30af77[_0xc476('0x69')]({'plain':!![]});interaction_log[_0xc476('0x15')](_0xc476('0x6e'),_0x1a64b2[_0xc476('0x67')]['id'],_0x1a64b2['user']['name'],_0x1a64b2[_0xc476('0x67')][_0xc476('0x6f')],_0x14e303[_0xc476('0x6d')]['id'],_0x1a64b2['body']?JSON['stringify'](_0x1a64b2[_0xc476('0x4a')]):_0xc476('0x70'));return respondWithRpcPromise(_0xc476('0x71'),_0xc476('0x72'),_0x14e303);}return null;})[_0xc476('0x14')](function(_0x2520da){var _0x365dd1=_0xc476('0x73')+_0x2520da[_0xc476('0x1b')][_0xc476('0x74')];return db[_0xc476('0x75')][_0xc476('0x33')](_0x365dd1,{'type':db[_0xc476('0x76')][_0xc476('0x77')][_0xc476('0x78')],'raw':!![]})[_0xc476('0x14')](function(_0x52a288){return _0x52a288;});})[_0xc476('0x14')](function(_0x32f682){if(_0x32f682){_0x14e303[_0xc476('0x1b')][_0xc476('0x79')]=_0x32f682[0x0];if(!_0x1a64b2[_0xc476('0x4a')][_0xc476('0x68')])return;return db['User'][_0xc476('0x48')]({'where':{'id':_0x1a64b2[_0xc476('0x4a')]['UserId'],'role':_0xc476('0x7a')},'attributes':['id',_0xc476('0x29'),_0xc476('0x7b'),'email',_0xc476('0x7c')],'raw':!![]});}return null;})[_0xc476('0x14')](function(_0x364934){if(!_0x364934)return null;_0x14e303['message'][_0xc476('0x7a')]=_0x364934;return _0x14e303;})[_0xc476('0x14')](function(_0x2bfe25){if(_0x2bfe25){if(_0x1a64b2['body'][_0xc476('0x7d')]){_0x14e303['message'][_0xc476('0x7e')]=util[_0xc476('0x61')](_0xc476('0x7f'),_0x1a64b2[_0xc476('0x67')][_0xc476('0x29')]);_0x14e303['message'][_0xc476('0x80')]=_0x14e303['channel'];_0x14e303['message'][_0xc476('0x81')]=_0x14e303[_0xc476('0x80')];_0x14e303[_0xc476('0x1b')][_0xc476('0x82')]='accept';_0x14e303[_0xc476('0x1b')][_0xc476('0x4a')]=htmlToText[_0xc476('0x83')](_0x14e303['message'][_0xc476('0x4a')]);return respondWithRpcPromise(_0xc476('0x84'),_0xc476('0x84'),{'event':_0xc476('0x85'),'message':_0x14e303[_0xc476('0x1b')]},client9002)['then'](function(){return _0x14e303;});}return _0x14e303;}return null;})['then'](respondWithResult(_0xd78b84,null))[_0xc476('0x44')](handleError(_0xd78b84,null));};exports[_0xc476('0x86')]=function(_0x154e68,_0x153bd1){var _0x1c364e={'agent':{},'channel':_0xc476('0x87')};if(_0x154e68[_0xc476('0x4a')]['id']){delete _0x154e68[_0xc476('0x4a')]['id'];}_0x154e68[_0xc476('0x4a')][_0xc476('0x68')]=_0x154e68[_0xc476('0x4a')][_0xc476('0x68')]||_0x154e68['user']['id'];_0x1c364e[_0xc476('0x7a')]['id']=_0x154e68['body']['UserId'];return db[_0xc476('0x2d')]['find']({'where':{'id':_0x154e68[_0xc476('0x46')]['id'],'UserId':null}})[_0xc476('0x14')](handleEntityNotFound(_0x153bd1,null))[_0xc476('0x14')](function(_0x2bc98c){if(_0x2bc98c){_0x1c364e['message']=_0x2bc98c['get']({'plain':!![]});return db[_0xc476('0x6a')][_0xc476('0x48')]({'where':{'id':_0x2bc98c[_0xc476('0x6b')]}});}return null;})[_0xc476('0x14')](handleEntityNotFound(_0x153bd1,null))['then'](function(_0x14dfba){if(_0x14dfba){_0x1c364e[_0xc476('0x6d')]=_0x14dfba[_0xc476('0x69')]({'plain':!![]});interaction_log[_0xc476('0x15')](_0xc476('0x88'),_0x154e68[_0xc476('0x67')]['id'],_0x154e68[_0xc476('0x67')][_0xc476('0x29')],_0x154e68[_0xc476('0x67')]['role'],_0x1c364e['interaction']['id'],_0x154e68[_0xc476('0x4a')]?JSON[_0xc476('0x63')](_0x154e68['body']):_0xc476('0x70'));return respondWithRpcPromise('RejectMessage',_0xc476('0x89'),_0x1c364e);}return null;})[_0xc476('0x14')](function(_0x3026be){var _0x46e8fc=_0xc476('0x73')+_0x3026be[_0xc476('0x1b')][_0xc476('0x74')];return db[_0xc476('0x75')][_0xc476('0x33')](_0x46e8fc,{'type':db['Sequelize'][_0xc476('0x77')][_0xc476('0x78')],'raw':!![]})['then'](function(_0x40e59d){return _0x40e59d;});})[_0xc476('0x14')](function(_0x3a6902){if(_0x3a6902){_0x1c364e[_0xc476('0x1b')][_0xc476('0x79')]=_0x3a6902[0x0];if(!_0x154e68[_0xc476('0x4a')][_0xc476('0x68')])return;return db[_0xc476('0x8a')][_0xc476('0x48')]({'where':{'id':_0x154e68[_0xc476('0x4a')][_0xc476('0x68')],'role':'agent'},'attributes':['id',_0xc476('0x29'),_0xc476('0x7b'),_0xc476('0x8b'),_0xc476('0x7c')],'raw':!![]});}return null;})[_0xc476('0x14')](function(_0x2802ac){if(!_0x2802ac)return null;_0x1c364e[_0xc476('0x1b')][_0xc476('0x7a')]=_0x2802ac;return _0x1c364e;})[_0xc476('0x14')](function(_0x34d710){if(_0x34d710){_0x34d710[_0xc476('0x1b')][_0xc476('0x7e')]=util['format'](_0xc476('0x7f'),_0x154e68[_0xc476('0x67')]['name']);_0x34d710[_0xc476('0x1b')][_0xc476('0x80')]=_0x1c364e[_0xc476('0x80')];_0x34d710['message'][_0xc476('0x81')]=_0x1c364e[_0xc476('0x80')];_0x34d710[_0xc476('0x1b')]['event']=_0xc476('0x86');_0x34d710[_0xc476('0x1b')][_0xc476('0x4a')]=htmlToText[_0xc476('0x83')](_0x1c364e[_0xc476('0x1b')][_0xc476('0x4a')]);respondWithRpcPromise(_0xc476('0x84'),'EventManager',{'event':_0xc476('0x8c'),'message':_0x34d710[_0xc476('0x1b')]},client9002);return _0x1c364e;}return null;})['then'](respondWithResult(_0x153bd1,null))[_0xc476('0x44')](handleError(_0x153bd1,null));};exports[_0xc476('0x8d')]=function(_0x505791,_0x25fb03){var _0x5c5f8b=moment()['unix']()['toString']();var _0x31fb81=path[_0xc476('0x59')](config[_0xc476('0x8e')],_0xc476('0x8f'),_0xc476('0x90'),_0xc476('0x91'));var _0x46db8f=path['join'](config[_0xc476('0x8e')],'server','files',_0xc476('0x58'));var _0x11c1e6=util['format'](_0xc476('0x92'),_0x5c5f8b);return db[_0xc476('0x2d')]['find']({'where':{'id':_0x505791['params']['id']},'attributes':['id','body','from','to','cc',_0xc476('0x93'),'subject',_0xc476('0x94')],'include':_0x505791[_0xc476('0x33')][_0xc476('0x58')]?[{'model':db[_0xc476('0x95')],'as':_0xc476('0x96')}]:undefined})[_0xc476('0x14')](handleEntityNotFound(_0x25fb03,null))[_0xc476('0x14')](function(_0x137b8f){if(_0x137b8f){var _0x3a2b1d=_0x137b8f;var _0x1a4949={'from':_0x3a2b1d[_0xc476('0x97')],'to':_0x3a2b1d['to'],'subject':_0x3a2b1d['subject'],'html':htmlEntities[_0xc476('0x98')](_0x3a2b1d[_0xc476('0x4a')]),'headers':{'Date':moment(_0x3a2b1d[_0xc476('0x94')])[_0xc476('0x61')](_0xc476('0x99'))},'attachments':[]};if(_0x137b8f['cc']){_0x1a4949[_0xc476('0x9a')]['Cc']=_0x137b8f['cc'];}if(_0x137b8f[_0xc476('0x93')]){_0x1a4949[_0xc476('0x9a')][_0xc476('0x9b')]=_0x137b8f[_0xc476('0x93')];}return new BPromise(function(_0x28c671,_0x56c706){if(_0x137b8f[_0xc476('0x96')]){for(var _0x405ee5=0x0;_0x405ee5<_0x137b8f['Attachments'][_0xc476('0x47')];_0x405ee5++){var _0x57ed4d=_0x137b8f[_0xc476('0x96')][_0x405ee5];var _0xe695b1=path[_0xc476('0x59')](_0x46db8f,_0x57ed4d[_0xc476('0x5b')]);if(fs[_0xc476('0x9c')](_0xe695b1)){_0x1a4949[_0xc476('0x58')][_0xc476('0x9d')]({'name':_0x57ed4d['name'],'contentType':_0x57ed4d[_0xc476('0x30')],'data':fs['readFileSync'](_0xe695b1)});}}}emlformat['build'](_0x1a4949,function(_0x48f3fb,_0x3d6ea6){if(_0x48f3fb)return _0x56c706(_0x48f3fb);fs['writeFileSync'](path[_0xc476('0x59')](_0x31fb81,_0x11c1e6),_0x3d6ea6);return _0x28c671(_0x3d6ea6);});});}})[_0xc476('0x14')](function(_0x585b35){if(_0x585b35){return _0x25fb03[_0xc476('0x8d')](path[_0xc476('0x59')](_0x31fb81,_0x11c1e6),_0x11c1e6,function(_0x3627d9){if(!_0x3627d9)fs[_0xc476('0x9e')](path[_0xc476('0x59')](_0x31fb81,_0x11c1e6));});}})[_0xc476('0x44')](handleError(_0x25fb03,null));}; \ No newline at end of file +var _0x8ff4=['createdAt','Attachment','Attachments','decode','headers','Bcc','push','type','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','html-entities','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','offset','undefined','limit','count','status','set','Content-Range','update','destroy','sendStatus','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','pick','where','VIRTUAL','filter','merge','options','MailMessage','includeAll','include','rows','body','find','params','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','Contacts','defaults','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','mail','read','UserId','user','read1stAt','interaction','get','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','channel','motionChannel','event','accept','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','interface','SIP/%s','rejectmessage','download','toString','files','server','message-%s.eml','from','bcc','subject'];(function(_0x2791b3,_0x205819){var _0x44aefd=function(_0x5cb057){while(--_0x5cb057){_0x2791b3['push'](_0x2791b3['shift']());}};_0x44aefd(++_0x205819);}(_0x8ff4,0x13e));var _0x48ff=function(_0x1e8c4e,_0x4b6ba5){_0x1e8c4e=_0x1e8c4e-0x0;var _0x19088a=_0x8ff4[_0x1e8c4e];return _0x19088a;};'use strict';var emlformat=require(_0x48ff('0x0'));var moment=require(_0x48ff('0x1'));var BPromise=require('bluebird');var util=require(_0x48ff('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x48ff('0x3'));var Redis=require(_0x48ff('0x4'));var htmlToText=require(_0x48ff('0x5'));var qs=require(_0x48ff('0x6'));var logger=require('../../config/logger')(_0x48ff('0x7'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x48ff('0x8'));var db=require(_0x48ff('0x9'))['db'];config[_0x48ff('0xa')]=_['defaults'](config[_0x48ff('0xa')],{'host':_0x48ff('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var htmlEntities=require(_0x48ff('0xc'));require(_0x48ff('0xd'))[_0x48ff('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x48ff('0xf')][_0x48ff('0x10')]({'port':0x232c});var client9003=jayson[_0x48ff('0xf')][_0x48ff('0x10')]({'port':0x232b});var client9002=jayson['client'][_0x48ff('0x10')]({'port':0x232a});function respondWithRpcPromise(_0x3d1507,_0x564c0d,_0x35331e,_0x490ebb){return new BPromise(function(_0x4b7202,_0xef8744){var _0x3e17e7=_0x490ebb||client;return _0x3e17e7['request'](_0x3d1507,_0x35331e)[_0x48ff('0x11')](function(_0x369f47){logger[_0x48ff('0x12')](_0x48ff('0x13'),_0x564c0d,_0x48ff('0x14'));logger[_0x48ff('0x15')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x564c0d,_0x48ff('0x14'),JSON['stringify'](_0x369f47));if(_0x369f47[_0x48ff('0x16')]){if(_0x369f47[_0x48ff('0x16')][_0x48ff('0x17')]===0x1f4){logger[_0x48ff('0x16')]('MailMessage,\x20%s,\x20%s',_0x564c0d,_0x369f47[_0x48ff('0x16')]['message']);return _0xef8744(_0x369f47['error']['message']);}logger['error'](_0x48ff('0x13'),_0x564c0d,_0x369f47['error'][_0x48ff('0x18')]);return _0x4b7202(_0x369f47[_0x48ff('0x16')]['message']);}else{logger[_0x48ff('0x12')](_0x48ff('0x13'),_0x564c0d,'request\x20sent');_0x4b7202(_0x369f47[_0x48ff('0x19')]['message']);}})[_0x48ff('0x1a')](function(_0xa28d81){logger['error']('MailMessage,\x20%s,\x20%s',_0x564c0d,_0xa28d81);_0xef8744(_0xa28d81);});});}function respondWithResult(_0x40da1f,_0x368814){_0x368814=_0x368814||0xc8;return function(_0x31f3cb){if(_0x31f3cb){return _0x40da1f['status'](_0x368814)['json'](_0x31f3cb);}};}function respondWithFilteredResult(_0x4f7164,_0x36305a){return function(_0x1698a2){if(_0x1698a2){var _0x1f3d9a=typeof _0x36305a[_0x48ff('0x1b')]===_0x48ff('0x1c')&&typeof _0x36305a[_0x48ff('0x1d')]==='undefined';var _0x452772=_0x1698a2[_0x48ff('0x1e')];var _0x28a265=_0x1f3d9a?0x0:_0x36305a['offset'];var _0x47e568=_0x1f3d9a?_0x1698a2[_0x48ff('0x1e')]:_0x36305a[_0x48ff('0x1b')]+_0x36305a['limit'];var _0x16d83c;if(_0x47e568>=_0x452772){_0x47e568=_0x452772;_0x16d83c=0xc8;}else{_0x16d83c=0xce;}_0x4f7164[_0x48ff('0x1f')](_0x16d83c);return _0x4f7164[_0x48ff('0x20')](_0x48ff('0x21'),_0x28a265+'-'+_0x47e568+'/'+_0x452772)['json'](_0x1698a2);}return null;};}function saveUpdates(_0x5d79e1){return function(_0x433f68){if(_0x433f68){return _0x433f68[_0x48ff('0x22')](_0x5d79e1)[_0x48ff('0x11')](function(_0x62072c){return _0x62072c;});}return null;};}function removeEntity(_0x3e728d){return function(_0x1c93d9){if(_0x1c93d9){return _0x1c93d9[_0x48ff('0x23')]()['then'](function(){_0x3e728d[_0x48ff('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b89f){return function(_0x1fc8e3){if(!_0x1fc8e3){_0x47b89f[_0x48ff('0x24')](0x194);}return _0x1fc8e3;};}function handleError(_0x1b213d,_0x130432){_0x130432=_0x130432||0x1f4;return function(_0x33583a){logger[_0x48ff('0x16')](_0x33583a['stack']);if(_0x33583a[_0x48ff('0x25')]){delete _0x33583a[_0x48ff('0x25')];}_0x1b213d[_0x48ff('0x1f')](_0x130432)[_0x48ff('0x26')](_0x33583a);};}exports[_0x48ff('0x27')]=function(_0x1852c6,_0x16344e){var _0x1f375e={},_0x209074={},_0x388ad8={'count':0x0,'rows':[]};var _0x8944f8=_[_0x48ff('0x28')](db['MailMessage'][_0x48ff('0x29')],function(_0x3bd11a){return{'name':_0x3bd11a[_0x48ff('0x2a')],'type':_0x3bd11a['type'][_0x48ff('0x2b')]};});_0x209074[_0x48ff('0x2c')]=_[_0x48ff('0x28')](_0x8944f8,'name');_0x209074[_0x48ff('0x2d')]=_[_0x48ff('0x2e')](_0x1852c6[_0x48ff('0x2d')]);_0x209074[_0x48ff('0x2f')]=_['intersection'](_0x209074['model'],_0x209074[_0x48ff('0x2d')]);_0x1f375e[_0x48ff('0x30')]=_[_0x48ff('0x31')](_0x209074[_0x48ff('0x2c')],qs['fields'](_0x1852c6[_0x48ff('0x2d')][_0x48ff('0x32')]));_0x1f375e[_0x48ff('0x30')]=_0x1f375e[_0x48ff('0x30')][_0x48ff('0x33')]?_0x1f375e[_0x48ff('0x30')]:_0x209074[_0x48ff('0x2c')];if(!_0x1852c6['query'][_0x48ff('0x34')]('nolimit')){_0x1f375e[_0x48ff('0x1d')]=qs['limit'](_0x1852c6[_0x48ff('0x2d')][_0x48ff('0x1d')]);_0x1f375e[_0x48ff('0x1b')]=qs[_0x48ff('0x1b')](_0x1852c6[_0x48ff('0x2d')][_0x48ff('0x1b')]);}_0x1f375e[_0x48ff('0x35')]=qs['sort'](_0x1852c6[_0x48ff('0x2d')]['sort']);_0x1f375e['where']=qs[_0x48ff('0x2f')](_[_0x48ff('0x36')](_0x1852c6['query'],_0x209074[_0x48ff('0x2f')]),_0x8944f8);if(_0x1852c6['query']['filter']){_0x1f375e[_0x48ff('0x37')]=_['merge'](_0x1f375e[_0x48ff('0x37')],{'$or':_[_0x48ff('0x28')](_0x8944f8,function(_0x29ea28){if(_0x29ea28['type']!==_0x48ff('0x38')){var _0x40aa9b={};_0x40aa9b[_0x29ea28[_0x48ff('0x25')]]={'$like':'%'+_0x1852c6[_0x48ff('0x2d')][_0x48ff('0x39')]+'%'};return _0x40aa9b;}})});}_0x1f375e=_[_0x48ff('0x3a')]({},_0x1f375e,_0x1852c6[_0x48ff('0x3b')]);var _0x57508a={'where':_0x1f375e[_0x48ff('0x37')]};return db[_0x48ff('0x3c')][_0x48ff('0x1e')](_0x57508a)[_0x48ff('0x11')](function(_0x356f28){_0x388ad8[_0x48ff('0x1e')]=_0x356f28;if(_0x1852c6[_0x48ff('0x2d')][_0x48ff('0x3d')]){_0x1f375e[_0x48ff('0x3e')]=[{'all':!![]}];}return db[_0x48ff('0x3c')]['findAll'](_0x1f375e);})[_0x48ff('0x11')](function(_0x25fd29){_0x388ad8[_0x48ff('0x3f')]=_0x25fd29;return _0x388ad8;})[_0x48ff('0x11')](respondWithFilteredResult(_0x16344e,_0x1f375e))[_0x48ff('0x1a')](handleError(_0x16344e,null));};exports['show']=function(_0x40fd52,_0x539da5){var _0x3f4397={'raw':!![],'where':{'id':_0x40fd52['params']['id']}},_0x351225={};_0x351225['model']=_[_0x48ff('0x2e')](db[_0x48ff('0x3c')][_0x48ff('0x29')]);_0x351225[_0x48ff('0x2d')]=_['keys'](_0x40fd52[_0x48ff('0x2d')]);_0x351225[_0x48ff('0x2f')]=_[_0x48ff('0x31')](_0x351225[_0x48ff('0x2c')],_0x351225[_0x48ff('0x2d')]);_0x3f4397[_0x48ff('0x30')]=_[_0x48ff('0x31')](_0x351225['model'],qs[_0x48ff('0x32')](_0x40fd52[_0x48ff('0x2d')][_0x48ff('0x32')]));_0x3f4397[_0x48ff('0x30')]=_0x3f4397['attributes']['length']?_0x3f4397[_0x48ff('0x30')]:_0x351225['model'];if(_0x40fd52['query'][_0x48ff('0x3d')]){_0x3f4397[_0x48ff('0x3e')]=[{'all':!![]}];}_0x3f4397=_['merge']({},_0x3f4397,_0x40fd52[_0x48ff('0x3b')]);return db['MailMessage']['find'](_0x3f4397)[_0x48ff('0x11')](handleEntityNotFound(_0x539da5,null))[_0x48ff('0x11')](respondWithResult(_0x539da5,null))[_0x48ff('0x1a')](handleError(_0x539da5,null));};exports[_0x48ff('0x22')]=function(_0x323377,_0x41d75e){if(_0x323377[_0x48ff('0x40')]['id']){delete _0x323377[_0x48ff('0x40')]['id'];}return db[_0x48ff('0x3c')][_0x48ff('0x41')]({'where':{'id':_0x323377[_0x48ff('0x42')]['id']}})[_0x48ff('0x11')](handleEntityNotFound(_0x41d75e,null))[_0x48ff('0x11')](saveUpdates(_0x323377[_0x48ff('0x40')],null))[_0x48ff('0x11')](respondWithResult(_0x41d75e,null))[_0x48ff('0x1a')](handleError(_0x41d75e,null));};exports['destroy']=function(_0x7352bb,_0x2e9167){return db[_0x48ff('0x3c')][_0x48ff('0x41')]({'where':{'id':_0x7352bb[_0x48ff('0x42')]['id']}})[_0x48ff('0x11')](handleEntityNotFound(_0x2e9167,null))[_0x48ff('0x11')](removeEntity(_0x2e9167,null))['catch'](handleError(_0x2e9167,null));};exports[_0x48ff('0x43')]=function(_0x473b17,_0x19aff1){return db[_0x48ff('0x3c')]['describe']()[_0x48ff('0x11')](respondWithResult(_0x19aff1,null))[_0x48ff('0x1a')](handleError(_0x19aff1,null));};exports['create']=function(_0x582f61,_0x4bba1c){return db['MailMessage'][_0x48ff('0x44')](_0x582f61[_0x48ff('0x40')])[_0x48ff('0x11')](function(_0x16b3e2){if(_0x16b3e2){if(_0x16b3e2[_0x48ff('0x45')]===_0x48ff('0x46')&&!_0x16b3e2[_0x48ff('0x47')]){var _0x3e62d8,_0x206325,_0x1f7a61;if(_0x582f61[_0x48ff('0x40')]['to']){_0x206325=_0x582f61[_0x48ff('0x40')]['to'][_0x48ff('0x48')](',')[0x0];}return db[_0x48ff('0x49')][_0x48ff('0x4a')]({'where':{'id':_0x16b3e2[_0x48ff('0x4b')]},'include':[{'model':db[_0x48ff('0x4c')],'as':_0x48ff('0x4d'),'include':[{'model':db[_0x48ff('0x4e')],'as':'Contacts','where':{'email':_0x206325},'limit':0x1,'order':[['updatedAt',_0x48ff('0x4f')]]}]},{'model':db[_0x48ff('0x50')],'as':_0x48ff('0x51'),'raw':!![],'include':[{'model':db[_0x48ff('0x52')],'as':_0x48ff('0x52'),'raw':!![]}]}]})[_0x48ff('0x11')](function(_0x4a3f9a){_0x3e62d8=_0x4a3f9a;if(!_0x3e62d8||!_0x3e62d8[_0x48ff('0x51')])return;var _0x2a7342=_0x3e62d8['getSmtpOptions']();if(_0x582f61[_0x48ff('0x40')][_0x48ff('0x53')]&&_0x582f61[_0x48ff('0x40')]['attachments'][_0x48ff('0x33')]){for(var _0x35fb7c=0x0;_0x35fb7c<_0x582f61['body'][_0x48ff('0x53')]['length'];_0x35fb7c+=0x1){_0x582f61['body'][_0x48ff('0x53')][_0x35fb7c]={'filename':_0x582f61[_0x48ff('0x40')]['attachments'][_0x35fb7c]['name'],'path':path[_0x48ff('0x54')](config[_0x48ff('0x55')],_0x48ff('0x56'),_0x582f61[_0x48ff('0x40')]['attachments'][_0x35fb7c][_0x48ff('0x57')])};}}_0x1f7a61={'account':_0x2a7342,'message':_0x582f61[_0x48ff('0x40')]};return;})[_0x48ff('0x11')](function(){if(_0x3e62d8['List']){if(_0x3e62d8[_0x48ff('0x4d')][_0x48ff('0x58')][_0x48ff('0x33')]){return _0x3e62d8['List'][_0x48ff('0x58')][0x0];}else{return db[_0x48ff('0x4e')][_0x48ff('0x44')](_[_0x48ff('0x59')](_0x582f61['body'],{'firstName':_0x582f61[_0x48ff('0x40')]['to'],'email':_0x582f61[_0x48ff('0x40')]['to'],'phone':_0x582f61[_0x48ff('0x40')]['to'],'ListId':_0x3e62d8[_0x48ff('0x5a')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x48ff('0x11')](function(){if(_0x1f7a61){return respondWithRpcPromise(_0x48ff('0x5b'),_0x48ff('0x5c'),_0x1f7a61,client9003)[_0x48ff('0x11')](function(_0x509b0b){return _0x16b3e2[_0x48ff('0x22')]({'read':!![],'messageId':_0x509b0b[_0x48ff('0x5d')],'sentAt':moment()[_0x48ff('0x5e')](_0x48ff('0x5f'))});})[_0x48ff('0x1a')](function(_0x43b9a0){logger['error']('%s',JSON[_0x48ff('0x60')](_0x43b9a0));return _0x16b3e2;});}return _0x16b3e2;});}return _0x16b3e2;}})['then'](respondWithResult(_0x4bba1c,0xc9))[_0x48ff('0x1a')](handleError(_0x4bba1c,null));};exports['accept']=function(_0x23abbe,_0x3fcafd){var _0x3b612a={'agent':{},'channel':_0x48ff('0x61')};if(_0x23abbe['body']['id']){delete _0x23abbe['body']['id'];}_0x23abbe[_0x48ff('0x40')][_0x48ff('0x62')]=!![];_0x23abbe[_0x48ff('0x40')]['readAt']=moment()[_0x48ff('0x5e')](_0x48ff('0x5f'));_0x23abbe['body'][_0x48ff('0x63')]=_0x23abbe[_0x48ff('0x40')][_0x48ff('0x63')]||_0x23abbe[_0x48ff('0x64')]['id'];_0x3b612a['agent']['id']=_0x23abbe[_0x48ff('0x40')]['UserId'];return db[_0x48ff('0x3c')][_0x48ff('0x41')]({'where':{'id':_0x23abbe[_0x48ff('0x42')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3fcafd,null))[_0x48ff('0x11')](saveUpdates(_0x23abbe[_0x48ff('0x40')],null))[_0x48ff('0x11')](function(_0xcbdcb1){if(_0xcbdcb1){_0x3b612a[_0x48ff('0x18')]=_0xcbdcb1['get']({'plain':!![]});return db['MailInteraction'][_0x48ff('0x41')]({'where':{'id':_0xcbdcb1['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x3fcafd,null))[_0x48ff('0x11')](function(_0x563464){if(_0x563464){return _0x563464[_0x48ff('0x22')]({'UserId':_0x23abbe['body'][_0x48ff('0x63')],'read1stAt':_['isNil'](_0x563464[_0x48ff('0x65')])?moment()[_0x48ff('0x5e')](_0x48ff('0x5f')):undefined});}return null;})[_0x48ff('0x11')](function(_0x4a9462){if(_0x4a9462){_0x3b612a[_0x48ff('0x66')]=_0x4a9462[_0x48ff('0x67')]({'plain':!![]});interaction_log[_0x48ff('0x12')](_0x48ff('0x68'),_0x23abbe['user']['id'],_0x23abbe['user'][_0x48ff('0x25')],_0x23abbe[_0x48ff('0x64')][_0x48ff('0x69')],_0x3b612a['interaction']['id'],_0x23abbe[_0x48ff('0x40')]?JSON[_0x48ff('0x60')](_0x23abbe[_0x48ff('0x40')]):'null');return respondWithRpcPromise(_0x48ff('0x6a'),_0x48ff('0x6b'),_0x3b612a);}return null;})[_0x48ff('0x11')](function(_0x382f01){var _0x500042=_0x48ff('0x6c')+_0x382f01[_0x48ff('0x18')][_0x48ff('0x6d')];return db[_0x48ff('0x6e')][_0x48ff('0x2d')](_0x500042,{'type':db['Sequelize'][_0x48ff('0x6f')][_0x48ff('0x70')],'raw':!![]})[_0x48ff('0x11')](function(_0x1b0010){return _0x1b0010;});})[_0x48ff('0x11')](function(_0x1a7f25){if(_0x1a7f25){_0x3b612a['message']['contact']=_0x1a7f25[0x0];if(!_0x23abbe['body'][_0x48ff('0x63')])return;return db[_0x48ff('0x71')][_0x48ff('0x41')]({'where':{'id':_0x23abbe['body'][_0x48ff('0x63')],'role':_0x48ff('0x72')},'attributes':['id',_0x48ff('0x25'),_0x48ff('0x73'),_0x48ff('0x74'),_0x48ff('0x75')],'raw':!![]});}return null;})['then'](function(_0x1093d4){if(!_0x1093d4)return null;_0x3b612a['message'][_0x48ff('0x72')]=_0x1093d4;return _0x3b612a;})[_0x48ff('0x11')](function(_0x4184a4){if(_0x4184a4){if(_0x23abbe[_0x48ff('0x40')]['manual']){_0x3b612a['message']['interface']=util[_0x48ff('0x5e')]('SIP/%s',_0x23abbe[_0x48ff('0x64')][_0x48ff('0x25')]);_0x3b612a[_0x48ff('0x18')]['channel']=_0x3b612a[_0x48ff('0x76')];_0x3b612a['message'][_0x48ff('0x77')]=_0x3b612a[_0x48ff('0x76')];_0x3b612a[_0x48ff('0x18')][_0x48ff('0x78')]=_0x48ff('0x79');_0x3b612a[_0x48ff('0x18')][_0x48ff('0x40')]=htmlToText[_0x48ff('0x7a')](_0x3b612a[_0x48ff('0x18')]['body']);return respondWithRpcPromise(_0x48ff('0x7b'),_0x48ff('0x7b'),{'event':_0x48ff('0x7c'),'message':_0x3b612a[_0x48ff('0x18')]},client9002)['then'](function(){return _0x3b612a;});}return _0x3b612a;}return null;})[_0x48ff('0x11')](respondWithResult(_0x3fcafd,null))[_0x48ff('0x1a')](handleError(_0x3fcafd,null));};exports[_0x48ff('0x7d')]=function(_0x32287f,_0x56df01){var _0xd45fda={'agent':{},'channel':'mail'};if(_0x32287f['body']['id']){delete _0x32287f['body']['id'];}_0x32287f['body']['UserId']=_0x32287f[_0x48ff('0x40')][_0x48ff('0x63')]||_0x32287f[_0x48ff('0x64')]['id'];_0xd45fda['agent']['id']=_0x32287f['body'][_0x48ff('0x63')];return db[_0x48ff('0x3c')]['find']({'where':{'id':_0x32287f[_0x48ff('0x42')]['id'],'UserId':null}})[_0x48ff('0x11')](handleEntityNotFound(_0x56df01,null))[_0x48ff('0x11')](function(_0x1a1e8f){if(_0x1a1e8f){_0xd45fda[_0x48ff('0x18')]=_0x1a1e8f[_0x48ff('0x67')]({'plain':!![]});return db['MailInteraction'][_0x48ff('0x41')]({'where':{'id':_0x1a1e8f[_0x48ff('0x7e')]}});}return null;})[_0x48ff('0x11')](handleEntityNotFound(_0x56df01,null))[_0x48ff('0x11')](function(_0x430c09){if(_0x430c09){_0xd45fda[_0x48ff('0x66')]=_0x430c09[_0x48ff('0x67')]({'plain':!![]});interaction_log['info'](_0x48ff('0x7f'),_0x32287f['user']['id'],_0x32287f['user'][_0x48ff('0x25')],_0x32287f[_0x48ff('0x64')][_0x48ff('0x69')],_0xd45fda[_0x48ff('0x66')]['id'],_0x32287f[_0x48ff('0x40')]?JSON[_0x48ff('0x60')](_0x32287f[_0x48ff('0x40')]):_0x48ff('0x80'));return respondWithRpcPromise('RejectMessage',_0x48ff('0x81'),_0xd45fda);}return null;})[_0x48ff('0x11')](function(_0xff46d8){var _0x274a2d=_0x48ff('0x6c')+_0xff46d8['message'][_0x48ff('0x6d')];return db[_0x48ff('0x6e')]['query'](_0x274a2d,{'type':db['Sequelize'][_0x48ff('0x6f')]['SELECT'],'raw':!![]})[_0x48ff('0x11')](function(_0x50ec1e){return _0x50ec1e;});})['then'](function(_0x2912ff){if(_0x2912ff){_0xd45fda[_0x48ff('0x18')]['contact']=_0x2912ff[0x0];if(!_0x32287f['body'][_0x48ff('0x63')])return;return db[_0x48ff('0x71')]['find']({'where':{'id':_0x32287f['body'][_0x48ff('0x63')],'role':_0x48ff('0x72')},'attributes':['id','name',_0x48ff('0x73'),_0x48ff('0x74'),_0x48ff('0x75')],'raw':!![]});}return null;})[_0x48ff('0x11')](function(_0x22ea04){if(!_0x22ea04)return null;_0xd45fda[_0x48ff('0x18')]['agent']=_0x22ea04;return _0xd45fda;})[_0x48ff('0x11')](function(_0xe5fc2d){if(_0xe5fc2d){_0xe5fc2d[_0x48ff('0x18')][_0x48ff('0x82')]=util[_0x48ff('0x5e')](_0x48ff('0x83'),_0x32287f[_0x48ff('0x64')]['name']);_0xe5fc2d[_0x48ff('0x18')][_0x48ff('0x76')]=_0xd45fda['channel'];_0xe5fc2d['message'][_0x48ff('0x77')]=_0xd45fda[_0x48ff('0x76')];_0xe5fc2d[_0x48ff('0x18')][_0x48ff('0x78')]=_0x48ff('0x7d');_0xe5fc2d[_0x48ff('0x18')]['body']=htmlToText['fromString'](_0xd45fda[_0x48ff('0x18')]['body']);respondWithRpcPromise(_0x48ff('0x7b'),_0x48ff('0x7b'),{'event':_0x48ff('0x84'),'message':_0xe5fc2d['message']},client9002);return _0xd45fda;}return null;})[_0x48ff('0x11')](respondWithResult(_0x56df01,null))[_0x48ff('0x1a')](handleError(_0x56df01,null));};exports[_0x48ff('0x85')]=function(_0xefe80c,_0x57442c){var _0x5043a5=moment()['unix']()[_0x48ff('0x86')]();var _0x11b450=path[_0x48ff('0x54')](config['root'],'server',_0x48ff('0x87'),'tmp');var _0x276856=path[_0x48ff('0x54')](config[_0x48ff('0x55')],_0x48ff('0x88'),_0x48ff('0x87'),_0x48ff('0x53'));var _0x8ca5bc=util[_0x48ff('0x5e')](_0x48ff('0x89'),_0x5043a5);return db[_0x48ff('0x3c')][_0x48ff('0x41')]({'where':{'id':_0xefe80c[_0x48ff('0x42')]['id']},'attributes':['id',_0x48ff('0x40'),_0x48ff('0x8a'),'to','cc',_0x48ff('0x8b'),_0x48ff('0x8c'),_0x48ff('0x8d')],'include':_0xefe80c[_0x48ff('0x2d')]['attachments']?[{'model':db[_0x48ff('0x8e')],'as':_0x48ff('0x8f')}]:undefined})[_0x48ff('0x11')](handleEntityNotFound(_0x57442c,null))[_0x48ff('0x11')](function(_0x579ebb){if(_0x579ebb){var _0x25c44b=_0x579ebb;var _0x2c7d96={'from':_0x25c44b[_0x48ff('0x8a')],'to':_0x25c44b['to'],'subject':_0x25c44b[_0x48ff('0x8c')],'html':htmlEntities[_0x48ff('0x90')](_0x25c44b['body']),'headers':{'Date':moment(_0x25c44b[_0x48ff('0x8d')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x579ebb['cc']){_0x2c7d96[_0x48ff('0x91')]['Cc']=_0x579ebb['cc'];}if(_0x579ebb['bcc']){_0x2c7d96['headers'][_0x48ff('0x92')]=_0x579ebb[_0x48ff('0x8b')];}return new BPromise(function(_0x4dd972,_0xb28bcf){if(_0x579ebb['Attachments']){for(var _0x166c92=0x0;_0x166c92<_0x579ebb[_0x48ff('0x8f')][_0x48ff('0x33')];_0x166c92++){var _0x51b038=_0x579ebb[_0x48ff('0x8f')][_0x166c92];var _0x179616=path['join'](_0x276856,_0x51b038['basename']);if(fs['existsSync'](_0x179616)){_0x2c7d96[_0x48ff('0x53')][_0x48ff('0x93')]({'name':_0x51b038['name'],'contentType':_0x51b038[_0x48ff('0x94')],'data':fs[_0x48ff('0x95')](_0x179616)});}}}emlformat[_0x48ff('0x96')](_0x2c7d96,function(_0x3fb08a,_0x6888a9){if(_0x3fb08a)return _0xb28bcf(_0x3fb08a);fs[_0x48ff('0x97')](path[_0x48ff('0x54')](_0x11b450,_0x8ca5bc),_0x6888a9);return _0x4dd972(_0x6888a9);});});}})[_0x48ff('0x11')](function(_0x116d3b){if(_0x116d3b){return _0x57442c['download'](path[_0x48ff('0x54')](_0x11b450,_0x8ca5bc),_0x8ca5bc,function(_0x3847ad){if(!_0x3847ad)fs[_0x48ff('0x98')](path[_0x48ff('0x54')](_0x11b450,_0x8ca5bc));});}})['catch'](handleError(_0x57442c,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 40df0b2..b8da64b 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 _0xe4d6=['update','remove','emit','exports','events','../../mysqldb','MailMessage'];(function(_0x4fde0b,_0x4b4289){var _0x3f3b38=function(_0x5e4d17){while(--_0x5e4d17){_0x4fde0b['push'](_0x4fde0b['shift']());}};_0x3f3b38(++_0x4b4289);}(_0xe4d6,0x100));var _0x6e4d=function(_0x11d738,_0x5bff63){_0x11d738=_0x11d738-0x0;var _0x11ab52=_0xe4d6[_0x11d738];return _0x11ab52;};'use strict';var EventEmitter=require(_0x6e4d('0x0'));var MailMessage=require(_0x6e4d('0x1'))['db'][_0x6e4d('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6e4d('0x3'),'afterDestroy':_0x6e4d('0x4')};function emitEvent(_0x2776e3){return function(_0x1c5409,_0x1f3b98,_0x16590e){MailMessageEvents[_0x6e4d('0x5')](_0x2776e3+':'+_0x1c5409['id'],_0x1c5409);MailMessageEvents[_0x6e4d('0x5')](_0x2776e3,_0x1c5409);_0x16590e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x6e4d('0x6')]=MailMessageEvents; \ No newline at end of file +var _0x2216=['update','remove','hasOwnProperty','hook','events','../../mysqldb','MailMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2216,0x9e));var _0x6221=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2216[_0xbca1b1];return _0x4e1686;};'use strict';var EventEmitter=require(_0x6221('0x0'));var MailMessage=require(_0x6221('0x1'))['db'][_0x6221('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x6221('0x3'),'afterDestroy':_0x6221('0x4')};function emitEvent(_0x1e3e6b){return function(_0x45fe4d,_0x5b77be,_0x41a242){MailMessageEvents['emit'](_0x1e3e6b+':'+_0x45fe4d['id'],_0x45fe4d);MailMessageEvents['emit'](_0x1e3e6b,_0x45fe4d);_0x41a242(null);};}for(var e in events){if(events[_0x6221('0x5')](e)){var event=events[e];MailMessage[_0x6221('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index d5d6f07..3d951b9 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 _0x3c76=['subject','FULLTEXT','fromString','body','models','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','then','createdAt','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','request-promise','rimraf','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','plainBody'];(function(_0x2b2fd2,_0x3058e9){var _0x53c6d2=function(_0x32a654){while(--_0x32a654){_0x2b2fd2['push'](_0x2b2fd2['shift']());}};_0x53c6d2(++_0x3058e9);}(_0x3c76,0x161));var _0x63c7=function(_0x16467f,_0x8426ef){_0x16467f=_0x16467f-0x0;var _0xfaf0e4=_0x3c76[_0x16467f];return _0xfaf0e4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x63c7('0x0'))('api');var moment=require(_0x63c7('0x1'));var BPromise=require(_0x63c7('0x2'));var rp=require(_0x63c7('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0x63c7('0x4'));var config=require('../../config/environment');var attributes=require(_0x63c7('0x5'));module[_0x63c7('0x6')]=function(_0x468ef1,_0x234cac){return _0x468ef1['define'](_0x63c7('0x7'),attributes,{'tableName':_0x63c7('0x8'),'paranoid':![],'indexes':[{'name':_0x63c7('0x9'),'fields':[_0x63c7('0x9')]},{'name':'fti_mail_messages','fields':[_0x63c7('0xa'),_0x63c7('0xb')],'type':_0x63c7('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x16bf29,_0x52af26,_0x455b7d){if(_0x16bf29['body']){_0x16bf29[_0x63c7('0xa')]=htmlToText[_0x63c7('0xd')](_0x16bf29[_0x63c7('0xe')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x455b7d(null,_0x52af26);},'afterCreate':function(_0x372cb4,_0x5e0a80,_0x5a66d3){var _0x36bc95=_0x468ef1[_0x63c7('0xf')];var _0x1200c2=_0x372cb4[_0x63c7('0x10')]({'plain':!![]});if(_0x1200c2[_0x63c7('0x11')][_0x63c7('0x12')]()==='in'||_0x1200c2[_0x63c7('0x11')][_0x63c7('0x12')]()===_0x63c7('0x13')&&!_0x1200c2[_0x63c7('0x14')]&&!_[_0x63c7('0x15')](_0x1200c2[_0x63c7('0x16')])){_0x36bc95[_0x63c7('0x17')]['findOne']({'where':{'id':_0x1200c2['MailInteractionId']}})[_0x63c7('0x18')](function(_0x5bbf78){if(_0x5bbf78){_0x5bbf78['update']({'lastMsgAt':_0x1200c2[_0x63c7('0x19')],'lastMsgDirection':_0x1200c2[_0x63c7('0x11')][_0x63c7('0x12')]()});}})['catch'](function(_0x3178f7){console['error'](_0x3178f7);});}_0x5a66d3();}},'charset':_0x63c7('0x1a'),'collate':_0x63c7('0x1b')});}; \ No newline at end of file +var _0x8124=['./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','body','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','MailInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','html-to-text','path','rimraf','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8124,0x1e6));var _0x4812=function(_0x5a26d1,_0x1b1d20){_0x5a26d1=_0x5a26d1-0x0;var _0x460dd8=_0x8124[_0x5a26d1];return _0x460dd8;};'use strict';var _=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var logger=require(_0x4812('0x2'))('api');var moment=require(_0x4812('0x3'));var BPromise=require(_0x4812('0x4'));var rp=require('request-promise');var htmlToText=require(_0x4812('0x5'));var fs=require('fs');var path=require(_0x4812('0x6'));var rimraf=require(_0x4812('0x7'));var config=require(_0x4812('0x8'));var attributes=require(_0x4812('0x9'));module[_0x4812('0xa')]=function(_0x1c69e1,_0x2d5419){return _0x1c69e1[_0x4812('0xb')]('MailMessage',attributes,{'tableName':_0x4812('0xc'),'paranoid':![],'indexes':[{'name':_0x4812('0xd'),'fields':[_0x4812('0xd')]},{'name':_0x4812('0xe'),'fields':['plainBody',_0x4812('0xf')],'type':_0x4812('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24f366,_0x13a068,_0x29ab1b){if(_0x24f366[_0x4812('0x11')]){_0x24f366['plainBody']=htmlToText['fromString'](_0x24f366[_0x4812('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x29ab1b(null,_0x13a068);},'afterCreate':function(_0xea50b,_0x5e1fa7,_0x4010ba){var _0x1a95b9=_0x1c69e1['models'];var _0x5aca75=_0xea50b[_0x4812('0x12')]({'plain':!![]});if(_0x5aca75[_0x4812('0x13')][_0x4812('0x14')]()==='in'||_0x5aca75['direction']['toLowerCase']()===_0x4812('0x15')&&!_0x5aca75[_0x4812('0x16')]&&!_[_0x4812('0x17')](_0x5aca75['UserId'])){_0x1a95b9[_0x4812('0x18')][_0x4812('0x19')]({'where':{'id':_0x5aca75[_0x4812('0x1a')]}})[_0x4812('0x1b')](function(_0x26149f){if(_0x26149f){_0x26149f['update']({'lastMsgAt':_0x5aca75[_0x4812('0x1c')],'lastMsgDirection':_0x5aca75[_0x4812('0x13')][_0x4812('0x14')]()});}})[_0x4812('0x1d')](function(_0x44489d){console[_0x4812('0x1e')](_0x44489d);});}_0x4010ba();}},'charset':_0x4812('0x1f'),'collate':_0x4812('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index fdfd22f..9ad91cb 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 _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(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});config[_0xaa30('0xb')]=_[_0xaa30('0xc')](config[_0xaa30('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0xd'))(new Redis(config[_0xaa30('0xb')]));require(_0xaa30('0xe'))[_0xaa30('0xf')](socket);function respondWithRpcPromise(_0x14a6a6,_0x45419f,_0x56f686){return new BPromise(function(_0x5afbf5,_0x12a8ce){return client['request'](_0x14a6a6,_0x56f686)[_0xaa30('0x10')](function(_0x1a5681){logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');logger[_0xaa30('0x13')](_0xaa30('0x14'),_0x45419f,_0xaa30('0x15'),JSON['stringify'](_0x1a5681));if(_0x1a5681[_0xaa30('0x16')]){if(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x17')]===0x1f4){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);return _0x12a8ce(_0x1a5681[_0xaa30('0x16')][_0xaa30('0x18')]);}logger[_0xaa30('0x16')]('MailMessage,\x20%s,\x20%s',_0x45419f,_0x1a5681[_0xaa30('0x16')]['message']);return _0x5afbf5(_0x1a5681['error'][_0xaa30('0x18')]);}else{logger[_0xaa30('0x11')](_0xaa30('0x12'),_0x45419f,'request\x20sent');_0x5afbf5(_0x1a5681['result']['message']);}})[_0xaa30('0x19')](function(_0x4acdfa){logger[_0xaa30('0x16')](_0xaa30('0x12'),_0x45419f,_0x4acdfa);_0x12a8ce(_0x4acdfa);});});}exports['CreateMailMessage']=function(_0x4e29f9){var _0x520abb=this;return new Promise(function(_0x3cbf92,_0x3e4f1d){return db[_0xaa30('0x1a')][_0xaa30('0x1b')](_0x4e29f9[_0xaa30('0x1c')],{'raw':_0x4e29f9['options']?_0x4e29f9[_0xaa30('0x1d')][_0xaa30('0x1e')]===undefined?!![]:![]:!![]})[_0xaa30('0x10')](function(_0x2d9e35){logger[_0xaa30('0x11')]('CreateMailMessage',_0x4e29f9);logger[_0xaa30('0x13')](_0xaa30('0x1f'),_0x4e29f9,JSON[_0xaa30('0x20')](_0x2d9e35));_0x3cbf92(_0x2d9e35);})[_0xaa30('0x19')](function(_0x57d1ca){logger[_0xaa30('0x16')](_0xaa30('0x1f'),_0x57d1ca[_0xaa30('0x18')],_0x4e29f9);_0x3e4f1d(_0x520abb[_0xaa30('0x16')](0x1f4,_0x57d1ca[_0xaa30('0x18')]));});});}; \ No newline at end of file +var _0x1775=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x1775,0x1db));var _0x5177=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1775[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0x5177('0x0'));var moment=require(_0x5177('0x1'));var BPromise=require(_0x5177('0x2'));var rs=require(_0x5177('0x3'));var fs=require('fs');var Redis=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var utils=require(_0x5177('0x6'));var logger=require(_0x5177('0x7'))(_0x5177('0x8'));var config=require(_0x5177('0x9'));var jayson=require(_0x5177('0xa'));var client=jayson[_0x5177('0xb')][_0x5177('0xc')]({'port':0x232a});config[_0x5177('0xd')]=_[_0x5177('0xe')](config[_0x5177('0xd')],{'host':_0x5177('0xf'),'port':0x18eb});var socket=require(_0x5177('0x10'))(new Redis(config[_0x5177('0xd')]));require(_0x5177('0x11'))[_0x5177('0x12')](socket);function respondWithRpcPromise(_0x206035,_0x5bdca9,_0x4ae3d2){return new BPromise(function(_0x13c7f6,_0x1d7116){return client[_0x5177('0x13')](_0x206035,_0x4ae3d2)[_0x5177('0x14')](function(_0x301db2){logger['info'](_0x5177('0x15'),_0x5bdca9,_0x5177('0x16'));logger[_0x5177('0x17')](_0x5177('0x18'),_0x5bdca9,_0x5177('0x16'),JSON[_0x5177('0x19')](_0x301db2));if(_0x301db2[_0x5177('0x1a')]){if(_0x301db2[_0x5177('0x1a')][_0x5177('0x1b')]===0x1f4){logger[_0x5177('0x1a')](_0x5177('0x15'),_0x5bdca9,_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);return _0x1d7116(_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);}logger[_0x5177('0x1a')](_0x5177('0x15'),_0x5bdca9,_0x301db2[_0x5177('0x1a')][_0x5177('0x1c')]);return _0x13c7f6(_0x301db2['error'][_0x5177('0x1c')]);}else{logger[_0x5177('0x1d')](_0x5177('0x15'),_0x5bdca9,_0x5177('0x16'));_0x13c7f6(_0x301db2['result'][_0x5177('0x1c')]);}})[_0x5177('0x1e')](function(_0x13d5d4){logger['error'](_0x5177('0x15'),_0x5bdca9,_0x13d5d4);_0x1d7116(_0x13d5d4);});});}exports['CreateMailMessage']=function(_0xc2b2b5){var _0xe221b3=this;return new Promise(function(_0x219744,_0x27b732){return db[_0x5177('0x1f')][_0x5177('0x20')](_0xc2b2b5[_0x5177('0x21')],{'raw':_0xc2b2b5[_0x5177('0x22')]?_0xc2b2b5[_0x5177('0x22')][_0x5177('0x23')]===undefined?!![]:![]:!![]})[_0x5177('0x14')](function(_0x3b0c37){logger['info'](_0x5177('0x24'),_0xc2b2b5);logger['debug'](_0x5177('0x24'),_0xc2b2b5,JSON[_0x5177('0x19')](_0x3b0c37));_0x219744(_0x3b0c37);})[_0x5177('0x1e')](function(_0x2d51d0){logger['error'](_0x5177('0x24'),_0x2d51d0['message'],_0xc2b2b5);_0x27b732(_0xe221b3['error'](0x1f4,_0x2d51d0[_0x5177('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 0e792e3..595e576 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 _0x0b8f=['./mailMessage.events','remove','update','emit','removeListener','register'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x0b8f,0x174));var _0xf0b8=function(_0x4c583c,_0x2b543f){_0x4c583c=_0x4c583c-0x0;var _0x5b1361=_0x0b8f[_0x4c583c];return _0x5b1361;};'use strict';var MailMessageEvents=require(_0xf0b8('0x0'));var events=['save',_0xf0b8('0x1'),_0xf0b8('0x2')];function createListener(_0x2b0a3d,_0x1dd890){return function(_0x3f9ea9){_0x1dd890[_0xf0b8('0x3')](_0x2b0a3d,_0x3f9ea9);};}function removeListener(_0x2f0e03,_0x3de089){return function(){MailMessageEvents[_0xf0b8('0x4')](_0x2f0e03,_0x3de089);};}exports[_0xf0b8('0x5')]=function(_0x30847e){for(var _0x4c2e2e=0x0,_0x58fef4=events['length'];_0x4c2e2e<_0x58fef4;_0x4c2e2e++){var _0x4a1101=events[_0x4c2e2e];var _0x5cee2d=createListener('mailMessage:'+_0x4a1101,_0x30847e);MailMessageEvents['on'](_0x4a1101,_0x5cee2d);}}; \ No newline at end of file +var _0xcf73=['remove','emit','removeListener','register','length','mailMessage:'];(function(_0x32ea16,_0x553e9f){var _0x2c38d3=function(_0x167f87){while(--_0x167f87){_0x32ea16['push'](_0x32ea16['shift']());}};_0x2c38d3(++_0x553e9f);}(_0xcf73,0x15c));var _0x3cf7=function(_0x2d4304,_0xa50ea9){_0x2d4304=_0x2d4304-0x0;var _0x13749a=_0xcf73[_0x2d4304];return _0x13749a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=['save',_0x3cf7('0x0'),'update'];function createListener(_0x51997c,_0x263376){return function(_0x1e1306){_0x263376[_0x3cf7('0x1')](_0x51997c,_0x1e1306);};}function removeListener(_0xc66f5e,_0x2585a6){return function(){MailMessageEvents[_0x3cf7('0x2')](_0xc66f5e,_0x2585a6);};}exports[_0x3cf7('0x3')]=function(_0x207292){for(var _0x5e68bb=0x0,_0x52e4a4=events[_0x3cf7('0x4')];_0x5e68bb<_0x52e4a4;_0x5e68bb++){var _0x567da2=events[_0x5e68bb];var _0x31dc23=createListener(_0x3cf7('0x5')+_0x567da2,_0x207292);MailMessageEvents['on'](_0x567da2,_0x31dc23);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 3a2daac..0676e5b 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 _0x66b8=['multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailQueue.controller','isAuthenticated','get','/describe','describe','/:id','show','/:id/members','/:id/teams','post','/:id/users','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x66b8,0xfa));var _0x866b=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x66b8[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x866b('0x0'));var util=require('util');var path=require(_0x866b('0x1'));var timeout=require(_0x866b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x866b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x866b('0x4'));var config=require(_0x866b('0x5'));var controller=require(_0x866b('0x6'));router['get']('/',auth[_0x866b('0x7')](),controller['index']);router[_0x866b('0x8')](_0x866b('0x9'),auth[_0x866b('0x7')](),controller[_0x866b('0xa')]);router['get'](_0x866b('0xb'),auth[_0x866b('0x7')](),controller[_0x866b('0xc')]);router['get'](_0x866b('0xd'),auth[_0x866b('0x7')](),controller['getMembers']);router[_0x866b('0x8')](_0x866b('0xe'),auth[_0x866b('0x7')](),controller['getTeams']);router[_0x866b('0x8')]('/:id/users',auth[_0x866b('0x7')](),controller['getAgents']);router[_0x866b('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x866b('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x866b('0xf')](_0x866b('0x10'),auth[_0x866b('0x7')](),controller[_0x866b('0x11')]);router[_0x866b('0x12')](_0x866b('0xb'),auth[_0x866b('0x7')](),controller[_0x866b('0x13')]);router[_0x866b('0x14')](_0x866b('0xb'),auth[_0x866b('0x7')](),controller[_0x866b('0x15')]);router[_0x866b('0x14')](_0x866b('0xe'),auth['isAuthenticated'](),controller[_0x866b('0x16')]);router[_0x866b('0x14')](_0x866b('0x10'),auth[_0x866b('0x7')](),controller[_0x866b('0x17')]);module[_0x866b('0x18')]=router; \ No newline at end of file +var _0x218e=['/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','connect-timeout','express','fs-extra','./mailQueue.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers'];(function(_0x313df7,_0x236364){var _0x220cce=function(_0x49b557){while(--_0x49b557){_0x313df7['push'](_0x313df7['shift']());}};_0x220cce(++_0x236364);}(_0x218e,0x71));var _0xe218=function(_0x1acc39,_0x3a8b1b){_0x1acc39=_0x1acc39-0x0;var _0x7d78ef=_0x218e[_0x1acc39];return _0x7d78ef;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe218('0x0'));var express=require(_0xe218('0x1'));var router=express['Router']();var fs_extra=require(_0xe218('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe218('0x3'));router[_0xe218('0x4')]('/',auth['isAuthenticated'](),controller[_0xe218('0x5')]);router[_0xe218('0x4')](_0xe218('0x6'),auth[_0xe218('0x7')](),controller['describe']);router[_0xe218('0x4')](_0xe218('0x8'),auth[_0xe218('0x7')](),controller[_0xe218('0x9')]);router[_0xe218('0x4')](_0xe218('0xa'),auth[_0xe218('0x7')](),controller[_0xe218('0xb')]);router[_0xe218('0x4')](_0xe218('0xc'),auth[_0xe218('0x7')](),controller[_0xe218('0xd')]);router[_0xe218('0x4')](_0xe218('0xe'),auth[_0xe218('0x7')](),controller['getAgents']);router[_0xe218('0xf')]('/',auth[_0xe218('0x7')](),controller[_0xe218('0x10')]);router[_0xe218('0xf')]('/:id/teams',auth[_0xe218('0x7')](),controller[_0xe218('0x11')]);router['post'](_0xe218('0xe'),auth[_0xe218('0x7')](),controller[_0xe218('0x12')]);router[_0xe218('0x13')](_0xe218('0x8'),auth['isAuthenticated'](),controller[_0xe218('0x14')]);router[_0xe218('0x15')](_0xe218('0x8'),auth['isAuthenticated'](),controller[_0xe218('0x16')]);router['delete'](_0xe218('0xc'),auth[_0xe218('0x7')](),controller[_0xe218('0x17')]);router[_0xe218('0x15')](_0xe218('0xe'),auth[_0xe218('0x7')](),controller[_0xe218('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 451ab2d..6a33123 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 _0xd883=['name','INTEGER','ENUM','rrmemory','beepall','roundrobin','STRING'];(function(_0x4eedf7,_0x391dd3){var _0x4e2294=function(_0x29eb94){while(--_0x29eb94){_0x4eedf7['push'](_0x4eedf7['shift']());}};_0x4e2294(++_0x391dd3);}(_0xd883,0x1b1));var _0x3d88=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xd883[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3d88('0x0')],'unique':_0x3d88('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3d88('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x3d88('0x3')](_0x3d88('0x4'),_0x3d88('0x5'),_0x3d88('0x6'))}}; \ No newline at end of file +var _0x5ee1=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0x20a3d2,_0x1fa558){var _0x22693a=function(_0x45de64){while(--_0x45de64){_0x20a3d2['push'](_0x20a3d2['shift']());}};_0x22693a(++_0x1fa558);}(_0x5ee1,0xe1));var _0x15ee=function(_0x56488e,_0x539b6a){_0x56488e=_0x56488e-0x0;var _0x274bf8=_0x5ee1[_0x56488e];return _0x274bf8;};'use strict';var Sequelize=require(_0x15ee('0x0'));module[_0x15ee('0x1')]={'name':{'type':Sequelize[_0x15ee('0x2')],'unique':_0x15ee('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x15ee('0x2')]},'timeout':{'type':Sequelize[_0x15ee('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x15ee('0x5')](_0x15ee('0x6'),_0x15ee('0x7'),_0x15ee('0x8'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 4ecb010..4222c08 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 _0x1928=['register','sendStatus','status','json','offset','undefined','limit','count','reject','update','destroy','then','get','MailQueues','UserProfileResource','end','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','include','findAll','rows','catch','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','body','params','describe','findOne','MailQueueId','filter','findAndCountAll','mailPause','createdAt','format','SIP','updatedAt','getTeams','Team','addTeams','ids','User','Agents','online','flatMap','transaction','each','UserMailQueue','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','addAgents','spread','isArray','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1928,0x183));var _0x8192=function(_0x24ff21,_0x20cdcc){_0x24ff21=_0x24ff21-0x0;var _0x777a7b=_0x1928[_0x24ff21];return _0x777a7b;};'use strict';var emlformat=require(_0x8192('0x0'));var rimraf=require(_0x8192('0x1'));var zipdir=require(_0x8192('0x2'));var jsonpatch=require(_0x8192('0x3'));var rp=require(_0x8192('0x4'));var moment=require(_0x8192('0x5'));var BPromise=require(_0x8192('0x6'));var Mustache=require(_0x8192('0x7'));var util=require(_0x8192('0x8'));var path=require(_0x8192('0x9'));var sox=require(_0x8192('0xa'));var csv=require(_0x8192('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8192('0xc'));var squel=require(_0x8192('0xd'));var crypto=require(_0x8192('0xe'));var jsforce=require(_0x8192('0xf'));var deskjs=require(_0x8192('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8192('0x11'));var Redis=require(_0x8192('0x12'));var authService=require(_0x8192('0x13'));var qs=require(_0x8192('0x14'));var as=require(_0x8192('0x15'));var hardwareService=require(_0x8192('0x16'));var logger=require(_0x8192('0x17'))(_0x8192('0x18'));var utils=require(_0x8192('0x19'));var config=require(_0x8192('0x1a'));var licenseUtil=require(_0x8192('0x1b'));var db=require('../../mysqldb')['db'];config[_0x8192('0x1c')]=_[_0x8192('0x1d')](config[_0x8192('0x1c')],{'host':_0x8192('0x1e'),'port':0x18eb});var socket=require(_0x8192('0x1f'))(new Redis(config[_0x8192('0x1c')]));require(_0x8192('0x20'))[_0x8192('0x21')](socket);function respondWithStatusCode(_0x476d96,_0x2058fd){_0x2058fd=_0x2058fd||0xcc;return function(_0x2b6c4a){if(_0x2b6c4a){return _0x476d96[_0x8192('0x22')](_0x2058fd);}return _0x476d96[_0x8192('0x23')](_0x2058fd)['end']();};}function respondWithResult(_0x571d90,_0x5de909){_0x5de909=_0x5de909||0xc8;return function(_0x1287df){if(_0x1287df){return _0x571d90[_0x8192('0x23')](_0x5de909)[_0x8192('0x24')](_0x1287df);}};}function respondWithFilteredResult(_0x517065,_0x276b36){return function(_0xcbfef6){if(_0xcbfef6){var _0x57927a=typeof _0x276b36[_0x8192('0x25')]===_0x8192('0x26')&&typeof _0x276b36[_0x8192('0x27')]===_0x8192('0x26');var _0xfb73a9=_0xcbfef6[_0x8192('0x28')];var _0x3f06f2=_0x57927a?0x0:_0x276b36[_0x8192('0x25')];var _0x2ea123=_0x57927a?_0xcbfef6[_0x8192('0x28')]:_0x276b36[_0x8192('0x25')]+_0x276b36[_0x8192('0x27')];var _0x256457;if(_0x2ea123>=_0xfb73a9){_0x2ea123=_0xfb73a9;_0x256457=0xc8;}else{_0x256457=0xce;}_0x517065[_0x8192('0x23')](_0x256457);return _0x517065['set']('Content-Range',_0x3f06f2+'-'+_0x2ea123+'/'+_0xfb73a9)[_0x8192('0x24')](_0xcbfef6);}return null;};}function patchUpdates(_0x14597a){return function(_0xecd07){try{jsonpatch['apply'](_0xecd07,_0x14597a,!![]);}catch(_0x29eb3e){return BPromise[_0x8192('0x29')](_0x29eb3e);}return _0xecd07['save']();};}function saveUpdates(_0x41d60e,_0x45f44e){return function(_0x3e6c2a){if(_0x3e6c2a){return _0x3e6c2a[_0x8192('0x2a')](_0x41d60e)['then'](function(_0x26213a){return _0x26213a;});}return null;};}function removeEntity(_0x1e577e,_0x5bd807){return function(_0x544196){if(_0x544196){return _0x544196[_0x8192('0x2b')]()[_0x8192('0x2c')](function(){var _0x5724c9=_0x544196[_0x8192('0x2d')]({'plain':!![]});var _0x36eb9b=_0x8192('0x2e');return db[_0x8192('0x2f')]['destroy']({'where':{'type':_0x36eb9b,'resourceId':_0x5724c9['id']}})[_0x8192('0x2c')](function(){return _0x544196;});})[_0x8192('0x2c')](function(){_0x1e577e[_0x8192('0x23')](0xcc)[_0x8192('0x30')]();});}};}function handleEntityNotFound(_0x3c9efa,_0x589413){return function(_0x53d7df){if(!_0x53d7df){_0x3c9efa[_0x8192('0x22')](0x194);}return _0x53d7df;};}function handleError(_0x5a791d,_0x361032){_0x361032=_0x361032||0x1f4;return function(_0x10095f){logger['error'](_0x10095f[_0x8192('0x31')]);if(_0x10095f[_0x8192('0x32')]){delete _0x10095f[_0x8192('0x32')];}_0x5a791d[_0x8192('0x23')](_0x361032)[_0x8192('0x33')](_0x10095f);};}exports[_0x8192('0x34')]=function(_0x2a1ce5,_0x4e33f0){var _0x2b610c={},_0x8098ba={},_0x4a652f={'count':0x0,'rows':[]};var _0x3bbd58=_[_0x8192('0x35')](db[_0x8192('0x36')][_0x8192('0x37')],function(_0x429e6b){return{'name':_0x429e6b[_0x8192('0x38')],'type':_0x429e6b[_0x8192('0x39')][_0x8192('0x3a')]};});_0x8098ba[_0x8192('0x3b')]=_[_0x8192('0x35')](_0x3bbd58,'name');_0x8098ba['query']=_[_0x8192('0x3c')](_0x2a1ce5[_0x8192('0x3d')]);_0x8098ba[_0x8192('0x3e')]=_[_0x8192('0x3f')](_0x8098ba[_0x8192('0x3b')],_0x8098ba[_0x8192('0x3d')]);_0x2b610c['attributes']=_[_0x8192('0x3f')](_0x8098ba['model'],qs[_0x8192('0x40')](_0x2a1ce5[_0x8192('0x3d')][_0x8192('0x40')]));_0x2b610c[_0x8192('0x41')]=_0x2b610c[_0x8192('0x41')][_0x8192('0x42')]?_0x2b610c[_0x8192('0x41')]:_0x8098ba[_0x8192('0x3b')];if(!_0x2a1ce5[_0x8192('0x3d')][_0x8192('0x43')](_0x8192('0x44'))){_0x2b610c[_0x8192('0x27')]=qs['limit'](_0x2a1ce5[_0x8192('0x3d')][_0x8192('0x27')]);_0x2b610c[_0x8192('0x25')]=qs[_0x8192('0x25')](_0x2a1ce5[_0x8192('0x3d')]['offset']);}_0x2b610c[_0x8192('0x45')]=qs[_0x8192('0x46')](_0x2a1ce5[_0x8192('0x3d')][_0x8192('0x46')]);_0x2b610c[_0x8192('0x47')]=qs['filters'](_[_0x8192('0x48')](_0x2a1ce5[_0x8192('0x3d')],_0x8098ba['filters']),_0x3bbd58);if(_0x2a1ce5[_0x8192('0x3d')]['filter']){_0x2b610c['where']=_[_0x8192('0x49')](_0x2b610c[_0x8192('0x47')],{'$or':_[_0x8192('0x35')](_0x3bbd58,function(_0x259e7a){if(_0x259e7a['type']!=='VIRTUAL'){var _0x377c30={};_0x377c30[_0x259e7a[_0x8192('0x32')]]={'$like':'%'+_0x2a1ce5[_0x8192('0x3d')]['filter']+'%'};return _0x377c30;}})});}_0x2b610c=_[_0x8192('0x49')]({},_0x2b610c,_0x2a1ce5['options']);var _0x473583={'where':_0x2b610c[_0x8192('0x47')]};return db[_0x8192('0x36')][_0x8192('0x28')](_0x473583)[_0x8192('0x2c')](function(_0x135d70){_0x4a652f[_0x8192('0x28')]=_0x135d70;if(_0x2a1ce5['query']['includeAll']){_0x2b610c[_0x8192('0x4a')]=[{'all':!![]}];}return db[_0x8192('0x36')][_0x8192('0x4b')](_0x2b610c);})[_0x8192('0x2c')](function(_0x4d08b3){_0x4a652f[_0x8192('0x4c')]=_0x4d08b3;return _0x4a652f;})[_0x8192('0x2c')](respondWithFilteredResult(_0x4e33f0,_0x2b610c))[_0x8192('0x4d')](handleError(_0x4e33f0,null));};exports['show']=function(_0x6d10db,_0x510bce){var _0x4418cf={'raw':!![],'where':{'id':_0x6d10db['params']['id']}},_0x4af99b={};_0x4af99b[_0x8192('0x3b')]=_[_0x8192('0x3c')](db['MailQueue'][_0x8192('0x37')]);_0x4af99b[_0x8192('0x3d')]=_[_0x8192('0x3c')](_0x6d10db['query']);_0x4af99b[_0x8192('0x3e')]=_[_0x8192('0x3f')](_0x4af99b['model'],_0x4af99b[_0x8192('0x3d')]);_0x4418cf[_0x8192('0x41')]=_[_0x8192('0x3f')](_0x4af99b[_0x8192('0x3b')],qs[_0x8192('0x40')](_0x6d10db[_0x8192('0x3d')][_0x8192('0x40')]));_0x4418cf[_0x8192('0x41')]=_0x4418cf[_0x8192('0x41')]['length']?_0x4418cf[_0x8192('0x41')]:_0x4af99b[_0x8192('0x3b')];if(_0x6d10db[_0x8192('0x3d')]['includeAll']){_0x4418cf[_0x8192('0x4a')]=[{'all':!![]}];}_0x4418cf=_[_0x8192('0x49')]({},_0x4418cf,_0x6d10db[_0x8192('0x4e')]);return db[_0x8192('0x36')][_0x8192('0x4f')](_0x4418cf)[_0x8192('0x2c')](handleEntityNotFound(_0x510bce,null))['then'](respondWithResult(_0x510bce,null))[_0x8192('0x4d')](handleError(_0x510bce,null));};exports['create']=function(_0x49962c,_0x103a2f){return db[_0x8192('0x36')][_0x8192('0x50')](_0x49962c['body'],{})[_0x8192('0x2c')](function(_0x569ea4){var _0x427e5d=_0x49962c[_0x8192('0x51')][_0x8192('0x2d')]({'plain':!![]});if(!_0x427e5d)throw new Error(_0x8192('0x52'));if(_0x427e5d[_0x8192('0x53')]==='user'){var _0x1952be=_0x569ea4['get']({'plain':!![]});var _0x1a8984=_0x8192('0x2e');return db[_0x8192('0x54')]['find']({'where':{'name':_0x1a8984,'userProfileId':_0x427e5d[_0x8192('0x55')]},'raw':!![]})[_0x8192('0x2c')](function(_0x4c971b){if(_0x4c971b&&_0x4c971b['autoAssociation']===0x0){return db[_0x8192('0x2f')][_0x8192('0x50')]({'name':_0x1952be[_0x8192('0x32')],'resourceId':_0x1952be['id'],'type':_0x4c971b[_0x8192('0x32')],'sectionId':_0x4c971b['id']},{})[_0x8192('0x2c')](function(){return _0x569ea4;});}else{return _0x569ea4;}})[_0x8192('0x4d')](function(_0x28a125){logger[_0x8192('0x56')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x28a125);throw _0x28a125;});}return _0x569ea4;})['then'](respondWithResult(_0x103a2f,0xc9))['catch'](handleError(_0x103a2f,null));};exports['update']=function(_0x5b478f,_0x3d5214){if(_0x5b478f['body']['id']){delete _0x5b478f[_0x8192('0x57')]['id'];}return db[_0x8192('0x36')][_0x8192('0x4f')]({'where':{'id':_0x5b478f[_0x8192('0x58')]['id']}})[_0x8192('0x2c')](handleEntityNotFound(_0x3d5214,null))[_0x8192('0x2c')](saveUpdates(_0x5b478f['body'],null))[_0x8192('0x2c')](respondWithResult(_0x3d5214,null))['catch'](handleError(_0x3d5214,null));};exports[_0x8192('0x2b')]=function(_0x5da768,_0x3888b9){return db[_0x8192('0x36')][_0x8192('0x4f')]({'where':{'id':_0x5da768['params']['id']}})[_0x8192('0x2c')](handleEntityNotFound(_0x3888b9,null))['then'](removeEntity(_0x3888b9,null))[_0x8192('0x4d')](handleError(_0x3888b9,null));};exports[_0x8192('0x59')]=function(_0x33e47b,_0x26f5df){return db['MailQueue'][_0x8192('0x59')]()[_0x8192('0x2c')](respondWithResult(_0x26f5df,null))[_0x8192('0x4d')](handleError(_0x26f5df,null));};exports['getMembers']=function(_0x10ea1e,_0x55434c,_0x3bba88){var _0x315622={'raw':!![],'where':{}},_0x53b204={},_0x42b351;return db[_0x8192('0x36')][_0x8192('0x5a')]({'where':{'id':_0x10ea1e[_0x8192('0x58')]['id']}})[_0x8192('0x2c')](handleEntityNotFound(_0x55434c,null))[_0x8192('0x2c')](function(_0x297773){if(_0x297773){_0x42b351=_0x297773[_0x8192('0x2d')]({'plain':!![]});_0x53b204[_0x8192('0x3b')]=_[_0x8192('0x3c')](db['UserMailQueue']['rawAttributes']);_0x53b204[_0x8192('0x3d')]=_[_0x8192('0x3c')](_0x10ea1e['query']);_0x53b204[_0x8192('0x3e')]=_[_0x8192('0x3f')](_0x53b204[_0x8192('0x3b')],_0x53b204[_0x8192('0x3d')]);_0x315622[_0x8192('0x41')]=_[_0x8192('0x3f')](_0x53b204['model'],qs['fields'](_0x10ea1e[_0x8192('0x3d')]['fields']));_0x315622[_0x8192('0x41')]=_0x315622[_0x8192('0x41')]['length']?_0x315622[_0x8192('0x41')]:_0x53b204['model'];if(!_0x10ea1e[_0x8192('0x3d')]['hasOwnProperty'](_0x8192('0x44'))){_0x315622[_0x8192('0x27')]=qs['limit'](_0x10ea1e[_0x8192('0x3d')][_0x8192('0x27')]);_0x315622['offset']=qs[_0x8192('0x25')](_0x10ea1e[_0x8192('0x3d')][_0x8192('0x25')]);}_0x315622[_0x8192('0x45')]=qs[_0x8192('0x46')](_0x10ea1e[_0x8192('0x3d')][_0x8192('0x46')]);_0x315622[_0x8192('0x47')]=qs[_0x8192('0x3e')](_[_0x8192('0x48')](_0x10ea1e['query'],_0x53b204['filters']));_0x315622['where'][_0x8192('0x5b')]=_0x297773['id'];if(_0x10ea1e['query'][_0x8192('0x5c')]){_0x315622[_0x8192('0x47')]=_[_0x8192('0x49')](_0x315622[_0x8192('0x47')],{'$or':_[_0x8192('0x35')](_0x315622[_0x8192('0x41')],function(_0x2d10c9){var _0xcd6157={};_0xcd6157[_0x2d10c9]={'$like':'%'+_0x10ea1e['query'][_0x8192('0x5c')]+'%'};return _0xcd6157;})});}_0x315622=_['merge']({},_0x315622,_0x10ea1e[_0x8192('0x4e')]);return db['UserMailQueue'][_0x8192('0x4b')](_0x315622);}})[_0x8192('0x2c')](function(_0x47e093){if(_0x47e093){return db['User'][_0x8192('0x5d')]({'where':{'id':_['map'](_0x47e093,'UserId'),'role':'agent'},'attributes':['id',_0x8192('0x32'),_0x8192('0x5e'),'updatedAt',_0x8192('0x5f')]});}})[_0x8192('0x2c')](function(_0x4f84d5){if(_0x4f84d5){return{'count':_0x4f84d5[_0x8192('0x28')],'rows':_[_0x8192('0x35')](_0x4f84d5[_0x8192('0x4c')],function(_0x4d508e){return{'membername':_0x4d508e['name'],'UserId':_0x4d508e['id'],'queue_name':_0x42b351[_0x8192('0x32')],'MailQueueId':_0x42b351['id'],'interface':util[_0x8192('0x60')]('%s/%s',_0x8192('0x61'),_0x4d508e[_0x8192('0x32')]),'penalty':0x0,'paused':_0x4d508e[_0x8192('0x5e')],'createdAt':_0x4d508e[_0x8192('0x5f')],'updatedAt':_0x4d508e[_0x8192('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x55434c,_0x315622))[_0x8192('0x4d')](handleError(_0x55434c,null));};exports[_0x8192('0x63')]=function(_0x468aa6,_0x5f0edb,_0x51852e){var _0x4f3c96={};var _0x2b6a32={};var _0x5829c1;var _0x35cc25;return db['MailQueue'][_0x8192('0x5a')]({'where':{'id':_0x468aa6['params']['id']}})[_0x8192('0x2c')](handleEntityNotFound(_0x5f0edb,null))[_0x8192('0x2c')](function(_0xe0220d){if(_0xe0220d){_0x5829c1=_0xe0220d;_0x2b6a32['model']=_[_0x8192('0x3c')](db[_0x8192('0x64')]['rawAttributes']);_0x2b6a32[_0x8192('0x3d')]=_[_0x8192('0x3c')](_0x468aa6['query']);_0x2b6a32[_0x8192('0x3e')]=_[_0x8192('0x3f')](_0x2b6a32[_0x8192('0x3b')],_0x2b6a32[_0x8192('0x3d')]);_0x4f3c96[_0x8192('0x41')]=_[_0x8192('0x3f')](_0x2b6a32[_0x8192('0x3b')],qs[_0x8192('0x40')](_0x468aa6[_0x8192('0x3d')][_0x8192('0x40')]));_0x4f3c96[_0x8192('0x41')]=_0x4f3c96[_0x8192('0x41')][_0x8192('0x42')]?_0x4f3c96[_0x8192('0x41')]:_0x2b6a32['model'];_0x4f3c96['order']=qs[_0x8192('0x46')](_0x468aa6['query']['sort']);_0x4f3c96[_0x8192('0x47')]=qs[_0x8192('0x3e')](_['pick'](_0x468aa6[_0x8192('0x3d')],_0x2b6a32[_0x8192('0x3e')]));if(_0x468aa6[_0x8192('0x3d')]['filter']){_0x4f3c96[_0x8192('0x47')]=_[_0x8192('0x49')](_0x4f3c96[_0x8192('0x47')],{'$or':_[_0x8192('0x35')](_0x4f3c96[_0x8192('0x41')],function(_0x1cc86b){var _0x74856c={};_0x74856c[_0x1cc86b]={'$like':'%'+_0x468aa6['query'][_0x8192('0x5c')]+'%'};return _0x74856c;})});}_0x4f3c96=_[_0x8192('0x49')]({},_0x4f3c96,_0x468aa6['options']);return _0x5829c1['getTeams'](_0x4f3c96);}})['then'](function(_0x4e6be9){if(_0x4e6be9){_0x35cc25=_0x4e6be9['length'];if(!_0x468aa6[_0x8192('0x3d')]['hasOwnProperty'](_0x8192('0x44'))){_0x4f3c96[_0x8192('0x27')]=qs[_0x8192('0x27')](_0x468aa6['query'][_0x8192('0x27')]);_0x4f3c96[_0x8192('0x25')]=qs[_0x8192('0x25')](_0x468aa6[_0x8192('0x3d')]['offset']);}return _0x5829c1[_0x8192('0x63')](_0x4f3c96);}})[_0x8192('0x2c')](function(_0x3df742){if(_0x3df742){return _0x3df742?{'count':_0x35cc25,'rows':_0x3df742}:null;}})[_0x8192('0x2c')](respondWithResult(_0x5f0edb,null))[_0x8192('0x4d')](handleError(_0x5f0edb,null));};exports[_0x8192('0x65')]=function(_0x1e78f2,_0x5666c2,_0x4593a2){var _0x2995c8=_0x1e78f2[_0x8192('0x57')][_0x8192('0x66')];return db[_0x8192('0x64')][_0x8192('0x4b')]({'where':{'id':_0x2995c8},'attributes':['id'],'include':[{'model':db[_0x8192('0x67')],'as':_0x8192('0x68'),'attributes':['id',_0x8192('0x32'),_0x8192('0x69'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0xd234e0){if(_0xd234e0){var _0x44e5ec=_[_0x8192('0x6a')](_0xd234e0,function(_0x922efb){var _0x266109=_0x922efb[_0x8192('0x2d')]({'plain':!![]});return _0x266109['Agents'];});return db[_0x8192('0x36')][_0x8192('0x4f')]({'where':{'id':_0x1e78f2[_0x8192('0x58')]['id']}})[_0x8192('0x2c')](function(_0x5c8d01){return db['sequelize'][_0x8192('0x6b')](function(_0x2c457d){return _0x5c8d01['addTeams'](_0x2995c8,{'transaction':_0x2c457d})['then'](function(){return BPromise[_0x8192('0x6c')](_0x44e5ec,function(_0x22d673){return db[_0x8192('0x6d')][_0x8192('0x6e')]({'where':{'UserId':_0x22d673['id'],'MailQueueId':_0x1e78f2['params']['id']},'transaction':_0x2c457d});});})[_0x8192('0x2c')](function(){_0x44e5ec[_0x8192('0x6f')](function(_0x42b23d){socket['emit'](_0x8192('0x70'),{'UserId':_0x42b23d['id'],'MailQueueId':_0x5c8d01['id']});});});});});}})[_0x8192('0x2c')](respondWithStatusCode(_0x5666c2,null))[_0x8192('0x4d')](handleError(_0x5666c2,null));};exports[_0x8192('0x71')]=function(_0x55c712,_0x36da8e,_0x3ad701){return db[_0x8192('0x64')][_0x8192('0x4b')]({'where':{'id':_0x55c712[_0x8192('0x3d')][_0x8192('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x8192('0x2c')](handleEntityNotFound(_0x36da8e,null))['then'](function(_0x199445){var _0x52551b=_[_0x8192('0x35')](_0x199445,'id');var _0x2ea6dd=[];var _0x15b256=[];var _0x1ae35c=squel[_0x8192('0x72')]();_0x1ae35c[_0x8192('0x73')](_0x8192('0x74'))['from'](_0x8192('0x75'),'tq')[_0x8192('0x76')](_0x8192('0x77'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x8192('0x47')](_0x8192('0x78'),_0x55c712['params']['id']);for(var _0x4a861c=0x0;_0x4a861c<_0x199445[_0x8192('0x42')];_0x4a861c+=0x1){let _0x2931fc=_0x199445[_0x4a861c];for(var _0x464ed1=0x0;_0x464ed1<_0x2931fc[_0x8192('0x68')][_0x8192('0x42')];_0x464ed1+=0x1){let _0xd9deb8=_0x2931fc['Agents'][_0x464ed1];var _0x6e7766=_0x1ae35c['clone']();_0x6e7766['where']('ut.UserId\x20=\x20?',_0xd9deb8['id']);_0x15b256[_0x8192('0x79')](db[_0x8192('0x7a')][_0x8192('0x3d')](_0x6e7766[_0x8192('0x7b')](),{'type':db[_0x8192('0x7a')][_0x8192('0x7c')][_0x8192('0x7d')]})[_0x8192('0x2c')](function(_0xe4b035){if(_0xe4b035['length']===0x1){return _0xd9deb8['id'];}else{var _0x3dd9fd=_[_0x8192('0x7e')](_[_0x8192('0x35')](_0xe4b035,_0x8192('0x7f')),function(_0x5dbe54){return _[_0x8192('0x80')](_0x52551b,_0x5dbe54);});if(_0x3dd9fd){return _0xd9deb8['id'];}}}));}}return BPromise[_0x8192('0x81')](_0x15b256)[_0x8192('0x2c')](function(_0x291187){_0x2ea6dd=_(_0x2ea6dd)['union'](_0x291187)[_0x8192('0x82')]()[_0x8192('0x83')]();return db[_0x8192('0x36')][_0x8192('0x4f')]({'where':{'id':_0x55c712['params']['id']}})['then'](function(_0x58f8d3){return db[_0x8192('0x7a')][_0x8192('0x6b')](function(_0x466309){return _0x58f8d3[_0x8192('0x71')](_0x55c712[_0x8192('0x3d')][_0x8192('0x66')],{'transaction':_0x466309})['then'](function(){if(!_[_0x8192('0x84')](_0x2ea6dd)){return _0x58f8d3[_0x8192('0x85')](_0x2ea6dd,{'transaction':_0x466309});}})['then'](function(){_0x2ea6dd[_0x8192('0x6f')](function(_0x1b7cb0){socket[_0x8192('0x86')]('userMailQueue:remove',{'UserId':_0x1b7cb0,'MailQueueId':_0x58f8d3['id']});});});});});});})['then'](respondWithStatusCode(_0x36da8e,null))['catch'](handleError(_0x36da8e,null));};exports[_0x8192('0x87')]=function(_0x117a69,_0x47d8e5,_0x5ec623){return db[_0x8192('0x36')]['find']({'where':{'id':_0x117a69[_0x8192('0x58')]['id']}})[_0x8192('0x2c')](handleEntityNotFound(_0x47d8e5,null))[_0x8192('0x2c')](function(_0x915ca){if(_0x915ca){return _0x915ca['addAgents'](_0x117a69[_0x8192('0x57')][_0x8192('0x66')],_['omit'](_0x117a69[_0x8192('0x57')],[_0x8192('0x66'),'id'])||{})[_0x8192('0x88')](function(_0x37503b){for(var _0x311d73=0x0;_0x311d73<_0x117a69[_0x8192('0x57')][_0x8192('0x66')][_0x8192('0x42')];_0x311d73+=0x1){socket[_0x8192('0x86')](_0x8192('0x70'),{'UserId':Number(_0x117a69[_0x8192('0x57')][_0x8192('0x66')][_0x311d73]),'MailQueueId':Number(_0x117a69[_0x8192('0x58')]['id'])});}return _0x37503b;});}})[_0x8192('0x2c')](respondWithResult(_0x47d8e5,null))[_0x8192('0x4d')](handleError(_0x47d8e5,null));};exports[_0x8192('0x85')]=function(_0x3d569c,_0x4df83a,_0x43f574){return db[_0x8192('0x36')][_0x8192('0x4f')]({'where':{'id':_0x3d569c[_0x8192('0x58')]['id']}})['then'](handleEntityNotFound(_0x4df83a,null))[_0x8192('0x2c')](function(_0x2a11a7){if(_0x2a11a7){return _0x2a11a7[_0x8192('0x85')](_0x3d569c['query'][_0x8192('0x66')])[_0x8192('0x2c')](function(){if(_[_0x8192('0x89')](_0x3d569c[_0x8192('0x3d')]['ids'])){for(var _0x2cd0ce=0x0;_0x2cd0ce<_0x3d569c[_0x8192('0x3d')][_0x8192('0x66')][_0x8192('0x42')];_0x2cd0ce+=0x1){socket[_0x8192('0x86')]('userMailQueue:remove',{'UserId':Number(_0x3d569c[_0x8192('0x3d')][_0x8192('0x66')][_0x2cd0ce]),'MailQueueId':Number(_0x3d569c['params']['id'])});}}else{socket['emit'](_0x8192('0x8a'),{'UserId':Number(_0x3d569c[_0x8192('0x3d')][_0x8192('0x66')]),'MailQueueId':Number(_0x3d569c[_0x8192('0x58')]['id'])});}});}})[_0x8192('0x2c')](respondWithStatusCode(_0x4df83a,null))[_0x8192('0x4d')](handleError(_0x4df83a,null));};exports[_0x8192('0x8b')]=function(_0x40d291,_0x39d107,_0xf380cb){var _0x17db34={};var _0x2364f1={};var _0x3b02c4;var _0x237abf;return db[_0x8192('0x36')][_0x8192('0x5a')]({'where':{'id':_0x40d291[_0x8192('0x58')]['id']}})[_0x8192('0x2c')](handleEntityNotFound(_0x39d107,null))[_0x8192('0x2c')](function(_0x529df8){if(_0x529df8){_0x3b02c4=_0x529df8;_0x2364f1['model']=_['keys'](db[_0x8192('0x67')][_0x8192('0x37')]);_0x2364f1['query']=_[_0x8192('0x3c')](_0x40d291[_0x8192('0x3d')]);_0x2364f1[_0x8192('0x3e')]=_['intersection'](_0x2364f1[_0x8192('0x3b')],_0x2364f1[_0x8192('0x3d')]);_0x17db34[_0x8192('0x41')]=_[_0x8192('0x3f')](_0x2364f1[_0x8192('0x3b')],qs['fields'](_0x40d291['query'][_0x8192('0x40')]));_0x17db34[_0x8192('0x41')]=_0x17db34[_0x8192('0x41')][_0x8192('0x42')]?_0x17db34['attributes']:_0x2364f1['model'];_0x17db34[_0x8192('0x45')]=qs[_0x8192('0x46')](_0x40d291[_0x8192('0x3d')]['sort']);_0x17db34[_0x8192('0x47')]=qs[_0x8192('0x3e')](_[_0x8192('0x48')](_0x40d291['query'],_0x2364f1[_0x8192('0x3e')]));if(_0x40d291['query'][_0x8192('0x5c')]){_0x17db34[_0x8192('0x47')]=_[_0x8192('0x49')](_0x17db34[_0x8192('0x47')],{'$or':_[_0x8192('0x35')](_0x17db34[_0x8192('0x41')],function(_0x4c5402){var _0x8223ab={};_0x8223ab[_0x4c5402]={'$like':'%'+_0x40d291[_0x8192('0x3d')][_0x8192('0x5c')]+'%'};return _0x8223ab;})});}_0x17db34=_[_0x8192('0x49')]({},_0x17db34,_0x40d291[_0x8192('0x4e')]);return _0x3b02c4[_0x8192('0x8b')](_0x17db34);}})[_0x8192('0x2c')](function(_0x547249){if(_0x547249){_0x237abf=_0x547249[_0x8192('0x42')];if(!_0x40d291[_0x8192('0x3d')][_0x8192('0x43')](_0x8192('0x44'))){_0x17db34[_0x8192('0x27')]=qs[_0x8192('0x27')](_0x40d291['query'][_0x8192('0x27')]);_0x17db34[_0x8192('0x25')]=qs[_0x8192('0x25')](_0x40d291[_0x8192('0x3d')][_0x8192('0x25')]);}return _0x3b02c4[_0x8192('0x8b')](_0x17db34);}})[_0x8192('0x2c')](function(_0x2048ca){if(_0x2048ca){return _0x2048ca?{'count':_0x237abf,'rows':_0x2048ca}:null;}})[_0x8192('0x2c')](respondWithResult(_0x39d107,null))[_0x8192('0x4d')](handleError(_0x39d107,null));}; \ No newline at end of file +var _0xc7e9=['filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','show','options','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserMailQueue','hasOwnProperty','nolimit','pick','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','Team','getTeams','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','push','toString','SELECT','every','includes','all','union','compact','value','removeAgents','userMailQueue:remove','addAgents','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','MailQueues','UserProfileResource','error','stack','name','send','index','MailQueue','rawAttributes','fieldName','type','model','map','keys','query'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xc7e9[_0x45b034];return _0x509cb0;};'use strict';var emlformat=require(_0x9c7e('0x0'));var rimraf=require(_0x9c7e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c7e('0x2'));var rp=require(_0x9c7e('0x3'));var moment=require(_0x9c7e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9c7e('0x5'));var util=require(_0x9c7e('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9c7e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9c7e('0x8'));var _=require(_0x9c7e('0x9'));var squel=require(_0x9c7e('0xa'));var crypto=require(_0x9c7e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9c7e('0xc'));var toCsv=require(_0x9c7e('0x7'));var querystring=require(_0x9c7e('0xd'));var Papa=require(_0x9c7e('0xe'));var Redis=require('ioredis');var authService=require(_0x9c7e('0xf'));var qs=require(_0x9c7e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c7e('0x11'));var logger=require('../../config/logger')(_0x9c7e('0x12'));var utils=require(_0x9c7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9c7e('0x14'));var db=require('../../mysqldb')['db'];config[_0x9c7e('0x15')]=_[_0x9c7e('0x16')](config[_0x9c7e('0x15')],{'host':_0x9c7e('0x17'),'port':0x18eb});var socket=require(_0x9c7e('0x18'))(new Redis(config['redis']));require(_0x9c7e('0x19'))[_0x9c7e('0x1a')](socket);function respondWithStatusCode(_0x322d98,_0x3a65a6){_0x3a65a6=_0x3a65a6||0xcc;return function(_0x288f3b){if(_0x288f3b){return _0x322d98[_0x9c7e('0x1b')](_0x3a65a6);}return _0x322d98['status'](_0x3a65a6)[_0x9c7e('0x1c')]();};}function respondWithResult(_0x161f74,_0x346951){_0x346951=_0x346951||0xc8;return function(_0x3fd3c9){if(_0x3fd3c9){return _0x161f74[_0x9c7e('0x1d')](_0x346951)['json'](_0x3fd3c9);}};}function respondWithFilteredResult(_0x192f86,_0x412b17){return function(_0x5af216){if(_0x5af216){var _0x164412=typeof _0x412b17[_0x9c7e('0x1e')]===_0x9c7e('0x1f')&&typeof _0x412b17[_0x9c7e('0x20')]===_0x9c7e('0x1f');var _0x592b16=_0x5af216[_0x9c7e('0x21')];var _0x5a51f8=_0x164412?0x0:_0x412b17[_0x9c7e('0x1e')];var _0x4c41fa=_0x164412?_0x5af216['count']:_0x412b17[_0x9c7e('0x1e')]+_0x412b17[_0x9c7e('0x20')];var _0x2f67d1;if(_0x4c41fa>=_0x592b16){_0x4c41fa=_0x592b16;_0x2f67d1=0xc8;}else{_0x2f67d1=0xce;}_0x192f86[_0x9c7e('0x1d')](_0x2f67d1);return _0x192f86[_0x9c7e('0x22')]('Content-Range',_0x5a51f8+'-'+_0x4c41fa+'/'+_0x592b16)[_0x9c7e('0x23')](_0x5af216);}return null;};}function patchUpdates(_0x14696f){return function(_0x5fd78f){try{jsonpatch[_0x9c7e('0x24')](_0x5fd78f,_0x14696f,!![]);}catch(_0x44b96a){return BPromise[_0x9c7e('0x25')](_0x44b96a);}return _0x5fd78f[_0x9c7e('0x26')]();};}function saveUpdates(_0x1ce4d2,_0x3567d8){return function(_0x295ddd){if(_0x295ddd){return _0x295ddd[_0x9c7e('0x27')](_0x1ce4d2)[_0x9c7e('0x28')](function(_0x4a8a46){return _0x4a8a46;});}return null;};}function removeEntity(_0x9780f8,_0x2eaebb){return function(_0x40ad31){if(_0x40ad31){return _0x40ad31[_0x9c7e('0x29')]()[_0x9c7e('0x28')](function(){var _0x224056=_0x40ad31['get']({'plain':!![]});var _0x5df23c=_0x9c7e('0x2a');return db[_0x9c7e('0x2b')][_0x9c7e('0x29')]({'where':{'type':_0x5df23c,'resourceId':_0x224056['id']}})[_0x9c7e('0x28')](function(){return _0x40ad31;});})[_0x9c7e('0x28')](function(){_0x9780f8[_0x9c7e('0x1d')](0xcc)[_0x9c7e('0x1c')]();});}};}function handleEntityNotFound(_0xc02abf,_0x531544){return function(_0x339e21){if(!_0x339e21){_0xc02abf['sendStatus'](0x194);}return _0x339e21;};}function handleError(_0x2f5da4,_0x4c9bae){_0x4c9bae=_0x4c9bae||0x1f4;return function(_0x5a33d7){logger[_0x9c7e('0x2c')](_0x5a33d7[_0x9c7e('0x2d')]);if(_0x5a33d7[_0x9c7e('0x2e')]){delete _0x5a33d7[_0x9c7e('0x2e')];}_0x2f5da4[_0x9c7e('0x1d')](_0x4c9bae)[_0x9c7e('0x2f')](_0x5a33d7);};}exports[_0x9c7e('0x30')]=function(_0x397824,_0x2bbfe8){var _0x3537b4={},_0x427015={},_0x16fcfc={'count':0x0,'rows':[]};var _0x38b10e=_['map'](db[_0x9c7e('0x31')][_0x9c7e('0x32')],function(_0x5d2518){return{'name':_0x5d2518[_0x9c7e('0x33')],'type':_0x5d2518[_0x9c7e('0x34')]['key']};});_0x427015[_0x9c7e('0x35')]=_[_0x9c7e('0x36')](_0x38b10e,_0x9c7e('0x2e'));_0x427015['query']=_[_0x9c7e('0x37')](_0x397824[_0x9c7e('0x38')]);_0x427015[_0x9c7e('0x39')]=_[_0x9c7e('0x3a')](_0x427015[_0x9c7e('0x35')],_0x427015[_0x9c7e('0x38')]);_0x3537b4[_0x9c7e('0x3b')]=_['intersection'](_0x427015[_0x9c7e('0x35')],qs[_0x9c7e('0x3c')](_0x397824['query'][_0x9c7e('0x3c')]));_0x3537b4['attributes']=_0x3537b4[_0x9c7e('0x3b')][_0x9c7e('0x3d')]?_0x3537b4[_0x9c7e('0x3b')]:_0x427015[_0x9c7e('0x35')];if(!_0x397824[_0x9c7e('0x38')]['hasOwnProperty']('nolimit')){_0x3537b4[_0x9c7e('0x20')]=qs[_0x9c7e('0x20')](_0x397824[_0x9c7e('0x38')][_0x9c7e('0x20')]);_0x3537b4[_0x9c7e('0x1e')]=qs['offset'](_0x397824['query'][_0x9c7e('0x1e')]);}_0x3537b4[_0x9c7e('0x3e')]=qs[_0x9c7e('0x3f')](_0x397824[_0x9c7e('0x38')][_0x9c7e('0x3f')]);_0x3537b4[_0x9c7e('0x40')]=qs[_0x9c7e('0x39')](_['pick'](_0x397824['query'],_0x427015[_0x9c7e('0x39')]),_0x38b10e);if(_0x397824['query'][_0x9c7e('0x41')]){_0x3537b4[_0x9c7e('0x40')]=_[_0x9c7e('0x42')](_0x3537b4[_0x9c7e('0x40')],{'$or':_['map'](_0x38b10e,function(_0xa58ece){if(_0xa58ece[_0x9c7e('0x34')]!==_0x9c7e('0x43')){var _0x345f44={};_0x345f44[_0xa58ece[_0x9c7e('0x2e')]]={'$like':'%'+_0x397824[_0x9c7e('0x38')][_0x9c7e('0x41')]+'%'};return _0x345f44;}})});}_0x3537b4=_[_0x9c7e('0x42')]({},_0x3537b4,_0x397824['options']);var _0x11bb46={'where':_0x3537b4['where']};return db[_0x9c7e('0x31')][_0x9c7e('0x21')](_0x11bb46)[_0x9c7e('0x28')](function(_0x170fa6){_0x16fcfc[_0x9c7e('0x21')]=_0x170fa6;if(_0x397824[_0x9c7e('0x38')][_0x9c7e('0x44')]){_0x3537b4[_0x9c7e('0x45')]=[{'all':!![]}];}return db['MailQueue'][_0x9c7e('0x46')](_0x3537b4);})['then'](function(_0x518973){_0x16fcfc['rows']=_0x518973;return _0x16fcfc;})[_0x9c7e('0x28')](respondWithFilteredResult(_0x2bbfe8,_0x3537b4))['catch'](handleError(_0x2bbfe8,null));};exports[_0x9c7e('0x47')]=function(_0x19b6be,_0x5161e2){var _0x127d16={'raw':!![],'where':{'id':_0x19b6be['params']['id']}},_0x1e86f4={};_0x1e86f4['model']=_[_0x9c7e('0x37')](db[_0x9c7e('0x31')][_0x9c7e('0x32')]);_0x1e86f4[_0x9c7e('0x38')]=_[_0x9c7e('0x37')](_0x19b6be[_0x9c7e('0x38')]);_0x1e86f4[_0x9c7e('0x39')]=_[_0x9c7e('0x3a')](_0x1e86f4[_0x9c7e('0x35')],_0x1e86f4[_0x9c7e('0x38')]);_0x127d16['attributes']=_[_0x9c7e('0x3a')](_0x1e86f4[_0x9c7e('0x35')],qs[_0x9c7e('0x3c')](_0x19b6be[_0x9c7e('0x38')][_0x9c7e('0x3c')]));_0x127d16[_0x9c7e('0x3b')]=_0x127d16[_0x9c7e('0x3b')]['length']?_0x127d16[_0x9c7e('0x3b')]:_0x1e86f4[_0x9c7e('0x35')];if(_0x19b6be[_0x9c7e('0x38')]['includeAll']){_0x127d16[_0x9c7e('0x45')]=[{'all':!![]}];}_0x127d16=_[_0x9c7e('0x42')]({},_0x127d16,_0x19b6be[_0x9c7e('0x48')]);return db[_0x9c7e('0x31')]['find'](_0x127d16)[_0x9c7e('0x28')](handleEntityNotFound(_0x5161e2,null))[_0x9c7e('0x28')](respondWithResult(_0x5161e2,null))[_0x9c7e('0x49')](handleError(_0x5161e2,null));};exports[_0x9c7e('0x4a')]=function(_0x146b4a,_0x5b6cb7){return db['MailQueue']['create'](_0x146b4a[_0x9c7e('0x4b')],{})[_0x9c7e('0x28')](function(_0x44ad2f){var _0x155f91=_0x146b4a[_0x9c7e('0x4c')][_0x9c7e('0x4d')]({'plain':!![]});if(!_0x155f91)throw new Error(_0x9c7e('0x4e'));if(_0x155f91[_0x9c7e('0x4f')]===_0x9c7e('0x4c')){var _0x331914=_0x44ad2f[_0x9c7e('0x4d')]({'plain':!![]});var _0x2015af=_0x9c7e('0x2a');return db[_0x9c7e('0x50')][_0x9c7e('0x51')]({'where':{'name':_0x2015af,'userProfileId':_0x155f91['userProfileId']},'raw':!![]})[_0x9c7e('0x28')](function(_0x474232){if(_0x474232&&_0x474232[_0x9c7e('0x52')]===0x0){return db[_0x9c7e('0x2b')][_0x9c7e('0x4a')]({'name':_0x331914[_0x9c7e('0x2e')],'resourceId':_0x331914['id'],'type':_0x474232[_0x9c7e('0x2e')],'sectionId':_0x474232['id']},{})[_0x9c7e('0x28')](function(){return _0x44ad2f;});}else{return _0x44ad2f;}})[_0x9c7e('0x49')](function(_0x5bbee6){logger[_0x9c7e('0x2c')](_0x9c7e('0x53'),_0x5bbee6);throw _0x5bbee6;});}return _0x44ad2f;})[_0x9c7e('0x28')](respondWithResult(_0x5b6cb7,0xc9))[_0x9c7e('0x49')](handleError(_0x5b6cb7,null));};exports[_0x9c7e('0x27')]=function(_0x23f7e5,_0x136158){if(_0x23f7e5[_0x9c7e('0x4b')]['id']){delete _0x23f7e5[_0x9c7e('0x4b')]['id'];}return db[_0x9c7e('0x31')][_0x9c7e('0x51')]({'where':{'id':_0x23f7e5[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](handleEntityNotFound(_0x136158,null))[_0x9c7e('0x28')](saveUpdates(_0x23f7e5[_0x9c7e('0x4b')],null))['then'](respondWithResult(_0x136158,null))[_0x9c7e('0x49')](handleError(_0x136158,null));};exports['destroy']=function(_0x54a23f,_0x13a517){return db['MailQueue'][_0x9c7e('0x51')]({'where':{'id':_0x54a23f[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](handleEntityNotFound(_0x13a517,null))[_0x9c7e('0x28')](removeEntity(_0x13a517,null))[_0x9c7e('0x49')](handleError(_0x13a517,null));};exports[_0x9c7e('0x55')]=function(_0x5ea570,_0x4f1485){return db['MailQueue']['describe']()[_0x9c7e('0x28')](respondWithResult(_0x4f1485,null))[_0x9c7e('0x49')](handleError(_0x4f1485,null));};exports[_0x9c7e('0x56')]=function(_0x2c3880,_0x583989,_0x75c21c){var _0x46723c={'raw':!![],'where':{}},_0xa38975={},_0xf7e689;return db[_0x9c7e('0x31')][_0x9c7e('0x57')]({'where':{'id':_0x2c3880[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](handleEntityNotFound(_0x583989,null))[_0x9c7e('0x28')](function(_0xc756bb){if(_0xc756bb){_0xf7e689=_0xc756bb[_0x9c7e('0x4d')]({'plain':!![]});_0xa38975['model']=_[_0x9c7e('0x37')](db[_0x9c7e('0x58')][_0x9c7e('0x32')]);_0xa38975[_0x9c7e('0x38')]=_[_0x9c7e('0x37')](_0x2c3880['query']);_0xa38975[_0x9c7e('0x39')]=_[_0x9c7e('0x3a')](_0xa38975[_0x9c7e('0x35')],_0xa38975[_0x9c7e('0x38')]);_0x46723c['attributes']=_['intersection'](_0xa38975[_0x9c7e('0x35')],qs[_0x9c7e('0x3c')](_0x2c3880[_0x9c7e('0x38')]['fields']));_0x46723c['attributes']=_0x46723c[_0x9c7e('0x3b')][_0x9c7e('0x3d')]?_0x46723c[_0x9c7e('0x3b')]:_0xa38975[_0x9c7e('0x35')];if(!_0x2c3880[_0x9c7e('0x38')][_0x9c7e('0x59')](_0x9c7e('0x5a'))){_0x46723c[_0x9c7e('0x20')]=qs['limit'](_0x2c3880[_0x9c7e('0x38')][_0x9c7e('0x20')]);_0x46723c[_0x9c7e('0x1e')]=qs[_0x9c7e('0x1e')](_0x2c3880[_0x9c7e('0x38')][_0x9c7e('0x1e')]);}_0x46723c[_0x9c7e('0x3e')]=qs[_0x9c7e('0x3f')](_0x2c3880[_0x9c7e('0x38')][_0x9c7e('0x3f')]);_0x46723c[_0x9c7e('0x40')]=qs[_0x9c7e('0x39')](_[_0x9c7e('0x5b')](_0x2c3880[_0x9c7e('0x38')],_0xa38975[_0x9c7e('0x39')]));_0x46723c[_0x9c7e('0x40')][_0x9c7e('0x5c')]=_0xc756bb['id'];if(_0x2c3880[_0x9c7e('0x38')]['filter']){_0x46723c[_0x9c7e('0x40')]=_[_0x9c7e('0x42')](_0x46723c['where'],{'$or':_[_0x9c7e('0x36')](_0x46723c[_0x9c7e('0x3b')],function(_0x51dcfd){var _0x3d6aed={};_0x3d6aed[_0x51dcfd]={'$like':'%'+_0x2c3880['query'][_0x9c7e('0x41')]+'%'};return _0x3d6aed;})});}_0x46723c=_[_0x9c7e('0x42')]({},_0x46723c,_0x2c3880[_0x9c7e('0x48')]);return db[_0x9c7e('0x58')][_0x9c7e('0x46')](_0x46723c);}})[_0x9c7e('0x28')](function(_0x19c9b8){if(_0x19c9b8){return db[_0x9c7e('0x5d')][_0x9c7e('0x5e')]({'where':{'id':_[_0x9c7e('0x36')](_0x19c9b8,'UserId'),'role':_0x9c7e('0x5f')},'attributes':['id',_0x9c7e('0x2e'),_0x9c7e('0x60'),_0x9c7e('0x61'),_0x9c7e('0x62')]});}})[_0x9c7e('0x28')](function(_0x55923b){if(_0x55923b){return{'count':_0x55923b[_0x9c7e('0x21')],'rows':_[_0x9c7e('0x36')](_0x55923b[_0x9c7e('0x63')],function(_0x7454e){return{'membername':_0x7454e[_0x9c7e('0x2e')],'UserId':_0x7454e['id'],'queue_name':_0xf7e689[_0x9c7e('0x2e')],'MailQueueId':_0xf7e689['id'],'interface':util[_0x9c7e('0x64')]('%s/%s','SIP',_0x7454e[_0x9c7e('0x2e')]),'penalty':0x0,'paused':_0x7454e[_0x9c7e('0x60')],'createdAt':_0x7454e[_0x9c7e('0x62')],'updatedAt':_0x7454e[_0x9c7e('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9c7e('0x28')](respondWithFilteredResult(_0x583989,_0x46723c))['catch'](handleError(_0x583989,null));};exports['getTeams']=function(_0x303103,_0x123868,_0x211f39){var _0x39ec17={};var _0x39cbf5={};var _0x1b76d0;var _0x263b76;return db['MailQueue']['findOne']({'where':{'id':_0x303103[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](handleEntityNotFound(_0x123868,null))[_0x9c7e('0x28')](function(_0x26d17a){if(_0x26d17a){_0x1b76d0=_0x26d17a;_0x39cbf5[_0x9c7e('0x35')]=_['keys'](db[_0x9c7e('0x65')][_0x9c7e('0x32')]);_0x39cbf5[_0x9c7e('0x38')]=_[_0x9c7e('0x37')](_0x303103['query']);_0x39cbf5[_0x9c7e('0x39')]=_[_0x9c7e('0x3a')](_0x39cbf5['model'],_0x39cbf5[_0x9c7e('0x38')]);_0x39ec17[_0x9c7e('0x3b')]=_[_0x9c7e('0x3a')](_0x39cbf5['model'],qs[_0x9c7e('0x3c')](_0x303103[_0x9c7e('0x38')][_0x9c7e('0x3c')]));_0x39ec17[_0x9c7e('0x3b')]=_0x39ec17['attributes'][_0x9c7e('0x3d')]?_0x39ec17['attributes']:_0x39cbf5[_0x9c7e('0x35')];_0x39ec17[_0x9c7e('0x3e')]=qs['sort'](_0x303103[_0x9c7e('0x38')][_0x9c7e('0x3f')]);_0x39ec17[_0x9c7e('0x40')]=qs[_0x9c7e('0x39')](_[_0x9c7e('0x5b')](_0x303103['query'],_0x39cbf5['filters']));if(_0x303103['query'][_0x9c7e('0x41')]){_0x39ec17[_0x9c7e('0x40')]=_['merge'](_0x39ec17['where'],{'$or':_[_0x9c7e('0x36')](_0x39ec17[_0x9c7e('0x3b')],function(_0x2f096a){var _0x5a5189={};_0x5a5189[_0x2f096a]={'$like':'%'+_0x303103['query'][_0x9c7e('0x41')]+'%'};return _0x5a5189;})});}_0x39ec17=_[_0x9c7e('0x42')]({},_0x39ec17,_0x303103[_0x9c7e('0x48')]);return _0x1b76d0[_0x9c7e('0x66')](_0x39ec17);}})[_0x9c7e('0x28')](function(_0x53bc7a){if(_0x53bc7a){_0x263b76=_0x53bc7a[_0x9c7e('0x3d')];if(!_0x303103[_0x9c7e('0x38')][_0x9c7e('0x59')](_0x9c7e('0x5a'))){_0x39ec17[_0x9c7e('0x20')]=qs['limit'](_0x303103[_0x9c7e('0x38')][_0x9c7e('0x20')]);_0x39ec17['offset']=qs['offset'](_0x303103['query'][_0x9c7e('0x1e')]);}return _0x1b76d0[_0x9c7e('0x66')](_0x39ec17);}})[_0x9c7e('0x28')](function(_0x3eec31){if(_0x3eec31){return _0x3eec31?{'count':_0x263b76,'rows':_0x3eec31}:null;}})[_0x9c7e('0x28')](respondWithResult(_0x123868,null))[_0x9c7e('0x49')](handleError(_0x123868,null));};exports[_0x9c7e('0x67')]=function(_0x2f591a,_0x1cbaa8,_0x97a5cb){var _0x39ea58=_0x2f591a[_0x9c7e('0x4b')][_0x9c7e('0x68')];return db['Team'][_0x9c7e('0x46')]({'where':{'id':_0x39ea58},'attributes':['id'],'include':[{'model':db[_0x9c7e('0x5d')],'as':_0x9c7e('0x69'),'attributes':['id',_0x9c7e('0x2e'),_0x9c7e('0x6a'),_0x9c7e('0x6b'),_0x9c7e('0x6c')],'raw':!![]}]})['then'](function(_0x32a069){if(_0x32a069){var _0x35428d=_[_0x9c7e('0x6d')](_0x32a069,function(_0x15a8bf){var _0x33eb3a=_0x15a8bf[_0x9c7e('0x4d')]({'plain':!![]});return _0x33eb3a[_0x9c7e('0x69')];});return db[_0x9c7e('0x31')][_0x9c7e('0x51')]({'where':{'id':_0x2f591a[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](function(_0x3053ed){return db[_0x9c7e('0x6e')][_0x9c7e('0x6f')](function(_0x234334){return _0x3053ed[_0x9c7e('0x67')](_0x39ea58,{'transaction':_0x234334})[_0x9c7e('0x28')](function(){return BPromise['each'](_0x35428d,function(_0x42abf3){return db[_0x9c7e('0x58')][_0x9c7e('0x70')]({'where':{'UserId':_0x42abf3['id'],'MailQueueId':_0x2f591a[_0x9c7e('0x54')]['id']},'transaction':_0x234334});});})['then'](function(){_0x35428d[_0x9c7e('0x71')](function(_0x498c37){socket[_0x9c7e('0x72')](_0x9c7e('0x73'),{'UserId':_0x498c37['id'],'MailQueueId':_0x3053ed['id']});});});});});}})['then'](respondWithStatusCode(_0x1cbaa8,null))['catch'](handleError(_0x1cbaa8,null));};exports[_0x9c7e('0x74')]=function(_0x5d0031,_0x88bc43,_0x211d74){return db[_0x9c7e('0x65')][_0x9c7e('0x46')]({'where':{'id':_0x5d0031[_0x9c7e('0x38')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9c7e('0x5d')],'as':_0x9c7e('0x69'),'attributes':['id'],'raw':!![]}]})[_0x9c7e('0x28')](handleEntityNotFound(_0x88bc43,null))[_0x9c7e('0x28')](function(_0x3d4d87){var _0x2ba716=_[_0x9c7e('0x36')](_0x3d4d87,'id');var _0x4bf499=[];var _0x344011=[];var _0x4b0cbc=squel[_0x9c7e('0x75')]();_0x4b0cbc['field'](_0x9c7e('0x76'))[_0x9c7e('0x77')](_0x9c7e('0x78'),'tq')[_0x9c7e('0x79')]('user_has_teams','ut',_0x9c7e('0x7a'))[_0x9c7e('0x40')](_0x9c7e('0x7b'),_0x5d0031[_0x9c7e('0x54')]['id']);for(var _0x524422=0x0;_0x524422<_0x3d4d87[_0x9c7e('0x3d')];_0x524422+=0x1){let _0x3761e0=_0x3d4d87[_0x524422];for(var _0x1133ca=0x0;_0x1133ca<_0x3761e0[_0x9c7e('0x69')][_0x9c7e('0x3d')];_0x1133ca+=0x1){let _0x37171d=_0x3761e0[_0x9c7e('0x69')][_0x1133ca];var _0x4f0a20=_0x4b0cbc[_0x9c7e('0x7c')]();_0x4f0a20[_0x9c7e('0x40')]('ut.UserId\x20=\x20?',_0x37171d['id']);_0x344011[_0x9c7e('0x7d')](db[_0x9c7e('0x6e')][_0x9c7e('0x38')](_0x4f0a20[_0x9c7e('0x7e')](),{'type':db['sequelize']['QueryTypes'][_0x9c7e('0x7f')]})[_0x9c7e('0x28')](function(_0x5cdb0c){if(_0x5cdb0c[_0x9c7e('0x3d')]===0x1){return _0x37171d['id'];}else{var _0x5eda23=_[_0x9c7e('0x80')](_[_0x9c7e('0x36')](_0x5cdb0c,'TeamId'),function(_0x89059e){return _[_0x9c7e('0x81')](_0x2ba716,_0x89059e);});if(_0x5eda23){return _0x37171d['id'];}}}));}}return BPromise[_0x9c7e('0x82')](_0x344011)[_0x9c7e('0x28')](function(_0xea1520){_0x4bf499=_(_0x4bf499)[_0x9c7e('0x83')](_0xea1520)[_0x9c7e('0x84')]()[_0x9c7e('0x85')]();return db['MailQueue'][_0x9c7e('0x51')]({'where':{'id':_0x5d0031[_0x9c7e('0x54')]['id']}})['then'](function(_0x238a38){return db[_0x9c7e('0x6e')]['transaction'](function(_0x5d4204){return _0x238a38['removeTeams'](_0x5d0031[_0x9c7e('0x38')][_0x9c7e('0x68')],{'transaction':_0x5d4204})[_0x9c7e('0x28')](function(){if(!_['isEmpty'](_0x4bf499)){return _0x238a38[_0x9c7e('0x86')](_0x4bf499,{'transaction':_0x5d4204});}})[_0x9c7e('0x28')](function(){_0x4bf499[_0x9c7e('0x71')](function(_0x142b6f){socket[_0x9c7e('0x72')](_0x9c7e('0x87'),{'UserId':_0x142b6f,'MailQueueId':_0x238a38['id']});});});});});});})['then'](respondWithStatusCode(_0x88bc43,null))[_0x9c7e('0x49')](handleError(_0x88bc43,null));};exports[_0x9c7e('0x88')]=function(_0x507bcc,_0x503bda,_0xc8b093){return db['MailQueue'][_0x9c7e('0x51')]({'where':{'id':_0x507bcc[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](handleEntityNotFound(_0x503bda,null))[_0x9c7e('0x28')](function(_0x38a38f){if(_0x38a38f){return _0x38a38f['addAgents'](_0x507bcc[_0x9c7e('0x4b')][_0x9c7e('0x68')],_['omit'](_0x507bcc[_0x9c7e('0x4b')],[_0x9c7e('0x68'),'id'])||{})['spread'](function(_0xd6a301){for(var _0x34d004=0x0;_0x34d004<_0x507bcc[_0x9c7e('0x4b')][_0x9c7e('0x68')]['length'];_0x34d004+=0x1){socket[_0x9c7e('0x72')](_0x9c7e('0x73'),{'UserId':Number(_0x507bcc['body'][_0x9c7e('0x68')][_0x34d004]),'MailQueueId':Number(_0x507bcc[_0x9c7e('0x54')]['id'])});}return _0xd6a301;});}})['then'](respondWithResult(_0x503bda,null))[_0x9c7e('0x49')](handleError(_0x503bda,null));};exports['removeAgents']=function(_0x396743,_0x16f106,_0x4a41dc){return db['MailQueue'][_0x9c7e('0x51')]({'where':{'id':_0x396743[_0x9c7e('0x54')]['id']}})['then'](handleEntityNotFound(_0x16f106,null))[_0x9c7e('0x28')](function(_0x4dcd1c){if(_0x4dcd1c){return _0x4dcd1c['removeAgents'](_0x396743[_0x9c7e('0x38')]['ids'])['then'](function(){if(_['isArray'](_0x396743['query'][_0x9c7e('0x68')])){for(var _0x1c0a37=0x0;_0x1c0a37<_0x396743['query'][_0x9c7e('0x68')][_0x9c7e('0x3d')];_0x1c0a37+=0x1){socket[_0x9c7e('0x72')](_0x9c7e('0x87'),{'UserId':Number(_0x396743[_0x9c7e('0x38')]['ids'][_0x1c0a37]),'MailQueueId':Number(_0x396743[_0x9c7e('0x54')]['id'])});}}else{socket[_0x9c7e('0x72')](_0x9c7e('0x87'),{'UserId':Number(_0x396743[_0x9c7e('0x38')][_0x9c7e('0x68')]),'MailQueueId':Number(_0x396743[_0x9c7e('0x54')]['id'])});}});}})[_0x9c7e('0x28')](respondWithStatusCode(_0x16f106,null))['catch'](handleError(_0x16f106,null));};exports['getAgents']=function(_0x1c5af5,_0x4f2b83,_0x1e406f){var _0x57116d={};var _0x5aad48={};var _0x170b73;var _0x53cafd;return db[_0x9c7e('0x31')]['findOne']({'where':{'id':_0x1c5af5[_0x9c7e('0x54')]['id']}})[_0x9c7e('0x28')](handleEntityNotFound(_0x4f2b83,null))[_0x9c7e('0x28')](function(_0xd204f4){if(_0xd204f4){_0x170b73=_0xd204f4;_0x5aad48[_0x9c7e('0x35')]=_[_0x9c7e('0x37')](db['User']['rawAttributes']);_0x5aad48[_0x9c7e('0x38')]=_[_0x9c7e('0x37')](_0x1c5af5['query']);_0x5aad48[_0x9c7e('0x39')]=_['intersection'](_0x5aad48[_0x9c7e('0x35')],_0x5aad48['query']);_0x57116d[_0x9c7e('0x3b')]=_[_0x9c7e('0x3a')](_0x5aad48[_0x9c7e('0x35')],qs['fields'](_0x1c5af5[_0x9c7e('0x38')]['fields']));_0x57116d[_0x9c7e('0x3b')]=_0x57116d[_0x9c7e('0x3b')][_0x9c7e('0x3d')]?_0x57116d['attributes']:_0x5aad48[_0x9c7e('0x35')];_0x57116d[_0x9c7e('0x3e')]=qs[_0x9c7e('0x3f')](_0x1c5af5[_0x9c7e('0x38')][_0x9c7e('0x3f')]);_0x57116d[_0x9c7e('0x40')]=qs[_0x9c7e('0x39')](_[_0x9c7e('0x5b')](_0x1c5af5[_0x9c7e('0x38')],_0x5aad48[_0x9c7e('0x39')]));if(_0x1c5af5[_0x9c7e('0x38')][_0x9c7e('0x41')]){_0x57116d['where']=_[_0x9c7e('0x42')](_0x57116d[_0x9c7e('0x40')],{'$or':_[_0x9c7e('0x36')](_0x57116d['attributes'],function(_0x54f174){var _0x3b3ae1={};_0x3b3ae1[_0x54f174]={'$like':'%'+_0x1c5af5['query']['filter']+'%'};return _0x3b3ae1;})});}_0x57116d=_[_0x9c7e('0x42')]({},_0x57116d,_0x1c5af5[_0x9c7e('0x48')]);return _0x170b73[_0x9c7e('0x89')](_0x57116d);}})[_0x9c7e('0x28')](function(_0x5bc2dd){if(_0x5bc2dd){_0x53cafd=_0x5bc2dd[_0x9c7e('0x3d')];if(!_0x1c5af5[_0x9c7e('0x38')][_0x9c7e('0x59')](_0x9c7e('0x5a'))){_0x57116d['limit']=qs[_0x9c7e('0x20')](_0x1c5af5[_0x9c7e('0x38')]['limit']);_0x57116d[_0x9c7e('0x1e')]=qs[_0x9c7e('0x1e')](_0x1c5af5[_0x9c7e('0x38')][_0x9c7e('0x1e')]);}return _0x170b73['getAgents'](_0x57116d);}})[_0x9c7e('0x28')](function(_0x459a4e){if(_0x459a4e){return _0x459a4e?{'count':_0x53cafd,'rows':_0x459a4e}:null;}})[_0x9c7e('0x28')](respondWithResult(_0x4f2b83,null))[_0x9c7e('0x49')](handleError(_0x4f2b83,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index b7466dd..5ff2cd0 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 _0x7902=['events','MailQueue','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x41a546,_0x35ad39){var _0x20f9aa=function(_0x5bafc7){while(--_0x5bafc7){_0x41a546['push'](_0x41a546['shift']());}};_0x20f9aa(++_0x35ad39);}(_0x7902,0x1e8));var _0x2790=function(_0x7791d5,_0xdab65f){_0x7791d5=_0x7791d5-0x0;var _0x5ce288=_0x7902[_0x7791d5];return _0x5ce288;};'use strict';var EventEmitter=require(_0x2790('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x2790('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x2790('0x2')](0x0);var events={'afterCreate':_0x2790('0x3'),'afterUpdate':_0x2790('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e42a1){return function(_0x218cf0,_0x277feb,_0xa7ae44){MailQueueEvents[_0x2790('0x5')](_0x4e42a1+':'+_0x218cf0['id'],_0x218cf0);MailQueueEvents[_0x2790('0x5')](_0x4e42a1,_0x218cf0);_0xa7ae44(null);};}for(var e in events){if(events[_0x2790('0x6')](e)){var event=events[e];MailQueue[_0x2790('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x6ca5=['MailQueue','save','update','remove','emit','hasOwnProperty','exports'];(function(_0xbd5c41,_0x54f7cd){var _0x553eb9=function(_0x2eda75){while(--_0x2eda75){_0xbd5c41['push'](_0xbd5c41['shift']());}};_0x553eb9(++_0x54f7cd);}(_0x6ca5,0x165));var _0x56ca=function(_0x15e026,_0x3b66c8){_0x15e026=_0x15e026-0x0;var _0x3197da=_0x6ca5[_0x15e026];return _0x3197da;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0x56ca('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x56ca('0x1'),'afterUpdate':_0x56ca('0x2'),'afterDestroy':_0x56ca('0x3')};function emitEvent(_0x24b81f){return function(_0x53e643,_0x1c9f2b,_0x31f283){MailQueueEvents[_0x56ca('0x4')](_0x24b81f+':'+_0x53e643['id'],_0x53e643);MailQueueEvents['emit'](_0x24b81f,_0x53e643);_0x31f283(null);};}for(var e in events){if(events[_0x56ca('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x56ca('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index d15287b..2d35493 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 _0x1ed6=['MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailQueue.attributes','exports','define'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0x1ed6,0xc5));var _0x61ed=function(_0x13bd97,_0x1098c1){_0x13bd97=_0x13bd97-0x0;var _0x1425ea=_0x1ed6[_0x13bd97];return _0x1425ea;};'use strict';var _=require(_0x61ed('0x0'));var util=require(_0x61ed('0x1'));var logger=require('../../config/logger')(_0x61ed('0x2'));var moment=require(_0x61ed('0x3'));var BPromise=require(_0x61ed('0x4'));var rp=require(_0x61ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x61ed('0x6'));var config=require(_0x61ed('0x7'));var attributes=require(_0x61ed('0x8'));module[_0x61ed('0x9')]=function(_0x8c072c,_0x52b8da){return _0x8c072c[_0x61ed('0xa')](_0x61ed('0xb'),attributes,{'tableName':_0x61ed('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa229=['path','rimraf','../../config/environment','exports','define','mail_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x15b51e,_0x445c35){var _0x2e4e39=function(_0x29e982){while(--_0x29e982){_0x15b51e['push'](_0x15b51e['shift']());}};_0x2e4e39(++_0x445c35);}(_0xa229,0x1aa));var _0x9a22=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa229[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x9a22('0x0'));var util=require(_0x9a22('0x1'));var logger=require('../../config/logger')(_0x9a22('0x2'));var moment=require(_0x9a22('0x3'));var BPromise=require(_0x9a22('0x4'));var rp=require(_0x9a22('0x5'));var fs=require('fs');var path=require(_0x9a22('0x6'));var rimraf=require(_0x9a22('0x7'));var config=require(_0x9a22('0x8'));var attributes=require('./mailQueue.attributes');module[_0x9a22('0x9')]=function(_0xa6c68f,_0x154bdb){return _0xa6c68f[_0x9a22('0xa')]('MailQueue',attributes,{'tableName':_0x9a22('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index a739c8d..a8eee8b 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 _0x8a56=['redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','attributes','include','map','model','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2d9d75,_0x12099c){var _0x48a02f=function(_0x12ff48){while(--_0x12ff48){_0x2d9d75['push'](_0x2d9d75['shift']());}};_0x48a02f(++_0x12099c);}(_0x8a56,0xf0));var _0x68a5=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0x8a56[_0xca1f0e];return _0x35e4ef;};'use strict';var _=require(_0x68a5('0x0'));var util=require(_0x68a5('0x1'));var moment=require(_0x68a5('0x2'));var BPromise=require(_0x68a5('0x3'));var rs=require(_0x68a5('0x4'));var fs=require('fs');var Redis=require(_0x68a5('0x5'));var db=require(_0x68a5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68a5('0x7'))(_0x68a5('0x8'));var config=require(_0x68a5('0x9'));var jayson=require(_0x68a5('0xa'));var client=jayson['client'][_0x68a5('0xb')]({'port':0x232a});config[_0x68a5('0xc')]=_[_0x68a5('0xd')](config[_0x68a5('0xc')],{'host':_0x68a5('0xe'),'port':0x18eb});var socket=require(_0x68a5('0xf'))(new Redis(config[_0x68a5('0xc')]));require(_0x68a5('0x10'))[_0x68a5('0x11')](socket);function respondWithRpcPromise(_0x5d0f33,_0x4efecf,_0x56104e){return new BPromise(function(_0x366fc6,_0x82b771){return client[_0x68a5('0x12')](_0x5d0f33,_0x56104e)[_0x68a5('0x13')](function(_0x34f6d6){logger[_0x68a5('0x14')](_0x68a5('0x15'),_0x4efecf,'request\x20sent');logger[_0x68a5('0x16')](_0x68a5('0x17'),_0x4efecf,_0x68a5('0x18'),JSON[_0x68a5('0x19')](_0x34f6d6));if(_0x34f6d6[_0x68a5('0x1a')]){if(_0x34f6d6[_0x68a5('0x1a')][_0x68a5('0x1b')]===0x1f4){logger[_0x68a5('0x1a')]('MailQueue,\x20%s,\x20%s',_0x4efecf,_0x34f6d6[_0x68a5('0x1a')][_0x68a5('0x1c')]);return _0x82b771(_0x34f6d6[_0x68a5('0x1a')][_0x68a5('0x1c')]);}logger[_0x68a5('0x1a')]('MailQueue,\x20%s,\x20%s',_0x4efecf,_0x34f6d6[_0x68a5('0x1a')][_0x68a5('0x1c')]);return _0x366fc6(_0x34f6d6[_0x68a5('0x1a')][_0x68a5('0x1c')]);}else{logger[_0x68a5('0x14')](_0x68a5('0x15'),_0x4efecf,_0x68a5('0x18'));_0x366fc6(_0x34f6d6[_0x68a5('0x1d')][_0x68a5('0x1c')]);}})[_0x68a5('0x1e')](function(_0xbc1ecc){logger[_0x68a5('0x1a')](_0x68a5('0x15'),_0x4efecf,_0xbc1ecc);_0x82b771(_0xbc1ecc);});});}exports[_0x68a5('0x1f')]=function(_0x55f5d5){var _0x1f3a67=this;return new Promise(function(_0x4c2506,_0x335ad7){return db[_0x68a5('0x20')][_0x68a5('0x21')]({'raw':_0x55f5d5[_0x68a5('0x22')]?_0x55f5d5['options'][_0x68a5('0x23')]===undefined?!![]:![]:!![],'where':_0x55f5d5[_0x68a5('0x22')]?_0x55f5d5[_0x68a5('0x22')]['where']||null:null,'attributes':_0x55f5d5[_0x68a5('0x22')]?_0x55f5d5[_0x68a5('0x22')][_0x68a5('0x24')]||null:null,'limit':_0x55f5d5[_0x68a5('0x22')]?_0x55f5d5[_0x68a5('0x22')]['limit']||null:null,'include':_0x55f5d5[_0x68a5('0x22')]?_0x55f5d5['options'][_0x68a5('0x25')]?_[_0x68a5('0x26')](_0x55f5d5['options']['include'],function(_0x48b844){return{'model':db[_0x48b844[_0x68a5('0x27')]],'as':_0x48b844['as'],'attributes':_0x48b844[_0x68a5('0x24')],'include':_0x48b844[_0x68a5('0x25')]?_[_0x68a5('0x26')](_0x48b844[_0x68a5('0x25')],function(_0xb3f7e8){return{'model':db[_0xb3f7e8['model']],'as':_0xb3f7e8['as'],'attributes':_0xb3f7e8['attributes'],'include':_0xb3f7e8[_0x68a5('0x25')]?_['map'](_0xb3f7e8['include'],function(_0x5f40b9){return{'model':db[_0x5f40b9[_0x68a5('0x27')]],'as':_0x5f40b9['as'],'attributes':_0x5f40b9[_0x68a5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x68a5('0x13')](function(_0x2efb2c){logger['info'](_0x68a5('0x1f'),_0x55f5d5);logger['debug'](_0x68a5('0x1f'),_0x55f5d5,JSON[_0x68a5('0x19')](_0x2efb2c));_0x4c2506(_0x2efb2c);})[_0x68a5('0x1e')](function(_0x28566d){logger[_0x68a5('0x1a')](_0x68a5('0x1f'),_0x28566d['message'],_0x55f5d5);_0x335ad7(_0x1f3a67[_0x68a5('0x1a')](0x1f4,_0x28566d[_0x68a5('0x1c')]));});});};exports[_0x68a5('0x28')]=function(_0x1a4611){var _0x169572=this;return new Promise(function(_0x36b43b,_0x13d384){return db[_0x68a5('0x20')][_0x68a5('0x29')]({'raw':_0x1a4611[_0x68a5('0x22')]?_0x1a4611[_0x68a5('0x22')]['raw']===undefined?!![]:![]:!![],'where':_0x1a4611['options']?_0x1a4611['options']['where']||null:null,'attributes':_0x1a4611[_0x68a5('0x22')]?_0x1a4611[_0x68a5('0x22')][_0x68a5('0x24')]||null:null,'include':_0x1a4611[_0x68a5('0x22')]?_0x1a4611[_0x68a5('0x22')][_0x68a5('0x25')]?_[_0x68a5('0x26')](_0x1a4611['options'][_0x68a5('0x25')],function(_0x2c7933){return{'model':db[_0x2c7933['model']],'as':_0x2c7933['as'],'attributes':_0x2c7933['attributes'],'include':_0x2c7933[_0x68a5('0x25')]?_[_0x68a5('0x26')](_0x2c7933[_0x68a5('0x25')],function(_0x1c7e99){return{'model':db[_0x1c7e99['model']],'as':_0x1c7e99['as'],'attributes':_0x1c7e99[_0x68a5('0x24')],'include':_0x1c7e99[_0x68a5('0x25')]?_[_0x68a5('0x26')](_0x1c7e99[_0x68a5('0x25')],function(_0x348f04){return{'model':db[_0x348f04[_0x68a5('0x27')]],'as':_0x348f04['as'],'attributes':_0x348f04[_0x68a5('0x24')]};}):[]};}):[]};}):[]:[]})[_0x68a5('0x13')](function(_0x2be671){logger['info'](_0x68a5('0x28'),_0x1a4611);logger['debug'](_0x68a5('0x28'),_0x1a4611,JSON[_0x68a5('0x19')](_0x2be671));_0x36b43b(_0x2be671);})['catch'](function(_0x206ed0){logger[_0x68a5('0x1a')]('ShowMailQueue',_0x206ed0[_0x68a5('0x1c')],_0x1a4611);_0x13d384(_0x169572[_0x68a5('0x1a')](0x1f4,_0x206ed0['message']));});});}; \ No newline at end of file +var _0xe088=['ShowMailQueue','lodash','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailQueue.socket','register','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','info','find'];(function(_0x478fb6,_0xef7cc9){var _0x40a940=function(_0x2e3807){while(--_0x2e3807){_0x478fb6['push'](_0x478fb6['shift']());}};_0x40a940(++_0xef7cc9);}(_0xe088,0xbf));var _0x8e08=function(_0x20c4a2,_0x83cf29){_0x20c4a2=_0x20c4a2-0x0;var _0x151d44=_0xe088[_0x20c4a2];return _0x151d44;};'use strict';var _=require(_0x8e08('0x0'));var util=require('util');var moment=require(_0x8e08('0x1'));var BPromise=require('bluebird');var rs=require(_0x8e08('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8e08('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8e08('0x4'));var jayson=require(_0x8e08('0x5'));var client=jayson[_0x8e08('0x6')][_0x8e08('0x7')]({'port':0x232a});config[_0x8e08('0x8')]=_[_0x8e08('0x9')](config[_0x8e08('0x8')],{'host':_0x8e08('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e08('0x8')]));require(_0x8e08('0xb'))[_0x8e08('0xc')](socket);function respondWithRpcPromise(_0x406040,_0x3e0f84,_0x35464f){return new BPromise(function(_0xb9c046,_0x1f5770){return client['request'](_0x406040,_0x35464f)['then'](function(_0x4f35b1){logger['info'](_0x8e08('0xd'),_0x3e0f84,_0x8e08('0xe'));logger[_0x8e08('0xf')](_0x8e08('0x10'),_0x3e0f84,_0x8e08('0xe'),JSON[_0x8e08('0x11')](_0x4f35b1));if(_0x4f35b1[_0x8e08('0x12')]){if(_0x4f35b1[_0x8e08('0x12')][_0x8e08('0x13')]===0x1f4){logger[_0x8e08('0x12')](_0x8e08('0xd'),_0x3e0f84,_0x4f35b1[_0x8e08('0x12')][_0x8e08('0x14')]);return _0x1f5770(_0x4f35b1[_0x8e08('0x12')][_0x8e08('0x14')]);}logger['error'](_0x8e08('0xd'),_0x3e0f84,_0x4f35b1['error'][_0x8e08('0x14')]);return _0xb9c046(_0x4f35b1[_0x8e08('0x12')][_0x8e08('0x14')]);}else{logger['info'](_0x8e08('0xd'),_0x3e0f84,_0x8e08('0xe'));_0xb9c046(_0x4f35b1[_0x8e08('0x15')][_0x8e08('0x14')]);}})[_0x8e08('0x16')](function(_0x51b4d1){logger['error'](_0x8e08('0xd'),_0x3e0f84,_0x51b4d1);_0x1f5770(_0x51b4d1);});});}exports[_0x8e08('0x17')]=function(_0x5ee2e9){var _0x3993d4=this;return new Promise(function(_0x4e2784,_0x454bf7){return db[_0x8e08('0x18')][_0x8e08('0x19')]({'raw':_0x5ee2e9[_0x8e08('0x1a')]?_0x5ee2e9[_0x8e08('0x1a')][_0x8e08('0x1b')]===undefined?!![]:![]:!![],'where':_0x5ee2e9[_0x8e08('0x1a')]?_0x5ee2e9[_0x8e08('0x1a')][_0x8e08('0x1c')]||null:null,'attributes':_0x5ee2e9[_0x8e08('0x1a')]?_0x5ee2e9[_0x8e08('0x1a')][_0x8e08('0x1d')]||null:null,'limit':_0x5ee2e9[_0x8e08('0x1a')]?_0x5ee2e9['options'][_0x8e08('0x1e')]||null:null,'include':_0x5ee2e9[_0x8e08('0x1a')]?_0x5ee2e9['options'][_0x8e08('0x1f')]?_[_0x8e08('0x20')](_0x5ee2e9[_0x8e08('0x1a')][_0x8e08('0x1f')],function(_0x1ba28f){return{'model':db[_0x1ba28f['model']],'as':_0x1ba28f['as'],'attributes':_0x1ba28f['attributes'],'include':_0x1ba28f['include']?_[_0x8e08('0x20')](_0x1ba28f[_0x8e08('0x1f')],function(_0x50ad3b){return{'model':db[_0x50ad3b[_0x8e08('0x21')]],'as':_0x50ad3b['as'],'attributes':_0x50ad3b['attributes'],'include':_0x50ad3b[_0x8e08('0x1f')]?_[_0x8e08('0x20')](_0x50ad3b[_0x8e08('0x1f')],function(_0x46f470){return{'model':db[_0x46f470[_0x8e08('0x21')]],'as':_0x46f470['as'],'attributes':_0x46f470[_0x8e08('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8e08('0x22')](function(_0x215596){logger[_0x8e08('0x23')](_0x8e08('0x17'),_0x5ee2e9);logger[_0x8e08('0xf')](_0x8e08('0x17'),_0x5ee2e9,JSON['stringify'](_0x215596));_0x4e2784(_0x215596);})[_0x8e08('0x16')](function(_0xd8f25d){logger['error']('GetMailQueue',_0xd8f25d[_0x8e08('0x14')],_0x5ee2e9);_0x454bf7(_0x3993d4[_0x8e08('0x12')](0x1f4,_0xd8f25d[_0x8e08('0x14')]));});});};exports['ShowMailQueue']=function(_0x59049f){var _0xe17020=this;return new Promise(function(_0x2bf3cd,_0x34bc45){return db[_0x8e08('0x18')][_0x8e08('0x24')]({'raw':_0x59049f['options']?_0x59049f[_0x8e08('0x1a')][_0x8e08('0x1b')]===undefined?!![]:![]:!![],'where':_0x59049f[_0x8e08('0x1a')]?_0x59049f['options'][_0x8e08('0x1c')]||null:null,'attributes':_0x59049f['options']?_0x59049f[_0x8e08('0x1a')]['attributes']||null:null,'include':_0x59049f['options']?_0x59049f[_0x8e08('0x1a')]['include']?_[_0x8e08('0x20')](_0x59049f[_0x8e08('0x1a')][_0x8e08('0x1f')],function(_0x570d83){return{'model':db[_0x570d83[_0x8e08('0x21')]],'as':_0x570d83['as'],'attributes':_0x570d83['attributes'],'include':_0x570d83[_0x8e08('0x1f')]?_[_0x8e08('0x20')](_0x570d83[_0x8e08('0x1f')],function(_0x45fca8){return{'model':db[_0x45fca8[_0x8e08('0x21')]],'as':_0x45fca8['as'],'attributes':_0x45fca8[_0x8e08('0x1d')],'include':_0x45fca8[_0x8e08('0x1f')]?_['map'](_0x45fca8[_0x8e08('0x1f')],function(_0x5e7032){return{'model':db[_0x5e7032[_0x8e08('0x21')]],'as':_0x5e7032['as'],'attributes':_0x5e7032['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a94c2){logger['info']('ShowMailQueue',_0x59049f);logger[_0x8e08('0xf')]('ShowMailQueue',_0x59049f,JSON[_0x8e08('0x11')](_0x3a94c2));_0x2bf3cd(_0x3a94c2);})[_0x8e08('0x16')](function(_0x4554fb){logger[_0x8e08('0x12')](_0x8e08('0x25'),_0x4554fb[_0x8e08('0x14')],_0x59049f);_0x34bc45(_0xe17020[_0x8e08('0x12')](0x1f4,_0x4554fb[_0x8e08('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index ea2e004..57aca2c 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 _0xd06e=['remove','update','emit','length','mailQueue:','./mailQueue.events','save'];(function(_0x469665,_0x394876){var _0x291ab5=function(_0x55c1c7){while(--_0x55c1c7){_0x469665['push'](_0x469665['shift']());}};_0x291ab5(++_0x394876);}(_0xd06e,0x91));var _0xed06=function(_0x550095,_0x141d19){_0x550095=_0x550095-0x0;var _0x1c35b0=_0xd06e[_0x550095];return _0x1c35b0;};'use strict';var MailQueueEvents=require(_0xed06('0x0'));var events=[_0xed06('0x1'),_0xed06('0x2'),_0xed06('0x3')];function createListener(_0x3a5d39,_0x41828e){return function(_0x4cb15d){_0x41828e[_0xed06('0x4')](_0x3a5d39,_0x4cb15d);};}function removeListener(_0x529fca,_0xcb3496){return function(){MailQueueEvents['removeListener'](_0x529fca,_0xcb3496);};}exports['register']=function(_0x160a3c){for(var _0x2c4c1d=0x0,_0x548ed7=events[_0xed06('0x5')];_0x2c4c1d<_0x548ed7;_0x2c4c1d++){var _0x148eda=events[_0x2c4c1d];var _0x1a61ec=createListener(_0xed06('0x6')+_0x148eda,_0x160a3c);MailQueueEvents['on'](_0x148eda,_0x1a61ec);}}; \ No newline at end of file +var _0x398a=['./mailQueue.events','save','update','emit','removeListener','length','mailQueue:'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0x398a,0xe0));var _0xa398=function(_0x1e20b5,_0x5497f7){_0x1e20b5=_0x1e20b5-0x0;var _0x4ddf8c=_0x398a[_0x1e20b5];return _0x4ddf8c;};'use strict';var MailQueueEvents=require(_0xa398('0x0'));var events=[_0xa398('0x1'),'remove',_0xa398('0x2')];function createListener(_0x5c1268,_0x4d286d){return function(_0x447897){_0x4d286d[_0xa398('0x3')](_0x5c1268,_0x447897);};}function removeListener(_0x45f028,_0x19b478){return function(){MailQueueEvents[_0xa398('0x4')](_0x45f028,_0x19b478);};}exports['register']=function(_0x33a281){for(var _0x2e173c=0x0,_0x11c5ca=events[_0xa398('0x5')];_0x2e173c<_0x11c5ca;_0x2e173c++){var _0x521285=events[_0x2e173c];var _0x50b0a4=createListener(_0xa398('0x6')+_0x521285,_0x33a281);MailQueueEvents['on'](_0x521285,_0x50b0a4);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 3ee1399..87b3be7 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 _0x00f1=['/describe','describe','show','post','create','put','/:id','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailQueueReport.controller','isAuthenticated','get'];(function(_0xd85763,_0x56e56b){var _0x454888=function(_0x4f804d){while(--_0x4f804d){_0xd85763['push'](_0xd85763['shift']());}};_0x454888(++_0x56e56b);}(_0x00f1,0x13a));var _0x100f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x00f1[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0x100f('0x0'));var path=require('path');var timeout=require(_0x100f('0x1'));var express=require(_0x100f('0x2'));var router=express[_0x100f('0x3')]();var fs_extra=require(_0x100f('0x4'));var auth=require(_0x100f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x100f('0x6'));router['get']('/',auth[_0x100f('0x7')](),controller['index']);router[_0x100f('0x8')](_0x100f('0x9'),auth[_0x100f('0x7')](),controller[_0x100f('0xa')]);router['get']('/:id',auth[_0x100f('0x7')](),controller[_0x100f('0xb')]);router[_0x100f('0xc')]('/',auth[_0x100f('0x7')](),controller[_0x100f('0xd')]);router[_0x100f('0xe')](_0x100f('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x100f('0x10')](_0x100f('0xf'),auth['isAuthenticated'](),controller[_0x100f('0x11')]);module[_0x100f('0x12')]=router; \ No newline at end of file +var _0x4acd=['/:id','show','post','create','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2f15ef,_0x45e669){var _0x461234=function(_0x40ea87){while(--_0x40ea87){_0x2f15ef['push'](_0x2f15ef['shift']());}};_0x461234(++_0x45e669);}(_0x4acd,0x12d));var _0xd4ac=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0x4acd[_0x4a6cf8];return _0x22205e;};'use strict';var multer=require(_0xd4ac('0x0'));var util=require(_0xd4ac('0x1'));var path=require('path');var timeout=require(_0xd4ac('0x2'));var express=require(_0xd4ac('0x3'));var router=express[_0xd4ac('0x4')]();var fs_extra=require(_0xd4ac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd4ac('0x6'));var config=require(_0xd4ac('0x7'));var controller=require(_0xd4ac('0x8'));router[_0xd4ac('0x9')]('/',auth[_0xd4ac('0xa')](),controller[_0xd4ac('0xb')]);router['get'](_0xd4ac('0xc'),auth['isAuthenticated'](),controller[_0xd4ac('0xd')]);router[_0xd4ac('0x9')](_0xd4ac('0xe'),auth[_0xd4ac('0xa')](),controller[_0xd4ac('0xf')]);router[_0xd4ac('0x10')]('/',auth[_0xd4ac('0xa')](),controller[_0xd4ac('0x11')]);router['put'](_0xd4ac('0xe'),auth[_0xd4ac('0xa')](),controller[_0xd4ac('0x12')]);router['delete'](_0xd4ac('0xe'),auth[_0xd4ac('0xa')](),controller[_0xd4ac('0x13')]);module[_0xd4ac('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 0af6042..6359cc3 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 _0xbb6e=['exports','STRING','DATE','moment','sequelize'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xbb6e,0xe4));var _0xebb6=function(_0xf97aa9,_0x1748b2){_0xf97aa9=_0xf97aa9-0x0;var _0x577e5b=_0xbb6e[_0xf97aa9];return _0x577e5b;};'use strict';var moment=require(_0xebb6('0x0'));var Sequelize=require(_0xebb6('0x1'));module[_0xebb6('0x2')]={'uniqueid':{'type':Sequelize[_0xebb6('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xebb6('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xebb6('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xebb6('0x3')]}}; \ No newline at end of file +var _0xba27=['sequelize','exports','STRING','DATE'];(function(_0x33f01d,_0x1e3fcd){var _0x3394d9=function(_0x5363fc){while(--_0x5363fc){_0x33f01d['push'](_0x33f01d['shift']());}};_0x3394d9(++_0x1e3fcd);}(_0xba27,0x15c));var _0x7ba2=function(_0x351b4c,_0x5d78f5){_0x351b4c=_0x351b4c-0x0;var _0x4de136=_0xba27[_0x351b4c];return _0x4de136;};'use strict';var moment=require('moment');var Sequelize=require(_0x7ba2('0x0'));module[_0x7ba2('0x1')]={'uniqueid':{'type':Sequelize[_0x7ba2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7ba2('0x2')]},'joinAt':{'type':Sequelize[_0x7ba2('0x3')]},'leaveAt':{'type':Sequelize[_0x7ba2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7ba2('0x3')]},'reason':{'type':Sequelize[_0x7ba2('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index e1a48d4..9d0ec5d 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 _0x4137=['key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','show','params','includeAll','options','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','sendStatus','error','name','send','index','map','MailQueueReport','rawAttributes','type'];(function(_0x38add1,_0x44b935){var _0x234c6f=function(_0x150c98){while(--_0x150c98){_0x38add1['push'](_0x38add1['shift']());}};_0x234c6f(++_0x44b935);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x7413('0x0'));var rimraf=require(_0x7413('0x1'));var zipdir=require(_0x7413('0x2'));var jsonpatch=require(_0x7413('0x3'));var rp=require(_0x7413('0x4'));var moment=require(_0x7413('0x5'));var BPromise=require(_0x7413('0x6'));var Mustache=require(_0x7413('0x7'));var util=require(_0x7413('0x8'));var path=require(_0x7413('0x9'));var sox=require(_0x7413('0xa'));var csv=require(_0x7413('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7413('0xc'));var _=require(_0x7413('0xd'));var squel=require(_0x7413('0xe'));var crypto=require(_0x7413('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x7413('0x10'));var toCsv=require(_0x7413('0xb'));var querystring=require('querystring');var Papa=require(_0x7413('0x11'));var Redis=require(_0x7413('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7413('0x13'));var as=require(_0x7413('0x14'));var hardwareService=require(_0x7413('0x15'));var logger=require(_0x7413('0x16'))(_0x7413('0x17'));var utils=require('../../config/utils');var config=require(_0x7413('0x18'));var licenseUtil=require(_0x7413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18a874,_0xa26ca4){_0xa26ca4=_0xa26ca4||0xcc;return function(_0x13e6bd){if(_0x13e6bd){return _0x18a874['sendStatus'](_0xa26ca4);}return _0x18a874['status'](_0xa26ca4)['end']();};}function respondWithResult(_0x2267f6,_0x336c4c){_0x336c4c=_0x336c4c||0xc8;return function(_0x49f0f6){if(_0x49f0f6){return _0x2267f6[_0x7413('0x1a')](_0x336c4c)[_0x7413('0x1b')](_0x49f0f6);}};}function respondWithFilteredResult(_0x4955d3,_0x38b3d1){return function(_0x50f301){if(_0x50f301){var _0x4b9a5b=typeof _0x38b3d1[_0x7413('0x1c')]==='undefined'&&typeof _0x38b3d1[_0x7413('0x1d')]==='undefined';var _0x2036b6=_0x50f301[_0x7413('0x1e')];var _0x19157f=_0x4b9a5b?0x0:_0x38b3d1[_0x7413('0x1c')];var _0x2a3417=_0x4b9a5b?_0x50f301[_0x7413('0x1e')]:_0x38b3d1['offset']+_0x38b3d1[_0x7413('0x1d')];var _0x17c062;if(_0x2a3417>=_0x2036b6){_0x2a3417=_0x2036b6;_0x17c062=0xc8;}else{_0x17c062=0xce;}_0x4955d3[_0x7413('0x1a')](_0x17c062);return _0x4955d3[_0x7413('0x1f')]('Content-Range',_0x19157f+'-'+_0x2a3417+'/'+_0x2036b6)[_0x7413('0x1b')](_0x50f301);}return null;};}function patchUpdates(_0x12d94d){return function(_0x206afc){try{jsonpatch[_0x7413('0x20')](_0x206afc,_0x12d94d,!![]);}catch(_0x409392){return BPromise[_0x7413('0x21')](_0x409392);}return _0x206afc[_0x7413('0x22')]();};}function saveUpdates(_0x4e18cb,_0x56a06a){return function(_0x5f12a2){if(_0x5f12a2){return _0x5f12a2[_0x7413('0x23')](_0x4e18cb)['then'](function(_0x1585ba){return _0x1585ba;});}return null;};}function removeEntity(_0x372944,_0x3b0c81){return function(_0x2fc0f4){if(_0x2fc0f4){return _0x2fc0f4[_0x7413('0x24')]()[_0x7413('0x25')](function(){_0x372944[_0x7413('0x1a')](0xcc)[_0x7413('0x26')]();});}};}function handleEntityNotFound(_0x1d455b,_0x5a8329){return function(_0x5cb15f){if(!_0x5cb15f){_0x1d455b[_0x7413('0x27')](0x194);}return _0x5cb15f;};}function handleError(_0x48c2dc,_0x46c895){_0x46c895=_0x46c895||0x1f4;return function(_0x71cbb4){logger[_0x7413('0x28')](_0x71cbb4['stack']);if(_0x71cbb4[_0x7413('0x29')]){delete _0x71cbb4[_0x7413('0x29')];}_0x48c2dc[_0x7413('0x1a')](_0x46c895)[_0x7413('0x2a')](_0x71cbb4);};}exports[_0x7413('0x2b')]=function(_0x2e521f,_0x5eb4d9){var _0x24dce7={},_0x4ed662={},_0x1d0bde={'count':0x0,'rows':[]};var _0x23e682=_[_0x7413('0x2c')](db[_0x7413('0x2d')][_0x7413('0x2e')],function(_0x2004ea){return{'name':_0x2004ea['fieldName'],'type':_0x2004ea[_0x7413('0x2f')][_0x7413('0x30')]};});_0x4ed662[_0x7413('0x31')]=_[_0x7413('0x2c')](_0x23e682,_0x7413('0x29'));_0x4ed662[_0x7413('0x32')]=_[_0x7413('0x33')](_0x2e521f['query']);_0x4ed662[_0x7413('0x34')]=_[_0x7413('0x35')](_0x4ed662[_0x7413('0x31')],_0x4ed662[_0x7413('0x32')]);_0x24dce7[_0x7413('0x36')]=_['intersection'](_0x4ed662[_0x7413('0x31')],qs['fields'](_0x2e521f[_0x7413('0x32')][_0x7413('0x37')]));_0x24dce7[_0x7413('0x36')]=_0x24dce7['attributes'][_0x7413('0x38')]?_0x24dce7['attributes']:_0x4ed662[_0x7413('0x31')];if(!_0x2e521f[_0x7413('0x32')]['hasOwnProperty']('nolimit')){_0x24dce7[_0x7413('0x1d')]=qs[_0x7413('0x1d')](_0x2e521f[_0x7413('0x32')]['limit']);_0x24dce7['offset']=qs[_0x7413('0x1c')](_0x2e521f['query']['offset']);}_0x24dce7[_0x7413('0x39')]=qs['sort'](_0x2e521f[_0x7413('0x32')][_0x7413('0x3a')]);_0x24dce7[_0x7413('0x3b')]=qs[_0x7413('0x34')](_[_0x7413('0x3c')](_0x2e521f['query'],_0x4ed662[_0x7413('0x34')]),_0x23e682);if(_0x2e521f[_0x7413('0x32')][_0x7413('0x3d')]){_0x24dce7[_0x7413('0x3b')]=_[_0x7413('0x3e')](_0x24dce7[_0x7413('0x3b')],{'$or':_[_0x7413('0x2c')](_0x23e682,function(_0x385156){if(_0x385156[_0x7413('0x2f')]!==_0x7413('0x3f')){var _0x5c03eb={};_0x5c03eb[_0x385156[_0x7413('0x29')]]={'$like':'%'+_0x2e521f['query'][_0x7413('0x3d')]+'%'};return _0x5c03eb;}})});}_0x24dce7=_['merge']({},_0x24dce7,_0x2e521f['options']);var _0x5b592c={'where':_0x24dce7['where']};return db['MailQueueReport'][_0x7413('0x1e')](_0x5b592c)['then'](function(_0x535e49){_0x1d0bde[_0x7413('0x1e')]=_0x535e49;if(_0x2e521f['query']['includeAll']){_0x24dce7[_0x7413('0x40')]=[{'all':!![]}];}return db[_0x7413('0x2d')][_0x7413('0x41')](_0x24dce7);})[_0x7413('0x25')](function(_0x8049c0){_0x1d0bde['rows']=_0x8049c0;return _0x1d0bde;})[_0x7413('0x25')](respondWithFilteredResult(_0x5eb4d9,_0x24dce7))['catch'](handleError(_0x5eb4d9,null));};exports[_0x7413('0x42')]=function(_0x1d8219,_0xa063d1){var _0xfe0daa={'raw':!![],'where':{'id':_0x1d8219[_0x7413('0x43')]['id']}},_0x3f7da2={};_0x3f7da2[_0x7413('0x31')]=_[_0x7413('0x33')](db[_0x7413('0x2d')][_0x7413('0x2e')]);_0x3f7da2[_0x7413('0x32')]=_[_0x7413('0x33')](_0x1d8219[_0x7413('0x32')]);_0x3f7da2['filters']=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],_0x3f7da2[_0x7413('0x32')]);_0xfe0daa[_0x7413('0x36')]=_[_0x7413('0x35')](_0x3f7da2[_0x7413('0x31')],qs[_0x7413('0x37')](_0x1d8219[_0x7413('0x32')][_0x7413('0x37')]));_0xfe0daa[_0x7413('0x36')]=_0xfe0daa[_0x7413('0x36')]['length']?_0xfe0daa[_0x7413('0x36')]:_0x3f7da2['model'];if(_0x1d8219[_0x7413('0x32')][_0x7413('0x44')]){_0xfe0daa[_0x7413('0x40')]=[{'all':!![]}];}_0xfe0daa=_[_0x7413('0x3e')]({},_0xfe0daa,_0x1d8219[_0x7413('0x45')]);return db[_0x7413('0x2d')][_0x7413('0x46')](_0xfe0daa)[_0x7413('0x25')](handleEntityNotFound(_0xa063d1,null))[_0x7413('0x25')](respondWithResult(_0xa063d1,null))[_0x7413('0x47')](handleError(_0xa063d1,null));};exports['create']=function(_0x513657,_0x3c1f1a){return db['MailQueueReport']['create'](_0x513657[_0x7413('0x48')],{})[_0x7413('0x25')](respondWithResult(_0x3c1f1a,0xc9))['catch'](handleError(_0x3c1f1a,null));};exports[_0x7413('0x23')]=function(_0x586d25,_0x562bae){if(_0x586d25[_0x7413('0x48')]['id']){delete _0x586d25['body']['id'];}return db[_0x7413('0x2d')][_0x7413('0x46')]({'where':{'id':_0x586d25[_0x7413('0x43')]['id']}})[_0x7413('0x25')](handleEntityNotFound(_0x562bae,null))[_0x7413('0x25')](saveUpdates(_0x586d25[_0x7413('0x48')],null))[_0x7413('0x25')](respondWithResult(_0x562bae,null))[_0x7413('0x47')](handleError(_0x562bae,null));};exports[_0x7413('0x24')]=function(_0x2031e3,_0x50a27d){return db[_0x7413('0x2d')]['find']({'where':{'id':_0x2031e3['params']['id']}})['then'](handleEntityNotFound(_0x50a27d,null))[_0x7413('0x25')](removeEntity(_0x50a27d,null))[_0x7413('0x47')](handleError(_0x50a27d,null));};exports[_0x7413('0x49')]=function(_0x1ba4e9,_0x4bc337){return db['MailQueueReport'][_0x7413('0x49')]()['then'](respondWithResult(_0x4bc337,null))[_0x7413('0x47')](handleError(_0x4bc337,null));}; \ No newline at end of file +var _0xaebd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','send','index','map','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','catch','params','MailQueueReport','options','create','body','find','describe','eml-format'];(function(_0x249162,_0x457c62){var _0x5a4ba0=function(_0x40d0dd){while(--_0x40d0dd){_0x249162['push'](_0x249162['shift']());}};_0x5a4ba0(++_0x457c62);}(_0xaebd,0x1e9));var _0xdaeb=function(_0xd5a256,_0x50c914){_0xd5a256=_0xd5a256-0x0;var _0x589480=_0xaebd[_0xd5a256];return _0x589480;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){_0x39dfae[_0xdaeb('0x16')](0xcc)[_0xdaeb('0x17')]();});}};}function handleEntityNotFound(_0x3b0770,_0x32c2c1){return function(_0x4fc3e2){if(!_0x4fc3e2){_0x3b0770[_0xdaeb('0x15')](0x194);}return _0x4fc3e2;};}function handleError(_0x34fa21,_0x338687){_0x338687=_0x338687||0x1f4;return function(_0x4eb719){logger['error'](_0x4eb719[_0xdaeb('0x24')]);if(_0x4eb719['name']){delete _0x4eb719['name'];}_0x34fa21[_0xdaeb('0x16')](_0x338687)[_0xdaeb('0x25')](_0x4eb719);};}exports[_0xdaeb('0x26')]=function(_0x5eb7b5,_0x5e6f97){var _0x32966f={},_0x440022={},_0x37f468={'count':0x0,'rows':[]};var _0x596c19=_[_0xdaeb('0x27')](db['MailQueueReport']['rawAttributes'],function(_0x28812c){return{'name':_0x28812c[_0xdaeb('0x28')],'type':_0x28812c[_0xdaeb('0x29')][_0xdaeb('0x2a')]};});_0x440022[_0xdaeb('0x2b')]=_[_0xdaeb('0x27')](_0x596c19,_0xdaeb('0x2c'));_0x440022['query']=_[_0xdaeb('0x2d')](_0x5eb7b5[_0xdaeb('0x2e')]);_0x440022[_0xdaeb('0x2f')]=_[_0xdaeb('0x30')](_0x440022[_0xdaeb('0x2b')],_0x440022['query']);_0x32966f[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x440022['model'],qs[_0xdaeb('0x32')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x32966f[_0xdaeb('0x31')]=_0x32966f[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x32966f[_0xdaeb('0x31')]:_0x440022[_0xdaeb('0x2b')];if(!_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x34')]('nolimit')){_0x32966f['limit']=qs[_0xdaeb('0x1c')](_0x5eb7b5['query'][_0xdaeb('0x1c')]);_0x32966f[_0xdaeb('0x1b')]=qs[_0xdaeb('0x1b')](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x1b')]);}_0x32966f[_0xdaeb('0x35')]=qs['sort'](_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x36')]);_0x32966f[_0xdaeb('0x37')]=qs['filters'](_[_0xdaeb('0x38')](_0x5eb7b5[_0xdaeb('0x2e')],_0x440022[_0xdaeb('0x2f')]),_0x596c19);if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x39')]){_0x32966f[_0xdaeb('0x37')]=_[_0xdaeb('0x3a')](_0x32966f['where'],{'$or':_[_0xdaeb('0x27')](_0x596c19,function(_0x170009){if(_0x170009['type']!=='VIRTUAL'){var _0x2ef310={};_0x2ef310[_0x170009[_0xdaeb('0x2c')]]={'$like':'%'+_0x5eb7b5['query'][_0xdaeb('0x39')]+'%'};return _0x2ef310;}})});}_0x32966f=_[_0xdaeb('0x3a')]({},_0x32966f,_0x5eb7b5['options']);var _0x151cc4={'where':_0x32966f[_0xdaeb('0x37')]};return db['MailQueueReport']['count'](_0x151cc4)[_0xdaeb('0x23')](function(_0x11dce7){_0x37f468[_0xdaeb('0x1a')]=_0x11dce7;if(_0x5eb7b5[_0xdaeb('0x2e')][_0xdaeb('0x3b')]){_0x32966f[_0xdaeb('0x3c')]=[{'all':!![]}];}return db['MailQueueReport'][_0xdaeb('0x3d')](_0x32966f);})['then'](function(_0x46aa44){_0x37f468['rows']=_0x46aa44;return _0x37f468;})['then'](respondWithFilteredResult(_0x5e6f97,_0x32966f))[_0xdaeb('0x3e')](handleError(_0x5e6f97,null));};exports['show']=function(_0x5a42a6,_0x4efd96){var _0x45c3fc={'raw':!![],'where':{'id':_0x5a42a6[_0xdaeb('0x3f')]['id']}},_0x244369={};_0x244369[_0xdaeb('0x2b')]=_['keys'](db[_0xdaeb('0x40')]['rawAttributes']);_0x244369[_0xdaeb('0x2e')]=_[_0xdaeb('0x2d')](_0x5a42a6[_0xdaeb('0x2e')]);_0x244369['filters']=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],_0x244369[_0xdaeb('0x2e')]);_0x45c3fc[_0xdaeb('0x31')]=_[_0xdaeb('0x30')](_0x244369[_0xdaeb('0x2b')],qs[_0xdaeb('0x32')](_0x5a42a6[_0xdaeb('0x2e')][_0xdaeb('0x32')]));_0x45c3fc[_0xdaeb('0x31')]=_0x45c3fc[_0xdaeb('0x31')][_0xdaeb('0x33')]?_0x45c3fc['attributes']:_0x244369[_0xdaeb('0x2b')];if(_0x5a42a6[_0xdaeb('0x2e')]['includeAll']){_0x45c3fc['include']=[{'all':!![]}];}_0x45c3fc=_[_0xdaeb('0x3a')]({},_0x45c3fc,_0x5a42a6[_0xdaeb('0x41')]);return db[_0xdaeb('0x40')]['find'](_0x45c3fc)[_0xdaeb('0x23')](handleEntityNotFound(_0x4efd96,null))[_0xdaeb('0x23')](respondWithResult(_0x4efd96,null))[_0xdaeb('0x3e')](handleError(_0x4efd96,null));};exports[_0xdaeb('0x42')]=function(_0x266d6b,_0x45344b){return db[_0xdaeb('0x40')][_0xdaeb('0x42')](_0x266d6b['body'],{})[_0xdaeb('0x23')](respondWithResult(_0x45344b,0xc9))[_0xdaeb('0x3e')](handleError(_0x45344b,null));};exports['update']=function(_0x38d2ee,_0x4dd70c){if(_0x38d2ee[_0xdaeb('0x43')]['id']){delete _0x38d2ee[_0xdaeb('0x43')]['id'];}return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x38d2ee[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x4dd70c,null))[_0xdaeb('0x23')](saveUpdates(_0x38d2ee[_0xdaeb('0x43')],null))[_0xdaeb('0x23')](respondWithResult(_0x4dd70c,null))['catch'](handleError(_0x4dd70c,null));};exports['destroy']=function(_0x1403c8,_0x3112d2){return db[_0xdaeb('0x40')][_0xdaeb('0x44')]({'where':{'id':_0x1403c8[_0xdaeb('0x3f')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x3112d2,null))['then'](removeEntity(_0x3112d2,null))[_0xdaeb('0x3e')](handleError(_0x3112d2,null));};exports[_0xdaeb('0x45')]=function(_0x3f6a88,_0x589442){return db[_0xdaeb('0x40')]['describe']()[_0xdaeb('0x23')](respondWithResult(_0x589442,null))[_0xdaeb('0x3e')](handleError(_0x589442,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 981dee8..a276eae 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 _0xbe1e=['./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x160bee,_0x387d36){var _0x15e8b1=function(_0x927476){while(--_0x927476){_0x160bee['push'](_0x160bee['shift']());}};_0x15e8b1(++_0x387d36);}(_0xbe1e,0xe2));var _0xebe1=function(_0xd2e11d,_0x4608b6){_0xd2e11d=_0xd2e11d-0x0;var _0x253ac2=_0xbe1e[_0xd2e11d];return _0x253ac2;};'use strict';var _=require(_0xebe1('0x0'));var util=require(_0xebe1('0x1'));var logger=require(_0xebe1('0x2'))(_0xebe1('0x3'));var moment=require('moment');var BPromise=require(_0xebe1('0x4'));var rp=require(_0xebe1('0x5'));var fs=require('fs');var path=require(_0xebe1('0x6'));var rimraf=require('rimraf');var config=require(_0xebe1('0x7'));var attributes=require(_0xebe1('0x8'));module['exports']=function(_0x150091,_0x902536){return _0x150091[_0xebe1('0x9')](_0xebe1('0xa'),attributes,{'tableName':_0xebe1('0xb'),'paranoid':![],'indexes':[{'name':_0xebe1('0xc'),'fields':[_0xebe1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7cc4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','uniqueid','api'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x7cc4,0x155));var _0x47cc=function(_0x38ff1e,_0x3b9385){_0x38ff1e=_0x38ff1e-0x0;var _0x3755d4=_0x7cc4[_0x38ff1e];return _0x3755d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x47cc('0x0'));var moment=require(_0x47cc('0x1'));var BPromise=require(_0x47cc('0x2'));var rp=require(_0x47cc('0x3'));var fs=require('fs');var path=require(_0x47cc('0x4'));var rimraf=require(_0x47cc('0x5'));var config=require(_0x47cc('0x6'));var attributes=require('./mailQueueReport.attributes');module['exports']=function(_0x514682,_0x1bd1e6){return _0x514682[_0x47cc('0x7')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x47cc('0x8'),'fields':[_0x47cc('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 7f1188c..d3173a6 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x19dc07,_0x2ef96f){var _0x5f01bb=function(_0x19fb39){while(--_0x19fb39){_0x19dc07['push'](_0x19dc07['shift']());}};_0x5f01bb(++_0x2ef96f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf99789,_0x5f57fc){var _0x4a152a=function(_0x2b545b){while(--_0x2b545b){_0xf99789['push'](_0xf99789['shift']());}};_0x4a152a(++_0x5f57fc);}(_0x1261,0x144));var _0x1126=function(_0xf39e84,_0x825c93){_0xf39e84=_0xf39e84-0x0;var _0x58e41f=_0x1261[_0xf39e84];return _0x58e41f;};'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')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 6687078..1b10ecd 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2f037d,_0x1ceb8a){var _0x10eb2c=function(_0x4b9a4a){while(--_0x4b9a4a){_0x2f037d['push'](_0x2f037d['shift']());}};_0x10eb2c(++_0x1ceb8a);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c7889,_0x24cd26){_0x1c7889=_0x1c7889-0x0;var _0x2f14e5=_0xcb91[_0x1c7889];return _0x2f14e5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x14125c,_0x54ad13){var _0x2ccf2a=function(_0x4e3dce){while(--_0x4e3dce){_0x14125c['push'](_0x14125c['shift']());}};_0x2ccf2a(++_0x54ad13);}(_0xe706,0xa3));var _0x6e70=function(_0x46ce98,_0x52d764){_0x46ce98=_0x46ce98-0x0;var _0x172f46=_0xe706[_0x46ce98];return _0x172f46;};'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 e8e1589..ea6b416 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 _0x5ee9=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x21899c,_0x4c0d98){var _0x5e895e=function(_0x5d6df9){while(--_0x5d6df9){_0x21899c['push'](_0x21899c['shift']());}};_0x5e895e(++_0x4c0d98);}(_0x5ee9,0x120));var _0x95ee=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5ee9[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x95ee('0x0'));module[_0x95ee('0x1')]={'description':{'type':Sequelize[_0x95ee('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x95ee('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x95ee('0x2')]},'port':{'type':Sequelize[_0x95ee('0x4')]},'tls':{'type':Sequelize[_0x95ee('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x95ee('0x2')],'defaultValue':_0x95ee('0x5')},'connTimeout':{'type':Sequelize[_0x95ee('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x95ee('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x95ee('0x2')]},'modernAuthentication':{'type':Sequelize[_0x95ee('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xa8d3=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x5f2236,_0x237c09){var _0xc52551=function(_0x588b6e){while(--_0x588b6e){_0x5f2236['push'](_0x5f2236['shift']());}};_0xc52551(++_0x237c09);}(_0xa8d3,0x94));var _0x3a8d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa8d3[_0x1ac595];return _0x455fff;};'use strict';var Sequelize=require(_0x3a8d('0x0'));module[_0x3a8d('0x1')]={'description':{'type':Sequelize[_0x3a8d('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x3a8d('0x2')]},'password':{'type':Sequelize[_0x3a8d('0x2')]},'port':{'type':Sequelize[_0x3a8d('0x3')]},'tls':{'type':Sequelize[_0x3a8d('0x4')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x3a8d('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x3a8d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x3a8d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x3a8d('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 1e2f492..f243c0f 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 _0x62bd=['../../config/environment','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x44d39a,_0x2ded78){var _0x11f377=function(_0x35fa69){while(--_0x35fa69){_0x44d39a['push'](_0x44d39a['shift']());}};_0x11f377(++_0x2ded78);}(_0x62bd,0x150));var _0xd62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd62b('0x0'));var util=require(_0xd62b('0x1'));var logger=require(_0xd62b('0x2'))(_0xd62b('0x3'));var moment=require(_0xd62b('0x4'));var BPromise=require(_0xd62b('0x5'));var rp=require(_0xd62b('0x6'));var fs=require('fs');var path=require(_0xd62b('0x7'));var rimraf=require(_0xd62b('0x8'));var config=require(_0xd62b('0x9'));var attributes=require(_0xd62b('0xa'));module[_0xd62b('0xb')]=function(_0x4c6d65,_0x1e9309){return _0x4c6d65[_0xd62b('0xc')](_0xd62b('0xd'),attributes,{'tableName':_0xd62b('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5a0=['define','mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5a0,0x9e));var _0x0b5a=function(_0x48cf09,_0x3b5f6c){_0x48cf09=_0x48cf09-0x0;var _0x203b57=_0xb5a0[_0x48cf09];return _0x203b57;};'use strict';var _=require(_0x0b5a('0x0'));var util=require(_0x0b5a('0x1'));var logger=require(_0x0b5a('0x2'))('api');var moment=require(_0x0b5a('0x3'));var BPromise=require(_0x0b5a('0x4'));var rp=require(_0x0b5a('0x5'));var fs=require('fs');var path=require(_0x0b5a('0x6'));var rimraf=require(_0x0b5a('0x7'));var config=require(_0x0b5a('0x8'));var attributes=require(_0x0b5a('0x9'));module[_0x0b5a('0xa')]=function(_0x25df6a,_0x41213c){return _0x25df6a[_0x0b5a('0xb')]('MailServerIn',attributes,{'tableName':_0x0b5a('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 cf57f40..d397713 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 _0x5c7c=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','error','code','MailServerIn,\x20%s,\x20%s','message','info','result','catch','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','GetMailServerIn','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x435063,_0x4ea50d){var _0x4cf2ae=function(_0x4cab2c){while(--_0x4cab2c){_0x435063['push'](_0x435063['shift']());}};_0x4cf2ae(++_0x4ea50d);}(_0x5c7c,0xe2));var _0xc5c7=function(_0x50b658,_0xd3077f){_0x50b658=_0x50b658-0x0;var _0x484d1d=_0x5c7c[_0x50b658];return _0x484d1d;};'use strict';var _=require(_0xc5c7('0x0'));var util=require('util');var moment=require(_0xc5c7('0x1'));var BPromise=require(_0xc5c7('0x2'));var rs=require(_0xc5c7('0x3'));var fs=require('fs');var Redis=require(_0xc5c7('0x4'));var db=require(_0xc5c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c7('0x6'))(_0xc5c7('0x7'));var config=require(_0xc5c7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5c7('0x9')][_0xc5c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d70c1,_0x18ba87,_0x1c0e31){return new BPromise(function(_0x1ab3f7,_0xb722db){return client[_0xc5c7('0xb')](_0x3d70c1,_0x1c0e31)[_0xc5c7('0xc')](function(_0x335360){logger['info']('MailServerIn,\x20%s,\x20%s',_0x18ba87,_0xc5c7('0xd'));logger[_0xc5c7('0xe')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0x18ba87,'request\x20sent',JSON['stringify'](_0x335360));if(_0x335360[_0xc5c7('0xf')]){if(_0x335360[_0xc5c7('0xf')][_0xc5c7('0x10')]===0x1f4){logger[_0xc5c7('0xf')](_0xc5c7('0x11'),_0x18ba87,_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);return _0xb722db(_0x335360[_0xc5c7('0xf')]['message']);}logger[_0xc5c7('0xf')]('MailServerIn,\x20%s,\x20%s',_0x18ba87,_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);return _0x1ab3f7(_0x335360[_0xc5c7('0xf')][_0xc5c7('0x12')]);}else{logger[_0xc5c7('0x13')](_0xc5c7('0x11'),_0x18ba87,_0xc5c7('0xd'));_0x1ab3f7(_0x335360[_0xc5c7('0x14')]['message']);}})[_0xc5c7('0x15')](function(_0x16826b){logger[_0xc5c7('0xf')]('MailServerIn,\x20%s,\x20%s',_0x18ba87,_0x16826b);_0xb722db(_0x16826b);});});}exports['GetMailServerIn']=function(_0x1db6b3){var _0x22b6f0=this;return new Promise(function(_0x1f0aee,_0x4dd517){return db[_0xc5c7('0x16')][_0xc5c7('0x17')]({'raw':_0x1db6b3[_0xc5c7('0x18')]?_0x1db6b3['options'][_0xc5c7('0x19')]===undefined?!![]:![]:!![],'where':_0x1db6b3[_0xc5c7('0x18')]?_0x1db6b3[_0xc5c7('0x18')][_0xc5c7('0x1a')]||null:null,'attributes':_0x1db6b3[_0xc5c7('0x18')]?_0x1db6b3[_0xc5c7('0x18')][_0xc5c7('0x1b')]||null:null,'limit':_0x1db6b3[_0xc5c7('0x18')]?_0x1db6b3['options'][_0xc5c7('0x1c')]||null:null,'include':_0x1db6b3['options']?_0x1db6b3[_0xc5c7('0x18')][_0xc5c7('0x1d')]?_[_0xc5c7('0x1e')](_0x1db6b3[_0xc5c7('0x18')]['include'],function(_0x10fe26){return{'model':db[_0x10fe26[_0xc5c7('0x1f')]],'as':_0x10fe26['as'],'attributes':_0x10fe26[_0xc5c7('0x1b')],'include':_0x10fe26[_0xc5c7('0x1d')]?_[_0xc5c7('0x1e')](_0x10fe26[_0xc5c7('0x1d')],function(_0x48a623){return{'model':db[_0x48a623['model']],'as':_0x48a623['as'],'attributes':_0x48a623['attributes'],'include':_0x48a623[_0xc5c7('0x1d')]?_[_0xc5c7('0x1e')](_0x48a623[_0xc5c7('0x1d')],function(_0x4a509e){return{'model':db[_0x4a509e[_0xc5c7('0x1f')]],'as':_0x4a509e['as'],'attributes':_0x4a509e[_0xc5c7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc5c7('0xc')](function(_0x515789){logger[_0xc5c7('0x13')](_0xc5c7('0x20'),_0x1db6b3);logger[_0xc5c7('0xe')](_0xc5c7('0x20'),_0x1db6b3,JSON['stringify'](_0x515789));_0x1f0aee(_0x515789);})['catch'](function(_0x13ff18){logger[_0xc5c7('0xf')](_0xc5c7('0x20'),_0x13ff18['message'],_0x1db6b3);_0x4dd517(_0x22b6f0[_0xc5c7('0xf')](0x1f4,_0x13ff18[_0xc5c7('0x12')]));});});}; \ No newline at end of file +var _0x2043=['GetMailServerIn','MailServerIn','findAll','options','raw','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2043,0x122));var _0x3204=function(_0x1ed286,_0x343ff4){_0x1ed286=_0x1ed286-0x0;var _0x4b7012=_0x2043[_0x1ed286];return _0x4b7012;};'use strict';var _=require(_0x3204('0x0'));var util=require(_0x3204('0x1'));var moment=require(_0x3204('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3204('0x3'));var db=require(_0x3204('0x4'))['db'];var utils=require(_0x3204('0x5'));var logger=require(_0x3204('0x6'))(_0x3204('0x7'));var config=require(_0x3204('0x8'));var jayson=require(_0x3204('0x9'));var client=jayson[_0x3204('0xa')][_0x3204('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x162705,_0x20028b,_0x58e3f3){return new BPromise(function(_0x6a4ec5,_0x498944){return client[_0x3204('0xc')](_0x162705,_0x58e3f3)[_0x3204('0xd')](function(_0x3c9cbd){logger[_0x3204('0xe')](_0x3204('0xf'),_0x20028b,_0x3204('0x10'));logger[_0x3204('0x11')](_0x3204('0x12'),_0x20028b,_0x3204('0x10'),JSON[_0x3204('0x13')](_0x3c9cbd));if(_0x3c9cbd[_0x3204('0x14')]){if(_0x3c9cbd['error'][_0x3204('0x15')]===0x1f4){logger[_0x3204('0x14')](_0x3204('0xf'),_0x20028b,_0x3c9cbd['error'][_0x3204('0x16')]);return _0x498944(_0x3c9cbd[_0x3204('0x14')][_0x3204('0x16')]);}logger[_0x3204('0x14')](_0x3204('0xf'),_0x20028b,_0x3c9cbd['error'][_0x3204('0x16')]);return _0x6a4ec5(_0x3c9cbd[_0x3204('0x14')]['message']);}else{logger['info'](_0x3204('0xf'),_0x20028b,_0x3204('0x10'));_0x6a4ec5(_0x3c9cbd[_0x3204('0x17')]['message']);}})[_0x3204('0x18')](function(_0x1a038e){logger[_0x3204('0x14')]('MailServerIn,\x20%s,\x20%s',_0x20028b,_0x1a038e);_0x498944(_0x1a038e);});});}exports[_0x3204('0x19')]=function(_0x35edce){var _0x218c9b=this;return new Promise(function(_0x1fbf21,_0x517c58){return db[_0x3204('0x1a')][_0x3204('0x1b')]({'raw':_0x35edce[_0x3204('0x1c')]?_0x35edce[_0x3204('0x1c')][_0x3204('0x1d')]===undefined?!![]:![]:!![],'where':_0x35edce['options']?_0x35edce[_0x3204('0x1c')]['where']||null:null,'attributes':_0x35edce[_0x3204('0x1c')]?_0x35edce[_0x3204('0x1c')][_0x3204('0x1e')]||null:null,'limit':_0x35edce[_0x3204('0x1c')]?_0x35edce[_0x3204('0x1c')][_0x3204('0x1f')]||null:null,'include':_0x35edce[_0x3204('0x1c')]?_0x35edce[_0x3204('0x1c')][_0x3204('0x20')]?_[_0x3204('0x21')](_0x35edce[_0x3204('0x1c')]['include'],function(_0x3f43c3){return{'model':db[_0x3f43c3[_0x3204('0x22')]],'as':_0x3f43c3['as'],'attributes':_0x3f43c3[_0x3204('0x1e')],'include':_0x3f43c3[_0x3204('0x20')]?_[_0x3204('0x21')](_0x3f43c3[_0x3204('0x20')],function(_0x4847a5){return{'model':db[_0x4847a5['model']],'as':_0x4847a5['as'],'attributes':_0x4847a5['attributes'],'include':_0x4847a5[_0x3204('0x20')]?_[_0x3204('0x21')](_0x4847a5[_0x3204('0x20')],function(_0x35442e){return{'model':db[_0x35442e[_0x3204('0x22')]],'as':_0x35442e['as'],'attributes':_0x35442e['attributes']};}):[]};}):[]};}):[]:[]})[_0x3204('0xd')](function(_0x642fbe){logger[_0x3204('0xe')](_0x3204('0x19'),_0x35edce);logger['debug'](_0x3204('0x19'),_0x35edce,JSON[_0x3204('0x13')](_0x642fbe));_0x1fbf21(_0x642fbe);})[_0x3204('0x18')](function(_0x47e22){logger[_0x3204('0x14')](_0x3204('0x19'),_0x47e22['message'],_0x35edce);_0x517c58(_0x218c9b[_0x3204('0x14')](0x1f4,_0x47e22[_0x3204('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index c8a2bb0..a1ef97c 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a54,0x106));var _0x47a5=function(_0x3fe83a,_0x55f7f1){_0x3fe83a=_0x3fe83a-0x0;var _0x575826=_0x7a54[_0x3fe83a];return _0x575826;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _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(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('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 cdad783..18f118d 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 _0x34b7=['BOOLEAN','STRING','INTEGER'];(function(_0x23631b,_0x5d017c){var _0x2d0ce6=function(_0x29c43a){while(--_0x29c43a){_0x23631b['push'](_0x23631b['shift']());}};_0x2d0ce6(++_0x5d017c);}(_0x34b7,0x196));var _0x734b=function(_0x199b64,_0x5d1120){_0x199b64=_0x199b64-0x0;var _0x42b220=_0x34b7[_0x199b64];return _0x42b220;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x734b('0x0')]},'host':{'type':Sequelize[_0x734b('0x0')]},'user':{'type':Sequelize[_0x734b('0x0')]},'pass':{'type':Sequelize[_0x734b('0x0')]},'port':{'type':Sequelize[_0x734b('0x1')]},'secure':{'type':Sequelize[_0x734b('0x2')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x734b('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x2547=['BOOLEAN','exports','STRING','INTEGER'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0x2547,0x1cd));var _0x7254=function(_0x282d2,_0x9d3f1a){_0x282d2=_0x282d2-0x0;var _0x2cad70=_0x2547[_0x282d2];return _0x2cad70;};'use strict';var Sequelize=require('sequelize');module[_0x7254('0x0')]={'description':{'type':Sequelize[_0x7254('0x1')]},'host':{'type':Sequelize[_0x7254('0x1')]},'user':{'type':Sequelize[_0x7254('0x1')]},'pass':{'type':Sequelize[_0x7254('0x1')]},'port':{'type':Sequelize[_0x7254('0x2')]},'secure':{'type':Sequelize[_0x7254('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x7254('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7254('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 be85993..fc4a5c6 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 _0x6f90=['offset','count','limit','set','apply','reject','save','destroy','then','name','send','index','map','MailServerOut','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x6f90,0x183));var _0x06f9=function(_0x3ffccc,_0x39620f){_0x3ffccc=_0x3ffccc-0x0;var _0x1583d2=_0x6f90[_0x3ffccc];return _0x1583d2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x06f9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06f9('0x1'));var moment=require(_0x06f9('0x2'));var BPromise=require(_0x06f9('0x3'));var Mustache=require('mustache');var util=require(_0x06f9('0x4'));var path=require(_0x06f9('0x5'));var sox=require(_0x06f9('0x6'));var csv=require(_0x06f9('0x7'));var ejs=require(_0x06f9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06f9('0x9'));var squel=require(_0x06f9('0xa'));var crypto=require('crypto');var jsforce=require(_0x06f9('0xb'));var deskjs=require(_0x06f9('0xc'));var toCsv=require(_0x06f9('0x7'));var querystring=require(_0x06f9('0xd'));var Papa=require(_0x06f9('0xe'));var Redis=require('ioredis');var authService=require(_0x06f9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x06f9('0x10'));var hardwareService=require(_0x06f9('0x11'));var logger=require(_0x06f9('0x12'))('api');var utils=require(_0x06f9('0x13'));var config=require(_0x06f9('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x06f9('0x15'))['db'];function respondWithStatusCode(_0x236de7,_0x5c69bf){_0x5c69bf=_0x5c69bf||0xcc;return function(_0x5ded66){if(_0x5ded66){return _0x236de7[_0x06f9('0x16')](_0x5c69bf);}return _0x236de7[_0x06f9('0x17')](_0x5c69bf)[_0x06f9('0x18')]();};}function respondWithResult(_0x2a7a22,_0x54fdd8){_0x54fdd8=_0x54fdd8||0xc8;return function(_0x1ca904){if(_0x1ca904){return _0x2a7a22['status'](_0x54fdd8)[_0x06f9('0x19')](_0x1ca904);}};}function respondWithFilteredResult(_0x44fe67,_0x2d82dc){return function(_0x433e4d){if(_0x433e4d){var _0x3d714d=typeof _0x2d82dc['offset']===_0x06f9('0x1a')&&typeof _0x2d82dc['limit']===_0x06f9('0x1a');var _0x119c8e=_0x433e4d['count'];var _0x4c42b4=_0x3d714d?0x0:_0x2d82dc[_0x06f9('0x1b')];var _0x521a21=_0x3d714d?_0x433e4d[_0x06f9('0x1c')]:_0x2d82dc[_0x06f9('0x1b')]+_0x2d82dc[_0x06f9('0x1d')];var _0x412323;if(_0x521a21>=_0x119c8e){_0x521a21=_0x119c8e;_0x412323=0xc8;}else{_0x412323=0xce;}_0x44fe67[_0x06f9('0x17')](_0x412323);return _0x44fe67[_0x06f9('0x1e')]('Content-Range',_0x4c42b4+'-'+_0x521a21+'/'+_0x119c8e)[_0x06f9('0x19')](_0x433e4d);}return null;};}function patchUpdates(_0x134903){return function(_0x215210){try{jsonpatch[_0x06f9('0x1f')](_0x215210,_0x134903,!![]);}catch(_0x54ebbf){return BPromise[_0x06f9('0x20')](_0x54ebbf);}return _0x215210[_0x06f9('0x21')]();};}function saveUpdates(_0x40498e,_0x1052ef){return function(_0x3ae7cc){if(_0x3ae7cc){return _0x3ae7cc['update'](_0x40498e)['then'](function(_0x1f8512){return _0x1f8512;});}return null;};}function removeEntity(_0x1ba426,_0x403f40){return function(_0x5d7ea0){if(_0x5d7ea0){return _0x5d7ea0[_0x06f9('0x22')]()[_0x06f9('0x23')](function(){_0x1ba426[_0x06f9('0x17')](0xcc)[_0x06f9('0x18')]();});}};}function handleEntityNotFound(_0x17308a,_0x4b818d){return function(_0x29841f){if(!_0x29841f){_0x17308a[_0x06f9('0x16')](0x194);}return _0x29841f;};}function handleError(_0x305c63,_0x4b8b47){_0x4b8b47=_0x4b8b47||0x1f4;return function(_0x1d9d41){logger['error'](_0x1d9d41['stack']);if(_0x1d9d41[_0x06f9('0x24')]){delete _0x1d9d41[_0x06f9('0x24')];}_0x305c63[_0x06f9('0x17')](_0x4b8b47)[_0x06f9('0x25')](_0x1d9d41);};}exports[_0x06f9('0x26')]=function(_0x1efc02,_0x2ada88){var _0x4cc0ba={},_0x32d2e5={},_0x3c4165={'count':0x0,'rows':[]};var _0x2f183d=_[_0x06f9('0x27')](db[_0x06f9('0x28')]['rawAttributes'],function(_0xbad626){return{'name':_0xbad626[_0x06f9('0x29')],'type':_0xbad626['type'][_0x06f9('0x2a')]};});_0x32d2e5['model']=_[_0x06f9('0x27')](_0x2f183d,_0x06f9('0x24'));_0x32d2e5[_0x06f9('0x2b')]=_['keys'](_0x1efc02[_0x06f9('0x2b')]);_0x32d2e5[_0x06f9('0x2c')]=_[_0x06f9('0x2d')](_0x32d2e5[_0x06f9('0x2e')],_0x32d2e5[_0x06f9('0x2b')]);_0x4cc0ba[_0x06f9('0x2f')]=_[_0x06f9('0x2d')](_0x32d2e5[_0x06f9('0x2e')],qs[_0x06f9('0x30')](_0x1efc02[_0x06f9('0x2b')][_0x06f9('0x30')]));_0x4cc0ba['attributes']=_0x4cc0ba[_0x06f9('0x2f')][_0x06f9('0x31')]?_0x4cc0ba[_0x06f9('0x2f')]:_0x32d2e5['model'];if(!_0x1efc02[_0x06f9('0x2b')][_0x06f9('0x32')](_0x06f9('0x33'))){_0x4cc0ba[_0x06f9('0x1d')]=qs[_0x06f9('0x1d')](_0x1efc02[_0x06f9('0x2b')][_0x06f9('0x1d')]);_0x4cc0ba[_0x06f9('0x1b')]=qs[_0x06f9('0x1b')](_0x1efc02[_0x06f9('0x2b')]['offset']);}_0x4cc0ba['order']=qs[_0x06f9('0x34')](_0x1efc02[_0x06f9('0x2b')][_0x06f9('0x34')]);_0x4cc0ba[_0x06f9('0x35')]=qs[_0x06f9('0x2c')](_['pick'](_0x1efc02[_0x06f9('0x2b')],_0x32d2e5[_0x06f9('0x2c')]),_0x2f183d);if(_0x1efc02[_0x06f9('0x2b')][_0x06f9('0x36')]){_0x4cc0ba[_0x06f9('0x35')]=_[_0x06f9('0x37')](_0x4cc0ba[_0x06f9('0x35')],{'$or':_[_0x06f9('0x27')](_0x2f183d,function(_0x3e141b){if(_0x3e141b['type']!==_0x06f9('0x38')){var _0x1d462c={};_0x1d462c[_0x3e141b['name']]={'$like':'%'+_0x1efc02['query']['filter']+'%'};return _0x1d462c;}})});}_0x4cc0ba=_[_0x06f9('0x37')]({},_0x4cc0ba,_0x1efc02[_0x06f9('0x39')]);var _0x6de04b={'where':_0x4cc0ba[_0x06f9('0x35')]};return db[_0x06f9('0x28')][_0x06f9('0x1c')](_0x6de04b)[_0x06f9('0x23')](function(_0x50b2bd){_0x3c4165[_0x06f9('0x1c')]=_0x50b2bd;if(_0x1efc02[_0x06f9('0x2b')][_0x06f9('0x3a')]){_0x4cc0ba['include']=[{'all':!![]}];}return db[_0x06f9('0x28')][_0x06f9('0x3b')](_0x4cc0ba);})[_0x06f9('0x23')](function(_0x22ba19){_0x3c4165[_0x06f9('0x3c')]=_0x22ba19;return _0x3c4165;})[_0x06f9('0x23')](respondWithFilteredResult(_0x2ada88,_0x4cc0ba))[_0x06f9('0x3d')](handleError(_0x2ada88,null));};exports[_0x06f9('0x3e')]=function(_0x429087,_0x13cea0){var _0x92be34={'raw':!![],'where':{'id':_0x429087[_0x06f9('0x3f')]['id']}},_0x14e0a1={};_0x14e0a1['model']=_[_0x06f9('0x40')](db[_0x06f9('0x28')][_0x06f9('0x41')]);_0x14e0a1[_0x06f9('0x2b')]=_[_0x06f9('0x40')](_0x429087[_0x06f9('0x2b')]);_0x14e0a1['filters']=_[_0x06f9('0x2d')](_0x14e0a1[_0x06f9('0x2e')],_0x14e0a1[_0x06f9('0x2b')]);_0x92be34[_0x06f9('0x2f')]=_[_0x06f9('0x2d')](_0x14e0a1[_0x06f9('0x2e')],qs[_0x06f9('0x30')](_0x429087[_0x06f9('0x2b')][_0x06f9('0x30')]));_0x92be34['attributes']=_0x92be34[_0x06f9('0x2f')][_0x06f9('0x31')]?_0x92be34[_0x06f9('0x2f')]:_0x14e0a1['model'];if(_0x429087[_0x06f9('0x2b')][_0x06f9('0x3a')]){_0x92be34['include']=[{'all':!![]}];}_0x92be34=_[_0x06f9('0x37')]({},_0x92be34,_0x429087[_0x06f9('0x39')]);return db['MailServerOut'][_0x06f9('0x42')](_0x92be34)[_0x06f9('0x23')](handleEntityNotFound(_0x13cea0,null))[_0x06f9('0x23')](respondWithResult(_0x13cea0,null))[_0x06f9('0x3d')](handleError(_0x13cea0,null));};exports['create']=function(_0x567522,_0x492091){return db[_0x06f9('0x28')][_0x06f9('0x43')](_0x567522[_0x06f9('0x44')],{})[_0x06f9('0x23')](respondWithResult(_0x492091,0xc9))[_0x06f9('0x3d')](handleError(_0x492091,null));};exports['update']=function(_0x5d0dd6,_0x225940){if(_0x5d0dd6[_0x06f9('0x44')]['id']){delete _0x5d0dd6['body']['id'];}return db[_0x06f9('0x28')][_0x06f9('0x42')]({'where':{'id':_0x5d0dd6[_0x06f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x225940,null))['then'](saveUpdates(_0x5d0dd6[_0x06f9('0x44')],null))[_0x06f9('0x23')](respondWithResult(_0x225940,null))[_0x06f9('0x3d')](handleError(_0x225940,null));};exports['destroy']=function(_0x205b72,_0x3e2b27){return db[_0x06f9('0x28')][_0x06f9('0x42')]({'where':{'id':_0x205b72[_0x06f9('0x3f')]['id']}})[_0x06f9('0x23')](handleEntityNotFound(_0x3e2b27,null))[_0x06f9('0x23')](removeEntity(_0x3e2b27,null))[_0x06f9('0x3d')](handleError(_0x3e2b27,null));}; \ No newline at end of file +var _0xa3b9=['fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','end','stack','name','send','index','map','MailServerOut','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','catch','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x30b7bc,_0x3d83d1){var _0x34b954=function(_0x46c462){while(--_0x46c462){_0x30b7bc['push'](_0x30b7bc['shift']());}};_0x34b954(++_0x3d83d1);}(_0xa3b9,0x1ef));var _0x9a3b=function(_0x4f4d44,_0x584f2a){_0x4f4d44=_0x4f4d44-0x0;var _0x58efd9=_0xa3b9[_0x4f4d44];return _0x58efd9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a3b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a3b('0x1'));var rp=require(_0x9a3b('0x2'));var moment=require(_0x9a3b('0x3'));var BPromise=require(_0x9a3b('0x4'));var Mustache=require('mustache');var util=require(_0x9a3b('0x5'));var path=require(_0x9a3b('0x6'));var sox=require('sox');var csv=require(_0x9a3b('0x7'));var ejs=require(_0x9a3b('0x8'));var fs=require('fs');var fs_extra=require(_0x9a3b('0x9'));var _=require(_0x9a3b('0xa'));var squel=require('squel');var crypto=require(_0x9a3b('0xb'));var jsforce=require(_0x9a3b('0xc'));var deskjs=require(_0x9a3b('0xd'));var toCsv=require(_0x9a3b('0x7'));var querystring=require(_0x9a3b('0xe'));var Papa=require(_0x9a3b('0xf'));var Redis=require('ioredis');var authService=require(_0x9a3b('0x10'));var qs=require(_0x9a3b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9a3b('0x12'))(_0x9a3b('0x13'));var utils=require('../../config/utils');var config=require(_0x9a3b('0x14'));var licenseUtil=require(_0x9a3b('0x15'));var db=require(_0x9a3b('0x16'))['db'];function respondWithStatusCode(_0x4aff1d,_0x439e61){_0x439e61=_0x439e61||0xcc;return function(_0x570a76){if(_0x570a76){return _0x4aff1d[_0x9a3b('0x17')](_0x439e61);}return _0x4aff1d[_0x9a3b('0x18')](_0x439e61)['end']();};}function respondWithResult(_0x8aa5e4,_0x50ea06){_0x50ea06=_0x50ea06||0xc8;return function(_0x58fd0d){if(_0x58fd0d){return _0x8aa5e4['status'](_0x50ea06)['json'](_0x58fd0d);}};}function respondWithFilteredResult(_0x2bc3ae,_0x557e95){return function(_0x40bb58){if(_0x40bb58){var _0x371815=typeof _0x557e95[_0x9a3b('0x19')]===_0x9a3b('0x1a')&&typeof _0x557e95[_0x9a3b('0x1b')]===_0x9a3b('0x1a');var _0x1e834a=_0x40bb58[_0x9a3b('0x1c')];var _0x399685=_0x371815?0x0:_0x557e95[_0x9a3b('0x19')];var _0xf8ce7c=_0x371815?_0x40bb58[_0x9a3b('0x1c')]:_0x557e95[_0x9a3b('0x19')]+_0x557e95[_0x9a3b('0x1b')];var _0x3e3cb3;if(_0xf8ce7c>=_0x1e834a){_0xf8ce7c=_0x1e834a;_0x3e3cb3=0xc8;}else{_0x3e3cb3=0xce;}_0x2bc3ae['status'](_0x3e3cb3);return _0x2bc3ae[_0x9a3b('0x1d')](_0x9a3b('0x1e'),_0x399685+'-'+_0xf8ce7c+'/'+_0x1e834a)['json'](_0x40bb58);}return null;};}function patchUpdates(_0x3ed9b6){return function(_0x992e89){try{jsonpatch['apply'](_0x992e89,_0x3ed9b6,!![]);}catch(_0x4a9f70){return BPromise[_0x9a3b('0x1f')](_0x4a9f70);}return _0x992e89['save']();};}function saveUpdates(_0x28e013,_0x4e669e){return function(_0x4b1617){if(_0x4b1617){return _0x4b1617['update'](_0x28e013)[_0x9a3b('0x20')](function(_0x612841){return _0x612841;});}return null;};}function removeEntity(_0x7707e2,_0x3912e4){return function(_0x545f5d){if(_0x545f5d){return _0x545f5d[_0x9a3b('0x21')]()[_0x9a3b('0x20')](function(){_0x7707e2[_0x9a3b('0x18')](0xcc)[_0x9a3b('0x22')]();});}};}function handleEntityNotFound(_0x26b93b,_0x262d67){return function(_0x1c438f){if(!_0x1c438f){_0x26b93b['sendStatus'](0x194);}return _0x1c438f;};}function handleError(_0x36fbfd,_0xfc2b11){_0xfc2b11=_0xfc2b11||0x1f4;return function(_0x3af7a6){logger['error'](_0x3af7a6[_0x9a3b('0x23')]);if(_0x3af7a6[_0x9a3b('0x24')]){delete _0x3af7a6['name'];}_0x36fbfd[_0x9a3b('0x18')](_0xfc2b11)[_0x9a3b('0x25')](_0x3af7a6);};}exports[_0x9a3b('0x26')]=function(_0x1ac71c,_0x2d2263){var _0x2ab40c={},_0x524ae9={},_0x289b6a={'count':0x0,'rows':[]};var _0x1a727d=_[_0x9a3b('0x27')](db[_0x9a3b('0x28')]['rawAttributes'],function(_0x393a7d){return{'name':_0x393a7d['fieldName'],'type':_0x393a7d[_0x9a3b('0x29')][_0x9a3b('0x2a')]};});_0x524ae9[_0x9a3b('0x2b')]=_[_0x9a3b('0x27')](_0x1a727d,_0x9a3b('0x24'));_0x524ae9[_0x9a3b('0x2c')]=_[_0x9a3b('0x2d')](_0x1ac71c[_0x9a3b('0x2c')]);_0x524ae9[_0x9a3b('0x2e')]=_[_0x9a3b('0x2f')](_0x524ae9[_0x9a3b('0x2b')],_0x524ae9[_0x9a3b('0x2c')]);_0x2ab40c[_0x9a3b('0x30')]=_['intersection'](_0x524ae9[_0x9a3b('0x2b')],qs[_0x9a3b('0x31')](_0x1ac71c['query']['fields']));_0x2ab40c[_0x9a3b('0x30')]=_0x2ab40c[_0x9a3b('0x30')]['length']?_0x2ab40c[_0x9a3b('0x30')]:_0x524ae9[_0x9a3b('0x2b')];if(!_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x32')](_0x9a3b('0x33'))){_0x2ab40c['limit']=qs['limit'](_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x1b')]);_0x2ab40c[_0x9a3b('0x19')]=qs['offset'](_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x19')]);}_0x2ab40c[_0x9a3b('0x34')]=qs[_0x9a3b('0x35')](_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x35')]);_0x2ab40c[_0x9a3b('0x36')]=qs[_0x9a3b('0x2e')](_[_0x9a3b('0x37')](_0x1ac71c[_0x9a3b('0x2c')],_0x524ae9[_0x9a3b('0x2e')]),_0x1a727d);if(_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x38')]){_0x2ab40c[_0x9a3b('0x36')]=_[_0x9a3b('0x39')](_0x2ab40c[_0x9a3b('0x36')],{'$or':_[_0x9a3b('0x27')](_0x1a727d,function(_0x4c12ab){if(_0x4c12ab[_0x9a3b('0x29')]!==_0x9a3b('0x3a')){var _0x1f1f89={};_0x1f1f89[_0x4c12ab[_0x9a3b('0x24')]]={'$like':'%'+_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x38')]+'%'};return _0x1f1f89;}})});}_0x2ab40c=_[_0x9a3b('0x39')]({},_0x2ab40c,_0x1ac71c[_0x9a3b('0x3b')]);var _0x5381a3={'where':_0x2ab40c[_0x9a3b('0x36')]};return db['MailServerOut'][_0x9a3b('0x1c')](_0x5381a3)['then'](function(_0x6a3ef2){_0x289b6a['count']=_0x6a3ef2;if(_0x1ac71c[_0x9a3b('0x2c')][_0x9a3b('0x3c')]){_0x2ab40c[_0x9a3b('0x3d')]=[{'all':!![]}];}return db[_0x9a3b('0x28')][_0x9a3b('0x3e')](_0x2ab40c);})[_0x9a3b('0x20')](function(_0xb5715b){_0x289b6a[_0x9a3b('0x3f')]=_0xb5715b;return _0x289b6a;})[_0x9a3b('0x20')](respondWithFilteredResult(_0x2d2263,_0x2ab40c))['catch'](handleError(_0x2d2263,null));};exports[_0x9a3b('0x40')]=function(_0x2734cd,_0x238475){var _0x3517e9={'raw':!![],'where':{'id':_0x2734cd[_0x9a3b('0x41')]['id']}},_0x4cc17d={};_0x4cc17d['model']=_[_0x9a3b('0x2d')](db[_0x9a3b('0x28')][_0x9a3b('0x42')]);_0x4cc17d[_0x9a3b('0x2c')]=_[_0x9a3b('0x2d')](_0x2734cd[_0x9a3b('0x2c')]);_0x4cc17d[_0x9a3b('0x2e')]=_['intersection'](_0x4cc17d[_0x9a3b('0x2b')],_0x4cc17d['query']);_0x3517e9['attributes']=_[_0x9a3b('0x2f')](_0x4cc17d['model'],qs[_0x9a3b('0x31')](_0x2734cd[_0x9a3b('0x2c')][_0x9a3b('0x31')]));_0x3517e9['attributes']=_0x3517e9[_0x9a3b('0x30')][_0x9a3b('0x43')]?_0x3517e9[_0x9a3b('0x30')]:_0x4cc17d[_0x9a3b('0x2b')];if(_0x2734cd[_0x9a3b('0x2c')]['includeAll']){_0x3517e9[_0x9a3b('0x3d')]=[{'all':!![]}];}_0x3517e9=_['merge']({},_0x3517e9,_0x2734cd[_0x9a3b('0x3b')]);return db[_0x9a3b('0x28')][_0x9a3b('0x44')](_0x3517e9)['then'](handleEntityNotFound(_0x238475,null))[_0x9a3b('0x20')](respondWithResult(_0x238475,null))[_0x9a3b('0x45')](handleError(_0x238475,null));};exports['create']=function(_0x553e86,_0x48e30c){return db[_0x9a3b('0x28')][_0x9a3b('0x46')](_0x553e86[_0x9a3b('0x47')],{})[_0x9a3b('0x20')](respondWithResult(_0x48e30c,0xc9))[_0x9a3b('0x45')](handleError(_0x48e30c,null));};exports['update']=function(_0x16fa9d,_0x155751){if(_0x16fa9d[_0x9a3b('0x47')]['id']){delete _0x16fa9d[_0x9a3b('0x47')]['id'];}return db[_0x9a3b('0x28')][_0x9a3b('0x44')]({'where':{'id':_0x16fa9d['params']['id']}})['then'](handleEntityNotFound(_0x155751,null))[_0x9a3b('0x20')](saveUpdates(_0x16fa9d[_0x9a3b('0x47')],null))[_0x9a3b('0x20')](respondWithResult(_0x155751,null))[_0x9a3b('0x45')](handleError(_0x155751,null));};exports[_0x9a3b('0x21')]=function(_0x11774e,_0x4b8b47){return db[_0x9a3b('0x28')][_0x9a3b('0x44')]({'where':{'id':_0x11774e[_0x9a3b('0x41')]['id']}})[_0x9a3b('0x20')](handleEntityNotFound(_0x4b8b47,null))[_0x9a3b('0x20')](removeEntity(_0x4b8b47,null))[_0x9a3b('0x45')](handleError(_0x4b8b47,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c889dbd..8d44b5a 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 _0x83d3=['path','rimraf','./mailServerOut.attributes','MailServerOut','lodash','util','api','moment','request-promise'];(function(_0x33b62a,_0x3c000f){var _0x1bd1cd=function(_0x213317){while(--_0x213317){_0x33b62a['push'](_0x33b62a['shift']());}};_0x1bd1cd(++_0x3c000f);}(_0x83d3,0xa6));var _0x383d=function(_0xce2ee4,_0x3fe1e1){_0xce2ee4=_0xce2ee4-0x0;var _0x3fd000=_0x83d3[_0xce2ee4];return _0x3fd000;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require('../../config/logger')(_0x383d('0x2'));var moment=require(_0x383d('0x3'));var BPromise=require('bluebird');var rp=require(_0x383d('0x4'));var fs=require('fs');var path=require(_0x383d('0x5'));var rimraf=require(_0x383d('0x6'));var config=require('../../config/environment');var attributes=require(_0x383d('0x7'));module['exports']=function(_0xa32dc6,_0x2c626d){return _0xa32dc6['define'](_0x383d('0x8'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbb54=['MailServerOut','mail_servers_out','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x501133,_0x2e55b5){var _0xb2c5e5=function(_0x40a25e){while(--_0x40a25e){_0x501133['push'](_0x501133['shift']());}};_0xb2c5e5(++_0x2e55b5);}(_0xbb54,0xf9));var _0x4bb5=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0xbb54[_0x134192];return _0x3cd080;};'use strict';var _=require('lodash');var util=require(_0x4bb5('0x0'));var logger=require(_0x4bb5('0x1'))(_0x4bb5('0x2'));var moment=require('moment');var BPromise=require(_0x4bb5('0x3'));var rp=require(_0x4bb5('0x4'));var fs=require('fs');var path=require(_0x4bb5('0x5'));var rimraf=require(_0x4bb5('0x6'));var config=require(_0x4bb5('0x7'));var attributes=require(_0x4bb5('0x8'));module[_0x4bb5('0x9')]=function(_0x3f24c7,_0xbac83){return _0x3f24c7[_0x4bb5('0xa')](_0x4bb5('0xb'),attributes,{'tableName':_0x4bb5('0xc'),'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 12b68db..acd4fb9 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x116482,_0x35ddae){var _0x56db37=function(_0xc3685c){while(--_0xc3685c){_0x116482['push'](_0x116482['shift']());}};_0x56db37(++_0x35ddae);}(_0x2ef3,0xba));var _0x32ef=function(_0x45dae2,_0xa87720){_0x45dae2=_0x45dae2-0x0;var _0x46ac08=_0x2ef3[_0x45dae2];return _0x46ac08;};'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')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x523994,_0x9d7964){var _0x31c408=function(_0x3c7e94){while(--_0x3c7e94){_0x523994['push'](_0x523994['shift']());}};_0x31c408(++_0x9d7964);}(_0x5f2f,0x73));var _0xf5f2=function(_0x345ff4,_0x2ecd5e){_0x345ff4=_0x345ff4-0x0;var _0x18b68a=_0x5f2f[_0x345ff4];return _0x18b68a;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1b032ee..ee836d9 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 _0xe51c=['update','delete','destroy','exports','multer','util','path','connect-timeout','Router','./mailSubstatus.controller','get','isAuthenticated','/describe','/:id','post'];(function(_0xbb4dc3,_0x3e74d8){var _0xcf6f15=function(_0x23d178){while(--_0x23d178){_0xbb4dc3['push'](_0xbb4dc3['shift']());}};_0xcf6f15(++_0x3e74d8);}(_0xe51c,0x13f));var _0xce51=function(_0x251669,_0x4cfefe){_0x251669=_0x251669-0x0;var _0x476916=_0xe51c[_0x251669];return _0x476916;};'use strict';var multer=require(_0xce51('0x0'));var util=require(_0xce51('0x1'));var path=require(_0xce51('0x2'));var timeout=require(_0xce51('0x3'));var express=require('express');var router=express[_0xce51('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(_0xce51('0x5'));router[_0xce51('0x6')]('/',auth[_0xce51('0x7')](),controller['index']);router[_0xce51('0x6')](_0xce51('0x8'),auth[_0xce51('0x7')](),controller['describe']);router[_0xce51('0x6')](_0xce51('0x9'),auth[_0xce51('0x7')](),controller['show']);router[_0xce51('0xa')]('/',auth[_0xce51('0x7')](),controller['create']);router['put'](_0xce51('0x9'),auth[_0xce51('0x7')](),controller[_0xce51('0xb')]);router[_0xce51('0xc')](_0xce51('0x9'),auth[_0xce51('0x7')](),controller[_0xce51('0xd')]);module[_0xce51('0xe')]=router; \ No newline at end of file +var _0x91b3=['get','/describe','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailSubstatus.controller'];(function(_0x1f5fde,_0x2978d9){var _0x16a642=function(_0x30a073){while(--_0x30a073){_0x1f5fde['push'](_0x1f5fde['shift']());}};_0x16a642(++_0x2978d9);}(_0x91b3,0xf0));var _0x391b=function(_0x5bd2fc,_0x1d2391){_0x5bd2fc=_0x5bd2fc-0x0;var _0x5d9753=_0x91b3[_0x5bd2fc];return _0x5d9753;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x391b('0x0'));var timeout=require(_0x391b('0x1'));var express=require(_0x391b('0x2'));var router=express[_0x391b('0x3')]();var fs_extra=require(_0x391b('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x391b('0x5'));var config=require('../../config/environment');var controller=require(_0x391b('0x6'));router[_0x391b('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x391b('0x7')](_0x391b('0x8'),auth[_0x391b('0x9')](),controller[_0x391b('0xa')]);router[_0x391b('0x7')](_0x391b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x391b('0xc')]('/',auth[_0x391b('0x9')](),controller[_0x391b('0xd')]);router[_0x391b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x391b('0xf')]);router[_0x391b('0x10')](_0x391b('0xb'),auth[_0x391b('0x9')](),controller[_0x391b('0x11')]);module[_0x391b('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 cbec2a9..213734c 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 _0xf494=['STRING','sequelize','exports'];(function(_0x139705,_0x21dbc2){var _0x2c03e8=function(_0x8691c9){while(--_0x8691c9){_0x139705['push'](_0x139705['shift']());}};_0x2c03e8(++_0x21dbc2);}(_0xf494,0x1c6));var _0x4f49=function(_0x3c704b,_0xd6f86f){_0x3c704b=_0x3c704b-0x0;var _0x44cb8b=_0xf494[_0x3c704b];return _0x44cb8b;};'use strict';var Sequelize=require(_0x4f49('0x0'));module[_0x4f49('0x1')]={'name':{'type':Sequelize[_0x4f49('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f49('0x2')]}}; \ No newline at end of file +var _0x5075=['exports','STRING','name','sequelize'];(function(_0x71a0f4,_0x1fa8ee){var _0xab5761=function(_0x438d53){while(--_0x438d53){_0x71a0f4['push'](_0x71a0f4['shift']());}};_0xab5761(++_0x1fa8ee);}(_0x5075,0x73));var _0x5507=function(_0x2b8722,_0x50d540){_0x2b8722=_0x2b8722-0x0;var _0x20c180=_0x5075[_0x2b8722];return _0x20c180;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'unique':_0x5507('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5507('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index ab5b88a..52c7531 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 _0x9d61=['intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','fields','options','find','create','body','destroy','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','map','keys','query','filters'];(function(_0x52bb73,_0x4d0075){var _0x5b66fb=function(_0xa06810){while(--_0xa06810){_0x52bb73['push'](_0x52bb73['shift']());}};_0x5b66fb(++_0x4d0075);}(_0x9d61,0xff));var _0x19d6=function(_0x200b64,_0x75ecf8){_0x200b64=_0x200b64-0x0;var _0x550dc0=_0x9d61[_0x200b64];return _0x550dc0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19d6('0x0'));var zipdir=require(_0x19d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19d6('0x2'));var moment=require(_0x19d6('0x3'));var BPromise=require(_0x19d6('0x4'));var Mustache=require(_0x19d6('0x5'));var util=require(_0x19d6('0x6'));var path=require(_0x19d6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x19d6('0x8'));var _=require(_0x19d6('0x9'));var squel=require(_0x19d6('0xa'));var crypto=require('crypto');var jsforce=require(_0x19d6('0xb'));var deskjs=require(_0x19d6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x19d6('0xd'));var Papa=require(_0x19d6('0xe'));var Redis=require(_0x19d6('0xf'));var authService=require(_0x19d6('0x10'));var qs=require(_0x19d6('0x11'));var as=require(_0x19d6('0x12'));var hardwareService=require(_0x19d6('0x13'));var logger=require(_0x19d6('0x14'))(_0x19d6('0x15'));var utils=require('../../config/utils');var config=require(_0x19d6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x19d6('0x17'))['db'];function respondWithStatusCode(_0x57ef4d,_0x1b3130){_0x1b3130=_0x1b3130||0xcc;return function(_0x263c12){if(_0x263c12){return _0x57ef4d[_0x19d6('0x18')](_0x1b3130);}return _0x57ef4d[_0x19d6('0x19')](_0x1b3130)[_0x19d6('0x1a')]();};}function respondWithResult(_0x884969,_0x100e6d){_0x100e6d=_0x100e6d||0xc8;return function(_0x537b95){if(_0x537b95){return _0x884969[_0x19d6('0x19')](_0x100e6d)[_0x19d6('0x1b')](_0x537b95);}};}function respondWithFilteredResult(_0x44d059,_0x2d66aa){return function(_0x92f37f){if(_0x92f37f){var _0x311cd1=typeof _0x2d66aa['offset']===_0x19d6('0x1c')&&typeof _0x2d66aa[_0x19d6('0x1d')]===_0x19d6('0x1c');var _0x317b03=_0x92f37f[_0x19d6('0x1e')];var _0x38e346=_0x311cd1?0x0:_0x2d66aa['offset'];var _0x21cd38=_0x311cd1?_0x92f37f[_0x19d6('0x1e')]:_0x2d66aa[_0x19d6('0x1f')]+_0x2d66aa[_0x19d6('0x1d')];var _0x2d5f0e;if(_0x21cd38>=_0x317b03){_0x21cd38=_0x317b03;_0x2d5f0e=0xc8;}else{_0x2d5f0e=0xce;}_0x44d059[_0x19d6('0x19')](_0x2d5f0e);return _0x44d059[_0x19d6('0x20')](_0x19d6('0x21'),_0x38e346+'-'+_0x21cd38+'/'+_0x317b03)['json'](_0x92f37f);}return null;};}function patchUpdates(_0x22cfb5){return function(_0x599020){try{jsonpatch['apply'](_0x599020,_0x22cfb5,!![]);}catch(_0x443ac3){return BPromise[_0x19d6('0x22')](_0x443ac3);}return _0x599020['save']();};}function saveUpdates(_0x368ce4,_0x32cdb2){return function(_0x3b4633){if(_0x3b4633){return _0x3b4633[_0x19d6('0x23')](_0x368ce4)[_0x19d6('0x24')](function(_0x137a7f){return _0x137a7f;});}return null;};}function removeEntity(_0x47fa22,_0x5168cb){return function(_0x4e5a16){if(_0x4e5a16){return _0x4e5a16['destroy']()['then'](function(){_0x47fa22['status'](0xcc)[_0x19d6('0x1a')]();});}};}function handleEntityNotFound(_0x47ec60,_0x30386e){return function(_0xb4f1cf){if(!_0xb4f1cf){_0x47ec60[_0x19d6('0x18')](0x194);}return _0xb4f1cf;};}function handleError(_0x28d90f,_0x31af17){_0x31af17=_0x31af17||0x1f4;return function(_0x193144){logger[_0x19d6('0x25')](_0x193144[_0x19d6('0x26')]);if(_0x193144[_0x19d6('0x27')]){delete _0x193144[_0x19d6('0x27')];}_0x28d90f[_0x19d6('0x19')](_0x31af17)[_0x19d6('0x28')](_0x193144);};}exports[_0x19d6('0x29')]=function(_0x3b45e8,_0x4d8e38){var _0x151151={},_0x57b1e1={},_0x5401bd={'count':0x0,'rows':[]};var _0xd4803=_['map'](db[_0x19d6('0x2a')][_0x19d6('0x2b')],function(_0x48644e){return{'name':_0x48644e[_0x19d6('0x2c')],'type':_0x48644e['type']['key']};});_0x57b1e1['model']=_[_0x19d6('0x2d')](_0xd4803,_0x19d6('0x27'));_0x57b1e1['query']=_[_0x19d6('0x2e')](_0x3b45e8[_0x19d6('0x2f')]);_0x57b1e1[_0x19d6('0x30')]=_[_0x19d6('0x31')](_0x57b1e1[_0x19d6('0x32')],_0x57b1e1['query']);_0x151151[_0x19d6('0x33')]=_['intersection'](_0x57b1e1[_0x19d6('0x32')],qs['fields'](_0x3b45e8[_0x19d6('0x2f')]['fields']));_0x151151[_0x19d6('0x33')]=_0x151151[_0x19d6('0x33')][_0x19d6('0x34')]?_0x151151[_0x19d6('0x33')]:_0x57b1e1[_0x19d6('0x32')];if(!_0x3b45e8[_0x19d6('0x2f')][_0x19d6('0x35')](_0x19d6('0x36'))){_0x151151[_0x19d6('0x1d')]=qs[_0x19d6('0x1d')](_0x3b45e8[_0x19d6('0x2f')]['limit']);_0x151151[_0x19d6('0x1f')]=qs[_0x19d6('0x1f')](_0x3b45e8[_0x19d6('0x2f')][_0x19d6('0x1f')]);}_0x151151[_0x19d6('0x37')]=qs[_0x19d6('0x38')](_0x3b45e8[_0x19d6('0x2f')]['sort']);_0x151151[_0x19d6('0x39')]=qs[_0x19d6('0x30')](_[_0x19d6('0x3a')](_0x3b45e8[_0x19d6('0x2f')],_0x57b1e1[_0x19d6('0x30')]),_0xd4803);if(_0x3b45e8['query']['filter']){_0x151151['where']=_[_0x19d6('0x3b')](_0x151151['where'],{'$or':_['map'](_0xd4803,function(_0x3b2e2e){if(_0x3b2e2e[_0x19d6('0x3c')]!==_0x19d6('0x3d')){var _0x2af518={};_0x2af518[_0x3b2e2e[_0x19d6('0x27')]]={'$like':'%'+_0x3b45e8[_0x19d6('0x2f')][_0x19d6('0x3e')]+'%'};return _0x2af518;}})});}_0x151151=_['merge']({},_0x151151,_0x3b45e8['options']);var _0x2ad9af={'where':_0x151151[_0x19d6('0x39')]};return db[_0x19d6('0x2a')]['count'](_0x2ad9af)['then'](function(_0x51af86){_0x5401bd[_0x19d6('0x1e')]=_0x51af86;if(_0x3b45e8[_0x19d6('0x2f')][_0x19d6('0x3f')]){_0x151151[_0x19d6('0x40')]=[{'all':!![]}];}return db[_0x19d6('0x2a')]['findAll'](_0x151151);})[_0x19d6('0x24')](function(_0x3435b7){_0x5401bd[_0x19d6('0x41')]=_0x3435b7;return _0x5401bd;})['then'](respondWithFilteredResult(_0x4d8e38,_0x151151))[_0x19d6('0x42')](handleError(_0x4d8e38,null));};exports[_0x19d6('0x43')]=function(_0x5b6a44,_0x1332e5){var _0x4c02f1={'raw':!![],'where':{'id':_0x5b6a44[_0x19d6('0x44')]['id']}},_0xc193c0={};_0xc193c0['model']=_['keys'](db['MailSubstatus'][_0x19d6('0x2b')]);_0xc193c0[_0x19d6('0x2f')]=_[_0x19d6('0x2e')](_0x5b6a44[_0x19d6('0x2f')]);_0xc193c0[_0x19d6('0x30')]=_['intersection'](_0xc193c0[_0x19d6('0x32')],_0xc193c0[_0x19d6('0x2f')]);_0x4c02f1[_0x19d6('0x33')]=_[_0x19d6('0x31')](_0xc193c0[_0x19d6('0x32')],qs[_0x19d6('0x45')](_0x5b6a44[_0x19d6('0x2f')][_0x19d6('0x45')]));_0x4c02f1[_0x19d6('0x33')]=_0x4c02f1['attributes'][_0x19d6('0x34')]?_0x4c02f1[_0x19d6('0x33')]:_0xc193c0[_0x19d6('0x32')];if(_0x5b6a44[_0x19d6('0x2f')][_0x19d6('0x3f')]){_0x4c02f1[_0x19d6('0x40')]=[{'all':!![]}];}_0x4c02f1=_[_0x19d6('0x3b')]({},_0x4c02f1,_0x5b6a44[_0x19d6('0x46')]);return db['MailSubstatus'][_0x19d6('0x47')](_0x4c02f1)[_0x19d6('0x24')](handleEntityNotFound(_0x1332e5,null))[_0x19d6('0x24')](respondWithResult(_0x1332e5,null))[_0x19d6('0x42')](handleError(_0x1332e5,null));};exports[_0x19d6('0x48')]=function(_0x1d8154,_0x5a3c20){return db[_0x19d6('0x2a')]['create'](_0x1d8154[_0x19d6('0x49')],{})[_0x19d6('0x24')](respondWithResult(_0x5a3c20,0xc9))[_0x19d6('0x42')](handleError(_0x5a3c20,null));};exports[_0x19d6('0x23')]=function(_0x48270e,_0x282c0d){if(_0x48270e[_0x19d6('0x49')]['id']){delete _0x48270e[_0x19d6('0x49')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x48270e[_0x19d6('0x44')]['id']}})['then'](handleEntityNotFound(_0x282c0d,null))[_0x19d6('0x24')](saveUpdates(_0x48270e[_0x19d6('0x49')],null))[_0x19d6('0x24')](respondWithResult(_0x282c0d,null))['catch'](handleError(_0x282c0d,null));};exports[_0x19d6('0x4a')]=function(_0x3e768e,_0x12c5a1){return db[_0x19d6('0x2a')][_0x19d6('0x47')]({'where':{'id':_0x3e768e[_0x19d6('0x44')]['id']}})[_0x19d6('0x24')](handleEntityNotFound(_0x12c5a1,null))['then'](removeEntity(_0x12c5a1,null))[_0x19d6('0x42')](handleError(_0x12c5a1,null));};exports[_0x19d6('0x4b')]=function(_0x5d7b42,_0x506347){return db[_0x19d6('0x2a')][_0x19d6('0x4b')]()[_0x19d6('0x24')](respondWithResult(_0x506347,null))[_0x19d6('0x42')](handleError(_0x506347,null));}; \ No newline at end of file +var _0xb86e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','limit','undefined','count','apply','save','update','then','end','sendStatus','error','name','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel'];(function(_0x268b56,_0x371778){var _0x24fff0=function(_0x59c153){while(--_0x59c153){_0x268b56['push'](_0x268b56['shift']());}};_0x24fff0(++_0x371778);}(_0xb86e,0x199));var _0xeb86=function(_0x1a8396,_0x280126){_0x1a8396=_0x1a8396-0x0;var _0x29ce3=_0xb86e[_0x1a8396];return _0x29ce3;};'use strict';var emlformat=require(_0xeb86('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeb86('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb86('0x2'));var BPromise=require(_0xeb86('0x3'));var Mustache=require(_0xeb86('0x4'));var util=require(_0xeb86('0x5'));var path=require('path');var sox=require(_0xeb86('0x6'));var csv=require('to-csv');var ejs=require(_0xeb86('0x7'));var fs=require('fs');var fs_extra=require(_0xeb86('0x8'));var _=require(_0xeb86('0x9'));var squel=require(_0xeb86('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeb86('0xb'));var Papa=require(_0xeb86('0xc'));var Redis=require(_0xeb86('0xd'));var authService=require(_0xeb86('0xe'));var qs=require(_0xeb86('0xf'));var as=require(_0xeb86('0x10'));var hardwareService=require(_0xeb86('0x11'));var logger=require('../../config/logger')(_0xeb86('0x12'));var utils=require(_0xeb86('0x13'));var config=require(_0xeb86('0x14'));var licenseUtil=require(_0xeb86('0x15'));var db=require(_0xeb86('0x16'))['db'];function respondWithStatusCode(_0x35293e,_0x1944cb){_0x1944cb=_0x1944cb||0xcc;return function(_0x5dd5a8){if(_0x5dd5a8){return _0x35293e['sendStatus'](_0x1944cb);}return _0x35293e['status'](_0x1944cb)['end']();};}function respondWithResult(_0x23799c,_0x23fce6){_0x23fce6=_0x23fce6||0xc8;return function(_0x180913){if(_0x180913){return _0x23799c[_0xeb86('0x17')](_0x23fce6)['json'](_0x180913);}};}function respondWithFilteredResult(_0x492a1b,_0x133bcb){return function(_0x43d247){if(_0x43d247){var _0x59817a=typeof _0x133bcb[_0xeb86('0x18')]==='undefined'&&typeof _0x133bcb[_0xeb86('0x19')]===_0xeb86('0x1a');var _0x15dd08=_0x43d247[_0xeb86('0x1b')];var _0x474497=_0x59817a?0x0:_0x133bcb[_0xeb86('0x18')];var _0x2f8634=_0x59817a?_0x43d247['count']:_0x133bcb['offset']+_0x133bcb['limit'];var _0x272702;if(_0x2f8634>=_0x15dd08){_0x2f8634=_0x15dd08;_0x272702=0xc8;}else{_0x272702=0xce;}_0x492a1b[_0xeb86('0x17')](_0x272702);return _0x492a1b['set']('Content-Range',_0x474497+'-'+_0x2f8634+'/'+_0x15dd08)['json'](_0x43d247);}return null;};}function patchUpdates(_0x2e7bb8){return function(_0x5f0735){try{jsonpatch[_0xeb86('0x1c')](_0x5f0735,_0x2e7bb8,!![]);}catch(_0x3d2249){return BPromise['reject'](_0x3d2249);}return _0x5f0735[_0xeb86('0x1d')]();};}function saveUpdates(_0x415537,_0x139a8e){return function(_0x4157d7){if(_0x4157d7){return _0x4157d7[_0xeb86('0x1e')](_0x415537)[_0xeb86('0x1f')](function(_0x1dd488){return _0x1dd488;});}return null;};}function removeEntity(_0xb2355e,_0x2dd457){return function(_0x52139c){if(_0x52139c){return _0x52139c['destroy']()[_0xeb86('0x1f')](function(){_0xb2355e['status'](0xcc)[_0xeb86('0x20')]();});}};}function handleEntityNotFound(_0x4e7b5e,_0x28d257){return function(_0x5cfa31){if(!_0x5cfa31){_0x4e7b5e[_0xeb86('0x21')](0x194);}return _0x5cfa31;};}function handleError(_0x49fee4,_0x3ae384){_0x3ae384=_0x3ae384||0x1f4;return function(_0x254f7b){logger[_0xeb86('0x22')](_0x254f7b['stack']);if(_0x254f7b[_0xeb86('0x23')]){delete _0x254f7b[_0xeb86('0x23')];}_0x49fee4[_0xeb86('0x17')](_0x3ae384)['send'](_0x254f7b);};}exports[_0xeb86('0x24')]=function(_0x4faf32,_0x474e45){var _0x5cc8f5={},_0x1afd7d={},_0x27cb99={'count':0x0,'rows':[]};var _0x4cd464=_[_0xeb86('0x25')](db[_0xeb86('0x26')][_0xeb86('0x27')],function(_0x44757d){return{'name':_0x44757d[_0xeb86('0x28')],'type':_0x44757d[_0xeb86('0x29')]['key']};});_0x1afd7d[_0xeb86('0x2a')]=_[_0xeb86('0x25')](_0x4cd464,_0xeb86('0x23'));_0x1afd7d[_0xeb86('0x2b')]=_[_0xeb86('0x2c')](_0x4faf32[_0xeb86('0x2b')]);_0x1afd7d[_0xeb86('0x2d')]=_[_0xeb86('0x2e')](_0x1afd7d[_0xeb86('0x2a')],_0x1afd7d['query']);_0x5cc8f5[_0xeb86('0x2f')]=_[_0xeb86('0x2e')](_0x1afd7d[_0xeb86('0x2a')],qs[_0xeb86('0x30')](_0x4faf32['query'][_0xeb86('0x30')]));_0x5cc8f5[_0xeb86('0x2f')]=_0x5cc8f5[_0xeb86('0x2f')]['length']?_0x5cc8f5[_0xeb86('0x2f')]:_0x1afd7d[_0xeb86('0x2a')];if(!_0x4faf32[_0xeb86('0x2b')][_0xeb86('0x31')]('nolimit')){_0x5cc8f5[_0xeb86('0x19')]=qs[_0xeb86('0x19')](_0x4faf32[_0xeb86('0x2b')][_0xeb86('0x19')]);_0x5cc8f5[_0xeb86('0x18')]=qs['offset'](_0x4faf32[_0xeb86('0x2b')][_0xeb86('0x18')]);}_0x5cc8f5[_0xeb86('0x32')]=qs[_0xeb86('0x33')](_0x4faf32[_0xeb86('0x2b')][_0xeb86('0x33')]);_0x5cc8f5['where']=qs[_0xeb86('0x2d')](_[_0xeb86('0x34')](_0x4faf32[_0xeb86('0x2b')],_0x1afd7d[_0xeb86('0x2d')]),_0x4cd464);if(_0x4faf32['query']['filter']){_0x5cc8f5['where']=_[_0xeb86('0x35')](_0x5cc8f5[_0xeb86('0x36')],{'$or':_[_0xeb86('0x25')](_0x4cd464,function(_0x15643e){if(_0x15643e['type']!==_0xeb86('0x37')){var _0x2df710={};_0x2df710[_0x15643e[_0xeb86('0x23')]]={'$like':'%'+_0x4faf32[_0xeb86('0x2b')][_0xeb86('0x38')]+'%'};return _0x2df710;}})});}_0x5cc8f5=_[_0xeb86('0x35')]({},_0x5cc8f5,_0x4faf32[_0xeb86('0x39')]);var _0x1fc5a6={'where':_0x5cc8f5[_0xeb86('0x36')]};return db[_0xeb86('0x26')][_0xeb86('0x1b')](_0x1fc5a6)[_0xeb86('0x1f')](function(_0x5c00c9){_0x27cb99[_0xeb86('0x1b')]=_0x5c00c9;if(_0x4faf32[_0xeb86('0x2b')][_0xeb86('0x3a')]){_0x5cc8f5[_0xeb86('0x3b')]=[{'all':!![]}];}return db[_0xeb86('0x26')][_0xeb86('0x3c')](_0x5cc8f5);})[_0xeb86('0x1f')](function(_0x5bfa8f){_0x27cb99[_0xeb86('0x3d')]=_0x5bfa8f;return _0x27cb99;})['then'](respondWithFilteredResult(_0x474e45,_0x5cc8f5))[_0xeb86('0x3e')](handleError(_0x474e45,null));};exports[_0xeb86('0x3f')]=function(_0x4c9e6c,_0x54b386){var _0x173bed={'raw':!![],'where':{'id':_0x4c9e6c[_0xeb86('0x40')]['id']}},_0x34be5f={};_0x34be5f[_0xeb86('0x2a')]=_[_0xeb86('0x2c')](db[_0xeb86('0x26')][_0xeb86('0x27')]);_0x34be5f['query']=_[_0xeb86('0x2c')](_0x4c9e6c[_0xeb86('0x2b')]);_0x34be5f['filters']=_[_0xeb86('0x2e')](_0x34be5f[_0xeb86('0x2a')],_0x34be5f[_0xeb86('0x2b')]);_0x173bed[_0xeb86('0x2f')]=_['intersection'](_0x34be5f[_0xeb86('0x2a')],qs[_0xeb86('0x30')](_0x4c9e6c[_0xeb86('0x2b')][_0xeb86('0x30')]));_0x173bed[_0xeb86('0x2f')]=_0x173bed['attributes'][_0xeb86('0x41')]?_0x173bed[_0xeb86('0x2f')]:_0x34be5f[_0xeb86('0x2a')];if(_0x4c9e6c[_0xeb86('0x2b')][_0xeb86('0x3a')]){_0x173bed[_0xeb86('0x3b')]=[{'all':!![]}];}_0x173bed=_[_0xeb86('0x35')]({},_0x173bed,_0x4c9e6c[_0xeb86('0x39')]);return db['MailSubstatus'][_0xeb86('0x42')](_0x173bed)[_0xeb86('0x1f')](handleEntityNotFound(_0x54b386,null))[_0xeb86('0x1f')](respondWithResult(_0x54b386,null))[_0xeb86('0x3e')](handleError(_0x54b386,null));};exports[_0xeb86('0x43')]=function(_0x20c8de,_0x4d6a71){return db[_0xeb86('0x26')][_0xeb86('0x43')](_0x20c8de[_0xeb86('0x44')],{})[_0xeb86('0x1f')](respondWithResult(_0x4d6a71,0xc9))[_0xeb86('0x3e')](handleError(_0x4d6a71,null));};exports[_0xeb86('0x1e')]=function(_0x59eccd,_0x1ca5e2){if(_0x59eccd['body']['id']){delete _0x59eccd[_0xeb86('0x44')]['id'];}return db[_0xeb86('0x26')][_0xeb86('0x42')]({'where':{'id':_0x59eccd[_0xeb86('0x40')]['id']}})[_0xeb86('0x1f')](handleEntityNotFound(_0x1ca5e2,null))['then'](saveUpdates(_0x59eccd['body'],null))[_0xeb86('0x1f')](respondWithResult(_0x1ca5e2,null))['catch'](handleError(_0x1ca5e2,null));};exports['destroy']=function(_0x46fa3c,_0x56e981){return db['MailSubstatus'][_0xeb86('0x42')]({'where':{'id':_0x46fa3c['params']['id']}})[_0xeb86('0x1f')](handleEntityNotFound(_0x56e981,null))[_0xeb86('0x1f')](removeEntity(_0x56e981,null))['catch'](handleError(_0x56e981,null));};exports[_0xeb86('0x45')]=function(_0x71a116,_0x2b66f3){return db[_0xeb86('0x26')]['describe']()['then'](respondWithResult(_0x2b66f3,null))[_0xeb86('0x3e')](handleError(_0x2b66f3,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index d3223be..51727b1 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 _0x2950=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x1f8126,_0x3038a4){var _0x25af01=function(_0x4728f8){while(--_0x4728f8){_0x1f8126['push'](_0x1f8126['shift']());}};_0x25af01(++_0x3038a4);}(_0x2950,0xe0));var _0x0295=function(_0x3b702c,_0x503f7a){_0x3b702c=_0x3b702c-0x0;var _0x2cd3f9=_0x2950[_0x3b702c];return _0x2cd3f9;};'use strict';var EventEmitter=require(_0x0295('0x0'));var MailSubstatus=require(_0x0295('0x1'))['db'][_0x0295('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x0295('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x3575a9){return function(_0x2db940,_0x3f8bef,_0x5aa424){MailSubstatusEvents[_0x0295('0x4')](_0x3575a9+':'+_0x2db940['id'],_0x2db940);MailSubstatusEvents['emit'](_0x3575a9,_0x2db940);_0x5aa424(null);};}for(var e in events){if(events[_0x0295('0x5')](e)){var event=events[e];MailSubstatus[_0x0295('0x6')](e,emitEvent(event));}}module[_0x0295('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0xd960=['exports','events','MailSubstatus','update','emit','hook'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd960,0xf1));var _0x0d96=function(_0x39c126,_0xe96b9c){_0x39c126=_0x39c126-0x0;var _0x10f6d0=_0xd960[_0x39c126];return _0x10f6d0;};'use strict';var EventEmitter=require(_0x0d96('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x0d96('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x0d96('0x2')};function emitEvent(_0x16d7cc){return function(_0x4ad485,_0x5f1915,_0x2950a1){MailSubstatusEvents[_0x0d96('0x3')](_0x16d7cc+':'+_0x4ad485['id'],_0x4ad485);MailSubstatusEvents[_0x0d96('0x3')](_0x16d7cc,_0x4ad485);_0x2950a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x0d96('0x4')](e,emitEvent(event));}}module[_0x0d96('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 53e8fc1..9d2acd0 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 _0x1de0=['name','then','catch','./mailSubstatus.attributes','exports','models','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus','_previousDataValues'];(function(_0x2fcccf,_0x57a767){var _0x407edc=function(_0x13048b){while(--_0x13048b){_0x2fcccf['push'](_0x2fcccf['shift']());}};_0x407edc(++_0x57a767);}(_0x1de0,0x1b3));var _0x01de=function(_0x2eef8c,_0x15a03d){_0x2eef8c=_0x2eef8c-0x0;var _0x1bec99=_0x1de0[_0x2eef8c];return _0x1bec99;};'use strict';var attributes=require(_0x01de('0x0'));module[_0x01de('0x1')]=function(_0x1876b5){var _0x38c77d=_0x1876b5[_0x01de('0x2')];return _0x1876b5['define'](_0x01de('0x3'),attributes,{'tableName':_0x01de('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x465f0c,_0x45a011,_0x3cd415){return _0x38c77d[_0x01de('0x5')][_0x01de('0x6')]({'value':_0x465f0c['name']},{'where':{'field':_0x01de('0x7'),'value':_0x465f0c[_0x01de('0x8')][_0x01de('0x9')]}})[_0x01de('0xa')](function(){_0x3cd415();})[_0x01de('0xb')](function(_0x33ae5a){_0x3cd415(_0x33ae5a);});}}});}; \ No newline at end of file +var _0xfab2=['exports','models','MailSubstatus','mail_substatuses','name','mailSubstatus','then','./mailSubstatus.attributes'];(function(_0x5885bc,_0x191e09){var _0x6b59e9=function(_0x22333a){while(--_0x22333a){_0x5885bc['push'](_0x5885bc['shift']());}};_0x6b59e9(++_0x191e09);}(_0xfab2,0x87));var _0x2fab=function(_0x5a9bcf,_0xb5db1f){_0x5a9bcf=_0x5a9bcf-0x0;var _0x57fef3=_0xfab2[_0x5a9bcf];return _0x57fef3;};'use strict';var attributes=require(_0x2fab('0x0'));module[_0x2fab('0x1')]=function(_0x407760){var _0x557259=_0x407760[_0x2fab('0x2')];return _0x407760['define'](_0x2fab('0x3'),attributes,{'tableName':_0x2fab('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x22729f,_0x55cb7e,_0x16d71e){return _0x557259['Condition']['update']({'value':_0x22729f[_0x2fab('0x5')]},{'where':{'field':_0x2fab('0x6'),'value':_0x22729f['_previousDataValues'][_0x2fab('0x5')]}})[_0x2fab('0x7')](function(){_0x16d71e();})['catch'](function(_0x584b46){_0x16d71e(_0x584b46);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index a786d8e..39d3b7e 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 _0xe8b1=['request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\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','client','http'];(function(_0x12f654,_0x4e1c65){var _0x59b5ae=function(_0x31cc76){while(--_0x31cc76){_0x12f654['push'](_0x12f654['shift']());}};_0x59b5ae(++_0x4e1c65);}(_0xe8b1,0x8a));var _0x1e8b=function(_0x2330fd,_0x56e9c7){_0x2330fd=_0x2330fd-0x0;var _0x5c1eba=_0xe8b1[_0x2330fd];return _0x5c1eba;};'use strict';var _=require(_0x1e8b('0x0'));var util=require(_0x1e8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1e8b('0x2'));var fs=require('fs');var Redis=require(_0x1e8b('0x3'));var db=require(_0x1e8b('0x4'))['db'];var utils=require(_0x1e8b('0x5'));var logger=require(_0x1e8b('0x6'))(_0x1e8b('0x7'));var config=require(_0x1e8b('0x8'));var jayson=require(_0x1e8b('0x9'));var client=jayson[_0x1e8b('0xa')][_0x1e8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fbc48,_0x398f06,_0x3651d2){return new BPromise(function(_0x343d1e,_0x405b7b){return client[_0x1e8b('0xc')](_0x4fbc48,_0x3651d2)[_0x1e8b('0xd')](function(_0x36a48b){logger[_0x1e8b('0xe')](_0x1e8b('0xf'),_0x398f06,_0x1e8b('0x10'));logger[_0x1e8b('0x11')](_0x1e8b('0x12'),_0x398f06,_0x1e8b('0x10'),JSON[_0x1e8b('0x13')](_0x36a48b));if(_0x36a48b['error']){if(_0x36a48b[_0x1e8b('0x14')][_0x1e8b('0x15')]===0x1f4){logger[_0x1e8b('0x14')](_0x1e8b('0xf'),_0x398f06,_0x36a48b[_0x1e8b('0x14')]['message']);return _0x405b7b(_0x36a48b[_0x1e8b('0x14')]['message']);}logger[_0x1e8b('0x14')](_0x1e8b('0xf'),_0x398f06,_0x36a48b[_0x1e8b('0x14')][_0x1e8b('0x16')]);return _0x343d1e(_0x36a48b[_0x1e8b('0x14')][_0x1e8b('0x16')]);}else{logger['info'](_0x1e8b('0xf'),_0x398f06,_0x1e8b('0x10'));_0x343d1e(_0x36a48b[_0x1e8b('0x17')][_0x1e8b('0x16')]);}})[_0x1e8b('0x18')](function(_0x63f0c5){logger[_0x1e8b('0x14')](_0x1e8b('0xf'),_0x398f06,_0x63f0c5);_0x405b7b(_0x63f0c5);});});} \ No newline at end of file +var _0xe41d=['code','message','MailSubstatus,\x20%s,\x20%s','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2811f6,_0x389737){var _0x2f6d1b=function(_0x54b654){while(--_0x54b654){_0x2811f6['push'](_0x2811f6['shift']());}};_0x2f6d1b(++_0x389737);}(_0xe41d,0x1bd));var _0xde41=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xe41d[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xde41('0x0'));var util=require(_0xde41('0x1'));var moment=require(_0xde41('0x2'));var BPromise=require(_0xde41('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde41('0x4'));var db=require(_0xde41('0x5'))['db'];var utils=require(_0xde41('0x6'));var logger=require(_0xde41('0x7'))(_0xde41('0x8'));var config=require('../../config/environment');var jayson=require(_0xde41('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c5430,_0x3b6f94,_0x44a3f9){return new BPromise(function(_0x5c760c,_0xb97a12){return client[_0xde41('0xa')](_0x4c5430,_0x44a3f9)[_0xde41('0xb')](function(_0xe7df98){logger['info']('MailSubstatus,\x20%s,\x20%s',_0x3b6f94,_0xde41('0xc'));logger[_0xde41('0xd')](_0xde41('0xe'),_0x3b6f94,'request\x20sent',JSON[_0xde41('0xf')](_0xe7df98));if(_0xe7df98[_0xde41('0x10')]){if(_0xe7df98[_0xde41('0x10')][_0xde41('0x11')]===0x1f4){logger[_0xde41('0x10')]('MailSubstatus,\x20%s,\x20%s',_0x3b6f94,_0xe7df98['error']['message']);return _0xb97a12(_0xe7df98[_0xde41('0x10')][_0xde41('0x12')]);}logger[_0xde41('0x10')](_0xde41('0x13'),_0x3b6f94,_0xe7df98[_0xde41('0x10')]['message']);return _0x5c760c(_0xe7df98['error']['message']);}else{logger[_0xde41('0x14')]('MailSubstatus,\x20%s,\x20%s',_0x3b6f94,_0xde41('0xc'));_0x5c760c(_0xe7df98[_0xde41('0x15')][_0xde41('0x12')]);}})['catch'](function(_0x593a02){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x3b6f94,_0x593a02);_0xb97a12(_0x593a02);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index cf889d1..48559d8 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 _0x823c=['./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','delete','destroy','multer','path','express','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x52ec05,_0x15b3ef){var _0x47f47d=function(_0x4a4d00){while(--_0x4a4d00){_0x52ec05['push'](_0x52ec05['shift']());}};_0x47f47d(++_0x15b3ef);}(_0x823c,0xe4));var _0xc823=function(_0x39c22b,_0x4a3247){_0x39c22b=_0x39c22b-0x0;var _0x63f94e=_0x823c[_0x39c22b];return _0x63f94e;};'use strict';var multer=require(_0xc823('0x0'));var util=require('util');var path=require(_0xc823('0x1'));var timeout=require('connect-timeout');var express=require(_0xc823('0x2'));var router=express['Router']();var fs_extra=require(_0xc823('0x3'));var auth=require(_0xc823('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc823('0x5'));var controller=require(_0xc823('0x6'));router[_0xc823('0x7')]('/',auth[_0xc823('0x8')](),controller[_0xc823('0x9')]);router[_0xc823('0x7')](_0xc823('0xa'),auth['isAuthenticated'](),controller[_0xc823('0xb')]);router[_0xc823('0x7')](_0xc823('0xc'),auth[_0xc823('0x8')](),controller[_0xc823('0xd')]);router['post']('/',auth[_0xc823('0x8')](),controller[_0xc823('0xe')]);router['put'](_0xc823('0xc'),auth[_0xc823('0x8')](),controller[_0xc823('0xf')]);router[_0xc823('0x10')](_0xc823('0xc'),auth[_0xc823('0x8')](),controller[_0xc823('0x11')]);module['exports']=router; \ No newline at end of file +var _0x46a4=['/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','util','path','express','Router','fs-extra','../../components/auth/service','./mailTransferReport.controller','index','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x46a4,0x8f));var _0x446a=function(_0x999667,_0x5e40f7){_0x999667=_0x999667-0x0;var _0x10d857=_0x46a4[_0x999667];return _0x10d857;};'use strict';var multer=require('multer');var util=require(_0x446a('0x0'));var path=require(_0x446a('0x1'));var timeout=require('connect-timeout');var express=require(_0x446a('0x2'));var router=express[_0x446a('0x3')]();var fs_extra=require(_0x446a('0x4'));var auth=require(_0x446a('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x446a('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x446a('0x7')]);router[_0x446a('0x8')](_0x446a('0x9'),auth[_0x446a('0xa')](),controller[_0x446a('0xb')]);router[_0x446a('0x8')](_0x446a('0xc'),auth[_0x446a('0xa')](),controller[_0x446a('0xd')]);router[_0x446a('0xe')]('/',auth[_0x446a('0xa')](),controller[_0x446a('0xf')]);router[_0x446a('0x10')](_0x446a('0xc'),auth['isAuthenticated'](),controller[_0x446a('0x11')]);router[_0x446a('0x12')](_0x446a('0xc'),auth[_0x446a('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 933713f..b6215f5 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1a06c4,_0x17d0e0){var _0x1bf57b=function(_0x2c11fa){while(--_0x2c11fa){_0x1a06c4['push'](_0x1a06c4['shift']());}};_0x1bf57b(++_0x17d0e0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x970738,_0xdf88fa){var _0x181cc9=function(_0x4a3894){while(--_0x4a3894){_0x970738['push'](_0x970738['shift']());}};_0x181cc9(++_0xdf88fa);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xcb91[_0x1969a7];return _0x3d665f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index c39e70e..48a7e07 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 _0x3d99=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../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','reject','save','update','then','destroy','stack','name','index','MailTransferReport','rawAttributes','fieldName','key','model','map','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x47a052,_0x353806){var _0x232d11=function(_0x50af29){while(--_0x50af29){_0x47a052['push'](_0x47a052['shift']());}};_0x232d11(++_0x353806);}(_0x3d99,0x91));var _0x93d9=function(_0x385bf4,_0x5e15d4){_0x385bf4=_0x385bf4-0x0;var _0x2243bd=_0x3d99[_0x385bf4];return _0x2243bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93d9('0x0'));var zipdir=require(_0x93d9('0x1'));var jsonpatch=require(_0x93d9('0x2'));var rp=require('request-promise');var moment=require(_0x93d9('0x3'));var BPromise=require(_0x93d9('0x4'));var Mustache=require(_0x93d9('0x5'));var util=require('util');var path=require(_0x93d9('0x6'));var sox=require(_0x93d9('0x7'));var csv=require(_0x93d9('0x8'));var ejs=require(_0x93d9('0x9'));var fs=require('fs');var fs_extra=require(_0x93d9('0xa'));var _=require(_0x93d9('0xb'));var squel=require(_0x93d9('0xc'));var crypto=require(_0x93d9('0xd'));var jsforce=require(_0x93d9('0xe'));var deskjs=require(_0x93d9('0xf'));var toCsv=require(_0x93d9('0x8'));var querystring=require(_0x93d9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93d9('0x11'));var qs=require(_0x93d9('0x12'));var as=require(_0x93d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x93d9('0x14'))(_0x93d9('0x15'));var utils=require(_0x93d9('0x16'));var config=require(_0x93d9('0x17'));var licenseUtil=require(_0x93d9('0x18'));var db=require(_0x93d9('0x19'))['db'];function respondWithStatusCode(_0xcc0a26,_0x3c0a70){_0x3c0a70=_0x3c0a70||0xcc;return function(_0x1d4f63){if(_0x1d4f63){return _0xcc0a26[_0x93d9('0x1a')](_0x3c0a70);}return _0xcc0a26[_0x93d9('0x1b')](_0x3c0a70)[_0x93d9('0x1c')]();};}function respondWithResult(_0x2fb55f,_0x15631d){_0x15631d=_0x15631d||0xc8;return function(_0x46b258){if(_0x46b258){return _0x2fb55f[_0x93d9('0x1b')](_0x15631d)[_0x93d9('0x1d')](_0x46b258);}};}function respondWithFilteredResult(_0x4ccb7c,_0x30bc4a){return function(_0x3e5adc){if(_0x3e5adc){var _0x1bfdd8=typeof _0x30bc4a[_0x93d9('0x1e')]===_0x93d9('0x1f')&&typeof _0x30bc4a[_0x93d9('0x20')]===_0x93d9('0x1f');var _0x291fab=_0x3e5adc[_0x93d9('0x21')];var _0x429e78=_0x1bfdd8?0x0:_0x30bc4a[_0x93d9('0x1e')];var _0x317369=_0x1bfdd8?_0x3e5adc[_0x93d9('0x21')]:_0x30bc4a[_0x93d9('0x1e')]+_0x30bc4a['limit'];var _0x5c2691;if(_0x317369>=_0x291fab){_0x317369=_0x291fab;_0x5c2691=0xc8;}else{_0x5c2691=0xce;}_0x4ccb7c['status'](_0x5c2691);return _0x4ccb7c[_0x93d9('0x22')](_0x93d9('0x23'),_0x429e78+'-'+_0x317369+'/'+_0x291fab)[_0x93d9('0x1d')](_0x3e5adc);}return null;};}function patchUpdates(_0x33769f){return function(_0x1af17b){try{jsonpatch['apply'](_0x1af17b,_0x33769f,!![]);}catch(_0x5c5910){return BPromise[_0x93d9('0x24')](_0x5c5910);}return _0x1af17b[_0x93d9('0x25')]();};}function saveUpdates(_0x396580,_0x5640c5){return function(_0x52f5fc){if(_0x52f5fc){return _0x52f5fc[_0x93d9('0x26')](_0x396580)[_0x93d9('0x27')](function(_0xa14842){return _0xa14842;});}return null;};}function removeEntity(_0x2c3f75,_0x4a811e){return function(_0x31f624){if(_0x31f624){return _0x31f624[_0x93d9('0x28')]()[_0x93d9('0x27')](function(){_0x2c3f75[_0x93d9('0x1b')](0xcc)[_0x93d9('0x1c')]();});}};}function handleEntityNotFound(_0x3d28e0,_0x4cdf5d){return function(_0x4e4997){if(!_0x4e4997){_0x3d28e0[_0x93d9('0x1a')](0x194);}return _0x4e4997;};}function handleError(_0xc5a9d9,_0x59bf95){_0x59bf95=_0x59bf95||0x1f4;return function(_0x34311e){logger['error'](_0x34311e[_0x93d9('0x29')]);if(_0x34311e[_0x93d9('0x2a')]){delete _0x34311e[_0x93d9('0x2a')];}_0xc5a9d9['status'](_0x59bf95)['send'](_0x34311e);};}exports[_0x93d9('0x2b')]=function(_0x5e1dbb,_0x435ad5){var _0x53df01={},_0xbd53b0={},_0x4d5d9e={'count':0x0,'rows':[]};var _0x217483=_['map'](db[_0x93d9('0x2c')][_0x93d9('0x2d')],function(_0x21a868){return{'name':_0x21a868[_0x93d9('0x2e')],'type':_0x21a868['type'][_0x93d9('0x2f')]};});_0xbd53b0[_0x93d9('0x30')]=_[_0x93d9('0x31')](_0x217483,'name');_0xbd53b0['query']=_[_0x93d9('0x32')](_0x5e1dbb['query']);_0xbd53b0[_0x93d9('0x33')]=_[_0x93d9('0x34')](_0xbd53b0[_0x93d9('0x30')],_0xbd53b0['query']);_0x53df01[_0x93d9('0x35')]=_[_0x93d9('0x34')](_0xbd53b0['model'],qs[_0x93d9('0x36')](_0x5e1dbb['query'][_0x93d9('0x36')]));_0x53df01[_0x93d9('0x35')]=_0x53df01[_0x93d9('0x35')][_0x93d9('0x37')]?_0x53df01[_0x93d9('0x35')]:_0xbd53b0['model'];if(!_0x5e1dbb[_0x93d9('0x38')][_0x93d9('0x39')](_0x93d9('0x3a'))){_0x53df01[_0x93d9('0x20')]=qs['limit'](_0x5e1dbb[_0x93d9('0x38')][_0x93d9('0x20')]);_0x53df01[_0x93d9('0x1e')]=qs[_0x93d9('0x1e')](_0x5e1dbb['query'][_0x93d9('0x1e')]);}_0x53df01[_0x93d9('0x3b')]=qs[_0x93d9('0x3c')](_0x5e1dbb[_0x93d9('0x38')][_0x93d9('0x3c')]);_0x53df01['where']=qs['filters'](_[_0x93d9('0x3d')](_0x5e1dbb[_0x93d9('0x38')],_0xbd53b0[_0x93d9('0x33')]),_0x217483);if(_0x5e1dbb[_0x93d9('0x38')][_0x93d9('0x3e')]){_0x53df01[_0x93d9('0x3f')]=_[_0x93d9('0x40')](_0x53df01[_0x93d9('0x3f')],{'$or':_[_0x93d9('0x31')](_0x217483,function(_0x5c91ab){if(_0x5c91ab[_0x93d9('0x41')]!==_0x93d9('0x42')){var _0x48d323={};_0x48d323[_0x5c91ab[_0x93d9('0x2a')]]={'$like':'%'+_0x5e1dbb[_0x93d9('0x38')][_0x93d9('0x3e')]+'%'};return _0x48d323;}})});}_0x53df01=_[_0x93d9('0x40')]({},_0x53df01,_0x5e1dbb[_0x93d9('0x43')]);var _0x3c10b5={'where':_0x53df01['where']};return db['MailTransferReport'][_0x93d9('0x21')](_0x3c10b5)[_0x93d9('0x27')](function(_0x2d0cf8){_0x4d5d9e[_0x93d9('0x21')]=_0x2d0cf8;if(_0x5e1dbb[_0x93d9('0x38')]['includeAll']){_0x53df01['include']=[{'all':!![]}];}return db['MailTransferReport'][_0x93d9('0x44')](_0x53df01);})[_0x93d9('0x27')](function(_0x3e2fc4){_0x4d5d9e[_0x93d9('0x45')]=_0x3e2fc4;return _0x4d5d9e;})[_0x93d9('0x27')](respondWithFilteredResult(_0x435ad5,_0x53df01))[_0x93d9('0x46')](handleError(_0x435ad5,null));};exports[_0x93d9('0x47')]=function(_0x840b4,_0x4fa791){var _0x419266={'raw':!![],'where':{'id':_0x840b4[_0x93d9('0x48')]['id']}},_0x691d2e={};_0x691d2e[_0x93d9('0x30')]=_[_0x93d9('0x32')](db[_0x93d9('0x2c')][_0x93d9('0x2d')]);_0x691d2e['query']=_[_0x93d9('0x32')](_0x840b4['query']);_0x691d2e[_0x93d9('0x33')]=_[_0x93d9('0x34')](_0x691d2e[_0x93d9('0x30')],_0x691d2e[_0x93d9('0x38')]);_0x419266[_0x93d9('0x35')]=_[_0x93d9('0x34')](_0x691d2e['model'],qs[_0x93d9('0x36')](_0x840b4['query'][_0x93d9('0x36')]));_0x419266['attributes']=_0x419266[_0x93d9('0x35')][_0x93d9('0x37')]?_0x419266[_0x93d9('0x35')]:_0x691d2e['model'];if(_0x840b4[_0x93d9('0x38')]['includeAll']){_0x419266['include']=[{'all':!![]}];}_0x419266=_[_0x93d9('0x40')]({},_0x419266,_0x840b4[_0x93d9('0x43')]);return db[_0x93d9('0x2c')][_0x93d9('0x49')](_0x419266)[_0x93d9('0x27')](handleEntityNotFound(_0x4fa791,null))[_0x93d9('0x27')](respondWithResult(_0x4fa791,null))[_0x93d9('0x46')](handleError(_0x4fa791,null));};exports[_0x93d9('0x4a')]=function(_0x134c75,_0x25f203){return db['MailTransferReport'][_0x93d9('0x4a')](_0x134c75[_0x93d9('0x4b')],{})[_0x93d9('0x27')](respondWithResult(_0x25f203,0xc9))['catch'](handleError(_0x25f203,null));};exports[_0x93d9('0x26')]=function(_0x2e4d34,_0x7b75bb){if(_0x2e4d34[_0x93d9('0x4b')]['id']){delete _0x2e4d34['body']['id'];}return db[_0x93d9('0x2c')][_0x93d9('0x49')]({'where':{'id':_0x2e4d34[_0x93d9('0x48')]['id']}})[_0x93d9('0x27')](handleEntityNotFound(_0x7b75bb,null))[_0x93d9('0x27')](saveUpdates(_0x2e4d34[_0x93d9('0x4b')],null))[_0x93d9('0x27')](respondWithResult(_0x7b75bb,null))['catch'](handleError(_0x7b75bb,null));};exports['destroy']=function(_0x115ae8,_0x439aef){return db['MailTransferReport']['find']({'where':{'id':_0x115ae8['params']['id']}})['then'](handleEntityNotFound(_0x439aef,null))[_0x93d9('0x27')](removeEntity(_0x439aef,null))['catch'](handleError(_0x439aef,null));};exports[_0x93d9('0x4c')]=function(_0x4ab830,_0x3b25b7){return db['MailTransferReport'][_0x93d9('0x4c')]()[_0x93d9('0x27')](respondWithResult(_0x3b25b7,null))[_0x93d9('0x46')](handleError(_0x3b25b7,null));}; \ No newline at end of file +var _0x8fa4=['catch','show','params','intersection','length','include','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','name','send','index','map','MailTransferReport','rawAttributes','key','model','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x8fa4,0x9f));var _0x48fa=function(_0x483772,_0x3ddae9){_0x483772=_0x483772-0x0;var _0x374e2e=_0x8fa4[_0x483772];return _0x374e2e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x48fa('0x0'));var jsonpatch=require(_0x48fa('0x1'));var rp=require(_0x48fa('0x2'));var moment=require(_0x48fa('0x3'));var BPromise=require(_0x48fa('0x4'));var Mustache=require(_0x48fa('0x5'));var util=require(_0x48fa('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x48fa('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48fa('0x8'));var squel=require(_0x48fa('0x9'));var crypto=require(_0x48fa('0xa'));var jsforce=require(_0x48fa('0xb'));var deskjs=require(_0x48fa('0xc'));var toCsv=require(_0x48fa('0xd'));var querystring=require(_0x48fa('0xe'));var Papa=require('papaparse');var Redis=require(_0x48fa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x48fa('0x10'));var as=require(_0x48fa('0x11'));var hardwareService=require(_0x48fa('0x12'));var logger=require(_0x48fa('0x13'))(_0x48fa('0x14'));var utils=require('../../config/utils');var config=require(_0x48fa('0x15'));var licenseUtil=require(_0x48fa('0x16'));var db=require(_0x48fa('0x17'))['db'];function respondWithStatusCode(_0x5354ed,_0x1ad8db){_0x1ad8db=_0x1ad8db||0xcc;return function(_0x51b2ca){if(_0x51b2ca){return _0x5354ed['sendStatus'](_0x1ad8db);}return _0x5354ed[_0x48fa('0x18')](_0x1ad8db)[_0x48fa('0x19')]();};}function respondWithResult(_0x47f410,_0xec4acb){_0xec4acb=_0xec4acb||0xc8;return function(_0x2c61d7){if(_0x2c61d7){return _0x47f410['status'](_0xec4acb)[_0x48fa('0x1a')](_0x2c61d7);}};}function respondWithFilteredResult(_0x383ee4,_0x4290a3){return function(_0xfc521){if(_0xfc521){var _0xcbd26e=typeof _0x4290a3[_0x48fa('0x1b')]===_0x48fa('0x1c')&&typeof _0x4290a3[_0x48fa('0x1d')]===_0x48fa('0x1c');var _0x374a38=_0xfc521[_0x48fa('0x1e')];var _0x2304b1=_0xcbd26e?0x0:_0x4290a3[_0x48fa('0x1b')];var _0x469015=_0xcbd26e?_0xfc521[_0x48fa('0x1e')]:_0x4290a3['offset']+_0x4290a3[_0x48fa('0x1d')];var _0x3c4dc2;if(_0x469015>=_0x374a38){_0x469015=_0x374a38;_0x3c4dc2=0xc8;}else{_0x3c4dc2=0xce;}_0x383ee4['status'](_0x3c4dc2);return _0x383ee4['set'](_0x48fa('0x1f'),_0x2304b1+'-'+_0x469015+'/'+_0x374a38)['json'](_0xfc521);}return null;};}function patchUpdates(_0x2f12ff){return function(_0x322ea1){try{jsonpatch[_0x48fa('0x20')](_0x322ea1,_0x2f12ff,!![]);}catch(_0x3e2621){return BPromise['reject'](_0x3e2621);}return _0x322ea1[_0x48fa('0x21')]();};}function saveUpdates(_0x4bd2d2,_0xcf7329){return function(_0x19315b){if(_0x19315b){return _0x19315b[_0x48fa('0x22')](_0x4bd2d2)[_0x48fa('0x23')](function(_0x2a07c7){return _0x2a07c7;});}return null;};}function removeEntity(_0x29586d,_0x11d98e){return function(_0x331723){if(_0x331723){return _0x331723[_0x48fa('0x24')]()['then'](function(){_0x29586d[_0x48fa('0x18')](0xcc)[_0x48fa('0x19')]();});}};}function handleEntityNotFound(_0xe078f5,_0x43fb70){return function(_0x300142){if(!_0x300142){_0xe078f5[_0x48fa('0x25')](0x194);}return _0x300142;};}function handleError(_0x2eee5d,_0x246d9e){_0x246d9e=_0x246d9e||0x1f4;return function(_0x3e3535){logger[_0x48fa('0x26')](_0x3e3535['stack']);if(_0x3e3535[_0x48fa('0x27')]){delete _0x3e3535[_0x48fa('0x27')];}_0x2eee5d[_0x48fa('0x18')](_0x246d9e)[_0x48fa('0x28')](_0x3e3535);};}exports[_0x48fa('0x29')]=function(_0x5d67c3,_0x3a0f00){var _0x27346a={},_0x18a191={},_0x1913e2={'count':0x0,'rows':[]};var _0x1c4ca2=_[_0x48fa('0x2a')](db[_0x48fa('0x2b')][_0x48fa('0x2c')],function(_0x2d7192){return{'name':_0x2d7192['fieldName'],'type':_0x2d7192['type'][_0x48fa('0x2d')]};});_0x18a191[_0x48fa('0x2e')]=_['map'](_0x1c4ca2,_0x48fa('0x27'));_0x18a191[_0x48fa('0x2f')]=_[_0x48fa('0x30')](_0x5d67c3[_0x48fa('0x2f')]);_0x18a191['filters']=_['intersection'](_0x18a191[_0x48fa('0x2e')],_0x18a191[_0x48fa('0x2f')]);_0x27346a[_0x48fa('0x31')]=_['intersection'](_0x18a191['model'],qs[_0x48fa('0x32')](_0x5d67c3[_0x48fa('0x2f')][_0x48fa('0x32')]));_0x27346a['attributes']=_0x27346a[_0x48fa('0x31')]['length']?_0x27346a[_0x48fa('0x31')]:_0x18a191[_0x48fa('0x2e')];if(!_0x5d67c3['query'][_0x48fa('0x33')](_0x48fa('0x34'))){_0x27346a[_0x48fa('0x1d')]=qs[_0x48fa('0x1d')](_0x5d67c3['query'][_0x48fa('0x1d')]);_0x27346a[_0x48fa('0x1b')]=qs[_0x48fa('0x1b')](_0x5d67c3[_0x48fa('0x2f')][_0x48fa('0x1b')]);}_0x27346a[_0x48fa('0x35')]=qs[_0x48fa('0x36')](_0x5d67c3[_0x48fa('0x2f')][_0x48fa('0x36')]);_0x27346a[_0x48fa('0x37')]=qs[_0x48fa('0x38')](_[_0x48fa('0x39')](_0x5d67c3['query'],_0x18a191[_0x48fa('0x38')]),_0x1c4ca2);if(_0x5d67c3[_0x48fa('0x2f')]['filter']){_0x27346a[_0x48fa('0x37')]=_[_0x48fa('0x3a')](_0x27346a[_0x48fa('0x37')],{'$or':_['map'](_0x1c4ca2,function(_0xd82437){if(_0xd82437[_0x48fa('0x3b')]!==_0x48fa('0x3c')){var _0x277592={};_0x277592[_0xd82437['name']]={'$like':'%'+_0x5d67c3[_0x48fa('0x2f')][_0x48fa('0x3d')]+'%'};return _0x277592;}})});}_0x27346a=_['merge']({},_0x27346a,_0x5d67c3[_0x48fa('0x3e')]);var _0x2ef732={'where':_0x27346a[_0x48fa('0x37')]};return db[_0x48fa('0x2b')][_0x48fa('0x1e')](_0x2ef732)[_0x48fa('0x23')](function(_0x2c486c){_0x1913e2[_0x48fa('0x1e')]=_0x2c486c;if(_0x5d67c3[_0x48fa('0x2f')][_0x48fa('0x3f')]){_0x27346a['include']=[{'all':!![]}];}return db[_0x48fa('0x2b')][_0x48fa('0x40')](_0x27346a);})[_0x48fa('0x23')](function(_0x8f2e9c){_0x1913e2[_0x48fa('0x41')]=_0x8f2e9c;return _0x1913e2;})[_0x48fa('0x23')](respondWithFilteredResult(_0x3a0f00,_0x27346a))[_0x48fa('0x42')](handleError(_0x3a0f00,null));};exports[_0x48fa('0x43')]=function(_0x599c5d,_0x581a1a){var _0x395c03={'raw':!![],'where':{'id':_0x599c5d[_0x48fa('0x44')]['id']}},_0x3a319d={};_0x3a319d[_0x48fa('0x2e')]=_[_0x48fa('0x30')](db[_0x48fa('0x2b')][_0x48fa('0x2c')]);_0x3a319d[_0x48fa('0x2f')]=_['keys'](_0x599c5d[_0x48fa('0x2f')]);_0x3a319d[_0x48fa('0x38')]=_[_0x48fa('0x45')](_0x3a319d[_0x48fa('0x2e')],_0x3a319d[_0x48fa('0x2f')]);_0x395c03['attributes']=_[_0x48fa('0x45')](_0x3a319d['model'],qs['fields'](_0x599c5d[_0x48fa('0x2f')]['fields']));_0x395c03[_0x48fa('0x31')]=_0x395c03[_0x48fa('0x31')][_0x48fa('0x46')]?_0x395c03[_0x48fa('0x31')]:_0x3a319d[_0x48fa('0x2e')];if(_0x599c5d[_0x48fa('0x2f')][_0x48fa('0x3f')]){_0x395c03[_0x48fa('0x47')]=[{'all':!![]}];}_0x395c03=_['merge']({},_0x395c03,_0x599c5d[_0x48fa('0x3e')]);return db['MailTransferReport']['find'](_0x395c03)[_0x48fa('0x23')](handleEntityNotFound(_0x581a1a,null))['then'](respondWithResult(_0x581a1a,null))[_0x48fa('0x42')](handleError(_0x581a1a,null));};exports[_0x48fa('0x48')]=function(_0x297cca,_0x12d459){return db[_0x48fa('0x2b')][_0x48fa('0x48')](_0x297cca[_0x48fa('0x49')],{})[_0x48fa('0x23')](respondWithResult(_0x12d459,0xc9))['catch'](handleError(_0x12d459,null));};exports['update']=function(_0x471bf8,_0x24f1b2){if(_0x471bf8[_0x48fa('0x49')]['id']){delete _0x471bf8[_0x48fa('0x49')]['id'];}return db[_0x48fa('0x2b')]['find']({'where':{'id':_0x471bf8[_0x48fa('0x44')]['id']}})[_0x48fa('0x23')](handleEntityNotFound(_0x24f1b2,null))['then'](saveUpdates(_0x471bf8[_0x48fa('0x49')],null))[_0x48fa('0x23')](respondWithResult(_0x24f1b2,null))[_0x48fa('0x42')](handleError(_0x24f1b2,null));};exports[_0x48fa('0x24')]=function(_0x3286f5,_0x39236d){return db[_0x48fa('0x2b')]['find']({'where':{'id':_0x3286f5[_0x48fa('0x44')]['id']}})[_0x48fa('0x23')](handleEntityNotFound(_0x39236d,null))[_0x48fa('0x23')](removeEntity(_0x39236d,null))[_0x48fa('0x42')](handleError(_0x39236d,null));};exports[_0x48fa('0x4a')]=function(_0x1020a7,_0x351e50){return db['MailTransferReport']['describe']()[_0x48fa('0x23')](respondWithResult(_0x351e50,null))['catch'](handleError(_0x351e50,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index c37d7db..77d11ab 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 _0x867f=['bluebird','request-promise','./mailTransferReport.attributes','exports','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x8fb6dc,_0x3bfa9){var _0x1eebbd=function(_0xf87943){while(--_0xf87943){_0x8fb6dc['push'](_0x8fb6dc['shift']());}};_0x1eebbd(++_0x3bfa9);}(_0x867f,0x7f));var _0xf867=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0x867f[_0x1e2072];return _0x22956b;};'use strict';var _=require(_0xf867('0x0'));var util=require(_0xf867('0x1'));var logger=require(_0xf867('0x2'))(_0xf867('0x3'));var moment=require(_0xf867('0x4'));var BPromise=require(_0xf867('0x5'));var rp=require(_0xf867('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf867('0x7'));module[_0xf867('0x8')]=function(_0x33b5a7,_0x254e82){return _0x33b5a7['define'](_0xf867('0x9'),attributes,{'tableName':_0xf867('0xa'),'paranoid':![],'indexes':[{'name':_0xf867('0xb'),'fields':[_0xf867('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ca8=['define','MailTransferReport','report_mail_transfer','util','api','moment','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x9ca8,0x123));var _0x89ca=function(_0x95942,_0x85da80){_0x95942=_0x95942-0x0;var _0x6d7f81=_0x9ca8[_0x95942];return _0x6d7f81;};'use strict';var _=require('lodash');var util=require(_0x89ca('0x0'));var logger=require('../../config/logger')(_0x89ca('0x1'));var moment=require(_0x89ca('0x2'));var BPromise=require(_0x89ca('0x3'));var rp=require(_0x89ca('0x4'));var fs=require('fs');var path=require(_0x89ca('0x5'));var rimraf=require('rimraf');var config=require(_0x89ca('0x6'));var attributes=require(_0x89ca('0x7'));module[_0x89ca('0x8')]=function(_0x1464be,_0x348f76){return _0x1464be[_0x89ca('0x9')](_0x89ca('0xa'),attributes,{'tableName':_0x89ca('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index daea34c..3404c36 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 _0x1a52=['request','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http'];(function(_0x103538,_0x4a9156){var _0x48128a=function(_0x5773cc){while(--_0x5773cc){_0x103538['push'](_0x103538['shift']());}};_0x48128a(++_0x4a9156);}(_0x1a52,0x174));var _0x21a5=function(_0x1a6c38,_0x42a780){_0x1a6c38=_0x1a6c38-0x0;var _0x2bdeb8=_0x1a52[_0x1a6c38];return _0x2bdeb8;};'use strict';var _=require('lodash');var util=require(_0x21a5('0x0'));var moment=require(_0x21a5('0x1'));var BPromise=require(_0x21a5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21a5('0x3'))['db'];var utils=require(_0x21a5('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x21a5('0x5'));var jayson=require(_0x21a5('0x6'));var client=jayson['client'][_0x21a5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x307443,_0x5947ca,_0x3d43dd){return new BPromise(function(_0x4abae5,_0x465fdc){return client[_0x21a5('0x8')](_0x307443,_0x3d43dd)['then'](function(_0x2a1ce2){logger[_0x21a5('0x9')](_0x21a5('0xa'),_0x5947ca,'request\x20sent');logger[_0x21a5('0xb')](_0x21a5('0xc'),_0x5947ca,_0x21a5('0xd'),JSON[_0x21a5('0xe')](_0x2a1ce2));if(_0x2a1ce2[_0x21a5('0xf')]){if(_0x2a1ce2['error'][_0x21a5('0x10')]===0x1f4){logger[_0x21a5('0xf')](_0x21a5('0xa'),_0x5947ca,_0x2a1ce2[_0x21a5('0xf')][_0x21a5('0x11')]);return _0x465fdc(_0x2a1ce2[_0x21a5('0xf')][_0x21a5('0x11')]);}logger[_0x21a5('0xf')](_0x21a5('0xa'),_0x5947ca,_0x2a1ce2[_0x21a5('0xf')]['message']);return _0x4abae5(_0x2a1ce2[_0x21a5('0xf')]['message']);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5947ca,_0x21a5('0xd'));_0x4abae5(_0x2a1ce2[_0x21a5('0x12')][_0x21a5('0x11')]);}})[_0x21a5('0x13')](function(_0x2d30ca){logger[_0x21a5('0xf')](_0x21a5('0xa'),_0x5947ca,_0x2d30ca);_0x465fdc(_0x2d30ca);});});} \ No newline at end of file +var _0x9d0e=['../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x26f4f5,_0x53419e){var _0x91bf0a=function(_0x144da0){while(--_0x144da0){_0x26f4f5['push'](_0x26f4f5['shift']());}};_0x91bf0a(++_0x53419e);}(_0x9d0e,0x118));var _0xe9d0=function(_0x4d9e5d,_0x33af89){_0x4d9e5d=_0x4d9e5d-0x0;var _0x23bb80=_0x9d0e[_0x4d9e5d];return _0x23bb80;};'use strict';var _=require(_0xe9d0('0x0'));var util=require(_0xe9d0('0x1'));var moment=require(_0xe9d0('0x2'));var BPromise=require(_0xe9d0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9d0('0x4'))['db'];var utils=require(_0xe9d0('0x5'));var logger=require(_0xe9d0('0x6'))(_0xe9d0('0x7'));var config=require(_0xe9d0('0x8'));var jayson=require(_0xe9d0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4542f8,_0x5942d0,_0x461772){return new BPromise(function(_0x5e5b49,_0x1afb63){return client[_0xe9d0('0xa')](_0x4542f8,_0x461772)[_0xe9d0('0xb')](function(_0xb27234){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5942d0,_0xe9d0('0xc'));logger[_0xe9d0('0xd')](_0xe9d0('0xe'),_0x5942d0,_0xe9d0('0xc'),JSON[_0xe9d0('0xf')](_0xb27234));if(_0xb27234[_0xe9d0('0x10')]){if(_0xb27234[_0xe9d0('0x10')][_0xe9d0('0x11')]===0x1f4){logger[_0xe9d0('0x10')](_0xe9d0('0x12'),_0x5942d0,_0xb27234[_0xe9d0('0x10')]['message']);return _0x1afb63(_0xb27234[_0xe9d0('0x10')][_0xe9d0('0x13')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5942d0,_0xb27234[_0xe9d0('0x10')][_0xe9d0('0x13')]);return _0x5e5b49(_0xb27234[_0xe9d0('0x10')][_0xe9d0('0x13')]);}else{logger[_0xe9d0('0x14')](_0xe9d0('0x12'),_0x5942d0,_0xe9d0('0xc'));_0x5e5b49(_0xb27234['result'][_0xe9d0('0x13')]);}})[_0xe9d0('0x15')](function(_0x549f8a){logger[_0xe9d0('0x10')](_0xe9d0('0x12'),_0x5942d0,_0x549f8a);_0x1afb63(_0x549f8a);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 645de96..fb9e66b 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 _0x25ea=['put','update','delete','/:id','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./memberReport.controller','get','/describe','describe','isAuthenticated','show','post'];(function(_0x49cc18,_0x11cc73){var _0x5b8e1c=function(_0x46f3c6){while(--_0x46f3c6){_0x49cc18['push'](_0x49cc18['shift']());}};_0x5b8e1c(++_0x11cc73);}(_0x25ea,0xd6));var _0xa25e=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0x25ea[_0x4ce028];return _0x583d0c;};'use strict';var multer=require('multer');var util=require(_0xa25e('0x0'));var path=require(_0xa25e('0x1'));var timeout=require(_0xa25e('0x2'));var express=require('express');var router=express[_0xa25e('0x3')]();var fs_extra=require(_0xa25e('0x4'));var auth=require(_0xa25e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa25e('0x6'));var controller=require(_0xa25e('0x7'));router[_0xa25e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xa25e('0x8')](_0xa25e('0x9'),auth['isAuthenticated'](),controller[_0xa25e('0xa')]);router[_0xa25e('0x8')]('/:id',auth[_0xa25e('0xb')](),controller[_0xa25e('0xc')]);router[_0xa25e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa25e('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xa25e('0xf')]);router[_0xa25e('0x10')](_0xa25e('0x11'),auth[_0xa25e('0xb')](),controller[_0xa25e('0x12')]);module['exports']=router; \ No newline at end of file +var _0x868a=['/describe','isAuthenticated','describe','/:id','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index'];(function(_0x5a9e32,_0x3197fd){var _0x521b3f=function(_0x55f4f9){while(--_0x55f4f9){_0x5a9e32['push'](_0x5a9e32['shift']());}};_0x521b3f(++_0x3197fd);}(_0x868a,0x105));var _0xa868=function(_0x221553,_0x4c67db){_0x221553=_0x221553-0x0;var _0x5ebc28=_0x868a[_0x221553];return _0x5ebc28;};'use strict';var multer=require(_0xa868('0x0'));var util=require(_0xa868('0x1'));var path=require(_0xa868('0x2'));var timeout=require(_0xa868('0x3'));var express=require(_0xa868('0x4'));var router=express[_0xa868('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa868('0x6'));var interaction=require(_0xa868('0x7'));var config=require(_0xa868('0x8'));var controller=require(_0xa868('0x9'));router[_0xa868('0xa')]('/',auth['isAuthenticated'](),controller[_0xa868('0xb')]);router[_0xa868('0xa')](_0xa868('0xc'),auth[_0xa868('0xd')](),controller[_0xa868('0xe')]);router[_0xa868('0xa')](_0xa868('0xf'),auth[_0xa868('0xd')](),controller[_0xa868('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xa868('0x11')]('/:id',auth[_0xa868('0xd')](),controller[_0xa868('0x12')]);router[_0xa868('0x13')]('/:id',auth[_0xa868('0xd')](),controller['destroy']);module[_0xa868('0x14')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5654522..bacf971 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 _0xf5df=['diff','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt'];(function(_0x34dd3b,_0x6a05b6){var _0x2590c2=function(_0x70174a){while(--_0x70174a){_0x34dd3b['push'](_0x34dd3b['shift']());}};_0x2590c2(++_0x6a05b6);}(_0xf5df,0xac));var _0xff5d=function(_0x3ff45a,_0x50443e){_0x3ff45a=_0x3ff45a-0x0;var _0x6dc03f=_0xf5df[_0x3ff45a];return _0x6dc03f;};'use strict';var Sequelize=require(_0xff5d('0x0'));var moment=require('moment');module[_0xff5d('0x1')]={'channel':{'type':Sequelize[_0xff5d('0x2')]},'membername':{'type':Sequelize[_0xff5d('0x2')]},'interface':{'type':Sequelize[_0xff5d('0x2')]},'type':{'type':Sequelize[_0xff5d('0x2')],'defaultValue':_0xff5d('0x3'),'comment':_0xff5d('0x4')},'duration':{'type':Sequelize[_0xff5d('0x5')]},'enterAt':{'type':Sequelize[_0xff5d('0x6')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x4958b2){var _0x2c646f=moment(_0x4958b2);var _0x3dcd78=moment(this['getDataValue'](_0xff5d('0x7')));var _0x498aea=_0x2c646f[_0xff5d('0x8')](_0x3dcd78,'seconds');this[_0xff5d('0x9')](_0xff5d('0xa'),_0x4958b2);this[_0xff5d('0x9')]('duration',_0x498aea>=0x0?_0x498aea:null);}},'data1':{'type':Sequelize[_0xff5d('0x2')],'comment':_0xff5d('0xb')},'data2':{'type':Sequelize[_0xff5d('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xff5d('0x2')],'comment':_0xff5d('0xc')},'data4':{'type':Sequelize['STRING'],'comment':_0xff5d('0xd')},'data5':{'type':Sequelize[_0xff5d('0x2')],'comment':_0xff5d('0xe')},'role':{'type':Sequelize[_0xff5d('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xff5d('0x2')]}}; \ No newline at end of file +var _0x4c4e=['getDataValue','enterAt','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4a35ab,_0x4a0a71){var _0x240e3e=function(_0xafc407){while(--_0xafc407){_0x4a35ab['push'](_0x4a35ab['shift']());}};_0x240e3e(++_0x4a0a71);}(_0x4c4e,0x14d));var _0xe4c4=function(_0x4f9975,_0x3758f4){_0x4f9975=_0x4f9975-0x0;var _0x40d100=_0x4c4e[_0x4f9975];return _0x40d100;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xe4c4('0x0'));module[_0xe4c4('0x1')]={'channel':{'type':Sequelize[_0xe4c4('0x2')]},'membername':{'type':Sequelize[_0xe4c4('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe4c4('0x2')],'defaultValue':_0xe4c4('0x3'),'comment':_0xe4c4('0x4')},'duration':{'type':Sequelize[_0xe4c4('0x5')]},'enterAt':{'type':Sequelize[_0xe4c4('0x6')]},'exitAt':{'type':Sequelize[_0xe4c4('0x6')],'set':function(_0x59bf41){var _0x1ac8aa=moment(_0x59bf41);var _0x24e3e8=moment(this[_0xe4c4('0x7')](_0xe4c4('0x8')));var _0xa7e34c=_0x1ac8aa['diff'](_0x24e3e8,'seconds');this['setDataValue'](_0xe4c4('0x9'),_0x59bf41);this[_0xe4c4('0xa')](_0xe4c4('0xb'),_0xa7e34c>=0x0?_0xa7e34c:null);}},'data1':{'type':Sequelize[_0xe4c4('0x2')],'comment':_0xe4c4('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0xe4c4('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0xe4c4('0xe')},'data4':{'type':Sequelize[_0xe4c4('0x2')],'comment':_0xe4c4('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0xe4c4('0x10')},'role':{'type':Sequelize[_0xe4c4('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xe4c4('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index d0addf1..f00d2cb 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x1fd676,_0x32bf62){var _0x1dd16e=function(_0x58ba4d){while(--_0x58ba4d){_0x1fd676['push'](_0x1fd676['shift']());}};_0x1dd16e(++_0x32bf62);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','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','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x55ca,0x126));var _0xa55c=function(_0x7633c,_0x1e45bf){_0x7633c=_0x7633c-0x0;var _0x1b77e2=_0x55ca[_0x7633c];return _0x1b77e2;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index c02d0c1..fbc4cf9 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 _0x7a72=['request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','interface','util','../../config/logger','api','moment','bluebird'];(function(_0x5b9259,_0x198473){var _0x5bbf28=function(_0x392f8e){while(--_0x392f8e){_0x5b9259['push'](_0x5b9259['shift']());}};_0x5bbf28(++_0x198473);}(_0x7a72,0xbe));var _0x27a7=function(_0x297aa3,_0x38c8ba){_0x297aa3=_0x297aa3-0x0;var _0xe70969=_0x7a72[_0x297aa3];return _0xe70969;};'use strict';var _=require('lodash');var util=require(_0x27a7('0x0'));var logger=require(_0x27a7('0x1'))(_0x27a7('0x2'));var moment=require(_0x27a7('0x3'));var BPromise=require(_0x27a7('0x4'));var rp=require(_0x27a7('0x5'));var fs=require('fs');var path=require(_0x27a7('0x6'));var rimraf=require(_0x27a7('0x7'));var config=require('../../config/environment');var attributes=require(_0x27a7('0x8'));module[_0x27a7('0x9')]=function(_0x4dd47c,_0x375c82){return _0x4dd47c[_0x27a7('0xa')](_0x27a7('0xb'),attributes,{'tableName':_0x27a7('0xc'),'paranoid':![],'indexes':[{'name':_0x27a7('0xd'),'fields':['membername',_0x27a7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x708f=['../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername','interface','api','moment','rimraf'];(function(_0xaef321,_0x282cd4){var _0x235211=function(_0x2df57a){while(--_0x2df57a){_0xaef321['push'](_0xaef321['shift']());}};_0x235211(++_0x282cd4);}(_0x708f,0x11b));var _0xf708=function(_0x3f92ec,_0x2075e9){_0x3f92ec=_0x3f92ec-0x0;var _0x592026=_0x708f[_0x3f92ec];return _0x592026;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf708('0x0'));var moment=require(_0xf708('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf708('0x2'));var config=require(_0xf708('0x3'));var attributes=require('./memberReport.attributes');module[_0xf708('0x4')]=function(_0x19c17e,_0x3ca883){return _0x19c17e[_0xf708('0x5')](_0xf708('0x6'),attributes,{'tableName':_0xf708('0x7'),'paranoid':![],'indexes':[{'name':_0xf708('0x8'),'fields':[_0xf708('0x9'),_0xf708('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 ba470e2..e6409ec 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 _0xbf07=['stringify','error','code','message','catch','MemberReport','findAll','options','raw','where','attributes','include','model','map','GetMemberReport','CreateMemberReport','body','UpdateMemberReport','update','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment','request','then','info','MemberReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf07,0x77));var _0x7bf0=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0xbf07[_0x454018];return _0x24697d;};'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')]('MemberReport,\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);});});}exports['GetMemberReport']=function(_0x254dc8){var _0x3a1c6e=this;return new Promise(function(_0x2a99fe,_0x117342){return db[_0x7bf0('0x12')][_0x7bf0('0x13')]({'raw':_0x254dc8[_0x7bf0('0x14')]?_0x254dc8[_0x7bf0('0x14')][_0x7bf0('0x15')]===undefined?!![]:![]:!![],'where':_0x254dc8[_0x7bf0('0x14')]?_0x254dc8['options'][_0x7bf0('0x16')]||null:null,'attributes':_0x254dc8[_0x7bf0('0x14')]?_0x254dc8[_0x7bf0('0x14')][_0x7bf0('0x17')]||null:null,'limit':_0x254dc8[_0x7bf0('0x14')]?_0x254dc8[_0x7bf0('0x14')]['limit']||null:null,'include':_0x254dc8['options']?_0x254dc8[_0x7bf0('0x14')][_0x7bf0('0x18')]?_['map'](_0x254dc8[_0x7bf0('0x14')]['include'],function(_0x157e0f){return{'model':db[_0x157e0f[_0x7bf0('0x19')]],'as':_0x157e0f['as'],'attributes':_0x157e0f[_0x7bf0('0x17')],'include':_0x157e0f[_0x7bf0('0x18')]?_[_0x7bf0('0x1a')](_0x157e0f[_0x7bf0('0x18')],function(_0x2e4994){return{'model':db[_0x2e4994[_0x7bf0('0x19')]],'as':_0x2e4994['as'],'attributes':_0x2e4994[_0x7bf0('0x17')],'include':_0x2e4994[_0x7bf0('0x18')]?_[_0x7bf0('0x1a')](_0x2e4994['include'],function(_0x366c54){return{'model':db[_0x366c54[_0x7bf0('0x19')]],'as':_0x366c54['as'],'attributes':_0x366c54[_0x7bf0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7bf0('0x8')](function(_0x2ba0a3){logger['info'](_0x7bf0('0x1b'),_0x254dc8);logger[_0x7bf0('0xb')]('GetMemberReport',_0x254dc8,JSON[_0x7bf0('0xd')](_0x2ba0a3));_0x2a99fe(_0x2ba0a3);})['catch'](function(_0x1393f7){logger[_0x7bf0('0xe')](_0x7bf0('0x1b'),_0x1393f7['message'],_0x254dc8);_0x117342(_0x3a1c6e[_0x7bf0('0xe')](0x1f4,_0x1393f7[_0x7bf0('0x10')]));});});};exports[_0x7bf0('0x1c')]=function(_0x5ad9c9){var _0x371611=this;return new Promise(function(_0x318c1f,_0x116b32){return db[_0x7bf0('0x12')]['create'](_0x5ad9c9[_0x7bf0('0x1d')],{'raw':_0x5ad9c9[_0x7bf0('0x14')]?_0x5ad9c9[_0x7bf0('0x14')][_0x7bf0('0x15')]===undefined?!![]:![]:!![]})[_0x7bf0('0x8')](function(_0x4eac51){logger[_0x7bf0('0x9')](_0x7bf0('0x1c'),_0x5ad9c9);logger['debug'](_0x7bf0('0x1c'),_0x5ad9c9,JSON[_0x7bf0('0xd')](_0x4eac51));_0x318c1f(_0x4eac51);})['catch'](function(_0x4227ec){logger[_0x7bf0('0xe')](_0x7bf0('0x1c'),_0x4227ec[_0x7bf0('0x10')],_0x5ad9c9);_0x116b32(_0x371611[_0x7bf0('0xe')](0x1f4,_0x4227ec[_0x7bf0('0x10')]));});});};exports[_0x7bf0('0x1e')]=function(_0x36b25f){var _0x14e678=this;return new Promise(function(_0x2b94dd,_0x458142){return db[_0x7bf0('0x12')][_0x7bf0('0x1f')](_0x36b25f[_0x7bf0('0x1d')],{'raw':_0x36b25f[_0x7bf0('0x14')]?_0x36b25f['options'][_0x7bf0('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36b25f[_0x7bf0('0x14')]?_0x36b25f[_0x7bf0('0x14')][_0x7bf0('0x16')]||null:null,'attributes':_0x36b25f[_0x7bf0('0x14')]?_0x36b25f['options'][_0x7bf0('0x17')]||null:null,'limit':_0x36b25f[_0x7bf0('0x14')]?_0x36b25f['options'][_0x7bf0('0x20')]||null:null})['then'](function(_0x426466){logger[_0x7bf0('0x9')](_0x7bf0('0x1e'),_0x36b25f);logger[_0x7bf0('0xb')](_0x7bf0('0x1e'),_0x36b25f,JSON[_0x7bf0('0xd')](_0x426466));_0x2b94dd(_0x426466);})[_0x7bf0('0x11')](function(_0x5ddede){logger['error'](_0x7bf0('0x1e'),_0x5ddede[_0x7bf0('0x10')],_0x36b25f);_0x458142(_0x14e678[_0x7bf0('0xe')](0x1f4,_0x5ddede['message']));});});}; \ No newline at end of file +var _0xc9c3=['limit','include','map','model','catch','CreateMemberReport','create','body','UpdateMemberReport','update','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetMemberReport','MemberReport','options','raw','where','attributes'];(function(_0x5d6ebf,_0x309792){var _0x4efad0=function(_0x526634){while(--_0x526634){_0x5d6ebf['push'](_0x5d6ebf['shift']());}};_0x4efad0(++_0x309792);}(_0xc9c3,0x96));var _0x3c9c=function(_0x401c14,_0x1e5eed){_0x401c14=_0x401c14-0x0;var _0x173d30=_0xc9c3[_0x401c14];return _0x173d30;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3c9c('0x0'));var BPromise=require('bluebird');var rs=require(_0x3c9c('0x1'));var fs=require('fs');var Redis=require(_0x3c9c('0x2'));var db=require(_0x3c9c('0x3'))['db'];var utils=require(_0x3c9c('0x4'));var logger=require(_0x3c9c('0x5'))(_0x3c9c('0x6'));var config=require(_0x3c9c('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5a2836,_0x3ca0ce,_0xc35e75){return new BPromise(function(_0x2eb946,_0x3e5ccb){return client[_0x3c9c('0x8')](_0x5a2836,_0xc35e75)[_0x3c9c('0x9')](function(_0x302ab7){logger[_0x3c9c('0xa')](_0x3c9c('0xb'),_0x3ca0ce,'request\x20sent');logger[_0x3c9c('0xc')](_0x3c9c('0xd'),_0x3ca0ce,'request\x20sent',JSON[_0x3c9c('0xe')](_0x302ab7));if(_0x302ab7['error']){if(_0x302ab7[_0x3c9c('0xf')][_0x3c9c('0x10')]===0x1f4){logger[_0x3c9c('0xf')](_0x3c9c('0xb'),_0x3ca0ce,_0x302ab7['error']['message']);return _0x3e5ccb(_0x302ab7['error'][_0x3c9c('0x11')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x3ca0ce,_0x302ab7['error'][_0x3c9c('0x11')]);return _0x2eb946(_0x302ab7['error'][_0x3c9c('0x11')]);}else{logger[_0x3c9c('0xa')](_0x3c9c('0xb'),_0x3ca0ce,_0x3c9c('0x12'));_0x2eb946(_0x302ab7['result'][_0x3c9c('0x11')]);}})['catch'](function(_0x558101){logger['error'](_0x3c9c('0xb'),_0x3ca0ce,_0x558101);_0x3e5ccb(_0x558101);});});}exports[_0x3c9c('0x13')]=function(_0x216fd8){var _0x3eee19=this;return new Promise(function(_0x3e63e0,_0x220b23){return db[_0x3c9c('0x14')]['findAll']({'raw':_0x216fd8[_0x3c9c('0x15')]?_0x216fd8['options'][_0x3c9c('0x16')]===undefined?!![]:![]:!![],'where':_0x216fd8['options']?_0x216fd8[_0x3c9c('0x15')][_0x3c9c('0x17')]||null:null,'attributes':_0x216fd8['options']?_0x216fd8[_0x3c9c('0x15')][_0x3c9c('0x18')]||null:null,'limit':_0x216fd8[_0x3c9c('0x15')]?_0x216fd8['options'][_0x3c9c('0x19')]||null:null,'include':_0x216fd8[_0x3c9c('0x15')]?_0x216fd8[_0x3c9c('0x15')][_0x3c9c('0x1a')]?_[_0x3c9c('0x1b')](_0x216fd8[_0x3c9c('0x15')][_0x3c9c('0x1a')],function(_0x32e4c2){return{'model':db[_0x32e4c2['model']],'as':_0x32e4c2['as'],'attributes':_0x32e4c2[_0x3c9c('0x18')],'include':_0x32e4c2['include']?_[_0x3c9c('0x1b')](_0x32e4c2[_0x3c9c('0x1a')],function(_0x4ca078){return{'model':db[_0x4ca078['model']],'as':_0x4ca078['as'],'attributes':_0x4ca078[_0x3c9c('0x18')],'include':_0x4ca078[_0x3c9c('0x1a')]?_[_0x3c9c('0x1b')](_0x4ca078[_0x3c9c('0x1a')],function(_0x4c283d){return{'model':db[_0x4c283d[_0x3c9c('0x1c')]],'as':_0x4c283d['as'],'attributes':_0x4c283d[_0x3c9c('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xafa3aa){logger['info']('GetMemberReport',_0x216fd8);logger[_0x3c9c('0xc')](_0x3c9c('0x13'),_0x216fd8,JSON[_0x3c9c('0xe')](_0xafa3aa));_0x3e63e0(_0xafa3aa);})[_0x3c9c('0x1d')](function(_0x7bdf33){logger['error'](_0x3c9c('0x13'),_0x7bdf33['message'],_0x216fd8);_0x220b23(_0x3eee19[_0x3c9c('0xf')](0x1f4,_0x7bdf33[_0x3c9c('0x11')]));});});};exports[_0x3c9c('0x1e')]=function(_0x10f439){var _0x5793c1=this;return new Promise(function(_0x257470,_0x39e4ed){return db[_0x3c9c('0x14')][_0x3c9c('0x1f')](_0x10f439[_0x3c9c('0x20')],{'raw':_0x10f439[_0x3c9c('0x15')]?_0x10f439[_0x3c9c('0x15')][_0x3c9c('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x173fa0){logger[_0x3c9c('0xa')](_0x3c9c('0x1e'),_0x10f439);logger[_0x3c9c('0xc')](_0x3c9c('0x1e'),_0x10f439,JSON[_0x3c9c('0xe')](_0x173fa0));_0x257470(_0x173fa0);})[_0x3c9c('0x1d')](function(_0x2d84e8){logger[_0x3c9c('0xf')](_0x3c9c('0x1e'),_0x2d84e8[_0x3c9c('0x11')],_0x10f439);_0x39e4ed(_0x5793c1[_0x3c9c('0xf')](0x1f4,_0x2d84e8[_0x3c9c('0x11')]));});});};exports[_0x3c9c('0x21')]=function(_0x5f4f64){var _0xa1d0f=this;return new Promise(function(_0x34266f,_0x3ae727){return db['MemberReport'][_0x3c9c('0x22')](_0x5f4f64[_0x3c9c('0x20')],{'raw':_0x5f4f64[_0x3c9c('0x15')]?_0x5f4f64[_0x3c9c('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f4f64['options']?_0x5f4f64[_0x3c9c('0x15')][_0x3c9c('0x17')]||null:null,'attributes':_0x5f4f64[_0x3c9c('0x15')]?_0x5f4f64['options']['attributes']||null:null,'limit':_0x5f4f64[_0x3c9c('0x15')]?_0x5f4f64['options']['limit']||null:null})[_0x3c9c('0x9')](function(_0xbe5c79){logger[_0x3c9c('0xa')]('UpdateMemberReport',_0x5f4f64);logger[_0x3c9c('0xc')](_0x3c9c('0x21'),_0x5f4f64,JSON[_0x3c9c('0xe')](_0xbe5c79));_0x34266f(_0xbe5c79);})['catch'](function(_0x54c14c){logger['error'](_0x3c9c('0x21'),_0x54c14c[_0x3c9c('0x11')],_0x5f4f64);_0x3ae727(_0xa1d0f[_0x3c9c('0xf')](0x1f4,_0x54c14c[_0x3c9c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index f117e82..2985bba 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 _0xd2df=['connect-timeout','express','../../components/interaction/service','../../config/environment','./migration.controller','multer','util','path'];(function(_0x5e4866,_0x1f1101){var _0x38b84e=function(_0x4e1864){while(--_0x4e1864){_0x5e4866['push'](_0x5e4866['shift']());}};_0x38b84e(++_0x1f1101);}(_0xd2df,0x175));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfd2d('0x0'));var util=require(_0xfd2d('0x1'));var path=require(_0xfd2d('0x2'));var timeout=require(_0xfd2d('0x3'));var express=require(_0xfd2d('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfd2d('0x5'));var config=require(_0xfd2d('0x6'));var controller=require(_0xfd2d('0x7'));router['get']('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x05da=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','exports','multer','util'];(function(_0x26bf51,_0x5e261a){var _0x503415=function(_0x92b028){while(--_0x92b028){_0x26bf51['push'](_0x26bf51['shift']());}};_0x503415(++_0x5e261a);}(_0x05da,0x94));var _0xa05d=function(_0x5e66cc,_0x6be9dd){_0x5e66cc=_0x5e66cc-0x0;var _0x37d5b8=_0x05da[_0x5e66cc];return _0x37d5b8;};'use strict';var multer=require(_0xa05d('0x0'));var util=require(_0xa05d('0x1'));var path=require('path');var timeout=require(_0xa05d('0x2'));var express=require('express');var router=express[_0xa05d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa05d('0x4'));var interaction=require(_0xa05d('0x5'));var config=require(_0xa05d('0x6'));var controller=require(_0xa05d('0x7'));router[_0xa05d('0x8')]('/',controller['index']);module[_0xa05d('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 4410e11..c3100f3 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 _0xdf9a=['exports','STRING','sequelize'];(function(_0x1509f7,_0x2fc1d2){var _0x3211a0=function(_0x204f7d){while(--_0x204f7d){_0x1509f7['push'](_0x1509f7['shift']());}};_0x3211a0(++_0x2fc1d2);}(_0xdf9a,0x131));var _0xadf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdf9a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xadf9('0x0'));module[_0xadf9('0x1')]={'version':{'type':Sequelize[_0xadf9('0x2')],'unique':'version'}}; \ No newline at end of file +var _0xcfd2=['STRING'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xcfd2,0xaf));var _0x2cfd=function(_0x10dbac,_0x1e6d7c){_0x10dbac=_0x10dbac-0x0;var _0x5b13f6=_0xcfd2[_0x10dbac];return _0x5b13f6;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0x2cfd('0x0')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 67e8c2f..be1635b 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 _0x2eb2=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','rows','catch','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','Migration'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0x2eb2,0x19f));var _0x22eb=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x2eb2[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22eb('0x0'));var zipdir=require(_0x22eb('0x1'));var jsonpatch=require(_0x22eb('0x2'));var rp=require(_0x22eb('0x3'));var moment=require(_0x22eb('0x4'));var BPromise=require(_0x22eb('0x5'));var Mustache=require('mustache');var util=require(_0x22eb('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x22eb('0x7'));var ejs=require(_0x22eb('0x8'));var fs=require('fs');var fs_extra=require(_0x22eb('0x9'));var _=require(_0x22eb('0xa'));var squel=require(_0x22eb('0xb'));var crypto=require(_0x22eb('0xc'));var jsforce=require(_0x22eb('0xd'));var deskjs=require(_0x22eb('0xe'));var toCsv=require(_0x22eb('0x7'));var querystring=require(_0x22eb('0xf'));var Papa=require(_0x22eb('0x10'));var Redis=require(_0x22eb('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x22eb('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x22eb('0x13'))('api');var utils=require(_0x22eb('0x14'));var config=require(_0x22eb('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f286c,_0x189f05){_0x189f05=_0x189f05||0xcc;return function(_0x128d43){if(_0x128d43){return _0x1f286c[_0x22eb('0x16')](_0x189f05);}return _0x1f286c[_0x22eb('0x17')](_0x189f05)['end']();};}function respondWithResult(_0x350ade,_0x53f14e){_0x53f14e=_0x53f14e||0xc8;return function(_0x1f5089){if(_0x1f5089){return _0x350ade['status'](_0x53f14e)[_0x22eb('0x18')](_0x1f5089);}};}function respondWithFilteredResult(_0x84c668,_0x53abbf){return function(_0x48b63c){if(_0x48b63c){var _0x4bc29a=typeof _0x53abbf[_0x22eb('0x19')]==='undefined'&&typeof _0x53abbf['limit']===_0x22eb('0x1a');var _0x4d9a71=_0x48b63c['count'];var _0xb7a73a=_0x4bc29a?0x0:_0x53abbf[_0x22eb('0x19')];var _0x385bcb=_0x4bc29a?_0x48b63c[_0x22eb('0x1b')]:_0x53abbf[_0x22eb('0x19')]+_0x53abbf['limit'];var _0x4182a8;if(_0x385bcb>=_0x4d9a71){_0x385bcb=_0x4d9a71;_0x4182a8=0xc8;}else{_0x4182a8=0xce;}_0x84c668[_0x22eb('0x17')](_0x4182a8);return _0x84c668[_0x22eb('0x1c')](_0x22eb('0x1d'),_0xb7a73a+'-'+_0x385bcb+'/'+_0x4d9a71)[_0x22eb('0x18')](_0x48b63c);}return null;};}function patchUpdates(_0x517313){return function(_0x2eb115){try{jsonpatch[_0x22eb('0x1e')](_0x2eb115,_0x517313,!![]);}catch(_0x2fc36e){return BPromise['reject'](_0x2fc36e);}return _0x2eb115['save']();};}function saveUpdates(_0x4335b7,_0x267d97){return function(_0x434ecb){if(_0x434ecb){return _0x434ecb[_0x22eb('0x1f')](_0x4335b7)[_0x22eb('0x20')](function(_0x3e8c1c){return _0x3e8c1c;});}return null;};}function removeEntity(_0x43dacb,_0x4e7e69){return function(_0x2e8f7c){if(_0x2e8f7c){return _0x2e8f7c[_0x22eb('0x21')]()[_0x22eb('0x20')](function(){_0x43dacb[_0x22eb('0x17')](0xcc)[_0x22eb('0x22')]();});}};}function handleEntityNotFound(_0x4da252,_0x12c133){return function(_0x6f8ff3){if(!_0x6f8ff3){_0x4da252[_0x22eb('0x16')](0x194);}return _0x6f8ff3;};}function handleError(_0x5a001e,_0xe0783c){_0xe0783c=_0xe0783c||0x1f4;return function(_0x259847){logger['error'](_0x259847[_0x22eb('0x23')]);if(_0x259847[_0x22eb('0x24')]){delete _0x259847[_0x22eb('0x24')];}_0x5a001e[_0x22eb('0x17')](_0xe0783c)[_0x22eb('0x25')](_0x259847);};}exports['index']=function(_0x49dd59,_0x2a950e){var _0x25e5bc={},_0x44cf91={},_0x7c0119={'count':0x0,'rows':[]};var _0x1599c7=_[_0x22eb('0x26')](db[_0x22eb('0x27')][_0x22eb('0x28')],function(_0x382784){return{'name':_0x382784[_0x22eb('0x29')],'type':_0x382784[_0x22eb('0x2a')][_0x22eb('0x2b')]};});_0x44cf91['model']=_[_0x22eb('0x26')](_0x1599c7,'name');_0x44cf91[_0x22eb('0x2c')]=_[_0x22eb('0x2d')](_0x49dd59[_0x22eb('0x2c')]);_0x44cf91[_0x22eb('0x2e')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],_0x44cf91[_0x22eb('0x2c')]);_0x25e5bc[_0x22eb('0x31')]=_[_0x22eb('0x2f')](_0x44cf91[_0x22eb('0x30')],qs['fields'](_0x49dd59['query'][_0x22eb('0x32')]));_0x25e5bc['attributes']=_0x25e5bc['attributes'][_0x22eb('0x33')]?_0x25e5bc[_0x22eb('0x31')]:_0x44cf91[_0x22eb('0x30')];if(!_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x34')](_0x22eb('0x35'))){_0x25e5bc[_0x22eb('0x36')]=qs[_0x22eb('0x36')](_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x36')]);_0x25e5bc['offset']=qs[_0x22eb('0x19')](_0x49dd59['query']['offset']);}_0x25e5bc[_0x22eb('0x37')]=qs[_0x22eb('0x38')](_0x49dd59['query'][_0x22eb('0x38')]);_0x25e5bc[_0x22eb('0x39')]=qs[_0x22eb('0x2e')](_[_0x22eb('0x3a')](_0x49dd59[_0x22eb('0x2c')],_0x44cf91['filters']),_0x1599c7);if(_0x49dd59[_0x22eb('0x2c')][_0x22eb('0x3b')]){_0x25e5bc['where']=_[_0x22eb('0x3c')](_0x25e5bc[_0x22eb('0x39')],{'$or':_[_0x22eb('0x26')](_0x1599c7,function(_0x2cc77c){if(_0x2cc77c[_0x22eb('0x2a')]!=='VIRTUAL'){var _0x51c8b5={};_0x51c8b5[_0x2cc77c[_0x22eb('0x24')]]={'$like':'%'+_0x49dd59[_0x22eb('0x2c')]['filter']+'%'};return _0x51c8b5;}})});}_0x25e5bc=_[_0x22eb('0x3c')]({},_0x25e5bc,_0x49dd59[_0x22eb('0x3d')]);var _0x46c6a1={'where':_0x25e5bc['where']};return db[_0x22eb('0x27')][_0x22eb('0x1b')](_0x46c6a1)[_0x22eb('0x20')](function(_0x2a8517){_0x7c0119[_0x22eb('0x1b')]=_0x2a8517;if(_0x49dd59[_0x22eb('0x2c')]['includeAll']){_0x25e5bc[_0x22eb('0x3e')]=[{'all':!![]}];}return db[_0x22eb('0x27')]['findAll'](_0x25e5bc);})[_0x22eb('0x20')](function(_0x44d39f){_0x7c0119[_0x22eb('0x3f')]=_0x44d39f;return _0x7c0119;})[_0x22eb('0x20')](respondWithFilteredResult(_0x2a950e,_0x25e5bc))[_0x22eb('0x40')](handleError(_0x2a950e,null));}; \ No newline at end of file +var _0x5a8d=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','sendStatus','error','stack','name','send','index','Migration','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x5a8d,0xb4));var _0xd5a8=function(_0xace5a0,_0x7ebdce){_0xace5a0=_0xace5a0-0x0;var _0x529174=_0x5a8d[_0xace5a0];return _0x529174;};'use strict';var emlformat=require(_0xd5a8('0x0'));var rimraf=require(_0xd5a8('0x1'));var zipdir=require(_0xd5a8('0x2'));var jsonpatch=require(_0xd5a8('0x3'));var rp=require(_0xd5a8('0x4'));var moment=require('moment');var BPromise=require(_0xd5a8('0x5'));var Mustache=require(_0xd5a8('0x6'));var util=require('util');var path=require(_0xd5a8('0x7'));var sox=require(_0xd5a8('0x8'));var csv=require(_0xd5a8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd5a8('0xa'));var _=require(_0xd5a8('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd5a8('0xc'));var deskjs=require(_0xd5a8('0xd'));var toCsv=require(_0xd5a8('0x9'));var querystring=require(_0xd5a8('0xe'));var Papa=require('papaparse');var Redis=require(_0xd5a8('0xf'));var authService=require(_0xd5a8('0x10'));var qs=require(_0xd5a8('0x11'));var as=require(_0xd5a8('0x12'));var hardwareService=require(_0xd5a8('0x13'));var logger=require(_0xd5a8('0x14'))(_0xd5a8('0x15'));var utils=require(_0xd5a8('0x16'));var config=require(_0xd5a8('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x300f72,_0x1f4ec0){_0x1f4ec0=_0x1f4ec0||0xcc;return function(_0xbbfb97){if(_0xbbfb97){return _0x300f72['sendStatus'](_0x1f4ec0);}return _0x300f72[_0xd5a8('0x18')](_0x1f4ec0)[_0xd5a8('0x19')]();};}function respondWithResult(_0x73e6f0,_0x22ba06){_0x22ba06=_0x22ba06||0xc8;return function(_0x59e7ee){if(_0x59e7ee){return _0x73e6f0[_0xd5a8('0x18')](_0x22ba06)[_0xd5a8('0x1a')](_0x59e7ee);}};}function respondWithFilteredResult(_0x279f55,_0x561242){return function(_0x5b9f75){if(_0x5b9f75){var _0x39e15e=typeof _0x561242[_0xd5a8('0x1b')]===_0xd5a8('0x1c')&&typeof _0x561242[_0xd5a8('0x1d')]===_0xd5a8('0x1c');var _0x2590ad=_0x5b9f75['count'];var _0x4a81d8=_0x39e15e?0x0:_0x561242[_0xd5a8('0x1b')];var _0x380afe=_0x39e15e?_0x5b9f75[_0xd5a8('0x1e')]:_0x561242[_0xd5a8('0x1b')]+_0x561242['limit'];var _0x271b60;if(_0x380afe>=_0x2590ad){_0x380afe=_0x2590ad;_0x271b60=0xc8;}else{_0x271b60=0xce;}_0x279f55[_0xd5a8('0x18')](_0x271b60);return _0x279f55['set'](_0xd5a8('0x1f'),_0x4a81d8+'-'+_0x380afe+'/'+_0x2590ad)[_0xd5a8('0x1a')](_0x5b9f75);}return null;};}function patchUpdates(_0x17c952){return function(_0x2d2390){try{jsonpatch['apply'](_0x2d2390,_0x17c952,!![]);}catch(_0x20bd0c){return BPromise['reject'](_0x20bd0c);}return _0x2d2390[_0xd5a8('0x20')]();};}function saveUpdates(_0x594173,_0x23129e){return function(_0x15bae3){if(_0x15bae3){return _0x15bae3[_0xd5a8('0x21')](_0x594173)[_0xd5a8('0x22')](function(_0x238e10){return _0x238e10;});}return null;};}function removeEntity(_0x2d6730,_0x56848f){return function(_0x5c2a16){if(_0x5c2a16){return _0x5c2a16[_0xd5a8('0x23')]()['then'](function(){_0x2d6730[_0xd5a8('0x18')](0xcc)[_0xd5a8('0x19')]();});}};}function handleEntityNotFound(_0x27de15,_0x24da02){return function(_0x663f3d){if(!_0x663f3d){_0x27de15[_0xd5a8('0x24')](0x194);}return _0x663f3d;};}function handleError(_0xce42a,_0x2ff269){_0x2ff269=_0x2ff269||0x1f4;return function(_0x306ac8){logger[_0xd5a8('0x25')](_0x306ac8[_0xd5a8('0x26')]);if(_0x306ac8[_0xd5a8('0x27')]){delete _0x306ac8['name'];}_0xce42a[_0xd5a8('0x18')](_0x2ff269)[_0xd5a8('0x28')](_0x306ac8);};}exports[_0xd5a8('0x29')]=function(_0x2447d1,_0x54beb5){var _0x46de05={},_0x3f1060={},_0x2c5495={'count':0x0,'rows':[]};var _0x14a3ac=_['map'](db[_0xd5a8('0x2a')][_0xd5a8('0x2b')],function(_0x488f16){return{'name':_0x488f16[_0xd5a8('0x2c')],'type':_0x488f16[_0xd5a8('0x2d')][_0xd5a8('0x2e')]};});_0x3f1060[_0xd5a8('0x2f')]=_[_0xd5a8('0x30')](_0x14a3ac,_0xd5a8('0x27'));_0x3f1060[_0xd5a8('0x31')]=_['keys'](_0x2447d1[_0xd5a8('0x31')]);_0x3f1060['filters']=_['intersection'](_0x3f1060[_0xd5a8('0x2f')],_0x3f1060[_0xd5a8('0x31')]);_0x46de05['attributes']=_[_0xd5a8('0x32')](_0x3f1060[_0xd5a8('0x2f')],qs['fields'](_0x2447d1['query'][_0xd5a8('0x33')]));_0x46de05['attributes']=_0x46de05['attributes'][_0xd5a8('0x34')]?_0x46de05['attributes']:_0x3f1060[_0xd5a8('0x2f')];if(!_0x2447d1[_0xd5a8('0x31')][_0xd5a8('0x35')](_0xd5a8('0x36'))){_0x46de05[_0xd5a8('0x1d')]=qs[_0xd5a8('0x1d')](_0x2447d1[_0xd5a8('0x31')][_0xd5a8('0x1d')]);_0x46de05['offset']=qs[_0xd5a8('0x1b')](_0x2447d1[_0xd5a8('0x31')]['offset']);}_0x46de05[_0xd5a8('0x37')]=qs[_0xd5a8('0x38')](_0x2447d1[_0xd5a8('0x31')]['sort']);_0x46de05[_0xd5a8('0x39')]=qs[_0xd5a8('0x3a')](_[_0xd5a8('0x3b')](_0x2447d1['query'],_0x3f1060[_0xd5a8('0x3a')]),_0x14a3ac);if(_0x2447d1[_0xd5a8('0x31')][_0xd5a8('0x3c')]){_0x46de05['where']=_['merge'](_0x46de05[_0xd5a8('0x39')],{'$or':_[_0xd5a8('0x30')](_0x14a3ac,function(_0x296e85){if(_0x296e85[_0xd5a8('0x2d')]!==_0xd5a8('0x3d')){var _0x37260e={};_0x37260e[_0x296e85[_0xd5a8('0x27')]]={'$like':'%'+_0x2447d1[_0xd5a8('0x31')][_0xd5a8('0x3c')]+'%'};return _0x37260e;}})});}_0x46de05=_[_0xd5a8('0x3e')]({},_0x46de05,_0x2447d1['options']);var _0xb6dd27={'where':_0x46de05[_0xd5a8('0x39')]};return db[_0xd5a8('0x2a')][_0xd5a8('0x1e')](_0xb6dd27)[_0xd5a8('0x22')](function(_0x37f81b){_0x2c5495[_0xd5a8('0x1e')]=_0x37f81b;if(_0x2447d1[_0xd5a8('0x31')][_0xd5a8('0x3f')]){_0x46de05['include']=[{'all':!![]}];}return db[_0xd5a8('0x2a')][_0xd5a8('0x40')](_0x46de05);})[_0xd5a8('0x22')](function(_0x5d9bd0){_0x2c5495[_0xd5a8('0x41')]=_0x5d9bd0;return _0x2c5495;})[_0xd5a8('0x22')](respondWithFilteredResult(_0x54beb5,_0x46de05))['catch'](handleError(_0x54beb5,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 087d270..125ab9d 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 _0x99ad=['bluebird','request-promise','path','rimraf','./migration.attributes','migrations','lodash','../../config/logger','moment'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x99ad,0x96));var _0xd99a=function(_0x3ef22a,_0x104ebf){_0x3ef22a=_0x3ef22a-0x0;var _0x484dd0=_0x99ad[_0x3ef22a];return _0x484dd0;};'use strict';var _=require(_0xd99a('0x0'));var util=require('util');var logger=require(_0xd99a('0x1'))('api');var moment=require(_0xd99a('0x2'));var BPromise=require(_0xd99a('0x3'));var rp=require(_0xd99a('0x4'));var fs=require('fs');var path=require(_0xd99a('0x5'));var rimraf=require(_0xd99a('0x6'));var config=require('../../config/environment');var attributes=require(_0xd99a('0x7'));module['exports']=function(_0x500cfb,_0x1cc085){return _0x500cfb['define']('Migration',attributes,{'tableName':_0xd99a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe983=['request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe983,0x1ba));var _0x3e98=function(_0x2ba8cd,_0x343cd1){_0x2ba8cd=_0x2ba8cd-0x0;var _0x57697f=_0xe983[_0x2ba8cd];return _0x57697f;};'use strict';var _=require(_0x3e98('0x0'));var util=require(_0x3e98('0x1'));var logger=require(_0x3e98('0x2'))(_0x3e98('0x3'));var moment=require(_0x3e98('0x4'));var BPromise=require(_0x3e98('0x5'));var rp=require(_0x3e98('0x6'));var fs=require('fs');var path=require(_0x3e98('0x7'));var rimraf=require(_0x3e98('0x8'));var config=require(_0x3e98('0x9'));var attributes=require(_0x3e98('0xa'));module[_0x3e98('0xb')]=function(_0x23fff7,_0x939672){return _0x23fff7[_0x3e98('0xc')]('Migration',attributes,{'tableName':_0x3e98('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ffd344e..92ee722 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 _0x5bc5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5bc5,0xb2));var _0x55bc=function(_0x320b8e,_0x1da3fe){_0x320b8e=_0x320b8e-0x0;var _0x55a10a=_0x5bc5[_0x320b8e];return _0x55a10a;};'use strict';var _=require(_0x55bc('0x0'));var util=require(_0x55bc('0x1'));var moment=require(_0x55bc('0x2'));var BPromise=require(_0x55bc('0x3'));var rs=require(_0x55bc('0x4'));var fs=require('fs');var Redis=require(_0x55bc('0x5'));var db=require(_0x55bc('0x6'))['db'];var utils=require(_0x55bc('0x7'));var logger=require(_0x55bc('0x8'))(_0x55bc('0x9'));var config=require(_0x55bc('0xa'));var jayson=require(_0x55bc('0xb'));var client=jayson[_0x55bc('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d78d6,_0x5719c9,_0x2a612b){return new BPromise(function(_0x38839e,_0x4d0610){return client[_0x55bc('0xd')](_0x4d78d6,_0x2a612b)[_0x55bc('0xe')](function(_0xc535ac){logger[_0x55bc('0xf')](_0x55bc('0x10'),_0x5719c9,_0x55bc('0x11'));logger[_0x55bc('0x12')](_0x55bc('0x13'),_0x5719c9,'request\x20sent',JSON[_0x55bc('0x14')](_0xc535ac));if(_0xc535ac[_0x55bc('0x15')]){if(_0xc535ac[_0x55bc('0x15')]['code']===0x1f4){logger[_0x55bc('0x15')]('Migration,\x20%s,\x20%s',_0x5719c9,_0xc535ac[_0x55bc('0x15')][_0x55bc('0x16')]);return _0x4d0610(_0xc535ac[_0x55bc('0x15')]['message']);}logger[_0x55bc('0x15')]('Migration,\x20%s,\x20%s',_0x5719c9,_0xc535ac[_0x55bc('0x15')][_0x55bc('0x16')]);return _0x38839e(_0xc535ac[_0x55bc('0x15')]['message']);}else{logger[_0x55bc('0xf')](_0x55bc('0x10'),_0x5719c9,'request\x20sent');_0x38839e(_0xc535ac['result'][_0x55bc('0x16')]);}})['catch'](function(_0x482eea){logger[_0x55bc('0x15')](_0x55bc('0x10'),_0x5719c9,_0x482eea);_0x4d0610(_0x482eea);});});} \ No newline at end of file +var _0xd3a0=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1c0f80,_0x4fa6ab){var _0x10538c=function(_0x2f4361){while(--_0x2f4361){_0x1c0f80['push'](_0x1c0f80['shift']());}};_0x10538c(++_0x4fa6ab);}(_0xd3a0,0xaa));var _0x0d3a=function(_0x127e8c,_0x89466f){_0x127e8c=_0x127e8c-0x0;var _0x5c571e=_0xd3a0[_0x127e8c];return _0x5c571e;};'use strict';var _=require(_0x0d3a('0x0'));var util=require(_0x0d3a('0x1'));var moment=require(_0x0d3a('0x2'));var BPromise=require(_0x0d3a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d3a('0x4'));var db=require(_0x0d3a('0x5'))['db'];var utils=require(_0x0d3a('0x6'));var logger=require(_0x0d3a('0x7'))(_0x0d3a('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d3a('0x9'));var client=jayson[_0x0d3a('0xa')][_0x0d3a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437b06,_0x46b328,_0x50d6bb){return new BPromise(function(_0x1a3cac,_0x262ce7){return client[_0x0d3a('0xc')](_0x437b06,_0x50d6bb)[_0x0d3a('0xd')](function(_0x66d9b){logger[_0x0d3a('0xe')](_0x0d3a('0xf'),_0x46b328,'request\x20sent');logger[_0x0d3a('0x10')](_0x0d3a('0x11'),_0x46b328,'request\x20sent',JSON[_0x0d3a('0x12')](_0x66d9b));if(_0x66d9b[_0x0d3a('0x13')]){if(_0x66d9b[_0x0d3a('0x13')][_0x0d3a('0x14')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x46b328,_0x66d9b[_0x0d3a('0x13')][_0x0d3a('0x15')]);return _0x262ce7(_0x66d9b[_0x0d3a('0x13')][_0x0d3a('0x15')]);}logger[_0x0d3a('0x13')](_0x0d3a('0xf'),_0x46b328,_0x66d9b[_0x0d3a('0x13')][_0x0d3a('0x15')]);return _0x1a3cac(_0x66d9b[_0x0d3a('0x13')][_0x0d3a('0x15')]);}else{logger[_0x0d3a('0xe')]('Migration,\x20%s,\x20%s',_0x46b328,'request\x20sent');_0x1a3cac(_0x66d9b[_0x0d3a('0x16')][_0x0d3a('0x15')]);}})[_0x0d3a('0x17')](function(_0x2c93bd){logger[_0x0d3a('0x13')](_0x0d3a('0xf'),_0x46b328,_0x2c93bd);_0x262ce7(_0x2c93bd);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index d0d4d53..28c4ba9 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 _0xca96=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','create','delete','destroy','exports','util'];(function(_0x323d87,_0x4ef3f9){var _0x5e8f74=function(_0x185735){while(--_0x185735){_0x323d87['push'](_0x323d87['shift']());}};_0x5e8f74(++_0x4ef3f9);}(_0xca96,0x10f));var _0x6ca9=function(_0xdea652,_0x3d74b4){_0xdea652=_0xdea652-0x0;var _0x1335ae=_0xca96[_0xdea652];return _0x1335ae;};'use strict';var multer=require('multer');var util=require(_0x6ca9('0x0'));var path=require('path');var timeout=require(_0x6ca9('0x1'));var express=require(_0x6ca9('0x2'));var router=express[_0x6ca9('0x3')]();var fs_extra=require(_0x6ca9('0x4'));var auth=require(_0x6ca9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ca9('0x6'));var controller=require(_0x6ca9('0x7'));router['get']('/',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0x9')]);router[_0x6ca9('0xa')](_0x6ca9('0xb'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xc')]);router['post']('/',auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xd')]);router['put'](_0x6ca9('0xb'),auth[_0x6ca9('0x8')](),controller['update']);router[_0x6ca9('0xe')](_0x6ca9('0xb'),auth[_0x6ca9('0x8')](),controller[_0x6ca9('0xf')]);module[_0x6ca9('0x10')]=router; \ No newline at end of file +var _0xb366=['path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','show','post','create','/:id','delete','destroy','exports','multer'];(function(_0x232f34,_0x2cbdc1){var _0xa91721=function(_0x52d828){while(--_0x52d828){_0x232f34['push'](_0x232f34['shift']());}};_0xa91721(++_0x2cbdc1);}(_0xb366,0xa4));var _0x6b36=function(_0x39ded9,_0x53b4ef){_0x39ded9=_0x39ded9-0x0;var _0x21b451=_0xb366[_0x39ded9];return _0x21b451;};'use strict';var multer=require(_0x6b36('0x0'));var util=require('util');var path=require(_0x6b36('0x1'));var timeout=require(_0x6b36('0x2'));var express=require('express');var router=express[_0x6b36('0x3')]();var fs_extra=require(_0x6b36('0x4'));var auth=require(_0x6b36('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./network.controller');router[_0x6b36('0x6')]('/',auth[_0x6b36('0x7')](),controller['index']);router[_0x6b36('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6b36('0x8')]);router[_0x6b36('0x9')]('/',auth[_0x6b36('0x7')](),controller[_0x6b36('0xa')]);router['put'](_0x6b36('0xb'),auth[_0x6b36('0x7')](),controller['update']);router[_0x6b36('0xc')]('/:id',auth[_0x6b36('0x7')](),controller[_0x6b36('0xd')]);module[_0x6b36('0xe')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 31417c6..574671e 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 _0x6760=['sequelize','exports','ENUM','externip','turn','STRING'];(function(_0x322ce4,_0x3dd20c){var _0x4a1284=function(_0x4be2de){while(--_0x4be2de){_0x322ce4['push'](_0x322ce4['shift']());}};_0x4a1284(++_0x3dd20c);}(_0x6760,0x1e0));var _0x0676=function(_0xa5c0f,_0x5a3121){_0xa5c0f=_0xa5c0f-0x0;var _0x36705b=_0x6760[_0xa5c0f];return _0x36705b;};'use strict';var Sequelize=require(_0x0676('0x0'));module[_0x0676('0x1')]={'type':{'type':Sequelize[_0x0676('0x2')]('localnet',_0x0676('0x3'),'stun',_0x0676('0x4'))},'value':{'type':Sequelize[_0x0676('0x5')]},'username':{'type':Sequelize[_0x0676('0x5')]},'password':{'type':Sequelize[_0x0676('0x5')]}}; \ No newline at end of file +var _0xb45d=['stun','turn','STRING','exports','externip'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xb45d,0x189));var _0xdb45=function(_0x120bc2,_0x57a253){_0x120bc2=_0x120bc2-0x0;var _0x454a41=_0xb45d[_0x120bc2];return _0x454a41;};'use strict';var Sequelize=require('sequelize');module[_0xdb45('0x0')]={'type':{'type':Sequelize['ENUM']('localnet',_0xdb45('0x1'),_0xdb45('0x2'),_0xdb45('0x3'))},'value':{'type':Sequelize[_0xdb45('0x4')]},'username':{'type':Sequelize[_0xdb45('0x4')]},'password':{'type':Sequelize[_0xdb45('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 3a79e73..1fd56ed 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 _0xbabc=['rows','length','find','create','body','toUpperCase','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','readFileSync','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','/etc/asterisk/stun_xcally.conf','toLowerCase','/etc/asterisk/turn_xcally.conf','path','lodash','../../config/logger','api','../../config/environment','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','json','undefined','limit','count','offset','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll'];(function(_0x1b2f4a,_0x93cef2){var _0x5e518b=function(_0x2272c0){while(--_0x2272c0){_0x1b2f4a['push'](_0x1b2f4a['shift']());}};_0x5e518b(++_0x93cef2);}(_0xbabc,0x159));var _0xcbab=function(_0x319493,_0x7b9841){_0x319493=_0x319493-0x0;var _0x12e05a=_0xbabc[_0x319493];return _0x12e05a;};'use strict';var util=require('util');var path=require(_0xcbab('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xcbab('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xcbab('0x2'))(_0xcbab('0x3'));var config=require(_0xcbab('0x4'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xcbab('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37a5c0,_0x520631,_0x5729c9,_0x4e6fcf){return new Promise(function(_0x45aa46,_0x4c0a64){var _0x345f0c=_0x4e6fcf||client;return _0x345f0c[_0xcbab('0x6')](_0x37a5c0,_0x5729c9)[_0xcbab('0x7')](function(_0x15fb29){logger[_0xcbab('0x8')](_0xcbab('0x9'),_0x520631,_0xcbab('0xa'));logger['debug'](_0xcbab('0xb'),_0x520631,_0xcbab('0xa'),JSON['stringify'](_0x15fb29));if(_0x15fb29[_0xcbab('0xc')]){if(_0x15fb29[_0xcbab('0xc')][_0xcbab('0xd')]===0x1f4){logger[_0xcbab('0xc')](_0xcbab('0x9'),_0x520631,_0x15fb29[_0xcbab('0xc')]['message']);return _0x4c0a64(_0x15fb29[_0xcbab('0xc')][_0xcbab('0xe')]);}logger[_0xcbab('0xc')](_0xcbab('0x9'),_0x520631,_0x15fb29['error'][_0xcbab('0xe')]);return _0x45aa46(_0x15fb29[_0xcbab('0xc')][_0xcbab('0xe')]);}else{logger[_0xcbab('0x8')](_0xcbab('0x9'),_0x520631,'request\x20sent');_0x45aa46(_0x15fb29[_0xcbab('0xf')][_0xcbab('0xe')]);}})[_0xcbab('0x10')](function(_0x290435){logger[_0xcbab('0xc')](_0xcbab('0x9'),_0x520631,_0x290435);_0x4c0a64(_0x290435);});});}function respondWithResult(_0xa27928,_0x4b0f27){_0x4b0f27=_0x4b0f27||0xc8;return function(_0x23819a){if(_0x23819a){return _0xa27928['status'](_0x4b0f27)[_0xcbab('0x11')](_0x23819a);}};}function respondWithFilteredResult(_0x383b6c,_0x3a6d61){return function(_0x13be36){if(_0x13be36){var _0x3c836c=typeof _0x3a6d61['offset']===_0xcbab('0x12')&&typeof _0x3a6d61[_0xcbab('0x13')]===_0xcbab('0x12');var _0x407f9a=_0x13be36[_0xcbab('0x14')];var _0x36dc6a=_0x3c836c?0x0:_0x3a6d61[_0xcbab('0x15')];var _0x142cae=_0x3c836c?_0x13be36['count']:_0x3a6d61[_0xcbab('0x15')]+_0x3a6d61[_0xcbab('0x13')];var _0x3b4656;if(_0x142cae>=_0x407f9a){_0x142cae=_0x407f9a;_0x3b4656=0xc8;}else{_0x3b4656=0xce;}_0x383b6c[_0xcbab('0x16')](_0x3b4656);return _0x383b6c[_0xcbab('0x17')](_0xcbab('0x18'),_0x36dc6a+'-'+_0x142cae+'/'+_0x407f9a)[_0xcbab('0x11')](_0x13be36);}return null;};}function saveUpdates(_0x350c6f){return function(_0x44c0da){if(_0x44c0da){return _0x44c0da[_0xcbab('0x19')](_0x350c6f)[_0xcbab('0x7')](function(_0x38abc6){return _0x38abc6;});}return null;};}function removeEntity(_0x3694bd){return function(_0x30df5c){if(_0x30df5c){return _0x30df5c[_0xcbab('0x1a')]()[_0xcbab('0x7')](function(){_0x3694bd[_0xcbab('0x16')](0xcc)[_0xcbab('0x1b')]();});}};}function handleEntityNotFound(_0x659f04){return function(_0x337383){if(!_0x337383){_0x659f04[_0xcbab('0x1c')](0x194);}return _0x337383;};}function handleError(_0x34bd5f,_0x2606d6){_0x2606d6=_0x2606d6||0x1f4;return function(_0x95856a){logger[_0xcbab('0xc')](_0x95856a[_0xcbab('0x1d')]);if(_0x95856a[_0xcbab('0x1e')]){delete _0x95856a[_0xcbab('0x1e')];}_0x34bd5f['status'](_0x2606d6)['send'](_0x95856a);};}exports['index']=function(_0x59eb56,_0x8d4f78){var _0x3252a7={},_0x4c0332={},_0x32ceb2={'count':0x0,'rows':[]};var _0x4465b5=_['map'](db[_0xcbab('0x1f')][_0xcbab('0x20')],function(_0x4be950){return{'name':_0x4be950[_0xcbab('0x21')],'type':_0x4be950[_0xcbab('0x22')][_0xcbab('0x23')]};});_0x4c0332['model']=_['map'](_0x4465b5,'name');_0x4c0332[_0xcbab('0x24')]=_[_0xcbab('0x25')](_0x59eb56['query']);_0x4c0332[_0xcbab('0x26')]=_[_0xcbab('0x27')](_0x4c0332['model'],_0x4c0332[_0xcbab('0x24')]);_0x3252a7[_0xcbab('0x28')]=_[_0xcbab('0x27')](_0x4c0332[_0xcbab('0x29')],qs[_0xcbab('0x2a')](_0x59eb56[_0xcbab('0x24')][_0xcbab('0x2a')]));_0x3252a7[_0xcbab('0x28')]=_0x3252a7['attributes']['length']?_0x3252a7[_0xcbab('0x28')]:_0x4c0332[_0xcbab('0x29')];if(!_0x59eb56[_0xcbab('0x24')][_0xcbab('0x2b')]('nolimit')){_0x3252a7[_0xcbab('0x13')]=qs[_0xcbab('0x13')](_0x59eb56[_0xcbab('0x24')][_0xcbab('0x13')]);_0x3252a7[_0xcbab('0x15')]=qs['offset'](_0x59eb56[_0xcbab('0x24')]['offset']);}_0x3252a7['order']=qs[_0xcbab('0x2c')](_0x59eb56[_0xcbab('0x24')]['sort']);_0x3252a7['where']=qs[_0xcbab('0x26')](_[_0xcbab('0x2d')](_0x59eb56[_0xcbab('0x24')],_0x4c0332[_0xcbab('0x26')]),_0x4465b5);if(_0x59eb56[_0xcbab('0x24')][_0xcbab('0x2e')]){_0x3252a7[_0xcbab('0x2f')]=_[_0xcbab('0x30')](_0x3252a7['where'],{'$or':_[_0xcbab('0x31')](_0x4465b5,function(_0x4060bb){if(_0x4060bb['type']!==_0xcbab('0x32')){var _0xfe4ff9={};_0xfe4ff9[_0x4060bb[_0xcbab('0x1e')]]={'$like':'%'+_0x59eb56[_0xcbab('0x24')][_0xcbab('0x2e')]+'%'};return _0xfe4ff9;}})});}_0x3252a7=_[_0xcbab('0x30')]({},_0x3252a7,_0x59eb56[_0xcbab('0x33')]);var _0x484d35={'where':_0x3252a7['where']};return db[_0xcbab('0x1f')][_0xcbab('0x14')](_0x484d35)['then'](function(_0x2065ed){_0x32ceb2[_0xcbab('0x14')]=_0x2065ed;if(_0x59eb56[_0xcbab('0x24')][_0xcbab('0x34')]){_0x3252a7[_0xcbab('0x35')]=[{'all':!![]}];}return db['Network'][_0xcbab('0x36')](_0x3252a7);})[_0xcbab('0x7')](function(_0x1f4398){_0x32ceb2[_0xcbab('0x37')]=_0x1f4398;return _0x32ceb2;})[_0xcbab('0x7')](respondWithFilteredResult(_0x8d4f78,_0x3252a7))[_0xcbab('0x10')](handleError(_0x8d4f78,null));};exports['show']=function(_0x4fbadf,_0x31f24a){var _0x44b903={'raw':!![],'where':{'id':_0x4fbadf['params']['id']}},_0x44630e={};_0x44630e[_0xcbab('0x29')]=_[_0xcbab('0x25')](db[_0xcbab('0x1f')][_0xcbab('0x20')]);_0x44630e[_0xcbab('0x24')]=_[_0xcbab('0x25')](_0x4fbadf[_0xcbab('0x24')]);_0x44630e[_0xcbab('0x26')]=_[_0xcbab('0x27')](_0x44630e[_0xcbab('0x29')],_0x44630e[_0xcbab('0x24')]);_0x44b903[_0xcbab('0x28')]=_[_0xcbab('0x27')](_0x44630e[_0xcbab('0x29')],qs[_0xcbab('0x2a')](_0x4fbadf['query'][_0xcbab('0x2a')]));_0x44b903[_0xcbab('0x28')]=_0x44b903[_0xcbab('0x28')][_0xcbab('0x38')]?_0x44b903[_0xcbab('0x28')]:_0x44630e[_0xcbab('0x29')];if(_0x4fbadf[_0xcbab('0x24')][_0xcbab('0x34')]){_0x44b903['include']=[{'all':!![]}];}_0x44b903=_[_0xcbab('0x30')]({},_0x44b903,_0x4fbadf[_0xcbab('0x33')]);return db['Network'][_0xcbab('0x39')](_0x44b903)[_0xcbab('0x7')](handleEntityNotFound(_0x31f24a,null))[_0xcbab('0x7')](respondWithResult(_0x31f24a,null))[_0xcbab('0x10')](handleError(_0x31f24a,null));};exports[_0xcbab('0x3a')]=function(_0x27ab3f,_0x19e3c1){var _0x42d1fe;return db['Network'][_0xcbab('0x3a')](_0x27ab3f['body'],{'raw':!![]})['then'](function(_0x2b849a){_0x42d1fe=_0x2b849a;return db[_0xcbab('0x1f')][_0xcbab('0x36')]({'where':{'type':_0x27ab3f[_0xcbab('0x3b')][_0xcbab('0x22')]},'raw':!![]});})[_0xcbab('0x7')](function(_0x1b7835){if(_0x42d1fe[_0xcbab('0x22')][_0xcbab('0x3c')]()==_0xcbab('0x3d')){var _0x5cf742=fs['readFileSync'](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],_0xcbab('0x40')),_0xcbab('0x41'));var _0x483749=ejs['render'](_0x5cf742,{'networks':_0x1b7835||[]});fs[_0xcbab('0x42')]('/etc/asterisk/stun_xcally.conf',_0x483749);return respondWithRpcPromise(_0xcbab('0x43'),_0xcbab('0x3a'),{'module':_0xcbab('0x44')});}else if(_0x42d1fe[_0xcbab('0x22')][_0xcbab('0x3c')]()==_0xcbab('0x45')){var _0x591838=fs['readFileSync'](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],_0xcbab('0x46')),_0xcbab('0x41'));var _0x2b5b05=ejs['render'](_0x591838,{'networks':_0x1b7835||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x2b5b05);return respondWithRpcPromise(_0xcbab('0x43'),'create',{'module':'res_stun_monitor.so'});}else{var _0x3b7910=fs[_0xcbab('0x47')](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],_0xcbab('0x48')),_0xcbab('0x41'));var _0x3e2ddc=ejs[_0xcbab('0x49')](_0x3b7910,{'networks':_0x1b7835||[]});fs[_0xcbab('0x42')](util[_0xcbab('0x4a')](_0xcbab('0x4b'),_0x27ab3f[_0xcbab('0x3b')]['type']['toLowerCase']()),_0x3e2ddc);return respondWithRpcPromise(_0xcbab('0x43'),_0xcbab('0x3a'),{'module':_0xcbab('0x4c')});}})[_0xcbab('0x7')](function(){return _0x42d1fe;})['then'](respondWithResult(_0x19e3c1,0xc9))[_0xcbab('0x10')](handleError(_0x19e3c1,null));};exports['update']=function(_0x559ce9,_0x5cb4fa){var _0x216739;return db[_0xcbab('0x1f')]['find']({'where':{'id':_0x559ce9['params']['id']}})[_0xcbab('0x7')](handleEntityNotFound(_0x5cb4fa,null))[_0xcbab('0x7')](saveUpdates(_0x559ce9[_0xcbab('0x3b')],null))[_0xcbab('0x7')](function(_0xe44c0d){if(_0xe44c0d){_0x216739=_0xe44c0d;return db['Network'][_0xcbab('0x36')]({'where':{'type':_0x216739[_0xcbab('0x22')]},'raw':!![]});}return null;})[_0xcbab('0x7')](function(_0x3a48bb){if(_0x216739[_0xcbab('0x22')]['toUpperCase']()==_0xcbab('0x3d')){var _0x3bd3f3=fs['readFileSync'](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],_0xcbab('0x40')),_0xcbab('0x41'));var _0x54dda9=ejs[_0xcbab('0x49')](_0x3bd3f3,{'networks':_0x3a48bb||[]});fs[_0xcbab('0x42')](_0xcbab('0x4d'),_0x54dda9);return respondWithRpcPromise(_0xcbab('0x43'),_0xcbab('0x19'),{'module':_0xcbab('0x44')});}else if(_0x216739[_0xcbab('0x22')][_0xcbab('0x3c')]()==_0xcbab('0x45')){var _0x3303a1=fs[_0xcbab('0x47')](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x12a817=ejs['render'](_0x3303a1,{'networks':_0x3a48bb||[]});fs[_0xcbab('0x42')]('/etc/asterisk/turn_xcally.conf',_0x12a817);return respondWithRpcPromise(_0xcbab('0x43'),_0xcbab('0x19'),{'module':_0xcbab('0x44')});}else{var _0x72a620=fs[_0xcbab('0x47')](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],_0xcbab('0x48')),_0xcbab('0x41'));var _0x3f9115=ejs[_0xcbab('0x49')](_0x72a620,{'networks':_0x3a48bb||[]});fs[_0xcbab('0x42')](util[_0xcbab('0x4a')](_0xcbab('0x4b'),_0x559ce9[_0xcbab('0x3b')]['type'][_0xcbab('0x4e')]()),_0x3f9115);return respondWithRpcPromise(_0xcbab('0x43'),_0xcbab('0x19'),{'module':'chan_sip.so'});}})[_0xcbab('0x7')](function(_0xf05c4f){if(_0xf05c4f){return _0x216739;}return null;})[_0xcbab('0x7')](respondWithResult(_0x5cb4fa,null))[_0xcbab('0x10')](handleError(_0x5cb4fa,null));};exports[_0xcbab('0x1a')]=function(_0x57ecd7,_0x3f68d4){var _0x1ff4d9;return db['Network']['find']({'where':{'id':_0x57ecd7['params']['id']}})['then'](function(_0x27fae3){_0x1ff4d9=_0x27fae3;return _0x27fae3;})[_0xcbab('0x7')](handleEntityNotFound(_0x3f68d4,null))['then'](removeEntity(_0x3f68d4,null))[_0xcbab('0x7')](function(){if(_0x1ff4d9){return db[_0xcbab('0x1f')][_0xcbab('0x36')]({'where':{'type':_0x1ff4d9[_0xcbab('0x22')]},'raw':!![]});}})['then'](function(_0x9a62fe){if(_0x1ff4d9[_0xcbab('0x22')]['toUpperCase']()==_0xcbab('0x3d')){var _0xb2ffaa=fs[_0xcbab('0x47')](path['join'](config[_0xcbab('0x3f')],_0xcbab('0x40')),_0xcbab('0x41'));var _0x5a05a3=ejs['render'](_0xb2ffaa,{'networks':_0x9a62fe||[]});fs[_0xcbab('0x42')]('/etc/asterisk/stun_xcally.conf',_0x5a05a3);return respondWithRpcPromise(_0xcbab('0x43'),'destroy',{'module':_0xcbab('0x44')});}else if(_0x1ff4d9[_0xcbab('0x22')][_0xcbab('0x3c')]()==_0xcbab('0x45')){var _0x299a54=fs[_0xcbab('0x47')](path[_0xcbab('0x3e')](config['root'],_0xcbab('0x46')),_0xcbab('0x41'));var _0x1c62b8=ejs[_0xcbab('0x49')](_0x299a54,{'networks':_0x9a62fe||[]});fs[_0xcbab('0x42')](_0xcbab('0x4f'),_0x1c62b8);return respondWithRpcPromise('Reload',_0xcbab('0x1a'),{'module':_0xcbab('0x44')});}else{var _0x4782b3=fs[_0xcbab('0x47')](path[_0xcbab('0x3e')](config[_0xcbab('0x3f')],_0xcbab('0x48')),_0xcbab('0x41'));var _0x5e5850=ejs[_0xcbab('0x49')](_0x4782b3,{'networks':_0x9a62fe||[]});fs[_0xcbab('0x42')](util[_0xcbab('0x4a')](_0xcbab('0x4b'),_0x1ff4d9['type'][_0xcbab('0x4e')]()),_0x5e5850);return respondWithRpcPromise(_0xcbab('0x43'),'destroy',{'module':'chan_sip.so'});}})[_0xcbab('0x10')](handleError(_0x3f68d4,null));}; \ No newline at end of file +var _0x07c0=['info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','error','code','message','Network,\x20%s,\x20%s','json','undefined','limit','count','offset','status','set','Content-Range','update','destroy','end','sendStatus','stack','name','index','map','Network','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','catch','create','body','toUpperCase','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','root','/etc/asterisk/turn_xcally.conf','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','STUN','server/files/templates/stun_multiple.ejs','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','chan_sip.so','TURN','util','ejs','../../components/parsers/qs','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x07c0,0x190));var _0x007c=function(_0x1c5385,_0x3aba1a){_0x1c5385=_0x1c5385-0x0;var _0x478ddb=_0x07c0[_0x1c5385];return _0x478ddb;};'use strict';var util=require(_0x007c('0x0'));var path=require('path');var ejs=require(_0x007c('0x1'));var fs=require('fs');var _=require('lodash');var qs=require(_0x007c('0x2'));var logger=require('../../config/logger')(_0x007c('0x3'));var config=require(_0x007c('0x4'));var db=require(_0x007c('0x5'))['db'];var jayson=require(_0x007c('0x6'));var client=jayson['client'][_0x007c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x55dea3,_0x3720e9,_0x4ca170,_0x1c42f9){return new Promise(function(_0xc43618,_0x349828){var _0x5d29d4=_0x1c42f9||client;return _0x5d29d4[_0x007c('0x8')](_0x55dea3,_0x4ca170)[_0x007c('0x9')](function(_0x56798a){logger[_0x007c('0xa')]('Network,\x20%s,\x20%s',_0x3720e9,_0x007c('0xb'));logger['debug'](_0x007c('0xc'),_0x3720e9,'request\x20sent',JSON['stringify'](_0x56798a));if(_0x56798a[_0x007c('0xd')]){if(_0x56798a['error'][_0x007c('0xe')]===0x1f4){logger[_0x007c('0xd')]('Network,\x20%s,\x20%s',_0x3720e9,_0x56798a[_0x007c('0xd')]['message']);return _0x349828(_0x56798a[_0x007c('0xd')][_0x007c('0xf')]);}logger['error'](_0x007c('0x10'),_0x3720e9,_0x56798a[_0x007c('0xd')]['message']);return _0xc43618(_0x56798a['error'][_0x007c('0xf')]);}else{logger[_0x007c('0xa')](_0x007c('0x10'),_0x3720e9,'request\x20sent');_0xc43618(_0x56798a['result'][_0x007c('0xf')]);}})['catch'](function(_0x5ad6ab){logger[_0x007c('0xd')]('Network,\x20%s,\x20%s',_0x3720e9,_0x5ad6ab);_0x349828(_0x5ad6ab);});});}function respondWithResult(_0x286367,_0x4678e0){_0x4678e0=_0x4678e0||0xc8;return function(_0x286336){if(_0x286336){return _0x286367['status'](_0x4678e0)[_0x007c('0x11')](_0x286336);}};}function respondWithFilteredResult(_0x50273f,_0x2e9585){return function(_0x5cd8cc){if(_0x5cd8cc){var _0xe927f4=typeof _0x2e9585['offset']===_0x007c('0x12')&&typeof _0x2e9585[_0x007c('0x13')]===_0x007c('0x12');var _0x15144a=_0x5cd8cc[_0x007c('0x14')];var _0x230d8c=_0xe927f4?0x0:_0x2e9585['offset'];var _0x45af3a=_0xe927f4?_0x5cd8cc['count']:_0x2e9585[_0x007c('0x15')]+_0x2e9585['limit'];var _0x4f9d9e;if(_0x45af3a>=_0x15144a){_0x45af3a=_0x15144a;_0x4f9d9e=0xc8;}else{_0x4f9d9e=0xce;}_0x50273f[_0x007c('0x16')](_0x4f9d9e);return _0x50273f[_0x007c('0x17')](_0x007c('0x18'),_0x230d8c+'-'+_0x45af3a+'/'+_0x15144a)[_0x007c('0x11')](_0x5cd8cc);}return null;};}function saveUpdates(_0x469d8e){return function(_0x35dacf){if(_0x35dacf){return _0x35dacf[_0x007c('0x19')](_0x469d8e)[_0x007c('0x9')](function(_0x15c94c){return _0x15c94c;});}return null;};}function removeEntity(_0x9425df){return function(_0x26191f){if(_0x26191f){return _0x26191f[_0x007c('0x1a')]()[_0x007c('0x9')](function(){_0x9425df[_0x007c('0x16')](0xcc)[_0x007c('0x1b')]();});}};}function handleEntityNotFound(_0x51ea0e){return function(_0x2dd1a1){if(!_0x2dd1a1){_0x51ea0e[_0x007c('0x1c')](0x194);}return _0x2dd1a1;};}function handleError(_0x314920,_0x52ddd0){_0x52ddd0=_0x52ddd0||0x1f4;return function(_0x1874c3){logger[_0x007c('0xd')](_0x1874c3[_0x007c('0x1d')]);if(_0x1874c3[_0x007c('0x1e')]){delete _0x1874c3[_0x007c('0x1e')];}_0x314920['status'](_0x52ddd0)['send'](_0x1874c3);};}exports[_0x007c('0x1f')]=function(_0x5f3adc,_0x38dfc7){var _0x1be4ec={},_0x442e1b={},_0x4843e7={'count':0x0,'rows':[]};var _0x2e78b0=_[_0x007c('0x20')](db[_0x007c('0x21')]['rawAttributes'],function(_0x5a21b5){return{'name':_0x5a21b5[_0x007c('0x22')],'type':_0x5a21b5[_0x007c('0x23')][_0x007c('0x24')]};});_0x442e1b[_0x007c('0x25')]=_[_0x007c('0x20')](_0x2e78b0,_0x007c('0x1e'));_0x442e1b[_0x007c('0x26')]=_[_0x007c('0x27')](_0x5f3adc[_0x007c('0x26')]);_0x442e1b[_0x007c('0x28')]=_[_0x007c('0x29')](_0x442e1b['model'],_0x442e1b[_0x007c('0x26')]);_0x1be4ec[_0x007c('0x2a')]=_['intersection'](_0x442e1b['model'],qs[_0x007c('0x2b')](_0x5f3adc['query'][_0x007c('0x2b')]));_0x1be4ec[_0x007c('0x2a')]=_0x1be4ec[_0x007c('0x2a')][_0x007c('0x2c')]?_0x1be4ec['attributes']:_0x442e1b[_0x007c('0x25')];if(!_0x5f3adc['query']['hasOwnProperty']('nolimit')){_0x1be4ec[_0x007c('0x13')]=qs[_0x007c('0x13')](_0x5f3adc['query']['limit']);_0x1be4ec[_0x007c('0x15')]=qs['offset'](_0x5f3adc[_0x007c('0x26')][_0x007c('0x15')]);}_0x1be4ec[_0x007c('0x2d')]=qs[_0x007c('0x2e')](_0x5f3adc['query'][_0x007c('0x2e')]);_0x1be4ec[_0x007c('0x2f')]=qs['filters'](_[_0x007c('0x30')](_0x5f3adc[_0x007c('0x26')],_0x442e1b[_0x007c('0x28')]),_0x2e78b0);if(_0x5f3adc[_0x007c('0x26')]['filter']){_0x1be4ec[_0x007c('0x2f')]=_[_0x007c('0x31')](_0x1be4ec['where'],{'$or':_[_0x007c('0x20')](_0x2e78b0,function(_0x4722be){if(_0x4722be[_0x007c('0x23')]!==_0x007c('0x32')){var _0x282f2d={};_0x282f2d[_0x4722be['name']]={'$like':'%'+_0x5f3adc[_0x007c('0x26')]['filter']+'%'};return _0x282f2d;}})});}_0x1be4ec=_[_0x007c('0x31')]({},_0x1be4ec,_0x5f3adc[_0x007c('0x33')]);var _0xe54a97={'where':_0x1be4ec['where']};return db[_0x007c('0x21')][_0x007c('0x14')](_0xe54a97)['then'](function(_0x4237aa){_0x4843e7[_0x007c('0x14')]=_0x4237aa;if(_0x5f3adc[_0x007c('0x26')][_0x007c('0x34')]){_0x1be4ec[_0x007c('0x35')]=[{'all':!![]}];}return db[_0x007c('0x21')][_0x007c('0x36')](_0x1be4ec);})[_0x007c('0x9')](function(_0x5a23c4){_0x4843e7[_0x007c('0x37')]=_0x5a23c4;return _0x4843e7;})[_0x007c('0x9')](respondWithFilteredResult(_0x38dfc7,_0x1be4ec))['catch'](handleError(_0x38dfc7,null));};exports['show']=function(_0x13b156,_0x3e5541){var _0x173e69={'raw':!![],'where':{'id':_0x13b156[_0x007c('0x38')]['id']}},_0x2ec28c={};_0x2ec28c[_0x007c('0x25')]=_['keys'](db[_0x007c('0x21')][_0x007c('0x39')]);_0x2ec28c[_0x007c('0x26')]=_[_0x007c('0x27')](_0x13b156[_0x007c('0x26')]);_0x2ec28c[_0x007c('0x28')]=_[_0x007c('0x29')](_0x2ec28c[_0x007c('0x25')],_0x2ec28c['query']);_0x173e69[_0x007c('0x2a')]=_[_0x007c('0x29')](_0x2ec28c['model'],qs[_0x007c('0x2b')](_0x13b156[_0x007c('0x26')][_0x007c('0x2b')]));_0x173e69[_0x007c('0x2a')]=_0x173e69[_0x007c('0x2a')][_0x007c('0x2c')]?_0x173e69[_0x007c('0x2a')]:_0x2ec28c[_0x007c('0x25')];if(_0x13b156[_0x007c('0x26')][_0x007c('0x34')]){_0x173e69['include']=[{'all':!![]}];}_0x173e69=_['merge']({},_0x173e69,_0x13b156[_0x007c('0x33')]);return db['Network']['find'](_0x173e69)['then'](handleEntityNotFound(_0x3e5541,null))[_0x007c('0x9')](respondWithResult(_0x3e5541,null))[_0x007c('0x3a')](handleError(_0x3e5541,null));};exports[_0x007c('0x3b')]=function(_0x4a7a34,_0x5809ff){var _0x854120;return db[_0x007c('0x21')]['create'](_0x4a7a34[_0x007c('0x3c')],{'raw':!![]})[_0x007c('0x9')](function(_0xe6686e){_0x854120=_0xe6686e;return db[_0x007c('0x21')][_0x007c('0x36')]({'where':{'type':_0x4a7a34['body'][_0x007c('0x23')]},'raw':!![]});})['then'](function(_0x28dae4){if(_0x854120[_0x007c('0x23')][_0x007c('0x3d')]()=='STUN'){var _0x50051=fs[_0x007c('0x3e')](path[_0x007c('0x3f')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x007c('0x40'));var _0x23b82f=ejs[_0x007c('0x41')](_0x50051,{'networks':_0x28dae4||[]});fs[_0x007c('0x42')](_0x007c('0x43'),_0x23b82f);return respondWithRpcPromise(_0x007c('0x44'),'create',{'module':'res_stun_monitor.so'});}else if(_0x854120[_0x007c('0x23')]['toUpperCase']()=='TURN'){var _0x19e698=fs[_0x007c('0x3e')](path['join'](config[_0x007c('0x45')],'server/files/templates/turn_multiple.ejs'),_0x007c('0x40'));var _0x4938ab=ejs[_0x007c('0x41')](_0x19e698,{'networks':_0x28dae4||[]});fs[_0x007c('0x42')](_0x007c('0x46'),_0x4938ab);return respondWithRpcPromise(_0x007c('0x44'),_0x007c('0x3b'),{'module':'res_stun_monitor.so'});}else{var _0x1cde94=fs[_0x007c('0x3e')](path['join'](config[_0x007c('0x45')],'server/files/templates/network.ejs'),_0x007c('0x40'));var _0xd4b301=ejs['render'](_0x1cde94,{'networks':_0x28dae4||[]});fs[_0x007c('0x42')](util[_0x007c('0x47')](_0x007c('0x48'),_0x4a7a34[_0x007c('0x3c')][_0x007c('0x23')][_0x007c('0x49')]()),_0xd4b301);return respondWithRpcPromise(_0x007c('0x44'),_0x007c('0x3b'),{'module':'chan_sip.so'});}})[_0x007c('0x9')](function(){return _0x854120;})[_0x007c('0x9')](respondWithResult(_0x5809ff,0xc9))[_0x007c('0x3a')](handleError(_0x5809ff,null));};exports[_0x007c('0x19')]=function(_0x5268ad,_0x249d3f){var _0x3c6ce6;return db['Network'][_0x007c('0x4a')]({'where':{'id':_0x5268ad[_0x007c('0x38')]['id']}})['then'](handleEntityNotFound(_0x249d3f,null))[_0x007c('0x9')](saveUpdates(_0x5268ad[_0x007c('0x3c')],null))[_0x007c('0x9')](function(_0x211a17){if(_0x211a17){_0x3c6ce6=_0x211a17;return db['Network']['findAll']({'where':{'type':_0x3c6ce6['type']},'raw':!![]});}return null;})[_0x007c('0x9')](function(_0x2682f5){if(_0x3c6ce6[_0x007c('0x23')][_0x007c('0x3d')]()==_0x007c('0x4b')){var _0xef36db=fs['readFileSync'](path['join'](config['root'],_0x007c('0x4c')),_0x007c('0x40'));var _0x1ad05e=ejs[_0x007c('0x41')](_0xef36db,{'networks':_0x2682f5||[]});fs[_0x007c('0x42')](_0x007c('0x43'),_0x1ad05e);return respondWithRpcPromise(_0x007c('0x44'),_0x007c('0x19'),{'module':_0x007c('0x4d')});}else if(_0x3c6ce6[_0x007c('0x23')][_0x007c('0x3d')]()=='TURN'){var _0x2b2e4b=fs[_0x007c('0x3e')](path[_0x007c('0x3f')](config[_0x007c('0x45')],_0x007c('0x4e')),'utf8');var _0x3be558=ejs['render'](_0x2b2e4b,{'networks':_0x2682f5||[]});fs[_0x007c('0x42')](_0x007c('0x46'),_0x3be558);return respondWithRpcPromise('Reload','update',{'module':_0x007c('0x4d')});}else{var _0x1f1cdc=fs[_0x007c('0x3e')](path[_0x007c('0x3f')](config[_0x007c('0x45')],_0x007c('0x4f')),'utf8');var _0x10cb94=ejs[_0x007c('0x41')](_0x1f1cdc,{'networks':_0x2682f5||[]});fs[_0x007c('0x42')](util[_0x007c('0x47')](_0x007c('0x48'),_0x5268ad[_0x007c('0x3c')][_0x007c('0x23')][_0x007c('0x49')]()),_0x10cb94);return respondWithRpcPromise(_0x007c('0x44'),_0x007c('0x19'),{'module':_0x007c('0x50')});}})[_0x007c('0x9')](function(_0x4d1dce){if(_0x4d1dce){return _0x3c6ce6;}return null;})[_0x007c('0x9')](respondWithResult(_0x249d3f,null))[_0x007c('0x3a')](handleError(_0x249d3f,null));};exports[_0x007c('0x1a')]=function(_0xe130e,_0x2f7b08){var _0x5bec00;return db['Network'][_0x007c('0x4a')]({'where':{'id':_0xe130e['params']['id']}})[_0x007c('0x9')](function(_0x2726db){_0x5bec00=_0x2726db;return _0x2726db;})['then'](handleEntityNotFound(_0x2f7b08,null))[_0x007c('0x9')](removeEntity(_0x2f7b08,null))['then'](function(){if(_0x5bec00){return db[_0x007c('0x21')]['findAll']({'where':{'type':_0x5bec00[_0x007c('0x23')]},'raw':!![]});}})[_0x007c('0x9')](function(_0x10c6fa){if(_0x5bec00[_0x007c('0x23')][_0x007c('0x3d')]()==_0x007c('0x4b')){var _0xa6e597=fs[_0x007c('0x3e')](path['join'](config['root'],_0x007c('0x4c')),_0x007c('0x40'));var _0x4689fd=ejs[_0x007c('0x41')](_0xa6e597,{'networks':_0x10c6fa||[]});fs[_0x007c('0x42')](_0x007c('0x43'),_0x4689fd);return respondWithRpcPromise(_0x007c('0x44'),'destroy',{'module':_0x007c('0x4d')});}else if(_0x5bec00[_0x007c('0x23')][_0x007c('0x3d')]()==_0x007c('0x51')){var _0x400b3d=fs[_0x007c('0x3e')](path[_0x007c('0x3f')](config['root'],_0x007c('0x4e')),_0x007c('0x40'));var _0x44c09a=ejs['render'](_0x400b3d,{'networks':_0x10c6fa||[]});fs[_0x007c('0x42')](_0x007c('0x46'),_0x44c09a);return respondWithRpcPromise(_0x007c('0x44'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x1f741a=fs[_0x007c('0x3e')](path[_0x007c('0x3f')](config[_0x007c('0x45')],'server/files/templates/network.ejs'),'utf8');var _0x11dddb=ejs[_0x007c('0x41')](_0x1f741a,{'networks':_0x10c6fa||[]});fs[_0x007c('0x42')](util[_0x007c('0x47')](_0x007c('0x48'),_0x5bec00['type'][_0x007c('0x49')]()),_0x11dddb);return respondWithRpcPromise(_0x007c('0x44'),_0x007c('0x1a'),{'module':_0x007c('0x50')});}})['catch'](handleError(_0x2f7b08,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 941e886..0205554 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 _0xa588=['exports','define','Network','network','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x22afe5,_0x284242){var _0x4e1348=function(_0x57647d){while(--_0x57647d){_0x22afe5['push'](_0x22afe5['shift']());}};_0x4e1348(++_0x284242);}(_0xa588,0xe1));var _0x8a58=function(_0x4ec964,_0x3b9bd8){_0x4ec964=_0x4ec964-0x0;var _0x5943e2=_0xa588[_0x4ec964];return _0x5943e2;};'use strict';var _=require('lodash');var util=require(_0x8a58('0x0'));var logger=require(_0x8a58('0x1'))(_0x8a58('0x2'));var moment=require(_0x8a58('0x3'));var BPromise=require(_0x8a58('0x4'));var rp=require(_0x8a58('0x5'));var fs=require('fs');var path=require(_0x8a58('0x6'));var rimraf=require(_0x8a58('0x7'));var config=require(_0x8a58('0x8'));var attributes=require('./network.attributes');module[_0x8a58('0x9')]=function(_0x408a4a,_0x448366){return _0x408a4a[_0x8a58('0xa')](_0x8a58('0xb'),attributes,{'tableName':_0x8a58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4522=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger','api','moment','request-promise'];(function(_0x3662e4,_0x5e20ac){var _0x7515a7=function(_0x355af3){while(--_0x355af3){_0x3662e4['push'](_0x3662e4['shift']());}};_0x7515a7(++_0x5e20ac);}(_0x4522,0x1a0));var _0x2452=function(_0x18f57a,_0x2a23ec){_0x18f57a=_0x18f57a-0x0;var _0x529482=_0x4522[_0x18f57a];return _0x529482;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2452('0x0'))(_0x2452('0x1'));var moment=require(_0x2452('0x2'));var BPromise=require('bluebird');var rp=require(_0x2452('0x3'));var fs=require('fs');var path=require(_0x2452('0x4'));var rimraf=require(_0x2452('0x5'));var config=require(_0x2452('0x6'));var attributes=require(_0x2452('0x7'));module[_0x2452('0x8')]=function(_0x15fc69,_0x226578){return _0x15fc69[_0x2452('0x9')](_0x2452('0xa'),attributes,{'tableName':_0x2452('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 00eaab4..680b05a 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(_0x77a826,_0x6a6a50){var _0x317dea=function(_0x2f1457){while(--_0x2f1457){_0x77a826['push'](_0x77a826['shift']());}};_0x317dea(++_0x6a6a50);}(_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 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0xa11854,_0x25577c){_0xa11854=_0xa11854-0x0;var _0x9338ea=_0x7a54[_0xa11854];return _0x9338ea;};'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 4c0bdbf..731a9d6 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 _0x44f3=['addApplications','addAgents','/:id/send','send','update','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','/:id/applications'];(function(_0x32824c,_0x187b0a){var _0x170e27=function(_0x3a2ea2){while(--_0x3a2ea2){_0x32824c['push'](_0x32824c['shift']());}};_0x170e27(++_0x187b0a);}(_0x44f3,0x1a0));var _0x344f=function(_0x285b7d,_0x46a4b7){_0x285b7d=_0x285b7d-0x0;var _0x1c6999=_0x44f3[_0x285b7d];return _0x1c6999;};'use strict';var multer=require(_0x344f('0x0'));var util=require('util');var path=require(_0x344f('0x1'));var timeout=require(_0x344f('0x2'));var express=require(_0x344f('0x3'));var router=express['Router']();var fs_extra=require(_0x344f('0x4'));var auth=require(_0x344f('0x5'));var interaction=require(_0x344f('0x6'));var config=require(_0x344f('0x7'));var controller=require('./openchannelAccount.controller');router[_0x344f('0x8')]('/',auth['isAuthenticated'](),controller[_0x344f('0x9')]);router['get'](_0x344f('0xa'),auth[_0x344f('0xb')](),controller[_0x344f('0xc')]);router['get'](_0x344f('0xd'),auth[_0x344f('0xb')](),controller['show']);router['get'](_0x344f('0xe'),auth['isAuthenticated'](),controller[_0x344f('0xf')]);router[_0x344f('0x8')](_0x344f('0x10'),auth['isAuthenticated'](),controller[_0x344f('0x11')]);router['get']('/:id/applications',auth[_0x344f('0xb')](),controller[_0x344f('0x12')]);router['get'](_0x344f('0x13'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x344f('0x8')](_0x344f('0x14'),auth[_0x344f('0xb')](),controller[_0x344f('0x15')]);router[_0x344f('0x16')]('/',auth[_0x344f('0xb')](),controller[_0x344f('0x17')]);router['post'](_0x344f('0xe'),auth[_0x344f('0xb')](),controller[_0x344f('0x18')]);router[_0x344f('0x16')](_0x344f('0x10'),auth[_0x344f('0xb')](),controller[_0x344f('0x19')]);router[_0x344f('0x16')](_0x344f('0x1a'),controller['notify']);router[_0x344f('0x16')](_0x344f('0x1b'),auth['isAuthenticated'](),controller[_0x344f('0x1c')]);router[_0x344f('0x16')](_0x344f('0x14'),auth[_0x344f('0xb')](),controller[_0x344f('0x1d')]);router[_0x344f('0x16')](_0x344f('0x1e'),auth[_0x344f('0xb')](),controller[_0x344f('0x1f')]);router['put']('/:id',auth[_0x344f('0xb')](),controller[_0x344f('0x20')]);router[_0x344f('0x21')](_0x344f('0xd'),auth[_0x344f('0xb')](),controller['destroy']);router[_0x344f('0x21')](_0x344f('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x344f('0x21')](_0x344f('0x10'),auth[_0x344f('0xb')](),controller[_0x344f('0x22')]);router[_0x344f('0x21')](_0x344f('0x14'),auth['isAuthenticated'](),controller[_0x344f('0x23')]);module[_0x344f('0x24')]=router; \ No newline at end of file +var _0x0133=['../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','getInteractions','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1ad17c,_0x1974b8){var _0x13951b=function(_0x2f9832){while(--_0x2f9832){_0x1ad17c['push'](_0x1ad17c['shift']());}};_0x13951b(++_0x1974b8);}(_0x0133,0xf7));var _0x3013=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0133[_0x580576];return _0x3f55a0;};'use strict';var multer=require(_0x3013('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3013('0x1'));var express=require(_0x3013('0x2'));var router=express[_0x3013('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3013('0x4'));var interaction=require(_0x3013('0x5'));var config=require(_0x3013('0x6'));var controller=require(_0x3013('0x7'));router[_0x3013('0x8')]('/',auth[_0x3013('0x9')](),controller[_0x3013('0xa')]);router[_0x3013('0x8')](_0x3013('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x3013('0x8')](_0x3013('0xc'),auth[_0x3013('0x9')](),controller[_0x3013('0xd')]);router['get'](_0x3013('0xe'),auth['isAuthenticated'](),controller[_0x3013('0xf')]);router[_0x3013('0x8')]('/:id/canned_answers',auth[_0x3013('0x9')](),controller[_0x3013('0x10')]);router[_0x3013('0x8')]('/:id/applications',auth[_0x3013('0x9')](),controller['getApplications']);router[_0x3013('0x8')]('/:id/interactions',auth[_0x3013('0x9')](),controller[_0x3013('0x11')]);router[_0x3013('0x8')](_0x3013('0x12'),auth[_0x3013('0x9')](),controller[_0x3013('0x13')]);router['post']('/',auth[_0x3013('0x9')](),controller[_0x3013('0x14')]);router[_0x3013('0x15')](_0x3013('0xe'),auth[_0x3013('0x9')](),controller[_0x3013('0x16')]);router[_0x3013('0x15')](_0x3013('0x17'),auth['isAuthenticated'](),controller[_0x3013('0x18')]);router[_0x3013('0x15')](_0x3013('0x19'),controller[_0x3013('0x1a')]);router['post']('/:id/applications',auth[_0x3013('0x9')](),controller[_0x3013('0x1b')]);router['post'](_0x3013('0x12'),auth[_0x3013('0x9')](),controller['addAgents']);router[_0x3013('0x15')]('/:id/send',auth[_0x3013('0x9')](),controller['send']);router[_0x3013('0x1c')](_0x3013('0xc'),auth[_0x3013('0x9')](),controller[_0x3013('0x1d')]);router['delete']('/:id',auth[_0x3013('0x9')](),controller[_0x3013('0x1e')]);router[_0x3013('0x1f')](_0x3013('0xe'),auth[_0x3013('0x9')](),controller[_0x3013('0x20')]);router[_0x3013('0x1f')]('/:id/canned_answers',auth[_0x3013('0x9')](),controller[_0x3013('0x21')]);router[_0x3013('0x1f')](_0x3013('0x12'),auth[_0x3013('0x9')](),controller[_0x3013('0x22')]);module[_0x3013('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index f886e3a..92d1e7a 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 _0x873f=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','sequelize','exports','STRING','name','generate','TEXT'];(function(_0x37d7e4,_0x2806bf){var _0x568c8b=function(_0x3432e7){while(--_0x3432e7){_0x37d7e4['push'](_0x37d7e4['shift']());}};_0x568c8b(++_0x2806bf);}(_0x873f,0x139));var _0xf873=function(_0x4b2a56,_0x3f2880){_0x4b2a56=_0x4b2a56-0x0;var _0x4c3038=_0x873f[_0x4b2a56];return _0x4c3038;};'use strict';var Sequelize=require(_0xf873('0x0'));var rs=require('randomstring');module[_0xf873('0x1')]={'name':{'type':Sequelize[_0xf873('0x2')],'unique':_0xf873('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xf873('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf873('0x4')]();}},'replyUri':{'type':Sequelize[_0xf873('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf873('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf873('0x5')],'defaultValue':function(){return _0xf873('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf873('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf873('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf873('0x2')]},'queueTransfer':{'type':Sequelize[_0xf873('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf873('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf873('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf873('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xf873('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xf873('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1dbcff){if(!_0x1dbcff)this['setDataValue'](_0xf873('0xa'),null);this['setDataValue']('mandatoryDisposition',_0x1dbcff);}}}; \ No newline at end of file +var _0xcd42=['exports','STRING','generate','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xcd42,0x153));var _0x2cd4=function(_0x3f962e,_0x65b7c3){_0x3f962e=_0x3f962e-0x0;var _0xc0fb70=_0xcd42[_0x3f962e];return _0xc0fb70;};'use strict';var Sequelize=require(_0x2cd4('0x0'));var rs=require(_0x2cd4('0x1'));module[_0x2cd4('0x2')]={'name':{'type':Sequelize[_0x2cd4('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x2cd4('0x3')]},'token':{'type':Sequelize[_0x2cd4('0x3')],'defaultValue':function(){return rs[_0x2cd4('0x4')]();}},'replyUri':{'type':Sequelize[_0x2cd4('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2cd4('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x2cd4('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2cd4('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2cd4('0x3')]},'queueTransfer':{'type':Sequelize[_0x2cd4('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2cd4('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2cd4('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2cd4('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x2cd4('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x2cd4('0x5')],'defaultValue':![],'comment':_0x2cd4('0x8'),'set':function(_0x5e451b){if(!_0x5e451b)this['setDataValue'](_0x2cd4('0x9'),null);this['setDataValue'](_0x2cd4('0xa'),_0x5e451b);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 3ad5367..ec835f7 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 _0x9181=['getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','then','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','OpenchannelAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','OpenchannelAccount','findAll','show','params','include','options','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','rows','removeAnswers','notify','CmContact','ValidationError','difference','createdAt','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','updatedAt','DESC','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','EventManager','addApplications','transaction','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','userOpenchannelAccount:remove'];(function(_0x1f3d3f,_0x582dbb){var _0xcee75d=function(_0x5e12d1){while(--_0x5e12d1){_0x1f3d3f['push'](_0x1f3d3f['shift']());}};_0xcee75d(++_0x582dbb);}(_0x9181,0x182));var _0x1918=function(_0x55900c,_0x11ccee){_0x55900c=_0x55900c-0x0;var _0x199266=_0x9181[_0x55900c];return _0x199266;};'use strict';var emlformat=require(_0x1918('0x0'));var rimraf=require(_0x1918('0x1'));var zipdir=require(_0x1918('0x2'));var jsonpatch=require(_0x1918('0x3'));var rp=require(_0x1918('0x4'));var moment=require('moment');var BPromise=require(_0x1918('0x5'));var Mustache=require('mustache');var util=require(_0x1918('0x6'));var path=require(_0x1918('0x7'));var sox=require(_0x1918('0x8'));var csv=require(_0x1918('0x9'));var ejs=require(_0x1918('0xa'));var fs=require('fs');var fs_extra=require(_0x1918('0xb'));var _=require('lodash');var squel=require(_0x1918('0xc'));var crypto=require('crypto');var jsforce=require(_0x1918('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1918('0x9'));var querystring=require(_0x1918('0xe'));var Papa=require(_0x1918('0xf'));var Redis=require(_0x1918('0x10'));var authService=require(_0x1918('0x11'));var qs=require(_0x1918('0x12'));var as=require(_0x1918('0x13'));var hardwareService=require(_0x1918('0x14'));var logger=require(_0x1918('0x15'))(_0x1918('0x16'));var utils=require(_0x1918('0x17'));var config=require(_0x1918('0x18'));var licenseUtil=require(_0x1918('0x19'));var db=require('../../mysqldb')['db'];config[_0x1918('0x1a')]=_[_0x1918('0x1b')](config[_0x1918('0x1a')],{'host':_0x1918('0x1c'),'port':0x18eb});var socket=require(_0x1918('0x1d'))(new Redis(config[_0x1918('0x1a')]));require(_0x1918('0x1e'))['register'](socket);var jayson=require(_0x1918('0x1f'));var client=jayson[_0x1918('0x20')][_0x1918('0x21')]({'port':0x232c});var client9002=jayson[_0x1918('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dafec,_0x4947b5,_0x193305,_0x844035){return new BPromise(function(_0x303245,_0x5845c4){var _0x52087d=_0x844035||client;return _0x52087d['request'](_0x5dafec,_0x193305)[_0x1918('0x22')](function(_0x3df504){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4947b5,'request\x20sent');logger[_0x1918('0x23')](_0x1918('0x24'),_0x4947b5,_0x1918('0x25'),JSON['stringify'](_0x3df504));if(_0x3df504[_0x1918('0x26')]){if(_0x3df504[_0x1918('0x26')][_0x1918('0x27')]===0x1f4){logger[_0x1918('0x26')](_0x1918('0x28'),_0x4947b5,_0x3df504[_0x1918('0x26')][_0x1918('0x29')]);return _0x5845c4(_0x3df504['error'][_0x1918('0x29')]);}logger[_0x1918('0x26')](_0x1918('0x28'),_0x4947b5,_0x3df504[_0x1918('0x26')][_0x1918('0x29')]);return _0x303245(_0x3df504['error'][_0x1918('0x29')]);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4947b5,'request\x20sent');_0x303245(_0x3df504[_0x1918('0x2a')][_0x1918('0x29')]);}})[_0x1918('0x2b')](function(_0x3e0532){logger[_0x1918('0x26')](_0x1918('0x28'),_0x4947b5,_0x3e0532);_0x5845c4(_0x3e0532);});});}function respondWithStatusCode(_0x1d1dac,_0x132403){_0x132403=_0x132403||0xcc;return function(_0x139127){if(_0x139127){return _0x1d1dac[_0x1918('0x2c')](_0x132403);}return _0x1d1dac[_0x1918('0x2d')](_0x132403)[_0x1918('0x2e')]();};}function respondWithResult(_0x25d433,_0x58e227){_0x58e227=_0x58e227||0xc8;return function(_0xf693da){if(_0xf693da){return _0x25d433['status'](_0x58e227)[_0x1918('0x2f')](_0xf693da);}};}function respondWithFilteredResult(_0x1689ce,_0x5b8f9c){return function(_0x8ca18b){if(_0x8ca18b){var _0x32dd3b=typeof _0x5b8f9c[_0x1918('0x30')]===_0x1918('0x31')&&typeof _0x5b8f9c[_0x1918('0x32')]===_0x1918('0x31');var _0x4adba0=_0x8ca18b[_0x1918('0x33')];var _0x45d480=_0x32dd3b?0x0:_0x5b8f9c[_0x1918('0x30')];var _0x4a6c88=_0x32dd3b?_0x8ca18b[_0x1918('0x33')]:_0x5b8f9c[_0x1918('0x30')]+_0x5b8f9c[_0x1918('0x32')];var _0x440389;if(_0x4a6c88>=_0x4adba0){_0x4a6c88=_0x4adba0;_0x440389=0xc8;}else{_0x440389=0xce;}_0x1689ce[_0x1918('0x2d')](_0x440389);return _0x1689ce[_0x1918('0x34')](_0x1918('0x35'),_0x45d480+'-'+_0x4a6c88+'/'+_0x4adba0)[_0x1918('0x2f')](_0x8ca18b);}return null;};}function patchUpdates(_0x1a8103){return function(_0x517821){try{jsonpatch[_0x1918('0x36')](_0x517821,_0x1a8103,!![]);}catch(_0xbfda0){return BPromise['reject'](_0xbfda0);}return _0x517821[_0x1918('0x37')]();};}function saveUpdates(_0x78acf4,_0x2ff358){return function(_0xf4165c){if(_0xf4165c){return _0xf4165c['update'](_0x78acf4)[_0x1918('0x22')](function(_0x1b0e90){return _0x1b0e90;});}return null;};}function removeEntity(_0x43c040,_0x42432f){return function(_0x3bc774){if(_0x3bc774){return _0x3bc774[_0x1918('0x38')]()[_0x1918('0x22')](function(){var _0x2a42cb=_0x3bc774[_0x1918('0x39')]({'plain':!![]});var _0x2aa40d=_0x1918('0x3a');return db['UserProfileResource'][_0x1918('0x38')]({'where':{'type':_0x2aa40d,'resourceId':_0x2a42cb['id']}})[_0x1918('0x22')](function(){return _0x3bc774;});})[_0x1918('0x22')](function(){_0x43c040[_0x1918('0x2d')](0xcc)[_0x1918('0x2e')]();});}};}function handleEntityNotFound(_0x3ca167,_0x1ad6a1){return function(_0xad54b8){if(!_0xad54b8){_0x3ca167[_0x1918('0x2c')](0x194);}return _0xad54b8;};}function handleError(_0x337ed7,_0x35a69b){_0x35a69b=_0x35a69b||0x1f4;return function(_0x236efb){logger[_0x1918('0x26')](_0x236efb[_0x1918('0x3b')]);if(_0x236efb[_0x1918('0x3c')]){delete _0x236efb[_0x1918('0x3c')];}_0x337ed7['status'](_0x35a69b)[_0x1918('0x3d')](_0x236efb);};}exports['index']=function(_0x27834e,_0xc9a3dc){var _0x2ecf33={'include':[{'model':db[_0x1918('0x3e')],'as':_0x1918('0x3f')}]},_0x218c37={},_0x42b55c={'count':0x0,'rows':[]};var _0x11d6de=_[_0x1918('0x40')](db['OpenchannelAccount'][_0x1918('0x41')],function(_0x5e4634){return{'name':_0x5e4634[_0x1918('0x42')],'type':_0x5e4634[_0x1918('0x43')]['key']};});_0x218c37['model']=_['map'](_0x11d6de,_0x1918('0x3c'));_0x218c37[_0x1918('0x44')]=_[_0x1918('0x45')](_0x27834e['query']);_0x218c37[_0x1918('0x46')]=_[_0x1918('0x47')](_0x218c37[_0x1918('0x48')],_0x218c37[_0x1918('0x44')]);_0x2ecf33['attributes']=_[_0x1918('0x47')](_0x218c37['model'],qs['fields'](_0x27834e[_0x1918('0x44')][_0x1918('0x49')]));_0x2ecf33['attributes']=_0x2ecf33[_0x1918('0x4a')][_0x1918('0x4b')]?_0x2ecf33[_0x1918('0x4a')]:_0x218c37[_0x1918('0x48')];if(!_0x27834e[_0x1918('0x44')][_0x1918('0x4c')](_0x1918('0x4d'))){_0x2ecf33['limit']=qs[_0x1918('0x32')](_0x27834e[_0x1918('0x44')]['limit']);_0x2ecf33['offset']=qs[_0x1918('0x30')](_0x27834e[_0x1918('0x44')][_0x1918('0x30')]);}_0x2ecf33[_0x1918('0x4e')]=qs[_0x1918('0x4f')](_0x27834e[_0x1918('0x44')][_0x1918('0x4f')]);_0x2ecf33[_0x1918('0x50')]=qs[_0x1918('0x46')](_[_0x1918('0x51')](_0x27834e[_0x1918('0x44')],_0x218c37[_0x1918('0x46')]),_0x11d6de);if(_0x27834e[_0x1918('0x44')][_0x1918('0x52')]){_0x2ecf33[_0x1918('0x50')]=_['merge'](_0x2ecf33[_0x1918('0x50')],{'$or':_[_0x1918('0x40')](_0x11d6de,function(_0x100d1e){if(_0x100d1e[_0x1918('0x43')]!==_0x1918('0x53')){var _0x5ea587={};_0x5ea587[_0x100d1e[_0x1918('0x3c')]]={'$like':'%'+_0x27834e['query'][_0x1918('0x52')]+'%'};return _0x5ea587;}})});}_0x2ecf33=_[_0x1918('0x54')]({},_0x2ecf33,_0x27834e['options']);var _0x301c1e={'where':_0x2ecf33['where']};return db['OpenchannelAccount'][_0x1918('0x33')](_0x301c1e)[_0x1918('0x22')](function(_0x21bd6b){_0x42b55c['count']=_0x21bd6b;if(_0x27834e[_0x1918('0x44')][_0x1918('0x55')]){_0x2ecf33['include']=[{'all':!![]}];}return db[_0x1918('0x56')][_0x1918('0x57')](_0x2ecf33);})['then'](function(_0x37cd84){_0x42b55c['rows']=_0x37cd84;return _0x42b55c;})['then'](respondWithFilteredResult(_0xc9a3dc,_0x2ecf33))['catch'](handleError(_0xc9a3dc,null));};exports[_0x1918('0x58')]=function(_0x15c73a,_0x47e389){var _0x86e250={'raw':![],'where':{'id':_0x15c73a[_0x1918('0x59')]['id']},'include':[{'model':db[_0x1918('0x3e')],'as':_0x1918('0x3f')}]},_0x1bbe4e={};_0x1bbe4e['model']=_[_0x1918('0x45')](db[_0x1918('0x56')][_0x1918('0x41')]);_0x1bbe4e[_0x1918('0x44')]=_[_0x1918('0x45')](_0x15c73a[_0x1918('0x44')]);_0x1bbe4e[_0x1918('0x46')]=_[_0x1918('0x47')](_0x1bbe4e[_0x1918('0x48')],_0x1bbe4e[_0x1918('0x44')]);_0x86e250['attributes']=_['intersection'](_0x1bbe4e['model'],qs[_0x1918('0x49')](_0x15c73a[_0x1918('0x44')][_0x1918('0x49')]));_0x86e250[_0x1918('0x4a')]=_0x86e250[_0x1918('0x4a')][_0x1918('0x4b')]?_0x86e250[_0x1918('0x4a')]:_0x1bbe4e[_0x1918('0x48')];if(_0x15c73a[_0x1918('0x44')]['includeAll']){_0x86e250[_0x1918('0x5a')]=[{'all':!![]}];}_0x86e250=_[_0x1918('0x54')]({},_0x86e250,_0x15c73a[_0x1918('0x5b')]);return db['OpenchannelAccount']['find'](_0x86e250)[_0x1918('0x22')](handleEntityNotFound(_0x47e389,null))[_0x1918('0x22')](respondWithResult(_0x47e389,null))[_0x1918('0x2b')](handleError(_0x47e389,null));};exports['create']=function(_0x2b66e9,_0x24357f){return db[_0x1918('0x56')][_0x1918('0x5c')](_0x2b66e9[_0x1918('0x5d')],{})[_0x1918('0x22')](function(_0x1766f6){var _0x21f0bc=_0x2b66e9['user']['get']({'plain':!![]});if(!_0x21f0bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x21f0bc['role']===_0x1918('0x5e')){var _0xda0b31=_0x1766f6[_0x1918('0x39')]({'plain':!![]});var _0x2bed28='OpenchannelAccounts';return db[_0x1918('0x5f')][_0x1918('0x60')]({'where':{'name':_0x2bed28,'userProfileId':_0x21f0bc[_0x1918('0x61')]},'raw':!![]})[_0x1918('0x22')](function(_0x6dff2){if(_0x6dff2&&_0x6dff2[_0x1918('0x62')]===0x0){return db[_0x1918('0x63')][_0x1918('0x5c')]({'name':_0xda0b31[_0x1918('0x3c')],'resourceId':_0xda0b31['id'],'type':_0x6dff2['name'],'sectionId':_0x6dff2['id']},{})[_0x1918('0x22')](function(){return _0x1766f6;});}else{return _0x1766f6;}})[_0x1918('0x2b')](function(_0x2b8ab2){logger['error'](_0x1918('0x64'),_0x2b8ab2);throw _0x2b8ab2;});}return _0x1766f6;})['then'](respondWithResult(_0x24357f,0xc9))['catch'](handleError(_0x24357f,null));};exports[_0x1918('0x65')]=function(_0x14026f,_0x2b6381){if(_0x14026f[_0x1918('0x5d')]['id']){delete _0x14026f[_0x1918('0x5d')]['id'];}return db['OpenchannelAccount'][_0x1918('0x60')]({'where':{'id':_0x14026f[_0x1918('0x59')]['id']},'include':[{'model':db[_0x1918('0x3e')],'as':_0x1918('0x3f')}]})['then'](handleEntityNotFound(_0x2b6381,null))[_0x1918('0x22')](saveUpdates(_0x14026f[_0x1918('0x5d')],null))[_0x1918('0x22')](respondWithResult(_0x2b6381,null))[_0x1918('0x2b')](handleError(_0x2b6381,null));};exports[_0x1918('0x38')]=function(_0x52c155,_0x576ca3){return db['OpenchannelAccount'][_0x1918('0x60')]({'where':{'id':_0x52c155[_0x1918('0x59')]['id']}})['then'](handleEntityNotFound(_0x576ca3,null))[_0x1918('0x22')](removeEntity(_0x576ca3,null))['catch'](handleError(_0x576ca3,null));};exports[_0x1918('0x66')]=function(_0x4c1ac3,_0x549137){return db['OpenchannelAccount'][_0x1918('0x66')]()[_0x1918('0x22')](respondWithResult(_0x549137,null))[_0x1918('0x2b')](handleError(_0x549137,null));};exports[_0x1918('0x67')]=function(_0x58215e,_0xf4549e,_0x85a2a4){if(_0x58215e[_0x1918('0x5d')]['id']){delete _0x58215e[_0x1918('0x5d')]['id'];}return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x58215e[_0x1918('0x59')]['id']}})['then'](handleEntityNotFound(_0xf4549e,null))['then'](function(_0x13eccd){if(_0x13eccd){_0x58215e[_0x1918('0x5d')]['OpenchannelAccountId']=_0x13eccd['id'];return db['Disposition'][_0x1918('0x5c')](_0x58215e[_0x1918('0x5d')]);}})[_0x1918('0x22')](respondWithResult(_0xf4549e,null))['catch'](handleError(_0xf4549e,null));};exports[_0x1918('0x68')]=function(_0x1c6574,_0x2e2a99,_0x36efc9){var _0x1c1c3f={'raw':![],'where':{}};var _0x43a37f={};var _0xeaa9ad={'count':0x0,'rows':[]};return db[_0x1918('0x56')][_0x1918('0x69')]({'where':{'id':_0x1c6574[_0x1918('0x59')]['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x2e2a99,null))[_0x1918('0x22')](function(_0x54d21d){if(_0x54d21d){_0x43a37f[_0x1918('0x48')]=_[_0x1918('0x45')](db[_0x1918('0x6a')][_0x1918('0x41')]);_0x43a37f[_0x1918('0x44')]=_[_0x1918('0x45')](_0x1c6574[_0x1918('0x44')]);_0x43a37f['filters']=_[_0x1918('0x47')](_0x43a37f[_0x1918('0x48')],_0x43a37f[_0x1918('0x44')]);_0x1c1c3f[_0x1918('0x4a')]=_[_0x1918('0x47')](_0x43a37f[_0x1918('0x48')],qs[_0x1918('0x49')](_0x1c6574[_0x1918('0x44')][_0x1918('0x49')]));_0x1c1c3f[_0x1918('0x4a')]=_0x1c1c3f[_0x1918('0x4a')][_0x1918('0x4b')]?_0x1c1c3f['attributes']:_0x43a37f[_0x1918('0x48')];if(!_0x1c6574[_0x1918('0x44')][_0x1918('0x4c')](_0x1918('0x4d'))){_0x1c1c3f[_0x1918('0x32')]=qs[_0x1918('0x32')](_0x1c6574[_0x1918('0x44')]['limit']);_0x1c1c3f[_0x1918('0x30')]=qs[_0x1918('0x30')](_0x1c6574['query']['offset']);}_0x1c1c3f['order']=qs[_0x1918('0x4f')](_0x1c6574[_0x1918('0x44')]['sort']);_0x1c1c3f[_0x1918('0x50')]=qs[_0x1918('0x46')](_[_0x1918('0x51')](_0x1c6574[_0x1918('0x44')],_0x43a37f[_0x1918('0x46')]));_0x1c1c3f['where']['OpenchannelAccountId']=_0x54d21d['id'];if(_0x1c6574[_0x1918('0x44')]['filter']){_0x1c1c3f[_0x1918('0x50')]=_[_0x1918('0x54')](_0x1c1c3f['where'],{'$or':_[_0x1918('0x40')](_0x1c1c3f[_0x1918('0x4a')],function(_0x9bfcc5){var _0x4af053={};_0x4af053[_0x9bfcc5]={'$like':'%'+_0x1c6574[_0x1918('0x44')]['filter']+'%'};return _0x4af053;})});}_0x1c1c3f=_[_0x1918('0x54')]({},_0x1c1c3f,_0x1c6574[_0x1918('0x5b')]);return db[_0x1918('0x6a')]['count']({'where':_0x1c1c3f[_0x1918('0x50')]})[_0x1918('0x22')](function(_0x2768f5){_0xeaa9ad[_0x1918('0x33')]=_0x2768f5;if(_0x1c6574[_0x1918('0x44')][_0x1918('0x55')]){_0x1c1c3f[_0x1918('0x5a')]=[{'all':!![]}];}return db[_0x1918('0x6a')][_0x1918('0x57')](_0x1c1c3f);})['then'](function(_0x5097e6){_0xeaa9ad['rows']=_0x5097e6;return _0xeaa9ad;});}})[_0x1918('0x22')](respondWithFilteredResult(_0x2e2a99,_0x1c1c3f))[_0x1918('0x2b')](handleError(_0x2e2a99,null));};exports['removeDispositions']=function(_0x455b0f,_0x2afe9d,_0x340a41){return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x455b0f['params']['id']}})['then'](handleEntityNotFound(_0x2afe9d,null))['then'](function(_0x406d7a){if(_0x406d7a){return _0x406d7a[_0x1918('0x6b')](_0x455b0f[_0x1918('0x44')][_0x1918('0x6c')]);}})['then'](respondWithStatusCode(_0x2afe9d,null))[_0x1918('0x2b')](handleError(_0x2afe9d,null));};exports[_0x1918('0x6d')]=function(_0x38ed0c,_0x1b1404,_0x2af9dd){if(_0x38ed0c[_0x1918('0x5d')]['id']){delete _0x38ed0c[_0x1918('0x5d')]['id'];}return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x38ed0c[_0x1918('0x59')]['id']}})['then'](handleEntityNotFound(_0x1b1404,null))[_0x1918('0x22')](function(_0x3b5549){if(_0x3b5549){_0x38ed0c[_0x1918('0x5d')][_0x1918('0x6e')]=_0x3b5549['id'];return db[_0x1918('0x6f')][_0x1918('0x5c')](_0x38ed0c['body']);}})[_0x1918('0x22')](respondWithResult(_0x1b1404,null))[_0x1918('0x2b')](handleError(_0x1b1404,null));};exports[_0x1918('0x70')]=function(_0x1076ea,_0x5e5856,_0x4fa8bc){var _0x1338cc={'raw':![],'where':{}};var _0x5aa21f={};var _0x4b97de={'count':0x0,'rows':[]};return db[_0x1918('0x56')][_0x1918('0x69')]({'where':{'id':_0x1076ea['params']['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x5e5856,null))[_0x1918('0x22')](function(_0x58d9ac){if(_0x58d9ac){_0x5aa21f[_0x1918('0x48')]=_[_0x1918('0x45')](db[_0x1918('0x6f')][_0x1918('0x41')]);_0x5aa21f[_0x1918('0x44')]=_[_0x1918('0x45')](_0x1076ea[_0x1918('0x44')]);_0x5aa21f[_0x1918('0x46')]=_['intersection'](_0x5aa21f[_0x1918('0x48')],_0x5aa21f[_0x1918('0x44')]);_0x1338cc['attributes']=_[_0x1918('0x47')](_0x5aa21f[_0x1918('0x48')],qs[_0x1918('0x49')](_0x1076ea[_0x1918('0x44')][_0x1918('0x49')]));_0x1338cc[_0x1918('0x4a')]=_0x1338cc[_0x1918('0x4a')][_0x1918('0x4b')]?_0x1338cc['attributes']:_0x5aa21f[_0x1918('0x48')];if(!_0x1076ea[_0x1918('0x44')][_0x1918('0x4c')]('nolimit')){_0x1338cc['limit']=qs[_0x1918('0x32')](_0x1076ea[_0x1918('0x44')][_0x1918('0x32')]);_0x1338cc[_0x1918('0x30')]=qs['offset'](_0x1076ea[_0x1918('0x44')][_0x1918('0x30')]);}_0x1338cc['order']=qs[_0x1918('0x4f')](_0x1076ea[_0x1918('0x44')][_0x1918('0x4f')]);_0x1338cc['where']=qs['filters'](_[_0x1918('0x51')](_0x1076ea['query'],_0x5aa21f[_0x1918('0x46')]));_0x1338cc[_0x1918('0x50')][_0x1918('0x6e')]=_0x58d9ac['id'];if(_0x1076ea[_0x1918('0x44')][_0x1918('0x52')]){_0x1338cc[_0x1918('0x50')]=_[_0x1918('0x54')](_0x1338cc[_0x1918('0x50')],{'$or':_[_0x1918('0x40')](_0x1338cc[_0x1918('0x4a')],function(_0x105c73){var _0x504560={};_0x504560[_0x105c73]={'$like':'%'+_0x1076ea[_0x1918('0x44')]['filter']+'%'};return _0x504560;})});}_0x1338cc=_['merge']({},_0x1338cc,_0x1076ea['options']);return db[_0x1918('0x6f')][_0x1918('0x33')]({'where':_0x1338cc[_0x1918('0x50')]})[_0x1918('0x22')](function(_0x107b93){_0x4b97de[_0x1918('0x33')]=_0x107b93;if(_0x1076ea[_0x1918('0x44')][_0x1918('0x55')]){_0x1338cc['include']=[{'all':!![]}];}return db[_0x1918('0x6f')]['findAll'](_0x1338cc);})[_0x1918('0x22')](function(_0x1c5999){_0x4b97de[_0x1918('0x71')]=_0x1c5999;return _0x4b97de;});}})[_0x1918('0x22')](respondWithFilteredResult(_0x5e5856,_0x1338cc))['catch'](handleError(_0x5e5856,null));};exports[_0x1918('0x72')]=function(_0x4ecfec,_0x5dad23,_0x47473f){return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x4ecfec['params']['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x5dad23,null))[_0x1918('0x22')](function(_0x5da75e){if(_0x5da75e){return _0x5da75e[_0x1918('0x72')](_0x4ecfec['query'][_0x1918('0x6c')]);}})[_0x1918('0x22')](respondWithStatusCode(_0x5dad23,null))[_0x1918('0x2b')](handleError(_0x5dad23,null));};exports[_0x1918('0x73')]=function(_0x1fd4a1,_0xf2c354,_0x55c2fa){var _0xeb2913={'body':_0x1fd4a1[_0x1918('0x5d')],'channel':'openchannel'};var _0x22970c=[];var _0x547af1=[];var _0x48c214={};var _0x2d6f40=![];return db[_0x1918('0x74')][_0x1918('0x66')]()[_0x1918('0x22')](function(_0x4da92c){if(!_0x4da92c){throw new db['Sequelize'][(_0x1918('0x75'))]('no\x20available\x20attributes');}_0x22970c=_[_0x1918('0x76')](_[_0x1918('0x45')](_0x4da92c),[_0x1918('0x77'),'updatedAt']);_0x547af1=_[_0x1918('0x76')](_[_0x1918('0x45')](_0x4da92c),[_0x1918('0x77'),'updatedAt','CompanyId',_0x1918('0x78')]);if(_0x1fd4a1[_0x1918('0x5d')]['id']){delete _0x1fd4a1[_0x1918('0x5d')]['id'];}if(_[_0x1918('0x79')](_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x7a')])){throw new db[(_0x1918('0x7b'))][(_0x1918('0x75'))](_0x1918('0x7c'));}if(_['isNil'](_0x1fd4a1[_0x1918('0x5d')]['body'])||_0x1fd4a1[_0x1918('0x5d')]['body']===''){throw new db[(_0x1918('0x7b'))][(_0x1918('0x75'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x1918('0x79')](_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x7d')])){throw new db[(_0x1918('0x7b'))][(_0x1918('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x547af1);}if(!_[_0x1918('0x7e')](_0x547af1,_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x7d')])){throw new db[(_0x1918('0x7b'))][(_0x1918('0x75'))](_0x1918('0x7f')+_0x547af1);}_0x48c214[_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x7d')]]=_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x7a')];})['then'](function(){return db[_0x1918('0x56')]['find']({'where':{'id':_0x1fd4a1['params']['id']},'include':[{'model':db[_0x1918('0x80')],'as':_0x1918('0x81'),'include':[{'model':db[_0x1918('0x74')],'as':'Contacts','where':_0x48c214,'limit':0x1,'order':[[_0x1918('0x82'),_0x1918('0x83')]]}]},{'model':db[_0x1918('0x84')],'as':_0x1918('0x85')}]});})[_0x1918('0x22')](handleEntityNotFound(_0xf2c354,null))[_0x1918('0x22')](function(_0x3798b4){if(_0x3798b4&&_0x3798b4[_0x1918('0x81')]){_0xeb2913[_0x1918('0x86')]=_0x3798b4;_0xeb2913[_0x1918('0x87')]=_0x3798b4['Applications'];_0xeb2913[_0x1918('0x88')]=_0x3798b4[_0x1918('0x81')];_0xeb2913[_0x1918('0x87')]=_[_0x1918('0x89')](_0xeb2913[_0x1918('0x87')],[_0x1918('0x8a')],[_0x1918('0x8b')]);if(_0xeb2913[_0x1918('0x86')][_0x1918('0x85')]){delete _0xeb2913['account']['Applications'];}if(_0xeb2913['account'][_0x1918('0x81')]&&_0xeb2913['account']['List'][_0x1918('0x8c')][_0x1918('0x4b')]){return _0xeb2913[_0x1918('0x86')][_0x1918('0x81')][_0x1918('0x8c')][0x0];}var _0xb73c29=_[_0x1918('0x1b')](_0x1fd4a1['body'],{'firstName':_0x1fd4a1['body'][_0x1918('0x7a')],'ListId':_0x3798b4['ListId']});_0xb73c29[_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x7d')]]=_0x1fd4a1[_0x1918('0x5d')]['from'];return db[_0x1918('0x74')][_0x1918('0x5c')](_0xb73c29,{'fields':_0x22970c,'raw':!![]});}})['then'](handleEntityNotFound(_0xf2c354,null))[_0x1918('0x22')](function(_0x51de75){_0xeb2913[_0x1918('0x8d')]=_0x51de75;if(_0x51de75){var _0x541488={'ContactId':_0x51de75['id'],'OpenchannelAccountId':_0x1fd4a1['params']['id'],'from':(_0x51de75[_0x1918('0x8e')]||'')+'\x20'+(_0x51de75['lastName']||'')};var _0x5a9ff7={'OpenchannelAccountId':_0x1fd4a1[_0x1918('0x59')]['id'],'closed':![]};if(_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x8f')]){_0x5a9ff7[_0x1918('0x8f')]=_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x8f')];return db[_0x1918('0x90')][_0x1918('0x60')]({'where':_0x5a9ff7})[_0x1918('0x22')](function(_0x2a9f24){if(_0x2a9f24){return[_0x2a9f24,![]];}_0x541488[_0x1918('0x8f')]=_0x1fd4a1['body']['threadId'];_0x541488[_0x1918('0x91')]=_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x91')];return db[_0x1918('0x90')][_0x1918('0x5c')](_0x541488)[_0x1918('0x22')](function(_0x20f0a0){return[_0x20f0a0,!![]];});});}else{_0x5a9ff7[_0x1918('0x8f')]=null;}_0x5a9ff7['ContactId']=_0x51de75['id'];return db['OpenchannelInteraction'][_0x1918('0x60')]({'where':_0x5a9ff7})[_0x1918('0x22')](function(_0x411e5a){if(_0x411e5a){return[_0x411e5a,![]];}return db[_0x1918('0x90')]['create'](_0x541488)['then'](function(_0x427810){return[_0x427810,!![]];});});}})['spread'](function(_0x38e523,_0x4d4d59){if(_0x38e523){_0x2d6f40=_0x4d4d59;if(!_0x4d4d59){var _0x2f88b7={'from':(_0xeb2913[_0x1918('0x8d')][_0x1918('0x8e')]||'')+'\x20'+(_0xeb2913[_0x1918('0x8d')][_0x1918('0x92')]||'')};if(_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x8f')]&&_0x1fd4a1[_0x1918('0x5d')]['messageId']&&_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x8f')]!=_0x1fd4a1[_0x1918('0x5d')]['messageId']){_0x2f88b7[_0x1918('0x8f')]=_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x93')];}return _0x38e523[_0x1918('0x65')](_0x2f88b7);}else{return _0x38e523;}}})[_0x1918('0x22')](function(_0x3fbbed){_0xeb2913['interaction']=_0x3fbbed[_0x1918('0x39')]({'plain':!![]});_0xeb2913[_0x1918('0x94')]['created']=_0x2d6f40;if(_0xeb2913[_0x1918('0x94')][_0x1918('0x95')]){if(_0xeb2913['account'][_0x1918('0x96')]){_0xeb2913['applications'][_0x1918('0x97')]({'id':0x0,'priority':_0xeb2913[_0x1918('0x87')][_0x1918('0x4b')]+0x1,'app':_0x1918('0x98'),'appdata':_0x1918('0x99'),'interval':_0x1918('0x9a')});}}return db[_0x1918('0x9b')][_0x1918('0x5c')]({'body':_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x5d')],'OpenchannelAccountId':_0x1fd4a1[_0x1918('0x59')]['id'],'OpenchannelInteractionId':_0x3fbbed['id'],'direction':'in','ContactId':_0xeb2913['contact']['id'],'AttachmentId':_0x1fd4a1[_0x1918('0x5d')][_0x1918('0x9c')]});})['then'](function(_0x3608d3){_0xeb2913[_0x1918('0x29')]=_0x3608d3;if(_0xeb2913[_0x1918('0x94')][_0x1918('0x9d')]){return db[_0x1918('0x9e')][_0x1918('0x60')]({'attributes':['id','name'],'where':{'id':_0xeb2913['interaction'][_0x1918('0x9d')]}})[_0x1918('0x22')](function(_0x338a31){if(_0x338a31){_0xeb2913[_0x1918('0x87')][_0x1918('0x9f')]({'id':0x0,'priority':0x0,'app':_0x1918('0xa0'),'appdata':_0x338a31['name']+','+(_0xeb2913[_0x1918('0x86')][_0x1918('0xa1')]||0xa),'interval':'*,*,*,*'});_0xeb2913['forcedOwnership']=![];}return respondWithRpcPromise(_0x1918('0xa2'),'startRouting',_0xeb2913);});}return respondWithRpcPromise(_0x1918('0xa2'),'startRouting',_0xeb2913);})['then'](function(_0x50b2eb){respondWithRpcPromise(_0x1918('0xa3'),_0x1918('0xa3'),{'event':_0x1918('0x73'),'message':_0x50b2eb},client9002);return _0x50b2eb;})[_0x1918('0x22')](respondWithResult(_0xf2c354,null))[_0x1918('0x2b')](handleError(_0xf2c354,null));};exports[_0x1918('0xa4')]=function(_0x2f8b33,_0x4061f3){var _0x9330af=_0x2f8b33['params']['id'];var _0x366573=_0x2f8b33[_0x1918('0x5d')];var _0x41fa09=0xc8;var _0x594d40=null;return db['sequelize'][_0x1918('0xa5')]({'isolationLevel':db['sequelize'][_0x1918('0xa6')][_0x1918('0xa7')]['READ_COMMITTED']},function(_0x1aa777){return db[_0x1918('0x56')][_0x1918('0x69')]({'where':{'id':_0x9330af},'transaction':_0x1aa777})[_0x1918('0x22')](function(_0x458e64){if(_0x458e64){return db[_0x1918('0x84')]['destroy']({'where':{'OpenchannelAccountId':_0x9330af},'transaction':_0x1aa777})['then'](function(){var _0x387e3c=_[_0x1918('0x40')](_0x366573,function(_0x839993){_0x839993['OpenchannelAccountId']=_0x9330af;return _0x839993;});return db[_0x1918('0x84')][_0x1918('0xa8')](_0x387e3c,{'transaction':_0x1aa777});});}else{_0x41fa09=0x194;_0x594d40=[];}});})[_0x1918('0x22')](function(){if(_0x41fa09!==0x194){return db['OpenchannelApplication'][_0x1918('0xa9')]({'where':{'OpenchannelAccountId':_0x9330af},'order':_0x1918('0x8a')})['then'](function(_0x36d6fe){_0x594d40=_0x36d6fe;});}})[_0x1918('0x2b')](function(_0x54517f){_0x41fa09=0x1f4;logger[_0x1918('0x26')](_0x54517f[_0x1918('0x3b')]);if(_0x54517f[_0x1918('0x3c')]){delete _0x54517f[_0x1918('0x3c')];}_0x594d40=_0x54517f;})[_0x1918('0xaa')](function(){if(_0x594d40===null){_0x4061f3['sendStatus'](_0x41fa09);}else{if(_0x41fa09===0x1f4){_0x4061f3[_0x1918('0x2d')](_0x41fa09)[_0x1918('0x3d')](_0x594d40);}else{_0x4061f3[_0x1918('0x2d')](_0x41fa09)[_0x1918('0x2f')](_0x594d40);}}});};exports[_0x1918('0xab')]=function(_0x32f1fb,_0x19fada,_0x22cb24){var _0x408273={};var _0x13bfd7={};var _0x1a896e;var _0x2c1ad0;return db['OpenchannelAccount'][_0x1918('0x69')]({'where':{'id':_0x32f1fb[_0x1918('0x59')]['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x19fada,null))[_0x1918('0x22')](function(_0x4cc954){if(_0x4cc954){_0x1a896e=_0x4cc954;_0x13bfd7[_0x1918('0x48')]=_[_0x1918('0x45')](db['OpenchannelApplication']['rawAttributes']);_0x13bfd7[_0x1918('0x44')]=_[_0x1918('0x45')](_0x32f1fb[_0x1918('0x44')]);_0x13bfd7[_0x1918('0x46')]=_[_0x1918('0x47')](_0x13bfd7[_0x1918('0x48')],_0x13bfd7[_0x1918('0x44')]);_0x408273['attributes']=_[_0x1918('0x47')](_0x13bfd7[_0x1918('0x48')],qs['fields'](_0x32f1fb[_0x1918('0x44')][_0x1918('0x49')]));_0x408273[_0x1918('0x4a')]=_0x408273[_0x1918('0x4a')][_0x1918('0x4b')]?_0x408273[_0x1918('0x4a')]:_0x13bfd7[_0x1918('0x48')];_0x408273['order']=qs[_0x1918('0x4f')](_0x32f1fb[_0x1918('0x44')][_0x1918('0x4f')]);_0x408273[_0x1918('0x50')]=qs[_0x1918('0x46')](_[_0x1918('0x51')](_0x32f1fb[_0x1918('0x44')],_0x13bfd7['filters']));if(_0x32f1fb[_0x1918('0x44')]['filter']){_0x408273['where']=_[_0x1918('0x54')](_0x408273[_0x1918('0x50')],{'$or':_[_0x1918('0x40')](_0x408273[_0x1918('0x4a')],function(_0x54f42c){var _0x37d9eb={};_0x37d9eb[_0x54f42c]={'$like':'%'+_0x32f1fb['query'][_0x1918('0x52')]+'%'};return _0x37d9eb;})});}_0x408273=_[_0x1918('0x54')]({},_0x408273,_0x32f1fb['options']);return _0x1a896e[_0x1918('0xab')](_0x408273);}})[_0x1918('0x22')](function(_0x42b533){if(_0x42b533){_0x2c1ad0=_0x42b533[_0x1918('0x4b')];if(!_0x32f1fb[_0x1918('0x44')][_0x1918('0x4c')]('nolimit')){_0x408273[_0x1918('0x32')]=qs['limit'](_0x32f1fb[_0x1918('0x44')][_0x1918('0x32')]);_0x408273[_0x1918('0x30')]=qs[_0x1918('0x30')](_0x32f1fb[_0x1918('0x44')][_0x1918('0x30')]);}return _0x1a896e[_0x1918('0xab')](_0x408273);}})['then'](function(_0x5acf6e){if(_0x5acf6e){return _0x5acf6e?{'count':_0x2c1ad0,'rows':_0x5acf6e}:null;}})[_0x1918('0x22')](respondWithResult(_0x19fada,null))[_0x1918('0x2b')](handleError(_0x19fada,null));};exports[_0x1918('0xac')]=function(_0x451941,_0x18d670,_0x4fa310){var _0x11196c={'raw':![],'where':{}};var _0x580ee2={};var _0xec95d={'count':0x0,'rows':[]};return db[_0x1918('0x56')][_0x1918('0x69')]({'where':{'id':_0x451941['params']['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x18d670,null))[_0x1918('0x22')](function(_0x41ec8c){if(_0x41ec8c){_0x580ee2[_0x1918('0x48')]=_[_0x1918('0x45')](db[_0x1918('0x90')]['rawAttributes']);_0x580ee2[_0x1918('0x44')]=_[_0x1918('0x45')](_0x451941[_0x1918('0x44')]);_0x580ee2[_0x1918('0x46')]=_[_0x1918('0x47')](_0x580ee2[_0x1918('0x48')],_0x580ee2[_0x1918('0x44')]);_0x11196c[_0x1918('0x4a')]=_[_0x1918('0x47')](_0x580ee2[_0x1918('0x48')],qs[_0x1918('0x49')](_0x451941[_0x1918('0x44')][_0x1918('0x49')]));_0x11196c[_0x1918('0x4a')]=_0x11196c['attributes'][_0x1918('0x4b')]?_0x11196c[_0x1918('0x4a')]:_0x580ee2[_0x1918('0x48')];if(!_0x451941[_0x1918('0x44')][_0x1918('0x4c')](_0x1918('0x4d'))){_0x11196c['limit']=qs['limit'](_0x451941[_0x1918('0x44')][_0x1918('0x32')]);_0x11196c['offset']=qs[_0x1918('0x30')](_0x451941['query'][_0x1918('0x30')]);}_0x11196c['order']=qs['sort'](_0x451941['query'][_0x1918('0x4f')]);_0x11196c[_0x1918('0x50')]=qs[_0x1918('0x46')](_[_0x1918('0x51')](_0x451941[_0x1918('0x44')],_0x580ee2[_0x1918('0x46')]));_0x11196c[_0x1918('0x50')][_0x1918('0x6e')]=_0x41ec8c['id'];if(_0x451941[_0x1918('0x44')][_0x1918('0x52')]){_0x11196c[_0x1918('0x50')]=_[_0x1918('0x54')](_0x11196c[_0x1918('0x50')],{'$or':_['map'](_0x11196c[_0x1918('0x4a')],function(_0x142901){var _0x2f277f={};_0x2f277f[_0x142901]={'$like':'%'+_0x451941['query']['filter']+'%'};return _0x2f277f;})});}_0x11196c=_[_0x1918('0x54')]({},_0x11196c,_0x451941[_0x1918('0x5b')]);return db['OpenchannelInteraction'][_0x1918('0x33')]({'where':_0x11196c[_0x1918('0x50')]})[_0x1918('0x22')](function(_0x438385){_0xec95d[_0x1918('0x33')]=_0x438385;if(_0x451941[_0x1918('0x44')][_0x1918('0x55')]){_0x11196c[_0x1918('0x5a')]=[{'model':db['CmContact'],'as':_0x1918('0xad'),'required':![]},{'model':db[_0x1918('0x9e')],'as':_0x1918('0xae'),'attributes':['name',_0x1918('0xaf'),_0x1918('0xb0')],'required':![]},{'model':db[_0x1918('0xb1')],'as':_0x1918('0xb2'),'attributes':['id',_0x1918('0x3c'),_0x1918('0xb3')],'where':_0x451941[_0x1918('0x44')][_0x1918('0xb4')]?{'id':_0x451941[_0x1918('0x44')][_0x1918('0xb4')]}:undefined,'required':_0x451941['query'][_0x1918('0xb4')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x1918('0x57')](_0x11196c);})[_0x1918('0x22')](function(_0x33facc){_0xec95d['rows']=_0x33facc;return _0xec95d;});}})[_0x1918('0x22')](respondWithFilteredResult(_0x18d670,_0x11196c))[_0x1918('0x2b')](handleError(_0x18d670,null));};exports['addAgents']=function(_0x18308e,_0x45684a,_0x5b1867){return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x18308e[_0x1918('0x59')]['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x45684a,null))[_0x1918('0x22')](function(_0x51b0ff){if(_0x51b0ff){return _0x51b0ff[_0x1918('0xb5')](_0x18308e[_0x1918('0x5d')]['ids'],_[_0x1918('0xb6')](_0x18308e[_0x1918('0x5d')],[_0x1918('0x6c'),'id'])||{})[_0x1918('0xb7')](function(_0x5b6e0a){for(var _0x57e9d7=0x0;_0x57e9d7<_0x18308e[_0x1918('0x5d')]['ids'][_0x1918('0x4b')];_0x57e9d7+=0x1){socket[_0x1918('0xb8')](_0x1918('0xb9'),{'UserId':Number(_0x18308e[_0x1918('0x5d')]['ids'][_0x57e9d7]),'OpenchannelAccountId':Number(_0x18308e[_0x1918('0x59')]['id'])});}return _0x5b6e0a;});}})[_0x1918('0x22')](respondWithResult(_0x45684a,null))[_0x1918('0x2b')](handleError(_0x45684a,null));};exports['removeAgents']=function(_0x4569bb,_0x4f49ae,_0x2bfc3c){return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x4569bb['params']['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x4f49ae,null))[_0x1918('0x22')](function(_0x7a1640){if(_0x7a1640){return _0x7a1640['removeAgents'](_0x4569bb[_0x1918('0x44')][_0x1918('0x6c')])['then'](function(){if(_['isArray'](_0x4569bb[_0x1918('0x44')][_0x1918('0x6c')])){for(var _0x2050c4=0x0;_0x2050c4<_0x4569bb[_0x1918('0x44')][_0x1918('0x6c')][_0x1918('0x4b')];_0x2050c4+=0x1){socket[_0x1918('0xb8')](_0x1918('0xba'),{'UserId':Number(_0x4569bb[_0x1918('0x44')][_0x1918('0x6c')][_0x2050c4]),'OpenchannelAccountId':Number(_0x4569bb[_0x1918('0x59')]['id'])});}}else{socket[_0x1918('0xb8')](_0x1918('0xba'),{'UserId':Number(_0x4569bb[_0x1918('0x44')][_0x1918('0x6c')]),'OpenchannelAccountId':Number(_0x4569bb[_0x1918('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x4f49ae,null))[_0x1918('0x2b')](handleError(_0x4f49ae,null));};exports[_0x1918('0xbb')]=function(_0x54f658,_0x2530b7,_0x114526){var _0x2ae45d={};var _0x29b6ca={};var _0x31887f;var _0xbaf0ad;return db[_0x1918('0x56')]['findOne']({'where':{'id':_0x54f658['params']['id']}})[_0x1918('0x22')](handleEntityNotFound(_0x2530b7,null))[_0x1918('0x22')](function(_0x16d947){if(_0x16d947){_0x31887f=_0x16d947;_0x29b6ca[_0x1918('0x48')]=_[_0x1918('0x45')](db[_0x1918('0x9e')]['rawAttributes']);_0x29b6ca[_0x1918('0x44')]=_[_0x1918('0x45')](_0x54f658[_0x1918('0x44')]);_0x29b6ca[_0x1918('0x46')]=_[_0x1918('0x47')](_0x29b6ca['model'],_0x29b6ca[_0x1918('0x44')]);_0x2ae45d[_0x1918('0x4a')]=_['intersection'](_0x29b6ca[_0x1918('0x48')],qs[_0x1918('0x49')](_0x54f658['query'][_0x1918('0x49')]));_0x2ae45d[_0x1918('0x4a')]=_0x2ae45d[_0x1918('0x4a')][_0x1918('0x4b')]?_0x2ae45d[_0x1918('0x4a')]:_0x29b6ca[_0x1918('0x48')];_0x2ae45d[_0x1918('0x4e')]=qs['sort'](_0x54f658[_0x1918('0x44')]['sort']);_0x2ae45d[_0x1918('0x50')]=qs[_0x1918('0x46')](_[_0x1918('0x51')](_0x54f658[_0x1918('0x44')],_0x29b6ca[_0x1918('0x46')]));if(_0x54f658[_0x1918('0x44')][_0x1918('0x52')]){_0x2ae45d[_0x1918('0x50')]=_[_0x1918('0x54')](_0x2ae45d[_0x1918('0x50')],{'$or':_['map'](_0x2ae45d[_0x1918('0x4a')],function(_0x1ad6c8){var _0x2a848e={};_0x2a848e[_0x1ad6c8]={'$like':'%'+_0x54f658[_0x1918('0x44')][_0x1918('0x52')]+'%'};return _0x2a848e;})});}_0x2ae45d=_[_0x1918('0x54')]({},_0x2ae45d,_0x54f658[_0x1918('0x5b')]);return _0x31887f[_0x1918('0xbb')](_0x2ae45d);}})['then'](function(_0x2722aa){if(_0x2722aa){_0xbaf0ad=_0x2722aa[_0x1918('0x4b')];if(!_0x54f658[_0x1918('0x44')]['hasOwnProperty'](_0x1918('0x4d'))){_0x2ae45d[_0x1918('0x32')]=qs['limit'](_0x54f658[_0x1918('0x44')][_0x1918('0x32')]);_0x2ae45d['offset']=qs[_0x1918('0x30')](_0x54f658['query'][_0x1918('0x30')]);}return _0x31887f['getAgents'](_0x2ae45d);}})[_0x1918('0x22')](function(_0x515928){if(_0x515928){return _0x515928?{'count':_0xbaf0ad,'rows':_0x515928}:null;}})[_0x1918('0x22')](respondWithResult(_0x2530b7,null))[_0x1918('0x2b')](handleError(_0x2530b7,null));};exports[_0x1918('0x3d')]=function(_0x3bd100,_0x58666e,_0x5173c2){var _0x4e80f4,_0xe2ed5b,_0x15d747;if(_[_0x1918('0x79')](_0x3bd100[_0x1918('0x5d')][_0x1918('0x5d')])||_0x3bd100['body']['body']===''){throw new db[(_0x1918('0x7b'))][(_0x1918('0x75'))](_0x1918('0xbc'));}if(_[_0x1918('0x79')](_0x3bd100[_0x1918('0x5d')]['to'])){}_0x4e80f4=_0x3bd100[_0x1918('0x5d')]['to'];return db[_0x1918('0x56')][_0x1918('0x69')]({'where':{'id':_0x3bd100['params']['id']}})['then'](handleEntityNotFound(_0x58666e,null))[_0x1918('0x22')](function(_0x34bb91){if(_0x34bb91){return db[_0x1918('0x56')][_0x1918('0x60')]({'where':{'id':_0x34bb91['id']},'include':[{'model':db[_0x1918('0x80')],'as':_0x1918('0x81'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x34bb91[_0x1918('0x7d')]]:_0x4e80f4},'limit':0x1,'order':[[_0x1918('0x82'),'DESC']]}]}]})[_0x1918('0x22')](handleEntityNotFound(_0x58666e,null))[_0x1918('0x22')](function(_0x4516b2){if(_0x4516b2&&_0x4516b2[_0x1918('0x81')]){_0xe2ed5b=_0x4516b2[_0x1918('0x39')]({'plain':!![]});if(_0xe2ed5b['List']&&_0xe2ed5b[_0x1918('0x81')]['Contacts'][_0x1918('0x4b')]){return _0xe2ed5b['List'][_0x1918('0x8c')][0x0];}return db[_0x1918('0x74')][_0x1918('0x5c')](_['defaults'](_0x3bd100[_0x1918('0x5d')],{'firstName':_0x4e80f4,[_0x4516b2[_0x1918('0x7d')]]:_0x4e80f4,'phone':_0x4e80f4,'ListId':_0xe2ed5b['ListId']}));}})['then'](handleEntityNotFound(_0x58666e,null))[_0x1918('0x22')](function(_0x49d299){if(_0x49d299){_0x15d747=_0x49d299;return db['OpenchannelInteraction'][_0x1918('0x60')]({'where':{'ContactId':_0x15d747['id'],'closed':![],'OpenchannelAccountId':_0xe2ed5b['id']}})['then'](function(_0x2cfbeb){if(_0x2cfbeb){return[_0x2cfbeb,![]];}return db[_0x1918('0x90')][_0x1918('0x5c')]({'UserId':_0x3bd100[_0x1918('0x5e')]['id'],'ContactId':_0x15d747['id'],'OpenchannelAccountId':_0xe2ed5b['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_['merge'](_0x3bd100[_0x1918('0x5d')],{'read':![],'body':_0x3bd100[_0x1918('0x5d')][_0x1918('0x5d')],'OpenchannelAccountId':_0xe2ed5b['id'],'UserId':_0x3bd100[_0x1918('0x5e')]['id'],'ContactId':_0x15d747['id']})]},{'include':[{'model':db[_0x1918('0x9b')],'as':_0x1918('0xbd')}]})['then'](function(_0x434119){return[_0x434119,!![]];});});}})[_0x1918('0xb7')](function(_0x4ae9d6,_0x7b5e0e){if(_0x7b5e0e){return _0x4ae9d6;}return db[_0x1918('0x9b')][_0x1918('0x5c')](_[_0x1918('0x54')](_0x3bd100[_0x1918('0x5d')],{'read':![],'body':_0x3bd100['body'][_0x1918('0x5d')],'OpenchannelAccountId':_0xe2ed5b['id'],'OpenchannelInteractionId':_0x4ae9d6['id'],'UserId':_0x3bd100[_0x1918('0x5e')]['id'],'ContactId':_0x15d747['id']}))[_0x1918('0x22')](function(_0x574434){_0x4ae9d6[_0x1918('0xbe')][_0x1918('0xbd')]=[];_0x4ae9d6['dataValues']['Messages'][_0x1918('0x97')](_0x574434[_0x1918('0xbe')]);return _0x4ae9d6;});});}})[_0x1918('0x22')](respondWithResult(_0x58666e,null))[_0x1918('0x2b')](handleError(_0x58666e,null));}; \ No newline at end of file +var _0xe8f7=['filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','options','OpenchannelAccount','includeAll','include','show','params','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','getDispositions','findOne','rawAttributes','order','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','findAll','rows','notify','openchannel','CmContact','difference','createdAt','updatedAt','CompanyId','ListId','from','Sequelize','ValidationError','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','firstName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','lastName','messageId','interaction','autoclose','close','OpenchannelMessage','UserId','unshift','agent','*,*,*,*','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','User','Owner','internal','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','Messages','dataValues','push','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','catch','sendStatus','json','offset','undefined','limit','count','status','set','reject','save','update','destroy','get','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','key','model','query','keys'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xe8f7,0x137));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x7e8f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7e8f('0x1'));var jsonpatch=require(_0x7e8f('0x2'));var rp=require(_0x7e8f('0x3'));var moment=require(_0x7e8f('0x4'));var BPromise=require(_0x7e8f('0x5'));var Mustache=require(_0x7e8f('0x6'));var util=require(_0x7e8f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7e8f('0x8'));var ejs=require(_0x7e8f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e8f('0xa'));var squel=require(_0x7e8f('0xb'));var crypto=require(_0x7e8f('0xc'));var jsforce=require(_0x7e8f('0xd'));var deskjs=require(_0x7e8f('0xe'));var toCsv=require(_0x7e8f('0x8'));var querystring=require(_0x7e8f('0xf'));var Papa=require('papaparse');var Redis=require(_0x7e8f('0x10'));var authService=require(_0x7e8f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7e8f('0x12'));var hardwareService=require(_0x7e8f('0x13'));var logger=require(_0x7e8f('0x14'))(_0x7e8f('0x15'));var utils=require('../../config/utils');var config=require(_0x7e8f('0x16'));var licenseUtil=require(_0x7e8f('0x17'));var db=require('../../mysqldb')['db'];config[_0x7e8f('0x18')]=_[_0x7e8f('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7e8f('0x1a'))(new Redis(config[_0x7e8f('0x18')]));require(_0x7e8f('0x1b'))[_0x7e8f('0x1c')](socket);var jayson=require(_0x7e8f('0x1d'));var client=jayson[_0x7e8f('0x1e')][_0x7e8f('0x1f')]({'port':0x232c});var client9002=jayson[_0x7e8f('0x1e')][_0x7e8f('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3d05f1,_0x38066f,_0xe0c19a,_0x40ecdb){return new BPromise(function(_0x2e8211,_0x10fd0c){var _0xbbb0e=_0x40ecdb||client;return _0xbbb0e['request'](_0x3d05f1,_0xe0c19a)[_0x7e8f('0x20')](function(_0x10e3fc){logger[_0x7e8f('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x38066f,_0x7e8f('0x22'));logger[_0x7e8f('0x23')](_0x7e8f('0x24'),_0x38066f,_0x7e8f('0x22'),JSON[_0x7e8f('0x25')](_0x10e3fc));if(_0x10e3fc[_0x7e8f('0x26')]){if(_0x10e3fc[_0x7e8f('0x26')][_0x7e8f('0x27')]===0x1f4){logger['error'](_0x7e8f('0x28'),_0x38066f,_0x10e3fc['error'][_0x7e8f('0x29')]);return _0x10fd0c(_0x10e3fc[_0x7e8f('0x26')][_0x7e8f('0x29')]);}logger['error'](_0x7e8f('0x28'),_0x38066f,_0x10e3fc[_0x7e8f('0x26')]['message']);return _0x2e8211(_0x10e3fc[_0x7e8f('0x26')][_0x7e8f('0x29')]);}else{logger['info'](_0x7e8f('0x28'),_0x38066f,_0x7e8f('0x22'));_0x2e8211(_0x10e3fc[_0x7e8f('0x2a')]['message']);}})[_0x7e8f('0x2b')](function(_0x4d9211){logger[_0x7e8f('0x26')](_0x7e8f('0x28'),_0x38066f,_0x4d9211);_0x10fd0c(_0x4d9211);});});}function respondWithStatusCode(_0x5ae4bf,_0xa82475){_0xa82475=_0xa82475||0xcc;return function(_0x307eb3){if(_0x307eb3){return _0x5ae4bf[_0x7e8f('0x2c')](_0xa82475);}return _0x5ae4bf['status'](_0xa82475)['end']();};}function respondWithResult(_0x3ac382,_0x5b72d0){_0x5b72d0=_0x5b72d0||0xc8;return function(_0x26ee2a){if(_0x26ee2a){return _0x3ac382['status'](_0x5b72d0)[_0x7e8f('0x2d')](_0x26ee2a);}};}function respondWithFilteredResult(_0x82b6f8,_0x56f82c){return function(_0x15dba0){if(_0x15dba0){var _0x33bb50=typeof _0x56f82c[_0x7e8f('0x2e')]===_0x7e8f('0x2f')&&typeof _0x56f82c[_0x7e8f('0x30')]===_0x7e8f('0x2f');var _0x3f52e0=_0x15dba0[_0x7e8f('0x31')];var _0x19273e=_0x33bb50?0x0:_0x56f82c[_0x7e8f('0x2e')];var _0x5bc5e0=_0x33bb50?_0x15dba0[_0x7e8f('0x31')]:_0x56f82c[_0x7e8f('0x2e')]+_0x56f82c['limit'];var _0xdb9d6e;if(_0x5bc5e0>=_0x3f52e0){_0x5bc5e0=_0x3f52e0;_0xdb9d6e=0xc8;}else{_0xdb9d6e=0xce;}_0x82b6f8[_0x7e8f('0x32')](_0xdb9d6e);return _0x82b6f8[_0x7e8f('0x33')]('Content-Range',_0x19273e+'-'+_0x5bc5e0+'/'+_0x3f52e0)[_0x7e8f('0x2d')](_0x15dba0);}return null;};}function patchUpdates(_0x2ed737){return function(_0x286ab0){try{jsonpatch['apply'](_0x286ab0,_0x2ed737,!![]);}catch(_0x76cfc){return BPromise[_0x7e8f('0x34')](_0x76cfc);}return _0x286ab0[_0x7e8f('0x35')]();};}function saveUpdates(_0x2a9f64,_0x1085b6){return function(_0x229592){if(_0x229592){return _0x229592[_0x7e8f('0x36')](_0x2a9f64)[_0x7e8f('0x20')](function(_0x5806fa){return _0x5806fa;});}return null;};}function removeEntity(_0x2a43dc,_0x1a8a9d){return function(_0x2d28f4){if(_0x2d28f4){return _0x2d28f4[_0x7e8f('0x37')]()[_0x7e8f('0x20')](function(){var _0x314de1=_0x2d28f4[_0x7e8f('0x38')]({'plain':!![]});var _0x131eb7='OpenchannelAccounts';return db[_0x7e8f('0x39')][_0x7e8f('0x37')]({'where':{'type':_0x131eb7,'resourceId':_0x314de1['id']}})[_0x7e8f('0x20')](function(){return _0x2d28f4;});})[_0x7e8f('0x20')](function(){_0x2a43dc['status'](0xcc)[_0x7e8f('0x3a')]();});}};}function handleEntityNotFound(_0x244a8e,_0x45c437){return function(_0x2db68a){if(!_0x2db68a){_0x244a8e['sendStatus'](0x194);}return _0x2db68a;};}function handleError(_0x4c6001,_0x2f6a54){_0x2f6a54=_0x2f6a54||0x1f4;return function(_0x194363){logger['error'](_0x194363[_0x7e8f('0x3b')]);if(_0x194363[_0x7e8f('0x3c')]){delete _0x194363[_0x7e8f('0x3c')];}_0x4c6001[_0x7e8f('0x32')](_0x2f6a54)['send'](_0x194363);};}exports[_0x7e8f('0x3d')]=function(_0x118f5f,_0x594204){var _0xd99269={'include':[{'model':db[_0x7e8f('0x3e')],'as':_0x7e8f('0x3f')}]},_0x1909b0={},_0xf17095={'count':0x0,'rows':[]};var _0xa6889b=_[_0x7e8f('0x40')](db['OpenchannelAccount']['rawAttributes'],function(_0x1fabe1){return{'name':_0x1fabe1['fieldName'],'type':_0x1fabe1['type'][_0x7e8f('0x41')]};});_0x1909b0[_0x7e8f('0x42')]=_['map'](_0xa6889b,_0x7e8f('0x3c'));_0x1909b0[_0x7e8f('0x43')]=_[_0x7e8f('0x44')](_0x118f5f[_0x7e8f('0x43')]);_0x1909b0[_0x7e8f('0x45')]=_['intersection'](_0x1909b0[_0x7e8f('0x42')],_0x1909b0['query']);_0xd99269[_0x7e8f('0x46')]=_[_0x7e8f('0x47')](_0x1909b0['model'],qs[_0x7e8f('0x48')](_0x118f5f['query'][_0x7e8f('0x48')]));_0xd99269['attributes']=_0xd99269[_0x7e8f('0x46')][_0x7e8f('0x49')]?_0xd99269[_0x7e8f('0x46')]:_0x1909b0['model'];if(!_0x118f5f[_0x7e8f('0x43')][_0x7e8f('0x4a')](_0x7e8f('0x4b'))){_0xd99269[_0x7e8f('0x30')]=qs['limit'](_0x118f5f[_0x7e8f('0x43')][_0x7e8f('0x30')]);_0xd99269['offset']=qs[_0x7e8f('0x2e')](_0x118f5f[_0x7e8f('0x43')][_0x7e8f('0x2e')]);}_0xd99269['order']=qs[_0x7e8f('0x4c')](_0x118f5f['query'][_0x7e8f('0x4c')]);_0xd99269[_0x7e8f('0x4d')]=qs[_0x7e8f('0x45')](_[_0x7e8f('0x4e')](_0x118f5f[_0x7e8f('0x43')],_0x1909b0[_0x7e8f('0x45')]),_0xa6889b);if(_0x118f5f[_0x7e8f('0x43')]['filter']){_0xd99269[_0x7e8f('0x4d')]=_['merge'](_0xd99269[_0x7e8f('0x4d')],{'$or':_[_0x7e8f('0x40')](_0xa6889b,function(_0x5bb2de){if(_0x5bb2de[_0x7e8f('0x4f')]!==_0x7e8f('0x50')){var _0x399b78={};_0x399b78[_0x5bb2de[_0x7e8f('0x3c')]]={'$like':'%'+_0x118f5f[_0x7e8f('0x43')][_0x7e8f('0x51')]+'%'};return _0x399b78;}})});}_0xd99269=_['merge']({},_0xd99269,_0x118f5f[_0x7e8f('0x52')]);var _0x1f5dca={'where':_0xd99269[_0x7e8f('0x4d')]};return db[_0x7e8f('0x53')]['count'](_0x1f5dca)[_0x7e8f('0x20')](function(_0x264705){_0xf17095[_0x7e8f('0x31')]=_0x264705;if(_0x118f5f[_0x7e8f('0x43')][_0x7e8f('0x54')]){_0xd99269[_0x7e8f('0x55')]=[{'all':!![]}];}return db[_0x7e8f('0x53')]['findAll'](_0xd99269);})[_0x7e8f('0x20')](function(_0x41f6bf){_0xf17095['rows']=_0x41f6bf;return _0xf17095;})[_0x7e8f('0x20')](respondWithFilteredResult(_0x594204,_0xd99269))[_0x7e8f('0x2b')](handleError(_0x594204,null));};exports[_0x7e8f('0x56')]=function(_0x1c900e,_0x5def78){var _0x10dfd4={'raw':![],'where':{'id':_0x1c900e[_0x7e8f('0x57')]['id']},'include':[{'model':db[_0x7e8f('0x3e')],'as':'mandatoryDispositionPause'}]},_0x1a15c6={};_0x1a15c6[_0x7e8f('0x42')]=_[_0x7e8f('0x44')](db[_0x7e8f('0x53')]['rawAttributes']);_0x1a15c6[_0x7e8f('0x43')]=_[_0x7e8f('0x44')](_0x1c900e[_0x7e8f('0x43')]);_0x1a15c6[_0x7e8f('0x45')]=_[_0x7e8f('0x47')](_0x1a15c6[_0x7e8f('0x42')],_0x1a15c6[_0x7e8f('0x43')]);_0x10dfd4[_0x7e8f('0x46')]=_['intersection'](_0x1a15c6[_0x7e8f('0x42')],qs[_0x7e8f('0x48')](_0x1c900e[_0x7e8f('0x43')]['fields']));_0x10dfd4['attributes']=_0x10dfd4[_0x7e8f('0x46')][_0x7e8f('0x49')]?_0x10dfd4['attributes']:_0x1a15c6[_0x7e8f('0x42')];if(_0x1c900e[_0x7e8f('0x43')]['includeAll']){_0x10dfd4[_0x7e8f('0x55')]=[{'all':!![]}];}_0x10dfd4=_[_0x7e8f('0x58')]({},_0x10dfd4,_0x1c900e[_0x7e8f('0x52')]);return db['OpenchannelAccount'][_0x7e8f('0x59')](_0x10dfd4)[_0x7e8f('0x20')](handleEntityNotFound(_0x5def78,null))[_0x7e8f('0x20')](respondWithResult(_0x5def78,null))['catch'](handleError(_0x5def78,null));};exports[_0x7e8f('0x5a')]=function(_0x19e643,_0x5bd48e){return db['OpenchannelAccount']['create'](_0x19e643[_0x7e8f('0x5b')],{})[_0x7e8f('0x20')](function(_0x5b07d1){var _0x2febd1=_0x19e643['user']['get']({'plain':!![]});if(!_0x2febd1)throw new Error(_0x7e8f('0x5c'));if(_0x2febd1[_0x7e8f('0x5d')]===_0x7e8f('0x5e')){var _0x446397=_0x5b07d1[_0x7e8f('0x38')]({'plain':!![]});var _0x2d9b25=_0x7e8f('0x5f');return db[_0x7e8f('0x60')]['find']({'where':{'name':_0x2d9b25,'userProfileId':_0x2febd1[_0x7e8f('0x61')]},'raw':!![]})[_0x7e8f('0x20')](function(_0x220d44){if(_0x220d44&&_0x220d44['autoAssociation']===0x0){return db[_0x7e8f('0x39')][_0x7e8f('0x5a')]({'name':_0x446397['name'],'resourceId':_0x446397['id'],'type':_0x220d44['name'],'sectionId':_0x220d44['id']},{})['then'](function(){return _0x5b07d1;});}else{return _0x5b07d1;}})[_0x7e8f('0x2b')](function(_0xbbdec8){logger['error'](_0x7e8f('0x62'),_0xbbdec8);throw _0xbbdec8;});}return _0x5b07d1;})[_0x7e8f('0x20')](respondWithResult(_0x5bd48e,0xc9))[_0x7e8f('0x2b')](handleError(_0x5bd48e,null));};exports['update']=function(_0x46d6ed,_0x1cd154){if(_0x46d6ed[_0x7e8f('0x5b')]['id']){delete _0x46d6ed[_0x7e8f('0x5b')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x46d6ed[_0x7e8f('0x57')]['id']},'include':[{'model':db[_0x7e8f('0x3e')],'as':_0x7e8f('0x3f')}]})[_0x7e8f('0x20')](handleEntityNotFound(_0x1cd154,null))[_0x7e8f('0x20')](saveUpdates(_0x46d6ed[_0x7e8f('0x5b')],null))[_0x7e8f('0x20')](respondWithResult(_0x1cd154,null))[_0x7e8f('0x2b')](handleError(_0x1cd154,null));};exports['destroy']=function(_0x5e7779,_0x334d6a){return db[_0x7e8f('0x53')]['find']({'where':{'id':_0x5e7779[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x334d6a,null))['then'](removeEntity(_0x334d6a,null))[_0x7e8f('0x2b')](handleError(_0x334d6a,null));};exports[_0x7e8f('0x63')]=function(_0xe4d07b,_0x1e2547){return db[_0x7e8f('0x53')]['describe']()[_0x7e8f('0x20')](respondWithResult(_0x1e2547,null))['catch'](handleError(_0x1e2547,null));};exports[_0x7e8f('0x64')]=function(_0x230926,_0x1a35c1,_0x2285fa){if(_0x230926[_0x7e8f('0x5b')]['id']){delete _0x230926[_0x7e8f('0x5b')]['id'];}return db[_0x7e8f('0x53')]['find']({'where':{'id':_0x230926[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x1a35c1,null))[_0x7e8f('0x20')](function(_0x48dbe0){if(_0x48dbe0){_0x230926[_0x7e8f('0x5b')]['OpenchannelAccountId']=_0x48dbe0['id'];return db[_0x7e8f('0x65')][_0x7e8f('0x5a')](_0x230926[_0x7e8f('0x5b')]);}})[_0x7e8f('0x20')](respondWithResult(_0x1a35c1,null))[_0x7e8f('0x2b')](handleError(_0x1a35c1,null));};exports[_0x7e8f('0x66')]=function(_0x366468,_0x1014e3,_0x18d7bc){var _0x3908f5={'raw':![],'where':{}};var _0x2cbe75={};var _0x5d457f={'count':0x0,'rows':[]};return db[_0x7e8f('0x53')][_0x7e8f('0x67')]({'where':{'id':_0x366468[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x1014e3,null))[_0x7e8f('0x20')](function(_0x4a27fc){if(_0x4a27fc){_0x2cbe75[_0x7e8f('0x42')]=_[_0x7e8f('0x44')](db['Disposition'][_0x7e8f('0x68')]);_0x2cbe75[_0x7e8f('0x43')]=_[_0x7e8f('0x44')](_0x366468[_0x7e8f('0x43')]);_0x2cbe75[_0x7e8f('0x45')]=_[_0x7e8f('0x47')](_0x2cbe75[_0x7e8f('0x42')],_0x2cbe75[_0x7e8f('0x43')]);_0x3908f5['attributes']=_[_0x7e8f('0x47')](_0x2cbe75[_0x7e8f('0x42')],qs['fields'](_0x366468[_0x7e8f('0x43')][_0x7e8f('0x48')]));_0x3908f5[_0x7e8f('0x46')]=_0x3908f5[_0x7e8f('0x46')][_0x7e8f('0x49')]?_0x3908f5[_0x7e8f('0x46')]:_0x2cbe75['model'];if(!_0x366468['query'][_0x7e8f('0x4a')]('nolimit')){_0x3908f5[_0x7e8f('0x30')]=qs[_0x7e8f('0x30')](_0x366468['query'][_0x7e8f('0x30')]);_0x3908f5[_0x7e8f('0x2e')]=qs[_0x7e8f('0x2e')](_0x366468['query'][_0x7e8f('0x2e')]);}_0x3908f5[_0x7e8f('0x69')]=qs[_0x7e8f('0x4c')](_0x366468[_0x7e8f('0x43')][_0x7e8f('0x4c')]);_0x3908f5['where']=qs[_0x7e8f('0x45')](_[_0x7e8f('0x4e')](_0x366468[_0x7e8f('0x43')],_0x2cbe75['filters']));_0x3908f5['where']['OpenchannelAccountId']=_0x4a27fc['id'];if(_0x366468['query'][_0x7e8f('0x51')]){_0x3908f5[_0x7e8f('0x4d')]=_[_0x7e8f('0x58')](_0x3908f5[_0x7e8f('0x4d')],{'$or':_[_0x7e8f('0x40')](_0x3908f5[_0x7e8f('0x46')],function(_0x44dd87){var _0x2a9115={};_0x2a9115[_0x44dd87]={'$like':'%'+_0x366468[_0x7e8f('0x43')][_0x7e8f('0x51')]+'%'};return _0x2a9115;})});}_0x3908f5=_[_0x7e8f('0x58')]({},_0x3908f5,_0x366468[_0x7e8f('0x52')]);return db[_0x7e8f('0x65')][_0x7e8f('0x31')]({'where':_0x3908f5['where']})[_0x7e8f('0x20')](function(_0x457baf){_0x5d457f[_0x7e8f('0x31')]=_0x457baf;if(_0x366468[_0x7e8f('0x43')][_0x7e8f('0x54')]){_0x3908f5[_0x7e8f('0x55')]=[{'all':!![]}];}return db[_0x7e8f('0x65')]['findAll'](_0x3908f5);})[_0x7e8f('0x20')](function(_0x4a9506){_0x5d457f['rows']=_0x4a9506;return _0x5d457f;});}})[_0x7e8f('0x20')](respondWithFilteredResult(_0x1014e3,_0x3908f5))[_0x7e8f('0x2b')](handleError(_0x1014e3,null));};exports['removeDispositions']=function(_0x46a847,_0x154434,_0x47f5a8){return db[_0x7e8f('0x53')][_0x7e8f('0x59')]({'where':{'id':_0x46a847[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x154434,null))[_0x7e8f('0x20')](function(_0x5ba2fc){if(_0x5ba2fc){return _0x5ba2fc[_0x7e8f('0x6a')](_0x46a847['query'][_0x7e8f('0x6b')]);}})[_0x7e8f('0x20')](respondWithStatusCode(_0x154434,null))['catch'](handleError(_0x154434,null));};exports[_0x7e8f('0x6c')]=function(_0x1b7ced,_0x1ce911,_0x464e24){if(_0x1b7ced['body']['id']){delete _0x1b7ced[_0x7e8f('0x5b')]['id'];}return db[_0x7e8f('0x53')]['find']({'where':{'id':_0x1b7ced['params']['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x1ce911,null))[_0x7e8f('0x20')](function(_0x259a55){if(_0x259a55){_0x1b7ced[_0x7e8f('0x5b')][_0x7e8f('0x6d')]=_0x259a55['id'];return db[_0x7e8f('0x6e')]['create'](_0x1b7ced[_0x7e8f('0x5b')]);}})[_0x7e8f('0x20')](respondWithResult(_0x1ce911,null))[_0x7e8f('0x2b')](handleError(_0x1ce911,null));};exports[_0x7e8f('0x6f')]=function(_0x3c69fd,_0x505b23,_0x11e4ef){var _0x2aec2a={'raw':![],'where':{}};var _0x958b78={};var _0x364085={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7e8f('0x67')]({'where':{'id':_0x3c69fd[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x505b23,null))[_0x7e8f('0x20')](function(_0x9673da){if(_0x9673da){_0x958b78[_0x7e8f('0x42')]=_[_0x7e8f('0x44')](db[_0x7e8f('0x6e')][_0x7e8f('0x68')]);_0x958b78[_0x7e8f('0x43')]=_['keys'](_0x3c69fd[_0x7e8f('0x43')]);_0x958b78['filters']=_[_0x7e8f('0x47')](_0x958b78['model'],_0x958b78[_0x7e8f('0x43')]);_0x2aec2a['attributes']=_[_0x7e8f('0x47')](_0x958b78[_0x7e8f('0x42')],qs[_0x7e8f('0x48')](_0x3c69fd['query']['fields']));_0x2aec2a[_0x7e8f('0x46')]=_0x2aec2a[_0x7e8f('0x46')][_0x7e8f('0x49')]?_0x2aec2a['attributes']:_0x958b78[_0x7e8f('0x42')];if(!_0x3c69fd[_0x7e8f('0x43')][_0x7e8f('0x4a')](_0x7e8f('0x4b'))){_0x2aec2a[_0x7e8f('0x30')]=qs[_0x7e8f('0x30')](_0x3c69fd[_0x7e8f('0x43')][_0x7e8f('0x30')]);_0x2aec2a[_0x7e8f('0x2e')]=qs[_0x7e8f('0x2e')](_0x3c69fd[_0x7e8f('0x43')][_0x7e8f('0x2e')]);}_0x2aec2a[_0x7e8f('0x69')]=qs[_0x7e8f('0x4c')](_0x3c69fd['query'][_0x7e8f('0x4c')]);_0x2aec2a[_0x7e8f('0x4d')]=qs[_0x7e8f('0x45')](_['pick'](_0x3c69fd[_0x7e8f('0x43')],_0x958b78[_0x7e8f('0x45')]));_0x2aec2a[_0x7e8f('0x4d')][_0x7e8f('0x6d')]=_0x9673da['id'];if(_0x3c69fd[_0x7e8f('0x43')][_0x7e8f('0x51')]){_0x2aec2a[_0x7e8f('0x4d')]=_[_0x7e8f('0x58')](_0x2aec2a[_0x7e8f('0x4d')],{'$or':_[_0x7e8f('0x40')](_0x2aec2a[_0x7e8f('0x46')],function(_0x3902bd){var _0x51a53d={};_0x51a53d[_0x3902bd]={'$like':'%'+_0x3c69fd['query'][_0x7e8f('0x51')]+'%'};return _0x51a53d;})});}_0x2aec2a=_[_0x7e8f('0x58')]({},_0x2aec2a,_0x3c69fd[_0x7e8f('0x52')]);return db[_0x7e8f('0x6e')][_0x7e8f('0x31')]({'where':_0x2aec2a[_0x7e8f('0x4d')]})[_0x7e8f('0x20')](function(_0x57a19e){_0x364085[_0x7e8f('0x31')]=_0x57a19e;if(_0x3c69fd[_0x7e8f('0x43')][_0x7e8f('0x54')]){_0x2aec2a[_0x7e8f('0x55')]=[{'all':!![]}];}return db[_0x7e8f('0x6e')][_0x7e8f('0x70')](_0x2aec2a);})['then'](function(_0x2e93b8){_0x364085[_0x7e8f('0x71')]=_0x2e93b8;return _0x364085;});}})[_0x7e8f('0x20')](respondWithFilteredResult(_0x505b23,_0x2aec2a))[_0x7e8f('0x2b')](handleError(_0x505b23,null));};exports['removeAnswers']=function(_0x475e16,_0x5e9d44,_0x100e96){return db[_0x7e8f('0x53')]['find']({'where':{'id':_0x475e16['params']['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x5e9d44,null))[_0x7e8f('0x20')](function(_0x4b13ae){if(_0x4b13ae){return _0x4b13ae['removeAnswers'](_0x475e16[_0x7e8f('0x43')][_0x7e8f('0x6b')]);}})[_0x7e8f('0x20')](respondWithStatusCode(_0x5e9d44,null))['catch'](handleError(_0x5e9d44,null));};exports[_0x7e8f('0x72')]=function(_0x11ccb9,_0x5f35f9,_0x4699a0){var _0x5f410b={'body':_0x11ccb9[_0x7e8f('0x5b')],'channel':_0x7e8f('0x73')};var _0x4adf2e=[];var _0x448a6f=[];var _0xdc87dc={};var _0x33e352=![];return db[_0x7e8f('0x74')][_0x7e8f('0x63')]()[_0x7e8f('0x20')](function(_0x4de28b){if(!_0x4de28b){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x4adf2e=_[_0x7e8f('0x75')](_[_0x7e8f('0x44')](_0x4de28b),[_0x7e8f('0x76'),_0x7e8f('0x77')]);_0x448a6f=_[_0x7e8f('0x75')](_[_0x7e8f('0x44')](_0x4de28b),[_0x7e8f('0x76'),_0x7e8f('0x77'),_0x7e8f('0x78'),_0x7e8f('0x79')]);if(_0x11ccb9['body']['id']){delete _0x11ccb9['body']['id'];}if(_['isNil'](_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7a')])){throw new db[(_0x7e8f('0x7b'))][(_0x7e8f('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x7e8f('0x7d')](_0x11ccb9[_0x7e8f('0x5b')]['body'])||_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x5b')]===''){throw new db[(_0x7e8f('0x7b'))]['ValidationError'](_0x7e8f('0x7e'));}if(_[_0x7e8f('0x7d')](_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7f')])){throw new db[(_0x7e8f('0x7b'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x448a6f);}if(!_[_0x7e8f('0x80')](_0x448a6f,_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7f')])){throw new db[(_0x7e8f('0x7b'))]['ValidationError'](_0x7e8f('0x81')+_0x448a6f);}_0xdc87dc[_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7f')]]=_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7a')];})[_0x7e8f('0x20')](function(){return db[_0x7e8f('0x53')][_0x7e8f('0x59')]({'where':{'id':_0x11ccb9[_0x7e8f('0x57')]['id']},'include':[{'model':db[_0x7e8f('0x82')],'as':_0x7e8f('0x83'),'include':[{'model':db[_0x7e8f('0x74')],'as':_0x7e8f('0x84'),'where':_0xdc87dc,'limit':0x1,'order':[[_0x7e8f('0x77'),_0x7e8f('0x85')]]}]},{'model':db[_0x7e8f('0x86')],'as':_0x7e8f('0x87')}]});})[_0x7e8f('0x20')](handleEntityNotFound(_0x5f35f9,null))[_0x7e8f('0x20')](function(_0x49356f){if(_0x49356f&&_0x49356f[_0x7e8f('0x83')]){_0x5f410b[_0x7e8f('0x88')]=_0x49356f;_0x5f410b[_0x7e8f('0x89')]=_0x49356f[_0x7e8f('0x87')];_0x5f410b['list']=_0x49356f['List'];_0x5f410b['applications']=_[_0x7e8f('0x8a')](_0x5f410b[_0x7e8f('0x89')],[_0x7e8f('0x8b')],[_0x7e8f('0x8c')]);if(_0x5f410b['account']['Applications']){delete _0x5f410b['account'][_0x7e8f('0x87')];}if(_0x5f410b[_0x7e8f('0x88')][_0x7e8f('0x83')]&&_0x5f410b[_0x7e8f('0x88')][_0x7e8f('0x83')][_0x7e8f('0x84')][_0x7e8f('0x49')]){return _0x5f410b['account'][_0x7e8f('0x83')][_0x7e8f('0x84')][0x0];}var _0xa4cb06=_[_0x7e8f('0x19')](_0x11ccb9[_0x7e8f('0x5b')],{'firstName':_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7a')],'ListId':_0x49356f[_0x7e8f('0x79')]});_0xa4cb06[_0x11ccb9[_0x7e8f('0x5b')]['mapKey']]=_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x7a')];return db[_0x7e8f('0x74')]['create'](_0xa4cb06,{'fields':_0x4adf2e,'raw':!![]});}})['then'](handleEntityNotFound(_0x5f35f9,null))[_0x7e8f('0x20')](function(_0x1bba10){_0x5f410b['contact']=_0x1bba10;if(_0x1bba10){var _0x2628ce={'ContactId':_0x1bba10['id'],'OpenchannelAccountId':_0x11ccb9[_0x7e8f('0x57')]['id'],'from':(_0x1bba10[_0x7e8f('0x8d')]||'')+'\x20'+(_0x1bba10['lastName']||'')};var _0x55dd39={'OpenchannelAccountId':_0x11ccb9['params']['id'],'closed':![]};if(_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x8e')]){_0x55dd39['threadId']=_0x11ccb9[_0x7e8f('0x5b')]['threadId'];return db[_0x7e8f('0x8f')][_0x7e8f('0x59')]({'where':_0x55dd39})['then'](function(_0xa53275){if(_0xa53275){return[_0xa53275,![]];}_0x2628ce['threadId']=_0x11ccb9[_0x7e8f('0x5b')]['threadId'];_0x2628ce[_0x7e8f('0x90')]=_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x90')];return db[_0x7e8f('0x8f')]['create'](_0x2628ce)[_0x7e8f('0x20')](function(_0x13b4ec){return[_0x13b4ec,!![]];});});}else{_0x55dd39[_0x7e8f('0x8e')]=null;}_0x55dd39[_0x7e8f('0x91')]=_0x1bba10['id'];return db['OpenchannelInteraction']['find']({'where':_0x55dd39})['then'](function(_0x380e6d){if(_0x380e6d){return[_0x380e6d,![]];}return db['OpenchannelInteraction'][_0x7e8f('0x5a')](_0x2628ce)[_0x7e8f('0x20')](function(_0x512377){return[_0x512377,!![]];});});}})[_0x7e8f('0x92')](function(_0x13e701,_0x192bd8){if(_0x13e701){_0x33e352=_0x192bd8;if(!_0x192bd8){var _0x4a935e={'from':(_0x5f410b['contact']['firstName']||'')+'\x20'+(_0x5f410b['contact'][_0x7e8f('0x93')]||'')};if(_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x8e')]&&_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x94')]&&_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x8e')]!=_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x94')]){_0x4a935e[_0x7e8f('0x8e')]=_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x94')];}return _0x13e701['update'](_0x4a935e);}else{return _0x13e701;}}})['then'](function(_0x427cd2){_0x5f410b['interaction']=_0x427cd2[_0x7e8f('0x38')]({'plain':!![]});_0x5f410b[_0x7e8f('0x95')]['created']=_0x33e352;if(_0x5f410b[_0x7e8f('0x95')]['created']){if(_0x5f410b[_0x7e8f('0x88')][_0x7e8f('0x96')]){_0x5f410b[_0x7e8f('0x89')]['push']({'id':0x0,'priority':_0x5f410b[_0x7e8f('0x89')][_0x7e8f('0x49')]+0x1,'app':_0x7e8f('0x97'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x7e8f('0x98')][_0x7e8f('0x5a')]({'body':_0x11ccb9[_0x7e8f('0x5b')][_0x7e8f('0x5b')],'OpenchannelAccountId':_0x11ccb9[_0x7e8f('0x57')]['id'],'OpenchannelInteractionId':_0x427cd2['id'],'direction':'in','ContactId':_0x5f410b['contact']['id'],'AttachmentId':_0x11ccb9[_0x7e8f('0x5b')]['AttachmentId']});})[_0x7e8f('0x20')](function(_0x283221){_0x5f410b['message']=_0x283221;if(_0x5f410b[_0x7e8f('0x95')][_0x7e8f('0x99')]){return db['User']['find']({'attributes':['id',_0x7e8f('0x3c')],'where':{'id':_0x5f410b[_0x7e8f('0x95')][_0x7e8f('0x99')]}})[_0x7e8f('0x20')](function(_0x4c8e51){if(_0x4c8e51){_0x5f410b[_0x7e8f('0x89')][_0x7e8f('0x9a')]({'id':0x0,'priority':0x0,'app':_0x7e8f('0x9b'),'appdata':_0x4c8e51['name']+','+(_0x5f410b[_0x7e8f('0x88')]['waitForTheAssignedAgent']||0xa),'interval':_0x7e8f('0x9c')});_0x5f410b[_0x7e8f('0x9d')]=![];}return respondWithRpcPromise(_0x7e8f('0x9e'),_0x7e8f('0x9f'),_0x5f410b);});}return respondWithRpcPromise(_0x7e8f('0x9e'),_0x7e8f('0x9f'),_0x5f410b);})[_0x7e8f('0x20')](function(_0x21ca7d){respondWithRpcPromise(_0x7e8f('0xa0'),'EventManager',{'event':_0x7e8f('0x72'),'message':_0x21ca7d},client9002);return _0x21ca7d;})['then'](respondWithResult(_0x5f35f9,null))['catch'](handleError(_0x5f35f9,null));};exports[_0x7e8f('0xa1')]=function(_0x5b2dd9,_0x35a0d8){var _0x7455a6=_0x5b2dd9[_0x7e8f('0x57')]['id'];var _0x20319d=_0x5b2dd9['body'];var _0xc1add9=0xc8;var _0x18599e=null;return db[_0x7e8f('0xa2')][_0x7e8f('0xa3')]({'isolationLevel':db['sequelize'][_0x7e8f('0xa4')]['ISOLATION_LEVELS'][_0x7e8f('0xa5')]},function(_0x593d85){return db['OpenchannelAccount']['findOne']({'where':{'id':_0x7455a6},'transaction':_0x593d85})[_0x7e8f('0x20')](function(_0x2465ca){if(_0x2465ca){return db[_0x7e8f('0x86')][_0x7e8f('0x37')]({'where':{'OpenchannelAccountId':_0x7455a6},'transaction':_0x593d85})[_0x7e8f('0x20')](function(){var _0x5aff28=_['map'](_0x20319d,function(_0x1307a2){_0x1307a2['OpenchannelAccountId']=_0x7455a6;return _0x1307a2;});return db[_0x7e8f('0x86')][_0x7e8f('0xa6')](_0x5aff28,{'transaction':_0x593d85});});}else{_0xc1add9=0x194;_0x18599e=[];}});})[_0x7e8f('0x20')](function(){if(_0xc1add9!==0x194){return db[_0x7e8f('0x86')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0x7455a6},'order':_0x7e8f('0x8b')})[_0x7e8f('0x20')](function(_0x30cd8f){_0x18599e=_0x30cd8f;});}})['catch'](function(_0x5dd73c){_0xc1add9=0x1f4;logger['error'](_0x5dd73c[_0x7e8f('0x3b')]);if(_0x5dd73c[_0x7e8f('0x3c')]){delete _0x5dd73c['name'];}_0x18599e=_0x5dd73c;})[_0x7e8f('0xa7')](function(){if(_0x18599e===null){_0x35a0d8['sendStatus'](_0xc1add9);}else{if(_0xc1add9===0x1f4){_0x35a0d8[_0x7e8f('0x32')](_0xc1add9)['send'](_0x18599e);}else{_0x35a0d8[_0x7e8f('0x32')](_0xc1add9)[_0x7e8f('0x2d')](_0x18599e);}}});};exports[_0x7e8f('0xa8')]=function(_0x5b46c6,_0x306989,_0x53ad0e){var _0x18955a={};var _0x10a63a={};var _0x6037b7;var _0x206356;return db['OpenchannelAccount'][_0x7e8f('0x67')]({'where':{'id':_0x5b46c6['params']['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x306989,null))[_0x7e8f('0x20')](function(_0x3cd6cf){if(_0x3cd6cf){_0x6037b7=_0x3cd6cf;_0x10a63a[_0x7e8f('0x42')]=_[_0x7e8f('0x44')](db[_0x7e8f('0x86')][_0x7e8f('0x68')]);_0x10a63a['query']=_[_0x7e8f('0x44')](_0x5b46c6[_0x7e8f('0x43')]);_0x10a63a[_0x7e8f('0x45')]=_['intersection'](_0x10a63a[_0x7e8f('0x42')],_0x10a63a[_0x7e8f('0x43')]);_0x18955a['attributes']=_[_0x7e8f('0x47')](_0x10a63a[_0x7e8f('0x42')],qs[_0x7e8f('0x48')](_0x5b46c6['query'][_0x7e8f('0x48')]));_0x18955a[_0x7e8f('0x46')]=_0x18955a[_0x7e8f('0x46')][_0x7e8f('0x49')]?_0x18955a['attributes']:_0x10a63a[_0x7e8f('0x42')];_0x18955a[_0x7e8f('0x69')]=qs[_0x7e8f('0x4c')](_0x5b46c6[_0x7e8f('0x43')][_0x7e8f('0x4c')]);_0x18955a[_0x7e8f('0x4d')]=qs['filters'](_[_0x7e8f('0x4e')](_0x5b46c6['query'],_0x10a63a[_0x7e8f('0x45')]));if(_0x5b46c6[_0x7e8f('0x43')][_0x7e8f('0x51')]){_0x18955a[_0x7e8f('0x4d')]=_[_0x7e8f('0x58')](_0x18955a['where'],{'$or':_[_0x7e8f('0x40')](_0x18955a[_0x7e8f('0x46')],function(_0x1c3884){var _0x1b7110={};_0x1b7110[_0x1c3884]={'$like':'%'+_0x5b46c6['query']['filter']+'%'};return _0x1b7110;})});}_0x18955a=_[_0x7e8f('0x58')]({},_0x18955a,_0x5b46c6['options']);return _0x6037b7[_0x7e8f('0xa8')](_0x18955a);}})[_0x7e8f('0x20')](function(_0x32978d){if(_0x32978d){_0x206356=_0x32978d[_0x7e8f('0x49')];if(!_0x5b46c6[_0x7e8f('0x43')][_0x7e8f('0x4a')]('nolimit')){_0x18955a[_0x7e8f('0x30')]=qs[_0x7e8f('0x30')](_0x5b46c6[_0x7e8f('0x43')][_0x7e8f('0x30')]);_0x18955a[_0x7e8f('0x2e')]=qs['offset'](_0x5b46c6[_0x7e8f('0x43')]['offset']);}return _0x6037b7[_0x7e8f('0xa8')](_0x18955a);}})[_0x7e8f('0x20')](function(_0x1f1874){if(_0x1f1874){return _0x1f1874?{'count':_0x206356,'rows':_0x1f1874}:null;}})['then'](respondWithResult(_0x306989,null))['catch'](handleError(_0x306989,null));};exports[_0x7e8f('0xa9')]=function(_0x103b9d,_0x4b6c4e,_0xe0a51f){var _0x565a8d={'raw':![],'where':{}};var _0x4a4002={};var _0x8e1f70={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x7e8f('0x67')]({'where':{'id':_0x103b9d['params']['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x4b6c4e,null))[_0x7e8f('0x20')](function(_0xbc7b00){if(_0xbc7b00){_0x4a4002['model']=_[_0x7e8f('0x44')](db[_0x7e8f('0x8f')][_0x7e8f('0x68')]);_0x4a4002['query']=_[_0x7e8f('0x44')](_0x103b9d[_0x7e8f('0x43')]);_0x4a4002[_0x7e8f('0x45')]=_[_0x7e8f('0x47')](_0x4a4002[_0x7e8f('0x42')],_0x4a4002['query']);_0x565a8d[_0x7e8f('0x46')]=_[_0x7e8f('0x47')](_0x4a4002[_0x7e8f('0x42')],qs[_0x7e8f('0x48')](_0x103b9d[_0x7e8f('0x43')]['fields']));_0x565a8d[_0x7e8f('0x46')]=_0x565a8d[_0x7e8f('0x46')][_0x7e8f('0x49')]?_0x565a8d[_0x7e8f('0x46')]:_0x4a4002['model'];if(!_0x103b9d['query'][_0x7e8f('0x4a')](_0x7e8f('0x4b'))){_0x565a8d[_0x7e8f('0x30')]=qs[_0x7e8f('0x30')](_0x103b9d['query']['limit']);_0x565a8d[_0x7e8f('0x2e')]=qs[_0x7e8f('0x2e')](_0x103b9d[_0x7e8f('0x43')][_0x7e8f('0x2e')]);}_0x565a8d[_0x7e8f('0x69')]=qs[_0x7e8f('0x4c')](_0x103b9d['query'][_0x7e8f('0x4c')]);_0x565a8d[_0x7e8f('0x4d')]=qs[_0x7e8f('0x45')](_[_0x7e8f('0x4e')](_0x103b9d[_0x7e8f('0x43')],_0x4a4002[_0x7e8f('0x45')]));_0x565a8d[_0x7e8f('0x4d')][_0x7e8f('0x6d')]=_0xbc7b00['id'];if(_0x103b9d['query']['filter']){_0x565a8d[_0x7e8f('0x4d')]=_['merge'](_0x565a8d[_0x7e8f('0x4d')],{'$or':_[_0x7e8f('0x40')](_0x565a8d[_0x7e8f('0x46')],function(_0x58118c){var _0x44fe5b={};_0x44fe5b[_0x58118c]={'$like':'%'+_0x103b9d['query'][_0x7e8f('0x51')]+'%'};return _0x44fe5b;})});}_0x565a8d=_[_0x7e8f('0x58')]({},_0x565a8d,_0x103b9d[_0x7e8f('0x52')]);return db[_0x7e8f('0x8f')][_0x7e8f('0x31')]({'where':_0x565a8d[_0x7e8f('0x4d')]})[_0x7e8f('0x20')](function(_0x4f574f){_0x8e1f70[_0x7e8f('0x31')]=_0x4f574f;if(_0x103b9d[_0x7e8f('0x43')]['includeAll']){_0x565a8d['include']=[{'model':db[_0x7e8f('0x74')],'as':_0x7e8f('0xaa'),'required':![]},{'model':db[_0x7e8f('0xab')],'as':_0x7e8f('0xac'),'attributes':[_0x7e8f('0x3c'),'fullname',_0x7e8f('0xad')],'required':![]},{'model':db['Tag'],'as':_0x7e8f('0xae'),'attributes':['id',_0x7e8f('0x3c'),_0x7e8f('0xaf')],'where':_0x103b9d[_0x7e8f('0x43')][_0x7e8f('0xb0')]?{'id':_0x103b9d['query'][_0x7e8f('0xb0')]}:undefined,'required':_0x103b9d[_0x7e8f('0x43')]['tag']?!![]:![]}];}return db[_0x7e8f('0x8f')][_0x7e8f('0x70')](_0x565a8d);})[_0x7e8f('0x20')](function(_0x2ef049){_0x8e1f70[_0x7e8f('0x71')]=_0x2ef049;return _0x8e1f70;});}})[_0x7e8f('0x20')](respondWithFilteredResult(_0x4b6c4e,_0x565a8d))[_0x7e8f('0x2b')](handleError(_0x4b6c4e,null));};exports[_0x7e8f('0xb1')]=function(_0x264f44,_0x2b3a01,_0x33802e){return db['OpenchannelAccount'][_0x7e8f('0x59')]({'where':{'id':_0x264f44[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x2b3a01,null))[_0x7e8f('0x20')](function(_0xab78f3){if(_0xab78f3){return _0xab78f3[_0x7e8f('0xb1')](_0x264f44[_0x7e8f('0x5b')][_0x7e8f('0x6b')],_[_0x7e8f('0xb2')](_0x264f44[_0x7e8f('0x5b')],[_0x7e8f('0x6b'),'id'])||{})[_0x7e8f('0x92')](function(_0x137be8){for(var _0x2ebcf4=0x0;_0x2ebcf4<_0x264f44[_0x7e8f('0x5b')][_0x7e8f('0x6b')][_0x7e8f('0x49')];_0x2ebcf4+=0x1){socket[_0x7e8f('0xb3')](_0x7e8f('0xb4'),{'UserId':Number(_0x264f44[_0x7e8f('0x5b')][_0x7e8f('0x6b')][_0x2ebcf4]),'OpenchannelAccountId':Number(_0x264f44['params']['id'])});}return _0x137be8;});}})['then'](respondWithResult(_0x2b3a01,null))[_0x7e8f('0x2b')](handleError(_0x2b3a01,null));};exports[_0x7e8f('0xb5')]=function(_0x29bc57,_0xd30171,_0xabc493){return db[_0x7e8f('0x53')][_0x7e8f('0x59')]({'where':{'id':_0x29bc57[_0x7e8f('0x57')]['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0xd30171,null))[_0x7e8f('0x20')](function(_0x58ac47){if(_0x58ac47){return _0x58ac47[_0x7e8f('0xb5')](_0x29bc57[_0x7e8f('0x43')][_0x7e8f('0x6b')])[_0x7e8f('0x20')](function(){if(_[_0x7e8f('0xb6')](_0x29bc57['query']['ids'])){for(var _0x17290c=0x0;_0x17290c<_0x29bc57[_0x7e8f('0x43')][_0x7e8f('0x6b')][_0x7e8f('0x49')];_0x17290c+=0x1){socket[_0x7e8f('0xb3')](_0x7e8f('0xb7'),{'UserId':Number(_0x29bc57[_0x7e8f('0x43')]['ids'][_0x17290c]),'OpenchannelAccountId':Number(_0x29bc57['params']['id'])});}}else{socket['emit'](_0x7e8f('0xb7'),{'UserId':Number(_0x29bc57[_0x7e8f('0x43')]['ids']),'OpenchannelAccountId':Number(_0x29bc57[_0x7e8f('0x57')]['id'])});}});}})[_0x7e8f('0x20')](respondWithStatusCode(_0xd30171,null))[_0x7e8f('0x2b')](handleError(_0xd30171,null));};exports[_0x7e8f('0xb8')]=function(_0x3d6dc1,_0x4dcd2e,_0x16c2dc){var _0x46a0be={};var _0x530f4d={};var _0x49a2fd;var _0x4db93a;return db['OpenchannelAccount'][_0x7e8f('0x67')]({'where':{'id':_0x3d6dc1['params']['id']}})[_0x7e8f('0x20')](handleEntityNotFound(_0x4dcd2e,null))['then'](function(_0x2a026d){if(_0x2a026d){_0x49a2fd=_0x2a026d;_0x530f4d[_0x7e8f('0x42')]=_['keys'](db[_0x7e8f('0xab')]['rawAttributes']);_0x530f4d[_0x7e8f('0x43')]=_[_0x7e8f('0x44')](_0x3d6dc1['query']);_0x530f4d[_0x7e8f('0x45')]=_[_0x7e8f('0x47')](_0x530f4d[_0x7e8f('0x42')],_0x530f4d[_0x7e8f('0x43')]);_0x46a0be['attributes']=_['intersection'](_0x530f4d[_0x7e8f('0x42')],qs[_0x7e8f('0x48')](_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x48')]));_0x46a0be[_0x7e8f('0x46')]=_0x46a0be['attributes']['length']?_0x46a0be[_0x7e8f('0x46')]:_0x530f4d[_0x7e8f('0x42')];_0x46a0be[_0x7e8f('0x69')]=qs[_0x7e8f('0x4c')](_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x4c')]);_0x46a0be[_0x7e8f('0x4d')]=qs['filters'](_[_0x7e8f('0x4e')](_0x3d6dc1[_0x7e8f('0x43')],_0x530f4d[_0x7e8f('0x45')]));if(_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x51')]){_0x46a0be[_0x7e8f('0x4d')]=_[_0x7e8f('0x58')](_0x46a0be[_0x7e8f('0x4d')],{'$or':_[_0x7e8f('0x40')](_0x46a0be[_0x7e8f('0x46')],function(_0x13882f){var _0x7e6194={};_0x7e6194[_0x13882f]={'$like':'%'+_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x51')]+'%'};return _0x7e6194;})});}_0x46a0be=_['merge']({},_0x46a0be,_0x3d6dc1[_0x7e8f('0x52')]);return _0x49a2fd[_0x7e8f('0xb8')](_0x46a0be);}})[_0x7e8f('0x20')](function(_0x3027f8){if(_0x3027f8){_0x4db93a=_0x3027f8['length'];if(!_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x4a')](_0x7e8f('0x4b'))){_0x46a0be[_0x7e8f('0x30')]=qs[_0x7e8f('0x30')](_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x30')]);_0x46a0be[_0x7e8f('0x2e')]=qs[_0x7e8f('0x2e')](_0x3d6dc1[_0x7e8f('0x43')][_0x7e8f('0x2e')]);}return _0x49a2fd[_0x7e8f('0xb8')](_0x46a0be);}})['then'](function(_0x345fb8){if(_0x345fb8){return _0x345fb8?{'count':_0x4db93a,'rows':_0x345fb8}:null;}})[_0x7e8f('0x20')](respondWithResult(_0x4dcd2e,null))['catch'](handleError(_0x4dcd2e,null));};exports[_0x7e8f('0xb9')]=function(_0x4a0696,_0x26134e,_0x529385){var _0x1f9bd1,_0xf0db87,_0x347293;if(_[_0x7e8f('0x7d')](_0x4a0696['body']['body'])||_0x4a0696[_0x7e8f('0x5b')]['body']===''){throw new db[(_0x7e8f('0x7b'))][(_0x7e8f('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7e8f('0x7d')](_0x4a0696[_0x7e8f('0x5b')]['to'])){}_0x1f9bd1=_0x4a0696[_0x7e8f('0x5b')]['to'];return db['OpenchannelAccount'][_0x7e8f('0x67')]({'where':{'id':_0x4a0696[_0x7e8f('0x57')]['id']}})['then'](handleEntityNotFound(_0x26134e,null))[_0x7e8f('0x20')](function(_0x1dddae){if(_0x1dddae){return db[_0x7e8f('0x53')][_0x7e8f('0x59')]({'where':{'id':_0x1dddae['id']},'include':[{'model':db[_0x7e8f('0x82')],'as':_0x7e8f('0x83'),'include':[{'model':db[_0x7e8f('0x74')],'as':_0x7e8f('0x84'),'where':{[_0x1dddae[_0x7e8f('0x7f')]]:_0x1f9bd1},'limit':0x1,'order':[['updatedAt',_0x7e8f('0x85')]]}]}]})['then'](handleEntityNotFound(_0x26134e,null))['then'](function(_0x5a42fc){if(_0x5a42fc&&_0x5a42fc[_0x7e8f('0x83')]){_0xf0db87=_0x5a42fc['get']({'plain':!![]});if(_0xf0db87[_0x7e8f('0x83')]&&_0xf0db87[_0x7e8f('0x83')][_0x7e8f('0x84')]['length']){return _0xf0db87[_0x7e8f('0x83')][_0x7e8f('0x84')][0x0];}return db[_0x7e8f('0x74')][_0x7e8f('0x5a')](_[_0x7e8f('0x19')](_0x4a0696[_0x7e8f('0x5b')],{'firstName':_0x1f9bd1,[_0x5a42fc['mapKey']]:_0x1f9bd1,'phone':_0x1f9bd1,'ListId':_0xf0db87[_0x7e8f('0x79')]}));}})['then'](handleEntityNotFound(_0x26134e,null))[_0x7e8f('0x20')](function(_0x49da5b){if(_0x49da5b){_0x347293=_0x49da5b;return db[_0x7e8f('0x8f')][_0x7e8f('0x59')]({'where':{'ContactId':_0x347293['id'],'closed':![],'OpenchannelAccountId':_0xf0db87['id']}})[_0x7e8f('0x20')](function(_0x260879){if(_0x260879){return[_0x260879,![]];}return db[_0x7e8f('0x8f')][_0x7e8f('0x5a')]({'UserId':_0x4a0696[_0x7e8f('0x5e')]['id'],'ContactId':_0x347293['id'],'OpenchannelAccountId':_0xf0db87['id'],'lastMsgDirection':_0x7e8f('0xba'),'firstMsgDirection':'out','Messages':[_['merge'](_0x4a0696[_0x7e8f('0x5b')],{'read':![],'body':_0x4a0696[_0x7e8f('0x5b')][_0x7e8f('0x5b')],'OpenchannelAccountId':_0xf0db87['id'],'UserId':_0x4a0696[_0x7e8f('0x5e')]['id'],'ContactId':_0x347293['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x7e8f('0xbb')}]})['then'](function(_0x56ec2c){return[_0x56ec2c,!![]];});});}})['spread'](function(_0x14959b,_0x202fe5){if(_0x202fe5){return _0x14959b;}return db[_0x7e8f('0x98')][_0x7e8f('0x5a')](_[_0x7e8f('0x58')](_0x4a0696[_0x7e8f('0x5b')],{'read':![],'body':_0x4a0696[_0x7e8f('0x5b')][_0x7e8f('0x5b')],'OpenchannelAccountId':_0xf0db87['id'],'OpenchannelInteractionId':_0x14959b['id'],'UserId':_0x4a0696[_0x7e8f('0x5e')]['id'],'ContactId':_0x347293['id']}))['then'](function(_0x2d68e4){_0x14959b[_0x7e8f('0xbc')][_0x7e8f('0xbb')]=[];_0x14959b[_0x7e8f('0xbc')][_0x7e8f('0xbb')][_0x7e8f('0xbd')](_0x2d68e4[_0x7e8f('0xbc')]);return _0x14959b;});});}})[_0x7e8f('0x20')](respondWithResult(_0x26134e,null))[_0x7e8f('0x2b')](handleError(_0x26134e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e866708..c604c0a 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','update','emit'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var EventEmitter=require(_0x0a9e('0x0'));var OpenchannelAccount=require(_0x0a9e('0x1'))['db'][_0x0a9e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0a9e('0x3'),'afterDestroy':'remove'};function emitEvent(_0x333808){return function(_0x432180,_0x2ab90b,_0x991246){OpenchannelAccountEvents[_0x0a9e('0x4')](_0x333808+':'+_0x432180['id'],_0x432180);OpenchannelAccountEvents['emit'](_0x333808,_0x432180);_0x991246(null);};}for(var e in events){if(events[_0x0a9e('0x5')](e)){var event=events[e];OpenchannelAccount[_0x0a9e('0x6')](e,emitEvent(event));}}module[_0x0a9e('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x878f=['hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit'];(function(_0x37b0c6,_0x1ca047){var _0x1bfb91=function(_0x42ab94){while(--_0x42ab94){_0x37b0c6['push'](_0x37b0c6['shift']());}};_0x1bfb91(++_0x1ca047);}(_0x878f,0x173));var _0xf878=function(_0x1b91e1,_0x49c731){_0x1b91e1=_0x1b91e1-0x0;var _0x179231=_0x878f[_0x1b91e1];return _0x179231;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xf878('0x0'))['db'][_0xf878('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xf878('0x2')](0x0);var events={'afterCreate':_0xf878('0x3'),'afterUpdate':_0xf878('0x4'),'afterDestroy':_0xf878('0x5')};function emitEvent(_0x9e6783){return function(_0x45a37b,_0x240b48,_0xcf1927){OpenchannelAccountEvents[_0xf878('0x6')](_0x9e6783+':'+_0x45a37b['id'],_0x45a37b);OpenchannelAccountEvents['emit'](_0x9e6783,_0x45a37b);_0xcf1927(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xf878('0x7')](e,emitEvent(event));}}module[_0xf878('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 02516ea..05ca355 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(_0xcd37b6,_0x10e7ba){var _0xefe402=function(_0x5c9d09){while(--_0x5c9d09){_0xcd37b6['push'](_0xcd37b6['shift']());}};_0xefe402(++_0x10e7ba);}(_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 +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4bad70,_0x334ed3){var _0x2e5dbc=function(_0xd290aa){while(--_0xd290aa){_0x4bad70['push'](_0x4bad70['shift']());}};_0x2e5dbc(++_0x334ed3);}(_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 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 d93ceee..fc52c8b 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 _0x0713=['socket.io-emitter','./openchannelAccount.socket','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xfce478,_0x41b0e5){var _0x1a86bd=function(_0x5800b6){while(--_0x5800b6){_0xfce478['push'](_0xfce478['shift']());}};_0x1a86bd(++_0x41b0e5);}(_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});config[_0x3071('0xb')]=_[_0x3071('0xc')](config[_0x3071('0xb')],{'host':_0x3071('0xd'),'port':0x18eb});var socket=require(_0x3071('0xe'))(new Redis(config[_0x3071('0xb')]));require(_0x3071('0xf'))['register'](socket);function respondWithRpcPromise(_0x3457cd,_0x2610b4,_0x937259){return new BPromise(function(_0xff9a29,_0x1ce844){return client['request'](_0x3457cd,_0x937259)[_0x3071('0x10')](function(_0x11a7ee){logger[_0x3071('0x11')](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x2610b4,_0x3071('0x13'),JSON['stringify'](_0x11a7ee));if(_0x11a7ee[_0x3071('0x14')]){if(_0x11a7ee[_0x3071('0x14')]['code']===0x1f4){logger[_0x3071('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0x1ce844(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);return _0xff9a29(_0x11a7ee[_0x3071('0x14')][_0x3071('0x15')]);}else{logger['info'](_0x3071('0x12'),_0x2610b4,_0x3071('0x13'));_0xff9a29(_0x11a7ee[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x17aee2){logger[_0x3071('0x14')](_0x3071('0x12'),_0x2610b4,_0x17aee2);_0x1ce844(_0x17aee2);});});} \ No newline at end of file +var _0xe511=['jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x579fa4,_0x1911e0){_0x579fa4=_0x579fa4-0x0;var _0x514fa2=_0xe511[_0x579fa4];return _0x514fa2;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});config[_0x1e51('0xa')]=_['defaults'](config['redis'],{'host':_0x1e51('0xb'),'port':0x18eb});var socket=require(_0x1e51('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x1e51('0xd')](socket);function respondWithRpcPromise(_0x2712e0,_0x29da1f,_0x706e60){return new BPromise(function(_0x4241a6,_0x141e2e){return client['request'](_0x2712e0,_0x706e60)[_0x1e51('0xe')](function(_0xcdfa5d){logger[_0x1e51('0xf')](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));logger[_0x1e51('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x29da1f,_0x1e51('0x11'),JSON[_0x1e51('0x13')](_0xcdfa5d));if(_0xcdfa5d[_0x1e51('0x14')]){if(_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x15')]===0x1f4){logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x16')]);return _0x141e2e(_0xcdfa5d[_0x1e51('0x14')]['message']);}logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')]['message']);return _0x4241a6(_0xcdfa5d[_0x1e51('0x14')]['message']);}else{logger['info'](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));_0x4241a6(_0xcdfa5d[_0x1e51('0x17')][_0x1e51('0x16')]);}})[_0x1e51('0x18')](function(_0x3e4234){logger['error'](_0x1e51('0x10'),_0x29da1f,_0x3e4234);_0x141e2e(_0x3e4234);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 953af5b..88ad3a6 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 _0x5b05=['update','emit','removeListener','length','save','remove'];(function(_0x45aa68,_0x1156ce){var _0x2f1a03=function(_0x3af511){while(--_0x3af511){_0x45aa68['push'](_0x45aa68['shift']());}};_0x2f1a03(++_0x1156ce);}(_0x5b05,0x190));var _0x55b0=function(_0x2c7bd4,_0x322297){_0x2c7bd4=_0x2c7bd4-0x0;var _0x35a751=_0x5b05[_0x2c7bd4];return _0x35a751;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x55b0('0x0'),_0x55b0('0x1'),_0x55b0('0x2')];function createListener(_0x4148d8,_0x28c785){return function(_0x2925fe){_0x28c785[_0x55b0('0x3')](_0x4148d8,_0x2925fe);};}function removeListener(_0x43a880,_0x2cbf51){return function(){OpenchannelAccountEvents[_0x55b0('0x4')](_0x43a880,_0x2cbf51);};}exports['register']=function(_0x569adf){for(var _0x129898=0x0,_0xe0c407=events[_0x55b0('0x5')];_0x129898<_0xe0c407;_0x129898++){var _0x355e20=events[_0x129898];var _0xdf375f=createListener('openchannelAccount:'+_0x355e20,_0x569adf);OpenchannelAccountEvents['on'](_0x355e20,_0xdf375f);}}; \ No newline at end of file +var _0x98e1=['update','removeListener','register','length','save','remove'];(function(_0x2766b3,_0x343bcd){var _0x533720=function(_0x198a44){while(--_0x198a44){_0x2766b3['push'](_0x2766b3['shift']());}};_0x533720(++_0x343bcd);}(_0x98e1,0x160));var _0x198e=function(_0x25b85c,_0x1c3933){_0x25b85c=_0x25b85c-0x0;var _0x10f3ef=_0x98e1[_0x25b85c];return _0x10f3ef;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x198e('0x0'),_0x198e('0x1'),_0x198e('0x2')];function createListener(_0x1d1f36,_0x53fd68){return function(_0x300c4b){_0x53fd68['emit'](_0x1d1f36,_0x300c4b);};}function removeListener(_0x4a102f,_0x3bd989){return function(){OpenchannelAccountEvents[_0x198e('0x3')](_0x4a102f,_0x3bd989);};}exports[_0x198e('0x4')]=function(_0x317209){for(var _0x551d31=0x0,_0x545114=events[_0x198e('0x5')];_0x551d31<_0x545114;_0x551d31++){var _0x4d45d6=events[_0x551d31];var _0x3322c5=createListener('openchannelAccount:'+_0x4d45d6,_0x317209);OpenchannelAccountEvents['on'](_0x4d45d6,_0x3322c5);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 4ce6cf0..e7e7a26 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 _0x00a9=['get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller'];(function(_0x7645ed,_0x2f5b96){var _0x3005ab=function(_0x200be6){while(--_0x200be6){_0x7645ed['push'](_0x7645ed['shift']());}};_0x3005ab(++_0x2f5b96);}(_0x00a9,0xf0));var _0x900a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x00a9[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x900a('0x0'));var util=require(_0x900a('0x1'));var path=require(_0x900a('0x2'));var timeout=require('connect-timeout');var express=require(_0x900a('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x900a('0x4'));var interaction=require(_0x900a('0x5'));var config=require('../../config/environment');var controller=require(_0x900a('0x6'));router[_0x900a('0x7')]('/',auth['isAuthenticated'](),controller[_0x900a('0x8')]);router['get']('/:id',auth[_0x900a('0x9')](),controller[_0x900a('0xa')]);router[_0x900a('0xb')]('/',auth[_0x900a('0x9')](),controller[_0x900a('0xc')]);router[_0x900a('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x900a('0xe')]);router[_0x900a('0xf')](_0x900a('0x10'),auth[_0x900a('0x9')](),controller[_0x900a('0x11')]);module[_0x900a('0x12')]=router; \ No newline at end of file +var _0x3ffe=['isAuthenticated','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','index','/:id'];(function(_0x248682,_0x5af82e){var _0x51acb8=function(_0x139c2f){while(--_0x139c2f){_0x248682['push'](_0x248682['shift']());}};_0x51acb8(++_0x5af82e);}(_0x3ffe,0x138));var _0xe3ff=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x3ffe[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0xe3ff('0x0'));var util=require(_0xe3ff('0x1'));var path=require(_0xe3ff('0x2'));var timeout=require(_0xe3ff('0x3'));var express=require(_0xe3ff('0x4'));var router=express[_0xe3ff('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe3ff('0x6'));var interaction=require(_0xe3ff('0x7'));var config=require('../../config/environment');var controller=require(_0xe3ff('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xe3ff('0x9')]);router['get'](_0xe3ff('0xa'),auth[_0xe3ff('0xb')](),controller[_0xe3ff('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xe3ff('0xd')]);router[_0xe3ff('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xe3ff('0xf')]);router[_0xe3ff('0x10')](_0xe3ff('0xa'),auth[_0xe3ff('0xb')](),controller[_0xe3ff('0x11')]);module[_0xe3ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 94afe6f..7be31b7 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 _0xe53c=['STRING','*,*,*,*','exports','INTEGER','noop'];(function(_0x2e3a2c,_0x52ae45){var _0x1939b5=function(_0x3f0a4b){while(--_0x3f0a4b){_0x2e3a2c['push'](_0x2e3a2c['shift']());}};_0x1939b5(++_0x52ae45);}(_0xe53c,0x17e));var _0xce53=function(_0x23ed5d,_0x25c460){_0x23ed5d=_0x23ed5d-0x0;var _0x12fbdd=_0xe53c[_0x23ed5d];return _0x12fbdd;};'use strict';var Sequelize=require('sequelize');module[_0xce53('0x0')]={'priority':{'type':Sequelize[_0xce53('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xce53('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xce53('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xce53('0x4')}}; \ No newline at end of file +var _0x3dab=['STRING','noop','*,*,*,*','INTEGER'];(function(_0x2dae38,_0x148c46){var _0x568dc9=function(_0x37b98f){while(--_0x37b98f){_0x2dae38['push'](_0x2dae38['shift']());}};_0x568dc9(++_0x148c46);}(_0x3dab,0x157));var _0xb3da=function(_0x26104d,_0xfe0a1f){_0x26104d=_0x26104d-0x0;var _0x1c5b42=_0x3dab[_0x26104d];return _0x1c5b42;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xb3da('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xb3da('0x1')],'allowNull':![],'defaultValue':_0xb3da('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xb3da('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb3da('0x3')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9f4d6ce..60e4ad8 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 _0x225e=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','reject','save','then','sendStatus','error','name','send','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','rows','catch','show','includeAll','options','find','create','body','update','params','destroy','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils'];(function(_0x264b9b,_0xa1181e){var _0x4c7a0e=function(_0x4b77a0){while(--_0x4b77a0){_0x264b9b['push'](_0x264b9b['shift']());}};_0x4c7a0e(++_0xa1181e);}(_0x225e,0x10f));var _0xe225=function(_0x4feed0,_0x1eb034){_0x4feed0=_0x4feed0-0x0;var _0x3a8e74=_0x225e[_0x4feed0];return _0x3a8e74;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe225('0x0'));var zipdir=require(_0xe225('0x1'));var jsonpatch=require(_0xe225('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe225('0x3'));var Mustache=require(_0xe225('0x4'));var util=require(_0xe225('0x5'));var path=require(_0xe225('0x6'));var sox=require(_0xe225('0x7'));var csv=require(_0xe225('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe225('0x9'));var _=require(_0xe225('0xa'));var squel=require(_0xe225('0xb'));var crypto=require(_0xe225('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe225('0xd'));var toCsv=require(_0xe225('0x8'));var querystring=require(_0xe225('0xe'));var Papa=require(_0xe225('0xf'));var Redis=require('ioredis');var authService=require(_0xe225('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe225('0x11'));var hardwareService=require(_0xe225('0x12'));var logger=require('../../config/logger')(_0xe225('0x13'));var utils=require(_0xe225('0x14'));var config=require(_0xe225('0x15'));var licenseUtil=require(_0xe225('0x16'));var db=require(_0xe225('0x17'))['db'];function respondWithStatusCode(_0x547c6f,_0x2ee62c){_0x2ee62c=_0x2ee62c||0xcc;return function(_0x4516e6){if(_0x4516e6){return _0x547c6f['sendStatus'](_0x2ee62c);}return _0x547c6f[_0xe225('0x18')](_0x2ee62c)[_0xe225('0x19')]();};}function respondWithResult(_0x4939d2,_0x15dd97){_0x15dd97=_0x15dd97||0xc8;return function(_0x59ae83){if(_0x59ae83){return _0x4939d2[_0xe225('0x18')](_0x15dd97)[_0xe225('0x1a')](_0x59ae83);}};}function respondWithFilteredResult(_0x5ce112,_0x39c42b){return function(_0x4711be){if(_0x4711be){var _0x4655cd=typeof _0x39c42b[_0xe225('0x1b')]===_0xe225('0x1c')&&typeof _0x39c42b[_0xe225('0x1d')]===_0xe225('0x1c');var _0x421911=_0x4711be[_0xe225('0x1e')];var _0x162dff=_0x4655cd?0x0:_0x39c42b[_0xe225('0x1b')];var _0x427f75=_0x4655cd?_0x4711be[_0xe225('0x1e')]:_0x39c42b['offset']+_0x39c42b[_0xe225('0x1d')];var _0x335618;if(_0x427f75>=_0x421911){_0x427f75=_0x421911;_0x335618=0xc8;}else{_0x335618=0xce;}_0x5ce112[_0xe225('0x18')](_0x335618);return _0x5ce112['set']('Content-Range',_0x162dff+'-'+_0x427f75+'/'+_0x421911)[_0xe225('0x1a')](_0x4711be);}return null;};}function patchUpdates(_0xea0d3a){return function(_0x51fa0b){try{jsonpatch[_0xe225('0x1f')](_0x51fa0b,_0xea0d3a,!![]);}catch(_0x54c62e){return BPromise[_0xe225('0x20')](_0x54c62e);}return _0x51fa0b[_0xe225('0x21')]();};}function saveUpdates(_0x369e72,_0x326b9a){return function(_0x330166){if(_0x330166){return _0x330166['update'](_0x369e72)[_0xe225('0x22')](function(_0x1fe26f){return _0x1fe26f;});}return null;};}function removeEntity(_0x2e708f,_0x5b5237){return function(_0x317292){if(_0x317292){return _0x317292['destroy']()[_0xe225('0x22')](function(){_0x2e708f[_0xe225('0x18')](0xcc)[_0xe225('0x19')]();});}};}function handleEntityNotFound(_0xa22c9b,_0x4ffbc5){return function(_0x551212){if(!_0x551212){_0xa22c9b[_0xe225('0x23')](0x194);}return _0x551212;};}function handleError(_0x41e018,_0xfb0a00){_0xfb0a00=_0xfb0a00||0x1f4;return function(_0x4752a3){logger[_0xe225('0x24')](_0x4752a3['stack']);if(_0x4752a3[_0xe225('0x25')]){delete _0x4752a3['name'];}_0x41e018[_0xe225('0x18')](_0xfb0a00)[_0xe225('0x26')](_0x4752a3);};}exports['index']=function(_0x3b9f63,_0x4f0a83){var _0x302ad9={},_0x504d58={},_0x3c8493={'count':0x0,'rows':[]};var _0x31a179=_[_0xe225('0x27')](db[_0xe225('0x28')][_0xe225('0x29')],function(_0x52f80e){return{'name':_0x52f80e[_0xe225('0x2a')],'type':_0x52f80e[_0xe225('0x2b')][_0xe225('0x2c')]};});_0x504d58[_0xe225('0x2d')]=_[_0xe225('0x27')](_0x31a179,_0xe225('0x25'));_0x504d58[_0xe225('0x2e')]=_[_0xe225('0x2f')](_0x3b9f63['query']);_0x504d58[_0xe225('0x30')]=_[_0xe225('0x31')](_0x504d58['model'],_0x504d58[_0xe225('0x2e')]);_0x302ad9[_0xe225('0x32')]=_[_0xe225('0x31')](_0x504d58['model'],qs[_0xe225('0x33')](_0x3b9f63[_0xe225('0x2e')]['fields']));_0x302ad9[_0xe225('0x32')]=_0x302ad9[_0xe225('0x32')][_0xe225('0x34')]?_0x302ad9[_0xe225('0x32')]:_0x504d58[_0xe225('0x2d')];if(!_0x3b9f63[_0xe225('0x2e')][_0xe225('0x35')](_0xe225('0x36'))){_0x302ad9[_0xe225('0x1d')]=qs[_0xe225('0x1d')](_0x3b9f63['query'][_0xe225('0x1d')]);_0x302ad9[_0xe225('0x1b')]=qs[_0xe225('0x1b')](_0x3b9f63['query']['offset']);}_0x302ad9[_0xe225('0x37')]=qs[_0xe225('0x38')](_0x3b9f63['query']['sort']);_0x302ad9[_0xe225('0x39')]=qs[_0xe225('0x30')](_['pick'](_0x3b9f63[_0xe225('0x2e')],_0x504d58[_0xe225('0x30')]),_0x31a179);if(_0x3b9f63[_0xe225('0x2e')][_0xe225('0x3a')]){_0x302ad9[_0xe225('0x39')]=_[_0xe225('0x3b')](_0x302ad9[_0xe225('0x39')],{'$or':_[_0xe225('0x27')](_0x31a179,function(_0x52d4d5){if(_0x52d4d5[_0xe225('0x2b')]!==_0xe225('0x3c')){var _0x2ed68f={};_0x2ed68f[_0x52d4d5[_0xe225('0x25')]]={'$like':'%'+_0x3b9f63[_0xe225('0x2e')][_0xe225('0x3a')]+'%'};return _0x2ed68f;}})});}_0x302ad9=_[_0xe225('0x3b')]({},_0x302ad9,_0x3b9f63['options']);var _0x24df0a={'where':_0x302ad9['where']};return db[_0xe225('0x28')]['count'](_0x24df0a)[_0xe225('0x22')](function(_0x5588f2){_0x3c8493[_0xe225('0x1e')]=_0x5588f2;if(_0x3b9f63[_0xe225('0x2e')]['includeAll']){_0x302ad9[_0xe225('0x3d')]=[{'all':!![]}];}return db[_0xe225('0x28')]['findAll'](_0x302ad9);})[_0xe225('0x22')](function(_0x1b0aa8){_0x3c8493[_0xe225('0x3e')]=_0x1b0aa8;return _0x3c8493;})[_0xe225('0x22')](respondWithFilteredResult(_0x4f0a83,_0x302ad9))[_0xe225('0x3f')](handleError(_0x4f0a83,null));};exports[_0xe225('0x40')]=function(_0x337587,_0x5a02d8){var _0x544ac5={'raw':!![],'where':{'id':_0x337587['params']['id']}},_0xb68ec3={};_0xb68ec3[_0xe225('0x2d')]=_[_0xe225('0x2f')](db[_0xe225('0x28')][_0xe225('0x29')]);_0xb68ec3[_0xe225('0x2e')]=_[_0xe225('0x2f')](_0x337587['query']);_0xb68ec3[_0xe225('0x30')]=_[_0xe225('0x31')](_0xb68ec3[_0xe225('0x2d')],_0xb68ec3[_0xe225('0x2e')]);_0x544ac5[_0xe225('0x32')]=_[_0xe225('0x31')](_0xb68ec3[_0xe225('0x2d')],qs['fields'](_0x337587['query']['fields']));_0x544ac5[_0xe225('0x32')]=_0x544ac5[_0xe225('0x32')][_0xe225('0x34')]?_0x544ac5[_0xe225('0x32')]:_0xb68ec3['model'];if(_0x337587[_0xe225('0x2e')][_0xe225('0x41')]){_0x544ac5[_0xe225('0x3d')]=[{'all':!![]}];}_0x544ac5=_[_0xe225('0x3b')]({},_0x544ac5,_0x337587[_0xe225('0x42')]);return db['OpenchannelApplication'][_0xe225('0x43')](_0x544ac5)[_0xe225('0x22')](handleEntityNotFound(_0x5a02d8,null))['then'](respondWithResult(_0x5a02d8,null))[_0xe225('0x3f')](handleError(_0x5a02d8,null));};exports['create']=function(_0x5cd1b9,_0x47893d){return db[_0xe225('0x28')][_0xe225('0x44')](_0x5cd1b9[_0xe225('0x45')],{})[_0xe225('0x22')](respondWithResult(_0x47893d,0xc9))[_0xe225('0x3f')](handleError(_0x47893d,null));};exports[_0xe225('0x46')]=function(_0x2dc6e0,_0x8919ed){if(_0x2dc6e0[_0xe225('0x45')]['id']){delete _0x2dc6e0['body']['id'];}return db[_0xe225('0x28')][_0xe225('0x43')]({'where':{'id':_0x2dc6e0[_0xe225('0x47')]['id']}})[_0xe225('0x22')](handleEntityNotFound(_0x8919ed,null))[_0xe225('0x22')](saveUpdates(_0x2dc6e0[_0xe225('0x45')],null))['then'](respondWithResult(_0x8919ed,null))[_0xe225('0x3f')](handleError(_0x8919ed,null));};exports[_0xe225('0x48')]=function(_0xab90a,_0x1648b8){return db[_0xe225('0x28')][_0xe225('0x43')]({'where':{'id':_0xab90a[_0xe225('0x47')]['id']}})[_0xe225('0x22')](handleEntityNotFound(_0x1648b8,null))['then'](removeEntity(_0x1648b8,null))['catch'](handleError(_0x1648b8,null));}; \ No newline at end of file +var _0x5ea4=['send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelApplication','findAll','catch','params','length','includeAll','include','create','body','find','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','destroy','then','sendStatus','error','name'];(function(_0x3960a3,_0x5e59b8){var _0x2e103b=function(_0x1255a1){while(--_0x1255a1){_0x3960a3['push'](_0x3960a3['shift']());}};_0x2e103b(++_0x5e59b8);}(_0x5ea4,0x69));var _0x45ea=function(_0x12ce2d,_0x27d02d){_0x12ce2d=_0x12ce2d-0x0;var _0x199ccf=_0x5ea4[_0x12ce2d];return _0x199ccf;};'use strict';var emlformat=require(_0x45ea('0x0'));var rimraf=require(_0x45ea('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x45ea('0x2'));var BPromise=require(_0x45ea('0x3'));var Mustache=require(_0x45ea('0x4'));var util=require(_0x45ea('0x5'));var path=require(_0x45ea('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x45ea('0x7'));var fs=require('fs');var fs_extra=require(_0x45ea('0x8'));var _=require('lodash');var squel=require(_0x45ea('0x9'));var crypto=require(_0x45ea('0xa'));var jsforce=require(_0x45ea('0xb'));var deskjs=require(_0x45ea('0xc'));var toCsv=require(_0x45ea('0xd'));var querystring=require(_0x45ea('0xe'));var Papa=require('papaparse');var Redis=require(_0x45ea('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x45ea('0x10'));var hardwareService=require(_0x45ea('0x11'));var logger=require('../../config/logger')(_0x45ea('0x12'));var utils=require(_0x45ea('0x13'));var config=require(_0x45ea('0x14'));var licenseUtil=require(_0x45ea('0x15'));var db=require(_0x45ea('0x16'))['db'];function respondWithStatusCode(_0x30c246,_0x1c15f2){_0x1c15f2=_0x1c15f2||0xcc;return function(_0x2d31f1){if(_0x2d31f1){return _0x30c246['sendStatus'](_0x1c15f2);}return _0x30c246[_0x45ea('0x17')](_0x1c15f2)[_0x45ea('0x18')]();};}function respondWithResult(_0x44bb69,_0x30e07b){_0x30e07b=_0x30e07b||0xc8;return function(_0x17d077){if(_0x17d077){return _0x44bb69[_0x45ea('0x17')](_0x30e07b)[_0x45ea('0x19')](_0x17d077);}};}function respondWithFilteredResult(_0x3eaf89,_0xedb8d4){return function(_0x4c3c02){if(_0x4c3c02){var _0x374921=typeof _0xedb8d4[_0x45ea('0x1a')]===_0x45ea('0x1b')&&typeof _0xedb8d4['limit']===_0x45ea('0x1b');var _0x148de8=_0x4c3c02['count'];var _0x342797=_0x374921?0x0:_0xedb8d4[_0x45ea('0x1a')];var _0x4fd553=_0x374921?_0x4c3c02[_0x45ea('0x1c')]:_0xedb8d4['offset']+_0xedb8d4[_0x45ea('0x1d')];var _0x3e1b2e;if(_0x4fd553>=_0x148de8){_0x4fd553=_0x148de8;_0x3e1b2e=0xc8;}else{_0x3e1b2e=0xce;}_0x3eaf89[_0x45ea('0x17')](_0x3e1b2e);return _0x3eaf89[_0x45ea('0x1e')]('Content-Range',_0x342797+'-'+_0x4fd553+'/'+_0x148de8)[_0x45ea('0x19')](_0x4c3c02);}return null;};}function patchUpdates(_0x285f40){return function(_0x2a1d5c){try{jsonpatch[_0x45ea('0x1f')](_0x2a1d5c,_0x285f40,!![]);}catch(_0x210d31){return BPromise['reject'](_0x210d31);}return _0x2a1d5c[_0x45ea('0x20')]();};}function saveUpdates(_0x36a871,_0x44746e){return function(_0x664326){if(_0x664326){return _0x664326[_0x45ea('0x21')](_0x36a871)['then'](function(_0x573808){return _0x573808;});}return null;};}function removeEntity(_0x170e72,_0x20f41d){return function(_0x125c5c){if(_0x125c5c){return _0x125c5c[_0x45ea('0x22')]()[_0x45ea('0x23')](function(){_0x170e72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f4b13,_0x4ce6cb){return function(_0x108e05){if(!_0x108e05){_0x4f4b13[_0x45ea('0x24')](0x194);}return _0x108e05;};}function handleError(_0x381c39,_0x450bcb){_0x450bcb=_0x450bcb||0x1f4;return function(_0x1fb68a){logger[_0x45ea('0x25')](_0x1fb68a['stack']);if(_0x1fb68a[_0x45ea('0x26')]){delete _0x1fb68a['name'];}_0x381c39[_0x45ea('0x17')](_0x450bcb)[_0x45ea('0x27')](_0x1fb68a);};}exports['index']=function(_0x3f1f9a,_0x4e237d){var _0x11dd32={},_0x1039bf={},_0x112aaa={'count':0x0,'rows':[]};var _0x48433e=_[_0x45ea('0x28')](db['OpenchannelApplication'][_0x45ea('0x29')],function(_0x1563a8){return{'name':_0x1563a8[_0x45ea('0x2a')],'type':_0x1563a8[_0x45ea('0x2b')][_0x45ea('0x2c')]};});_0x1039bf[_0x45ea('0x2d')]=_[_0x45ea('0x28')](_0x48433e,_0x45ea('0x26'));_0x1039bf[_0x45ea('0x2e')]=_[_0x45ea('0x2f')](_0x3f1f9a['query']);_0x1039bf[_0x45ea('0x30')]=_['intersection'](_0x1039bf[_0x45ea('0x2d')],_0x1039bf[_0x45ea('0x2e')]);_0x11dd32['attributes']=_[_0x45ea('0x31')](_0x1039bf[_0x45ea('0x2d')],qs['fields'](_0x3f1f9a[_0x45ea('0x2e')][_0x45ea('0x32')]));_0x11dd32[_0x45ea('0x33')]=_0x11dd32[_0x45ea('0x33')]['length']?_0x11dd32['attributes']:_0x1039bf[_0x45ea('0x2d')];if(!_0x3f1f9a[_0x45ea('0x2e')][_0x45ea('0x34')](_0x45ea('0x35'))){_0x11dd32['limit']=qs[_0x45ea('0x1d')](_0x3f1f9a[_0x45ea('0x2e')][_0x45ea('0x1d')]);_0x11dd32['offset']=qs[_0x45ea('0x1a')](_0x3f1f9a[_0x45ea('0x2e')]['offset']);}_0x11dd32[_0x45ea('0x36')]=qs[_0x45ea('0x37')](_0x3f1f9a[_0x45ea('0x2e')]['sort']);_0x11dd32['where']=qs[_0x45ea('0x30')](_[_0x45ea('0x38')](_0x3f1f9a['query'],_0x1039bf[_0x45ea('0x30')]),_0x48433e);if(_0x3f1f9a[_0x45ea('0x2e')][_0x45ea('0x39')]){_0x11dd32[_0x45ea('0x3a')]=_[_0x45ea('0x3b')](_0x11dd32[_0x45ea('0x3a')],{'$or':_[_0x45ea('0x28')](_0x48433e,function(_0x2ab250){if(_0x2ab250[_0x45ea('0x2b')]!==_0x45ea('0x3c')){var _0x4613cb={};_0x4613cb[_0x2ab250[_0x45ea('0x26')]]={'$like':'%'+_0x3f1f9a[_0x45ea('0x2e')][_0x45ea('0x39')]+'%'};return _0x4613cb;}})});}_0x11dd32=_[_0x45ea('0x3b')]({},_0x11dd32,_0x3f1f9a[_0x45ea('0x3d')]);var _0x3cf692={'where':_0x11dd32[_0x45ea('0x3a')]};return db[_0x45ea('0x3e')][_0x45ea('0x1c')](_0x3cf692)[_0x45ea('0x23')](function(_0x31436f){_0x112aaa[_0x45ea('0x1c')]=_0x31436f;if(_0x3f1f9a[_0x45ea('0x2e')]['includeAll']){_0x11dd32['include']=[{'all':!![]}];}return db[_0x45ea('0x3e')][_0x45ea('0x3f')](_0x11dd32);})[_0x45ea('0x23')](function(_0x482500){_0x112aaa['rows']=_0x482500;return _0x112aaa;})[_0x45ea('0x23')](respondWithFilteredResult(_0x4e237d,_0x11dd32))[_0x45ea('0x40')](handleError(_0x4e237d,null));};exports['show']=function(_0x4135ee,_0x4b9dc6){var _0xd4130d={'raw':!![],'where':{'id':_0x4135ee[_0x45ea('0x41')]['id']}},_0x118738={};_0x118738[_0x45ea('0x2d')]=_[_0x45ea('0x2f')](db[_0x45ea('0x3e')][_0x45ea('0x29')]);_0x118738['query']=_[_0x45ea('0x2f')](_0x4135ee[_0x45ea('0x2e')]);_0x118738['filters']=_[_0x45ea('0x31')](_0x118738[_0x45ea('0x2d')],_0x118738['query']);_0xd4130d[_0x45ea('0x33')]=_[_0x45ea('0x31')](_0x118738[_0x45ea('0x2d')],qs[_0x45ea('0x32')](_0x4135ee[_0x45ea('0x2e')][_0x45ea('0x32')]));_0xd4130d['attributes']=_0xd4130d[_0x45ea('0x33')][_0x45ea('0x42')]?_0xd4130d['attributes']:_0x118738['model'];if(_0x4135ee[_0x45ea('0x2e')][_0x45ea('0x43')]){_0xd4130d[_0x45ea('0x44')]=[{'all':!![]}];}_0xd4130d=_[_0x45ea('0x3b')]({},_0xd4130d,_0x4135ee[_0x45ea('0x3d')]);return db['OpenchannelApplication']['find'](_0xd4130d)[_0x45ea('0x23')](handleEntityNotFound(_0x4b9dc6,null))['then'](respondWithResult(_0x4b9dc6,null))[_0x45ea('0x40')](handleError(_0x4b9dc6,null));};exports[_0x45ea('0x45')]=function(_0x32ad2a,_0x9faa54){return db[_0x45ea('0x3e')]['create'](_0x32ad2a[_0x45ea('0x46')],{})[_0x45ea('0x23')](respondWithResult(_0x9faa54,0xc9))[_0x45ea('0x40')](handleError(_0x9faa54,null));};exports['update']=function(_0x4e11a9,_0xb4ad7e){if(_0x4e11a9[_0x45ea('0x46')]['id']){delete _0x4e11a9[_0x45ea('0x46')]['id'];}return db[_0x45ea('0x3e')][_0x45ea('0x47')]({'where':{'id':_0x4e11a9['params']['id']}})[_0x45ea('0x23')](handleEntityNotFound(_0xb4ad7e,null))[_0x45ea('0x23')](saveUpdates(_0x4e11a9[_0x45ea('0x46')],null))[_0x45ea('0x23')](respondWithResult(_0xb4ad7e,null))['catch'](handleError(_0xb4ad7e,null));};exports[_0x45ea('0x22')]=function(_0x56e1ec,_0x12bb86){return db['OpenchannelApplication'][_0x45ea('0x47')]({'where':{'id':_0x56e1ec[_0x45ea('0x41')]['id']}})[_0x45ea('0x23')](handleEntityNotFound(_0x12bb86,null))[_0x45ea('0x23')](removeEntity(_0x12bb86,null))[_0x45ea('0x40')](handleError(_0x12bb86,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 928020a..6595f1d 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 _0x96ed=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications'];(function(_0x1541c6,_0x170408){var _0x41901b=function(_0x517db0){while(--_0x517db0){_0x1541c6['push'](_0x1541c6['shift']());}};_0x41901b(++_0x170408);}(_0x96ed,0x6a));var _0xd96e=function(_0x54cd29,_0x36f6fb){_0x54cd29=_0x54cd29-0x0;var _0x25d484=_0x96ed[_0x54cd29];return _0x25d484;};'use strict';var _=require(_0xd96e('0x0'));var util=require(_0xd96e('0x1'));var logger=require(_0xd96e('0x2'))(_0xd96e('0x3'));var moment=require('moment');var BPromise=require(_0xd96e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd96e('0x5'));var config=require(_0xd96e('0x6'));var attributes=require(_0xd96e('0x7'));module['exports']=function(_0x1b4358,_0x3273bc){return _0x1b4358[_0xd96e('0x8')](_0xd96e('0x9'),attributes,{'tableName':_0xd96e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd96e('0xb'),'collate':_0xd96e('0xc')});}; \ No newline at end of file +var _0x7640=['./openchannelApplication.attributes','define','OpenchannelApplication','openchannel_applications','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment'];(function(_0x55d58f,_0x2bea83){var _0x1ad6e6=function(_0x31447e){while(--_0x31447e){_0x55d58f['push'](_0x55d58f['shift']());}};_0x1ad6e6(++_0x2bea83);}(_0x7640,0x16d));var _0x0764=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x7640[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x0764('0x0'));var util=require(_0x0764('0x1'));var logger=require(_0x0764('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0764('0x3'));var rp=require(_0x0764('0x4'));var fs=require('fs');var path=require(_0x0764('0x5'));var rimraf=require('rimraf');var config=require(_0x0764('0x6'));var attributes=require(_0x0764('0x7'));module['exports']=function(_0x57954a,_0x23a7ad){return _0x57954a[_0x0764('0x8')](_0x0764('0x9'),attributes,{'tableName':_0x0764('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0764('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index caf3dd1..58e7d6e 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 _0x248c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','attributes','limit','then','debug','lodash','util'];(function(_0x39d872,_0x56f195){var _0x4f6471=function(_0x591f88){while(--_0x591f88){_0x39d872['push'](_0x39d872['shift']());}};_0x4f6471(++_0x56f195);}(_0x248c,0x1de));var _0xc248=function(_0x141448,_0x188873){_0x141448=_0x141448-0x0;var _0x5e5ddd=_0x248c[_0x141448];return _0x5e5ddd;};'use strict';var _=require(_0xc248('0x0'));var util=require(_0xc248('0x1'));var moment=require(_0xc248('0x2'));var BPromise=require(_0xc248('0x3'));var rs=require(_0xc248('0x4'));var fs=require('fs');var Redis=require(_0xc248('0x5'));var db=require(_0xc248('0x6'))['db'];var utils=require(_0xc248('0x7'));var logger=require(_0xc248('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc248('0x9'));var client=jayson[_0xc248('0xa')][_0xc248('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3fdf1c,_0x361761,_0x305f88){return new BPromise(function(_0x519d0e,_0x254283){return client[_0xc248('0xc')](_0x3fdf1c,_0x305f88)['then'](function(_0x1b2059){logger[_0xc248('0xd')](_0xc248('0xe'),_0x361761,_0xc248('0xf'));logger['debug']('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x361761,_0xc248('0xf'),JSON[_0xc248('0x10')](_0x1b2059));if(_0x1b2059[_0xc248('0x11')]){if(_0x1b2059[_0xc248('0x11')][_0xc248('0x12')]===0x1f4){logger[_0xc248('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x361761,_0x1b2059[_0xc248('0x11')][_0xc248('0x13')]);return _0x254283(_0x1b2059[_0xc248('0x11')]['message']);}logger[_0xc248('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x361761,_0x1b2059[_0xc248('0x11')][_0xc248('0x13')]);return _0x519d0e(_0x1b2059[_0xc248('0x11')][_0xc248('0x13')]);}else{logger['info'](_0xc248('0xe'),_0x361761,_0xc248('0xf'));_0x519d0e(_0x1b2059[_0xc248('0x14')][_0xc248('0x13')]);}})[_0xc248('0x15')](function(_0x5cccac){logger['error'](_0xc248('0xe'),_0x361761,_0x5cccac);_0x254283(_0x5cccac);});});}exports[_0xc248('0x16')]=function(_0x12627a){var _0x3dbab3=this;return new Promise(function(_0x378b30,_0x4f3557){return db[_0xc248('0x17')][_0xc248('0x18')](_0x12627a[_0xc248('0x19')],{'raw':_0x12627a[_0xc248('0x1a')]?_0x12627a['options'][_0xc248('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12627a[_0xc248('0x1a')]?_0x12627a[_0xc248('0x1a')]['where']||null:null,'attributes':_0x12627a[_0xc248('0x1a')]?_0x12627a[_0xc248('0x1a')][_0xc248('0x1c')]||null:null,'limit':_0x12627a[_0xc248('0x1a')]?_0x12627a[_0xc248('0x1a')][_0xc248('0x1d')]||null:null})[_0xc248('0x1e')](function(_0x5de8a4){logger[_0xc248('0xd')](_0xc248('0x16'),_0x12627a);logger[_0xc248('0x1f')](_0xc248('0x16'),_0x12627a,JSON[_0xc248('0x10')](_0x5de8a4));_0x378b30(_0x5de8a4);})[_0xc248('0x15')](function(_0x471eda){logger['error'](_0xc248('0x16'),_0x471eda[_0xc248('0x13')],_0x12627a);_0x4f3557(_0x3dbab3[_0xc248('0x11')](0x1f4,_0x471eda['message']));});});}; \ No newline at end of file +var _0xdd4b=['attributes','limit','UpdateOpenchannelApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','OpenchannelApplication','body','options','raw','where'];(function(_0x485db8,_0x428f85){var _0x413111=function(_0x2c93ce){while(--_0x2c93ce){_0x485db8['push'](_0x485db8['shift']());}};_0x413111(++_0x428f85);}(_0xdd4b,0xdc));var _0xbdd4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xdd4b[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xbdd4('0x0'));var util=require(_0xbdd4('0x1'));var moment=require(_0xbdd4('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdd4('0x3'));var fs=require('fs');var Redis=require(_0xbdd4('0x4'));var db=require(_0xbdd4('0x5'))['db'];var utils=require(_0xbdd4('0x6'));var logger=require(_0xbdd4('0x7'))(_0xbdd4('0x8'));var config=require(_0xbdd4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbdd4('0xa')][_0xbdd4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5033cd,_0x4b1faa,_0x658cfa){return new BPromise(function(_0x20a97b,_0x53e2c9){return client['request'](_0x5033cd,_0x658cfa)[_0xbdd4('0xc')](function(_0x30f325){logger[_0xbdd4('0xd')](_0xbdd4('0xe'),_0x4b1faa,_0xbdd4('0xf'));logger['debug'](_0xbdd4('0x10'),_0x4b1faa,_0xbdd4('0xf'),JSON[_0xbdd4('0x11')](_0x30f325));if(_0x30f325['error']){if(_0x30f325['error'][_0xbdd4('0x12')]===0x1f4){logger[_0xbdd4('0x13')](_0xbdd4('0xe'),_0x4b1faa,_0x30f325['error']['message']);return _0x53e2c9(_0x30f325[_0xbdd4('0x13')][_0xbdd4('0x14')]);}logger[_0xbdd4('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x4b1faa,_0x30f325['error']['message']);return _0x20a97b(_0x30f325[_0xbdd4('0x13')]['message']);}else{logger[_0xbdd4('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x4b1faa,_0xbdd4('0xf'));_0x20a97b(_0x30f325[_0xbdd4('0x15')][_0xbdd4('0x14')]);}})[_0xbdd4('0x16')](function(_0x53963c){logger[_0xbdd4('0x13')](_0xbdd4('0xe'),_0x4b1faa,_0x53963c);_0x53e2c9(_0x53963c);});});}exports['UpdateOpenchannelApplication']=function(_0x5f2600){var _0x321d99=this;return new Promise(function(_0x299549,_0x4a7f9a){return db[_0xbdd4('0x17')]['update'](_0x5f2600[_0xbdd4('0x18')],{'raw':_0x5f2600[_0xbdd4('0x19')]?_0x5f2600[_0xbdd4('0x19')][_0xbdd4('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f2600['options']?_0x5f2600[_0xbdd4('0x19')][_0xbdd4('0x1b')]||null:null,'attributes':_0x5f2600[_0xbdd4('0x19')]?_0x5f2600[_0xbdd4('0x19')][_0xbdd4('0x1c')]||null:null,'limit':_0x5f2600['options']?_0x5f2600[_0xbdd4('0x19')][_0xbdd4('0x1d')]||null:null})[_0xbdd4('0xc')](function(_0xe72883){logger[_0xbdd4('0xd')](_0xbdd4('0x1e'),_0x5f2600);logger['debug'](_0xbdd4('0x1e'),_0x5f2600,JSON[_0xbdd4('0x11')](_0xe72883));_0x299549(_0xe72883);})[_0xbdd4('0x16')](function(_0x58e865){logger[_0xbdd4('0x13')]('UpdateOpenchannelApplication',_0x58e865[_0xbdd4('0x14')],_0x5f2600);_0x4a7f9a(_0x321d99[_0xbdd4('0x13')](0x1f4,_0x58e865[_0xbdd4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 53b86ee..9bb018f 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 _0x9eba=['../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','put','openchannel','openchannelinteraction:update','/:id','openchannelinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x6942e0,_0x131e6d){var _0xb86490=function(_0x2fd5d7){while(--_0x2fd5d7){_0x6942e0['push'](_0x6942e0['shift']());}};_0xb86490(++_0x131e6d);}(_0x9eba,0x162));var _0xa9eb=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9eba[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xa9eb('0x0'));var util=require(_0xa9eb('0x1'));var path=require(_0xa9eb('0x2'));var timeout=require(_0xa9eb('0x3'));var express=require('express');var router=express[_0xa9eb('0x4')]();var fs_extra=require(_0xa9eb('0x5'));var auth=require(_0xa9eb('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa9eb('0x7'));var controller=require(_0xa9eb('0x8'));router[_0xa9eb('0x9')]('/',auth[_0xa9eb('0xa')](),controller['index']);router[_0xa9eb('0x9')]('/describe',auth[_0xa9eb('0xa')](),controller[_0xa9eb('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa9eb('0x9')](_0xa9eb('0xc'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0xd')]);router[_0xa9eb('0x9')](_0xa9eb('0xe'),auth[_0xa9eb('0xa')](),controller[_0xa9eb('0xf')]);router[_0xa9eb('0x10')]('/',auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x11')]);router['post'](_0xa9eb('0xc'),auth['isAuthenticated'](),controller[_0xa9eb('0x12')]);router[_0xa9eb('0x10')](_0xa9eb('0x13'),auth['isAuthenticated'](),interaction[_0xa9eb('0x14')]('openchannel',_0xa9eb('0x15')),controller['addTags']);router[_0xa9eb('0x16')]('/:id',auth[_0xa9eb('0xa')](),interaction[_0xa9eb('0x14')](_0xa9eb('0x17'),_0xa9eb('0x18')),controller['update']);router['delete'](_0xa9eb('0x19'),auth[_0xa9eb('0xa')](),interaction[_0xa9eb('0x14')](_0xa9eb('0x17'),_0xa9eb('0x1a')),controller[_0xa9eb('0x1b')]);router['delete']('/:id/tags',auth[_0xa9eb('0xa')](),controller[_0xa9eb('0x1c')]);module[_0xa9eb('0x1d')]=router; \ No newline at end of file +var _0xd302=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','/:id','openchannel','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd302,0x140));var _0x2d30=function(_0x191647,_0x539ef3){_0x191647=_0x191647-0x0;var _0x4b808b=_0xd302[_0x191647];return _0x4b808b;};'use strict';var multer=require(_0x2d30('0x0'));var util=require(_0x2d30('0x1'));var path=require(_0x2d30('0x2'));var timeout=require(_0x2d30('0x3'));var express=require('express');var router=express[_0x2d30('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2d30('0x5'));var interaction=require(_0x2d30('0x6'));var config=require(_0x2d30('0x7'));var controller=require(_0x2d30('0x8'));router[_0x2d30('0x9')]('/',auth[_0x2d30('0xa')](),controller[_0x2d30('0xb')]);router['get'](_0x2d30('0xc'),auth['isAuthenticated'](),controller[_0x2d30('0xd')]);router[_0x2d30('0x9')]('/:id',auth[_0x2d30('0xa')](),controller[_0x2d30('0xe')]);router[_0x2d30('0x9')](_0x2d30('0xf'),auth[_0x2d30('0xa')](),controller['getMessages']);router[_0x2d30('0x9')](_0x2d30('0x10'),auth[_0x2d30('0xa')](),controller[_0x2d30('0x11')]);router[_0x2d30('0x12')]('/',auth[_0x2d30('0xa')](),controller['create']);router[_0x2d30('0x12')](_0x2d30('0xf'),auth[_0x2d30('0xa')](),controller[_0x2d30('0x13')]);router[_0x2d30('0x12')](_0x2d30('0x14'),auth[_0x2d30('0xa')](),interaction[_0x2d30('0x15')]('openchannel',_0x2d30('0x16')),controller[_0x2d30('0x17')]);router[_0x2d30('0x18')](_0x2d30('0x19'),auth[_0x2d30('0xa')](),interaction[_0x2d30('0x15')](_0x2d30('0x1a'),_0x2d30('0x1b')),controller[_0x2d30('0x1c')]);router['delete'](_0x2d30('0x19'),auth[_0x2d30('0xa')](),interaction[_0x2d30('0x15')](_0x2d30('0x1a'),_0x2d30('0x1d')),controller[_0x2d30('0x1e')]);router[_0x2d30('0x1f')]('/:id/tags',auth[_0x2d30('0xa')](),controller['removeTags']);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 5c7c9d2..6967b84 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 _0x6732=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0xc41365,_0x35d774){var _0x388102=function(_0x44a91a){while(--_0x44a91a){_0xc41365['push'](_0xc41365['shift']());}};_0x388102(++_0x35d774);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'closed':{'type':Sequelize[_0x2673('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2673('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2673('0x4')]},'thirdDisposition':{'type':Sequelize[_0x2673('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2673('0x3')]},'threadId':{'type':Sequelize[_0x2673('0x4')]},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x2673('0x5')]('in',_0x2673('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x2673('0x5')]('in',_0x2673('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x2673('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x2673('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xe64a=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x1ca0d5,_0x3960bd){var _0x3aad05=function(_0x163d9b){while(--_0x163d9b){_0x1ca0d5['push'](_0x1ca0d5['shift']());}};_0x3aad05(++_0x3960bd);}(_0xe64a,0x1e0));var _0xae64=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe64a[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0xae64('0x0'));module[_0xae64('0x1')]={'closed':{'type':Sequelize[_0xae64('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xae64('0x3')]},'disposition':{'type':Sequelize[_0xae64('0x4')]},'secondDisposition':{'type':Sequelize[_0xae64('0x4')]},'thirdDisposition':{'type':Sequelize[_0xae64('0x4')]},'note':{'type':Sequelize[_0xae64('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xae64('0x5')]('in',_0xae64('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xae64('0x5')]('in',_0xae64('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xae64('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xae64('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 02869c1..723995f 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 _0x578d=['.pdf','Openchannel','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','then','destroy','error','name','send','map','rawAttributes','type','getOptions','findAll','openchannel','user','catch','show','query','from','params','model','keys','OpenchannelInteraction','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','create','body','update','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','omit','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','tmp','attachments','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','push','OpenchannelAccount','Owner','get','mkdirSync','Account','fullname','N.A.','closedAt','disposition','threadId','basename','createReadStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-'];(function(_0x575a31,_0x56336f){var _0x5d7dad=function(_0x2c8c09){while(--_0x2c8c09){_0x575a31['push'](_0x575a31['shift']());}};_0x5d7dad(++_0x56336f);}(_0x578d,0x194));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require(_0xd578('0x0'));var zipdir=require(_0xd578('0x1'));var moment=require(_0xd578('0x2'));var util=require(_0xd578('0x3'));var path=require(_0xd578('0x4'));var ejs=require(_0xd578('0x5'));var fs=require('fs');var _=require(_0xd578('0x6'));var Redis=require(_0xd578('0x7'));var interaction=require(_0xd578('0x8'));var qs=require(_0xd578('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0xd578('0xa'))(_0xd578('0xb'));var config=require(_0xd578('0xc'));var db=require(_0xd578('0xd'))['db'];config['redis']=_[_0xd578('0xe')](config[_0xd578('0xf')],{'host':_0xd578('0x10'),'port':0x18eb});var socket=require(_0xd578('0x11'))(new Redis(config[_0xd578('0xf')]));require(_0xd578('0x12'))[_0xd578('0x13')](socket);function respondWithStatusCode(_0x4194b6,_0x20cad4){_0x20cad4=_0x20cad4||0xcc;return function(_0xafaf6b){if(_0xafaf6b){return _0x4194b6[_0xd578('0x14')](_0x20cad4);}return _0x4194b6[_0xd578('0x15')](_0x20cad4)[_0xd578('0x16')]();};}function respondWithResult(_0x63aea2,_0x458535){_0x458535=_0x458535||0xc8;return function(_0x276c8d){if(_0x276c8d){return _0x63aea2[_0xd578('0x15')](_0x458535)[_0xd578('0x17')](_0x276c8d);}};}function respondWithFilteredResult(_0x1f502e,_0x20ebc5){return function(_0x4eb03b){if(_0x4eb03b){var _0x1d73a3=typeof _0x20ebc5['offset']==='undefined'&&typeof _0x20ebc5['limit']===_0xd578('0x18');var _0x169494=_0x4eb03b[_0xd578('0x19')];var _0x291d6c=_0x1d73a3?0x0:_0x20ebc5[_0xd578('0x1a')];var _0x5a360d=_0x1d73a3?_0x4eb03b['count']:_0x20ebc5[_0xd578('0x1a')]+_0x20ebc5[_0xd578('0x1b')];var _0x1b9217;if(_0x5a360d>=_0x169494){_0x5a360d=_0x169494;_0x1b9217=0xc8;}else{_0x1b9217=0xce;}_0x1f502e[_0xd578('0x15')](_0x1b9217);return _0x1f502e[_0xd578('0x1c')](_0xd578('0x1d'),_0x291d6c+'-'+_0x5a360d+'/'+_0x169494)['json'](_0x4eb03b);}return null;};}function saveUpdates(_0x5b7081){return function(_0x27ca2c){if(_0x27ca2c){return _0x27ca2c['update'](_0x5b7081)[_0xd578('0x1e')](function(_0x1bc385){return _0x1bc385;});}return null;};}function removeEntity(_0x3ef380){return function(_0x515591){if(_0x515591){return _0x515591[_0xd578('0x1f')]()[_0xd578('0x1e')](function(){_0x3ef380[_0xd578('0x15')](0xcc)[_0xd578('0x16')]();});}};}function handleEntityNotFound(_0x1f2c2a){return function(_0x838063){if(!_0x838063){_0x1f2c2a[_0xd578('0x14')](0x194);}return _0x838063;};}function handleError(_0x54d5bc,_0x426d2b){_0x426d2b=_0x426d2b||0x1f4;return function(_0x2de2f3){logger[_0xd578('0x20')](_0x2de2f3['stack']);if(_0x2de2f3[_0xd578('0x21')]){delete _0x2de2f3['name'];}_0x54d5bc[_0xd578('0x15')](_0x426d2b)[_0xd578('0x22')](_0x2de2f3);};}exports['index']=function(_0x4fdc66,_0x1d51bc){var _0x22704a={};var _0x10ec7a=_[_0xd578('0x23')](db['OpenchannelInteraction'][_0xd578('0x24')],function(_0x4b8eb8){return{'name':_0x4b8eb8['fieldName'],'type':_0x4b8eb8[_0xd578('0x25')]['key']};});_0x22704a=qs[_0xd578('0x26')](_0x10ec7a,_0x4fdc66);return interaction[_0xd578('0x27')](_0xd578('0x28'),_0x4fdc66['query'],_0x4fdc66[_0xd578('0x29')],_0x22704a,_0x10ec7a)[_0xd578('0x1e')](respondWithFilteredResult(_0x1d51bc,_0x22704a))[_0xd578('0x2a')](handleError(_0x1d51bc,null));};exports[_0xd578('0x2b')]=function(_0x4bac00,_0x56729a){var _0x27f6f6={};if(_0x4bac00[_0xd578('0x2c')][_0xd578('0x25')]&&_0x4bac00[_0xd578('0x2c')][_0xd578('0x25')]==='from'){_0x27f6f6[_0xd578('0x2d')]=_0x4bac00[_0xd578('0x2e')]['id'];}else{_0x27f6f6['id']=_0x4bac00['params']['id'];}var _0x55ac6d={'raw':![],'where':_0x27f6f6},_0x1194d5={};_0x1194d5[_0xd578('0x2f')]=_[_0xd578('0x30')](db[_0xd578('0x31')]['rawAttributes']);_0x1194d5['query']=_[_0xd578('0x30')](_0x4bac00[_0xd578('0x2c')]);_0x1194d5[_0xd578('0x32')]=_['intersection'](_0x1194d5[_0xd578('0x2f')],_0x1194d5['query']);_0x55ac6d[_0xd578('0x33')]=_[_0xd578('0x34')](_0x1194d5['model'],qs['fields'](_0x4bac00[_0xd578('0x2c')][_0xd578('0x35')]));_0x55ac6d[_0xd578('0x33')]=_0x55ac6d[_0xd578('0x33')][_0xd578('0x36')]?_0x55ac6d[_0xd578('0x33')]:_0x1194d5['model'];if(_0x4bac00[_0xd578('0x2c')][_0xd578('0x37')]){_0x55ac6d[_0xd578('0x38')]=[{'all':!![]}];}_0x55ac6d=_[_0xd578('0x39')]({},_0x55ac6d,_0x4bac00[_0xd578('0x3a')]);return db['OpenchannelInteraction'][_0xd578('0x3b')](_0x55ac6d)['then'](handleEntityNotFound(_0x56729a,null))[_0xd578('0x1e')](respondWithResult(_0x56729a,null))[_0xd578('0x2a')](handleError(_0x56729a,null));};exports[_0xd578('0x3c')]=function(_0xbea8e7,_0x37f34a){return db[_0xd578('0x31')][_0xd578('0x3c')](_0xbea8e7[_0xd578('0x3d')],{})[_0xd578('0x1e')](respondWithResult(_0x37f34a,0xc9))['catch'](handleError(_0x37f34a,null));};exports[_0xd578('0x3e')]=function(_0x5edb57,_0x38b6a9){if(_0x5edb57[_0xd578('0x3d')]['id']){delete _0x5edb57[_0xd578('0x3d')]['id'];}return db[_0xd578('0x31')][_0xd578('0x3b')]({'where':{'id':_0x5edb57['params']['id']}})[_0xd578('0x1e')](handleEntityNotFound(_0x38b6a9,null))['then'](saveUpdates(_0x5edb57[_0xd578('0x3d')],null))[_0xd578('0x1e')](respondWithResult(_0x38b6a9,null))[_0xd578('0x2a')](handleError(_0x38b6a9,null));};exports['destroy']=function(_0x5b09d5,_0x1b8e1d){return db['OpenchannelInteraction'][_0xd578('0x3b')]({'where':{'id':_0x5b09d5[_0xd578('0x2e')]['id']}})[_0xd578('0x1e')](handleEntityNotFound(_0x1b8e1d,null))[_0xd578('0x1e')](removeEntity(_0x1b8e1d,null))[_0xd578('0x2a')](handleError(_0x1b8e1d,null));};exports[_0xd578('0x3f')]=function(_0xa1975e,_0x536705){return db[_0xd578('0x31')][_0xd578('0x3f')]()[_0xd578('0x1e')](respondWithResult(_0x536705,null))[_0xd578('0x2a')](handleError(_0x536705,null));};exports[_0xd578('0x40')]=function(_0x4d248d,_0x3f4fbe){return db[_0xd578('0x41')][_0xd578('0x3b')]({'where':{'id':_0x4d248d['params']['id']}})['then'](handleEntityNotFound(_0x3f4fbe,null))[_0xd578('0x1e')](function(_0x95a701){if(_0x95a701){return _0x95a701['addMessage'](_0x4d248d[_0xd578('0x3d')]['ids'],_['omit'](_0x4d248d['body'],[_0xd578('0x42'),'id'])||{});}})[_0xd578('0x1e')](respondWithResult(_0x3f4fbe,null))[_0xd578('0x2a')](handleError(_0x3f4fbe,null));};exports[_0xd578('0x43')]=function(_0x21ddf5,_0x1e192e){var _0x19d6e6={'raw':![],'where':{}};var _0x32488f={};var _0x338e1b={'count':0x0,'rows':[]};return db[_0xd578('0x31')][_0xd578('0x44')]({'where':{'id':_0x21ddf5[_0xd578('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1e192e,null))['then'](function(_0x4a440c){if(_0x4a440c){_0x32488f[_0xd578('0x2f')]=_['keys'](db[_0xd578('0x41')][_0xd578('0x24')]);_0x32488f[_0xd578('0x2c')]=_[_0xd578('0x30')](_0x21ddf5[_0xd578('0x2c')]);_0x32488f[_0xd578('0x32')]=_[_0xd578('0x34')](_0x32488f[_0xd578('0x2f')],_0x32488f[_0xd578('0x2c')]);_0x19d6e6[_0xd578('0x33')]=_[_0xd578('0x34')](_0x32488f[_0xd578('0x2f')],qs[_0xd578('0x35')](_0x21ddf5['query']['fields']));_0x19d6e6[_0xd578('0x33')]=_0x19d6e6[_0xd578('0x33')][_0xd578('0x36')]?_0x19d6e6[_0xd578('0x33')]:_0x32488f['model'];if(!_0x21ddf5[_0xd578('0x2c')][_0xd578('0x45')](_0xd578('0x46'))){_0x19d6e6[_0xd578('0x1b')]=qs[_0xd578('0x1b')](_0x21ddf5[_0xd578('0x2c')][_0xd578('0x1b')]);_0x19d6e6[_0xd578('0x1a')]=qs[_0xd578('0x1a')](_0x21ddf5[_0xd578('0x2c')][_0xd578('0x1a')]);}_0x19d6e6[_0xd578('0x47')]=qs[_0xd578('0x48')](_0x21ddf5[_0xd578('0x2c')]['sort']);_0x19d6e6[_0xd578('0x49')]=qs[_0xd578('0x32')](_[_0xd578('0x4a')](_0x21ddf5[_0xd578('0x2c')],_0x32488f[_0xd578('0x32')]));_0x19d6e6[_0xd578('0x49')][_0xd578('0x4b')]=_0x4a440c['id'];if(_0x21ddf5[_0xd578('0x2c')][_0xd578('0x4c')]){_0x19d6e6[_0xd578('0x49')]=_[_0xd578('0x39')](_0x19d6e6[_0xd578('0x49')],{'$or':_[_0xd578('0x23')](_0x19d6e6[_0xd578('0x33')],function(_0x3d1020){var _0x1d3f86={};_0x1d3f86[_0x3d1020]={'$like':'%'+_0x21ddf5[_0xd578('0x2c')][_0xd578('0x4c')]+'%'};return _0x1d3f86;})});}if(_0x21ddf5['query'][_0xd578('0x4d')]){var _0x8c645e=_0x21ddf5['query'][_0xd578('0x4d')][_0xd578('0x4e')](',');var _0x4076bd={};_0x4076bd[_0x8c645e[0x0]]={'$gte':moment(_0x8c645e[0x1])[_0xd578('0x4f')](_0xd578('0x50'))};_0x19d6e6[_0xd578('0x49')]=_['merge'](_0x19d6e6[_0xd578('0x49')],_0x4076bd);}_0x19d6e6=_[_0xd578('0x39')]({},_0x19d6e6,_0x21ddf5[_0xd578('0x3a')]);return db[_0xd578('0x41')][_0xd578('0x19')]({'where':_0x19d6e6[_0xd578('0x49')]})['then'](function(_0x37f6ea){_0x338e1b['count']=_0x37f6ea;if(_0x21ddf5[_0xd578('0x2c')][_0xd578('0x37')]){_0x19d6e6[_0xd578('0x38')]=[{'all':!![]}];}return db[_0xd578('0x41')][_0xd578('0x27')](_0x19d6e6);})['then'](function(_0x36aaba){_0x338e1b['rows']=_0x36aaba;return _0x338e1b;});}})[_0xd578('0x1e')](respondWithFilteredResult(_0x1e192e,_0x19d6e6))[_0xd578('0x2a')](handleError(_0x1e192e,null));};exports[_0xd578('0x51')]=function(_0x4564a4,_0x523f23){return db[_0xd578('0x31')][_0xd578('0x3b')]({'where':{'id':_0x4564a4[_0xd578('0x2e')]['id']}})[_0xd578('0x1e')](handleEntityNotFound(_0x523f23,null))[_0xd578('0x1e')](function(_0x3f19ff){if(_0x3f19ff){return _0x3f19ff[_0xd578('0x52')](_0x4564a4[_0xd578('0x3d')][_0xd578('0x42')],_[_0xd578('0x53')](_0x4564a4[_0xd578('0x3d')],[_0xd578('0x42'),'id'])||{})[_0xd578('0x54')](function(){return db[_0xd578('0x55')][_0xd578('0x27')]({'attributes':['id','name',_0xd578('0x56')],'where':{'id':_0x4564a4[_0xd578('0x3d')]['ids']}});})[_0xd578('0x1e')](function(_0x5e677b){socket[_0xd578('0x57')](_0xd578('0x58'),{'id':Number(_0x4564a4[_0xd578('0x2e')]['id']),'tags':_0x5e677b||[]});return{'id':Number(_0x4564a4['params']['id']),'tags':_0x5e677b||[]};});}})[_0xd578('0x1e')](respondWithResult(_0x523f23,null))['catch'](handleError(_0x523f23,null));};exports[_0xd578('0x59')]=function(_0x4fa61d,_0x18eaaf){return db[_0xd578('0x31')]['find']({'where':{'id':_0x4fa61d['params']['id']}})['then'](handleEntityNotFound(_0x18eaaf,null))[_0xd578('0x1e')](function(_0x454045){if(_0x454045){return _0x454045[_0xd578('0x59')](_0x4fa61d['query'][_0xd578('0x42')]);}})[_0xd578('0x1e')](respondWithStatusCode(_0x18eaaf,null))[_0xd578('0x2a')](handleError(_0x18eaaf,null));};exports['download']=function(_0x50ba97,_0x1b2f31){var _0x124ff6=moment()[_0xd578('0x5a')]()[_0xd578('0x5b')]();var _0x3949f2=path[_0xd578('0x5c')](config[_0xd578('0x5d')],_0xd578('0x5e'),'files',_0xd578('0x5f'));var _0x1f52aa=path[_0xd578('0x5c')](config[_0xd578('0x5d')],'server','files',_0xd578('0x60'));var _0x17a09d=path['join'](_0x3949f2,_0x124ff6);var _0xc25351=util[_0xd578('0x4f')](_0xd578('0x61'),_0x50ba97[_0xd578('0x2e')]['id'],_0x124ff6);var _0x33a259=path[_0xd578('0x5c')](_0x3949f2,_0xc25351);var _0x330718=[];_0x330718['push']({'model':db[_0xd578('0x62')],'as':_0xd578('0x62'),'attributes':['id','fullname'],'raw':!![]});_0x330718['push']({'model':db[_0xd578('0x63')],'as':_0xd578('0x64'),'attributes':['id',_0xd578('0x65'),_0xd578('0x66')],'raw':!![]});if(_0x50ba97[_0xd578('0x2c')][_0xd578('0x60')]){_0x330718['push']({'model':db[_0xd578('0x67')],'as':_0xd578('0x67'),'raw':!![]});}var _0x455d5b=[{'model':db[_0xd578('0x41')],'as':'Messages','attributes':['id',_0xd578('0x3d'),_0xd578('0x68'),_0xd578('0x69'),_0xd578('0x6a'),_0xd578('0x6b')],'include':_0x330718}];_0x455d5b[_0xd578('0x6c')]({'model':db[_0xd578('0x6d')],'as':'Account','attributes':['id',_0xd578('0x21')]});_0x455d5b['push']({'model':db[_0xd578('0x62')],'as':_0xd578('0x6e'),'attributes':['id','fullname']});return db[_0xd578('0x31')]['find']({'where':{'id':_0x50ba97[_0xd578('0x2e')]['id']},'include':_0x455d5b})[_0xd578('0x1e')](handleEntityNotFound(_0x1b2f31,null))[_0xd578('0x1e')](function(_0x5704b6){if(_0x5704b6){var _0x5a4e69=_0x5704b6[_0xd578('0x6f')]({'plain':!![]});fs[_0xd578('0x70')](_0x17a09d);var _0x53b6a3={'channel':'Openchannel','account':_0x5a4e69[_0xd578('0x71')][_0xd578('0x21')],'agent':_0x5a4e69['Owner']?_0x5a4e69[_0xd578('0x6e')][_0xd578('0x72')]:_0xd578('0x73'),'createdAt':moment(_0x5a4e69[_0xd578('0x68')])[_0xd578('0x4f')](_0xd578('0x50'))[_0xd578('0x5b')](),'closedAt':_0x5a4e69['closed']?moment(_0x5a4e69[_0xd578('0x74')])['format'](_0xd578('0x50'))[_0xd578('0x5b')]():'','disposition':_0x5a4e69[_0xd578('0x75')],'visibility':_0x5a4e69[_0xd578('0x76')]?'Public':'Private','messages':_(_0x5a4e69['Messages'])['filter']({'secret':![]})[_0xd578('0x23')](function(_0x5573dd){if(_0x5573dd[_0xd578('0x67')]){var _0x311917=path[_0xd578('0x5c')](_0x1f52aa,_0x5573dd[_0xd578('0x67')][_0xd578('0x77')]);if(fs['existsSync'](_0x311917)){fs[_0xd578('0x78')](_0x311917)['pipe'](fs['createWriteStream'](path[_0xd578('0x5c')](_0x17a09d,_0x5573dd[_0xd578('0x67')]['basename'])));}}return{'date':moment(_0x5573dd[_0xd578('0x68')])[_0xd578('0x4f')](_0xd578('0x50'))[_0xd578('0x5b')](),'sender':_0x5573dd[_0xd578('0x69')]===_0xd578('0x79')?_0x5573dd[_0xd578('0x62')]?_0x5573dd[_0xd578('0x62')][_0xd578('0x72')]:_0xd578('0x7a'):_0x5573dd['Contact'][_0xd578('0x65')]+(_0x5573dd[_0xd578('0x64')]['lastName']?'\x20'+_0x5573dd[_0xd578('0x64')]['lastName']:''),'body':_0x5573dd[_0xd578('0x67')]?_0x5573dd[_0xd578('0x67')][_0xd578('0x77')]:_0x5573dd['body'],'direction':_0x5573dd[_0xd578('0x69')]===_0xd578('0x79')?'A':'C','secret':_0x5573dd[_0xd578('0x6a')],'read':_0x5573dd[_0xd578('0x6b')],'attachment':_0x5573dd['Attachment']};})[_0xd578('0x7b')]()};return ejs[_0xd578('0x7c')](path[_0xd578('0x5c')](config['root'],_0xd578('0x5e'),_0xd578('0x7d'),_0xd578('0x7e')),{'interaction':_0x53b6a3})[_0xd578('0x1e')](function(_0x224e99){var _0x4defbb=path['join'](_0x17a09d,_0xd578('0x7f')+_0x5a4e69['id']+'-'+_0x124ff6+_0xd578('0x80'));var _0x478edb={'path':_0x4defbb,'channel':_0xd578('0x81'),'interactionId':_0x5a4e69['id']};return pdf[_0xd578('0x82')](_0x224e99,_0x478edb);})['then'](function(){return new Promise(function(_0x3ef641,_0x2ac3f0){zipdir(_0x17a09d,{'saveTo':_0x33a259},function(_0xd22e1e,_0x155d5b){if(_0xd22e1e)return _0x2ac3f0(_0xd22e1e);return _0x3ef641(_0x155d5b);});})[_0xd578('0x1e')](function(){return new Promise(function(_0x63ccd9,_0x231c3e){rimraf(_0x17a09d,function(_0x3761b4){if(_0x3761b4)_0x231c3e(_0x3761b4);return _0x63ccd9();});});})['then'](function(){return _0x1b2f31[_0xd578('0x83')](_0x33a259,_0xc25351,function(_0x1bc41d){if(_0x1bc41d){logger[_0xd578('0x20')](_0xd578('0x84'),_0x1bc41d);}else{fs['unlinkSync'](_0x33a259);}});});});}else{return _0x1b2f31[_0xd578('0x14')](0xc8);}})[_0xd578('0x2a')](handleError(_0x1b2f31,null));}; \ No newline at end of file +var _0x0280=['./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','update','then','destroy','error','name','send','map','fieldName','key','getOptions','findAll','openchannel','user','catch','show','query','type','params','keys','OpenchannelInteraction','rawAttributes','filters','intersection','model','attributes','fields','length','includeAll','merge','find','create','body','describe','OpenchannelMessage','addMessage','ids','omit','hasOwnProperty','nolimit','sort','where','OpenchannelInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','closed','closedAt','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','redis'];(function(_0x3591d0,_0x5e81d2){var _0x272882=function(_0x21300b){while(--_0x21300b){_0x3591d0['push'](_0x3591d0['shift']());}};_0x272882(++_0x5e81d2);}(_0x0280,0x72));var _0x0028=function(_0x15f694,_0x302bd3){_0x15f694=_0x15f694-0x0;var _0x108252=_0x0280[_0x15f694];return _0x108252;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x0028('0x0'));var moment=require(_0x0028('0x1'));var util=require(_0x0028('0x2'));var path=require(_0x0028('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0028('0x4'));var Redis=require(_0x0028('0x5'));var interaction=require(_0x0028('0x6'));var qs=require(_0x0028('0x7'));var pdf=require(_0x0028('0x8'));var logger=require(_0x0028('0x9'))(_0x0028('0xa'));var config=require('../../config/environment');var db=require(_0x0028('0xb'))['db'];config['redis']=_[_0x0028('0xc')](config[_0x0028('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0028('0xe'))[_0x0028('0xf')](socket);function respondWithStatusCode(_0x590062,_0x557323){_0x557323=_0x557323||0xcc;return function(_0x360092){if(_0x360092){return _0x590062[_0x0028('0x10')](_0x557323);}return _0x590062[_0x0028('0x11')](_0x557323)[_0x0028('0x12')]();};}function respondWithResult(_0x403134,_0x1eea49){_0x1eea49=_0x1eea49||0xc8;return function(_0x2f17b3){if(_0x2f17b3){return _0x403134[_0x0028('0x11')](_0x1eea49)['json'](_0x2f17b3);}};}function respondWithFilteredResult(_0x1c6de1,_0x599641){return function(_0x54f9a0){if(_0x54f9a0){var _0x42b3bc=typeof _0x599641[_0x0028('0x13')]===_0x0028('0x14')&&typeof _0x599641['limit']===_0x0028('0x14');var _0x3be6f4=_0x54f9a0[_0x0028('0x15')];var _0x18258b=_0x42b3bc?0x0:_0x599641['offset'];var _0x1e0d41=_0x42b3bc?_0x54f9a0[_0x0028('0x15')]:_0x599641[_0x0028('0x13')]+_0x599641[_0x0028('0x16')];var _0x481b01;if(_0x1e0d41>=_0x3be6f4){_0x1e0d41=_0x3be6f4;_0x481b01=0xc8;}else{_0x481b01=0xce;}_0x1c6de1['status'](_0x481b01);return _0x1c6de1[_0x0028('0x17')](_0x0028('0x18'),_0x18258b+'-'+_0x1e0d41+'/'+_0x3be6f4)[_0x0028('0x19')](_0x54f9a0);}return null;};}function saveUpdates(_0x3128b3){return function(_0x354f15){if(_0x354f15){return _0x354f15[_0x0028('0x1a')](_0x3128b3)[_0x0028('0x1b')](function(_0x308782){return _0x308782;});}return null;};}function removeEntity(_0x5e0f67){return function(_0xa34200){if(_0xa34200){return _0xa34200[_0x0028('0x1c')]()[_0x0028('0x1b')](function(){_0x5e0f67[_0x0028('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1939da){return function(_0x1a7a3b){if(!_0x1a7a3b){_0x1939da[_0x0028('0x10')](0x194);}return _0x1a7a3b;};}function handleError(_0xd8d9c8,_0x4f9429){_0x4f9429=_0x4f9429||0x1f4;return function(_0x551633){logger[_0x0028('0x1d')](_0x551633['stack']);if(_0x551633['name']){delete _0x551633[_0x0028('0x1e')];}_0xd8d9c8['status'](_0x4f9429)[_0x0028('0x1f')](_0x551633);};}exports['index']=function(_0x518a72,_0x4592e0){var _0xf408f3={};var _0x13f109=_[_0x0028('0x20')](db['OpenchannelInteraction']['rawAttributes'],function(_0x13cd1d){return{'name':_0x13cd1d[_0x0028('0x21')],'type':_0x13cd1d['type'][_0x0028('0x22')]};});_0xf408f3=qs[_0x0028('0x23')](_0x13f109,_0x518a72);return interaction[_0x0028('0x24')](_0x0028('0x25'),_0x518a72['query'],_0x518a72[_0x0028('0x26')],_0xf408f3,_0x13f109)[_0x0028('0x1b')](respondWithFilteredResult(_0x4592e0,_0xf408f3))[_0x0028('0x27')](handleError(_0x4592e0,null));};exports[_0x0028('0x28')]=function(_0x20520c,_0x390e31){var _0x42541c={};if(_0x20520c[_0x0028('0x29')][_0x0028('0x2a')]&&_0x20520c[_0x0028('0x29')][_0x0028('0x2a')]==='from'){_0x42541c['from']=_0x20520c[_0x0028('0x2b')]['id'];}else{_0x42541c['id']=_0x20520c[_0x0028('0x2b')]['id'];}var _0x5f319={'raw':![],'where':_0x42541c},_0x137d53={};_0x137d53['model']=_[_0x0028('0x2c')](db[_0x0028('0x2d')][_0x0028('0x2e')]);_0x137d53['query']=_[_0x0028('0x2c')](_0x20520c[_0x0028('0x29')]);_0x137d53[_0x0028('0x2f')]=_[_0x0028('0x30')](_0x137d53[_0x0028('0x31')],_0x137d53[_0x0028('0x29')]);_0x5f319[_0x0028('0x32')]=_[_0x0028('0x30')](_0x137d53['model'],qs[_0x0028('0x33')](_0x20520c[_0x0028('0x29')]['fields']));_0x5f319['attributes']=_0x5f319[_0x0028('0x32')][_0x0028('0x34')]?_0x5f319[_0x0028('0x32')]:_0x137d53['model'];if(_0x20520c[_0x0028('0x29')][_0x0028('0x35')]){_0x5f319['include']=[{'all':!![]}];}_0x5f319=_[_0x0028('0x36')]({},_0x5f319,_0x20520c['options']);return db[_0x0028('0x2d')][_0x0028('0x37')](_0x5f319)[_0x0028('0x1b')](handleEntityNotFound(_0x390e31,null))[_0x0028('0x1b')](respondWithResult(_0x390e31,null))['catch'](handleError(_0x390e31,null));};exports[_0x0028('0x38')]=function(_0xdc4415,_0x2bdda9){return db[_0x0028('0x2d')]['create'](_0xdc4415[_0x0028('0x39')],{})[_0x0028('0x1b')](respondWithResult(_0x2bdda9,0xc9))['catch'](handleError(_0x2bdda9,null));};exports['update']=function(_0x44571e,_0x5b4846){if(_0x44571e['body']['id']){delete _0x44571e[_0x0028('0x39')]['id'];}return db[_0x0028('0x2d')][_0x0028('0x37')]({'where':{'id':_0x44571e[_0x0028('0x2b')]['id']}})[_0x0028('0x1b')](handleEntityNotFound(_0x5b4846,null))[_0x0028('0x1b')](saveUpdates(_0x44571e[_0x0028('0x39')],null))[_0x0028('0x1b')](respondWithResult(_0x5b4846,null))['catch'](handleError(_0x5b4846,null));};exports['destroy']=function(_0x45fb5c,_0x49d2f0){return db[_0x0028('0x2d')][_0x0028('0x37')]({'where':{'id':_0x45fb5c[_0x0028('0x2b')]['id']}})[_0x0028('0x1b')](handleEntityNotFound(_0x49d2f0,null))[_0x0028('0x1b')](removeEntity(_0x49d2f0,null))['catch'](handleError(_0x49d2f0,null));};exports[_0x0028('0x3a')]=function(_0x210098,_0x24dd44){return db[_0x0028('0x2d')][_0x0028('0x3a')]()[_0x0028('0x1b')](respondWithResult(_0x24dd44,null))[_0x0028('0x27')](handleError(_0x24dd44,null));};exports['addMessage']=function(_0x43b382,_0x53a073){return db[_0x0028('0x3b')][_0x0028('0x37')]({'where':{'id':_0x43b382[_0x0028('0x2b')]['id']}})[_0x0028('0x1b')](handleEntityNotFound(_0x53a073,null))[_0x0028('0x1b')](function(_0x274337){if(_0x274337){return _0x274337[_0x0028('0x3c')](_0x43b382[_0x0028('0x39')][_0x0028('0x3d')],_[_0x0028('0x3e')](_0x43b382[_0x0028('0x39')],[_0x0028('0x3d'),'id'])||{});}})[_0x0028('0x1b')](respondWithResult(_0x53a073,null))[_0x0028('0x27')](handleError(_0x53a073,null));};exports['getMessages']=function(_0x59ab4d,_0x287ecd){var _0x1e9721={'raw':![],'where':{}};var _0x513b3d={};var _0x412acc={'count':0x0,'rows':[]};return db[_0x0028('0x2d')]['findOne']({'where':{'id':_0x59ab4d[_0x0028('0x2b')]['id']}})[_0x0028('0x1b')](handleEntityNotFound(_0x287ecd,null))[_0x0028('0x1b')](function(_0x60eb8b){if(_0x60eb8b){_0x513b3d['model']=_[_0x0028('0x2c')](db[_0x0028('0x3b')][_0x0028('0x2e')]);_0x513b3d[_0x0028('0x29')]=_[_0x0028('0x2c')](_0x59ab4d[_0x0028('0x29')]);_0x513b3d[_0x0028('0x2f')]=_[_0x0028('0x30')](_0x513b3d['model'],_0x513b3d[_0x0028('0x29')]);_0x1e9721['attributes']=_['intersection'](_0x513b3d[_0x0028('0x31')],qs['fields'](_0x59ab4d[_0x0028('0x29')]['fields']));_0x1e9721[_0x0028('0x32')]=_0x1e9721['attributes']['length']?_0x1e9721['attributes']:_0x513b3d[_0x0028('0x31')];if(!_0x59ab4d[_0x0028('0x29')][_0x0028('0x3f')](_0x0028('0x40'))){_0x1e9721['limit']=qs['limit'](_0x59ab4d['query']['limit']);_0x1e9721[_0x0028('0x13')]=qs[_0x0028('0x13')](_0x59ab4d[_0x0028('0x29')][_0x0028('0x13')]);}_0x1e9721['order']=qs[_0x0028('0x41')](_0x59ab4d['query'][_0x0028('0x41')]);_0x1e9721['where']=qs[_0x0028('0x2f')](_['pick'](_0x59ab4d[_0x0028('0x29')],_0x513b3d['filters']));_0x1e9721[_0x0028('0x42')][_0x0028('0x43')]=_0x60eb8b['id'];if(_0x59ab4d[_0x0028('0x29')]['filter']){_0x1e9721[_0x0028('0x42')]=_[_0x0028('0x36')](_0x1e9721[_0x0028('0x42')],{'$or':_[_0x0028('0x20')](_0x1e9721['attributes'],function(_0xff247a){var _0x3d4c76={};_0x3d4c76[_0xff247a]={'$like':'%'+_0x59ab4d[_0x0028('0x29')][_0x0028('0x44')]+'%'};return _0x3d4c76;})});}if(_0x59ab4d[_0x0028('0x29')][_0x0028('0x45')]){var _0x433d13=_0x59ab4d[_0x0028('0x29')][_0x0028('0x45')][_0x0028('0x46')](',');var _0xd80e36={};_0xd80e36[_0x433d13[0x0]]={'$gte':moment(_0x433d13[0x1])['format'](_0x0028('0x47'))};_0x1e9721[_0x0028('0x42')]=_[_0x0028('0x36')](_0x1e9721[_0x0028('0x42')],_0xd80e36);}_0x1e9721=_[_0x0028('0x36')]({},_0x1e9721,_0x59ab4d[_0x0028('0x48')]);return db['OpenchannelMessage']['count']({'where':_0x1e9721[_0x0028('0x42')]})[_0x0028('0x1b')](function(_0x592cfe){_0x412acc[_0x0028('0x15')]=_0x592cfe;if(_0x59ab4d[_0x0028('0x29')][_0x0028('0x35')]){_0x1e9721['include']=[{'all':!![]}];}return db[_0x0028('0x3b')][_0x0028('0x24')](_0x1e9721);})[_0x0028('0x1b')](function(_0x455104){_0x412acc[_0x0028('0x49')]=_0x455104;return _0x412acc;});}})[_0x0028('0x1b')](respondWithFilteredResult(_0x287ecd,_0x1e9721))['catch'](handleError(_0x287ecd,null));};exports[_0x0028('0x4a')]=function(_0x459877,_0x1e4d88){return db[_0x0028('0x2d')][_0x0028('0x37')]({'where':{'id':_0x459877[_0x0028('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1e4d88,null))['then'](function(_0x5c062f){if(_0x5c062f){return _0x5c062f[_0x0028('0x4b')](_0x459877['body']['ids'],_[_0x0028('0x3e')](_0x459877[_0x0028('0x39')],['ids','id'])||{})[_0x0028('0x4c')](function(){return db[_0x0028('0x4d')][_0x0028('0x24')]({'attributes':['id',_0x0028('0x1e'),_0x0028('0x4e')],'where':{'id':_0x459877[_0x0028('0x39')][_0x0028('0x3d')]}});})[_0x0028('0x1b')](function(_0x549573){socket[_0x0028('0x4f')](_0x0028('0x50'),{'id':Number(_0x459877['params']['id']),'tags':_0x549573||[]});return{'id':Number(_0x459877['params']['id']),'tags':_0x549573||[]};});}})[_0x0028('0x1b')](respondWithResult(_0x1e4d88,null))['catch'](handleError(_0x1e4d88,null));};exports[_0x0028('0x51')]=function(_0x47b3dc,_0x4cb2d9){return db[_0x0028('0x2d')]['find']({'where':{'id':_0x47b3dc['params']['id']}})[_0x0028('0x1b')](handleEntityNotFound(_0x4cb2d9,null))[_0x0028('0x1b')](function(_0x4223f2){if(_0x4223f2){return _0x4223f2[_0x0028('0x51')](_0x47b3dc[_0x0028('0x29')]['ids']);}})['then'](respondWithStatusCode(_0x4cb2d9,null))['catch'](handleError(_0x4cb2d9,null));};exports['download']=function(_0x408525,_0x20fa9e){var _0x2c1ffd=moment()['unix']()[_0x0028('0x52')]();var _0x466687=path[_0x0028('0x53')](config[_0x0028('0x54')],_0x0028('0x55'),_0x0028('0x56'),_0x0028('0x57'));var _0x58668e=path[_0x0028('0x53')](config['root'],_0x0028('0x55'),_0x0028('0x56'),_0x0028('0x58'));var _0x3dae78=path['join'](_0x466687,_0x2c1ffd);var _0x26b873=util[_0x0028('0x59')](_0x0028('0x5a'),_0x408525[_0x0028('0x2b')]['id'],_0x2c1ffd);var _0x4569f0=path[_0x0028('0x53')](_0x466687,_0x26b873);var _0x1e2458=[];_0x1e2458[_0x0028('0x5b')]({'model':db[_0x0028('0x5c')],'as':_0x0028('0x5c'),'attributes':['id',_0x0028('0x5d')],'raw':!![]});_0x1e2458[_0x0028('0x5b')]({'model':db[_0x0028('0x5e')],'as':_0x0028('0x5f'),'attributes':['id',_0x0028('0x60'),_0x0028('0x61')],'raw':!![]});if(_0x408525['query']['attachments']){_0x1e2458[_0x0028('0x5b')]({'model':db[_0x0028('0x62')],'as':'Attachment','raw':!![]});}var _0x1f6c47=[{'model':db[_0x0028('0x3b')],'as':_0x0028('0x63'),'attributes':['id','body',_0x0028('0x64'),_0x0028('0x65'),_0x0028('0x66'),_0x0028('0x67')],'include':_0x1e2458}];_0x1f6c47[_0x0028('0x5b')]({'model':db[_0x0028('0x68')],'as':_0x0028('0x69'),'attributes':['id',_0x0028('0x1e')]});_0x1f6c47[_0x0028('0x5b')]({'model':db[_0x0028('0x5c')],'as':'Owner','attributes':['id',_0x0028('0x5d')]});return db['OpenchannelInteraction'][_0x0028('0x37')]({'where':{'id':_0x408525[_0x0028('0x2b')]['id']},'include':_0x1f6c47})['then'](handleEntityNotFound(_0x20fa9e,null))[_0x0028('0x1b')](function(_0x270c71){if(_0x270c71){var _0x3b095a=_0x270c71[_0x0028('0x6a')]({'plain':!![]});fs[_0x0028('0x6b')](_0x3dae78);var _0x1b2777={'channel':_0x0028('0x6c'),'account':_0x3b095a[_0x0028('0x69')][_0x0028('0x1e')],'agent':_0x3b095a[_0x0028('0x6d')]?_0x3b095a[_0x0028('0x6d')][_0x0028('0x5d')]:'N.A.','createdAt':moment(_0x3b095a[_0x0028('0x64')])[_0x0028('0x59')](_0x0028('0x47'))[_0x0028('0x52')](),'closedAt':_0x3b095a[_0x0028('0x6e')]?moment(_0x3b095a[_0x0028('0x6f')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x0028('0x52')]():'','disposition':_0x3b095a['disposition'],'visibility':_0x3b095a[_0x0028('0x70')]?_0x0028('0x71'):_0x0028('0x72'),'messages':_(_0x3b095a['Messages'])['filter']({'secret':![]})[_0x0028('0x20')](function(_0x1b5c73){if(_0x1b5c73['Attachment']){var _0x8885ee=path[_0x0028('0x53')](_0x58668e,_0x1b5c73[_0x0028('0x62')][_0x0028('0x73')]);if(fs[_0x0028('0x74')](_0x8885ee)){fs[_0x0028('0x75')](_0x8885ee)[_0x0028('0x76')](fs[_0x0028('0x77')](path[_0x0028('0x53')](_0x3dae78,_0x1b5c73[_0x0028('0x62')]['basename'])));}}return{'date':moment(_0x1b5c73[_0x0028('0x64')])[_0x0028('0x59')](_0x0028('0x47'))[_0x0028('0x52')](),'sender':_0x1b5c73['direction']===_0x0028('0x78')?_0x1b5c73['User']?_0x1b5c73['User'][_0x0028('0x5d')]:_0x0028('0x79'):_0x1b5c73[_0x0028('0x5f')][_0x0028('0x60')]+(_0x1b5c73[_0x0028('0x5f')][_0x0028('0x61')]?'\x20'+_0x1b5c73[_0x0028('0x5f')][_0x0028('0x61')]:''),'body':_0x1b5c73[_0x0028('0x62')]?_0x1b5c73[_0x0028('0x62')][_0x0028('0x73')]:_0x1b5c73[_0x0028('0x39')],'direction':_0x1b5c73[_0x0028('0x65')]===_0x0028('0x78')?'A':'C','secret':_0x1b5c73['secret'],'read':_0x1b5c73[_0x0028('0x67')],'attachment':_0x1b5c73[_0x0028('0x62')]};})[_0x0028('0x7a')]()};return ejs['renderFile'](path['join'](config[_0x0028('0x54')],'server','views','downloadInteraction.ejs'),{'interaction':_0x1b2777})[_0x0028('0x1b')](function(_0x498ab9){var _0xab98c7=path[_0x0028('0x53')](_0x3dae78,_0x0028('0x7b')+_0x3b095a['id']+'-'+_0x2c1ffd+_0x0028('0x7c'));var _0x242c78={'path':_0xab98c7,'channel':_0x0028('0x6c'),'interactionId':_0x3b095a['id']};return pdf[_0x0028('0x7d')](_0x498ab9,_0x242c78);})[_0x0028('0x1b')](function(){return new Promise(function(_0x3dc84c,_0x2a84a6){zipdir(_0x3dae78,{'saveTo':_0x4569f0},function(_0x21e26c,_0x39ebe4){if(_0x21e26c)return _0x2a84a6(_0x21e26c);return _0x3dc84c(_0x39ebe4);});})[_0x0028('0x1b')](function(){return new Promise(function(_0x4ef653,_0x194e07){rimraf(_0x3dae78,function(_0xd6c726){if(_0xd6c726)_0x194e07(_0xd6c726);return _0x4ef653();});});})[_0x0028('0x1b')](function(){return _0x20fa9e['download'](_0x4569f0,_0x26b873,function(_0x264f5d){if(_0x264f5d){logger[_0x0028('0x1d')](_0x0028('0x7e'),_0x264f5d);}else{fs[_0x0028('0x7f')](_0x4569f0);}});});});}else{return _0x20fa9e[_0x0028('0x10')](0xc8);}})['catch'](handleError(_0x20fa9e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index f5a0dcf..f46294f 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 _0x5d0b=['update','remove','getUsers','setDataValue','Users','findAll','then','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0xd2faf3,_0x422544){var _0x586342=function(_0x1adc41){while(--_0x1adc41){_0xd2faf3['push'](_0xd2faf3['shift']());}};_0x586342(++_0x422544);}(_0x5d0b,0x12b));var _0xb5d0=function(_0x3e29e5,_0x1cd087){_0x3e29e5=_0x3e29e5-0x0;var _0x37f88a=_0x5d0b[_0x3e29e5];return _0x37f88a;};'use strict';var EventEmitter=require(_0xb5d0('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xb5d0('0x1')];var OpenchannelMessage=require(_0xb5d0('0x2'))['db'][_0xb5d0('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xb5d0('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb5d0('0x5'),'afterDestroy':_0xb5d0('0x6')};function emitEvent(_0x49df55){return function(_0x9e9638,_0x3fa786,_0x5f6077){_0x9e9638[_0xb5d0('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2de5c8){_0x9e9638[_0xb5d0('0x8')](_0xb5d0('0x9'),_0x2de5c8['map'](function(_0x22ee09){return{'id':_0x22ee09['id']};}));return OpenchannelMessage[_0xb5d0('0xa')]({'where':{'OpenchannelInteractionId':_0x9e9638['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb5d0('0xb')](function(_0x585068){_0x9e9638[_0xb5d0('0x8')](_0xb5d0('0xc'),_0x585068[_0xb5d0('0xd')]);OpenchannelInteractionEvents[_0xb5d0('0xe')](_0x49df55+':'+_0x9e9638['id'],_0x9e9638);OpenchannelInteractionEvents[_0xb5d0('0xe')](_0x49df55,_0x9e9638);_0x5f6077(null);})[_0xb5d0('0xf')](_0x5f6077(null));};}for(var e in events){if(events[_0xb5d0('0x10')](e)){var event=events[e];OpenchannelInteraction[_0xb5d0('0x11')](e,emitEvent(event));}}module[_0xb5d0('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xe924=['setMaxListeners','update','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','OpenchannelInteraction','../../mysqldb'];(function(_0x4e4519,_0x392ae){var _0x340044=function(_0x11721f){while(--_0x11721f){_0x4e4519['push'](_0x4e4519['shift']());}};_0x340044(++_0x392ae);}(_0xe924,0x162));var _0x4e92=function(_0x5d4ee0,_0x12edb2){_0x5d4ee0=_0x5d4ee0-0x0;var _0x139d94=_0xe924[_0x5d4ee0];return _0x139d94;};'use strict';var EventEmitter=require(_0x4e92('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4e92('0x1')];var OpenchannelMessage=require(_0x4e92('0x2'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4e92('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e92('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2ac6e2){return function(_0x56b38d,_0x435366,_0x367b72){_0x56b38d[_0x4e92('0x5')]({'attributes':['id'],'raw':!![]})[_0x4e92('0x6')](function(_0x56943b){_0x56b38d[_0x4e92('0x7')](_0x4e92('0x8'),_0x56943b[_0x4e92('0x9')](function(_0x528744){return{'id':_0x528744['id']};}));return OpenchannelMessage[_0x4e92('0xa')]({'where':{'OpenchannelInteractionId':_0x56b38d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e92('0x6')](function(_0x4bab7f){_0x56b38d[_0x4e92('0x7')](_0x4e92('0xb'),_0x4bab7f[_0x4e92('0xc')]);OpenchannelInteractionEvents[_0x4e92('0xd')](_0x2ac6e2+':'+_0x56b38d['id'],_0x56b38d);OpenchannelInteractionEvents['emit'](_0x2ac6e2,_0x56b38d);_0x367b72(null);})[_0x4e92('0xe')](_0x367b72(null));};}for(var e in events){if(events[_0x4e92('0xf')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0x4e92('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 8bb4f0f..db152c1 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 _0x97ee=['bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','utf8mb4_unicode_ci','changed','closed','closedAt','lodash','util','api','moment'];(function(_0x3f18a9,_0x1670b5){var _0x4a8de1=function(_0x53be10){while(--_0x53be10){_0x3f18a9['push'](_0x3f18a9['shift']());}};_0x4a8de1(++_0x1670b5);}(_0x97ee,0xfb));var _0xe97e=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x97ee[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xe97e('0x0'));var util=require(_0xe97e('0x1'));var logger=require('../../config/logger')(_0xe97e('0x2'));var moment=require(_0xe97e('0x3'));var BPromise=require(_0xe97e('0x4'));var rp=require(_0xe97e('0x5'));var fs=require('fs');var path=require(_0xe97e('0x6'));var rimraf=require(_0xe97e('0x7'));var config=require(_0xe97e('0x8'));var attributes=require(_0xe97e('0x9'));module[_0xe97e('0xa')]=function(_0x73d1dd,_0x23d684){return _0x73d1dd[_0xe97e('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0xe97e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xe97e('0xd'),'hooks':{'beforeUpdate':function(_0x32603b,_0x230340,_0x44e212){if(_0x32603b[_0xe97e('0xe')](_0xe97e('0xf'))){_0x32603b[_0xe97e('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x44e212(null,_0x32603b);}}});}; \ No newline at end of file +var _0xece1=['changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci'];(function(_0x46aed2,_0x5f2fd6){var _0x902489=function(_0x20fd85){while(--_0x20fd85){_0x46aed2['push'](_0x46aed2['shift']());}};_0x902489(++_0x5f2fd6);}(_0xece1,0xfc));var _0x1ece=function(_0x332133,_0x208113){_0x332133=_0x332133-0x0;var _0x2bfb2d=_0xece1[_0x332133];return _0x2bfb2d;};'use strict';var _=require(_0x1ece('0x0'));var util=require(_0x1ece('0x1'));var logger=require(_0x1ece('0x2'))(_0x1ece('0x3'));var moment=require('moment');var BPromise=require(_0x1ece('0x4'));var rp=require(_0x1ece('0x5'));var fs=require('fs');var path=require(_0x1ece('0x6'));var rimraf=require(_0x1ece('0x7'));var config=require(_0x1ece('0x8'));var attributes=require(_0x1ece('0x9'));module['exports']=function(_0x4e8e28,_0x1a24cc){return _0x4e8e28['define'](_0x1ece('0xa'),attributes,{'tableName':_0x1ece('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1ece('0xc'),'collate':_0x1ece('0xd'),'hooks':{'beforeUpdate':function(_0x59111f,_0x5a4e4e,_0x49ef62){if(_0x59111f[_0x1ece('0xe')](_0x1ece('0xf'))){_0x59111f[_0x1ece('0x10')]=moment()[_0x1ece('0x11')](_0x1ece('0x12'));}_0x49ef62(null,_0x59111f);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 706e82e..898577e 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 _0xeaba=['AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','omit'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xeaba,0x99));var _0xaeab=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xeaba[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xaeab('0x0'));var util=require(_0xaeab('0x1'));var moment=require(_0xaeab('0x2'));var BPromise=require('bluebird');var rs=require(_0xaeab('0x3'));var fs=require('fs');var Redis=require(_0xaeab('0x4'));var db=require(_0xaeab('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaeab('0x6'))(_0xaeab('0x7'));var config=require(_0xaeab('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaeab('0x9')][_0xaeab('0xa')]({'port':0x232a});config[_0xaeab('0xb')]=_[_0xaeab('0xc')](config[_0xaeab('0xb')],{'host':_0xaeab('0xd'),'port':0x18eb});var socket=require(_0xaeab('0xe'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x548b93,_0x3542b0,_0x4fa7ee){return new BPromise(function(_0x5801a3,_0x4375d8){return client['request'](_0x548b93,_0x4fa7ee)[_0xaeab('0xf')](function(_0x3969d9){logger[_0xaeab('0x10')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3542b0,_0xaeab('0x11'));logger[_0xaeab('0x12')](_0xaeab('0x13'),_0x3542b0,_0xaeab('0x11'),JSON[_0xaeab('0x14')](_0x3969d9));if(_0x3969d9[_0xaeab('0x15')]){if(_0x3969d9[_0xaeab('0x15')][_0xaeab('0x16')]===0x1f4){logger[_0xaeab('0x15')](_0xaeab('0x17'),_0x3542b0,_0x3969d9[_0xaeab('0x15')][_0xaeab('0x18')]);return _0x4375d8(_0x3969d9[_0xaeab('0x15')][_0xaeab('0x18')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x3542b0,_0x3969d9[_0xaeab('0x15')][_0xaeab('0x18')]);return _0x5801a3(_0x3969d9['error'][_0xaeab('0x18')]);}else{logger[_0xaeab('0x10')](_0xaeab('0x17'),_0x3542b0,'request\x20sent');_0x5801a3(_0x3969d9['result'][_0xaeab('0x18')]);}})[_0xaeab('0x19')](function(_0x4c8892){logger[_0xaeab('0x15')](_0xaeab('0x17'),_0x3542b0,_0x4c8892);_0x4375d8(_0x4c8892);});});}exports[_0xaeab('0x1a')]=function(_0x7297f2){var _0x1e3bad=this;return new Promise(function(_0x19fb54,_0x102029){return db[_0xaeab('0x1b')][_0xaeab('0x1c')](_0x7297f2['body'],{'raw':_0x7297f2[_0xaeab('0x1d')]?_0x7297f2[_0xaeab('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7297f2['options']?_0x7297f2['options']['where']||null:null,'attributes':_0x7297f2['options']?_0x7297f2[_0xaeab('0x1d')]['attributes']||null:null,'limit':_0x7297f2[_0xaeab('0x1d')]?_0x7297f2[_0xaeab('0x1d')]['limit']||null:null})[_0xaeab('0xf')](function(_0xcfce8e){logger[_0xaeab('0x10')](_0xaeab('0x1a'),_0x7297f2);logger[_0xaeab('0x12')]('UpdateOpenchannelInteraction',_0x7297f2,JSON['stringify'](_0xcfce8e));_0x19fb54(_0xcfce8e);})[_0xaeab('0x19')](function(_0x299bf4){logger[_0xaeab('0x15')](_0xaeab('0x1a'),_0x299bf4[_0xaeab('0x18')],_0x7297f2);_0x102029(_0x1e3bad['error'](0x1f4,_0x299bf4[_0xaeab('0x18')]));});});};exports[_0xaeab('0x1e')]=function(_0xad785){return new Promise(function(_0x426789,_0xd56694){return db[_0xaeab('0x1b')][_0xaeab('0x1f')]({'where':_0xad785['options']?_0xad785[_0xaeab('0x1d')][_0xaeab('0x20')]||null:null})[_0xaeab('0xf')](function(_0x4389c5){if(_0x4389c5){return _0x4389c5[_0xaeab('0x21')](_0xad785[_0xaeab('0x22')][_0xaeab('0x23')],_[_0xaeab('0x24')](_0xad785['body'],[_0xaeab('0x23'),'id'])||{});}})['spread'](function(_0x403603){logger[_0xaeab('0x10')]('AddTags',_0xad785);logger[_0xaeab('0x12')]('AddTags',_0xad785,JSON['stringify'](_0x403603));_0x426789(_0x403603);})[_0xaeab('0x19')](function(_0xe6e68b){logger[_0xaeab('0x15')](_0xaeab('0x25'),_0xe6e68b[_0xaeab('0x18')],_0xad785);_0xd56694(_this['error'](0x1f4,_0xe6e68b['message']));});});}; \ No newline at end of file +var _0x348f=['client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','info','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','limit','then','debug','find','addTags','ids','omit','spread','AddTags','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1de1ab,_0x20c351){var _0x5a7d9e=function(_0x3d0e48){while(--_0x3d0e48){_0x1de1ab['push'](_0x1de1ab['shift']());}};_0x5a7d9e(++_0x20c351);}(_0x348f,0x9d));var _0xf348=function(_0x50e0fe,_0x4330bc){_0x50e0fe=_0x50e0fe-0x0;var _0x5c479f=_0x348f[_0x50e0fe];return _0x5c479f;};'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(_0xf348('0x0'));var db=require(_0xf348('0x1'))['db'];var utils=require(_0xf348('0x2'));var logger=require(_0xf348('0x3'))(_0xf348('0x4'));var config=require(_0xf348('0x5'));var jayson=require(_0xf348('0x6'));var client=jayson[_0xf348('0x7')][_0xf348('0x8')]({'port':0x232a});config[_0xf348('0x9')]=_[_0xf348('0xa')](config[_0xf348('0x9')],{'host':_0xf348('0xb'),'port':0x18eb});var socket=require(_0xf348('0xc'))(new Redis(config[_0xf348('0x9')]));require(_0xf348('0xd'))['register'](socket);function respondWithRpcPromise(_0x29b877,_0x3212ac,_0x578238){return new BPromise(function(_0x3c1c91,_0x13b895){return client[_0xf348('0xe')](_0x29b877,_0x578238)['then'](function(_0x586801){logger[_0xf348('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3212ac,'request\x20sent');logger['debug'](_0xf348('0x10'),_0x3212ac,_0xf348('0x11'),JSON[_0xf348('0x12')](_0x586801));if(_0x586801[_0xf348('0x13')]){if(_0x586801[_0xf348('0x13')][_0xf348('0x14')]===0x1f4){logger[_0xf348('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x3212ac,_0x586801['error'][_0xf348('0x15')]);return _0x13b895(_0x586801[_0xf348('0x13')][_0xf348('0x15')]);}logger[_0xf348('0x13')](_0xf348('0x16'),_0x3212ac,_0x586801[_0xf348('0x13')]['message']);return _0x3c1c91(_0x586801[_0xf348('0x13')][_0xf348('0x15')]);}else{logger[_0xf348('0xf')](_0xf348('0x16'),_0x3212ac,_0xf348('0x11'));_0x3c1c91(_0x586801[_0xf348('0x17')][_0xf348('0x15')]);}})[_0xf348('0x18')](function(_0x2769e9){logger[_0xf348('0x13')](_0xf348('0x16'),_0x3212ac,_0x2769e9);_0x13b895(_0x2769e9);});});}exports[_0xf348('0x19')]=function(_0x311071){var _0x314150=this;return new Promise(function(_0x435e69,_0x4bc5bc){return db[_0xf348('0x1a')][_0xf348('0x1b')](_0x311071[_0xf348('0x1c')],{'raw':_0x311071[_0xf348('0x1d')]?_0x311071[_0xf348('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x311071[_0xf348('0x1d')]?_0x311071[_0xf348('0x1d')][_0xf348('0x1e')]||null:null,'attributes':_0x311071[_0xf348('0x1d')]?_0x311071['options'][_0xf348('0x1f')]||null:null,'limit':_0x311071[_0xf348('0x1d')]?_0x311071[_0xf348('0x1d')][_0xf348('0x20')]||null:null})[_0xf348('0x21')](function(_0x9dbaa6){logger['info'](_0xf348('0x19'),_0x311071);logger[_0xf348('0x22')]('UpdateOpenchannelInteraction',_0x311071,JSON[_0xf348('0x12')](_0x9dbaa6));_0x435e69(_0x9dbaa6);})['catch'](function(_0x1af9e0){logger[_0xf348('0x13')]('UpdateOpenchannelInteraction',_0x1af9e0[_0xf348('0x15')],_0x311071);_0x4bc5bc(_0x314150[_0xf348('0x13')](0x1f4,_0x1af9e0[_0xf348('0x15')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0xdd202a){return new Promise(function(_0x51c9ce,_0x35e413){return db[_0xf348('0x1a')][_0xf348('0x23')]({'where':_0xdd202a[_0xf348('0x1d')]?_0xdd202a[_0xf348('0x1d')][_0xf348('0x1e')]||null:null})[_0xf348('0x21')](function(_0x28be1a){if(_0x28be1a){return _0x28be1a[_0xf348('0x24')](_0xdd202a[_0xf348('0x1c')][_0xf348('0x25')],_[_0xf348('0x26')](_0xdd202a['body'],[_0xf348('0x25'),'id'])||{});}})[_0xf348('0x27')](function(_0x555d6f){logger[_0xf348('0xf')](_0xf348('0x28'),_0xdd202a);logger['debug'](_0xf348('0x28'),_0xdd202a,JSON['stringify'](_0x555d6f));_0x51c9ce(_0x555d6f);})[_0xf348('0x18')](function(_0x1e48a4){logger[_0xf348('0x13')](_0xf348('0x28'),_0x1e48a4[_0xf348('0x15')],_0xdd202a);_0x35e413(_this[_0xf348('0x13')](0x1f4,_0x1e48a4[_0xf348('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 71af9dc..ba5de45 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 _0x1e51=['./openchannelInteraction.events','save','remove','update','register','length','openchannelInteraction:'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x1e51,0x1f1));var _0x11e5=function(_0x4c0918,_0x2a4499){_0x4c0918=_0x4c0918-0x0;var _0x273018=_0x1e51[_0x4c0918];return _0x273018;};'use strict';var OpenchannelInteractionEvents=require(_0x11e5('0x0'));var events=[_0x11e5('0x1'),_0x11e5('0x2'),_0x11e5('0x3')];function createListener(_0x14a61e,_0x133b82){return function(_0x4d4c0f){_0x133b82['emit'](_0x14a61e,_0x4d4c0f);};}function removeListener(_0x3280e7,_0x26e3a1){return function(){OpenchannelInteractionEvents['removeListener'](_0x3280e7,_0x26e3a1);};}exports[_0x11e5('0x4')]=function(_0x7050dc){for(var _0xf3ab96=0x0,_0x39bd34=events[_0x11e5('0x5')];_0xf3ab96<_0x39bd34;_0xf3ab96++){var _0x59d1e6=events[_0xf3ab96];var _0x2e03ce=createListener(_0x11e5('0x6')+_0x59d1e6,_0x7050dc);OpenchannelInteractionEvents['on'](_0x59d1e6,_0x2e03ce);}}; \ No newline at end of file +var _0xd3ae=['update','emit','removeListener','register','length','./openchannelInteraction.events','remove'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd3ae,0x155));var _0xed3a=function(_0x3eef60,_0x9eb279){_0x3eef60=_0x3eef60-0x0;var _0x569efe=_0xd3ae[_0x3eef60];return _0x569efe;};'use strict';var OpenchannelInteractionEvents=require(_0xed3a('0x0'));var events=['save',_0xed3a('0x1'),_0xed3a('0x2')];function createListener(_0x1b5518,_0x17f391){return function(_0x2ab3ca){_0x17f391[_0xed3a('0x3')](_0x1b5518,_0x2ab3ca);};}function removeListener(_0x44c75b,_0x5eace4){return function(){OpenchannelInteractionEvents[_0xed3a('0x4')](_0x44c75b,_0x5eace4);};}exports[_0xed3a('0x5')]=function(_0x28179b){for(var _0x3adff9=0x0,_0xd4166e=events[_0xed3a('0x6')];_0x3adff9<_0xd4166e;_0x3adff9++){var _0x2acef3=events[_0x3adff9];var _0x464788=createListener('openchannelInteraction:'+_0x2acef3,_0x28179b);OpenchannelInteractionEvents['on'](_0x2acef3,_0x464788);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a4e75f3..55f8969 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x56cf86,_0x2c9b49){var _0x22aa39=function(_0x48b6ba){while(--_0x48b6ba){_0x56cf86['push'](_0x56cf86['shift']());}};_0x22aa39(++_0x2c9b49);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x305892,_0x529bd3){var _0x24557e=function(_0x11a686){while(--_0x11a686){_0x305892['push'](_0x305892['shift']());}};_0x24557e(++_0x529bd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 08125c7..2f65f2a 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 _0xd4f4=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x593bbe,_0x3ef22e){var _0x221482=function(_0x4a0998){while(--_0x4a0998){_0x593bbe['push'](_0x593bbe['shift']());}};_0x221482(++_0x3ef22e);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x51bd63,_0x30e551){_0x51bd63=_0x51bd63-0x0;var _0x431686=_0xd4f4[_0x51bd63];return _0x431686;};'use strict';var Sequelize=require(_0x4d4f('0x0'));module[_0x4d4f('0x1')]={'body':{'type':Sequelize[_0x4d4f('0x2')](_0x4d4f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4d4f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d4f('0x5')]('in',_0x4d4f('0x6')),'defaultValue':_0x4d4f('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4d4f('0x7')]},'providerName':{'type':Sequelize[_0x4d4f('0x8')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x282b=['BOOLEAN','out','DATE','STRING','sequelize','exports','TEXT','medium'];(function(_0x289e60,_0x1f7393){var _0x50658f=function(_0x6063dc){while(--_0x6063dc){_0x289e60['push'](_0x289e60['shift']());}};_0x50658f(++_0x1f7393);}(_0x282b,0xec));var _0xb282=function(_0xf181a,_0x5aa247){_0xf181a=_0xf181a-0x0;var _0x31d3b2=_0x282b[_0xf181a];return _0x31d3b2;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'body':{'type':Sequelize[_0xb282('0x2')](_0xb282('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xb282('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xb282('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xb282('0x6')]},'providerName':{'type':Sequelize[_0xb282('0x7')]},'providerResponse':{'type':Sequelize[_0xb282('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index a197f7a..6bed55f 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 _0xce68=['Sequelize','fullname','SIP/%s','motionChannel','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','map','OpenchannelMessage','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','params','describe','openchannel-interactions','read','format','UserId','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','interface','channel','event','accept','EventManager','acceptmessage','openchannel','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage'];(function(_0x6355b8,_0x2e0dcc){var _0x3308d8=function(_0x89c38f){while(--_0x89c38f){_0x6355b8['push'](_0x6355b8['shift']());}};_0x3308d8(++_0x2e0dcc);}(_0xce68,0x10c));var _0x8ce6=function(_0x51e9cf,_0x3b02cf){_0x51e9cf=_0x51e9cf-0x0;var _0x2c9129=_0xce68[_0x51e9cf];return _0x2c9129;};'use strict';var emlformat=require(_0x8ce6('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ce6('0x1'));var jsonpatch=require(_0x8ce6('0x2'));var rp=require(_0x8ce6('0x3'));var moment=require(_0x8ce6('0x4'));var BPromise=require(_0x8ce6('0x5'));var Mustache=require('mustache');var util=require(_0x8ce6('0x6'));var path=require(_0x8ce6('0x7'));var sox=require(_0x8ce6('0x8'));var csv=require('to-csv');var ejs=require(_0x8ce6('0x9'));var fs=require('fs');var fs_extra=require(_0x8ce6('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8ce6('0xb'));var jsforce=require(_0x8ce6('0xc'));var deskjs=require(_0x8ce6('0xd'));var toCsv=require(_0x8ce6('0xe'));var querystring=require('querystring');var Papa=require(_0x8ce6('0xf'));var Redis=require(_0x8ce6('0x10'));var authService=require(_0x8ce6('0x11'));var qs=require(_0x8ce6('0x12'));var as=require(_0x8ce6('0x13'));var hardwareService=require(_0x8ce6('0x14'));var logger=require(_0x8ce6('0x15'))(_0x8ce6('0x16'));var utils=require(_0x8ce6('0x17'));var config=require(_0x8ce6('0x18'));var licenseUtil=require(_0x8ce6('0x19'));var db=require(_0x8ce6('0x1a'))['db'];config[_0x8ce6('0x1b')]=_[_0x8ce6('0x1c')](config[_0x8ce6('0x1b')],{'host':_0x8ce6('0x1d'),'port':0x18eb});var socket=require(_0x8ce6('0x1e'))(new Redis(config[_0x8ce6('0x1b')]));require('./openchannelMessage.socket')[_0x8ce6('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8ce6('0x20')][_0x8ce6('0x21')]({'port':0x232c});var client9002=jayson[_0x8ce6('0x20')][_0x8ce6('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2c2d7e,_0x34cce2,_0x25aa78,_0x36824d){return new BPromise(function(_0x3fae8e,_0x3926b4){var _0x4fd6a6=_0x36824d||client;return _0x4fd6a6[_0x8ce6('0x22')](_0x2c2d7e,_0x25aa78)['then'](function(_0x29122f){logger[_0x8ce6('0x23')](_0x8ce6('0x24'),_0x34cce2,'request\x20sent');logger['debug'](_0x8ce6('0x25'),_0x34cce2,_0x8ce6('0x26'),JSON['stringify'](_0x29122f));if(_0x29122f[_0x8ce6('0x27')]){if(_0x29122f[_0x8ce6('0x27')][_0x8ce6('0x28')]===0x1f4){logger[_0x8ce6('0x27')](_0x8ce6('0x24'),_0x34cce2,_0x29122f[_0x8ce6('0x27')][_0x8ce6('0x29')]);return _0x3926b4(_0x29122f[_0x8ce6('0x27')][_0x8ce6('0x29')]);}logger[_0x8ce6('0x27')](_0x8ce6('0x24'),_0x34cce2,_0x29122f[_0x8ce6('0x27')]['message']);return _0x3fae8e(_0x29122f[_0x8ce6('0x27')]['message']);}else{logger[_0x8ce6('0x23')](_0x8ce6('0x24'),_0x34cce2,_0x8ce6('0x26'));_0x3fae8e(_0x29122f['result']['message']);}})['catch'](function(_0x5c2b61){logger[_0x8ce6('0x27')](_0x8ce6('0x24'),_0x34cce2,_0x5c2b61);_0x3926b4(_0x5c2b61);});});}function respondWithStatusCode(_0xac00e3,_0xed5ae7){_0xed5ae7=_0xed5ae7||0xcc;return function(_0x35c2d6){if(_0x35c2d6){return _0xac00e3[_0x8ce6('0x2a')](_0xed5ae7);}return _0xac00e3['status'](_0xed5ae7)['end']();};}function respondWithResult(_0x1233b0,_0x6a0f99){_0x6a0f99=_0x6a0f99||0xc8;return function(_0x31bf49){if(_0x31bf49){return _0x1233b0[_0x8ce6('0x2b')](_0x6a0f99)[_0x8ce6('0x2c')](_0x31bf49);}};}function respondWithFilteredResult(_0x10a3f9,_0x552251){return function(_0x4c5a7e){if(_0x4c5a7e){var _0x1eabc8=typeof _0x552251[_0x8ce6('0x2d')]===_0x8ce6('0x2e')&&typeof _0x552251['limit']===_0x8ce6('0x2e');var _0x3c6617=_0x4c5a7e[_0x8ce6('0x2f')];var _0x423e1c=_0x1eabc8?0x0:_0x552251['offset'];var _0x2c5bc8=_0x1eabc8?_0x4c5a7e[_0x8ce6('0x2f')]:_0x552251['offset']+_0x552251['limit'];var _0x2c6c7d;if(_0x2c5bc8>=_0x3c6617){_0x2c5bc8=_0x3c6617;_0x2c6c7d=0xc8;}else{_0x2c6c7d=0xce;}_0x10a3f9[_0x8ce6('0x2b')](_0x2c6c7d);return _0x10a3f9[_0x8ce6('0x30')](_0x8ce6('0x31'),_0x423e1c+'-'+_0x2c5bc8+'/'+_0x3c6617)[_0x8ce6('0x2c')](_0x4c5a7e);}return null;};}function patchUpdates(_0x75bb53){return function(_0x469da2){try{jsonpatch[_0x8ce6('0x32')](_0x469da2,_0x75bb53,!![]);}catch(_0x28a5b3){return BPromise[_0x8ce6('0x33')](_0x28a5b3);}return _0x469da2[_0x8ce6('0x34')]();};}function saveUpdates(_0x1b3215,_0x1e7ed4){return function(_0x3a8224){if(_0x3a8224){return _0x3a8224[_0x8ce6('0x35')](_0x1b3215)[_0x8ce6('0x36')](function(_0x4f7d39){return _0x4f7d39;});}return null;};}function removeEntity(_0x43b3ff,_0xd85701){return function(_0x58ff4f){if(_0x58ff4f){return _0x58ff4f[_0x8ce6('0x37')]()[_0x8ce6('0x36')](function(){_0x43b3ff[_0x8ce6('0x2b')](0xcc)[_0x8ce6('0x38')]();});}};}function handleEntityNotFound(_0x14ea6d,_0x4d3e12){return function(_0x533e37){if(!_0x533e37){_0x14ea6d[_0x8ce6('0x2a')](0x194);}return _0x533e37;};}function handleError(_0x37c1d3,_0x59608b){_0x59608b=_0x59608b||0x1f4;return function(_0x5199b4){logger[_0x8ce6('0x27')](_0x5199b4[_0x8ce6('0x39')]);if(_0x5199b4[_0x8ce6('0x3a')]){delete _0x5199b4[_0x8ce6('0x3a')];}_0x37c1d3[_0x8ce6('0x2b')](_0x59608b)[_0x8ce6('0x3b')](_0x5199b4);};}exports['index']=function(_0x174cf7,_0x4b05be){var _0x14deb3={},_0x4c6c86={},_0x25ff21={'count':0x0,'rows':[]};var _0x35cd9c=_[_0x8ce6('0x3c')](db[_0x8ce6('0x3d')]['rawAttributes'],function(_0x2d0775){return{'name':_0x2d0775['fieldName'],'type':_0x2d0775[_0x8ce6('0x3e')]['key']};});_0x4c6c86[_0x8ce6('0x3f')]=_[_0x8ce6('0x3c')](_0x35cd9c,_0x8ce6('0x3a'));_0x4c6c86['query']=_[_0x8ce6('0x40')](_0x174cf7[_0x8ce6('0x41')]);_0x4c6c86[_0x8ce6('0x42')]=_[_0x8ce6('0x43')](_0x4c6c86[_0x8ce6('0x3f')],_0x4c6c86[_0x8ce6('0x41')]);_0x14deb3['attributes']=_[_0x8ce6('0x43')](_0x4c6c86[_0x8ce6('0x3f')],qs[_0x8ce6('0x44')](_0x174cf7['query'][_0x8ce6('0x44')]));_0x14deb3[_0x8ce6('0x45')]=_0x14deb3[_0x8ce6('0x45')][_0x8ce6('0x46')]?_0x14deb3[_0x8ce6('0x45')]:_0x4c6c86[_0x8ce6('0x3f')];if(!_0x174cf7[_0x8ce6('0x41')][_0x8ce6('0x47')](_0x8ce6('0x48'))){_0x14deb3[_0x8ce6('0x49')]=qs[_0x8ce6('0x49')](_0x174cf7[_0x8ce6('0x41')][_0x8ce6('0x49')]);_0x14deb3[_0x8ce6('0x2d')]=qs[_0x8ce6('0x2d')](_0x174cf7['query'][_0x8ce6('0x2d')]);}_0x14deb3[_0x8ce6('0x4a')]=qs[_0x8ce6('0x4b')](_0x174cf7[_0x8ce6('0x41')][_0x8ce6('0x4b')]);_0x14deb3[_0x8ce6('0x4c')]=qs[_0x8ce6('0x42')](_[_0x8ce6('0x4d')](_0x174cf7[_0x8ce6('0x41')],_0x4c6c86[_0x8ce6('0x42')]),_0x35cd9c);if(_0x174cf7[_0x8ce6('0x41')][_0x8ce6('0x4e')]){_0x14deb3['where']=_[_0x8ce6('0x4f')](_0x14deb3[_0x8ce6('0x4c')],{'$or':_[_0x8ce6('0x3c')](_0x35cd9c,function(_0x28d685){if(_0x28d685[_0x8ce6('0x3e')]!==_0x8ce6('0x50')){var _0x58d54f={};_0x58d54f[_0x28d685[_0x8ce6('0x3a')]]={'$like':'%'+_0x174cf7[_0x8ce6('0x41')][_0x8ce6('0x4e')]+'%'};return _0x58d54f;}})});}_0x14deb3=_[_0x8ce6('0x4f')]({},_0x14deb3,_0x174cf7[_0x8ce6('0x51')]);var _0x212d18={'where':_0x14deb3['where']};return db[_0x8ce6('0x3d')][_0x8ce6('0x2f')](_0x212d18)['then'](function(_0x30f4c2){_0x25ff21[_0x8ce6('0x2f')]=_0x30f4c2;if(_0x174cf7[_0x8ce6('0x41')][_0x8ce6('0x52')]){_0x14deb3[_0x8ce6('0x53')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x8ce6('0x54')](_0x14deb3);})[_0x8ce6('0x36')](function(_0x4883a3){_0x25ff21[_0x8ce6('0x55')]=_0x4883a3;return _0x25ff21;})['then'](respondWithFilteredResult(_0x4b05be,_0x14deb3))['catch'](handleError(_0x4b05be,null));};exports['show']=function(_0x465b14,_0x1ca3a1){var _0x4ec1ad={'raw':!![],'where':{'id':_0x465b14['params']['id']}},_0x4dea5f={};_0x4dea5f[_0x8ce6('0x3f')]=_[_0x8ce6('0x40')](db[_0x8ce6('0x3d')][_0x8ce6('0x56')]);_0x4dea5f['query']=_[_0x8ce6('0x40')](_0x465b14[_0x8ce6('0x41')]);_0x4dea5f[_0x8ce6('0x42')]=_['intersection'](_0x4dea5f['model'],_0x4dea5f[_0x8ce6('0x41')]);_0x4ec1ad[_0x8ce6('0x45')]=_[_0x8ce6('0x43')](_0x4dea5f['model'],qs[_0x8ce6('0x44')](_0x465b14[_0x8ce6('0x41')][_0x8ce6('0x44')]));_0x4ec1ad[_0x8ce6('0x45')]=_0x4ec1ad[_0x8ce6('0x45')]['length']?_0x4ec1ad[_0x8ce6('0x45')]:_0x4dea5f[_0x8ce6('0x3f')];if(_0x465b14[_0x8ce6('0x41')][_0x8ce6('0x52')]){_0x4ec1ad['include']=[{'all':!![]}];}_0x4ec1ad=_[_0x8ce6('0x4f')]({},_0x4ec1ad,_0x465b14[_0x8ce6('0x51')]);return db[_0x8ce6('0x3d')][_0x8ce6('0x57')](_0x4ec1ad)[_0x8ce6('0x36')](handleEntityNotFound(_0x1ca3a1,null))[_0x8ce6('0x36')](respondWithResult(_0x1ca3a1,null))[_0x8ce6('0x58')](handleError(_0x1ca3a1,null));};exports[_0x8ce6('0x59')]=function(_0x383159,_0x22b3dc){return db['OpenchannelMessage']['create'](_0x383159[_0x8ce6('0x5a')],{})[_0x8ce6('0x36')](respondWithResult(_0x22b3dc,0xc9))['catch'](handleError(_0x22b3dc,null));};exports[_0x8ce6('0x35')]=function(_0x520114,_0x3d0a48){if(_0x520114[_0x8ce6('0x5a')]['id']){delete _0x520114[_0x8ce6('0x5a')]['id'];}return db['OpenchannelMessage'][_0x8ce6('0x57')]({'where':{'id':_0x520114[_0x8ce6('0x5b')]['id']}})[_0x8ce6('0x36')](handleEntityNotFound(_0x3d0a48,null))[_0x8ce6('0x36')](saveUpdates(_0x520114[_0x8ce6('0x5a')],null))[_0x8ce6('0x36')](respondWithResult(_0x3d0a48,null))[_0x8ce6('0x58')](handleError(_0x3d0a48,null));};exports[_0x8ce6('0x37')]=function(_0x2f78f7,_0x3a86d0){return db['OpenchannelMessage'][_0x8ce6('0x57')]({'where':{'id':_0x2f78f7[_0x8ce6('0x5b')]['id']}})[_0x8ce6('0x36')](handleEntityNotFound(_0x3a86d0,null))['then'](removeEntity(_0x3a86d0,null))[_0x8ce6('0x58')](handleError(_0x3a86d0,null));};exports[_0x8ce6('0x5c')]=function(_0x2a26c0,_0x77aab1){return db[_0x8ce6('0x3d')]['describe']()['then'](respondWithResult(_0x77aab1,null))['catch'](handleError(_0x77aab1,null));};var interaction_log=require('../../config/logger')(_0x8ce6('0x5d'));exports['accept']=function(_0x19486d,_0x31e6ac,_0x127b45){var _0x13d1e5={'agent':{},'channel':'openchannel'};if(_0x19486d[_0x8ce6('0x5a')]['id']){delete _0x19486d[_0x8ce6('0x5a')]['id'];}_0x19486d[_0x8ce6('0x5a')][_0x8ce6('0x5e')]=!![];_0x19486d[_0x8ce6('0x5a')]['readAt']=moment()[_0x8ce6('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x19486d[_0x8ce6('0x5a')]['UserId']=_0x19486d['body'][_0x8ce6('0x60')]||_0x19486d['user']['id'];_0x13d1e5[_0x8ce6('0x61')]['id']=_0x19486d[_0x8ce6('0x5a')][_0x8ce6('0x60')];return db[_0x8ce6('0x3d')][_0x8ce6('0x57')]({'where':{'id':_0x19486d['params']['id'],'UserId':null}})[_0x8ce6('0x36')](handleEntityNotFound(_0x31e6ac,null))[_0x8ce6('0x36')](saveUpdates(_0x19486d['body'],null))[_0x8ce6('0x36')](function(_0x20235a){if(_0x20235a){_0x13d1e5[_0x8ce6('0x29')]=_0x20235a['get']({'plain':!![]});return db[_0x8ce6('0x62')][_0x8ce6('0x57')]({'where':{'id':_0x20235a[_0x8ce6('0x63')]}});}return null;})[_0x8ce6('0x36')](handleEntityNotFound(_0x31e6ac,null))['then'](function(_0x1db316){if(_0x1db316){return _0x1db316['update']({'UserId':_0x19486d[_0x8ce6('0x5a')][_0x8ce6('0x60')],'read1stAt':_[_0x8ce6('0x64')](_0x1db316['read1stAt'])?moment()[_0x8ce6('0x5f')](_0x8ce6('0x65')):undefined});}return null;})[_0x8ce6('0x36')](function(_0x4feebb){if(_0x4feebb){_0x13d1e5[_0x8ce6('0x66')]=_0x4feebb[_0x8ce6('0x67')]({'plain':!![]});interaction_log[_0x8ce6('0x23')](_0x8ce6('0x68'),_0x19486d[_0x8ce6('0x69')]['id'],_0x19486d[_0x8ce6('0x69')][_0x8ce6('0x3a')],_0x19486d[_0x8ce6('0x69')][_0x8ce6('0x6a')],_0x13d1e5[_0x8ce6('0x66')]['id'],_0x19486d[_0x8ce6('0x5a')]?JSON[_0x8ce6('0x6b')](_0x19486d[_0x8ce6('0x5a')]):'null');return respondWithRpcPromise('AcceptMessage',_0x8ce6('0x6c'),_0x13d1e5);}return null;})['then'](function(_0x46de33){var _0x1b2dbb=_0x8ce6('0x6d')+_0x46de33[_0x8ce6('0x29')][_0x8ce6('0x6e')];return db[_0x8ce6('0x6f')][_0x8ce6('0x41')](_0x1b2dbb,{'type':db['Sequelize'][_0x8ce6('0x70')][_0x8ce6('0x71')],'raw':!![]})[_0x8ce6('0x36')](function(_0x3950cc){return _0x3950cc;});})[_0x8ce6('0x36')](function(_0x4c90ab){if(_0x4c90ab){_0x13d1e5[_0x8ce6('0x29')][_0x8ce6('0x72')]=_0x4c90ab[0x0];if(!_0x19486d[_0x8ce6('0x5a')][_0x8ce6('0x60')])return;return db[_0x8ce6('0x73')][_0x8ce6('0x57')]({'where':{'id':_0x19486d[_0x8ce6('0x5a')]['UserId'],'role':_0x8ce6('0x61')},'attributes':['id','name','fullname',_0x8ce6('0x74'),_0x8ce6('0x75')],'raw':!![]});}return null;})[_0x8ce6('0x36')](function(_0x53f43d){if(!_0x53f43d)return null;_0x13d1e5[_0x8ce6('0x29')][_0x8ce6('0x61')]=_0x53f43d;return _0x13d1e5;})[_0x8ce6('0x36')](function(_0x3accab){if(_0x3accab){if(_0x19486d[_0x8ce6('0x5a')]['manual']){_0x13d1e5[_0x8ce6('0x29')][_0x8ce6('0x76')]=util[_0x8ce6('0x5f')]('SIP/%s',_0x19486d[_0x8ce6('0x69')]['name']);_0x13d1e5['message'][_0x8ce6('0x77')]=_0x13d1e5[_0x8ce6('0x77')];_0x13d1e5[_0x8ce6('0x29')]['motionChannel']=_0x13d1e5[_0x8ce6('0x77')];_0x13d1e5[_0x8ce6('0x29')][_0x8ce6('0x78')]=_0x8ce6('0x79');return respondWithRpcPromise(_0x8ce6('0x7a'),'EventManager',{'event':_0x8ce6('0x7b'),'message':_0x13d1e5[_0x8ce6('0x29')]},client9002)[_0x8ce6('0x36')](function(){return _0x13d1e5;});}return _0x13d1e5;}return null;})[_0x8ce6('0x36')](respondWithResult(_0x31e6ac,null))[_0x8ce6('0x58')](handleError(_0x31e6ac,null));};var interaction_log=require(_0x8ce6('0x15'))(_0x8ce6('0x5d'));exports['reject']=function(_0x267e30,_0x20f27,_0x5382b6){var _0x178bb1={'agent':{},'channel':_0x8ce6('0x7c')};if(_0x267e30[_0x8ce6('0x5a')]['id']){delete _0x267e30['body']['id'];}_0x267e30['body'][_0x8ce6('0x60')]=_0x267e30[_0x8ce6('0x5a')][_0x8ce6('0x60')]||_0x267e30[_0x8ce6('0x69')]['id'];_0x178bb1[_0x8ce6('0x61')]['id']=_0x267e30[_0x8ce6('0x5a')][_0x8ce6('0x60')];return db[_0x8ce6('0x3d')]['find']({'where':{'id':_0x267e30[_0x8ce6('0x5b')]['id'],'UserId':null}})[_0x8ce6('0x36')](handleEntityNotFound(_0x20f27,null))[_0x8ce6('0x36')](function(_0x42dd37){if(_0x42dd37){_0x178bb1[_0x8ce6('0x29')]=_0x42dd37[_0x8ce6('0x67')]({'plain':!![]});return db[_0x8ce6('0x62')][_0x8ce6('0x57')]({'where':{'id':_0x42dd37[_0x8ce6('0x63')]}});}return null;})[_0x8ce6('0x36')](handleEntityNotFound(_0x20f27,null))[_0x8ce6('0x36')](function(_0x3a5eb0){if(_0x3a5eb0){_0x178bb1[_0x8ce6('0x66')]=_0x3a5eb0[_0x8ce6('0x67')]({'plain':!![]});interaction_log[_0x8ce6('0x23')](_0x8ce6('0x7d'),_0x267e30[_0x8ce6('0x69')]['id'],_0x267e30[_0x8ce6('0x69')][_0x8ce6('0x3a')],_0x267e30[_0x8ce6('0x69')][_0x8ce6('0x6a')],_0x178bb1[_0x8ce6('0x66')]['id'],_0x267e30[_0x8ce6('0x5a')]?JSON[_0x8ce6('0x6b')](_0x267e30['body']):'null');return respondWithRpcPromise(_0x8ce6('0x7e'),_0x8ce6('0x7f'),_0x178bb1);}return null;})[_0x8ce6('0x36')](function(_0x2429f2){var _0x4bf699=_0x8ce6('0x6d')+_0x2429f2[_0x8ce6('0x29')][_0x8ce6('0x6e')];return db[_0x8ce6('0x6f')][_0x8ce6('0x41')](_0x4bf699,{'type':db[_0x8ce6('0x80')][_0x8ce6('0x70')][_0x8ce6('0x71')],'raw':!![]})['then'](function(_0x19811d){return _0x19811d;});})[_0x8ce6('0x36')](function(_0x156390){if(_0x156390){_0x178bb1[_0x8ce6('0x29')][_0x8ce6('0x72')]=_0x156390[0x0];if(!_0x267e30[_0x8ce6('0x5a')][_0x8ce6('0x60')])return;return db['User'][_0x8ce6('0x57')]({'where':{'id':_0x267e30['body'][_0x8ce6('0x60')],'role':_0x8ce6('0x61')},'attributes':['id',_0x8ce6('0x3a'),_0x8ce6('0x81'),_0x8ce6('0x74'),_0x8ce6('0x75')],'raw':!![]});}return null;})[_0x8ce6('0x36')](function(_0x444d6b){if(!_0x444d6b)return null;_0x178bb1[_0x8ce6('0x29')][_0x8ce6('0x61')]=_0x444d6b;return _0x178bb1;})[_0x8ce6('0x36')](function(_0x2172af){if(_0x2172af){_0x2172af[_0x8ce6('0x29')][_0x8ce6('0x76')]=util[_0x8ce6('0x5f')](_0x8ce6('0x82'),_0x267e30['user'][_0x8ce6('0x3a')]);_0x2172af[_0x8ce6('0x29')]['channel']=_0x178bb1[_0x8ce6('0x77')];_0x2172af[_0x8ce6('0x29')][_0x8ce6('0x83')]=_0x178bb1['channel'];_0x2172af[_0x8ce6('0x29')]['event']='reject';respondWithRpcPromise('EventManager',_0x8ce6('0x7a'),{'event':'rejectmessage','message':_0x2172af[_0x8ce6('0x29')]},client9002);return _0x178bb1;}return null;})[_0x8ce6('0x36')](respondWithResult(_0x20f27,null))[_0x8ce6('0x58')](handleError(_0x20f27,null));}; \ No newline at end of file +var _0x2496=['manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','rejectmessage','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','nolimit','where','VIRTUAL','merge','options','OpenchannelMessage','includeAll','include','findAll','show','attributes','length','create','body','find','params','destroy','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','sequelize','QueryTypes','SELECT','User','fullname','email','internal','agent'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x2496,0x91));var _0x6249=function(_0x3b29c3,_0x441674){_0x3b29c3=_0x3b29c3-0x0;var _0x477f87=_0x2496[_0x3b29c3];return _0x477f87;};'use strict';var emlformat=require(_0x6249('0x0'));var rimraf=require(_0x6249('0x1'));var zipdir=require(_0x6249('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6249('0x3'));var moment=require(_0x6249('0x4'));var BPromise=require(_0x6249('0x5'));var Mustache=require('mustache');var util=require(_0x6249('0x6'));var path=require(_0x6249('0x7'));var sox=require(_0x6249('0x8'));var csv=require(_0x6249('0x9'));var ejs=require(_0x6249('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6249('0xb'));var squel=require(_0x6249('0xc'));var crypto=require(_0x6249('0xd'));var jsforce=require(_0x6249('0xe'));var deskjs=require(_0x6249('0xf'));var toCsv=require(_0x6249('0x9'));var querystring=require('querystring');var Papa=require(_0x6249('0x10'));var Redis=require(_0x6249('0x11'));var authService=require(_0x6249('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6249('0x13'));var logger=require(_0x6249('0x14'))(_0x6249('0x15'));var utils=require(_0x6249('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6249('0x17'))['db'];config[_0x6249('0x18')]=_[_0x6249('0x19')](config[_0x6249('0x18')],{'host':_0x6249('0x1a'),'port':0x18eb});var socket=require(_0x6249('0x1b'))(new Redis(config[_0x6249('0x18')]));require(_0x6249('0x1c'))['register'](socket);var jayson=require(_0x6249('0x1d'));var client=jayson[_0x6249('0x1e')][_0x6249('0x1f')]({'port':0x232c});var client9002=jayson[_0x6249('0x1e')][_0x6249('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4adeff,_0x10c758,_0x11b2db,_0x1137ff){return new BPromise(function(_0xaa120e,_0x3daa04){var _0x4abbfe=_0x1137ff||client;return _0x4abbfe[_0x6249('0x20')](_0x4adeff,_0x11b2db)['then'](function(_0xe5bce1){logger[_0x6249('0x21')](_0x6249('0x22'),_0x10c758,_0x6249('0x23'));logger[_0x6249('0x24')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x10c758,_0x6249('0x23'),JSON[_0x6249('0x25')](_0xe5bce1));if(_0xe5bce1['error']){if(_0xe5bce1[_0x6249('0x26')]['code']===0x1f4){logger[_0x6249('0x26')](_0x6249('0x22'),_0x10c758,_0xe5bce1[_0x6249('0x26')]['message']);return _0x3daa04(_0xe5bce1[_0x6249('0x26')][_0x6249('0x27')]);}logger[_0x6249('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x10c758,_0xe5bce1[_0x6249('0x26')]['message']);return _0xaa120e(_0xe5bce1[_0x6249('0x26')][_0x6249('0x27')]);}else{logger[_0x6249('0x21')](_0x6249('0x22'),_0x10c758,'request\x20sent');_0xaa120e(_0xe5bce1[_0x6249('0x28')][_0x6249('0x27')]);}})[_0x6249('0x29')](function(_0x13f6cf){logger['error'](_0x6249('0x22'),_0x10c758,_0x13f6cf);_0x3daa04(_0x13f6cf);});});}function respondWithStatusCode(_0x1678dd,_0x3d257d){_0x3d257d=_0x3d257d||0xcc;return function(_0x72f7c1){if(_0x72f7c1){return _0x1678dd[_0x6249('0x2a')](_0x3d257d);}return _0x1678dd[_0x6249('0x2b')](_0x3d257d)['end']();};}function respondWithResult(_0x3e81bd,_0x4b0dfa){_0x4b0dfa=_0x4b0dfa||0xc8;return function(_0x1d4c16){if(_0x1d4c16){return _0x3e81bd[_0x6249('0x2b')](_0x4b0dfa)[_0x6249('0x2c')](_0x1d4c16);}};}function respondWithFilteredResult(_0x3eb7af,_0x4fd05b){return function(_0x4f5680){if(_0x4f5680){var _0x4db52f=typeof _0x4fd05b['offset']===_0x6249('0x2d')&&typeof _0x4fd05b['limit']===_0x6249('0x2d');var _0x364d85=_0x4f5680[_0x6249('0x2e')];var _0x54c621=_0x4db52f?0x0:_0x4fd05b['offset'];var _0x1d35b5=_0x4db52f?_0x4f5680[_0x6249('0x2e')]:_0x4fd05b[_0x6249('0x2f')]+_0x4fd05b[_0x6249('0x30')];var _0x5cf275;if(_0x1d35b5>=_0x364d85){_0x1d35b5=_0x364d85;_0x5cf275=0xc8;}else{_0x5cf275=0xce;}_0x3eb7af[_0x6249('0x2b')](_0x5cf275);return _0x3eb7af[_0x6249('0x31')](_0x6249('0x32'),_0x54c621+'-'+_0x1d35b5+'/'+_0x364d85)[_0x6249('0x2c')](_0x4f5680);}return null;};}function patchUpdates(_0x408ed1){return function(_0x230d37){try{jsonpatch[_0x6249('0x33')](_0x230d37,_0x408ed1,!![]);}catch(_0x11c452){return BPromise['reject'](_0x11c452);}return _0x230d37[_0x6249('0x34')]();};}function saveUpdates(_0x1271b0,_0x21916f){return function(_0x2d0df9){if(_0x2d0df9){return _0x2d0df9[_0x6249('0x35')](_0x1271b0)[_0x6249('0x36')](function(_0x1bc290){return _0x1bc290;});}return null;};}function removeEntity(_0x1092c9,_0x23f818){return function(_0x3e280e){if(_0x3e280e){return _0x3e280e['destroy']()[_0x6249('0x36')](function(){_0x1092c9[_0x6249('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2433d1,_0x31743c){return function(_0x13de6d){if(!_0x13de6d){_0x2433d1['sendStatus'](0x194);}return _0x13de6d;};}function handleError(_0x36f1eb,_0x1d369b){_0x1d369b=_0x1d369b||0x1f4;return function(_0x4e669f){logger['error'](_0x4e669f[_0x6249('0x37')]);if(_0x4e669f['name']){delete _0x4e669f[_0x6249('0x38')];}_0x36f1eb['status'](_0x1d369b)[_0x6249('0x39')](_0x4e669f);};}exports[_0x6249('0x3a')]=function(_0xd50c77,_0x13116d){var _0xe2e343={},_0x549a72={},_0x4dcde3={'count':0x0,'rows':[]};var _0x54f217=_['map'](db['OpenchannelMessage'][_0x6249('0x3b')],function(_0x344ade){return{'name':_0x344ade[_0x6249('0x3c')],'type':_0x344ade[_0x6249('0x3d')]['key']};});_0x549a72[_0x6249('0x3e')]=_[_0x6249('0x3f')](_0x54f217,_0x6249('0x38'));_0x549a72[_0x6249('0x40')]=_[_0x6249('0x41')](_0xd50c77[_0x6249('0x40')]);_0x549a72[_0x6249('0x42')]=_[_0x6249('0x43')](_0x549a72['model'],_0x549a72[_0x6249('0x40')]);_0xe2e343['attributes']=_[_0x6249('0x43')](_0x549a72[_0x6249('0x3e')],qs[_0x6249('0x44')](_0xd50c77[_0x6249('0x40')]['fields']));_0xe2e343['attributes']=_0xe2e343['attributes']['length']?_0xe2e343['attributes']:_0x549a72[_0x6249('0x3e')];if(!_0xd50c77['query']['hasOwnProperty'](_0x6249('0x45'))){_0xe2e343[_0x6249('0x30')]=qs[_0x6249('0x30')](_0xd50c77[_0x6249('0x40')]['limit']);_0xe2e343[_0x6249('0x2f')]=qs['offset'](_0xd50c77[_0x6249('0x40')][_0x6249('0x2f')]);}_0xe2e343['order']=qs['sort'](_0xd50c77[_0x6249('0x40')]['sort']);_0xe2e343[_0x6249('0x46')]=qs['filters'](_['pick'](_0xd50c77['query'],_0x549a72[_0x6249('0x42')]),_0x54f217);if(_0xd50c77[_0x6249('0x40')]['filter']){_0xe2e343[_0x6249('0x46')]=_['merge'](_0xe2e343[_0x6249('0x46')],{'$or':_[_0x6249('0x3f')](_0x54f217,function(_0x475763){if(_0x475763['type']!==_0x6249('0x47')){var _0x4a2842={};_0x4a2842[_0x475763[_0x6249('0x38')]]={'$like':'%'+_0xd50c77[_0x6249('0x40')]['filter']+'%'};return _0x4a2842;}})});}_0xe2e343=_[_0x6249('0x48')]({},_0xe2e343,_0xd50c77[_0x6249('0x49')]);var _0x4cc0cd={'where':_0xe2e343[_0x6249('0x46')]};return db[_0x6249('0x4a')]['count'](_0x4cc0cd)[_0x6249('0x36')](function(_0x4f8082){_0x4dcde3[_0x6249('0x2e')]=_0x4f8082;if(_0xd50c77[_0x6249('0x40')][_0x6249('0x4b')]){_0xe2e343[_0x6249('0x4c')]=[{'all':!![]}];}return db[_0x6249('0x4a')][_0x6249('0x4d')](_0xe2e343);})[_0x6249('0x36')](function(_0x202149){_0x4dcde3['rows']=_0x202149;return _0x4dcde3;})[_0x6249('0x36')](respondWithFilteredResult(_0x13116d,_0xe2e343))['catch'](handleError(_0x13116d,null));};exports[_0x6249('0x4e')]=function(_0x1d0a39,_0x588293){var _0xd482b9={'raw':!![],'where':{'id':_0x1d0a39['params']['id']}},_0x37a035={};_0x37a035[_0x6249('0x3e')]=_[_0x6249('0x41')](db[_0x6249('0x4a')][_0x6249('0x3b')]);_0x37a035[_0x6249('0x40')]=_['keys'](_0x1d0a39['query']);_0x37a035[_0x6249('0x42')]=_[_0x6249('0x43')](_0x37a035[_0x6249('0x3e')],_0x37a035['query']);_0xd482b9[_0x6249('0x4f')]=_[_0x6249('0x43')](_0x37a035[_0x6249('0x3e')],qs['fields'](_0x1d0a39[_0x6249('0x40')][_0x6249('0x44')]));_0xd482b9['attributes']=_0xd482b9[_0x6249('0x4f')][_0x6249('0x50')]?_0xd482b9[_0x6249('0x4f')]:_0x37a035['model'];if(_0x1d0a39[_0x6249('0x40')]['includeAll']){_0xd482b9[_0x6249('0x4c')]=[{'all':!![]}];}_0xd482b9=_['merge']({},_0xd482b9,_0x1d0a39[_0x6249('0x49')]);return db['OpenchannelMessage']['find'](_0xd482b9)['then'](handleEntityNotFound(_0x588293,null))[_0x6249('0x36')](respondWithResult(_0x588293,null))['catch'](handleError(_0x588293,null));};exports['create']=function(_0x432e68,_0x10930a){return db[_0x6249('0x4a')][_0x6249('0x51')](_0x432e68[_0x6249('0x52')],{})[_0x6249('0x36')](respondWithResult(_0x10930a,0xc9))['catch'](handleError(_0x10930a,null));};exports[_0x6249('0x35')]=function(_0x4bb2b0,_0x19e46b){if(_0x4bb2b0[_0x6249('0x52')]['id']){delete _0x4bb2b0[_0x6249('0x52')]['id'];}return db[_0x6249('0x4a')][_0x6249('0x53')]({'where':{'id':_0x4bb2b0[_0x6249('0x54')]['id']}})[_0x6249('0x36')](handleEntityNotFound(_0x19e46b,null))[_0x6249('0x36')](saveUpdates(_0x4bb2b0['body'],null))[_0x6249('0x36')](respondWithResult(_0x19e46b,null))[_0x6249('0x29')](handleError(_0x19e46b,null));};exports[_0x6249('0x55')]=function(_0x1e3fb9,_0x514f32){return db[_0x6249('0x4a')][_0x6249('0x53')]({'where':{'id':_0x1e3fb9[_0x6249('0x54')]['id']}})['then'](handleEntityNotFound(_0x514f32,null))[_0x6249('0x36')](removeEntity(_0x514f32,null))[_0x6249('0x29')](handleError(_0x514f32,null));};exports[_0x6249('0x56')]=function(_0x2c299f,_0x514a6e){return db[_0x6249('0x4a')][_0x6249('0x56')]()[_0x6249('0x36')](respondWithResult(_0x514a6e,null))['catch'](handleError(_0x514a6e,null));};var interaction_log=require(_0x6249('0x14'))(_0x6249('0x57'));exports[_0x6249('0x58')]=function(_0x3fea8d,_0x3cfffa,_0x5e4a1c){var _0x3af322={'agent':{},'channel':_0x6249('0x59')};if(_0x3fea8d[_0x6249('0x52')]['id']){delete _0x3fea8d['body']['id'];}_0x3fea8d[_0x6249('0x52')][_0x6249('0x5a')]=!![];_0x3fea8d[_0x6249('0x52')][_0x6249('0x5b')]=moment()[_0x6249('0x5c')](_0x6249('0x5d'));_0x3fea8d[_0x6249('0x52')][_0x6249('0x5e')]=_0x3fea8d['body'][_0x6249('0x5e')]||_0x3fea8d['user']['id'];_0x3af322['agent']['id']=_0x3fea8d['body']['UserId'];return db['OpenchannelMessage'][_0x6249('0x53')]({'where':{'id':_0x3fea8d[_0x6249('0x54')]['id'],'UserId':null}})[_0x6249('0x36')](handleEntityNotFound(_0x3cfffa,null))['then'](saveUpdates(_0x3fea8d['body'],null))[_0x6249('0x36')](function(_0x1f284d){if(_0x1f284d){_0x3af322[_0x6249('0x27')]=_0x1f284d['get']({'plain':!![]});return db[_0x6249('0x5f')][_0x6249('0x53')]({'where':{'id':_0x1f284d[_0x6249('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x3cfffa,null))['then'](function(_0x2b488e){if(_0x2b488e){return _0x2b488e[_0x6249('0x35')]({'UserId':_0x3fea8d['body']['UserId'],'read1stAt':_[_0x6249('0x61')](_0x2b488e[_0x6249('0x62')])?moment()[_0x6249('0x5c')](_0x6249('0x5d')):undefined});}return null;})[_0x6249('0x36')](function(_0x4dc128){if(_0x4dc128){_0x3af322[_0x6249('0x63')]=_0x4dc128[_0x6249('0x64')]({'plain':!![]});interaction_log[_0x6249('0x21')](_0x6249('0x65'),_0x3fea8d[_0x6249('0x66')]['id'],_0x3fea8d[_0x6249('0x66')][_0x6249('0x38')],_0x3fea8d[_0x6249('0x66')][_0x6249('0x67')],_0x3af322['interaction']['id'],_0x3fea8d['body']?JSON['stringify'](_0x3fea8d[_0x6249('0x52')]):_0x6249('0x68'));return respondWithRpcPromise(_0x6249('0x69'),_0x6249('0x6a'),_0x3af322);}return null;})[_0x6249('0x36')](function(_0x4be5b9){var _0x52537f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4be5b9[_0x6249('0x27')]['ContactId'];return db[_0x6249('0x6b')][_0x6249('0x40')](_0x52537f,{'type':db['Sequelize'][_0x6249('0x6c')][_0x6249('0x6d')],'raw':!![]})['then'](function(_0x1878d1){return _0x1878d1;});})[_0x6249('0x36')](function(_0x1d4298){if(_0x1d4298){_0x3af322[_0x6249('0x27')]['contact']=_0x1d4298[0x0];if(!_0x3fea8d[_0x6249('0x52')]['UserId'])return;return db[_0x6249('0x6e')][_0x6249('0x53')]({'where':{'id':_0x3fea8d[_0x6249('0x52')][_0x6249('0x5e')],'role':'agent'},'attributes':['id',_0x6249('0x38'),_0x6249('0x6f'),_0x6249('0x70'),_0x6249('0x71')],'raw':!![]});}return null;})['then'](function(_0x4d62d5){if(!_0x4d62d5)return null;_0x3af322[_0x6249('0x27')][_0x6249('0x72')]=_0x4d62d5;return _0x3af322;})[_0x6249('0x36')](function(_0x20aab2){if(_0x20aab2){if(_0x3fea8d[_0x6249('0x52')][_0x6249('0x73')]){_0x3af322[_0x6249('0x27')][_0x6249('0x74')]=util['format'](_0x6249('0x75'),_0x3fea8d[_0x6249('0x66')][_0x6249('0x38')]);_0x3af322[_0x6249('0x27')][_0x6249('0x76')]=_0x3af322['channel'];_0x3af322[_0x6249('0x27')][_0x6249('0x77')]=_0x3af322['channel'];_0x3af322['message'][_0x6249('0x78')]=_0x6249('0x58');return respondWithRpcPromise(_0x6249('0x79'),_0x6249('0x79'),{'event':_0x6249('0x7a'),'message':_0x3af322['message']},client9002)['then'](function(){return _0x3af322;});}return _0x3af322;}return null;})[_0x6249('0x36')](respondWithResult(_0x3cfffa,null))['catch'](handleError(_0x3cfffa,null));};var interaction_log=require(_0x6249('0x14'))('openchannel-interactions');exports[_0x6249('0x7b')]=function(_0x4923f6,_0x15d6ed,_0x2ac4b4){var _0x5f12b1={'agent':{},'channel':_0x6249('0x59')};if(_0x4923f6['body']['id']){delete _0x4923f6[_0x6249('0x52')]['id'];}_0x4923f6[_0x6249('0x52')]['UserId']=_0x4923f6[_0x6249('0x52')][_0x6249('0x5e')]||_0x4923f6[_0x6249('0x66')]['id'];_0x5f12b1[_0x6249('0x72')]['id']=_0x4923f6[_0x6249('0x52')][_0x6249('0x5e')];return db['OpenchannelMessage'][_0x6249('0x53')]({'where':{'id':_0x4923f6['params']['id'],'UserId':null}})[_0x6249('0x36')](handleEntityNotFound(_0x15d6ed,null))[_0x6249('0x36')](function(_0x35be92){if(_0x35be92){_0x5f12b1[_0x6249('0x27')]=_0x35be92['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x6249('0x53')]({'where':{'id':_0x35be92[_0x6249('0x60')]}});}return null;})[_0x6249('0x36')](handleEntityNotFound(_0x15d6ed,null))[_0x6249('0x36')](function(_0x186827){if(_0x186827){_0x5f12b1[_0x6249('0x63')]=_0x186827[_0x6249('0x64')]({'plain':!![]});interaction_log['info'](_0x6249('0x7c'),_0x4923f6[_0x6249('0x66')]['id'],_0x4923f6[_0x6249('0x66')][_0x6249('0x38')],_0x4923f6[_0x6249('0x66')][_0x6249('0x67')],_0x5f12b1[_0x6249('0x63')]['id'],_0x4923f6['body']?JSON[_0x6249('0x25')](_0x4923f6[_0x6249('0x52')]):_0x6249('0x68'));return respondWithRpcPromise(_0x6249('0x7d'),_0x6249('0x7e'),_0x5f12b1);}return null;})['then'](function(_0x554b98){var _0x1ca35c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x554b98['message'][_0x6249('0x7f')];return db[_0x6249('0x6b')][_0x6249('0x40')](_0x1ca35c,{'type':db[_0x6249('0x80')][_0x6249('0x6c')][_0x6249('0x6d')],'raw':!![]})['then'](function(_0x549014){return _0x549014;});})[_0x6249('0x36')](function(_0x59b226){if(_0x59b226){_0x5f12b1[_0x6249('0x27')]['contact']=_0x59b226[0x0];if(!_0x4923f6['body']['UserId'])return;return db['User'][_0x6249('0x53')]({'where':{'id':_0x4923f6[_0x6249('0x52')][_0x6249('0x5e')],'role':_0x6249('0x72')},'attributes':['id','name','fullname',_0x6249('0x70'),_0x6249('0x71')],'raw':!![]});}return null;})[_0x6249('0x36')](function(_0x155df3){if(!_0x155df3)return null;_0x5f12b1['message']['agent']=_0x155df3;return _0x5f12b1;})[_0x6249('0x36')](function(_0x1ff502){if(_0x1ff502){_0x1ff502[_0x6249('0x27')]['interface']=util[_0x6249('0x5c')]('SIP/%s',_0x4923f6[_0x6249('0x66')]['name']);_0x1ff502[_0x6249('0x27')][_0x6249('0x76')]=_0x5f12b1[_0x6249('0x76')];_0x1ff502[_0x6249('0x27')][_0x6249('0x77')]=_0x5f12b1[_0x6249('0x76')];_0x1ff502[_0x6249('0x27')]['event']='reject';respondWithRpcPromise('EventManager',_0x6249('0x79'),{'event':_0x6249('0x81'),'message':_0x1ff502[_0x6249('0x27')]},client9002);return _0x5f12b1;}return null;})[_0x6249('0x36')](respondWithResult(_0x15d6ed,null))[_0x6249('0x29')](handleError(_0x15d6ed,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 78ba847..bc66f79 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 _0xfcd9=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelMessage','setMaxListeners','save'];(function(_0x203847,_0x38fb38){var _0x383d7a=function(_0x1f10bb){while(--_0x1f10bb){_0x203847['push'](_0x203847['shift']());}};_0x383d7a(++_0x38fb38);}(_0xfcd9,0x1c8));var _0x9fcd=function(_0x160182,_0x4cf21a){_0x160182=_0x160182-0x0;var _0x1c1e78=_0xfcd9[_0x160182];return _0x1c1e78;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x9fcd('0x0'))['db'][_0x9fcd('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9fcd('0x2')](0x0);var events={'afterCreate':_0x9fcd('0x3'),'afterUpdate':_0x9fcd('0x4'),'afterDestroy':_0x9fcd('0x5')};function emitEvent(_0x378e92){return function(_0x397ece,_0x376634,_0x409468){OpenchannelMessageEvents[_0x9fcd('0x6')](_0x378e92+':'+_0x397ece['id'],_0x397ece);OpenchannelMessageEvents['emit'](_0x378e92,_0x397ece);_0x409468(null);};}for(var e in events){if(events[_0x9fcd('0x7')](e)){var event=events[e];OpenchannelMessage[_0x9fcd('0x8')](e,emitEvent(event));}}module[_0x9fcd('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x96e2=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x58cf07,_0x2e3858){var _0x42afe0=function(_0x3c71ff){while(--_0x3c71ff){_0x58cf07['push'](_0x58cf07['shift']());}};_0x42afe0(++_0x2e3858);}(_0x96e2,0x155));var _0x296e=function(_0x400a4f,_0x302b31){_0x400a4f=_0x400a4f-0x0;var _0x2d0335=_0x96e2[_0x400a4f];return _0x2d0335;};'use strict';var EventEmitter=require(_0x296e('0x0'));var OpenchannelMessage=require(_0x296e('0x1'))['db'][_0x296e('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x296e('0x3')](0x0);var events={'afterCreate':_0x296e('0x4'),'afterUpdate':'update','afterDestroy':_0x296e('0x5')};function emitEvent(_0x64b6d7){return function(_0x2e08e2,_0xcb7298,_0x2ef1f1){OpenchannelMessageEvents[_0x296e('0x6')](_0x64b6d7+':'+_0x2e08e2['id'],_0x2e08e2);OpenchannelMessageEvents[_0x296e('0x6')](_0x64b6d7,_0x2e08e2);_0x2ef1f1(null);};}for(var e in events){if(events[_0x296e('0x7')](e)){var event=events[e];OpenchannelMessage[_0x296e('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 6976dd4..85ccb78 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 _0x5338=['describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./openchannelMessage.attributes','define','openchannel_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','update','createdAt','catch','error','CmContact'];(function(_0x5d491a,_0x46fe1b){var _0x31b402=function(_0x14854e){while(--_0x14854e){_0x5d491a['push'](_0x5d491a['shift']());}};_0x31b402(++_0x46fe1b);}(_0x5338,0x11e));var _0x8533=function(_0x331ce9,_0x4bf2fd){_0x331ce9=_0x331ce9-0x0;var _0x1b2ddb=_0x5338[_0x331ce9];return _0x1b2ddb;};'use strict';var _=require(_0x8533('0x0'));var util=require(_0x8533('0x1'));var logger=require(_0x8533('0x2'))(_0x8533('0x3'));var moment=require(_0x8533('0x4'));var BPromise=require(_0x8533('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8533('0x6'));var rimraf=require('rimraf');var config=require(_0x8533('0x7'));var attributes=require(_0x8533('0x8'));module['exports']=function(_0xb9a785,_0xa17bd5){return _0xb9a785[_0x8533('0x9')]('OpenchannelMessage',attributes,{'tableName':_0x8533('0xa'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':[_0x8533('0xb')],'type':_0x8533('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x442b1e,_0x1453fc,_0x2f5bd6){var _0x46e3e5=_0xb9a785['models'];var _0x27744c=_0x442b1e[_0x8533('0xd')]({'plain':!![]});if(_0x27744c[_0x8533('0xe')]['toLowerCase']()==='in'||_0x27744c[_0x8533('0xe')][_0x8533('0xf')]()===_0x8533('0x10')&&!_0x27744c[_0x8533('0x11')]&&!_[_0x8533('0x12')](_0x27744c[_0x8533('0x13')])){_0x46e3e5[_0x8533('0x14')]['findOne']({'where':{'id':_0x27744c['OpenchannelInteractionId']}})['then'](function(_0x5820c6){if(_0x5820c6){_0x5820c6[_0x8533('0x15')]({'lastMsgAt':_0x27744c[_0x8533('0x16')],'lastMsgDirection':_0x27744c[_0x8533('0xe')]['toLowerCase']()});}})[_0x8533('0x17')](function(_0x3e97d6){console[_0x8533('0x18')](_0x3e97d6);});}if(_0x27744c[_0x8533('0xe')]===_0x8533('0x10')&&!_0x27744c['secret']){var _0x4f7325;_0x46e3e5[_0x8533('0x19')][_0x8533('0x1a')]()[_0x8533('0x1b')](function(_0x35adcd){return _0x46e3e5[_0x8533('0x1c')][_0x8533('0x1d')]({'where':{'id':_0x27744c[_0x8533('0x1e')]},'include':[{'model':_0x46e3e5[_0x8533('0x14')],'as':_0x8533('0x1f'),'where':{'id':_0x27744c[_0x8533('0x20')]},'limit':0x1,'include':[{'model':_0x46e3e5[_0x8533('0x19')],'as':_0x8533('0x21'),'attributes':_[_0x8533('0x22')](_0x35adcd)}]}]});})[_0x8533('0x1b')](function(_0x4276da){_0x4f7325=_0x4276da[_0x8533('0xd')]({'plain':!![]});if(_0x4f7325&&_0x4f7325['replyUri']){logger['info'](_0x8533('0x23'),_0x8533('0x24'),util[_0x8533('0x25')](_0x8533('0x26'),_0x27744c['id'],_0x4f7325[_0x8533('0x27')]));if(_0x4f7325['Interactions']&&_0x4f7325['Interactions'][_0x8533('0x28')]){_0x27744c['Interaction']=_[_0x8533('0x29')](_0x4f7325['Interactions'][0x0],_0x8533('0x21'));_0x27744c['Contact']=_0x4f7325['Interactions'][0x0]['Contact'];}var _0x1453fc={'method':_0x8533('0x2a'),'uri':encodeURI(_0x4f7325['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1453fc[_0x8533('0x2b')]){case _0x8533('0x2c'):_0x1453fc['qs']=_0x27744c;break;case _0x8533('0x2a'):_0x1453fc[_0x8533('0xb')]=_0x27744c;break;}return rp(_0x1453fc)[_0x8533('0x1b')](function(_0x4e0a4b){logger[_0x8533('0x2d')]('OpenchannelMessage,\x20%s,\x20%s',_0x8533('0x24'),util[_0x8533('0x25')](_0x8533('0x2e'),_0x27744c['id'],_0x4f7325[_0x8533('0x27')]));if(_0x4e0a4b[_0x8533('0xb')][_0x8533('0x2f')]&&_0x4e0a4b[_0x8533('0xb')]['threadId']!=_0x27744c[_0x8533('0x30')][_0x8533('0x2f')]){return _0x46e3e5[_0x8533('0x14')][_0x8533('0x15')]({'threadId':_0x4e0a4b[_0x8533('0xb')][_0x8533('0x2f')]},{'where':{'id':_0x27744c[_0x8533('0x30')]['id']}});}else{return;}})[_0x8533('0x1b')](function(){return _0x442b1e[_0x8533('0x15')]({'read':!![]});})[_0x8533('0x17')](function(_0x2258da){logger[_0x8533('0x18')](_0x8533('0x23'),_0x8533('0x24'),util[_0x8533('0x31')](_0x2258da,{'showHidden':![],'depth':null}));_0x2f5bd6();});}else{_0x2f5bd6();}})[_0x8533('0x32')](function(){_0x2f5bd6();});}else{_0x2f5bd6();}}},'charset':'utf8mb4','collate':_0x8533('0x33')});}; \ No newline at end of file +var _0xba62=['Contact','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Interaction','omit','POST','GET','body','info','threadId','catch','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','then','update','CmContact','describe','OpenchannelAccount','find','Interactions','OpenchannelInteractionId'];(function(_0x315233,_0x54216c){var _0x5724c5=function(_0x355c18){while(--_0x355c18){_0x315233['push'](_0x315233['shift']());}};_0x5724c5(++_0x54216c);}(_0xba62,0x176));var _0x2ba6=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xba62[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0x2ba6('0x0'));var util=require(_0x2ba6('0x1'));var logger=require(_0x2ba6('0x2'))(_0x2ba6('0x3'));var moment=require(_0x2ba6('0x4'));var BPromise=require(_0x2ba6('0x5'));var rp=require(_0x2ba6('0x6'));var fs=require('fs');var path=require(_0x2ba6('0x7'));var rimraf=require(_0x2ba6('0x8'));var config=require(_0x2ba6('0x9'));var attributes=require(_0x2ba6('0xa'));module[_0x2ba6('0xb')]=function(_0x2ba7b6,_0x46c63e){return _0x2ba7b6[_0x2ba6('0xc')](_0x2ba6('0xd'),attributes,{'tableName':_0x2ba6('0xe'),'paranoid':![],'indexes':[{'name':_0x2ba6('0xf'),'fields':['body'],'type':_0x2ba6('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5297c2,_0x4533c2,_0x3b8fac){var _0x2cc14c=_0x2ba7b6[_0x2ba6('0x11')];var _0x5b37fd=_0x5297c2[_0x2ba6('0x12')]({'plain':!![]});if(_0x5b37fd[_0x2ba6('0x13')]['toLowerCase']()==='in'||_0x5b37fd[_0x2ba6('0x13')][_0x2ba6('0x14')]()===_0x2ba6('0x15')&&!_0x5b37fd[_0x2ba6('0x16')]&&!_[_0x2ba6('0x17')](_0x5b37fd[_0x2ba6('0x18')])){_0x2cc14c[_0x2ba6('0x19')]['findOne']({'where':{'id':_0x5b37fd['OpenchannelInteractionId']}})[_0x2ba6('0x1a')](function(_0x2b1ef3){if(_0x2b1ef3){_0x2b1ef3[_0x2ba6('0x1b')]({'lastMsgAt':_0x5b37fd['createdAt'],'lastMsgDirection':_0x5b37fd[_0x2ba6('0x13')][_0x2ba6('0x14')]()});}})['catch'](function(_0x2b1445){console['error'](_0x2b1445);});}if(_0x5b37fd[_0x2ba6('0x13')]===_0x2ba6('0x15')&&!_0x5b37fd['secret']){var _0x269b41;_0x2cc14c[_0x2ba6('0x1c')][_0x2ba6('0x1d')]()['then'](function(_0x1d84e){return _0x2cc14c[_0x2ba6('0x1e')][_0x2ba6('0x1f')]({'where':{'id':_0x5b37fd['OpenchannelAccountId']},'include':[{'model':_0x2cc14c[_0x2ba6('0x19')],'as':_0x2ba6('0x20'),'where':{'id':_0x5b37fd[_0x2ba6('0x21')]},'limit':0x1,'include':[{'model':_0x2cc14c[_0x2ba6('0x1c')],'as':_0x2ba6('0x22'),'attributes':_['keys'](_0x1d84e)}]}]});})['then'](function(_0x390097){_0x269b41=_0x390097[_0x2ba6('0x12')]({'plain':!![]});if(_0x269b41&&_0x269b41[_0x2ba6('0x23')]){logger['info'](_0x2ba6('0x24'),_0x2ba6('0x25'),util[_0x2ba6('0x26')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x5b37fd['id'],_0x269b41[_0x2ba6('0x23')]));if(_0x269b41[_0x2ba6('0x20')]&&_0x269b41[_0x2ba6('0x20')]['length']){_0x5b37fd[_0x2ba6('0x27')]=_[_0x2ba6('0x28')](_0x269b41['Interactions'][0x0],'Contact');_0x5b37fd[_0x2ba6('0x22')]=_0x269b41[_0x2ba6('0x20')][0x0]['Contact'];}var _0x4533c2={'method':_0x2ba6('0x29'),'uri':encodeURI(_0x269b41[_0x2ba6('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4533c2['method']){case _0x2ba6('0x2a'):_0x4533c2['qs']=_0x5b37fd;break;case'POST':_0x4533c2[_0x2ba6('0x2b')]=_0x5b37fd;break;}return rp(_0x4533c2)[_0x2ba6('0x1a')](function(_0x15afc1){logger[_0x2ba6('0x2c')](_0x2ba6('0x24'),_0x2ba6('0x25'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x5b37fd['id'],_0x269b41[_0x2ba6('0x23')]));if(_0x15afc1[_0x2ba6('0x2b')][_0x2ba6('0x2d')]&&_0x15afc1['body'][_0x2ba6('0x2d')]!=_0x5b37fd[_0x2ba6('0x27')]['threadId']){return _0x2cc14c[_0x2ba6('0x19')][_0x2ba6('0x1b')]({'threadId':_0x15afc1[_0x2ba6('0x2b')]['threadId']},{'where':{'id':_0x5b37fd['Interaction']['id']}});}else{return;}})['then'](function(){return _0x5297c2['update']({'read':!![]});})[_0x2ba6('0x2e')](function(_0xd20b63){logger[_0x2ba6('0x2f')](_0x2ba6('0x24'),_0x2ba6('0x25'),util[_0x2ba6('0x30')](_0xd20b63,{'showHidden':![],'depth':null}));_0x3b8fac();});}else{_0x3b8fac();}})['finally'](function(){_0x3b8fac();});}else{_0x3b8fac();}}},'charset':_0x2ba6('0x31'),'collate':_0x2ba6('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 9909e83..1e99296 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(_0x91011d,_0x438f7d){var _0x797100=function(_0x198f4d){while(--_0x198f4d){_0x91011d['push'](_0x91011d['shift']());}};_0x797100(++_0x438f7d);}(_0x1261,0x144));var _0x1126=function(_0x3feb5f,_0x45cc31){_0x3feb5f=_0x3feb5f-0x0;var _0x5c4911=_0x1261[_0x3feb5f];return _0x5c4911;};'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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4af9b7,_0x51ff06){var _0x2a23ba=function(_0x1ef256){while(--_0x1ef256){_0x4af9b7['push'](_0x4af9b7['shift']());}};_0x2a23ba(++_0x51ff06);}(_0x5f66,0x1a0));var _0x65f6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5f66[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index cf04c81..955e1cc 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 _0x55cd=['emit','removeListener','length','remove'];(function(_0x1fdde7,_0x4676a8){var _0x10e587=function(_0x4d74a0){while(--_0x4d74a0){_0x1fdde7['push'](_0x1fdde7['shift']());}};_0x10e587(++_0x4676a8);}(_0x55cd,0xdb));var _0xd55c=function(_0x5bad1f,_0x509daf){_0x5bad1f=_0x5bad1f-0x0;var _0x5e8ab8=_0x55cd[_0x5bad1f];return _0x5e8ab8;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=['save',_0xd55c('0x0'),'update'];function createListener(_0x3a5cd0,_0x462ab9){return function(_0x1efa97){_0x462ab9[_0xd55c('0x1')](_0x3a5cd0,_0x1efa97);};}function removeListener(_0x5a7c59,_0xb6c552){return function(){OpenchannelMessageEvents[_0xd55c('0x2')](_0x5a7c59,_0xb6c552);};}exports['register']=function(_0x6b25a4){for(var _0xd5d74e=0x0,_0x4fc57b=events[_0xd55c('0x3')];_0xd5d74e<_0x4fc57b;_0xd5d74e++){var _0x1e757b=events[_0xd5d74e];var _0x76f822=createListener('openchannelMessage:'+_0x1e757b,_0x6b25a4);OpenchannelMessageEvents['on'](_0x1e757b,_0x76f822);}}; \ No newline at end of file +var _0xde83=['./openchannelMessage.events','save','remove','update','emit','register','openchannelMessage:'];(function(_0x2ffe98,_0x19e300){var _0x55c69c=function(_0x31844f){while(--_0x31844f){_0x2ffe98['push'](_0x2ffe98['shift']());}};_0x55c69c(++_0x19e300);}(_0xde83,0xe7));var _0x3de8=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0xde83[_0x403115];return _0x596ef3;};'use strict';var OpenchannelMessageEvents=require(_0x3de8('0x0'));var events=[_0x3de8('0x1'),_0x3de8('0x2'),_0x3de8('0x3')];function createListener(_0x54efbf,_0x4eb0b4){return function(_0x3fe36a){_0x4eb0b4[_0x3de8('0x4')](_0x54efbf,_0x3fe36a);};}function removeListener(_0xde609,_0x218e47){return function(){OpenchannelMessageEvents['removeListener'](_0xde609,_0x218e47);};}exports[_0x3de8('0x5')]=function(_0x14330a){for(var _0x513943=0x0,_0x13278f=events['length'];_0x513943<_0x13278f;_0x513943++){var _0x46ee83=events[_0x513943];var _0x3e5eb7=createListener(_0x3de8('0x6')+_0x46ee83,_0x14330a);OpenchannelMessageEvents['on'](_0x46ee83,_0x3e5eb7);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 8759e6e..273283c 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 _0x0f90=['/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','describe','/:id','/:id/members','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','update','delete','destroy'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x0f90,0x1b3));var _0x00f9=function(_0x23b8c4,_0x41b837){_0x23b8c4=_0x23b8c4-0x0;var _0x34b2c7=_0x0f90[_0x23b8c4];return _0x34b2c7;};'use strict';var multer=require(_0x00f9('0x0'));var util=require(_0x00f9('0x1'));var path=require(_0x00f9('0x2'));var timeout=require(_0x00f9('0x3'));var express=require(_0x00f9('0x4'));var router=express[_0x00f9('0x5')]();var fs_extra=require(_0x00f9('0x6'));var auth=require(_0x00f9('0x7'));var interaction=require(_0x00f9('0x8'));var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0x00f9('0x9')]('/',auth[_0x00f9('0xa')](),controller['index']);router[_0x00f9('0x9')]('/describe',auth[_0x00f9('0xa')](),controller[_0x00f9('0xb')]);router['get'](_0x00f9('0xc'),auth[_0x00f9('0xa')](),controller['show']);router[_0x00f9('0x9')](_0x00f9('0xd'),auth[_0x00f9('0xa')](),controller['getMembers']);router[_0x00f9('0x9')](_0x00f9('0xe'),auth[_0x00f9('0xa')](),controller[_0x00f9('0xf')]);router[_0x00f9('0x9')]('/:id/users',auth[_0x00f9('0xa')](),controller[_0x00f9('0x10')]);router[_0x00f9('0x11')]('/',auth[_0x00f9('0xa')](),controller['create']);router['post'](_0x00f9('0xe'),auth[_0x00f9('0xa')](),controller[_0x00f9('0x12')]);router[_0x00f9('0x11')]('/:id/users',auth[_0x00f9('0xa')](),controller[_0x00f9('0x13')]);router[_0x00f9('0x14')](_0x00f9('0xc'),auth[_0x00f9('0xa')](),controller[_0x00f9('0x15')]);router[_0x00f9('0x16')](_0x00f9('0xc'),auth['isAuthenticated'](),controller[_0x00f9('0x17')]);router[_0x00f9('0x16')](_0x00f9('0xe'),auth[_0x00f9('0xa')](),controller['removeTeams']);router[_0x00f9('0x16')](_0x00f9('0x18'),auth[_0x00f9('0xa')](),controller[_0x00f9('0x19')]);module[_0x00f9('0x1a')]=router; \ No newline at end of file +var _0xef1a=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','index','/describe','isAuthenticated','show','/:id/members','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','util'];(function(_0x1f5344,_0x5d990d){var _0xe13d84=function(_0x571fe3){while(--_0x571fe3){_0x1f5344['push'](_0x1f5344['shift']());}};_0xe13d84(++_0x5d990d);}(_0xef1a,0xee));var _0xaef1=function(_0x520dc0,_0x396ab6){_0x520dc0=_0x520dc0-0x0;var _0x2cc700=_0xef1a[_0x520dc0];return _0x2cc700;};'use strict';var multer=require(_0xaef1('0x0'));var util=require(_0xaef1('0x1'));var path=require(_0xaef1('0x2'));var timeout=require(_0xaef1('0x3'));var express=require(_0xaef1('0x4'));var router=express[_0xaef1('0x5')]();var fs_extra=require(_0xaef1('0x6'));var auth=require(_0xaef1('0x7'));var interaction=require(_0xaef1('0x8'));var config=require('../../config/environment');var controller=require(_0xaef1('0x9'));router[_0xaef1('0xa')]('/',auth['isAuthenticated'](),controller[_0xaef1('0xb')]);router[_0xaef1('0xa')](_0xaef1('0xc'),auth[_0xaef1('0xd')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xaef1('0xe')]);router[_0xaef1('0xa')](_0xaef1('0xf'),auth[_0xaef1('0xd')](),controller['getMembers']);router['get']('/:id/teams',auth[_0xaef1('0xd')](),controller[_0xaef1('0x10')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0xaef1('0x11')]);router[_0xaef1('0x12')]('/',auth[_0xaef1('0xd')](),controller[_0xaef1('0x13')]);router[_0xaef1('0x12')](_0xaef1('0x14'),auth[_0xaef1('0xd')](),controller[_0xaef1('0x15')]);router[_0xaef1('0x12')](_0xaef1('0x16'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xaef1('0x17'),auth[_0xaef1('0xd')](),controller[_0xaef1('0x18')]);router[_0xaef1('0x19')](_0xaef1('0x17'),auth[_0xaef1('0xd')](),controller[_0xaef1('0x1a')]);router[_0xaef1('0x19')]('/:id/teams',auth[_0xaef1('0xd')](),controller[_0xaef1('0x1b')]);router[_0xaef1('0x19')](_0xaef1('0x16'),auth[_0xaef1('0xd')](),controller[_0xaef1('0x1c')]);module[_0xaef1('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index ca2a798..349bd57 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 _0xc314=['name','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x34ece7,_0x197dce){var _0x2bb837=function(_0x49a0b7){while(--_0x49a0b7){_0x34ece7['push'](_0x34ece7['shift']());}};_0x2bb837(++_0x197dce);}(_0xc314,0x95));var _0x4c31=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xc314[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x4c31('0x0'));module[_0x4c31('0x1')]={'name':{'type':Sequelize[_0x4c31('0x2')],'unique':_0x4c31('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4c31('0x2')]},'timeout':{'type':Sequelize[_0x4c31('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4c31('0x5')](_0x4c31('0x6'),'beepall',_0x4c31('0x7'))}}; \ No newline at end of file +var _0x23ce=['exports','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x1e6ca4,_0x4899d6){var _0x41824a=function(_0x13091f){while(--_0x13091f){_0x1e6ca4['push'](_0x1e6ca4['shift']());}};_0x41824a(++_0x4899d6);}(_0x23ce,0xc7));var _0xe23c=function(_0x4e87f9,_0x3765ed){_0x4e87f9=_0x4e87f9-0x0;var _0x5576e1=_0x23ce[_0x4e87f9];return _0x5576e1;};'use strict';var Sequelize=require(_0xe23c('0x0'));module[_0xe23c('0x1')]={'name':{'type':Sequelize[_0xe23c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe23c('0x2')]},'timeout':{'type':Sequelize[_0xe23c('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe23c('0x4')](_0xe23c('0x5'),_0xe23c('0x6'),_0xe23c('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2c9e3ac..2654532 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 _0x6460=['limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','OpenchannelQueues','UserProfileResource','error','stack','name','send','OpenchannelQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','SIP','openchannelPause','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','select','field','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','value','removeTeams','isEmpty','userOpenchannelQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','sendStatus','status','end','json','offset'];(function(_0x50eea5,_0x4378af){var _0x3f94a6=function(_0x27d72c){while(--_0x27d72c){_0x50eea5['push'](_0x50eea5['shift']());}};_0x3f94a6(++_0x4378af);}(_0x6460,0x17f));var _0x0646=function(_0x2ba310,_0x5320cb){_0x2ba310=_0x2ba310-0x0;var _0x478aa1=_0x6460[_0x2ba310];return _0x478aa1;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0646('0x0'));var jsonpatch=require(_0x0646('0x1'));var rp=require(_0x0646('0x2'));var moment=require(_0x0646('0x3'));var BPromise=require(_0x0646('0x4'));var Mustache=require(_0x0646('0x5'));var util=require('util');var path=require(_0x0646('0x6'));var sox=require(_0x0646('0x7'));var csv=require(_0x0646('0x8'));var ejs=require(_0x0646('0x9'));var fs=require('fs');var fs_extra=require(_0x0646('0xa'));var _=require(_0x0646('0xb'));var squel=require(_0x0646('0xc'));var crypto=require(_0x0646('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0646('0xe'));var toCsv=require(_0x0646('0x8'));var querystring=require('querystring');var Papa=require(_0x0646('0xf'));var Redis=require('ioredis');var authService=require(_0x0646('0x10'));var qs=require(_0x0646('0x11'));var as=require(_0x0646('0x12'));var hardwareService=require(_0x0646('0x13'));var logger=require('../../config/logger')(_0x0646('0x14'));var utils=require('../../config/utils');var config=require(_0x0646('0x15'));var licenseUtil=require(_0x0646('0x16'));var db=require(_0x0646('0x17'))['db'];config[_0x0646('0x18')]=_[_0x0646('0x19')](config[_0x0646('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x28fe2e,_0x382ce7){_0x382ce7=_0x382ce7||0xcc;return function(_0xb261d){if(_0xb261d){return _0x28fe2e[_0x0646('0x1a')](_0x382ce7);}return _0x28fe2e[_0x0646('0x1b')](_0x382ce7)[_0x0646('0x1c')]();};}function respondWithResult(_0x3f5706,_0x42ad5b){_0x42ad5b=_0x42ad5b||0xc8;return function(_0x2d01b3){if(_0x2d01b3){return _0x3f5706['status'](_0x42ad5b)[_0x0646('0x1d')](_0x2d01b3);}};}function respondWithFilteredResult(_0x39853e,_0x43b325){return function(_0x1d4e0b){if(_0x1d4e0b){var _0x141d10=typeof _0x43b325[_0x0646('0x1e')]==='undefined'&&typeof _0x43b325[_0x0646('0x1f')]===_0x0646('0x20');var _0x176732=_0x1d4e0b[_0x0646('0x21')];var _0x50e8dd=_0x141d10?0x0:_0x43b325['offset'];var _0x2e3105=_0x141d10?_0x1d4e0b[_0x0646('0x21')]:_0x43b325[_0x0646('0x1e')]+_0x43b325[_0x0646('0x1f')];var _0x46bdf7;if(_0x2e3105>=_0x176732){_0x2e3105=_0x176732;_0x46bdf7=0xc8;}else{_0x46bdf7=0xce;}_0x39853e[_0x0646('0x1b')](_0x46bdf7);return _0x39853e['set'](_0x0646('0x22'),_0x50e8dd+'-'+_0x2e3105+'/'+_0x176732)[_0x0646('0x1d')](_0x1d4e0b);}return null;};}function patchUpdates(_0x516133){return function(_0x103127){try{jsonpatch[_0x0646('0x23')](_0x103127,_0x516133,!![]);}catch(_0x3e6409){return BPromise[_0x0646('0x24')](_0x3e6409);}return _0x103127[_0x0646('0x25')]();};}function saveUpdates(_0x5a04bc,_0x4f4457){return function(_0xb069c4){if(_0xb069c4){return _0xb069c4[_0x0646('0x26')](_0x5a04bc)[_0x0646('0x27')](function(_0x44f090){return _0x44f090;});}return null;};}function removeEntity(_0x1ad305,_0x4ac349){return function(_0x5ede5f){if(_0x5ede5f){return _0x5ede5f[_0x0646('0x28')]()[_0x0646('0x27')](function(){var _0x406c4b=_0x5ede5f['get']({'plain':!![]});var _0x281df5=_0x0646('0x29');return db[_0x0646('0x2a')][_0x0646('0x28')]({'where':{'type':_0x281df5,'resourceId':_0x406c4b['id']}})[_0x0646('0x27')](function(){return _0x5ede5f;});})[_0x0646('0x27')](function(){_0x1ad305[_0x0646('0x1b')](0xcc)[_0x0646('0x1c')]();});}};}function handleEntityNotFound(_0x32bc48,_0x2a40fd){return function(_0x2f5201){if(!_0x2f5201){_0x32bc48['sendStatus'](0x194);}return _0x2f5201;};}function handleError(_0x2d1a6b,_0x1736c9){_0x1736c9=_0x1736c9||0x1f4;return function(_0x17846e){logger[_0x0646('0x2b')](_0x17846e[_0x0646('0x2c')]);if(_0x17846e[_0x0646('0x2d')]){delete _0x17846e[_0x0646('0x2d')];}_0x2d1a6b['status'](_0x1736c9)[_0x0646('0x2e')](_0x17846e);};}exports['index']=function(_0x2c3fa3,_0x21b121){var _0x13de93={},_0x459bae={},_0x58cb35={'count':0x0,'rows':[]};var _0x5a98c4=_['map'](db[_0x0646('0x2f')][_0x0646('0x30')],function(_0x5a8235){return{'name':_0x5a8235['fieldName'],'type':_0x5a8235[_0x0646('0x31')][_0x0646('0x32')]};});_0x459bae[_0x0646('0x33')]=_['map'](_0x5a98c4,'name');_0x459bae[_0x0646('0x34')]=_[_0x0646('0x35')](_0x2c3fa3[_0x0646('0x34')]);_0x459bae[_0x0646('0x36')]=_[_0x0646('0x37')](_0x459bae[_0x0646('0x33')],_0x459bae['query']);_0x13de93[_0x0646('0x38')]=_[_0x0646('0x37')](_0x459bae[_0x0646('0x33')],qs[_0x0646('0x39')](_0x2c3fa3[_0x0646('0x34')][_0x0646('0x39')]));_0x13de93[_0x0646('0x38')]=_0x13de93[_0x0646('0x38')]['length']?_0x13de93[_0x0646('0x38')]:_0x459bae[_0x0646('0x33')];if(!_0x2c3fa3[_0x0646('0x34')]['hasOwnProperty'](_0x0646('0x3a'))){_0x13de93[_0x0646('0x1f')]=qs[_0x0646('0x1f')](_0x2c3fa3[_0x0646('0x34')]['limit']);_0x13de93[_0x0646('0x1e')]=qs[_0x0646('0x1e')](_0x2c3fa3[_0x0646('0x34')][_0x0646('0x1e')]);}_0x13de93[_0x0646('0x3b')]=qs[_0x0646('0x3c')](_0x2c3fa3[_0x0646('0x34')][_0x0646('0x3c')]);_0x13de93['where']=qs[_0x0646('0x36')](_[_0x0646('0x3d')](_0x2c3fa3[_0x0646('0x34')],_0x459bae[_0x0646('0x36')]),_0x5a98c4);if(_0x2c3fa3['query'][_0x0646('0x3e')]){_0x13de93[_0x0646('0x3f')]=_[_0x0646('0x40')](_0x13de93[_0x0646('0x3f')],{'$or':_[_0x0646('0x41')](_0x5a98c4,function(_0x26280b){if(_0x26280b[_0x0646('0x31')]!==_0x0646('0x42')){var _0x4a1ac9={};_0x4a1ac9[_0x26280b[_0x0646('0x2d')]]={'$like':'%'+_0x2c3fa3[_0x0646('0x34')]['filter']+'%'};return _0x4a1ac9;}})});}_0x13de93=_[_0x0646('0x40')]({},_0x13de93,_0x2c3fa3[_0x0646('0x43')]);var _0x2158df={'where':_0x13de93[_0x0646('0x3f')]};return db[_0x0646('0x2f')][_0x0646('0x21')](_0x2158df)[_0x0646('0x27')](function(_0x8a0977){_0x58cb35[_0x0646('0x21')]=_0x8a0977;if(_0x2c3fa3[_0x0646('0x34')][_0x0646('0x44')]){_0x13de93[_0x0646('0x45')]=[{'all':!![]}];}return db[_0x0646('0x2f')][_0x0646('0x46')](_0x13de93);})['then'](function(_0x41b03a){_0x58cb35['rows']=_0x41b03a;return _0x58cb35;})[_0x0646('0x27')](respondWithFilteredResult(_0x21b121,_0x13de93))[_0x0646('0x47')](handleError(_0x21b121,null));};exports[_0x0646('0x48')]=function(_0x5129d6,_0x145709){var _0x21a3d={'raw':!![],'where':{'id':_0x5129d6[_0x0646('0x49')]['id']}},_0x18a66d={};_0x18a66d[_0x0646('0x33')]=_[_0x0646('0x35')](db[_0x0646('0x2f')][_0x0646('0x30')]);_0x18a66d[_0x0646('0x34')]=_[_0x0646('0x35')](_0x5129d6[_0x0646('0x34')]);_0x18a66d[_0x0646('0x36')]=_[_0x0646('0x37')](_0x18a66d[_0x0646('0x33')],_0x18a66d[_0x0646('0x34')]);_0x21a3d[_0x0646('0x38')]=_[_0x0646('0x37')](_0x18a66d[_0x0646('0x33')],qs[_0x0646('0x39')](_0x5129d6['query'][_0x0646('0x39')]));_0x21a3d[_0x0646('0x38')]=_0x21a3d[_0x0646('0x38')][_0x0646('0x4a')]?_0x21a3d['attributes']:_0x18a66d[_0x0646('0x33')];if(_0x5129d6[_0x0646('0x34')]['includeAll']){_0x21a3d[_0x0646('0x45')]=[{'all':!![]}];}_0x21a3d=_[_0x0646('0x40')]({},_0x21a3d,_0x5129d6[_0x0646('0x43')]);return db['OpenchannelQueue']['find'](_0x21a3d)['then'](handleEntityNotFound(_0x145709,null))['then'](respondWithResult(_0x145709,null))[_0x0646('0x47')](handleError(_0x145709,null));};exports[_0x0646('0x4b')]=function(_0x18f1d3,_0x4249d7){return db[_0x0646('0x2f')][_0x0646('0x4b')](_0x18f1d3['body'],{})[_0x0646('0x27')](function(_0x3eb341){var _0x5081eb=_0x18f1d3[_0x0646('0x4c')][_0x0646('0x4d')]({'plain':!![]});if(!_0x5081eb)throw new Error(_0x0646('0x4e'));if(_0x5081eb['role']==='user'){var _0x5def75=_0x3eb341[_0x0646('0x4d')]({'plain':!![]});var _0x1e644c=_0x0646('0x29');return db['UserProfileSection'][_0x0646('0x4f')]({'where':{'name':_0x1e644c,'userProfileId':_0x5081eb[_0x0646('0x50')]},'raw':!![]})[_0x0646('0x27')](function(_0x2779ab){if(_0x2779ab&&_0x2779ab[_0x0646('0x51')]===0x0){return db[_0x0646('0x2a')][_0x0646('0x4b')]({'name':_0x5def75[_0x0646('0x2d')],'resourceId':_0x5def75['id'],'type':_0x2779ab[_0x0646('0x2d')],'sectionId':_0x2779ab['id']},{})[_0x0646('0x27')](function(){return _0x3eb341;});}else{return _0x3eb341;}})[_0x0646('0x47')](function(_0x47d988){logger[_0x0646('0x2b')](_0x0646('0x52'),_0x47d988);throw _0x47d988;});}return _0x3eb341;})[_0x0646('0x27')](respondWithResult(_0x4249d7,0xc9))[_0x0646('0x47')](handleError(_0x4249d7,null));};exports[_0x0646('0x26')]=function(_0x4ecd77,_0x4d0840){if(_0x4ecd77['body']['id']){delete _0x4ecd77[_0x0646('0x53')]['id'];}return db[_0x0646('0x2f')][_0x0646('0x4f')]({'where':{'id':_0x4ecd77[_0x0646('0x49')]['id']}})['then'](handleEntityNotFound(_0x4d0840,null))[_0x0646('0x27')](saveUpdates(_0x4ecd77[_0x0646('0x53')],null))[_0x0646('0x27')](respondWithResult(_0x4d0840,null))['catch'](handleError(_0x4d0840,null));};exports[_0x0646('0x28')]=function(_0x182765,_0x335fb2){return db[_0x0646('0x2f')]['find']({'where':{'id':_0x182765[_0x0646('0x49')]['id']}})[_0x0646('0x27')](handleEntityNotFound(_0x335fb2,null))['then'](removeEntity(_0x335fb2,null))[_0x0646('0x47')](handleError(_0x335fb2,null));};exports[_0x0646('0x54')]=function(_0x22692f,_0x535c77){return db[_0x0646('0x2f')][_0x0646('0x54')]()[_0x0646('0x27')](respondWithResult(_0x535c77,null))['catch'](handleError(_0x535c77,null));};exports[_0x0646('0x55')]=function(_0x58627b,_0x21e4a8,_0x147192){var _0x6936d8={'raw':!![],'where':{}},_0x4df269={},_0x3ec89e;return db['OpenchannelQueue'][_0x0646('0x56')]({'where':{'id':_0x58627b[_0x0646('0x49')]['id']}})[_0x0646('0x27')](handleEntityNotFound(_0x21e4a8,null))[_0x0646('0x27')](function(_0x285bcd){if(_0x285bcd){_0x3ec89e=_0x285bcd['get']({'plain':!![]});_0x4df269[_0x0646('0x33')]=_[_0x0646('0x35')](db[_0x0646('0x57')][_0x0646('0x30')]);_0x4df269[_0x0646('0x34')]=_['keys'](_0x58627b[_0x0646('0x34')]);_0x4df269[_0x0646('0x36')]=_['intersection'](_0x4df269[_0x0646('0x33')],_0x4df269[_0x0646('0x34')]);_0x6936d8[_0x0646('0x38')]=_[_0x0646('0x37')](_0x4df269['model'],qs[_0x0646('0x39')](_0x58627b['query']['fields']));_0x6936d8[_0x0646('0x38')]=_0x6936d8[_0x0646('0x38')][_0x0646('0x4a')]?_0x6936d8[_0x0646('0x38')]:_0x4df269[_0x0646('0x33')];if(!_0x58627b[_0x0646('0x34')][_0x0646('0x58')](_0x0646('0x3a'))){_0x6936d8[_0x0646('0x1f')]=qs[_0x0646('0x1f')](_0x58627b['query'][_0x0646('0x1f')]);_0x6936d8['offset']=qs['offset'](_0x58627b[_0x0646('0x34')][_0x0646('0x1e')]);}_0x6936d8['order']=qs[_0x0646('0x3c')](_0x58627b['query'][_0x0646('0x3c')]);_0x6936d8[_0x0646('0x3f')]=qs[_0x0646('0x36')](_[_0x0646('0x3d')](_0x58627b[_0x0646('0x34')],_0x4df269[_0x0646('0x36')]));_0x6936d8[_0x0646('0x3f')]['OpenchannelQueueId']=_0x285bcd['id'];if(_0x58627b[_0x0646('0x34')][_0x0646('0x3e')]){_0x6936d8[_0x0646('0x3f')]=_['merge'](_0x6936d8[_0x0646('0x3f')],{'$or':_[_0x0646('0x41')](_0x6936d8['attributes'],function(_0xdd6c6f){var _0x52f45b={};_0x52f45b[_0xdd6c6f]={'$like':'%'+_0x58627b[_0x0646('0x34')][_0x0646('0x3e')]+'%'};return _0x52f45b;})});}_0x6936d8=_[_0x0646('0x40')]({},_0x6936d8,_0x58627b[_0x0646('0x43')]);return db[_0x0646('0x57')][_0x0646('0x46')](_0x6936d8);}})[_0x0646('0x27')](function(_0x2a5558){if(_0x2a5558){return db[_0x0646('0x59')][_0x0646('0x5a')]({'where':{'id':_[_0x0646('0x41')](_0x2a5558,_0x0646('0x5b')),'role':_0x0646('0x5c')},'attributes':['id',_0x0646('0x2d'),'openchannelPause',_0x0646('0x5d'),_0x0646('0x5e')]});}})[_0x0646('0x27')](function(_0x14fc3c){if(_0x14fc3c){return{'count':_0x14fc3c[_0x0646('0x21')],'rows':_[_0x0646('0x41')](_0x14fc3c[_0x0646('0x5f')],function(_0x287b77){return{'membername':_0x287b77[_0x0646('0x2d')],'UserId':_0x287b77['id'],'queue_name':_0x3ec89e[_0x0646('0x2d')],'OpenchannelQueueId':_0x3ec89e['id'],'interface':util['format']('%s/%s',_0x0646('0x60'),_0x287b77[_0x0646('0x2d')]),'penalty':0x0,'paused':_0x287b77[_0x0646('0x61')],'createdAt':_0x287b77[_0x0646('0x5e')],'updatedAt':_0x287b77[_0x0646('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0646('0x27')](respondWithFilteredResult(_0x21e4a8,_0x6936d8))[_0x0646('0x47')](handleError(_0x21e4a8,null));};exports[_0x0646('0x62')]=function(_0x2518e9,_0x7a86ac,_0x33bc6e){var _0x162133={};var _0x25243d={};var _0xbe12ee;var _0x323c4a;return db[_0x0646('0x2f')][_0x0646('0x56')]({'where':{'id':_0x2518e9['params']['id']}})[_0x0646('0x27')](handleEntityNotFound(_0x7a86ac,null))[_0x0646('0x27')](function(_0x52731b){if(_0x52731b){_0xbe12ee=_0x52731b;_0x25243d[_0x0646('0x33')]=_[_0x0646('0x35')](db[_0x0646('0x63')][_0x0646('0x30')]);_0x25243d[_0x0646('0x34')]=_['keys'](_0x2518e9[_0x0646('0x34')]);_0x25243d['filters']=_[_0x0646('0x37')](_0x25243d[_0x0646('0x33')],_0x25243d['query']);_0x162133[_0x0646('0x38')]=_[_0x0646('0x37')](_0x25243d[_0x0646('0x33')],qs[_0x0646('0x39')](_0x2518e9[_0x0646('0x34')][_0x0646('0x39')]));_0x162133[_0x0646('0x38')]=_0x162133[_0x0646('0x38')][_0x0646('0x4a')]?_0x162133[_0x0646('0x38')]:_0x25243d['model'];_0x162133[_0x0646('0x3b')]=qs['sort'](_0x2518e9[_0x0646('0x34')][_0x0646('0x3c')]);_0x162133['where']=qs['filters'](_[_0x0646('0x3d')](_0x2518e9[_0x0646('0x34')],_0x25243d[_0x0646('0x36')]));if(_0x2518e9[_0x0646('0x34')][_0x0646('0x3e')]){_0x162133['where']=_[_0x0646('0x40')](_0x162133[_0x0646('0x3f')],{'$or':_[_0x0646('0x41')](_0x162133['attributes'],function(_0x594c8c){var _0x3ea6a7={};_0x3ea6a7[_0x594c8c]={'$like':'%'+_0x2518e9[_0x0646('0x34')]['filter']+'%'};return _0x3ea6a7;})});}_0x162133=_[_0x0646('0x40')]({},_0x162133,_0x2518e9[_0x0646('0x43')]);return _0xbe12ee[_0x0646('0x62')](_0x162133);}})['then'](function(_0x220cb2){if(_0x220cb2){_0x323c4a=_0x220cb2[_0x0646('0x4a')];if(!_0x2518e9['query']['hasOwnProperty']('nolimit')){_0x162133[_0x0646('0x1f')]=qs['limit'](_0x2518e9[_0x0646('0x34')][_0x0646('0x1f')]);_0x162133[_0x0646('0x1e')]=qs[_0x0646('0x1e')](_0x2518e9[_0x0646('0x34')]['offset']);}return _0xbe12ee[_0x0646('0x62')](_0x162133);}})[_0x0646('0x27')](function(_0x424c27){if(_0x424c27){return _0x424c27?{'count':_0x323c4a,'rows':_0x424c27}:null;}})['then'](respondWithResult(_0x7a86ac,null))['catch'](handleError(_0x7a86ac,null));};exports[_0x0646('0x64')]=function(_0xfeb93c,_0x105276,_0x2f89d1){var _0x2c3e36=_0xfeb93c[_0x0646('0x53')][_0x0646('0x65')];return db[_0x0646('0x63')][_0x0646('0x46')]({'where':{'id':_0x2c3e36},'attributes':['id'],'include':[{'model':db[_0x0646('0x59')],'as':_0x0646('0x66'),'attributes':['id',_0x0646('0x2d'),'online',_0x0646('0x67'),_0x0646('0x68')],'raw':!![]}]})[_0x0646('0x27')](function(_0x4321d6){if(_0x4321d6){var _0x13577c=_[_0x0646('0x69')](_0x4321d6,function(_0x543e7e){var _0xa4914=_0x543e7e['get']({'plain':!![]});return _0xa4914[_0x0646('0x66')];});return db[_0x0646('0x2f')][_0x0646('0x4f')]({'where':{'id':_0xfeb93c[_0x0646('0x49')]['id']}})['then'](function(_0x1181a3){return db[_0x0646('0x6a')][_0x0646('0x6b')](function(_0xd9a180){return _0x1181a3[_0x0646('0x64')](_0x2c3e36,{'transaction':_0xd9a180})[_0x0646('0x27')](function(){return BPromise['each'](_0x13577c,function(_0xa5ab69){return db[_0x0646('0x57')][_0x0646('0x6c')]({'where':{'UserId':_0xa5ab69['id'],'OpenchannelQueueId':_0xfeb93c[_0x0646('0x49')]['id']},'transaction':_0xd9a180});});})[_0x0646('0x27')](function(){_0x13577c[_0x0646('0x6d')](function(_0x1a6e89){socket[_0x0646('0x6e')](_0x0646('0x6f'),{'UserId':_0x1a6e89['id'],'OpenchannelQueueId':_0x1181a3['id']});});});});});}})[_0x0646('0x27')](respondWithStatusCode(_0x105276,null))[_0x0646('0x47')](handleError(_0x105276,null));};exports['removeTeams']=function(_0x218b8d,_0x3a6558,_0x4da9fb){return db[_0x0646('0x63')][_0x0646('0x46')]({'where':{'id':_0x218b8d[_0x0646('0x34')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0646('0x59')],'as':_0x0646('0x66'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3a6558,null))['then'](function(_0x453ae9){var _0x1eefe3=_[_0x0646('0x41')](_0x453ae9,'id');var _0x4946cd=[];var _0x5444bd=[];var _0x129984=squel[_0x0646('0x70')]();_0x129984[_0x0646('0x71')]('tq.TeamId')[_0x0646('0x72')](_0x0646('0x73'),'tq')[_0x0646('0x74')](_0x0646('0x75'),'ut',_0x0646('0x76'))[_0x0646('0x3f')](_0x0646('0x77'),_0x218b8d[_0x0646('0x49')]['id']);for(var _0x3225f8=0x0;_0x3225f8<_0x453ae9['length'];_0x3225f8+=0x1){let _0x5ba442=_0x453ae9[_0x3225f8];for(var _0x22b001=0x0;_0x22b001<_0x5ba442[_0x0646('0x66')]['length'];_0x22b001+=0x1){let _0x9b1520=_0x5ba442[_0x0646('0x66')][_0x22b001];var _0x24da3a=_0x129984[_0x0646('0x78')]();_0x24da3a[_0x0646('0x3f')](_0x0646('0x79'),_0x9b1520['id']);_0x5444bd[_0x0646('0x7a')](db['sequelize']['query'](_0x24da3a['toString'](),{'type':db[_0x0646('0x6a')][_0x0646('0x7b')][_0x0646('0x7c')]})[_0x0646('0x27')](function(_0x47345e){if(_0x47345e[_0x0646('0x4a')]===0x1){return _0x9b1520['id'];}else{var _0xa001da=_[_0x0646('0x7d')](_[_0x0646('0x41')](_0x47345e,_0x0646('0x7e')),function(_0x20e0de){return _[_0x0646('0x7f')](_0x1eefe3,_0x20e0de);});if(_0xa001da){return _0x9b1520['id'];}}}));}}return BPromise['all'](_0x5444bd)[_0x0646('0x27')](function(_0x1f3cf7){_0x4946cd=_(_0x4946cd)[_0x0646('0x80')](_0x1f3cf7)['compact']()[_0x0646('0x81')]();return db['OpenchannelQueue'][_0x0646('0x4f')]({'where':{'id':_0x218b8d[_0x0646('0x49')]['id']}})[_0x0646('0x27')](function(_0x2296bd){return db[_0x0646('0x6a')]['transaction'](function(_0x469af7){return _0x2296bd[_0x0646('0x82')](_0x218b8d[_0x0646('0x34')][_0x0646('0x65')],{'transaction':_0x469af7})[_0x0646('0x27')](function(){if(!_[_0x0646('0x83')](_0x4946cd)){return _0x2296bd['removeAgents'](_0x4946cd,{'transaction':_0x469af7});}})['then'](function(){_0x4946cd[_0x0646('0x6d')](function(_0xca8df7){socket[_0x0646('0x6e')](_0x0646('0x84'),{'UserId':_0xca8df7,'OpenchannelQueueId':_0x2296bd['id']});});});});});});})[_0x0646('0x27')](respondWithStatusCode(_0x3a6558,null))[_0x0646('0x47')](handleError(_0x3a6558,null));};exports['addAgents']=function(_0x196562,_0x203867,_0xc3a7c7){return db[_0x0646('0x2f')]['find']({'where':{'id':_0x196562[_0x0646('0x49')]['id']}})['then'](handleEntityNotFound(_0x203867,null))[_0x0646('0x27')](function(_0x5e9c1b){if(_0x5e9c1b){return _0x5e9c1b[_0x0646('0x85')](_0x196562[_0x0646('0x53')]['ids'],_['omit'](_0x196562[_0x0646('0x53')],['ids','id'])||{})[_0x0646('0x86')](function(_0x57ed0b){for(var _0x1d40b7=0x0;_0x1d40b7<_0x196562['body']['ids'][_0x0646('0x4a')];_0x1d40b7+=0x1){socket[_0x0646('0x6e')]('userOpenchannelQueue:save',{'UserId':Number(_0x196562[_0x0646('0x53')]['ids'][_0x1d40b7]),'OpenchannelQueueId':Number(_0x196562[_0x0646('0x49')]['id'])});}return _0x57ed0b;});}})[_0x0646('0x27')](respondWithResult(_0x203867,null))[_0x0646('0x47')](handleError(_0x203867,null));};exports[_0x0646('0x87')]=function(_0x3cf86c,_0x32d8db,_0x17163b){return db[_0x0646('0x2f')]['find']({'where':{'id':_0x3cf86c['params']['id']}})[_0x0646('0x27')](handleEntityNotFound(_0x32d8db,null))[_0x0646('0x27')](function(_0x4f3a5d){if(_0x4f3a5d){return _0x4f3a5d[_0x0646('0x87')](_0x3cf86c[_0x0646('0x34')]['ids'])[_0x0646('0x27')](function(){if(_[_0x0646('0x88')](_0x3cf86c[_0x0646('0x34')][_0x0646('0x65')])){for(var _0x31fc9e=0x0;_0x31fc9e<_0x3cf86c[_0x0646('0x34')][_0x0646('0x65')][_0x0646('0x4a')];_0x31fc9e+=0x1){socket[_0x0646('0x6e')](_0x0646('0x84'),{'UserId':Number(_0x3cf86c[_0x0646('0x34')][_0x0646('0x65')][_0x31fc9e]),'OpenchannelQueueId':Number(_0x3cf86c[_0x0646('0x49')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x3cf86c[_0x0646('0x34')][_0x0646('0x65')]),'OpenchannelQueueId':Number(_0x3cf86c[_0x0646('0x49')]['id'])});}});}})[_0x0646('0x27')](respondWithStatusCode(_0x32d8db,null))[_0x0646('0x47')](handleError(_0x32d8db,null));};exports[_0x0646('0x89')]=function(_0x464e18,_0x2b5c2c,_0x27d086){var _0x149d80={};var _0x49ad4b={};var _0x5409b2;var _0x5c71bf;return db['OpenchannelQueue'][_0x0646('0x56')]({'where':{'id':_0x464e18[_0x0646('0x49')]['id']}})[_0x0646('0x27')](handleEntityNotFound(_0x2b5c2c,null))['then'](function(_0x38229d){if(_0x38229d){_0x5409b2=_0x38229d;_0x49ad4b[_0x0646('0x33')]=_['keys'](db[_0x0646('0x59')][_0x0646('0x30')]);_0x49ad4b['query']=_[_0x0646('0x35')](_0x464e18[_0x0646('0x34')]);_0x49ad4b[_0x0646('0x36')]=_[_0x0646('0x37')](_0x49ad4b['model'],_0x49ad4b[_0x0646('0x34')]);_0x149d80[_0x0646('0x38')]=_[_0x0646('0x37')](_0x49ad4b[_0x0646('0x33')],qs[_0x0646('0x39')](_0x464e18[_0x0646('0x34')][_0x0646('0x39')]));_0x149d80[_0x0646('0x38')]=_0x149d80[_0x0646('0x38')][_0x0646('0x4a')]?_0x149d80[_0x0646('0x38')]:_0x49ad4b['model'];_0x149d80['order']=qs[_0x0646('0x3c')](_0x464e18['query'][_0x0646('0x3c')]);_0x149d80[_0x0646('0x3f')]=qs[_0x0646('0x36')](_['pick'](_0x464e18[_0x0646('0x34')],_0x49ad4b['filters']));if(_0x464e18[_0x0646('0x34')][_0x0646('0x3e')]){_0x149d80[_0x0646('0x3f')]=_[_0x0646('0x40')](_0x149d80['where'],{'$or':_[_0x0646('0x41')](_0x149d80[_0x0646('0x38')],function(_0x50e606){var _0x2c0db6={};_0x2c0db6[_0x50e606]={'$like':'%'+_0x464e18[_0x0646('0x34')]['filter']+'%'};return _0x2c0db6;})});}_0x149d80=_['merge']({},_0x149d80,_0x464e18['options']);return _0x5409b2[_0x0646('0x89')](_0x149d80);}})[_0x0646('0x27')](function(_0x1144cf){if(_0x1144cf){_0x5c71bf=_0x1144cf[_0x0646('0x4a')];if(!_0x464e18['query']['hasOwnProperty'](_0x0646('0x3a'))){_0x149d80[_0x0646('0x1f')]=qs[_0x0646('0x1f')](_0x464e18[_0x0646('0x34')][_0x0646('0x1f')]);_0x149d80['offset']=qs['offset'](_0x464e18[_0x0646('0x34')][_0x0646('0x1e')]);}return _0x5409b2[_0x0646('0x89')](_0x149d80);}})['then'](function(_0x2190f2){if(_0x2190f2){return _0x2190f2?{'count':_0x5c71bf,'rows':_0x2190f2}:null;}})['then'](respondWithResult(_0x2b5c2c,null))[_0x0646('0x47')](handleError(_0x2b5c2c,null));}; \ No newline at end of file +var _0xf2f0=['include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','User','map','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','findOne','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','all','union','value','transaction','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','fs-extra','lodash','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','register','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','OpenchannelQueues','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelQueue','then','includeAll'];(function(_0x98db33,_0x397f20){var _0x5ae63a=function(_0x411f1c){while(--_0x411f1c){_0x98db33['push'](_0x98db33['shift']());}};_0x5ae63a(++_0x397f20);}(_0xf2f0,0x1f3));var _0x0f2f=function(_0x348547,_0x32a2fb){_0x348547=_0x348547-0x0;var _0xceed34=_0xf2f0[_0x348547];return _0xceed34;};'use strict';var emlformat=require(_0x0f2f('0x0'));var rimraf=require(_0x0f2f('0x1'));var zipdir=require(_0x0f2f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f2f('0x3'));var moment=require(_0x0f2f('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0f2f('0x5'));var sox=require(_0x0f2f('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f2f('0x7'));var _=require(_0x0f2f('0x8'));var squel=require('squel');var crypto=require(_0x0f2f('0x9'));var jsforce=require(_0x0f2f('0xa'));var deskjs=require(_0x0f2f('0xb'));var toCsv=require(_0x0f2f('0xc'));var querystring=require(_0x0f2f('0xd'));var Papa=require(_0x0f2f('0xe'));var Redis=require(_0x0f2f('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0f2f('0x10'));var as=require(_0x0f2f('0x11'));var hardwareService=require(_0x0f2f('0x12'));var logger=require(_0x0f2f('0x13'))(_0x0f2f('0x14'));var utils=require('../../config/utils');var config=require(_0x0f2f('0x15'));var licenseUtil=require(_0x0f2f('0x16'));var db=require(_0x0f2f('0x17'))['db'];config[_0x0f2f('0x18')]=_[_0x0f2f('0x19')](config[_0x0f2f('0x18')],{'host':_0x0f2f('0x1a'),'port':0x18eb});var socket=require(_0x0f2f('0x1b'))(new Redis(config[_0x0f2f('0x18')]));require('./openchannelQueue.socket')[_0x0f2f('0x1c')](socket);function respondWithStatusCode(_0x300419,_0x1cb6e3){_0x1cb6e3=_0x1cb6e3||0xcc;return function(_0x590ba7){if(_0x590ba7){return _0x300419['sendStatus'](_0x1cb6e3);}return _0x300419[_0x0f2f('0x1d')](_0x1cb6e3)[_0x0f2f('0x1e')]();};}function respondWithResult(_0x95a7cb,_0xdf5e5c){_0xdf5e5c=_0xdf5e5c||0xc8;return function(_0x2c54d3){if(_0x2c54d3){return _0x95a7cb['status'](_0xdf5e5c)['json'](_0x2c54d3);}};}function respondWithFilteredResult(_0x4d2a14,_0x2fb20c){return function(_0xdb9d56){if(_0xdb9d56){var _0x3e38dd=typeof _0x2fb20c[_0x0f2f('0x1f')]===_0x0f2f('0x20')&&typeof _0x2fb20c[_0x0f2f('0x21')]===_0x0f2f('0x20');var _0x43158b=_0xdb9d56['count'];var _0x2b6852=_0x3e38dd?0x0:_0x2fb20c[_0x0f2f('0x1f')];var _0x15f195=_0x3e38dd?_0xdb9d56[_0x0f2f('0x22')]:_0x2fb20c[_0x0f2f('0x1f')]+_0x2fb20c[_0x0f2f('0x21')];var _0x5c06e4;if(_0x15f195>=_0x43158b){_0x15f195=_0x43158b;_0x5c06e4=0xc8;}else{_0x5c06e4=0xce;}_0x4d2a14[_0x0f2f('0x1d')](_0x5c06e4);return _0x4d2a14[_0x0f2f('0x23')](_0x0f2f('0x24'),_0x2b6852+'-'+_0x15f195+'/'+_0x43158b)['json'](_0xdb9d56);}return null;};}function patchUpdates(_0x5292bd){return function(_0x1159be){try{jsonpatch['apply'](_0x1159be,_0x5292bd,!![]);}catch(_0x2825dc){return BPromise[_0x0f2f('0x25')](_0x2825dc);}return _0x1159be[_0x0f2f('0x26')]();};}function saveUpdates(_0x352ce8,_0xddbb26){return function(_0x24df08){if(_0x24df08){return _0x24df08[_0x0f2f('0x27')](_0x352ce8)['then'](function(_0x46abe4){return _0x46abe4;});}return null;};}function removeEntity(_0xaafad9,_0xe0b6ef){return function(_0x2c2c45){if(_0x2c2c45){return _0x2c2c45[_0x0f2f('0x28')]()['then'](function(){var _0xb64fbe=_0x2c2c45[_0x0f2f('0x29')]({'plain':!![]});var _0x475353=_0x0f2f('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x475353,'resourceId':_0xb64fbe['id']}})['then'](function(){return _0x2c2c45;});})['then'](function(){_0xaafad9[_0x0f2f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2317,_0x174d88){return function(_0xdb761){if(!_0xdb761){_0x3d2317[_0x0f2f('0x2b')](0x194);}return _0xdb761;};}function handleError(_0x56fb99,_0x24af70){_0x24af70=_0x24af70||0x1f4;return function(_0x3a5e84){logger[_0x0f2f('0x2c')](_0x3a5e84[_0x0f2f('0x2d')]);if(_0x3a5e84[_0x0f2f('0x2e')]){delete _0x3a5e84[_0x0f2f('0x2e')];}_0x56fb99[_0x0f2f('0x1d')](_0x24af70)['send'](_0x3a5e84);};}exports[_0x0f2f('0x2f')]=function(_0x1515ea,_0x55b53f){var _0x5f257d={},_0x28a9cd={},_0x307313={'count':0x0,'rows':[]};var _0x3d650f=_['map'](db['OpenchannelQueue'][_0x0f2f('0x30')],function(_0x3de2c7){return{'name':_0x3de2c7[_0x0f2f('0x31')],'type':_0x3de2c7[_0x0f2f('0x32')][_0x0f2f('0x33')]};});_0x28a9cd[_0x0f2f('0x34')]=_['map'](_0x3d650f,_0x0f2f('0x2e'));_0x28a9cd[_0x0f2f('0x35')]=_[_0x0f2f('0x36')](_0x1515ea['query']);_0x28a9cd[_0x0f2f('0x37')]=_[_0x0f2f('0x38')](_0x28a9cd[_0x0f2f('0x34')],_0x28a9cd[_0x0f2f('0x35')]);_0x5f257d[_0x0f2f('0x39')]=_['intersection'](_0x28a9cd[_0x0f2f('0x34')],qs[_0x0f2f('0x3a')](_0x1515ea[_0x0f2f('0x35')][_0x0f2f('0x3a')]));_0x5f257d[_0x0f2f('0x39')]=_0x5f257d[_0x0f2f('0x39')][_0x0f2f('0x3b')]?_0x5f257d[_0x0f2f('0x39')]:_0x28a9cd[_0x0f2f('0x34')];if(!_0x1515ea['query'][_0x0f2f('0x3c')](_0x0f2f('0x3d'))){_0x5f257d[_0x0f2f('0x21')]=qs[_0x0f2f('0x21')](_0x1515ea[_0x0f2f('0x35')][_0x0f2f('0x21')]);_0x5f257d[_0x0f2f('0x1f')]=qs[_0x0f2f('0x1f')](_0x1515ea[_0x0f2f('0x35')]['offset']);}_0x5f257d[_0x0f2f('0x3e')]=qs['sort'](_0x1515ea[_0x0f2f('0x35')][_0x0f2f('0x3f')]);_0x5f257d[_0x0f2f('0x40')]=qs[_0x0f2f('0x37')](_[_0x0f2f('0x41')](_0x1515ea[_0x0f2f('0x35')],_0x28a9cd[_0x0f2f('0x37')]),_0x3d650f);if(_0x1515ea[_0x0f2f('0x35')][_0x0f2f('0x42')]){_0x5f257d['where']=_[_0x0f2f('0x43')](_0x5f257d[_0x0f2f('0x40')],{'$or':_['map'](_0x3d650f,function(_0x1ab431){if(_0x1ab431['type']!==_0x0f2f('0x44')){var _0x5415f9={};_0x5415f9[_0x1ab431[_0x0f2f('0x2e')]]={'$like':'%'+_0x1515ea['query']['filter']+'%'};return _0x5415f9;}})});}_0x5f257d=_['merge']({},_0x5f257d,_0x1515ea[_0x0f2f('0x45')]);var _0x4ffd98={'where':_0x5f257d[_0x0f2f('0x40')]};return db[_0x0f2f('0x46')][_0x0f2f('0x22')](_0x4ffd98)[_0x0f2f('0x47')](function(_0x5ee32b){_0x307313[_0x0f2f('0x22')]=_0x5ee32b;if(_0x1515ea[_0x0f2f('0x35')][_0x0f2f('0x48')]){_0x5f257d[_0x0f2f('0x49')]=[{'all':!![]}];}return db[_0x0f2f('0x46')][_0x0f2f('0x4a')](_0x5f257d);})['then'](function(_0xaaa825){_0x307313[_0x0f2f('0x4b')]=_0xaaa825;return _0x307313;})['then'](respondWithFilteredResult(_0x55b53f,_0x5f257d))[_0x0f2f('0x4c')](handleError(_0x55b53f,null));};exports[_0x0f2f('0x4d')]=function(_0x1bc64e,_0x4a2b28){var _0x4f4ebd={'raw':!![],'where':{'id':_0x1bc64e[_0x0f2f('0x4e')]['id']}},_0x4ea555={};_0x4ea555[_0x0f2f('0x34')]=_[_0x0f2f('0x36')](db[_0x0f2f('0x46')][_0x0f2f('0x30')]);_0x4ea555[_0x0f2f('0x35')]=_[_0x0f2f('0x36')](_0x1bc64e[_0x0f2f('0x35')]);_0x4ea555[_0x0f2f('0x37')]=_[_0x0f2f('0x38')](_0x4ea555[_0x0f2f('0x34')],_0x4ea555[_0x0f2f('0x35')]);_0x4f4ebd[_0x0f2f('0x39')]=_[_0x0f2f('0x38')](_0x4ea555['model'],qs[_0x0f2f('0x3a')](_0x1bc64e[_0x0f2f('0x35')][_0x0f2f('0x3a')]));_0x4f4ebd[_0x0f2f('0x39')]=_0x4f4ebd['attributes'][_0x0f2f('0x3b')]?_0x4f4ebd[_0x0f2f('0x39')]:_0x4ea555[_0x0f2f('0x34')];if(_0x1bc64e[_0x0f2f('0x35')][_0x0f2f('0x48')]){_0x4f4ebd[_0x0f2f('0x49')]=[{'all':!![]}];}_0x4f4ebd=_[_0x0f2f('0x43')]({},_0x4f4ebd,_0x1bc64e[_0x0f2f('0x45')]);return db[_0x0f2f('0x46')][_0x0f2f('0x4f')](_0x4f4ebd)['then'](handleEntityNotFound(_0x4a2b28,null))[_0x0f2f('0x47')](respondWithResult(_0x4a2b28,null))[_0x0f2f('0x4c')](handleError(_0x4a2b28,null));};exports[_0x0f2f('0x50')]=function(_0x3f536e,_0x5f583c){return db['OpenchannelQueue'][_0x0f2f('0x50')](_0x3f536e['body'],{})['then'](function(_0x2dc1d6){var _0x57ecc7=_0x3f536e[_0x0f2f('0x51')]['get']({'plain':!![]});if(!_0x57ecc7)throw new Error(_0x0f2f('0x52'));if(_0x57ecc7['role']===_0x0f2f('0x51')){var _0x4bd32b=_0x2dc1d6[_0x0f2f('0x29')]({'plain':!![]});var _0x1d967d=_0x0f2f('0x2a');return db[_0x0f2f('0x53')]['find']({'where':{'name':_0x1d967d,'userProfileId':_0x57ecc7[_0x0f2f('0x54')]},'raw':!![]})['then'](function(_0x2551f1){if(_0x2551f1&&_0x2551f1[_0x0f2f('0x55')]===0x0){return db[_0x0f2f('0x56')][_0x0f2f('0x50')]({'name':_0x4bd32b['name'],'resourceId':_0x4bd32b['id'],'type':_0x2551f1['name'],'sectionId':_0x2551f1['id']},{})[_0x0f2f('0x47')](function(){return _0x2dc1d6;});}else{return _0x2dc1d6;}})[_0x0f2f('0x4c')](function(_0x5b978b){logger['error'](_0x0f2f('0x57'),_0x5b978b);throw _0x5b978b;});}return _0x2dc1d6;})[_0x0f2f('0x47')](respondWithResult(_0x5f583c,0xc9))['catch'](handleError(_0x5f583c,null));};exports[_0x0f2f('0x27')]=function(_0x12f40f,_0x5cefdf){if(_0x12f40f[_0x0f2f('0x58')]['id']){delete _0x12f40f[_0x0f2f('0x58')]['id'];}return db[_0x0f2f('0x46')]['find']({'where':{'id':_0x12f40f[_0x0f2f('0x4e')]['id']}})[_0x0f2f('0x47')](handleEntityNotFound(_0x5cefdf,null))[_0x0f2f('0x47')](saveUpdates(_0x12f40f[_0x0f2f('0x58')],null))[_0x0f2f('0x47')](respondWithResult(_0x5cefdf,null))['catch'](handleError(_0x5cefdf,null));};exports[_0x0f2f('0x28')]=function(_0x39ef5a,_0x8ea667){return db[_0x0f2f('0x46')][_0x0f2f('0x4f')]({'where':{'id':_0x39ef5a['params']['id']}})[_0x0f2f('0x47')](handleEntityNotFound(_0x8ea667,null))['then'](removeEntity(_0x8ea667,null))[_0x0f2f('0x4c')](handleError(_0x8ea667,null));};exports[_0x0f2f('0x59')]=function(_0x97ddc4,_0x461b60){return db[_0x0f2f('0x46')][_0x0f2f('0x59')]()[_0x0f2f('0x47')](respondWithResult(_0x461b60,null))[_0x0f2f('0x4c')](handleError(_0x461b60,null));};exports[_0x0f2f('0x5a')]=function(_0x3b4e16,_0x5913b8,_0x2d6941){var _0x18354e={'raw':!![],'where':{}},_0x52e50f={},_0x576128;return db[_0x0f2f('0x46')]['findOne']({'where':{'id':_0x3b4e16[_0x0f2f('0x4e')]['id']}})[_0x0f2f('0x47')](handleEntityNotFound(_0x5913b8,null))['then'](function(_0x435722){if(_0x435722){_0x576128=_0x435722[_0x0f2f('0x29')]({'plain':!![]});_0x52e50f[_0x0f2f('0x34')]=_['keys'](db[_0x0f2f('0x5b')][_0x0f2f('0x30')]);_0x52e50f[_0x0f2f('0x35')]=_[_0x0f2f('0x36')](_0x3b4e16[_0x0f2f('0x35')]);_0x52e50f['filters']=_[_0x0f2f('0x38')](_0x52e50f[_0x0f2f('0x34')],_0x52e50f[_0x0f2f('0x35')]);_0x18354e['attributes']=_[_0x0f2f('0x38')](_0x52e50f[_0x0f2f('0x34')],qs['fields'](_0x3b4e16['query'][_0x0f2f('0x3a')]));_0x18354e[_0x0f2f('0x39')]=_0x18354e[_0x0f2f('0x39')][_0x0f2f('0x3b')]?_0x18354e[_0x0f2f('0x39')]:_0x52e50f[_0x0f2f('0x34')];if(!_0x3b4e16[_0x0f2f('0x35')]['hasOwnProperty'](_0x0f2f('0x3d'))){_0x18354e['limit']=qs['limit'](_0x3b4e16[_0x0f2f('0x35')][_0x0f2f('0x21')]);_0x18354e[_0x0f2f('0x1f')]=qs['offset'](_0x3b4e16[_0x0f2f('0x35')][_0x0f2f('0x1f')]);}_0x18354e[_0x0f2f('0x3e')]=qs[_0x0f2f('0x3f')](_0x3b4e16[_0x0f2f('0x35')][_0x0f2f('0x3f')]);_0x18354e[_0x0f2f('0x40')]=qs[_0x0f2f('0x37')](_['pick'](_0x3b4e16[_0x0f2f('0x35')],_0x52e50f[_0x0f2f('0x37')]));_0x18354e[_0x0f2f('0x40')][_0x0f2f('0x5c')]=_0x435722['id'];if(_0x3b4e16[_0x0f2f('0x35')][_0x0f2f('0x42')]){_0x18354e[_0x0f2f('0x40')]=_[_0x0f2f('0x43')](_0x18354e[_0x0f2f('0x40')],{'$or':_['map'](_0x18354e['attributes'],function(_0x2050fe){var _0x25b1ce={};_0x25b1ce[_0x2050fe]={'$like':'%'+_0x3b4e16[_0x0f2f('0x35')][_0x0f2f('0x42')]+'%'};return _0x25b1ce;})});}_0x18354e=_[_0x0f2f('0x43')]({},_0x18354e,_0x3b4e16[_0x0f2f('0x45')]);return db[_0x0f2f('0x5b')][_0x0f2f('0x4a')](_0x18354e);}})[_0x0f2f('0x47')](function(_0x20e170){if(_0x20e170){return db[_0x0f2f('0x5d')]['findAndCountAll']({'where':{'id':_[_0x0f2f('0x5e')](_0x20e170,_0x0f2f('0x5f')),'role':_0x0f2f('0x60')},'attributes':['id',_0x0f2f('0x2e'),'openchannelPause',_0x0f2f('0x61'),_0x0f2f('0x62')]});}})[_0x0f2f('0x47')](function(_0x354f40){if(_0x354f40){return{'count':_0x354f40[_0x0f2f('0x22')],'rows':_[_0x0f2f('0x5e')](_0x354f40[_0x0f2f('0x4b')],function(_0x323401){return{'membername':_0x323401[_0x0f2f('0x2e')],'UserId':_0x323401['id'],'queue_name':_0x576128[_0x0f2f('0x2e')],'OpenchannelQueueId':_0x576128['id'],'interface':util[_0x0f2f('0x63')](_0x0f2f('0x64'),_0x0f2f('0x65'),_0x323401[_0x0f2f('0x2e')]),'penalty':0x0,'paused':_0x323401[_0x0f2f('0x66')],'createdAt':_0x323401['createdAt'],'updatedAt':_0x323401['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x0f2f('0x47')](respondWithFilteredResult(_0x5913b8,_0x18354e))[_0x0f2f('0x4c')](handleError(_0x5913b8,null));};exports[_0x0f2f('0x67')]=function(_0x27452f,_0x122a62,_0x195604){var _0x5bc412={};var _0xe11acb={};var _0x5e4506;var _0x3ee50;return db[_0x0f2f('0x46')][_0x0f2f('0x68')]({'where':{'id':_0x27452f['params']['id']}})['then'](handleEntityNotFound(_0x122a62,null))['then'](function(_0x4aac6c){if(_0x4aac6c){_0x5e4506=_0x4aac6c;_0xe11acb[_0x0f2f('0x34')]=_[_0x0f2f('0x36')](db[_0x0f2f('0x69')]['rawAttributes']);_0xe11acb['query']=_[_0x0f2f('0x36')](_0x27452f[_0x0f2f('0x35')]);_0xe11acb[_0x0f2f('0x37')]=_[_0x0f2f('0x38')](_0xe11acb[_0x0f2f('0x34')],_0xe11acb['query']);_0x5bc412['attributes']=_['intersection'](_0xe11acb[_0x0f2f('0x34')],qs[_0x0f2f('0x3a')](_0x27452f['query'][_0x0f2f('0x3a')]));_0x5bc412['attributes']=_0x5bc412[_0x0f2f('0x39')][_0x0f2f('0x3b')]?_0x5bc412[_0x0f2f('0x39')]:_0xe11acb[_0x0f2f('0x34')];_0x5bc412[_0x0f2f('0x3e')]=qs[_0x0f2f('0x3f')](_0x27452f[_0x0f2f('0x35')][_0x0f2f('0x3f')]);_0x5bc412[_0x0f2f('0x40')]=qs[_0x0f2f('0x37')](_[_0x0f2f('0x41')](_0x27452f['query'],_0xe11acb['filters']));if(_0x27452f[_0x0f2f('0x35')]['filter']){_0x5bc412[_0x0f2f('0x40')]=_[_0x0f2f('0x43')](_0x5bc412[_0x0f2f('0x40')],{'$or':_[_0x0f2f('0x5e')](_0x5bc412[_0x0f2f('0x39')],function(_0x5f09fc){var _0x4a41fe={};_0x4a41fe[_0x5f09fc]={'$like':'%'+_0x27452f[_0x0f2f('0x35')][_0x0f2f('0x42')]+'%'};return _0x4a41fe;})});}_0x5bc412=_[_0x0f2f('0x43')]({},_0x5bc412,_0x27452f['options']);return _0x5e4506[_0x0f2f('0x67')](_0x5bc412);}})[_0x0f2f('0x47')](function(_0x5251ee){if(_0x5251ee){_0x3ee50=_0x5251ee[_0x0f2f('0x3b')];if(!_0x27452f[_0x0f2f('0x35')][_0x0f2f('0x3c')](_0x0f2f('0x3d'))){_0x5bc412[_0x0f2f('0x21')]=qs[_0x0f2f('0x21')](_0x27452f[_0x0f2f('0x35')][_0x0f2f('0x21')]);_0x5bc412[_0x0f2f('0x1f')]=qs[_0x0f2f('0x1f')](_0x27452f[_0x0f2f('0x35')][_0x0f2f('0x1f')]);}return _0x5e4506['getTeams'](_0x5bc412);}})[_0x0f2f('0x47')](function(_0x34595e){if(_0x34595e){return _0x34595e?{'count':_0x3ee50,'rows':_0x34595e}:null;}})[_0x0f2f('0x47')](respondWithResult(_0x122a62,null))['catch'](handleError(_0x122a62,null));};exports[_0x0f2f('0x6a')]=function(_0x2811c0,_0x41d448,_0x1cd7db){var _0x2910c6=_0x2811c0[_0x0f2f('0x58')][_0x0f2f('0x6b')];return db[_0x0f2f('0x69')][_0x0f2f('0x4a')]({'where':{'id':_0x2910c6},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f2f('0x6c'),'attributes':['id',_0x0f2f('0x2e'),_0x0f2f('0x6d'),_0x0f2f('0x6e'),_0x0f2f('0x6f')],'raw':!![]}]})[_0x0f2f('0x47')](function(_0x4bf4ca){if(_0x4bf4ca){var _0x5060e7=_[_0x0f2f('0x70')](_0x4bf4ca,function(_0x103245){var _0x153a2f=_0x103245[_0x0f2f('0x29')]({'plain':!![]});return _0x153a2f[_0x0f2f('0x6c')];});return db[_0x0f2f('0x46')][_0x0f2f('0x4f')]({'where':{'id':_0x2811c0['params']['id']}})[_0x0f2f('0x47')](function(_0x39dac0){return db[_0x0f2f('0x71')]['transaction'](function(_0x5299b5){return _0x39dac0[_0x0f2f('0x6a')](_0x2910c6,{'transaction':_0x5299b5})[_0x0f2f('0x47')](function(){return BPromise['each'](_0x5060e7,function(_0x2af7cd){return db[_0x0f2f('0x5b')][_0x0f2f('0x72')]({'where':{'UserId':_0x2af7cd['id'],'OpenchannelQueueId':_0x2811c0['params']['id']},'transaction':_0x5299b5});});})['then'](function(){_0x5060e7[_0x0f2f('0x73')](function(_0x14f590){socket[_0x0f2f('0x74')](_0x0f2f('0x75'),{'UserId':_0x14f590['id'],'OpenchannelQueueId':_0x39dac0['id']});});});});});}})[_0x0f2f('0x47')](respondWithStatusCode(_0x41d448,null))[_0x0f2f('0x4c')](handleError(_0x41d448,null));};exports[_0x0f2f('0x76')]=function(_0x5ed8d1,_0x434ed0,_0x2c937a){return db[_0x0f2f('0x69')]['findAll']({'where':{'id':_0x5ed8d1[_0x0f2f('0x35')][_0x0f2f('0x6b')]},'attributes':['id'],'include':[{'model':db[_0x0f2f('0x5d')],'as':_0x0f2f('0x6c'),'attributes':['id'],'raw':!![]}]})[_0x0f2f('0x47')](handleEntityNotFound(_0x434ed0,null))[_0x0f2f('0x47')](function(_0x436ffd){var _0x27a45d=_[_0x0f2f('0x5e')](_0x436ffd,'id');var _0x2bbfb0=[];var _0x25b2d2=[];var _0x5a12e6=squel['select']();_0x5a12e6['field'](_0x0f2f('0x77'))[_0x0f2f('0x78')](_0x0f2f('0x79'),'tq')[_0x0f2f('0x7a')](_0x0f2f('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x0f2f('0x7c'),_0x5ed8d1[_0x0f2f('0x4e')]['id']);for(var _0x41410a=0x0;_0x41410a<_0x436ffd[_0x0f2f('0x3b')];_0x41410a+=0x1){let _0x4e3606=_0x436ffd[_0x41410a];for(var _0x2a720b=0x0;_0x2a720b<_0x4e3606[_0x0f2f('0x6c')][_0x0f2f('0x3b')];_0x2a720b+=0x1){let _0x1ccd57=_0x4e3606[_0x0f2f('0x6c')][_0x2a720b];var _0x48f285=_0x5a12e6[_0x0f2f('0x7d')]();_0x48f285['where'](_0x0f2f('0x7e'),_0x1ccd57['id']);_0x25b2d2[_0x0f2f('0x7f')](db[_0x0f2f('0x71')][_0x0f2f('0x35')](_0x48f285[_0x0f2f('0x80')](),{'type':db['sequelize']['QueryTypes'][_0x0f2f('0x81')]})[_0x0f2f('0x47')](function(_0x54f156){if(_0x54f156[_0x0f2f('0x3b')]===0x1){return _0x1ccd57['id'];}else{var _0x55e7c4=_[_0x0f2f('0x82')](_[_0x0f2f('0x5e')](_0x54f156,_0x0f2f('0x83')),function(_0x4ff7e6){return _['includes'](_0x27a45d,_0x4ff7e6);});if(_0x55e7c4){return _0x1ccd57['id'];}}}));}}return BPromise[_0x0f2f('0x84')](_0x25b2d2)[_0x0f2f('0x47')](function(_0x375841){_0x2bbfb0=_(_0x2bbfb0)[_0x0f2f('0x85')](_0x375841)['compact']()[_0x0f2f('0x86')]();return db[_0x0f2f('0x46')][_0x0f2f('0x4f')]({'where':{'id':_0x5ed8d1[_0x0f2f('0x4e')]['id']}})['then'](function(_0x4f3f25){return db[_0x0f2f('0x71')][_0x0f2f('0x87')](function(_0xfa8524){return _0x4f3f25[_0x0f2f('0x76')](_0x5ed8d1[_0x0f2f('0x35')]['ids'],{'transaction':_0xfa8524})['then'](function(){if(!_[_0x0f2f('0x88')](_0x2bbfb0)){return _0x4f3f25[_0x0f2f('0x89')](_0x2bbfb0,{'transaction':_0xfa8524});}})[_0x0f2f('0x47')](function(){_0x2bbfb0[_0x0f2f('0x73')](function(_0x17bac3){socket[_0x0f2f('0x74')](_0x0f2f('0x8a'),{'UserId':_0x17bac3,'OpenchannelQueueId':_0x4f3f25['id']});});});});});});})[_0x0f2f('0x47')](respondWithStatusCode(_0x434ed0,null))[_0x0f2f('0x4c')](handleError(_0x434ed0,null));};exports[_0x0f2f('0x8b')]=function(_0xd358bb,_0x24e4ff,_0x151c1c){return db['OpenchannelQueue'][_0x0f2f('0x4f')]({'where':{'id':_0xd358bb[_0x0f2f('0x4e')]['id']}})[_0x0f2f('0x47')](handleEntityNotFound(_0x24e4ff,null))[_0x0f2f('0x47')](function(_0x3dc87c){if(_0x3dc87c){return _0x3dc87c['addAgents'](_0xd358bb[_0x0f2f('0x58')][_0x0f2f('0x6b')],_[_0x0f2f('0x8c')](_0xd358bb[_0x0f2f('0x58')],[_0x0f2f('0x6b'),'id'])||{})[_0x0f2f('0x8d')](function(_0x3b679c){for(var _0x42c78c=0x0;_0x42c78c<_0xd358bb['body']['ids'][_0x0f2f('0x3b')];_0x42c78c+=0x1){socket[_0x0f2f('0x74')](_0x0f2f('0x75'),{'UserId':Number(_0xd358bb[_0x0f2f('0x58')]['ids'][_0x42c78c]),'OpenchannelQueueId':Number(_0xd358bb[_0x0f2f('0x4e')]['id'])});}return _0x3b679c;});}})[_0x0f2f('0x47')](respondWithResult(_0x24e4ff,null))[_0x0f2f('0x4c')](handleError(_0x24e4ff,null));};exports[_0x0f2f('0x89')]=function(_0x2d116e,_0x76e562,_0x15fa38){return db[_0x0f2f('0x46')][_0x0f2f('0x4f')]({'where':{'id':_0x2d116e[_0x0f2f('0x4e')]['id']}})[_0x0f2f('0x47')](handleEntityNotFound(_0x76e562,null))[_0x0f2f('0x47')](function(_0x140418){if(_0x140418){return _0x140418[_0x0f2f('0x89')](_0x2d116e[_0x0f2f('0x35')][_0x0f2f('0x6b')])[_0x0f2f('0x47')](function(){if(_['isArray'](_0x2d116e[_0x0f2f('0x35')][_0x0f2f('0x6b')])){for(var _0x63fae5=0x0;_0x63fae5<_0x2d116e[_0x0f2f('0x35')][_0x0f2f('0x6b')][_0x0f2f('0x3b')];_0x63fae5+=0x1){socket[_0x0f2f('0x74')]('userOpenchannelQueue:remove',{'UserId':Number(_0x2d116e[_0x0f2f('0x35')][_0x0f2f('0x6b')][_0x63fae5]),'OpenchannelQueueId':Number(_0x2d116e[_0x0f2f('0x4e')]['id'])});}}else{socket['emit'](_0x0f2f('0x8a'),{'UserId':Number(_0x2d116e[_0x0f2f('0x35')][_0x0f2f('0x6b')]),'OpenchannelQueueId':Number(_0x2d116e[_0x0f2f('0x4e')]['id'])});}});}})[_0x0f2f('0x47')](respondWithStatusCode(_0x76e562,null))['catch'](handleError(_0x76e562,null));};exports[_0x0f2f('0x8e')]=function(_0x4224b4,_0x505da6,_0x3645fa){var _0x1eecf7={};var _0x4a9618={};var _0x3e1cbc;var _0x26e893;return db[_0x0f2f('0x46')][_0x0f2f('0x68')]({'where':{'id':_0x4224b4['params']['id']}})[_0x0f2f('0x47')](handleEntityNotFound(_0x505da6,null))[_0x0f2f('0x47')](function(_0x1680d5){if(_0x1680d5){_0x3e1cbc=_0x1680d5;_0x4a9618['model']=_[_0x0f2f('0x36')](db[_0x0f2f('0x5d')][_0x0f2f('0x30')]);_0x4a9618[_0x0f2f('0x35')]=_[_0x0f2f('0x36')](_0x4224b4[_0x0f2f('0x35')]);_0x4a9618[_0x0f2f('0x37')]=_[_0x0f2f('0x38')](_0x4a9618['model'],_0x4a9618[_0x0f2f('0x35')]);_0x1eecf7[_0x0f2f('0x39')]=_[_0x0f2f('0x38')](_0x4a9618[_0x0f2f('0x34')],qs[_0x0f2f('0x3a')](_0x4224b4[_0x0f2f('0x35')]['fields']));_0x1eecf7[_0x0f2f('0x39')]=_0x1eecf7['attributes'][_0x0f2f('0x3b')]?_0x1eecf7['attributes']:_0x4a9618[_0x0f2f('0x34')];_0x1eecf7[_0x0f2f('0x3e')]=qs[_0x0f2f('0x3f')](_0x4224b4['query']['sort']);_0x1eecf7[_0x0f2f('0x40')]=qs['filters'](_[_0x0f2f('0x41')](_0x4224b4['query'],_0x4a9618[_0x0f2f('0x37')]));if(_0x4224b4[_0x0f2f('0x35')][_0x0f2f('0x42')]){_0x1eecf7['where']=_[_0x0f2f('0x43')](_0x1eecf7[_0x0f2f('0x40')],{'$or':_[_0x0f2f('0x5e')](_0x1eecf7[_0x0f2f('0x39')],function(_0x1c7542){var _0x20b715={};_0x20b715[_0x1c7542]={'$like':'%'+_0x4224b4['query'][_0x0f2f('0x42')]+'%'};return _0x20b715;})});}_0x1eecf7=_[_0x0f2f('0x43')]({},_0x1eecf7,_0x4224b4[_0x0f2f('0x45')]);return _0x3e1cbc[_0x0f2f('0x8e')](_0x1eecf7);}})[_0x0f2f('0x47')](function(_0x2cb23d){if(_0x2cb23d){_0x26e893=_0x2cb23d[_0x0f2f('0x3b')];if(!_0x4224b4[_0x0f2f('0x35')][_0x0f2f('0x3c')](_0x0f2f('0x3d'))){_0x1eecf7[_0x0f2f('0x21')]=qs[_0x0f2f('0x21')](_0x4224b4[_0x0f2f('0x35')][_0x0f2f('0x21')]);_0x1eecf7[_0x0f2f('0x1f')]=qs[_0x0f2f('0x1f')](_0x4224b4[_0x0f2f('0x35')]['offset']);}return _0x3e1cbc['getAgents'](_0x1eecf7);}})[_0x0f2f('0x47')](function(_0x508841){if(_0x508841){return _0x508841?{'count':_0x26e893,'rows':_0x508841}:null;}})[_0x0f2f('0x47')](respondWithResult(_0x505da6,null))[_0x0f2f('0x4c')](handleError(_0x505da6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 05d1e8d..e3369c7 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 _0xac12=['events','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xac12,0xc0));var _0x2ac1=function(_0x2908d0,_0x1f017b){_0x2908d0=_0x2908d0-0x0;var _0x36986c=_0xac12[_0x2908d0];return _0x36986c;};'use strict';var EventEmitter=require(_0x2ac1('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x2ac1('0x1')](0x0);var events={'afterCreate':_0x2ac1('0x2'),'afterUpdate':_0x2ac1('0x3'),'afterDestroy':_0x2ac1('0x4')};function emitEvent(_0x3bc106){return function(_0x160111,_0x1fd673,_0x17d42d){OpenchannelQueueEvents['emit'](_0x3bc106+':'+_0x160111['id'],_0x160111);OpenchannelQueueEvents['emit'](_0x3bc106,_0x160111);_0x17d42d(null);};}for(var e in events){if(events[_0x2ac1('0x5')](e)){var event=events[e];OpenchannelQueue[_0x2ac1('0x6')](e,emitEvent(event));}}module[_0x2ac1('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x92be=['update','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x1e2f48,_0x68228e){var _0x11b9a7=function(_0x5acc5e){while(--_0x5acc5e){_0x1e2f48['push'](_0x1e2f48['shift']());}};_0x11b9a7(++_0x68228e);}(_0x92be,0x190));var _0xe92b=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x92be[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0xe92b('0x0'));var OpenchannelQueue=require(_0xe92b('0x1'))['db'][_0xe92b('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe92b('0x3')](0x0);var events={'afterCreate':_0xe92b('0x4'),'afterUpdate':_0xe92b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21b7da){return function(_0xe09561,_0x5d3e09,_0x15f47b){OpenchannelQueueEvents[_0xe92b('0x6')](_0x21b7da+':'+_0xe09561['id'],_0xe09561);OpenchannelQueueEvents[_0xe92b('0x6')](_0x21b7da,_0xe09561);_0x15f47b(null);};}for(var e in events){if(events[_0xe92b('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xe92b('0x8')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index b7a98ab..57ddb5e 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 _0xd110=['openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue'];(function(_0x56418e,_0x362812){var _0x5b160c=function(_0x5b44cb){while(--_0x5b44cb){_0x56418e['push'](_0x56418e['shift']());}};_0x5b160c(++_0x362812);}(_0xd110,0xb5));var _0x0d11=function(_0x4de86b,_0x30d9dd){_0x4de86b=_0x4de86b-0x0;var _0x5c1d75=_0xd110[_0x4de86b];return _0x5c1d75;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var logger=require(_0x0d11('0x2'))(_0x0d11('0x3'));var moment=require(_0x0d11('0x4'));var BPromise=require(_0x0d11('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0d11('0x6'));var config=require(_0x0d11('0x7'));var attributes=require(_0x0d11('0x8'));module['exports']=function(_0x7c11ab,_0x2b42f1){return _0x7c11ab[_0x0d11('0x9')](_0x0d11('0xa'),attributes,{'tableName':_0x0d11('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfa0=['openchannel_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue'];(function(_0xd6e6a6,_0x10096b){var _0x4bb481=function(_0x32e094){while(--_0x32e094){_0xd6e6a6['push'](_0xd6e6a6['shift']());}};_0x4bb481(++_0x10096b);}(_0xbfa0,0xcd));var _0x0bfa=function(_0x31d60a,_0x468fbd){_0x31d60a=_0x31d60a-0x0;var _0xd243ab=_0xbfa0[_0x31d60a];return _0xd243ab;};'use strict';var _=require('lodash');var util=require(_0x0bfa('0x0'));var logger=require(_0x0bfa('0x1'))(_0x0bfa('0x2'));var moment=require(_0x0bfa('0x3'));var BPromise=require('bluebird');var rp=require(_0x0bfa('0x4'));var fs=require('fs');var path=require(_0x0bfa('0x5'));var rimraf=require(_0x0bfa('0x6'));var config=require(_0x0bfa('0x7'));var attributes=require(_0x0bfa('0x8'));module['exports']=function(_0x44c6a2,_0x2c588b){return _0x44c6a2[_0x0bfa('0x9')](_0x0bfa('0xa'),attributes,{'tableName':_0x0bfa('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 04531e9..3d4cc68 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 _0x2ce5=['result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','debug','stringify','find','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./openchannelQueue.socket','register','request','then','info','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','OpenchannelQueue,\x20%s,\x20%s','message'];(function(_0x327c57,_0xa7d8f2){var _0x441cd8=function(_0x55ac04){while(--_0x55ac04){_0x327c57['push'](_0x327c57['shift']());}};_0x441cd8(++_0xa7d8f2);}(_0x2ce5,0x101));var _0x52ce=function(_0x3e9bc6,_0x33c000){_0x3e9bc6=_0x3e9bc6-0x0;var _0x49234f=_0x2ce5[_0x3e9bc6];return _0x49234f;};'use strict';var _=require('lodash');var util=require(_0x52ce('0x0'));var moment=require('moment');var BPromise=require(_0x52ce('0x1'));var rs=require(_0x52ce('0x2'));var fs=require('fs');var Redis=require(_0x52ce('0x3'));var db=require(_0x52ce('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x52ce('0x5'))(_0x52ce('0x6'));var config=require(_0x52ce('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x52ce('0x8')][_0x52ce('0x9')]({'port':0x232a});config[_0x52ce('0xa')]=_[_0x52ce('0xb')](config[_0x52ce('0xa')],{'host':_0x52ce('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x52ce('0xa')]));require(_0x52ce('0xd'))[_0x52ce('0xe')](socket);function respondWithRpcPromise(_0xa0d0af,_0xe90e66,_0xf31ab5){return new BPromise(function(_0x48ae8d,_0x12d1df){return client[_0x52ce('0xf')](_0xa0d0af,_0xf31ab5)[_0x52ce('0x10')](function(_0x191a1f){logger[_0x52ce('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0xe90e66,_0x52ce('0x12'));logger['debug'](_0x52ce('0x13'),_0xe90e66,_0x52ce('0x12'),JSON['stringify'](_0x191a1f));if(_0x191a1f[_0x52ce('0x14')]){if(_0x191a1f[_0x52ce('0x14')]['code']===0x1f4){logger['error'](_0x52ce('0x15'),_0xe90e66,_0x191a1f[_0x52ce('0x14')][_0x52ce('0x16')]);return _0x12d1df(_0x191a1f[_0x52ce('0x14')][_0x52ce('0x16')]);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0xe90e66,_0x191a1f['error'][_0x52ce('0x16')]);return _0x48ae8d(_0x191a1f['error'][_0x52ce('0x16')]);}else{logger[_0x52ce('0x11')](_0x52ce('0x15'),_0xe90e66,_0x52ce('0x12'));_0x48ae8d(_0x191a1f[_0x52ce('0x17')]['message']);}})[_0x52ce('0x18')](function(_0x331cf0){logger[_0x52ce('0x14')](_0x52ce('0x15'),_0xe90e66,_0x331cf0);_0x12d1df(_0x331cf0);});});}exports['GetOpenchannelQueue']=function(_0x543265){var _0xb36e49=this;return new Promise(function(_0x183561,_0x6697b6){return db[_0x52ce('0x19')][_0x52ce('0x1a')]({'raw':_0x543265[_0x52ce('0x1b')]?_0x543265[_0x52ce('0x1b')][_0x52ce('0x1c')]===undefined?!![]:![]:!![],'where':_0x543265[_0x52ce('0x1b')]?_0x543265[_0x52ce('0x1b')][_0x52ce('0x1d')]||null:null,'attributes':_0x543265['options']?_0x543265[_0x52ce('0x1b')][_0x52ce('0x1e')]||null:null,'limit':_0x543265[_0x52ce('0x1b')]?_0x543265[_0x52ce('0x1b')][_0x52ce('0x1f')]||null:null,'include':_0x543265[_0x52ce('0x1b')]?_0x543265[_0x52ce('0x1b')][_0x52ce('0x20')]?_[_0x52ce('0x21')](_0x543265[_0x52ce('0x1b')][_0x52ce('0x20')],function(_0x1ce32f){return{'model':db[_0x1ce32f[_0x52ce('0x22')]],'as':_0x1ce32f['as'],'attributes':_0x1ce32f[_0x52ce('0x1e')],'include':_0x1ce32f[_0x52ce('0x20')]?_[_0x52ce('0x21')](_0x1ce32f[_0x52ce('0x20')],function(_0x1d0fab){return{'model':db[_0x1d0fab[_0x52ce('0x22')]],'as':_0x1d0fab['as'],'attributes':_0x1d0fab[_0x52ce('0x1e')],'include':_0x1d0fab[_0x52ce('0x20')]?_['map'](_0x1d0fab[_0x52ce('0x20')],function(_0x1c81a9){return{'model':db[_0x1c81a9[_0x52ce('0x22')]],'as':_0x1c81a9['as'],'attributes':_0x1c81a9[_0x52ce('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x52ce('0x10')](function(_0x45f206){logger[_0x52ce('0x11')](_0x52ce('0x23'),_0x543265);logger[_0x52ce('0x24')](_0x52ce('0x23'),_0x543265,JSON[_0x52ce('0x25')](_0x45f206));_0x183561(_0x45f206);})[_0x52ce('0x18')](function(_0x38472d){logger[_0x52ce('0x14')](_0x52ce('0x23'),_0x38472d[_0x52ce('0x16')],_0x543265);_0x6697b6(_0xb36e49['error'](0x1f4,_0x38472d[_0x52ce('0x16')]));});});};exports['ShowOpenchannelQueue']=function(_0x35fae3){var _0x4988a7=this;return new Promise(function(_0x15bd84,_0x20ed16){return db['OpenchannelQueue'][_0x52ce('0x26')]({'raw':_0x35fae3[_0x52ce('0x1b')]?_0x35fae3[_0x52ce('0x1b')][_0x52ce('0x1c')]===undefined?!![]:![]:!![],'where':_0x35fae3[_0x52ce('0x1b')]?_0x35fae3[_0x52ce('0x1b')]['where']||null:null,'attributes':_0x35fae3[_0x52ce('0x1b')]?_0x35fae3[_0x52ce('0x1b')]['attributes']||null:null,'include':_0x35fae3['options']?_0x35fae3[_0x52ce('0x1b')][_0x52ce('0x20')]?_[_0x52ce('0x21')](_0x35fae3[_0x52ce('0x1b')][_0x52ce('0x20')],function(_0x52436e){return{'model':db[_0x52436e[_0x52ce('0x22')]],'as':_0x52436e['as'],'attributes':_0x52436e[_0x52ce('0x1e')],'include':_0x52436e['include']?_[_0x52ce('0x21')](_0x52436e['include'],function(_0x59b704){return{'model':db[_0x59b704['model']],'as':_0x59b704['as'],'attributes':_0x59b704[_0x52ce('0x1e')],'include':_0x59b704[_0x52ce('0x20')]?_[_0x52ce('0x21')](_0x59b704['include'],function(_0x8e97ac){return{'model':db[_0x8e97ac[_0x52ce('0x22')]],'as':_0x8e97ac['as'],'attributes':_0x8e97ac[_0x52ce('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x52ce('0x10')](function(_0x6390bd){logger[_0x52ce('0x11')](_0x52ce('0x27'),_0x35fae3);logger[_0x52ce('0x24')]('ShowOpenchannelQueue',_0x35fae3,JSON['stringify'](_0x6390bd));_0x15bd84(_0x6390bd);})[_0x52ce('0x18')](function(_0x4e630d){logger['error']('ShowOpenchannelQueue',_0x4e630d[_0x52ce('0x16')],_0x35fae3);_0x20ed16(_0x4988a7[_0x52ce('0x14')](0x1f4,_0x4e630d['message']));});});}; \ No newline at end of file +var _0x8648=['find','debug','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','then','GetOpenchannelQueue','ShowOpenchannelQueue','OpenchannelQueue'];(function(_0x2cce72,_0x432665){var _0xe78e46=function(_0x5d2992){while(--_0x5d2992){_0x2cce72['push'](_0x2cce72['shift']());}};_0xe78e46(++_0x432665);}(_0x8648,0x1ca));var _0x8864=function(_0x42518c,_0x211998){_0x42518c=_0x42518c-0x0;var _0x499e84=_0x8648[_0x42518c];return _0x499e84;};'use strict';var _=require('lodash');var util=require(_0x8864('0x0'));var moment=require('moment');var BPromise=require(_0x8864('0x1'));var rs=require(_0x8864('0x2'));var fs=require('fs');var Redis=require(_0x8864('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8864('0x4'));var logger=require(_0x8864('0x5'))(_0x8864('0x6'));var config=require(_0x8864('0x7'));var jayson=require(_0x8864('0x8'));var client=jayson[_0x8864('0x9')][_0x8864('0xa')]({'port':0x232a});config[_0x8864('0xb')]=_['defaults'](config[_0x8864('0xb')],{'host':_0x8864('0xc'),'port':0x18eb});var socket=require(_0x8864('0xd'))(new Redis(config['redis']));require('./openchannelQueue.socket')[_0x8864('0xe')](socket);function respondWithRpcPromise(_0x3c0f6c,_0x200830,_0x1c4cf0){return new BPromise(function(_0x1e7d1f,_0x420a9b){return client['request'](_0x3c0f6c,_0x1c4cf0)['then'](function(_0x37ac20){logger['info'](_0x8864('0xf'),_0x200830,_0x8864('0x10'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x200830,'request\x20sent',JSON[_0x8864('0x11')](_0x37ac20));if(_0x37ac20['error']){if(_0x37ac20[_0x8864('0x12')][_0x8864('0x13')]===0x1f4){logger['error'](_0x8864('0xf'),_0x200830,_0x37ac20[_0x8864('0x12')][_0x8864('0x14')]);return _0x420a9b(_0x37ac20[_0x8864('0x12')]['message']);}logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x200830,_0x37ac20[_0x8864('0x12')][_0x8864('0x14')]);return _0x1e7d1f(_0x37ac20[_0x8864('0x12')][_0x8864('0x14')]);}else{logger[_0x8864('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x200830,'request\x20sent');_0x1e7d1f(_0x37ac20['result'][_0x8864('0x14')]);}})[_0x8864('0x16')](function(_0x48db0c){logger[_0x8864('0x12')](_0x8864('0xf'),_0x200830,_0x48db0c);_0x420a9b(_0x48db0c);});});}exports['GetOpenchannelQueue']=function(_0x16c264){var _0x3dd264=this;return new Promise(function(_0xe7b1cc,_0x1a53a8){return db['OpenchannelQueue'][_0x8864('0x17')]({'raw':_0x16c264[_0x8864('0x18')]?_0x16c264[_0x8864('0x18')][_0x8864('0x19')]===undefined?!![]:![]:!![],'where':_0x16c264[_0x8864('0x18')]?_0x16c264['options'][_0x8864('0x1a')]||null:null,'attributes':_0x16c264[_0x8864('0x18')]?_0x16c264[_0x8864('0x18')][_0x8864('0x1b')]||null:null,'limit':_0x16c264[_0x8864('0x18')]?_0x16c264[_0x8864('0x18')][_0x8864('0x1c')]||null:null,'include':_0x16c264[_0x8864('0x18')]?_0x16c264[_0x8864('0x18')][_0x8864('0x1d')]?_[_0x8864('0x1e')](_0x16c264[_0x8864('0x18')][_0x8864('0x1d')],function(_0x224134){return{'model':db[_0x224134[_0x8864('0x1f')]],'as':_0x224134['as'],'attributes':_0x224134[_0x8864('0x1b')],'include':_0x224134[_0x8864('0x1d')]?_[_0x8864('0x1e')](_0x224134[_0x8864('0x1d')],function(_0x1b6ed3){return{'model':db[_0x1b6ed3[_0x8864('0x1f')]],'as':_0x1b6ed3['as'],'attributes':_0x1b6ed3[_0x8864('0x1b')],'include':_0x1b6ed3[_0x8864('0x1d')]?_[_0x8864('0x1e')](_0x1b6ed3[_0x8864('0x1d')],function(_0x3fe1af){return{'model':db[_0x3fe1af[_0x8864('0x1f')]],'as':_0x3fe1af['as'],'attributes':_0x3fe1af[_0x8864('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8864('0x20')](function(_0xbdd412){logger[_0x8864('0x15')](_0x8864('0x21'),_0x16c264);logger['debug'](_0x8864('0x21'),_0x16c264,JSON[_0x8864('0x11')](_0xbdd412));_0xe7b1cc(_0xbdd412);})[_0x8864('0x16')](function(_0x49e71a){logger['error'](_0x8864('0x21'),_0x49e71a[_0x8864('0x14')],_0x16c264);_0x1a53a8(_0x3dd264[_0x8864('0x12')](0x1f4,_0x49e71a[_0x8864('0x14')]));});});};exports[_0x8864('0x22')]=function(_0x121fbf){var _0x1ac3dd=this;return new Promise(function(_0x2ab694,_0x32551c){return db[_0x8864('0x23')][_0x8864('0x24')]({'raw':_0x121fbf[_0x8864('0x18')]?_0x121fbf[_0x8864('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x121fbf[_0x8864('0x18')]?_0x121fbf[_0x8864('0x18')][_0x8864('0x1a')]||null:null,'attributes':_0x121fbf[_0x8864('0x18')]?_0x121fbf[_0x8864('0x18')][_0x8864('0x1b')]||null:null,'include':_0x121fbf[_0x8864('0x18')]?_0x121fbf[_0x8864('0x18')][_0x8864('0x1d')]?_[_0x8864('0x1e')](_0x121fbf[_0x8864('0x18')]['include'],function(_0x2da041){return{'model':db[_0x2da041[_0x8864('0x1f')]],'as':_0x2da041['as'],'attributes':_0x2da041[_0x8864('0x1b')],'include':_0x2da041['include']?_['map'](_0x2da041[_0x8864('0x1d')],function(_0x284edc){return{'model':db[_0x284edc[_0x8864('0x1f')]],'as':_0x284edc['as'],'attributes':_0x284edc[_0x8864('0x1b')],'include':_0x284edc['include']?_[_0x8864('0x1e')](_0x284edc[_0x8864('0x1d')],function(_0x5e9dfd){return{'model':db[_0x5e9dfd['model']],'as':_0x5e9dfd['as'],'attributes':_0x5e9dfd[_0x8864('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8864('0x20')](function(_0x2a8fd5){logger[_0x8864('0x15')](_0x8864('0x22'),_0x121fbf);logger[_0x8864('0x25')](_0x8864('0x22'),_0x121fbf,JSON[_0x8864('0x11')](_0x2a8fd5));_0x2ab694(_0x2a8fd5);})[_0x8864('0x16')](function(_0x4b9475){logger[_0x8864('0x12')](_0x8864('0x22'),_0x4b9475[_0x8864('0x14')],_0x121fbf);_0x32551c(_0x1ac3dd[_0x8864('0x12')](0x1f4,_0x4b9475[_0x8864('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index b4971a0..6ce30fb 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 _0x8ae9=['save','emit','removeListener','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x4dd295,_0x3cc24b){var _0x209240=function(_0x446730){while(--_0x446730){_0x4dd295['push'](_0x4dd295['shift']());}};_0x209240(++_0x3cc24b);}(_0x8ae9,0x179));var _0x98ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8ae9[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0x98ae('0x0'));var events=[_0x98ae('0x1'),'remove','update'];function createListener(_0x4a1157,_0x2c2290){return function(_0xd86255){_0x2c2290[_0x98ae('0x2')](_0x4a1157,_0xd86255);};}function removeListener(_0x5a6b34,_0x4eea43){return function(){OpenchannelQueueEvents[_0x98ae('0x3')](_0x5a6b34,_0x4eea43);};}exports[_0x98ae('0x4')]=function(_0x237dd0){for(var _0x3a6b37=0x0,_0x58301b=events[_0x98ae('0x5')];_0x3a6b37<_0x58301b;_0x3a6b37++){var _0x303580=events[_0x3a6b37];var _0x4477e=createListener(_0x98ae('0x6')+_0x303580,_0x237dd0);OpenchannelQueueEvents['on'](_0x303580,_0x4477e);}}; \ No newline at end of file +var _0xf07a=['remove','removeListener','length','./openchannelQueue.events'];(function(_0x3c5735,_0x1f4f53){var _0x2cd61d=function(_0x183e55){while(--_0x183e55){_0x3c5735['push'](_0x3c5735['shift']());}};_0x2cd61d(++_0x1f4f53);}(_0xf07a,0xe7));var _0xaf07=function(_0x53dac4,_0x436fac){_0x53dac4=_0x53dac4-0x0;var _0x589366=_0xf07a[_0x53dac4];return _0x589366;};'use strict';var OpenchannelQueueEvents=require(_0xaf07('0x0'));var events=['save',_0xaf07('0x1'),'update'];function createListener(_0x57ca76,_0x443838){return function(_0x172203){_0x443838['emit'](_0x57ca76,_0x172203);};}function removeListener(_0xf993d4,_0x58dd0c){return function(){OpenchannelQueueEvents[_0xaf07('0x2')](_0xf993d4,_0x58dd0c);};}exports['register']=function(_0x1678fa){for(var _0x5f244a=0x0,_0x42c430=events[_0xaf07('0x3')];_0x5f244a<_0x42c430;_0x5f244a++){var _0x5c5556=events[_0x5f244a];var _0x1890d9=createListener('openchannelQueue:'+_0x5c5556,_0x1678fa);OpenchannelQueueEvents['on'](_0x5c5556,_0x1890d9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 913bf41..0223fad 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 _0x204a=['./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0xdbc579,_0x2d477a){var _0x2a5169=function(_0x53a648){while(--_0x53a648){_0xdbc579['push'](_0xdbc579['shift']());}};_0x2a5169(++_0x2d477a);}(_0x204a,0x1ad));var _0xa204=function(_0x54275f,_0x445a39){_0x54275f=_0x54275f-0x0;var _0x4340c8=_0x204a[_0x54275f];return _0x4340c8;};'use strict';var multer=require(_0xa204('0x0'));var util=require('util');var path=require(_0xa204('0x1'));var timeout=require(_0xa204('0x2'));var express=require(_0xa204('0x3'));var router=express[_0xa204('0x4')]();var fs_extra=require(_0xa204('0x5'));var auth=require(_0xa204('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa204('0x7'));var controller=require(_0xa204('0x8'));router[_0xa204('0x9')]('/',auth[_0xa204('0xa')](),controller[_0xa204('0xb')]);router['get'](_0xa204('0xc'),auth[_0xa204('0xa')](),controller[_0xa204('0xd')]);router[_0xa204('0x9')](_0xa204('0xe'),auth[_0xa204('0xa')](),controller[_0xa204('0xf')]);router[_0xa204('0x10')]('/',auth[_0xa204('0xa')](),controller[_0xa204('0x11')]);router[_0xa204('0x12')](_0xa204('0xe'),auth['isAuthenticated'](),controller[_0xa204('0x13')]);router[_0xa204('0x14')]('/:id',auth[_0xa204('0xa')](),controller[_0xa204('0x15')]);module[_0xa204('0x16')]=router; \ No newline at end of file +var _0x0560=['destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','/describe','describe','/:id','isAuthenticated','show','put','update','delete'];(function(_0x851fae,_0x5efd08){var _0x12dcff=function(_0x4c3728){while(--_0x4c3728){_0x851fae['push'](_0x851fae['shift']());}};_0x12dcff(++_0x5efd08);}(_0x0560,0xa3));var _0x0056=function(_0x3dc6da,_0x1dde45){_0x3dc6da=_0x3dc6da-0x0;var _0x43c57c=_0x0560[_0x3dc6da];return _0x43c57c;};'use strict';var multer=require(_0x0056('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0056('0x1'));var express=require(_0x0056('0x2'));var router=express[_0x0056('0x3')]();var fs_extra=require(_0x0056('0x4'));var auth=require(_0x0056('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0056('0x6'));var controller=require(_0x0056('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0056('0x8')](_0x0056('0x9'),auth['isAuthenticated'](),controller[_0x0056('0xa')]);router[_0x0056('0x8')](_0x0056('0xb'),auth[_0x0056('0xc')](),controller[_0x0056('0xd')]);router['post']('/',auth[_0x0056('0xc')](),controller['create']);router[_0x0056('0xe')]('/:id',auth[_0x0056('0xc')](),controller[_0x0056('0xf')]);router[_0x0056('0x10')](_0x0056('0xb'),auth[_0x0056('0xc')](),controller[_0x0056('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index cfdb182..b4ece7b 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 _0xd086=['STRING','DATE','moment','exports'];(function(_0x39531c,_0x4e4dfb){var _0x9dfc07=function(_0x419fb9){while(--_0x419fb9){_0x39531c['push'](_0x39531c['shift']());}};_0x9dfc07(++_0x4e4dfb);}(_0xd086,0x1da));var _0x6d08=function(_0x49d045,_0x3ef04c){_0x49d045=_0x49d045-0x0;var _0x149fc0=_0xd086[_0x49d045];return _0x149fc0;};'use strict';var moment=require(_0x6d08('0x0'));var Sequelize=require('sequelize');module[_0x6d08('0x1')]={'uniqueid':{'type':Sequelize[_0x6d08('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6d08('0x2')]},'joinAt':{'type':Sequelize[_0x6d08('0x3')]},'leaveAt':{'type':Sequelize[_0x6d08('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8124=['DATE','moment','exports','STRING'];(function(_0x4120f5,_0x468360){var _0x42ad35=function(_0x534424){while(--_0x534424){_0x4120f5['push'](_0x4120f5['shift']());}};_0x42ad35(++_0x468360);}(_0x8124,0x89));var _0x4812=function(_0x380168,_0x40546c){_0x380168=_0x380168-0x0;var _0x12e86d=_0x8124[_0x380168];return _0x12e86d;};'use strict';var moment=require(_0x4812('0x0'));var Sequelize=require('sequelize');module[_0x4812('0x1')]={'uniqueid':{'type':Sequelize[_0x4812('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4812('0x2')]},'joinAt':{'type':Sequelize[_0x4812('0x3')]},'leaveAt':{'type':Sequelize[_0x4812('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x4812('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index f69abdf..a67f840 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 _0x45e8=['sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','length','includeAll','find','create','body','describe','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit'];(function(_0x40e735,_0x914218){var _0x5b4a8f=function(_0x3b61cf){while(--_0x3b61cf){_0x40e735['push'](_0x40e735['shift']());}};_0x5b4a8f(++_0x914218);}(_0x45e8,0x152));var _0x845e=function(_0x910b22,_0x57e873){_0x910b22=_0x910b22-0x0;var _0x1f594d=_0x45e8[_0x910b22];return _0x1f594d;};'use strict';var emlformat=require(_0x845e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x845e('0x1'));var moment=require(_0x845e('0x2'));var BPromise=require(_0x845e('0x3'));var Mustache=require(_0x845e('0x4'));var util=require(_0x845e('0x5'));var path=require(_0x845e('0x6'));var sox=require(_0x845e('0x7'));var csv=require(_0x845e('0x8'));var ejs=require(_0x845e('0x9'));var fs=require('fs');var fs_extra=require(_0x845e('0xa'));var _=require(_0x845e('0xb'));var squel=require(_0x845e('0xc'));var crypto=require(_0x845e('0xd'));var jsforce=require(_0x845e('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x845e('0xf'));var Papa=require(_0x845e('0x10'));var Redis=require(_0x845e('0x11'));var authService=require(_0x845e('0x12'));var qs=require(_0x845e('0x13'));var as=require(_0x845e('0x14'));var hardwareService=require(_0x845e('0x15'));var logger=require(_0x845e('0x16'))(_0x845e('0x17'));var utils=require(_0x845e('0x18'));var config=require(_0x845e('0x19'));var licenseUtil=require(_0x845e('0x1a'));var db=require(_0x845e('0x1b'))['db'];function respondWithStatusCode(_0x5105fe,_0x4aa8d5){_0x4aa8d5=_0x4aa8d5||0xcc;return function(_0x153b82){if(_0x153b82){return _0x5105fe['sendStatus'](_0x4aa8d5);}return _0x5105fe['status'](_0x4aa8d5)[_0x845e('0x1c')]();};}function respondWithResult(_0x4e40c7,_0x20b458){_0x20b458=_0x20b458||0xc8;return function(_0x14266e){if(_0x14266e){return _0x4e40c7[_0x845e('0x1d')](_0x20b458)['json'](_0x14266e);}};}function respondWithFilteredResult(_0x291184,_0x316da9){return function(_0x2572fa){if(_0x2572fa){var _0x673675=typeof _0x316da9['offset']===_0x845e('0x1e')&&typeof _0x316da9[_0x845e('0x1f')]===_0x845e('0x1e');var _0x2e034c=_0x2572fa[_0x845e('0x20')];var _0x48f362=_0x673675?0x0:_0x316da9[_0x845e('0x21')];var _0x1edc65=_0x673675?_0x2572fa['count']:_0x316da9[_0x845e('0x21')]+_0x316da9[_0x845e('0x1f')];var _0x2e5850;if(_0x1edc65>=_0x2e034c){_0x1edc65=_0x2e034c;_0x2e5850=0xc8;}else{_0x2e5850=0xce;}_0x291184[_0x845e('0x1d')](_0x2e5850);return _0x291184[_0x845e('0x22')](_0x845e('0x23'),_0x48f362+'-'+_0x1edc65+'/'+_0x2e034c)[_0x845e('0x24')](_0x2572fa);}return null;};}function patchUpdates(_0x4751a6){return function(_0x264a64){try{jsonpatch[_0x845e('0x25')](_0x264a64,_0x4751a6,!![]);}catch(_0x136631){return BPromise[_0x845e('0x26')](_0x136631);}return _0x264a64[_0x845e('0x27')]();};}function saveUpdates(_0x2c4203,_0x521faa){return function(_0x133b2f){if(_0x133b2f){return _0x133b2f[_0x845e('0x28')](_0x2c4203)[_0x845e('0x29')](function(_0x4f98be){return _0x4f98be;});}return null;};}function removeEntity(_0x17f8e5,_0x3ab375){return function(_0x8a5d1b){if(_0x8a5d1b){return _0x8a5d1b[_0x845e('0x2a')]()[_0x845e('0x29')](function(){_0x17f8e5[_0x845e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a21e6,_0x54874d){return function(_0x28d0e8){if(!_0x28d0e8){_0x3a21e6[_0x845e('0x2b')](0x194);}return _0x28d0e8;};}function handleError(_0x1b7935,_0x4e26ab){_0x4e26ab=_0x4e26ab||0x1f4;return function(_0x1280f8){logger[_0x845e('0x2c')](_0x1280f8[_0x845e('0x2d')]);if(_0x1280f8[_0x845e('0x2e')]){delete _0x1280f8[_0x845e('0x2e')];}_0x1b7935[_0x845e('0x1d')](_0x4e26ab)['send'](_0x1280f8);};}exports[_0x845e('0x2f')]=function(_0x49605b,_0x37b543){var _0x8dbae0={},_0x4a8e87={},_0x29185d={'count':0x0,'rows':[]};var _0x4b0a1b=_[_0x845e('0x30')](db[_0x845e('0x31')][_0x845e('0x32')],function(_0x87fa79){return{'name':_0x87fa79[_0x845e('0x33')],'type':_0x87fa79[_0x845e('0x34')]['key']};});_0x4a8e87[_0x845e('0x35')]=_[_0x845e('0x30')](_0x4b0a1b,_0x845e('0x2e'));_0x4a8e87[_0x845e('0x36')]=_[_0x845e('0x37')](_0x49605b[_0x845e('0x36')]);_0x4a8e87[_0x845e('0x38')]=_[_0x845e('0x39')](_0x4a8e87['model'],_0x4a8e87['query']);_0x8dbae0['attributes']=_['intersection'](_0x4a8e87['model'],qs[_0x845e('0x3a')](_0x49605b[_0x845e('0x36')][_0x845e('0x3a')]));_0x8dbae0[_0x845e('0x3b')]=_0x8dbae0['attributes']['length']?_0x8dbae0[_0x845e('0x3b')]:_0x4a8e87[_0x845e('0x35')];if(!_0x49605b['query'][_0x845e('0x3c')](_0x845e('0x3d'))){_0x8dbae0[_0x845e('0x1f')]=qs[_0x845e('0x1f')](_0x49605b['query'][_0x845e('0x1f')]);_0x8dbae0[_0x845e('0x21')]=qs[_0x845e('0x21')](_0x49605b[_0x845e('0x36')][_0x845e('0x21')]);}_0x8dbae0['order']=qs['sort'](_0x49605b[_0x845e('0x36')][_0x845e('0x3e')]);_0x8dbae0[_0x845e('0x3f')]=qs[_0x845e('0x38')](_[_0x845e('0x40')](_0x49605b['query'],_0x4a8e87['filters']),_0x4b0a1b);if(_0x49605b[_0x845e('0x36')][_0x845e('0x41')]){_0x8dbae0[_0x845e('0x3f')]=_[_0x845e('0x42')](_0x8dbae0[_0x845e('0x3f')],{'$or':_[_0x845e('0x30')](_0x4b0a1b,function(_0x312da8){if(_0x312da8['type']!==_0x845e('0x43')){var _0x5c9d34={};_0x5c9d34[_0x312da8[_0x845e('0x2e')]]={'$like':'%'+_0x49605b['query']['filter']+'%'};return _0x5c9d34;}})});}_0x8dbae0=_[_0x845e('0x42')]({},_0x8dbae0,_0x49605b[_0x845e('0x44')]);var _0x563895={'where':_0x8dbae0[_0x845e('0x3f')]};return db[_0x845e('0x31')][_0x845e('0x20')](_0x563895)[_0x845e('0x29')](function(_0x4809c1){_0x29185d[_0x845e('0x20')]=_0x4809c1;if(_0x49605b[_0x845e('0x36')]['includeAll']){_0x8dbae0[_0x845e('0x45')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x845e('0x46')](_0x8dbae0);})[_0x845e('0x29')](function(_0x563bfe){_0x29185d['rows']=_0x563bfe;return _0x29185d;})[_0x845e('0x29')](respondWithFilteredResult(_0x37b543,_0x8dbae0))[_0x845e('0x47')](handleError(_0x37b543,null));};exports[_0x845e('0x48')]=function(_0x2e4df4,_0x1e0796){var _0xa291f5={'raw':!![],'where':{'id':_0x2e4df4[_0x845e('0x49')]['id']}},_0x198295={};_0x198295[_0x845e('0x35')]=_[_0x845e('0x37')](db[_0x845e('0x31')][_0x845e('0x32')]);_0x198295[_0x845e('0x36')]=_[_0x845e('0x37')](_0x2e4df4[_0x845e('0x36')]);_0x198295[_0x845e('0x38')]=_[_0x845e('0x39')](_0x198295[_0x845e('0x35')],_0x198295[_0x845e('0x36')]);_0xa291f5[_0x845e('0x3b')]=_[_0x845e('0x39')](_0x198295[_0x845e('0x35')],qs[_0x845e('0x3a')](_0x2e4df4[_0x845e('0x36')][_0x845e('0x3a')]));_0xa291f5[_0x845e('0x3b')]=_0xa291f5['attributes'][_0x845e('0x4a')]?_0xa291f5[_0x845e('0x3b')]:_0x198295[_0x845e('0x35')];if(_0x2e4df4[_0x845e('0x36')][_0x845e('0x4b')]){_0xa291f5[_0x845e('0x45')]=[{'all':!![]}];}_0xa291f5=_[_0x845e('0x42')]({},_0xa291f5,_0x2e4df4[_0x845e('0x44')]);return db[_0x845e('0x31')][_0x845e('0x4c')](_0xa291f5)[_0x845e('0x29')](handleEntityNotFound(_0x1e0796,null))['then'](respondWithResult(_0x1e0796,null))[_0x845e('0x47')](handleError(_0x1e0796,null));};exports[_0x845e('0x4d')]=function(_0x5a8ca0,_0x177254){return db[_0x845e('0x31')][_0x845e('0x4d')](_0x5a8ca0[_0x845e('0x4e')],{})[_0x845e('0x29')](respondWithResult(_0x177254,0xc9))[_0x845e('0x47')](handleError(_0x177254,null));};exports[_0x845e('0x28')]=function(_0x5ba1e1,_0x27002b){if(_0x5ba1e1[_0x845e('0x4e')]['id']){delete _0x5ba1e1[_0x845e('0x4e')]['id'];}return db['OpenchannelQueueReport'][_0x845e('0x4c')]({'where':{'id':_0x5ba1e1[_0x845e('0x49')]['id']}})[_0x845e('0x29')](handleEntityNotFound(_0x27002b,null))['then'](saveUpdates(_0x5ba1e1['body'],null))[_0x845e('0x29')](respondWithResult(_0x27002b,null))['catch'](handleError(_0x27002b,null));};exports['destroy']=function(_0x447c6e,_0x19f7fc){return db[_0x845e('0x31')][_0x845e('0x4c')]({'where':{'id':_0x447c6e['params']['id']}})['then'](handleEntityNotFound(_0x19f7fc,null))[_0x845e('0x29')](removeEntity(_0x19f7fc,null))[_0x845e('0x47')](handleError(_0x19f7fc,null));};exports[_0x845e('0x4f')]=function(_0x23c058,_0x110048){return db['OpenchannelQueueReport'][_0x845e('0x4f')]()[_0x845e('0x29')](respondWithResult(_0x110048,null))['catch'](handleError(_0x110048,null));}; \ No newline at end of file +var _0x8197=['fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','limit','count','offset','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','map','OpenchannelQueueReport','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','describe','rimraf','zip-dir'];(function(_0x4040b7,_0x26a05f){var _0x538213=function(_0x4c15ba){while(--_0x4c15ba){_0x4040b7['push'](_0x4040b7['shift']());}};_0x538213(++_0x26a05f);}(_0x8197,0x122));var _0x7819=function(_0x22a168,_0x21f25c){_0x22a168=_0x22a168-0x0;var _0x3b7fce=_0x8197[_0x22a168];return _0x3b7fce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7819('0x0'));var zipdir=require(_0x7819('0x1'));var jsonpatch=require(_0x7819('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7819('0x3'));var util=require(_0x7819('0x4'));var path=require(_0x7819('0x5'));var sox=require('sox');var csv=require(_0x7819('0x6'));var ejs=require(_0x7819('0x7'));var fs=require('fs');var fs_extra=require(_0x7819('0x8'));var _=require(_0x7819('0x9'));var squel=require(_0x7819('0xa'));var crypto=require(_0x7819('0xb'));var jsforce=require(_0x7819('0xc'));var deskjs=require(_0x7819('0xd'));var toCsv=require(_0x7819('0x6'));var querystring=require('querystring');var Papa=require(_0x7819('0xe'));var Redis=require('ioredis');var authService=require(_0x7819('0xf'));var qs=require(_0x7819('0x10'));var as=require(_0x7819('0x11'));var hardwareService=require(_0x7819('0x12'));var logger=require(_0x7819('0x13'))(_0x7819('0x14'));var utils=require(_0x7819('0x15'));var config=require(_0x7819('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2d096c,_0x2e5e54){_0x2e5e54=_0x2e5e54||0xcc;return function(_0x19b5eb){if(_0x19b5eb){return _0x2d096c[_0x7819('0x17')](_0x2e5e54);}return _0x2d096c[_0x7819('0x18')](_0x2e5e54)['end']();};}function respondWithResult(_0x1fd953,_0xd992c1){_0xd992c1=_0xd992c1||0xc8;return function(_0x14977f){if(_0x14977f){return _0x1fd953[_0x7819('0x18')](_0xd992c1)['json'](_0x14977f);}};}function respondWithFilteredResult(_0xc4395d,_0x1552b1){return function(_0x9c921c){if(_0x9c921c){var _0x1c83f5=typeof _0x1552b1['offset']==='undefined'&&typeof _0x1552b1[_0x7819('0x19')]==='undefined';var _0x55fb7d=_0x9c921c[_0x7819('0x1a')];var _0x1fd441=_0x1c83f5?0x0:_0x1552b1[_0x7819('0x1b')];var _0x5556a1=_0x1c83f5?_0x9c921c[_0x7819('0x1a')]:_0x1552b1[_0x7819('0x1b')]+_0x1552b1[_0x7819('0x19')];var _0x10eb13;if(_0x5556a1>=_0x55fb7d){_0x5556a1=_0x55fb7d;_0x10eb13=0xc8;}else{_0x10eb13=0xce;}_0xc4395d[_0x7819('0x18')](_0x10eb13);return _0xc4395d[_0x7819('0x1c')](_0x7819('0x1d'),_0x1fd441+'-'+_0x5556a1+'/'+_0x55fb7d)[_0x7819('0x1e')](_0x9c921c);}return null;};}function patchUpdates(_0x5f4c76){return function(_0x499730){try{jsonpatch[_0x7819('0x1f')](_0x499730,_0x5f4c76,!![]);}catch(_0x904487){return BPromise[_0x7819('0x20')](_0x904487);}return _0x499730['save']();};}function saveUpdates(_0x2ac392,_0x4f998a){return function(_0x291519){if(_0x291519){return _0x291519[_0x7819('0x21')](_0x2ac392)[_0x7819('0x22')](function(_0x1301ff){return _0x1301ff;});}return null;};}function removeEntity(_0x465ea1,_0xccfcb3){return function(_0x1dc58a){if(_0x1dc58a){return _0x1dc58a[_0x7819('0x23')]()[_0x7819('0x22')](function(){_0x465ea1[_0x7819('0x18')](0xcc)[_0x7819('0x24')]();});}};}function handleEntityNotFound(_0x32c995,_0x4f7361){return function(_0x253d75){if(!_0x253d75){_0x32c995[_0x7819('0x17')](0x194);}return _0x253d75;};}function handleError(_0x4b3763,_0x12fa70){_0x12fa70=_0x12fa70||0x1f4;return function(_0x285085){logger[_0x7819('0x25')](_0x285085[_0x7819('0x26')]);if(_0x285085['name']){delete _0x285085['name'];}_0x4b3763[_0x7819('0x18')](_0x12fa70)['send'](_0x285085);};}exports['index']=function(_0x464f81,_0x1b6107){var _0x478792={},_0x5e3896={},_0x5e6fa4={'count':0x0,'rows':[]};var _0x1b919a=_[_0x7819('0x27')](db[_0x7819('0x28')]['rawAttributes'],function(_0x18837f){return{'name':_0x18837f[_0x7819('0x29')],'type':_0x18837f[_0x7819('0x2a')][_0x7819('0x2b')]};});_0x5e3896[_0x7819('0x2c')]=_[_0x7819('0x27')](_0x1b919a,_0x7819('0x2d'));_0x5e3896[_0x7819('0x2e')]=_[_0x7819('0x2f')](_0x464f81[_0x7819('0x2e')]);_0x5e3896[_0x7819('0x30')]=_[_0x7819('0x31')](_0x5e3896[_0x7819('0x2c')],_0x5e3896[_0x7819('0x2e')]);_0x478792['attributes']=_[_0x7819('0x31')](_0x5e3896[_0x7819('0x2c')],qs[_0x7819('0x32')](_0x464f81[_0x7819('0x2e')][_0x7819('0x32')]));_0x478792[_0x7819('0x33')]=_0x478792[_0x7819('0x33')][_0x7819('0x34')]?_0x478792['attributes']:_0x5e3896['model'];if(!_0x464f81[_0x7819('0x2e')]['hasOwnProperty'](_0x7819('0x35'))){_0x478792[_0x7819('0x19')]=qs['limit'](_0x464f81[_0x7819('0x2e')][_0x7819('0x19')]);_0x478792['offset']=qs[_0x7819('0x1b')](_0x464f81[_0x7819('0x2e')][_0x7819('0x1b')]);}_0x478792[_0x7819('0x36')]=qs[_0x7819('0x37')](_0x464f81[_0x7819('0x2e')]['sort']);_0x478792[_0x7819('0x38')]=qs[_0x7819('0x30')](_[_0x7819('0x39')](_0x464f81[_0x7819('0x2e')],_0x5e3896[_0x7819('0x30')]),_0x1b919a);if(_0x464f81[_0x7819('0x2e')][_0x7819('0x3a')]){_0x478792[_0x7819('0x38')]=_[_0x7819('0x3b')](_0x478792[_0x7819('0x38')],{'$or':_[_0x7819('0x27')](_0x1b919a,function(_0x49d5fd){if(_0x49d5fd[_0x7819('0x2a')]!==_0x7819('0x3c')){var _0x29b83e={};_0x29b83e[_0x49d5fd['name']]={'$like':'%'+_0x464f81['query'][_0x7819('0x3a')]+'%'};return _0x29b83e;}})});}_0x478792=_['merge']({},_0x478792,_0x464f81['options']);var _0x54adcf={'where':_0x478792['where']};return db[_0x7819('0x28')][_0x7819('0x1a')](_0x54adcf)[_0x7819('0x22')](function(_0x272eaa){_0x5e6fa4[_0x7819('0x1a')]=_0x272eaa;if(_0x464f81[_0x7819('0x2e')][_0x7819('0x3d')]){_0x478792['include']=[{'all':!![]}];}return db[_0x7819('0x28')]['findAll'](_0x478792);})[_0x7819('0x22')](function(_0x267115){_0x5e6fa4[_0x7819('0x3e')]=_0x267115;return _0x5e6fa4;})[_0x7819('0x22')](respondWithFilteredResult(_0x1b6107,_0x478792))['catch'](handleError(_0x1b6107,null));};exports[_0x7819('0x3f')]=function(_0x2c8da3,_0x23dea5){var _0x128c90={'raw':!![],'where':{'id':_0x2c8da3[_0x7819('0x40')]['id']}},_0x13f7ec={};_0x13f7ec[_0x7819('0x2c')]=_['keys'](db['OpenchannelQueueReport'][_0x7819('0x41')]);_0x13f7ec[_0x7819('0x2e')]=_['keys'](_0x2c8da3[_0x7819('0x2e')]);_0x13f7ec[_0x7819('0x30')]=_[_0x7819('0x31')](_0x13f7ec['model'],_0x13f7ec[_0x7819('0x2e')]);_0x128c90[_0x7819('0x33')]=_[_0x7819('0x31')](_0x13f7ec[_0x7819('0x2c')],qs[_0x7819('0x32')](_0x2c8da3[_0x7819('0x2e')]['fields']));_0x128c90[_0x7819('0x33')]=_0x128c90[_0x7819('0x33')][_0x7819('0x34')]?_0x128c90[_0x7819('0x33')]:_0x13f7ec[_0x7819('0x2c')];if(_0x2c8da3[_0x7819('0x2e')][_0x7819('0x3d')]){_0x128c90[_0x7819('0x42')]=[{'all':!![]}];}_0x128c90=_[_0x7819('0x3b')]({},_0x128c90,_0x2c8da3[_0x7819('0x43')]);return db['OpenchannelQueueReport'][_0x7819('0x44')](_0x128c90)[_0x7819('0x22')](handleEntityNotFound(_0x23dea5,null))[_0x7819('0x22')](respondWithResult(_0x23dea5,null))[_0x7819('0x45')](handleError(_0x23dea5,null));};exports[_0x7819('0x46')]=function(_0x4174f6,_0x6dc368){return db[_0x7819('0x28')]['create'](_0x4174f6[_0x7819('0x47')],{})[_0x7819('0x22')](respondWithResult(_0x6dc368,0xc9))[_0x7819('0x45')](handleError(_0x6dc368,null));};exports[_0x7819('0x21')]=function(_0x3a416b,_0x289a07){if(_0x3a416b[_0x7819('0x47')]['id']){delete _0x3a416b['body']['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x3a416b[_0x7819('0x40')]['id']}})[_0x7819('0x22')](handleEntityNotFound(_0x289a07,null))['then'](saveUpdates(_0x3a416b[_0x7819('0x47')],null))[_0x7819('0x22')](respondWithResult(_0x289a07,null))['catch'](handleError(_0x289a07,null));};exports[_0x7819('0x23')]=function(_0x43ee5f,_0x204248){return db[_0x7819('0x28')][_0x7819('0x44')]({'where':{'id':_0x43ee5f['params']['id']}})[_0x7819('0x22')](handleEntityNotFound(_0x204248,null))['then'](removeEntity(_0x204248,null))[_0x7819('0x45')](handleError(_0x204248,null));};exports['describe']=function(_0x8aee42,_0x4ee579){return db[_0x7819('0x28')][_0x7819('0x48')]()[_0x7819('0x22')](respondWithResult(_0x4ee579,null))['catch'](handleError(_0x4ee579,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 9497695..2edb4b0 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x14024d,_0x33a94b){var _0x365fe6=function(_0x5c7e03){while(--_0x5c7e03){_0x14024d['push'](_0x14024d['shift']());}};_0x365fe6(++_0x33a94b);}(_0x326f,0xd1));var _0xf326=function(_0xe9b54c,_0x440c63){_0xe9b54c=_0xe9b54c-0x0;var _0x10d3fe=_0x326f[_0xe9b54c];return _0x10d3fe;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x4590cf,_0xc7ba09){var _0x36bd08=function(_0x436c16){while(--_0x436c16){_0x4590cf['push'](_0x4590cf['shift']());}};_0x36bd08(++_0xc7ba09);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43a1b8,_0x1c90c8){_0x43a1b8=_0x43a1b8-0x0;var _0x324ecc=_0x5fc3[_0x43a1b8];return _0x324ecc;};'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')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index d2be98d..837f737 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 _0x4227=['CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','UpdateOpenchannelQueueReport','update','raw','attributes','limit','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch'];(function(_0x5746a1,_0x11eab1){var _0x551a43=function(_0x7ddcbe){while(--_0x7ddcbe){_0x5746a1['push'](_0x5746a1['shift']());}};_0x551a43(++_0x11eab1);}(_0x4227,0x89));var _0x7422=function(_0x247679,_0x10a08a){_0x247679=_0x247679-0x0;var _0x42e111=_0x4227[_0x247679];return _0x42e111;};'use strict';var _=require(_0x7422('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7422('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7422('0x2'));var db=require(_0x7422('0x3'))['db'];var utils=require(_0x7422('0x4'));var logger=require('../../config/logger')(_0x7422('0x5'));var config=require(_0x7422('0x6'));var jayson=require(_0x7422('0x7'));var client=jayson[_0x7422('0x8')][_0x7422('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b3432,_0xe99299,_0x45ca1a){return new BPromise(function(_0x12965e,_0x599d78){return client[_0x7422('0xa')](_0x2b3432,_0x45ca1a)[_0x7422('0xb')](function(_0x25de34){logger['info'](_0x7422('0xc'),_0xe99299,'request\x20sent');logger[_0x7422('0xd')](_0x7422('0xe'),_0xe99299,_0x7422('0xf'),JSON[_0x7422('0x10')](_0x25de34));if(_0x25de34[_0x7422('0x11')]){if(_0x25de34['error'][_0x7422('0x12')]===0x1f4){logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x25de34[_0x7422('0x11')][_0x7422('0x13')]);return _0x599d78(_0x25de34['error'][_0x7422('0x13')]);}logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x25de34['error'][_0x7422('0x13')]);return _0x12965e(_0x25de34['error'][_0x7422('0x13')]);}else{logger[_0x7422('0x14')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x7422('0xf'));_0x12965e(_0x25de34[_0x7422('0x15')][_0x7422('0x13')]);}})[_0x7422('0x16')](function(_0x2946ca){logger[_0x7422('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0xe99299,_0x2946ca);_0x599d78(_0x2946ca);});});}exports[_0x7422('0x17')]=function(_0xa7ff41){var _0x493f59=this;return new Promise(function(_0x30656d,_0x57b8bf){return db[_0x7422('0x18')]['create'](_0xa7ff41[_0x7422('0x19')],{'raw':_0xa7ff41[_0x7422('0x1a')]?_0xa7ff41[_0x7422('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x7422('0xb')](function(_0xacaad1){logger[_0x7422('0x14')](_0x7422('0x17'),_0xa7ff41);logger['debug']('CreateOpenchannelQueueReport',_0xa7ff41,JSON[_0x7422('0x10')](_0xacaad1));_0x30656d(_0xacaad1);})[_0x7422('0x16')](function(_0x20c1e3){logger[_0x7422('0x11')](_0x7422('0x17'),_0x20c1e3[_0x7422('0x13')],_0xa7ff41);_0x57b8bf(_0x493f59[_0x7422('0x11')](0x1f4,_0x20c1e3['message']));});});};exports[_0x7422('0x1b')]=function(_0x46b927){var _0x4fc200=this;return new Promise(function(_0x3a5a0c,_0x23fb68){return db[_0x7422('0x18')][_0x7422('0x1c')](_0x46b927['body'],{'raw':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')][_0x7422('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')]['where']||null:null,'attributes':_0x46b927[_0x7422('0x1a')]?_0x46b927[_0x7422('0x1a')][_0x7422('0x1e')]||null:null,'limit':_0x46b927[_0x7422('0x1a')]?_0x46b927['options'][_0x7422('0x1f')]||null:null})[_0x7422('0xb')](function(_0x9b0144){logger[_0x7422('0x14')]('UpdateOpenchannelQueueReport',_0x46b927);logger[_0x7422('0xd')](_0x7422('0x1b'),_0x46b927,JSON['stringify'](_0x9b0144));_0x3a5a0c(_0x9b0144);})['catch'](function(_0x2baac6){logger[_0x7422('0x11')]('UpdateOpenchannelQueueReport',_0x2baac6[_0x7422('0x13')],_0x46b927);_0x23fb68(_0x4fc200[_0x7422('0x11')](0x1f4,_0x2baac6[_0x7422('0x13')]));});});}; \ No newline at end of file +var _0x8e3f=['limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','stringify','UpdateOpenchannelQueueReport','update','attributes'];(function(_0x7800d,_0x45b213){var _0x41e3ba=function(_0x2afe72){while(--_0x2afe72){_0x7800d['push'](_0x7800d['shift']());}};_0x41e3ba(++_0x45b213);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var moment=require(_0xf8e3('0x2'));var BPromise=require('bluebird');var rs=require(_0xf8e3('0x3'));var fs=require('fs');var Redis=require(_0xf8e3('0x4'));var db=require(_0xf8e3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf8e3('0x6'))(_0xf8e3('0x7'));var config=require('../../config/environment');var jayson=require(_0xf8e3('0x8'));var client=jayson[_0xf8e3('0x9')][_0xf8e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ee9f3,_0x4e9e57,_0x4504dd){return new BPromise(function(_0x2e39b7,_0x17f56c){return client[_0xf8e3('0xb')](_0x1ee9f3,_0x4504dd)[_0xf8e3('0xc')](function(_0x4055e2){logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));logger[_0xf8e3('0x10')](_0xf8e3('0x11'),_0x4e9e57,_0xf8e3('0xf'),JSON['stringify'](_0x4055e2));if(_0x4055e2[_0xf8e3('0x12')]){if(_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x13')]===0x1f4){logger['error'](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')][_0xf8e3('0x14')]);return _0x17f56c(_0x4055e2[_0xf8e3('0x12')]['message']);}logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x4055e2[_0xf8e3('0x12')]['message']);return _0x2e39b7(_0x4055e2[_0xf8e3('0x12')]['message']);}else{logger[_0xf8e3('0xd')](_0xf8e3('0xe'),_0x4e9e57,_0xf8e3('0xf'));_0x2e39b7(_0x4055e2['result']['message']);}})[_0xf8e3('0x15')](function(_0x385dde){logger[_0xf8e3('0x12')](_0xf8e3('0xe'),_0x4e9e57,_0x385dde);_0x17f56c(_0x385dde);});});}exports[_0xf8e3('0x16')]=function(_0x11d4cc){var _0x7a81c3=this;return new Promise(function(_0x2e27e3,_0x1337ae){return db[_0xf8e3('0x17')]['create'](_0x11d4cc[_0xf8e3('0x18')],{'raw':_0x11d4cc[_0xf8e3('0x19')]?_0x11d4cc[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![]})[_0xf8e3('0xc')](function(_0x11c58e){logger[_0xf8e3('0xd')](_0xf8e3('0x16'),_0x11d4cc);logger['debug'](_0xf8e3('0x16'),_0x11d4cc,JSON[_0xf8e3('0x1b')](_0x11c58e));_0x2e27e3(_0x11c58e);})[_0xf8e3('0x15')](function(_0xccbcc0){logger['error'](_0xf8e3('0x16'),_0xccbcc0['message'],_0x11d4cc);_0x1337ae(_0x7a81c3[_0xf8e3('0x12')](0x1f4,_0xccbcc0[_0xf8e3('0x14')]));});});};exports[_0xf8e3('0x1c')]=function(_0x2dc856){var _0x1f4b68=this;return new Promise(function(_0x3ac384,_0x512a83){return db[_0xf8e3('0x17')][_0xf8e3('0x1d')](_0x2dc856[_0xf8e3('0x18')],{'raw':_0x2dc856[_0xf8e3('0x19')]?_0x2dc856[_0xf8e3('0x19')][_0xf8e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dc856[_0xf8e3('0x19')]?_0x2dc856[_0xf8e3('0x19')]['where']||null:null,'attributes':_0x2dc856[_0xf8e3('0x19')]?_0x2dc856[_0xf8e3('0x19')][_0xf8e3('0x1e')]||null:null,'limit':_0x2dc856[_0xf8e3('0x19')]?_0x2dc856[_0xf8e3('0x19')][_0xf8e3('0x1f')]||null:null})[_0xf8e3('0xc')](function(_0xfaf15d){logger['info'](_0xf8e3('0x1c'),_0x2dc856);logger[_0xf8e3('0x10')](_0xf8e3('0x1c'),_0x2dc856,JSON[_0xf8e3('0x1b')](_0xfaf15d));_0x3ac384(_0xfaf15d);})['catch'](function(_0x2e507c){logger[_0xf8e3('0x12')](_0xf8e3('0x1c'),_0x2e507c[_0xf8e3('0x14')],_0x2dc856);_0x512a83(_0x1f4b68[_0xf8e3('0x12')](0x1f4,_0x2e507c[_0xf8e3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 0d885ba..bfc7da5 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 _0xec7a=['connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy','util','path'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xec7a,0x1da));var _0xaec7=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0xec7a[_0x541ea6];return _0x3c3e84;};'use strict';var multer=require('multer');var util=require(_0xaec7('0x0'));var path=require(_0xaec7('0x1'));var timeout=require(_0xaec7('0x2'));var express=require(_0xaec7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaec7('0x4'));var interaction=require(_0xaec7('0x5'));var config=require(_0xaec7('0x6'));var controller=require(_0xaec7('0x7'));router[_0xaec7('0x8')]('/',auth[_0xaec7('0x9')](),controller[_0xaec7('0xa')]);router[_0xaec7('0x8')]('/describe',auth[_0xaec7('0x9')](),controller['describe']);router[_0xaec7('0x8')](_0xaec7('0xb'),auth[_0xaec7('0x9')](),controller['show']);router[_0xaec7('0xc')]('/',auth[_0xaec7('0x9')](),controller['create']);router[_0xaec7('0xd')](_0xaec7('0xb'),auth[_0xaec7('0x9')](),controller[_0xaec7('0xe')]);router[_0xaec7('0xf')](_0xaec7('0xb'),auth[_0xaec7('0x9')](),controller[_0xaec7('0x10')]);module['exports']=router; \ No newline at end of file +var _0xb7a7=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','put','update','path'];(function(_0x11399e,_0x29c509){var _0xc4e021=function(_0x51f290){while(--_0x51f290){_0x11399e['push'](_0x11399e['shift']());}};_0xc4e021(++_0x29c509);}(_0xb7a7,0xdf));var _0x7b7a=function(_0x43d55d,_0x283a21){_0x43d55d=_0x43d55d-0x0;var _0x2b6508=_0xb7a7[_0x43d55d];return _0x2b6508;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b7a('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b7a('0x1'));var router=express[_0x7b7a('0x2')]();var fs_extra=require(_0x7b7a('0x3'));var auth=require(_0x7b7a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7b7a('0x5'));var controller=require(_0x7b7a('0x6'));router[_0x7b7a('0x7')]('/',auth[_0x7b7a('0x8')](),controller['index']);router['get'](_0x7b7a('0x9'),auth['isAuthenticated'](),controller[_0x7b7a('0xa')]);router[_0x7b7a('0x7')](_0x7b7a('0xb'),auth['isAuthenticated'](),controller[_0x7b7a('0xc')]);router[_0x7b7a('0xd')]('/',auth[_0x7b7a('0x8')](),controller['create']);router[_0x7b7a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x7b7a('0xf')]);router['delete'](_0x7b7a('0xb'),auth[_0x7b7a('0x8')](),controller['destroy']);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 c211562..593eca9 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x257783,_0x46c493){var _0x51f212=function(_0x419031){while(--_0x419031){_0x257783['push'](_0x257783['shift']());}};_0x51f212(++_0x46c493);}(_0xf4eb,0xec));var _0xbf4e=function(_0x28c319,_0x4d78ad){_0x28c319=_0x28c319-0x0;var _0x129651=_0xf4eb[_0x28c319];return _0x129651;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x233c11,_0x1083e4){var _0x381729=function(_0x43b75b){while(--_0x43b75b){_0x233c11['push'](_0x233c11['shift']());}};_0x381729(++_0x1083e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 951ccc5..387c856 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 _0xb1ab=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','then','destroy','error','name','index','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','count','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x43af7b,_0x3891d9){var _0x5ab131=function(_0x42f585){while(--_0x42f585){_0x43af7b['push'](_0x43af7b['shift']());}};_0x5ab131(++_0x3891d9);}(_0xb1ab,0x11c));var _0xbb1a=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xb1ab[_0x525c7b];return _0x27b33e;};'use strict';var emlformat=require(_0xbb1a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb1a('0x1'));var jsonpatch=require(_0xbb1a('0x2'));var rp=require(_0xbb1a('0x3'));var moment=require(_0xbb1a('0x4'));var BPromise=require(_0xbb1a('0x5'));var Mustache=require('mustache');var util=require(_0xbb1a('0x6'));var path=require(_0xbb1a('0x7'));var sox=require(_0xbb1a('0x8'));var csv=require(_0xbb1a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb1a('0xa'));var _=require(_0xbb1a('0xb'));var squel=require(_0xbb1a('0xc'));var crypto=require(_0xbb1a('0xd'));var jsforce=require(_0xbb1a('0xe'));var deskjs=require(_0xbb1a('0xf'));var toCsv=require(_0xbb1a('0x9'));var querystring=require(_0xbb1a('0x10'));var Papa=require(_0xbb1a('0x11'));var Redis=require('ioredis');var authService=require(_0xbb1a('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xbb1a('0x13'));var hardwareService=require(_0xbb1a('0x14'));var logger=require(_0xbb1a('0x15'))('api');var utils=require(_0xbb1a('0x16'));var config=require(_0xbb1a('0x17'));var licenseUtil=require(_0xbb1a('0x18'));var db=require(_0xbb1a('0x19'))['db'];function respondWithStatusCode(_0x2d151b,_0x1158d0){_0x1158d0=_0x1158d0||0xcc;return function(_0x170065){if(_0x170065){return _0x2d151b['sendStatus'](_0x1158d0);}return _0x2d151b[_0xbb1a('0x1a')](_0x1158d0)[_0xbb1a('0x1b')]();};}function respondWithResult(_0x22b7d2,_0x1a87f4){_0x1a87f4=_0x1a87f4||0xc8;return function(_0xb409b5){if(_0xb409b5){return _0x22b7d2['status'](_0x1a87f4)[_0xbb1a('0x1c')](_0xb409b5);}};}function respondWithFilteredResult(_0x31f3da,_0x45be32){return function(_0x142d3c){if(_0x142d3c){var _0x1a00e3=typeof _0x45be32[_0xbb1a('0x1d')]===_0xbb1a('0x1e')&&typeof _0x45be32[_0xbb1a('0x1f')]==='undefined';var _0x4f7a79=_0x142d3c['count'];var _0x49b8d1=_0x1a00e3?0x0:_0x45be32[_0xbb1a('0x1d')];var _0x5d89b1=_0x1a00e3?_0x142d3c['count']:_0x45be32[_0xbb1a('0x1d')]+_0x45be32[_0xbb1a('0x1f')];var _0x2cefed;if(_0x5d89b1>=_0x4f7a79){_0x5d89b1=_0x4f7a79;_0x2cefed=0xc8;}else{_0x2cefed=0xce;}_0x31f3da[_0xbb1a('0x1a')](_0x2cefed);return _0x31f3da['set'](_0xbb1a('0x20'),_0x49b8d1+'-'+_0x5d89b1+'/'+_0x4f7a79)[_0xbb1a('0x1c')](_0x142d3c);}return null;};}function patchUpdates(_0xfabd72){return function(_0x1de59e){try{jsonpatch['apply'](_0x1de59e,_0xfabd72,!![]);}catch(_0x486f7c){return BPromise[_0xbb1a('0x21')](_0x486f7c);}return _0x1de59e[_0xbb1a('0x22')]();};}function saveUpdates(_0xc4cc65,_0x58f209){return function(_0x23745e){if(_0x23745e){return _0x23745e[_0xbb1a('0x23')](_0xc4cc65)[_0xbb1a('0x24')](function(_0x1e6bec){return _0x1e6bec;});}return null;};}function removeEntity(_0x5a03b1,_0x822a59){return function(_0x5f1539){if(_0x5f1539){return _0x5f1539[_0xbb1a('0x25')]()[_0xbb1a('0x24')](function(){_0x5a03b1[_0xbb1a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a2237,_0x5689db){return function(_0x517652){if(!_0x517652){_0x3a2237['sendStatus'](0x194);}return _0x517652;};}function handleError(_0x5da1cc,_0x33581f){_0x33581f=_0x33581f||0x1f4;return function(_0x3db7c7){logger[_0xbb1a('0x26')](_0x3db7c7['stack']);if(_0x3db7c7['name']){delete _0x3db7c7[_0xbb1a('0x27')];}_0x5da1cc[_0xbb1a('0x1a')](_0x33581f)['send'](_0x3db7c7);};}exports[_0xbb1a('0x28')]=function(_0x167a35,_0x255146){var _0x27af0b={},_0x41c117={},_0x242aa5={'count':0x0,'rows':[]};var _0x58c73f=_['map'](db[_0xbb1a('0x29')][_0xbb1a('0x2a')],function(_0x506756){return{'name':_0x506756[_0xbb1a('0x2b')],'type':_0x506756[_0xbb1a('0x2c')][_0xbb1a('0x2d')]};});_0x41c117[_0xbb1a('0x2e')]=_[_0xbb1a('0x2f')](_0x58c73f,'name');_0x41c117[_0xbb1a('0x30')]=_[_0xbb1a('0x31')](_0x167a35[_0xbb1a('0x30')]);_0x41c117[_0xbb1a('0x32')]=_[_0xbb1a('0x33')](_0x41c117['model'],_0x41c117[_0xbb1a('0x30')]);_0x27af0b[_0xbb1a('0x34')]=_['intersection'](_0x41c117['model'],qs[_0xbb1a('0x35')](_0x167a35['query']['fields']));_0x27af0b[_0xbb1a('0x34')]=_0x27af0b[_0xbb1a('0x34')][_0xbb1a('0x36')]?_0x27af0b[_0xbb1a('0x34')]:_0x41c117['model'];if(!_0x167a35[_0xbb1a('0x30')][_0xbb1a('0x37')](_0xbb1a('0x38'))){_0x27af0b[_0xbb1a('0x1f')]=qs[_0xbb1a('0x1f')](_0x167a35[_0xbb1a('0x30')][_0xbb1a('0x1f')]);_0x27af0b[_0xbb1a('0x1d')]=qs[_0xbb1a('0x1d')](_0x167a35[_0xbb1a('0x30')]['offset']);}_0x27af0b[_0xbb1a('0x39')]=qs[_0xbb1a('0x3a')](_0x167a35['query'][_0xbb1a('0x3a')]);_0x27af0b[_0xbb1a('0x3b')]=qs[_0xbb1a('0x32')](_['pick'](_0x167a35[_0xbb1a('0x30')],_0x41c117[_0xbb1a('0x32')]),_0x58c73f);if(_0x167a35[_0xbb1a('0x30')][_0xbb1a('0x3c')]){_0x27af0b[_0xbb1a('0x3b')]=_[_0xbb1a('0x3d')](_0x27af0b[_0xbb1a('0x3b')],{'$or':_[_0xbb1a('0x2f')](_0x58c73f,function(_0x1666e5){if(_0x1666e5[_0xbb1a('0x2c')]!=='VIRTUAL'){var _0xb6c59b={};_0xb6c59b[_0x1666e5[_0xbb1a('0x27')]]={'$like':'%'+_0x167a35['query']['filter']+'%'};return _0xb6c59b;}})});}_0x27af0b=_['merge']({},_0x27af0b,_0x167a35['options']);var _0x50ee40={'where':_0x27af0b[_0xbb1a('0x3b')]};return db[_0xbb1a('0x29')][_0xbb1a('0x3e')](_0x50ee40)[_0xbb1a('0x24')](function(_0x52f540){_0x242aa5[_0xbb1a('0x3e')]=_0x52f540;if(_0x167a35[_0xbb1a('0x30')][_0xbb1a('0x3f')]){_0x27af0b[_0xbb1a('0x40')]=[{'all':!![]}];}return db[_0xbb1a('0x29')][_0xbb1a('0x41')](_0x27af0b);})[_0xbb1a('0x24')](function(_0x1ed6d1){_0x242aa5[_0xbb1a('0x42')]=_0x1ed6d1;return _0x242aa5;})[_0xbb1a('0x24')](respondWithFilteredResult(_0x255146,_0x27af0b))[_0xbb1a('0x43')](handleError(_0x255146,null));};exports[_0xbb1a('0x44')]=function(_0x2326f8,_0x37913b){var _0x2537aa={'raw':!![],'where':{'id':_0x2326f8[_0xbb1a('0x45')]['id']}},_0x4a96a7={};_0x4a96a7[_0xbb1a('0x2e')]=_['keys'](db[_0xbb1a('0x29')][_0xbb1a('0x2a')]);_0x4a96a7[_0xbb1a('0x30')]=_['keys'](_0x2326f8['query']);_0x4a96a7[_0xbb1a('0x32')]=_[_0xbb1a('0x33')](_0x4a96a7[_0xbb1a('0x2e')],_0x4a96a7[_0xbb1a('0x30')]);_0x2537aa['attributes']=_[_0xbb1a('0x33')](_0x4a96a7['model'],qs['fields'](_0x2326f8[_0xbb1a('0x30')][_0xbb1a('0x35')]));_0x2537aa[_0xbb1a('0x34')]=_0x2537aa[_0xbb1a('0x34')]['length']?_0x2537aa[_0xbb1a('0x34')]:_0x4a96a7[_0xbb1a('0x2e')];if(_0x2326f8['query'][_0xbb1a('0x3f')]){_0x2537aa['include']=[{'all':!![]}];}_0x2537aa=_[_0xbb1a('0x3d')]({},_0x2537aa,_0x2326f8[_0xbb1a('0x46')]);return db[_0xbb1a('0x29')]['find'](_0x2537aa)['then'](handleEntityNotFound(_0x37913b,null))[_0xbb1a('0x24')](respondWithResult(_0x37913b,null))[_0xbb1a('0x43')](handleError(_0x37913b,null));};exports[_0xbb1a('0x47')]=function(_0x1fba74,_0x698b66){return db[_0xbb1a('0x29')]['create'](_0x1fba74[_0xbb1a('0x48')],{})[_0xbb1a('0x24')](respondWithResult(_0x698b66,0xc9))[_0xbb1a('0x43')](handleError(_0x698b66,null));};exports[_0xbb1a('0x23')]=function(_0x4954ef,_0x2553e3){if(_0x4954ef[_0xbb1a('0x48')]['id']){delete _0x4954ef[_0xbb1a('0x48')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4954ef[_0xbb1a('0x45')]['id']}})[_0xbb1a('0x24')](handleEntityNotFound(_0x2553e3,null))[_0xbb1a('0x24')](saveUpdates(_0x4954ef[_0xbb1a('0x48')],null))[_0xbb1a('0x24')](respondWithResult(_0x2553e3,null))[_0xbb1a('0x43')](handleError(_0x2553e3,null));};exports[_0xbb1a('0x25')]=function(_0x74932f,_0x1d7791){return db['OpenchannelTransferReport'][_0xbb1a('0x49')]({'where':{'id':_0x74932f['params']['id']}})[_0xbb1a('0x24')](handleEntityNotFound(_0x1d7791,null))[_0xbb1a('0x24')](removeEntity(_0x1d7791,null))[_0xbb1a('0x43')](handleError(_0x1d7791,null));};exports[_0xbb1a('0x4a')]=function(_0x55b49e,_0x4b1bae){return db[_0xbb1a('0x29')][_0xbb1a('0x4a')]()[_0xbb1a('0x24')](respondWithResult(_0x4b1bae,null))[_0xbb1a('0x43')](handleError(_0x4b1bae,null));}; \ No newline at end of file +var _0x0994=['create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','then','end','name','index','OpenchannelTransferReport','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find'];(function(_0x48b492,_0x1c5091){var _0x5eb0f1=function(_0x282a94){while(--_0x282a94){_0x48b492['push'](_0x48b492['shift']());}};_0x5eb0f1(++_0x1c5091);}(_0x0994,0xe6));var _0x4099=function(_0x5ecb31,_0x1b2f70){_0x5ecb31=_0x5ecb31-0x0;var _0xb6753b=_0x0994[_0x5ecb31];return _0xb6753b;};'use strict';var emlformat=require(_0x4099('0x0'));var rimraf=require(_0x4099('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4099('0x2'));var rp=require(_0x4099('0x3'));var moment=require(_0x4099('0x4'));var BPromise=require(_0x4099('0x5'));var Mustache=require(_0x4099('0x6'));var util=require(_0x4099('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4099('0x8'));var ejs=require(_0x4099('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4099('0xa'));var squel=require(_0x4099('0xb'));var crypto=require(_0x4099('0xc'));var jsforce=require(_0x4099('0xd'));var deskjs=require(_0x4099('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4099('0xf'));var Papa=require(_0x4099('0x10'));var Redis=require(_0x4099('0x11'));var authService=require(_0x4099('0x12'));var qs=require(_0x4099('0x13'));var as=require(_0x4099('0x14'));var hardwareService=require(_0x4099('0x15'));var logger=require(_0x4099('0x16'))('api');var utils=require(_0x4099('0x17'));var config=require(_0x4099('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4099('0x19'))['db'];function respondWithStatusCode(_0x330c18,_0x47d578){_0x47d578=_0x47d578||0xcc;return function(_0x18a601){if(_0x18a601){return _0x330c18[_0x4099('0x1a')](_0x47d578);}return _0x330c18['status'](_0x47d578)['end']();};}function respondWithResult(_0x2162e9,_0x3ef375){_0x3ef375=_0x3ef375||0xc8;return function(_0x2d4693){if(_0x2d4693){return _0x2162e9[_0x4099('0x1b')](_0x3ef375)[_0x4099('0x1c')](_0x2d4693);}};}function respondWithFilteredResult(_0x4592df,_0x4d5047){return function(_0x33289c){if(_0x33289c){var _0x548358=typeof _0x4d5047[_0x4099('0x1d')]===_0x4099('0x1e')&&typeof _0x4d5047[_0x4099('0x1f')]===_0x4099('0x1e');var _0x332ab6=_0x33289c[_0x4099('0x20')];var _0x28e137=_0x548358?0x0:_0x4d5047['offset'];var _0x363cb9=_0x548358?_0x33289c[_0x4099('0x20')]:_0x4d5047[_0x4099('0x1d')]+_0x4d5047[_0x4099('0x1f')];var _0x48a2d1;if(_0x363cb9>=_0x332ab6){_0x363cb9=_0x332ab6;_0x48a2d1=0xc8;}else{_0x48a2d1=0xce;}_0x4592df[_0x4099('0x1b')](_0x48a2d1);return _0x4592df[_0x4099('0x21')]('Content-Range',_0x28e137+'-'+_0x363cb9+'/'+_0x332ab6)[_0x4099('0x1c')](_0x33289c);}return null;};}function patchUpdates(_0x1bed5a){return function(_0x5ee7a6){try{jsonpatch[_0x4099('0x22')](_0x5ee7a6,_0x1bed5a,!![]);}catch(_0x6b71c3){return BPromise['reject'](_0x6b71c3);}return _0x5ee7a6[_0x4099('0x23')]();};}function saveUpdates(_0x13b4f0,_0x5784b4){return function(_0x2b5b91){if(_0x2b5b91){return _0x2b5b91['update'](_0x13b4f0)[_0x4099('0x24')](function(_0x22788c){return _0x22788c;});}return null;};}function removeEntity(_0x491924,_0x2b2abc){return function(_0x40387b){if(_0x40387b){return _0x40387b['destroy']()[_0x4099('0x24')](function(){_0x491924[_0x4099('0x1b')](0xcc)[_0x4099('0x25')]();});}};}function handleEntityNotFound(_0x56a6c0,_0x19c95d){return function(_0x45ab68){if(!_0x45ab68){_0x56a6c0[_0x4099('0x1a')](0x194);}return _0x45ab68;};}function handleError(_0x37c1a6,_0x3d173e){_0x3d173e=_0x3d173e||0x1f4;return function(_0x275000){logger['error'](_0x275000['stack']);if(_0x275000[_0x4099('0x26')]){delete _0x275000[_0x4099('0x26')];}_0x37c1a6['status'](_0x3d173e)['send'](_0x275000);};}exports[_0x4099('0x27')]=function(_0x4ab3ad,_0x28fb0f){var _0x288daf={},_0x9d5ef4={},_0x8f86d1={'count':0x0,'rows':[]};var _0x31fdac=_['map'](db[_0x4099('0x28')]['rawAttributes'],function(_0x335e88){return{'name':_0x335e88[_0x4099('0x29')],'type':_0x335e88[_0x4099('0x2a')][_0x4099('0x2b')]};});_0x9d5ef4[_0x4099('0x2c')]=_[_0x4099('0x2d')](_0x31fdac,_0x4099('0x26'));_0x9d5ef4[_0x4099('0x2e')]=_['keys'](_0x4ab3ad[_0x4099('0x2e')]);_0x9d5ef4[_0x4099('0x2f')]=_[_0x4099('0x30')](_0x9d5ef4['model'],_0x9d5ef4[_0x4099('0x2e')]);_0x288daf[_0x4099('0x31')]=_[_0x4099('0x30')](_0x9d5ef4[_0x4099('0x2c')],qs[_0x4099('0x32')](_0x4ab3ad[_0x4099('0x2e')][_0x4099('0x32')]));_0x288daf[_0x4099('0x31')]=_0x288daf['attributes']['length']?_0x288daf['attributes']:_0x9d5ef4[_0x4099('0x2c')];if(!_0x4ab3ad[_0x4099('0x2e')][_0x4099('0x33')](_0x4099('0x34'))){_0x288daf[_0x4099('0x1f')]=qs[_0x4099('0x1f')](_0x4ab3ad[_0x4099('0x2e')][_0x4099('0x1f')]);_0x288daf['offset']=qs['offset'](_0x4ab3ad[_0x4099('0x2e')]['offset']);}_0x288daf['order']=qs['sort'](_0x4ab3ad['query'][_0x4099('0x35')]);_0x288daf[_0x4099('0x36')]=qs[_0x4099('0x2f')](_[_0x4099('0x37')](_0x4ab3ad[_0x4099('0x2e')],_0x9d5ef4['filters']),_0x31fdac);if(_0x4ab3ad['query']['filter']){_0x288daf[_0x4099('0x36')]=_[_0x4099('0x38')](_0x288daf[_0x4099('0x36')],{'$or':_['map'](_0x31fdac,function(_0x5b5530){if(_0x5b5530[_0x4099('0x2a')]!==_0x4099('0x39')){var _0xc594ad={};_0xc594ad[_0x5b5530[_0x4099('0x26')]]={'$like':'%'+_0x4ab3ad[_0x4099('0x2e')][_0x4099('0x3a')]+'%'};return _0xc594ad;}})});}_0x288daf=_[_0x4099('0x38')]({},_0x288daf,_0x4ab3ad[_0x4099('0x3b')]);var _0x20f682={'where':_0x288daf[_0x4099('0x36')]};return db[_0x4099('0x28')]['count'](_0x20f682)['then'](function(_0x114424){_0x8f86d1['count']=_0x114424;if(_0x4ab3ad[_0x4099('0x2e')][_0x4099('0x3c')]){_0x288daf[_0x4099('0x3d')]=[{'all':!![]}];}return db[_0x4099('0x28')][_0x4099('0x3e')](_0x288daf);})['then'](function(_0x120eaf){_0x8f86d1['rows']=_0x120eaf;return _0x8f86d1;})[_0x4099('0x24')](respondWithFilteredResult(_0x28fb0f,_0x288daf))[_0x4099('0x3f')](handleError(_0x28fb0f,null));};exports[_0x4099('0x40')]=function(_0x586477,_0x23f136){var _0x284c06={'raw':!![],'where':{'id':_0x586477[_0x4099('0x41')]['id']}},_0x29358e={};_0x29358e[_0x4099('0x2c')]=_[_0x4099('0x42')](db[_0x4099('0x28')][_0x4099('0x43')]);_0x29358e['query']=_[_0x4099('0x42')](_0x586477[_0x4099('0x2e')]);_0x29358e['filters']=_[_0x4099('0x30')](_0x29358e[_0x4099('0x2c')],_0x29358e[_0x4099('0x2e')]);_0x284c06[_0x4099('0x31')]=_[_0x4099('0x30')](_0x29358e[_0x4099('0x2c')],qs[_0x4099('0x32')](_0x586477[_0x4099('0x2e')][_0x4099('0x32')]));_0x284c06[_0x4099('0x31')]=_0x284c06[_0x4099('0x31')][_0x4099('0x44')]?_0x284c06[_0x4099('0x31')]:_0x29358e[_0x4099('0x2c')];if(_0x586477[_0x4099('0x2e')][_0x4099('0x3c')]){_0x284c06[_0x4099('0x3d')]=[{'all':!![]}];}_0x284c06=_[_0x4099('0x38')]({},_0x284c06,_0x586477[_0x4099('0x3b')]);return db[_0x4099('0x28')][_0x4099('0x45')](_0x284c06)[_0x4099('0x24')](handleEntityNotFound(_0x23f136,null))['then'](respondWithResult(_0x23f136,null))[_0x4099('0x3f')](handleError(_0x23f136,null));};exports[_0x4099('0x46')]=function(_0x139487,_0x47359c){return db[_0x4099('0x28')][_0x4099('0x46')](_0x139487[_0x4099('0x47')],{})[_0x4099('0x24')](respondWithResult(_0x47359c,0xc9))[_0x4099('0x3f')](handleError(_0x47359c,null));};exports[_0x4099('0x48')]=function(_0x478b30,_0x1b44b1){if(_0x478b30['body']['id']){delete _0x478b30[_0x4099('0x47')]['id'];}return db[_0x4099('0x28')][_0x4099('0x45')]({'where':{'id':_0x478b30[_0x4099('0x41')]['id']}})[_0x4099('0x24')](handleEntityNotFound(_0x1b44b1,null))[_0x4099('0x24')](saveUpdates(_0x478b30[_0x4099('0x47')],null))[_0x4099('0x24')](respondWithResult(_0x1b44b1,null))[_0x4099('0x3f')](handleError(_0x1b44b1,null));};exports[_0x4099('0x49')]=function(_0x25e603,_0x35cce3){return db['OpenchannelTransferReport'][_0x4099('0x45')]({'where':{'id':_0x25e603[_0x4099('0x41')]['id']}})[_0x4099('0x24')](handleEntityNotFound(_0x35cce3,null))['then'](removeEntity(_0x35cce3,null))['catch'](handleError(_0x35cce3,null));};exports[_0x4099('0x4a')]=function(_0x187d00,_0xb5e8c5){return db[_0x4099('0x28')]['describe']()[_0x4099('0x24')](respondWithResult(_0xb5e8c5,null))['catch'](handleError(_0xb5e8c5,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index a448b2e..9b51583 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 _0x4769=['define','OpenchannelTransferReport','uniqueid','lodash','api','moment','bluebird','rimraf','./openchannelTransferReport.attributes','exports'];(function(_0x39628c,_0x2eb8c4){var _0x2b0532=function(_0x87cc3b){while(--_0x87cc3b){_0x39628c['push'](_0x39628c['shift']());}};_0x2b0532(++_0x2eb8c4);}(_0x4769,0x1cf));var _0x9476=function(_0x3322ae,_0x4cba6e){_0x3322ae=_0x3322ae-0x0;var _0x32ff57=_0x4769[_0x3322ae];return _0x32ff57;};'use strict';var _=require(_0x9476('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9476('0x1'));var moment=require(_0x9476('0x2'));var BPromise=require(_0x9476('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9476('0x4'));var config=require('../../config/environment');var attributes=require(_0x9476('0x5'));module[_0x9476('0x6')]=function(_0xe3cc4a,_0x4b3007){return _0xe3cc4a[_0x9476('0x7')](_0x9476('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x9476('0x9'),'fields':[_0x9476('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1d76=['util','../../config/logger','api','bluebird','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','lodash'];(function(_0xf3f0cc,_0x5a6ff3){var _0x30935a=function(_0x180114){while(--_0x180114){_0xf3f0cc['push'](_0xf3f0cc['shift']());}};_0x30935a(++_0x5a6ff3);}(_0x1d76,0x1ac));var _0x61d7=function(_0x264348,_0x50f1f0){_0x264348=_0x264348-0x0;var _0x28c5c0=_0x1d76[_0x264348];return _0x28c5c0;};'use strict';var _=require(_0x61d7('0x0'));var util=require(_0x61d7('0x1'));var logger=require(_0x61d7('0x2'))(_0x61d7('0x3'));var moment=require('moment');var BPromise=require(_0x61d7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x61d7('0x5'));var config=require(_0x61d7('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x61d7('0x7')]=function(_0xf98326,_0x519426){return _0xf98326[_0x61d7('0x8')](_0x61d7('0x9'),attributes,{'tableName':_0x61d7('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 644d6bb..bc7f893 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 _0x9c5a=['http','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x5dbf37,_0x2d14e8){var _0x3e11b4=function(_0x2983a5){while(--_0x2983a5){_0x5dbf37['push'](_0x5dbf37['shift']());}};_0x3e11b4(++_0x2d14e8);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x2ac783,_0xd9ad72){_0x2ac783=_0x2ac783-0x0;var _0x35f174=_0x9c5a[_0x2ac783];return _0x35f174;};'use strict';var _=require(_0xa9c5('0x0'));var util=require(_0xa9c5('0x1'));var moment=require('moment');var BPromise=require(_0xa9c5('0x2'));var rs=require(_0xa9c5('0x3'));var fs=require('fs');var Redis=require(_0xa9c5('0x4'));var db=require(_0xa9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa9c5('0x6'))(_0xa9c5('0x7'));var config=require('../../config/environment');var jayson=require(_0xa9c5('0x8'));var client=jayson['client'][_0xa9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3df556,_0x4cb597,_0x4b6db6){return new BPromise(function(_0x3d6b50,_0x16f331){return client['request'](_0x3df556,_0x4b6db6)[_0xa9c5('0xa')](function(_0x97f9e2){logger['info'](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));logger['debug']('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x4cb597,_0xa9c5('0xc'),JSON[_0xa9c5('0xd')](_0x97f9e2));if(_0x97f9e2[_0xa9c5('0xe')]){if(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0xf')]===0x1f4){logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x16f331(_0x97f9e2[_0xa9c5('0xe')]['message']);}logger[_0xa9c5('0xe')](_0xa9c5('0xb'),_0x4cb597,_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);return _0x3d6b50(_0x97f9e2[_0xa9c5('0xe')][_0xa9c5('0x10')]);}else{logger[_0xa9c5('0x11')](_0xa9c5('0xb'),_0x4cb597,_0xa9c5('0xc'));_0x3d6b50(_0x97f9e2[_0xa9c5('0x12')]['message']);}})[_0xa9c5('0x13')](function(_0xd85c32){logger[_0xa9c5('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4cb597,_0xd85c32);_0x16f331(_0xd85c32);});});} \ No newline at end of file +var _0x0960=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util','bluebird','randomstring'];(function(_0x17fed0,_0x281f6f){var _0x49fb26=function(_0x43e431){while(--_0x43e431){_0x17fed0['push'](_0x17fed0['shift']());}};_0x49fb26(++_0x281f6f);}(_0x0960,0xc2));var _0x0096=function(_0x1ac6b3,_0x5cb1a5){_0x1ac6b3=_0x1ac6b3-0x0;var _0x5cd39a=_0x0960[_0x1ac6b3];return _0x5cd39a;};'use strict';var _=require(_0x0096('0x0'));var util=require(_0x0096('0x1'));var moment=require('moment');var BPromise=require(_0x0096('0x2'));var rs=require(_0x0096('0x3'));var fs=require('fs');var Redis=require(_0x0096('0x4'));var db=require(_0x0096('0x5'))['db'];var utils=require(_0x0096('0x6'));var logger=require(_0x0096('0x7'))(_0x0096('0x8'));var config=require(_0x0096('0x9'));var jayson=require(_0x0096('0xa'));var client=jayson[_0x0096('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81cc41,_0x57390a,_0x1d35f1){return new BPromise(function(_0x44e168,_0x407f3a){return client['request'](_0x81cc41,_0x1d35f1)[_0x0096('0xc')](function(_0x3e97ce){logger[_0x0096('0xd')](_0x0096('0xe'),_0x57390a,'request\x20sent');logger[_0x0096('0xf')](_0x0096('0x10'),_0x57390a,'request\x20sent',JSON[_0x0096('0x11')](_0x3e97ce));if(_0x3e97ce['error']){if(_0x3e97ce[_0x0096('0x12')]['code']===0x1f4){logger[_0x0096('0x12')](_0x0096('0xe'),_0x57390a,_0x3e97ce['error'][_0x0096('0x13')]);return _0x407f3a(_0x3e97ce[_0x0096('0x12')]['message']);}logger['error'](_0x0096('0xe'),_0x57390a,_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);return _0x44e168(_0x3e97ce[_0x0096('0x12')][_0x0096('0x13')]);}else{logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x57390a,_0x0096('0x14'));_0x44e168(_0x3e97ce['result']['message']);}})[_0x0096('0x15')](function(_0x37f0e4){logger['error'](_0x0096('0xe'),_0x57390a,_0x37f0e4);_0x407f3a(_0x37f0e4);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1b58b76..aa5b288 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 _0xd189=['index','show','post','create','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated'];(function(_0x4cf76f,_0x4e3488){var _0x387bb5=function(_0x5f5870){while(--_0x5f5870){_0x4cf76f['push'](_0x4cf76f['shift']());}};_0x387bb5(++_0x4e3488);}(_0xd189,0x9f));var _0x9d18=function(_0x15e7fc,_0x19803a){_0x15e7fc=_0x15e7fc-0x0;var _0x41a22f=_0xd189[_0x15e7fc];return _0x41a22f;};'use strict';var multer=require(_0x9d18('0x0'));var util=require(_0x9d18('0x1'));var path=require(_0x9d18('0x2'));var timeout=require(_0x9d18('0x3'));var express=require(_0x9d18('0x4'));var router=express[_0x9d18('0x5')]();var fs_extra=require(_0x9d18('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x9d18('0x7'));var config=require(_0x9d18('0x8'));var controller=require(_0x9d18('0x9'));router[_0x9d18('0xa')]('/',auth[_0x9d18('0xb')](),controller[_0x9d18('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x9d18('0xd')]);router[_0x9d18('0xe')]('/',auth[_0x9d18('0xb')](),controller[_0x9d18('0xf')]);router['put'](_0x9d18('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x9d18('0x11')]('/:id',auth[_0x9d18('0xb')](),controller['destroy']);module[_0x9d18('0x12')]=router; \ No newline at end of file +var _0x05b1=['isAuthenticated','index','/:id','show','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./pause.controller','get'];(function(_0x4fb696,_0x303c52){var _0x9c9030=function(_0x5d43af){while(--_0x5d43af){_0x4fb696['push'](_0x4fb696['shift']());}};_0x9c9030(++_0x303c52);}(_0x05b1,0xf7));var _0x105b=function(_0x2dc83b,_0x3115da){_0x2dc83b=_0x2dc83b-0x0;var _0x309c47=_0x05b1[_0x2dc83b];return _0x309c47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x105b('0x0'));var timeout=require(_0x105b('0x1'));var express=require('express');var router=express[_0x105b('0x2')]();var fs_extra=require(_0x105b('0x3'));var auth=require(_0x105b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x105b('0x5'));var controller=require(_0x105b('0x6'));router[_0x105b('0x7')]('/',auth[_0x105b('0x8')](),controller[_0x105b('0x9')]);router[_0x105b('0x7')](_0x105b('0xa'),auth[_0x105b('0x8')](),controller[_0x105b('0xb')]);router['post']('/',auth[_0x105b('0x8')](),controller['create']);router[_0x105b('0xc')]('/:id',auth[_0x105b('0x8')](),controller[_0x105b('0xd')]);router[_0x105b('0xe')](_0x105b('0xa'),auth[_0x105b('0x8')](),controller[_0x105b('0xf')]);module[_0x105b('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 92b7542..20fb126 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 _0x9eb4=['STRING'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x9eb4,0xe2));var _0x49eb=function(_0x2095ed,_0x156cfb){_0x2095ed=_0x2095ed-0x0;var _0x22dbb0=_0x9eb4[_0x2095ed];return _0x22dbb0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x49eb('0x0')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd574=['name','exports','STRING'];(function(_0xf0af3,_0x2f51df){var _0x5b4a18=function(_0x1aaeba){while(--_0x1aaeba){_0xf0af3['push'](_0xf0af3['shift']());}};_0x5b4a18(++_0x2f51df);}(_0xd574,0x1ba));var _0x4d57=function(_0x5c52e2,_0x4ee13e){_0x5c52e2=_0x5c52e2-0x0;var _0x1dc903=_0xd574[_0x5c52e2];return _0x1dc903;};'use strict';var Sequelize=require('sequelize');module[_0x4d57('0x0')]={'name':{'type':Sequelize[_0x4d57('0x1')],'unique':_0x4d57('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index b1fc044..0bdc062 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 _0x5cab=['../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','map','VIRTUAL','merge','options','Pause','includeAll','findAll','rows','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','update','body','params','eml-format','rimraf','fast-json-patch','request-promise','util','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x53e149,_0x2e5dff){var _0x16a2c5=function(_0x5cdab2){while(--_0x5cdab2){_0x53e149['push'](_0x53e149['shift']());}};_0x16a2c5(++_0x2e5dff);}(_0x5cab,0x1c0));var _0xb5ca=function(_0x3bb76f,_0x2ed0bd){_0x3bb76f=_0x3bb76f-0x0;var _0x39d289=_0x5cab[_0x3bb76f];return _0x39d289;};'use strict';var emlformat=require(_0xb5ca('0x0'));var rimraf=require(_0xb5ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5ca('0x2'));var rp=require(_0xb5ca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb5ca('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb5ca('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb5ca('0x6'));var _=require(_0xb5ca('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb5ca('0x8'));var deskjs=require(_0xb5ca('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb5ca('0xa'));var Papa=require(_0xb5ca('0xb'));var Redis=require(_0xb5ca('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xb5ca('0xd'));var as=require(_0xb5ca('0xe'));var hardwareService=require(_0xb5ca('0xf'));var logger=require(_0xb5ca('0x10'))('api');var utils=require(_0xb5ca('0x11'));var config=require(_0xb5ca('0x12'));var licenseUtil=require(_0xb5ca('0x13'));var db=require(_0xb5ca('0x14'))['db'];function respondWithStatusCode(_0x1e06c6,_0x37d085){_0x37d085=_0x37d085||0xcc;return function(_0x3db006){if(_0x3db006){return _0x1e06c6[_0xb5ca('0x15')](_0x37d085);}return _0x1e06c6[_0xb5ca('0x16')](_0x37d085)[_0xb5ca('0x17')]();};}function respondWithResult(_0x5496b4,_0x5c993a){_0x5c993a=_0x5c993a||0xc8;return function(_0x57d27){if(_0x57d27){return _0x5496b4['status'](_0x5c993a)['json'](_0x57d27);}};}function respondWithFilteredResult(_0x257a71,_0x285c3f){return function(_0x36fa1e){if(_0x36fa1e){var _0x2240a5=typeof _0x285c3f['offset']===_0xb5ca('0x18')&&typeof _0x285c3f[_0xb5ca('0x19')]===_0xb5ca('0x18');var _0x8a1921=_0x36fa1e[_0xb5ca('0x1a')];var _0x3becfd=_0x2240a5?0x0:_0x285c3f['offset'];var _0x451512=_0x2240a5?_0x36fa1e[_0xb5ca('0x1a')]:_0x285c3f[_0xb5ca('0x1b')]+_0x285c3f[_0xb5ca('0x19')];var _0x4db633;if(_0x451512>=_0x8a1921){_0x451512=_0x8a1921;_0x4db633=0xc8;}else{_0x4db633=0xce;}_0x257a71[_0xb5ca('0x16')](_0x4db633);return _0x257a71[_0xb5ca('0x1c')](_0xb5ca('0x1d'),_0x3becfd+'-'+_0x451512+'/'+_0x8a1921)[_0xb5ca('0x1e')](_0x36fa1e);}return null;};}function patchUpdates(_0x8cd7ad){return function(_0x2c69e1){try{jsonpatch[_0xb5ca('0x1f')](_0x2c69e1,_0x8cd7ad,!![]);}catch(_0x41d9b2){return BPromise['reject'](_0x41d9b2);}return _0x2c69e1['save']();};}function saveUpdates(_0x5e6dac,_0x44b91a){return function(_0x484a53){if(_0x484a53){return _0x484a53['update'](_0x5e6dac)[_0xb5ca('0x20')](function(_0x3e0bfa){return _0x3e0bfa;});}return null;};}function removeEntity(_0x55846a,_0x5f12d1){return function(_0x15eaf7){if(_0x15eaf7){return _0x15eaf7[_0xb5ca('0x21')]()[_0xb5ca('0x20')](function(){var _0x1cddc3=_0x15eaf7[_0xb5ca('0x22')]({'plain':!![]});var _0x47211f=_0xb5ca('0x23');return db[_0xb5ca('0x24')][_0xb5ca('0x21')]({'where':{'type':_0x47211f,'resourceId':_0x1cddc3['id']}})[_0xb5ca('0x20')](function(){return _0x15eaf7;});})[_0xb5ca('0x20')](function(){_0x55846a[_0xb5ca('0x16')](0xcc)[_0xb5ca('0x17')]();});}};}function handleEntityNotFound(_0x472cba,_0x4a7539){return function(_0x4ac60b){if(!_0x4ac60b){_0x472cba[_0xb5ca('0x15')](0x194);}return _0x4ac60b;};}function handleError(_0x2d7a1b,_0x5d34ba){_0x5d34ba=_0x5d34ba||0x1f4;return function(_0x513cd1){logger[_0xb5ca('0x25')](_0x513cd1[_0xb5ca('0x26')]);if(_0x513cd1[_0xb5ca('0x27')]){delete _0x513cd1[_0xb5ca('0x27')];}_0x2d7a1b[_0xb5ca('0x16')](_0x5d34ba)[_0xb5ca('0x28')](_0x513cd1);};}exports[_0xb5ca('0x29')]=function(_0x45fb89,_0x207534){var _0xd1bb03={},_0x522f68={},_0x3b70bf={'count':0x0,'rows':[]};var _0x408980=_['map'](db['Pause'][_0xb5ca('0x2a')],function(_0x297da6){return{'name':_0x297da6[_0xb5ca('0x2b')],'type':_0x297da6[_0xb5ca('0x2c')][_0xb5ca('0x2d')]};});_0x522f68[_0xb5ca('0x2e')]=_['map'](_0x408980,_0xb5ca('0x27'));_0x522f68[_0xb5ca('0x2f')]=_[_0xb5ca('0x30')](_0x45fb89['query']);_0x522f68['filters']=_['intersection'](_0x522f68[_0xb5ca('0x2e')],_0x522f68[_0xb5ca('0x2f')]);_0xd1bb03[_0xb5ca('0x31')]=_[_0xb5ca('0x32')](_0x522f68['model'],qs['fields'](_0x45fb89['query'][_0xb5ca('0x33')]));_0xd1bb03[_0xb5ca('0x31')]=_0xd1bb03[_0xb5ca('0x31')][_0xb5ca('0x34')]?_0xd1bb03[_0xb5ca('0x31')]:_0x522f68[_0xb5ca('0x2e')];if(!_0x45fb89[_0xb5ca('0x2f')]['hasOwnProperty'](_0xb5ca('0x35'))){_0xd1bb03[_0xb5ca('0x19')]=qs[_0xb5ca('0x19')](_0x45fb89['query'][_0xb5ca('0x19')]);_0xd1bb03['offset']=qs['offset'](_0x45fb89[_0xb5ca('0x2f')]['offset']);}_0xd1bb03['order']=qs['sort'](_0x45fb89[_0xb5ca('0x2f')][_0xb5ca('0x36')]);_0xd1bb03[_0xb5ca('0x37')]=qs['filters'](_[_0xb5ca('0x38')](_0x45fb89[_0xb5ca('0x2f')],_0x522f68[_0xb5ca('0x39')]),_0x408980);if(_0x45fb89[_0xb5ca('0x2f')]['filter']){_0xd1bb03[_0xb5ca('0x37')]=_['merge'](_0xd1bb03[_0xb5ca('0x37')],{'$or':_[_0xb5ca('0x3a')](_0x408980,function(_0x2423a4){if(_0x2423a4[_0xb5ca('0x2c')]!==_0xb5ca('0x3b')){var _0x17a533={};_0x17a533[_0x2423a4[_0xb5ca('0x27')]]={'$like':'%'+_0x45fb89[_0xb5ca('0x2f')]['filter']+'%'};return _0x17a533;}})});}_0xd1bb03=_[_0xb5ca('0x3c')]({},_0xd1bb03,_0x45fb89[_0xb5ca('0x3d')]);var _0x231c63={'where':_0xd1bb03[_0xb5ca('0x37')]};return db[_0xb5ca('0x3e')][_0xb5ca('0x1a')](_0x231c63)[_0xb5ca('0x20')](function(_0x41859d){_0x3b70bf[_0xb5ca('0x1a')]=_0x41859d;if(_0x45fb89['query'][_0xb5ca('0x3f')]){_0xd1bb03['include']=[{'all':!![]}];}return db[_0xb5ca('0x3e')][_0xb5ca('0x40')](_0xd1bb03);})['then'](function(_0x13eba3){_0x3b70bf[_0xb5ca('0x41')]=_0x13eba3;return _0x3b70bf;})['then'](respondWithFilteredResult(_0x207534,_0xd1bb03))[_0xb5ca('0x42')](handleError(_0x207534,null));};exports[_0xb5ca('0x43')]=function(_0x23fa83,_0x2f5220){var _0x9fe260={'raw':!![],'where':{'id':_0x23fa83['params']['id']}},_0x1781a0={};_0x1781a0[_0xb5ca('0x2e')]=_[_0xb5ca('0x30')](db[_0xb5ca('0x3e')][_0xb5ca('0x2a')]);_0x1781a0[_0xb5ca('0x2f')]=_[_0xb5ca('0x30')](_0x23fa83['query']);_0x1781a0[_0xb5ca('0x39')]=_[_0xb5ca('0x32')](_0x1781a0[_0xb5ca('0x2e')],_0x1781a0['query']);_0x9fe260['attributes']=_[_0xb5ca('0x32')](_0x1781a0[_0xb5ca('0x2e')],qs[_0xb5ca('0x33')](_0x23fa83[_0xb5ca('0x2f')][_0xb5ca('0x33')]));_0x9fe260['attributes']=_0x9fe260[_0xb5ca('0x31')][_0xb5ca('0x34')]?_0x9fe260[_0xb5ca('0x31')]:_0x1781a0[_0xb5ca('0x2e')];if(_0x23fa83[_0xb5ca('0x2f')][_0xb5ca('0x3f')]){_0x9fe260[_0xb5ca('0x44')]=[{'all':!![]}];}_0x9fe260=_['merge']({},_0x9fe260,_0x23fa83['options']);return db[_0xb5ca('0x3e')][_0xb5ca('0x45')](_0x9fe260)['then'](handleEntityNotFound(_0x2f5220,null))[_0xb5ca('0x20')](respondWithResult(_0x2f5220,null))[_0xb5ca('0x42')](handleError(_0x2f5220,null));};exports[_0xb5ca('0x46')]=function(_0x467a4d,_0x3d6765){return db['Pause'][_0xb5ca('0x46')](_0x467a4d['body'],{})[_0xb5ca('0x20')](function(_0x411b5d){var _0x1f1374=_0x467a4d[_0xb5ca('0x47')][_0xb5ca('0x22')]({'plain':!![]});if(!_0x1f1374)throw new Error(_0xb5ca('0x48'));if(_0x1f1374['role']==='user'){var _0x4bf81c=_0x411b5d[_0xb5ca('0x22')]({'plain':!![]});var _0x1b27fd=_0xb5ca('0x23');return db[_0xb5ca('0x49')]['find']({'where':{'name':_0x1b27fd,'userProfileId':_0x1f1374[_0xb5ca('0x4a')]},'raw':!![]})[_0xb5ca('0x20')](function(_0x27edef){if(_0x27edef&&_0x27edef['autoAssociation']===0x0){return db['UserProfileResource'][_0xb5ca('0x46')]({'name':_0x4bf81c[_0xb5ca('0x27')],'resourceId':_0x4bf81c['id'],'type':_0x27edef[_0xb5ca('0x27')],'sectionId':_0x27edef['id']},{})[_0xb5ca('0x20')](function(){return _0x411b5d;});}else{return _0x411b5d;}})[_0xb5ca('0x42')](function(_0x23dd71){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23dd71);throw _0x23dd71;});}return _0x411b5d;})[_0xb5ca('0x20')](respondWithResult(_0x3d6765,0xc9))[_0xb5ca('0x42')](handleError(_0x3d6765,null));};exports[_0xb5ca('0x4b')]=function(_0x21834b,_0x5a28ff){if(_0x21834b[_0xb5ca('0x4c')]['id']){delete _0x21834b[_0xb5ca('0x4c')]['id'];}return db['Pause']['find']({'where':{'id':_0x21834b[_0xb5ca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5a28ff,null))[_0xb5ca('0x20')](saveUpdates(_0x21834b[_0xb5ca('0x4c')],null))[_0xb5ca('0x20')](respondWithResult(_0x5a28ff,null))['catch'](handleError(_0x5a28ff,null));};exports[_0xb5ca('0x21')]=function(_0x52457a,_0x1f71f2){return db['Pause']['find']({'where':{'id':_0x52457a[_0xb5ca('0x4d')]['id']}})[_0xb5ca('0x20')](handleEntityNotFound(_0x1f71f2,null))[_0xb5ca('0x20')](removeEntity(_0x1f71f2,null))['catch'](handleError(_0x1f71f2,null));}; \ No newline at end of file +var _0x3862=['includeAll','include','findAll','catch','show','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','type','key','name','query','keys','filters','model','attributes','intersection','fields','length','sort','where','pick','merge','VIRTUAL','filter','Pause'];(function(_0x2415ab,_0x53b507){var _0x52a230=function(_0x1357c2){while(--_0x1357c2){_0x2415ab['push'](_0x2415ab['shift']());}};_0x52a230(++_0x53b507);}(_0x3862,0x1a9));var _0x2386=function(_0x301064,_0x1985aa){_0x301064=_0x301064-0x0;var _0x5bc841=_0x3862[_0x301064];return _0x5bc841;};'use strict';var emlformat=require(_0x2386('0x0'));var rimraf=require(_0x2386('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2386('0x2'));var rp=require(_0x2386('0x3'));var moment=require(_0x2386('0x4'));var BPromise=require(_0x2386('0x5'));var Mustache=require(_0x2386('0x6'));var util=require('util');var path=require(_0x2386('0x7'));var sox=require('sox');var csv=require(_0x2386('0x8'));var ejs=require(_0x2386('0x9'));var fs=require('fs');var fs_extra=require(_0x2386('0xa'));var _=require(_0x2386('0xb'));var squel=require(_0x2386('0xc'));var crypto=require(_0x2386('0xd'));var jsforce=require(_0x2386('0xe'));var deskjs=require(_0x2386('0xf'));var toCsv=require(_0x2386('0x8'));var querystring=require('querystring');var Papa=require(_0x2386('0x10'));var Redis=require(_0x2386('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2386('0x12'));var as=require(_0x2386('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x2386('0x14'));var config=require(_0x2386('0x15'));var licenseUtil=require(_0x2386('0x16'));var db=require(_0x2386('0x17'))['db'];function respondWithStatusCode(_0x3ab34a,_0x336d30){_0x336d30=_0x336d30||0xcc;return function(_0x2fd692){if(_0x2fd692){return _0x3ab34a[_0x2386('0x18')](_0x336d30);}return _0x3ab34a[_0x2386('0x19')](_0x336d30)[_0x2386('0x1a')]();};}function respondWithResult(_0x2d77c5,_0x46e578){_0x46e578=_0x46e578||0xc8;return function(_0x5f16e0){if(_0x5f16e0){return _0x2d77c5[_0x2386('0x19')](_0x46e578)[_0x2386('0x1b')](_0x5f16e0);}};}function respondWithFilteredResult(_0x57226a,_0x2ae4a3){return function(_0x449139){if(_0x449139){var _0x16e529=typeof _0x2ae4a3['offset']===_0x2386('0x1c')&&typeof _0x2ae4a3[_0x2386('0x1d')]===_0x2386('0x1c');var _0xa86f5d=_0x449139['count'];var _0x3b8f48=_0x16e529?0x0:_0x2ae4a3[_0x2386('0x1e')];var _0x1edb0d=_0x16e529?_0x449139[_0x2386('0x1f')]:_0x2ae4a3[_0x2386('0x1e')]+_0x2ae4a3[_0x2386('0x1d')];var _0x36e120;if(_0x1edb0d>=_0xa86f5d){_0x1edb0d=_0xa86f5d;_0x36e120=0xc8;}else{_0x36e120=0xce;}_0x57226a[_0x2386('0x19')](_0x36e120);return _0x57226a[_0x2386('0x20')](_0x2386('0x21'),_0x3b8f48+'-'+_0x1edb0d+'/'+_0xa86f5d)[_0x2386('0x1b')](_0x449139);}return null;};}function patchUpdates(_0x1e11a2){return function(_0x26e376){try{jsonpatch[_0x2386('0x22')](_0x26e376,_0x1e11a2,!![]);}catch(_0x42bace){return BPromise['reject'](_0x42bace);}return _0x26e376[_0x2386('0x23')]();};}function saveUpdates(_0x50c4b9,_0x3d916e){return function(_0x51a8b4){if(_0x51a8b4){return _0x51a8b4[_0x2386('0x24')](_0x50c4b9)[_0x2386('0x25')](function(_0x3b68e2){return _0x3b68e2;});}return null;};}function removeEntity(_0x38c990,_0x31d4b6){return function(_0x164073){if(_0x164073){return _0x164073[_0x2386('0x26')]()[_0x2386('0x25')](function(){var _0x123648=_0x164073[_0x2386('0x27')]({'plain':!![]});var _0x5a2c6c=_0x2386('0x28');return db[_0x2386('0x29')]['destroy']({'where':{'type':_0x5a2c6c,'resourceId':_0x123648['id']}})['then'](function(){return _0x164073;});})[_0x2386('0x25')](function(){_0x38c990[_0x2386('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c5a69,_0x156cd4){return function(_0x2806eb){if(!_0x2806eb){_0x1c5a69[_0x2386('0x18')](0x194);}return _0x2806eb;};}function handleError(_0x5a2606,_0x3f541b){_0x3f541b=_0x3f541b||0x1f4;return function(_0x213d6b){logger[_0x2386('0x2a')](_0x213d6b[_0x2386('0x2b')]);if(_0x213d6b['name']){delete _0x213d6b['name'];}_0x5a2606[_0x2386('0x19')](_0x3f541b)[_0x2386('0x2c')](_0x213d6b);};}exports[_0x2386('0x2d')]=function(_0x428c1e,_0x3e408f){var _0x3c3e47={},_0x177240={},_0x1fb787={'count':0x0,'rows':[]};var _0x1a875b=_[_0x2386('0x2e')](db['Pause'][_0x2386('0x2f')],function(_0x5807ad){return{'name':_0x5807ad[_0x2386('0x30')],'type':_0x5807ad[_0x2386('0x31')][_0x2386('0x32')]};});_0x177240['model']=_['map'](_0x1a875b,_0x2386('0x33'));_0x177240[_0x2386('0x34')]=_[_0x2386('0x35')](_0x428c1e['query']);_0x177240[_0x2386('0x36')]=_['intersection'](_0x177240[_0x2386('0x37')],_0x177240[_0x2386('0x34')]);_0x3c3e47[_0x2386('0x38')]=_[_0x2386('0x39')](_0x177240['model'],qs[_0x2386('0x3a')](_0x428c1e[_0x2386('0x34')]['fields']));_0x3c3e47['attributes']=_0x3c3e47[_0x2386('0x38')][_0x2386('0x3b')]?_0x3c3e47[_0x2386('0x38')]:_0x177240[_0x2386('0x37')];if(!_0x428c1e[_0x2386('0x34')]['hasOwnProperty']('nolimit')){_0x3c3e47[_0x2386('0x1d')]=qs[_0x2386('0x1d')](_0x428c1e[_0x2386('0x34')]['limit']);_0x3c3e47[_0x2386('0x1e')]=qs['offset'](_0x428c1e[_0x2386('0x34')][_0x2386('0x1e')]);}_0x3c3e47['order']=qs[_0x2386('0x3c')](_0x428c1e[_0x2386('0x34')][_0x2386('0x3c')]);_0x3c3e47[_0x2386('0x3d')]=qs[_0x2386('0x36')](_[_0x2386('0x3e')](_0x428c1e['query'],_0x177240['filters']),_0x1a875b);if(_0x428c1e[_0x2386('0x34')]['filter']){_0x3c3e47[_0x2386('0x3d')]=_[_0x2386('0x3f')](_0x3c3e47[_0x2386('0x3d')],{'$or':_[_0x2386('0x2e')](_0x1a875b,function(_0x59c591){if(_0x59c591[_0x2386('0x31')]!==_0x2386('0x40')){var _0x33ab9c={};_0x33ab9c[_0x59c591[_0x2386('0x33')]]={'$like':'%'+_0x428c1e[_0x2386('0x34')][_0x2386('0x41')]+'%'};return _0x33ab9c;}})});}_0x3c3e47=_['merge']({},_0x3c3e47,_0x428c1e['options']);var _0x50d89f={'where':_0x3c3e47[_0x2386('0x3d')]};return db[_0x2386('0x42')][_0x2386('0x1f')](_0x50d89f)[_0x2386('0x25')](function(_0x4e4f2b){_0x1fb787['count']=_0x4e4f2b;if(_0x428c1e[_0x2386('0x34')][_0x2386('0x43')]){_0x3c3e47[_0x2386('0x44')]=[{'all':!![]}];}return db[_0x2386('0x42')][_0x2386('0x45')](_0x3c3e47);})[_0x2386('0x25')](function(_0x309844){_0x1fb787['rows']=_0x309844;return _0x1fb787;})[_0x2386('0x25')](respondWithFilteredResult(_0x3e408f,_0x3c3e47))[_0x2386('0x46')](handleError(_0x3e408f,null));};exports[_0x2386('0x47')]=function(_0x5b41ab,_0x3f840f){var _0x44717b={'raw':!![],'where':{'id':_0x5b41ab['params']['id']}},_0x2fe2a5={};_0x2fe2a5[_0x2386('0x37')]=_['keys'](db[_0x2386('0x42')][_0x2386('0x2f')]);_0x2fe2a5['query']=_['keys'](_0x5b41ab[_0x2386('0x34')]);_0x2fe2a5[_0x2386('0x36')]=_[_0x2386('0x39')](_0x2fe2a5['model'],_0x2fe2a5[_0x2386('0x34')]);_0x44717b[_0x2386('0x38')]=_[_0x2386('0x39')](_0x2fe2a5['model'],qs[_0x2386('0x3a')](_0x5b41ab[_0x2386('0x34')][_0x2386('0x3a')]));_0x44717b[_0x2386('0x38')]=_0x44717b[_0x2386('0x38')]['length']?_0x44717b['attributes']:_0x2fe2a5[_0x2386('0x37')];if(_0x5b41ab['query'][_0x2386('0x43')]){_0x44717b['include']=[{'all':!![]}];}_0x44717b=_['merge']({},_0x44717b,_0x5b41ab['options']);return db[_0x2386('0x42')][_0x2386('0x48')](_0x44717b)[_0x2386('0x25')](handleEntityNotFound(_0x3f840f,null))[_0x2386('0x25')](respondWithResult(_0x3f840f,null))[_0x2386('0x46')](handleError(_0x3f840f,null));};exports[_0x2386('0x49')]=function(_0x3e115e,_0x43efce){return db[_0x2386('0x42')][_0x2386('0x49')](_0x3e115e[_0x2386('0x4a')],{})[_0x2386('0x25')](function(_0x165609){var _0x2b0ceb=_0x3e115e[_0x2386('0x4b')][_0x2386('0x27')]({'plain':!![]});if(!_0x2b0ceb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b0ceb[_0x2386('0x4c')]===_0x2386('0x4b')){var _0x4f3b0a=_0x165609[_0x2386('0x27')]({'plain':!![]});var _0x23bc18='Pauses';return db[_0x2386('0x4d')]['find']({'where':{'name':_0x23bc18,'userProfileId':_0x2b0ceb[_0x2386('0x4e')]},'raw':!![]})[_0x2386('0x25')](function(_0x2e674){if(_0x2e674&&_0x2e674[_0x2386('0x4f')]===0x0){return db[_0x2386('0x29')][_0x2386('0x49')]({'name':_0x4f3b0a['name'],'resourceId':_0x4f3b0a['id'],'type':_0x2e674['name'],'sectionId':_0x2e674['id']},{})[_0x2386('0x25')](function(){return _0x165609;});}else{return _0x165609;}})[_0x2386('0x46')](function(_0x58a575){logger[_0x2386('0x2a')](_0x2386('0x50'),_0x58a575);throw _0x58a575;});}return _0x165609;})[_0x2386('0x25')](respondWithResult(_0x43efce,0xc9))[_0x2386('0x46')](handleError(_0x43efce,null));};exports[_0x2386('0x24')]=function(_0x319339,_0x1efb7b){if(_0x319339[_0x2386('0x4a')]['id']){delete _0x319339[_0x2386('0x4a')]['id'];}return db[_0x2386('0x42')]['find']({'where':{'id':_0x319339['params']['id']}})[_0x2386('0x25')](handleEntityNotFound(_0x1efb7b,null))[_0x2386('0x25')](saveUpdates(_0x319339[_0x2386('0x4a')],null))[_0x2386('0x25')](respondWithResult(_0x1efb7b,null))[_0x2386('0x46')](handleError(_0x1efb7b,null));};exports['destroy']=function(_0x567c31,_0x3ae504){return db['Pause'][_0x2386('0x48')]({'where':{'id':_0x567c31[_0x2386('0x51')]['id']}})[_0x2386('0x25')](handleEntityNotFound(_0x3ae504,null))['then'](removeEntity(_0x3ae504,null))[_0x2386('0x46')](handleError(_0x3ae504,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index c96884e..f21cd05 100644 --- a/server/api/pause/pause.model.js +++ b/server/api/pause/pause.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x17c385,_0x5ddde2){var _0x6c9ae0=function(_0x118b56){while(--_0x118b56){_0x17c385['push'](_0x17c385['shift']());}};_0x6c9ae0(++_0x5ddde2);}(_0x53ec,0x192));var _0xc53e=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x53ec[_0x4f9b18];return _0x29f20c;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x4706ce,_0x32bd69){var _0x2d840c=function(_0x348a5a){while(--_0x348a5a){_0x4706ce['push'](_0x4706ce['shift']());}};_0x2d840c(++_0x32bd69);}(_0x1cb9,0x14e));var _0x91cb=function(_0x58b460,_0x357706){_0x58b460=_0x58b460-0x0;var _0x4ec8d1=_0x1cb9[_0x58b460];return _0x4ec8d1;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 0207ebb..d012618 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 _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(_0x2db54e,_0x20c401){var _0x53a5f=function(_0x1ea853){while(--_0x1ea853){_0x2db54e['push'](_0x2db54e['shift']());}};_0x53a5f(++_0x20c401);}(_0xb10b,0x12a));var _0xbb10=function(_0x19f20a,_0x49fa82){_0x19f20a=_0x19f20a-0x0;var _0x436896=_0xb10b[_0x19f20a];return _0x436896;};'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 +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(_0x3e7524,_0x536d9f){var _0x16c498=function(_0x400417){while(--_0x400417){_0x3e7524['push'](_0x3e7524['shift']());}};_0x16c498(++_0x536d9f);}(_0x7a54,0x106));var _0x47a5=function(_0x51fcaa,_0x36bc53){_0x51fcaa=_0x51fcaa-0x0;var _0x511351=_0x7a54[_0x51fcaa];return _0x511351;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index cfe0e3b..5d1add0 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 _0xf873=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','extname','now','post','file','upload','webhookPost'];(function(_0x4f9ece,_0x1d4867){var _0x1697b9=function(_0x66aea7){while(--_0x66aea7){_0x4f9ece['push'](_0x4f9ece['shift']());}};_0x1697b9(++_0x1d4867);}(_0xf873,0xb2));var _0x3f87=function(_0xbd4392,_0x46e3a5){_0xbd4392=_0xbd4392-0x0;var _0x54253b=_0xf873[_0xbd4392];return _0x54253b;};'use strict';var multer=require('multer');var util=require(_0x3f87('0x0'));var path=require(_0x3f87('0x1'));var timeout=require(_0x3f87('0x2'));var express=require(_0x3f87('0x3'));var router=express[_0x3f87('0x4')]();var fs_extra=require(_0x3f87('0x5'));var auth=require(_0x3f87('0x6'));var interaction=require(_0x3f87('0x7'));var config=require(_0x3f87('0x8'));var controller=require('./plugin.controller');router[_0x3f87('0x9')]('/',auth[_0x3f87('0xa')](),controller[_0x3f87('0xb')]);router['get'](_0x3f87('0xc'),controller[_0x3f87('0xd')]);router[_0x3f87('0x9')](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0xf')]);router['get'](_0x3f87('0x10'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x11')]);var upload=multer({'storage':multer[_0x3f87('0x12')]({'destination':function(_0x1ad2a9,_0xd41ca0,_0x2aa592){_0x2aa592(null,path[_0x3f87('0x13')](config[_0x3f87('0x14')],_0x3f87('0x15')));},'filename':function(_0x42fde8,_0x593e9,_0xfd5b65){_0x593e9[_0x3f87('0x16')]=_0x593e9['originalname'][_0x3f87('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xfd5b65(null,util[_0x3f87('0x18')]('%s-%s%s',path[_0x3f87('0x19')](_0x593e9[_0x3f87('0x16')],path[_0x3f87('0x1a')](_0x593e9[_0x3f87('0x16')])),Date[_0x3f87('0x1b')](),path[_0x3f87('0x1a')](_0x593e9[_0x3f87('0x16')])));}})});router[_0x3f87('0x1c')]('/',upload['single'](_0x3f87('0x1d')),controller[_0x3f87('0x1e')]);router[_0x3f87('0x1c')]('/webhook',controller[_0x3f87('0x1f')]);router['put'](_0x3f87('0xe'),auth[_0x3f87('0xa')](),controller[_0x3f87('0x20')]);router[_0x3f87('0x21')](_0x3f87('0xe'),auth['isAuthenticated'](),controller[_0x3f87('0x21')]);module[_0x3f87('0x22')]=router; \ No newline at end of file +var _0x032e=['show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id'];(function(_0x24274a,_0x21a7d7){var _0x5cc0b3=function(_0x5197de){while(--_0x5197de){_0x24274a['push'](_0x24274a['shift']());}};_0x5cc0b3(++_0x21a7d7);}(_0x032e,0x124));var _0xe032=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x032e[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')]('/',auth[_0xe032('0x9')](),controller[_0xe032('0xa')]);router[_0xe032('0x8')](_0xe032('0xb'),controller[_0xe032('0xc')]);router[_0xe032('0x8')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0xe')]);router[_0xe032('0x8')](_0xe032('0xf'),auth[_0xe032('0x9')](),controller['download']);var upload=multer({'storage':multer[_0xe032('0x10')]({'destination':function(_0x1ce2ae,_0x13c126,_0x42e2ba){_0x42e2ba(null,path[_0xe032('0x11')](config[_0xe032('0x12')],_0xe032('0x13')));},'filename':function(_0x5bcb5b,_0x646979,_0x266d71){_0x646979[_0xe032('0x14')]=_0x646979[_0xe032('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x266d71(null,util[_0xe032('0x15')](_0xe032('0x16'),path[_0xe032('0x17')](_0x646979[_0xe032('0x14')],path[_0xe032('0x18')](_0x646979[_0xe032('0x14')])),Date[_0xe032('0x19')](),path['extname'](_0x646979[_0xe032('0x14')])));}})});router[_0xe032('0x1a')]('/',upload[_0xe032('0x1b')](_0xe032('0x1c')),controller[_0xe032('0x1d')]);router[_0xe032('0x1a')]('/webhook',controller[_0xe032('0x1e')]);router[_0xe032('0x1f')](_0xe032('0xd'),auth[_0xe032('0x9')](),controller[_0xe032('0x20')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe032('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index f1c7400..f2dd03f 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 _0xfd2e=['The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','STRING','sequelize','exports','ENUM','html','script','TEXT'];(function(_0x2ed14b,_0x2f6473){var _0x1bbde8=function(_0x2618b1){while(--_0x2618b1){_0x2ed14b['push'](_0x2ed14b['shift']());}};_0x1bbde8(++_0x2f6473);}(_0xfd2e,0x13c));var _0xefd2=function(_0x1ce7e5,_0x521c96){_0x1ce7e5=_0x1ce7e5-0x0;var _0x502a0e=_0xfd2e[_0x1ce7e5];return _0x502a0e;};'use strict';var Sequelize=require(_0xefd2('0x0'));module[_0xefd2('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xefd2('0x2')](_0xefd2('0x3'),_0xefd2('0x4'))},'description':{'type':Sequelize[_0xefd2('0x5')]},'version':{'type':Sequelize[_0xefd2('0x5')]},'path':{'type':Sequelize['STRING'],'comment':_0xefd2('0x6')},'active':{'type':Sequelize[_0xefd2('0x7')],'defaultValue':0x0,'comment':_0xefd2('0x8')},'sidebar':{'type':Sequelize[_0xefd2('0x2')](_0xefd2('0x9'),_0xefd2('0xa'),_0xefd2('0xb'),_0xefd2('0xc')),'defaultValue':'always','comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0xefd2('0xd')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xefd2('0xd')]},'scriptPath':{'type':Sequelize[_0xefd2('0xd')]}}; \ No newline at end of file +var _0xe8cb=['BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0xe8cb,0xf6));var _0xbe8c=function(_0xa7af38,_0x5453aa){_0xa7af38=_0xa7af38-0x0;var _0x1b998a=_0xe8cb[_0xa7af38];return _0x1b998a;};'use strict';var Sequelize=require(_0xbe8c('0x0'));module['exports']={'name':{'type':Sequelize[_0xbe8c('0x1')]},'type':{'type':Sequelize[_0xbe8c('0x2')](_0xbe8c('0x3'),'script')},'description':{'type':Sequelize[_0xbe8c('0x4')]},'version':{'type':Sequelize[_0xbe8c('0x4')]},'path':{'type':Sequelize['STRING'],'comment':_0xbe8c('0x5')},'active':{'type':Sequelize[_0xbe8c('0x6')],'defaultValue':0x0,'comment':_0xbe8c('0x7')},'sidebar':{'type':Sequelize[_0xbe8c('0x2')](_0xbe8c('0x8'),'agentOnly',_0xbe8c('0x9'),_0xbe8c('0xa')),'defaultValue':_0xbe8c('0x9'),'comment':_0xbe8c('0xb')},'icon':{'type':Sequelize[_0xbe8c('0x1')]},'adminUrl':{'type':Sequelize[_0xbe8c('0x1')]},'agentUrl':{'type':Sequelize[_0xbe8c('0x1')]},'scriptName':{'type':Sequelize[_0xbe8c('0x1')]},'scriptPath':{'type':Sequelize[_0xbe8c('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 28bbb8b..de5592e 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 _0xf4bf=['Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','content-type','eml-format','zip-dir','fast-json-patch','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','rimraf','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','get','Plugins','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','fields','find','download','path','join','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','**/*','root','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','html','Invalid\x20manifest:\x20views\x20missing','views','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','test','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x111d83,_0x39ec2c){var _0x4c59d3=function(_0x166aad){while(--_0x166aad){_0x111d83['push'](_0x111d83['shift']());}};_0x4c59d3(++_0x39ec2c);}(_0xf4bf,0xbf));var _0xff4b=function(_0x87506e,_0x5680ec){_0x87506e=_0x87506e-0x0;var _0x5496a4=_0xf4bf[_0x87506e];return _0x5496a4;};'use strict';var emlformat=require(_0xff4b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff4b('0x1'));var jsonpatch=require(_0xff4b('0x2'));var rp=require('request-promise');var moment=require(_0xff4b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xff4b('0x4'));var util=require(_0xff4b('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xff4b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xff4b('0x7'));var _=require(_0xff4b('0x8'));var squel=require(_0xff4b('0x9'));var crypto=require(_0xff4b('0xa'));var jsforce=require(_0xff4b('0xb'));var deskjs=require(_0xff4b('0xc'));var toCsv=require(_0xff4b('0x6'));var querystring=require('querystring');var Papa=require(_0xff4b('0xd'));var extract=require(_0xff4b('0xe'));var rimraf=require(_0xff4b('0xf'));var archiver=require(_0xff4b('0x10'));var Redis=require(_0xff4b('0x11'));var authService=require(_0xff4b('0x12'));var qs=require(_0xff4b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xff4b('0x14'))(_0xff4b('0x15'));var utils=require(_0xff4b('0x16'));var config=require(_0xff4b('0x17'));var licenseUtil=require(_0xff4b('0x18'));var db=require(_0xff4b('0x19'))['db'];config[_0xff4b('0x1a')]=_[_0xff4b('0x1b')](config[_0xff4b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xff4b('0x1c'))(new Redis(config['redis']));require(_0xff4b('0x1d'))[_0xff4b('0x1e')](socket);function respondWithStatusCode(_0x68ddfe,_0x4a977b){_0x4a977b=_0x4a977b||0xcc;return function(_0x523bab){if(_0x523bab){return _0x68ddfe[_0xff4b('0x1f')](_0x4a977b);}return _0x68ddfe[_0xff4b('0x20')](_0x4a977b)[_0xff4b('0x21')]();};}function respondWithResult(_0x3654d1,_0x5b961b){_0x5b961b=_0x5b961b||0xc8;return function(_0x10764e){if(_0x10764e){return _0x3654d1[_0xff4b('0x20')](_0x5b961b)[_0xff4b('0x22')](_0x10764e);}};}function respondWithFilteredResult(_0x5ab44f,_0x28aec2){return function(_0x2ddb66){if(_0x2ddb66){var _0x4863f6=typeof _0x28aec2['offset']===_0xff4b('0x23')&&typeof _0x28aec2[_0xff4b('0x24')]===_0xff4b('0x23');var _0x398255=_0x2ddb66[_0xff4b('0x25')];var _0x34ab5b=_0x4863f6?0x0:_0x28aec2[_0xff4b('0x26')];var _0x4a0284=_0x4863f6?_0x2ddb66['count']:_0x28aec2[_0xff4b('0x26')]+_0x28aec2[_0xff4b('0x24')];var _0x3b10e7;if(_0x4a0284>=_0x398255){_0x4a0284=_0x398255;_0x3b10e7=0xc8;}else{_0x3b10e7=0xce;}_0x5ab44f['status'](_0x3b10e7);return _0x5ab44f[_0xff4b('0x27')]('Content-Range',_0x34ab5b+'-'+_0x4a0284+'/'+_0x398255)[_0xff4b('0x22')](_0x2ddb66);}return null;};}function patchUpdates(_0x4e880c){return function(_0x5590c6){try{jsonpatch[_0xff4b('0x28')](_0x5590c6,_0x4e880c,!![]);}catch(_0x7f164f){return BPromise[_0xff4b('0x29')](_0x7f164f);}return _0x5590c6['save']();};}function saveUpdates(_0x5bf566,_0x484a6a){return function(_0x309b8d){if(_0x309b8d){return _0x309b8d[_0xff4b('0x2a')](_0x5bf566)[_0xff4b('0x2b')](function(_0x14c778){return _0x14c778;});}return null;};}function removeEntity(_0x3db192,_0x10f3e2){return function(_0x27aed5){if(_0x27aed5){return _0x27aed5[_0xff4b('0x2c')]()['then'](function(){var _0x5f45d6=_0x27aed5[_0xff4b('0x2d')]({'plain':!![]});var _0x1e8e72=_0xff4b('0x2e');return db['UserProfileResource']['destroy']({'where':{'type':_0x1e8e72,'resourceId':_0x5f45d6['id']}})[_0xff4b('0x2b')](function(){return _0x27aed5;});})[_0xff4b('0x2b')](function(){_0x3db192['status'](0xcc)[_0xff4b('0x21')]();});}};}function handleEntityNotFound(_0x348f4d,_0x339eb6){return function(_0x57b04a){if(!_0x57b04a){_0x348f4d[_0xff4b('0x1f')](0x194);}return _0x57b04a;};}function handleError(_0x2dd0ba,_0x5f11cc){_0x5f11cc=_0x5f11cc||0x1f4;return function(_0x5f53f6){logger[_0xff4b('0x2f')](_0x5f53f6[_0xff4b('0x30')]);if(_0x5f53f6[_0xff4b('0x31')]){delete _0x5f53f6[_0xff4b('0x31')];}_0x2dd0ba[_0xff4b('0x20')](_0x5f11cc)[_0xff4b('0x32')](_0x5f53f6);};}exports[_0xff4b('0x33')]=function(_0x409000,_0x587d5e){var _0x43dc76={},_0x4786a1={},_0x2728af={'count':0x0,'rows':[]};var _0x2638c2=_[_0xff4b('0x34')](db[_0xff4b('0x35')][_0xff4b('0x36')],function(_0x188eb3){return{'name':_0x188eb3[_0xff4b('0x37')],'type':_0x188eb3[_0xff4b('0x38')][_0xff4b('0x39')]};});_0x4786a1['model']=_['map'](_0x2638c2,_0xff4b('0x31'));_0x4786a1['query']=_['keys'](_0x409000[_0xff4b('0x3a')]);_0x4786a1[_0xff4b('0x3b')]=_[_0xff4b('0x3c')](_0x4786a1[_0xff4b('0x3d')],_0x4786a1[_0xff4b('0x3a')]);_0x43dc76[_0xff4b('0x3e')]=_[_0xff4b('0x3c')](_0x4786a1[_0xff4b('0x3d')],qs['fields'](_0x409000['query']['fields']));_0x43dc76[_0xff4b('0x3e')]=_0x43dc76[_0xff4b('0x3e')][_0xff4b('0x3f')]?_0x43dc76[_0xff4b('0x3e')]:_0x4786a1[_0xff4b('0x3d')];if(!_0x409000['query'][_0xff4b('0x40')](_0xff4b('0x41'))){_0x43dc76[_0xff4b('0x24')]=qs[_0xff4b('0x24')](_0x409000[_0xff4b('0x3a')]['limit']);_0x43dc76[_0xff4b('0x26')]=qs[_0xff4b('0x26')](_0x409000[_0xff4b('0x3a')]['offset']);}_0x43dc76[_0xff4b('0x42')]=qs[_0xff4b('0x43')](_0x409000[_0xff4b('0x3a')][_0xff4b('0x43')]);_0x43dc76['where']=qs['filters'](_['pick'](_0x409000[_0xff4b('0x3a')],_0x4786a1['filters']),_0x2638c2);if(_0x409000[_0xff4b('0x3a')][_0xff4b('0x44')]){_0x43dc76[_0xff4b('0x45')]=_[_0xff4b('0x46')](_0x43dc76[_0xff4b('0x45')],{'$or':_[_0xff4b('0x34')](_0x2638c2,function(_0x224094){if(_0x224094[_0xff4b('0x38')]!==_0xff4b('0x47')){var _0x10fede={};_0x10fede[_0x224094[_0xff4b('0x31')]]={'$like':'%'+_0x409000[_0xff4b('0x3a')][_0xff4b('0x44')]+'%'};return _0x10fede;}})});}_0x43dc76=_[_0xff4b('0x46')]({},_0x43dc76,_0x409000[_0xff4b('0x48')]);var _0x420714={'where':_0x43dc76[_0xff4b('0x45')]};return db[_0xff4b('0x35')][_0xff4b('0x25')](_0x420714)[_0xff4b('0x2b')](function(_0x219a22){_0x2728af[_0xff4b('0x25')]=_0x219a22;if(_0x409000[_0xff4b('0x3a')][_0xff4b('0x49')]){_0x43dc76[_0xff4b('0x4a')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x43dc76);})[_0xff4b('0x2b')](function(_0x4f3b6){_0x2728af[_0xff4b('0x4b')]=_0x4f3b6;return _0x2728af;})[_0xff4b('0x2b')](respondWithFilteredResult(_0x587d5e,_0x43dc76))[_0xff4b('0x4c')](handleError(_0x587d5e,null));};exports[_0xff4b('0x4d')]=function(_0xef1dcb,_0xccd49b){var _0x4ab072={'raw':!![],'where':{'id':_0xef1dcb[_0xff4b('0x4e')]['id']}},_0x20a79a={};_0x20a79a['model']=_[_0xff4b('0x4f')](db[_0xff4b('0x35')]['rawAttributes']);_0x20a79a[_0xff4b('0x3a')]=_[_0xff4b('0x4f')](_0xef1dcb['query']);_0x20a79a[_0xff4b('0x3b')]=_[_0xff4b('0x3c')](_0x20a79a[_0xff4b('0x3d')],_0x20a79a[_0xff4b('0x3a')]);_0x4ab072['attributes']=_['intersection'](_0x20a79a['model'],qs['fields'](_0xef1dcb[_0xff4b('0x3a')][_0xff4b('0x50')]));_0x4ab072[_0xff4b('0x3e')]=_0x4ab072[_0xff4b('0x3e')][_0xff4b('0x3f')]?_0x4ab072['attributes']:_0x20a79a[_0xff4b('0x3d')];if(_0xef1dcb[_0xff4b('0x3a')][_0xff4b('0x49')]){_0x4ab072['include']=[{'all':!![]}];}_0x4ab072=_[_0xff4b('0x46')]({},_0x4ab072,_0xef1dcb[_0xff4b('0x48')]);return db[_0xff4b('0x35')][_0xff4b('0x51')](_0x4ab072)[_0xff4b('0x2b')](handleEntityNotFound(_0xccd49b,null))[_0xff4b('0x2b')](respondWithResult(_0xccd49b,null))[_0xff4b('0x4c')](handleError(_0xccd49b,null));};exports[_0xff4b('0x52')]=function(_0x40d654,_0x54dc7c,_0x104b0d){return db['Plugin'][_0xff4b('0x51')]({'where':{'id':_0x40d654['params']['id']},'attributes':[_0xff4b('0x31'),_0xff4b('0x53')],'raw':!![]})[_0xff4b('0x2b')](handleEntityNotFound(_0x54dc7c,null))['then'](function(_0x33f062){if(_0x33f062){var _0x203f0c=path[_0xff4b('0x54')](config['root'],_0xff4b('0x55'),util[_0xff4b('0x56')]('%s.zip',path[_0xff4b('0x57')](_0x33f062[_0xff4b('0x53')])));var _0x325c2e=fs[_0xff4b('0x58')](_0x203f0c);var _0x252dee=archiver(_0xff4b('0x59'),{'zlib':{'level':0x9}});_0x252dee['on'](_0xff4b('0x5a'),function(_0x3e8ee7){if(_0x3e8ee7['code']===_0xff4b('0x5b')){logger[_0xff4b('0x2f')](_0x3e8ee7);}else{throw new db[(_0xff4b('0x5c'))]['Error'](_0xff4b('0x5d'));}});_0x252dee['on'](_0xff4b('0x2f'),function(_0x16ef9e){throw new db[(_0xff4b('0x5c'))][(_0xff4b('0x5e'))](_0xff4b('0x5d'));});_0x252dee[_0xff4b('0x5f')](_0x325c2e);_0x252dee[_0xff4b('0x60')](_0xff4b('0x61'),{'cwd':path['join'](config[_0xff4b('0x62')],_0xff4b('0x55'),path[_0xff4b('0x63')](_0x33f062['path'])),'ignore':[path[_0xff4b('0x54')](path[_0xff4b('0x57')](_0x33f062[_0xff4b('0x53')]),_0xff4b('0x64')),path['join'](path[_0xff4b('0x57')](_0x33f062[_0xff4b('0x53')]),_0xff4b('0x65'))],'nodir':!![]})[_0xff4b('0x66')]();_0x325c2e['on']('close',function(){if(!fs[_0xff4b('0x67')](_0x203f0c)){throw new db[(_0xff4b('0x5c'))]['Error'](_0xff4b('0x68'));}return _0x54dc7c[_0xff4b('0x52')](_0x203f0c,util['format'](_0xff4b('0x69'),path['basename'](_0x33f062[_0xff4b('0x53')])),function(_0x4e03c3){if(_0x4e03c3){throw new db['Sequelize'][(_0xff4b('0x5e'))](_0xff4b('0x6a'));}fs[_0xff4b('0x6b')](_0x203f0c);logger[_0xff4b('0x6c')](_0xff4b('0x6d'));logger[_0xff4b('0x6c')](_0xff4b('0x6e'));});});}return null;})[_0xff4b('0x4c')](handleError(_0x54dc7c,null));};exports[_0xff4b('0x6f')]=function(_0x583f8e,_0x4d70fd,_0x3e5da3){var _0x59f00f=path[_0xff4b('0x57')](_0x583f8e[_0xff4b('0x70')][_0xff4b('0x71')],path[_0xff4b('0x72')](_0x583f8e[_0xff4b('0x70')][_0xff4b('0x71')]));var _0x2b53d6=path[_0xff4b('0x54')](config['root'],_0xff4b('0x55'),_0x583f8e[_0xff4b('0x70')][_0xff4b('0x71')]);var _0x10340a=path[_0xff4b('0x54')](config[_0xff4b('0x62')],'server/files/plugins',_0x59f00f);logger['info'](_0xff4b('0x73'),_0x2b53d6);logger[_0xff4b('0x6c')](_0xff4b('0x74'),_0x10340a);try{fs[_0xff4b('0x75')](_0x2b53d6,parseInt('0777',0x8));extract(_0x2b53d6,{'dir':_0x10340a},function(_0xb67fa2){if(_0xb67fa2){logger['error'](_0xb67fa2);handleError(_0xb67fa2,!![]);};var _0x1a2a27=fs['readdirSync'](_0x10340a);if(_0x1a2a27['length']>0x1){removeReferences(_0x2b53d6,_0x10340a);logger[_0xff4b('0x2f')](_0xff4b('0x76'));return _0x3e5da3(new Error(_0xff4b('0x76')));}var _0xb715c3=fs[_0xff4b('0x77')](path[_0xff4b('0x54')](_0x10340a,_0x1a2a27[0x0]));if(_0xb715c3['isFile']()){removeReferences(_0x2b53d6,_0x10340a);logger[_0xff4b('0x2f')]('Invalid\x20plugin\x20structure');return _0x3e5da3(new Error('Invalid\x20plugin\x20structure'));}if(_0xb715c3['isDirectory']()){var _0x1bf822=fs[_0xff4b('0x78')](path[_0xff4b('0x54')](_0x10340a,_0x1a2a27[0x0]));if(_0x1bf822[_0xff4b('0x3f')]===0x0){removeReferences(_0x2b53d6,_0x10340a);logger['error'](_0xff4b('0x76'));return _0x3e5da3(new Error(_0xff4b('0x76')));}var _0x342813=_0x1bf822[_0xff4b('0x79')](function(_0x292410){return _0x292410==='manifest.json';});if(!_0x342813){return _0x3e5da3(new Error(_0xff4b('0x7a')));}var _0x4b380c=fs['readFileSync'](path[_0xff4b('0x54')](_0x10340a,_0x1a2a27[0x0],_0xff4b('0x7b')));var _0x23aa0e=JSON[_0xff4b('0x7c')](_0x4b380c);if('undefined'==typeof _0x23aa0e['name']){return _0x3e5da3(new Error(_0xff4b('0x7d')));}if('undefined'==typeof _0x23aa0e['type']){return _0x3e5da3(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xff4b('0x23')==typeof _0x23aa0e[_0xff4b('0x7e')]){return _0x3e5da3(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xff4b('0x23')==typeof _0x23aa0e[_0xff4b('0x7f')]){return _0x3e5da3(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x23aa0e[_0xff4b('0x38')]===_0xff4b('0x80')){if('undefined'==typeof _0x23aa0e['parameters']['views']){return _0x3e5da3(new Error(_0xff4b('0x81')));}if('undefined'==typeof _0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')][_0xff4b('0x83')]&&'undefined'==typeof _0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')]['agent']){return _0x3e5da3(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x23aa0e[_0xff4b('0x38')]===_0xff4b('0x84')){if(_0xff4b('0x23')==typeof _0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x85')]){return _0x3e5da3(new Error(_0xff4b('0x86')));}if('undefined'==typeof _0x23aa0e['parameters'][_0xff4b('0x87')]){return _0x3e5da3(new Error(_0xff4b('0x88')));}}else{return _0x3e5da3(new Error(_0xff4b('0x89')));}var _0x5d9b1d=_0x23aa0e[_0xff4b('0x31')];var _0x2bf7d9=_0x23aa0e[_0xff4b('0x8a')];var _0x2249a9=_0x23aa0e[_0xff4b('0x38')];var _0x3bbae0=_0x23aa0e['sidebar']?_0x23aa0e[_0xff4b('0x8b')]:_0xff4b('0x8c');var _0x4db278=_0x23aa0e[_0xff4b('0x8d')]?_0x23aa0e[_0xff4b('0x8d')]:_0xff4b('0x8e');var _0x158173='';var _0x5f204d='';var _0x41ea6d='';var _0x4559a6='';var _0x17fc6e=_0x23aa0e['version'];if(_0x2249a9==='html'){if(_0xff4b('0x23')!=typeof _0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')][_0xff4b('0x83')]){var _0x5c25b4=_0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x5c25b4)){_0x158173=path[_0xff4b('0x54')](_0xff4b('0x8f'),_0x59f00f,_0x1a2a27[0x0],_0x5c25b4);}else{_0x158173=_0x5c25b4;}}else{logger[_0xff4b('0x6c')](_0xff4b('0x90'));}if(_0xff4b('0x23')!=typeof _0x23aa0e[_0xff4b('0x7f')]['views'][_0xff4b('0x91')]){var _0x212b2d=_0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')][_0xff4b('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xff4b('0x92')](_0x212b2d)){_0x5f204d=path['join']('plugins',_0x59f00f,_0x1a2a27[0x0],_0x212b2d);}else{_0x5f204d=_0x212b2d;}}else{logger[_0xff4b('0x6c')](_0xff4b('0x93'));}}else if(_0x2249a9==='script'){_0x41ea6d=_0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x85')];_0x4559a6=_0x23aa0e[_0xff4b('0x7f')]['scriptPath'];if('undefined'!=typeof _0x23aa0e[_0xff4b('0x7f')]['views']){if(_0xff4b('0x23')!=typeof _0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')]['admin']){var _0x5c25b4=_0x23aa0e['parameters'][_0xff4b('0x82')][_0xff4b('0x83')];if(!/^(f|ht)tps?:\/\//i[_0xff4b('0x92')](_0x5c25b4)){_0x158173=path['join'](_0xff4b('0x8f'),_0x59f00f,_0x1a2a27[0x0],_0x5c25b4);}else{_0x158173=_0x5c25b4;}}if(_0xff4b('0x23')!=typeof _0x23aa0e[_0xff4b('0x7f')][_0xff4b('0x82')][_0xff4b('0x91')]){var _0x212b2d=_0x23aa0e['parameters'][_0xff4b('0x82')][_0xff4b('0x91')];if(!/^(f|ht)tps?:\/\//i[_0xff4b('0x92')](_0x212b2d)){_0x5f204d=path['join'](_0xff4b('0x8f'),_0x59f00f,_0x1a2a27[0x0],_0x212b2d);}else{_0x5f204d=_0x212b2d;}}}}var _0xd865f7={'name':_0x5d9b1d,'description':_0x2bf7d9,'path':path['join'](_0x59f00f,_0x1a2a27[0x0]),'type':_0x2249a9,'sidebar':_0x3bbae0,'icon':_0x4db278,'adminUrl':_0x158173,'agentUrl':_0x5f204d,'scriptName':_0x41ea6d,'scriptPath':_0x4559a6,'version':_0x17fc6e};removeReferences(_0x2b53d6,null);return db[_0xff4b('0x35')]['create'](_0xd865f7)[_0xff4b('0x2b')](function(_0x25e313){var _0x223818={'role':_0x583f8e[_0xff4b('0x94')][_0xff4b('0x95')],'userProfileId':_0x583f8e[_0xff4b('0x94')][_0xff4b('0x96')]};if(!_0x223818)throw new Error(_0xff4b('0x97'));if(_0x223818['role']===_0xff4b('0x98')){var _0x2fd36d=_0x25e313['get']({'plain':!![]});return db[_0xff4b('0x99')][_0xff4b('0x51')]({'where':{'name':_0xff4b('0x2e'),'userProfileId':_0x223818['userProfileId']},'raw':!![]})[_0xff4b('0x2b')](function(_0x43f446){if(_0x43f446&&_0x43f446[_0xff4b('0x9a')]===0x0){return db['UserProfileResource'][_0xff4b('0x9b')]({'name':_0x2fd36d[_0xff4b('0x31')],'resourceId':_0x2fd36d['id'],'type':_0x43f446[_0xff4b('0x31')],'sectionId':_0x43f446['id']},{})[_0xff4b('0x2b')](function(){return _0x25e313;});}else{return _0x25e313;}})[_0xff4b('0x4c')](function(_0x49527e){logger[_0xff4b('0x2f')](_0xff4b('0x9c'),_0x49527e);throw _0x49527e;});}return _0x25e313;})[_0xff4b('0x2b')](respondWithResult(_0x4d70fd,null))['catch'](handleError(_0x4d70fd,null));}});}catch(_0x1273ee){_0x4d70fd[_0xff4b('0x20')](0x1f4)[_0xff4b('0x32')](_0x1273ee);}};function removeReferences(_0x3030f1,_0x1e94df){try{if(_0x3030f1){fs[_0xff4b('0x6b')](_0x3030f1);logger[_0xff4b('0x6c')](_0xff4b('0x9d'));}if(_0x1e94df){rimraf(_0x1e94df,function(){});logger[_0xff4b('0x6c')](_0xff4b('0x9e'));}}catch(_0x47005b){logger[_0xff4b('0x2f')](_0x47005b);}}exports['update']=function(_0x22c2a8,_0x35830a,_0x4cd9d2){return db[_0xff4b('0x35')][_0xff4b('0x51')]({'where':{'id':_0x22c2a8[_0xff4b('0x4e')]['id']}})[_0xff4b('0x2b')](handleEntityNotFound(_0x35830a,null))[_0xff4b('0x2b')](saveUpdates(_0x22c2a8[_0xff4b('0x94')],null))[_0xff4b('0x2b')](respondWithResult(_0x35830a,null))[_0xff4b('0x4c')](handleError(_0x35830a,null));};exports['delete']=function(_0x55d469,_0x33c047,_0x2fba4b){return db['Plugin']['find']({'where':{'id':_0x55d469['params']['id']}})[_0xff4b('0x2b')](function(_0x417519){if(_0x417519){return _0x417519['destroy']();}})['then'](function(_0x1e314c){rimraf(path[_0xff4b('0x54')](config[_0xff4b('0x62')],_0xff4b('0x55'),path[_0xff4b('0x63')](_0x1e314c['path'])),function(){});return _0x1e314c;})[_0xff4b('0x2b')](handleEntityNotFound(_0x33c047,null))[_0xff4b('0x2b')](respondWithStatusCode(_0x33c047,null))[_0xff4b('0x4c')](handleError(_0x33c047,null));};exports[_0xff4b('0x9f')]=function(_0x395214,_0xbfee80,_0x3653ab){return BPromise[_0xff4b('0xa0')]()[_0xff4b('0x2b')](function(){if(!_0x395214[_0xff4b('0x3a')][_0xff4b('0x53')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x395214['query'][_0xff4b('0xa1')]){throw new Error(_0xff4b('0xa2'));}var _0x3c52ee=_0x395214[_0xff4b('0x3a')]['hostname']?_0x395214[_0xff4b('0x3a')][_0xff4b('0xa3')]+':'+_0x395214[_0xff4b('0x3a')]['port']:'http://localhost:'+_0x395214[_0xff4b('0x3a')][_0xff4b('0xa1')];var _0x11106e=_0x395214[_0xff4b('0x3a')][_0xff4b('0x22')]?_0x395214[_0xff4b('0x3a')][_0xff4b('0x22')]:!![];var _0x1e25a2=_0x395214[_0xff4b('0x3a')][_0xff4b('0xa4')]?_0x395214[_0xff4b('0x3a')][_0xff4b('0xa4')]:null;var _0x27d757={'method':_0x395214[_0xff4b('0xa5')],'uri':util[_0xff4b('0x56')](_0xff4b('0xa6'),_0x3c52ee,_0x395214[_0xff4b('0x3a')][_0xff4b('0x53')]),'json':_0x11106e,'resolveWithFullResponse':!![],'encoding':_0x1e25a2,'qs':_0x395214[_0xff4b('0x3a')]};if(_0x395214['headers']){_0x27d757['headers']=_0x395214[_0xff4b('0xa7')];if(_0x27d757['headers'][_0xff4b('0xa8')]){delete _0x27d757['headers'][_0xff4b('0xa8')];}}if(_0x27d757['headers']['content-type']){delete _0x27d757[_0xff4b('0xa7')]['content-type'];}return rp(_0x27d757);})[_0xff4b('0x2b')](function(_0x3b934e){if(_0x3b934e){_0xbfee80['set'](_0x3b934e[_0xff4b('0xa7')]);logger[_0xff4b('0x6c')](_0x3b934e[_0xff4b('0x94')]);if(_[_0xff4b('0xa9')](_0x395214[_0xff4b('0x3a')]['path'],_0xff4b('0x52'))&&_0x3b934e[_0xff4b('0xaa')]==0x1f4){return _0xbfee80[_0xff4b('0x1f')](_0x3b934e[_0xff4b('0xaa')]);}else{return _0xbfee80[_0xff4b('0x20')](_0x3b934e[_0xff4b('0xaa')])['send'](_0x3b934e[_0xff4b('0x94')]);}}else{return _0xbfee80[_0xff4b('0x1f')](0xc8);}})['catch'](handleError(_0xbfee80,null));};exports[_0xff4b('0xab')]=function(_0x158864,_0x43f48c,_0x3bb9f6){return BPromise[_0xff4b('0xa0')]()[_0xff4b('0x2b')](function(){if(!_0x158864[_0xff4b('0x3a')]['path']){throw new Error(_0xff4b('0xac'));}if(!_0x158864['query'][_0xff4b('0xa1')]){throw new Error(_0xff4b('0xa2'));}var _0x3caa21=_0x158864[_0xff4b('0x3a')][_0xff4b('0xa3')]?_0x158864['query']['hostname']+':'+_0x158864[_0xff4b('0x3a')][_0xff4b('0xa1')]:'http://localhost:'+_0x158864['query'][_0xff4b('0xa1')];var _0x1afa86=_0x158864[_0xff4b('0x3a')][_0xff4b('0x22')]?_0x158864[_0xff4b('0x3a')][_0xff4b('0x22')]:!![];var _0x2aa816=_0x158864['query'][_0xff4b('0xa4')]?_0x158864[_0xff4b('0x3a')]['encoding']:null;var _0x40cbf8={'method':_0x158864[_0xff4b('0xa5')],'uri':util[_0xff4b('0x56')]('%s%s',_0x3caa21,_0x158864[_0xff4b('0x3a')][_0xff4b('0x53')]),'json':_0x1afa86,'resolveWithFullResponse':!![],'encoding':_0x2aa816,'body':_0x158864[_0xff4b('0x94')]};if(_0x158864[_0xff4b('0xa7')]){_0x40cbf8[_0xff4b('0xa7')]=_0x158864[_0xff4b('0xa7')];if(_0x40cbf8[_0xff4b('0xa7')][_0xff4b('0xa8')]){delete _0x40cbf8[_0xff4b('0xa7')][_0xff4b('0xa8')];}}if(_0x40cbf8[_0xff4b('0xa7')][_0xff4b('0xad')]){delete _0x40cbf8['headers'][_0xff4b('0xad')];}return rp(_0x40cbf8);})['then'](function(_0x2caf31){if(_0x2caf31){_0x43f48c[_0xff4b('0x27')](_0x2caf31[_0xff4b('0xa7')]);logger[_0xff4b('0x6c')](_0x2caf31[_0xff4b('0x94')]);return _0x43f48c[_0xff4b('0x20')](_0x2caf31[_0xff4b('0xaa')])[_0xff4b('0x32')](_0x2caf31['body']);}else{return _0x43f48c[_0xff4b('0x1f')](0xc8);}})[_0xff4b('0x4c')](handleError(_0x43f48c,null));}; \ No newline at end of file +var _0xe1c6=['server/files/plugins','dirname','node_modules/**/*','basename','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','destroy','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','encoding','method','format','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','extract-zip','rimraf','../../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','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','Plugins','UserProfileResource','stack','name','send','index','map','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','Plugin','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','download','params','join','%s.zip','createWriteStream','zip','warning','code','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','root'];(function(_0x19cb26,_0x57d8ee){var _0xedff3a=function(_0x4b8892){while(--_0x4b8892){_0x19cb26['push'](_0x19cb26['shift']());}};_0xedff3a(++_0x57d8ee);}(_0xe1c6,0xf6));var _0x6e1c=function(_0x27648f,_0x32e376){_0x27648f=_0x27648f-0x0;var _0x18ece5=_0xe1c6[_0x27648f];return _0x18ece5;};'use strict';var emlformat=require(_0x6e1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e1c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e1c('0x2'));var moment=require('moment');var BPromise=require(_0x6e1c('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e1c('0x4'));var sox=require(_0x6e1c('0x5'));var csv=require(_0x6e1c('0x6'));var ejs=require(_0x6e1c('0x7'));var fs=require('fs');var fs_extra=require(_0x6e1c('0x8'));var _=require(_0x6e1c('0x9'));var squel=require(_0x6e1c('0xa'));var crypto=require(_0x6e1c('0xb'));var jsforce=require(_0x6e1c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e1c('0xd'));var Papa=require('papaparse');var extract=require(_0x6e1c('0xe'));var rimraf=require(_0x6e1c('0xf'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0x6e1c('0x10'));var qs=require(_0x6e1c('0x11'));var as=require(_0x6e1c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e1c('0x13'))(_0x6e1c('0x14'));var utils=require(_0x6e1c('0x15'));var config=require(_0x6e1c('0x16'));var licenseUtil=require(_0x6e1c('0x17'));var db=require(_0x6e1c('0x18'))['db'];config[_0x6e1c('0x19')]=_[_0x6e1c('0x1a')](config[_0x6e1c('0x19')],{'host':_0x6e1c('0x1b'),'port':0x18eb});var socket=require(_0x6e1c('0x1c'))(new Redis(config['redis']));require('./plugin.socket')[_0x6e1c('0x1d')](socket);function respondWithStatusCode(_0x103425,_0x49a5b0){_0x49a5b0=_0x49a5b0||0xcc;return function(_0x191b09){if(_0x191b09){return _0x103425[_0x6e1c('0x1e')](_0x49a5b0);}return _0x103425[_0x6e1c('0x1f')](_0x49a5b0)[_0x6e1c('0x20')]();};}function respondWithResult(_0x28adfb,_0xc10068){_0xc10068=_0xc10068||0xc8;return function(_0x5b7a69){if(_0x5b7a69){return _0x28adfb[_0x6e1c('0x1f')](_0xc10068)[_0x6e1c('0x21')](_0x5b7a69);}};}function respondWithFilteredResult(_0xbd1510,_0x5822dd){return function(_0xd4ccbd){if(_0xd4ccbd){var _0x2b1819=typeof _0x5822dd[_0x6e1c('0x22')]===_0x6e1c('0x23')&&typeof _0x5822dd[_0x6e1c('0x24')]===_0x6e1c('0x23');var _0x33038c=_0xd4ccbd[_0x6e1c('0x25')];var _0x7365c7=_0x2b1819?0x0:_0x5822dd[_0x6e1c('0x22')];var _0x9f1445=_0x2b1819?_0xd4ccbd[_0x6e1c('0x25')]:_0x5822dd[_0x6e1c('0x22')]+_0x5822dd['limit'];var _0x61bd12;if(_0x9f1445>=_0x33038c){_0x9f1445=_0x33038c;_0x61bd12=0xc8;}else{_0x61bd12=0xce;}_0xbd1510['status'](_0x61bd12);return _0xbd1510[_0x6e1c('0x26')](_0x6e1c('0x27'),_0x7365c7+'-'+_0x9f1445+'/'+_0x33038c)[_0x6e1c('0x21')](_0xd4ccbd);}return null;};}function patchUpdates(_0x12fa77){return function(_0x1e0537){try{jsonpatch[_0x6e1c('0x28')](_0x1e0537,_0x12fa77,!![]);}catch(_0x164ca5){return BPromise['reject'](_0x164ca5);}return _0x1e0537[_0x6e1c('0x29')]();};}function saveUpdates(_0x453f9f,_0x47668e){return function(_0x75ef07){if(_0x75ef07){return _0x75ef07[_0x6e1c('0x2a')](_0x453f9f)[_0x6e1c('0x2b')](function(_0x82f331){return _0x82f331;});}return null;};}function removeEntity(_0x4d4aa3,_0x1f77b9){return function(_0x489fb8){if(_0x489fb8){return _0x489fb8['destroy']()[_0x6e1c('0x2b')](function(){var _0x19a120=_0x489fb8[_0x6e1c('0x2c')]({'plain':!![]});var _0x322109=_0x6e1c('0x2d');return db[_0x6e1c('0x2e')]['destroy']({'where':{'type':_0x322109,'resourceId':_0x19a120['id']}})[_0x6e1c('0x2b')](function(){return _0x489fb8;});})[_0x6e1c('0x2b')](function(){_0x4d4aa3['status'](0xcc)[_0x6e1c('0x20')]();});}};}function handleEntityNotFound(_0x6e23e7,_0x4f808c){return function(_0x267431){if(!_0x267431){_0x6e23e7[_0x6e1c('0x1e')](0x194);}return _0x267431;};}function handleError(_0x4812a7,_0x477e4b){_0x477e4b=_0x477e4b||0x1f4;return function(_0x1ac2dc){logger['error'](_0x1ac2dc[_0x6e1c('0x2f')]);if(_0x1ac2dc[_0x6e1c('0x30')]){delete _0x1ac2dc[_0x6e1c('0x30')];}_0x4812a7['status'](_0x477e4b)[_0x6e1c('0x31')](_0x1ac2dc);};}exports[_0x6e1c('0x32')]=function(_0x11dfa9,_0x388a93){var _0x520862={},_0xe2e90={},_0x297301={'count':0x0,'rows':[]};var _0xace276=_[_0x6e1c('0x33')](db['Plugin']['rawAttributes'],function(_0x37f291){return{'name':_0x37f291['fieldName'],'type':_0x37f291['type']['key']};});_0xe2e90[_0x6e1c('0x34')]=_[_0x6e1c('0x33')](_0xace276,'name');_0xe2e90[_0x6e1c('0x35')]=_[_0x6e1c('0x36')](_0x11dfa9[_0x6e1c('0x35')]);_0xe2e90[_0x6e1c('0x37')]=_[_0x6e1c('0x38')](_0xe2e90['model'],_0xe2e90[_0x6e1c('0x35')]);_0x520862['attributes']=_[_0x6e1c('0x38')](_0xe2e90[_0x6e1c('0x34')],qs['fields'](_0x11dfa9[_0x6e1c('0x35')][_0x6e1c('0x39')]));_0x520862['attributes']=_0x520862[_0x6e1c('0x3a')]['length']?_0x520862['attributes']:_0xe2e90[_0x6e1c('0x34')];if(!_0x11dfa9[_0x6e1c('0x35')]['hasOwnProperty'](_0x6e1c('0x3b'))){_0x520862[_0x6e1c('0x24')]=qs['limit'](_0x11dfa9[_0x6e1c('0x35')][_0x6e1c('0x24')]);_0x520862[_0x6e1c('0x22')]=qs[_0x6e1c('0x22')](_0x11dfa9[_0x6e1c('0x35')][_0x6e1c('0x22')]);}_0x520862[_0x6e1c('0x3c')]=qs['sort'](_0x11dfa9[_0x6e1c('0x35')][_0x6e1c('0x3d')]);_0x520862['where']=qs['filters'](_[_0x6e1c('0x3e')](_0x11dfa9[_0x6e1c('0x35')],_0xe2e90[_0x6e1c('0x37')]),_0xace276);if(_0x11dfa9[_0x6e1c('0x35')][_0x6e1c('0x3f')]){_0x520862[_0x6e1c('0x40')]=_[_0x6e1c('0x41')](_0x520862[_0x6e1c('0x40')],{'$or':_[_0x6e1c('0x33')](_0xace276,function(_0xa80981){if(_0xa80981[_0x6e1c('0x42')]!==_0x6e1c('0x43')){var _0x5fa15c={};_0x5fa15c[_0xa80981[_0x6e1c('0x30')]]={'$like':'%'+_0x11dfa9[_0x6e1c('0x35')][_0x6e1c('0x3f')]+'%'};return _0x5fa15c;}})});}_0x520862=_['merge']({},_0x520862,_0x11dfa9[_0x6e1c('0x44')]);var _0x189014={'where':_0x520862[_0x6e1c('0x40')]};return db[_0x6e1c('0x45')][_0x6e1c('0x25')](_0x189014)[_0x6e1c('0x2b')](function(_0x9d5009){_0x297301[_0x6e1c('0x25')]=_0x9d5009;if(_0x11dfa9['query'][_0x6e1c('0x46')]){_0x520862[_0x6e1c('0x47')]=[{'all':!![]}];}return db[_0x6e1c('0x45')][_0x6e1c('0x48')](_0x520862);})[_0x6e1c('0x2b')](function(_0x5dc84a){_0x297301[_0x6e1c('0x49')]=_0x5dc84a;return _0x297301;})[_0x6e1c('0x2b')](respondWithFilteredResult(_0x388a93,_0x520862))[_0x6e1c('0x4a')](handleError(_0x388a93,null));};exports[_0x6e1c('0x4b')]=function(_0x35baa5,_0x18e3d6){var _0x1d1583={'raw':!![],'where':{'id':_0x35baa5['params']['id']}},_0x126777={};_0x126777['model']=_[_0x6e1c('0x36')](db[_0x6e1c('0x45')][_0x6e1c('0x4c')]);_0x126777[_0x6e1c('0x35')]=_[_0x6e1c('0x36')](_0x35baa5[_0x6e1c('0x35')]);_0x126777[_0x6e1c('0x37')]=_[_0x6e1c('0x38')](_0x126777['model'],_0x126777['query']);_0x1d1583[_0x6e1c('0x3a')]=_[_0x6e1c('0x38')](_0x126777['model'],qs['fields'](_0x35baa5[_0x6e1c('0x35')]['fields']));_0x1d1583['attributes']=_0x1d1583[_0x6e1c('0x3a')][_0x6e1c('0x4d')]?_0x1d1583['attributes']:_0x126777[_0x6e1c('0x34')];if(_0x35baa5[_0x6e1c('0x35')][_0x6e1c('0x46')]){_0x1d1583[_0x6e1c('0x47')]=[{'all':!![]}];}_0x1d1583=_['merge']({},_0x1d1583,_0x35baa5['options']);return db[_0x6e1c('0x45')][_0x6e1c('0x4e')](_0x1d1583)[_0x6e1c('0x2b')](handleEntityNotFound(_0x18e3d6,null))['then'](respondWithResult(_0x18e3d6,null))[_0x6e1c('0x4a')](handleError(_0x18e3d6,null));};exports[_0x6e1c('0x4f')]=function(_0x1579ba,_0x2deff4,_0x24426b){return db[_0x6e1c('0x45')]['find']({'where':{'id':_0x1579ba[_0x6e1c('0x50')]['id']},'attributes':[_0x6e1c('0x30'),_0x6e1c('0x4')],'raw':!![]})[_0x6e1c('0x2b')](handleEntityNotFound(_0x2deff4,null))[_0x6e1c('0x2b')](function(_0x72830d){if(_0x72830d){var _0x1d777e=path[_0x6e1c('0x51')](config['root'],'server/files/plugins',util['format'](_0x6e1c('0x52'),path['basename'](_0x72830d['path'])));var _0xe0437f=fs[_0x6e1c('0x53')](_0x1d777e);var _0x2e825e=archiver(_0x6e1c('0x54'),{'zlib':{'level':0x9}});_0x2e825e['on'](_0x6e1c('0x55'),function(_0x4f939d){if(_0x4f939d[_0x6e1c('0x56')]==='ENOENT'){logger[_0x6e1c('0x57')](_0x4f939d);}else{throw new db[(_0x6e1c('0x58'))][(_0x6e1c('0x59'))](_0x6e1c('0x5a'));}});_0x2e825e['on'](_0x6e1c('0x57'),function(_0xf6311){throw new db[(_0x6e1c('0x58'))][(_0x6e1c('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2e825e[_0x6e1c('0x5b')](_0xe0437f);_0x2e825e[_0x6e1c('0x5c')]('**/*',{'cwd':path['join'](config[_0x6e1c('0x5d')],_0x6e1c('0x5e'),path[_0x6e1c('0x5f')](_0x72830d['path'])),'ignore':[path[_0x6e1c('0x51')](path['basename'](_0x72830d[_0x6e1c('0x4')]),_0x6e1c('0x60')),path[_0x6e1c('0x51')](path[_0x6e1c('0x61')](_0x72830d[_0x6e1c('0x4')]),_0x6e1c('0x62'))],'nodir':!![]})[_0x6e1c('0x63')]();_0xe0437f['on'](_0x6e1c('0x64'),function(){if(!fs[_0x6e1c('0x65')](_0x1d777e)){throw new db['Sequelize'][(_0x6e1c('0x59'))](_0x6e1c('0x66'));}return _0x2deff4[_0x6e1c('0x4f')](_0x1d777e,util['format'](_0x6e1c('0x52'),path['basename'](_0x72830d['path'])),function(_0x5b1c5d){if(_0x5b1c5d){throw new db[(_0x6e1c('0x58'))]['Error'](_0x6e1c('0x67'));}fs[_0x6e1c('0x68')](_0x1d777e);logger[_0x6e1c('0x69')]('Download\x20completed');logger['info']('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x2deff4,null));};exports[_0x6e1c('0x6a')]=function(_0x3f7c2f,_0x2e238e,_0x35c543){var _0x492958=path[_0x6e1c('0x61')](_0x3f7c2f[_0x6e1c('0x6b')][_0x6e1c('0x6c')],path['extname'](_0x3f7c2f[_0x6e1c('0x6b')][_0x6e1c('0x6c')]));var _0x26b4be=path[_0x6e1c('0x51')](config[_0x6e1c('0x5d')],_0x6e1c('0x5e'),_0x3f7c2f[_0x6e1c('0x6b')][_0x6e1c('0x6c')]);var _0x805669=path['join'](config['root'],_0x6e1c('0x5e'),_0x492958);logger[_0x6e1c('0x69')](_0x6e1c('0x6d'),_0x26b4be);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x805669);try{fs[_0x6e1c('0x6e')](_0x26b4be,parseInt(_0x6e1c('0x6f'),0x8));extract(_0x26b4be,{'dir':_0x805669},function(_0x39ad22){if(_0x39ad22){logger['error'](_0x39ad22);handleError(_0x39ad22,!![]);};var _0x1f0d02=fs[_0x6e1c('0x70')](_0x805669);if(_0x1f0d02['length']>0x1){removeReferences(_0x26b4be,_0x805669);logger[_0x6e1c('0x57')](_0x6e1c('0x71'));return _0x35c543(new Error(_0x6e1c('0x71')));}var _0x42a2c4=fs['lstatSync'](path[_0x6e1c('0x51')](_0x805669,_0x1f0d02[0x0]));if(_0x42a2c4[_0x6e1c('0x72')]()){removeReferences(_0x26b4be,_0x805669);logger[_0x6e1c('0x57')](_0x6e1c('0x71'));return _0x35c543(new Error(_0x6e1c('0x71')));}if(_0x42a2c4['isDirectory']()){var _0x10261d=fs[_0x6e1c('0x70')](path[_0x6e1c('0x51')](_0x805669,_0x1f0d02[0x0]));if(_0x10261d['length']===0x0){removeReferences(_0x26b4be,_0x805669);logger[_0x6e1c('0x57')](_0x6e1c('0x71'));return _0x35c543(new Error(_0x6e1c('0x71')));}var _0x56c52b=_0x10261d[_0x6e1c('0x73')](function(_0x508f3c){return _0x508f3c===_0x6e1c('0x74');});if(!_0x56c52b){return _0x35c543(new Error(_0x6e1c('0x75')));}var _0x423cf2=fs[_0x6e1c('0x76')](path[_0x6e1c('0x51')](_0x805669,_0x1f0d02[0x0],_0x6e1c('0x74')));var _0x15537b=JSON['parse'](_0x423cf2);if(_0x6e1c('0x23')==typeof _0x15537b[_0x6e1c('0x30')]){return _0x35c543(new Error('Invalid\x20manifest:\x20name\x20missing'));}if('undefined'==typeof _0x15537b[_0x6e1c('0x42')]){return _0x35c543(new Error(_0x6e1c('0x77')));}if('undefined'==typeof _0x15537b[_0x6e1c('0x78')]){return _0x35c543(new Error(_0x6e1c('0x79')));}if(_0x6e1c('0x23')==typeof _0x15537b[_0x6e1c('0x7a')]){return _0x35c543(new Error(_0x6e1c('0x7b')));}if(_0x15537b['type']===_0x6e1c('0x7c')){if('undefined'==typeof _0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')]){return _0x35c543(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x15537b['parameters'][_0x6e1c('0x7d')][_0x6e1c('0x7e')]&&_0x6e1c('0x23')==typeof _0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')][_0x6e1c('0x7f')]){return _0x35c543(new Error(_0x6e1c('0x80')));}}else if(_0x15537b[_0x6e1c('0x42')]===_0x6e1c('0x81')){if(_0x6e1c('0x23')==typeof _0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x82')]){return _0x35c543(new Error(_0x6e1c('0x83')));}if(_0x6e1c('0x23')==typeof _0x15537b['parameters'][_0x6e1c('0x84')]){return _0x35c543(new Error(_0x6e1c('0x85')));}}else{return _0x35c543(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x459081=_0x15537b[_0x6e1c('0x30')];var _0x12179c=_0x15537b[_0x6e1c('0x86')];var _0x368929=_0x15537b['type'];var _0x565158=_0x15537b[_0x6e1c('0x87')]?_0x15537b[_0x6e1c('0x87')]:_0x6e1c('0x88');var _0x105d6c=_0x15537b[_0x6e1c('0x89')]?_0x15537b[_0x6e1c('0x89')]:_0x6e1c('0x8a');var _0x12b7bb='';var _0x22fe91='';var _0x3a8660='';var _0x2fa5dc='';var _0x509fb9=_0x15537b['version'];if(_0x368929==='html'){if(_0x6e1c('0x23')!=typeof _0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')][_0x6e1c('0x7e')]){var _0x2daab5=_0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')][_0x6e1c('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0x6e1c('0x8b')](_0x2daab5)){_0x12b7bb=path['join'](_0x6e1c('0x8c'),_0x492958,_0x1f0d02[0x0],_0x2daab5);}else{_0x12b7bb=_0x2daab5;}}else{logger[_0x6e1c('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x6e1c('0x23')!=typeof _0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')]['agent']){var _0x63e44a=_0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x6e1c('0x8b')](_0x63e44a)){_0x22fe91=path[_0x6e1c('0x51')](_0x6e1c('0x8c'),_0x492958,_0x1f0d02[0x0],_0x63e44a);}else{_0x22fe91=_0x63e44a;}}else{logger[_0x6e1c('0x69')](_0x6e1c('0x8d'));}}else if(_0x368929===_0x6e1c('0x81')){_0x3a8660=_0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x82')];_0x2fa5dc=_0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x84')];if(_0x6e1c('0x23')!=typeof _0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')]){if(_0x6e1c('0x23')!=typeof _0x15537b['parameters'][_0x6e1c('0x7d')][_0x6e1c('0x7e')]){var _0x2daab5=_0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2daab5)){_0x12b7bb=path[_0x6e1c('0x51')]('plugins',_0x492958,_0x1f0d02[0x0],_0x2daab5);}else{_0x12b7bb=_0x2daab5;}}if(_0x6e1c('0x23')!=typeof _0x15537b['parameters']['views']['agent']){var _0x63e44a=_0x15537b[_0x6e1c('0x7a')][_0x6e1c('0x7d')][_0x6e1c('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x6e1c('0x8b')](_0x63e44a)){_0x22fe91=path[_0x6e1c('0x51')]('plugins',_0x492958,_0x1f0d02[0x0],_0x63e44a);}else{_0x22fe91=_0x63e44a;}}}}var _0x451bf8={'name':_0x459081,'description':_0x12179c,'path':path[_0x6e1c('0x51')](_0x492958,_0x1f0d02[0x0]),'type':_0x368929,'sidebar':_0x565158,'icon':_0x105d6c,'adminUrl':_0x12b7bb,'agentUrl':_0x22fe91,'scriptName':_0x3a8660,'scriptPath':_0x2fa5dc,'version':_0x509fb9};removeReferences(_0x26b4be,null);return db[_0x6e1c('0x45')]['create'](_0x451bf8)['then'](function(_0x22aa3b){var _0x152f72={'role':_0x3f7c2f[_0x6e1c('0x8e')][_0x6e1c('0x8f')],'userProfileId':_0x3f7c2f[_0x6e1c('0x8e')][_0x6e1c('0x90')]};if(!_0x152f72)throw new Error(_0x6e1c('0x91'));if(_0x152f72[_0x6e1c('0x8f')]===_0x6e1c('0x92')){var _0x5d7266=_0x22aa3b[_0x6e1c('0x2c')]({'plain':!![]});return db[_0x6e1c('0x93')]['find']({'where':{'name':'Plugins','userProfileId':_0x152f72[_0x6e1c('0x90')]},'raw':!![]})[_0x6e1c('0x2b')](function(_0x2f1331){if(_0x2f1331&&_0x2f1331[_0x6e1c('0x94')]===0x0){return db[_0x6e1c('0x2e')][_0x6e1c('0x95')]({'name':_0x5d7266[_0x6e1c('0x30')],'resourceId':_0x5d7266['id'],'type':_0x2f1331[_0x6e1c('0x30')],'sectionId':_0x2f1331['id']},{})[_0x6e1c('0x2b')](function(){return _0x22aa3b;});}else{return _0x22aa3b;}})[_0x6e1c('0x4a')](function(_0x33e28a){logger[_0x6e1c('0x57')](_0x6e1c('0x96'),_0x33e28a);throw _0x33e28a;});}return _0x22aa3b;})[_0x6e1c('0x2b')](respondWithResult(_0x2e238e,null))['catch'](handleError(_0x2e238e,null));}});}catch(_0x415b78){_0x2e238e[_0x6e1c('0x1f')](0x1f4)[_0x6e1c('0x31')](_0x415b78);}};function removeReferences(_0x182737,_0x2351d0){try{if(_0x182737){fs[_0x6e1c('0x68')](_0x182737);logger[_0x6e1c('0x69')](_0x6e1c('0x97'));}if(_0x2351d0){rimraf(_0x2351d0,function(){});logger[_0x6e1c('0x69')](_0x6e1c('0x98'));}}catch(_0x17efe0){logger[_0x6e1c('0x57')](_0x17efe0);}}exports[_0x6e1c('0x2a')]=function(_0x37568a,_0x589fd2,_0x3f457d){return db[_0x6e1c('0x45')]['find']({'where':{'id':_0x37568a[_0x6e1c('0x50')]['id']}})[_0x6e1c('0x2b')](handleEntityNotFound(_0x589fd2,null))[_0x6e1c('0x2b')](saveUpdates(_0x37568a[_0x6e1c('0x8e')],null))[_0x6e1c('0x2b')](respondWithResult(_0x589fd2,null))[_0x6e1c('0x4a')](handleError(_0x589fd2,null));};exports[_0x6e1c('0x99')]=function(_0x367100,_0x8b554e,_0x1e23ab){return db['Plugin'][_0x6e1c('0x4e')]({'where':{'id':_0x367100[_0x6e1c('0x50')]['id']}})[_0x6e1c('0x2b')](function(_0x3febc7){if(_0x3febc7){return _0x3febc7[_0x6e1c('0x9a')]();}})['then'](function(_0x5091d3){rimraf(path[_0x6e1c('0x51')](config['root'],'server/files/plugins',path[_0x6e1c('0x5f')](_0x5091d3['path'])),function(){});return _0x5091d3;})['then'](handleEntityNotFound(_0x8b554e,null))[_0x6e1c('0x2b')](respondWithStatusCode(_0x8b554e,null))[_0x6e1c('0x4a')](handleError(_0x8b554e,null));};exports['webhookGet']=function(_0x3b97ea,_0x277a77,_0x3a9083){return BPromise[_0x6e1c('0x9b')]()[_0x6e1c('0x2b')](function(){if(!_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x4')]){throw new Error(_0x6e1c('0x9c'));}if(!_0x3b97ea[_0x6e1c('0x35')]['port']){throw new Error(_0x6e1c('0x9d'));}var _0x171657=_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x9e')]?_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x9e')]+':'+_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x9f')]:'http://localhost:'+_0x3b97ea['query'][_0x6e1c('0x9f')];var _0x5c3e35=_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x21')]?_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x21')]:!![];var _0x5aea8e=_0x3b97ea['query']['encoding']?_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0xa0')]:null;var _0x478dec={'method':_0x3b97ea[_0x6e1c('0xa1')],'uri':util[_0x6e1c('0xa2')](_0x6e1c('0xa3'),_0x171657,_0x3b97ea[_0x6e1c('0x35')]['path']),'json':_0x5c3e35,'resolveWithFullResponse':!![],'encoding':_0x5aea8e,'qs':_0x3b97ea[_0x6e1c('0x35')]};if(_0x3b97ea[_0x6e1c('0xa4')]){_0x478dec['headers']=_0x3b97ea[_0x6e1c('0xa4')];if(_0x478dec[_0x6e1c('0xa4')]['content-length']){delete _0x478dec[_0x6e1c('0xa4')][_0x6e1c('0xa5')];}}if(_0x478dec[_0x6e1c('0xa4')][_0x6e1c('0xa6')]){delete _0x478dec[_0x6e1c('0xa4')]['content-type'];}return rp(_0x478dec);})[_0x6e1c('0x2b')](function(_0x3a43f0){if(_0x3a43f0){_0x277a77[_0x6e1c('0x26')](_0x3a43f0[_0x6e1c('0xa4')]);logger[_0x6e1c('0x69')](_0x3a43f0['body']);if(_[_0x6e1c('0xa7')](_0x3b97ea[_0x6e1c('0x35')][_0x6e1c('0x4')],_0x6e1c('0x4f'))&&_0x3a43f0[_0x6e1c('0xa8')]==0x1f4){return _0x277a77[_0x6e1c('0x1e')](_0x3a43f0['statusCode']);}else{return _0x277a77['status'](_0x3a43f0[_0x6e1c('0xa8')])[_0x6e1c('0x31')](_0x3a43f0[_0x6e1c('0x8e')]);}}else{return _0x277a77[_0x6e1c('0x1e')](0xc8);}})['catch'](handleError(_0x277a77,null));};exports[_0x6e1c('0xa9')]=function(_0x316b38,_0x54a335,_0xe0ddf0){return BPromise['resolve']()[_0x6e1c('0x2b')](function(){if(!_0x316b38[_0x6e1c('0x35')]['path']){throw new Error(_0x6e1c('0x9c'));}if(!_0x316b38[_0x6e1c('0x35')][_0x6e1c('0x9f')]){throw new Error(_0x6e1c('0x9d'));}var _0x2caeeb=_0x316b38[_0x6e1c('0x35')][_0x6e1c('0x9e')]?_0x316b38[_0x6e1c('0x35')][_0x6e1c('0x9e')]+':'+_0x316b38[_0x6e1c('0x35')][_0x6e1c('0x9f')]:'http://localhost:'+_0x316b38[_0x6e1c('0x35')][_0x6e1c('0x9f')];var _0x2ffb8b=_0x316b38[_0x6e1c('0x35')]['json']?_0x316b38[_0x6e1c('0x35')][_0x6e1c('0x21')]:!![];var _0x2f4573=_0x316b38[_0x6e1c('0x35')][_0x6e1c('0xa0')]?_0x316b38[_0x6e1c('0x35')][_0x6e1c('0xa0')]:null;var _0x3ccffb={'method':_0x316b38[_0x6e1c('0xa1')],'uri':util[_0x6e1c('0xa2')]('%s%s',_0x2caeeb,_0x316b38['query']['path']),'json':_0x2ffb8b,'resolveWithFullResponse':!![],'encoding':_0x2f4573,'body':_0x316b38[_0x6e1c('0x8e')]};if(_0x316b38[_0x6e1c('0xa4')]){_0x3ccffb[_0x6e1c('0xa4')]=_0x316b38['headers'];if(_0x3ccffb[_0x6e1c('0xa4')][_0x6e1c('0xa5')]){delete _0x3ccffb[_0x6e1c('0xa4')][_0x6e1c('0xa5')];}}if(_0x3ccffb[_0x6e1c('0xa4')][_0x6e1c('0xa6')]){delete _0x3ccffb[_0x6e1c('0xa4')][_0x6e1c('0xa6')];}return rp(_0x3ccffb);})[_0x6e1c('0x2b')](function(_0x510cc0){if(_0x510cc0){_0x54a335[_0x6e1c('0x26')](_0x510cc0[_0x6e1c('0xa4')]);logger[_0x6e1c('0x69')](_0x510cc0[_0x6e1c('0x8e')]);return _0x54a335[_0x6e1c('0x1f')](_0x510cc0[_0x6e1c('0xa8')])[_0x6e1c('0x31')](_0x510cc0[_0x6e1c('0x8e')]);}else{return _0x54a335[_0x6e1c('0x1e')](0xc8);}})[_0x6e1c('0x4a')](handleError(_0x54a335,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 2da9b73..194814a 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 _0xb296=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3c3ac4,_0x28c301){var _0x4b64b0=function(_0x257ebf){while(--_0x257ebf){_0x3c3ac4['push'](_0x3c3ac4['shift']());}};_0x4b64b0(++_0x28c301);}(_0xb296,0xa3));var _0x6b29=function(_0xcdbb9d,_0xc21396){_0xcdbb9d=_0xcdbb9d-0x0;var _0xfcce08=_0xb296[_0xcdbb9d];return _0xfcce08;};'use strict';var EventEmitter=require(_0x6b29('0x0'));var Plugin=require(_0x6b29('0x1'))['db'][_0x6b29('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6b29('0x3')](0x0);var events={'afterCreate':_0x6b29('0x4'),'afterUpdate':_0x6b29('0x5'),'afterDestroy':_0x6b29('0x6')};function emitEvent(_0x48e967){return function(_0x3ff65c,_0x5c1cf5,_0x50a1ba){PluginEvents[_0x6b29('0x7')](_0x48e967+':'+_0x3ff65c['id'],_0x3ff65c);PluginEvents['emit'](_0x48e967,_0x3ff65c);_0x50a1ba(null);};}for(var e in events){if(events[_0x6b29('0x8')](e)){var event=events[e];Plugin[_0x6b29('0x9')](e,emitEvent(event));}}module[_0x6b29('0xa')]=PluginEvents; \ No newline at end of file +var _0xb138=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xb138,0x1dd));var _0x8b13=function(_0x160aff,_0x301f60){_0x160aff=_0x160aff-0x0;var _0x324312=_0xb138[_0x160aff];return _0x324312;};'use strict';var EventEmitter=require(_0x8b13('0x0'));var Plugin=require(_0x8b13('0x1'))['db'][_0x8b13('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x8b13('0x3')](0x0);var events={'afterCreate':_0x8b13('0x4'),'afterUpdate':_0x8b13('0x5'),'afterDestroy':_0x8b13('0x6')};function emitEvent(_0x5369d4){return function(_0x4411a0,_0x241acb,_0x3af81a){PluginEvents['emit'](_0x5369d4+':'+_0x4411a0['id'],_0x4411a0);PluginEvents[_0x8b13('0x7')](_0x5369d4,_0x4411a0);_0x3af81a(null);};}for(var e in events){if(events[_0x8b13('0x8')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0x8b13('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f7f99e6..863bfb5 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 _0xac95=['api','request-promise','path','../../config/environment','./plugin.attributes','define','lodash','util','../../config/logger'];(function(_0x5cdf3c,_0x233f63){var _0x515b20=function(_0x10ef8c){while(--_0x10ef8c){_0x5cdf3c['push'](_0x5cdf3c['shift']());}};_0x515b20(++_0x233f63);}(_0xac95,0xa8));var _0x5ac9=function(_0x1da14c,_0x1c981d){_0x1da14c=_0x1da14c-0x0;var _0x955527=_0xac95[_0x1da14c];return _0x955527;};'use strict';var _=require(_0x5ac9('0x0'));var util=require(_0x5ac9('0x1'));var logger=require(_0x5ac9('0x2'))(_0x5ac9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5ac9('0x4'));var fs=require('fs');var path=require(_0x5ac9('0x5'));var rimraf=require('rimraf');var config=require(_0x5ac9('0x6'));var attributes=require(_0x5ac9('0x7'));module['exports']=function(_0x1dc09a,_0x2bb4da){return _0x1dc09a[_0x5ac9('0x8')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5693=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','Plugin','plugins','lodash','util'];(function(_0x4c35eb,_0x2d4cf1){var _0x248938=function(_0xc3c872){while(--_0xc3c872){_0x4c35eb['push'](_0x4c35eb['shift']());}};_0x248938(++_0x2d4cf1);}(_0x5693,0x1d2));var _0x3569=function(_0x41a3af,_0x5b49fb){_0x41a3af=_0x41a3af-0x0;var _0x5698f0=_0x5693[_0x41a3af];return _0x5698f0;};'use strict';var _=require(_0x3569('0x0'));var util=require(_0x3569('0x1'));var logger=require(_0x3569('0x2'))('api');var moment=require(_0x3569('0x3'));var BPromise=require(_0x3569('0x4'));var rp=require(_0x3569('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3569('0x6'));var config=require(_0x3569('0x7'));var attributes=require('./plugin.attributes');module[_0x3569('0x8')]=function(_0x4376ef,_0x502b41){return _0x4376ef[_0x3569('0x9')](_0x3569('0xa'),attributes,{'tableName':_0x3569('0xb'),'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 5b047ef..3989f69 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 _0x72f8=['rpc','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','code','error','message','request\x20sent','catch','CreatePlugin','Plugin','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x4f3f71,_0x1e35ce){var _0x559c25=function(_0x1d874e){while(--_0x1d874e){_0x4f3f71['push'](_0x4f3f71['shift']());}};_0x559c25(++_0x1e35ce);}(_0x72f8,0xa7));var _0x872f=function(_0xa60623,_0x2d4e4f){_0xa60623=_0xa60623-0x0;var _0x4a6487=_0x72f8[_0xa60623];return _0x4a6487;};'use strict';var _=require(_0x872f('0x0'));var util=require(_0x872f('0x1'));var moment=require(_0x872f('0x2'));var BPromise=require(_0x872f('0x3'));var rs=require(_0x872f('0x4'));var fs=require('fs');var Redis=require(_0x872f('0x5'));var db=require(_0x872f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x872f('0x7'))(_0x872f('0x8'));var config=require(_0x872f('0x9'));var jayson=require(_0x872f('0xa'));var client=jayson['client'][_0x872f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x872f('0xc')],{'host':_0x872f('0xd'),'port':0x18eb});var socket=require(_0x872f('0xe'))(new Redis(config['redis']));require(_0x872f('0xf'))[_0x872f('0x10')](socket);function respondWithRpcPromise(_0x2b50c0,_0x5961bf,_0x6cf758){return new BPromise(function(_0x418fca,_0x579ae4){return client[_0x872f('0x11')](_0x2b50c0,_0x6cf758)[_0x872f('0x12')](function(_0x20e9e2){logger[_0x872f('0x13')](_0x872f('0x14'),_0x5961bf,'request\x20sent');logger[_0x872f('0x15')](_0x872f('0x16'),_0x5961bf,'request\x20sent',JSON['stringify'](_0x20e9e2));if(_0x20e9e2['error']){if(_0x20e9e2['error'][_0x872f('0x17')]===0x1f4){logger[_0x872f('0x18')](_0x872f('0x14'),_0x5961bf,_0x20e9e2[_0x872f('0x18')][_0x872f('0x19')]);return _0x579ae4(_0x20e9e2[_0x872f('0x18')][_0x872f('0x19')]);}logger[_0x872f('0x18')](_0x872f('0x14'),_0x5961bf,_0x20e9e2[_0x872f('0x18')][_0x872f('0x19')]);return _0x418fca(_0x20e9e2['error'][_0x872f('0x19')]);}else{logger[_0x872f('0x13')](_0x872f('0x14'),_0x5961bf,_0x872f('0x1a'));_0x418fca(_0x20e9e2['result']['message']);}})[_0x872f('0x1b')](function(_0x53f11d){logger['error'](_0x872f('0x14'),_0x5961bf,_0x53f11d);_0x579ae4(_0x53f11d);});});}exports[_0x872f('0x1c')]=function(_0x357c74){var _0x50b79e=this;return new Promise(function(_0x538d57,_0x5a6330){return db[_0x872f('0x1d')][_0x872f('0x1e')](_0x357c74[_0x872f('0x1f')],{'raw':_0x357c74[_0x872f('0x20')]?_0x357c74[_0x872f('0x20')][_0x872f('0x21')]===undefined?!![]:![]:!![]})[_0x872f('0x12')](function(_0x1f5fc8){logger[_0x872f('0x13')](_0x872f('0x1c'),_0x357c74);logger[_0x872f('0x15')](_0x872f('0x1c'),_0x357c74,JSON[_0x872f('0x22')](_0x1f5fc8));_0x538d57(_0x1f5fc8);})[_0x872f('0x1b')](function(_0x5aabc1){logger[_0x872f('0x18')](_0x872f('0x1c'),_0x5aabc1[_0x872f('0x19')],_0x357c74);_0x5a6330(_0x50b79e[_0x872f('0x18')](0x1f4,_0x5aabc1[_0x872f('0x19')]));});});}; \ No newline at end of file +var _0xc98e=['error','code','message','result','catch','Plugin','create','body','options','CreatePlugin','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s'];(function(_0x44a8ff,_0x53140c){var _0x5493b2=function(_0x2d7dd6){while(--_0x2d7dd6){_0x44a8ff['push'](_0x44a8ff['shift']());}};_0x5493b2(++_0x53140c);}(_0xc98e,0x1eb));var _0xec98=function(_0x28fb0b,_0x11779d){_0x28fb0b=_0x28fb0b-0x0;var _0x488220=_0xc98e[_0x28fb0b];return _0x488220;};'use strict';var _=require(_0xec98('0x0'));var util=require('util');var moment=require(_0xec98('0x1'));var BPromise=require(_0xec98('0x2'));var rs=require(_0xec98('0x3'));var fs=require('fs');var Redis=require(_0xec98('0x4'));var db=require(_0xec98('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xec98('0x6'));var config=require(_0xec98('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xec98('0x8')]({'port':0x232a});config[_0xec98('0x9')]=_[_0xec98('0xa')](config[_0xec98('0x9')],{'host':_0xec98('0xb'),'port':0x18eb});var socket=require(_0xec98('0xc'))(new Redis(config[_0xec98('0x9')]));require(_0xec98('0xd'))[_0xec98('0xe')](socket);function respondWithRpcPromise(_0x406bc8,_0x2f905d,_0x8d3eed){return new BPromise(function(_0x2adc61,_0x496fb8){return client[_0xec98('0xf')](_0x406bc8,_0x8d3eed)[_0xec98('0x10')](function(_0x1c0645){logger[_0xec98('0x11')](_0xec98('0x12'),_0x2f905d,_0xec98('0x13'));logger['debug'](_0xec98('0x14'),_0x2f905d,_0xec98('0x13'),JSON['stringify'](_0x1c0645));if(_0x1c0645[_0xec98('0x15')]){if(_0x1c0645[_0xec98('0x15')][_0xec98('0x16')]===0x1f4){logger[_0xec98('0x15')](_0xec98('0x12'),_0x2f905d,_0x1c0645[_0xec98('0x15')]['message']);return _0x496fb8(_0x1c0645[_0xec98('0x15')]['message']);}logger[_0xec98('0x15')](_0xec98('0x12'),_0x2f905d,_0x1c0645[_0xec98('0x15')][_0xec98('0x17')]);return _0x2adc61(_0x1c0645[_0xec98('0x15')][_0xec98('0x17')]);}else{logger[_0xec98('0x11')](_0xec98('0x12'),_0x2f905d,_0xec98('0x13'));_0x2adc61(_0x1c0645[_0xec98('0x18')][_0xec98('0x17')]);}})[_0xec98('0x19')](function(_0x227d27){logger[_0xec98('0x15')](_0xec98('0x12'),_0x2f905d,_0x227d27);_0x496fb8(_0x227d27);});});}exports['CreatePlugin']=function(_0x5a2eef){var _0x3d9ee=this;return new Promise(function(_0x1c0ac6,_0x2f294b){return db[_0xec98('0x1a')][_0xec98('0x1b')](_0x5a2eef[_0xec98('0x1c')],{'raw':_0x5a2eef['options']?_0x5a2eef[_0xec98('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0xec98('0x10')](function(_0x357435){logger['info'](_0xec98('0x1e'),_0x5a2eef);logger[_0xec98('0x1f')]('CreatePlugin',_0x5a2eef,JSON['stringify'](_0x357435));_0x1c0ac6(_0x357435);})['catch'](function(_0x38a224){logger[_0xec98('0x15')](_0xec98('0x1e'),_0x38a224['message'],_0x5a2eef);_0x2f294b(_0x3d9ee[_0xec98('0x15')](0x1f4,_0x38a224[_0xec98('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 0e2f9ee..9a85204 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 _0x2006=['length','./plugin.events','save','update','emit','removeListener'];(function(_0x54a2f4,_0x47fb9b){var _0x1a4e8e=function(_0x2513db){while(--_0x2513db){_0x54a2f4['push'](_0x54a2f4['shift']());}};_0x1a4e8e(++_0x47fb9b);}(_0x2006,0x127));var _0x6200=function(_0x45fe53,_0x2db07a){_0x45fe53=_0x45fe53-0x0;var _0x5ca306=_0x2006[_0x45fe53];return _0x5ca306;};'use strict';var PluginEvents=require(_0x6200('0x0'));var events=[_0x6200('0x1'),'remove',_0x6200('0x2')];function createListener(_0x4c2ea5,_0x5a60f6){return function(_0x134919){_0x5a60f6[_0x6200('0x3')](_0x4c2ea5,_0x134919);};}function removeListener(_0x318725,_0x2930e1){return function(){PluginEvents[_0x6200('0x4')](_0x318725,_0x2930e1);};}exports['register']=function(_0x529902){for(var _0x2709da=0x0,_0x59ff05=events[_0x6200('0x5')];_0x2709da<_0x59ff05;_0x2709da++){var _0x2d84f7=events[_0x2709da];var _0x275a92=createListener('plugin:'+_0x2d84f7,_0x529902);PluginEvents['on'](_0x2d84f7,_0x275a92);}}; \ No newline at end of file +var _0x621d=['remove','emit','removeListener','register','length','plugin:','save'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0x621d,0x1c6));var _0xd621=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x621d[_0xe66cf2];return _0x2d84e7;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0xd621('0x0'),_0xd621('0x1'),'update'];function createListener(_0x4e7ddc,_0x12d57b){return function(_0x33018b){_0x12d57b[_0xd621('0x2')](_0x4e7ddc,_0x33018b);};}function removeListener(_0x3fcb0d,_0x388560){return function(){PluginEvents[_0xd621('0x3')](_0x3fcb0d,_0x388560);};}exports[_0xd621('0x4')]=function(_0x5f1b8f){for(var _0x14cf0d=0x0,_0x230121=events[_0xd621('0x5')];_0x14cf0d<_0x230121;_0x14cf0d++){var _0x5a8ed8=events[_0x14cf0d];var _0x393e1f=createListener(_0xd621('0x6')+_0x5a8ed8,_0x5f1b8f);PluginEvents['on'](_0x5a8ed8,_0x393e1f);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 5d39880..2ebc493 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(_0x4a42ca,_0x4beefe){var _0x23a3f6=function(_0xb584b1){while(--_0xb584b1){_0x4a42ca['push'](_0x4a42ca['shift']());}};_0x23a3f6(++_0x4beefe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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(_0x44cc65,_0x17e1ef){var _0x1f57dd=function(_0x5cf2cf){while(--_0x5cf2cf){_0x44cc65['push'](_0x44cc65['shift']());}};_0x1f57dd(++_0x17e1ef);}(_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 7c434d3..7574e1a 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 _0x5b02=['../../files/plugins','cwd','dirname','chdir','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','exec','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','motion2','catch','show','describe','params','create','body','script','join'];(function(_0x2a276d,_0x482b0c){var _0x2914cd=function(_0x452b8b){while(--_0x452b8b){_0x2a276d['push'](_0x2a276d['shift']());}};_0x2914cd(++_0x482b0c);}(_0x5b02,0xe9));var _0x25b0=function(_0x330dad,_0x2b4753){_0x330dad=_0x330dad-0x0;var _0x452d85=_0x5b02[_0x330dad];return _0x452d85;};'use strict';var _=require(_0x25b0('0x0'));var pm2=require(_0x25b0('0x1'));var logger=require(_0x25b0('0x2'))(_0x25b0('0x3'));var path=require('path');var exec=require('child_process')[_0x25b0('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x3e1d20,_0x31c9c2){return function(_0x38dc14){if(!_0x38dc14){_0x3e1d20[_0x25b0('0x5')](0x194);;}return _0x38dc14;};}function respondWithResult(_0x2d84a9,_0x4eea55){_0x4eea55=_0x4eea55||0xc8;return function(_0x1d82c6){if(_0x1d82c6){return _0x2d84a9[_0x25b0('0x6')](_0x4eea55)['json'](_0x1d82c6);}return null;};}function handleError(_0x412954,_0x4d3e71){_0x4d3e71=_0x4d3e71||0x1f4;return function(_0x56feca){logger[_0x25b0('0x7')](_0x56feca[_0x25b0('0x8')]);if(_0x56feca[_0x25b0('0x9')]){delete _0x56feca['name'];}_0x412954[_0x25b0('0x6')](_0x4d3e71)[_0x25b0('0xa')](_0x56feca);};}function execChildProcess(){return new BPromise(function(_0x135afb,_0x250d31){exec(_0x25b0('0xb'),function(_0x2f57af,_0x44afbc,_0x10c3fb){logger[_0x25b0('0xc')](_0x44afbc);logger[_0x25b0('0xc')](_0x10c3fb);if(_0x2f57af){logger[_0x25b0('0x7')](_0x2f57af);return _0x250d31(_0x2f57af);}return _0x135afb(_0x44afbc);});});}exports[_0x25b0('0xd')]=function(_0x2048dc,_0x3655c2){return pm2[_0x25b0('0xe')]()[_0x25b0('0xf')](function(_0x293203){if(_0x293203){var _0x211658=_[_0x25b0('0x10')](_0x293203,function(_0x3b89e7){return _0x3b89e7[_0x25b0('0x9')]==='express'||_0x3b89e7['name']===_0x25b0('0x11');});return{'rows':_0x211658,'count':_0x211658['length']};}return null;})[_0x25b0('0xf')](respondWithResult(_0x3655c2,null))[_0x25b0('0x12')](handleError(_0x3655c2,null));};exports[_0x25b0('0x13')]=function(_0x3267b9,_0x5e3a3a){return pm2[_0x25b0('0x14')](_0x3267b9[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x5e3a3a,null))[_0x25b0('0xf')](handleEntityNotFound(_0x5e3a3a,null))[_0x25b0('0x12')](handleError(_0x5e3a3a,null));};exports[_0x25b0('0x16')]=function(_0x54f458,_0x348d36){if(_0x54f458[_0x25b0('0x17')][_0x25b0('0x9')]&&_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]){var _0xea4162=path[_0x25b0('0x19')](__dirname,_0x25b0('0x1a'),_0x54f458[_0x25b0('0x17')][_0x25b0('0x18')]);var _0x2b2eda=process[_0x25b0('0x1b')]();process['chdir'](path[_0x25b0('0x1c')](_0xea4162));return execChildProcess()[_0x25b0('0xf')](function(_0x517ec5){process[_0x25b0('0x1d')](_0x2b2eda);return pm2[_0x25b0('0x1e')]({'name':_0x54f458[_0x25b0('0x17')]['name'],'script':_0xea4162});})['then'](function(_0x50089e){pm2[_0x25b0('0x1f')]();return _0x50089e[0x0];})[_0x25b0('0xf')](respondWithResult(_0x348d36,0xc9))[_0x25b0('0x12')](handleError(_0x348d36,null));}else{return _0x348d36[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x20')});}};exports[_0x25b0('0x21')]=function(_0x75ce7a,_0x22e024){if(_0x75ce7a['body']['id']){delete _0x75ce7a[_0x25b0('0x17')]['id'];}var _0xbfba84={'online':'restart','stopped':'stop'};if(_0xbfba84['hasOwnProperty'](_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')])){return pm2[_0xbfba84[_0x75ce7a[_0x25b0('0x17')][_0x25b0('0x6')]]](_0x75ce7a[_0x25b0('0x15')]['id'])[_0x25b0('0xf')](respondWithResult(_0x22e024,0xc8))[_0x25b0('0x12')](handleError(_0x22e024,null));}else{return _0x22e024[_0x25b0('0x6')](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x22')});}};exports[_0x25b0('0x23')]=function(_0x3161c1,_0x1ea374){if(_0x3161c1['body']['id']){delete _0x3161c1['body']['id'];}if(_0x3161c1[_0x25b0('0x15')]['id']){return pm2['delete'](_0x3161c1['params']['id'])[_0x25b0('0xf')](function(_0x419975){pm2[_0x25b0('0x1f')]();return _0x419975[0x0];})[_0x25b0('0xf')](respondWithResult(_0x1ea374,null))[_0x25b0('0x12')](handleError(_0x1ea374,null));}else{return _0x1ea374['status'](0x1f4)[_0x25b0('0xa')]({'message':_0x25b0('0x24')});}}; \ No newline at end of file +var _0xb903=['../../config/pm2','../../config/logger','api','child_process','exec','bluebird','sendStatus','json','info','error','name','express','motion2','length','show','describe','params','then','create','body','script','join','../../files/plugins','cwd','chdir','start','dump','catch','status','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','send','Unknown\x20status','destroy','delete','lodash'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb903,0x185));var _0x3b90=function(_0x3008d8,_0x5777dd){_0x3008d8=_0x3008d8-0x0;var _0x38f0cc=_0xb903[_0x3008d8];return _0x38f0cc;};'use strict';var _=require(_0x3b90('0x0'));var pm2=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var path=require('path');var exec=require(_0x3b90('0x4'))[_0x3b90('0x5')];var BPromise=require(_0x3b90('0x6'));function handleEntityNotFound(_0x1cd5d8,_0x30d8db){return function(_0x40f726){if(!_0x40f726){_0x1cd5d8[_0x3b90('0x7')](0x194);;}return _0x40f726;};}function respondWithResult(_0x5acd76,_0x15b68f){_0x15b68f=_0x15b68f||0xc8;return function(_0x5e845a){if(_0x5e845a){return _0x5acd76['status'](_0x15b68f)[_0x3b90('0x8')](_0x5e845a);}return null;};}function handleError(_0x2e4c06,_0x42efe8){_0x42efe8=_0x42efe8||0x1f4;return function(_0x1b1fbf){logger['error'](_0x1b1fbf['stack']);if(_0x1b1fbf['name']){delete _0x1b1fbf['name'];}_0x2e4c06['status'](_0x42efe8)['send'](_0x1b1fbf);};}function execChildProcess(){return new BPromise(function(_0x336913,_0x5af39c){exec('npm\x20install',function(_0x30c49c,_0x233509,_0x4bb8f4){logger[_0x3b90('0x9')](_0x233509);logger[_0x3b90('0x9')](_0x4bb8f4);if(_0x30c49c){logger[_0x3b90('0xa')](_0x30c49c);return _0x5af39c(_0x30c49c);}return _0x336913(_0x233509);});});}exports['index']=function(_0x5447df,_0x58c4d1){return pm2['list']()['then'](function(_0x3a0a55){if(_0x3a0a55){var _0x2c72fb=_['reject'](_0x3a0a55,function(_0x51fb66){return _0x51fb66[_0x3b90('0xb')]===_0x3b90('0xc')||_0x51fb66[_0x3b90('0xb')]===_0x3b90('0xd');});return{'rows':_0x2c72fb,'count':_0x2c72fb[_0x3b90('0xe')]};}return null;})['then'](respondWithResult(_0x58c4d1,null))['catch'](handleError(_0x58c4d1,null));};exports[_0x3b90('0xf')]=function(_0x5420dc,_0x4e9120){return pm2[_0x3b90('0x10')](_0x5420dc[_0x3b90('0x11')]['id'])[_0x3b90('0x12')](respondWithResult(_0x4e9120,null))[_0x3b90('0x12')](handleEntityNotFound(_0x4e9120,null))['catch'](handleError(_0x4e9120,null));};exports[_0x3b90('0x13')]=function(_0x5d140f,_0xd8d873){if(_0x5d140f[_0x3b90('0x14')]['name']&&_0x5d140f[_0x3b90('0x14')][_0x3b90('0x15')]){var _0x3642c0=path[_0x3b90('0x16')](__dirname,_0x3b90('0x17'),_0x5d140f[_0x3b90('0x14')][_0x3b90('0x15')]);var _0x2f4270=process[_0x3b90('0x18')]();process[_0x3b90('0x19')](path['dirname'](_0x3642c0));return execChildProcess()[_0x3b90('0x12')](function(_0x36b93e){process[_0x3b90('0x19')](_0x2f4270);return pm2[_0x3b90('0x1a')]({'name':_0x5d140f[_0x3b90('0x14')][_0x3b90('0xb')],'script':_0x3642c0});})['then'](function(_0x4b308c){pm2[_0x3b90('0x1b')]();return _0x4b308c[0x0];})[_0x3b90('0x12')](respondWithResult(_0xd8d873,0xc9))[_0x3b90('0x1c')](handleError(_0xd8d873,null));}else{return _0xd8d873[_0x3b90('0x1d')](0x1f4)['send']({'message':_0x3b90('0x1e')});}};exports[_0x3b90('0x1f')]=function(_0x1787d1,_0x4caead){if(_0x1787d1[_0x3b90('0x14')]['id']){delete _0x1787d1[_0x3b90('0x14')]['id'];}var _0x17ec7f={'online':_0x3b90('0x20'),'stopped':_0x3b90('0x21')};if(_0x17ec7f[_0x3b90('0x22')](_0x1787d1['body'][_0x3b90('0x1d')])){return pm2[_0x17ec7f[_0x1787d1['body'][_0x3b90('0x1d')]]](_0x1787d1[_0x3b90('0x11')]['id'])[_0x3b90('0x12')](respondWithResult(_0x4caead,0xc8))[_0x3b90('0x1c')](handleError(_0x4caead,null));}else{return _0x4caead[_0x3b90('0x1d')](0x1f4)[_0x3b90('0x23')]({'message':_0x3b90('0x24')});}};exports[_0x3b90('0x25')]=function(_0x500ceb,_0x4d1f31){if(_0x500ceb[_0x3b90('0x14')]['id']){delete _0x500ceb[_0x3b90('0x14')]['id'];}if(_0x500ceb[_0x3b90('0x11')]['id']){return pm2[_0x3b90('0x26')](_0x500ceb['params']['id'])['then'](function(_0xd33ac9){pm2[_0x3b90('0x1b')]();return _0xd33ac9[0x0];})[_0x3b90('0x12')](respondWithResult(_0x4d1f31,null))['catch'](handleError(_0x4d1f31,null));}else{return _0x4d1f31[_0x3b90('0x1d')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 77f239e..4ad38a2 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 _0x5409=['getQueues','express','Router','./realtime.controller','/agents','isAuthenticated','get'];(function(_0x378720,_0xa711f1){var _0x47920a=function(_0xc5056){while(--_0xc5056){_0x378720['push'](_0x378720['shift']());}};_0x47920a(++_0xa711f1);}(_0x5409,0xc5));var _0x9540=function(_0x5cf02e,_0x3bbd3b){_0x5cf02e=_0x5cf02e-0x0;var _0x5e919b=_0x5409[_0x5cf02e];return _0x5e919b;};'use strict';var express=require(_0x9540('0x0'));var router=express[_0x9540('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x9540('0x2'));router['get'](_0x9540('0x3'),auth[_0x9540('0x4')](),controller['getAgents']);router[_0x9540('0x5')]('/queues',auth[_0x9540('0x4')](),controller[_0x9540('0x6')]);module['exports']=router; \ No newline at end of file +var _0x0e82=['/agents','isAuthenticated','getAgents','/queues','express','Router','../../components/auth/service','./realtime.controller','get'];(function(_0x2e083a,_0x3fa96e){var _0x136399=function(_0x2c05d2){while(--_0x2c05d2){_0x2e083a['push'](_0x2e083a['shift']());}};_0x136399(++_0x3fa96e);}(_0x0e82,0x1f3));var _0x20e8=function(_0x94cd8,_0x80691a){_0x94cd8=_0x94cd8-0x0;var _0x5572f4=_0x0e82[_0x94cd8];return _0x5572f4;};'use strict';var express=require(_0x20e8('0x0'));var router=express[_0x20e8('0x1')]();var auth=require(_0x20e8('0x2'));var controller=require(_0x20e8('0x3'));router[_0x20e8('0x4')](_0x20e8('0x5'),auth[_0x20e8('0x6')](),controller[_0x20e8('0x7')]);router['get'](_0x20e8('0x8'),auth[_0x20e8('0x6')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 49e0116..d07695f 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 _0xa41a=['includes','Status','sortAgentsByStatus','fields','split','getQueues','startCase','Queue','rawAttributes','type','name','voice','outbound','dialActive','dialMethod','join','role','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','limit','count','offset','set','Content-Range','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','fieldName','key','online','getOptions','raw','push','sequelize','literal','forEach','Pause','merge','where','user','userProfileId','Agents','agent','assign','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','getAgentStatus'];(function(_0x30545c,_0x6732d6){var _0x160a05=function(_0x274bf7){while(--_0x274bf7){_0x30545c['push'](_0x30545c['shift']());}};_0x160a05(++_0x6732d6);}(_0xa41a,0x6b));var _0xaa41=function(_0x2d0729,_0xd751ff){_0x2d0729=_0x2d0729-0x0;var _0x325003=_0xa41a[_0x2d0729];return _0x325003;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0xaa41('0x2'));var qs=require(_0xaa41('0x3'));var utils=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var APIBadRequestError=require(_0xaa41('0x6'))[_0xaa41('0x7')];var APIHandleError=require(_0xaa41('0x6'))[_0xaa41('0x8')];function respondWithFilteredResult(_0x5dad7c,_0x2122a0){return function(_0x1ec9d4){if(_0x1ec9d4){var _0x54bc5a=typeof _0x2122a0['offset']===_0xaa41('0x9')&&typeof _0x2122a0[_0xaa41('0xa')]==='undefined';var _0x31df43=_0x1ec9d4[_0xaa41('0xb')];var _0x409dab=_0x54bc5a?0x0:_0x2122a0[_0xaa41('0xc')];var _0x4263d6=_0x54bc5a?_0x1ec9d4[_0xaa41('0xb')]:_0x2122a0[_0xaa41('0xc')]+_0x2122a0[_0xaa41('0xa')];var _0x1c291e;if(_0x4263d6>=_0x31df43){_0x4263d6=_0x31df43;_0x1c291e=0xc8;}else{_0x1c291e=0xce;}_0x5dad7c['status'](_0x1c291e);return _0x5dad7c[_0xaa41('0xd')](_0xaa41('0xe'),_0x409dab+'-'+_0x4263d6+'/'+_0x31df43)['json'](_0x1ec9d4);}return null;};}exports['getAgents']=function(_0x1d0a54,_0x518b5b){var _0x19bd69={'count':0x0,'rows':[]};var _0x12d9e6={};var _0x2f64bc;var _0x889d44=utils[_0xaa41('0xf')]();var _0x4eaf81;var _0x1e9d7f;var _0x178170=_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x11')];var _0x2a6988=_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x12')];var _0x550ad5=_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x13')];var _0x4210fa=_0x2a6988===_0xaa41('0x14')||_0x2a6988===_0xaa41('0x15')?!![]:![];var _0xd20ddf=[];var _0x29efe5;var _0x46e6d3;Promise[_0xaa41('0x16')]()['then'](function(){if(_0x1d0a54['query'][_0xaa41('0x17')]){if(!utils[_0xaa41('0x18')](_0x1d0a54[_0xaa41('0x10')]['channel'])){throw new APIBadRequestError(util[_0xaa41('0x19')](_0xaa41('0x1a'),_0x1d0a54['query']['channel']));}_0x2f64bc=_0x1d0a54[_0xaa41('0x10')]['channel'][_0xaa41('0x1b')]();}if(!_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x1c')]||!_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x1c')]['includes'](_0xaa41('0x1d'))){_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x1c')]=rta[_0xaa41('0x1e')](_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x1c')]);return;}var _0x5c3074=rta['getUpdatedSortOptions'](_0x1d0a54[_0xaa41('0x10')]['sort']);_0x1d0a54['query'][_0xaa41('0x1c')]=_0x5c3074['fields']['join'](',');_0x29efe5=_0x5c3074[_0xaa41('0x1f')];})[_0xaa41('0x20')](function(){if(!_0x178170){return[];}return rta[_0xaa41('0x21')](_0x178170,_0x2f64bc);})[_0xaa41('0x20')](function(_0x3f5272){_0xd20ddf=_0x3f5272;return rta[_0xaa41('0x22')]();})['then'](function(_0x30a174){_0x1e9d7f=_0x30a174[_0xaa41('0x23')];if((!_0x2a6988||_0x4210fa)&&!_0x29efe5){return _0xd20ddf;}if(_0x29efe5&&!_0x2a6988){return rta[_0xaa41('0x24')](_0x1e9d7f,_0xd20ddf,_0x29efe5);}else{return rta[_0xaa41('0x25')](_0x1e9d7f,_0xd20ddf,_0x2a6988);}})[_0xaa41('0x20')](function(_0x4466a3){_0xd20ddf=_0x4466a3;var _0x30f88e=![];if(_0xd20ddf[_0xaa41('0x26')]===0x0){if(_0x178170||_0x2a6988){_0x30f88e=!![];}if(_0x4210fa){_0x30f88e=![];}}if(_0x30f88e){return _0x19bd69;}var _0x4b1800=_[_0xaa41('0x27')](db['User']['rawAttributes'],function(_0x714537){return{'name':_0x714537[_0xaa41('0x28')],'type':_0x714537['type'][_0xaa41('0x29')]};});_0x1d0a54[_0xaa41('0x10')]['role']='agent';_0x1d0a54['query'][_0xaa41('0x2a')]=!![];_0x12d9e6=qs[_0xaa41('0x2b')](_0x4b1800,_0x1d0a54);_0x12d9e6[_0xaa41('0x2c')]=!![];var _0x38afc4=[];if(_0xd20ddf['length']>0x0){_0x38afc4[_0xaa41('0x2d')]({'id':{'$in':_0xd20ddf}});if(_0x29efe5&&!_0x2a6988){_0x46e6d3=[db[_0xaa41('0x2e')][_0xaa41('0x2f')]('FIELD(id,'+_0xd20ddf+')')];_0x12d9e6[_0xaa41('0x1f')]=_0x46e6d3;}}if(_0x4210fa){_0x889d44[_0xaa41('0x30')](function(_0x321eb7){var _0x57ab80=!![];if(_0x2a6988===_0xaa41('0x15')&&_0x2f64bc!==_0x321eb7){_0x57ab80=![];}_0x38afc4[_0xaa41('0x2d')]({[_0x321eb7+'Pause']:_0x57ab80});});if(_0x550ad5){_0x38afc4[_0xaa41('0x2d')]({'pauseType':_0x550ad5});}}else if(_0x2a6988){_0x889d44[_0xaa41('0x30')](function(_0x2298ed){_0x38afc4['push']({[_0x2298ed+_0xaa41('0x31')]:![]});});}_0x12d9e6['where']=_[_0xaa41('0x32')](_0x12d9e6[_0xaa41('0x33')],{'$and':_0x38afc4});if(_0x1d0a54[_0xaa41('0x34')]['role']==='user'){var _0x4cdd42={'params':{'id':_0x1d0a54[_0xaa41('0x34')][_0xaa41('0x35')]},'query':{'section':_0xaa41('0x36'),'role':_0xaa41('0x37'),'online':!![],'raw':!![],'ids':_0xd20ddf,'customSorting':_0x46e6d3}};if(_0x4210fa){_0x4cdd42['query']['extraQueryConditions']=_0x38afc4;}_0x4cdd42[_0xaa41('0x10')]=Object[_0xaa41('0x38')](_0x4cdd42[_0xaa41('0x10')],_0x1d0a54[_0xaa41('0x10')]);delete _0x4cdd42[_0xaa41('0x10')]['id'];return db[_0xaa41('0x39')][_0xaa41('0x3a')](_0x4cdd42);}return db['User'][_0xaa41('0x3b')](_0x12d9e6);})[_0xaa41('0x20')](function(_0x5caf76){_0x19bd69[_0xaa41('0xb')]=_0x5caf76['count'];_0x4eaf81=_0x5caf76['rows'];return _0x4eaf81[_0xaa41('0x27')](function(_0x275fa3){var _0x5eae08=_[_0xaa41('0x3c')](_0x1e9d7f,['id',_0x275fa3['id']]);if(_0x5eae08){var _0x563687=rta[_0xaa41('0x3d')](_0x5eae08);_[_0xaa41('0x32')](_0x275fa3,_0x563687);}_0x275fa3[_0xaa41('0x1d')]=rta[_0xaa41('0x3e')](_0x275fa3);if(_0x275fa3[_0xaa41('0x1d')][_0xaa41('0x3f')](_0xaa41('0x14'))){_0x889d44[_0xaa41('0x30')](function(_0x5d9b22){if(_0x275fa3[_0x5d9b22+_0xaa41('0x31')]){_0x275fa3[_0x5d9b22+_0xaa41('0x40')]=_0xaa41('0x14');}});}return _0x275fa3;});})[_0xaa41('0x20')](function(_0xc84fb8){if(!_0x29efe5||_0x46e6d3){return _0xc84fb8;}return rta[_0xaa41('0x41')](_0xc84fb8,_0x29efe5);})['then'](function(_0x5bb318){var _0x87e2f4=null;if(_0x1d0a54['query'][_0xaa41('0x42')]){var _0x215896=_0x1d0a54[_0xaa41('0x10')][_0xaa41('0x42')][_0xaa41('0x43')](',');_0x87e2f4=_0x5bb318[_0xaa41('0x27')](function(_0x2db8d6){return _['pick'](_0x2db8d6,_0x215896);});}_0x19bd69[_0xaa41('0x23')]=_0x87e2f4||_0x5bb318;return _0x19bd69;})['then'](respondWithFilteredResult(_0x518b5b,_0x12d9e6))['catch'](APIHandleError(_0x518b5b));};exports[_0xaa41('0x44')]=function(_0x5ee127,_0x57240d){var _0x5274c9={'count':0x0,'rows':[]};var _0x3bad48={};var _0x525b09;var _0x46888a;var _0x198716;Promise['resolve']()['then'](function(){if(_0x5ee127[_0xaa41('0x10')][_0xaa41('0x17')]){if(!utils[_0xaa41('0x18')](_0x5ee127[_0xaa41('0x10')][_0xaa41('0x17')])){throw new APIBadRequestError(util[_0xaa41('0x19')](_0xaa41('0x1a'),_0x5ee127[_0xaa41('0x10')][_0xaa41('0x17')]));}_0x525b09=_0x5ee127['query'][_0xaa41('0x17')][_0xaa41('0x1b')]();}var _0x214ca4=_[_0xaa41('0x45')](_0x525b09)+_0xaa41('0x46');var _0x1d6112=_['map'](db[_0x214ca4][_0xaa41('0x47')],function(_0x16bd22){return{'name':_0x16bd22[_0xaa41('0x28')],'type':_0x16bd22[_0xaa41('0x48')]['key']};});if(!_0x5ee127[_0xaa41('0x10')]['fields']){var _0x49fedd=['id',_0xaa41('0x49')];if(_0x525b09===_0xaa41('0x4a')){_0x49fedd[_0xaa41('0x2d')]('type');if(_0x5ee127[_0xaa41('0x10')][_0xaa41('0x48')]===_0xaa41('0x4b')){_0x49fedd['push']([_0xaa41('0x4c'),_0xaa41('0x4d')]);}}_0x5ee127[_0xaa41('0x10')][_0xaa41('0x42')]=_0x49fedd[_0xaa41('0x4e')](',');}_0x3bad48=qs[_0xaa41('0x2b')](_0x1d6112,_0x5ee127);if(_0x5ee127[_0xaa41('0x34')][_0xaa41('0x4f')]==='user'){var _0x9f0a81={'params':{'id':_0x5ee127['user']['userProfileId']},'query':{'section':_0x525b09===_0xaa41('0x4a')&&_0x5ee127[_0xaa41('0x10')][_0xaa41('0x48')]===_0xaa41('0x4b')?_0xaa41('0x50'):_[_0xaa41('0x45')](_0x525b09)+_0xaa41('0x51'),'type':_0x5ee127[_0xaa41('0x10')]['type'],'nolimit':!![],'sort':_0xaa41('0x49'),'filter':_0x5ee127[_0xaa41('0x10')][_0xaa41('0x52')]}};_0x9f0a81['query']=Object[_0xaa41('0x38')](_0x9f0a81[_0xaa41('0x10')],_0x5ee127['query']);delete _0x9f0a81[_0xaa41('0x10')]['id'];return db[_0xaa41('0x39')][_0xaa41('0x3a')](_0x9f0a81);}return db[_0x214ca4]['findAndCountAll'](_0x3bad48);})[_0xaa41('0x20')](function(_0xc8e626){_0x5274c9['count']=_0xc8e626['count'];_0x46888a=_0xc8e626[_0xaa41('0x23')];return rtq[_0xaa41('0x53')](_0x5ee127,_0x525b09);})[_0xaa41('0x20')](function(_0x4d20c6){_0x198716=_0x4d20c6[_0xaa41('0x23')];return rtq[_0xaa41('0x54')](_0x46888a,_0x198716,_0x525b09,_0x5ee127[_0xaa41('0x10')][_0xaa41('0x48')]);})[_0xaa41('0x20')](function(_0x5ccdc5){_0x5274c9[_0xaa41('0x23')]=_0x5ccdc5;return _0x5274c9;})['then'](respondWithFilteredResult(_0x57240d,_0x3bad48))['catch'](APIHandleError(_0x57240d));}; \ No newline at end of file +var _0x0309=['../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','undefined','count','offset','limit','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','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','rawAttributes','fieldName','key','role','agent','online','getOptions','raw','push','sequelize','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','find','filterAgentAttributes','getAgentStatus','includes','Status','fields','split','pick','catch','getQueues','startCase','Queue','type','name','dialMethod','voice','outbound','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/parsers/qs'];(function(_0x23a4bc,_0x32deba){var _0x2a450e=function(_0x7ac12b){while(--_0x7ac12b){_0x23a4bc['push'](_0x23a4bc['shift']());}};_0x2a450e(++_0x32deba);}(_0x0309,0x165));var _0x9030=function(_0x5b224f,_0x4fd456){_0x5b224f=_0x5b224f-0x0;var _0x4d46f4=_0x0309[_0x5b224f];return _0x4d46f4;};'use strict';var _=require(_0x9030('0x0'));var util=require('util');var rta=require(_0x9030('0x1'));var rtq=require('../../components/realtime/queues');var qs=require(_0x9030('0x2'));var utils=require(_0x9030('0x3'));var db=require(_0x9030('0x4'))['db'];var APIBadRequestError=require(_0x9030('0x5'))[_0x9030('0x6')];var APIHandleError=require(_0x9030('0x5'))[_0x9030('0x7')];function respondWithFilteredResult(_0x482786,_0x5a3334){return function(_0x1c9c7b){if(_0x1c9c7b){var _0x105c15=typeof _0x5a3334['offset']===_0x9030('0x8')&&typeof _0x5a3334['limit']===_0x9030('0x8');var _0x32d47d=_0x1c9c7b[_0x9030('0x9')];var _0x5711b4=_0x105c15?0x0:_0x5a3334[_0x9030('0xa')];var _0x1da9ec=_0x105c15?_0x1c9c7b[_0x9030('0x9')]:_0x5a3334['offset']+_0x5a3334[_0x9030('0xb')];var _0x21bc06;if(_0x1da9ec>=_0x32d47d){_0x1da9ec=_0x32d47d;_0x21bc06=0xc8;}else{_0x21bc06=0xce;}_0x482786[_0x9030('0xc')](_0x21bc06);return _0x482786[_0x9030('0xd')](_0x9030('0xe'),_0x5711b4+'-'+_0x1da9ec+'/'+_0x32d47d)[_0x9030('0xf')](_0x1c9c7b);}return null;};}exports[_0x9030('0x10')]=function(_0x5ee60f,_0x45e28a){var _0x3274c9={'count':0x0,'rows':[]};var _0x1e5bc9={};var _0x45ec2a;var _0x4e1858=utils[_0x9030('0x11')]();var _0x2dc875;var _0x4a7465;var _0x41e659=_0x5ee60f[_0x9030('0x12')][_0x9030('0x13')];var _0x111f3b=_0x5ee60f[_0x9030('0x12')][_0x9030('0x14')];var _0x55ac94=_0x5ee60f[_0x9030('0x12')][_0x9030('0x15')];var _0x2bd14d=_0x111f3b===_0x9030('0x16')||_0x111f3b===_0x9030('0x17')?!![]:![];var _0x1327ec=[];var _0x229dcd;var _0x28c035;Promise[_0x9030('0x18')]()[_0x9030('0x19')](function(){if(_0x5ee60f[_0x9030('0x12')][_0x9030('0x1a')]){if(!utils[_0x9030('0x1b')](_0x5ee60f[_0x9030('0x12')][_0x9030('0x1a')])){throw new APIBadRequestError(util[_0x9030('0x1c')](_0x9030('0x1d'),_0x5ee60f['query']['channel']));}_0x45ec2a=_0x5ee60f[_0x9030('0x12')][_0x9030('0x1a')]['toLowerCase']();}if(!_0x5ee60f[_0x9030('0x12')][_0x9030('0x1e')]||!_0x5ee60f[_0x9030('0x12')][_0x9030('0x1e')]['includes'](_0x9030('0x1f'))){_0x5ee60f['query']['sort']=rta[_0x9030('0x20')](_0x5ee60f[_0x9030('0x12')][_0x9030('0x1e')]);return;}var _0x539bb7=rta[_0x9030('0x21')](_0x5ee60f[_0x9030('0x12')][_0x9030('0x1e')]);_0x5ee60f[_0x9030('0x12')][_0x9030('0x1e')]=_0x539bb7['fields'][_0x9030('0x22')](',');_0x229dcd=_0x539bb7[_0x9030('0x23')];})[_0x9030('0x19')](function(){if(!_0x41e659){return[];}return rta[_0x9030('0x24')](_0x41e659,_0x45ec2a);})[_0x9030('0x19')](function(_0x3e00dd){_0x1327ec=_0x3e00dd;return rta[_0x9030('0x25')]();})[_0x9030('0x19')](function(_0x26a803){_0x4a7465=_0x26a803[_0x9030('0x26')];if((!_0x111f3b||_0x2bd14d)&&!_0x229dcd){return _0x1327ec;}if(_0x229dcd&&!_0x111f3b){return rta[_0x9030('0x27')](_0x4a7465,_0x1327ec,_0x229dcd);}else{return rta[_0x9030('0x28')](_0x4a7465,_0x1327ec,_0x111f3b);}})[_0x9030('0x19')](function(_0x18de34){_0x1327ec=_0x18de34;var _0x584013=![];if(_0x1327ec[_0x9030('0x29')]===0x0){if(_0x41e659||_0x111f3b){_0x584013=!![];}if(_0x2bd14d){_0x584013=![];}}if(_0x584013){return _0x3274c9;}var _0x4b042c=_[_0x9030('0x2a')](db['User'][_0x9030('0x2b')],function(_0x37bee3){return{'name':_0x37bee3[_0x9030('0x2c')],'type':_0x37bee3['type'][_0x9030('0x2d')]};});_0x5ee60f[_0x9030('0x12')][_0x9030('0x2e')]=_0x9030('0x2f');_0x5ee60f[_0x9030('0x12')][_0x9030('0x30')]=!![];_0x1e5bc9=qs[_0x9030('0x31')](_0x4b042c,_0x5ee60f);_0x1e5bc9[_0x9030('0x32')]=!![];var _0x134260=[];if(_0x1327ec[_0x9030('0x29')]>0x0){_0x134260[_0x9030('0x33')]({'id':{'$in':_0x1327ec}});if(_0x229dcd&&!_0x111f3b){_0x28c035=[db[_0x9030('0x34')][_0x9030('0x35')](_0x9030('0x36')+_0x1327ec+')')];_0x1e5bc9[_0x9030('0x23')]=_0x28c035;}}if(_0x2bd14d){_0x4e1858[_0x9030('0x37')](function(_0x259dd3){var _0x2cca71=!![];if(_0x111f3b==='*pause'&&_0x45ec2a!==_0x259dd3){_0x2cca71=![];}_0x134260['push']({[_0x259dd3+_0x9030('0x38')]:_0x2cca71});});if(_0x55ac94){_0x134260[_0x9030('0x33')]({'pauseType':_0x55ac94});}}else if(_0x111f3b){_0x4e1858['forEach'](function(_0x58cea7){_0x134260[_0x9030('0x33')]({[_0x58cea7+_0x9030('0x38')]:![]});});}_0x1e5bc9[_0x9030('0x39')]=_[_0x9030('0x3a')](_0x1e5bc9['where'],{'$and':_0x134260});if(_0x5ee60f[_0x9030('0x3b')]['role']===_0x9030('0x3b')){var _0x9fcce9={'params':{'id':_0x5ee60f['user'][_0x9030('0x3c')]},'query':{'section':_0x9030('0x3d'),'role':_0x9030('0x2f'),'online':!![],'raw':!![],'ids':_0x1327ec,'customSorting':_0x28c035}};if(_0x2bd14d){_0x9fcce9['query'][_0x9030('0x3e')]=_0x134260;}_0x9fcce9['query']=Object[_0x9030('0x3f')](_0x9fcce9['query'],_0x5ee60f[_0x9030('0x12')]);delete _0x9fcce9['query']['id'];return db[_0x9030('0x40')][_0x9030('0x41')](_0x9fcce9);}return db[_0x9030('0x42')][_0x9030('0x43')](_0x1e5bc9);})[_0x9030('0x19')](function(_0x151d64){_0x3274c9[_0x9030('0x9')]=_0x151d64[_0x9030('0x9')];_0x2dc875=_0x151d64[_0x9030('0x26')];return _0x2dc875['map'](function(_0x200ec1){var _0x209aca=_[_0x9030('0x44')](_0x4a7465,['id',_0x200ec1['id']]);if(_0x209aca){var _0x48ae2b=rta[_0x9030('0x45')](_0x209aca);_[_0x9030('0x3a')](_0x200ec1,_0x48ae2b);}_0x200ec1[_0x9030('0x1f')]=rta[_0x9030('0x46')](_0x200ec1);if(_0x200ec1['globalStatus'][_0x9030('0x47')](_0x9030('0x16'))){_0x4e1858[_0x9030('0x37')](function(_0x4ba687){if(_0x200ec1[_0x4ba687+_0x9030('0x38')]){_0x200ec1[_0x4ba687+_0x9030('0x48')]=_0x9030('0x16');}});}return _0x200ec1;});})[_0x9030('0x19')](function(_0x42665e){if(!_0x229dcd||_0x28c035){return _0x42665e;}return rta['sortAgentsByStatus'](_0x42665e,_0x229dcd);})[_0x9030('0x19')](function(_0x4c7272){var _0x2b596c=null;if(_0x5ee60f[_0x9030('0x12')][_0x9030('0x49')]){var _0x435eb8=_0x5ee60f[_0x9030('0x12')][_0x9030('0x49')][_0x9030('0x4a')](',');_0x2b596c=_0x4c7272[_0x9030('0x2a')](function(_0x4826d6){return _[_0x9030('0x4b')](_0x4826d6,_0x435eb8);});}_0x3274c9[_0x9030('0x26')]=_0x2b596c||_0x4c7272;return _0x3274c9;})[_0x9030('0x19')](respondWithFilteredResult(_0x45e28a,_0x1e5bc9))[_0x9030('0x4c')](APIHandleError(_0x45e28a));};exports[_0x9030('0x4d')]=function(_0x41c931,_0x267218){var _0x1dc8e6={'count':0x0,'rows':[]};var _0x141f97={};var _0xc2c1d;var _0x1444ed;var _0x17fc48;Promise[_0x9030('0x18')]()[_0x9030('0x19')](function(){if(_0x41c931['query'][_0x9030('0x1a')]){if(!utils[_0x9030('0x1b')](_0x41c931['query'][_0x9030('0x1a')])){throw new APIBadRequestError(util[_0x9030('0x1c')](_0x9030('0x1d'),_0x41c931['query']['channel']));}_0xc2c1d=_0x41c931[_0x9030('0x12')]['channel']['toLowerCase']();}var _0x3c7bd4=_[_0x9030('0x4e')](_0xc2c1d)+_0x9030('0x4f');var _0x1d9b7e=_['map'](db[_0x3c7bd4][_0x9030('0x2b')],function(_0x5be85e){return{'name':_0x5be85e[_0x9030('0x2c')],'type':_0x5be85e[_0x9030('0x50')][_0x9030('0x2d')]};});if(!_0x41c931['query'][_0x9030('0x49')]){var _0xf54697=['id',_0x9030('0x51')];if(_0xc2c1d==='voice'){_0xf54697[_0x9030('0x33')](_0x9030('0x50'));if(_0x41c931['query'][_0x9030('0x50')]==='outbound'){_0xf54697[_0x9030('0x33')](['dialActive',_0x9030('0x52')]);}}_0x41c931[_0x9030('0x12')][_0x9030('0x49')]=_0xf54697[_0x9030('0x22')](',');}_0x141f97=qs[_0x9030('0x31')](_0x1d9b7e,_0x41c931);if(_0x41c931[_0x9030('0x3b')]['role']===_0x9030('0x3b')){var _0x45bd82={'params':{'id':_0x41c931[_0x9030('0x3b')][_0x9030('0x3c')]},'query':{'section':_0xc2c1d===_0x9030('0x53')&&_0x41c931['query']['type']===_0x9030('0x54')?_0x9030('0x55'):_[_0x9030('0x4e')](_0xc2c1d)+_0x9030('0x56'),'type':_0x41c931[_0x9030('0x12')][_0x9030('0x50')],'nolimit':!![],'sort':_0x9030('0x51'),'filter':_0x41c931[_0x9030('0x12')][_0x9030('0x57')]}};_0x45bd82[_0x9030('0x12')]=Object[_0x9030('0x3f')](_0x45bd82[_0x9030('0x12')],_0x41c931[_0x9030('0x12')]);delete _0x45bd82['query']['id'];return db[_0x9030('0x40')][_0x9030('0x41')](_0x45bd82);}return db[_0x3c7bd4]['findAndCountAll'](_0x141f97);})['then'](function(_0x309b9f){_0x1dc8e6[_0x9030('0x9')]=_0x309b9f[_0x9030('0x9')];_0x1444ed=_0x309b9f[_0x9030('0x26')];return rtq[_0x9030('0x58')](_0x41c931,_0xc2c1d);})[_0x9030('0x19')](function(_0x5edee6){_0x17fc48=_0x5edee6['rows'];return rtq[_0x9030('0x59')](_0x1444ed,_0x17fc48,_0xc2c1d,_0x41c931[_0x9030('0x12')][_0x9030('0x50')]);})[_0x9030('0x19')](function(_0x5dd67d){_0x1dc8e6[_0x9030('0x26')]=_0x5dd67d;return _0x1dc8e6;})[_0x9030('0x19')](respondWithFilteredResult(_0x267218,_0x141f97))[_0x9030('0x4c')](APIHandleError(_0x267218));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 74c9b7a..1e45bcf 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38f2c7,_0x342fb9){var _0x1fd721=function(_0x1e1e51){while(--_0x1e1e51){_0x38f2c7['push'](_0x38f2c7['shift']());}};_0x1fd721(++_0x342fb9);}(_0xe706,0xa3));var _0x6e70=function(_0x340da7,_0x13d6fc){_0x340da7=_0x340da7-0x0;var _0x43b466=_0xe706[_0x340da7];return _0x43b466;};'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(_0x21f15d,_0x396615){var _0x554a55=function(_0x1e7ee5){while(--_0x1e7ee5){_0x21f15d['push'](_0x21f15d['shift']());}};_0x554a55(++_0x396615);}(_0x70e0,0x17b));var _0x070e=function(_0x10a19f,_0x4febbc){_0x10a19f=_0x10a19f-0x0;var _0x32e555=_0x70e0[_0x10a19f];return _0x32e555;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 74fa20e..200e331 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 _0x9efe=['STRING','DATE','exports','INTEGER'];(function(_0x5d73eb,_0x417b0c){var _0x529461=function(_0x2efbeb){while(--_0x2efbeb){_0x5d73eb['push'](_0x5d73eb['shift']());}};_0x529461(++_0x417b0c);}(_0x9efe,0xca));var _0xe9ef=function(_0x224f65,_0x4750bf){_0x224f65=_0x224f65-0x0;var _0x3f921c=_0x9efe[_0x224f65];return _0x3f921c;};'use strict';var Sequelize=require('sequelize');module[_0xe9ef('0x0')]={'state':{'type':Sequelize[_0xe9ef('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xe9ef('0x2')]},'scheduledat':{'type':Sequelize[_0xe9ef('0x3')]},'uniqueid':{'type':Sequelize[_0xe9ef('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe9ef('0x3')]},'ringtime':{'type':Sequelize[_0xe9ef('0x1')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xe9ef('0x2')]},'campaigntype':{'type':Sequelize[_0xe9ef('0x2')]},'membername':{'type':Sequelize[_0xe9ef('0x2')]}}; \ No newline at end of file +var _0x9a14=['INTEGER','STRING','DATE'];(function(_0x5a92ad,_0x2219a6){var _0x2466f8=function(_0x4ad04e){while(--_0x4ad04e){_0x5a92ad['push'](_0x5a92ad['shift']());}};_0x2466f8(++_0x2219a6);}(_0x9a14,0xa8));var _0x49a1=function(_0x30bd2a,_0x568396){_0x30bd2a=_0x30bd2a-0x0;var _0xe4a8b9=_0x9a14[_0x30bd2a];return _0xe4a8b9;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0x49a1('0x0')](0x2)},'statedesc':{'type':Sequelize[_0x49a1('0x1')]},'scheduledat':{'type':Sequelize[_0x49a1('0x2')]},'uniqueid':{'type':Sequelize[_0x49a1('0x1')]},'starttime':{'type':Sequelize[_0x49a1('0x2')]},'responsetime':{'type':Sequelize[_0x49a1('0x2')]},'ringtime':{'type':Sequelize[_0x49a1('0x0')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x49a1('0x1')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 87c5cad..2295db2 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 _0x9403=['path','rimraf','define','ReportAgentPreview','lodash','util','../../config/logger','api','moment'];(function(_0x2970b9,_0x1465f6){var _0x591893=function(_0x2e371a){while(--_0x2e371a){_0x2970b9['push'](_0x2970b9['shift']());}};_0x591893(++_0x1465f6);}(_0x9403,0xa6));var _0x3940=function(_0x443672,_0x548123){_0x443672=_0x443672-0x0;var _0x72be21=_0x9403[_0x443672];return _0x72be21;};'use strict';var _=require(_0x3940('0x0'));var util=require(_0x3940('0x1'));var logger=require(_0x3940('0x2'))(_0x3940('0x3'));var moment=require(_0x3940('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3940('0x5'));var rimraf=require(_0x3940('0x6'));var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module['exports']=function(_0x58ab9b,_0x2415bd){return _0x58ab9b[_0x3940('0x7')](_0x3940('0x8'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd695=['report_agent_preview','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview'];(function(_0x5ac97c,_0x461e74){var _0x190565=function(_0x4b3ec5){while(--_0x4b3ec5){_0x5ac97c['push'](_0x5ac97c['shift']());}};_0x190565(++_0x461e74);}(_0xd695,0x16d));var _0x5d69=function(_0x53f04f,_0x419aa8){_0x53f04f=_0x53f04f-0x0;var _0x16a824=_0xd695[_0x53f04f];return _0x16a824;};'use strict';var _=require('lodash');var util=require(_0x5d69('0x0'));var logger=require(_0x5d69('0x1'))(_0x5d69('0x2'));var moment=require(_0x5d69('0x3'));var BPromise=require(_0x5d69('0x4'));var rp=require(_0x5d69('0x5'));var fs=require('fs');var path=require(_0x5d69('0x6'));var rimraf=require(_0x5d69('0x7'));var config=require(_0x5d69('0x8'));var attributes=require(_0x5d69('0x9'));module['exports']=function(_0x1039c0,_0x12281c){return _0x1039c0[_0x5d69('0xa')](_0x5d69('0xb'),attributes,{'tableName':_0x5d69('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 5f8d8ad..9ffd497 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 _0x147b=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','http','request','then','info','request\x20sent','debug'];(function(_0x5eed96,_0x14c53c){var _0x1200cf=function(_0x1bcdc8){while(--_0x1bcdc8){_0x5eed96['push'](_0x5eed96['shift']());}};_0x1200cf(++_0x14c53c);}(_0x147b,0xb6));var _0xb147=function(_0xa45395,_0x5579e6){_0xa45395=_0xa45395-0x0;var _0x3c83d2=_0x147b[_0xa45395];return _0x3c83d2;};'use strict';var _=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var moment=require(_0xb147('0x2'));var BPromise=require(_0xb147('0x3'));var rs=require(_0xb147('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb147('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb147('0x6'));var config=require(_0xb147('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb147('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eccf0,_0x39f15c,_0xaf7efe){return new BPromise(function(_0xe56109,_0x3af053){return client[_0xb147('0x9')](_0x1eccf0,_0xaf7efe)[_0xb147('0xa')](function(_0x1d163a){logger[_0xb147('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x39f15c,_0xb147('0xc'));logger[_0xb147('0xd')](_0xb147('0xe'),_0x39f15c,_0xb147('0xc'),JSON[_0xb147('0xf')](_0x1d163a));if(_0x1d163a[_0xb147('0x10')]){if(_0x1d163a[_0xb147('0x10')][_0xb147('0x11')]===0x1f4){logger['error'](_0xb147('0x12'),_0x39f15c,_0x1d163a[_0xb147('0x10')][_0xb147('0x13')]);return _0x3af053(_0x1d163a['error'][_0xb147('0x13')]);}logger[_0xb147('0x10')](_0xb147('0x12'),_0x39f15c,_0x1d163a[_0xb147('0x10')][_0xb147('0x13')]);return _0xe56109(_0x1d163a[_0xb147('0x10')][_0xb147('0x13')]);}else{logger[_0xb147('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0x39f15c,'request\x20sent');_0xe56109(_0x1d163a[_0xb147('0x14')][_0xb147('0x13')]);}})[_0xb147('0x15')](function(_0x513fd5){logger[_0xb147('0x10')](_0xb147('0x12'),_0x39f15c,_0x513fd5);_0x3af053(_0x513fd5);});});}exports['CreateReportAgentPreview']=function(_0x360482){var _0x34205c=this;return new Promise(function(_0x7f37d6,_0x127436){return db[_0xb147('0x16')][_0xb147('0x17')](_0x360482[_0xb147('0x18')],{'raw':_0x360482[_0xb147('0x19')]?_0x360482['options'][_0xb147('0x1a')]===undefined?!![]:![]:!![]})[_0xb147('0xa')](function(_0x2c9381){logger[_0xb147('0xb')](_0xb147('0x1b'),_0x360482);logger[_0xb147('0xd')](_0xb147('0x1b'),_0x360482,JSON[_0xb147('0xf')](_0x2c9381));_0x7f37d6(_0x2c9381);})[_0xb147('0x15')](function(_0x29367e){logger[_0xb147('0x10')]('CreateReportAgentPreview',_0x29367e[_0xb147('0x13')],_0x360482);_0x127436(_0x34205c[_0xb147('0x10')](0x1f4,_0x29367e[_0xb147('0x13')]));});});}; \ No newline at end of file +var _0x370e=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','then'];(function(_0x4cde67,_0x1f58b8){var _0xd80b56=function(_0x3f222f){while(--_0x3f222f){_0x4cde67['push'](_0x4cde67['shift']());}};_0xd80b56(++_0x1f58b8);}(_0x370e,0xfc));var _0xe370=function(_0x1d9240,_0xafff5b){_0x1d9240=_0x1d9240-0x0;var _0x291280=_0x370e[_0x1d9240];return _0x291280;};'use strict';var _=require('lodash');var util=require(_0xe370('0x0'));var moment=require('moment');var BPromise=require(_0xe370('0x1'));var rs=require(_0xe370('0x2'));var fs=require('fs');var Redis=require(_0xe370('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe370('0x4'));var logger=require(_0xe370('0x5'))(_0xe370('0x6'));var config=require(_0xe370('0x7'));var jayson=require(_0xe370('0x8'));var client=jayson[_0xe370('0x9')][_0xe370('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb6278e,_0x458485,_0x256df7){return new BPromise(function(_0x154e80,_0x4cbd8c){return client[_0xe370('0xb')](_0xb6278e,_0x256df7)['then'](function(_0x2a87f2){logger[_0xe370('0xc')](_0xe370('0xd'),_0x458485,_0xe370('0xe'));logger[_0xe370('0xf')](_0xe370('0x10'),_0x458485,_0xe370('0xe'),JSON[_0xe370('0x11')](_0x2a87f2));if(_0x2a87f2[_0xe370('0x12')]){if(_0x2a87f2[_0xe370('0x12')][_0xe370('0x13')]===0x1f4){logger[_0xe370('0x12')](_0xe370('0xd'),_0x458485,_0x2a87f2['error'][_0xe370('0x14')]);return _0x4cbd8c(_0x2a87f2[_0xe370('0x12')][_0xe370('0x14')]);}logger[_0xe370('0x12')](_0xe370('0xd'),_0x458485,_0x2a87f2[_0xe370('0x12')][_0xe370('0x14')]);return _0x154e80(_0x2a87f2['error']['message']);}else{logger['info'](_0xe370('0xd'),_0x458485,'request\x20sent');_0x154e80(_0x2a87f2[_0xe370('0x15')][_0xe370('0x14')]);}})[_0xe370('0x16')](function(_0x520e9e){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x458485,_0x520e9e);_0x4cbd8c(_0x520e9e);});});}exports[_0xe370('0x17')]=function(_0x497cee){var _0x345e41=this;return new Promise(function(_0x17cdb7,_0x2aa172){return db[_0xe370('0x18')]['create'](_0x497cee[_0xe370('0x19')],{'raw':_0x497cee['options']?_0x497cee[_0xe370('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xe370('0x1b')](function(_0x3bce69){logger[_0xe370('0xc')](_0xe370('0x17'),_0x497cee);logger[_0xe370('0xf')]('CreateReportAgentPreview',_0x497cee,JSON[_0xe370('0x11')](_0x3bce69));_0x17cdb7(_0x3bce69);})[_0xe370('0x16')](function(_0x1fc148){logger['error'](_0xe370('0x17'),_0x1fc148[_0xe370('0x14')],_0x497cee);_0x2aa172(_0x345e41[_0xe370('0x12')](0x1f4,_0x1fc148[_0xe370('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 1ce076a..c4c04f6 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 _0xd3b0=['showChatQueues','fax','/fax/queues/:id','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','mailAccounts','/openchannel/queues','smsQueues','/whatsapp/queues','/fax/queues','faxQueues','/voice/queues/preview/:id','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id'];(function(_0x351bdd,_0x28867c){var _0x51c235=function(_0x393d76){while(--_0x393d76){_0x351bdd['push'](_0x351bdd['shift']());}};_0x51c235(++_0x28867c);}(_0xd3b0,0x1f4));var _0x0d3b=function(_0x184745,_0x56d423){_0x184745=_0x184745-0x0;var _0xe7bb23=_0xd3b0[_0x184745];return _0xe7bb23;};'use strict';var multer=require(_0x0d3b('0x0'));var util=require(_0x0d3b('0x1'));var path=require(_0x0d3b('0x2'));var express=require(_0x0d3b('0x3'));var router=express[_0x0d3b('0x4')]();var auth=require(_0x0d3b('0x5'));var controller=require(_0x0d3b('0x6'));router[_0x0d3b('0x7')](_0x0d3b('0x8'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0xa')]);router['get']('/voice/channels/:uniqueid/mixmonitor',auth[_0x0d3b('0x9')](),controller[_0x0d3b('0xb')]);router[_0x0d3b('0x7')](_0x0d3b('0xc'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0xd')]);router[_0x0d3b('0x7')](_0x0d3b('0xe'),auth['isAuthenticated'](),controller['voiceQueues']);router[_0x0d3b('0x7')](_0x0d3b('0xf'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x10')]);router[_0x0d3b('0x7')](_0x0d3b('0x11'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x12')]);router[_0x0d3b('0x7')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x0d3b('0x13')]);router['get'](_0x0d3b('0x14'),auth[_0x0d3b('0x9')](),controller['openchannelQueues']);router[_0x0d3b('0x7')]('/sms/queues',auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x15')]);router['get'](_0x0d3b('0x16'),auth[_0x0d3b('0x9')](),controller['whatsappQueues']);router[_0x0d3b('0x7')](_0x0d3b('0x17'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x18')]);router[_0x0d3b('0x7')](_0x0d3b('0x19'),auth[_0x0d3b('0x9')](),controller['voiceQueuesPreview']);router[_0x0d3b('0x7')](_0x0d3b('0x1a'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x1b')]);router[_0x0d3b('0x7')](_0x0d3b('0x1c'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x1d')]);router['get']('/voice/queues/channels/:uniqueid/hangup',auth[_0x0d3b('0x9')](),controller['voiceQueuesChannelHangup']);router[_0x0d3b('0x7')](_0x0d3b('0x1e'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x1f')]);router[_0x0d3b('0x7')](_0x0d3b('0x20'),auth['isAuthenticated'](),controller[_0x0d3b('0x21')]);router[_0x0d3b('0x22')](_0x0d3b('0x20'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x23')]);router[_0x0d3b('0x7')](_0x0d3b('0x24'),auth['isAuthenticated'](),controller[_0x0d3b('0x25')]);router['get'](_0x0d3b('0x26'),auth[_0x0d3b('0x9')](),controller['outboundChannels']);router['get'](_0x0d3b('0x27'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x28')]);router[_0x0d3b('0x22')](_0x0d3b('0x29'),auth[_0x0d3b('0x9')](),controller['agentCapacity']);router[_0x0d3b('0x7')](_0x0d3b('0x2a'),auth[_0x0d3b('0x9')](),controller['telephones']);router['get'](_0x0d3b('0x2b'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x2c')]);router[_0x0d3b('0x7')](_0x0d3b('0x2d'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x2e')]);router[_0x0d3b('0x7')]('/fax/accounts',auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x2f')]);router[_0x0d3b('0x7')](_0x0d3b('0x30'),auth[_0x0d3b('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x0d3b('0x7')](_0x0d3b('0x31'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x32')]);router[_0x0d3b('0x7')](_0x0d3b('0x33'),auth['isAuthenticated'](),controller[_0x0d3b('0x34')]);router[_0x0d3b('0x7')](_0x0d3b('0x35'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x36')]);router[_0x0d3b('0x7')](_0x0d3b('0x37'),auth['isAuthenticated'](),controller[_0x0d3b('0x38')]);router[_0x0d3b('0x7')](_0x0d3b('0x39'),auth[_0x0d3b('0x9')](),controller['whatsappQueuesWaitingInteractions']);router[_0x0d3b('0x7')](_0x0d3b('0x3a'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x3b')]);router[_0x0d3b('0x3c')](_0x0d3b('0x3d'),auth['isAuthenticated'](),controller[_0x0d3b('0x3e')]('mail'));router['get']('/mail/queues/:id',auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x3f')]);router[_0x0d3b('0x3c')](_0x0d3b('0x40'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x3e')](_0x0d3b('0x41')));router[_0x0d3b('0x7')](_0x0d3b('0x42'),auth['isAuthenticated'](),controller[_0x0d3b('0x43')]);router['post']('/fax/queues/:id/notify',auth[_0x0d3b('0x9')](),controller['queueNotify'](_0x0d3b('0x44')));router['get'](_0x0d3b('0x45'),auth['isAuthenticated'](),controller['showFaxQueues']);router['post'](_0x0d3b('0x46'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x3e')]('openchannel'));router[_0x0d3b('0x7')](_0x0d3b('0x47'),auth[_0x0d3b('0x9')](),controller['showOpenchannelQueues']);router[_0x0d3b('0x3c')](_0x0d3b('0x48'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x3e')](_0x0d3b('0x49')));router[_0x0d3b('0x3c')](_0x0d3b('0x4a'),auth['isAuthenticated'](),controller['queueNotify']('whatsapp'));router['get'](_0x0d3b('0x4b'),auth['isAuthenticated'](),controller[_0x0d3b('0x4c')]);router['get'](_0x0d3b('0x4d'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router['post'](_0x0d3b('0x4e'),auth[_0x0d3b('0x9')](),controller[_0x0d3b('0x4f')]);module[_0x0d3b('0x50')]=router; \ No newline at end of file +var _0x8d28=['/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','path','Router','../../components/auth/service','./rpc.controller','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','mailQueues','/openchannel/queues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','/outbound','outbound','outboundChannels','agents'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0x8d28,0xcd));var _0x88d2=function(_0x21353c,_0x2ea587){_0x21353c=_0x21353c-0x0;var _0xa99120=_0x8d28[_0x21353c];return _0xa99120;};'use strict';var multer=require(_0x88d2('0x0'));var util=require('util');var path=require(_0x88d2('0x1'));var express=require('express');var router=express[_0x88d2('0x2')]();var auth=require(_0x88d2('0x3'));var controller=require(_0x88d2('0x4'));router['get']('/voice/channels',auth[_0x88d2('0x5')](),controller[_0x88d2('0x6')]);router[_0x88d2('0x7')](_0x88d2('0x8'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x9')]);router[_0x88d2('0x7')](_0x88d2('0xa'),auth[_0x88d2('0x5')](),controller[_0x88d2('0xb')]);router[_0x88d2('0x7')](_0x88d2('0xc'),auth[_0x88d2('0x5')](),controller['voiceQueues']);router[_0x88d2('0x7')](_0x88d2('0xd'),auth[_0x88d2('0x5')](),controller[_0x88d2('0xe')]);router[_0x88d2('0x7')]('/mail/queues',auth['isAuthenticated'](),controller[_0x88d2('0xf')]);router['get']('/mail/accounts',auth[_0x88d2('0x5')](),controller['mailAccounts']);router[_0x88d2('0x7')](_0x88d2('0x10'),auth[_0x88d2('0x5')](),controller['openchannelQueues']);router['get'](_0x88d2('0x11'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x12')]);router[_0x88d2('0x7')](_0x88d2('0x13'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x14')]);router['get'](_0x88d2('0x15'),auth['isAuthenticated'](),controller['faxQueues']);router[_0x88d2('0x7')](_0x88d2('0x16'),auth['isAuthenticated'](),controller[_0x88d2('0x17')]);router[_0x88d2('0x7')](_0x88d2('0x18'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x19')]);router[_0x88d2('0x7')](_0x88d2('0x1a'),auth['isAuthenticated'](),controller[_0x88d2('0x1b')]);router[_0x88d2('0x7')](_0x88d2('0x1c'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x1d')]);router[_0x88d2('0x7')](_0x88d2('0x1e'),auth[_0x88d2('0x5')](),controller['voiceQueuesChannelRedirect']);router[_0x88d2('0x7')](_0x88d2('0x1f'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x20')]);router[_0x88d2('0x21')](_0x88d2('0x1f'),auth['isAuthenticated'](),controller['updateVoiceQueue']);router[_0x88d2('0x7')](_0x88d2('0x22'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x23')]);router[_0x88d2('0x7')]('/outbound/channels',auth[_0x88d2('0x5')](),controller[_0x88d2('0x24')]);router[_0x88d2('0x7')]('/agents',auth[_0x88d2('0x5')](),controller[_0x88d2('0x25')]);router['put'](_0x88d2('0x26'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x27')]);router[_0x88d2('0x7')](_0x88d2('0x28'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x29')]);router[_0x88d2('0x7')](_0x88d2('0x2a'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x2b')]);router[_0x88d2('0x7')](_0x88d2('0x2c'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x2d')]);router[_0x88d2('0x7')](_0x88d2('0x2e'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x2f')]);router['get'](_0x88d2('0x30'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x31')]);router[_0x88d2('0x7')]('/mail/queues/waitinginteractions',auth[_0x88d2('0x5')](),controller[_0x88d2('0x32')]);router[_0x88d2('0x7')](_0x88d2('0x33'),auth['isAuthenticated'](),controller[_0x88d2('0x34')]);router[_0x88d2('0x7')](_0x88d2('0x35'),auth['isAuthenticated'](),controller[_0x88d2('0x36')]);router[_0x88d2('0x7')](_0x88d2('0x37'),auth['isAuthenticated'](),controller[_0x88d2('0x38')]);router[_0x88d2('0x7')](_0x88d2('0x39'),auth[_0x88d2('0x5')](),controller['whatsappQueuesWaitingInteractions']);router[_0x88d2('0x7')](_0x88d2('0x3a'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x3b')]);router[_0x88d2('0x3c')]('/mail/queues/:id/notify',auth[_0x88d2('0x5')](),controller[_0x88d2('0x3d')](_0x88d2('0x3e')));router[_0x88d2('0x7')]('/mail/queues/:id',auth[_0x88d2('0x5')](),controller[_0x88d2('0x3f')]);router[_0x88d2('0x3c')](_0x88d2('0x40'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x3d')](_0x88d2('0x41')));router[_0x88d2('0x7')](_0x88d2('0x42'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x43')]);router[_0x88d2('0x3c')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x88d2('0x3d')]('fax'));router[_0x88d2('0x7')](_0x88d2('0x44'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x45')]);router[_0x88d2('0x3c')](_0x88d2('0x46'),auth[_0x88d2('0x5')](),controller[_0x88d2('0x3d')](_0x88d2('0x47')));router[_0x88d2('0x7')](_0x88d2('0x48'),auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x88d2('0x3c')](_0x88d2('0x49'),auth[_0x88d2('0x5')](),controller['queueNotify'](_0x88d2('0x4a')));router['post'](_0x88d2('0x4b'),auth[_0x88d2('0x5')](),controller['queueNotify']('whatsapp'));router[_0x88d2('0x7')]('/sms/queues/:id',auth[_0x88d2('0x5')](),controller[_0x88d2('0x4c')]);router['get'](_0x88d2('0x4d'),auth[_0x88d2('0x5')](),controller['showWhatsappQueues']);router[_0x88d2('0x3c')](_0x88d2('0x4e'),auth['isAuthenticated'](),controller[_0x88d2('0x4f')]);module[_0x88d2('0x50')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index f78057b..5b79bbf 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 _0x1095=['InteractionId','From','QueueId','TransferReport','create','Start','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','User','Agent\x20not\x20found','agentTransferTimeout','lodash','util','../../config/logger','http','client','request','error','code','message','result','json','stack','name','status','isNil','rows','find','VoiceChannels','query','then','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','merge','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','INTERACTION','interaction','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','format','SIP/%s','agent','internal','telephones','trunks','campaigns','Campaigns','chatQueues','showChatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId'];(function(_0x119cd9,_0x5f2c6b){var _0x53c8b0=function(_0x498303){while(--_0x498303){_0x119cd9['push'](_0x119cd9['shift']());}};_0x53c8b0(++_0x5f2c6b);}(_0x1095,0x88));var _0x5109=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x1095[_0x2a6809];return _0x11c371;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0x5109('0x0'));var util=require(_0x5109('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0x5109('0x2'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x5109('0x3')]({'port':0x232a});var mailClient=jayson['client'][_0x5109('0x3')]({'port':0x232b});var routingClient=jayson[_0x5109('0x4')][_0x5109('0x3')]({'port':0x232c});function respondWithRpcPromise(_0x2fb127,_0x29d8ad,_0x4d8640){return new BPromise(function(_0x4185af,_0x2830fe){var _0x530ba8=_0x4d8640?_0x4d8640:amiClient;return _0x530ba8[_0x5109('0x5')](_0x2fb127,_0x29d8ad)['then'](function(_0xd42a44){if(_0xd42a44[_0x5109('0x6')]){if(_0xd42a44['error'][_0x5109('0x7')]===0x1f4){return _0x2830fe(_0xd42a44[_0x5109('0x6')][_0x5109('0x8')]);}return _0x4185af(_0xd42a44[_0x5109('0x6')][_0x5109('0x8')]);}else{_0x4185af(_0xd42a44[_0x5109('0x9')]);}})['catch'](function(_0x1e0f73){_0x2830fe(_0x1e0f73);});});}function respondWithResult(_0x39d503,_0xc3a8cc){_0xc3a8cc=_0xc3a8cc||0xc8;return function(_0x1aea2a){if(_0x1aea2a){return _0x39d503['status'](_0xc3a8cc)[_0x5109('0xa')](_0x1aea2a);}return _0x39d503['sendStatus'](0x194);};}function handleError(_0x4d8c4c,_0x1de859){_0x1de859=_0x1de859||0x1f4;return function(_0x14c7fd){logger[_0x5109('0x6')](_0x14c7fd[_0x5109('0xb')]);if(_0x14c7fd[_0x5109('0xc')]){delete _0x14c7fd[_0x5109('0xc')];}_0x4d8c4c[_0x5109('0xd')](_0x1de859)['send'](_0x14c7fd);};}function findById(_0x56fedb){return function(_0x320a78){if(!_[_0x5109('0xe')](_0x56fedb)&&!_[_0x5109('0xe')](_0x320a78)&&!_[_0x5109('0xe')](_0x320a78[_0x5109('0xf')])){return _[_0x5109('0x10')](_0x320a78[_0x5109('0xf')],function(_0x28771e){return _0x28771e['id']==_0x56fedb;});}return null;};}exports['voiceChannels']=function(_0x1b9d52,_0x1863ec){return respondWithRpcPromise(_0x5109('0x11'),_0x1b9d52[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0x1863ec,null))[_0x5109('0x14')](handleError(_0x1863ec,null));};exports[_0x5109('0x15')]=function(_0x404b03,_0x2950de){return respondWithRpcPromise(_0x5109('0x16'),_['merge'](_0x404b03['query'],_0x404b03['params']))[_0x5109('0x13')](respondWithResult(_0x2950de,null))[_0x5109('0x14')](handleError(_0x2950de,null));};exports['voiceChannelStopMixMonitor']=function(_0x882fff,_0x50e519){return respondWithRpcPromise(_0x5109('0x17'),_['merge'](_0x882fff[_0x5109('0x12')],_0x882fff[_0x5109('0x18')]))['then'](respondWithResult(_0x50e519,null))['catch'](handleError(_0x50e519,null));};exports[_0x5109('0x19')]=function(_0x2416f5,_0xe57de6){return respondWithRpcPromise('VoiceQueues',_0x2416f5[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0xe57de6,null))['catch'](handleError(_0xe57de6,null));};exports[_0x5109('0x1a')]=function(_0x1a46ad,_0x4ffb1f){return respondWithRpcPromise(_0x5109('0x1b'),_0x1a46ad['query'])[_0x5109('0x13')](findById(_0x1a46ad['params']['id']))['then'](respondWithResult(_0x4ffb1f,null))[_0x5109('0x14')](handleError(_0x4ffb1f,null));};exports[_0x5109('0x1c')]=function(_0x4cd61a,_0x4fc959){return respondWithRpcPromise(_0x5109('0x1d'),_['merge'](_0x4cd61a[_0x5109('0x1e')],_0x4cd61a[_0x5109('0x18')]))[_0x5109('0x13')](respondWithResult(_0x4fc959,null))[_0x5109('0x14')](handleError(_0x4fc959,null));};exports[_0x5109('0x1f')]=function(_0xffe249,_0x14ae6b){return respondWithRpcPromise(_0x5109('0x20'),_[_0x5109('0x21')](_0xffe249[_0x5109('0x12')],_0xffe249['params']))[_0x5109('0x13')](respondWithResult(_0x14ae6b,null))[_0x5109('0x14')](handleError(_0x14ae6b,null));};exports[_0x5109('0x22')]=function(_0x1fb146,_0x8582e){return respondWithRpcPromise(_0x5109('0x23'),_0x1fb146['query'])['then'](respondWithResult(_0x8582e,null))[_0x5109('0x14')](handleError(_0x8582e,null));};exports[_0x5109('0x24')]=function(_0x5f1dd8,_0x4e1e1e){return respondWithRpcPromise(_0x5109('0x25'),_[_0x5109('0x21')](_0x5f1dd8[_0x5109('0x12')],_0x5f1dd8[_0x5109('0x18')]))[_0x5109('0x13')](respondWithResult(_0x4e1e1e,null))[_0x5109('0x14')](handleError(_0x4e1e1e,null));};exports[_0x5109('0x26')]=function(_0x3e1968,_0x4bf263){return respondWithRpcPromise(_0x5109('0x27'),_[_0x5109('0x21')](_0x3e1968[_0x5109('0x12')],_0x3e1968[_0x5109('0x18')]))[_0x5109('0x13')](respondWithResult(_0x4bf263,null))['catch'](handleError(_0x4bf263,null));};exports[_0x5109('0x28')]=function(_0x28f5ef,_0x3abc91){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x28f5ef[_0x5109('0x12')],_0x28f5ef[_0x5109('0x18')]))[_0x5109('0x13')](respondWithResult(_0x3abc91,null))[_0x5109('0x14')](handleError(_0x3abc91,null));};exports[_0x5109('0x29')]=function(_0x4603d4,_0x45312f){return respondWithRpcPromise(_0x5109('0x2a'),_0x4603d4[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0x45312f,null))[_0x5109('0x14')](handleError(_0x45312f,null));};exports[_0x5109('0x2b')]=function(_0x50051c,_0x4a6508){return respondWithRpcPromise(_0x5109('0x2c'),_0x50051c[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0x4a6508,null))[_0x5109('0x14')](handleError(_0x4a6508,null));};exports[_0x5109('0x2d')]=function(_0x35e281,_0x233b61){var _0x366ed8;return respondWithRpcPromise(_0x5109('0x2e'),_0x35e281[_0x5109('0x12')])[_0x5109('0x13')](function(_0x5c3de5){_0x366ed8=_0x5c3de5;return respondWithRpcPromise(_0x5109('0x2e'),_0x35e281[_0x5109('0x12')],routingClient);})[_0x5109('0x13')](function(_0x3abaf8){return _[_0x5109('0x21')]({},_0x3abaf8,_0x366ed8);})[_0x5109('0x13')](respondWithResult(_0x233b61,null))['catch'](handleError(_0x233b61,null));};exports[_0x5109('0x2f')]=function(_0x506372,_0x31172e){if(_0x506372[_0x5109('0x1e')]&&_0x506372['body']['interaction']&&_0x506372[_0x5109('0x30')]&&_0x506372[_0x5109('0x30')][_0x5109('0xc')]){for(var _0x55340b in _0x506372[_0x5109('0x1e')]['interaction']){if(_0x506372[_0x5109('0x1e')]['interaction'][_0x5109('0x31')](_0x55340b)){db[_0x5109('0x32')]['findAll']({'where':{'channel':_0x55340b,'membername':_0x506372['user']['name'],'type':_0x5109('0x33'),'exitAt':null,'uniqueid':_0x506372[_0x5109('0x1e')]['interaction'][_0x55340b]&&_0x506372[_0x5109('0x1e')][_0x5109('0x34')][_0x55340b][_0x5109('0x35')]?{'$notIn':_0x506372[_0x5109('0x1e')][_0x5109('0x34')][_0x55340b]}:{'$ne':null}}})['then'](function(_0x3783dc){var _0x282d4c=moment()['format'](_0x5109('0x36'));for(var _0x3022dc=0x0,_0x5b79c8=_0x3783dc[_0x5109('0x35')];_0x3022dc<_0x5b79c8;_0x3022dc+=0x1){_0x3783dc[_0x3022dc][_0x5109('0x37')]({'exitAt':_0x282d4c});}});for(var _0x3ae93e=0x0;_0x3ae93e<_0x506372[_0x5109('0x1e')]['interaction'][_0x55340b][_0x5109('0x35')];_0x3ae93e+=0x1){db[_0x5109('0x32')][_0x5109('0x38')]({'where':{'channel':_0x55340b,'membername':_0x506372[_0x5109('0x30')]['name'],'type':'INTERACTION','uniqueid':_0x506372[_0x5109('0x1e')][_0x5109('0x34')][_0x55340b][_0x3ae93e],'exitAt':null},'defaults':{'channel':_0x55340b,'membername':_0x506372[_0x5109('0x30')][_0x5109('0xc')],'interface':_[_0x5109('0xe')](_0x506372[_0x5109('0x30')][_0x5109('0x39')])?util[_0x5109('0x3a')](_0x5109('0x3b'),_0x506372[_0x5109('0x30')]['name']):_0x506372[_0x5109('0x30')]['interface'],'type':'INTERACTION','enterAt':moment()[_0x5109('0x3a')](_0x5109('0x36')),'role':_0x5109('0x3c'),'internal':_0x506372[_0x5109('0x30')][_0x5109('0x3d')],'uniqueid':_0x506372[_0x5109('0x1e')][_0x5109('0x34')][_0x55340b][_0x3ae93e]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x506372[_0x5109('0x18')]['id'],'capacity':_0x506372[_0x5109('0x1e')]['capacity']},routingClient)[_0x5109('0x13')](respondWithResult(_0x31172e,null))['catch'](handleError(_0x31172e,null));};exports[_0x5109('0x3e')]=function(_0x2cdd10,_0xe94d8){return respondWithRpcPromise('Telephones',_0x2cdd10['query'])[_0x5109('0x13')](respondWithResult(_0xe94d8,null))['catch'](handleError(_0xe94d8,null));};exports[_0x5109('0x3f')]=function(_0x46ed51,_0xcb95b9){return respondWithRpcPromise('Trunks',_0x46ed51[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0xcb95b9,null))['catch'](handleError(_0xcb95b9,null));};exports[_0x5109('0x40')]=function(_0x36efd0,_0x428e0f){return respondWithRpcPromise(_0x5109('0x41'),_0x36efd0[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0x428e0f,null))[_0x5109('0x14')](handleError(_0x428e0f,null));};exports[_0x5109('0x42')]=function(_0x37976b,_0x3a0b3d){return respondWithRpcPromise('ChatQueues',_0x37976b[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x3a0b3d,null))[_0x5109('0x14')](handleError(_0x3a0b3d,null));};exports[_0x5109('0x43')]=function(_0x39462a,_0x5dc1ce){return respondWithRpcPromise(_0x5109('0x44'),_0x39462a[_0x5109('0x12')],routingClient)[_0x5109('0x13')](findById(_0x39462a[_0x5109('0x18')]['id']))[_0x5109('0x13')](respondWithResult(_0x5dc1ce,null))['catch'](handleError(_0x5dc1ce,null));};exports[_0x5109('0x45')]=function(_0x120cc5,_0x3a29e9){return respondWithRpcPromise(_0x5109('0x46'),_0x120cc5['query'],routingClient)[_0x5109('0x13')](respondWithResult(_0x3a29e9,null))[_0x5109('0x14')](handleError(_0x3a29e9,null));};exports[_0x5109('0x47')]=function(_0x2e491c,_0x4e6d13){return respondWithRpcPromise(_0x5109('0x46'),_0x2e491c[_0x5109('0x12')],routingClient)['then'](findById(_0x2e491c[_0x5109('0x18')]['id']))[_0x5109('0x13')](respondWithResult(_0x4e6d13,null))[_0x5109('0x14')](handleError(_0x4e6d13,null));};exports[_0x5109('0x48')]=function(_0x51ce9f,_0x5a3b18){return respondWithRpcPromise(_0x5109('0x49'),_0x51ce9f[_0x5109('0x12')],mailClient)[_0x5109('0x13')](respondWithResult(_0x5a3b18,null))[_0x5109('0x14')](handleError(_0x5a3b18,null));};exports['openchannelQueues']=function(_0x224293,_0x119df0){return respondWithRpcPromise(_0x5109('0x4a'),_0x224293[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x119df0,null))[_0x5109('0x14')](handleError(_0x119df0,null));};exports['showOpenchannelQueues']=function(_0x113481,_0x4c0f6a){return respondWithRpcPromise(_0x5109('0x4a'),_0x113481[_0x5109('0x12')],routingClient)[_0x5109('0x13')](findById(_0x113481[_0x5109('0x18')]['id']))['then'](respondWithResult(_0x4c0f6a,null))[_0x5109('0x14')](handleError(_0x4c0f6a,null));};exports[_0x5109('0x4b')]=function(_0x3c8097,_0xd27aa3){return respondWithRpcPromise(_0x5109('0x4c'),_0x3c8097[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0xd27aa3,null))[_0x5109('0x14')](handleError(_0xd27aa3,null));};exports[_0x5109('0x4d')]=function(_0xf71af0,_0x3b44fd){return respondWithRpcPromise(_0x5109('0x4c'),_0xf71af0[_0x5109('0x12')],routingClient)[_0x5109('0x13')](findById(_0xf71af0[_0x5109('0x18')]['id']))[_0x5109('0x13')](respondWithResult(_0x3b44fd,null))['catch'](handleError(_0x3b44fd,null));};exports[_0x5109('0x4e')]=function(_0x491e48,_0x377305){return respondWithRpcPromise(_0x5109('0x4f'),_0x491e48[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x377305,null))[_0x5109('0x14')](handleError(_0x377305,null));};exports['showWhatsappQueues']=function(_0x41a010,_0x344128){return respondWithRpcPromise(_0x5109('0x4f'),_0x41a010[_0x5109('0x12')],routingClient)['then'](findById(_0x41a010[_0x5109('0x18')]['id']))[_0x5109('0x13')](respondWithResult(_0x344128,null))[_0x5109('0x14')](handleError(_0x344128,null));};exports['faxQueues']=function(_0x5840c6,_0x24d63f){return respondWithRpcPromise('FaxQueues',_0x5840c6[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x24d63f,null))[_0x5109('0x14')](handleError(_0x24d63f,null));};exports['showFaxQueues']=function(_0x39da0b,_0x1d076c){return respondWithRpcPromise('FaxQueues',_0x39da0b[_0x5109('0x12')],routingClient)[_0x5109('0x13')](findById(_0x39da0b['params']['id']))[_0x5109('0x13')](respondWithResult(_0x1d076c,null))[_0x5109('0x14')](handleError(_0x1d076c,null));};exports['faxAccounts']=function(_0x11d4e0,_0x3a2258){return respondWithRpcPromise(_0x5109('0x50'),_0x11d4e0[_0x5109('0x12')])[_0x5109('0x13')](respondWithResult(_0x3a2258,null))['catch'](handleError(_0x3a2258,null));};exports[_0x5109('0x51')]=function(_0x3b8044,_0x29cf8e){return respondWithRpcPromise(_0x5109('0x52'),_0x3b8044[_0x5109('0x12')],routingClient)['then'](respondWithResult(_0x29cf8e,null))['catch'](handleError(_0x29cf8e,null));};exports[_0x5109('0x53')]=function(_0x5eecf2,_0x43c5fd){return respondWithRpcPromise(_0x5109('0x54'),_0x5eecf2[_0x5109('0x12')],routingClient)['then'](respondWithResult(_0x43c5fd,null))[_0x5109('0x14')](handleError(_0x43c5fd,null));};exports[_0x5109('0x55')]=function(_0x35da51,_0x2f2476){return respondWithRpcPromise(_0x5109('0x56'),_0x35da51[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x2f2476,null))[_0x5109('0x14')](handleError(_0x2f2476,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x5236d4,_0x3a84e2){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5236d4[_0x5109('0x12')],routingClient)['then'](function(_0x52b04a){if(_0x5236d4['query'][_0x5109('0x57')]!==undefined){var _0x9edcb2=_(_0x52b04a['rows'])[_0x5109('0x58')]([_0x5236d4[_0x5109('0x12')]['type'],_0x5236d4['params']['id']])['map'](_0x5109('0x59'))[_0x5109('0x5a')]()['value']();return _0x52b04a[_0x5109('0xf')][_0x5109('0x58')](function(_0x57ab4b){return _0x9edcb2[_0x5109('0x5b')](_0x57ab4b[_0x5109('0x59')])>-0x1;});}else{return _0x52b04a[_0x5109('0xf')][_0x5109('0x58')](function(_0x281e0c){return _0x281e0c[_0x5109('0x59')]===parseInt(_0x5236d4[_0x5109('0x18')]['id']);});}})[_0x5109('0x13')](respondWithResult(_0x3a84e2,null))[_0x5109('0x14')](handleError(_0x3a84e2,null));};exports[_0x5109('0x5c')]=function(_0x2549f2,_0x2898a0){return respondWithRpcPromise(_0x5109('0x5d'),_0x2549f2['query'],routingClient)[_0x5109('0x13')](respondWithResult(_0x2898a0,null))[_0x5109('0x14')](handleError(_0x2898a0,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x2fee28,_0x198ede){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x2fee28[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x198ede,null))[_0x5109('0x14')](handleError(_0x198ede,null));};exports[_0x5109('0x5e')]=function(_0x4d4f85,_0x1a4cf9){return respondWithRpcPromise(_0x5109('0x5f'),_0x4d4f85[_0x5109('0x12')],routingClient)[_0x5109('0x13')](respondWithResult(_0x1a4cf9,null))[_0x5109('0x14')](handleError(_0x1a4cf9,null));};exports[_0x5109('0x60')]=function(_0x1f955f){return function(_0x4a1013,_0xeaaf21){var _0x5d3d78,_0x42048a;var _0x3931a9=_[_0x5109('0x61')](_0x1f955f);var _0x104123=_0x1f955f===_0x5109('0x62')?_0x5109('0x63'):_0x5109('0x64');return db[_0x3931a9+'Queue'][_0x5109('0x65')]({'raw':!![],'where':{'id':_0x4a1013['params']['id']}})[_0x5109('0x13')](function(_0x1fb57a){if(_[_0x5109('0xe')](_0x1fb57a)){throw new Error(_0x3931a9+_0x5109('0x66'));}_0x5d3d78=_0x1fb57a;return db[_0x3931a9+_0x5109('0x67')][_0x5109('0x65')]({'where':{'id':_0x4a1013[_0x5109('0x1e')][_0x5109('0x68')]},'include':[{'model':db[_0x3931a9+'Interaction'],'as':_0x5109('0x69')},{'model':db[_0x3931a9+_0x104123],'as':_0x5109('0x64')}]});})[_0x5109('0x13')](function(_0x5e2d4f){if(_['isNil'](_0x5e2d4f)){throw new Error(_0x3931a9+_0x5109('0x6a'));}_0x42048a=_0x5e2d4f;return _0x5e2d4f[_0x5109('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x1f1c85={'uniqueid':_0x1f955f+'.'+_0x42048a['id']+'.'+_0x42048a[_0x5109('0x69')]['id'],'FromUserId':_0x4a1013[_0x5109('0x30')]['id'],'type':_0x5109('0x6c')};_0x1f1c85[_0x3931a9+_0x5109('0x6d')]=_0x42048a['id'];_0x1f1c85[_0x3931a9+_0x5109('0x6e')]=_0x42048a[_0x5109('0x69')]['id'];_0x1f1c85[_0x5109('0x6f')+_0x3931a9+_0x104123+'Id']=_0x42048a[_0x5109('0x64')]['id'];_0x1f1c85['To'+_0x3931a9+_0x5109('0x70')]=_0x5d3d78['id'];return db[_0x3931a9+_0x5109('0x71')][_0x5109('0x72')](_0x1f1c85);})[_0x5109('0x13')](function(){return respondWithRpcPromise(_0x5109('0x73'),{'channel':_0x1f955f,'interaction':_0x42048a[_0x5109('0x69')],'message':_0x42048a,'account':_0x42048a[_0x5109('0x64')],'applications':[{'id':0x0,'priority':0x1,'app':_0x5109('0x6c'),'appdata':_0x5d3d78[_0x5109('0xc')]+','+(_0x42048a[_0x5109('0x64')]['queueTransferTimeout']||0x12c),'interval':_0x5109('0x74')}]},routingClient);})[_0x5109('0x13')](respondWithResult(_0xeaaf21,null))['catch'](handleError(_0xeaaf21,null));};};exports[_0x5109('0x75')]=function(_0x2d2301,_0x2c7bf9){var _0x1920de,_0x1d117a;if(_[_0x5109('0xe')](_0x2d2301[_0x5109('0x1e')][_0x5109('0x76')])){throw new Error(_0x5109('0x77'));}var _0x507523=_0x2d2301['body'][_0x5109('0x76')];var _0x176a46=_['capitalize'](_0x507523);var _0x95792c=_0x507523==='chat'?_0x5109('0x63'):_0x5109('0x64');return db[_0x5109('0x78')][_0x5109('0x65')]({'raw':!![],'where':{'id':_0x2d2301[_0x5109('0x18')]['id'],'role':_0x5109('0x3c')}})[_0x5109('0x13')](function(_0x1f6d4a){if(_[_0x5109('0xe')](_0x1f6d4a)){throw new Error(_0x5109('0x79'));}_0x1920de=_0x1f6d4a;return db[_0x176a46+'Message'][_0x5109('0x65')]({'where':{'id':_0x2d2301[_0x5109('0x1e')][_0x5109('0x68')]},'include':[{'model':db[_0x176a46+'Interaction'],'as':'Interaction'},{'model':db[_0x176a46+_0x95792c],'as':_0x5109('0x64')}]});})['then'](function(_0x4cf05f){if(_[_0x5109('0xe')](_0x4cf05f)){throw new Error(_0x176a46+_0x5109('0x6a'));}_0x1d117a=_0x4cf05f;return _0x4cf05f[_0x5109('0x6b')]({'read':0x0,'readAt':null,'UserId':null});})[_0x5109('0x13')](function(){var _0x4ff585={'uniqueid':_0x507523+'.'+_0x1d117a['id']+'.'+_0x1d117a[_0x5109('0x69')]['id'],'FromUserId':_0x2d2301[_0x5109('0x30')]['id'],'type':_0x5109('0x3c'),'ToUserId':_0x1920de['id']};_0x4ff585[_0x176a46+_0x5109('0x6d')]=_0x1d117a['id'];_0x4ff585[_0x176a46+'InteractionId']=_0x1d117a[_0x5109('0x69')]['id'];_0x4ff585['From'+_0x176a46+_0x95792c+'Id']=_0x1d117a[_0x5109('0x64')]['id'];return db[_0x176a46+'TransferReport']['create'](_0x4ff585);})[_0x5109('0x13')](function(){return respondWithRpcPromise(_0x5109('0x73'),{'channel':_0x507523,'interaction':_0x1d117a[_0x5109('0x69')],'message':_0x1d117a,'account':_0x1d117a['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x5109('0x3c'),'appdata':_0x1920de['name']+','+(_0x1d117a[_0x5109('0x64')][_0x5109('0x7a')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})['then'](respondWithResult(_0x2c7bf9,null))['catch'](handleError(_0x2c7bf9,null));}; \ No newline at end of file +var _0x8f55=['moment','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','json','sendStatus','name','send','rows','find','voiceChannels','VoiceChannels','query','catch','merge','VoiceChannelStopMixMonitor','params','voiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','OutboundChannels','agents','Agents','agentCapacity','body','user','interaction','findAll','INTERACTION','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','MemberReport','findOrCreate','isNil','interface','SIP/%s','agent','internal','telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','OpenchannelQueues','showOpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Account','Queue','findOne','messageId','Interaction','queue','MessageId','From','QueueId','create','Start','agentNotify','Channel\x20field\x20is\x20mandatory','channel','chat','User','Agent\x20not\x20found','update','InteractionId','TransferReport','agentTransferTimeout','*,*,*,*','bluebird'];(function(_0x2d6c9a,_0x538b01){var _0x5b45e8=function(_0x17ea1e){while(--_0x17ea1e){_0x2d6c9a['push'](_0x2d6c9a['shift']());}};_0x5b45e8(++_0x538b01);}(_0x8f55,0xfd));var _0x58f5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8f55[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x58f5('0x0'));var moment=require(_0x58f5('0x1'));var _=require(_0x58f5('0x2'));var util=require(_0x58f5('0x3'));var db=require(_0x58f5('0x4'))['db'];var logger=require(_0x58f5('0x5'))(_0x58f5('0x6'));var jayson=require(_0x58f5('0x7'));var amiClient=jayson[_0x58f5('0x8')]['http']({'port':0x232a});var mailClient=jayson[_0x58f5('0x8')]['http']({'port':0x232b});var routingClient=jayson[_0x58f5('0x8')][_0x58f5('0x9')]({'port':0x232c});function respondWithRpcPromise(_0x46a66b,_0x509125,_0x462b74){return new BPromise(function(_0x30b2e7,_0x4a7d99){var _0x5c5795=_0x462b74?_0x462b74:amiClient;return _0x5c5795[_0x58f5('0xa')](_0x46a66b,_0x509125)[_0x58f5('0xb')](function(_0x109097){if(_0x109097[_0x58f5('0xc')]){if(_0x109097[_0x58f5('0xc')][_0x58f5('0xd')]===0x1f4){return _0x4a7d99(_0x109097[_0x58f5('0xc')]['message']);}return _0x30b2e7(_0x109097['error'][_0x58f5('0xe')]);}else{_0x30b2e7(_0x109097[_0x58f5('0xf')]);}})['catch'](function(_0x5aaf3){_0x4a7d99(_0x5aaf3);});});}function respondWithResult(_0x44f654,_0x365667){_0x365667=_0x365667||0xc8;return function(_0x24e7a2){if(_0x24e7a2){return _0x44f654['status'](_0x365667)[_0x58f5('0x10')](_0x24e7a2);}return _0x44f654[_0x58f5('0x11')](0x194);};}function handleError(_0x5a262b,_0x2e9058){_0x2e9058=_0x2e9058||0x1f4;return function(_0x18519a){logger[_0x58f5('0xc')](_0x18519a['stack']);if(_0x18519a[_0x58f5('0x12')]){delete _0x18519a[_0x58f5('0x12')];}_0x5a262b['status'](_0x2e9058)[_0x58f5('0x13')](_0x18519a);};}function findById(_0x42cfd7){return function(_0x117e5b){if(!_['isNil'](_0x42cfd7)&&!_['isNil'](_0x117e5b)&&!_['isNil'](_0x117e5b[_0x58f5('0x14')])){return _[_0x58f5('0x15')](_0x117e5b['rows'],function(_0x30869d){return _0x30869d['id']==_0x42cfd7;});}return null;};}exports[_0x58f5('0x16')]=function(_0x1d3035,_0x1163e0){return respondWithRpcPromise(_0x58f5('0x17'),_0x1d3035[_0x58f5('0x18')])[_0x58f5('0xb')](respondWithResult(_0x1163e0,null))[_0x58f5('0x19')](handleError(_0x1163e0,null));};exports['voiceChannelMixMonitor']=function(_0x830a71,_0x491e42){return respondWithRpcPromise('VoiceChannelMixMonitor',_[_0x58f5('0x1a')](_0x830a71[_0x58f5('0x18')],_0x830a71['params']))[_0x58f5('0xb')](respondWithResult(_0x491e42,null))['catch'](handleError(_0x491e42,null));};exports['voiceChannelStopMixMonitor']=function(_0x1a2b91,_0x2f5db2){return respondWithRpcPromise(_0x58f5('0x1b'),_['merge'](_0x1a2b91['query'],_0x1a2b91[_0x58f5('0x1c')]))[_0x58f5('0xb')](respondWithResult(_0x2f5db2,null))[_0x58f5('0x19')](handleError(_0x2f5db2,null));};exports[_0x58f5('0x1d')]=function(_0x25a520,_0x550c2c){return respondWithRpcPromise('VoiceQueues',_0x25a520[_0x58f5('0x18')])[_0x58f5('0xb')](respondWithResult(_0x550c2c,null))['catch'](handleError(_0x550c2c,null));};exports[_0x58f5('0x1e')]=function(_0x1fea9d,_0x4b4f5c){return respondWithRpcPromise('VoiceQueues',_0x1fea9d[_0x58f5('0x18')])[_0x58f5('0xb')](findById(_0x1fea9d[_0x58f5('0x1c')]['id']))['then'](respondWithResult(_0x4b4f5c,null))[_0x58f5('0x19')](handleError(_0x4b4f5c,null));};exports[_0x58f5('0x1f')]=function(_0x148be2,_0x51b874){return respondWithRpcPromise(_0x58f5('0x20'),_[_0x58f5('0x1a')](_0x148be2['body'],_0x148be2[_0x58f5('0x1c')]))['then'](respondWithResult(_0x51b874,null))[_0x58f5('0x19')](handleError(_0x51b874,null));};exports[_0x58f5('0x21')]=function(_0x98b122,_0x234e4c){return respondWithRpcPromise(_0x58f5('0x22'),_[_0x58f5('0x1a')](_0x98b122[_0x58f5('0x18')],_0x98b122[_0x58f5('0x1c')]))[_0x58f5('0xb')](respondWithResult(_0x234e4c,null))['catch'](handleError(_0x234e4c,null));};exports['voiceQueuesChannels']=function(_0x5e8c78,_0x1e0b72){return respondWithRpcPromise('VoiceQueuesChannels',_0x5e8c78[_0x58f5('0x18')])[_0x58f5('0xb')](respondWithResult(_0x1e0b72,null))['catch'](handleError(_0x1e0b72,null));};exports[_0x58f5('0x23')]=function(_0x2e3b78,_0x5954b3){return respondWithRpcPromise(_0x58f5('0x24'),_['merge'](_0x2e3b78['query'],_0x2e3b78[_0x58f5('0x1c')]))[_0x58f5('0xb')](respondWithResult(_0x5954b3,null))['catch'](handleError(_0x5954b3,null));};exports[_0x58f5('0x25')]=function(_0x2d41ed,_0x31a63b){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x58f5('0x1a')](_0x2d41ed['query'],_0x2d41ed[_0x58f5('0x1c')]))[_0x58f5('0xb')](respondWithResult(_0x31a63b,null))[_0x58f5('0x19')](handleError(_0x31a63b,null));};exports[_0x58f5('0x26')]=function(_0x4e564b,_0x42db6c){return respondWithRpcPromise(_0x58f5('0x27'),_[_0x58f5('0x1a')](_0x4e564b['query'],_0x4e564b[_0x58f5('0x1c')]))[_0x58f5('0xb')](respondWithResult(_0x42db6c,null))[_0x58f5('0x19')](handleError(_0x42db6c,null));};exports[_0x58f5('0x28')]=function(_0x1abe5d,_0x4e2bbd){return respondWithRpcPromise(_0x58f5('0x29'),_0x1abe5d['query'])[_0x58f5('0xb')](respondWithResult(_0x4e2bbd,null))[_0x58f5('0x19')](handleError(_0x4e2bbd,null));};exports['outboundChannels']=function(_0x37c7fd,_0x22f8e7){return respondWithRpcPromise(_0x58f5('0x2a'),_0x37c7fd[_0x58f5('0x18')])[_0x58f5('0xb')](respondWithResult(_0x22f8e7,null))[_0x58f5('0x19')](handleError(_0x22f8e7,null));};exports[_0x58f5('0x2b')]=function(_0x30986f,_0x56f7d1){var _0x43769d;return respondWithRpcPromise(_0x58f5('0x2c'),_0x30986f['query'])['then'](function(_0x5a7046){_0x43769d=_0x5a7046;return respondWithRpcPromise(_0x58f5('0x2c'),_0x30986f[_0x58f5('0x18')],routingClient);})[_0x58f5('0xb')](function(_0x5c95d5){return _[_0x58f5('0x1a')]({},_0x5c95d5,_0x43769d);})[_0x58f5('0xb')](respondWithResult(_0x56f7d1,null))[_0x58f5('0x19')](handleError(_0x56f7d1,null));};exports[_0x58f5('0x2d')]=function(_0x73527b,_0x84c5d6){if(_0x73527b[_0x58f5('0x2e')]&&_0x73527b['body']['interaction']&&_0x73527b[_0x58f5('0x2f')]&&_0x73527b[_0x58f5('0x2f')][_0x58f5('0x12')]){for(var _0x58d139 in _0x73527b[_0x58f5('0x2e')][_0x58f5('0x30')]){if(_0x73527b[_0x58f5('0x2e')][_0x58f5('0x30')]['hasOwnProperty'](_0x58d139)){db['MemberReport'][_0x58f5('0x31')]({'where':{'channel':_0x58d139,'membername':_0x73527b[_0x58f5('0x2f')][_0x58f5('0x12')],'type':_0x58f5('0x32'),'exitAt':null,'uniqueid':_0x73527b['body']['interaction'][_0x58d139]&&_0x73527b[_0x58f5('0x2e')]['interaction'][_0x58d139]['length']?{'$notIn':_0x73527b['body'][_0x58f5('0x30')][_0x58d139]}:{'$ne':null}}})['then'](function(_0x2e0622){var _0x187550=moment()[_0x58f5('0x33')](_0x58f5('0x34'));for(var _0xa8e4ab=0x0,_0x3f6739=_0x2e0622[_0x58f5('0x35')];_0xa8e4ab<_0x3f6739;_0xa8e4ab+=0x1){_0x2e0622[_0xa8e4ab][_0x58f5('0x36')]({'exitAt':_0x187550});}});for(var _0x48e767=0x0;_0x48e767<_0x73527b[_0x58f5('0x2e')][_0x58f5('0x30')][_0x58d139][_0x58f5('0x35')];_0x48e767+=0x1){db[_0x58f5('0x37')][_0x58f5('0x38')]({'where':{'channel':_0x58d139,'membername':_0x73527b['user'][_0x58f5('0x12')],'type':'INTERACTION','uniqueid':_0x73527b[_0x58f5('0x2e')]['interaction'][_0x58d139][_0x48e767],'exitAt':null},'defaults':{'channel':_0x58d139,'membername':_0x73527b[_0x58f5('0x2f')][_0x58f5('0x12')],'interface':_[_0x58f5('0x39')](_0x73527b[_0x58f5('0x2f')][_0x58f5('0x3a')])?util[_0x58f5('0x33')](_0x58f5('0x3b'),_0x73527b[_0x58f5('0x2f')]['name']):_0x73527b[_0x58f5('0x2f')]['interface'],'type':_0x58f5('0x32'),'enterAt':moment()['format'](_0x58f5('0x34')),'role':_0x58f5('0x3c'),'internal':_0x73527b[_0x58f5('0x2f')][_0x58f5('0x3d')],'uniqueid':_0x73527b[_0x58f5('0x2e')][_0x58f5('0x30')][_0x58d139][_0x48e767]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x73527b['params']['id'],'capacity':_0x73527b[_0x58f5('0x2e')]['capacity']},routingClient)['then'](respondWithResult(_0x84c5d6,null))[_0x58f5('0x19')](handleError(_0x84c5d6,null));};exports[_0x58f5('0x3e')]=function(_0x232d1b,_0x36920a){return respondWithRpcPromise('Telephones',_0x232d1b[_0x58f5('0x18')])[_0x58f5('0xb')](respondWithResult(_0x36920a,null))[_0x58f5('0x19')](handleError(_0x36920a,null));};exports[_0x58f5('0x3f')]=function(_0x3ebda5,_0x3a522a){return respondWithRpcPromise(_0x58f5('0x40'),_0x3ebda5['query'])[_0x58f5('0xb')](respondWithResult(_0x3a522a,null))[_0x58f5('0x19')](handleError(_0x3a522a,null));};exports['campaigns']=function(_0x184fd3,_0x4d5c89){return respondWithRpcPromise(_0x58f5('0x41'),_0x184fd3[_0x58f5('0x18')])[_0x58f5('0xb')](respondWithResult(_0x4d5c89,null))[_0x58f5('0x19')](handleError(_0x4d5c89,null));};exports[_0x58f5('0x42')]=function(_0x17a2ac,_0x195aba){return respondWithRpcPromise(_0x58f5('0x43'),_0x17a2ac['query'],routingClient)[_0x58f5('0xb')](respondWithResult(_0x195aba,null))[_0x58f5('0x19')](handleError(_0x195aba,null));};exports[_0x58f5('0x44')]=function(_0x233f0a,_0x48e6a7){return respondWithRpcPromise(_0x58f5('0x43'),_0x233f0a['query'],routingClient)['then'](findById(_0x233f0a[_0x58f5('0x1c')]['id']))[_0x58f5('0xb')](respondWithResult(_0x48e6a7,null))[_0x58f5('0x19')](handleError(_0x48e6a7,null));};exports[_0x58f5('0x45')]=function(_0x4ea48b,_0x16625a){return respondWithRpcPromise(_0x58f5('0x46'),_0x4ea48b[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](respondWithResult(_0x16625a,null))['catch'](handleError(_0x16625a,null));};exports[_0x58f5('0x47')]=function(_0x1be391,_0x2a7380){return respondWithRpcPromise('MailQueues',_0x1be391[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](findById(_0x1be391['params']['id']))[_0x58f5('0xb')](respondWithResult(_0x2a7380,null))[_0x58f5('0x19')](handleError(_0x2a7380,null));};exports[_0x58f5('0x48')]=function(_0x2c3ae2,_0x5062ba){return respondWithRpcPromise(_0x58f5('0x49'),_0x2c3ae2[_0x58f5('0x18')],mailClient)[_0x58f5('0xb')](respondWithResult(_0x5062ba,null))[_0x58f5('0x19')](handleError(_0x5062ba,null));};exports['openchannelQueues']=function(_0x336499,_0x1a77a6){return respondWithRpcPromise(_0x58f5('0x4a'),_0x336499[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](respondWithResult(_0x1a77a6,null))[_0x58f5('0x19')](handleError(_0x1a77a6,null));};exports[_0x58f5('0x4b')]=function(_0x16ed58,_0x38a016){return respondWithRpcPromise('OpenchannelQueues',_0x16ed58[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](findById(_0x16ed58[_0x58f5('0x1c')]['id']))[_0x58f5('0xb')](respondWithResult(_0x38a016,null))[_0x58f5('0x19')](handleError(_0x38a016,null));};exports[_0x58f5('0x4c')]=function(_0x1b64a4,_0x4972b4){return respondWithRpcPromise('SmsQueues',_0x1b64a4['query'],routingClient)[_0x58f5('0xb')](respondWithResult(_0x4972b4,null))[_0x58f5('0x19')](handleError(_0x4972b4,null));};exports[_0x58f5('0x4d')]=function(_0x475971,_0x412986){return respondWithRpcPromise(_0x58f5('0x4e'),_0x475971[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](findById(_0x475971[_0x58f5('0x1c')]['id']))[_0x58f5('0xb')](respondWithResult(_0x412986,null))[_0x58f5('0x19')](handleError(_0x412986,null));};exports[_0x58f5('0x4f')]=function(_0x5bda5b,_0x2300d1){return respondWithRpcPromise(_0x58f5('0x50'),_0x5bda5b[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](respondWithResult(_0x2300d1,null))['catch'](handleError(_0x2300d1,null));};exports[_0x58f5('0x51')]=function(_0xf26c4e,_0x366747){return respondWithRpcPromise('WhatsappQueues',_0xf26c4e[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](findById(_0xf26c4e[_0x58f5('0x1c')]['id']))[_0x58f5('0xb')](respondWithResult(_0x366747,null))[_0x58f5('0x19')](handleError(_0x366747,null));};exports[_0x58f5('0x52')]=function(_0x27595d,_0x14101b){return respondWithRpcPromise(_0x58f5('0x53'),_0x27595d[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](respondWithResult(_0x14101b,null))[_0x58f5('0x19')](handleError(_0x14101b,null));};exports[_0x58f5('0x54')]=function(_0x27834b,_0x17ac92){return respondWithRpcPromise('FaxQueues',_0x27834b['query'],routingClient)[_0x58f5('0xb')](findById(_0x27834b[_0x58f5('0x1c')]['id']))[_0x58f5('0xb')](respondWithResult(_0x17ac92,null))[_0x58f5('0x19')](handleError(_0x17ac92,null));};exports[_0x58f5('0x55')]=function(_0x55bc11,_0x96ca89){return respondWithRpcPromise('FaxAccounts',_0x55bc11['query'])[_0x58f5('0xb')](respondWithResult(_0x96ca89,null))[_0x58f5('0x19')](handleError(_0x96ca89,null));};exports[_0x58f5('0x56')]=function(_0x5d4eed,_0x28d873){return respondWithRpcPromise(_0x58f5('0x57'),_0x5d4eed[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](respondWithResult(_0x28d873,null))['catch'](handleError(_0x28d873,null));};exports[_0x58f5('0x58')]=function(_0x3a5adc,_0x207453){return respondWithRpcPromise(_0x58f5('0x59'),_0x3a5adc[_0x58f5('0x18')],routingClient)['then'](respondWithResult(_0x207453,null))[_0x58f5('0x19')](handleError(_0x207453,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x226c7a,_0x4586b3){return respondWithRpcPromise(_0x58f5('0x5a'),_0x226c7a['query'],routingClient)[_0x58f5('0xb')](respondWithResult(_0x4586b3,null))[_0x58f5('0x19')](handleError(_0x4586b3,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4bdf0c,_0x4451a3){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4bdf0c[_0x58f5('0x18')],routingClient)['then'](function(_0x30bc77){if(_0x4bdf0c['query'][_0x58f5('0x5b')]!==undefined){var _0x13b23d=_(_0x30bc77[_0x58f5('0x14')])[_0x58f5('0x5c')]([_0x4bdf0c['query'][_0x58f5('0x5b')],_0x4bdf0c[_0x58f5('0x1c')]['id']])[_0x58f5('0x5d')](_0x58f5('0x5e'))[_0x58f5('0x5f')]()[_0x58f5('0x60')]();return _0x30bc77[_0x58f5('0x14')][_0x58f5('0x5c')](function(_0x224339){return _0x13b23d[_0x58f5('0x61')](_0x224339[_0x58f5('0x5e')])>-0x1;});}else{return _0x30bc77[_0x58f5('0x14')][_0x58f5('0x5c')](function(_0x2b4036){return _0x2b4036[_0x58f5('0x5e')]===parseInt(_0x4bdf0c['params']['id']);});}})[_0x58f5('0xb')](respondWithResult(_0x4451a3,null))[_0x58f5('0x19')](handleError(_0x4451a3,null));};exports['smsQueuesWaitingInteractions']=function(_0x7b26ba,_0x5a6373){return respondWithRpcPromise(_0x58f5('0x62'),_0x7b26ba[_0x58f5('0x18')],routingClient)[_0x58f5('0xb')](respondWithResult(_0x5a6373,null))[_0x58f5('0x19')](handleError(_0x5a6373,null));};exports[_0x58f5('0x63')]=function(_0x4b093a,_0x27116a){return respondWithRpcPromise(_0x58f5('0x64'),_0x4b093a['query'],routingClient)['then'](respondWithResult(_0x27116a,null))[_0x58f5('0x19')](handleError(_0x27116a,null));};exports['faxQueuesWaitingInteractions']=function(_0x5a1652,_0x475a79){return respondWithRpcPromise(_0x58f5('0x65'),_0x5a1652['query'],routingClient)[_0x58f5('0xb')](respondWithResult(_0x475a79,null))[_0x58f5('0x19')](handleError(_0x475a79,null));};exports[_0x58f5('0x66')]=function(_0x48f203){return function(_0x4f5149,_0x5964c5){var _0x17f646,_0x356912;var _0x207c31=_[_0x58f5('0x67')](_0x48f203);var _0x5193fc=_0x48f203==='chat'?_0x58f5('0x68'):_0x58f5('0x69');return db[_0x207c31+_0x58f5('0x6a')][_0x58f5('0x6b')]({'raw':!![],'where':{'id':_0x4f5149[_0x58f5('0x1c')]['id']}})[_0x58f5('0xb')](function(_0x421cec){if(_[_0x58f5('0x39')](_0x421cec)){throw new Error(_0x207c31+'\x20Queue\x20not\x20found');}_0x17f646=_0x421cec;return db[_0x207c31+'Message'][_0x58f5('0x6b')]({'where':{'id':_0x4f5149[_0x58f5('0x2e')][_0x58f5('0x6c')]},'include':[{'model':db[_0x207c31+_0x58f5('0x6d')],'as':_0x58f5('0x6d')},{'model':db[_0x207c31+_0x5193fc],'as':_0x58f5('0x69')}]});})[_0x58f5('0xb')](function(_0x5e34db){if(_[_0x58f5('0x39')](_0x5e34db)){throw new Error(_0x207c31+'\x20Message\x20not\x20found');}_0x356912=_0x5e34db;return _0x5e34db['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xa1e2ca={'uniqueid':_0x48f203+'.'+_0x356912['id']+'.'+_0x356912[_0x58f5('0x6d')]['id'],'FromUserId':_0x4f5149[_0x58f5('0x2f')]['id'],'type':_0x58f5('0x6e')};_0xa1e2ca[_0x207c31+_0x58f5('0x6f')]=_0x356912['id'];_0xa1e2ca[_0x207c31+'InteractionId']=_0x356912[_0x58f5('0x6d')]['id'];_0xa1e2ca[_0x58f5('0x70')+_0x207c31+_0x5193fc+'Id']=_0x356912['Account']['id'];_0xa1e2ca['To'+_0x207c31+_0x58f5('0x71')]=_0x17f646['id'];return db[_0x207c31+'TransferReport'][_0x58f5('0x72')](_0xa1e2ca);})[_0x58f5('0xb')](function(){return respondWithRpcPromise(_0x58f5('0x73'),{'channel':_0x48f203,'interaction':_0x356912[_0x58f5('0x6d')],'message':_0x356912,'account':_0x356912[_0x58f5('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':_0x58f5('0x6e'),'appdata':_0x17f646[_0x58f5('0x12')]+','+(_0x356912['Account']['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x58f5('0xb')](respondWithResult(_0x5964c5,null))[_0x58f5('0x19')](handleError(_0x5964c5,null));};};exports[_0x58f5('0x74')]=function(_0x2b4ea1,_0x531d59){var _0x7395dd,_0x58234d;if(_['isNil'](_0x2b4ea1[_0x58f5('0x2e')]['channel'])){throw new Error(_0x58f5('0x75'));}var _0x5d245f=_0x2b4ea1[_0x58f5('0x2e')][_0x58f5('0x76')];var _0x21582a=_[_0x58f5('0x67')](_0x5d245f);var _0x5ed468=_0x5d245f===_0x58f5('0x77')?_0x58f5('0x68'):_0x58f5('0x69');return db[_0x58f5('0x78')][_0x58f5('0x6b')]({'raw':!![],'where':{'id':_0x2b4ea1[_0x58f5('0x1c')]['id'],'role':_0x58f5('0x3c')}})[_0x58f5('0xb')](function(_0x5cfa82){if(_[_0x58f5('0x39')](_0x5cfa82)){throw new Error(_0x58f5('0x79'));}_0x7395dd=_0x5cfa82;return db[_0x21582a+'Message'][_0x58f5('0x6b')]({'where':{'id':_0x2b4ea1[_0x58f5('0x2e')][_0x58f5('0x6c')]},'include':[{'model':db[_0x21582a+_0x58f5('0x6d')],'as':_0x58f5('0x6d')},{'model':db[_0x21582a+_0x5ed468],'as':_0x58f5('0x69')}]});})[_0x58f5('0xb')](function(_0x2bfe39){if(_[_0x58f5('0x39')](_0x2bfe39)){throw new Error(_0x21582a+'\x20Message\x20not\x20found');}_0x58234d=_0x2bfe39;return _0x2bfe39[_0x58f5('0x7a')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x550005={'uniqueid':_0x5d245f+'.'+_0x58234d['id']+'.'+_0x58234d[_0x58f5('0x6d')]['id'],'FromUserId':_0x2b4ea1[_0x58f5('0x2f')]['id'],'type':_0x58f5('0x3c'),'ToUserId':_0x7395dd['id']};_0x550005[_0x21582a+'MessageId']=_0x58234d['id'];_0x550005[_0x21582a+_0x58f5('0x7b')]=_0x58234d[_0x58f5('0x6d')]['id'];_0x550005[_0x58f5('0x70')+_0x21582a+_0x5ed468+'Id']=_0x58234d[_0x58f5('0x69')]['id'];return db[_0x21582a+_0x58f5('0x7c')][_0x58f5('0x72')](_0x550005);})['then'](function(){return respondWithRpcPromise(_0x58f5('0x73'),{'channel':_0x5d245f,'interaction':_0x58234d[_0x58f5('0x6d')],'message':_0x58234d,'account':_0x58234d[_0x58f5('0x69')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x7395dd[_0x58f5('0x12')]+','+(_0x58234d[_0x58f5('0x69')][_0x58f5('0x7d')]||0x12c),'interval':_0x58f5('0x7e')}]},routingClient);})[_0x58f5('0xb')](respondWithResult(_0x531d59,null))[_0x58f5('0x19')](handleError(_0x531d59,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 586dab5..4bd4b4f 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 _0xf62e=['../../config/environment','isAuthenticated','/:id','show','get','/:id/run','run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x177a1a,_0x1ee104){var _0x25e096=function(_0x1946ad){while(--_0x1946ad){_0x177a1a['push'](_0x177a1a['shift']());}};_0x25e096(++_0x1ee104);}(_0xf62e,0xc1));var _0xef62=function(_0xe8d593,_0x4c69dc){_0xe8d593=_0xe8d593-0x0;var _0x212d07=_0xf62e[_0xe8d593];return _0x212d07;};'use strict';var multer=require(_0xef62('0x0'));var util=require(_0xef62('0x1'));var path=require(_0xef62('0x2'));var timeout=require(_0xef62('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xef62('0x4'));var auth=require(_0xef62('0x5'));var interaction=require(_0xef62('0x6'));var config=require(_0xef62('0x7'));var controller=require('./schedule.controller');router['get']('/',auth[_0xef62('0x8')](),controller['index']);router['get'](_0xef62('0x9'),auth['isAuthenticated'](),controller[_0xef62('0xa')]);router[_0xef62('0xb')](_0xef62('0xc'),auth[_0xef62('0x8')](),controller[_0xef62('0xd')]);router[_0xef62('0xe')]('/',auth[_0xef62('0x8')](),controller[_0xef62('0xf')]);router[_0xef62('0x10')](_0xef62('0x9'),auth[_0xef62('0x8')](),controller[_0xef62('0x11')]);router[_0xef62('0x12')](_0xef62('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xef62('0x13')]=router; \ No newline at end of file +var _0x9f94=['post','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x9f94,0x1e9));var _0x49f9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9f94[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var path=require(_0x49f9('0x2'));var timeout=require(_0x49f9('0x3'));var express=require('express');var router=express[_0x49f9('0x4')]();var fs_extra=require(_0x49f9('0x5'));var auth=require(_0x49f9('0x6'));var interaction=require(_0x49f9('0x7'));var config=require(_0x49f9('0x8'));var controller=require(_0x49f9('0x9'));router['get']('/',auth[_0x49f9('0xa')](),controller[_0x49f9('0xb')]);router['get'](_0x49f9('0xc'),auth['isAuthenticated'](),controller[_0x49f9('0xd')]);router[_0x49f9('0xe')](_0x49f9('0xf'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x10')]);router[_0x49f9('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x49f9('0x12')](_0x49f9('0xc'),auth[_0x49f9('0xa')](),controller[_0x49f9('0x13')]);router[_0x49f9('0x14')](_0x49f9('0xc'),auth[_0x49f9('0xa')](),controller['destroy']);module[_0x49f9('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 545266b..957463e 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 _0x9da8=['BOOLEAN','DATE','INTEGER','weeks','days','hours','ENUM','pdf','csv','custom','TEXT','sequelize','exports','STRING'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9da8,0x1e7));var _0x89da=function(_0x31c04d,_0x59a5d5){_0x31c04d=_0x31c04d-0x0;var _0x3fd81b=_0x9da8[_0x31c04d];return _0x3fd81b;};'use strict';var Sequelize=require(_0x89da('0x0'));module[_0x89da('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x89da('0x2')]},'active':{'type':Sequelize[_0x89da('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x89da('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x89da('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x89da('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x89da('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM']('years','quarters','months',_0x89da('0x6'),_0x89da('0x7'),_0x89da('0x8'),'minutes'),'allowNull':![],'defaultValue':_0x89da('0x7')},'output':{'type':Sequelize[_0x89da('0x9')]('csv',_0x89da('0xa'),'xlsx'),'allowNull':![],'defaultValue':_0x89da('0xb')},'type':{'type':Sequelize['ENUM'](_0x89da('0xc'),'default'),'allowNull':![],'defaultValue':_0x89da('0xc')},'sendMail':{'type':Sequelize[_0x89da('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x89da('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x89da('0xd')]},'sendIfEmpty':{'type':Sequelize[_0x89da('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3d20=['default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','hours','minutes','days','csv','xlsx','custom'];(function(_0x48c4e5,_0x48ba02){var _0x5f58af=function(_0x186e32){while(--_0x186e32){_0x48c4e5['push'](_0x48c4e5['shift']());}};_0x5f58af(++_0x48ba02);}(_0x3d20,0xc0));var _0x03d2=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x3d20[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x03d2('0x0'));module[_0x03d2('0x1')]={'name':{'type':Sequelize[_0x03d2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x03d2('0x2')]},'active':{'type':Sequelize[_0x03d2('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x03d2('0x2')],'allowNull':![],'defaultValue':_0x03d2('0x4')},'startAt':{'type':Sequelize[_0x03d2('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x03d2('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x03d2('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x03d2('0x7')]('years',_0x03d2('0x8'),_0x03d2('0x9'),_0x03d2('0xa'),'days',_0x03d2('0xb'),_0x03d2('0xc')),'allowNull':![],'defaultValue':_0x03d2('0xd')},'output':{'type':Sequelize['ENUM'](_0x03d2('0xe'),'pdf',_0x03d2('0xf')),'allowNull':![],'defaultValue':_0x03d2('0xe')},'type':{'type':Sequelize[_0x03d2('0x7')](_0x03d2('0x10'),_0x03d2('0x11')),'allowNull':![],'defaultValue':_0x03d2('0x10')},'sendMail':{'type':Sequelize[_0x03d2('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x03d2('0x2')]},'cc':{'type':Sequelize[_0x03d2('0x12')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x03d2('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 24b01f7..b6edfde 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 _0x0f43=['UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','run','../../config/schedule','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','error','stack','name','send','index','map','Schedule','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','user','role'];(function(_0x2b1c89,_0x399b27){var _0x1d495e=function(_0x7eea0){while(--_0x7eea0){_0x2b1c89['push'](_0x2b1c89['shift']());}};_0x1d495e(++_0x399b27);}(_0x0f43,0xab));var _0x30f4=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0x0f43[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x30f4('0x0'));var rp=require('request-promise');var moment=require(_0x30f4('0x1'));var BPromise=require(_0x30f4('0x2'));var Mustache=require('mustache');var util=require(_0x30f4('0x3'));var path=require(_0x30f4('0x4'));var sox=require(_0x30f4('0x5'));var csv=require(_0x30f4('0x6'));var ejs=require(_0x30f4('0x7'));var fs=require('fs');var fs_extra=require(_0x30f4('0x8'));var _=require('lodash');var squel=require(_0x30f4('0x9'));var crypto=require('crypto');var jsforce=require(_0x30f4('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x30f4('0xb'));var Papa=require('papaparse');var Redis=require(_0x30f4('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x30f4('0xd'));var as=require(_0x30f4('0xe'));var hardwareService=require(_0x30f4('0xf'));var logger=require(_0x30f4('0x10'))(_0x30f4('0x11'));var utils=require(_0x30f4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x30f4('0x13'));var db=require(_0x30f4('0x14'))['db'];function respondWithStatusCode(_0x45b055,_0x5c6b6f){_0x5c6b6f=_0x5c6b6f||0xcc;return function(_0x436b1f){if(_0x436b1f){return _0x45b055[_0x30f4('0x15')](_0x5c6b6f);}return _0x45b055[_0x30f4('0x16')](_0x5c6b6f)[_0x30f4('0x17')]();};}function respondWithResult(_0x51a184,_0x918767){_0x918767=_0x918767||0xc8;return function(_0xb2177b){if(_0xb2177b){return _0x51a184[_0x30f4('0x16')](_0x918767)['json'](_0xb2177b);}};}function respondWithFilteredResult(_0x47d65d,_0x31a9aa){return function(_0x2045f8){if(_0x2045f8){var _0x3bf38f=typeof _0x31a9aa[_0x30f4('0x18')]===_0x30f4('0x19')&&typeof _0x31a9aa['limit']===_0x30f4('0x19');var _0xaec24a=_0x2045f8[_0x30f4('0x1a')];var _0x5b09d3=_0x3bf38f?0x0:_0x31a9aa[_0x30f4('0x18')];var _0x61aec0=_0x3bf38f?_0x2045f8[_0x30f4('0x1a')]:_0x31a9aa[_0x30f4('0x18')]+_0x31a9aa[_0x30f4('0x1b')];var _0x348181;if(_0x61aec0>=_0xaec24a){_0x61aec0=_0xaec24a;_0x348181=0xc8;}else{_0x348181=0xce;}_0x47d65d[_0x30f4('0x16')](_0x348181);return _0x47d65d['set'](_0x30f4('0x1c'),_0x5b09d3+'-'+_0x61aec0+'/'+_0xaec24a)[_0x30f4('0x1d')](_0x2045f8);}return null;};}function patchUpdates(_0x1b0826){return function(_0x463d17){try{jsonpatch[_0x30f4('0x1e')](_0x463d17,_0x1b0826,!![]);}catch(_0xdff1c8){return BPromise[_0x30f4('0x1f')](_0xdff1c8);}return _0x463d17[_0x30f4('0x20')]();};}function saveUpdates(_0x243a64,_0x419276){return function(_0x5c9dff){if(_0x5c9dff){return _0x5c9dff[_0x30f4('0x21')](_0x243a64)[_0x30f4('0x22')](function(_0x5338c6){return _0x5338c6;});}return null;};}function removeEntity(_0x199204,_0x21c4fb){return function(_0x4c39b3){if(_0x4c39b3){return _0x4c39b3['destroy']()['then'](function(){var _0x5daab2=_0x4c39b3[_0x30f4('0x23')]({'plain':!![]});var _0x59704c=_0x30f4('0x24');return db[_0x30f4('0x25')][_0x30f4('0x26')]({'where':{'type':_0x59704c,'resourceId':_0x5daab2['id']}})['then'](function(){return _0x4c39b3;});})[_0x30f4('0x22')](function(){_0x199204['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbc5b9d,_0x3fb749){return function(_0xdda3ce){if(!_0xdda3ce){_0xbc5b9d[_0x30f4('0x15')](0x194);}return _0xdda3ce;};}function handleError(_0x319b84,_0x1a503e){_0x1a503e=_0x1a503e||0x1f4;return function(_0x2f5e3b){logger[_0x30f4('0x27')](_0x2f5e3b[_0x30f4('0x28')]);if(_0x2f5e3b[_0x30f4('0x29')]){delete _0x2f5e3b['name'];}_0x319b84[_0x30f4('0x16')](_0x1a503e)[_0x30f4('0x2a')](_0x2f5e3b);};}exports[_0x30f4('0x2b')]=function(_0x6f7ffb,_0x32a0eb){var _0x38b599={},_0x32c689={},_0x1c2987={'count':0x0,'rows':[]};var _0x39444c=_[_0x30f4('0x2c')](db[_0x30f4('0x2d')][_0x30f4('0x2e')],function(_0x4c35e9){return{'name':_0x4c35e9['fieldName'],'type':_0x4c35e9['type'][_0x30f4('0x2f')]};});_0x32c689['model']=_['map'](_0x39444c,_0x30f4('0x29'));_0x32c689[_0x30f4('0x30')]=_[_0x30f4('0x31')](_0x6f7ffb[_0x30f4('0x30')]);_0x32c689[_0x30f4('0x32')]=_['intersection'](_0x32c689[_0x30f4('0x33')],_0x32c689['query']);_0x38b599[_0x30f4('0x34')]=_[_0x30f4('0x35')](_0x32c689[_0x30f4('0x33')],qs[_0x30f4('0x36')](_0x6f7ffb[_0x30f4('0x30')]['fields']));_0x38b599[_0x30f4('0x34')]=_0x38b599[_0x30f4('0x34')]['length']?_0x38b599[_0x30f4('0x34')]:_0x32c689[_0x30f4('0x33')];if(!_0x6f7ffb[_0x30f4('0x30')][_0x30f4('0x37')](_0x30f4('0x38'))){_0x38b599[_0x30f4('0x1b')]=qs['limit'](_0x6f7ffb['query']['limit']);_0x38b599['offset']=qs['offset'](_0x6f7ffb[_0x30f4('0x30')][_0x30f4('0x18')]);}_0x38b599[_0x30f4('0x39')]=qs[_0x30f4('0x3a')](_0x6f7ffb[_0x30f4('0x30')][_0x30f4('0x3a')]);_0x38b599[_0x30f4('0x3b')]=qs[_0x30f4('0x32')](_[_0x30f4('0x3c')](_0x6f7ffb[_0x30f4('0x30')],_0x32c689[_0x30f4('0x32')]),_0x39444c);if(_0x6f7ffb['query'][_0x30f4('0x3d')]){_0x38b599['where']=_[_0x30f4('0x3e')](_0x38b599[_0x30f4('0x3b')],{'$or':_[_0x30f4('0x2c')](_0x39444c,function(_0x3e8631){if(_0x3e8631['type']!==_0x30f4('0x3f')){var _0x14df5c={};_0x14df5c[_0x3e8631[_0x30f4('0x29')]]={'$like':'%'+_0x6f7ffb[_0x30f4('0x30')]['filter']+'%'};return _0x14df5c;}})});}_0x38b599=_['merge']({},_0x38b599,_0x6f7ffb[_0x30f4('0x40')]);var _0x46b0c0={'where':_0x38b599['where']};return db['Schedule'][_0x30f4('0x1a')](_0x46b0c0)['then'](function(_0x4e67e4){_0x1c2987[_0x30f4('0x1a')]=_0x4e67e4;if(_0x6f7ffb['query'][_0x30f4('0x41')]){_0x38b599[_0x30f4('0x42')]=[{'all':!![]}];}return db[_0x30f4('0x2d')]['findAll'](_0x38b599);})[_0x30f4('0x22')](function(_0x4ce83b){_0x1c2987['rows']=_0x4ce83b;return _0x1c2987;})[_0x30f4('0x22')](respondWithFilteredResult(_0x32a0eb,_0x38b599))[_0x30f4('0x43')](handleError(_0x32a0eb,null));};exports[_0x30f4('0x44')]=function(_0x1e00c3,_0x307fa5){var _0x59908c={'raw':![],'where':{'id':_0x1e00c3[_0x30f4('0x45')]['id']}},_0x59640={};_0x59640[_0x30f4('0x33')]=_[_0x30f4('0x31')](db[_0x30f4('0x2d')][_0x30f4('0x2e')]);_0x59640['query']=_['keys'](_0x1e00c3[_0x30f4('0x30')]);_0x59640[_0x30f4('0x32')]=_[_0x30f4('0x35')](_0x59640[_0x30f4('0x33')],_0x59640[_0x30f4('0x30')]);_0x59908c[_0x30f4('0x34')]=_[_0x30f4('0x35')](_0x59640['model'],qs['fields'](_0x1e00c3[_0x30f4('0x30')][_0x30f4('0x36')]));_0x59908c[_0x30f4('0x34')]=_0x59908c[_0x30f4('0x34')][_0x30f4('0x46')]?_0x59908c[_0x30f4('0x34')]:_0x59640[_0x30f4('0x33')];if(_0x1e00c3[_0x30f4('0x30')][_0x30f4('0x41')]){_0x59908c[_0x30f4('0x42')]=[{'all':!![]}];}_0x59908c=_[_0x30f4('0x3e')]({},_0x59908c,_0x1e00c3['options']);return db['Schedule'][_0x30f4('0x47')](_0x59908c)['then'](handleEntityNotFound(_0x307fa5,null))[_0x30f4('0x22')](respondWithResult(_0x307fa5,null))[_0x30f4('0x43')](handleError(_0x307fa5,null));};exports[_0x30f4('0x48')]=function(_0x2504ec,_0x128462){return db[_0x30f4('0x2d')][_0x30f4('0x48')](_0x2504ec['body'],{})[_0x30f4('0x22')](function(_0x169862){var _0x3443f3=_0x2504ec[_0x30f4('0x49')][_0x30f4('0x23')]({'plain':!![]});if(!_0x3443f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3443f3[_0x30f4('0x4a')]===_0x30f4('0x49')){var _0x296c45=_0x169862['get']({'plain':!![]});var _0x29ab07=_0x30f4('0x24');return db[_0x30f4('0x4b')][_0x30f4('0x47')]({'where':{'name':_0x29ab07,'userProfileId':_0x3443f3[_0x30f4('0x4c')]},'raw':!![]})[_0x30f4('0x22')](function(_0x27ee9e){if(_0x27ee9e&&_0x27ee9e[_0x30f4('0x4d')]===0x0){return db[_0x30f4('0x25')][_0x30f4('0x48')]({'name':_0x296c45['name'],'resourceId':_0x296c45['id'],'type':_0x27ee9e[_0x30f4('0x29')],'sectionId':_0x27ee9e['id']},{})[_0x30f4('0x22')](function(){return _0x169862;});}else{return _0x169862;}})[_0x30f4('0x43')](function(_0x18a378){logger['error'](_0x30f4('0x4e'),_0x18a378);throw _0x18a378;});}return _0x169862;})[_0x30f4('0x22')](respondWithResult(_0x128462,0xc9))[_0x30f4('0x43')](handleError(_0x128462,null));};exports[_0x30f4('0x21')]=function(_0x5f4558,_0x300ade){if(_0x5f4558[_0x30f4('0x4f')]['id']){delete _0x5f4558[_0x30f4('0x4f')]['id'];}return db[_0x30f4('0x2d')][_0x30f4('0x47')]({'where':{'id':_0x5f4558['params']['id']}})[_0x30f4('0x22')](handleEntityNotFound(_0x300ade,null))[_0x30f4('0x22')](saveUpdates(_0x5f4558[_0x30f4('0x4f')],null))['then'](respondWithResult(_0x300ade,null))[_0x30f4('0x43')](handleError(_0x300ade,null));};exports[_0x30f4('0x26')]=function(_0x7b2764,_0x3adea3){return db[_0x30f4('0x2d')]['find']({'where':{'id':_0x7b2764[_0x30f4('0x45')]['id']}})[_0x30f4('0x22')](handleEntityNotFound(_0x3adea3,null))['then'](removeEntity(_0x3adea3,null))[_0x30f4('0x43')](handleError(_0x3adea3,null));};exports[_0x30f4('0x50')]=function(_0x474645,_0x159539,_0x34df56){var _0x554c74=require(_0x30f4('0x51'));return db[_0x30f4('0x2d')][_0x30f4('0x47')]({'where':{'id':_0x474645['params']['id']},'raw':!![]})[_0x30f4('0x22')](handleEntityNotFound(_0x159539,null))[_0x30f4('0x22')](function(){_0x554c74[_0x30f4('0x50')](_0x474645[_0x30f4('0x45')]['id']);})[_0x30f4('0x22')](respondWithStatusCode(_0x159539,null))[_0x30f4('0x43')](handleError(_0x159539,null));}; \ No newline at end of file +var _0x3b49=['nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','UserProfileResource','run','../../config/schedule','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','update','destroy','then','get','Scheduler','error','stack','name','send','index','map','Schedule','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x49a41c,_0x5e910e){var _0xedae2a=function(_0xbde328){while(--_0xbde328){_0x49a41c['push'](_0x49a41c['shift']());}};_0xedae2a(++_0x5e910e);}(_0x3b49,0x15d));var _0x93b4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3b49[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x93b4('0x0'));var rimraf=require(_0x93b4('0x1'));var zipdir=require(_0x93b4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93b4('0x3'));var Mustache=require(_0x93b4('0x4'));var util=require(_0x93b4('0x5'));var path=require(_0x93b4('0x6'));var sox=require(_0x93b4('0x7'));var csv=require(_0x93b4('0x8'));var ejs=require(_0x93b4('0x9'));var fs=require('fs');var fs_extra=require(_0x93b4('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x93b4('0xb'));var jsforce=require(_0x93b4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x93b4('0x8'));var querystring=require('querystring');var Papa=require(_0x93b4('0xd'));var Redis=require(_0x93b4('0xe'));var authService=require(_0x93b4('0xf'));var qs=require(_0x93b4('0x10'));var as=require(_0x93b4('0x11'));var hardwareService=require(_0x93b4('0x12'));var logger=require(_0x93b4('0x13'))(_0x93b4('0x14'));var utils=require(_0x93b4('0x15'));var config=require(_0x93b4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x93b4('0x17'))['db'];function respondWithStatusCode(_0x1c512c,_0x4da14a){_0x4da14a=_0x4da14a||0xcc;return function(_0x1c61cb){if(_0x1c61cb){return _0x1c512c[_0x93b4('0x18')](_0x4da14a);}return _0x1c512c[_0x93b4('0x19')](_0x4da14a)[_0x93b4('0x1a')]();};}function respondWithResult(_0x132672,_0x1d8f30){_0x1d8f30=_0x1d8f30||0xc8;return function(_0x33ca03){if(_0x33ca03){return _0x132672['status'](_0x1d8f30)[_0x93b4('0x1b')](_0x33ca03);}};}function respondWithFilteredResult(_0x45c3f2,_0x5b5ef4){return function(_0x73f335){if(_0x73f335){var _0x197fc6=typeof _0x5b5ef4[_0x93b4('0x1c')]===_0x93b4('0x1d')&&typeof _0x5b5ef4[_0x93b4('0x1e')]===_0x93b4('0x1d');var _0x350a1e=_0x73f335['count'];var _0x111713=_0x197fc6?0x0:_0x5b5ef4['offset'];var _0x348ac7=_0x197fc6?_0x73f335[_0x93b4('0x1f')]:_0x5b5ef4[_0x93b4('0x1c')]+_0x5b5ef4[_0x93b4('0x1e')];var _0x3470fe;if(_0x348ac7>=_0x350a1e){_0x348ac7=_0x350a1e;_0x3470fe=0xc8;}else{_0x3470fe=0xce;}_0x45c3f2[_0x93b4('0x19')](_0x3470fe);return _0x45c3f2['set']('Content-Range',_0x111713+'-'+_0x348ac7+'/'+_0x350a1e)[_0x93b4('0x1b')](_0x73f335);}return null;};}function patchUpdates(_0xebf5a2){return function(_0x1538b6){try{jsonpatch['apply'](_0x1538b6,_0xebf5a2,!![]);}catch(_0x5dc9d5){return BPromise[_0x93b4('0x20')](_0x5dc9d5);}return _0x1538b6['save']();};}function saveUpdates(_0x40aac6,_0x2391c1){return function(_0xde9263){if(_0xde9263){return _0xde9263[_0x93b4('0x21')](_0x40aac6)['then'](function(_0x3dd1ae){return _0x3dd1ae;});}return null;};}function removeEntity(_0x1d0169,_0xa9d10c){return function(_0x49f61a){if(_0x49f61a){return _0x49f61a[_0x93b4('0x22')]()[_0x93b4('0x23')](function(){var _0x40a1e7=_0x49f61a[_0x93b4('0x24')]({'plain':!![]});var _0x1cbacd=_0x93b4('0x25');return db['UserProfileResource'][_0x93b4('0x22')]({'where':{'type':_0x1cbacd,'resourceId':_0x40a1e7['id']}})['then'](function(){return _0x49f61a;});})['then'](function(){_0x1d0169['status'](0xcc)[_0x93b4('0x1a')]();});}};}function handleEntityNotFound(_0x2e4d30,_0x29e1ad){return function(_0x427521){if(!_0x427521){_0x2e4d30[_0x93b4('0x18')](0x194);}return _0x427521;};}function handleError(_0x1b394f,_0xb13f56){_0xb13f56=_0xb13f56||0x1f4;return function(_0x103caa){logger[_0x93b4('0x26')](_0x103caa[_0x93b4('0x27')]);if(_0x103caa['name']){delete _0x103caa[_0x93b4('0x28')];}_0x1b394f[_0x93b4('0x19')](_0xb13f56)[_0x93b4('0x29')](_0x103caa);};}exports[_0x93b4('0x2a')]=function(_0x145313,_0x365886){var _0x22379c={},_0x470141={},_0x5607a8={'count':0x0,'rows':[]};var _0x226cfb=_[_0x93b4('0x2b')](db[_0x93b4('0x2c')][_0x93b4('0x2d')],function(_0x2e2582){return{'name':_0x2e2582[_0x93b4('0x2e')],'type':_0x2e2582[_0x93b4('0x2f')]['key']};});_0x470141[_0x93b4('0x30')]=_[_0x93b4('0x2b')](_0x226cfb,_0x93b4('0x28'));_0x470141['query']=_[_0x93b4('0x31')](_0x145313[_0x93b4('0x32')]);_0x470141[_0x93b4('0x33')]=_[_0x93b4('0x34')](_0x470141[_0x93b4('0x30')],_0x470141[_0x93b4('0x32')]);_0x22379c[_0x93b4('0x35')]=_[_0x93b4('0x34')](_0x470141[_0x93b4('0x30')],qs['fields'](_0x145313[_0x93b4('0x32')][_0x93b4('0x36')]));_0x22379c[_0x93b4('0x35')]=_0x22379c[_0x93b4('0x35')]['length']?_0x22379c['attributes']:_0x470141[_0x93b4('0x30')];if(!_0x145313[_0x93b4('0x32')][_0x93b4('0x37')](_0x93b4('0x38'))){_0x22379c['limit']=qs[_0x93b4('0x1e')](_0x145313[_0x93b4('0x32')][_0x93b4('0x1e')]);_0x22379c[_0x93b4('0x1c')]=qs[_0x93b4('0x1c')](_0x145313[_0x93b4('0x32')][_0x93b4('0x1c')]);}_0x22379c[_0x93b4('0x39')]=qs[_0x93b4('0x3a')](_0x145313[_0x93b4('0x32')][_0x93b4('0x3a')]);_0x22379c['where']=qs['filters'](_['pick'](_0x145313['query'],_0x470141[_0x93b4('0x33')]),_0x226cfb);if(_0x145313[_0x93b4('0x32')][_0x93b4('0x3b')]){_0x22379c[_0x93b4('0x3c')]=_[_0x93b4('0x3d')](_0x22379c[_0x93b4('0x3c')],{'$or':_[_0x93b4('0x2b')](_0x226cfb,function(_0x40c84f){if(_0x40c84f['type']!==_0x93b4('0x3e')){var _0x46c4fa={};_0x46c4fa[_0x40c84f[_0x93b4('0x28')]]={'$like':'%'+_0x145313[_0x93b4('0x32')][_0x93b4('0x3b')]+'%'};return _0x46c4fa;}})});}_0x22379c=_['merge']({},_0x22379c,_0x145313['options']);var _0x33ac50={'where':_0x22379c[_0x93b4('0x3c')]};return db[_0x93b4('0x2c')][_0x93b4('0x1f')](_0x33ac50)[_0x93b4('0x23')](function(_0x560caf){_0x5607a8['count']=_0x560caf;if(_0x145313[_0x93b4('0x32')][_0x93b4('0x3f')]){_0x22379c[_0x93b4('0x40')]=[{'all':!![]}];}return db['Schedule'][_0x93b4('0x41')](_0x22379c);})[_0x93b4('0x23')](function(_0x13131a){_0x5607a8[_0x93b4('0x42')]=_0x13131a;return _0x5607a8;})[_0x93b4('0x23')](respondWithFilteredResult(_0x365886,_0x22379c))[_0x93b4('0x43')](handleError(_0x365886,null));};exports[_0x93b4('0x44')]=function(_0x118ad7,_0x22cb42){var _0x5bf757={'raw':![],'where':{'id':_0x118ad7[_0x93b4('0x45')]['id']}},_0x59249={};_0x59249[_0x93b4('0x30')]=_[_0x93b4('0x31')](db[_0x93b4('0x2c')][_0x93b4('0x2d')]);_0x59249[_0x93b4('0x32')]=_[_0x93b4('0x31')](_0x118ad7[_0x93b4('0x32')]);_0x59249['filters']=_[_0x93b4('0x34')](_0x59249[_0x93b4('0x30')],_0x59249[_0x93b4('0x32')]);_0x5bf757[_0x93b4('0x35')]=_[_0x93b4('0x34')](_0x59249[_0x93b4('0x30')],qs[_0x93b4('0x36')](_0x118ad7['query'][_0x93b4('0x36')]));_0x5bf757['attributes']=_0x5bf757[_0x93b4('0x35')][_0x93b4('0x46')]?_0x5bf757[_0x93b4('0x35')]:_0x59249[_0x93b4('0x30')];if(_0x118ad7[_0x93b4('0x32')][_0x93b4('0x3f')]){_0x5bf757[_0x93b4('0x40')]=[{'all':!![]}];}_0x5bf757=_[_0x93b4('0x3d')]({},_0x5bf757,_0x118ad7['options']);return db[_0x93b4('0x2c')][_0x93b4('0x47')](_0x5bf757)[_0x93b4('0x23')](handleEntityNotFound(_0x22cb42,null))[_0x93b4('0x23')](respondWithResult(_0x22cb42,null))[_0x93b4('0x43')](handleError(_0x22cb42,null));};exports[_0x93b4('0x48')]=function(_0x3cf1d7,_0x28b3ec){return db[_0x93b4('0x2c')]['create'](_0x3cf1d7[_0x93b4('0x49')],{})['then'](function(_0x30dd27){var _0x587a88=_0x3cf1d7['user']['get']({'plain':!![]});if(!_0x587a88)throw new Error(_0x93b4('0x4a'));if(_0x587a88[_0x93b4('0x4b')]===_0x93b4('0x4c')){var _0x12e2f1=_0x30dd27[_0x93b4('0x24')]({'plain':!![]});var _0x2b0331='Scheduler';return db['UserProfileSection'][_0x93b4('0x47')]({'where':{'name':_0x2b0331,'userProfileId':_0x587a88[_0x93b4('0x4d')]},'raw':!![]})[_0x93b4('0x23')](function(_0xd52b8c){if(_0xd52b8c&&_0xd52b8c['autoAssociation']===0x0){return db[_0x93b4('0x4e')][_0x93b4('0x48')]({'name':_0x12e2f1[_0x93b4('0x28')],'resourceId':_0x12e2f1['id'],'type':_0xd52b8c[_0x93b4('0x28')],'sectionId':_0xd52b8c['id']},{})[_0x93b4('0x23')](function(){return _0x30dd27;});}else{return _0x30dd27;}})['catch'](function(_0x43a0fe){logger[_0x93b4('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43a0fe);throw _0x43a0fe;});}return _0x30dd27;})[_0x93b4('0x23')](respondWithResult(_0x28b3ec,0xc9))[_0x93b4('0x43')](handleError(_0x28b3ec,null));};exports[_0x93b4('0x21')]=function(_0x3bd474,_0x2b6fe4){if(_0x3bd474[_0x93b4('0x49')]['id']){delete _0x3bd474[_0x93b4('0x49')]['id'];}return db[_0x93b4('0x2c')][_0x93b4('0x47')]({'where':{'id':_0x3bd474[_0x93b4('0x45')]['id']}})[_0x93b4('0x23')](handleEntityNotFound(_0x2b6fe4,null))['then'](saveUpdates(_0x3bd474[_0x93b4('0x49')],null))[_0x93b4('0x23')](respondWithResult(_0x2b6fe4,null))['catch'](handleError(_0x2b6fe4,null));};exports[_0x93b4('0x22')]=function(_0xb153e6,_0x170fb8){return db[_0x93b4('0x2c')]['find']({'where':{'id':_0xb153e6[_0x93b4('0x45')]['id']}})[_0x93b4('0x23')](handleEntityNotFound(_0x170fb8,null))[_0x93b4('0x23')](removeEntity(_0x170fb8,null))[_0x93b4('0x43')](handleError(_0x170fb8,null));};exports[_0x93b4('0x4f')]=function(_0x2c9c2b,_0x309a14,_0x634df3){var _0x21c13e=require(_0x93b4('0x50'));return db['Schedule'][_0x93b4('0x47')]({'where':{'id':_0x2c9c2b['params']['id']},'raw':!![]})[_0x93b4('0x23')](handleEntityNotFound(_0x309a14,null))[_0x93b4('0x23')](function(){_0x21c13e['run'](_0x2c9c2b[_0x93b4('0x45')]['id']);})[_0x93b4('0x23')](respondWithStatusCode(_0x309a14,null))[_0x93b4('0x43')](handleError(_0x309a14,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index be1f840..47ffd84 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 _0xaea0=['path','../../config/environment','Schedule','tools_schedules','lodash','../../config/logger','api','moment','bluebird'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xaea0,0x163));var _0x0aea=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0xaea0[_0x163040];return _0x364667;};'use strict';var _=require(_0x0aea('0x0'));var util=require('util');var logger=require(_0x0aea('0x1'))(_0x0aea('0x2'));var moment=require(_0x0aea('0x3'));var BPromise=require(_0x0aea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0aea('0x5'));var rimraf=require('rimraf');var config=require(_0x0aea('0x6'));var attributes=require('./schedule.attributes');module['exports']=function(_0x1ec4b5,_0x2fb1d3){return _0x1ec4b5['define'](_0x0aea('0x7'),attributes,{'tableName':_0x0aea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f8a=['tools_schedules','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x7f8a,0x155));var _0xa7f8=function(_0x2f2708,_0x3c1681){_0x2f2708=_0x2f2708-0x0;var _0x246128=_0x7f8a[_0x2f2708];return _0x246128;};'use strict';var _=require(_0xa7f8('0x0'));var util=require(_0xa7f8('0x1'));var logger=require('../../config/logger')(_0xa7f8('0x2'));var moment=require('moment');var BPromise=require(_0xa7f8('0x3'));var rp=require(_0xa7f8('0x4'));var fs=require('fs');var path=require(_0xa7f8('0x5'));var rimraf=require(_0xa7f8('0x6'));var config=require(_0xa7f8('0x7'));var attributes=require('./schedule.attributes');module[_0xa7f8('0x8')]=function(_0x3f3405,_0x585230){return _0x3f3405['define']('Schedule',attributes,{'tableName':_0xa7f8('0x9'),'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 eacb0a0..a867710 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 _0xf9e2=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xf9e2,0x107));var _0x2f9e=function(_0x1cf2b3,_0x4c35af){_0x1cf2b3=_0x1cf2b3-0x0;var _0x3a53c9=_0xf9e2[_0x1cf2b3];return _0x3a53c9;};'use strict';var _=require(_0x2f9e('0x0'));var util=require('util');var moment=require(_0x2f9e('0x1'));var BPromise=require(_0x2f9e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f9e('0x3'));var db=require(_0x2f9e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f9e('0x5'))(_0x2f9e('0x6'));var config=require('../../config/environment');var jayson=require(_0x2f9e('0x7'));var client=jayson[_0x2f9e('0x8')][_0x2f9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x540ef7,_0x119ed6,_0x5c81ea){return new BPromise(function(_0x44f9fb,_0x38c729){return client[_0x2f9e('0xa')](_0x540ef7,_0x5c81ea)[_0x2f9e('0xb')](function(_0x1e0517){logger[_0x2f9e('0xc')](_0x2f9e('0xd'),_0x119ed6,_0x2f9e('0xe'));logger[_0x2f9e('0xf')](_0x2f9e('0x10'),_0x119ed6,_0x2f9e('0xe'),JSON['stringify'](_0x1e0517));if(_0x1e0517[_0x2f9e('0x11')]){if(_0x1e0517['error'][_0x2f9e('0x12')]===0x1f4){logger[_0x2f9e('0x11')](_0x2f9e('0xd'),_0x119ed6,_0x1e0517[_0x2f9e('0x11')][_0x2f9e('0x13')]);return _0x38c729(_0x1e0517[_0x2f9e('0x11')][_0x2f9e('0x13')]);}logger[_0x2f9e('0x11')](_0x2f9e('0xd'),_0x119ed6,_0x1e0517[_0x2f9e('0x11')][_0x2f9e('0x13')]);return _0x44f9fb(_0x1e0517[_0x2f9e('0x11')][_0x2f9e('0x13')]);}else{logger['info']('Schedule,\x20%s,\x20%s',_0x119ed6,_0x2f9e('0xe'));_0x44f9fb(_0x1e0517[_0x2f9e('0x14')][_0x2f9e('0x13')]);}})[_0x2f9e('0x15')](function(_0x329f6d){logger[_0x2f9e('0x11')]('Schedule,\x20%s,\x20%s',_0x119ed6,_0x329f6d);_0x38c729(_0x329f6d);});});} \ No newline at end of file +var _0x1a71=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x48b074,_0x323cbf){var _0x335e45=function(_0x1c7092){while(--_0x1c7092){_0x48b074['push'](_0x48b074['shift']());}};_0x335e45(++_0x323cbf);}(_0x1a71,0x1b9));var _0x11a7=function(_0x4c742f,_0x2bd40a){_0x4c742f=_0x4c742f-0x0;var _0x2913ae=_0x1a71[_0x4c742f];return _0x2913ae;};'use strict';var _=require('lodash');var util=require(_0x11a7('0x0'));var moment=require(_0x11a7('0x1'));var BPromise=require(_0x11a7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11a7('0x3'));var db=require(_0x11a7('0x4'))['db'];var utils=require(_0x11a7('0x5'));var logger=require(_0x11a7('0x6'))('rpc');var config=require(_0x11a7('0x7'));var jayson=require(_0x11a7('0x8'));var client=jayson[_0x11a7('0x9')][_0x11a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d82e2,_0x217352,_0x5549e1){return new BPromise(function(_0x37f2d1,_0x23d299){return client[_0x11a7('0xb')](_0x4d82e2,_0x5549e1)[_0x11a7('0xc')](function(_0x410582){logger['info'](_0x11a7('0xd'),_0x217352,_0x11a7('0xe'));logger[_0x11a7('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x217352,_0x11a7('0xe'),JSON[_0x11a7('0x10')](_0x410582));if(_0x410582[_0x11a7('0x11')]){if(_0x410582[_0x11a7('0x11')][_0x11a7('0x12')]===0x1f4){logger[_0x11a7('0x11')]('Schedule,\x20%s,\x20%s',_0x217352,_0x410582[_0x11a7('0x11')]['message']);return _0x23d299(_0x410582[_0x11a7('0x11')]['message']);}logger[_0x11a7('0x11')](_0x11a7('0xd'),_0x217352,_0x410582[_0x11a7('0x11')][_0x11a7('0x13')]);return _0x37f2d1(_0x410582[_0x11a7('0x11')][_0x11a7('0x13')]);}else{logger[_0x11a7('0x14')](_0x11a7('0xd'),_0x217352,_0x11a7('0xe'));_0x37f2d1(_0x410582[_0x11a7('0x15')][_0x11a7('0x13')]);}})[_0x11a7('0x16')](function(_0x2f27ac){logger[_0x11a7('0x11')](_0x11a7('0xd'),_0x217352,_0x2f27ac);_0x23d299(_0x2f27ac);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index eba716f..6c3a19e 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 _0x034a=['/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','show','/:id/download','download','post','create','put'];(function(_0x3ee35a,_0x59dff6){var _0x51be1c=function(_0x55401d){while(--_0x55401d){_0x3ee35a['push'](_0x3ee35a['shift']());}};_0x51be1c(++_0x59dff6);}(_0x034a,0xdb));var _0xa034=function(_0x14c552,_0x600898){_0x14c552=_0x14c552-0x0;var _0x3221a3=_0x034a[_0x14c552];return _0x3221a3;};'use strict';var multer=require(_0xa034('0x0'));var util=require(_0xa034('0x1'));var path=require(_0xa034('0x2'));var timeout=require(_0xa034('0x3'));var express=require(_0xa034('0x4'));var router=express[_0xa034('0x5')]();var fs_extra=require(_0xa034('0x6'));var auth=require(_0xa034('0x7'));var interaction=require(_0xa034('0x8'));var config=require(_0xa034('0x9'));var controller=require('./screenRecording.controller');router[_0xa034('0xa')]('/',auth['isAuthenticated'](),controller[_0xa034('0xb')]);router[_0xa034('0xa')](_0xa034('0xc'),auth[_0xa034('0xd')](),controller[_0xa034('0xe')]);router['get']('/:id',auth[_0xa034('0xd')](),controller[_0xa034('0xf')]);router[_0xa034('0xa')](_0xa034('0x10'),auth[_0xa034('0xd')](),controller[_0xa034('0x11')]);router[_0xa034('0x12')]('/',auth['isAuthenticated'](),controller[_0xa034('0x13')]);router[_0xa034('0x14')](_0xa034('0x15'),auth['isAuthenticated'](),controller[_0xa034('0x16')]);router[_0xa034('0x17')](_0xa034('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0999=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','isAuthenticated','/:id','/:id/download','download','create','put','update','delete','destroy'];(function(_0x26984c,_0x7c294){var _0x418da8=function(_0x515250){while(--_0x515250){_0x26984c['push'](_0x26984c['shift']());}};_0x418da8(++_0x7c294);}(_0x0999,0x85));var _0x9099=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x0999[_0x34843e];return _0x598f7f;};'use strict';var multer=require('multer');var util=require(_0x9099('0x0'));var path=require(_0x9099('0x1'));var timeout=require(_0x9099('0x2'));var express=require(_0x9099('0x3'));var router=express[_0x9099('0x4')]();var fs_extra=require(_0x9099('0x5'));var auth=require(_0x9099('0x6'));var interaction=require(_0x9099('0x7'));var config=require(_0x9099('0x8'));var controller=require(_0x9099('0x9'));router[_0x9099('0xa')]('/',auth['isAuthenticated'](),controller[_0x9099('0xb')]);router[_0x9099('0xa')]('/describe',auth[_0x9099('0xc')](),controller['describe']);router['get'](_0x9099('0xd'),auth[_0x9099('0xc')](),controller['show']);router[_0x9099('0xa')](_0x9099('0xe'),auth['isAuthenticated'](),controller[_0x9099('0xf')]);router['post']('/',auth[_0x9099('0xc')](),controller[_0x9099('0x10')]);router[_0x9099('0x11')]('/:id',auth[_0x9099('0xc')](),controller[_0x9099('0x12')]);router[_0x9099('0x13')]('/:id',auth[_0x9099('0xc')](),controller[_0x9099('0x14')]);module[_0x9099('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4ec6740..d42f516 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 _0x6edc=['setDataValue','INTEGER','startedAt','subtract','duration','DATE','MM-DD-YYYY\x20HH:mm','closedAt','format','createdAt','updatedAt','toString','sequelize','moment','path','../../config/environment','getDataValue','value','extname','STRING'];(function(_0x4f93d7,_0x14f218){var _0x432f18=function(_0x346252){while(--_0x346252){_0x4f93d7['push'](_0x4f93d7['shift']());}};_0x432f18(++_0x14f218);}(_0x6edc,0x138));var _0xc6ed=function(_0x28a3b2,_0x8afb4f){_0x28a3b2=_0x28a3b2-0x0;var _0x429d03=_0x6edc[_0x28a3b2];return _0x429d03;};'use strict';var Sequelize=require(_0xc6ed('0x0'));var moment=require(_0xc6ed('0x1'));var path=require(_0xc6ed('0x2'));var config=require(_0xc6ed('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xc6ed('0x4')](_0xc6ed('0x5'))?path[_0xc6ed('0x6')](this[_0xc6ed('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xc6ed('0x7')]},'channel':{'type':Sequelize[_0xc6ed('0x7')]},'value':{'type':Sequelize[_0xc6ed('0x7')],'set':function(_0x548a14){var _0x274b0d=_0x548a14['replace'](/\\/g,'/');this[_0xc6ed('0x8')](_0xc6ed('0x5'),_0x274b0d);}},'rating':{'type':Sequelize[_0xc6ed('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xc6ed('0x9')],'set':function(_0x496e6a){this[_0xc6ed('0x8')](_0xc6ed('0xa'),moment()[_0xc6ed('0xb')](_0x496e6a,'ms'));this['setDataValue']('closedAt',moment());this[_0xc6ed('0x8')](_0xc6ed('0xc'),_0x496e6a);}},'startedAt':{'type':Sequelize[_0xc6ed('0xd')],'get':function(){return moment(this[_0xc6ed('0x4')](_0xc6ed('0xa')))['format'](_0xc6ed('0xe'))['toString']();}},'closedAt':{'type':Sequelize[_0xc6ed('0xd')],'get':function(){return moment(this['getDataValue'](_0xc6ed('0xf')))[_0xc6ed('0x10')](_0xc6ed('0xe'))['toString']();}},'createdAt':{'type':Sequelize[_0xc6ed('0xd')],'get':function(){return moment(this[_0xc6ed('0x4')](_0xc6ed('0x11')))['format'](_0xc6ed('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0xc6ed('0xd')],'get':function(){return moment(this[_0xc6ed('0x4')](_0xc6ed('0x12')))['format'](_0xc6ed('0xe'))[_0xc6ed('0x13')]();}}}; \ No newline at end of file +var _0xce14=['DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','moment','../../config/environment','exports','getDataValue','value','extname','STRING','setDataValue','INTEGER','startedAt','subtract','closedAt','duration'];(function(_0x4b788c,_0x224b70){var _0x2d2d12=function(_0x22eb2b){while(--_0x22eb2b){_0x4b788c['push'](_0x4b788c['shift']());}};_0x2d2d12(++_0x224b70);}(_0xce14,0x17f));var _0x4ce1=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xce14[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4ce1('0x0'));var path=require('path');var config=require(_0x4ce1('0x1'));module[_0x4ce1('0x2')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x4ce1('0x3')](_0x4ce1('0x4'))?path[_0x4ce1('0x5')](this[_0x4ce1('0x3')](_0x4ce1('0x4'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4ce1('0x6')]},'value':{'type':Sequelize[_0x4ce1('0x6')],'set':function(_0x1f603d){var _0x2b9923=_0x1f603d['replace'](/\\/g,'/');this[_0x4ce1('0x7')](_0x4ce1('0x4'),_0x2b9923);}},'rating':{'type':Sequelize[_0x4ce1('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x1b5bd8){this[_0x4ce1('0x7')](_0x4ce1('0x9'),moment()[_0x4ce1('0xa')](_0x1b5bd8,'ms'));this['setDataValue'](_0x4ce1('0xb'),moment());this[_0x4ce1('0x7')](_0x4ce1('0xc'),_0x1b5bd8);}},'startedAt':{'type':Sequelize[_0x4ce1('0xd')],'get':function(){return moment(this['getDataValue'](_0x4ce1('0x9')))[_0x4ce1('0xe')](_0x4ce1('0xf'))[_0x4ce1('0x10')]();}},'closedAt':{'type':Sequelize[_0x4ce1('0xd')],'get':function(){return moment(this[_0x4ce1('0x3')](_0x4ce1('0xb')))[_0x4ce1('0xe')](_0x4ce1('0xf'))[_0x4ce1('0x10')]();}},'createdAt':{'type':Sequelize[_0x4ce1('0xd')],'get':function(){return moment(this['getDataValue'](_0x4ce1('0x11')))['format'](_0x4ce1('0xf'))[_0x4ce1('0x10')]();}},'updatedAt':{'type':Sequelize[_0x4ce1('0xd')],'get':function(){return moment(this[_0x4ce1('0x3')]('updatedAt'))[_0x4ce1('0xe')]('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 483708c..5e3ee7c 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 _0xed1f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','ScreenRecording','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','show','params','merge','options','catch','create','body','duration','createdAt','closedAt','value','find','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf'];(function(_0x4a5efe,_0x4248fb){var _0x1c719a=function(_0x43fd88){while(--_0x43fd88){_0x4a5efe['push'](_0x4a5efe['shift']());}};_0x1c719a(++_0x4248fb);}(_0xed1f,0x6a));var _0xfed1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xed1f[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xfed1('0x0'));var rimraf=require(_0xfed1('0x1'));var zipdir=require(_0xfed1('0x2'));var jsonpatch=require(_0xfed1('0x3'));var rp=require(_0xfed1('0x4'));var moment=require(_0xfed1('0x5'));var BPromise=require(_0xfed1('0x6'));var Mustache=require(_0xfed1('0x7'));var util=require(_0xfed1('0x8'));var path=require(_0xfed1('0x9'));var sox=require(_0xfed1('0xa'));var csv=require(_0xfed1('0xb'));var ejs=require(_0xfed1('0xc'));var fs=require('fs');var fs_extra=require(_0xfed1('0xd'));var _=require(_0xfed1('0xe'));var squel=require(_0xfed1('0xf'));var crypto=require(_0xfed1('0x10'));var jsforce=require(_0xfed1('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfed1('0xb'));var querystring=require(_0xfed1('0x12'));var Papa=require('papaparse');var Redis=require(_0xfed1('0x13'));var authService=require(_0xfed1('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfed1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfed1('0x16'))(_0xfed1('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfed1('0x18'));var db=require(_0xfed1('0x19'))['db'];function respondWithStatusCode(_0x569a6e,_0x17f4fe){_0x17f4fe=_0x17f4fe||0xcc;return function(_0x5a3469){if(_0x5a3469){return _0x569a6e['sendStatus'](_0x17f4fe);}return _0x569a6e[_0xfed1('0x1a')](_0x17f4fe)[_0xfed1('0x1b')]();};}function respondWithResult(_0x532537,_0x2dde3a){_0x2dde3a=_0x2dde3a||0xc8;return function(_0x5b9455){if(_0x5b9455){return _0x532537['status'](_0x2dde3a)[_0xfed1('0x1c')](_0x5b9455);}};}function respondWithFilteredResult(_0x39aa0c,_0x1fbb7a){return function(_0x123c46){if(_0x123c46){var _0x582e67=typeof _0x1fbb7a[_0xfed1('0x1d')]==='undefined'&&typeof _0x1fbb7a[_0xfed1('0x1e')]===_0xfed1('0x1f');var _0x489a0f=_0x123c46[_0xfed1('0x20')];var _0xa72a20=_0x582e67?0x0:_0x1fbb7a['offset'];var _0x59509b=_0x582e67?_0x123c46['count']:_0x1fbb7a[_0xfed1('0x1d')]+_0x1fbb7a['limit'];var _0x201f18;if(_0x59509b>=_0x489a0f){_0x59509b=_0x489a0f;_0x201f18=0xc8;}else{_0x201f18=0xce;}_0x39aa0c[_0xfed1('0x1a')](_0x201f18);return _0x39aa0c['set'](_0xfed1('0x21'),_0xa72a20+'-'+_0x59509b+'/'+_0x489a0f)[_0xfed1('0x1c')](_0x123c46);}return null;};}function patchUpdates(_0x59ee9d){return function(_0x3ce944){try{jsonpatch[_0xfed1('0x22')](_0x3ce944,_0x59ee9d,!![]);}catch(_0xff4842){return BPromise[_0xfed1('0x23')](_0xff4842);}return _0x3ce944['save']();};}function saveUpdates(_0x203cec,_0x59333e){return function(_0x446558){if(_0x446558){return _0x446558[_0xfed1('0x24')](_0x203cec)[_0xfed1('0x25')](function(_0x532ec2){return _0x532ec2;});}return null;};}function removeEntity(_0x41d22c,_0x594917){return function(_0x460555){if(_0x460555){return _0x460555[_0xfed1('0x26')]()[_0xfed1('0x25')](function(){_0x41d22c[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();});}};}function handleEntityNotFound(_0x1199b7,_0x527fc7){return function(_0x465ce6){if(!_0x465ce6){_0x1199b7[_0xfed1('0x27')](0x194);}return _0x465ce6;};}function handleError(_0x49072b,_0x1d6c72){_0x1d6c72=_0x1d6c72||0x1f4;return function(_0x2b9dd2){logger[_0xfed1('0x28')](_0x2b9dd2[_0xfed1('0x29')]);if(_0x2b9dd2[_0xfed1('0x2a')]){delete _0x2b9dd2[_0xfed1('0x2a')];}_0x49072b['status'](_0x1d6c72)[_0xfed1('0x2b')](_0x2b9dd2);};}exports['index']=function(_0x3106ee,_0x4e5249){var _0x53b0c9={},_0x1cec64={},_0x42c950={'count':0x0,'rows':[]};var _0x2d334e=_['map'](db[_0xfed1('0x2c')][_0xfed1('0x2d')],function(_0x13f414){return{'name':_0x13f414[_0xfed1('0x2e')],'type':_0x13f414[_0xfed1('0x2f')][_0xfed1('0x30')]};});_0x1cec64['model']=_[_0xfed1('0x31')](_[_0xfed1('0x32')](_0x2d334e,'name'),['format']);_0x1cec64[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0x3106ee[_0xfed1('0x33')]);_0x1cec64[_0xfed1('0x35')]=_[_0xfed1('0x36')](_0x1cec64['model'],_0x1cec64[_0xfed1('0x33')]);_0x53b0c9[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1cec64[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0x3106ee['query'][_0xfed1('0x39')]));_0x53b0c9['attributes']=_0x53b0c9[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x53b0c9[_0xfed1('0x37')]:_0x1cec64[_0xfed1('0x38')];if(!_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3b')](_0xfed1('0x3c'))){_0x53b0c9[_0xfed1('0x1e')]=qs['limit'](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x1e')]);_0x53b0c9[_0xfed1('0x1d')]=qs[_0xfed1('0x1d')](_0x3106ee['query']['offset']);}_0x53b0c9[_0xfed1('0x3d')]=qs[_0xfed1('0x3e')](_0x3106ee[_0xfed1('0x33')][_0xfed1('0x3e')]);_0x53b0c9[_0xfed1('0x3f')]=qs[_0xfed1('0x35')](_[_0xfed1('0x40')](_0x3106ee[_0xfed1('0x33')],_0x1cec64['filters']),_0x2d334e);if(_0x3106ee['query'][_0xfed1('0x41')]){_0x53b0c9[_0xfed1('0x3f')]=_['merge'](_0x53b0c9[_0xfed1('0x3f')],{'$or':_[_0xfed1('0x32')](_0x2d334e,function(_0x3b0973){if(_0x3b0973[_0xfed1('0x2f')]!==_0xfed1('0x42')){var _0x31ffeb={};_0x31ffeb[_0x3b0973[_0xfed1('0x2a')]]={'$like':'%'+_0x3106ee[_0xfed1('0x33')][_0xfed1('0x41')]+'%'};return _0x31ffeb;}})});}_0x53b0c9=_['merge']({},_0x53b0c9,_0x3106ee['options']);var _0x5598dc={'where':_0x53b0c9[_0xfed1('0x3f')]};return db[_0xfed1('0x2c')][_0xfed1('0x20')](_0x5598dc)['then'](function(_0x3454e6){_0x42c950['count']=_0x3454e6;if(_0x3106ee[_0xfed1('0x33')][_0xfed1('0x43')]){_0x53b0c9[_0xfed1('0x44')]=[{'all':!![]}];}return db['ScreenRecording'][_0xfed1('0x45')](_0x53b0c9);})[_0xfed1('0x25')](function(_0x422433){_0x42c950['rows']=_0x422433;return _0x42c950;})[_0xfed1('0x25')](respondWithFilteredResult(_0x4e5249,_0x53b0c9))['catch'](handleError(_0x4e5249,null));};exports[_0xfed1('0x46')]=function(_0xf1f739,_0x229fc7){var _0x13c087={'raw':![],'where':{'id':_0xf1f739[_0xfed1('0x47')]['id']}},_0x1bfbe8={};_0x1bfbe8[_0xfed1('0x38')]=_[_0xfed1('0x34')](db[_0xfed1('0x2c')]['rawAttributes']);_0x1bfbe8[_0xfed1('0x33')]=_[_0xfed1('0x34')](_0xf1f739[_0xfed1('0x33')]);_0x1bfbe8['filters']=_['intersection'](_0x1bfbe8[_0xfed1('0x38')],_0x1bfbe8[_0xfed1('0x33')]);_0x13c087[_0xfed1('0x37')]=_[_0xfed1('0x36')](_0x1bfbe8[_0xfed1('0x38')],qs[_0xfed1('0x39')](_0xf1f739[_0xfed1('0x33')][_0xfed1('0x39')]));_0x13c087[_0xfed1('0x37')]=_0x13c087[_0xfed1('0x37')][_0xfed1('0x3a')]?_0x13c087[_0xfed1('0x37')]:_0x1bfbe8['model'];if(_0xf1f739[_0xfed1('0x33')][_0xfed1('0x43')]){_0x13c087[_0xfed1('0x44')]=[{'all':!![]}];}_0x13c087=_[_0xfed1('0x48')]({},_0x13c087,_0xf1f739[_0xfed1('0x49')]);return db[_0xfed1('0x2c')]['find'](_0x13c087)[_0xfed1('0x25')](handleEntityNotFound(_0x229fc7,null))[_0xfed1('0x25')](respondWithResult(_0x229fc7,null))[_0xfed1('0x4a')](handleError(_0x229fc7,null));};exports['create']=function(_0x22874a,_0x10f98d){return db[_0xfed1('0x2c')][_0xfed1('0x4b')](_0x22874a['body'],{})[_0xfed1('0x25')](respondWithResult(_0x10f98d,0xc9))[_0xfed1('0x4a')](handleError(_0x10f98d,null));};exports[_0xfed1('0x24')]=function(_0x42761f,_0x14745e){if(_0x42761f[_0xfed1('0x4c')]['id']){delete _0x42761f[_0xfed1('0x4c')]['id'];}delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4d')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4e')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x4f')];delete _0x42761f[_0xfed1('0x4c')][_0xfed1('0x50')];return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x42761f[_0xfed1('0x47')]['id']}})['then'](handleEntityNotFound(_0x14745e,null))['then'](saveUpdates(_0x42761f[_0xfed1('0x4c')],null))[_0xfed1('0x25')](respondWithResult(_0x14745e,null))[_0xfed1('0x4a')](handleError(_0x14745e,null));};exports[_0xfed1('0x52')]=function(_0x5da599,_0x3c2534){return db[_0xfed1('0x2c')]['describe']()['then'](respondWithResult(_0x3c2534,null))['catch'](handleError(_0x3c2534,null));};exports[_0xfed1('0x53')]=function(_0x1aaa3d,_0x15e90f,_0x1d8ef2){var _0x2665c8=require(_0xfed1('0x54'));var _0x1a9f22=![];var _0x144102={};if(_0x1aaa3d[_0xfed1('0x33')][_0xfed1('0x2f')]&&_0x1aaa3d['query']['type']===_0xfed1('0x55')){_0x144102[_0xfed1('0x55')]=_0x1aaa3d[_0xfed1('0x47')]['id'];}else{_0x144102['id']=_0x1aaa3d[_0xfed1('0x47')]['id'];}return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':_0x144102,'attributes':['id',_0xfed1('0x50')],'raw':!![]})[_0xfed1('0x25')](handleEntityNotFound(_0x15e90f,null))[_0xfed1('0x25')](function(_0x427fa6){if(_0x427fa6){var _0xbd49dc=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x427fa6[_0xfed1('0x50')]);var _0x3a7a42=util[_0xfed1('0x59')]('%s.cypher',_0xbd49dc);if(fs['existsSync'](_0x3a7a42)){_0x1a9f22=!![];return _0x2665c8[_0xfed1('0x5a')](_0x3a7a42,_0xbd49dc,config[_0xfed1('0x5b')][_0xfed1('0x5c')])[_0xfed1('0x25')](function(){return _0x427fa6;});}return _0x427fa6;}})[_0xfed1('0x25')](function(_0x41a22a){if(_0x41a22a){var _0x2ccdc3=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x41a22a[_0xfed1('0x50')]);if(!fs[_0xfed1('0x5d')](_0x2ccdc3)){throw new db[(_0xfed1('0x5e'))][(_0xfed1('0x5f'))]('ScreenRecording\x20not\x20found');}if(_0x41a22a[_0xfed1('0x60')]){return _0x15e90f['download'](_0x2ccdc3,_0x41a22a['filename']+path[_0xfed1('0x61')](_0x2ccdc3),function(){if(_0x1a9f22){fs['unlink'](_0x2ccdc3);}});}else{return _0x15e90f[_0xfed1('0x53')](_0x2ccdc3,function(_0x5acc45){if(_0x1a9f22){fs[_0xfed1('0x62')](_0x2ccdc3);}});}}})[_0xfed1('0x4a')](function(_0x53f0ab){if(_0x53f0ab[_0xfed1('0x63')]===_0xfed1('0x64')){_0x15e90f['status'](0x194)[_0xfed1('0x2b')](_0xfed1('0x65'));}else{return handleError(_0x15e90f,null);}});};exports[_0xfed1('0x26')]=function(_0x2f37b9,_0x59a23a){return db[_0xfed1('0x2c')][_0xfed1('0x51')]({'where':{'id':_0x2f37b9[_0xfed1('0x47')]['id']}})[_0xfed1('0x25')](function(_0x23347a){if(_[_0xfed1('0x66')](_0x23347a)){throw new ReferenceError(_0xfed1('0x67'));}return _0x23347a;})[_0xfed1('0x25')](function(_0x5c043d){var _0x2d66ec=path[_0xfed1('0x56')](config[_0xfed1('0x57')],_0xfed1('0x58'),_0x5c043d[_0xfed1('0x50')]);logger[_0xfed1('0x68')]('cancellazione\x20fisica\x20documento\x20%s',_0x2d66ec);if(!_['isNil'](_0x5c043d['value'])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}_0x2d66ec=_0x2d66ec+_0xfed1('0x6b');if(!_['isNil'](_0x5c043d[_0xfed1('0x50')])&&fs[_0xfed1('0x5d')](_0x2d66ec)){logger[_0xfed1('0x68')](_0xfed1('0x69')+_0x2d66ec+_0xfed1('0x6a'));fs['unlinkSync'](_0x2d66ec);}return _0x5c043d;})[_0xfed1('0x25')](function(_0x6b74cb){if(!_0x6b74cb)throw new InternalError();return _0x6b74cb[_0xfed1('0x26')]();})['then'](function(){_0x59a23a[_0xfed1('0x1a')](0xcc)[_0xfed1('0x1b')]();})[_0xfed1('0x4a')](handleError(_0x59a23a,null));}; \ No newline at end of file +var _0x7fbe=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','stack','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','format','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','find','catch','create','body','duration','createdAt','closedAt','params','describe','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5e7609,_0x1659ac){var _0x345ce5=function(_0x410b5e){while(--_0x410b5e){_0x5e7609['push'](_0x5e7609['shift']());}};_0x345ce5(++_0x1659ac);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1ff385,_0x2f30bb){_0x1ff385=_0x1ff385-0x0;var _0x563380=_0x7fbe[_0x1ff385];return _0x563380;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();});}};}function handleEntityNotFound(_0x2996ae,_0x4f6c73){return function(_0x6c930){if(!_0x6c930){_0x2996ae[_0xe7fb('0x1b')](0x194);}return _0x6c930;};}function handleError(_0x390f32,_0x1ceed8){_0x1ceed8=_0x1ceed8||0x1f4;return function(_0x392d75){logger[_0xe7fb('0x28')](_0x392d75[_0xe7fb('0x29')]);if(_0x392d75['name']){delete _0x392d75['name'];}_0x390f32[_0xe7fb('0x1c')](_0x1ceed8)[_0xe7fb('0x2a')](_0x392d75);};}exports[_0xe7fb('0x2b')]=function(_0x4fd290,_0xb1f2f4){var _0x251807={},_0xd3fffe={},_0x5f265f={'count':0x0,'rows':[]};var _0x219554=_[_0xe7fb('0x2c')](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')],function(_0x4ce993){return{'name':_0x4ce993[_0xe7fb('0x2f')],'type':_0x4ce993[_0xe7fb('0x30')][_0xe7fb('0x31')]};});_0xd3fffe['model']=_['differenceBy'](_[_0xe7fb('0x2c')](_0x219554,'name'),[_0xe7fb('0x32')]);_0xd3fffe[_0xe7fb('0x33')]=_[_0xe7fb('0x34')](_0x4fd290[_0xe7fb('0x33')]);_0xd3fffe['filters']=_[_0xe7fb('0x35')](_0xd3fffe[_0xe7fb('0x36')],_0xd3fffe[_0xe7fb('0x33')]);_0x251807[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xd3fffe['model'],qs[_0xe7fb('0x38')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x251807[_0xe7fb('0x37')]=_0x251807[_0xe7fb('0x37')][_0xe7fb('0x39')]?_0x251807[_0xe7fb('0x37')]:_0xd3fffe[_0xe7fb('0x36')];if(!_0x4fd290[_0xe7fb('0x33')]['hasOwnProperty'](_0xe7fb('0x3a'))){_0x251807[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x4fd290['query'][_0xe7fb('0x20')]);_0x251807[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x1e')]);}_0x251807[_0xe7fb('0x3b')]=qs[_0xe7fb('0x3c')](_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x3c')]);_0x251807[_0xe7fb('0x3d')]=qs[_0xe7fb('0x3e')](_[_0xe7fb('0x3f')](_0x4fd290[_0xe7fb('0x33')],_0xd3fffe[_0xe7fb('0x3e')]),_0x219554);if(_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]){_0x251807[_0xe7fb('0x3d')]=_[_0xe7fb('0x41')](_0x251807[_0xe7fb('0x3d')],{'$or':_['map'](_0x219554,function(_0x261ec5){if(_0x261ec5[_0xe7fb('0x30')]!==_0xe7fb('0x42')){var _0x444f98={};_0x444f98[_0x261ec5['name']]={'$like':'%'+_0x4fd290[_0xe7fb('0x33')][_0xe7fb('0x40')]+'%'};return _0x444f98;}})});}_0x251807=_[_0xe7fb('0x41')]({},_0x251807,_0x4fd290[_0xe7fb('0x43')]);var _0x49fe9d={'where':_0x251807[_0xe7fb('0x3d')]};return db[_0xe7fb('0x2d')][_0xe7fb('0x21')](_0x49fe9d)[_0xe7fb('0x26')](function(_0x468d16){_0x5f265f[_0xe7fb('0x21')]=_0x468d16;if(_0x4fd290['query'][_0xe7fb('0x44')]){_0x251807[_0xe7fb('0x45')]=[{'all':!![]}];}return db[_0xe7fb('0x2d')]['findAll'](_0x251807);})[_0xe7fb('0x26')](function(_0x3a8c52){_0x5f265f['rows']=_0x3a8c52;return _0x5f265f;})['then'](respondWithFilteredResult(_0xb1f2f4,_0x251807))['catch'](handleError(_0xb1f2f4,null));};exports['show']=function(_0x5e0153,_0x900d67){var _0x957ca3={'raw':![],'where':{'id':_0x5e0153['params']['id']}},_0xed62e9={};_0xed62e9[_0xe7fb('0x36')]=_['keys'](db[_0xe7fb('0x2d')][_0xe7fb('0x2e')]);_0xed62e9['query']=_[_0xe7fb('0x34')](_0x5e0153[_0xe7fb('0x33')]);_0xed62e9[_0xe7fb('0x3e')]=_[_0xe7fb('0x35')](_0xed62e9['model'],_0xed62e9[_0xe7fb('0x33')]);_0x957ca3[_0xe7fb('0x37')]=_[_0xe7fb('0x35')](_0xed62e9['model'],qs[_0xe7fb('0x38')](_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x38')]));_0x957ca3[_0xe7fb('0x37')]=_0x957ca3[_0xe7fb('0x37')]['length']?_0x957ca3[_0xe7fb('0x37')]:_0xed62e9['model'];if(_0x5e0153[_0xe7fb('0x33')][_0xe7fb('0x44')]){_0x957ca3[_0xe7fb('0x45')]=[{'all':!![]}];}_0x957ca3=_[_0xe7fb('0x41')]({},_0x957ca3,_0x5e0153[_0xe7fb('0x43')]);return db['ScreenRecording'][_0xe7fb('0x46')](_0x957ca3)['then'](handleEntityNotFound(_0x900d67,null))['then'](respondWithResult(_0x900d67,null))[_0xe7fb('0x47')](handleError(_0x900d67,null));};exports[_0xe7fb('0x48')]=function(_0x16327f,_0x589555){return db[_0xe7fb('0x2d')][_0xe7fb('0x48')](_0x16327f['body'],{})['then'](respondWithResult(_0x589555,0xc9))[_0xe7fb('0x47')](handleError(_0x589555,null));};exports[_0xe7fb('0x25')]=function(_0x1cbf34,_0x3dd6bf){if(_0x1cbf34[_0xe7fb('0x49')]['id']){delete _0x1cbf34[_0xe7fb('0x49')]['id'];}delete _0x1cbf34[_0xe7fb('0x49')][_0xe7fb('0x4a')];delete _0x1cbf34['body'][_0xe7fb('0x4b')];delete _0x1cbf34['body'][_0xe7fb('0x4c')];delete _0x1cbf34[_0xe7fb('0x49')]['value'];return db[_0xe7fb('0x2d')]['find']({'where':{'id':_0x1cbf34[_0xe7fb('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3dd6bf,null))[_0xe7fb('0x26')](saveUpdates(_0x1cbf34['body'],null))[_0xe7fb('0x26')](respondWithResult(_0x3dd6bf,null))['catch'](handleError(_0x3dd6bf,null));};exports[_0xe7fb('0x4e')]=function(_0x1b6442,_0x41fcfb){return db[_0xe7fb('0x2d')][_0xe7fb('0x4e')]()[_0xe7fb('0x26')](respondWithResult(_0x41fcfb,null))[_0xe7fb('0x47')](handleError(_0x41fcfb,null));};exports['download']=function(_0x5d20dc,_0x20aa55,_0x4948a7){var _0x4f4240=require('../../components/encryptor');var _0x50b8df=![];var _0x539252={};if(_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]&&_0x5d20dc[_0xe7fb('0x33')][_0xe7fb('0x30')]==='uniqueid'){_0x539252[_0xe7fb('0x4f')]=_0x5d20dc[_0xe7fb('0x4d')]['id'];}else{_0x539252['id']=_0x5d20dc[_0xe7fb('0x4d')]['id'];}return db['ScreenRecording']['find']({'where':_0x539252,'attributes':['id',_0xe7fb('0x50')],'raw':!![]})[_0xe7fb('0x26')](handleEntityNotFound(_0x20aa55,null))[_0xe7fb('0x26')](function(_0x4f4ba3){if(_0x4f4ba3){var _0x27f860=path[_0xe7fb('0x51')](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x4f4ba3['value']);var _0x4b35f9=util[_0xe7fb('0x32')](_0xe7fb('0x54'),_0x27f860);if(fs[_0xe7fb('0x55')](_0x4b35f9)){_0x50b8df=!![];return _0x4f4240[_0xe7fb('0x56')](_0x4b35f9,_0x27f860,config[_0xe7fb('0x57')]['recording'])[_0xe7fb('0x26')](function(){return _0x4f4ba3;});}return _0x4f4ba3;}})[_0xe7fb('0x26')](function(_0x23755b){if(_0x23755b){var _0x590d7a=path['join'](config[_0xe7fb('0x52')],_0xe7fb('0x53'),_0x23755b[_0xe7fb('0x50')]);if(!fs[_0xe7fb('0x55')](_0x590d7a)){throw new db[(_0xe7fb('0x58'))][(_0xe7fb('0x59'))]('ScreenRecording\x20not\x20found');}if(_0x23755b[_0xe7fb('0x5a')]){return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,_0x23755b[_0xe7fb('0x5a')]+path[_0xe7fb('0x5c')](_0x590d7a),function(){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}else{return _0x20aa55[_0xe7fb('0x5b')](_0x590d7a,function(_0x554092){if(_0x50b8df){fs[_0xe7fb('0x5d')](_0x590d7a);}});}}})['catch'](function(_0x1eda1d){if(_0x1eda1d[_0xe7fb('0x5e')]===_0xe7fb('0x5f')){_0x20aa55[_0xe7fb('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x20aa55,null);}});};exports[_0xe7fb('0x60')]=function(_0x11e15a,_0x25aeb2){return db[_0xe7fb('0x2d')][_0xe7fb('0x46')]({'where':{'id':_0x11e15a['params']['id']}})[_0xe7fb('0x26')](function(_0x58d4ec){if(_[_0xe7fb('0x61')](_0x58d4ec)){throw new ReferenceError('Entity\x20not\x20found');}return _0x58d4ec;})['then'](function(_0xc13fac){var _0x203da3=path[_0xe7fb('0x51')](config['root'],_0xe7fb('0x53'),_0xc13fac[_0xe7fb('0x50')]);logger[_0xe7fb('0x62')](_0xe7fb('0x63'),_0x203da3);if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')]('File:\x20\x22'+_0x203da3+_0xe7fb('0x64'));fs[_0xe7fb('0x65')](_0x203da3);}_0x203da3=_0x203da3+'.cypher';if(!_[_0xe7fb('0x61')](_0xc13fac['value'])&&fs[_0xe7fb('0x55')](_0x203da3)){logger[_0xe7fb('0x62')](_0xe7fb('0x66')+_0x203da3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7fb('0x65')](_0x203da3);}return _0xc13fac;})[_0xe7fb('0x26')](function(_0x2c558a){if(!_0x2c558a)throw new InternalError();return _0x2c558a[_0xe7fb('0x60')]();})[_0xe7fb('0x26')](function(){_0x25aeb2[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x27')]();})[_0xe7fb('0x47')](handleError(_0x25aeb2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e7e8092..42d8585 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 _0x8f5d=['ScreenRecording','screen_recordings','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x12f171,_0x4d1aa7){var _0x3f0c11=function(_0x20fac6){while(--_0x20fac6){_0x12f171['push'](_0x12f171['shift']());}};_0x3f0c11(++_0x4d1aa7);}(_0x8f5d,0xa4));var _0xd8f5=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x8f5d[_0x342baa];return _0x1208f3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd8f5('0x0'))(_0xd8f5('0x1'));var moment=require(_0xd8f5('0x2'));var BPromise=require(_0xd8f5('0x3'));var rp=require(_0xd8f5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd8f5('0x5'));var attributes=require('./screenRecording.attributes');module[_0xd8f5('0x6')]=function(_0x9ef1bd,_0x19b421){return _0x9ef1bd['define'](_0xd8f5('0x7'),attributes,{'tableName':_0xd8f5('0x8'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xdca0=['../../config/logger','api','moment','request-promise','path','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x300d13,_0x412659){var _0x39541d=function(_0x4dd523){while(--_0x4dd523){_0x300d13['push'](_0x300d13['shift']());}};_0x39541d(++_0x412659);}(_0xdca0,0x128));var _0x0dca=function(_0x4a456e,_0x5318dd){_0x4a456e=_0x4a456e-0x0;var _0x7428f5=_0xdca0[_0x4a456e];return _0x7428f5;};'use strict';var _=require(_0x0dca('0x0'));var util=require('util');var logger=require(_0x0dca('0x1'))(_0x0dca('0x2'));var moment=require(_0x0dca('0x3'));var BPromise=require('bluebird');var rp=require(_0x0dca('0x4'));var fs=require('fs');var path=require(_0x0dca('0x5'));var rimraf=require('rimraf');var config=require(_0x0dca('0x6'));var attributes=require(_0x0dca('0x7'));module['exports']=function(_0x334551,_0x3fb550){return _0x334551['define'](_0x0dca('0x8'),attributes,{'tableName':_0x0dca('0x9'),'paranoid':![],'indexes':[{'name':_0x0dca('0xa'),'fields':[_0x0dca('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 4ea9a9a..0d2bb44 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 _0x016a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x393f6e,_0x5c1072){var _0x5c5083=function(_0x442603){while(--_0x442603){_0x393f6e['push'](_0x393f6e['shift']());}};_0x5c5083(++_0x5c1072);}(_0x016a,0x79));var _0xa016=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0x016a[_0x59c301];return _0x3866b9;};'use strict';var _=require('lodash');var util=require(_0xa016('0x0'));var moment=require(_0xa016('0x1'));var BPromise=require(_0xa016('0x2'));var rs=require(_0xa016('0x3'));var fs=require('fs');var Redis=require(_0xa016('0x4'));var db=require(_0xa016('0x5'))['db'];var utils=require(_0xa016('0x6'));var logger=require(_0xa016('0x7'))(_0xa016('0x8'));var config=require('../../config/environment');var jayson=require(_0xa016('0x9'));var client=jayson[_0xa016('0xa')][_0xa016('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x145acc,_0x5d12ab,_0x4cf701){return new BPromise(function(_0x2ffd13,_0x1593d2){return client[_0xa016('0xc')](_0x145acc,_0x4cf701)[_0xa016('0xd')](function(_0x49c6e7){logger[_0xa016('0xe')](_0xa016('0xf'),_0x5d12ab,_0xa016('0x10'));logger[_0xa016('0x11')](_0xa016('0x12'),_0x5d12ab,_0xa016('0x10'),JSON[_0xa016('0x13')](_0x49c6e7));if(_0x49c6e7[_0xa016('0x14')]){if(_0x49c6e7['error'][_0xa016('0x15')]===0x1f4){logger[_0xa016('0x14')](_0xa016('0xf'),_0x5d12ab,_0x49c6e7['error'][_0xa016('0x16')]);return _0x1593d2(_0x49c6e7[_0xa016('0x14')][_0xa016('0x16')]);}logger[_0xa016('0x14')](_0xa016('0xf'),_0x5d12ab,_0x49c6e7[_0xa016('0x14')][_0xa016('0x16')]);return _0x2ffd13(_0x49c6e7[_0xa016('0x14')][_0xa016('0x16')]);}else{logger[_0xa016('0xe')](_0xa016('0xf'),_0x5d12ab,'request\x20sent');_0x2ffd13(_0x49c6e7[_0xa016('0x17')][_0xa016('0x16')]);}})[_0xa016('0x18')](function(_0xad4558){logger[_0xa016('0x14')](_0xa016('0xf'),_0x5d12ab,_0xad4558);_0x1593d2(_0xad4558);});});} \ No newline at end of file +var _0xd36e=['ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','ScreenRecording,\x20%s,\x20%s','request\x20sent'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xd36e,0x18d));var _0xed36=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd36e[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xed36('0x0'));var util=require(_0xed36('0x1'));var moment=require(_0xed36('0x2'));var BPromise=require(_0xed36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xed36('0x4'));var db=require(_0xed36('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xed36('0x6'));var config=require(_0xed36('0x7'));var jayson=require(_0xed36('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18ff6e,_0x3aa13d,_0x258041){return new BPromise(function(_0x14a02d,_0x1b481a){return client['request'](_0x18ff6e,_0x258041)['then'](function(_0x275eeb){logger['info'](_0xed36('0x9'),_0x3aa13d,_0xed36('0xa'));logger['debug'](_0xed36('0xb'),_0x3aa13d,'request\x20sent',JSON[_0xed36('0xc')](_0x275eeb));if(_0x275eeb['error']){if(_0x275eeb[_0xed36('0xd')][_0xed36('0xe')]===0x1f4){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x3aa13d,_0x275eeb[_0xed36('0xd')]['message']);return _0x1b481a(_0x275eeb[_0xed36('0xd')]['message']);}logger[_0xed36('0xd')](_0xed36('0x9'),_0x3aa13d,_0x275eeb[_0xed36('0xd')][_0xed36('0xf')]);return _0x14a02d(_0x275eeb[_0xed36('0xd')][_0xed36('0xf')]);}else{logger['info'](_0xed36('0x9'),_0x3aa13d,_0xed36('0xa'));_0x14a02d(_0x275eeb['result'][_0xed36('0xf')]);}})[_0xed36('0x10')](function(_0x41b038){logger[_0xed36('0xd')](_0xed36('0x9'),_0x3aa13d,_0x41b038);_0x1b481a(_0x41b038);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 4381629..823b366 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 _0x6946=['format','%s%s','logo','extname','post','file','addLogo','server/files/images/logos/','logologin','originalname','/:id/logo_login','single','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root'];(function(_0x2952ab,_0x32ba5b){var _0x462bee=function(_0xc0aff5){while(--_0xc0aff5){_0x2952ab['push'](_0x2952ab['shift']());}};_0x462bee(++_0x32ba5b);}(_0x6946,0x1a0));var _0x6694=function(_0x141e95,_0x12dd9d){_0x141e95=_0x141e95-0x0;var _0x501b36=_0x6946[_0x141e95];return _0x501b36;};'use strict';var multer=require(_0x6694('0x0'));var util=require(_0x6694('0x1'));var path=require(_0x6694('0x2'));var timeout=require('connect-timeout');var express=require(_0x6694('0x3'));var router=express['Router']();var fs_extra=require(_0x6694('0x4'));var auth=require(_0x6694('0x5'));var interaction=require(_0x6694('0x6'));var config=require(_0x6694('0x7'));var controller=require(_0x6694('0x8'));router[_0x6694('0x9')]('/',auth[_0x6694('0xa')](),controller['index']);router['get'](_0x6694('0xb'),controller[_0x6694('0xc')]);router[_0x6694('0x9')](_0x6694('0xd'),controller[_0x6694('0xe')]);router[_0x6694('0x9')](_0x6694('0xf'),controller[_0x6694('0x10')]);router['get']('/:id/logo_login',controller[_0x6694('0x11')]);router[_0x6694('0x9')]('/:id/gdpr',controller['gdpr']);router[_0x6694('0x9')](_0x6694('0x12'),controller[_0x6694('0x13')]);router[_0x6694('0x9')]('/:id/favicon',controller[_0x6694('0x14')]);var upload=multer({'storage':multer[_0x6694('0x15')]({'destination':function(_0xe4c4fb,_0x2d5c8c,_0x1ff1c8){_0x1ff1c8(null,path[_0x6694('0x16')](config[_0x6694('0x17')],'server/files/images/logos/'));},'filename':function(_0x5f2735,_0x14a334,_0x560874){_0x560874(null,util[_0x6694('0x18')](_0x6694('0x19'),_0x6694('0x1a'),path[_0x6694('0x1b')](_0x14a334['originalname'])));}})});router[_0x6694('0x1c')](_0x6694('0xf'),upload['single'](_0x6694('0x1d')),controller[_0x6694('0x1e')]);var upload=multer({'storage':multer[_0x6694('0x15')]({'destination':function(_0x363eb6,_0xef1339,_0x57f27d){_0x57f27d(null,path['join'](config[_0x6694('0x17')],_0x6694('0x1f')));},'filename':function(_0x2e743c,_0x4cf4ee,_0x2c8447){_0x2c8447(null,util[_0x6694('0x18')](_0x6694('0x19'),_0x6694('0x20'),path[_0x6694('0x1b')](_0x4cf4ee[_0x6694('0x21')])));}})});router[_0x6694('0x1c')](_0x6694('0x22'),upload[_0x6694('0x23')]('file'),controller[_0x6694('0x24')]);var upload=multer({'storage':multer[_0x6694('0x15')]({'destination':function(_0x2bad7d,_0xbe7732,_0x8fa6a){_0x8fa6a(null,path['join'](config[_0x6694('0x17')],'server/files/images/logos/'));},'filename':function(_0x16f5a1,_0x459a84,_0x49944e){_0x49944e(null,util[_0x6694('0x18')](_0x6694('0x19'),_0x6694('0x25'),path[_0x6694('0x1b')](_0x459a84[_0x6694('0x21')])));}})});router[_0x6694('0x1c')]('/:id/preferred',upload[_0x6694('0x23')](_0x6694('0x1d')),controller[_0x6694('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3ea9c9,_0x2815e4,_0x3d3f9e){_0x3d3f9e(null,path[_0x6694('0x16')](config[_0x6694('0x17')],_0x6694('0x1f')));},'filename':function(_0x58cea1,_0x3e90e2,_0x48e7d3){_0x48e7d3(null,util[_0x6694('0x18')](_0x6694('0x19'),_0x6694('0x27'),path[_0x6694('0x1b')](_0x3e90e2[_0x6694('0x21')])));}})});router[_0x6694('0x1c')](_0x6694('0x28'),upload['single'](_0x6694('0x1d')),controller[_0x6694('0x29')]);router[_0x6694('0x2a')](_0x6694('0xd'),auth[_0x6694('0xa')](),controller[_0x6694('0x2b')]);module['exports']=router; \ No newline at end of file +var _0xadb9=['getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','favicon','/:id','update','exports','util','path','Router','fs-extra','../../config/environment','./setting.controller','get','isAuthenticated','index','/now'];(function(_0x3d2fd7,_0x50a0d5){var _0x50ddd2=function(_0x11e269){while(--_0x11e269){_0x3d2fd7['push'](_0x3d2fd7['shift']());}};_0x50ddd2(++_0x50a0d5);}(_0xadb9,0x167));var _0x9adb=function(_0x4f1676,_0x37289e){_0x4f1676=_0x4f1676-0x0;var _0x25d0a1=_0xadb9[_0x4f1676];return _0x25d0a1;};'use strict';var multer=require('multer');var util=require(_0x9adb('0x0'));var path=require(_0x9adb('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9adb('0x2')]();var fs_extra=require(_0x9adb('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9adb('0x4'));var controller=require(_0x9adb('0x5'));router[_0x9adb('0x6')]('/',auth[_0x9adb('0x7')](),controller[_0x9adb('0x8')]);router[_0x9adb('0x6')](_0x9adb('0x9'),controller[_0x9adb('0xa')]);router[_0x9adb('0x6')]('/:id',controller['show']);router[_0x9adb('0x6')](_0x9adb('0xb'),controller[_0x9adb('0xc')]);router['get'](_0x9adb('0xd'),controller[_0x9adb('0xe')]);router[_0x9adb('0x6')](_0x9adb('0xf'),controller[_0x9adb('0x10')]);router[_0x9adb('0x6')](_0x9adb('0x11'),controller[_0x9adb('0x12')]);router[_0x9adb('0x6')](_0x9adb('0x13'),controller[_0x9adb('0x14')]);var upload=multer({'storage':multer[_0x9adb('0x15')]({'destination':function(_0x3dce9c,_0x770c1f,_0x27c8bc){_0x27c8bc(null,path[_0x9adb('0x16')](config[_0x9adb('0x17')],_0x9adb('0x18')));},'filename':function(_0x265a37,_0x180e5b,_0x3b4ce1){_0x3b4ce1(null,util[_0x9adb('0x19')](_0x9adb('0x1a'),'logo',path[_0x9adb('0x1b')](_0x180e5b[_0x9adb('0x1c')])));}})});router[_0x9adb('0x1d')](_0x9adb('0xb'),upload[_0x9adb('0x1e')](_0x9adb('0x1f')),controller[_0x9adb('0x20')]);var upload=multer({'storage':multer[_0x9adb('0x15')]({'destination':function(_0x5e602b,_0x159a79,_0x1806d8){_0x1806d8(null,path[_0x9adb('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x113b1e,_0xc1af44,_0x4e226d){_0x4e226d(null,util[_0x9adb('0x19')](_0x9adb('0x1a'),_0x9adb('0x21'),path['extname'](_0xc1af44[_0x9adb('0x1c')])));}})});router[_0x9adb('0x1d')](_0x9adb('0xd'),upload[_0x9adb('0x1e')]('file'),controller[_0x9adb('0x22')]);var upload=multer({'storage':multer[_0x9adb('0x15')]({'destination':function(_0x5a4999,_0x1798b8,_0x28e56a){_0x28e56a(null,path['join'](config['root'],_0x9adb('0x18')));},'filename':function(_0x26cfe4,_0x30bae0,_0x59b35f){_0x59b35f(null,util[_0x9adb('0x19')](_0x9adb('0x1a'),_0x9adb('0x23'),path[_0x9adb('0x1b')](_0x30bae0[_0x9adb('0x1c')])));}})});router[_0x9adb('0x1d')](_0x9adb('0x11'),upload['single'](_0x9adb('0x1f')),controller[_0x9adb('0x24')]);var upload=multer({'storage':multer[_0x9adb('0x15')]({'destination':function(_0x223177,_0x3dcbd3,_0x183ff1){_0x183ff1(null,path[_0x9adb('0x16')](config[_0x9adb('0x17')],_0x9adb('0x18')));},'filename':function(_0x577aef,_0xcf097,_0x4fc7b6){_0x4fc7b6(null,util[_0x9adb('0x19')](_0x9adb('0x1a'),_0x9adb('0x25'),path[_0x9adb('0x1b')](_0xcf097[_0x9adb('0x1c')])));}})});router[_0x9adb('0x1d')](_0x9adb('0x13'),upload[_0x9adb('0x1e')](_0x9adb('0x1f')),controller['addFavicon']);router['put'](_0x9adb('0x26'),auth[_0x9adb('0x7')](),controller[_0x9adb('0x27')]);module[_0x9adb('0x28')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index cb76a86..8ea8118 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(_0x26678e,_0x46f3bc){var _0x7be478=function(_0x5a9b39){while(--_0x5a9b39){_0x26678e['push'](_0x26678e['shift']());}};_0x7be478(++_0x46f3bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x2995df,_0x4953a0){var _0x45f727=function(_0x13b2e2){while(--_0x13b2e2){_0x2995df['push'](_0x2995df['shift']());}};_0x45f727(++_0x4953a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 76250e3..ff437f8 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 _0xc8b0=['update','destroy','stack','name','index','map','Setting','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','body','find','addLogo','file','logo','filename','loginLogo','getLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','root','join','toLower','default_logo.svg','upperFirst','existsSync','download','getLogoLogin','preferred','default_loginLogo.svg','ValidationError','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','default','Sequelize','addFavicon','getFavicon','custom','default_favicon.ico','getDate','utcOffset','now','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','message','Setting,\x20%s,\x20%s','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc8b0,0x1cc));var _0x0c8b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc8b0[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x0c8b('0x0'));var rimraf=require(_0x0c8b('0x1'));var zipdir=require(_0x0c8b('0x2'));var jsonpatch=require(_0x0c8b('0x3'));var rp=require(_0x0c8b('0x4'));var moment=require(_0x0c8b('0x5'));var BPromise=require(_0x0c8b('0x6'));var Mustache=require(_0x0c8b('0x7'));var util=require(_0x0c8b('0x8'));var path=require(_0x0c8b('0x9'));var sox=require(_0x0c8b('0xa'));var csv=require(_0x0c8b('0xb'));var ejs=require(_0x0c8b('0xc'));var fs=require('fs');var fs_extra=require(_0x0c8b('0xd'));var _=require(_0x0c8b('0xe'));var squel=require('squel');var crypto=require(_0x0c8b('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x0c8b('0x10'));var toCsv=require(_0x0c8b('0xb'));var querystring=require(_0x0c8b('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c8b('0x12'));var qs=require(_0x0c8b('0x13'));var as=require(_0x0c8b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c8b('0x15'))(_0x0c8b('0x16'));var utils=require(_0x0c8b('0x17'));var config=require(_0x0c8b('0x18'));var licenseUtil=require(_0x0c8b('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0x0c8b('0x1a'));var client=jayson[_0x0c8b('0x1b')][_0x0c8b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2baf59,_0x47246a,_0x4b202b,_0x1af8c2){return new BPromise(function(_0x3b1b4d,_0x5c44f0){var _0x4d47ba=_0x1af8c2||client;return _0x4d47ba[_0x0c8b('0x1d')](_0x2baf59,_0x4b202b)[_0x0c8b('0x1e')](function(_0x582e44){logger[_0x0c8b('0x1f')]('Setting,\x20%s,\x20%s',_0x47246a,_0x0c8b('0x20'));logger[_0x0c8b('0x21')](_0x0c8b('0x22'),_0x47246a,_0x0c8b('0x20'),JSON['stringify'](_0x582e44));if(_0x582e44[_0x0c8b('0x23')]){if(_0x582e44[_0x0c8b('0x23')]['code']===0x1f4){logger[_0x0c8b('0x23')]('Setting,\x20%s,\x20%s',_0x47246a,_0x582e44['error']['message']);return _0x5c44f0(_0x582e44[_0x0c8b('0x23')][_0x0c8b('0x24')]);}logger[_0x0c8b('0x23')](_0x0c8b('0x25'),_0x47246a,_0x582e44['error'][_0x0c8b('0x24')]);return _0x3b1b4d(_0x582e44[_0x0c8b('0x23')][_0x0c8b('0x24')]);}else{logger['info'](_0x0c8b('0x25'),_0x47246a,_0x0c8b('0x20'));_0x3b1b4d(_0x582e44[_0x0c8b('0x26')][_0x0c8b('0x24')]);}})['catch'](function(_0x39a559){logger['error'](_0x0c8b('0x25'),_0x47246a,_0x39a559);_0x5c44f0(_0x39a559);});});}function respondWithStatusCode(_0x1dafe0,_0x1572ae){_0x1572ae=_0x1572ae||0xcc;return function(_0x29ab10){if(_0x29ab10){return _0x1dafe0[_0x0c8b('0x27')](_0x1572ae);}return _0x1dafe0[_0x0c8b('0x28')](_0x1572ae)[_0x0c8b('0x29')]();};}function respondWithResult(_0xe42e83,_0x55789b){_0x55789b=_0x55789b||0xc8;return function(_0x5cf080){if(_0x5cf080){return _0xe42e83[_0x0c8b('0x28')](_0x55789b)['json'](_0x5cf080);}};}function respondWithFilteredResult(_0x304d52,_0x57a413){return function(_0x1a242b){if(_0x1a242b){var _0x1cf823=typeof _0x57a413[_0x0c8b('0x2a')]===_0x0c8b('0x2b')&&typeof _0x57a413['limit']==='undefined';var _0x1e3185=_0x1a242b[_0x0c8b('0x2c')];var _0x48da90=_0x1cf823?0x0:_0x57a413[_0x0c8b('0x2a')];var _0x31bf70=_0x1cf823?_0x1a242b[_0x0c8b('0x2c')]:_0x57a413[_0x0c8b('0x2a')]+_0x57a413[_0x0c8b('0x2d')];var _0x240513;if(_0x31bf70>=_0x1e3185){_0x31bf70=_0x1e3185;_0x240513=0xc8;}else{_0x240513=0xce;}_0x304d52[_0x0c8b('0x28')](_0x240513);return _0x304d52[_0x0c8b('0x2e')](_0x0c8b('0x2f'),_0x48da90+'-'+_0x31bf70+'/'+_0x1e3185)[_0x0c8b('0x30')](_0x1a242b);}return null;};}function patchUpdates(_0x5f4c1b){return function(_0x8f43ba){try{jsonpatch[_0x0c8b('0x31')](_0x8f43ba,_0x5f4c1b,!![]);}catch(_0x18344d){return BPromise[_0x0c8b('0x32')](_0x18344d);}return _0x8f43ba[_0x0c8b('0x33')]();};}function saveUpdates(_0x20c9f5,_0x4d5787){return function(_0x5e6a81){if(_0x5e6a81){return _0x5e6a81[_0x0c8b('0x34')](_0x20c9f5)[_0x0c8b('0x1e')](function(_0x175197){return _0x175197;});}return null;};}function removeEntity(_0x4fc25b,_0x4e8868){return function(_0x2b7da0){if(_0x2b7da0){return _0x2b7da0[_0x0c8b('0x35')]()[_0x0c8b('0x1e')](function(){_0x4fc25b['status'](0xcc)[_0x0c8b('0x29')]();});}};}function handleEntityNotFound(_0x2e2625,_0x2c1826){return function(_0x51b0e9){if(!_0x51b0e9){_0x2e2625[_0x0c8b('0x27')](0x194);}return _0x51b0e9;};}function handleError(_0x5a7723,_0x11a9e6){_0x11a9e6=_0x11a9e6||0x1f4;return function(_0x3394ae){logger[_0x0c8b('0x23')](_0x3394ae[_0x0c8b('0x36')]);if(_0x3394ae[_0x0c8b('0x37')]){delete _0x3394ae[_0x0c8b('0x37')];}_0x5a7723[_0x0c8b('0x28')](_0x11a9e6)['send'](_0x3394ae);};}exports[_0x0c8b('0x38')]=function(_0x5363a0,_0x475e97){var _0x431c79={},_0x2ea420={},_0x1ed28d={'count':0x0,'rows':[]};var _0x37f05e=_[_0x0c8b('0x39')](db[_0x0c8b('0x3a')][_0x0c8b('0x3b')],function(_0x423e8d){return{'name':_0x423e8d['fieldName'],'type':_0x423e8d[_0x0c8b('0x3c')][_0x0c8b('0x3d')]};});_0x2ea420[_0x0c8b('0x3e')]=_[_0x0c8b('0x39')](_0x37f05e,_0x0c8b('0x37'));_0x2ea420[_0x0c8b('0x3f')]=_[_0x0c8b('0x40')](_0x5363a0[_0x0c8b('0x3f')]);_0x2ea420['filters']=_[_0x0c8b('0x41')](_0x2ea420['model'],_0x2ea420[_0x0c8b('0x3f')]);_0x431c79[_0x0c8b('0x42')]=_['intersection'](_0x2ea420[_0x0c8b('0x3e')],qs[_0x0c8b('0x43')](_0x5363a0[_0x0c8b('0x3f')][_0x0c8b('0x43')]));_0x431c79['attributes']=_0x431c79[_0x0c8b('0x42')][_0x0c8b('0x44')]?_0x431c79[_0x0c8b('0x42')]:_0x2ea420[_0x0c8b('0x3e')];if(!_0x5363a0['query'][_0x0c8b('0x45')]('nolimit')){_0x431c79[_0x0c8b('0x2d')]=qs['limit'](_0x5363a0[_0x0c8b('0x3f')][_0x0c8b('0x2d')]);_0x431c79['offset']=qs[_0x0c8b('0x2a')](_0x5363a0[_0x0c8b('0x3f')][_0x0c8b('0x2a')]);}_0x431c79[_0x0c8b('0x46')]=qs[_0x0c8b('0x47')](_0x5363a0[_0x0c8b('0x3f')][_0x0c8b('0x47')]);_0x431c79[_0x0c8b('0x48')]=qs[_0x0c8b('0x49')](_[_0x0c8b('0x4a')](_0x5363a0[_0x0c8b('0x3f')],_0x2ea420[_0x0c8b('0x49')]),_0x37f05e);if(_0x5363a0[_0x0c8b('0x3f')]['filter']){_0x431c79[_0x0c8b('0x48')]=_[_0x0c8b('0x4b')](_0x431c79[_0x0c8b('0x48')],{'$or':_[_0x0c8b('0x39')](_0x37f05e,function(_0x514e9b){if(_0x514e9b[_0x0c8b('0x3c')]!==_0x0c8b('0x4c')){var _0x570448={};_0x570448[_0x514e9b['name']]={'$like':'%'+_0x5363a0[_0x0c8b('0x3f')][_0x0c8b('0x4d')]+'%'};return _0x570448;}})});}_0x431c79=_[_0x0c8b('0x4b')]({},_0x431c79,_0x5363a0['options']);var _0x547d7f={'where':_0x431c79[_0x0c8b('0x48')]};return db['Setting']['count'](_0x547d7f)[_0x0c8b('0x1e')](function(_0x73bfbe){_0x1ed28d[_0x0c8b('0x2c')]=_0x73bfbe;if(_0x5363a0[_0x0c8b('0x3f')][_0x0c8b('0x4e')]){_0x431c79[_0x0c8b('0x4f')]=[{'all':!![]}];}return db['Setting'][_0x0c8b('0x50')](_0x431c79);})[_0x0c8b('0x1e')](function(_0x3f2e5c){_0x1ed28d[_0x0c8b('0x51')]=_0x3f2e5c;return _0x1ed28d;})[_0x0c8b('0x1e')](respondWithFilteredResult(_0x475e97,_0x431c79))[_0x0c8b('0x52')](handleError(_0x475e97,null));};exports[_0x0c8b('0x53')]=function(_0x55c379,_0x5dd175){var _0x33e8f9={'raw':![],'where':{'id':_0x55c379[_0x0c8b('0x54')]['id']}},_0x3d497c={};_0x3d497c['model']=_[_0x0c8b('0x40')](db['Setting']['rawAttributes']);_0x3d497c[_0x0c8b('0x3f')]=_[_0x0c8b('0x40')](_0x55c379[_0x0c8b('0x3f')]);_0x3d497c[_0x0c8b('0x49')]=_['intersection'](_0x3d497c[_0x0c8b('0x3e')],_0x3d497c[_0x0c8b('0x3f')]);_0x33e8f9[_0x0c8b('0x42')]=_[_0x0c8b('0x41')](_0x3d497c[_0x0c8b('0x3e')],qs[_0x0c8b('0x43')](_0x55c379[_0x0c8b('0x3f')][_0x0c8b('0x43')]));_0x33e8f9[_0x0c8b('0x42')]=_0x33e8f9[_0x0c8b('0x42')]['length']?_0x33e8f9['attributes']:_0x3d497c[_0x0c8b('0x3e')];if(_0x55c379[_0x0c8b('0x3f')][_0x0c8b('0x4e')]){_0x33e8f9['include']=[{'all':!![]}];}_0x33e8f9=_['merge']({},_0x33e8f9,_0x55c379[_0x0c8b('0x55')]);return db[_0x0c8b('0x3a')]['find'](_0x33e8f9)[_0x0c8b('0x1e')](handleEntityNotFound(_0x5dd175,null))[_0x0c8b('0x1e')](respondWithResult(_0x5dd175,null))[_0x0c8b('0x52')](handleError(_0x5dd175,null));};exports[_0x0c8b('0x34')]=function(_0x2680e7,_0x4fbfa0){if(_0x2680e7[_0x0c8b('0x56')]['id']){delete _0x2680e7[_0x0c8b('0x56')]['id'];}return db['Setting'][_0x0c8b('0x57')]({'where':{'id':_0x2680e7[_0x0c8b('0x54')]['id']}})[_0x0c8b('0x1e')](handleEntityNotFound(_0x4fbfa0,null))[_0x0c8b('0x1e')](saveUpdates(_0x2680e7[_0x0c8b('0x56')],null))[_0x0c8b('0x1e')](respondWithResult(_0x4fbfa0,null))['catch'](handleError(_0x4fbfa0,null));};exports[_0x0c8b('0x58')]=function(_0x4c79da,_0x29bd4a,_0x4d1275){if(_0x4c79da[_0x0c8b('0x59')]&&_0x4c79da[_0x0c8b('0x59')]['filename']){_0x4c79da['body'][_0x0c8b('0x5a')]=_0x4c79da[_0x0c8b('0x59')][_0x0c8b('0x5b')];}return db[_0x0c8b('0x3a')][_0x0c8b('0x57')]({'where':{'id':_0x4c79da['params']['id']}})[_0x0c8b('0x1e')](handleEntityNotFound(_0x29bd4a,null))[_0x0c8b('0x1e')](saveUpdates(_0x4c79da[_0x0c8b('0x56')],null))[_0x0c8b('0x1e')](respondWithResult(_0x29bd4a,null))['catch'](handleError(_0x29bd4a,null));};exports['addLogoLogin']=function(_0x15377f,_0x3e3b78,_0x413661){if(_0x15377f[_0x0c8b('0x59')]&&_0x15377f[_0x0c8b('0x59')]['filename']){_0x15377f['body'][_0x0c8b('0x5c')]=_0x15377f[_0x0c8b('0x59')]['filename'];}return db[_0x0c8b('0x3a')]['find']({'where':{'id':_0x15377f[_0x0c8b('0x54')]['id']}})[_0x0c8b('0x1e')](handleEntityNotFound(_0x3e3b78,null))[_0x0c8b('0x1e')](saveUpdates(_0x15377f[_0x0c8b('0x56')],null))['then'](respondWithResult(_0x3e3b78,null))[_0x0c8b('0x52')](handleError(_0x3e3b78,null));};var utilLicense=require(_0x0c8b('0x19'));exports[_0x0c8b('0x5d')]=function(_0x348d88,_0x23a47c,_0x4613aa){var _0x4eac86=_0x0c8b('0x5e');var _0x2ec909={'custom':![]};return utilLicense[_0x0c8b('0x5f')]()[_0x0c8b('0x1e')](function(_0x2bb518){if(_0x2bb518){_0x2ec909=_0x2bb518;}return db[_0x0c8b('0x3a')][_0x0c8b('0x57')]({'where':{'id':_0x348d88[_0x0c8b('0x54')]['id']},'attributes':[_0x0c8b('0x5a'),'loginLogo','preferred',_0x0c8b('0x60'),_0x0c8b('0x61'),_0x0c8b('0x62'),_0x0c8b('0x63'),_0x0c8b('0x64')],'raw':!![]});})[_0x0c8b('0x1e')](handleEntityNotFound(_0x23a47c,null))[_0x0c8b('0x1e')](function(_0x11012f){if(_0x11012f){var _0xe664a9=_0x11012f[_0x0c8b('0x5a')]&&fs['existsSync'](path['join'](config[_0x0c8b('0x65')],_0x4eac86,_['toLower'](_0x11012f['logo'])))?path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x4eac86,_[_0x0c8b('0x67')](_0x11012f[_0x0c8b('0x5a')])):path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x4eac86,_[_0x0c8b('0x67')](_0x0c8b('0x68')));var _0x22a6e8='default'+_[_0x0c8b('0x69')](_0x0c8b('0x5a'));if(_0x11012f[_0x22a6e8]||!_0x2ec909['custom']){_0xe664a9=path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x4eac86,_[_0x0c8b('0x67')](_0x0c8b('0x68')));}if(!fs[_0x0c8b('0x6a')](_0xe664a9)){throw new db['Sequelize']['ValidationError'](_[_0x0c8b('0x69')](_0x0c8b('0x5a'))+'\x20not\x20found');}return _0x23a47c[_0x0c8b('0x6b')](_0xe664a9);}})[_0x0c8b('0x52')](handleError(_0x23a47c,null));};var utilLicense=require('../../config/license/util');exports[_0x0c8b('0x6c')]=function(_0x48bb1e,_0x408ba5,_0x2e7e54){var _0x1e9110=_0x0c8b('0x5e');var _0x2b0fd9={'custom':![]};return utilLicense[_0x0c8b('0x5f')]()[_0x0c8b('0x1e')](function(_0x220448){if(_0x220448){_0x2b0fd9=_0x220448;}return db['Setting'][_0x0c8b('0x57')]({'where':{'id':_0x48bb1e[_0x0c8b('0x54')]['id']},'attributes':[_0x0c8b('0x5a'),'loginLogo',_0x0c8b('0x6d'),_0x0c8b('0x60'),_0x0c8b('0x61'),'defaultLoginLogo','defaultPreferred',_0x0c8b('0x64')],'raw':!![]});})[_0x0c8b('0x1e')](handleEntityNotFound(_0x408ba5,null))['then'](function(_0x107ee2){if(_0x107ee2){var _0xf56cbc=_0x107ee2[_0x0c8b('0x5c')]&&fs[_0x0c8b('0x6a')](path['join'](config[_0x0c8b('0x65')],_0x1e9110,_[_0x0c8b('0x67')](_0x107ee2[_0x0c8b('0x5c')])))?path[_0x0c8b('0x66')](config['root'],_0x1e9110,_[_0x0c8b('0x67')](_0x107ee2['loginLogo'])):path['join'](config['root'],_0x1e9110,_[_0x0c8b('0x67')](_0x0c8b('0x6e')));var _0x29d6f7='default'+_[_0x0c8b('0x69')](_0x0c8b('0x5c'));if(_0x107ee2[_0x29d6f7]||!_0x2b0fd9['custom']){_0xf56cbc=path['join'](config[_0x0c8b('0x65')],_0x1e9110,_[_0x0c8b('0x67')](_0x0c8b('0x6e')));}if(!fs[_0x0c8b('0x6a')](_0xf56cbc)){throw new db['Sequelize'][(_0x0c8b('0x6f'))](_[_0x0c8b('0x69')](_0x0c8b('0x5c'))+_0x0c8b('0x70'));}return _0x408ba5[_0x0c8b('0x6b')](_0xf56cbc);}})[_0x0c8b('0x52')](handleError(_0x408ba5,null));};exports[_0x0c8b('0x71')]=function(_0x41d4c2,_0x27b942){return db[_0x0c8b('0x3a')][_0x0c8b('0x57')]({'where':{'id':_0x41d4c2[_0x0c8b('0x54')]['id']},'attributes':[_0x0c8b('0x72')]})[_0x0c8b('0x1e')](respondWithResult(_0x27b942,null))['catch'](handleError(_0x27b942,null));};exports[_0x0c8b('0x73')]=function(_0x4e38ad,_0x4aface,_0x4991a8){if(_0x4e38ad[_0x0c8b('0x59')]&&_0x4e38ad[_0x0c8b('0x59')][_0x0c8b('0x5b')]){_0x4e38ad['body'][_0x0c8b('0x6d')]=_0x4e38ad['file'][_0x0c8b('0x5b')];}return db[_0x0c8b('0x3a')][_0x0c8b('0x57')]({'where':{'id':_0x4e38ad[_0x0c8b('0x54')]['id']}})['then'](handleEntityNotFound(_0x4aface,null))['then'](saveUpdates(_0x4e38ad[_0x0c8b('0x56')],null))[_0x0c8b('0x1e')](respondWithResult(_0x4aface,null))['catch'](handleError(_0x4aface,null));};var utilLicense=require('../../config/license/util');exports[_0x0c8b('0x74')]=function(_0x21d3ea,_0x5971a9,_0x40e739){var _0x2df664='server/files/images/logos';var _0x14b9bf={'custom':![]};return utilLicense['getLicense']()[_0x0c8b('0x1e')](function(_0x414357){if(_0x414357){_0x14b9bf=_0x414357;}return db[_0x0c8b('0x3a')][_0x0c8b('0x57')]({'where':{'id':_0x21d3ea[_0x0c8b('0x54')]['id']},'attributes':[_0x0c8b('0x5a'),_0x0c8b('0x5c'),_0x0c8b('0x6d'),'favicon',_0x0c8b('0x61'),_0x0c8b('0x62'),_0x0c8b('0x63'),_0x0c8b('0x64')],'raw':!![]});})['then'](handleEntityNotFound(_0x5971a9,null))[_0x0c8b('0x1e')](function(_0x42392e){if(_0x42392e){var _0x254c2a=_0x42392e[_0x0c8b('0x6d')]&&fs[_0x0c8b('0x6a')](path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x2df664,_[_0x0c8b('0x67')](_0x42392e['preferred'])))?path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x2df664,_[_0x0c8b('0x67')](_0x42392e[_0x0c8b('0x6d')])):path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x2df664,_[_0x0c8b('0x67')](_0x0c8b('0x75')));var _0xc170eb=_0x0c8b('0x76')+_[_0x0c8b('0x69')]('preferred');if(_0x42392e[_0xc170eb]||!_0x14b9bf['custom']||!_0x14b9bf[_0x0c8b('0x6d')]){_0x254c2a=path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x2df664,_['toLower'](_0x0c8b('0x75')));}if(!fs['existsSync'](_0x254c2a)){throw new db[(_0x0c8b('0x77'))][(_0x0c8b('0x6f'))](_[_0x0c8b('0x69')](_0x0c8b('0x6d'))+_0x0c8b('0x70'));}return _0x5971a9[_0x0c8b('0x6b')](_0x254c2a);}})[_0x0c8b('0x52')](handleError(_0x5971a9,null));};exports[_0x0c8b('0x78')]=function(_0x1bd48f,_0x531dcc,_0x4a8783){if(_0x1bd48f[_0x0c8b('0x59')]&&_0x1bd48f[_0x0c8b('0x59')][_0x0c8b('0x5b')]){_0x1bd48f[_0x0c8b('0x56')]['favicon']=_0x1bd48f[_0x0c8b('0x59')][_0x0c8b('0x5b')];}return db[_0x0c8b('0x3a')][_0x0c8b('0x57')]({'where':{'id':_0x1bd48f[_0x0c8b('0x54')]['id']}})['then'](handleEntityNotFound(_0x531dcc,null))[_0x0c8b('0x1e')](saveUpdates(_0x1bd48f[_0x0c8b('0x56')],null))['then'](respondWithResult(_0x531dcc,null))[_0x0c8b('0x52')](handleError(_0x531dcc,null));};var utilLicense=require('../../config/license/util');exports[_0x0c8b('0x79')]=function(_0x41139b,_0x39c77c,_0x1de03f){var _0x5608a8='server/files/images/logos';var _0x2ed8de={'custom':![]};return utilLicense[_0x0c8b('0x5f')]()['then'](function(_0x132688){if(_0x132688){_0x2ed8de=_0x132688;}return db[_0x0c8b('0x3a')]['find']({'where':{'id':_0x41139b[_0x0c8b('0x54')]['id']},'attributes':['logo',_0x0c8b('0x5c'),'preferred',_0x0c8b('0x60'),_0x0c8b('0x61'),_0x0c8b('0x62'),_0x0c8b('0x63'),_0x0c8b('0x64')],'raw':!![]});})[_0x0c8b('0x1e')](handleEntityNotFound(_0x39c77c,null))['then'](function(_0x35531f){if(_0x35531f){var _0x4a0cb4=_0x35531f['favicon']&&fs[_0x0c8b('0x6a')](path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x5608a8,_[_0x0c8b('0x67')](_0x35531f[_0x0c8b('0x60')])))?path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x5608a8,_['toLower'](_0x35531f[_0x0c8b('0x60')])):path['join'](config['root'],_0x5608a8,_[_0x0c8b('0x67')]('default_favicon.ico'));var _0x39839d='default'+_[_0x0c8b('0x69')]('favicon');if(_0x35531f[_0x39839d]||!_0x2ed8de[_0x0c8b('0x7a')]){_0x4a0cb4=path[_0x0c8b('0x66')](config[_0x0c8b('0x65')],_0x5608a8,_['toLower'](_0x0c8b('0x7b')));}if(!fs[_0x0c8b('0x6a')](_0x4a0cb4)){throw new db[(_0x0c8b('0x77'))][(_0x0c8b('0x6f'))](_[_0x0c8b('0x69')](_0x0c8b('0x60'))+_0x0c8b('0x70'));}return _0x39c77c['download'](_0x4a0cb4);}})['catch'](handleError(_0x39c77c,null));};exports[_0x0c8b('0x7c')]=function(_0x52dca9,_0x481c14){var _0x411df6={'offset':moment()[_0x0c8b('0x7d')]()};_0x411df6[_0x0c8b('0x7e')]=moment()[_0x0c8b('0x7d')](_0x411df6['offset'])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x481c14['status'](0xc8)[_0x0c8b('0x7f')](_0x411df6);}; \ No newline at end of file +var _0x27c7=['defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','default','gdpr','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','update','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','findAll','rows','params','Setting','include','find','body','addLogo','file','logo','filename','addLogoLogin','loginLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultPreferred'];(function(_0x36187f,_0x1eb804){var _0x224bf9=function(_0x15e4db){while(--_0x15e4db){_0x36187f['push'](_0x36187f['shift']());}};_0x224bf9(++_0x1eb804);}(_0x27c7,0x10d));var _0x727c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x27c7[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x727c('0x0'));var rimraf=require(_0x727c('0x1'));var zipdir=require(_0x727c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x727c('0x3'));var moment=require(_0x727c('0x4'));var BPromise=require(_0x727c('0x5'));var Mustache=require('mustache');var util=require(_0x727c('0x6'));var path=require(_0x727c('0x7'));var sox=require(_0x727c('0x8'));var csv=require(_0x727c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x727c('0xa'));var _=require(_0x727c('0xb'));var squel=require(_0x727c('0xc'));var crypto=require(_0x727c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x727c('0xe'));var toCsv=require(_0x727c('0x9'));var querystring=require(_0x727c('0xf'));var Papa=require('papaparse');var Redis=require(_0x727c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x727c('0x11'));var as=require(_0x727c('0x12'));var hardwareService=require(_0x727c('0x13'));var logger=require('../../config/logger')(_0x727c('0x14'));var utils=require(_0x727c('0x15'));var config=require(_0x727c('0x16'));var licenseUtil=require(_0x727c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0x727c('0x18'));var client=jayson[_0x727c('0x19')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ea810,_0x158617,_0x4d7b1,_0x4b633a){return new BPromise(function(_0x411428,_0x196c0d){var _0x3d2aae=_0x4b633a||client;return _0x3d2aae['request'](_0x1ea810,_0x4d7b1)['then'](function(_0xa7dd67){logger[_0x727c('0x1a')]('Setting,\x20%s,\x20%s',_0x158617,_0x727c('0x1b'));logger[_0x727c('0x1c')](_0x727c('0x1d'),_0x158617,_0x727c('0x1b'),JSON[_0x727c('0x1e')](_0xa7dd67));if(_0xa7dd67[_0x727c('0x1f')]){if(_0xa7dd67['error'][_0x727c('0x20')]===0x1f4){logger[_0x727c('0x1f')](_0x727c('0x21'),_0x158617,_0xa7dd67[_0x727c('0x1f')][_0x727c('0x22')]);return _0x196c0d(_0xa7dd67['error'][_0x727c('0x22')]);}logger['error'](_0x727c('0x21'),_0x158617,_0xa7dd67[_0x727c('0x1f')][_0x727c('0x22')]);return _0x411428(_0xa7dd67[_0x727c('0x1f')]['message']);}else{logger[_0x727c('0x1a')](_0x727c('0x21'),_0x158617,'request\x20sent');_0x411428(_0xa7dd67[_0x727c('0x23')]['message']);}})[_0x727c('0x24')](function(_0x14132e){logger[_0x727c('0x1f')](_0x727c('0x21'),_0x158617,_0x14132e);_0x196c0d(_0x14132e);});});}function respondWithStatusCode(_0x3c6b66,_0x437747){_0x437747=_0x437747||0xcc;return function(_0x5a24db){if(_0x5a24db){return _0x3c6b66[_0x727c('0x25')](_0x437747);}return _0x3c6b66[_0x727c('0x26')](_0x437747)[_0x727c('0x27')]();};}function respondWithResult(_0x28cc18,_0x32c5d5){_0x32c5d5=_0x32c5d5||0xc8;return function(_0x46e6a5){if(_0x46e6a5){return _0x28cc18[_0x727c('0x26')](_0x32c5d5)[_0x727c('0x28')](_0x46e6a5);}};}function respondWithFilteredResult(_0x1ca28c,_0x38a65d){return function(_0x4728dd){if(_0x4728dd){var _0x2287b0=typeof _0x38a65d['offset']==='undefined'&&typeof _0x38a65d[_0x727c('0x29')]==='undefined';var _0x4e46e1=_0x4728dd[_0x727c('0x2a')];var _0x55e6af=_0x2287b0?0x0:_0x38a65d[_0x727c('0x2b')];var _0x38d7d7=_0x2287b0?_0x4728dd[_0x727c('0x2a')]:_0x38a65d['offset']+_0x38a65d['limit'];var _0x5ad577;if(_0x38d7d7>=_0x4e46e1){_0x38d7d7=_0x4e46e1;_0x5ad577=0xc8;}else{_0x5ad577=0xce;}_0x1ca28c[_0x727c('0x26')](_0x5ad577);return _0x1ca28c[_0x727c('0x2c')](_0x727c('0x2d'),_0x55e6af+'-'+_0x38d7d7+'/'+_0x4e46e1)['json'](_0x4728dd);}return null;};}function patchUpdates(_0xca8ad3){return function(_0xc17b0c){try{jsonpatch[_0x727c('0x2e')](_0xc17b0c,_0xca8ad3,!![]);}catch(_0x1bb27a){return BPromise['reject'](_0x1bb27a);}return _0xc17b0c['save']();};}function saveUpdates(_0x252910,_0x2ca32a){return function(_0x5c7101){if(_0x5c7101){return _0x5c7101[_0x727c('0x2f')](_0x252910)[_0x727c('0x30')](function(_0x171834){return _0x171834;});}return null;};}function removeEntity(_0x135692,_0x153b3a){return function(_0x6abe0){if(_0x6abe0){return _0x6abe0[_0x727c('0x31')]()[_0x727c('0x30')](function(){_0x135692[_0x727c('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fe4e2,_0x423973){return function(_0x324421){if(!_0x324421){_0x4fe4e2[_0x727c('0x25')](0x194);}return _0x324421;};}function handleError(_0x75c867,_0x5a9cf0){_0x5a9cf0=_0x5a9cf0||0x1f4;return function(_0x5dbbd0){logger[_0x727c('0x1f')](_0x5dbbd0[_0x727c('0x32')]);if(_0x5dbbd0[_0x727c('0x33')]){delete _0x5dbbd0['name'];}_0x75c867[_0x727c('0x26')](_0x5a9cf0)[_0x727c('0x34')](_0x5dbbd0);};}exports['index']=function(_0x360fec,_0x25e756){var _0x3e8488={},_0x129635={},_0x27de7a={'count':0x0,'rows':[]};var _0x89174e=_[_0x727c('0x35')](db['Setting'][_0x727c('0x36')],function(_0x5429b7){return{'name':_0x5429b7[_0x727c('0x37')],'type':_0x5429b7[_0x727c('0x38')][_0x727c('0x39')]};});_0x129635['model']=_['map'](_0x89174e,_0x727c('0x33'));_0x129635[_0x727c('0x3a')]=_[_0x727c('0x3b')](_0x360fec['query']);_0x129635['filters']=_[_0x727c('0x3c')](_0x129635[_0x727c('0x3d')],_0x129635['query']);_0x3e8488[_0x727c('0x3e')]=_[_0x727c('0x3c')](_0x129635[_0x727c('0x3d')],qs[_0x727c('0x3f')](_0x360fec[_0x727c('0x3a')][_0x727c('0x3f')]));_0x3e8488['attributes']=_0x3e8488[_0x727c('0x3e')][_0x727c('0x40')]?_0x3e8488['attributes']:_0x129635[_0x727c('0x3d')];if(!_0x360fec['query']['hasOwnProperty'](_0x727c('0x41'))){_0x3e8488[_0x727c('0x29')]=qs[_0x727c('0x29')](_0x360fec[_0x727c('0x3a')]['limit']);_0x3e8488['offset']=qs[_0x727c('0x2b')](_0x360fec[_0x727c('0x3a')][_0x727c('0x2b')]);}_0x3e8488[_0x727c('0x42')]=qs[_0x727c('0x43')](_0x360fec[_0x727c('0x3a')][_0x727c('0x43')]);_0x3e8488[_0x727c('0x44')]=qs[_0x727c('0x45')](_[_0x727c('0x46')](_0x360fec['query'],_0x129635[_0x727c('0x45')]),_0x89174e);if(_0x360fec['query'][_0x727c('0x47')]){_0x3e8488[_0x727c('0x44')]=_[_0x727c('0x48')](_0x3e8488['where'],{'$or':_[_0x727c('0x35')](_0x89174e,function(_0xb499de){if(_0xb499de['type']!=='VIRTUAL'){var _0x58d907={};_0x58d907[_0xb499de[_0x727c('0x33')]]={'$like':'%'+_0x360fec[_0x727c('0x3a')][_0x727c('0x47')]+'%'};return _0x58d907;}})});}_0x3e8488=_[_0x727c('0x48')]({},_0x3e8488,_0x360fec[_0x727c('0x49')]);var _0x375803={'where':_0x3e8488[_0x727c('0x44')]};return db['Setting']['count'](_0x375803)[_0x727c('0x30')](function(_0x25f951){_0x27de7a[_0x727c('0x2a')]=_0x25f951;if(_0x360fec[_0x727c('0x3a')][_0x727c('0x4a')]){_0x3e8488['include']=[{'all':!![]}];}return db['Setting'][_0x727c('0x4b')](_0x3e8488);})[_0x727c('0x30')](function(_0x1b8a17){_0x27de7a[_0x727c('0x4c')]=_0x1b8a17;return _0x27de7a;})[_0x727c('0x30')](respondWithFilteredResult(_0x25e756,_0x3e8488))[_0x727c('0x24')](handleError(_0x25e756,null));};exports['show']=function(_0x1ce61c,_0x32cdd2){var _0x49b294={'raw':![],'where':{'id':_0x1ce61c[_0x727c('0x4d')]['id']}},_0x494681={};_0x494681['model']=_[_0x727c('0x3b')](db[_0x727c('0x4e')][_0x727c('0x36')]);_0x494681[_0x727c('0x3a')]=_['keys'](_0x1ce61c[_0x727c('0x3a')]);_0x494681['filters']=_[_0x727c('0x3c')](_0x494681[_0x727c('0x3d')],_0x494681[_0x727c('0x3a')]);_0x49b294[_0x727c('0x3e')]=_['intersection'](_0x494681[_0x727c('0x3d')],qs[_0x727c('0x3f')](_0x1ce61c[_0x727c('0x3a')][_0x727c('0x3f')]));_0x49b294[_0x727c('0x3e')]=_0x49b294[_0x727c('0x3e')][_0x727c('0x40')]?_0x49b294['attributes']:_0x494681[_0x727c('0x3d')];if(_0x1ce61c[_0x727c('0x3a')][_0x727c('0x4a')]){_0x49b294[_0x727c('0x4f')]=[{'all':!![]}];}_0x49b294=_[_0x727c('0x48')]({},_0x49b294,_0x1ce61c['options']);return db[_0x727c('0x4e')][_0x727c('0x50')](_0x49b294)[_0x727c('0x30')](handleEntityNotFound(_0x32cdd2,null))['then'](respondWithResult(_0x32cdd2,null))[_0x727c('0x24')](handleError(_0x32cdd2,null));};exports[_0x727c('0x2f')]=function(_0x4d5bba,_0x306459){if(_0x4d5bba[_0x727c('0x51')]['id']){delete _0x4d5bba[_0x727c('0x51')]['id'];}return db[_0x727c('0x4e')]['find']({'where':{'id':_0x4d5bba['params']['id']}})[_0x727c('0x30')](handleEntityNotFound(_0x306459,null))['then'](saveUpdates(_0x4d5bba[_0x727c('0x51')],null))[_0x727c('0x30')](respondWithResult(_0x306459,null))[_0x727c('0x24')](handleError(_0x306459,null));};exports[_0x727c('0x52')]=function(_0x1bae26,_0x3c3d2d,_0x16ca3a){if(_0x1bae26[_0x727c('0x53')]&&_0x1bae26[_0x727c('0x53')]['filename']){_0x1bae26['body'][_0x727c('0x54')]=_0x1bae26['file'][_0x727c('0x55')];}return db['Setting']['find']({'where':{'id':_0x1bae26[_0x727c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3c3d2d,null))[_0x727c('0x30')](saveUpdates(_0x1bae26[_0x727c('0x51')],null))[_0x727c('0x30')](respondWithResult(_0x3c3d2d,null))[_0x727c('0x24')](handleError(_0x3c3d2d,null));};exports[_0x727c('0x56')]=function(_0x21a510,_0x3ef322,_0x4a56f1){if(_0x21a510[_0x727c('0x53')]&&_0x21a510['file'][_0x727c('0x55')]){_0x21a510[_0x727c('0x51')][_0x727c('0x57')]=_0x21a510['file'][_0x727c('0x55')];}return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x21a510[_0x727c('0x4d')]['id']}})[_0x727c('0x30')](handleEntityNotFound(_0x3ef322,null))[_0x727c('0x30')](saveUpdates(_0x21a510['body'],null))[_0x727c('0x30')](respondWithResult(_0x3ef322,null))['catch'](handleError(_0x3ef322,null));};var utilLicense=require(_0x727c('0x17'));exports['getLogo']=function(_0x54b55b,_0x50bd70,_0xd53d9c){var _0x359b52=_0x727c('0x58');var _0x3bf31b={'custom':![]};return utilLicense[_0x727c('0x59')]()[_0x727c('0x30')](function(_0x13f5c6){if(_0x13f5c6){_0x3bf31b=_0x13f5c6;}return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x54b55b[_0x727c('0x4d')]['id']},'attributes':[_0x727c('0x54'),_0x727c('0x57'),_0x727c('0x5a'),_0x727c('0x5b'),_0x727c('0x5c'),'defaultLoginLogo',_0x727c('0x5d'),_0x727c('0x5e')],'raw':!![]});})[_0x727c('0x30')](handleEntityNotFound(_0x50bd70,null))[_0x727c('0x30')](function(_0x42e010){if(_0x42e010){var _0x17030c=_0x42e010[_0x727c('0x54')]&&fs[_0x727c('0x5f')](path[_0x727c('0x60')](config[_0x727c('0x61')],_0x359b52,_[_0x727c('0x62')](_0x42e010[_0x727c('0x54')])))?path[_0x727c('0x60')](config[_0x727c('0x61')],_0x359b52,_[_0x727c('0x62')](_0x42e010['logo'])):path['join'](config['root'],_0x359b52,_[_0x727c('0x62')](_0x727c('0x63')));var _0x1072df='default'+_[_0x727c('0x64')]('logo');if(_0x42e010[_0x1072df]||!_0x3bf31b[_0x727c('0x65')]){_0x17030c=path[_0x727c('0x60')](config[_0x727c('0x61')],_0x359b52,_['toLower'](_0x727c('0x63')));}if(!fs[_0x727c('0x5f')](_0x17030c)){throw new db[(_0x727c('0x66'))][(_0x727c('0x67'))](_[_0x727c('0x64')](_0x727c('0x54'))+_0x727c('0x68'));}return _0x50bd70[_0x727c('0x69')](_0x17030c);}})[_0x727c('0x24')](handleError(_0x50bd70,null));};var utilLicense=require(_0x727c('0x17'));exports[_0x727c('0x6a')]=function(_0x46dac6,_0x25218a,_0x42a31d){var _0xfadcee='server/files/images/logos';var _0x14d32a={'custom':![]};return utilLicense[_0x727c('0x59')]()[_0x727c('0x30')](function(_0x40c7f8){if(_0x40c7f8){_0x14d32a=_0x40c7f8;}return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x46dac6['params']['id']},'attributes':[_0x727c('0x54'),_0x727c('0x57'),_0x727c('0x5a'),_0x727c('0x5b'),_0x727c('0x5c'),'defaultLoginLogo',_0x727c('0x5d'),_0x727c('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x25218a,null))[_0x727c('0x30')](function(_0x112bbc){if(_0x112bbc){var _0x507ae4=_0x112bbc['loginLogo']&&fs[_0x727c('0x5f')](path[_0x727c('0x60')](config[_0x727c('0x61')],_0xfadcee,_[_0x727c('0x62')](_0x112bbc[_0x727c('0x57')])))?path['join'](config[_0x727c('0x61')],_0xfadcee,_['toLower'](_0x112bbc[_0x727c('0x57')])):path['join'](config[_0x727c('0x61')],_0xfadcee,_[_0x727c('0x62')](_0x727c('0x6b')));var _0x2ae75b=_0x727c('0x6c')+_[_0x727c('0x64')](_0x727c('0x57'));if(_0x112bbc[_0x2ae75b]||!_0x14d32a['custom']){_0x507ae4=path[_0x727c('0x60')](config[_0x727c('0x61')],_0xfadcee,_[_0x727c('0x62')]('default_loginLogo.svg'));}if(!fs[_0x727c('0x5f')](_0x507ae4)){throw new db[(_0x727c('0x66'))]['ValidationError'](_[_0x727c('0x64')](_0x727c('0x57'))+_0x727c('0x68'));}return _0x25218a[_0x727c('0x69')](_0x507ae4);}})[_0x727c('0x24')](handleError(_0x25218a,null));};exports[_0x727c('0x6d')]=function(_0x21d45e,_0x47d66d){return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x21d45e['params']['id']},'attributes':[_0x727c('0x6e')]})['then'](respondWithResult(_0x47d66d,null))[_0x727c('0x24')](handleError(_0x47d66d,null));};exports[_0x727c('0x6f')]=function(_0x1d60e5,_0x3b971a,_0x5125ac){if(_0x1d60e5[_0x727c('0x53')]&&_0x1d60e5['file'][_0x727c('0x55')]){_0x1d60e5[_0x727c('0x51')][_0x727c('0x5a')]=_0x1d60e5[_0x727c('0x53')]['filename'];}return db[_0x727c('0x4e')]['find']({'where':{'id':_0x1d60e5[_0x727c('0x4d')]['id']}})[_0x727c('0x30')](handleEntityNotFound(_0x3b971a,null))[_0x727c('0x30')](saveUpdates(_0x1d60e5[_0x727c('0x51')],null))['then'](respondWithResult(_0x3b971a,null))['catch'](handleError(_0x3b971a,null));};var utilLicense=require(_0x727c('0x17'));exports['getPreferred']=function(_0x136855,_0x21eea3,_0x506c65){var _0x5c6782=_0x727c('0x58');var _0x3fdb6b={'custom':![]};return utilLicense[_0x727c('0x59')]()[_0x727c('0x30')](function(_0x9c5265){if(_0x9c5265){_0x3fdb6b=_0x9c5265;}return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x136855['params']['id']},'attributes':[_0x727c('0x54'),_0x727c('0x57'),'preferred',_0x727c('0x5b'),_0x727c('0x5c'),'defaultLoginLogo','defaultPreferred',_0x727c('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x21eea3,null))[_0x727c('0x30')](function(_0x44fb47){if(_0x44fb47){var _0x41d571=_0x44fb47[_0x727c('0x5a')]&&fs['existsSync'](path[_0x727c('0x60')](config[_0x727c('0x61')],_0x5c6782,_[_0x727c('0x62')](_0x44fb47[_0x727c('0x5a')])))?path[_0x727c('0x60')](config['root'],_0x5c6782,_[_0x727c('0x62')](_0x44fb47[_0x727c('0x5a')])):path[_0x727c('0x60')](config[_0x727c('0x61')],_0x5c6782,_[_0x727c('0x62')](_0x727c('0x70')));var _0x15ca91=_0x727c('0x6c')+_[_0x727c('0x64')]('preferred');if(_0x44fb47[_0x15ca91]||!_0x3fdb6b['custom']||!_0x3fdb6b[_0x727c('0x5a')]){_0x41d571=path['join'](config[_0x727c('0x61')],_0x5c6782,_['toLower'](_0x727c('0x70')));}if(!fs[_0x727c('0x5f')](_0x41d571)){throw new db[(_0x727c('0x66'))][(_0x727c('0x67'))](_['upperFirst'](_0x727c('0x5a'))+_0x727c('0x68'));}return _0x21eea3[_0x727c('0x69')](_0x41d571);}})['catch'](handleError(_0x21eea3,null));};exports[_0x727c('0x71')]=function(_0x582fa7,_0x5183c4,_0x5ddcba){if(_0x582fa7[_0x727c('0x53')]&&_0x582fa7[_0x727c('0x53')][_0x727c('0x55')]){_0x582fa7[_0x727c('0x51')]['favicon']=_0x582fa7[_0x727c('0x53')][_0x727c('0x55')];}return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x582fa7['params']['id']}})[_0x727c('0x30')](handleEntityNotFound(_0x5183c4,null))[_0x727c('0x30')](saveUpdates(_0x582fa7[_0x727c('0x51')],null))['then'](respondWithResult(_0x5183c4,null))[_0x727c('0x24')](handleError(_0x5183c4,null));};var utilLicense=require(_0x727c('0x17'));exports[_0x727c('0x72')]=function(_0x513873,_0x33a765,_0x5aeb9d){var _0x5c46d9=_0x727c('0x58');var _0x4dbab2={'custom':![]};return utilLicense[_0x727c('0x59')]()[_0x727c('0x30')](function(_0x4d9b0c){if(_0x4d9b0c){_0x4dbab2=_0x4d9b0c;}return db[_0x727c('0x4e')][_0x727c('0x50')]({'where':{'id':_0x513873[_0x727c('0x4d')]['id']},'attributes':[_0x727c('0x54'),'loginLogo',_0x727c('0x5a'),'favicon',_0x727c('0x5c'),'defaultLoginLogo',_0x727c('0x5d'),_0x727c('0x5e')],'raw':!![]});})['then'](handleEntityNotFound(_0x33a765,null))[_0x727c('0x30')](function(_0x55c260){if(_0x55c260){var _0x3bdc49=_0x55c260[_0x727c('0x5b')]&&fs['existsSync'](path[_0x727c('0x60')](config[_0x727c('0x61')],_0x5c46d9,_['toLower'](_0x55c260[_0x727c('0x5b')])))?path[_0x727c('0x60')](config['root'],_0x5c46d9,_['toLower'](_0x55c260[_0x727c('0x5b')])):path[_0x727c('0x60')](config[_0x727c('0x61')],_0x5c46d9,_[_0x727c('0x62')]('default_favicon.ico'));var _0x31665d=_0x727c('0x6c')+_[_0x727c('0x64')]('favicon');if(_0x55c260[_0x31665d]||!_0x4dbab2[_0x727c('0x65')]){_0x3bdc49=path['join'](config['root'],_0x5c46d9,_[_0x727c('0x62')](_0x727c('0x73')));}if(!fs[_0x727c('0x5f')](_0x3bdc49)){throw new db['Sequelize'][(_0x727c('0x67'))](_[_0x727c('0x64')]('favicon')+_0x727c('0x68'));}return _0x33a765[_0x727c('0x69')](_0x3bdc49);}})['catch'](handleError(_0x33a765,null));};exports[_0x727c('0x74')]=function(_0x67395a,_0x13e284){var _0x23dbcf={'offset':moment()[_0x727c('0x75')]()};_0x23dbcf[_0x727c('0x76')]=moment()['utcOffset'](_0x23dbcf[_0x727c('0x2b')])[_0x727c('0x77')](_0x727c('0x78'));return _0x13e284['status'](0xc8)[_0x727c('0x34')](_0x23dbcf);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index a38ddc6..48c566a 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 _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0x008c,0x188));var _0xc008=function(_0x3adc9f,_0x5d49d5){_0x3adc9f=_0x3adc9f-0x0;var _0x432a40=_0x008c[_0x3adc9f];return _0x432a40;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','settings','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports'];(function(_0x2534cf,_0x545be6){var _0x221461=function(_0x379e83){while(--_0x379e83){_0x2534cf['push'](_0x2534cf['shift']());}};_0x221461(++_0x545be6);}(_0x008c,0x188));var _0xc008=function(_0x4ac24c,_0x2791b9){_0x4ac24c=_0x4ac24c-0x0;var _0x3961b0=_0x008c[_0x4ac24c];return _0x3961b0;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('Setting',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 971a325..17921e8 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 _0x3fe5=['util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','then'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3fe5,0x193));var _0x53fe=function(_0x44f2b6,_0x55ae93){_0x44f2b6=_0x44f2b6-0x0;var _0x436887=_0x3fe5[_0x44f2b6];return _0x436887;};'use strict';var _=require('lodash');var util=require(_0x53fe('0x0'));var moment=require(_0x53fe('0x1'));var BPromise=require(_0x53fe('0x2'));var rs=require(_0x53fe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x53fe('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x53fe('0x5'));var config=require(_0x53fe('0x6'));var jayson=require(_0x53fe('0x7'));var client=jayson[_0x53fe('0x8')][_0x53fe('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30dd77,_0x2bb423,_0x2a112f){return new BPromise(function(_0x1391c1,_0x4d6e2c){return client['request'](_0x30dd77,_0x2a112f)['then'](function(_0x44ff56){logger[_0x53fe('0xa')](_0x53fe('0xb'),_0x2bb423,_0x53fe('0xc'));logger[_0x53fe('0xd')]('Setting,\x20%s,\x20%s,\x20%s',_0x2bb423,'request\x20sent',JSON[_0x53fe('0xe')](_0x44ff56));if(_0x44ff56[_0x53fe('0xf')]){if(_0x44ff56[_0x53fe('0xf')][_0x53fe('0x10')]===0x1f4){logger['error'](_0x53fe('0xb'),_0x2bb423,_0x44ff56[_0x53fe('0xf')][_0x53fe('0x11')]);return _0x4d6e2c(_0x44ff56['error'][_0x53fe('0x11')]);}logger['error']('Setting,\x20%s,\x20%s',_0x2bb423,_0x44ff56[_0x53fe('0xf')][_0x53fe('0x11')]);return _0x1391c1(_0x44ff56[_0x53fe('0xf')]['message']);}else{logger['info'](_0x53fe('0xb'),_0x2bb423,_0x53fe('0xc'));_0x1391c1(_0x44ff56[_0x53fe('0x12')][_0x53fe('0x11')]);}})[_0x53fe('0x13')](function(_0x5010f0){logger[_0x53fe('0xf')](_0x53fe('0xb'),_0x2bb423,_0x5010f0);_0x4d6e2c(_0x5010f0);});});}exports[_0x53fe('0x14')]=function(_0xa96622){var _0x47008e=this;return new Promise(function(_0x5cf3eb,_0x1e4641){return db[_0x53fe('0x15')][_0x53fe('0x16')]({'raw':_0xa96622[_0x53fe('0x17')]?_0xa96622[_0x53fe('0x17')][_0x53fe('0x18')]===undefined?!![]:![]:!![],'where':_0xa96622[_0x53fe('0x17')]?_0xa96622[_0x53fe('0x17')][_0x53fe('0x19')]||null:null,'attributes':_0xa96622['options']?_0xa96622[_0x53fe('0x17')][_0x53fe('0x1a')]||null:null,'include':_0xa96622['options']?_0xa96622[_0x53fe('0x17')][_0x53fe('0x1b')]?_[_0x53fe('0x1c')](_0xa96622[_0x53fe('0x17')][_0x53fe('0x1b')],function(_0x164e85){return{'model':db[_0x164e85[_0x53fe('0x1d')]],'as':_0x164e85['as'],'attributes':_0x164e85[_0x53fe('0x1a')],'include':_0x164e85['include']?_[_0x53fe('0x1c')](_0x164e85[_0x53fe('0x1b')],function(_0xa3a045){return{'model':db[_0xa3a045[_0x53fe('0x1d')]],'as':_0xa3a045['as'],'attributes':_0xa3a045[_0x53fe('0x1a')],'include':_0xa3a045[_0x53fe('0x1b')]?_[_0x53fe('0x1c')](_0xa3a045[_0x53fe('0x1b')],function(_0x37363b){return{'model':db[_0x37363b[_0x53fe('0x1d')]],'as':_0x37363b['as'],'attributes':_0x37363b[_0x53fe('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x53fe('0x1e')](function(_0x51fc99){logger[_0x53fe('0xa')](_0x53fe('0x14'),_0xa96622);logger[_0x53fe('0xd')](_0x53fe('0x14'),_0xa96622,JSON[_0x53fe('0xe')](_0x51fc99));_0x5cf3eb(_0x51fc99);})['catch'](function(_0x2375bb){logger[_0x53fe('0xf')](_0x53fe('0x14'),_0x2375bb[_0x53fe('0x11')],_0xa96622);_0x1e4641(_0x47008e[_0x53fe('0xf')](0x1f4,_0x2375bb[_0x53fe('0x11')]));});});}; \ No newline at end of file +var _0x01ca=['error','message','result','catch','find','options','where','include','map','model','attributes','ShowSetting','stringify','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s'];(function(_0x1e1af2,_0x594e9e){var _0x5daca3=function(_0x2affff){while(--_0x2affff){_0x1e1af2['push'](_0x1e1af2['shift']());}};_0x5daca3(++_0x594e9e);}(_0x01ca,0xb5));var _0xa01c=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x01ca[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xa01c('0x0'));var util=require(_0xa01c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa01c('0x2'));var db=require(_0xa01c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa01c('0x4'))(_0xa01c('0x5'));var config=require('../../config/environment');var jayson=require(_0xa01c('0x6'));var client=jayson[_0xa01c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ea5cd,_0x553f64,_0x22dbc3){return new BPromise(function(_0x49e8f9,_0x5c56c7){return client[_0xa01c('0x8')](_0x4ea5cd,_0x22dbc3)[_0xa01c('0x9')](function(_0x2c70d8){logger[_0xa01c('0xa')](_0xa01c('0xb'),_0x553f64,_0xa01c('0xc'));logger[_0xa01c('0xd')](_0xa01c('0xe'),_0x553f64,_0xa01c('0xc'),JSON['stringify'](_0x2c70d8));if(_0x2c70d8[_0xa01c('0xf')]){if(_0x2c70d8[_0xa01c('0xf')]['code']===0x1f4){logger[_0xa01c('0xf')](_0xa01c('0xb'),_0x553f64,_0x2c70d8[_0xa01c('0xf')][_0xa01c('0x10')]);return _0x5c56c7(_0x2c70d8[_0xa01c('0xf')][_0xa01c('0x10')]);}logger[_0xa01c('0xf')](_0xa01c('0xb'),_0x553f64,_0x2c70d8[_0xa01c('0xf')][_0xa01c('0x10')]);return _0x49e8f9(_0x2c70d8[_0xa01c('0xf')][_0xa01c('0x10')]);}else{logger[_0xa01c('0xa')](_0xa01c('0xb'),_0x553f64,_0xa01c('0xc'));_0x49e8f9(_0x2c70d8[_0xa01c('0x11')][_0xa01c('0x10')]);}})[_0xa01c('0x12')](function(_0x3d7a90){logger['error']('Setting,\x20%s,\x20%s',_0x553f64,_0x3d7a90);_0x5c56c7(_0x3d7a90);});});}exports['ShowSetting']=function(_0x11f9b9){var _0x352504=this;return new Promise(function(_0x116d25,_0x251f5b){return db['Setting'][_0xa01c('0x13')]({'raw':_0x11f9b9['options']?_0x11f9b9[_0xa01c('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x11f9b9['options']?_0x11f9b9[_0xa01c('0x14')][_0xa01c('0x15')]||null:null,'attributes':_0x11f9b9[_0xa01c('0x14')]?_0x11f9b9[_0xa01c('0x14')]['attributes']||null:null,'include':_0x11f9b9[_0xa01c('0x14')]?_0x11f9b9[_0xa01c('0x14')][_0xa01c('0x16')]?_[_0xa01c('0x17')](_0x11f9b9[_0xa01c('0x14')][_0xa01c('0x16')],function(_0x18a615){return{'model':db[_0x18a615[_0xa01c('0x18')]],'as':_0x18a615['as'],'attributes':_0x18a615[_0xa01c('0x19')],'include':_0x18a615[_0xa01c('0x16')]?_[_0xa01c('0x17')](_0x18a615[_0xa01c('0x16')],function(_0x452a91){return{'model':db[_0x452a91['model']],'as':_0x452a91['as'],'attributes':_0x452a91[_0xa01c('0x19')],'include':_0x452a91[_0xa01c('0x16')]?_['map'](_0x452a91[_0xa01c('0x16')],function(_0x1ee415){return{'model':db[_0x1ee415[_0xa01c('0x18')]],'as':_0x1ee415['as'],'attributes':_0x1ee415[_0xa01c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54e011){logger[_0xa01c('0xa')](_0xa01c('0x1a'),_0x11f9b9);logger['debug'](_0xa01c('0x1a'),_0x11f9b9,JSON[_0xa01c('0x1b')](_0x54e011));_0x116d25(_0x54e011);})['catch'](function(_0x1b104a){logger[_0xa01c('0xf')](_0xa01c('0x1a'),_0x1b104a[_0xa01c('0x10')],_0x11f9b9);_0x251f5b(_0x352504['error'](0x1f4,_0x1b104a[_0xa01c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 2b3c93d..3b6f04e 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(_0x2db59f,_0x236c36){var _0x8e74b8=function(_0x230da4){while(--_0x230da4){_0x2db59f['push'](_0x2db59f['shift']());}};_0x8e74b8(++_0x236c36);}(_0x326f,0xd1));var _0xf326=function(_0x340adf,_0x1f7497){_0x340adf=_0x340adf-0x0;var _0x1246da=_0x326f[_0x340adf];return _0x1246da;};'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 _0xc4aa=['statusGet','/:id/users','getAgents','post','addDisposition','addAnswer','notify','addApplications','/:id/send','send','status','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x525150,_0x1d6e0c){var _0x380c2f=function(_0x2cdd86){while(--_0x2cdd86){_0x525150['push'](_0x525150['shift']());}};_0x380c2f(++_0x1d6e0c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'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')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['get'](_0xac4a('0x12'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x13')]);router['get'](_0xac4a('0x14'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x15')]);router[_0xac4a('0x8')](_0xac4a('0x16'),controller[_0xac4a('0x17')]);router[_0xac4a('0x8')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')]('/',auth[_0xac4a('0x9')](),controller['create']);router[_0xac4a('0x1a')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1b')]);router[_0xac4a('0x1a')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x1c')]);router['post']('/:id/notify',controller[_0xac4a('0x1d')]);router[_0xac4a('0x1a')](_0xac4a('0x12'),auth['isAuthenticated'](),controller[_0xac4a('0x1e')]);router[_0xac4a('0x1a')](_0xac4a('0x1f'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x20')]);router[_0xac4a('0x1a')](_0xac4a('0x16'),controller[_0xac4a('0x21')]);router['post'](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller['addAgents']);router[_0xac4a('0x22')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x23')]);router['delete'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x24')]);router[_0xac4a('0x25')](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x26')]);router[_0xac4a('0x25')](_0xac4a('0x10'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x27')]);router[_0xac4a('0x25')](_0xac4a('0x18'),auth[_0xac4a('0x9')](),controller[_0xac4a('0x28')]);module[_0xac4a('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index cfca43d..c6d2f2b 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 _0xb62e=['TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate','ENUM','twilio','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','BOOLEAN'];(function(_0x21b1fa,_0x501f8c){var _0x536899=function(_0x24b7b0){while(--_0x24b7b0){_0x21b1fa['push'](_0x21b1fa['shift']());}};_0x536899(++_0x501f8c);}(_0xb62e,0x12d));var _0xeb62=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb62e[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0xeb62('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0xeb62('0x1')],'unique':_0xeb62('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xeb62('0x1')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xeb62('0x3')]();}},'phone':{'type':Sequelize[_0xeb62('0x1')]},'type':{'type':Sequelize[_0xeb62('0x4')](_0xeb62('0x5'),'skebby',_0xeb62('0x6'),_0xeb62('0x7'),_0xeb62('0x8'),_0xeb62('0x9'),_0xeb62('0xa'),_0xeb62('0xb'),_0xeb62('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0xeb62('0x1')]},'authId':{'type':Sequelize[_0xeb62('0x1')]},'authToken':{'type':Sequelize[_0xeb62('0x1')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0xeb62('0x1')]},'password':{'type':Sequelize[_0xeb62('0x1')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0xeb62('0x1')]},'accountId':{'type':Sequelize[_0xeb62('0x1')]},'senderString':{'type':Sequelize[_0xeb62('0x1')]},'deliveryReport':{'type':Sequelize[_0xeb62('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0xeb62('0x1')]},'notificationTemplate':{'type':Sequelize[_0xeb62('0xe')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xeb62('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xeb62('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeb62('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeb62('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeb62('0xf')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xeb62('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xeb62('0x10')},'mandatoryDisposition':{'type':Sequelize[_0xeb62('0xd')],'defaultValue':![],'comment':_0xeb62('0x11'),'set':function(_0x5db247){if(!_0x5db247)this['setDataValue'](_0xeb62('0x12'),null);this[_0xeb62('0x13')](_0xeb62('0x14'),_0x5db247);}}}; \ No newline at end of file +var _0x4862=['generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','name','STRING'];(function(_0x1113dc,_0x188e4b){var _0x1ebf6e=function(_0x132049){while(--_0x132049){_0x1113dc['push'](_0x1113dc['shift']());}};_0x1ebf6e(++_0x188e4b);}(_0x4862,0x19a));var _0x2486=function(_0x23d2a0,_0x516174){_0x23d2a0=_0x23d2a0-0x0;var _0x409e80=_0x4862[_0x23d2a0];return _0x409e80;};'use strict';var Sequelize=require(_0x2486('0x0'));var rs=require(_0x2486('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x2486('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2486('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x2486('0x4')]();}},'phone':{'type':Sequelize[_0x2486('0x3')]},'type':{'type':Sequelize[_0x2486('0x5')](_0x2486('0x6'),_0x2486('0x7'),_0x2486('0x8'),_0x2486('0x9'),_0x2486('0xa'),_0x2486('0xb'),_0x2486('0xc'),'csc',_0x2486('0xd'),_0x2486('0xe'))},'accountSid':{'type':Sequelize[_0x2486('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x2486('0x3')]},'smsMethod':{'type':Sequelize[_0x2486('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x2486('0x3')]},'password':{'type':Sequelize[_0x2486('0x3')]},'apiKey':{'type':Sequelize[_0x2486('0x3')]},'applicationId':{'type':Sequelize[_0x2486('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x2486('0x3')]},'deliveryReport':{'type':Sequelize[_0x2486('0xf')],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x2486('0x10')],'defaultValue':function(){return _0x2486('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2486('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2486('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2486('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2486('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2486('0x12')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x2486('0x13'),'set':function(_0x1a9805){if(!_0x1a9805)this[_0x2486('0x14')](_0x2486('0x15'),null);this[_0x2486('0x14')](_0x2486('0x16'),_0x1a9805);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index a382278..00a3b8c 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 _0xa2c2=['asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','Body','messageId','MessageSid','skebby','from','text','connectel','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','AttachmentId','UserId','applications','unshift','agent','waitForTheAssignedAgent','*,*,*,*','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','addApplications','sequelize','Transaction','ISOLATION_LEVELS','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','clicksend','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','ids','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','then','info','SmsAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','end','stack','name','send','Pause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','mandatoryDispositionPause','keys','include','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','SmsAccountId','Disposition','getDispositions','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','nolimit','removeAnswers','notify','sms','Applications','account','orderBy','priority'];(function(_0x144c37,_0x5508f7){var _0x298904=function(_0x275ea8){while(--_0x275ea8){_0x144c37['push'](_0x144c37['shift']());}};_0x298904(++_0x5508f7);}(_0xa2c2,0x78));var _0x2a2c=function(_0x33f81a,_0x48a3fc){_0x33f81a=_0x33f81a-0x0;var _0xdab9e9=_0xa2c2[_0x33f81a];return _0xdab9e9;};'use strict';var emlformat=require(_0x2a2c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2a2c('0x1'));var jsonpatch=require(_0x2a2c('0x2'));var rp=require('request-promise');var moment=require(_0x2a2c('0x3'));var BPromise=require(_0x2a2c('0x4'));var Mustache=require(_0x2a2c('0x5'));var util=require('util');var path=require(_0x2a2c('0x6'));var sox=require(_0x2a2c('0x7'));var csv=require(_0x2a2c('0x8'));var ejs=require(_0x2a2c('0x9'));var fs=require('fs');var fs_extra=require(_0x2a2c('0xa'));var _=require(_0x2a2c('0xb'));var squel=require(_0x2a2c('0xc'));var crypto=require(_0x2a2c('0xd'));var jsforce=require(_0x2a2c('0xe'));var deskjs=require(_0x2a2c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2a2c('0x10'));var Papa=require(_0x2a2c('0x11'));var Redis=require(_0x2a2c('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a2c('0x13'));var logger=require('../../config/logger')(_0x2a2c('0x14'));var utils=require('../../config/utils');var config=require(_0x2a2c('0x15'));var licenseUtil=require(_0x2a2c('0x16'));var db=require(_0x2a2c('0x17'))['db'];config[_0x2a2c('0x18')]=_[_0x2a2c('0x19')](config[_0x2a2c('0x18')],{'host':_0x2a2c('0x1a'),'port':0x18eb});var socket=require(_0x2a2c('0x1b'))(new Redis(config[_0x2a2c('0x18')]));require(_0x2a2c('0x1c'))[_0x2a2c('0x1d')](socket);var jayson=require(_0x2a2c('0x1e'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x49df93,_0x1de88e,_0x2bfd0f,_0x25f252){return new BPromise(function(_0x65edd9,_0x2e9ad8){var _0x6fb800=_0x25f252||client;return _0x6fb800['request'](_0x49df93,_0x2bfd0f)[_0x2a2c('0x1f')](function(_0x2c8b84){logger[_0x2a2c('0x20')](_0x2a2c('0x21'),_0x1de88e,'request\x20sent');logger[_0x2a2c('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1de88e,_0x2a2c('0x23'),JSON[_0x2a2c('0x24')](_0x2c8b84));if(_0x2c8b84[_0x2a2c('0x25')]){if(_0x2c8b84[_0x2a2c('0x25')][_0x2a2c('0x26')]===0x1f4){logger[_0x2a2c('0x25')](_0x2a2c('0x21'),_0x1de88e,_0x2c8b84['error'][_0x2a2c('0x27')]);return _0x2e9ad8(_0x2c8b84[_0x2a2c('0x25')]['message']);}logger[_0x2a2c('0x25')]('SmsAccount,\x20%s,\x20%s',_0x1de88e,_0x2c8b84['error'][_0x2a2c('0x27')]);return _0x65edd9(_0x2c8b84[_0x2a2c('0x25')][_0x2a2c('0x27')]);}else{logger[_0x2a2c('0x20')](_0x2a2c('0x21'),_0x1de88e,'request\x20sent');_0x65edd9(_0x2c8b84['result'][_0x2a2c('0x27')]);}})[_0x2a2c('0x28')](function(_0x3e7994){logger[_0x2a2c('0x25')](_0x2a2c('0x21'),_0x1de88e,_0x3e7994);_0x2e9ad8(_0x3e7994);});});}function respondWithStatusCode(_0x4548af,_0x45c96e){_0x45c96e=_0x45c96e||0xcc;return function(_0x478f4f){if(_0x478f4f){return _0x4548af[_0x2a2c('0x29')](_0x45c96e);}return _0x4548af['status'](_0x45c96e)['end']();};}function respondWithResult(_0x258cc2,_0x47f3d1){_0x47f3d1=_0x47f3d1||0xc8;return function(_0x17e644){if(_0x17e644){return _0x258cc2[_0x2a2c('0x2a')](_0x47f3d1)[_0x2a2c('0x2b')](_0x17e644);}};}function respondWithFilteredResult(_0x45232e,_0xa412e4){return function(_0x4593a6){if(_0x4593a6){var _0x27a651=typeof _0xa412e4[_0x2a2c('0x2c')]==='undefined'&&typeof _0xa412e4[_0x2a2c('0x2d')]===_0x2a2c('0x2e');var _0x31e947=_0x4593a6['count'];var _0x10fd29=_0x27a651?0x0:_0xa412e4[_0x2a2c('0x2c')];var _0x45b256=_0x27a651?_0x4593a6[_0x2a2c('0x2f')]:_0xa412e4[_0x2a2c('0x2c')]+_0xa412e4[_0x2a2c('0x2d')];var _0x191d9e;if(_0x45b256>=_0x31e947){_0x45b256=_0x31e947;_0x191d9e=0xc8;}else{_0x191d9e=0xce;}_0x45232e[_0x2a2c('0x2a')](_0x191d9e);return _0x45232e[_0x2a2c('0x30')](_0x2a2c('0x31'),_0x10fd29+'-'+_0x45b256+'/'+_0x31e947)[_0x2a2c('0x2b')](_0x4593a6);}return null;};}function patchUpdates(_0x2f156b){return function(_0x3d3551){try{jsonpatch[_0x2a2c('0x32')](_0x3d3551,_0x2f156b,!![]);}catch(_0x2574ef){return BPromise[_0x2a2c('0x33')](_0x2574ef);}return _0x3d3551[_0x2a2c('0x34')]();};}function saveUpdates(_0x3385e7,_0x20175e){return function(_0x37de2d){if(_0x37de2d){return _0x37de2d[_0x2a2c('0x35')](_0x3385e7)['then'](function(_0x242db6){return _0x242db6;});}return null;};}function removeEntity(_0x43fa0e,_0x4cc183){return function(_0x31affa){if(_0x31affa){return _0x31affa[_0x2a2c('0x36')]()['then'](function(){var _0x44e630=_0x31affa['get']({'plain':!![]});var _0x3223c5=_0x2a2c('0x37');return db[_0x2a2c('0x38')]['destroy']({'where':{'type':_0x3223c5,'resourceId':_0x44e630['id']}})[_0x2a2c('0x1f')](function(){return _0x31affa;});})[_0x2a2c('0x1f')](function(){_0x43fa0e[_0x2a2c('0x2a')](0xcc)[_0x2a2c('0x39')]();});}};}function handleEntityNotFound(_0x54dc7f,_0x2f67b3){return function(_0x490c49){if(!_0x490c49){_0x54dc7f[_0x2a2c('0x29')](0x194);}return _0x490c49;};}function handleError(_0x1d5ad8,_0x40361c){_0x40361c=_0x40361c||0x1f4;return function(_0x4f24f0){logger[_0x2a2c('0x25')](_0x4f24f0[_0x2a2c('0x3a')]);if(_0x4f24f0[_0x2a2c('0x3b')]){delete _0x4f24f0[_0x2a2c('0x3b')];}_0x1d5ad8[_0x2a2c('0x2a')](_0x40361c)[_0x2a2c('0x3c')](_0x4f24f0);};}exports['index']=function(_0x14ce21,_0x4448f8){var _0x4999e7={'include':[{'model':db[_0x2a2c('0x3d')],'as':'mandatoryDispositionPause'}]},_0x5b9ab9={},_0x28b962={'count':0x0,'rows':[]};var _0x13e929=_[_0x2a2c('0x3e')](db[_0x2a2c('0x3f')][_0x2a2c('0x40')],function(_0x19d03e){return{'name':_0x19d03e[_0x2a2c('0x41')],'type':_0x19d03e[_0x2a2c('0x42')][_0x2a2c('0x43')]};});_0x5b9ab9[_0x2a2c('0x44')]=_[_0x2a2c('0x3e')](_0x13e929,_0x2a2c('0x3b'));_0x5b9ab9[_0x2a2c('0x45')]=_['keys'](_0x14ce21[_0x2a2c('0x45')]);_0x5b9ab9[_0x2a2c('0x46')]=_[_0x2a2c('0x47')](_0x5b9ab9[_0x2a2c('0x44')],_0x5b9ab9[_0x2a2c('0x45')]);_0x4999e7['attributes']=_[_0x2a2c('0x47')](_0x5b9ab9[_0x2a2c('0x44')],qs[_0x2a2c('0x48')](_0x14ce21['query']['fields']));_0x4999e7[_0x2a2c('0x49')]=_0x4999e7['attributes'][_0x2a2c('0x4a')]?_0x4999e7[_0x2a2c('0x49')]:_0x5b9ab9[_0x2a2c('0x44')];if(!_0x14ce21['query'][_0x2a2c('0x4b')]('nolimit')){_0x4999e7[_0x2a2c('0x2d')]=qs[_0x2a2c('0x2d')](_0x14ce21['query'][_0x2a2c('0x2d')]);_0x4999e7[_0x2a2c('0x2c')]=qs[_0x2a2c('0x2c')](_0x14ce21[_0x2a2c('0x45')][_0x2a2c('0x2c')]);}_0x4999e7[_0x2a2c('0x4c')]=qs[_0x2a2c('0x4d')](_0x14ce21[_0x2a2c('0x45')][_0x2a2c('0x4d')]);_0x4999e7[_0x2a2c('0x4e')]=qs[_0x2a2c('0x46')](_['pick'](_0x14ce21[_0x2a2c('0x45')],_0x5b9ab9['filters']),_0x13e929);if(_0x14ce21[_0x2a2c('0x45')][_0x2a2c('0x4f')]){_0x4999e7[_0x2a2c('0x4e')]=_[_0x2a2c('0x50')](_0x4999e7[_0x2a2c('0x4e')],{'$or':_[_0x2a2c('0x3e')](_0x13e929,function(_0x3cff8e){if(_0x3cff8e['type']!==_0x2a2c('0x51')){var _0x32e095={};_0x32e095[_0x3cff8e['name']]={'$like':'%'+_0x14ce21[_0x2a2c('0x45')][_0x2a2c('0x4f')]+'%'};return _0x32e095;}})});}_0x4999e7=_[_0x2a2c('0x50')]({},_0x4999e7,_0x14ce21['options']);var _0x37d475={'where':_0x4999e7[_0x2a2c('0x4e')]};return db[_0x2a2c('0x3f')][_0x2a2c('0x2f')](_0x37d475)[_0x2a2c('0x1f')](function(_0x439a01){_0x28b962['count']=_0x439a01;if(_0x14ce21[_0x2a2c('0x45')][_0x2a2c('0x52')]){_0x4999e7['include']=[{'all':!![]}];}return db[_0x2a2c('0x3f')]['findAll'](_0x4999e7);})['then'](function(_0x21176a){_0x28b962[_0x2a2c('0x53')]=_0x21176a;return _0x28b962;})[_0x2a2c('0x1f')](respondWithFilteredResult(_0x4448f8,_0x4999e7))['catch'](handleError(_0x4448f8,null));};exports[_0x2a2c('0x54')]=function(_0x192c5f,_0x61bfa){var _0x234321={'raw':![],'where':{'id':_0x192c5f[_0x2a2c('0x55')]['id']},'include':[{'model':db['Pause'],'as':_0x2a2c('0x56')}]},_0xdbf72a={};_0xdbf72a[_0x2a2c('0x44')]=_[_0x2a2c('0x57')](db[_0x2a2c('0x3f')][_0x2a2c('0x40')]);_0xdbf72a[_0x2a2c('0x45')]=_[_0x2a2c('0x57')](_0x192c5f['query']);_0xdbf72a[_0x2a2c('0x46')]=_[_0x2a2c('0x47')](_0xdbf72a[_0x2a2c('0x44')],_0xdbf72a['query']);_0x234321[_0x2a2c('0x49')]=_[_0x2a2c('0x47')](_0xdbf72a[_0x2a2c('0x44')],qs['fields'](_0x192c5f[_0x2a2c('0x45')][_0x2a2c('0x48')]));_0x234321['attributes']=_0x234321[_0x2a2c('0x49')][_0x2a2c('0x4a')]?_0x234321[_0x2a2c('0x49')]:_0xdbf72a[_0x2a2c('0x44')];if(_0x192c5f[_0x2a2c('0x45')]['includeAll']){_0x234321[_0x2a2c('0x58')]=[{'all':!![]}];}_0x234321=_['merge']({},_0x234321,_0x192c5f[_0x2a2c('0x59')]);return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')](_0x234321)[_0x2a2c('0x1f')](handleEntityNotFound(_0x61bfa,null))[_0x2a2c('0x1f')](respondWithResult(_0x61bfa,null))[_0x2a2c('0x28')](handleError(_0x61bfa,null));};exports[_0x2a2c('0x5b')]=function(_0x361c26,_0x5b4c16){return db[_0x2a2c('0x3f')]['create'](_0x361c26['body'],{})['then'](function(_0x5c5a55){var _0x2bd673=_0x361c26[_0x2a2c('0x5c')][_0x2a2c('0x5d')]({'plain':!![]});if(!_0x2bd673)throw new Error(_0x2a2c('0x5e'));if(_0x2bd673[_0x2a2c('0x5f')]===_0x2a2c('0x5c')){var _0x403379=_0x5c5a55[_0x2a2c('0x5d')]({'plain':!![]});var _0x362230=_0x2a2c('0x37');return db['UserProfileSection'][_0x2a2c('0x5a')]({'where':{'name':_0x362230,'userProfileId':_0x2bd673[_0x2a2c('0x60')]},'raw':!![]})[_0x2a2c('0x1f')](function(_0x515605){if(_0x515605&&_0x515605['autoAssociation']===0x0){return db[_0x2a2c('0x38')]['create']({'name':_0x403379['name'],'resourceId':_0x403379['id'],'type':_0x515605[_0x2a2c('0x3b')],'sectionId':_0x515605['id']},{})[_0x2a2c('0x1f')](function(){return _0x5c5a55;});}else{return _0x5c5a55;}})[_0x2a2c('0x28')](function(_0x2f4f04){logger['error'](_0x2a2c('0x61'),_0x2f4f04);throw _0x2f4f04;});}return _0x5c5a55;})[_0x2a2c('0x1f')](respondWithResult(_0x5b4c16,0xc9))[_0x2a2c('0x28')](handleError(_0x5b4c16,null));};exports['update']=function(_0x391c41,_0x5095bc){if(_0x391c41['body']['id']){delete _0x391c41['body']['id'];}return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x391c41[_0x2a2c('0x55')]['id']},'include':[{'model':db[_0x2a2c('0x3d')],'as':_0x2a2c('0x56')}]})['then'](handleEntityNotFound(_0x5095bc,null))[_0x2a2c('0x1f')](saveUpdates(_0x391c41[_0x2a2c('0x62')],null))['then'](respondWithResult(_0x5095bc,null))[_0x2a2c('0x28')](handleError(_0x5095bc,null));};exports[_0x2a2c('0x36')]=function(_0x42f5f5,_0x1bcf9e){return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x42f5f5[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x1bcf9e,null))[_0x2a2c('0x1f')](removeEntity(_0x1bcf9e,null))[_0x2a2c('0x28')](handleError(_0x1bcf9e,null));};exports[_0x2a2c('0x63')]=function(_0x45c5ad,_0xa16caf){return db[_0x2a2c('0x3f')][_0x2a2c('0x63')]()[_0x2a2c('0x1f')](respondWithResult(_0xa16caf,null))[_0x2a2c('0x28')](handleError(_0xa16caf,null));};exports[_0x2a2c('0x64')]=function(_0x2b17c0,_0x64d341,_0x5bf9d8){if(_0x2b17c0[_0x2a2c('0x62')]['id']){delete _0x2b17c0[_0x2a2c('0x62')]['id'];}return db['SmsAccount'][_0x2a2c('0x5a')]({'where':{'id':_0x2b17c0[_0x2a2c('0x55')]['id']}})['then'](handleEntityNotFound(_0x64d341,null))[_0x2a2c('0x1f')](function(_0x1fe3fe){if(_0x1fe3fe){_0x2b17c0['body'][_0x2a2c('0x65')]=_0x1fe3fe['id'];return db[_0x2a2c('0x66')]['create'](_0x2b17c0[_0x2a2c('0x62')]);}})[_0x2a2c('0x1f')](respondWithResult(_0x64d341,null))[_0x2a2c('0x28')](handleError(_0x64d341,null));};exports[_0x2a2c('0x67')]=function(_0x3710d5,_0x1cb252,_0x48f8b9){var _0x5c30eb={'raw':![],'where':{}};var _0x1a96fc={};var _0x1ff1c8={'count':0x0,'rows':[]};return db[_0x2a2c('0x3f')]['findOne']({'where':{'id':_0x3710d5[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x1cb252,null))[_0x2a2c('0x1f')](function(_0x500a03){if(_0x500a03){_0x1a96fc[_0x2a2c('0x44')]=_[_0x2a2c('0x57')](db[_0x2a2c('0x66')][_0x2a2c('0x40')]);_0x1a96fc[_0x2a2c('0x45')]=_['keys'](_0x3710d5[_0x2a2c('0x45')]);_0x1a96fc[_0x2a2c('0x46')]=_[_0x2a2c('0x47')](_0x1a96fc['model'],_0x1a96fc[_0x2a2c('0x45')]);_0x5c30eb[_0x2a2c('0x49')]=_[_0x2a2c('0x47')](_0x1a96fc[_0x2a2c('0x44')],qs[_0x2a2c('0x48')](_0x3710d5[_0x2a2c('0x45')][_0x2a2c('0x48')]));_0x5c30eb[_0x2a2c('0x49')]=_0x5c30eb[_0x2a2c('0x49')][_0x2a2c('0x4a')]?_0x5c30eb[_0x2a2c('0x49')]:_0x1a96fc[_0x2a2c('0x44')];if(!_0x3710d5[_0x2a2c('0x45')][_0x2a2c('0x4b')]('nolimit')){_0x5c30eb[_0x2a2c('0x2d')]=qs[_0x2a2c('0x2d')](_0x3710d5[_0x2a2c('0x45')][_0x2a2c('0x2d')]);_0x5c30eb[_0x2a2c('0x2c')]=qs[_0x2a2c('0x2c')](_0x3710d5[_0x2a2c('0x45')][_0x2a2c('0x2c')]);}_0x5c30eb[_0x2a2c('0x4c')]=qs[_0x2a2c('0x4d')](_0x3710d5['query'][_0x2a2c('0x4d')]);_0x5c30eb[_0x2a2c('0x4e')]=qs[_0x2a2c('0x46')](_[_0x2a2c('0x68')](_0x3710d5['query'],_0x1a96fc[_0x2a2c('0x46')]));_0x5c30eb[_0x2a2c('0x4e')][_0x2a2c('0x65')]=_0x500a03['id'];if(_0x3710d5[_0x2a2c('0x45')][_0x2a2c('0x4f')]){_0x5c30eb[_0x2a2c('0x4e')]=_[_0x2a2c('0x50')](_0x5c30eb[_0x2a2c('0x4e')],{'$or':_[_0x2a2c('0x3e')](_0x5c30eb[_0x2a2c('0x49')],function(_0x2a0fcb){var _0x5e9b86={};_0x5e9b86[_0x2a0fcb]={'$like':'%'+_0x3710d5['query']['filter']+'%'};return _0x5e9b86;})});}_0x5c30eb=_[_0x2a2c('0x50')]({},_0x5c30eb,_0x3710d5['options']);return db['Disposition'][_0x2a2c('0x2f')]({'where':_0x5c30eb[_0x2a2c('0x4e')]})[_0x2a2c('0x1f')](function(_0xeb82fc){_0x1ff1c8[_0x2a2c('0x2f')]=_0xeb82fc;if(_0x3710d5[_0x2a2c('0x45')][_0x2a2c('0x52')]){_0x5c30eb['include']=[{'all':!![]}];}return db[_0x2a2c('0x66')]['findAll'](_0x5c30eb);})['then'](function(_0x4324ba){_0x1ff1c8[_0x2a2c('0x53')]=_0x4324ba;return _0x1ff1c8;});}})['then'](respondWithFilteredResult(_0x1cb252,_0x5c30eb))[_0x2a2c('0x28')](handleError(_0x1cb252,null));};exports[_0x2a2c('0x69')]=function(_0x4deb03,_0x2e3086,_0x5b02f8){return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x4deb03[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x2e3086,null))[_0x2a2c('0x1f')](function(_0x575611){if(_0x575611){return _0x575611[_0x2a2c('0x69')](_0x4deb03[_0x2a2c('0x45')]['ids']);}})[_0x2a2c('0x1f')](respondWithStatusCode(_0x2e3086,null))[_0x2a2c('0x28')](handleError(_0x2e3086,null));};exports[_0x2a2c('0x6a')]=function(_0x4faa30,_0x3fa311,_0x402502){if(_0x4faa30[_0x2a2c('0x62')]['id']){delete _0x4faa30[_0x2a2c('0x62')]['id'];}return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x4faa30[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x3fa311,null))[_0x2a2c('0x1f')](function(_0x1d486c){if(_0x1d486c){_0x4faa30[_0x2a2c('0x62')][_0x2a2c('0x65')]=_0x1d486c['id'];return db[_0x2a2c('0x6b')][_0x2a2c('0x5b')](_0x4faa30[_0x2a2c('0x62')]);}})[_0x2a2c('0x1f')](respondWithResult(_0x3fa311,null))[_0x2a2c('0x28')](handleError(_0x3fa311,null));};exports[_0x2a2c('0x6c')]=function(_0x183c06,_0x2644d2,_0x9de46d){var _0x1bc944={'raw':![],'where':{}};var _0x3f2e97={};var _0x48cd17={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2a2c('0x6d')]({'where':{'id':_0x183c06['params']['id']}})['then'](handleEntityNotFound(_0x2644d2,null))[_0x2a2c('0x1f')](function(_0x218cc4){if(_0x218cc4){_0x3f2e97['model']=_[_0x2a2c('0x57')](db[_0x2a2c('0x6b')]['rawAttributes']);_0x3f2e97[_0x2a2c('0x45')]=_[_0x2a2c('0x57')](_0x183c06[_0x2a2c('0x45')]);_0x3f2e97['filters']=_[_0x2a2c('0x47')](_0x3f2e97['model'],_0x3f2e97[_0x2a2c('0x45')]);_0x1bc944[_0x2a2c('0x49')]=_[_0x2a2c('0x47')](_0x3f2e97[_0x2a2c('0x44')],qs[_0x2a2c('0x48')](_0x183c06[_0x2a2c('0x45')]['fields']));_0x1bc944[_0x2a2c('0x49')]=_0x1bc944[_0x2a2c('0x49')][_0x2a2c('0x4a')]?_0x1bc944['attributes']:_0x3f2e97[_0x2a2c('0x44')];if(!_0x183c06[_0x2a2c('0x45')][_0x2a2c('0x4b')](_0x2a2c('0x6e'))){_0x1bc944['limit']=qs[_0x2a2c('0x2d')](_0x183c06[_0x2a2c('0x45')][_0x2a2c('0x2d')]);_0x1bc944[_0x2a2c('0x2c')]=qs[_0x2a2c('0x2c')](_0x183c06[_0x2a2c('0x45')][_0x2a2c('0x2c')]);}_0x1bc944[_0x2a2c('0x4c')]=qs[_0x2a2c('0x4d')](_0x183c06[_0x2a2c('0x45')][_0x2a2c('0x4d')]);_0x1bc944[_0x2a2c('0x4e')]=qs[_0x2a2c('0x46')](_[_0x2a2c('0x68')](_0x183c06['query'],_0x3f2e97['filters']));_0x1bc944[_0x2a2c('0x4e')][_0x2a2c('0x65')]=_0x218cc4['id'];if(_0x183c06[_0x2a2c('0x45')][_0x2a2c('0x4f')]){_0x1bc944['where']=_[_0x2a2c('0x50')](_0x1bc944[_0x2a2c('0x4e')],{'$or':_[_0x2a2c('0x3e')](_0x1bc944['attributes'],function(_0xb9279d){var _0x379273={};_0x379273[_0xb9279d]={'$like':'%'+_0x183c06[_0x2a2c('0x45')][_0x2a2c('0x4f')]+'%'};return _0x379273;})});}_0x1bc944=_[_0x2a2c('0x50')]({},_0x1bc944,_0x183c06[_0x2a2c('0x59')]);return db[_0x2a2c('0x6b')][_0x2a2c('0x2f')]({'where':_0x1bc944[_0x2a2c('0x4e')]})[_0x2a2c('0x1f')](function(_0x16c599){_0x48cd17[_0x2a2c('0x2f')]=_0x16c599;if(_0x183c06['query']['includeAll']){_0x1bc944[_0x2a2c('0x58')]=[{'all':!![]}];}return db[_0x2a2c('0x6b')]['findAll'](_0x1bc944);})[_0x2a2c('0x1f')](function(_0x863a25){_0x48cd17[_0x2a2c('0x53')]=_0x863a25;return _0x48cd17;});}})[_0x2a2c('0x1f')](respondWithFilteredResult(_0x2644d2,_0x1bc944))[_0x2a2c('0x28')](handleError(_0x2644d2,null));};exports['removeAnswers']=function(_0x2c260b,_0x220740,_0x534430){return db['SmsAccount']['find']({'where':{'id':_0x2c260b['params']['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x220740,null))[_0x2a2c('0x1f')](function(_0x309651){if(_0x309651){return _0x309651[_0x2a2c('0x6f')](_0x2c260b[_0x2a2c('0x45')]['ids']);}})[_0x2a2c('0x1f')](respondWithStatusCode(_0x220740,null))[_0x2a2c('0x28')](handleError(_0x220740,null));};exports[_0x2a2c('0x70')]=function(_0x23c09f,_0x46c0c0,_0x135aaa){var _0x3b1cff={'channel':_0x2a2c('0x71')};var _0x59939c=[];var _0x1954ae=[];var _0x1e83f5={};return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x23c09f['params']['id']},'include':[{'model':db['SmsApplication'],'as':_0x2a2c('0x72')}]})['then'](handleEntityNotFound(_0x46c0c0,null))[_0x2a2c('0x1f')](function(_0x270bdd){_0x3b1cff[_0x2a2c('0x73')]=_0x270bdd;_0x3b1cff['applications']=_[_0x2a2c('0x74')](_0x270bdd[_0x2a2c('0x72')],[_0x2a2c('0x75')],[_0x2a2c('0x76')]);if(_0x3b1cff[_0x2a2c('0x73')][_0x2a2c('0x72')]){delete _0x3b1cff[_0x2a2c('0x73')][_0x2a2c('0x72')];}return db['CmContact'][_0x2a2c('0x63')]();})[_0x2a2c('0x1f')](function(_0x41741d){if(!_0x41741d){throw new db[(_0x2a2c('0x77'))][(_0x2a2c('0x78'))](_0x2a2c('0x79'));}_0x59939c=_[_0x2a2c('0x7a')](_[_0x2a2c('0x57')](_0x41741d),[_0x2a2c('0x7b'),_0x2a2c('0x7c')]);_0x1954ae=_[_0x2a2c('0x7a')](_[_0x2a2c('0x57')](_0x41741d),[_0x2a2c('0x7b'),_0x2a2c('0x7c'),_0x2a2c('0x7d'),_0x2a2c('0x7e')]);_0x3b1cff[_0x2a2c('0x62')]={'mapKey':_0x2a2c('0x7f')};if(_0x3b1cff[_0x2a2c('0x73')]['type']){switch(_0x3b1cff['account'][_0x2a2c('0x42')]){case'twilio':_0x3b1cff[_0x2a2c('0x62')]['from']=_0x23c09f[_0x2a2c('0x62')]['From'];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x80')];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x81')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x82')];break;case _0x2a2c('0x83'):_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')]='+'+_0x23c09f['body']['sender'];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x85')];break;case _0x2a2c('0x86'):_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x84')];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x27')];break;case'clicksend':_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')]=_0x23c09f['body'][_0x2a2c('0x84')];_0x3b1cff[_0x2a2c('0x62')]['body']=_0x23c09f[_0x2a2c('0x62')]['body'];_0x3b1cff[_0x2a2c('0x62')]['messageId']=_0x23c09f[_0x2a2c('0x62')]['message_id'];break;case'plivo':_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x87')];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f['body'][_0x2a2c('0x88')];_0x3b1cff[_0x2a2c('0x62')]['messageId']=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x89')];break;case _0x2a2c('0x8a'):_0x3b1cff['body'][_0x2a2c('0x84')]='+'+_0x23c09f[_0x2a2c('0x62')]['results'][0x0]['from'];_0x3b1cff['body'][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x8b')][0x0]['text'];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x81')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x8b')][0x0][_0x2a2c('0x81')];break;case _0x2a2c('0x8c'):_0x3b1cff[_0x2a2c('0x62')]['from']=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x8d')];_0x3b1cff['body']['body']=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x8e')][_0x2a2c('0x27')];break;case _0x2a2c('0x8f'):_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x90')];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x85')];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x81')]=_0x23c09f['body'][_0x2a2c('0x91')];break;case _0x2a2c('0x92'):_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x81')]=_0x23c09f['body'][0x0][_0x2a2c('0x27')]['id'];_0x3b1cff['body'][_0x2a2c('0x84')]=_0x23c09f[_0x2a2c('0x62')][0x0][_0x2a2c('0x27')][_0x2a2c('0x84')];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][0x0]['message']['text'];break;case _0x2a2c('0x93'):_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')]=_0x23c09f[_0x2a2c('0x62')]['from'];_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x62')]=_0x23c09f[_0x2a2c('0x62')][_0x2a2c('0x27')];_0x3b1cff['body'][_0x2a2c('0x81')]=_0x23c09f['body'][_0x2a2c('0x94')];break;}}if(_0x3b1cff[_0x2a2c('0x62')]['id']){delete _0x3b1cff[_0x2a2c('0x62')]['id'];}if(_[_0x2a2c('0x95')](_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')])){throw new db[(_0x2a2c('0x77'))][(_0x2a2c('0x78'))](_0x2a2c('0x96'));}if(_[_0x2a2c('0x95')](_0x3b1cff[_0x2a2c('0x62')]['body'])||_0x3b1cff[_0x2a2c('0x62')]['body']===''){throw new db[(_0x2a2c('0x77'))][(_0x2a2c('0x78'))](_0x2a2c('0x97'));}if(_[_0x2a2c('0x95')](_0x3b1cff[_0x2a2c('0x62')]['mapKey'])){throw new db[(_0x2a2c('0x77'))]['ValidationError'](_0x2a2c('0x98')+_0x1954ae);}if(!_[_0x2a2c('0x99')](_0x1954ae,_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x9a')])){throw new db[(_0x2a2c('0x77'))]['ValidationError'](_0x2a2c('0x9b')+_0x1954ae);}_0x1e83f5[_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x9a')]]=_0x3b1cff['body'][_0x2a2c('0x84')];return db[_0x2a2c('0x9c')]['find']({'where':{'id':_0x3b1cff['account'][_0x2a2c('0x7e')]},'include':[{'model':db[_0x2a2c('0x9d')],'as':_0x2a2c('0x9e'),'where':_0x1e83f5,'limit':0x1,'order':[[_0x2a2c('0x7c'),'DESC']]}]});})[_0x2a2c('0x1f')](handleEntityNotFound(_0x46c0c0,null))[_0x2a2c('0x1f')](function(_0x3363f0){if(_0x3363f0){_0x3b1cff[_0x2a2c('0x9f')]=_[_0x2a2c('0xa0')](_0x3363f0,[_0x2a2c('0x9e')]);if(_0x3363f0[_0x2a2c('0x9e')][_0x2a2c('0x4a')]){return _0x3363f0[_0x2a2c('0x9e')][0x0];}var _0x34773e=_[_0x2a2c('0x19')](_0x3b1cff[_0x2a2c('0x62')],{'firstName':_0x3b1cff[_0x2a2c('0x62')]['from'],'ListId':_0x3363f0['id']});_0x34773e[_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x9a')]]=_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')];return db[_0x2a2c('0x9d')][_0x2a2c('0x5b')](_0x34773e,{'fields':_0x59939c,'raw':!![]});}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x46c0c0,null))[_0x2a2c('0x1f')](function(_0x41da73){if(_0x41da73){_0x3b1cff[_0x2a2c('0xa1')]=_0x41da73;var _0x397c95={'ContactId':_0x41da73['id'],'phone':_0x3b1cff[_0x2a2c('0x62')]['from'],'SmsAccountId':_0x23c09f['params']['id']};var _0x4364d8={'ContactId':_0x41da73['id'],'SmsAccountId':_0x23c09f[_0x2a2c('0x55')]['id'],'closed':![]};return db[_0x2a2c('0xa2')]['find']({'where':_0x4364d8})['then'](function(_0x35c087){if(_0x35c087){return[_0x35c087,![]];}return db[_0x2a2c('0xa2')]['create'](_0x397c95)['then'](function(_0x5dae4d){return[_0x5dae4d,!![]];});});}})[_0x2a2c('0xa3')](function(_0x3ff0a3,_0x499701){_0x3b1cff[_0x2a2c('0xa4')]=_0x3ff0a3[_0x2a2c('0x5d')]({'plain':!![]});_0x3b1cff[_0x2a2c('0xa4')][_0x2a2c('0xa5')]=![];if(_0x499701){if(_0x3b1cff[_0x2a2c('0x73')][_0x2a2c('0xa6')]){_0x3b1cff['applications'][_0x2a2c('0xa7')]({'id':0x0,'priority':_0x3b1cff['applications'][_0x2a2c('0x4a')]+0x1,'app':_0x2a2c('0xa8'),'appdata':_0x2a2c('0xa9'),'interval':'*,*,*,*'});}_0x3b1cff['interaction'][_0x2a2c('0xa5')]=!![];}return db[_0x2a2c('0xaa')][_0x2a2c('0x5b')]({'phone':_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0x84')],'messageId':_0x3b1cff[_0x2a2c('0x62')]['messageId'],'body':_0x3b1cff['body'][_0x2a2c('0x62')],'SmsAccountId':_0x23c09f['params']['id'],'SmsInteractionId':_0x3ff0a3['id'],'direction':'in','ContactId':_0x3ff0a3[_0x2a2c('0xab')],'AttachmentId':_0x3b1cff[_0x2a2c('0x62')][_0x2a2c('0xac')]});})[_0x2a2c('0x1f')](function(_0x50f361){_0x3b1cff['message']=_0x50f361;if(_0x3b1cff[_0x2a2c('0xa4')][_0x2a2c('0xad')]){return db['User'][_0x2a2c('0x5a')]({'attributes':['id',_0x2a2c('0x3b')],'where':{'id':_0x3b1cff['interaction'][_0x2a2c('0xad')]}})[_0x2a2c('0x1f')](function(_0xc2d73d){if(_0xc2d73d){_0x3b1cff[_0x2a2c('0xae')][_0x2a2c('0xaf')]({'id':0x0,'priority':0x0,'app':_0x2a2c('0xb0'),'appdata':_0xc2d73d['name']+','+(_0x3b1cff[_0x2a2c('0x73')][_0x2a2c('0xb1')]||0xa),'interval':_0x2a2c('0xb2')});}return respondWithRpcPromise('Start',_0x2a2c('0xb3'),_0x3b1cff);});}return respondWithRpcPromise('Start',_0x2a2c('0xb3'),_0x3b1cff);})['then'](function(_0x1c7c3b){if(_0x1c7c3b){var _0x4f9658=0xc8;var _0x2c4567=_0x2a2c('0xb4');logger[_0x2a2c('0x20')](_0x2a2c('0xb5'),_0x2c4567,_0x4f9658,_0x2a2c('0xb6'));logger[_0x2a2c('0x22')](_0x2a2c('0xb7'),_0x2c4567,_0x4f9658,_0x2a2c('0xb6'),JSON[_0x2a2c('0x24')](_0x1c7c3b));if(_0x3b1cff[_0x2a2c('0x73')][_0x2a2c('0x42')]===_0x2a2c('0xb8')){return _0x46c0c0['status'](_0x4f9658)['set'](_0x2a2c('0xb9'),_0x2a2c('0xba'))[_0x2a2c('0x3c')](_0x2a2c('0xbb'));}else{return _0x46c0c0[_0x2a2c('0x2a')](_0x4f9658)['json'](_0x1c7c3b);}}})[_0x2a2c('0x28')](handleError(_0x46c0c0,null));};exports[_0x2a2c('0xbc')]=function(_0x131a5f,_0x51d34a){var _0x38a216=_0x131a5f[_0x2a2c('0x55')]['id'];var _0x20a63c=_0x131a5f[_0x2a2c('0x62')];var _0x1aebda=0xc8;var _0x3af0c5=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x2a2c('0xbd')][_0x2a2c('0xbe')][_0x2a2c('0xbf')]['READ_COMMITTED']},function(_0x1e2f63){return db[_0x2a2c('0x3f')][_0x2a2c('0x6d')]({'where':{'id':_0x38a216},'transaction':_0x1e2f63})[_0x2a2c('0x1f')](function(_0x3e626b){if(_0x3e626b){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x38a216},'transaction':_0x1e2f63})['then'](function(){var _0x52a82d=_[_0x2a2c('0x3e')](_0x20a63c,function(_0x4b371e){_0x4b371e[_0x2a2c('0x65')]=_0x38a216;return _0x4b371e;});return db[_0x2a2c('0xc0')][_0x2a2c('0xc1')](_0x52a82d,{'transaction':_0x1e2f63});});}else{_0x1aebda=0x194;_0x3af0c5=[];}});})['then'](function(){if(_0x1aebda!==0x194){return db[_0x2a2c('0xc0')][_0x2a2c('0xc2')]({'where':{'SmsAccountId':_0x38a216},'order':_0x2a2c('0x75')})['then'](function(_0x5d5b96){_0x3af0c5=_0x5d5b96;});}})[_0x2a2c('0x28')](function(_0x27e629){_0x1aebda=0x1f4;logger[_0x2a2c('0x25')](_0x27e629[_0x2a2c('0x3a')]);if(_0x27e629['name']){delete _0x27e629[_0x2a2c('0x3b')];}_0x3af0c5=_0x27e629;})[_0x2a2c('0xc3')](function(){if(_0x3af0c5===null){_0x51d34a[_0x2a2c('0x29')](_0x1aebda);}else{if(_0x1aebda===0x1f4){_0x51d34a['status'](_0x1aebda)[_0x2a2c('0x3c')](_0x3af0c5);}else{_0x51d34a[_0x2a2c('0x2a')](_0x1aebda)['json'](_0x3af0c5);}}});};exports[_0x2a2c('0xc4')]=function(_0x5a7c15,_0x9ab070,_0x49d91f){var _0x5217d2={};var _0xc84d8a={};var _0x30c363;var _0x37af5a;return db[_0x2a2c('0x3f')]['findOne']({'where':{'id':_0x5a7c15[_0x2a2c('0x55')]['id']}})['then'](handleEntityNotFound(_0x9ab070,null))[_0x2a2c('0x1f')](function(_0x137d12){if(_0x137d12){_0x30c363=_0x137d12;_0xc84d8a[_0x2a2c('0x44')]=_[_0x2a2c('0x57')](db[_0x2a2c('0xc0')][_0x2a2c('0x40')]);_0xc84d8a['query']=_['keys'](_0x5a7c15[_0x2a2c('0x45')]);_0xc84d8a[_0x2a2c('0x46')]=_[_0x2a2c('0x47')](_0xc84d8a[_0x2a2c('0x44')],_0xc84d8a[_0x2a2c('0x45')]);_0x5217d2[_0x2a2c('0x49')]=_['intersection'](_0xc84d8a[_0x2a2c('0x44')],qs[_0x2a2c('0x48')](_0x5a7c15[_0x2a2c('0x45')][_0x2a2c('0x48')]));_0x5217d2['attributes']=_0x5217d2['attributes'][_0x2a2c('0x4a')]?_0x5217d2['attributes']:_0xc84d8a['model'];_0x5217d2[_0x2a2c('0x4c')]=qs[_0x2a2c('0x4d')](_0x5a7c15[_0x2a2c('0x45')]['sort']);_0x5217d2[_0x2a2c('0x4e')]=qs['filters'](_['pick'](_0x5a7c15[_0x2a2c('0x45')],_0xc84d8a[_0x2a2c('0x46')]));if(_0x5a7c15['query'][_0x2a2c('0x4f')]){_0x5217d2[_0x2a2c('0x4e')]=_['merge'](_0x5217d2[_0x2a2c('0x4e')],{'$or':_[_0x2a2c('0x3e')](_0x5217d2['attributes'],function(_0x1fbfb1){var _0x4069e3={};_0x4069e3[_0x1fbfb1]={'$like':'%'+_0x5a7c15['query']['filter']+'%'};return _0x4069e3;})});}_0x5217d2=_[_0x2a2c('0x50')]({},_0x5217d2,_0x5a7c15['options']);return _0x30c363[_0x2a2c('0xc4')](_0x5217d2);}})[_0x2a2c('0x1f')](function(_0x2a3c33){if(_0x2a3c33){_0x37af5a=_0x2a3c33['length'];if(!_0x5a7c15['query'][_0x2a2c('0x4b')]('nolimit')){_0x5217d2[_0x2a2c('0x2d')]=qs[_0x2a2c('0x2d')](_0x5a7c15['query'][_0x2a2c('0x2d')]);_0x5217d2[_0x2a2c('0x2c')]=qs[_0x2a2c('0x2c')](_0x5a7c15[_0x2a2c('0x45')]['offset']);}return _0x30c363['getApplications'](_0x5217d2);}})[_0x2a2c('0x1f')](function(_0x66628b){if(_0x66628b){return _0x66628b?{'count':_0x37af5a,'rows':_0x66628b}:null;}})['then'](respondWithResult(_0x9ab070,null))[_0x2a2c('0x28')](handleError(_0x9ab070,null));};exports[_0x2a2c('0xc5')]=function(_0x5c3746,_0x5c4d76,_0x1bf9da){var _0x3bbb0d={'raw':![],'where':{}};var _0x47f87e={};var _0x5ad974={'count':0x0,'rows':[]};return db['SmsAccount'][_0x2a2c('0x6d')]({'where':{'id':_0x5c3746[_0x2a2c('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c4d76,null))[_0x2a2c('0x1f')](function(_0x5cc2fe){if(_0x5cc2fe){_0x47f87e[_0x2a2c('0x44')]=_[_0x2a2c('0x57')](db['SmsInteraction']['rawAttributes']);_0x47f87e['query']=_[_0x2a2c('0x57')](_0x5c3746[_0x2a2c('0x45')]);_0x47f87e[_0x2a2c('0x46')]=_[_0x2a2c('0x47')](_0x47f87e[_0x2a2c('0x44')],_0x47f87e[_0x2a2c('0x45')]);_0x3bbb0d[_0x2a2c('0x49')]=_['intersection'](_0x47f87e['model'],qs[_0x2a2c('0x48')](_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x48')]));_0x3bbb0d[_0x2a2c('0x49')]=_0x3bbb0d[_0x2a2c('0x49')]['length']?_0x3bbb0d['attributes']:_0x47f87e['model'];if(!_0x5c3746['query'][_0x2a2c('0x4b')](_0x2a2c('0x6e'))){_0x3bbb0d[_0x2a2c('0x2d')]=qs[_0x2a2c('0x2d')](_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x2d')]);_0x3bbb0d[_0x2a2c('0x2c')]=qs['offset'](_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x2c')]);}_0x3bbb0d['order']=qs[_0x2a2c('0x4d')](_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x4d')]);_0x3bbb0d[_0x2a2c('0x4e')]=qs[_0x2a2c('0x46')](_[_0x2a2c('0x68')](_0x5c3746[_0x2a2c('0x45')],_0x47f87e[_0x2a2c('0x46')]));_0x3bbb0d[_0x2a2c('0x4e')][_0x2a2c('0x65')]=_0x5cc2fe['id'];if(_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x4f')]){_0x3bbb0d['where']=_[_0x2a2c('0x50')](_0x3bbb0d[_0x2a2c('0x4e')],{'$or':_[_0x2a2c('0x3e')](_0x3bbb0d[_0x2a2c('0x49')],function(_0x1ee09f){var _0x4b4d1c={};_0x4b4d1c[_0x1ee09f]={'$like':'%'+_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x4f')]+'%'};return _0x4b4d1c;})});}_0x3bbb0d=_['merge']({},_0x3bbb0d,_0x5c3746[_0x2a2c('0x59')]);return db[_0x2a2c('0xa2')][_0x2a2c('0x2f')]({'where':_0x3bbb0d[_0x2a2c('0x4e')]})[_0x2a2c('0x1f')](function(_0x55f76b){_0x5ad974[_0x2a2c('0x2f')]=_0x55f76b;if(_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0x52')]){_0x3bbb0d['include']=[{'model':db[_0x2a2c('0x9d')],'as':_0x2a2c('0xc6'),'required':![]},{'model':db[_0x2a2c('0xc7')],'as':'Owner','attributes':[_0x2a2c('0x3b'),_0x2a2c('0xc8'),_0x2a2c('0xc9')],'required':![]},{'model':db[_0x2a2c('0xca')],'as':_0x2a2c('0xcb'),'attributes':['id','name',_0x2a2c('0xcc')],'where':_0x5c3746['query'][_0x2a2c('0xcd')]?{'id':_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0xcd')]}:undefined,'required':_0x5c3746[_0x2a2c('0x45')][_0x2a2c('0xcd')]?!![]:![]}];}return db[_0x2a2c('0xa2')]['findAll'](_0x3bbb0d);})[_0x2a2c('0x1f')](function(_0x18ff76){_0x5ad974['rows']=_0x18ff76;return _0x5ad974;});}})[_0x2a2c('0x1f')](respondWithFilteredResult(_0x5c4d76,_0x3bbb0d))[_0x2a2c('0x28')](handleError(_0x5c4d76,null));};exports[_0x2a2c('0x3c')]=function(_0x2fba22,_0x1017c6,_0x162fd2){var _0x5bf28a,_0x430760,_0x313715;if(_[_0x2a2c('0x95')](_0x2fba22['body'][_0x2a2c('0x62')])||_0x2fba22[_0x2a2c('0x62')]['body']===''){throw new db['Sequelize'][(_0x2a2c('0x78'))](_0x2a2c('0x97'));}if(_[_0x2a2c('0x95')](_0x2fba22[_0x2a2c('0x62')]['to'])){throw new db['Sequelize'][(_0x2a2c('0x78'))](_0x2a2c('0xce'));}_0x5bf28a=_0x2fba22['body']['to'];return db[_0x2a2c('0x3f')]['find']({'where':{'id':_0x2fba22[_0x2a2c('0x55')]['id']},'include':[{'model':db['CmList'],'as':_0x2a2c('0xcf'),'include':[{'model':db['CmContact'],'as':_0x2a2c('0x9e'),'where':{'mobile':_0x5bf28a},'limit':0x1,'order':[[_0x2a2c('0x7c'),_0x2a2c('0xd0')]]}]}]})[_0x2a2c('0x1f')](handleEntityNotFound(_0x1017c6,null))[_0x2a2c('0x1f')](function(_0x2f9ca4){if(_0x2f9ca4&&_0x2f9ca4[_0x2a2c('0xcf')]){_0x430760=_0x2f9ca4['get']({'plain':!![]});if(_0x430760[_0x2a2c('0xcf')]&&_0x430760['List'][_0x2a2c('0x9e')][_0x2a2c('0x4a')]){return _0x430760['List'][_0x2a2c('0x9e')][0x0];}return db[_0x2a2c('0x9d')][_0x2a2c('0x5b')](_['defaults'](_0x2fba22['body'],{'firstName':_0x5bf28a,'mobile':_0x5bf28a,'phone':_0x5bf28a,'ListId':_0x430760[_0x2a2c('0x7e')]}));}})['then'](handleEntityNotFound(_0x1017c6,null))[_0x2a2c('0x1f')](function(_0x5ef165){if(_0x5ef165){_0x313715=_0x5ef165;return db[_0x2a2c('0xa2')][_0x2a2c('0x5a')]({'where':{'ContactId':_0x313715['id'],'closed':![],'SmsAccountId':_0x430760['id']}})[_0x2a2c('0x1f')](function(_0x2954af){if(_0x2954af){return[_0x2954af,![]];}return db['SmsInteraction'][_0x2a2c('0x5b')]({'UserId':_0x2fba22[_0x2a2c('0x5c')]['id'],'ContactId':_0x313715['id'],'SmsAccountId':_0x430760['id'],'phone':_0x5bf28a,'firstMsgDirection':_0x2a2c('0xd1'),'Messages':[_['merge'](_0x2fba22[_0x2a2c('0x62')],{'read':![],'body':_0x2fba22[_0x2a2c('0x62')][_0x2a2c('0x62')],'phone':_0x5bf28a,'SmsAccountId':_0x430760['id'],'UserId':_0x2fba22[_0x2a2c('0x5c')]['id'],'ContactId':_0x313715['id']})]},{'include':[{'model':db[_0x2a2c('0xaa')],'as':_0x2a2c('0xd2')}]})[_0x2a2c('0x1f')](function(_0x5b8016){return[_0x5b8016,!![]];});});}})[_0x2a2c('0xa3')](function(_0x32b564,_0x2fc769){if(_0x2fc769){return _0x32b564;}return db['SmsMessage'][_0x2a2c('0x5b')](_[_0x2a2c('0x50')](_0x2fba22[_0x2a2c('0x62')],{'read':![],'body':_0x2fba22[_0x2a2c('0x62')][_0x2a2c('0x62')],'phone':_0x5bf28a,'SmsAccountId':_0x430760['id'],'SmsInteractionId':_0x32b564['id'],'UserId':_0x2fba22[_0x2a2c('0x5c')]['id'],'ContactId':_0x313715['id']}))[_0x2a2c('0x1f')](function(_0x34c8bd){_0x32b564[_0x2a2c('0xd3')][_0x2a2c('0xd2')]=[];_0x32b564[_0x2a2c('0xd3')]['Messages'][_0x2a2c('0xa7')](_0x34c8bd[_0x2a2c('0xd3')]);return _0x32b564;});})[_0x2a2c('0x1f')](respondWithResult(_0x1017c6,null))[_0x2a2c('0x28')](handleError(_0x1017c6,null));};exports['status']=function(_0x388400,_0xfc8b84,_0x235588){if(_0x388400['body']['id']){delete _0x388400['body']['id'];}var _0x3a8ade,_0x3cf30b,_0x3b3ee7;return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x388400[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0xfc8b84,null))[_0x2a2c('0x1f')](function(_0x5191f6){if(_0x5191f6){_0x3b3ee7=_0x5191f6;logger[_0x2a2c('0x22')](_0x2a2c('0xb5'),_0x2a2c('0x2a'),_0x2a2c('0xd4'),_0x5191f6['type'],util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));switch(_0x5191f6[_0x2a2c('0x42')]){case'skebby':if(_0x388400[_0x2a2c('0x62')][_0x2a2c('0xd6')]&&_0x388400[_0x2a2c('0x62')]['status']){_0x3cf30b=_0x388400[_0x2a2c('0x62')]['status'];return db[_0x2a2c('0xaa')][_0x2a2c('0x5a')]({'where':{'messageId':_0x388400[_0x2a2c('0x62')][_0x2a2c('0xd6')]}});}break;case'connectel':if(_0x388400['body'][_0x2a2c('0xd7')]&&_0x388400[_0x2a2c('0x62')][_0x2a2c('0xd8')]){_0x3cf30b=_0x388400['body']['statusInt'];return db[_0x2a2c('0xaa')][_0x2a2c('0x5a')]({'where':{'messageId':_0x388400[_0x2a2c('0x62')][_0x2a2c('0xd7')]}});}break;case _0x2a2c('0xd9'):if(_0x388400[_0x2a2c('0x62')]['message_id']&&_0x388400[_0x2a2c('0x62')][_0x2a2c('0xda')]){_0x3cf30b=_0x388400[_0x2a2c('0x62')]['status_code'];return db[_0x2a2c('0xaa')][_0x2a2c('0x5a')]({'where':{'messageId':_0x388400['body']['message_id']}});}break;case'infobip':var _0x1ecca6=_0x388400[_0x2a2c('0x62')][_0x2a2c('0x8b')][0x0];if(_0x1ecca6[_0x2a2c('0x81')]&&_0x1ecca6[_0x2a2c('0x2a')][_0x2a2c('0xdb')]===_0x2a2c('0xdc')){_0x3cf30b=_0x1ecca6[_0x2a2c('0x2a')][_0x2a2c('0xdb')];return db[_0x2a2c('0xaa')][_0x2a2c('0x5a')]({'where':{'messageId':_0x1ecca6[_0x2a2c('0x81')]}});}break;case _0x2a2c('0x8f'):if(_0x388400['body']['messageId']&&_0x388400[_0x2a2c('0x62')][_0x2a2c('0x2a')]){_0x3cf30b=_0x388400[_0x2a2c('0x62')][_0x2a2c('0x2a')];return db['SmsMessage'][_0x2a2c('0x5a')]({'where':{'messageId':_0x388400['body']['messageId']}});}break;case _0x2a2c('0x92'):if(_0x388400['body'][0x0][_0x2a2c('0x27')]['id']){_0x3cf30b=_0x388400['body'][0x0][_0x2a2c('0x42')];return db[_0x2a2c('0xaa')][_0x2a2c('0x5a')]({'where':{'messageId':_0x388400[_0x2a2c('0x62')][0x0][_0x2a2c('0x27')]['id']}});}break;case _0x2a2c('0x93'):if(_0x388400[_0x2a2c('0x62')][_0x2a2c('0xdd')]&&_0x388400[_0x2a2c('0x62')][_0x2a2c('0x2a')]){_0x3cf30b=_0x388400[_0x2a2c('0x62')][_0x2a2c('0x2a')];return db['SmsMessage'][_0x2a2c('0x5a')]({'where':{'messageId':_0x388400[_0x2a2c('0x62')][_0x2a2c('0xdd')]}});}break;}}})[_0x2a2c('0x1f')](handleEntityNotFound(_0xfc8b84,null))[_0x2a2c('0x1f')](function(_0x508376){if(_0x508376){_0x3a8ade=_0x508376;switch(_0x3b3ee7[_0x2a2c('0x42')]){case _0x2a2c('0x83'):if(_0x3cf30b==='DELIVERED'){return _0x3a8ade[_0x2a2c('0x35')]({'read':!![]});}else{logger[_0x2a2c('0x25')](_0x2a2c('0xb5'),_0x2a2c('0x2a'),'skebby',util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x2a2c('0x86'):if(_0x3cf30b==='1'){return _0x3a8ade['update']({'read':!![]});}else{logger['error'](_0x2a2c('0xb5'),_0x2a2c('0x2a'),_0x2a2c('0x83'),util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x2a2c('0xd9'):if(!_0x388400[_0x2a2c('0x62')][_0x2a2c('0xde')]&&_0x3cf30b>=0xc8&&_0x3cf30b<=0xce){return _0x3a8ade[_0x2a2c('0x35')]({'read':!![]});}else{logger[_0x2a2c('0x25')](_0x2a2c('0xb5'),_0x2a2c('0x2a'),'clicksend',util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x2a2c('0x8a'):var _0xe57dbc=_0x388400[_0x2a2c('0x62')][_0x2a2c('0x8b')][0x0];if(_0xe57dbc['status']['groupName']==='DELIVERED'){return _0x3a8ade['update']({'read':!![]});}else{logger[_0x2a2c('0x25')](_0x2a2c('0xb5'),_0x2a2c('0x2a'),_0x2a2c('0x8a'),util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x2a2c('0x8f'):if(_0x3cf30b==_0x2a2c('0xdf')||_0x3cf30b==_0x2a2c('0xe0')){return _0x3a8ade[_0x2a2c('0x35')]({'read':!![]});}else{logger[_0x2a2c('0x25')](_0x2a2c('0xb5'),_0x2a2c('0x2a'),_0x2a2c('0x8f'),util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x3cf30b==_0x2a2c('0xe1')){return _0x3a8ade[_0x2a2c('0x35')]({'read':!![]});}else{logger[_0x2a2c('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x2a2c('0x92'),util[_0x2a2c('0xd5')](_0x388400[_0x2a2c('0x62')],{'showHidden':![],'depth':null}));}break;case _0x2a2c('0x93'):if(_0x3cf30b===_0x2a2c('0xe2')||_0x3cf30b==='ACCEPTD'){return _0x3a8ade[_0x2a2c('0x35')]({'read':!![]});}else{logger[_0x2a2c('0x25')](_0x2a2c('0xb5'),_0x2a2c('0x2a'),_0x2a2c('0x93'),util['inspect'](_0x388400['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a8ade;}})[_0x2a2c('0x1f')](respondWithResult(_0xfc8b84,null))[_0x2a2c('0x28')](handleError(_0xfc8b84,null));};exports[_0x2a2c('0xe3')]=function(_0x49c8f3,_0x16ba81,_0x4d7230){var _0x414108,_0x5cccc3,_0x343989;return db['SmsAccount']['find']({'where':{'id':_0x49c8f3[_0x2a2c('0x55')]['id']}})['then'](handleEntityNotFound(_0x16ba81,null))['then'](function(_0x553bfb){if(_0x553bfb){_0x343989=_0x553bfb;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a2c('0x2a'),_0x2a2c('0xd4'),_0x553bfb[_0x2a2c('0x42')],util[_0x2a2c('0xd5')](_0x49c8f3['query'],{'showHidden':![],'depth':null}));switch(_0x553bfb['type']){case _0x2a2c('0x8c'):if(_0x49c8f3[_0x2a2c('0x45')][_0x2a2c('0xe4')]&&_0x49c8f3['query'][_0x2a2c('0xe5')]){_0x5cccc3=_0x49c8f3[_0x2a2c('0x45')][_0x2a2c('0xe5')];return db['SmsMessage']['find']({'where':{'messageId':_0x49c8f3[_0x2a2c('0x45')]['message-id']}});}break;}}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x16ba81,null))[_0x2a2c('0x1f')](function(_0x426128){if(_0x426128){_0x414108=_0x426128;switch(_0x343989[_0x2a2c('0x42')]){case'csc':if(_0x5cccc3==='2'||_0x5cccc3==='6'){return _0x414108[_0x2a2c('0x35')]({'read':!![]});}else{logger['error'](_0x2a2c('0xb5'),_0x2a2c('0x2a'),_0x2a2c('0x8c'),util[_0x2a2c('0xd5')](_0x49c8f3[_0x2a2c('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x414108;}})[_0x2a2c('0x1f')](respondWithResult(_0x16ba81,null))[_0x2a2c('0x28')](handleError(_0x16ba81,null));};exports[_0x2a2c('0xe6')]=function(_0x935fbc,_0x2ac86c,_0x6b0061){return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x935fbc[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x2ac86c,null))[_0x2a2c('0x1f')](function(_0x144f82){if(_0x144f82){return _0x144f82[_0x2a2c('0xe6')](_0x935fbc[_0x2a2c('0x62')]['ids'],_[_0x2a2c('0xa0')](_0x935fbc[_0x2a2c('0x62')],['ids','id'])||{})[_0x2a2c('0xa3')](function(_0x50367b){for(var _0x1432bc=0x0;_0x1432bc<_0x935fbc[_0x2a2c('0x62')][_0x2a2c('0xe7')][_0x2a2c('0x4a')];_0x1432bc+=0x1){socket[_0x2a2c('0xe8')](_0x2a2c('0xe9'),{'UserId':Number(_0x935fbc[_0x2a2c('0x62')]['ids'][_0x1432bc]),'SmsAccountId':Number(_0x935fbc[_0x2a2c('0x55')]['id'])});}return _0x50367b;});}})[_0x2a2c('0x1f')](respondWithResult(_0x2ac86c,null))[_0x2a2c('0x28')](handleError(_0x2ac86c,null));};exports[_0x2a2c('0xea')]=function(_0x47ef05,_0x26c1de,_0x142216){return db[_0x2a2c('0x3f')][_0x2a2c('0x5a')]({'where':{'id':_0x47ef05[_0x2a2c('0x55')]['id']}})[_0x2a2c('0x1f')](handleEntityNotFound(_0x26c1de,null))[_0x2a2c('0x1f')](function(_0x400ae5){if(_0x400ae5){return _0x400ae5[_0x2a2c('0xea')](_0x47ef05['query'][_0x2a2c('0xe7')])[_0x2a2c('0x1f')](function(){if(_[_0x2a2c('0xeb')](_0x47ef05['query'][_0x2a2c('0xe7')])){for(var _0x3dbd43=0x0;_0x3dbd43<_0x47ef05[_0x2a2c('0x45')][_0x2a2c('0xe7')][_0x2a2c('0x4a')];_0x3dbd43+=0x1){socket[_0x2a2c('0xe8')](_0x2a2c('0xec'),{'UserId':Number(_0x47ef05[_0x2a2c('0x45')]['ids'][_0x3dbd43]),'SmsAccountId':Number(_0x47ef05[_0x2a2c('0x55')]['id'])});}}else{socket[_0x2a2c('0xe8')](_0x2a2c('0xec'),{'UserId':Number(_0x47ef05[_0x2a2c('0x45')][_0x2a2c('0xe7')]),'SmsAccountId':Number(_0x47ef05['params']['id'])});}});}})['then'](respondWithStatusCode(_0x26c1de,null))[_0x2a2c('0x28')](handleError(_0x26c1de,null));};exports[_0x2a2c('0xed')]=function(_0x4ed499,_0x32106e,_0x510618){var _0x3be89f={};var _0x19b089={};var _0x5b3f67;var _0x1f37ac;return db[_0x2a2c('0x3f')][_0x2a2c('0x6d')]({'where':{'id':_0x4ed499[_0x2a2c('0x55')]['id']}})['then'](handleEntityNotFound(_0x32106e,null))[_0x2a2c('0x1f')](function(_0x19e5fd){if(_0x19e5fd){_0x5b3f67=_0x19e5fd;_0x19b089['model']=_[_0x2a2c('0x57')](db[_0x2a2c('0xc7')][_0x2a2c('0x40')]);_0x19b089[_0x2a2c('0x45')]=_[_0x2a2c('0x57')](_0x4ed499[_0x2a2c('0x45')]);_0x19b089[_0x2a2c('0x46')]=_[_0x2a2c('0x47')](_0x19b089['model'],_0x19b089[_0x2a2c('0x45')]);_0x3be89f[_0x2a2c('0x49')]=_['intersection'](_0x19b089['model'],qs[_0x2a2c('0x48')](_0x4ed499[_0x2a2c('0x45')][_0x2a2c('0x48')]));_0x3be89f[_0x2a2c('0x49')]=_0x3be89f[_0x2a2c('0x49')]['length']?_0x3be89f[_0x2a2c('0x49')]:_0x19b089['model'];_0x3be89f['order']=qs[_0x2a2c('0x4d')](_0x4ed499[_0x2a2c('0x45')]['sort']);_0x3be89f[_0x2a2c('0x4e')]=qs[_0x2a2c('0x46')](_[_0x2a2c('0x68')](_0x4ed499['query'],_0x19b089[_0x2a2c('0x46')]));if(_0x4ed499['query'][_0x2a2c('0x4f')]){_0x3be89f[_0x2a2c('0x4e')]=_[_0x2a2c('0x50')](_0x3be89f[_0x2a2c('0x4e')],{'$or':_['map'](_0x3be89f['attributes'],function(_0x398897){var _0x4cda9e={};_0x4cda9e[_0x398897]={'$like':'%'+_0x4ed499[_0x2a2c('0x45')]['filter']+'%'};return _0x4cda9e;})});}_0x3be89f=_[_0x2a2c('0x50')]({},_0x3be89f,_0x4ed499['options']);return _0x5b3f67[_0x2a2c('0xed')](_0x3be89f);}})['then'](function(_0x2bdcf9){if(_0x2bdcf9){_0x1f37ac=_0x2bdcf9[_0x2a2c('0x4a')];if(!_0x4ed499['query'][_0x2a2c('0x4b')](_0x2a2c('0x6e'))){_0x3be89f['limit']=qs[_0x2a2c('0x2d')](_0x4ed499[_0x2a2c('0x45')][_0x2a2c('0x2d')]);_0x3be89f[_0x2a2c('0x2c')]=qs[_0x2a2c('0x2c')](_0x4ed499[_0x2a2c('0x45')][_0x2a2c('0x2c')]);}return _0x5b3f67['getAgents'](_0x3be89f);}})[_0x2a2c('0x1f')](function(_0xd3de1b){if(_0xd3de1b){return _0xd3de1b?{'count':_0x1f37ac,'rows':_0xd3de1b}:null;}})['then'](respondWithResult(_0x32106e,null))[_0x2a2c('0x28')](handleError(_0x32106e,null));}; \ No newline at end of file +var _0x22d9=['entity\x20found','stringify','twilio','Content-Type','text/xml','\x0a','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','send','getApplications','getInteractions','User','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','inspect','skebby_dispatch_id','requestid','statusInt','status_code','groupName','redif','DELIVERED','error_code','infobip','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','undefined','limit','count','offset','set','json','reject','save','update','then','destroy','get','SmsAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','map','SmsAccount','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','create','user','role','find','userProfileId','autoAssociation','body','mandatoryDispositionPause','describe','SmsAccountId','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','CmContact','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','type','from','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','Sequelize','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','SmsMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting'];(function(_0x4d2f00,_0x4e94d5){var _0x2d7b7f=function(_0x18fa08){while(--_0x18fa08){_0x4d2f00['push'](_0x4d2f00['shift']());}};_0x2d7b7f(++_0x4e94d5);}(_0x22d9,0x1ec));var _0x922d=function(_0x4bb8e6,_0x512cc6){_0x4bb8e6=_0x4bb8e6-0x0;var _0x19d134=_0x22d9[_0x4bb8e6];return _0x19d134;};'use strict';var emlformat=require(_0x922d('0x0'));var rimraf=require(_0x922d('0x1'));var zipdir=require(_0x922d('0x2'));var jsonpatch=require(_0x922d('0x3'));var rp=require(_0x922d('0x4'));var moment=require(_0x922d('0x5'));var BPromise=require(_0x922d('0x6'));var Mustache=require(_0x922d('0x7'));var util=require('util');var path=require(_0x922d('0x8'));var sox=require(_0x922d('0x9'));var csv=require(_0x922d('0xa'));var ejs=require(_0x922d('0xb'));var fs=require('fs');var fs_extra=require(_0x922d('0xc'));var _=require('lodash');var squel=require(_0x922d('0xd'));var crypto=require(_0x922d('0xe'));var jsforce=require(_0x922d('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x922d('0xa'));var querystring=require(_0x922d('0x10'));var Papa=require('papaparse');var Redis=require(_0x922d('0x11'));var authService=require(_0x922d('0x12'));var qs=require(_0x922d('0x13'));var as=require(_0x922d('0x14'));var hardwareService=require(_0x922d('0x15'));var logger=require(_0x922d('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x922d('0x17'));var db=require('../../mysqldb')['db'];config[_0x922d('0x18')]=_[_0x922d('0x19')](config[_0x922d('0x18')],{'host':_0x922d('0x1a'),'port':0x18eb});var socket=require(_0x922d('0x1b'))(new Redis(config['redis']));require(_0x922d('0x1c'))[_0x922d('0x1d')](socket);var jayson=require(_0x922d('0x1e'));var client=jayson[_0x922d('0x1f')][_0x922d('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x32a7e6,_0x287e9f,_0x33d655,_0x57c5af){return new BPromise(function(_0xe5fb73,_0x27a736){var _0x312ab7=_0x57c5af||client;return _0x312ab7[_0x922d('0x21')](_0x32a7e6,_0x33d655)['then'](function(_0x565a5e){logger[_0x922d('0x22')](_0x922d('0x23'),_0x287e9f,_0x922d('0x24'));logger[_0x922d('0x25')](_0x922d('0x26'),_0x287e9f,_0x922d('0x24'),JSON['stringify'](_0x565a5e));if(_0x565a5e[_0x922d('0x27')]){if(_0x565a5e[_0x922d('0x27')][_0x922d('0x28')]===0x1f4){logger[_0x922d('0x27')](_0x922d('0x23'),_0x287e9f,_0x565a5e['error'][_0x922d('0x29')]);return _0x27a736(_0x565a5e[_0x922d('0x27')]['message']);}logger[_0x922d('0x27')](_0x922d('0x23'),_0x287e9f,_0x565a5e[_0x922d('0x27')]['message']);return _0xe5fb73(_0x565a5e['error']['message']);}else{logger[_0x922d('0x22')](_0x922d('0x23'),_0x287e9f,_0x922d('0x24'));_0xe5fb73(_0x565a5e['result']['message']);}})[_0x922d('0x2a')](function(_0x4a51b3){logger[_0x922d('0x27')](_0x922d('0x23'),_0x287e9f,_0x4a51b3);_0x27a736(_0x4a51b3);});});}function respondWithStatusCode(_0x4bb25f,_0x2c84cc){_0x2c84cc=_0x2c84cc||0xcc;return function(_0x21d2be){if(_0x21d2be){return _0x4bb25f['sendStatus'](_0x2c84cc);}return _0x4bb25f[_0x922d('0x2b')](_0x2c84cc)[_0x922d('0x2c')]();};}function respondWithResult(_0x2860cb,_0x4e742e){_0x4e742e=_0x4e742e||0xc8;return function(_0xc9e52c){if(_0xc9e52c){return _0x2860cb[_0x922d('0x2b')](_0x4e742e)['json'](_0xc9e52c);}};}function respondWithFilteredResult(_0x26f9ec,_0x5238ae){return function(_0x16af62){if(_0x16af62){var _0x3e67a5=typeof _0x5238ae['offset']===_0x922d('0x2d')&&typeof _0x5238ae[_0x922d('0x2e')]===_0x922d('0x2d');var _0x2aee4f=_0x16af62['count'];var _0x4cb92a=_0x3e67a5?0x0:_0x5238ae['offset'];var _0x26e225=_0x3e67a5?_0x16af62[_0x922d('0x2f')]:_0x5238ae[_0x922d('0x30')]+_0x5238ae[_0x922d('0x2e')];var _0x43c40e;if(_0x26e225>=_0x2aee4f){_0x26e225=_0x2aee4f;_0x43c40e=0xc8;}else{_0x43c40e=0xce;}_0x26f9ec['status'](_0x43c40e);return _0x26f9ec[_0x922d('0x31')]('Content-Range',_0x4cb92a+'-'+_0x26e225+'/'+_0x2aee4f)[_0x922d('0x32')](_0x16af62);}return null;};}function patchUpdates(_0x11bde5){return function(_0x4e9a87){try{jsonpatch['apply'](_0x4e9a87,_0x11bde5,!![]);}catch(_0x2a7314){return BPromise[_0x922d('0x33')](_0x2a7314);}return _0x4e9a87[_0x922d('0x34')]();};}function saveUpdates(_0x54c83a,_0x4c5eaa){return function(_0x520434){if(_0x520434){return _0x520434[_0x922d('0x35')](_0x54c83a)[_0x922d('0x36')](function(_0x3799e4){return _0x3799e4;});}return null;};}function removeEntity(_0x3e68e0,_0x49e14c){return function(_0x2ec09d){if(_0x2ec09d){return _0x2ec09d[_0x922d('0x37')]()['then'](function(){var _0xb3cf20=_0x2ec09d[_0x922d('0x38')]({'plain':!![]});var _0x58192e=_0x922d('0x39');return db[_0x922d('0x3a')]['destroy']({'where':{'type':_0x58192e,'resourceId':_0xb3cf20['id']}})[_0x922d('0x36')](function(){return _0x2ec09d;});})[_0x922d('0x36')](function(){_0x3e68e0[_0x922d('0x2b')](0xcc)[_0x922d('0x2c')]();});}};}function handleEntityNotFound(_0xbc58fe,_0xc44349){return function(_0xadd7df){if(!_0xadd7df){_0xbc58fe[_0x922d('0x3b')](0x194);}return _0xadd7df;};}function handleError(_0x1d7846,_0x5aee13){_0x5aee13=_0x5aee13||0x1f4;return function(_0x8143f6){logger[_0x922d('0x27')](_0x8143f6[_0x922d('0x3c')]);if(_0x8143f6[_0x922d('0x3d')]){delete _0x8143f6[_0x922d('0x3d')];}_0x1d7846[_0x922d('0x2b')](_0x5aee13)['send'](_0x8143f6);};}exports[_0x922d('0x3e')]=function(_0x2707c1,_0x702bb1){var _0x1f9c8f={'include':[{'model':db[_0x922d('0x3f')],'as':'mandatoryDispositionPause'}]},_0x357198={},_0x294682={'count':0x0,'rows':[]};var _0xa3bd3b=_[_0x922d('0x40')](db[_0x922d('0x41')][_0x922d('0x42')],function(_0x22acf7){return{'name':_0x22acf7['fieldName'],'type':_0x22acf7['type']['key']};});_0x357198[_0x922d('0x43')]=_[_0x922d('0x40')](_0xa3bd3b,_0x922d('0x3d'));_0x357198['query']=_[_0x922d('0x44')](_0x2707c1[_0x922d('0x45')]);_0x357198[_0x922d('0x46')]=_[_0x922d('0x47')](_0x357198[_0x922d('0x43')],_0x357198[_0x922d('0x45')]);_0x1f9c8f[_0x922d('0x48')]=_[_0x922d('0x47')](_0x357198[_0x922d('0x43')],qs[_0x922d('0x49')](_0x2707c1[_0x922d('0x45')][_0x922d('0x49')]));_0x1f9c8f['attributes']=_0x1f9c8f['attributes'][_0x922d('0x4a')]?_0x1f9c8f[_0x922d('0x48')]:_0x357198[_0x922d('0x43')];if(!_0x2707c1['query'][_0x922d('0x4b')](_0x922d('0x4c'))){_0x1f9c8f[_0x922d('0x2e')]=qs[_0x922d('0x2e')](_0x2707c1[_0x922d('0x45')][_0x922d('0x2e')]);_0x1f9c8f[_0x922d('0x30')]=qs[_0x922d('0x30')](_0x2707c1[_0x922d('0x45')]['offset']);}_0x1f9c8f[_0x922d('0x4d')]=qs[_0x922d('0x4e')](_0x2707c1[_0x922d('0x45')][_0x922d('0x4e')]);_0x1f9c8f[_0x922d('0x4f')]=qs[_0x922d('0x46')](_[_0x922d('0x50')](_0x2707c1[_0x922d('0x45')],_0x357198['filters']),_0xa3bd3b);if(_0x2707c1[_0x922d('0x45')][_0x922d('0x51')]){_0x1f9c8f[_0x922d('0x4f')]=_[_0x922d('0x52')](_0x1f9c8f['where'],{'$or':_[_0x922d('0x40')](_0xa3bd3b,function(_0x53a8f7){if(_0x53a8f7['type']!==_0x922d('0x53')){var _0x2eaf90={};_0x2eaf90[_0x53a8f7[_0x922d('0x3d')]]={'$like':'%'+_0x2707c1[_0x922d('0x45')][_0x922d('0x51')]+'%'};return _0x2eaf90;}})});}_0x1f9c8f=_['merge']({},_0x1f9c8f,_0x2707c1[_0x922d('0x54')]);var _0x18fd97={'where':_0x1f9c8f[_0x922d('0x4f')]};return db[_0x922d('0x41')]['count'](_0x18fd97)[_0x922d('0x36')](function(_0x4f1367){_0x294682[_0x922d('0x2f')]=_0x4f1367;if(_0x2707c1[_0x922d('0x45')][_0x922d('0x55')]){_0x1f9c8f[_0x922d('0x56')]=[{'all':!![]}];}return db['SmsAccount'][_0x922d('0x57')](_0x1f9c8f);})[_0x922d('0x36')](function(_0x29cd18){_0x294682[_0x922d('0x58')]=_0x29cd18;return _0x294682;})[_0x922d('0x36')](respondWithFilteredResult(_0x702bb1,_0x1f9c8f))[_0x922d('0x2a')](handleError(_0x702bb1,null));};exports['show']=function(_0x4216db,_0x49189f){var _0x93eb7f={'raw':![],'where':{'id':_0x4216db[_0x922d('0x59')]['id']},'include':[{'model':db[_0x922d('0x3f')],'as':'mandatoryDispositionPause'}]},_0x17d77e={};_0x17d77e[_0x922d('0x43')]=_['keys'](db[_0x922d('0x41')][_0x922d('0x42')]);_0x17d77e[_0x922d('0x45')]=_['keys'](_0x4216db[_0x922d('0x45')]);_0x17d77e[_0x922d('0x46')]=_[_0x922d('0x47')](_0x17d77e['model'],_0x17d77e[_0x922d('0x45')]);_0x93eb7f[_0x922d('0x48')]=_['intersection'](_0x17d77e[_0x922d('0x43')],qs[_0x922d('0x49')](_0x4216db[_0x922d('0x45')]['fields']));_0x93eb7f[_0x922d('0x48')]=_0x93eb7f[_0x922d('0x48')][_0x922d('0x4a')]?_0x93eb7f[_0x922d('0x48')]:_0x17d77e[_0x922d('0x43')];if(_0x4216db[_0x922d('0x45')]['includeAll']){_0x93eb7f[_0x922d('0x56')]=[{'all':!![]}];}_0x93eb7f=_['merge']({},_0x93eb7f,_0x4216db[_0x922d('0x54')]);return db['SmsAccount']['find'](_0x93eb7f)['then'](handleEntityNotFound(_0x49189f,null))['then'](respondWithResult(_0x49189f,null))[_0x922d('0x2a')](handleError(_0x49189f,null));};exports[_0x922d('0x5a')]=function(_0x4da3b0,_0xa8ecf){return db[_0x922d('0x41')][_0x922d('0x5a')](_0x4da3b0['body'],{})[_0x922d('0x36')](function(_0x17cd5a){var _0xabe55b=_0x4da3b0[_0x922d('0x5b')][_0x922d('0x38')]({'plain':!![]});if(!_0xabe55b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xabe55b[_0x922d('0x5c')]==='user'){var _0x4added=_0x17cd5a['get']({'plain':!![]});var _0x107269=_0x922d('0x39');return db['UserProfileSection'][_0x922d('0x5d')]({'where':{'name':_0x107269,'userProfileId':_0xabe55b[_0x922d('0x5e')]},'raw':!![]})[_0x922d('0x36')](function(_0x18ddf6){if(_0x18ddf6&&_0x18ddf6[_0x922d('0x5f')]===0x0){return db[_0x922d('0x3a')][_0x922d('0x5a')]({'name':_0x4added['name'],'resourceId':_0x4added['id'],'type':_0x18ddf6[_0x922d('0x3d')],'sectionId':_0x18ddf6['id']},{})[_0x922d('0x36')](function(){return _0x17cd5a;});}else{return _0x17cd5a;}})['catch'](function(_0x1d1f9c){logger[_0x922d('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d1f9c);throw _0x1d1f9c;});}return _0x17cd5a;})[_0x922d('0x36')](respondWithResult(_0xa8ecf,0xc9))[_0x922d('0x2a')](handleError(_0xa8ecf,null));};exports[_0x922d('0x35')]=function(_0x1c6766,_0x1ea2a0){if(_0x1c6766[_0x922d('0x60')]['id']){delete _0x1c6766['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1c6766[_0x922d('0x59')]['id']},'include':[{'model':db[_0x922d('0x3f')],'as':_0x922d('0x61')}]})[_0x922d('0x36')](handleEntityNotFound(_0x1ea2a0,null))[_0x922d('0x36')](saveUpdates(_0x1c6766[_0x922d('0x60')],null))[_0x922d('0x36')](respondWithResult(_0x1ea2a0,null))[_0x922d('0x2a')](handleError(_0x1ea2a0,null));};exports['destroy']=function(_0x8e23c5,_0x2ad19a){return db['SmsAccount']['find']({'where':{'id':_0x8e23c5['params']['id']}})['then'](handleEntityNotFound(_0x2ad19a,null))[_0x922d('0x36')](removeEntity(_0x2ad19a,null))[_0x922d('0x2a')](handleError(_0x2ad19a,null));};exports[_0x922d('0x62')]=function(_0x29f345,_0x3b36e8){return db[_0x922d('0x41')][_0x922d('0x62')]()[_0x922d('0x36')](respondWithResult(_0x3b36e8,null))['catch'](handleError(_0x3b36e8,null));};exports['addDisposition']=function(_0x4bf308,_0x22833c,_0x10364e){if(_0x4bf308['body']['id']){delete _0x4bf308[_0x922d('0x60')]['id'];}return db['SmsAccount'][_0x922d('0x5d')]({'where':{'id':_0x4bf308[_0x922d('0x59')]['id']}})['then'](handleEntityNotFound(_0x22833c,null))[_0x922d('0x36')](function(_0x1b4bed){if(_0x1b4bed){_0x4bf308[_0x922d('0x60')][_0x922d('0x63')]=_0x1b4bed['id'];return db['Disposition'][_0x922d('0x5a')](_0x4bf308[_0x922d('0x60')]);}})[_0x922d('0x36')](respondWithResult(_0x22833c,null))[_0x922d('0x2a')](handleError(_0x22833c,null));};exports['getDispositions']=function(_0x5d9525,_0x2e3820,_0x40a391){var _0x25ed21={'raw':![],'where':{}};var _0x337ef5={};var _0x218b60={'count':0x0,'rows':[]};return db[_0x922d('0x41')]['findOne']({'where':{'id':_0x5d9525[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x2e3820,null))['then'](function(_0x5e4002){if(_0x5e4002){_0x337ef5[_0x922d('0x43')]=_[_0x922d('0x44')](db[_0x922d('0x64')]['rawAttributes']);_0x337ef5[_0x922d('0x45')]=_[_0x922d('0x44')](_0x5d9525[_0x922d('0x45')]);_0x337ef5[_0x922d('0x46')]=_[_0x922d('0x47')](_0x337ef5[_0x922d('0x43')],_0x337ef5[_0x922d('0x45')]);_0x25ed21[_0x922d('0x48')]=_['intersection'](_0x337ef5['model'],qs[_0x922d('0x49')](_0x5d9525[_0x922d('0x45')][_0x922d('0x49')]));_0x25ed21[_0x922d('0x48')]=_0x25ed21['attributes']['length']?_0x25ed21['attributes']:_0x337ef5[_0x922d('0x43')];if(!_0x5d9525[_0x922d('0x45')][_0x922d('0x4b')](_0x922d('0x4c'))){_0x25ed21[_0x922d('0x2e')]=qs[_0x922d('0x2e')](_0x5d9525[_0x922d('0x45')]['limit']);_0x25ed21[_0x922d('0x30')]=qs[_0x922d('0x30')](_0x5d9525['query'][_0x922d('0x30')]);}_0x25ed21[_0x922d('0x4d')]=qs[_0x922d('0x4e')](_0x5d9525['query']['sort']);_0x25ed21[_0x922d('0x4f')]=qs[_0x922d('0x46')](_['pick'](_0x5d9525['query'],_0x337ef5[_0x922d('0x46')]));_0x25ed21[_0x922d('0x4f')]['SmsAccountId']=_0x5e4002['id'];if(_0x5d9525[_0x922d('0x45')][_0x922d('0x51')]){_0x25ed21[_0x922d('0x4f')]=_[_0x922d('0x52')](_0x25ed21[_0x922d('0x4f')],{'$or':_[_0x922d('0x40')](_0x25ed21[_0x922d('0x48')],function(_0x35f802){var _0x4b2098={};_0x4b2098[_0x35f802]={'$like':'%'+_0x5d9525[_0x922d('0x45')][_0x922d('0x51')]+'%'};return _0x4b2098;})});}_0x25ed21=_[_0x922d('0x52')]({},_0x25ed21,_0x5d9525[_0x922d('0x54')]);return db['Disposition'][_0x922d('0x2f')]({'where':_0x25ed21['where']})[_0x922d('0x36')](function(_0xfd8b72){_0x218b60['count']=_0xfd8b72;if(_0x5d9525[_0x922d('0x45')][_0x922d('0x55')]){_0x25ed21['include']=[{'all':!![]}];}return db['Disposition'][_0x922d('0x57')](_0x25ed21);})[_0x922d('0x36')](function(_0x286254){_0x218b60[_0x922d('0x58')]=_0x286254;return _0x218b60;});}})['then'](respondWithFilteredResult(_0x2e3820,_0x25ed21))[_0x922d('0x2a')](handleError(_0x2e3820,null));};exports['removeDispositions']=function(_0x4dee48,_0x424ccc,_0x1c301f){return db['SmsAccount'][_0x922d('0x5d')]({'where':{'id':_0x4dee48['params']['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x424ccc,null))[_0x922d('0x36')](function(_0x1037dc){if(_0x1037dc){return _0x1037dc[_0x922d('0x65')](_0x4dee48['query'][_0x922d('0x66')]);}})['then'](respondWithStatusCode(_0x424ccc,null))[_0x922d('0x2a')](handleError(_0x424ccc,null));};exports[_0x922d('0x67')]=function(_0x393cd4,_0x3ea1a7,_0x4e723c){if(_0x393cd4[_0x922d('0x60')]['id']){delete _0x393cd4[_0x922d('0x60')]['id'];}return db[_0x922d('0x41')][_0x922d('0x5d')]({'where':{'id':_0x393cd4[_0x922d('0x59')]['id']}})['then'](handleEntityNotFound(_0x3ea1a7,null))['then'](function(_0x52d839){if(_0x52d839){_0x393cd4['body'][_0x922d('0x63')]=_0x52d839['id'];return db['CannedAnswer'][_0x922d('0x5a')](_0x393cd4[_0x922d('0x60')]);}})['then'](respondWithResult(_0x3ea1a7,null))[_0x922d('0x2a')](handleError(_0x3ea1a7,null));};exports[_0x922d('0x68')]=function(_0x72cb37,_0x2689b2,_0x37d4e3){var _0x50e16e={'raw':![],'where':{}};var _0x3c3f03={};var _0x1e0192={'count':0x0,'rows':[]};return db['SmsAccount'][_0x922d('0x69')]({'where':{'id':_0x72cb37[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x2689b2,null))['then'](function(_0x27848b){if(_0x27848b){_0x3c3f03['model']=_[_0x922d('0x44')](db['CannedAnswer'][_0x922d('0x42')]);_0x3c3f03[_0x922d('0x45')]=_['keys'](_0x72cb37[_0x922d('0x45')]);_0x3c3f03[_0x922d('0x46')]=_['intersection'](_0x3c3f03[_0x922d('0x43')],_0x3c3f03['query']);_0x50e16e[_0x922d('0x48')]=_['intersection'](_0x3c3f03[_0x922d('0x43')],qs[_0x922d('0x49')](_0x72cb37[_0x922d('0x45')][_0x922d('0x49')]));_0x50e16e[_0x922d('0x48')]=_0x50e16e['attributes']['length']?_0x50e16e['attributes']:_0x3c3f03[_0x922d('0x43')];if(!_0x72cb37['query']['hasOwnProperty'](_0x922d('0x4c'))){_0x50e16e['limit']=qs['limit'](_0x72cb37[_0x922d('0x45')][_0x922d('0x2e')]);_0x50e16e[_0x922d('0x30')]=qs['offset'](_0x72cb37[_0x922d('0x45')][_0x922d('0x30')]);}_0x50e16e[_0x922d('0x4d')]=qs[_0x922d('0x4e')](_0x72cb37[_0x922d('0x45')][_0x922d('0x4e')]);_0x50e16e[_0x922d('0x4f')]=qs['filters'](_[_0x922d('0x50')](_0x72cb37[_0x922d('0x45')],_0x3c3f03[_0x922d('0x46')]));_0x50e16e[_0x922d('0x4f')][_0x922d('0x63')]=_0x27848b['id'];if(_0x72cb37['query'][_0x922d('0x51')]){_0x50e16e[_0x922d('0x4f')]=_[_0x922d('0x52')](_0x50e16e[_0x922d('0x4f')],{'$or':_['map'](_0x50e16e[_0x922d('0x48')],function(_0x2d7601){var _0x2a87b9={};_0x2a87b9[_0x2d7601]={'$like':'%'+_0x72cb37['query']['filter']+'%'};return _0x2a87b9;})});}_0x50e16e=_[_0x922d('0x52')]({},_0x50e16e,_0x72cb37[_0x922d('0x54')]);return db[_0x922d('0x6a')][_0x922d('0x2f')]({'where':_0x50e16e[_0x922d('0x4f')]})[_0x922d('0x36')](function(_0x3e5901){_0x1e0192[_0x922d('0x2f')]=_0x3e5901;if(_0x72cb37['query'][_0x922d('0x55')]){_0x50e16e[_0x922d('0x56')]=[{'all':!![]}];}return db[_0x922d('0x6a')][_0x922d('0x57')](_0x50e16e);})[_0x922d('0x36')](function(_0x51e2cf){_0x1e0192[_0x922d('0x58')]=_0x51e2cf;return _0x1e0192;});}})[_0x922d('0x36')](respondWithFilteredResult(_0x2689b2,_0x50e16e))[_0x922d('0x2a')](handleError(_0x2689b2,null));};exports[_0x922d('0x6b')]=function(_0xa921ce,_0x2dad84,_0x3f48c2){return db['SmsAccount'][_0x922d('0x5d')]({'where':{'id':_0xa921ce[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x2dad84,null))[_0x922d('0x36')](function(_0x2bfc8d){if(_0x2bfc8d){return _0x2bfc8d[_0x922d('0x6b')](_0xa921ce[_0x922d('0x45')][_0x922d('0x66')]);}})['then'](respondWithStatusCode(_0x2dad84,null))['catch'](handleError(_0x2dad84,null));};exports[_0x922d('0x6c')]=function(_0x1cf3ad,_0x317cf6,_0x1dbee9){var _0x5cf85b={'channel':_0x922d('0x6d')};var _0x5dcb73=[];var _0x342e17=[];var _0x4e55c1={};return db[_0x922d('0x41')][_0x922d('0x5d')]({'where':{'id':_0x1cf3ad[_0x922d('0x59')]['id']},'include':[{'model':db[_0x922d('0x6e')],'as':_0x922d('0x6f')}]})[_0x922d('0x36')](handleEntityNotFound(_0x317cf6,null))[_0x922d('0x36')](function(_0x5af493){_0x5cf85b[_0x922d('0x70')]=_0x5af493;_0x5cf85b[_0x922d('0x71')]=_['orderBy'](_0x5af493[_0x922d('0x6f')],[_0x922d('0x72')],[_0x922d('0x73')]);if(_0x5cf85b[_0x922d('0x70')][_0x922d('0x6f')]){delete _0x5cf85b[_0x922d('0x70')][_0x922d('0x6f')];}return db[_0x922d('0x74')][_0x922d('0x62')]();})[_0x922d('0x36')](function(_0x247c62){if(!_0x247c62){throw new db['Sequelize'][(_0x922d('0x75'))]('no\x20available\x20attributes');}_0x5dcb73=_[_0x922d('0x76')](_[_0x922d('0x44')](_0x247c62),[_0x922d('0x77'),_0x922d('0x78')]);_0x342e17=_['difference'](_[_0x922d('0x44')](_0x247c62),[_0x922d('0x77'),_0x922d('0x78'),_0x922d('0x79'),_0x922d('0x7a')]);_0x5cf85b[_0x922d('0x60')]={'mapKey':'mobile'};if(_0x5cf85b[_0x922d('0x70')][_0x922d('0x7b')]){switch(_0x5cf85b[_0x922d('0x70')][_0x922d('0x7b')]){case'twilio':_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')]=_0x1cf3ad[_0x922d('0x60')]['From'];_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')]=_0x1cf3ad[_0x922d('0x60')]['Body'];_0x5cf85b[_0x922d('0x60')][_0x922d('0x7d')]=_0x1cf3ad['body'][_0x922d('0x7e')];break;case _0x922d('0x7f'):_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')]='+'+_0x1cf3ad[_0x922d('0x60')][_0x922d('0x80')];_0x5cf85b['body'][_0x922d('0x60')]=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x81')];break;case'connectel':_0x5cf85b[_0x922d('0x60')]['from']=_0x1cf3ad['body'][_0x922d('0x7c')];_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')]=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x29')];break;case _0x922d('0x82'):_0x5cf85b[_0x922d('0x60')]['from']=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x7c')];_0x5cf85b[_0x922d('0x60')]['body']=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x60')];_0x5cf85b['body'][_0x922d('0x7d')]=_0x1cf3ad['body'][_0x922d('0x83')];break;case _0x922d('0x84'):_0x5cf85b['body']['from']=_0x1cf3ad['body']['From'];_0x5cf85b['body'][_0x922d('0x60')]=_0x1cf3ad['body'][_0x922d('0x85')];_0x5cf85b[_0x922d('0x60')]['messageId']=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x86')];break;case'infobip':_0x5cf85b[_0x922d('0x60')]['from']='+'+_0x1cf3ad['body'][_0x922d('0x87')][0x0][_0x922d('0x7c')];_0x5cf85b[_0x922d('0x60')]['body']=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x87')][0x0][_0x922d('0x81')];_0x5cf85b[_0x922d('0x60')][_0x922d('0x7d')]=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x87')][0x0][_0x922d('0x7d')];break;case _0x922d('0x88'):_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')]=_0x1cf3ad['body'][_0x922d('0x89')];_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')]=_0x1cf3ad[_0x922d('0x60')]['segmentedMessage']['message'];break;case _0x922d('0x8a'):_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')]=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x8b')];_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')]=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x81')];_0x5cf85b[_0x922d('0x60')][_0x922d('0x7d')]=_0x1cf3ad['body'][_0x922d('0x8c')];break;case _0x922d('0x8d'):_0x5cf85b['body']['messageId']=_0x1cf3ad[_0x922d('0x60')][0x0][_0x922d('0x29')]['id'];_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')]=_0x1cf3ad['body'][0x0]['message']['from'];_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')]=_0x1cf3ad[_0x922d('0x60')][0x0][_0x922d('0x29')][_0x922d('0x81')];break;case _0x922d('0x8e'):_0x5cf85b[_0x922d('0x60')]['from']=_0x1cf3ad[_0x922d('0x60')]['from'];_0x5cf85b[_0x922d('0x60')]['body']=_0x1cf3ad[_0x922d('0x60')]['message'];_0x5cf85b[_0x922d('0x60')][_0x922d('0x7d')]=_0x1cf3ad[_0x922d('0x60')][_0x922d('0x8f')];break;}}if(_0x5cf85b[_0x922d('0x60')]['id']){delete _0x5cf85b[_0x922d('0x60')]['id'];}if(_['isNil'](_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')])){throw new db[(_0x922d('0x90'))][(_0x922d('0x75'))](_0x922d('0x91'));}if(_[_0x922d('0x92')](_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')])||_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')]===''){throw new db[(_0x922d('0x90'))][(_0x922d('0x75'))](_0x922d('0x93'));}if(_['isNil'](_0x5cf85b[_0x922d('0x60')][_0x922d('0x94')])){throw new db[(_0x922d('0x90'))]['ValidationError'](_0x922d('0x95')+_0x342e17);}if(!_['includes'](_0x342e17,_0x5cf85b['body'][_0x922d('0x94')])){throw new db[(_0x922d('0x90'))][(_0x922d('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x342e17);}_0x4e55c1[_0x5cf85b['body']['mapKey']]=_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')];return db['CmList']['find']({'where':{'id':_0x5cf85b[_0x922d('0x70')]['ListId']},'include':[{'model':db[_0x922d('0x74')],'as':_0x922d('0x96'),'where':_0x4e55c1,'limit':0x1,'order':[[_0x922d('0x78'),_0x922d('0x97')]]}]});})['then'](handleEntityNotFound(_0x317cf6,null))[_0x922d('0x36')](function(_0x5696c3){if(_0x5696c3){_0x5cf85b[_0x922d('0x98')]=_[_0x922d('0x99')](_0x5696c3,[_0x922d('0x96')]);if(_0x5696c3[_0x922d('0x96')][_0x922d('0x4a')]){return _0x5696c3[_0x922d('0x96')][0x0];}var _0x45ac5e=_['defaults'](_0x5cf85b['body'],{'firstName':_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')],'ListId':_0x5696c3['id']});_0x45ac5e[_0x5cf85b[_0x922d('0x60')][_0x922d('0x94')]]=_0x5cf85b['body'][_0x922d('0x7c')];return db[_0x922d('0x74')][_0x922d('0x5a')](_0x45ac5e,{'fields':_0x5dcb73,'raw':!![]});}})[_0x922d('0x36')](handleEntityNotFound(_0x317cf6,null))[_0x922d('0x36')](function(_0x3a770b){if(_0x3a770b){_0x5cf85b[_0x922d('0x9a')]=_0x3a770b;var _0x26e0fa={'ContactId':_0x3a770b['id'],'phone':_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')],'SmsAccountId':_0x1cf3ad[_0x922d('0x59')]['id']};var _0x529006={'ContactId':_0x3a770b['id'],'SmsAccountId':_0x1cf3ad[_0x922d('0x59')]['id'],'closed':![]};return db[_0x922d('0x9b')][_0x922d('0x5d')]({'where':_0x529006})[_0x922d('0x36')](function(_0x2af0fe){if(_0x2af0fe){return[_0x2af0fe,![]];}return db[_0x922d('0x9b')]['create'](_0x26e0fa)[_0x922d('0x36')](function(_0x9f80b5){return[_0x9f80b5,!![]];});});}})[_0x922d('0x9c')](function(_0x44d0c1,_0x94dd7d){_0x5cf85b[_0x922d('0x9d')]=_0x44d0c1[_0x922d('0x38')]({'plain':!![]});_0x5cf85b['interaction']['created']=![];if(_0x94dd7d){if(_0x5cf85b[_0x922d('0x70')][_0x922d('0x9e')]){_0x5cf85b[_0x922d('0x71')][_0x922d('0x9f')]({'id':0x0,'priority':_0x5cf85b[_0x922d('0x71')][_0x922d('0x4a')]+0x1,'app':_0x922d('0xa0'),'appdata':'unmanaged','interval':_0x922d('0xa1')});}_0x5cf85b[_0x922d('0x9d')][_0x922d('0xa2')]=!![];}return db[_0x922d('0xa3')][_0x922d('0x5a')]({'phone':_0x5cf85b[_0x922d('0x60')][_0x922d('0x7c')],'messageId':_0x5cf85b[_0x922d('0x60')][_0x922d('0x7d')],'body':_0x5cf85b[_0x922d('0x60')][_0x922d('0x60')],'SmsAccountId':_0x1cf3ad[_0x922d('0x59')]['id'],'SmsInteractionId':_0x44d0c1['id'],'direction':'in','ContactId':_0x44d0c1['ContactId'],'AttachmentId':_0x5cf85b[_0x922d('0x60')][_0x922d('0xa4')]});})[_0x922d('0x36')](function(_0x5aaa57){_0x5cf85b[_0x922d('0x29')]=_0x5aaa57;if(_0x5cf85b[_0x922d('0x9d')]['UserId']){return db['User'][_0x922d('0x5d')]({'attributes':['id',_0x922d('0x3d')],'where':{'id':_0x5cf85b[_0x922d('0x9d')][_0x922d('0xa5')]}})['then'](function(_0x178b97){if(_0x178b97){_0x5cf85b['applications'][_0x922d('0xa6')]({'id':0x0,'priority':0x0,'app':_0x922d('0xa7'),'appdata':_0x178b97[_0x922d('0x3d')]+','+(_0x5cf85b[_0x922d('0x70')][_0x922d('0xa8')]||0xa),'interval':_0x922d('0xa1')});}return respondWithRpcPromise(_0x922d('0xa9'),'startRouting',_0x5cf85b);});}return respondWithRpcPromise(_0x922d('0xa9'),_0x922d('0xaa'),_0x5cf85b);})[_0x922d('0x36')](function(_0x102101){if(_0x102101){var _0xb2304=0xc8;var _0x3e4c22='receiveMessage';logger['info'](_0x922d('0x26'),_0x3e4c22,_0xb2304,_0x922d('0xab'));logger[_0x922d('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x3e4c22,_0xb2304,'entity\x20found',JSON[_0x922d('0xac')](_0x102101));if(_0x5cf85b[_0x922d('0x70')]['type']===_0x922d('0xad')){return _0x317cf6[_0x922d('0x2b')](_0xb2304)[_0x922d('0x31')](_0x922d('0xae'),_0x922d('0xaf'))['send'](_0x922d('0xb0'));}else{return _0x317cf6[_0x922d('0x2b')](_0xb2304)[_0x922d('0x32')](_0x102101);}}})['catch'](handleError(_0x317cf6,null));};exports[_0x922d('0xb1')]=function(_0x499d8e,_0x1107c0){var _0x43feca=_0x499d8e['params']['id'];var _0x3516fa=_0x499d8e[_0x922d('0x60')];var _0x5b78c2=0xc8;var _0x50d63c=null;return db['sequelize'][_0x922d('0xb2')]({'isolationLevel':db[_0x922d('0xb3')][_0x922d('0xb4')][_0x922d('0xb5')][_0x922d('0xb6')]},function(_0x157d6a){return db[_0x922d('0x41')][_0x922d('0x69')]({'where':{'id':_0x43feca},'transaction':_0x157d6a})['then'](function(_0x490015){if(_0x490015){return db['SmsApplication'][_0x922d('0x37')]({'where':{'SmsAccountId':_0x43feca},'transaction':_0x157d6a})['then'](function(){var _0x4f1990=_[_0x922d('0x40')](_0x3516fa,function(_0x44a559){_0x44a559['SmsAccountId']=_0x43feca;return _0x44a559;});return db[_0x922d('0x6e')]['bulkCreate'](_0x4f1990,{'transaction':_0x157d6a});});}else{_0x5b78c2=0x194;_0x50d63c=[];}});})[_0x922d('0x36')](function(){if(_0x5b78c2!==0x194){return db[_0x922d('0x6e')]['findAndCountAll']({'where':{'SmsAccountId':_0x43feca},'order':_0x922d('0x72')})[_0x922d('0x36')](function(_0x32bcbb){_0x50d63c=_0x32bcbb;});}})[_0x922d('0x2a')](function(_0x521b71){_0x5b78c2=0x1f4;logger['error'](_0x521b71[_0x922d('0x3c')]);if(_0x521b71[_0x922d('0x3d')]){delete _0x521b71[_0x922d('0x3d')];}_0x50d63c=_0x521b71;})[_0x922d('0xb7')](function(){if(_0x50d63c===null){_0x1107c0[_0x922d('0x3b')](_0x5b78c2);}else{if(_0x5b78c2===0x1f4){_0x1107c0[_0x922d('0x2b')](_0x5b78c2)[_0x922d('0xb8')](_0x50d63c);}else{_0x1107c0['status'](_0x5b78c2)[_0x922d('0x32')](_0x50d63c);}}});};exports['getApplications']=function(_0x6a8334,_0xb44a3c,_0x546b93){var _0x5c9e74={};var _0x375192={};var _0x58998a;var _0x1bab91;return db[_0x922d('0x41')][_0x922d('0x69')]({'where':{'id':_0x6a8334[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0xb44a3c,null))[_0x922d('0x36')](function(_0x140205){if(_0x140205){_0x58998a=_0x140205;_0x375192['model']=_[_0x922d('0x44')](db[_0x922d('0x6e')][_0x922d('0x42')]);_0x375192[_0x922d('0x45')]=_[_0x922d('0x44')](_0x6a8334[_0x922d('0x45')]);_0x375192[_0x922d('0x46')]=_[_0x922d('0x47')](_0x375192[_0x922d('0x43')],_0x375192[_0x922d('0x45')]);_0x5c9e74['attributes']=_[_0x922d('0x47')](_0x375192[_0x922d('0x43')],qs[_0x922d('0x49')](_0x6a8334[_0x922d('0x45')][_0x922d('0x49')]));_0x5c9e74[_0x922d('0x48')]=_0x5c9e74['attributes'][_0x922d('0x4a')]?_0x5c9e74[_0x922d('0x48')]:_0x375192[_0x922d('0x43')];_0x5c9e74[_0x922d('0x4d')]=qs[_0x922d('0x4e')](_0x6a8334[_0x922d('0x45')]['sort']);_0x5c9e74[_0x922d('0x4f')]=qs[_0x922d('0x46')](_['pick'](_0x6a8334['query'],_0x375192[_0x922d('0x46')]));if(_0x6a8334['query'][_0x922d('0x51')]){_0x5c9e74['where']=_['merge'](_0x5c9e74[_0x922d('0x4f')],{'$or':_[_0x922d('0x40')](_0x5c9e74[_0x922d('0x48')],function(_0x441c5e){var _0x528760={};_0x528760[_0x441c5e]={'$like':'%'+_0x6a8334['query'][_0x922d('0x51')]+'%'};return _0x528760;})});}_0x5c9e74=_['merge']({},_0x5c9e74,_0x6a8334[_0x922d('0x54')]);return _0x58998a[_0x922d('0xb9')](_0x5c9e74);}})['then'](function(_0x542767){if(_0x542767){_0x1bab91=_0x542767[_0x922d('0x4a')];if(!_0x6a8334[_0x922d('0x45')][_0x922d('0x4b')](_0x922d('0x4c'))){_0x5c9e74['limit']=qs['limit'](_0x6a8334[_0x922d('0x45')]['limit']);_0x5c9e74[_0x922d('0x30')]=qs['offset'](_0x6a8334[_0x922d('0x45')]['offset']);}return _0x58998a[_0x922d('0xb9')](_0x5c9e74);}})[_0x922d('0x36')](function(_0x2180fb){if(_0x2180fb){return _0x2180fb?{'count':_0x1bab91,'rows':_0x2180fb}:null;}})[_0x922d('0x36')](respondWithResult(_0xb44a3c,null))['catch'](handleError(_0xb44a3c,null));};exports[_0x922d('0xba')]=function(_0x30e3e5,_0x3d7c85,_0x54a37c){var _0x501850={'raw':![],'where':{}};var _0xad6526={};var _0x55ff1c={'count':0x0,'rows':[]};return db[_0x922d('0x41')][_0x922d('0x69')]({'where':{'id':_0x30e3e5[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x3d7c85,null))[_0x922d('0x36')](function(_0x58775d){if(_0x58775d){_0xad6526['model']=_['keys'](db[_0x922d('0x9b')][_0x922d('0x42')]);_0xad6526[_0x922d('0x45')]=_[_0x922d('0x44')](_0x30e3e5['query']);_0xad6526['filters']=_[_0x922d('0x47')](_0xad6526[_0x922d('0x43')],_0xad6526['query']);_0x501850[_0x922d('0x48')]=_[_0x922d('0x47')](_0xad6526['model'],qs[_0x922d('0x49')](_0x30e3e5['query'][_0x922d('0x49')]));_0x501850['attributes']=_0x501850['attributes'][_0x922d('0x4a')]?_0x501850[_0x922d('0x48')]:_0xad6526['model'];if(!_0x30e3e5['query'][_0x922d('0x4b')](_0x922d('0x4c'))){_0x501850['limit']=qs['limit'](_0x30e3e5['query'][_0x922d('0x2e')]);_0x501850[_0x922d('0x30')]=qs['offset'](_0x30e3e5[_0x922d('0x45')][_0x922d('0x30')]);}_0x501850[_0x922d('0x4d')]=qs['sort'](_0x30e3e5[_0x922d('0x45')][_0x922d('0x4e')]);_0x501850[_0x922d('0x4f')]=qs[_0x922d('0x46')](_['pick'](_0x30e3e5['query'],_0xad6526['filters']));_0x501850[_0x922d('0x4f')][_0x922d('0x63')]=_0x58775d['id'];if(_0x30e3e5[_0x922d('0x45')][_0x922d('0x51')]){_0x501850['where']=_[_0x922d('0x52')](_0x501850[_0x922d('0x4f')],{'$or':_[_0x922d('0x40')](_0x501850[_0x922d('0x48')],function(_0x3986da){var _0x4df8e3={};_0x4df8e3[_0x3986da]={'$like':'%'+_0x30e3e5[_0x922d('0x45')][_0x922d('0x51')]+'%'};return _0x4df8e3;})});}_0x501850=_[_0x922d('0x52')]({},_0x501850,_0x30e3e5['options']);return db[_0x922d('0x9b')]['count']({'where':_0x501850[_0x922d('0x4f')]})[_0x922d('0x36')](function(_0x467ba6){_0x55ff1c[_0x922d('0x2f')]=_0x467ba6;if(_0x30e3e5['query'][_0x922d('0x55')]){_0x501850[_0x922d('0x56')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x922d('0xbb')],'as':'Owner','attributes':[_0x922d('0x3d'),_0x922d('0xbc'),_0x922d('0xbd')],'required':![]},{'model':db[_0x922d('0xbe')],'as':_0x922d('0xbf'),'attributes':['id','name',_0x922d('0xc0')],'where':_0x30e3e5[_0x922d('0x45')][_0x922d('0xc1')]?{'id':_0x30e3e5[_0x922d('0x45')][_0x922d('0xc1')]}:undefined,'required':_0x30e3e5[_0x922d('0x45')][_0x922d('0xc1')]?!![]:![]}];}return db['SmsInteraction'][_0x922d('0x57')](_0x501850);})[_0x922d('0x36')](function(_0x5b6780){_0x55ff1c['rows']=_0x5b6780;return _0x55ff1c;});}})[_0x922d('0x36')](respondWithFilteredResult(_0x3d7c85,_0x501850))['catch'](handleError(_0x3d7c85,null));};exports[_0x922d('0xb8')]=function(_0x20c1da,_0x516c0e,_0xffe451){var _0xade188,_0x4a1007,_0xb88f49;if(_['isNil'](_0x20c1da[_0x922d('0x60')][_0x922d('0x60')])||_0x20c1da[_0x922d('0x60')]['body']===''){throw new db[(_0x922d('0x90'))][(_0x922d('0x75'))](_0x922d('0x93'));}if(_[_0x922d('0x92')](_0x20c1da[_0x922d('0x60')]['to'])){throw new db['Sequelize'][(_0x922d('0x75'))](_0x922d('0xc2'));}_0xade188=_0x20c1da[_0x922d('0x60')]['to'];return db[_0x922d('0x41')][_0x922d('0x5d')]({'where':{'id':_0x20c1da[_0x922d('0x59')]['id']},'include':[{'model':db['CmList'],'as':_0x922d('0xc3'),'include':[{'model':db['CmContact'],'as':_0x922d('0x96'),'where':{'mobile':_0xade188},'limit':0x1,'order':[[_0x922d('0x78'),_0x922d('0x97')]]}]}]})[_0x922d('0x36')](handleEntityNotFound(_0x516c0e,null))['then'](function(_0x3d1861){if(_0x3d1861&&_0x3d1861['List']){_0x4a1007=_0x3d1861['get']({'plain':!![]});if(_0x4a1007[_0x922d('0xc3')]&&_0x4a1007[_0x922d('0xc3')][_0x922d('0x96')][_0x922d('0x4a')]){return _0x4a1007[_0x922d('0xc3')]['Contacts'][0x0];}return db['CmContact'][_0x922d('0x5a')](_['defaults'](_0x20c1da['body'],{'firstName':_0xade188,'mobile':_0xade188,'phone':_0xade188,'ListId':_0x4a1007[_0x922d('0x7a')]}));}})[_0x922d('0x36')](handleEntityNotFound(_0x516c0e,null))['then'](function(_0x436723){if(_0x436723){_0xb88f49=_0x436723;return db[_0x922d('0x9b')][_0x922d('0x5d')]({'where':{'ContactId':_0xb88f49['id'],'closed':![],'SmsAccountId':_0x4a1007['id']}})[_0x922d('0x36')](function(_0x3ca8ce){if(_0x3ca8ce){return[_0x3ca8ce,![]];}return db[_0x922d('0x9b')][_0x922d('0x5a')]({'UserId':_0x20c1da[_0x922d('0x5b')]['id'],'ContactId':_0xb88f49['id'],'SmsAccountId':_0x4a1007['id'],'phone':_0xade188,'firstMsgDirection':'out','Messages':[_[_0x922d('0x52')](_0x20c1da[_0x922d('0x60')],{'read':![],'body':_0x20c1da[_0x922d('0x60')]['body'],'phone':_0xade188,'SmsAccountId':_0x4a1007['id'],'UserId':_0x20c1da[_0x922d('0x5b')]['id'],'ContactId':_0xb88f49['id']})]},{'include':[{'model':db[_0x922d('0xa3')],'as':_0x922d('0xc4')}]})[_0x922d('0x36')](function(_0x3658da){return[_0x3658da,!![]];});});}})[_0x922d('0x9c')](function(_0x5a59b5,_0x5cc4cc){if(_0x5cc4cc){return _0x5a59b5;}return db[_0x922d('0xa3')][_0x922d('0x5a')](_[_0x922d('0x52')](_0x20c1da[_0x922d('0x60')],{'read':![],'body':_0x20c1da[_0x922d('0x60')]['body'],'phone':_0xade188,'SmsAccountId':_0x4a1007['id'],'SmsInteractionId':_0x5a59b5['id'],'UserId':_0x20c1da[_0x922d('0x5b')]['id'],'ContactId':_0xb88f49['id']}))['then'](function(_0x1db106){_0x5a59b5[_0x922d('0xc5')][_0x922d('0xc4')]=[];_0x5a59b5[_0x922d('0xc5')][_0x922d('0xc4')][_0x922d('0x9f')](_0x1db106['dataValues']);return _0x5a59b5;});})[_0x922d('0x36')](respondWithResult(_0x516c0e,null))[_0x922d('0x2a')](handleError(_0x516c0e,null));};exports['status']=function(_0x20bd06,_0x28c2a1,_0x567a31){if(_0x20bd06[_0x922d('0x60')]['id']){delete _0x20bd06[_0x922d('0x60')]['id'];}var _0x44db3a,_0xfcce71,_0x27904a;return db['SmsAccount'][_0x922d('0x5d')]({'where':{'id':_0x20bd06[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x28c2a1,null))[_0x922d('0x36')](function(_0x490c9f){if(_0x490c9f){_0x27904a=_0x490c9f;logger[_0x922d('0x25')](_0x922d('0x26'),'status','received\x20delivery\x20report\x20from',_0x490c9f['type'],util[_0x922d('0xc6')](_0x20bd06['body'],{'showHidden':![],'depth':null}));switch(_0x490c9f['type']){case _0x922d('0x7f'):if(_0x20bd06[_0x922d('0x60')][_0x922d('0xc7')]&&_0x20bd06[_0x922d('0x60')][_0x922d('0x2b')]){_0xfcce71=_0x20bd06['body'][_0x922d('0x2b')];return db[_0x922d('0xa3')][_0x922d('0x5d')]({'where':{'messageId':_0x20bd06[_0x922d('0x60')]['skebby_dispatch_id']}});}break;case'connectel':if(_0x20bd06[_0x922d('0x60')][_0x922d('0xc8')]&&_0x20bd06[_0x922d('0x60')]['statusInt']){_0xfcce71=_0x20bd06[_0x922d('0x60')][_0x922d('0xc9')];return db[_0x922d('0xa3')]['find']({'where':{'messageId':_0x20bd06[_0x922d('0x60')][_0x922d('0xc8')]}});}break;case'clicksend':if(_0x20bd06['body'][_0x922d('0x83')]&&_0x20bd06['body'][_0x922d('0xca')]){_0xfcce71=_0x20bd06['body'][_0x922d('0xca')];return db['SmsMessage'][_0x922d('0x5d')]({'where':{'messageId':_0x20bd06['body'][_0x922d('0x83')]}});}break;case'infobip':var _0x2903ac=_0x20bd06[_0x922d('0x60')]['results'][0x0];if(_0x2903ac[_0x922d('0x7d')]&&_0x2903ac[_0x922d('0x2b')][_0x922d('0xcb')]==='DELIVERED'){_0xfcce71=_0x2903ac[_0x922d('0x2b')][_0x922d('0xcb')];return db[_0x922d('0xa3')][_0x922d('0x5d')]({'where':{'messageId':_0x2903ac[_0x922d('0x7d')]}});}break;case _0x922d('0x8a'):if(_0x20bd06['body']['messageId']&&_0x20bd06['body']['status']){_0xfcce71=_0x20bd06['body'][_0x922d('0x2b')];return db[_0x922d('0xa3')][_0x922d('0x5d')]({'where':{'messageId':_0x20bd06[_0x922d('0x60')][_0x922d('0x7d')]}});}break;case _0x922d('0x8d'):if(_0x20bd06[_0x922d('0x60')][0x0][_0x922d('0x29')]['id']){_0xfcce71=_0x20bd06['body'][0x0][_0x922d('0x7b')];return db[_0x922d('0xa3')][_0x922d('0x5d')]({'where':{'messageId':_0x20bd06[_0x922d('0x60')][0x0][_0x922d('0x29')]['id']}});}break;case _0x922d('0x8e'):if(_0x20bd06[_0x922d('0x60')][_0x922d('0xcc')]&&_0x20bd06['body'][_0x922d('0x2b')]){_0xfcce71=_0x20bd06['body'][_0x922d('0x2b')];return db[_0x922d('0xa3')]['find']({'where':{'messageId':_0x20bd06[_0x922d('0x60')]['redif']}});}break;}}})[_0x922d('0x36')](handleEntityNotFound(_0x28c2a1,null))[_0x922d('0x36')](function(_0xd4078b){if(_0xd4078b){_0x44db3a=_0xd4078b;switch(_0x27904a[_0x922d('0x7b')]){case _0x922d('0x7f'):if(_0xfcce71===_0x922d('0xcd')){return _0x44db3a[_0x922d('0x35')]({'read':!![]});}else{logger[_0x922d('0x27')](_0x922d('0x26'),_0x922d('0x2b'),_0x922d('0x7f'),util[_0x922d('0xc6')](_0x20bd06['body'],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0xfcce71==='1'){return _0x44db3a[_0x922d('0x35')]({'read':!![]});}else{logger[_0x922d('0x27')](_0x922d('0x26'),_0x922d('0x2b'),_0x922d('0x7f'),util['inspect'](_0x20bd06[_0x922d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x922d('0x82'):if(!_0x20bd06[_0x922d('0x60')][_0x922d('0xce')]&&_0xfcce71>=0xc8&&_0xfcce71<=0xce){return _0x44db3a['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x922d('0x82'),util['inspect'](_0x20bd06['body'],{'showHidden':![],'depth':null}));}break;case _0x922d('0xcf'):var _0xee9088=_0x20bd06[_0x922d('0x60')][_0x922d('0x87')][0x0];if(_0xee9088[_0x922d('0x2b')]['groupName']===_0x922d('0xcd')){return _0x44db3a[_0x922d('0x35')]({'read':!![]});}else{logger[_0x922d('0x27')](_0x922d('0x26'),_0x922d('0x2b'),_0x922d('0xcf'),util['inspect'](_0x20bd06[_0x922d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x922d('0x8a'):if(_0xfcce71==_0x922d('0xd0')||_0xfcce71=='RECEIVED_BY_RECIPIENT'){return _0x44db3a[_0x922d('0x35')]({'read':!![]});}else{logger[_0x922d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x922d('0x8a'),util['inspect'](_0x20bd06[_0x922d('0x60')],{'showHidden':![],'depth':null}));}break;case _0x922d('0x8d'):if(_0xfcce71==_0x922d('0xd1')){return _0x44db3a[_0x922d('0x35')]({'read':!![]});}else{logger[_0x922d('0x27')](_0x922d('0x26'),_0x922d('0x2b'),_0x922d('0x8d'),util[_0x922d('0xc6')](_0x20bd06[_0x922d('0x60')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xfcce71===_0x922d('0xd2')||_0xfcce71===_0x922d('0xd3')){return _0x44db3a[_0x922d('0x35')]({'read':!![]});}else{logger[_0x922d('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x922d('0x2b'),_0x922d('0x8e'),util[_0x922d('0xc6')](_0x20bd06[_0x922d('0x60')],{'showHidden':![],'depth':null}));}break;}return _0x44db3a;}})['then'](respondWithResult(_0x28c2a1,null))['catch'](handleError(_0x28c2a1,null));};exports[_0x922d('0xd4')]=function(_0x9fe8c9,_0x2acad4,_0x390c66){var _0x1a340d,_0x2027e4,_0x3f7541;return db[_0x922d('0x41')][_0x922d('0x5d')]({'where':{'id':_0x9fe8c9['params']['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x2acad4,null))[_0x922d('0x36')](function(_0x25a2f1){if(_0x25a2f1){_0x3f7541=_0x25a2f1;logger['debug'](_0x922d('0x26'),'status',_0x922d('0xd5'),_0x25a2f1[_0x922d('0x7b')],util[_0x922d('0xc6')](_0x9fe8c9[_0x922d('0x45')],{'showHidden':![],'depth':null}));switch(_0x25a2f1[_0x922d('0x7b')]){case _0x922d('0x88'):if(_0x9fe8c9['query'][_0x922d('0xd6')]&&_0x9fe8c9[_0x922d('0x45')][_0x922d('0xd7')]){_0x2027e4=_0x9fe8c9[_0x922d('0x45')][_0x922d('0xd7')];return db[_0x922d('0xa3')]['find']({'where':{'messageId':_0x9fe8c9[_0x922d('0x45')][_0x922d('0xd6')]}});}break;}}})['then'](handleEntityNotFound(_0x2acad4,null))[_0x922d('0x36')](function(_0x53da1d){if(_0x53da1d){_0x1a340d=_0x53da1d;switch(_0x3f7541[_0x922d('0x7b')]){case _0x922d('0x88'):if(_0x2027e4==='2'||_0x2027e4==='6'){return _0x1a340d['update']({'read':!![]});}else{logger[_0x922d('0x27')](_0x922d('0x26'),_0x922d('0x2b'),'csc',util[_0x922d('0xc6')](_0x9fe8c9['query'],{'showHidden':![],'depth':null}));};break;}return _0x1a340d;}})[_0x922d('0x36')](respondWithResult(_0x2acad4,null))[_0x922d('0x2a')](handleError(_0x2acad4,null));};exports['addAgents']=function(_0x7231cd,_0x3acd64,_0x4f2b3b){return db['SmsAccount'][_0x922d('0x5d')]({'where':{'id':_0x7231cd[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x3acd64,null))[_0x922d('0x36')](function(_0xe9799f){if(_0xe9799f){return _0xe9799f['addAgents'](_0x7231cd['body'][_0x922d('0x66')],_['omit'](_0x7231cd[_0x922d('0x60')],[_0x922d('0x66'),'id'])||{})[_0x922d('0x9c')](function(_0x165437){for(var _0x1d6812=0x0;_0x1d6812<_0x7231cd[_0x922d('0x60')][_0x922d('0x66')][_0x922d('0x4a')];_0x1d6812+=0x1){socket[_0x922d('0xd8')](_0x922d('0xd9'),{'UserId':Number(_0x7231cd[_0x922d('0x60')][_0x922d('0x66')][_0x1d6812]),'SmsAccountId':Number(_0x7231cd[_0x922d('0x59')]['id'])});}return _0x165437;});}})[_0x922d('0x36')](respondWithResult(_0x3acd64,null))[_0x922d('0x2a')](handleError(_0x3acd64,null));};exports[_0x922d('0xda')]=function(_0x1d04c1,_0x5b0795,_0x236cf1){return db[_0x922d('0x41')][_0x922d('0x5d')]({'where':{'id':_0x1d04c1[_0x922d('0x59')]['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x5b0795,null))[_0x922d('0x36')](function(_0x1c3a3b){if(_0x1c3a3b){return _0x1c3a3b[_0x922d('0xda')](_0x1d04c1[_0x922d('0x45')][_0x922d('0x66')])[_0x922d('0x36')](function(){if(_['isArray'](_0x1d04c1[_0x922d('0x45')][_0x922d('0x66')])){for(var _0x551b41=0x0;_0x551b41<_0x1d04c1[_0x922d('0x45')][_0x922d('0x66')][_0x922d('0x4a')];_0x551b41+=0x1){socket[_0x922d('0xd8')](_0x922d('0xdb'),{'UserId':Number(_0x1d04c1['query'][_0x922d('0x66')][_0x551b41]),'SmsAccountId':Number(_0x1d04c1['params']['id'])});}}else{socket[_0x922d('0xd8')]('userSmsAccount:remove',{'UserId':Number(_0x1d04c1[_0x922d('0x45')][_0x922d('0x66')]),'SmsAccountId':Number(_0x1d04c1[_0x922d('0x59')]['id'])});}});}})[_0x922d('0x36')](respondWithStatusCode(_0x5b0795,null))[_0x922d('0x2a')](handleError(_0x5b0795,null));};exports[_0x922d('0xdc')]=function(_0x45a2e,_0x590f6c,_0x456b0b){var _0x2d7858={};var _0x4bde7f={};var _0x319c10;var _0x11cf0a;return db[_0x922d('0x41')]['findOne']({'where':{'id':_0x45a2e['params']['id']}})[_0x922d('0x36')](handleEntityNotFound(_0x590f6c,null))['then'](function(_0x586562){if(_0x586562){_0x319c10=_0x586562;_0x4bde7f['model']=_[_0x922d('0x44')](db['User'][_0x922d('0x42')]);_0x4bde7f[_0x922d('0x45')]=_['keys'](_0x45a2e['query']);_0x4bde7f[_0x922d('0x46')]=_[_0x922d('0x47')](_0x4bde7f[_0x922d('0x43')],_0x4bde7f[_0x922d('0x45')]);_0x2d7858[_0x922d('0x48')]=_['intersection'](_0x4bde7f[_0x922d('0x43')],qs[_0x922d('0x49')](_0x45a2e['query'][_0x922d('0x49')]));_0x2d7858[_0x922d('0x48')]=_0x2d7858[_0x922d('0x48')]['length']?_0x2d7858[_0x922d('0x48')]:_0x4bde7f['model'];_0x2d7858[_0x922d('0x4d')]=qs[_0x922d('0x4e')](_0x45a2e[_0x922d('0x45')]['sort']);_0x2d7858['where']=qs['filters'](_[_0x922d('0x50')](_0x45a2e[_0x922d('0x45')],_0x4bde7f[_0x922d('0x46')]));if(_0x45a2e[_0x922d('0x45')][_0x922d('0x51')]){_0x2d7858[_0x922d('0x4f')]=_['merge'](_0x2d7858[_0x922d('0x4f')],{'$or':_[_0x922d('0x40')](_0x2d7858[_0x922d('0x48')],function(_0x579824){var _0x1786b7={};_0x1786b7[_0x579824]={'$like':'%'+_0x45a2e[_0x922d('0x45')]['filter']+'%'};return _0x1786b7;})});}_0x2d7858=_[_0x922d('0x52')]({},_0x2d7858,_0x45a2e['options']);return _0x319c10[_0x922d('0xdc')](_0x2d7858);}})['then'](function(_0x88f5ef){if(_0x88f5ef){_0x11cf0a=_0x88f5ef[_0x922d('0x4a')];if(!_0x45a2e[_0x922d('0x45')]['hasOwnProperty']('nolimit')){_0x2d7858['limit']=qs['limit'](_0x45a2e['query'][_0x922d('0x2e')]);_0x2d7858['offset']=qs[_0x922d('0x30')](_0x45a2e[_0x922d('0x45')][_0x922d('0x30')]);}return _0x319c10[_0x922d('0xdc')](_0x2d7858);}})[_0x922d('0x36')](function(_0x5b75ba){if(_0x5b75ba){return _0x5b75ba?{'count':_0x11cf0a,'rows':_0x5b75ba}:null;}})[_0x922d('0x36')](respondWithResult(_0x590f6c,null))[_0x922d('0x2a')](handleError(_0x590f6c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index f2948b1..24ab1e6 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 _0x3f11=['SmsAccount','setMaxListeners','save','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x3f11,0x16e));var _0x13f1=function(_0x4411e3,_0x5062e5){_0x4411e3=_0x4411e3-0x0;var _0x4b11c3=_0x3f11[_0x4411e3];return _0x4b11c3;};'use strict';var EventEmitter=require(_0x13f1('0x0'));var SmsAccount=require(_0x13f1('0x1'))['db'][_0x13f1('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x13f1('0x3')](0x0);var events={'afterCreate':_0x13f1('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x243c1c){return function(_0x432414,_0x1cfe7f,_0x5de043){SmsAccountEvents['emit'](_0x243c1c+':'+_0x432414['id'],_0x432414);SmsAccountEvents[_0x13f1('0x5')](_0x243c1c,_0x432414);_0x5de043(null);};}for(var e in events){if(events[_0x13f1('0x6')](e)){var event=events[e];SmsAccount[_0x13f1('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xbb40=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update'];(function(_0x15c818,_0x22bc5a){var _0x26c610=function(_0x9c22ba){while(--_0x9c22ba){_0x15c818['push'](_0x15c818['shift']());}};_0x26c610(++_0x22bc5a);}(_0xbb40,0x194));var _0x0bb4=function(_0x54171c,_0x18ead4){_0x54171c=_0x54171c-0x0;var _0x5371d1=_0xbb40[_0x54171c];return _0x5371d1;};'use strict';var EventEmitter=require(_0x0bb4('0x0'));var SmsAccount=require(_0x0bb4('0x1'))['db'][_0x0bb4('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0bb4('0x3')](0x0);var events={'afterCreate':_0x0bb4('0x4'),'afterUpdate':_0x0bb4('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5bc585){return function(_0x3dd991,_0x4a92c1,_0x4753d5){SmsAccountEvents[_0x0bb4('0x6')](_0x5bc585+':'+_0x3dd991['id'],_0x3dd991);SmsAccountEvents[_0x0bb4('0x6')](_0x5bc585,_0x3dd991);_0x4753d5(null);};}for(var e in events){if(events[_0x0bb4('0x7')](e)){var event=events[e];SmsAccount[_0x0bb4('0x8')](e,emitEvent(event));}}module[_0x0bb4('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 3262f5c..8ac38d2 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 _0x8358=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash'];(function(_0x2d5239,_0x21dfeb){var _0xff776d=function(_0x1c8d47){while(--_0x1c8d47){_0x2d5239['push'](_0x2d5239['shift']());}};_0xff776d(++_0x21dfeb);}(_0x8358,0x1eb));var _0x8835=function(_0x1e599e,_0xb41ef){_0x1e599e=_0x1e599e-0x0;var _0x1d7798=_0x8358[_0x1e599e];return _0x1d7798;};'use strict';var _=require(_0x8835('0x0'));var util=require('util');var logger=require(_0x8835('0x1'))(_0x8835('0x2'));var moment=require(_0x8835('0x3'));var BPromise=require(_0x8835('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8835('0x5'));var rimraf=require(_0x8835('0x6'));var config=require(_0x8835('0x7'));var attributes=require('./smsAccount.attributes');module[_0x8835('0x8')]=function(_0x33eb29,_0x26dfac){return _0x33eb29[_0x8835('0x9')](_0x8835('0xa'),attributes,{'tableName':_0x8835('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e91=['rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e91,0x1aa));var _0x18e9=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x8e91[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x18e9('0x0'));var util=require('util');var logger=require(_0x18e9('0x1'))(_0x18e9('0x2'));var moment=require('moment');var BPromise=require(_0x18e9('0x3'));var rp=require(_0x18e9('0x4'));var fs=require('fs');var path=require(_0x18e9('0x5'));var rimraf=require(_0x18e9('0x6'));var config=require(_0x18e9('0x7'));var attributes=require(_0x18e9('0x8'));module[_0x18e9('0x9')]=function(_0x34a90c,_0x11616e){return _0x34a90c[_0x18e9('0xa')]('SmsAccount',attributes,{'tableName':_0x18e9('0xb'),'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 bed8f84..8ed9833 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 _0x1e2d=['attributes','include','map','model','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw'];(function(_0x2f6ae4,_0x1b5b34){var _0xdc9131=function(_0x6d845){while(--_0x6d845){_0x2f6ae4['push'](_0x2f6ae4['shift']());}};_0xdc9131(++_0x1b5b34);}(_0x1e2d,0x163));var _0xd1e2=function(_0x26e0da,_0x3e961b){_0x26e0da=_0x26e0da-0x0;var _0x221753=_0x1e2d[_0x26e0da];return _0x221753;};'use strict';var _=require('lodash');var util=require(_0xd1e2('0x0'));var moment=require(_0xd1e2('0x1'));var BPromise=require(_0xd1e2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd1e2('0x3'));var db=require(_0xd1e2('0x4'))['db'];var utils=require(_0xd1e2('0x5'));var logger=require(_0xd1e2('0x6'))(_0xd1e2('0x7'));var config=require(_0xd1e2('0x8'));var jayson=require(_0xd1e2('0x9'));var client=jayson[_0xd1e2('0xa')][_0xd1e2('0xb')]({'port':0x232a});config[_0xd1e2('0xc')]=_[_0xd1e2('0xd')](config[_0xd1e2('0xc')],{'host':_0xd1e2('0xe'),'port':0x18eb});var socket=require(_0xd1e2('0xf'))(new Redis(config[_0xd1e2('0xc')]));require(_0xd1e2('0x10'))['register'](socket);function respondWithRpcPromise(_0x1bca90,_0x20fa27,_0x1382ce){return new BPromise(function(_0x13280b,_0xff931f){return client[_0xd1e2('0x11')](_0x1bca90,_0x1382ce)[_0xd1e2('0x12')](function(_0x150aad){logger[_0xd1e2('0x13')](_0xd1e2('0x14'),_0x20fa27,_0xd1e2('0x15'));logger[_0xd1e2('0x16')](_0xd1e2('0x17'),_0x20fa27,_0xd1e2('0x15'),JSON[_0xd1e2('0x18')](_0x150aad));if(_0x150aad[_0xd1e2('0x19')]){if(_0x150aad[_0xd1e2('0x19')][_0xd1e2('0x1a')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x20fa27,_0x150aad['error'][_0xd1e2('0x1b')]);return _0xff931f(_0x150aad['error']['message']);}logger[_0xd1e2('0x19')](_0xd1e2('0x14'),_0x20fa27,_0x150aad[_0xd1e2('0x19')][_0xd1e2('0x1b')]);return _0x13280b(_0x150aad['error'][_0xd1e2('0x1b')]);}else{logger[_0xd1e2('0x13')](_0xd1e2('0x14'),_0x20fa27,'request\x20sent');_0x13280b(_0x150aad[_0xd1e2('0x1c')][_0xd1e2('0x1b')]);}})[_0xd1e2('0x1d')](function(_0x3e2bb6){logger[_0xd1e2('0x19')](_0xd1e2('0x14'),_0x20fa27,_0x3e2bb6);_0xff931f(_0x3e2bb6);});});}exports[_0xd1e2('0x1e')]=function(_0x5001db){var _0x515fa9=this;return new Promise(function(_0x5c541e,_0xef6d63){return db[_0xd1e2('0x1f')][_0xd1e2('0x20')]({'raw':_0x5001db[_0xd1e2('0x21')]?_0x5001db[_0xd1e2('0x21')][_0xd1e2('0x22')]===undefined?!![]:![]:!![],'where':_0x5001db[_0xd1e2('0x21')]?_0x5001db[_0xd1e2('0x21')]['where']||null:null,'attributes':_0x5001db['options']?_0x5001db[_0xd1e2('0x21')][_0xd1e2('0x23')]||null:null,'include':_0x5001db[_0xd1e2('0x21')]?_0x5001db['options'][_0xd1e2('0x24')]?_[_0xd1e2('0x25')](_0x5001db[_0xd1e2('0x21')][_0xd1e2('0x24')],function(_0x1b9001){return{'model':db[_0x1b9001[_0xd1e2('0x26')]],'as':_0x1b9001['as'],'attributes':_0x1b9001[_0xd1e2('0x23')],'include':_0x1b9001[_0xd1e2('0x24')]?_['map'](_0x1b9001[_0xd1e2('0x24')],function(_0x10c592){return{'model':db[_0x10c592[_0xd1e2('0x26')]],'as':_0x10c592['as'],'attributes':_0x10c592[_0xd1e2('0x23')],'include':_0x10c592['include']?_[_0xd1e2('0x25')](_0x10c592[_0xd1e2('0x24')],function(_0x5b31b8){return{'model':db[_0x5b31b8[_0xd1e2('0x26')]],'as':_0x5b31b8['as'],'attributes':_0x5b31b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xd1e2('0x12')](function(_0x36e6f6){logger['info'](_0xd1e2('0x1e'),_0x5001db);logger[_0xd1e2('0x16')](_0xd1e2('0x1e'),_0x5001db,JSON['stringify'](_0x36e6f6));_0x5c541e(_0x36e6f6);})[_0xd1e2('0x1d')](function(_0x1a5c93){logger[_0xd1e2('0x19')](_0xd1e2('0x1e'),_0x1a5c93[_0xd1e2('0x1b')],_0x5001db);_0xef6d63(_0x515fa9['error'](0x1f4,_0x1a5c93[_0xd1e2('0x1b')]));});});}; \ No newline at end of file +var _0x8bed=['SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./smsAccount.socket','then','info'];(function(_0x3e01cc,_0x5610d1){var _0xdb3d35=function(_0x3cc467){while(--_0x3cc467){_0x3e01cc['push'](_0x3e01cc['shift']());}};_0xdb3d35(++_0x5610d1);}(_0x8bed,0xa1));var _0xd8be=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0x8bed[_0x3ff685];return _0x2046c9;};'use strict';var _=require(_0xd8be('0x0'));var util=require(_0xd8be('0x1'));var moment=require(_0xd8be('0x2'));var BPromise=require(_0xd8be('0x3'));var rs=require(_0xd8be('0x4'));var fs=require('fs');var Redis=require(_0xd8be('0x5'));var db=require(_0xd8be('0x6'))['db'];var utils=require(_0xd8be('0x7'));var logger=require(_0xd8be('0x8'))(_0xd8be('0x9'));var config=require(_0xd8be('0xa'));var jayson=require(_0xd8be('0xb'));var client=jayson[_0xd8be('0xc')]['http']({'port':0x232a});config[_0xd8be('0xd')]=_['defaults'](config[_0xd8be('0xd')],{'host':_0xd8be('0xe'),'port':0x18eb});var socket=require(_0xd8be('0xf'))(new Redis(config[_0xd8be('0xd')]));require(_0xd8be('0x10'))['register'](socket);function respondWithRpcPromise(_0x46b9e3,_0x215b00,_0x3ecf56){return new BPromise(function(_0x54ceb6,_0x5e9496){return client['request'](_0x46b9e3,_0x3ecf56)[_0xd8be('0x11')](function(_0x2cfc60){logger[_0xd8be('0x12')](_0xd8be('0x13'),_0x215b00,_0xd8be('0x14'));logger[_0xd8be('0x15')](_0xd8be('0x16'),_0x215b00,_0xd8be('0x14'),JSON[_0xd8be('0x17')](_0x2cfc60));if(_0x2cfc60[_0xd8be('0x18')]){if(_0x2cfc60[_0xd8be('0x18')][_0xd8be('0x19')]===0x1f4){logger[_0xd8be('0x18')](_0xd8be('0x13'),_0x215b00,_0x2cfc60['error']['message']);return _0x5e9496(_0x2cfc60['error'][_0xd8be('0x1a')]);}logger['error'](_0xd8be('0x13'),_0x215b00,_0x2cfc60[_0xd8be('0x18')][_0xd8be('0x1a')]);return _0x54ceb6(_0x2cfc60[_0xd8be('0x18')][_0xd8be('0x1a')]);}else{logger['info'](_0xd8be('0x13'),_0x215b00,_0xd8be('0x14'));_0x54ceb6(_0x2cfc60['result'][_0xd8be('0x1a')]);}})[_0xd8be('0x1b')](function(_0x28a7f4){logger[_0xd8be('0x18')]('SmsAccount,\x20%s,\x20%s',_0x215b00,_0x28a7f4);_0x5e9496(_0x28a7f4);});});}exports[_0xd8be('0x1c')]=function(_0x558af4){var _0xc06f31=this;return new Promise(function(_0x59bfc8,_0x5b80c2){return db[_0xd8be('0x1d')][_0xd8be('0x1e')]({'raw':_0x558af4[_0xd8be('0x1f')]?_0x558af4[_0xd8be('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x558af4[_0xd8be('0x1f')]?_0x558af4[_0xd8be('0x1f')]['where']||null:null,'attributes':_0x558af4[_0xd8be('0x1f')]?_0x558af4[_0xd8be('0x1f')][_0xd8be('0x20')]||null:null,'include':_0x558af4[_0xd8be('0x1f')]?_0x558af4[_0xd8be('0x1f')][_0xd8be('0x21')]?_[_0xd8be('0x22')](_0x558af4[_0xd8be('0x1f')][_0xd8be('0x21')],function(_0x33bc54){return{'model':db[_0x33bc54[_0xd8be('0x23')]],'as':_0x33bc54['as'],'attributes':_0x33bc54['attributes'],'include':_0x33bc54[_0xd8be('0x21')]?_[_0xd8be('0x22')](_0x33bc54[_0xd8be('0x21')],function(_0x249bde){return{'model':db[_0x249bde['model']],'as':_0x249bde['as'],'attributes':_0x249bde[_0xd8be('0x20')],'include':_0x249bde[_0xd8be('0x21')]?_['map'](_0x249bde[_0xd8be('0x21')],function(_0x2869c7){return{'model':db[_0x2869c7['model']],'as':_0x2869c7['as'],'attributes':_0x2869c7['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8be('0x11')](function(_0x379756){logger[_0xd8be('0x12')]('ShowSmsAccount',_0x558af4);logger[_0xd8be('0x15')](_0xd8be('0x1c'),_0x558af4,JSON[_0xd8be('0x17')](_0x379756));_0x59bfc8(_0x379756);})['catch'](function(_0x24854c){logger['error'](_0xd8be('0x1c'),_0x24854c[_0xd8be('0x1a')],_0x558af4);_0x5b80c2(_0xc06f31[_0xd8be('0x18')](0x1f4,_0x24854c[_0xd8be('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 01878d1..d5eb2ee 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(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 4ec531b..2a7ca00 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(_0x24c75d,_0x205a28){var _0x4fffe7=function(_0x5a9e5d){while(--_0x5a9e5d){_0x24c75d['push'](_0x24c75d['shift']());}};_0x4fffe7(++_0x205a28);}(_0x7217,0x19e));var _0x7721=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x7217[_0x2f3848];return _0x102668;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_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/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index a32e78c..565b5cf 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 _0xaf5c=['STRING','noop','TEXT','*,*,*,*','INTEGER'];(function(_0x3a9b01,_0x309cef){var _0x1297ab=function(_0x155b37){while(--_0x155b37){_0x3a9b01['push'](_0x3a9b01['shift']());}};_0x1297ab(++_0x309cef);}(_0xaf5c,0x1d5));var _0xcaf5=function(_0x2879db,_0x3e79f8){_0x2879db=_0x2879db-0x0;var _0x2c3fa3=_0xaf5c[_0x2879db];return _0x2c3fa3;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xcaf5('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xcaf5('0x1')],'allowNull':![],'defaultValue':_0xcaf5('0x2')},'appdata':{'type':Sequelize[_0xcaf5('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcaf5('0x1')],'defaultValue':_0xcaf5('0x4')}}; \ No newline at end of file +var _0xe9d8=['INTEGER','STRING','*,*,*,*','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe9d8,0x1a2));var _0x8e9d=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xe9d8[_0x46698a];return _0x356db0;};'use strict';var Sequelize=require(_0x8e9d('0x0'));module[_0x8e9d('0x1')]={'priority':{'type':Sequelize[_0x8e9d('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8e9d('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x8e9d('0x3')]},'interval':{'type':Sequelize[_0x8e9d('0x3')],'defaultValue':_0x8e9d('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 8988e76..a08e47d 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 _0x349e=['fieldName','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','catch','show','params','create','find','eml-format','fast-json-patch','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','SmsApplication','rawAttributes'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x349e,0x1f0));var _0xe349=function(_0x2179df,_0x52f919){_0x2179df=_0x2179df-0x0;var _0x3f354e=_0x349e[_0x2179df];return _0x3f354e;};'use strict';var emlformat=require(_0xe349('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe349('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe349('0x2'));var util=require(_0xe349('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xe349('0x4'));var ejs=require(_0xe349('0x5'));var fs=require('fs');var fs_extra=require(_0xe349('0x6'));var _=require(_0xe349('0x7'));var squel=require(_0xe349('0x8'));var crypto=require('crypto');var jsforce=require(_0xe349('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xe349('0x4'));var querystring=require(_0xe349('0xa'));var Papa=require(_0xe349('0xb'));var Redis=require(_0xe349('0xc'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe349('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe349('0xe'))(_0xe349('0xf'));var utils=require(_0xe349('0x10'));var config=require(_0xe349('0x11'));var licenseUtil=require(_0xe349('0x12'));var db=require(_0xe349('0x13'))['db'];function respondWithStatusCode(_0x5dfbbb,_0x4d265d){_0x4d265d=_0x4d265d||0xcc;return function(_0x5527a0){if(_0x5527a0){return _0x5dfbbb[_0xe349('0x14')](_0x4d265d);}return _0x5dfbbb[_0xe349('0x15')](_0x4d265d)['end']();};}function respondWithResult(_0x4e7f81,_0xfd8132){_0xfd8132=_0xfd8132||0xc8;return function(_0x2c729f){if(_0x2c729f){return _0x4e7f81[_0xe349('0x15')](_0xfd8132)[_0xe349('0x16')](_0x2c729f);}};}function respondWithFilteredResult(_0x4e71ca,_0xfc0b94){return function(_0x45a928){if(_0x45a928){var _0xf4f3f3=typeof _0xfc0b94['offset']===_0xe349('0x17')&&typeof _0xfc0b94[_0xe349('0x18')]==='undefined';var _0xf00eec=_0x45a928[_0xe349('0x19')];var _0x1ac7df=_0xf4f3f3?0x0:_0xfc0b94['offset'];var _0x142948=_0xf4f3f3?_0x45a928[_0xe349('0x19')]:_0xfc0b94[_0xe349('0x1a')]+_0xfc0b94[_0xe349('0x18')];var _0x454917;if(_0x142948>=_0xf00eec){_0x142948=_0xf00eec;_0x454917=0xc8;}else{_0x454917=0xce;}_0x4e71ca['status'](_0x454917);return _0x4e71ca[_0xe349('0x1b')](_0xe349('0x1c'),_0x1ac7df+'-'+_0x142948+'/'+_0xf00eec)[_0xe349('0x16')](_0x45a928);}return null;};}function patchUpdates(_0x8b57){return function(_0x3fe4fd){try{jsonpatch[_0xe349('0x1d')](_0x3fe4fd,_0x8b57,!![]);}catch(_0x1c2df2){return BPromise[_0xe349('0x1e')](_0x1c2df2);}return _0x3fe4fd[_0xe349('0x1f')]();};}function saveUpdates(_0x1589ba,_0x373126){return function(_0x585757){if(_0x585757){return _0x585757[_0xe349('0x20')](_0x1589ba)[_0xe349('0x21')](function(_0x793299){return _0x793299;});}return null;};}function removeEntity(_0x955499,_0x4f3b70){return function(_0x7299d4){if(_0x7299d4){return _0x7299d4[_0xe349('0x22')]()[_0xe349('0x21')](function(){_0x955499[_0xe349('0x15')](0xcc)[_0xe349('0x23')]();});}};}function handleEntityNotFound(_0x591268,_0x3d9af1){return function(_0x5deeba){if(!_0x5deeba){_0x591268[_0xe349('0x14')](0x194);}return _0x5deeba;};}function handleError(_0x42fc78,_0x520985){_0x520985=_0x520985||0x1f4;return function(_0x47456d){logger['error'](_0x47456d['stack']);if(_0x47456d['name']){delete _0x47456d[_0xe349('0x24')];}_0x42fc78[_0xe349('0x15')](_0x520985)[_0xe349('0x25')](_0x47456d);};}exports['index']=function(_0x5cc3f9,_0x7079b9){var _0x1222b6={},_0x535bb0={},_0x4ca872={'count':0x0,'rows':[]};var _0x2b5326=_['map'](db[_0xe349('0x26')][_0xe349('0x27')],function(_0x5d7ac6){return{'name':_0x5d7ac6[_0xe349('0x28')],'type':_0x5d7ac6['type']['key']};});_0x535bb0[_0xe349('0x29')]=_[_0xe349('0x2a')](_0x2b5326,_0xe349('0x24'));_0x535bb0[_0xe349('0x2b')]=_[_0xe349('0x2c')](_0x5cc3f9[_0xe349('0x2b')]);_0x535bb0[_0xe349('0x2d')]=_[_0xe349('0x2e')](_0x535bb0[_0xe349('0x29')],_0x535bb0['query']);_0x1222b6['attributes']=_[_0xe349('0x2e')](_0x535bb0['model'],qs['fields'](_0x5cc3f9['query'][_0xe349('0x2f')]));_0x1222b6[_0xe349('0x30')]=_0x1222b6[_0xe349('0x30')]['length']?_0x1222b6[_0xe349('0x30')]:_0x535bb0['model'];if(!_0x5cc3f9[_0xe349('0x2b')][_0xe349('0x31')](_0xe349('0x32'))){_0x1222b6['limit']=qs['limit'](_0x5cc3f9[_0xe349('0x2b')][_0xe349('0x18')]);_0x1222b6['offset']=qs[_0xe349('0x1a')](_0x5cc3f9[_0xe349('0x2b')][_0xe349('0x1a')]);}_0x1222b6[_0xe349('0x33')]=qs[_0xe349('0x34')](_0x5cc3f9[_0xe349('0x2b')]['sort']);_0x1222b6[_0xe349('0x35')]=qs[_0xe349('0x2d')](_[_0xe349('0x36')](_0x5cc3f9['query'],_0x535bb0[_0xe349('0x2d')]),_0x2b5326);if(_0x5cc3f9[_0xe349('0x2b')][_0xe349('0x37')]){_0x1222b6[_0xe349('0x35')]=_['merge'](_0x1222b6[_0xe349('0x35')],{'$or':_[_0xe349('0x2a')](_0x2b5326,function(_0xa2c46a){if(_0xa2c46a[_0xe349('0x38')]!==_0xe349('0x39')){var _0x4bba4b={};_0x4bba4b[_0xa2c46a[_0xe349('0x24')]]={'$like':'%'+_0x5cc3f9[_0xe349('0x2b')][_0xe349('0x37')]+'%'};return _0x4bba4b;}})});}_0x1222b6=_[_0xe349('0x3a')]({},_0x1222b6,_0x5cc3f9[_0xe349('0x3b')]);var _0x17ef9e={'where':_0x1222b6['where']};return db[_0xe349('0x26')]['count'](_0x17ef9e)[_0xe349('0x21')](function(_0x3bb1c5){_0x4ca872[_0xe349('0x19')]=_0x3bb1c5;if(_0x5cc3f9[_0xe349('0x2b')][_0xe349('0x3c')]){_0x1222b6[_0xe349('0x3d')]=[{'all':!![]}];}return db[_0xe349('0x26')]['findAll'](_0x1222b6);})[_0xe349('0x21')](function(_0x186788){_0x4ca872['rows']=_0x186788;return _0x4ca872;})[_0xe349('0x21')](respondWithFilteredResult(_0x7079b9,_0x1222b6))[_0xe349('0x3e')](handleError(_0x7079b9,null));};exports[_0xe349('0x3f')]=function(_0x34381d,_0x586dee){var _0x32f07a={'raw':!![],'where':{'id':_0x34381d[_0xe349('0x40')]['id']}},_0x26e0d6={};_0x26e0d6[_0xe349('0x29')]=_['keys'](db[_0xe349('0x26')]['rawAttributes']);_0x26e0d6['query']=_['keys'](_0x34381d[_0xe349('0x2b')]);_0x26e0d6[_0xe349('0x2d')]=_['intersection'](_0x26e0d6[_0xe349('0x29')],_0x26e0d6[_0xe349('0x2b')]);_0x32f07a[_0xe349('0x30')]=_[_0xe349('0x2e')](_0x26e0d6[_0xe349('0x29')],qs[_0xe349('0x2f')](_0x34381d[_0xe349('0x2b')]['fields']));_0x32f07a[_0xe349('0x30')]=_0x32f07a[_0xe349('0x30')]['length']?_0x32f07a[_0xe349('0x30')]:_0x26e0d6[_0xe349('0x29')];if(_0x34381d[_0xe349('0x2b')][_0xe349('0x3c')]){_0x32f07a[_0xe349('0x3d')]=[{'all':!![]}];}_0x32f07a=_[_0xe349('0x3a')]({},_0x32f07a,_0x34381d['options']);return db[_0xe349('0x26')]['find'](_0x32f07a)['then'](handleEntityNotFound(_0x586dee,null))[_0xe349('0x21')](respondWithResult(_0x586dee,null))[_0xe349('0x3e')](handleError(_0x586dee,null));};exports[_0xe349('0x41')]=function(_0x4620be,_0x5766ee){return db[_0xe349('0x26')][_0xe349('0x41')](_0x4620be['body'],{})[_0xe349('0x21')](respondWithResult(_0x5766ee,0xc9))[_0xe349('0x3e')](handleError(_0x5766ee,null));};exports[_0xe349('0x20')]=function(_0x2ae51e,_0xfe5629){if(_0x2ae51e['body']['id']){delete _0x2ae51e['body']['id'];}return db['SmsApplication'][_0xe349('0x42')]({'where':{'id':_0x2ae51e[_0xe349('0x40')]['id']}})[_0xe349('0x21')](handleEntityNotFound(_0xfe5629,null))['then'](saveUpdates(_0x2ae51e['body'],null))[_0xe349('0x21')](respondWithResult(_0xfe5629,null))[_0xe349('0x3e')](handleError(_0xfe5629,null));};exports[_0xe349('0x22')]=function(_0x42f898,_0x453602){return db[_0xe349('0x26')][_0xe349('0x42')]({'where':{'id':_0x42f898[_0xe349('0x40')]['id']}})['then'](handleEntityNotFound(_0x453602,null))['then'](removeEntity(_0x453602,null))[_0xe349('0x3e')](handleError(_0x453602,null));}; \ No newline at end of file +var _0xf95c=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SmsApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils'];(function(_0x3abd9a,_0x4835bf){var _0x73121e=function(_0x1eacd5){while(--_0x1eacd5){_0x3abd9a['push'](_0x3abd9a['shift']());}};_0x73121e(++_0x4835bf);}(_0xf95c,0x15a));var _0xcf95=function(_0x324a1c,_0x12010b){_0x324a1c=_0x324a1c-0x0;var _0x3a087d=_0xf95c[_0x324a1c];return _0x3a087d;};'use strict';var emlformat=require(_0xcf95('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf95('0x1'));var jsonpatch=require(_0xcf95('0x2'));var rp=require(_0xcf95('0x3'));var moment=require(_0xcf95('0x4'));var BPromise=require(_0xcf95('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xcf95('0x6'));var csv=require(_0xcf95('0x7'));var ejs=require(_0xcf95('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcf95('0x9'));var crypto=require(_0xcf95('0xa'));var jsforce=require(_0xcf95('0xb'));var deskjs=require(_0xcf95('0xc'));var toCsv=require(_0xcf95('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcf95('0xd'));var authService=require(_0xcf95('0xe'));var qs=require(_0xcf95('0xf'));var as=require(_0xcf95('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcf95('0x11'));var utils=require(_0xcf95('0x12'));var config=require(_0xcf95('0x13'));var licenseUtil=require(_0xcf95('0x14'));var db=require(_0xcf95('0x15'))['db'];function respondWithStatusCode(_0x17bf6f,_0x2a17ad){_0x2a17ad=_0x2a17ad||0xcc;return function(_0x31c1d7){if(_0x31c1d7){return _0x17bf6f[_0xcf95('0x16')](_0x2a17ad);}return _0x17bf6f[_0xcf95('0x17')](_0x2a17ad)[_0xcf95('0x18')]();};}function respondWithResult(_0x58bf97,_0xd474dd){_0xd474dd=_0xd474dd||0xc8;return function(_0x49402f){if(_0x49402f){return _0x58bf97[_0xcf95('0x17')](_0xd474dd)[_0xcf95('0x19')](_0x49402f);}};}function respondWithFilteredResult(_0x15298b,_0x183a45){return function(_0x1fdea8){if(_0x1fdea8){var _0x12e07d=typeof _0x183a45['offset']===_0xcf95('0x1a')&&typeof _0x183a45[_0xcf95('0x1b')]===_0xcf95('0x1a');var _0x7832e8=_0x1fdea8['count'];var _0x506de3=_0x12e07d?0x0:_0x183a45[_0xcf95('0x1c')];var _0x3431be=_0x12e07d?_0x1fdea8[_0xcf95('0x1d')]:_0x183a45[_0xcf95('0x1c')]+_0x183a45[_0xcf95('0x1b')];var _0x44189a;if(_0x3431be>=_0x7832e8){_0x3431be=_0x7832e8;_0x44189a=0xc8;}else{_0x44189a=0xce;}_0x15298b[_0xcf95('0x17')](_0x44189a);return _0x15298b[_0xcf95('0x1e')](_0xcf95('0x1f'),_0x506de3+'-'+_0x3431be+'/'+_0x7832e8)['json'](_0x1fdea8);}return null;};}function patchUpdates(_0x853910){return function(_0x558d02){try{jsonpatch[_0xcf95('0x20')](_0x558d02,_0x853910,!![]);}catch(_0x9d938){return BPromise[_0xcf95('0x21')](_0x9d938);}return _0x558d02[_0xcf95('0x22')]();};}function saveUpdates(_0x29e6d0,_0x5bc44c){return function(_0x1c2095){if(_0x1c2095){return _0x1c2095[_0xcf95('0x23')](_0x29e6d0)[_0xcf95('0x24')](function(_0x58d2e6){return _0x58d2e6;});}return null;};}function removeEntity(_0x4b61e3,_0x49335f){return function(_0x57f111){if(_0x57f111){return _0x57f111['destroy']()[_0xcf95('0x24')](function(){_0x4b61e3[_0xcf95('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10970b,_0x29ffb3){return function(_0x2f3353){if(!_0x2f3353){_0x10970b['sendStatus'](0x194);}return _0x2f3353;};}function handleError(_0x50686d,_0x1d7b1f){_0x1d7b1f=_0x1d7b1f||0x1f4;return function(_0x18311d){logger[_0xcf95('0x25')](_0x18311d[_0xcf95('0x26')]);if(_0x18311d[_0xcf95('0x27')]){delete _0x18311d[_0xcf95('0x27')];}_0x50686d[_0xcf95('0x17')](_0x1d7b1f)[_0xcf95('0x28')](_0x18311d);};}exports[_0xcf95('0x29')]=function(_0x398862,_0x472f79){var _0x78d3b3={},_0x31df48={},_0x221919={'count':0x0,'rows':[]};var _0x3cb345=_['map'](db[_0xcf95('0x2a')][_0xcf95('0x2b')],function(_0x300d5d){return{'name':_0x300d5d[_0xcf95('0x2c')],'type':_0x300d5d[_0xcf95('0x2d')]['key']};});_0x31df48[_0xcf95('0x2e')]=_[_0xcf95('0x2f')](_0x3cb345,_0xcf95('0x27'));_0x31df48[_0xcf95('0x30')]=_[_0xcf95('0x31')](_0x398862[_0xcf95('0x30')]);_0x31df48[_0xcf95('0x32')]=_[_0xcf95('0x33')](_0x31df48[_0xcf95('0x2e')],_0x31df48[_0xcf95('0x30')]);_0x78d3b3[_0xcf95('0x34')]=_[_0xcf95('0x33')](_0x31df48[_0xcf95('0x2e')],qs[_0xcf95('0x35')](_0x398862['query']['fields']));_0x78d3b3[_0xcf95('0x34')]=_0x78d3b3[_0xcf95('0x34')][_0xcf95('0x36')]?_0x78d3b3['attributes']:_0x31df48[_0xcf95('0x2e')];if(!_0x398862[_0xcf95('0x30')][_0xcf95('0x37')]('nolimit')){_0x78d3b3[_0xcf95('0x1b')]=qs[_0xcf95('0x1b')](_0x398862[_0xcf95('0x30')]['limit']);_0x78d3b3[_0xcf95('0x1c')]=qs[_0xcf95('0x1c')](_0x398862['query']['offset']);}_0x78d3b3['order']=qs[_0xcf95('0x38')](_0x398862['query'][_0xcf95('0x38')]);_0x78d3b3[_0xcf95('0x39')]=qs[_0xcf95('0x32')](_[_0xcf95('0x3a')](_0x398862[_0xcf95('0x30')],_0x31df48['filters']),_0x3cb345);if(_0x398862[_0xcf95('0x30')][_0xcf95('0x3b')]){_0x78d3b3['where']=_['merge'](_0x78d3b3[_0xcf95('0x39')],{'$or':_[_0xcf95('0x2f')](_0x3cb345,function(_0x5cc3da){if(_0x5cc3da['type']!=='VIRTUAL'){var _0x1e918c={};_0x1e918c[_0x5cc3da[_0xcf95('0x27')]]={'$like':'%'+_0x398862['query'][_0xcf95('0x3b')]+'%'};return _0x1e918c;}})});}_0x78d3b3=_['merge']({},_0x78d3b3,_0x398862[_0xcf95('0x3c')]);var _0x46e4a1={'where':_0x78d3b3[_0xcf95('0x39')]};return db[_0xcf95('0x2a')][_0xcf95('0x1d')](_0x46e4a1)[_0xcf95('0x24')](function(_0x28c288){_0x221919[_0xcf95('0x1d')]=_0x28c288;if(_0x398862[_0xcf95('0x30')][_0xcf95('0x3d')]){_0x78d3b3[_0xcf95('0x3e')]=[{'all':!![]}];}return db['SmsApplication'][_0xcf95('0x3f')](_0x78d3b3);})[_0xcf95('0x24')](function(_0x5ad827){_0x221919[_0xcf95('0x40')]=_0x5ad827;return _0x221919;})['then'](respondWithFilteredResult(_0x472f79,_0x78d3b3))['catch'](handleError(_0x472f79,null));};exports[_0xcf95('0x41')]=function(_0xb7cac8,_0x273159){var _0x28d5ab={'raw':!![],'where':{'id':_0xb7cac8[_0xcf95('0x42')]['id']}},_0x3d1979={};_0x3d1979[_0xcf95('0x2e')]=_['keys'](db[_0xcf95('0x2a')][_0xcf95('0x2b')]);_0x3d1979['query']=_['keys'](_0xb7cac8['query']);_0x3d1979['filters']=_[_0xcf95('0x33')](_0x3d1979['model'],_0x3d1979[_0xcf95('0x30')]);_0x28d5ab['attributes']=_['intersection'](_0x3d1979[_0xcf95('0x2e')],qs[_0xcf95('0x35')](_0xb7cac8[_0xcf95('0x30')][_0xcf95('0x35')]));_0x28d5ab['attributes']=_0x28d5ab[_0xcf95('0x34')][_0xcf95('0x36')]?_0x28d5ab['attributes']:_0x3d1979['model'];if(_0xb7cac8[_0xcf95('0x30')][_0xcf95('0x3d')]){_0x28d5ab[_0xcf95('0x3e')]=[{'all':!![]}];}_0x28d5ab=_[_0xcf95('0x43')]({},_0x28d5ab,_0xb7cac8['options']);return db[_0xcf95('0x2a')][_0xcf95('0x44')](_0x28d5ab)[_0xcf95('0x24')](handleEntityNotFound(_0x273159,null))[_0xcf95('0x24')](respondWithResult(_0x273159,null))[_0xcf95('0x45')](handleError(_0x273159,null));};exports['create']=function(_0x1228b2,_0x49eb66){return db[_0xcf95('0x2a')][_0xcf95('0x46')](_0x1228b2[_0xcf95('0x47')],{})['then'](respondWithResult(_0x49eb66,0xc9))[_0xcf95('0x45')](handleError(_0x49eb66,null));};exports[_0xcf95('0x23')]=function(_0x18fdf8,_0x262cbe){if(_0x18fdf8['body']['id']){delete _0x18fdf8[_0xcf95('0x47')]['id'];}return db['SmsApplication'][_0xcf95('0x44')]({'where':{'id':_0x18fdf8[_0xcf95('0x42')]['id']}})[_0xcf95('0x24')](handleEntityNotFound(_0x262cbe,null))[_0xcf95('0x24')](saveUpdates(_0x18fdf8['body'],null))['then'](respondWithResult(_0x262cbe,null))[_0xcf95('0x45')](handleError(_0x262cbe,null));};exports[_0xcf95('0x48')]=function(_0x14cc24,_0x4fca2c){return db['SmsApplication'][_0xcf95('0x44')]({'where':{'id':_0x14cc24['params']['id']}})[_0xcf95('0x24')](handleEntityNotFound(_0x4fca2c,null))[_0xcf95('0x24')](removeEntity(_0x4fca2c,null))[_0xcf95('0x45')](handleError(_0x4fca2c,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 1f345a2..567165b 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 _0x7a94=['moment','bluebird','path','./smsApplication.attributes','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api'];(function(_0x2f4c68,_0x71994){var _0xe57292=function(_0x19f7ad){while(--_0x19f7ad){_0x2f4c68['push'](_0x2f4c68['shift']());}};_0xe57292(++_0x71994);}(_0x7a94,0x1c5));var _0x47a9=function(_0x18770e,_0x1cdf36){_0x18770e=_0x18770e-0x0;var _0x4282e6=_0x7a94[_0x18770e];return _0x4282e6;};'use strict';var _=require('lodash');var util=require(_0x47a9('0x0'));var logger=require(_0x47a9('0x1'))(_0x47a9('0x2'));var moment=require(_0x47a9('0x3'));var BPromise=require(_0x47a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a9('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x47a9('0x6'));module['exports']=function(_0x2f5589,_0x6d7a2f){return _0x2f5589[_0x47a9('0x7')](_0x47a9('0x8'),attributes,{'tableName':_0x47a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x47a9('0xa'),'collate':_0x47a9('0xb')});}; \ No newline at end of file +var _0x2cd3=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication'];(function(_0x425b19,_0x2dcf14){var _0x15ecab=function(_0x317d46){while(--_0x317d46){_0x425b19['push'](_0x425b19['shift']());}};_0x15ecab(++_0x2dcf14);}(_0x2cd3,0xf1));var _0x32cd=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x2cd3[_0x3cae69];return _0x3128eb;};'use strict';var _=require(_0x32cd('0x0'));var util=require('util');var logger=require(_0x32cd('0x1'))(_0x32cd('0x2'));var moment=require(_0x32cd('0x3'));var BPromise=require(_0x32cd('0x4'));var rp=require(_0x32cd('0x5'));var fs=require('fs');var path=require(_0x32cd('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x32cd('0x7'));module[_0x32cd('0x8')]=function(_0x1af8c8,_0x1024e0){return _0x1af8c8[_0x32cd('0x9')](_0x32cd('0xa'),attributes,{'tableName':_0x32cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x32cd('0xc'),'collate':_0x32cd('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 50f53fe..76dfb44 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 _0xe98f=['result','catch','lodash','moment','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x3a047c,_0xdd39e7){var _0x12985b=function(_0x4a19a6){while(--_0x4a19a6){_0x3a047c['push'](_0x3a047c['shift']());}};_0x12985b(++_0xdd39e7);}(_0xe98f,0xde));var _0xfe98=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xe98f[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xfe98('0x0'));var util=require('util');var moment=require(_0xfe98('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe98('0x2'));var fs=require('fs');var Redis=require(_0xfe98('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe98('0x4'))('rpc');var config=require(_0xfe98('0x5'));var jayson=require(_0xfe98('0x6'));var client=jayson['client'][_0xfe98('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x585363,_0x39bc9f,_0x2721d1){return new BPromise(function(_0x3cbc45,_0x502d20){return client[_0xfe98('0x8')](_0x585363,_0x2721d1)[_0xfe98('0x9')](function(_0x57fc24){logger[_0xfe98('0xa')](_0xfe98('0xb'),_0x39bc9f,_0xfe98('0xc'));logger[_0xfe98('0xd')](_0xfe98('0xe'),_0x39bc9f,_0xfe98('0xc'),JSON['stringify'](_0x57fc24));if(_0x57fc24[_0xfe98('0xf')]){if(_0x57fc24[_0xfe98('0xf')][_0xfe98('0x10')]===0x1f4){logger[_0xfe98('0xf')](_0xfe98('0xb'),_0x39bc9f,_0x57fc24['error'][_0xfe98('0x11')]);return _0x502d20(_0x57fc24[_0xfe98('0xf')]['message']);}logger[_0xfe98('0xf')]('SmsApplication,\x20%s,\x20%s',_0x39bc9f,_0x57fc24[_0xfe98('0xf')][_0xfe98('0x11')]);return _0x3cbc45(_0x57fc24[_0xfe98('0xf')][_0xfe98('0x11')]);}else{logger['info'](_0xfe98('0xb'),_0x39bc9f,'request\x20sent');_0x3cbc45(_0x57fc24[_0xfe98('0x12')][_0xfe98('0x11')]);}})[_0xfe98('0x13')](function(_0x476932){logger['error']('SmsApplication,\x20%s,\x20%s',_0x39bc9f,_0x476932);_0x502d20(_0x476932);});});} \ No newline at end of file +var _0xe1e8=['lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','info','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','SmsApplication,\x20%s,\x20%s','message','result'];(function(_0x35181c,_0x82694a){var _0xe14bf9=function(_0x2be9b7){while(--_0x2be9b7){_0x35181c['push'](_0x35181c['shift']());}};_0xe14bf9(++_0x82694a);}(_0xe1e8,0x1cb));var _0x8e1e=function(_0x1dfdad,_0x1f47d0){_0x1dfdad=_0x1dfdad-0x0;var _0x4e4478=_0xe1e8[_0x1dfdad];return _0x4e4478;};'use strict';var _=require(_0x8e1e('0x0'));var util=require('util');var moment=require(_0x8e1e('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e1e('0x2'));var db=require(_0x8e1e('0x3'))['db'];var utils=require(_0x8e1e('0x4'));var logger=require(_0x8e1e('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8e1e('0x6'));var client=jayson[_0x8e1e('0x7')][_0x8e1e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1861ce,_0x4eb2b7,_0x21ee75){return new BPromise(function(_0xe8a658,_0x3a1ead){return client['request'](_0x1861ce,_0x21ee75)['then'](function(_0x4007f3){logger[_0x8e1e('0x9')]('SmsApplication,\x20%s,\x20%s',_0x4eb2b7,_0x8e1e('0xa'));logger['debug'](_0x8e1e('0xb'),_0x4eb2b7,_0x8e1e('0xa'),JSON[_0x8e1e('0xc')](_0x4007f3));if(_0x4007f3[_0x8e1e('0xd')]){if(_0x4007f3[_0x8e1e('0xd')]['code']===0x1f4){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3[_0x8e1e('0xd')]['message']);return _0x3a1ead(_0x4007f3[_0x8e1e('0xd')][_0x8e1e('0xf')]);}logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x4007f3['error']['message']);return _0xe8a658(_0x4007f3['error'][_0x8e1e('0xf')]);}else{logger[_0x8e1e('0x9')](_0x8e1e('0xe'),_0x4eb2b7,_0x8e1e('0xa'));_0xe8a658(_0x4007f3[_0x8e1e('0x10')]['message']);}})['catch'](function(_0x2d2dc2){logger[_0x8e1e('0xd')](_0x8e1e('0xe'),_0x4eb2b7,_0x2d2dc2);_0x3a1ead(_0x2d2dc2);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 9115659..07b5c45 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 _0x4213=['download','post','create','/:id/messages','addMessage','/:id/tags','tracked','smsinteraction:addtags','put','smsinteraction:update','update','sms','smsinteraction:destroy','destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4213,0x77));var _0x3421=function(_0xee05c6,_0x544c85){_0xee05c6=_0xee05c6-0x0;var _0xe21efc=_0x4213[_0xee05c6];return _0xe21efc;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/messages',auth[_0x3421('0xa')](),controller['getMessages']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x12')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0x13')]);router['post'](_0x3421('0x14'),auth[_0x3421('0xa')](),controller[_0x3421('0x15')]);router[_0x3421('0x12')](_0x3421('0x16'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')]('sms',_0x3421('0x18')),controller['addTags']);router[_0x3421('0x19')](_0x3421('0xe'),auth['isAuthenticated'](),interaction[_0x3421('0x17')]('sms',_0x3421('0x1a')),controller[_0x3421('0x1b')]);router['delete'](_0x3421('0xe'),auth[_0x3421('0xa')](),interaction[_0x3421('0x17')](_0x3421('0x1c'),_0x3421('0x1d')),controller[_0x3421('0x1e')]);router[_0x3421('0x1f')](_0x3421('0x16'),auth[_0x3421('0xa')](),controller[_0x3421('0x20')]);module[_0x3421('0x21')]=router; \ No newline at end of file +var _0x2032=['./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','create','/:id/tags','sms','smsinteraction:addtags','addTags','put','/:id','tracked','smsinteraction:update','update','smsinteraction:destroy','delete','removeTags','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x4d3a9b,_0x20b47d){var _0x1b5471=function(_0x51bf57){while(--_0x51bf57){_0x4d3a9b['push'](_0x4d3a9b['shift']());}};_0x1b5471(++_0x20b47d);}(_0x2032,0xd9));var _0x2203=function(_0x1f81a6,_0x10d749){_0x1f81a6=_0x1f81a6-0x0;var _0x3d7fd5=_0x2032[_0x1f81a6];return _0x3d7fd5;};'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',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['get'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router['get'](_0x2203('0x10'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);router['post']('/',auth[_0x2203('0x9')](),controller[_0x2203('0x12')]);router['post']('/:id/messages',auth['isAuthenticated'](),controller['addMessage']);router['post'](_0x2203('0x13'),auth['isAuthenticated'](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction[_0x2203('0x19')](_0x2203('0x14'),_0x2203('0x1a')),controller[_0x2203('0x1b')]);router['delete'](_0x2203('0x18'),auth[_0x2203('0x9')](),interaction['tracked'](_0x2203('0x14'),_0x2203('0x1c')),controller['destroy']);router[_0x2203('0x1d')]('/:id/tags',auth[_0x2203('0x9')](),controller[_0x2203('0x1e')]);module[_0x2203('0x1f')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 48c36cb..b88fd23 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 _0x5581=['out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x313c92,_0x5d9943){var _0x8ddf39=function(_0x5c8fe7){while(--_0x5c8fe7){_0x313c92['push'](_0x313c92['shift']());}};_0x8ddf39(++_0x5d9943);}(_0x5581,0x115));var _0x1558=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x5581[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x1558('0x0'));var moment=require('moment');module[_0x1558('0x1')]={'closed':{'type':Sequelize[_0x1558('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1558('0x3')]},'disposition':{'type':Sequelize[_0x1558('0x4')]},'secondDisposition':{'type':Sequelize[_0x1558('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1558('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1558('0x4')]},'read1stAt':{'type':Sequelize[_0x1558('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1558('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1558('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1558('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1558('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6808=['out','sequelize','moment','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x263f2e,_0x2da62f){var _0x3474e3=function(_0x1aa23e){while(--_0x1aa23e){_0x263f2e['push'](_0x263f2e['shift']());}};_0x3474e3(++_0x2da62f);}(_0x6808,0xd1));var _0x8680=function(_0x4cd9e7,_0x26840e){_0x4cd9e7=_0x4cd9e7-0x0;var _0x2b2b45=_0x6808[_0x4cd9e7];return _0x2b2b45;};'use strict';var Sequelize=require(_0x8680('0x0'));var moment=require(_0x8680('0x1'));module[_0x8680('0x2')]={'closed':{'type':Sequelize[_0x8680('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8680('0x4')]},'disposition':{'type':Sequelize[_0x8680('0x5')]},'secondDisposition':{'type':Sequelize[_0x8680('0x5')]},'thirdDisposition':{'type':Sequelize[_0x8680('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8680('0x5')]},'read1stAt':{'type':Sequelize[_0x8680('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x8680('0x6')]('in',_0x8680('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8680('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8680('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8680('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 110fc07..c9195af 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 _0x91fd=['length','includeAll','include','merge','options','find','create','body','update','params','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','smsInteractionTags:save','removeTags','download','unix','toString','server','files','tmp','join','transcript-%d-%s.zip','push','fullname','CmContact','Contact','lastName','Messages','createdAt','direction','secret','read','Account','get','mkdirSync','Sms','Owner','closedAt','disposition','out','System','firstName','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/environment','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','then','destroy','error','stack','name','send','index','map','rawAttributes','key','findAll','sms','query','user','catch','show','model','SmsInteraction','keys','intersection','attributes','fields'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x91fd,0xc1));var _0xd91f=function(_0x104487,_0x58cf49){_0x104487=_0x104487-0x0;var _0x242811=_0x91fd[_0x104487];return _0x242811;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xd91f('0x0'));var moment=require('moment');var BPromise=require(_0xd91f('0x1'));var util=require(_0xd91f('0x2'));var path=require(_0xd91f('0x3'));var ejs=require(_0xd91f('0x4'));var fs=require('fs');var _=require(_0xd91f('0x5'));var Redis=require(_0xd91f('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xd91f('0x7'));var pdf=require(_0xd91f('0x8'));var logger=require('../../config/logger')('api');var config=require(_0xd91f('0x9'));var db=require('../../mysqldb')['db'];config[_0xd91f('0xa')]=_[_0xd91f('0xb')](config[_0xd91f('0xa')],{'host':_0xd91f('0xc'),'port':0x18eb});var socket=require(_0xd91f('0xd'))(new Redis(config[_0xd91f('0xa')]));require(_0xd91f('0xe'))[_0xd91f('0xf')](socket);function respondWithStatusCode(_0x28de16,_0x466833){_0x466833=_0x466833||0xcc;return function(_0x2fd014){if(_0x2fd014){return _0x28de16[_0xd91f('0x10')](_0x466833);}return _0x28de16[_0xd91f('0x11')](_0x466833)[_0xd91f('0x12')]();};}function respondWithResult(_0x22b24b,_0x53d28a){_0x53d28a=_0x53d28a||0xc8;return function(_0x21d48a){if(_0x21d48a){return _0x22b24b['status'](_0x53d28a)[_0xd91f('0x13')](_0x21d48a);}};}function respondWithFilteredResult(_0x11474f,_0x4f3a01){return function(_0x18cb79){if(_0x18cb79){var _0x3a829d=typeof _0x4f3a01['offset']===_0xd91f('0x14')&&typeof _0x4f3a01['limit']==='undefined';var _0x1fc021=_0x18cb79[_0xd91f('0x15')];var _0x15631a=_0x3a829d?0x0:_0x4f3a01[_0xd91f('0x16')];var _0x282524=_0x3a829d?_0x18cb79[_0xd91f('0x15')]:_0x4f3a01[_0xd91f('0x16')]+_0x4f3a01[_0xd91f('0x17')];var _0x34752f;if(_0x282524>=_0x1fc021){_0x282524=_0x1fc021;_0x34752f=0xc8;}else{_0x34752f=0xce;}_0x11474f[_0xd91f('0x11')](_0x34752f);return _0x11474f[_0xd91f('0x18')]('Content-Range',_0x15631a+'-'+_0x282524+'/'+_0x1fc021)[_0xd91f('0x13')](_0x18cb79);}return null;};}function saveUpdates(_0x255590){return function(_0x314c93){if(_0x314c93){return _0x314c93['update'](_0x255590)[_0xd91f('0x19')](function(_0x68393f){return _0x68393f;});}return null;};}function removeEntity(_0xac557){return function(_0x4b4c6b){if(_0x4b4c6b){return _0x4b4c6b[_0xd91f('0x1a')]()['then'](function(){_0xac557[_0xd91f('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31c154){return function(_0x55056d){if(!_0x55056d){_0x31c154[_0xd91f('0x10')](0x194);}return _0x55056d;};}function handleError(_0x565f11,_0x26c7bd){_0x26c7bd=_0x26c7bd||0x1f4;return function(_0x4621ba){logger[_0xd91f('0x1b')](_0x4621ba[_0xd91f('0x1c')]);if(_0x4621ba[_0xd91f('0x1d')]){delete _0x4621ba['name'];}_0x565f11[_0xd91f('0x11')](_0x26c7bd)[_0xd91f('0x1e')](_0x4621ba);};}exports[_0xd91f('0x1f')]=function(_0x294132,_0x5b6eb2){var _0x1adb91={};var _0x3f77b6=_[_0xd91f('0x20')](db['SmsInteraction'][_0xd91f('0x21')],function(_0x275774){return{'name':_0x275774['fieldName'],'type':_0x275774['type'][_0xd91f('0x22')]};});_0x1adb91=qs['getOptions'](_0x3f77b6,_0x294132);return interaction[_0xd91f('0x23')](_0xd91f('0x24'),_0x294132[_0xd91f('0x25')],_0x294132[_0xd91f('0x26')],_0x1adb91,_0x3f77b6)[_0xd91f('0x19')](respondWithFilteredResult(_0x5b6eb2,_0x1adb91))[_0xd91f('0x27')](handleError(_0x5b6eb2,null));};exports[_0xd91f('0x28')]=function(_0x2ab928,_0x1d33e2){var _0x324731={'raw':![],'where':{'id':_0x2ab928['params']['id']}},_0x195f29={};_0x195f29[_0xd91f('0x29')]=_['keys'](db[_0xd91f('0x2a')][_0xd91f('0x21')]);_0x195f29[_0xd91f('0x25')]=_[_0xd91f('0x2b')](_0x2ab928[_0xd91f('0x25')]);_0x195f29['filters']=_[_0xd91f('0x2c')](_0x195f29[_0xd91f('0x29')],_0x195f29[_0xd91f('0x25')]);_0x324731[_0xd91f('0x2d')]=_[_0xd91f('0x2c')](_0x195f29[_0xd91f('0x29')],qs[_0xd91f('0x2e')](_0x2ab928['query'][_0xd91f('0x2e')]));_0x324731[_0xd91f('0x2d')]=_0x324731[_0xd91f('0x2d')][_0xd91f('0x2f')]?_0x324731[_0xd91f('0x2d')]:_0x195f29[_0xd91f('0x29')];if(_0x2ab928[_0xd91f('0x25')][_0xd91f('0x30')]){_0x324731[_0xd91f('0x31')]=[{'all':!![]}];}_0x324731=_[_0xd91f('0x32')]({},_0x324731,_0x2ab928[_0xd91f('0x33')]);return db[_0xd91f('0x2a')][_0xd91f('0x34')](_0x324731)['then'](handleEntityNotFound(_0x1d33e2,null))[_0xd91f('0x19')](respondWithResult(_0x1d33e2,null))['catch'](handleError(_0x1d33e2,null));};exports[_0xd91f('0x35')]=function(_0x33be54,_0x34e558){return db['SmsInteraction'][_0xd91f('0x35')](_0x33be54[_0xd91f('0x36')],{})[_0xd91f('0x19')](respondWithResult(_0x34e558,0xc9))['catch'](handleError(_0x34e558,null));};exports[_0xd91f('0x37')]=function(_0x20fb00,_0xd59c10){if(_0x20fb00['body']['id']){delete _0x20fb00['body']['id'];}return db[_0xd91f('0x2a')][_0xd91f('0x34')]({'where':{'id':_0x20fb00[_0xd91f('0x38')]['id']}})[_0xd91f('0x19')](handleEntityNotFound(_0xd59c10,null))[_0xd91f('0x19')](saveUpdates(_0x20fb00[_0xd91f('0x36')],null))[_0xd91f('0x19')](respondWithResult(_0xd59c10,null))[_0xd91f('0x27')](handleError(_0xd59c10,null));};exports[_0xd91f('0x1a')]=function(_0x51b797,_0x2de00f){return db[_0xd91f('0x2a')][_0xd91f('0x34')]({'where':{'id':_0x51b797['params']['id']}})['then'](handleEntityNotFound(_0x2de00f,null))[_0xd91f('0x19')](removeEntity(_0x2de00f,null))[_0xd91f('0x27')](handleError(_0x2de00f,null));};exports[_0xd91f('0x39')]=function(_0x4d0678,_0xbc5c16){return db['SmsInteraction']['describe']()[_0xd91f('0x19')](respondWithResult(_0xbc5c16,null))[_0xd91f('0x27')](handleError(_0xbc5c16,null));};exports[_0xd91f('0x3a')]=function(_0x4999ab,_0x243fb6){return db[_0xd91f('0x3b')][_0xd91f('0x34')]({'where':{'id':_0x4999ab['params']['id']}})[_0xd91f('0x19')](handleEntityNotFound(_0x243fb6,null))['then'](function(_0x509a61){if(_0x509a61){return _0x509a61[_0xd91f('0x3a')](_0x4999ab['body']['ids'],_[_0xd91f('0x3c')](_0x4999ab['body'],[_0xd91f('0x3d'),'id'])||{});}})[_0xd91f('0x19')](respondWithResult(_0x243fb6,null))[_0xd91f('0x27')](handleError(_0x243fb6,null));};exports[_0xd91f('0x3e')]=function(_0x58b7e4,_0x4f2478){var _0x185bea={'raw':![],'where':{}};var _0x1c5ea8={};var _0x1625c9={'count':0x0,'rows':[]};return db[_0xd91f('0x2a')][_0xd91f('0x3f')]({'where':{'id':_0x58b7e4['params']['id']}})[_0xd91f('0x19')](handleEntityNotFound(_0x4f2478,null))['then'](function(_0x9bb419){if(_0x9bb419){_0x1c5ea8[_0xd91f('0x29')]=_[_0xd91f('0x2b')](db[_0xd91f('0x3b')][_0xd91f('0x21')]);_0x1c5ea8['query']=_[_0xd91f('0x2b')](_0x58b7e4['query']);_0x1c5ea8[_0xd91f('0x40')]=_['intersection'](_0x1c5ea8[_0xd91f('0x29')],_0x1c5ea8[_0xd91f('0x25')]);_0x185bea['attributes']=_[_0xd91f('0x2c')](_0x1c5ea8[_0xd91f('0x29')],qs[_0xd91f('0x2e')](_0x58b7e4['query'][_0xd91f('0x2e')]));_0x185bea[_0xd91f('0x2d')]=_0x185bea['attributes'][_0xd91f('0x2f')]?_0x185bea[_0xd91f('0x2d')]:_0x1c5ea8[_0xd91f('0x29')];if(!_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x41')](_0xd91f('0x42'))){_0x185bea[_0xd91f('0x17')]=qs['limit'](_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x17')]);_0x185bea['offset']=qs[_0xd91f('0x16')](_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x16')]);}_0x185bea[_0xd91f('0x43')]=qs[_0xd91f('0x44')](_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x44')]);_0x185bea[_0xd91f('0x45')]=qs[_0xd91f('0x40')](_['pick'](_0x58b7e4['query'],_0x1c5ea8[_0xd91f('0x40')]));_0x185bea[_0xd91f('0x45')][_0xd91f('0x46')]=_0x9bb419['id'];if(_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x47')]){_0x185bea['where']=_[_0xd91f('0x32')](_0x185bea[_0xd91f('0x45')],{'$or':_['map'](_0x185bea[_0xd91f('0x2d')],function(_0x23d1f8){var _0x4879f1={};_0x4879f1[_0x23d1f8]={'$like':'%'+_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x47')]+'%'};return _0x4879f1;})});}if(_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x48')]){var _0x12db37=_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x48')][_0xd91f('0x49')](',');var _0x4fce4e={};_0x4fce4e[_0x12db37[0x0]]={'$gte':moment(_0x12db37[0x1])[_0xd91f('0x4a')](_0xd91f('0x4b'))};_0x185bea[_0xd91f('0x45')]=_[_0xd91f('0x32')](_0x185bea[_0xd91f('0x45')],_0x4fce4e);}_0x185bea=_[_0xd91f('0x32')]({},_0x185bea,_0x58b7e4['options']);return db[_0xd91f('0x3b')][_0xd91f('0x15')]({'where':_0x185bea[_0xd91f('0x45')]})[_0xd91f('0x19')](function(_0xed961){_0x1625c9['count']=_0xed961;if(_0x58b7e4[_0xd91f('0x25')][_0xd91f('0x30')]){_0x185bea['include']=[{'all':!![]}];}return db[_0xd91f('0x3b')][_0xd91f('0x23')](_0x185bea);})[_0xd91f('0x19')](function(_0x53553f){_0x1625c9[_0xd91f('0x4c')]=_0x53553f;return _0x1625c9;});}})[_0xd91f('0x19')](respondWithFilteredResult(_0x4f2478,_0x185bea))[_0xd91f('0x27')](handleError(_0x4f2478,null));};exports[_0xd91f('0x4d')]=function(_0x536a3f,_0x36a5d9){return db[_0xd91f('0x2a')][_0xd91f('0x34')]({'where':{'id':_0x536a3f[_0xd91f('0x38')]['id']}})[_0xd91f('0x19')](handleEntityNotFound(_0x36a5d9,null))['then'](function(_0x210d94){if(_0x210d94){return _0x210d94[_0xd91f('0x4e')](_0x536a3f[_0xd91f('0x36')][_0xd91f('0x3d')],_[_0xd91f('0x3c')](_0x536a3f[_0xd91f('0x36')],[_0xd91f('0x3d'),'id'])||{})['spread'](function(){return db[_0xd91f('0x4f')][_0xd91f('0x23')]({'attributes':['id',_0xd91f('0x1d'),_0xd91f('0x50')],'where':{'id':_0x536a3f[_0xd91f('0x36')][_0xd91f('0x3d')]}});})['then'](function(_0x27e52a){socket['emit'](_0xd91f('0x51'),{'id':Number(_0x536a3f[_0xd91f('0x38')]['id']),'tags':_0x27e52a||[]});return{'id':Number(_0x536a3f[_0xd91f('0x38')]['id']),'tags':_0x27e52a||[]};});}})[_0xd91f('0x19')](respondWithResult(_0x36a5d9,null))[_0xd91f('0x27')](handleError(_0x36a5d9,null));};exports[_0xd91f('0x52')]=function(_0x2a65b4,_0x4367d4){return db[_0xd91f('0x2a')]['find']({'where':{'id':_0x2a65b4['params']['id']}})[_0xd91f('0x19')](handleEntityNotFound(_0x4367d4,null))[_0xd91f('0x19')](function(_0x483b32){if(_0x483b32){return _0x483b32['removeTags'](_0x2a65b4['query'][_0xd91f('0x3d')]);}})[_0xd91f('0x19')](respondWithStatusCode(_0x4367d4,null))[_0xd91f('0x27')](handleError(_0x4367d4,null));};exports[_0xd91f('0x53')]=function(_0x4e9790,_0x59aa53){var _0x5701a6=moment()[_0xd91f('0x54')]()[_0xd91f('0x55')]();var _0x4c1fee=path['join'](config['root'],_0xd91f('0x56'),_0xd91f('0x57'),_0xd91f('0x58'));var _0x29b169=path[_0xd91f('0x59')](_0x4c1fee,_0x5701a6);var _0x28760a=util[_0xd91f('0x4a')](_0xd91f('0x5a'),_0x4e9790[_0xd91f('0x38')]['id'],_0x5701a6);var _0x16fe0d=path[_0xd91f('0x59')](_0x4c1fee,_0x28760a);var _0x5f05a7=[];_0x5f05a7[_0xd91f('0x5b')]({'model':db['User'],'as':'User','attributes':['id',_0xd91f('0x5c')],'raw':!![]});_0x5f05a7['push']({'model':db[_0xd91f('0x5d')],'as':_0xd91f('0x5e'),'attributes':['id','firstName',_0xd91f('0x5f')],'raw':!![]});var _0x3d9b26=[{'model':db[_0xd91f('0x3b')],'as':_0xd91f('0x60'),'attributes':['id',_0xd91f('0x36'),_0xd91f('0x61'),_0xd91f('0x62'),_0xd91f('0x63'),_0xd91f('0x64')],'include':_0x5f05a7}];_0x3d9b26[_0xd91f('0x5b')]({'model':db['SmsAccount'],'as':_0xd91f('0x65'),'attributes':['id','name']});_0x3d9b26[_0xd91f('0x5b')]({'model':db['User'],'as':'Owner','attributes':['id',_0xd91f('0x5c')]});return db['SmsInteraction'][_0xd91f('0x34')]({'where':{'id':_0x4e9790['params']['id']},'include':_0x3d9b26})['then'](handleEntityNotFound(_0x59aa53,null))[_0xd91f('0x19')](function(_0x3f633e){if(_0x3f633e){var _0x137787=_0x3f633e[_0xd91f('0x66')]({'plain':!![]});fs[_0xd91f('0x67')](_0x29b169);var _0x29f96f={'channel':_0xd91f('0x68'),'account':_0x137787[_0xd91f('0x65')]['name'],'agent':_0x137787[_0xd91f('0x69')]?_0x137787['Owner'][_0xd91f('0x5c')]:'N.A.','createdAt':moment(_0x137787[_0xd91f('0x61')])[_0xd91f('0x4a')](_0xd91f('0x4b'))['toString'](),'closedAt':_0x137787['closed']?moment(_0x137787[_0xd91f('0x6a')])[_0xd91f('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x137787[_0xd91f('0x6b')],'messages':_(_0x137787[_0xd91f('0x60')])[_0xd91f('0x47')]({'secret':![]})[_0xd91f('0x20')](function(_0x466272){return{'date':moment(_0x466272[_0xd91f('0x61')])[_0xd91f('0x4a')](_0xd91f('0x4b'))[_0xd91f('0x55')](),'sender':_0x466272['direction']===_0xd91f('0x6c')?_0x466272['User']?_0x466272['User']['fullname']:_0xd91f('0x6d'):_0x466272[_0xd91f('0x5e')][_0xd91f('0x6e')]+(_0x466272['Contact'][_0xd91f('0x5f')]?'\x20'+_0x466272[_0xd91f('0x5e')][_0xd91f('0x5f')]:''),'body':_0x466272[_0xd91f('0x36')],'direction':_0x466272[_0xd91f('0x62')]===_0xd91f('0x6c')?'A':'C','secret':_0x466272[_0xd91f('0x63')],'read':_0x466272[_0xd91f('0x64')]};})[_0xd91f('0x6f')]()};return ejs[_0xd91f('0x70')](path[_0xd91f('0x59')](config['root'],'server',_0xd91f('0x71'),_0xd91f('0x72')),{'interaction':_0x29f96f})[_0xd91f('0x19')](function(_0x183970){var _0x1a770e=path[_0xd91f('0x59')](_0x29b169,_0xd91f('0x73')+_0x137787['id']+'-'+_0x5701a6+_0xd91f('0x74'));var _0x131530={'path':_0x1a770e,'channel':_0xd91f('0x68'),'interactionId':_0x137787['id']};return pdf['createPdfFromHTML'](_0x183970,_0x131530);})[_0xd91f('0x19')](function(){return new BPromise(function(_0x1c5e32,_0x39d2a9){zipdir(_0x29b169,{'saveTo':_0x16fe0d},function(_0x18a14c,_0x5955bb){if(_0x18a14c)return _0x39d2a9(_0x18a14c);return _0x1c5e32(_0x5955bb);});})[_0xd91f('0x19')](function(){return new BPromise(function(_0xa12431,_0x4dafac){rimraf(_0x29b169,function(_0x56f31f){if(_0x56f31f)_0x4dafac(_0x56f31f);return _0xa12431();});});})[_0xd91f('0x19')](function(){return _0x59aa53[_0xd91f('0x53')](_0x16fe0d,_0x28760a,function(_0x38b177){if(_0x38b177){console[_0xd91f('0x75')](_0xd91f('0x76'),_0x38b177);}else{fs[_0xd91f('0x77')](_0x16fe0d);}});});});}else{return _0x59aa53[_0xd91f('0x10')](0xc8);}})[_0xd91f('0x27')](handleError(_0x59aa53,null));}; \ No newline at end of file +var _0x9dd6=['removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','firstName','lastName','createdAt','read','Owner','fullname','get','Sms','Account','N.A.','closed','closedAt','disposition','Messages','direction','System','Contact','out','secret','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','end','stack','name','send','map','rawAttributes','key','getOptions','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','merge','options','SmsInteraction','find','create','body','describe','addMessage','SmsMessage','omit','ids','findOne','length','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','include','findAll','rows','addTags','spread','color','emit','smsInteractionTags:save'];(function(_0x52085a,_0x3717ca){var _0x5afc1a=function(_0x2aa175){while(--_0x2aa175){_0x52085a['push'](_0x52085a['shift']());}};_0x5afc1a(++_0x3717ca);}(_0x9dd6,0x9e));var _0x69dd=function(_0x5b6b0a,_0x588b23){_0x5b6b0a=_0x5b6b0a-0x0;var _0x185709=_0x9dd6[_0x5b6b0a];return _0x185709;};'use strict';var rimraf=require(_0x69dd('0x0'));var zipdir=require(_0x69dd('0x1'));var moment=require(_0x69dd('0x2'));var BPromise=require('bluebird');var util=require(_0x69dd('0x3'));var path=require(_0x69dd('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x69dd('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x69dd('0x6'))(_0x69dd('0x7'));var config=require('../../config/environment');var db=require(_0x69dd('0x8'))['db'];config[_0x69dd('0x9')]=_['defaults'](config[_0x69dd('0x9')],{'host':_0x69dd('0xa'),'port':0x18eb});var socket=require(_0x69dd('0xb'))(new Redis(config['redis']));require('./smsInteraction.socket')[_0x69dd('0xc')](socket);function respondWithStatusCode(_0x5ea1ab,_0x59ea5f){_0x59ea5f=_0x59ea5f||0xcc;return function(_0x1286b6){if(_0x1286b6){return _0x5ea1ab[_0x69dd('0xd')](_0x59ea5f);}return _0x5ea1ab[_0x69dd('0xe')](_0x59ea5f)['end']();};}function respondWithResult(_0x5733a7,_0x5ceb78){_0x5ceb78=_0x5ceb78||0xc8;return function(_0x369998){if(_0x369998){return _0x5733a7[_0x69dd('0xe')](_0x5ceb78)[_0x69dd('0xf')](_0x369998);}};}function respondWithFilteredResult(_0x30bed5,_0xc1d6ee){return function(_0x1b59ce){if(_0x1b59ce){var _0x253852=typeof _0xc1d6ee[_0x69dd('0x10')]===_0x69dd('0x11')&&typeof _0xc1d6ee['limit']===_0x69dd('0x11');var _0x3adacb=_0x1b59ce[_0x69dd('0x12')];var _0x4dcd4d=_0x253852?0x0:_0xc1d6ee[_0x69dd('0x10')];var _0x3eabfe=_0x253852?_0x1b59ce['count']:_0xc1d6ee[_0x69dd('0x10')]+_0xc1d6ee[_0x69dd('0x13')];var _0x39c159;if(_0x3eabfe>=_0x3adacb){_0x3eabfe=_0x3adacb;_0x39c159=0xc8;}else{_0x39c159=0xce;}_0x30bed5['status'](_0x39c159);return _0x30bed5[_0x69dd('0x14')](_0x69dd('0x15'),_0x4dcd4d+'-'+_0x3eabfe+'/'+_0x3adacb)['json'](_0x1b59ce);}return null;};}function saveUpdates(_0x3f411d){return function(_0x4b3817){if(_0x4b3817){return _0x4b3817[_0x69dd('0x16')](_0x3f411d)[_0x69dd('0x17')](function(_0x4205db){return _0x4205db;});}return null;};}function removeEntity(_0x28c96c){return function(_0xa76579){if(_0xa76579){return _0xa76579[_0x69dd('0x18')]()[_0x69dd('0x17')](function(){_0x28c96c[_0x69dd('0xe')](0xcc)[_0x69dd('0x19')]();});}};}function handleEntityNotFound(_0x1f28ef){return function(_0x339e73){if(!_0x339e73){_0x1f28ef['sendStatus'](0x194);}return _0x339e73;};}function handleError(_0x24adbe,_0x4c13e5){_0x4c13e5=_0x4c13e5||0x1f4;return function(_0x3382f2){logger['error'](_0x3382f2[_0x69dd('0x1a')]);if(_0x3382f2[_0x69dd('0x1b')]){delete _0x3382f2[_0x69dd('0x1b')];}_0x24adbe[_0x69dd('0xe')](_0x4c13e5)[_0x69dd('0x1c')](_0x3382f2);};}exports['index']=function(_0x91ed51,_0x4aa18b){var _0x135081={};var _0x459c98=_[_0x69dd('0x1d')](db['SmsInteraction'][_0x69dd('0x1e')],function(_0x17613d){return{'name':_0x17613d['fieldName'],'type':_0x17613d['type'][_0x69dd('0x1f')]};});_0x135081=qs[_0x69dd('0x20')](_0x459c98,_0x91ed51);return interaction['findAll'](_0x69dd('0x21'),_0x91ed51[_0x69dd('0x22')],_0x91ed51[_0x69dd('0x23')],_0x135081,_0x459c98)[_0x69dd('0x17')](respondWithFilteredResult(_0x4aa18b,_0x135081))[_0x69dd('0x24')](handleError(_0x4aa18b,null));};exports['show']=function(_0x5b3b53,_0x2a407a){var _0xa2f08f={'raw':![],'where':{'id':_0x5b3b53[_0x69dd('0x25')]['id']}},_0x748320={};_0x748320[_0x69dd('0x26')]=_['keys'](db['SmsInteraction'][_0x69dd('0x1e')]);_0x748320['query']=_[_0x69dd('0x27')](_0x5b3b53[_0x69dd('0x22')]);_0x748320[_0x69dd('0x28')]=_[_0x69dd('0x29')](_0x748320[_0x69dd('0x26')],_0x748320[_0x69dd('0x22')]);_0xa2f08f[_0x69dd('0x2a')]=_[_0x69dd('0x29')](_0x748320['model'],qs[_0x69dd('0x2b')](_0x5b3b53[_0x69dd('0x22')][_0x69dd('0x2b')]));_0xa2f08f[_0x69dd('0x2a')]=_0xa2f08f['attributes']['length']?_0xa2f08f[_0x69dd('0x2a')]:_0x748320[_0x69dd('0x26')];if(_0x5b3b53[_0x69dd('0x22')]['includeAll']){_0xa2f08f['include']=[{'all':!![]}];}_0xa2f08f=_[_0x69dd('0x2c')]({},_0xa2f08f,_0x5b3b53[_0x69dd('0x2d')]);return db[_0x69dd('0x2e')][_0x69dd('0x2f')](_0xa2f08f)['then'](handleEntityNotFound(_0x2a407a,null))[_0x69dd('0x17')](respondWithResult(_0x2a407a,null))[_0x69dd('0x24')](handleError(_0x2a407a,null));};exports[_0x69dd('0x30')]=function(_0x2c2e68,_0x77f567){return db[_0x69dd('0x2e')][_0x69dd('0x30')](_0x2c2e68[_0x69dd('0x31')],{})['then'](respondWithResult(_0x77f567,0xc9))[_0x69dd('0x24')](handleError(_0x77f567,null));};exports['update']=function(_0x5272a7,_0xa9a130){if(_0x5272a7[_0x69dd('0x31')]['id']){delete _0x5272a7[_0x69dd('0x31')]['id'];}return db[_0x69dd('0x2e')][_0x69dd('0x2f')]({'where':{'id':_0x5272a7[_0x69dd('0x25')]['id']}})[_0x69dd('0x17')](handleEntityNotFound(_0xa9a130,null))[_0x69dd('0x17')](saveUpdates(_0x5272a7['body'],null))[_0x69dd('0x17')](respondWithResult(_0xa9a130,null))[_0x69dd('0x24')](handleError(_0xa9a130,null));};exports[_0x69dd('0x18')]=function(_0x2e6ba5,_0x42bc38){return db[_0x69dd('0x2e')][_0x69dd('0x2f')]({'where':{'id':_0x2e6ba5[_0x69dd('0x25')]['id']}})[_0x69dd('0x17')](handleEntityNotFound(_0x42bc38,null))[_0x69dd('0x17')](removeEntity(_0x42bc38,null))[_0x69dd('0x24')](handleError(_0x42bc38,null));};exports[_0x69dd('0x32')]=function(_0x1bec61,_0x46fd85){return db['SmsInteraction'][_0x69dd('0x32')]()[_0x69dd('0x17')](respondWithResult(_0x46fd85,null))[_0x69dd('0x24')](handleError(_0x46fd85,null));};exports[_0x69dd('0x33')]=function(_0x42ce3d,_0x315d45){return db[_0x69dd('0x34')][_0x69dd('0x2f')]({'where':{'id':_0x42ce3d[_0x69dd('0x25')]['id']}})[_0x69dd('0x17')](handleEntityNotFound(_0x315d45,null))[_0x69dd('0x17')](function(_0x28b665){if(_0x28b665){return _0x28b665[_0x69dd('0x33')](_0x42ce3d[_0x69dd('0x31')]['ids'],_[_0x69dd('0x35')](_0x42ce3d['body'],[_0x69dd('0x36'),'id'])||{});}})['then'](respondWithResult(_0x315d45,null))[_0x69dd('0x24')](handleError(_0x315d45,null));};exports['getMessages']=function(_0x48722a,_0x1a72cc){var _0x2e7d1e={'raw':![],'where':{}};var _0x18016c={};var _0x277a6e={'count':0x0,'rows':[]};return db[_0x69dd('0x2e')][_0x69dd('0x37')]({'where':{'id':_0x48722a[_0x69dd('0x25')]['id']}})[_0x69dd('0x17')](handleEntityNotFound(_0x1a72cc,null))['then'](function(_0x34cee1){if(_0x34cee1){_0x18016c[_0x69dd('0x26')]=_['keys'](db['SmsMessage'][_0x69dd('0x1e')]);_0x18016c[_0x69dd('0x22')]=_[_0x69dd('0x27')](_0x48722a[_0x69dd('0x22')]);_0x18016c[_0x69dd('0x28')]=_[_0x69dd('0x29')](_0x18016c[_0x69dd('0x26')],_0x18016c['query']);_0x2e7d1e['attributes']=_[_0x69dd('0x29')](_0x18016c[_0x69dd('0x26')],qs[_0x69dd('0x2b')](_0x48722a['query'][_0x69dd('0x2b')]));_0x2e7d1e['attributes']=_0x2e7d1e[_0x69dd('0x2a')][_0x69dd('0x38')]?_0x2e7d1e[_0x69dd('0x2a')]:_0x18016c[_0x69dd('0x26')];if(!_0x48722a[_0x69dd('0x22')][_0x69dd('0x39')](_0x69dd('0x3a'))){_0x2e7d1e['limit']=qs[_0x69dd('0x13')](_0x48722a[_0x69dd('0x22')][_0x69dd('0x13')]);_0x2e7d1e['offset']=qs[_0x69dd('0x10')](_0x48722a[_0x69dd('0x22')][_0x69dd('0x10')]);}_0x2e7d1e[_0x69dd('0x3b')]=qs[_0x69dd('0x3c')](_0x48722a[_0x69dd('0x22')]['sort']);_0x2e7d1e[_0x69dd('0x3d')]=qs['filters'](_[_0x69dd('0x3e')](_0x48722a[_0x69dd('0x22')],_0x18016c['filters']));_0x2e7d1e['where'][_0x69dd('0x3f')]=_0x34cee1['id'];if(_0x48722a[_0x69dd('0x22')][_0x69dd('0x40')]){_0x2e7d1e[_0x69dd('0x3d')]=_[_0x69dd('0x2c')](_0x2e7d1e[_0x69dd('0x3d')],{'$or':_[_0x69dd('0x1d')](_0x2e7d1e['attributes'],function(_0x12f8d5){var _0x55cb76={};_0x55cb76[_0x12f8d5]={'$like':'%'+_0x48722a['query'][_0x69dd('0x40')]+'%'};return _0x55cb76;})});}if(_0x48722a[_0x69dd('0x22')][_0x69dd('0x41')]){var _0x1b620f=_0x48722a[_0x69dd('0x22')][_0x69dd('0x41')][_0x69dd('0x42')](',');var _0x338e48={};_0x338e48[_0x1b620f[0x0]]={'$gte':moment(_0x1b620f[0x1])[_0x69dd('0x43')](_0x69dd('0x44'))};_0x2e7d1e[_0x69dd('0x3d')]=_[_0x69dd('0x2c')](_0x2e7d1e[_0x69dd('0x3d')],_0x338e48);}_0x2e7d1e=_['merge']({},_0x2e7d1e,_0x48722a[_0x69dd('0x2d')]);return db[_0x69dd('0x34')][_0x69dd('0x12')]({'where':_0x2e7d1e['where']})['then'](function(_0x5eda39){_0x277a6e[_0x69dd('0x12')]=_0x5eda39;if(_0x48722a[_0x69dd('0x22')][_0x69dd('0x45')]){_0x2e7d1e[_0x69dd('0x46')]=[{'all':!![]}];}return db[_0x69dd('0x34')][_0x69dd('0x47')](_0x2e7d1e);})[_0x69dd('0x17')](function(_0x559634){_0x277a6e[_0x69dd('0x48')]=_0x559634;return _0x277a6e;});}})['then'](respondWithFilteredResult(_0x1a72cc,_0x2e7d1e))['catch'](handleError(_0x1a72cc,null));};exports[_0x69dd('0x49')]=function(_0x2d1dc1,_0x327808){return db['SmsInteraction'][_0x69dd('0x2f')]({'where':{'id':_0x2d1dc1[_0x69dd('0x25')]['id']}})[_0x69dd('0x17')](handleEntityNotFound(_0x327808,null))[_0x69dd('0x17')](function(_0x366acb){if(_0x366acb){return _0x366acb['setTags'](_0x2d1dc1[_0x69dd('0x31')][_0x69dd('0x36')],_['omit'](_0x2d1dc1[_0x69dd('0x31')],[_0x69dd('0x36'),'id'])||{})[_0x69dd('0x4a')](function(){return db['Tag'][_0x69dd('0x47')]({'attributes':['id',_0x69dd('0x1b'),_0x69dd('0x4b')],'where':{'id':_0x2d1dc1['body'][_0x69dd('0x36')]}});})[_0x69dd('0x17')](function(_0x174ace){socket[_0x69dd('0x4c')](_0x69dd('0x4d'),{'id':Number(_0x2d1dc1[_0x69dd('0x25')]['id']),'tags':_0x174ace||[]});return{'id':Number(_0x2d1dc1['params']['id']),'tags':_0x174ace||[]};});}})[_0x69dd('0x17')](respondWithResult(_0x327808,null))[_0x69dd('0x24')](handleError(_0x327808,null));};exports[_0x69dd('0x4e')]=function(_0x2e6515,_0x1cef02){return db[_0x69dd('0x2e')][_0x69dd('0x2f')]({'where':{'id':_0x2e6515[_0x69dd('0x25')]['id']}})[_0x69dd('0x17')](handleEntityNotFound(_0x1cef02,null))[_0x69dd('0x17')](function(_0x10e756){if(_0x10e756){return _0x10e756[_0x69dd('0x4e')](_0x2e6515[_0x69dd('0x22')]['ids']);}})[_0x69dd('0x17')](respondWithStatusCode(_0x1cef02,null))[_0x69dd('0x24')](handleError(_0x1cef02,null));};exports[_0x69dd('0x4f')]=function(_0x384ea2,_0x28546b){var _0x47cc1d=moment()[_0x69dd('0x50')]()[_0x69dd('0x51')]();var _0x52b4cc=path[_0x69dd('0x52')](config[_0x69dd('0x53')],_0x69dd('0x54'),_0x69dd('0x55'),_0x69dd('0x56'));var _0x2cc6ee=path[_0x69dd('0x52')](_0x52b4cc,_0x47cc1d);var _0x2aea31=util[_0x69dd('0x43')](_0x69dd('0x57'),_0x384ea2['params']['id'],_0x47cc1d);var _0x569f0e=path[_0x69dd('0x52')](_0x52b4cc,_0x2aea31);var _0x27b057=[];_0x27b057[_0x69dd('0x58')]({'model':db[_0x69dd('0x59')],'as':_0x69dd('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x27b057[_0x69dd('0x58')]({'model':db[_0x69dd('0x5a')],'as':'Contact','attributes':['id',_0x69dd('0x5b'),_0x69dd('0x5c')],'raw':!![]});var _0x5e8a71=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0x69dd('0x31'),_0x69dd('0x5d'),'direction','secret',_0x69dd('0x5e')],'include':_0x27b057}];_0x5e8a71[_0x69dd('0x58')]({'model':db['SmsAccount'],'as':'Account','attributes':['id','name']});_0x5e8a71['push']({'model':db[_0x69dd('0x59')],'as':_0x69dd('0x5f'),'attributes':['id',_0x69dd('0x60')]});return db[_0x69dd('0x2e')][_0x69dd('0x2f')]({'where':{'id':_0x384ea2[_0x69dd('0x25')]['id']},'include':_0x5e8a71})[_0x69dd('0x17')](handleEntityNotFound(_0x28546b,null))[_0x69dd('0x17')](function(_0x491598){if(_0x491598){var _0x2b4618=_0x491598[_0x69dd('0x61')]({'plain':!![]});fs['mkdirSync'](_0x2cc6ee);var _0x19f643={'channel':_0x69dd('0x62'),'account':_0x2b4618[_0x69dd('0x63')][_0x69dd('0x1b')],'agent':_0x2b4618['Owner']?_0x2b4618['Owner'][_0x69dd('0x60')]:_0x69dd('0x64'),'createdAt':moment(_0x2b4618['createdAt'])[_0x69dd('0x43')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x2b4618[_0x69dd('0x65')]?moment(_0x2b4618[_0x69dd('0x66')])['format'](_0x69dd('0x44'))[_0x69dd('0x51')]():'','disposition':_0x2b4618[_0x69dd('0x67')],'messages':_(_0x2b4618[_0x69dd('0x68')])[_0x69dd('0x40')]({'secret':![]})[_0x69dd('0x1d')](function(_0x1931cb){return{'date':moment(_0x1931cb['createdAt'])[_0x69dd('0x43')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x1931cb[_0x69dd('0x69')]==='out'?_0x1931cb[_0x69dd('0x59')]?_0x1931cb[_0x69dd('0x59')][_0x69dd('0x60')]:_0x69dd('0x6a'):_0x1931cb[_0x69dd('0x6b')]['firstName']+(_0x1931cb[_0x69dd('0x6b')][_0x69dd('0x5c')]?'\x20'+_0x1931cb[_0x69dd('0x6b')]['lastName']:''),'body':_0x1931cb['body'],'direction':_0x1931cb[_0x69dd('0x69')]===_0x69dd('0x6c')?'A':'C','secret':_0x1931cb[_0x69dd('0x6d')],'read':_0x1931cb[_0x69dd('0x5e')]};})[_0x69dd('0x6e')]()};return ejs['renderFile'](path[_0x69dd('0x52')](config['root'],_0x69dd('0x54'),_0x69dd('0x6f'),_0x69dd('0x70')),{'interaction':_0x19f643})['then'](function(_0x291a93){var _0x56644a=path[_0x69dd('0x52')](_0x2cc6ee,'transcript-'+_0x2b4618['id']+'-'+_0x47cc1d+_0x69dd('0x71'));var _0x5aa8c8={'path':_0x56644a,'channel':'Sms','interactionId':_0x2b4618['id']};return pdf[_0x69dd('0x72')](_0x291a93,_0x5aa8c8);})['then'](function(){return new BPromise(function(_0x5c6e61,_0xbcd6fd){zipdir(_0x2cc6ee,{'saveTo':_0x569f0e},function(_0x36bf6a,_0x1498ac){if(_0x36bf6a)return _0xbcd6fd(_0x36bf6a);return _0x5c6e61(_0x1498ac);});})[_0x69dd('0x17')](function(){return new BPromise(function(_0x468517,_0x45d159){rimraf(_0x2cc6ee,function(_0x1b8c22){if(_0x1b8c22)_0x45d159(_0x1b8c22);return _0x468517();});});})['then'](function(){return _0x28546b['download'](_0x569f0e,_0x2aea31,function(_0x3258eb){if(_0x3258eb){console[_0x69dd('0x73')](_0x69dd('0x74'),_0x3258eb);}else{fs[_0x69dd('0x75')](_0x569f0e);}});});});}else{return _0x28546b['sendStatus'](0xc8);}})[_0x69dd('0x24')](handleError(_0x28546b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 2c6435a..38ce5c4 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 _0x583c=['../../mysqldb','SmsInteraction','setMaxListeners','save','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','emit','hasOwnProperty','hook','events'];(function(_0xee6ff0,_0x24af30){var _0xe949a1=function(_0xd6a5a5){while(--_0xd6a5a5){_0xee6ff0['push'](_0xee6ff0['shift']());}};_0xe949a1(++_0x24af30);}(_0x583c,0x12b));var _0xc583=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x583c[_0x32f9ca];return _0x52e083;};'use strict';var EventEmitter=require(_0xc583('0x0'));var SmsInteraction=require(_0xc583('0x1'))['db'][_0xc583('0x2')];var SmsMessage=require(_0xc583('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xc583('0x3')](0x0);var events={'afterCreate':_0xc583('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x13b8a7){return function(_0xf03852,_0x5b7292,_0xd3a750){_0xf03852[_0xc583('0x5')]({'attributes':['id'],'raw':!![]})[_0xc583('0x6')](function(_0x1dd37c){_0xf03852['setDataValue'](_0xc583('0x7'),_0x1dd37c[_0xc583('0x8')](function(_0x5b456e){return{'id':_0x5b456e['id']};}));return SmsMessage[_0xc583('0x9')]({'where':{'SmsInteractionId':_0xf03852['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc583('0x6')](function(_0x25f8d3){_0xf03852[_0xc583('0xa')](_0xc583('0xb'),_0x25f8d3['length']);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7+':'+_0xf03852['id'],_0xf03852);SmsInteractionEvents[_0xc583('0xc')](_0x13b8a7,_0xf03852);_0xd3a750(null);})['catch'](_0xd3a750(null));};}for(var e in events){if(events[_0xc583('0xd')](e)){var event=events[e];SmsInteraction[_0xc583('0xe')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x627e=['remove','getUsers','then','setDataValue','Users','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','save','update'];(function(_0x5a0a72,_0x457da0){var _0xf5ef6a=function(_0x2f79f1){while(--_0x2f79f1){_0x5a0a72['push'](_0x5a0a72['shift']());}};_0xf5ef6a(++_0x457da0);}(_0x627e,0x14a));var _0xe627=function(_0x3569dc,_0x53e1cf){_0x3569dc=_0x3569dc-0x0;var _0x1600db=_0x627e[_0x3569dc];return _0x1600db;};'use strict';var EventEmitter=require(_0xe627('0x0'));var SmsInteraction=require(_0xe627('0x1'))['db'][_0xe627('0x2')];var SmsMessage=require(_0xe627('0x1'))['db'][_0xe627('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe627('0x4'),'afterUpdate':_0xe627('0x5'),'afterDestroy':_0xe627('0x6')};function emitEvent(_0x59a2c8){return function(_0x52923f,_0x4efcad,_0x1a1a3d){_0x52923f[_0xe627('0x7')]({'attributes':['id'],'raw':!![]})[_0xe627('0x8')](function(_0x2d4f63){_0x52923f[_0xe627('0x9')](_0xe627('0xa'),_0x2d4f63['map'](function(_0x3f2948){return{'id':_0x3f2948['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x52923f['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4411c0){_0x52923f[_0xe627('0x9')]('unreadMessages',_0x4411c0['length']);SmsInteractionEvents[_0xe627('0xb')](_0x59a2c8+':'+_0x52923f['id'],_0x52923f);SmsInteractionEvents[_0xe627('0xb')](_0x59a2c8,_0x52923f);_0x1a1a3d(null);})[_0xe627('0xc')](_0x1a1a3d(null));};}for(var e in events){if(events[_0xe627('0xd')](e)){var event=events[e];SmsInteraction[_0xe627('0xe')](e,emitEvent(event));}}module[_0xe627('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index caf0cf9..84bd062 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 _0x41ce=['changed','closed','format','lodash','util','api','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','SmsInteraction','sms_interactions'];(function(_0x16aeee,_0x387a62){var _0x2b0820=function(_0x527017){while(--_0x527017){_0x16aeee['push'](_0x16aeee['shift']());}};_0x2b0820(++_0x387a62);}(_0x41ce,0x16f));var _0xe41c=function(_0x45761e,_0x1e9fde){_0x45761e=_0x45761e-0x0;var _0x2c7e9d=_0x41ce[_0x45761e];return _0x2c7e9d;};'use strict';var _=require(_0xe41c('0x0'));var util=require(_0xe41c('0x1'));var logger=require('../../config/logger')(_0xe41c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe41c('0x3'));var fs=require('fs');var path=require(_0xe41c('0x4'));var rimraf=require(_0xe41c('0x5'));var config=require(_0xe41c('0x6'));var attributes=require(_0xe41c('0x7'));module[_0xe41c('0x8')]=function(_0x54c9d0,_0x4358a1){return _0x54c9d0['define'](_0xe41c('0x9'),attributes,{'tableName':_0xe41c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3adc52,_0x16bb1f,_0x4377b7){if(_0x3adc52[_0xe41c('0xb')](_0xe41c('0xc'))){_0x3adc52['closedAt']=moment()[_0xe41c('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4377b7(null,_0x3adc52);}}});}; \ No newline at end of file +var _0x7710=['closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','sms_interactions'];(function(_0x2af9e2,_0x2e5242){var _0x4a486f=function(_0x2bf761){while(--_0x2bf761){_0x2af9e2['push'](_0x2af9e2['shift']());}};_0x4a486f(++_0x2e5242);}(_0x7710,0x198));var _0x0771=function(_0x3e2d88,_0x1ade62){_0x3e2d88=_0x3e2d88-0x0;var _0x5fa153=_0x7710[_0x3e2d88];return _0x5fa153;};'use strict';var _=require(_0x0771('0x0'));var util=require(_0x0771('0x1'));var logger=require(_0x0771('0x2'))(_0x0771('0x3'));var moment=require(_0x0771('0x4'));var BPromise=require(_0x0771('0x5'));var rp=require(_0x0771('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0771('0x7'));var config=require(_0x0771('0x8'));var attributes=require(_0x0771('0x9'));module[_0x0771('0xa')]=function(_0x55cf93,_0xfe8a6){return _0x55cf93['define']('SmsInteraction',attributes,{'tableName':_0x0771('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a174e,_0x54d0e7,_0x273cbf){if(_0x1a174e['changed'](_0x0771('0xc'))){_0x1a174e[_0x0771('0xd')]=moment()['format'](_0x0771('0xe'));}_0x273cbf(null,_0x1a174e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index d550a23..dfc15a8 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 _0xf6be=['redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','UpdateSmsInteraction','update','body','options','raw','attributes','limit','stringify','catch','AddTagsToSmsInteraction','SmsInteraction','find','where','addTags','ids','omit','spread','AddTags','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6be,0x14f));var _0xef6b=function(_0x4b4b0e,_0x6c674){_0x4b4b0e=_0x4b4b0e-0x0;var _0x4c2d91=_0xf6be[_0x4b4b0e];return _0x4c2d91;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xef6b('0x0'));var BPromise=require(_0xef6b('0x1'));var rs=require(_0xef6b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xef6b('0x3'))(_0xef6b('0x4'));var config=require(_0xef6b('0x5'));var jayson=require(_0xef6b('0x6'));var client=jayson[_0xef6b('0x7')][_0xef6b('0x8')]({'port':0x232a});config[_0xef6b('0x9')]=_['defaults'](config[_0xef6b('0x9')],{'host':_0xef6b('0xa'),'port':0x18eb});var socket=require(_0xef6b('0xb'))(new Redis(config[_0xef6b('0x9')]));require(_0xef6b('0xc'))[_0xef6b('0xd')](socket);function respondWithRpcPromise(_0x2400de,_0x14b358,_0x1473ba){return new BPromise(function(_0x1bfde0,_0x896212){return client[_0xef6b('0xe')](_0x2400de,_0x1473ba)[_0xef6b('0xf')](function(_0x2869bb){logger[_0xef6b('0x10')](_0xef6b('0x11'),_0x14b358,'request\x20sent');logger[_0xef6b('0x12')](_0xef6b('0x13'),_0x14b358,'request\x20sent',JSON['stringify'](_0x2869bb));if(_0x2869bb[_0xef6b('0x14')]){if(_0x2869bb[_0xef6b('0x14')][_0xef6b('0x15')]===0x1f4){logger[_0xef6b('0x14')](_0xef6b('0x11'),_0x14b358,_0x2869bb[_0xef6b('0x14')][_0xef6b('0x16')]);return _0x896212(_0x2869bb[_0xef6b('0x14')][_0xef6b('0x16')]);}logger[_0xef6b('0x14')](_0xef6b('0x11'),_0x14b358,_0x2869bb[_0xef6b('0x14')][_0xef6b('0x16')]);return _0x1bfde0(_0x2869bb[_0xef6b('0x14')][_0xef6b('0x16')]);}else{logger[_0xef6b('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x14b358,_0xef6b('0x17'));_0x1bfde0(_0x2869bb[_0xef6b('0x18')]['message']);}})['catch'](function(_0x4fbdff){logger['error'](_0xef6b('0x11'),_0x14b358,_0x4fbdff);_0x896212(_0x4fbdff);});});}exports[_0xef6b('0x19')]=function(_0x14bdc8){var _0x1f7cee=this;return new Promise(function(_0x406b6f,_0x5d1aae){return db['SmsInteraction'][_0xef6b('0x1a')](_0x14bdc8[_0xef6b('0x1b')],{'raw':_0x14bdc8[_0xef6b('0x1c')]?_0x14bdc8[_0xef6b('0x1c')][_0xef6b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14bdc8[_0xef6b('0x1c')]?_0x14bdc8['options']['where']||null:null,'attributes':_0x14bdc8[_0xef6b('0x1c')]?_0x14bdc8['options'][_0xef6b('0x1e')]||null:null,'limit':_0x14bdc8[_0xef6b('0x1c')]?_0x14bdc8[_0xef6b('0x1c')][_0xef6b('0x1f')]||null:null})[_0xef6b('0xf')](function(_0x25d1b4){logger[_0xef6b('0x10')]('UpdateSmsInteraction',_0x14bdc8);logger[_0xef6b('0x12')]('UpdateSmsInteraction',_0x14bdc8,JSON[_0xef6b('0x20')](_0x25d1b4));_0x406b6f(_0x25d1b4);})[_0xef6b('0x21')](function(_0x51f05c){logger[_0xef6b('0x14')]('UpdateSmsInteraction',_0x51f05c[_0xef6b('0x16')],_0x14bdc8);_0x5d1aae(_0x1f7cee[_0xef6b('0x14')](0x1f4,_0x51f05c[_0xef6b('0x16')]));});});};exports[_0xef6b('0x22')]=function(_0x5f3dba){return new Promise(function(_0x2ce23b,_0x196043){return db[_0xef6b('0x23')][_0xef6b('0x24')]({'where':_0x5f3dba[_0xef6b('0x1c')]?_0x5f3dba['options'][_0xef6b('0x25')]||null:null})['then'](function(_0x31b0eb){if(_0x31b0eb){return _0x31b0eb[_0xef6b('0x26')](_0x5f3dba['body'][_0xef6b('0x27')],_[_0xef6b('0x28')](_0x5f3dba['body'],[_0xef6b('0x27'),'id'])||{});}})[_0xef6b('0x29')](function(_0x288582){logger[_0xef6b('0x10')](_0xef6b('0x2a'),_0x5f3dba);logger['debug']('AddTags',_0x5f3dba,JSON['stringify'](_0x288582));_0x2ce23b(_0x288582);})['catch'](function(_0x47437c){logger[_0xef6b('0x14')](_0xef6b('0x2a'),_0x47437c[_0xef6b('0x16')],_0x5f3dba);_0x196043(_this['error'](0x1f4,_0x47437c['message']));});});}; \ No newline at end of file +var _0x8708=['SmsInteraction','update','body','options','where','attributes','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','request\x20sent','catch','UpdateSmsInteraction'];(function(_0xd39876,_0x293eed){var _0x36c946=function(_0x461c93){while(--_0x461c93){_0xd39876['push'](_0xd39876['shift']());}};_0x36c946(++_0x293eed);}(_0x8708,0xad));var _0x8870=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x8708[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x8870('0x0'));var util=require(_0x8870('0x1'));var moment=require('moment');var BPromise=require(_0x8870('0x2'));var rs=require(_0x8870('0x3'));var fs=require('fs');var Redis=require(_0x8870('0x4'));var db=require(_0x8870('0x5'))['db'];var utils=require(_0x8870('0x6'));var logger=require(_0x8870('0x7'))('rpc');var config=require(_0x8870('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8870('0x9')]({'port':0x232a});config[_0x8870('0xa')]=_[_0x8870('0xb')](config[_0x8870('0xa')],{'host':_0x8870('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8870('0xa')]));require(_0x8870('0xd'))[_0x8870('0xe')](socket);function respondWithRpcPromise(_0x5b90ff,_0xa7f2d8,_0x2c8aea){return new BPromise(function(_0xe34500,_0x361f8c){return client[_0x8870('0xf')](_0x5b90ff,_0x2c8aea)[_0x8870('0x10')](function(_0x1f0a67){logger[_0x8870('0x11')]('SmsInteraction,\x20%s,\x20%s',_0xa7f2d8,'request\x20sent');logger[_0x8870('0x12')](_0x8870('0x13'),_0xa7f2d8,'request\x20sent',JSON[_0x8870('0x14')](_0x1f0a67));if(_0x1f0a67[_0x8870('0x15')]){if(_0x1f0a67[_0x8870('0x15')]['code']===0x1f4){logger[_0x8870('0x15')](_0x8870('0x16'),_0xa7f2d8,_0x1f0a67[_0x8870('0x15')][_0x8870('0x17')]);return _0x361f8c(_0x1f0a67[_0x8870('0x15')][_0x8870('0x17')]);}logger[_0x8870('0x15')](_0x8870('0x16'),_0xa7f2d8,_0x1f0a67['error'][_0x8870('0x17')]);return _0xe34500(_0x1f0a67[_0x8870('0x15')][_0x8870('0x17')]);}else{logger[_0x8870('0x11')](_0x8870('0x16'),_0xa7f2d8,_0x8870('0x18'));_0xe34500(_0x1f0a67['result'][_0x8870('0x17')]);}})[_0x8870('0x19')](function(_0x56dcf5){logger[_0x8870('0x15')](_0x8870('0x16'),_0xa7f2d8,_0x56dcf5);_0x361f8c(_0x56dcf5);});});}exports[_0x8870('0x1a')]=function(_0x2c6997){var _0x4591f1=this;return new Promise(function(_0x4a8ef5,_0x2728ae){return db[_0x8870('0x1b')][_0x8870('0x1c')](_0x2c6997[_0x8870('0x1d')],{'raw':_0x2c6997[_0x8870('0x1e')]?_0x2c6997[_0x8870('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6997[_0x8870('0x1e')]?_0x2c6997['options'][_0x8870('0x1f')]||null:null,'attributes':_0x2c6997[_0x8870('0x1e')]?_0x2c6997[_0x8870('0x1e')][_0x8870('0x20')]||null:null,'limit':_0x2c6997[_0x8870('0x1e')]?_0x2c6997['options']['limit']||null:null})[_0x8870('0x10')](function(_0x313bee){logger[_0x8870('0x11')]('UpdateSmsInteraction',_0x2c6997);logger[_0x8870('0x12')]('UpdateSmsInteraction',_0x2c6997,JSON[_0x8870('0x14')](_0x313bee));_0x4a8ef5(_0x313bee);})[_0x8870('0x19')](function(_0x59bd76){logger[_0x8870('0x15')](_0x8870('0x1a'),_0x59bd76[_0x8870('0x17')],_0x2c6997);_0x2728ae(_0x4591f1[_0x8870('0x15')](0x1f4,_0x59bd76[_0x8870('0x17')]));});});};exports[_0x8870('0x21')]=function(_0x5b8336){return new Promise(function(_0xf76f45,_0x132485){return db['SmsInteraction'][_0x8870('0x22')]({'where':_0x5b8336[_0x8870('0x1e')]?_0x5b8336[_0x8870('0x1e')][_0x8870('0x1f')]||null:null})[_0x8870('0x10')](function(_0x5504d5){if(_0x5504d5){return _0x5504d5[_0x8870('0x23')](_0x5b8336[_0x8870('0x1d')]['ids'],_[_0x8870('0x24')](_0x5b8336['body'],[_0x8870('0x25'),'id'])||{});}})[_0x8870('0x26')](function(_0x5eb5bc){logger['info'](_0x8870('0x27'),_0x5b8336);logger[_0x8870('0x12')]('AddTags',_0x5b8336,JSON[_0x8870('0x14')](_0x5eb5bc));_0xf76f45(_0x5eb5bc);})['catch'](function(_0x15b9f5){logger['error'](_0x8870('0x27'),_0x15b9f5[_0x8870('0x17')],_0x5b8336);_0x132485(_this[_0x8870('0x15')](0x1f4,_0x15b9f5[_0x8870('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 04a4b49..a51f58e 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 _0x3de6=['removeListener','register','smsInteraction:','./smsInteraction.events','save','update','emit'];(function(_0x4ace84,_0x4a8422){var _0x18459c=function(_0x43f35a){while(--_0x43f35a){_0x4ace84['push'](_0x4ace84['shift']());}};_0x18459c(++_0x4a8422);}(_0x3de6,0x153));var _0x63de=function(_0x5b839f,_0x5c7858){_0x5b839f=_0x5b839f-0x0;var _0x5c2336=_0x3de6[_0x5b839f];return _0x5c2336;};'use strict';var SmsInteractionEvents=require(_0x63de('0x0'));var events=[_0x63de('0x1'),'remove',_0x63de('0x2')];function createListener(_0x2f5861,_0x40eac1){return function(_0x44a550){_0x40eac1[_0x63de('0x3')](_0x2f5861,_0x44a550);};}function removeListener(_0x166923,_0x3fa913){return function(){SmsInteractionEvents[_0x63de('0x4')](_0x166923,_0x3fa913);};}exports[_0x63de('0x5')]=function(_0x2e5178){for(var _0x5661d8=0x0,_0x340647=events['length'];_0x5661d8<_0x340647;_0x5661d8++){var _0x1b6d75=events[_0x5661d8];var _0x36e591=createListener(_0x63de('0x6')+_0x1b6d75,_0x2e5178);SmsInteractionEvents['on'](_0x1b6d75,_0x36e591);}}; \ No newline at end of file +var _0x4c8a=['length','smsInteraction:','save','remove','update','emit','removeListener','register'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x4c8a,0x92));var _0xa4c8=function(_0x5c778c,_0x39f87a){_0x5c778c=_0x5c778c-0x0;var _0xb4d81a=_0x4c8a[_0x5c778c];return _0xb4d81a;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa4c8('0x0'),_0xa4c8('0x1'),_0xa4c8('0x2')];function createListener(_0x33d2af,_0x130b5e){return function(_0x571008){_0x130b5e[_0xa4c8('0x3')](_0x33d2af,_0x571008);};}function removeListener(_0x105ce9,_0xbb2477){return function(){SmsInteractionEvents[_0xa4c8('0x4')](_0x105ce9,_0xbb2477);};}exports[_0xa4c8('0x5')]=function(_0x484af1){for(var _0x52c815=0x0,_0x34acfa=events[_0xa4c8('0x6')];_0x52c815<_0x34acfa;_0x52c815++){var _0x530c54=events[_0x52c815];var _0x15afe5=createListener(_0xa4c8('0x7')+_0x530c54,_0x484af1);SmsInteractionEvents['on'](_0x530c54,_0x15afe5);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 755895e..c00f925 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 _0xda44=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','smsmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy'];(function(_0x33afa5,_0xf82d17){var _0x1f326b=function(_0x37fd4d){while(--_0x37fd4d){_0x33afa5['push'](_0x33afa5['shift']());}};_0x1f326b(++_0xf82d17);}(_0xda44,0x175));var _0x4da4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xda44[_0xf50820];return _0x2a9b10;};'use strict';var multer=require(_0x4da4('0x0'));var util=require(_0x4da4('0x1'));var path=require(_0x4da4('0x2'));var timeout=require(_0x4da4('0x3'));var express=require(_0x4da4('0x4'));var router=express[_0x4da4('0x5')]();var fs_extra=require(_0x4da4('0x6'));var auth=require(_0x4da4('0x7'));var interaction=require(_0x4da4('0x8'));var config=require(_0x4da4('0x9'));var controller=require(_0x4da4('0xa'));router['get']('/',auth[_0x4da4('0xb')](),controller[_0x4da4('0xc')]);router[_0x4da4('0xd')](_0x4da4('0xe'),auth[_0x4da4('0xb')](),controller[_0x4da4('0xf')]);router[_0x4da4('0xd')](_0x4da4('0x10'),auth[_0x4da4('0xb')](),controller[_0x4da4('0x11')]);router[_0x4da4('0x12')]('/',auth[_0x4da4('0xb')](),interaction[_0x4da4('0x13')]('sms',_0x4da4('0x14')),controller[_0x4da4('0x15')]);router[_0x4da4('0x12')](_0x4da4('0x16'),controller['status']);router[_0x4da4('0x17')](_0x4da4('0x10'),auth[_0x4da4('0xb')](),controller['update']);router[_0x4da4('0x17')](_0x4da4('0x18'),auth[_0x4da4('0xb')](),controller[_0x4da4('0x19')]);router[_0x4da4('0x17')](_0x4da4('0x1a'),auth[_0x4da4('0xb')](),controller[_0x4da4('0x1b')]);router[_0x4da4('0x1c')](_0x4da4('0x10'),auth[_0x4da4('0xb')](),controller[_0x4da4('0x1d')]);module[_0x4da4('0x1e')]=router; \ No newline at end of file +var _0x1fe1=['express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/describe','describe','/:id','show','post','tracked','/:id/status','status','put','update','/:id/accept','/:id/reject','delete','destroy','exports','multer','util','path'];(function(_0x32a376,_0x4445ad){var _0x129086=function(_0x3da3c7){while(--_0x3da3c7){_0x32a376['push'](_0x32a376['shift']());}};_0x129086(++_0x4445ad);}(_0x1fe1,0xbd));var _0x11fe=function(_0xf5bc03,_0x90ad7){_0xf5bc03=_0xf5bc03-0x0;var _0x188b7f=_0x1fe1[_0xf5bc03];return _0x188b7f;};'use strict';var multer=require(_0x11fe('0x0'));var util=require(_0x11fe('0x1'));var path=require(_0x11fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x11fe('0x3'));var router=express[_0x11fe('0x4')]();var fs_extra=require(_0x11fe('0x5'));var auth=require(_0x11fe('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x11fe('0x7')]('/',auth[_0x11fe('0x8')](),controller['index']);router['get'](_0x11fe('0x9'),auth[_0x11fe('0x8')](),controller[_0x11fe('0xa')]);router['get'](_0x11fe('0xb'),auth[_0x11fe('0x8')](),controller[_0x11fe('0xc')]);router[_0x11fe('0xd')]('/',auth['isAuthenticated'](),interaction[_0x11fe('0xe')]('sms','smsmessage:create'),controller['create']);router[_0x11fe('0xd')](_0x11fe('0xf'),controller[_0x11fe('0x10')]);router[_0x11fe('0x11')](_0x11fe('0xb'),auth[_0x11fe('0x8')](),controller[_0x11fe('0x12')]);router[_0x11fe('0x11')](_0x11fe('0x13'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x11fe('0x14'),auth[_0x11fe('0x8')](),controller['reject']);router[_0x11fe('0x15')](_0x11fe('0xb'),auth[_0x11fe('0x8')](),controller[_0x11fe('0x16')]);module[_0x11fe('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index ef0936c..cf3e499 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 _0x30a7=['out','STRING','DATE','exports','TEXT','medium','BOOLEAN'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x30a7,0xf1));var _0x730a=function(_0x23c134,_0x4ee6a3){_0x23c134=_0x23c134-0x0;var _0x27f2a0=_0x30a7[_0x23c134];return _0x27f2a0;};'use strict';var Sequelize=require('sequelize');module[_0x730a('0x0')]={'body':{'type':Sequelize[_0x730a('0x1')](_0x730a('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x730a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x730a('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x730a('0x5')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x730a('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x730a('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x5fa2=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5fa2,0x1b2));var _0x25fa=function(_0x4e843d,_0x52ed22){_0x4e843d=_0x4e843d-0x0;var _0x53c723=_0x5fa2[_0x4e843d];return _0x53c723;};'use strict';var Sequelize=require(_0x25fa('0x0'));module[_0x25fa('0x1')]={'body':{'type':Sequelize[_0x25fa('0x2')](_0x25fa('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x25fa('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x25fa('0x5')]('in',_0x25fa('0x6')),'defaultValue':_0x25fa('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x25fa('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0x25fa('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x25fa('0x7')]},'providerResponse':{'type':Sequelize[_0x25fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 968d121..3f3696c 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 _0xa1cc=['ejs','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','stack','name','index','map','SmsMessage','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','catch','destroy','describe','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','sms-interactions','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','QueryTypes','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','plivo','MessageUUID','sent','delivered','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv'];(function(_0x4250b4,_0x3fd543){var _0x8a4807=function(_0x147c84){while(--_0x147c84){_0x4250b4['push'](_0x4250b4['shift']());}};_0x8a4807(++_0x3fd543);}(_0xa1cc,0x10f));var _0xca1c=function(_0x2f4353,_0x3bb304){_0x2f4353=_0x2f4353-0x0;var _0x5e73ed=_0xa1cc[_0x2f4353];return _0x5e73ed;};'use strict';var emlformat=require(_0xca1c('0x0'));var rimraf=require(_0xca1c('0x1'));var zipdir=require(_0xca1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xca1c('0x3'));var moment=require(_0xca1c('0x4'));var BPromise=require(_0xca1c('0x5'));var Mustache=require('mustache');var util=require(_0xca1c('0x6'));var path=require('path');var sox=require(_0xca1c('0x7'));var csv=require(_0xca1c('0x8'));var ejs=require(_0xca1c('0x9'));var fs=require('fs');var fs_extra=require(_0xca1c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xca1c('0xb'));var jsforce=require(_0xca1c('0xc'));var deskjs=require(_0xca1c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xca1c('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xca1c('0xf'));var as=require(_0xca1c('0x10'));var hardwareService=require(_0xca1c('0x11'));var logger=require(_0xca1c('0x12'))(_0xca1c('0x13'));var utils=require('../../config/utils');var config=require(_0xca1c('0x14'));var licenseUtil=require(_0xca1c('0x15'));var db=require('../../mysqldb')['db'];config[_0xca1c('0x16')]=_['defaults'](config[_0xca1c('0x16')],{'host':_0xca1c('0x17'),'port':0x18eb});var socket=require(_0xca1c('0x18'))(new Redis(config['redis']));require(_0xca1c('0x19'))[_0xca1c('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xca1c('0x1b')]({'port':0x232c});var client9002=jayson[_0xca1c('0x1c')][_0xca1c('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x18e6ac,_0x2644f0,_0x3ba29e,_0x1347cf){return new BPromise(function(_0x357321,_0x12a7f5){var _0x882fd4=_0x1347cf||client;return _0x882fd4[_0xca1c('0x1d')](_0x18e6ac,_0x3ba29e)[_0xca1c('0x1e')](function(_0x14480c){logger[_0xca1c('0x1f')](_0xca1c('0x20'),_0x2644f0,_0xca1c('0x21'));logger['debug'](_0xca1c('0x22'),_0x2644f0,_0xca1c('0x21'),JSON['stringify'](_0x14480c));if(_0x14480c['error']){if(_0x14480c[_0xca1c('0x23')][_0xca1c('0x24')]===0x1f4){logger[_0xca1c('0x23')](_0xca1c('0x20'),_0x2644f0,_0x14480c[_0xca1c('0x23')][_0xca1c('0x25')]);return _0x12a7f5(_0x14480c[_0xca1c('0x23')]['message']);}logger[_0xca1c('0x23')]('SmsMessage,\x20%s,\x20%s',_0x2644f0,_0x14480c[_0xca1c('0x23')][_0xca1c('0x25')]);return _0x357321(_0x14480c[_0xca1c('0x23')][_0xca1c('0x25')]);}else{logger['info'](_0xca1c('0x20'),_0x2644f0,_0xca1c('0x21'));_0x357321(_0x14480c['result'][_0xca1c('0x25')]);}})['catch'](function(_0x1639da){logger[_0xca1c('0x23')](_0xca1c('0x20'),_0x2644f0,_0x1639da);_0x12a7f5(_0x1639da);});});}function respondWithStatusCode(_0x77ea99,_0x4aacb8){_0x4aacb8=_0x4aacb8||0xcc;return function(_0x1c3056){if(_0x1c3056){return _0x77ea99[_0xca1c('0x26')](_0x4aacb8);}return _0x77ea99[_0xca1c('0x27')](_0x4aacb8)[_0xca1c('0x28')]();};}function respondWithResult(_0x1bb670,_0x40a8ca){_0x40a8ca=_0x40a8ca||0xc8;return function(_0x3d5ee4){if(_0x3d5ee4){return _0x1bb670['status'](_0x40a8ca)[_0xca1c('0x29')](_0x3d5ee4);}};}function respondWithFilteredResult(_0x5408c6,_0x573fc){return function(_0x31042a){if(_0x31042a){var _0x4a2406=typeof _0x573fc[_0xca1c('0x2a')]===_0xca1c('0x2b')&&typeof _0x573fc[_0xca1c('0x2c')]===_0xca1c('0x2b');var _0x55cc6d=_0x31042a[_0xca1c('0x2d')];var _0x267c92=_0x4a2406?0x0:_0x573fc[_0xca1c('0x2a')];var _0x3f5335=_0x4a2406?_0x31042a['count']:_0x573fc[_0xca1c('0x2a')]+_0x573fc['limit'];var _0x4eb986;if(_0x3f5335>=_0x55cc6d){_0x3f5335=_0x55cc6d;_0x4eb986=0xc8;}else{_0x4eb986=0xce;}_0x5408c6[_0xca1c('0x27')](_0x4eb986);return _0x5408c6[_0xca1c('0x2e')](_0xca1c('0x2f'),_0x267c92+'-'+_0x3f5335+'/'+_0x55cc6d)[_0xca1c('0x29')](_0x31042a);}return null;};}function patchUpdates(_0x451179){return function(_0x48fa20){try{jsonpatch['apply'](_0x48fa20,_0x451179,!![]);}catch(_0xedeaba){return BPromise[_0xca1c('0x30')](_0xedeaba);}return _0x48fa20[_0xca1c('0x31')]();};}function saveUpdates(_0x1e3273,_0x24aba6){return function(_0x5d2ab9){if(_0x5d2ab9){return _0x5d2ab9[_0xca1c('0x32')](_0x1e3273)['then'](function(_0x5b8a94){return _0x5b8a94;});}return null;};}function removeEntity(_0x4737bf,_0x3a9642){return function(_0x3aa3bc){if(_0x3aa3bc){return _0x3aa3bc['destroy']()[_0xca1c('0x1e')](function(){_0x4737bf[_0xca1c('0x27')](0xcc)[_0xca1c('0x28')]();});}};}function handleEntityNotFound(_0x10b31c,_0x57a0fc){return function(_0x3fdfdd){if(!_0x3fdfdd){_0x10b31c[_0xca1c('0x26')](0x194);}return _0x3fdfdd;};}function handleError(_0x2742d6,_0x3d3ac3){_0x3d3ac3=_0x3d3ac3||0x1f4;return function(_0xb5f2f8){logger[_0xca1c('0x23')](_0xb5f2f8[_0xca1c('0x33')]);if(_0xb5f2f8['name']){delete _0xb5f2f8[_0xca1c('0x34')];}_0x2742d6[_0xca1c('0x27')](_0x3d3ac3)['send'](_0xb5f2f8);};}exports[_0xca1c('0x35')]=function(_0x1cc798,_0x50b0ff){var _0x324cc3={},_0x2b3540={},_0x9b282f={'count':0x0,'rows':[]};var _0x4e66f9=_[_0xca1c('0x36')](db[_0xca1c('0x37')]['rawAttributes'],function(_0x2ffdab){return{'name':_0x2ffdab['fieldName'],'type':_0x2ffdab['type'][_0xca1c('0x38')]};});_0x2b3540[_0xca1c('0x39')]=_[_0xca1c('0x36')](_0x4e66f9,'name');_0x2b3540[_0xca1c('0x3a')]=_[_0xca1c('0x3b')](_0x1cc798[_0xca1c('0x3a')]);_0x2b3540[_0xca1c('0x3c')]=_[_0xca1c('0x3d')](_0x2b3540[_0xca1c('0x39')],_0x2b3540[_0xca1c('0x3a')]);_0x324cc3[_0xca1c('0x3e')]=_[_0xca1c('0x3d')](_0x2b3540[_0xca1c('0x39')],qs[_0xca1c('0x3f')](_0x1cc798[_0xca1c('0x3a')][_0xca1c('0x3f')]));_0x324cc3[_0xca1c('0x3e')]=_0x324cc3[_0xca1c('0x3e')][_0xca1c('0x40')]?_0x324cc3['attributes']:_0x2b3540[_0xca1c('0x39')];if(!_0x1cc798[_0xca1c('0x3a')]['hasOwnProperty'](_0xca1c('0x41'))){_0x324cc3[_0xca1c('0x2c')]=qs[_0xca1c('0x2c')](_0x1cc798[_0xca1c('0x3a')][_0xca1c('0x2c')]);_0x324cc3[_0xca1c('0x2a')]=qs[_0xca1c('0x2a')](_0x1cc798['query']['offset']);}_0x324cc3[_0xca1c('0x42')]=qs[_0xca1c('0x43')](_0x1cc798[_0xca1c('0x3a')]['sort']);_0x324cc3[_0xca1c('0x44')]=qs[_0xca1c('0x3c')](_['pick'](_0x1cc798[_0xca1c('0x3a')],_0x2b3540[_0xca1c('0x3c')]),_0x4e66f9);if(_0x1cc798[_0xca1c('0x3a')][_0xca1c('0x45')]){_0x324cc3['where']=_[_0xca1c('0x46')](_0x324cc3['where'],{'$or':_[_0xca1c('0x36')](_0x4e66f9,function(_0x57b3c4){if(_0x57b3c4[_0xca1c('0x47')]!==_0xca1c('0x48')){var _0x5a76d9={};_0x5a76d9[_0x57b3c4['name']]={'$like':'%'+_0x1cc798[_0xca1c('0x3a')][_0xca1c('0x45')]+'%'};return _0x5a76d9;}})});}_0x324cc3=_[_0xca1c('0x46')]({},_0x324cc3,_0x1cc798[_0xca1c('0x49')]);var _0x39d95f={'where':_0x324cc3[_0xca1c('0x44')]};return db[_0xca1c('0x37')][_0xca1c('0x2d')](_0x39d95f)['then'](function(_0xe1d343){_0x9b282f[_0xca1c('0x2d')]=_0xe1d343;if(_0x1cc798[_0xca1c('0x3a')][_0xca1c('0x4a')]){_0x324cc3[_0xca1c('0x4b')]=[{'all':!![]}];}return db[_0xca1c('0x37')][_0xca1c('0x4c')](_0x324cc3);})[_0xca1c('0x1e')](function(_0x1ee559){_0x9b282f[_0xca1c('0x4d')]=_0x1ee559;return _0x9b282f;})[_0xca1c('0x1e')](respondWithFilteredResult(_0x50b0ff,_0x324cc3))['catch'](handleError(_0x50b0ff,null));};exports[_0xca1c('0x4e')]=function(_0x29e65a,_0x472bf4){var _0x55c6c2={'raw':!![],'where':{'id':_0x29e65a[_0xca1c('0x4f')]['id']}},_0x51c889={};_0x51c889[_0xca1c('0x39')]=_[_0xca1c('0x3b')](db['SmsMessage']['rawAttributes']);_0x51c889[_0xca1c('0x3a')]=_[_0xca1c('0x3b')](_0x29e65a['query']);_0x51c889[_0xca1c('0x3c')]=_['intersection'](_0x51c889[_0xca1c('0x39')],_0x51c889[_0xca1c('0x3a')]);_0x55c6c2['attributes']=_[_0xca1c('0x3d')](_0x51c889[_0xca1c('0x39')],qs[_0xca1c('0x3f')](_0x29e65a[_0xca1c('0x3a')][_0xca1c('0x3f')]));_0x55c6c2[_0xca1c('0x3e')]=_0x55c6c2['attributes'][_0xca1c('0x40')]?_0x55c6c2['attributes']:_0x51c889['model'];if(_0x29e65a['query'][_0xca1c('0x4a')]){_0x55c6c2['include']=[{'all':!![]}];}_0x55c6c2=_[_0xca1c('0x46')]({},_0x55c6c2,_0x29e65a[_0xca1c('0x49')]);return db[_0xca1c('0x37')][_0xca1c('0x50')](_0x55c6c2)[_0xca1c('0x1e')](handleEntityNotFound(_0x472bf4,null))[_0xca1c('0x1e')](respondWithResult(_0x472bf4,null))['catch'](handleError(_0x472bf4,null));};exports[_0xca1c('0x51')]=function(_0xc9234a,_0xa560){return db[_0xca1c('0x37')]['create'](_0xc9234a[_0xca1c('0x52')],{})['then'](respondWithResult(_0xa560,0xc9))[_0xca1c('0x53')](handleError(_0xa560,null));};exports[_0xca1c('0x32')]=function(_0x14421c,_0x27c456){if(_0x14421c[_0xca1c('0x52')]['id']){delete _0x14421c[_0xca1c('0x52')]['id'];}return db[_0xca1c('0x37')][_0xca1c('0x50')]({'where':{'id':_0x14421c['params']['id']}})[_0xca1c('0x1e')](handleEntityNotFound(_0x27c456,null))[_0xca1c('0x1e')](saveUpdates(_0x14421c[_0xca1c('0x52')],null))[_0xca1c('0x1e')](respondWithResult(_0x27c456,null))[_0xca1c('0x53')](handleError(_0x27c456,null));};exports[_0xca1c('0x54')]=function(_0x20506c,_0x157ee4){return db[_0xca1c('0x37')][_0xca1c('0x50')]({'where':{'id':_0x20506c[_0xca1c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x157ee4,null))[_0xca1c('0x1e')](removeEntity(_0x157ee4,null))[_0xca1c('0x53')](handleError(_0x157ee4,null));};exports[_0xca1c('0x55')]=function(_0x4c5d1a,_0x1a2ec9){return db[_0xca1c('0x37')][_0xca1c('0x55')]()[_0xca1c('0x1e')](respondWithResult(_0x1a2ec9,null))[_0xca1c('0x53')](handleError(_0x1a2ec9,null));};var interaction_log=require(_0xca1c('0x12'))('sms-interactions');exports['accept']=function(_0x1aa777,_0x22c09d,_0x36fa2f){var _0x2a3a53={'agent':{},'channel':_0xca1c('0x56')};if(_0x1aa777[_0xca1c('0x52')]['id']){delete _0x1aa777['body']['id'];}_0x1aa777[_0xca1c('0x52')]['read']=!![];_0x1aa777[_0xca1c('0x52')]['readAt']=moment()[_0xca1c('0x57')](_0xca1c('0x58'));_0x1aa777[_0xca1c('0x52')][_0xca1c('0x59')]=_0x1aa777['body'][_0xca1c('0x59')]||_0x1aa777['user']['id'];_0x2a3a53[_0xca1c('0x5a')]['id']=_0x1aa777[_0xca1c('0x52')][_0xca1c('0x59')];return db[_0xca1c('0x37')]['find']({'where':{'id':_0x1aa777[_0xca1c('0x4f')]['id'],'UserId':null}})[_0xca1c('0x1e')](handleEntityNotFound(_0x22c09d,null))[_0xca1c('0x1e')](saveUpdates(_0x1aa777[_0xca1c('0x52')],null))[_0xca1c('0x1e')](function(_0x346cb1){if(_0x346cb1){_0x2a3a53[_0xca1c('0x25')]=_0x346cb1[_0xca1c('0x5b')]({'plain':!![]});return db[_0xca1c('0x5c')]['find']({'where':{'id':_0x346cb1[_0xca1c('0x5d')]}});}return null;})[_0xca1c('0x1e')](handleEntityNotFound(_0x22c09d,null))[_0xca1c('0x1e')](function(_0xc2bd7d){if(_0xc2bd7d){return _0xc2bd7d[_0xca1c('0x32')]({'UserId':_0x1aa777[_0xca1c('0x52')]['UserId'],'read1stAt':_[_0xca1c('0x5e')](_0xc2bd7d[_0xca1c('0x5f')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xca1c('0x1e')](function(_0x198107){if(_0x198107){_0x2a3a53[_0xca1c('0x60')]=_0x198107['get']({'plain':!![]});interaction_log[_0xca1c('0x1f')](_0xca1c('0x61'),_0x1aa777[_0xca1c('0x62')]['id'],_0x1aa777[_0xca1c('0x62')]['name'],_0x1aa777[_0xca1c('0x62')]['role'],_0x2a3a53['interaction']['id'],_0x1aa777[_0xca1c('0x52')]?JSON[_0xca1c('0x63')](_0x1aa777[_0xca1c('0x52')]):'null');return respondWithRpcPromise('AcceptMessage',_0xca1c('0x64'),_0x2a3a53);}return null;})[_0xca1c('0x1e')](function(_0x315c53){var _0x86fe23=_0xca1c('0x65')+_0x315c53[_0xca1c('0x25')][_0xca1c('0x66')];return db[_0xca1c('0x67')][_0xca1c('0x3a')](_0x86fe23,{'type':db[_0xca1c('0x68')]['QueryTypes'][_0xca1c('0x69')],'raw':!![]})[_0xca1c('0x1e')](function(_0x156106){return _0x156106;});})[_0xca1c('0x1e')](function(_0x3da34d){if(_0x3da34d){_0x2a3a53[_0xca1c('0x25')][_0xca1c('0x6a')]=_0x3da34d[0x0];if(!_0x1aa777[_0xca1c('0x52')][_0xca1c('0x59')])return;return db[_0xca1c('0x6b')][_0xca1c('0x50')]({'where':{'id':_0x1aa777[_0xca1c('0x52')]['UserId'],'role':_0xca1c('0x5a')},'attributes':['id',_0xca1c('0x34'),_0xca1c('0x6c'),_0xca1c('0x6d'),_0xca1c('0x6e')],'raw':!![]});}return null;})[_0xca1c('0x1e')](function(_0x38a017){if(!_0x38a017)return null;_0x2a3a53['message'][_0xca1c('0x5a')]=_0x38a017;return _0x2a3a53;})[_0xca1c('0x1e')](function(_0x17101a){if(_0x17101a){if(_0x1aa777[_0xca1c('0x52')]['manual']){_0x2a3a53['message'][_0xca1c('0x6f')]=util[_0xca1c('0x57')](_0xca1c('0x70'),_0x1aa777[_0xca1c('0x62')]['name']);_0x2a3a53[_0xca1c('0x25')][_0xca1c('0x71')]=_0x2a3a53[_0xca1c('0x71')];_0x2a3a53[_0xca1c('0x25')][_0xca1c('0x72')]=_0x2a3a53['channel'];_0x2a3a53[_0xca1c('0x25')][_0xca1c('0x73')]=_0xca1c('0x74');return respondWithRpcPromise(_0xca1c('0x75'),'EventManager',{'event':_0xca1c('0x76'),'message':_0x2a3a53[_0xca1c('0x25')]},client9002)[_0xca1c('0x1e')](function(){return _0x2a3a53;});}return _0x2a3a53;}return null;})['then'](respondWithResult(_0x22c09d,null))[_0xca1c('0x53')](handleError(_0x22c09d,null));};var interaction_log=require('../../config/logger')(_0xca1c('0x77'));exports[_0xca1c('0x30')]=function(_0x10eb77,_0x39f7a8,_0x568e0e){var _0x2a97d7={'agent':{},'channel':_0xca1c('0x56')};if(_0x10eb77[_0xca1c('0x52')]['id']){delete _0x10eb77['body']['id'];}_0x10eb77[_0xca1c('0x52')][_0xca1c('0x59')]=_0x10eb77[_0xca1c('0x52')][_0xca1c('0x59')]||_0x10eb77['user']['id'];_0x2a97d7[_0xca1c('0x5a')]['id']=_0x10eb77[_0xca1c('0x52')]['UserId'];return db[_0xca1c('0x37')]['find']({'where':{'id':_0x10eb77[_0xca1c('0x4f')]['id'],'UserId':null}})[_0xca1c('0x1e')](handleEntityNotFound(_0x39f7a8,null))[_0xca1c('0x1e')](function(_0x42a929){if(_0x42a929){_0x2a97d7[_0xca1c('0x25')]=_0x42a929[_0xca1c('0x5b')]({'plain':!![]});return db[_0xca1c('0x5c')]['find']({'where':{'id':_0x42a929['SmsInteractionId']}});}return null;})[_0xca1c('0x1e')](handleEntityNotFound(_0x39f7a8,null))[_0xca1c('0x1e')](function(_0x19c400){if(_0x19c400){_0x2a97d7[_0xca1c('0x60')]=_0x19c400[_0xca1c('0x5b')]({'plain':!![]});interaction_log[_0xca1c('0x1f')](_0xca1c('0x78'),_0x10eb77[_0xca1c('0x62')]['id'],_0x10eb77['user'][_0xca1c('0x34')],_0x10eb77[_0xca1c('0x62')]['role'],_0x2a97d7[_0xca1c('0x60')]['id'],_0x10eb77[_0xca1c('0x52')]?JSON[_0xca1c('0x63')](_0x10eb77['body']):_0xca1c('0x79'));return respondWithRpcPromise(_0xca1c('0x7a'),'rejectMessage',_0x2a97d7);}return null;})[_0xca1c('0x1e')](function(_0xc8311c){var _0x38b6e8=_0xca1c('0x65')+_0xc8311c['message'][_0xca1c('0x66')];return db[_0xca1c('0x67')]['query'](_0x38b6e8,{'type':db['Sequelize'][_0xca1c('0x7b')][_0xca1c('0x69')],'raw':!![]})[_0xca1c('0x1e')](function(_0x5489ef){return _0x5489ef;});})[_0xca1c('0x1e')](function(_0x2f59ce){if(_0x2f59ce){_0x2a97d7[_0xca1c('0x25')][_0xca1c('0x6a')]=_0x2f59ce[0x0];if(!_0x10eb77[_0xca1c('0x52')]['UserId'])return;return db[_0xca1c('0x6b')][_0xca1c('0x50')]({'where':{'id':_0x10eb77[_0xca1c('0x52')][_0xca1c('0x59')],'role':_0xca1c('0x5a')},'attributes':['id',_0xca1c('0x34'),'fullname',_0xca1c('0x6d'),_0xca1c('0x6e')],'raw':!![]});}return null;})[_0xca1c('0x1e')](function(_0xf06fb){if(!_0xf06fb)return null;_0x2a97d7['message'][_0xca1c('0x5a')]=_0xf06fb;return _0x2a97d7;})[_0xca1c('0x1e')](function(_0x11530){if(_0x11530){_0x11530[_0xca1c('0x25')][_0xca1c('0x6f')]=util[_0xca1c('0x57')](_0xca1c('0x70'),_0x10eb77[_0xca1c('0x62')][_0xca1c('0x34')]);_0x11530['message'][_0xca1c('0x71')]=_0x2a97d7['channel'];_0x11530['message'][_0xca1c('0x72')]=_0x2a97d7[_0xca1c('0x71')];_0x11530[_0xca1c('0x25')][_0xca1c('0x73')]=_0xca1c('0x30');respondWithRpcPromise(_0xca1c('0x75'),'EventManager',{'event':'rejectmessage','message':_0x11530[_0xca1c('0x25')]},client9002);return _0x2a97d7;}return null;})['then'](respondWithResult(_0x39f7a8,null))[_0xca1c('0x53')](handleError(_0x39f7a8,null));};exports['status']=function(_0x470229,_0x3e2718,_0x498ca8){if(_0x470229[_0xca1c('0x52')]['id']){delete _0x470229[_0xca1c('0x52')]['id'];}var _0x2e3bd8;return db[_0xca1c('0x37')][_0xca1c('0x50')]({'where':{'id':_0x470229[_0xca1c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3e2718,null))[_0xca1c('0x1e')](function(_0xc977b9){if(_0xc977b9){_0x2e3bd8=_0xc977b9;return db[_0xca1c('0x7c')][_0xca1c('0x50')]({'where':{'id':_0xc977b9[_0xca1c('0x7d')]}});}})[_0xca1c('0x1e')](handleEntityNotFound(_0x3e2718,null))[_0xca1c('0x1e')](function(_0x414e65){if(_0x414e65){logger[_0xca1c('0x7e')](_0xca1c('0x22'),_0xca1c('0x27'),_0xca1c('0x7f'),_0x414e65[_0xca1c('0x47')],util['inspect'](_0x470229[_0xca1c('0x52')],{'showHidden':![],'depth':null}));switch(_0x414e65[_0xca1c('0x47')]){case'twilio':if(_0x470229[_0xca1c('0x52')]['MessageSid']&&_0x470229[_0xca1c('0x52')]['MessageSid']===_0x2e3bd8[_0xca1c('0x80')]){return _0x2e3bd8['update']({'read':!![]});}else{logger[_0xca1c('0x23')](_0xca1c('0x81'),_0xca1c('0x27'),_0xca1c('0x82'),util[_0xca1c('0x83')](_0x470229[_0xca1c('0x52')],{'showHidden':![],'depth':null}));}break;case _0xca1c('0x84'):if(_0x470229[_0xca1c('0x52')][_0xca1c('0x85')]&&_0x470229[_0xca1c('0x52')][_0xca1c('0x85')]===_0x2e3bd8['messageId']&&_['indexOf']([_0xca1c('0x86'),_0xca1c('0x87')],_0x470229['body']['Status'])>=0x0){return _0x2e3bd8['update']({'read':!![]});}else{logger[_0xca1c('0x23')](_0xca1c('0x81'),_0xca1c('0x27'),_0xca1c('0x88'),util['inspect'](_0x470229['body'],{'showHidden':![],'depth':null}));}break;case _0xca1c('0x89'):var _0x269e69=_0x470229[_0xca1c('0x52')]['results'][0x0];if(_0x269e69[_0xca1c('0x27')][_0xca1c('0x8a')]===_0xca1c('0x8b')){return _0x2e3bd8['update']({'read':!![]});}else{logger[_0xca1c('0x23')](_0xca1c('0x81'),_0xca1c('0x27'),_0xca1c('0x89'),util[_0xca1c('0x83')](_0x470229[_0xca1c('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x2e3bd8;}})[_0xca1c('0x1e')](respondWithResult(_0x3e2718,null))[_0xca1c('0x53')](handleError(_0x3e2718,null));}; \ No newline at end of file +var _0xf5c0=['inspect','type','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','Status','plivio','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','update','params','sms-interactions','accept','sms','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','read1stAt','interaction','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','internal','agent','manual','interface','channel','motionChannel','EventManager','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','event','rejectmessage','SmsAccount','SmsAccountId','debug','received\x20delivery\x20report\x20from'];(function(_0x355df8,_0x3bafc0){var _0x59b951=function(_0x22e64f){while(--_0x22e64f){_0x355df8['push'](_0x355df8['shift']());}};_0x59b951(++_0x3bafc0);}(_0xf5c0,0x9d));var _0x0f5c=function(_0x24689f,_0x4fff42){_0x24689f=_0x24689f-0x0;var _0x2c1c51=_0xf5c0[_0x24689f];return _0x2c1c51;};'use strict';var emlformat=require(_0x0f5c('0x0'));var rimraf=require(_0x0f5c('0x1'));var zipdir=require(_0x0f5c('0x2'));var jsonpatch=require(_0x0f5c('0x3'));var rp=require(_0x0f5c('0x4'));var moment=require(_0x0f5c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0f5c('0x6'));var util=require('util');var path=require(_0x0f5c('0x7'));var sox=require(_0x0f5c('0x8'));var csv=require('to-csv');var ejs=require(_0x0f5c('0x9'));var fs=require('fs');var fs_extra=require(_0x0f5c('0xa'));var _=require('lodash');var squel=require(_0x0f5c('0xb'));var crypto=require(_0x0f5c('0xc'));var jsforce=require(_0x0f5c('0xd'));var deskjs=require(_0x0f5c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0f5c('0xf'));var Papa=require(_0x0f5c('0x10'));var Redis=require(_0x0f5c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0f5c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0f5c('0x13'))('api');var utils=require(_0x0f5c('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f5c('0x15'))['db'];config[_0x0f5c('0x16')]=_['defaults'](config['redis'],{'host':_0x0f5c('0x17'),'port':0x18eb});var socket=require(_0x0f5c('0x18'))(new Redis(config[_0x0f5c('0x16')]));require(_0x0f5c('0x19'))['register'](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x0f5c('0x1a')]({'port':0x232c});var client9002=jayson[_0x0f5c('0x1b')][_0x0f5c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x2e01df,_0x27b77a,_0x69078c,_0xcf78c4){return new BPromise(function(_0x107e3d,_0x1150d5){var _0x4dfe04=_0xcf78c4||client;return _0x4dfe04[_0x0f5c('0x1c')](_0x2e01df,_0x69078c)[_0x0f5c('0x1d')](function(_0x29aed3){logger[_0x0f5c('0x1e')](_0x0f5c('0x1f'),_0x27b77a,_0x0f5c('0x20'));logger['debug'](_0x0f5c('0x21'),_0x27b77a,_0x0f5c('0x20'),JSON[_0x0f5c('0x22')](_0x29aed3));if(_0x29aed3[_0x0f5c('0x23')]){if(_0x29aed3[_0x0f5c('0x23')][_0x0f5c('0x24')]===0x1f4){logger[_0x0f5c('0x23')](_0x0f5c('0x1f'),_0x27b77a,_0x29aed3[_0x0f5c('0x23')][_0x0f5c('0x25')]);return _0x1150d5(_0x29aed3['error']['message']);}logger[_0x0f5c('0x23')](_0x0f5c('0x1f'),_0x27b77a,_0x29aed3['error']['message']);return _0x107e3d(_0x29aed3[_0x0f5c('0x23')][_0x0f5c('0x25')]);}else{logger[_0x0f5c('0x1e')](_0x0f5c('0x1f'),_0x27b77a,'request\x20sent');_0x107e3d(_0x29aed3[_0x0f5c('0x26')]['message']);}})['catch'](function(_0x13557e){logger[_0x0f5c('0x23')](_0x0f5c('0x1f'),_0x27b77a,_0x13557e);_0x1150d5(_0x13557e);});});}function respondWithStatusCode(_0x1a3aa4,_0x468b80){_0x468b80=_0x468b80||0xcc;return function(_0x150133){if(_0x150133){return _0x1a3aa4[_0x0f5c('0x27')](_0x468b80);}return _0x1a3aa4[_0x0f5c('0x28')](_0x468b80)[_0x0f5c('0x29')]();};}function respondWithResult(_0x38e3cf,_0x178d46){_0x178d46=_0x178d46||0xc8;return function(_0x3a91dd){if(_0x3a91dd){return _0x38e3cf[_0x0f5c('0x28')](_0x178d46)[_0x0f5c('0x2a')](_0x3a91dd);}};}function respondWithFilteredResult(_0x3d7d3e,_0xbaf87f){return function(_0x24004c){if(_0x24004c){var _0x1ea558=typeof _0xbaf87f[_0x0f5c('0x2b')]===_0x0f5c('0x2c')&&typeof _0xbaf87f['limit']===_0x0f5c('0x2c');var _0x3626b4=_0x24004c[_0x0f5c('0x2d')];var _0x21a6d8=_0x1ea558?0x0:_0xbaf87f[_0x0f5c('0x2b')];var _0x3751fa=_0x1ea558?_0x24004c[_0x0f5c('0x2d')]:_0xbaf87f[_0x0f5c('0x2b')]+_0xbaf87f[_0x0f5c('0x2e')];var _0x201b02;if(_0x3751fa>=_0x3626b4){_0x3751fa=_0x3626b4;_0x201b02=0xc8;}else{_0x201b02=0xce;}_0x3d7d3e['status'](_0x201b02);return _0x3d7d3e[_0x0f5c('0x2f')]('Content-Range',_0x21a6d8+'-'+_0x3751fa+'/'+_0x3626b4)[_0x0f5c('0x2a')](_0x24004c);}return null;};}function patchUpdates(_0x1a57b9){return function(_0x4f6337){try{jsonpatch['apply'](_0x4f6337,_0x1a57b9,!![]);}catch(_0x1fb25a){return BPromise[_0x0f5c('0x30')](_0x1fb25a);}return _0x4f6337[_0x0f5c('0x31')]();};}function saveUpdates(_0x5c51b1,_0x332599){return function(_0xd45abd){if(_0xd45abd){return _0xd45abd['update'](_0x5c51b1)[_0x0f5c('0x1d')](function(_0x491a09){return _0x491a09;});}return null;};}function removeEntity(_0x2307f7,_0x27e3c3){return function(_0x381efa){if(_0x381efa){return _0x381efa[_0x0f5c('0x32')]()[_0x0f5c('0x1d')](function(){_0x2307f7['status'](0xcc)[_0x0f5c('0x29')]();});}};}function handleEntityNotFound(_0x1b5a91,_0x37bf42){return function(_0x4e3ceb){if(!_0x4e3ceb){_0x1b5a91[_0x0f5c('0x27')](0x194);}return _0x4e3ceb;};}function handleError(_0x1b8d04,_0x5c6a0b){_0x5c6a0b=_0x5c6a0b||0x1f4;return function(_0x1800ae){logger[_0x0f5c('0x23')](_0x1800ae[_0x0f5c('0x33')]);if(_0x1800ae[_0x0f5c('0x34')]){delete _0x1800ae[_0x0f5c('0x34')];}_0x1b8d04[_0x0f5c('0x28')](_0x5c6a0b)[_0x0f5c('0x35')](_0x1800ae);};}exports[_0x0f5c('0x36')]=function(_0x48006a,_0x1b3b83){var _0x1687a={},_0x53acdb={},_0x4f6419={'count':0x0,'rows':[]};var _0xbd7131=_[_0x0f5c('0x37')](db[_0x0f5c('0x38')][_0x0f5c('0x39')],function(_0x5b9973){return{'name':_0x5b9973[_0x0f5c('0x3a')],'type':_0x5b9973['type'][_0x0f5c('0x3b')]};});_0x53acdb[_0x0f5c('0x3c')]=_[_0x0f5c('0x37')](_0xbd7131,_0x0f5c('0x34'));_0x53acdb[_0x0f5c('0x3d')]=_[_0x0f5c('0x3e')](_0x48006a[_0x0f5c('0x3d')]);_0x53acdb[_0x0f5c('0x3f')]=_['intersection'](_0x53acdb[_0x0f5c('0x3c')],_0x53acdb[_0x0f5c('0x3d')]);_0x1687a[_0x0f5c('0x40')]=_[_0x0f5c('0x41')](_0x53acdb[_0x0f5c('0x3c')],qs[_0x0f5c('0x42')](_0x48006a[_0x0f5c('0x3d')][_0x0f5c('0x42')]));_0x1687a[_0x0f5c('0x40')]=_0x1687a['attributes'][_0x0f5c('0x43')]?_0x1687a[_0x0f5c('0x40')]:_0x53acdb[_0x0f5c('0x3c')];if(!_0x48006a[_0x0f5c('0x3d')][_0x0f5c('0x44')]('nolimit')){_0x1687a[_0x0f5c('0x2e')]=qs[_0x0f5c('0x2e')](_0x48006a['query'][_0x0f5c('0x2e')]);_0x1687a[_0x0f5c('0x2b')]=qs[_0x0f5c('0x2b')](_0x48006a[_0x0f5c('0x3d')][_0x0f5c('0x2b')]);}_0x1687a[_0x0f5c('0x45')]=qs[_0x0f5c('0x46')](_0x48006a['query'][_0x0f5c('0x46')]);_0x1687a[_0x0f5c('0x47')]=qs[_0x0f5c('0x3f')](_['pick'](_0x48006a[_0x0f5c('0x3d')],_0x53acdb[_0x0f5c('0x3f')]),_0xbd7131);if(_0x48006a['query']['filter']){_0x1687a[_0x0f5c('0x47')]=_[_0x0f5c('0x48')](_0x1687a['where'],{'$or':_['map'](_0xbd7131,function(_0x1cf467){if(_0x1cf467['type']!==_0x0f5c('0x49')){var _0x28a2bb={};_0x28a2bb[_0x1cf467[_0x0f5c('0x34')]]={'$like':'%'+_0x48006a[_0x0f5c('0x3d')]['filter']+'%'};return _0x28a2bb;}})});}_0x1687a=_[_0x0f5c('0x48')]({},_0x1687a,_0x48006a[_0x0f5c('0x4a')]);var _0x34f1a5={'where':_0x1687a['where']};return db[_0x0f5c('0x38')][_0x0f5c('0x2d')](_0x34f1a5)[_0x0f5c('0x1d')](function(_0x1972b2){_0x4f6419[_0x0f5c('0x2d')]=_0x1972b2;if(_0x48006a[_0x0f5c('0x3d')][_0x0f5c('0x4b')]){_0x1687a[_0x0f5c('0x4c')]=[{'all':!![]}];}return db[_0x0f5c('0x38')][_0x0f5c('0x4d')](_0x1687a);})[_0x0f5c('0x1d')](function(_0x11f3d8){_0x4f6419[_0x0f5c('0x4e')]=_0x11f3d8;return _0x4f6419;})[_0x0f5c('0x1d')](respondWithFilteredResult(_0x1b3b83,_0x1687a))['catch'](handleError(_0x1b3b83,null));};exports[_0x0f5c('0x4f')]=function(_0x22c029,_0x19f665){var _0x2cc589={'raw':!![],'where':{'id':_0x22c029['params']['id']}},_0x7cbe59={};_0x7cbe59[_0x0f5c('0x3c')]=_[_0x0f5c('0x3e')](db[_0x0f5c('0x38')][_0x0f5c('0x39')]);_0x7cbe59[_0x0f5c('0x3d')]=_[_0x0f5c('0x3e')](_0x22c029[_0x0f5c('0x3d')]);_0x7cbe59[_0x0f5c('0x3f')]=_[_0x0f5c('0x41')](_0x7cbe59['model'],_0x7cbe59[_0x0f5c('0x3d')]);_0x2cc589[_0x0f5c('0x40')]=_[_0x0f5c('0x41')](_0x7cbe59['model'],qs['fields'](_0x22c029[_0x0f5c('0x3d')][_0x0f5c('0x42')]));_0x2cc589['attributes']=_0x2cc589['attributes'][_0x0f5c('0x43')]?_0x2cc589[_0x0f5c('0x40')]:_0x7cbe59[_0x0f5c('0x3c')];if(_0x22c029['query']['includeAll']){_0x2cc589['include']=[{'all':!![]}];}_0x2cc589=_[_0x0f5c('0x48')]({},_0x2cc589,_0x22c029['options']);return db[_0x0f5c('0x38')][_0x0f5c('0x50')](_0x2cc589)[_0x0f5c('0x1d')](handleEntityNotFound(_0x19f665,null))['then'](respondWithResult(_0x19f665,null))[_0x0f5c('0x51')](handleError(_0x19f665,null));};exports[_0x0f5c('0x52')]=function(_0x25b382,_0x3ee7a1){return db[_0x0f5c('0x38')][_0x0f5c('0x52')](_0x25b382[_0x0f5c('0x53')],{})[_0x0f5c('0x1d')](respondWithResult(_0x3ee7a1,0xc9))[_0x0f5c('0x51')](handleError(_0x3ee7a1,null));};exports[_0x0f5c('0x54')]=function(_0x1b7f23,_0x39ebec){if(_0x1b7f23[_0x0f5c('0x53')]['id']){delete _0x1b7f23['body']['id'];}return db[_0x0f5c('0x38')][_0x0f5c('0x50')]({'where':{'id':_0x1b7f23[_0x0f5c('0x55')]['id']}})[_0x0f5c('0x1d')](handleEntityNotFound(_0x39ebec,null))[_0x0f5c('0x1d')](saveUpdates(_0x1b7f23['body'],null))[_0x0f5c('0x1d')](respondWithResult(_0x39ebec,null))[_0x0f5c('0x51')](handleError(_0x39ebec,null));};exports[_0x0f5c('0x32')]=function(_0x2c8ebd,_0x4a3bd6){return db[_0x0f5c('0x38')]['find']({'where':{'id':_0x2c8ebd[_0x0f5c('0x55')]['id']}})[_0x0f5c('0x1d')](handleEntityNotFound(_0x4a3bd6,null))['then'](removeEntity(_0x4a3bd6,null))[_0x0f5c('0x51')](handleError(_0x4a3bd6,null));};exports['describe']=function(_0x94a446,_0x5c8265){return db[_0x0f5c('0x38')]['describe']()['then'](respondWithResult(_0x5c8265,null))[_0x0f5c('0x51')](handleError(_0x5c8265,null));};var interaction_log=require(_0x0f5c('0x13'))(_0x0f5c('0x56'));exports[_0x0f5c('0x57')]=function(_0x557cfd,_0x535b6b,_0xc434cd){var _0x18dfca={'agent':{},'channel':_0x0f5c('0x58')};if(_0x557cfd['body']['id']){delete _0x557cfd[_0x0f5c('0x53')]['id'];}_0x557cfd[_0x0f5c('0x53')]['read']=!![];_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x59')]=moment()[_0x0f5c('0x5a')](_0x0f5c('0x5b'));_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x5c')]=_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x5c')]||_0x557cfd[_0x0f5c('0x5d')]['id'];_0x18dfca['agent']['id']=_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x5c')];return db[_0x0f5c('0x38')][_0x0f5c('0x50')]({'where':{'id':_0x557cfd['params']['id'],'UserId':null}})[_0x0f5c('0x1d')](handleEntityNotFound(_0x535b6b,null))[_0x0f5c('0x1d')](saveUpdates(_0x557cfd['body'],null))[_0x0f5c('0x1d')](function(_0xb74756){if(_0xb74756){_0x18dfca[_0x0f5c('0x25')]=_0xb74756[_0x0f5c('0x5e')]({'plain':!![]});return db[_0x0f5c('0x5f')][_0x0f5c('0x50')]({'where':{'id':_0xb74756[_0x0f5c('0x60')]}});}return null;})[_0x0f5c('0x1d')](handleEntityNotFound(_0x535b6b,null))[_0x0f5c('0x1d')](function(_0x33688e){if(_0x33688e){return _0x33688e[_0x0f5c('0x54')]({'UserId':_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x5c')],'read1stAt':_['isNil'](_0x33688e[_0x0f5c('0x61')])?moment()[_0x0f5c('0x5a')](_0x0f5c('0x5b')):undefined});}return null;})[_0x0f5c('0x1d')](function(_0x3a947d){if(_0x3a947d){_0x18dfca[_0x0f5c('0x62')]=_0x3a947d['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x557cfd[_0x0f5c('0x5d')]['id'],_0x557cfd[_0x0f5c('0x5d')][_0x0f5c('0x34')],_0x557cfd['user'][_0x0f5c('0x63')],_0x18dfca[_0x0f5c('0x62')]['id'],_0x557cfd['body']?JSON[_0x0f5c('0x22')](_0x557cfd[_0x0f5c('0x53')]):_0x0f5c('0x64'));return respondWithRpcPromise(_0x0f5c('0x65'),_0x0f5c('0x66'),_0x18dfca);}return null;})['then'](function(_0x237825){var _0xd665c9=_0x0f5c('0x67')+_0x237825[_0x0f5c('0x25')][_0x0f5c('0x68')];return db[_0x0f5c('0x69')][_0x0f5c('0x3d')](_0xd665c9,{'type':db['Sequelize'][_0x0f5c('0x6a')]['SELECT'],'raw':!![]})[_0x0f5c('0x1d')](function(_0x1cabc4){return _0x1cabc4;});})['then'](function(_0x2c247f){if(_0x2c247f){_0x18dfca[_0x0f5c('0x25')][_0x0f5c('0x6b')]=_0x2c247f[0x0];if(!_0x557cfd['body'][_0x0f5c('0x5c')])return;return db[_0x0f5c('0x6c')][_0x0f5c('0x50')]({'where':{'id':_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x5c')],'role':'agent'},'attributes':['id',_0x0f5c('0x34'),_0x0f5c('0x6d'),'email',_0x0f5c('0x6e')],'raw':!![]});}return null;})[_0x0f5c('0x1d')](function(_0x52409e){if(!_0x52409e)return null;_0x18dfca[_0x0f5c('0x25')][_0x0f5c('0x6f')]=_0x52409e;return _0x18dfca;})[_0x0f5c('0x1d')](function(_0x3953ae){if(_0x3953ae){if(_0x557cfd[_0x0f5c('0x53')][_0x0f5c('0x70')]){_0x18dfca[_0x0f5c('0x25')][_0x0f5c('0x71')]=util[_0x0f5c('0x5a')]('SIP/%s',_0x557cfd[_0x0f5c('0x5d')][_0x0f5c('0x34')]);_0x18dfca['message'][_0x0f5c('0x72')]=_0x18dfca[_0x0f5c('0x72')];_0x18dfca[_0x0f5c('0x25')][_0x0f5c('0x73')]=_0x18dfca[_0x0f5c('0x72')];_0x18dfca[_0x0f5c('0x25')]['event']=_0x0f5c('0x57');return respondWithRpcPromise(_0x0f5c('0x74'),_0x0f5c('0x74'),{'event':'acceptmessage','message':_0x18dfca['message']},client9002)[_0x0f5c('0x1d')](function(){return _0x18dfca;});}return _0x18dfca;}return null;})['then'](respondWithResult(_0x535b6b,null))['catch'](handleError(_0x535b6b,null));};var interaction_log=require(_0x0f5c('0x13'))(_0x0f5c('0x56'));exports[_0x0f5c('0x30')]=function(_0x1ba4d3,_0x59ff3f,_0xd77bd4){var _0x1a2a0e={'agent':{},'channel':_0x0f5c('0x58')};if(_0x1ba4d3['body']['id']){delete _0x1ba4d3['body']['id'];}_0x1ba4d3[_0x0f5c('0x53')][_0x0f5c('0x5c')]=_0x1ba4d3[_0x0f5c('0x53')]['UserId']||_0x1ba4d3[_0x0f5c('0x5d')]['id'];_0x1a2a0e['agent']['id']=_0x1ba4d3[_0x0f5c('0x53')][_0x0f5c('0x5c')];return db[_0x0f5c('0x38')][_0x0f5c('0x50')]({'where':{'id':_0x1ba4d3['params']['id'],'UserId':null}})[_0x0f5c('0x1d')](handleEntityNotFound(_0x59ff3f,null))['then'](function(_0x40a84a){if(_0x40a84a){_0x1a2a0e[_0x0f5c('0x25')]=_0x40a84a[_0x0f5c('0x5e')]({'plain':!![]});return db[_0x0f5c('0x5f')]['find']({'where':{'id':_0x40a84a[_0x0f5c('0x60')]}});}return null;})[_0x0f5c('0x1d')](handleEntityNotFound(_0x59ff3f,null))[_0x0f5c('0x1d')](function(_0x468d87){if(_0x468d87){_0x1a2a0e[_0x0f5c('0x62')]=_0x468d87['get']({'plain':!![]});interaction_log[_0x0f5c('0x1e')](_0x0f5c('0x75'),_0x1ba4d3[_0x0f5c('0x5d')]['id'],_0x1ba4d3[_0x0f5c('0x5d')]['name'],_0x1ba4d3[_0x0f5c('0x5d')][_0x0f5c('0x63')],_0x1a2a0e[_0x0f5c('0x62')]['id'],_0x1ba4d3[_0x0f5c('0x53')]?JSON[_0x0f5c('0x22')](_0x1ba4d3[_0x0f5c('0x53')]):_0x0f5c('0x64'));return respondWithRpcPromise(_0x0f5c('0x76'),_0x0f5c('0x77'),_0x1a2a0e);}return null;})[_0x0f5c('0x1d')](function(_0xdb9b44){var _0xa336f2=_0x0f5c('0x67')+_0xdb9b44['message']['ContactId'];return db['sequelize'][_0x0f5c('0x3d')](_0xa336f2,{'type':db['Sequelize'][_0x0f5c('0x6a')][_0x0f5c('0x78')],'raw':!![]})[_0x0f5c('0x1d')](function(_0x3a16ea){return _0x3a16ea;});})[_0x0f5c('0x1d')](function(_0x15169f){if(_0x15169f){_0x1a2a0e['message'][_0x0f5c('0x6b')]=_0x15169f[0x0];if(!_0x1ba4d3['body']['UserId'])return;return db[_0x0f5c('0x6c')][_0x0f5c('0x50')]({'where':{'id':_0x1ba4d3[_0x0f5c('0x53')]['UserId'],'role':_0x0f5c('0x6f')},'attributes':['id','name',_0x0f5c('0x6d'),'email',_0x0f5c('0x6e')],'raw':!![]});}return null;})[_0x0f5c('0x1d')](function(_0x47995e){if(!_0x47995e)return null;_0x1a2a0e[_0x0f5c('0x25')][_0x0f5c('0x6f')]=_0x47995e;return _0x1a2a0e;})[_0x0f5c('0x1d')](function(_0x3e17f9){if(_0x3e17f9){_0x3e17f9['message']['interface']=util[_0x0f5c('0x5a')]('SIP/%s',_0x1ba4d3[_0x0f5c('0x5d')][_0x0f5c('0x34')]);_0x3e17f9[_0x0f5c('0x25')][_0x0f5c('0x72')]=_0x1a2a0e[_0x0f5c('0x72')];_0x3e17f9[_0x0f5c('0x25')][_0x0f5c('0x73')]=_0x1a2a0e['channel'];_0x3e17f9[_0x0f5c('0x25')][_0x0f5c('0x79')]=_0x0f5c('0x30');respondWithRpcPromise(_0x0f5c('0x74'),_0x0f5c('0x74'),{'event':_0x0f5c('0x7a'),'message':_0x3e17f9[_0x0f5c('0x25')]},client9002);return _0x1a2a0e;}return null;})[_0x0f5c('0x1d')](respondWithResult(_0x59ff3f,null))['catch'](handleError(_0x59ff3f,null));};exports[_0x0f5c('0x28')]=function(_0x49eb9d,_0x47315e,_0x4e8484){if(_0x49eb9d['body']['id']){delete _0x49eb9d[_0x0f5c('0x53')]['id'];}var _0x19cb2a;return db['SmsMessage'][_0x0f5c('0x50')]({'where':{'id':_0x49eb9d['params']['id']}})[_0x0f5c('0x1d')](handleEntityNotFound(_0x47315e,null))['then'](function(_0x31f22c){if(_0x31f22c){_0x19cb2a=_0x31f22c;return db[_0x0f5c('0x7b')][_0x0f5c('0x50')]({'where':{'id':_0x31f22c[_0x0f5c('0x7c')]}});}})[_0x0f5c('0x1d')](handleEntityNotFound(_0x47315e,null))[_0x0f5c('0x1d')](function(_0xbff730){if(_0xbff730){logger[_0x0f5c('0x7d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x0f5c('0x28'),_0x0f5c('0x7e'),_0xbff730['type'],util[_0x0f5c('0x7f')](_0x49eb9d['body'],{'showHidden':![],'depth':null}));switch(_0xbff730[_0x0f5c('0x80')]){case _0x0f5c('0x81'):if(_0x49eb9d['body']['MessageSid']&&_0x49eb9d[_0x0f5c('0x53')][_0x0f5c('0x82')]===_0x19cb2a[_0x0f5c('0x83')]){return _0x19cb2a[_0x0f5c('0x54')]({'read':!![]});}else{logger[_0x0f5c('0x23')](_0x0f5c('0x84'),_0x0f5c('0x28'),_0x0f5c('0x81'),util['inspect'](_0x49eb9d[_0x0f5c('0x53')],{'showHidden':![],'depth':null}));}break;case _0x0f5c('0x85'):if(_0x49eb9d['body'][_0x0f5c('0x86')]&&_0x49eb9d[_0x0f5c('0x53')][_0x0f5c('0x86')]===_0x19cb2a[_0x0f5c('0x83')]&&_[_0x0f5c('0x87')]([_0x0f5c('0x88'),'delivered'],_0x49eb9d[_0x0f5c('0x53')][_0x0f5c('0x89')])>=0x0){return _0x19cb2a[_0x0f5c('0x54')]({'read':!![]});}else{logger[_0x0f5c('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0f5c('0x28'),_0x0f5c('0x8a'),util[_0x0f5c('0x7f')](_0x49eb9d[_0x0f5c('0x53')],{'showHidden':![],'depth':null}));}break;case _0x0f5c('0x8b'):var _0x141e7c=_0x49eb9d[_0x0f5c('0x53')]['results'][0x0];if(_0x141e7c[_0x0f5c('0x28')][_0x0f5c('0x8c')]===_0x0f5c('0x8d')){return _0x19cb2a[_0x0f5c('0x54')]({'read':!![]});}else{logger[_0x0f5c('0x23')](_0x0f5c('0x84'),_0x0f5c('0x28'),_0x0f5c('0x8b'),util[_0x0f5c('0x7f')](_0x49eb9d['body'],{'showHidden':![],'depth':null}));}break;}return _0x19cb2a;}})[_0x0f5c('0x1d')](respondWithResult(_0x47315e,null))['catch'](handleError(_0x47315e,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index bb6967b..ed7d85f 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 _0xe34f=['hasOwnProperty','exports','../../mysqldb','SmsMessage','setMaxListeners','save','emit'];(function(_0x5d74b6,_0xe9b6c0){var _0x15807e=function(_0x4264d9){while(--_0x4264d9){_0x5d74b6['push'](_0x5d74b6['shift']());}};_0x15807e(++_0xe9b6c0);}(_0xe34f,0x183));var _0xfe34=function(_0x3e07f8,_0x16373c){_0x3e07f8=_0x3e07f8-0x0;var _0x5caed4=_0xe34f[_0x3e07f8];return _0x5caed4;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xfe34('0x0'))['db'][_0xfe34('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xfe34('0x2')](0x0);var events={'afterCreate':_0xfe34('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x12f9d4){return function(_0x4ea6e1,_0x129384,_0x501667){SmsMessageEvents[_0xfe34('0x4')](_0x12f9d4+':'+_0x4ea6e1['id'],_0x4ea6e1);SmsMessageEvents[_0xfe34('0x4')](_0x12f9d4,_0x4ea6e1);_0x501667(null);};}for(var e in events){if(events[_0xfe34('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xfe34('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x9d49=['remove','emit','hasOwnProperty','hook','exports','events','SmsMessage','update'];(function(_0x1c62e0,_0x22dab8){var _0xddf4aa=function(_0x2d9a34){while(--_0x2d9a34){_0x1c62e0['push'](_0x1c62e0['shift']());}};_0xddf4aa(++_0x22dab8);}(_0x9d49,0x75));var _0x99d4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d49[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x99d4('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x99d4('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x99d4('0x2'),'afterDestroy':_0x99d4('0x3')};function emitEvent(_0x30ff85){return function(_0x33e97b,_0x5adb2d,_0xf60ea){SmsMessageEvents['emit'](_0x30ff85+':'+_0x33e97b['id'],_0x33e97b);SmsMessageEvents[_0x99d4('0x4')](_0x30ff85,_0x33e97b);_0xf60ea(null);};}for(var e in events){if(events[_0x99d4('0x5')](e)){var event=events[e];SmsMessage[_0x99d4('0x6')](e,emitEvent(event));}}module[_0x99d4('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index fb42ace..2e6c666 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 _0x1277=['../../config/environment','exports','define','sms_messages','messageId','body','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','update','createdAt','catch','error','find','SmsAccountId','then','type','twilio','accountSid','phone','authToken','messages','create','remote','/status?token=','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','password','GET','sms','user_key','session_key','total_sent','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','POST','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','token','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','message_uuid','infobip','/auth/1/session','baseUrl','/sms/2/text/advanced','application/json','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','timestamp','keys','sort','createHash','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x48a082,_0x2a26b9){var _0xf69a35=function(_0x210e57){while(--_0x210e57){_0x48a082['push'](_0x48a082['shift']());}};_0xf69a35(++_0x2a26b9);}(_0x1277,0x16e));var _0x7127=function(_0x46e754,_0x29ea33){_0x46e754=_0x46e754-0x0;var _0x4cab18=_0x1277[_0x46e754];return _0x4cab18;};'use strict';var _=require(_0x7127('0x0'));var util=require(_0x7127('0x1'));var logger=require(_0x7127('0x2'))(_0x7127('0x3'));var moment=require(_0x7127('0x4'));var BPromise=require(_0x7127('0x5'));var rp=require(_0x7127('0x6'));var fs=require('fs');var path=require(_0x7127('0x7'));var rimraf=require(_0x7127('0x8'));var config=require(_0x7127('0x9'));var attributes=require('./smsMessage.attributes');module[_0x7127('0xa')]=function(_0x52ef66,_0x42d305){return _0x52ef66[_0x7127('0xb')]('SmsMessage',attributes,{'tableName':_0x7127('0xc'),'paranoid':![],'indexes':[{'name':_0x7127('0xd'),'fields':[_0x7127('0xd')]},{'name':'fti_sms_messages','fields':[_0x7127('0xe')],'type':_0x7127('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x499c8f,_0x3ac85b,_0x275547){var _0x12eef6=_0x52ef66[_0x7127('0x10')];var _0x55752e=_0x499c8f[_0x7127('0x11')]({'plain':!![]});if(_0x55752e[_0x7127('0x12')][_0x7127('0x13')]()==='in'||_0x55752e['direction'][_0x7127('0x13')]()==='out'&&!_0x55752e[_0x7127('0x14')]&&!_['isNil'](_0x55752e[_0x7127('0x15')])&&!_[_0x7127('0x16')](_0x55752e[_0x7127('0x17')])){_0x12eef6[_0x7127('0x18')][_0x7127('0x19')]({'where':{'id':_0x55752e[_0x7127('0x17')]}})['then'](function(_0x4a9709){if(_0x4a9709){_0x4a9709[_0x7127('0x1a')]({'lastMsgAt':_0x55752e[_0x7127('0x1b')],'lastMsgDirection':_0x55752e[_0x7127('0x12')][_0x7127('0x13')]()});}})[_0x7127('0x1c')](function(_0x1260af){console[_0x7127('0x1d')](_0x1260af);});}if(_0x55752e[_0x7127('0x12')]==='out'&&!_0x55752e[_0x7127('0x14')]){var _0x274ba2;_0x12eef6['SmsAccount'][_0x7127('0x1e')]({'where':{'id':_0x55752e[_0x7127('0x1f')]},'raw':!![]})[_0x7127('0x20')](function(_0x500cd1){_0x274ba2=_0x500cd1;if(_0x274ba2&&_0x274ba2[_0x7127('0x21')]){switch(_0x274ba2[_0x7127('0x21')]){case _0x7127('0x22'):var _0x5d904b=require(_0x7127('0x22'));if(_0x274ba2[_0x7127('0x23')]&&_0x274ba2['authToken']&&_0x274ba2[_0x7127('0x24')]){var _0x289805=new _0x5d904b(_0x274ba2['accountSid'],_0x274ba2[_0x7127('0x25')]);_0x289805[_0x7127('0x26')][_0x7127('0x27')]({'body':_0x55752e[_0x7127('0xe')],'to':_0x55752e[_0x7127('0x24')],'from':_0x274ba2[_0x7127('0x24')],'statusCallback':_0x274ba2[_0x7127('0x28')]+'/api/sms/messages/'+_0x55752e['id']+_0x7127('0x29')+_0x274ba2['token']})[_0x7127('0x20')](function(_0x191940){if(_0x191940['sid']){return _0x499c8f[_0x7127('0x1a')]({'messageId':_0x191940[_0x7127('0x2a')]});}})[_0x7127('0x1c')](function(_0x12397d){logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),_0x7127('0x22'),util[_0x7127('0x2c')](_0x12397d,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x22'),_0x7127('0x2e'));}break;case _0x7127('0x2f'):var _0x5e906e=_0x7127('0x30');if(_0x274ba2[_0x7127('0x31')]&&_0x274ba2['password']){var _0x3197e4={'recipient':[_0x55752e['phone']],'message':_0x55752e[_0x7127('0xe')],'message_type':_0x274ba2[_0x7127('0x32')]};if(_0x274ba2[_0x7127('0x32')]&&_0x274ba2[_0x7127('0x32')]!=='SI'){_0x3197e4[_0x7127('0x33')]=_0x274ba2['phone'];}var _0x3c7514={'url':_0x5e906e+_0x7127('0x34')+_0x274ba2[_0x7127('0x31')]+'&password='+_0x274ba2[_0x7127('0x35')],'method':_0x7127('0x36')};rp(_0x3c7514)['then'](function(_0x1303f5){var _0x28b689=_0x1303f5['split'](';');var _0x44f772={'user_key':_0x28b689[0x0],'session_key':_0x28b689[0x1]};_0x3c7514={'url':_0x5e906e+_0x7127('0x37'),'method':'POST','headers':{'user_key':_0x44f772[_0x7127('0x38')],'Session_key':_0x44f772[_0x7127('0x39')]},'json':!![],'body':_0x3197e4};return rp(_0x3c7514);})[_0x7127('0x20')](function(_0x157d1a){if(_0x157d1a[_0x7127('0x3a')]>=0x1){var _0x5d752b={'messageId':_0x157d1a['internal_order_id']};if(_0x274ba2['smsMethod']!=='GP'||!_0x274ba2[_0x7127('0x3b')]){_0x5d752b[_0x7127('0x3c')]=!![];}return _0x499c8f[_0x7127('0x1a')](_0x5d752b);}else{return logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'skebby',util['inspect'](_0x157d1a,{'showHidden':![],'depth':null}));}})[_0x7127('0x1c')](function(_0x58b67c){return logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),'skebby',util[_0x7127('0x2c')](_0x58b67c,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'skebby',_0x7127('0x3d'));}break;case'connectel':if(_0x274ba2[_0x7127('0x25')]){var _0x7a4a1b={'recipient':_0x55752e[_0x7127('0x24')],'message':_0x55752e['body'],'sender':_0x274ba2[_0x7127('0x3e')]||_0x274ba2[_0x7127('0x24')],'authorization':_0x274ba2[_0x7127('0x25')]};var _0x3ac85b={'method':_0x7127('0x3f'),'uri':_0x7127('0x40'),'body':_0x7a4a1b,'json':!![]};rp(_0x3ac85b)[_0x7127('0x20')](function(_0x28f924){var _0x3f8af5={'messageId':_0x28f924['requestid']};if(!_0x274ba2[_0x7127('0x3b')]){_0x3f8af5['read']=!![];}return _0x499c8f[_0x7127('0x1a')](_0x3f8af5);})['catch'](function(_0x447db8){logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x41'),util[_0x7127('0x2c')](_0x447db8,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),'connectel',_0x7127('0x42'));}break;case _0x7127('0x43'):if(_0x274ba2[_0x7127('0x31')]&&_0x274ba2[_0x7127('0x35')]){var _0x7a4a1b={'messages':[{'source':'xCALLY\x20Motion','to':_0x55752e[_0x7127('0x24')],'body':_0x55752e['body'],'from':_0x274ba2[_0x7127('0x3e')]||_0x274ba2[_0x7127('0x24')]}]};var _0x45c55c=util[_0x7127('0x44')](_0x7127('0x45'),_0x274ba2[_0x7127('0x31')],_0x274ba2[_0x7127('0x35')]);var _0x3ac85b={'method':_0x7127('0x3f'),'uri':_0x7127('0x46'),'body':_0x7a4a1b,'headers':{'Authorization':util[_0x7127('0x44')]('Basic\x20%s',new Buffer(_0x45c55c)[_0x7127('0x47')](_0x7127('0x48')))},'json':!![]};rp(_0x3ac85b)['then'](function(_0x8dc319){if(_0x8dc319['http_code']>=0xc8&&_0x8dc319[_0x7127('0x49')]<=0xce){if(_0x8dc319['data']&&_0x8dc319[_0x7127('0x4a')][_0x7127('0x4b')]>0x0){var _0x24774e=_[_0x7127('0x4c')](_0x8dc319[_0x7127('0x4a')][_0x7127('0x26')]);var _0x514d75={'messageId':_0x24774e[_0x7127('0x4d')]};if(!_0x274ba2[_0x7127('0x3b')]){_0x514d75[_0x7127('0x3c')]=!![];}return _0x499c8f[_0x7127('0x1a')](_0x514d75);}else{logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),_0x7127('0x4e'),util[_0x7127('0x2c')](_0x8dc319,{'showHidden':![],'depth':null}));}}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'clickSend',util[_0x7127('0x2c')](_0x8dc319,{'showHidden':![],'depth':null}));}})[_0x7127('0x1c')](function(_0x2dd300){logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7127('0x4e'),util[_0x7127('0x2c')](_0x2dd300,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'clickSend',_0x7127('0x3d'));}break;case _0x7127('0x4f'):if(_0x274ba2[_0x7127('0x50')]&&_0x274ba2[_0x7127('0x25')]){var _0x7a4a1b={'dst':_0x55752e[_0x7127('0x24')],'text':_0x55752e[_0x7127('0xe')],'src':_0x274ba2[_0x7127('0x3e')]||_0x274ba2[_0x7127('0x24')],'url':_0x274ba2[_0x7127('0x28')]+_0x7127('0x51')+_0x55752e['id']+'/status?token='+_0x274ba2[_0x7127('0x52')]};var _0x45c55c=util[_0x7127('0x44')](_0x7127('0x45'),_0x274ba2[_0x7127('0x50')],_0x274ba2[_0x7127('0x25')]);var _0x3ac85b={'method':'POST','uri':util['format'](_0x7127('0x53'),_0x274ba2[_0x7127('0x50')]),'body':_0x7a4a1b,'headers':{'Authorization':util[_0x7127('0x44')](_0x7127('0x54'),new Buffer(_0x45c55c)[_0x7127('0x47')](_0x7127('0x48')))},'json':!![]};rp(_0x3ac85b)['then'](function(_0x35212f){var _0x3707c8={'messageId':_0x35212f[_0x7127('0x55')][0x0]};return _0x499c8f[_0x7127('0x1a')](_0x3707c8);})[_0x7127('0x1c')](function(_0x2ddf6a){logger[_0x7127('0x1d')](_0x7127('0x2d'),'afterCreate','plivo',util[_0x7127('0x2c')](_0x2ddf6a,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x4f'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x7127('0x56'):if(_0x274ba2[_0x7127('0x31')]&&_0x274ba2[_0x7127('0x35')]){if(_0x274ba2['baseUrl']){var _0x5002b2={'method':_0x7127('0x3f'),'uri':_0x274ba2['baseUrl']+_0x7127('0x57'),'body':{'username':_0x274ba2[_0x7127('0x31')],'password':_0x274ba2[_0x7127('0x35')]},'json':!![]};return rp(_0x5002b2)['then'](function(_0x1a436a){var _0x2c4b0f={'method':_0x7127('0x3f'),'uri':_0x274ba2[_0x7127('0x58')]+_0x7127('0x59'),'body':{'messages':[{'from':_0x274ba2['phone'],'destinations':[{'to':_0x55752e[_0x7127('0x24')]}],'text':_0x55752e['body'],'notifyUrl':_0x274ba2[_0x7127('0x28')]+_0x7127('0x51')+_0x55752e['id']+_0x7127('0x29')+_0x274ba2[_0x7127('0x52')],'notifyContentType':_0x7127('0x5a'),'callbackData':_0x274ba2['phone']+';'+_0x55752e['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x1a436a['token']},'json':!![]};return rp(_0x2c4b0f)['then'](function(_0x5560f8){if(_0x5560f8['messages']){var _0x21805b={'messageId':_0x5560f8['messages'][0x0][_0x7127('0xd')]};if(!_0x274ba2[_0x7127('0x3b')]){_0x21805b[_0x7127('0x3c')]=!![];}return _0x499c8f[_0x7127('0x1a')](_0x21805b);}else{return logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'infobip',util[_0x7127('0x2c')](_0x5560f8,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2cc608){return logger[_0x7127('0x1d')](_0x7127('0x2d'),'afterCreate',_0x7127('0x56'),util[_0x7127('0x2c')](_0x2cc608,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),_0x7127('0x56'),_0x7127('0x5b'));}}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x56'),_0x7127('0x3d'));}break;case _0x7127('0x5c'):var _0xb78c05=require(_0x7127('0x5d'));if(_0x274ba2[_0x7127('0x5e')]){var _0x2976d6={};_0x2976d6[_0x7127('0x5f')]=_0x274ba2[_0x7127('0x31')];_0x2976d6[_0x7127('0x24')]=_0x55752e[_0x7127('0x24')];_0x2976d6[_0x7127('0x33')]=_0x274ba2['phone'];_0x2976d6['text']=_0x55752e[_0x7127('0xe')];_0x2976d6[_0x7127('0x60')]=+new Date();var _0x33a1fa='';var _0x4a9421='';var _0x3c5a7d=Object[_0x7127('0x61')](_0x2976d6);_0x3c5a7d[_0x7127('0x62')]();for(var _0x4ee2f2=0x0;_0x4ee2f2<_0x3c5a7d['length'];_0x4ee2f2++){if(_0x33a1fa!=''){_0x33a1fa+='&';}_0x33a1fa+=_0x3c5a7d[_0x4ee2f2]+'='+encodeURIComponent(_0x2976d6[_0x3c5a7d[_0x4ee2f2]]);_0x4a9421+=_0x2976d6[_0x3c5a7d[_0x4ee2f2]];}_0x4a9421+=_0x274ba2[_0x7127('0x5e')];_0x4a9421=_0xb78c05[_0x7127('0x63')]('md5')['update'](_0x4a9421)[_0x7127('0x64')](_0x7127('0x65'));if(_0x33a1fa!==''){_0x33a1fa+='&';}_0x33a1fa+=_0x7127('0x66')+_0x4a9421;var _0x3c7514={'method':_0x7127('0x36'),'uri':_0x274ba2[_0x7127('0x58')]+_0x7127('0x67')+_0x33a1fa,'json':!![]};return rp(_0x3c7514)[_0x7127('0x20')](function(_0x4e088d){var _0x2125f8=Object[_0x7127('0x61')](_0x4e088d);if(_0x4e088d[_0x2125f8[0x0]][_0x7127('0x1d')]&&parseInt(_0x4e088d[_0x2125f8[0x0]]['error'])===0x0){var _0x40202c={'messageId':_0x4e088d[_0x2125f8[0x0]]['id_sms']};if(!_0x274ba2[_0x7127('0x3b')]){_0x40202c[_0x7127('0x3c')]=!![];}return _0x499c8f[_0x7127('0x1a')](_0x40202c);}else{return logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),_0x7127('0x5c'),util['inspect'](_0x4e088d['error'],{'showHidden':![],'depth':null}));}})[_0x7127('0x1c')](function(_0x3c7404){return logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'csc',util['inspect'](_0x3c7404,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'csc',_0x7127('0x68'));}break;case _0x7127('0x69'):if(_0x274ba2[_0x7127('0x5e')]){var _0xe2dfea={'method':_0x7127('0x3f'),'uri':_0x7127('0x6a'),'headers':{'Authorization':_0x274ba2[_0x7127('0x5e')]},'body':{'content':_0x55752e['body'],'to':[_0x55752e[_0x7127('0x24')]],'from':_0x274ba2[_0x7127('0x24')],'binary':![],'clientMessageId':'uuid','charset':_0x7127('0x6b')},'json':!![]};rp(_0xe2dfea)[_0x7127('0x20')](function(_0x52ad70){if(!_0x52ad70[_0x7127('0x1d')]){var _0x46d6a6={'messageId':_0x52ad70[_0x7127('0x26')][0x0][_0x7127('0x6c')]};if(!_0x274ba2[_0x7127('0x3b')]){_0x46d6a6['read']=!![];}return _0x499c8f[_0x7127('0x1a')](_0x46d6a6);}else{return logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x69'),util[_0x7127('0x2c')](_0x52ad70[_0x7127('0x1d')],{'showHidden':![],'depth':null}));}})[_0x7127('0x1c')](function(_0x2f9b74){return logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),'clickatell',util[_0x7127('0x2c')](_0x2f9b74,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x69'),_0x7127('0x68'));}break;case _0x7127('0x6d'):if(_0x274ba2[_0x7127('0x31')]&&_0x274ba2[_0x7127('0x35')]){var _0x45c55c=util['format'](_0x7127('0x45'),_0x274ba2['username'],_0x274ba2[_0x7127('0x35')]);var _0x3ac85b={'method':_0x7127('0x3f'),'uri':_0x7127('0x6e')+_0x274ba2[_0x7127('0x6f')]+_0x7127('0x70'),'body':{'to':[_0x55752e[_0x7127('0x24')]],'text':_0x55752e[_0x7127('0xe')],'from':_0x274ba2[_0x7127('0x24')],'applicationId':_0x274ba2[_0x7127('0x71')]},'headers':{'Authorization':util['format'](_0x7127('0x54'),new Buffer(_0x45c55c)['toString'](_0x7127('0x48')))},'json':!![]};rp(_0x3ac85b)['then'](function(_0x4c4b88){if(_0x4c4b88['id']){var _0x5485be={'messageId':_0x4c4b88['id']};return _0x499c8f['update'](_0x5485be);}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),'afterCreate',_0x7127('0x6d'),util[_0x7127('0x2c')](_0x4c4b88,{'showHidden':![],'depth':null}));}})[_0x7127('0x1c')](function(_0x1bfdc8){logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),'bandwidth',util['inspect'](_0x1bfdc8,{'showHidden':![],'depth':null}));});}else{logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x6d'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7127('0x72'):if(_0x274ba2[_0x7127('0x5e')]){var _0x52aefe={};var _0x3c7514={'method':_0x7127('0x3f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x7127('0x73')+_0x274ba2[_0x7127('0x5e')],'Content-Type':'application/json'},'body':{'from':_0x274ba2['phone'],'to':_0x55752e[_0x7127('0x24')],'text':_0x55752e[_0x7127('0xe')]},'json':!![]};return rp(_0x3c7514)[_0x7127('0x20')](function(_0x2271cd){if(_0x2271cd[_0x7127('0x74')]==0xca){_0x52aefe['message']=_0x2271cd;var _0x1c7aac={'method':_0x7127('0x3f'),'uri':_0x7127('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x274ba2[_0x7127('0x5e')],'Content-Type':_0x7127('0x5a')},'body':{'refid':_0x52aefe[_0x7127('0x76')]['refid']},'json':!![]};return rp(_0x1c7aac)[_0x7127('0x20')](function(_0x4fe922){_0x52aefe[_0x7127('0x77')]=_0x4fe922;var _0x5747cf={'messageId':_0x52aefe[_0x7127('0x76')][_0x7127('0x78')],'read':!![]};return _0x499c8f[_0x7127('0x1a')](_0x5747cf);});}else{return logger[_0x7127('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7127('0x2b'),_0x7127('0x72'),util['inspect'](_0x2271cd,{'showHidden':![],'depth':null}));}})[_0x7127('0x1c')](function(_0x4ce4e0){return logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x72'),util['inspect'](_0x4ce4e0,{'showHidden':![],'depth':null}));});}else{return logger[_0x7127('0x1d')](_0x7127('0x2d'),_0x7127('0x2b'),_0x7127('0x72'),_0x7127('0x79'));}break;}}})[_0x7127('0x7a')](function(){_0x275547();});}else{_0x275547();}}},'charset':_0x7127('0x7b'),'collate':_0x7127('0x7c')});}; \ No newline at end of file +var _0xdf56=['Basic\x20%s','toString','base64','http_code','data','head','messages','message_id','clickSend','authId','/status?token=','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messageId','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','length','apiKey','md5','digest','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','code','Bearer\x20','message','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','exports','define','SmsMessage','sms_messages','fti_sms_messages','body','models','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','find','SmsAccountId','type','twilio','accountSid','phone','authToken','create','/api/sms/messages/','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','sms','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','skebby','inspect','Missing\x20parameters:\x20username,\x20password','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send'];(function(_0x146050,_0x24a4d8){var _0x179a48=function(_0xb524b1){while(--_0xb524b1){_0x146050['push'](_0x146050['shift']());}};_0x179a48(++_0x24a4d8);}(_0xdf56,0xae));var _0x6df5=function(_0x534f4f,_0xd9e172){_0x534f4f=_0x534f4f-0x0;var _0x3aa387=_0xdf56[_0x534f4f];return _0x3aa387;};'use strict';var _=require(_0x6df5('0x0'));var util=require('util');var logger=require(_0x6df5('0x1'))('api');var moment=require(_0x6df5('0x2'));var BPromise=require(_0x6df5('0x3'));var rp=require(_0x6df5('0x4'));var fs=require('fs');var path=require(_0x6df5('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0x6df5('0x6')]=function(_0x37b135,_0x253d83){return _0x37b135[_0x6df5('0x7')](_0x6df5('0x8'),attributes,{'tableName':_0x6df5('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x6df5('0xa'),'fields':[_0x6df5('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f0525,_0x14da6d,_0x5b64e4){var _0x18ba81=_0x37b135[_0x6df5('0xc')];var _0x10bf47=_0x4f0525[_0x6df5('0xd')]({'plain':!![]});if(_0x10bf47['direction'][_0x6df5('0xe')]()==='in'||_0x10bf47[_0x6df5('0xf')][_0x6df5('0xe')]()===_0x6df5('0x10')&&!_0x10bf47[_0x6df5('0x11')]&&!_[_0x6df5('0x12')](_0x10bf47[_0x6df5('0x13')])&&!_[_0x6df5('0x12')](_0x10bf47[_0x6df5('0x14')])){_0x18ba81[_0x6df5('0x15')][_0x6df5('0x16')]({'where':{'id':_0x10bf47['SmsInteractionId']}})[_0x6df5('0x17')](function(_0x2acd97){if(_0x2acd97){_0x2acd97[_0x6df5('0x18')]({'lastMsgAt':_0x10bf47[_0x6df5('0x19')],'lastMsgDirection':_0x10bf47[_0x6df5('0xf')]['toLowerCase']()});}})[_0x6df5('0x1a')](function(_0x256133){console[_0x6df5('0x1b')](_0x256133);});}if(_0x10bf47[_0x6df5('0xf')]===_0x6df5('0x10')&&!_0x10bf47['secret']){var _0x2ff54d;_0x18ba81['SmsAccount'][_0x6df5('0x1c')]({'where':{'id':_0x10bf47[_0x6df5('0x1d')]},'raw':!![]})[_0x6df5('0x17')](function(_0x30b025){_0x2ff54d=_0x30b025;if(_0x2ff54d&&_0x2ff54d[_0x6df5('0x1e')]){switch(_0x2ff54d[_0x6df5('0x1e')]){case _0x6df5('0x1f'):var _0x45757c=require(_0x6df5('0x1f'));if(_0x2ff54d[_0x6df5('0x20')]&&_0x2ff54d['authToken']&&_0x2ff54d[_0x6df5('0x21')]){var _0x2e05d4=new _0x45757c(_0x2ff54d[_0x6df5('0x20')],_0x2ff54d[_0x6df5('0x22')]);_0x2e05d4['messages'][_0x6df5('0x23')]({'body':_0x10bf47[_0x6df5('0xb')],'to':_0x10bf47[_0x6df5('0x21')],'from':_0x2ff54d[_0x6df5('0x21')],'statusCallback':_0x2ff54d['remote']+_0x6df5('0x24')+_0x10bf47['id']+'/status?token='+_0x2ff54d[_0x6df5('0x25')]})['then'](function(_0x261e40){if(_0x261e40[_0x6df5('0x26')]){return _0x4f0525[_0x6df5('0x18')]({'messageId':_0x261e40['sid']});}})['catch'](function(_0x50b6f1){logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x1f'),util['inspect'](_0x50b6f1,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x1f'),_0x6df5('0x29'));}break;case'skebby':var _0x1413d5=_0x6df5('0x2a');if(_0x2ff54d['username']&&_0x2ff54d[_0x6df5('0x2b')]){var _0x3a8d4c={'recipient':[_0x10bf47[_0x6df5('0x21')]],'message':_0x10bf47['body'],'message_type':_0x2ff54d[_0x6df5('0x2c')]};if(_0x2ff54d['smsMethod']&&_0x2ff54d[_0x6df5('0x2c')]!=='SI'){_0x3a8d4c[_0x6df5('0x2d')]=_0x2ff54d[_0x6df5('0x21')];}var _0x5d4d6d={'url':_0x1413d5+_0x6df5('0x2e')+_0x2ff54d[_0x6df5('0x2f')]+_0x6df5('0x30')+_0x2ff54d[_0x6df5('0x2b')],'method':_0x6df5('0x31')};rp(_0x5d4d6d)[_0x6df5('0x17')](function(_0x46e975){var _0x5c1819=_0x46e975['split'](';');var _0x4c921c={'user_key':_0x5c1819[0x0],'session_key':_0x5c1819[0x1]};_0x5d4d6d={'url':_0x1413d5+_0x6df5('0x32'),'method':'POST','headers':{'user_key':_0x4c921c[_0x6df5('0x33')],'Session_key':_0x4c921c[_0x6df5('0x34')]},'json':!![],'body':_0x3a8d4c};return rp(_0x5d4d6d);})[_0x6df5('0x17')](function(_0x3db146){if(_0x3db146[_0x6df5('0x35')]>=0x1){var _0x4ae07c={'messageId':_0x3db146[_0x6df5('0x36')]};if(_0x2ff54d[_0x6df5('0x2c')]!=='GP'||!_0x2ff54d[_0x6df5('0x37')]){_0x4ae07c[_0x6df5('0x38')]=!![];}return _0x4f0525[_0x6df5('0x18')](_0x4ae07c);}else{return logger[_0x6df5('0x1b')](_0x6df5('0x27'),'afterCreate',_0x6df5('0x39'),util['inspect'](_0x3db146,{'showHidden':![],'depth':null}));}})[_0x6df5('0x1a')](function(_0x4c071e){return logger['error'](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x39'),util[_0x6df5('0x3a')](_0x4c071e,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x39'),_0x6df5('0x3b'));}break;case'connectel':if(_0x2ff54d[_0x6df5('0x22')]){var _0xc4b94d={'recipient':_0x10bf47[_0x6df5('0x21')],'message':_0x10bf47[_0x6df5('0xb')],'sender':_0x2ff54d[_0x6df5('0x3c')]||_0x2ff54d[_0x6df5('0x21')],'authorization':_0x2ff54d['authToken']};var _0x14da6d={'method':_0x6df5('0x3d'),'uri':_0x6df5('0x3e'),'body':_0xc4b94d,'json':!![]};rp(_0x14da6d)[_0x6df5('0x17')](function(_0x44ce33){var _0x17e503={'messageId':_0x44ce33[_0x6df5('0x3f')]};if(!_0x2ff54d[_0x6df5('0x37')]){_0x17e503[_0x6df5('0x38')]=!![];}return _0x4f0525['update'](_0x17e503);})[_0x6df5('0x1a')](function(_0x3b8b12){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6df5('0x28'),_0x6df5('0x40'),util['inspect'](_0x3b8b12,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),'afterCreate',_0x6df5('0x40'),_0x6df5('0x41'));}break;case _0x6df5('0x42'):if(_0x2ff54d[_0x6df5('0x2f')]&&_0x2ff54d[_0x6df5('0x2b')]){var _0xc4b94d={'messages':[{'source':'xCALLY\x20Motion','to':_0x10bf47['phone'],'body':_0x10bf47['body'],'from':_0x2ff54d[_0x6df5('0x3c')]||_0x2ff54d[_0x6df5('0x21')]}]};var _0x2c2dc7=util[_0x6df5('0x43')](_0x6df5('0x44'),_0x2ff54d['username'],_0x2ff54d[_0x6df5('0x2b')]);var _0x14da6d={'method':_0x6df5('0x3d'),'uri':_0x6df5('0x45'),'body':_0xc4b94d,'headers':{'Authorization':util['format'](_0x6df5('0x46'),new Buffer(_0x2c2dc7)[_0x6df5('0x47')](_0x6df5('0x48')))},'json':!![]};rp(_0x14da6d)[_0x6df5('0x17')](function(_0x208dfa){if(_0x208dfa[_0x6df5('0x49')]>=0xc8&&_0x208dfa['http_code']<=0xce){if(_0x208dfa[_0x6df5('0x4a')]&&_0x208dfa[_0x6df5('0x4a')]['queued_count']>0x0){var _0x48a445=_[_0x6df5('0x4b')](_0x208dfa[_0x6df5('0x4a')][_0x6df5('0x4c')]);var _0x1ed8c5={'messageId':_0x48a445[_0x6df5('0x4d')]};if(!_0x2ff54d[_0x6df5('0x37')]){_0x1ed8c5['read']=!![];}return _0x4f0525['update'](_0x1ed8c5);}else{logger['error'](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x4e'),util['inspect'](_0x208dfa,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6df5('0x27'),'afterCreate',_0x6df5('0x4e'),util['inspect'](_0x208dfa,{'showHidden':![],'depth':null}));}})[_0x6df5('0x1a')](function(_0x124a0d){logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),'clickSend',util[_0x6df5('0x3a')](_0x124a0d,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x4e'),_0x6df5('0x3b'));}break;case'plivo':if(_0x2ff54d[_0x6df5('0x4f')]&&_0x2ff54d[_0x6df5('0x22')]){var _0xc4b94d={'dst':_0x10bf47['phone'],'text':_0x10bf47[_0x6df5('0xb')],'src':_0x2ff54d['senderString']||_0x2ff54d[_0x6df5('0x21')],'url':_0x2ff54d['remote']+_0x6df5('0x24')+_0x10bf47['id']+_0x6df5('0x50')+_0x2ff54d[_0x6df5('0x25')]};var _0x2c2dc7=util[_0x6df5('0x43')]('%s:%s',_0x2ff54d[_0x6df5('0x4f')],_0x2ff54d[_0x6df5('0x22')]);var _0x14da6d={'method':_0x6df5('0x3d'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x2ff54d['authId']),'body':_0xc4b94d,'headers':{'Authorization':util['format'](_0x6df5('0x46'),new Buffer(_0x2c2dc7)[_0x6df5('0x47')]('base64'))},'json':!![]};rp(_0x14da6d)[_0x6df5('0x17')](function(_0x3a186c){var _0x2b5a43={'messageId':_0x3a186c[_0x6df5('0x51')][0x0]};return _0x4f0525['update'](_0x2b5a43);})[_0x6df5('0x1a')](function(_0x1c7122){logger['error'](_0x6df5('0x27'),'afterCreate',_0x6df5('0x52'),util[_0x6df5('0x3a')](_0x1c7122,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),'afterCreate','plivo',_0x6df5('0x53'));}break;case _0x6df5('0x54'):if(_0x2ff54d[_0x6df5('0x2f')]&&_0x2ff54d[_0x6df5('0x2b')]){if(_0x2ff54d[_0x6df5('0x55')]){var _0x126083={'method':_0x6df5('0x3d'),'uri':_0x2ff54d['baseUrl']+_0x6df5('0x56'),'body':{'username':_0x2ff54d[_0x6df5('0x2f')],'password':_0x2ff54d[_0x6df5('0x2b')]},'json':!![]};return rp(_0x126083)['then'](function(_0x3550ac){var _0x144baf={'method':_0x6df5('0x3d'),'uri':_0x2ff54d['baseUrl']+_0x6df5('0x57'),'body':{'messages':[{'from':_0x2ff54d[_0x6df5('0x21')],'destinations':[{'to':_0x10bf47['phone']}],'text':_0x10bf47[_0x6df5('0xb')],'notifyUrl':_0x2ff54d['remote']+_0x6df5('0x24')+_0x10bf47['id']+'/status?token='+_0x2ff54d[_0x6df5('0x25')],'notifyContentType':_0x6df5('0x58'),'callbackData':_0x2ff54d[_0x6df5('0x21')]+';'+_0x10bf47[_0x6df5('0xb')]}]},'headers':{'Authorization':_0x6df5('0x59')+_0x3550ac[_0x6df5('0x25')]},'json':!![]};return rp(_0x144baf)[_0x6df5('0x17')](function(_0x25bb25){if(_0x25bb25['messages']){var _0x47dc54={'messageId':_0x25bb25[_0x6df5('0x4c')][0x0][_0x6df5('0x5a')]};if(!_0x2ff54d[_0x6df5('0x37')]){_0x47dc54[_0x6df5('0x38')]=!![];}return _0x4f0525[_0x6df5('0x18')](_0x47dc54);}else{return logger['error'](_0x6df5('0x27'),_0x6df5('0x28'),'infobip',util[_0x6df5('0x3a')](_0x25bb25,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x38e4fb){return logger['error'](_0x6df5('0x27'),_0x6df5('0x28'),'infobip',util[_0x6df5('0x3a')](_0x38e4fb,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x54'),_0x6df5('0x5b'));}}else{logger[_0x6df5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6df5('0x28'),_0x6df5('0x54'),_0x6df5('0x3b'));}break;case _0x6df5('0x5c'):var _0xa292e8=require(_0x6df5('0x5d'));if(_0x2ff54d['apiKey']){var _0x5c493b={};_0x5c493b[_0x6df5('0x5e')]=_0x2ff54d[_0x6df5('0x2f')];_0x5c493b[_0x6df5('0x21')]=_0x10bf47[_0x6df5('0x21')];_0x5c493b[_0x6df5('0x2d')]=_0x2ff54d[_0x6df5('0x21')];_0x5c493b[_0x6df5('0x5f')]=_0x10bf47[_0x6df5('0xb')];_0x5c493b[_0x6df5('0x60')]=+new Date();var _0x19a9fc='';var _0x3315f4='';var _0xece430=Object[_0x6df5('0x61')](_0x5c493b);_0xece430['sort']();for(var _0x14915f=0x0;_0x14915f<_0xece430[_0x6df5('0x62')];_0x14915f++){if(_0x19a9fc!=''){_0x19a9fc+='&';}_0x19a9fc+=_0xece430[_0x14915f]+'='+encodeURIComponent(_0x5c493b[_0xece430[_0x14915f]]);_0x3315f4+=_0x5c493b[_0xece430[_0x14915f]];}_0x3315f4+=_0x2ff54d[_0x6df5('0x63')];_0x3315f4=_0xa292e8['createHash'](_0x6df5('0x64'))['update'](_0x3315f4)[_0x6df5('0x65')]('hex');if(_0x19a9fc!==''){_0x19a9fc+='&';}_0x19a9fc+='signature='+_0x3315f4;var _0x5d4d6d={'method':_0x6df5('0x31'),'uri':_0x2ff54d[_0x6df5('0x55')]+_0x6df5('0x66')+_0x19a9fc,'json':!![]};return rp(_0x5d4d6d)[_0x6df5('0x17')](function(_0x142951){var _0x44292d=Object[_0x6df5('0x61')](_0x142951);if(_0x142951[_0x44292d[0x0]][_0x6df5('0x1b')]&&parseInt(_0x142951[_0x44292d[0x0]][_0x6df5('0x1b')])===0x0){var _0x575f8a={'messageId':_0x142951[_0x44292d[0x0]][_0x6df5('0x67')]};if(!_0x2ff54d[_0x6df5('0x37')]){_0x575f8a[_0x6df5('0x38')]=!![];}return _0x4f0525[_0x6df5('0x18')](_0x575f8a);}else{return logger[_0x6df5('0x1b')](_0x6df5('0x27'),'afterCreate',_0x6df5('0x5c'),util['inspect'](_0x142951['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x572c9d){return logger[_0x6df5('0x1b')](_0x6df5('0x27'),'afterCreate',_0x6df5('0x5c'),util[_0x6df5('0x3a')](_0x572c9d,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x5c'),_0x6df5('0x68'));}break;case _0x6df5('0x69'):if(_0x2ff54d[_0x6df5('0x63')]){var _0x122cad={'method':'POST','uri':_0x6df5('0x6a'),'headers':{'Authorization':_0x2ff54d[_0x6df5('0x63')]},'body':{'content':_0x10bf47['body'],'to':[_0x10bf47[_0x6df5('0x21')]],'from':_0x2ff54d['phone'],'binary':![],'clientMessageId':_0x6df5('0x6b'),'charset':'UTF-8'},'json':!![]};rp(_0x122cad)['then'](function(_0x560671){if(!_0x560671[_0x6df5('0x1b')]){var _0x5065d7={'messageId':_0x560671['messages'][0x0][_0x6df5('0x6c')]};if(!_0x2ff54d[_0x6df5('0x37')]){_0x5065d7[_0x6df5('0x38')]=!![];}return _0x4f0525[_0x6df5('0x18')](_0x5065d7);}else{return logger[_0x6df5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6df5('0x28'),'clickatell',util[_0x6df5('0x3a')](_0x560671[_0x6df5('0x1b')],{'showHidden':![],'depth':null}));}})[_0x6df5('0x1a')](function(_0x357d77){return logger[_0x6df5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6df5('0x28'),_0x6df5('0x69'),util[_0x6df5('0x3a')](_0x357d77,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),'clickatell',_0x6df5('0x68'));}break;case _0x6df5('0x6d'):if(_0x2ff54d['username']&&_0x2ff54d['password']){var _0x2c2dc7=util[_0x6df5('0x43')](_0x6df5('0x44'),_0x2ff54d[_0x6df5('0x2f')],_0x2ff54d[_0x6df5('0x2b')]);var _0x14da6d={'method':'POST','uri':_0x6df5('0x6e')+_0x2ff54d[_0x6df5('0x6f')]+_0x6df5('0x70'),'body':{'to':[_0x10bf47[_0x6df5('0x21')]],'text':_0x10bf47[_0x6df5('0xb')],'from':_0x2ff54d[_0x6df5('0x21')],'applicationId':_0x2ff54d[_0x6df5('0x71')]},'headers':{'Authorization':util[_0x6df5('0x43')](_0x6df5('0x46'),new Buffer(_0x2c2dc7)[_0x6df5('0x47')](_0x6df5('0x48')))},'json':!![]};rp(_0x14da6d)[_0x6df5('0x17')](function(_0x15a956){if(_0x15a956['id']){var _0x23ed54={'messageId':_0x15a956['id']};return _0x4f0525[_0x6df5('0x18')](_0x23ed54);}else{logger[_0x6df5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6df5('0x28'),'bandwidth',util[_0x6df5('0x3a')](_0x15a956,{'showHidden':![],'depth':null}));}})[_0x6df5('0x1a')](function(_0x5e352c){logger['error'](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x6d'),util[_0x6df5('0x3a')](_0x5e352c,{'showHidden':![],'depth':null}));});}else{logger[_0x6df5('0x1b')](_0x6df5('0x27'),'afterCreate',_0x6df5('0x6d'),_0x6df5('0x3b'));}break;case _0x6df5('0x72'):if(_0x2ff54d[_0x6df5('0x63')]){var _0x3e101d={};var _0x5d4d6d={'method':_0x6df5('0x3d'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x2ff54d['apiKey'],'Content-Type':_0x6df5('0x58')},'body':{'from':_0x2ff54d[_0x6df5('0x21')],'to':_0x10bf47['phone'],'text':_0x10bf47[_0x6df5('0xb')]},'json':!![]};return rp(_0x5d4d6d)[_0x6df5('0x17')](function(_0x46da4e){if(_0x46da4e[_0x6df5('0x73')]==0xca){_0x3e101d['message']=_0x46da4e;var _0x27da9b={'method':_0x6df5('0x3d'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0x6df5('0x74')+_0x2ff54d[_0x6df5('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x3e101d[_0x6df5('0x75')]['refid']},'json':!![]};return rp(_0x27da9b)['then'](function(_0x4cb548){_0x3e101d['status']=_0x4cb548;var _0x37419c={'messageId':_0x3e101d[_0x6df5('0x75')][_0x6df5('0x76')],'read':!![]};return _0x4f0525[_0x6df5('0x18')](_0x37419c);});}else{return logger[_0x6df5('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util[_0x6df5('0x3a')](_0x46da4e,{'showHidden':![],'depth':null}));}})[_0x6df5('0x1a')](function(_0x308e55){return logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x72'),util[_0x6df5('0x3a')](_0x308e55,{'showHidden':![],'depth':null}));});}else{return logger[_0x6df5('0x1b')](_0x6df5('0x27'),_0x6df5('0x28'),_0x6df5('0x72'),_0x6df5('0x77'));}break;}}})['finally'](function(){_0x5b64e4();});}else{_0x5b64e4();}}},'charset':_0x6df5('0x78'),'collate':_0x6df5('0x79')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 3653f55..98b41d5 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 _0xe007=['request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','debug'];(function(_0x22de9b,_0x3550cc){var _0x2ff6a9=function(_0x54155e){while(--_0x54155e){_0x22de9b['push'](_0x22de9b['shift']());}};_0x2ff6a9(++_0x3550cc);}(_0xe007,0xb6));var _0x7e00=function(_0x4d5e31,_0xe5acde){_0x4d5e31=_0x4d5e31-0x0;var _0x36b657=_0xe007[_0x4d5e31];return _0x36b657;};'use strict';var _=require(_0x7e00('0x0'));var util=require(_0x7e00('0x1'));var moment=require('moment');var BPromise=require(_0x7e00('0x2'));var rs=require(_0x7e00('0x3'));var fs=require('fs');var Redis=require(_0x7e00('0x4'));var db=require(_0x7e00('0x5'))['db'];var utils=require(_0x7e00('0x6'));var logger=require('../../config/logger')(_0x7e00('0x7'));var config=require(_0x7e00('0x8'));var jayson=require(_0x7e00('0x9'));var client=jayson[_0x7e00('0xa')]['http']({'port':0x232a});config[_0x7e00('0xb')]=_[_0x7e00('0xc')](config[_0x7e00('0xb')],{'host':_0x7e00('0xd'),'port':0x18eb});var socket=require(_0x7e00('0xe'))(new Redis(config[_0x7e00('0xb')]));require(_0x7e00('0xf'))[_0x7e00('0x10')](socket);function respondWithRpcPromise(_0x4850b8,_0x243aaa,_0x59b3fc){return new BPromise(function(_0x2d1256,_0x232ec0){return client[_0x7e00('0x11')](_0x4850b8,_0x59b3fc)[_0x7e00('0x12')](function(_0x11c830){logger[_0x7e00('0x13')](_0x7e00('0x14'),_0x243aaa,'request\x20sent');logger[_0x7e00('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x243aaa,_0x7e00('0x16'),JSON[_0x7e00('0x17')](_0x11c830));if(_0x11c830[_0x7e00('0x18')]){if(_0x11c830[_0x7e00('0x18')][_0x7e00('0x19')]===0x1f4){logger[_0x7e00('0x18')](_0x7e00('0x14'),_0x243aaa,_0x11c830[_0x7e00('0x18')]['message']);return _0x232ec0(_0x11c830[_0x7e00('0x18')][_0x7e00('0x1a')]);}logger[_0x7e00('0x18')]('SmsMessage,\x20%s,\x20%s',_0x243aaa,_0x11c830[_0x7e00('0x18')][_0x7e00('0x1a')]);return _0x2d1256(_0x11c830[_0x7e00('0x18')][_0x7e00('0x1a')]);}else{logger[_0x7e00('0x13')]('SmsMessage,\x20%s,\x20%s',_0x243aaa,'request\x20sent');_0x2d1256(_0x11c830[_0x7e00('0x1b')]['message']);}})[_0x7e00('0x1c')](function(_0x1c24c5){logger[_0x7e00('0x18')](_0x7e00('0x14'),_0x243aaa,_0x1c24c5);_0x232ec0(_0x1c24c5);});});}exports[_0x7e00('0x1d')]=function(_0x40c471){var _0x79cc31=this;return new Promise(function(_0x44ab6f,_0x7c6184){return db[_0x7e00('0x1e')][_0x7e00('0x1f')](_0x40c471[_0x7e00('0x20')],{'raw':_0x40c471['options']?_0x40c471[_0x7e00('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x7e00('0x12')](function(_0x266180){logger[_0x7e00('0x13')](_0x7e00('0x1d'),_0x40c471);logger[_0x7e00('0x15')]('CreateSmsMessage',_0x40c471,JSON[_0x7e00('0x17')](_0x266180));_0x44ab6f(_0x266180);})['catch'](function(_0x12a582){logger[_0x7e00('0x18')]('CreateSmsMessage',_0x12a582[_0x7e00('0x1a')],_0x40c471);_0x7c6184(_0x79cc31[_0x7e00('0x18')](0x1f4,_0x12a582[_0x7e00('0x1a')]));});});}; \ No newline at end of file +var _0x9ea7=['register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','raw','debug','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x50dea1,_0x566b2a){var _0x55a72a=function(_0x212511){while(--_0x212511){_0x50dea1['push'](_0x50dea1['shift']());}};_0x55a72a(++_0x566b2a);}(_0x9ea7,0xa4));var _0x79ea=function(_0x421196,_0x1cbd94){_0x421196=_0x421196-0x0;var _0x2738af=_0x9ea7[_0x421196];return _0x2738af;};'use strict';var _=require('lodash');var util=require(_0x79ea('0x0'));var moment=require(_0x79ea('0x1'));var BPromise=require('bluebird');var rs=require(_0x79ea('0x2'));var fs=require('fs');var Redis=require(_0x79ea('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x79ea('0x4'));var logger=require(_0x79ea('0x5'))(_0x79ea('0x6'));var config=require(_0x79ea('0x7'));var jayson=require(_0x79ea('0x8'));var client=jayson[_0x79ea('0x9')][_0x79ea('0xa')]({'port':0x232a});config[_0x79ea('0xb')]=_[_0x79ea('0xc')](config[_0x79ea('0xb')],{'host':_0x79ea('0xd'),'port':0x18eb});var socket=require(_0x79ea('0xe'))(new Redis(config[_0x79ea('0xb')]));require(_0x79ea('0xf'))[_0x79ea('0x10')](socket);function respondWithRpcPromise(_0x1005c4,_0x5299c4,_0x9b73ed){return new BPromise(function(_0x38f58a,_0x34adce){return client[_0x79ea('0x11')](_0x1005c4,_0x9b73ed)[_0x79ea('0x12')](function(_0x58883f){logger['info'](_0x79ea('0x13'),_0x5299c4,_0x79ea('0x14'));logger['debug'](_0x79ea('0x15'),_0x5299c4,_0x79ea('0x14'),JSON[_0x79ea('0x16')](_0x58883f));if(_0x58883f[_0x79ea('0x17')]){if(_0x58883f[_0x79ea('0x17')][_0x79ea('0x18')]===0x1f4){logger[_0x79ea('0x17')]('SmsMessage,\x20%s,\x20%s',_0x5299c4,_0x58883f['error'][_0x79ea('0x19')]);return _0x34adce(_0x58883f['error'][_0x79ea('0x19')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x5299c4,_0x58883f[_0x79ea('0x17')]['message']);return _0x38f58a(_0x58883f['error'][_0x79ea('0x19')]);}else{logger[_0x79ea('0x1a')](_0x79ea('0x13'),_0x5299c4,_0x79ea('0x14'));_0x38f58a(_0x58883f[_0x79ea('0x1b')][_0x79ea('0x19')]);}})[_0x79ea('0x1c')](function(_0x227cd2){logger[_0x79ea('0x17')]('SmsMessage,\x20%s,\x20%s',_0x5299c4,_0x227cd2);_0x34adce(_0x227cd2);});});}exports[_0x79ea('0x1d')]=function(_0x5a76ef){var _0x4b6888=this;return new Promise(function(_0x4d90e2,_0x426a1){return db[_0x79ea('0x1e')][_0x79ea('0x1f')](_0x5a76ef[_0x79ea('0x20')],{'raw':_0x5a76ef['options']?_0x5a76ef[_0x79ea('0x21')][_0x79ea('0x22')]===undefined?!![]:![]:!![]})[_0x79ea('0x12')](function(_0x2105a6){logger[_0x79ea('0x1a')](_0x79ea('0x1d'),_0x5a76ef);logger[_0x79ea('0x23')](_0x79ea('0x1d'),_0x5a76ef,JSON['stringify'](_0x2105a6));_0x4d90e2(_0x2105a6);})['catch'](function(_0x5e45cb){logger[_0x79ea('0x17')](_0x79ea('0x1d'),_0x5e45cb[_0x79ea('0x19')],_0x5a76ef);_0x426a1(_0x4b6888[_0x79ea('0x17')](0x1f4,_0x5e45cb[_0x79ea('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 4cc5c69..fcb75c3 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 _0xc6df=['removeListener','register','length','smsMessage:','./smsMessage.events','emit'];(function(_0x5ac1ae,_0x2bbf6d){var _0x2ca11f=function(_0x1a8b4f){while(--_0x1a8b4f){_0x5ac1ae['push'](_0x5ac1ae['shift']());}};_0x2ca11f(++_0x2bbf6d);}(_0xc6df,0x76));var _0xfc6d=function(_0x5d005e,_0x47ae13){_0x5d005e=_0x5d005e-0x0;var _0x3c6f48=_0xc6df[_0x5d005e];return _0x3c6f48;};'use strict';var SmsMessageEvents=require(_0xfc6d('0x0'));var events=['save','remove','update'];function createListener(_0x5b9d9e,_0x5e0885){return function(_0x1b8e52){_0x5e0885[_0xfc6d('0x1')](_0x5b9d9e,_0x1b8e52);};}function removeListener(_0x5014ed,_0xd97d1c){return function(){SmsMessageEvents[_0xfc6d('0x2')](_0x5014ed,_0xd97d1c);};}exports[_0xfc6d('0x3')]=function(_0x586b4c){for(var _0x443c8c=0x0,_0x35f590=events[_0xfc6d('0x4')];_0x443c8c<_0x35f590;_0x443c8c++){var _0x5d2c88=events[_0x443c8c];var _0x141c9c=createListener(_0xfc6d('0x5')+_0x5d2c88,_0x586b4c);SmsMessageEvents['on'](_0x5d2c88,_0x141c9c);}}; \ No newline at end of file +var _0x39fd=['length','./smsMessage.events','remove','removeListener','register'];(function(_0x431c9d,_0x9da89a){var _0x1d1915=function(_0x3aad18){while(--_0x3aad18){_0x431c9d['push'](_0x431c9d['shift']());}};_0x1d1915(++_0x9da89a);}(_0x39fd,0x1eb));var _0xd39f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39fd[_0x42cae2];return _0x5f256f;};'use strict';var SmsMessageEvents=require(_0xd39f('0x0'));var events=['save',_0xd39f('0x1'),'update'];function createListener(_0x341458,_0x4ffc13){return function(_0x5833cb){_0x4ffc13['emit'](_0x341458,_0x5833cb);};}function removeListener(_0x322f7c,_0x510f4a){return function(){SmsMessageEvents[_0xd39f('0x2')](_0x322f7c,_0x510f4a);};}exports[_0xd39f('0x3')]=function(_0x93042a){for(var _0x1ea013=0x0,_0x563225=events[_0xd39f('0x4')];_0x1ea013<_0x563225;_0x1ea013++){var _0x4615e1=events[_0x1ea013];var _0x3fdf65=createListener('smsMessage:'+_0x4615e1,_0x93042a);SmsMessageEvents['on'](_0x4615e1,_0x3fdf65);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 72b7b5a..efa05d6 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 _0x0855=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','index','/describe','get','/:id','isAuthenticated','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','update','destroy','removeTeams','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x57d2d0,_0x4c59b8){var _0x4b1025=function(_0x55448d){while(--_0x55448d){_0x57d2d0['push'](_0x57d2d0['shift']());}};_0x4b1025(++_0x4c59b8);}(_0x0855,0x7a));var _0x5085=function(_0x47b497,_0x5af2ed){_0x47b497=_0x47b497-0x0;var _0x39c0f3=_0x0855[_0x47b497];return _0x39c0f3;};'use strict';var multer=require(_0x5085('0x0'));var util=require(_0x5085('0x1'));var path=require(_0x5085('0x2'));var timeout=require(_0x5085('0x3'));var express=require(_0x5085('0x4'));var router=express[_0x5085('0x5')]();var fs_extra=require(_0x5085('0x6'));var auth=require(_0x5085('0x7'));var interaction=require(_0x5085('0x8'));var config=require(_0x5085('0x9'));var controller=require(_0x5085('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x5085('0xb')]);router['get'](_0x5085('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x5085('0xd')](_0x5085('0xe'),auth[_0x5085('0xf')](),controller['show']);router[_0x5085('0xd')](_0x5085('0x10'),auth[_0x5085('0xf')](),controller[_0x5085('0x11')]);router[_0x5085('0xd')](_0x5085('0x12'),auth[_0x5085('0xf')](),controller[_0x5085('0x13')]);router[_0x5085('0xd')]('/:id/users',auth[_0x5085('0xf')](),controller[_0x5085('0x14')]);router[_0x5085('0x15')]('/',auth[_0x5085('0xf')](),controller['create']);router[_0x5085('0x15')](_0x5085('0x12'),auth['isAuthenticated'](),controller[_0x5085('0x16')]);router['post'](_0x5085('0x17'),auth['isAuthenticated'](),controller[_0x5085('0x18')]);router[_0x5085('0x19')](_0x5085('0xe'),auth[_0x5085('0xf')](),controller[_0x5085('0x1a')]);router['delete'](_0x5085('0xe'),auth['isAuthenticated'](),controller[_0x5085('0x1b')]);router['delete']('/:id/teams',auth[_0x5085('0xf')](),controller[_0x5085('0x1c')]);router[_0x5085('0x1d')](_0x5085('0x17'),auth[_0x5085('0xf')](),controller[_0x5085('0x1e')]);module[_0x5085('0x1f')]=router; \ No newline at end of file +var _0x97e5=['update','delete','destroy','exports','multer','path','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put'];(function(_0x4c5cea,_0x1b96bb){var _0x379014=function(_0x519332){while(--_0x519332){_0x4c5cea['push'](_0x4c5cea['shift']());}};_0x379014(++_0x1b96bb);}(_0x97e5,0x1d8));var _0x597e=function(_0x1bacb5,_0x30eea3){_0x1bacb5=_0x1bacb5-0x0;var _0x19e776=_0x97e5[_0x1bacb5];return _0x19e776;};'use strict';var multer=require(_0x597e('0x0'));var util=require('util');var path=require(_0x597e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x597e('0x2'));var auth=require(_0x597e('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./smsQueue.controller');router[_0x597e('0x4')]('/',auth[_0x597e('0x5')](),controller[_0x597e('0x6')]);router[_0x597e('0x4')](_0x597e('0x7'),auth['isAuthenticated'](),controller[_0x597e('0x8')]);router[_0x597e('0x4')](_0x597e('0x9'),auth['isAuthenticated'](),controller[_0x597e('0xa')]);router[_0x597e('0x4')](_0x597e('0xb'),auth[_0x597e('0x5')](),controller[_0x597e('0xc')]);router[_0x597e('0x4')](_0x597e('0xd'),auth[_0x597e('0x5')](),controller[_0x597e('0xe')]);router['get'](_0x597e('0xf'),auth['isAuthenticated'](),controller[_0x597e('0x10')]);router['post']('/',auth[_0x597e('0x5')](),controller[_0x597e('0x11')]);router[_0x597e('0x12')](_0x597e('0xd'),auth[_0x597e('0x5')](),controller[_0x597e('0x13')]);router['post'](_0x597e('0xf'),auth[_0x597e('0x5')](),controller[_0x597e('0x14')]);router[_0x597e('0x15')](_0x597e('0x9'),auth['isAuthenticated'](),controller[_0x597e('0x16')]);router[_0x597e('0x17')](_0x597e('0x9'),auth[_0x597e('0x5')](),controller[_0x597e('0x18')]);router['delete']('/:id/teams',auth[_0x597e('0x5')](),controller['removeTeams']);router[_0x597e('0x17')](_0x597e('0xf'),auth[_0x597e('0x5')](),controller['removeAgents']);module[_0x597e('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 9c95fae..1292178 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 _0xaf41=['ENUM','beepall','sequelize','STRING','name','INTEGER'];(function(_0x354181,_0x12bd72){var _0xfbb67a=function(_0x1e174f){while(--_0x1e174f){_0x354181['push'](_0x354181['shift']());}};_0xfbb67a(++_0x12bd72);}(_0xaf41,0xb0));var _0x1af4=function(_0x51228d,_0x4fa2b0){_0x51228d=_0x51228d-0x0;var _0x51a599=_0xaf41[_0x51228d];return _0x51a599;};'use strict';var Sequelize=require(_0x1af4('0x0'));module['exports']={'name':{'type':Sequelize[_0x1af4('0x1')],'unique':_0x1af4('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1af4('0x1')]},'timeout':{'type':Sequelize[_0x1af4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1af4('0x4')]('rrmemory',_0x1af4('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x2afb=['INTEGER','rrmemory','beepall','roundrobin','sequelize','exports','STRING','name'];(function(_0x27ac3d,_0x37773d){var _0x2fc4c0=function(_0x278cdc){while(--_0x278cdc){_0x27ac3d['push'](_0x27ac3d['shift']());}};_0x2fc4c0(++_0x37773d);}(_0x2afb,0x19c));var _0xb2af=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0x2afb[_0x3beea0];return _0x314eb1;};'use strict';var Sequelize=require(_0xb2af('0x0'));module[_0xb2af('0x1')]={'name':{'type':Sequelize[_0xb2af('0x2')],'unique':_0xb2af('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb2af('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb2af('0x5'),_0xb2af('0x6'),_0xb2af('0x7'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index fceaae5..a6ede67 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 _0xb0cf=['SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','rows','format','%s/%s','SIP','createdAt','updatedAt','getTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','user_has_teams','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','send','map','rawAttributes','fieldName','type','model','name','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsQueue','includeAll','include','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserSmsQueue','hasOwnProperty','pick'];(function(_0x2ec9c0,_0x199458){var _0x367291=function(_0x43cffc){while(--_0x43cffc){_0x2ec9c0['push'](_0x2ec9c0['shift']());}};_0x367291(++_0x199458);}(_0xb0cf,0xc3));var _0xfb0c=function(_0x1e1639,_0x352143){_0x1e1639=_0x1e1639-0x0;var _0x29893c=_0xb0cf[_0x1e1639];return _0x29893c;};'use strict';var emlformat=require(_0xfb0c('0x0'));var rimraf=require(_0xfb0c('0x1'));var zipdir=require(_0xfb0c('0x2'));var jsonpatch=require(_0xfb0c('0x3'));var rp=require(_0xfb0c('0x4'));var moment=require(_0xfb0c('0x5'));var BPromise=require(_0xfb0c('0x6'));var Mustache=require('mustache');var util=require(_0xfb0c('0x7'));var path=require(_0xfb0c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfb0c('0x9'));var fs=require('fs');var fs_extra=require(_0xfb0c('0xa'));var _=require(_0xfb0c('0xb'));var squel=require(_0xfb0c('0xc'));var crypto=require(_0xfb0c('0xd'));var jsforce=require(_0xfb0c('0xe'));var deskjs=require(_0xfb0c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfb0c('0x10'));var Papa=require(_0xfb0c('0x11'));var Redis=require(_0xfb0c('0x12'));var authService=require(_0xfb0c('0x13'));var qs=require(_0xfb0c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb0c('0x15'));var logger=require(_0xfb0c('0x16'))(_0xfb0c('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb0c('0x18'))['db'];config[_0xfb0c('0x19')]=_[_0xfb0c('0x1a')](config['redis'],{'host':_0xfb0c('0x1b'),'port':0x18eb});var socket=require(_0xfb0c('0x1c'))(new Redis(config[_0xfb0c('0x19')]));require(_0xfb0c('0x1d'))[_0xfb0c('0x1e')](socket);function respondWithStatusCode(_0x4960f9,_0x2f6a1f){_0x2f6a1f=_0x2f6a1f||0xcc;return function(_0x56acd8){if(_0x56acd8){return _0x4960f9[_0xfb0c('0x1f')](_0x2f6a1f);}return _0x4960f9[_0xfb0c('0x20')](_0x2f6a1f)[_0xfb0c('0x21')]();};}function respondWithResult(_0x3a7032,_0x2b71a6){_0x2b71a6=_0x2b71a6||0xc8;return function(_0x282f4a){if(_0x282f4a){return _0x3a7032[_0xfb0c('0x20')](_0x2b71a6)[_0xfb0c('0x22')](_0x282f4a);}};}function respondWithFilteredResult(_0x1944d2,_0x1d6661){return function(_0x2c85cb){if(_0x2c85cb){var _0x2f9f1d=typeof _0x1d6661[_0xfb0c('0x23')]==='undefined'&&typeof _0x1d6661[_0xfb0c('0x24')]===_0xfb0c('0x25');var _0x59f1b9=_0x2c85cb['count'];var _0x1aa9de=_0x2f9f1d?0x0:_0x1d6661[_0xfb0c('0x23')];var _0x4206ea=_0x2f9f1d?_0x2c85cb[_0xfb0c('0x26')]:_0x1d6661[_0xfb0c('0x23')]+_0x1d6661[_0xfb0c('0x24')];var _0x45baef;if(_0x4206ea>=_0x59f1b9){_0x4206ea=_0x59f1b9;_0x45baef=0xc8;}else{_0x45baef=0xce;}_0x1944d2[_0xfb0c('0x20')](_0x45baef);return _0x1944d2[_0xfb0c('0x27')]('Content-Range',_0x1aa9de+'-'+_0x4206ea+'/'+_0x59f1b9)[_0xfb0c('0x22')](_0x2c85cb);}return null;};}function patchUpdates(_0x29a0ed){return function(_0xcfb8eb){try{jsonpatch['apply'](_0xcfb8eb,_0x29a0ed,!![]);}catch(_0x5b8e76){return BPromise[_0xfb0c('0x28')](_0x5b8e76);}return _0xcfb8eb[_0xfb0c('0x29')]();};}function saveUpdates(_0x153a24,_0x3536ec){return function(_0x387ac6){if(_0x387ac6){return _0x387ac6[_0xfb0c('0x2a')](_0x153a24)[_0xfb0c('0x2b')](function(_0x17ac8f){return _0x17ac8f;});}return null;};}function removeEntity(_0x338b0b,_0x2509ef){return function(_0x2fbc59){if(_0x2fbc59){return _0x2fbc59[_0xfb0c('0x2c')]()[_0xfb0c('0x2b')](function(){var _0x5d9d48=_0x2fbc59[_0xfb0c('0x2d')]({'plain':!![]});var _0x2165d3=_0xfb0c('0x2e');return db[_0xfb0c('0x2f')][_0xfb0c('0x2c')]({'where':{'type':_0x2165d3,'resourceId':_0x5d9d48['id']}})[_0xfb0c('0x2b')](function(){return _0x2fbc59;});})['then'](function(){_0x338b0b[_0xfb0c('0x20')](0xcc)[_0xfb0c('0x21')]();});}};}function handleEntityNotFound(_0x593bb2,_0x233826){return function(_0x3a8db5){if(!_0x3a8db5){_0x593bb2[_0xfb0c('0x1f')](0x194);}return _0x3a8db5;};}function handleError(_0x4fcd8e,_0x479a94){_0x479a94=_0x479a94||0x1f4;return function(_0x443862){logger[_0xfb0c('0x30')](_0x443862[_0xfb0c('0x31')]);if(_0x443862['name']){delete _0x443862['name'];}_0x4fcd8e['status'](_0x479a94)[_0xfb0c('0x32')](_0x443862);};}exports['index']=function(_0x4eb710,_0x12512e){var _0x163f15={},_0xd17ad5={},_0x188eaf={'count':0x0,'rows':[]};var _0x46abcf=_[_0xfb0c('0x33')](db['SmsQueue'][_0xfb0c('0x34')],function(_0x33b8c1){return{'name':_0x33b8c1[_0xfb0c('0x35')],'type':_0x33b8c1[_0xfb0c('0x36')]['key']};});_0xd17ad5[_0xfb0c('0x37')]=_[_0xfb0c('0x33')](_0x46abcf,_0xfb0c('0x38'));_0xd17ad5[_0xfb0c('0x39')]=_[_0xfb0c('0x3a')](_0x4eb710[_0xfb0c('0x39')]);_0xd17ad5['filters']=_[_0xfb0c('0x3b')](_0xd17ad5['model'],_0xd17ad5[_0xfb0c('0x39')]);_0x163f15[_0xfb0c('0x3c')]=_['intersection'](_0xd17ad5[_0xfb0c('0x37')],qs[_0xfb0c('0x3d')](_0x4eb710[_0xfb0c('0x39')][_0xfb0c('0x3d')]));_0x163f15[_0xfb0c('0x3c')]=_0x163f15[_0xfb0c('0x3c')][_0xfb0c('0x3e')]?_0x163f15[_0xfb0c('0x3c')]:_0xd17ad5[_0xfb0c('0x37')];if(!_0x4eb710[_0xfb0c('0x39')]['hasOwnProperty'](_0xfb0c('0x3f'))){_0x163f15[_0xfb0c('0x24')]=qs[_0xfb0c('0x24')](_0x4eb710[_0xfb0c('0x39')]['limit']);_0x163f15['offset']=qs[_0xfb0c('0x23')](_0x4eb710[_0xfb0c('0x39')][_0xfb0c('0x23')]);}_0x163f15[_0xfb0c('0x40')]=qs[_0xfb0c('0x41')](_0x4eb710[_0xfb0c('0x39')][_0xfb0c('0x41')]);_0x163f15[_0xfb0c('0x42')]=qs[_0xfb0c('0x43')](_['pick'](_0x4eb710['query'],_0xd17ad5[_0xfb0c('0x43')]),_0x46abcf);if(_0x4eb710[_0xfb0c('0x39')][_0xfb0c('0x44')]){_0x163f15[_0xfb0c('0x42')]=_[_0xfb0c('0x45')](_0x163f15[_0xfb0c('0x42')],{'$or':_['map'](_0x46abcf,function(_0xf1e133){if(_0xf1e133[_0xfb0c('0x36')]!==_0xfb0c('0x46')){var _0x393160={};_0x393160[_0xf1e133['name']]={'$like':'%'+_0x4eb710['query'][_0xfb0c('0x44')]+'%'};return _0x393160;}})});}_0x163f15=_[_0xfb0c('0x45')]({},_0x163f15,_0x4eb710[_0xfb0c('0x47')]);var _0x5d06ef={'where':_0x163f15[_0xfb0c('0x42')]};return db[_0xfb0c('0x48')][_0xfb0c('0x26')](_0x5d06ef)[_0xfb0c('0x2b')](function(_0x118408){_0x188eaf[_0xfb0c('0x26')]=_0x118408;if(_0x4eb710[_0xfb0c('0x39')][_0xfb0c('0x49')]){_0x163f15[_0xfb0c('0x4a')]=[{'all':!![]}];}return db[_0xfb0c('0x48')]['findAll'](_0x163f15);})['then'](function(_0x2cbfec){_0x188eaf['rows']=_0x2cbfec;return _0x188eaf;})['then'](respondWithFilteredResult(_0x12512e,_0x163f15))[_0xfb0c('0x4b')](handleError(_0x12512e,null));};exports[_0xfb0c('0x4c')]=function(_0x17d8c7,_0x4b4d71){var _0x188b32={'raw':!![],'where':{'id':_0x17d8c7[_0xfb0c('0x4d')]['id']}},_0x49f3b0={};_0x49f3b0['model']=_[_0xfb0c('0x3a')](db[_0xfb0c('0x48')]['rawAttributes']);_0x49f3b0[_0xfb0c('0x39')]=_[_0xfb0c('0x3a')](_0x17d8c7[_0xfb0c('0x39')]);_0x49f3b0[_0xfb0c('0x43')]=_[_0xfb0c('0x3b')](_0x49f3b0['model'],_0x49f3b0['query']);_0x188b32[_0xfb0c('0x3c')]=_[_0xfb0c('0x3b')](_0x49f3b0[_0xfb0c('0x37')],qs[_0xfb0c('0x3d')](_0x17d8c7[_0xfb0c('0x39')][_0xfb0c('0x3d')]));_0x188b32[_0xfb0c('0x3c')]=_0x188b32['attributes'][_0xfb0c('0x3e')]?_0x188b32['attributes']:_0x49f3b0[_0xfb0c('0x37')];if(_0x17d8c7['query'][_0xfb0c('0x49')]){_0x188b32[_0xfb0c('0x4a')]=[{'all':!![]}];}_0x188b32=_['merge']({},_0x188b32,_0x17d8c7[_0xfb0c('0x47')]);return db[_0xfb0c('0x48')][_0xfb0c('0x4e')](_0x188b32)[_0xfb0c('0x2b')](handleEntityNotFound(_0x4b4d71,null))['then'](respondWithResult(_0x4b4d71,null))[_0xfb0c('0x4b')](handleError(_0x4b4d71,null));};exports[_0xfb0c('0x4f')]=function(_0x4b1b2b,_0x1da61f){return db[_0xfb0c('0x48')][_0xfb0c('0x4f')](_0x4b1b2b['body'],{})['then'](function(_0x3369da){var _0x5e5430=_0x4b1b2b[_0xfb0c('0x50')][_0xfb0c('0x2d')]({'plain':!![]});if(!_0x5e5430)throw new Error(_0xfb0c('0x51'));if(_0x5e5430[_0xfb0c('0x52')]===_0xfb0c('0x50')){var _0x385f74=_0x3369da[_0xfb0c('0x2d')]({'plain':!![]});var _0x30bab2=_0xfb0c('0x2e');return db[_0xfb0c('0x53')][_0xfb0c('0x4e')]({'where':{'name':_0x30bab2,'userProfileId':_0x5e5430[_0xfb0c('0x54')]},'raw':!![]})[_0xfb0c('0x2b')](function(_0x13f262){if(_0x13f262&&_0x13f262[_0xfb0c('0x55')]===0x0){return db[_0xfb0c('0x2f')]['create']({'name':_0x385f74['name'],'resourceId':_0x385f74['id'],'type':_0x13f262['name'],'sectionId':_0x13f262['id']},{})['then'](function(){return _0x3369da;});}else{return _0x3369da;}})[_0xfb0c('0x4b')](function(_0x1a1ba9){logger[_0xfb0c('0x30')](_0xfb0c('0x56'),_0x1a1ba9);throw _0x1a1ba9;});}return _0x3369da;})[_0xfb0c('0x2b')](respondWithResult(_0x1da61f,0xc9))[_0xfb0c('0x4b')](handleError(_0x1da61f,null));};exports[_0xfb0c('0x2a')]=function(_0x5bbd58,_0x19a0f7){if(_0x5bbd58[_0xfb0c('0x57')]['id']){delete _0x5bbd58['body']['id'];}return db[_0xfb0c('0x48')][_0xfb0c('0x4e')]({'where':{'id':_0x5bbd58[_0xfb0c('0x4d')]['id']}})[_0xfb0c('0x2b')](handleEntityNotFound(_0x19a0f7,null))[_0xfb0c('0x2b')](saveUpdates(_0x5bbd58[_0xfb0c('0x57')],null))[_0xfb0c('0x2b')](respondWithResult(_0x19a0f7,null))[_0xfb0c('0x4b')](handleError(_0x19a0f7,null));};exports[_0xfb0c('0x2c')]=function(_0x1b48e9,_0x489f6b){return db[_0xfb0c('0x48')][_0xfb0c('0x4e')]({'where':{'id':_0x1b48e9[_0xfb0c('0x4d')]['id']}})[_0xfb0c('0x2b')](handleEntityNotFound(_0x489f6b,null))[_0xfb0c('0x2b')](removeEntity(_0x489f6b,null))[_0xfb0c('0x4b')](handleError(_0x489f6b,null));};exports[_0xfb0c('0x58')]=function(_0x1282c0,_0x544a0b){return db[_0xfb0c('0x48')][_0xfb0c('0x58')]()[_0xfb0c('0x2b')](respondWithResult(_0x544a0b,null))[_0xfb0c('0x4b')](handleError(_0x544a0b,null));};exports['getMembers']=function(_0x5372c6,_0x5283a9,_0x2e041a){var _0x333268={'raw':!![],'where':{}},_0x38c56e={},_0x52166e;return db['SmsQueue'][_0xfb0c('0x59')]({'where':{'id':_0x5372c6[_0xfb0c('0x4d')]['id']}})[_0xfb0c('0x2b')](handleEntityNotFound(_0x5283a9,null))[_0xfb0c('0x2b')](function(_0x430faa){if(_0x430faa){_0x52166e=_0x430faa[_0xfb0c('0x2d')]({'plain':!![]});_0x38c56e[_0xfb0c('0x37')]=_[_0xfb0c('0x3a')](db[_0xfb0c('0x5a')][_0xfb0c('0x34')]);_0x38c56e[_0xfb0c('0x39')]=_[_0xfb0c('0x3a')](_0x5372c6[_0xfb0c('0x39')]);_0x38c56e['filters']=_[_0xfb0c('0x3b')](_0x38c56e[_0xfb0c('0x37')],_0x38c56e[_0xfb0c('0x39')]);_0x333268[_0xfb0c('0x3c')]=_[_0xfb0c('0x3b')](_0x38c56e[_0xfb0c('0x37')],qs[_0xfb0c('0x3d')](_0x5372c6['query']['fields']));_0x333268['attributes']=_0x333268['attributes'][_0xfb0c('0x3e')]?_0x333268['attributes']:_0x38c56e['model'];if(!_0x5372c6[_0xfb0c('0x39')][_0xfb0c('0x5b')](_0xfb0c('0x3f'))){_0x333268[_0xfb0c('0x24')]=qs[_0xfb0c('0x24')](_0x5372c6[_0xfb0c('0x39')][_0xfb0c('0x24')]);_0x333268[_0xfb0c('0x23')]=qs['offset'](_0x5372c6[_0xfb0c('0x39')][_0xfb0c('0x23')]);}_0x333268[_0xfb0c('0x40')]=qs[_0xfb0c('0x41')](_0x5372c6[_0xfb0c('0x39')][_0xfb0c('0x41')]);_0x333268[_0xfb0c('0x42')]=qs[_0xfb0c('0x43')](_[_0xfb0c('0x5c')](_0x5372c6['query'],_0x38c56e[_0xfb0c('0x43')]));_0x333268[_0xfb0c('0x42')][_0xfb0c('0x5d')]=_0x430faa['id'];if(_0x5372c6[_0xfb0c('0x39')][_0xfb0c('0x44')]){_0x333268[_0xfb0c('0x42')]=_[_0xfb0c('0x45')](_0x333268[_0xfb0c('0x42')],{'$or':_[_0xfb0c('0x33')](_0x333268['attributes'],function(_0x5a857a){var _0x2ed064={};_0x2ed064[_0x5a857a]={'$like':'%'+_0x5372c6[_0xfb0c('0x39')][_0xfb0c('0x44')]+'%'};return _0x2ed064;})});}_0x333268=_[_0xfb0c('0x45')]({},_0x333268,_0x5372c6[_0xfb0c('0x47')]);return db['UserSmsQueue'][_0xfb0c('0x5e')](_0x333268);}})[_0xfb0c('0x2b')](function(_0x168f69){if(_0x168f69){return db[_0xfb0c('0x5f')][_0xfb0c('0x60')]({'where':{'id':_[_0xfb0c('0x33')](_0x168f69,_0xfb0c('0x61')),'role':_0xfb0c('0x62')},'attributes':['id',_0xfb0c('0x38'),_0xfb0c('0x63'),'updatedAt','createdAt']});}})[_0xfb0c('0x2b')](function(_0x2a5498){if(_0x2a5498){return{'count':_0x2a5498['count'],'rows':_['map'](_0x2a5498[_0xfb0c('0x64')],function(_0x5b3ad8){return{'membername':_0x5b3ad8[_0xfb0c('0x38')],'UserId':_0x5b3ad8['id'],'queue_name':_0x52166e[_0xfb0c('0x38')],'SmsQueueId':_0x52166e['id'],'interface':util[_0xfb0c('0x65')](_0xfb0c('0x66'),_0xfb0c('0x67'),_0x5b3ad8[_0xfb0c('0x38')]),'penalty':0x0,'paused':_0x5b3ad8['smsPause'],'createdAt':_0x5b3ad8[_0xfb0c('0x68')],'updatedAt':_0x5b3ad8[_0xfb0c('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfb0c('0x2b')](respondWithFilteredResult(_0x5283a9,_0x333268))[_0xfb0c('0x4b')](handleError(_0x5283a9,null));};exports['getTeams']=function(_0x895350,_0x10e50d,_0x3c7670){var _0x1c48df={};var _0x1334d2={};var _0x4a4d1c;var _0x1a13ee;return db['SmsQueue']['findOne']({'where':{'id':_0x895350[_0xfb0c('0x4d')]['id']}})[_0xfb0c('0x2b')](handleEntityNotFound(_0x10e50d,null))[_0xfb0c('0x2b')](function(_0x21bfd0){if(_0x21bfd0){_0x4a4d1c=_0x21bfd0;_0x1334d2['model']=_[_0xfb0c('0x3a')](db['Team'][_0xfb0c('0x34')]);_0x1334d2[_0xfb0c('0x39')]=_[_0xfb0c('0x3a')](_0x895350[_0xfb0c('0x39')]);_0x1334d2[_0xfb0c('0x43')]=_[_0xfb0c('0x3b')](_0x1334d2[_0xfb0c('0x37')],_0x1334d2['query']);_0x1c48df['attributes']=_[_0xfb0c('0x3b')](_0x1334d2[_0xfb0c('0x37')],qs[_0xfb0c('0x3d')](_0x895350[_0xfb0c('0x39')][_0xfb0c('0x3d')]));_0x1c48df[_0xfb0c('0x3c')]=_0x1c48df[_0xfb0c('0x3c')]['length']?_0x1c48df['attributes']:_0x1334d2[_0xfb0c('0x37')];_0x1c48df['order']=qs[_0xfb0c('0x41')](_0x895350[_0xfb0c('0x39')][_0xfb0c('0x41')]);_0x1c48df[_0xfb0c('0x42')]=qs['filters'](_[_0xfb0c('0x5c')](_0x895350[_0xfb0c('0x39')],_0x1334d2[_0xfb0c('0x43')]));if(_0x895350[_0xfb0c('0x39')]['filter']){_0x1c48df['where']=_[_0xfb0c('0x45')](_0x1c48df[_0xfb0c('0x42')],{'$or':_[_0xfb0c('0x33')](_0x1c48df[_0xfb0c('0x3c')],function(_0x3ffd25){var _0x101650={};_0x101650[_0x3ffd25]={'$like':'%'+_0x895350['query'][_0xfb0c('0x44')]+'%'};return _0x101650;})});}_0x1c48df=_['merge']({},_0x1c48df,_0x895350['options']);return _0x4a4d1c[_0xfb0c('0x6a')](_0x1c48df);}})['then'](function(_0x32d1b3){if(_0x32d1b3){_0x1a13ee=_0x32d1b3['length'];if(!_0x895350[_0xfb0c('0x39')][_0xfb0c('0x5b')]('nolimit')){_0x1c48df['limit']=qs['limit'](_0x895350[_0xfb0c('0x39')][_0xfb0c('0x24')]);_0x1c48df[_0xfb0c('0x23')]=qs[_0xfb0c('0x23')](_0x895350[_0xfb0c('0x39')][_0xfb0c('0x23')]);}return _0x4a4d1c[_0xfb0c('0x6a')](_0x1c48df);}})[_0xfb0c('0x2b')](function(_0x3ace63){if(_0x3ace63){return _0x3ace63?{'count':_0x1a13ee,'rows':_0x3ace63}:null;}})[_0xfb0c('0x2b')](respondWithResult(_0x10e50d,null))['catch'](handleError(_0x10e50d,null));};exports['addTeams']=function(_0x6e92e0,_0x33f213,_0x36a985){var _0x1edf31=_0x6e92e0[_0xfb0c('0x57')][_0xfb0c('0x6b')];return db[_0xfb0c('0x6c')]['findAll']({'where':{'id':_0x1edf31},'attributes':['id'],'include':[{'model':db[_0xfb0c('0x5f')],'as':_0xfb0c('0x6d'),'attributes':['id',_0xfb0c('0x38'),_0xfb0c('0x6e'),_0xfb0c('0x6f'),_0xfb0c('0x70')],'raw':!![]}]})[_0xfb0c('0x2b')](function(_0x1a360a){if(_0x1a360a){var _0x3ac58a=_[_0xfb0c('0x71')](_0x1a360a,function(_0x35eec2){var _0x3d8205=_0x35eec2[_0xfb0c('0x2d')]({'plain':!![]});return _0x3d8205[_0xfb0c('0x6d')];});return db[_0xfb0c('0x48')]['find']({'where':{'id':_0x6e92e0['params']['id']}})[_0xfb0c('0x2b')](function(_0x350698){return db[_0xfb0c('0x72')][_0xfb0c('0x73')](function(_0x5eb49b){return _0x350698[_0xfb0c('0x74')](_0x1edf31,{'transaction':_0x5eb49b})['then'](function(){return BPromise['each'](_0x3ac58a,function(_0x2d7e93){return db[_0xfb0c('0x5a')][_0xfb0c('0x75')]({'where':{'UserId':_0x2d7e93['id'],'SmsQueueId':_0x6e92e0[_0xfb0c('0x4d')]['id']},'transaction':_0x5eb49b});});})['then'](function(){_0x3ac58a[_0xfb0c('0x76')](function(_0x386f3a){socket[_0xfb0c('0x77')](_0xfb0c('0x78'),{'UserId':_0x386f3a['id'],'SmsQueueId':_0x350698['id']});});});});});}})[_0xfb0c('0x2b')](respondWithStatusCode(_0x33f213,null))[_0xfb0c('0x4b')](handleError(_0x33f213,null));};exports[_0xfb0c('0x79')]=function(_0x424782,_0x291e50,_0x238ecb){return db[_0xfb0c('0x6c')][_0xfb0c('0x5e')]({'where':{'id':_0x424782[_0xfb0c('0x39')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfb0c('0x5f')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfb0c('0x2b')](handleEntityNotFound(_0x291e50,null))[_0xfb0c('0x2b')](function(_0x82ddaf){var _0x357864=_[_0xfb0c('0x33')](_0x82ddaf,'id');var _0x53e4b4=[];var _0x5cc906=[];var _0x39ca70=squel[_0xfb0c('0x7a')]();_0x39ca70[_0xfb0c('0x7b')]('tq.TeamId')[_0xfb0c('0x7c')]('team_has_sms_queues','tq')['join'](_0xfb0c('0x7d'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xfb0c('0x42')](_0xfb0c('0x7e'),_0x424782[_0xfb0c('0x4d')]['id']);for(var _0x386571=0x0;_0x386571<_0x82ddaf[_0xfb0c('0x3e')];_0x386571+=0x1){let _0x22a1f0=_0x82ddaf[_0x386571];for(var _0x4fcf1f=0x0;_0x4fcf1f<_0x22a1f0['Agents']['length'];_0x4fcf1f+=0x1){let _0x3d80c9=_0x22a1f0[_0xfb0c('0x6d')][_0x4fcf1f];var _0x5b12c5=_0x39ca70[_0xfb0c('0x7f')]();_0x5b12c5[_0xfb0c('0x42')](_0xfb0c('0x80'),_0x3d80c9['id']);_0x5cc906[_0xfb0c('0x81')](db[_0xfb0c('0x72')][_0xfb0c('0x39')](_0x5b12c5[_0xfb0c('0x82')](),{'type':db[_0xfb0c('0x72')]['QueryTypes'][_0xfb0c('0x83')]})[_0xfb0c('0x2b')](function(_0x4bd623){if(_0x4bd623[_0xfb0c('0x3e')]===0x1){return _0x3d80c9['id'];}else{var _0x58760a=_[_0xfb0c('0x84')](_[_0xfb0c('0x33')](_0x4bd623,_0xfb0c('0x85')),function(_0x45d929){return _[_0xfb0c('0x86')](_0x357864,_0x45d929);});if(_0x58760a){return _0x3d80c9['id'];}}}));}}return BPromise[_0xfb0c('0x87')](_0x5cc906)['then'](function(_0x1f8a9a){_0x53e4b4=_(_0x53e4b4)[_0xfb0c('0x88')](_0x1f8a9a)[_0xfb0c('0x89')]()[_0xfb0c('0x8a')]();return db[_0xfb0c('0x48')]['find']({'where':{'id':_0x424782['params']['id']}})['then'](function(_0x1026d1){return db[_0xfb0c('0x72')][_0xfb0c('0x73')](function(_0x2b026a){return _0x1026d1['removeTeams'](_0x424782[_0xfb0c('0x39')][_0xfb0c('0x6b')],{'transaction':_0x2b026a})[_0xfb0c('0x2b')](function(){if(!_['isEmpty'](_0x53e4b4)){return _0x1026d1[_0xfb0c('0x8b')](_0x53e4b4,{'transaction':_0x2b026a});}})[_0xfb0c('0x2b')](function(){_0x53e4b4[_0xfb0c('0x76')](function(_0x32e71b){socket['emit']('userSmsQueue:remove',{'UserId':_0x32e71b,'SmsQueueId':_0x1026d1['id']});});});});});});})[_0xfb0c('0x2b')](respondWithStatusCode(_0x291e50,null))['catch'](handleError(_0x291e50,null));};exports[_0xfb0c('0x8c')]=function(_0x240d1f,_0x2050ba,_0xaac458){return db[_0xfb0c('0x48')]['find']({'where':{'id':_0x240d1f[_0xfb0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2050ba,null))[_0xfb0c('0x2b')](function(_0x14efd7){if(_0x14efd7){return _0x14efd7['addAgents'](_0x240d1f[_0xfb0c('0x57')][_0xfb0c('0x6b')],_[_0xfb0c('0x8d')](_0x240d1f[_0xfb0c('0x57')],[_0xfb0c('0x6b'),'id'])||{})['spread'](function(_0x3d3d87){for(var _0x3d257a=0x0;_0x3d257a<_0x240d1f[_0xfb0c('0x57')][_0xfb0c('0x6b')][_0xfb0c('0x3e')];_0x3d257a+=0x1){socket[_0xfb0c('0x77')](_0xfb0c('0x78'),{'UserId':Number(_0x240d1f[_0xfb0c('0x57')][_0xfb0c('0x6b')][_0x3d257a]),'SmsQueueId':Number(_0x240d1f[_0xfb0c('0x4d')]['id'])});}return _0x3d3d87;});}})[_0xfb0c('0x2b')](respondWithResult(_0x2050ba,null))[_0xfb0c('0x4b')](handleError(_0x2050ba,null));};exports[_0xfb0c('0x8b')]=function(_0xa2b3fa,_0x412a2d,_0x1f1708){return db[_0xfb0c('0x48')][_0xfb0c('0x4e')]({'where':{'id':_0xa2b3fa['params']['id']}})['then'](handleEntityNotFound(_0x412a2d,null))[_0xfb0c('0x2b')](function(_0x2a77e6){if(_0x2a77e6){return _0x2a77e6[_0xfb0c('0x8b')](_0xa2b3fa[_0xfb0c('0x39')][_0xfb0c('0x6b')])[_0xfb0c('0x2b')](function(){if(_['isArray'](_0xa2b3fa[_0xfb0c('0x39')][_0xfb0c('0x6b')])){for(var _0x4e5771=0x0;_0x4e5771<_0xa2b3fa[_0xfb0c('0x39')][_0xfb0c('0x6b')][_0xfb0c('0x3e')];_0x4e5771+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0xa2b3fa[_0xfb0c('0x39')]['ids'][_0x4e5771]),'SmsQueueId':Number(_0xa2b3fa['params']['id'])});}}else{socket[_0xfb0c('0x77')](_0xfb0c('0x8e'),{'UserId':Number(_0xa2b3fa['query'][_0xfb0c('0x6b')]),'SmsQueueId':Number(_0xa2b3fa['params']['id'])});}});}})[_0xfb0c('0x2b')](respondWithStatusCode(_0x412a2d,null))[_0xfb0c('0x4b')](handleError(_0x412a2d,null));};exports['getAgents']=function(_0xf14604,_0x47e483,_0x1f76d2){var _0x1457bd={};var _0x582cab={};var _0xab1c7c;var _0x26de64;return db[_0xfb0c('0x48')][_0xfb0c('0x59')]({'where':{'id':_0xf14604[_0xfb0c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x47e483,null))['then'](function(_0x184e30){if(_0x184e30){_0xab1c7c=_0x184e30;_0x582cab[_0xfb0c('0x37')]=_['keys'](db[_0xfb0c('0x5f')][_0xfb0c('0x34')]);_0x582cab['query']=_[_0xfb0c('0x3a')](_0xf14604[_0xfb0c('0x39')]);_0x582cab[_0xfb0c('0x43')]=_[_0xfb0c('0x3b')](_0x582cab['model'],_0x582cab['query']);_0x1457bd[_0xfb0c('0x3c')]=_[_0xfb0c('0x3b')](_0x582cab[_0xfb0c('0x37')],qs[_0xfb0c('0x3d')](_0xf14604['query'][_0xfb0c('0x3d')]));_0x1457bd[_0xfb0c('0x3c')]=_0x1457bd[_0xfb0c('0x3c')]['length']?_0x1457bd['attributes']:_0x582cab[_0xfb0c('0x37')];_0x1457bd[_0xfb0c('0x40')]=qs['sort'](_0xf14604[_0xfb0c('0x39')][_0xfb0c('0x41')]);_0x1457bd[_0xfb0c('0x42')]=qs['filters'](_[_0xfb0c('0x5c')](_0xf14604['query'],_0x582cab[_0xfb0c('0x43')]));if(_0xf14604[_0xfb0c('0x39')][_0xfb0c('0x44')]){_0x1457bd[_0xfb0c('0x42')]=_[_0xfb0c('0x45')](_0x1457bd[_0xfb0c('0x42')],{'$or':_[_0xfb0c('0x33')](_0x1457bd['attributes'],function(_0x2f822a){var _0x57a676={};_0x57a676[_0x2f822a]={'$like':'%'+_0xf14604[_0xfb0c('0x39')][_0xfb0c('0x44')]+'%'};return _0x57a676;})});}_0x1457bd=_[_0xfb0c('0x45')]({},_0x1457bd,_0xf14604[_0xfb0c('0x47')]);return _0xab1c7c[_0xfb0c('0x8f')](_0x1457bd);}})[_0xfb0c('0x2b')](function(_0x1f7112){if(_0x1f7112){_0x26de64=_0x1f7112[_0xfb0c('0x3e')];if(!_0xf14604[_0xfb0c('0x39')]['hasOwnProperty']('nolimit')){_0x1457bd[_0xfb0c('0x24')]=qs[_0xfb0c('0x24')](_0xf14604[_0xfb0c('0x39')][_0xfb0c('0x24')]);_0x1457bd[_0xfb0c('0x23')]=qs[_0xfb0c('0x23')](_0xf14604[_0xfb0c('0x39')][_0xfb0c('0x23')]);}return _0xab1c7c['getAgents'](_0x1457bd);}})[_0xfb0c('0x2b')](function(_0x201477){if(_0x201477){return _0x201477?{'count':_0x26de64,'rows':_0x201477}:null;}})['then'](respondWithResult(_0x47e483,null))[_0xfb0c('0x4b')](handleError(_0x47e483,null));}; \ No newline at end of file +var _0x346a=['offset','limit','set','Content-Range','json','apply','reject','save','update','then','get','SmsQueues','UserProfileResource','error','stack','name','send','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','SmsQueue','findAll','rows','catch','show','params','keys','rawAttributes','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserSmsQueue','pick','SmsQueueId','User','findAndCountAll','smsPause','updatedAt','createdAt','format','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userSmsQueue:save','select','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','value','removeTeams','isEmpty','removeAgents','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','count'];(function(_0x3c27df,_0xc6d32b){var _0x56f1f0=function(_0x2dfcd2){while(--_0x2dfcd2){_0x3c27df['push'](_0x3c27df['shift']());}};_0x56f1f0(++_0xc6d32b);}(_0x346a,0x74));var _0xa346=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x346a[_0x27af45];return _0x18df21;};'use strict';var emlformat=require(_0xa346('0x0'));var rimraf=require(_0xa346('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa346('0x2'));var rp=require('request-promise');var moment=require(_0xa346('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa346('0x4'));var util=require('util');var path=require(_0xa346('0x5'));var sox=require(_0xa346('0x6'));var csv=require('to-csv');var ejs=require(_0xa346('0x7'));var fs=require('fs');var fs_extra=require(_0xa346('0x8'));var _=require(_0xa346('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa346('0xa'));var deskjs=require(_0xa346('0xb'));var toCsv=require(_0xa346('0xc'));var querystring=require('querystring');var Papa=require(_0xa346('0xd'));var Redis=require(_0xa346('0xe'));var authService=require(_0xa346('0xf'));var qs=require(_0xa346('0x10'));var as=require(_0xa346('0x11'));var hardwareService=require(_0xa346('0x12'));var logger=require(_0xa346('0x13'))(_0xa346('0x14'));var utils=require(_0xa346('0x15'));var config=require(_0xa346('0x16'));var licenseUtil=require(_0xa346('0x17'));var db=require('../../mysqldb')['db'];config[_0xa346('0x18')]=_[_0xa346('0x19')](config[_0xa346('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa346('0x1a'))(new Redis(config[_0xa346('0x18')]));require('./smsQueue.socket')[_0xa346('0x1b')](socket);function respondWithStatusCode(_0xb27556,_0x10adbc){_0x10adbc=_0x10adbc||0xcc;return function(_0x4476f6){if(_0x4476f6){return _0xb27556[_0xa346('0x1c')](_0x10adbc);}return _0xb27556[_0xa346('0x1d')](_0x10adbc)[_0xa346('0x1e')]();};}function respondWithResult(_0xc7471a,_0x469e38){_0x469e38=_0x469e38||0xc8;return function(_0x5616f9){if(_0x5616f9){return _0xc7471a[_0xa346('0x1d')](_0x469e38)['json'](_0x5616f9);}};}function respondWithFilteredResult(_0x50cd1d,_0x5ec3d0){return function(_0x39e5af){if(_0x39e5af){var _0x52804d=typeof _0x5ec3d0['offset']===_0xa346('0x1f')&&typeof _0x5ec3d0['limit']==='undefined';var _0x927e80=_0x39e5af[_0xa346('0x20')];var _0x30355e=_0x52804d?0x0:_0x5ec3d0[_0xa346('0x21')];var _0x45ec3f=_0x52804d?_0x39e5af['count']:_0x5ec3d0['offset']+_0x5ec3d0[_0xa346('0x22')];var _0x31017b;if(_0x45ec3f>=_0x927e80){_0x45ec3f=_0x927e80;_0x31017b=0xc8;}else{_0x31017b=0xce;}_0x50cd1d['status'](_0x31017b);return _0x50cd1d[_0xa346('0x23')](_0xa346('0x24'),_0x30355e+'-'+_0x45ec3f+'/'+_0x927e80)[_0xa346('0x25')](_0x39e5af);}return null;};}function patchUpdates(_0x25b10b){return function(_0x243a54){try{jsonpatch[_0xa346('0x26')](_0x243a54,_0x25b10b,!![]);}catch(_0x26767a){return BPromise[_0xa346('0x27')](_0x26767a);}return _0x243a54[_0xa346('0x28')]();};}function saveUpdates(_0x40cd97,_0x5ec2ad){return function(_0x3c10bb){if(_0x3c10bb){return _0x3c10bb[_0xa346('0x29')](_0x40cd97)[_0xa346('0x2a')](function(_0x249f8d){return _0x249f8d;});}return null;};}function removeEntity(_0x156a66,_0x13dcd4){return function(_0x36cafc){if(_0x36cafc){return _0x36cafc['destroy']()['then'](function(){var _0x52a454=_0x36cafc[_0xa346('0x2b')]({'plain':!![]});var _0x3def67=_0xa346('0x2c');return db[_0xa346('0x2d')]['destroy']({'where':{'type':_0x3def67,'resourceId':_0x52a454['id']}})[_0xa346('0x2a')](function(){return _0x36cafc;});})['then'](function(){_0x156a66[_0xa346('0x1d')](0xcc)[_0xa346('0x1e')]();});}};}function handleEntityNotFound(_0x5e4458,_0xaa4735){return function(_0x99eacb){if(!_0x99eacb){_0x5e4458[_0xa346('0x1c')](0x194);}return _0x99eacb;};}function handleError(_0x362bbe,_0x4a9a9f){_0x4a9a9f=_0x4a9a9f||0x1f4;return function(_0x4bbf4b){logger[_0xa346('0x2e')](_0x4bbf4b[_0xa346('0x2f')]);if(_0x4bbf4b[_0xa346('0x30')]){delete _0x4bbf4b[_0xa346('0x30')];}_0x362bbe[_0xa346('0x1d')](_0x4a9a9f)[_0xa346('0x31')](_0x4bbf4b);};}exports[_0xa346('0x32')]=function(_0x2152a9,_0x1fae78){var _0x142e85={},_0x39619c={},_0x5cfb82={'count':0x0,'rows':[]};var _0x3ed60e=_['map'](db['SmsQueue']['rawAttributes'],function(_0x311799){return{'name':_0x311799[_0xa346('0x33')],'type':_0x311799[_0xa346('0x34')][_0xa346('0x35')]};});_0x39619c[_0xa346('0x36')]=_[_0xa346('0x37')](_0x3ed60e,_0xa346('0x30'));_0x39619c[_0xa346('0x38')]=_['keys'](_0x2152a9[_0xa346('0x38')]);_0x39619c[_0xa346('0x39')]=_[_0xa346('0x3a')](_0x39619c[_0xa346('0x36')],_0x39619c[_0xa346('0x38')]);_0x142e85[_0xa346('0x3b')]=_[_0xa346('0x3a')](_0x39619c[_0xa346('0x36')],qs[_0xa346('0x3c')](_0x2152a9[_0xa346('0x38')][_0xa346('0x3c')]));_0x142e85['attributes']=_0x142e85[_0xa346('0x3b')][_0xa346('0x3d')]?_0x142e85[_0xa346('0x3b')]:_0x39619c[_0xa346('0x36')];if(!_0x2152a9[_0xa346('0x38')][_0xa346('0x3e')](_0xa346('0x3f'))){_0x142e85['limit']=qs[_0xa346('0x22')](_0x2152a9[_0xa346('0x38')][_0xa346('0x22')]);_0x142e85['offset']=qs[_0xa346('0x21')](_0x2152a9['query']['offset']);}_0x142e85[_0xa346('0x40')]=qs['sort'](_0x2152a9[_0xa346('0x38')][_0xa346('0x41')]);_0x142e85['where']=qs[_0xa346('0x39')](_['pick'](_0x2152a9[_0xa346('0x38')],_0x39619c['filters']),_0x3ed60e);if(_0x2152a9[_0xa346('0x38')][_0xa346('0x42')]){_0x142e85[_0xa346('0x43')]=_[_0xa346('0x44')](_0x142e85[_0xa346('0x43')],{'$or':_[_0xa346('0x37')](_0x3ed60e,function(_0x1f2185){if(_0x1f2185[_0xa346('0x34')]!==_0xa346('0x45')){var _0x182458={};_0x182458[_0x1f2185[_0xa346('0x30')]]={'$like':'%'+_0x2152a9[_0xa346('0x38')][_0xa346('0x42')]+'%'};return _0x182458;}})});}_0x142e85=_[_0xa346('0x44')]({},_0x142e85,_0x2152a9['options']);var _0x5db79a={'where':_0x142e85['where']};return db['SmsQueue']['count'](_0x5db79a)[_0xa346('0x2a')](function(_0x32ee11){_0x5cfb82[_0xa346('0x20')]=_0x32ee11;if(_0x2152a9['query'][_0xa346('0x46')]){_0x142e85[_0xa346('0x47')]=[{'all':!![]}];}return db[_0xa346('0x48')][_0xa346('0x49')](_0x142e85);})[_0xa346('0x2a')](function(_0x319bbe){_0x5cfb82[_0xa346('0x4a')]=_0x319bbe;return _0x5cfb82;})[_0xa346('0x2a')](respondWithFilteredResult(_0x1fae78,_0x142e85))[_0xa346('0x4b')](handleError(_0x1fae78,null));};exports[_0xa346('0x4c')]=function(_0x3d5ac7,_0x559f6f){var _0x29e150={'raw':!![],'where':{'id':_0x3d5ac7[_0xa346('0x4d')]['id']}},_0x4f96ce={};_0x4f96ce['model']=_[_0xa346('0x4e')](db['SmsQueue'][_0xa346('0x4f')]);_0x4f96ce[_0xa346('0x38')]=_[_0xa346('0x4e')](_0x3d5ac7[_0xa346('0x38')]);_0x4f96ce[_0xa346('0x39')]=_[_0xa346('0x3a')](_0x4f96ce[_0xa346('0x36')],_0x4f96ce[_0xa346('0x38')]);_0x29e150[_0xa346('0x3b')]=_[_0xa346('0x3a')](_0x4f96ce[_0xa346('0x36')],qs['fields'](_0x3d5ac7[_0xa346('0x38')][_0xa346('0x3c')]));_0x29e150[_0xa346('0x3b')]=_0x29e150[_0xa346('0x3b')][_0xa346('0x3d')]?_0x29e150['attributes']:_0x4f96ce[_0xa346('0x36')];if(_0x3d5ac7[_0xa346('0x38')]['includeAll']){_0x29e150[_0xa346('0x47')]=[{'all':!![]}];}_0x29e150=_[_0xa346('0x44')]({},_0x29e150,_0x3d5ac7[_0xa346('0x50')]);return db['SmsQueue'][_0xa346('0x51')](_0x29e150)[_0xa346('0x2a')](handleEntityNotFound(_0x559f6f,null))[_0xa346('0x2a')](respondWithResult(_0x559f6f,null))[_0xa346('0x4b')](handleError(_0x559f6f,null));};exports[_0xa346('0x52')]=function(_0x57bc36,_0x13a25f){return db[_0xa346('0x48')][_0xa346('0x52')](_0x57bc36[_0xa346('0x53')],{})['then'](function(_0x33c48e){var _0x3b432c=_0x57bc36['user'][_0xa346('0x2b')]({'plain':!![]});if(!_0x3b432c)throw new Error(_0xa346('0x54'));if(_0x3b432c[_0xa346('0x55')]===_0xa346('0x56')){var _0x1b3d90=_0x33c48e[_0xa346('0x2b')]({'plain':!![]});var _0x27b47b=_0xa346('0x2c');return db[_0xa346('0x57')]['find']({'where':{'name':_0x27b47b,'userProfileId':_0x3b432c['userProfileId']},'raw':!![]})[_0xa346('0x2a')](function(_0x7f6aa1){if(_0x7f6aa1&&_0x7f6aa1[_0xa346('0x58')]===0x0){return db['UserProfileResource'][_0xa346('0x52')]({'name':_0x1b3d90[_0xa346('0x30')],'resourceId':_0x1b3d90['id'],'type':_0x7f6aa1['name'],'sectionId':_0x7f6aa1['id']},{})[_0xa346('0x2a')](function(){return _0x33c48e;});}else{return _0x33c48e;}})['catch'](function(_0x1a7400){logger['error'](_0xa346('0x59'),_0x1a7400);throw _0x1a7400;});}return _0x33c48e;})[_0xa346('0x2a')](respondWithResult(_0x13a25f,0xc9))[_0xa346('0x4b')](handleError(_0x13a25f,null));};exports[_0xa346('0x29')]=function(_0x2ec9e0,_0x5c2cb3){if(_0x2ec9e0[_0xa346('0x53')]['id']){delete _0x2ec9e0[_0xa346('0x53')]['id'];}return db[_0xa346('0x48')]['find']({'where':{'id':_0x2ec9e0[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](handleEntityNotFound(_0x5c2cb3,null))[_0xa346('0x2a')](saveUpdates(_0x2ec9e0['body'],null))[_0xa346('0x2a')](respondWithResult(_0x5c2cb3,null))[_0xa346('0x4b')](handleError(_0x5c2cb3,null));};exports[_0xa346('0x5a')]=function(_0x1e859e,_0x747b83){return db[_0xa346('0x48')]['find']({'where':{'id':_0x1e859e['params']['id']}})[_0xa346('0x2a')](handleEntityNotFound(_0x747b83,null))[_0xa346('0x2a')](removeEntity(_0x747b83,null))['catch'](handleError(_0x747b83,null));};exports[_0xa346('0x5b')]=function(_0x4b94ba,_0x568751){return db[_0xa346('0x48')][_0xa346('0x5b')]()['then'](respondWithResult(_0x568751,null))['catch'](handleError(_0x568751,null));};exports[_0xa346('0x5c')]=function(_0x378915,_0x519e67,_0x221238){var _0x4a173e={'raw':!![],'where':{}},_0x213ff0={},_0x1a1aed;return db[_0xa346('0x48')][_0xa346('0x5d')]({'where':{'id':_0x378915[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](handleEntityNotFound(_0x519e67,null))[_0xa346('0x2a')](function(_0x3dda29){if(_0x3dda29){_0x1a1aed=_0x3dda29[_0xa346('0x2b')]({'plain':!![]});_0x213ff0[_0xa346('0x36')]=_[_0xa346('0x4e')](db[_0xa346('0x5e')][_0xa346('0x4f')]);_0x213ff0[_0xa346('0x38')]=_[_0xa346('0x4e')](_0x378915[_0xa346('0x38')]);_0x213ff0['filters']=_[_0xa346('0x3a')](_0x213ff0[_0xa346('0x36')],_0x213ff0[_0xa346('0x38')]);_0x4a173e[_0xa346('0x3b')]=_['intersection'](_0x213ff0[_0xa346('0x36')],qs[_0xa346('0x3c')](_0x378915[_0xa346('0x38')][_0xa346('0x3c')]));_0x4a173e[_0xa346('0x3b')]=_0x4a173e[_0xa346('0x3b')]['length']?_0x4a173e[_0xa346('0x3b')]:_0x213ff0['model'];if(!_0x378915[_0xa346('0x38')][_0xa346('0x3e')](_0xa346('0x3f'))){_0x4a173e[_0xa346('0x22')]=qs[_0xa346('0x22')](_0x378915[_0xa346('0x38')]['limit']);_0x4a173e[_0xa346('0x21')]=qs[_0xa346('0x21')](_0x378915[_0xa346('0x38')][_0xa346('0x21')]);}_0x4a173e[_0xa346('0x40')]=qs[_0xa346('0x41')](_0x378915[_0xa346('0x38')][_0xa346('0x41')]);_0x4a173e[_0xa346('0x43')]=qs['filters'](_[_0xa346('0x5f')](_0x378915[_0xa346('0x38')],_0x213ff0[_0xa346('0x39')]));_0x4a173e[_0xa346('0x43')][_0xa346('0x60')]=_0x3dda29['id'];if(_0x378915['query'][_0xa346('0x42')]){_0x4a173e[_0xa346('0x43')]=_['merge'](_0x4a173e['where'],{'$or':_[_0xa346('0x37')](_0x4a173e[_0xa346('0x3b')],function(_0x24440c){var _0x7331b={};_0x7331b[_0x24440c]={'$like':'%'+_0x378915['query'][_0xa346('0x42')]+'%'};return _0x7331b;})});}_0x4a173e=_[_0xa346('0x44')]({},_0x4a173e,_0x378915[_0xa346('0x50')]);return db[_0xa346('0x5e')][_0xa346('0x49')](_0x4a173e);}})[_0xa346('0x2a')](function(_0x441f78){if(_0x441f78){return db[_0xa346('0x61')][_0xa346('0x62')]({'where':{'id':_['map'](_0x441f78,'UserId'),'role':'agent'},'attributes':['id',_0xa346('0x30'),_0xa346('0x63'),_0xa346('0x64'),_0xa346('0x65')]});}})[_0xa346('0x2a')](function(_0x52d6f0){if(_0x52d6f0){return{'count':_0x52d6f0[_0xa346('0x20')],'rows':_[_0xa346('0x37')](_0x52d6f0[_0xa346('0x4a')],function(_0x3ff556){return{'membername':_0x3ff556[_0xa346('0x30')],'UserId':_0x3ff556['id'],'queue_name':_0x1a1aed[_0xa346('0x30')],'SmsQueueId':_0x1a1aed['id'],'interface':util[_0xa346('0x66')]('%s/%s',_0xa346('0x67'),_0x3ff556[_0xa346('0x30')]),'penalty':0x0,'paused':_0x3ff556[_0xa346('0x63')],'createdAt':_0x3ff556[_0xa346('0x65')],'updatedAt':_0x3ff556['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa346('0x2a')](respondWithFilteredResult(_0x519e67,_0x4a173e))[_0xa346('0x4b')](handleError(_0x519e67,null));};exports[_0xa346('0x68')]=function(_0x331e52,_0x5887c6,_0x3c638d){var _0x43a2df={};var _0x268deb={};var _0x983e30;var _0x15790e;return db[_0xa346('0x48')][_0xa346('0x5d')]({'where':{'id':_0x331e52[_0xa346('0x4d')]['id']}})['then'](handleEntityNotFound(_0x5887c6,null))[_0xa346('0x2a')](function(_0x49894f){if(_0x49894f){_0x983e30=_0x49894f;_0x268deb[_0xa346('0x36')]=_['keys'](db[_0xa346('0x69')]['rawAttributes']);_0x268deb[_0xa346('0x38')]=_[_0xa346('0x4e')](_0x331e52[_0xa346('0x38')]);_0x268deb[_0xa346('0x39')]=_['intersection'](_0x268deb[_0xa346('0x36')],_0x268deb[_0xa346('0x38')]);_0x43a2df['attributes']=_[_0xa346('0x3a')](_0x268deb[_0xa346('0x36')],qs['fields'](_0x331e52['query']['fields']));_0x43a2df[_0xa346('0x3b')]=_0x43a2df[_0xa346('0x3b')][_0xa346('0x3d')]?_0x43a2df[_0xa346('0x3b')]:_0x268deb[_0xa346('0x36')];_0x43a2df[_0xa346('0x40')]=qs['sort'](_0x331e52[_0xa346('0x38')][_0xa346('0x41')]);_0x43a2df[_0xa346('0x43')]=qs[_0xa346('0x39')](_[_0xa346('0x5f')](_0x331e52[_0xa346('0x38')],_0x268deb[_0xa346('0x39')]));if(_0x331e52[_0xa346('0x38')]['filter']){_0x43a2df['where']=_[_0xa346('0x44')](_0x43a2df['where'],{'$or':_[_0xa346('0x37')](_0x43a2df[_0xa346('0x3b')],function(_0x1ca7d2){var _0x3d5d1e={};_0x3d5d1e[_0x1ca7d2]={'$like':'%'+_0x331e52[_0xa346('0x38')][_0xa346('0x42')]+'%'};return _0x3d5d1e;})});}_0x43a2df=_[_0xa346('0x44')]({},_0x43a2df,_0x331e52['options']);return _0x983e30[_0xa346('0x68')](_0x43a2df);}})[_0xa346('0x2a')](function(_0x345edd){if(_0x345edd){_0x15790e=_0x345edd['length'];if(!_0x331e52[_0xa346('0x38')][_0xa346('0x3e')](_0xa346('0x3f'))){_0x43a2df[_0xa346('0x22')]=qs[_0xa346('0x22')](_0x331e52[_0xa346('0x38')][_0xa346('0x22')]);_0x43a2df['offset']=qs[_0xa346('0x21')](_0x331e52[_0xa346('0x38')][_0xa346('0x21')]);}return _0x983e30['getTeams'](_0x43a2df);}})[_0xa346('0x2a')](function(_0x2cb37a){if(_0x2cb37a){return _0x2cb37a?{'count':_0x15790e,'rows':_0x2cb37a}:null;}})[_0xa346('0x2a')](respondWithResult(_0x5887c6,null))[_0xa346('0x4b')](handleError(_0x5887c6,null));};exports[_0xa346('0x6a')]=function(_0x255e2e,_0x17494c,_0x17b5b9){var _0x2bbbc8=_0x255e2e['body'][_0xa346('0x6b')];return db[_0xa346('0x69')][_0xa346('0x49')]({'where':{'id':_0x2bbbc8},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa346('0x6c'),'attributes':['id',_0xa346('0x30'),_0xa346('0x6d'),_0xa346('0x6e'),_0xa346('0x6f')],'raw':!![]}]})[_0xa346('0x2a')](function(_0x5b3872){if(_0x5b3872){var _0x208b1d=_[_0xa346('0x70')](_0x5b3872,function(_0x5d8f99){var _0xffb8c7=_0x5d8f99['get']({'plain':!![]});return _0xffb8c7[_0xa346('0x6c')];});return db[_0xa346('0x48')][_0xa346('0x51')]({'where':{'id':_0x255e2e[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](function(_0x47521c){return db[_0xa346('0x71')][_0xa346('0x72')](function(_0x16c842){return _0x47521c['addTeams'](_0x2bbbc8,{'transaction':_0x16c842})['then'](function(){return BPromise[_0xa346('0x73')](_0x208b1d,function(_0x33a11e){return db[_0xa346('0x5e')][_0xa346('0x74')]({'where':{'UserId':_0x33a11e['id'],'SmsQueueId':_0x255e2e[_0xa346('0x4d')]['id']},'transaction':_0x16c842});});})[_0xa346('0x2a')](function(){_0x208b1d[_0xa346('0x75')](function(_0x44d589){socket[_0xa346('0x76')](_0xa346('0x77'),{'UserId':_0x44d589['id'],'SmsQueueId':_0x47521c['id']});});});});});}})[_0xa346('0x2a')](respondWithStatusCode(_0x17494c,null))['catch'](handleError(_0x17494c,null));};exports['removeTeams']=function(_0x51186b,_0x4d0dce,_0xbf02d7){return db['Team'][_0xa346('0x49')]({'where':{'id':_0x51186b[_0xa346('0x38')][_0xa346('0x6b')]},'attributes':['id'],'include':[{'model':db[_0xa346('0x61')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa346('0x2a')](handleEntityNotFound(_0x4d0dce,null))[_0xa346('0x2a')](function(_0xe93075){var _0x2a956f=_[_0xa346('0x37')](_0xe93075,'id');var _0x4d4629=[];var _0xfb0c8b=[];var _0x415ae3=squel[_0xa346('0x78')]();_0x415ae3[_0xa346('0x79')](_0xa346('0x7a'))[_0xa346('0x7b')](_0xa346('0x7c'),'tq')[_0xa346('0x7d')](_0xa346('0x7e'),'ut',_0xa346('0x7f'))['where'](_0xa346('0x80'),_0x51186b[_0xa346('0x4d')]['id']);for(var _0xaf5b01=0x0;_0xaf5b01<_0xe93075[_0xa346('0x3d')];_0xaf5b01+=0x1){let _0x45dcc0=_0xe93075[_0xaf5b01];for(var _0x3d4b06=0x0;_0x3d4b06<_0x45dcc0[_0xa346('0x6c')][_0xa346('0x3d')];_0x3d4b06+=0x1){let _0x58aac5=_0x45dcc0['Agents'][_0x3d4b06];var _0x39e223=_0x415ae3[_0xa346('0x81')]();_0x39e223[_0xa346('0x43')](_0xa346('0x82'),_0x58aac5['id']);_0xfb0c8b[_0xa346('0x83')](db[_0xa346('0x71')][_0xa346('0x38')](_0x39e223[_0xa346('0x84')](),{'type':db[_0xa346('0x71')][_0xa346('0x85')][_0xa346('0x86')]})['then'](function(_0x2690d0){if(_0x2690d0['length']===0x1){return _0x58aac5['id'];}else{var _0x30e846=_[_0xa346('0x87')](_[_0xa346('0x37')](_0x2690d0,'TeamId'),function(_0x159f01){return _[_0xa346('0x88')](_0x2a956f,_0x159f01);});if(_0x30e846){return _0x58aac5['id'];}}}));}}return BPromise[_0xa346('0x89')](_0xfb0c8b)[_0xa346('0x2a')](function(_0x1f7d31){_0x4d4629=_(_0x4d4629)[_0xa346('0x8a')](_0x1f7d31)['compact']()[_0xa346('0x8b')]();return db[_0xa346('0x48')]['find']({'where':{'id':_0x51186b[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](function(_0x16c19b){return db['sequelize']['transaction'](function(_0x582f0a){return _0x16c19b[_0xa346('0x8c')](_0x51186b[_0xa346('0x38')][_0xa346('0x6b')],{'transaction':_0x582f0a})['then'](function(){if(!_[_0xa346('0x8d')](_0x4d4629)){return _0x16c19b[_0xa346('0x8e')](_0x4d4629,{'transaction':_0x582f0a});}})[_0xa346('0x2a')](function(){_0x4d4629[_0xa346('0x75')](function(_0x374298){socket[_0xa346('0x76')](_0xa346('0x8f'),{'UserId':_0x374298,'SmsQueueId':_0x16c19b['id']});});});});});});})[_0xa346('0x2a')](respondWithStatusCode(_0x4d0dce,null))[_0xa346('0x4b')](handleError(_0x4d0dce,null));};exports['addAgents']=function(_0x48c279,_0x2cc642,_0x5038c9){return db['SmsQueue'][_0xa346('0x51')]({'where':{'id':_0x48c279[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](handleEntityNotFound(_0x2cc642,null))['then'](function(_0x2b224e){if(_0x2b224e){return _0x2b224e[_0xa346('0x90')](_0x48c279[_0xa346('0x53')]['ids'],_[_0xa346('0x91')](_0x48c279['body'],['ids','id'])||{})[_0xa346('0x92')](function(_0x2d3ee6){for(var _0x262592=0x0;_0x262592<_0x48c279[_0xa346('0x53')][_0xa346('0x6b')]['length'];_0x262592+=0x1){socket[_0xa346('0x76')]('userSmsQueue:save',{'UserId':Number(_0x48c279[_0xa346('0x53')][_0xa346('0x6b')][_0x262592]),'SmsQueueId':Number(_0x48c279[_0xa346('0x4d')]['id'])});}return _0x2d3ee6;});}})[_0xa346('0x2a')](respondWithResult(_0x2cc642,null))[_0xa346('0x4b')](handleError(_0x2cc642,null));};exports[_0xa346('0x8e')]=function(_0xc2e6c,_0x55f5d1,_0x449466){return db[_0xa346('0x48')][_0xa346('0x51')]({'where':{'id':_0xc2e6c[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](handleEntityNotFound(_0x55f5d1,null))[_0xa346('0x2a')](function(_0x516432){if(_0x516432){return _0x516432['removeAgents'](_0xc2e6c['query'][_0xa346('0x6b')])[_0xa346('0x2a')](function(){if(_[_0xa346('0x93')](_0xc2e6c[_0xa346('0x38')][_0xa346('0x6b')])){for(var _0x19d667=0x0;_0x19d667<_0xc2e6c[_0xa346('0x38')][_0xa346('0x6b')][_0xa346('0x3d')];_0x19d667+=0x1){socket['emit'](_0xa346('0x8f'),{'UserId':Number(_0xc2e6c['query'][_0xa346('0x6b')][_0x19d667]),'SmsQueueId':Number(_0xc2e6c[_0xa346('0x4d')]['id'])});}}else{socket[_0xa346('0x76')](_0xa346('0x8f'),{'UserId':Number(_0xc2e6c['query'][_0xa346('0x6b')]),'SmsQueueId':Number(_0xc2e6c[_0xa346('0x4d')]['id'])});}});}})[_0xa346('0x2a')](respondWithStatusCode(_0x55f5d1,null))[_0xa346('0x4b')](handleError(_0x55f5d1,null));};exports['getAgents']=function(_0x4911bf,_0x2ed54,_0x4a03d5){var _0x2fed9e={};var _0x1b067c={};var _0x1339f0;var _0x4f3b04;return db[_0xa346('0x48')][_0xa346('0x5d')]({'where':{'id':_0x4911bf[_0xa346('0x4d')]['id']}})[_0xa346('0x2a')](handleEntityNotFound(_0x2ed54,null))[_0xa346('0x2a')](function(_0x4dc7d5){if(_0x4dc7d5){_0x1339f0=_0x4dc7d5;_0x1b067c[_0xa346('0x36')]=_[_0xa346('0x4e')](db[_0xa346('0x61')][_0xa346('0x4f')]);_0x1b067c[_0xa346('0x38')]=_[_0xa346('0x4e')](_0x4911bf[_0xa346('0x38')]);_0x1b067c[_0xa346('0x39')]=_['intersection'](_0x1b067c[_0xa346('0x36')],_0x1b067c[_0xa346('0x38')]);_0x2fed9e[_0xa346('0x3b')]=_[_0xa346('0x3a')](_0x1b067c[_0xa346('0x36')],qs['fields'](_0x4911bf[_0xa346('0x38')][_0xa346('0x3c')]));_0x2fed9e[_0xa346('0x3b')]=_0x2fed9e[_0xa346('0x3b')][_0xa346('0x3d')]?_0x2fed9e[_0xa346('0x3b')]:_0x1b067c['model'];_0x2fed9e[_0xa346('0x40')]=qs[_0xa346('0x41')](_0x4911bf['query']['sort']);_0x2fed9e[_0xa346('0x43')]=qs[_0xa346('0x39')](_[_0xa346('0x5f')](_0x4911bf[_0xa346('0x38')],_0x1b067c['filters']));if(_0x4911bf[_0xa346('0x38')]['filter']){_0x2fed9e[_0xa346('0x43')]=_[_0xa346('0x44')](_0x2fed9e['where'],{'$or':_[_0xa346('0x37')](_0x2fed9e[_0xa346('0x3b')],function(_0x106f81){var _0x48e48e={};_0x48e48e[_0x106f81]={'$like':'%'+_0x4911bf[_0xa346('0x38')][_0xa346('0x42')]+'%'};return _0x48e48e;})});}_0x2fed9e=_[_0xa346('0x44')]({},_0x2fed9e,_0x4911bf[_0xa346('0x50')]);return _0x1339f0['getAgents'](_0x2fed9e);}})[_0xa346('0x2a')](function(_0xea5b55){if(_0xea5b55){_0x4f3b04=_0xea5b55[_0xa346('0x3d')];if(!_0x4911bf[_0xa346('0x38')][_0xa346('0x3e')]('nolimit')){_0x2fed9e['limit']=qs['limit'](_0x4911bf[_0xa346('0x38')]['limit']);_0x2fed9e[_0xa346('0x21')]=qs[_0xa346('0x21')](_0x4911bf[_0xa346('0x38')][_0xa346('0x21')]);}return _0x1339f0[_0xa346('0x94')](_0x2fed9e);}})[_0xa346('0x2a')](function(_0x4e7319){if(_0x4e7319){return _0x4e7319?{'count':_0x4f3b04,'rows':_0x4e7319}:null;}})[_0xa346('0x2a')](respondWithResult(_0x2ed54,null))['catch'](handleError(_0x2ed54,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index f48e13b..663c360 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 _0x399e=['update','remove','emit','hook','exports','events'];(function(_0x53284b,_0x11028b){var _0x39dc7d=function(_0x2d117b){while(--_0x2d117b){_0x53284b['push'](_0x53284b['shift']());}};_0x39dc7d(++_0x11028b);}(_0x399e,0xcb));var _0xe399=function(_0x5e6fca,_0x540568){_0x5e6fca=_0x5e6fca-0x0;var _0x505941=_0x399e[_0x5e6fca];return _0x505941;};'use strict';var EventEmitter=require(_0xe399('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe399('0x1'),'afterDestroy':_0xe399('0x2')};function emitEvent(_0x4f3083){return function(_0x5abe1b,_0x2c6c84,_0x279108){SmsQueueEvents[_0xe399('0x3')](_0x4f3083+':'+_0x5abe1b['id'],_0x5abe1b);SmsQueueEvents[_0xe399('0x3')](_0x4f3083,_0x5abe1b);_0x279108(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xe399('0x4')](e,emitEvent(event));}}module[_0xe399('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x417e=['../../mysqldb','SmsQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x20b1ca,_0xcaa99b){var _0x13a457=function(_0x49b381){while(--_0x49b381){_0x20b1ca['push'](_0x20b1ca['shift']());}};_0x13a457(++_0xcaa99b);}(_0x417e,0x133));var _0xe417=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x417e[_0x238671];return _0x474844;};'use strict';var EventEmitter=require(_0xe417('0x0'));var SmsQueue=require(_0xe417('0x1'))['db'][_0xe417('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xe417('0x3')](0x0);var events={'afterCreate':_0xe417('0x4'),'afterUpdate':_0xe417('0x5'),'afterDestroy':_0xe417('0x6')};function emitEvent(_0x21c728){return function(_0x3a8d31,_0x466095,_0x2a2213){SmsQueueEvents[_0xe417('0x7')](_0x21c728+':'+_0x3a8d31['id'],_0x3a8d31);SmsQueueEvents[_0xe417('0x7')](_0x21c728,_0x3a8d31);_0x2a2213(null);};}for(var e in events){if(events[_0xe417('0x8')](e)){var event=events[e];SmsQueue[_0xe417('0x9')](e,emitEvent(event));}}module[_0xe417('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4ec22cf..f6fb4c2 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 _0xc182=['rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xc4d1c6,_0x4b6ee9){var _0xfd4b3b=function(_0x111b7a){while(--_0x111b7a){_0xc4d1c6['push'](_0xc4d1c6['shift']());}};_0xfd4b3b(++_0x4b6ee9);}(_0xc182,0x181));var _0x2c18=function(_0x18632c,_0x4fcc66){_0x18632c=_0x18632c-0x0;var _0xc8be97=_0xc182[_0x18632c];return _0xc8be97;};'use strict';var _=require(_0x2c18('0x0'));var util=require(_0x2c18('0x1'));var logger=require('../../config/logger')(_0x2c18('0x2'));var moment=require(_0x2c18('0x3'));var BPromise=require(_0x2c18('0x4'));var rp=require(_0x2c18('0x5'));var fs=require('fs');var path=require(_0x2c18('0x6'));var rimraf=require(_0x2c18('0x7'));var config=require(_0x2c18('0x8'));var attributes=require(_0x2c18('0x9'));module[_0x2c18('0xa')]=function(_0x4d2053,_0x18616b){return _0x4d2053[_0x2c18('0xb')](_0x2c18('0xc'),attributes,{'tableName':_0x2c18('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7ed=['define','SmsQueue','sms_queues','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd7ed,0x1bb));var _0xdd7e=function(_0x2abc3d,_0x48edca){_0x2abc3d=_0x2abc3d-0x0;var _0x252745=_0xd7ed[_0x2abc3d];return _0x252745;};'use strict';var _=require(_0xdd7e('0x0'));var util=require(_0xdd7e('0x1'));var logger=require(_0xdd7e('0x2'))('api');var moment=require(_0xdd7e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd7e('0x4'));var rimraf=require(_0xdd7e('0x5'));var config=require(_0xdd7e('0x6'));var attributes=require(_0xdd7e('0x7'));module['exports']=function(_0x279a21,_0x2f7888){return _0x279a21[_0xdd7e('0x8')](_0xdd7e('0x9'),attributes,{'tableName':_0xdd7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index e549fbb..77410fe 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 _0x72e1=['raw','where','limit','include','map','model','attributes','ShowSmsQueue','find','debug','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','findAll','options'];(function(_0x3856f4,_0x450645){var _0x447b24=function(_0x8d788c){while(--_0x8d788c){_0x3856f4['push'](_0x3856f4['shift']());}};_0x447b24(++_0x450645);}(_0x72e1,0x122));var _0x172e=function(_0x2882ab,_0x42ec28){_0x2882ab=_0x2882ab-0x0;var _0x11b5c3=_0x72e1[_0x2882ab];return _0x11b5c3;};'use strict';var _=require(_0x172e('0x0'));var util=require(_0x172e('0x1'));var moment=require(_0x172e('0x2'));var BPromise=require(_0x172e('0x3'));var rs=require(_0x172e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x172e('0x5'));var logger=require(_0x172e('0x6'))(_0x172e('0x7'));var config=require(_0x172e('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x172e('0x9')]=_[_0x172e('0xa')](config[_0x172e('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x172e('0xb'))(new Redis(config['redis']));require(_0x172e('0xc'))[_0x172e('0xd')](socket);function respondWithRpcPromise(_0x182140,_0x418e68,_0xe57f73){return new BPromise(function(_0xc556c7,_0x362384){return client[_0x172e('0xe')](_0x182140,_0xe57f73)[_0x172e('0xf')](function(_0x3dc0d6){logger[_0x172e('0x10')](_0x172e('0x11'),_0x418e68,_0x172e('0x12'));logger['debug'](_0x172e('0x13'),_0x418e68,_0x172e('0x12'),JSON[_0x172e('0x14')](_0x3dc0d6));if(_0x3dc0d6[_0x172e('0x15')]){if(_0x3dc0d6[_0x172e('0x15')][_0x172e('0x16')]===0x1f4){logger[_0x172e('0x15')]('SmsQueue,\x20%s,\x20%s',_0x418e68,_0x3dc0d6[_0x172e('0x15')][_0x172e('0x17')]);return _0x362384(_0x3dc0d6['error'][_0x172e('0x17')]);}logger[_0x172e('0x15')](_0x172e('0x11'),_0x418e68,_0x3dc0d6[_0x172e('0x15')][_0x172e('0x17')]);return _0xc556c7(_0x3dc0d6[_0x172e('0x15')][_0x172e('0x17')]);}else{logger[_0x172e('0x10')](_0x172e('0x11'),_0x418e68,_0x172e('0x12'));_0xc556c7(_0x3dc0d6[_0x172e('0x18')][_0x172e('0x17')]);}})[_0x172e('0x19')](function(_0x447aeb){logger[_0x172e('0x15')](_0x172e('0x11'),_0x418e68,_0x447aeb);_0x362384(_0x447aeb);});});}exports[_0x172e('0x1a')]=function(_0x536772){var _0x56306e=this;return new Promise(function(_0x13a633,_0x44e849){return db[_0x172e('0x1b')][_0x172e('0x1c')]({'raw':_0x536772[_0x172e('0x1d')]?_0x536772[_0x172e('0x1d')][_0x172e('0x1e')]===undefined?!![]:![]:!![],'where':_0x536772[_0x172e('0x1d')]?_0x536772[_0x172e('0x1d')][_0x172e('0x1f')]||null:null,'attributes':_0x536772[_0x172e('0x1d')]?_0x536772[_0x172e('0x1d')]['attributes']||null:null,'limit':_0x536772[_0x172e('0x1d')]?_0x536772['options'][_0x172e('0x20')]||null:null,'include':_0x536772[_0x172e('0x1d')]?_0x536772[_0x172e('0x1d')][_0x172e('0x21')]?_[_0x172e('0x22')](_0x536772['options'][_0x172e('0x21')],function(_0x45b5f5){return{'model':db[_0x45b5f5[_0x172e('0x23')]],'as':_0x45b5f5['as'],'attributes':_0x45b5f5['attributes'],'include':_0x45b5f5[_0x172e('0x21')]?_[_0x172e('0x22')](_0x45b5f5[_0x172e('0x21')],function(_0x5825e8){return{'model':db[_0x5825e8[_0x172e('0x23')]],'as':_0x5825e8['as'],'attributes':_0x5825e8[_0x172e('0x24')],'include':_0x5825e8[_0x172e('0x21')]?_[_0x172e('0x22')](_0x5825e8[_0x172e('0x21')],function(_0x1f81dc){return{'model':db[_0x1f81dc[_0x172e('0x23')]],'as':_0x1f81dc['as'],'attributes':_0x1f81dc[_0x172e('0x24')]};}):[]};}):[]};}):[]:[]})[_0x172e('0xf')](function(_0x1f64a7){logger[_0x172e('0x10')](_0x172e('0x1a'),_0x536772);logger['debug'](_0x172e('0x1a'),_0x536772,JSON[_0x172e('0x14')](_0x1f64a7));_0x13a633(_0x1f64a7);})[_0x172e('0x19')](function(_0x86a3d5){logger['error'](_0x172e('0x1a'),_0x86a3d5[_0x172e('0x17')],_0x536772);_0x44e849(_0x56306e[_0x172e('0x15')](0x1f4,_0x86a3d5[_0x172e('0x17')]));});});};exports[_0x172e('0x25')]=function(_0x47d8d2){var _0x556a00=this;return new Promise(function(_0x726bca,_0x3b57c){return db[_0x172e('0x1b')][_0x172e('0x26')]({'raw':_0x47d8d2[_0x172e('0x1d')]?_0x47d8d2['options'][_0x172e('0x1e')]===undefined?!![]:![]:!![],'where':_0x47d8d2[_0x172e('0x1d')]?_0x47d8d2['options']['where']||null:null,'attributes':_0x47d8d2['options']?_0x47d8d2[_0x172e('0x1d')]['attributes']||null:null,'include':_0x47d8d2['options']?_0x47d8d2[_0x172e('0x1d')][_0x172e('0x21')]?_['map'](_0x47d8d2[_0x172e('0x1d')][_0x172e('0x21')],function(_0x1b7245){return{'model':db[_0x1b7245[_0x172e('0x23')]],'as':_0x1b7245['as'],'attributes':_0x1b7245[_0x172e('0x24')],'include':_0x1b7245[_0x172e('0x21')]?_['map'](_0x1b7245[_0x172e('0x21')],function(_0x5a7ddc){return{'model':db[_0x5a7ddc['model']],'as':_0x5a7ddc['as'],'attributes':_0x5a7ddc[_0x172e('0x24')],'include':_0x5a7ddc[_0x172e('0x21')]?_['map'](_0x5a7ddc[_0x172e('0x21')],function(_0x4b3de3){return{'model':db[_0x4b3de3['model']],'as':_0x4b3de3['as'],'attributes':_0x4b3de3[_0x172e('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x18d5fb){logger['info'](_0x172e('0x25'),_0x47d8d2);logger[_0x172e('0x27')]('ShowSmsQueue',_0x47d8d2,JSON[_0x172e('0x14')](_0x18d5fb));_0x726bca(_0x18d5fb);})[_0x172e('0x19')](function(_0x55157c){logger[_0x172e('0x15')]('ShowSmsQueue',_0x55157c['message'],_0x47d8d2);_0x3b57c(_0x556a00[_0x172e('0x15')](0x1f4,_0x55157c[_0x172e('0x17')]));});});}; \ No newline at end of file +var _0xd7fb=['debug','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','GetSmsQueue','SmsQueue','findAll','options','where','attributes','include','map','model','catch','ShowSmsQueue','find','raw','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','then','info'];(function(_0x14555f,_0x28130c){var _0xa6ad2e=function(_0x471956){while(--_0x471956){_0x14555f['push'](_0x14555f['shift']());}};_0xa6ad2e(++_0x28130c);}(_0xd7fb,0x1a0));var _0xbd7f=function(_0x148fc9,_0x2c4741){_0x148fc9=_0x148fc9-0x0;var _0x7782ad=_0xd7fb[_0x148fc9];return _0x7782ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbd7f('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd7f('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd7f('0x2'));var logger=require(_0xbd7f('0x3'))(_0xbd7f('0x4'));var config=require(_0xbd7f('0x5'));var jayson=require(_0xbd7f('0x6'));var client=jayson[_0xbd7f('0x7')][_0xbd7f('0x8')]({'port':0x232a});config[_0xbd7f('0x9')]=_[_0xbd7f('0xa')](config['redis'],{'host':_0xbd7f('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbd7f('0x9')]));require(_0xbd7f('0xc'))[_0xbd7f('0xd')](socket);function respondWithRpcPromise(_0x4f5cd8,_0x330db5,_0x49c1e4){return new BPromise(function(_0x17bc41,_0x13a87d){return client['request'](_0x4f5cd8,_0x49c1e4)[_0xbd7f('0xe')](function(_0x2cf455){logger[_0xbd7f('0xf')]('SmsQueue,\x20%s,\x20%s',_0x330db5,'request\x20sent');logger[_0xbd7f('0x10')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x330db5,'request\x20sent',JSON[_0xbd7f('0x11')](_0x2cf455));if(_0x2cf455[_0xbd7f('0x12')]){if(_0x2cf455[_0xbd7f('0x12')][_0xbd7f('0x13')]===0x1f4){logger[_0xbd7f('0x12')](_0xbd7f('0x14'),_0x330db5,_0x2cf455[_0xbd7f('0x12')][_0xbd7f('0x15')]);return _0x13a87d(_0x2cf455[_0xbd7f('0x12')][_0xbd7f('0x15')]);}logger[_0xbd7f('0x12')](_0xbd7f('0x14'),_0x330db5,_0x2cf455['error'][_0xbd7f('0x15')]);return _0x17bc41(_0x2cf455['error'][_0xbd7f('0x15')]);}else{logger[_0xbd7f('0xf')](_0xbd7f('0x14'),_0x330db5,'request\x20sent');_0x17bc41(_0x2cf455[_0xbd7f('0x16')][_0xbd7f('0x15')]);}})['catch'](function(_0x19b137){logger[_0xbd7f('0x12')](_0xbd7f('0x14'),_0x330db5,_0x19b137);_0x13a87d(_0x19b137);});});}exports[_0xbd7f('0x17')]=function(_0xe37a70){var _0x391a0d=this;return new Promise(function(_0x24bc95,_0x571a51){return db[_0xbd7f('0x18')][_0xbd7f('0x19')]({'raw':_0xe37a70['options']?_0xe37a70[_0xbd7f('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0xe37a70[_0xbd7f('0x1a')]?_0xe37a70[_0xbd7f('0x1a')][_0xbd7f('0x1b')]||null:null,'attributes':_0xe37a70[_0xbd7f('0x1a')]?_0xe37a70[_0xbd7f('0x1a')][_0xbd7f('0x1c')]||null:null,'limit':_0xe37a70['options']?_0xe37a70['options']['limit']||null:null,'include':_0xe37a70[_0xbd7f('0x1a')]?_0xe37a70[_0xbd7f('0x1a')][_0xbd7f('0x1d')]?_[_0xbd7f('0x1e')](_0xe37a70['options'][_0xbd7f('0x1d')],function(_0xe9bd99){return{'model':db[_0xe9bd99['model']],'as':_0xe9bd99['as'],'attributes':_0xe9bd99[_0xbd7f('0x1c')],'include':_0xe9bd99['include']?_[_0xbd7f('0x1e')](_0xe9bd99[_0xbd7f('0x1d')],function(_0x2d5d0a){return{'model':db[_0x2d5d0a['model']],'as':_0x2d5d0a['as'],'attributes':_0x2d5d0a[_0xbd7f('0x1c')],'include':_0x2d5d0a[_0xbd7f('0x1d')]?_[_0xbd7f('0x1e')](_0x2d5d0a['include'],function(_0x3182ae){return{'model':db[_0x3182ae[_0xbd7f('0x1f')]],'as':_0x3182ae['as'],'attributes':_0x3182ae[_0xbd7f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbd7f('0xe')](function(_0x1c1023){logger[_0xbd7f('0xf')](_0xbd7f('0x17'),_0xe37a70);logger[_0xbd7f('0x10')](_0xbd7f('0x17'),_0xe37a70,JSON['stringify'](_0x1c1023));_0x24bc95(_0x1c1023);})[_0xbd7f('0x20')](function(_0x5b513a){logger[_0xbd7f('0x12')](_0xbd7f('0x17'),_0x5b513a[_0xbd7f('0x15')],_0xe37a70);_0x571a51(_0x391a0d[_0xbd7f('0x12')](0x1f4,_0x5b513a['message']));});});};exports[_0xbd7f('0x21')]=function(_0x2056fb){var _0x1de79a=this;return new Promise(function(_0x3064b1,_0x1a8ce4){return db[_0xbd7f('0x18')][_0xbd7f('0x22')]({'raw':_0x2056fb[_0xbd7f('0x1a')]?_0x2056fb[_0xbd7f('0x1a')][_0xbd7f('0x23')]===undefined?!![]:![]:!![],'where':_0x2056fb[_0xbd7f('0x1a')]?_0x2056fb[_0xbd7f('0x1a')][_0xbd7f('0x1b')]||null:null,'attributes':_0x2056fb[_0xbd7f('0x1a')]?_0x2056fb[_0xbd7f('0x1a')][_0xbd7f('0x1c')]||null:null,'include':_0x2056fb['options']?_0x2056fb[_0xbd7f('0x1a')][_0xbd7f('0x1d')]?_[_0xbd7f('0x1e')](_0x2056fb['options'][_0xbd7f('0x1d')],function(_0x24d80c){return{'model':db[_0x24d80c[_0xbd7f('0x1f')]],'as':_0x24d80c['as'],'attributes':_0x24d80c[_0xbd7f('0x1c')],'include':_0x24d80c[_0xbd7f('0x1d')]?_[_0xbd7f('0x1e')](_0x24d80c['include'],function(_0x3152f8){return{'model':db[_0x3152f8[_0xbd7f('0x1f')]],'as':_0x3152f8['as'],'attributes':_0x3152f8[_0xbd7f('0x1c')],'include':_0x3152f8[_0xbd7f('0x1d')]?_[_0xbd7f('0x1e')](_0x3152f8[_0xbd7f('0x1d')],function(_0x4b2d4a){return{'model':db[_0x4b2d4a[_0xbd7f('0x1f')]],'as':_0x4b2d4a['as'],'attributes':_0x4b2d4a[_0xbd7f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cfeaf){logger[_0xbd7f('0xf')](_0xbd7f('0x21'),_0x2056fb);logger['debug']('ShowSmsQueue',_0x2056fb,JSON[_0xbd7f('0x11')](_0x2cfeaf));_0x3064b1(_0x2cfeaf);})['catch'](function(_0x230d0e){logger[_0xbd7f('0x12')](_0xbd7f('0x21'),_0x230d0e[_0xbd7f('0x15')],_0x2056fb);_0x1a8ce4(_0x1de79a[_0xbd7f('0x12')](0x1f4,_0x230d0e[_0xbd7f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 0a953d3..1271b20 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 _0x98fc=['save','remove','emit','removeListener','length','smsQueue:'];(function(_0x39580c,_0x22425c){var _0x1a4cd8=function(_0x42ee09){while(--_0x42ee09){_0x39580c['push'](_0x39580c['shift']());}};_0x1a4cd8(++_0x22425c);}(_0x98fc,0x66));var _0xc98f=function(_0x1f6e71,_0x19360b){_0x1f6e71=_0x1f6e71-0x0;var _0x2271aa=_0x98fc[_0x1f6e71];return _0x2271aa;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xc98f('0x0'),_0xc98f('0x1'),'update'];function createListener(_0x411e8e,_0x53394a){return function(_0x58c9e2){_0x53394a[_0xc98f('0x2')](_0x411e8e,_0x58c9e2);};}function removeListener(_0x405990,_0x1da1f2){return function(){SmsQueueEvents[_0xc98f('0x3')](_0x405990,_0x1da1f2);};}exports['register']=function(_0x53db69){for(var _0xb852f7=0x0,_0x2407f9=events[_0xc98f('0x4')];_0xb852f7<_0x2407f9;_0xb852f7++){var _0x11358f=events[_0xb852f7];var _0x11a701=createListener(_0xc98f('0x5')+_0x11358f,_0x53db69);SmsQueueEvents['on'](_0x11358f,_0x11a701);}}; \ No newline at end of file +var _0x2df9=['emit','removeListener','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x20db0f,_0x34f4e9){var _0x48cb9d=function(_0xa84a2d){while(--_0xa84a2d){_0x20db0f['push'](_0x20db0f['shift']());}};_0x48cb9d(++_0x34f4e9);}(_0x2df9,0x10e));var _0x92df=function(_0x3be081,_0x1a0666){_0x3be081=_0x3be081-0x0;var _0x2ff0d8=_0x2df9[_0x3be081];return _0x2ff0d8;};'use strict';var SmsQueueEvents=require(_0x92df('0x0'));var events=[_0x92df('0x1'),_0x92df('0x2'),'update'];function createListener(_0x5a69d2,_0x56117a){return function(_0x4b707c){_0x56117a[_0x92df('0x3')](_0x5a69d2,_0x4b707c);};}function removeListener(_0x35fc2e,_0x9c5dc9){return function(){SmsQueueEvents[_0x92df('0x4')](_0x35fc2e,_0x9c5dc9);};}exports['register']=function(_0xdf0531){for(var _0x148f3a=0x0,_0x45f0d2=events[_0x92df('0x5')];_0x148f3a<_0x45f0d2;_0x148f3a++){var _0x5b4382=events[_0x148f3a];var _0x3ae590=createListener(_0x92df('0x6')+_0x5b4382,_0xdf0531);SmsQueueEvents['on'](_0x5b4382,_0x3ae590);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index dcf7862..d8ca00c 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 _0xf3cc=['Router','fs-extra','../../components/auth/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','put','update','delete','exports','multer','util','path','connect-timeout'];(function(_0x16539a,_0x31409a){var _0x200796=function(_0xfe7803){while(--_0xfe7803){_0x16539a['push'](_0x16539a['shift']());}};_0x200796(++_0x31409a);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x4a0f60,_0x298c30){_0x4a0f60=_0x4a0f60-0x0;var _0x59b579=_0xf3cc[_0x4a0f60];return _0x59b579;};'use strict';var multer=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var path=require(_0xcf3c('0x2'));var timeout=require(_0xcf3c('0x3'));var express=require('express');var router=express[_0xcf3c('0x4')]();var fs_extra=require(_0xcf3c('0x5'));var auth=require(_0xcf3c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcf3c('0x7'));var controller=require(_0xcf3c('0x8'));router['get']('/',auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xa')]);router[_0xcf3c('0xb')](_0xcf3c('0xc'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xd')]);router[_0xcf3c('0xb')](_0xcf3c('0xe'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcf3c('0x10')]);router[_0xcf3c('0x11')](_0xcf3c('0xe'),auth[_0xcf3c('0x9')](),controller[_0xcf3c('0x12')]);router[_0xcf3c('0x13')](_0xcf3c('0xe'),auth[_0xcf3c('0x9')](),controller['destroy']);module[_0xcf3c('0x14')]=router; \ No newline at end of file +var _0x5c97=['show','post','create','put','update','exports','path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated'];(function(_0x20f758,_0x3b6b1d){var _0x24dcd2=function(_0x26720f){while(--_0x26720f){_0x20f758['push'](_0x20f758['shift']());}};_0x24dcd2(++_0x3b6b1d);}(_0x5c97,0x164));var _0x75c9=function(_0x420282,_0x1f941f){_0x420282=_0x420282-0x0;var _0x535480=_0x5c97[_0x420282];return _0x535480;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x75c9('0x0'));var timeout=require(_0x75c9('0x1'));var express=require(_0x75c9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x75c9('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x75c9('0x4'));var controller=require(_0x75c9('0x5'));router[_0x75c9('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x75c9('0x7')](),controller['describe']);router['get']('/:id',auth[_0x75c9('0x7')](),controller[_0x75c9('0x8')]);router[_0x75c9('0x9')]('/',auth[_0x75c9('0x7')](),controller[_0x75c9('0xa')]);router[_0x75c9('0xb')]('/:id',auth[_0x75c9('0x7')](),controller[_0x75c9('0xc')]);router['delete']('/:id',auth[_0x75c9('0x7')](),controller['destroy']);module[_0x75c9('0xd')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 62d98b0..274f47c 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 _0x5ba4=['moment','sequelize','exports','STRING','DATE'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x5ba4,0x136));var _0x45ba=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x5ba4[_0x4ae625];return _0x31accf;};'use strict';var moment=require(_0x45ba('0x0'));var Sequelize=require(_0x45ba('0x1'));module[_0x45ba('0x2')]={'uniqueid':{'type':Sequelize[_0x45ba('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x45ba('0x4')]},'exitAt':{'type':Sequelize[_0x45ba('0x4')]},'reason':{'type':Sequelize[_0x45ba('0x3')]}}; \ No newline at end of file +var _0xdeb6=['DATE','moment','sequelize','exports','STRING'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0xdeb6,0x114));var _0x6deb=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0xdeb6[_0x4c05da];return _0x1614db;};'use strict';var moment=require(_0x6deb('0x0'));var Sequelize=require(_0x6deb('0x1'));module[_0x6deb('0x2')]={'uniqueid':{'type':Sequelize[_0x6deb('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6deb('0x3')]},'joinAt':{'type':Sequelize[_0x6deb('0x4')]},'leaveAt':{'type':Sequelize[_0x6deb('0x4')]},'acceptAt':{'type':Sequelize[_0x6deb('0x4')]},'exitAt':{'type':Sequelize[_0x6deb('0x4')]},'reason':{'type':Sequelize[_0x6deb('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index bea56dc..9e96261 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 _0xf94f=['fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','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','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','SmsQueueReport','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x51a5ad,_0xb87632){var _0x3c00a5=function(_0x11a338){while(--_0x11a338){_0x51a5ad['push'](_0x51a5ad['shift']());}};_0x3c00a5(++_0xb87632);}(_0xf94f,0x64));var _0xff94=function(_0x409c1a,_0x2e4ca7){_0x409c1a=_0x409c1a-0x0;var _0x40f7dd=_0xf94f[_0x409c1a];return _0x40f7dd;};'use strict';var emlformat=require(_0xff94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xff94('0x1'));var jsonpatch=require(_0xff94('0x2'));var rp=require(_0xff94('0x3'));var moment=require(_0xff94('0x4'));var BPromise=require(_0xff94('0x5'));var Mustache=require('mustache');var util=require(_0xff94('0x6'));var path=require(_0xff94('0x7'));var sox=require(_0xff94('0x8'));var csv=require(_0xff94('0x9'));var ejs=require(_0xff94('0xa'));var fs=require('fs');var fs_extra=require(_0xff94('0xb'));var _=require(_0xff94('0xc'));var squel=require(_0xff94('0xd'));var crypto=require('crypto');var jsforce=require(_0xff94('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xff94('0xf'));var Papa=require(_0xff94('0x10'));var Redis=require(_0xff94('0x11'));var authService=require(_0xff94('0x12'));var qs=require(_0xff94('0x13'));var as=require(_0xff94('0x14'));var hardwareService=require(_0xff94('0x15'));var logger=require(_0xff94('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xff94('0x17'));var licenseUtil=require(_0xff94('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x302b9b,_0x2d9f46){_0x2d9f46=_0x2d9f46||0xcc;return function(_0x578b42){if(_0x578b42){return _0x302b9b['sendStatus'](_0x2d9f46);}return _0x302b9b[_0xff94('0x19')](_0x2d9f46)[_0xff94('0x1a')]();};}function respondWithResult(_0x26102d,_0x25c718){_0x25c718=_0x25c718||0xc8;return function(_0x106696){if(_0x106696){return _0x26102d[_0xff94('0x19')](_0x25c718)[_0xff94('0x1b')](_0x106696);}};}function respondWithFilteredResult(_0x5337af,_0x11f5c9){return function(_0x3e85e3){if(_0x3e85e3){var _0xc27aba=typeof _0x11f5c9[_0xff94('0x1c')]===_0xff94('0x1d')&&typeof _0x11f5c9[_0xff94('0x1e')]===_0xff94('0x1d');var _0x4245c7=_0x3e85e3[_0xff94('0x1f')];var _0x3c8063=_0xc27aba?0x0:_0x11f5c9[_0xff94('0x1c')];var _0x162720=_0xc27aba?_0x3e85e3[_0xff94('0x1f')]:_0x11f5c9[_0xff94('0x1c')]+_0x11f5c9[_0xff94('0x1e')];var _0x40d447;if(_0x162720>=_0x4245c7){_0x162720=_0x4245c7;_0x40d447=0xc8;}else{_0x40d447=0xce;}_0x5337af['status'](_0x40d447);return _0x5337af[_0xff94('0x20')](_0xff94('0x21'),_0x3c8063+'-'+_0x162720+'/'+_0x4245c7)['json'](_0x3e85e3);}return null;};}function patchUpdates(_0x30e5c1){return function(_0x403a4d){try{jsonpatch[_0xff94('0x22')](_0x403a4d,_0x30e5c1,!![]);}catch(_0x3d3b46){return BPromise['reject'](_0x3d3b46);}return _0x403a4d[_0xff94('0x23')]();};}function saveUpdates(_0x525332,_0xa220d1){return function(_0x4c0c6d){if(_0x4c0c6d){return _0x4c0c6d['update'](_0x525332)[_0xff94('0x24')](function(_0x9e2d8){return _0x9e2d8;});}return null;};}function removeEntity(_0x13be5e,_0x5ed14b){return function(_0x324f17){if(_0x324f17){return _0x324f17[_0xff94('0x25')]()[_0xff94('0x24')](function(){_0x13be5e[_0xff94('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b925c,_0x1dc172){return function(_0xc75d0){if(!_0xc75d0){_0x5b925c[_0xff94('0x26')](0x194);}return _0xc75d0;};}function handleError(_0x112af6,_0x50fbd0){_0x50fbd0=_0x50fbd0||0x1f4;return function(_0x3f4d3b){logger[_0xff94('0x27')](_0x3f4d3b[_0xff94('0x28')]);if(_0x3f4d3b[_0xff94('0x29')]){delete _0x3f4d3b[_0xff94('0x29')];}_0x112af6[_0xff94('0x19')](_0x50fbd0)[_0xff94('0x2a')](_0x3f4d3b);};}exports[_0xff94('0x2b')]=function(_0xc592e,_0x1091d7){var _0x3df7ab={},_0x4a0edf={},_0x214c33={'count':0x0,'rows':[]};var _0x2eb93b=_[_0xff94('0x2c')](db[_0xff94('0x2d')]['rawAttributes'],function(_0x2ebdc5){return{'name':_0x2ebdc5[_0xff94('0x2e')],'type':_0x2ebdc5['type'][_0xff94('0x2f')]};});_0x4a0edf[_0xff94('0x30')]=_[_0xff94('0x2c')](_0x2eb93b,_0xff94('0x29'));_0x4a0edf[_0xff94('0x31')]=_[_0xff94('0x32')](_0xc592e[_0xff94('0x31')]);_0x4a0edf[_0xff94('0x33')]=_[_0xff94('0x34')](_0x4a0edf[_0xff94('0x30')],_0x4a0edf[_0xff94('0x31')]);_0x3df7ab[_0xff94('0x35')]=_[_0xff94('0x34')](_0x4a0edf[_0xff94('0x30')],qs['fields'](_0xc592e[_0xff94('0x31')][_0xff94('0x36')]));_0x3df7ab[_0xff94('0x35')]=_0x3df7ab[_0xff94('0x35')][_0xff94('0x37')]?_0x3df7ab['attributes']:_0x4a0edf['model'];if(!_0xc592e[_0xff94('0x31')]['hasOwnProperty'](_0xff94('0x38'))){_0x3df7ab['limit']=qs['limit'](_0xc592e[_0xff94('0x31')][_0xff94('0x1e')]);_0x3df7ab[_0xff94('0x1c')]=qs[_0xff94('0x1c')](_0xc592e[_0xff94('0x31')]['offset']);}_0x3df7ab[_0xff94('0x39')]=qs[_0xff94('0x3a')](_0xc592e[_0xff94('0x31')][_0xff94('0x3a')]);_0x3df7ab[_0xff94('0x3b')]=qs[_0xff94('0x33')](_[_0xff94('0x3c')](_0xc592e[_0xff94('0x31')],_0x4a0edf[_0xff94('0x33')]),_0x2eb93b);if(_0xc592e[_0xff94('0x31')][_0xff94('0x3d')]){_0x3df7ab['where']=_[_0xff94('0x3e')](_0x3df7ab[_0xff94('0x3b')],{'$or':_['map'](_0x2eb93b,function(_0x27404a){if(_0x27404a[_0xff94('0x3f')]!==_0xff94('0x40')){var _0x44f741={};_0x44f741[_0x27404a[_0xff94('0x29')]]={'$like':'%'+_0xc592e[_0xff94('0x31')][_0xff94('0x3d')]+'%'};return _0x44f741;}})});}_0x3df7ab=_[_0xff94('0x3e')]({},_0x3df7ab,_0xc592e[_0xff94('0x41')]);var _0x49a2e6={'where':_0x3df7ab[_0xff94('0x3b')]};return db[_0xff94('0x2d')][_0xff94('0x1f')](_0x49a2e6)[_0xff94('0x24')](function(_0x594adb){_0x214c33[_0xff94('0x1f')]=_0x594adb;if(_0xc592e[_0xff94('0x31')][_0xff94('0x42')]){_0x3df7ab[_0xff94('0x43')]=[{'all':!![]}];}return db[_0xff94('0x2d')]['findAll'](_0x3df7ab);})['then'](function(_0x2910eb){_0x214c33[_0xff94('0x44')]=_0x2910eb;return _0x214c33;})[_0xff94('0x24')](respondWithFilteredResult(_0x1091d7,_0x3df7ab))[_0xff94('0x45')](handleError(_0x1091d7,null));};exports['show']=function(_0x1acacc,_0x1f2c4e){var _0x2b7f56={'raw':!![],'where':{'id':_0x1acacc[_0xff94('0x46')]['id']}},_0x15887e={};_0x15887e[_0xff94('0x30')]=_[_0xff94('0x32')](db[_0xff94('0x2d')][_0xff94('0x47')]);_0x15887e[_0xff94('0x31')]=_[_0xff94('0x32')](_0x1acacc['query']);_0x15887e[_0xff94('0x33')]=_['intersection'](_0x15887e[_0xff94('0x30')],_0x15887e['query']);_0x2b7f56[_0xff94('0x35')]=_['intersection'](_0x15887e[_0xff94('0x30')],qs['fields'](_0x1acacc[_0xff94('0x31')][_0xff94('0x36')]));_0x2b7f56['attributes']=_0x2b7f56[_0xff94('0x35')]['length']?_0x2b7f56[_0xff94('0x35')]:_0x15887e[_0xff94('0x30')];if(_0x1acacc[_0xff94('0x31')][_0xff94('0x42')]){_0x2b7f56[_0xff94('0x43')]=[{'all':!![]}];}_0x2b7f56=_[_0xff94('0x3e')]({},_0x2b7f56,_0x1acacc[_0xff94('0x41')]);return db[_0xff94('0x2d')][_0xff94('0x48')](_0x2b7f56)[_0xff94('0x24')](handleEntityNotFound(_0x1f2c4e,null))[_0xff94('0x24')](respondWithResult(_0x1f2c4e,null))['catch'](handleError(_0x1f2c4e,null));};exports[_0xff94('0x49')]=function(_0x2f76c9,_0x1b96d7){return db[_0xff94('0x2d')]['create'](_0x2f76c9[_0xff94('0x4a')],{})[_0xff94('0x24')](respondWithResult(_0x1b96d7,0xc9))[_0xff94('0x45')](handleError(_0x1b96d7,null));};exports[_0xff94('0x4b')]=function(_0x1cf9b6,_0x3ff7cb){if(_0x1cf9b6[_0xff94('0x4a')]['id']){delete _0x1cf9b6[_0xff94('0x4a')]['id'];}return db[_0xff94('0x2d')][_0xff94('0x48')]({'where':{'id':_0x1cf9b6[_0xff94('0x46')]['id']}})[_0xff94('0x24')](handleEntityNotFound(_0x3ff7cb,null))[_0xff94('0x24')](saveUpdates(_0x1cf9b6['body'],null))[_0xff94('0x24')](respondWithResult(_0x3ff7cb,null))[_0xff94('0x45')](handleError(_0x3ff7cb,null));};exports['destroy']=function(_0x3ea2b2,_0x1f1b0b){return db['SmsQueueReport'][_0xff94('0x48')]({'where':{'id':_0x3ea2b2[_0xff94('0x46')]['id']}})[_0xff94('0x24')](handleEntityNotFound(_0x1f1b0b,null))[_0xff94('0x24')](removeEntity(_0x1f1b0b,null))[_0xff94('0x45')](handleError(_0x1f1b0b,null));};exports['describe']=function(_0x269908,_0x1c70d4){return db[_0xff94('0x2d')][_0xff94('0x4c')]()[_0xff94('0x24')](respondWithResult(_0x1c70d4,null))[_0xff94('0x45')](handleError(_0x1c70d4,null));}; \ No newline at end of file +var _0x284b=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','index','map','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SmsQueueReport','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','papaparse','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x284b,0x159));var _0xb284=function(_0x304c2e,_0x1f4942){_0x304c2e=_0x304c2e-0x0;var _0x24a79a=_0x284b[_0x304c2e];return _0x24a79a;};'use strict';var emlformat=require(_0xb284('0x0'));var rimraf=require(_0xb284('0x1'));var zipdir=require(_0xb284('0x2'));var jsonpatch=require(_0xb284('0x3'));var rp=require(_0xb284('0x4'));var moment=require('moment');var BPromise=require(_0xb284('0x5'));var Mustache=require(_0xb284('0x6'));var util=require(_0xb284('0x7'));var path=require(_0xb284('0x8'));var sox=require(_0xb284('0x9'));var csv=require(_0xb284('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb284('0xb'));var crypto=require(_0xb284('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb284('0xa'));var querystring=require('querystring');var Papa=require(_0xb284('0xd'));var Redis=require('ioredis');var authService=require(_0xb284('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb284('0xf'));var logger=require(_0xb284('0x10'))(_0xb284('0x11'));var utils=require(_0xb284('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xb284('0x13'));var db=require(_0xb284('0x14'))['db'];function respondWithStatusCode(_0x130ac8,_0x423b24){_0x423b24=_0x423b24||0xcc;return function(_0x529b8b){if(_0x529b8b){return _0x130ac8[_0xb284('0x15')](_0x423b24);}return _0x130ac8[_0xb284('0x16')](_0x423b24)[_0xb284('0x17')]();};}function respondWithResult(_0x4e9da4,_0x141a71){_0x141a71=_0x141a71||0xc8;return function(_0x293d2f){if(_0x293d2f){return _0x4e9da4['status'](_0x141a71)[_0xb284('0x18')](_0x293d2f);}};}function respondWithFilteredResult(_0x4f55e0,_0x1489f3){return function(_0x5e4d7b){if(_0x5e4d7b){var _0x291bba=typeof _0x1489f3[_0xb284('0x19')]===_0xb284('0x1a')&&typeof _0x1489f3[_0xb284('0x1b')]===_0xb284('0x1a');var _0x34bc16=_0x5e4d7b[_0xb284('0x1c')];var _0x135be3=_0x291bba?0x0:_0x1489f3[_0xb284('0x19')];var _0xfcf12f=_0x291bba?_0x5e4d7b[_0xb284('0x1c')]:_0x1489f3[_0xb284('0x19')]+_0x1489f3[_0xb284('0x1b')];var _0x4a880d;if(_0xfcf12f>=_0x34bc16){_0xfcf12f=_0x34bc16;_0x4a880d=0xc8;}else{_0x4a880d=0xce;}_0x4f55e0[_0xb284('0x16')](_0x4a880d);return _0x4f55e0[_0xb284('0x1d')](_0xb284('0x1e'),_0x135be3+'-'+_0xfcf12f+'/'+_0x34bc16)[_0xb284('0x18')](_0x5e4d7b);}return null;};}function patchUpdates(_0x5d103e){return function(_0x253156){try{jsonpatch['apply'](_0x253156,_0x5d103e,!![]);}catch(_0x2c45fc){return BPromise[_0xb284('0x1f')](_0x2c45fc);}return _0x253156[_0xb284('0x20')]();};}function saveUpdates(_0x1d6cba,_0x2e453f){return function(_0x2f8436){if(_0x2f8436){return _0x2f8436[_0xb284('0x21')](_0x1d6cba)[_0xb284('0x22')](function(_0x2e5b4f){return _0x2e5b4f;});}return null;};}function removeEntity(_0x684260,_0x5f3abb){return function(_0x2c0c57){if(_0x2c0c57){return _0x2c0c57[_0xb284('0x23')]()[_0xb284('0x22')](function(){_0x684260['status'](0xcc)[_0xb284('0x17')]();});}};}function handleEntityNotFound(_0x469d64,_0x3ac7fd){return function(_0x935283){if(!_0x935283){_0x469d64['sendStatus'](0x194);}return _0x935283;};}function handleError(_0x504ace,_0x3c5039){_0x3c5039=_0x3c5039||0x1f4;return function(_0x271e73){logger[_0xb284('0x24')](_0x271e73[_0xb284('0x25')]);if(_0x271e73['name']){delete _0x271e73['name'];}_0x504ace[_0xb284('0x16')](_0x3c5039)['send'](_0x271e73);};}exports[_0xb284('0x26')]=function(_0x22fc3b,_0xc5df14){var _0x4f1eca={},_0x5f4741={},_0x43cb42={'count':0x0,'rows':[]};var _0x271dcd=_[_0xb284('0x27')](db['SmsQueueReport'][_0xb284('0x28')],function(_0xc2b89c){return{'name':_0xc2b89c[_0xb284('0x29')],'type':_0xc2b89c[_0xb284('0x2a')][_0xb284('0x2b')]};});_0x5f4741['model']=_[_0xb284('0x27')](_0x271dcd,_0xb284('0x2c'));_0x5f4741[_0xb284('0x2d')]=_['keys'](_0x22fc3b[_0xb284('0x2d')]);_0x5f4741[_0xb284('0x2e')]=_[_0xb284('0x2f')](_0x5f4741[_0xb284('0x30')],_0x5f4741[_0xb284('0x2d')]);_0x4f1eca[_0xb284('0x31')]=_[_0xb284('0x2f')](_0x5f4741['model'],qs[_0xb284('0x32')](_0x22fc3b[_0xb284('0x2d')][_0xb284('0x32')]));_0x4f1eca[_0xb284('0x31')]=_0x4f1eca['attributes'][_0xb284('0x33')]?_0x4f1eca[_0xb284('0x31')]:_0x5f4741[_0xb284('0x30')];if(!_0x22fc3b[_0xb284('0x2d')][_0xb284('0x34')](_0xb284('0x35'))){_0x4f1eca[_0xb284('0x1b')]=qs[_0xb284('0x1b')](_0x22fc3b[_0xb284('0x2d')][_0xb284('0x1b')]);_0x4f1eca[_0xb284('0x19')]=qs['offset'](_0x22fc3b[_0xb284('0x2d')][_0xb284('0x19')]);}_0x4f1eca['order']=qs[_0xb284('0x36')](_0x22fc3b[_0xb284('0x2d')][_0xb284('0x36')]);_0x4f1eca[_0xb284('0x37')]=qs[_0xb284('0x2e')](_[_0xb284('0x38')](_0x22fc3b['query'],_0x5f4741['filters']),_0x271dcd);if(_0x22fc3b[_0xb284('0x2d')][_0xb284('0x39')]){_0x4f1eca[_0xb284('0x37')]=_[_0xb284('0x3a')](_0x4f1eca['where'],{'$or':_[_0xb284('0x27')](_0x271dcd,function(_0x32a8c0){if(_0x32a8c0['type']!=='VIRTUAL'){var _0x27d913={};_0x27d913[_0x32a8c0['name']]={'$like':'%'+_0x22fc3b[_0xb284('0x2d')][_0xb284('0x39')]+'%'};return _0x27d913;}})});}_0x4f1eca=_[_0xb284('0x3a')]({},_0x4f1eca,_0x22fc3b[_0xb284('0x3b')]);var _0x5b104d={'where':_0x4f1eca[_0xb284('0x37')]};return db[_0xb284('0x3c')][_0xb284('0x1c')](_0x5b104d)[_0xb284('0x22')](function(_0x51a928){_0x43cb42[_0xb284('0x1c')]=_0x51a928;if(_0x22fc3b[_0xb284('0x2d')][_0xb284('0x3d')]){_0x4f1eca[_0xb284('0x3e')]=[{'all':!![]}];}return db[_0xb284('0x3c')][_0xb284('0x3f')](_0x4f1eca);})[_0xb284('0x22')](function(_0x1479a4){_0x43cb42[_0xb284('0x40')]=_0x1479a4;return _0x43cb42;})[_0xb284('0x22')](respondWithFilteredResult(_0xc5df14,_0x4f1eca))['catch'](handleError(_0xc5df14,null));};exports['show']=function(_0x4b5688,_0x3f6199){var _0x2aff66={'raw':!![],'where':{'id':_0x4b5688[_0xb284('0x41')]['id']}},_0x1fdd0f={};_0x1fdd0f[_0xb284('0x30')]=_[_0xb284('0x42')](db['SmsQueueReport'][_0xb284('0x28')]);_0x1fdd0f[_0xb284('0x2d')]=_[_0xb284('0x42')](_0x4b5688['query']);_0x1fdd0f['filters']=_['intersection'](_0x1fdd0f[_0xb284('0x30')],_0x1fdd0f['query']);_0x2aff66[_0xb284('0x31')]=_[_0xb284('0x2f')](_0x1fdd0f[_0xb284('0x30')],qs[_0xb284('0x32')](_0x4b5688[_0xb284('0x2d')]['fields']));_0x2aff66[_0xb284('0x31')]=_0x2aff66[_0xb284('0x31')][_0xb284('0x33')]?_0x2aff66[_0xb284('0x31')]:_0x1fdd0f[_0xb284('0x30')];if(_0x4b5688[_0xb284('0x2d')][_0xb284('0x3d')]){_0x2aff66[_0xb284('0x3e')]=[{'all':!![]}];}_0x2aff66=_['merge']({},_0x2aff66,_0x4b5688['options']);return db[_0xb284('0x3c')][_0xb284('0x43')](_0x2aff66)[_0xb284('0x22')](handleEntityNotFound(_0x3f6199,null))['then'](respondWithResult(_0x3f6199,null))[_0xb284('0x44')](handleError(_0x3f6199,null));};exports[_0xb284('0x45')]=function(_0x208e10,_0x23cf85){return db[_0xb284('0x3c')][_0xb284('0x45')](_0x208e10[_0xb284('0x46')],{})[_0xb284('0x22')](respondWithResult(_0x23cf85,0xc9))[_0xb284('0x44')](handleError(_0x23cf85,null));};exports[_0xb284('0x21')]=function(_0xd8f077,_0x573040){if(_0xd8f077[_0xb284('0x46')]['id']){delete _0xd8f077['body']['id'];}return db[_0xb284('0x3c')][_0xb284('0x43')]({'where':{'id':_0xd8f077['params']['id']}})[_0xb284('0x22')](handleEntityNotFound(_0x573040,null))[_0xb284('0x22')](saveUpdates(_0xd8f077['body'],null))[_0xb284('0x22')](respondWithResult(_0x573040,null))[_0xb284('0x44')](handleError(_0x573040,null));};exports['destroy']=function(_0x3b1430,_0x5d25af){return db[_0xb284('0x3c')][_0xb284('0x43')]({'where':{'id':_0x3b1430[_0xb284('0x41')]['id']}})[_0xb284('0x22')](handleEntityNotFound(_0x5d25af,null))[_0xb284('0x22')](removeEntity(_0x5d25af,null))[_0xb284('0x44')](handleError(_0x5d25af,null));};exports[_0xb284('0x47')]=function(_0x5503e8,_0x56fc30){return db['SmsQueueReport'][_0xb284('0x47')]()[_0xb284('0x22')](respondWithResult(_0x56fc30,null))[_0xb284('0x44')](handleError(_0x56fc30,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 0d8dfe7..00a7868 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['define','SmsQueueReport','report_sms_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x2e5860,_0x56363c){var _0x3c477c=function(_0x1e07fa){while(--_0x1e07fa){_0x2e5860['push'](_0x2e5860['shift']());}};_0x3c477c(++_0x56363c);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var 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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x142b86,_0x685d8e){var _0x32b39e=function(_0x505e10){while(--_0x505e10){_0x142b86['push'](_0x142b86['shift']());}};_0x32b39e(++_0x685d8e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xcb91[_0x15c421];return _0x5e5ed5;};'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')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 989e993..8dcfc3a 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 _0xf7bb=['attributes','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','options','raw','update','body'];(function(_0x3add96,_0x1e76f8){var _0x2f43fb=function(_0x178048){while(--_0x178048){_0x3add96['push'](_0x3add96['shift']());}};_0x2f43fb(++_0x1e76f8);}(_0xf7bb,0x179));var _0xbf7b=function(_0x333409,_0x8bdf47){_0x333409=_0x333409-0x0;var _0x3649f1=_0xf7bb[_0x333409];return _0x3649f1;};'use strict';var _=require(_0xbf7b('0x0'));var util=require(_0xbf7b('0x1'));var moment=require(_0xbf7b('0x2'));var BPromise=require(_0xbf7b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf7b('0x4'));var db=require(_0xbf7b('0x5'))['db'];var utils=require(_0xbf7b('0x6'));var logger=require(_0xbf7b('0x7'))(_0xbf7b('0x8'));var config=require(_0xbf7b('0x9'));var jayson=require(_0xbf7b('0xa'));var client=jayson[_0xbf7b('0xb')][_0xbf7b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c88fd,_0x5ac06a,_0x9fa768){return new BPromise(function(_0x2a891e,_0x57fe49){return client[_0xbf7b('0xd')](_0x3c88fd,_0x9fa768)[_0xbf7b('0xe')](function(_0x1cc27c){logger[_0xbf7b('0xf')](_0xbf7b('0x10'),_0x5ac06a,_0xbf7b('0x11'));logger[_0xbf7b('0x12')](_0xbf7b('0x13'),_0x5ac06a,_0xbf7b('0x11'),JSON[_0xbf7b('0x14')](_0x1cc27c));if(_0x1cc27c[_0xbf7b('0x15')]){if(_0x1cc27c[_0xbf7b('0x15')][_0xbf7b('0x16')]===0x1f4){logger[_0xbf7b('0x15')](_0xbf7b('0x10'),_0x5ac06a,_0x1cc27c[_0xbf7b('0x15')]['message']);return _0x57fe49(_0x1cc27c[_0xbf7b('0x15')][_0xbf7b('0x17')]);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x5ac06a,_0x1cc27c['error'][_0xbf7b('0x17')]);return _0x2a891e(_0x1cc27c['error'][_0xbf7b('0x17')]);}else{logger[_0xbf7b('0xf')](_0xbf7b('0x10'),_0x5ac06a,_0xbf7b('0x11'));_0x2a891e(_0x1cc27c[_0xbf7b('0x18')]['message']);}})[_0xbf7b('0x19')](function(_0x2d5ccc){logger[_0xbf7b('0x15')]('SmsQueueReport,\x20%s,\x20%s',_0x5ac06a,_0x2d5ccc);_0x57fe49(_0x2d5ccc);});});}exports[_0xbf7b('0x1a')]=function(_0x4b2d14){var _0x16a7ba=this;return new Promise(function(_0x24aa27,_0x45e59f){return db['SmsQueueReport']['create'](_0x4b2d14['body'],{'raw':_0x4b2d14[_0xbf7b('0x1b')]?_0x4b2d14[_0xbf7b('0x1b')][_0xbf7b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x1159b3){logger[_0xbf7b('0xf')](_0xbf7b('0x1a'),_0x4b2d14);logger[_0xbf7b('0x12')](_0xbf7b('0x1a'),_0x4b2d14,JSON[_0xbf7b('0x14')](_0x1159b3));_0x24aa27(_0x1159b3);})[_0xbf7b('0x19')](function(_0x26b034){logger[_0xbf7b('0x15')](_0xbf7b('0x1a'),_0x26b034[_0xbf7b('0x17')],_0x4b2d14);_0x45e59f(_0x16a7ba[_0xbf7b('0x15')](0x1f4,_0x26b034[_0xbf7b('0x17')]));});});};exports['UpdateSmsQueueReport']=function(_0x50babd){var _0x1a6ec1=this;return new Promise(function(_0x14a445,_0x583800){return db['SmsQueueReport'][_0xbf7b('0x1d')](_0x50babd[_0xbf7b('0x1e')],{'raw':_0x50babd[_0xbf7b('0x1b')]?_0x50babd['options'][_0xbf7b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50babd[_0xbf7b('0x1b')]?_0x50babd[_0xbf7b('0x1b')]['where']||null:null,'attributes':_0x50babd[_0xbf7b('0x1b')]?_0x50babd['options'][_0xbf7b('0x1f')]||null:null,'limit':_0x50babd[_0xbf7b('0x1b')]?_0x50babd[_0xbf7b('0x1b')][_0xbf7b('0x20')]||null:null})[_0xbf7b('0xe')](function(_0x19fbe3){logger[_0xbf7b('0xf')](_0xbf7b('0x21'),_0x50babd);logger[_0xbf7b('0x12')](_0xbf7b('0x21'),_0x50babd,JSON[_0xbf7b('0x14')](_0x19fbe3));_0x14a445(_0x19fbe3);})['catch'](function(_0x620089){logger['error'](_0xbf7b('0x21'),_0x620089[_0xbf7b('0x17')],_0x50babd);_0x583800(_0x1a6ec1[_0xbf7b('0x15')](0x1f4,_0x620089[_0xbf7b('0x17')]));});});}; \ No newline at end of file +var _0x3dbe=['debug','UpdateSmsQueueReport','update','body','attributes','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','then'];(function(_0x1c56ad,_0x45f210){var _0x27d60c=function(_0x3d543e){while(--_0x3d543e){_0x1c56ad['push'](_0x1c56ad['shift']());}};_0x27d60c(++_0x45f210);}(_0x3dbe,0xec));var _0xe3db=function(_0x206dd8,_0x385e80){_0x206dd8=_0x206dd8-0x0;var _0x1d0daf=_0x3dbe[_0x206dd8];return _0x1d0daf;};'use strict';var _=require(_0xe3db('0x0'));var util=require('util');var moment=require(_0xe3db('0x1'));var BPromise=require(_0xe3db('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe3db('0x3'));var db=require(_0xe3db('0x4'))['db'];var utils=require(_0xe3db('0x5'));var logger=require(_0xe3db('0x6'))(_0xe3db('0x7'));var config=require(_0xe3db('0x8'));var jayson=require(_0xe3db('0x9'));var client=jayson[_0xe3db('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3327ad,_0x590407,_0x42669b){return new BPromise(function(_0x3427a5,_0x3a71f2){return client[_0xe3db('0xb')](_0x3327ad,_0x42669b)['then'](function(_0x5adbcb){logger[_0xe3db('0xc')](_0xe3db('0xd'),_0x590407,_0xe3db('0xe'));logger['debug'](_0xe3db('0xf'),_0x590407,_0xe3db('0xe'),JSON[_0xe3db('0x10')](_0x5adbcb));if(_0x5adbcb['error']){if(_0x5adbcb[_0xe3db('0x11')][_0xe3db('0x12')]===0x1f4){logger[_0xe3db('0x11')](_0xe3db('0xd'),_0x590407,_0x5adbcb[_0xe3db('0x11')][_0xe3db('0x13')]);return _0x3a71f2(_0x5adbcb[_0xe3db('0x11')]['message']);}logger[_0xe3db('0x11')](_0xe3db('0xd'),_0x590407,_0x5adbcb[_0xe3db('0x11')][_0xe3db('0x13')]);return _0x3427a5(_0x5adbcb[_0xe3db('0x11')]['message']);}else{logger[_0xe3db('0xc')](_0xe3db('0xd'),_0x590407,_0xe3db('0xe'));_0x3427a5(_0x5adbcb[_0xe3db('0x14')][_0xe3db('0x13')]);}})[_0xe3db('0x15')](function(_0x3831b4){logger[_0xe3db('0x11')](_0xe3db('0xd'),_0x590407,_0x3831b4);_0x3a71f2(_0x3831b4);});});}exports[_0xe3db('0x16')]=function(_0x289569){var _0x5829be=this;return new Promise(function(_0x2ce6bc,_0x9fde4e){return db[_0xe3db('0x17')][_0xe3db('0x18')](_0x289569['body'],{'raw':_0x289569['options']?_0x289569[_0xe3db('0x19')][_0xe3db('0x1a')]===undefined?!![]:![]:!![]})[_0xe3db('0x1b')](function(_0x523cb8){logger[_0xe3db('0xc')]('CreateSmsQueueReport',_0x289569);logger[_0xe3db('0x1c')]('CreateSmsQueueReport',_0x289569,JSON[_0xe3db('0x10')](_0x523cb8));_0x2ce6bc(_0x523cb8);})[_0xe3db('0x15')](function(_0x74f8e5){logger[_0xe3db('0x11')](_0xe3db('0x16'),_0x74f8e5[_0xe3db('0x13')],_0x289569);_0x9fde4e(_0x5829be[_0xe3db('0x11')](0x1f4,_0x74f8e5['message']));});});};exports[_0xe3db('0x1d')]=function(_0xa21a1c){var _0x4dc09e=this;return new Promise(function(_0x2b87e6,_0x26da13){return db[_0xe3db('0x17')][_0xe3db('0x1e')](_0xa21a1c[_0xe3db('0x1f')],{'raw':_0xa21a1c[_0xe3db('0x19')]?_0xa21a1c[_0xe3db('0x19')][_0xe3db('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xa21a1c[_0xe3db('0x19')]?_0xa21a1c[_0xe3db('0x19')]['where']||null:null,'attributes':_0xa21a1c[_0xe3db('0x19')]?_0xa21a1c[_0xe3db('0x19')][_0xe3db('0x20')]||null:null,'limit':_0xa21a1c[_0xe3db('0x19')]?_0xa21a1c[_0xe3db('0x19')]['limit']||null:null})['then'](function(_0x2b7033){logger[_0xe3db('0xc')](_0xe3db('0x1d'),_0xa21a1c);logger[_0xe3db('0x1c')](_0xe3db('0x1d'),_0xa21a1c,JSON['stringify'](_0x2b7033));_0x2b87e6(_0x2b7033);})[_0xe3db('0x15')](function(_0x75d575){logger[_0xe3db('0x11')](_0xe3db('0x1d'),_0x75d575[_0xe3db('0x13')],_0xa21a1c);_0x26da13(_0x4dc09e['error'](0x1f4,_0x75d575[_0xe3db('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0c653e0..8ccb306 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 _0x6c32=['get','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller'];(function(_0x271345,_0x165229){var _0x6dad70=function(_0x1f0480){while(--_0x1f0480){_0x271345['push'](_0x271345['shift']());}};_0x6dad70(++_0x165229);}(_0x6c32,0x6e));var _0x26c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6c32[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x26c3('0x0'));var util=require(_0x26c3('0x1'));var path=require(_0x26c3('0x2'));var timeout=require(_0x26c3('0x3'));var express=require(_0x26c3('0x4'));var router=express[_0x26c3('0x5')]();var fs_extra=require(_0x26c3('0x6'));var auth=require(_0x26c3('0x7'));var interaction=require(_0x26c3('0x8'));var config=require('../../config/environment');var controller=require(_0x26c3('0x9'));router[_0x26c3('0xa')]('/',auth[_0x26c3('0xb')](),controller['index']);router[_0x26c3('0xa')]('/describe',auth[_0x26c3('0xb')](),controller[_0x26c3('0xc')]);router[_0x26c3('0xa')](_0x26c3('0xd'),auth[_0x26c3('0xb')](),controller[_0x26c3('0xe')]);router[_0x26c3('0xf')]('/',auth[_0x26c3('0xb')](),controller[_0x26c3('0x10')]);router[_0x26c3('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x26c3('0xd'),auth[_0x26c3('0xb')](),controller[_0x26c3('0x12')]);module[_0x26c3('0x13')]=router; \ No newline at end of file +var _0x8a28=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy'];(function(_0x10de11,_0x43c2cb){var _0x4bf433=function(_0x2d0779){while(--_0x2d0779){_0x10de11['push'](_0x10de11['shift']());}};_0x4bf433(++_0x43c2cb);}(_0x8a28,0xfd));var _0x88a2=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x8a28[_0x491a7f];return _0x3d8f44;};'use strict';var multer=require(_0x88a2('0x0'));var util=require(_0x88a2('0x1'));var path=require(_0x88a2('0x2'));var timeout=require(_0x88a2('0x3'));var express=require(_0x88a2('0x4'));var router=express[_0x88a2('0x5')]();var fs_extra=require(_0x88a2('0x6'));var auth=require(_0x88a2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x88a2('0x8'));var controller=require(_0x88a2('0x9'));router[_0x88a2('0xa')]('/',auth[_0x88a2('0xb')](),controller[_0x88a2('0xc')]);router['get'](_0x88a2('0xd'),auth['isAuthenticated'](),controller[_0x88a2('0xe')]);router[_0x88a2('0xa')](_0x88a2('0xf'),auth[_0x88a2('0xb')](),controller[_0x88a2('0x10')]);router[_0x88a2('0x11')]('/',auth[_0x88a2('0xb')](),controller[_0x88a2('0x12')]);router[_0x88a2('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x88a2('0x14')]);router[_0x88a2('0x15')](_0x88a2('0xf'),auth[_0x88a2('0xb')](),controller[_0x88a2('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ac91225..d3f85db 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(_0x11731f,_0x2271b5){var _0x14587c=function(_0x31e014){while(--_0x31e014){_0x11731f['push'](_0x11731f['shift']());}};_0x14587c(++_0x2271b5);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x5b07b8,_0x17f5ce){var _0x4a1dff=function(_0x7ac587){while(--_0x7ac587){_0x5b07b8['push'](_0x5b07b8['shift']());}};_0x4a1dff(++_0x17f5ce);}(_0xedd9,0xfc));var _0x9edd=function(_0xc33556,_0x4e1362){_0xc33556=_0xc33556-0x0;var _0x220734=_0xedd9[_0xc33556];return _0x220734;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 090e3bd..8f81cc7 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 _0xbdff=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','stack','name','send','index','SmsTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x3f7101,_0x3af08b){var _0x1a30a0=function(_0x750e5b){while(--_0x750e5b){_0x3f7101['push'](_0x3f7101['shift']());}};_0x1a30a0(++_0x3af08b);}(_0xbdff,0x12c));var _0xfbdf=function(_0x34eb18,_0x4ffc3b){_0x34eb18=_0x34eb18-0x0;var _0x234bc2=_0xbdff[_0x34eb18];return _0x234bc2;};'use strict';var emlformat=require(_0xfbdf('0x0'));var rimraf=require(_0xfbdf('0x1'));var zipdir=require(_0xfbdf('0x2'));var jsonpatch=require(_0xfbdf('0x3'));var rp=require(_0xfbdf('0x4'));var moment=require(_0xfbdf('0x5'));var BPromise=require(_0xfbdf('0x6'));var Mustache=require(_0xfbdf('0x7'));var util=require(_0xfbdf('0x8'));var path=require(_0xfbdf('0x9'));var sox=require(_0xfbdf('0xa'));var csv=require(_0xfbdf('0xb'));var ejs=require(_0xfbdf('0xc'));var fs=require('fs');var fs_extra=require(_0xfbdf('0xd'));var _=require(_0xfbdf('0xe'));var squel=require(_0xfbdf('0xf'));var crypto=require(_0xfbdf('0x10'));var jsforce=require(_0xfbdf('0x11'));var deskjs=require('desk.js');var toCsv=require(_0xfbdf('0xb'));var querystring=require(_0xfbdf('0x12'));var Papa=require(_0xfbdf('0x13'));var Redis=require('ioredis');var authService=require(_0xfbdf('0x14'));var qs=require(_0xfbdf('0x15'));var as=require(_0xfbdf('0x16'));var hardwareService=require(_0xfbdf('0x17'));var logger=require(_0xfbdf('0x18'))(_0xfbdf('0x19'));var utils=require('../../config/utils');var config=require(_0xfbdf('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbdf('0x1b'))['db'];function respondWithStatusCode(_0x37b670,_0x348823){_0x348823=_0x348823||0xcc;return function(_0x469cad){if(_0x469cad){return _0x37b670[_0xfbdf('0x1c')](_0x348823);}return _0x37b670[_0xfbdf('0x1d')](_0x348823)[_0xfbdf('0x1e')]();};}function respondWithResult(_0x4378ae,_0x16dc92){_0x16dc92=_0x16dc92||0xc8;return function(_0x304ad7){if(_0x304ad7){return _0x4378ae['status'](_0x16dc92)[_0xfbdf('0x1f')](_0x304ad7);}};}function respondWithFilteredResult(_0x571394,_0x3d50bb){return function(_0x4a21ae){if(_0x4a21ae){var _0x180deb=typeof _0x3d50bb[_0xfbdf('0x20')]===_0xfbdf('0x21')&&typeof _0x3d50bb[_0xfbdf('0x22')]===_0xfbdf('0x21');var _0x1e927f=_0x4a21ae['count'];var _0x618015=_0x180deb?0x0:_0x3d50bb['offset'];var _0x4a8688=_0x180deb?_0x4a21ae[_0xfbdf('0x23')]:_0x3d50bb[_0xfbdf('0x20')]+_0x3d50bb[_0xfbdf('0x22')];var _0x17b2d9;if(_0x4a8688>=_0x1e927f){_0x4a8688=_0x1e927f;_0x17b2d9=0xc8;}else{_0x17b2d9=0xce;}_0x571394['status'](_0x17b2d9);return _0x571394[_0xfbdf('0x24')](_0xfbdf('0x25'),_0x618015+'-'+_0x4a8688+'/'+_0x1e927f)['json'](_0x4a21ae);}return null;};}function patchUpdates(_0x3ba312){return function(_0x405511){try{jsonpatch['apply'](_0x405511,_0x3ba312,!![]);}catch(_0x32ed3f){return BPromise[_0xfbdf('0x26')](_0x32ed3f);}return _0x405511[_0xfbdf('0x27')]();};}function saveUpdates(_0x2d29c8,_0x1ecfb0){return function(_0x23de3e){if(_0x23de3e){return _0x23de3e['update'](_0x2d29c8)[_0xfbdf('0x28')](function(_0x258eee){return _0x258eee;});}return null;};}function removeEntity(_0xb7eb7b,_0x6ca470){return function(_0x2212d1){if(_0x2212d1){return _0x2212d1['destroy']()[_0xfbdf('0x28')](function(){_0xb7eb7b[_0xfbdf('0x1d')](0xcc)[_0xfbdf('0x1e')]();});}};}function handleEntityNotFound(_0x4822f3,_0x561826){return function(_0x1bd220){if(!_0x1bd220){_0x4822f3[_0xfbdf('0x1c')](0x194);}return _0x1bd220;};}function handleError(_0x1c007a,_0x5275cd){_0x5275cd=_0x5275cd||0x1f4;return function(_0x1474c7){logger['error'](_0x1474c7[_0xfbdf('0x29')]);if(_0x1474c7['name']){delete _0x1474c7[_0xfbdf('0x2a')];}_0x1c007a['status'](_0x5275cd)[_0xfbdf('0x2b')](_0x1474c7);};}exports[_0xfbdf('0x2c')]=function(_0xc5ab98,_0xd38de4){var _0x5d8f84={},_0x33b8b7={},_0x4d356f={'count':0x0,'rows':[]};var _0x97e0f3=_['map'](db[_0xfbdf('0x2d')][_0xfbdf('0x2e')],function(_0x4e9c4c){return{'name':_0x4e9c4c[_0xfbdf('0x2f')],'type':_0x4e9c4c[_0xfbdf('0x30')][_0xfbdf('0x31')]};});_0x33b8b7['model']=_[_0xfbdf('0x32')](_0x97e0f3,'name');_0x33b8b7[_0xfbdf('0x33')]=_[_0xfbdf('0x34')](_0xc5ab98[_0xfbdf('0x33')]);_0x33b8b7[_0xfbdf('0x35')]=_[_0xfbdf('0x36')](_0x33b8b7[_0xfbdf('0x37')],_0x33b8b7[_0xfbdf('0x33')]);_0x5d8f84[_0xfbdf('0x38')]=_[_0xfbdf('0x36')](_0x33b8b7['model'],qs['fields'](_0xc5ab98[_0xfbdf('0x33')][_0xfbdf('0x39')]));_0x5d8f84['attributes']=_0x5d8f84[_0xfbdf('0x38')][_0xfbdf('0x3a')]?_0x5d8f84[_0xfbdf('0x38')]:_0x33b8b7['model'];if(!_0xc5ab98[_0xfbdf('0x33')][_0xfbdf('0x3b')](_0xfbdf('0x3c'))){_0x5d8f84['limit']=qs[_0xfbdf('0x22')](_0xc5ab98[_0xfbdf('0x33')][_0xfbdf('0x22')]);_0x5d8f84[_0xfbdf('0x20')]=qs['offset'](_0xc5ab98[_0xfbdf('0x33')][_0xfbdf('0x20')]);}_0x5d8f84[_0xfbdf('0x3d')]=qs['sort'](_0xc5ab98['query'][_0xfbdf('0x3e')]);_0x5d8f84[_0xfbdf('0x3f')]=qs['filters'](_[_0xfbdf('0x40')](_0xc5ab98[_0xfbdf('0x33')],_0x33b8b7[_0xfbdf('0x35')]),_0x97e0f3);if(_0xc5ab98[_0xfbdf('0x33')][_0xfbdf('0x41')]){_0x5d8f84[_0xfbdf('0x3f')]=_['merge'](_0x5d8f84['where'],{'$or':_[_0xfbdf('0x32')](_0x97e0f3,function(_0x589298){if(_0x589298[_0xfbdf('0x30')]!==_0xfbdf('0x42')){var _0x3ca4df={};_0x3ca4df[_0x589298[_0xfbdf('0x2a')]]={'$like':'%'+_0xc5ab98['query'][_0xfbdf('0x41')]+'%'};return _0x3ca4df;}})});}_0x5d8f84=_[_0xfbdf('0x43')]({},_0x5d8f84,_0xc5ab98[_0xfbdf('0x44')]);var _0x26de34={'where':_0x5d8f84['where']};return db['SmsTransferReport'][_0xfbdf('0x23')](_0x26de34)[_0xfbdf('0x28')](function(_0x5b189a){_0x4d356f['count']=_0x5b189a;if(_0xc5ab98[_0xfbdf('0x33')][_0xfbdf('0x45')]){_0x5d8f84[_0xfbdf('0x46')]=[{'all':!![]}];}return db[_0xfbdf('0x2d')][_0xfbdf('0x47')](_0x5d8f84);})[_0xfbdf('0x28')](function(_0x1bc706){_0x4d356f[_0xfbdf('0x48')]=_0x1bc706;return _0x4d356f;})[_0xfbdf('0x28')](respondWithFilteredResult(_0xd38de4,_0x5d8f84))['catch'](handleError(_0xd38de4,null));};exports[_0xfbdf('0x49')]=function(_0x5ecef2,_0x1e0dfe){var _0x1130e8={'raw':!![],'where':{'id':_0x5ecef2[_0xfbdf('0x4a')]['id']}},_0x4d1425={};_0x4d1425[_0xfbdf('0x37')]=_[_0xfbdf('0x34')](db[_0xfbdf('0x2d')][_0xfbdf('0x2e')]);_0x4d1425[_0xfbdf('0x33')]=_[_0xfbdf('0x34')](_0x5ecef2[_0xfbdf('0x33')]);_0x4d1425['filters']=_['intersection'](_0x4d1425[_0xfbdf('0x37')],_0x4d1425[_0xfbdf('0x33')]);_0x1130e8[_0xfbdf('0x38')]=_[_0xfbdf('0x36')](_0x4d1425[_0xfbdf('0x37')],qs[_0xfbdf('0x39')](_0x5ecef2[_0xfbdf('0x33')][_0xfbdf('0x39')]));_0x1130e8[_0xfbdf('0x38')]=_0x1130e8[_0xfbdf('0x38')][_0xfbdf('0x3a')]?_0x1130e8[_0xfbdf('0x38')]:_0x4d1425[_0xfbdf('0x37')];if(_0x5ecef2[_0xfbdf('0x33')][_0xfbdf('0x45')]){_0x1130e8[_0xfbdf('0x46')]=[{'all':!![]}];}_0x1130e8=_[_0xfbdf('0x43')]({},_0x1130e8,_0x5ecef2[_0xfbdf('0x44')]);return db[_0xfbdf('0x2d')][_0xfbdf('0x4b')](_0x1130e8)[_0xfbdf('0x28')](handleEntityNotFound(_0x1e0dfe,null))['then'](respondWithResult(_0x1e0dfe,null))[_0xfbdf('0x4c')](handleError(_0x1e0dfe,null));};exports[_0xfbdf('0x4d')]=function(_0x1a29f5,_0x113741){return db[_0xfbdf('0x2d')][_0xfbdf('0x4d')](_0x1a29f5[_0xfbdf('0x4e')],{})[_0xfbdf('0x28')](respondWithResult(_0x113741,0xc9))[_0xfbdf('0x4c')](handleError(_0x113741,null));};exports[_0xfbdf('0x4f')]=function(_0x557073,_0x51cf07){if(_0x557073['body']['id']){delete _0x557073[_0xfbdf('0x4e')]['id'];}return db[_0xfbdf('0x2d')]['find']({'where':{'id':_0x557073[_0xfbdf('0x4a')]['id']}})[_0xfbdf('0x28')](handleEntityNotFound(_0x51cf07,null))[_0xfbdf('0x28')](saveUpdates(_0x557073[_0xfbdf('0x4e')],null))['then'](respondWithResult(_0x51cf07,null))[_0xfbdf('0x4c')](handleError(_0x51cf07,null));};exports[_0xfbdf('0x50')]=function(_0xcdb0d9,_0x5d4ea8){return db[_0xfbdf('0x2d')][_0xfbdf('0x4b')]({'where':{'id':_0xcdb0d9[_0xfbdf('0x4a')]['id']}})[_0xfbdf('0x28')](handleEntityNotFound(_0x5d4ea8,null))['then'](removeEntity(_0x5d4ea8,null))['catch'](handleError(_0x5d4ea8,null));};exports[_0xfbdf('0x51')]=function(_0x1e3ff3,_0x1b7644){return db[_0xfbdf('0x2d')][_0xfbdf('0x51')]()[_0xfbdf('0x28')](respondWithResult(_0x1b7644,null))[_0xfbdf('0x4c')](handleError(_0x1b7644,null));}; \ No newline at end of file +var _0xc9cd=['findAll','rows','catch','show','params','options','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','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','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','map','SmsTransferReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0xc9cd,0x12b));var _0xdc9c=function(_0x41b0a8,_0x1b05cc){_0x41b0a8=_0x41b0a8-0x0;var _0x3a83d4=_0xc9cd[_0x41b0a8];return _0x3a83d4;};'use strict';var emlformat=require(_0xdc9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdc9c('0x1'));var jsonpatch=require(_0xdc9c('0x2'));var rp=require(_0xdc9c('0x3'));var moment=require('moment');var BPromise=require(_0xdc9c('0x4'));var Mustache=require(_0xdc9c('0x5'));var util=require(_0xdc9c('0x6'));var path=require('path');var sox=require(_0xdc9c('0x7'));var csv=require('to-csv');var ejs=require(_0xdc9c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdc9c('0x9'));var squel=require(_0xdc9c('0xa'));var crypto=require('crypto');var jsforce=require(_0xdc9c('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xdc9c('0xc'));var Redis=require(_0xdc9c('0xd'));var authService=require(_0xdc9c('0xe'));var qs=require(_0xdc9c('0xf'));var as=require(_0xdc9c('0x10'));var hardwareService=require(_0xdc9c('0x11'));var logger=require(_0xdc9c('0x12'))('api');var utils=require(_0xdc9c('0x13'));var config=require(_0xdc9c('0x14'));var licenseUtil=require(_0xdc9c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dfa53,_0x13d48b){_0x13d48b=_0x13d48b||0xcc;return function(_0x17870a){if(_0x17870a){return _0x5dfa53[_0xdc9c('0x16')](_0x13d48b);}return _0x5dfa53[_0xdc9c('0x17')](_0x13d48b)[_0xdc9c('0x18')]();};}function respondWithResult(_0x592e81,_0x3196a0){_0x3196a0=_0x3196a0||0xc8;return function(_0x41e82f){if(_0x41e82f){return _0x592e81['status'](_0x3196a0)['json'](_0x41e82f);}};}function respondWithFilteredResult(_0x43cb00,_0x4faa93){return function(_0x15d66e){if(_0x15d66e){var _0x33277f=typeof _0x4faa93[_0xdc9c('0x19')]===_0xdc9c('0x1a')&&typeof _0x4faa93[_0xdc9c('0x1b')]===_0xdc9c('0x1a');var _0x4a90da=_0x15d66e[_0xdc9c('0x1c')];var _0x19b1f3=_0x33277f?0x0:_0x4faa93[_0xdc9c('0x19')];var _0x1ede83=_0x33277f?_0x15d66e['count']:_0x4faa93[_0xdc9c('0x19')]+_0x4faa93['limit'];var _0x1a710a;if(_0x1ede83>=_0x4a90da){_0x1ede83=_0x4a90da;_0x1a710a=0xc8;}else{_0x1a710a=0xce;}_0x43cb00[_0xdc9c('0x17')](_0x1a710a);return _0x43cb00['set'](_0xdc9c('0x1d'),_0x19b1f3+'-'+_0x1ede83+'/'+_0x4a90da)[_0xdc9c('0x1e')](_0x15d66e);}return null;};}function patchUpdates(_0x316325){return function(_0x5b8858){try{jsonpatch[_0xdc9c('0x1f')](_0x5b8858,_0x316325,!![]);}catch(_0x34640b){return BPromise[_0xdc9c('0x20')](_0x34640b);}return _0x5b8858[_0xdc9c('0x21')]();};}function saveUpdates(_0xec0ac,_0x234a3b){return function(_0x34ab53){if(_0x34ab53){return _0x34ab53['update'](_0xec0ac)[_0xdc9c('0x22')](function(_0x18e625){return _0x18e625;});}return null;};}function removeEntity(_0x2a8b7c,_0x3c2f91){return function(_0x21461d){if(_0x21461d){return _0x21461d[_0xdc9c('0x23')]()[_0xdc9c('0x22')](function(){_0x2a8b7c['status'](0xcc)[_0xdc9c('0x18')]();});}};}function handleEntityNotFound(_0x332de0,_0x4510d9){return function(_0x52382b){if(!_0x52382b){_0x332de0[_0xdc9c('0x16')](0x194);}return _0x52382b;};}function handleError(_0x1d6ec5,_0x2c9d4e){_0x2c9d4e=_0x2c9d4e||0x1f4;return function(_0x165c4a){logger[_0xdc9c('0x24')](_0x165c4a['stack']);if(_0x165c4a[_0xdc9c('0x25')]){delete _0x165c4a[_0xdc9c('0x25')];}_0x1d6ec5[_0xdc9c('0x17')](_0x2c9d4e)[_0xdc9c('0x26')](_0x165c4a);};}exports[_0xdc9c('0x27')]=function(_0x46c4f,_0xbcf393){var _0x154a7a={},_0x9068cf={},_0x9b2ef2={'count':0x0,'rows':[]};var _0x264e87=_[_0xdc9c('0x28')](db[_0xdc9c('0x29')][_0xdc9c('0x2a')],function(_0x1db461){return{'name':_0x1db461['fieldName'],'type':_0x1db461['type']['key']};});_0x9068cf[_0xdc9c('0x2b')]=_[_0xdc9c('0x28')](_0x264e87,_0xdc9c('0x25'));_0x9068cf[_0xdc9c('0x2c')]=_[_0xdc9c('0x2d')](_0x46c4f[_0xdc9c('0x2c')]);_0x9068cf[_0xdc9c('0x2e')]=_[_0xdc9c('0x2f')](_0x9068cf['model'],_0x9068cf['query']);_0x154a7a[_0xdc9c('0x30')]=_[_0xdc9c('0x2f')](_0x9068cf[_0xdc9c('0x2b')],qs['fields'](_0x46c4f[_0xdc9c('0x2c')][_0xdc9c('0x31')]));_0x154a7a[_0xdc9c('0x30')]=_0x154a7a[_0xdc9c('0x30')][_0xdc9c('0x32')]?_0x154a7a[_0xdc9c('0x30')]:_0x9068cf[_0xdc9c('0x2b')];if(!_0x46c4f[_0xdc9c('0x2c')][_0xdc9c('0x33')]('nolimit')){_0x154a7a['limit']=qs[_0xdc9c('0x1b')](_0x46c4f['query'][_0xdc9c('0x1b')]);_0x154a7a[_0xdc9c('0x19')]=qs['offset'](_0x46c4f[_0xdc9c('0x2c')][_0xdc9c('0x19')]);}_0x154a7a['order']=qs[_0xdc9c('0x34')](_0x46c4f[_0xdc9c('0x2c')][_0xdc9c('0x34')]);_0x154a7a[_0xdc9c('0x35')]=qs['filters'](_[_0xdc9c('0x36')](_0x46c4f[_0xdc9c('0x2c')],_0x9068cf[_0xdc9c('0x2e')]),_0x264e87);if(_0x46c4f[_0xdc9c('0x2c')]['filter']){_0x154a7a['where']=_[_0xdc9c('0x37')](_0x154a7a[_0xdc9c('0x35')],{'$or':_[_0xdc9c('0x28')](_0x264e87,function(_0x27c1c9){if(_0x27c1c9[_0xdc9c('0x38')]!==_0xdc9c('0x39')){var _0x39e447={};_0x39e447[_0x27c1c9[_0xdc9c('0x25')]]={'$like':'%'+_0x46c4f[_0xdc9c('0x2c')][_0xdc9c('0x3a')]+'%'};return _0x39e447;}})});}_0x154a7a=_[_0xdc9c('0x37')]({},_0x154a7a,_0x46c4f['options']);var _0x55049f={'where':_0x154a7a[_0xdc9c('0x35')]};return db[_0xdc9c('0x29')]['count'](_0x55049f)['then'](function(_0x46df57){_0x9b2ef2[_0xdc9c('0x1c')]=_0x46df57;if(_0x46c4f[_0xdc9c('0x2c')][_0xdc9c('0x3b')]){_0x154a7a[_0xdc9c('0x3c')]=[{'all':!![]}];}return db[_0xdc9c('0x29')][_0xdc9c('0x3d')](_0x154a7a);})['then'](function(_0x3d3929){_0x9b2ef2[_0xdc9c('0x3e')]=_0x3d3929;return _0x9b2ef2;})[_0xdc9c('0x22')](respondWithFilteredResult(_0xbcf393,_0x154a7a))[_0xdc9c('0x3f')](handleError(_0xbcf393,null));};exports[_0xdc9c('0x40')]=function(_0x55669c,_0x198995){var _0x4f27a2={'raw':!![],'where':{'id':_0x55669c[_0xdc9c('0x41')]['id']}},_0x930cb4={};_0x930cb4[_0xdc9c('0x2b')]=_[_0xdc9c('0x2d')](db[_0xdc9c('0x29')]['rawAttributes']);_0x930cb4['query']=_[_0xdc9c('0x2d')](_0x55669c[_0xdc9c('0x2c')]);_0x930cb4['filters']=_['intersection'](_0x930cb4[_0xdc9c('0x2b')],_0x930cb4[_0xdc9c('0x2c')]);_0x4f27a2['attributes']=_[_0xdc9c('0x2f')](_0x930cb4[_0xdc9c('0x2b')],qs[_0xdc9c('0x31')](_0x55669c[_0xdc9c('0x2c')][_0xdc9c('0x31')]));_0x4f27a2[_0xdc9c('0x30')]=_0x4f27a2[_0xdc9c('0x30')][_0xdc9c('0x32')]?_0x4f27a2['attributes']:_0x930cb4[_0xdc9c('0x2b')];if(_0x55669c[_0xdc9c('0x2c')]['includeAll']){_0x4f27a2[_0xdc9c('0x3c')]=[{'all':!![]}];}_0x4f27a2=_[_0xdc9c('0x37')]({},_0x4f27a2,_0x55669c[_0xdc9c('0x42')]);return db['SmsTransferReport'][_0xdc9c('0x43')](_0x4f27a2)[_0xdc9c('0x22')](handleEntityNotFound(_0x198995,null))[_0xdc9c('0x22')](respondWithResult(_0x198995,null))[_0xdc9c('0x3f')](handleError(_0x198995,null));};exports[_0xdc9c('0x44')]=function(_0x51a789,_0x12675f){return db['SmsTransferReport'][_0xdc9c('0x44')](_0x51a789[_0xdc9c('0x45')],{})[_0xdc9c('0x22')](respondWithResult(_0x12675f,0xc9))[_0xdc9c('0x3f')](handleError(_0x12675f,null));};exports[_0xdc9c('0x46')]=function(_0x3f110f,_0x2940c3){if(_0x3f110f['body']['id']){delete _0x3f110f[_0xdc9c('0x45')]['id'];}return db[_0xdc9c('0x29')][_0xdc9c('0x43')]({'where':{'id':_0x3f110f[_0xdc9c('0x41')]['id']}})[_0xdc9c('0x22')](handleEntityNotFound(_0x2940c3,null))[_0xdc9c('0x22')](saveUpdates(_0x3f110f['body'],null))[_0xdc9c('0x22')](respondWithResult(_0x2940c3,null))[_0xdc9c('0x3f')](handleError(_0x2940c3,null));};exports['destroy']=function(_0x17e5f4,_0x908335){return db[_0xdc9c('0x29')][_0xdc9c('0x43')]({'where':{'id':_0x17e5f4[_0xdc9c('0x41')]['id']}})[_0xdc9c('0x22')](handleEntityNotFound(_0x908335,null))[_0xdc9c('0x22')](removeEntity(_0x908335,null))[_0xdc9c('0x3f')](handleError(_0x908335,null));};exports[_0xdc9c('0x47')]=function(_0x4affe9,_0x4bb0a6){return db['SmsTransferReport'][_0xdc9c('0x47')]()['then'](respondWithResult(_0x4bb0a6,null))[_0xdc9c('0x3f')](handleError(_0x4bb0a6,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 93109c0..e214283 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 _0x761e=['../../config/logger','api','moment','bluebird','request-promise','path','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util'];(function(_0xf3d3d,_0x18c710){var _0x1e5511=function(_0x2b25e9){while(--_0x2b25e9){_0xf3d3d['push'](_0xf3d3d['shift']());}};_0x1e5511(++_0x18c710);}(_0x761e,0x14e));var _0xe761=function(_0x5f5cce,_0x138cc5){_0x5f5cce=_0x5f5cce-0x0;var _0x705ecf=_0x761e[_0x5f5cce];return _0x705ecf;};'use strict';var _=require(_0xe761('0x0'));var util=require(_0xe761('0x1'));var logger=require(_0xe761('0x2'))(_0xe761('0x3'));var moment=require(_0xe761('0x4'));var BPromise=require(_0xe761('0x5'));var rp=require(_0xe761('0x6'));var fs=require('fs');var path=require(_0xe761('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe761('0x8'));module[_0xe761('0x9')]=function(_0x4c35b7,_0xbe7b6d){return _0x4c35b7[_0xe761('0xa')](_0xe761('0xb'),attributes,{'tableName':_0xe761('0xc'),'paranoid':![],'indexes':[{'name':_0xe761('0xd'),'fields':[_0xe761('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc999=['api','rimraf','./smsTransferReport.attributes','define','report_sms_transfer','uniqueid','util','../../config/logger'];(function(_0xdcf054,_0xfe32c1){var _0x8f2d67=function(_0x438d25){while(--_0x438d25){_0xdcf054['push'](_0xdcf054['shift']());}};_0x8f2d67(++_0xfe32c1);}(_0xc999,0x176));var _0x9c99=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0xc999[_0x4d2f00];return _0x2d7b7f;};'use strict';var _=require('lodash');var util=require(_0x9c99('0x0'));var logger=require(_0x9c99('0x1'))(_0x9c99('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(_0x9c99('0x3'));var config=require('../../config/environment');var attributes=require(_0x9c99('0x4'));module['exports']=function(_0x35f5f4,_0x1ce762){return _0x35f5f4[_0x9c99('0x5')]('SmsTransferReport',attributes,{'tableName':_0x9c99('0x6'),'paranoid':![],'indexes':[{'name':_0x9c99('0x7'),'fields':[_0x9c99('0x7')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index a3ba16c..f8a3a4d 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 _0x7da7=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x361b37,_0xc5a7ee){var _0x80ed9b=function(_0x1b5390){while(--_0x1b5390){_0x361b37['push'](_0x361b37['shift']());}};_0x80ed9b(++_0xc5a7ee);}(_0x7da7,0x10d));var _0x77da=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0x7da7[_0x1b7368];return _0x25d54c;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var moment=require(_0x77da('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x77da('0x3'));var db=require(_0x77da('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x77da('0x5'))(_0x77da('0x6'));var config=require('../../config/environment');var jayson=require(_0x77da('0x7'));var client=jayson[_0x77da('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30afe0,_0x47cf1d,_0x1191de){return new BPromise(function(_0x13992e,_0x37c5ab){return client[_0x77da('0x9')](_0x30afe0,_0x1191de)[_0x77da('0xa')](function(_0x58f3fe){logger[_0x77da('0xb')](_0x77da('0xc'),_0x47cf1d,_0x77da('0xd'));logger['debug'](_0x77da('0xe'),_0x47cf1d,_0x77da('0xd'),JSON[_0x77da('0xf')](_0x58f3fe));if(_0x58f3fe[_0x77da('0x10')]){if(_0x58f3fe['error'][_0x77da('0x11')]===0x1f4){logger[_0x77da('0x10')](_0x77da('0xc'),_0x47cf1d,_0x58f3fe['error']['message']);return _0x37c5ab(_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);}logger['error'](_0x77da('0xc'),_0x47cf1d,_0x58f3fe[_0x77da('0x10')][_0x77da('0x12')]);return _0x13992e(_0x58f3fe[_0x77da('0x10')]['message']);}else{logger[_0x77da('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x47cf1d,_0x77da('0xd'));_0x13992e(_0x58f3fe[_0x77da('0x13')][_0x77da('0x12')]);}})[_0x77da('0x14')](function(_0x4ecd98){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x47cf1d,_0x4ecd98);_0x37c5ab(_0x4ecd98);});});} \ No newline at end of file +var _0xc73a=['../../config/environment','jayson/promise','client','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc73a,0x72));var _0xac73=function(_0xc1d7e8,_0x552cb3){_0xc1d7e8=_0xc1d7e8-0x0;var _0xa07a93=_0xc73a[_0xc1d7e8];return _0xa07a93;};'use strict';var _=require('lodash');var util=require(_0xac73('0x0'));var moment=require(_0xac73('0x1'));var BPromise=require(_0xac73('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac73('0x3'))['db'];var utils=require(_0xac73('0x4'));var logger=require(_0xac73('0x5'))('rpc');var config=require(_0xac73('0x6'));var jayson=require(_0xac73('0x7'));var client=jayson[_0xac73('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9eb408,_0x24a1bc,_0x1cc38a){return new BPromise(function(_0x22638a,_0x4fe9a1){return client[_0xac73('0x9')](_0x9eb408,_0x1cc38a)['then'](function(_0x5da0ee){logger[_0xac73('0xa')](_0xac73('0xb'),_0x24a1bc,_0xac73('0xc'));logger[_0xac73('0xd')](_0xac73('0xe'),_0x24a1bc,_0xac73('0xc'),JSON[_0xac73('0xf')](_0x5da0ee));if(_0x5da0ee[_0xac73('0x10')]){if(_0x5da0ee['error'][_0xac73('0x11')]===0x1f4){logger[_0xac73('0x10')](_0xac73('0xb'),_0x24a1bc,_0x5da0ee[_0xac73('0x10')][_0xac73('0x12')]);return _0x4fe9a1(_0x5da0ee[_0xac73('0x10')]['message']);}logger[_0xac73('0x10')]('SmsTransferReport,\x20%s,\x20%s',_0x24a1bc,_0x5da0ee[_0xac73('0x10')][_0xac73('0x12')]);return _0x22638a(_0x5da0ee[_0xac73('0x10')][_0xac73('0x12')]);}else{logger['info'](_0xac73('0xb'),_0x24a1bc,_0xac73('0xc'));_0x22638a(_0x5da0ee['result'][_0xac73('0x12')]);}})[_0xac73('0x13')](function(_0x196f7a){logger['error'](_0xac73('0xb'),_0x24a1bc,_0x196f7a);_0x4fe9a1(_0x196f7a);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 0e3019c..5d1fc57 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 _0xabe5=['replace','format','%s-%s%s','extname','now','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','/:id','isAuthenticated','show','/:id/download','diskStorage','root','server/files/sounds/original/','originalname'];(function(_0x34a34d,_0x3011d9){var _0x5a79aa=function(_0x53cbc5){while(--_0x53cbc5){_0x34a34d['push'](_0x34a34d['shift']());}};_0x5a79aa(++_0x3011d9);}(_0xabe5,0x1eb));var _0x5abe=function(_0x28109a,_0x5f4cf4){_0x28109a=_0x28109a-0x0;var _0x4fbaea=_0xabe5[_0x28109a];return _0x4fbaea;};'use strict';var multer=require(_0x5abe('0x0'));var util=require(_0x5abe('0x1'));var path=require(_0x5abe('0x2'));var timeout=require(_0x5abe('0x3'));var express=require('express');var router=express[_0x5abe('0x4')]();var fs_extra=require(_0x5abe('0x5'));var auth=require(_0x5abe('0x6'));var interaction=require(_0x5abe('0x7'));var config=require('../../config/environment');var controller=require(_0x5abe('0x8'));router[_0x5abe('0x9')]('/',auth['isAuthenticated'](),controller[_0x5abe('0xa')]);router[_0x5abe('0x9')](_0x5abe('0xb'),auth[_0x5abe('0xc')](),controller[_0x5abe('0xd')]);router['get'](_0x5abe('0xe'),auth[_0x5abe('0xc')](),controller['download']);var upload=multer({'storage':multer[_0x5abe('0xf')]({'destination':function(_0x143c4e,_0x34d443,_0x443237){_0x443237(null,path['join'](config[_0x5abe('0x10')],_0x5abe('0x11')));},'filename':function(_0x12a251,_0x5b6a00,_0x1cc5b3){_0x5b6a00[_0x5abe('0x12')]=_0x5b6a00[_0x5abe('0x12')][_0x5abe('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1cc5b3(null,util[_0x5abe('0x14')](_0x5abe('0x15'),path['basename'](_0x5b6a00[_0x5abe('0x12')],path[_0x5abe('0x16')](_0x5b6a00[_0x5abe('0x12')])),Date[_0x5abe('0x17')](),path[_0x5abe('0x16')](_0x5b6a00[_0x5abe('0x12')])));}})});router[_0x5abe('0x18')]('/',upload['single']('file'),controller[_0x5abe('0x19')]);router[_0x5abe('0x1a')](_0x5abe('0xb'),auth[_0x5abe('0xc')](),controller[_0x5abe('0x1b')]);router['delete']('/:id',auth[_0x5abe('0xc')](),controller[_0x5abe('0x1c')]);module[_0x5abe('0x1d')]=router; \ No newline at end of file +var _0x8581=['get','isAuthenticated','index','show','/:id/download','download','diskStorage','originalname','replace','format','%s-%s%s','extname','now','post','single','update','delete','/:id','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x166d93,_0x301f09){var _0xba708=function(_0x349bf7){while(--_0x349bf7){_0x166d93['push'](_0x166d93['shift']());}};_0xba708(++_0x301f09);}(_0x8581,0x1a2));var _0x1858=function(_0xe66f5a,_0x20056b){_0xe66f5a=_0xe66f5a-0x0;var _0x9f6f71=_0x8581[_0xe66f5a];return _0x9f6f71;};'use strict';var multer=require(_0x1858('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1858('0x1'));var express=require(_0x1858('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1858('0x3'));var interaction=require(_0x1858('0x4'));var config=require(_0x1858('0x5'));var controller=require(_0x1858('0x6'));router[_0x1858('0x7')]('/',auth[_0x1858('0x8')](),controller[_0x1858('0x9')]);router[_0x1858('0x7')]('/:id',auth[_0x1858('0x8')](),controller[_0x1858('0xa')]);router[_0x1858('0x7')](_0x1858('0xb'),auth[_0x1858('0x8')](),controller[_0x1858('0xc')]);var upload=multer({'storage':multer[_0x1858('0xd')]({'destination':function(_0x127b22,_0x52dfe7,_0x1c78eb){_0x1c78eb(null,path['join'](config['root'],'server/files/sounds/original/'));},'filename':function(_0x570772,_0x2b8250,_0x16bb9e){_0x2b8250[_0x1858('0xe')]=_0x2b8250['originalname'][_0x1858('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x16bb9e(null,util[_0x1858('0x10')](_0x1858('0x11'),path['basename'](_0x2b8250[_0x1858('0xe')],path[_0x1858('0x12')](_0x2b8250[_0x1858('0xe')])),Date[_0x1858('0x13')](),path[_0x1858('0x12')](_0x2b8250[_0x1858('0xe')])));}})});router[_0x1858('0x14')]('/',upload[_0x1858('0x15')]('file'),controller['create']);router['put']('/:id',auth[_0x1858('0x8')](),controller[_0x1858('0x16')]);router[_0x1858('0x17')](_0x1858('0x18'),auth['isAuthenticated'](),controller[_0x1858('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 0972ff7..9759eab 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 _0xe678=['sequelize','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0xe678,0x1d4));var _0x8e67=function(_0x175ad1,_0x6a5922){_0x175ad1=_0x175ad1-0x0;var _0x487408=_0xe678[_0x175ad1];return _0x487408;};'use strict';var Sequelize=require(_0x8e67('0x0'));module['exports']={'name':{'type':Sequelize[_0x8e67('0x1')],'unique':_0x8e67('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x8e67('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x8e67('0x3')]},'original_sampleCount':{'type':Sequelize[_0x8e67('0x4')]},'original_channelCount':{'type':Sequelize[_0x8e67('0x5')]},'original_bitRate':{'type':Sequelize[_0x8e67('0x4')]},'original_sampleRate':{'type':Sequelize[_0x8e67('0x5')]},'converted_format':{'type':Sequelize[_0x8e67('0x1')]},'converted_duration':{'type':Sequelize[_0x8e67('0x3')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x8e67('0x5')]},'converted_bitRate':{'type':Sequelize[_0x8e67('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x8e67('0x5')]}}; \ No newline at end of file +var _0x7cb6=['name','FLOAT','INTEGER','BIGINT','exports','STRING'];(function(_0x421196,_0x1cbd94){var _0x2738af=function(_0xc956ff){while(--_0xc956ff){_0x421196['push'](_0x421196['shift']());}};_0x2738af(++_0x1cbd94);}(_0x7cb6,0xe8));var _0x67cb=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7cb6[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require('sequelize');module[_0x67cb('0x0')]={'name':{'type':Sequelize[_0x67cb('0x1')],'unique':_0x67cb('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x67cb('0x1')]},'display_name':{'type':Sequelize[_0x67cb('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x67cb('0x1')]},'original_format':{'type':Sequelize[_0x67cb('0x1')]},'original_duration':{'type':Sequelize[_0x67cb('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x67cb('0x4')]},'original_bitRate':{'type':Sequelize[_0x67cb('0x5')]},'original_sampleRate':{'type':Sequelize[_0x67cb('0x4')]},'converted_format':{'type':Sequelize[_0x67cb('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x67cb('0x5')]},'converted_channelCount':{'type':Sequelize[_0x67cb('0x4')]},'converted_bitRate':{'type':Sequelize[_0x67cb('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x67cb('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index cbc6454..d166109 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 _0xd086=['rows','catch','show','include','download','find','save_name','converted_format','root','server/files/sounds/converted','Sequelize','ValidationError','join','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','params','server/files/sounds/original','original_format','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','UserProfileResource','end','error','name','send','index','map','Sound','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','type','VIRTUAL','filter','options','includeAll','findAll'];(function(_0x3b4d7a,_0x240c00){var _0x97bfa1=function(_0x4b4ab9){while(--_0x4b4ab9){_0x3b4d7a['push'](_0x3b4d7a['shift']());}};_0x97bfa1(++_0x240c00);}(_0xd086,0x130));var _0x6d08=function(_0x49527,_0x34587c){_0x49527=_0x49527-0x0;var _0x4ab74a=_0xd086[_0x49527];return _0x4ab74a;};'use strict';var emlformat=require(_0x6d08('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6d08('0x1'));var jsonpatch=require(_0x6d08('0x2'));var rp=require('request-promise');var moment=require(_0x6d08('0x3'));var BPromise=require(_0x6d08('0x4'));var Mustache=require('mustache');var util=require(_0x6d08('0x5'));var path=require(_0x6d08('0x6'));var sox=require('sox');var csv=require(_0x6d08('0x7'));var ejs=require(_0x6d08('0x8'));var fs=require('fs');var fs_extra=require(_0x6d08('0x9'));var _=require(_0x6d08('0xa'));var squel=require(_0x6d08('0xb'));var crypto=require(_0x6d08('0xc'));var jsforce=require(_0x6d08('0xd'));var deskjs=require(_0x6d08('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6d08('0xf'));var authService=require(_0x6d08('0x10'));var qs=require(_0x6d08('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d08('0x12'));var logger=require(_0x6d08('0x13'))(_0x6d08('0x14'));var utils=require(_0x6d08('0x15'));var config=require(_0x6d08('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x6d08('0x17'))['db'];function respondWithStatusCode(_0x59980d,_0x395728){_0x395728=_0x395728||0xcc;return function(_0x3e712c){if(_0x3e712c){return _0x59980d[_0x6d08('0x18')](_0x395728);}return _0x59980d[_0x6d08('0x19')](_0x395728)['end']();};}function respondWithResult(_0x79c287,_0x56ceac){_0x56ceac=_0x56ceac||0xc8;return function(_0x4ca3f6){if(_0x4ca3f6){return _0x79c287[_0x6d08('0x19')](_0x56ceac)[_0x6d08('0x1a')](_0x4ca3f6);}};}function respondWithFilteredResult(_0x6e26f1,_0x1dcc55){return function(_0x480a80){if(_0x480a80){var _0x5713b4=typeof _0x1dcc55[_0x6d08('0x1b')]===_0x6d08('0x1c')&&typeof _0x1dcc55[_0x6d08('0x1d')]===_0x6d08('0x1c');var _0x2edf79=_0x480a80[_0x6d08('0x1e')];var _0x18e74e=_0x5713b4?0x0:_0x1dcc55[_0x6d08('0x1b')];var _0x40f0d8=_0x5713b4?_0x480a80['count']:_0x1dcc55[_0x6d08('0x1b')]+_0x1dcc55['limit'];var _0x203e38;if(_0x40f0d8>=_0x2edf79){_0x40f0d8=_0x2edf79;_0x203e38=0xc8;}else{_0x203e38=0xce;}_0x6e26f1[_0x6d08('0x19')](_0x203e38);return _0x6e26f1[_0x6d08('0x1f')]('Content-Range',_0x18e74e+'-'+_0x40f0d8+'/'+_0x2edf79)[_0x6d08('0x1a')](_0x480a80);}return null;};}function patchUpdates(_0x5f16f5){return function(_0x179024){try{jsonpatch[_0x6d08('0x20')](_0x179024,_0x5f16f5,!![]);}catch(_0x1b9f4f){return BPromise['reject'](_0x1b9f4f);}return _0x179024[_0x6d08('0x21')]();};}function saveUpdates(_0xc8daf2,_0x26a7df){return function(_0x41c7ed){if(_0x41c7ed){return _0x41c7ed[_0x6d08('0x22')](_0xc8daf2)[_0x6d08('0x23')](function(_0x3fdeba){return _0x3fdeba;});}return null;};}function removeEntity(_0x11097c,_0x415b02){return function(_0x382d83){if(_0x382d83){return _0x382d83[_0x6d08('0x24')]()[_0x6d08('0x23')](function(){var _0x2badd8=_0x382d83[_0x6d08('0x25')]({'plain':!![]});var _0x476201='Sounds';return db[_0x6d08('0x26')]['destroy']({'where':{'type':_0x476201,'resourceId':_0x2badd8['id']}})[_0x6d08('0x23')](function(){return _0x382d83;});})[_0x6d08('0x23')](function(){_0x11097c['status'](0xcc)[_0x6d08('0x27')]();});}};}function handleEntityNotFound(_0x478cad,_0x3e94aa){return function(_0x4a12bd){if(!_0x4a12bd){_0x478cad[_0x6d08('0x18')](0x194);}return _0x4a12bd;};}function handleError(_0x406b2d,_0x2ab8c2){_0x2ab8c2=_0x2ab8c2||0x1f4;return function(_0x324de8){logger[_0x6d08('0x28')](_0x324de8['stack']);if(_0x324de8[_0x6d08('0x29')]){delete _0x324de8[_0x6d08('0x29')];}_0x406b2d[_0x6d08('0x19')](_0x2ab8c2)[_0x6d08('0x2a')](_0x324de8);};}exports[_0x6d08('0x2b')]=function(_0x5839b0,_0x3cb508){var _0x37cd3c={},_0x4d1338={},_0x226faf={'count':0x0,'rows':[]};var _0x5a25d5=_[_0x6d08('0x2c')](db[_0x6d08('0x2d')][_0x6d08('0x2e')],function(_0x14f7a3){return{'name':_0x14f7a3[_0x6d08('0x2f')],'type':_0x14f7a3['type']['key']};});_0x4d1338[_0x6d08('0x30')]=_['map'](_0x5a25d5,_0x6d08('0x29'));_0x4d1338[_0x6d08('0x31')]=_[_0x6d08('0x32')](_0x5839b0[_0x6d08('0x31')]);_0x4d1338[_0x6d08('0x33')]=_[_0x6d08('0x34')](_0x4d1338['model'],_0x4d1338[_0x6d08('0x31')]);_0x37cd3c[_0x6d08('0x35')]=_['intersection'](_0x4d1338[_0x6d08('0x30')],qs[_0x6d08('0x36')](_0x5839b0[_0x6d08('0x31')][_0x6d08('0x36')]));_0x37cd3c[_0x6d08('0x35')]=_0x37cd3c[_0x6d08('0x35')][_0x6d08('0x37')]?_0x37cd3c[_0x6d08('0x35')]:_0x4d1338[_0x6d08('0x30')];if(!_0x5839b0[_0x6d08('0x31')][_0x6d08('0x38')]('nolimit')){_0x37cd3c[_0x6d08('0x1d')]=qs[_0x6d08('0x1d')](_0x5839b0[_0x6d08('0x31')]['limit']);_0x37cd3c['offset']=qs['offset'](_0x5839b0[_0x6d08('0x31')][_0x6d08('0x1b')]);}_0x37cd3c[_0x6d08('0x39')]=qs[_0x6d08('0x3a')](_0x5839b0[_0x6d08('0x31')]['sort']);_0x37cd3c['where']=qs[_0x6d08('0x33')](_[_0x6d08('0x3b')](_0x5839b0['query'],_0x4d1338[_0x6d08('0x33')]),_0x5a25d5);if(_0x5839b0[_0x6d08('0x31')]['filter']){_0x37cd3c[_0x6d08('0x3c')]=_[_0x6d08('0x3d')](_0x37cd3c[_0x6d08('0x3c')],{'$or':_[_0x6d08('0x2c')](_0x5a25d5,function(_0xaa6379){if(_0xaa6379[_0x6d08('0x3e')]!==_0x6d08('0x3f')){var _0x20ed1a={};_0x20ed1a[_0xaa6379[_0x6d08('0x29')]]={'$like':'%'+_0x5839b0[_0x6d08('0x31')][_0x6d08('0x40')]+'%'};return _0x20ed1a;}})});}_0x37cd3c=_[_0x6d08('0x3d')]({},_0x37cd3c,_0x5839b0[_0x6d08('0x41')]);var _0x239ef4={'where':_0x37cd3c['where']};return db[_0x6d08('0x2d')][_0x6d08('0x1e')](_0x239ef4)[_0x6d08('0x23')](function(_0x1a25c6){_0x226faf[_0x6d08('0x1e')]=_0x1a25c6;if(_0x5839b0[_0x6d08('0x31')][_0x6d08('0x42')]){_0x37cd3c['include']=[{'all':!![]}];}return db['Sound'][_0x6d08('0x43')](_0x37cd3c);})['then'](function(_0xcddcae){_0x226faf[_0x6d08('0x44')]=_0xcddcae;return _0x226faf;})[_0x6d08('0x23')](respondWithFilteredResult(_0x3cb508,_0x37cd3c))[_0x6d08('0x45')](handleError(_0x3cb508,null));};exports[_0x6d08('0x46')]=function(_0x209ae9,_0xcfaaa){var _0x4cee83={'raw':!![],'where':{'id':_0x209ae9['params']['id']}},_0x5cf7f9={};_0x5cf7f9['model']=_[_0x6d08('0x32')](db[_0x6d08('0x2d')]['rawAttributes']);_0x5cf7f9[_0x6d08('0x31')]=_['keys'](_0x209ae9[_0x6d08('0x31')]);_0x5cf7f9[_0x6d08('0x33')]=_['intersection'](_0x5cf7f9[_0x6d08('0x30')],_0x5cf7f9[_0x6d08('0x31')]);_0x4cee83['attributes']=_[_0x6d08('0x34')](_0x5cf7f9[_0x6d08('0x30')],qs[_0x6d08('0x36')](_0x209ae9[_0x6d08('0x31')][_0x6d08('0x36')]));_0x4cee83[_0x6d08('0x35')]=_0x4cee83['attributes']['length']?_0x4cee83[_0x6d08('0x35')]:_0x5cf7f9[_0x6d08('0x30')];if(_0x209ae9[_0x6d08('0x31')]['includeAll']){_0x4cee83[_0x6d08('0x47')]=[{'all':!![]}];}_0x4cee83=_[_0x6d08('0x3d')]({},_0x4cee83,_0x209ae9['options']);return db[_0x6d08('0x2d')]['find'](_0x4cee83)[_0x6d08('0x23')](handleEntityNotFound(_0xcfaaa,null))[_0x6d08('0x23')](respondWithResult(_0xcfaaa,null))[_0x6d08('0x45')](handleError(_0xcfaaa,null));};exports[_0x6d08('0x48')]=function(_0x1306e0,_0x2071b4,_0x295229){return db[_0x6d08('0x2d')][_0x6d08('0x49')]({'where':{'id':_0x1306e0['params']['id']},'attributes':[_0x6d08('0x29'),_0x6d08('0x4a'),_0x6d08('0x4b')],'raw':!![]})[_0x6d08('0x23')](handleEntityNotFound(_0x2071b4,null))[_0x6d08('0x23')](function(_0x10ae5e){if(_0x10ae5e){if(!fs['existsSync'](path['join'](config[_0x6d08('0x4c')],_0x6d08('0x4d'),_0x10ae5e[_0x6d08('0x4a')]+'.'+_0x10ae5e['converted_format']))){throw new db[(_0x6d08('0x4e'))][(_0x6d08('0x4f'))]('Sound\x20not\x20found');}return _0x2071b4[_0x6d08('0x48')](path[_0x6d08('0x50')](config[_0x6d08('0x4c')],_0x6d08('0x4d'),util[_0x6d08('0x51')]('%s.%s',_0x10ae5e[_0x6d08('0x4a')],_0x10ae5e[_0x6d08('0x4b')])),util['format'](_0x6d08('0x52'),_0x10ae5e[_0x6d08('0x29')],_0x10ae5e['converted_format']));}return null;})['catch'](handleError(_0x2071b4,null));};exports[_0x6d08('0x53')]=function(_0x27afe3,_0x227012,_0x36d166){var _0x4227af={'name':path[_0x6d08('0x54')](_0x27afe3[_0x6d08('0x55')][_0x6d08('0x56')],path[_0x6d08('0x57')](_0x27afe3[_0x6d08('0x55')][_0x6d08('0x56')])),'save_name':path[_0x6d08('0x54')](_0x27afe3['file'][_0x6d08('0x58')],path[_0x6d08('0x57')](_0x27afe3[_0x6d08('0x55')][_0x6d08('0x58')])),'original_format':path[_0x6d08('0x57')](_0x27afe3[_0x6d08('0x55')]['originalname'])[_0x6d08('0x59')](0x1),'converted_format':_0x6d08('0x5a')};var _0x3dd83c=path[_0x6d08('0x50')](config[_0x6d08('0x4c')],'server/files/sounds/original',_0x27afe3[_0x6d08('0x55')]['filename']);var _0x5a987c=path[_0x6d08('0x50')](config['root'],_0x6d08('0x4d'),util['format'](_0x6d08('0x52'),path[_0x6d08('0x54')](_0x27afe3[_0x6d08('0x55')][_0x6d08('0x58')],path['extname'](_0x27afe3[_0x6d08('0x55')][_0x6d08('0x58')])),_0x4227af[_0x6d08('0x4b')]));logger[_0x6d08('0x5b')](_0x6d08('0x5c'),_0x3dd83c);logger[_0x6d08('0x5b')](_0x6d08('0x5d'),_0x5a987c);try{fs[_0x6d08('0x5e')](_0x3dd83c,parseInt(_0x6d08('0x5f'),0x8));var _0x31517c=sox['transcode'](_0x3dd83c,_0x5a987c,{'sampleRate':0x1f40,'format':_0x6d08('0x5a'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x31517c['on'](_0x6d08('0x28'),function(_0x9a32c2){fs[_0x6d08('0x60')](_0x3dd83c);_0x227012[_0x6d08('0x19')](0x1f4)[_0x6d08('0x2a')](_0x9a32c2);});_0x31517c['on']('src',function(_0x3dd683){_0x4227af[_0x6d08('0x61')]=isNaN(_0x3dd683['duration'])?null:_0x3dd683[_0x6d08('0x62')]*0x3e8;_0x4227af[_0x6d08('0x63')]=isNaN(_0x3dd683[_0x6d08('0x64')])?null:_0x3dd683[_0x6d08('0x64')];_0x4227af[_0x6d08('0x65')]=isNaN(_0x3dd683[_0x6d08('0x66')])?null:_0x3dd683[_0x6d08('0x66')];_0x4227af[_0x6d08('0x67')]=isNaN(_0x3dd683[_0x6d08('0x68')])?null:_0x3dd683[_0x6d08('0x68')];_0x4227af[_0x6d08('0x69')]=isNaN(_0x3dd683['sampleRate'])?null:_0x3dd683[_0x6d08('0x6a')];});_0x31517c['on']('dest',function(_0x4a6e5a){_0x4227af[_0x6d08('0x6b')]=isNaN(_0x4a6e5a[_0x6d08('0x62')])?null:_0x4a6e5a[_0x6d08('0x62')]*0x3e8;_0x4227af[_0x6d08('0x6c')]=isNaN(_0x4a6e5a[_0x6d08('0x64')])?null:_0x4a6e5a[_0x6d08('0x64')];_0x4227af[_0x6d08('0x6d')]=isNaN(_0x4a6e5a[_0x6d08('0x66')])?null:_0x4a6e5a[_0x6d08('0x66')];_0x4227af['converted_bitRate']=isNaN(_0x4a6e5a[_0x6d08('0x68')])?null:_0x4a6e5a[_0x6d08('0x68')];_0x4227af['converted_sampleRate']=isNaN(_0x4a6e5a[_0x6d08('0x6a')])?null:_0x4a6e5a[_0x6d08('0x6a')];});_0x31517c['on']('end',function(){fs['chmodSync'](_0x5a987c,parseInt(_0x6d08('0x5f'),0x8));return db[_0x6d08('0x2d')][_0x6d08('0x53')](_0x4227af)[_0x6d08('0x23')](function(_0x4d3dd9){var _0x379e4c={'role':_0x27afe3[_0x6d08('0x6e')][_0x6d08('0x6f')],'userProfileId':_0x27afe3[_0x6d08('0x6e')][_0x6d08('0x70')]};if(!_0x379e4c)throw new Error(_0x6d08('0x71'));if(_0x379e4c['role']===_0x6d08('0x72')){var _0x128e0e=_0x4d3dd9[_0x6d08('0x25')]({'plain':!![]});return db[_0x6d08('0x73')][_0x6d08('0x49')]({'where':{'name':_0x6d08('0x74'),'userProfileId':_0x379e4c[_0x6d08('0x70')]},'raw':!![]})['then'](function(_0x1a4009){if(_0x1a4009&&_0x1a4009[_0x6d08('0x75')]===0x0){return db[_0x6d08('0x26')][_0x6d08('0x53')]({'name':_0x128e0e[_0x6d08('0x29')],'resourceId':_0x128e0e['id'],'type':_0x1a4009[_0x6d08('0x29')],'sectionId':_0x1a4009['id']},{})[_0x6d08('0x23')](function(){return _0x4d3dd9;});}else{return _0x4d3dd9;}})[_0x6d08('0x45')](function(_0x439968){logger[_0x6d08('0x28')](_0x6d08('0x76'),_0x439968);throw _0x439968;});}return _0x4d3dd9;})['then'](respondWithResult(_0x227012,null))[_0x6d08('0x45')](handleError(_0x227012,null));});_0x31517c[_0x6d08('0x77')]();}catch(_0x3bdb7f){_0x227012['status'](0x1f4)['send'](_0x3bdb7f);}};exports[_0x6d08('0x22')]=function(_0x3940f2,_0x35d403,_0x1c68d0){return db[_0x6d08('0x2d')]['find']({'where':{'id':_0x3940f2['params']['id']}})[_0x6d08('0x23')](handleEntityNotFound(_0x35d403,null))[_0x6d08('0x23')](saveUpdates(_[_0x6d08('0x3b')](_0x3940f2[_0x6d08('0x6e')],['name',_0x6d08('0x78')]),null))[_0x6d08('0x23')](respondWithResult(_0x35d403,null))['catch'](handleError(_0x35d403,null));};exports['delete']=function(_0xbdd4b4,_0x4e91d5,_0x17ae5b){return db[_0x6d08('0x2d')]['find']({'where':{'id':_0xbdd4b4[_0x6d08('0x79')]['id']}})['then'](function(_0x4b7993){if(_0x4b7993){return _0x4b7993[_0x6d08('0x24')]();}})[_0x6d08('0x23')](function(_0x500057){var _0x49f982=path[_0x6d08('0x50')](config[_0x6d08('0x4c')],_0x6d08('0x7a'),util[_0x6d08('0x51')](_0x6d08('0x52'),_0x500057[_0x6d08('0x4a')],_0x500057[_0x6d08('0x7b')]));var _0x55aa71=path[_0x6d08('0x50')](config[_0x6d08('0x4c')],_0x6d08('0x4d'),util[_0x6d08('0x51')](_0x6d08('0x52'),_0x500057[_0x6d08('0x4a')],_0x500057[_0x6d08('0x4b')]));fs[_0x6d08('0x60')](_0x49f982);fs['unlinkSync'](_0x55aa71);return _0x500057;})[_0x6d08('0x23')](function(_0xb14b8b){if(_0xb14b8b){return _0x4e91d5[_0x6d08('0x19')](0xcc)[_0x6d08('0x27')]();}})[_0x6d08('0x23')](handleEntityNotFound(_0x4e91d5,null))[_0x6d08('0x45')](handleError(_0x4e91d5,null));}; \ No newline at end of file +var _0xfb5a=['download','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','Sound\x20not\x20found','format','%s.%s','create','file','originalname','filename','substring','wav','basename','extname','info','Sound\x20upload\x20filepath:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','sampleRate','dest','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','Sounds','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','server/files/sounds/original','original_format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','end','json','offset','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','Sound','includeAll','include','findAll','rows','catch','show','params'];(function(_0x15f635,_0x628c6e){var _0x1f716d=function(_0xf1f482){while(--_0xf1f482){_0x15f635['push'](_0x15f635['shift']());}};_0x1f716d(++_0x628c6e);}(_0xfb5a,0xaa));var _0xafb5=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb5a[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xafb5('0x0'));var jsonpatch=require(_0xafb5('0x1'));var rp=require(_0xafb5('0x2'));var moment=require(_0xafb5('0x3'));var BPromise=require(_0xafb5('0x4'));var Mustache=require(_0xafb5('0x5'));var util=require('util');var path=require(_0xafb5('0x6'));var sox=require(_0xafb5('0x7'));var csv=require('to-csv');var ejs=require(_0xafb5('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xafb5('0x9'));var squel=require(_0xafb5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xafb5('0xb'));var querystring=require(_0xafb5('0xc'));var Papa=require(_0xafb5('0xd'));var Redis=require('ioredis');var authService=require(_0xafb5('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xafb5('0xf'));var logger=require('../../config/logger')(_0xafb5('0x10'));var utils=require('../../config/utils');var config=require(_0xafb5('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xafb5('0x12'))['db'];function respondWithStatusCode(_0x2fa233,_0x12e2d0){_0x12e2d0=_0x12e2d0||0xcc;return function(_0x1d6363){if(_0x1d6363){return _0x2fa233['sendStatus'](_0x12e2d0);}return _0x2fa233[_0xafb5('0x13')](_0x12e2d0)[_0xafb5('0x14')]();};}function respondWithResult(_0x4c1f4f,_0x2e0a38){_0x2e0a38=_0x2e0a38||0xc8;return function(_0x5821cd){if(_0x5821cd){return _0x4c1f4f[_0xafb5('0x13')](_0x2e0a38)[_0xafb5('0x15')](_0x5821cd);}};}function respondWithFilteredResult(_0x5a8122,_0x3c3878){return function(_0x1528b8){if(_0x1528b8){var _0x1fab72=typeof _0x3c3878[_0xafb5('0x16')]==='undefined'&&typeof _0x3c3878['limit']==='undefined';var _0x2f9181=_0x1528b8[_0xafb5('0x17')];var _0x3ecdb3=_0x1fab72?0x0:_0x3c3878[_0xafb5('0x16')];var _0x6ec8cd=_0x1fab72?_0x1528b8['count']:_0x3c3878[_0xafb5('0x16')]+_0x3c3878['limit'];var _0xa57a6;if(_0x6ec8cd>=_0x2f9181){_0x6ec8cd=_0x2f9181;_0xa57a6=0xc8;}else{_0xa57a6=0xce;}_0x5a8122[_0xafb5('0x13')](_0xa57a6);return _0x5a8122[_0xafb5('0x18')](_0xafb5('0x19'),_0x3ecdb3+'-'+_0x6ec8cd+'/'+_0x2f9181)[_0xafb5('0x15')](_0x1528b8);}return null;};}function patchUpdates(_0x3b04c7){return function(_0x3bb785){try{jsonpatch[_0xafb5('0x1a')](_0x3bb785,_0x3b04c7,!![]);}catch(_0xf04687){return BPromise['reject'](_0xf04687);}return _0x3bb785[_0xafb5('0x1b')]();};}function saveUpdates(_0xf73377,_0x39e9be){return function(_0x38ccb5){if(_0x38ccb5){return _0x38ccb5[_0xafb5('0x1c')](_0xf73377)[_0xafb5('0x1d')](function(_0x302e5e){return _0x302e5e;});}return null;};}function removeEntity(_0x198b13,_0x320b1a){return function(_0x107d25){if(_0x107d25){return _0x107d25[_0xafb5('0x1e')]()[_0xafb5('0x1d')](function(){var _0x2af89a=_0x107d25[_0xafb5('0x1f')]({'plain':!![]});var _0x4ef842='Sounds';return db[_0xafb5('0x20')][_0xafb5('0x1e')]({'where':{'type':_0x4ef842,'resourceId':_0x2af89a['id']}})[_0xafb5('0x1d')](function(){return _0x107d25;});})[_0xafb5('0x1d')](function(){_0x198b13[_0xafb5('0x13')](0xcc)[_0xafb5('0x14')]();});}};}function handleEntityNotFound(_0x18cdff,_0x31980e){return function(_0x503cf4){if(!_0x503cf4){_0x18cdff[_0xafb5('0x21')](0x194);}return _0x503cf4;};}function handleError(_0x548a82,_0x392e2d){_0x392e2d=_0x392e2d||0x1f4;return function(_0x5d0020){logger[_0xafb5('0x22')](_0x5d0020['stack']);if(_0x5d0020[_0xafb5('0x23')]){delete _0x5d0020[_0xafb5('0x23')];}_0x548a82['status'](_0x392e2d)[_0xafb5('0x24')](_0x5d0020);};}exports[_0xafb5('0x25')]=function(_0x259950,_0x22d743){var _0x279a9a={},_0x7338ac={},_0x6cdf89={'count':0x0,'rows':[]};var _0x3cd155=_[_0xafb5('0x26')](db['Sound'][_0xafb5('0x27')],function(_0x31d343){return{'name':_0x31d343[_0xafb5('0x28')],'type':_0x31d343[_0xafb5('0x29')][_0xafb5('0x2a')]};});_0x7338ac['model']=_[_0xafb5('0x26')](_0x3cd155,_0xafb5('0x23'));_0x7338ac['query']=_[_0xafb5('0x2b')](_0x259950['query']);_0x7338ac[_0xafb5('0x2c')]=_[_0xafb5('0x2d')](_0x7338ac[_0xafb5('0x2e')],_0x7338ac[_0xafb5('0x2f')]);_0x279a9a[_0xafb5('0x30')]=_[_0xafb5('0x2d')](_0x7338ac[_0xafb5('0x2e')],qs[_0xafb5('0x31')](_0x259950[_0xafb5('0x2f')][_0xafb5('0x31')]));_0x279a9a[_0xafb5('0x30')]=_0x279a9a[_0xafb5('0x30')][_0xafb5('0x32')]?_0x279a9a['attributes']:_0x7338ac[_0xafb5('0x2e')];if(!_0x259950[_0xafb5('0x2f')][_0xafb5('0x33')](_0xafb5('0x34'))){_0x279a9a[_0xafb5('0x35')]=qs[_0xafb5('0x35')](_0x259950[_0xafb5('0x2f')][_0xafb5('0x35')]);_0x279a9a[_0xafb5('0x16')]=qs[_0xafb5('0x16')](_0x259950[_0xafb5('0x2f')][_0xafb5('0x16')]);}_0x279a9a[_0xafb5('0x36')]=qs[_0xafb5('0x37')](_0x259950[_0xafb5('0x2f')][_0xafb5('0x37')]);_0x279a9a['where']=qs[_0xafb5('0x2c')](_[_0xafb5('0x38')](_0x259950['query'],_0x7338ac[_0xafb5('0x2c')]),_0x3cd155);if(_0x259950[_0xafb5('0x2f')][_0xafb5('0x39')]){_0x279a9a[_0xafb5('0x3a')]=_['merge'](_0x279a9a[_0xafb5('0x3a')],{'$or':_['map'](_0x3cd155,function(_0x389f4b){if(_0x389f4b['type']!==_0xafb5('0x3b')){var _0x2dcac2={};_0x2dcac2[_0x389f4b[_0xafb5('0x23')]]={'$like':'%'+_0x259950[_0xafb5('0x2f')][_0xafb5('0x39')]+'%'};return _0x2dcac2;}})});}_0x279a9a=_[_0xafb5('0x3c')]({},_0x279a9a,_0x259950[_0xafb5('0x3d')]);var _0xcf7305={'where':_0x279a9a['where']};return db[_0xafb5('0x3e')][_0xafb5('0x17')](_0xcf7305)[_0xafb5('0x1d')](function(_0x537ebb){_0x6cdf89['count']=_0x537ebb;if(_0x259950[_0xafb5('0x2f')][_0xafb5('0x3f')]){_0x279a9a[_0xafb5('0x40')]=[{'all':!![]}];}return db[_0xafb5('0x3e')][_0xafb5('0x41')](_0x279a9a);})['then'](function(_0xe6d634){_0x6cdf89[_0xafb5('0x42')]=_0xe6d634;return _0x6cdf89;})[_0xafb5('0x1d')](respondWithFilteredResult(_0x22d743,_0x279a9a))[_0xafb5('0x43')](handleError(_0x22d743,null));};exports[_0xafb5('0x44')]=function(_0x1b4cd8,_0x303bb0){var _0x9b5fbf={'raw':!![],'where':{'id':_0x1b4cd8[_0xafb5('0x45')]['id']}},_0x31ca85={};_0x31ca85['model']=_[_0xafb5('0x2b')](db[_0xafb5('0x3e')][_0xafb5('0x27')]);_0x31ca85[_0xafb5('0x2f')]=_[_0xafb5('0x2b')](_0x1b4cd8[_0xafb5('0x2f')]);_0x31ca85['filters']=_[_0xafb5('0x2d')](_0x31ca85[_0xafb5('0x2e')],_0x31ca85[_0xafb5('0x2f')]);_0x9b5fbf[_0xafb5('0x30')]=_[_0xafb5('0x2d')](_0x31ca85[_0xafb5('0x2e')],qs['fields'](_0x1b4cd8['query']['fields']));_0x9b5fbf[_0xafb5('0x30')]=_0x9b5fbf[_0xafb5('0x30')][_0xafb5('0x32')]?_0x9b5fbf['attributes']:_0x31ca85[_0xafb5('0x2e')];if(_0x1b4cd8[_0xafb5('0x2f')][_0xafb5('0x3f')]){_0x9b5fbf['include']=[{'all':!![]}];}_0x9b5fbf=_['merge']({},_0x9b5fbf,_0x1b4cd8[_0xafb5('0x3d')]);return db[_0xafb5('0x3e')]['find'](_0x9b5fbf)[_0xafb5('0x1d')](handleEntityNotFound(_0x303bb0,null))[_0xafb5('0x1d')](respondWithResult(_0x303bb0,null))[_0xafb5('0x43')](handleError(_0x303bb0,null));};exports[_0xafb5('0x46')]=function(_0x396f53,_0x856b,_0x4d76a0){return db[_0xafb5('0x3e')]['find']({'where':{'id':_0x396f53['params']['id']},'attributes':[_0xafb5('0x23'),_0xafb5('0x47'),'converted_format'],'raw':!![]})[_0xafb5('0x1d')](handleEntityNotFound(_0x856b,null))[_0xafb5('0x1d')](function(_0x27b806){if(_0x27b806){if(!fs[_0xafb5('0x48')](path[_0xafb5('0x49')](config[_0xafb5('0x4a')],_0xafb5('0x4b'),_0x27b806[_0xafb5('0x47')]+'.'+_0x27b806[_0xafb5('0x4c')]))){throw new db[(_0xafb5('0x4d'))]['ValidationError'](_0xafb5('0x4e'));}return _0x856b[_0xafb5('0x46')](path[_0xafb5('0x49')](config[_0xafb5('0x4a')],_0xafb5('0x4b'),util[_0xafb5('0x4f')](_0xafb5('0x50'),_0x27b806[_0xafb5('0x47')],_0x27b806[_0xafb5('0x4c')])),util[_0xafb5('0x4f')](_0xafb5('0x50'),_0x27b806['name'],_0x27b806['converted_format']));}return null;})[_0xafb5('0x43')](handleError(_0x856b,null));};exports[_0xafb5('0x51')]=function(_0x419b73,_0x31607f,_0x2471e6){var _0x49ece2={'name':path['basename'](_0x419b73[_0xafb5('0x52')][_0xafb5('0x53')],path['extname'](_0x419b73[_0xafb5('0x52')][_0xafb5('0x53')])),'save_name':path['basename'](_0x419b73[_0xafb5('0x52')][_0xafb5('0x54')],path['extname'](_0x419b73[_0xafb5('0x52')][_0xafb5('0x54')])),'original_format':path['extname'](_0x419b73[_0xafb5('0x52')][_0xafb5('0x53')])[_0xafb5('0x55')](0x1),'converted_format':_0xafb5('0x56')};var _0x3542be=path['join'](config[_0xafb5('0x4a')],'server/files/sounds/original',_0x419b73[_0xafb5('0x52')][_0xafb5('0x54')]);var _0x2f43ae=path['join'](config[_0xafb5('0x4a')],'server/files/sounds/converted',util[_0xafb5('0x4f')](_0xafb5('0x50'),path[_0xafb5('0x57')](_0x419b73[_0xafb5('0x52')][_0xafb5('0x54')],path[_0xafb5('0x58')](_0x419b73[_0xafb5('0x52')][_0xafb5('0x54')])),_0x49ece2[_0xafb5('0x4c')]));logger[_0xafb5('0x59')](_0xafb5('0x5a'),_0x3542be);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x2f43ae);try{fs[_0xafb5('0x5b')](_0x3542be,parseInt(_0xafb5('0x5c'),0x8));var _0x21db2f=sox[_0xafb5('0x5d')](_0x3542be,_0x2f43ae,{'sampleRate':0x1f40,'format':_0xafb5('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x21db2f['on'](_0xafb5('0x22'),function(_0x1482c4){fs[_0xafb5('0x5e')](_0x3542be);_0x31607f['status'](0x1f4)[_0xafb5('0x24')](_0x1482c4);});_0x21db2f['on'](_0xafb5('0x5f'),function(_0x5eae86){_0x49ece2[_0xafb5('0x60')]=isNaN(_0x5eae86[_0xafb5('0x61')])?null:_0x5eae86[_0xafb5('0x61')]*0x3e8;_0x49ece2[_0xafb5('0x62')]=isNaN(_0x5eae86[_0xafb5('0x63')])?null:_0x5eae86[_0xafb5('0x63')];_0x49ece2[_0xafb5('0x64')]=isNaN(_0x5eae86[_0xafb5('0x65')])?null:_0x5eae86[_0xafb5('0x65')];_0x49ece2[_0xafb5('0x66')]=isNaN(_0x5eae86[_0xafb5('0x67')])?null:_0x5eae86[_0xafb5('0x67')];_0x49ece2['original_sampleRate']=isNaN(_0x5eae86[_0xafb5('0x68')])?null:_0x5eae86[_0xafb5('0x68')];});_0x21db2f['on'](_0xafb5('0x69'),function(_0x6e46c4){_0x49ece2['converted_duration']=isNaN(_0x6e46c4['duration'])?null:_0x6e46c4[_0xafb5('0x61')]*0x3e8;_0x49ece2['converted_sampleCount']=isNaN(_0x6e46c4[_0xafb5('0x63')])?null:_0x6e46c4['sampleCount'];_0x49ece2[_0xafb5('0x6a')]=isNaN(_0x6e46c4[_0xafb5('0x65')])?null:_0x6e46c4[_0xafb5('0x65')];_0x49ece2[_0xafb5('0x6b')]=isNaN(_0x6e46c4['bitRate'])?null:_0x6e46c4[_0xafb5('0x67')];_0x49ece2[_0xafb5('0x6c')]=isNaN(_0x6e46c4[_0xafb5('0x68')])?null:_0x6e46c4['sampleRate'];});_0x21db2f['on']('end',function(){fs[_0xafb5('0x5b')](_0x2f43ae,parseInt(_0xafb5('0x5c'),0x8));return db[_0xafb5('0x3e')][_0xafb5('0x51')](_0x49ece2)[_0xafb5('0x1d')](function(_0x57b5a9){var _0x26ade8={'role':_0x419b73[_0xafb5('0x6d')][_0xafb5('0x6e')],'userProfileId':_0x419b73['body'][_0xafb5('0x6f')]};if(!_0x26ade8)throw new Error(_0xafb5('0x70'));if(_0x26ade8[_0xafb5('0x6e')]==='user'){var _0x13ce46=_0x57b5a9[_0xafb5('0x1f')]({'plain':!![]});return db['UserProfileSection'][_0xafb5('0x71')]({'where':{'name':_0xafb5('0x72'),'userProfileId':_0x26ade8['userProfileId']},'raw':!![]})[_0xafb5('0x1d')](function(_0x50c4cd){if(_0x50c4cd&&_0x50c4cd[_0xafb5('0x73')]===0x0){return db[_0xafb5('0x20')][_0xafb5('0x51')]({'name':_0x13ce46[_0xafb5('0x23')],'resourceId':_0x13ce46['id'],'type':_0x50c4cd['name'],'sectionId':_0x50c4cd['id']},{})[_0xafb5('0x1d')](function(){return _0x57b5a9;});}else{return _0x57b5a9;}})[_0xafb5('0x43')](function(_0x500af9){logger[_0xafb5('0x22')](_0xafb5('0x74'),_0x500af9);throw _0x500af9;});}return _0x57b5a9;})['then'](respondWithResult(_0x31607f,null))[_0xafb5('0x43')](handleError(_0x31607f,null));});_0x21db2f[_0xafb5('0x75')]();}catch(_0x44b7bc){_0x31607f[_0xafb5('0x13')](0x1f4)[_0xafb5('0x24')](_0x44b7bc);}};exports[_0xafb5('0x1c')]=function(_0x1d2148,_0xa68e4c,_0x2a79b0){return db[_0xafb5('0x3e')][_0xafb5('0x71')]({'where':{'id':_0x1d2148[_0xafb5('0x45')]['id']}})[_0xafb5('0x1d')](handleEntityNotFound(_0xa68e4c,null))[_0xafb5('0x1d')](saveUpdates(_[_0xafb5('0x38')](_0x1d2148['body'],[_0xafb5('0x23'),'description']),null))[_0xafb5('0x1d')](respondWithResult(_0xa68e4c,null))[_0xafb5('0x43')](handleError(_0xa68e4c,null));};exports['delete']=function(_0x5edd77,_0x54980d,_0x4585dc){return db[_0xafb5('0x3e')][_0xafb5('0x71')]({'where':{'id':_0x5edd77[_0xafb5('0x45')]['id']}})[_0xafb5('0x1d')](function(_0x582fe0){if(_0x582fe0){return _0x582fe0[_0xafb5('0x1e')]();}})[_0xafb5('0x1d')](function(_0x356a52){var _0x1d920a=path['join'](config[_0xafb5('0x4a')],_0xafb5('0x76'),util[_0xafb5('0x4f')](_0xafb5('0x50'),_0x356a52['save_name'],_0x356a52[_0xafb5('0x77')]));var _0x15f7aa=path['join'](config[_0xafb5('0x4a')],'server/files/sounds/converted',util[_0xafb5('0x4f')]('%s.%s',_0x356a52[_0xafb5('0x47')],_0x356a52[_0xafb5('0x4c')]));fs[_0xafb5('0x5e')](_0x1d920a);fs[_0xafb5('0x5e')](_0x15f7aa);return _0x356a52;})[_0xafb5('0x1d')](function(_0x6c6ca3){if(_0x6c6ca3){return _0x54980d['status'](0xcc)[_0xafb5('0x14')]();}})[_0xafb5('0x1d')](handleEntityNotFound(_0x54980d,null))[_0xafb5('0x43')](handleError(_0x54980d,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e8be42a..36ca18f 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 _0x5373=['request-promise','path','rimraf','../../config/environment','Sound','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x43bd62,_0x107420){var _0x22321c=function(_0x5ed92c){while(--_0x5ed92c){_0x43bd62['push'](_0x43bd62['shift']());}};_0x22321c(++_0x107420);}(_0x5373,0x139));var _0x3537=function(_0x332f6b,_0xc61e1e){_0x332f6b=_0x332f6b-0x0;var _0x5221d5=_0x5373[_0x332f6b];return _0x5221d5;};'use strict';var _=require(_0x3537('0x0'));var util=require(_0x3537('0x1'));var logger=require(_0x3537('0x2'))(_0x3537('0x3'));var moment=require(_0x3537('0x4'));var BPromise=require(_0x3537('0x5'));var rp=require(_0x3537('0x6'));var fs=require('fs');var path=require(_0x3537('0x7'));var rimraf=require(_0x3537('0x8'));var config=require(_0x3537('0x9'));var attributes=require('./sound.attributes');module['exports']=function(_0x1d50d8,_0x59e7fa){return _0x1d50d8['define'](_0x3537('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d83=['rimraf','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','bluebird','request-promise','path'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x0d83,0x1c2));var _0x30d8=function(_0x54c802,_0x2f9e9d){_0x54c802=_0x54c802-0x0;var _0x1ddecd=_0x0d83[_0x54c802];return _0x1ddecd;};'use strict';var _=require(_0x30d8('0x0'));var util=require(_0x30d8('0x1'));var logger=require(_0x30d8('0x2'))('api');var moment=require('moment');var BPromise=require(_0x30d8('0x3'));var rp=require(_0x30d8('0x4'));var fs=require('fs');var path=require(_0x30d8('0x5'));var rimraf=require(_0x30d8('0x6'));var config=require('../../config/environment');var attributes=require(_0x30d8('0x7'));module[_0x30d8('0x8')]=function(_0x25abf3,_0x5d892a){return _0x25abf3[_0x30d8('0x9')](_0x30d8('0xa'),attributes,{'tableName':_0x30d8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 0e3ea93..fdd3a4d 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 _0x54ab=['model','debug','catch','lodash','moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound','Sound','find','options','raw','attributes','map','include'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x54ab,0x1e3));var _0xb54a=function(_0x30207d,_0x9a4466){_0x30207d=_0x30207d-0x0;var _0x282210=_0x54ab[_0x30207d];return _0x282210;};'use strict';var _=require(_0xb54a('0x0'));var util=require('util');var moment=require(_0xb54a('0x1'));var BPromise=require(_0xb54a('0x2'));var rs=require(_0xb54a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb54a('0x4'));var config=require(_0xb54a('0x5'));var jayson=require(_0xb54a('0x6'));var client=jayson[_0xb54a('0x7')][_0xb54a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d841d,_0x1094a0,_0x21c181){return new BPromise(function(_0x2b0aa6,_0x474bed){return client[_0xb54a('0x9')](_0x1d841d,_0x21c181)[_0xb54a('0xa')](function(_0x53468f){logger[_0xb54a('0xb')](_0xb54a('0xc'),_0x1094a0,_0xb54a('0xd'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x1094a0,'request\x20sent',JSON[_0xb54a('0xe')](_0x53468f));if(_0x53468f['error']){if(_0x53468f[_0xb54a('0xf')][_0xb54a('0x10')]===0x1f4){logger['error'](_0xb54a('0xc'),_0x1094a0,_0x53468f[_0xb54a('0xf')][_0xb54a('0x11')]);return _0x474bed(_0x53468f[_0xb54a('0xf')][_0xb54a('0x11')]);}logger[_0xb54a('0xf')](_0xb54a('0xc'),_0x1094a0,_0x53468f[_0xb54a('0xf')]['message']);return _0x2b0aa6(_0x53468f[_0xb54a('0xf')][_0xb54a('0x11')]);}else{logger[_0xb54a('0xb')](_0xb54a('0xc'),_0x1094a0,'request\x20sent');_0x2b0aa6(_0x53468f[_0xb54a('0x12')][_0xb54a('0x11')]);}})['catch'](function(_0x432807){logger[_0xb54a('0xf')](_0xb54a('0xc'),_0x1094a0,_0x432807);_0x474bed(_0x432807);});});}exports[_0xb54a('0x13')]=function(_0xa9ea1c){var _0xb8835b=this;return new Promise(function(_0x3f6951,_0x585ca0){return db[_0xb54a('0x14')][_0xb54a('0x15')]({'raw':_0xa9ea1c[_0xb54a('0x16')]?_0xa9ea1c[_0xb54a('0x16')][_0xb54a('0x17')]===undefined?!![]:![]:!![],'where':_0xa9ea1c[_0xb54a('0x16')]?_0xa9ea1c['options']['where']||null:null,'attributes':_0xa9ea1c[_0xb54a('0x16')]?_0xa9ea1c[_0xb54a('0x16')][_0xb54a('0x18')]||null:null,'include':_0xa9ea1c[_0xb54a('0x16')]?_0xa9ea1c[_0xb54a('0x16')]['include']?_[_0xb54a('0x19')](_0xa9ea1c[_0xb54a('0x16')][_0xb54a('0x1a')],function(_0x1346c6){return{'model':db[_0x1346c6['model']],'as':_0x1346c6['as'],'attributes':_0x1346c6[_0xb54a('0x18')],'include':_0x1346c6[_0xb54a('0x1a')]?_[_0xb54a('0x19')](_0x1346c6[_0xb54a('0x1a')],function(_0x5576ff){return{'model':db[_0x5576ff['model']],'as':_0x5576ff['as'],'attributes':_0x5576ff[_0xb54a('0x18')],'include':_0x5576ff['include']?_[_0xb54a('0x19')](_0x5576ff['include'],function(_0x5aec76){return{'model':db[_0x5aec76[_0xb54a('0x1b')]],'as':_0x5aec76['as'],'attributes':_0x5aec76['attributes']};}):[]};}):[]};}):[]:[]})[_0xb54a('0xa')](function(_0x15155e){logger[_0xb54a('0xb')]('ShowSound',_0xa9ea1c);logger[_0xb54a('0x1c')]('ShowSound',_0xa9ea1c,JSON['stringify'](_0x15155e));_0x3f6951(_0x15155e);})[_0xb54a('0x1d')](function(_0x246973){logger[_0xb54a('0xf')]('ShowSound',_0x246973[_0xb54a('0x11')],_0xa9ea1c);_0x585ca0(_0xb8835b[_0xb54a('0xf')](0x1f4,_0x246973[_0xb54a('0x11')]));});});}; \ No newline at end of file +var _0x44be=['debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','find','options','raw','attributes','map','include','model','ShowSound','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent'];(function(_0x37b21a,_0x390c39){var _0x2496b5=function(_0x5c6a75){while(--_0x5c6a75){_0x37b21a['push'](_0x37b21a['shift']());}};_0x2496b5(++_0x390c39);}(_0x44be,0x131));var _0xe44b=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x44be[_0x199572];return _0x13cfa3;};'use strict';var _=require('lodash');var util=require(_0xe44b('0x0'));var moment=require(_0xe44b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe44b('0x2'))['db'];var utils=require(_0xe44b('0x3'));var logger=require('../../config/logger')(_0xe44b('0x4'));var config=require(_0xe44b('0x5'));var jayson=require(_0xe44b('0x6'));var client=jayson[_0xe44b('0x7')][_0xe44b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x12ffbf,_0x20967f,_0xf54cf5){return new BPromise(function(_0x481567,_0x45ed1e){return client[_0xe44b('0x9')](_0x12ffbf,_0xf54cf5)[_0xe44b('0xa')](function(_0x1a329c){logger[_0xe44b('0xb')](_0xe44b('0xc'),_0x20967f,_0xe44b('0xd'));logger[_0xe44b('0xe')](_0xe44b('0xf'),_0x20967f,'request\x20sent',JSON[_0xe44b('0x10')](_0x1a329c));if(_0x1a329c[_0xe44b('0x11')]){if(_0x1a329c[_0xe44b('0x11')][_0xe44b('0x12')]===0x1f4){logger[_0xe44b('0x11')](_0xe44b('0xc'),_0x20967f,_0x1a329c['error']['message']);return _0x45ed1e(_0x1a329c[_0xe44b('0x11')][_0xe44b('0x13')]);}logger[_0xe44b('0x11')](_0xe44b('0xc'),_0x20967f,_0x1a329c[_0xe44b('0x11')]['message']);return _0x481567(_0x1a329c[_0xe44b('0x11')][_0xe44b('0x13')]);}else{logger[_0xe44b('0xb')](_0xe44b('0xc'),_0x20967f,_0xe44b('0xd'));_0x481567(_0x1a329c['result'][_0xe44b('0x13')]);}})[_0xe44b('0x14')](function(_0x511ca5){logger[_0xe44b('0x11')]('Sound,\x20%s,\x20%s',_0x20967f,_0x511ca5);_0x45ed1e(_0x511ca5);});});}exports['ShowSound']=function(_0x4df40d){var _0x24b4fb=this;return new Promise(function(_0x156378,_0x145775){return db['Sound'][_0xe44b('0x15')]({'raw':_0x4df40d['options']?_0x4df40d[_0xe44b('0x16')][_0xe44b('0x17')]===undefined?!![]:![]:!![],'where':_0x4df40d[_0xe44b('0x16')]?_0x4df40d['options']['where']||null:null,'attributes':_0x4df40d['options']?_0x4df40d[_0xe44b('0x16')][_0xe44b('0x18')]||null:null,'include':_0x4df40d[_0xe44b('0x16')]?_0x4df40d[_0xe44b('0x16')]['include']?_[_0xe44b('0x19')](_0x4df40d['options'][_0xe44b('0x1a')],function(_0x120a79){return{'model':db[_0x120a79[_0xe44b('0x1b')]],'as':_0x120a79['as'],'attributes':_0x120a79[_0xe44b('0x18')],'include':_0x120a79[_0xe44b('0x1a')]?_['map'](_0x120a79[_0xe44b('0x1a')],function(_0x1d5d66){return{'model':db[_0x1d5d66['model']],'as':_0x1d5d66['as'],'attributes':_0x1d5d66['attributes'],'include':_0x1d5d66[_0xe44b('0x1a')]?_[_0xe44b('0x19')](_0x1d5d66[_0xe44b('0x1a')],function(_0x3f16e5){return{'model':db[_0x3f16e5[_0xe44b('0x1b')]],'as':_0x3f16e5['as'],'attributes':_0x3f16e5[_0xe44b('0x18')]};}):[]};}):[]};}):[]:[]})[_0xe44b('0xa')](function(_0x89deb6){logger['info'](_0xe44b('0x1c'),_0x4df40d);logger[_0xe44b('0xe')](_0xe44b('0x1c'),_0x4df40d,JSON[_0xe44b('0x10')](_0x89deb6));_0x156378(_0x89deb6);})['catch'](function(_0x2a3027){logger['error']('ShowSound',_0x2a3027[_0xe44b('0x13')],_0x4df40d);_0x145775(_0x24b4fb[_0xe44b('0x11')](0x1f4,_0x2a3027[_0xe44b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index ef9ce1d..dc93597 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(_0x595bd1,_0xb1e7a){var _0xd0344f=function(_0x5eb2fd){while(--_0x5eb2fd){_0x595bd1['push'](_0x595bd1['shift']());}};_0xd0344f(++_0xb1e7a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x7837ff,_0x192867){_0x7837ff=_0x7837ff-0x0;var _0x1cbbb7=_0x9ffd[_0x7837ff];return _0x1cbbb7;};'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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0x4fc2,0x111));var _0x24fc=function(_0x3c1304,_0x219ae5){_0x3c1304=_0x3c1304-0x0;var _0x11b071=_0x4fc2[_0x3c1304];return _0x11b071;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('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 d73467b..4691e85 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 _0x10a3=['out','STRING','TEXT','medium','ENUM'];(function(_0x4f5670,_0x3ef7e4){var _0x5a7277=function(_0x1de56f){while(--_0x1de56f){_0x4f5670['push'](_0x4f5670['shift']());}};_0x5a7277(++_0x3ef7e4);}(_0x10a3,0x13c));var _0x310a=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x10a3[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x310a('0x0')]},'body':{'type':Sequelize[_0x310a('0x1')](_0x310a('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x310a('0x3')]('in','out'),'defaultValue':_0x310a('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x310a('0x0')]},'providerResponse':{'type':Sequelize[_0x310a('0x1')]}}; \ No newline at end of file +var _0x5ac3=['out','sequelize','STRING','medium','ENUM'];(function(_0xc0aab8,_0x5d0a02){var _0x4423e6=function(_0x446258){while(--_0x446258){_0xc0aab8['push'](_0xc0aab8['shift']());}};_0x4423e6(++_0x5d0a02);}(_0x5ac3,0xce));var _0x35ac=function(_0x4bdf60,_0x4875f0){_0x4bdf60=_0x4bdf60-0x0;var _0x1b08cf=_0x5ac3[_0x4bdf60];return _0x1b08cf;};'use strict';var Sequelize=require(_0x35ac('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x35ac('0x1')]},'body':{'type':Sequelize['TEXT'](_0x35ac('0x2')),'allowNull':![]},'direction':{'type':Sequelize[_0x35ac('0x3')]('in',_0x35ac('0x4')),'defaultValue':_0x35ac('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x35ac('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 37e3d90..ca68f79 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 _0xa287=['includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','update','then','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','options','SquareMessage'];(function(_0x519b10,_0x13e494){var _0x164cb3=function(_0x5e5420){while(--_0x5e5420){_0x519b10['push'](_0x519b10['shift']());}};_0x164cb3(++_0x13e494);}(_0xa287,0xe0));var _0x7a28=function(_0x5f3562,_0x212f41){_0x5f3562=_0x5f3562-0x0;var _0x1b39b4=_0xa287[_0x5f3562];return _0x1b39b4;};'use strict';var emlformat=require(_0x7a28('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a28('0x1'));var rp=require('request-promise');var moment=require(_0x7a28('0x2'));var BPromise=require(_0x7a28('0x3'));var Mustache=require(_0x7a28('0x4'));var util=require(_0x7a28('0x5'));var path=require(_0x7a28('0x6'));var sox=require(_0x7a28('0x7'));var csv=require(_0x7a28('0x8'));var ejs=require(_0x7a28('0x9'));var fs=require('fs');var fs_extra=require(_0x7a28('0xa'));var _=require(_0x7a28('0xb'));var squel=require(_0x7a28('0xc'));var crypto=require(_0x7a28('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a28('0xe'));var toCsv=require(_0x7a28('0x8'));var querystring=require(_0x7a28('0xf'));var Papa=require(_0x7a28('0x10'));var Redis=require('ioredis');var authService=require(_0x7a28('0x11'));var qs=require(_0x7a28('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a28('0x13'));var logger=require(_0x7a28('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x7a28('0x15'));var licenseUtil=require(_0x7a28('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10ff5e,_0xf934c1){_0xf934c1=_0xf934c1||0xcc;return function(_0x5c1d55){if(_0x5c1d55){return _0x10ff5e[_0x7a28('0x17')](_0xf934c1);}return _0x10ff5e['status'](_0xf934c1)[_0x7a28('0x18')]();};}function respondWithResult(_0x3e4b8f,_0x1a7e14){_0x1a7e14=_0x1a7e14||0xc8;return function(_0xc6f7ff){if(_0xc6f7ff){return _0x3e4b8f['status'](_0x1a7e14)[_0x7a28('0x19')](_0xc6f7ff);}};}function respondWithFilteredResult(_0x1db255,_0x28c3e8){return function(_0x5b902e){if(_0x5b902e){var _0x4fccd8=typeof _0x28c3e8[_0x7a28('0x1a')]===_0x7a28('0x1b')&&typeof _0x28c3e8[_0x7a28('0x1c')]===_0x7a28('0x1b');var _0x35940f=_0x5b902e[_0x7a28('0x1d')];var _0xb1679c=_0x4fccd8?0x0:_0x28c3e8[_0x7a28('0x1a')];var _0x53c968=_0x4fccd8?_0x5b902e[_0x7a28('0x1d')]:_0x28c3e8[_0x7a28('0x1a')]+_0x28c3e8[_0x7a28('0x1c')];var _0x5a272d;if(_0x53c968>=_0x35940f){_0x53c968=_0x35940f;_0x5a272d=0xc8;}else{_0x5a272d=0xce;}_0x1db255[_0x7a28('0x1e')](_0x5a272d);return _0x1db255[_0x7a28('0x1f')]('Content-Range',_0xb1679c+'-'+_0x53c968+'/'+_0x35940f)['json'](_0x5b902e);}return null;};}function patchUpdates(_0x5d7d82){return function(_0x4fcb8b){try{jsonpatch[_0x7a28('0x20')](_0x4fcb8b,_0x5d7d82,!![]);}catch(_0x35835a){return BPromise['reject'](_0x35835a);}return _0x4fcb8b['save']();};}function saveUpdates(_0x50290e,_0x2e6006){return function(_0x27a16d){if(_0x27a16d){return _0x27a16d[_0x7a28('0x21')](_0x50290e)[_0x7a28('0x22')](function(_0x366a1c){return _0x366a1c;});}return null;};}function removeEntity(_0x4e72d9,_0x53e473){return function(_0x390288){if(_0x390288){return _0x390288['destroy']()[_0x7a28('0x22')](function(){_0x4e72d9[_0x7a28('0x1e')](0xcc)[_0x7a28('0x18')]();});}};}function handleEntityNotFound(_0x34fe9e,_0x264074){return function(_0x553564){if(!_0x553564){_0x34fe9e[_0x7a28('0x17')](0x194);}return _0x553564;};}function handleError(_0x1f48be,_0x16c22b){_0x16c22b=_0x16c22b||0x1f4;return function(_0x1db9b2){logger[_0x7a28('0x23')](_0x1db9b2[_0x7a28('0x24')]);if(_0x1db9b2[_0x7a28('0x25')]){delete _0x1db9b2[_0x7a28('0x25')];}_0x1f48be['status'](_0x16c22b)[_0x7a28('0x26')](_0x1db9b2);};}exports[_0x7a28('0x27')]=function(_0x5cfe10,_0x355f47){var _0x493615={},_0x4ed662={},_0x294f2f={'count':0x0,'rows':[]};var _0x5dd2bf=_['map'](db['SquareMessage'][_0x7a28('0x28')],function(_0x4ae416){return{'name':_0x4ae416[_0x7a28('0x29')],'type':_0x4ae416['type'][_0x7a28('0x2a')]};});_0x4ed662[_0x7a28('0x2b')]=_[_0x7a28('0x2c')](_0x5dd2bf,'name');_0x4ed662[_0x7a28('0x2d')]=_[_0x7a28('0x2e')](_0x5cfe10['query']);_0x4ed662[_0x7a28('0x2f')]=_[_0x7a28('0x30')](_0x4ed662[_0x7a28('0x2b')],_0x4ed662[_0x7a28('0x2d')]);_0x493615[_0x7a28('0x31')]=_[_0x7a28('0x30')](_0x4ed662[_0x7a28('0x2b')],qs[_0x7a28('0x32')](_0x5cfe10[_0x7a28('0x2d')][_0x7a28('0x32')]));_0x493615[_0x7a28('0x31')]=_0x493615['attributes'][_0x7a28('0x33')]?_0x493615[_0x7a28('0x31')]:_0x4ed662['model'];if(!_0x5cfe10[_0x7a28('0x2d')][_0x7a28('0x34')]('nolimit')){_0x493615[_0x7a28('0x1c')]=qs['limit'](_0x5cfe10['query'][_0x7a28('0x1c')]);_0x493615[_0x7a28('0x1a')]=qs[_0x7a28('0x1a')](_0x5cfe10['query']['offset']);}_0x493615[_0x7a28('0x35')]=qs[_0x7a28('0x36')](_0x5cfe10[_0x7a28('0x2d')][_0x7a28('0x36')]);_0x493615['where']=qs[_0x7a28('0x2f')](_['pick'](_0x5cfe10[_0x7a28('0x2d')],_0x4ed662[_0x7a28('0x2f')]),_0x5dd2bf);if(_0x5cfe10[_0x7a28('0x2d')][_0x7a28('0x37')]){_0x493615[_0x7a28('0x38')]=_[_0x7a28('0x39')](_0x493615[_0x7a28('0x38')],{'$or':_[_0x7a28('0x2c')](_0x5dd2bf,function(_0x20b8d4){if(_0x20b8d4['type']!=='VIRTUAL'){var _0x27cd34={};_0x27cd34[_0x20b8d4[_0x7a28('0x25')]]={'$like':'%'+_0x5cfe10['query'][_0x7a28('0x37')]+'%'};return _0x27cd34;}})});}_0x493615=_[_0x7a28('0x39')]({},_0x493615,_0x5cfe10[_0x7a28('0x3a')]);var _0x1daa36={'where':_0x493615[_0x7a28('0x38')]};return db[_0x7a28('0x3b')][_0x7a28('0x1d')](_0x1daa36)[_0x7a28('0x22')](function(_0x2dbc16){_0x294f2f[_0x7a28('0x1d')]=_0x2dbc16;if(_0x5cfe10[_0x7a28('0x2d')][_0x7a28('0x3c')]){_0x493615[_0x7a28('0x3d')]=[{'all':!![]}];}return db[_0x7a28('0x3b')][_0x7a28('0x3e')](_0x493615);})[_0x7a28('0x22')](function(_0x39259d){_0x294f2f[_0x7a28('0x3f')]=_0x39259d;return _0x294f2f;})[_0x7a28('0x22')](respondWithFilteredResult(_0x355f47,_0x493615))['catch'](handleError(_0x355f47,null));};exports[_0x7a28('0x40')]=function(_0x129b3a,_0x1c7d62){var _0x1140e5={'raw':!![],'where':{'id':_0x129b3a[_0x7a28('0x41')]['id']}},_0x284fa3={};_0x284fa3[_0x7a28('0x2b')]=_['keys'](db[_0x7a28('0x3b')][_0x7a28('0x28')]);_0x284fa3[_0x7a28('0x2d')]=_[_0x7a28('0x2e')](_0x129b3a['query']);_0x284fa3[_0x7a28('0x2f')]=_[_0x7a28('0x30')](_0x284fa3[_0x7a28('0x2b')],_0x284fa3[_0x7a28('0x2d')]);_0x1140e5[_0x7a28('0x31')]=_[_0x7a28('0x30')](_0x284fa3[_0x7a28('0x2b')],qs[_0x7a28('0x32')](_0x129b3a[_0x7a28('0x2d')][_0x7a28('0x32')]));_0x1140e5[_0x7a28('0x31')]=_0x1140e5[_0x7a28('0x31')][_0x7a28('0x33')]?_0x1140e5[_0x7a28('0x31')]:_0x284fa3[_0x7a28('0x2b')];if(_0x129b3a['query'][_0x7a28('0x3c')]){_0x1140e5[_0x7a28('0x3d')]=[{'all':!![]}];}_0x1140e5=_[_0x7a28('0x39')]({},_0x1140e5,_0x129b3a[_0x7a28('0x3a')]);return db[_0x7a28('0x3b')][_0x7a28('0x42')](_0x1140e5)['then'](handleEntityNotFound(_0x1c7d62,null))['then'](respondWithResult(_0x1c7d62,null))[_0x7a28('0x43')](handleError(_0x1c7d62,null));};exports[_0x7a28('0x44')]=function(_0x2d8c9e,_0x59f8f0){return db[_0x7a28('0x3b')][_0x7a28('0x44')](_0x2d8c9e[_0x7a28('0x45')],{})[_0x7a28('0x22')](respondWithResult(_0x59f8f0,0xc9))[_0x7a28('0x43')](handleError(_0x59f8f0,null));};exports[_0x7a28('0x21')]=function(_0x585a45,_0x4bf48d){if(_0x585a45[_0x7a28('0x45')]['id']){delete _0x585a45[_0x7a28('0x45')]['id'];}return db[_0x7a28('0x3b')][_0x7a28('0x42')]({'where':{'id':_0x585a45[_0x7a28('0x41')]['id']}})[_0x7a28('0x22')](handleEntityNotFound(_0x4bf48d,null))[_0x7a28('0x22')](saveUpdates(_0x585a45[_0x7a28('0x45')],null))[_0x7a28('0x22')](respondWithResult(_0x4bf48d,null))[_0x7a28('0x43')](handleError(_0x4bf48d,null));};exports[_0x7a28('0x46')]=function(_0x24d268,_0x274cfe){return db[_0x7a28('0x3b')][_0x7a28('0x42')]({'where':{'id':_0x24d268['params']['id']}})['then'](handleEntityNotFound(_0x274cfe,null))[_0x7a28('0x22')](removeEntity(_0x274cfe,null))[_0x7a28('0x43')](handleError(_0x274cfe,null));}; \ No newline at end of file +var _0x685b=['SquareMessage','rawAttributes','key','map','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','count','limit','set','Content-Range','json','apply','save','then','end','sendStatus','error','stack','index'];(function(_0x21ace4,_0x31669c){var _0x35c901=function(_0x214b8f){while(--_0x214b8f){_0x21ace4['push'](_0x21ace4['shift']());}};_0x35c901(++_0x31669c);}(_0x685b,0x199));var _0xb685=function(_0x2e4ee7,_0x4bdc11){_0x2e4ee7=_0x2e4ee7-0x0;var _0x49e2e8=_0x685b[_0x2e4ee7];return _0x49e2e8;};'use strict';var emlformat=require(_0xb685('0x0'));var rimraf=require(_0xb685('0x1'));var zipdir=require(_0xb685('0x2'));var jsonpatch=require(_0xb685('0x3'));var rp=require(_0xb685('0x4'));var moment=require(_0xb685('0x5'));var BPromise=require(_0xb685('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb685('0x7'));var sox=require(_0xb685('0x8'));var csv=require(_0xb685('0x9'));var ejs=require(_0xb685('0xa'));var fs=require('fs');var fs_extra=require(_0xb685('0xb'));var _=require(_0xb685('0xc'));var squel=require(_0xb685('0xd'));var crypto=require(_0xb685('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb685('0xf'));var toCsv=require(_0xb685('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb685('0x10'));var authService=require(_0xb685('0x11'));var qs=require(_0xb685('0x12'));var as=require(_0xb685('0x13'));var hardwareService=require(_0xb685('0x14'));var logger=require(_0xb685('0x15'))('api');var utils=require(_0xb685('0x16'));var config=require(_0xb685('0x17'));var licenseUtil=require(_0xb685('0x18'));var db=require(_0xb685('0x19'))['db'];function respondWithStatusCode(_0x25a06e,_0x5d4255){_0x5d4255=_0x5d4255||0xcc;return function(_0x35a41e){if(_0x35a41e){return _0x25a06e['sendStatus'](_0x5d4255);}return _0x25a06e[_0xb685('0x1a')](_0x5d4255)['end']();};}function respondWithResult(_0x37400a,_0xfac243){_0xfac243=_0xfac243||0xc8;return function(_0x2a7557){if(_0x2a7557){return _0x37400a[_0xb685('0x1a')](_0xfac243)['json'](_0x2a7557);}};}function respondWithFilteredResult(_0x217c06,_0x5dfa46){return function(_0x2aa19e){if(_0x2aa19e){var _0x1bd88b=typeof _0x5dfa46[_0xb685('0x1b')]==='undefined'&&typeof _0x5dfa46['limit']==='undefined';var _0x24028d=_0x2aa19e[_0xb685('0x1c')];var _0x23f701=_0x1bd88b?0x0:_0x5dfa46['offset'];var _0x111066=_0x1bd88b?_0x2aa19e[_0xb685('0x1c')]:_0x5dfa46[_0xb685('0x1b')]+_0x5dfa46[_0xb685('0x1d')];var _0x2587bc;if(_0x111066>=_0x24028d){_0x111066=_0x24028d;_0x2587bc=0xc8;}else{_0x2587bc=0xce;}_0x217c06[_0xb685('0x1a')](_0x2587bc);return _0x217c06[_0xb685('0x1e')](_0xb685('0x1f'),_0x23f701+'-'+_0x111066+'/'+_0x24028d)[_0xb685('0x20')](_0x2aa19e);}return null;};}function patchUpdates(_0x16032e){return function(_0x1e466f){try{jsonpatch[_0xb685('0x21')](_0x1e466f,_0x16032e,!![]);}catch(_0x394c84){return BPromise['reject'](_0x394c84);}return _0x1e466f[_0xb685('0x22')]();};}function saveUpdates(_0x13f3fc,_0x55e39e){return function(_0xcce887){if(_0xcce887){return _0xcce887['update'](_0x13f3fc)[_0xb685('0x23')](function(_0x24b78b){return _0x24b78b;});}return null;};}function removeEntity(_0x527847,_0x433bb3){return function(_0x5f1532){if(_0x5f1532){return _0x5f1532['destroy']()['then'](function(){_0x527847[_0xb685('0x1a')](0xcc)[_0xb685('0x24')]();});}};}function handleEntityNotFound(_0x42983b,_0x170798){return function(_0x39b1ac){if(!_0x39b1ac){_0x42983b[_0xb685('0x25')](0x194);}return _0x39b1ac;};}function handleError(_0x8f8da3,_0x2ea329){_0x2ea329=_0x2ea329||0x1f4;return function(_0x2ade94){logger[_0xb685('0x26')](_0x2ade94[_0xb685('0x27')]);if(_0x2ade94['name']){delete _0x2ade94['name'];}_0x8f8da3[_0xb685('0x1a')](_0x2ea329)['send'](_0x2ade94);};}exports[_0xb685('0x28')]=function(_0x42e6eb,_0x52b321){var _0x20dce7={},_0x13c91e={},_0x3af7c5={'count':0x0,'rows':[]};var _0x31cb04=_['map'](db[_0xb685('0x29')][_0xb685('0x2a')],function(_0x1747d5){return{'name':_0x1747d5['fieldName'],'type':_0x1747d5['type'][_0xb685('0x2b')]};});_0x13c91e['model']=_[_0xb685('0x2c')](_0x31cb04,_0xb685('0x2d'));_0x13c91e[_0xb685('0x2e')]=_[_0xb685('0x2f')](_0x42e6eb[_0xb685('0x2e')]);_0x13c91e[_0xb685('0x30')]=_[_0xb685('0x31')](_0x13c91e[_0xb685('0x32')],_0x13c91e['query']);_0x20dce7[_0xb685('0x33')]=_[_0xb685('0x31')](_0x13c91e[_0xb685('0x32')],qs[_0xb685('0x34')](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x34')]));_0x20dce7[_0xb685('0x33')]=_0x20dce7['attributes'][_0xb685('0x35')]?_0x20dce7[_0xb685('0x33')]:_0x13c91e[_0xb685('0x32')];if(!_0x42e6eb['query'][_0xb685('0x36')](_0xb685('0x37'))){_0x20dce7['limit']=qs['limit'](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x1d')]);_0x20dce7['offset']=qs['offset'](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x1b')]);}_0x20dce7[_0xb685('0x38')]=qs[_0xb685('0x39')](_0x42e6eb[_0xb685('0x2e')][_0xb685('0x39')]);_0x20dce7[_0xb685('0x3a')]=qs[_0xb685('0x30')](_['pick'](_0x42e6eb[_0xb685('0x2e')],_0x13c91e[_0xb685('0x30')]),_0x31cb04);if(_0x42e6eb[_0xb685('0x2e')][_0xb685('0x3b')]){_0x20dce7[_0xb685('0x3a')]=_[_0xb685('0x3c')](_0x20dce7[_0xb685('0x3a')],{'$or':_[_0xb685('0x2c')](_0x31cb04,function(_0x2bd0fc){if(_0x2bd0fc[_0xb685('0x3d')]!==_0xb685('0x3e')){var _0x34fbfc={};_0x34fbfc[_0x2bd0fc['name']]={'$like':'%'+_0x42e6eb[_0xb685('0x2e')][_0xb685('0x3b')]+'%'};return _0x34fbfc;}})});}_0x20dce7=_[_0xb685('0x3c')]({},_0x20dce7,_0x42e6eb[_0xb685('0x3f')]);var _0x568555={'where':_0x20dce7[_0xb685('0x3a')]};return db['SquareMessage'][_0xb685('0x1c')](_0x568555)[_0xb685('0x23')](function(_0xd71ab5){_0x3af7c5[_0xb685('0x1c')]=_0xd71ab5;if(_0x42e6eb['query'][_0xb685('0x40')]){_0x20dce7[_0xb685('0x41')]=[{'all':!![]}];}return db['SquareMessage'][_0xb685('0x42')](_0x20dce7);})[_0xb685('0x23')](function(_0x562d12){_0x3af7c5[_0xb685('0x43')]=_0x562d12;return _0x3af7c5;})[_0xb685('0x23')](respondWithFilteredResult(_0x52b321,_0x20dce7))[_0xb685('0x44')](handleError(_0x52b321,null));};exports[_0xb685('0x45')]=function(_0x329cdb,_0x50c226){var _0x75abc7={'raw':!![],'where':{'id':_0x329cdb[_0xb685('0x46')]['id']}},_0x32b337={};_0x32b337[_0xb685('0x32')]=_['keys'](db[_0xb685('0x29')]['rawAttributes']);_0x32b337[_0xb685('0x2e')]=_[_0xb685('0x2f')](_0x329cdb[_0xb685('0x2e')]);_0x32b337[_0xb685('0x30')]=_[_0xb685('0x31')](_0x32b337[_0xb685('0x32')],_0x32b337[_0xb685('0x2e')]);_0x75abc7[_0xb685('0x33')]=_[_0xb685('0x31')](_0x32b337[_0xb685('0x32')],qs[_0xb685('0x34')](_0x329cdb[_0xb685('0x2e')][_0xb685('0x34')]));_0x75abc7[_0xb685('0x33')]=_0x75abc7[_0xb685('0x33')][_0xb685('0x35')]?_0x75abc7[_0xb685('0x33')]:_0x32b337['model'];if(_0x329cdb['query'][_0xb685('0x40')]){_0x75abc7[_0xb685('0x41')]=[{'all':!![]}];}_0x75abc7=_[_0xb685('0x3c')]({},_0x75abc7,_0x329cdb[_0xb685('0x3f')]);return db[_0xb685('0x29')]['find'](_0x75abc7)[_0xb685('0x23')](handleEntityNotFound(_0x50c226,null))[_0xb685('0x23')](respondWithResult(_0x50c226,null))[_0xb685('0x44')](handleError(_0x50c226,null));};exports[_0xb685('0x47')]=function(_0x544b0f,_0x120c92){return db[_0xb685('0x29')]['create'](_0x544b0f[_0xb685('0x48')],{})[_0xb685('0x23')](respondWithResult(_0x120c92,0xc9))['catch'](handleError(_0x120c92,null));};exports[_0xb685('0x49')]=function(_0x317d8b,_0x16c306){if(_0x317d8b[_0xb685('0x48')]['id']){delete _0x317d8b[_0xb685('0x48')]['id'];}return db['SquareMessage']['find']({'where':{'id':_0x317d8b[_0xb685('0x46')]['id']}})['then'](handleEntityNotFound(_0x16c306,null))[_0xb685('0x23')](saveUpdates(_0x317d8b[_0xb685('0x48')],null))[_0xb685('0x23')](respondWithResult(_0x16c306,null))[_0xb685('0x44')](handleError(_0x16c306,null));};exports[_0xb685('0x4a')]=function(_0x1e433f,_0x57a798){return db[_0xb685('0x29')]['find']({'where':{'id':_0x1e433f['params']['id']}})[_0xb685('0x23')](handleEntityNotFound(_0x57a798,null))['then'](removeEntity(_0x57a798,null))['catch'](handleError(_0x57a798,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index bdbfe25..53e0394 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 _0x9169=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SquareMessage','util','../../config/logger'];(function(_0x5b58b2,_0x4e32d4){var _0x23f5d6=function(_0x4bf5f3){while(--_0x4bf5f3){_0x5b58b2['push'](_0x5b58b2['shift']());}};_0x23f5d6(++_0x4e32d4);}(_0x9169,0xb9));var _0x9916=function(_0x23fd1b,_0x469cab){_0x23fd1b=_0x23fd1b-0x0;var _0x304e83=_0x9169[_0x23fd1b];return _0x304e83;};'use strict';var _=require('lodash');var util=require(_0x9916('0x0'));var logger=require(_0x9916('0x1'))(_0x9916('0x2'));var moment=require(_0x9916('0x3'));var BPromise=require(_0x9916('0x4'));var rp=require(_0x9916('0x5'));var fs=require('fs');var path=require(_0x9916('0x6'));var rimraf=require('rimraf');var config=require(_0x9916('0x7'));var attributes=require('./squareMessage.attributes');module[_0x9916('0x8')]=function(_0x5b7dc1,_0x217a04){return _0x5b7dc1[_0x9916('0x9')](_0x9916('0xa'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56ae=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0x56ae,0x160));var _0xe56a=function(_0x3de9ff,_0x537b75){_0x3de9ff=_0x3de9ff-0x0;var _0x29cc8e=_0x56ae[_0x3de9ff];return _0x29cc8e;};'use strict';var _=require(_0xe56a('0x0'));var util=require('util');var logger=require(_0xe56a('0x1'))(_0xe56a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe56a('0x3'));var fs=require('fs');var path=require(_0xe56a('0x4'));var rimraf=require(_0xe56a('0x5'));var config=require(_0xe56a('0x6'));var attributes=require(_0xe56a('0x7'));module[_0xe56a('0x8')]=function(_0x2797ea,_0x24db0e){return _0x2797ea[_0xe56a('0x9')](_0xe56a('0xa'),attributes,{'tableName':'square_messages','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 acfdf9b..0cdf84a 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 _0x35af=['stringify','error','code','message','result','CreateSquareMessage','SquareMessage','body','options','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4fbcca,_0xcfed06){var _0x2152c8=function(_0x57df99){while(--_0x57df99){_0x4fbcca['push'](_0x4fbcca['shift']());}};_0x2152c8(++_0xcfed06);}(_0x35af,0x119));var _0xf35a=function(_0x2b0e5f,_0x437f0c){_0x2b0e5f=_0x2b0e5f-0x0;var _0x2cfa56=_0x35af[_0x2b0e5f];return _0x2cfa56;};'use strict';var _=require(_0xf35a('0x0'));var util=require(_0xf35a('0x1'));var moment=require(_0xf35a('0x2'));var BPromise=require(_0xf35a('0x3'));var rs=require(_0xf35a('0x4'));var fs=require('fs');var Redis=require(_0xf35a('0x5'));var db=require(_0xf35a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf35a('0x7'))(_0xf35a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf35a('0x9'));var client=jayson[_0xf35a('0xa')][_0xf35a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x53a7db,_0x5636fe,_0x458d4b){return new BPromise(function(_0x1db023,_0x3fb623){return client['request'](_0x53a7db,_0x458d4b)['then'](function(_0x13d385){logger[_0xf35a('0xc')](_0xf35a('0xd'),_0x5636fe,_0xf35a('0xe'));logger['debug'](_0xf35a('0xf'),_0x5636fe,_0xf35a('0xe'),JSON[_0xf35a('0x10')](_0x13d385));if(_0x13d385[_0xf35a('0x11')]){if(_0x13d385[_0xf35a('0x11')][_0xf35a('0x12')]===0x1f4){logger[_0xf35a('0x11')]('SquareMessage,\x20%s,\x20%s',_0x5636fe,_0x13d385[_0xf35a('0x11')][_0xf35a('0x13')]);return _0x3fb623(_0x13d385['error'][_0xf35a('0x13')]);}logger[_0xf35a('0x11')](_0xf35a('0xd'),_0x5636fe,_0x13d385[_0xf35a('0x11')][_0xf35a('0x13')]);return _0x1db023(_0x13d385[_0xf35a('0x11')][_0xf35a('0x13')]);}else{logger[_0xf35a('0xc')](_0xf35a('0xd'),_0x5636fe,_0xf35a('0xe'));_0x1db023(_0x13d385[_0xf35a('0x14')][_0xf35a('0x13')]);}})['catch'](function(_0x3b53d1){logger['error'](_0xf35a('0xd'),_0x5636fe,_0x3b53d1);_0x3fb623(_0x3b53d1);});});}exports[_0xf35a('0x15')]=function(_0x9619a3){var _0x52017a=this;return new Promise(function(_0x37bfb9,_0x2b7e9e){return db[_0xf35a('0x16')]['create'](_0x9619a3[_0xf35a('0x17')],{'raw':_0x9619a3['options']?_0x9619a3[_0xf35a('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xf35a('0x19')](function(_0xa5979c){logger[_0xf35a('0xc')](_0xf35a('0x15'),_0x9619a3);logger[_0xf35a('0x1a')]('CreateSquareMessage',_0x9619a3,JSON[_0xf35a('0x10')](_0xa5979c));_0x37bfb9(_0xa5979c);})['catch'](function(_0x17ad3f){logger['error']('CreateSquareMessage',_0x17ad3f[_0xf35a('0x13')],_0x9619a3);_0x2b7e9e(_0x52017a[_0xf35a('0x11')](0x1f4,_0x17ad3f[_0xf35a('0x13')]));});});}; \ No newline at end of file +var _0x0f2f=['request','info','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','SquareMessage,\x20%s,\x20%s','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','then','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x3912b2,_0x54f3d4){var _0x25771d=function(_0x3d2b0d){while(--_0x3d2b0d){_0x3912b2['push'](_0x3912b2['shift']());}};_0x25771d(++_0x54f3d4);}(_0x0f2f,0xa0));var _0xf0f2=function(_0x2ab89a,_0xc19b7f){_0x2ab89a=_0x2ab89a-0x0;var _0xbb60db=_0x0f2f[_0x2ab89a];return _0xbb60db;};'use strict';var _=require(_0xf0f2('0x0'));var util=require(_0xf0f2('0x1'));var moment=require('moment');var BPromise=require(_0xf0f2('0x2'));var rs=require(_0xf0f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf0f2('0x4'));var logger=require(_0xf0f2('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf0f2('0x6'));var client=jayson[_0xf0f2('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x29d619,_0x29e287,_0x1764c7){return new BPromise(function(_0x5ae636,_0xde872){return client[_0xf0f2('0x8')](_0x29d619,_0x1764c7)['then'](function(_0x1d4251){logger[_0xf0f2('0x9')]('SquareMessage,\x20%s,\x20%s',_0x29e287,_0xf0f2('0xa'));logger['debug'](_0xf0f2('0xb'),_0x29e287,_0xf0f2('0xa'),JSON['stringify'](_0x1d4251));if(_0x1d4251['error']){if(_0x1d4251[_0xf0f2('0xc')][_0xf0f2('0xd')]===0x1f4){logger[_0xf0f2('0xc')](_0xf0f2('0xe'),_0x29e287,_0x1d4251['error'][_0xf0f2('0xf')]);return _0xde872(_0x1d4251[_0xf0f2('0xc')][_0xf0f2('0xf')]);}logger[_0xf0f2('0xc')]('SquareMessage,\x20%s,\x20%s',_0x29e287,_0x1d4251['error'][_0xf0f2('0xf')]);return _0x5ae636(_0x1d4251['error'][_0xf0f2('0xf')]);}else{logger[_0xf0f2('0x9')](_0xf0f2('0xe'),_0x29e287,_0xf0f2('0xa'));_0x5ae636(_0x1d4251['result'][_0xf0f2('0xf')]);}})[_0xf0f2('0x10')](function(_0x2c1897){logger[_0xf0f2('0xc')](_0xf0f2('0xe'),_0x29e287,_0x2c1897);_0xde872(_0x2c1897);});});}exports[_0xf0f2('0x11')]=function(_0x4831fe){var _0x5da419=this;return new Promise(function(_0x3a9496,_0x3da9d4){return db[_0xf0f2('0x12')][_0xf0f2('0x13')](_0x4831fe[_0xf0f2('0x14')],{'raw':_0x4831fe[_0xf0f2('0x15')]?_0x4831fe[_0xf0f2('0x15')][_0xf0f2('0x16')]===undefined?!![]:![]:!![]})[_0xf0f2('0x17')](function(_0x21f2c1){logger[_0xf0f2('0x9')]('CreateSquareMessage',_0x4831fe);logger['debug'](_0xf0f2('0x11'),_0x4831fe,JSON['stringify'](_0x21f2c1));_0x3a9496(_0x21f2c1);})['catch'](function(_0x2b440f){logger['error'](_0xf0f2('0x11'),_0x2b440f[_0xf0f2('0xf')],_0x4831fe);_0x3da9d4(_0x5da419['error'](0x1f4,_0x2b440f[_0xf0f2('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index fecfc27..caabb6a 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 _0xecb8=['./squareOdbc.controller','get','isAuthenticated','/:id','show','/:id/test','15s','test','create','put','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x209158,_0x40756b){var _0x166f84=function(_0x57bcb6){while(--_0x57bcb6){_0x209158['push'](_0x209158['shift']());}};_0x166f84(++_0x40756b);}(_0xecb8,0x1b0));var _0x8ecb=function(_0x1cabf4,_0x2842df){_0x1cabf4=_0x1cabf4-0x0;var _0x8a7fa1=_0xecb8[_0x1cabf4];return _0x8a7fa1;};'use strict';var multer=require(_0x8ecb('0x0'));var util=require(_0x8ecb('0x1'));var path=require('path');var timeout=require(_0x8ecb('0x2'));var express=require(_0x8ecb('0x3'));var router=express[_0x8ecb('0x4')]();var fs_extra=require(_0x8ecb('0x5'));var auth=require(_0x8ecb('0x6'));var interaction=require(_0x8ecb('0x7'));var config=require(_0x8ecb('0x8'));var controller=require(_0x8ecb('0x9'));router[_0x8ecb('0xa')]('/',auth[_0x8ecb('0xb')](),controller['index']);router['get'](_0x8ecb('0xc'),auth['isAuthenticated'](),controller[_0x8ecb('0xd')]);router['get'](_0x8ecb('0xe'),auth[_0x8ecb('0xb')](),timeout(_0x8ecb('0xf')),controller[_0x8ecb('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8ecb('0x11')]);router[_0x8ecb('0x12')]('/:id',auth[_0x8ecb('0xb')](),controller[_0x8ecb('0x13')]);router['delete'](_0x8ecb('0xc'),auth[_0x8ecb('0xb')](),controller[_0x8ecb('0x14')]);module['exports']=router; \ No newline at end of file +var _0xc813=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareOdbc.controller','isAuthenticated','index','get','/:id','show','15s','test','post','put','update','delete','destroy','exports'];(function(_0x3a026b,_0x42af55){var _0x4a3dec=function(_0xcfea52){while(--_0xcfea52){_0x3a026b['push'](_0x3a026b['shift']());}};_0x4a3dec(++_0x42af55);}(_0xc813,0x165));var _0x3c81=function(_0x1bd0c4,_0x2405e0){_0x1bd0c4=_0x1bd0c4-0x0;var _0x13a3af=_0xc813[_0x1bd0c4];return _0x13a3af;};'use strict';var multer=require(_0x3c81('0x0'));var util=require('util');var path=require(_0x3c81('0x1'));var timeout=require(_0x3c81('0x2'));var express=require(_0x3c81('0x3'));var router=express[_0x3c81('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3c81('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3c81('0x6'));var controller=require(_0x3c81('0x7'));router['get']('/',auth[_0x3c81('0x8')](),controller[_0x3c81('0x9')]);router[_0x3c81('0xa')](_0x3c81('0xb'),auth[_0x3c81('0x8')](),controller[_0x3c81('0xc')]);router[_0x3c81('0xa')]('/:id/test',auth['isAuthenticated'](),timeout(_0x3c81('0xd')),controller[_0x3c81('0xe')]);router[_0x3c81('0xf')]('/',auth[_0x3c81('0x8')](),controller['create']);router[_0x3c81('0x10')]('/:id',auth[_0x3c81('0x8')](),controller[_0x3c81('0x11')]);router[_0x3c81('0x12')](_0x3c81('0xb'),auth[_0x3c81('0x8')](),controller[_0x3c81('0x13')]);module[_0x3c81('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index afb457c..10e412b 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 _0xdcf9=['exports','STRING','name','sequelize'];(function(_0x30e004,_0x46f8c2){var _0x5ca247=function(_0x20d80f){while(--_0x20d80f){_0x30e004['push'](_0x30e004['shift']());}};_0x5ca247(++_0x46f8c2);}(_0xdcf9,0x7b));var _0x9dcf=function(_0x10b31d,_0x42b5c1){_0x10b31d=_0x10b31d-0x0;var _0x491f57=_0xdcf9[_0x10b31d];return _0x491f57;};'use strict';var Sequelize=require(_0x9dcf('0x0'));module[_0x9dcf('0x1')]={'name':{'type':Sequelize[_0x9dcf('0x2')],'unique':_0x9dcf('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x9dcf('0x2')]},'description':{'type':Sequelize[_0x9dcf('0x2')]}}; \ No newline at end of file +var _0xf596=['exports','STRING','name'];(function(_0x30cc1f,_0x7c7185){var _0x1e12d7=function(_0x3d9176){while(--_0x3d9176){_0x30cc1f['push'](_0x30cc1f['shift']());}};_0x1e12d7(++_0x7c7185);}(_0xf596,0x1c8));var _0x6f59=function(_0x397e9b,_0x33a24a){_0x397e9b=_0x397e9b-0x0;var _0x369d2e=_0xf596[_0x397e9b];return _0x369d2e;};'use strict';var Sequelize=require('sequelize');module[_0x6f59('0x0')]={'name':{'type':Sequelize[_0x6f59('0x1')],'unique':_0x6f59('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6f59('0x1')]},'description':{'type':Sequelize[_0x6f59('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 4d5b01b..563ebb9 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 _0x99ff=['fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','catch','error','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','ODBC','UserProfileResource','sendStatus','stack','name','index','map','SquareOdbc','rawAttributes'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x99ff,0x1e5));var _0xf99f=function(_0x3eae8d,_0x331b35){_0x3eae8d=_0x3eae8d-0x0;var _0x360920=_0x99ff[_0x3eae8d];return _0x360920;};'use strict';var emlformat=require(_0xf99f('0x0'));var rimraf=require(_0xf99f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf99f('0x2'));var rp=require('request-promise');var moment=require(_0xf99f('0x3'));var BPromise=require(_0xf99f('0x4'));var Mustache=require(_0xf99f('0x5'));var util=require('util');var path=require(_0xf99f('0x6'));var sox=require('sox');var csv=require(_0xf99f('0x7'));var ejs=require(_0xf99f('0x8'));var fs=require('fs');var fs_extra=require(_0xf99f('0x9'));var _=require(_0xf99f('0xa'));var squel=require(_0xf99f('0xb'));var crypto=require(_0xf99f('0xc'));var jsforce=require(_0xf99f('0xd'));var deskjs=require(_0xf99f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf99f('0xf'));var Papa=require(_0xf99f('0x10'));var Redis=require('ioredis');var authService=require(_0xf99f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf99f('0x12'));var hardwareService=require(_0xf99f('0x13'));var logger=require(_0xf99f('0x14'))('api');var utils=require(_0xf99f('0x15'));var config=require(_0xf99f('0x16'));var licenseUtil=require(_0xf99f('0x17'));var db=require(_0xf99f('0x18'))['db'];function respondWithStatusCode(_0x2a02bb,_0x2d8229){_0x2d8229=_0x2d8229||0xcc;return function(_0x1df755){if(_0x1df755){return _0x2a02bb['sendStatus'](_0x2d8229);}return _0x2a02bb['status'](_0x2d8229)[_0xf99f('0x19')]();};}function respondWithResult(_0x4aa094,_0xe526c6){_0xe526c6=_0xe526c6||0xc8;return function(_0x23c561){if(_0x23c561){return _0x4aa094[_0xf99f('0x1a')](_0xe526c6)[_0xf99f('0x1b')](_0x23c561);}};}function respondWithFilteredResult(_0x2ae8b0,_0xa083e0){return function(_0x94caf2){if(_0x94caf2){var _0x5817de=typeof _0xa083e0[_0xf99f('0x1c')]===_0xf99f('0x1d')&&typeof _0xa083e0[_0xf99f('0x1e')]===_0xf99f('0x1d');var _0x1557c0=_0x94caf2[_0xf99f('0x1f')];var _0x17369f=_0x5817de?0x0:_0xa083e0[_0xf99f('0x1c')];var _0x5e5bcd=_0x5817de?_0x94caf2[_0xf99f('0x1f')]:_0xa083e0[_0xf99f('0x1c')]+_0xa083e0[_0xf99f('0x1e')];var _0x41846c;if(_0x5e5bcd>=_0x1557c0){_0x5e5bcd=_0x1557c0;_0x41846c=0xc8;}else{_0x41846c=0xce;}_0x2ae8b0[_0xf99f('0x1a')](_0x41846c);return _0x2ae8b0[_0xf99f('0x20')](_0xf99f('0x21'),_0x17369f+'-'+_0x5e5bcd+'/'+_0x1557c0)[_0xf99f('0x1b')](_0x94caf2);}return null;};}function patchUpdates(_0x2d8c76){return function(_0x25afbf){try{jsonpatch[_0xf99f('0x22')](_0x25afbf,_0x2d8c76,!![]);}catch(_0x529236){return BPromise[_0xf99f('0x23')](_0x529236);}return _0x25afbf[_0xf99f('0x24')]();};}function saveUpdates(_0xba446a,_0x18a843){return function(_0x3961c6){if(_0x3961c6){return _0x3961c6[_0xf99f('0x25')](_0xba446a)[_0xf99f('0x26')](function(_0x3d62b7){return _0x3d62b7;});}return null;};}function removeEntity(_0x3aa8f1,_0x117aba){return function(_0x1e1e78){if(_0x1e1e78){return _0x1e1e78[_0xf99f('0x27')]()[_0xf99f('0x26')](function(){var _0x263da8=_0x1e1e78['get']({'plain':!![]});var _0x249e94=_0xf99f('0x28');return db[_0xf99f('0x29')][_0xf99f('0x27')]({'where':{'type':_0x249e94,'resourceId':_0x263da8['id']}})[_0xf99f('0x26')](function(){return _0x1e1e78;});})['then'](function(){_0x3aa8f1['status'](0xcc)[_0xf99f('0x19')]();});}};}function handleEntityNotFound(_0x384e0f,_0x2111dd){return function(_0x333396){if(!_0x333396){_0x384e0f[_0xf99f('0x2a')](0x194);}return _0x333396;};}function handleError(_0x442990,_0x4be0e4){_0x4be0e4=_0x4be0e4||0x1f4;return function(_0x2b2cbc){logger['error'](_0x2b2cbc[_0xf99f('0x2b')]);if(_0x2b2cbc[_0xf99f('0x2c')]){delete _0x2b2cbc[_0xf99f('0x2c')];}_0x442990[_0xf99f('0x1a')](_0x4be0e4)['send'](_0x2b2cbc);};}exports[_0xf99f('0x2d')]=function(_0x3ccdf5,_0xfe0bbb){var _0x4261c3={},_0x81ac7b={},_0x2478ad={'count':0x0,'rows':[]};var _0x162298=_[_0xf99f('0x2e')](db[_0xf99f('0x2f')][_0xf99f('0x30')],function(_0x79c2d9){return{'name':_0x79c2d9[_0xf99f('0x31')],'type':_0x79c2d9[_0xf99f('0x32')][_0xf99f('0x33')]};});_0x81ac7b['model']=_['map'](_0x162298,_0xf99f('0x2c'));_0x81ac7b[_0xf99f('0x34')]=_[_0xf99f('0x35')](_0x3ccdf5[_0xf99f('0x34')]);_0x81ac7b['filters']=_[_0xf99f('0x36')](_0x81ac7b[_0xf99f('0x37')],_0x81ac7b[_0xf99f('0x34')]);_0x4261c3[_0xf99f('0x38')]=_[_0xf99f('0x36')](_0x81ac7b['model'],qs[_0xf99f('0x39')](_0x3ccdf5['query']['fields']));_0x4261c3[_0xf99f('0x38')]=_0x4261c3[_0xf99f('0x38')][_0xf99f('0x3a')]?_0x4261c3['attributes']:_0x81ac7b['model'];if(!_0x3ccdf5['query'][_0xf99f('0x3b')](_0xf99f('0x3c'))){_0x4261c3[_0xf99f('0x1e')]=qs[_0xf99f('0x1e')](_0x3ccdf5[_0xf99f('0x34')]['limit']);_0x4261c3[_0xf99f('0x1c')]=qs[_0xf99f('0x1c')](_0x3ccdf5['query'][_0xf99f('0x1c')]);}_0x4261c3['order']=qs[_0xf99f('0x3d')](_0x3ccdf5['query'][_0xf99f('0x3d')]);_0x4261c3[_0xf99f('0x3e')]=qs[_0xf99f('0x3f')](_['pick'](_0x3ccdf5['query'],_0x81ac7b[_0xf99f('0x3f')]),_0x162298);if(_0x3ccdf5['query'][_0xf99f('0x40')]){_0x4261c3[_0xf99f('0x3e')]=_['merge'](_0x4261c3[_0xf99f('0x3e')],{'$or':_[_0xf99f('0x2e')](_0x162298,function(_0x372453){if(_0x372453[_0xf99f('0x32')]!==_0xf99f('0x41')){var _0x38e5bc={};_0x38e5bc[_0x372453[_0xf99f('0x2c')]]={'$like':'%'+_0x3ccdf5[_0xf99f('0x34')]['filter']+'%'};return _0x38e5bc;}})});}_0x4261c3=_[_0xf99f('0x42')]({},_0x4261c3,_0x3ccdf5[_0xf99f('0x43')]);var _0x157326={'where':_0x4261c3[_0xf99f('0x3e')]};return db[_0xf99f('0x2f')]['count'](_0x157326)['then'](function(_0x3c1403){_0x2478ad['count']=_0x3c1403;if(_0x3ccdf5[_0xf99f('0x34')][_0xf99f('0x44')]){_0x4261c3[_0xf99f('0x45')]=[{'all':!![]}];}return db[_0xf99f('0x2f')][_0xf99f('0x46')](_0x4261c3);})['then'](function(_0x3dcb91){_0x2478ad['rows']=_0x3dcb91;return _0x2478ad;})[_0xf99f('0x26')](respondWithFilteredResult(_0xfe0bbb,_0x4261c3))['catch'](handleError(_0xfe0bbb,null));};exports[_0xf99f('0x47')]=function(_0x43b770,_0x256be9){var _0x3254cd={'raw':!![],'where':{'id':_0x43b770[_0xf99f('0x48')]['id']}},_0x37cdf0={};_0x37cdf0['model']=_[_0xf99f('0x35')](db[_0xf99f('0x2f')]['rawAttributes']);_0x37cdf0['query']=_[_0xf99f('0x35')](_0x43b770[_0xf99f('0x34')]);_0x37cdf0[_0xf99f('0x3f')]=_[_0xf99f('0x36')](_0x37cdf0['model'],_0x37cdf0[_0xf99f('0x34')]);_0x3254cd[_0xf99f('0x38')]=_[_0xf99f('0x36')](_0x37cdf0[_0xf99f('0x37')],qs[_0xf99f('0x39')](_0x43b770[_0xf99f('0x34')]['fields']));_0x3254cd['attributes']=_0x3254cd[_0xf99f('0x38')][_0xf99f('0x3a')]?_0x3254cd['attributes']:_0x37cdf0[_0xf99f('0x37')];if(_0x43b770[_0xf99f('0x34')][_0xf99f('0x44')]){_0x3254cd[_0xf99f('0x45')]=[{'all':!![]}];}_0x3254cd=_[_0xf99f('0x42')]({},_0x3254cd,_0x43b770['options']);return db[_0xf99f('0x2f')]['find'](_0x3254cd)[_0xf99f('0x26')](handleEntityNotFound(_0x256be9,null))[_0xf99f('0x26')](respondWithResult(_0x256be9,null))['catch'](handleError(_0x256be9,null));};exports[_0xf99f('0x49')]=function(_0x10cb0d,_0x24dda8){return db[_0xf99f('0x2f')][_0xf99f('0x49')](_0x10cb0d[_0xf99f('0x4a')],{})['then'](function(_0xa290e7){var _0x362c3e=_0x10cb0d[_0xf99f('0x4b')][_0xf99f('0x4c')]({'plain':!![]});if(!_0x362c3e)throw new Error(_0xf99f('0x4d'));if(_0x362c3e[_0xf99f('0x4e')]===_0xf99f('0x4b')){var _0x551a56=_0xa290e7[_0xf99f('0x4c')]({'plain':!![]});var _0x4945f5=_0xf99f('0x28');return db[_0xf99f('0x4f')][_0xf99f('0x50')]({'where':{'name':_0x4945f5,'userProfileId':_0x362c3e['userProfileId']},'raw':!![]})[_0xf99f('0x26')](function(_0x26cea3){if(_0x26cea3&&_0x26cea3[_0xf99f('0x51')]===0x0){return db[_0xf99f('0x29')]['create']({'name':_0x551a56[_0xf99f('0x2c')],'resourceId':_0x551a56['id'],'type':_0x26cea3['name'],'sectionId':_0x26cea3['id']},{})[_0xf99f('0x26')](function(){return _0xa290e7;});}else{return _0xa290e7;}})[_0xf99f('0x52')](function(_0xbc4f8e){logger[_0xf99f('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xbc4f8e);throw _0xbc4f8e;});}return _0xa290e7;})['then'](respondWithResult(_0x24dda8,0xc9))[_0xf99f('0x52')](handleError(_0x24dda8,null));};exports[_0xf99f('0x25')]=function(_0x3b760c,_0x27cba3){if(_0x3b760c[_0xf99f('0x4a')]['id']){delete _0x3b760c[_0xf99f('0x4a')]['id'];}return db['SquareOdbc'][_0xf99f('0x50')]({'where':{'id':_0x3b760c[_0xf99f('0x48')]['id']}})[_0xf99f('0x26')](handleEntityNotFound(_0x27cba3,null))[_0xf99f('0x26')](saveUpdates(_0x3b760c[_0xf99f('0x4a')],null))[_0xf99f('0x26')](respondWithResult(_0x27cba3,null))['catch'](handleError(_0x27cba3,null));};exports[_0xf99f('0x27')]=function(_0x2ff08d,_0xfc818c){return db[_0xf99f('0x2f')][_0xf99f('0x50')]({'where':{'id':_0x2ff08d[_0xf99f('0x48')]['id']}})[_0xf99f('0x26')](handleEntityNotFound(_0xfc818c,null))[_0xf99f('0x26')](removeEntity(_0xfc818c,null))[_0xf99f('0x52')](handleError(_0xfc818c,null));};exports[_0xf99f('0x54')]=function(_0x3f94f9,_0x2a362c,_0x4ea270){var _0x402492;return db[_0xf99f('0x2f')]['find']({'where':{'id':_0x3f94f9[_0xf99f('0x48')]['id']},'attributes':['id',_0xf99f('0x55')]})['then'](handleEntityNotFound(_0x2a362c,null))[_0xf99f('0x26')](function(_0x4bf398){if(_0x4bf398){var _0x2db7a7=require(_0xf99f('0x56'))();_0x2db7a7[_0xf99f('0x57')](_0x4bf398[_0xf99f('0x55')]);_0x2db7a7[_0xf99f('0x58')]();return _0x4bf398;}})['then'](respondWithResult(_0x2a362c,null))['catch'](handleError(_0x2a362c,null));}; \ No newline at end of file +var _0xade9=['limit','status','set','Content-Range','apply','reject','update','then','destroy','get','ODBC','UserProfileResource','stack','name','index','map','SquareOdbc','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','rawAttributes','length','find','body','user','role','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','odbc','openSync','closeSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xade9,0xe3));var _0x9ade=function(_0x15ed84,_0x589521){_0x15ed84=_0x15ed84-0x0;var _0x426d2b=_0xade9[_0x15ed84];return _0x426d2b;};'use strict';var emlformat=require(_0x9ade('0x0'));var rimraf=require(_0x9ade('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9ade('0x2'));var rp=require('request-promise');var moment=require(_0x9ade('0x3'));var BPromise=require(_0x9ade('0x4'));var Mustache=require(_0x9ade('0x5'));var util=require(_0x9ade('0x6'));var path=require('path');var sox=require(_0x9ade('0x7'));var csv=require('to-csv');var ejs=require(_0x9ade('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9ade('0x9'));var squel=require(_0x9ade('0xa'));var crypto=require(_0x9ade('0xb'));var jsforce=require(_0x9ade('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9ade('0xd'));var querystring=require(_0x9ade('0xe'));var Papa=require(_0x9ade('0xf'));var Redis=require(_0x9ade('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9ade('0x11'));var as=require(_0x9ade('0x12'));var hardwareService=require(_0x9ade('0x13'));var logger=require('../../config/logger')(_0x9ade('0x14'));var utils=require('../../config/utils');var config=require(_0x9ade('0x15'));var licenseUtil=require(_0x9ade('0x16'));var db=require(_0x9ade('0x17'))['db'];function respondWithStatusCode(_0x9835b0,_0x5bf850){_0x5bf850=_0x5bf850||0xcc;return function(_0x803ba4){if(_0x803ba4){return _0x9835b0['sendStatus'](_0x5bf850);}return _0x9835b0['status'](_0x5bf850)[_0x9ade('0x18')]();};}function respondWithResult(_0x144019,_0x28f0ef){_0x28f0ef=_0x28f0ef||0xc8;return function(_0x17fdfc){if(_0x17fdfc){return _0x144019['status'](_0x28f0ef)[_0x9ade('0x19')](_0x17fdfc);}};}function respondWithFilteredResult(_0x58d726,_0x18bc6a){return function(_0x598a35){if(_0x598a35){var _0x51c0d8=typeof _0x18bc6a[_0x9ade('0x1a')]===_0x9ade('0x1b')&&typeof _0x18bc6a[_0x9ade('0x1c')]===_0x9ade('0x1b');var _0x2628b4=_0x598a35['count'];var _0x2c405f=_0x51c0d8?0x0:_0x18bc6a[_0x9ade('0x1a')];var _0x300ca5=_0x51c0d8?_0x598a35['count']:_0x18bc6a[_0x9ade('0x1a')]+_0x18bc6a['limit'];var _0x56bb32;if(_0x300ca5>=_0x2628b4){_0x300ca5=_0x2628b4;_0x56bb32=0xc8;}else{_0x56bb32=0xce;}_0x58d726[_0x9ade('0x1d')](_0x56bb32);return _0x58d726[_0x9ade('0x1e')](_0x9ade('0x1f'),_0x2c405f+'-'+_0x300ca5+'/'+_0x2628b4)[_0x9ade('0x19')](_0x598a35);}return null;};}function patchUpdates(_0x1ec918){return function(_0x2e88e0){try{jsonpatch[_0x9ade('0x20')](_0x2e88e0,_0x1ec918,!![]);}catch(_0x480208){return BPromise[_0x9ade('0x21')](_0x480208);}return _0x2e88e0['save']();};}function saveUpdates(_0x5352f1,_0x1e5209){return function(_0x2ff01a){if(_0x2ff01a){return _0x2ff01a[_0x9ade('0x22')](_0x5352f1)[_0x9ade('0x23')](function(_0x3e3e0b){return _0x3e3e0b;});}return null;};}function removeEntity(_0xfd452c,_0x477691){return function(_0x5589d4){if(_0x5589d4){return _0x5589d4[_0x9ade('0x24')]()[_0x9ade('0x23')](function(){var _0x3706eb=_0x5589d4[_0x9ade('0x25')]({'plain':!![]});var _0xc97616=_0x9ade('0x26');return db[_0x9ade('0x27')][_0x9ade('0x24')]({'where':{'type':_0xc97616,'resourceId':_0x3706eb['id']}})[_0x9ade('0x23')](function(){return _0x5589d4;});})[_0x9ade('0x23')](function(){_0xfd452c[_0x9ade('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x20d174,_0x3f2bb6){return function(_0x24e2c1){if(!_0x24e2c1){_0x20d174['sendStatus'](0x194);}return _0x24e2c1;};}function handleError(_0x5caf4e,_0x5cd0f9){_0x5cd0f9=_0x5cd0f9||0x1f4;return function(_0x26bd67){logger['error'](_0x26bd67[_0x9ade('0x28')]);if(_0x26bd67[_0x9ade('0x29')]){delete _0x26bd67['name'];}_0x5caf4e['status'](_0x5cd0f9)['send'](_0x26bd67);};}exports[_0x9ade('0x2a')]=function(_0x494587,_0x50e335){var _0x3d70c0={},_0x45b646={},_0x2ec3ce={'count':0x0,'rows':[]};var _0x395280=_[_0x9ade('0x2b')](db[_0x9ade('0x2c')]['rawAttributes'],function(_0x39f03){return{'name':_0x39f03[_0x9ade('0x2d')],'type':_0x39f03[_0x9ade('0x2e')]['key']};});_0x45b646[_0x9ade('0x2f')]=_[_0x9ade('0x2b')](_0x395280,_0x9ade('0x29'));_0x45b646[_0x9ade('0x30')]=_[_0x9ade('0x31')](_0x494587[_0x9ade('0x30')]);_0x45b646[_0x9ade('0x32')]=_[_0x9ade('0x33')](_0x45b646[_0x9ade('0x2f')],_0x45b646[_0x9ade('0x30')]);_0x3d70c0[_0x9ade('0x34')]=_[_0x9ade('0x33')](_0x45b646[_0x9ade('0x2f')],qs[_0x9ade('0x35')](_0x494587[_0x9ade('0x30')][_0x9ade('0x35')]));_0x3d70c0[_0x9ade('0x34')]=_0x3d70c0['attributes']['length']?_0x3d70c0[_0x9ade('0x34')]:_0x45b646['model'];if(!_0x494587[_0x9ade('0x30')][_0x9ade('0x36')]('nolimit')){_0x3d70c0['limit']=qs[_0x9ade('0x1c')](_0x494587[_0x9ade('0x30')][_0x9ade('0x1c')]);_0x3d70c0[_0x9ade('0x1a')]=qs[_0x9ade('0x1a')](_0x494587['query'][_0x9ade('0x1a')]);}_0x3d70c0[_0x9ade('0x37')]=qs['sort'](_0x494587[_0x9ade('0x30')][_0x9ade('0x38')]);_0x3d70c0[_0x9ade('0x39')]=qs[_0x9ade('0x32')](_[_0x9ade('0x3a')](_0x494587[_0x9ade('0x30')],_0x45b646['filters']),_0x395280);if(_0x494587[_0x9ade('0x30')][_0x9ade('0x3b')]){_0x3d70c0['where']=_['merge'](_0x3d70c0['where'],{'$or':_[_0x9ade('0x2b')](_0x395280,function(_0x32d1ab){if(_0x32d1ab[_0x9ade('0x2e')]!==_0x9ade('0x3c')){var _0x7de8b9={};_0x7de8b9[_0x32d1ab[_0x9ade('0x29')]]={'$like':'%'+_0x494587[_0x9ade('0x30')]['filter']+'%'};return _0x7de8b9;}})});}_0x3d70c0=_[_0x9ade('0x3d')]({},_0x3d70c0,_0x494587[_0x9ade('0x3e')]);var _0x3aeeb9={'where':_0x3d70c0[_0x9ade('0x39')]};return db[_0x9ade('0x2c')][_0x9ade('0x3f')](_0x3aeeb9)['then'](function(_0x42cff3){_0x2ec3ce[_0x9ade('0x3f')]=_0x42cff3;if(_0x494587[_0x9ade('0x30')][_0x9ade('0x40')]){_0x3d70c0[_0x9ade('0x41')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x3d70c0);})['then'](function(_0x1e6d9a){_0x2ec3ce[_0x9ade('0x42')]=_0x1e6d9a;return _0x2ec3ce;})['then'](respondWithFilteredResult(_0x50e335,_0x3d70c0))[_0x9ade('0x43')](handleError(_0x50e335,null));};exports[_0x9ade('0x44')]=function(_0x1690a0,_0x267476){var _0x1e333e={'raw':!![],'where':{'id':_0x1690a0[_0x9ade('0x45')]['id']}},_0x1b801d={};_0x1b801d['model']=_['keys'](db[_0x9ade('0x2c')][_0x9ade('0x46')]);_0x1b801d[_0x9ade('0x30')]=_[_0x9ade('0x31')](_0x1690a0['query']);_0x1b801d[_0x9ade('0x32')]=_['intersection'](_0x1b801d['model'],_0x1b801d[_0x9ade('0x30')]);_0x1e333e[_0x9ade('0x34')]=_[_0x9ade('0x33')](_0x1b801d['model'],qs[_0x9ade('0x35')](_0x1690a0[_0x9ade('0x30')][_0x9ade('0x35')]));_0x1e333e[_0x9ade('0x34')]=_0x1e333e[_0x9ade('0x34')][_0x9ade('0x47')]?_0x1e333e[_0x9ade('0x34')]:_0x1b801d[_0x9ade('0x2f')];if(_0x1690a0[_0x9ade('0x30')][_0x9ade('0x40')]){_0x1e333e[_0x9ade('0x41')]=[{'all':!![]}];}_0x1e333e=_[_0x9ade('0x3d')]({},_0x1e333e,_0x1690a0[_0x9ade('0x3e')]);return db['SquareOdbc'][_0x9ade('0x48')](_0x1e333e)[_0x9ade('0x23')](handleEntityNotFound(_0x267476,null))[_0x9ade('0x23')](respondWithResult(_0x267476,null))[_0x9ade('0x43')](handleError(_0x267476,null));};exports['create']=function(_0x14b790,_0x51883a){return db[_0x9ade('0x2c')]['create'](_0x14b790[_0x9ade('0x49')],{})[_0x9ade('0x23')](function(_0x34855b){var _0x25badb=_0x14b790[_0x9ade('0x4a')]['get']({'plain':!![]});if(!_0x25badb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x25badb[_0x9ade('0x4b')]===_0x9ade('0x4a')){var _0x5ccfad=_0x34855b[_0x9ade('0x25')]({'plain':!![]});var _0x5a184a='ODBC';return db['UserProfileSection'][_0x9ade('0x48')]({'where':{'name':_0x5a184a,'userProfileId':_0x25badb[_0x9ade('0x4c')]},'raw':!![]})[_0x9ade('0x23')](function(_0x7b8097){if(_0x7b8097&&_0x7b8097[_0x9ade('0x4d')]===0x0){return db[_0x9ade('0x27')][_0x9ade('0x4e')]({'name':_0x5ccfad[_0x9ade('0x29')],'resourceId':_0x5ccfad['id'],'type':_0x7b8097[_0x9ade('0x29')],'sectionId':_0x7b8097['id']},{})['then'](function(){return _0x34855b;});}else{return _0x34855b;}})[_0x9ade('0x43')](function(_0x348794){logger[_0x9ade('0x4f')](_0x9ade('0x50'),_0x348794);throw _0x348794;});}return _0x34855b;})[_0x9ade('0x23')](respondWithResult(_0x51883a,0xc9))[_0x9ade('0x43')](handleError(_0x51883a,null));};exports[_0x9ade('0x22')]=function(_0x122d47,_0x5c63ba){if(_0x122d47['body']['id']){delete _0x122d47[_0x9ade('0x49')]['id'];}return db[_0x9ade('0x2c')][_0x9ade('0x48')]({'where':{'id':_0x122d47['params']['id']}})['then'](handleEntityNotFound(_0x5c63ba,null))[_0x9ade('0x23')](saveUpdates(_0x122d47[_0x9ade('0x49')],null))['then'](respondWithResult(_0x5c63ba,null))['catch'](handleError(_0x5c63ba,null));};exports[_0x9ade('0x24')]=function(_0x2330a5,_0x2c64e3){return db['SquareOdbc']['find']({'where':{'id':_0x2330a5['params']['id']}})[_0x9ade('0x23')](handleEntityNotFound(_0x2c64e3,null))[_0x9ade('0x23')](removeEntity(_0x2c64e3,null))[_0x9ade('0x43')](handleError(_0x2c64e3,null));};exports[_0x9ade('0x51')]=function(_0x36b67c,_0x4d58c3,_0x52be43){var _0x130f6c;return db[_0x9ade('0x2c')][_0x9ade('0x48')]({'where':{'id':_0x36b67c[_0x9ade('0x45')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x4d58c3,null))['then'](function(_0x5217ad){if(_0x5217ad){var _0x129def=require(_0x9ade('0x52'))();_0x129def[_0x9ade('0x53')](_0x5217ad['dsn']);_0x129def[_0x9ade('0x54')]();return _0x5217ad;}})[_0x9ade('0x23')](respondWithResult(_0x4d58c3,null))[_0x9ade('0x43')](handleError(_0x4d58c3,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index e37a77e..3986211 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 _0x6a33=['request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','bluebird'];(function(_0x1e7e85,_0x5c747f){var _0x2f15b1=function(_0x24f14a){while(--_0x24f14a){_0x1e7e85['push'](_0x1e7e85['shift']());}};_0x2f15b1(++_0x5c747f);}(_0x6a33,0x1ad));var _0x36a3=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x6a33[_0x556927];return _0x5f1235;};'use strict';var _=require(_0x36a3('0x0'));var util=require(_0x36a3('0x1'));var logger=require(_0x36a3('0x2'))(_0x36a3('0x3'));var moment=require('moment');var BPromise=require(_0x36a3('0x4'));var rp=require(_0x36a3('0x5'));var fs=require('fs');var path=require(_0x36a3('0x6'));var rimraf=require(_0x36a3('0x7'));var config=require(_0x36a3('0x8'));var attributes=require(_0x36a3('0x9'));module[_0x36a3('0xa')]=function(_0x9f5a10,_0x2ae6e0){return _0x9f5a10[_0x36a3('0xb')](_0x36a3('0xc'),attributes,{'tableName':_0x36a3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6658=['path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','square_odbc','util','api','moment','bluebird','request-promise'];(function(_0x279755,_0x45b5c2){var _0x1e2295=function(_0x4129c8){while(--_0x4129c8){_0x279755['push'](_0x279755['shift']());}};_0x1e2295(++_0x45b5c2);}(_0x6658,0xf2));var _0x8665=function(_0x9cbe2c,_0x1884bd){_0x9cbe2c=_0x9cbe2c-0x0;var _0x3963d7=_0x6658[_0x9cbe2c];return _0x3963d7;};'use strict';var _=require('lodash');var util=require(_0x8665('0x0'));var logger=require('../../config/logger')(_0x8665('0x1'));var moment=require(_0x8665('0x2'));var BPromise=require(_0x8665('0x3'));var rp=require(_0x8665('0x4'));var fs=require('fs');var path=require(_0x8665('0x5'));var rimraf=require(_0x8665('0x6'));var config=require(_0x8665('0x7'));var attributes=require(_0x8665('0x8'));module[_0x8665('0x9')]=function(_0x1ccbde,_0x5d26fd){return _0x1ccbde[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('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 a907041..db396d1 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 _0x401e=['debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','SquareOdbc,\x20%s,\x20%s','message','result','catch','ShowSquareOdbc','SquareOdbc','options','where','attributes','include','map','model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent'];(function(_0x566aeb,_0x12ed7d){var _0x40ca61=function(_0x464379){while(--_0x464379){_0x566aeb['push'](_0x566aeb['shift']());}};_0x40ca61(++_0x12ed7d);}(_0x401e,0x192));var _0xe401=function(_0x20dd87,_0x510d8b){_0x20dd87=_0x20dd87-0x0;var _0x31d72f=_0x401e[_0x20dd87];return _0x31d72f;};'use strict';var _=require('lodash');var util=require(_0xe401('0x0'));var moment=require(_0xe401('0x1'));var BPromise=require(_0xe401('0x2'));var rs=require(_0xe401('0x3'));var fs=require('fs');var Redis=require(_0xe401('0x4'));var db=require(_0xe401('0x5'))['db'];var utils=require(_0xe401('0x6'));var logger=require(_0xe401('0x7'))(_0xe401('0x8'));var config=require(_0xe401('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe401('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f62bf,_0x2bdbc1,_0x543362){return new BPromise(function(_0x1d01f2,_0x5088c5){return client[_0xe401('0xb')](_0x2f62bf,_0x543362)['then'](function(_0x18ef9d){logger[_0xe401('0xc')]('SquareOdbc,\x20%s,\x20%s',_0x2bdbc1,_0xe401('0xd'));logger[_0xe401('0xe')](_0xe401('0xf'),_0x2bdbc1,_0xe401('0xd'),JSON['stringify'](_0x18ef9d));if(_0x18ef9d[_0xe401('0x10')]){if(_0x18ef9d[_0xe401('0x10')][_0xe401('0x11')]===0x1f4){logger[_0xe401('0x10')](_0xe401('0x12'),_0x2bdbc1,_0x18ef9d[_0xe401('0x10')]['message']);return _0x5088c5(_0x18ef9d[_0xe401('0x10')]['message']);}logger[_0xe401('0x10')](_0xe401('0x12'),_0x2bdbc1,_0x18ef9d[_0xe401('0x10')][_0xe401('0x13')]);return _0x1d01f2(_0x18ef9d['error'][_0xe401('0x13')]);}else{logger[_0xe401('0xc')](_0xe401('0x12'),_0x2bdbc1,_0xe401('0xd'));_0x1d01f2(_0x18ef9d[_0xe401('0x14')][_0xe401('0x13')]);}})[_0xe401('0x15')](function(_0x4a0d1f){logger['error'](_0xe401('0x12'),_0x2bdbc1,_0x4a0d1f);_0x5088c5(_0x4a0d1f);});});}exports[_0xe401('0x16')]=function(_0x10da15){var _0x6fd31d=this;return new Promise(function(_0x561306,_0x5eff91){return db[_0xe401('0x17')]['find']({'raw':_0x10da15[_0xe401('0x18')]?_0x10da15[_0xe401('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x10da15[_0xe401('0x18')]?_0x10da15[_0xe401('0x18')][_0xe401('0x19')]||null:null,'attributes':_0x10da15['options']?_0x10da15[_0xe401('0x18')][_0xe401('0x1a')]||null:null,'include':_0x10da15['options']?_0x10da15[_0xe401('0x18')][_0xe401('0x1b')]?_[_0xe401('0x1c')](_0x10da15[_0xe401('0x18')][_0xe401('0x1b')],function(_0x9222ac){return{'model':db[_0x9222ac[_0xe401('0x1d')]],'as':_0x9222ac['as'],'attributes':_0x9222ac['attributes'],'include':_0x9222ac[_0xe401('0x1b')]?_['map'](_0x9222ac['include'],function(_0x5a109c){return{'model':db[_0x5a109c['model']],'as':_0x5a109c['as'],'attributes':_0x5a109c[_0xe401('0x1a')],'include':_0x5a109c[_0xe401('0x1b')]?_[_0xe401('0x1c')](_0x5a109c[_0xe401('0x1b')],function(_0x3deb06){return{'model':db[_0x3deb06[_0xe401('0x1d')]],'as':_0x3deb06['as'],'attributes':_0x3deb06[_0xe401('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe401('0x1e')](function(_0x17a31d){logger[_0xe401('0xc')]('ShowSquareOdbc',_0x10da15);logger[_0xe401('0xe')](_0xe401('0x16'),_0x10da15,JSON[_0xe401('0x1f')](_0x17a31d));_0x561306(_0x17a31d);})[_0xe401('0x15')](function(_0x52a598){logger[_0xe401('0x10')](_0xe401('0x16'),_0x52a598[_0xe401('0x13')],_0x10da15);_0x5eff91(_0x6fd31d[_0xe401('0x10')](0x1f4,_0x52a598['message']));});});}; \ No newline at end of file +var _0x9a4e=['error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9a4e,0x151));var _0xe9a4=function(_0x34c237,_0x365787){_0x34c237=_0x34c237-0x0;var _0x26a96f=_0x9a4e[_0x34c237];return _0x26a96f;};'use strict';var _=require('lodash');var util=require(_0xe9a4('0x0'));var moment=require(_0xe9a4('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9a4('0x2'));var fs=require('fs');var Redis=require(_0xe9a4('0x3'));var db=require(_0xe9a4('0x4'))['db'];var utils=require(_0xe9a4('0x5'));var logger=require('../../config/logger')(_0xe9a4('0x6'));var config=require(_0xe9a4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe9a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x721d4a,_0x185fa5,_0x37253f){return new BPromise(function(_0x220f19,_0x246172){return client[_0xe9a4('0x9')](_0x721d4a,_0x37253f)[_0xe9a4('0xa')](function(_0x3a3dab){logger['info'](_0xe9a4('0xb'),_0x185fa5,_0xe9a4('0xc'));logger[_0xe9a4('0xd')](_0xe9a4('0xe'),_0x185fa5,_0xe9a4('0xc'),JSON['stringify'](_0x3a3dab));if(_0x3a3dab[_0xe9a4('0xf')]){if(_0x3a3dab[_0xe9a4('0xf')][_0xe9a4('0x10')]===0x1f4){logger[_0xe9a4('0xf')](_0xe9a4('0xb'),_0x185fa5,_0x3a3dab[_0xe9a4('0xf')][_0xe9a4('0x11')]);return _0x246172(_0x3a3dab[_0xe9a4('0xf')][_0xe9a4('0x11')]);}logger['error'](_0xe9a4('0xb'),_0x185fa5,_0x3a3dab['error'][_0xe9a4('0x11')]);return _0x220f19(_0x3a3dab[_0xe9a4('0xf')][_0xe9a4('0x11')]);}else{logger[_0xe9a4('0x12')](_0xe9a4('0xb'),_0x185fa5,'request\x20sent');_0x220f19(_0x3a3dab[_0xe9a4('0x13')][_0xe9a4('0x11')]);}})[_0xe9a4('0x14')](function(_0x1b7ac3){logger[_0xe9a4('0xf')](_0xe9a4('0xb'),_0x185fa5,_0x1b7ac3);_0x246172(_0x1b7ac3);});});}exports[_0xe9a4('0x15')]=function(_0x2c2fa7){var _0x2c4643=this;return new Promise(function(_0xe6c192,_0x3cc7a6){return db[_0xe9a4('0x16')][_0xe9a4('0x17')]({'raw':_0x2c2fa7[_0xe9a4('0x18')]?_0x2c2fa7[_0xe9a4('0x18')][_0xe9a4('0x19')]===undefined?!![]:![]:!![],'where':_0x2c2fa7[_0xe9a4('0x18')]?_0x2c2fa7[_0xe9a4('0x18')][_0xe9a4('0x1a')]||null:null,'attributes':_0x2c2fa7[_0xe9a4('0x18')]?_0x2c2fa7[_0xe9a4('0x18')][_0xe9a4('0x1b')]||null:null,'include':_0x2c2fa7[_0xe9a4('0x18')]?_0x2c2fa7['options'][_0xe9a4('0x1c')]?_[_0xe9a4('0x1d')](_0x2c2fa7[_0xe9a4('0x18')]['include'],function(_0x54b3fd){return{'model':db[_0x54b3fd[_0xe9a4('0x1e')]],'as':_0x54b3fd['as'],'attributes':_0x54b3fd[_0xe9a4('0x1b')],'include':_0x54b3fd['include']?_[_0xe9a4('0x1d')](_0x54b3fd[_0xe9a4('0x1c')],function(_0x57d34b){return{'model':db[_0x57d34b[_0xe9a4('0x1e')]],'as':_0x57d34b['as'],'attributes':_0x57d34b['attributes'],'include':_0x57d34b['include']?_[_0xe9a4('0x1d')](_0x57d34b[_0xe9a4('0x1c')],function(_0x2206f7){return{'model':db[_0x2206f7[_0xe9a4('0x1e')]],'as':_0x2206f7['as'],'attributes':_0x2206f7[_0xe9a4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe9a4('0xa')](function(_0x3d0589){logger[_0xe9a4('0x12')](_0xe9a4('0x15'),_0x2c2fa7);logger[_0xe9a4('0xd')]('ShowSquareOdbc',_0x2c2fa7,JSON[_0xe9a4('0x1f')](_0x3d0589));_0xe6c192(_0x3d0589);})[_0xe9a4('0x14')](function(_0xe1add9){logger[_0xe9a4('0xf')](_0xe9a4('0x15'),_0xe1add9[_0xe9a4('0x11')],_0x2c2fa7);_0x3cc7a6(_0x2c4643['error'](0x1f4,_0xe1add9['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index d852bfd..e8ad227 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 _0x6f35=['path','express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer','util'];(function(_0x172c61,_0x581387){var _0x462df7=function(_0x1973bd){while(--_0x1973bd){_0x172c61['push'](_0x172c61['shift']());}};_0x462df7(++_0x581387);}(_0x6f35,0x1c0));var _0x56f3=function(_0x1f812,_0x455a7b){_0x1f812=_0x1f812-0x0;var _0x1f6547=_0x6f35[_0x1f812];return _0x1f6547;};'use strict';var multer=require(_0x56f3('0x0'));var util=require(_0x56f3('0x1'));var path=require(_0x56f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x56f3('0x3'));var router=express[_0x56f3('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x56f3('0x5'));var config=require(_0x56f3('0x6'));var controller=require(_0x56f3('0x7'));router[_0x56f3('0x8')]('/',auth[_0x56f3('0x9')](),controller[_0x56f3('0xa')]);router[_0x56f3('0x8')](_0x56f3('0xb'),auth[_0x56f3('0x9')](),controller[_0x56f3('0xc')]);router[_0x56f3('0xd')]('/',auth[_0x56f3('0x9')](),controller['create']);router['put'](_0x56f3('0xb'),auth[_0x56f3('0x9')](),controller[_0x56f3('0xe')]);router[_0x56f3('0xf')]('/:id',auth[_0x56f3('0x9')](),controller[_0x56f3('0x10')]);module[_0x56f3('0x11')]=router; \ No newline at end of file +var _0x67e3=['exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','show','put','/:id','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67e3,0x151));var _0x367e=function(_0x2f8431,_0x49cef3){_0x2f8431=_0x2f8431-0x0;var _0x1acd17=_0x67e3[_0x2f8431];return _0x1acd17;};'use strict';var multer=require(_0x367e('0x0'));var util=require(_0x367e('0x1'));var path=require('path');var timeout=require(_0x367e('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x367e('0x3'));var interaction=require(_0x367e('0x4'));var config=require('../../config/environment');var controller=require(_0x367e('0x5'));router[_0x367e('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x367e('0x6')]('/:id',auth[_0x367e('0x7')](),controller[_0x367e('0x8')]);router['post']('/',auth[_0x367e('0x7')](),controller['create']);router[_0x367e('0x9')](_0x367e('0xa'),auth['isAuthenticated'](),controller[_0x367e('0xb')]);router[_0x367e('0xc')](_0x367e('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x367e('0xd')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 10d2919..718e783 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 _0xe4f4=['preproduction','toString','utf8','production','DATE','exports','STRING','TEXT','BLOB','long','getDataValue'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xe4f4,0x89));var _0x4e4f=function(_0x353cd6,_0xc795f6){_0x353cd6=_0x353cd6-0x0;var _0x55712a=_0xe4f4[_0x353cd6];return _0x55712a;};'use strict';var Sequelize=require('sequelize');module[_0x4e4f('0x0')]={'name':{'type':Sequelize[_0x4e4f('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x4e4f('0x1')]},'notes':{'type':Sequelize[_0x4e4f('0x2')]},'preproduction':{'type':Sequelize[_0x4e4f('0x3')](_0x4e4f('0x4')),'get':function(){if(this[_0x4e4f('0x5')](_0x4e4f('0x6'))){return this[_0x4e4f('0x5')]('preproduction')[_0x4e4f('0x7')](_0x4e4f('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x4e4f('0x4')),'get':function(){if(this[_0x4e4f('0x5')]('production')){return this[_0x4e4f('0x5')](_0x4e4f('0x9'))[_0x4e4f('0x7')](_0x4e4f('0x8'));}}},'savedAt':{'type':Sequelize[_0x4e4f('0xa')]},'publishedAt':{'type':Sequelize[_0x4e4f('0xa')]}}; \ No newline at end of file +var _0x2908=['production','DATE','sequelize','exports','STRING','name','long','getDataValue','preproduction','toString','utf8','BLOB'];(function(_0x14e3d1,_0x5e37a5){var _0x5baa3b=function(_0x161ae6){while(--_0x161ae6){_0x14e3d1['push'](_0x14e3d1['shift']());}};_0x5baa3b(++_0x5e37a5);}(_0x2908,0x1be));var _0x8290=function(_0x5a823b,_0x16b025){_0x5a823b=_0x5a823b-0x0;var _0x1497eb=_0x2908[_0x5a823b];return _0x1497eb;};'use strict';var Sequelize=require(_0x8290('0x0'));module[_0x8290('0x1')]={'name':{'type':Sequelize[_0x8290('0x2')],'unique':_0x8290('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x8290('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x8290('0x4')),'get':function(){if(this[_0x8290('0x5')](_0x8290('0x6'))){return this[_0x8290('0x5')](_0x8290('0x6'))[_0x8290('0x7')](_0x8290('0x8'));}}},'production':{'type':Sequelize[_0x8290('0x9')](_0x8290('0x4')),'get':function(){if(this[_0x8290('0x5')]('production')){return this[_0x8290('0x5')](_0x8290('0xa'))[_0x8290('0x7')](_0x8290('0x8'));}}},'savedAt':{'type':Sequelize[_0x8290('0xb')]},'publishedAt':{'type':Sequelize[_0x8290('0xb')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 0b3e76a..c4f9950 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 _0x9f8b=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','length','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','body','params','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','UserProfileResource','destroy','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','fieldName','key','keys','filters','intersection','model','query','fields','attributes','hasOwnProperty'];(function(_0x46d441,_0x392c98){var _0x419105=function(_0x5b95c4){while(--_0x5b95c4){_0x46d441['push'](_0x46d441['shift']());}};_0x419105(++_0x392c98);}(_0x9f8b,0x1b6));var _0xb9f8=function(_0x8b1bec,_0x1c8e41){_0x8b1bec=_0x8b1bec-0x0;var _0x29b1d8=_0x9f8b[_0x8b1bec];return _0x29b1d8;};'use strict';var _=require(_0xb9f8('0x0'));var Redis=require(_0xb9f8('0x1'));var qs=require(_0xb9f8('0x2'));var logger=require(_0xb9f8('0x3'))(_0xb9f8('0x4'));var config=require(_0xb9f8('0x5'));var db=require(_0xb9f8('0x6'))['db'];config[_0xb9f8('0x7')]=_['defaults'](config['redis'],{'host':_0xb9f8('0x8'),'port':0x18eb});var socket=require(_0xb9f8('0x9'))(new Redis(config[_0xb9f8('0x7')]));require(_0xb9f8('0xa'))[_0xb9f8('0xb')](socket);function respondWithResult(_0x5b4264,_0x405210){_0x405210=_0x405210||0xc8;return function(_0x2ca9a6){if(_0x2ca9a6){return _0x5b4264[_0xb9f8('0xc')](_0x405210)[_0xb9f8('0xd')](_0x2ca9a6);}};}function respondWithFilteredResult(_0x2d35b2,_0x39b3b0){return function(_0x520f80){if(_0x520f80){var _0x57e82e=typeof _0x39b3b0[_0xb9f8('0xe')]===_0xb9f8('0xf')&&typeof _0x39b3b0[_0xb9f8('0x10')]==='undefined';var _0x67fdb1=_0x520f80[_0xb9f8('0x11')];var _0x369a9a=_0x57e82e?0x0:_0x39b3b0[_0xb9f8('0xe')];var _0x4d3860=_0x57e82e?_0x520f80['count']:_0x39b3b0[_0xb9f8('0xe')]+_0x39b3b0[_0xb9f8('0x10')];var _0x553338;if(_0x4d3860>=_0x67fdb1){_0x4d3860=_0x67fdb1;_0x553338=0xc8;}else{_0x553338=0xce;}_0x2d35b2[_0xb9f8('0xc')](_0x553338);return _0x2d35b2[_0xb9f8('0x12')](_0xb9f8('0x13'),_0x369a9a+'-'+_0x4d3860+'/'+_0x67fdb1)[_0xb9f8('0xd')](_0x520f80);}return null;};}function saveUpdates(_0x1e731b){return function(_0x380d8a){if(_0x380d8a){return _0x380d8a[_0xb9f8('0x14')](_0x1e731b)[_0xb9f8('0x15')](function(_0xbc017d){return _0xbc017d;});}return null;};}function removeEntity(_0x1962b6){return function(_0x39a773){if(_0x39a773){return _0x39a773['destroy']()[_0xb9f8('0x15')](function(){var _0x7f3a08=_0x39a773['get']({'plain':!![]});var _0x2ffdb7='SquareProjects';return db[_0xb9f8('0x16')][_0xb9f8('0x17')]({'where':{'type':_0x2ffdb7,'resourceId':_0x7f3a08['id']}})[_0xb9f8('0x15')](function(){return _0x39a773;});})[_0xb9f8('0x15')](function(){var _0x11e3cd=new Redis(config[_0xb9f8('0x7')]);_0x11e3cd['publish'](_0xb9f8('0x18'),JSON[_0xb9f8('0x19')]({'id':_0x39a773['id'],'deleted':!![]}));})[_0xb9f8('0x15')](function(){_0x1962b6['status'](0xcc)[_0xb9f8('0x1a')]();});}};}function handleEntityNotFound(_0x5b1a0f){return function(_0x354701){if(!_0x354701){_0x5b1a0f[_0xb9f8('0x1b')](0x194);}return _0x354701;};}function handleError(_0xb2be3e,_0x2ecd42){_0x2ecd42=_0x2ecd42||0x1f4;return function(_0x3d0ee5){logger[_0xb9f8('0x1c')](_0x3d0ee5[_0xb9f8('0x1d')]);if(_0x3d0ee5['name']){delete _0x3d0ee5[_0xb9f8('0x1e')];}_0xb2be3e[_0xb9f8('0xc')](_0x2ecd42)['send'](_0x3d0ee5);};}exports[_0xb9f8('0x1f')]=function(_0x34b65b,_0x17d038){var _0x4c423a={},_0x33b412={},_0x4b414b={'count':0x0,'rows':[]};var _0x10b7cf=_[_0xb9f8('0x20')](db[_0xb9f8('0x21')][_0xb9f8('0x22')],function(_0x2e6cf6){return{'name':_0x2e6cf6[_0xb9f8('0x23')],'type':_0x2e6cf6['type'][_0xb9f8('0x24')]};});_0x33b412['model']=_['map'](_0x10b7cf,_0xb9f8('0x1e'));_0x33b412['query']=_[_0xb9f8('0x25')](_0x34b65b['query']);_0x33b412[_0xb9f8('0x26')]=_[_0xb9f8('0x27')](_0x33b412[_0xb9f8('0x28')],_0x33b412[_0xb9f8('0x29')]);_0x4c423a['attributes']=_['intersection'](_0x33b412[_0xb9f8('0x28')],qs['fields'](_0x34b65b[_0xb9f8('0x29')][_0xb9f8('0x2a')]));_0x4c423a[_0xb9f8('0x2b')]=_0x4c423a[_0xb9f8('0x2b')]['length']?_0x4c423a[_0xb9f8('0x2b')]:_0x33b412[_0xb9f8('0x28')];if(!_0x34b65b[_0xb9f8('0x29')][_0xb9f8('0x2c')]('nolimit')){_0x4c423a[_0xb9f8('0x10')]=qs[_0xb9f8('0x10')](_0x34b65b[_0xb9f8('0x29')][_0xb9f8('0x10')]);_0x4c423a[_0xb9f8('0xe')]=qs[_0xb9f8('0xe')](_0x34b65b[_0xb9f8('0x29')][_0xb9f8('0xe')]);}_0x4c423a[_0xb9f8('0x2d')]=qs[_0xb9f8('0x2e')](_0x34b65b['query'][_0xb9f8('0x2e')]);_0x4c423a[_0xb9f8('0x2f')]=qs['filters'](_[_0xb9f8('0x30')](_0x34b65b[_0xb9f8('0x29')],_0x33b412[_0xb9f8('0x26')]),_0x10b7cf);if(_0x34b65b[_0xb9f8('0x29')][_0xb9f8('0x31')]){_0x4c423a['where']=_[_0xb9f8('0x32')](_0x4c423a[_0xb9f8('0x2f')],{'$or':_[_0xb9f8('0x20')](_0x10b7cf,function(_0x5ba4a2){if(_0x5ba4a2['type']!==_0xb9f8('0x33')){var _0x10ea20={};_0x10ea20[_0x5ba4a2[_0xb9f8('0x1e')]]={'$like':'%'+_0x34b65b['query']['filter']+'%'};return _0x10ea20;}})});}_0x4c423a=_[_0xb9f8('0x32')]({},_0x4c423a,_0x34b65b[_0xb9f8('0x34')]);var _0x59084a={'where':_0x4c423a['where']};return db['SquareProject'][_0xb9f8('0x11')](_0x59084a)[_0xb9f8('0x15')](function(_0x5584a3){_0x4b414b[_0xb9f8('0x11')]=_0x5584a3;if(_0x34b65b[_0xb9f8('0x29')][_0xb9f8('0x35')]){_0x4c423a[_0xb9f8('0x36')]=[{'all':!![]}];}return db[_0xb9f8('0x21')][_0xb9f8('0x37')](_0x4c423a);})[_0xb9f8('0x15')](function(_0x578f65){_0x4b414b['rows']=_0x578f65;return _0x4b414b;})[_0xb9f8('0x15')](respondWithFilteredResult(_0x17d038,_0x4c423a))[_0xb9f8('0x38')](handleError(_0x17d038,null));};exports['show']=function(_0x4baa49,_0x127ebc){var _0x1ef660={'raw':![],'where':{'id':_0x4baa49['params']['id']}},_0x502fa4={};_0x502fa4[_0xb9f8('0x28')]=_['keys'](db[_0xb9f8('0x21')][_0xb9f8('0x22')]);_0x502fa4[_0xb9f8('0x29')]=_[_0xb9f8('0x25')](_0x4baa49[_0xb9f8('0x29')]);_0x502fa4[_0xb9f8('0x26')]=_['intersection'](_0x502fa4['model'],_0x502fa4[_0xb9f8('0x29')]);_0x1ef660[_0xb9f8('0x2b')]=_[_0xb9f8('0x27')](_0x502fa4['model'],qs[_0xb9f8('0x2a')](_0x4baa49[_0xb9f8('0x29')]['fields']));_0x1ef660[_0xb9f8('0x2b')]=_0x1ef660[_0xb9f8('0x2b')][_0xb9f8('0x39')]?_0x1ef660['attributes']:_0x502fa4[_0xb9f8('0x28')];if(_0x4baa49[_0xb9f8('0x29')]['includeAll']){_0x1ef660['include']=[{'all':!![]}];}_0x1ef660=_['merge']({},_0x1ef660,_0x4baa49[_0xb9f8('0x34')]);return db[_0xb9f8('0x21')][_0xb9f8('0x3a')](_0x1ef660)[_0xb9f8('0x15')](handleEntityNotFound(_0x127ebc,null))['then'](respondWithResult(_0x127ebc,null))['catch'](handleError(_0x127ebc,null));};exports['create']=function(_0xc3b0b1,_0x1d1a2d){return db[_0xb9f8('0x21')][_0xb9f8('0x3b')](_0xc3b0b1['body'],{})['then'](function(_0x5e4a85){var _0x1cd57b=_0xc3b0b1['user'][_0xb9f8('0x3c')]({'plain':!![]});if(!_0x1cd57b)throw new Error(_0xb9f8('0x3d'));if(_0x1cd57b[_0xb9f8('0x3e')]===_0xb9f8('0x3f')){var _0x307e67=_0x5e4a85[_0xb9f8('0x3c')]({'plain':!![]});var _0x5f87cf='SquareProjects';return db[_0xb9f8('0x40')]['find']({'where':{'name':_0x5f87cf,'userProfileId':_0x1cd57b['userProfileId']},'raw':!![]})[_0xb9f8('0x15')](function(_0x505b3a){if(_0x505b3a&&_0x505b3a[_0xb9f8('0x41')]===0x0){return db[_0xb9f8('0x16')][_0xb9f8('0x3b')]({'name':_0x307e67['name'],'resourceId':_0x307e67['id'],'type':_0x505b3a['name'],'sectionId':_0x505b3a['id']},{})[_0xb9f8('0x15')](function(){return _0x5e4a85;});}else{return _0x5e4a85;}})['catch'](function(_0x4cdd9d){logger[_0xb9f8('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4cdd9d);throw _0x4cdd9d;});}return _0x5e4a85;})[_0xb9f8('0x15')](respondWithResult(_0x1d1a2d,0xc9))['catch'](handleError(_0x1d1a2d,null));};exports[_0xb9f8('0x14')]=function(_0x2f1f9b,_0x16c818){if(_0x2f1f9b[_0xb9f8('0x42')]['id']){delete _0x2f1f9b[_0xb9f8('0x42')]['id'];}return db[_0xb9f8('0x21')]['find']({'where':{'id':_0x2f1f9b[_0xb9f8('0x43')]['id']}})['then'](handleEntityNotFound(_0x16c818,null))[_0xb9f8('0x15')](saveUpdates(_0x2f1f9b[_0xb9f8('0x42')],null))[_0xb9f8('0x15')](function(_0x2d4bc1){if(!_0x2d4bc1)return;var _0x385b89=_0x2d4bc1[_0xb9f8('0x3c')]({'plain':!![]});return _0x385b89;})[_0xb9f8('0x15')](function(_0x19ac38){var _0x12f698=new Redis(config[_0xb9f8('0x7')]);_0x12f698['publish'](_0xb9f8('0x18'),JSON[_0xb9f8('0x19')](_[_0xb9f8('0x30')](_0x19ac38,['id',_0xb9f8('0x1e'),_0xb9f8('0x44')])));return _0x19ac38;})[_0xb9f8('0x15')](respondWithResult(_0x16c818,null))[_0xb9f8('0x38')](handleError(_0x16c818,null));};exports[_0xb9f8('0x17')]=function(_0x3f8326,_0xe56239){return db[_0xb9f8('0x21')][_0xb9f8('0x3a')]({'where':{'id':_0x3f8326['params']['id']}})['then'](handleEntityNotFound(_0xe56239,null))[_0xb9f8('0x15')](removeEntity(_0xe56239,null))[_0xb9f8('0x38')](handleError(_0xe56239,null));}; \ No newline at end of file +var _0xc82d=['filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','merge','filter','options','SquareProject','includeAll','include','findAll','rows','show','keys','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','publish','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./squareProject.socket','register','status','json','offset','undefined','count','limit','Content-Range','then','SquareProjects','UserProfileResource','destroy','agi','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query'];(function(_0x403fe9,_0x4853f0){var _0x9b5e77=function(_0x5fc61b){while(--_0x5fc61b){_0x403fe9['push'](_0x403fe9['shift']());}};_0x9b5e77(++_0x4853f0);}(_0xc82d,0x67));var _0xdc82=function(_0x57c380,_0x4cdaae){_0x57c380=_0x57c380-0x0;var _0x201cbf=_0xc82d[_0x57c380];return _0x201cbf;};'use strict';var _=require(_0xdc82('0x0'));var Redis=require(_0xdc82('0x1'));var qs=require(_0xdc82('0x2'));var logger=require(_0xdc82('0x3'))(_0xdc82('0x4'));var config=require(_0xdc82('0x5'));var db=require(_0xdc82('0x6'))['db'];config[_0xdc82('0x7')]=_[_0xdc82('0x8')](config[_0xdc82('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xdc82('0x9'))[_0xdc82('0xa')](socket);function respondWithResult(_0x4201f4,_0x46bab5){_0x46bab5=_0x46bab5||0xc8;return function(_0x4f7bb4){if(_0x4f7bb4){return _0x4201f4[_0xdc82('0xb')](_0x46bab5)[_0xdc82('0xc')](_0x4f7bb4);}};}function respondWithFilteredResult(_0x4353a0,_0x4dd45b){return function(_0x4a2411){if(_0x4a2411){var _0x136265=typeof _0x4dd45b[_0xdc82('0xd')]===_0xdc82('0xe')&&typeof _0x4dd45b['limit']===_0xdc82('0xe');var _0x56c930=_0x4a2411[_0xdc82('0xf')];var _0x512433=_0x136265?0x0:_0x4dd45b['offset'];var _0x4409d2=_0x136265?_0x4a2411[_0xdc82('0xf')]:_0x4dd45b[_0xdc82('0xd')]+_0x4dd45b[_0xdc82('0x10')];var _0x452c1e;if(_0x4409d2>=_0x56c930){_0x4409d2=_0x56c930;_0x452c1e=0xc8;}else{_0x452c1e=0xce;}_0x4353a0['status'](_0x452c1e);return _0x4353a0['set'](_0xdc82('0x11'),_0x512433+'-'+_0x4409d2+'/'+_0x56c930)[_0xdc82('0xc')](_0x4a2411);}return null;};}function saveUpdates(_0x5c1736){return function(_0x4856d1){if(_0x4856d1){return _0x4856d1['update'](_0x5c1736)[_0xdc82('0x12')](function(_0x1357cd){return _0x1357cd;});}return null;};}function removeEntity(_0x54943f){return function(_0x55ea2c){if(_0x55ea2c){return _0x55ea2c['destroy']()[_0xdc82('0x12')](function(){var _0xe3804b=_0x55ea2c['get']({'plain':!![]});var _0x329767=_0xdc82('0x13');return db[_0xdc82('0x14')][_0xdc82('0x15')]({'where':{'type':_0x329767,'resourceId':_0xe3804b['id']}})[_0xdc82('0x12')](function(){return _0x55ea2c;});})[_0xdc82('0x12')](function(){var _0x71eabb=new Redis(config[_0xdc82('0x7')]);_0x71eabb['publish'](_0xdc82('0x16'),JSON['stringify']({'id':_0x55ea2c['id'],'deleted':!![]}));})[_0xdc82('0x12')](function(){_0x54943f['status'](0xcc)[_0xdc82('0x17')]();});}};}function handleEntityNotFound(_0x5a393e){return function(_0x25b6f6){if(!_0x25b6f6){_0x5a393e['sendStatus'](0x194);}return _0x25b6f6;};}function handleError(_0x265bb0,_0x7f277b){_0x7f277b=_0x7f277b||0x1f4;return function(_0x5e9d0d){logger[_0xdc82('0x18')](_0x5e9d0d[_0xdc82('0x19')]);if(_0x5e9d0d[_0xdc82('0x1a')]){delete _0x5e9d0d[_0xdc82('0x1a')];}_0x265bb0['status'](_0x7f277b)[_0xdc82('0x1b')](_0x5e9d0d);};}exports[_0xdc82('0x1c')]=function(_0x4901ea,_0x2692de){var _0x4b5e9a={},_0x6f4c64={},_0x2fef59={'count':0x0,'rows':[]};var _0x21a1ce=_[_0xdc82('0x1d')](db['SquareProject'][_0xdc82('0x1e')],function(_0x5ab6f2){return{'name':_0x5ab6f2[_0xdc82('0x1f')],'type':_0x5ab6f2[_0xdc82('0x20')][_0xdc82('0x21')]};});_0x6f4c64['model']=_[_0xdc82('0x1d')](_0x21a1ce,_0xdc82('0x1a'));_0x6f4c64[_0xdc82('0x22')]=_['keys'](_0x4901ea[_0xdc82('0x22')]);_0x6f4c64[_0xdc82('0x23')]=_[_0xdc82('0x24')](_0x6f4c64[_0xdc82('0x25')],_0x6f4c64[_0xdc82('0x22')]);_0x4b5e9a[_0xdc82('0x26')]=_['intersection'](_0x6f4c64['model'],qs[_0xdc82('0x27')](_0x4901ea['query']['fields']));_0x4b5e9a[_0xdc82('0x26')]=_0x4b5e9a['attributes'][_0xdc82('0x28')]?_0x4b5e9a[_0xdc82('0x26')]:_0x6f4c64[_0xdc82('0x25')];if(!_0x4901ea[_0xdc82('0x22')][_0xdc82('0x29')](_0xdc82('0x2a'))){_0x4b5e9a[_0xdc82('0x10')]=qs[_0xdc82('0x10')](_0x4901ea[_0xdc82('0x22')][_0xdc82('0x10')]);_0x4b5e9a[_0xdc82('0xd')]=qs[_0xdc82('0xd')](_0x4901ea[_0xdc82('0x22')][_0xdc82('0xd')]);}_0x4b5e9a['order']=qs['sort'](_0x4901ea[_0xdc82('0x22')]['sort']);_0x4b5e9a[_0xdc82('0x2b')]=qs[_0xdc82('0x23')](_['pick'](_0x4901ea[_0xdc82('0x22')],_0x6f4c64[_0xdc82('0x23')]),_0x21a1ce);if(_0x4901ea['query']['filter']){_0x4b5e9a['where']=_[_0xdc82('0x2c')](_0x4b5e9a[_0xdc82('0x2b')],{'$or':_[_0xdc82('0x1d')](_0x21a1ce,function(_0x25410d){if(_0x25410d['type']!=='VIRTUAL'){var _0x2b9d25={};_0x2b9d25[_0x25410d[_0xdc82('0x1a')]]={'$like':'%'+_0x4901ea[_0xdc82('0x22')][_0xdc82('0x2d')]+'%'};return _0x2b9d25;}})});}_0x4b5e9a=_[_0xdc82('0x2c')]({},_0x4b5e9a,_0x4901ea[_0xdc82('0x2e')]);var _0x5cedd4={'where':_0x4b5e9a['where']};return db[_0xdc82('0x2f')]['count'](_0x5cedd4)['then'](function(_0x2c9d1e){_0x2fef59[_0xdc82('0xf')]=_0x2c9d1e;if(_0x4901ea[_0xdc82('0x22')][_0xdc82('0x30')]){_0x4b5e9a[_0xdc82('0x31')]=[{'all':!![]}];}return db[_0xdc82('0x2f')][_0xdc82('0x32')](_0x4b5e9a);})[_0xdc82('0x12')](function(_0x212ee5){_0x2fef59[_0xdc82('0x33')]=_0x212ee5;return _0x2fef59;})[_0xdc82('0x12')](respondWithFilteredResult(_0x2692de,_0x4b5e9a))['catch'](handleError(_0x2692de,null));};exports[_0xdc82('0x34')]=function(_0x2ce2b9,_0x4820ef){var _0x3ab16b={'raw':![],'where':{'id':_0x2ce2b9['params']['id']}},_0x2b7bcd={};_0x2b7bcd[_0xdc82('0x25')]=_[_0xdc82('0x35')](db[_0xdc82('0x2f')][_0xdc82('0x1e')]);_0x2b7bcd[_0xdc82('0x22')]=_[_0xdc82('0x35')](_0x2ce2b9[_0xdc82('0x22')]);_0x2b7bcd[_0xdc82('0x23')]=_['intersection'](_0x2b7bcd[_0xdc82('0x25')],_0x2b7bcd[_0xdc82('0x22')]);_0x3ab16b[_0xdc82('0x26')]=_['intersection'](_0x2b7bcd[_0xdc82('0x25')],qs['fields'](_0x2ce2b9['query'][_0xdc82('0x27')]));_0x3ab16b[_0xdc82('0x26')]=_0x3ab16b[_0xdc82('0x26')][_0xdc82('0x28')]?_0x3ab16b[_0xdc82('0x26')]:_0x2b7bcd[_0xdc82('0x25')];if(_0x2ce2b9['query']['includeAll']){_0x3ab16b[_0xdc82('0x31')]=[{'all':!![]}];}_0x3ab16b=_[_0xdc82('0x2c')]({},_0x3ab16b,_0x2ce2b9[_0xdc82('0x2e')]);return db[_0xdc82('0x2f')][_0xdc82('0x36')](_0x3ab16b)[_0xdc82('0x12')](handleEntityNotFound(_0x4820ef,null))[_0xdc82('0x12')](respondWithResult(_0x4820ef,null))[_0xdc82('0x37')](handleError(_0x4820ef,null));};exports[_0xdc82('0x38')]=function(_0x27dbce,_0x15ed81){return db['SquareProject'][_0xdc82('0x38')](_0x27dbce['body'],{})[_0xdc82('0x12')](function(_0x521854){var _0x1d5818=_0x27dbce[_0xdc82('0x39')][_0xdc82('0x3a')]({'plain':!![]});if(!_0x1d5818)throw new Error(_0xdc82('0x3b'));if(_0x1d5818[_0xdc82('0x3c')]==='user'){var _0x4925c8=_0x521854['get']({'plain':!![]});var _0x3b1c0d=_0xdc82('0x13');return db[_0xdc82('0x3d')][_0xdc82('0x36')]({'where':{'name':_0x3b1c0d,'userProfileId':_0x1d5818[_0xdc82('0x3e')]},'raw':!![]})[_0xdc82('0x12')](function(_0x507b5b){if(_0x507b5b&&_0x507b5b['autoAssociation']===0x0){return db['UserProfileResource'][_0xdc82('0x38')]({'name':_0x4925c8[_0xdc82('0x1a')],'resourceId':_0x4925c8['id'],'type':_0x507b5b[_0xdc82('0x1a')],'sectionId':_0x507b5b['id']},{})[_0xdc82('0x12')](function(){return _0x521854;});}else{return _0x521854;}})['catch'](function(_0x388bb0){logger[_0xdc82('0x18')](_0xdc82('0x3f'),_0x388bb0);throw _0x388bb0;});}return _0x521854;})[_0xdc82('0x12')](respondWithResult(_0x15ed81,0xc9))[_0xdc82('0x37')](handleError(_0x15ed81,null));};exports['update']=function(_0x1404e0,_0x554098){if(_0x1404e0[_0xdc82('0x40')]['id']){delete _0x1404e0[_0xdc82('0x40')]['id'];}return db[_0xdc82('0x2f')][_0xdc82('0x36')]({'where':{'id':_0x1404e0[_0xdc82('0x41')]['id']}})[_0xdc82('0x12')](handleEntityNotFound(_0x554098,null))['then'](saveUpdates(_0x1404e0['body'],null))[_0xdc82('0x12')](function(_0x3a00dd){if(!_0x3a00dd)return;var _0x20e02c=_0x3a00dd['get']({'plain':!![]});return _0x20e02c;})[_0xdc82('0x12')](function(_0x2e3177){var _0x42262f=new Redis(config['redis']);_0x42262f[_0xdc82('0x42')](_0xdc82('0x16'),JSON['stringify'](_[_0xdc82('0x43')](_0x2e3177,['id','name',_0xdc82('0x44')])));return _0x2e3177;})['then'](respondWithResult(_0x554098,null))['catch'](handleError(_0x554098,null));};exports[_0xdc82('0x15')]=function(_0x3db759,_0x11dbb1){return db[_0xdc82('0x2f')][_0xdc82('0x36')]({'where':{'id':_0x3db759[_0xdc82('0x41')]['id']}})['then'](handleEntityNotFound(_0x11dbb1,null))['then'](removeEntity(_0x11dbb1,null))[_0xdc82('0x37')](handleError(_0x11dbb1,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index a0e0791..0433b98 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 _0x6d40=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SquareProject'];(function(_0x448410,_0x1f7ad5){var _0x26c76e=function(_0x259afc){while(--_0x259afc){_0x448410['push'](_0x448410['shift']());}};_0x26c76e(++_0x1f7ad5);}(_0x6d40,0x16f));var _0x06d4=function(_0x565f43,_0x50cd2c){_0x565f43=_0x565f43-0x0;var _0xf3dbac=_0x6d40[_0x565f43];return _0xf3dbac;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x06d4('0x0'))['db'][_0x06d4('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x06d4('0x2')](0x0);var events={'afterCreate':_0x06d4('0x3'),'afterUpdate':'update','afterDestroy':_0x06d4('0x4')};function emitEvent(_0x243ec5){return function(_0x483a03,_0x12181c,_0x5f41f5){SquareProjectEvents[_0x06d4('0x5')](_0x243ec5+':'+_0x483a03['id'],_0x483a03);SquareProjectEvents[_0x06d4('0x5')](_0x243ec5,_0x483a03);_0x5f41f5(null);};}for(var e in events){if(events[_0x06d4('0x6')](e)){var event=events[e];SquareProject[_0x06d4('0x7')](e,emitEvent(event));}}module[_0x06d4('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xb1c7=['hasOwnProperty','hook','events','SquareProject','save','update','remove','emit'];(function(_0x3fb247,_0x3bfd5c){var _0x68be6f=function(_0x488e4e){while(--_0x488e4e){_0x3fb247['push'](_0x3fb247['shift']());}};_0x68be6f(++_0x3bfd5c);}(_0xb1c7,0x14a));var _0x7b1c=function(_0x3c49b2,_0x285e48){_0x3c49b2=_0x3c49b2-0x0;var _0x2d9203=_0xb1c7[_0x3c49b2];return _0x2d9203;};'use strict';var EventEmitter=require(_0x7b1c('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x7b1c('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b1c('0x2'),'afterUpdate':_0x7b1c('0x3'),'afterDestroy':_0x7b1c('0x4')};function emitEvent(_0x20c906){return function(_0x253936,_0x536ff0,_0x507a7b){SquareProjectEvents[_0x7b1c('0x5')](_0x20c906+':'+_0x253936['id'],_0x253936);SquareProjectEvents[_0x7b1c('0x5')](_0x20c906,_0x253936);_0x507a7b(null);};}for(var e in events){if(events[_0x7b1c('0x6')](e)){var event=events[e];SquareProject[_0x7b1c('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 13c5768..f7f077f 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 _0x5876=['moment','request-promise','path','exports','define','SquareProject','square_projects','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x5876,0x150));var _0x6587=function(_0x389b98,_0x58b439){_0x389b98=_0x389b98-0x0;var _0x65b7c6=_0x5876[_0x389b98];return _0x65b7c6;};'use strict';var _=require(_0x6587('0x0'));var util=require(_0x6587('0x1'));var logger=require(_0x6587('0x2'))(_0x6587('0x3'));var moment=require(_0x6587('0x4'));var BPromise=require('bluebird');var rp=require(_0x6587('0x5'));var fs=require('fs');var path=require(_0x6587('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareProject.attributes');module[_0x6587('0x7')]=function(_0x16693a,_0x37a7e6){return _0x16693a[_0x6587('0x8')](_0x6587('0x9'),attributes,{'tableName':_0x6587('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a5d9a,_0x43f23b,_0x594444){if(_0x1a5d9a[_0x6587('0xb')](_0x6587('0xc'))){_0x1a5d9a['savedAt']=moment()[_0x6587('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1a5d9a[_0x6587('0xb')](_0x6587('0xe'))){_0x1a5d9a[_0x6587('0xf')]=moment()['format'](_0x6587('0x10'));}_0x594444(null,_0x1a5d9a);}}});}; \ No newline at end of file +var _0x6a2c=['preproduction','savedAt','format','production','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject','square_projects','changed'];(function(_0x5d7504,_0x2ba214){var _0x29157a=function(_0x37665d){while(--_0x37665d){_0x5d7504['push'](_0x5d7504['shift']());}};_0x29157a(++_0x2ba214);}(_0x6a2c,0x181));var _0xc6a2=function(_0x208f84,_0x3ec6f6){_0x208f84=_0x208f84-0x0;var _0x23a9b0=_0x6a2c[_0x208f84];return _0x23a9b0;};'use strict';var _=require(_0xc6a2('0x0'));var util=require(_0xc6a2('0x1'));var logger=require(_0xc6a2('0x2'))('api');var moment=require(_0xc6a2('0x3'));var BPromise=require(_0xc6a2('0x4'));var rp=require(_0xc6a2('0x5'));var fs=require('fs');var path=require(_0xc6a2('0x6'));var rimraf=require(_0xc6a2('0x7'));var config=require(_0xc6a2('0x8'));var attributes=require(_0xc6a2('0x9'));module[_0xc6a2('0xa')]=function(_0x1d2b31,_0x391b8a){return _0x1d2b31[_0xc6a2('0xb')](_0xc6a2('0xc'),attributes,{'tableName':_0xc6a2('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x407468,_0x112060,_0x557a54){if(_0x407468[_0xc6a2('0xe')](_0xc6a2('0xf'))){_0x407468[_0xc6a2('0x10')]=moment()[_0xc6a2('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x407468[_0xc6a2('0xe')](_0xc6a2('0x12'))){_0x407468['publishedAt']=moment()[_0xc6a2('0x11')](_0xc6a2('0x13'));}_0x557a54(null,_0x407468);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index edea967..a5ea2df 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 _0x8f0e=['register','GetSquareProjects','SquareProject','options','raw','where','attributes','limit','include','map','model','then','info','debug','catch','error','message','ShowSquareProject','find','stringify','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','defaults','redis','socket.io-emitter'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8f0e,0x1e4));var _0xe8f0=function(_0x3aa9b1,_0x343571){_0x3aa9b1=_0x3aa9b1-0x0;var _0x28f995=_0x8f0e[_0x3aa9b1];return _0x28f995;};'use strict';var _=require(_0xe8f0('0x0'));var Redis=require(_0xe8f0('0x1'));var db=require(_0xe8f0('0x2'))['db'];var logger=require(_0xe8f0('0x3'))(_0xe8f0('0x4'));var config=require(_0xe8f0('0x5'));config['redis']=_[_0xe8f0('0x6')](config[_0xe8f0('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xe8f0('0x8'))(new Redis(config[_0xe8f0('0x7')]));require('./squareProject.socket')[_0xe8f0('0x9')](socket);exports[_0xe8f0('0xa')]=function(_0x51f078){var _0x1243a4=this;return new Promise(function(_0x3fe82d,_0x4659ac){return db[_0xe8f0('0xb')]['findAll']({'raw':_0x51f078[_0xe8f0('0xc')]?_0x51f078[_0xe8f0('0xc')][_0xe8f0('0xd')]===undefined?!![]:![]:!![],'where':_0x51f078[_0xe8f0('0xc')]?_0x51f078[_0xe8f0('0xc')][_0xe8f0('0xe')]||null:null,'attributes':_0x51f078[_0xe8f0('0xc')]?_0x51f078[_0xe8f0('0xc')][_0xe8f0('0xf')]||null:null,'limit':_0x51f078[_0xe8f0('0xc')]?_0x51f078[_0xe8f0('0xc')][_0xe8f0('0x10')]||null:null,'include':_0x51f078[_0xe8f0('0xc')]?_0x51f078[_0xe8f0('0xc')][_0xe8f0('0x11')]?_[_0xe8f0('0x12')](_0x51f078[_0xe8f0('0xc')][_0xe8f0('0x11')],function(_0x2c5cd8){return{'model':db[_0x2c5cd8[_0xe8f0('0x13')]],'as':_0x2c5cd8['as'],'attributes':_0x2c5cd8[_0xe8f0('0xf')],'include':_0x2c5cd8[_0xe8f0('0x11')]?_['map'](_0x2c5cd8[_0xe8f0('0x11')],function(_0x4fed90){return{'model':db[_0x4fed90['model']],'as':_0x4fed90['as'],'attributes':_0x4fed90[_0xe8f0('0xf')],'include':_0x4fed90[_0xe8f0('0x11')]?_[_0xe8f0('0x12')](_0x4fed90[_0xe8f0('0x11')],function(_0x631132){return{'model':db[_0x631132[_0xe8f0('0x13')]],'as':_0x631132['as'],'attributes':_0x631132[_0xe8f0('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe8f0('0x14')](function(_0x328858){logger[_0xe8f0('0x15')](_0xe8f0('0xa'),_0x51f078);logger[_0xe8f0('0x16')](_0xe8f0('0xa'),_0x51f078,JSON['stringify'](_0x328858));_0x3fe82d(_0x328858);})[_0xe8f0('0x17')](function(_0x341aa2){logger[_0xe8f0('0x18')](_0xe8f0('0xa'),_0x341aa2[_0xe8f0('0x19')],_0x51f078);_0x4659ac(_0x1243a4[_0xe8f0('0x18')](0x1f4,_0x341aa2['message']));});});};exports[_0xe8f0('0x1a')]=function(_0x9c70c0){var _0x1d10c5=this;return new Promise(function(_0x5466e5,_0x3e7ea7){return db[_0xe8f0('0xb')][_0xe8f0('0x1b')]({'raw':_0x9c70c0[_0xe8f0('0xc')]?_0x9c70c0[_0xe8f0('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x9c70c0[_0xe8f0('0xc')]?_0x9c70c0[_0xe8f0('0xc')][_0xe8f0('0xe')]||null:null,'attributes':_0x9c70c0[_0xe8f0('0xc')]?_0x9c70c0['options']['attributes']||null:null,'include':_0x9c70c0[_0xe8f0('0xc')]?_0x9c70c0['options'][_0xe8f0('0x11')]?_[_0xe8f0('0x12')](_0x9c70c0['options']['include'],function(_0x549871){return{'model':db[_0x549871[_0xe8f0('0x13')]],'as':_0x549871['as'],'attributes':_0x549871['attributes'],'include':_0x549871[_0xe8f0('0x11')]?_['map'](_0x549871[_0xe8f0('0x11')],function(_0x1717ae){return{'model':db[_0x1717ae['model']],'as':_0x1717ae['as'],'attributes':_0x1717ae[_0xe8f0('0xf')],'include':_0x1717ae[_0xe8f0('0x11')]?_[_0xe8f0('0x12')](_0x1717ae[_0xe8f0('0x11')],function(_0x3216e2){return{'model':db[_0x3216e2['model']],'as':_0x3216e2['as'],'attributes':_0x3216e2[_0xe8f0('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe8f0('0x14')](function(_0x4720e3){logger[_0xe8f0('0x15')](_0xe8f0('0x1a'),_0x9c70c0);logger[_0xe8f0('0x16')]('ShowSquareProject',_0x9c70c0,JSON[_0xe8f0('0x1c')](_0x4720e3));_0x5466e5(_0x4720e3);})[_0xe8f0('0x17')](function(_0x555e4b){logger[_0xe8f0('0x18')](_0xe8f0('0x1a'),_0x555e4b['message'],_0x9c70c0);_0x3e7ea7(_0x1d10c5['error'](0x1f4,_0x555e4b[_0xe8f0('0x19')]));});});}; \ No newline at end of file +var _0x4c41=['then','info','debug','stringify','catch','error','message','where','ShowSquareProject','lodash','../../config/logger','rpc','redis','defaults','localhost','socket.io-emitter','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','include','map','model'];(function(_0x2003a7,_0x346b87){var _0x5e6814=function(_0x55256d){while(--_0x55256d){_0x2003a7['push'](_0x2003a7['shift']());}};_0x5e6814(++_0x346b87);}(_0x4c41,0xd9));var _0x14c4=function(_0x3ba486,_0x3a02a8){_0x3ba486=_0x3ba486-0x0;var _0x30cd00=_0x4c41[_0x3ba486];return _0x30cd00;};'use strict';var _=require(_0x14c4('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0x14c4('0x1'))(_0x14c4('0x2'));var config=require('../../config/environment');config[_0x14c4('0x3')]=_[_0x14c4('0x4')](config[_0x14c4('0x3')],{'host':_0x14c4('0x5'),'port':0x18eb});var socket=require(_0x14c4('0x6'))(new Redis(config[_0x14c4('0x3')]));require('./squareProject.socket')['register'](socket);exports[_0x14c4('0x7')]=function(_0x400ee1){var _0xabd90b=this;return new Promise(function(_0x3e462a,_0x2e8c3c){return db[_0x14c4('0x8')][_0x14c4('0x9')]({'raw':_0x400ee1[_0x14c4('0xa')]?_0x400ee1['options'][_0x14c4('0xb')]===undefined?!![]:![]:!![],'where':_0x400ee1['options']?_0x400ee1['options']['where']||null:null,'attributes':_0x400ee1[_0x14c4('0xa')]?_0x400ee1[_0x14c4('0xa')][_0x14c4('0xc')]||null:null,'limit':_0x400ee1[_0x14c4('0xa')]?_0x400ee1['options'][_0x14c4('0xd')]||null:null,'include':_0x400ee1[_0x14c4('0xa')]?_0x400ee1[_0x14c4('0xa')][_0x14c4('0xe')]?_[_0x14c4('0xf')](_0x400ee1[_0x14c4('0xa')][_0x14c4('0xe')],function(_0x41f41a){return{'model':db[_0x41f41a['model']],'as':_0x41f41a['as'],'attributes':_0x41f41a[_0x14c4('0xc')],'include':_0x41f41a[_0x14c4('0xe')]?_[_0x14c4('0xf')](_0x41f41a[_0x14c4('0xe')],function(_0x4fde7f){return{'model':db[_0x4fde7f['model']],'as':_0x4fde7f['as'],'attributes':_0x4fde7f[_0x14c4('0xc')],'include':_0x4fde7f[_0x14c4('0xe')]?_[_0x14c4('0xf')](_0x4fde7f['include'],function(_0x305057){return{'model':db[_0x305057[_0x14c4('0x10')]],'as':_0x305057['as'],'attributes':_0x305057['attributes']};}):[]};}):[]};}):[]:[]})[_0x14c4('0x11')](function(_0x5b3312){logger[_0x14c4('0x12')]('GetSquareProjects',_0x400ee1);logger[_0x14c4('0x13')](_0x14c4('0x7'),_0x400ee1,JSON[_0x14c4('0x14')](_0x5b3312));_0x3e462a(_0x5b3312);})[_0x14c4('0x15')](function(_0x532b95){logger[_0x14c4('0x16')](_0x14c4('0x7'),_0x532b95[_0x14c4('0x17')],_0x400ee1);_0x2e8c3c(_0xabd90b[_0x14c4('0x16')](0x1f4,_0x532b95[_0x14c4('0x17')]));});});};exports['ShowSquareProject']=function(_0xdd5f13){var _0x381bd3=this;return new Promise(function(_0xd446fa,_0xf2adc){return db[_0x14c4('0x8')]['find']({'raw':_0xdd5f13[_0x14c4('0xa')]?_0xdd5f13['options'][_0x14c4('0xb')]===undefined?!![]:![]:!![],'where':_0xdd5f13[_0x14c4('0xa')]?_0xdd5f13[_0x14c4('0xa')][_0x14c4('0x18')]||null:null,'attributes':_0xdd5f13[_0x14c4('0xa')]?_0xdd5f13['options']['attributes']||null:null,'include':_0xdd5f13[_0x14c4('0xa')]?_0xdd5f13[_0x14c4('0xa')][_0x14c4('0xe')]?_[_0x14c4('0xf')](_0xdd5f13[_0x14c4('0xa')][_0x14c4('0xe')],function(_0x293302){return{'model':db[_0x293302[_0x14c4('0x10')]],'as':_0x293302['as'],'attributes':_0x293302[_0x14c4('0xc')],'include':_0x293302[_0x14c4('0xe')]?_[_0x14c4('0xf')](_0x293302[_0x14c4('0xe')],function(_0xb64bd9){return{'model':db[_0xb64bd9[_0x14c4('0x10')]],'as':_0xb64bd9['as'],'attributes':_0xb64bd9[_0x14c4('0xc')],'include':_0xb64bd9[_0x14c4('0xe')]?_['map'](_0xb64bd9[_0x14c4('0xe')],function(_0x3fe41a){return{'model':db[_0x3fe41a[_0x14c4('0x10')]],'as':_0x3fe41a['as'],'attributes':_0x3fe41a['attributes']};}):[]};}):[]};}):[]:[]})[_0x14c4('0x11')](function(_0x3efe03){logger['info'](_0x14c4('0x19'),_0xdd5f13);logger['debug'](_0x14c4('0x19'),_0xdd5f13,JSON[_0x14c4('0x14')](_0x3efe03));_0xd446fa(_0x3efe03);})[_0x14c4('0x15')](function(_0x147c30){logger['error'](_0x14c4('0x19'),_0x147c30[_0x14c4('0x17')],_0xdd5f13);_0xf2adc(_0x381bd3[_0x14c4('0x16')](0x1f4,_0x147c30[_0x14c4('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index ac67764..cd1ff58 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 _0x53c9=['remove','update','register','squareProject:','save'];(function(_0x487e1a,_0x30a59a){var _0x517231=function(_0x1db838){while(--_0x1db838){_0x487e1a['push'](_0x487e1a['shift']());}};_0x517231(++_0x30a59a);}(_0x53c9,0x1cb));var _0x953c=function(_0x2e0876,_0x676cc1){_0x2e0876=_0x2e0876-0x0;var _0x6be532=_0x53c9[_0x2e0876];return _0x6be532;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x953c('0x0'),_0x953c('0x1'),_0x953c('0x2')];function createListener(_0x1b3020,_0x2296ab){return function(_0x110e6f){_0x2296ab['emit'](_0x1b3020,_0x110e6f);};}function removeListener(_0x381152,_0x36fbdf){return function(){SquareProjectEvents['removeListener'](_0x381152,_0x36fbdf);};}exports[_0x953c('0x3')]=function(_0x19fb1a){for(var _0x45c248=0x0,_0x29a5a8=events['length'];_0x45c248<_0x29a5a8;_0x45c248++){var _0x2391bc=events[_0x45c248];var _0x35387e=createListener(_0x953c('0x4')+_0x2391bc,_0x19fb1a);SquareProjectEvents['on'](_0x2391bc,_0x35387e);}}; \ No newline at end of file +var _0x9ad9=['update','emit','removeListener','register','length','squareProject:','save','remove'];(function(_0xf4ee31,_0x5895c2){var _0x14bd89=function(_0x2a5f3d){while(--_0x2a5f3d){_0xf4ee31['push'](_0xf4ee31['shift']());}};_0x14bd89(++_0x5895c2);}(_0x9ad9,0x1e6));var _0x99ad=function(_0x417774,_0x1b95e6){_0x417774=_0x417774-0x0;var _0x10015d=_0x9ad9[_0x417774];return _0x10015d;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x99ad('0x0'),_0x99ad('0x1'),_0x99ad('0x2')];function createListener(_0xebb640,_0x2e059f){return function(_0x1c96bf){_0x2e059f[_0x99ad('0x3')](_0xebb640,_0x1c96bf);};}function removeListener(_0x45d201,_0x44892d){return function(){SquareProjectEvents[_0x99ad('0x4')](_0x45d201,_0x44892d);};}exports[_0x99ad('0x5')]=function(_0x2f5832){for(var _0x20d011=0x0,_0x5cdc39=events[_0x99ad('0x6')];_0x20d011<_0x5cdc39;_0x20d011++){var _0x5bd39f=events[_0x20d011];var _0x48747f=createListener(_0x99ad('0x7')+_0x5bd39f,_0x2f5832);SquareProjectEvents['on'](_0x5bd39f,_0x48747f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 7171baa..eae9c02 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 _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3c78d6,_0x2b37fd){var _0x22f1ce=function(_0x1325f5){while(--_0x1325f5){_0x3c78d6['push'](_0x3c78d6['shift']());}};_0x22f1ce(++_0x2b37fd);}(_0x4975,0x86));var _0x5497=function(_0x3f59a8,_0x4569d6){_0x3f59a8=_0x3f59a8-0x0;var _0x1a84de=_0x4975[_0x3f59a8];return _0x1a84de;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0xf39cf7,_0x4cfc3f){var _0x5cb052=function(_0x1b3ed0){while(--_0x1b3ed0){_0xf39cf7['push'](_0xf39cf7['shift']());}};_0x5cb052(++_0x4cfc3f);}(_0x53ec,0x192));var _0xc53e=function(_0x56e2ed,_0x1c4781){_0x56e2ed=_0x56e2ed-0x0;var _0x5237b2=_0x53ec[_0x56e2ed];return _0x5237b2;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0b93a31..32ef062 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 _0xac31=['STRING','VIRTUAL','savePath','lastIndexOf','sequelize','exports'];(function(_0x2af11a,_0x443532){var _0x40d52e=function(_0xcfe7b2){while(--_0xcfe7b2){_0x2af11a['push'](_0x2af11a['shift']());}};_0x40d52e(++_0x443532);}(_0xac31,0xca));var _0x1ac3=function(_0x37d588,_0x5a48c7){_0x37d588=_0x37d588-0x0;var _0x39ff79=_0xac31[_0x37d588];return _0x39ff79;};'use strict';var Sequelize=require(_0x1ac3('0x0'));module[_0x1ac3('0x1')]={'uniqueid':{'type':Sequelize[_0x1ac3('0x2')]},'callerid':{'type':Sequelize[_0x1ac3('0x2')]},'calleridname':{'type':Sequelize[_0x1ac3('0x2')]},'context':{'type':Sequelize[_0x1ac3('0x2')]},'extension':{'type':Sequelize[_0x1ac3('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x1ac3('0x2')]},'dnid':{'type':Sequelize[_0x1ac3('0x2')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x1ac3('0x2')]},'savePath':{'type':Sequelize[_0x1ac3('0x2')]},'format':{'type':Sequelize[_0x1ac3('0x3')],'get':function(){var _0x1be223='';var _0x157604=this['getDataValue'](_0x1ac3('0x4'));if(_0x157604){_0x1be223=_0x157604['substring'](_0x157604[_0x1ac3('0x5')]('.'));}return _0x1be223;}}}; \ No newline at end of file +var _0xb138=['getDataValue','substring','lastIndexOf','sequelize','exports','STRING'];(function(_0x1f35bd,_0x35d637){var _0x26a4ca=function(_0x13e7ad){while(--_0x13e7ad){_0x1f35bd['push'](_0x1f35bd['shift']());}};_0x26a4ca(++_0x35d637);}(_0xb138,0x1dd));var _0x8b13=function(_0x25d6ba,_0x401011){_0x25d6ba=_0x25d6ba-0x0;var _0x1b2b44=_0xb138[_0x25d6ba];return _0x1b2b44;};'use strict';var Sequelize=require(_0x8b13('0x0'));module[_0x8b13('0x1')]={'uniqueid':{'type':Sequelize[_0x8b13('0x2')]},'callerid':{'type':Sequelize[_0x8b13('0x2')]},'calleridname':{'type':Sequelize[_0x8b13('0x2')]},'context':{'type':Sequelize[_0x8b13('0x2')]},'extension':{'type':Sequelize[_0x8b13('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x8b13('0x2')]},'dnid':{'type':Sequelize[_0x8b13('0x2')]},'projectName':{'type':Sequelize[_0x8b13('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x8b13('0x2')]},'savePath':{'type':Sequelize[_0x8b13('0x2')]},'format':{'type':Sequelize['VIRTUAL'],'get':function(){var _0x3fdf4d='';var _0x33d1a7=this[_0x8b13('0x3')]('savePath');if(_0x33d1a7){_0x3fdf4d=_0x33d1a7[_0x8b13('0x4')](_0x33d1a7[_0x8b13('0x5')]('.'));}return _0x3fdf4d;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f3b5247..a409ee9 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 _0x68de=['path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','SquareRecording','includeAll','findAll','catch','show','params','keys','find','create','body','update','download','uniqueid','savePath','filename','format','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x4ccde2,_0x31bfb9){var _0x1e011d=function(_0x17bb70){while(--_0x17bb70){_0x4ccde2['push'](_0x4ccde2['shift']());}};_0x1e011d(++_0x31bfb9);}(_0x68de,0x1e6));var _0xe68d=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x68de[_0x3fba9f];return _0x192cf1;};'use strict';var emlformat=require(_0xe68d('0x0'));var rimraf=require(_0xe68d('0x1'));var zipdir=require(_0xe68d('0x2'));var jsonpatch=require(_0xe68d('0x3'));var rp=require(_0xe68d('0x4'));var moment=require(_0xe68d('0x5'));var BPromise=require(_0xe68d('0x6'));var Mustache=require(_0xe68d('0x7'));var util=require(_0xe68d('0x8'));var path=require(_0xe68d('0x9'));var sox=require(_0xe68d('0xa'));var csv=require(_0xe68d('0xb'));var ejs=require(_0xe68d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe68d('0xd'));var squel=require('squel');var crypto=require(_0xe68d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xe68d('0xf'));var toCsv=require(_0xe68d('0xb'));var querystring=require(_0xe68d('0x10'));var Papa=require(_0xe68d('0x11'));var Redis=require('ioredis');var authService=require(_0xe68d('0x12'));var qs=require(_0xe68d('0x13'));var as=require(_0xe68d('0x14'));var hardwareService=require(_0xe68d('0x15'));var logger=require(_0xe68d('0x16'))(_0xe68d('0x17'));var utils=require(_0xe68d('0x18'));var config=require(_0xe68d('0x19'));var licenseUtil=require(_0xe68d('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x29457f,_0x44aba3){_0x44aba3=_0x44aba3||0xcc;return function(_0x5127d2){if(_0x5127d2){return _0x29457f[_0xe68d('0x1b')](_0x44aba3);}return _0x29457f['status'](_0x44aba3)[_0xe68d('0x1c')]();};}function respondWithResult(_0x2f407c,_0x28c883){_0x28c883=_0x28c883||0xc8;return function(_0x53742e){if(_0x53742e){return _0x2f407c[_0xe68d('0x1d')](_0x28c883)[_0xe68d('0x1e')](_0x53742e);}};}function respondWithFilteredResult(_0x1fb70e,_0x4755f8){return function(_0xe317cc){if(_0xe317cc){var _0x7c7f7d=typeof _0x4755f8[_0xe68d('0x1f')]==='undefined'&&typeof _0x4755f8[_0xe68d('0x20')]===_0xe68d('0x21');var _0x5a9763=_0xe317cc[_0xe68d('0x22')];var _0xf9e76=_0x7c7f7d?0x0:_0x4755f8[_0xe68d('0x1f')];var _0x294a2a=_0x7c7f7d?_0xe317cc['count']:_0x4755f8[_0xe68d('0x1f')]+_0x4755f8[_0xe68d('0x20')];var _0x55fe2;if(_0x294a2a>=_0x5a9763){_0x294a2a=_0x5a9763;_0x55fe2=0xc8;}else{_0x55fe2=0xce;}_0x1fb70e['status'](_0x55fe2);return _0x1fb70e[_0xe68d('0x23')](_0xe68d('0x24'),_0xf9e76+'-'+_0x294a2a+'/'+_0x5a9763)['json'](_0xe317cc);}return null;};}function patchUpdates(_0xe3e555){return function(_0x4dce92){try{jsonpatch[_0xe68d('0x25')](_0x4dce92,_0xe3e555,!![]);}catch(_0x197816){return BPromise[_0xe68d('0x26')](_0x197816);}return _0x4dce92[_0xe68d('0x27')]();};}function saveUpdates(_0x146d26,_0x48097c){return function(_0x1e246d){if(_0x1e246d){return _0x1e246d['update'](_0x146d26)[_0xe68d('0x28')](function(_0x22ac83){return _0x22ac83;});}return null;};}function removeEntity(_0x25c08e,_0x362362){return function(_0x4573de){if(_0x4573de){return _0x4573de[_0xe68d('0x29')]()[_0xe68d('0x28')](function(){_0x25c08e[_0xe68d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b39ae,_0x15e2e7){return function(_0x1756a7){if(!_0x1756a7){_0x2b39ae[_0xe68d('0x1b')](0x194);}return _0x1756a7;};}function handleError(_0x22d71f,_0x1ebc25){_0x1ebc25=_0x1ebc25||0x1f4;return function(_0x470f5e){logger[_0xe68d('0x2a')](_0x470f5e['stack']);if(_0x470f5e[_0xe68d('0x2b')]){delete _0x470f5e[_0xe68d('0x2b')];}_0x22d71f[_0xe68d('0x1d')](_0x1ebc25)[_0xe68d('0x2c')](_0x470f5e);};}exports['index']=function(_0x3f2b66,_0x1aadce){var _0x65f9df={},_0x2978c7={},_0x44f9b5={'count':0x0,'rows':[]};var _0x3d6705=_[_0xe68d('0x2d')](db['SquareRecording'][_0xe68d('0x2e')],function(_0x6bb11d){return{'name':_0x6bb11d[_0xe68d('0x2f')],'type':_0x6bb11d[_0xe68d('0x30')][_0xe68d('0x31')]};});_0x2978c7[_0xe68d('0x32')]=_[_0xe68d('0x2d')](_0x3d6705,_0xe68d('0x2b'));_0x2978c7[_0xe68d('0x33')]=_['keys'](_0x3f2b66[_0xe68d('0x33')]);_0x2978c7[_0xe68d('0x34')]=_[_0xe68d('0x35')](_0x2978c7[_0xe68d('0x32')],_0x2978c7[_0xe68d('0x33')]);_0x65f9df[_0xe68d('0x36')]=_[_0xe68d('0x35')](_0x2978c7[_0xe68d('0x32')],qs['fields'](_0x3f2b66[_0xe68d('0x33')][_0xe68d('0x37')]));_0x65f9df[_0xe68d('0x36')]=_0x65f9df[_0xe68d('0x36')][_0xe68d('0x38')]?_0x65f9df[_0xe68d('0x36')]:_0x2978c7[_0xe68d('0x32')];if(!_0x3f2b66[_0xe68d('0x33')][_0xe68d('0x39')]('nolimit')){_0x65f9df[_0xe68d('0x20')]=qs[_0xe68d('0x20')](_0x3f2b66['query'][_0xe68d('0x20')]);_0x65f9df['offset']=qs[_0xe68d('0x1f')](_0x3f2b66[_0xe68d('0x33')][_0xe68d('0x1f')]);}_0x65f9df['order']=qs[_0xe68d('0x3a')](_0x3f2b66[_0xe68d('0x33')][_0xe68d('0x3a')]);_0x65f9df[_0xe68d('0x3b')]=qs['filters'](_[_0xe68d('0x3c')](_0x3f2b66[_0xe68d('0x33')],_0x2978c7['filters']),_0x3d6705);if(_0x3f2b66[_0xe68d('0x33')]['filter']){_0x65f9df[_0xe68d('0x3b')]=_[_0xe68d('0x3d')](_0x65f9df[_0xe68d('0x3b')],{'$or':_[_0xe68d('0x2d')](_0x3d6705,function(_0x1dcaf0){if(_0x1dcaf0[_0xe68d('0x30')]!==_0xe68d('0x3e')){var _0x3b21b1={};_0x3b21b1[_0x1dcaf0[_0xe68d('0x2b')]]={'$like':'%'+_0x3f2b66[_0xe68d('0x33')][_0xe68d('0x3f')]+'%'};return _0x3b21b1;}})});}_0x65f9df=_[_0xe68d('0x3d')]({},_0x65f9df,_0x3f2b66[_0xe68d('0x40')]);var _0x103003={'where':_0x65f9df[_0xe68d('0x3b')]};return db[_0xe68d('0x41')][_0xe68d('0x22')](_0x103003)['then'](function(_0x12c539){_0x44f9b5[_0xe68d('0x22')]=_0x12c539;if(_0x3f2b66[_0xe68d('0x33')][_0xe68d('0x42')]){_0x65f9df['include']=[{'all':!![]}];}return db[_0xe68d('0x41')][_0xe68d('0x43')](_0x65f9df);})['then'](function(_0x13a338){_0x44f9b5['rows']=_0x13a338;return _0x44f9b5;})['then'](respondWithFilteredResult(_0x1aadce,_0x65f9df))[_0xe68d('0x44')](handleError(_0x1aadce,null));};exports[_0xe68d('0x45')]=function(_0x36a237,_0x33c7a0){var _0x3b157e={'raw':!![],'where':{'id':_0x36a237[_0xe68d('0x46')]['id']}},_0x490785={};_0x490785[_0xe68d('0x32')]=_[_0xe68d('0x47')](db[_0xe68d('0x41')][_0xe68d('0x2e')]);_0x490785['query']=_['keys'](_0x36a237[_0xe68d('0x33')]);_0x490785[_0xe68d('0x34')]=_['intersection'](_0x490785[_0xe68d('0x32')],_0x490785[_0xe68d('0x33')]);_0x3b157e[_0xe68d('0x36')]=_[_0xe68d('0x35')](_0x490785[_0xe68d('0x32')],qs[_0xe68d('0x37')](_0x36a237[_0xe68d('0x33')][_0xe68d('0x37')]));_0x3b157e['attributes']=_0x3b157e['attributes'][_0xe68d('0x38')]?_0x3b157e[_0xe68d('0x36')]:_0x490785[_0xe68d('0x32')];if(_0x36a237['query'][_0xe68d('0x42')]){_0x3b157e['include']=[{'all':!![]}];}_0x3b157e=_[_0xe68d('0x3d')]({},_0x3b157e,_0x36a237['options']);return db['SquareRecording'][_0xe68d('0x48')](_0x3b157e)[_0xe68d('0x28')](handleEntityNotFound(_0x33c7a0,null))[_0xe68d('0x28')](respondWithResult(_0x33c7a0,null))[_0xe68d('0x44')](handleError(_0x33c7a0,null));};exports[_0xe68d('0x49')]=function(_0x50f051,_0x3de98a){return db[_0xe68d('0x41')][_0xe68d('0x49')](_0x50f051[_0xe68d('0x4a')],{})[_0xe68d('0x28')](respondWithResult(_0x3de98a,0xc9))['catch'](handleError(_0x3de98a,null));};exports[_0xe68d('0x4b')]=function(_0x56b4a5,_0x164deb){if(_0x56b4a5['body']['id']){delete _0x56b4a5[_0xe68d('0x4a')]['id'];}return db[_0xe68d('0x41')][_0xe68d('0x48')]({'where':{'id':_0x56b4a5['params']['id']}})['then'](handleEntityNotFound(_0x164deb,null))['then'](saveUpdates(_0x56b4a5[_0xe68d('0x4a')],null))[_0xe68d('0x28')](respondWithResult(_0x164deb,null))[_0xe68d('0x44')](handleError(_0x164deb,null));};exports[_0xe68d('0x4c')]=function(_0x138953,_0xdf615a,_0x30f624){var _0x136bcc=require('../../components/encryptor');var _0x2a6db2=![];var _0x1bf3e3={};if(_0x138953[_0xe68d('0x33')]['type']&&_0x138953[_0xe68d('0x33')][_0xe68d('0x30')]===_0xe68d('0x4d')){_0x1bf3e3[_0xe68d('0x4d')]=_0x138953[_0xe68d('0x46')]['id'];}else{_0x1bf3e3['id']=_0x138953[_0xe68d('0x46')]['id'];}return db[_0xe68d('0x41')][_0xe68d('0x48')]({'where':_0x1bf3e3,'attributes':['id',_0xe68d('0x4e'),_0xe68d('0x4f')],'raw':!![]})[_0xe68d('0x28')](handleEntityNotFound(_0xdf615a,null))[_0xe68d('0x28')](function(_0x4c16fc){if(_0x4c16fc){var _0x4ff148=_0x4c16fc[_0xe68d('0x4e')];var _0x2ea07e=util[_0xe68d('0x50')]('%s.cypher',_0x4ff148);if(fs['existsSync'](_0x2ea07e)){_0x2a6db2=!![];return _0x136bcc[_0xe68d('0x51')](_0x2ea07e,_0x4ff148,config[_0xe68d('0x52')][_0xe68d('0x53')])[_0xe68d('0x28')](function(){return _0x4c16fc;});}return _0x4c16fc;}})[_0xe68d('0x28')](function(_0x5541fe){if(_0x5541fe){var _0x5cf524=_0x5541fe[_0xe68d('0x4e')];if(!fs[_0xe68d('0x54')](_0x5cf524)){throw new db[(_0xe68d('0x55'))][(_0xe68d('0x56'))]('SquareRecording\x20not\x20found');}if(_0x5541fe[_0xe68d('0x4f')]){return _0xdf615a['download'](_0x5cf524,_0x5541fe[_0xe68d('0x4f')]+path[_0xe68d('0x57')](_0x5cf524),function(){if(_0x2a6db2){fs[_0xe68d('0x58')](_0x5cf524);}});}else{return _0xdf615a[_0xe68d('0x4c')](_0x5cf524,function(_0x4a01d9){if(_0x2a6db2){fs['unlink'](_0x5cf524);}});}}})['catch'](function(_0x593594){if(_0x593594[_0xe68d('0x59')]===_0xe68d('0x5a')){_0xdf615a['status'](0x194)['send'](_0xe68d('0x5b'));}else{return handleError(_0xdf615a,null);}});};exports[_0xe68d('0x29')]=function(_0x599a43,_0x4d3240){return db[_0xe68d('0x41')][_0xe68d('0x48')]({'where':{'id':_0x599a43[_0xe68d('0x46')]['id']}})[_0xe68d('0x28')](function(_0x3346e3){if(_[_0xe68d('0x5c')](_0x3346e3)){throw new ReferenceError(_0xe68d('0x5d'));}return _0x3346e3;})['then'](function(_0x3acc2f){var _0x35a184=_0x3acc2f['savePath'];logger[_0xe68d('0x5e')](_0xe68d('0x5f'),_0x35a184);if(!_[_0xe68d('0x5c')](_0x3acc2f[_0xe68d('0x4e')])&&fs[_0xe68d('0x54')](_0x35a184)){logger['info']('File:\x20\x22'+_0x35a184+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe68d('0x60')](_0x35a184);}_0x35a184=_0x35a184+'.cypher';if(!_[_0xe68d('0x5c')](_0x3acc2f[_0xe68d('0x4e')])&&fs[_0xe68d('0x54')](_0x35a184)){logger[_0xe68d('0x5e')](_0xe68d('0x61')+_0x35a184+_0xe68d('0x62'));fs[_0xe68d('0x60')](_0x35a184);}return _0x3acc2f;})[_0xe68d('0x28')](function(_0x484e3f){if(!_0x484e3f)throw new InternalError();return _0x484e3f['destroy']();})[_0xe68d('0x28')](function(){_0x4d3240['status'](0xcc)[_0xe68d('0x1c')]();})[_0xe68d('0x44')](handleError(_0x4d3240,null));}; \ No newline at end of file +var _0xabc6=['show','params','find','catch','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','download','message','isNil','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','reject','save','destroy','then','stack','send','index','map','rawAttributes','fieldName','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','include','SquareRecording','findAll','rows'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xabc6,0x19e));var _0x6abc=function(_0x28be72,_0x2b83af){_0x28be72=_0x28be72-0x0;var _0x46c5da=_0xabc6[_0x28be72];return _0x46c5da;};'use strict';var emlformat=require(_0x6abc('0x0'));var rimraf=require(_0x6abc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6abc('0x2'));var rp=require(_0x6abc('0x3'));var moment=require(_0x6abc('0x4'));var BPromise=require(_0x6abc('0x5'));var Mustache=require(_0x6abc('0x6'));var util=require('util');var path=require(_0x6abc('0x7'));var sox=require(_0x6abc('0x8'));var csv=require(_0x6abc('0x9'));var ejs=require(_0x6abc('0xa'));var fs=require('fs');var fs_extra=require(_0x6abc('0xb'));var _=require(_0x6abc('0xc'));var squel=require('squel');var crypto=require(_0x6abc('0xd'));var jsforce=require(_0x6abc('0xe'));var deskjs=require(_0x6abc('0xf'));var toCsv=require(_0x6abc('0x9'));var querystring=require(_0x6abc('0x10'));var Papa=require(_0x6abc('0x11'));var Redis=require(_0x6abc('0x12'));var authService=require(_0x6abc('0x13'));var qs=require(_0x6abc('0x14'));var as=require(_0x6abc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6abc('0x16'))(_0x6abc('0x17'));var utils=require(_0x6abc('0x18'));var config=require(_0x6abc('0x19'));var licenseUtil=require(_0x6abc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5286c5,_0x119046){_0x119046=_0x119046||0xcc;return function(_0x371840){if(_0x371840){return _0x5286c5[_0x6abc('0x1b')](_0x119046);}return _0x5286c5[_0x6abc('0x1c')](_0x119046)[_0x6abc('0x1d')]();};}function respondWithResult(_0x3cff53,_0x38fb2e){_0x38fb2e=_0x38fb2e||0xc8;return function(_0x1103b8){if(_0x1103b8){return _0x3cff53['status'](_0x38fb2e)[_0x6abc('0x1e')](_0x1103b8);}};}function respondWithFilteredResult(_0x4cebcc,_0x21a613){return function(_0x17e9ea){if(_0x17e9ea){var _0x5a4f5f=typeof _0x21a613['offset']===_0x6abc('0x1f')&&typeof _0x21a613[_0x6abc('0x20')]==='undefined';var _0x1abc51=_0x17e9ea['count'];var _0xe75e1a=_0x5a4f5f?0x0:_0x21a613[_0x6abc('0x21')];var _0x4d6bbc=_0x5a4f5f?_0x17e9ea['count']:_0x21a613[_0x6abc('0x21')]+_0x21a613[_0x6abc('0x20')];var _0x50031d;if(_0x4d6bbc>=_0x1abc51){_0x4d6bbc=_0x1abc51;_0x50031d=0xc8;}else{_0x50031d=0xce;}_0x4cebcc[_0x6abc('0x1c')](_0x50031d);return _0x4cebcc[_0x6abc('0x22')](_0x6abc('0x23'),_0xe75e1a+'-'+_0x4d6bbc+'/'+_0x1abc51)[_0x6abc('0x1e')](_0x17e9ea);}return null;};}function patchUpdates(_0x5f033d){return function(_0xb5e650){try{jsonpatch['apply'](_0xb5e650,_0x5f033d,!![]);}catch(_0x45b92c){return BPromise[_0x6abc('0x24')](_0x45b92c);}return _0xb5e650[_0x6abc('0x25')]();};}function saveUpdates(_0x328ab5,_0x4d5bd1){return function(_0x3339b5){if(_0x3339b5){return _0x3339b5['update'](_0x328ab5)['then'](function(_0xab992f){return _0xab992f;});}return null;};}function removeEntity(_0x58dffb,_0x1f2eb8){return function(_0x2205c8){if(_0x2205c8){return _0x2205c8[_0x6abc('0x26')]()[_0x6abc('0x27')](function(){_0x58dffb[_0x6abc('0x1c')](0xcc)[_0x6abc('0x1d')]();});}};}function handleEntityNotFound(_0x51bdf1,_0x4dcf1a){return function(_0x1fa15c){if(!_0x1fa15c){_0x51bdf1[_0x6abc('0x1b')](0x194);}return _0x1fa15c;};}function handleError(_0x4bc97e,_0x254cf6){_0x254cf6=_0x254cf6||0x1f4;return function(_0x29c373){logger['error'](_0x29c373[_0x6abc('0x28')]);if(_0x29c373['name']){delete _0x29c373['name'];}_0x4bc97e[_0x6abc('0x1c')](_0x254cf6)[_0x6abc('0x29')](_0x29c373);};}exports[_0x6abc('0x2a')]=function(_0x4f51fd,_0x1de8f8){var _0xa39a34={},_0x8c515d={},_0x546636={'count':0x0,'rows':[]};var _0x2df3a9=_[_0x6abc('0x2b')](db['SquareRecording'][_0x6abc('0x2c')],function(_0x5bdbf3){return{'name':_0x5bdbf3[_0x6abc('0x2d')],'type':_0x5bdbf3['type'][_0x6abc('0x2e')]};});_0x8c515d[_0x6abc('0x2f')]=_[_0x6abc('0x2b')](_0x2df3a9,_0x6abc('0x30'));_0x8c515d['query']=_[_0x6abc('0x31')](_0x4f51fd[_0x6abc('0x32')]);_0x8c515d[_0x6abc('0x33')]=_[_0x6abc('0x34')](_0x8c515d[_0x6abc('0x2f')],_0x8c515d[_0x6abc('0x32')]);_0xa39a34[_0x6abc('0x35')]=_[_0x6abc('0x34')](_0x8c515d[_0x6abc('0x2f')],qs[_0x6abc('0x36')](_0x4f51fd['query'][_0x6abc('0x36')]));_0xa39a34[_0x6abc('0x35')]=_0xa39a34[_0x6abc('0x35')][_0x6abc('0x37')]?_0xa39a34[_0x6abc('0x35')]:_0x8c515d[_0x6abc('0x2f')];if(!_0x4f51fd[_0x6abc('0x32')][_0x6abc('0x38')](_0x6abc('0x39'))){_0xa39a34['limit']=qs['limit'](_0x4f51fd['query']['limit']);_0xa39a34[_0x6abc('0x21')]=qs[_0x6abc('0x21')](_0x4f51fd[_0x6abc('0x32')][_0x6abc('0x21')]);}_0xa39a34['order']=qs[_0x6abc('0x3a')](_0x4f51fd[_0x6abc('0x32')][_0x6abc('0x3a')]);_0xa39a34[_0x6abc('0x3b')]=qs[_0x6abc('0x33')](_[_0x6abc('0x3c')](_0x4f51fd[_0x6abc('0x32')],_0x8c515d[_0x6abc('0x33')]),_0x2df3a9);if(_0x4f51fd['query'][_0x6abc('0x3d')]){_0xa39a34[_0x6abc('0x3b')]=_[_0x6abc('0x3e')](_0xa39a34[_0x6abc('0x3b')],{'$or':_[_0x6abc('0x2b')](_0x2df3a9,function(_0x38e7db){if(_0x38e7db[_0x6abc('0x3f')]!=='VIRTUAL'){var _0x120e89={};_0x120e89[_0x38e7db[_0x6abc('0x30')]]={'$like':'%'+_0x4f51fd[_0x6abc('0x32')][_0x6abc('0x3d')]+'%'};return _0x120e89;}})});}_0xa39a34=_[_0x6abc('0x3e')]({},_0xa39a34,_0x4f51fd[_0x6abc('0x40')]);var _0x166bae={'where':_0xa39a34[_0x6abc('0x3b')]};return db['SquareRecording'][_0x6abc('0x41')](_0x166bae)['then'](function(_0x11abe1){_0x546636['count']=_0x11abe1;if(_0x4f51fd[_0x6abc('0x32')][_0x6abc('0x42')]){_0xa39a34[_0x6abc('0x43')]=[{'all':!![]}];}return db[_0x6abc('0x44')][_0x6abc('0x45')](_0xa39a34);})[_0x6abc('0x27')](function(_0xe2d4be){_0x546636[_0x6abc('0x46')]=_0xe2d4be;return _0x546636;})['then'](respondWithFilteredResult(_0x1de8f8,_0xa39a34))['catch'](handleError(_0x1de8f8,null));};exports[_0x6abc('0x47')]=function(_0x5293a6,_0x1cd06d){var _0x22554a={'raw':!![],'where':{'id':_0x5293a6[_0x6abc('0x48')]['id']}},_0x4c61ff={};_0x4c61ff[_0x6abc('0x2f')]=_[_0x6abc('0x31')](db['SquareRecording'][_0x6abc('0x2c')]);_0x4c61ff[_0x6abc('0x32')]=_[_0x6abc('0x31')](_0x5293a6['query']);_0x4c61ff[_0x6abc('0x33')]=_[_0x6abc('0x34')](_0x4c61ff['model'],_0x4c61ff[_0x6abc('0x32')]);_0x22554a['attributes']=_[_0x6abc('0x34')](_0x4c61ff['model'],qs['fields'](_0x5293a6[_0x6abc('0x32')][_0x6abc('0x36')]));_0x22554a[_0x6abc('0x35')]=_0x22554a[_0x6abc('0x35')][_0x6abc('0x37')]?_0x22554a[_0x6abc('0x35')]:_0x4c61ff['model'];if(_0x5293a6[_0x6abc('0x32')]['includeAll']){_0x22554a['include']=[{'all':!![]}];}_0x22554a=_[_0x6abc('0x3e')]({},_0x22554a,_0x5293a6[_0x6abc('0x40')]);return db[_0x6abc('0x44')][_0x6abc('0x49')](_0x22554a)[_0x6abc('0x27')](handleEntityNotFound(_0x1cd06d,null))[_0x6abc('0x27')](respondWithResult(_0x1cd06d,null))[_0x6abc('0x4a')](handleError(_0x1cd06d,null));};exports[_0x6abc('0x4b')]=function(_0x40e3cc,_0x380e21){return db['SquareRecording'][_0x6abc('0x4b')](_0x40e3cc[_0x6abc('0x4c')],{})['then'](respondWithResult(_0x380e21,0xc9))[_0x6abc('0x4a')](handleError(_0x380e21,null));};exports['update']=function(_0x38a19d,_0x120726){if(_0x38a19d[_0x6abc('0x4c')]['id']){delete _0x38a19d[_0x6abc('0x4c')]['id'];}return db['SquareRecording'][_0x6abc('0x49')]({'where':{'id':_0x38a19d[_0x6abc('0x48')]['id']}})[_0x6abc('0x27')](handleEntityNotFound(_0x120726,null))[_0x6abc('0x27')](saveUpdates(_0x38a19d[_0x6abc('0x4c')],null))['then'](respondWithResult(_0x120726,null))['catch'](handleError(_0x120726,null));};exports['download']=function(_0x5a6b79,_0x229bf6,_0x425660){var _0x4d1338=require(_0x6abc('0x4d'));var _0x5d3b31=![];var _0x21f75d={};if(_0x5a6b79[_0x6abc('0x32')][_0x6abc('0x3f')]&&_0x5a6b79[_0x6abc('0x32')][_0x6abc('0x3f')]==='uniqueid'){_0x21f75d[_0x6abc('0x4e')]=_0x5a6b79[_0x6abc('0x48')]['id'];}else{_0x21f75d['id']=_0x5a6b79['params']['id'];}return db[_0x6abc('0x44')]['find']({'where':_0x21f75d,'attributes':['id',_0x6abc('0x4f'),_0x6abc('0x50')],'raw':!![]})[_0x6abc('0x27')](handleEntityNotFound(_0x229bf6,null))[_0x6abc('0x27')](function(_0x4f1400){if(_0x4f1400){var _0x3587d7=_0x4f1400[_0x6abc('0x4f')];var _0x57280e=util[_0x6abc('0x51')](_0x6abc('0x52'),_0x3587d7);if(fs[_0x6abc('0x53')](_0x57280e)){_0x5d3b31=!![];return _0x4d1338['decryptFile'](_0x57280e,_0x3587d7,config[_0x6abc('0x54')][_0x6abc('0x55')])[_0x6abc('0x27')](function(){return _0x4f1400;});}return _0x4f1400;}})[_0x6abc('0x27')](function(_0x33736f){if(_0x33736f){var _0xa5186b=_0x33736f[_0x6abc('0x4f')];if(!fs[_0x6abc('0x53')](_0xa5186b)){throw new db[(_0x6abc('0x56'))]['ValidationError'](_0x6abc('0x57'));}if(_0x33736f['filename']){return _0x229bf6['download'](_0xa5186b,_0x33736f[_0x6abc('0x50')]+path['extname'](_0xa5186b),function(){if(_0x5d3b31){fs[_0x6abc('0x58')](_0xa5186b);}});}else{return _0x229bf6[_0x6abc('0x59')](_0xa5186b,function(_0x5dc55f){if(_0x5d3b31){fs[_0x6abc('0x58')](_0xa5186b);}});}}})[_0x6abc('0x4a')](function(_0x3d489d){if(_0x3d489d[_0x6abc('0x5a')]===_0x6abc('0x57')){_0x229bf6[_0x6abc('0x1c')](0x194)[_0x6abc('0x29')]('Not\x20found');}else{return handleError(_0x229bf6,null);}});};exports[_0x6abc('0x26')]=function(_0x1e4845,_0xf42b22){return db['SquareRecording'][_0x6abc('0x49')]({'where':{'id':_0x1e4845[_0x6abc('0x48')]['id']}})[_0x6abc('0x27')](function(_0x12e9dc){if(_[_0x6abc('0x5b')](_0x12e9dc)){throw new ReferenceError('Entity\x20not\x20found');}return _0x12e9dc;})[_0x6abc('0x27')](function(_0x3588b1){var _0x1c00ae=_0x3588b1[_0x6abc('0x4f')];logger['info'](_0x6abc('0x5c'),_0x1c00ae);if(!_[_0x6abc('0x5b')](_0x3588b1[_0x6abc('0x4f')])&&fs[_0x6abc('0x53')](_0x1c00ae)){logger[_0x6abc('0x5d')]('File:\x20\x22'+_0x1c00ae+_0x6abc('0x5e'));fs['unlinkSync'](_0x1c00ae);}_0x1c00ae=_0x1c00ae+_0x6abc('0x5f');if(!_[_0x6abc('0x5b')](_0x3588b1[_0x6abc('0x4f')])&&fs[_0x6abc('0x53')](_0x1c00ae)){logger[_0x6abc('0x5d')]('File:\x20\x22'+_0x1c00ae+_0x6abc('0x5e'));fs[_0x6abc('0x60')](_0x1c00ae);}return _0x3588b1;})[_0x6abc('0x27')](function(_0x22e0a4){if(!_0x22e0a4)throw new InternalError();return _0x22e0a4[_0x6abc('0x26')]();})['then'](function(){_0xf42b22['status'](0xcc)[_0x6abc('0x1d')]();})[_0x6abc('0x4a')](handleError(_0xf42b22,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 4bcc84d..1790651 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 _0xaa64=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','lodash','util','api','bluebird','request-promise','path'];(function(_0x583761,_0x119f81){var _0x4b72f0=function(_0x351cad){while(--_0x351cad){_0x583761['push'](_0x583761['shift']());}};_0x4b72f0(++_0x119f81);}(_0xaa64,0xf7));var _0x4aa6=function(_0xeb7b15,_0x3faeb1){_0xeb7b15=_0xeb7b15-0x0;var _0x2107ee=_0xaa64[_0xeb7b15];return _0x2107ee;};'use strict';var _=require(_0x4aa6('0x0'));var util=require(_0x4aa6('0x1'));var logger=require('../../config/logger')(_0x4aa6('0x2'));var moment=require('moment');var BPromise=require(_0x4aa6('0x3'));var rp=require(_0x4aa6('0x4'));var fs=require('fs');var path=require(_0x4aa6('0x5'));var rimraf=require('rimraf');var config=require(_0x4aa6('0x6'));var attributes=require(_0x4aa6('0x7'));module[_0x4aa6('0x8')]=function(_0x37a260,_0x426bd6){return _0x37a260[_0x4aa6('0x9')](_0x4aa6('0xa'),attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47a1=['SquareRecording','square_recordings','lodash','api','bluebird','request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0xf0ec6e,_0xa183d3){var _0x8bbc27=function(_0x39822b){while(--_0x39822b){_0xf0ec6e['push'](_0xf0ec6e['shift']());}};_0x8bbc27(++_0xa183d3);}(_0x47a1,0xbd));var _0x147a=function(_0x75b04d,_0x1ac554){_0x75b04d=_0x75b04d-0x0;var _0x419482=_0x47a1[_0x75b04d];return _0x419482;};'use strict';var _=require(_0x147a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x147a('0x1'));var moment=require('moment');var BPromise=require(_0x147a('0x2'));var rp=require(_0x147a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x147a('0x4'));var config=require(_0x147a('0x5'));var attributes=require(_0x147a('0x6'));module[_0x147a('0x7')]=function(_0x31373d,_0x57e7a2){return _0x31373d[_0x147a('0x8')](_0x147a('0x9'),attributes,{'tableName':_0x147a('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 a9fbf7c..497f1da 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 _0x3ee5=['../../config/environment','jayson/promise','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','debug','stringify','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1df9a2,_0x53b7c8){var _0x555a87=function(_0x3495e0){while(--_0x3495e0){_0x1df9a2['push'](_0x1df9a2['shift']());}};_0x555a87(++_0x53b7c8);}(_0x3ee5,0xe8));var _0x53ee=function(_0xf3ed1a,_0x175c35){_0xf3ed1a=_0xf3ed1a-0x0;var _0x4914da=_0x3ee5[_0xf3ed1a];return _0x4914da;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53ee('0x0'));var BPromise=require(_0x53ee('0x1'));var rs=require(_0x53ee('0x2'));var fs=require('fs');var Redis=require(_0x53ee('0x3'));var db=require(_0x53ee('0x4'))['db'];var utils=require(_0x53ee('0x5'));var logger=require(_0x53ee('0x6'))(_0x53ee('0x7'));var config=require(_0x53ee('0x8'));var jayson=require(_0x53ee('0x9'));var client=jayson['client'][_0x53ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37e1d7,_0x3df953,_0x38b039){return new BPromise(function(_0x5ce4e4,_0xe761c7){return client[_0x53ee('0xb')](_0x37e1d7,_0x38b039)[_0x53ee('0xc')](function(_0x426337){logger[_0x53ee('0xd')](_0x53ee('0xe'),_0x3df953,_0x53ee('0xf'));logger['debug'](_0x53ee('0x10'),_0x3df953,_0x53ee('0xf'),JSON['stringify'](_0x426337));if(_0x426337[_0x53ee('0x11')]){if(_0x426337['error'][_0x53ee('0x12')]===0x1f4){logger['error'](_0x53ee('0xe'),_0x3df953,_0x426337['error'][_0x53ee('0x13')]);return _0xe761c7(_0x426337[_0x53ee('0x11')]['message']);}logger[_0x53ee('0x11')](_0x53ee('0xe'),_0x3df953,_0x426337['error'][_0x53ee('0x13')]);return _0x5ce4e4(_0x426337[_0x53ee('0x11')][_0x53ee('0x13')]);}else{logger[_0x53ee('0xd')](_0x53ee('0xe'),_0x3df953,_0x53ee('0xf'));_0x5ce4e4(_0x426337[_0x53ee('0x14')][_0x53ee('0x13')]);}})[_0x53ee('0x15')](function(_0x4bc490){logger[_0x53ee('0x11')](_0x53ee('0xe'),_0x3df953,_0x4bc490);_0xe761c7(_0x4bc490);});});}exports['CreateSquareRecording']=function(_0x5617be){var _0x23291b=this;return new Promise(function(_0x1976fd,_0x35dd82){return db[_0x53ee('0x16')][_0x53ee('0x17')](_0x5617be[_0x53ee('0x18')],{'raw':_0x5617be[_0x53ee('0x19')]?_0x5617be[_0x53ee('0x19')][_0x53ee('0x1a')]===undefined?!![]:![]:!![]})[_0x53ee('0xc')](function(_0x53a071){logger['info'](_0x53ee('0x1b'),_0x5617be);logger[_0x53ee('0x1c')]('CreateSquareRecording',_0x5617be,JSON[_0x53ee('0x1d')](_0x53a071));_0x1976fd(_0x53a071);})[_0x53ee('0x15')](function(_0x5a6635){logger[_0x53ee('0x11')](_0x53ee('0x1b'),_0x5a6635[_0x53ee('0x13')],_0x5617be);_0x35dd82(_0x23291b['error'](0x1f4,_0x5a6635[_0x53ee('0x13')]));});});}; \ No newline at end of file +var _0x6a7d=['SquareRecording,\x20%s,\x20%s,\x20%s','error','message','SquareRecording,\x20%s,\x20%s','info','result','SquareRecording','options','CreateSquareRecording','stringify','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug'];(function(_0x5c468f,_0x2e5c25){var _0x2136b0=function(_0x56b8a4){while(--_0x56b8a4){_0x5c468f['push'](_0x5c468f['shift']());}};_0x2136b0(++_0x2e5c25);}(_0x6a7d,0x137));var _0xd6a7=function(_0x16972f,_0x24951d){_0x16972f=_0x16972f-0x0;var _0x3e2509=_0x6a7d[_0x16972f];return _0x3e2509;};'use strict';var _=require(_0xd6a7('0x0'));var util=require(_0xd6a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd6a7('0x2'));var fs=require('fs');var Redis=require(_0xd6a7('0x3'));var db=require(_0xd6a7('0x4'))['db'];var utils=require(_0xd6a7('0x5'));var logger=require(_0xd6a7('0x6'))(_0xd6a7('0x7'));var config=require(_0xd6a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ee9b,_0x5a1b09,_0x4ed4f1){return new BPromise(function(_0x2ad77c,_0x2f5a28){return client[_0xd6a7('0xa')](_0x24ee9b,_0x4ed4f1)[_0xd6a7('0xb')](function(_0x510c36){logger['info']('SquareRecording,\x20%s,\x20%s',_0x5a1b09,_0xd6a7('0xc'));logger[_0xd6a7('0xd')](_0xd6a7('0xe'),_0x5a1b09,_0xd6a7('0xc'),JSON['stringify'](_0x510c36));if(_0x510c36['error']){if(_0x510c36[_0xd6a7('0xf')]['code']===0x1f4){logger[_0xd6a7('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5a1b09,_0x510c36['error'][_0xd6a7('0x10')]);return _0x2f5a28(_0x510c36[_0xd6a7('0xf')][_0xd6a7('0x10')]);}logger['error'](_0xd6a7('0x11'),_0x5a1b09,_0x510c36[_0xd6a7('0xf')][_0xd6a7('0x10')]);return _0x2ad77c(_0x510c36['error'][_0xd6a7('0x10')]);}else{logger[_0xd6a7('0x12')]('SquareRecording,\x20%s,\x20%s',_0x5a1b09,_0xd6a7('0xc'));_0x2ad77c(_0x510c36[_0xd6a7('0x13')]['message']);}})['catch'](function(_0x39d2ca){logger[_0xd6a7('0xf')]('SquareRecording,\x20%s,\x20%s',_0x5a1b09,_0x39d2ca);_0x2f5a28(_0x39d2ca);});});}exports['CreateSquareRecording']=function(_0x5447d5){var _0x5c534c=this;return new Promise(function(_0xb18ae,_0x54eff3){return db[_0xd6a7('0x14')]['create'](_0x5447d5['body'],{'raw':_0x5447d5[_0xd6a7('0x15')]?_0x5447d5[_0xd6a7('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xd6a7('0xb')](function(_0x4f093e){logger[_0xd6a7('0x12')](_0xd6a7('0x16'),_0x5447d5);logger['debug'](_0xd6a7('0x16'),_0x5447d5,JSON[_0xd6a7('0x17')](_0x4f093e));_0xb18ae(_0x4f093e);})[_0xd6a7('0x18')](function(_0x1f707b){logger[_0xd6a7('0xf')](_0xd6a7('0x16'),_0x1f707b['message'],_0x5447d5);_0x54eff3(_0x5c534c[_0xd6a7('0xf')](0x1f4,_0x1f707b['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index c24a806..b9e7ea8 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0xe4bc5b,_0x47d956){var _0x3efc28=function(_0x4268a3){while(--_0x4268a3){_0xe4bc5b['push'](_0xe4bc5b['shift']());}};_0x3efc28(++_0x47d956);}(_0xb10b,0x12a));var _0xbb10=function(_0x3ed0d5,_0x5f0e1f){_0x3ed0d5=_0x3ed0d5-0x0;var _0x5e4563=_0xb10b[_0x3ed0d5];return _0x5e4563;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file +var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x4989d4,_0x2173ae){var _0x562420=function(_0xbc4941){while(--_0xbc4941){_0x4989d4['push'](_0x4989d4['shift']());}};_0x562420(++_0x2173ae);}(_0xe706,0xa3));var _0x6e70=function(_0x350465,_0x18ed5d){_0x350465=_0x350465-0x0;var _0x4ae53d=_0xe706[_0x350465];return _0x4ae53d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4e5f1c3..d11d339 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 _0xeca8=['STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeca8,0x1f2));var _0x8eca=function(_0x43cf32,_0x3128a1){_0x43cf32=_0x43cf32-0x0;var _0x265761=_0xeca8[_0x43cf32];return _0x265761;};'use strict';var Sequelize=require(_0x8eca('0x0'));module[_0x8eca('0x1')]={'network':{'type':Sequelize[_0x8eca('0x2')]},'network_script':{'type':Sequelize[_0x8eca('0x2')]},'request':{'type':Sequelize[_0x8eca('0x2')]},'channel':{'type':Sequelize[_0x8eca('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8eca('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x8eca('0x2')]},'callerid':{'type':Sequelize[_0x8eca('0x2')]},'calleridname':{'type':Sequelize[_0x8eca('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x8eca('0x2')]},'callington':{'type':Sequelize[_0x8eca('0x2')]},'callingtns':{'type':Sequelize[_0x8eca('0x2')]},'dnid':{'type':Sequelize[_0x8eca('0x2')]},'rdnis':{'type':Sequelize[_0x8eca('0x2')]},'context':{'type':Sequelize[_0x8eca('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x8eca('0x2')]},'enhanced':{'type':Sequelize[_0x8eca('0x2')]},'accountcode':{'type':Sequelize[_0x8eca('0x2')]},'threadid':{'type':Sequelize[_0x8eca('0x2')]},'project_name':{'type':Sequelize[_0x8eca('0x2')]},'joinAt':{'type':Sequelize[_0x8eca('0x3')]},'leaveAt':{'type':Sequelize[_0x8eca('0x3')]},'bot':{'type':Sequelize[_0x8eca('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xad66=['DATE','BOOLEAN','sequelize','STRING'];(function(_0x4e9eba,_0x322c3d){var _0x571912=function(_0x51124b){while(--_0x51124b){_0x4e9eba['push'](_0x4e9eba['shift']());}};_0x571912(++_0x322c3d);}(_0xad66,0x66));var _0x6ad6=function(_0x54d315,_0x5d057c){_0x54d315=_0x54d315-0x0;var _0x5f06a1=_0xad66[_0x54d315];return _0x5f06a1;};'use strict';var Sequelize=require(_0x6ad6('0x0'));module['exports']={'network':{'type':Sequelize[_0x6ad6('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x6ad6('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x6ad6('0x1')]},'uniqueid':{'type':Sequelize[_0x6ad6('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6ad6('0x1')]},'callingpres':{'type':Sequelize[_0x6ad6('0x1')]},'callingani2':{'type':Sequelize[_0x6ad6('0x1')]},'callington':{'type':Sequelize[_0x6ad6('0x1')]},'callingtns':{'type':Sequelize[_0x6ad6('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x6ad6('0x1')]},'context':{'type':Sequelize[_0x6ad6('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x6ad6('0x1')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6ad6('0x1')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0x6ad6('0x1')]},'joinAt':{'type':Sequelize[_0x6ad6('0x2')]},'leaveAt':{'type':Sequelize[_0x6ad6('0x2')]},'bot':{'type':Sequelize[_0x6ad6('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 166a114..f10dd85 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 _0x3c51=['../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x3f959a,_0x4128e9){var _0x28c9e7=function(_0x39ceb1){while(--_0x39ceb1){_0x3f959a['push'](_0x3f959a['shift']());}};_0x28c9e7(++_0x4128e9);}(_0x3c51,0x1b7));var _0x13c5=function(_0xb4830c,_0x4bfa24){_0xb4830c=_0xb4830c-0x0;var _0x4cb0c0=_0x3c51[_0xb4830c];return _0x4cb0c0;};'use strict';var emlformat=require(_0x13c5('0x0'));var rimraf=require(_0x13c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13c5('0x2'));var moment=require(_0x13c5('0x3'));var BPromise=require(_0x13c5('0x4'));var Mustache=require(_0x13c5('0x5'));var util=require(_0x13c5('0x6'));var path=require('path');var sox=require(_0x13c5('0x7'));var csv=require(_0x13c5('0x8'));var ejs=require(_0x13c5('0x9'));var fs=require('fs');var fs_extra=require(_0x13c5('0xa'));var _=require('lodash');var squel=require(_0x13c5('0xb'));var crypto=require(_0x13c5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x13c5('0xd'));var toCsv=require(_0x13c5('0x8'));var querystring=require(_0x13c5('0xe'));var Papa=require(_0x13c5('0xf'));var Redis=require(_0x13c5('0x10'));var authService=require(_0x13c5('0x11'));var qs=require(_0x13c5('0x12'));var as=require(_0x13c5('0x13'));var hardwareService=require(_0x13c5('0x14'));var logger=require(_0x13c5('0x15'))('api');var utils=require(_0x13c5('0x16'));var config=require(_0x13c5('0x17'));var licenseUtil=require(_0x13c5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d45fd,_0x16a6dd){_0x16a6dd=_0x16a6dd||0xcc;return function(_0x26b021){if(_0x26b021){return _0x3d45fd[_0x13c5('0x19')](_0x16a6dd);}return _0x3d45fd[_0x13c5('0x1a')](_0x16a6dd)[_0x13c5('0x1b')]();};}function respondWithResult(_0x2f7538,_0x3b9602){_0x3b9602=_0x3b9602||0xc8;return function(_0x2c7dad){if(_0x2c7dad){return _0x2f7538['status'](_0x3b9602)[_0x13c5('0x1c')](_0x2c7dad);}};}function respondWithFilteredResult(_0x4ec529,_0xd3046){return function(_0x713229){if(_0x713229){var _0x4bab34=typeof _0xd3046['offset']==='undefined'&&typeof _0xd3046[_0x13c5('0x1d')]===_0x13c5('0x1e');var _0xf49d08=_0x713229[_0x13c5('0x1f')];var _0x98542f=_0x4bab34?0x0:_0xd3046[_0x13c5('0x20')];var _0x152720=_0x4bab34?_0x713229[_0x13c5('0x1f')]:_0xd3046[_0x13c5('0x20')]+_0xd3046['limit'];var _0x38a8c6;if(_0x152720>=_0xf49d08){_0x152720=_0xf49d08;_0x38a8c6=0xc8;}else{_0x38a8c6=0xce;}_0x4ec529[_0x13c5('0x1a')](_0x38a8c6);return _0x4ec529['set'](_0x13c5('0x21'),_0x98542f+'-'+_0x152720+'/'+_0xf49d08)['json'](_0x713229);}return null;};}function patchUpdates(_0x30d09e){return function(_0x4c8995){try{jsonpatch[_0x13c5('0x22')](_0x4c8995,_0x30d09e,!![]);}catch(_0x43301d){return BPromise[_0x13c5('0x23')](_0x43301d);}return _0x4c8995[_0x13c5('0x24')]();};}function saveUpdates(_0x5c6e14,_0x2a0914){return function(_0x417ec4){if(_0x417ec4){return _0x417ec4[_0x13c5('0x25')](_0x5c6e14)[_0x13c5('0x26')](function(_0x52cc7a){return _0x52cc7a;});}return null;};}function removeEntity(_0x12aa36,_0x2e85fb){return function(_0x280d32){if(_0x280d32){return _0x280d32[_0x13c5('0x27')]()['then'](function(){_0x12aa36[_0x13c5('0x1a')](0xcc)[_0x13c5('0x1b')]();});}};}function handleEntityNotFound(_0x4a69db,_0x562c3f){return function(_0xb0daa1){if(!_0xb0daa1){_0x4a69db[_0x13c5('0x19')](0x194);}return _0xb0daa1;};}function handleError(_0x129c20,_0xfcc2de){_0xfcc2de=_0xfcc2de||0x1f4;return function(_0x20affc){logger[_0x13c5('0x28')](_0x20affc['stack']);if(_0x20affc['name']){delete _0x20affc[_0x13c5('0x29')];}_0x129c20['status'](_0xfcc2de)[_0x13c5('0x2a')](_0x20affc);};}exports[_0x13c5('0x2b')]=function(_0x32edf8,_0xcb8262){var _0x38f66f={},_0x159d1b={},_0x28ef07={'count':0x0,'rows':[]};var _0x3a5674=_[_0x13c5('0x2c')](db[_0x13c5('0x2d')][_0x13c5('0x2e')],function(_0x28b4b7){return{'name':_0x28b4b7[_0x13c5('0x2f')],'type':_0x28b4b7[_0x13c5('0x30')][_0x13c5('0x31')]};});_0x159d1b['model']=_[_0x13c5('0x2c')](_0x3a5674,_0x13c5('0x29'));_0x159d1b[_0x13c5('0x32')]=_[_0x13c5('0x33')](_0x32edf8['query']);_0x159d1b['filters']=_['intersection'](_0x159d1b[_0x13c5('0x34')],_0x159d1b[_0x13c5('0x32')]);_0x38f66f[_0x13c5('0x35')]=_['intersection'](_0x159d1b[_0x13c5('0x34')],qs[_0x13c5('0x36')](_0x32edf8[_0x13c5('0x32')][_0x13c5('0x36')]));_0x38f66f['attributes']=_0x38f66f['attributes'][_0x13c5('0x37')]?_0x38f66f[_0x13c5('0x35')]:_0x159d1b['model'];if(!_0x32edf8[_0x13c5('0x32')][_0x13c5('0x38')](_0x13c5('0x39'))){_0x38f66f[_0x13c5('0x1d')]=qs['limit'](_0x32edf8[_0x13c5('0x32')][_0x13c5('0x1d')]);_0x38f66f[_0x13c5('0x20')]=qs[_0x13c5('0x20')](_0x32edf8[_0x13c5('0x32')][_0x13c5('0x20')]);}_0x38f66f[_0x13c5('0x3a')]=qs[_0x13c5('0x3b')](_0x32edf8['query']['sort']);_0x38f66f['where']=qs[_0x13c5('0x3c')](_[_0x13c5('0x3d')](_0x32edf8['query'],_0x159d1b[_0x13c5('0x3c')]),_0x3a5674);if(_0x32edf8[_0x13c5('0x32')][_0x13c5('0x3e')]){_0x38f66f[_0x13c5('0x3f')]=_[_0x13c5('0x40')](_0x38f66f[_0x13c5('0x3f')],{'$or':_[_0x13c5('0x2c')](_0x3a5674,function(_0x4a960b){if(_0x4a960b['type']!=='VIRTUAL'){var _0x24857={};_0x24857[_0x4a960b[_0x13c5('0x29')]]={'$like':'%'+_0x32edf8[_0x13c5('0x32')][_0x13c5('0x3e')]+'%'};return _0x24857;}})});}_0x38f66f=_[_0x13c5('0x40')]({},_0x38f66f,_0x32edf8[_0x13c5('0x41')]);var _0x599e47={'where':_0x38f66f[_0x13c5('0x3f')]};return db[_0x13c5('0x2d')][_0x13c5('0x1f')](_0x599e47)[_0x13c5('0x26')](function(_0x218d08){_0x28ef07['count']=_0x218d08;if(_0x32edf8['query'][_0x13c5('0x42')]){_0x38f66f[_0x13c5('0x43')]=[{'all':!![]}];}return db[_0x13c5('0x2d')]['findAll'](_0x38f66f);})[_0x13c5('0x26')](function(_0x3affc6){_0x28ef07[_0x13c5('0x44')]=_0x3affc6;return _0x28ef07;})[_0x13c5('0x26')](respondWithFilteredResult(_0xcb8262,_0x38f66f))[_0x13c5('0x45')](handleError(_0xcb8262,null));};exports[_0x13c5('0x46')]=function(_0x4ad987,_0x142853){var _0x55c3dd={'raw':!![],'where':{'id':_0x4ad987[_0x13c5('0x47')]['id']}},_0x2f0a19={};_0x2f0a19[_0x13c5('0x34')]=_['keys'](db[_0x13c5('0x2d')][_0x13c5('0x2e')]);_0x2f0a19['query']=_[_0x13c5('0x33')](_0x4ad987[_0x13c5('0x32')]);_0x2f0a19[_0x13c5('0x3c')]=_[_0x13c5('0x48')](_0x2f0a19[_0x13c5('0x34')],_0x2f0a19[_0x13c5('0x32')]);_0x55c3dd[_0x13c5('0x35')]=_['intersection'](_0x2f0a19[_0x13c5('0x34')],qs[_0x13c5('0x36')](_0x4ad987[_0x13c5('0x32')][_0x13c5('0x36')]));_0x55c3dd[_0x13c5('0x35')]=_0x55c3dd['attributes']['length']?_0x55c3dd[_0x13c5('0x35')]:_0x2f0a19['model'];if(_0x4ad987[_0x13c5('0x32')][_0x13c5('0x42')]){_0x55c3dd[_0x13c5('0x43')]=[{'all':!![]}];}_0x55c3dd=_['merge']({},_0x55c3dd,_0x4ad987[_0x13c5('0x41')]);return db['SquareReport'][_0x13c5('0x49')](_0x55c3dd)[_0x13c5('0x26')](handleEntityNotFound(_0x142853,null))['then'](respondWithResult(_0x142853,null))[_0x13c5('0x45')](handleError(_0x142853,null));};exports[_0x13c5('0x4a')]=function(_0x26986c,_0x5de616){return db[_0x13c5('0x2d')]['create'](_0x26986c['body'],{})['then'](respondWithResult(_0x5de616,0xc9))[_0x13c5('0x45')](handleError(_0x5de616,null));};exports[_0x13c5('0x25')]=function(_0x1235e2,_0x524f63){if(_0x1235e2[_0x13c5('0x4b')]['id']){delete _0x1235e2[_0x13c5('0x4b')]['id'];}return db[_0x13c5('0x2d')][_0x13c5('0x49')]({'where':{'id':_0x1235e2['params']['id']}})[_0x13c5('0x26')](handleEntityNotFound(_0x524f63,null))['then'](saveUpdates(_0x1235e2[_0x13c5('0x4b')],null))['then'](respondWithResult(_0x524f63,null))['catch'](handleError(_0x524f63,null));};exports[_0x13c5('0x27')]=function(_0x44e424,_0x25d248){return db['SquareReport'][_0x13c5('0x49')]({'where':{'id':_0x44e424[_0x13c5('0x47')]['id']}})[_0x13c5('0x26')](handleEntityNotFound(_0x25d248,null))[_0x13c5('0x26')](removeEntity(_0x25d248,null))[_0x13c5('0x45')](handleError(_0x25d248,null));};exports[_0x13c5('0x4c')]=function(_0x43bffc,_0x5e370a){return db[_0x13c5('0x2d')][_0x13c5('0x4c')]()[_0x13c5('0x26')](respondWithResult(_0x5e370a,null))[_0x13c5('0x45')](handleError(_0x5e370a,null));}; \ No newline at end of file +var _0xf5ce=['status','set','Content-Range','json','apply','update','then','destroy','stack','name','send','map','SquareReport','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','includeAll','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count'];(function(_0x34ecdd,_0x3f5902){var _0x4f8f85=function(_0x4d08d2){while(--_0x4d08d2){_0x34ecdd['push'](_0x34ecdd['shift']());}};_0x4f8f85(++_0x3f5902);}(_0xf5ce,0x10a));var _0xef5c=function(_0x595397,_0x22a5a8){_0x595397=_0x595397-0x0;var _0xdec269=_0xf5ce[_0x595397];return _0xdec269;};'use strict';var emlformat=require(_0xef5c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef5c('0x1'));var jsonpatch=require(_0xef5c('0x2'));var rp=require(_0xef5c('0x3'));var moment=require(_0xef5c('0x4'));var BPromise=require(_0xef5c('0x5'));var Mustache=require(_0xef5c('0x6'));var util=require(_0xef5c('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xef5c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xef5c('0x9'));var jsforce=require(_0xef5c('0xa'));var deskjs=require(_0xef5c('0xb'));var toCsv=require('to-csv');var querystring=require(_0xef5c('0xc'));var Papa=require(_0xef5c('0xd'));var Redis=require(_0xef5c('0xe'));var authService=require(_0xef5c('0xf'));var qs=require(_0xef5c('0x10'));var as=require(_0xef5c('0x11'));var hardwareService=require(_0xef5c('0x12'));var logger=require('../../config/logger')(_0xef5c('0x13'));var utils=require(_0xef5c('0x14'));var config=require(_0xef5c('0x15'));var licenseUtil=require(_0xef5c('0x16'));var db=require(_0xef5c('0x17'))['db'];function respondWithStatusCode(_0xb5e56,_0x2df634){_0x2df634=_0x2df634||0xcc;return function(_0x5f389c){if(_0x5f389c){return _0xb5e56[_0xef5c('0x18')](_0x2df634);}return _0xb5e56['status'](_0x2df634)[_0xef5c('0x19')]();};}function respondWithResult(_0x542756,_0x373dff){_0x373dff=_0x373dff||0xc8;return function(_0x3b9c72){if(_0x3b9c72){return _0x542756['status'](_0x373dff)['json'](_0x3b9c72);}};}function respondWithFilteredResult(_0xca2fb9,_0x2e23a8){return function(_0x26eeb8){if(_0x26eeb8){var _0x3537a9=typeof _0x2e23a8[_0xef5c('0x1a')]===_0xef5c('0x1b')&&typeof _0x2e23a8[_0xef5c('0x1c')]===_0xef5c('0x1b');var _0x1c819a=_0x26eeb8[_0xef5c('0x1d')];var _0x16cddd=_0x3537a9?0x0:_0x2e23a8[_0xef5c('0x1a')];var _0x2fe911=_0x3537a9?_0x26eeb8[_0xef5c('0x1d')]:_0x2e23a8['offset']+_0x2e23a8['limit'];var _0x192a91;if(_0x2fe911>=_0x1c819a){_0x2fe911=_0x1c819a;_0x192a91=0xc8;}else{_0x192a91=0xce;}_0xca2fb9[_0xef5c('0x1e')](_0x192a91);return _0xca2fb9[_0xef5c('0x1f')](_0xef5c('0x20'),_0x16cddd+'-'+_0x2fe911+'/'+_0x1c819a)[_0xef5c('0x21')](_0x26eeb8);}return null;};}function patchUpdates(_0x3871bd){return function(_0x2a57a2){try{jsonpatch[_0xef5c('0x22')](_0x2a57a2,_0x3871bd,!![]);}catch(_0x4cc425){return BPromise['reject'](_0x4cc425);}return _0x2a57a2['save']();};}function saveUpdates(_0x4aec53,_0x749c51){return function(_0x55d2f6){if(_0x55d2f6){return _0x55d2f6[_0xef5c('0x23')](_0x4aec53)[_0xef5c('0x24')](function(_0x29d446){return _0x29d446;});}return null;};}function removeEntity(_0x2c6ccb,_0x54a12c){return function(_0x5d70ec){if(_0x5d70ec){return _0x5d70ec[_0xef5c('0x25')]()['then'](function(){_0x2c6ccb[_0xef5c('0x1e')](0xcc)[_0xef5c('0x19')]();});}};}function handleEntityNotFound(_0x11566e,_0x18620c){return function(_0x56f4d4){if(!_0x56f4d4){_0x11566e[_0xef5c('0x18')](0x194);}return _0x56f4d4;};}function handleError(_0x25437d,_0x4f5cc5){_0x4f5cc5=_0x4f5cc5||0x1f4;return function(_0x2094d9){logger['error'](_0x2094d9[_0xef5c('0x26')]);if(_0x2094d9[_0xef5c('0x27')]){delete _0x2094d9['name'];}_0x25437d['status'](_0x4f5cc5)[_0xef5c('0x28')](_0x2094d9);};}exports['index']=function(_0x451ef6,_0x59708b){var _0x27d681={},_0x457c04={},_0x2990f5={'count':0x0,'rows':[]};var _0x3cc510=_[_0xef5c('0x29')](db[_0xef5c('0x2a')]['rawAttributes'],function(_0x47f60e){return{'name':_0x47f60e[_0xef5c('0x2b')],'type':_0x47f60e[_0xef5c('0x2c')][_0xef5c('0x2d')]};});_0x457c04[_0xef5c('0x2e')]=_[_0xef5c('0x29')](_0x3cc510,'name');_0x457c04[_0xef5c('0x2f')]=_[_0xef5c('0x30')](_0x451ef6[_0xef5c('0x2f')]);_0x457c04[_0xef5c('0x31')]=_['intersection'](_0x457c04[_0xef5c('0x2e')],_0x457c04[_0xef5c('0x2f')]);_0x27d681[_0xef5c('0x32')]=_['intersection'](_0x457c04[_0xef5c('0x2e')],qs[_0xef5c('0x33')](_0x451ef6[_0xef5c('0x2f')][_0xef5c('0x33')]));_0x27d681[_0xef5c('0x32')]=_0x27d681[_0xef5c('0x32')][_0xef5c('0x34')]?_0x27d681[_0xef5c('0x32')]:_0x457c04[_0xef5c('0x2e')];if(!_0x451ef6[_0xef5c('0x2f')][_0xef5c('0x35')]('nolimit')){_0x27d681[_0xef5c('0x1c')]=qs[_0xef5c('0x1c')](_0x451ef6[_0xef5c('0x2f')][_0xef5c('0x1c')]);_0x27d681['offset']=qs['offset'](_0x451ef6['query'][_0xef5c('0x1a')]);}_0x27d681['order']=qs[_0xef5c('0x36')](_0x451ef6[_0xef5c('0x2f')][_0xef5c('0x36')]);_0x27d681[_0xef5c('0x37')]=qs[_0xef5c('0x31')](_[_0xef5c('0x38')](_0x451ef6[_0xef5c('0x2f')],_0x457c04[_0xef5c('0x31')]),_0x3cc510);if(_0x451ef6['query'][_0xef5c('0x39')]){_0x27d681[_0xef5c('0x37')]=_[_0xef5c('0x3a')](_0x27d681[_0xef5c('0x37')],{'$or':_['map'](_0x3cc510,function(_0x29c75a){if(_0x29c75a['type']!==_0xef5c('0x3b')){var _0x9c4b08={};_0x9c4b08[_0x29c75a[_0xef5c('0x27')]]={'$like':'%'+_0x451ef6[_0xef5c('0x2f')][_0xef5c('0x39')]+'%'};return _0x9c4b08;}})});}_0x27d681=_[_0xef5c('0x3a')]({},_0x27d681,_0x451ef6[_0xef5c('0x3c')]);var _0x2f2aba={'where':_0x27d681[_0xef5c('0x37')]};return db['SquareReport'][_0xef5c('0x1d')](_0x2f2aba)[_0xef5c('0x24')](function(_0x152c03){_0x2990f5['count']=_0x152c03;if(_0x451ef6[_0xef5c('0x2f')]['includeAll']){_0x27d681[_0xef5c('0x3d')]=[{'all':!![]}];}return db[_0xef5c('0x2a')][_0xef5c('0x3e')](_0x27d681);})['then'](function(_0x393b47){_0x2990f5[_0xef5c('0x3f')]=_0x393b47;return _0x2990f5;})[_0xef5c('0x24')](respondWithFilteredResult(_0x59708b,_0x27d681))[_0xef5c('0x40')](handleError(_0x59708b,null));};exports[_0xef5c('0x41')]=function(_0x57553e,_0x4438e1){var _0x5046f5={'raw':!![],'where':{'id':_0x57553e[_0xef5c('0x42')]['id']}},_0x49e858={};_0x49e858[_0xef5c('0x2e')]=_['keys'](db['SquareReport'][_0xef5c('0x43')]);_0x49e858[_0xef5c('0x2f')]=_['keys'](_0x57553e[_0xef5c('0x2f')]);_0x49e858[_0xef5c('0x31')]=_[_0xef5c('0x44')](_0x49e858['model'],_0x49e858[_0xef5c('0x2f')]);_0x5046f5[_0xef5c('0x32')]=_[_0xef5c('0x44')](_0x49e858[_0xef5c('0x2e')],qs[_0xef5c('0x33')](_0x57553e[_0xef5c('0x2f')]['fields']));_0x5046f5[_0xef5c('0x32')]=_0x5046f5[_0xef5c('0x32')]['length']?_0x5046f5['attributes']:_0x49e858[_0xef5c('0x2e')];if(_0x57553e['query'][_0xef5c('0x45')]){_0x5046f5[_0xef5c('0x3d')]=[{'all':!![]}];}_0x5046f5=_['merge']({},_0x5046f5,_0x57553e['options']);return db[_0xef5c('0x2a')]['find'](_0x5046f5)['then'](handleEntityNotFound(_0x4438e1,null))[_0xef5c('0x24')](respondWithResult(_0x4438e1,null))[_0xef5c('0x40')](handleError(_0x4438e1,null));};exports[_0xef5c('0x46')]=function(_0x48bf80,_0x34a9e9){return db[_0xef5c('0x2a')][_0xef5c('0x46')](_0x48bf80['body'],{})[_0xef5c('0x24')](respondWithResult(_0x34a9e9,0xc9))[_0xef5c('0x40')](handleError(_0x34a9e9,null));};exports[_0xef5c('0x23')]=function(_0xd4a50f,_0x353041){if(_0xd4a50f['body']['id']){delete _0xd4a50f[_0xef5c('0x47')]['id'];}return db[_0xef5c('0x2a')][_0xef5c('0x48')]({'where':{'id':_0xd4a50f[_0xef5c('0x42')]['id']}})[_0xef5c('0x24')](handleEntityNotFound(_0x353041,null))[_0xef5c('0x24')](saveUpdates(_0xd4a50f[_0xef5c('0x47')],null))[_0xef5c('0x24')](respondWithResult(_0x353041,null))[_0xef5c('0x40')](handleError(_0x353041,null));};exports['destroy']=function(_0x18534d,_0x56eb77){return db[_0xef5c('0x2a')][_0xef5c('0x48')]({'where':{'id':_0x18534d[_0xef5c('0x42')]['id']}})['then'](handleEntityNotFound(_0x56eb77,null))[_0xef5c('0x24')](removeEntity(_0x56eb77,null))[_0xef5c('0x40')](handleError(_0x56eb77,null));};exports['describe']=function(_0x4481cf,_0x45ab62){return db[_0xef5c('0x2a')][_0xef5c('0x49')]()[_0xef5c('0x24')](respondWithResult(_0x45ab62,null))[_0xef5c('0x40')](handleError(_0x45ab62,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 2cec427..1a78417 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 _0xef2d=['rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','uniqueid','leaveAt','lodash','moment','bluebird','request-promise'];(function(_0x54268e,_0x759f40){var _0x50da50=function(_0x118c3f){while(--_0x118c3f){_0x54268e['push'](_0x54268e['shift']());}};_0x50da50(++_0x759f40);}(_0xef2d,0x140));var _0xdef2=function(_0x4b2468,_0x582ca5){_0x4b2468=_0x4b2468-0x0;var _0x442ee0=_0xef2d[_0x4b2468];return _0x442ee0;};'use strict';var _=require(_0xdef2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdef2('0x1'));var BPromise=require(_0xdef2('0x2'));var rp=require(_0xdef2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdef2('0x4'));var config=require(_0xdef2('0x5'));var attributes=require(_0xdef2('0x6'));module[_0xdef2('0x7')]=function(_0x22dabd,_0x541b53){return _0x22dabd[_0xdef2('0x8')](_0xdef2('0x9'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xdef2('0xa'),'project_name']},{'name':_0xdef2('0xb'),'fields':[_0xdef2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3c89=['define','SquareReport','report_square','uniqueid','leaveAt','lodash','../../config/logger','api','moment','bluebird','path','rimraf','./squareReport.attributes','exports'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0x3c89,0x1ef));var _0x93c8=function(_0x396c8e,_0x59f6d7){_0x396c8e=_0x396c8e-0x0;var _0x52ed6b=_0x3c89[_0x396c8e];return _0x52ed6b;};'use strict';var _=require(_0x93c8('0x0'));var util=require('util');var logger=require(_0x93c8('0x1'))(_0x93c8('0x2'));var moment=require(_0x93c8('0x3'));var BPromise=require(_0x93c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x93c8('0x5'));var rimraf=require(_0x93c8('0x6'));var config=require('../../config/environment');var attributes=require(_0x93c8('0x7'));module[_0x93c8('0x8')]=function(_0x395f63,_0x4ed656){return _0x395f63[_0x93c8('0x9')](_0x93c8('0xa'),attributes,{'tableName':_0x93c8('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x93c8('0xc'),'project_name']},{'name':_0x93c8('0xd'),'fields':[_0x93c8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index fbfb6d7..7fa0ca3 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 _0xbe1e=['then','info','CreateSquareReport','attributes','limit','UpdateSquareReport','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareReport','body','options','raw'];(function(_0x10004e,_0xd701e6){var _0x5af990=function(_0x4bab6a){while(--_0x4bab6a){_0x10004e['push'](_0x10004e['shift']());}};_0x5af990(++_0xd701e6);}(_0xbe1e,0x13c));var _0xebe1=function(_0x275f4a,_0x2077d4){_0x275f4a=_0x275f4a-0x0;var _0x4b4a21=_0xbe1e[_0x275f4a];return _0x4b4a21;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xebe1('0x0'));var BPromise=require(_0xebe1('0x1'));var rs=require(_0xebe1('0x2'));var fs=require('fs');var Redis=require(_0xebe1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xebe1('0x4'));var logger=require(_0xebe1('0x5'))(_0xebe1('0x6'));var config=require(_0xebe1('0x7'));var jayson=require(_0xebe1('0x8'));var client=jayson[_0xebe1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f9d72,_0xd0b327,_0x26e92a){return new BPromise(function(_0x2b8543,_0xb83e4a){return client[_0xebe1('0xa')](_0x4f9d72,_0x26e92a)['then'](function(_0xfb5870){logger['info'](_0xebe1('0xb'),_0xd0b327,_0xebe1('0xc'));logger[_0xebe1('0xd')](_0xebe1('0xe'),_0xd0b327,_0xebe1('0xc'),JSON[_0xebe1('0xf')](_0xfb5870));if(_0xfb5870[_0xebe1('0x10')]){if(_0xfb5870['error'][_0xebe1('0x11')]===0x1f4){logger['error']('SquareReport,\x20%s,\x20%s',_0xd0b327,_0xfb5870[_0xebe1('0x10')][_0xebe1('0x12')]);return _0xb83e4a(_0xfb5870[_0xebe1('0x10')][_0xebe1('0x12')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0xd0b327,_0xfb5870[_0xebe1('0x10')][_0xebe1('0x12')]);return _0x2b8543(_0xfb5870[_0xebe1('0x10')][_0xebe1('0x12')]);}else{logger['info'](_0xebe1('0xb'),_0xd0b327,'request\x20sent');_0x2b8543(_0xfb5870[_0xebe1('0x13')][_0xebe1('0x12')]);}})[_0xebe1('0x14')](function(_0x38880c){logger[_0xebe1('0x10')]('SquareReport,\x20%s,\x20%s',_0xd0b327,_0x38880c);_0xb83e4a(_0x38880c);});});}exports['CreateSquareReport']=function(_0x245208){var _0x9fc61=this;return new Promise(function(_0x51456f,_0x3dc0ce){return db[_0xebe1('0x15')]['create'](_0x245208[_0xebe1('0x16')],{'raw':_0x245208[_0xebe1('0x17')]?_0x245208[_0xebe1('0x17')][_0xebe1('0x18')]===undefined?!![]:![]:!![]})[_0xebe1('0x19')](function(_0x1d1282){logger[_0xebe1('0x1a')](_0xebe1('0x1b'),_0x245208);logger[_0xebe1('0xd')](_0xebe1('0x1b'),_0x245208,JSON[_0xebe1('0xf')](_0x1d1282));_0x51456f(_0x1d1282);})[_0xebe1('0x14')](function(_0x26487e){logger[_0xebe1('0x10')](_0xebe1('0x1b'),_0x26487e[_0xebe1('0x12')],_0x245208);_0x3dc0ce(_0x9fc61[_0xebe1('0x10')](0x1f4,_0x26487e[_0xebe1('0x12')]));});});};exports['UpdateSquareReport']=function(_0x3976ee){var _0x241a76=this;return new Promise(function(_0x4dcb96,_0x5a51d1){return db[_0xebe1('0x15')]['update'](_0x3976ee['body'],{'raw':_0x3976ee[_0xebe1('0x17')]?_0x3976ee['options'][_0xebe1('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3976ee[_0xebe1('0x17')]?_0x3976ee[_0xebe1('0x17')]['where']||null:null,'attributes':_0x3976ee['options']?_0x3976ee['options'][_0xebe1('0x1c')]||null:null,'limit':_0x3976ee[_0xebe1('0x17')]?_0x3976ee[_0xebe1('0x17')][_0xebe1('0x1d')]||null:null})['then'](function(_0x241446){logger[_0xebe1('0x1a')]('UpdateSquareReport',_0x3976ee);logger['debug']('UpdateSquareReport',_0x3976ee,JSON[_0xebe1('0xf')](_0x241446));_0x4dcb96(_0x241446);})[_0xebe1('0x14')](function(_0x3a7450){logger[_0xebe1('0x10')](_0xebe1('0x1e'),_0x3a7450[_0xebe1('0x12')],_0x3976ee);_0x5a51d1(_0x241a76['error'](0x1f4,_0x3a7450[_0xebe1('0x12')]));});});}; \ No newline at end of file +var _0x30d9=['catch','UpdateSquareReport','update','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw'];(function(_0x53c2b9,_0x1dbc82){var _0x2c677b=function(_0x3a7310){while(--_0x3a7310){_0x53c2b9['push'](_0x53c2b9['shift']());}};_0x2c677b(++_0x1dbc82);}(_0x30d9,0xbe));var _0x930d=function(_0x5e3d96,_0xda8c2b){_0x5e3d96=_0x5e3d96-0x0;var _0x341c72=_0x30d9[_0x5e3d96];return _0x341c72;};'use strict';var _=require(_0x930d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x930d('0x1'));var rs=require(_0x930d('0x2'));var fs=require('fs');var Redis=require(_0x930d('0x3'));var db=require(_0x930d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x930d('0x5'));var config=require(_0x930d('0x6'));var jayson=require(_0x930d('0x7'));var client=jayson['client'][_0x930d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25868c,_0x2439fa,_0x1d5346){return new BPromise(function(_0x315195,_0x88c541){return client[_0x930d('0x9')](_0x25868c,_0x1d5346)[_0x930d('0xa')](function(_0x10832d){logger[_0x930d('0xb')](_0x930d('0xc'),_0x2439fa,_0x930d('0xd'));logger[_0x930d('0xe')](_0x930d('0xf'),_0x2439fa,_0x930d('0xd'),JSON[_0x930d('0x10')](_0x10832d));if(_0x10832d['error']){if(_0x10832d[_0x930d('0x11')][_0x930d('0x12')]===0x1f4){logger[_0x930d('0x11')](_0x930d('0xc'),_0x2439fa,_0x10832d[_0x930d('0x11')]['message']);return _0x88c541(_0x10832d[_0x930d('0x11')][_0x930d('0x13')]);}logger[_0x930d('0x11')](_0x930d('0xc'),_0x2439fa,_0x10832d[_0x930d('0x11')][_0x930d('0x13')]);return _0x315195(_0x10832d[_0x930d('0x11')][_0x930d('0x13')]);}else{logger[_0x930d('0xb')]('SquareReport,\x20%s,\x20%s',_0x2439fa,'request\x20sent');_0x315195(_0x10832d[_0x930d('0x14')][_0x930d('0x13')]);}})['catch'](function(_0x502abf){logger[_0x930d('0x11')](_0x930d('0xc'),_0x2439fa,_0x502abf);_0x88c541(_0x502abf);});});}exports[_0x930d('0x15')]=function(_0x45c26d){var _0x5b5602=this;return new Promise(function(_0x5565a0,_0x5d3c52){return db[_0x930d('0x16')][_0x930d('0x17')](_0x45c26d[_0x930d('0x18')],{'raw':_0x45c26d[_0x930d('0x19')]?_0x45c26d[_0x930d('0x19')][_0x930d('0x1a')]===undefined?!![]:![]:!![]})[_0x930d('0xa')](function(_0x1ac23f){logger[_0x930d('0xb')]('CreateSquareReport',_0x45c26d);logger[_0x930d('0xe')]('CreateSquareReport',_0x45c26d,JSON[_0x930d('0x10')](_0x1ac23f));_0x5565a0(_0x1ac23f);})[_0x930d('0x1b')](function(_0xf62b5f){logger[_0x930d('0x11')]('CreateSquareReport',_0xf62b5f[_0x930d('0x13')],_0x45c26d);_0x5d3c52(_0x5b5602[_0x930d('0x11')](0x1f4,_0xf62b5f[_0x930d('0x13')]));});});};exports[_0x930d('0x1c')]=function(_0x429e2f){var _0x3fea84=this;return new Promise(function(_0x36664f,_0x133dc9){return db[_0x930d('0x16')][_0x930d('0x1d')](_0x429e2f['body'],{'raw':_0x429e2f[_0x930d('0x19')]?_0x429e2f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x429e2f[_0x930d('0x19')]?_0x429e2f[_0x930d('0x19')]['where']||null:null,'attributes':_0x429e2f[_0x930d('0x19')]?_0x429e2f['options'][_0x930d('0x1e')]||null:null,'limit':_0x429e2f[_0x930d('0x19')]?_0x429e2f[_0x930d('0x19')]['limit']||null:null})[_0x930d('0xa')](function(_0x463436){logger[_0x930d('0xb')](_0x930d('0x1c'),_0x429e2f);logger['debug'](_0x930d('0x1c'),_0x429e2f,JSON[_0x930d('0x10')](_0x463436));_0x36664f(_0x463436);})['catch'](function(_0xa9ec92){logger[_0x930d('0x11')](_0x930d('0x1c'),_0xa9ec92['message'],_0x429e2f);_0x133dc9(_0x3fea84[_0x930d('0x11')](0x1f4,_0xa9ec92[_0x930d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 4ee9bd9..6a66e82 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 _0x48b3=['./squareReportDetail.controller','isAuthenticated','index','describe','/:id','post','put','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x854be7,_0x49f71b){var _0x422af4=function(_0x2faa45){while(--_0x2faa45){_0x854be7['push'](_0x854be7['shift']());}};_0x422af4(++_0x49f71b);}(_0x48b3,0x15d));var _0x348b=function(_0x342c97,_0x47ba3d){_0x342c97=_0x342c97-0x0;var _0x4b39f1=_0x48b3[_0x342c97];return _0x4b39f1;};'use strict';var multer=require(_0x348b('0x0'));var util=require('util');var path=require(_0x348b('0x1'));var timeout=require(_0x348b('0x2'));var express=require('express');var router=express[_0x348b('0x3')]();var fs_extra=require(_0x348b('0x4'));var auth=require(_0x348b('0x5'));var interaction=require(_0x348b('0x6'));var config=require(_0x348b('0x7'));var controller=require(_0x348b('0x8'));router['get']('/',auth[_0x348b('0x9')](),controller[_0x348b('0xa')]);router['get']('/describe',auth[_0x348b('0x9')](),controller[_0x348b('0xb')]);router['get'](_0x348b('0xc'),auth[_0x348b('0x9')](),controller['show']);router[_0x348b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x348b('0xe')](_0x348b('0xc'),auth[_0x348b('0x9')](),controller['update']);router[_0x348b('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x348b('0x10')]=router; \ No newline at end of file +var _0x2237=['/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','isAuthenticated','index','get'];(function(_0x26d476,_0x3790dc){var _0x28214d=function(_0x38c6e6){while(--_0x38c6e6){_0x26d476['push'](_0x26d476['shift']());}};_0x28214d(++_0x3790dc);}(_0x2237,0x81));var _0x7223=function(_0x33aa88,_0x2a0a36){_0x33aa88=_0x33aa88-0x0;var _0x2f15ce=_0x2237[_0x33aa88];return _0x2f15ce;};'use strict';var multer=require(_0x7223('0x0'));var util=require(_0x7223('0x1'));var path=require(_0x7223('0x2'));var timeout=require('connect-timeout');var express=require(_0x7223('0x3'));var router=express[_0x7223('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7223('0x5'));var interaction=require(_0x7223('0x6'));var config=require('../../config/environment');var controller=require(_0x7223('0x7'));router['get']('/',auth[_0x7223('0x8')](),controller[_0x7223('0x9')]);router[_0x7223('0xa')](_0x7223('0xb'),auth[_0x7223('0x8')](),controller['describe']);router['get'](_0x7223('0xc'),auth[_0x7223('0x8')](),controller[_0x7223('0xd')]);router[_0x7223('0xe')]('/',auth[_0x7223('0x8')](),controller['create']);router[_0x7223('0xf')](_0x7223('0xc'),auth[_0x7223('0x8')](),controller[_0x7223('0x10')]);router[_0x7223('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x7223('0x12')]);module[_0x7223('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index a4bcb3c..518c2e9 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 _0xd520=['sequelize','exports','STRING'];(function(_0x2a1b33,_0x409f50){var _0x4c50e7=function(_0x13e16d){while(--_0x13e16d){_0x2a1b33['push'](_0x2a1b33['shift']());}};_0x4c50e7(++_0x409f50);}(_0xd520,0x9c));var _0x0d52=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd520[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0d52('0x0'));module[_0x0d52('0x1')]={'uniqueid':{'type':Sequelize[_0x0d52('0x2')]},'node':{'type':Sequelize[_0x0d52('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x0d52('0x2')]}}; \ No newline at end of file +var _0xcade=['sequelize','exports','STRING','TEXT'];(function(_0x1db251,_0xf0443d){var _0x56685a=function(_0x6ec6b7){while(--_0x6ec6b7){_0x1db251['push'](_0x1db251['shift']());}};_0x56685a(++_0xf0443d);}(_0xcade,0x158));var _0xecad=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcade[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xecad('0x0'));module[_0xecad('0x1')]={'uniqueid':{'type':Sequelize[_0xecad('0x2')]},'node':{'type':Sequelize[_0xecad('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xecad('0x3')]},'project_name':{'type':Sequelize[_0xecad('0x2')]},'callerid':{'type':Sequelize[_0xecad('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index fd31746..c1f9e78 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 _0xccdf=['../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','SquareDetailsReport','catch','show','find','create','body','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util'];(function(_0x3dda0f,_0x5b9902){var _0x1b0488=function(_0x267031){while(--_0x267031){_0x3dda0f['push'](_0x3dda0f['shift']());}};_0x1b0488(++_0x5b9902);}(_0xccdf,0xbe));var _0xfccd=function(_0x2833dc,_0x4e7cec){_0x2833dc=_0x2833dc-0x0;var _0x401ece=_0xccdf[_0x2833dc];return _0x401ece;};'use strict';var emlformat=require(_0xfccd('0x0'));var rimraf=require(_0xfccd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfccd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfccd('0x3'));var Mustache=require(_0xfccd('0x4'));var util=require('util');var path=require(_0xfccd('0x5'));var sox=require(_0xfccd('0x6'));var csv=require(_0xfccd('0x7'));var ejs=require(_0xfccd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfccd('0x9'));var squel=require('squel');var crypto=require(_0xfccd('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfccd('0xb'));var toCsv=require(_0xfccd('0x7'));var querystring=require(_0xfccd('0xc'));var Papa=require(_0xfccd('0xd'));var Redis=require(_0xfccd('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfccd('0xf'));var hardwareService=require(_0xfccd('0x10'));var logger=require(_0xfccd('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xfccd('0x12'));var licenseUtil=require(_0xfccd('0x13'));var db=require(_0xfccd('0x14'))['db'];function respondWithStatusCode(_0x1540a7,_0x4415c3){_0x4415c3=_0x4415c3||0xcc;return function(_0x1a9bb6){if(_0x1a9bb6){return _0x1540a7[_0xfccd('0x15')](_0x4415c3);}return _0x1540a7[_0xfccd('0x16')](_0x4415c3)[_0xfccd('0x17')]();};}function respondWithResult(_0x1497b4,_0x2bd703){_0x2bd703=_0x2bd703||0xc8;return function(_0x261a8d){if(_0x261a8d){return _0x1497b4[_0xfccd('0x16')](_0x2bd703)['json'](_0x261a8d);}};}function respondWithFilteredResult(_0x266921,_0x83ed8c){return function(_0x324ab5){if(_0x324ab5){var _0x254752=typeof _0x83ed8c[_0xfccd('0x18')]===_0xfccd('0x19')&&typeof _0x83ed8c[_0xfccd('0x1a')]===_0xfccd('0x19');var _0x3f743a=_0x324ab5['count'];var _0x129c85=_0x254752?0x0:_0x83ed8c['offset'];var _0xa4adf2=_0x254752?_0x324ab5[_0xfccd('0x1b')]:_0x83ed8c[_0xfccd('0x18')]+_0x83ed8c[_0xfccd('0x1a')];var _0xbac53;if(_0xa4adf2>=_0x3f743a){_0xa4adf2=_0x3f743a;_0xbac53=0xc8;}else{_0xbac53=0xce;}_0x266921['status'](_0xbac53);return _0x266921[_0xfccd('0x1c')](_0xfccd('0x1d'),_0x129c85+'-'+_0xa4adf2+'/'+_0x3f743a)[_0xfccd('0x1e')](_0x324ab5);}return null;};}function patchUpdates(_0x23c678){return function(_0x272e75){try{jsonpatch['apply'](_0x272e75,_0x23c678,!![]);}catch(_0xcdf9db){return BPromise[_0xfccd('0x1f')](_0xcdf9db);}return _0x272e75[_0xfccd('0x20')]();};}function saveUpdates(_0x27c725,_0x464ca8){return function(_0x473579){if(_0x473579){return _0x473579[_0xfccd('0x21')](_0x27c725)[_0xfccd('0x22')](function(_0x2f27fc){return _0x2f27fc;});}return null;};}function removeEntity(_0x550686,_0x586a9c){return function(_0x494472){if(_0x494472){return _0x494472[_0xfccd('0x23')]()['then'](function(){_0x550686[_0xfccd('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2efcf1,_0x4ebec7){return function(_0x3ac7cc){if(!_0x3ac7cc){_0x2efcf1['sendStatus'](0x194);}return _0x3ac7cc;};}function handleError(_0x4fe4ca,_0x272706){_0x272706=_0x272706||0x1f4;return function(_0x32620c){logger[_0xfccd('0x24')](_0x32620c[_0xfccd('0x25')]);if(_0x32620c['name']){delete _0x32620c[_0xfccd('0x26')];}_0x4fe4ca[_0xfccd('0x16')](_0x272706)[_0xfccd('0x27')](_0x32620c);};}exports[_0xfccd('0x28')]=function(_0x135919,_0xa8dad0){var _0x17ed04={},_0x574fb8={},_0x2bd1af={'count':0x0,'rows':[]};var _0x44e647=_[_0xfccd('0x29')](db['SquareDetailsReport'][_0xfccd('0x2a')],function(_0x39fcc4){return{'name':_0x39fcc4['fieldName'],'type':_0x39fcc4['type'][_0xfccd('0x2b')]};});_0x574fb8[_0xfccd('0x2c')]=_[_0xfccd('0x29')](_0x44e647,_0xfccd('0x26'));_0x574fb8[_0xfccd('0x2d')]=_[_0xfccd('0x2e')](_0x135919[_0xfccd('0x2d')]);_0x574fb8['filters']=_['intersection'](_0x574fb8[_0xfccd('0x2c')],_0x574fb8[_0xfccd('0x2d')]);_0x17ed04[_0xfccd('0x2f')]=_[_0xfccd('0x30')](_0x574fb8[_0xfccd('0x2c')],qs['fields'](_0x135919[_0xfccd('0x2d')][_0xfccd('0x31')]));_0x17ed04[_0xfccd('0x2f')]=_0x17ed04[_0xfccd('0x2f')][_0xfccd('0x32')]?_0x17ed04[_0xfccd('0x2f')]:_0x574fb8[_0xfccd('0x2c')];if(!_0x135919[_0xfccd('0x2d')][_0xfccd('0x33')]('nolimit')){_0x17ed04[_0xfccd('0x1a')]=qs['limit'](_0x135919[_0xfccd('0x2d')][_0xfccd('0x1a')]);_0x17ed04[_0xfccd('0x18')]=qs[_0xfccd('0x18')](_0x135919[_0xfccd('0x2d')][_0xfccd('0x18')]);}_0x17ed04[_0xfccd('0x34')]=qs[_0xfccd('0x35')](_0x135919[_0xfccd('0x2d')][_0xfccd('0x35')]);_0x17ed04[_0xfccd('0x36')]=qs[_0xfccd('0x37')](_[_0xfccd('0x38')](_0x135919[_0xfccd('0x2d')],_0x574fb8[_0xfccd('0x37')]),_0x44e647);if(_0x135919[_0xfccd('0x2d')][_0xfccd('0x39')]){_0x17ed04[_0xfccd('0x36')]=_[_0xfccd('0x3a')](_0x17ed04[_0xfccd('0x36')],{'$or':_[_0xfccd('0x29')](_0x44e647,function(_0xd5ce62){if(_0xd5ce62[_0xfccd('0x3b')]!=='VIRTUAL'){var _0x19801f={};_0x19801f[_0xd5ce62[_0xfccd('0x26')]]={'$like':'%'+_0x135919['query'][_0xfccd('0x39')]+'%'};return _0x19801f;}})});}_0x17ed04=_['merge']({},_0x17ed04,_0x135919[_0xfccd('0x3c')]);var _0x22f120={'where':_0x17ed04['where']};return db['SquareDetailsReport'][_0xfccd('0x1b')](_0x22f120)[_0xfccd('0x22')](function(_0x216211){_0x2bd1af[_0xfccd('0x1b')]=_0x216211;if(_0x135919['query'][_0xfccd('0x3d')]){_0x17ed04[_0xfccd('0x3e')]=[{'all':!![]}];}return db[_0xfccd('0x3f')]['findAll'](_0x17ed04);})[_0xfccd('0x22')](function(_0x8a8418){_0x2bd1af['rows']=_0x8a8418;return _0x2bd1af;})[_0xfccd('0x22')](respondWithFilteredResult(_0xa8dad0,_0x17ed04))[_0xfccd('0x40')](handleError(_0xa8dad0,null));};exports[_0xfccd('0x41')]=function(_0x54fbeb,_0x2c133f){var _0x473673={'raw':!![],'where':{'id':_0x54fbeb['params']['id']}},_0x88da11={};_0x88da11['model']=_['keys'](db[_0xfccd('0x3f')][_0xfccd('0x2a')]);_0x88da11[_0xfccd('0x2d')]=_[_0xfccd('0x2e')](_0x54fbeb[_0xfccd('0x2d')]);_0x88da11[_0xfccd('0x37')]=_[_0xfccd('0x30')](_0x88da11[_0xfccd('0x2c')],_0x88da11[_0xfccd('0x2d')]);_0x473673['attributes']=_['intersection'](_0x88da11[_0xfccd('0x2c')],qs[_0xfccd('0x31')](_0x54fbeb[_0xfccd('0x2d')]['fields']));_0x473673['attributes']=_0x473673[_0xfccd('0x2f')][_0xfccd('0x32')]?_0x473673[_0xfccd('0x2f')]:_0x88da11[_0xfccd('0x2c')];if(_0x54fbeb['query'][_0xfccd('0x3d')]){_0x473673['include']=[{'all':!![]}];}_0x473673=_[_0xfccd('0x3a')]({},_0x473673,_0x54fbeb[_0xfccd('0x3c')]);return db[_0xfccd('0x3f')][_0xfccd('0x42')](_0x473673)[_0xfccd('0x22')](handleEntityNotFound(_0x2c133f,null))[_0xfccd('0x22')](respondWithResult(_0x2c133f,null))['catch'](handleError(_0x2c133f,null));};exports[_0xfccd('0x43')]=function(_0xf02981,_0x7f2bfc){return db[_0xfccd('0x3f')][_0xfccd('0x43')](_0xf02981[_0xfccd('0x44')],{})[_0xfccd('0x22')](respondWithResult(_0x7f2bfc,0xc9))['catch'](handleError(_0x7f2bfc,null));};exports[_0xfccd('0x21')]=function(_0x5520e6,_0x342316){if(_0x5520e6[_0xfccd('0x44')]['id']){delete _0x5520e6[_0xfccd('0x44')]['id'];}return db[_0xfccd('0x3f')][_0xfccd('0x42')]({'where':{'id':_0x5520e6['params']['id']}})['then'](handleEntityNotFound(_0x342316,null))[_0xfccd('0x22')](saveUpdates(_0x5520e6['body'],null))[_0xfccd('0x22')](respondWithResult(_0x342316,null))[_0xfccd('0x40')](handleError(_0x342316,null));};exports[_0xfccd('0x23')]=function(_0x4c87f3,_0x25cac2){return db[_0xfccd('0x3f')][_0xfccd('0x42')]({'where':{'id':_0x4c87f3['params']['id']}})[_0xfccd('0x22')](handleEntityNotFound(_0x25cac2,null))[_0xfccd('0x22')](removeEntity(_0x25cac2,null))[_0xfccd('0x40')](handleError(_0x25cac2,null));};exports[_0xfccd('0x45')]=function(_0x5190b2,_0x21da78){return db[_0xfccd('0x3f')][_0xfccd('0x45')]()[_0xfccd('0x22')](respondWithResult(_0x21da78,null))[_0xfccd('0x40')](handleError(_0x21da78,null));}; \ No newline at end of file +var _0x101a=['util','to-csv','ejs','fs-extra','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','json','offset','undefined','limit','count','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','SquareDetailsReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x4b96d1,_0x5c5faf){var _0x926452=function(_0x5c424b){while(--_0x5c424b){_0x4b96d1['push'](_0x4b96d1['shift']());}};_0x926452(++_0x5c5faf);}(_0x101a,0x11a));var _0xa101=function(_0x39925a,_0x29e311){_0x39925a=_0x39925a-0x0;var _0x260bbc=_0x101a[_0x39925a];return _0x260bbc;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa101('0x0'));var jsonpatch=require(_0xa101('0x1'));var rp=require(_0xa101('0x2'));var moment=require(_0xa101('0x3'));var BPromise=require(_0xa101('0x4'));var Mustache=require(_0xa101('0x5'));var util=require(_0xa101('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa101('0x7'));var ejs=require(_0xa101('0x8'));var fs=require('fs');var fs_extra=require(_0xa101('0x9'));var _=require('lodash');var squel=require(_0xa101('0xa'));var crypto=require('crypto');var jsforce=require(_0xa101('0xb'));var deskjs=require(_0xa101('0xc'));var toCsv=require(_0xa101('0x7'));var querystring=require(_0xa101('0xd'));var Papa=require(_0xa101('0xe'));var Redis=require(_0xa101('0xf'));var authService=require(_0xa101('0x10'));var qs=require(_0xa101('0x11'));var as=require(_0xa101('0x12'));var hardwareService=require(_0xa101('0x13'));var logger=require(_0xa101('0x14'))(_0xa101('0x15'));var utils=require(_0xa101('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa101('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5aac38,_0x261070){_0x261070=_0x261070||0xcc;return function(_0x35fddf){if(_0x35fddf){return _0x5aac38[_0xa101('0x18')](_0x261070);}return _0x5aac38[_0xa101('0x19')](_0x261070)['end']();};}function respondWithResult(_0x1bd9db,_0x5a16a0){_0x5a16a0=_0x5a16a0||0xc8;return function(_0x25f5de){if(_0x25f5de){return _0x1bd9db[_0xa101('0x19')](_0x5a16a0)[_0xa101('0x1a')](_0x25f5de);}};}function respondWithFilteredResult(_0x4c49b5,_0x4c9074){return function(_0x38575e){if(_0x38575e){var _0x4af614=typeof _0x4c9074[_0xa101('0x1b')]===_0xa101('0x1c')&&typeof _0x4c9074[_0xa101('0x1d')]==='undefined';var _0x5521a1=_0x38575e[_0xa101('0x1e')];var _0x339161=_0x4af614?0x0:_0x4c9074[_0xa101('0x1b')];var _0x40d98a=_0x4af614?_0x38575e[_0xa101('0x1e')]:_0x4c9074[_0xa101('0x1b')]+_0x4c9074[_0xa101('0x1d')];var _0x281838;if(_0x40d98a>=_0x5521a1){_0x40d98a=_0x5521a1;_0x281838=0xc8;}else{_0x281838=0xce;}_0x4c49b5[_0xa101('0x19')](_0x281838);return _0x4c49b5['set']('Content-Range',_0x339161+'-'+_0x40d98a+'/'+_0x5521a1)['json'](_0x38575e);}return null;};}function patchUpdates(_0x39b2d9){return function(_0x13858e){try{jsonpatch['apply'](_0x13858e,_0x39b2d9,!![]);}catch(_0x3168b6){return BPromise['reject'](_0x3168b6);}return _0x13858e['save']();};}function saveUpdates(_0x2da999,_0x47b684){return function(_0xa3ec1d){if(_0xa3ec1d){return _0xa3ec1d[_0xa101('0x1f')](_0x2da999)['then'](function(_0x41e6d8){return _0x41e6d8;});}return null;};}function removeEntity(_0x541562,_0xa065d4){return function(_0x198a50){if(_0x198a50){return _0x198a50[_0xa101('0x20')]()[_0xa101('0x21')](function(){_0x541562[_0xa101('0x19')](0xcc)[_0xa101('0x22')]();});}};}function handleEntityNotFound(_0x37432d,_0x4032fd){return function(_0x16680e){if(!_0x16680e){_0x37432d[_0xa101('0x18')](0x194);}return _0x16680e;};}function handleError(_0x5c24ea,_0x34a54b){_0x34a54b=_0x34a54b||0x1f4;return function(_0x1f6e9d){logger['error'](_0x1f6e9d['stack']);if(_0x1f6e9d['name']){delete _0x1f6e9d[_0xa101('0x23')];}_0x5c24ea[_0xa101('0x19')](_0x34a54b)[_0xa101('0x24')](_0x1f6e9d);};}exports[_0xa101('0x25')]=function(_0x1ecec4,_0x21941a){var _0x5537c4={},_0x156662={},_0x3cc385={'count':0x0,'rows':[]};var _0x1d2a1d=_[_0xa101('0x26')](db['SquareDetailsReport'][_0xa101('0x27')],function(_0xb6bc07){return{'name':_0xb6bc07[_0xa101('0x28')],'type':_0xb6bc07[_0xa101('0x29')][_0xa101('0x2a')]};});_0x156662['model']=_[_0xa101('0x26')](_0x1d2a1d,_0xa101('0x23'));_0x156662[_0xa101('0x2b')]=_[_0xa101('0x2c')](_0x1ecec4[_0xa101('0x2b')]);_0x156662[_0xa101('0x2d')]=_[_0xa101('0x2e')](_0x156662[_0xa101('0x2f')],_0x156662[_0xa101('0x2b')]);_0x5537c4['attributes']=_[_0xa101('0x2e')](_0x156662[_0xa101('0x2f')],qs[_0xa101('0x30')](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x30')]));_0x5537c4[_0xa101('0x31')]=_0x5537c4[_0xa101('0x31')][_0xa101('0x32')]?_0x5537c4[_0xa101('0x31')]:_0x156662['model'];if(!_0x1ecec4[_0xa101('0x2b')][_0xa101('0x33')](_0xa101('0x34'))){_0x5537c4[_0xa101('0x1d')]=qs['limit'](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x1d')]);_0x5537c4['offset']=qs[_0xa101('0x1b')](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x1b')]);}_0x5537c4[_0xa101('0x35')]=qs[_0xa101('0x36')](_0x1ecec4[_0xa101('0x2b')][_0xa101('0x36')]);_0x5537c4[_0xa101('0x37')]=qs[_0xa101('0x2d')](_['pick'](_0x1ecec4[_0xa101('0x2b')],_0x156662['filters']),_0x1d2a1d);if(_0x1ecec4[_0xa101('0x2b')]['filter']){_0x5537c4[_0xa101('0x37')]=_['merge'](_0x5537c4[_0xa101('0x37')],{'$or':_[_0xa101('0x26')](_0x1d2a1d,function(_0x526294){if(_0x526294['type']!==_0xa101('0x38')){var _0xaa04a2={};_0xaa04a2[_0x526294[_0xa101('0x23')]]={'$like':'%'+_0x1ecec4['query'][_0xa101('0x39')]+'%'};return _0xaa04a2;}})});}_0x5537c4=_[_0xa101('0x3a')]({},_0x5537c4,_0x1ecec4[_0xa101('0x3b')]);var _0x91c81b={'where':_0x5537c4[_0xa101('0x37')]};return db[_0xa101('0x3c')][_0xa101('0x1e')](_0x91c81b)['then'](function(_0x470971){_0x3cc385[_0xa101('0x1e')]=_0x470971;if(_0x1ecec4['query'][_0xa101('0x3d')]){_0x5537c4[_0xa101('0x3e')]=[{'all':!![]}];}return db[_0xa101('0x3c')][_0xa101('0x3f')](_0x5537c4);})[_0xa101('0x21')](function(_0x1d7ef1){_0x3cc385[_0xa101('0x40')]=_0x1d7ef1;return _0x3cc385;})[_0xa101('0x21')](respondWithFilteredResult(_0x21941a,_0x5537c4))[_0xa101('0x41')](handleError(_0x21941a,null));};exports[_0xa101('0x42')]=function(_0x28bdee,_0x42b4f5){var _0x35c68e={'raw':!![],'where':{'id':_0x28bdee[_0xa101('0x43')]['id']}},_0x569a79={};_0x569a79[_0xa101('0x2f')]=_[_0xa101('0x2c')](db[_0xa101('0x3c')]['rawAttributes']);_0x569a79['query']=_['keys'](_0x28bdee['query']);_0x569a79[_0xa101('0x2d')]=_[_0xa101('0x2e')](_0x569a79[_0xa101('0x2f')],_0x569a79[_0xa101('0x2b')]);_0x35c68e[_0xa101('0x31')]=_['intersection'](_0x569a79[_0xa101('0x2f')],qs[_0xa101('0x30')](_0x28bdee[_0xa101('0x2b')][_0xa101('0x30')]));_0x35c68e[_0xa101('0x31')]=_0x35c68e[_0xa101('0x31')][_0xa101('0x32')]?_0x35c68e[_0xa101('0x31')]:_0x569a79['model'];if(_0x28bdee[_0xa101('0x2b')]['includeAll']){_0x35c68e[_0xa101('0x3e')]=[{'all':!![]}];}_0x35c68e=_[_0xa101('0x3a')]({},_0x35c68e,_0x28bdee[_0xa101('0x3b')]);return db[_0xa101('0x3c')]['find'](_0x35c68e)[_0xa101('0x21')](handleEntityNotFound(_0x42b4f5,null))[_0xa101('0x21')](respondWithResult(_0x42b4f5,null))[_0xa101('0x41')](handleError(_0x42b4f5,null));};exports[_0xa101('0x44')]=function(_0x42e4a2,_0x5b9ef0){return db[_0xa101('0x3c')][_0xa101('0x44')](_0x42e4a2[_0xa101('0x45')],{})[_0xa101('0x21')](respondWithResult(_0x5b9ef0,0xc9))[_0xa101('0x41')](handleError(_0x5b9ef0,null));};exports[_0xa101('0x1f')]=function(_0x15385f,_0x50fcbb){if(_0x15385f[_0xa101('0x45')]['id']){delete _0x15385f['body']['id'];}return db['SquareDetailsReport'][_0xa101('0x46')]({'where':{'id':_0x15385f[_0xa101('0x43')]['id']}})[_0xa101('0x21')](handleEntityNotFound(_0x50fcbb,null))[_0xa101('0x21')](saveUpdates(_0x15385f[_0xa101('0x45')],null))['then'](respondWithResult(_0x50fcbb,null))[_0xa101('0x41')](handleError(_0x50fcbb,null));};exports[_0xa101('0x20')]=function(_0x319d2d,_0x531efd){return db[_0xa101('0x3c')][_0xa101('0x46')]({'where':{'id':_0x319d2d[_0xa101('0x43')]['id']}})[_0xa101('0x21')](handleEntityNotFound(_0x531efd,null))[_0xa101('0x21')](removeEntity(_0x531efd,null))['catch'](handleError(_0x531efd,null));};exports[_0xa101('0x47')]=function(_0x58679a,_0x1417b7){return db['SquareDetailsReport'][_0xa101('0x47')]()[_0xa101('0x21')](respondWithResult(_0x1417b7,null))[_0xa101('0x41')](handleError(_0x1417b7,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 1a31891..d3b41ae 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 _0x8b7c=['../../config/logger','api','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','define','report_square_details','lodash'];(function(_0x42fba4,_0x588b08){var _0x362ebf=function(_0x767897){while(--_0x767897){_0x42fba4['push'](_0x42fba4['shift']());}};_0x362ebf(++_0x588b08);}(_0x8b7c,0x11f));var _0xc8b7=function(_0x5dd69b,_0x118e05){_0x5dd69b=_0x5dd69b-0x0;var _0x1bc678=_0x8b7c[_0x5dd69b];return _0x1bc678;};'use strict';var _=require(_0xc8b7('0x0'));var util=require('util');var logger=require(_0xc8b7('0x1'))(_0xc8b7('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc8b7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc8b7('0x4'));var config=require(_0xc8b7('0x5'));var attributes=require(_0xc8b7('0x6'));module['exports']=function(_0x24a70b,_0x11c656){return _0x24a70b[_0xc8b7('0x7')]('SquareDetailsReport',attributes,{'tableName':_0xc8b7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x290a=['report_square_details','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x5717d8,_0x52e576){var _0x51eacb=function(_0x469b61){while(--_0x469b61){_0x5717d8['push'](_0x5717d8['shift']());}};_0x51eacb(++_0x52e576);}(_0x290a,0xdd));var _0xa290=function(_0x4b3746,_0x3d94f1){_0x4b3746=_0x4b3746-0x0;var _0x38e1a3=_0x290a[_0x4b3746];return _0x38e1a3;};'use strict';var _=require(_0xa290('0x0'));var util=require(_0xa290('0x1'));var logger=require(_0xa290('0x2'))('api');var moment=require('moment');var BPromise=require(_0xa290('0x3'));var rp=require(_0xa290('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa290('0x5'));var config=require(_0xa290('0x6'));var attributes=require(_0xa290('0x7'));module['exports']=function(_0x497af6,_0x124069){return _0x497af6[_0xa290('0x8')](_0xa290('0x9'),attributes,{'tableName':_0xa290('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 8f95e99..559b838 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 _0xae60=['client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x84c858,_0x32c06a){var _0x566333=function(_0x21489d){while(--_0x21489d){_0x84c858['push'](_0x84c858['shift']());}};_0x566333(++_0x32c06a);}(_0xae60,0x1c7));var _0x0ae6=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xae60[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x0ae6('0x0'));var util=require(_0x0ae6('0x1'));var moment=require(_0x0ae6('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ae6('0x3'));var fs=require('fs');var Redis=require(_0x0ae6('0x4'));var db=require(_0x0ae6('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ae6('0x6'))(_0x0ae6('0x7'));var config=require('../../config/environment');var jayson=require(_0x0ae6('0x8'));var client=jayson[_0x0ae6('0x9')][_0x0ae6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fed4,_0xbb596c,_0x447a1d){return new BPromise(function(_0x120910,_0x1b5e80){return client['request'](_0x46fed4,_0x447a1d)[_0x0ae6('0xb')](function(_0x36a5e0){logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,'request\x20sent');logger[_0x0ae6('0xe')](_0x0ae6('0xf'),_0xbb596c,_0x0ae6('0x10'),JSON[_0x0ae6('0x11')](_0x36a5e0));if(_0x36a5e0[_0x0ae6('0x12')]){if(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x13')]===0x1f4){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x1b5e80(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}logger[_0x0ae6('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0xbb596c,_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);return _0x120910(_0x36a5e0[_0x0ae6('0x12')][_0x0ae6('0x14')]);}else{logger[_0x0ae6('0xc')](_0x0ae6('0xd'),_0xbb596c,_0x0ae6('0x10'));_0x120910(_0x36a5e0[_0x0ae6('0x15')][_0x0ae6('0x14')]);}})[_0x0ae6('0x16')](function(_0x8a4c9a){logger[_0x0ae6('0x12')](_0x0ae6('0xd'),_0xbb596c,_0x8a4c9a);_0x1b5e80(_0x8a4c9a);});});}exports[_0x0ae6('0x17')]=function(_0xda4f01){var _0x3f5c41=this;return new Promise(function(_0x2fdf25,_0x1735ba){return db[_0x0ae6('0x18')][_0x0ae6('0x19')](_0xda4f01[_0x0ae6('0x1a')],{'raw':_0xda4f01[_0x0ae6('0x1b')]?_0xda4f01['options'][_0x0ae6('0x1c')]===undefined?!![]:![]:!![]})[_0x0ae6('0xb')](function(_0x140a3b){logger[_0x0ae6('0xc')](_0x0ae6('0x17'),_0xda4f01);logger[_0x0ae6('0xe')](_0x0ae6('0x17'),_0xda4f01,JSON[_0x0ae6('0x11')](_0x140a3b));_0x2fdf25(_0x140a3b);})['catch'](function(_0x39b22e){logger[_0x0ae6('0x12')](_0x0ae6('0x17'),_0x39b22e[_0x0ae6('0x14')],_0xda4f01);_0x1735ba(_0x3f5c41[_0x0ae6('0x12')](0x1f4,_0x39b22e['message']));});});}; \ No newline at end of file +var _0x7462=['request\x20sent','debug','stringify','error','code','message','catch','CreateSquareDetailsReport','create','options','raw','info','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','SquareDetailsReport,\x20%s,\x20%s'];(function(_0x4222de,_0x567252){var _0x1ff142=function(_0x4859ae){while(--_0x4859ae){_0x4222de['push'](_0x4222de['shift']());}};_0x1ff142(++_0x567252);}(_0x7462,0x165));var _0x2746=function(_0xf89c3,_0x351bf1){_0xf89c3=_0xf89c3-0x0;var _0x274fc8=_0x7462[_0xf89c3];return _0x274fc8;};'use strict';var _=require(_0x2746('0x0'));var util=require(_0x2746('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2746('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2746('0x3'));var logger=require(_0x2746('0x4'))('rpc');var config=require(_0x2746('0x5'));var jayson=require(_0x2746('0x6'));var client=jayson[_0x2746('0x7')][_0x2746('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a2f42,_0x2940d8,_0x1447bc){return new BPromise(function(_0x40ad2b,_0x283327){return client['request'](_0x2a2f42,_0x1447bc)[_0x2746('0x9')](function(_0x2e4713){logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));logger[_0x2746('0xc')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x2940d8,_0x2746('0xb'),JSON[_0x2746('0xd')](_0x2e4713));if(_0x2e4713[_0x2746('0xe')]){if(_0x2e4713[_0x2746('0xe')][_0x2746('0xf')]===0x1f4){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x283327(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2940d8,_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);return _0x40ad2b(_0x2e4713[_0x2746('0xe')][_0x2746('0x10')]);}else{logger['info'](_0x2746('0xa'),_0x2940d8,_0x2746('0xb'));_0x40ad2b(_0x2e4713['result']['message']);}})[_0x2746('0x11')](function(_0x43f06c){logger[_0x2746('0xe')](_0x2746('0xa'),_0x2940d8,_0x43f06c);_0x283327(_0x43f06c);});});}exports[_0x2746('0x12')]=function(_0x232108){var _0x3556b5=this;return new Promise(function(_0x6102f3,_0x25c122){return db['SquareDetailsReport'][_0x2746('0x13')](_0x232108['body'],{'raw':_0x232108[_0x2746('0x14')]?_0x232108[_0x2746('0x14')][_0x2746('0x15')]===undefined?!![]:![]:!![]})[_0x2746('0x9')](function(_0xa64e76){logger[_0x2746('0x16')](_0x2746('0x12'),_0x232108);logger[_0x2746('0xc')](_0x2746('0x12'),_0x232108,JSON['stringify'](_0xa64e76));_0x6102f3(_0xa64e76);})['catch'](function(_0x7390b3){logger[_0x2746('0xe')](_0x2746('0x12'),_0x7390b3['message'],_0x232108);_0x25c122(_0x3556b5[_0x2746('0xe')](0x1f4,_0x7390b3[_0x2746('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index ef39343..f245c13 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 _0x929a=['../../components/auth/service','./system.controller','isAuthenticated','index','get','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x44266b,_0x4c6155){var _0x44ac03=function(_0x3a4032){while(--_0x3a4032){_0x44266b['push'](_0x44266b['shift']());}};_0x44ac03(++_0x4c6155);}(_0x929a,0x1d4));var _0xa929=function(_0x24dafd,_0x1a8af9){_0x24dafd=_0x24dafd-0x0;var _0x5e8ef6=_0x929a[_0x24dafd];return _0x5e8ef6;};'use strict';var express=require(_0xa929('0x0'));var router=express[_0xa929('0x1')]();var auth=require(_0xa929('0x2'));var controller=require(_0xa929('0x3'));router['get']('/',auth[_0xa929('0x4')](),controller[_0xa929('0x5')]);router[_0xa929('0x6')](_0xa929('0x7'),auth[_0xa929('0x4')](),controller[_0xa929('0x8')]);module[_0xa929('0x9')]=router; \ No newline at end of file +var _0x1d10=['Router','./system.controller','get','isAuthenticated','index','/process/:pid/kill','killProcess','express'];(function(_0x195c21,_0x332612){var _0x3576a8=function(_0xa4bde2){while(--_0xa4bde2){_0x195c21['push'](_0x195c21['shift']());}};_0x3576a8(++_0x332612);}(_0x1d10,0x97));var _0x01d1=function(_0x108534,_0x6a908f){_0x108534=_0x108534-0x0;var _0x10debc=_0x1d10[_0x108534];return _0x10debc;};'use strict';var express=require(_0x01d1('0x0'));var router=express[_0x01d1('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x01d1('0x2'));router[_0x01d1('0x3')]('/',auth[_0x01d1('0x4')](),controller[_0x01d1('0x5')]);router['get'](_0x01d1('0x6'),auth[_0x01d1('0x4')](),controller[_0x01d1('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 256b38c..5aa4944 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 _0x7cf9=['SIGINT','json','systeminformation','child_process','exec','../../config/logger','lodash','inspect','name','status','send','index','getAllData','then','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','kill'];(function(_0xd1bd2b,_0x43ead3){var _0x466676=function(_0x4062eb){while(--_0x4062eb){_0xd1bd2b['push'](_0xd1bd2b['shift']());}};_0x466676(++_0x43ead3);}(_0x7cf9,0x120));var _0x97cf=function(_0x349de1,_0x49fb3b){_0x349de1=_0x349de1-0x0;var _0x15c4e5=_0x7cf9[_0x349de1];return _0x15c4e5;};'use strict';var info=require(_0x97cf('0x0'));var exec=require(_0x97cf('0x1'))[_0x97cf('0x2')];var logger=require(_0x97cf('0x3'))('api');var util=require('util');var BPromise=require('bluebird');var _=require(_0x97cf('0x4'));function handleError(_0x18a895,_0x303a66,_0x40274a){_0x303a66=_0x303a66||0x1f4;return function(_0x2ef0c9){logger['error']('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x40274a,_0x303a66,util[_0x97cf('0x5')](_0x2ef0c9,{'showHidden':![],'depth':null}));delete _0x2ef0c9[_0x97cf('0x6')];_0x18a895[_0x97cf('0x7')](_0x303a66)[_0x97cf('0x8')](_0x2ef0c9);};}exports[_0x97cf('0x9')]=function(_0x473ad0,_0x33bc55){return info[_0x97cf('0xa')]()[_0x97cf('0xb')](function(_0x352920){return _0x33bc55[_0x97cf('0x7')](0xc8)['json'](_0x352920);})[_0x97cf('0xc')](function(_0x12cbe7){return _0x33bc55[_0x97cf('0x7')](0x1f4)['json'](_0x12cbe7);});};exports[_0x97cf('0xd')]=function(_0x112572,_0x368988){var _0x884931=[_0x97cf('0xe')];return new BPromise(function(_0x155ee0,_0x26fff9){return exec(util[_0x97cf('0xf')](_0x97cf('0x10'),_0x112572['params'][_0x97cf('0x11')]),function(_0x1c8b80,_0x548ef4,_0x14c391){if(_0x1c8b80){return _0x26fff9(_0x1c8b80);}return _0x155ee0(_0x548ef4);});})['then'](function(_0x579bb3){var _0xecf317=![];var _0x3bec0f=_0x579bb3[_0x97cf('0x12')](/\n/);for(var _0x145cce=0x0,_0x1d34db=_0x884931[_0x97cf('0x13')];_0x145cce<_0x1d34db,_0xecf317===![];_0x145cce+=0x1){if(_0x579bb3[_0x97cf('0x14')](_0x884931[_0x145cce])>=0x0){_0xecf317=!![];}}if(!_0xecf317){throw new Error(util[_0x97cf('0xf')](_0x97cf('0x15'),_0x112572[_0x97cf('0x16')][_0x97cf('0x11')]));}process[_0x97cf('0x17')](_0x112572[_0x97cf('0x16')][_0x97cf('0x11')],_0x97cf('0x18'));return _0x368988[_0x97cf('0x7')](0xc8)[_0x97cf('0x19')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x112572[_0x97cf('0x16')][_0x97cf('0x11')])});})[_0x97cf('0xc')](handleError(_0x368988,null,'killProcess'));}; \ No newline at end of file +var _0x10a4=['ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','killProcess','systeminformation','child_process','exec','../../config/logger','util','lodash','error','name','status','send','index','then','json','catch','components/import/cm','format'];(function(_0x1e17eb,_0x2e15c5){var _0x4de4c7=function(_0x52d003){while(--_0x52d003){_0x1e17eb['push'](_0x1e17eb['shift']());}};_0x4de4c7(++_0x2e15c5);}(_0x10a4,0xda));var _0x410a=function(_0x333160,_0x4c1df7){_0x333160=_0x333160-0x0;var _0x256d5a=_0x10a4[_0x333160];return _0x256d5a;};'use strict';var info=require(_0x410a('0x0'));var exec=require(_0x410a('0x1'))[_0x410a('0x2')];var logger=require(_0x410a('0x3'))('api');var util=require(_0x410a('0x4'));var BPromise=require('bluebird');var _=require(_0x410a('0x5'));function handleError(_0x1edabd,_0x170b9f,_0x40e17f){_0x170b9f=_0x170b9f||0x1f4;return function(_0x36c194){logger[_0x410a('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x40e17f,_0x170b9f,util['inspect'](_0x36c194,{'showHidden':![],'depth':null}));delete _0x36c194[_0x410a('0x7')];_0x1edabd[_0x410a('0x8')](_0x170b9f)[_0x410a('0x9')](_0x36c194);};}exports[_0x410a('0xa')]=function(_0x2e4412,_0x25cdad){return info['getAllData']()[_0x410a('0xb')](function(_0x126493){return _0x25cdad[_0x410a('0x8')](0xc8)[_0x410a('0xc')](_0x126493);})[_0x410a('0xd')](function(_0x2f2981){return _0x25cdad[_0x410a('0x8')](0x1f4)['json'](_0x2f2981);});};exports['killProcess']=function(_0x4f8622,_0x398379){var _0x5d975f=[_0x410a('0xe')];return new BPromise(function(_0x2934ce,_0x3fa77f){return exec(util[_0x410a('0xf')](_0x410a('0x10'),_0x4f8622[_0x410a('0x11')][_0x410a('0x12')]),function(_0x537e88,_0x49518d,_0x10b845){if(_0x537e88){return _0x3fa77f(_0x537e88);}return _0x2934ce(_0x49518d);});})['then'](function(_0x4f55fe){var _0x24a5e9=![];var _0x3c3b61=_0x4f55fe[_0x410a('0x13')](/\n/);for(var _0x53ce58=0x0,_0x25d981=_0x5d975f[_0x410a('0x14')];_0x53ce58<_0x25d981,_0x24a5e9===![];_0x53ce58+=0x1){if(_0x4f55fe[_0x410a('0x15')](_0x5d975f[_0x53ce58])>=0x0){_0x24a5e9=!![];}}if(!_0x24a5e9){throw new Error(util[_0x410a('0xf')](_0x410a('0x16'),_0x4f8622[_0x410a('0x11')][_0x410a('0x12')]));}process[_0x410a('0x17')](_0x4f8622['params'][_0x410a('0x12')],_0x410a('0x18'));return _0x398379[_0x410a('0x8')](0xc8)['json']({'message':util[_0x410a('0xf')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x4f8622[_0x410a('0x11')]['pid'])});})['catch'](handleError(_0x398379,null,_0x410a('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 6b03b04..88ded93 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 _0xe334=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','create','destroy','exports','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5ba435,_0x34aa9e){var _0x17d643=function(_0x2a0c5e){while(--_0x2a0c5e){_0x5ba435['push'](_0x5ba435['shift']());}};_0x17d643(++_0x34aa9e);}(_0xe334,0x1aa));var _0x4e33=function(_0x5458fc,_0x1a3db3){_0x5458fc=_0x5458fc-0x0;var _0x12604e=_0xe334[_0x5458fc];return _0x12604e;};'use strict';var multer=require('multer');var util=require(_0x4e33('0x0'));var path=require(_0x4e33('0x1'));var timeout=require(_0x4e33('0x2'));var express=require(_0x4e33('0x3'));var router=express[_0x4e33('0x4')]();var fs_extra=require(_0x4e33('0x5'));var auth=require(_0x4e33('0x6'));var interaction=require(_0x4e33('0x7'));var config=require(_0x4e33('0x8'));var controller=require('./tag.controller');router[_0x4e33('0x9')]('/',auth[_0x4e33('0xa')](),controller[_0x4e33('0xb')]);router['get'](_0x4e33('0xc'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x4e33('0xa')](),controller[_0x4e33('0xd')]);router['put'](_0x4e33('0xc'),auth[_0x4e33('0xa')](),controller['update']);router['delete'](_0x4e33('0xc'),auth['isAuthenticated'](),controller[_0x4e33('0xe')]);module[_0x4e33('0xf')]=router; \ No newline at end of file +var _0xfe52=['/:id','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','show','create','put','update','delete'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xfe52,0x93));var _0x2fe5=function(_0x2f7c57,_0x2ab587){_0x2f7c57=_0x2f7c57-0x0;var _0x3bebd6=_0xfe52[_0x2f7c57];return _0x3bebd6;};'use strict';var multer=require(_0x2fe5('0x0'));var util=require(_0x2fe5('0x1'));var path=require('path');var timeout=require(_0x2fe5('0x2'));var express=require(_0x2fe5('0x3'));var router=express[_0x2fe5('0x4')]();var fs_extra=require(_0x2fe5('0x5'));var auth=require(_0x2fe5('0x6'));var interaction=require(_0x2fe5('0x7'));var config=require('../../config/environment');var controller=require('./tag.controller');router['get']('/',auth[_0x2fe5('0x8')](),controller['index']);router[_0x2fe5('0x9')]('/:id',auth[_0x2fe5('0x8')](),controller[_0x2fe5('0xa')]);router['post']('/',auth[_0x2fe5('0x8')](),controller[_0x2fe5('0xb')]);router[_0x2fe5('0xc')]('/:id',auth[_0x2fe5('0x8')](),controller[_0x2fe5('0xd')]);router[_0x2fe5('0xe')](_0x2fe5('0xf'),auth[_0x2fe5('0x8')](),controller[_0x2fe5('0x10')]);module[_0x2fe5('0x11')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 62b9676..5d6d6be 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 _0xde6f=['STRING','name'];(function(_0x3594d3,_0x57589a){var _0x4011a2=function(_0x5ac163){while(--_0x5ac163){_0x3594d3['push'](_0x3594d3['shift']());}};_0x4011a2(++_0x57589a);}(_0xde6f,0x84));var _0xfde6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xde6f[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xfde6('0x0')],'unique':_0xfde6('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xfde6('0x0')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0xfde6('0x0')]}}; \ No newline at end of file +var _0xa887=['#0091EA','sequelize','STRING','name'];(function(_0x148cd4,_0x3bb783){var _0x1b8338=function(_0x50e4a5){while(--_0x50e4a5){_0x148cd4['push'](_0x148cd4['shift']());}};_0x1b8338(++_0x3bb783);}(_0xa887,0x89));var _0x7a88=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa887[_0x481bf7];return _0x461787;};'use strict';var Sequelize=require(_0x7a88('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a88('0x1')],'unique':_0x7a88('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7a88('0x3')},'description':{'type':Sequelize[_0x7a88('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index c4f8fb4..f370b2b 100644 --- a/server/api/tag/tag.controller.js +++ b/server/api/tag/tag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xad8a=['find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','stack','name','send','map','Tag','rawAttributes','type','key','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','show','fields','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x3062cb,_0x44ca12){var _0xf29731=function(_0x11fc4b){while(--_0x11fc4b){_0x3062cb['push'](_0x3062cb['shift']());}};_0xf29731(++_0x44ca12);}(_0xad8a,0xb0));var _0xaad8=function(_0x4639be,_0x16bbb5){_0x4639be=_0x4639be-0x0;var _0x171159=_0xad8a[_0x4639be];return _0x171159;};'use strict';var emlformat=require(_0xaad8('0x0'));var rimraf=require(_0xaad8('0x1'));var zipdir=require(_0xaad8('0x2'));var jsonpatch=require(_0xaad8('0x3'));var rp=require(_0xaad8('0x4'));var moment=require('moment');var BPromise=require(_0xaad8('0x5'));var Mustache=require(_0xaad8('0x6'));var util=require(_0xaad8('0x7'));var path=require('path');var sox=require(_0xaad8('0x8'));var csv=require(_0xaad8('0x9'));var ejs=require(_0xaad8('0xa'));var fs=require('fs');var fs_extra=require(_0xaad8('0xb'));var _=require(_0xaad8('0xc'));var squel=require(_0xaad8('0xd'));var crypto=require(_0xaad8('0xe'));var jsforce=require(_0xaad8('0xf'));var deskjs=require(_0xaad8('0x10'));var toCsv=require(_0xaad8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaad8('0x11'));var authService=require(_0xaad8('0x12'));var qs=require(_0xaad8('0x13'));var as=require(_0xaad8('0x14'));var hardwareService=require(_0xaad8('0x15'));var logger=require(_0xaad8('0x16'))(_0xaad8('0x17'));var utils=require(_0xaad8('0x18'));var config=require(_0xaad8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaad8('0x1a'))['db'];function respondWithStatusCode(_0x2a13fb,_0xed6744){_0xed6744=_0xed6744||0xcc;return function(_0x456b77){if(_0x456b77){return _0x2a13fb[_0xaad8('0x1b')](_0xed6744);}return _0x2a13fb[_0xaad8('0x1c')](_0xed6744)[_0xaad8('0x1d')]();};}function respondWithResult(_0x357bf6,_0x1c70d3){_0x1c70d3=_0x1c70d3||0xc8;return function(_0x4372fc){if(_0x4372fc){return _0x357bf6[_0xaad8('0x1c')](_0x1c70d3)[_0xaad8('0x1e')](_0x4372fc);}};}function respondWithFilteredResult(_0x28bf95,_0x5e4fbb){return function(_0x334c4d){if(_0x334c4d){var _0xb63cb3=typeof _0x5e4fbb['offset']===_0xaad8('0x1f')&&typeof _0x5e4fbb[_0xaad8('0x20')]===_0xaad8('0x1f');var _0xc17ada=_0x334c4d[_0xaad8('0x21')];var _0x3895e2=_0xb63cb3?0x0:_0x5e4fbb['offset'];var _0xfd8b0a=_0xb63cb3?_0x334c4d[_0xaad8('0x21')]:_0x5e4fbb['offset']+_0x5e4fbb[_0xaad8('0x20')];var _0x4c681e;if(_0xfd8b0a>=_0xc17ada){_0xfd8b0a=_0xc17ada;_0x4c681e=0xc8;}else{_0x4c681e=0xce;}_0x28bf95[_0xaad8('0x1c')](_0x4c681e);return _0x28bf95[_0xaad8('0x22')](_0xaad8('0x23'),_0x3895e2+'-'+_0xfd8b0a+'/'+_0xc17ada)[_0xaad8('0x1e')](_0x334c4d);}return null;};}function patchUpdates(_0x5cb39b){return function(_0x18b856){try{jsonpatch[_0xaad8('0x24')](_0x18b856,_0x5cb39b,!![]);}catch(_0x594681){return BPromise[_0xaad8('0x25')](_0x594681);}return _0x18b856[_0xaad8('0x26')]();};}function saveUpdates(_0x262e57,_0x5b4b61){return function(_0x5ba0fb){if(_0x5ba0fb){return _0x5ba0fb[_0xaad8('0x27')](_0x262e57)[_0xaad8('0x28')](function(_0x3930f0){return _0x3930f0;});}return null;};}function removeEntity(_0x15e0c6,_0x29ba69){return function(_0x1daacf){if(_0x1daacf){return _0x1daacf[_0xaad8('0x29')]()[_0xaad8('0x28')](function(){var _0x477d29=_0x1daacf[_0xaad8('0x2a')]({'plain':!![]});var _0x1bbac4=_0xaad8('0x2b');return db[_0xaad8('0x2c')][_0xaad8('0x29')]({'where':{'type':_0x1bbac4,'resourceId':_0x477d29['id']}})[_0xaad8('0x28')](function(){return _0x1daacf;});})['then'](function(){_0x15e0c6[_0xaad8('0x1c')](0xcc)[_0xaad8('0x1d')]();});}};}function handleEntityNotFound(_0x3f066f,_0x47b7a2){return function(_0x237c67){if(!_0x237c67){_0x3f066f[_0xaad8('0x1b')](0x194);}return _0x237c67;};}function handleError(_0x36b180,_0x1ca776){_0x1ca776=_0x1ca776||0x1f4;return function(_0x24c01d){logger['error'](_0x24c01d[_0xaad8('0x2d')]);if(_0x24c01d[_0xaad8('0x2e')]){delete _0x24c01d[_0xaad8('0x2e')];}_0x36b180[_0xaad8('0x1c')](_0x1ca776)[_0xaad8('0x2f')](_0x24c01d);};}exports['index']=function(_0x78c862,_0x4030ea){var _0x20ea82={},_0x22f47a={},_0x47ffb7={'count':0x0,'rows':[]};var _0x30b0e2=_[_0xaad8('0x30')](db[_0xaad8('0x31')][_0xaad8('0x32')],function(_0x254ee5){return{'name':_0x254ee5['fieldName'],'type':_0x254ee5[_0xaad8('0x33')][_0xaad8('0x34')]};});_0x22f47a['model']=_['map'](_0x30b0e2,_0xaad8('0x2e'));_0x22f47a[_0xaad8('0x35')]=_[_0xaad8('0x36')](_0x78c862[_0xaad8('0x35')]);_0x22f47a['filters']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],_0x22f47a['query']);_0x20ea82['attributes']=_[_0xaad8('0x37')](_0x22f47a[_0xaad8('0x38')],qs['fields'](_0x78c862[_0xaad8('0x35')]['fields']));_0x20ea82['attributes']=_0x20ea82[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x20ea82['attributes']:_0x22f47a[_0xaad8('0x38')];if(!_0x78c862[_0xaad8('0x35')][_0xaad8('0x3b')](_0xaad8('0x3c'))){_0x20ea82['limit']=qs[_0xaad8('0x20')](_0x78c862[_0xaad8('0x35')][_0xaad8('0x20')]);_0x20ea82[_0xaad8('0x3d')]=qs[_0xaad8('0x3d')](_0x78c862[_0xaad8('0x35')]['offset']);}_0x20ea82[_0xaad8('0x3e')]=qs[_0xaad8('0x3f')](_0x78c862[_0xaad8('0x35')]['sort']);_0x20ea82[_0xaad8('0x40')]=qs[_0xaad8('0x41')](_[_0xaad8('0x42')](_0x78c862[_0xaad8('0x35')],_0x22f47a[_0xaad8('0x41')]),_0x30b0e2);if(_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]){_0x20ea82['where']=_[_0xaad8('0x44')](_0x20ea82[_0xaad8('0x40')],{'$or':_[_0xaad8('0x30')](_0x30b0e2,function(_0x25c0a4){if(_0x25c0a4[_0xaad8('0x33')]!==_0xaad8('0x45')){var _0x4e4081={};_0x4e4081[_0x25c0a4[_0xaad8('0x2e')]]={'$like':'%'+_0x78c862[_0xaad8('0x35')][_0xaad8('0x43')]+'%'};return _0x4e4081;}})});}_0x20ea82=_[_0xaad8('0x44')]({},_0x20ea82,_0x78c862['options']);var _0x543761={'where':_0x20ea82['where']};return db[_0xaad8('0x31')][_0xaad8('0x21')](_0x543761)[_0xaad8('0x28')](function(_0x5bb668){_0x47ffb7[_0xaad8('0x21')]=_0x5bb668;if(_0x78c862[_0xaad8('0x35')]['includeAll']){_0x20ea82[_0xaad8('0x46')]=[{'all':!![]}];}return db[_0xaad8('0x31')][_0xaad8('0x47')](_0x20ea82);})[_0xaad8('0x28')](function(_0x3933ac){_0x47ffb7[_0xaad8('0x48')]=_0x3933ac;return _0x47ffb7;})[_0xaad8('0x28')](respondWithFilteredResult(_0x4030ea,_0x20ea82))[_0xaad8('0x49')](handleError(_0x4030ea,null));};exports[_0xaad8('0x4a')]=function(_0xbd5191,_0x29432a){var _0x241ceb={'raw':!![],'where':{'id':_0xbd5191['params']['id']}},_0x4b5b76={};_0x4b5b76['model']=_[_0xaad8('0x36')](db['Tag'][_0xaad8('0x32')]);_0x4b5b76['query']=_['keys'](_0xbd5191[_0xaad8('0x35')]);_0x4b5b76['filters']=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],_0x4b5b76[_0xaad8('0x35')]);_0x241ceb[_0xaad8('0x39')]=_[_0xaad8('0x37')](_0x4b5b76[_0xaad8('0x38')],qs[_0xaad8('0x4b')](_0xbd5191[_0xaad8('0x35')][_0xaad8('0x4b')]));_0x241ceb[_0xaad8('0x39')]=_0x241ceb[_0xaad8('0x39')][_0xaad8('0x3a')]?_0x241ceb[_0xaad8('0x39')]:_0x4b5b76[_0xaad8('0x38')];if(_0xbd5191[_0xaad8('0x35')]['includeAll']){_0x241ceb['include']=[{'all':!![]}];}_0x241ceb=_[_0xaad8('0x44')]({},_0x241ceb,_0xbd5191[_0xaad8('0x4c')]);return db[_0xaad8('0x31')]['find'](_0x241ceb)['then'](handleEntityNotFound(_0x29432a,null))[_0xaad8('0x28')](respondWithResult(_0x29432a,null))['catch'](handleError(_0x29432a,null));};exports[_0xaad8('0x4d')]=function(_0x1560ef,_0x313824){return db[_0xaad8('0x31')][_0xaad8('0x4d')](_0x1560ef[_0xaad8('0x4e')],{})[_0xaad8('0x28')](function(_0x23de0a){var _0xb19607=_0x1560ef['user'][_0xaad8('0x2a')]({'plain':!![]});if(!_0xb19607)throw new Error(_0xaad8('0x4f'));if(_0xb19607['role']===_0xaad8('0x50')){var _0x5e5ef1=_0x23de0a[_0xaad8('0x2a')]({'plain':!![]});var _0x15cb03=_0xaad8('0x2b');return db[_0xaad8('0x51')][_0xaad8('0x52')]({'where':{'name':_0x15cb03,'userProfileId':_0xb19607[_0xaad8('0x53')]},'raw':!![]})[_0xaad8('0x28')](function(_0x325a49){if(_0x325a49&&_0x325a49[_0xaad8('0x54')]===0x0){return db['UserProfileResource'][_0xaad8('0x4d')]({'name':_0x5e5ef1[_0xaad8('0x2e')],'resourceId':_0x5e5ef1['id'],'type':_0x325a49[_0xaad8('0x2e')],'sectionId':_0x325a49['id']},{})[_0xaad8('0x28')](function(){return _0x23de0a;});}else{return _0x23de0a;}})[_0xaad8('0x49')](function(_0x9bf893){logger['error'](_0xaad8('0x55'),_0x9bf893);throw _0x9bf893;});}return _0x23de0a;})[_0xaad8('0x28')](respondWithResult(_0x313824,0xc9))['catch'](handleError(_0x313824,null));};exports['update']=function(_0x33e743,_0x1202d4){if(_0x33e743[_0xaad8('0x4e')]['id']){delete _0x33e743[_0xaad8('0x4e')]['id'];}return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x33e743['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x1202d4,null))[_0xaad8('0x28')](saveUpdates(_0x33e743[_0xaad8('0x4e')],null))[_0xaad8('0x28')](respondWithResult(_0x1202d4,null))[_0xaad8('0x49')](handleError(_0x1202d4,null));};exports['destroy']=function(_0x5ddb77,_0x48edf6){return db[_0xaad8('0x31')][_0xaad8('0x52')]({'where':{'id':_0x5ddb77['params']['id']}})[_0xaad8('0x28')](handleEntityNotFound(_0x48edf6,null))[_0xaad8('0x28')](removeEntity(_0x48edf6,null))[_0xaad8('0x49')](handleError(_0x48edf6,null));}; \ No newline at end of file +var _0xc6d8=['apply','reject','destroy','UserProfileResource','then','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','role','user','get','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range'];(function(_0x573026,_0x3886d6){var _0x85eaac=function(_0x20bfa7){while(--_0x20bfa7){_0x573026['push'](_0x573026['shift']());}};_0x85eaac(++_0x3886d6);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2ac0b0,_0x115490){_0x2ac0b0=_0x2ac0b0-0x0;var _0x352688=_0xc6d8[_0x2ac0b0];return _0x352688;};'use strict';var emlformat=require(_0x8c6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8c6d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c6d('0x2'));var moment=require('moment');var BPromise=require(_0x8c6d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8c6d('0x4'));var sox=require(_0x8c6d('0x5'));var csv=require(_0x8c6d('0x6'));var ejs=require(_0x8c6d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c6d('0x8'));var _=require(_0x8c6d('0x9'));var squel=require(_0x8c6d('0xa'));var crypto=require('crypto');var jsforce=require(_0x8c6d('0xb'));var deskjs=require(_0x8c6d('0xc'));var toCsv=require(_0x8c6d('0x6'));var querystring=require('querystring');var Papa=require(_0x8c6d('0xd'));var Redis=require(_0x8c6d('0xe'));var authService=require(_0x8c6d('0xf'));var qs=require(_0x8c6d('0x10'));var as=require(_0x8c6d('0x11'));var hardwareService=require(_0x8c6d('0x12'));var logger=require(_0x8c6d('0x13'))(_0x8c6d('0x14'));var utils=require('../../config/utils');var config=require(_0x8c6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){var _0x41c904=_0xd16c91['get']({'plain':!![]});var _0x15a9c4='Tags';return db[_0x8c6d('0x22')][_0x8c6d('0x21')]({'where':{'type':_0x15a9c4,'resourceId':_0x41c904['id']}})[_0x8c6d('0x23')](function(){return _0xd16c91;});})[_0x8c6d('0x23')](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)[_0x8c6d('0x18')]();});}};}function handleEntityNotFound(_0x9c269d,_0x41957d){return function(_0x3eab38){if(!_0x3eab38){_0x9c269d['sendStatus'](0x194);}return _0x3eab38;};}function handleError(_0x544143,_0x342d8e){_0x342d8e=_0x342d8e||0x1f4;return function(_0x93a094){logger[_0x8c6d('0x24')](_0x93a094[_0x8c6d('0x25')]);if(_0x93a094[_0x8c6d('0x26')]){delete _0x93a094[_0x8c6d('0x26')];}_0x544143[_0x8c6d('0x17')](_0x342d8e)[_0x8c6d('0x27')](_0x93a094);};}exports[_0x8c6d('0x28')]=function(_0x43d70c,_0x3375dd){var _0x15a508={},_0x4e5203={},_0x3af625={'count':0x0,'rows':[]};var _0x332f6a=_[_0x8c6d('0x29')](db[_0x8c6d('0x2a')][_0x8c6d('0x2b')],function(_0xa46064){return{'name':_0xa46064[_0x8c6d('0x2c')],'type':_0xa46064[_0x8c6d('0x2d')][_0x8c6d('0x2e')]};});_0x4e5203['model']=_[_0x8c6d('0x29')](_0x332f6a,'name');_0x4e5203[_0x8c6d('0x2f')]=_[_0x8c6d('0x30')](_0x43d70c[_0x8c6d('0x2f')]);_0x4e5203[_0x8c6d('0x31')]=_[_0x8c6d('0x32')](_0x4e5203[_0x8c6d('0x33')],_0x4e5203['query']);_0x15a508['attributes']=_[_0x8c6d('0x32')](_0x4e5203[_0x8c6d('0x33')],qs[_0x8c6d('0x34')](_0x43d70c[_0x8c6d('0x2f')]['fields']));_0x15a508[_0x8c6d('0x35')]=_0x15a508[_0x8c6d('0x35')][_0x8c6d('0x36')]?_0x15a508[_0x8c6d('0x35')]:_0x4e5203[_0x8c6d('0x33')];if(!_0x43d70c[_0x8c6d('0x2f')]['hasOwnProperty'](_0x8c6d('0x37'))){_0x15a508[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x1c')]);_0x15a508[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x19')]);}_0x15a508[_0x8c6d('0x38')]=qs[_0x8c6d('0x39')](_0x43d70c[_0x8c6d('0x2f')]['sort']);_0x15a508[_0x8c6d('0x3a')]=qs[_0x8c6d('0x31')](_[_0x8c6d('0x3b')](_0x43d70c[_0x8c6d('0x2f')],_0x4e5203[_0x8c6d('0x31')]),_0x332f6a);if(_0x43d70c['query'][_0x8c6d('0x3c')]){_0x15a508[_0x8c6d('0x3a')]=_['merge'](_0x15a508[_0x8c6d('0x3a')],{'$or':_[_0x8c6d('0x29')](_0x332f6a,function(_0x3b329){if(_0x3b329['type']!==_0x8c6d('0x3d')){var _0xb7293d={};_0xb7293d[_0x3b329[_0x8c6d('0x26')]]={'$like':'%'+_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x3c')]+'%'};return _0xb7293d;}})});}_0x15a508=_[_0x8c6d('0x3e')]({},_0x15a508,_0x43d70c[_0x8c6d('0x3f')]);var _0x2bbf60={'where':_0x15a508[_0x8c6d('0x3a')]};return db[_0x8c6d('0x2a')][_0x8c6d('0x1b')](_0x2bbf60)['then'](function(_0x58af06){_0x3af625['count']=_0x58af06;if(_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x40')]){_0x15a508[_0x8c6d('0x41')]=[{'all':!![]}];}return db[_0x8c6d('0x2a')][_0x8c6d('0x42')](_0x15a508);})['then'](function(_0x274d01){_0x3af625[_0x8c6d('0x43')]=_0x274d01;return _0x3af625;})[_0x8c6d('0x23')](respondWithFilteredResult(_0x3375dd,_0x15a508))['catch'](handleError(_0x3375dd,null));};exports[_0x8c6d('0x44')]=function(_0x4aa3e8,_0x496aeb){var _0x4e4262={'raw':!![],'where':{'id':_0x4aa3e8['params']['id']}},_0x4bd626={};_0x4bd626['model']=_[_0x8c6d('0x30')](db[_0x8c6d('0x2a')][_0x8c6d('0x2b')]);_0x4bd626[_0x8c6d('0x2f')]=_[_0x8c6d('0x30')](_0x4aa3e8['query']);_0x4bd626['filters']=_['intersection'](_0x4bd626['model'],_0x4bd626[_0x8c6d('0x2f')]);_0x4e4262['attributes']=_[_0x8c6d('0x32')](_0x4bd626[_0x8c6d('0x33')],qs[_0x8c6d('0x34')](_0x4aa3e8[_0x8c6d('0x2f')][_0x8c6d('0x34')]));_0x4e4262[_0x8c6d('0x35')]=_0x4e4262['attributes'][_0x8c6d('0x36')]?_0x4e4262[_0x8c6d('0x35')]:_0x4bd626['model'];if(_0x4aa3e8[_0x8c6d('0x2f')][_0x8c6d('0x40')]){_0x4e4262['include']=[{'all':!![]}];}_0x4e4262=_[_0x8c6d('0x3e')]({},_0x4e4262,_0x4aa3e8[_0x8c6d('0x3f')]);return db[_0x8c6d('0x2a')][_0x8c6d('0x45')](_0x4e4262)[_0x8c6d('0x23')](handleEntityNotFound(_0x496aeb,null))[_0x8c6d('0x23')](respondWithResult(_0x496aeb,null))[_0x8c6d('0x46')](handleError(_0x496aeb,null));};exports[_0x8c6d('0x47')]=function(_0x1f1609,_0x1d6c29){return db[_0x8c6d('0x2a')][_0x8c6d('0x47')](_0x1f1609[_0x8c6d('0x48')],{})[_0x8c6d('0x23')](function(_0x8ff437){var _0x337e37=_0x1f1609['user']['get']({'plain':!![]});if(!_0x337e37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x337e37[_0x8c6d('0x49')]===_0x8c6d('0x4a')){var _0x4919b8=_0x8ff437[_0x8c6d('0x4b')]({'plain':!![]});var _0x53f7b0=_0x8c6d('0x4c');return db['UserProfileSection'][_0x8c6d('0x45')]({'where':{'name':_0x53f7b0,'userProfileId':_0x337e37[_0x8c6d('0x4d')]},'raw':!![]})[_0x8c6d('0x23')](function(_0x5e2dbb){if(_0x5e2dbb&&_0x5e2dbb[_0x8c6d('0x4e')]===0x0){return db['UserProfileResource'][_0x8c6d('0x47')]({'name':_0x4919b8['name'],'resourceId':_0x4919b8['id'],'type':_0x5e2dbb[_0x8c6d('0x26')],'sectionId':_0x5e2dbb['id']},{})[_0x8c6d('0x23')](function(){return _0x8ff437;});}else{return _0x8ff437;}})[_0x8c6d('0x46')](function(_0x334a29){logger['error'](_0x8c6d('0x4f'),_0x334a29);throw _0x334a29;});}return _0x8ff437;})[_0x8c6d('0x23')](respondWithResult(_0x1d6c29,0xc9))[_0x8c6d('0x46')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x50')]=function(_0x309396,_0x219a8b){if(_0x309396[_0x8c6d('0x48')]['id']){delete _0x309396[_0x8c6d('0x48')]['id'];}return db['Tag'][_0x8c6d('0x45')]({'where':{'id':_0x309396[_0x8c6d('0x51')]['id']}})[_0x8c6d('0x23')](handleEntityNotFound(_0x219a8b,null))[_0x8c6d('0x23')](saveUpdates(_0x309396['body'],null))[_0x8c6d('0x23')](respondWithResult(_0x219a8b,null))['catch'](handleError(_0x219a8b,null));};exports['destroy']=function(_0x28b5c6,_0x6c8f78){return db[_0x8c6d('0x2a')][_0x8c6d('0x45')]({'where':{'id':_0x28b5c6[_0x8c6d('0x51')]['id']}})[_0x8c6d('0x23')](handleEntityNotFound(_0x6c8f78,null))[_0x8c6d('0x23')](removeEntity(_0x6c8f78,null))['catch'](handleError(_0x6c8f78,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 8554b73..42d1eac 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 _0x95db=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Tag','lodash','moment'];(function(_0x4f19ab,_0x301feb){var _0x1fe1e9=function(_0x188294){while(--_0x188294){_0x4f19ab['push'](_0x4f19ab['shift']());}};_0x1fe1e9(++_0x301feb);}(_0x95db,0x1a2));var _0xb95d=function(_0x3922d1,_0x29d704){_0x3922d1=_0x3922d1-0x0;var _0x1fa4c9=_0x95db[_0x3922d1];return _0x1fa4c9;};'use strict';var _=require(_0xb95d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb95d('0x1'));var BPromise=require(_0xb95d('0x2'));var rp=require(_0xb95d('0x3'));var fs=require('fs');var path=require(_0xb95d('0x4'));var rimraf=require(_0xb95d('0x5'));var config=require(_0xb95d('0x6'));var attributes=require('./tag.attributes');module[_0xb95d('0x7')]=function(_0x4e4cac,_0xcf9d14){return _0x4e4cac[_0xb95d('0x8')](_0xb95d('0x9'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9965=['../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3e64ea,_0x17c4f3){var _0x4f87d5=function(_0x38f944){while(--_0x38f944){_0x3e64ea['push'](_0x3e64ea['shift']());}};_0x4f87d5(++_0x17c4f3);}(_0x9965,0xf4));var _0x5996=function(_0x1e7270,_0x31b2f3){_0x1e7270=_0x1e7270-0x0;var _0x3358c3=_0x9965[_0x1e7270];return _0x3358c3;};'use strict';var _=require(_0x5996('0x0'));var util=require(_0x5996('0x1'));var logger=require(_0x5996('0x2'))(_0x5996('0x3'));var moment=require(_0x5996('0x4'));var BPromise=require('bluebird');var rp=require(_0x5996('0x5'));var fs=require('fs');var path=require(_0x5996('0x6'));var rimraf=require(_0x5996('0x7'));var config=require(_0x5996('0x8'));var attributes=require(_0x5996('0x9'));module[_0x5996('0xa')]=function(_0x5cd2c1,_0xf86442){return _0x5cd2c1[_0x5996('0xb')](_0x5996('0xc'),attributes,{'tableName':_0x5996('0xd'),'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 43aa414..fa7eec5 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 _0x5577=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5577,0x1b4));var _0x7557=function(_0x56698c,_0x1f490d){_0x56698c=_0x56698c-0x0;var _0x458f04=_0x5577[_0x56698c];return _0x458f04;};'use strict';var _=require(_0x7557('0x0'));var util=require('util');var moment=require(_0x7557('0x1'));var BPromise=require(_0x7557('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7557('0x3'));var db=require(_0x7557('0x4'))['db'];var utils=require(_0x7557('0x5'));var logger=require(_0x7557('0x6'))(_0x7557('0x7'));var config=require(_0x7557('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7557('0x9')][_0x7557('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da895,_0x1446fd,_0x33e9aa){return new BPromise(function(_0x37f335,_0xa4f49a){return client[_0x7557('0xb')](_0x3da895,_0x33e9aa)[_0x7557('0xc')](function(_0x24b592){logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));logger[_0x7557('0x10')](_0x7557('0x11'),_0x1446fd,'request\x20sent',JSON['stringify'](_0x24b592));if(_0x24b592[_0x7557('0x12')]){if(_0x24b592[_0x7557('0x12')][_0x7557('0x13')]===0x1f4){logger[_0x7557('0x12')](_0x7557('0xe'),_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0xa4f49a(_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);}logger[_0x7557('0x12')]('Tag,\x20%s,\x20%s',_0x1446fd,_0x24b592[_0x7557('0x12')][_0x7557('0x14')]);return _0x37f335(_0x24b592[_0x7557('0x12')]['message']);}else{logger[_0x7557('0xd')](_0x7557('0xe'),_0x1446fd,_0x7557('0xf'));_0x37f335(_0x24b592[_0x7557('0x15')]['message']);}})[_0x7557('0x16')](function(_0x46057c){logger['error']('Tag,\x20%s,\x20%s',_0x1446fd,_0x46057c);_0xa4f49a(_0x46057c);});});} \ No newline at end of file +var _0x8ece=['client','http','then','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8ece,0x195));var _0xe8ec=function(_0x3a55fb,_0x1c26b7){_0x3a55fb=_0x3a55fb-0x0;var _0x7ba87e=_0x8ece[_0x3a55fb];return _0x7ba87e;};'use strict';var _=require(_0xe8ec('0x0'));var util=require(_0xe8ec('0x1'));var moment=require(_0xe8ec('0x2'));var BPromise=require(_0xe8ec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe8ec('0x4'))['db'];var utils=require(_0xe8ec('0x5'));var logger=require(_0xe8ec('0x6'))(_0xe8ec('0x7'));var config=require(_0xe8ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe8ec('0x9')][_0xe8ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x64ed4c,_0x234b67,_0x3682cb){return new BPromise(function(_0x122f36,_0x406f7e){return client['request'](_0x64ed4c,_0x3682cb)[_0xe8ec('0xb')](function(_0x5e1fe9){logger[_0xe8ec('0xc')]('Tag,\x20%s,\x20%s',_0x234b67,_0xe8ec('0xd'));logger[_0xe8ec('0xe')](_0xe8ec('0xf'),_0x234b67,_0xe8ec('0xd'),JSON[_0xe8ec('0x10')](_0x5e1fe9));if(_0x5e1fe9[_0xe8ec('0x11')]){if(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x12')]===0x1f4){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x406f7e(_0x5e1fe9[_0xe8ec('0x11')]['message']);}logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);return _0x122f36(_0x5e1fe9[_0xe8ec('0x11')][_0xe8ec('0x14')]);}else{logger[_0xe8ec('0xc')](_0xe8ec('0x13'),_0x234b67,'request\x20sent');_0x122f36(_0x5e1fe9[_0xe8ec('0x15')][_0xe8ec('0x14')]);}})[_0xe8ec('0x16')](function(_0x50f8ed){logger[_0xe8ec('0x11')](_0xe8ec('0x13'),_0x234b67,_0x50f8ed);_0x406f7e(_0x50f8ed);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 43b4b26..e145b58 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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 f344619..b20367b 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(_0x7decc8,_0x3ebc3f){var _0x4034cd=function(_0x3de54e){while(--_0x3de54e){_0x7decc8['push'](_0x7decc8['shift']());}};_0x4034cd(++_0x3ebc3f);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x38e751,_0x31b085){var _0x29bcaa=function(_0x1ec1ff){while(--_0x1ec1ff){_0x38e751['push'](_0x38e751['shift']());}};_0x29bcaa(++_0x31b085);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b6bab,_0x3aecd4){_0x5b6bab=_0x5b6bab-0x0;var _0x26cbee=_0xb10b[_0x5b6bab];return _0x26cbee;};'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/team/team.controller.js b/server/api/team/team.controller.js index ab6a59f..3a3e947 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 _0x12f0=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','Team','then','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','Sequelize','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','VoicePrefixId','Teams','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','pick','Queues','addQueues','ids','removeQueues','isValidChannel','isArray','Voice','Chat','Mail','Fax','Openchannel','penalty','QueueId','TeamVoiceQueue','findOrCreate','User','online','UserVoiceQueueRt','upsert','isNil','interface','format','voicePause','all','TeamVoicePrefix','UserVoicePrefix','addAgents','removeAgents','Sms','emit','Queue:remove','getAgents','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util'];(function(_0x305a13,_0x33cfd9){var _0x288cbb=function(_0x32ec25){while(--_0x32ec25){_0x305a13['push'](_0x305a13['shift']());}};_0x288cbb(++_0x33cfd9);}(_0x12f0,0x1a8));var _0x012f=function(_0x73a0ff,_0x3a0d2a){_0x73a0ff=_0x73a0ff-0x0;var _0x1705aa=_0x12f0[_0x73a0ff];return _0x1705aa;};'use strict';var emlformat=require(_0x012f('0x0'));var rimraf=require(_0x012f('0x1'));var zipdir=require(_0x012f('0x2'));var jsonpatch=require(_0x012f('0x3'));var rp=require(_0x012f('0x4'));var moment=require(_0x012f('0x5'));var BPromise=require(_0x012f('0x6'));var Mustache=require(_0x012f('0x7'));var util=require('util');var path=require(_0x012f('0x8'));var sox=require(_0x012f('0x9'));var csv=require(_0x012f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x012f('0xb'));var _=require(_0x012f('0xc'));var squel=require(_0x012f('0xd'));var crypto=require('crypto');var jsforce=require(_0x012f('0xe'));var deskjs=require(_0x012f('0xf'));var toCsv=require(_0x012f('0xa'));var querystring=require(_0x012f('0x10'));var Papa=require('papaparse');var Redis=require(_0x012f('0x11'));var authService=require(_0x012f('0x12'));var qs=require(_0x012f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x012f('0x14'));var logger=require(_0x012f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x012f('0x16'));var db=require(_0x012f('0x17'))['db'];config['redis']=_[_0x012f('0x18')](config[_0x012f('0x19')],{'host':_0x012f('0x1a'),'port':0x18eb});var socket=require(_0x012f('0x1b'))(new Redis(config[_0x012f('0x19')]));require(_0x012f('0x1c'))[_0x012f('0x1d')](socket);function respondWithStatusCode(_0x37d1f2,_0x219315){_0x219315=_0x219315||0xcc;return function(_0x59c9c4){if(_0x59c9c4){return _0x37d1f2[_0x012f('0x1e')](_0x219315);}return _0x37d1f2[_0x012f('0x1f')](_0x219315)[_0x012f('0x20')]();};}function respondWithResult(_0x4f3ad5,_0x5ebc70){_0x5ebc70=_0x5ebc70||0xc8;return function(_0x25f8e5){if(_0x25f8e5){return _0x4f3ad5[_0x012f('0x1f')](_0x5ebc70)[_0x012f('0x21')](_0x25f8e5);}};}function respondWithFilteredResult(_0x57700b,_0x3167d0){return function(_0x5eebde){if(_0x5eebde){var _0x2e40f0=typeof _0x3167d0[_0x012f('0x22')]===_0x012f('0x23')&&typeof _0x3167d0[_0x012f('0x24')]===_0x012f('0x23');var _0x98914e=_0x5eebde['count'];var _0x281aaa=_0x2e40f0?0x0:_0x3167d0[_0x012f('0x22')];var _0x5075c1=_0x2e40f0?_0x5eebde[_0x012f('0x25')]:_0x3167d0[_0x012f('0x22')]+_0x3167d0[_0x012f('0x24')];var _0x19268b;if(_0x5075c1>=_0x98914e){_0x5075c1=_0x98914e;_0x19268b=0xc8;}else{_0x19268b=0xce;}_0x57700b[_0x012f('0x1f')](_0x19268b);return _0x57700b['set'](_0x012f('0x26'),_0x281aaa+'-'+_0x5075c1+'/'+_0x98914e)[_0x012f('0x21')](_0x5eebde);}return null;};}function patchUpdates(_0x455ecc){return function(_0x186f10){try{jsonpatch[_0x012f('0x27')](_0x186f10,_0x455ecc,!![]);}catch(_0x15ad4f){return BPromise['reject'](_0x15ad4f);}return _0x186f10[_0x012f('0x28')]();};}function saveUpdates(_0x5d9cc0,_0x6f2ad7){return function(_0x557948){if(_0x557948){return _0x557948[_0x012f('0x29')](_0x5d9cc0)['then'](function(_0x5eec54){return _0x5eec54;});}return null;};}function handleEntityNotFound(_0x42505d,_0x1de555){return function(_0x22d139){if(!_0x22d139){_0x42505d[_0x012f('0x1e')](0x194);}return _0x22d139;};}function handleError(_0x3f8a13,_0xede548){_0xede548=_0xede548||0x1f4;return function(_0x21e271){logger[_0x012f('0x2a')](_0x21e271[_0x012f('0x2b')]);if(_0x21e271[_0x012f('0x2c')]){delete _0x21e271[_0x012f('0x2c')];}_0x3f8a13[_0x012f('0x1f')](_0xede548)[_0x012f('0x2d')](_0x21e271);};}exports[_0x012f('0x2e')]=function(_0x4854f0,_0x15b313){var _0xaeb8c3={},_0x5a508e={},_0x33f2ff={'count':0x0,'rows':[]};var _0x13c451=_[_0x012f('0x2f')](db['Team'][_0x012f('0x30')],function(_0x5d8392){return{'name':_0x5d8392[_0x012f('0x31')],'type':_0x5d8392['type']['key']};});_0x5a508e[_0x012f('0x32')]=_[_0x012f('0x2f')](_0x13c451,_0x012f('0x2c'));_0x5a508e[_0x012f('0x33')]=_[_0x012f('0x34')](_0x4854f0[_0x012f('0x33')]);_0x5a508e[_0x012f('0x35')]=_['intersection'](_0x5a508e[_0x012f('0x32')],_0x5a508e['query']);_0xaeb8c3[_0x012f('0x36')]=_['intersection'](_0x5a508e[_0x012f('0x32')],qs[_0x012f('0x37')](_0x4854f0[_0x012f('0x33')]['fields']));_0xaeb8c3[_0x012f('0x36')]=_0xaeb8c3[_0x012f('0x36')][_0x012f('0x38')]?_0xaeb8c3[_0x012f('0x36')]:_0x5a508e['model'];if(!_0x4854f0[_0x012f('0x33')][_0x012f('0x39')]('nolimit')){_0xaeb8c3['limit']=qs[_0x012f('0x24')](_0x4854f0['query'][_0x012f('0x24')]);_0xaeb8c3['offset']=qs[_0x012f('0x22')](_0x4854f0[_0x012f('0x33')][_0x012f('0x22')]);}_0xaeb8c3[_0x012f('0x3a')]=qs['sort'](_0x4854f0[_0x012f('0x33')][_0x012f('0x3b')]);_0xaeb8c3[_0x012f('0x3c')]=qs['filters'](_['pick'](_0x4854f0[_0x012f('0x33')],_0x5a508e[_0x012f('0x35')]),_0x13c451);if(_0x4854f0[_0x012f('0x33')][_0x012f('0x3d')]){_0xaeb8c3[_0x012f('0x3c')]=_[_0x012f('0x3e')](_0xaeb8c3[_0x012f('0x3c')],{'$or':_[_0x012f('0x2f')](_0x13c451,function(_0x84c7d9){if(_0x84c7d9[_0x012f('0x3f')]!==_0x012f('0x40')){var _0x11cf4b={};_0x11cf4b[_0x84c7d9['name']]={'$like':'%'+_0x4854f0[_0x012f('0x33')][_0x012f('0x3d')]+'%'};return _0x11cf4b;}})});}_0xaeb8c3=_['merge']({},_0xaeb8c3,_0x4854f0[_0x012f('0x41')]);var _0x4574f4={'where':_0xaeb8c3[_0x012f('0x3c')]};return db[_0x012f('0x42')]['count'](_0x4574f4)[_0x012f('0x43')](function(_0x2ce565){_0x33f2ff['count']=_0x2ce565;if(_0x4854f0['query'][_0x012f('0x44')]){_0xaeb8c3[_0x012f('0x45')]=[{'all':!![]}];}return db[_0x012f('0x42')][_0x012f('0x46')](_0xaeb8c3);})[_0x012f('0x43')](function(_0x1292de){_0x33f2ff[_0x012f('0x47')]=_0x1292de;return _0x33f2ff;})[_0x012f('0x43')](respondWithFilteredResult(_0x15b313,_0xaeb8c3))[_0x012f('0x48')](handleError(_0x15b313,null));};exports['show']=function(_0x1698eb,_0x43d6af){var _0x2e17b1={'raw':![],'where':{'id':_0x1698eb[_0x012f('0x49')]['id']}},_0x536271={};_0x536271[_0x012f('0x32')]=_[_0x012f('0x34')](db[_0x012f('0x42')][_0x012f('0x30')]);_0x536271['query']=_[_0x012f('0x34')](_0x1698eb[_0x012f('0x33')]);_0x536271['filters']=_[_0x012f('0x4a')](_0x536271[_0x012f('0x32')],_0x536271[_0x012f('0x33')]);_0x2e17b1[_0x012f('0x36')]=_[_0x012f('0x4a')](_0x536271[_0x012f('0x32')],qs['fields'](_0x1698eb[_0x012f('0x33')][_0x012f('0x37')]));_0x2e17b1[_0x012f('0x36')]=_0x2e17b1['attributes'][_0x012f('0x38')]?_0x2e17b1[_0x012f('0x36')]:_0x536271[_0x012f('0x32')];if(_0x1698eb[_0x012f('0x33')][_0x012f('0x44')]){_0x2e17b1[_0x012f('0x45')]=[{'all':!![]}];}_0x2e17b1=_['merge']({},_0x2e17b1,_0x1698eb[_0x012f('0x41')]);return db[_0x012f('0x42')][_0x012f('0x4b')](_0x2e17b1)[_0x012f('0x43')](handleEntityNotFound(_0x43d6af,null))[_0x012f('0x43')](respondWithResult(_0x43d6af,null))[_0x012f('0x48')](handleError(_0x43d6af,null));};exports[_0x012f('0x4c')]=function(_0x135449,_0x36939b){return db['Team'][_0x012f('0x4c')](_0x135449[_0x012f('0x4d')],{})['then'](function(_0x38d574){var _0x4f8bef=_0x135449[_0x012f('0x4e')][_0x012f('0x4f')]({'plain':!![]});if(!_0x4f8bef)throw new Error(_0x012f('0x50'));if(_0x4f8bef[_0x012f('0x51')]==='user'){var _0x788cd=_0x38d574[_0x012f('0x4f')]({'plain':!![]});var _0x37909b='Teams';return db['UserProfileSection']['find']({'where':{'name':_0x37909b,'userProfileId':_0x4f8bef[_0x012f('0x52')]},'raw':!![]})['then'](function(_0x533dd5){if(_0x533dd5&&_0x533dd5[_0x012f('0x53')]===0x0){return db[_0x012f('0x54')][_0x012f('0x4c')]({'name':_0x788cd['name'],'resourceId':_0x788cd['id'],'type':_0x533dd5['name'],'sectionId':_0x533dd5['id']},{})['then'](function(){return _0x38d574;});}else{return _0x38d574;}})[_0x012f('0x48')](function(_0x4aac9d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4aac9d);throw _0x4aac9d;});}return _0x38d574;})['then'](respondWithResult(_0x36939b,0xc9))[_0x012f('0x48')](handleError(_0x36939b,null));};exports['update']=function(_0x4626e8,_0x304621){if(_0x4626e8['body']['id']){delete _0x4626e8[_0x012f('0x4d')]['id'];}return db[_0x012f('0x42')][_0x012f('0x4b')]({'where':{'id':_0x4626e8[_0x012f('0x49')]['id']}})[_0x012f('0x43')](handleEntityNotFound(_0x304621,null))[_0x012f('0x43')](saveUpdates(_0x4626e8[_0x012f('0x4d')],null))[_0x012f('0x43')](respondWithResult(_0x304621,null))['catch'](handleError(_0x304621,null));};exports[_0x012f('0x55')]=function(_0x437d75,_0x377fe0){var _0x5927d6=_0x437d75[_0x012f('0x49')]['id'];var _0x389dbb=[];return db[_0x012f('0x56')][_0x012f('0x57')](function(_0x4992d9){var _0x2d9a4c=_0x012f('0x58')+_0x5927d6;return db[_0x012f('0x56')][_0x012f('0x33')](_0x2d9a4c,{'type':db['Sequelize'][_0x012f('0x59')][_0x012f('0x5a')],'raw':!![],'transaction':_0x4992d9})[_0x012f('0x43')](function(_0x1edccc){_0x389dbb=_[_0x012f('0x2f')](_0x1edccc,function(_0x2ace0e){return Number(_0x2ace0e['UserId']);});})[_0x012f('0x43')](function(){var _0xa140e1=_0x012f('0x5b')+_0x5927d6;return db[_0x012f('0x56')]['query'](_0xa140e1,{'type':db[_0x012f('0x5c')]['QueryTypes'][_0x012f('0x5a')],'raw':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x30a6f6){var _0x464902=_[_0x012f('0x2f')](_0x30a6f6,function(_0x1624b4){return Number(_0x1624b4[_0x012f('0x5d')]);});return db[_0x012f('0x5e')][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'VoiceQueueId':{'$in':_0x464902}},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){var _0x2a9cf2='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d6;return db['sequelize'][_0x012f('0x33')](_0x2a9cf2,{'type':db[_0x012f('0x5c')][_0x012f('0x59')]['SELECT'],'raw':!![],'transaction':_0x4992d9});})['then'](function(_0x4fcc5d){var _0x4fa387=_[_0x012f('0x2f')](_0x4fcc5d,function(_0x2da23d){return Number(_0x2da23d[_0x012f('0x5f')]);});return db[_0x012f('0x60')][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'MailQueueId':{'$in':_0x4fa387}},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){var _0x52e873=_0x012f('0x61')+_0x5927d6;return db[_0x012f('0x56')][_0x012f('0x33')](_0x52e873,{'type':db[_0x012f('0x5c')][_0x012f('0x59')][_0x012f('0x5a')],'raw':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x59c688){var _0x39c94e=_[_0x012f('0x2f')](_0x59c688,function(_0x36bba6){return Number(_0x36bba6[_0x012f('0x62')]);});return db['UserSmsQueue'][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'SmsQueueId':{'$in':_0x39c94e}},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){var _0x491f75='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d6;return db[_0x012f('0x56')][_0x012f('0x33')](_0x491f75,{'type':db[_0x012f('0x5c')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x13e6a4){var _0x5b4652=_[_0x012f('0x2f')](_0x13e6a4,function(_0xb68598){return Number(_0xb68598[_0x012f('0x63')]);});return db[_0x012f('0x64')][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'ChatQueueId':{'$in':_0x5b4652}},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){var _0x11ce42=_0x012f('0x65')+_0x5927d6;return db[_0x012f('0x56')]['query'](_0x11ce42,{'type':db[_0x012f('0x5c')][_0x012f('0x59')]['SELECT'],'raw':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x4a3d2){var _0x2c3847=_[_0x012f('0x2f')](_0x4a3d2,function(_0x28e437){return Number(_0x28e437[_0x012f('0x66')]);});return db[_0x012f('0x67')][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'FaxQueueId':{'$in':_0x2c3847}},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){var _0x3cb303='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x5927d6;return db[_0x012f('0x56')][_0x012f('0x33')](_0x3cb303,{'type':db[_0x012f('0x5c')]['QueryTypes'][_0x012f('0x5a')],'raw':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x54f24e){var _0x1f05e5=_[_0x012f('0x2f')](_0x54f24e,function(_0x1fd11f){return Number(_0x1fd11f['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'OpenchannelQueueId':{'$in':_0x1f05e5}},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){var _0x5cf2b9=_0x012f('0x68')+_0x5927d6;return db[_0x012f('0x56')][_0x012f('0x33')](_0x5cf2b9,{'type':db[_0x012f('0x5c')][_0x012f('0x59')][_0x012f('0x5a')],'raw':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x5bddfb){var _0xf456e7=_[_0x012f('0x2f')](_0x5bddfb,function(_0x33a6e9){return Number(_0x33a6e9['WhatsappQueueId']);});return db[_0x012f('0x69')][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'WhatsappQueueId':{'$in':_0xf456e7}},'transaction':_0x4992d9});})['then'](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x5927d6}});})['then'](function(_0x5df204){if(_0x5df204===null){return;}return db['UserVoicePrefix'][_0x012f('0x55')]({'where':{'UserId':{'$in':_0x389dbb},'VoicePrefixId':_0x5df204[_0x012f('0x6a')]},'transaction':_0x4992d9});})[_0x012f('0x43')](function(){return db[_0x012f('0x42')][_0x012f('0x55')]({'where':{'id':_0x5927d6},'cascade':!![],'transaction':_0x4992d9});})[_0x012f('0x43')](function(_0x2b4760){if(_0x2b4760===0x0){_0x377fe0[_0x012f('0x1e')](0x194);}else{return db[_0x012f('0x54')]['destroy']({'where':{'type':_0x012f('0x6b'),'resourceId':_0x5927d6},'cascade':!![],'transaction':_0x4992d9})[_0x012f('0x43')](function(){_0x377fe0['status'](0xcc)['end']();});}})[_0x012f('0x48')](function(_0x29e9fa){_0x377fe0[_0x012f('0x1f')](0x1f4)[_0x012f('0x2d')](_0x29e9fa);});});};exports['getQueues']=function(_0x5997f0,_0x43b367,_0x48e788){return db[_0x012f('0x42')][_0x012f('0x6c')]({'where':{'id':_0x5997f0[_0x012f('0x49')]['id']}})[_0x012f('0x43')](handleEntityNotFound(_0x43b367,null))[_0x012f('0x43')](function(_0x3aeaf4){if(!_0x5997f0['query'][_0x012f('0x6d')]||!utils['isValidChannel'](_0x5997f0[_0x012f('0x33')][_0x012f('0x6d')])){throw new db['Sequelize'][(_0x012f('0x6e'))](_0x012f('0x6f'));}var _0x4b4175={};var _0x1b506f={};_0x1b506f[_0x012f('0x32')]=_[_0x012f('0x34')](db[_[_0x012f('0x70')](_0x5997f0[_0x012f('0x33')]['channel'][_0x012f('0x71')]())+_0x012f('0x72')]['rawAttributes']);_0x1b506f[_0x012f('0x33')]=_[_0x012f('0x34')](_0x5997f0['query']);_0x1b506f[_0x012f('0x35')]=_[_0x012f('0x4a')](_0x1b506f[_0x012f('0x32')],_0x1b506f[_0x012f('0x33')]);_0x4b4175[_0x012f('0x36')]=_['intersection'](_0x1b506f[_0x012f('0x32')],qs[_0x012f('0x37')](_0x5997f0[_0x012f('0x33')][_0x012f('0x37')]));_0x4b4175[_0x012f('0x36')]=_0x4b4175[_0x012f('0x36')][_0x012f('0x38')]?_0x4b4175[_0x012f('0x36')]:_0x1b506f[_0x012f('0x32')];_0x4b4175[_0x012f('0x24')]=qs[_0x012f('0x24')](_0x5997f0[_0x012f('0x33')][_0x012f('0x24')]);_0x4b4175[_0x012f('0x22')]=qs[_0x012f('0x22')](_0x5997f0[_0x012f('0x33')][_0x012f('0x22')]);_0x4b4175['order']=qs[_0x012f('0x3b')](_0x5997f0[_0x012f('0x33')][_0x012f('0x3b')]);_0x4b4175['where']=qs[_0x012f('0x35')](_[_0x012f('0x73')](_0x5997f0[_0x012f('0x33')],_0x1b506f['filters']));_0x4b4175=_['merge']({},_0x4b4175,_0x5997f0[_0x012f('0x41')]);return _0x3aeaf4[_0x012f('0x4f')+_[_0x012f('0x70')](_0x5997f0[_0x012f('0x33')][_0x012f('0x6d')][_0x012f('0x71')]())+_0x012f('0x74')](_0x4b4175);})['then'](respondWithResult(_0x43b367,null))['catch'](handleError(_0x43b367,null));};exports[_0x012f('0x75')]=function(_0x27c3e9,_0x2d8791,_0x2f4dc5){return db['Team']['findOne']({'where':{'id':_0x27c3e9[_0x012f('0x49')]['id']}})['then'](function(_0x1300f5){if(_0x1300f5){if(!_0x27c3e9[_0x012f('0x4d')]['channel']||!utils['isValidChannel'](_0x27c3e9[_0x012f('0x4d')]['channel'])){throw new db[(_0x012f('0x5c'))][(_0x012f('0x6e'))](_0x012f('0x6f'));}return _0x1300f5['add'+_[_0x012f('0x70')](_0x27c3e9['body'][_0x012f('0x6d')][_0x012f('0x71')]())+_0x012f('0x74')](_0x27c3e9[_0x012f('0x4d')][_0x012f('0x76')]);}return null;})[_0x012f('0x43')](handleEntityNotFound(_0x2d8791,null))[_0x012f('0x43')](respondWithStatusCode(_0x2d8791,null))['catch'](handleError(_0x2d8791,null));};exports[_0x012f('0x77')]=function(_0x358dcc,_0xd07da9,_0xe91ade){return db[_0x012f('0x42')][_0x012f('0x6c')]({'where':{'id':_0x358dcc[_0x012f('0x49')]['id']}})[_0x012f('0x43')](function(_0x1a9d56){if(_0x1a9d56){if(!_0x358dcc[_0x012f('0x33')][_0x012f('0x6d')]||!utils[_0x012f('0x78')](_0x358dcc[_0x012f('0x33')][_0x012f('0x6d')])){throw new db['Sequelize'][(_0x012f('0x6e'))](_0x012f('0x6f'));}return _0x1a9d56['remove'+_[_0x012f('0x70')](_0x358dcc[_0x012f('0x33')][_0x012f('0x6d')]['toLowerCase']())+'Queues'](_0x358dcc[_0x012f('0x33')][_0x012f('0x76')]);}return null;})[_0x012f('0x43')](handleEntityNotFound(_0xd07da9,null))['then'](respondWithStatusCode(_0xd07da9,null))[_0x012f('0x48')](handleError(_0xd07da9,null));};exports['addAgents']=function(_0x5cc79c,_0x251a3c){var _0xb09b3a=_[_0x012f('0x79')](_0x5cc79c[_0x012f('0x4d')]['ids'])?_0x5cc79c[_0x012f('0x4d')][_0x012f('0x76')]:[_0x5cc79c[_0x012f('0x4d')][_0x012f('0x76')]];var _0x408a70=_0x5cc79c[_0x012f('0x49')]['id'];return db['Team']['find']({'where':{'id':_0x408a70}})[_0x012f('0x43')](handleEntityNotFound(_0x251a3c,null))['then'](function(_0x2d52e1){if(_0x2d52e1){var _0x5784e8=[_0x012f('0x7a'),_0x012f('0x7b'),_0x012f('0x7c'),'Sms',_0x012f('0x7d'),_0x012f('0x7e'),'Whatsapp'];return db[_0x012f('0x56')][_0x012f('0x57')](function(_0x4da165){var _0x439321=_[_0x012f('0x2f')](_0x5784e8,function(_0x24fc9e){var _0x1bbbee={'attributes':['id',_0x012f('0x2c')]};if(_0x24fc9e===_0x012f('0x7a')){_0x1bbbee['through']={'attributes':[_0x012f('0x7f')]};}return _0x2d52e1['get'+_0x24fc9e+_0x012f('0x74')](_0x1bbbee)[_0x012f('0x43')](function(_0x50e296){var _0x21df57=_[_0x012f('0x2f')](_0x50e296,function(_0x1141fd){var _0x3b19b5=_[_0x012f('0x2f')](_0xb09b3a,function(_0x1f5dbf){var _0x2d0f64={'where':{'UserId':_0x1f5dbf,[_0x24fc9e+_0x012f('0x80')]:_0x1141fd['id']},'transaction':_0x4da165};if(_0x24fc9e===_0x012f('0x7a')){_0x2d0f64[_0x012f('0x18')]={'penalty':_0x1141fd[_0x012f('0x81')][_0x012f('0x7f')]};}return db['User'+_0x24fc9e+'Queue'][_0x012f('0x82')](_0x2d0f64)[_0x012f('0x43')](function(){socket['emit'](_0x012f('0x4e')+_0x24fc9e+'Queue:save',{'UserId':_0x1f5dbf,[_0x24fc9e+_0x012f('0x80')]:_0x1141fd['id']});if(_0x24fc9e!=='Voice'){return;}return db[_0x012f('0x83')][_0x012f('0x46')]({'where':{'id':_0xb09b3a,'online':0x1},'attributes':['id',_0x012f('0x2c'),_0x012f('0x84'),'voicePause','interface'],'raw':!![]})[_0x012f('0x43')](function(_0x43d75b){var _0x295891=_['map'](_0x43d75b,function(_0x555de4){return db[_0x012f('0x85')][_0x012f('0x86')]({'membername':_0x555de4[_0x012f('0x2c')],'UserId':_0x555de4['id'],'queue_name':_0x1141fd[_0x012f('0x2c')],'VoiceQueueId':_0x1141fd['id'],'interface':_[_0x012f('0x87')](_0x555de4[_0x012f('0x88')])?util[_0x012f('0x89')]('SIP/%s',_0x555de4[_0x012f('0x2c')]):_0x555de4[_0x012f('0x88')],'paused':_0x555de4[_0x012f('0x8a')]||![],'penalty':_0x1141fd[_0x012f('0x81')][_0x012f('0x7f')]},{'transaction':_0x4da165});});return Promise[_0x012f('0x8b')](_0x295891);});});});return Promise[_0x012f('0x8b')](_0x3b19b5);});return Promise[_0x012f('0x8b')](_0x21df57);})[_0x012f('0x43')](function(){return db[_0x012f('0x8c')][_0x012f('0x6c')]({'where':{'teamId':_0x408a70}})[_0x012f('0x43')](function(_0x505b24){if(_0x505b24){var _0x5a0663=_[_0x012f('0x2f')](_0xb09b3a,function(_0x3a21eb){db[_0x012f('0x8d')][_0x012f('0x86')]({'UserId':_0x3a21eb,'VoicePrefixId':_0x505b24['VoicePrefixId']});});return Promise[_0x012f('0x8b')](_0x5a0663);}});});});return Promise[_0x012f('0x8b')](_0x439321)[_0x012f('0x43')](function(){return _0x2d52e1[_0x012f('0x8e')](_0xb09b3a,{'transaction':_0x4da165})['spread'](function(_0x3e0a4b){return _0x3e0a4b;});});});}})[_0x012f('0x43')](respondWithResult(_0x251a3c,null))[_0x012f('0x48')](handleError(_0x251a3c,null));};exports[_0x012f('0x8f')]=function(_0x236bcb,_0x362457){var _0x5398a3=_[_0x012f('0x79')](_0x236bcb[_0x012f('0x33')][_0x012f('0x76')])?_0x236bcb[_0x012f('0x33')][_0x012f('0x76')]:[_0x236bcb[_0x012f('0x33')][_0x012f('0x76')]];var _0x4ae06d=_0x236bcb['params']['id'];return db[_0x012f('0x42')][_0x012f('0x4b')]({'where':{'id':_0x4ae06d}})[_0x012f('0x43')](handleEntityNotFound(_0x362457,null))[_0x012f('0x43')](function(_0x26d37d){if(_0x26d37d){var _0x2f1de=[_0x012f('0x7a'),_0x012f('0x7b'),_0x012f('0x7c'),_0x012f('0x90'),_0x012f('0x7d'),_0x012f('0x7e'),'Whatsapp'];return db[_0x012f('0x56')]['transaction'](function(_0x1df167){var _0x4435c0=_['map'](_0x2f1de,function(_0x25f4f1){var _0x425fa5={'attributes':['id',_0x012f('0x2c')]};return _0x26d37d[_0x012f('0x4f')+_0x25f4f1+_0x012f('0x74')](_0x425fa5)[_0x012f('0x43')](function(_0x894033){var _0x2ec417=_[_0x012f('0x2f')](_0x894033,function(_0x2ce209){return _0x2ce209[_0x012f('0x8f')](_0x5398a3,{'transaction':_0x1df167})[_0x012f('0x43')](function(){var _0x245e8f=_[_0x012f('0x2f')](_0x5398a3,function(_0xb99d0b){socket[_0x012f('0x91')]('user'+_0x25f4f1+_0x012f('0x92'),{'UserId':Number(_0xb99d0b),[_0x25f4f1+_0x012f('0x80')]:_0x2ce209['id']});if(_0x25f4f1!=='Voice'){return;}return db[_0x012f('0x85')][_0x012f('0x55')]({'where':{'VoiceQueueId':_0x2ce209['id'],'UserId':_0xb99d0b},'transaction':_0x1df167});});return Promise['all'](_0x245e8f);});});return Promise[_0x012f('0x8b')](_0x2ec417);});});return Promise[_0x012f('0x8b')](_0x4435c0)['then'](function(){return _0x26d37d[_0x012f('0x8f')](_0x5398a3,{'transaction':_0x1df167});})['then'](function(){return db[_0x012f('0x8c')][_0x012f('0x6c')]({'where':{'teamId':_0x4ae06d}})[_0x012f('0x43')](function(_0xa7860c){if(_0xa7860c){var _0x255832=_['map'](_0x5398a3,function(_0x436708){db['UserVoicePrefix'][_0x012f('0x55')]({'where':{'UserId':_0x436708,'VoicePrefixId':_0xa7860c['VoicePrefixId']}});});return Promise[_0x012f('0x8b')](_0x255832);}});});});}})['then'](respondWithStatusCode(_0x362457,null))['catch'](handleError(_0x362457,null));};exports[_0x012f('0x93')]=function(_0x4511b7,_0x4489cb,_0x3f8c98){var _0xb4d592={};var _0x2833dd={};var _0x21ff0d;var _0x2c8bf;return db[_0x012f('0x42')][_0x012f('0x6c')]({'where':{'id':_0x4511b7[_0x012f('0x49')]['id']}})[_0x012f('0x43')](handleEntityNotFound(_0x4489cb,null))[_0x012f('0x43')](function(_0x4cbd5e){if(_0x4cbd5e){_0x21ff0d=_0x4cbd5e;_0x2833dd[_0x012f('0x32')]=_[_0x012f('0x34')](db[_0x012f('0x83')][_0x012f('0x30')]);_0x2833dd['query']=_['keys'](_0x4511b7[_0x012f('0x33')]);_0x2833dd[_0x012f('0x35')]=_[_0x012f('0x4a')](_0x2833dd[_0x012f('0x32')],_0x2833dd[_0x012f('0x33')]);_0xb4d592[_0x012f('0x36')]=_['intersection'](_0x2833dd[_0x012f('0x32')],qs[_0x012f('0x37')](_0x4511b7['query']['fields']));_0xb4d592['attributes']=_0xb4d592[_0x012f('0x36')][_0x012f('0x38')]?_0xb4d592[_0x012f('0x36')]:_0x2833dd['model'];_0xb4d592['order']=qs[_0x012f('0x3b')](_0x4511b7[_0x012f('0x33')][_0x012f('0x3b')]);_0xb4d592['where']=qs[_0x012f('0x35')](_[_0x012f('0x73')](_0x4511b7[_0x012f('0x33')],_0x2833dd[_0x012f('0x35')]));if(_0x4511b7[_0x012f('0x33')][_0x012f('0x3d')]){_0xb4d592['where']=_[_0x012f('0x3e')](_0xb4d592[_0x012f('0x3c')],{'$or':_[_0x012f('0x2f')](_0xb4d592[_0x012f('0x36')],function(_0x591aa5){var _0x5c626c={};_0x5c626c[_0x591aa5]={'$like':'%'+_0x4511b7[_0x012f('0x33')][_0x012f('0x3d')]+'%'};return _0x5c626c;})});}_0xb4d592=_[_0x012f('0x3e')]({},_0xb4d592,_0x4511b7[_0x012f('0x41')]);return _0x21ff0d[_0x012f('0x93')](_0xb4d592);}})[_0x012f('0x43')](function(_0x4417f3){if(_0x4417f3){_0x2c8bf=_0x4417f3['length'];if(!_0x4511b7[_0x012f('0x33')][_0x012f('0x39')](_0x012f('0x94'))){_0xb4d592[_0x012f('0x24')]=qs[_0x012f('0x24')](_0x4511b7[_0x012f('0x33')][_0x012f('0x24')]);_0xb4d592[_0x012f('0x22')]=qs[_0x012f('0x22')](_0x4511b7[_0x012f('0x33')][_0x012f('0x22')]);}return _0x21ff0d['getAgents'](_0xb4d592);}})[_0x012f('0x43')](function(_0x578f43){if(_0x578f43){return _0x578f43?{'count':_0x2c8bf,'rows':_0x578f43}:null;}})[_0x012f('0x43')](respondWithResult(_0x4489cb,null))[_0x012f('0x48')](handleError(_0x4489cb,null));}; \ No newline at end of file +var _0x4009=['ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','isArray','Chat','Sms','Fax','transaction','Voice','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','user','Queue:save','QueueId','findAll','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','all','addAgents','spread','removeAgents','Mail','Whatsapp','Queue:remove','getAgents','filter','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','sendStatus','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','rows','then','catch','show','params','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','UserProfileResource','findOne','channel'];(function(_0x141380,_0x39a064){var _0x184ed8=function(_0x3d0dee){while(--_0x3d0dee){_0x141380['push'](_0x141380['shift']());}};_0x184ed8(++_0x39a064);}(_0x4009,0xcf));var _0x9400=function(_0x2fa012,_0x5dac07){_0x2fa012=_0x2fa012-0x0;var _0x2f61e5=_0x4009[_0x2fa012];return _0x2f61e5;};'use strict';var emlformat=require(_0x9400('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9400('0x1'));var rp=require(_0x9400('0x2'));var moment=require(_0x9400('0x3'));var BPromise=require(_0x9400('0x4'));var Mustache=require(_0x9400('0x5'));var util=require(_0x9400('0x6'));var path=require(_0x9400('0x7'));var sox=require('sox');var csv=require(_0x9400('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9400('0x9'));var _=require(_0x9400('0xa'));var squel=require(_0x9400('0xb'));var crypto=require(_0x9400('0xc'));var jsforce=require(_0x9400('0xd'));var deskjs=require(_0x9400('0xe'));var toCsv=require(_0x9400('0x8'));var querystring=require(_0x9400('0xf'));var Papa=require(_0x9400('0x10'));var Redis=require(_0x9400('0x11'));var authService=require(_0x9400('0x12'));var qs=require(_0x9400('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9400('0x14'));var logger=require(_0x9400('0x15'))(_0x9400('0x16'));var utils=require(_0x9400('0x17'));var config=require(_0x9400('0x18'));var licenseUtil=require(_0x9400('0x19'));var db=require(_0x9400('0x1a'))['db'];config[_0x9400('0x1b')]=_['defaults'](config[_0x9400('0x1b')],{'host':_0x9400('0x1c'),'port':0x18eb});var socket=require(_0x9400('0x1d'))(new Redis(config['redis']));require(_0x9400('0x1e'))[_0x9400('0x1f')](socket);function respondWithStatusCode(_0x29cec4,_0x436686){_0x436686=_0x436686||0xcc;return function(_0x318189){if(_0x318189){return _0x29cec4['sendStatus'](_0x436686);}return _0x29cec4[_0x9400('0x20')](_0x436686)[_0x9400('0x21')]();};}function respondWithResult(_0x5015a5,_0x169bf6){_0x169bf6=_0x169bf6||0xc8;return function(_0x4717ff){if(_0x4717ff){return _0x5015a5[_0x9400('0x20')](_0x169bf6)[_0x9400('0x22')](_0x4717ff);}};}function respondWithFilteredResult(_0x4ce8f2,_0x3a811b){return function(_0x5393ee){if(_0x5393ee){var _0x63a9e0=typeof _0x3a811b[_0x9400('0x23')]===_0x9400('0x24')&&typeof _0x3a811b[_0x9400('0x25')]===_0x9400('0x24');var _0x57aa50=_0x5393ee[_0x9400('0x26')];var _0x592143=_0x63a9e0?0x0:_0x3a811b[_0x9400('0x23')];var _0x548968=_0x63a9e0?_0x5393ee[_0x9400('0x26')]:_0x3a811b[_0x9400('0x23')]+_0x3a811b[_0x9400('0x25')];var _0x5c5ebe;if(_0x548968>=_0x57aa50){_0x548968=_0x57aa50;_0x5c5ebe=0xc8;}else{_0x5c5ebe=0xce;}_0x4ce8f2[_0x9400('0x20')](_0x5c5ebe);return _0x4ce8f2[_0x9400('0x27')](_0x9400('0x28'),_0x592143+'-'+_0x548968+'/'+_0x57aa50)['json'](_0x5393ee);}return null;};}function patchUpdates(_0x18fc59){return function(_0x1bfcf3){try{jsonpatch[_0x9400('0x29')](_0x1bfcf3,_0x18fc59,!![]);}catch(_0x2065d2){return BPromise[_0x9400('0x2a')](_0x2065d2);}return _0x1bfcf3[_0x9400('0x2b')]();};}function saveUpdates(_0x110b52,_0x58fd7e){return function(_0x3cabdc){if(_0x3cabdc){return _0x3cabdc[_0x9400('0x2c')](_0x110b52)['then'](function(_0xfacca9){return _0xfacca9;});}return null;};}function handleEntityNotFound(_0x59472d,_0x436b2){return function(_0x1b68bf){if(!_0x1b68bf){_0x59472d[_0x9400('0x2d')](0x194);}return _0x1b68bf;};}function handleError(_0x4cb94c,_0x21b3aa){_0x21b3aa=_0x21b3aa||0x1f4;return function(_0x23eb41){logger[_0x9400('0x2e')](_0x23eb41[_0x9400('0x2f')]);if(_0x23eb41[_0x9400('0x30')]){delete _0x23eb41[_0x9400('0x30')];}_0x4cb94c[_0x9400('0x20')](_0x21b3aa)[_0x9400('0x31')](_0x23eb41);};}exports[_0x9400('0x32')]=function(_0x4737a6,_0x1147e3){var _0x33fa51={},_0x500c09={},_0x1220a5={'count':0x0,'rows':[]};var _0x33c671=_[_0x9400('0x33')](db[_0x9400('0x34')][_0x9400('0x35')],function(_0x162672){return{'name':_0x162672[_0x9400('0x36')],'type':_0x162672[_0x9400('0x37')]['key']};});_0x500c09[_0x9400('0x38')]=_[_0x9400('0x33')](_0x33c671,_0x9400('0x30'));_0x500c09['query']=_[_0x9400('0x39')](_0x4737a6[_0x9400('0x3a')]);_0x500c09[_0x9400('0x3b')]=_[_0x9400('0x3c')](_0x500c09[_0x9400('0x38')],_0x500c09['query']);_0x33fa51[_0x9400('0x3d')]=_[_0x9400('0x3c')](_0x500c09[_0x9400('0x38')],qs[_0x9400('0x3e')](_0x4737a6[_0x9400('0x3a')][_0x9400('0x3e')]));_0x33fa51['attributes']=_0x33fa51[_0x9400('0x3d')][_0x9400('0x3f')]?_0x33fa51[_0x9400('0x3d')]:_0x500c09[_0x9400('0x38')];if(!_0x4737a6['query'][_0x9400('0x40')](_0x9400('0x41'))){_0x33fa51[_0x9400('0x25')]=qs[_0x9400('0x25')](_0x4737a6['query'][_0x9400('0x25')]);_0x33fa51[_0x9400('0x23')]=qs['offset'](_0x4737a6['query'][_0x9400('0x23')]);}_0x33fa51[_0x9400('0x42')]=qs[_0x9400('0x43')](_0x4737a6[_0x9400('0x3a')][_0x9400('0x43')]);_0x33fa51[_0x9400('0x44')]=qs[_0x9400('0x3b')](_[_0x9400('0x45')](_0x4737a6[_0x9400('0x3a')],_0x500c09[_0x9400('0x3b')]),_0x33c671);if(_0x4737a6[_0x9400('0x3a')]['filter']){_0x33fa51[_0x9400('0x44')]=_[_0x9400('0x46')](_0x33fa51[_0x9400('0x44')],{'$or':_['map'](_0x33c671,function(_0x9c0c27){if(_0x9c0c27[_0x9400('0x37')]!==_0x9400('0x47')){var _0x1d281b={};_0x1d281b[_0x9c0c27['name']]={'$like':'%'+_0x4737a6[_0x9400('0x3a')]['filter']+'%'};return _0x1d281b;}})});}_0x33fa51=_[_0x9400('0x46')]({},_0x33fa51,_0x4737a6[_0x9400('0x48')]);var _0x2a8274={'where':_0x33fa51[_0x9400('0x44')]};return db[_0x9400('0x34')][_0x9400('0x26')](_0x2a8274)['then'](function(_0x558b06){_0x1220a5[_0x9400('0x26')]=_0x558b06;if(_0x4737a6[_0x9400('0x3a')]['includeAll']){_0x33fa51['include']=[{'all':!![]}];}return db[_0x9400('0x34')]['findAll'](_0x33fa51);})['then'](function(_0x33fafd){_0x1220a5[_0x9400('0x49')]=_0x33fafd;return _0x1220a5;})[_0x9400('0x4a')](respondWithFilteredResult(_0x1147e3,_0x33fa51))[_0x9400('0x4b')](handleError(_0x1147e3,null));};exports[_0x9400('0x4c')]=function(_0x5b9281,_0x3e7f4c){var _0x3bfa8d={'raw':![],'where':{'id':_0x5b9281[_0x9400('0x4d')]['id']}},_0x2998fc={};_0x2998fc[_0x9400('0x38')]=_[_0x9400('0x39')](db[_0x9400('0x34')][_0x9400('0x35')]);_0x2998fc[_0x9400('0x3a')]=_[_0x9400('0x39')](_0x5b9281[_0x9400('0x3a')]);_0x2998fc[_0x9400('0x3b')]=_[_0x9400('0x3c')](_0x2998fc[_0x9400('0x38')],_0x2998fc['query']);_0x3bfa8d[_0x9400('0x3d')]=_[_0x9400('0x3c')](_0x2998fc[_0x9400('0x38')],qs[_0x9400('0x3e')](_0x5b9281[_0x9400('0x3a')][_0x9400('0x3e')]));_0x3bfa8d['attributes']=_0x3bfa8d[_0x9400('0x3d')][_0x9400('0x3f')]?_0x3bfa8d[_0x9400('0x3d')]:_0x2998fc['model'];if(_0x5b9281[_0x9400('0x3a')][_0x9400('0x4e')]){_0x3bfa8d[_0x9400('0x4f')]=[{'all':!![]}];}_0x3bfa8d=_[_0x9400('0x46')]({},_0x3bfa8d,_0x5b9281[_0x9400('0x48')]);return db[_0x9400('0x34')][_0x9400('0x50')](_0x3bfa8d)[_0x9400('0x4a')](handleEntityNotFound(_0x3e7f4c,null))['then'](respondWithResult(_0x3e7f4c,null))[_0x9400('0x4b')](handleError(_0x3e7f4c,null));};exports[_0x9400('0x51')]=function(_0x43748c,_0x4faafa){return db[_0x9400('0x34')][_0x9400('0x51')](_0x43748c[_0x9400('0x52')],{})[_0x9400('0x4a')](function(_0x3779ac){var _0xe98f85=_0x43748c['user']['get']({'plain':!![]});if(!_0xe98f85)throw new Error(_0x9400('0x53'));if(_0xe98f85[_0x9400('0x54')]==='user'){var _0x4aea44=_0x3779ac[_0x9400('0x55')]({'plain':!![]});var _0x106213=_0x9400('0x56');return db[_0x9400('0x57')][_0x9400('0x50')]({'where':{'name':_0x106213,'userProfileId':_0xe98f85[_0x9400('0x58')]},'raw':!![]})[_0x9400('0x4a')](function(_0x2ddf5e){if(_0x2ddf5e&&_0x2ddf5e[_0x9400('0x59')]===0x0){return db['UserProfileResource'][_0x9400('0x51')]({'name':_0x4aea44[_0x9400('0x30')],'resourceId':_0x4aea44['id'],'type':_0x2ddf5e[_0x9400('0x30')],'sectionId':_0x2ddf5e['id']},{})['then'](function(){return _0x3779ac;});}else{return _0x3779ac;}})['catch'](function(_0x1fef94){logger[_0x9400('0x2e')](_0x9400('0x5a'),_0x1fef94);throw _0x1fef94;});}return _0x3779ac;})[_0x9400('0x4a')](respondWithResult(_0x4faafa,0xc9))[_0x9400('0x4b')](handleError(_0x4faafa,null));};exports[_0x9400('0x2c')]=function(_0xad77eb,_0x14a3a3){if(_0xad77eb[_0x9400('0x52')]['id']){delete _0xad77eb[_0x9400('0x52')]['id'];}return db[_0x9400('0x34')][_0x9400('0x50')]({'where':{'id':_0xad77eb['params']['id']}})['then'](handleEntityNotFound(_0x14a3a3,null))[_0x9400('0x4a')](saveUpdates(_0xad77eb[_0x9400('0x52')],null))[_0x9400('0x4a')](respondWithResult(_0x14a3a3,null))['catch'](handleError(_0x14a3a3,null));};exports['destroy']=function(_0x514365,_0xd1ccec){var _0xc7b2d4=_0x514365[_0x9400('0x4d')]['id'];var _0x42e14d=[];return db['sequelize']['transaction'](function(_0x21e52c){var _0x1dd43d=_0x9400('0x5b')+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x1dd43d,{'type':db[_0x9400('0x5d')][_0x9400('0x5e')][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c})[_0x9400('0x4a')](function(_0xc0eebd){_0x42e14d=_['map'](_0xc0eebd,function(_0x59e072){return Number(_0x59e072[_0x9400('0x60')]);});})[_0x9400('0x4a')](function(){var _0x423e8b=_0x9400('0x61')+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x423e8b,{'type':db['Sequelize'][_0x9400('0x5e')][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c});})['then'](function(_0x16ca10){var _0x2b7a40=_['map'](_0x16ca10,function(_0x58514f){return Number(_0x58514f[_0x9400('0x62')]);});return db[_0x9400('0x63')][_0x9400('0x64')]({'where':{'UserId':{'$in':_0x42e14d},'VoiceQueueId':{'$in':_0x2b7a40}},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){var _0x3cc31e=_0x9400('0x65')+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x3cc31e,{'type':db['Sequelize'][_0x9400('0x5e')]['SELECT'],'raw':!![],'transaction':_0x21e52c});})['then'](function(_0x1ee53e){var _0x44a44c=_[_0x9400('0x33')](_0x1ee53e,function(_0x210994){return Number(_0x210994[_0x9400('0x66')]);});return db[_0x9400('0x67')][_0x9400('0x64')]({'where':{'UserId':{'$in':_0x42e14d},'MailQueueId':{'$in':_0x44a44c}},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){var _0x450749=_0x9400('0x68')+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x450749,{'type':db['Sequelize'][_0x9400('0x5e')][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c});})['then'](function(_0x2f6c14){var _0x4ad42d=_[_0x9400('0x33')](_0x2f6c14,function(_0x5d13ac){return Number(_0x5d13ac[_0x9400('0x69')]);});return db[_0x9400('0x6a')]['destroy']({'where':{'UserId':{'$in':_0x42e14d},'SmsQueueId':{'$in':_0x4ad42d}},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){var _0x2e938c=_0x9400('0x6b')+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x2e938c,{'type':db[_0x9400('0x5d')][_0x9400('0x5e')][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c});})[_0x9400('0x4a')](function(_0x517a2e){var _0x1cfa0c=_['map'](_0x517a2e,function(_0x4caa36){return Number(_0x4caa36[_0x9400('0x6c')]);});return db['UserChatQueue'][_0x9400('0x64')]({'where':{'UserId':{'$in':_0x42e14d},'ChatQueueId':{'$in':_0x1cfa0c}},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){var _0x399ea0=_0x9400('0x6d')+_0xc7b2d4;return db['sequelize'][_0x9400('0x3a')](_0x399ea0,{'type':db[_0x9400('0x5d')][_0x9400('0x5e')][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c});})['then'](function(_0x1fd983){var _0x451316=_[_0x9400('0x33')](_0x1fd983,function(_0x2edba7){return Number(_0x2edba7['FaxQueueId']);});return db['UserFaxQueue'][_0x9400('0x64')]({'where':{'UserId':{'$in':_0x42e14d},'FaxQueueId':{'$in':_0x451316}},'transaction':_0x21e52c});})['then'](function(){var _0x57f8b8='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x57f8b8,{'type':db['Sequelize']['QueryTypes'][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c});})['then'](function(_0x16c5b2){var _0x337370=_['map'](_0x16c5b2,function(_0x34549e){return Number(_0x34549e[_0x9400('0x6e')]);});return db[_0x9400('0x6f')]['destroy']({'where':{'UserId':{'$in':_0x42e14d},'OpenchannelQueueId':{'$in':_0x337370}},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){var _0x3139c5='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xc7b2d4;return db[_0x9400('0x5c')][_0x9400('0x3a')](_0x3139c5,{'type':db[_0x9400('0x5d')][_0x9400('0x5e')][_0x9400('0x5f')],'raw':!![],'transaction':_0x21e52c});})[_0x9400('0x4a')](function(_0x2fd78e){var _0x3ffcfd=_['map'](_0x2fd78e,function(_0x58d075){return Number(_0x58d075[_0x9400('0x70')]);});return db['UserWhatsappQueue'][_0x9400('0x64')]({'where':{'UserId':{'$in':_0x42e14d},'WhatsappQueueId':{'$in':_0x3ffcfd}},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){return db[_0x9400('0x71')]['find']({'where':{'TeamId':_0xc7b2d4}});})[_0x9400('0x4a')](function(_0x3ae743){if(_0x3ae743===null){return;}return db[_0x9400('0x72')]['destroy']({'where':{'UserId':{'$in':_0x42e14d},'VoicePrefixId':_0x3ae743[_0x9400('0x73')]},'transaction':_0x21e52c});})[_0x9400('0x4a')](function(){return db[_0x9400('0x34')][_0x9400('0x64')]({'where':{'id':_0xc7b2d4},'cascade':!![],'transaction':_0x21e52c});})[_0x9400('0x4a')](function(_0x374c70){if(_0x374c70===0x0){_0xd1ccec[_0x9400('0x2d')](0x194);}else{return db[_0x9400('0x74')][_0x9400('0x64')]({'where':{'type':'Teams','resourceId':_0xc7b2d4},'cascade':!![],'transaction':_0x21e52c})[_0x9400('0x4a')](function(){_0xd1ccec['status'](0xcc)[_0x9400('0x21')]();});}})['catch'](function(_0xd8c562){_0xd1ccec[_0x9400('0x20')](0x1f4)[_0x9400('0x31')](_0xd8c562);});});};exports['getQueues']=function(_0x4f4776,_0x357ba2,_0xed27f2){return db[_0x9400('0x34')][_0x9400('0x75')]({'where':{'id':_0x4f4776[_0x9400('0x4d')]['id']}})[_0x9400('0x4a')](handleEntityNotFound(_0x357ba2,null))[_0x9400('0x4a')](function(_0x551d06){if(!_0x4f4776[_0x9400('0x3a')][_0x9400('0x76')]||!utils['isValidChannel'](_0x4f4776[_0x9400('0x3a')][_0x9400('0x76')])){throw new db[(_0x9400('0x5d'))][(_0x9400('0x77'))](_0x9400('0x78'));}var _0x1c44b3={};var _0x374d09={};_0x374d09[_0x9400('0x38')]=_['keys'](db[_[_0x9400('0x79')](_0x4f4776[_0x9400('0x3a')][_0x9400('0x76')][_0x9400('0x7a')]())+_0x9400('0x7b')][_0x9400('0x35')]);_0x374d09[_0x9400('0x3a')]=_[_0x9400('0x39')](_0x4f4776[_0x9400('0x3a')]);_0x374d09[_0x9400('0x3b')]=_[_0x9400('0x3c')](_0x374d09['model'],_0x374d09['query']);_0x1c44b3[_0x9400('0x3d')]=_['intersection'](_0x374d09[_0x9400('0x38')],qs[_0x9400('0x3e')](_0x4f4776['query']['fields']));_0x1c44b3[_0x9400('0x3d')]=_0x1c44b3[_0x9400('0x3d')][_0x9400('0x3f')]?_0x1c44b3[_0x9400('0x3d')]:_0x374d09[_0x9400('0x38')];_0x1c44b3[_0x9400('0x25')]=qs[_0x9400('0x25')](_0x4f4776[_0x9400('0x3a')][_0x9400('0x25')]);_0x1c44b3[_0x9400('0x23')]=qs[_0x9400('0x23')](_0x4f4776[_0x9400('0x3a')][_0x9400('0x23')]);_0x1c44b3[_0x9400('0x42')]=qs[_0x9400('0x43')](_0x4f4776['query'][_0x9400('0x43')]);_0x1c44b3['where']=qs['filters'](_[_0x9400('0x45')](_0x4f4776[_0x9400('0x3a')],_0x374d09['filters']));_0x1c44b3=_['merge']({},_0x1c44b3,_0x4f4776['options']);return _0x551d06[_0x9400('0x55')+_['capitalize'](_0x4f4776[_0x9400('0x3a')]['channel']['toLowerCase']())+_0x9400('0x7c')](_0x1c44b3);})['then'](respondWithResult(_0x357ba2,null))['catch'](handleError(_0x357ba2,null));};exports[_0x9400('0x7d')]=function(_0x5348fc,_0x44e1b1,_0x4fbd6c){return db['Team'][_0x9400('0x75')]({'where':{'id':_0x5348fc[_0x9400('0x4d')]['id']}})[_0x9400('0x4a')](function(_0x287467){if(_0x287467){if(!_0x5348fc[_0x9400('0x52')][_0x9400('0x76')]||!utils[_0x9400('0x7e')](_0x5348fc['body'][_0x9400('0x76')])){throw new db[(_0x9400('0x5d'))]['ValidationError']('Unknown\x20channel');}return _0x287467[_0x9400('0x7f')+_[_0x9400('0x79')](_0x5348fc[_0x9400('0x52')][_0x9400('0x76')][_0x9400('0x7a')]())+_0x9400('0x7c')](_0x5348fc[_0x9400('0x52')][_0x9400('0x80')]);}return null;})[_0x9400('0x4a')](handleEntityNotFound(_0x44e1b1,null))['then'](respondWithStatusCode(_0x44e1b1,null))[_0x9400('0x4b')](handleError(_0x44e1b1,null));};exports[_0x9400('0x81')]=function(_0xffd961,_0x3d8d18,_0x57570b){return db[_0x9400('0x34')][_0x9400('0x75')]({'where':{'id':_0xffd961['params']['id']}})[_0x9400('0x4a')](function(_0x487b23){if(_0x487b23){if(!_0xffd961[_0x9400('0x3a')][_0x9400('0x76')]||!utils[_0x9400('0x7e')](_0xffd961[_0x9400('0x3a')][_0x9400('0x76')])){throw new db[(_0x9400('0x5d'))][(_0x9400('0x77'))](_0x9400('0x78'));}return _0x487b23[_0x9400('0x82')+_[_0x9400('0x79')](_0xffd961[_0x9400('0x3a')][_0x9400('0x76')]['toLowerCase']())+_0x9400('0x7c')](_0xffd961[_0x9400('0x3a')][_0x9400('0x80')]);}return null;})[_0x9400('0x4a')](handleEntityNotFound(_0x3d8d18,null))[_0x9400('0x4a')](respondWithStatusCode(_0x3d8d18,null))[_0x9400('0x4b')](handleError(_0x3d8d18,null));};exports['addAgents']=function(_0x16afa8,_0x146a4c){var _0x2f43b7=_[_0x9400('0x83')](_0x16afa8[_0x9400('0x52')][_0x9400('0x80')])?_0x16afa8[_0x9400('0x52')][_0x9400('0x80')]:[_0x16afa8[_0x9400('0x52')][_0x9400('0x80')]];var _0x396a11=_0x16afa8[_0x9400('0x4d')]['id'];return db[_0x9400('0x34')][_0x9400('0x50')]({'where':{'id':_0x396a11}})[_0x9400('0x4a')](handleEntityNotFound(_0x146a4c,null))['then'](function(_0x167a29){if(_0x167a29){var _0xfc0f4b=['Voice',_0x9400('0x84'),'Mail',_0x9400('0x85'),_0x9400('0x86'),'Openchannel','Whatsapp'];return db[_0x9400('0x5c')][_0x9400('0x87')](function(_0x2cd6d8){var _0x7ce751=_[_0x9400('0x33')](_0xfc0f4b,function(_0x2b0709){var _0x5a9f09={'attributes':['id','name']};if(_0x2b0709===_0x9400('0x88')){_0x5a9f09[_0x9400('0x89')]={'attributes':[_0x9400('0x8a')]};}return _0x167a29[_0x9400('0x55')+_0x2b0709+_0x9400('0x7c')](_0x5a9f09)[_0x9400('0x4a')](function(_0xa4dea){var _0x4bc08b=_[_0x9400('0x33')](_0xa4dea,function(_0x4c3f79){var _0x39f838=_[_0x9400('0x33')](_0x2f43b7,function(_0x14bdd1){var _0x295486={'where':{'UserId':_0x14bdd1,[_0x2b0709+'QueueId']:_0x4c3f79['id']},'transaction':_0x2cd6d8};if(_0x2b0709===_0x9400('0x88')){_0x295486['defaults']={'penalty':_0x4c3f79[_0x9400('0x8b')][_0x9400('0x8a')]};}return db[_0x9400('0x8c')+_0x2b0709+'Queue'][_0x9400('0x8d')](_0x295486)[_0x9400('0x4a')](function(){socket[_0x9400('0x8e')](_0x9400('0x8f')+_0x2b0709+_0x9400('0x90'),{'UserId':_0x14bdd1,[_0x2b0709+_0x9400('0x91')]:_0x4c3f79['id']});if(_0x2b0709!==_0x9400('0x88')){return;}return db[_0x9400('0x8c')][_0x9400('0x92')]({'where':{'id':_0x2f43b7,'online':0x1},'attributes':['id',_0x9400('0x30'),_0x9400('0x93'),_0x9400('0x94'),'interface'],'raw':!![]})['then'](function(_0x346ce7){var _0x5c4bb4=_[_0x9400('0x33')](_0x346ce7,function(_0x36867f){return db[_0x9400('0x95')][_0x9400('0x96')]({'membername':_0x36867f[_0x9400('0x30')],'UserId':_0x36867f['id'],'queue_name':_0x4c3f79[_0x9400('0x30')],'VoiceQueueId':_0x4c3f79['id'],'interface':_[_0x9400('0x97')](_0x36867f[_0x9400('0x98')])?util[_0x9400('0x99')]('SIP/%s',_0x36867f[_0x9400('0x30')]):_0x36867f[_0x9400('0x98')],'paused':_0x36867f[_0x9400('0x94')]||![],'penalty':_0x4c3f79['TeamVoiceQueue']['penalty']},{'transaction':_0x2cd6d8});});return Promise[_0x9400('0x9a')](_0x5c4bb4);});});});return Promise[_0x9400('0x9a')](_0x39f838);});return Promise[_0x9400('0x9a')](_0x4bc08b);})[_0x9400('0x4a')](function(){return db[_0x9400('0x71')][_0x9400('0x75')]({'where':{'teamId':_0x396a11}})[_0x9400('0x4a')](function(_0x4facd1){if(_0x4facd1){var _0x48fc0a=_[_0x9400('0x33')](_0x2f43b7,function(_0x3a631f){db['UserVoicePrefix']['upsert']({'UserId':_0x3a631f,'VoicePrefixId':_0x4facd1[_0x9400('0x73')]});});return Promise[_0x9400('0x9a')](_0x48fc0a);}});});});return Promise[_0x9400('0x9a')](_0x7ce751)[_0x9400('0x4a')](function(){return _0x167a29[_0x9400('0x9b')](_0x2f43b7,{'transaction':_0x2cd6d8})[_0x9400('0x9c')](function(_0x5af926){return _0x5af926;});});});}})[_0x9400('0x4a')](respondWithResult(_0x146a4c,null))[_0x9400('0x4b')](handleError(_0x146a4c,null));};exports[_0x9400('0x9d')]=function(_0x2666a0,_0x2bb0f3){var _0x5faf92=_['isArray'](_0x2666a0[_0x9400('0x3a')]['ids'])?_0x2666a0['query'][_0x9400('0x80')]:[_0x2666a0[_0x9400('0x3a')][_0x9400('0x80')]];var _0x565e94=_0x2666a0[_0x9400('0x4d')]['id'];return db['Team']['find']({'where':{'id':_0x565e94}})['then'](handleEntityNotFound(_0x2bb0f3,null))[_0x9400('0x4a')](function(_0x2423cb){if(_0x2423cb){var _0x4d2974=[_0x9400('0x88'),'Chat',_0x9400('0x9e'),'Sms','Fax','Openchannel',_0x9400('0x9f')];return db[_0x9400('0x5c')][_0x9400('0x87')](function(_0x2d3deb){var _0x2c66c6=_['map'](_0x4d2974,function(_0x493004){var _0x2b7201={'attributes':['id',_0x9400('0x30')]};return _0x2423cb['get'+_0x493004+_0x9400('0x7c')](_0x2b7201)[_0x9400('0x4a')](function(_0x16b442){var _0x57743c=_[_0x9400('0x33')](_0x16b442,function(_0x564252){return _0x564252['removeAgents'](_0x5faf92,{'transaction':_0x2d3deb})[_0x9400('0x4a')](function(){var _0x1bc7fc=_['map'](_0x5faf92,function(_0x3c2b63){socket[_0x9400('0x8e')](_0x9400('0x8f')+_0x493004+_0x9400('0xa0'),{'UserId':Number(_0x3c2b63),[_0x493004+'QueueId']:_0x564252['id']});if(_0x493004!==_0x9400('0x88')){return;}return db[_0x9400('0x95')][_0x9400('0x64')]({'where':{'VoiceQueueId':_0x564252['id'],'UserId':_0x3c2b63},'transaction':_0x2d3deb});});return Promise[_0x9400('0x9a')](_0x1bc7fc);});});return Promise['all'](_0x57743c);});});return Promise[_0x9400('0x9a')](_0x2c66c6)['then'](function(){return _0x2423cb[_0x9400('0x9d')](_0x5faf92,{'transaction':_0x2d3deb});})['then'](function(){return db[_0x9400('0x71')][_0x9400('0x75')]({'where':{'teamId':_0x565e94}})[_0x9400('0x4a')](function(_0x2954fe){if(_0x2954fe){var _0x203034=_[_0x9400('0x33')](_0x5faf92,function(_0x49c215){db[_0x9400('0x72')][_0x9400('0x64')]({'where':{'UserId':_0x49c215,'VoicePrefixId':_0x2954fe[_0x9400('0x73')]}});});return Promise[_0x9400('0x9a')](_0x203034);}});});});}})[_0x9400('0x4a')](respondWithStatusCode(_0x2bb0f3,null))[_0x9400('0x4b')](handleError(_0x2bb0f3,null));};exports[_0x9400('0xa1')]=function(_0x537ee0,_0x5ee7ba,_0x200efc){var _0x4029f9={};var _0x1ab682={};var _0x50a439;var _0x432d83;return db[_0x9400('0x34')][_0x9400('0x75')]({'where':{'id':_0x537ee0[_0x9400('0x4d')]['id']}})[_0x9400('0x4a')](handleEntityNotFound(_0x5ee7ba,null))[_0x9400('0x4a')](function(_0x557145){if(_0x557145){_0x50a439=_0x557145;_0x1ab682[_0x9400('0x38')]=_['keys'](db['User'][_0x9400('0x35')]);_0x1ab682[_0x9400('0x3a')]=_[_0x9400('0x39')](_0x537ee0['query']);_0x1ab682[_0x9400('0x3b')]=_[_0x9400('0x3c')](_0x1ab682[_0x9400('0x38')],_0x1ab682['query']);_0x4029f9[_0x9400('0x3d')]=_[_0x9400('0x3c')](_0x1ab682[_0x9400('0x38')],qs[_0x9400('0x3e')](_0x537ee0[_0x9400('0x3a')]['fields']));_0x4029f9[_0x9400('0x3d')]=_0x4029f9[_0x9400('0x3d')][_0x9400('0x3f')]?_0x4029f9[_0x9400('0x3d')]:_0x1ab682[_0x9400('0x38')];_0x4029f9[_0x9400('0x42')]=qs[_0x9400('0x43')](_0x537ee0[_0x9400('0x3a')][_0x9400('0x43')]);_0x4029f9[_0x9400('0x44')]=qs[_0x9400('0x3b')](_[_0x9400('0x45')](_0x537ee0['query'],_0x1ab682['filters']));if(_0x537ee0[_0x9400('0x3a')][_0x9400('0xa2')]){_0x4029f9[_0x9400('0x44')]=_['merge'](_0x4029f9[_0x9400('0x44')],{'$or':_['map'](_0x4029f9[_0x9400('0x3d')],function(_0x1315e5){var _0x3241d1={};_0x3241d1[_0x1315e5]={'$like':'%'+_0x537ee0[_0x9400('0x3a')][_0x9400('0xa2')]+'%'};return _0x3241d1;})});}_0x4029f9=_[_0x9400('0x46')]({},_0x4029f9,_0x537ee0[_0x9400('0x48')]);return _0x50a439['getAgents'](_0x4029f9);}})[_0x9400('0x4a')](function(_0x2fc7fd){if(_0x2fc7fd){_0x432d83=_0x2fc7fd[_0x9400('0x3f')];if(!_0x537ee0[_0x9400('0x3a')][_0x9400('0x40')]('nolimit')){_0x4029f9['limit']=qs['limit'](_0x537ee0[_0x9400('0x3a')][_0x9400('0x25')]);_0x4029f9[_0x9400('0x23')]=qs['offset'](_0x537ee0[_0x9400('0x3a')][_0x9400('0x23')]);}return _0x50a439['getAgents'](_0x4029f9);}})[_0x9400('0x4a')](function(_0x21e967){if(_0x21e967){return _0x21e967?{'count':_0x432d83,'rows':_0x21e967}:null;}})[_0x9400('0x4a')](respondWithResult(_0x5ee7ba,null))['catch'](handleError(_0x5ee7ba,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 606aa37..44c6397 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 _0xfec8=['emit','hasOwnProperty','hook','exports','events','save','remove'];(function(_0x5d3267,_0xe106a8){var _0x57dba1=function(_0x22d379){while(--_0x22d379){_0x5d3267['push'](_0x5d3267['shift']());}};_0x57dba1(++_0xe106a8);}(_0xfec8,0x19a));var _0x8fec=function(_0xd7b0a4,_0x53c7d3){_0xd7b0a4=_0xd7b0a4-0x0;var _0x184e9e=_0xfec8[_0xd7b0a4];return _0x184e9e;};'use strict';var EventEmitter=require(_0x8fec('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8fec('0x1'),'afterUpdate':'update','afterDestroy':_0x8fec('0x2')};function emitEvent(_0x4ef389){return function(_0x2db9c8,_0x3178b2,_0x4db8ab){TeamEvents[_0x8fec('0x3')](_0x4ef389+':'+_0x2db9c8['id'],_0x2db9c8);TeamEvents[_0x8fec('0x3')](_0x4ef389,_0x2db9c8);_0x4db8ab(null);};}for(var e in events){if(events[_0x8fec('0x4')](e)){var event=events[e];Team[_0x8fec('0x5')](e,emitEvent(event));}}module[_0x8fec('0x6')]=TeamEvents; \ No newline at end of file +var _0x87c6=['hook','exports','events','save','update','emit','hasOwnProperty'];(function(_0x23ca4d,_0x5c2a32){var _0x435432=function(_0xe1a5e5){while(--_0xe1a5e5){_0x23ca4d['push'](_0x23ca4d['shift']());}};_0x435432(++_0x5c2a32);}(_0x87c6,0x87));var _0x687c=function(_0x2b6263,_0x1be54e){_0x2b6263=_0x2b6263-0x0;var _0x8bb176=_0x87c6[_0x2b6263];return _0x8bb176;};'use strict';var EventEmitter=require(_0x687c('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x687c('0x1'),'afterUpdate':_0x687c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1ac030){return function(_0x155b22,_0x336b3f,_0xe7c0b0){TeamEvents[_0x687c('0x3')](_0x1ac030+':'+_0x155b22['id'],_0x155b22);TeamEvents['emit'](_0x1ac030,_0x155b22);_0xe7c0b0(null);};}for(var e in events){if(events[_0x687c('0x4')](e)){var event=events[e];Team[_0x687c('0x5')](e,emitEvent(event));}}module[_0x687c('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 2789de1..bea1582 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 _0xd987=['setDataValue','channel','catch','define','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes','get','then'];(function(_0xb5adad,_0x2e59a2){var _0x3558b4=function(_0x1467bf){while(--_0x1467bf){_0xb5adad['push'](_0xb5adad['shift']());}};_0x3558b4(++_0x2e59a2);}(_0xd987,0xe0));var _0x7d98=function(_0x5f483a,_0x4c942d){_0x5f483a=_0x5f483a-0x0;var _0x5bdfb6=_0xd987[_0x5f483a];return _0x5bdfb6;};'use strict';var _=require(_0x7d98('0x0'));var attributes=require(_0x7d98('0x1'));function getQueuesByChannel(_0x30ec3c,_0x211271){var _0x2672f3=_0x7d98('0x2')+_0x211271+'Queues';return _0x30ec3c[_0x2672f3]()[_0x7d98('0x3')](function(_0x1195ba){return _['map'](_0x1195ba,function(_0x41fad2){_0x41fad2[_0x7d98('0x4')](_0x7d98('0x5'),_0x211271);return _0x41fad2;});})[_0x7d98('0x6')](function(_0x1e553c){throw _0x1e553c;});}module['exports']=function(_0x47c699){return _0x47c699[_0x7d98('0x7')]('Team',attributes,{'tableName':_0x7d98('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4ed9da=this;var _0x66ac0c=[_0x7d98('0x9'),_0x7d98('0xa'),_0x7d98('0xb'),_0x7d98('0xc'),_0x7d98('0xd'),_0x7d98('0xe'),_0x7d98('0xf')];return Promise[_0x7d98('0x10')]()[_0x7d98('0x3')](function(){var _0x187cd8=_[_0x7d98('0x11')](_0x66ac0c,function(_0x130989){return getQueuesByChannel(_0x4ed9da,_0x130989);});return Promise[_0x7d98('0x12')](_0x187cd8);})[_0x7d98('0x6')](function(_0x340c22){throw _0x340c22;});}}});}; \ No newline at end of file +var _0xd9c0=['channel','exports','define','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','all','./team.attributes','get','Queues','then','setDataValue'];(function(_0x405db6,_0x2ae1e0){var _0x40131a=function(_0x51d3cc){while(--_0x51d3cc){_0x405db6['push'](_0x405db6['shift']());}};_0x40131a(++_0x2ae1e0);}(_0xd9c0,0x105));var _0x0d9c=function(_0x27a60b,_0x1dcfd5){_0x27a60b=_0x27a60b-0x0;var _0x4cff9a=_0xd9c0[_0x27a60b];return _0x4cff9a;};'use strict';var _=require('lodash');var attributes=require(_0x0d9c('0x0'));function getQueuesByChannel(_0x4712e3,_0x3cafdd){var _0x1f8de9=_0x0d9c('0x1')+_0x3cafdd+_0x0d9c('0x2');return _0x4712e3[_0x1f8de9]()[_0x0d9c('0x3')](function(_0xffa6ae){return _['map'](_0xffa6ae,function(_0x33c8fa){_0x33c8fa[_0x0d9c('0x4')](_0x0d9c('0x5'),_0x3cafdd);return _0x33c8fa;});})['catch'](function(_0x2f6f7a){throw _0x2f6f7a;});}module[_0x0d9c('0x6')]=function(_0x4ceffa){return _0x4ceffa[_0x0d9c('0x7')]('Team',attributes,{'tableName':_0x0d9c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x4cc614=this;var _0x30723d=[_0x0d9c('0x9'),_0x0d9c('0xa'),_0x0d9c('0xb'),_0x0d9c('0xc'),_0x0d9c('0xd'),_0x0d9c('0xe'),_0x0d9c('0xf')];return Promise[_0x0d9c('0x10')]()[_0x0d9c('0x3')](function(){var _0x14ddd5=_[_0x0d9c('0x11')](_0x30723d,function(_0xdb2cf4){return getQueuesByChannel(_0x4cc614,_0xdb2cf4);});return Promise[_0x0d9c('0x12')](_0x14ddd5);})['catch'](function(_0x50faf6){throw _0x50faf6;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 285230e..be9d966 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 _0x78ce=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','Team,\x20%s,\x20%s','Team,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x78ce,0xc4));var _0xe78c=function(_0x1c90a7,_0x115e4d){_0x1c90a7=_0x1c90a7-0x0;var _0x408b33=_0x78ce[_0x1c90a7];return _0x408b33;};'use strict';var _=require(_0xe78c('0x0'));var util=require(_0xe78c('0x1'));var moment=require(_0xe78c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe78c('0x3'));var fs=require('fs');var Redis=require(_0xe78c('0x4'));var db=require(_0xe78c('0x5'))['db'];var utils=require(_0xe78c('0x6'));var logger=require('../../config/logger')(_0xe78c('0x7'));var config=require(_0xe78c('0x8'));var jayson=require(_0xe78c('0x9'));var client=jayson[_0xe78c('0xa')][_0xe78c('0xb')]({'port':0x232a});config[_0xe78c('0xc')]=_[_0xe78c('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe78c('0xe'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x3c4e0b,_0xb72cee,_0xcd4819){return new BPromise(function(_0x5544ef,_0x491ad1){return client[_0xe78c('0xf')](_0x3c4e0b,_0xcd4819)[_0xe78c('0x10')](function(_0x5189c0){logger[_0xe78c('0x11')](_0xe78c('0x12'),_0xb72cee,'request\x20sent');logger['debug'](_0xe78c('0x13'),_0xb72cee,_0xe78c('0x14'),JSON['stringify'](_0x5189c0));if(_0x5189c0['error']){if(_0x5189c0[_0xe78c('0x15')][_0xe78c('0x16')]===0x1f4){logger['error'](_0xe78c('0x12'),_0xb72cee,_0x5189c0[_0xe78c('0x15')][_0xe78c('0x17')]);return _0x491ad1(_0x5189c0[_0xe78c('0x15')][_0xe78c('0x17')]);}logger[_0xe78c('0x15')](_0xe78c('0x12'),_0xb72cee,_0x5189c0[_0xe78c('0x15')][_0xe78c('0x17')]);return _0x5544ef(_0x5189c0[_0xe78c('0x15')][_0xe78c('0x17')]);}else{logger[_0xe78c('0x11')](_0xe78c('0x12'),_0xb72cee,'request\x20sent');_0x5544ef(_0x5189c0['result'][_0xe78c('0x17')]);}})[_0xe78c('0x18')](function(_0x870814){logger[_0xe78c('0x15')](_0xe78c('0x12'),_0xb72cee,_0x870814);_0x491ad1(_0x870814);});});} \ No newline at end of file +var _0x2dd0=['error','code','message','info','Team,\x20%s,\x20%s','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','./team.socket','request','then','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12982e,_0x2f2a93){var _0x141063=function(_0x1eea96){while(--_0x1eea96){_0x12982e['push'](_0x12982e['shift']());}};_0x141063(++_0x2f2a93);}(_0x2dd0,0x14c));var _0x02dd=function(_0x4f9d7f,_0x1a474f){_0x4f9d7f=_0x4f9d7f-0x0;var _0x1fbfd7=_0x2dd0[_0x4f9d7f];return _0x1fbfd7;};'use strict';var _=require(_0x02dd('0x0'));var util=require(_0x02dd('0x1'));var moment=require('moment');var BPromise=require(_0x02dd('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x02dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x02dd('0x4'));var logger=require(_0x02dd('0x5'))(_0x02dd('0x6'));var config=require(_0x02dd('0x7'));var jayson=require(_0x02dd('0x8'));var client=jayson['client'][_0x02dd('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x02dd('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x02dd('0xa')]));require(_0x02dd('0xb'))['register'](socket);function respondWithRpcPromise(_0x523ba2,_0x481c0d,_0x41b0df){return new BPromise(function(_0x1b23f2,_0x9bc528){return client[_0x02dd('0xc')](_0x523ba2,_0x41b0df)[_0x02dd('0xd')](function(_0x28c9bb){logger['info']('Team,\x20%s,\x20%s',_0x481c0d,_0x02dd('0xe'));logger[_0x02dd('0xf')](_0x02dd('0x10'),_0x481c0d,_0x02dd('0xe'),JSON[_0x02dd('0x11')](_0x28c9bb));if(_0x28c9bb[_0x02dd('0x12')]){if(_0x28c9bb['error'][_0x02dd('0x13')]===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x481c0d,_0x28c9bb[_0x02dd('0x12')][_0x02dd('0x14')]);return _0x9bc528(_0x28c9bb[_0x02dd('0x12')][_0x02dd('0x14')]);}logger[_0x02dd('0x12')]('Team,\x20%s,\x20%s',_0x481c0d,_0x28c9bb[_0x02dd('0x12')][_0x02dd('0x14')]);return _0x1b23f2(_0x28c9bb['error'][_0x02dd('0x14')]);}else{logger[_0x02dd('0x15')](_0x02dd('0x16'),_0x481c0d,_0x02dd('0xe'));_0x1b23f2(_0x28c9bb[_0x02dd('0x17')]['message']);}})[_0x02dd('0x18')](function(_0x231c3a){logger[_0x02dd('0x12')](_0x02dd('0x16'),_0x481c0d,_0x231c3a);_0x9bc528(_0x231c3a);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e85ef01..edc0f04 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 _0xe87e=['register','length','team:','./team.events','save','remove','update','emit','removeListener'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0xe87e,0x17d));var _0xee87=function(_0x9cfe28,_0x1a335c){_0x9cfe28=_0x9cfe28-0x0;var _0x54a1d0=_0xe87e[_0x9cfe28];return _0x54a1d0;};'use strict';var TeamEvents=require(_0xee87('0x0'));var events=[_0xee87('0x1'),_0xee87('0x2'),_0xee87('0x3')];function createListener(_0x1224f4,_0x572349){return function(_0x5a1394){_0x572349[_0xee87('0x4')](_0x1224f4,_0x5a1394);};}function removeListener(_0x14b7a8,_0x41d461){return function(){TeamEvents[_0xee87('0x5')](_0x14b7a8,_0x41d461);};}exports[_0xee87('0x6')]=function(_0x46446e){for(var _0x5be499=0x0,_0x589c36=events[_0xee87('0x7')];_0x5be499<_0x589c36;_0x5be499++){var _0x2ee165=events[_0x5be499];var _0x2fda67=createListener(_0xee87('0x8')+_0x2ee165,_0x46446e);TeamEvents['on'](_0x2ee165,_0x2fda67);}}; \ No newline at end of file +var _0xdbb7=['register','length','team:','save','remove','update','removeListener'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0xdbb7,0x9d));var _0x7dbb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdbb7[_0x14add3];return _0x4a174f;};'use strict';var TeamEvents=require('./team.events');var events=[_0x7dbb('0x0'),_0x7dbb('0x1'),_0x7dbb('0x2')];function createListener(_0x3d858e,_0x288e74){return function(_0x38850c){_0x288e74['emit'](_0x3d858e,_0x38850c);};}function removeListener(_0x6ff0dc,_0x856c9c){return function(){TeamEvents[_0x7dbb('0x3')](_0x6ff0dc,_0x856c9c);};}exports[_0x7dbb('0x4')]=function(_0x162415){for(var _0x1105c8=0x0,_0x1724bb=events[_0x7dbb('0x5')];_0x1105c8<_0x1724bb;_0x1105c8++){var _0x4d709f=events[_0x1105c8];var _0x4a2e80=createListener(_0x7dbb('0x6')+_0x4d709f,_0x162415);TeamEvents['on'](_0x4d709f,_0x4a2e80);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 7b687c8..d124120 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 _0x28a1=['INTEGER','sequelize','exports'];(function(_0xe62388,_0x20a8dc){var _0x364a83=function(_0x3c3718){while(--_0x3c3718){_0xe62388['push'](_0xe62388['shift']());}};_0x364a83(++_0x20a8dc);}(_0x28a1,0x145));var _0x128a=function(_0x482214,_0x2550ff){_0x482214=_0x482214-0x0;var _0x38d0cb=_0x28a1[_0x482214];return _0x38d0cb;};'use strict';var Sequelize=require(_0x128a('0x0'));module[_0x128a('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x128a('0x2')]}}; \ No newline at end of file +var _0xbcc4=['INTEGER','sequelize'];(function(_0x35fb7c,_0x4ee512){var _0x3b319e=function(_0x381eaa){while(--_0x381eaa){_0x35fb7c['push'](_0x35fb7c['shift']());}};_0x3b319e(++_0x4ee512);}(_0xbcc4,0x12b));var _0x4bcc=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xbcc4[_0x47e7cb];return _0x2a8874;};'use strict';var Sequelize=require(_0x4bcc('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x4bcc('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4bcc('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 53b54ae..10bd5c1 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 _0xcb10=['request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','api','moment'];(function(_0x5120e7,_0x55733b){var _0x14082c=function(_0x19c05d){while(--_0x19c05d){_0x5120e7['push'](_0x5120e7['shift']());}};_0x14082c(++_0x55733b);}(_0xcb10,0x104));var _0x0cb1=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0xcb10[_0x243b59];return _0x3e1676;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var logger=require('../../config/logger')(_0x0cb1('0x2'));var moment=require(_0x0cb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cb1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0cb1('0x5'));var config=require(_0x0cb1('0x6'));var attributes=require(_0x0cb1('0x7'));module[_0x0cb1('0x8')]=function(_0x430f60,_0x3ee6ec){return _0x430f60[_0x0cb1('0x9')](_0x0cb1('0xa'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3176=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','lodash','util','../../config/logger','api'];(function(_0x5d7cee,_0x307511){var _0x41f661=function(_0x1530f1){while(--_0x1530f1){_0x5d7cee['push'](_0x5d7cee['shift']());}};_0x41f661(++_0x307511);}(_0x3176,0x1d8));var _0x6317=function(_0x1e0f82,_0x33011d){_0x1e0f82=_0x1e0f82-0x0;var _0x1b3e5f=_0x3176[_0x1e0f82];return _0x1b3e5f;};'use strict';var _=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var logger=require(_0x6317('0x2'))(_0x6317('0x3'));var moment=require(_0x6317('0x4'));var BPromise=require(_0x6317('0x5'));var rp=require(_0x6317('0x6'));var fs=require('fs');var path=require(_0x6317('0x7'));var rimraf=require(_0x6317('0x8'));var config=require(_0x6317('0x9'));var attributes=require(_0x6317('0xa'));module[_0x6317('0xb')]=function(_0x46f4c9,_0x354521){return _0x46f4c9[_0x6317('0xc')](_0x6317('0xd'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index be5fc43..01fe985 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x527c0a,_0x5e3a7f){var _0x46e42b=function(_0x5ce4c3){while(--_0x5ce4c3){_0x527c0a['push'](_0x527c0a['shift']());}};_0x46e42b(++_0x5e3a7f);}(_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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x28f3a5,_0x2a84af){var _0x1a60bc=function(_0x1cf0ef){while(--_0x1cf0ef){_0x28f3a5['push'](_0x28f3a5['shift']());}};_0x1a60bc(++_0x2a84af);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 2e5c9b5..4308e96 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 _0xf596=['sequelize','INTEGER'];(function(_0x55be09,_0x62ecca){var _0x60f8f9=function(_0x101030){while(--_0x101030){_0x55be09['push'](_0x55be09['shift']());}};_0x60f8f9(++_0x62ecca);}(_0xf596,0x66));var _0x6f59=function(_0x30845d,_0x1989b2){_0x30845d=_0x30845d-0x0;var _0xff5444=_0xf596[_0x30845d];return _0xff5444;};'use strict';var Sequelize=require(_0x6f59('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6f59('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xde72=['exports','INTEGER'];(function(_0x34d6bd,_0x55b744){var _0x248396=function(_0x23f061){while(--_0x23f061){_0x34d6bd['push'](_0x34d6bd['shift']());}};_0x248396(++_0x55b744);}(_0xde72,0x1a4));var _0x2de7=function(_0x4e0cff,_0x4e9100){_0x4e0cff=_0x4e0cff-0x0;var _0x5ebffc=_0xde72[_0x4e0cff];return _0x5ebffc;};'use strict';var Sequelize=require('sequelize');module[_0x2de7('0x0')]={'penalty':{'type':Sequelize[_0x2de7('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index ba16f4c..09f3dd7 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 _0xa1a5=['bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','team_has_voice_queues','lodash','../../config/logger','api','moment'];(function(_0x383914,_0x2781f2){var _0x2d812c=function(_0x366f95){while(--_0x366f95){_0x383914['push'](_0x383914['shift']());}};_0x2d812c(++_0x2781f2);}(_0xa1a5,0x1b8));var _0x5a1a=function(_0x5e0b58,_0x3632f4){_0x5e0b58=_0x5e0b58-0x0;var _0x235017=_0xa1a5[_0x5e0b58];return _0x235017;};'use strict';var _=require(_0x5a1a('0x0'));var util=require('util');var logger=require(_0x5a1a('0x1'))(_0x5a1a('0x2'));var moment=require(_0x5a1a('0x3'));var BPromise=require(_0x5a1a('0x4'));var rp=require(_0x5a1a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5a1a('0x6'));var config=require(_0x5a1a('0x7'));var attributes=require(_0x5a1a('0x8'));module[_0x5a1a('0x9')]=function(_0x1b718f,_0x27f71f){return _0x1b718f[_0x5a1a('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x5a1a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2209=['../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x269e5f,_0x216360){var _0x3003e7=function(_0x3e9bd5){while(--_0x3e9bd5){_0x269e5f['push'](_0x269e5f['shift']());}};_0x3003e7(++_0x216360);}(_0x2209,0x95));var _0x9220=function(_0x177b68,_0x238de4){_0x177b68=_0x177b68-0x0;var _0x516e81=_0x2209[_0x177b68];return _0x516e81;};'use strict';var _=require(_0x9220('0x0'));var util=require(_0x9220('0x1'));var logger=require(_0x9220('0x2'))(_0x9220('0x3'));var moment=require(_0x9220('0x4'));var BPromise=require('bluebird');var rp=require(_0x9220('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9220('0x6'));var config=require(_0x9220('0x7'));var attributes=require(_0x9220('0x8'));module[_0x9220('0x9')]=function(_0x45bd2d,_0x300ed6){return _0x45bd2d[_0x9220('0xa')](_0x9220('0xb'),attributes,{'tableName':_0x9220('0xc'),'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 8e1204e..6df2373 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 _0x96a2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','TeamVoiceQueue,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring'];(function(_0x51a6e8,_0x3e754a){var _0xda6ca=function(_0x2bc0e4){while(--_0x2bc0e4){_0x51a6e8['push'](_0x51a6e8['shift']());}};_0xda6ca(++_0x3e754a);}(_0x96a2,0x96));var _0x296a=function(_0x101c39,_0x145d2c){_0x101c39=_0x101c39-0x0;var _0x484052=_0x96a2[_0x101c39];return _0x484052;};'use strict';var _=require(_0x296a('0x0'));var util=require('util');var moment=require(_0x296a('0x1'));var BPromise=require(_0x296a('0x2'));var rs=require(_0x296a('0x3'));var fs=require('fs');var Redis=require(_0x296a('0x4'));var db=require(_0x296a('0x5'))['db'];var utils=require(_0x296a('0x6'));var logger=require(_0x296a('0x7'))(_0x296a('0x8'));var config=require(_0x296a('0x9'));var jayson=require(_0x296a('0xa'));var client=jayson[_0x296a('0xb')][_0x296a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4eb919,_0x273b83,_0x3c3486){return new BPromise(function(_0x3a2b44,_0x17d4d2){return client[_0x296a('0xd')](_0x4eb919,_0x3c3486)['then'](function(_0x307644){logger[_0x296a('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x273b83,_0x296a('0xf'));logger[_0x296a('0x10')](_0x296a('0x11'),_0x273b83,_0x296a('0xf'),JSON[_0x296a('0x12')](_0x307644));if(_0x307644[_0x296a('0x13')]){if(_0x307644[_0x296a('0x13')]['code']===0x1f4){logger[_0x296a('0x13')](_0x296a('0x14'),_0x273b83,_0x307644[_0x296a('0x13')][_0x296a('0x15')]);return _0x17d4d2(_0x307644[_0x296a('0x13')]['message']);}logger[_0x296a('0x13')](_0x296a('0x14'),_0x273b83,_0x307644['error'][_0x296a('0x15')]);return _0x3a2b44(_0x307644[_0x296a('0x13')][_0x296a('0x15')]);}else{logger[_0x296a('0xe')](_0x296a('0x14'),_0x273b83,_0x296a('0xf'));_0x3a2b44(_0x307644['result'][_0x296a('0x15')]);}})['catch'](function(_0x55864e){logger['error'](_0x296a('0x14'),_0x273b83,_0x55864e);_0x17d4d2(_0x55864e);});});} \ No newline at end of file +var _0xc678=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x5c167b,_0x5e4036){var _0x3f10ba=function(_0x55cb31){while(--_0x55cb31){_0x5c167b['push'](_0x5c167b['shift']());}};_0x3f10ba(++_0x5e4036);}(_0xc678,0x1b4));var _0x8c67=function(_0x5c3d8b,_0x5324fa){_0x5c3d8b=_0x5c3d8b-0x0;var _0x4d66e0=_0xc678[_0x5c3d8b];return _0x4d66e0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8c67('0x0'));var BPromise=require(_0x8c67('0x1'));var rs=require(_0x8c67('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c67('0x3'))['db'];var utils=require(_0x8c67('0x4'));var logger=require(_0x8c67('0x5'))(_0x8c67('0x6'));var config=require('../../config/environment');var jayson=require(_0x8c67('0x7'));var client=jayson['client'][_0x8c67('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4ceb,_0x4c2ffe,_0x207de1){return new BPromise(function(_0x22d7e4,_0x41ac88){return client[_0x8c67('0x9')](_0x1b4ceb,_0x207de1)[_0x8c67('0xa')](function(_0x5bac97){logger[_0x8c67('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4c2ffe,_0x8c67('0xc'));logger[_0x8c67('0xd')](_0x8c67('0xe'),_0x4c2ffe,'request\x20sent',JSON[_0x8c67('0xf')](_0x5bac97));if(_0x5bac97[_0x8c67('0x10')]){if(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x11')]===0x1f4){logger['error'](_0x8c67('0x12'),_0x4c2ffe,_0x5bac97['error']['message']);return _0x41ac88(_0x5bac97['error']['message']);}logger[_0x8c67('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4c2ffe,_0x5bac97[_0x8c67('0x10')]['message']);return _0x22d7e4(_0x5bac97[_0x8c67('0x10')][_0x8c67('0x13')]);}else{logger[_0x8c67('0xb')](_0x8c67('0x12'),_0x4c2ffe,'request\x20sent');_0x22d7e4(_0x5bac97[_0x8c67('0x14')][_0x8c67('0x13')]);}})[_0x8c67('0x15')](function(_0x1bae2f){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4c2ffe,_0x1bae2f);_0x41ac88(_0x1bae2f);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0ce552e..43a477c 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 _0xf970=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','path'];(function(_0x407b72,_0x5e24f9){var _0x507105=function(_0x141f7d){while(--_0x141f7d){_0x407b72['push'](_0x407b72['shift']());}};_0x507105(++_0x5e24f9);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0f97('0x0'));var util=require('util');var path=require(_0x0f97('0x1'));var timeout=require(_0x0f97('0x2'));var express=require(_0x0f97('0x3'));var router=express[_0x0f97('0x4')]();var fs_extra=require(_0x0f97('0x5'));var auth=require(_0x0f97('0x6'));var interaction=require(_0x0f97('0x7'));var config=require('../../config/environment');var controller=require(_0x0f97('0x8'));router[_0x0f97('0x9')]('/',auth[_0x0f97('0xa')](),controller[_0x0f97('0xb')]);router[_0x0f97('0x9')](_0x0f97('0xc'),auth[_0x0f97('0xa')](),controller[_0x0f97('0xd')]);router[_0x0f97('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0f97('0xf')]('/:id',auth[_0x0f97('0xa')](),controller[_0x0f97('0x10')]);router[_0x0f97('0x11')]('/:id',auth[_0x0f97('0xa')](),controller['destroy']);module[_0x0f97('0x12')]=router; \ No newline at end of file +var _0x9264=['../../config/environment','index','get','isAuthenticated','show','create','put','update','delete','multer','util','path','connect-timeout','fs-extra'];(function(_0x1e1d78,_0x409769){var _0x299153=function(_0x10e8ff){while(--_0x10e8ff){_0x1e1d78['push'](_0x1e1d78['shift']());}};_0x299153(++_0x409769);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var path=require(_0x4926('0x2'));var timeout=require(_0x4926('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4926('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4926('0x5'));var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4926('0x6')]);router[_0x4926('0x7')]('/:id',auth[_0x4926('0x8')](),controller[_0x4926('0x9')]);router['post']('/',auth[_0x4926('0x8')](),controller[_0x4926('0xa')]);router[_0x4926('0xb')]('/:id',auth[_0x4926('0x8')](),controller[_0x4926('0xc')]);router[_0x4926('0xd')]('/:id',auth[_0x4926('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0e74f47..e8e2b45 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 _0xab0c=['STRING','TEXT','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xab0c,0x1d3));var _0xcab0=function(_0x3ed83e,_0x54b8f0){_0x3ed83e=_0x3ed83e-0x0;var _0x8d9871=_0xab0c[_0x3ed83e];return _0x8d9871;};'use strict';var Sequelize=require(_0xcab0('0x0'));module['exports']={'name':{'type':Sequelize[_0xcab0('0x1')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0xcab0('0x2')]}}; \ No newline at end of file +var _0x7657=['sequelize','exports','STRING','TEXT'];(function(_0x1876b2,_0x5d0225){var _0x9fb1e0=function(_0x29b099){while(--_0x29b099){_0x1876b2['push'](_0x1876b2['shift']());}};_0x9fb1e0(++_0x5d0225);}(_0x7657,0x98));var _0x7765=function(_0x3fd066,_0x31b22b){_0x3fd066=_0x3fd066-0x0;var _0x5539bc=_0x7657[_0x3fd066];return _0x5539bc;};'use strict';var Sequelize=require(_0x7765('0x0'));module[_0x7765('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7765('0x2')]},'html':{'type':Sequelize[_0x7765('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index c1d94f6..fe3df65 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 _0xf5e5=['save','then','destroy','get','error','stack','name','send','index','Template','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Templates','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf5e5,0xdb));var _0x5f5e=function(_0x520a18,_0x2e7d0a){_0x520a18=_0x520a18-0x0;var _0x5b0ba6=_0xf5e5[_0x520a18];return _0x5b0ba6;};'use strict';var emlformat=require(_0x5f5e('0x0'));var rimraf=require(_0x5f5e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5f5e('0x2'));var moment=require(_0x5f5e('0x3'));var BPromise=require(_0x5f5e('0x4'));var Mustache=require('mustache');var util=require(_0x5f5e('0x5'));var path=require(_0x5f5e('0x6'));var sox=require(_0x5f5e('0x7'));var csv=require(_0x5f5e('0x8'));var ejs=require(_0x5f5e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5f5e('0xa'));var squel=require(_0x5f5e('0xb'));var crypto=require(_0x5f5e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5f5e('0xd'));var toCsv=require(_0x5f5e('0x8'));var querystring=require('querystring');var Papa=require(_0x5f5e('0xe'));var Redis=require('ioredis');var authService=require(_0x5f5e('0xf'));var qs=require(_0x5f5e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5f5e('0x11'));var utils=require('../../config/utils');var config=require(_0x5f5e('0x12'));var licenseUtil=require(_0x5f5e('0x13'));var db=require(_0x5f5e('0x14'))['db'];function respondWithStatusCode(_0x279532,_0x396763){_0x396763=_0x396763||0xcc;return function(_0x4602f6){if(_0x4602f6){return _0x279532[_0x5f5e('0x15')](_0x396763);}return _0x279532[_0x5f5e('0x16')](_0x396763)[_0x5f5e('0x17')]();};}function respondWithResult(_0x2b7a13,_0x87be4d){_0x87be4d=_0x87be4d||0xc8;return function(_0x4cdd47){if(_0x4cdd47){return _0x2b7a13['status'](_0x87be4d)[_0x5f5e('0x18')](_0x4cdd47);}};}function respondWithFilteredResult(_0x3a1d50,_0x52ecf5){return function(_0x37be7c){if(_0x37be7c){var _0x88d86d=typeof _0x52ecf5['offset']==='undefined'&&typeof _0x52ecf5[_0x5f5e('0x19')]===_0x5f5e('0x1a');var _0x2b9d22=_0x37be7c[_0x5f5e('0x1b')];var _0x5aaef6=_0x88d86d?0x0:_0x52ecf5[_0x5f5e('0x1c')];var _0x223656=_0x88d86d?_0x37be7c[_0x5f5e('0x1b')]:_0x52ecf5[_0x5f5e('0x1c')]+_0x52ecf5[_0x5f5e('0x19')];var _0x3b6da7;if(_0x223656>=_0x2b9d22){_0x223656=_0x2b9d22;_0x3b6da7=0xc8;}else{_0x3b6da7=0xce;}_0x3a1d50['status'](_0x3b6da7);return _0x3a1d50[_0x5f5e('0x1d')](_0x5f5e('0x1e'),_0x5aaef6+'-'+_0x223656+'/'+_0x2b9d22)['json'](_0x37be7c);}return null;};}function patchUpdates(_0x4e8ad4){return function(_0x923480){try{jsonpatch[_0x5f5e('0x1f')](_0x923480,_0x4e8ad4,!![]);}catch(_0x4c0e0e){return BPromise[_0x5f5e('0x20')](_0x4c0e0e);}return _0x923480[_0x5f5e('0x21')]();};}function saveUpdates(_0x13274e,_0x469e8e){return function(_0x1d077f){if(_0x1d077f){return _0x1d077f['update'](_0x13274e)[_0x5f5e('0x22')](function(_0x1794b6){return _0x1794b6;});}return null;};}function removeEntity(_0x2d9ce4,_0x28bbb2){return function(_0x464e42){if(_0x464e42){return _0x464e42[_0x5f5e('0x23')]()['then'](function(){var _0x37d76c=_0x464e42[_0x5f5e('0x24')]({'plain':!![]});var _0x41f5e2='Templates';return db['UserProfileResource'][_0x5f5e('0x23')]({'where':{'type':_0x41f5e2,'resourceId':_0x37d76c['id']}})[_0x5f5e('0x22')](function(){return _0x464e42;});})[_0x5f5e('0x22')](function(){_0x2d9ce4[_0x5f5e('0x16')](0xcc)[_0x5f5e('0x17')]();});}};}function handleEntityNotFound(_0x9b6baf,_0x4e85fc){return function(_0x55a076){if(!_0x55a076){_0x9b6baf['sendStatus'](0x194);}return _0x55a076;};}function handleError(_0x38eacf,_0x2ba4bc){_0x2ba4bc=_0x2ba4bc||0x1f4;return function(_0x1d7003){logger[_0x5f5e('0x25')](_0x1d7003[_0x5f5e('0x26')]);if(_0x1d7003[_0x5f5e('0x27')]){delete _0x1d7003[_0x5f5e('0x27')];}_0x38eacf[_0x5f5e('0x16')](_0x2ba4bc)[_0x5f5e('0x28')](_0x1d7003);};}exports[_0x5f5e('0x29')]=function(_0x3e148e,_0x57a6c2){var _0x13be21={},_0x55c06f={},_0x1d2a69={'count':0x0,'rows':[]};var _0x48c444=_['map'](db[_0x5f5e('0x2a')][_0x5f5e('0x2b')],function(_0x1ae8ff){return{'name':_0x1ae8ff[_0x5f5e('0x2c')],'type':_0x1ae8ff[_0x5f5e('0x2d')][_0x5f5e('0x2e')]};});_0x55c06f['model']=_[_0x5f5e('0x2f')](_0x48c444,'name');_0x55c06f[_0x5f5e('0x30')]=_[_0x5f5e('0x31')](_0x3e148e[_0x5f5e('0x30')]);_0x55c06f[_0x5f5e('0x32')]=_['intersection'](_0x55c06f[_0x5f5e('0x33')],_0x55c06f[_0x5f5e('0x30')]);_0x13be21[_0x5f5e('0x34')]=_[_0x5f5e('0x35')](_0x55c06f[_0x5f5e('0x33')],qs[_0x5f5e('0x36')](_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x36')]));_0x13be21[_0x5f5e('0x34')]=_0x13be21[_0x5f5e('0x34')][_0x5f5e('0x37')]?_0x13be21[_0x5f5e('0x34')]:_0x55c06f[_0x5f5e('0x33')];if(!_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x38')](_0x5f5e('0x39'))){_0x13be21['limit']=qs['limit'](_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x19')]);_0x13be21[_0x5f5e('0x1c')]=qs[_0x5f5e('0x1c')](_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x1c')]);}_0x13be21[_0x5f5e('0x3a')]=qs[_0x5f5e('0x3b')](_0x3e148e['query'][_0x5f5e('0x3b')]);_0x13be21[_0x5f5e('0x3c')]=qs[_0x5f5e('0x32')](_[_0x5f5e('0x3d')](_0x3e148e[_0x5f5e('0x30')],_0x55c06f['filters']),_0x48c444);if(_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x3e')]){_0x13be21[_0x5f5e('0x3c')]=_[_0x5f5e('0x3f')](_0x13be21['where'],{'$or':_[_0x5f5e('0x2f')](_0x48c444,function(_0x5cc88d){if(_0x5cc88d[_0x5f5e('0x2d')]!==_0x5f5e('0x40')){var _0x1f5c99={};_0x1f5c99[_0x5cc88d[_0x5f5e('0x27')]]={'$like':'%'+_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x3e')]+'%'};return _0x1f5c99;}})});}_0x13be21=_[_0x5f5e('0x3f')]({},_0x13be21,_0x3e148e['options']);var _0x2c7586={'where':_0x13be21[_0x5f5e('0x3c')]};return db[_0x5f5e('0x2a')][_0x5f5e('0x1b')](_0x2c7586)['then'](function(_0x564f3c){_0x1d2a69[_0x5f5e('0x1b')]=_0x564f3c;if(_0x3e148e[_0x5f5e('0x30')][_0x5f5e('0x41')]){_0x13be21[_0x5f5e('0x42')]=[{'all':!![]}];}return db['Template'][_0x5f5e('0x43')](_0x13be21);})[_0x5f5e('0x22')](function(_0x1c6265){_0x1d2a69[_0x5f5e('0x44')]=_0x1c6265;return _0x1d2a69;})['then'](respondWithFilteredResult(_0x57a6c2,_0x13be21))[_0x5f5e('0x45')](handleError(_0x57a6c2,null));};exports[_0x5f5e('0x46')]=function(_0x567d94,_0xa69ccc){var _0x429a1f={'raw':!![],'where':{'id':_0x567d94['params']['id']}},_0x58de01={};_0x58de01[_0x5f5e('0x33')]=_['keys'](db[_0x5f5e('0x2a')][_0x5f5e('0x2b')]);_0x58de01[_0x5f5e('0x30')]=_[_0x5f5e('0x31')](_0x567d94[_0x5f5e('0x30')]);_0x58de01['filters']=_[_0x5f5e('0x35')](_0x58de01[_0x5f5e('0x33')],_0x58de01[_0x5f5e('0x30')]);_0x429a1f[_0x5f5e('0x34')]=_[_0x5f5e('0x35')](_0x58de01[_0x5f5e('0x33')],qs[_0x5f5e('0x36')](_0x567d94[_0x5f5e('0x30')][_0x5f5e('0x36')]));_0x429a1f[_0x5f5e('0x34')]=_0x429a1f[_0x5f5e('0x34')][_0x5f5e('0x37')]?_0x429a1f[_0x5f5e('0x34')]:_0x58de01[_0x5f5e('0x33')];if(_0x567d94[_0x5f5e('0x30')][_0x5f5e('0x41')]){_0x429a1f[_0x5f5e('0x42')]=[{'all':!![]}];}_0x429a1f=_[_0x5f5e('0x3f')]({},_0x429a1f,_0x567d94[_0x5f5e('0x47')]);return db[_0x5f5e('0x2a')][_0x5f5e('0x48')](_0x429a1f)[_0x5f5e('0x22')](handleEntityNotFound(_0xa69ccc,null))[_0x5f5e('0x22')](respondWithResult(_0xa69ccc,null))[_0x5f5e('0x45')](handleError(_0xa69ccc,null));};exports['create']=function(_0x5392a8,_0x26a708){return db[_0x5f5e('0x2a')]['create'](_0x5392a8['body'],{})[_0x5f5e('0x22')](function(_0x5aa371){var _0x5c9553=_0x5392a8[_0x5f5e('0x49')]['get']({'plain':!![]});if(!_0x5c9553)throw new Error(_0x5f5e('0x4a'));if(_0x5c9553[_0x5f5e('0x4b')]===_0x5f5e('0x49')){var _0xe6c246=_0x5aa371['get']({'plain':!![]});var _0x18a5c7=_0x5f5e('0x4c');return db['UserProfileSection'][_0x5f5e('0x48')]({'where':{'name':_0x18a5c7,'userProfileId':_0x5c9553[_0x5f5e('0x4d')]},'raw':!![]})['then'](function(_0x535682){if(_0x535682&&_0x535682[_0x5f5e('0x4e')]===0x0){return db[_0x5f5e('0x4f')]['create']({'name':_0xe6c246['name'],'resourceId':_0xe6c246['id'],'type':_0x535682['name'],'sectionId':_0x535682['id']},{})['then'](function(){return _0x5aa371;});}else{return _0x5aa371;}})[_0x5f5e('0x45')](function(_0xdaf9dd){logger[_0x5f5e('0x25')](_0x5f5e('0x50'),_0xdaf9dd);throw _0xdaf9dd;});}return _0x5aa371;})[_0x5f5e('0x22')](respondWithResult(_0x26a708,0xc9))[_0x5f5e('0x45')](handleError(_0x26a708,null));};exports[_0x5f5e('0x51')]=function(_0x426eb8,_0x54953d){if(_0x426eb8[_0x5f5e('0x52')]['id']){delete _0x426eb8[_0x5f5e('0x52')]['id'];}return db[_0x5f5e('0x2a')][_0x5f5e('0x48')]({'where':{'id':_0x426eb8[_0x5f5e('0x53')]['id']}})[_0x5f5e('0x22')](handleEntityNotFound(_0x54953d,null))[_0x5f5e('0x22')](saveUpdates(_0x426eb8[_0x5f5e('0x52')],null))['then'](respondWithResult(_0x54953d,null))[_0x5f5e('0x45')](handleError(_0x54953d,null));};exports[_0x5f5e('0x23')]=function(_0x5852e7,_0x19ab95){return db[_0x5f5e('0x2a')][_0x5f5e('0x48')]({'where':{'id':_0x5852e7[_0x5f5e('0x53')]['id']}})[_0x5f5e('0x22')](handleEntityNotFound(_0x19ab95,null))[_0x5f5e('0x22')](removeEntity(_0x19ab95,null))[_0x5f5e('0x45')](handleError(_0x19ab95,null));}; \ No newline at end of file +var _0xa28d=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Templates','UserProfileResource','error','name','send','index','map','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','Template','includeAll','include','findAll','catch','show','params','options','find','create','body','user'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xa28d,0x1b5));var _0xda28=function(_0x269b7f,_0x46f00e){_0x269b7f=_0x269b7f-0x0;var _0x11b338=_0xa28d[_0x269b7f];return _0x11b338;};'use strict';var emlformat=require(_0xda28('0x0'));var rimraf=require(_0xda28('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xda28('0x2'));var rp=require('request-promise');var moment=require(_0xda28('0x3'));var BPromise=require(_0xda28('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xda28('0x5'));var csv=require(_0xda28('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xda28('0x7'));var _=require(_0xda28('0x8'));var squel=require(_0xda28('0x9'));var crypto=require(_0xda28('0xa'));var jsforce=require(_0xda28('0xb'));var deskjs=require(_0xda28('0xc'));var toCsv=require(_0xda28('0x6'));var querystring=require(_0xda28('0xd'));var Papa=require(_0xda28('0xe'));var Redis=require(_0xda28('0xf'));var authService=require(_0xda28('0x10'));var qs=require(_0xda28('0x11'));var as=require(_0xda28('0x12'));var hardwareService=require(_0xda28('0x13'));var logger=require('../../config/logger')(_0xda28('0x14'));var utils=require(_0xda28('0x15'));var config=require(_0xda28('0x16'));var licenseUtil=require(_0xda28('0x17'));var db=require(_0xda28('0x18'))['db'];function respondWithStatusCode(_0x20b221,_0x10bb9d){_0x10bb9d=_0x10bb9d||0xcc;return function(_0x3dc540){if(_0x3dc540){return _0x20b221[_0xda28('0x19')](_0x10bb9d);}return _0x20b221[_0xda28('0x1a')](_0x10bb9d)[_0xda28('0x1b')]();};}function respondWithResult(_0x33a199,_0x1385d7){_0x1385d7=_0x1385d7||0xc8;return function(_0x55d1ea){if(_0x55d1ea){return _0x33a199[_0xda28('0x1a')](_0x1385d7)[_0xda28('0x1c')](_0x55d1ea);}};}function respondWithFilteredResult(_0x4f512f,_0xe700dc){return function(_0x178885){if(_0x178885){var _0x1e1262=typeof _0xe700dc[_0xda28('0x1d')]===_0xda28('0x1e')&&typeof _0xe700dc[_0xda28('0x1f')]===_0xda28('0x1e');var _0x5eed52=_0x178885[_0xda28('0x20')];var _0x4ce4ef=_0x1e1262?0x0:_0xe700dc[_0xda28('0x1d')];var _0x25b3a0=_0x1e1262?_0x178885['count']:_0xe700dc['offset']+_0xe700dc[_0xda28('0x1f')];var _0x3d9aba;if(_0x25b3a0>=_0x5eed52){_0x25b3a0=_0x5eed52;_0x3d9aba=0xc8;}else{_0x3d9aba=0xce;}_0x4f512f[_0xda28('0x1a')](_0x3d9aba);return _0x4f512f[_0xda28('0x21')](_0xda28('0x22'),_0x4ce4ef+'-'+_0x25b3a0+'/'+_0x5eed52)[_0xda28('0x1c')](_0x178885);}return null;};}function patchUpdates(_0xc0833b){return function(_0xb47d07){try{jsonpatch[_0xda28('0x23')](_0xb47d07,_0xc0833b,!![]);}catch(_0x8e967d){return BPromise[_0xda28('0x24')](_0x8e967d);}return _0xb47d07[_0xda28('0x25')]();};}function saveUpdates(_0x25646b,_0x314927){return function(_0x2abf73){if(_0x2abf73){return _0x2abf73[_0xda28('0x26')](_0x25646b)[_0xda28('0x27')](function(_0x58d227){return _0x58d227;});}return null;};}function removeEntity(_0x20711f,_0x2438d4){return function(_0x2e3e0b){if(_0x2e3e0b){return _0x2e3e0b['destroy']()['then'](function(){var _0x5d6389=_0x2e3e0b[_0xda28('0x28')]({'plain':!![]});var _0x3a3c3a=_0xda28('0x29');return db[_0xda28('0x2a')]['destroy']({'where':{'type':_0x3a3c3a,'resourceId':_0x5d6389['id']}})[_0xda28('0x27')](function(){return _0x2e3e0b;});})['then'](function(){_0x20711f[_0xda28('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x581d72,_0x19affa){return function(_0x432b0f){if(!_0x432b0f){_0x581d72[_0xda28('0x19')](0x194);}return _0x432b0f;};}function handleError(_0x54354d,_0x4f4b25){_0x4f4b25=_0x4f4b25||0x1f4;return function(_0x3c715b){logger[_0xda28('0x2b')](_0x3c715b['stack']);if(_0x3c715b[_0xda28('0x2c')]){delete _0x3c715b[_0xda28('0x2c')];}_0x54354d[_0xda28('0x1a')](_0x4f4b25)[_0xda28('0x2d')](_0x3c715b);};}exports[_0xda28('0x2e')]=function(_0x56236f,_0x5b202b){var _0x37bff2={},_0x4c67fa={},_0x22d610={'count':0x0,'rows':[]};var _0x27c43d=_[_0xda28('0x2f')](db['Template']['rawAttributes'],function(_0x5a608c){return{'name':_0x5a608c[_0xda28('0x30')],'type':_0x5a608c[_0xda28('0x31')]['key']};});_0x4c67fa[_0xda28('0x32')]=_[_0xda28('0x2f')](_0x27c43d,_0xda28('0x2c'));_0x4c67fa[_0xda28('0x33')]=_[_0xda28('0x34')](_0x56236f['query']);_0x4c67fa['filters']=_[_0xda28('0x35')](_0x4c67fa['model'],_0x4c67fa[_0xda28('0x33')]);_0x37bff2[_0xda28('0x36')]=_[_0xda28('0x35')](_0x4c67fa[_0xda28('0x32')],qs[_0xda28('0x37')](_0x56236f[_0xda28('0x33')][_0xda28('0x37')]));_0x37bff2[_0xda28('0x36')]=_0x37bff2[_0xda28('0x36')][_0xda28('0x38')]?_0x37bff2['attributes']:_0x4c67fa['model'];if(!_0x56236f['query'][_0xda28('0x39')](_0xda28('0x3a'))){_0x37bff2[_0xda28('0x1f')]=qs[_0xda28('0x1f')](_0x56236f['query'][_0xda28('0x1f')]);_0x37bff2['offset']=qs[_0xda28('0x1d')](_0x56236f['query'][_0xda28('0x1d')]);}_0x37bff2[_0xda28('0x3b')]=qs[_0xda28('0x3c')](_0x56236f['query'][_0xda28('0x3c')]);_0x37bff2[_0xda28('0x3d')]=qs[_0xda28('0x3e')](_[_0xda28('0x3f')](_0x56236f[_0xda28('0x33')],_0x4c67fa[_0xda28('0x3e')]),_0x27c43d);if(_0x56236f['query'][_0xda28('0x40')]){_0x37bff2[_0xda28('0x3d')]=_[_0xda28('0x41')](_0x37bff2[_0xda28('0x3d')],{'$or':_[_0xda28('0x2f')](_0x27c43d,function(_0x3ad670){if(_0x3ad670[_0xda28('0x31')]!==_0xda28('0x42')){var _0x592193={};_0x592193[_0x3ad670[_0xda28('0x2c')]]={'$like':'%'+_0x56236f[_0xda28('0x33')][_0xda28('0x40')]+'%'};return _0x592193;}})});}_0x37bff2=_[_0xda28('0x41')]({},_0x37bff2,_0x56236f['options']);var _0x54e345={'where':_0x37bff2[_0xda28('0x3d')]};return db[_0xda28('0x43')]['count'](_0x54e345)[_0xda28('0x27')](function(_0x4f2060){_0x22d610[_0xda28('0x20')]=_0x4f2060;if(_0x56236f[_0xda28('0x33')][_0xda28('0x44')]){_0x37bff2[_0xda28('0x45')]=[{'all':!![]}];}return db['Template'][_0xda28('0x46')](_0x37bff2);})[_0xda28('0x27')](function(_0x3ab975){_0x22d610['rows']=_0x3ab975;return _0x22d610;})[_0xda28('0x27')](respondWithFilteredResult(_0x5b202b,_0x37bff2))[_0xda28('0x47')](handleError(_0x5b202b,null));};exports[_0xda28('0x48')]=function(_0xab787b,_0x3ab27a){var _0x1a656a={'raw':!![],'where':{'id':_0xab787b[_0xda28('0x49')]['id']}},_0x532c04={};_0x532c04[_0xda28('0x32')]=_[_0xda28('0x34')](db['Template']['rawAttributes']);_0x532c04[_0xda28('0x33')]=_['keys'](_0xab787b[_0xda28('0x33')]);_0x532c04[_0xda28('0x3e')]=_[_0xda28('0x35')](_0x532c04[_0xda28('0x32')],_0x532c04['query']);_0x1a656a[_0xda28('0x36')]=_['intersection'](_0x532c04[_0xda28('0x32')],qs[_0xda28('0x37')](_0xab787b[_0xda28('0x33')]['fields']));_0x1a656a[_0xda28('0x36')]=_0x1a656a[_0xda28('0x36')][_0xda28('0x38')]?_0x1a656a['attributes']:_0x532c04[_0xda28('0x32')];if(_0xab787b[_0xda28('0x33')][_0xda28('0x44')]){_0x1a656a[_0xda28('0x45')]=[{'all':!![]}];}_0x1a656a=_[_0xda28('0x41')]({},_0x1a656a,_0xab787b[_0xda28('0x4a')]);return db[_0xda28('0x43')][_0xda28('0x4b')](_0x1a656a)[_0xda28('0x27')](handleEntityNotFound(_0x3ab27a,null))['then'](respondWithResult(_0x3ab27a,null))[_0xda28('0x47')](handleError(_0x3ab27a,null));};exports[_0xda28('0x4c')]=function(_0x20f839,_0x58de3b){return db[_0xda28('0x43')][_0xda28('0x4c')](_0x20f839[_0xda28('0x4d')],{})[_0xda28('0x27')](function(_0x5457db){var _0x4a9b57=_0x20f839[_0xda28('0x4e')][_0xda28('0x28')]({'plain':!![]});if(!_0x4a9b57)throw new Error(_0xda28('0x4f'));if(_0x4a9b57[_0xda28('0x50')]==='user'){var _0x1b1d77=_0x5457db[_0xda28('0x28')]({'plain':!![]});var _0x24ffe4=_0xda28('0x29');return db[_0xda28('0x51')][_0xda28('0x4b')]({'where':{'name':_0x24ffe4,'userProfileId':_0x4a9b57[_0xda28('0x52')]},'raw':!![]})[_0xda28('0x27')](function(_0x97b5f){if(_0x97b5f&&_0x97b5f[_0xda28('0x53')]===0x0){return db[_0xda28('0x2a')]['create']({'name':_0x1b1d77[_0xda28('0x2c')],'resourceId':_0x1b1d77['id'],'type':_0x97b5f[_0xda28('0x2c')],'sectionId':_0x97b5f['id']},{})['then'](function(){return _0x5457db;});}else{return _0x5457db;}})[_0xda28('0x47')](function(_0x306405){logger['error'](_0xda28('0x54'),_0x306405);throw _0x306405;});}return _0x5457db;})[_0xda28('0x27')](respondWithResult(_0x58de3b,0xc9))['catch'](handleError(_0x58de3b,null));};exports['update']=function(_0x2c9d05,_0x48b8e6){if(_0x2c9d05[_0xda28('0x4d')]['id']){delete _0x2c9d05[_0xda28('0x4d')]['id'];}return db[_0xda28('0x43')][_0xda28('0x4b')]({'where':{'id':_0x2c9d05[_0xda28('0x49')]['id']}})[_0xda28('0x27')](handleEntityNotFound(_0x48b8e6,null))['then'](saveUpdates(_0x2c9d05[_0xda28('0x4d')],null))[_0xda28('0x27')](respondWithResult(_0x48b8e6,null))[_0xda28('0x47')](handleError(_0x48b8e6,null));};exports[_0xda28('0x55')]=function(_0x5a3dd2,_0x3984c9){return db['Template'][_0xda28('0x4b')]({'where':{'id':_0x5a3dd2[_0xda28('0x49')]['id']}})[_0xda28('0x27')](handleEntityNotFound(_0x3984c9,null))[_0xda28('0x27')](removeEntity(_0x3984c9,null))[_0xda28('0x47')](handleError(_0x3984c9,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index d77213e..389ff4a 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 _0x1829=['lodash','util','../../config/logger','api','request-promise','./template.attributes','exports','define','Template','tools_templates'];(function(_0x40b8de,_0x1bc3a5){var _0x137d51=function(_0x1a3d12){while(--_0x1a3d12){_0x40b8de['push'](_0x40b8de['shift']());}};_0x137d51(++_0x1bc3a5);}(_0x1829,0xfa));var _0x9182=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0x1829[_0x1762b4];return _0x29beda;};'use strict';var _=require(_0x9182('0x0'));var util=require(_0x9182('0x1'));var logger=require(_0x9182('0x2'))(_0x9182('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9182('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9182('0x5'));module[_0x9182('0x6')]=function(_0x220cc1,_0x5213e4){return _0x220cc1[_0x9182('0x7')](_0x9182('0x8'),attributes,{'tableName':_0x9182('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f24=['path','rimraf','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x397936,_0x449e05){var _0x212f67=function(_0x4e641d){while(--_0x4e641d){_0x397936['push'](_0x397936['shift']());}};_0x212f67(++_0x449e05);}(_0x5f24,0x7e));var _0x45f2=function(_0x98225d,_0x76bc17){_0x98225d=_0x98225d-0x0;var _0x176967=_0x5f24[_0x98225d];return _0x176967;};'use strict';var _=require(_0x45f2('0x0'));var util=require(_0x45f2('0x1'));var logger=require(_0x45f2('0x2'))(_0x45f2('0x3'));var moment=require('moment');var BPromise=require(_0x45f2('0x4'));var rp=require(_0x45f2('0x5'));var fs=require('fs');var path=require(_0x45f2('0x6'));var rimraf=require(_0x45f2('0x7'));var config=require('../../config/environment');var attributes=require(_0x45f2('0x8'));module[_0x45f2('0x9')]=function(_0xe1a65c,_0x4c698d){return _0xe1a65c[_0x45f2('0xa')](_0x45f2('0xb'),attributes,{'tableName':'tools_templates','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 1cb76c5..5deab9d 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 _0x0d94=['util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','Template','findAll','options','raw','where','attributes','limit','include','map','model','GetTemplate','debug','lodash'];(function(_0x4c7095,_0x510858){var _0x202f96=function(_0x3d23ed){while(--_0x3d23ed){_0x4c7095['push'](_0x4c7095['shift']());}};_0x202f96(++_0x510858);}(_0x0d94,0xc5));var _0x40d9=function(_0x439a7f,_0x5b0253){_0x439a7f=_0x439a7f-0x0;var _0x11d326=_0x0d94[_0x439a7f];return _0x11d326;};'use strict';var _=require(_0x40d9('0x0'));var util=require(_0x40d9('0x1'));var moment=require(_0x40d9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x40d9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x40d9('0x4'));var logger=require('../../config/logger')(_0x40d9('0x5'));var config=require(_0x40d9('0x6'));var jayson=require(_0x40d9('0x7'));var client=jayson['client'][_0x40d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x152b1c,_0x5ec2d0,_0x582758){return new BPromise(function(_0x4997c7,_0x40ca87){return client[_0x40d9('0x9')](_0x152b1c,_0x582758)[_0x40d9('0xa')](function(_0x22cd2c){logger['info'](_0x40d9('0xb'),_0x5ec2d0,_0x40d9('0xc'));logger['debug'](_0x40d9('0xd'),_0x5ec2d0,_0x40d9('0xc'),JSON[_0x40d9('0xe')](_0x22cd2c));if(_0x22cd2c[_0x40d9('0xf')]){if(_0x22cd2c[_0x40d9('0xf')][_0x40d9('0x10')]===0x1f4){logger[_0x40d9('0xf')](_0x40d9('0xb'),_0x5ec2d0,_0x22cd2c['error']['message']);return _0x40ca87(_0x22cd2c[_0x40d9('0xf')][_0x40d9('0x11')]);}logger[_0x40d9('0xf')](_0x40d9('0xb'),_0x5ec2d0,_0x22cd2c[_0x40d9('0xf')][_0x40d9('0x11')]);return _0x4997c7(_0x22cd2c[_0x40d9('0xf')][_0x40d9('0x11')]);}else{logger[_0x40d9('0x12')](_0x40d9('0xb'),_0x5ec2d0,'request\x20sent');_0x4997c7(_0x22cd2c[_0x40d9('0x13')][_0x40d9('0x11')]);}})[_0x40d9('0x14')](function(_0x81334e){logger['error'](_0x40d9('0xb'),_0x5ec2d0,_0x81334e);_0x40ca87(_0x81334e);});});}exports['GetTemplate']=function(_0x2e2627){var _0x56e200=this;return new Promise(function(_0x4e5fa1,_0x216ce0){return db[_0x40d9('0x15')][_0x40d9('0x16')]({'raw':_0x2e2627[_0x40d9('0x17')]?_0x2e2627[_0x40d9('0x17')][_0x40d9('0x18')]===undefined?!![]:![]:!![],'where':_0x2e2627[_0x40d9('0x17')]?_0x2e2627[_0x40d9('0x17')][_0x40d9('0x19')]||null:null,'attributes':_0x2e2627[_0x40d9('0x17')]?_0x2e2627['options'][_0x40d9('0x1a')]||null:null,'limit':_0x2e2627[_0x40d9('0x17')]?_0x2e2627['options'][_0x40d9('0x1b')]||null:null,'include':_0x2e2627[_0x40d9('0x17')]?_0x2e2627[_0x40d9('0x17')][_0x40d9('0x1c')]?_[_0x40d9('0x1d')](_0x2e2627[_0x40d9('0x17')][_0x40d9('0x1c')],function(_0xd3fd87){return{'model':db[_0xd3fd87[_0x40d9('0x1e')]],'as':_0xd3fd87['as'],'attributes':_0xd3fd87[_0x40d9('0x1a')],'include':_0xd3fd87[_0x40d9('0x1c')]?_[_0x40d9('0x1d')](_0xd3fd87[_0x40d9('0x1c')],function(_0x5f1a82){return{'model':db[_0x5f1a82[_0x40d9('0x1e')]],'as':_0x5f1a82['as'],'attributes':_0x5f1a82[_0x40d9('0x1a')],'include':_0x5f1a82[_0x40d9('0x1c')]?_['map'](_0x5f1a82['include'],function(_0x5d9a75){return{'model':db[_0x5d9a75['model']],'as':_0x5d9a75['as'],'attributes':_0x5d9a75[_0x40d9('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51fdf3){logger[_0x40d9('0x12')](_0x40d9('0x1f'),_0x2e2627);logger[_0x40d9('0x20')](_0x40d9('0x1f'),_0x2e2627,JSON[_0x40d9('0xe')](_0x51fdf3));_0x4e5fa1(_0x51fdf3);})[_0x40d9('0x14')](function(_0x5d7503){logger['error']('GetTemplate',_0x5d7503[_0x40d9('0x11')],_0x2e2627);_0x216ce0(_0x56e200[_0x40d9('0xf')](0x1f4,_0x5d7503[_0x40d9('0x11')]));});});}; \ No newline at end of file +var _0x36ba=['attributes','include','model','map','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','GetTemplate','options','raw','where'];(function(_0x3ed705,_0x497347){var _0x1af557=function(_0xf4827b){while(--_0xf4827b){_0x3ed705['push'](_0x3ed705['shift']());}};_0x1af557(++_0x497347);}(_0x36ba,0x1b7));var _0xa36b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x36ba[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa36b('0x0'));var util=require(_0xa36b('0x1'));var moment=require('moment');var BPromise=require(_0xa36b('0x2'));var rs=require(_0xa36b('0x3'));var fs=require('fs');var Redis=require(_0xa36b('0x4'));var db=require(_0xa36b('0x5'))['db'];var utils=require(_0xa36b('0x6'));var logger=require(_0xa36b('0x7'))(_0xa36b('0x8'));var config=require(_0xa36b('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa36b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28a055,_0x5ebf27,_0x237d9f){return new BPromise(function(_0x50c78e,_0xf7c452){return client[_0xa36b('0xb')](_0x28a055,_0x237d9f)[_0xa36b('0xc')](function(_0x2364ee){logger[_0xa36b('0xd')](_0xa36b('0xe'),_0x5ebf27,_0xa36b('0xf'));logger[_0xa36b('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x5ebf27,_0xa36b('0xf'),JSON[_0xa36b('0x11')](_0x2364ee));if(_0x2364ee['error']){if(_0x2364ee['error'][_0xa36b('0x12')]===0x1f4){logger[_0xa36b('0x13')](_0xa36b('0xe'),_0x5ebf27,_0x2364ee[_0xa36b('0x13')][_0xa36b('0x14')]);return _0xf7c452(_0x2364ee[_0xa36b('0x13')][_0xa36b('0x14')]);}logger[_0xa36b('0x13')](_0xa36b('0xe'),_0x5ebf27,_0x2364ee[_0xa36b('0x13')][_0xa36b('0x14')]);return _0x50c78e(_0x2364ee[_0xa36b('0x13')][_0xa36b('0x14')]);}else{logger[_0xa36b('0xd')](_0xa36b('0xe'),_0x5ebf27,_0xa36b('0xf'));_0x50c78e(_0x2364ee[_0xa36b('0x15')][_0xa36b('0x14')]);}})['catch'](function(_0x20b6ec){logger[_0xa36b('0x13')](_0xa36b('0xe'),_0x5ebf27,_0x20b6ec);_0xf7c452(_0x20b6ec);});});}exports[_0xa36b('0x16')]=function(_0x1ded1d){var _0x10cb9e=this;return new Promise(function(_0x3bc3d4,_0x516ad2){return db['Template']['findAll']({'raw':_0x1ded1d['options']?_0x1ded1d[_0xa36b('0x17')][_0xa36b('0x18')]===undefined?!![]:![]:!![],'where':_0x1ded1d[_0xa36b('0x17')]?_0x1ded1d['options'][_0xa36b('0x19')]||null:null,'attributes':_0x1ded1d[_0xa36b('0x17')]?_0x1ded1d[_0xa36b('0x17')][_0xa36b('0x1a')]||null:null,'limit':_0x1ded1d['options']?_0x1ded1d['options']['limit']||null:null,'include':_0x1ded1d[_0xa36b('0x17')]?_0x1ded1d[_0xa36b('0x17')][_0xa36b('0x1b')]?_['map'](_0x1ded1d['options'][_0xa36b('0x1b')],function(_0x280d92){return{'model':db[_0x280d92[_0xa36b('0x1c')]],'as':_0x280d92['as'],'attributes':_0x280d92['attributes'],'include':_0x280d92[_0xa36b('0x1b')]?_[_0xa36b('0x1d')](_0x280d92[_0xa36b('0x1b')],function(_0x5000c3){return{'model':db[_0x5000c3[_0xa36b('0x1c')]],'as':_0x5000c3['as'],'attributes':_0x5000c3[_0xa36b('0x1a')],'include':_0x5000c3[_0xa36b('0x1b')]?_[_0xa36b('0x1d')](_0x5000c3[_0xa36b('0x1b')],function(_0x4dbe21){return{'model':db[_0x4dbe21[_0xa36b('0x1c')]],'as':_0x4dbe21['as'],'attributes':_0x4dbe21[_0xa36b('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d31ba){logger[_0xa36b('0xd')](_0xa36b('0x16'),_0x1ded1d);logger[_0xa36b('0x10')](_0xa36b('0x16'),_0x1ded1d,JSON[_0xa36b('0x11')](_0x1d31ba));_0x3bc3d4(_0x1d31ba);})[_0xa36b('0x1e')](function(_0x4d65e6){logger[_0xa36b('0x13')]('GetTemplate',_0x4d65e6[_0xa36b('0x14')],_0x1ded1d);_0x516ad2(_0x10cb9e[_0xa36b('0x13')](0x1f4,_0x4d65e6['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 0cecfe9..539593e 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 _0xdd45=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','get','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0xdd45,0x10a));var _0x5dd4=function(_0x2813c9,_0x59aadd){_0x2813c9=_0x2813c9-0x0;var _0x3867e9=_0xdd45[_0x2813c9];return _0x3867e9;};'use strict';var multer=require(_0x5dd4('0x0'));var util=require('util');var path=require(_0x5dd4('0x1'));var timeout=require(_0x5dd4('0x2'));var express=require(_0x5dd4('0x3'));var router=express[_0x5dd4('0x4')]();var fs_extra=require(_0x5dd4('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5dd4('0x6'));var controller=require(_0x5dd4('0x7'));router['get']('/',auth[_0x5dd4('0x8')](),controller[_0x5dd4('0x9')]);router['get'](_0x5dd4('0xa'),auth[_0x5dd4('0x8')](),controller[_0x5dd4('0xb')]);router[_0x5dd4('0xc')](_0x5dd4('0xd'),auth['isAuthenticated'](),controller[_0x5dd4('0xe')]);router[_0x5dd4('0xc')]('/:id/any_conditions',auth[_0x5dd4('0x8')](),controller[_0x5dd4('0xf')]);router[_0x5dd4('0xc')](_0x5dd4('0x10'),auth[_0x5dd4('0x8')](),controller[_0x5dd4('0x11')]);router[_0x5dd4('0x12')]('/',auth[_0x5dd4('0x8')](),controller[_0x5dd4('0x13')]);router[_0x5dd4('0x12')](_0x5dd4('0xd'),auth['isAuthenticated'](),controller[_0x5dd4('0x14')]);router[_0x5dd4('0x12')](_0x5dd4('0x15'),auth[_0x5dd4('0x8')](),controller[_0x5dd4('0x16')]);router[_0x5dd4('0x12')]('/:id/actions',auth[_0x5dd4('0x8')](),controller[_0x5dd4('0x17')]);router[_0x5dd4('0x18')](_0x5dd4('0xa'),auth[_0x5dd4('0x8')](),controller[_0x5dd4('0x19')]);router[_0x5dd4('0x1a')](_0x5dd4('0xa'),auth['isAuthenticated'](),controller[_0x5dd4('0x1b')]);module[_0x5dd4('0x1c')]=router; \ No newline at end of file +var _0x33b4=['exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','post','addAllCondition','addAnyCondition','addAction','/:id','update','destroy'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x33b4,0x160));var _0x433b=function(_0x10a62b,_0x4b07cd){_0x10a62b=_0x10a62b-0x0;var _0xd9dde6=_0x33b4[_0x10a62b];return _0xd9dde6;};'use strict';var multer=require('multer');var util=require(_0x433b('0x0'));var path=require('path');var timeout=require(_0x433b('0x1'));var express=require(_0x433b('0x2'));var router=express[_0x433b('0x3')]();var fs_extra=require(_0x433b('0x4'));var auth=require(_0x433b('0x5'));var interaction=require(_0x433b('0x6'));var config=require(_0x433b('0x7'));var controller=require(_0x433b('0x8'));router[_0x433b('0x9')]('/',auth[_0x433b('0xa')](),controller[_0x433b('0xb')]);router[_0x433b('0x9')]('/:id',auth[_0x433b('0xa')](),controller[_0x433b('0xc')]);router['get'](_0x433b('0xd'),auth['isAuthenticated'](),controller[_0x433b('0xe')]);router[_0x433b('0x9')](_0x433b('0xf'),auth[_0x433b('0xa')](),controller[_0x433b('0x10')]);router[_0x433b('0x9')](_0x433b('0x11'),auth[_0x433b('0xa')](),controller[_0x433b('0x12')]);router[_0x433b('0x13')]('/',auth[_0x433b('0xa')](),controller['create']);router[_0x433b('0x13')](_0x433b('0xd'),auth['isAuthenticated'](),controller[_0x433b('0x14')]);router[_0x433b('0x13')](_0x433b('0xf'),auth[_0x433b('0xa')](),controller[_0x433b('0x15')]);router[_0x433b('0x13')](_0x433b('0x11'),auth[_0x433b('0xa')](),controller[_0x433b('0x16')]);router['put'](_0x433b('0x17'),auth[_0x433b('0xa')](),controller[_0x433b('0x18')]);router['delete'](_0x433b('0x17'),auth[_0x433b('0xa')](),controller[_0x433b('0x19')]);module[_0x433b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index d0a537b..9e0e951 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 _0x2a9c=['exports','STRING','sequelize'];(function(_0x56c38,_0xe456b1){var _0x4ca365=function(_0x15bbdd){while(--_0x15bbdd){_0x56c38['push'](_0x56c38['shift']());}};_0x4ca365(++_0xe456b1);}(_0x2a9c,0xb6));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc2a9('0x0'));module[_0xc2a9('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc2a9('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x5a4a=['STRING','sequelize','exports'];(function(_0x31ad56,_0x4e0796){var _0x39bb9e=function(_0x58fb8d){while(--_0x58fb8d){_0x31ad56['push'](_0x31ad56['shift']());}};_0x39bb9e(++_0x4e0796);}(_0x5a4a,0x100));var _0xa5a4=function(_0x26a718,_0x80e326){_0x26a718=_0x26a718-0x0;var _0x19cb86=_0x5a4a[_0x26a718];return _0x19cb86;};'use strict';var Sequelize=require(_0xa5a4('0x0'));module[_0xa5a4('0x1')]={'name':{'type':Sequelize[_0xa5a4('0x2')]},'channel':{'type':Sequelize[_0xa5a4('0x2')]},'description':{'type':Sequelize[_0xa5a4('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 9e683d0..f99fbc0 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 _0x2d16=['eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','Triggers','UserProfileResource','error','stack','index','map','Trigger','fieldName','type','key','name','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','rawAttributes','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','params','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','length','getAnyConditions','addAction','Action','getActions'];(function(_0x20be43,_0x2ced25){var _0x2d5515=function(_0x43fe37){while(--_0x43fe37){_0x20be43['push'](_0x20be43['shift']());}};_0x2d5515(++_0x2ced25);}(_0x2d16,0x1c2));var _0x62d1=function(_0x57a785,_0x3e6c8f){_0x57a785=_0x57a785-0x0;var _0x36bad0=_0x2d16[_0x57a785];return _0x36bad0;};'use strict';var emlformat=require(_0x62d1('0x0'));var rimraf=require(_0x62d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x62d1('0x2'));var rp=require('request-promise');var moment=require(_0x62d1('0x3'));var BPromise=require(_0x62d1('0x4'));var Mustache=require('mustache');var util=require(_0x62d1('0x5'));var path=require(_0x62d1('0x6'));var sox=require(_0x62d1('0x7'));var csv=require(_0x62d1('0x8'));var ejs=require(_0x62d1('0x9'));var fs=require('fs');var fs_extra=require(_0x62d1('0xa'));var _=require(_0x62d1('0xb'));var squel=require('squel');var crypto=require(_0x62d1('0xc'));var jsforce=require(_0x62d1('0xd'));var deskjs=require(_0x62d1('0xe'));var toCsv=require(_0x62d1('0x8'));var querystring=require(_0x62d1('0xf'));var Papa=require(_0x62d1('0x10'));var Redis=require(_0x62d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x62d1('0x12'));var as=require(_0x62d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x62d1('0x14'))(_0x62d1('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x62d1('0x16'))['db'];function respondWithStatusCode(_0x4ecfa6,_0x46535c){_0x46535c=_0x46535c||0xcc;return function(_0x3720d3){if(_0x3720d3){return _0x4ecfa6['sendStatus'](_0x46535c);}return _0x4ecfa6[_0x62d1('0x17')](_0x46535c)['end']();};}function respondWithResult(_0x174a23,_0x3566aa){_0x3566aa=_0x3566aa||0xc8;return function(_0x212187){if(_0x212187){return _0x174a23[_0x62d1('0x17')](_0x3566aa)[_0x62d1('0x18')](_0x212187);}};}function respondWithFilteredResult(_0x555711,_0x190bad){return function(_0x3554d5){if(_0x3554d5){var _0x2cf8b0=typeof _0x190bad['offset']==='undefined'&&typeof _0x190bad['limit']===_0x62d1('0x19');var _0xdc28e2=_0x3554d5[_0x62d1('0x1a')];var _0x171050=_0x2cf8b0?0x0:_0x190bad[_0x62d1('0x1b')];var _0x5eb10f=_0x2cf8b0?_0x3554d5[_0x62d1('0x1a')]:_0x190bad['offset']+_0x190bad[_0x62d1('0x1c')];var _0x9266a7;if(_0x5eb10f>=_0xdc28e2){_0x5eb10f=_0xdc28e2;_0x9266a7=0xc8;}else{_0x9266a7=0xce;}_0x555711[_0x62d1('0x17')](_0x9266a7);return _0x555711[_0x62d1('0x1d')](_0x62d1('0x1e'),_0x171050+'-'+_0x5eb10f+'/'+_0xdc28e2)[_0x62d1('0x18')](_0x3554d5);}return null;};}function patchUpdates(_0x14204c){return function(_0x437d8e){try{jsonpatch[_0x62d1('0x1f')](_0x437d8e,_0x14204c,!![]);}catch(_0x16e35d){return BPromise['reject'](_0x16e35d);}return _0x437d8e['save']();};}function saveUpdates(_0x243fc4,_0x52b27b){return function(_0x33664b){if(_0x33664b){return _0x33664b[_0x62d1('0x20')](_0x243fc4)[_0x62d1('0x21')](function(_0x3d5752){return _0x3d5752;});}return null;};}function removeEntity(_0x489b79,_0x283bfa){return function(_0x22a810){if(_0x22a810){return _0x22a810[_0x62d1('0x22')]()[_0x62d1('0x21')](function(){var _0x3ec9a2=_0x22a810['get']({'plain':!![]});var _0x1b2cab=_0x62d1('0x23');return db[_0x62d1('0x24')][_0x62d1('0x22')]({'where':{'type':_0x1b2cab,'resourceId':_0x3ec9a2['id']}})[_0x62d1('0x21')](function(){return _0x22a810;});})[_0x62d1('0x21')](function(){_0x489b79['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12756c,_0x531d32){return function(_0x43462c){if(!_0x43462c){_0x12756c['sendStatus'](0x194);}return _0x43462c;};}function handleError(_0x36b74e,_0x95bfd4){_0x95bfd4=_0x95bfd4||0x1f4;return function(_0xb169ea){logger[_0x62d1('0x25')](_0xb169ea[_0x62d1('0x26')]);if(_0xb169ea['name']){delete _0xb169ea['name'];}_0x36b74e['status'](_0x95bfd4)['send'](_0xb169ea);};}exports[_0x62d1('0x27')]=function(_0x1ac747,_0x3851b0){var _0x283b1d={},_0x17bd6b={},_0x4b72f1={'count':0x0,'rows':[]};var _0x34bbed=_[_0x62d1('0x28')](db[_0x62d1('0x29')]['rawAttributes'],function(_0x5b1c5d){return{'name':_0x5b1c5d[_0x62d1('0x2a')],'type':_0x5b1c5d[_0x62d1('0x2b')][_0x62d1('0x2c')]};});_0x17bd6b['model']=_[_0x62d1('0x28')](_0x34bbed,_0x62d1('0x2d'));_0x17bd6b['query']=_[_0x62d1('0x2e')](_0x1ac747[_0x62d1('0x2f')]);_0x17bd6b[_0x62d1('0x30')]=_[_0x62d1('0x31')](_0x17bd6b[_0x62d1('0x32')],_0x17bd6b[_0x62d1('0x2f')]);_0x283b1d[_0x62d1('0x33')]=_[_0x62d1('0x31')](_0x17bd6b[_0x62d1('0x32')],qs[_0x62d1('0x34')](_0x1ac747[_0x62d1('0x2f')][_0x62d1('0x34')]));_0x283b1d[_0x62d1('0x33')]=_0x283b1d[_0x62d1('0x33')]['length']?_0x283b1d[_0x62d1('0x33')]:_0x17bd6b[_0x62d1('0x32')];if(!_0x1ac747[_0x62d1('0x2f')][_0x62d1('0x35')](_0x62d1('0x36'))){_0x283b1d[_0x62d1('0x1c')]=qs[_0x62d1('0x1c')](_0x1ac747['query']['limit']);_0x283b1d['offset']=qs[_0x62d1('0x1b')](_0x1ac747[_0x62d1('0x2f')][_0x62d1('0x1b')]);}_0x283b1d[_0x62d1('0x37')]=qs[_0x62d1('0x38')](_0x1ac747['query']['sort']);_0x283b1d[_0x62d1('0x39')]=qs['filters'](_[_0x62d1('0x3a')](_0x1ac747[_0x62d1('0x2f')],_0x17bd6b[_0x62d1('0x30')]),_0x34bbed);if(_0x1ac747['query'][_0x62d1('0x3b')]){_0x283b1d[_0x62d1('0x39')]=_['merge'](_0x283b1d[_0x62d1('0x39')],{'$or':_['map'](_0x34bbed,function(_0x2eced3){if(_0x2eced3[_0x62d1('0x2b')]!==_0x62d1('0x3c')){var _0x2e77a4={};_0x2e77a4[_0x2eced3[_0x62d1('0x2d')]]={'$like':'%'+_0x1ac747[_0x62d1('0x2f')][_0x62d1('0x3b')]+'%'};return _0x2e77a4;}})});}_0x283b1d=_[_0x62d1('0x3d')]({},_0x283b1d,_0x1ac747[_0x62d1('0x3e')]);var _0x5d28ee={'where':_0x283b1d[_0x62d1('0x39')]};return db['Trigger'][_0x62d1('0x1a')](_0x5d28ee)[_0x62d1('0x21')](function(_0x1b7917){_0x4b72f1[_0x62d1('0x1a')]=_0x1b7917;if(_0x1ac747[_0x62d1('0x2f')][_0x62d1('0x3f')]){_0x283b1d[_0x62d1('0x40')]=[{'all':!![]}];}return db['Trigger'][_0x62d1('0x41')](_0x283b1d);})['then'](function(_0x2accbc){_0x4b72f1['rows']=_0x2accbc;return _0x4b72f1;})[_0x62d1('0x21')](respondWithFilteredResult(_0x3851b0,_0x283b1d))[_0x62d1('0x42')](handleError(_0x3851b0,null));};exports[_0x62d1('0x43')]=function(_0x1bf2c0,_0x57132f){var _0x1fb648={'raw':![],'where':{'id':_0x1bf2c0['params']['id']}},_0x19a3ab={};_0x19a3ab[_0x62d1('0x32')]=_[_0x62d1('0x2e')](db[_0x62d1('0x29')][_0x62d1('0x44')]);_0x19a3ab[_0x62d1('0x2f')]=_[_0x62d1('0x2e')](_0x1bf2c0[_0x62d1('0x2f')]);_0x19a3ab[_0x62d1('0x30')]=_[_0x62d1('0x31')](_0x19a3ab[_0x62d1('0x32')],_0x19a3ab[_0x62d1('0x2f')]);_0x1fb648[_0x62d1('0x33')]=_[_0x62d1('0x31')](_0x19a3ab['model'],qs[_0x62d1('0x34')](_0x1bf2c0[_0x62d1('0x2f')]['fields']));_0x1fb648[_0x62d1('0x33')]=_0x1fb648['attributes']['length']?_0x1fb648[_0x62d1('0x33')]:_0x19a3ab[_0x62d1('0x32')];if(_0x1bf2c0[_0x62d1('0x2f')][_0x62d1('0x3f')]){_0x1fb648[_0x62d1('0x40')]=[{'all':!![]}];}_0x1fb648=_[_0x62d1('0x3d')]({},_0x1fb648,_0x1bf2c0[_0x62d1('0x3e')]);return db[_0x62d1('0x29')]['find'](_0x1fb648)[_0x62d1('0x21')](handleEntityNotFound(_0x57132f,null))[_0x62d1('0x21')](respondWithResult(_0x57132f,null))[_0x62d1('0x42')](handleError(_0x57132f,null));};exports['create']=function(_0x4a2180,_0x1d3399){return db[_0x62d1('0x29')][_0x62d1('0x45')](_0x4a2180['body'],{})['then'](function(_0x314805){var _0x104fbd=_0x4a2180[_0x62d1('0x46')][_0x62d1('0x47')]({'plain':!![]});if(!_0x104fbd)throw new Error(_0x62d1('0x48'));if(_0x104fbd[_0x62d1('0x49')]===_0x62d1('0x46')){var _0x18c206=_0x314805[_0x62d1('0x47')]({'plain':!![]});var _0x25f8a6='Triggers';return db['UserProfileSection'][_0x62d1('0x4a')]({'where':{'name':_0x25f8a6,'userProfileId':_0x104fbd[_0x62d1('0x4b')]},'raw':!![]})[_0x62d1('0x21')](function(_0xc23178){if(_0xc23178&&_0xc23178[_0x62d1('0x4c')]===0x0){return db[_0x62d1('0x24')]['create']({'name':_0x18c206['name'],'resourceId':_0x18c206['id'],'type':_0xc23178[_0x62d1('0x2d')],'sectionId':_0xc23178['id']},{})[_0x62d1('0x21')](function(){return _0x314805;});}else{return _0x314805;}})[_0x62d1('0x42')](function(_0x57bb7f){logger[_0x62d1('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57bb7f);throw _0x57bb7f;});}return _0x314805;})[_0x62d1('0x21')](respondWithResult(_0x1d3399,0xc9))[_0x62d1('0x42')](handleError(_0x1d3399,null));};exports[_0x62d1('0x20')]=function(_0x580707,_0x418136){if(_0x580707['body']['id']){delete _0x580707['body']['id'];}return db[_0x62d1('0x29')]['find']({'where':{'id':_0x580707[_0x62d1('0x4d')]['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x418136,null))['then'](saveUpdates(_0x580707[_0x62d1('0x4e')],null))[_0x62d1('0x21')](respondWithResult(_0x418136,null))[_0x62d1('0x42')](handleError(_0x418136,null));};exports[_0x62d1('0x22')]=function(_0x2522e5,_0x1b2723){return db[_0x62d1('0x29')][_0x62d1('0x4a')]({'where':{'id':_0x2522e5[_0x62d1('0x4d')]['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x1b2723,null))[_0x62d1('0x21')](removeEntity(_0x1b2723,null))['catch'](handleError(_0x1b2723,null));};exports[_0x62d1('0x4f')]=function(_0x21a429,_0x2bba4f,_0xb153f){if(_0x21a429['body']['id']){delete _0x21a429[_0x62d1('0x4e')]['id'];}return db[_0x62d1('0x29')][_0x62d1('0x4a')]({'where':{'id':_0x21a429[_0x62d1('0x4d')]['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x2bba4f,null))[_0x62d1('0x21')](function(_0x47b11a){if(_0x47b11a){_0x21a429['body'][_0x62d1('0x50')]=_0x47b11a['id'];return db[_0x62d1('0x51')][_0x62d1('0x45')](_0x21a429[_0x62d1('0x4e')]);}})[_0x62d1('0x21')](respondWithResult(_0x2bba4f,null))['catch'](handleError(_0x2bba4f,null));};exports[_0x62d1('0x52')]=function(_0x4063ca,_0x3b1d02,_0x4453e4){if(_0x4063ca[_0x62d1('0x4e')]['id']){delete _0x4063ca[_0x62d1('0x4e')]['id'];}return db['Trigger']['find']({'where':{'id':_0x4063ca['params']['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x3b1d02,null))[_0x62d1('0x21')](function(_0x43a84a){if(_0x43a84a){_0x4063ca[_0x62d1('0x4e')]['TriggerAnyId']=_0x43a84a['id'];return db[_0x62d1('0x51')]['create'](_0x4063ca[_0x62d1('0x4e')]);}})[_0x62d1('0x21')](respondWithResult(_0x3b1d02,null))[_0x62d1('0x42')](handleError(_0x3b1d02,null));};exports[_0x62d1('0x53')]=function(_0x975ffb,_0x10d314,_0x3d77a4){var _0x5a129a={};var _0x19d3cb={};var _0x34fe89;var _0x1a9ce2;return db[_0x62d1('0x29')][_0x62d1('0x54')]({'where':{'id':_0x975ffb['params']['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x10d314,null))[_0x62d1('0x21')](function(_0x2d1177){if(_0x2d1177){_0x34fe89=_0x2d1177;_0x19d3cb[_0x62d1('0x32')]=_[_0x62d1('0x2e')](db['Condition'][_0x62d1('0x44')]);_0x19d3cb[_0x62d1('0x2f')]=_[_0x62d1('0x2e')](_0x975ffb[_0x62d1('0x2f')]);_0x19d3cb[_0x62d1('0x30')]=_['intersection'](_0x19d3cb['model'],_0x19d3cb[_0x62d1('0x2f')]);_0x5a129a[_0x62d1('0x33')]=_['intersection'](_0x19d3cb[_0x62d1('0x32')],qs['fields'](_0x975ffb[_0x62d1('0x2f')][_0x62d1('0x34')]));_0x5a129a[_0x62d1('0x33')]=_0x5a129a['attributes'][_0x62d1('0x55')]?_0x5a129a['attributes']:_0x19d3cb[_0x62d1('0x32')];_0x5a129a[_0x62d1('0x37')]=qs[_0x62d1('0x38')](_0x975ffb[_0x62d1('0x2f')]['sort']);_0x5a129a['where']=qs[_0x62d1('0x30')](_[_0x62d1('0x3a')](_0x975ffb['query'],_0x19d3cb['filters']));if(_0x975ffb[_0x62d1('0x2f')][_0x62d1('0x3b')]){_0x5a129a[_0x62d1('0x39')]=_[_0x62d1('0x3d')](_0x5a129a[_0x62d1('0x39')],{'$or':_['map'](_0x5a129a['attributes'],function(_0x5edfa6){var _0x32cb2c={};_0x32cb2c[_0x5edfa6]={'$like':'%'+_0x975ffb[_0x62d1('0x2f')]['filter']+'%'};return _0x32cb2c;})});}_0x5a129a=_['merge']({},_0x5a129a,_0x975ffb[_0x62d1('0x3e')]);return _0x34fe89[_0x62d1('0x53')](_0x5a129a);}})[_0x62d1('0x21')](function(_0x2253fb){if(_0x2253fb){_0x1a9ce2=_0x2253fb['length'];if(!_0x975ffb[_0x62d1('0x2f')]['hasOwnProperty']('nolimit')){_0x5a129a[_0x62d1('0x1c')]=qs[_0x62d1('0x1c')](_0x975ffb[_0x62d1('0x2f')][_0x62d1('0x1c')]);_0x5a129a['offset']=qs[_0x62d1('0x1b')](_0x975ffb[_0x62d1('0x2f')][_0x62d1('0x1b')]);}return _0x34fe89[_0x62d1('0x53')](_0x5a129a);}})['then'](function(_0x265d29){if(_0x265d29){return _0x265d29?{'count':_0x1a9ce2,'rows':_0x265d29}:null;}})[_0x62d1('0x21')](respondWithResult(_0x10d314,null))['catch'](handleError(_0x10d314,null));};exports['getAnyConditions']=function(_0x3e8535,_0x1f11ff,_0x16af21){var _0x73aac6={};var _0x12d4c3={};var _0x442f87;var _0x133734;return db[_0x62d1('0x29')][_0x62d1('0x54')]({'where':{'id':_0x3e8535['params']['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x1f11ff,null))['then'](function(_0xc4041c){if(_0xc4041c){_0x442f87=_0xc4041c;_0x12d4c3[_0x62d1('0x32')]=_['keys'](db[_0x62d1('0x51')][_0x62d1('0x44')]);_0x12d4c3[_0x62d1('0x2f')]=_[_0x62d1('0x2e')](_0x3e8535[_0x62d1('0x2f')]);_0x12d4c3['filters']=_[_0x62d1('0x31')](_0x12d4c3[_0x62d1('0x32')],_0x12d4c3['query']);_0x73aac6[_0x62d1('0x33')]=_[_0x62d1('0x31')](_0x12d4c3[_0x62d1('0x32')],qs[_0x62d1('0x34')](_0x3e8535[_0x62d1('0x2f')][_0x62d1('0x34')]));_0x73aac6[_0x62d1('0x33')]=_0x73aac6[_0x62d1('0x33')]['length']?_0x73aac6[_0x62d1('0x33')]:_0x12d4c3[_0x62d1('0x32')];_0x73aac6[_0x62d1('0x37')]=qs[_0x62d1('0x38')](_0x3e8535[_0x62d1('0x2f')][_0x62d1('0x38')]);_0x73aac6[_0x62d1('0x39')]=qs['filters'](_['pick'](_0x3e8535[_0x62d1('0x2f')],_0x12d4c3[_0x62d1('0x30')]));if(_0x3e8535['query']['filter']){_0x73aac6[_0x62d1('0x39')]=_[_0x62d1('0x3d')](_0x73aac6[_0x62d1('0x39')],{'$or':_[_0x62d1('0x28')](_0x73aac6[_0x62d1('0x33')],function(_0xc2733e){var _0x253f11={};_0x253f11[_0xc2733e]={'$like':'%'+_0x3e8535[_0x62d1('0x2f')][_0x62d1('0x3b')]+'%'};return _0x253f11;})});}_0x73aac6=_[_0x62d1('0x3d')]({},_0x73aac6,_0x3e8535[_0x62d1('0x3e')]);return _0x442f87[_0x62d1('0x56')](_0x73aac6);}})[_0x62d1('0x21')](function(_0x2bb9ba){if(_0x2bb9ba){_0x133734=_0x2bb9ba[_0x62d1('0x55')];if(!_0x3e8535['query'][_0x62d1('0x35')](_0x62d1('0x36'))){_0x73aac6[_0x62d1('0x1c')]=qs[_0x62d1('0x1c')](_0x3e8535[_0x62d1('0x2f')][_0x62d1('0x1c')]);_0x73aac6[_0x62d1('0x1b')]=qs[_0x62d1('0x1b')](_0x3e8535[_0x62d1('0x2f')]['offset']);}return _0x442f87[_0x62d1('0x56')](_0x73aac6);}})['then'](function(_0xed0fae){if(_0xed0fae){return _0xed0fae?{'count':_0x133734,'rows':_0xed0fae}:null;}})['then'](respondWithResult(_0x1f11ff,null))[_0x62d1('0x42')](handleError(_0x1f11ff,null));};exports[_0x62d1('0x57')]=function(_0x433f01,_0x5dade2,_0x105ea7){if(_0x433f01[_0x62d1('0x4e')]['id']){delete _0x433f01[_0x62d1('0x4e')]['id'];}return db[_0x62d1('0x29')][_0x62d1('0x4a')]({'where':{'id':_0x433f01[_0x62d1('0x4d')]['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x5dade2,null))[_0x62d1('0x21')](function(_0x430e1a){if(_0x430e1a){_0x433f01[_0x62d1('0x4e')]['TriggerId']=_0x430e1a['id'];return db[_0x62d1('0x58')][_0x62d1('0x45')](_0x433f01[_0x62d1('0x4e')]);}})['then'](respondWithResult(_0x5dade2,null))[_0x62d1('0x42')](handleError(_0x5dade2,null));};exports[_0x62d1('0x59')]=function(_0x126a65,_0x59f150,_0x892e){var _0x1386f9={};var _0x28ac67={};var _0x552d7a;var _0x3d771e;return db[_0x62d1('0x29')][_0x62d1('0x54')]({'where':{'id':_0x126a65[_0x62d1('0x4d')]['id']}})[_0x62d1('0x21')](handleEntityNotFound(_0x59f150,null))[_0x62d1('0x21')](function(_0x9d4c9){if(_0x9d4c9){_0x552d7a=_0x9d4c9;_0x28ac67[_0x62d1('0x32')]=_['keys'](db['Action'][_0x62d1('0x44')]);_0x28ac67['query']=_[_0x62d1('0x2e')](_0x126a65[_0x62d1('0x2f')]);_0x28ac67[_0x62d1('0x30')]=_[_0x62d1('0x31')](_0x28ac67[_0x62d1('0x32')],_0x28ac67['query']);_0x1386f9['attributes']=_[_0x62d1('0x31')](_0x28ac67[_0x62d1('0x32')],qs[_0x62d1('0x34')](_0x126a65[_0x62d1('0x2f')][_0x62d1('0x34')]));_0x1386f9[_0x62d1('0x33')]=_0x1386f9[_0x62d1('0x33')][_0x62d1('0x55')]?_0x1386f9[_0x62d1('0x33')]:_0x28ac67[_0x62d1('0x32')];_0x1386f9[_0x62d1('0x37')]=qs[_0x62d1('0x38')](_0x126a65[_0x62d1('0x2f')][_0x62d1('0x38')]);_0x1386f9[_0x62d1('0x39')]=qs[_0x62d1('0x30')](_['pick'](_0x126a65[_0x62d1('0x2f')],_0x28ac67['filters']));if(_0x126a65[_0x62d1('0x2f')][_0x62d1('0x3b')]){_0x1386f9[_0x62d1('0x39')]=_[_0x62d1('0x3d')](_0x1386f9[_0x62d1('0x39')],{'$or':_['map'](_0x1386f9['attributes'],function(_0xe27505){var _0x141141={};_0x141141[_0xe27505]={'$like':'%'+_0x126a65[_0x62d1('0x2f')][_0x62d1('0x3b')]+'%'};return _0x141141;})});}_0x1386f9=_[_0x62d1('0x3d')]({},_0x1386f9,_0x126a65[_0x62d1('0x3e')]);return _0x552d7a[_0x62d1('0x59')](_0x1386f9);}})[_0x62d1('0x21')](function(_0x2f2302){if(_0x2f2302){_0x3d771e=_0x2f2302['length'];if(!_0x126a65[_0x62d1('0x2f')][_0x62d1('0x35')]('nolimit')){_0x1386f9['limit']=qs[_0x62d1('0x1c')](_0x126a65[_0x62d1('0x2f')]['limit']);_0x1386f9[_0x62d1('0x1b')]=qs[_0x62d1('0x1b')](_0x126a65[_0x62d1('0x2f')]['offset']);}return _0x552d7a[_0x62d1('0x59')](_0x1386f9);}})[_0x62d1('0x21')](function(_0x57f570){if(_0x57f570){return _0x57f570?{'count':_0x3d771e,'rows':_0x57f570}:null;}})[_0x62d1('0x21')](respondWithResult(_0x59f150,null))[_0x62d1('0x42')](handleError(_0x59f150,null));}; \ No newline at end of file +var _0xce35=['Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','save','then','destroy','get','Triggers','UserProfileResource','stack','name','index','map','Trigger','type','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','rawAttributes','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','order','getAnyConditions','addAction'];(function(_0x59befa,_0x4af99b){var _0x1dd63d=function(_0x4c1df4){while(--_0x4c1df4){_0x59befa['push'](_0x59befa['shift']());}};_0x1dd63d(++_0x4af99b);}(_0xce35,0x1c9));var _0x5ce3=function(_0x32b6d4,_0x558ad8){_0x32b6d4=_0x32b6d4-0x0;var _0x65892e=_0xce35[_0x32b6d4];return _0x65892e;};'use strict';var emlformat=require(_0x5ce3('0x0'));var rimraf=require(_0x5ce3('0x1'));var zipdir=require(_0x5ce3('0x2'));var jsonpatch=require(_0x5ce3('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5ce3('0x4'));var Mustache=require(_0x5ce3('0x5'));var util=require(_0x5ce3('0x6'));var path=require(_0x5ce3('0x7'));var sox=require(_0x5ce3('0x8'));var csv=require(_0x5ce3('0x9'));var ejs=require(_0x5ce3('0xa'));var fs=require('fs');var fs_extra=require(_0x5ce3('0xb'));var _=require(_0x5ce3('0xc'));var squel=require('squel');var crypto=require(_0x5ce3('0xd'));var jsforce=require(_0x5ce3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ce3('0xf'));var Papa=require(_0x5ce3('0x10'));var Redis=require(_0x5ce3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5ce3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ce3('0x13'));var logger=require(_0x5ce3('0x14'))(_0x5ce3('0x15'));var utils=require(_0x5ce3('0x16'));var config=require(_0x5ce3('0x17'));var licenseUtil=require(_0x5ce3('0x18'));var db=require(_0x5ce3('0x19'))['db'];function respondWithStatusCode(_0x5ef3df,_0x116583){_0x116583=_0x116583||0xcc;return function(_0x3d2a2f){if(_0x3d2a2f){return _0x5ef3df[_0x5ce3('0x1a')](_0x116583);}return _0x5ef3df[_0x5ce3('0x1b')](_0x116583)[_0x5ce3('0x1c')]();};}function respondWithResult(_0x5e6ea7,_0x32a87f){_0x32a87f=_0x32a87f||0xc8;return function(_0x1a82c9){if(_0x1a82c9){return _0x5e6ea7[_0x5ce3('0x1b')](_0x32a87f)[_0x5ce3('0x1d')](_0x1a82c9);}};}function respondWithFilteredResult(_0x42c8f4,_0x1c2389){return function(_0x5f5056){if(_0x5f5056){var _0x5bf791=typeof _0x1c2389['offset']===_0x5ce3('0x1e')&&typeof _0x1c2389['limit']===_0x5ce3('0x1e');var _0x1bac75=_0x5f5056['count'];var _0x1b402e=_0x5bf791?0x0:_0x1c2389[_0x5ce3('0x1f')];var _0x2688e0=_0x5bf791?_0x5f5056[_0x5ce3('0x20')]:_0x1c2389['offset']+_0x1c2389[_0x5ce3('0x21')];var _0x3c8277;if(_0x2688e0>=_0x1bac75){_0x2688e0=_0x1bac75;_0x3c8277=0xc8;}else{_0x3c8277=0xce;}_0x42c8f4[_0x5ce3('0x1b')](_0x3c8277);return _0x42c8f4[_0x5ce3('0x22')]('Content-Range',_0x1b402e+'-'+_0x2688e0+'/'+_0x1bac75)[_0x5ce3('0x1d')](_0x5f5056);}return null;};}function patchUpdates(_0xe26002){return function(_0x2327fd){try{jsonpatch['apply'](_0x2327fd,_0xe26002,!![]);}catch(_0x456586){return BPromise['reject'](_0x456586);}return _0x2327fd[_0x5ce3('0x23')]();};}function saveUpdates(_0x500c4e,_0x5787ac){return function(_0x29206f){if(_0x29206f){return _0x29206f['update'](_0x500c4e)[_0x5ce3('0x24')](function(_0x4183bb){return _0x4183bb;});}return null;};}function removeEntity(_0x1481a4,_0x3c3041){return function(_0x197c35){if(_0x197c35){return _0x197c35[_0x5ce3('0x25')]()[_0x5ce3('0x24')](function(){var _0x675484=_0x197c35[_0x5ce3('0x26')]({'plain':!![]});var _0x3e9868=_0x5ce3('0x27');return db[_0x5ce3('0x28')][_0x5ce3('0x25')]({'where':{'type':_0x3e9868,'resourceId':_0x675484['id']}})['then'](function(){return _0x197c35;});})[_0x5ce3('0x24')](function(){_0x1481a4[_0x5ce3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4375,_0x386c47){return function(_0x382b50){if(!_0x382b50){_0x1e4375[_0x5ce3('0x1a')](0x194);}return _0x382b50;};}function handleError(_0x3fc2d3,_0x442bb1){_0x442bb1=_0x442bb1||0x1f4;return function(_0x3e12e2){logger['error'](_0x3e12e2[_0x5ce3('0x29')]);if(_0x3e12e2['name']){delete _0x3e12e2[_0x5ce3('0x2a')];}_0x3fc2d3[_0x5ce3('0x1b')](_0x442bb1)['send'](_0x3e12e2);};}exports[_0x5ce3('0x2b')]=function(_0x5ed6ce,_0x53fe3b){var _0x55247f={},_0x33b8d6={},_0x2f258f={'count':0x0,'rows':[]};var _0x58436d=_[_0x5ce3('0x2c')](db[_0x5ce3('0x2d')]['rawAttributes'],function(_0x1ad943){return{'name':_0x1ad943['fieldName'],'type':_0x1ad943[_0x5ce3('0x2e')]['key']};});_0x33b8d6['model']=_['map'](_0x58436d,_0x5ce3('0x2a'));_0x33b8d6[_0x5ce3('0x2f')]=_[_0x5ce3('0x30')](_0x5ed6ce[_0x5ce3('0x2f')]);_0x33b8d6['filters']=_[_0x5ce3('0x31')](_0x33b8d6['model'],_0x33b8d6['query']);_0x55247f[_0x5ce3('0x32')]=_[_0x5ce3('0x31')](_0x33b8d6['model'],qs[_0x5ce3('0x33')](_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x33')]));_0x55247f[_0x5ce3('0x32')]=_0x55247f[_0x5ce3('0x32')][_0x5ce3('0x34')]?_0x55247f[_0x5ce3('0x32')]:_0x33b8d6[_0x5ce3('0x35')];if(!_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x36')](_0x5ce3('0x37'))){_0x55247f['limit']=qs[_0x5ce3('0x21')](_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x21')]);_0x55247f[_0x5ce3('0x1f')]=qs[_0x5ce3('0x1f')](_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x1f')]);}_0x55247f['order']=qs[_0x5ce3('0x38')](_0x5ed6ce['query']['sort']);_0x55247f['where']=qs[_0x5ce3('0x39')](_['pick'](_0x5ed6ce['query'],_0x33b8d6[_0x5ce3('0x39')]),_0x58436d);if(_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x3a')]){_0x55247f[_0x5ce3('0x3b')]=_[_0x5ce3('0x3c')](_0x55247f[_0x5ce3('0x3b')],{'$or':_['map'](_0x58436d,function(_0x2ab5cb){if(_0x2ab5cb[_0x5ce3('0x2e')]!==_0x5ce3('0x3d')){var _0x1c3fce={};_0x1c3fce[_0x2ab5cb[_0x5ce3('0x2a')]]={'$like':'%'+_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x3a')]+'%'};return _0x1c3fce;}})});}_0x55247f=_[_0x5ce3('0x3c')]({},_0x55247f,_0x5ed6ce[_0x5ce3('0x3e')]);var _0x6989fb={'where':_0x55247f[_0x5ce3('0x3b')]};return db[_0x5ce3('0x2d')][_0x5ce3('0x20')](_0x6989fb)[_0x5ce3('0x24')](function(_0x5748f2){_0x2f258f['count']=_0x5748f2;if(_0x5ed6ce[_0x5ce3('0x2f')][_0x5ce3('0x3f')]){_0x55247f[_0x5ce3('0x40')]=[{'all':!![]}];}return db[_0x5ce3('0x2d')][_0x5ce3('0x41')](_0x55247f);})[_0x5ce3('0x24')](function(_0x3c7946){_0x2f258f['rows']=_0x3c7946;return _0x2f258f;})['then'](respondWithFilteredResult(_0x53fe3b,_0x55247f))[_0x5ce3('0x42')](handleError(_0x53fe3b,null));};exports['show']=function(_0xea29f2,_0x397bee){var _0x56a24b={'raw':![],'where':{'id':_0xea29f2[_0x5ce3('0x43')]['id']}},_0x2fabcd={};_0x2fabcd[_0x5ce3('0x35')]=_['keys'](db[_0x5ce3('0x2d')][_0x5ce3('0x44')]);_0x2fabcd[_0x5ce3('0x2f')]=_[_0x5ce3('0x30')](_0xea29f2[_0x5ce3('0x2f')]);_0x2fabcd[_0x5ce3('0x39')]=_[_0x5ce3('0x31')](_0x2fabcd['model'],_0x2fabcd[_0x5ce3('0x2f')]);_0x56a24b[_0x5ce3('0x32')]=_[_0x5ce3('0x31')](_0x2fabcd[_0x5ce3('0x35')],qs['fields'](_0xea29f2[_0x5ce3('0x2f')][_0x5ce3('0x33')]));_0x56a24b[_0x5ce3('0x32')]=_0x56a24b[_0x5ce3('0x32')][_0x5ce3('0x34')]?_0x56a24b[_0x5ce3('0x32')]:_0x2fabcd['model'];if(_0xea29f2[_0x5ce3('0x2f')]['includeAll']){_0x56a24b[_0x5ce3('0x40')]=[{'all':!![]}];}_0x56a24b=_['merge']({},_0x56a24b,_0xea29f2['options']);return db[_0x5ce3('0x2d')]['find'](_0x56a24b)[_0x5ce3('0x24')](handleEntityNotFound(_0x397bee,null))[_0x5ce3('0x24')](respondWithResult(_0x397bee,null))['catch'](handleError(_0x397bee,null));};exports['create']=function(_0x5b6621,_0x2db42a){return db[_0x5ce3('0x2d')][_0x5ce3('0x45')](_0x5b6621[_0x5ce3('0x46')],{})[_0x5ce3('0x24')](function(_0x44ea92){var _0x5e6cb3=_0x5b6621[_0x5ce3('0x47')][_0x5ce3('0x26')]({'plain':!![]});if(!_0x5e6cb3)throw new Error(_0x5ce3('0x48'));if(_0x5e6cb3[_0x5ce3('0x49')]===_0x5ce3('0x47')){var _0x2571d3=_0x44ea92[_0x5ce3('0x26')]({'plain':!![]});var _0x29745c=_0x5ce3('0x27');return db[_0x5ce3('0x4a')][_0x5ce3('0x4b')]({'where':{'name':_0x29745c,'userProfileId':_0x5e6cb3[_0x5ce3('0x4c')]},'raw':!![]})[_0x5ce3('0x24')](function(_0x234ff5){if(_0x234ff5&&_0x234ff5[_0x5ce3('0x4d')]===0x0){return db['UserProfileResource'][_0x5ce3('0x45')]({'name':_0x2571d3[_0x5ce3('0x2a')],'resourceId':_0x2571d3['id'],'type':_0x234ff5['name'],'sectionId':_0x234ff5['id']},{})['then'](function(){return _0x44ea92;});}else{return _0x44ea92;}})['catch'](function(_0x4850b5){logger[_0x5ce3('0x4e')](_0x5ce3('0x4f'),_0x4850b5);throw _0x4850b5;});}return _0x44ea92;})[_0x5ce3('0x24')](respondWithResult(_0x2db42a,0xc9))[_0x5ce3('0x42')](handleError(_0x2db42a,null));};exports['update']=function(_0x594e6a,_0x1f42a5){if(_0x594e6a[_0x5ce3('0x46')]['id']){delete _0x594e6a[_0x5ce3('0x46')]['id'];}return db[_0x5ce3('0x2d')][_0x5ce3('0x4b')]({'where':{'id':_0x594e6a['params']['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x1f42a5,null))[_0x5ce3('0x24')](saveUpdates(_0x594e6a['body'],null))['then'](respondWithResult(_0x1f42a5,null))['catch'](handleError(_0x1f42a5,null));};exports[_0x5ce3('0x25')]=function(_0x106126,_0x596b68){return db[_0x5ce3('0x2d')][_0x5ce3('0x4b')]({'where':{'id':_0x106126[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x596b68,null))['then'](removeEntity(_0x596b68,null))[_0x5ce3('0x42')](handleError(_0x596b68,null));};exports[_0x5ce3('0x50')]=function(_0xfcd51c,_0x893d47,_0x453078){if(_0xfcd51c[_0x5ce3('0x46')]['id']){delete _0xfcd51c[_0x5ce3('0x46')]['id'];}return db[_0x5ce3('0x2d')][_0x5ce3('0x4b')]({'where':{'id':_0xfcd51c[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x893d47,null))[_0x5ce3('0x24')](function(_0x581d5a){if(_0x581d5a){_0xfcd51c[_0x5ce3('0x46')][_0x5ce3('0x51')]=_0x581d5a['id'];return db[_0x5ce3('0x52')][_0x5ce3('0x45')](_0xfcd51c['body']);}})[_0x5ce3('0x24')](respondWithResult(_0x893d47,null))[_0x5ce3('0x42')](handleError(_0x893d47,null));};exports[_0x5ce3('0x53')]=function(_0x34676e,_0x863888,_0x5c7303){if(_0x34676e[_0x5ce3('0x46')]['id']){delete _0x34676e[_0x5ce3('0x46')]['id'];}return db[_0x5ce3('0x2d')][_0x5ce3('0x4b')]({'where':{'id':_0x34676e[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x863888,null))['then'](function(_0x44fc70){if(_0x44fc70){_0x34676e['body']['TriggerAnyId']=_0x44fc70['id'];return db['Condition'][_0x5ce3('0x45')](_0x34676e[_0x5ce3('0x46')]);}})[_0x5ce3('0x24')](respondWithResult(_0x863888,null))['catch'](handleError(_0x863888,null));};exports[_0x5ce3('0x54')]=function(_0x536f0a,_0x1e7cf6,_0x14694f){var _0x48d224={};var _0x19342f={};var _0x4670c3;var _0x42fef5;return db[_0x5ce3('0x2d')][_0x5ce3('0x55')]({'where':{'id':_0x536f0a[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x1e7cf6,null))[_0x5ce3('0x24')](function(_0x20cebf){if(_0x20cebf){_0x4670c3=_0x20cebf;_0x19342f[_0x5ce3('0x35')]=_[_0x5ce3('0x30')](db['Condition']['rawAttributes']);_0x19342f['query']=_[_0x5ce3('0x30')](_0x536f0a['query']);_0x19342f[_0x5ce3('0x39')]=_[_0x5ce3('0x31')](_0x19342f[_0x5ce3('0x35')],_0x19342f[_0x5ce3('0x2f')]);_0x48d224['attributes']=_['intersection'](_0x19342f['model'],qs[_0x5ce3('0x33')](_0x536f0a['query'][_0x5ce3('0x33')]));_0x48d224[_0x5ce3('0x32')]=_0x48d224['attributes']['length']?_0x48d224[_0x5ce3('0x32')]:_0x19342f[_0x5ce3('0x35')];_0x48d224[_0x5ce3('0x56')]=qs['sort'](_0x536f0a[_0x5ce3('0x2f')][_0x5ce3('0x38')]);_0x48d224[_0x5ce3('0x3b')]=qs[_0x5ce3('0x39')](_['pick'](_0x536f0a[_0x5ce3('0x2f')],_0x19342f['filters']));if(_0x536f0a[_0x5ce3('0x2f')][_0x5ce3('0x3a')]){_0x48d224['where']=_[_0x5ce3('0x3c')](_0x48d224['where'],{'$or':_[_0x5ce3('0x2c')](_0x48d224[_0x5ce3('0x32')],function(_0x33596f){var _0x40102e={};_0x40102e[_0x33596f]={'$like':'%'+_0x536f0a[_0x5ce3('0x2f')][_0x5ce3('0x3a')]+'%'};return _0x40102e;})});}_0x48d224=_[_0x5ce3('0x3c')]({},_0x48d224,_0x536f0a['options']);return _0x4670c3['getAllConditions'](_0x48d224);}})[_0x5ce3('0x24')](function(_0xda5a4a){if(_0xda5a4a){_0x42fef5=_0xda5a4a[_0x5ce3('0x34')];if(!_0x536f0a[_0x5ce3('0x2f')][_0x5ce3('0x36')](_0x5ce3('0x37'))){_0x48d224[_0x5ce3('0x21')]=qs[_0x5ce3('0x21')](_0x536f0a[_0x5ce3('0x2f')][_0x5ce3('0x21')]);_0x48d224[_0x5ce3('0x1f')]=qs[_0x5ce3('0x1f')](_0x536f0a[_0x5ce3('0x2f')][_0x5ce3('0x1f')]);}return _0x4670c3[_0x5ce3('0x54')](_0x48d224);}})['then'](function(_0x4ae72c){if(_0x4ae72c){return _0x4ae72c?{'count':_0x42fef5,'rows':_0x4ae72c}:null;}})[_0x5ce3('0x24')](respondWithResult(_0x1e7cf6,null))['catch'](handleError(_0x1e7cf6,null));};exports[_0x5ce3('0x57')]=function(_0x1b372b,_0x1fff0d,_0x26d101){var _0x3dd0ab={};var _0x477783={};var _0x41e8bb;var _0x2a9ca3;return db['Trigger'][_0x5ce3('0x55')]({'where':{'id':_0x1b372b[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x1fff0d,null))[_0x5ce3('0x24')](function(_0x3329d0){if(_0x3329d0){_0x41e8bb=_0x3329d0;_0x477783[_0x5ce3('0x35')]=_['keys'](db[_0x5ce3('0x52')][_0x5ce3('0x44')]);_0x477783[_0x5ce3('0x2f')]=_[_0x5ce3('0x30')](_0x1b372b[_0x5ce3('0x2f')]);_0x477783[_0x5ce3('0x39')]=_[_0x5ce3('0x31')](_0x477783['model'],_0x477783[_0x5ce3('0x2f')]);_0x3dd0ab[_0x5ce3('0x32')]=_[_0x5ce3('0x31')](_0x477783[_0x5ce3('0x35')],qs['fields'](_0x1b372b[_0x5ce3('0x2f')][_0x5ce3('0x33')]));_0x3dd0ab[_0x5ce3('0x32')]=_0x3dd0ab[_0x5ce3('0x32')][_0x5ce3('0x34')]?_0x3dd0ab['attributes']:_0x477783['model'];_0x3dd0ab[_0x5ce3('0x56')]=qs[_0x5ce3('0x38')](_0x1b372b[_0x5ce3('0x2f')]['sort']);_0x3dd0ab['where']=qs[_0x5ce3('0x39')](_['pick'](_0x1b372b['query'],_0x477783[_0x5ce3('0x39')]));if(_0x1b372b['query'][_0x5ce3('0x3a')]){_0x3dd0ab[_0x5ce3('0x3b')]=_[_0x5ce3('0x3c')](_0x3dd0ab[_0x5ce3('0x3b')],{'$or':_['map'](_0x3dd0ab[_0x5ce3('0x32')],function(_0x36541d){var _0x26d53b={};_0x26d53b[_0x36541d]={'$like':'%'+_0x1b372b[_0x5ce3('0x2f')][_0x5ce3('0x3a')]+'%'};return _0x26d53b;})});}_0x3dd0ab=_[_0x5ce3('0x3c')]({},_0x3dd0ab,_0x1b372b['options']);return _0x41e8bb['getAnyConditions'](_0x3dd0ab);}})[_0x5ce3('0x24')](function(_0x2b0e6c){if(_0x2b0e6c){_0x2a9ca3=_0x2b0e6c[_0x5ce3('0x34')];if(!_0x1b372b[_0x5ce3('0x2f')]['hasOwnProperty'](_0x5ce3('0x37'))){_0x3dd0ab[_0x5ce3('0x21')]=qs[_0x5ce3('0x21')](_0x1b372b[_0x5ce3('0x2f')][_0x5ce3('0x21')]);_0x3dd0ab[_0x5ce3('0x1f')]=qs[_0x5ce3('0x1f')](_0x1b372b[_0x5ce3('0x2f')][_0x5ce3('0x1f')]);}return _0x41e8bb[_0x5ce3('0x57')](_0x3dd0ab);}})['then'](function(_0x53b8cf){if(_0x53b8cf){return _0x53b8cf?{'count':_0x2a9ca3,'rows':_0x53b8cf}:null;}})[_0x5ce3('0x24')](respondWithResult(_0x1fff0d,null))[_0x5ce3('0x42')](handleError(_0x1fff0d,null));};exports[_0x5ce3('0x58')]=function(_0x43c31c,_0x1494e0,_0x1db866){if(_0x43c31c[_0x5ce3('0x46')]['id']){delete _0x43c31c[_0x5ce3('0x46')]['id'];}return db[_0x5ce3('0x2d')]['find']({'where':{'id':_0x43c31c[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x1494e0,null))['then'](function(_0x19aef7){if(_0x19aef7){_0x43c31c['body']['TriggerId']=_0x19aef7['id'];return db[_0x5ce3('0x59')][_0x5ce3('0x45')](_0x43c31c[_0x5ce3('0x46')]);}})[_0x5ce3('0x24')](respondWithResult(_0x1494e0,null))['catch'](handleError(_0x1494e0,null));};exports['getActions']=function(_0x4606e8,_0x10ea0c,_0x405d41){var _0x1cc994={};var _0x155a9e={};var _0x235715;var _0x46d528;return db[_0x5ce3('0x2d')][_0x5ce3('0x55')]({'where':{'id':_0x4606e8[_0x5ce3('0x43')]['id']}})[_0x5ce3('0x24')](handleEntityNotFound(_0x10ea0c,null))[_0x5ce3('0x24')](function(_0x33e5a9){if(_0x33e5a9){_0x235715=_0x33e5a9;_0x155a9e[_0x5ce3('0x35')]=_[_0x5ce3('0x30')](db[_0x5ce3('0x59')][_0x5ce3('0x44')]);_0x155a9e[_0x5ce3('0x2f')]=_[_0x5ce3('0x30')](_0x4606e8[_0x5ce3('0x2f')]);_0x155a9e[_0x5ce3('0x39')]=_[_0x5ce3('0x31')](_0x155a9e[_0x5ce3('0x35')],_0x155a9e[_0x5ce3('0x2f')]);_0x1cc994[_0x5ce3('0x32')]=_[_0x5ce3('0x31')](_0x155a9e[_0x5ce3('0x35')],qs[_0x5ce3('0x33')](_0x4606e8[_0x5ce3('0x2f')]['fields']));_0x1cc994[_0x5ce3('0x32')]=_0x1cc994[_0x5ce3('0x32')][_0x5ce3('0x34')]?_0x1cc994[_0x5ce3('0x32')]:_0x155a9e[_0x5ce3('0x35')];_0x1cc994[_0x5ce3('0x56')]=qs['sort'](_0x4606e8[_0x5ce3('0x2f')]['sort']);_0x1cc994['where']=qs[_0x5ce3('0x39')](_['pick'](_0x4606e8['query'],_0x155a9e['filters']));if(_0x4606e8[_0x5ce3('0x2f')][_0x5ce3('0x3a')]){_0x1cc994[_0x5ce3('0x3b')]=_[_0x5ce3('0x3c')](_0x1cc994[_0x5ce3('0x3b')],{'$or':_[_0x5ce3('0x2c')](_0x1cc994[_0x5ce3('0x32')],function(_0x3a98e3){var _0xb799e1={};_0xb799e1[_0x3a98e3]={'$like':'%'+_0x4606e8[_0x5ce3('0x2f')]['filter']+'%'};return _0xb799e1;})});}_0x1cc994=_['merge']({},_0x1cc994,_0x4606e8['options']);return _0x235715[_0x5ce3('0x5a')](_0x1cc994);}})[_0x5ce3('0x24')](function(_0x276892){if(_0x276892){_0x46d528=_0x276892[_0x5ce3('0x34')];if(!_0x4606e8[_0x5ce3('0x2f')]['hasOwnProperty'](_0x5ce3('0x37'))){_0x1cc994[_0x5ce3('0x21')]=qs[_0x5ce3('0x21')](_0x4606e8[_0x5ce3('0x2f')][_0x5ce3('0x21')]);_0x1cc994[_0x5ce3('0x1f')]=qs[_0x5ce3('0x1f')](_0x4606e8['query']['offset']);}return _0x235715[_0x5ce3('0x5a')](_0x1cc994);}})[_0x5ce3('0x24')](function(_0x3062df){if(_0x3062df){return _0x3062df?{'count':_0x46d528,'rows':_0x3062df}:null;}})[_0x5ce3('0x24')](respondWithResult(_0x10ea0c,null))[_0x5ce3('0x42')](handleError(_0x10ea0c,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 76907f7..080b681 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 _0x40b5=['bluebird','request-promise','rimraf','../../config/environment','./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment'];(function(_0x515bb6,_0x4fdf67){var _0x440f4c=function(_0x342fcb){while(--_0x342fcb){_0x515bb6['push'](_0x515bb6['shift']());}};_0x440f4c(++_0x4fdf67);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var util=require(_0x540b('0x1'));var logger=require(_0x540b('0x2'))(_0x540b('0x3'));var moment=require(_0x540b('0x4'));var BPromise=require(_0x540b('0x5'));var rp=require(_0x540b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x540b('0x7'));var config=require(_0x540b('0x8'));var attributes=require(_0x540b('0x9'));module[_0x540b('0xa')]=function(_0x5b75dc,_0x4e0a29){return _0x5b75dc[_0x540b('0xb')](_0x540b('0xc'),attributes,{'tableName':_0x540b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x975f=['rimraf','../../config/environment','./trigger.attributes','define','Trigger','lodash','util','moment','bluebird','path'];(function(_0x5952b1,_0x21d1cc){var _0x5377c5=function(_0x425691){while(--_0x425691){_0x5952b1['push'](_0x5952b1['shift']());}};_0x5377c5(++_0x21d1cc);}(_0x975f,0x109));var _0xf975=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0x975f[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0xf975('0x0'));var util=require(_0xf975('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf975('0x2'));var BPromise=require(_0xf975('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf975('0x4'));var rimraf=require(_0xf975('0x5'));var config=require(_0xf975('0x6'));var attributes=require(_0xf975('0x7'));module['exports']=function(_0x356f71,_0x5a9aca){return _0x356f71[_0xf975('0x8')](_0xf975('0x9'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index a01d525..bc1976b 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 _0xdfe0=['ioredis','../../mysqldb','../../config/utils','jayson/promise','request','then','info','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','include','model','map','debug','catch','ShowTrigger','find','lodash','moment','bluebird'];(function(_0x14dfd6,_0x392fa4){var _0x36c19a=function(_0x453179){while(--_0x453179){_0x14dfd6['push'](_0x14dfd6['shift']());}};_0x36c19a(++_0x392fa4);}(_0xdfe0,0x1ec));var _0x0dfe=function(_0x1fb0d7,_0x480e7a){_0x1fb0d7=_0x1fb0d7-0x0;var _0x4da9e9=_0xdfe0[_0x1fb0d7];return _0x4da9e9;};'use strict';var _=require(_0x0dfe('0x0'));var util=require('util');var moment=require(_0x0dfe('0x1'));var BPromise=require(_0x0dfe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0dfe('0x3'));var db=require(_0x0dfe('0x4'))['db'];var utils=require(_0x0dfe('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0dfe('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4ca60a,_0x200d00,_0x17e472){return new BPromise(function(_0x33a851,_0x311f1d){return client[_0x0dfe('0x7')](_0x4ca60a,_0x17e472)[_0x0dfe('0x8')](function(_0x3560ea){logger[_0x0dfe('0x9')]('Trigger,\x20%s,\x20%s',_0x200d00,'request\x20sent');logger['debug'](_0x0dfe('0xa'),_0x200d00,_0x0dfe('0xb'),JSON[_0x0dfe('0xc')](_0x3560ea));if(_0x3560ea[_0x0dfe('0xd')]){if(_0x3560ea[_0x0dfe('0xd')][_0x0dfe('0xe')]===0x1f4){logger[_0x0dfe('0xd')](_0x0dfe('0xf'),_0x200d00,_0x3560ea[_0x0dfe('0xd')][_0x0dfe('0x10')]);return _0x311f1d(_0x3560ea[_0x0dfe('0xd')][_0x0dfe('0x10')]);}logger['error'](_0x0dfe('0xf'),_0x200d00,_0x3560ea[_0x0dfe('0xd')][_0x0dfe('0x10')]);return _0x33a851(_0x3560ea[_0x0dfe('0xd')][_0x0dfe('0x10')]);}else{logger['info'](_0x0dfe('0xf'),_0x200d00,_0x0dfe('0xb'));_0x33a851(_0x3560ea[_0x0dfe('0x11')]['message']);}})['catch'](function(_0x584827){logger[_0x0dfe('0xd')](_0x0dfe('0xf'),_0x200d00,_0x584827);_0x311f1d(_0x584827);});});}exports[_0x0dfe('0x12')]=function(_0x400030){var _0x454028=this;return new Promise(function(_0x143421,_0x52bcdc){return db[_0x0dfe('0x13')][_0x0dfe('0x14')]({'raw':_0x400030[_0x0dfe('0x15')]?_0x400030['options'][_0x0dfe('0x16')]===undefined?!![]:![]:!![],'where':_0x400030[_0x0dfe('0x15')]?_0x400030['options'][_0x0dfe('0x17')]||null:null,'attributes':_0x400030[_0x0dfe('0x15')]?_0x400030[_0x0dfe('0x15')][_0x0dfe('0x18')]||null:null,'limit':_0x400030[_0x0dfe('0x15')]?_0x400030['options'][_0x0dfe('0x19')]||null:null,'include':_0x400030[_0x0dfe('0x15')]?_0x400030[_0x0dfe('0x15')][_0x0dfe('0x1a')]?_['map'](_0x400030[_0x0dfe('0x15')][_0x0dfe('0x1a')],function(_0x134f48){return{'model':db[_0x134f48[_0x0dfe('0x1b')]],'as':_0x134f48['as'],'attributes':_0x134f48[_0x0dfe('0x18')],'include':_0x134f48[_0x0dfe('0x1a')]?_['map'](_0x134f48['include'],function(_0x215409){return{'model':db[_0x215409[_0x0dfe('0x1b')]],'as':_0x215409['as'],'attributes':_0x215409['attributes'],'include':_0x215409[_0x0dfe('0x1a')]?_[_0x0dfe('0x1c')](_0x215409['include'],function(_0x323f73){return{'model':db[_0x323f73[_0x0dfe('0x1b')]],'as':_0x323f73['as'],'attributes':_0x323f73['attributes']};}):[]};}):[]};}):[]:[]})[_0x0dfe('0x8')](function(_0x4ecb34){logger[_0x0dfe('0x9')](_0x0dfe('0x12'),_0x400030);logger[_0x0dfe('0x1d')](_0x0dfe('0x12'),_0x400030,JSON[_0x0dfe('0xc')](_0x4ecb34));_0x143421(_0x4ecb34);})[_0x0dfe('0x1e')](function(_0x3f63ec){logger[_0x0dfe('0xd')](_0x0dfe('0x12'),_0x3f63ec[_0x0dfe('0x10')],_0x400030);_0x52bcdc(_0x454028[_0x0dfe('0xd')](0x1f4,_0x3f63ec[_0x0dfe('0x10')]));});});};exports[_0x0dfe('0x1f')]=function(_0x1b360c){var _0x1f93b3=this;return new Promise(function(_0x2fb6d1,_0x28f694){return db['Trigger'][_0x0dfe('0x20')]({'raw':_0x1b360c[_0x0dfe('0x15')]?_0x1b360c[_0x0dfe('0x15')][_0x0dfe('0x16')]===undefined?!![]:![]:!![],'where':_0x1b360c[_0x0dfe('0x15')]?_0x1b360c['options'][_0x0dfe('0x17')]||null:null,'attributes':_0x1b360c[_0x0dfe('0x15')]?_0x1b360c[_0x0dfe('0x15')][_0x0dfe('0x18')]||null:null,'include':_0x1b360c[_0x0dfe('0x15')]?_0x1b360c[_0x0dfe('0x15')][_0x0dfe('0x1a')]?_['map'](_0x1b360c[_0x0dfe('0x15')]['include'],function(_0x617723){return{'model':db[_0x617723[_0x0dfe('0x1b')]],'as':_0x617723['as'],'attributes':_0x617723[_0x0dfe('0x18')],'include':_0x617723[_0x0dfe('0x1a')]?_['map'](_0x617723[_0x0dfe('0x1a')],function(_0x2a2fe9){return{'model':db[_0x2a2fe9[_0x0dfe('0x1b')]],'as':_0x2a2fe9['as'],'attributes':_0x2a2fe9[_0x0dfe('0x18')],'include':_0x2a2fe9[_0x0dfe('0x1a')]?_[_0x0dfe('0x1c')](_0x2a2fe9[_0x0dfe('0x1a')],function(_0x3cf9f6){return{'model':db[_0x3cf9f6[_0x0dfe('0x1b')]],'as':_0x3cf9f6['as'],'attributes':_0x3cf9f6[_0x0dfe('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x297414){logger[_0x0dfe('0x9')](_0x0dfe('0x1f'),_0x1b360c);logger[_0x0dfe('0x1d')](_0x0dfe('0x1f'),_0x1b360c,JSON[_0x0dfe('0xc')](_0x297414));_0x2fb6d1(_0x297414);})[_0x0dfe('0x1e')](function(_0x40aea7){logger[_0x0dfe('0xd')](_0x0dfe('0x1f'),_0x40aea7[_0x0dfe('0x10')],_0x1b360c);_0x28f694(_0x1f93b3['error'](0x1f4,_0x40aea7[_0x0dfe('0x10')]));});});}; \ No newline at end of file +var _0xcc3a=['message','info','catch','GetTrigger','Trigger','options','attributes','limit','include','map','model','ShowTrigger','find','raw','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s'];(function(_0x26bfe1,_0x8c9394){var _0xb6c0b7=function(_0x41b02d){while(--_0x41b02d){_0x26bfe1['push'](_0x26bfe1['shift']());}};_0xb6c0b7(++_0x8c9394);}(_0xcc3a,0x1a7));var _0xacc3=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0xcc3a[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0xacc3('0x0'));var moment=require(_0xacc3('0x1'));var BPromise=require('bluebird');var rs=require(_0xacc3('0x2'));var fs=require('fs');var Redis=require(_0xacc3('0x3'));var db=require(_0xacc3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xacc3('0x5'))(_0xacc3('0x6'));var config=require(_0xacc3('0x7'));var jayson=require(_0xacc3('0x8'));var client=jayson[_0xacc3('0x9')][_0xacc3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d56bd,_0x3126a9,_0x2aabc4){return new BPromise(function(_0xd2278e,_0x5d2e49){return client['request'](_0x1d56bd,_0x2aabc4)[_0xacc3('0xb')](function(_0x3f6af3){logger['info']('Trigger,\x20%s,\x20%s',_0x3126a9,'request\x20sent');logger[_0xacc3('0xc')](_0xacc3('0xd'),_0x3126a9,_0xacc3('0xe'),JSON[_0xacc3('0xf')](_0x3f6af3));if(_0x3f6af3[_0xacc3('0x10')]){if(_0x3f6af3[_0xacc3('0x10')][_0xacc3('0x11')]===0x1f4){logger['error'](_0xacc3('0x12'),_0x3126a9,_0x3f6af3[_0xacc3('0x10')][_0xacc3('0x13')]);return _0x5d2e49(_0x3f6af3[_0xacc3('0x10')][_0xacc3('0x13')]);}logger[_0xacc3('0x10')](_0xacc3('0x12'),_0x3126a9,_0x3f6af3['error'][_0xacc3('0x13')]);return _0xd2278e(_0x3f6af3[_0xacc3('0x10')][_0xacc3('0x13')]);}else{logger[_0xacc3('0x14')](_0xacc3('0x12'),_0x3126a9,_0xacc3('0xe'));_0xd2278e(_0x3f6af3['result'][_0xacc3('0x13')]);}})[_0xacc3('0x15')](function(_0x2582f3){logger[_0xacc3('0x10')]('Trigger,\x20%s,\x20%s',_0x3126a9,_0x2582f3);_0x5d2e49(_0x2582f3);});});}exports[_0xacc3('0x16')]=function(_0x26fcb7){var _0x356566=this;return new Promise(function(_0xdfd215,_0x464835){return db[_0xacc3('0x17')]['findAll']({'raw':_0x26fcb7[_0xacc3('0x18')]?_0x26fcb7['options']['raw']===undefined?!![]:![]:!![],'where':_0x26fcb7[_0xacc3('0x18')]?_0x26fcb7[_0xacc3('0x18')]['where']||null:null,'attributes':_0x26fcb7['options']?_0x26fcb7['options'][_0xacc3('0x19')]||null:null,'limit':_0x26fcb7[_0xacc3('0x18')]?_0x26fcb7[_0xacc3('0x18')][_0xacc3('0x1a')]||null:null,'include':_0x26fcb7[_0xacc3('0x18')]?_0x26fcb7['options'][_0xacc3('0x1b')]?_[_0xacc3('0x1c')](_0x26fcb7['options'][_0xacc3('0x1b')],function(_0x41eeaa){return{'model':db[_0x41eeaa[_0xacc3('0x1d')]],'as':_0x41eeaa['as'],'attributes':_0x41eeaa[_0xacc3('0x19')],'include':_0x41eeaa[_0xacc3('0x1b')]?_[_0xacc3('0x1c')](_0x41eeaa[_0xacc3('0x1b')],function(_0x20643d){return{'model':db[_0x20643d[_0xacc3('0x1d')]],'as':_0x20643d['as'],'attributes':_0x20643d['attributes'],'include':_0x20643d['include']?_[_0xacc3('0x1c')](_0x20643d['include'],function(_0x279df7){return{'model':db[_0x279df7['model']],'as':_0x279df7['as'],'attributes':_0x279df7[_0xacc3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xacc3('0xb')](function(_0x470dd8){logger[_0xacc3('0x14')](_0xacc3('0x16'),_0x26fcb7);logger['debug']('GetTrigger',_0x26fcb7,JSON[_0xacc3('0xf')](_0x470dd8));_0xdfd215(_0x470dd8);})[_0xacc3('0x15')](function(_0x5da5a6){logger[_0xacc3('0x10')](_0xacc3('0x16'),_0x5da5a6[_0xacc3('0x13')],_0x26fcb7);_0x464835(_0x356566[_0xacc3('0x10')](0x1f4,_0x5da5a6[_0xacc3('0x13')]));});});};exports[_0xacc3('0x1e')]=function(_0x4f8f01){var _0x48636f=this;return new Promise(function(_0x236d8d,_0x52111b){return db[_0xacc3('0x17')][_0xacc3('0x1f')]({'raw':_0x4f8f01[_0xacc3('0x18')]?_0x4f8f01[_0xacc3('0x18')][_0xacc3('0x20')]===undefined?!![]:![]:!![],'where':_0x4f8f01[_0xacc3('0x18')]?_0x4f8f01[_0xacc3('0x18')][_0xacc3('0x21')]||null:null,'attributes':_0x4f8f01['options']?_0x4f8f01[_0xacc3('0x18')][_0xacc3('0x19')]||null:null,'include':_0x4f8f01['options']?_0x4f8f01[_0xacc3('0x18')][_0xacc3('0x1b')]?_['map'](_0x4f8f01[_0xacc3('0x18')][_0xacc3('0x1b')],function(_0x181617){return{'model':db[_0x181617['model']],'as':_0x181617['as'],'attributes':_0x181617['attributes'],'include':_0x181617[_0xacc3('0x1b')]?_[_0xacc3('0x1c')](_0x181617['include'],function(_0x1412b1){return{'model':db[_0x1412b1[_0xacc3('0x1d')]],'as':_0x1412b1['as'],'attributes':_0x1412b1['attributes'],'include':_0x1412b1[_0xacc3('0x1b')]?_[_0xacc3('0x1c')](_0x1412b1[_0xacc3('0x1b')],function(_0x37b559){return{'model':db[_0x37b559[_0xacc3('0x1d')]],'as':_0x37b559['as'],'attributes':_0x37b559[_0xacc3('0x19')]};}):[]};}):[]};}):[]:[]})[_0xacc3('0xb')](function(_0x53e710){logger[_0xacc3('0x14')](_0xacc3('0x1e'),_0x4f8f01);logger[_0xacc3('0xc')](_0xacc3('0x1e'),_0x4f8f01,JSON[_0xacc3('0xf')](_0x53e710));_0x236d8d(_0x53e710);})[_0xacc3('0x15')](function(_0x113c62){logger[_0xacc3('0x10')]('ShowTrigger',_0x113c62[_0xacc3('0x13')],_0x4f8f01);_0x52111b(_0x48636f[_0xacc3('0x10')](0x1f4,_0x113c62[_0xacc3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 1b24cdd..4a63dab 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 _0x6cb8=['isAuthenticated','index','/:id','post','clone','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x6cb8,0x172));var _0x86cb=function(_0x39cae5,_0x18cf74){_0x39cae5=_0x39cae5-0x0;var _0x297ead=_0x6cb8[_0x39cae5];return _0x297ead;};'use strict';var multer=require(_0x86cb('0x0'));var util=require(_0x86cb('0x1'));var path=require('path');var timeout=require(_0x86cb('0x2'));var express=require(_0x86cb('0x3'));var router=express[_0x86cb('0x4')]();var fs_extra=require(_0x86cb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x86cb('0x6'));var config=require(_0x86cb('0x7'));var controller=require(_0x86cb('0x8'));router[_0x86cb('0x9')]('/',auth[_0x86cb('0xa')](),controller[_0x86cb('0xb')]);router[_0x86cb('0x9')](_0x86cb('0xc'),auth[_0x86cb('0xa')](),controller['show']);router[_0x86cb('0xd')]('/:id/clone',auth[_0x86cb('0xa')](),controller[_0x86cb('0xe')]);router[_0x86cb('0xd')]('/',auth[_0x86cb('0xa')](),controller[_0x86cb('0xf')]);router[_0x86cb('0x10')](_0x86cb('0xc'),auth[_0x86cb('0xa')](),controller[_0x86cb('0x11')]);router['delete'](_0x86cb('0xc'),auth[_0x86cb('0xa')](),controller[_0x86cb('0x12')]);module[_0x86cb('0x13')]=router; \ No newline at end of file +var _0x7df7=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post','create','update','destroy','exports'];(function(_0x5a19d8,_0x29b124){var _0x291708=function(_0x468a0c){while(--_0x468a0c){_0x5a19d8['push'](_0x5a19d8['shift']());}};_0x291708(++_0x29b124);}(_0x7df7,0x165));var _0x77df=function(_0x4a310e,_0x4f415c){_0x4a310e=_0x4a310e-0x0;var _0x58a05d=_0x7df7[_0x4a310e];return _0x58a05d;};'use strict';var multer=require(_0x77df('0x0'));var util=require(_0x77df('0x1'));var path=require('path');var timeout=require(_0x77df('0x2'));var express=require(_0x77df('0x3'));var router=express[_0x77df('0x4')]();var fs_extra=require(_0x77df('0x5'));var auth=require(_0x77df('0x6'));var interaction=require(_0x77df('0x7'));var config=require(_0x77df('0x8'));var controller=require('./trunk.controller');router[_0x77df('0x9')]('/',auth[_0x77df('0xa')](),controller[_0x77df('0xb')]);router[_0x77df('0x9')](_0x77df('0xc'),auth[_0x77df('0xa')](),controller[_0x77df('0xd')]);router['post'](_0x77df('0xe'),auth[_0x77df('0xa')](),controller[_0x77df('0xf')]);router[_0x77df('0x10')]('/',auth['isAuthenticated'](),controller[_0x77df('0x11')]);router['put'](_0x77df('0xc'),auth[_0x77df('0xa')](),controller[_0x77df('0x12')]);router['delete']('/:id',auth[_0x77df('0xa')](),controller[_0x77df('0x13')]);module[_0x77df('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index ae0730e..e0b63e0 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 _0xc5cb=['yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','uas','active','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','peer','friend','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','rfc2833','info','shortinfo'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc5cb,0x10a));var _0xbc5c=function(_0x56f5aa,_0xdc8d5b){_0x56f5aa=_0x56f5aa-0x0;var _0x26a03a=_0xc5cb[_0x56f5aa];return _0x26a03a;};'use strict';var Sequelize=require(_0xbc5c('0x0'));module[_0xbc5c('0x1')]={'name':{'type':Sequelize[_0xbc5c('0x2')],'allowNull':![],'unique':_0xbc5c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend','user',_0xbc5c('0x4')),'allowNull':![],'defaultValue':_0xbc5c('0x5')},'context':{'type':Sequelize[_0xbc5c('0x2')],'allowNull':![],'defaultValue':_0xbc5c('0x6')},'callingpres':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x8'),_0xbc5c('0x9'),'ALLOWED_FAILED_SCREEN',_0xbc5c('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xbc5c('0xb'),_0xbc5c('0xc'))},'deny':{'type':Sequelize[_0xbc5c('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xbc5c('0x2')]},'md5secret':{'type':Sequelize[_0xbc5c('0x2')]},'remotesecret':{'type':Sequelize[_0xbc5c('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xbc5c('0xd'),'set':function(_0x29224b){this[_0xbc5c('0xe')](_0xbc5c('0xf'),_0x29224b?_0x29224b[_0xbc5c('0x10')](','):null);},'get':function(){return this[_0xbc5c('0x11')](_0xbc5c('0xf'))?this['getDataValue'](_0xbc5c('0xf'))[_0xbc5c('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x13'),_0xbc5c('0x14'),_0xbc5c('0x15'),'inband','auto'),'defaultValue':_0xbc5c('0x13')},'directmedia':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no',_0xbc5c('0x17'),_0xbc5c('0x18'),_0xbc5c('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xbc5c('0x2')],'defaultValue':_0xbc5c('0x1a'),'set':function(_0x512924){this[_0xbc5c('0xe')]('nat',_0x512924?_0x512924[_0xbc5c('0x10')](','):null);},'get':function(){return this[_0xbc5c('0x11')](_0xbc5c('0x1b'))?this['getDataValue']('nat')['split'](','):null;},'comment':_0xbc5c('0x1c')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xbc5c('0x2')]},'pickupgroup':{'type':Sequelize[_0xbc5c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xbc5c('0x2')]},'language':{'type':Sequelize[_0xbc5c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbc5c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xbc5c('0x2')],'defaultValue':_0xbc5c('0x1d')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbc5c('0x1e'),'set':function(_0x412fb1){this[_0xbc5c('0xe')]('allow',_0x412fb1?_0x412fb1[_0xbc5c('0x10')](';'):_0xbc5c('0x1e'));},'get':function(){return this[_0xbc5c('0x11')](_0xbc5c('0x1f'))?this[_0xbc5c('0x11')]('allow')['split'](';'):null;},'comment':_0xbc5c('0x20')},'autoframing':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'insecure':{'type':Sequelize[_0xbc5c('0x2')],'defaultValue':_0xbc5c('0x21'),'set':function(_0x2198e0){this['setDataValue'](_0xbc5c('0x22'),_0x2198e0?_0x2198e0['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xbc5c('0x11')](_0xbc5c('0x22'))['split'](','):null;},'comment':_0xbc5c('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0xbc5c('0x16'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xbc5c('0x16'),'no',_0xbc5c('0x24'))},'promiscredir':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'useclientcode':{'type':Sequelize[_0xbc5c('0x7')]('yes','no')},'accountcode':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'setvar':{'type':Sequelize[_0xbc5c('0x2')]},'callerid':{'type':Sequelize['STRING'],'defaultValue':_0xbc5c('0x26')},'amaflags':{'type':Sequelize[_0xbc5c('0x2')]},'callcounter':{'type':Sequelize[_0xbc5c('0x7')]('yes','no'),'defaultValue':_0xbc5c('0x16')},'busylevel':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0xbc5c('0x7')]('yes','no')},'allowtransfer':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xbc5c('0x2')]},'videosupport':{'type':Sequelize[_0xbc5c('0x7')]('yes','no',_0xbc5c('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no')},'mailbox':{'type':Sequelize[_0xbc5c('0x2')]},'session_timers':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x28'),_0xbc5c('0x29'),'originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xbc5c('0x7')]('uac',_0xbc5c('0x2a')),'defaultValue':_0xbc5c('0x2a')},'t38pt_usertpsource':{'type':Sequelize[_0xbc5c('0x2')]},'regexten':{'type':Sequelize[_0xbc5c('0x2')]},'fromdomain':{'type':Sequelize[_0xbc5c('0x2')]},'fromuser':{'type':Sequelize[_0xbc5c('0x2')]},'port':{'type':Sequelize[_0xbc5c('0x25')](0x5)},'qualify':{'type':Sequelize[_0xbc5c('0x7')]('yes','no'),'defaultValue':_0xbc5c('0x16')},'keepalive':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xbc5c('0x2')]},'defaultuser':{'type':Sequelize[_0xbc5c('0x2')]},'rtptimeout':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0xbc5c('0x7')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbc5c('0x2')]},'callbackextension':{'type':Sequelize[_0xbc5c('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xbc5c('0x2')]},'contactdeny':{'type':Sequelize[_0xbc5c('0x2')]},'contactacl':{'type':Sequelize[_0xbc5c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xbc5c('0x2')]},'use_q850_reason':{'type':Sequelize[_0xbc5c('0x2')]},'maxforwards':{'type':Sequelize[_0xbc5c('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'force_avp':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'icesupport':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'dtlsenable':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize[_0xbc5c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xbc5c('0x2')]},'dtlscipher':{'type':Sequelize[_0xbc5c('0x2')]},'dtlscafile':{'type':Sequelize[_0xbc5c('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize['ENUM'](_0xbc5c('0x2b'),'passive',_0xbc5c('0x2c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xbc5c('0x7')](_0xbc5c('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbc5c('0x2')]},'recordofffeature':{'type':Sequelize[_0xbc5c('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xbc5c('0x16'),'no')},'subscribemwi':{'type':Sequelize[_0xbc5c('0x7')]('yes','no')},'vmexten':{'type':Sequelize[_0xbc5c('0x2')]},'mohinterpret':{'type':Sequelize[_0xbc5c('0x2')]},'mohsuggest':{'type':Sequelize[_0xbc5c('0x2')]},'parkinglot':{'type':Sequelize[_0xbc5c('0x2')]},'description':{'type':Sequelize[_0xbc5c('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xbc5c('0x2d')},'canreinvite':{'type':Sequelize['ENUM'](_0xbc5c('0x16'),'no',_0xbc5c('0x17'),_0xbc5c('0x18'),_0xbc5c('0x2e')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xbc5c('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xbc5c('0x2f')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbc5c('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0xb927=['originate','uac','uas','pai','fingerprint','active','passive','BOOLEAN','sequelize','exports','STRING','ENUM','user','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','never','\x22\x22\x20<>','INTEGER','always','accept','refuse'];(function(_0x282734,_0x8a42d3){var _0x312069=function(_0x1ffced){while(--_0x1ffced){_0x282734['push'](_0x282734['shift']());}};_0x312069(++_0x8a42d3);}(_0xb927,0x134));var _0x7b92=function(_0x35e293,_0x452144){_0x35e293=_0x35e293-0x0;var _0x5216de=_0xb927[_0x35e293];return _0x5216de;};'use strict';var Sequelize=require(_0x7b92('0x0'));module[_0x7b92('0x1')]={'name':{'type':Sequelize[_0x7b92('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7b92('0x3')]('friend',_0x7b92('0x4'),'peer'),'allowNull':![],'defaultValue':_0x7b92('0x5')},'context':{'type':Sequelize[_0x7b92('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize['ENUM'](_0x7b92('0x6'),_0x7b92('0x7'),_0x7b92('0x8'),_0x7b92('0x9'),_0x7b92('0xa'),_0x7b92('0xb'),_0x7b92('0xc'),'PROHIB')},'deny':{'type':Sequelize[_0x7b92('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x7b92('0x2')]},'md5secret':{'type':Sequelize[_0x7b92('0x2')]},'remotesecret':{'type':Sequelize[_0x7b92('0x2')]},'transport':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':_0x7b92('0xd'),'set':function(_0x2a07bc){this[_0x7b92('0xe')](_0x7b92('0xf'),_0x2a07bc?_0x2a07bc['join'](','):null);},'get':function(){return this[_0x7b92('0x10')](_0x7b92('0xf'))?this[_0x7b92('0x10')](_0x7b92('0xf'))[_0x7b92('0x11')](','):null;},'comment':_0x7b92('0x12')},'dtmfmode':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x13'),'info',_0x7b92('0x14'),_0x7b92('0x15'),_0x7b92('0x16')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x7b92('0x17'),'no',_0x7b92('0x18'),_0x7b92('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7b92('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':_0x7b92('0x1a'),'set':function(_0x318933){this['setDataValue'](_0x7b92('0x1b'),_0x318933?_0x318933['join'](','):null);},'get':function(){return this[_0x7b92('0x10')](_0x7b92('0x1b'))?this[_0x7b92('0x10')](_0x7b92('0x1b'))[_0x7b92('0x11')](','):null;},'comment':_0x7b92('0x1c')},'callgroup':{'type':Sequelize[_0x7b92('0x2')]},'namedcallgroup':{'type':Sequelize[_0x7b92('0x2')]},'pickupgroup':{'type':Sequelize[_0x7b92('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x7b92('0x2')]},'language':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7b92('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':_0x7b92('0x1d')},'allow':{'type':Sequelize[_0x7b92('0x2')],'allowNull':![],'defaultValue':_0x7b92('0x1e'),'set':function(_0x32199c){this[_0x7b92('0xe')](_0x7b92('0x1f'),_0x32199c?_0x32199c[_0x7b92('0x20')](';'):_0x7b92('0x1e'));},'get':function(){return this[_0x7b92('0x10')]('allow')?this['getDataValue'](_0x7b92('0x1f'))['split'](';'):null;},'comment':_0x7b92('0x21')},'autoframing':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'insecure':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':_0x7b92('0x22'),'set':function(_0x5ae721){this[_0x7b92('0xe')]('insecure',_0x5ae721?_0x5ae721[_0x7b92('0x20')](','):null);},'get':function(){return this[_0x7b92('0x10')](_0x7b92('0x23'))?this['getDataValue'](_0x7b92('0x23'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no',_0x7b92('0x24'))},'promiscredir':{'type':Sequelize[_0x7b92('0x3')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0x7b92('0x2')]},'callerid':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':_0x7b92('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no'),'defaultValue':_0x7b92('0x17')},'busylevel':{'type':Sequelize[_0x7b92('0x26')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x7b92('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x7b92('0x3')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7b92('0x3')]('yes','no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7b92('0x3')]('yes','no',_0x7b92('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7b92('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'mailbox':{'type':Sequelize[_0x7b92('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x7b92('0x28'),_0x7b92('0x29'),_0x7b92('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x2b'),'uas'),'defaultValue':_0x7b92('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7b92('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7b92('0x2')]},'fromuser':{'type':Sequelize[_0x7b92('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7b92('0x17'),'no'),'defaultValue':_0x7b92('0x17')},'keepalive':{'type':Sequelize[_0x7b92('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x7b92('0x2')]},'defaultuser':{'type':Sequelize[_0x7b92('0x2')]},'rtptimeout':{'type':Sequelize[_0x7b92('0x26')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x7b92('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7b92('0x26')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x7b92('0x17'),'no',_0x7b92('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7b92('0x2')]},'callbackextension':{'type':Sequelize[_0x7b92('0x2')]},'timert1':{'type':Sequelize[_0x7b92('0x26')](0xb)},'timerb':{'type':Sequelize[_0x7b92('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7b92('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x7b92('0x2')]},'contactdeny':{'type':Sequelize[_0x7b92('0x2')]},'contactacl':{'type':Sequelize[_0x7b92('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x7b92('0x2')]},'use_q850_reason':{'type':Sequelize[_0x7b92('0x2')]},'maxforwards':{'type':Sequelize[_0x7b92('0x26')](0xb)},'encryption':{'type':Sequelize[_0x7b92('0x3')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x7b92('0x17'),'no')},'force_avp':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'icesupport':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x7b92('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no',_0x7b92('0x2e'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x7b92('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7b92('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x7b92('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7b92('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x7b92('0x2f'),_0x7b92('0x30'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7b92('0x2')]},'usereqphone':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7b92('0x2')]},'recordofffeature':{'type':Sequelize[_0x7b92('0x2')]},'call_limit':{'type':Sequelize[_0x7b92('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x7b92('0x3')](_0x7b92('0x17'),'no')},'vmexten':{'type':Sequelize[_0x7b92('0x2')]},'mohinterpret':{'type':Sequelize[_0x7b92('0x2')]},'mohsuggest':{'type':Sequelize[_0x7b92('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7b92('0x2')]},'host':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize['ENUM'](_0x7b92('0x17'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x7b92('0x2')]},'active':{'type':Sequelize[_0x7b92('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7b92('0x2')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 77cd80b..556eecc 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 _0x54ef=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','get','updatedAt','omit','body','createdAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','userProfileId','root','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','Trunks','UserProfileResource','name','send','index','map','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x12037b,_0x145c16){var _0x52ac6f=function(_0x42d4b9){while(--_0x42d4b9){_0x12037b['push'](_0x12037b['shift']());}};_0x52ac6f(++_0x145c16);}(_0x54ef,0x112));var _0xf54e=function(_0x82fd1f,_0x101a41){_0x82fd1f=_0x82fd1f-0x0;var _0x179c3a=_0x54ef[_0x82fd1f];return _0x179c3a;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x2033e9,_0x28f776,_0x380f26,_0x5644aa){return new BPromise(function(_0x331732,_0x1bbeaa){var _0x1855fe=_0x5644aa||client;return _0x1855fe[_0xf54e('0x1a')](_0x2033e9,_0x380f26)['then'](function(_0x2366ee){logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,'request\x20sent');logger['debug'](_0xf54e('0x1d'),_0x28f776,_0xf54e('0x1e'),JSON[_0xf54e('0x1f')](_0x2366ee));if(_0x2366ee[_0xf54e('0x20')]){if(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x21')]===0x1f4){logger[_0xf54e('0x20')](_0xf54e('0x1c'),_0x28f776,_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);return _0x1bbeaa(_0x2366ee[_0xf54e('0x20')]['message']);}logger['error'](_0xf54e('0x1c'),_0x28f776,_0x2366ee['error'][_0xf54e('0x22')]);return _0x331732(_0x2366ee[_0xf54e('0x20')][_0xf54e('0x22')]);}else{logger[_0xf54e('0x1b')](_0xf54e('0x1c'),_0x28f776,_0xf54e('0x1e'));_0x331732(_0x2366ee[_0xf54e('0x23')][_0xf54e('0x22')]);}})[_0xf54e('0x24')](function(_0x5f9eea){logger[_0xf54e('0x20')]('Trunk,\x20%s,\x20%s',_0x28f776,_0x5f9eea);_0x1bbeaa(_0x5f9eea);});});}function respondWithStatusCode(_0x6f6d29,_0x54f914){_0x54f914=_0x54f914||0xcc;return function(_0x264a8f){if(_0x264a8f){return _0x6f6d29[_0xf54e('0x25')](_0x54f914);}return _0x6f6d29[_0xf54e('0x26')](_0x54f914)[_0xf54e('0x27')]();};}function respondWithResult(_0x3805a7,_0x160160){_0x160160=_0x160160||0xc8;return function(_0x1e08d1){if(_0x1e08d1){return _0x3805a7[_0xf54e('0x26')](_0x160160)[_0xf54e('0x28')](_0x1e08d1);}};}function respondWithFilteredResult(_0x33457f,_0xf6cdd7){return function(_0x39c0ae){if(_0x39c0ae){var _0x2ea001=typeof _0xf6cdd7['offset']===_0xf54e('0x29')&&typeof _0xf6cdd7['limit']===_0xf54e('0x29');var _0x5e63f4=_0x39c0ae[_0xf54e('0x2a')];var _0x269f47=_0x2ea001?0x0:_0xf6cdd7[_0xf54e('0x2b')];var _0xa13cd0=_0x2ea001?_0x39c0ae[_0xf54e('0x2a')]:_0xf6cdd7[_0xf54e('0x2b')]+_0xf6cdd7[_0xf54e('0x2c')];var _0x54bd8f;if(_0xa13cd0>=_0x5e63f4){_0xa13cd0=_0x5e63f4;_0x54bd8f=0xc8;}else{_0x54bd8f=0xce;}_0x33457f['status'](_0x54bd8f);return _0x33457f[_0xf54e('0x2d')](_0xf54e('0x2e'),_0x269f47+'-'+_0xa13cd0+'/'+_0x5e63f4)[_0xf54e('0x28')](_0x39c0ae);}return null;};}function patchUpdates(_0x16d00f){return function(_0xb2d4c4){try{jsonpatch[_0xf54e('0x2f')](_0xb2d4c4,_0x16d00f,!![]);}catch(_0x2b5408){return BPromise[_0xf54e('0x30')](_0x2b5408);}return _0xb2d4c4[_0xf54e('0x31')]();};}function saveUpdates(_0x12edc3,_0x5ea0cc){return function(_0x5f29d3){if(_0x5f29d3){return _0x5f29d3[_0xf54e('0x32')](_0x12edc3)[_0xf54e('0x33')](function(_0x4d8fdd){return _0x4d8fdd;});}return null;};}function removeEntity(_0x3e319c,_0x82e313){return function(_0x379110){if(_0x379110){return _0x379110[_0xf54e('0x34')]()['then'](function(){var _0x54bea4=_0x379110['get']({'plain':!![]});var _0x3c0cca=_0xf54e('0x35');return db[_0xf54e('0x36')][_0xf54e('0x34')]({'where':{'type':_0x3c0cca,'resourceId':_0x54bea4['id']}})[_0xf54e('0x33')](function(){return _0x379110;});})[_0xf54e('0x33')](function(){_0x3e319c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x530cee,_0xc04e04){return function(_0x734187){if(!_0x734187){_0x530cee['sendStatus'](0x194);}return _0x734187;};}function handleError(_0x4d9b06,_0xda1d10){_0xda1d10=_0xda1d10||0x1f4;return function(_0x2c0d30){logger[_0xf54e('0x20')](_0x2c0d30['stack']);if(_0x2c0d30[_0xf54e('0x37')]){delete _0x2c0d30[_0xf54e('0x37')];}_0x4d9b06['status'](_0xda1d10)[_0xf54e('0x38')](_0x2c0d30);};}exports[_0xf54e('0x39')]=function(_0x5af03,_0x1eeeb4){var _0x12ef97={},_0x199056={},_0x4e00b7={'count':0x0,'rows':[]};var _0x5d45cf=_[_0xf54e('0x3a')](db[_0xf54e('0x3b')][_0xf54e('0x3c')],function(_0x4b1f84){return{'name':_0x4b1f84[_0xf54e('0x3d')],'type':_0x4b1f84[_0xf54e('0x3e')][_0xf54e('0x3f')]};});_0x199056[_0xf54e('0x40')]=_[_0xf54e('0x3a')](_0x5d45cf,_0xf54e('0x37'));_0x199056[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x5af03[_0xf54e('0x41')]);_0x199056[_0xf54e('0x43')]=_[_0xf54e('0x44')](_0x199056[_0xf54e('0x40')],_0x199056[_0xf54e('0x41')]);_0x12ef97[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x199056['model'],qs['fields'](_0x5af03['query'][_0xf54e('0x46')]));_0x12ef97[_0xf54e('0x45')]=_0x12ef97['attributes'][_0xf54e('0x47')]?_0x12ef97[_0xf54e('0x45')]:_0x199056[_0xf54e('0x40')];if(!_0x5af03['query'][_0xf54e('0x48')](_0xf54e('0x49'))){_0x12ef97[_0xf54e('0x2c')]=qs[_0xf54e('0x2c')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x2c')]);_0x12ef97[_0xf54e('0x2b')]=qs[_0xf54e('0x2b')](_0x5af03[_0xf54e('0x41')]['offset']);}_0x12ef97[_0xf54e('0x4a')]=qs[_0xf54e('0x4b')](_0x5af03[_0xf54e('0x41')][_0xf54e('0x4b')]);_0x12ef97[_0xf54e('0x4c')]=qs[_0xf54e('0x43')](_['pick'](_0x5af03[_0xf54e('0x41')],_0x199056['filters']),_0x5d45cf);if(_0x5af03[_0xf54e('0x41')]['filter']){_0x12ef97[_0xf54e('0x4c')]=_[_0xf54e('0x4d')](_0x12ef97[_0xf54e('0x4c')],{'$or':_['map'](_0x5d45cf,function(_0x1af35d){if(_0x1af35d[_0xf54e('0x3e')]!==_0xf54e('0x4e')){var _0x32fb46={};_0x32fb46[_0x1af35d[_0xf54e('0x37')]]={'$like':'%'+_0x5af03['query'][_0xf54e('0x4f')]+'%'};return _0x32fb46;}})});}_0x12ef97=_[_0xf54e('0x4d')]({},_0x12ef97,_0x5af03[_0xf54e('0x50')]);var _0x45592b={'where':_0x12ef97['where']};return db[_0xf54e('0x3b')][_0xf54e('0x2a')](_0x45592b)['then'](function(_0x22c842){_0x4e00b7[_0xf54e('0x2a')]=_0x22c842;if(_0x5af03[_0xf54e('0x41')][_0xf54e('0x51')]){_0x12ef97['include']=[{'all':!![]}];}return db[_0xf54e('0x3b')][_0xf54e('0x52')](_0x12ef97);})[_0xf54e('0x33')](function(_0xb4654f){_0x4e00b7[_0xf54e('0x53')]=_0xb4654f;return _0x4e00b7;})[_0xf54e('0x33')](respondWithFilteredResult(_0x1eeeb4,_0x12ef97))[_0xf54e('0x24')](handleError(_0x1eeeb4,null));};exports[_0xf54e('0x54')]=function(_0x15bfef,_0x21f2f8){var _0xaf9bf0={'raw':![],'where':{'id':_0x15bfef[_0xf54e('0x55')]['id']}},_0x1f4cf8={};_0x1f4cf8[_0xf54e('0x40')]=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x1f4cf8[_0xf54e('0x41')]=_[_0xf54e('0x42')](_0x15bfef[_0xf54e('0x41')]);_0x1f4cf8['filters']=_['intersection'](_0x1f4cf8[_0xf54e('0x40')],_0x1f4cf8[_0xf54e('0x41')]);_0xaf9bf0[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x1f4cf8[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x15bfef[_0xf54e('0x41')][_0xf54e('0x46')]));_0xaf9bf0[_0xf54e('0x45')]=_0xaf9bf0[_0xf54e('0x45')][_0xf54e('0x47')]?_0xaf9bf0['attributes']:_0x1f4cf8[_0xf54e('0x40')];if(_0x15bfef[_0xf54e('0x41')][_0xf54e('0x51')]){_0xaf9bf0[_0xf54e('0x56')]=[{'all':!![]}];}_0xaf9bf0=_[_0xf54e('0x4d')]({},_0xaf9bf0,_0x15bfef[_0xf54e('0x50')]);return db[_0xf54e('0x3b')]['find'](_0xaf9bf0)[_0xf54e('0x33')](handleEntityNotFound(_0x21f2f8,null))[_0xf54e('0x33')](respondWithResult(_0x21f2f8,null))[_0xf54e('0x24')](handleError(_0x21f2f8,null));};exports['clone']=function(_0x3ce832,_0x54ac1a){var _0x465a0f={'where':{'id':_0x3ce832[_0xf54e('0x55')]['id']}},_0x400ee0={};_0x400ee0['model']=_[_0xf54e('0x42')](db[_0xf54e('0x3b')][_0xf54e('0x3c')]);_0x465a0f[_0xf54e('0x45')]=_[_0xf54e('0x44')](_0x400ee0[_0xf54e('0x40')],qs[_0xf54e('0x46')](_0x3ce832['query']['fields']));_0x465a0f[_0xf54e('0x45')]=_0x465a0f[_0xf54e('0x45')]['length']?_0x465a0f[_0xf54e('0x45')]:_0x400ee0['model'];if(_0x3ce832[_0xf54e('0x41')]['includeAll']){_0x465a0f[_0xf54e('0x56')]=[{'all':!![]}];}_0x465a0f=_[_0xf54e('0x4d')]({},_0x465a0f,_0x3ce832[_0xf54e('0x50')]);return db[_0xf54e('0x3b')][_0xf54e('0x57')](_0x465a0f)[_0xf54e('0x33')](handleEntityNotFound(_0x54ac1a,null))['then'](function(_0x479572){if(_0x479572){var _0x79345=_0x479572[_0xf54e('0x58')]({'plain':!![]});_0x79345=qs['omit'](_0x79345,['id','createdAt',_0xf54e('0x59')]);_0x3ce832['body']=_[_0xf54e('0x5a')](_0x3ce832[_0xf54e('0x5b')],['id',_0xf54e('0x5c'),_0xf54e('0x59')]);return db[_0xf54e('0x3b')][_0xf54e('0x5d')](_[_0xf54e('0x4d')](_0x79345,_0x3ce832[_0xf54e('0x5b')]),{'include':_0x3ce832[_0xf54e('0x41')][_0xf54e('0x51')]?[{'all':!![]}]:undefined})[_0xf54e('0x33')](function(_0x2c6d0e){var _0x65bdf2=_0x3ce832[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x65bdf2)throw new Error(_0xf54e('0x5f'));if(_0x65bdf2[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x11908b=_0x2c6d0e[_0xf54e('0x58')]({'plain':!![]});var _0x494629=_0xf54e('0x35');return db[_0xf54e('0x61')]['find']({'where':{'name':_0x494629,'userProfileId':_0x65bdf2['userProfileId']},'raw':!![]})[_0xf54e('0x33')](function(_0x4b4a2f){if(_0x4b4a2f&&_0x4b4a2f[_0xf54e('0x62')]===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x11908b[_0xf54e('0x37')],'resourceId':_0x11908b['id'],'type':_0x4b4a2f['name'],'sectionId':_0x4b4a2f['id']},{})[_0xf54e('0x33')](function(){return _0x2c6d0e;});}else{return _0x2c6d0e;}})['catch'](function(_0x3800d4){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x3800d4);throw _0x3800d4;});}return _0x2c6d0e;});}})['then'](respondWithResult(_0x54ac1a,0xc9))[_0xf54e('0x24')](handleError(_0x54ac1a,null));};exports['create']=function(_0x3f7224,_0x3e2101,_0x5500d7){var _0x380b4f;return db['Trunk'][_0xf54e('0x5d')](_0x3f7224[_0xf54e('0x5b')],{'raw':!![]})[_0xf54e('0x33')](function(_0x38405c){_0x380b4f=_0x38405c;return db[_0xf54e('0x3b')]['findAll']({'raw':!![]});})[_0xf54e('0x33')](function(_0x1d18d3){var _0x57db6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x309895=fs['readFileSync'](path[_0xf54e('0x65')](config['root'],_0xf54e('0x68')),_0xf54e('0x67'));var _0x5e45e7=ejs[_0xf54e('0x69')](_0x57db6f,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x5e45e7);if(_0x380b4f[_0xf54e('0x6c')]){var _0x38bf71=ejs[_0xf54e('0x69')](_0x309895,{'trunks':_0x1d18d3||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x38bf71);}})[_0xf54e('0x33')](function(){return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x5d'),{'module':'chan_sip.so'});})[_0xf54e('0x33')](function(){var _0x2c20b5=_0x3f7224[_0xf54e('0x5e')]['get']({'plain':!![]});if(!_0x2c20b5)throw new Error(_0xf54e('0x5f'));if(_0x2c20b5[_0xf54e('0x60')]===_0xf54e('0x5e')){var _0x13db3e=_0x380b4f[_0xf54e('0x58')]({'plain':!![]});return db[_0xf54e('0x61')][_0xf54e('0x57')]({'where':{'name':'Trunks','userProfileId':_0x2c20b5[_0xf54e('0x6f')]},'raw':!![]})[_0xf54e('0x33')](function(_0x261c39){if(_0x261c39&&_0x261c39['autoAssociation']===0x0){return db[_0xf54e('0x36')][_0xf54e('0x5d')]({'name':_0x13db3e[_0xf54e('0x37')],'resourceId':_0x13db3e['id'],'type':_0x261c39[_0xf54e('0x37')],'sectionId':_0x261c39['id']},{})['then'](function(){return _0x380b4f;});}else{return _0x380b4f;}})['catch'](function(_0x25d05e){logger[_0xf54e('0x20')](_0xf54e('0x63'),_0x25d05e);throw _0x25d05e;});}return _0x380b4f;})[_0xf54e('0x33')](respondWithResult(_0x3e2101,0xc9))[_0xf54e('0x24')](handleError(_0x3e2101,null));};exports[_0xf54e('0x32')]=function(_0x35b5a4,_0x3b2a3e,_0xf5108b){var _0x205b47;return db['Trunk'][_0xf54e('0x57')]({'where':{'id':_0x35b5a4[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x3b2a3e,null))[_0xf54e('0x33')](saveUpdates(_0x35b5a4['body'],null))[_0xf54e('0x33')](function(_0x1de6dd){if(_0x1de6dd){_0x205b47=_0x1de6dd;return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});}})['then'](function(_0x394862){if(_0x394862){var _0x4876b5=fs[_0xf54e('0x64')](path['join'](config['root'],_0xf54e('0x66')),_0xf54e('0x67'));var _0x1e2834=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config[_0xf54e('0x70')],_0xf54e('0x68')),_0xf54e('0x67'));var _0x8093bc=ejs['render'](_0x4876b5,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6b'),_0x8093bc);var _0x4ce10=ejs[_0xf54e('0x69')](_0x1e2834,{'trunks':_0x394862||[]});fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x4ce10);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x32'),{'module':_0xf54e('0x71')});}return null;})[_0xf54e('0x33')](function(_0x11dec2){if(_0x11dec2){return _0x205b47;}})[_0xf54e('0x33')](respondWithResult(_0x3b2a3e,null))['catch'](handleError(_0x3b2a3e,null));};exports[_0xf54e('0x34')]=function(_0x1cfa09,_0x59acbc,_0x4a0614){var _0x85b108;return db[_0xf54e('0x3b')][_0xf54e('0x57')]({'where':{'id':_0x1cfa09[_0xf54e('0x55')]['id']}})[_0xf54e('0x33')](handleEntityNotFound(_0x59acbc,null))[_0xf54e('0x33')](removeEntity(_0x59acbc,null))[_0xf54e('0x33')](function(){return db[_0xf54e('0x3b')][_0xf54e('0x52')]({'raw':!![]});})['then'](function(_0x2bb31f){var _0x3c222a=fs[_0xf54e('0x64')](path['join'](config[_0xf54e('0x70')],'server/files/templates/trunk.ejs'),_0xf54e('0x67'));var _0x57bc6f=fs[_0xf54e('0x64')](path[_0xf54e('0x65')](config['root'],'server/files/templates/registry.ejs'),_0xf54e('0x67'));var _0x632240=ejs[_0xf54e('0x69')](_0x3c222a,{'trunks':_0x2bb31f});var _0x406261=ejs[_0xf54e('0x69')](_0x57bc6f,{'trunks':_0x2bb31f});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x632240);fs[_0xf54e('0x6a')](_0xf54e('0x6d'),_0x406261);return respondWithRpcPromise(_0xf54e('0x6e'),_0xf54e('0x34'),{'module':_0xf54e('0x71')});})[_0xf54e('0x24')](handleError(_0x59acbc,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x1f27a1,_0x5ef229){var _0x41bf42=function(_0x2e2822){while(--_0x2e2822){_0x1f27a1['push'](_0x1f27a1['shift']());}};_0x41bf42(++_0x5ef229);}(_0xe14d,0x1ee));var _0xde14=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xe14d[_0x3635ce];return _0x97ecd0;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 18ad4ba..1690141 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 _0x3f8a=['Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','./trunk.attributes','exports','define'];(function(_0x1c2b80,_0x2e61e6){var _0x46f872=function(_0x259f00){while(--_0x259f00){_0x1c2b80['push'](_0x1c2b80['shift']());}};_0x46f872(++_0x2e61e6);}(_0x3f8a,0xb2));var _0xa3f8=function(_0x584f75,_0x1c5be1){_0x584f75=_0x584f75-0x0;var _0x183456=_0x3f8a[_0x584f75];return _0x183456;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require('../../config/logger')(_0xa3f8('0x2'));var moment=require(_0xa3f8('0x3'));var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa3f8('0x6'));module[_0xa3f8('0x7')]=function(_0x4b34b7,_0xc170b2){return _0x4b34b7[_0xa3f8('0x8')](_0xa3f8('0x9'),attributes,{'tableName':_0xa3f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e5f=['./trunk.attributes','exports','Trunk','tools_trunks','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x430c5f,_0x7a1340){var _0x1175f5=function(_0x47d0cd){while(--_0x47d0cd){_0x430c5f['push'](_0x430c5f['shift']());}};_0x1175f5(++_0x7a1340);}(_0x9e5f,0x187));var _0xf9e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf9e5('0x0'));var util=require('util');var logger=require(_0xf9e5('0x1'))(_0xf9e5('0x2'));var moment=require('moment');var BPromise=require(_0xf9e5('0x3'));var rp=require(_0xf9e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf9e5('0x5'));module[_0xf9e5('0x6')]=function(_0x2f4de6,_0x2ed1c3){return _0x2f4de6['define'](_0xf9e5('0x7'),attributes,{'tableName':_0xf9e5('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 d9b5c0c..798321e 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 _0x6b68=['../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','Trunk','findAll','options','raw','attributes','limit','include','map','model','GetTrunk','stringify','where','then','ShowTrunk','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27967e,_0x22b26a){var _0xf96f79=function(_0x137da1){while(--_0x137da1){_0x27967e['push'](_0x27967e['shift']());}};_0xf96f79(++_0x22b26a);}(_0x6b68,0x111));var _0x86b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x86b6('0x0'));var moment=require(_0x86b6('0x1'));var BPromise=require('bluebird');var rs=require(_0x86b6('0x2'));var fs=require('fs');var Redis=require(_0x86b6('0x3'));var db=require(_0x86b6('0x4'))['db'];var utils=require(_0x86b6('0x5'));var logger=require(_0x86b6('0x6'))('rpc');var config=require(_0x86b6('0x7'));var jayson=require(_0x86b6('0x8'));var client=jayson['client'][_0x86b6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x457d10,_0x3f133b,_0x197edd){return new BPromise(function(_0x1fe4ef,_0x3fbb95){return client[_0x86b6('0xa')](_0x457d10,_0x197edd)['then'](function(_0x2a9472){logger[_0x86b6('0xb')](_0x86b6('0xc'),_0x3f133b,'request\x20sent');logger[_0x86b6('0xd')](_0x86b6('0xe'),_0x3f133b,_0x86b6('0xf'),JSON['stringify'](_0x2a9472));if(_0x2a9472['error']){if(_0x2a9472[_0x86b6('0x10')][_0x86b6('0x11')]===0x1f4){logger['error'](_0x86b6('0xc'),_0x3f133b,_0x2a9472[_0x86b6('0x10')]['message']);return _0x3fbb95(_0x2a9472[_0x86b6('0x10')]['message']);}logger[_0x86b6('0x10')](_0x86b6('0xc'),_0x3f133b,_0x2a9472['error'][_0x86b6('0x12')]);return _0x1fe4ef(_0x2a9472[_0x86b6('0x10')][_0x86b6('0x12')]);}else{logger[_0x86b6('0xb')](_0x86b6('0xc'),_0x3f133b,'request\x20sent');_0x1fe4ef(_0x2a9472[_0x86b6('0x13')][_0x86b6('0x12')]);}})[_0x86b6('0x14')](function(_0x526845){logger['error'](_0x86b6('0xc'),_0x3f133b,_0x526845);_0x3fbb95(_0x526845);});});}exports['GetTrunk']=function(_0x2231a2){var _0x3ce3a7=this;return new Promise(function(_0x6b6285,_0xcc4cff){return db[_0x86b6('0x15')][_0x86b6('0x16')]({'raw':_0x2231a2[_0x86b6('0x17')]?_0x2231a2[_0x86b6('0x17')][_0x86b6('0x18')]===undefined?!![]:![]:!![],'where':_0x2231a2['options']?_0x2231a2[_0x86b6('0x17')]['where']||null:null,'attributes':_0x2231a2[_0x86b6('0x17')]?_0x2231a2[_0x86b6('0x17')][_0x86b6('0x19')]||null:null,'limit':_0x2231a2['options']?_0x2231a2[_0x86b6('0x17')][_0x86b6('0x1a')]||null:null,'include':_0x2231a2[_0x86b6('0x17')]?_0x2231a2[_0x86b6('0x17')][_0x86b6('0x1b')]?_[_0x86b6('0x1c')](_0x2231a2[_0x86b6('0x17')][_0x86b6('0x1b')],function(_0x3900c6){return{'model':db[_0x3900c6[_0x86b6('0x1d')]],'as':_0x3900c6['as'],'attributes':_0x3900c6[_0x86b6('0x19')],'include':_0x3900c6['include']?_[_0x86b6('0x1c')](_0x3900c6[_0x86b6('0x1b')],function(_0x46d075){return{'model':db[_0x46d075[_0x86b6('0x1d')]],'as':_0x46d075['as'],'attributes':_0x46d075[_0x86b6('0x19')],'include':_0x46d075[_0x86b6('0x1b')]?_[_0x86b6('0x1c')](_0x46d075[_0x86b6('0x1b')],function(_0x1a1d99){return{'model':db[_0x1a1d99[_0x86b6('0x1d')]],'as':_0x1a1d99['as'],'attributes':_0x1a1d99['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c190a){logger['info']('GetTrunk',_0x2231a2);logger[_0x86b6('0xd')](_0x86b6('0x1e'),_0x2231a2,JSON[_0x86b6('0x1f')](_0x1c190a));_0x6b6285(_0x1c190a);})[_0x86b6('0x14')](function(_0x45dd92){logger[_0x86b6('0x10')](_0x86b6('0x1e'),_0x45dd92[_0x86b6('0x12')],_0x2231a2);_0xcc4cff(_0x3ce3a7['error'](0x1f4,_0x45dd92[_0x86b6('0x12')]));});});};exports['ShowTrunk']=function(_0x4516df){var _0xf7b624=this;return new Promise(function(_0x15ce4c,_0x1ebc05){return db[_0x86b6('0x15')]['find']({'raw':_0x4516df['options']?_0x4516df[_0x86b6('0x17')][_0x86b6('0x18')]===undefined?!![]:![]:!![],'where':_0x4516df['options']?_0x4516df[_0x86b6('0x17')][_0x86b6('0x20')]||null:null,'attributes':_0x4516df[_0x86b6('0x17')]?_0x4516df[_0x86b6('0x17')][_0x86b6('0x19')]||null:null,'include':_0x4516df[_0x86b6('0x17')]?_0x4516df[_0x86b6('0x17')]['include']?_['map'](_0x4516df['options'][_0x86b6('0x1b')],function(_0x2fe8ae){return{'model':db[_0x2fe8ae[_0x86b6('0x1d')]],'as':_0x2fe8ae['as'],'attributes':_0x2fe8ae['attributes'],'include':_0x2fe8ae[_0x86b6('0x1b')]?_[_0x86b6('0x1c')](_0x2fe8ae[_0x86b6('0x1b')],function(_0x27f6d1){return{'model':db[_0x27f6d1[_0x86b6('0x1d')]],'as':_0x27f6d1['as'],'attributes':_0x27f6d1[_0x86b6('0x19')],'include':_0x27f6d1[_0x86b6('0x1b')]?_[_0x86b6('0x1c')](_0x27f6d1[_0x86b6('0x1b')],function(_0x11417d){return{'model':db[_0x11417d['model']],'as':_0x11417d['as'],'attributes':_0x11417d['attributes']};}):[]};}):[]};}):[]:[]})[_0x86b6('0x21')](function(_0x2a8610){logger['info'](_0x86b6('0x22'),_0x4516df);logger['debug'](_0x86b6('0x22'),_0x4516df,JSON[_0x86b6('0x1f')](_0x2a8610));_0x15ce4c(_0x2a8610);})[_0x86b6('0x14')](function(_0x5b357d){logger[_0x86b6('0x10')](_0x86b6('0x22'),_0x5b357d[_0x86b6('0x12')],_0x4516df);_0x1ebc05(_0xf7b624[_0x86b6('0x10')](0x1f4,_0x5b357d[_0x86b6('0x12')]));});});}; \ No newline at end of file +var _0xba79=['error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug'];(function(_0x51a220,_0x516382){var _0x4aa255=function(_0x2610bb){while(--_0x2610bb){_0x51a220['push'](_0x51a220['shift']());}};_0x4aa255(++_0x516382);}(_0xba79,0x1da));var _0x9ba7=function(_0x2f5ee4,_0x584180){_0x2f5ee4=_0x2f5ee4-0x0;var _0x4ec263=_0xba79[_0x2f5ee4];return _0x4ec263;};'use strict';var _=require(_0x9ba7('0x0'));var util=require(_0x9ba7('0x1'));var moment=require(_0x9ba7('0x2'));var BPromise=require(_0x9ba7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ba7('0x4'));var db=require(_0x9ba7('0x5'))['db'];var utils=require(_0x9ba7('0x6'));var logger=require(_0x9ba7('0x7'))('rpc');var config=require(_0x9ba7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ba7('0x9')][_0x9ba7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f67ff,_0x69c309,_0x6bf390){return new BPromise(function(_0x14b309,_0x8f971e){return client[_0x9ba7('0xb')](_0x4f67ff,_0x6bf390)[_0x9ba7('0xc')](function(_0x1689a0){logger[_0x9ba7('0xd')]('Trunk,\x20%s,\x20%s',_0x69c309,_0x9ba7('0xe'));logger[_0x9ba7('0xf')]('Trunk,\x20%s,\x20%s,\x20%s',_0x69c309,'request\x20sent',JSON['stringify'](_0x1689a0));if(_0x1689a0[_0x9ba7('0x10')]){if(_0x1689a0[_0x9ba7('0x10')]['code']===0x1f4){logger['error'](_0x9ba7('0x11'),_0x69c309,_0x1689a0[_0x9ba7('0x10')][_0x9ba7('0x12')]);return _0x8f971e(_0x1689a0[_0x9ba7('0x10')]['message']);}logger['error'](_0x9ba7('0x11'),_0x69c309,_0x1689a0[_0x9ba7('0x10')][_0x9ba7('0x12')]);return _0x14b309(_0x1689a0[_0x9ba7('0x10')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x69c309,_0x9ba7('0xe'));_0x14b309(_0x1689a0[_0x9ba7('0x13')][_0x9ba7('0x12')]);}})[_0x9ba7('0x14')](function(_0x40307e){logger[_0x9ba7('0x10')](_0x9ba7('0x11'),_0x69c309,_0x40307e);_0x8f971e(_0x40307e);});});}exports[_0x9ba7('0x15')]=function(_0x476c25){var _0x169750=this;return new Promise(function(_0x4513f5,_0x169fdb){return db[_0x9ba7('0x16')][_0x9ba7('0x17')]({'raw':_0x476c25[_0x9ba7('0x18')]?_0x476c25[_0x9ba7('0x18')][_0x9ba7('0x19')]===undefined?!![]:![]:!![],'where':_0x476c25[_0x9ba7('0x18')]?_0x476c25['options'][_0x9ba7('0x1a')]||null:null,'attributes':_0x476c25[_0x9ba7('0x18')]?_0x476c25[_0x9ba7('0x18')][_0x9ba7('0x1b')]||null:null,'limit':_0x476c25[_0x9ba7('0x18')]?_0x476c25[_0x9ba7('0x18')][_0x9ba7('0x1c')]||null:null,'include':_0x476c25[_0x9ba7('0x18')]?_0x476c25[_0x9ba7('0x18')][_0x9ba7('0x1d')]?_[_0x9ba7('0x1e')](_0x476c25[_0x9ba7('0x18')][_0x9ba7('0x1d')],function(_0x4a6c00){return{'model':db[_0x4a6c00[_0x9ba7('0x1f')]],'as':_0x4a6c00['as'],'attributes':_0x4a6c00[_0x9ba7('0x1b')],'include':_0x4a6c00[_0x9ba7('0x1d')]?_['map'](_0x4a6c00[_0x9ba7('0x1d')],function(_0x58bee6){return{'model':db[_0x58bee6[_0x9ba7('0x1f')]],'as':_0x58bee6['as'],'attributes':_0x58bee6[_0x9ba7('0x1b')],'include':_0x58bee6[_0x9ba7('0x1d')]?_[_0x9ba7('0x1e')](_0x58bee6['include'],function(_0x13f40f){return{'model':db[_0x13f40f[_0x9ba7('0x1f')]],'as':_0x13f40f['as'],'attributes':_0x13f40f[_0x9ba7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9ba7('0xc')](function(_0x1835de){logger[_0x9ba7('0xd')]('GetTrunk',_0x476c25);logger[_0x9ba7('0xf')](_0x9ba7('0x15'),_0x476c25,JSON['stringify'](_0x1835de));_0x4513f5(_0x1835de);})['catch'](function(_0x1f3d5b){logger[_0x9ba7('0x10')](_0x9ba7('0x15'),_0x1f3d5b[_0x9ba7('0x12')],_0x476c25);_0x169fdb(_0x169750[_0x9ba7('0x10')](0x1f4,_0x1f3d5b['message']));});});};exports[_0x9ba7('0x20')]=function(_0x39a846){var _0x33276c=this;return new Promise(function(_0x34a160,_0x1b5c1c){return db[_0x9ba7('0x16')][_0x9ba7('0x21')]({'raw':_0x39a846[_0x9ba7('0x18')]?_0x39a846[_0x9ba7('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x39a846['options']?_0x39a846['options'][_0x9ba7('0x1a')]||null:null,'attributes':_0x39a846[_0x9ba7('0x18')]?_0x39a846[_0x9ba7('0x18')]['attributes']||null:null,'include':_0x39a846[_0x9ba7('0x18')]?_0x39a846['options'][_0x9ba7('0x1d')]?_[_0x9ba7('0x1e')](_0x39a846['options'][_0x9ba7('0x1d')],function(_0x3edfa9){return{'model':db[_0x3edfa9['model']],'as':_0x3edfa9['as'],'attributes':_0x3edfa9[_0x9ba7('0x1b')],'include':_0x3edfa9[_0x9ba7('0x1d')]?_[_0x9ba7('0x1e')](_0x3edfa9['include'],function(_0x5577f7){return{'model':db[_0x5577f7[_0x9ba7('0x1f')]],'as':_0x5577f7['as'],'attributes':_0x5577f7[_0x9ba7('0x1b')],'include':_0x5577f7[_0x9ba7('0x1d')]?_[_0x9ba7('0x1e')](_0x5577f7['include'],function(_0x196d4b){return{'model':db[_0x196d4b[_0x9ba7('0x1f')]],'as':_0x196d4b['as'],'attributes':_0x196d4b[_0x9ba7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x9ba7('0xc')](function(_0x418758){logger['info'](_0x9ba7('0x20'),_0x39a846);logger['debug']('ShowTrunk',_0x39a846,JSON[_0x9ba7('0x22')](_0x418758));_0x34a160(_0x418758);})[_0x9ba7('0x14')](function(_0x3c0199){logger[_0x9ba7('0x10')](_0x9ba7('0x20'),_0x3c0199[_0x9ba7('0x12')],_0x39a846);_0x1b5c1c(_0x33276c[_0x9ba7('0x10')](0x1f4,_0x3c0199[_0x9ba7('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index a7d8ff9..9d227fe 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 _0xa5a1=['exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x105d2e,_0xefc0f9){var _0x44969d=function(_0x2fca67){while(--_0x2fca67){_0x105d2e['push'](_0x105d2e['shift']());}};_0x44969d(++_0xefc0f9);}(_0xa5a1,0xf1));var _0x1a5a=function(_0x4fe0f2,_0x5dbc89){_0x4fe0f2=_0x4fe0f2-0x0;var _0x982e06=_0xa5a1[_0x4fe0f2];return _0x982e06;};'use strict';var express=require(_0x1a5a('0x0'));var router=express[_0x1a5a('0x1')]();var auth=require(_0x1a5a('0x2'));var controller=require(_0x1a5a('0x3'));router['put'](_0x1a5a('0x4'),auth[_0x1a5a('0x5')](),controller[_0x1a5a('0x6')]);module[_0x1a5a('0x7')]=router; \ No newline at end of file +var _0x2cc6=['../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x5cdbab,_0x219ba0){var _0x5b1ea6=function(_0x232399){while(--_0x232399){_0x5cdbab['push'](_0x5cdbab['shift']());}};_0x5b1ea6(++_0x219ba0);}(_0x2cc6,0x1c8));var _0x62cc=function(_0xfe4a8d,_0x33d75d){_0xfe4a8d=_0xfe4a8d-0x0;var _0x1bf633=_0x2cc6[_0xfe4a8d];return _0x1bf633;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x62cc('0x0'));var controller=require(_0x62cc('0x1'));router[_0x62cc('0x2')](_0x62cc('0x3'),auth[_0x62cc('0x4')](),controller[_0x62cc('0x5')]);module['exports']=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 d897a4a..fa6cf66 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 _0xdb0e=['ENUM','BOOLEAN','DATE','INTEGER','UserId','sequelize','error','warning','exports'];(function(_0x3ac83e,_0x9032a6){var _0x3b0e4e=function(_0xee57aa){while(--_0xee57aa){_0x3ac83e['push'](_0x3ac83e['shift']());}};_0x3b0e4e(++_0x9032a6);}(_0xdb0e,0x1f4));var _0xedb0=function(_0x2ecb67,_0x8ec62d){_0x2ecb67=_0x2ecb67-0x0;var _0x168079=_0xdb0e[_0x2ecb67];return _0x168079;};'use strict';var Sequelize=require(_0xedb0('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xedb0('0x1'),_0xedb0('0x2'),'info','debug'];module[_0xedb0('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xedb0('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xedb0('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xedb0('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xedb0('0x6')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xedb0('0x7')],'unique':_0xedb0('0x8')}}; \ No newline at end of file +var _0x0187=['DATE','INTEGER','UserId','error','info','debug','exports','ENUM','BOOLEAN','TEXT'];(function(_0x4a1cbf,_0x326249){var _0x5ae40e=function(_0x7e4851){while(--_0x7e4851){_0x4a1cbf['push'](_0x4a1cbf['shift']());}};_0x5ae40e(++_0x326249);}(_0x0187,0x71));var _0x7018=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x0187[_0x53bcc3];return _0x47c959;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0x7018('0x0'),'warning',_0x7018('0x1'),_0x7018('0x2')];module[_0x7018('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x7018('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x7018('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x7018('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x7018('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x7018('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x7018('0x8')],'unique':_0x7018('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index f90d552..dcc7445 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 _0xce9b=['body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','defaults','localhost','json','update','then','sendStatus','error','stack','name','status','send','user','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xce9b,0xc6));var _0xbce9=function(_0x3ce8fe,_0x5c6753){_0x3ce8fe=_0x3ce8fe-0x0;var _0x22f508=_0xce9b[_0x3ce8fe];return _0x22f508;};'use strict';var _=require(_0xbce9('0x0'));var Redis=require(_0xbce9('0x1'));var logger=require(_0xbce9('0x2'))(_0xbce9('0x3'));var config=require(_0xbce9('0x4'));var db=require(_0xbce9('0x5'))['db'];var socket=require(_0xbce9('0x6'))(new Redis(config[_0xbce9('0x7')]));require('./user-setting.socket')[_0xbce9('0x8')](socket);config[_0xbce9('0x7')]=_[_0xbce9('0x9')](config[_0xbce9('0x7')],{'host':_0xbce9('0xa'),'port':0x18eb});function respondWithResult(_0x2c336a,_0x10a645){_0x10a645=_0x10a645||0xc8;return function(_0x562634){if(_0x562634){return _0x2c336a['status'](_0x10a645)[_0xbce9('0xb')](_0x562634);}};}function saveUpdates(_0x1d9a99){return function(_0x5a5542){if(_0x5a5542){return _0x5a5542[_0xbce9('0xc')](_0x1d9a99)[_0xbce9('0xd')](function(_0x572128){return _0x572128;});}return null;};}function handleEntityNotFound(_0x5b766a){return function(_0x2073ea){if(!_0x2073ea){_0x5b766a[_0xbce9('0xe')](0x194);}return _0x2073ea;};}function handleError(_0x1b980c,_0x4dc9a9){_0x4dc9a9=_0x4dc9a9||0x1f4;return function(_0x48a272){logger[_0xbce9('0xf')](_0x48a272[_0xbce9('0x10')]);if(_0x48a272[_0xbce9('0x11')]){delete _0x48a272[_0xbce9('0x11')];}_0x1b980c[_0xbce9('0x12')](_0x4dc9a9)[_0xbce9('0x13')](_0x48a272);};}exports[_0xbce9('0xc')]=function(_0x540886,_0xa6903c){if(_0x540886[_0xbce9('0x14')]['role']!==_0xbce9('0x15'))throw new Error(_0xbce9('0x16'));if(isNaN(Number(_0x540886[_0xbce9('0x17')]['id'])))throw new Error(_0xbce9('0x18'));return db[_0xbce9('0x19')]['find']({'where':{'id':_0x540886[_0xbce9('0x17')]['id']}})[_0xbce9('0xd')](handleEntityNotFound(_0xa6903c,null))[_0xbce9('0xd')](saveUpdates(_0x540886[_0xbce9('0x1a')],null))[_0xbce9('0xd')](respondWithResult(_0xa6903c,null))[_0xbce9('0x1b')](handleError(_0xa6903c,null));}; \ No newline at end of file +var _0xcf95=['catch','lodash','ioredis','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','status','json','update','then','error','name','send','user','admin','Unauthorized','params','body'];(function(_0x119629,_0x246787){var _0x49a771=function(_0x23624c){while(--_0x23624c){_0x119629['push'](_0x119629['shift']());}};_0x49a771(++_0x246787);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5cf9('0x0'));var Redis=require(_0x5cf9('0x1'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5cf9('0x2'))['db'];var socket=require(_0x5cf9('0x3'))(new Redis(config[_0x5cf9('0x4')]));require(_0x5cf9('0x5'))['register'](socket);config[_0x5cf9('0x4')]=_[_0x5cf9('0x6')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x1c0c3a,_0x2d24df){_0x2d24df=_0x2d24df||0xc8;return function(_0x51acd7){if(_0x51acd7){return _0x1c0c3a[_0x5cf9('0x7')](_0x2d24df)[_0x5cf9('0x8')](_0x51acd7);}};}function saveUpdates(_0x23c40e){return function(_0x34c019){if(_0x34c019){return _0x34c019[_0x5cf9('0x9')](_0x23c40e)[_0x5cf9('0xa')](function(_0x20ebed){return _0x20ebed;});}return null;};}function handleEntityNotFound(_0x3d3481){return function(_0x364263){if(!_0x364263){_0x3d3481['sendStatus'](0x194);}return _0x364263;};}function handleError(_0x2aaf4f,_0x29fbff){_0x29fbff=_0x29fbff||0x1f4;return function(_0x39c2b9){logger[_0x5cf9('0xb')](_0x39c2b9['stack']);if(_0x39c2b9[_0x5cf9('0xc')]){delete _0x39c2b9[_0x5cf9('0xc')];}_0x2aaf4f[_0x5cf9('0x7')](_0x29fbff)[_0x5cf9('0xd')](_0x39c2b9);};}exports[_0x5cf9('0x9')]=function(_0x3d4758,_0xda5539){if(_0x3d4758[_0x5cf9('0xe')]['role']!==_0x5cf9('0xf'))throw new Error(_0x5cf9('0x10'));if(isNaN(Number(_0x3d4758['params']['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting']['find']({'where':{'id':_0x3d4758[_0x5cf9('0x11')]['id']}})[_0x5cf9('0xa')](handleEntityNotFound(_0xda5539,null))[_0x5cf9('0xa')](saveUpdates(_0x3d4758[_0x5cf9('0x12')],null))['then'](respondWithResult(_0xda5539,null))[_0x5cf9('0x13')](handleError(_0xda5539,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 850521e..b9899df 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 _0xebc5=['update','remove','emit','hasOwnProperty','exports','events','UserSetting','setMaxListeners','save'];(function(_0x59400c,_0x364897){var _0x51508d=function(_0x1f7682){while(--_0x1f7682){_0x59400c['push'](_0x59400c['shift']());}};_0x51508d(++_0x364897);}(_0xebc5,0x1f4));var _0x5ebc=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xebc5[_0x543084];return _0x306a57;};'use strict';var EventEmitter=require(_0x5ebc('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x5ebc('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x5ebc('0x2')](0x0);var events={'afterCreate':_0x5ebc('0x3'),'afterUpdate':_0x5ebc('0x4'),'afterDestroy':_0x5ebc('0x5')};function emitEvent(_0x43e9eb){return function(_0x33a276,_0x3e3b1c,_0x375de5){UserSettingEvents[_0x5ebc('0x6')](_0x43e9eb+':'+_0x33a276['id'],_0x33a276);UserSettingEvents[_0x5ebc('0x6')](_0x43e9eb,_0x33a276);_0x375de5(null);};}for(var e in events){if(events[_0x5ebc('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module[_0x5ebc('0x8')]=UserSettingEvents; \ No newline at end of file +var _0x3318=['update','remove','emit','hasOwnProperty','hook','setMaxListeners'];(function(_0x45bd84,_0x4a61bb){var _0x551b62=function(_0x3b03cf){while(--_0x3b03cf){_0x45bd84['push'](_0x45bd84['shift']());}};_0x551b62(++_0x4a61bb);}(_0x3318,0xbf));var _0x8331=function(_0xe7400f,_0x573b7d){_0xe7400f=_0xe7400f-0x0;var _0x2990f7=_0x3318[_0xe7400f];return _0x2990f7;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x8331('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8331('0x1'),'afterDestroy':_0x8331('0x2')};function emitEvent(_0xe9155c){return function(_0x1b96ee,_0x586739,_0x2e3d1d){UserSettingEvents[_0x8331('0x3')](_0xe9155c+':'+_0x1b96ee['id'],_0x1b96ee);UserSettingEvents[_0x8331('0x3')](_0xe9155c,_0x1b96ee);_0x2e3d1d(null);};}for(var e in events){if(events[_0x8331('0x4')](e)){var event=events[e];UserSetting[_0x8331('0x5')](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 f126352..61cb88c 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 _0xfc75=['UserSetting','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x1eba74,_0x21609f){var _0x537bfa=function(_0x2f8e43){while(--_0x2f8e43){_0x1eba74['push'](_0x1eba74['shift']());}};_0x537bfa(++_0x21609f);}(_0xfc75,0xe1));var _0x5fc7=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfc75[_0x17d9e3];return _0x14192d;};'use strict';var attributes=require(_0x5fc7('0x0'));module[_0x5fc7('0x1')]=function(_0x3d2426){return _0x3d2426[_0x5fc7('0x2')](_0x5fc7('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55314c){if(!_0x55314c[_0x5fc7('0x4')])_0x55314c['clientSideLoggingEnabledSince']=null;else if(_0x55314c[_0x5fc7('0x5')]===null)_0x55314c[_0x5fc7('0x5')]=new Date();}}});}; \ No newline at end of file +var _0x2c54=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x4e5960,_0x5c1bf0){var _0x38cf9a=function(_0x1c99a4){while(--_0x1c99a4){_0x4e5960['push'](_0x4e5960['shift']());}};_0x38cf9a(++_0x5c1bf0);}(_0x2c54,0x136));var _0x42c5=function(_0x4a9898,_0x4eee11){_0x4a9898=_0x4a9898-0x0;var _0xf788f=_0x2c54[_0x4a9898];return _0xf788f;};'use strict';var attributes=require(_0x42c5('0x0'));module[_0x42c5('0x1')]=function(_0x2dcfde){return _0x2dcfde['define'](_0x42c5('0x2'),attributes,{'tableName':_0x42c5('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d5e1d){if(!_0x3d5e1d[_0x42c5('0x4')])_0x3d5e1d[_0x42c5('0x5')]=null;else if(_0x3d5e1d[_0x42c5('0x5')]===null)_0x3d5e1d['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 52ba2ae..f1ddbdd 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 _0xbf5a=['UserId','register','length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x500994,_0x1b11a0){var _0x29fb2a=function(_0x53c72f){while(--_0x53c72f){_0x500994['push'](_0x500994['shift']());}};_0x29fb2a(++_0x1b11a0);}(_0xbf5a,0x16c));var _0xabf5=function(_0x50b213,_0x2460af){_0x50b213=_0x50b213-0x0;var _0x43eb40=_0xbf5a[_0x50b213];return _0x43eb40;};'use strict';var UserSettingEvents=require(_0xabf5('0x0'));var events=['save',_0xabf5('0x1'),_0xabf5('0x2')];function createListener(_0x141b0c,_0x39f536){return function(_0x31a2d){_0x39f536[_0xabf5('0x3')](_0x141b0c,_0x31a2d);if(_0x141b0c===_0xabf5('0x4')){_0x39f536[_0xabf5('0x3')](_0xabf5('0x5')+_0x31a2d[_0xabf5('0x6')],_0x31a2d);}};}exports[_0xabf5('0x7')]=function(_0x4c46fc){for(var _0x32f17d=0x0,_0x1dfe7f=events[_0xabf5('0x8')];_0x32f17d<_0x1dfe7f;_0x32f17d++){var _0x12a821=events[_0x32f17d];var _0x15f970=createListener(_0xabf5('0x9')+_0x12a821,_0x4c46fc);UserSettingEvents['on'](_0x12a821,_0x15f970);}}; \ No newline at end of file +var _0xeb67=['register','length','user-setting:','./user-setting.events','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x29f4e2,_0x3efbd9){var _0x329bac=function(_0x504157){while(--_0x504157){_0x29f4e2['push'](_0x29f4e2['shift']());}};_0x329bac(++_0x3efbd9);}(_0xeb67,0x1b3));var _0x7eb6=function(_0x5f0e3a,_0x76f71f){_0x5f0e3a=_0x5f0e3a-0x0;var _0x257606=_0xeb67[_0x5f0e3a];return _0x257606;};'use strict';var UserSettingEvents=require(_0x7eb6('0x0'));var events=['save','remove',_0x7eb6('0x1')];function createListener(_0x90bf5e,_0x27a565){return function(_0x158719){_0x27a565[_0x7eb6('0x2')](_0x90bf5e,_0x158719);if(_0x90bf5e===_0x7eb6('0x3')){_0x27a565['emit'](_0x7eb6('0x4')+_0x158719['UserId'],_0x158719);}};}exports[_0x7eb6('0x5')]=function(_0x53132f){for(var _0x14de83=0x0,_0x1252ef=events[_0x7eb6('0x6')];_0x14de83<_0x1252ef;_0x14de83++){var _0x366713=events[_0x14de83];var _0x78a079=createListener(_0x7eb6('0x7')+_0x366713,_0x53132f);UserSettingEvents['on'](_0x366713,_0x78a079);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 97d985f..bd183f7 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 _0x0009=['root','server/files/images/','%s-%s','now','originalname','file','addAvatar','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','unpause','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','/:id/openchannel_accounts','addOpenchannelAccounts','addSmsAccounts','createApiKey','put','update','/:id/password','changePassword','delete','/:id/teams','removeTeams','destroy','/:id/chat_interactions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getTeams','/:id/lists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','bulkCreate','diskStorage','join'];(function(_0x52fe2d,_0x227427){var _0xbe709a=function(_0x4f4100){while(--_0x4f4100){_0x52fe2d['push'](_0x52fe2d['shift']());}};_0xbe709a(++_0x227427);}(_0x0009,0x188));var _0x9000=function(_0x291f8b,_0x3b5591){_0x291f8b=_0x291f8b-0x0;var _0x275171=_0x0009[_0x291f8b];return _0x275171;};'use strict';var multer=require(_0x9000('0x0'));var util=require('util');var path=require(_0x9000('0x1'));var timeout=require(_0x9000('0x2'));var express=require(_0x9000('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9000('0x4'));var interaction=require(_0x9000('0x5'));var config=require(_0x9000('0x6'));var controller=require(_0x9000('0x7'));router[_0x9000('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9000('0x8')](_0x9000('0x9'),auth[_0x9000('0xa')](),controller[_0x9000('0xb')]);router[_0x9000('0x8')](_0x9000('0xc'),auth['isAuthenticated'](),controller[_0x9000('0xd')]);router[_0x9000('0x8')](_0x9000('0xe'),auth[_0x9000('0xa')](),controller[_0x9000('0xf')]);router[_0x9000('0x8')](_0x9000('0x10'),auth['isAuthenticated'](),controller['show']);router[_0x9000('0x8')](_0x9000('0x11'),controller[_0x9000('0x12')]);router[_0x9000('0x8')](_0x9000('0x13'),auth[_0x9000('0xa')](),controller[_0x9000('0x14')]);router['get'](_0x9000('0x15'),auth['isAuthenticated'](),controller[_0x9000('0x16')]);router[_0x9000('0x8')](_0x9000('0x17'),auth[_0x9000('0xa')](),controller[_0x9000('0x18')]);router[_0x9000('0x8')](_0x9000('0x19'),auth[_0x9000('0xa')](),controller['getVoiceQueuesRt']);router[_0x9000('0x8')](_0x9000('0x1a'),auth[_0x9000('0xa')](),controller['getGroups']);router['get'](_0x9000('0x1b'),auth[_0x9000('0xa')](),controller[_0x9000('0x1c')]);router['get'](_0x9000('0x1d'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x9000('0x8')]('/:id/chat/interactions',auth[_0x9000('0xa')](),controller[_0x9000('0x1e')]);router['get'](_0x9000('0x1f'),auth[_0x9000('0xa')](),controller[_0x9000('0x20')]);router['get'](_0x9000('0x21'),auth[_0x9000('0xa')](),controller[_0x9000('0x22')]);router['get']('/:id/sms/interactions',auth[_0x9000('0xa')](),controller[_0x9000('0x23')]);router[_0x9000('0x8')](_0x9000('0x24'),auth[_0x9000('0xa')](),controller[_0x9000('0x25')]);router[_0x9000('0x8')](_0x9000('0x26'),auth[_0x9000('0xa')](),controller['getWhatsappInteractions']);router['get']('/:id/teams',auth[_0x9000('0xa')](),controller[_0x9000('0x27')]);router[_0x9000('0x8')](_0x9000('0x28'),auth[_0x9000('0xa')](),controller['getLists']);router[_0x9000('0x8')](_0x9000('0x29'),auth[_0x9000('0xa')](),controller[_0x9000('0x2a')]);router['get'](_0x9000('0x2b'),auth[_0x9000('0xa')](),controller[_0x9000('0x2c')]);router['get'](_0x9000('0x2d'),auth[_0x9000('0xa')](),controller[_0x9000('0x2e')]);router[_0x9000('0x8')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x9000('0x2f')]);router[_0x9000('0x8')]('/:id/openchannel_accounts',auth[_0x9000('0xa')](),controller[_0x9000('0x30')]);router['get'](_0x9000('0x31'),auth[_0x9000('0xa')](),controller['getSmsAccounts']);router[_0x9000('0x8')](_0x9000('0x32'),auth['isAuthenticated'](),controller[_0x9000('0x33')]);router['get'](_0x9000('0x34'),auth['isAuthenticated'](),controller[_0x9000('0x35')]);router[_0x9000('0x8')]('/:id/scheduled_calls',auth[_0x9000('0xa')](),controller[_0x9000('0x36')]);router[_0x9000('0x8')](_0x9000('0x37'),auth[_0x9000('0xa')](),controller[_0x9000('0x38')]);router[_0x9000('0x39')](_0x9000('0x15'),auth[_0x9000('0xa')](),controller[_0x9000('0x3a')]);router[_0x9000('0x39')]('/',auth['isAuthenticated'](),controller[_0x9000('0x3b')]);router['post'](_0x9000('0x3c'),auth[_0x9000('0xa')](),controller[_0x9000('0x3d')]);router[_0x9000('0x39')]('/:id/queues',auth[_0x9000('0xa')](),controller['addQueues']);var upload=multer({'storage':multer[_0x9000('0x3e')]({'destination':function(_0x4b5988,_0x2d73bf,_0x1afc16){_0x1afc16(null,path[_0x9000('0x3f')](config[_0x9000('0x40')],_0x9000('0x41')));},'filename':function(_0x56ef77,_0x4426db,_0x298891){_0x298891(null,util['format'](_0x9000('0x42'),Date[_0x9000('0x43')](),_0x4426db[_0x9000('0x44')]));}})});router[_0x9000('0x39')]('/:id/avatar',upload['single'](_0x9000('0x45')),controller[_0x9000('0x46')]);router[_0x9000('0x39')](_0x9000('0x47'),auth[_0x9000('0xa')](),controller[_0x9000('0x48')]);router[_0x9000('0x39')](_0x9000('0x49'),auth[_0x9000('0xa')](),controller['logout']);router[_0x9000('0x39')](_0x9000('0x4a'),auth[_0x9000('0xa')](),controller[_0x9000('0x4b')]);router[_0x9000('0x39')](_0x9000('0x4c'),auth[_0x9000('0xa')](),controller[_0x9000('0x4d')]);router[_0x9000('0x39')]('/:id/teams',auth[_0x9000('0xa')](),controller['addTeams']);router[_0x9000('0x39')]('/:id/chat_interactions',auth['isAuthenticated'](),controller['addChatInteractions']);router[_0x9000('0x39')]('/:id/mail_interactions',auth[_0x9000('0xa')](),controller['addMailInteractions']);router[_0x9000('0x39')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x9000('0x4e')]);router[_0x9000('0x39')](_0x9000('0x4f'),auth[_0x9000('0xa')](),controller[_0x9000('0x50')]);router['post'](_0x9000('0x51'),auth['isAuthenticated'](),controller[_0x9000('0x52')]);router[_0x9000('0x39')](_0x9000('0x53'),auth[_0x9000('0xa')](),controller[_0x9000('0x54')]);router[_0x9000('0x39')]('/:id/fax_accounts',auth[_0x9000('0xa')](),controller[_0x9000('0x55')]);router[_0x9000('0x39')](_0x9000('0x56'),auth[_0x9000('0xa')](),controller[_0x9000('0x57')]);router[_0x9000('0x39')](_0x9000('0x58'),auth[_0x9000('0xa')](),controller[_0x9000('0x59')]);router[_0x9000('0x39')](_0x9000('0x31'),auth[_0x9000('0xa')](),controller[_0x9000('0x5a')]);router['post']('/:id/chat_websites',auth[_0x9000('0xa')](),controller['addChatWebsites']);router[_0x9000('0x39')](_0x9000('0x34'),auth[_0x9000('0xa')](),controller['addWhatsappAccounts']);router['post'](_0x9000('0x37'),auth[_0x9000('0xa')](),controller[_0x9000('0x5b')]);router[_0x9000('0x5c')](_0x9000('0x10'),auth['isAuthenticated'](),controller[_0x9000('0x5d')]);router[_0x9000('0x5c')](_0x9000('0x5e'),auth[_0x9000('0xa')](),controller[_0x9000('0x5f')]);router[_0x9000('0x60')](_0x9000('0x17'),auth['isAuthenticated'](),controller['removeQueues']);router[_0x9000('0x60')](_0x9000('0x61'),auth['isAuthenticated'](),controller[_0x9000('0x62')]);router[_0x9000('0x60')](_0x9000('0x10'),auth[_0x9000('0xa')](),controller[_0x9000('0x63')]);router['delete'](_0x9000('0x64'),auth[_0x9000('0xa')](),controller['removeChatInteractions']);router[_0x9000('0x60')](_0x9000('0x65'),auth[_0x9000('0xa')](),controller[_0x9000('0x66')]);router[_0x9000('0x60')]('/:id/fax_interactions',auth[_0x9000('0xa')](),controller[_0x9000('0x67')]);router['delete'](_0x9000('0x4f'),auth['isAuthenticated'](),controller[_0x9000('0x68')]);router['delete']('/:id/openchannel_interactions',auth[_0x9000('0xa')](),controller[_0x9000('0x69')]);router['delete'](_0x9000('0x53'),auth[_0x9000('0xa')](),controller['removeWhatsappInteractions']);router[_0x9000('0x60')](_0x9000('0x2d'),auth[_0x9000('0xa')](),controller['removeFaxAccounts']);router['delete'](_0x9000('0x56'),auth['isAuthenticated'](),controller[_0x9000('0x6a')]);router[_0x9000('0x60')]('/:id/openchannel_accounts',auth[_0x9000('0xa')](),controller[_0x9000('0x6b')]);router['delete'](_0x9000('0x31'),auth[_0x9000('0xa')](),controller[_0x9000('0x6c')]);router['delete']('/:id/chat_websites',auth[_0x9000('0xa')](),controller[_0x9000('0x6d')]);router[_0x9000('0x60')](_0x9000('0x34'),auth['isAuthenticated'](),controller[_0x9000('0x6e')]);router[_0x9000('0x60')](_0x9000('0x37'),auth[_0x9000('0xa')](),controller[_0x9000('0x6f')]);router[_0x9000('0x39')]('/:id/messengerSoundNotification',auth[_0x9000('0xa')](),controller[_0x9000('0x70')]);module[_0x9000('0x71')]=router; \ No newline at end of file +var _0x29bb=['bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','file','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','addWhatsappAccounts','put','update','/:id/password','changePassword','delete','removeQueues','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/fax_accounts','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','/create_many'];(function(_0xf1f37e,_0x159a20){var _0x2e3a6d=function(_0x4163cd){while(--_0x4163cd){_0xf1f37e['push'](_0xf1f37e['shift']());}};_0x2e3a6d(++_0x159a20);}(_0x29bb,0x198));var _0xb29b=function(_0x1653ec,_0xf0caa6){_0x1653ec=_0x1653ec-0x0;var _0x2596e1=_0x29bb[_0x1653ec];return _0x2596e1;};'use strict';var multer=require(_0xb29b('0x0'));var util=require('util');var path=require(_0xb29b('0x1'));var timeout=require(_0xb29b('0x2'));var express=require(_0xb29b('0x3'));var router=express[_0xb29b('0x4')]();var fs_extra=require(_0xb29b('0x5'));var auth=require(_0xb29b('0x6'));var interaction=require(_0xb29b('0x7'));var config=require(_0xb29b('0x8'));var controller=require(_0xb29b('0x9'));router[_0xb29b('0xa')]('/',auth[_0xb29b('0xb')](),controller[_0xb29b('0xc')]);router[_0xb29b('0xa')](_0xb29b('0xd'),auth[_0xb29b('0xb')](),controller[_0xb29b('0xe')]);router[_0xb29b('0xa')](_0xb29b('0xf'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x10')]);router[_0xb29b('0xa')](_0xb29b('0x11'),auth['isAuthenticated'](),controller[_0xb29b('0x12')]);router[_0xb29b('0xa')](_0xb29b('0x13'),auth[_0xb29b('0xb')](),controller['show']);router[_0xb29b('0xa')]('/:id/avatar',controller[_0xb29b('0x14')]);router[_0xb29b('0xa')](_0xb29b('0x15'),auth['isAuthenticated'](),controller[_0xb29b('0x16')]);router['get'](_0xb29b('0x17'),auth[_0xb29b('0xb')](),controller['getContacts']);router[_0xb29b('0xa')]('/:id/queues',auth[_0xb29b('0xb')](),controller[_0xb29b('0x18')]);router[_0xb29b('0xa')](_0xb29b('0x19'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x1a')]);router[_0xb29b('0xa')](_0xb29b('0x1b'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x1c')]);router[_0xb29b('0xa')](_0xb29b('0x1d'),auth[_0xb29b('0xb')](),controller['getRecordings']);router[_0xb29b('0xa')](_0xb29b('0x1e'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x1f')]);router['get'](_0xb29b('0x20'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x21')]);router[_0xb29b('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0xb29b('0xa')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0xb29b('0x22')]);router['get'](_0xb29b('0x23'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x24')]);router['get'](_0xb29b('0x25'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x26')]);router[_0xb29b('0xa')](_0xb29b('0x27'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x28')]);router[_0xb29b('0xa')]('/:id/teams',auth[_0xb29b('0xb')](),controller[_0xb29b('0x29')]);router[_0xb29b('0xa')]('/:id/lists',auth[_0xb29b('0xb')](),controller[_0xb29b('0x2a')]);router[_0xb29b('0xa')](_0xb29b('0x2b'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x2c')]);router[_0xb29b('0xa')]('/:id/prefixes',auth[_0xb29b('0xb')](),controller[_0xb29b('0x2d')]);router[_0xb29b('0xa')]('/:id/fax_accounts',auth[_0xb29b('0xb')](),controller['getFaxAccounts']);router['get'](_0xb29b('0x2e'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x2f')]);router['get'](_0xb29b('0x30'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x31')]);router['get'](_0xb29b('0x32'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x33')]);router[_0xb29b('0xa')]('/:id/chat_websites',auth[_0xb29b('0xb')](),controller[_0xb29b('0x34')]);router[_0xb29b('0xa')]('/:id/whatsapp_accounts',auth[_0xb29b('0xb')](),controller[_0xb29b('0x35')]);router[_0xb29b('0xa')](_0xb29b('0x36'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x37')]);router[_0xb29b('0xa')](_0xb29b('0x38'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x39')]);router['post'](_0xb29b('0x17'),auth[_0xb29b('0xb')](),controller['addContacts']);router[_0xb29b('0x3a')]('/',auth[_0xb29b('0xb')](),controller['create']);router[_0xb29b('0x3a')](_0xb29b('0x3b'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x3c')]);router[_0xb29b('0x3a')](_0xb29b('0x3d'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x3e')]);var upload=multer({'storage':multer[_0xb29b('0x3f')]({'destination':function(_0x4a8f9e,_0x165956,_0x85f754){_0x85f754(null,path[_0xb29b('0x40')](config[_0xb29b('0x41')],_0xb29b('0x42')));},'filename':function(_0x1f5a2a,_0x536d33,_0x51f101){_0x51f101(null,util[_0xb29b('0x43')](_0xb29b('0x44'),Date['now'](),_0x536d33[_0xb29b('0x45')]));}})});router[_0xb29b('0x3a')]('/:id/avatar',upload[_0xb29b('0x46')](_0xb29b('0x47')),controller['addAvatar']);router[_0xb29b('0x3a')](_0xb29b('0x48'),auth[_0xb29b('0xb')](),controller['login']);router[_0xb29b('0x3a')](_0xb29b('0x49'),auth['isAuthenticated'](),controller[_0xb29b('0x4a')]);router[_0xb29b('0x3a')](_0xb29b('0x4b'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x4c')]);router[_0xb29b('0x3a')](_0xb29b('0x4d'),auth['isAuthenticated'](),controller[_0xb29b('0x4e')]);router[_0xb29b('0x3a')](_0xb29b('0x4f'),auth['isAuthenticated'](),controller['addTeams']);router[_0xb29b('0x3a')](_0xb29b('0x50'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x51')]);router[_0xb29b('0x3a')](_0xb29b('0x52'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x53')]);router[_0xb29b('0x3a')](_0xb29b('0x54'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x55')]);router[_0xb29b('0x3a')](_0xb29b('0x56'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xb29b('0x3a')](_0xb29b('0x57'),auth['isAuthenticated'](),controller[_0xb29b('0x58')]);router['post'](_0xb29b('0x59'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x5a')]);router[_0xb29b('0x3a')]('/:id/fax_accounts',auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0xb29b('0x3a')](_0xb29b('0x2e'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x5b')]);router[_0xb29b('0x3a')](_0xb29b('0x30'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x5c')]);router[_0xb29b('0x3a')](_0xb29b('0x32'),auth['isAuthenticated'](),controller[_0xb29b('0x5d')]);router[_0xb29b('0x3a')](_0xb29b('0x5e'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x5f')]);router[_0xb29b('0x3a')](_0xb29b('0x60'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x61')]);router[_0xb29b('0x3a')]('/:id/api_key',auth[_0xb29b('0xb')](),controller['createApiKey']);router[_0xb29b('0x62')](_0xb29b('0x13'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x63')]);router[_0xb29b('0x62')](_0xb29b('0x64'),auth['isAuthenticated'](),controller[_0xb29b('0x65')]);router[_0xb29b('0x66')]('/:id/queues',auth[_0xb29b('0xb')](),controller[_0xb29b('0x67')]);router['delete'](_0xb29b('0x4f'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb29b('0x66')](_0xb29b('0x13'),auth[_0xb29b('0xb')](),controller['destroy']);router['delete'](_0xb29b('0x50'),auth[_0xb29b('0xb')](),controller['removeChatInteractions']);router[_0xb29b('0x66')]('/:id/mail_interactions',auth[_0xb29b('0xb')](),controller[_0xb29b('0x68')]);router[_0xb29b('0x66')](_0xb29b('0x54'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x69')]);router[_0xb29b('0x66')](_0xb29b('0x56'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x6a')]);router[_0xb29b('0x66')](_0xb29b('0x57'),auth[_0xb29b('0xb')](),controller['removeOpenchannelInteractions']);router[_0xb29b('0x66')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['removeWhatsappInteractions']);router[_0xb29b('0x66')](_0xb29b('0x6b'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x6c')]);router[_0xb29b('0x66')]('/:id/mail_accounts',auth[_0xb29b('0xb')](),controller['removeMailAccounts']);router['delete'](_0xb29b('0x30'),auth['isAuthenticated'](),controller[_0xb29b('0x6d')]);router[_0xb29b('0x66')](_0xb29b('0x32'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x6e')]);router[_0xb29b('0x66')](_0xb29b('0x5e'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x6f')]);router['delete'](_0xb29b('0x60'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x70')]);router[_0xb29b('0x66')]('/:id/api_key',auth[_0xb29b('0xb')](),controller[_0xb29b('0x71')]);router[_0xb29b('0x3a')](_0xb29b('0x72'),auth[_0xb29b('0xb')](),controller[_0xb29b('0x73')]);module[_0xb29b('0x74')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 3760acf..4078fbe 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 _0x53d1=['icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','encryption','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','lodash','exports','name','setDataValue','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','ENUM','admin','user','agent','telephone','local','accountcode','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','rfc2833','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','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]','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','passive','actpass','TEXT','showWebBar','get','isArray','wss','avpf','force_avp'];(function(_0xae4d23,_0xd31a8){var _0x2a1462=function(_0x3891ef){while(--_0x3891ef){_0xae4d23['push'](_0xae4d23['shift']());}};_0x2a1462(++_0xd31a8);}(_0x53d1,0x73));var _0x153d=function(_0x5a9b11,_0x505157){_0x5a9b11=_0x5a9b11-0x0;var _0x3a7394=_0x53d1[_0x5a9b11];return _0x3a7394;};'use strict';var Sequelize=require(_0x153d('0x0'));var moment=require(_0x153d('0x1'));var util=require('util');var _=require(_0x153d('0x2'));module[_0x153d('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x153d('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9._]+$/i},'set':function(_0x56cd25){this[_0x153d('0x5')](_0x153d('0x4'),_0x56cd25);this[_0x153d('0x5')]('defaultuser',_0x56cd25);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x153d('0x6')],'allowNull':![],'set':function(_0x5d5c04){this['setDataValue'](_0x153d('0x7'),_0x5d5c04);this[_0x153d('0x5')](_0x153d('0x8'),util[_0x153d('0x9')](_0x153d('0xa'),_0x5d5c04,this[_0x153d('0xb')](_0x153d('0xc'))));}},'alias':{'type':Sequelize[_0x153d('0x6')]},'email':{'type':Sequelize[_0x153d('0x6')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x4325fb){if(_0x4325fb){this['setDataValue'](_0x153d('0xd'),_0x4325fb['toLowerCase']());}}},'role':{'type':Sequelize[_0x153d('0xe')](_0x153d('0xf'),_0x153d('0x10'),_0x153d('0x11'),_0x153d('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x153d('0x6')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x153d('0x6')],'defaultValue':_0x153d('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x153d('0xc'),'set':function(_0xaed40c){this[_0x153d('0x5')]('internal',_0xaed40c);this[_0x153d('0x5')](_0x153d('0x14'),_0xaed40c);this[_0x153d('0x5')](_0x153d('0x8'),util[_0x153d('0x9')](_0x153d('0xa'),this['getDataValue'](_0x153d('0x7')),_0xaed40c));}},'salt':{'type':Sequelize[_0x153d('0x6')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x153d('0x6')]},'userpic':{'type':Sequelize[_0x153d('0x6')]},'city':{'type':Sequelize[_0x153d('0x6')]},'country':{'type':Sequelize[_0x153d('0x6')]},'online':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x153d('0x6')],'defaultValue':_0x153d('0x16')},'lastPauseAt':{'type':Sequelize[_0x153d('0x17')]},'chatCapacity':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x153d('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x153d('0x18')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'host':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![],'defaultValue':_0x153d('0x19')},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize[_0x153d('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x153d('0xe')]('friend',_0x153d('0x10'),_0x153d('0x1a')),'allowNull':!![],'defaultValue':_0x153d('0x1b')},'context':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![],'defaultValue':_0x153d('0x1c')},'callingpres':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x1d'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x153d('0x1e'),'PROHIB_NOT_SCREENED',_0x153d('0x1f'),'PROHIB_FAILED_SCREEN',_0x153d('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'permit':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'secret':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'transport':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![],'defaultValue':_0x153d('0x21'),'set':function(_0x464507){this[_0x153d('0x5')](_0x153d('0x22'),_0x464507?_0x464507[_0x153d('0x23')](','):null);},'get':function(){return this[_0x153d('0xb')](_0x153d('0x22'))?this['getDataValue'](_0x153d('0x22'))[_0x153d('0x24')](','):null;},'comment':_0x153d('0x25')},'dtmfmode':{'type':Sequelize[_0x153d('0xe')]('rfc2833',_0x153d('0x26'),_0x153d('0x27'),_0x153d('0x28'),_0x153d('0x29')),'allowNull':!![],'defaultValue':_0x153d('0x2a')},'directmedia':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no',_0x153d('0x2c'),_0x153d('0x2d'),_0x153d('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![],'defaultValue':_0x153d('0x2f'),'set':function(_0x2ed4d7){this[_0x153d('0x5')](_0x153d('0x30'),_0x2ed4d7?_0x2ed4d7['join'](','):null);},'get':function(){return this[_0x153d('0xb')]('nat')?this[_0x153d('0xb')](_0x153d('0x30'))[_0x153d('0x24')](','):null;},'comment':_0x153d('0x31')},'callgroup':{'type':Sequelize[_0x153d('0x6')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x153d('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x153d('0x6')]},'language':{'type':Sequelize[_0x153d('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x153d('0x6')]},'disallow':{'type':Sequelize[_0x153d('0x6')],'allowNull':![],'defaultValue':_0x153d('0x32')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1bc14d){this[_0x153d('0x5')](_0x153d('0x33'),_0x1bc14d?_0x1bc14d[_0x153d('0x23')](';'):_0x153d('0x34'));},'get':function(){return this[_0x153d('0xb')](_0x153d('0x33'))?this['getDataValue'](_0x153d('0x33'))[_0x153d('0x24')](';'):null;},'comment':_0x153d('0x35')},'autoframing':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![],'set':function(_0x351674){this[_0x153d('0x5')](_0x153d('0x36'),_0x351674?_0x351674[_0x153d('0x23')](','):null);},'get':function(){return this[_0x153d('0xb')](_0x153d('0x36'))?this['getDataValue'](_0x153d('0x36'))['split'](','):null;},'comment':_0x153d('0x37')},'trustrpid':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x153d('0x38')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![],'defaultValue':_0x153d('0x39')},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x153d('0x2b')},'busylevel':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x153d('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'template':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0x153d('0x2b'),'no',_0x153d('0x3a')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x153d('0x3b'),_0x153d('0x3c'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x3d'),_0x153d('0x3e')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x153d('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no',_0x153d('0x3f'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x153d('0xe')]('active',_0x153d('0x40'),_0x153d('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x153d('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x153d('0xe')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no',_0x153d('0x2c'),_0x153d('0x2d'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x153d('0x6')]},'resetPasswordExpires':{'type':Sequelize[_0x153d('0x17')]},'passwordResetAt':{'type':Sequelize[_0x153d('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x153d('0x42')]},'showWebBar':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0,'set':function(_0x4b6ccd){this[_0x153d('0x5')](_0x153d('0x43'),_0x4b6ccd);var _0x2df62b=this[_0x153d('0x44')]({'plain':!![]});switch(_0x4b6ccd){case 0x0:case 0x1:var _0x48912a=_0x2df62b[_0x153d('0x22')]?_[_0x153d('0x45')](_0x2df62b['transport'])?_0x2df62b[_0x153d('0x22')]['join']():_0x2df62b['transport']:_0x153d('0x21');if(_0x48912a===_0x153d('0x46')){_0x48912a=_0x153d('0x21');}this[_0x153d('0x5')](_0x153d('0x22'),_0x48912a);this[_0x153d('0x5')]('encryption','no');this[_0x153d('0x5')](_0x153d('0x47'),null);this[_0x153d('0x5')](_0x153d('0x48'),null);this[_0x153d('0x5')](_0x153d('0x49'),null);this[_0x153d('0x5')](_0x153d('0x4a'),null);this[_0x153d('0x5')](_0x153d('0x4b'),null);this[_0x153d('0x5')](_0x153d('0x4c'),null);this[_0x153d('0x5')](_0x153d('0x4d'),null);this[_0x153d('0x5')](_0x153d('0x4e'),null);this['setDataValue'](_0x153d('0x4f'),'no');break;case 0x2:this[_0x153d('0x5')](_0x153d('0x22'),_0x153d('0x46'));this[_0x153d('0x5')](_0x153d('0x50'),_0x153d('0x2b'));this[_0x153d('0x5')](_0x153d('0x47'),_0x153d('0x2b'));this[_0x153d('0x5')]('force_avp','yes');this[_0x153d('0x5')]('icesupport',_0x153d('0x2b'));this[_0x153d('0x5')]('dtlsenable','yes');this[_0x153d('0x5')](_0x153d('0x4b'),'no');this['setDataValue'](_0x153d('0x4c'),_0x153d('0x41'));this['setDataValue'](_0x153d('0x4d'),_0x2df62b[_0x153d('0x4d')]||_0x153d('0x51'));this['setDataValue'](_0x153d('0x4e'),_0x2df62b[_0x153d('0x4e')]||_0x153d('0x52'));this[_0x153d('0x5')](_0x153d('0x4f'),_0x153d('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x153d('0x42')],'set':function(_0x5db92c){this[_0x153d('0x5')]('permissions',_0x5db92c?_0x5db92c[_0x153d('0x23')](','):[]);},'get':function(){return this[_0x153d('0xb')](_0x153d('0x53'))?_[_0x153d('0x54')](this['getDataValue'](_0x153d('0x53'))['split'](','),function(_0x4abd7e){return parseInt(_0x4abd7e,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x153d('0x6')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x153d('0x6')]},'phoneBarBusyNumber':{'type':Sequelize[_0x153d('0x6')]},'phoneBarUnconditional':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x153d('0x6')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x153d('0xe')](_0x153d('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x153d('0x6')]},'phoneBarEnableJaws':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x153d('0x55')],'get':function(){return this[_0x153d('0xb')](_0x153d('0x56'))?this[_0x153d('0xb')](_0x153d('0x56')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0x153d('0x6')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x153d('0x6')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![],'set':function(_0x3396fa){if(typeof _0x3396fa===_0x153d('0x57')){var _0x5bb7a2=_0x3396fa==='1'?!![]:_0x3396fa==='0'?![]:_0x3396fa==='true'?!![]:_0x3396fa===_0x153d('0x58')?![]:![];this[_0x153d('0x5')](_0x153d('0x59'),_0x5bb7a2);}else{this[_0x153d('0x5')](_0x153d('0x59'),_0x3396fa);}}},'blocked':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![],'set':function(_0x4544fc){this[_0x153d('0x5')](_0x153d('0x5a'),_0x4544fc);if(_0x4544fc===!![]){this[_0x153d('0x5')]('blockedAt',moment());this[_0x153d('0x5')](_0x153d('0x5b'),0x0);}else{this[_0x153d('0x5')](_0x153d('0x5c'),null);}}},'blockedAt':{'type':Sequelize[_0x153d('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0x153d('0x5d')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x153d('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'messengerSoundNotification':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x153d('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x153d('0x18')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8333=['fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','user','agent','telephone','INTEGER','DATE','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','split','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uas','certificate','actpass','update,nonat','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','wss','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser'];(function(_0x469a3c,_0x5ebc10){var _0x968f4=function(_0x22403b){while(--_0x22403b){_0x469a3c['push'](_0x469a3c['shift']());}};_0x968f4(++_0x5ebc10);}(_0x8333,0x1b4));var _0x3833=function(_0x6f732a,_0x7a433){_0x6f732a=_0x6f732a-0x0;var _0x3c89ab=_0x8333[_0x6f732a];return _0x3c89ab;};'use strict';var Sequelize=require(_0x3833('0x0'));var moment=require(_0x3833('0x1'));var util=require(_0x3833('0x2'));var _=require(_0x3833('0x3'));module[_0x3833('0x4')]={'name':{'type':Sequelize[_0x3833('0x5')],'allowNull':![],'unique':_0x3833('0x6'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9._]+$/i},'set':function(_0x1c10f9){this[_0x3833('0x7')](_0x3833('0x6'),_0x1c10f9);this[_0x3833('0x7')](_0x3833('0x8'),_0x1c10f9);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x1a4fa3){this[_0x3833('0x7')](_0x3833('0x9'),_0x1a4fa3);this['setDataValue'](_0x3833('0xa'),util[_0x3833('0xb')](_0x3833('0xc'),_0x1a4fa3,this[_0x3833('0xd')](_0x3833('0xe'))));}},'alias':{'type':Sequelize[_0x3833('0x5')]},'email':{'type':Sequelize[_0x3833('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x3f303c){if(_0x3f303c){this[_0x3833('0x7')]('email',_0x3f303c['toLowerCase']());}}},'role':{'type':Sequelize['ENUM']('admin',_0x3833('0xf'),_0x3833('0x10'),_0x3833('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x3833('0x5')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x3833('0x5')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':![],'unique':_0x3833('0xe'),'set':function(_0x5b1c76){this[_0x3833('0x7')](_0x3833('0xe'),_0x5b1c76);this[_0x3833('0x7')]('accountcode',_0x5b1c76);this['setDataValue'](_0x3833('0xa'),util[_0x3833('0xb')](_0x3833('0xc'),this[_0x3833('0xd')](_0x3833('0x9')),_0x5b1c76));}},'salt':{'type':Sequelize[_0x3833('0x5')]},'phone':{'type':Sequelize[_0x3833('0x5')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x3833('0x5')]},'zipcode':{'type':Sequelize[_0x3833('0x5')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3833('0x5')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x3833('0x13')]},'voicePause':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x3833('0x5')],'defaultValue':_0x3833('0x15')},'lastPauseAt':{'type':Sequelize[_0x3833('0x13')]},'chatCapacity':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x3833('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x3833('0x12')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x3833('0x12')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'host':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![],'defaultValue':_0x3833('0x16')},'ipaddr':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0x3833('0x12')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x3833('0x17')]('friend',_0x3833('0xf'),_0x3833('0x18')),'allowNull':!![],'defaultValue':_0x3833('0x19')},'context':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![],'defaultValue':_0x3833('0x1a')},'callingpres':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x1b'),_0x3833('0x1c'),'ALLOWED_FAILED_SCREEN',_0x3833('0x1d'),_0x3833('0x1e'),'PROHIB_PASSED_SCREEN',_0x3833('0x1f'),_0x3833('0x20')),'allowNull':!![]},'deny':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'permit':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'secret':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3833('0x21'),'set':function(_0x44c987){this[_0x3833('0x7')](_0x3833('0x22'),_0x44c987?_0x44c987[_0x3833('0x23')](','):null);},'get':function(){return this[_0x3833('0xd')](_0x3833('0x22'))?this['getDataValue'](_0x3833('0x22'))['split'](','):null;},'comment':_0x3833('0x24')},'dtmfmode':{'type':Sequelize[_0x3833('0x17')]('rfc2833',_0x3833('0x25'),_0x3833('0x26'),_0x3833('0x27'),_0x3833('0x28')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x3833('0x29'),'no',_0x3833('0x2a'),_0x3833('0x2b'),_0x3833('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3833('0x2d'),'set':function(_0x18b0c0){this[_0x3833('0x7')]('nat',_0x18b0c0?_0x18b0c0[_0x3833('0x23')](','):null);},'get':function(){return this['getDataValue'](_0x3833('0x2e'))?this[_0x3833('0xd')](_0x3833('0x2e'))['split'](','):null;},'comment':_0x3833('0x2f')},'callgroup':{'type':Sequelize[_0x3833('0x5')]},'namedcallgroup':{'type':Sequelize[_0x3833('0x5')]},'pickupgroup':{'type':Sequelize[_0x3833('0x5')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3833('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3833('0x5')]},'disallow':{'type':Sequelize[_0x3833('0x5')],'allowNull':![],'defaultValue':_0x3833('0x30')},'allow':{'type':Sequelize[_0x3833('0x5')],'allowNull':![],'defaultValue':_0x3833('0x31'),'set':function(_0x3f9efe){this[_0x3833('0x7')](_0x3833('0x32'),_0x3f9efe?_0x3f9efe[_0x3833('0x23')](';'):_0x3833('0x31'));},'get':function(){return this[_0x3833('0xd')](_0x3833('0x32'))?this['getDataValue'](_0x3833('0x32'))[_0x3833('0x33')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![],'set':function(_0x2136fc){this['setDataValue']('insecure',_0x2136fc?_0x2136fc[_0x3833('0x23')](','):null);},'get':function(){return this[_0x3833('0xd')](_0x3833('0x34'))?this[_0x3833('0xd')](_0x3833('0x34'))[_0x3833('0x33')](','):null;},'comment':_0x3833('0x35')},'trustrpid':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3833('0x17')]('yes','no',_0x3833('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x3833('0x37')},'amaflags':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0x3833('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x3833('0x17')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x3833('0x17')]('yes','no',_0x3833('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x39'),'refuse',_0x3833('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac',_0x3833('0x3b')),'allowNull':!![],'defaultValue':_0x3833('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x3833('0x17')]('yes','no'),'allowNull':!![],'defaultValue':_0x3833('0x29')},'keepalive':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x3833('0x17')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x3833('0x17')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x3833('0x17')]('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no','fingerprint',_0x3833('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM']('active','passive',_0x3833('0x3d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x3833('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x3833('0x12')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x3833('0x17')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x3833('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x3833('0x29'),'no',_0x3833('0x2a'),'update',_0x3833('0x3e')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x3833('0x13')]},'passwordResetAt':{'type':Sequelize[_0x3833('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0,'set':function(_0x382cd1){this[_0x3833('0x7')](_0x3833('0x3f'),_0x382cd1);var _0x12a388=this[_0x3833('0x40')]({'plain':!![]});switch(_0x382cd1){case 0x0:case 0x1:var _0xf12d90=_0x12a388[_0x3833('0x22')]?_[_0x3833('0x41')](_0x12a388[_0x3833('0x22')])?_0x12a388['transport'][_0x3833('0x23')]():_0x12a388[_0x3833('0x22')]:'udp';if(_0xf12d90==='wss'){_0xf12d90=_0x3833('0x21');}this[_0x3833('0x7')](_0x3833('0x22'),_0xf12d90);this['setDataValue'](_0x3833('0x42'),'no');this['setDataValue'](_0x3833('0x43'),null);this['setDataValue'](_0x3833('0x44'),null);this[_0x3833('0x7')](_0x3833('0x45'),null);this[_0x3833('0x7')](_0x3833('0x46'),null);this[_0x3833('0x7')](_0x3833('0x47'),null);this[_0x3833('0x7')](_0x3833('0x48'),null);this[_0x3833('0x7')](_0x3833('0x49'),null);this[_0x3833('0x7')](_0x3833('0x4a'),null);this[_0x3833('0x7')](_0x3833('0x4b'),'no');break;case 0x2:this[_0x3833('0x7')]('transport',_0x3833('0x4c'));this[_0x3833('0x7')](_0x3833('0x42'),_0x3833('0x29'));this[_0x3833('0x7')](_0x3833('0x43'),'yes');this[_0x3833('0x7')]('force_avp',_0x3833('0x29'));this[_0x3833('0x7')](_0x3833('0x45'),_0x3833('0x29'));this[_0x3833('0x7')]('dtlsenable','yes');this[_0x3833('0x7')]('dtlsverify','no');this[_0x3833('0x7')]('dtlssetup','actpass');this[_0x3833('0x7')](_0x3833('0x49'),_0x12a388[_0x3833('0x49')]||'/etc/pki/tls/certs/motion.crt');this[_0x3833('0x7')](_0x3833('0x4a'),_0x12a388['dtlsprivatekey']||_0x3833('0x4d'));this[_0x3833('0x7')](_0x3833('0x4b'),_0x3833('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x3833('0x4e')],'set':function(_0x45b173){this[_0x3833('0x7')]('permissions',_0x45b173?_0x45b173[_0x3833('0x23')](','):[]);},'get':function(){return this[_0x3833('0xd')](_0x3833('0x4f'))?_[_0x3833('0x50')](this['getDataValue']('permissions')[_0x3833('0x33')](','),function(_0x8c6a68){return parseInt(_0x8c6a68,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x3833('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x3833('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0x3833('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x3833('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x3833('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x3833('0x17')](_0x3833('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x3833('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x3833('0x5')]},'phoneBarEnableJaws':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x3833('0x51')],'get':function(){return this[_0x3833('0xd')](_0x3833('0x52'))?this[_0x3833('0xd')](_0x3833('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0x3833('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x3833('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x12aa5a){if(typeof _0x12aa5a==='string'){var _0x5e24cc=_0x12aa5a==='1'?!![]:_0x12aa5a==='0'?![]:_0x12aa5a==='true'?!![]:_0x12aa5a===_0x3833('0x53')?![]:![];this[_0x3833('0x7')](_0x3833('0x54'),_0x5e24cc);}else{this['setDataValue']('screenrecording',_0x12aa5a);}}},'blocked':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![],'set':function(_0x180770){this[_0x3833('0x7')](_0x3833('0x55'),_0x180770);if(_0x180770===!![]){this[_0x3833('0x7')](_0x3833('0x56'),moment());this['setDataValue'](_0x3833('0x57'),0x0);}else{this['setDataValue'](_0x3833('0x56'),null);}}},'blockedAt':{'type':Sequelize[_0x3833('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x3833('0x12')](0x5)[_0x3833('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x3833('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x3833('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x3833('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'messengerSoundNotification':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x3833('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x3833('0x12')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x3833('0x12')],'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 5b9d02b..f6ed5a4 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 _0xe3da=['$notLike','$iLike','$notILike','$overlap','$contains','CmHopper','firstName','lastName','CmContact','Contact','dialActive','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','queues','teams','inbound','flatten','col','toString','asc','desc','substring','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','offline','idle','unknown','unavailable','ringing','voiceStatus','busy','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','type','moment','util','path','lodash','squel','jayson/promise','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','client','http','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','role','destroy','get','admin','Users','user','Agents','Telephones','filter','map','includes','value','name','UserProfileResource','send','index','User','fieldName','password','salt','getOptions','includeAll','query','userSetting','true','include','attributes','rows','openTabs','push','dataValues','sms','fax','openchannel','all','show','params','model','differenceBy','keys','rawAttributes','intersection','fields','length','merge','find','mail','body','describe','addContacts','ids','omit','internal','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','email','permissions','101','103','113','105','106','107','109','100','114','115','agent','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','create','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','findAll','isEmpty','changePassword','newPassword','Sequelize','ValidationError','Wrong\x20credentials','oldPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','updatePasswordsHistory','channel','loginInPause','voicePause','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','emit','voice','VoiceQueue','online','interface','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','isArray','QueueId','Queue:remove','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','existsSync','server/files/images/','getOpenTabs','chat','whatsapp','CHAT','createdAt','FaxOpenTabs','OpenchannelOpenTabs','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WHATSAPP','getContacts','format','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','color','tag','getQueues','Queue','order','sort','where','filters','options','Unknown\x20role','pick','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','user:forcelogout','headers','x-forwarded-for','remoteAddress','socket','connection','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','device','PAUSE','concat','isMiddleware','resolve','logout','pause','updateAttributes','DEFAULT\x20PAUSE','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','Team','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','removeAgent','getLists','getAgents','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lte','$eq','$not','$notBetween','$in','$notIn','$like'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xe3da,0x1cd));var _0xae3d=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xe3da[_0x19950b];return _0x3c6b41;};'use strict';var moment=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var fs=require('fs');var _=require(_0xae3d('0x3'));var squel=require(_0xae3d('0x4'));var jayson=require(_0xae3d('0x5'));var Redis=require(_0xae3d('0x6'));var authService=require(_0xae3d('0x7'));var contacts=require(_0xae3d('0x8'));var qs=require(_0xae3d('0x9'));var logger=require(_0xae3d('0xa'))(_0xae3d('0xb'));var utils=require(_0xae3d('0xc'));var config=require(_0xae3d('0xd'));var licenseUtil=require(_0xae3d('0xe'));var APIBadRequestError=require(_0xae3d('0xf'))['APIBadRequestError'];var APINotFoundError=require(_0xae3d('0xf'))[_0xae3d('0x10')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0xae3d('0x11'))['db'];var socket=require(_0xae3d('0x12'))(new Redis(config[_0xae3d('0x13')]));require(_0xae3d('0x14'))[_0xae3d('0x15')](socket);config[_0xae3d('0x13')]=_['defaults'](config[_0xae3d('0x13')],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0xae3d('0x16')][_0xae3d('0x17')]({'port':0x232a});var values;function respondWithRpcPromise(_0x7770eb,_0x172f7a,_0x48aa74,_0xfb7869){return new Promise(function(_0x27561c,_0x16fd19){var _0x1605ac=_0xfb7869||amiClient;return _0x1605ac[_0xae3d('0x18')](_0x7770eb,_0x48aa74)[_0xae3d('0x19')](function(_0x31498d){logger['info'](_0xae3d('0x1a'),_0x172f7a,_0xae3d('0x1b'));logger[_0xae3d('0x1c')](_0xae3d('0x1d'),_0x172f7a,_0xae3d('0x1b'),JSON[_0xae3d('0x1e')](_0x31498d));if(_0x31498d['error']){if(_0x31498d[_0xae3d('0x1f')][_0xae3d('0x20')]===0x1f4){logger[_0xae3d('0x1f')]('User,\x20%s,\x20%s',_0x172f7a,_0x31498d[_0xae3d('0x1f')][_0xae3d('0x21')]);return _0x16fd19(_0x31498d['error']['message']);}logger[_0xae3d('0x1f')](_0xae3d('0x1a'),_0x172f7a,_0x31498d[_0xae3d('0x1f')][_0xae3d('0x21')]);return _0x27561c(_0x31498d[_0xae3d('0x1f')]['message']);}else{logger[_0xae3d('0x22')]('User,\x20%s,\x20%s',_0x172f7a,_0xae3d('0x1b'));_0x27561c(_0x31498d[_0xae3d('0x23')][_0xae3d('0x21')]);}})[_0xae3d('0x24')](function(_0x1facc1){logger[_0xae3d('0x1f')](_0xae3d('0x1a'),_0x172f7a,_0x1facc1);_0x16fd19(_0x1facc1);});});}function respondWithStatusCode(_0x155099,_0x3224ff){_0x3224ff=_0x3224ff||0xcc;return function(_0x11ecf7){if(_0x11ecf7){return _0x155099[_0xae3d('0x25')](_0x3224ff);}return _0x155099[_0xae3d('0x26')](_0x3224ff)[_0xae3d('0x27')]();};}function respondWithResult(_0x1b2acb,_0x44a4e0){_0x44a4e0=_0x44a4e0||0xc8;return function(_0x1fe90f){if(_0x1fe90f){return _0x1b2acb[_0xae3d('0x26')](_0x44a4e0)[_0xae3d('0x28')](_0x1fe90f);}};}function respondWithFilteredResult(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(_0x5d45db){var _0x16c014=typeof _0x1b1217[_0xae3d('0x29')]===_0xae3d('0x2a')&&typeof _0x1b1217[_0xae3d('0x2b')]===_0xae3d('0x2a');var _0x4391db=_0x5d45db[_0xae3d('0x2c')];var _0x54c1e1=_0x16c014?0x0:_0x1b1217['offset'];var _0x12e3a5=_0x16c014?_0x5d45db[_0xae3d('0x2c')]:_0x1b1217[_0xae3d('0x29')]+_0x1b1217[_0xae3d('0x2b')];var _0xb69ec9;if(_0x12e3a5>=_0x4391db){_0x12e3a5=_0x4391db;_0xb69ec9=0xc8;}else{_0xb69ec9=0xce;}_0x2131e9['status'](_0xb69ec9);return _0x2131e9[_0xae3d('0x2d')](_0xae3d('0x2e'),_0x54c1e1+'-'+_0x12e3a5+'/'+_0x4391db)['json'](_0x5d45db);}return null;};}function saveUpdates(_0x5c155e){return function(_0x323715){if(_0x323715){return _0x323715[_0xae3d('0x2f')](_0x5c155e)[_0xae3d('0x19')](function(_0x432c04){if(_0x432c04[_0xae3d('0x30')]==='agent'){socket['emit']('userNotification:recalc:'+_0x432c04['id'],_0x432c04);}return _0x432c04;});}return null;};}function removeEntity(_0x5cfdae){return function(_0x90b62a){if(_0x90b62a){return _0x90b62a[_0xae3d('0x31')]()[_0xae3d('0x19')](function(){var _0x54a75c=_0x90b62a[_0xae3d('0x32')]({'plain':!![]});if(_0x54a75c[_0xae3d('0x30')]===_0xae3d('0x33'))return;var _0x3748d2=[{'name':_0xae3d('0x34'),'value':_0xae3d('0x35'),'ignore':!![]},{'name':_0xae3d('0x36'),'value':'agent','ignore':![]},{'name':_0xae3d('0x37'),'value':'telephone','ignore':![]}];var _0x55aae4=_(_0x3748d2)[_0xae3d('0x38')]('ignore')[_0xae3d('0x39')]('value')['value']();if(_[_0xae3d('0x3a')](_0x55aae4,_0x54a75c[_0xae3d('0x30')])){return;}var _0x403484=_['find'](_0x3748d2,[_0xae3d('0x3b'),_0x54a75c['role']])[_0xae3d('0x3c')];return db[_0xae3d('0x3d')][_0xae3d('0x31')]({'where':{'type':_0x403484,'resourceId':_0x54a75c['id']}})[_0xae3d('0x19')](function(){return _0x90b62a;});})[_0xae3d('0x19')](function(){_0x5cfdae[_0xae3d('0x26')](0xcc)[_0xae3d('0x27')]();});}};}function handleEntityNotFound(_0x21d84d){return function(_0x267dff){if(!_0x267dff){_0x21d84d[_0xae3d('0x25')](0x194);}return _0x267dff;};}function handleError(_0x18855c,_0x5543ee){_0x5543ee=_0x5543ee||0x1f4;return function(_0x544269){logger[_0xae3d('0x1f')](_0x544269['stack']);if(_0x544269[_0xae3d('0x3c')]){delete _0x544269[_0xae3d('0x3c')];}_0x18855c[_0xae3d('0x26')](_0x5543ee)[_0xae3d('0x3e')](_0x544269);};}exports[_0xae3d('0x3f')]=function(_0x35db44,_0x238e65){var _0x15350d={},_0x26de54={'count':0x0,'rows':[]};var _0xd8cd66=_(db[_0xae3d('0x40')]['rawAttributes'])[_0xae3d('0x39')](function(_0x3ab6a6){return{'name':_0x3ab6a6[_0xae3d('0x41')],'type':_0x3ab6a6['type']['key']};})[_0xae3d('0x38')](function(_0x190dd4){return!_['includes']([_0xae3d('0x42'),_0xae3d('0x43')],_0x190dd4[_0xae3d('0x3c')]);})[_0xae3d('0x3b')]();_0x15350d=qs[_0xae3d('0x44')](_0xd8cd66,_0x35db44);var _0x1a483a={'where':_0x15350d['where']};return db[_0xae3d('0x40')][_0xae3d('0x2c')](_0x1a483a)[_0xae3d('0x19')](function(_0x938811){_0x26de54[_0xae3d('0x2c')]=_0x938811;if(_0x35db44['query'][_0xae3d('0x45')]){_0x15350d['include']=[{'all':!![]}];}if(_0x35db44[_0xae3d('0x46')][_0xae3d('0x47')]===_0xae3d('0x48')){_0x15350d[_0xae3d('0x49')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_['includes'](_0x15350d[_0xae3d('0x4a')],'id')){_0x15350d[_0xae3d('0x4a')]['push']('id');}return db['User']['findAll'](_0x15350d);})[_0xae3d('0x19')](function(_0x2fdc6e){_0x26de54[_0xae3d('0x4b')]=_0x2fdc6e;if(_0x35db44[_0xae3d('0x46')][_0xae3d('0x4c')]===_0xae3d('0x48')){var _0x42357f=[];for(var _0x5c621e=0x0;_0x5c621e<_0x26de54['rows']['length'];_0x5c621e++){_0x42357f[_0xae3d('0x4d')](get_open_tabs('chat',_0x26de54[_0xae3d('0x4b')][_0x5c621e][_0xae3d('0x4e')]));_0x42357f[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x4f'),_0x26de54[_0xae3d('0x4b')][_0x5c621e][_0xae3d('0x4e')]));_0x42357f[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x50'),_0x26de54[_0xae3d('0x4b')][_0x5c621e][_0xae3d('0x4e')]));_0x42357f[_0xae3d('0x4d')](get_open_tabs('mail',_0x26de54['rows'][_0x5c621e]['dataValues']));_0x42357f[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x51'),_0x26de54[_0xae3d('0x4b')][_0x5c621e][_0xae3d('0x4e')]));_0x42357f['push'](get_open_tabs('whatsapp',_0x26de54[_0xae3d('0x4b')][_0x5c621e][_0xae3d('0x4e')]));}return Promise[_0xae3d('0x52')](_0x42357f)[_0xae3d('0x19')](function(){return _0x26de54;});}else{return _0x26de54;}})['then'](respondWithFilteredResult(_0x238e65,_0x15350d))[_0xae3d('0x24')](handleError(_0x238e65,null));};exports[_0xae3d('0x53')]=function(_0xad005d,_0x455e47){var _0x2a6a24={'raw':![],'where':{'id':_0xad005d[_0xae3d('0x54')]['id']}},_0x38ccf1={};_0x38ccf1[_0xae3d('0x55')]=_[_0xae3d('0x56')](_[_0xae3d('0x57')](db[_0xae3d('0x40')][_0xae3d('0x58')]),['password','salt']);_0x38ccf1['query']=_[_0xae3d('0x57')](_0xad005d[_0xae3d('0x46')]);_0x38ccf1['filters']=_[_0xae3d('0x59')](_0x38ccf1['model'],_0x38ccf1['query']);_0x2a6a24[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x38ccf1[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0xad005d[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x2a6a24[_0xae3d('0x4a')]=_0x2a6a24['attributes'][_0xae3d('0x5b')]?_0x2a6a24[_0xae3d('0x4a')]:_0x38ccf1[_0xae3d('0x55')];if(_0xad005d[_0xae3d('0x46')]['includeAll']){_0x2a6a24[_0xae3d('0x49')]=[{'all':!![]}];}if(_0xad005d[_0xae3d('0x46')][_0xae3d('0x47')]===_0xae3d('0x48')){_0x2a6a24['include']=[{'model':db['UserSetting'],'as':'userSetting'}];}_0x2a6a24=_[_0xae3d('0x5c')]({},_0x2a6a24,_0xad005d['options']);if(!_['includes'](_0x2a6a24[_0xae3d('0x4a')],'id')){_0x2a6a24[_0xae3d('0x4a')][_0xae3d('0x4d')]('id');}return db[_0xae3d('0x40')][_0xae3d('0x5d')](_0x2a6a24)[_0xae3d('0x19')](handleEntityNotFound(_0x455e47,null))['then'](function(_0x42e9af){var _0x4448d5=[];values=_0x42e9af;if(_0xad005d[_0xae3d('0x46')][_0xae3d('0x4c')]===_0xae3d('0x48')){_0x4448d5[_0xae3d('0x4d')](get_open_tabs('chat',_0x42e9af[_0xae3d('0x4e')]));_0x4448d5[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x4f'),_0x42e9af['dataValues']));_0x4448d5['push'](get_open_tabs('openchannel',_0x42e9af[_0xae3d('0x4e')]));_0x4448d5[_0xae3d('0x4d')](get_open_tabs('whatsapp',_0x42e9af[_0xae3d('0x4e')]));_0x4448d5[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x50'),_0x42e9af['dataValues']));_0x4448d5[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x5e'),_0x42e9af[_0xae3d('0x4e')]));return Promise[_0xae3d('0x52')](_0x4448d5);}else{return values;}})[_0xae3d('0x19')](function(){return values;})[_0xae3d('0x19')](respondWithResult(_0x455e47,null))[_0xae3d('0x24')](handleError(_0x455e47,null));};exports[_0xae3d('0x2f')]=function(_0x4c8b7b,_0x49f862){if(_0x4c8b7b[_0xae3d('0x5f')]['id']){delete _0x4c8b7b[_0xae3d('0x5f')]['id'];}delete _0x4c8b7b[_0xae3d('0x5f')]['role'];return db['User'][_0xae3d('0x5d')]({'where':{'id':_0x4c8b7b[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x49f862,null))[_0xae3d('0x19')](saveUpdates(_0x4c8b7b['body'],null))[_0xae3d('0x19')](respondWithResult(_0x49f862,null))[_0xae3d('0x24')](handleError(_0x49f862,null));};exports['describe']=function(_0x19aab4,_0x2c221b){return db[_0xae3d('0x40')][_0xae3d('0x60')]()[_0xae3d('0x19')](respondWithResult(_0x2c221b,null))[_0xae3d('0x24')](handleError(_0x2c221b,null));};exports[_0xae3d('0x61')]=function(_0x551269,_0xe340c1){return db[_0xae3d('0x40')][_0xae3d('0x5d')]({'where':{'id':_0x551269[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0xe340c1,null))['then'](function(_0x18c9b0){if(_0x18c9b0){return _0x18c9b0[_0xae3d('0x61')](_0x551269[_0xae3d('0x5f')][_0xae3d('0x62')],_[_0xae3d('0x63')](_0x551269[_0xae3d('0x5f')],['ids','id'])||{});}})[_0xae3d('0x19')](respondWithResult(_0xe340c1,null))[_0xae3d('0x24')](handleError(_0xe340c1,null));};function validateUser(_0x51a078){return new Promise(function(_0x292b03,_0x343584){if(_0x51a078[_0xae3d('0x64')])return _0x292b03(_0x51a078);return db['Setting']['findById'](0x1)[_0xae3d('0x19')](function(_0xbd425b){if(_0xbd425b[_0xae3d('0x65')])authService[_0xae3d('0x66')](_0x51a078[_0xae3d('0x42')]);db[_0xae3d('0x40')][_0xae3d('0x67')]('internal')[_0xae3d('0x19')](function(_0x2e696d){if(_['isNil'](_0x2e696d)){_0x51a078[_0xae3d('0x64')]=_0xbd425b['min_internal']||0x1;return;}if(_[_0xae3d('0x68')](_0xbd425b[_0xae3d('0x69')])||_0xbd425b[_0xae3d('0x69')]===_0x2e696d){_0x51a078[_0xae3d('0x64')]=_0x2e696d+0x1;return;}if(_0xbd425b[_0xae3d('0x69')]>_0x2e696d){_0x51a078['internal']=_0xbd425b[_0xae3d('0x69')];return;}return db[_0xae3d('0x6a')][_0xae3d('0x46')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0xae3d('0x6b')][_0xae3d('0x6c')]})['then'](function(_0x57eb98){if(_0x57eb98&&_0x57eb98[_0xae3d('0x5b')]){for(var _0x5785d8=0x0,_0x388880=_0x57eb98['length'];_0x5785d8<_0x388880&&_['isNil'](_0x51a078['internal']);_0x5785d8++){if(_0xbd425b['min_internal']<=_0x57eb98[_0x5785d8][_0xae3d('0x6d')]){_0x51a078[_0xae3d('0x64')]=_0x57eb98[_0x5785d8]['from'];}else if(_0xbd425b['min_internal']>_0x57eb98[_0x5785d8][_0xae3d('0x6d')]&&_0xbd425b[_0xae3d('0x69')]<=_0x57eb98[_0x5785d8]['to']){_0x51a078[_0xae3d('0x64')]=_0xbd425b[_0xae3d('0x69')];}}}if(_[_0xae3d('0x68')](_0x51a078[_0xae3d('0x64')])){_0x51a078[_0xae3d('0x64')]=_0x2e696d+0x1;}return _0x292b03(_0x51a078);});});})['catch'](function(_0x21cc63){_0x343584(_0x21cc63);});});}function updateUser(_0x3d6aef){return new Promise(function(_0x199993,_0x1ab2e7){try{if(_0x3d6aef[_0xae3d('0x6e')]){_0x3d6aef[_0xae3d('0x6f')]=_0x3d6aef['internal'];_0x3d6aef[_0xae3d('0x70')]={'mailbox':_0x3d6aef[_0xae3d('0x64')],'password':_0x3d6aef['password'],'fullname':_0x3d6aef['fullname'],'email':_0x3d6aef[_0xae3d('0x71')]};}if(_0x3d6aef[_0xae3d('0x30')]==='agent'){if(!_0x3d6aef[_0xae3d('0x72')])_0x3d6aef[_0xae3d('0x72')]=[_0xae3d('0x73'),'102',_0xae3d('0x74'),_0xae3d('0x75'),'110','104',_0xae3d('0x76'),_0xae3d('0x77'),_0xae3d('0x78'),'108',_0xae3d('0x79'),_0xae3d('0x7a'),'111',_0xae3d('0x7b'),_0xae3d('0x7c')];}_0x199993(_0x3d6aef);}catch(_0x37319e){_0x1ab2e7(_0x37319e);}});}exports['create']=function(_0x46ea6a,_0x290335){if(_0x46ea6a[_0xae3d('0x35')]['role']===_0xae3d('0x7d'))throw new Error('Unauthorized');if(_0x46ea6a[_0xae3d('0x5f')]['role']==='user'&&_0x46ea6a[_0xae3d('0x35')]['role']!==_0xae3d('0x33')){throw new Error(_0xae3d('0x7e'));}if(_0x46ea6a[_0xae3d('0x5f')][_0xae3d('0x30')]==='admin'&&_0x46ea6a[_0xae3d('0x35')][_0xae3d('0x30')]!==_0xae3d('0x33')){throw new Error(_0xae3d('0x7f'));}return licenseUtil[_0xae3d('0x80')]([_0x46ea6a[_0xae3d('0x5f')]])[_0xae3d('0x19')](function(){return validateUser(_0x46ea6a[_0xae3d('0x5f')]);})[_0xae3d('0x19')](function(_0x19f797){return updateUser(_0x19f797)[_0xae3d('0x19')](function(_0x331dbb){if(_0x331dbb[_0xae3d('0x30')]===_0xae3d('0x33')){_0x331dbb[_0xae3d('0x81')]=_0x46ea6a[_0xae3d('0x35')][_0xae3d('0x81')];delete _0x331dbb['userProfileId'];}return _0x331dbb;});})[_0xae3d('0x19')](function(_0x48e648){return db[_0xae3d('0x40')][_0xae3d('0x82')](_0x48e648,{'include':[{'model':db[_0xae3d('0x70')],'as':'VoiceMail'}]});})[_0xae3d('0x19')](function(_0x44127e){if(_0x46ea6a[_0xae3d('0x5f')][_0xae3d('0x30')]===_0xae3d('0x35'))return _0x44127e;if(_0x46ea6a[_0xae3d('0x35')][_0xae3d('0x30')]!==_0xae3d('0x35'))return _0x44127e;return db['UserProfileSection'][_0xae3d('0x5d')]({'where':{'name':_0x44127e[_0xae3d('0x30')]===_0xae3d('0x7d')?'Agents':_0xae3d('0x37'),'userProfileId':_0x46ea6a[_0xae3d('0x35')][_0xae3d('0x83')]},'raw':!![]})['then'](function(_0x3451cf){if(!_0x3451cf||_0x3451cf[_0xae3d('0x84')]!=0x0)return _0x44127e;return db['UserProfileResource'][_0xae3d('0x82')]({'name':_0x44127e['name'],'resourceId':_0x44127e['id'],'type':_0x3451cf[_0xae3d('0x3c')],'sectionId':_0x3451cf['id']},{})['then'](function(){return _0x44127e;});})[_0xae3d('0x24')](function(_0x185439){logger[_0xae3d('0x1f')](_0xae3d('0x85'),_0x185439);throw _0x185439;});})[_0xae3d('0x19')](respondWithResult(_0x290335,0xc9))['catch'](handleError(_0x290335,null));};exports[_0xae3d('0x86')]=function(_0x27cf68,_0x53aeea){var _0x546185=_0x27cf68[_0xae3d('0x5f')];var _0x700176=[];if(_0x27cf68[_0xae3d('0x35')][_0xae3d('0x30')]==='agent')throw new Error(_0xae3d('0x87'));if(_[_0xae3d('0x88')](_0x546185,[_0xae3d('0x30'),'user'])&&_0x27cf68['user'][_0xae3d('0x30')]!=='admin'){throw new Error(_0xae3d('0x7e'));}if(_['some'](_0x546185,[_0xae3d('0x30'),_0xae3d('0x33')])&&_0x27cf68[_0xae3d('0x35')][_0xae3d('0x30')]!=='admin'){throw new Error(_0xae3d('0x89'));}return licenseUtil[_0xae3d('0x80')](_0x546185)[_0xae3d('0x19')](function(){return validateUser(_0x546185[0x0]);})['then'](function(){for(var _0xbe7948=0x1;_0xbe7948<_0x546185['length'];_0xbe7948++){var _0x30a9ee=_0x546185[_0xbe7948-0x1][_0xae3d('0x64')];if(!_0x546185[_0xbe7948]['internal'])_0x546185[_0xbe7948]['internal']=_0x30a9ee+0x1;_0x700176[_0xae3d('0x4d')](validateUser(_0x546185[_0xbe7948]));}return Promise['all'](_0x700176);})['then'](function(){_0x700176=[];for(var _0x1e53a9=0x0;_0x1e53a9<_0x546185['length'];_0x1e53a9++){_0x700176[_0xae3d('0x4d')](updateUser(_0x546185[_0x1e53a9]));}return Promise['all'](_0x700176);})[_0xae3d('0x19')](function(){_0x700176=_0x546185['map'](function(_0x27c0ff){return db['User'][_0xae3d('0x82')](_0x27c0ff,{'include':[{'model':db['VoiceMail'],'as':_0xae3d('0x70')}]})[_0xae3d('0x19')](function(_0x394c78){_0x27c0ff['id']=_0x394c78['id'];return _0x27c0ff;});});return Promise[_0xae3d('0x52')](_0x700176);})[_0xae3d('0x19')](function(_0x1c05a5){if(_0x27cf68[_0xae3d('0x5f')][_0xae3d('0x30')]===_0xae3d('0x35'))return _0x1c05a5;if(_0x27cf68['user'][_0xae3d('0x30')]!==_0xae3d('0x35'))return _0x1c05a5;var _0xca73b8=_[_0xae3d('0x88')](_0x1c05a5,function(_0x3a06eb){return _0x3a06eb['role']===_0xae3d('0x7d')||_0x3a06eb[_0xae3d('0x30')]===_0xae3d('0x8a');});if(!_0xca73b8)return _0x1c05a5;return db['UserProfileSection'][_0xae3d('0x8b')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x27cf68[_0xae3d('0x35')]['userProfileId']},'raw':!![]})[_0xae3d('0x19')](function(_0xb5c810){if(_[_0xae3d('0x8c')](_0xb5c810)||!_[_0xae3d('0x88')](_0xb5c810,[_0xae3d('0x84'),0x0]))return _0x1c05a5;_0x700176=[];var _0x5d1e8e=_(_0xb5c810)[_0xae3d('0x39')](function(_0x4230eb){if(_0x4230eb[_0xae3d('0x84')]===0x1)return;return _0x4230eb[_0xae3d('0x3c')]===_0xae3d('0x36')?_0xae3d('0x7d'):'telephone';})['compact']()['value']();for(var _0x50bb54=0x0;_0x50bb54<_0x1c05a5['length'];_0x50bb54++){if(!_[_0xae3d('0x3a')](_0x5d1e8e,_0x1c05a5[_0x50bb54]['role']))return;var _0x4c55ab=_0x1c05a5[_0x50bb54][_0xae3d('0x30')]===_0xae3d('0x7d')?'Agents':'Telephones';_0x700176[_0xae3d('0x4d')](db[_0xae3d('0x3d')][_0xae3d('0x82')]({'name':_0x1c05a5[_0x50bb54][_0xae3d('0x3c')],'resourceId':_0x1c05a5[_0x50bb54]['id'],'type':_0x4c55ab,'sectionId':_[_0xae3d('0x5d')](_0xb5c810,[_0xae3d('0x3c'),_0x4c55ab])['id']},{}));}return Promise[_0xae3d('0x52')](_0x700176);});})[_0xae3d('0x19')](respondWithResult(_0x53aeea,0xc9))[_0xae3d('0x24')](handleError(_0x53aeea,null));};exports[_0xae3d('0x8d')]=function(_0xce0e1c,_0x15a746){if(_0xce0e1c[_0xae3d('0x5f')]['id']){delete _0xce0e1c['body']['id'];}return db['User'][_0xae3d('0x5d')]({'where':{'id':_0xce0e1c['params']['id']}})[_0xae3d('0x19')](function(_0x409e0b){if(!_0x409e0b)return null;if(_0x409e0b['id']===_0xce0e1c[_0xae3d('0x35')]['id']){if(!_0xce0e1c[_0xae3d('0x5f')]['oldPassword']||!_0xce0e1c[_0xae3d('0x5f')][_0xae3d('0x8e')]){throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x409e0b['authenticate'](_0xce0e1c['body']['oldPassword'])){throw new db['Sequelize'][(_0xae3d('0x90'))](_0xae3d('0x91'));}if(_0xce0e1c[_0xae3d('0x5f')][_0xae3d('0x92')]===_0xce0e1c[_0xae3d('0x5f')]['newPassword']){throw new db[(_0xae3d('0x8f'))]['ValidationError'](_0xae3d('0x93'));}}else if(_0xce0e1c[_0xae3d('0x35')][_0xae3d('0x30')]===_0xae3d('0x33')){if(!_0xce0e1c['body']['newPassword']){throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))](_0xae3d('0x94'));}}else if(_0xce0e1c[_0xae3d('0x35')][_0xae3d('0x30')]===_0xae3d('0x35')){if(!_0xce0e1c[_0xae3d('0x5f')][_0xae3d('0x8e')]){throw new db['Sequelize'][(_0xae3d('0x90'))](_0xae3d('0x94'));}if(_0x409e0b['role']!==_0xae3d('0x7d')){throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))](_0xae3d('0x87'));}}else{throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))]('Unauthorized');}return _0x409e0b;})[_0xae3d('0x19')](handleEntityNotFound(_0x15a746,null))[_0xae3d('0x19')](function(_0x44cfb7){return db[_0xae3d('0x95')][_0xae3d('0x96')]({'attributes':['id',_0xae3d('0x65'),_0xae3d('0x97'),_0xae3d('0x98')]})[_0xae3d('0x19')](function(_0x3933f6){if(_0x3933f6['securePassword'])authService['validatePasswordPattern'](_0xce0e1c[_0xae3d('0x5f')][_0xae3d('0x8e')]);if(!_0x3933f6[_0xae3d('0x97')]||!_0x44cfb7[_0xae3d('0x99')])return _0x44cfb7;authService['validatePasswordHistory'](_0xce0e1c[_0xae3d('0x5f')]['newPassword'],_0x44cfb7['previousPasswords'],_0x3933f6[_0xae3d('0x98')]);return _0x44cfb7;})[_0xae3d('0x19')](saveUpdates({'password':_0xce0e1c[_0xae3d('0x5f')][_0xae3d('0x8e')],'passwordResetAt':_0xce0e1c['user']['id']==_0xce0e1c[_0xae3d('0x54')]['id']?moment():null,'previousPasswords':authService[_0xae3d('0x9a')](_0xce0e1c[_0xae3d('0x5f')]['newPassword'],_0x44cfb7[_0xae3d('0x99')])},null));})[_0xae3d('0x19')](respondWithResult(_0x15a746,null))[_0xae3d('0x24')](handleError(_0x15a746,null));};exports['addQueues']=function(_0x4842d8,_0x235831){var _0x30c8c2=_0x4842d8['body'][_0xae3d('0x9b')];return db[_0xae3d('0x40')][_0xae3d('0x5d')]({'where':{'id':_0x4842d8[_0xae3d('0x54')]['id']},'attributes':['id','name','role','online',_0xae3d('0x9c'),_0xae3d('0x9d'),'interface']})[_0xae3d('0x19')](handleEntityNotFound(_0x235831,null))[_0xae3d('0x19')](function(_0x35b418){if(_0x35b418){if(!utils['isValidChannel'](_0x30c8c2)){throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))](_0xae3d('0x9e'));}return _0x35b418[_0xae3d('0x9f')+_[_0xae3d('0xa0')](_0x30c8c2[_0xae3d('0xa1')]())+_0xae3d('0xa2')](_0x4842d8['body'][_0xae3d('0x62')],{'penalty':_0x4842d8[_0xae3d('0x5f')][_0xae3d('0xa3')]||0x0})[_0xae3d('0xa4')](function(_0x31eb2b){for(var _0x1f1c1c=0x0;_0x1f1c1c<_0x4842d8[_0xae3d('0x5f')][_0xae3d('0x62')]['length'];_0x1f1c1c+=0x1){var _0x2c09c6={'UserId':Number(_0x4842d8[_0xae3d('0x54')]['id'])};_0x2c09c6[_['capitalize'](_0x30c8c2[_0xae3d('0xa1')]())+'QueueId']=Number(_0x4842d8['body']['ids'][_0x1f1c1c]);socket[_0xae3d('0xa5')](_0xae3d('0x35')+_[_0xae3d('0xa0')](_0x30c8c2[_0xae3d('0xa1')]())+'Queue:save',_0x2c09c6);}return _0x31eb2b;})['then'](function(){if(_0x30c8c2===_0xae3d('0xa6')){return db[_0xae3d('0xa7')]['findAll']({'where':{'id':_0x4842d8[_0xae3d('0x5f')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0xae3d('0x19')](function(_0x430f40){var _0x1cf7ca=_0x35b418[_0xae3d('0x32')]({'plain':!![]});var _0x5b6a92=[];if(_0x30c8c2===_0xae3d('0xa6')&&_0x1cf7ca[_0xae3d('0x30')]==='agent'&&_0x1cf7ca[_0xae3d('0xa8')]){for(let _0x478875=0x0;_0x478875<_0x430f40[_0xae3d('0x5b')];_0x478875+=0x1){_0x5b6a92['push']({'membername':_0x1cf7ca[_0xae3d('0x3c')],'UserId':_0x1cf7ca['id'],'queue_name':_0x430f40[_0x478875][_0xae3d('0x3c')],'VoiceQueueId':_0x430f40[_0x478875]['id'],'interface':_[_0xae3d('0x68')](_0x1cf7ca[_0xae3d('0xa9')])?util['format']('SIP/%s',_0x1cf7ca[_0xae3d('0x3c')]):_0x1cf7ca['interface'],'paused':_0x1cf7ca['voicePause']||![],'penalty':_0x4842d8[_0xae3d('0x5f')][_0xae3d('0xa3')]||0x0});}return Promise[_0xae3d('0x52')](_0x5b6a92[_0xae3d('0x39')](function(_0x8d7031){return db[_0xae3d('0xaa')][_0xae3d('0xab')](_0x8d7031);}));}return _0x35b418;});}})[_0xae3d('0x19')](respondWithStatusCode(_0x235831,null))['catch'](handleError(_0x235831,null));};exports[_0xae3d('0xac')]=function(_0x3cf26e,_0x3942ff){var _0x49e4c0,_0x28220d;return db[_0xae3d('0x40')]['find']({'where':{'id':_0x3cf26e[_0xae3d('0x54')]['id']},'attributes':['id',_0xae3d('0x3c'),_0xae3d('0x30')]})[_0xae3d('0x19')](handleEntityNotFound(_0x3942ff,null))[_0xae3d('0x19')](function(_0x2826b0){if(_0x2826b0){_0x49e4c0=_0x2826b0;if(!_0x3cf26e[_0xae3d('0x46')][_0xae3d('0x9b')]||!utils[_0xae3d('0xad')](_0x3cf26e[_0xae3d('0x46')]['channel'])){throw new db['Sequelize'][(_0xae3d('0x90'))](_0xae3d('0x9e'));}return _0x2826b0[_0xae3d('0xae')+_[_0xae3d('0xa0')](_0x3cf26e[_0xae3d('0x46')][_0xae3d('0x9b')]['toLowerCase']())+_0xae3d('0xa2')](_0x3cf26e['query'][_0xae3d('0x62')]);}})['then'](function(_0xb58ccf){if(_[_0xae3d('0xaf')](_0x3cf26e[_0xae3d('0x46')]['ids'])){for(var _0x2825e9=0x0;_0x2825e9<_0x3cf26e['query']['ids']['length'];_0x2825e9+=0x1){_0x28220d={'UserId':Number(_0x3cf26e[_0xae3d('0x54')]['id'])};_0x28220d[_[_0xae3d('0xa0')](_0x3cf26e[_0xae3d('0x46')]['channel'][_0xae3d('0xa1')]())+_0xae3d('0xb0')]=Number(_0x3cf26e[_0xae3d('0x46')][_0xae3d('0x62')][_0x2825e9]);socket[_0xae3d('0xa5')](_0xae3d('0x35')+_[_0xae3d('0xa0')](_0x3cf26e['query']['channel']['toLowerCase']())+_0xae3d('0xb1'),_0x28220d);}}else{_0x28220d={'UserId':Number(_0x3cf26e[_0xae3d('0x54')]['id'])};_0x28220d[_[_0xae3d('0xa0')](_0x3cf26e['query'][_0xae3d('0x9b')][_0xae3d('0xa1')]())+_0xae3d('0xb0')]=Number(_0x3cf26e[_0xae3d('0x46')][_0xae3d('0x62')]);socket[_0xae3d('0xa5')]('user'+_[_0xae3d('0xa0')](_0x3cf26e[_0xae3d('0x46')]['channel']['toLowerCase']())+_0xae3d('0xb1'),_0x28220d);}return _0xb58ccf;})[_0xae3d('0x19')](function(){if(_0x3cf26e['query']['channel']===_0xae3d('0xa6')){return db[_0xae3d('0xaa')][_0xae3d('0x31')]({'where':{'UserId':_0x3cf26e[_0xae3d('0x54')]['id'],'VoiceQueueId':_0x3cf26e['query']['ids']},'individualHooks':!![]})[_0xae3d('0x19')](function(){return _0x49e4c0;});}return _0x49e4c0;})[_0xae3d('0x19')](respondWithStatusCode(_0x3942ff,null))[_0xae3d('0x24')](handleError(_0x3942ff,null));};exports['addAvatar']=function(_0x3a71cc,_0x10faf7){_0x3a71cc[_0xae3d('0x5f')][_0xae3d('0xb2')]=_0x3a71cc['file'][_0xae3d('0xb3')];return db[_0xae3d('0x40')][_0xae3d('0x5d')]({'where':{'id':_0x3a71cc[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x10faf7,null))[_0xae3d('0x19')](saveUpdates(_0x3a71cc[_0xae3d('0x5f')],null))['then'](respondWithResult(_0x10faf7,null))[_0xae3d('0x24')](handleError(_0x10faf7,null));};exports[_0xae3d('0xb4')]=function(_0x244fd3,_0x34c90e){var _0x53945e=path[_0xae3d('0xb5')](config[_0xae3d('0xb6')],_0xae3d('0xb7'));return db[_0xae3d('0x40')][_0xae3d('0x5d')]({'where':{'id':_0x244fd3[_0xae3d('0x54')]['id']},'attributes':['id',_0xae3d('0xb2')],'raw':!![]})['then'](handleEntityNotFound(_0x34c90e,null))[_0xae3d('0x19')](function(_0x503524){if(_0x503524){if(_['isNil'](_0x503524['userpic'])){return _0x34c90e[_0xae3d('0xb8')](_0x53945e);}else{if(!fs[_0xae3d('0xb9')](path[_0xae3d('0xb5')](config[_0xae3d('0xb6')],_0xae3d('0xba'),_0x503524[_0xae3d('0xb2')]))){return _0x34c90e['download'](_0x53945e);}return _0x34c90e['download'](path[_0xae3d('0xb5')](config[_0xae3d('0xb6')],_0xae3d('0xba'),_0x503524['userpic']));}}})[_0xae3d('0x24')](handleError(_0x34c90e,null));};exports[_0xae3d('0xbb')]=function(_0x8fa3c9,_0x15ea05){return db[_0xae3d('0x40')][_0xae3d('0x5d')]({'where':{'id':_0x8fa3c9[_0xae3d('0x54')]['id']},'attributes':['id']})[_0xae3d('0x19')](handleEntityNotFound(_0x15ea05,null))[_0xae3d('0x19')](function(_0x20974e){var _0x22ff07=[];values=_0x20974e[_0xae3d('0x4e')];_0x22ff07[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0xbc'),_0x20974e[_0xae3d('0x4e')]));_0x22ff07['push'](get_open_tabs(_0xae3d('0x4f'),_0x20974e['dataValues']));_0x22ff07[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x51'),_0x20974e[_0xae3d('0x4e')]));_0x22ff07[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0xbd'),_0x20974e[_0xae3d('0x4e')]));_0x22ff07[_0xae3d('0x4d')](get_open_tabs('fax',_0x20974e[_0xae3d('0x4e')]));_0x22ff07[_0xae3d('0x4d')](get_open_tabs(_0xae3d('0x5e'),_0x20974e['dataValues']));return Promise[_0xae3d('0x52')](_0x22ff07);})['then'](function(_0x9f34be){if(_0x9f34be){var _0x658386=_[_0xae3d('0x39')](values['ChatOpenTabs'],function(_0x22ff21){return{'channel':_0xae3d('0xbe'),'id':_0x22ff21['id'],'createdAt':_0x22ff21[_0xae3d('0xbf')]};});var _0x4c9936=_['map'](values[_0xae3d('0xc0')],function(_0x504340){return{'channel':'FAX','id':_0x504340['id'],'createdAt':_0x504340[_0xae3d('0xbf')]};});var _0x194fd4=_[_0xae3d('0x39')](values[_0xae3d('0xc1')],function(_0x2fbb90){return{'channel':'OPENCHANNEL','id':_0x2fbb90['id'],'createdAt':_0x2fbb90['createdAt']};});var _0x544262=_[_0xae3d('0x39')](values[_0xae3d('0xc2')],function(_0x4e5d82){return{'channel':_0xae3d('0xc3'),'id':_0x4e5d82['id'],'createdAt':_0x4e5d82[_0xae3d('0xbf')]};});var _0x130bc9=_[_0xae3d('0x39')](values[_0xae3d('0xc4')],function(_0x55a165){return{'channel':_0xae3d('0xc5'),'id':_0x55a165['id'],'createdAt':_0x55a165['createdAt']};});var _0x58f79a=_[_0xae3d('0x39')](values['WhatsappOpenTabs'],function(_0x7d6d2d){return{'channel':_0xae3d('0xc6'),'id':_0x7d6d2d['id'],'createdAt':_0x7d6d2d['createdAt']};});var _0x455c5d=_['concat'](_0x658386,_0x4c9936,_0x194fd4,_0x544262,_0x130bc9,_0x58f79a);var _0x261675={'count':_0x455c5d[_0xae3d('0x5b')],'rows':_0x455c5d};return _0x261675;}else return null;})['then'](respondWithResult(_0x15ea05,null))[_0xae3d('0x24')](handleError(_0x15ea05,null));};exports[_0xae3d('0xc7')]=function(_0x5d12c7,_0x48d759){var _0x1a8f2b={};return db['User'][_0xae3d('0x96')]({'where':{'id':_0x5d12c7[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](function(_0x43bb9c){if(!_0x43bb9c){throw new APINotFoundError(util[_0xae3d('0xc8')](_0xae3d('0xc9'),_0x5d12c7[_0xae3d('0x54')]['id']));}return contacts[_0xae3d('0x60')]();})['then'](function(_0x13e865){_0x5d12c7[_0xae3d('0x46')]['User']=_0x5d12c7[_0xae3d('0x54')]['id'];_0x1a8f2b=qs['getOptions'](_0x13e865,_0x5d12c7);if(_0x5d12c7[_0xae3d('0x46')][_0xae3d('0xca')](_0xae3d('0x45'))){_0x1a8f2b[_0xae3d('0x49')]=[{'model':db[_0xae3d('0xcb')],'as':'List','required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xae3d('0x3c'),_0xae3d('0xcc')],'where':_0x5d12c7[_0xae3d('0x46')][_0xae3d('0xcd')]?{'id':_0x5d12c7[_0xae3d('0x46')][_0xae3d('0xcd')]}:undefined,'required':_0x5d12c7['query']['tag']?!![]:![]}];}return contacts['findAll'](_0x5d12c7[_0xae3d('0x46')],_0x5d12c7[_0xae3d('0x35')],_0x1a8f2b,_0x13e865);})[_0xae3d('0x19')](respondWithFilteredResult(_0x48d759,_0x1a8f2b))[_0xae3d('0x24')](APIHandleError(_0x48d759));};exports[_0xae3d('0xce')]=function(_0x599e9b,_0x202408){var _0x37aa5d;var _0x366ccc={};var _0x58c4e1;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x599e9b[_0xae3d('0x54')]['id']},'attributes':['id',_0xae3d('0x3c'),_0xae3d('0x30')]})['then'](handleEntityNotFound(_0x202408,null))['then'](function(_0xe32118){if(!utils[_0xae3d('0xad')](_0x599e9b[_0xae3d('0x46')][_0xae3d('0x9b')])){throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))](_0xae3d('0x9e'));}_0x37aa5d=_0xe32118;var _0x137328={};_0x137328[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_[_0xae3d('0xa0')](_0x599e9b[_0xae3d('0x46')][_0xae3d('0x9b')])+_0xae3d('0xcf')][_0xae3d('0x58')]);_0x137328[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x599e9b[_0xae3d('0x46')]);_0x137328['filters']=_[_0xae3d('0x59')](_0x137328['model'],_0x137328[_0xae3d('0x46')]);_0x366ccc[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x137328[_0xae3d('0x55')],qs['fields'](_0x599e9b[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x366ccc[_0xae3d('0x4a')]=_0x366ccc[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x366ccc[_0xae3d('0x4a')]:_0x137328[_0xae3d('0x55')];_0x366ccc[_0xae3d('0xd0')]=qs['sort'](_0x599e9b['query'][_0xae3d('0xd1')]);_0x366ccc[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_['pick'](_0x599e9b[_0xae3d('0x46')],_0x137328['filters']));if(_0x599e9b[_0xae3d('0x46')]['filter']){_0x366ccc[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x366ccc['where'],{'$or':_['map'](_0x366ccc['attributes'],function(_0x4d1a5c){var _0x32e65c={};_0x32e65c[_0x4d1a5c]={'$like':'%'+_0x599e9b['query'][_0xae3d('0x38')]+'%'};return _0x32e65c;})});}_0x366ccc=_[_0xae3d('0x5c')]({},_0x366ccc,_0x599e9b[_0xae3d('0xd4')]);switch(_0x37aa5d[_0xae3d('0x30')]){case'admin':return db[_['capitalize'](_0x599e9b[_0xae3d('0x46')][_0xae3d('0x9b')])+_0xae3d('0xcf')][_0xae3d('0x8b')](_0x366ccc);case _0xae3d('0x35'):case _0xae3d('0x7d'):return _0x37aa5d['get'+_[_0xae3d('0xa0')](_0x599e9b[_0xae3d('0x46')][_0xae3d('0x9b')])+'Queues'](_0x366ccc);default:throw new db[(_0xae3d('0x8f'))]['ValidationError'](_0xae3d('0xd5'));}})['then'](function(_0x1b69bb){_0x58c4e1=_0x1b69bb[_0xae3d('0x5b')];if(!_0x599e9b[_0xae3d('0x46')][_0xae3d('0xca')]('nolimit')){_0x366ccc['limit']=qs[_0xae3d('0x2b')](_0x599e9b[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x366ccc[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x599e9b['query'][_0xae3d('0x29')]);}switch(_0x37aa5d['role']){case _0xae3d('0x33'):return db[_[_0xae3d('0xa0')](_0x599e9b[_0xae3d('0x46')]['channel'])+_0xae3d('0xcf')][_0xae3d('0x8b')](_0x366ccc);case'user':case _0xae3d('0x7d'):return _0x37aa5d[_0xae3d('0x32')+_['capitalize'](_0x599e9b['query'][_0xae3d('0x9b')])+'Queues'](_0x366ccc);}})[_0xae3d('0x19')](function(_0x4c5913){return{'count':_0x58c4e1,'rows':_0x4c5913};})[_0xae3d('0x19')](respondWithResult(_0x202408,null))['catch'](handleError(_0x202408,null));};exports['getVoiceQueuesRt']=function(_0x6b81b4,_0x42670a){var _0x2bdb9c={};var _0x4b5896={};var _0x3406b9;var _0x52435a;return db['User'][_0xae3d('0x96')]({'where':{'id':_0x6b81b4['params']['id']}})['then'](handleEntityNotFound(_0x42670a,null))['then'](function(_0x137dbb){if(_0x137dbb){_0x3406b9=_0x137dbb;_0x4b5896[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0xaa')][_0xae3d('0x58')]);_0x4b5896['query']=_[_0xae3d('0x57')](_0x6b81b4['query']);_0x4b5896[_0xae3d('0xd3')]=_['intersection'](_0x4b5896['model'],_0x4b5896['query']);_0x2bdb9c[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x4b5896[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x6b81b4[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x2bdb9c[_0xae3d('0x4a')]=_0x2bdb9c[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x2bdb9c[_0xae3d('0x4a')]:_0x4b5896[_0xae3d('0x55')];_0x2bdb9c[_0xae3d('0xd0')]=qs['sort'](_0x6b81b4['query'][_0xae3d('0xd1')]);_0x2bdb9c[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_[_0xae3d('0xd6')](_0x6b81b4[_0xae3d('0x46')],_0x4b5896[_0xae3d('0xd3')]));if(_0x6b81b4[_0xae3d('0x46')][_0xae3d('0x38')]){_0x2bdb9c[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x2bdb9c[_0xae3d('0xd2')],{'$or':_[_0xae3d('0x39')](_0x2bdb9c[_0xae3d('0x4a')],function(_0xa38f4b){var _0x5d8275={};_0x5d8275[_0xa38f4b]={'$like':'%'+_0x6b81b4[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x5d8275;})});}_0x2bdb9c=_['merge']({},_0x2bdb9c,_0x6b81b4[_0xae3d('0xd4')]);return _0x3406b9[_0xae3d('0xd7')](_0x2bdb9c);}})[_0xae3d('0x19')](function(_0x43e030){if(_0x43e030){_0x52435a=_0x43e030['length'];if(!_0x6b81b4[_0xae3d('0x46')][_0xae3d('0xca')](_0xae3d('0xd8'))){_0x2bdb9c[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x6b81b4[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x2bdb9c[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x6b81b4[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0x3406b9[_0xae3d('0xd7')](_0x2bdb9c);}})[_0xae3d('0x19')](function(_0x3cfa32){if(_0x3cfa32){return _0x3cfa32?{'count':_0x52435a,'rows':_0x3cfa32}:null;}})[_0xae3d('0x19')](respondWithResult(_0x42670a,null))[_0xae3d('0x24')](handleError(_0x42670a,null));};exports[_0xae3d('0xd9')]=function(_0x51145e,_0x4eddf0){var _0x2d8e07={};var _0x307d5e={};var _0x23dea6;var _0x201984;return db['User'][_0xae3d('0x96')]({'where':{'id':_0x51145e['params']['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x4eddf0,null))['then'](function(_0x2c9c73){if(_0x2c9c73){_0x23dea6=_0x2c9c73;_0x307d5e[_0xae3d('0x55')]=_['keys'](db[_0xae3d('0xda')][_0xae3d('0x58')]);_0x307d5e[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x51145e[_0xae3d('0x46')]);_0x307d5e[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x307d5e[_0xae3d('0x55')],_0x307d5e['query']);_0x2d8e07['attributes']=_[_0xae3d('0x59')](_0x307d5e[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x51145e[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x2d8e07[_0xae3d('0x4a')]=_0x2d8e07[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x2d8e07[_0xae3d('0x4a')]:_0x307d5e[_0xae3d('0x55')];_0x2d8e07[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x51145e[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x2d8e07['where']=qs['filters'](_[_0xae3d('0xd6')](_0x51145e[_0xae3d('0x46')],_0x307d5e[_0xae3d('0xd3')]));if(_0x51145e[_0xae3d('0x46')][_0xae3d('0x38')]){_0x2d8e07[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x2d8e07['where'],{'$or':_[_0xae3d('0x39')](_0x2d8e07['attributes'],function(_0x47e5c1){var _0x58bb34={};_0x58bb34[_0x47e5c1]={'$like':'%'+_0x51145e[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x58bb34;})});}_0x2d8e07=_[_0xae3d('0x5c')]({},_0x2d8e07,_0x51145e[_0xae3d('0xd4')]);return _0x23dea6[_0xae3d('0xd9')](_0x2d8e07);}})[_0xae3d('0x19')](function(_0x6c5043){if(_0x6c5043){_0x201984=_0x6c5043[_0xae3d('0x5b')];if(!_0x51145e[_0xae3d('0x46')][_0xae3d('0xca')]('nolimit')){_0x2d8e07[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x51145e[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x2d8e07[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x51145e[_0xae3d('0x46')]['offset']);}return _0x23dea6[_0xae3d('0xd9')](_0x2d8e07);}})[_0xae3d('0x19')](function(_0x3ecc00){if(_0x3ecc00){return _0x3ecc00?{'count':_0x201984,'rows':_0x3ecc00}:null;}})[_0xae3d('0x19')](respondWithResult(_0x4eddf0,null))['catch'](handleError(_0x4eddf0,null));};exports['getRecordings']=function(_0x3ee2cd,_0x2d3531){var _0x53529d={'raw':!![],'where':{}};var _0x4625a3={};var _0x3f8f19={'count':0x0,'rows':[]};return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x3ee2cd[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x2d3531,null))[_0xae3d('0x19')](function(_0x361d9e){if(_0x361d9e){_0x4625a3['model']=_[_0xae3d('0x57')](db[_0xae3d('0xdb')][_0xae3d('0x58')]);_0x4625a3[_0xae3d('0x46')]=_['keys'](_0x3ee2cd[_0xae3d('0x46')]);_0x4625a3[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x4625a3['model'],_0x4625a3['query']);_0x53529d[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x4625a3[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x3ee2cd[_0xae3d('0x46')]['fields']));_0x53529d[_0xae3d('0x4a')]=_0x53529d[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x53529d['attributes']:_0x4625a3[_0xae3d('0x55')];if(!_0x3ee2cd[_0xae3d('0x46')][_0xae3d('0xca')](_0xae3d('0xd8'))){_0x53529d['limit']=qs[_0xae3d('0x2b')](_0x3ee2cd[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x53529d[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x3ee2cd['query'][_0xae3d('0x29')]);}_0x53529d['order']=qs[_0xae3d('0xd1')](_0x3ee2cd['query']['sort']);_0x53529d['where']=qs['filters'](_[_0xae3d('0xd6')](_0x3ee2cd[_0xae3d('0x46')],_0x4625a3['filters']));_0x53529d[_0xae3d('0xd2')]['UserId']=_0x361d9e['id'];if(_0x3ee2cd[_0xae3d('0x46')][_0xae3d('0x38')]){_0x53529d['where']=_['merge'](_0x53529d[_0xae3d('0xd2')],{'$or':_[_0xae3d('0x39')](_0x53529d[_0xae3d('0x4a')],function(_0x191c4c){var _0x4a5066={};_0x4a5066[_0x191c4c]={'$like':'%'+_0x3ee2cd['query'][_0xae3d('0x38')]+'%'};return _0x4a5066;})});}_0x53529d=_[_0xae3d('0x5c')]({},_0x53529d,_0x3ee2cd['options']);return db[_0xae3d('0xdb')]['count']({'where':_0x53529d[_0xae3d('0xd2')]})[_0xae3d('0x19')](function(_0x1f835f){_0x3f8f19[_0xae3d('0x2c')]=_0x1f835f;if(_0x3ee2cd[_0xae3d('0x46')][_0xae3d('0x45')]){_0x53529d[_0xae3d('0x49')]=[{'all':!![]}];}return db[_0xae3d('0xdb')][_0xae3d('0x8b')](_0x53529d);})[_0xae3d('0x19')](function(_0x1895f1){_0x3f8f19[_0xae3d('0x4b')]=_0x1895f1;return _0x3f8f19;});}})[_0xae3d('0x19')](respondWithFilteredResult(_0x2d3531,_0x53529d))[_0xae3d('0x24')](handleError(_0x2d3531,null));};exports[_0xae3d('0xdc')]=function(_0xbaa09d,_0x25156f){var _0x36ff79={'raw':!![],'where':{}};var _0x54f128={};var _0x555766={'count':0x0,'rows':[]};return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0xbaa09d[_0xae3d('0x54')]['id']}})['then'](handleEntityNotFound(_0x25156f,null))['then'](function(_0xf26482){if(_0xf26482){_0x54f128[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0xdd')][_0xae3d('0x58')]);_0x54f128[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0xbaa09d['query']);_0x54f128[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x54f128[_0xae3d('0x55')],_0x54f128[_0xae3d('0x46')]);_0x36ff79[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x54f128[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0xbaa09d[_0xae3d('0x46')]['fields']));_0x36ff79[_0xae3d('0x4a')]=_0x36ff79[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x36ff79['attributes']:_0x54f128['model'];if(!_0xbaa09d[_0xae3d('0x46')][_0xae3d('0xca')]('nolimit')){_0x36ff79[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0xbaa09d[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x36ff79['offset']=qs[_0xae3d('0x29')](_0xbaa09d['query'][_0xae3d('0x29')]);}_0x36ff79[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0xbaa09d[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x36ff79[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_['pick'](_0xbaa09d[_0xae3d('0x46')],_0x54f128[_0xae3d('0xd3')]));_0x36ff79[_0xae3d('0xd2')][_0xae3d('0xde')]=_0xf26482['id'];if(_0xbaa09d[_0xae3d('0x46')][_0xae3d('0x38')]){_0x36ff79[_0xae3d('0xd2')]=_['merge'](_0x36ff79[_0xae3d('0xd2')],{'$or':_['map'](_0x36ff79[_0xae3d('0x4a')],function(_0x5bca26){var _0x4e2782={};_0x4e2782[_0x5bca26]={'$like':'%'+_0xbaa09d[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x4e2782;})});}_0x36ff79=_[_0xae3d('0x5c')]({},_0x36ff79,_0xbaa09d['options']);return db[_0xae3d('0xdd')][_0xae3d('0x2c')]({'where':_0x36ff79[_0xae3d('0xd2')]})[_0xae3d('0x19')](function(_0x4d1f46){_0x555766[_0xae3d('0x2c')]=_0x4d1f46;if(_0xbaa09d[_0xae3d('0x46')][_0xae3d('0x45')]){_0x36ff79[_0xae3d('0x49')]=[{'all':!![]}];}return db[_0xae3d('0xdd')][_0xae3d('0x8b')](_0x36ff79);})['then'](function(_0xcfa9a6){_0x555766[_0xae3d('0x4b')]=_0xcfa9a6;return _0x555766;});}})[_0xae3d('0x19')](respondWithFilteredResult(_0x25156f,_0x36ff79))[_0xae3d('0x24')](handleError(_0x25156f,null));};exports[_0xae3d('0xdf')]=function(_0x35512d,_0x1d8335){var _0x18b044={};var _0x4ef407={};var _0x2b0cbc;var _0x3af90c;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x35512d[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x1d8335,null))[_0xae3d('0x19')](function(_0x284ffd){if(_0x284ffd){_0x2b0cbc=_0x284ffd;_0x4ef407['model']=_['keys'](db['ChatInteraction'][_0xae3d('0x58')]);_0x4ef407['query']=_[_0xae3d('0x57')](_0x35512d[_0xae3d('0x46')]);_0x4ef407['filters']=_[_0xae3d('0x59')](_0x4ef407[_0xae3d('0x55')],_0x4ef407[_0xae3d('0x46')]);_0x18b044[_0xae3d('0x4a')]=_['intersection'](_0x4ef407['model'],qs[_0xae3d('0x5a')](_0x35512d[_0xae3d('0x46')]['fields']));_0x18b044['attributes']=_0x18b044['attributes'][_0xae3d('0x5b')]?_0x18b044[_0xae3d('0x4a')]:_0x4ef407[_0xae3d('0x55')];_0x18b044[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x35512d[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x18b044[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_['pick'](_0x35512d[_0xae3d('0x46')],_0x4ef407[_0xae3d('0xd3')]));if(_0x35512d['query']['filter']){_0x18b044[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x18b044[_0xae3d('0xd2')],{'$or':_[_0xae3d('0x39')](_0x18b044[_0xae3d('0x4a')],function(_0x4db76a){var _0x4398e2={};_0x4398e2[_0x4db76a]={'$like':'%'+_0x35512d['query'][_0xae3d('0x38')]+'%'};return _0x4398e2;})});}_0x18b044=_['merge']({},_0x18b044,_0x35512d[_0xae3d('0xd4')]);return _0x2b0cbc[_0xae3d('0xdf')](_0x18b044);}})[_0xae3d('0x19')](function(_0x11beb5){if(_0x11beb5){_0x3af90c=_0x11beb5[_0xae3d('0x5b')];if(!_0x35512d['query'][_0xae3d('0xca')](_0xae3d('0xd8'))){_0x18b044[_0xae3d('0x2b')]=qs['limit'](_0x35512d['query'][_0xae3d('0x2b')]);_0x18b044[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x35512d[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0x2b0cbc['getChatInteractions'](_0x18b044);}})[_0xae3d('0x19')](function(_0x5b4436){if(_0x5b4436){return _0x5b4436?{'count':_0x3af90c,'rows':_0x5b4436}:null;}})[_0xae3d('0x19')](respondWithResult(_0x1d8335,null))[_0xae3d('0x24')](handleError(_0x1d8335,null));};exports[_0xae3d('0xe0')]=function(_0x3c946c,_0x3f51af){var _0x1f6365={};var _0x270f65={};var _0x32b8f5;var _0x52cada;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x3c946c[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x3f51af,null))[_0xae3d('0x19')](function(_0x2b1fde){if(_0x2b1fde){_0x32b8f5=_0x2b1fde;_0x270f65['model']=_[_0xae3d('0x57')](db[_0xae3d('0xe1')][_0xae3d('0x58')]);_0x270f65[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x3c946c['query']);_0x270f65[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x270f65['model'],_0x270f65[_0xae3d('0x46')]);_0x1f6365[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x270f65[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x3c946c[_0xae3d('0x46')]['fields']));_0x1f6365['attributes']=_0x1f6365[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x1f6365[_0xae3d('0x4a')]:_0x270f65['model'];_0x1f6365['order']=qs[_0xae3d('0xd1')](_0x3c946c[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x1f6365[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_[_0xae3d('0xd6')](_0x3c946c[_0xae3d('0x46')],_0x270f65[_0xae3d('0xd3')]));if(_0x3c946c[_0xae3d('0x46')][_0xae3d('0x38')]){_0x1f6365[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x1f6365[_0xae3d('0xd2')],{'$or':_[_0xae3d('0x39')](_0x1f6365[_0xae3d('0x4a')],function(_0x1df4e4){var _0x580ef8={};_0x580ef8[_0x1df4e4]={'$like':'%'+_0x3c946c['query'][_0xae3d('0x38')]+'%'};return _0x580ef8;})});}_0x1f6365=_[_0xae3d('0x5c')]({},_0x1f6365,_0x3c946c[_0xae3d('0xd4')]);return _0x32b8f5[_0xae3d('0xe0')](_0x1f6365);}})[_0xae3d('0x19')](function(_0x1772f2){if(_0x1772f2){_0x52cada=_0x1772f2['length'];if(!_0x3c946c[_0xae3d('0x46')]['hasOwnProperty'](_0xae3d('0xd8'))){_0x1f6365['limit']=qs[_0xae3d('0x2b')](_0x3c946c['query'][_0xae3d('0x2b')]);_0x1f6365[_0xae3d('0x29')]=qs['offset'](_0x3c946c['query']['offset']);}return _0x32b8f5['getOpenchannelInteractions'](_0x1f6365);}})['then'](function(_0x1e8a48){if(_0x1e8a48){return _0x1e8a48?{'count':_0x52cada,'rows':_0x1e8a48}:null;}})[_0xae3d('0x19')](respondWithResult(_0x3f51af,null))[_0xae3d('0x24')](handleError(_0x3f51af,null));};exports[_0xae3d('0xe2')]=function(_0x3e9f5e,_0x7c302){var _0x1116fa={'raw':!![],'where':{}};var _0x15093a={};var _0x33352e={'count':0x0,'rows':[]};return db['User'][_0xae3d('0x96')]({'where':{'id':_0x3e9f5e['params']['id']}})['then'](handleEntityNotFound(_0x7c302,null))['then'](function(_0x8bbf91){if(_0x8bbf91){_0x15093a['model']=_[_0xae3d('0x57')](db[_0xae3d('0xe3')][_0xae3d('0x58')]);_0x15093a[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x3e9f5e[_0xae3d('0x46')]);_0x15093a['filters']=_['intersection'](_0x15093a[_0xae3d('0x55')],_0x15093a[_0xae3d('0x46')]);_0x1116fa[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x15093a['model'],qs['fields'](_0x3e9f5e[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x1116fa[_0xae3d('0x4a')]=_0x1116fa['attributes'][_0xae3d('0x5b')]?_0x1116fa[_0xae3d('0x4a')]:_0x15093a[_0xae3d('0x55')];if(!_0x3e9f5e['query']['hasOwnProperty'](_0xae3d('0xd8'))){_0x1116fa['limit']=qs[_0xae3d('0x2b')](_0x3e9f5e[_0xae3d('0x46')]['limit']);_0x1116fa[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x3e9f5e[_0xae3d('0x46')]['offset']);}_0x1116fa[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x3e9f5e[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x1116fa[_0xae3d('0xd2')]=qs['filters'](_[_0xae3d('0xd6')](_0x3e9f5e[_0xae3d('0x46')],_0x15093a[_0xae3d('0xd3')]));_0x1116fa[_0xae3d('0xd2')]['UserId']=_0x8bbf91['id'];if(_0x3e9f5e[_0xae3d('0x46')][_0xae3d('0x38')]){_0x1116fa[_0xae3d('0xd2')]=_['merge'](_0x1116fa['where'],{'$or':_[_0xae3d('0x39')](_0x1116fa[_0xae3d('0x4a')],function(_0xd14b41){var _0x46cf22={};_0x46cf22[_0xd14b41]={'$like':'%'+_0x3e9f5e[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x46cf22;})});}_0x1116fa=_[_0xae3d('0x5c')]({},_0x1116fa,_0x3e9f5e[_0xae3d('0xd4')]);return db[_0xae3d('0xe3')][_0xae3d('0x2c')]({'where':_0x1116fa[_0xae3d('0xd2')]})['then'](function(_0x39ba4d){_0x33352e['count']=_0x39ba4d;if(_0x3e9f5e[_0xae3d('0x46')]['includeAll']){_0x1116fa[_0xae3d('0x49')]=[{'all':!![]}];}return db[_0xae3d('0xe3')]['findAll'](_0x1116fa);})[_0xae3d('0x19')](function(_0x31d8c7){_0x33352e['rows']=_0x31d8c7;return _0x33352e;});}})[_0xae3d('0x19')](respondWithFilteredResult(_0x7c302,_0x1116fa))[_0xae3d('0x24')](handleError(_0x7c302,null));};exports[_0xae3d('0xe4')]=function(_0x5918e8,_0x4cf329){var _0x3b8b32={};var _0x2f9ffe={};var _0xa741b3;var _0x461e36;return db[_0xae3d('0x40')]['findOne']({'where':{'id':_0x5918e8['params']['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x4cf329,null))[_0xae3d('0x19')](function(_0x1592f2){if(_0x1592f2){_0xa741b3=_0x1592f2;_0x2f9ffe[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0xe5')][_0xae3d('0x58')]);_0x2f9ffe[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x5918e8[_0xae3d('0x46')]);_0x2f9ffe[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x2f9ffe[_0xae3d('0x55')],_0x2f9ffe['query']);_0x3b8b32['attributes']=_[_0xae3d('0x59')](_0x2f9ffe[_0xae3d('0x55')],qs['fields'](_0x5918e8[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x3b8b32[_0xae3d('0x4a')]=_0x3b8b32[_0xae3d('0x4a')]['length']?_0x3b8b32[_0xae3d('0x4a')]:_0x2f9ffe[_0xae3d('0x55')];_0x3b8b32[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x5918e8[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x3b8b32[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_[_0xae3d('0xd6')](_0x5918e8[_0xae3d('0x46')],_0x2f9ffe[_0xae3d('0xd3')]));if(_0x5918e8['query']['filter']){_0x3b8b32['where']=_[_0xae3d('0x5c')](_0x3b8b32[_0xae3d('0xd2')],{'$or':_['map'](_0x3b8b32['attributes'],function(_0x49645b){var _0x54e7d6={};_0x54e7d6[_0x49645b]={'$like':'%'+_0x5918e8['query'][_0xae3d('0x38')]+'%'};return _0x54e7d6;})});}_0x3b8b32=_[_0xae3d('0x5c')]({},_0x3b8b32,_0x5918e8[_0xae3d('0xd4')]);return _0xa741b3[_0xae3d('0xe4')](_0x3b8b32);}})[_0xae3d('0x19')](function(_0x5ee6ac){if(_0x5ee6ac){_0x461e36=_0x5ee6ac[_0xae3d('0x5b')];if(!_0x5918e8[_0xae3d('0x46')][_0xae3d('0xca')](_0xae3d('0xd8'))){_0x3b8b32[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x5918e8[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x3b8b32[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x5918e8[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0xa741b3[_0xae3d('0xe4')](_0x3b8b32);}})[_0xae3d('0x19')](function(_0x39f67f){if(_0x39f67f){return _0x39f67f?{'count':_0x461e36,'rows':_0x39f67f}:null;}})[_0xae3d('0x19')](respondWithResult(_0x4cf329,null))['catch'](handleError(_0x4cf329,null));};exports[_0xae3d('0xe6')]=function(_0x22ecdc,_0x2934ba){var _0xa9c3dc={};var _0x5c129c={};var _0x204879;var _0xb7511e;return db['User'][_0xae3d('0x96')]({'where':{'id':_0x22ecdc[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x2934ba,null))[_0xae3d('0x19')](function(_0x1da81d){if(_0x1da81d){_0x204879=_0x1da81d;_0x5c129c['model']=_[_0xae3d('0x57')](db[_0xae3d('0xe7')][_0xae3d('0x58')]);_0x5c129c['query']=_[_0xae3d('0x57')](_0x22ecdc[_0xae3d('0x46')]);_0x5c129c[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x5c129c[_0xae3d('0x55')],_0x5c129c['query']);_0xa9c3dc['attributes']=_[_0xae3d('0x59')](_0x5c129c[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x22ecdc[_0xae3d('0x46')]['fields']));_0xa9c3dc[_0xae3d('0x4a')]=_0xa9c3dc[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0xa9c3dc[_0xae3d('0x4a')]:_0x5c129c[_0xae3d('0x55')];_0xa9c3dc[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x22ecdc[_0xae3d('0x46')]['sort']);_0xa9c3dc[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_['pick'](_0x22ecdc[_0xae3d('0x46')],_0x5c129c[_0xae3d('0xd3')]));if(_0x22ecdc[_0xae3d('0x46')][_0xae3d('0x38')]){_0xa9c3dc[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0xa9c3dc[_0xae3d('0xd2')],{'$or':_[_0xae3d('0x39')](_0xa9c3dc['attributes'],function(_0x283ee2){var _0x1ad452={};_0x1ad452[_0x283ee2]={'$like':'%'+_0x22ecdc[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x1ad452;})});}_0xa9c3dc=_[_0xae3d('0x5c')]({},_0xa9c3dc,_0x22ecdc[_0xae3d('0xd4')]);return _0x204879[_0xae3d('0xe6')](_0xa9c3dc);}})[_0xae3d('0x19')](function(_0x30e3e8){if(_0x30e3e8){_0xb7511e=_0x30e3e8['length'];if(!_0x22ecdc['query']['hasOwnProperty'](_0xae3d('0xd8'))){_0xa9c3dc[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x22ecdc[_0xae3d('0x46')][_0xae3d('0x2b')]);_0xa9c3dc['offset']=qs[_0xae3d('0x29')](_0x22ecdc[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0x204879[_0xae3d('0xe6')](_0xa9c3dc);}})[_0xae3d('0x19')](function(_0x3d33dc){if(_0x3d33dc){return _0x3d33dc?{'count':_0xb7511e,'rows':_0x3d33dc}:null;}})['then'](respondWithResult(_0x2934ba,null))[_0xae3d('0x24')](handleError(_0x2934ba,null));};exports[_0xae3d('0xe8')]=function(_0x1f167f,_0x15f524){var _0x590845={};var _0x406e9d={};var _0x454fac;var _0x1f345a;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x1f167f[_0xae3d('0x54')]['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x15f524,null))[_0xae3d('0x19')](function(_0x5c9798){if(_0x5c9798){_0x454fac=_0x5c9798;_0x406e9d[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0xe9')][_0xae3d('0x58')]);_0x406e9d[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x1f167f[_0xae3d('0x46')]);_0x406e9d[_0xae3d('0xd3')]=_['intersection'](_0x406e9d[_0xae3d('0x55')],_0x406e9d['query']);_0x590845[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x406e9d[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x1f167f['query'][_0xae3d('0x5a')]));_0x590845[_0xae3d('0x4a')]=_0x590845[_0xae3d('0x4a')]['length']?_0x590845['attributes']:_0x406e9d['model'];_0x590845[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x1f167f[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x590845[_0xae3d('0xd2')]=qs['filters'](_[_0xae3d('0xd6')](_0x1f167f['query'],_0x406e9d[_0xae3d('0xd3')]));if(_0x1f167f[_0xae3d('0x46')][_0xae3d('0x38')]){_0x590845[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x590845[_0xae3d('0xd2')],{'$or':_['map'](_0x590845[_0xae3d('0x4a')],function(_0x4e8ee1){var _0x553342={};_0x553342[_0x4e8ee1]={'$like':'%'+_0x1f167f['query'][_0xae3d('0x38')]+'%'};return _0x553342;})});}_0x590845=_[_0xae3d('0x5c')]({},_0x590845,_0x1f167f[_0xae3d('0xd4')]);return _0x454fac[_0xae3d('0xe8')](_0x590845);}})[_0xae3d('0x19')](function(_0x42c5d8){if(_0x42c5d8){_0x1f345a=_0x42c5d8[_0xae3d('0x5b')];if(!_0x1f167f[_0xae3d('0x46')]['hasOwnProperty']('nolimit')){_0x590845[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x1f167f[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x590845[_0xae3d('0x29')]=qs['offset'](_0x1f167f[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0x454fac[_0xae3d('0xe8')](_0x590845);}})[_0xae3d('0x19')](function(_0x47bfb2){if(_0x47bfb2){return _0x47bfb2?{'count':_0x1f345a,'rows':_0x47bfb2}:null;}})[_0xae3d('0x19')](respondWithResult(_0x15f524,null))[_0xae3d('0x24')](handleError(_0x15f524,null));};exports['login']=function(_0x54e412,_0x121250,_0x3ee5b5){var _0x2ca1e0;var _0x27786f;var _0x577c37;var _0x42ee2d=!_['isNil'](_0x54e412[_0xae3d('0x54')]['id'])?_0x54e412[_0xae3d('0x54')]['id']:!_[_0xae3d('0x68')](_0x54e412[_0xae3d('0x35')]['id'])?_0x54e412[_0xae3d('0x35')]['id']:null;return db['User'][_0xae3d('0x5d')]({'where':{'id':_0x42ee2d,'role':{'$or':[_0xae3d('0x33'),'user',_0xae3d('0x7d')]}},'attributes':['id',_0xae3d('0x3c'),_0xae3d('0xea'),_0xae3d('0xeb'),_0xae3d('0x30'),_0xae3d('0x64'),_0xae3d('0x9c')]})[_0xae3d('0x19')](function(_0x41793c){if(_0x41793c){if(_0x41793c[_0xae3d('0x30')]===_0xae3d('0x7d')){_0x2ca1e0=_0x41793c;if(_0x54e412[_0xae3d('0x5f')]['interface']){_0x577c37=util[_0xae3d('0xc8')](_0xae3d('0xec'),_0x2ca1e0[_0x54e412['body'][_0xae3d('0xa9')]]);}else if(_0x54e412[_0xae3d('0x5f')][_0xae3d('0xed')]){_0x577c37=util[_0xae3d('0xc8')](_0xae3d('0xee'),_0x54e412[_0xae3d('0x5f')][_0xae3d('0xed')]);}else{_0x577c37=util[_0xae3d('0xc8')](_0xae3d('0xee'),_0x2ca1e0[_0xae3d('0x3c')]);}socket['to'](util[_0xae3d('0xc8')](_0xae3d('0xef'),_0x2ca1e0[_0xae3d('0x3c')]))[_0xae3d('0xa5')](_0xae3d('0xf0'),{'user':{'id':_0x2ca1e0['id'],'name':_0x2ca1e0[_0xae3d('0x3c')]},'ip':_0x54e412[_0xae3d('0xf1')][_0xae3d('0xf2')]||_0x54e412['connection'][_0xae3d('0xf3')]||_0x54e412[_0xae3d('0xf4')][_0xae3d('0xf3')]||_0x54e412[_0xae3d('0xf5')]['socket'][_0xae3d('0xf3')]});return db['UserVoiceQueueRt'][_0xae3d('0x31')]({'where':{'membername':_0x2ca1e0[_0xae3d('0x3c')]},'individualHooks':!![]});}}else{throw new db[(_0xae3d('0x8f'))][(_0xae3d('0x90'))](_0xae3d('0xf6'));}})['then'](function(){if(_0x2ca1e0){return _0x2ca1e0[_0xae3d('0xf7')]({'raw':!![]});}})[_0xae3d('0x19')](function(_0xd4f7db){if(_0x2ca1e0){if(_0xd4f7db){_0x27786f=_0xd4f7db;if(_0x27786f[_0xae3d('0x5b')]){var _0xecef9f=_0x27786f['map'](function(_0x32a2c5){var _0x866163={'membername':_0x2ca1e0['name'],'UserId':_0x2ca1e0['id'],'queue_name':_0x32a2c5[_0xae3d('0x3c')],'VoiceQueueId':_0x32a2c5['id'],'interface':_0x577c37,'paused':_0x2ca1e0[_0xae3d('0x9c')]||![],'penalty':_0x32a2c5[_0xae3d('0xf8')]||0x0};return db[_0xae3d('0xaa')][_0xae3d('0xab')](_0x866163);});return Promise[_0xae3d('0x52')](_0xecef9f);}}}})[_0xae3d('0x19')](function(){if(_0x2ca1e0){return db[_0xae3d('0xf9')][_0xae3d('0x8b')]({'where':{'membername':_0x2ca1e0[_0xae3d('0x3c')],'exitAt':null}});}})[_0xae3d('0x19')](function(_0x85a7f9){if(_0x2ca1e0){var _0x54bf98=[];_0x85a7f9[_0xae3d('0xfa')](function(_0x58aeac){_0x54bf98[_0xae3d('0x4d')](_0x58aeac[_0xae3d('0x2f')]({'exitAt':moment()[_0xae3d('0xc8')](_0xae3d('0xfb'))}));});return Promise[_0xae3d('0x52')](_0x54bf98);}})[_0xae3d('0x19')](function(){if(_0x2ca1e0){var _0x1545e9=[];var _0xdd79d1=[];var _0x8b8933=utils[_0xae3d('0xfc')]();var _0x2a0e89={'membername':_0x2ca1e0[_0xae3d('0x3c')],'interface':_0x577c37,'enterAt':moment()[_0xae3d('0xc8')](_0xae3d('0xfb')),'role':_0x2ca1e0[_0xae3d('0x30')],'internal':_0x2ca1e0[_0xae3d('0x64')]};_0x8b8933['forEach'](function(_0x2726f1){_0x1545e9[_0xae3d('0x4d')](_[_0xae3d('0x5c')]({'channel':_0x2726f1,'type':'LOGIN','data1':_0x54e412[_0xae3d('0x5f')][_0xae3d('0xfd')],'data2':_0x577c37},_0x2a0e89));if(_0x2ca1e0[_0xae3d('0x9c')]){_0xdd79d1[_0xae3d('0x4d')](_[_0xae3d('0x5c')]({'channel':_0x2726f1,'type':_0xae3d('0xfe'),'data1':'LOGININPAUSE'},_0x2a0e89));}});return db[_0xae3d('0xf9')]['bulkCreate'](_0x1545e9[_0xae3d('0xff')](_0xdd79d1),{'individualHooks':!![]});}})[_0xae3d('0x19')](function(){if(_0x2ca1e0){return _0x2ca1e0[_0xae3d('0x2f')]({'online':!![],'lastLoginAt':moment()[_0xae3d('0xc8')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2ca1e0['loginInPause']||![],'mailPause':_0x2ca1e0[_0xae3d('0x9c')]||![],'chatPause':_0x2ca1e0[_0xae3d('0x9c')]||![],'faxPause':_0x2ca1e0[_0xae3d('0x9c')]||![],'smsPause':_0x2ca1e0[_0xae3d('0x9c')]||![],'openchannelPause':_0x2ca1e0['loginInPause']||![],'whatsappPause':_0x2ca1e0[_0xae3d('0x9c')]||![],'pauseType':_0x2ca1e0['loginInPause']?'LOGININPAUSE':null,'interface':_0x577c37,'lastPauseAt':moment()[_0xae3d('0xc8')](_0xae3d('0xfb'))});}})[_0xae3d('0x19')](function(_0x40fb38){if(_0x54e412[_0xae3d('0x100')]){return _0x3ee5b5();}else{return Promise[_0xae3d('0x101')](_0x40fb38)[_0xae3d('0x19')](respondWithResult(_0x121250,null));}})[_0xae3d('0x24')](handleError(_0x121250,null));};exports[_0xae3d('0x102')]=function(_0x3acbc1,_0x23dbcd){var _0x3b028e;return db[_0xae3d('0x40')]['find']({'where':{'id':_0x3acbc1['params']['id'],'role':_0xae3d('0x7d')},'attributes':['id',_0xae3d('0x3c'),_0xae3d('0x30')]})[_0xae3d('0x19')](handleEntityNotFound(_0x23dbcd,null))[_0xae3d('0x19')](function(_0x514c1a){if(_0x514c1a){_0x3b028e=_0x514c1a;return db[_0xae3d('0xaa')][_0xae3d('0x31')]({'where':{'membername':_0x3b028e['name']},'individualHooks':!![]});}})[_0xae3d('0x19')](function(){return db[_0xae3d('0xf9')][_0xae3d('0x8b')]({'where':{'membername':_0x3b028e[_0xae3d('0x3c')],'exitAt':null}});})['then'](function(_0x5d39d4){var _0x321e82=[];_0x5d39d4['forEach'](function(_0x32d766){_0x321e82[_0xae3d('0x4d')](_0x32d766['update']({'exitAt':moment()[_0xae3d('0xc8')](_0xae3d('0xfb'))}));});return Promise[_0xae3d('0x52')](_0x321e82);})[_0xae3d('0x19')](function(){return _0x3b028e[_0xae3d('0x2f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x23dbcd,null))['catch'](handleError(_0x23dbcd,null));};exports[_0xae3d('0x103')]=function(_0x625e0a,_0x3516cc){var _0x5b0a23;return db[_0xae3d('0xaa')][_0xae3d('0x2f')]({'paused':0x1},{'where':{'UserId':_0x625e0a[_0xae3d('0x54')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xae3d('0x40')]['find']({'where':{'id':_0x625e0a[_0xae3d('0x54')]['id'],'role':_0xae3d('0x7d')},'attributes':['id',_0xae3d('0x3c'),'role',_0xae3d('0x64'),_0xae3d('0xa9'),_0xae3d('0xa8')]});})[_0xae3d('0x19')](handleEntityNotFound(_0x3516cc,null))[_0xae3d('0x19')](function(_0x1ebd17){if(_0x1ebd17){_0x5b0a23=_0x1ebd17;return respondWithRpcPromise('QueuePause',_0xae3d('0x103'),{'id':_0x5b0a23['id'],'name':_0x5b0a23['name'],'pause':!![]});}})[_0xae3d('0x19')](function(){if(_0x5b0a23){return db[_0xae3d('0xf9')][_0xae3d('0x8b')]({'where':{'membername':_0x5b0a23[_0xae3d('0x3c')],'type':_0xae3d('0xfe'),'exitAt':null}});}})[_0xae3d('0x19')](function(_0x38f841){if(_0x38f841[_0xae3d('0x5b')]){var _0x418bcf=moment()[_0xae3d('0xc8')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3fba32=0x0,_0x3d2332=_0x38f841[_0xae3d('0x5b')];_0x3fba32<_0x3d2332;_0x3fba32++){_0x38f841[_0x3fba32][_0xae3d('0x104')]({'exitAt':_0x418bcf});}}})[_0xae3d('0x19')](function(){var _0x2577b6=[];var _0x29842f=utils[_0xae3d('0xfc')]();_0x29842f['forEach'](function(_0x2f3277){_0x2577b6[_0xae3d('0x4d')]({'channel':_0x2f3277,'membername':_0x5b0a23[_0xae3d('0x3c')],'interface':_[_0xae3d('0x68')](_0x5b0a23[_0xae3d('0xa9')])?util[_0xae3d('0xc8')](_0xae3d('0xee'),_0x5b0a23[_0xae3d('0x3c')]):_0x5b0a23['interface'],'type':'PAUSE','enterAt':moment()[_0xae3d('0xc8')](_0xae3d('0xfb')),'data1':_0x625e0a['body']['type']||_0xae3d('0x105'),'role':_0x5b0a23[_0xae3d('0x30')],'internal':_0x5b0a23[_0xae3d('0x64')]});});return db[_0xae3d('0xf9')]['bulkCreate'](_0x2577b6,{'individualHooks':!![]});})[_0xae3d('0x19')](function(){return _0x5b0a23[_0xae3d('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x625e0a[_0xae3d('0x5f')]['type']||_0xae3d('0x105'),'lastPauseAt':moment()[_0xae3d('0xc8')](_0xae3d('0xfb'))});})['then'](respondWithResult(_0x3516cc,null))[_0xae3d('0x24')](handleError(_0x3516cc,null));};exports['unpause']=function(_0x5e6259,_0x225dac){if(_0x5e6259[_0xae3d('0x5f')]['channel']&&!utils[_0xae3d('0xad')](_0x5e6259[_0xae3d('0x5f')]['channel'])){throw new APIBadRequestError(util[_0xae3d('0xc8')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x5e6259[_0xae3d('0x5f')][_0xae3d('0x9b')]));}return db[_0xae3d('0x40')]['find']({'where':{'id':_0x5e6259[_0xae3d('0x54')]['id']},'attributes':['id',_0xae3d('0x3c'),_0xae3d('0x30'),_0xae3d('0x64'),_0xae3d('0xa9'),_0xae3d('0xa8'),_0xae3d('0x9d'),_0xae3d('0x106'),_0xae3d('0x107'),_0xae3d('0x108'),_0xae3d('0x109'),_0xae3d('0x10a'),_0xae3d('0x10b'),_0xae3d('0x10c'),_0xae3d('0x10d')]})['then'](function(_0x2e992a){if(!_0x2e992a){throw new APINotFoundError(util[_0xae3d('0xc8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5e6259[_0xae3d('0x54')]['id']));}return _0x2e992a[_0xae3d('0x10e')](_0x5e6259['body'][_0xae3d('0x9b')]);})['then'](respondWithResult(_0x225dac,null))['catch'](APIHandleError(_0x225dac));};exports['getTeams']=function(_0x1ea2dd,_0xa86a35){var _0x5547cd={};var _0x3038fa={};var _0x1cd7dc;var _0x186da5;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x1ea2dd['params']['id']}})['then'](handleEntityNotFound(_0xa86a35,null))['then'](function(_0x3fba47){if(_0x3fba47){_0x1cd7dc=_0x3fba47;_0x3038fa[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0x10f')][_0xae3d('0x58')]);_0x3038fa['query']=_[_0xae3d('0x57')](_0x1ea2dd[_0xae3d('0x46')]);_0x3038fa[_0xae3d('0xd3')]=_[_0xae3d('0x59')](_0x3038fa[_0xae3d('0x55')],_0x3038fa[_0xae3d('0x46')]);_0x5547cd[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x3038fa[_0xae3d('0x55')],qs['fields'](_0x1ea2dd[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x5547cd[_0xae3d('0x4a')]=_0x5547cd[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x5547cd[_0xae3d('0x4a')]:_0x3038fa[_0xae3d('0x55')];_0x5547cd[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x1ea2dd[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x5547cd[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_['pick'](_0x1ea2dd[_0xae3d('0x46')],_0x3038fa[_0xae3d('0xd3')]));if(_0x1ea2dd[_0xae3d('0x46')][_0xae3d('0x38')]){_0x5547cd[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x5547cd['where'],{'$or':_[_0xae3d('0x39')](_0x5547cd[_0xae3d('0x4a')],function(_0x566793){var _0x51bb04={};_0x51bb04[_0x566793]={'$like':'%'+_0x1ea2dd[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x51bb04;})});}_0x5547cd=_[_0xae3d('0x5c')]({},_0x5547cd,_0x1ea2dd[_0xae3d('0xd4')]);return _0x1cd7dc['getTeams'](_0x5547cd);}})[_0xae3d('0x19')](function(_0x32fef2){if(_0x32fef2){_0x186da5=_0x32fef2['length'];if(!_0x1ea2dd[_0xae3d('0x46')][_0xae3d('0xca')](_0xae3d('0xd8'))){_0x5547cd[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x1ea2dd[_0xae3d('0x46')]['limit']);_0x5547cd[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x1ea2dd[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0x1cd7dc[_0xae3d('0x110')](_0x5547cd);}})['then'](function(_0x5030fa){if(_0x5030fa){return _0x5030fa?{'count':_0x186da5,'rows':_0x5030fa}:null;}})[_0xae3d('0x19')](respondWithResult(_0xa86a35,null))[_0xae3d('0x24')](handleError(_0xa86a35,null));};exports[_0xae3d('0x111')]=function(_0x535533,_0x1b8ec1){var _0x17a882=_0x535533['params']['id'];var _0x491112=_0x535533['body']?_0x535533[_0xae3d('0x5f')][_0xae3d('0x62')]:null;var _0x57c0d9=[];return Promise['resolve']()['then'](function(){if(!_0x491112)throw new APIBadRequestError(_0xae3d('0x112'));})[_0xae3d('0x19')](function(){return db[_0xae3d('0x40')]['findOne']({'where':{'id':_0x17a882}});})['then'](function(_0x3db6db){if(!_0x3db6db)throw new APINotFoundError(util[_0xae3d('0xc8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x535533[_0xae3d('0x54')]['id']));return db['sequelize']['transaction'](function(_0x9d4469){return _0x3db6db[_0xae3d('0x111')](_0x491112,{'transaction':_0x9d4469})['then'](function(){return db[_0xae3d('0x10f')][_0xae3d('0x8b')]({'where':{'id':{'$in':_0x491112}}});})[_0xae3d('0x19')](function(_0x111c19){var _0x533a5a=_[_0xae3d('0x39')](_0x111c19,function(_0x1ef842){return _0x1ef842[_0xae3d('0x113')]();});return Promise[_0xae3d('0x52')](_0x533a5a);})[_0xae3d('0x19')](function(_0x2a41ae){_0x57c0d9=_[_0xae3d('0x114')](_0x2a41ae);var _0x561c71=_[_0xae3d('0x39')](_0x57c0d9,function(_0x4d14ca){return _0x4d14ca[_0xae3d('0x115')](_0x3db6db['id'],{'transaction':_0x9d4469});});return Promise[_0xae3d('0x52')](_0x561c71);})[_0xae3d('0x19')](function(){if(!_0x3db6db[_0xae3d('0xa8')])return;var _0x1c940a=_['filter'](_0x57c0d9,function(_0x448dcd){return _0x448dcd[_0xae3d('0x116')](_0xae3d('0x9b'))===_0xae3d('0x117');});var _0x5f15c7=_[_0xae3d('0x39')](_0x1c940a,function(_0x22286a){return db[_0xae3d('0xaa')][_0xae3d('0xab')]({'membername':_0x3db6db['name'],'UserId':_0x3db6db['id'],'queue_name':_0x22286a['name'],'VoiceQueueId':_0x22286a['id'],'interface':_['isNil'](_0x3db6db[_0xae3d('0xa9')])?util['format'](_0xae3d('0xee'),_0x3db6db[_0xae3d('0x3c')]):_0x3db6db[_0xae3d('0xa9')],'paused':_0x3db6db[_0xae3d('0x9d')]||![],'penalty':_0x3db6db[_0xae3d('0xa3')]},{'transaction':_0x9d4469});});return Promise[_0xae3d('0x52')](_0x5f15c7);})[_0xae3d('0x19')](function(){return db[_0xae3d('0x118')][_0xae3d('0x8b')]({'where':{'teamId':{'$in':_0x491112}}});})[_0xae3d('0x19')](function(_0x14ca0d){var _0x3d9f2b=_[_0xae3d('0x39')](_0x14ca0d,function(_0x647484){return db[_0xae3d('0x119')]['create']({'UserId':_0x3db6db['id'],'VoicePrefixId':_0x647484[_0xae3d('0x11a')]},{'transaction':_0x9d4469});});return Promise[_0xae3d('0x52')](_0x3d9f2b);});});})['then'](function(){for(var _0x3051c4=0x0;_0x3051c4<_0x57c0d9['length'];_0x3051c4++){var _0x220b61=_0x57c0d9[_0x3051c4]['getDataValue'](_0xae3d('0x9b'));var _0x2d530e=_0x220b61+'QueueId';socket[_0xae3d('0xa5')](_0xae3d('0x35')+_0x220b61+_0xae3d('0x11b'),{'UserId':_0x17a882,['queueField']:_0x57c0d9[_0x3051c4]['id']});}})[_0xae3d('0x19')](respondWithStatusCode(_0x1b8ec1,null))['catch'](APIHandleError(_0x1b8ec1));};exports[_0xae3d('0x11c')]=function(_0x1e8e97,_0x31202c){var _0x48b3e0=_0x1e8e97[_0xae3d('0x54')]['id'];var _0x32abba=null;if(_0x1e8e97[_0xae3d('0x46')][_0xae3d('0x62')]){_0x32abba=_[_0xae3d('0xaf')](_0x1e8e97['query']['ids'])?_0x1e8e97[_0xae3d('0x46')][_0xae3d('0x62')]:[_0x1e8e97[_0xae3d('0x46')][_0xae3d('0x62')]];}var _0x455046=[];return Promise['resolve']()[_0xae3d('0x19')](function(){if(!_0x32abba)throw new APIBadRequestError(_0xae3d('0x11d'));})['then'](function(){return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x48b3e0}});})[_0xae3d('0x19')](function(_0x1d226e){if(!_0x1d226e)throw new APINotFoundError(util[_0xae3d('0xc8')](_0xae3d('0xc9'),_0x1e8e97[_0xae3d('0x54')]['id']));return db[_0xae3d('0x6a')][_0xae3d('0x11e')](function(_0x5241bf){return _0x1d226e[_0xae3d('0x11c')](_0x32abba,{'transaction':_0x5241bf})[_0xae3d('0x19')](function(){return db[_0xae3d('0x10f')][_0xae3d('0x8b')]({'where':{'id':{'$in':_0x32abba}}});})[_0xae3d('0x19')](function(_0x4f1ffe){var _0x40f159=_[_0xae3d('0x39')](_0x4f1ffe,function(_0x333d77){return _0x333d77[_0xae3d('0x113')]();});return Promise[_0xae3d('0x52')](_0x40f159);})[_0xae3d('0x19')](function(_0x2fa7ab){_0x455046=_['flattenDeep'](_0x2fa7ab);var _0x1cd287=_['map'](_0x455046,function(_0x48a161){return _0x48a161[_0xae3d('0x11f')](_0x1d226e['id'],{'transaction':_0x5241bf});});return Promise[_0xae3d('0x52')](_0x1cd287);})['then'](function(){if(!_0x1d226e['online'])return;var _0x5c4b58=_[_0xae3d('0x38')](_0x455046,function(_0x2ab4bb){return _0x2ab4bb['getDataValue'](_0xae3d('0x9b'))===_0xae3d('0x117');});var _0x5dd74e=_[_0xae3d('0x39')](_0x5c4b58,function(_0x4ddeaf){return db[_0xae3d('0xaa')][_0xae3d('0x31')]({'where':{'VoiceQueueId':_0x4ddeaf['id'],'UserId':_0x1d226e['id']},'transaction':_0x5241bf});});return Promise['all'](_0x5dd74e);})[_0xae3d('0x19')](function(){return db['TeamVoicePrefix'][_0xae3d('0x8b')]({'where':{'teamId':{'$in':_0x32abba}}});})[_0xae3d('0x19')](function(_0x1b9c85){var _0x4fec29=_['map'](_0x1b9c85,function(_0x2a28e0){return db['UserVoicePrefix'][_0xae3d('0x31')]({'where':{'UserId':_0x1d226e['id'],'VoicePrefixId':_0x2a28e0[_0xae3d('0x11a')]}},{'transaction':_0x5241bf});});return Promise['all'](_0x4fec29);});});})[_0xae3d('0x19')](function(){for(var _0x39f4ea=0x0;_0x39f4ea<_0x455046[_0xae3d('0x5b')];_0x39f4ea++){var _0x584c3c=_0x455046[_0x39f4ea][_0xae3d('0x116')]('channel');var _0x27e944=_0x584c3c+_0xae3d('0xb0');socket[_0xae3d('0xa5')]('user'+_0x584c3c+_0xae3d('0xb1'),{'UserId':_0x48b3e0,['queueField']:_0x455046[_0x39f4ea]['id']});}})[_0xae3d('0x19')](respondWithStatusCode(_0x31202c,null))[_0xae3d('0x24')](APIHandleError(_0x31202c));};exports['getLists']=function(_0x1cfee6,_0x24274a){var _0x19ca95={};var _0x87cc2f={};var _0x20dfaa;var _0x433d96;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x1cfee6['params']['id']}})[_0xae3d('0x19')](handleEntityNotFound(_0x24274a,null))[_0xae3d('0x19')](function(_0x29aca5){if(_0x29aca5){_0x20dfaa=_0x29aca5;_0x87cc2f[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0xcb')][_0xae3d('0x58')]);_0x87cc2f[_0xae3d('0x46')]=_[_0xae3d('0x57')](_0x1cfee6[_0xae3d('0x46')]);_0x87cc2f[_0xae3d('0xd3')]=_['intersection'](_0x87cc2f['model'],_0x87cc2f[_0xae3d('0x46')]);_0x19ca95[_0xae3d('0x4a')]=_['intersection'](_0x87cc2f[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x1cfee6[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x19ca95[_0xae3d('0x4a')]=_0x19ca95[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x19ca95[_0xae3d('0x4a')]:_0x87cc2f[_0xae3d('0x55')];_0x19ca95[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x1cfee6[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x19ca95[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_[_0xae3d('0xd6')](_0x1cfee6[_0xae3d('0x46')],_0x87cc2f[_0xae3d('0xd3')]));if(_0x1cfee6[_0xae3d('0x46')][_0xae3d('0x38')]){_0x19ca95[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x19ca95['where'],{'$or':_[_0xae3d('0x39')](_0x19ca95[_0xae3d('0x4a')],function(_0x2c3905){var _0x5e1c27={};_0x5e1c27[_0x2c3905]={'$like':'%'+_0x1cfee6['query'][_0xae3d('0x38')]+'%'};return _0x5e1c27;})});}_0x19ca95=_[_0xae3d('0x5c')]({},_0x19ca95,_0x1cfee6[_0xae3d('0xd4')]);return _0x20dfaa[_0xae3d('0x120')](_0x19ca95);}})[_0xae3d('0x19')](function(_0x4b88dc){if(_0x4b88dc){_0x433d96=_0x4b88dc[_0xae3d('0x5b')];if(!_0x1cfee6[_0xae3d('0x46')][_0xae3d('0xca')](_0xae3d('0xd8'))){_0x19ca95[_0xae3d('0x2b')]=qs[_0xae3d('0x2b')](_0x1cfee6[_0xae3d('0x46')][_0xae3d('0x2b')]);_0x19ca95[_0xae3d('0x29')]=qs[_0xae3d('0x29')](_0x1cfee6[_0xae3d('0x46')][_0xae3d('0x29')]);}return _0x20dfaa[_0xae3d('0x120')](_0x19ca95);}})[_0xae3d('0x19')](function(_0x2c9764){if(_0x2c9764){return _0x2c9764?{'count':_0x433d96,'rows':_0x2c9764}:null;}})[_0xae3d('0x19')](respondWithResult(_0x24274a,null))[_0xae3d('0x24')](handleError(_0x24274a,null));};exports[_0xae3d('0x121')]=function(_0x1af371,_0x105b5e){var _0x264a4b={};var _0x3db6e5={};var _0x4d3d79;return db[_0xae3d('0x40')][_0xae3d('0x96')]({'where':{'id':_0x1af371[_0xae3d('0x54')]['id']}})['then'](handleEntityNotFound(_0x105b5e,null))[_0xae3d('0x19')](function(_0x4e2774){if(_0x4e2774){_0x4d3d79=_0x4e2774;_0x3db6e5[_0xae3d('0x55')]=_[_0xae3d('0x57')](db[_0xae3d('0x40')]['rawAttributes']);_0x3db6e5[_0xae3d('0x46')]=_['keys'](_0x1af371[_0xae3d('0x46')]);_0x3db6e5[_0xae3d('0xd3')]=_['intersection'](_0x3db6e5[_0xae3d('0x55')],_0x3db6e5['query']);_0x264a4b[_0xae3d('0x4a')]=_[_0xae3d('0x59')](_0x3db6e5[_0xae3d('0x55')],qs[_0xae3d('0x5a')](_0x1af371[_0xae3d('0x46')][_0xae3d('0x5a')]));_0x264a4b['attributes']=_0x264a4b[_0xae3d('0x4a')][_0xae3d('0x5b')]?_0x264a4b[_0xae3d('0x4a')]:_0x3db6e5['model'];_0x264a4b[_0xae3d('0xd0')]=qs[_0xae3d('0xd1')](_0x1af371[_0xae3d('0x46')][_0xae3d('0xd1')]);_0x264a4b[_0xae3d('0xd2')]=qs[_0xae3d('0xd3')](_['pick'](_0x1af371[_0xae3d('0x46')],_0x3db6e5[_0xae3d('0xd3')]));if(_0x1af371['query'][_0xae3d('0x38')]){_0x264a4b[_0xae3d('0xd2')]=_[_0xae3d('0x5c')](_0x264a4b[_0xae3d('0xd2')],{'$or':_[_0xae3d('0x39')](_0x264a4b[_0xae3d('0x4a')],function(_0x23fc62){var _0x1648ec={};_0x1648ec[_0x23fc62]={'$like':'%'+_0x1af371[_0xae3d('0x46')][_0xae3d('0x38')]+'%'};return _0x1648ec;})});}_0x264a4b['model']=db[_0xae3d('0x40')];_0x264a4b['as']='Agents';_0x264a4b=_[_0xae3d('0x5c')]({},_0x264a4b,_0x1af371[_0xae3d('0xd4')]);return _0x4d3d79[_0xae3d('0xf7')]({'include':[_0x264a4b]});}})[_0xae3d('0x19')](function(_0x8c43ff){if(_0x8c43ff){var _0x2307b7={},_0x5d9bb8=[];for(var _0x408705=0x0;_0x408705<_0x8c43ff[_0xae3d('0x5b')];_0x408705+=0x1){for(var _0x4bedcb=0x0,_0x4ee8e7;_0x4bedcb<_0x8c43ff[_0x408705]['Agents'][_0xae3d('0x5b')];_0x4bedcb+=0x1){_0x4ee8e7=_0x8c43ff[_0x408705][_0xae3d('0x36')][_0x4bedcb][_0xae3d('0x32')]({'plain':!![]});_0x2307b7[_0x4ee8e7['id']]=_0x4ee8e7;}}_0x2307b7=_['values'](_0x2307b7);for(var _0x2dbddd=qs[_0xae3d('0x29')](_0x1af371[_0xae3d('0x46')][_0xae3d('0x29')]);_0x2dbddd<_0x2307b7[_0xae3d('0x5b')]&&_0x5d9bb8['length']=_0x117b6e){_0x60b1ef=_0x117b6e;_0x484a57=0xc8;}else{_0x484a57=0xce;}_0xe2ca8b[_0x8a49('0x22')](_0x484a57);return _0xe2ca8b[_0x8a49('0x27')](_0x8a49('0x28'),_0x5272a6+'-'+_0x60b1ef+'/'+_0x117b6e)[_0x8a49('0x23')](_0x1b0a01);}return null;};}function saveUpdates(_0x643dd1){return function(_0x58fa31){if(_0x58fa31){return _0x58fa31[_0x8a49('0x29')](_0x643dd1)[_0x8a49('0x16')](function(_0x2f76aa){if(_0x2f76aa[_0x8a49('0x2a')]===_0x8a49('0x2b')){socket[_0x8a49('0x2c')](_0x8a49('0x2d')+_0x2f76aa['id'],_0x2f76aa);}return _0x2f76aa;});}return null;};}function removeEntity(_0x47bb1b){return function(_0x49af4e){if(_0x49af4e){return _0x49af4e[_0x8a49('0x2e')]()[_0x8a49('0x16')](function(){var _0x1ad459=_0x49af4e[_0x8a49('0x2f')]({'plain':!![]});if(_0x1ad459['role']===_0x8a49('0x30'))return;var _0xae33d4=[{'name':'Users','value':_0x8a49('0x31'),'ignore':!![]},{'name':'Agents','value':_0x8a49('0x2b'),'ignore':![]},{'name':_0x8a49('0x32'),'value':_0x8a49('0x33'),'ignore':![]}];var _0xeee46f=_(_0xae33d4)['filter'](_0x8a49('0x34'))[_0x8a49('0x35')](_0x8a49('0x36'))['value']();if(_[_0x8a49('0x37')](_0xeee46f,_0x1ad459['role'])){return;}var _0x5618bd=_[_0x8a49('0x38')](_0xae33d4,[_0x8a49('0x36'),_0x1ad459[_0x8a49('0x2a')]])[_0x8a49('0x39')];return db['UserProfileResource']['destroy']({'where':{'type':_0x5618bd,'resourceId':_0x1ad459['id']}})[_0x8a49('0x16')](function(){return _0x49af4e;});})[_0x8a49('0x16')](function(){_0x47bb1b[_0x8a49('0x22')](0xcc)[_0x8a49('0x21')]();});}};}function handleEntityNotFound(_0x4c6fa4){return function(_0x198362){if(!_0x198362){_0x4c6fa4[_0x8a49('0x20')](0x194);}return _0x198362;};}function handleError(_0x450637,_0x597340){_0x597340=_0x597340||0x1f4;return function(_0x52d7dd){logger[_0x8a49('0x1b')](_0x52d7dd[_0x8a49('0x3a')]);if(_0x52d7dd[_0x8a49('0x39')]){delete _0x52d7dd['name'];}_0x450637[_0x8a49('0x22')](_0x597340)[_0x8a49('0x3b')](_0x52d7dd);};}exports[_0x8a49('0x3c')]=function(_0x7b71bb,_0x33c7a5){var _0x193f2c={},_0x4a520a={'count':0x0,'rows':[]};var _0x1559aa=_(db[_0x8a49('0x3d')][_0x8a49('0x3e')])[_0x8a49('0x35')](function(_0x37901c){return{'name':_0x37901c[_0x8a49('0x3f')],'type':_0x37901c['type'][_0x8a49('0x40')]};})[_0x8a49('0x41')](function(_0x384a1f){return!_[_0x8a49('0x37')]([_0x8a49('0x42'),_0x8a49('0x43')],_0x384a1f[_0x8a49('0x39')]);})[_0x8a49('0x36')]();_0x193f2c=qs[_0x8a49('0x44')](_0x1559aa,_0x7b71bb);var _0x1ecfe0={'where':_0x193f2c[_0x8a49('0x45')]};return db['User'][_0x8a49('0x26')](_0x1ecfe0)[_0x8a49('0x16')](function(_0x2938a8){_0x4a520a['count']=_0x2938a8;if(_0x7b71bb[_0x8a49('0x46')][_0x8a49('0x47')]){_0x193f2c[_0x8a49('0x48')]=[{'all':!![]}];}if(_0x7b71bb[_0x8a49('0x46')][_0x8a49('0x49')]==='true'){_0x193f2c[_0x8a49('0x48')]=[{'model':db[_0x8a49('0x4a')],'as':'userSetting'}];}if(!_[_0x8a49('0x37')](_0x193f2c['attributes'],'id')){_0x193f2c['attributes'][_0x8a49('0x4b')]('id');}return db['User'][_0x8a49('0x4c')](_0x193f2c);})[_0x8a49('0x16')](function(_0x2e5e7e){_0x4a520a[_0x8a49('0x4d')]=_0x2e5e7e;if(_0x7b71bb['query'][_0x8a49('0x4e')]===_0x8a49('0x4f')){var _0x239cea=[];for(var _0x213cf7=0x0;_0x213cf7<_0x4a520a[_0x8a49('0x4d')][_0x8a49('0x50')];_0x213cf7++){_0x239cea[_0x8a49('0x4b')](get_open_tabs('chat',_0x4a520a['rows'][_0x213cf7][_0x8a49('0x51')]));_0x239cea[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x52'),_0x4a520a[_0x8a49('0x4d')][_0x213cf7][_0x8a49('0x51')]));_0x239cea[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x53'),_0x4a520a[_0x8a49('0x4d')][_0x213cf7]['dataValues']));_0x239cea[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x54'),_0x4a520a[_0x8a49('0x4d')][_0x213cf7][_0x8a49('0x51')]));_0x239cea[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x55'),_0x4a520a[_0x8a49('0x4d')][_0x213cf7][_0x8a49('0x51')]));_0x239cea[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x56'),_0x4a520a[_0x8a49('0x4d')][_0x213cf7]['dataValues']));}return Promise['all'](_0x239cea)[_0x8a49('0x16')](function(){return _0x4a520a;});}else{return _0x4a520a;}})[_0x8a49('0x16')](respondWithFilteredResult(_0x33c7a5,_0x193f2c))[_0x8a49('0x1f')](handleError(_0x33c7a5,null));};exports[_0x8a49('0x57')]=function(_0x42aa48,_0x8d827f){var _0x3e066e={'raw':![],'where':{'id':_0x42aa48['params']['id']}},_0x4d9306={};_0x4d9306['model']=_[_0x8a49('0x58')](_[_0x8a49('0x59')](db[_0x8a49('0x3d')]['rawAttributes']),[_0x8a49('0x42'),_0x8a49('0x43')]);_0x4d9306[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x42aa48[_0x8a49('0x46')]);_0x4d9306[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x4d9306[_0x8a49('0x5c')],_0x4d9306[_0x8a49('0x46')]);_0x3e066e[_0x8a49('0x5d')]=_['intersection'](_0x4d9306['model'],qs[_0x8a49('0x5e')](_0x42aa48[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x3e066e[_0x8a49('0x5d')]=_0x3e066e[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x3e066e[_0x8a49('0x5d')]:_0x4d9306[_0x8a49('0x5c')];if(_0x42aa48[_0x8a49('0x46')][_0x8a49('0x47')]){_0x3e066e['include']=[{'all':!![]}];}if(_0x42aa48[_0x8a49('0x46')][_0x8a49('0x49')]===_0x8a49('0x4f')){_0x3e066e[_0x8a49('0x48')]=[{'model':db[_0x8a49('0x4a')],'as':'userSetting'}];}_0x3e066e=_['merge']({},_0x3e066e,_0x42aa48['options']);if(!_[_0x8a49('0x37')](_0x3e066e[_0x8a49('0x5d')],'id')){_0x3e066e[_0x8a49('0x5d')][_0x8a49('0x4b')]('id');}return db[_0x8a49('0x3d')]['find'](_0x3e066e)[_0x8a49('0x16')](handleEntityNotFound(_0x8d827f,null))[_0x8a49('0x16')](function(_0x2b1b3){var _0x449a81=[];values=_0x2b1b3;if(_0x42aa48[_0x8a49('0x46')][_0x8a49('0x4e')]==='true'){_0x449a81['push'](get_open_tabs(_0x8a49('0x5f'),_0x2b1b3[_0x8a49('0x51')]));_0x449a81['push'](get_open_tabs(_0x8a49('0x52'),_0x2b1b3[_0x8a49('0x51')]));_0x449a81[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x55'),_0x2b1b3[_0x8a49('0x51')]));_0x449a81['push'](get_open_tabs('whatsapp',_0x2b1b3[_0x8a49('0x51')]));_0x449a81[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x53'),_0x2b1b3[_0x8a49('0x51')]));_0x449a81[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x54'),_0x2b1b3['dataValues']));return Promise[_0x8a49('0x60')](_0x449a81);}else{return values;}})[_0x8a49('0x16')](function(){return values;})['then'](respondWithResult(_0x8d827f,null))[_0x8a49('0x1f')](handleError(_0x8d827f,null));};exports['update']=function(_0x2d04da,_0x455809){if(_0x2d04da[_0x8a49('0x61')]['id']){delete _0x2d04da[_0x8a49('0x61')]['id'];}delete _0x2d04da[_0x8a49('0x61')][_0x8a49('0x2a')];return db[_0x8a49('0x3d')]['find']({'where':{'id':_0x2d04da[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x455809,null))[_0x8a49('0x16')](saveUpdates(_0x2d04da['body'],null))[_0x8a49('0x16')](respondWithResult(_0x455809,null))[_0x8a49('0x1f')](handleError(_0x455809,null));};exports[_0x8a49('0x63')]=function(_0x19dd05,_0x100d14){return db[_0x8a49('0x3d')][_0x8a49('0x63')]()[_0x8a49('0x16')](respondWithResult(_0x100d14,null))['catch'](handleError(_0x100d14,null));};exports[_0x8a49('0x64')]=function(_0x1658b3,_0x56adf6){return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x1658b3[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x56adf6,null))[_0x8a49('0x16')](function(_0x54a994){if(_0x54a994){return _0x54a994[_0x8a49('0x64')](_0x1658b3[_0x8a49('0x61')][_0x8a49('0x65')],_[_0x8a49('0x66')](_0x1658b3[_0x8a49('0x61')],[_0x8a49('0x65'),'id'])||{});}})[_0x8a49('0x16')](respondWithResult(_0x56adf6,null))['catch'](handleError(_0x56adf6,null));};function validateUser(_0x52cf4a){return new Promise(function(_0x4d62e0,_0x5f0f89){if(_0x52cf4a['internal'])return _0x4d62e0(_0x52cf4a);return db[_0x8a49('0x67')]['findById'](0x1)[_0x8a49('0x16')](function(_0x45786e){if(_0x45786e[_0x8a49('0x68')])authService[_0x8a49('0x69')](_0x52cf4a[_0x8a49('0x42')]);db['User']['max'](_0x8a49('0x6a'))['then'](function(_0x4ba695){if(_[_0x8a49('0x6b')](_0x4ba695)){_0x52cf4a[_0x8a49('0x6a')]=_0x45786e['min_internal']||0x1;return;}if(_[_0x8a49('0x6b')](_0x45786e[_0x8a49('0x6c')])||_0x45786e['min_internal']===_0x4ba695){_0x52cf4a[_0x8a49('0x6a')]=_0x4ba695+0x1;return;}if(_0x45786e['min_internal']>_0x4ba695){_0x52cf4a[_0x8a49('0x6a')]=_0x45786e['min_internal'];return;}return db[_0x8a49('0x6d')][_0x8a49('0x46')](_0x8a49('0x6e'),{'type':db[_0x8a49('0x6d')]['QueryTypes']['SELECT']})[_0x8a49('0x16')](function(_0x17277d){if(_0x17277d&&_0x17277d['length']){for(var _0x5418a5=0x0,_0x4c0dd4=_0x17277d[_0x8a49('0x50')];_0x5418a5<_0x4c0dd4&&_['isNil'](_0x52cf4a[_0x8a49('0x6a')]);_0x5418a5++){if(_0x45786e[_0x8a49('0x6c')]<=_0x17277d[_0x5418a5][_0x8a49('0x6f')]){_0x52cf4a[_0x8a49('0x6a')]=_0x17277d[_0x5418a5]['from'];}else if(_0x45786e[_0x8a49('0x6c')]>_0x17277d[_0x5418a5][_0x8a49('0x6f')]&&_0x45786e['min_internal']<=_0x17277d[_0x5418a5]['to']){_0x52cf4a[_0x8a49('0x6a')]=_0x45786e[_0x8a49('0x6c')];}}}if(_[_0x8a49('0x6b')](_0x52cf4a[_0x8a49('0x6a')])){_0x52cf4a['internal']=_0x4ba695+0x1;}return _0x4d62e0(_0x52cf4a);});});})['catch'](function(_0x177405){_0x5f0f89(_0x177405);});});}function updateUser(_0x2afa1f){return new Promise(function(_0x1c49d3,_0x81681d){try{if(_0x2afa1f[_0x8a49('0x70')]){_0x2afa1f[_0x8a49('0x71')]=_0x2afa1f[_0x8a49('0x6a')];_0x2afa1f[_0x8a49('0x72')]={'mailbox':_0x2afa1f['internal'],'password':_0x2afa1f['password'],'fullname':_0x2afa1f['fullname'],'email':_0x2afa1f[_0x8a49('0x73')]};}if(_0x2afa1f[_0x8a49('0x2a')]===_0x8a49('0x2b')){if(!_0x2afa1f[_0x8a49('0x74')])_0x2afa1f[_0x8a49('0x74')]=[_0x8a49('0x75'),_0x8a49('0x76'),'103',_0x8a49('0x77'),'110',_0x8a49('0x78'),_0x8a49('0x79'),_0x8a49('0x7a'),_0x8a49('0x7b'),_0x8a49('0x7c'),_0x8a49('0x7d'),_0x8a49('0x7e'),_0x8a49('0x7f'),_0x8a49('0x80'),_0x8a49('0x81')];}_0x1c49d3(_0x2afa1f);}catch(_0x5141cc){_0x81681d(_0x5141cc);}});}exports[_0x8a49('0x82')]=function(_0x1ae68a,_0xa2bb83){if(_0x1ae68a[_0x8a49('0x31')]['role']===_0x8a49('0x2b'))throw new Error(_0x8a49('0x83'));if(_0x1ae68a[_0x8a49('0x61')][_0x8a49('0x2a')]===_0x8a49('0x31')&&_0x1ae68a['user'][_0x8a49('0x2a')]!==_0x8a49('0x30')){throw new Error(_0x8a49('0x84'));}if(_0x1ae68a['body'][_0x8a49('0x2a')]==='admin'&&_0x1ae68a[_0x8a49('0x31')]['role']!==_0x8a49('0x30')){throw new Error(_0x8a49('0x85'));}return licenseUtil[_0x8a49('0x86')]([_0x1ae68a[_0x8a49('0x61')]])[_0x8a49('0x16')](function(){return validateUser(_0x1ae68a[_0x8a49('0x61')]);})[_0x8a49('0x16')](function(_0x5a8eb4){return updateUser(_0x5a8eb4)[_0x8a49('0x16')](function(_0x57d0d2){if(_0x57d0d2[_0x8a49('0x2a')]===_0x8a49('0x30')){_0x57d0d2[_0x8a49('0x87')]=_0x1ae68a[_0x8a49('0x31')][_0x8a49('0x87')];delete _0x57d0d2[_0x8a49('0x88')];}return _0x57d0d2;});})[_0x8a49('0x16')](function(_0x2effea){return db['User'][_0x8a49('0x82')](_0x2effea,{'include':[{'model':db[_0x8a49('0x72')],'as':_0x8a49('0x72')}]});})[_0x8a49('0x16')](function(_0x463062){if(_0x1ae68a[_0x8a49('0x61')][_0x8a49('0x2a')]===_0x8a49('0x31'))return _0x463062;if(_0x1ae68a[_0x8a49('0x31')][_0x8a49('0x2a')]!==_0x8a49('0x31'))return _0x463062;return db[_0x8a49('0x89')][_0x8a49('0x38')]({'where':{'name':_0x463062[_0x8a49('0x2a')]===_0x8a49('0x2b')?_0x8a49('0x8a'):_0x8a49('0x32'),'userProfileId':_0x1ae68a[_0x8a49('0x31')][_0x8a49('0x88')]},'raw':!![]})['then'](function(_0x14601e){if(!_0x14601e||_0x14601e[_0x8a49('0x8b')]!=0x0)return _0x463062;return db['UserProfileResource'][_0x8a49('0x82')]({'name':_0x463062[_0x8a49('0x39')],'resourceId':_0x463062['id'],'type':_0x14601e[_0x8a49('0x39')],'sectionId':_0x14601e['id']},{})[_0x8a49('0x16')](function(){return _0x463062;});})[_0x8a49('0x1f')](function(_0x55cb81){logger[_0x8a49('0x1b')](_0x8a49('0x8c'),_0x55cb81);throw _0x55cb81;});})[_0x8a49('0x16')](respondWithResult(_0xa2bb83,0xc9))[_0x8a49('0x1f')](handleError(_0xa2bb83,null));};exports['bulkCreate']=function(_0x28344b,_0x32be38){var _0x4918f6=_0x28344b[_0x8a49('0x61')];var _0xefa5f4=[];if(_0x28344b[_0x8a49('0x31')][_0x8a49('0x2a')]===_0x8a49('0x2b'))throw new Error(_0x8a49('0x83'));if(_[_0x8a49('0x8d')](_0x4918f6,[_0x8a49('0x2a'),_0x8a49('0x31')])&&_0x28344b[_0x8a49('0x31')][_0x8a49('0x2a')]!==_0x8a49('0x30')){throw new Error(_0x8a49('0x84'));}if(_[_0x8a49('0x8d')](_0x4918f6,['role',_0x8a49('0x30')])&&_0x28344b[_0x8a49('0x31')][_0x8a49('0x2a')]!==_0x8a49('0x30')){throw new Error(_0x8a49('0x8e'));}return licenseUtil[_0x8a49('0x86')](_0x4918f6)[_0x8a49('0x16')](function(){return validateUser(_0x4918f6[0x0]);})[_0x8a49('0x16')](function(){for(var _0x43eb7a=0x1;_0x43eb7a<_0x4918f6[_0x8a49('0x50')];_0x43eb7a++){var _0x2776a8=_0x4918f6[_0x43eb7a-0x1][_0x8a49('0x6a')];if(!_0x4918f6[_0x43eb7a][_0x8a49('0x6a')])_0x4918f6[_0x43eb7a][_0x8a49('0x6a')]=_0x2776a8+0x1;_0xefa5f4[_0x8a49('0x4b')](validateUser(_0x4918f6[_0x43eb7a]));}return Promise[_0x8a49('0x60')](_0xefa5f4);})[_0x8a49('0x16')](function(){_0xefa5f4=[];for(var _0x1762e1=0x0;_0x1762e1<_0x4918f6[_0x8a49('0x50')];_0x1762e1++){_0xefa5f4['push'](updateUser(_0x4918f6[_0x1762e1]));}return Promise['all'](_0xefa5f4);})['then'](function(){_0xefa5f4=_0x4918f6[_0x8a49('0x35')](function(_0x29b983){return db[_0x8a49('0x3d')][_0x8a49('0x82')](_0x29b983,{'include':[{'model':db['VoiceMail'],'as':_0x8a49('0x72')}]})['then'](function(_0x5200c7){_0x29b983['id']=_0x5200c7['id'];return _0x29b983;});});return Promise[_0x8a49('0x60')](_0xefa5f4);})[_0x8a49('0x16')](function(_0x28caa2){if(_0x28344b['body'][_0x8a49('0x2a')]===_0x8a49('0x31'))return _0x28caa2;if(_0x28344b[_0x8a49('0x31')][_0x8a49('0x2a')]!==_0x8a49('0x31'))return _0x28caa2;var _0x4def2e=_['some'](_0x28caa2,function(_0x25ce23){return _0x25ce23[_0x8a49('0x2a')]===_0x8a49('0x2b')||_0x25ce23[_0x8a49('0x2a')]===_0x8a49('0x33');});if(!_0x4def2e)return _0x28caa2;return db[_0x8a49('0x89')][_0x8a49('0x4c')]({'where':{'name':{'$or':[_0x8a49('0x8a'),'Telephones']},'userProfileId':_0x28344b[_0x8a49('0x31')][_0x8a49('0x88')]},'raw':!![]})[_0x8a49('0x16')](function(_0x29b255){if(_['isEmpty'](_0x29b255)||!_[_0x8a49('0x8d')](_0x29b255,[_0x8a49('0x8b'),0x0]))return _0x28caa2;_0xefa5f4=[];var _0x33201c=_(_0x29b255)[_0x8a49('0x35')](function(_0x48a416){if(_0x48a416[_0x8a49('0x8b')]===0x1)return;return _0x48a416[_0x8a49('0x39')]===_0x8a49('0x8a')?_0x8a49('0x2b'):_0x8a49('0x33');})[_0x8a49('0x8f')]()[_0x8a49('0x36')]();for(var _0xb18a2c=0x0;_0xb18a2c<_0x28caa2[_0x8a49('0x50')];_0xb18a2c++){if(!_[_0x8a49('0x37')](_0x33201c,_0x28caa2[_0xb18a2c][_0x8a49('0x2a')]))return;var _0x326ba8=_0x28caa2[_0xb18a2c][_0x8a49('0x2a')]==='agent'?_0x8a49('0x8a'):'Telephones';_0xefa5f4['push'](db[_0x8a49('0x90')]['create']({'name':_0x28caa2[_0xb18a2c][_0x8a49('0x39')],'resourceId':_0x28caa2[_0xb18a2c]['id'],'type':_0x326ba8,'sectionId':_[_0x8a49('0x38')](_0x29b255,[_0x8a49('0x39'),_0x326ba8])['id']},{}));}return Promise['all'](_0xefa5f4);});})[_0x8a49('0x16')](respondWithResult(_0x32be38,0xc9))['catch'](handleError(_0x32be38,null));};exports[_0x8a49('0x91')]=function(_0x4f136d,_0x2458e3){if(_0x4f136d[_0x8a49('0x61')]['id']){delete _0x4f136d[_0x8a49('0x61')]['id'];}return db['User'][_0x8a49('0x38')]({'where':{'id':_0x4f136d[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](function(_0x1e63a6){if(!_0x1e63a6)return null;if(_0x1e63a6['id']===_0x4f136d[_0x8a49('0x31')]['id']){if(!_0x4f136d[_0x8a49('0x61')][_0x8a49('0x92')]||!_0x4f136d[_0x8a49('0x61')][_0x8a49('0x93')]){throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))](_0x8a49('0x96'));}if(!_0x1e63a6[_0x8a49('0x97')](_0x4f136d[_0x8a49('0x61')][_0x8a49('0x92')])){throw new db['Sequelize'][(_0x8a49('0x95'))](_0x8a49('0x98'));}if(_0x4f136d[_0x8a49('0x61')][_0x8a49('0x92')]===_0x4f136d['body'][_0x8a49('0x93')]){throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))](_0x8a49('0x99'));}}else if(_0x4f136d[_0x8a49('0x31')][_0x8a49('0x2a')]===_0x8a49('0x30')){if(!_0x4f136d[_0x8a49('0x61')][_0x8a49('0x93')]){throw new db[(_0x8a49('0x94'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x4f136d['user'][_0x8a49('0x2a')]==='user'){if(!_0x4f136d[_0x8a49('0x61')][_0x8a49('0x93')]){throw new db['Sequelize'][(_0x8a49('0x95'))](_0x8a49('0x9a'));}if(_0x1e63a6['role']!==_0x8a49('0x2b')){throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))]('Unauthorized');}}else{throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))]('Unauthorized');}return _0x1e63a6;})['then'](handleEntityNotFound(_0x2458e3,null))['then'](function(_0x4d89c5){return db[_0x8a49('0x67')][_0x8a49('0x9b')]({'attributes':['id',_0x8a49('0x68'),_0x8a49('0x9c'),'passwordHistoryLimit']})[_0x8a49('0x16')](function(_0x39f02e){if(_0x39f02e['securePassword'])authService[_0x8a49('0x69')](_0x4f136d[_0x8a49('0x61')][_0x8a49('0x93')]);if(!_0x39f02e['enforcePasswordHistory']||!_0x4d89c5['previousPasswords'])return _0x4d89c5;authService[_0x8a49('0x9d')](_0x4f136d['body'][_0x8a49('0x93')],_0x4d89c5['previousPasswords'],_0x39f02e[_0x8a49('0x9e')]);return _0x4d89c5;})[_0x8a49('0x16')](saveUpdates({'password':_0x4f136d[_0x8a49('0x61')][_0x8a49('0x93')],'passwordResetAt':_0x4f136d[_0x8a49('0x31')]['id']==_0x4f136d[_0x8a49('0x62')]['id']?moment():null,'previousPasswords':authService[_0x8a49('0x9f')](_0x4f136d['body'][_0x8a49('0x93')],_0x4d89c5[_0x8a49('0xa0')])},null));})[_0x8a49('0x16')](respondWithResult(_0x2458e3,null))[_0x8a49('0x1f')](handleError(_0x2458e3,null));};exports[_0x8a49('0xa1')]=function(_0x34bf7e,_0x3efa0a){var _0x201971=_0x34bf7e['body'][_0x8a49('0xa2')];return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x34bf7e['params']['id']},'attributes':['id',_0x8a49('0x39'),_0x8a49('0x2a'),_0x8a49('0xa3'),_0x8a49('0xa4'),_0x8a49('0xa5'),_0x8a49('0xa6')]})[_0x8a49('0x16')](handleEntityNotFound(_0x3efa0a,null))[_0x8a49('0x16')](function(_0x26672a){if(_0x26672a){if(!utils[_0x8a49('0xa7')](_0x201971)){throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))](_0x8a49('0xa8'));}return _0x26672a[_0x8a49('0xa9')+_['capitalize'](_0x201971[_0x8a49('0xaa')]())+'Queues'](_0x34bf7e[_0x8a49('0x61')][_0x8a49('0x65')],{'penalty':_0x34bf7e[_0x8a49('0x61')][_0x8a49('0xab')]||0x0})[_0x8a49('0xac')](function(_0x208697){for(var _0x2054a9=0x0;_0x2054a9<_0x34bf7e['body'][_0x8a49('0x65')][_0x8a49('0x50')];_0x2054a9+=0x1){var _0xf70fb3={'UserId':Number(_0x34bf7e['params']['id'])};_0xf70fb3[_['capitalize'](_0x201971['toLowerCase']())+_0x8a49('0xad')]=Number(_0x34bf7e[_0x8a49('0x61')][_0x8a49('0x65')][_0x2054a9]);socket[_0x8a49('0x2c')](_0x8a49('0x31')+_[_0x8a49('0xae')](_0x201971['toLowerCase']())+_0x8a49('0xaf'),_0xf70fb3);}return _0x208697;})[_0x8a49('0x16')](function(){if(_0x201971===_0x8a49('0xb0')){return db['VoiceQueue'][_0x8a49('0x4c')]({'where':{'id':_0x34bf7e[_0x8a49('0x61')]['ids']||[]},'raw':!![],'attributes':['id',_0x8a49('0x39')]});}})[_0x8a49('0x16')](function(_0x588ffd){var _0x21bbd6=_0x26672a[_0x8a49('0x2f')]({'plain':!![]});var _0x19f93e=[];if(_0x201971===_0x8a49('0xb0')&&_0x21bbd6[_0x8a49('0x2a')]===_0x8a49('0x2b')&&_0x21bbd6[_0x8a49('0xa3')]){for(let _0x27f049=0x0;_0x27f049<_0x588ffd[_0x8a49('0x50')];_0x27f049+=0x1){_0x19f93e[_0x8a49('0x4b')]({'membername':_0x21bbd6[_0x8a49('0x39')],'UserId':_0x21bbd6['id'],'queue_name':_0x588ffd[_0x27f049][_0x8a49('0x39')],'VoiceQueueId':_0x588ffd[_0x27f049]['id'],'interface':_['isNil'](_0x21bbd6[_0x8a49('0xa6')])?util[_0x8a49('0xb1')](_0x8a49('0xb2'),_0x21bbd6['name']):_0x21bbd6[_0x8a49('0xa6')],'paused':_0x21bbd6[_0x8a49('0xa5')]||![],'penalty':_0x34bf7e[_0x8a49('0x61')]['penalty']||0x0});}return Promise[_0x8a49('0x60')](_0x19f93e['map'](function(_0x323944){return db['UserVoiceQueueRt'][_0x8a49('0xb3')](_0x323944);}));}return _0x26672a;});}})[_0x8a49('0x16')](respondWithStatusCode(_0x3efa0a,null))['catch'](handleError(_0x3efa0a,null));};exports[_0x8a49('0xb4')]=function(_0x53fe60,_0xeacac1){var _0x2747a4,_0x484655;return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x53fe60[_0x8a49('0x62')]['id']},'attributes':['id',_0x8a49('0x39'),_0x8a49('0x2a')]})[_0x8a49('0x16')](handleEntityNotFound(_0xeacac1,null))[_0x8a49('0x16')](function(_0xa92246){if(_0xa92246){_0x2747a4=_0xa92246;if(!_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')]||!utils[_0x8a49('0xa7')](_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')])){throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))](_0x8a49('0xa8'));}return _0xa92246[_0x8a49('0xb5')+_[_0x8a49('0xae')](_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')]['toLowerCase']())+_0x8a49('0xb6')](_0x53fe60['query'][_0x8a49('0x65')]);}})[_0x8a49('0x16')](function(_0x290a05){if(_['isArray'](_0x53fe60[_0x8a49('0x46')][_0x8a49('0x65')])){for(var _0x469056=0x0;_0x469056<_0x53fe60['query'][_0x8a49('0x65')][_0x8a49('0x50')];_0x469056+=0x1){_0x484655={'UserId':Number(_0x53fe60['params']['id'])};_0x484655[_['capitalize'](_0x53fe60[_0x8a49('0x46')]['channel'][_0x8a49('0xaa')]())+_0x8a49('0xad')]=Number(_0x53fe60[_0x8a49('0x46')][_0x8a49('0x65')][_0x469056]);socket[_0x8a49('0x2c')](_0x8a49('0x31')+_[_0x8a49('0xae')](_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')][_0x8a49('0xaa')]())+'Queue:remove',_0x484655);}}else{_0x484655={'UserId':Number(_0x53fe60[_0x8a49('0x62')]['id'])};_0x484655[_[_0x8a49('0xae')](_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')][_0x8a49('0xaa')]())+_0x8a49('0xad')]=Number(_0x53fe60[_0x8a49('0x46')][_0x8a49('0x65')]);socket[_0x8a49('0x2c')](_0x8a49('0x31')+_[_0x8a49('0xae')](_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')]['toLowerCase']())+_0x8a49('0xb7'),_0x484655);}return _0x290a05;})['then'](function(){if(_0x53fe60[_0x8a49('0x46')][_0x8a49('0xa2')]===_0x8a49('0xb0')){return db[_0x8a49('0xb8')][_0x8a49('0x2e')]({'where':{'UserId':_0x53fe60[_0x8a49('0x62')]['id'],'VoiceQueueId':_0x53fe60['query'][_0x8a49('0x65')]},'individualHooks':!![]})[_0x8a49('0x16')](function(){return _0x2747a4;});}return _0x2747a4;})[_0x8a49('0x16')](respondWithStatusCode(_0xeacac1,null))[_0x8a49('0x1f')](handleError(_0xeacac1,null));};exports[_0x8a49('0xb9')]=function(_0x47a409,_0xbed9f0){_0x47a409[_0x8a49('0x61')]['userpic']=_0x47a409[_0x8a49('0xba')][_0x8a49('0xbb')];return db['User'][_0x8a49('0x38')]({'where':{'id':_0x47a409['params']['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0xbed9f0,null))[_0x8a49('0x16')](saveUpdates(_0x47a409[_0x8a49('0x61')],null))[_0x8a49('0x16')](respondWithResult(_0xbed9f0,null))[_0x8a49('0x1f')](handleError(_0xbed9f0,null));};exports['getAvatar']=function(_0x40b502,_0x451d6f){var _0x25310f=path[_0x8a49('0xbc')](config[_0x8a49('0xbd')],_0x8a49('0xbe'));return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x40b502[_0x8a49('0x62')]['id']},'attributes':['id',_0x8a49('0xbf')],'raw':!![]})[_0x8a49('0x16')](handleEntityNotFound(_0x451d6f,null))['then'](function(_0x4509c1){if(_0x4509c1){if(_[_0x8a49('0x6b')](_0x4509c1[_0x8a49('0xbf')])){return _0x451d6f[_0x8a49('0xc0')](_0x25310f);}else{if(!fs[_0x8a49('0xc1')](path[_0x8a49('0xbc')](config[_0x8a49('0xbd')],_0x8a49('0xc2'),_0x4509c1[_0x8a49('0xbf')]))){return _0x451d6f['download'](_0x25310f);}return _0x451d6f[_0x8a49('0xc0')](path[_0x8a49('0xbc')](config[_0x8a49('0xbd')],'server/files/images/',_0x4509c1[_0x8a49('0xbf')]));}}})[_0x8a49('0x1f')](handleError(_0x451d6f,null));};exports[_0x8a49('0xc3')]=function(_0x33b6ba,_0x5e207d){return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x33b6ba['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x5e207d,null))[_0x8a49('0x16')](function(_0xcfebf2){var _0x35cf97=[];values=_0xcfebf2[_0x8a49('0x51')];_0x35cf97['push'](get_open_tabs(_0x8a49('0x5f'),_0xcfebf2[_0x8a49('0x51')]));_0x35cf97[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x52'),_0xcfebf2[_0x8a49('0x51')]));_0x35cf97[_0x8a49('0x4b')](get_open_tabs('openchannel',_0xcfebf2['dataValues']));_0x35cf97[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x56'),_0xcfebf2[_0x8a49('0x51')]));_0x35cf97[_0x8a49('0x4b')](get_open_tabs(_0x8a49('0x53'),_0xcfebf2[_0x8a49('0x51')]));_0x35cf97['push'](get_open_tabs(_0x8a49('0x54'),_0xcfebf2[_0x8a49('0x51')]));return Promise['all'](_0x35cf97);})[_0x8a49('0x16')](function(_0x4f61d1){if(_0x4f61d1){var _0x3a8e61=_[_0x8a49('0x35')](values[_0x8a49('0xc4')],function(_0x3cdff9){return{'channel':_0x8a49('0xc5'),'id':_0x3cdff9['id'],'createdAt':_0x3cdff9[_0x8a49('0xc6')]};});var _0xffef8d=_[_0x8a49('0x35')](values['FaxOpenTabs'],function(_0x28537b){return{'channel':_0x8a49('0xc7'),'id':_0x28537b['id'],'createdAt':_0x28537b[_0x8a49('0xc6')]};});var _0x4d5df0=_[_0x8a49('0x35')](values[_0x8a49('0xc8')],function(_0x4ccec1){return{'channel':'OPENCHANNEL','id':_0x4ccec1['id'],'createdAt':_0x4ccec1['createdAt']};});var _0x5db8e9=_['map'](values[_0x8a49('0xc9')],function(_0x50a0ef){return{'channel':_0x8a49('0xca'),'id':_0x50a0ef['id'],'createdAt':_0x50a0ef[_0x8a49('0xc6')]};});var _0x573e81=_[_0x8a49('0x35')](values[_0x8a49('0xcb')],function(_0x351f25){return{'channel':'SMS','id':_0x351f25['id'],'createdAt':_0x351f25[_0x8a49('0xc6')]};});var _0x248e15=_[_0x8a49('0x35')](values[_0x8a49('0xcc')],function(_0x117962){return{'channel':'WHATSAPP','id':_0x117962['id'],'createdAt':_0x117962[_0x8a49('0xc6')]};});var _0x573d64=_[_0x8a49('0xcd')](_0x3a8e61,_0xffef8d,_0x4d5df0,_0x5db8e9,_0x573e81,_0x248e15);var _0x4b2a6b={'count':_0x573d64[_0x8a49('0x50')],'rows':_0x573d64};return _0x4b2a6b;}else return null;})[_0x8a49('0x16')](respondWithResult(_0x5e207d,null))[_0x8a49('0x1f')](handleError(_0x5e207d,null));};exports[_0x8a49('0xce')]=function(_0x1043f4,_0x364094){var _0x1f876a={};return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x1043f4['params']['id']}})[_0x8a49('0x16')](function(_0x3f49b5){if(!_0x3f49b5){throw new APINotFoundError(util[_0x8a49('0xb1')](_0x8a49('0xcf'),_0x1043f4[_0x8a49('0x62')]['id']));}return contacts['describe']();})[_0x8a49('0x16')](function(_0x5c4415){_0x1043f4[_0x8a49('0x46')][_0x8a49('0x3d')]=_0x1043f4[_0x8a49('0x62')]['id'];_0x1f876a=qs[_0x8a49('0x44')](_0x5c4415,_0x1043f4);if(_0x1043f4[_0x8a49('0x46')][_0x8a49('0xd0')](_0x8a49('0x47'))){_0x1f876a[_0x8a49('0x48')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0x8a49('0xd1')],'as':_0x8a49('0xd2'),'attributes':['id',_0x8a49('0x39'),'color'],'where':_0x1043f4[_0x8a49('0x46')][_0x8a49('0xd3')]?{'id':_0x1043f4[_0x8a49('0x46')][_0x8a49('0xd3')]}:undefined,'required':_0x1043f4[_0x8a49('0x46')]['tag']?!![]:![]}];}return contacts[_0x8a49('0x4c')](_0x1043f4[_0x8a49('0x46')],_0x1043f4[_0x8a49('0x31')],_0x1f876a,_0x5c4415);})['then'](respondWithFilteredResult(_0x364094,_0x1f876a))['catch'](APIHandleError(_0x364094));};exports[_0x8a49('0xd4')]=function(_0x3ac1a5,_0x30289a){var _0x528970;var _0x4849ed={};var _0x5accaf;return db['User'][_0x8a49('0x9b')]({'where':{'id':_0x3ac1a5[_0x8a49('0x62')]['id']},'attributes':['id','name',_0x8a49('0x2a')]})['then'](handleEntityNotFound(_0x30289a,null))[_0x8a49('0x16')](function(_0x3340f9){if(!utils['isValidChannel'](_0x3ac1a5['query'][_0x8a49('0xa2')])){throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))]('Unknown\x20channel');}_0x528970=_0x3340f9;var _0x85fc3={};_0x85fc3[_0x8a49('0x5c')]=_[_0x8a49('0x59')](db[_[_0x8a49('0xae')](_0x3ac1a5['query']['channel'])+_0x8a49('0xd5')][_0x8a49('0x3e')]);_0x85fc3[_0x8a49('0x46')]=_['keys'](_0x3ac1a5['query']);_0x85fc3[_0x8a49('0x5a')]=_['intersection'](_0x85fc3['model'],_0x85fc3['query']);_0x4849ed[_0x8a49('0x5d')]=_['intersection'](_0x85fc3[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x3ac1a5[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x4849ed[_0x8a49('0x5d')]=_0x4849ed['attributes'][_0x8a49('0x50')]?_0x4849ed[_0x8a49('0x5d')]:_0x85fc3[_0x8a49('0x5c')];_0x4849ed['order']=qs['sort'](_0x3ac1a5[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x4849ed[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x3ac1a5[_0x8a49('0x46')],_0x85fc3[_0x8a49('0x5a')]));if(_0x3ac1a5[_0x8a49('0x46')]['filter']){_0x4849ed[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x4849ed[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0x4849ed[_0x8a49('0x5d')],function(_0x15a1f6){var _0xf0eaae={};_0xf0eaae[_0x15a1f6]={'$like':'%'+_0x3ac1a5['query'][_0x8a49('0x41')]+'%'};return _0xf0eaae;})});}_0x4849ed=_['merge']({},_0x4849ed,_0x3ac1a5[_0x8a49('0xd9')]);switch(_0x528970[_0x8a49('0x2a')]){case'admin':return db[_[_0x8a49('0xae')](_0x3ac1a5[_0x8a49('0x46')]['channel'])+_0x8a49('0xd5')][_0x8a49('0x4c')](_0x4849ed);case _0x8a49('0x31'):case _0x8a49('0x2b'):return _0x528970[_0x8a49('0x2f')+_[_0x8a49('0xae')](_0x3ac1a5[_0x8a49('0x46')][_0x8a49('0xa2')])+_0x8a49('0xb6')](_0x4849ed);default:throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))](_0x8a49('0xda'));}})[_0x8a49('0x16')](function(_0x17dfe6){_0x5accaf=_0x17dfe6[_0x8a49('0x50')];if(!_0x3ac1a5[_0x8a49('0x46')]['hasOwnProperty'](_0x8a49('0xdb'))){_0x4849ed['limit']=qs[_0x8a49('0x25')](_0x3ac1a5['query'][_0x8a49('0x25')]);_0x4849ed[_0x8a49('0x24')]=qs['offset'](_0x3ac1a5[_0x8a49('0x46')][_0x8a49('0x24')]);}switch(_0x528970[_0x8a49('0x2a')]){case _0x8a49('0x30'):return db[_['capitalize'](_0x3ac1a5[_0x8a49('0x46')][_0x8a49('0xa2')])+_0x8a49('0xd5')][_0x8a49('0x4c')](_0x4849ed);case'user':case _0x8a49('0x2b'):return _0x528970[_0x8a49('0x2f')+_[_0x8a49('0xae')](_0x3ac1a5[_0x8a49('0x46')][_0x8a49('0xa2')])+_0x8a49('0xb6')](_0x4849ed);}})[_0x8a49('0x16')](function(_0x5b2e1e){return{'count':_0x5accaf,'rows':_0x5b2e1e};})['then'](respondWithResult(_0x30289a,null))[_0x8a49('0x1f')](handleError(_0x30289a,null));};exports['getVoiceQueuesRt']=function(_0x380b2e,_0x1c5491){var _0x46112d={};var _0x27ff06={};var _0x51a0ee;var _0xa1847c;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x380b2e[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x1c5491,null))[_0x8a49('0x16')](function(_0x4625d7){if(_0x4625d7){_0x51a0ee=_0x4625d7;_0x27ff06['model']=_[_0x8a49('0x59')](db[_0x8a49('0xb8')][_0x8a49('0x3e')]);_0x27ff06[_0x8a49('0x46')]=_['keys'](_0x380b2e[_0x8a49('0x46')]);_0x27ff06[_0x8a49('0x5a')]=_['intersection'](_0x27ff06[_0x8a49('0x5c')],_0x27ff06[_0x8a49('0x46')]);_0x46112d[_0x8a49('0x5d')]=_['intersection'](_0x27ff06[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x380b2e[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x46112d[_0x8a49('0x5d')]=_0x46112d[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x46112d[_0x8a49('0x5d')]:_0x27ff06[_0x8a49('0x5c')];_0x46112d[_0x8a49('0xdc')]=qs['sort'](_0x380b2e[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x46112d[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x380b2e[_0x8a49('0x46')],_0x27ff06['filters']));if(_0x380b2e[_0x8a49('0x46')][_0x8a49('0x41')]){_0x46112d[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x46112d[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0x46112d[_0x8a49('0x5d')],function(_0x47e0ce){var _0x15f821={};_0x15f821[_0x47e0ce]={'$like':'%'+_0x380b2e['query'][_0x8a49('0x41')]+'%'};return _0x15f821;})});}_0x46112d=_['merge']({},_0x46112d,_0x380b2e[_0x8a49('0xd9')]);return _0x51a0ee[_0x8a49('0xdd')](_0x46112d);}})[_0x8a49('0x16')](function(_0x473b7d){if(_0x473b7d){_0xa1847c=_0x473b7d[_0x8a49('0x50')];if(!_0x380b2e[_0x8a49('0x46')]['hasOwnProperty'](_0x8a49('0xdb'))){_0x46112d[_0x8a49('0x25')]=qs['limit'](_0x380b2e[_0x8a49('0x46')][_0x8a49('0x25')]);_0x46112d[_0x8a49('0x24')]=qs['offset'](_0x380b2e[_0x8a49('0x46')][_0x8a49('0x24')]);}return _0x51a0ee[_0x8a49('0xdd')](_0x46112d);}})['then'](function(_0x3241ac){if(_0x3241ac){return _0x3241ac?{'count':_0xa1847c,'rows':_0x3241ac}:null;}})[_0x8a49('0x16')](respondWithResult(_0x1c5491,null))[_0x8a49('0x1f')](handleError(_0x1c5491,null));};exports['getGroups']=function(_0x1d3d3e,_0x542729){var _0x2d7a25={};var _0x484a9f={};var _0x507706;var _0x58d21d;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x1d3d3e[_0x8a49('0x62')]['id']}})['then'](handleEntityNotFound(_0x542729,null))['then'](function(_0x22a3df){if(_0x22a3df){_0x507706=_0x22a3df;_0x484a9f['model']=_[_0x8a49('0x59')](db[_0x8a49('0xde')][_0x8a49('0x3e')]);_0x484a9f[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x1d3d3e['query']);_0x484a9f[_0x8a49('0x5a')]=_['intersection'](_0x484a9f[_0x8a49('0x5c')],_0x484a9f['query']);_0x2d7a25[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x484a9f['model'],qs[_0x8a49('0x5e')](_0x1d3d3e[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x2d7a25[_0x8a49('0x5d')]=_0x2d7a25[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x2d7a25[_0x8a49('0x5d')]:_0x484a9f[_0x8a49('0x5c')];_0x2d7a25['order']=qs[_0x8a49('0xd6')](_0x1d3d3e['query'][_0x8a49('0xd6')]);_0x2d7a25[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x1d3d3e[_0x8a49('0x46')],_0x484a9f[_0x8a49('0x5a')]));if(_0x1d3d3e[_0x8a49('0x46')]['filter']){_0x2d7a25[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x2d7a25[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0x2d7a25[_0x8a49('0x5d')],function(_0x15a3a1){var _0xf5e695={};_0xf5e695[_0x15a3a1]={'$like':'%'+_0x1d3d3e['query'][_0x8a49('0x41')]+'%'};return _0xf5e695;})});}_0x2d7a25=_[_0x8a49('0xd8')]({},_0x2d7a25,_0x1d3d3e[_0x8a49('0xd9')]);return _0x507706[_0x8a49('0xdf')](_0x2d7a25);}})[_0x8a49('0x16')](function(_0x349df8){if(_0x349df8){_0x58d21d=_0x349df8['length'];if(!_0x1d3d3e[_0x8a49('0x46')][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0x2d7a25[_0x8a49('0x25')]=qs['limit'](_0x1d3d3e['query'][_0x8a49('0x25')]);_0x2d7a25['offset']=qs[_0x8a49('0x24')](_0x1d3d3e[_0x8a49('0x46')][_0x8a49('0x24')]);}return _0x507706[_0x8a49('0xdf')](_0x2d7a25);}})[_0x8a49('0x16')](function(_0x20ec92){if(_0x20ec92){return _0x20ec92?{'count':_0x58d21d,'rows':_0x20ec92}:null;}})[_0x8a49('0x16')](respondWithResult(_0x542729,null))[_0x8a49('0x1f')](handleError(_0x542729,null));};exports['getRecordings']=function(_0x1355fb,_0x245b56){var _0xc5c162={'raw':!![],'where':{}};var _0x1c17fd={};var _0x3e2bb0={'count':0x0,'rows':[]};return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x1355fb[_0x8a49('0x62')]['id']}})['then'](handleEntityNotFound(_0x245b56,null))[_0x8a49('0x16')](function(_0x4cfbca){if(_0x4cfbca){_0x1c17fd['model']=_[_0x8a49('0x59')](db[_0x8a49('0xe0')][_0x8a49('0x3e')]);_0x1c17fd[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x1355fb[_0x8a49('0x46')]);_0x1c17fd[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x1c17fd[_0x8a49('0x5c')],_0x1c17fd['query']);_0xc5c162[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x1c17fd['model'],qs[_0x8a49('0x5e')](_0x1355fb['query'][_0x8a49('0x5e')]));_0xc5c162[_0x8a49('0x5d')]=_0xc5c162[_0x8a49('0x5d')]['length']?_0xc5c162[_0x8a49('0x5d')]:_0x1c17fd[_0x8a49('0x5c')];if(!_0x1355fb['query'][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0xc5c162[_0x8a49('0x25')]=qs['limit'](_0x1355fb[_0x8a49('0x46')][_0x8a49('0x25')]);_0xc5c162[_0x8a49('0x24')]=qs[_0x8a49('0x24')](_0x1355fb[_0x8a49('0x46')][_0x8a49('0x24')]);}_0xc5c162[_0x8a49('0xdc')]=qs[_0x8a49('0xd6')](_0x1355fb[_0x8a49('0x46')][_0x8a49('0xd6')]);_0xc5c162[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x1355fb[_0x8a49('0x46')],_0x1c17fd[_0x8a49('0x5a')]));_0xc5c162[_0x8a49('0x45')][_0x8a49('0xe1')]=_0x4cfbca['id'];if(_0x1355fb['query']['filter']){_0xc5c162['where']=_['merge'](_0xc5c162[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0xc5c162[_0x8a49('0x5d')],function(_0x61e5b8){var _0x76df5d={};_0x76df5d[_0x61e5b8]={'$like':'%'+_0x1355fb[_0x8a49('0x46')][_0x8a49('0x41')]+'%'};return _0x76df5d;})});}_0xc5c162=_['merge']({},_0xc5c162,_0x1355fb[_0x8a49('0xd9')]);return db[_0x8a49('0xe0')]['count']({'where':_0xc5c162[_0x8a49('0x45')]})[_0x8a49('0x16')](function(_0x38a11b){_0x3e2bb0['count']=_0x38a11b;if(_0x1355fb['query'][_0x8a49('0x47')]){_0xc5c162[_0x8a49('0x48')]=[{'all':!![]}];}return db['VoiceRecording'][_0x8a49('0x4c')](_0xc5c162);})[_0x8a49('0x16')](function(_0x1cc8bc){_0x3e2bb0[_0x8a49('0x4d')]=_0x1cc8bc;return _0x3e2bb0;});}})['then'](respondWithFilteredResult(_0x245b56,_0xc5c162))[_0x8a49('0x1f')](handleError(_0x245b56,null));};exports['getScreenRecordings']=function(_0x14b8b9,_0x31d506){var _0x3faa55={'raw':!![],'where':{}};var _0x2907b1={};var _0x1e9cd5={'count':0x0,'rows':[]};return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x14b8b9[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x31d506,null))[_0x8a49('0x16')](function(_0xeb6ec){if(_0xeb6ec){_0x2907b1[_0x8a49('0x5c')]=_[_0x8a49('0x59')](db[_0x8a49('0xe2')][_0x8a49('0x3e')]);_0x2907b1[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x14b8b9[_0x8a49('0x46')]);_0x2907b1[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x2907b1[_0x8a49('0x5c')],_0x2907b1['query']);_0x3faa55[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x2907b1['model'],qs[_0x8a49('0x5e')](_0x14b8b9[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x3faa55['attributes']=_0x3faa55[_0x8a49('0x5d')]['length']?_0x3faa55[_0x8a49('0x5d')]:_0x2907b1['model'];if(!_0x14b8b9[_0x8a49('0x46')]['hasOwnProperty'](_0x8a49('0xdb'))){_0x3faa55[_0x8a49('0x25')]=qs[_0x8a49('0x25')](_0x14b8b9['query'][_0x8a49('0x25')]);_0x3faa55[_0x8a49('0x24')]=qs['offset'](_0x14b8b9['query']['offset']);}_0x3faa55[_0x8a49('0xdc')]=qs[_0x8a49('0xd6')](_0x14b8b9['query'][_0x8a49('0xd6')]);_0x3faa55[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x14b8b9[_0x8a49('0x46')],_0x2907b1[_0x8a49('0x5a')]));_0x3faa55[_0x8a49('0x45')]['UserId']=_0xeb6ec['id'];if(_0x14b8b9[_0x8a49('0x46')][_0x8a49('0x41')]){_0x3faa55[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x3faa55[_0x8a49('0x45')],{'$or':_['map'](_0x3faa55[_0x8a49('0x5d')],function(_0x27ca8b){var _0x1eb1a3={};_0x1eb1a3[_0x27ca8b]={'$like':'%'+_0x14b8b9[_0x8a49('0x46')][_0x8a49('0x41')]+'%'};return _0x1eb1a3;})});}_0x3faa55=_['merge']({},_0x3faa55,_0x14b8b9['options']);return db[_0x8a49('0xe2')][_0x8a49('0x26')]({'where':_0x3faa55[_0x8a49('0x45')]})['then'](function(_0x5bb597){_0x1e9cd5['count']=_0x5bb597;if(_0x14b8b9['query'][_0x8a49('0x47')]){_0x3faa55[_0x8a49('0x48')]=[{'all':!![]}];}return db[_0x8a49('0xe2')]['findAll'](_0x3faa55);})[_0x8a49('0x16')](function(_0x2baf78){_0x1e9cd5[_0x8a49('0x4d')]=_0x2baf78;return _0x1e9cd5;});}})[_0x8a49('0x16')](respondWithFilteredResult(_0x31d506,_0x3faa55))['catch'](handleError(_0x31d506,null));};exports[_0x8a49('0xe3')]=function(_0x3e3317,_0x406b90){var _0x25c21e={};var _0x449dd0={};var _0x3df020;var _0x159605;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x3e3317[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x406b90,null))[_0x8a49('0x16')](function(_0x137309){if(_0x137309){_0x3df020=_0x137309;_0x449dd0['model']=_[_0x8a49('0x59')](db[_0x8a49('0xe4')][_0x8a49('0x3e')]);_0x449dd0[_0x8a49('0x46')]=_['keys'](_0x3e3317[_0x8a49('0x46')]);_0x449dd0[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x449dd0[_0x8a49('0x5c')],_0x449dd0[_0x8a49('0x46')]);_0x25c21e[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x449dd0[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x3e3317[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x25c21e['attributes']=_0x25c21e['attributes'][_0x8a49('0x50')]?_0x25c21e['attributes']:_0x449dd0[_0x8a49('0x5c')];_0x25c21e[_0x8a49('0xdc')]=qs['sort'](_0x3e3317[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x25c21e[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x3e3317['query'],_0x449dd0[_0x8a49('0x5a')]));if(_0x3e3317[_0x8a49('0x46')]['filter']){_0x25c21e[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x25c21e[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0x25c21e[_0x8a49('0x5d')],function(_0x19e97f){var _0x54a355={};_0x54a355[_0x19e97f]={'$like':'%'+_0x3e3317[_0x8a49('0x46')][_0x8a49('0x41')]+'%'};return _0x54a355;})});}_0x25c21e=_[_0x8a49('0xd8')]({},_0x25c21e,_0x3e3317[_0x8a49('0xd9')]);return _0x3df020[_0x8a49('0xe3')](_0x25c21e);}})[_0x8a49('0x16')](function(_0x2b6970){if(_0x2b6970){_0x159605=_0x2b6970[_0x8a49('0x50')];if(!_0x3e3317[_0x8a49('0x46')][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0x25c21e[_0x8a49('0x25')]=qs[_0x8a49('0x25')](_0x3e3317[_0x8a49('0x46')]['limit']);_0x25c21e['offset']=qs[_0x8a49('0x24')](_0x3e3317[_0x8a49('0x46')]['offset']);}return _0x3df020[_0x8a49('0xe3')](_0x25c21e);}})[_0x8a49('0x16')](function(_0x2535a3){if(_0x2535a3){return _0x2535a3?{'count':_0x159605,'rows':_0x2535a3}:null;}})['then'](respondWithResult(_0x406b90,null))[_0x8a49('0x1f')](handleError(_0x406b90,null));};exports[_0x8a49('0xe5')]=function(_0x3e9e86,_0x371495){var _0x67294e={};var _0x3b4a22={};var _0xee28ee;var _0x58e2ad;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x3e9e86['params']['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x371495,null))['then'](function(_0x11b48c){if(_0x11b48c){_0xee28ee=_0x11b48c;_0x3b4a22[_0x8a49('0x5c')]=_['keys'](db[_0x8a49('0xe6')][_0x8a49('0x3e')]);_0x3b4a22[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x3e9e86['query']);_0x3b4a22[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x3b4a22[_0x8a49('0x5c')],_0x3b4a22[_0x8a49('0x46')]);_0x67294e[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x3b4a22[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x3e9e86[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x67294e[_0x8a49('0x5d')]=_0x67294e[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x67294e[_0x8a49('0x5d')]:_0x3b4a22[_0x8a49('0x5c')];_0x67294e[_0x8a49('0xdc')]=qs[_0x8a49('0xd6')](_0x3e9e86[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x67294e[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x3e9e86[_0x8a49('0x46')],_0x3b4a22[_0x8a49('0x5a')]));if(_0x3e9e86['query']['filter']){_0x67294e[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x67294e[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0x67294e['attributes'],function(_0x3bc565){var _0x4df19b={};_0x4df19b[_0x3bc565]={'$like':'%'+_0x3e9e86[_0x8a49('0x46')]['filter']+'%'};return _0x4df19b;})});}_0x67294e=_[_0x8a49('0xd8')]({},_0x67294e,_0x3e9e86[_0x8a49('0xd9')]);return _0xee28ee[_0x8a49('0xe5')](_0x67294e);}})[_0x8a49('0x16')](function(_0x1e9e06){if(_0x1e9e06){_0x58e2ad=_0x1e9e06['length'];if(!_0x3e9e86[_0x8a49('0x46')][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0x67294e[_0x8a49('0x25')]=qs[_0x8a49('0x25')](_0x3e9e86['query'][_0x8a49('0x25')]);_0x67294e[_0x8a49('0x24')]=qs[_0x8a49('0x24')](_0x3e9e86[_0x8a49('0x46')][_0x8a49('0x24')]);}return _0xee28ee[_0x8a49('0xe5')](_0x67294e);}})[_0x8a49('0x16')](function(_0x2a4908){if(_0x2a4908){return _0x2a4908?{'count':_0x58e2ad,'rows':_0x2a4908}:null;}})[_0x8a49('0x16')](respondWithResult(_0x371495,null))[_0x8a49('0x1f')](handleError(_0x371495,null));};exports[_0x8a49('0xe7')]=function(_0x3f0140,_0x100485){var _0x1e9b02={'raw':!![],'where':{}};var _0x15a930={};var _0x4e63d2={'count':0x0,'rows':[]};return db['User'][_0x8a49('0x9b')]({'where':{'id':_0x3f0140[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x100485,null))[_0x8a49('0x16')](function(_0x382155){if(_0x382155){_0x15a930[_0x8a49('0x5c')]=_['keys'](db[_0x8a49('0xe8')][_0x8a49('0x3e')]);_0x15a930[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x3f0140['query']);_0x15a930[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x15a930[_0x8a49('0x5c')],_0x15a930['query']);_0x1e9b02[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x15a930[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x3f0140[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x1e9b02['attributes']=_0x1e9b02[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x1e9b02['attributes']:_0x15a930[_0x8a49('0x5c')];if(!_0x3f0140[_0x8a49('0x46')][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0x1e9b02[_0x8a49('0x25')]=qs[_0x8a49('0x25')](_0x3f0140['query'][_0x8a49('0x25')]);_0x1e9b02[_0x8a49('0x24')]=qs['offset'](_0x3f0140[_0x8a49('0x46')][_0x8a49('0x24')]);}_0x1e9b02[_0x8a49('0xdc')]=qs['sort'](_0x3f0140[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x1e9b02['where']=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x3f0140[_0x8a49('0x46')],_0x15a930[_0x8a49('0x5a')]));_0x1e9b02[_0x8a49('0x45')][_0x8a49('0xe1')]=_0x382155['id'];if(_0x3f0140[_0x8a49('0x46')][_0x8a49('0x41')]){_0x1e9b02[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x1e9b02['where'],{'$or':_[_0x8a49('0x35')](_0x1e9b02['attributes'],function(_0x11f8a6){var _0x5ae7a8={};_0x5ae7a8[_0x11f8a6]={'$like':'%'+_0x3f0140['query']['filter']+'%'};return _0x5ae7a8;})});}_0x1e9b02=_[_0x8a49('0xd8')]({},_0x1e9b02,_0x3f0140[_0x8a49('0xd9')]);return db[_0x8a49('0xe8')][_0x8a49('0x26')]({'where':_0x1e9b02[_0x8a49('0x45')]})[_0x8a49('0x16')](function(_0x5296eb){_0x4e63d2[_0x8a49('0x26')]=_0x5296eb;if(_0x3f0140[_0x8a49('0x46')]['includeAll']){_0x1e9b02['include']=[{'all':!![]}];}return db[_0x8a49('0xe8')][_0x8a49('0x4c')](_0x1e9b02);})[_0x8a49('0x16')](function(_0x4f4d83){_0x4e63d2[_0x8a49('0x4d')]=_0x4f4d83;return _0x4e63d2;});}})[_0x8a49('0x16')](respondWithFilteredResult(_0x100485,_0x1e9b02))[_0x8a49('0x1f')](handleError(_0x100485,null));};exports[_0x8a49('0xe9')]=function(_0x12bac4,_0x4293af){var _0x1645f8={};var _0x46aac7={};var _0x24d09f;var _0x2e6960;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x12bac4[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x4293af,null))[_0x8a49('0x16')](function(_0x23712d){if(_0x23712d){_0x24d09f=_0x23712d;_0x46aac7[_0x8a49('0x5c')]=_[_0x8a49('0x59')](db['SmsInteraction'][_0x8a49('0x3e')]);_0x46aac7[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x12bac4[_0x8a49('0x46')]);_0x46aac7[_0x8a49('0x5a')]=_['intersection'](_0x46aac7['model'],_0x46aac7[_0x8a49('0x46')]);_0x1645f8[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x46aac7[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x12bac4[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x1645f8[_0x8a49('0x5d')]=_0x1645f8['attributes'][_0x8a49('0x50')]?_0x1645f8[_0x8a49('0x5d')]:_0x46aac7[_0x8a49('0x5c')];_0x1645f8['order']=qs[_0x8a49('0xd6')](_0x12bac4[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x1645f8[_0x8a49('0x45')]=qs['filters'](_[_0x8a49('0xd7')](_0x12bac4[_0x8a49('0x46')],_0x46aac7[_0x8a49('0x5a')]));if(_0x12bac4[_0x8a49('0x46')]['filter']){_0x1645f8[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x1645f8[_0x8a49('0x45')],{'$or':_[_0x8a49('0x35')](_0x1645f8[_0x8a49('0x5d')],function(_0x2922d4){var _0x485539={};_0x485539[_0x2922d4]={'$like':'%'+_0x12bac4[_0x8a49('0x46')]['filter']+'%'};return _0x485539;})});}_0x1645f8=_[_0x8a49('0xd8')]({},_0x1645f8,_0x12bac4['options']);return _0x24d09f[_0x8a49('0xe9')](_0x1645f8);}})['then'](function(_0x319b47){if(_0x319b47){_0x2e6960=_0x319b47[_0x8a49('0x50')];if(!_0x12bac4[_0x8a49('0x46')]['hasOwnProperty']('nolimit')){_0x1645f8[_0x8a49('0x25')]=qs['limit'](_0x12bac4[_0x8a49('0x46')]['limit']);_0x1645f8['offset']=qs[_0x8a49('0x24')](_0x12bac4['query'][_0x8a49('0x24')]);}return _0x24d09f[_0x8a49('0xe9')](_0x1645f8);}})[_0x8a49('0x16')](function(_0x221efe){if(_0x221efe){return _0x221efe?{'count':_0x2e6960,'rows':_0x221efe}:null;}})[_0x8a49('0x16')](respondWithResult(_0x4293af,null))['catch'](handleError(_0x4293af,null));};exports['getFaxInteractions']=function(_0x13253c,_0x26d2b8){var _0x49ca82={};var _0x5d4ec7={};var _0x582588;var _0x1f8e37;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x13253c['params']['id']}})['then'](handleEntityNotFound(_0x26d2b8,null))[_0x8a49('0x16')](function(_0x227bd2){if(_0x227bd2){_0x582588=_0x227bd2;_0x5d4ec7[_0x8a49('0x5c')]=_[_0x8a49('0x59')](db['FaxInteraction'][_0x8a49('0x3e')]);_0x5d4ec7['query']=_[_0x8a49('0x59')](_0x13253c[_0x8a49('0x46')]);_0x5d4ec7[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x5d4ec7[_0x8a49('0x5c')],_0x5d4ec7[_0x8a49('0x46')]);_0x49ca82['attributes']=_[_0x8a49('0x5b')](_0x5d4ec7[_0x8a49('0x5c')],qs[_0x8a49('0x5e')](_0x13253c[_0x8a49('0x46')]['fields']));_0x49ca82[_0x8a49('0x5d')]=_0x49ca82[_0x8a49('0x5d')]['length']?_0x49ca82[_0x8a49('0x5d')]:_0x5d4ec7[_0x8a49('0x5c')];_0x49ca82['order']=qs[_0x8a49('0xd6')](_0x13253c[_0x8a49('0x46')]['sort']);_0x49ca82[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x13253c[_0x8a49('0x46')],_0x5d4ec7['filters']));if(_0x13253c[_0x8a49('0x46')][_0x8a49('0x41')]){_0x49ca82['where']=_[_0x8a49('0xd8')](_0x49ca82[_0x8a49('0x45')],{'$or':_['map'](_0x49ca82[_0x8a49('0x5d')],function(_0x26c95c){var _0x447452={};_0x447452[_0x26c95c]={'$like':'%'+_0x13253c[_0x8a49('0x46')][_0x8a49('0x41')]+'%'};return _0x447452;})});}_0x49ca82=_[_0x8a49('0xd8')]({},_0x49ca82,_0x13253c['options']);return _0x582588[_0x8a49('0xea')](_0x49ca82);}})[_0x8a49('0x16')](function(_0x3e165a){if(_0x3e165a){_0x1f8e37=_0x3e165a[_0x8a49('0x50')];if(!_0x13253c[_0x8a49('0x46')][_0x8a49('0xd0')]('nolimit')){_0x49ca82[_0x8a49('0x25')]=qs[_0x8a49('0x25')](_0x13253c[_0x8a49('0x46')][_0x8a49('0x25')]);_0x49ca82[_0x8a49('0x24')]=qs[_0x8a49('0x24')](_0x13253c[_0x8a49('0x46')]['offset']);}return _0x582588[_0x8a49('0xea')](_0x49ca82);}})['then'](function(_0x3dfbb4){if(_0x3dfbb4){return _0x3dfbb4?{'count':_0x1f8e37,'rows':_0x3dfbb4}:null;}})['then'](respondWithResult(_0x26d2b8,null))[_0x8a49('0x1f')](handleError(_0x26d2b8,null));};exports['getWhatsappInteractions']=function(_0x5b3783,_0x55e018){var _0x3ef3ce={};var _0x4486f4={};var _0x5ed3e9;var _0x447506;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x5b3783[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x55e018,null))[_0x8a49('0x16')](function(_0x5258ac){if(_0x5258ac){_0x5ed3e9=_0x5258ac;_0x4486f4[_0x8a49('0x5c')]=_['keys'](db[_0x8a49('0xeb')]['rawAttributes']);_0x4486f4[_0x8a49('0x46')]=_[_0x8a49('0x59')](_0x5b3783[_0x8a49('0x46')]);_0x4486f4[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x4486f4[_0x8a49('0x5c')],_0x4486f4[_0x8a49('0x46')]);_0x3ef3ce[_0x8a49('0x5d')]=_['intersection'](_0x4486f4['model'],qs[_0x8a49('0x5e')](_0x5b3783['query'][_0x8a49('0x5e')]));_0x3ef3ce['attributes']=_0x3ef3ce['attributes'][_0x8a49('0x50')]?_0x3ef3ce[_0x8a49('0x5d')]:_0x4486f4[_0x8a49('0x5c')];_0x3ef3ce['order']=qs[_0x8a49('0xd6')](_0x5b3783[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x3ef3ce[_0x8a49('0x45')]=qs['filters'](_['pick'](_0x5b3783[_0x8a49('0x46')],_0x4486f4[_0x8a49('0x5a')]));if(_0x5b3783[_0x8a49('0x46')]['filter']){_0x3ef3ce['where']=_['merge'](_0x3ef3ce['where'],{'$or':_[_0x8a49('0x35')](_0x3ef3ce[_0x8a49('0x5d')],function(_0x172073){var _0x3fc941={};_0x3fc941[_0x172073]={'$like':'%'+_0x5b3783['query'][_0x8a49('0x41')]+'%'};return _0x3fc941;})});}_0x3ef3ce=_[_0x8a49('0xd8')]({},_0x3ef3ce,_0x5b3783['options']);return _0x5ed3e9[_0x8a49('0xec')](_0x3ef3ce);}})[_0x8a49('0x16')](function(_0x159f78){if(_0x159f78){_0x447506=_0x159f78[_0x8a49('0x50')];if(!_0x5b3783[_0x8a49('0x46')][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0x3ef3ce[_0x8a49('0x25')]=qs[_0x8a49('0x25')](_0x5b3783[_0x8a49('0x46')]['limit']);_0x3ef3ce['offset']=qs[_0x8a49('0x24')](_0x5b3783[_0x8a49('0x46')]['offset']);}return _0x5ed3e9[_0x8a49('0xec')](_0x3ef3ce);}})[_0x8a49('0x16')](function(_0x45d34e){if(_0x45d34e){return _0x45d34e?{'count':_0x447506,'rows':_0x45d34e}:null;}})['then'](respondWithResult(_0x55e018,null))[_0x8a49('0x1f')](handleError(_0x55e018,null));};exports['login']=function(_0x12e6b6,_0x582a7e,_0x3fac26){var _0x1be9d1;var _0x6a2a46;var _0x1c03d5;var _0x2a58d0=!_['isNil'](_0x12e6b6[_0x8a49('0x62')]['id'])?_0x12e6b6[_0x8a49('0x62')]['id']:!_[_0x8a49('0x6b')](_0x12e6b6['user']['id'])?_0x12e6b6[_0x8a49('0x31')]['id']:null;return db['User'][_0x8a49('0x38')]({'where':{'id':_0x2a58d0,'role':{'$or':['admin','user',_0x8a49('0x2b')]}},'attributes':['id',_0x8a49('0x39'),_0x8a49('0xed'),_0x8a49('0xee'),'role',_0x8a49('0x6a'),'loginInPause']})['then'](function(_0x418638){if(_0x418638){if(_0x418638[_0x8a49('0x2a')]===_0x8a49('0x2b')){_0x1be9d1=_0x418638;if(_0x12e6b6[_0x8a49('0x61')][_0x8a49('0xa6')]){_0x1c03d5=util[_0x8a49('0xb1')](_0x8a49('0xef'),_0x1be9d1[_0x12e6b6[_0x8a49('0x61')]['interface']]);}else if(_0x12e6b6[_0x8a49('0x61')][_0x8a49('0xf0')]){_0x1c03d5=util[_0x8a49('0xb1')]('SIP/%s',_0x12e6b6[_0x8a49('0x61')][_0x8a49('0xf0')]);}else{_0x1c03d5=util[_0x8a49('0xb1')](_0x8a49('0xb2'),_0x1be9d1['name']);}socket['to'](util[_0x8a49('0xb1')](_0x8a49('0xf1'),_0x1be9d1[_0x8a49('0x39')]))[_0x8a49('0x2c')]('user:forcelogout',{'user':{'id':_0x1be9d1['id'],'name':_0x1be9d1[_0x8a49('0x39')]},'ip':_0x12e6b6[_0x8a49('0xf2')][_0x8a49('0xf3')]||_0x12e6b6[_0x8a49('0xf4')][_0x8a49('0xf5')]||_0x12e6b6['socket'][_0x8a49('0xf5')]||_0x12e6b6[_0x8a49('0xf4')][_0x8a49('0xf6')][_0x8a49('0xf5')]});return db[_0x8a49('0xb8')][_0x8a49('0x2e')]({'where':{'membername':_0x1be9d1[_0x8a49('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x8a49('0x94'))][(_0x8a49('0x95'))](_0x8a49('0xf7'));}})[_0x8a49('0x16')](function(){if(_0x1be9d1){return _0x1be9d1[_0x8a49('0xf8')]({'raw':!![]});}})['then'](function(_0x516e3b){if(_0x1be9d1){if(_0x516e3b){_0x6a2a46=_0x516e3b;if(_0x6a2a46['length']){var _0x1757c=_0x6a2a46['map'](function(_0xe72239){var _0x209abc={'membername':_0x1be9d1[_0x8a49('0x39')],'UserId':_0x1be9d1['id'],'queue_name':_0xe72239['name'],'VoiceQueueId':_0xe72239['id'],'interface':_0x1c03d5,'paused':_0x1be9d1['loginInPause']||![],'penalty':_0xe72239['UserVoiceQueue.penalty']||0x0};return db[_0x8a49('0xb8')][_0x8a49('0xb3')](_0x209abc);});return Promise[_0x8a49('0x60')](_0x1757c);}}}})[_0x8a49('0x16')](function(){if(_0x1be9d1){return db[_0x8a49('0xf9')][_0x8a49('0x4c')]({'where':{'membername':_0x1be9d1['name'],'exitAt':null}});}})['then'](function(_0x1ea5d9){if(_0x1be9d1){var _0x28977c=[];_0x1ea5d9[_0x8a49('0xfa')](function(_0xb0bf72){_0x28977c[_0x8a49('0x4b')](_0xb0bf72['update']({'exitAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb'))}));});return Promise[_0x8a49('0x60')](_0x28977c);}})['then'](function(){if(_0x1be9d1){var _0x30d6f9=[];var _0x45d467=[];var _0x4617af=utils[_0x8a49('0xfc')]();var _0x5e3a33={'membername':_0x1be9d1[_0x8a49('0x39')],'interface':_0x1c03d5,'enterAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb')),'role':_0x1be9d1['role'],'internal':_0x1be9d1['internal']};_0x4617af[_0x8a49('0xfa')](function(_0x445f43){_0x30d6f9['push'](_[_0x8a49('0xd8')]({'channel':_0x445f43,'type':'LOGIN','data1':_0x12e6b6[_0x8a49('0x61')][_0x8a49('0xfd')],'data2':_0x1c03d5},_0x5e3a33));if(_0x1be9d1[_0x8a49('0xa4')]){_0x45d467[_0x8a49('0x4b')](_[_0x8a49('0xd8')]({'channel':_0x445f43,'type':_0x8a49('0xfe'),'data1':_0x8a49('0xff')},_0x5e3a33));}});return db[_0x8a49('0xf9')][_0x8a49('0x100')](_0x30d6f9[_0x8a49('0xcd')](_0x45d467),{'individualHooks':!![]});}})[_0x8a49('0x16')](function(){if(_0x1be9d1){return _0x1be9d1['update']({'online':!![],'lastLoginAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb')),'voicePause':_0x1be9d1[_0x8a49('0xa4')]||![],'mailPause':_0x1be9d1['loginInPause']||![],'chatPause':_0x1be9d1[_0x8a49('0xa4')]||![],'faxPause':_0x1be9d1[_0x8a49('0xa4')]||![],'smsPause':_0x1be9d1['loginInPause']||![],'openchannelPause':_0x1be9d1['loginInPause']||![],'whatsappPause':_0x1be9d1['loginInPause']||![],'pauseType':_0x1be9d1[_0x8a49('0xa4')]?_0x8a49('0xff'):null,'interface':_0x1c03d5,'lastPauseAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb'))});}})[_0x8a49('0x16')](function(_0x2c4bd2){if(_0x12e6b6[_0x8a49('0x101')]){return _0x3fac26();}else{return Promise['resolve'](_0x2c4bd2)[_0x8a49('0x16')](respondWithResult(_0x582a7e,null));}})['catch'](handleError(_0x582a7e,null));};exports[_0x8a49('0x102')]=function(_0x2ae886,_0x44872b){var _0x407131;return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x2ae886[_0x8a49('0x62')]['id'],'role':_0x8a49('0x2b')},'attributes':['id',_0x8a49('0x39'),_0x8a49('0x2a')]})['then'](handleEntityNotFound(_0x44872b,null))[_0x8a49('0x16')](function(_0x4dcd90){if(_0x4dcd90){_0x407131=_0x4dcd90;return db[_0x8a49('0xb8')][_0x8a49('0x2e')]({'where':{'membername':_0x407131['name']},'individualHooks':!![]});}})[_0x8a49('0x16')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x407131[_0x8a49('0x39')],'exitAt':null}});})[_0x8a49('0x16')](function(_0x477ddb){var _0x53bad5=[];_0x477ddb[_0x8a49('0xfa')](function(_0x5c6723){_0x53bad5[_0x8a49('0x4b')](_0x5c6723[_0x8a49('0x29')]({'exitAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb'))}));});return Promise['all'](_0x53bad5);})[_0x8a49('0x16')](function(){return _0x407131[_0x8a49('0x29')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x8a49('0x16')](respondWithResult(_0x44872b,null))[_0x8a49('0x1f')](handleError(_0x44872b,null));};exports[_0x8a49('0x103')]=function(_0x258f76,_0x524ef3){var _0x2416c7;return db[_0x8a49('0xb8')][_0x8a49('0x29')]({'paused':0x1},{'where':{'UserId':_0x258f76['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0x8a49('0x3d')][_0x8a49('0x38')]({'where':{'id':_0x258f76[_0x8a49('0x62')]['id'],'role':_0x8a49('0x2b')},'attributes':['id',_0x8a49('0x39'),'role',_0x8a49('0x6a'),_0x8a49('0xa6'),'online']});})['then'](handleEntityNotFound(_0x524ef3,null))[_0x8a49('0x16')](function(_0xf731f7){if(_0xf731f7){_0x2416c7=_0xf731f7;return respondWithRpcPromise('QueuePause',_0x8a49('0x103'),{'id':_0x2416c7['id'],'name':_0x2416c7['name'],'pause':!![]});}})['then'](function(){if(_0x2416c7){return db[_0x8a49('0xf9')]['findAll']({'where':{'membername':_0x2416c7[_0x8a49('0x39')],'type':_0x8a49('0xfe'),'exitAt':null}});}})[_0x8a49('0x16')](function(_0x45845d){if(_0x45845d[_0x8a49('0x50')]){var _0xca4af7=moment()[_0x8a49('0xb1')](_0x8a49('0xfb'));for(var _0x3ea3b1=0x0,_0x192fcc=_0x45845d[_0x8a49('0x50')];_0x3ea3b1<_0x192fcc;_0x3ea3b1++){_0x45845d[_0x3ea3b1][_0x8a49('0x104')]({'exitAt':_0xca4af7});}}})[_0x8a49('0x16')](function(){var _0x20b352=[];var _0x3c4c6b=utils[_0x8a49('0xfc')]();_0x3c4c6b[_0x8a49('0xfa')](function(_0x481614){_0x20b352[_0x8a49('0x4b')]({'channel':_0x481614,'membername':_0x2416c7[_0x8a49('0x39')],'interface':_[_0x8a49('0x6b')](_0x2416c7[_0x8a49('0xa6')])?util[_0x8a49('0xb1')](_0x8a49('0xb2'),_0x2416c7[_0x8a49('0x39')]):_0x2416c7['interface'],'type':'PAUSE','enterAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb')),'data1':_0x258f76[_0x8a49('0x61')][_0x8a49('0x105')]||'DEFAULT\x20PAUSE','role':_0x2416c7[_0x8a49('0x2a')],'internal':_0x2416c7[_0x8a49('0x6a')]});});return db[_0x8a49('0xf9')][_0x8a49('0x100')](_0x20b352,{'individualHooks':!![]});})[_0x8a49('0x16')](function(){return _0x2416c7[_0x8a49('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x258f76[_0x8a49('0x61')][_0x8a49('0x105')]||_0x8a49('0x106'),'lastPauseAt':moment()[_0x8a49('0xb1')](_0x8a49('0xfb'))});})['then'](respondWithResult(_0x524ef3,null))[_0x8a49('0x1f')](handleError(_0x524ef3,null));};exports[_0x8a49('0x107')]=function(_0x57e877,_0x32918d){if(_0x57e877[_0x8a49('0x61')][_0x8a49('0xa2')]&&!utils[_0x8a49('0xa7')](_0x57e877[_0x8a49('0x61')]['channel'])){throw new APIBadRequestError(util[_0x8a49('0xb1')](_0x8a49('0x108'),_0x57e877['body'][_0x8a49('0xa2')]));}return db[_0x8a49('0x3d')]['find']({'where':{'id':_0x57e877[_0x8a49('0x62')]['id']},'attributes':['id',_0x8a49('0x39'),'role',_0x8a49('0x6a'),_0x8a49('0xa6'),_0x8a49('0xa3'),_0x8a49('0xa5'),_0x8a49('0x109'),_0x8a49('0x10a'),_0x8a49('0x10b'),_0x8a49('0x10c'),_0x8a49('0x10d'),'whatsappPause',_0x8a49('0x10e'),_0x8a49('0x10f')]})[_0x8a49('0x16')](function(_0x2b6239){if(!_0x2b6239){throw new APINotFoundError(util[_0x8a49('0xb1')](_0x8a49('0xcf'),_0x57e877[_0x8a49('0x62')]['id']));}return _0x2b6239[_0x8a49('0x107')](_0x57e877[_0x8a49('0x61')][_0x8a49('0xa2')]);})[_0x8a49('0x16')](respondWithResult(_0x32918d,null))['catch'](APIHandleError(_0x32918d));};exports[_0x8a49('0x110')]=function(_0x27a296,_0x5213e7){var _0x55e6ba={};var _0x15fc5b={};var _0x5c3b98;var _0x416d97;return db['User']['findOne']({'where':{'id':_0x27a296[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x5213e7,null))['then'](function(_0x55289e){if(_0x55289e){_0x5c3b98=_0x55289e;_0x15fc5b[_0x8a49('0x5c')]=_[_0x8a49('0x59')](db[_0x8a49('0x111')]['rawAttributes']);_0x15fc5b['query']=_[_0x8a49('0x59')](_0x27a296[_0x8a49('0x46')]);_0x15fc5b[_0x8a49('0x5a')]=_['intersection'](_0x15fc5b[_0x8a49('0x5c')],_0x15fc5b[_0x8a49('0x46')]);_0x55e6ba[_0x8a49('0x5d')]=_[_0x8a49('0x5b')](_0x15fc5b[_0x8a49('0x5c')],qs['fields'](_0x27a296[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x55e6ba[_0x8a49('0x5d')]=_0x55e6ba[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x55e6ba[_0x8a49('0x5d')]:_0x15fc5b['model'];_0x55e6ba[_0x8a49('0xdc')]=qs['sort'](_0x27a296[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x55e6ba[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x27a296[_0x8a49('0x46')],_0x15fc5b[_0x8a49('0x5a')]));if(_0x27a296[_0x8a49('0x46')]['filter']){_0x55e6ba['where']=_[_0x8a49('0xd8')](_0x55e6ba['where'],{'$or':_['map'](_0x55e6ba[_0x8a49('0x5d')],function(_0x274174){var _0xf4449d={};_0xf4449d[_0x274174]={'$like':'%'+_0x27a296[_0x8a49('0x46')]['filter']+'%'};return _0xf4449d;})});}_0x55e6ba=_[_0x8a49('0xd8')]({},_0x55e6ba,_0x27a296['options']);return _0x5c3b98[_0x8a49('0x110')](_0x55e6ba);}})['then'](function(_0x4d2cc0){if(_0x4d2cc0){_0x416d97=_0x4d2cc0[_0x8a49('0x50')];if(!_0x27a296['query'][_0x8a49('0xd0')]('nolimit')){_0x55e6ba['limit']=qs[_0x8a49('0x25')](_0x27a296[_0x8a49('0x46')][_0x8a49('0x25')]);_0x55e6ba['offset']=qs[_0x8a49('0x24')](_0x27a296[_0x8a49('0x46')][_0x8a49('0x24')]);}return _0x5c3b98['getTeams'](_0x55e6ba);}})['then'](function(_0x33fc43){if(_0x33fc43){return _0x33fc43?{'count':_0x416d97,'rows':_0x33fc43}:null;}})[_0x8a49('0x16')](respondWithResult(_0x5213e7,null))[_0x8a49('0x1f')](handleError(_0x5213e7,null));};exports[_0x8a49('0x112')]=function(_0x561440,_0x4ff0f5){var _0x2b6ee6=_0x561440[_0x8a49('0x62')]['id'];var _0x139f6c=_0x561440[_0x8a49('0x61')]?_0x561440[_0x8a49('0x61')][_0x8a49('0x65')]:null;var _0xb7dec9=[];return Promise[_0x8a49('0x113')]()[_0x8a49('0x16')](function(){if(!_0x139f6c)throw new APIBadRequestError(_0x8a49('0x114'));})[_0x8a49('0x16')](function(){return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x2b6ee6}});})[_0x8a49('0x16')](function(_0x460623){if(!_0x460623)throw new APINotFoundError(util[_0x8a49('0xb1')](_0x8a49('0xcf'),_0x561440['params']['id']));return db[_0x8a49('0x6d')][_0x8a49('0x115')](function(_0x3691d3){return _0x460623['addTeams'](_0x139f6c,{'transaction':_0x3691d3})[_0x8a49('0x16')](function(){return db['Team'][_0x8a49('0x4c')]({'where':{'id':{'$in':_0x139f6c}}});})[_0x8a49('0x16')](function(_0x3d7243){var _0x1b65ad=_['map'](_0x3d7243,function(_0x584551){return _0x584551[_0x8a49('0x116')]();});return Promise[_0x8a49('0x60')](_0x1b65ad);})[_0x8a49('0x16')](function(_0x147634){_0xb7dec9=_[_0x8a49('0x117')](_0x147634);var _0x6b41cc=_['map'](_0xb7dec9,function(_0x57e2a8){return _0x57e2a8[_0x8a49('0x118')](_0x460623['id'],{'transaction':_0x3691d3});});return Promise['all'](_0x6b41cc);})[_0x8a49('0x16')](function(){if(!_0x460623[_0x8a49('0xa3')])return;var _0x34796b=_['filter'](_0xb7dec9,function(_0x3ab38c){return _0x3ab38c['getDataValue']('channel')===_0x8a49('0x119');});var _0x4a3831=_[_0x8a49('0x35')](_0x34796b,function(_0x9b4950){return db[_0x8a49('0xb8')]['upsert']({'membername':_0x460623['name'],'UserId':_0x460623['id'],'queue_name':_0x9b4950[_0x8a49('0x39')],'VoiceQueueId':_0x9b4950['id'],'interface':_[_0x8a49('0x6b')](_0x460623['interface'])?util[_0x8a49('0xb1')](_0x8a49('0xb2'),_0x460623[_0x8a49('0x39')]):_0x460623['interface'],'paused':_0x460623[_0x8a49('0xa5')]||![],'penalty':_0x460623[_0x8a49('0xab')]},{'transaction':_0x3691d3});});return Promise[_0x8a49('0x60')](_0x4a3831);})[_0x8a49('0x16')](function(){return db[_0x8a49('0x11a')][_0x8a49('0x4c')]({'where':{'teamId':{'$in':_0x139f6c}}});})['then'](function(_0x47b43e){var _0x52f335=_['map'](_0x47b43e,function(_0x353ae3){return db[_0x8a49('0x11b')][_0x8a49('0x82')]({'UserId':_0x460623['id'],'VoicePrefixId':_0x353ae3[_0x8a49('0x11c')]},{'transaction':_0x3691d3});});return Promise[_0x8a49('0x60')](_0x52f335);});});})[_0x8a49('0x16')](function(){for(var _0x13b1a8=0x0;_0x13b1a8<_0xb7dec9[_0x8a49('0x50')];_0x13b1a8++){var _0x5d2675=_0xb7dec9[_0x13b1a8][_0x8a49('0x11d')]('channel');var _0x1aa98c=_0x5d2675+_0x8a49('0xad');socket[_0x8a49('0x2c')](_0x8a49('0x31')+_0x5d2675+_0x8a49('0xaf'),{'UserId':_0x2b6ee6,['queueField']:_0xb7dec9[_0x13b1a8]['id']});}})['then'](respondWithStatusCode(_0x4ff0f5,null))[_0x8a49('0x1f')](APIHandleError(_0x4ff0f5));};exports[_0x8a49('0x11e')]=function(_0x42a258,_0x4ebd87){var _0x51ebc0=_0x42a258[_0x8a49('0x62')]['id'];var _0x26abe9=null;if(_0x42a258[_0x8a49('0x46')][_0x8a49('0x65')]){_0x26abe9=_[_0x8a49('0x11f')](_0x42a258[_0x8a49('0x46')][_0x8a49('0x65')])?_0x42a258[_0x8a49('0x46')][_0x8a49('0x65')]:[_0x42a258[_0x8a49('0x46')][_0x8a49('0x65')]];}var _0x7628d4=[];return Promise[_0x8a49('0x113')]()['then'](function(){if(!_0x26abe9)throw new APIBadRequestError(_0x8a49('0x120'));})[_0x8a49('0x16')](function(){return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x51ebc0}});})[_0x8a49('0x16')](function(_0x45aa34){if(!_0x45aa34)throw new APINotFoundError(util[_0x8a49('0xb1')](_0x8a49('0xcf'),_0x42a258[_0x8a49('0x62')]['id']));return db[_0x8a49('0x6d')][_0x8a49('0x115')](function(_0x26b9bc){return _0x45aa34[_0x8a49('0x11e')](_0x26abe9,{'transaction':_0x26b9bc})[_0x8a49('0x16')](function(){return db['Team'][_0x8a49('0x4c')]({'where':{'id':{'$in':_0x26abe9}}});})[_0x8a49('0x16')](function(_0x1661bf){var _0x3d02ae=_['map'](_0x1661bf,function(_0x595d0b){return _0x595d0b[_0x8a49('0x116')]();});return Promise['all'](_0x3d02ae);})[_0x8a49('0x16')](function(_0x46d0f6){_0x7628d4=_[_0x8a49('0x117')](_0x46d0f6);var _0x712c93=_[_0x8a49('0x35')](_0x7628d4,function(_0x1b4881){return _0x1b4881[_0x8a49('0x121')](_0x45aa34['id'],{'transaction':_0x26b9bc});});return Promise[_0x8a49('0x60')](_0x712c93);})['then'](function(){if(!_0x45aa34[_0x8a49('0xa3')])return;var _0x27504c=_[_0x8a49('0x41')](_0x7628d4,function(_0x23e6e4){return _0x23e6e4[_0x8a49('0x11d')](_0x8a49('0xa2'))===_0x8a49('0x119');});var _0x50af83=_[_0x8a49('0x35')](_0x27504c,function(_0x48c105){return db[_0x8a49('0xb8')][_0x8a49('0x2e')]({'where':{'VoiceQueueId':_0x48c105['id'],'UserId':_0x45aa34['id']},'transaction':_0x26b9bc});});return Promise[_0x8a49('0x60')](_0x50af83);})[_0x8a49('0x16')](function(){return db[_0x8a49('0x11a')]['findAll']({'where':{'teamId':{'$in':_0x26abe9}}});})[_0x8a49('0x16')](function(_0x362496){var _0x506638=_[_0x8a49('0x35')](_0x362496,function(_0x2532f0){return db[_0x8a49('0x11b')][_0x8a49('0x2e')]({'where':{'UserId':_0x45aa34['id'],'VoicePrefixId':_0x2532f0[_0x8a49('0x11c')]}},{'transaction':_0x26b9bc});});return Promise[_0x8a49('0x60')](_0x506638);});});})['then'](function(){for(var _0x1fc2ba=0x0;_0x1fc2ba<_0x7628d4['length'];_0x1fc2ba++){var _0x145a06=_0x7628d4[_0x1fc2ba][_0x8a49('0x11d')](_0x8a49('0xa2'));var _0xd64bbc=_0x145a06+'QueueId';socket['emit'](_0x8a49('0x31')+_0x145a06+_0x8a49('0xb7'),{'UserId':_0x51ebc0,['queueField']:_0x7628d4[_0x1fc2ba]['id']});}})[_0x8a49('0x16')](respondWithStatusCode(_0x4ebd87,null))[_0x8a49('0x1f')](APIHandleError(_0x4ebd87));};exports[_0x8a49('0x122')]=function(_0x1c9af2,_0x44fba5){var _0x584c5f={};var _0x4498a1={};var _0x1eda30;var _0x5c61df;return db[_0x8a49('0x3d')]['findOne']({'where':{'id':_0x1c9af2['params']['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x44fba5,null))['then'](function(_0x52dd59){if(_0x52dd59){_0x1eda30=_0x52dd59;_0x4498a1[_0x8a49('0x5c')]=_[_0x8a49('0x59')](db[_0x8a49('0x123')][_0x8a49('0x3e')]);_0x4498a1['query']=_[_0x8a49('0x59')](_0x1c9af2[_0x8a49('0x46')]);_0x4498a1[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x4498a1[_0x8a49('0x5c')],_0x4498a1[_0x8a49('0x46')]);_0x584c5f[_0x8a49('0x5d')]=_['intersection'](_0x4498a1['model'],qs[_0x8a49('0x5e')](_0x1c9af2[_0x8a49('0x46')][_0x8a49('0x5e')]));_0x584c5f['attributes']=_0x584c5f[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x584c5f[_0x8a49('0x5d')]:_0x4498a1[_0x8a49('0x5c')];_0x584c5f['order']=qs[_0x8a49('0xd6')](_0x1c9af2[_0x8a49('0x46')][_0x8a49('0xd6')]);_0x584c5f[_0x8a49('0x45')]=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x1c9af2[_0x8a49('0x46')],_0x4498a1[_0x8a49('0x5a')]));if(_0x1c9af2[_0x8a49('0x46')][_0x8a49('0x41')]){_0x584c5f[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x584c5f[_0x8a49('0x45')],{'$or':_['map'](_0x584c5f[_0x8a49('0x5d')],function(_0x5c314f){var _0x5e13ed={};_0x5e13ed[_0x5c314f]={'$like':'%'+_0x1c9af2['query'][_0x8a49('0x41')]+'%'};return _0x5e13ed;})});}_0x584c5f=_['merge']({},_0x584c5f,_0x1c9af2[_0x8a49('0xd9')]);return _0x1eda30['getLists'](_0x584c5f);}})[_0x8a49('0x16')](function(_0x4891f2){if(_0x4891f2){_0x5c61df=_0x4891f2[_0x8a49('0x50')];if(!_0x1c9af2['query'][_0x8a49('0xd0')](_0x8a49('0xdb'))){_0x584c5f[_0x8a49('0x25')]=qs['limit'](_0x1c9af2[_0x8a49('0x46')][_0x8a49('0x25')]);_0x584c5f[_0x8a49('0x24')]=qs[_0x8a49('0x24')](_0x1c9af2['query'][_0x8a49('0x24')]);}return _0x1eda30[_0x8a49('0x122')](_0x584c5f);}})[_0x8a49('0x16')](function(_0x3d777b){if(_0x3d777b){return _0x3d777b?{'count':_0x5c61df,'rows':_0x3d777b}:null;}})[_0x8a49('0x16')](respondWithResult(_0x44fba5,null))[_0x8a49('0x1f')](handleError(_0x44fba5,null));};exports[_0x8a49('0x124')]=function(_0x58a2c2,_0x5ed1b3){var _0x543a2f={};var _0x5962b0={};var _0x1594e0;return db[_0x8a49('0x3d')][_0x8a49('0x9b')]({'where':{'id':_0x58a2c2[_0x8a49('0x62')]['id']}})[_0x8a49('0x16')](handleEntityNotFound(_0x5ed1b3,null))[_0x8a49('0x16')](function(_0x3c9870){if(_0x3c9870){_0x1594e0=_0x3c9870;_0x5962b0[_0x8a49('0x5c')]=_['keys'](db[_0x8a49('0x3d')]['rawAttributes']);_0x5962b0['query']=_['keys'](_0x58a2c2[_0x8a49('0x46')]);_0x5962b0[_0x8a49('0x5a')]=_[_0x8a49('0x5b')](_0x5962b0[_0x8a49('0x5c')],_0x5962b0['query']);_0x543a2f['attributes']=_[_0x8a49('0x5b')](_0x5962b0['model'],qs[_0x8a49('0x5e')](_0x58a2c2['query']['fields']));_0x543a2f[_0x8a49('0x5d')]=_0x543a2f[_0x8a49('0x5d')][_0x8a49('0x50')]?_0x543a2f[_0x8a49('0x5d')]:_0x5962b0[_0x8a49('0x5c')];_0x543a2f['order']=qs[_0x8a49('0xd6')](_0x58a2c2['query'][_0x8a49('0xd6')]);_0x543a2f['where']=qs[_0x8a49('0x5a')](_[_0x8a49('0xd7')](_0x58a2c2[_0x8a49('0x46')],_0x5962b0['filters']));if(_0x58a2c2[_0x8a49('0x46')][_0x8a49('0x41')]){_0x543a2f[_0x8a49('0x45')]=_[_0x8a49('0xd8')](_0x543a2f[_0x8a49('0x45')],{'$or':_['map'](_0x543a2f[_0x8a49('0x5d')],function(_0x5259fb){var _0x588039={};_0x588039[_0x5259fb]={'$like':'%'+_0x58a2c2[_0x8a49('0x46')]['filter']+'%'};return _0x588039;})});}_0x543a2f[_0x8a49('0x5c')]=db[_0x8a49('0x3d')];_0x543a2f['as']=_0x8a49('0x8a');_0x543a2f=_[_0x8a49('0xd8')]({},_0x543a2f,_0x58a2c2['options']);return _0x1594e0[_0x8a49('0xf8')]({'include':[_0x543a2f]});}})[_0x8a49('0x16')](function(_0x16df58){if(_0x16df58){var _0x401d12={},_0x4c1d6f=[];for(var _0x574a2a=0x0;_0x574a2a<_0x16df58[_0x8a49('0x50')];_0x574a2a+=0x1){for(var _0x34e40e=0x0,_0x5d95dc;_0x34e40e<_0x16df58[_0x574a2a]['Agents'][_0x8a49('0x50')];_0x34e40e+=0x1){_0x5d95dc=_0x16df58[_0x574a2a][_0x8a49('0x8a')][_0x34e40e]['get']({'plain':!![]});_0x401d12[_0x5d95dc['id']]=_0x5d95dc;}}_0x401d12=_[_0x8a49('0x125')](_0x401d12);for(var _0x4ba077=qs[_0x8a49('0x24')](_0x58a2c2['query']['offset']);_0x4ba077<_0x401d12[_0x8a49('0x50')]&&_0x4c1d6f['length']=_0x286f0b[_0x2d35('0x4b')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x2d35('0x17')](function(){if(_0x2cea3d){return db[_0x2d35('0x27')][_0x2d35('0x42')]({'where':{'membername':_0x2cea3d['name']},'individualHooks':!![]});}})[_0x2d35('0x17')](function(){if(_0x2cea3d){return _0x2cea3d['getVoiceQueues']({'raw':!![]});}})[_0x2d35('0x17')](function(_0x5acbd2){if(_0x2cea3d){if(_0x5acbd2){var _0x5f4497=[];_0x16ba64=_0x5acbd2;if(_0x16ba64['length']){for(var _0x3469e6=0x0;_0x3469e6<_0x16ba64[_0x2d35('0x2a')];_0x3469e6++){_0x5f4497[_0x2d35('0x43')](db[_0x2d35('0x27')][_0x2d35('0x4c')]({'membername':_0x2cea3d[_0x2d35('0x20')],'UserId':_0x2cea3d['id'],'queue_name':_0x16ba64[_0x3469e6]['name'],'VoiceQueueId':_0x16ba64[_0x3469e6]['id'],'interface':_0x3f6f4c,'paused':_0x2cea3d[_0x2d35('0x46')]||![],'penalty':_0x16ba64[_0x3469e6][_0x2d35('0x4d')]||0x0}));}return BPromise[_0x2d35('0x4e')](_0x5f4497);}}}})[_0x2d35('0x17')](function(){if(_0x2cea3d){return db['MemberReport'][_0x2d35('0xe')]({'where':{'membername':_0x2cea3d[_0x2d35('0x20')],'exitAt':null}});}})[_0x2d35('0x17')](function(_0x143e95){if(_0x2cea3d){if(_0x143e95&&_0x143e95[_0x2d35('0x2a')]){var _0x35c15c=[];_0x143e95[_0x2d35('0x2e')](function(_0x2d1acd){_0x35c15c[_0x2d35('0x43')](_0x2d1acd[_0x2d35('0x28')]({'exitAt':moment()['format'](_0x2d35('0x2b'))}));});return BPromise['all'](_0x35c15c);}}})['then'](function(){if(_0x2cea3d){var _0x2808ef=[];var _0x5879a8=[];var _0x251bb9=utils[_0x2d35('0x2d')]();var _0x492684={'membername':_0x2cea3d[_0x2d35('0x20')],'interface':_0x3f6f4c,'enterAt':moment()[_0x2d35('0x24')](_0x2d35('0x2b')),'role':_0x2cea3d[_0x2d35('0x21')],'internal':_0x2cea3d[_0x2d35('0x22')]};_0x251bb9[_0x2d35('0x2e')](function(_0x27a48f){_0x2808ef[_0x2d35('0x43')](_['merge']({'channel':_0x27a48f,'type':'LOGIN','data1':_0x2d35('0x4f'),'data2':_0x3f6f4c},_0x492684));if(_0x2cea3d['loginInPause']){_0x5879a8['push'](_[_0x2d35('0x50')]({'channel':_0x27a48f,'type':_0x2d35('0x30'),'data1':_0x2d35('0x51')},_0x492684));}});return db[_0x2d35('0x29')]['bulkCreate'](_0x2808ef['concat'](_0x5879a8),{'individualHooks':!![]});}})[_0x2d35('0x17')](function(){if(_0x2cea3d){return _0x2cea3d[_0x2d35('0x28')]({'online':!![],'lastLoginAt':moment()[_0x2d35('0x24')](_0x2d35('0x2b')),'voicePause':_0x2cea3d[_0x2d35('0x46')]||![],'mailPause':_0x2cea3d[_0x2d35('0x46')]||![],'chatPause':_0x2cea3d[_0x2d35('0x46')]||![],'faxPause':_0x2cea3d[_0x2d35('0x46')]||![],'smsPause':_0x2cea3d[_0x2d35('0x46')]||![],'openchannelPause':_0x2cea3d['loginInPause']||![],'pauseType':_0x2cea3d[_0x2d35('0x46')]?_0x2d35('0x51'):null,'lastPauseAt':moment()['format'](_0x2d35('0x2b')),'interface':_0x3f6f4c});}})['then'](function(_0x47b805){_0x186f4a(_0x47b805);})[_0x2d35('0x1a')](function(_0x41c403){_0x5161db(_0x20fa40[_0x2d35('0x1b')](0x1f4,_0x41c403['message']));});});}; \ No newline at end of file +var _0xb62e=['../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','./user.socket','findAll','options','raw','where','attributes','limit','include','map','model','GetUser','debug','stringify','catch','error','message','ShowUser','User','find','then','info','PauseUser','name','role','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','body','UnpauseUser','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','faxPause','smsPause','whatsappPause','pauseType','unpause','system','LogoutUser','destroy','LoginUser','mobile','phone','loginInPause','SIP/%s','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','all','merge','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis'];(function(_0x1e3cfd,_0x5ec1b6){var _0x30ae3a=function(_0x396ced){while(--_0x396ced){_0x1e3cfd['push'](_0x1e3cfd['shift']());}};_0x30ae3a(++_0x5ec1b6);}(_0xb62e,0x100));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 moment=require(_0xeb62('0x2'));var BPromise=require(_0xeb62('0x3'));var Redis=require(_0xeb62('0x4'));var db=require(_0xeb62('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb62('0x6'))(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));config['redis']=_['defaults'](config[_0xeb62('0x9')],{'host':_0xeb62('0xa'),'port':0x18eb});var socket=require(_0xeb62('0xb'))(new Redis(config[_0xeb62('0x9')]));require(_0xeb62('0xc'))['register'](socket);exports['GetUser']=function(_0x333b60){var _0x38f54d=this;return new Promise(function(_0x297fbd,_0x5a34f3){return db['User'][_0xeb62('0xd')]({'raw':_0x333b60[_0xeb62('0xe')]?_0x333b60[_0xeb62('0xe')][_0xeb62('0xf')]===undefined?!![]:![]:!![],'where':_0x333b60[_0xeb62('0xe')]?_0x333b60[_0xeb62('0xe')][_0xeb62('0x10')]||null:null,'attributes':_0x333b60[_0xeb62('0xe')]?_0x333b60['options'][_0xeb62('0x11')]||null:null,'limit':_0x333b60['options']?_0x333b60['options'][_0xeb62('0x12')]||null:null,'include':_0x333b60['options']?_0x333b60[_0xeb62('0xe')][_0xeb62('0x13')]?_[_0xeb62('0x14')](_0x333b60[_0xeb62('0xe')][_0xeb62('0x13')],function(_0x472fe7){return{'model':db[_0x472fe7[_0xeb62('0x15')]],'as':_0x472fe7['as'],'attributes':_0x472fe7[_0xeb62('0x11')],'include':_0x472fe7[_0xeb62('0x13')]?_[_0xeb62('0x14')](_0x472fe7[_0xeb62('0x13')],function(_0x5bc568){return{'model':db[_0x5bc568['model']],'as':_0x5bc568['as'],'attributes':_0x5bc568[_0xeb62('0x11')],'include':_0x5bc568['include']?_[_0xeb62('0x14')](_0x5bc568[_0xeb62('0x13')],function(_0x722b09){return{'model':db[_0x722b09[_0xeb62('0x15')]],'as':_0x722b09['as'],'attributes':_0x722b09[_0xeb62('0x11')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3579a6){logger['info'](_0xeb62('0x16'),_0x333b60);logger[_0xeb62('0x17')](_0xeb62('0x16'),_0x333b60,JSON[_0xeb62('0x18')](_0x3579a6));_0x297fbd(_0x3579a6);})[_0xeb62('0x19')](function(_0x108a24){logger[_0xeb62('0x1a')](_0xeb62('0x16'),_0x108a24[_0xeb62('0x1b')],_0x333b60);_0x5a34f3(_0x38f54d[_0xeb62('0x1a')](0x1f4,_0x108a24[_0xeb62('0x1b')]));});});};exports[_0xeb62('0x1c')]=function(_0x121869){var _0x3cc00a=this;return new Promise(function(_0x1031b6,_0x106318){return db[_0xeb62('0x1d')][_0xeb62('0x1e')]({'raw':_0x121869['options']?_0x121869[_0xeb62('0xe')][_0xeb62('0xf')]===undefined?!![]:![]:!![],'where':_0x121869[_0xeb62('0xe')]?_0x121869[_0xeb62('0xe')][_0xeb62('0x10')]||null:null,'attributes':_0x121869['options']?_0x121869[_0xeb62('0xe')][_0xeb62('0x11')]||null:null,'include':_0x121869[_0xeb62('0xe')]?_0x121869['options'][_0xeb62('0x13')]?_[_0xeb62('0x14')](_0x121869[_0xeb62('0xe')]['include'],function(_0x90323){return{'model':db[_0x90323['model']],'as':_0x90323['as'],'attributes':_0x90323[_0xeb62('0x11')],'include':_0x90323[_0xeb62('0x13')]?_[_0xeb62('0x14')](_0x90323[_0xeb62('0x13')],function(_0x25c295){return{'model':db[_0x25c295[_0xeb62('0x15')]],'as':_0x25c295['as'],'attributes':_0x25c295[_0xeb62('0x11')],'include':_0x25c295[_0xeb62('0x13')]?_[_0xeb62('0x14')](_0x25c295[_0xeb62('0x13')],function(_0x3ffd13){return{'model':db[_0x3ffd13[_0xeb62('0x15')]],'as':_0x3ffd13['as'],'attributes':_0x3ffd13[_0xeb62('0x11')]};}):[]};}):[]};}):[]:[]})[_0xeb62('0x1f')](function(_0x96be2d){logger[_0xeb62('0x20')](_0xeb62('0x1c'),_0x121869);logger[_0xeb62('0x17')](_0xeb62('0x1c'),_0x121869,JSON[_0xeb62('0x18')](_0x96be2d));_0x1031b6(_0x96be2d);})[_0xeb62('0x19')](function(_0x41f0e1){logger[_0xeb62('0x1a')](_0xeb62('0x1c'),_0x41f0e1[_0xeb62('0x1b')],_0x121869);_0x106318(_0x3cc00a[_0xeb62('0x1a')](0x1f4,_0x41f0e1[_0xeb62('0x1b')]));});});};exports[_0xeb62('0x21')]=function(_0x38e3fa){var _0x29ff7f;return db[_0xeb62('0x1d')][_0xeb62('0x1e')]({'where':_0x38e3fa[_0xeb62('0xe')][_0xeb62('0x10')]||{},'attributes':['id',_0xeb62('0x22'),_0xeb62('0x23'),_0xeb62('0x24'),_0xeb62('0x25')]})[_0xeb62('0x1f')](function(_0x598e02){if(!_0x598e02){throw new Error(util[_0xeb62('0x26')](_0xeb62('0x27'),_0x38e3fa[_0xeb62('0x28')]['id']));}_0x29ff7f=_0x598e02;return db[_0xeb62('0x29')][_0xeb62('0x2a')]({'paused':0x1},{'where':{'UserId':_0x29ff7f['id']},'individualHooks':!![]});})['then'](function(){return db[_0xeb62('0x2b')][_0xeb62('0xd')]({'where':{'membername':_0x29ff7f[_0xeb62('0x22')],'type':_0xeb62('0x2c'),'exitAt':null}});})[_0xeb62('0x1f')](function(_0x2717f7){if(_0x2717f7&&_0x2717f7[_0xeb62('0x2d')]){var _0x5ecff5=moment()[_0xeb62('0x26')](_0xeb62('0x2e'));for(var _0x46cef4=0x0,_0x5e6bdf=_0x2717f7[_0xeb62('0x2d')];_0x46cef4<_0x5e6bdf;_0x46cef4++){_0x2717f7[_0x46cef4][_0xeb62('0x2f')]({'exitAt':_0x5ecff5});}}})[_0xeb62('0x1f')](function(){var _0x4c0a03=[];var _0x3ed9f0=utils[_0xeb62('0x30')]();_0x3ed9f0[_0xeb62('0x31')](function(_0x196e29){_0x4c0a03[_0xeb62('0x32')]({'channel':_0x196e29,'membername':_0x29ff7f[_0xeb62('0x22')],'interface':_[_0xeb62('0x33')](_0x29ff7f['interface'])?util[_0xeb62('0x26')]('SIP/%s',_0x29ff7f[_0xeb62('0x22')]):_0x29ff7f[_0xeb62('0x25')],'type':_0xeb62('0x2c'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x38e3fa['body'][_0xeb62('0x34')]||_0xeb62('0x35'),'role':_0x29ff7f[_0xeb62('0x23')],'internal':_0x29ff7f[_0xeb62('0x24')],'uniqueid':_0x38e3fa['body'][_0xeb62('0x36')]||null});});return db[_0xeb62('0x2b')][_0xeb62('0x37')](_0x4c0a03,{'individualHooks':!![]});})['then'](function(){return _0x29ff7f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x38e3fa[_0xeb62('0x38')][_0xeb62('0x34')]||_0xeb62('0x35'),'lastPauseAt':moment()[_0xeb62('0x26')](_0xeb62('0x2e'))});})[_0xeb62('0x19')](function(_0x384469){throw _0x384469;});};exports[_0xeb62('0x39')]=function(_0x5b0584){return Promise['resolve']()[_0xeb62('0x1f')](function(){if(_0x5b0584[_0xeb62('0x38')]['channel']&&!utils['isValidChannel'](_0x5b0584[_0xeb62('0x38')][_0xeb62('0x3a')])){throw new Error(util[_0xeb62('0x26')](_0xeb62('0x3b'),_0x5b0584['body'][_0xeb62('0x3a')]));}return db['User'][_0xeb62('0x3c')]({'where':_0x5b0584['options'][_0xeb62('0x10')]||{},'attributes':['id',_0xeb62('0x22'),'role',_0xeb62('0x24'),'interface',_0xeb62('0x3d'),'voicePause','mailPause','chatPause',_0xeb62('0x3e'),'openchannelPause',_0xeb62('0x3f'),_0xeb62('0x40'),_0xeb62('0x41'),'lastPauseAt']});})[_0xeb62('0x1f')](function(_0x11f1c6){if(!_0x11f1c6){throw new Error(util[_0xeb62('0x26')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5b0584[_0xeb62('0x28')]['id']));}return _0x11f1c6[_0xeb62('0x42')](_0x5b0584[_0xeb62('0x38')][_0xeb62('0x3a')],_0xeb62('0x43'));})['catch'](function(_0x519897){throw _0x519897;});};exports[_0xeb62('0x44')]=function(_0xad1aa5){var _0x230165=this;return new Promise(function(_0x1676e3,_0x11c094){var _0x2aa0c8;return db[_0xeb62('0x1d')][_0xeb62('0x3c')]({'where':_0xad1aa5[_0xeb62('0xe')][_0xeb62('0x10')]||{},'attributes':['id',_0xeb62('0x22')]})[_0xeb62('0x1f')](function(_0x55abf4){if(_0x55abf4){_0x2aa0c8=_0x55abf4;return db['UserVoiceQueueRt'][_0xeb62('0x45')]({'where':{'membername':_0x2aa0c8[_0xeb62('0x22')]},'individualHooks':!![]});}})[_0xeb62('0x1f')](function(){if(_0x2aa0c8){return db[_0xeb62('0x2b')]['findAll']({'where':{'membername':_0x2aa0c8[_0xeb62('0x22')],'exitAt':null}});}})[_0xeb62('0x1f')](function(_0x32771a){if(_0x2aa0c8){if(_0x32771a&&_0x32771a['length']){var _0xe9211f=[];_0x32771a[_0xeb62('0x31')](function(_0x2b7e26){_0xe9211f[_0xeb62('0x32')](_0x2b7e26['update']({'exitAt':moment()[_0xeb62('0x26')](_0xeb62('0x2e'))}));});return BPromise['all'](_0xe9211f);}}})[_0xeb62('0x1f')](function(){if(_0x2aa0c8){return _0x2aa0c8['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xeb62('0x1f')](function(_0x5a7e0a){_0x1676e3(_0x5a7e0a);})[_0xeb62('0x19')](function(_0x471a75){_0x11c094(_0x230165[_0xeb62('0x1a')](0x1f4,_0x471a75[_0xeb62('0x1b')]));});});};exports[_0xeb62('0x46')]=function(_0x312a5d){var _0x3e9230=this;return new Promise(function(_0x5ebb4f,_0x7bc324){var _0x163b2f;var _0x39d71a;var _0x14aa2c;var _0x2ab978;return db[_0xeb62('0x1d')][_0xeb62('0x3c')]({'where':_0x312a5d['options'][_0xeb62('0x10')]||{},'attributes':['id',_0xeb62('0x22'),_0xeb62('0x23'),_0xeb62('0x47'),_0xeb62('0x48'),'internal',_0xeb62('0x49'),_0xeb62('0x25')]})['then'](function(_0x276d1e){if(_0x276d1e){_0x163b2f=_0x276d1e;_0x2ab978=_0x312a5d[_0xeb62('0x38')][_0xeb62('0x25')]?_0x312a5d[_0xeb62('0x38')][_0xeb62('0x25')]:util[_0xeb62('0x26')](_0xeb62('0x4a'),_0x163b2f[_0xeb62('0x22')]);return db[_0xeb62('0x1d')]['count']({'where':{'role':_0xeb62('0x4b'),'online':!![],'id':{'$ne':_0x163b2f['id']}}});}})[_0xeb62('0x1f')](function(_0x4a350a){if(_0x4a350a){_0x14aa2c=_0x4a350a;return require(_0xeb62('0x4c'))[_0xeb62('0x4d')]();}})[_0xeb62('0x1f')](function(_0xa86dec){if(_0xa86dec&&_0xa86dec[_0xeb62('0x4e')]&&_0x14aa2c>=_0xa86dec[_0xeb62('0x4e')]){throw new Error(_0xeb62('0x4f'));}})['then'](function(){if(_0x163b2f){return db[_0xeb62('0x29')][_0xeb62('0x45')]({'where':{'membername':_0x163b2f[_0xeb62('0x22')]},'individualHooks':!![]});}})[_0xeb62('0x1f')](function(){if(_0x163b2f){return _0x163b2f['getVoiceQueues']({'raw':!![]});}})[_0xeb62('0x1f')](function(_0x178b3a){if(_0x163b2f){if(_0x178b3a){var _0x4d4012=[];_0x39d71a=_0x178b3a;if(_0x39d71a[_0xeb62('0x2d')]){for(var _0x1f2010=0x0;_0x1f2010<_0x39d71a[_0xeb62('0x2d')];_0x1f2010++){_0x4d4012[_0xeb62('0x32')](db['UserVoiceQueueRt'][_0xeb62('0x50')]({'membername':_0x163b2f[_0xeb62('0x22')],'UserId':_0x163b2f['id'],'queue_name':_0x39d71a[_0x1f2010]['name'],'VoiceQueueId':_0x39d71a[_0x1f2010]['id'],'interface':_0x2ab978,'paused':_0x163b2f['loginInPause']||![],'penalty':_0x39d71a[_0x1f2010][_0xeb62('0x51')]||0x0}));}return BPromise['all'](_0x4d4012);}}}})['then'](function(){if(_0x163b2f){return db[_0xeb62('0x2b')][_0xeb62('0xd')]({'where':{'membername':_0x163b2f[_0xeb62('0x22')],'exitAt':null}});}})[_0xeb62('0x1f')](function(_0x46cdad){if(_0x163b2f){if(_0x46cdad&&_0x46cdad[_0xeb62('0x2d')]){var _0x495b33=[];_0x46cdad['forEach'](function(_0x9e2fa1){_0x495b33[_0xeb62('0x32')](_0x9e2fa1[_0xeb62('0x2a')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xeb62('0x52')](_0x495b33);}}})[_0xeb62('0x1f')](function(){if(_0x163b2f){var _0x4fe7e3=[];var _0x4fa816=[];var _0x4b124d=utils[_0xeb62('0x30')]();var _0x1a31b9={'membername':_0x163b2f[_0xeb62('0x22')],'interface':_0x2ab978,'enterAt':moment()[_0xeb62('0x26')](_0xeb62('0x2e')),'role':_0x163b2f[_0xeb62('0x23')],'internal':_0x163b2f[_0xeb62('0x24')]};_0x4b124d[_0xeb62('0x31')](function(_0x4403db){_0x4fe7e3['push'](_[_0xeb62('0x53')]({'channel':_0x4403db,'type':'LOGIN','data1':_0xeb62('0x54'),'data2':_0x2ab978},_0x1a31b9));if(_0x163b2f[_0xeb62('0x49')]){_0x4fa816[_0xeb62('0x32')](_[_0xeb62('0x53')]({'channel':_0x4403db,'type':_0xeb62('0x2c'),'data1':'LOGININPAUSE'},_0x1a31b9));}});return db[_0xeb62('0x2b')]['bulkCreate'](_0x4fe7e3[_0xeb62('0x55')](_0x4fa816),{'individualHooks':!![]});}})[_0xeb62('0x1f')](function(){if(_0x163b2f){return _0x163b2f[_0xeb62('0x2a')]({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x163b2f['loginInPause']||![],'mailPause':_0x163b2f[_0xeb62('0x49')]||![],'chatPause':_0x163b2f[_0xeb62('0x49')]||![],'faxPause':_0x163b2f[_0xeb62('0x49')]||![],'smsPause':_0x163b2f[_0xeb62('0x49')]||![],'openchannelPause':_0x163b2f[_0xeb62('0x49')]||![],'pauseType':_0x163b2f[_0xeb62('0x49')]?_0xeb62('0x56'):null,'lastPauseAt':moment()[_0xeb62('0x26')](_0xeb62('0x2e')),'interface':_0x2ab978});}})[_0xeb62('0x1f')](function(_0x5a2dfc){_0x5ebb4f(_0x5a2dfc);})[_0xeb62('0x19')](function(_0x4457d6){_0x7bc324(_0x3e9230[_0xeb62('0x1a')](0x1f4,_0x4457d6[_0xeb62('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index f808731..914b21c 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 _0xf283=['update','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x3390dd,_0x206beb){var _0x184b59=function(_0x837ad0){while(--_0x837ad0){_0x3390dd['push'](_0x3390dd['shift']());}};_0x184b59(++_0x206beb);}(_0xf283,0x1bd));var _0x3f28=function(_0x363a25,_0x501880){_0x363a25=_0x363a25-0x0;var _0x51933e=_0xf283[_0x363a25];return _0x51933e;};'use strict';var UserEvents=require(_0x3f28('0x0'));var events=[_0x3f28('0x1'),_0x3f28('0x2'),_0x3f28('0x3')];function createListener(_0x58a868,_0x33ee26){return function(_0xd600f5){_0x33ee26['emit'](_0x58a868,_0xd600f5);};}function removeListener(_0x28d171,_0x26a09e){return function(){UserEvents[_0x3f28('0x4')](_0x28d171,_0x26a09e);};}exports[_0x3f28('0x5')]=function(_0x23a25e){for(var _0x2a1a94=0x0,_0x451e3d=events[_0x3f28('0x6')];_0x2a1a94<_0x451e3d;_0x2a1a94++){var _0x39741f=events[_0x2a1a94];var _0x3fea4e=createListener(_0x3f28('0x7')+_0x39741f,_0x23a25e);UserEvents['on'](_0x39741f,_0x3fea4e);}}; \ No newline at end of file +var _0xa668=['user:','./user.events','update','emit','removeListener','register'];(function(_0x4095b8,_0x3d202d){var _0x13c564=function(_0x4da8ac){while(--_0x4da8ac){_0x4095b8['push'](_0x4095b8['shift']());}};_0x13c564(++_0x3d202d);}(_0xa668,0x12d));var _0x8a66=function(_0x102f10,_0x1f71bc){_0x102f10=_0x102f10-0x0;var _0x3cf03a=_0xa668[_0x102f10];return _0x3cf03a;};'use strict';var UserEvents=require(_0x8a66('0x0'));var events=['save','remove',_0x8a66('0x1')];function createListener(_0x3ea2fc,_0x221488){return function(_0x2ee2fc){_0x221488[_0x8a66('0x2')](_0x3ea2fc,_0x2ee2fc);};}function removeListener(_0x463765,_0x13b706){return function(){UserEvents[_0x8a66('0x3')](_0x463765,_0x13b706);};}exports[_0x8a66('0x4')]=function(_0x15a0ad){for(var _0x558f4a=0x0,_0x45a083=events['length'];_0x558f4a<_0x45a083;_0x558f4a++){var _0x3fe44a=events[_0x558f4a];var _0x4ed974=createListener(_0x8a66('0x5')+_0x3fe44a,_0x15a0ad);UserEvents['on'](_0x3fe44a,_0x4ed974);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index fe4acf1..5221db8 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x656639,_0x11fbae){var _0x3fce31=function(_0x564368){while(--_0x564368){_0x656639['push'](_0x656639['shift']());}};_0x3fce31(++_0x11fbae);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0xcb91[_0x556bb1];return _0x45455f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3bbc07,_0x596706){var _0x1eca5a=function(_0x3ecdd3){while(--_0x3ecdd3){_0x3bbc07['push'](_0x3bbc07['shift']());}};_0x1eca5a(++_0x596706);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index c6fe55a..1c1d914 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 _0x4304=['INTEGER','sequelize','exports'];(function(_0x10a997,_0x4da7df){var _0x5831f6=function(_0x440165){while(--_0x440165){_0x10a997['push'](_0x10a997['shift']());}};_0x5831f6(++_0x4da7df);}(_0x4304,0xee));var _0x4430=function(_0x3875c2,_0x52b01e){_0x3875c2=_0x3875c2-0x0;var _0x52b45b=_0x4304[_0x3875c2];return _0x52b45b;};'use strict';var Sequelize=require(_0x4430('0x0'));module[_0x4430('0x1')]={'penalty':{'type':Sequelize[_0x4430('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1d64=['exports','INTEGER','sequelize'];(function(_0x3d674e,_0x4f843d){var _0x1eeefa=function(_0x2f7d3f){while(--_0x2f7d3f){_0x3d674e['push'](_0x3d674e['shift']());}};_0x1eeefa(++_0x4f843d);}(_0x1d64,0x1cd));var _0x41d6=function(_0x40be86,_0x68fe5d){_0x40be86=_0x40be86-0x0;var _0xda3c3b=_0x1d64[_0x40be86];return _0xda3c3b;};'use strict';var Sequelize=require(_0x41d6('0x0'));module[_0x41d6('0x1')]={'penalty':{'type':Sequelize[_0x41d6('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index e4fc8e9..603bbbe 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 _0x7f03=['path','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','api','moment'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x7f03,0x1ca));var _0x37f0=function(_0x5774f2,_0x3d198f){_0x5774f2=_0x5774f2-0x0;var _0x52c5be=_0x7f03[_0x5774f2];return _0x52c5be;};'use strict';var _=require(_0x37f0('0x0'));var util=require(_0x37f0('0x1'));var logger=require('../../config/logger')(_0x37f0('0x2'));var moment=require(_0x37f0('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x37f0('0x4'));var rimraf=require('rimraf');var config=require(_0x37f0('0x5'));var attributes=require(_0x37f0('0x6'));module[_0x37f0('0x7')]=function(_0x30ce1b,_0x250974){return _0x30ce1b[_0x37f0('0x8')](_0x37f0('0x9'),attributes,{'tableName':_0x37f0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4fc4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','lodash','util','../../config/logger'];(function(_0x4dcbd5,_0x31d67e){var _0x5d585c=function(_0x74685e){while(--_0x74685e){_0x4dcbd5['push'](_0x4dcbd5['shift']());}};_0x5d585c(++_0x31d67e);}(_0x4fc4,0x15c));var _0x44fc=function(_0xb50e93,_0x5a4be9){_0xb50e93=_0xb50e93-0x0;var _0x4f0263=_0x4fc4[_0xb50e93];return _0x4f0263;};'use strict';var _=require(_0x44fc('0x0'));var util=require(_0x44fc('0x1'));var logger=require(_0x44fc('0x2'))(_0x44fc('0x3'));var moment=require(_0x44fc('0x4'));var BPromise=require(_0x44fc('0x5'));var rp=require(_0x44fc('0x6'));var fs=require('fs');var path=require(_0x44fc('0x7'));var rimraf=require(_0x44fc('0x8'));var config=require(_0x44fc('0x9'));var attributes=require(_0x44fc('0xa'));module[_0x44fc('0xb')]=function(_0x10ee1b,_0x51b153){return _0x10ee1b[_0x44fc('0xc')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index e4f5c8e..865b51b 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 _0x212b=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0xb795ef,_0x3ac5a4){var _0x15f84e=function(_0x1f24d7){while(--_0x1f24d7){_0xb795ef['push'](_0xb795ef['shift']());}};_0x15f84e(++_0x3ac5a4);}(_0x212b,0x1b5));var _0xb212=function(_0xf2ed2d,_0x30e369){_0xf2ed2d=_0xf2ed2d-0x0;var _0xab5f2b=_0x212b[_0xf2ed2d];return _0xab5f2b;};'use strict';var _=require(_0xb212('0x0'));var util=require(_0xb212('0x1'));var moment=require(_0xb212('0x2'));var BPromise=require('bluebird');var rs=require(_0xb212('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb212('0x4'))['db'];var utils=require(_0xb212('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb212('0x6'));var jayson=require(_0xb212('0x7'));var client=jayson['client'][_0xb212('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1073da,_0xd11744,_0x5ef9b0){return new BPromise(function(_0x2300ca,_0x4d955e){return client[_0xb212('0x9')](_0x1073da,_0x5ef9b0)[_0xb212('0xa')](function(_0xc7d2a6){logger[_0xb212('0xb')](_0xb212('0xc'),_0xd11744,_0xb212('0xd'));logger['debug'](_0xb212('0xe'),_0xd11744,_0xb212('0xd'),JSON[_0xb212('0xf')](_0xc7d2a6));if(_0xc7d2a6['error']){if(_0xc7d2a6[_0xb212('0x10')][_0xb212('0x11')]===0x1f4){logger[_0xb212('0x10')](_0xb212('0xc'),_0xd11744,_0xc7d2a6[_0xb212('0x10')]['message']);return _0x4d955e(_0xc7d2a6['error'][_0xb212('0x12')]);}logger[_0xb212('0x10')](_0xb212('0xc'),_0xd11744,_0xc7d2a6[_0xb212('0x10')][_0xb212('0x12')]);return _0x2300ca(_0xc7d2a6['error'][_0xb212('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0xd11744,_0xb212('0xd'));_0x2300ca(_0xc7d2a6[_0xb212('0x13')][_0xb212('0x12')]);}})[_0xb212('0x14')](function(_0x48f59c){logger[_0xb212('0x10')](_0xb212('0xc'),_0xd11744,_0x48f59c);_0x4d955e(_0x48f59c);});});} \ No newline at end of file +var _0xf373=['then','info','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x387e84,_0x5fffe7){var _0x1add03=function(_0x52b004){while(--_0x52b004){_0x387e84['push'](_0x387e84['shift']());}};_0x1add03(++_0x5fffe7);}(_0xf373,0x1d7));var _0x3f37=function(_0x37f375,_0x30cf4b){_0x37f375=_0x37f375-0x0;var _0x36ed14=_0xf373[_0x37f375];return _0x36ed14;};'use strict';var _=require('lodash');var util=require(_0x3f37('0x0'));var moment=require(_0x3f37('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f37('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f37('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3f37('0x4'))(_0x3f37('0x5'));var config=require(_0x3f37('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3f37('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59dbe1,_0x650ee8,_0x721029){return new BPromise(function(_0x324082,_0x3321e3){return client[_0x3f37('0x8')](_0x59dbe1,_0x721029)[_0x3f37('0x9')](function(_0x228735){logger[_0x3f37('0xa')](_0x3f37('0xb'),_0x650ee8,'request\x20sent');logger['debug'](_0x3f37('0xc'),_0x650ee8,_0x3f37('0xd'),JSON[_0x3f37('0xe')](_0x228735));if(_0x228735[_0x3f37('0xf')]){if(_0x228735[_0x3f37('0xf')][_0x3f37('0x10')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x650ee8,_0x228735[_0x3f37('0xf')]['message']);return _0x3321e3(_0x228735[_0x3f37('0xf')][_0x3f37('0x11')]);}logger[_0x3f37('0xf')](_0x3f37('0xb'),_0x650ee8,_0x228735[_0x3f37('0xf')][_0x3f37('0x11')]);return _0x324082(_0x228735[_0x3f37('0xf')][_0x3f37('0x11')]);}else{logger[_0x3f37('0xa')](_0x3f37('0xb'),_0x650ee8,_0x3f37('0xd'));_0x324082(_0x228735[_0x3f37('0x12')]['message']);}})[_0x3f37('0x13')](function(_0x3c979b){logger['error'](_0x3f37('0xb'),_0x650ee8,_0x3c979b);_0x3321e3(_0x3c979b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 239474c..310e185 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3d400e,_0x10cf94){var _0x270c61=function(_0x1d61fc){while(--_0x1d61fc){_0x3d400e['push'](_0x3d400e['shift']());}};_0x270c61(++_0x10cf94);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0xcb91[_0x2ae2ad];return _0x26dbd7;};'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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x3ceb73,_0x4829e5){var _0xf8ff4f=function(_0x1c6659){while(--_0x1c6659){_0x3ceb73['push'](_0x3ceb73['shift']());}};_0xf8ff4f(++_0x4829e5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8d2df24..d3ae9b9 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 _0xae0e=['sequelize','INTEGER','STRING'];(function(_0x3a9c61,_0x58c919){var _0x3e05b3=function(_0x530497){while(--_0x530497){_0x3a9c61['push'](_0x3a9c61['shift']());}};_0x3e05b3(++_0x58c919);}(_0xae0e,0xb4));var _0xeae0=function(_0x21c05d,_0x3197dc){_0x21c05d=_0x21c05d-0x0;var _0x2c2cf1=_0xae0e[_0x21c05d];return _0x2c2cf1;};'use strict';var Sequelize=require(_0xeae0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xeae0('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xeae0('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xeae0('0x2')]}}; \ No newline at end of file +var _0x3267=['sequelize','exports','INTEGER','STRING'];(function(_0x4cb33f,_0x392fbe){var _0xcdada6=function(_0x32ed1c){while(--_0x32ed1c){_0x4cb33f['push'](_0x4cb33f['shift']());}};_0xcdada6(++_0x392fbe);}(_0x3267,0x124));var _0x7326=function(_0xb0fe92,_0x147e42){_0xb0fe92=_0xb0fe92-0x0;var _0x41787f=_0x3267[_0xb0fe92];return _0x41787f;};'use strict';var Sequelize=require(_0x7326('0x0'));module[_0x7326('0x1')]={'penalty':{'type':Sequelize[_0x7326('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x7326('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 8b94b7a..704f412 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 _0x93da=['request-promise','path','rimraf','../../config/environment','exports','define','UserFaxQueue','lodash','../../config/logger','api','bluebird'];(function(_0x1d7a74,_0x4402e9){var _0x44df06=function(_0x4f0d69){while(--_0x4f0d69){_0x1d7a74['push'](_0x1d7a74['shift']());}};_0x44df06(++_0x4402e9);}(_0x93da,0xd8));var _0xa93d=function(_0x3707fb,_0x40f632){_0x3707fb=_0x3707fb-0x0;var _0x4b7569=_0x93da[_0x3707fb];return _0x4b7569;};'use strict';var _=require(_0xa93d('0x0'));var util=require('util');var logger=require(_0xa93d('0x1'))(_0xa93d('0x2'));var moment=require('moment');var BPromise=require(_0xa93d('0x3'));var rp=require(_0xa93d('0x4'));var fs=require('fs');var path=require(_0xa93d('0x5'));var rimraf=require(_0xa93d('0x6'));var config=require(_0xa93d('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0xa93d('0x8')]=function(_0x1d703c,_0x33bca1){return _0x1d703c[_0xa93d('0x9')](_0xa93d('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ecf=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash','util'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0x0ecf,0x140));var _0xf0ec=function(_0x2c72f5,_0x499c8a){_0x2c72f5=_0x2c72f5-0x0;var _0x35a845=_0x0ecf[_0x2c72f5];return _0x35a845;};'use strict';var _=require(_0xf0ec('0x0'));var util=require(_0xf0ec('0x1'));var logger=require(_0xf0ec('0x2'))(_0xf0ec('0x3'));var moment=require(_0xf0ec('0x4'));var BPromise=require(_0xf0ec('0x5'));var rp=require(_0xf0ec('0x6'));var fs=require('fs');var path=require(_0xf0ec('0x7'));var rimraf=require('rimraf');var config=require(_0xf0ec('0x8'));var attributes=require(_0xf0ec('0x9'));module[_0xf0ec('0xa')]=function(_0x2b768e,_0x115863){return _0x2b768e[_0xf0ec('0xb')](_0xf0ec('0xc'),attributes,{'tableName':_0xf0ec('0xd'),'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 e87301e..3cf5443 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 _0x02c1=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02c1,0x128));var _0x102c=function(_0x12a1de,_0x220be4){_0x12a1de=_0x12a1de-0x0;var _0x167f8d=_0x02c1[_0x12a1de];return _0x167f8d;};'use strict';var _=require(_0x102c('0x0'));var util=require(_0x102c('0x1'));var moment=require(_0x102c('0x2'));var BPromise=require(_0x102c('0x3'));var rs=require(_0x102c('0x4'));var fs=require('fs');var Redis=require(_0x102c('0x5'));var db=require(_0x102c('0x6'))['db'];var utils=require(_0x102c('0x7'));var logger=require(_0x102c('0x8'))(_0x102c('0x9'));var config=require('../../config/environment');var jayson=require(_0x102c('0xa'));var client=jayson[_0x102c('0xb')][_0x102c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x38b587,_0x61c19,_0x157e08){return new BPromise(function(_0x5373a0,_0x530dab){return client['request'](_0x38b587,_0x157e08)['then'](function(_0x56bfc0){logger[_0x102c('0xd')](_0x102c('0xe'),_0x61c19,_0x102c('0xf'));logger[_0x102c('0x10')](_0x102c('0x11'),_0x61c19,'request\x20sent',JSON['stringify'](_0x56bfc0));if(_0x56bfc0[_0x102c('0x12')]){if(_0x56bfc0[_0x102c('0x12')][_0x102c('0x13')]===0x1f4){logger[_0x102c('0x12')]('UserFaxQueue,\x20%s,\x20%s',_0x61c19,_0x56bfc0[_0x102c('0x12')][_0x102c('0x14')]);return _0x530dab(_0x56bfc0[_0x102c('0x12')][_0x102c('0x14')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x61c19,_0x56bfc0[_0x102c('0x12')][_0x102c('0x14')]);return _0x5373a0(_0x56bfc0[_0x102c('0x12')][_0x102c('0x14')]);}else{logger[_0x102c('0xd')](_0x102c('0xe'),_0x61c19,_0x102c('0xf'));_0x5373a0(_0x56bfc0[_0x102c('0x15')][_0x102c('0x14')]);}})[_0x102c('0x16')](function(_0x44cd63){logger['error'](_0x102c('0xe'),_0x61c19,_0x44cd63);_0x530dab(_0x44cd63);});});} \ No newline at end of file +var _0x3190=['error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3190,0x184));var _0x0319=function(_0x8d4ec5,_0xcbe0b0){_0x8d4ec5=_0x8d4ec5-0x0;var _0x3ba2c1=_0x3190[_0x8d4ec5];return _0x3ba2c1;};'use strict';var _=require(_0x0319('0x0'));var util=require(_0x0319('0x1'));var moment=require(_0x0319('0x2'));var BPromise=require(_0x0319('0x3'));var rs=require(_0x0319('0x4'));var fs=require('fs');var Redis=require(_0x0319('0x5'));var db=require(_0x0319('0x6'))['db'];var utils=require(_0x0319('0x7'));var logger=require(_0x0319('0x8'))('rpc');var config=require(_0x0319('0x9'));var jayson=require(_0x0319('0xa'));var client=jayson[_0x0319('0xb')][_0x0319('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x569171,_0x19d9cc,_0x4b8dbb){return new BPromise(function(_0x40fa10,_0x464312){return client[_0x0319('0xd')](_0x569171,_0x4b8dbb)[_0x0319('0xe')](function(_0x190e80){logger[_0x0319('0xf')](_0x0319('0x10'),_0x19d9cc,_0x0319('0x11'));logger['debug'](_0x0319('0x12'),_0x19d9cc,_0x0319('0x11'),JSON[_0x0319('0x13')](_0x190e80));if(_0x190e80[_0x0319('0x14')]){if(_0x190e80[_0x0319('0x14')][_0x0319('0x15')]===0x1f4){logger[_0x0319('0x14')]('UserFaxQueue,\x20%s,\x20%s',_0x19d9cc,_0x190e80[_0x0319('0x14')][_0x0319('0x16')]);return _0x464312(_0x190e80[_0x0319('0x14')][_0x0319('0x16')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x19d9cc,_0x190e80[_0x0319('0x14')][_0x0319('0x16')]);return _0x40fa10(_0x190e80[_0x0319('0x14')]['message']);}else{logger[_0x0319('0xf')](_0x0319('0x10'),_0x19d9cc,_0x0319('0x11'));_0x40fa10(_0x190e80[_0x0319('0x17')][_0x0319('0x16')]);}})['catch'](function(_0x22adaa){logger[_0x0319('0x14')](_0x0319('0x10'),_0x19d9cc,_0x22adaa);_0x464312(_0x22adaa);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index c37fe82..ae16157 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a12a1,_0x23f85a){var _0xba5e85=function(_0xf0522a){while(--_0xf0522a){_0x4a12a1['push'](_0x4a12a1['shift']());}};_0xba5e85(++_0x23f85a);}(_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(_0x39bff9,_0x1ada74){var _0x24cc0e=function(_0x1048b1){while(--_0x1048b1){_0x39bff9['push'](_0x39bff9['shift']());}};_0x24cc0e(++_0x1ada74);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5976f8,_0x1265b7){_0x5976f8=_0x5976f8-0x0;var _0x179715=_0xcb91[_0x5976f8];return _0x179715;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6ffd962..2de9b39 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 _0x08d3=['sequelize','exports'];(function(_0x10e108,_0xb7d5f4){var _0x2550c8=function(_0x50c0a5){while(--_0x50c0a5){_0x10e108['push'](_0x10e108['shift']());}};_0x2550c8(++_0xb7d5f4);}(_0x08d3,0x174));var _0x308d=function(_0x530ef0,_0x514c24){_0x530ef0=_0x530ef0-0x0;var _0x34b010=_0x08d3[_0x530ef0];return _0x34b010;};'use strict';var Sequelize=require(_0x308d('0x0'));module[_0x308d('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3b2e=['sequelize','exports','INTEGER'];(function(_0x572e91,_0x4cab51){var _0x52fe80=function(_0x3dc60d){while(--_0x3dc60d){_0x572e91['push'](_0x572e91['shift']());}};_0x52fe80(++_0x4cab51);}(_0x3b2e,0xf6));var _0xe3b2=function(_0x27c69b,_0x4cbe55){_0x27c69b=_0x27c69b-0x0;var _0x198ac4=_0x3b2e[_0x27c69b];return _0x198ac4;};'use strict';var Sequelize=require(_0xe3b2('0x0'));module[_0xe3b2('0x1')]={'penalty':{'type':Sequelize[_0xe3b2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index c9f421b..087466d 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 _0x7ec3=['bluebird','request-promise','../../config/environment','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x7ec3,0x17d));var _0x37ec=function(_0xb7a49c,_0x5b691b){_0xb7a49c=_0xb7a49c-0x0;var _0x5cbc40=_0x7ec3[_0xb7a49c];return _0x5cbc40;};'use strict';var _=require(_0x37ec('0x0'));var util=require(_0x37ec('0x1'));var logger=require(_0x37ec('0x2'))(_0x37ec('0x3'));var moment=require('moment');var BPromise=require(_0x37ec('0x4'));var rp=require(_0x37ec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37ec('0x6'));var attributes=require('./userMailQueue.attributes');module[_0x37ec('0x7')]=function(_0x221cc6,_0x3a5b0b){return _0x221cc6[_0x37ec('0x8')](_0x37ec('0x9'),attributes,{'tableName':_0x37ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x017d=['exports','define','user_has_mail_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5f599c,_0x28f5bd){var _0x4cbdfc=function(_0x42540b){while(--_0x42540b){_0x5f599c['push'](_0x5f599c['shift']());}};_0x4cbdfc(++_0x28f5bd);}(_0x017d,0x7c));var _0xd017=function(_0x53fefe,_0x407ac6){_0x53fefe=_0x53fefe-0x0;var _0x1afbf6=_0x017d[_0x53fefe];return _0x1afbf6;};'use strict';var _=require(_0xd017('0x0'));var util=require(_0xd017('0x1'));var logger=require('../../config/logger')(_0xd017('0x2'));var moment=require('moment');var BPromise=require(_0xd017('0x3'));var rp=require(_0xd017('0x4'));var fs=require('fs');var path=require(_0xd017('0x5'));var rimraf=require(_0xd017('0x6'));var config=require(_0xd017('0x7'));var attributes=require('./userMailQueue.attributes');module[_0xd017('0x8')]=function(_0x21455e,_0x77e7a6){return _0x21455e[_0xd017('0x9')]('UserMailQueue',attributes,{'tableName':_0xd017('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 2a133a5..b3870c3 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4c8bfb,_0x216ded){var _0x230ac7=function(_0x5f0baa){while(--_0x5f0baa){_0x4c8bfb['push'](_0x4c8bfb['shift']());}};_0x230ac7(++_0x216ded);}(_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 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']('UserMailQueue,\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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x525b87,_0x3ec8b1){var _0x3df8d0=function(_0x4ab62e){while(--_0x4ab62e){_0x525b87['push'](_0x525b87['shift']());}};_0x3df8d0(++_0x3ec8b1);}(_0x8ef6,0xf2));var _0x68ef=function(_0xab7cdd,_0x570057){_0xab7cdd=_0xab7cdd-0x0;var _0x5c2710=_0x8ef6[_0xab7cdd];return _0x5c2710;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index a6cdd63..fdcd1ea 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 _0x7e4d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1b3a0d,_0x409937){var _0x5d980b=function(_0x333ffb){while(--_0x333ffb){_0x1b3a0d['push'](_0x1b3a0d['shift']());}};_0x5d980b(++_0x409937);}(_0x7e4d,0x126));var _0xd7e4=function(_0x2dc084,_0x5a928a){_0x2dc084=_0x2dc084-0x0;var _0x53e1ca=_0x7e4d[_0x2dc084];return _0x53e1ca;};'use strict';var multer=require(_0xd7e4('0x0'));var util=require(_0xd7e4('0x1'));var path=require(_0xd7e4('0x2'));var timeout=require(_0xd7e4('0x3'));var express=require(_0xd7e4('0x4'));var router=express[_0xd7e4('0x5')]();var fs_extra=require(_0xd7e4('0x6'));var auth=require(_0xd7e4('0x7'));var interaction=require(_0xd7e4('0x8'));var config=require(_0xd7e4('0x9'));var controller=require(_0xd7e4('0xa'));router[_0xd7e4('0xb')]('/',auth[_0xd7e4('0xc')](),controller[_0xd7e4('0xd')]);module[_0xd7e4('0xe')]=router; \ No newline at end of file +var _0x36b3=['isAuthenticated','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x36b3,0x11a));var _0x336b=function(_0x4b3eaa,_0x4619de){_0x4b3eaa=_0x4b3eaa-0x0;var _0x5c4aea=_0x36b3[_0x4b3eaa];return _0x5c4aea;};'use strict';var multer=require('multer');var util=require(_0x336b('0x0'));var path=require('path');var timeout=require(_0x336b('0x1'));var express=require(_0x336b('0x2'));var router=express[_0x336b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x336b('0x4'));var interaction=require(_0x336b('0x5'));var config=require(_0x336b('0x6'));var controller=require(_0x336b('0x7'));router['post']('/',auth[_0x336b('0x8')](),controller['sendUserNotification']);module[_0x336b('0x9')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index a289e1f..b32d810 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 _0x5baf=['TEXT','STRING','sequelize'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x5baf,0x155));var _0xf5ba=function(_0x320373,_0x58db72){_0x320373=_0x320373-0x0;var _0x593e91=_0x5baf[_0x320373];return _0x593e91;};'use strict';var Sequelize=require(_0xf5ba('0x0'));module['exports']={'body':{'type':Sequelize[_0xf5ba('0x1')]},'senderName':{'type':Sequelize[_0xf5ba('0x2')]},'recipientsId':{'type':Sequelize[_0xf5ba('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xed95=['BOOLEAN','sequelize','TEXT','STRING'];(function(_0xabd853,_0x2f4184){var _0x2e20e6=function(_0x5857d1){while(--_0x5857d1){_0xabd853['push'](_0xabd853['shift']());}};_0x2e20e6(++_0x2f4184);}(_0xed95,0xd5));var _0x5ed9=function(_0x4deebf,_0x5b9b72){_0x4deebf=_0x4deebf-0x0;var _0x1a7a84=_0xed95[_0x4deebf];return _0x1a7a84;};'use strict';var Sequelize=require(_0x5ed9('0x0'));module['exports']={'body':{'type':Sequelize[_0x5ed9('0x1')]},'senderName':{'type':Sequelize[_0x5ed9('0x2')]},'recipientsId':{'type':Sequelize[_0x5ed9('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x5ed9('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 22dc1f2..47c39d8 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 _0x9af7=['recipient','emit','userNotification:send','catch','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','includes','queue','Queue','push','all','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','then','destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','sortBy','join','sequelize','UserNotification','forEach'];(function(_0x56092a,_0x291ce5){var _0x1c9558=function(_0x5bf0c5){while(--_0x5bf0c5){_0x56092a['push'](_0x56092a['shift']());}};_0x1c9558(++_0x291ce5);}(_0x9af7,0xdc));var _0x79af=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9af7[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x79af('0x0'));var rimraf=require(_0x79af('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x79af('0x2'));var rp=require(_0x79af('0x3'));var moment=require(_0x79af('0x4'));var BPromise=require(_0x79af('0x5'));var Mustache=require(_0x79af('0x6'));var util=require(_0x79af('0x7'));var path=require(_0x79af('0x8'));var sox=require(_0x79af('0x9'));var csv=require(_0x79af('0xa'));var ejs=require(_0x79af('0xb'));var fs=require('fs');var fs_extra=require(_0x79af('0xc'));var _=require(_0x79af('0xd'));var squel=require(_0x79af('0xe'));var crypto=require('crypto');var jsforce=require(_0x79af('0xf'));var deskjs=require(_0x79af('0x10'));var toCsv=require('to-csv');var querystring=require(_0x79af('0x11'));var Papa=require(_0x79af('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x79af('0x13'));var hardwareService=require(_0x79af('0x14'));var logger=require(_0x79af('0x15'))(_0x79af('0x16'));var utils=require(_0x79af('0x17'));var config=require(_0x79af('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x79af('0x19'))['db'];config[_0x79af('0x1a')]=_[_0x79af('0x1b')](config[_0x79af('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x79af('0x1c'))(new Redis(config[_0x79af('0x1a')]));require(_0x79af('0x1d'))[_0x79af('0x1e')](socket);function respondWithStatusCode(_0x2b56e0,_0x41271b){_0x41271b=_0x41271b||0xcc;return function(_0x2223ce){if(_0x2223ce){return _0x2b56e0[_0x79af('0x1f')](_0x41271b);}return _0x2b56e0[_0x79af('0x20')](_0x41271b)[_0x79af('0x21')]();};}function respondWithResult(_0x32f1b8,_0x309aa3){_0x309aa3=_0x309aa3||0xc8;return function(_0x370359){if(_0x370359){return _0x32f1b8[_0x79af('0x20')](_0x309aa3)[_0x79af('0x22')](_0x370359);}};}function respondWithFilteredResult(_0x258384,_0x36a4c4){return function(_0x503297){if(_0x503297){var _0x7bcc7b=typeof _0x36a4c4[_0x79af('0x23')]===_0x79af('0x24')&&typeof _0x36a4c4['limit']==='undefined';var _0x5d2d5e=_0x503297[_0x79af('0x25')];var _0x336e12=_0x7bcc7b?0x0:_0x36a4c4[_0x79af('0x23')];var _0xabb6c=_0x7bcc7b?_0x503297[_0x79af('0x25')]:_0x36a4c4[_0x79af('0x23')]+_0x36a4c4[_0x79af('0x26')];var _0xb7f93b;if(_0xabb6c>=_0x5d2d5e){_0xabb6c=_0x5d2d5e;_0xb7f93b=0xc8;}else{_0xb7f93b=0xce;}_0x258384[_0x79af('0x20')](_0xb7f93b);return _0x258384[_0x79af('0x27')]('Content-Range',_0x336e12+'-'+_0xabb6c+'/'+_0x5d2d5e)['json'](_0x503297);}return null;};}function patchUpdates(_0x2d1b78){return function(_0x6cf4d8){try{jsonpatch['apply'](_0x6cf4d8,_0x2d1b78,!![]);}catch(_0x44fb04){return BPromise[_0x79af('0x28')](_0x44fb04);}return _0x6cf4d8[_0x79af('0x29')]();};}function saveUpdates(_0x474eda,_0x1677db){return function(_0x5c24dc){if(_0x5c24dc){return _0x5c24dc[_0x79af('0x2a')](_0x474eda)[_0x79af('0x2b')](function(_0x5d0fdf){return _0x5d0fdf;});}return null;};}function removeEntity(_0x381edf,_0x28889d){return function(_0x1c6971){if(_0x1c6971){return _0x1c6971[_0x79af('0x2c')]()[_0x79af('0x2b')](function(){_0x381edf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ff78d,_0x4d78bc){return function(_0x855291){if(!_0x855291){_0x7ff78d[_0x79af('0x1f')](0x194);}return _0x855291;};}function handleError(_0x9a7f71,_0x44796d){_0x44796d=_0x44796d||0x1f4;return function(_0x5c4d54){logger[_0x79af('0x2d')](_0x5c4d54[_0x79af('0x2e')]);if(_0x5c4d54[_0x79af('0x2f')]){delete _0x5c4d54['name'];}_0x9a7f71['status'](_0x44796d)['send'](_0x5c4d54);};}exports[_0x79af('0x30')]=function(_0x2b8cc2,_0x58c8a2,_0x468952){if(!_0x2b8cc2[_0x79af('0x31')][_0x79af('0x32')](_0x79af('0x33'))&&!_0x2b8cc2[_0x79af('0x31')][_0x79af('0x32')](_0x79af('0x34'))){throw new db[(_0x79af('0x35'))][(_0x79af('0x36'))](_0x79af('0x37'));}else{if(_0x2b8cc2[_0x79af('0x31')][_0x79af('0x32')](_0x79af('0x34'))&&!_0x2b8cc2[_0x79af('0x31')]['hasOwnProperty'](_0x79af('0x38'))){throw new db[(_0x79af('0x35'))][(_0x79af('0x36'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x2b8cc2['body'][_0x79af('0x32')](_0x79af('0x39'))){throw new db[(_0x79af('0x35'))][(_0x79af('0x36'))](_0x79af('0x3a'));}else{try{var _0xad7957=JSON[_0x79af('0x3b')](_0x2b8cc2['body'][_0x79af('0x39')]);}catch(_0x416d0d){logger['error'](_0x416d0d);throw new db[(_0x79af('0x35'))][(_0x79af('0x36'))](_0x79af('0x3c'));}var _0x3b7654=[_0x79af('0x3d'),_0x79af('0x3e'),_0x79af('0x3f'),_0x79af('0x40'),_0x79af('0x41'),_0x79af('0x42'),_0x79af('0x43'),_0x79af('0x44'),_0x79af('0x45')];if(_['some'](_0xad7957,function(_0x1314fc){return!_['includes'](_0x3b7654,_0x1314fc[_0x79af('0x46')][_0x79af('0x47')]());})){throw new db[(_0x79af('0x35'))]['ValidationError'](_0x79af('0x48'));}}}var _0x1c3ef2={};_0x1c3ef2[_0x79af('0x49')]=_0x2b8cc2[_0x79af('0x31')][_0x79af('0x32')]('senderName')?_0x2b8cc2[_0x79af('0x31')]['senderName']:_0x2b8cc2['user'][_0x79af('0x4a')];_0x1c3ef2[_0x79af('0x4b')]=_[_0x79af('0x4c')](_0x2b8cc2['body'][_0x79af('0x4b')])?null:_0x2b8cc2[_0x79af('0x31')][_0x79af('0x4b')];_0x1c3ef2[_0x79af('0x4d')]=_0x2b8cc2[_0x79af('0x31')][_0x79af('0x4d')]||![];_0x1c3ef2['SenderId']=_0x2b8cc2[_0x79af('0x45')]['id'];return getContent(_0x2b8cc2[_0x79af('0x31')])[_0x79af('0x2b')](function(_0x67b722){_0x1c3ef2['body']=_0x67b722;return getRecipients(_0xad7957);})[_0x79af('0x2b')](function(_0x5ee222){_0x1c3ef2['recipientsId']=_[_0x79af('0x4e')](_0x5ee222)[_0x79af('0x4f')](',');return db[_0x79af('0x50')]['transaction'](function(_0x12f3dc){return db[_0x79af('0x51')]['create'](_0x1c3ef2,{'raw':!![],'transaction':_0x12f3dc})[_0x79af('0x2b')](function(_0x3c0579){var _0x1522c2={'sender':_0x1c3ef2['senderName'],'description':_0x1c3ef2[_0x79af('0x4b')],'content':_0x1c3ef2[_0x79af('0x31')],'beep':_0x1c3ef2['beep']};_0x5ee222[_0x79af('0x52')](function(_0x233068){_0x1522c2[_0x79af('0x53')]=_0x233068;socket[_0x79af('0x54')](_0x79af('0x55'),_0x1522c2);});return _0x3c0579;});});})[_0x79af('0x2b')](respondWithResult(_0x58c8a2,0xc9))[_0x79af('0x56')](handleError(_0x58c8a2,null));};function getContent(_0x30f6f5){return new BPromise(function(_0x3899ac,_0x5b4423){if(_0x30f6f5[_0x79af('0x33')]){_0x3899ac(_0x30f6f5['text']);return;}return db[_0x79af('0x57')]['findOne']({'attributes':[_0x79af('0x58')],'where':{'id':_0x30f6f5[_0x79af('0x34')]},'raw':!![]})[_0x79af('0x2b')](function(_0x2a3053){if(!_0x2a3053)throw new db['Sequelize'][(_0x79af('0x36'))](_0x79af('0x59'));var _0x373f89=Mustache[_0x79af('0x5a')](_0x2a3053[_0x79af('0x58')],_0x30f6f5[_0x79af('0x38')]);_0x3899ac(_0x373f89);})['catch'](function(_0x50033b){_0x5b4423(_0x50033b);});});}function getRecipients(_0x3453d6){return new BPromise(function(_0x3b56ee,_0x5c8499){var _0x11b119=[];var _0x5cbe0f=[];_0x3453d6[_0x79af('0x52')](function(_0x3ee58f){var _0x3f1029=_[_0x79af('0x5b')](_0x3ee58f[_0x79af('0x46')][_0x79af('0x47')]());if(_0x3f1029===_0x79af('0x5c')){_0x11b119=_[_0x79af('0x5d')](_0x11b119,_0x3ee58f['ids']);}else{if(_[_0x79af('0x5e')](_0x3f1029,_0x79af('0x5f')))_0x3f1029=_0x3f1029['replace'](_0x79af('0x5f'),_0x79af('0x60'));_0x3ee58f['ids']['forEach'](function(_0xf34313){_0x5cbe0f[_0x79af('0x61')](getAgents(_0x3f1029,_0xf34313));});}});return BPromise[_0x79af('0x62')](_0x5cbe0f)[_0x79af('0x2b')](function(_0x5a2175){_0x11b119=_[_0x79af('0x5d')](_0x11b119,_['flatten'](_0x5a2175));_0x3b56ee(_0x11b119);})[_0x79af('0x56')](function(_0x57f347){_0x5c8499(_0x57f347);});});}function getAgents(_0x83e2b3,_0xeb236){return new BPromise(function(_0x4ea308,_0xb27d56){return db[_0x83e2b3]['findOne']({'where':{'id':_0xeb236}})['then'](function(_0x114394){return _0x114394[_0x79af('0x63')]({'attributes':['id'],'raw':!![]})[_0x79af('0x2b')](function(_0x153100){var _0xfc2f91=_[_0x79af('0x64')](_0x153100,'id');_0x4ea308(_0xfc2f91);});})[_0x79af('0x56')](function(_0x228bc2){_0xb27d56(_0x228bc2);});});} \ No newline at end of file +var _0xb164=['zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','./userNotification.socket','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','send','sendUserNotification','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','body','view','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','recipients','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sequelize','transaction','UserNotification','recipient','emit','userNotification:send','catch','text','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','User','union','queue','replace','forEach','push','getAgents','map','eml-format','rimraf'];(function(_0x399714,_0x17497c){var _0x4cd7b9=function(_0x458577){while(--_0x458577){_0x399714['push'](_0x399714['shift']());}};_0x4cd7b9(++_0x17497c);}(_0xb164,0xb4));var _0x4b16=function(_0x247923,_0x3aa509){_0x247923=_0x247923-0x0;var _0x4e4fbd=_0xb164[_0x247923];return _0x4e4fbd;};'use strict';var emlformat=require(_0x4b16('0x0'));var rimraf=require(_0x4b16('0x1'));var zipdir=require(_0x4b16('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4b16('0x3'));var BPromise=require(_0x4b16('0x4'));var Mustache=require(_0x4b16('0x5'));var util=require(_0x4b16('0x6'));var path=require(_0x4b16('0x7'));var sox=require(_0x4b16('0x8'));var csv=require(_0x4b16('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b16('0xa'));var squel=require(_0x4b16('0xb'));var crypto=require(_0x4b16('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4b16('0x9'));var querystring=require(_0x4b16('0xd'));var Papa=require(_0x4b16('0xe'));var Redis=require(_0x4b16('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4b16('0x10'));var as=require(_0x4b16('0x11'));var hardwareService=require(_0x4b16('0x12'));var logger=require(_0x4b16('0x13'))(_0x4b16('0x14'));var utils=require(_0x4b16('0x15'));var config=require(_0x4b16('0x16'));var licenseUtil=require(_0x4b16('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4b16('0x18')](config[_0x4b16('0x19')],{'host':_0x4b16('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b16('0x19')]));require(_0x4b16('0x1b'))['register'](socket);function respondWithStatusCode(_0x1a6535,_0x1fd20b){_0x1fd20b=_0x1fd20b||0xcc;return function(_0x5dfac6){if(_0x5dfac6){return _0x1a6535['sendStatus'](_0x1fd20b);}return _0x1a6535[_0x4b16('0x1c')](_0x1fd20b)['end']();};}function respondWithResult(_0x3e188d,_0x414362){_0x414362=_0x414362||0xc8;return function(_0x346f51){if(_0x346f51){return _0x3e188d[_0x4b16('0x1c')](_0x414362)['json'](_0x346f51);}};}function respondWithFilteredResult(_0x4b0adb,_0x2a13e5){return function(_0x51e19b){if(_0x51e19b){var _0x348285=typeof _0x2a13e5[_0x4b16('0x1d')]===_0x4b16('0x1e')&&typeof _0x2a13e5[_0x4b16('0x1f')]===_0x4b16('0x1e');var _0x32dcf1=_0x51e19b[_0x4b16('0x20')];var _0x21eeb7=_0x348285?0x0:_0x2a13e5['offset'];var _0x3d535f=_0x348285?_0x51e19b[_0x4b16('0x20')]:_0x2a13e5['offset']+_0x2a13e5['limit'];var _0x25798f;if(_0x3d535f>=_0x32dcf1){_0x3d535f=_0x32dcf1;_0x25798f=0xc8;}else{_0x25798f=0xce;}_0x4b0adb[_0x4b16('0x1c')](_0x25798f);return _0x4b0adb[_0x4b16('0x21')](_0x4b16('0x22'),_0x21eeb7+'-'+_0x3d535f+'/'+_0x32dcf1)['json'](_0x51e19b);}return null;};}function patchUpdates(_0x70e6d2){return function(_0x456273){try{jsonpatch[_0x4b16('0x23')](_0x456273,_0x70e6d2,!![]);}catch(_0x590268){return BPromise[_0x4b16('0x24')](_0x590268);}return _0x456273['save']();};}function saveUpdates(_0x7826d0,_0x657fb){return function(_0x5db085){if(_0x5db085){return _0x5db085['update'](_0x7826d0)[_0x4b16('0x25')](function(_0x2b1316){return _0x2b1316;});}return null;};}function removeEntity(_0x170438,_0x25a687){return function(_0x50d22a){if(_0x50d22a){return _0x50d22a[_0x4b16('0x26')]()[_0x4b16('0x25')](function(){_0x170438[_0x4b16('0x1c')](0xcc)[_0x4b16('0x27')]();});}};}function handleEntityNotFound(_0x2d4f91,_0x444c22){return function(_0x227d61){if(!_0x227d61){_0x2d4f91['sendStatus'](0x194);}return _0x227d61;};}function handleError(_0x7ae3cf,_0x4fe5f4){_0x4fe5f4=_0x4fe5f4||0x1f4;return function(_0x4e04f8){logger[_0x4b16('0x28')](_0x4e04f8[_0x4b16('0x29')]);if(_0x4e04f8[_0x4b16('0x2a')]){delete _0x4e04f8['name'];}_0x7ae3cf[_0x4b16('0x1c')](_0x4fe5f4)[_0x4b16('0x2b')](_0x4e04f8);};}exports[_0x4b16('0x2c')]=function(_0x44fb50,_0x12f4cf,_0x433656){if(!_0x44fb50['body'][_0x4b16('0x2d')]('text')&&!_0x44fb50['body']['hasOwnProperty'](_0x4b16('0x2e'))){throw new db[(_0x4b16('0x2f'))][(_0x4b16('0x30'))](_0x4b16('0x31'));}else{if(_0x44fb50['body'][_0x4b16('0x2d')](_0x4b16('0x2e'))&&!_0x44fb50[_0x4b16('0x32')][_0x4b16('0x2d')](_0x4b16('0x33'))){throw new db['Sequelize'][(_0x4b16('0x30'))](_0x4b16('0x34'));}if(!_0x44fb50[_0x4b16('0x32')][_0x4b16('0x2d')]('recipients')){throw new db[(_0x4b16('0x2f'))][(_0x4b16('0x30'))](_0x4b16('0x35'));}else{try{var _0x2ec370=JSON['parse'](_0x44fb50['body'][_0x4b16('0x36')]);}catch(_0x1534a4){logger[_0x4b16('0x28')](_0x1534a4);throw new db[(_0x4b16('0x2f'))]['ValidationError']('Invalid\x20\x27recipients\x27\x20object');}var _0x564970=['chatqueue','faxqueue','mailqueue','openchannelqueue',_0x4b16('0x37'),_0x4b16('0x38'),_0x4b16('0x39'),_0x4b16('0x3a'),_0x4b16('0x3b')];if(_[_0x4b16('0x3c')](_0x2ec370,function(_0x32fd09){return!_[_0x4b16('0x3d')](_0x564970,_0x32fd09[_0x4b16('0x3e')][_0x4b16('0x3f')]());})){throw new db[(_0x4b16('0x2f'))]['ValidationError'](_0x4b16('0x40'));}}}var _0x99ce50={};_0x99ce50['senderName']=_0x44fb50['body'][_0x4b16('0x2d')](_0x4b16('0x41'))?_0x44fb50[_0x4b16('0x32')][_0x4b16('0x41')]:_0x44fb50[_0x4b16('0x3b')]['fullname'];_0x99ce50[_0x4b16('0x42')]=_[_0x4b16('0x43')](_0x44fb50['body'][_0x4b16('0x42')])?null:_0x44fb50[_0x4b16('0x32')][_0x4b16('0x42')];_0x99ce50[_0x4b16('0x44')]=_0x44fb50[_0x4b16('0x32')][_0x4b16('0x44')]||![];_0x99ce50[_0x4b16('0x45')]=_0x44fb50['user']['id'];return getContent(_0x44fb50[_0x4b16('0x32')])[_0x4b16('0x25')](function(_0x2a3b43){_0x99ce50[_0x4b16('0x32')]=_0x2a3b43;return getRecipients(_0x2ec370);})[_0x4b16('0x25')](function(_0x265f70){_0x99ce50[_0x4b16('0x46')]=_['sortBy'](_0x265f70)['join'](',');return db[_0x4b16('0x47')][_0x4b16('0x48')](function(_0x55e333){return db[_0x4b16('0x49')]['create'](_0x99ce50,{'raw':!![],'transaction':_0x55e333})[_0x4b16('0x25')](function(_0x5a01f0){var _0x1ccf47={'sender':_0x99ce50[_0x4b16('0x41')],'description':_0x99ce50['recipientsDescription'],'content':_0x99ce50[_0x4b16('0x32')],'beep':_0x99ce50[_0x4b16('0x44')]};_0x265f70['forEach'](function(_0x5c02dd){_0x1ccf47[_0x4b16('0x4a')]=_0x5c02dd;socket[_0x4b16('0x4b')](_0x4b16('0x4c'),_0x1ccf47);});return _0x5a01f0;});});})[_0x4b16('0x25')](respondWithResult(_0x12f4cf,0xc9))[_0x4b16('0x4d')](handleError(_0x12f4cf,null));};function getContent(_0x41b7e3){return new BPromise(function(_0x200be6,_0x2f4637){if(_0x41b7e3[_0x4b16('0x4e')]){_0x200be6(_0x41b7e3['text']);return;}return db[_0x4b16('0x4f')]['findOne']({'attributes':[_0x4b16('0x50')],'where':{'id':_0x41b7e3[_0x4b16('0x2e')]},'raw':!![]})['then'](function(_0x4e52e3){if(!_0x4e52e3)throw new db[(_0x4b16('0x2f'))][(_0x4b16('0x30'))](_0x4b16('0x51'));var _0x36e427=Mustache['render'](_0x4e52e3[_0x4b16('0x50')],_0x41b7e3['view']);_0x200be6(_0x36e427);})[_0x4b16('0x4d')](function(_0x1ba07e){_0x2f4637(_0x1ba07e);});});}function getRecipients(_0x49068f){return new BPromise(function(_0x2e2dc4,_0xefe7bb){var _0x39b35d=[];var _0x5cbaa0=[];_0x49068f['forEach'](function(_0x4aaecb){var _0x78461a=_[_0x4b16('0x52')](_0x4aaecb[_0x4b16('0x3e')][_0x4b16('0x3f')]());if(_0x78461a===_0x4b16('0x53')){_0x39b35d=_[_0x4b16('0x54')](_0x39b35d,_0x4aaecb['ids']);}else{if(_['includes'](_0x78461a,_0x4b16('0x55')))_0x78461a=_0x78461a[_0x4b16('0x56')]('queue','Queue');_0x4aaecb['ids'][_0x4b16('0x57')](function(_0x134a24){_0x5cbaa0[_0x4b16('0x58')](getAgents(_0x78461a,_0x134a24));});}});return BPromise['all'](_0x5cbaa0)[_0x4b16('0x25')](function(_0x5fdb3){_0x39b35d=_['union'](_0x39b35d,_['flatten'](_0x5fdb3));_0x2e2dc4(_0x39b35d);})['catch'](function(_0x9b431){_0xefe7bb(_0x9b431);});});}function getAgents(_0x2128f3,_0x373195){return new BPromise(function(_0x4b5f5b,_0x37826c){return db[_0x2128f3]['findOne']({'where':{'id':_0x373195}})[_0x4b16('0x25')](function(_0x5decbc){return _0x5decbc[_0x4b16('0x59')]({'attributes':['id'],'raw':!![]})[_0x4b16('0x25')](function(_0x253241){var _0x3b7e60=_[_0x4b16('0x5a')](_0x253241,'id');_0x4b5f5b(_0x3b7e60);});})['catch'](function(_0x31932d){_0x37826c(_0x31932d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 138a70f..44c3462 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 _0x0bdf=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x32e758,_0x13c271){var _0x349316=function(_0x27a9da){while(--_0x27a9da){_0x32e758['push'](_0x32e758['shift']());}};_0x349316(++_0x13c271);}(_0x0bdf,0x134));var _0xf0bd=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x0bdf[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0xf0bd('0x0'));var UserNotification=require(_0xf0bd('0x1'))['db'][_0xf0bd('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xf0bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf0bd('0x4')};function emitEvent(_0x2c7c6b){return function(_0x34ce3b,_0x341ebf,_0x6e1a8c){UserNotificationEvents[_0xf0bd('0x5')](_0x2c7c6b+':'+_0x34ce3b['id'],_0x34ce3b);UserNotificationEvents[_0xf0bd('0x5')](_0x2c7c6b,_0x34ce3b);_0x6e1a8c(null);};}for(var e in events){if(events[_0xf0bd('0x6')](e)){var event=events[e];UserNotification[_0xf0bd('0x7')](e,emitEvent(event));}}module[_0xf0bd('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xc935=['remove','emit','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x40a77f,_0x1d5f8d){var _0x415aa1=function(_0x1e45bc){while(--_0x1e45bc){_0x40a77f['push'](_0x40a77f['shift']());}};_0x415aa1(++_0x1d5f8d);}(_0xc935,0x18f));var _0x5c93=function(_0x5eec6c,_0x1f65c9){_0x5eec6c=_0x5eec6c-0x0;var _0x44355d=_0xc935[_0x5eec6c];return _0x44355d;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x5c93('0x0'))['db'][_0x5c93('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x5c93('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5c93('0x3')};function emitEvent(_0x455929){return function(_0x1c854f,_0x149d67,_0xb93db7){UserNotificationEvents['emit'](_0x455929+':'+_0x1c854f['id'],_0x1c854f);UserNotificationEvents[_0x5c93('0x4')](_0x455929,_0x1c854f);_0xb93db7(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x5c93('0x5')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 59baa6f..5c5cc27 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 _0x1fd0=['UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x4c4413,_0x493fba){var _0x33ceec=function(_0x2daede){while(--_0x2daede){_0x4c4413['push'](_0x4c4413['shift']());}};_0x33ceec(++_0x493fba);}(_0x1fd0,0x1bd));var _0x01fd=function(_0xd0a0ae,_0x239a61){_0xd0a0ae=_0xd0a0ae-0x0;var _0x4da1a4=_0x1fd0[_0xd0a0ae];return _0x4da1a4;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require(_0x01fd('0x2'))(_0x01fd('0x3'));var moment=require('moment');var BPromise=require(_0x01fd('0x4'));var rp=require(_0x01fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01fd('0x6'));var config=require(_0x01fd('0x7'));var attributes=require('./userNotification.attributes');module[_0x01fd('0x8')]=function(_0x1b787c,_0x4f0c8f){return _0x1b787c[_0x01fd('0x9')](_0x01fd('0xa'),attributes,{'tableName':_0x01fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01fd('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb6c1=['../../config/logger','api','moment','rimraf','../../config/environment','./userNotification.attributes','define','util'];(function(_0x14598c,_0xca166f){var _0x19e53e=function(_0x19998a){while(--_0x19998a){_0x14598c['push'](_0x14598c['shift']());}};_0x19e53e(++_0xca166f);}(_0xb6c1,0x77));var _0x1b6c=function(_0x22f9c2,_0x202e8b){_0x22f9c2=_0x22f9c2-0x0;var _0x32b564=_0xb6c1[_0x22f9c2];return _0x32b564;};'use strict';var _=require('lodash');var util=require(_0x1b6c('0x0'));var logger=require(_0x1b6c('0x1'))(_0x1b6c('0x2'));var moment=require(_0x1b6c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b6c('0x4'));var config=require(_0x1b6c('0x5'));var attributes=require(_0x1b6c('0x6'));module['exports']=function(_0x235766,_0x32f3bf){return _0x235766[_0x1b6c('0x7')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index e4ab19b..2bfadea 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 _0x243b=['jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','info','request\x20sent','code','error','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','moment','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x243b,0x103));var _0xb243=function(_0x53ba97,_0x3b286f){_0x53ba97=_0x53ba97-0x0;var _0x47045f=_0x243b[_0x53ba97];return _0x47045f;};'use strict';var _=require(_0xb243('0x0'));var util=require('util');var moment=require(_0xb243('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb243('0x2'))['db'];var utils=require(_0xb243('0x3'));var logger=require(_0xb243('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb243('0x5'));var client=jayson[_0xb243('0x6')]['http']({'port':0x232a});config[_0xb243('0x7')]=_[_0xb243('0x8')](config[_0xb243('0x7')],{'host':_0xb243('0x9'),'port':0x18eb});var socket=require(_0xb243('0xa'))(new Redis(config[_0xb243('0x7')]));require(_0xb243('0xb'))[_0xb243('0xc')](socket);function respondWithRpcPromise(_0x30d4c5,_0x1f1845,_0x1bc47a){return new BPromise(function(_0x7928ec,_0x524f28){return client[_0xb243('0xd')](_0x30d4c5,_0x1bc47a)['then'](function(_0x21c1cd){logger[_0xb243('0xe')]('UserNotification,\x20%s,\x20%s',_0x1f1845,_0xb243('0xf'));logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x1f1845,_0xb243('0xf'),JSON['stringify'](_0x21c1cd));if(_0x21c1cd['error']){if(_0x21c1cd['error'][_0xb243('0x10')]===0x1f4){logger[_0xb243('0x11')](_0xb243('0x12'),_0x1f1845,_0x21c1cd[_0xb243('0x11')]['message']);return _0x524f28(_0x21c1cd[_0xb243('0x11')][_0xb243('0x13')]);}logger[_0xb243('0x11')](_0xb243('0x12'),_0x1f1845,_0x21c1cd['error'][_0xb243('0x13')]);return _0x7928ec(_0x21c1cd[_0xb243('0x11')][_0xb243('0x13')]);}else{logger[_0xb243('0xe')](_0xb243('0x12'),_0x1f1845,_0xb243('0xf'));_0x7928ec(_0x21c1cd[_0xb243('0x14')][_0xb243('0x13')]);}})[_0xb243('0x15')](function(_0x4f4f6f){logger[_0xb243('0x11')](_0xb243('0x12'),_0x1f1845,_0x4f4f6f);_0x524f28(_0x4f4f6f);});});} \ No newline at end of file +var _0x93e3=['info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./userNotification.socket','then'];(function(_0x5ad9e0,_0x327bae){var _0x22458c=function(_0x2a76ad){while(--_0x2a76ad){_0x5ad9e0['push'](_0x5ad9e0['shift']());}};_0x22458c(++_0x327bae);}(_0x93e3,0xb1));var _0x393e=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0x93e3[_0x459335];return _0x50f00b;};'use strict';var _=require('lodash');var util=require(_0x393e('0x0'));var moment=require(_0x393e('0x1'));var BPromise=require('bluebird');var rs=require(_0x393e('0x2'));var fs=require('fs');var Redis=require(_0x393e('0x3'));var db=require(_0x393e('0x4'))['db'];var utils=require(_0x393e('0x5'));var logger=require(_0x393e('0x6'))(_0x393e('0x7'));var config=require(_0x393e('0x8'));var jayson=require(_0x393e('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x393e('0xa')]=_[_0x393e('0xb')](config[_0x393e('0xa')],{'host':_0x393e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x393e('0xa')]));require(_0x393e('0xd'))['register'](socket);function respondWithRpcPromise(_0x1cda17,_0x363746,_0xc1d065){return new BPromise(function(_0x1ae1c4,_0x482a5c){return client['request'](_0x1cda17,_0xc1d065)[_0x393e('0xe')](function(_0x2bc387){logger[_0x393e('0xf')](_0x393e('0x10'),_0x363746,_0x393e('0x11'));logger[_0x393e('0x12')](_0x393e('0x13'),_0x363746,_0x393e('0x11'),JSON[_0x393e('0x14')](_0x2bc387));if(_0x2bc387[_0x393e('0x15')]){if(_0x2bc387[_0x393e('0x15')][_0x393e('0x16')]===0x1f4){logger['error'](_0x393e('0x10'),_0x363746,_0x2bc387[_0x393e('0x15')][_0x393e('0x17')]);return _0x482a5c(_0x2bc387[_0x393e('0x15')][_0x393e('0x17')]);}logger[_0x393e('0x15')](_0x393e('0x10'),_0x363746,_0x2bc387[_0x393e('0x15')][_0x393e('0x17')]);return _0x1ae1c4(_0x2bc387[_0x393e('0x15')][_0x393e('0x17')]);}else{logger[_0x393e('0xf')]('UserNotification,\x20%s,\x20%s',_0x363746,_0x393e('0x11'));_0x1ae1c4(_0x2bc387['result'][_0x393e('0x17')]);}})['catch'](function(_0x336874){logger[_0x393e('0x15')](_0x393e('0x10'),_0x363746,_0x336874);_0x482a5c(_0x336874);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 5a93d81..bdd26d0 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 _0x14dd=['userNotification:','./userNotification.events','save','remove','update','removeListener','length'];(function(_0x36113f,_0x46c8c){var _0x4c8bf7=function(_0x58213d){while(--_0x58213d){_0x36113f['push'](_0x36113f['shift']());}};_0x4c8bf7(++_0x46c8c);}(_0x14dd,0x1dd));var _0xd14d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14dd[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0xd14d('0x0'));var events=[_0xd14d('0x1'),_0xd14d('0x2'),_0xd14d('0x3')];function createListener(_0x25ffce,_0x5555e1){return function(_0x46ec05){_0x5555e1['emit'](_0x25ffce,_0x46ec05);};}function removeListener(_0x332d92,_0x4cdd5a){return function(){UserNotificationEvents[_0xd14d('0x4')](_0x332d92,_0x4cdd5a);};}exports['register']=function(_0x10cd8c){for(var _0x230169=0x0,_0x1d6ba3=events[_0xd14d('0x5')];_0x230169<_0x1d6ba3;_0x230169++){var _0x556580=events[_0x230169];var _0x59c490=createListener(_0xd14d('0x6')+_0x556580,_0x10cd8c);UserNotificationEvents['on'](_0x556580,_0x59c490);}}; \ No newline at end of file +var _0x6f47=['removeListener','register','length','save','remove','update','emit'];(function(_0x54fc27,_0x514efe){var _0x2f09b3=function(_0x44a789){while(--_0x44a789){_0x54fc27['push'](_0x54fc27['shift']());}};_0x2f09b3(++_0x514efe);}(_0x6f47,0x8f));var _0x76f4=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x6f47[_0x298ed3];return _0x5aad28;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x76f4('0x0'),_0x76f4('0x1'),_0x76f4('0x2')];function createListener(_0x12c732,_0x23a093){return function(_0x35520b){_0x23a093[_0x76f4('0x3')](_0x12c732,_0x35520b);};}function removeListener(_0x3cae48,_0x16bf10){return function(){UserNotificationEvents[_0x76f4('0x4')](_0x3cae48,_0x16bf10);};}exports[_0x76f4('0x5')]=function(_0x666699){for(var _0x1a9770=0x0,_0x500e28=events[_0x76f4('0x6')];_0x1a9770<_0x500e28;_0x1a9770++){var _0x1e9732=events[_0x1a9770];var _0x926f18=createListener('userNotification:'+_0x1e9732,_0x666699);UserNotificationEvents['on'](_0x1e9732,_0x926f18);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index c628012..4668e2f 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x56e655,_0x4f1641){var _0x218e9c=function(_0x395952){while(--_0x395952){_0x56e655['push'](_0x56e655['shift']());}};_0x218e9c(++_0x4f1641);}(_0xe706,0xa3));var _0x6e70=function(_0x1f5143,_0x5e31e6){_0x1f5143=_0x1f5143-0x0;var _0x383a38=_0xe706[_0x1f5143];return _0x383a38;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44ba19,_0x4f829d){var _0x56f6ee=function(_0xf692b8){while(--_0xf692b8){_0x44ba19['push'](_0x44ba19['shift']());}};_0x56f6ee(++_0x4f829d);}(_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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 6e864aa..a836cc4 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 _0x43b8=['sequelize','exports'];(function(_0x41dcab,_0x3cbe3e){var _0x592382=function(_0x86236e){while(--_0x86236e){_0x41dcab['push'](_0x41dcab['shift']());}};_0x592382(++_0x3cbe3e);}(_0x43b8,0x13c));var _0x843b=function(_0x1e660a,_0x5bb483){_0x1e660a=_0x1e660a-0x0;var _0x11507b=_0x43b8[_0x1e660a];return _0x11507b;};'use strict';var Sequelize=require(_0x843b('0x0'));module[_0x843b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xfcfc=['INTEGER','exports'];(function(_0x39f7f1,_0x125932){var _0x27be86=function(_0x2b493f){while(--_0x2b493f){_0x39f7f1['push'](_0x39f7f1['shift']());}};_0x27be86(++_0x125932);}(_0xfcfc,0xf9));var _0xcfcf=function(_0x3e1fd2,_0x3b4092){_0x3e1fd2=_0x3e1fd2-0x0;var _0xb2958=_0xfcfc[_0x3e1fd2];return _0xb2958;};'use strict';var Sequelize=require('sequelize');module[_0xcfcf('0x0')]={'penalty':{'type':Sequelize[_0xcfcf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 4533fd4..72c995c 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 _0x24dc=['moment','bluebird','request-promise','path','rimraf','exports','UserOpenchannelQueue','util','../../config/logger'];(function(_0x4be30e,_0x5f34ba){var _0x24fd1e=function(_0x2c1784){while(--_0x2c1784){_0x4be30e['push'](_0x4be30e['shift']());}};_0x24fd1e(++_0x5f34ba);}(_0x24dc,0x15d));var _0xc24d=function(_0x226d0e,_0x5682cc){_0x226d0e=_0x226d0e-0x0;var _0x14f1f8=_0x24dc[_0x226d0e];return _0x14f1f8;};'use strict';var _=require('lodash');var util=require(_0xc24d('0x0'));var logger=require(_0xc24d('0x1'))('api');var moment=require(_0xc24d('0x2'));var BPromise=require(_0xc24d('0x3'));var rp=require(_0xc24d('0x4'));var fs=require('fs');var path=require(_0xc24d('0x5'));var rimraf=require(_0xc24d('0x6'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xc24d('0x7')]=function(_0x25edf0,_0x176374){return _0x25edf0['define'](_0xc24d('0x8'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6f1=['./userOpenchannelQueue.attributes','exports','UserOpenchannelQueue','util','moment','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa6f1,0x141));var _0x1a6f=function(_0x1579be,_0x4f5834){_0x1579be=_0x1579be-0x0;var _0x4f4837=_0xa6f1[_0x1579be];return _0x4f4837;};'use strict';var _=require('lodash');var util=require(_0x1a6f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x1a6f('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1a6f('0x2'));var attributes=require(_0x1a6f('0x3'));module[_0x1a6f('0x4')]=function(_0x1baedb,_0x47f09b){return _0x1baedb['define'](_0x1a6f('0x5'),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 745b75a..e898ddb 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 _0x25cf=['error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','info','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2ea8f8,_0x434b24){var _0x2fe4d7=function(_0x64fe62){while(--_0x64fe62){_0x2ea8f8['push'](_0x2ea8f8['shift']());}};_0x2fe4d7(++_0x434b24);}(_0x25cf,0x117));var _0xf25c=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x25cf[_0x4bc4c8];return _0x3bb121;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var moment=require(_0xf25c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf25c('0x3'));var fs=require('fs');var Redis=require(_0xf25c('0x4'));var db=require(_0xf25c('0x5'))['db'];var utils=require(_0xf25c('0x6'));var logger=require(_0xf25c('0x7'))('rpc');var config=require(_0xf25c('0x8'));var jayson=require(_0xf25c('0x9'));var client=jayson[_0xf25c('0xa')][_0xf25c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49d43c,_0x27908f,_0x4f206b){return new BPromise(function(_0x4d3e3c,_0x3535d2){return client['request'](_0x49d43c,_0x4f206b)['then'](function(_0x3e9b46){logger[_0xf25c('0xc')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x27908f,_0xf25c('0xd'));logger['debug'](_0xf25c('0xe'),_0x27908f,_0xf25c('0xd'),JSON['stringify'](_0x3e9b46));if(_0x3e9b46[_0xf25c('0xf')]){if(_0x3e9b46['error'][_0xf25c('0x10')]===0x1f4){logger[_0xf25c('0xf')](_0xf25c('0x11'),_0x27908f,_0x3e9b46[_0xf25c('0xf')]['message']);return _0x3535d2(_0x3e9b46['error'][_0xf25c('0x12')]);}logger[_0xf25c('0xf')](_0xf25c('0x11'),_0x27908f,_0x3e9b46[_0xf25c('0xf')][_0xf25c('0x12')]);return _0x4d3e3c(_0x3e9b46[_0xf25c('0xf')][_0xf25c('0x12')]);}else{logger[_0xf25c('0xc')](_0xf25c('0x11'),_0x27908f,_0xf25c('0xd'));_0x4d3e3c(_0x3e9b46[_0xf25c('0x13')][_0xf25c('0x12')]);}})[_0xf25c('0x14')](function(_0x135a3c){logger[_0xf25c('0xf')](_0xf25c('0x11'),_0x27908f,_0x135a3c);_0x3535d2(_0x135a3c);});});} \ No newline at end of file +var _0x850d=['then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3fe92c,_0x15f7ef){var _0x2c83d8=function(_0x18b536){while(--_0x18b536){_0x3fe92c['push'](_0x3fe92c['shift']());}};_0x2c83d8(++_0x15f7ef);}(_0x850d,0xda));var _0xd850=function(_0x77a0c1,_0x400923){_0x77a0c1=_0x77a0c1-0x0;var _0x1db8b8=_0x850d[_0x77a0c1];return _0x1db8b8;};'use strict';var _=require('lodash');var util=require(_0xd850('0x0'));var moment=require(_0xd850('0x1'));var BPromise=require('bluebird');var rs=require(_0xd850('0x2'));var fs=require('fs');var Redis=require(_0xd850('0x3'));var db=require(_0xd850('0x4'))['db'];var utils=require(_0xd850('0x5'));var logger=require(_0xd850('0x6'))('rpc');var config=require(_0xd850('0x7'));var jayson=require(_0xd850('0x8'));var client=jayson[_0xd850('0x9')][_0xd850('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7c4aea,_0x26ab23,_0x5c06b3){return new BPromise(function(_0xefb31b,_0x18e768){return client[_0xd850('0xb')](_0x7c4aea,_0x5c06b3)[_0xd850('0xc')](function(_0x4693d1){logger[_0xd850('0xd')](_0xd850('0xe'),_0x26ab23,'request\x20sent');logger['debug'](_0xd850('0xf'),_0x26ab23,'request\x20sent',JSON[_0xd850('0x10')](_0x4693d1));if(_0x4693d1[_0xd850('0x11')]){if(_0x4693d1[_0xd850('0x11')][_0xd850('0x12')]===0x1f4){logger[_0xd850('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x26ab23,_0x4693d1[_0xd850('0x11')][_0xd850('0x13')]);return _0x18e768(_0x4693d1[_0xd850('0x11')][_0xd850('0x13')]);}logger[_0xd850('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x26ab23,_0x4693d1[_0xd850('0x11')][_0xd850('0x13')]);return _0xefb31b(_0x4693d1['error'][_0xd850('0x13')]);}else{logger['info'](_0xd850('0xe'),_0x26ab23,_0xd850('0x14'));_0xefb31b(_0x4693d1[_0xd850('0x15')][_0xd850('0x13')]);}})[_0xd850('0x16')](function(_0x5bee92){logger[_0xd850('0x11')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x26ab23,_0x5bee92);_0x18e768(_0x5bee92);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6d44298..332ff78 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 _0xc07a=['create','/:id/clone','clone','addSections','addResources','put','update','delete','removeSections','exports','multer','util','express','Router','fs-extra','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/sections','/:id/resources','post'];(function(_0x4f638d,_0x3b790f){var _0x1d74e1=function(_0x445fef){while(--_0x445fef){_0x4f638d['push'](_0x4f638d['shift']());}};_0x1d74e1(++_0x3b790f);}(_0xc07a,0x15c));var _0xac07=function(_0x3c2421,_0x5dcf45){_0x3c2421=_0x3c2421-0x0;var _0x1ae11a=_0xc07a[_0x3c2421];return _0x1ae11a;};'use strict';var multer=require(_0xac07('0x0'));var util=require(_0xac07('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xac07('0x2'));var router=express[_0xac07('0x3')]();var fs_extra=require(_0xac07('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac07('0x5'));var controller=require(_0xac07('0x6'));router[_0xac07('0x7')]('/',auth[_0xac07('0x8')](),controller[_0xac07('0x9')]);router[_0xac07('0x7')](_0xac07('0xa'),auth['isAuthenticated'](),controller[_0xac07('0xb')]);router[_0xac07('0x7')](_0xac07('0xc'),auth[_0xac07('0x8')](),controller['show']);router[_0xac07('0x7')](_0xac07('0xd'),auth['isAuthenticated'](),controller['getSections']);router[_0xac07('0x7')](_0xac07('0xe'),auth[_0xac07('0x8')](),controller['getResources']);router[_0xac07('0xf')]('/',auth[_0xac07('0x8')](),controller[_0xac07('0x10')]);router['post'](_0xac07('0x11'),auth[_0xac07('0x8')](),controller[_0xac07('0x12')]);router['post'](_0xac07('0xd'),auth['isAuthenticated'](),controller[_0xac07('0x13')]);router['post'](_0xac07('0xe'),auth[_0xac07('0x8')](),controller[_0xac07('0x14')]);router[_0xac07('0x15')](_0xac07('0xc'),auth[_0xac07('0x8')](),controller[_0xac07('0x16')]);router[_0xac07('0x17')]('/:id',auth[_0xac07('0x8')](),controller['destroy']);router[_0xac07('0x17')](_0xac07('0xd'),auth[_0xac07('0x8')](),controller[_0xac07('0x18')]);router[_0xac07('0x17')]('/:id/resources',auth[_0xac07('0x8')](),controller['removeResources']);module[_0xac07('0x19')]=router; \ No newline at end of file +var _0xd116=['/describe','describe','/:id','/:id/sections','getSections','/:id/resources','create','post','/:id/clone','clone','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index'];(function(_0x398402,_0x41f460){var _0x1fdbbd=function(_0x46277d){while(--_0x46277d){_0x398402['push'](_0x398402['shift']());}};_0x1fdbbd(++_0x41f460);}(_0xd116,0x6a));var _0x6d11=function(_0xda5cde,_0x270533){_0xda5cde=_0xda5cde-0x0;var _0x51e0ad=_0xd116[_0xda5cde];return _0x51e0ad;};'use strict';var multer=require(_0x6d11('0x0'));var util=require(_0x6d11('0x1'));var path=require(_0x6d11('0x2'));var timeout=require(_0x6d11('0x3'));var express=require(_0x6d11('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6d11('0x5'));var config=require('../../config/environment');var controller=require(_0x6d11('0x6'));router[_0x6d11('0x7')]('/',auth[_0x6d11('0x8')](),controller[_0x6d11('0x9')]);router[_0x6d11('0x7')](_0x6d11('0xa'),auth[_0x6d11('0x8')](),controller[_0x6d11('0xb')]);router['get'](_0x6d11('0xc'),auth[_0x6d11('0x8')](),controller['show']);router[_0x6d11('0x7')](_0x6d11('0xd'),auth['isAuthenticated'](),controller[_0x6d11('0xe')]);router['get'](_0x6d11('0xf'),auth[_0x6d11('0x8')](),controller['getResources']);router['post']('/',auth['isAuthenticated'](),controller[_0x6d11('0x10')]);router[_0x6d11('0x11')](_0x6d11('0x12'),auth['isAuthenticated'](),controller[_0x6d11('0x13')]);router[_0x6d11('0x11')](_0x6d11('0xd'),auth[_0x6d11('0x8')](),controller[_0x6d11('0x14')]);router['post']('/:id/resources',auth[_0x6d11('0x8')](),controller[_0x6d11('0x15')]);router[_0x6d11('0x16')](_0x6d11('0xc'),auth[_0x6d11('0x8')](),controller[_0x6d11('0x17')]);router[_0x6d11('0x18')](_0x6d11('0xc'),auth['isAuthenticated'](),controller[_0x6d11('0x19')]);router[_0x6d11('0x18')]('/:id/sections',auth['isAuthenticated'](),controller[_0x6d11('0x1a')]);router[_0x6d11('0x18')](_0x6d11('0xf'),auth['isAuthenticated'](),controller[_0x6d11('0x1b')]);module[_0x6d11('0x1c')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index b52a9ae..137087c 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 _0x9528=['crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING','name'];(function(_0x5a57a1,_0x4156a8){var _0x50b785=function(_0x5278bc){while(--_0x5278bc){_0x5a57a1['push'](_0x5a57a1['shift']());}};_0x50b785(++_0x4156a8);}(_0x9528,0x75));var _0x8952=function(_0x1eb4c1,_0x5d38d3){_0x1eb4c1=_0x1eb4c1-0x0;var _0x201233=_0x9528[_0x1eb4c1];return _0x201233;};'use strict';var Sequelize=require('sequelize');module[_0x8952('0x0')]={'name':{'type':Sequelize[_0x8952('0x1')],'allowNull':![],'unique':_0x8952('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x56c1ab){this['setDataValue'](_0x8952('0x3'),_0x56c1ab?_0x56c1ab[_0x8952('0x4')](''):[]);},'get':function(){return this[_0x8952('0x5')](_0x8952('0x3'))?this['getDataValue']('crudPermissions')[_0x8952('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8952('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8952('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8952('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8952('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8952('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8952('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xde4d=['crudPermissions','getDataValue','split','BOOLEAN','STRING','name','setDataValue'];(function(_0x4331c8,_0x3b04a0){var _0x25c2df=function(_0x49f77d){while(--_0x49f77d){_0x4331c8['push'](_0x4331c8['shift']());}};_0x25c2df(++_0x3b04a0);}(_0xde4d,0xa5));var _0xdde4=function(_0xe6514d,_0x5dcb53){_0xe6514d=_0xe6514d-0x0;var _0x18b539=_0xde4d[_0xe6514d];return _0x18b539;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdde4('0x0')],'allowNull':![],'unique':_0xdde4('0x1')},'crudPermissions':{'type':Sequelize[_0xdde4('0x0')],'set':function(_0x176f82){this[_0xdde4('0x2')](_0xdde4('0x3'),_0x176f82?_0x176f82['join'](''):[]);},'get':function(){return this[_0xdde4('0x4')](_0xdde4('0x3'))?this[_0xdde4('0x4')](_0xdde4('0x3'))[_0xdde4('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xdde4('0x0')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xdde4('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xdde4('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xdde4('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xdde4('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdde4('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdde4('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 2c8043c..111d1cb 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 _0x6515=['push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','findOne','Dashboard','forEach','Plugin','resourceId','addResources','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','catch','show','UserProfile','filters','find','create','body','clone','createdAt','updatedAt','crudPermissions','sequelize','get','UserProfileSection','findAll','params','each','autoAssociation','UserProfileResource','omit','sectionId','userProfileId','Resources','update','describe','addSections','transaction'];(function(_0x39dc7b,_0x397300){var _0x414a2f=function(_0x1e7445){while(--_0x1e7445){_0x39dc7b['push'](_0x39dc7b['shift']());}};_0x414a2f(++_0x397300);}(_0x6515,0x16f));var _0x5651=function(_0x9735c9,_0x2df051){_0x9735c9=_0x9735c9-0x0;var _0x3ce4d0=_0x6515[_0x9735c9];return _0x3ce4d0;};'use strict';var emlformat=require(_0x5651('0x0'));var rimraf=require(_0x5651('0x1'));var zipdir=require(_0x5651('0x2'));var jsonpatch=require(_0x5651('0x3'));var rp=require('request-promise');var moment=require(_0x5651('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5651('0x5'));var util=require('util');var path=require(_0x5651('0x6'));var sox=require(_0x5651('0x7'));var csv=require(_0x5651('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5651('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5651('0xa'));var jsforce=require(_0x5651('0xb'));var deskjs=require(_0x5651('0xc'));var toCsv=require(_0x5651('0x8'));var querystring=require('querystring');var Papa=require(_0x5651('0xd'));var Redis=require(_0x5651('0xe'));var authService=require(_0x5651('0xf'));var qs=require(_0x5651('0x10'));var as=require(_0x5651('0x11'));var hardwareService=require(_0x5651('0x12'));var logger=require('../../config/logger')(_0x5651('0x13'));var utils=require('../../config/utils');var config=require(_0x5651('0x14'));var licenseUtil=require(_0x5651('0x15'));var db=require('../../mysqldb')['db'];config[_0x5651('0x16')]=_[_0x5651('0x17')](config[_0x5651('0x16')],{'host':_0x5651('0x18'),'port':0x18eb});var socket=require(_0x5651('0x19'))(new Redis(config['redis']));require(_0x5651('0x1a'))[_0x5651('0x1b')](socket);function respondWithStatusCode(_0x5894f5,_0x3f1519){_0x3f1519=_0x3f1519||0xcc;return function(_0x3cad32){if(_0x3cad32){return _0x5894f5[_0x5651('0x1c')](_0x3f1519);}return _0x5894f5[_0x5651('0x1d')](_0x3f1519)[_0x5651('0x1e')]();};}function respondWithResult(_0x46f44e,_0x16ec10){_0x16ec10=_0x16ec10||0xc8;return function(_0xd77176){if(_0xd77176){return _0x46f44e[_0x5651('0x1d')](_0x16ec10)[_0x5651('0x1f')](_0xd77176);}};}function respondWithFilteredResult(_0x61120a,_0x5c775a){return function(_0x181201){if(_0x181201){var _0xee651a=typeof _0x5c775a[_0x5651('0x20')]===_0x5651('0x21')&&typeof _0x5c775a['limit']===_0x5651('0x21');var _0x3eff65=_0x181201[_0x5651('0x22')];var _0x5aae9a=_0xee651a?0x0:_0x5c775a['offset'];var _0xc3f1c5=_0xee651a?_0x181201[_0x5651('0x22')]:_0x5c775a[_0x5651('0x20')]+_0x5c775a['limit'];var _0x77485d;if(_0xc3f1c5>=_0x3eff65){_0xc3f1c5=_0x3eff65;_0x77485d=0xc8;}else{_0x77485d=0xce;}_0x61120a[_0x5651('0x1d')](_0x77485d);return _0x61120a[_0x5651('0x23')](_0x5651('0x24'),_0x5aae9a+'-'+_0xc3f1c5+'/'+_0x3eff65)[_0x5651('0x1f')](_0x181201);}return null;};}function patchUpdates(_0x4a7c25){return function(_0x458580){try{jsonpatch[_0x5651('0x25')](_0x458580,_0x4a7c25,!![]);}catch(_0x4df318){return BPromise[_0x5651('0x26')](_0x4df318);}return _0x458580[_0x5651('0x27')]();};}function saveUpdates(_0xedd757,_0x1bc9b6){return function(_0xac2f9b){if(_0xac2f9b){return _0xac2f9b['update'](_0xedd757)['then'](function(_0x4f1010){return _0x4f1010;});}return null;};}function removeEntity(_0x3d5d5b,_0x35ee48){return function(_0x1394df){if(_0x1394df){return _0x1394df[_0x5651('0x28')]()[_0x5651('0x29')](function(){_0x3d5d5b[_0x5651('0x1d')](0xcc)[_0x5651('0x1e')]();});}};}function handleEntityNotFound(_0x20ca3a,_0x17916b){return function(_0x28bf2f){if(!_0x28bf2f){_0x20ca3a[_0x5651('0x1c')](0x194);}return _0x28bf2f;};}function handleError(_0x26f384,_0x5c7f08){_0x5c7f08=_0x5c7f08||0x1f4;return function(_0x120b68){logger[_0x5651('0x2a')](_0x120b68['stack']);if(_0x120b68[_0x5651('0x2b')]){delete _0x120b68['name'];}_0x26f384[_0x5651('0x1d')](_0x5c7f08)[_0x5651('0x2c')](_0x120b68);};}exports[_0x5651('0x2d')]=function(_0x347226,_0x4b7056){var _0x195ee2={},_0xdc03d2={},_0x4cd252={'count':0x0,'rows':[]};var _0x4783f9=_[_0x5651('0x2e')](db['UserProfile'][_0x5651('0x2f')],function(_0x6eba8e){return{'name':_0x6eba8e[_0x5651('0x30')],'type':_0x6eba8e[_0x5651('0x31')][_0x5651('0x32')]};});_0xdc03d2[_0x5651('0x33')]=_[_0x5651('0x2e')](_0x4783f9,_0x5651('0x2b'));_0xdc03d2[_0x5651('0x34')]=_[_0x5651('0x35')](_0x347226[_0x5651('0x34')]);_0xdc03d2['filters']=_[_0x5651('0x36')](_0xdc03d2[_0x5651('0x33')],_0xdc03d2[_0x5651('0x34')]);_0x195ee2['attributes']=_[_0x5651('0x36')](_0xdc03d2[_0x5651('0x33')],qs[_0x5651('0x37')](_0x347226['query']['fields']));_0x195ee2[_0x5651('0x38')]=_0x195ee2[_0x5651('0x38')][_0x5651('0x39')]?_0x195ee2[_0x5651('0x38')]:_0xdc03d2[_0x5651('0x33')];if(!_0x347226[_0x5651('0x34')][_0x5651('0x3a')](_0x5651('0x3b'))){_0x195ee2[_0x5651('0x3c')]=qs['limit'](_0x347226[_0x5651('0x34')][_0x5651('0x3c')]);_0x195ee2[_0x5651('0x20')]=qs[_0x5651('0x20')](_0x347226['query']['offset']);}_0x195ee2[_0x5651('0x3d')]=qs[_0x5651('0x3e')](_0x347226[_0x5651('0x34')][_0x5651('0x3e')]);_0x195ee2[_0x5651('0x3f')]=qs['filters'](_['pick'](_0x347226['query'],_0xdc03d2['filters']),_0x4783f9);if(_0x347226[_0x5651('0x34')][_0x5651('0x40')]){_0x195ee2[_0x5651('0x3f')]=_[_0x5651('0x41')](_0x195ee2['where'],{'$or':_[_0x5651('0x2e')](_0x4783f9,function(_0x4cc02a){if(_0x4cc02a['type']!==_0x5651('0x42')){var _0x4e623f={};_0x4e623f[_0x4cc02a[_0x5651('0x2b')]]={'$like':'%'+_0x347226['query']['filter']+'%'};return _0x4e623f;}})});}_0x195ee2=_['merge']({},_0x195ee2,_0x347226[_0x5651('0x43')]);var _0xbf3daf={'where':_0x195ee2[_0x5651('0x3f')]};return db['UserProfile'][_0x5651('0x22')](_0xbf3daf)[_0x5651('0x29')](function(_0x11168a){_0x4cd252[_0x5651('0x22')]=_0x11168a;if(_0x347226[_0x5651('0x34')][_0x5651('0x44')]){_0x195ee2[_0x5651('0x45')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x195ee2);})[_0x5651('0x29')](function(_0x29fb1c){_0x4cd252['rows']=_0x29fb1c;return _0x4cd252;})[_0x5651('0x29')](respondWithFilteredResult(_0x4b7056,_0x195ee2))[_0x5651('0x46')](handleError(_0x4b7056,null));};exports[_0x5651('0x47')]=function(_0x1adcbd,_0x40fa86){var _0x7d5d68={'raw':![],'where':{'id':_0x1adcbd['params']['id']}},_0xa406a0={};_0xa406a0[_0x5651('0x33')]=_[_0x5651('0x35')](db[_0x5651('0x48')][_0x5651('0x2f')]);_0xa406a0[_0x5651('0x34')]=_[_0x5651('0x35')](_0x1adcbd[_0x5651('0x34')]);_0xa406a0[_0x5651('0x49')]=_['intersection'](_0xa406a0['model'],_0xa406a0['query']);_0x7d5d68[_0x5651('0x38')]=_[_0x5651('0x36')](_0xa406a0[_0x5651('0x33')],qs[_0x5651('0x37')](_0x1adcbd[_0x5651('0x34')][_0x5651('0x37')]));_0x7d5d68['attributes']=_0x7d5d68[_0x5651('0x38')][_0x5651('0x39')]?_0x7d5d68[_0x5651('0x38')]:_0xa406a0[_0x5651('0x33')];if(_0x1adcbd[_0x5651('0x34')][_0x5651('0x44')]){_0x7d5d68['include']=[{'all':!![]}];}_0x7d5d68=_[_0x5651('0x41')]({},_0x7d5d68,_0x1adcbd['options']);return db[_0x5651('0x48')][_0x5651('0x4a')](_0x7d5d68)[_0x5651('0x29')](handleEntityNotFound(_0x40fa86,null))[_0x5651('0x29')](respondWithResult(_0x40fa86,null))['catch'](handleError(_0x40fa86,null));};exports[_0x5651('0x4b')]=function(_0x1bf57b,_0x933ea3){return db[_0x5651('0x48')]['create'](_0x1bf57b[_0x5651('0x4c')],{})[_0x5651('0x29')](respondWithResult(_0x933ea3,0xc9))['catch'](handleError(_0x933ea3,null));};exports[_0x5651('0x4d')]=function(_0x150508,_0x150d49){var _0x360f19={'where':{'id':_0x150508['params']['id']}},_0x4b9471={};_0x4b9471[_0x5651('0x33')]=_[_0x5651('0x35')](db['UserProfile'][_0x5651('0x2f')]);_0x360f19[_0x5651('0x38')]=_[_0x5651('0x36')](_0x4b9471[_0x5651('0x33')],qs[_0x5651('0x37')](_0x150508[_0x5651('0x34')]['fields']));_0x360f19[_0x5651('0x38')]=_0x360f19['attributes']['length']?_0x360f19[_0x5651('0x38')]:_0x4b9471[_0x5651('0x33')];if(_0x150508['query']['includeAll']){_0x360f19[_0x5651('0x45')]=[{'all':!![]}];}_0x360f19=_['merge']({},_0x360f19,_0x150508['options']);return db['UserProfile'][_0x5651('0x4a')](_0x360f19)[_0x5651('0x29')](handleEntityNotFound(_0x150d49,null))[_0x5651('0x29')](function(_0x1feed6){if(_0x1feed6){var _0x2275f6=_0x1feed6['get']({'plain':!![]});_0x2275f6=qs['omit'](_0x2275f6,['id',_0x5651('0x4e'),_0x5651('0x4f'),_0x5651('0x50')]);_0x150508[_0x5651('0x4c')]=_['omit'](_0x150508['body'],['id',_0x5651('0x4e'),_0x5651('0x4f')]);return db[_0x5651('0x51')]['transaction'](function(_0x2f616b){return db[_0x5651('0x48')][_0x5651('0x4b')](_[_0x5651('0x41')](_0x2275f6,_0x150508[_0x5651('0x4c')]),{'include':_0x150508[_0x5651('0x34')][_0x5651('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x2f616b})['then'](function(_0x5b1b10){var _0x3d2732=_0x5b1b10[_0x5651('0x52')]({'plain':!![]});return db[_0x5651('0x53')][_0x5651('0x54')]({'where':{'userProfileId':_0x150508[_0x5651('0x55')]['id']},'raw':!![]})[_0x5651('0x29')](function(_0x18c2ba){if(_0x18c2ba){return BPromise[_0x5651('0x56')](_0x18c2ba,function(_0x13ed72){return new BPromise(function(_0x4d6d56,_0x59d2b0){if(_0x13ed72[_0x5651('0x57')]===null||_0x13ed72[_0x5651('0x57')]===0x1)_0x4d6d56(null);return db[_0x5651('0x58')]['findAll']({'where':{'sectionId':_0x13ed72['id']},'raw':!![]})[_0x5651('0x29')](function(_0x4f1883){var _0x45816a=_[_0x5651('0x2e')](_0x4f1883,function(_0x1f0dee){return qs[_0x5651('0x59')](_0x1f0dee,['id',_0x5651('0x4e'),_0x5651('0x4f'),_0x5651('0x5a')]);});_0x4d6d56(_0x45816a);})[_0x5651('0x46')](function(_0x3c9d56){_0x59d2b0(_0x3c9d56);});})[_0x5651('0x29')](function(_0x488b3d){var _0x3ce1ae=qs[_0x5651('0x59')](_0x13ed72,['id',_0x5651('0x4e'),_0x5651('0x4f')]);_0x3ce1ae[_0x5651('0x5b')]=_0x3d2732['id'];if(_0x488b3d)_0x3ce1ae[_0x5651('0x5c')]=_0x488b3d;return _0x3ce1ae;})[_0x5651('0x29')](function(_0x3066d1){return db[_0x5651('0x53')][_0x5651('0x4b')](_0x3066d1,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x2f616b});});})[_0x5651('0x29')](function(){return _0x3d2732;});}});});});}})[_0x5651('0x29')](respondWithResult(_0x150d49,0xc9))[_0x5651('0x46')](handleError(_0x150d49,null));};exports[_0x5651('0x5d')]=function(_0x8cf6d3,_0x385ad8){if(_0x8cf6d3[_0x5651('0x4c')]['id']){delete _0x8cf6d3[_0x5651('0x4c')]['id'];}return db[_0x5651('0x48')]['find']({'where':{'id':_0x8cf6d3[_0x5651('0x55')]['id']}})[_0x5651('0x29')](handleEntityNotFound(_0x385ad8,null))['then'](saveUpdates(_0x8cf6d3['body'],null))[_0x5651('0x29')](respondWithResult(_0x385ad8,null))[_0x5651('0x46')](handleError(_0x385ad8,null));};exports[_0x5651('0x28')]=function(_0x16c436,_0x32053a){return db['UserProfile'][_0x5651('0x4a')]({'where':{'id':_0x16c436[_0x5651('0x55')]['id']}})[_0x5651('0x29')](handleEntityNotFound(_0x32053a,null))[_0x5651('0x29')](removeEntity(_0x32053a,null))['catch'](handleError(_0x32053a,null));};exports['describe']=function(_0x5580be,_0x4a6e24){return db[_0x5651('0x48')][_0x5651('0x5e')]()[_0x5651('0x29')](respondWithResult(_0x4a6e24,null))['catch'](handleError(_0x4a6e24,null));};exports[_0x5651('0x5f')]=function(_0x4dce81,_0x58e9f9){var _0xaf90bb=_0x4dce81[_0x5651('0x4c')];return db[_0x5651('0x48')][_0x5651('0x4a')]({'where':{'id':_0x4dce81[_0x5651('0x55')]['id']}})[_0x5651('0x29')](handleEntityNotFound(_0x58e9f9,null))['then'](function(_0x2cd668){if(_0x2cd668){return db['sequelize'][_0x5651('0x60')](function(_0xe0df06){return db[_0x5651('0x53')][_0x5651('0x28')]({'where':{'userProfileId':_0x4dce81[_0x5651('0x55')]['id'],'sectionId':_[_0x5651('0x2e')](_0xaf90bb,function(_0x570a3a){return _0x570a3a['sectionId'];})},'transaction':_0xe0df06})['then'](function(){var _0x5587a5=_[_0x5651('0x2e')](_0xaf90bb,function(_0x11e635){_0x11e635[_0x5651('0x5b')]=_0x4dce81[_0x5651('0x55')]['id'];return _0x11e635;});var _0x443542=[];return BPromise[_0x5651('0x56')](_0x5587a5,function(_0x74014a){return db['UserProfileSection'][_0x5651('0x4b')](_0x74014a,{'include':[{'model':db[_0x5651('0x58')],'as':_0x5651('0x5c')}],'raw':!![],'transaction':_0xe0df06})['then'](function(_0x3126c4){_0x443542[_0x5651('0x61')](_0x3126c4[_0x5651('0x52')]({'plain':!![]}));});})[_0x5651('0x29')](function(){return _0x443542;});});});}})[_0x5651('0x29')](function(_0x20ecc6){return _0x20ecc6;})[_0x5651('0x29')](respondWithResult(_0x58e9f9,null))['catch'](handleError(_0x58e9f9,null));};exports[_0x5651('0x62')]=function(_0x4f2d68,_0x42aa0c){var _0x1b204e;return db[_0x5651('0x48')][_0x5651('0x4a')]({'where':{'id':_0x4f2d68[_0x5651('0x55')]['id']},'attributes':['id',_0x5651('0x2b')]})['then'](handleEntityNotFound(_0x42aa0c,null))['then'](function(_0x58349b){if(_0x58349b){_0x1b204e=_0x58349b;return db[_0x5651('0x53')][_0x5651('0x28')]({'where':{'userProfileId':_0x4f2d68[_0x5651('0x55')]['id'],'sectionId':_0x4f2d68['query'][_0x5651('0x63')]}});}})[_0x5651('0x29')](function(){return _0x1b204e;})['then'](respondWithStatusCode(_0x42aa0c,null))[_0x5651('0x46')](handleError(_0x42aa0c,null));};exports[_0x5651('0x64')]=function(_0x4d694f,_0xd3e2df){var _0x548bf3=[];var _0x4a5029=[];return db[_0x5651('0x53')][_0x5651('0x54')]({'where':{'userProfileId':_0x4d694f[_0x5651('0x55')]['id']},'raw':!![]})['then'](function(_0x3edb6f){_0x548bf3=_['filter'](_0x3edb6f,function(_0x124daf){return _0x124daf['enabled']===0x1||_[_0x5651('0x65')]([0x3eb,0x709],_0x124daf['sectionId']);});if(!_[_0x5651('0x66')](_0x548bf3)){return _[_0x5651('0x2e')](_0x548bf3,function(_0x51b703){return _0x51b703[_0x5651('0x5a')];});}else{return;}})[_0x5651('0x29')](function(_0x23230e){if(_0x23230e)_0x4a5029=_0x23230e;if(_[_0x5651('0x65')](_0x4a5029,0x64)){var _0x22be66=_['find'](_0x548bf3,{'sectionId':0x64});return hasDefaultDashboard(_0x22be66)[_0x5651('0x29')](function(_0x51e5d3){return _['map'](_0x548bf3,function(_0x54b4a7){if(_0x54b4a7[_0x5651('0x5a')]===0x64){_0x54b4a7[_0x5651('0x67')]=_0x51e5d3;}return _0x54b4a7;});});}else{return;}})[_0x5651('0x29')](function(_0x27c4c5){if(_0x27c4c5)_0x548bf3=_0x27c4c5;if(_[_0x5651('0x65')](_0x4a5029,0x3eb)){var _0x7dff32=_['find'](_0x548bf3,{'sectionId':0x3eb});return getCustomDashboards(_0x7dff32)['then'](function(_0x4bb8bb){return _[_0x5651('0x2e')](_0x548bf3,function(_0x38a531){if(_0x7dff32[_0x5651('0x68')]){if(_0x38a531['sectionId']===0x3eb){_0x38a531['subsections']=_0x4bb8bb;}}else{if(_0x38a531[_0x5651('0x5a')]===0x64){if(!_0x38a531['subsections']){_0x38a531[_0x5651('0x67')]=[];}_0x38a531['subsections']=_0x38a531[_0x5651('0x67')]['concat'](_0x4bb8bb);}}return _0x38a531;});});}else{return;}})['then'](function(_0x348067){if(_0x348067)_0x548bf3=_0x348067;if(_['includes'](_0x4a5029,0x709)){var _0x4df87d=_['find'](_0x548bf3,{'sectionId':0x709});return getPlugins(_0x4df87d)[_0x5651('0x29')](function(_0x528fc9){if(_0x4df87d['enabled']){return _['map'](_0x548bf3,function(_0x11b5ae){if(_0x11b5ae[_0x5651('0x5a')]===0x709){_0x11b5ae[_0x5651('0x67')]=_0x528fc9;}return _0x11b5ae;});}else{var _0x51a41f={'sectionId':0x76c,'enabled':0x1,'subsections':_0x528fc9};var _0xe4cd71=_[_0x5651('0x2e')](_0x548bf3);_0xe4cd71[_0x5651('0x61')](_0x51a41f);return _0xe4cd71;}});}else{return;}})[_0x5651('0x29')](function(_0x30e0c5){if(_0x30e0c5)_0x548bf3=_0x30e0c5;return _['filter'](_0x548bf3,[_0x5651('0x68'),0x1]);})[_0x5651('0x29')](respondWithResult(_0xd3e2df,null))[_0x5651('0x46')](handleError(_0xd3e2df,null));};function hasDefaultDashboard(_0x4c90f){var _0x5c0086=[0x65];return new BPromise(function(_0x195b8c,_0x58dd8d){try{if(_0x4c90f[_0x5651('0x57')]){_0x195b8c(_0x5c0086);}else{return db[_0x5651('0x58')][_0x5651('0x69')]({'where':{'sectionId':_0x4c90f['id']},'raw':!![]})['then'](function(_0x5c3496){_0x5c3496?_0x195b8c(_0x5c0086):_0x195b8c();});}}catch(_0x703256){_0x58dd8d(_0x703256);}});}function getCustomDashboards(_0x36a1bb){var _0x52320e=[];return new BPromise(function(_0x46c988,_0x1c6ad2){try{if(_0x36a1bb['autoAssociation']){return db[_0x5651('0x6a')][_0x5651('0x54')]({'raw':!![]})[_0x5651('0x29')](function(_0x41d4ea){_0x41d4ea[_0x5651('0x6b')](function(_0xb9af8b){_0x52320e[_0x5651('0x61')](_0xb9af8b['id']+0x1869f);});_0x46c988(_0x52320e);});}else{return db['UserProfileResource'][_0x5651('0x54')]({'where':{'sectionId':_0x36a1bb['id']},'raw':!![]})['then'](function(_0x5cb10b){_0x5cb10b['forEach'](function(_0x5710a6){_0x52320e[_0x5651('0x61')](_0x5710a6['resourceId']+0x1869f);});_0x46c988(_0x52320e);});}}catch(_0x2bab0f){_0x1c6ad2(_0x2bab0f);}});}function getPlugins(_0x541595){var _0x2a0048=[];return new BPromise(function(_0x3f76d2,_0x3b470d){try{if(_0x541595['autoAssociation']){return db[_0x5651('0x6c')]['findAll']({'raw':!![]})[_0x5651('0x29')](function(_0x5a9188){_0x5a9188[_0x5651('0x6b')](function(_0x2261da){_0x2a0048['push'](_0x2261da['id']+0x15b38);});_0x3f76d2(_0x2a0048);});}else{return db[_0x5651('0x58')][_0x5651('0x54')]({'where':{'sectionId':_0x541595['id']},'raw':!![]})[_0x5651('0x29')](function(_0x3fb89e){_0x3fb89e[_0x5651('0x6b')](function(_0x5b8abb){_0x2a0048[_0x5651('0x61')](_0x5b8abb[_0x5651('0x6d')]+0x15b38);});_0x3f76d2(_0x2a0048);});}}catch(_0x4ab34d){_0x3b470d(_0x4ab34d);}});}exports[_0x5651('0x6e')]=function(_0x3311b6,_0x1cca90){return db['UserProfile'][_0x5651('0x4a')]({'where':{'id':_0x3311b6[_0x5651('0x55')]['id']}})[_0x5651('0x29')](handleEntityNotFound(_0x1cca90,null))[_0x5651('0x29')](function(_0x1f525d){if(_0x1f525d){return db['sequelize'][_0x5651('0x60')](function(_0x51782d){return db[_0x5651('0x53')][_0x5651('0x54')]({'where':{'userProfileId':_0x3311b6[_0x5651('0x55')]['id']},'attributes':['id'],'raw':!![]})[_0x5651('0x29')](function(_0x5374df){if(_0x5374df){return db[_0x5651('0x53')]['destroy']({'where':{'userProfileId':_0x3311b6[_0x5651('0x55')]['id'],'id':_[_0x5651('0x2e')](_0x5374df,function(_0x4d3eb4){return _0x4d3eb4['id'];})},'transaction':_0x51782d});}})['then'](function(_0x5d0120){var _0x12c8b5=_['map'](_0x3311b6[_0x5651('0x4c')],function(_0x3e1bb8){_0x3e1bb8[_0x5651('0x5b')]=_0x3311b6['params']['id'];return _0x3e1bb8;});return db[_0x5651('0x53')][_0x5651('0x6f')](_0x12c8b5,{'raw':!![],'transaction':_0x51782d});})[_0x5651('0x29')](function(_0x79eb85){var _0x3bde46=_[_0x5651('0x40')](_[_0x5651('0x2e')](_0x79eb85,function(_0x5066c4){return _0x5066c4[_0x5651('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3bde46){return db[_0x5651('0x53')]['findAll']({'where':{'userProfileId':_0x3311b6[_0x5651('0x55')]['id'],'sectionId':_['map'](_0x3bde46,function(_0x3eff31){return _0x3eff31[_0x5651('0x5a')];})},'attributes':['id',_0x5651('0x5a')],'raw':!![]})[_0x5651('0x29')](function(_0x24d087){var _0x2d622b=_[_0x5651('0x2e')](_0x3311b6[_0x5651('0x4c')],function(_0x57ce30){_0x57ce30[_0x5651('0x5b')]=_0x3311b6['params']['id'];return _0x57ce30;});return db[_0x5651('0x58')][_0x5651('0x6f')](_0x2d622b,{'raw':!![],'transaction':_0x51782d});});}})['catch'](handleError(_0x1cca90,null));});}})[_0x5651('0x29')](function(_0x409fd1){var _0x403290=_[_0x5651('0x2e')](_0x409fd1,function(_0x1b713d){return _0x1b713d[_0x5651('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x1cca90,null))[_0x5651('0x46')](handleError(_0x1cca90,null));};exports[_0x5651('0x70')]=function(_0x40fd3e,_0x3fb4b0,_0x5c90f6){return db[_0x5651('0x48')][_0x5651('0x4a')]({'where':{'id':_0x40fd3e[_0x5651('0x55')]['id']}})[_0x5651('0x29')](handleEntityNotFound(_0x3fb4b0,null))[_0x5651('0x29')](function(_0x8edc04){if(_0x8edc04){return _0x8edc04[_0x5651('0x70')](_0x40fd3e[_0x5651('0x34')][_0x5651('0x63')]);}})[_0x5651('0x29')](respondWithStatusCode(_0x3fb4b0,null))[_0x5651('0x46')](handleError(_0x3fb4b0,null));};exports[_0x5651('0x71')]=function(_0x166dd6,_0x1f995a){var _0x51a5d6={};if(!_0x166dd6[_0x5651('0x34')][_0x5651('0x72')])throw new Error('Missing\x20section\x20parameter');if(!_0x166dd6[_0x5651('0x34')][_0x5651('0x3a')](_0x5651('0x3b'))){_0x51a5d6[_0x5651('0x3c')]=qs[_0x5651('0x3c')](_0x166dd6[_0x5651('0x34')][_0x5651('0x3c')]);_0x51a5d6['offset']=qs[_0x5651('0x20')](_0x166dd6[_0x5651('0x34')][_0x5651('0x20')]);}return db[_0x5651('0x48')][_0x5651('0x4a')]({'where':{'id':_0x166dd6['params']['id']}})[_0x5651('0x29')](function(_0x3e2d38){if(!_0x3e2d38)throw new Error(_0x5651('0x73')+_0x166dd6[_0x5651('0x55')]['id']);return db[_0x5651('0x48')][_0x5651('0x71')](_0x166dd6);})['then'](respondWithFilteredResult(_0x1f995a,_0x51a5d6))[_0x5651('0x46')](handleError(_0x1f995a,null));}; \ No newline at end of file +var _0xbefe=['crudPermissions','omit','sequelize','transaction','get','UserProfileSection','each','UserProfileResource','sectionId','userProfileId','Resources','find','describe','push','ids','getSections','isEmpty','includes','subsections','enabled','autoAssociation','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','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','redis','defaults','socket.io-emitter','./userProfile.socket','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','UserProfile','rawAttributes','fieldName','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','options','create','body','clone','createdAt','updatedAt'];(function(_0x460775,_0x465a77){var _0x4f1f91=function(_0x3fe808){while(--_0x3fe808){_0x460775['push'](_0x460775['shift']());}};_0x4f1f91(++_0x465a77);}(_0xbefe,0x91));var _0xebef=function(_0x35fa33,_0x5cee15){_0x35fa33=_0x35fa33-0x0;var _0x39de35=_0xbefe[_0x35fa33];return _0x39de35;};'use strict';var emlformat=require(_0xebef('0x0'));var rimraf=require(_0xebef('0x1'));var zipdir=require(_0xebef('0x2'));var jsonpatch=require(_0xebef('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xebef('0x4'));var util=require(_0xebef('0x5'));var path=require(_0xebef('0x6'));var sox=require('sox');var csv=require(_0xebef('0x7'));var ejs=require(_0xebef('0x8'));var fs=require('fs');var fs_extra=require(_0xebef('0x9'));var _=require(_0xebef('0xa'));var squel=require(_0xebef('0xb'));var crypto=require(_0xebef('0xc'));var jsforce=require(_0xebef('0xd'));var deskjs=require(_0xebef('0xe'));var toCsv=require(_0xebef('0x7'));var querystring=require(_0xebef('0xf'));var Papa=require(_0xebef('0x10'));var Redis=require('ioredis');var authService=require(_0xebef('0x11'));var qs=require(_0xebef('0x12'));var as=require(_0xebef('0x13'));var hardwareService=require(_0xebef('0x14'));var logger=require(_0xebef('0x15'))(_0xebef('0x16'));var utils=require(_0xebef('0x17'));var config=require(_0xebef('0x18'));var licenseUtil=require(_0xebef('0x19'));var db=require('../../mysqldb')['db'];config[_0xebef('0x1a')]=_[_0xebef('0x1b')](config[_0xebef('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xebef('0x1c'))(new Redis(config[_0xebef('0x1a')]));require(_0xebef('0x1d'))['register'](socket);function respondWithStatusCode(_0x56c40b,_0x12138b){_0x12138b=_0x12138b||0xcc;return function(_0x231eed){if(_0x231eed){return _0x56c40b[_0xebef('0x1e')](_0x12138b);}return _0x56c40b[_0xebef('0x1f')](_0x12138b)[_0xebef('0x20')]();};}function respondWithResult(_0x386514,_0x421795){_0x421795=_0x421795||0xc8;return function(_0x444798){if(_0x444798){return _0x386514['status'](_0x421795)[_0xebef('0x21')](_0x444798);}};}function respondWithFilteredResult(_0x1595cb,_0x5adee2){return function(_0x509bde){if(_0x509bde){var _0x443dab=typeof _0x5adee2['offset']===_0xebef('0x22')&&typeof _0x5adee2['limit']==='undefined';var _0x155f9b=_0x509bde[_0xebef('0x23')];var _0x1253dd=_0x443dab?0x0:_0x5adee2[_0xebef('0x24')];var _0x2da1be=_0x443dab?_0x509bde['count']:_0x5adee2[_0xebef('0x24')]+_0x5adee2[_0xebef('0x25')];var _0x45bd94;if(_0x2da1be>=_0x155f9b){_0x2da1be=_0x155f9b;_0x45bd94=0xc8;}else{_0x45bd94=0xce;}_0x1595cb['status'](_0x45bd94);return _0x1595cb[_0xebef('0x26')](_0xebef('0x27'),_0x1253dd+'-'+_0x2da1be+'/'+_0x155f9b)[_0xebef('0x21')](_0x509bde);}return null;};}function patchUpdates(_0x3a8a7c){return function(_0x45d630){try{jsonpatch[_0xebef('0x28')](_0x45d630,_0x3a8a7c,!![]);}catch(_0x3e23b7){return BPromise[_0xebef('0x29')](_0x3e23b7);}return _0x45d630[_0xebef('0x2a')]();};}function saveUpdates(_0x2ca014,_0x5863c7){return function(_0x567e21){if(_0x567e21){return _0x567e21[_0xebef('0x2b')](_0x2ca014)['then'](function(_0x34c6f2){return _0x34c6f2;});}return null;};}function removeEntity(_0x582233,_0x94965d){return function(_0x44061d){if(_0x44061d){return _0x44061d[_0xebef('0x2c')]()[_0xebef('0x2d')](function(){_0x582233[_0xebef('0x1f')](0xcc)[_0xebef('0x20')]();});}};}function handleEntityNotFound(_0x772a8,_0x266091){return function(_0x2cda6c){if(!_0x2cda6c){_0x772a8[_0xebef('0x1e')](0x194);}return _0x2cda6c;};}function handleError(_0x15d149,_0x5c6a45){_0x5c6a45=_0x5c6a45||0x1f4;return function(_0x4efecc){logger[_0xebef('0x2e')](_0x4efecc[_0xebef('0x2f')]);if(_0x4efecc[_0xebef('0x30')]){delete _0x4efecc[_0xebef('0x30')];}_0x15d149[_0xebef('0x1f')](_0x5c6a45)[_0xebef('0x31')](_0x4efecc);};}exports['index']=function(_0x3221c2,_0x304d32){var _0xb077fc={},_0x2d20cb={},_0x54794b={'count':0x0,'rows':[]};var _0x268975=_[_0xebef('0x32')](db[_0xebef('0x33')][_0xebef('0x34')],function(_0x5a0a8c){return{'name':_0x5a0a8c[_0xebef('0x35')],'type':_0x5a0a8c['type'][_0xebef('0x36')]};});_0x2d20cb[_0xebef('0x37')]=_['map'](_0x268975,_0xebef('0x30'));_0x2d20cb['query']=_[_0xebef('0x38')](_0x3221c2['query']);_0x2d20cb['filters']=_[_0xebef('0x39')](_0x2d20cb[_0xebef('0x37')],_0x2d20cb[_0xebef('0x3a')]);_0xb077fc[_0xebef('0x3b')]=_['intersection'](_0x2d20cb[_0xebef('0x37')],qs[_0xebef('0x3c')](_0x3221c2[_0xebef('0x3a')]['fields']));_0xb077fc['attributes']=_0xb077fc['attributes'][_0xebef('0x3d')]?_0xb077fc[_0xebef('0x3b')]:_0x2d20cb[_0xebef('0x37')];if(!_0x3221c2[_0xebef('0x3a')][_0xebef('0x3e')](_0xebef('0x3f'))){_0xb077fc[_0xebef('0x25')]=qs[_0xebef('0x25')](_0x3221c2[_0xebef('0x3a')][_0xebef('0x25')]);_0xb077fc[_0xebef('0x24')]=qs['offset'](_0x3221c2[_0xebef('0x3a')][_0xebef('0x24')]);}_0xb077fc[_0xebef('0x40')]=qs[_0xebef('0x41')](_0x3221c2['query'][_0xebef('0x41')]);_0xb077fc[_0xebef('0x42')]=qs[_0xebef('0x43')](_[_0xebef('0x44')](_0x3221c2[_0xebef('0x3a')],_0x2d20cb[_0xebef('0x43')]),_0x268975);if(_0x3221c2[_0xebef('0x3a')][_0xebef('0x45')]){_0xb077fc[_0xebef('0x42')]=_[_0xebef('0x46')](_0xb077fc[_0xebef('0x42')],{'$or':_['map'](_0x268975,function(_0xe03c78){if(_0xe03c78[_0xebef('0x47')]!=='VIRTUAL'){var _0x302be5={};_0x302be5[_0xe03c78[_0xebef('0x30')]]={'$like':'%'+_0x3221c2[_0xebef('0x3a')][_0xebef('0x45')]+'%'};return _0x302be5;}})});}_0xb077fc=_[_0xebef('0x46')]({},_0xb077fc,_0x3221c2['options']);var _0x1b5093={'where':_0xb077fc['where']};return db[_0xebef('0x33')][_0xebef('0x23')](_0x1b5093)[_0xebef('0x2d')](function(_0x5cc1e7){_0x54794b[_0xebef('0x23')]=_0x5cc1e7;if(_0x3221c2[_0xebef('0x3a')][_0xebef('0x48')]){_0xb077fc[_0xebef('0x49')]=[{'all':!![]}];}return db[_0xebef('0x33')][_0xebef('0x4a')](_0xb077fc);})[_0xebef('0x2d')](function(_0x51f5f5){_0x54794b[_0xebef('0x4b')]=_0x51f5f5;return _0x54794b;})['then'](respondWithFilteredResult(_0x304d32,_0xb077fc))[_0xebef('0x4c')](handleError(_0x304d32,null));};exports[_0xebef('0x4d')]=function(_0x27c77d,_0x30cc26){var _0x1dca2a={'raw':![],'where':{'id':_0x27c77d[_0xebef('0x4e')]['id']}},_0x2253de={};_0x2253de[_0xebef('0x37')]=_['keys'](db[_0xebef('0x33')][_0xebef('0x34')]);_0x2253de[_0xebef('0x3a')]=_[_0xebef('0x38')](_0x27c77d[_0xebef('0x3a')]);_0x2253de[_0xebef('0x43')]=_['intersection'](_0x2253de[_0xebef('0x37')],_0x2253de['query']);_0x1dca2a[_0xebef('0x3b')]=_[_0xebef('0x39')](_0x2253de[_0xebef('0x37')],qs[_0xebef('0x3c')](_0x27c77d[_0xebef('0x3a')][_0xebef('0x3c')]));_0x1dca2a[_0xebef('0x3b')]=_0x1dca2a[_0xebef('0x3b')][_0xebef('0x3d')]?_0x1dca2a[_0xebef('0x3b')]:_0x2253de[_0xebef('0x37')];if(_0x27c77d[_0xebef('0x3a')][_0xebef('0x48')]){_0x1dca2a['include']=[{'all':!![]}];}_0x1dca2a=_['merge']({},_0x1dca2a,_0x27c77d[_0xebef('0x4f')]);return db[_0xebef('0x33')]['find'](_0x1dca2a)[_0xebef('0x2d')](handleEntityNotFound(_0x30cc26,null))[_0xebef('0x2d')](respondWithResult(_0x30cc26,null))[_0xebef('0x4c')](handleError(_0x30cc26,null));};exports['create']=function(_0x11bd47,_0xba39d0){return db[_0xebef('0x33')][_0xebef('0x50')](_0x11bd47[_0xebef('0x51')],{})[_0xebef('0x2d')](respondWithResult(_0xba39d0,0xc9))[_0xebef('0x4c')](handleError(_0xba39d0,null));};exports[_0xebef('0x52')]=function(_0xa4c3a9,_0x1beb60){var _0x2ce30b={'where':{'id':_0xa4c3a9[_0xebef('0x4e')]['id']}},_0x2d8aea={};_0x2d8aea[_0xebef('0x37')]=_[_0xebef('0x38')](db[_0xebef('0x33')][_0xebef('0x34')]);_0x2ce30b[_0xebef('0x3b')]=_[_0xebef('0x39')](_0x2d8aea[_0xebef('0x37')],qs[_0xebef('0x3c')](_0xa4c3a9[_0xebef('0x3a')][_0xebef('0x3c')]));_0x2ce30b[_0xebef('0x3b')]=_0x2ce30b[_0xebef('0x3b')][_0xebef('0x3d')]?_0x2ce30b[_0xebef('0x3b')]:_0x2d8aea['model'];if(_0xa4c3a9[_0xebef('0x3a')]['includeAll']){_0x2ce30b[_0xebef('0x49')]=[{'all':!![]}];}_0x2ce30b=_[_0xebef('0x46')]({},_0x2ce30b,_0xa4c3a9[_0xebef('0x4f')]);return db[_0xebef('0x33')]['find'](_0x2ce30b)[_0xebef('0x2d')](handleEntityNotFound(_0x1beb60,null))[_0xebef('0x2d')](function(_0x494d5f){if(_0x494d5f){var _0x1d792b=_0x494d5f['get']({'plain':!![]});_0x1d792b=qs['omit'](_0x1d792b,['id',_0xebef('0x53'),_0xebef('0x54'),_0xebef('0x55')]);_0xa4c3a9[_0xebef('0x51')]=_[_0xebef('0x56')](_0xa4c3a9[_0xebef('0x51')],['id','createdAt',_0xebef('0x54')]);return db[_0xebef('0x57')][_0xebef('0x58')](function(_0x1f57a9){return db[_0xebef('0x33')][_0xebef('0x50')](_[_0xebef('0x46')](_0x1d792b,_0xa4c3a9[_0xebef('0x51')]),{'include':_0xa4c3a9[_0xebef('0x3a')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x1f57a9})[_0xebef('0x2d')](function(_0x4344de){var _0x20344b=_0x4344de[_0xebef('0x59')]({'plain':!![]});return db[_0xebef('0x5a')][_0xebef('0x4a')]({'where':{'userProfileId':_0xa4c3a9['params']['id']},'raw':!![]})[_0xebef('0x2d')](function(_0x5f5b93){if(_0x5f5b93){return BPromise[_0xebef('0x5b')](_0x5f5b93,function(_0x43afe3){return new BPromise(function(_0x92c6a4,_0x3b7a9c){if(_0x43afe3['autoAssociation']===null||_0x43afe3['autoAssociation']===0x1)_0x92c6a4(null);return db[_0xebef('0x5c')][_0xebef('0x4a')]({'where':{'sectionId':_0x43afe3['id']},'raw':!![]})[_0xebef('0x2d')](function(_0x2dce3c){var _0x5612c7=_[_0xebef('0x32')](_0x2dce3c,function(_0x12e015){return qs[_0xebef('0x56')](_0x12e015,['id','createdAt',_0xebef('0x54'),_0xebef('0x5d')]);});_0x92c6a4(_0x5612c7);})['catch'](function(_0x531239){_0x3b7a9c(_0x531239);});})[_0xebef('0x2d')](function(_0x5d76da){var _0x170e9e=qs[_0xebef('0x56')](_0x43afe3,['id',_0xebef('0x53'),_0xebef('0x54')]);_0x170e9e[_0xebef('0x5e')]=_0x20344b['id'];if(_0x5d76da)_0x170e9e[_0xebef('0x5f')]=_0x5d76da;return _0x170e9e;})[_0xebef('0x2d')](function(_0x28f95c){return db[_0xebef('0x5a')][_0xebef('0x50')](_0x28f95c,{'include':[{'model':db[_0xebef('0x5c')],'as':_0xebef('0x5f')}],'raw':!![],'transaction':_0x1f57a9});});})[_0xebef('0x2d')](function(){return _0x20344b;});}});});});}})['then'](respondWithResult(_0x1beb60,0xc9))['catch'](handleError(_0x1beb60,null));};exports['update']=function(_0x5bb2f6,_0x1357da){if(_0x5bb2f6['body']['id']){delete _0x5bb2f6[_0xebef('0x51')]['id'];}return db[_0xebef('0x33')][_0xebef('0x60')]({'where':{'id':_0x5bb2f6[_0xebef('0x4e')]['id']}})[_0xebef('0x2d')](handleEntityNotFound(_0x1357da,null))['then'](saveUpdates(_0x5bb2f6['body'],null))[_0xebef('0x2d')](respondWithResult(_0x1357da,null))['catch'](handleError(_0x1357da,null));};exports[_0xebef('0x2c')]=function(_0x51f8c7,_0x348f9c){return db['UserProfile']['find']({'where':{'id':_0x51f8c7[_0xebef('0x4e')]['id']}})['then'](handleEntityNotFound(_0x348f9c,null))[_0xebef('0x2d')](removeEntity(_0x348f9c,null))['catch'](handleError(_0x348f9c,null));};exports[_0xebef('0x61')]=function(_0x45d5e6,_0x424e38){return db[_0xebef('0x33')]['describe']()[_0xebef('0x2d')](respondWithResult(_0x424e38,null))[_0xebef('0x4c')](handleError(_0x424e38,null));};exports['addSections']=function(_0x2f26d3,_0x17fac8){var _0x12021a=_0x2f26d3[_0xebef('0x51')];return db[_0xebef('0x33')][_0xebef('0x60')]({'where':{'id':_0x2f26d3[_0xebef('0x4e')]['id']}})[_0xebef('0x2d')](handleEntityNotFound(_0x17fac8,null))[_0xebef('0x2d')](function(_0xaa8d20){if(_0xaa8d20){return db['sequelize']['transaction'](function(_0x203fa2){return db[_0xebef('0x5a')]['destroy']({'where':{'userProfileId':_0x2f26d3[_0xebef('0x4e')]['id'],'sectionId':_[_0xebef('0x32')](_0x12021a,function(_0x47422f){return _0x47422f[_0xebef('0x5d')];})},'transaction':_0x203fa2})[_0xebef('0x2d')](function(){var _0x59fdc5=_[_0xebef('0x32')](_0x12021a,function(_0x42f34d){_0x42f34d[_0xebef('0x5e')]=_0x2f26d3[_0xebef('0x4e')]['id'];return _0x42f34d;});var _0x372b1c=[];return BPromise[_0xebef('0x5b')](_0x59fdc5,function(_0x5322c2){return db[_0xebef('0x5a')]['create'](_0x5322c2,{'include':[{'model':db[_0xebef('0x5c')],'as':_0xebef('0x5f')}],'raw':!![],'transaction':_0x203fa2})[_0xebef('0x2d')](function(_0x1c8a26){_0x372b1c[_0xebef('0x62')](_0x1c8a26[_0xebef('0x59')]({'plain':!![]}));});})[_0xebef('0x2d')](function(){return _0x372b1c;});});});}})[_0xebef('0x2d')](function(_0x17c9eb){return _0x17c9eb;})[_0xebef('0x2d')](respondWithResult(_0x17fac8,null))[_0xebef('0x4c')](handleError(_0x17fac8,null));};exports['removeSections']=function(_0x13482f,_0x4fe02b){var _0x344d37;return db[_0xebef('0x33')][_0xebef('0x60')]({'where':{'id':_0x13482f[_0xebef('0x4e')]['id']},'attributes':['id',_0xebef('0x30')]})[_0xebef('0x2d')](handleEntityNotFound(_0x4fe02b,null))[_0xebef('0x2d')](function(_0x4eb1ee){if(_0x4eb1ee){_0x344d37=_0x4eb1ee;return db[_0xebef('0x5a')]['destroy']({'where':{'userProfileId':_0x13482f[_0xebef('0x4e')]['id'],'sectionId':_0x13482f['query'][_0xebef('0x63')]}});}})['then'](function(){return _0x344d37;})[_0xebef('0x2d')](respondWithStatusCode(_0x4fe02b,null))[_0xebef('0x4c')](handleError(_0x4fe02b,null));};exports[_0xebef('0x64')]=function(_0x1a8a81,_0x367b21){var _0x202050=[];var _0x1f64b2=[];return db[_0xebef('0x5a')][_0xebef('0x4a')]({'where':{'userProfileId':_0x1a8a81[_0xebef('0x4e')]['id']},'raw':!![]})[_0xebef('0x2d')](function(_0x1a8d8c){_0x202050=_[_0xebef('0x45')](_0x1a8d8c,function(_0x522e38){return _0x522e38['enabled']===0x1||_['includes']([0x3eb,0x709],_0x522e38[_0xebef('0x5d')]);});if(!_[_0xebef('0x65')](_0x202050)){return _[_0xebef('0x32')](_0x202050,function(_0x32cbf9){return _0x32cbf9[_0xebef('0x5d')];});}else{return;}})[_0xebef('0x2d')](function(_0x3d5bda){if(_0x3d5bda)_0x1f64b2=_0x3d5bda;if(_[_0xebef('0x66')](_0x1f64b2,0x64)){var _0x1954f5=_['find'](_0x202050,{'sectionId':0x64});return hasDefaultDashboard(_0x1954f5)['then'](function(_0x3a8aa6){return _[_0xebef('0x32')](_0x202050,function(_0x35326c){if(_0x35326c['sectionId']===0x64){_0x35326c[_0xebef('0x67')]=_0x3a8aa6;}return _0x35326c;});});}else{return;}})[_0xebef('0x2d')](function(_0x44b11f){if(_0x44b11f)_0x202050=_0x44b11f;if(_['includes'](_0x1f64b2,0x3eb)){var _0x3071=_['find'](_0x202050,{'sectionId':0x3eb});return getCustomDashboards(_0x3071)[_0xebef('0x2d')](function(_0x4f9b66){return _[_0xebef('0x32')](_0x202050,function(_0x2906e8){if(_0x3071[_0xebef('0x68')]){if(_0x2906e8['sectionId']===0x3eb){_0x2906e8[_0xebef('0x67')]=_0x4f9b66;}}else{if(_0x2906e8[_0xebef('0x5d')]===0x64){if(!_0x2906e8[_0xebef('0x67')]){_0x2906e8[_0xebef('0x67')]=[];}_0x2906e8[_0xebef('0x67')]=_0x2906e8[_0xebef('0x67')]['concat'](_0x4f9b66);}}return _0x2906e8;});});}else{return;}})[_0xebef('0x2d')](function(_0x17145b){if(_0x17145b)_0x202050=_0x17145b;if(_[_0xebef('0x66')](_0x1f64b2,0x709)){var _0x9eeaad=_[_0xebef('0x60')](_0x202050,{'sectionId':0x709});return getPlugins(_0x9eeaad)[_0xebef('0x2d')](function(_0x5d9a64){if(_0x9eeaad[_0xebef('0x68')]){return _['map'](_0x202050,function(_0x484826){if(_0x484826['sectionId']===0x709){_0x484826[_0xebef('0x67')]=_0x5d9a64;}return _0x484826;});}else{var _0x1e288b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5d9a64};var _0x5d4a35=_[_0xebef('0x32')](_0x202050);_0x5d4a35[_0xebef('0x62')](_0x1e288b);return _0x5d4a35;}});}else{return;}})['then'](function(_0x3e0bb2){if(_0x3e0bb2)_0x202050=_0x3e0bb2;return _[_0xebef('0x45')](_0x202050,[_0xebef('0x68'),0x1]);})[_0xebef('0x2d')](respondWithResult(_0x367b21,null))[_0xebef('0x4c')](handleError(_0x367b21,null));};function hasDefaultDashboard(_0x50fb6d){var _0x5d70fa=[0x65];return new BPromise(function(_0x22cef1,_0x250192){try{if(_0x50fb6d['autoAssociation']){_0x22cef1(_0x5d70fa);}else{return db[_0xebef('0x5c')]['findOne']({'where':{'sectionId':_0x50fb6d['id']},'raw':!![]})[_0xebef('0x2d')](function(_0x15edd2){_0x15edd2?_0x22cef1(_0x5d70fa):_0x22cef1();});}}catch(_0x348837){_0x250192(_0x348837);}});}function getCustomDashboards(_0x135724){var _0x2e0d83=[];return new BPromise(function(_0x431d95,_0xd53676){try{if(_0x135724[_0xebef('0x69')]){return db[_0xebef('0x6a')][_0xebef('0x4a')]({'raw':!![]})[_0xebef('0x2d')](function(_0x420675){_0x420675[_0xebef('0x6b')](function(_0x48ac02){_0x2e0d83[_0xebef('0x62')](_0x48ac02['id']+0x1869f);});_0x431d95(_0x2e0d83);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x135724['id']},'raw':!![]})[_0xebef('0x2d')](function(_0x2cfaf5){_0x2cfaf5[_0xebef('0x6b')](function(_0x4aaf0d){_0x2e0d83['push'](_0x4aaf0d['resourceId']+0x1869f);});_0x431d95(_0x2e0d83);});}}catch(_0x5e81f5){_0xd53676(_0x5e81f5);}});}function getPlugins(_0xe3aa08){var _0x43afe4=[];return new BPromise(function(_0x2674a6,_0x2f3d65){try{if(_0xe3aa08[_0xebef('0x69')]){return db[_0xebef('0x6c')][_0xebef('0x4a')]({'raw':!![]})[_0xebef('0x2d')](function(_0x5cca61){_0x5cca61['forEach'](function(_0x1de4ee){_0x43afe4[_0xebef('0x62')](_0x1de4ee['id']+0x15b38);});_0x2674a6(_0x43afe4);});}else{return db[_0xebef('0x5c')][_0xebef('0x4a')]({'where':{'sectionId':_0xe3aa08['id']},'raw':!![]})['then'](function(_0x4e219f){_0x4e219f[_0xebef('0x6b')](function(_0x339f7c){_0x43afe4[_0xebef('0x62')](_0x339f7c[_0xebef('0x6d')]+0x15b38);});_0x2674a6(_0x43afe4);});}}catch(_0x426976){_0x2f3d65(_0x426976);}});}exports['addResources']=function(_0x277363,_0x27dafd){return db['UserProfile'][_0xebef('0x60')]({'where':{'id':_0x277363['params']['id']}})[_0xebef('0x2d')](handleEntityNotFound(_0x27dafd,null))[_0xebef('0x2d')](function(_0x2fde4a){if(_0x2fde4a){return db[_0xebef('0x57')]['transaction'](function(_0x1c6826){return db[_0xebef('0x5a')][_0xebef('0x4a')]({'where':{'userProfileId':_0x277363['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x1fcaa1){if(_0x1fcaa1){return db[_0xebef('0x5a')][_0xebef('0x2c')]({'where':{'userProfileId':_0x277363['params']['id'],'id':_[_0xebef('0x32')](_0x1fcaa1,function(_0x227421){return _0x227421['id'];})},'transaction':_0x1c6826});}})[_0xebef('0x2d')](function(_0x5d5af9){var _0x415e05=_[_0xebef('0x32')](_0x277363[_0xebef('0x51')],function(_0x61cb9d){_0x61cb9d['userProfileId']=_0x277363['params']['id'];return _0x61cb9d;});return db[_0xebef('0x5a')][_0xebef('0x6e')](_0x415e05,{'raw':!![],'transaction':_0x1c6826});})[_0xebef('0x2d')](function(_0x2ce48c){var _0x575322=_[_0xebef('0x45')](_[_0xebef('0x32')](_0x2ce48c,function(_0x378d2a){return _0x378d2a[_0xebef('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x575322){return db['UserProfileSection'][_0xebef('0x4a')]({'where':{'userProfileId':_0x277363['params']['id'],'sectionId':_[_0xebef('0x32')](_0x575322,function(_0xa6a55b){return _0xa6a55b[_0xebef('0x5d')];})},'attributes':['id',_0xebef('0x5d')],'raw':!![]})[_0xebef('0x2d')](function(_0x288e52){var _0x33ad2b=_[_0xebef('0x32')](_0x277363['body'],function(_0x4f1aa2){_0x4f1aa2[_0xebef('0x5e')]=_0x277363[_0xebef('0x4e')]['id'];return _0x4f1aa2;});return db[_0xebef('0x5c')][_0xebef('0x6e')](_0x33ad2b,{'raw':!![],'transaction':_0x1c6826});});}})['catch'](handleError(_0x27dafd,null));});}})['then'](function(_0x2c997f){var _0xd29ffa=_[_0xebef('0x32')](_0x2c997f,function(_0x143466){return _0x143466['get']({'plain':!![]});});})[_0xebef('0x2d')](respondWithResult(_0x27dafd,null))[_0xebef('0x4c')](handleError(_0x27dafd,null));};exports[_0xebef('0x6f')]=function(_0x1e32ba,_0x12bcc8,_0x81c745){return db[_0xebef('0x33')][_0xebef('0x60')]({'where':{'id':_0x1e32ba[_0xebef('0x4e')]['id']}})['then'](handleEntityNotFound(_0x12bcc8,null))[_0xebef('0x2d')](function(_0x575fab){if(_0x575fab){return _0x575fab[_0xebef('0x6f')](_0x1e32ba[_0xebef('0x3a')]['ids']);}})['then'](respondWithStatusCode(_0x12bcc8,null))[_0xebef('0x4c')](handleError(_0x12bcc8,null));};exports[_0xebef('0x70')]=function(_0x1cf4ea,_0x514b76){var _0x321df1={};if(!_0x1cf4ea[_0xebef('0x3a')][_0xebef('0x71')])throw new Error('Missing\x20section\x20parameter');if(!_0x1cf4ea[_0xebef('0x3a')][_0xebef('0x3e')](_0xebef('0x3f'))){_0x321df1[_0xebef('0x25')]=qs[_0xebef('0x25')](_0x1cf4ea[_0xebef('0x3a')][_0xebef('0x25')]);_0x321df1[_0xebef('0x24')]=qs['offset'](_0x1cf4ea[_0xebef('0x3a')]['offset']);}return db[_0xebef('0x33')][_0xebef('0x60')]({'where':{'id':_0x1cf4ea['params']['id']}})[_0xebef('0x2d')](function(_0x320575){if(!_0x320575)throw new Error(_0xebef('0x72')+_0x1cf4ea[_0xebef('0x4e')]['id']);return db['UserProfile']['getResources'](_0x1cf4ea);})[_0xebef('0x2d')](respondWithFilteredResult(_0x514b76,_0x321df1))[_0xebef('0x4c')](handleError(_0x514b76,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index c35e8fd..ec0dcd8 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 _0x1867=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x1622eb,_0xcfa32c){var _0x418ce4=function(_0x4c5cf4){while(--_0x4c5cf4){_0x1622eb['push'](_0x1622eb['shift']());}};_0x418ce4(++_0xcfa32c);}(_0x1867,0xb5));var _0x7186=function(_0x45abed,_0x4407ca){_0x45abed=_0x45abed-0x0;var _0x340e7c=_0x1867[_0x45abed];return _0x340e7c;};'use strict';var EventEmitter=require(_0x7186('0x0'));var UserProfile=require(_0x7186('0x1'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x7186('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7186('0x3'),'afterDestroy':_0x7186('0x4')};function emitEvent(_0xeb165d){return function(_0xc7f9f0,_0x25d50d,_0x16dcd1){UserProfileEvents[_0x7186('0x5')](_0xeb165d+':'+_0xc7f9f0['id'],_0xc7f9f0);UserProfileEvents[_0x7186('0x5')](_0xeb165d,_0xc7f9f0);_0x16dcd1(null);};}for(var e in events){if(events[_0x7186('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x7186('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x38b2=['UserProfile','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1fb4d7,_0x5c252d){var _0x37b2bd=function(_0x29a9eb){while(--_0x29a9eb){_0x1fb4d7['push'](_0x1fb4d7['shift']());}};_0x37b2bd(++_0x5c252d);}(_0x38b2,0xf6));var _0x238b=function(_0x1897e9,_0x10e59c){_0x1897e9=_0x1897e9-0x0;var _0x402725=_0x38b2[_0x1897e9];return _0x402725;};'use strict';var EventEmitter=require(_0x238b('0x0'));var UserProfile=require(_0x238b('0x1'))['db'][_0x238b('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x238b('0x3'),'afterDestroy':_0x238b('0x4')};function emitEvent(_0x4df021){return function(_0x44251b,_0x4c4f0e,_0x44ddd2){UserProfileEvents[_0x238b('0x5')](_0x4df021+':'+_0x44251b['id'],_0x44251b);UserProfileEvents[_0x238b('0x5')](_0x4df021,_0x44251b);_0x44ddd2(null);};}for(var e in events){if(events[_0x238b('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x238b('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 2d151e3..4ed9e2d 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 _0xd169=['ui.UserId\x20=\x20?','sequelize','query','define','UserProfile','user_profiles','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','ignore','isEmpty','autoAssociation','keys','filters','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','key','foreignKey','options','includeAll','include','forEach','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','mail','./userProfile.attributes','../../components/parsers/qs','exports','models','value','findAll','map','catch','filter','field','model','then','associatedResources','name','AnalyticExtractedReport','type','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','contacts','CmContact','Lists','lists','CmList','companies','CmCustomField','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxQueue','faxaccounts','inboundroutes','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','User','agent','Telephones','role','telephone','queue','inbound','QueueCampaigns','VoiceQueue','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','Campaign','MailQueue','mailaccounts','MailAccount','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueues','users','telephones','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','Tag','templates','Template','triggers','Trigger','Trunk','variables','Variable','plugins','Plugin','Reports','reportId','charAt','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','_interactions'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xd169,0x1b0));var _0x9d16=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xd169[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var attributes=require(_0x9d16('0x0'));var qs=require(_0x9d16('0x1'));var squel=require('squel');module[_0x9d16('0x2')]=function(_0x58ea9b){var _0x18b9ff=_0x58ea9b[_0x9d16('0x3')];function _0x39f374(_0x38040e,_0x370cb4){return new Promise(function(_0x40d0bb,_0x504972){if(!_0x370cb4)return _0x40d0bb(null);var _0x511d53=_0x370cb4['filter']?{[_0x370cb4['filter']['field']]:_0x370cb4['filter'][_0x9d16('0x4')]}:undefined;return _0x18b9ff[_0x38040e][_0x9d16('0x5')]({'where':_0x511d53,'raw':!![]})['then'](function(_0x33a063){_0x370cb4['associatedResources']=_[_0x9d16('0x6')](_0x33a063,'id');_0x40d0bb(_0x370cb4);})[_0x9d16('0x7')](function(_0x5ec03c){_0x504972(_0x5ec03c);});});}function _0x357388(_0x3ea3a4,_0x4d5e2d){return new Promise(function(_0x19ad9a,_0x565477){var _0x129199=_0x3ea3a4[_0x9d16('0x8')]?{[_0x3ea3a4[_0x9d16('0x8')][_0x9d16('0x9')]]:_0x3ea3a4[_0x9d16('0x8')][_0x9d16('0x4')]}:undefined;return _0x18b9ff[_0x3ea3a4[_0x9d16('0xa')]][_0x9d16('0x5')]({'where':_0x129199,'raw':!![]})[_0x9d16('0xb')](function(_0x439d5f){_0x4d5e2d[_0x9d16('0xc')]=_[_0x9d16('0x6')](_0x439d5f,function(_0x11a60e){return _0x11a60e[_0x9d16('0xd')];});_0x19ad9a(_0x4d5e2d);})[_0x9d16('0x7')](function(_0x426682){_0x565477(_0x426682);});});}function _0x4a6aa4(_0x3e6aa7,_0x2473e7,_0x49483c){if(!_0x2473e7)return Promise['resolve'](null);return new Promise(function(_0x58153e,_0x2dc5b4){return _0x18b9ff['UserProfileResource'][_0x9d16('0x5')]({'where':{'sectionId':_0x2473e7['id']},'raw':!![]})[_0x9d16('0xb')](function(_0x5a03d8){if(_0x3e6aa7[_0x9d16('0x9')]&&_0x3e6aa7[_0x9d16('0x9')]!=='id'){_0x2473e7['associatedResources']=_[_0x9d16('0x6')](_0x5a03d8,function(_0x18afb5){return _0x18afb5[_0x3e6aa7['field']];});}else{if(_0x49483c===_0x9d16('0xe')){_0x2473e7[_0x9d16('0xc')]=_['map'](_0x5a03d8,function(_0xfff93d){return{'id':_0xfff93d['resourceId'],'type':_0xfff93d[_0x9d16('0xf')]};});}else{_0x2473e7[_0x9d16('0xc')]=_[_0x9d16('0x6')](_0x5a03d8,function(_0xb50656){return _0xb50656[_0x9d16('0x10')];});}}_0x58153e(_0x2473e7);})['catch'](function(_0x50330b){_0x2dc5b4(_0x50330b);});});}function _0x5c5960(_0x476e77,_0x4dbee2){var _0x79adb7={'parentSections':[]};switch(_0x476e77[_0x9d16('0x11')]()){case _0x9d16('0x12'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x14');break;case _0x9d16('0x15'):_0x79adb7['childModel']=_0x9d16('0x16');break;case _0x9d16('0x17'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x18');_0x79adb7['parentSections']=[{'name':_0x9d16('0x19'),'field':'name','foreignKey':_0x9d16('0x1a')}];break;case _0x9d16('0x1b'):_0x79adb7[_0x9d16('0x13')]='JscriptyProject';break;case _0x9d16('0x1c'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x1d');_0x79adb7['parentSections']=[{'name':_0x9d16('0x1e'),'field':'id','foreignKey':'ListId'}];break;case _0x9d16('0x1f'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x20');break;case _0x9d16('0x21'):_0x79adb7['childModel']='CmCompany';break;case'globalcustomfields':_0x79adb7['childModel']=_0x9d16('0x22');break;case'chatqueues':_0x79adb7['childModel']=_0x9d16('0x23');break;case _0x9d16('0x24'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x25');break;case _0x9d16('0x26'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x27');break;case _0x9d16('0x28'):_0x79adb7[_0x9d16('0x13')]='FaxAccount';break;case _0x9d16('0x29'):case'internalroutes':case'outboundroutes':_0x79adb7[_0x9d16('0x13')]='VoiceExtension';break;case'contexts':_0x79adb7[_0x9d16('0x13')]='VoiceContext';break;case _0x9d16('0x2a'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x2b');break;case _0x9d16('0x2c'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x2d');_0x79adb7[_0x9d16('0x2e')]=[{'name':'Agents','field':_0x9d16('0xd'),'foreignKey':'membername','model':_0x9d16('0x2f'),'filter':{'field':'role','value':[_0x9d16('0x30')]}},{'name':_0x9d16('0x31'),'field':_0x9d16('0xd'),'foreignKey':'membername','model':'User','filter':{'field':_0x9d16('0x32'),'value':[_0x9d16('0x33')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0x9d16('0x34'),'model':'VoiceQueue','filter':{'field':_0x9d16('0xf'),'value':[_0x9d16('0x35')]}},{'name':_0x9d16('0x36'),'field':_0x9d16('0xd'),'foreignKey':'queue','model':_0x9d16('0x37'),'filter':{'field':_0x9d16('0xf'),'value':['outbound']}}];break;case _0x9d16('0x38'):_0x79adb7['childModel']=_0x9d16('0x39');break;case _0x9d16('0x3a'):_0x79adb7['childModel']=_0x9d16('0x3b');break;case _0x9d16('0x3c'):_0x79adb7['childModel']='VoicePrefix';break;case _0x9d16('0x3d'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x3e');break;case'mailqueues':_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x3f');break;case _0x9d16('0x40'):_0x79adb7['childModel']=_0x9d16('0x41');break;case'mailsubstatuses':_0x79adb7['childModel']=_0x9d16('0x42');break;case'openchannelqueues':_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x43');break;case _0x9d16('0x44'):_0x79adb7['childModel']=_0x9d16('0x45');break;case _0x9d16('0x46'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x47');break;case'smsaccounts':_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x48');break;case'whatsappqueues':_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x49');break;case _0x9d16('0x4a'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x4b');break;case _0x9d16('0x4c'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x4d');break;case'voicequeues':case _0x9d16('0x4e'):_0x79adb7[_0x9d16('0x13')]='VoiceQueue';if(_0x4dbee2){_0x79adb7[_0x9d16('0x2e')]=[{'name':_0x9d16('0x4f')},{'name':_0x9d16('0x36')}];}break;case _0x9d16('0x50'):case'agents':case _0x9d16('0x51'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x2f');if(_0x4dbee2){_0x79adb7['parentSections']=[{'name':'Users','filter':{'field':_0x9d16('0x32'),'value':['admin',_0x9d16('0x52')]},'ignore':!![]},{'name':_0x9d16('0x53')},{'name':_0x9d16('0x31')}];}break;case _0x9d16('0x54'):_0x79adb7['childModel']=_0x9d16('0x55');break;case _0x9d16('0x56'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x57');break;case _0x9d16('0x58'):_0x79adb7[_0x9d16('0x13')]='FreshdeskAccount';break;case _0x9d16('0x59'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x5a');break;case _0x9d16('0x5b'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x5c');break;case _0x9d16('0x5d'):_0x79adb7[_0x9d16('0x13')]='ZohoAccount';break;case _0x9d16('0x5e'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x2f');break;case _0x9d16('0x5f'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x60');break;case _0x9d16('0x61'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x62');break;case _0x9d16('0x63'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x64');break;case _0x9d16('0x65'):_0x79adb7['childModel']=_0x9d16('0x66');break;case _0x9d16('0x67'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x68');break;case _0x9d16('0x69'):_0x79adb7['childModel']=_0x9d16('0x6a');break;case _0x9d16('0x6b'):_0x79adb7['childModel']=_0x9d16('0x6c');break;case'tags':_0x79adb7['childModel']=_0x9d16('0x6d');break;case _0x9d16('0x6e'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x6f');break;case _0x9d16('0x70'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x71');break;case'trunks':_0x79adb7['childModel']=_0x9d16('0x72');break;case _0x9d16('0x73'):_0x79adb7['childModel']=_0x9d16('0x74');break;case _0x9d16('0x75'):_0x79adb7[_0x9d16('0x13')]=_0x9d16('0x76');break;case'extractedreports':_0x79adb7['childModel']=_0x9d16('0xe');_0x79adb7[_0x9d16('0x2e')]=[{'name':_0x9d16('0x77'),'field':'id','foreignKey':_0x9d16('0x78')}];break;case'metrics':_0x79adb7[_0x9d16('0x13')]='AnalyticMetric';break;}return _0x79adb7;}function _0x59822e(_0x5f0ada,_0x33c63c){var _0x3ce689=_0x5f0ada[_0x9d16('0x79')](0x0)[_0x9d16('0x7a')]()+_0x5f0ada[_0x9d16('0x7b')](0x1);var _0x142fc6={'type':_0x18b9ff[_0x9d16('0x7c')][_0x9d16('0x7d')][_0x9d16('0x7e')],'raw':!![]};return new Promise(function(_0x308bdc,_0x591370){var _0x4a5ef3=squel[_0x9d16('0x7f')]()[_0x9d16('0x9')](_0x9d16('0x80')+_0x3ce689+_0x9d16('0x81'),'id')['field'](_0x9d16('0x82'))['from']('user_has_'+_0x5f0ada+_0x9d16('0x83'),'ui')['where'](_0x9d16('0x84'),_0x33c63c['id']);return _0x18b9ff[_0x9d16('0x85')][_0x9d16('0x86')](_0x4a5ef3['toString'](),_0x142fc6)[_0x9d16('0xb')](function(_0x473853){_0x33c63c[_0x3ce689+'OpenTabs']=_0x473853;_0x308bdc(_0x473853);})[_0x9d16('0x7')](function(_0x475479){_0x591370(_0x475479);});});}return _0x58ea9b[_0x9d16('0x87')](_0x9d16('0x88'),attributes,{'tableName':_0x9d16('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x45d71b){var _0x4e2526={'raw':_0x45d71b[_0x9d16('0x86')][_0x9d16('0x8a')],'where':{}};var _0x4a548c={};var _0x792c46={'count':0x0,'rows':[]};var _0x1ac2b6=_0x45d71b['query'][_0x9d16('0x8b')];var _0x4030b3=_0x45d71b[_0x9d16('0x86')][_0x9d16('0x8c')]||![];var _0x8e8698=_0x5c5960(_0x1ac2b6,_0x4030b3);if(!_0x8e8698[_0x9d16('0x13')])throw new Error(_0x9d16('0x8d')+_0x1ac2b6+'\x27');var _0xe81efb=[{'name':_0x1ac2b6}];if(!_['isEmpty'](_0x8e8698[_0x9d16('0x2e')]))_0xe81efb=_0x8e8698['parentSections'];var _0x7860b6=[];for(var _0x8ee75e=0x0;_0x8ee75e<_0xe81efb[_0x9d16('0x8e')];_0x8ee75e++){_0x7860b6[_0x9d16('0x8f')](_0x18b9ff[_0x9d16('0x90')][_0x9d16('0x91')]({'where':{'userProfileId':_0x45d71b[_0x9d16('0x92')]['id'],'name':_0xe81efb[_0x8ee75e][_0x9d16('0xd')]},'raw':!![]}));}return Promise[_0x9d16('0x93')](_0x7860b6)[_0x9d16('0xb')](function(_0x522add){var _0x4fd0a5=_['filter'](_0x522add,function(_0x4e5409){return _0x4e5409?_0x4e5409:undefined;});var _0x4c29ba=_['filter'](_0xe81efb,[_0x9d16('0x94'),!![]]);var _0x1d6f94=_[_0x9d16('0x95')](_0x4fd0a5)&&_['isEmpty'](_0x4c29ba)?null:_['union'](_0x4c29ba,_0x4fd0a5);if(!_0x1d6f94)return null;var _0xfb099d=[];for(var _0x8d8bdf=0x0;_0x8d8bdf<_0x1d6f94[_0x9d16('0x8e')];_0x8d8bdf++){var _0xd3a3e2=_['find'](_0xe81efb,function(_0x4a9e29){return _0x1d6f94[_0x8d8bdf]?_0x4a9e29['name']===_0x1d6f94[_0x8d8bdf][_0x9d16('0xd')]:null;});if(_0xd3a3e2){if(_0x1d6f94[_0x8d8bdf][_0x9d16('0x94')]){_0xfb099d[_0x9d16('0x8f')](_0x39f374(_0x8e8698[_0x9d16('0x13')],_0x1d6f94[_0x8d8bdf]));}else{if(!_0x1d6f94[_0x8d8bdf][_0x9d16('0x96')]){_0xfb099d[_0x9d16('0x8f')](_0x4a6aa4(_0xd3a3e2,_0x1d6f94[_0x8d8bdf],_0x8e8698[_0x9d16('0x13')]));}else{if(_0xd3a3e2['model']){_0xfb099d['push'](_0x357388(_0xd3a3e2,_0x1d6f94[_0x8d8bdf]));}}}}}return Promise[_0x9d16('0x93')](_0xfb099d);})['then'](function(_0x281329){var _0x5f431d=_0x281329;var _0x407e22=null;if(_0x5f431d){_0x407e22=_0x5f431d[_0x9d16('0x8e')]===0x1?_0x5f431d[0x0]:null;}if(!_0x407e22&&!_0x5f431d)return _0x792c46;var _0x259a2f=_0x18b9ff[_0x8e8698[_0x9d16('0x13')]]['rawAttributes'];_0x4a548c[_0x9d16('0xa')]=_[_0x9d16('0x97')](_0x259a2f);_0x4a548c['query']=_['keys'](_0x45d71b[_0x9d16('0x86')]);_0x4a548c[_0x9d16('0x98')]=_['intersection'](_0x4a548c['model'],_0x4a548c[_0x9d16('0x86')]);_0x4e2526[_0x9d16('0x99')]=_['intersection'](_0x4a548c['model'],qs[_0x9d16('0x9a')](_0x45d71b[_0x9d16('0x86')][_0x9d16('0x9a')]));_0x4e2526['attributes']=_0x4e2526[_0x9d16('0x99')][_0x9d16('0x8e')]?_0x4e2526[_0x9d16('0x99')]:_0x4a548c[_0x9d16('0xa')];if(!_0x45d71b['query'][_0x9d16('0x9b')](_0x9d16('0x9c'))){_0x4e2526['limit']=qs['limit'](_0x45d71b[_0x9d16('0x86')]['limit']);_0x4e2526[_0x9d16('0x9d')]=qs[_0x9d16('0x9d')](_0x45d71b[_0x9d16('0x86')]['offset']);}_0x4e2526[_0x9d16('0x9e')]=qs[_0x9d16('0x9f')](_0x45d71b[_0x9d16('0x86')]['sort']);_0x4e2526[_0x9d16('0xa0')]=qs[_0x9d16('0x98')](_[_0x9d16('0xa1')](_0x45d71b['query'],_0x4a548c[_0x9d16('0x98')]));if(_0x45d71b['query'][_0x9d16('0x8')]){_0x4e2526[_0x9d16('0xa0')]=_[_0x9d16('0xa2')](_0x4e2526[_0x9d16('0xa0')],{'$or':_[_0x9d16('0x6')](_0x259a2f,function(_0x3b6d7e){if(_0x3b6d7e[_0x9d16('0xf')][_0x9d16('0xa3')]!=='VIRTUAL'){var _0x2907cf={};_0x2907cf[_0x3b6d7e[_0x9d16('0x9')]]={'$like':'%'+_0x45d71b[_0x9d16('0x86')][_0x9d16('0x8')]+'%'};return _0x2907cf;}})});}var _0x924d2e=[];var _0x2bb2e9=null;var _0x215c5b={};if(_0x407e22){_0x2bb2e9=_[_0x9d16('0x91')](_0xe81efb,['name',_0x407e22[_0x9d16('0xd')]]);if(_0x2bb2e9['field']){_0x215c5b={};if(_0x8e8698[_0x9d16('0x13')]===_0x9d16('0xe')){_0x215c5b[_0x2bb2e9['foreignKey']]=_[_0x9d16('0x6')](_0x407e22[_0x9d16('0xc')],'id');}else{_0x215c5b[_0x2bb2e9[_0x9d16('0xa4')]]=_0x407e22[_0x9d16('0xc')];}_0x924d2e[_0x9d16('0x8f')](_0x215c5b);}else{_0x4e2526['where']['id']=_0x407e22[_0x9d16('0xc')];}}else{for(var _0x142e28=0x0;_0x142e28<_0x5f431d[_0x9d16('0x8e')];_0x142e28++){_0x2bb2e9=_['find'](_0xe81efb,['name',_0x5f431d[_0x142e28][_0x9d16('0xd')]]);if(_0x2bb2e9[_0x9d16('0x9')]){_0x215c5b={};_0x215c5b[_0x2bb2e9['foreignKey']]=_0x5f431d[_0x142e28][_0x9d16('0xc')];_0x924d2e[_0x9d16('0x8f')](_0x215c5b);}else{if(!_0x4e2526[_0x9d16('0xa0')]['id'])_0x4e2526[_0x9d16('0xa0')]['id']=[];_0x5f431d[_0x142e28][_0x9d16('0xc')]['forEach'](function(_0x541713){_0x4e2526[_0x9d16('0xa0')]['id'][_0x9d16('0x8f')](_0x541713);});}}}if(!_[_0x9d16('0x95')](_0x924d2e)){_0x4e2526[_0x9d16('0xa0')]=_[_0x9d16('0xa2')](_0x4e2526[_0x9d16('0xa0')],{'$and':{'$or':_0x924d2e}});}_0x4e2526=_['merge']({},_0x4e2526,_0x45d71b[_0x9d16('0xa5')]);if(_0x407e22&&!_0x407e22[_0x9d16('0x96')]&&_0x8e8698[_0x9d16('0x13')]===_0x9d16('0xe')){if(_0x45d71b['query'][_0x9d16('0xa6')]){_0x4e2526[_0x9d16('0xa7')]=[{'all':!![]}];}return _0x18b9ff[_0x8e8698[_0x9d16('0x13')]][_0x9d16('0x5')](_0x4e2526)['then'](function(_0x43402f){var _0x2d03bf=[];_0x43402f[_0x9d16('0xa8')](function(_0x4ddcca){var _0x5b0c88;switch(_0x4ddcca[_0x9d16('0xa9')]){case _0x9d16('0xaa'):_0x5b0c88=_['find'](_0x407e22[_0x9d16('0xc')],function(_0x403f97){return _0x403f97['id']===_0x4ddcca[_0x9d16('0x78')]&&_0x403f97[_0x9d16('0xf')]===_0x9d16('0xab');});break;case _0x9d16('0xac'):_0x5b0c88=_[_0x9d16('0x91')](_0x407e22[_0x9d16('0xc')],function(_0x122bf4){return _0x122bf4['id']===_0x4ddcca[_0x9d16('0x78')]&&_0x122bf4[_0x9d16('0xf')]===_0x9d16('0xad');});break;}if(_0x5b0c88)_0x2d03bf['push'](_0x4ddcca);});_0x792c46[_0x9d16('0xae')]=_0x2d03bf[_0x9d16('0x8e')];_0x792c46[_0x9d16('0xaf')]=_0x2d03bf;return _0x792c46;});}else{if(!_[_0x9d16('0x95')](_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb0')])){_0x4e2526[_0x9d16('0xa0')]['id']=_0x4e2526[_0x9d16('0xa0')]['id']?_['intersection'](_0x4e2526[_0x9d16('0xa0')]['id'],_0x45d71b['query'][_0x9d16('0xb0')]):_0x45d71b['query'][_0x9d16('0xb0')];if(_0x45d71b['query'][_0x9d16('0xb1')]){_0x4e2526[_0x9d16('0x9e')]=_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb1')];}}if(_0x45d71b[_0x9d16('0x86')]['extraQueryConditions']){_0x4e2526[_0x9d16('0xa0')]=_[_0x9d16('0xa2')](_0x4e2526[_0x9d16('0xa0')],{'$and':_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb2')]});}return _0x18b9ff[_0x8e8698[_0x9d16('0x13')]][_0x9d16('0xae')]({'where':_0x4e2526['where']})[_0x9d16('0xb')](function(_0x4d20b5){_0x792c46['count']=_0x4d20b5;if(_0x45d71b[_0x9d16('0x86')][_0x9d16('0xa6')]){if(_0x8e8698[_0x9d16('0x13')]===_0x9d16('0x1d')){_0x4e2526['include']=[{'model':_0x18b9ff[_0x9d16('0x6d')],'as':'Tags','attributes':['id',_0x9d16('0xd'),_0x9d16('0xb3')],'required':_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb4')]?!![]:![]},{'model':_0x18b9ff['Tag'],'as':_0x9d16('0xb5'),'attributes':['id',_0x9d16('0xd'),'color'],'through':_0x45d71b['query']['tag']?{'attributes':[],'where':{'TagId':_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb4')]||undefined}}:{},'required':_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb4')]?!![]:![]}];}else{_0x4e2526[_0x9d16('0xa7')]=[{'all':!![]}];}}return _0x18b9ff[_0x8e8698[_0x9d16('0x13')]][_0x9d16('0x5')](_0x4e2526);})[_0x9d16('0xb')](function(_0x50ab91){_0x792c46['rows']=_0x50ab91;if(_0x1ac2b6==='Agents'&&_0x45d71b[_0x9d16('0x86')][_0x9d16('0xb6')]===_0x9d16('0xb7')){var _0x2ef35a=[];for(var _0xf93b6b=0x0;_0xf93b6b<_0x792c46[_0x9d16('0xaf')][_0x9d16('0x8e')];_0xf93b6b++){_0x2ef35a['push'](_0x59822e('chat',_0x792c46['rows'][_0xf93b6b][_0x9d16('0xb8')]));_0x2ef35a['push'](_0x59822e(_0x9d16('0xb9'),_0x792c46['rows'][_0xf93b6b][_0x9d16('0xb8')]));_0x2ef35a['push'](_0x59822e(_0x9d16('0xba'),_0x792c46[_0x9d16('0xaf')][_0xf93b6b][_0x9d16('0xb8')]));_0x2ef35a['push'](_0x59822e(_0x9d16('0xbb'),_0x792c46[_0x9d16('0xaf')][_0xf93b6b][_0x9d16('0xb8')]));_0x2ef35a[_0x9d16('0x8f')](_0x59822e('openchannel',_0x792c46[_0x9d16('0xaf')][_0xf93b6b]['dataValues']));_0x2ef35a[_0x9d16('0x8f')](_0x59822e('whatsapp',_0x792c46['rows'][_0xf93b6b]['dataValues']));}return Promise['all'](_0x2ef35a)[_0x9d16('0xb')](function(){return _0x792c46;});}return _0x792c46;});}});}}});}; \ No newline at end of file +var _0x8983=['AnalyticExtractedReport','Reports','AnalyticMetric','charAt','toUpperCase','Sequelize','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','raw','section','mergeResources','isEmpty','length','UserProfileSection','params','all','ignore','autoAssociation','push','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','VIRTUAL','foreignKey','find','options','forEach','reportType','default','reportId','DefaultReports','custom','count','rows','ids','customSorting','extraQueryConditions','Tags','tag','ThroughTags','color','include','openTabs','true','chat','sms','fax','dataValues','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','name','resolve','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','Telephones','VoiceQueues','type','inbound','QueueCampaigns','queue','VoiceQueue','outbound','musiconholds','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelAccount','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Interval','pauses','scheduler','sounds','tags','Tag','templates','Template','Trigger','variables','Variable','plugins','Plugin'];(function(_0x28561e,_0x442fde){var _0x482018=function(_0x4097bc){while(--_0x4097bc){_0x28561e['push'](_0x28561e['shift']());}};_0x482018(++_0x442fde);}(_0x8983,0x1c6));var _0x3898=function(_0x5c70fa,_0x3622ad){_0x5c70fa=_0x5c70fa-0x0;var _0x18b7d2=_0x8983[_0x5c70fa];return _0x18b7d2;};'use strict';var _=require('lodash');var attributes=require(_0x3898('0x0'));var qs=require(_0x3898('0x1'));var squel=require(_0x3898('0x2'));module[_0x3898('0x3')]=function(_0x13c763){var _0x495ad0=_0x13c763[_0x3898('0x4')];function _0x3bf85e(_0x399b6d,_0x5098a4){return new Promise(function(_0x33b9bf,_0x5660b2){if(!_0x5098a4)return _0x33b9bf(null);var _0x3f5a6a=_0x5098a4['filter']?{[_0x5098a4[_0x3898('0x5')][_0x3898('0x6')]]:_0x5098a4['filter'][_0x3898('0x7')]}:undefined;return _0x495ad0[_0x399b6d][_0x3898('0x8')]({'where':_0x3f5a6a,'raw':!![]})[_0x3898('0x9')](function(_0x45ac64){_0x5098a4[_0x3898('0xa')]=_[_0x3898('0xb')](_0x45ac64,'id');_0x33b9bf(_0x5098a4);})[_0x3898('0xc')](function(_0x21ea1f){_0x5660b2(_0x21ea1f);});});}function _0x53336c(_0x437f23,_0x4ef45b){return new Promise(function(_0x5ab51c,_0x866643){var _0x2ede84=_0x437f23[_0x3898('0x5')]?{[_0x437f23[_0x3898('0x5')][_0x3898('0x6')]]:_0x437f23[_0x3898('0x5')][_0x3898('0x7')]}:undefined;return _0x495ad0[_0x437f23['model']][_0x3898('0x8')]({'where':_0x2ede84,'raw':!![]})[_0x3898('0x9')](function(_0x411733){_0x4ef45b['associatedResources']=_[_0x3898('0xb')](_0x411733,function(_0x4a096f){return _0x4a096f[_0x3898('0xd')];});_0x5ab51c(_0x4ef45b);})['catch'](function(_0x3d6871){_0x866643(_0x3d6871);});});}function _0x2f1c8f(_0x5962d9,_0x4ab429,_0x55c767){if(!_0x4ab429)return Promise[_0x3898('0xe')](null);return new Promise(function(_0x15c741,_0x419110){return _0x495ad0['UserProfileResource'][_0x3898('0x8')]({'where':{'sectionId':_0x4ab429['id']},'raw':!![]})[_0x3898('0x9')](function(_0x2794cf){if(_0x5962d9['field']&&_0x5962d9[_0x3898('0x6')]!=='id'){_0x4ab429[_0x3898('0xa')]=_[_0x3898('0xb')](_0x2794cf,function(_0x1fbf1a){return _0x1fbf1a[_0x5962d9[_0x3898('0x6')]];});}else{if(_0x55c767==='AnalyticExtractedReport'){_0x4ab429[_0x3898('0xa')]=_[_0x3898('0xb')](_0x2794cf,function(_0x2ea5a3){return{'id':_0x2ea5a3[_0x3898('0xf')],'type':_0x2ea5a3['type']};});}else{_0x4ab429[_0x3898('0xa')]=_['map'](_0x2794cf,function(_0x3b1c47){return _0x3b1c47['resourceId'];});}}_0x15c741(_0x4ab429);})[_0x3898('0xc')](function(_0x4a7369){_0x419110(_0x4a7369);});});}function _0x13f6ed(_0x320912,_0x356459){var _0x5d71c0={'parentSections':[]};switch(_0x320912[_0x3898('0x10')]()){case _0x3898('0x11'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x13');break;case _0x3898('0x14'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x15');break;case'squarerecordings':_0x5d71c0['childModel']=_0x3898('0x16');_0x5d71c0[_0x3898('0x17')]=[{'name':_0x3898('0x18'),'field':'name','foreignKey':'projectName'}];break;case _0x3898('0x19'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x1a');break;case _0x3898('0x1b'):_0x5d71c0['childModel']=_0x3898('0x1c');_0x5d71c0[_0x3898('0x17')]=[{'name':_0x3898('0x1d'),'field':'id','foreignKey':_0x3898('0x1e')}];break;case _0x3898('0x1f'):_0x5d71c0['childModel']=_0x3898('0x20');break;case _0x3898('0x21'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x22');break;case _0x3898('0x23'):_0x5d71c0[_0x3898('0x12')]='CmCustomField';break;case _0x3898('0x24'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x25');break;case _0x3898('0x26'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x27');break;case _0x3898('0x28'):_0x5d71c0[_0x3898('0x12')]='FaxQueue';break;case _0x3898('0x29'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x2a');break;case _0x3898('0x2b'):case _0x3898('0x2c'):case _0x3898('0x2d'):_0x5d71c0[_0x3898('0x12')]='VoiceExtension';break;case _0x3898('0x2e'):_0x5d71c0['childModel']=_0x3898('0x2f');break;case _0x3898('0x30'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x31');break;case _0x3898('0x32'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x33');_0x5d71c0[_0x3898('0x17')]=[{'name':_0x3898('0x34'),'field':_0x3898('0xd'),'foreignKey':_0x3898('0x35'),'model':_0x3898('0x36'),'filter':{'field':_0x3898('0x37'),'value':['agent']}},{'name':_0x3898('0x38'),'field':_0x3898('0xd'),'foreignKey':_0x3898('0x35'),'model':_0x3898('0x36'),'filter':{'field':_0x3898('0x37'),'value':['telephone']}},{'name':_0x3898('0x39'),'field':_0x3898('0xd'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x3898('0x3a'),'value':[_0x3898('0x3b')]}},{'name':_0x3898('0x3c'),'field':'name','foreignKey':_0x3898('0x3d'),'model':_0x3898('0x3e'),'filter':{'field':'type','value':[_0x3898('0x3f')]}}];break;case _0x3898('0x40'):_0x5d71c0[_0x3898('0x12')]='VoiceMusicOnHold';break;case'chanspies':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x41');break;case _0x3898('0x42'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x43');break;case _0x3898('0x44'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x45');break;case _0x3898('0x46'):_0x5d71c0[_0x3898('0x12')]='MailQueue';break;case _0x3898('0x47'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x48');break;case _0x3898('0x49'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x4a');break;case'openchannelqueues':_0x5d71c0[_0x3898('0x12')]='OpenchannelQueue';break;case'openchannelaccounts':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x4b');break;case'smsqueues':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x4c');break;case'smsaccounts':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x4d');break;case _0x3898('0x4e'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x4f');break;case _0x3898('0x50'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x51');break;case'teams':_0x5d71c0[_0x3898('0x12')]='Team';break;case _0x3898('0x52'):case _0x3898('0x53'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x3e');if(_0x356459){_0x5d71c0['parentSections']=[{'name':'VoiceQueues'},{'name':_0x3898('0x3c')}];}break;case _0x3898('0x54'):case _0x3898('0x55'):case _0x3898('0x56'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x36');if(_0x356459){_0x5d71c0['parentSections']=[{'name':_0x3898('0x57'),'filter':{'field':_0x3898('0x37'),'value':[_0x3898('0x58'),_0x3898('0x59')]},'ignore':!![]},{'name':_0x3898('0x34')},{'name':_0x3898('0x38')}];}break;case _0x3898('0x5a'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x5b');break;case'salesforceaccounts':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x5c');break;case _0x3898('0x5d'):_0x5d71c0[_0x3898('0x12')]='FreshdeskAccount';break;case _0x3898('0x5e'):_0x5d71c0['childModel']=_0x3898('0x5f');break;case _0x3898('0x60'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x61');break;case'zohoaccounts':_0x5d71c0[_0x3898('0x12')]='ZohoAccount';break;case _0x3898('0x62'):_0x5d71c0['childModel']=_0x3898('0x36');break;case _0x3898('0x63'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x64');break;case'dispositions':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x65');break;case _0x3898('0x66'):_0x5d71c0['childModel']='Dashboard';break;case'intervals':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x67');break;case _0x3898('0x68'):_0x5d71c0[_0x3898('0x12')]='Pause';break;case _0x3898('0x69'):_0x5d71c0[_0x3898('0x12')]='Schedule';break;case _0x3898('0x6a'):_0x5d71c0[_0x3898('0x12')]='Sound';break;case _0x3898('0x6b'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x6c');break;case _0x3898('0x6d'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x6e');break;case'triggers':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x6f');break;case'trunks':_0x5d71c0[_0x3898('0x12')]='Trunk';break;case _0x3898('0x70'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x71');break;case _0x3898('0x72'):_0x5d71c0[_0x3898('0x12')]=_0x3898('0x73');break;case'extractedreports':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x74');_0x5d71c0[_0x3898('0x17')]=[{'name':_0x3898('0x75'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x5d71c0[_0x3898('0x12')]=_0x3898('0x76');break;}return _0x5d71c0;}function _0x564a9f(_0xc3690b,_0x5e3e91){var _0x51cb83=_0xc3690b[_0x3898('0x77')](0x0)[_0x3898('0x78')]()+_0xc3690b['slice'](0x1);var _0x5c6da2={'type':_0x495ad0[_0x3898('0x79')]['QueryTypes']['SELECT'],'raw':!![]};return new Promise(function(_0x3959b3,_0x74f4dd){var _0x38267c=squel['select']()[_0x3898('0x6')](_0x3898('0x7a')+_0x51cb83+_0x3898('0x7b'),'id')[_0x3898('0x6')](_0x3898('0x7c'))[_0x3898('0x7d')](_0x3898('0x7e')+_0xc3690b+'_interactions','ui')[_0x3898('0x7f')](_0x3898('0x80'),_0x5e3e91['id']);return _0x495ad0[_0x3898('0x81')][_0x3898('0x82')](_0x38267c[_0x3898('0x83')](),_0x5c6da2)['then'](function(_0xae9e){_0x5e3e91[_0x51cb83+_0x3898('0x84')]=_0xae9e;_0x3959b3(_0xae9e);})[_0x3898('0xc')](function(_0x36df79){_0x74f4dd(_0x36df79);});});}return _0x13c763[_0x3898('0x85')](_0x3898('0x86'),attributes,{'tableName':_0x3898('0x87'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x30eac2){var _0x15147c={'raw':_0x30eac2[_0x3898('0x82')][_0x3898('0x88')],'where':{}};var _0x3a2457={};var _0x445564={'count':0x0,'rows':[]};var _0x31607d=_0x30eac2[_0x3898('0x82')][_0x3898('0x89')];var _0x11b1e8=_0x30eac2[_0x3898('0x82')][_0x3898('0x8a')]||![];var _0x396b87=_0x13f6ed(_0x31607d,_0x11b1e8);if(!_0x396b87[_0x3898('0x12')])throw new Error('Invalid\x20section\x20\x27'+_0x31607d+'\x27');var _0x535606=[{'name':_0x31607d}];if(!_[_0x3898('0x8b')](_0x396b87[_0x3898('0x17')]))_0x535606=_0x396b87[_0x3898('0x17')];var _0x19a4b9=[];for(var _0x4661a4=0x0;_0x4661a4<_0x535606[_0x3898('0x8c')];_0x4661a4++){_0x19a4b9['push'](_0x495ad0[_0x3898('0x8d')]['find']({'where':{'userProfileId':_0x30eac2[_0x3898('0x8e')]['id'],'name':_0x535606[_0x4661a4][_0x3898('0xd')]},'raw':!![]}));}return Promise[_0x3898('0x8f')](_0x19a4b9)[_0x3898('0x9')](function(_0x2381c2){var _0x55049a=_[_0x3898('0x5')](_0x2381c2,function(_0x4ba484){return _0x4ba484?_0x4ba484:undefined;});var _0x435758=_[_0x3898('0x5')](_0x535606,[_0x3898('0x90'),!![]]);var _0x14e6aa=_[_0x3898('0x8b')](_0x55049a)&&_[_0x3898('0x8b')](_0x435758)?null:_['union'](_0x435758,_0x55049a);if(!_0x14e6aa)return null;var _0x4ed9f3=[];for(var _0x131d8e=0x0;_0x131d8e<_0x14e6aa[_0x3898('0x8c')];_0x131d8e++){var _0xcf9d70=_['find'](_0x535606,function(_0x41e5eb){return _0x14e6aa[_0x131d8e]?_0x41e5eb[_0x3898('0xd')]===_0x14e6aa[_0x131d8e][_0x3898('0xd')]:null;});if(_0xcf9d70){if(_0x14e6aa[_0x131d8e][_0x3898('0x90')]){_0x4ed9f3['push'](_0x3bf85e(_0x396b87[_0x3898('0x12')],_0x14e6aa[_0x131d8e]));}else{if(!_0x14e6aa[_0x131d8e][_0x3898('0x91')]){_0x4ed9f3[_0x3898('0x92')](_0x2f1c8f(_0xcf9d70,_0x14e6aa[_0x131d8e],_0x396b87[_0x3898('0x12')]));}else{if(_0xcf9d70[_0x3898('0x93')]){_0x4ed9f3[_0x3898('0x92')](_0x53336c(_0xcf9d70,_0x14e6aa[_0x131d8e]));}}}}}return Promise[_0x3898('0x8f')](_0x4ed9f3);})[_0x3898('0x9')](function(_0x5d129b){var _0x245034=_0x5d129b;var _0x35d3b2=null;if(_0x245034){_0x35d3b2=_0x245034[_0x3898('0x8c')]===0x1?_0x245034[0x0]:null;}if(!_0x35d3b2&&!_0x245034)return _0x445564;var _0x424ebe=_0x495ad0[_0x396b87['childModel']][_0x3898('0x94')];_0x3a2457['model']=_[_0x3898('0x95')](_0x424ebe);_0x3a2457['query']=_[_0x3898('0x95')](_0x30eac2[_0x3898('0x82')]);_0x3a2457[_0x3898('0x96')]=_[_0x3898('0x97')](_0x3a2457[_0x3898('0x93')],_0x3a2457[_0x3898('0x82')]);_0x15147c[_0x3898('0x98')]=_[_0x3898('0x97')](_0x3a2457[_0x3898('0x93')],qs[_0x3898('0x99')](_0x30eac2[_0x3898('0x82')]['fields']));_0x15147c['attributes']=_0x15147c[_0x3898('0x98')]['length']?_0x15147c[_0x3898('0x98')]:_0x3a2457[_0x3898('0x93')];if(!_0x30eac2[_0x3898('0x82')][_0x3898('0x9a')](_0x3898('0x9b'))){_0x15147c['limit']=qs[_0x3898('0x9c')](_0x30eac2[_0x3898('0x82')][_0x3898('0x9c')]);_0x15147c[_0x3898('0x9d')]=qs[_0x3898('0x9d')](_0x30eac2[_0x3898('0x82')]['offset']);}_0x15147c[_0x3898('0x9e')]=qs[_0x3898('0x9f')](_0x30eac2[_0x3898('0x82')]['sort']);_0x15147c['where']=qs[_0x3898('0x96')](_[_0x3898('0xa0')](_0x30eac2[_0x3898('0x82')],_0x3a2457[_0x3898('0x96')]));if(_0x30eac2[_0x3898('0x82')]['filter']){_0x15147c[_0x3898('0x7f')]=_[_0x3898('0xa1')](_0x15147c[_0x3898('0x7f')],{'$or':_[_0x3898('0xb')](_0x424ebe,function(_0x27dc6d){if(_0x27dc6d['type']['key']!==_0x3898('0xa2')){var _0x29cc5d={};_0x29cc5d[_0x27dc6d['field']]={'$like':'%'+_0x30eac2[_0x3898('0x82')]['filter']+'%'};return _0x29cc5d;}})});}var _0x5148f7=[];var _0x480d0f=null;var _0x50b908={};if(_0x35d3b2){_0x480d0f=_['find'](_0x535606,[_0x3898('0xd'),_0x35d3b2[_0x3898('0xd')]]);if(_0x480d0f[_0x3898('0x6')]){_0x50b908={};if(_0x396b87[_0x3898('0x12')]===_0x3898('0x74')){_0x50b908[_0x480d0f[_0x3898('0xa3')]]=_[_0x3898('0xb')](_0x35d3b2['associatedResources'],'id');}else{_0x50b908[_0x480d0f['foreignKey']]=_0x35d3b2['associatedResources'];}_0x5148f7[_0x3898('0x92')](_0x50b908);}else{_0x15147c['where']['id']=_0x35d3b2['associatedResources'];}}else{for(var _0x43b30f=0x0;_0x43b30f<_0x245034[_0x3898('0x8c')];_0x43b30f++){_0x480d0f=_[_0x3898('0xa4')](_0x535606,[_0x3898('0xd'),_0x245034[_0x43b30f][_0x3898('0xd')]]);if(_0x480d0f[_0x3898('0x6')]){_0x50b908={};_0x50b908[_0x480d0f[_0x3898('0xa3')]]=_0x245034[_0x43b30f][_0x3898('0xa')];_0x5148f7[_0x3898('0x92')](_0x50b908);}else{if(!_0x15147c[_0x3898('0x7f')]['id'])_0x15147c[_0x3898('0x7f')]['id']=[];_0x245034[_0x43b30f][_0x3898('0xa')]['forEach'](function(_0x359dd7){_0x15147c[_0x3898('0x7f')]['id']['push'](_0x359dd7);});}}}if(!_[_0x3898('0x8b')](_0x5148f7)){_0x15147c['where']=_[_0x3898('0xa1')](_0x15147c[_0x3898('0x7f')],{'$and':{'$or':_0x5148f7}});}_0x15147c=_[_0x3898('0xa1')]({},_0x15147c,_0x30eac2[_0x3898('0xa5')]);if(_0x35d3b2&&!_0x35d3b2[_0x3898('0x91')]&&_0x396b87['childModel']===_0x3898('0x74')){if(_0x30eac2['query']['includeAll']){_0x15147c['include']=[{'all':!![]}];}return _0x495ad0[_0x396b87[_0x3898('0x12')]][_0x3898('0x8')](_0x15147c)[_0x3898('0x9')](function(_0x4afd79){var _0x24d87d=[];_0x4afd79[_0x3898('0xa6')](function(_0x1a1185){var _0x49b054;switch(_0x1a1185[_0x3898('0xa7')]){case _0x3898('0xa8'):_0x49b054=_[_0x3898('0xa4')](_0x35d3b2[_0x3898('0xa')],function(_0x20cbf3){return _0x20cbf3['id']===_0x1a1185[_0x3898('0xa9')]&&_0x20cbf3[_0x3898('0x3a')]===_0x3898('0xaa');});break;case _0x3898('0xab'):_0x49b054=_['find'](_0x35d3b2[_0x3898('0xa')],function(_0x176eb3){return _0x176eb3['id']===_0x1a1185[_0x3898('0xa9')]&&_0x176eb3[_0x3898('0x3a')]==='CustomReports';});break;}if(_0x49b054)_0x24d87d[_0x3898('0x92')](_0x1a1185);});_0x445564[_0x3898('0xac')]=_0x24d87d['length'];_0x445564[_0x3898('0xad')]=_0x24d87d;return _0x445564;});}else{if(!_['isEmpty'](_0x30eac2[_0x3898('0x82')][_0x3898('0xae')])){_0x15147c[_0x3898('0x7f')]['id']=_0x15147c['where']['id']?_[_0x3898('0x97')](_0x15147c[_0x3898('0x7f')]['id'],_0x30eac2[_0x3898('0x82')][_0x3898('0xae')]):_0x30eac2[_0x3898('0x82')][_0x3898('0xae')];if(_0x30eac2[_0x3898('0x82')][_0x3898('0xaf')]){_0x15147c[_0x3898('0x9e')]=_0x30eac2['query']['customSorting'];}}if(_0x30eac2[_0x3898('0x82')]['extraQueryConditions']){_0x15147c['where']=_[_0x3898('0xa1')](_0x15147c[_0x3898('0x7f')],{'$and':_0x30eac2[_0x3898('0x82')][_0x3898('0xb0')]});}return _0x495ad0[_0x396b87[_0x3898('0x12')]][_0x3898('0xac')]({'where':_0x15147c['where']})[_0x3898('0x9')](function(_0x527d2e){_0x445564['count']=_0x527d2e;if(_0x30eac2[_0x3898('0x82')]['includeAll']){if(_0x396b87['childModel']===_0x3898('0x1c')){_0x15147c['include']=[{'model':_0x495ad0[_0x3898('0x6c')],'as':_0x3898('0xb1'),'attributes':['id',_0x3898('0xd'),'color'],'required':_0x30eac2['query'][_0x3898('0xb2')]?!![]:![]},{'model':_0x495ad0[_0x3898('0x6c')],'as':_0x3898('0xb3'),'attributes':['id',_0x3898('0xd'),_0x3898('0xb4')],'through':_0x30eac2[_0x3898('0x82')][_0x3898('0xb2')]?{'attributes':[],'where':{'TagId':_0x30eac2[_0x3898('0x82')][_0x3898('0xb2')]||undefined}}:{},'required':_0x30eac2['query'][_0x3898('0xb2')]?!![]:![]}];}else{_0x15147c[_0x3898('0xb5')]=[{'all':!![]}];}}return _0x495ad0[_0x396b87[_0x3898('0x12')]]['findAll'](_0x15147c);})[_0x3898('0x9')](function(_0x1bcaac){_0x445564[_0x3898('0xad')]=_0x1bcaac;if(_0x31607d===_0x3898('0x34')&&_0x30eac2['query'][_0x3898('0xb6')]===_0x3898('0xb7')){var _0x449141=[];for(var _0x41030d=0x0;_0x41030d<_0x445564['rows'][_0x3898('0x8c')];_0x41030d++){_0x449141[_0x3898('0x92')](_0x564a9f(_0x3898('0xb8'),_0x445564[_0x3898('0xad')][_0x41030d]['dataValues']));_0x449141[_0x3898('0x92')](_0x564a9f(_0x3898('0xb9'),_0x445564[_0x3898('0xad')][_0x41030d]['dataValues']));_0x449141[_0x3898('0x92')](_0x564a9f(_0x3898('0xba'),_0x445564[_0x3898('0xad')][_0x41030d]['dataValues']));_0x449141[_0x3898('0x92')](_0x564a9f('mail',_0x445564[_0x3898('0xad')][_0x41030d][_0x3898('0xbb')]));_0x449141['push'](_0x564a9f(_0x3898('0xbc'),_0x445564[_0x3898('0xad')][_0x41030d][_0x3898('0xbb')]));_0x449141['push'](_0x564a9f(_0x3898('0xbd'),_0x445564[_0x3898('0xad')][_0x41030d][_0x3898('0xbb')]));}return Promise[_0x3898('0x8f')](_0x449141)[_0x3898('0x9')](function(){return _0x445564;});}return _0x445564;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 7a78adb..d13f985 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 _0x4744=['defaults','localhost','socket.io-emitter','register','request','request\x20sent','debug','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis'];(function(_0x55df79,_0x55b40d){var _0xcd674b=function(_0x29153e){while(--_0x29153e){_0x55df79['push'](_0x55df79['shift']());}};_0xcd674b(++_0x55b40d);}(_0x4744,0x107));var _0x4474=function(_0x4d0b17,_0x5e435b){_0x4d0b17=_0x4d0b17-0x0;var _0x1138a3=_0x4744[_0x4d0b17];return _0x1138a3;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))(_0x4474('0x8'));var config=require(_0x4474('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4474('0xa')]({'port':0x232a});config[_0x4474('0xb')]=_[_0x4474('0xc')](config[_0x4474('0xb')],{'host':_0x4474('0xd'),'port':0x18eb});var socket=require(_0x4474('0xe'))(new Redis(config[_0x4474('0xb')]));require('./userProfile.socket')[_0x4474('0xf')](socket);function respondWithRpcPromise(_0x191634,_0x34bbd3,_0x2cefd3){return new BPromise(function(_0x1e14ad,_0x3aab8f){return client[_0x4474('0x10')](_0x191634,_0x2cefd3)['then'](function(_0x4f880c){logger['info']('UserProfile,\x20%s,\x20%s',_0x34bbd3,_0x4474('0x11'));logger[_0x4474('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x34bbd3,_0x4474('0x11'),JSON['stringify'](_0x4f880c));if(_0x4f880c[_0x4474('0x13')]){if(_0x4f880c[_0x4474('0x13')][_0x4474('0x14')]===0x1f4){logger[_0x4474('0x13')](_0x4474('0x15'),_0x34bbd3,_0x4f880c[_0x4474('0x13')][_0x4474('0x16')]);return _0x3aab8f(_0x4f880c[_0x4474('0x13')][_0x4474('0x16')]);}logger['error'](_0x4474('0x15'),_0x34bbd3,_0x4f880c['error']['message']);return _0x1e14ad(_0x4f880c[_0x4474('0x13')][_0x4474('0x16')]);}else{logger['info'](_0x4474('0x15'),_0x34bbd3,_0x4474('0x11'));_0x1e14ad(_0x4f880c[_0x4474('0x17')][_0x4474('0x16')]);}})[_0x4474('0x18')](function(_0x249ae0){logger['error'](_0x4474('0x15'),_0x34bbd3,_0x249ae0);_0x3aab8f(_0x249ae0);});});} \ No newline at end of file +var _0xfd2e=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xfd2e,0x6e));var _0xefd2=function(_0x5cf46e,_0x202473){_0x5cf46e=_0x5cf46e-0x0;var _0x4b8729=_0xfd2e[_0x5cf46e];return _0x4b8729;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xefd2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xefd2('0xa'))(new Redis(config[_0xefd2('0x9')]));require(_0xefd2('0xb'))[_0xefd2('0xc')](socket);function respondWithRpcPromise(_0xa787ba,_0x2d7d0d,_0x602f0){return new BPromise(function(_0x490a6d,_0x2d8eff){return client[_0xefd2('0xd')](_0xa787ba,_0x602f0)[_0xefd2('0xe')](function(_0x14de17){logger[_0xefd2('0xf')](_0xefd2('0x10'),_0x2d7d0d,_0xefd2('0x11'));logger[_0xefd2('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2d7d0d,'request\x20sent',JSON[_0xefd2('0x13')](_0x14de17));if(_0x14de17['error']){if(_0x14de17['error'][_0xefd2('0x14')]===0x1f4){logger[_0xefd2('0x15')](_0xefd2('0x10'),_0x2d7d0d,_0x14de17[_0xefd2('0x15')][_0xefd2('0x16')]);return _0x2d8eff(_0x14de17['error'][_0xefd2('0x16')]);}logger[_0xefd2('0x15')](_0xefd2('0x10'),_0x2d7d0d,_0x14de17[_0xefd2('0x15')][_0xefd2('0x16')]);return _0x490a6d(_0x14de17[_0xefd2('0x15')]['message']);}else{logger['info'](_0xefd2('0x10'),_0x2d7d0d,_0xefd2('0x11'));_0x490a6d(_0x14de17[_0xefd2('0x17')][_0xefd2('0x16')]);}})[_0xefd2('0x18')](function(_0x5080a8){logger[_0xefd2('0x15')](_0xefd2('0x10'),_0x2d7d0d,_0x5080a8);_0x2d8eff(_0x5080a8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 0524dde..af7b008 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 _0x0cc5=['userProfile:','save','remove','update','emit','register','length'];(function(_0xd9442a,_0x29628a){var _0xd3a253=function(_0x2b24e8){while(--_0x2b24e8){_0xd9442a['push'](_0xd9442a['shift']());}};_0xd3a253(++_0x29628a);}(_0x0cc5,0x12e));var _0x50cc=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0x0cc5[_0x1d7300];return _0x46ee98;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x50cc('0x0'),_0x50cc('0x1'),_0x50cc('0x2')];function createListener(_0x1814ac,_0x17762b){return function(_0x11adf1){_0x17762b[_0x50cc('0x3')](_0x1814ac,_0x11adf1);};}function removeListener(_0x27a96c,_0x247ab5){return function(){UserProfileEvents['removeListener'](_0x27a96c,_0x247ab5);};}exports[_0x50cc('0x4')]=function(_0x45ee7e){for(var _0x45749a=0x0,_0xc66fc9=events[_0x50cc('0x5')];_0x45749a<_0xc66fc9;_0x45749a++){var _0x501b31=events[_0x45749a];var _0x775bda=createListener(_0x50cc('0x6')+_0x501b31,_0x45ee7e);UserProfileEvents['on'](_0x501b31,_0x775bda);}}; \ No newline at end of file +var _0x240a=['removeListener','register','length','./userProfile.events','remove'];(function(_0x43cec0,_0x268416){var _0x1de61d=function(_0x2b1e42){while(--_0x2b1e42){_0x43cec0['push'](_0x43cec0['shift']());}};_0x1de61d(++_0x268416);}(_0x240a,0xda));var _0xa240=function(_0x11b00e,_0x153b56){_0x11b00e=_0x11b00e-0x0;var _0x38aa3c=_0x240a[_0x11b00e];return _0x38aa3c;};'use strict';var UserProfileEvents=require(_0xa240('0x0'));var events=['save',_0xa240('0x1'),'update'];function createListener(_0x7b8771,_0x22aad6){return function(_0x43294d){_0x22aad6['emit'](_0x7b8771,_0x43294d);};}function removeListener(_0x26401f,_0x11362a){return function(){UserProfileEvents[_0xa240('0x2')](_0x26401f,_0x11362a);};}exports[_0xa240('0x3')]=function(_0x2d58d0){for(var _0x3b9f2c=0x0,_0x46d275=events[_0xa240('0x4')];_0x3b9f2c<_0x46d275;_0x3b9f2c++){var _0x295ca9=events[_0x3b9f2c];var _0x34de0f=createListener('userProfile:'+_0x295ca9,_0x2d58d0);UserProfileEvents['on'](_0x295ca9,_0x34de0f);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 3dd4c06..cd33193 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 _0x943f=['post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','index','describe'];(function(_0x144a3b,_0x4d2102){var _0x399fa2=function(_0x4f38eb){while(--_0x4f38eb){_0x144a3b['push'](_0x144a3b['shift']());}};_0x399fa2(++_0x4d2102);}(_0x943f,0x181));var _0xf943=function(_0x1a9a21,_0x56d62b){_0x1a9a21=_0x1a9a21-0x0;var _0x55c1ce=_0x943f[_0x1a9a21];return _0x55c1ce;};'use strict';var multer=require(_0xf943('0x0'));var util=require('util');var path=require(_0xf943('0x1'));var timeout=require(_0xf943('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf943('0x3'));var interaction=require(_0xf943('0x4'));var config=require(_0xf943('0x5'));var controller=require(_0xf943('0x6'));router[_0xf943('0x7')]('/',auth[_0xf943('0x8')](),controller[_0xf943('0x9')]);router[_0xf943('0x7')]('/describe',auth['isAuthenticated'](),controller[_0xf943('0xa')]);router['get']('/:id',auth[_0xf943('0x8')](),controller['show']);router[_0xf943('0xb')]('/',auth[_0xf943('0x8')](),controller['create']);router[_0xf943('0xc')](_0xf943('0xd'),auth[_0xf943('0x8')](),controller[_0xf943('0xe')]);router[_0xf943('0xf')]('/:id',auth[_0xf943('0x8')](),controller[_0xf943('0x10')]);module[_0xf943('0x11')]=router; \ No newline at end of file +var _0x8e8e=['/:id','show','post','create','update','delete','destroy','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x172ca8,_0x3b3d24){var _0x5628a6=function(_0x27a67e){while(--_0x27a67e){_0x172ca8['push'](_0x172ca8['shift']());}};_0x5628a6(++_0x3b3d24);}(_0x8e8e,0x16c));var _0xe8e8=function(_0x596f6e,_0x224688){_0x596f6e=_0x596f6e-0x0;var _0x292530=_0x8e8e[_0x596f6e];return _0x292530;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe8e8('0x0'));var router=express[_0xe8e8('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xe8e8('0x2'));var interaction=require(_0xe8e8('0x3'));var config=require(_0xe8e8('0x4'));var controller=require('./userProfileResource.controller');router[_0xe8e8('0x5')]('/',auth[_0xe8e8('0x6')](),controller[_0xe8e8('0x7')]);router[_0xe8e8('0x5')](_0xe8e8('0x8'),auth[_0xe8e8('0x6')](),controller[_0xe8e8('0x9')]);router[_0xe8e8('0x5')](_0xe8e8('0xa'),auth['isAuthenticated'](),controller[_0xe8e8('0xb')]);router[_0xe8e8('0xc')]('/',auth[_0xe8e8('0x6')](),controller[_0xe8e8('0xd')]);router['put']('/:id',auth[_0xe8e8('0x6')](),controller[_0xe8e8('0xe')]);router[_0xe8e8('0xf')](_0xe8e8('0xa'),auth[_0xe8e8('0x6')](),controller[_0xe8e8('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 4fa945e..6535ffa 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 _0x0ae7=['sequelize','exports','INTEGER'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0ae7,0xe1));var _0x70ae=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x0ae7[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0x70ae('0x0'));module[_0x70ae('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0x70ae('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xea85=['INTEGER','exports','STRING'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0xea85,0x103));var _0x5ea8=function(_0x590fb7,_0x346b15){_0x590fb7=_0x590fb7-0x0;var _0x43ae16=_0xea85[_0x590fb7];return _0x43ae16;};'use strict';var Sequelize=require('sequelize');module[_0x5ea8('0x0')]={'name':{'type':Sequelize[_0x5ea8('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5ea8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5ea8('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 8b0e5a3..3205726 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 _0xc4aa=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x35bd6c,_0x585087){var _0x2f421d=function(_0x42ae70){while(--_0x42ae70){_0x35bd6c['push'](_0x35bd6c['shift']());}};_0x2f421d(++_0x585087);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));};exports[_0xac4a('0x4c')]=function(_0x26e716,_0x3ac36e){return db['UserProfileResource'][_0xac4a('0x4c')]()[_0xac4a('0x24')](respondWithResult(_0x3ac36e,null))[_0xac4a('0x44')](handleError(_0x3ac36e,null));}; \ No newline at end of file +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(_0xdf61e0,_0x4f8125){var _0x14e572=function(_0x3f2af9){while(--_0x3f2af9){_0xdf61e0['push'](_0xdf61e0['shift']());}};_0x14e572(++_0x4f8125);}(_0x9582,0x95));var _0x2958=function(_0x3661fa,_0x4bee92){_0x3661fa=_0x3661fa-0x0;var _0x23246a=_0x9582[_0x3661fa];return _0x23246a;};'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 diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index c8befbd..0074507 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 _0x8a03=['../../config/environment','./userProfileResource.attributes','UserProfileResource','compositeIndex','sectionId','lodash','util','moment','path','rimraf'];(function(_0x549c9a,_0x213785){var _0x56c2f9=function(_0x9e70e2){while(--_0x9e70e2){_0x549c9a['push'](_0x549c9a['shift']());}};_0x56c2f9(++_0x213785);}(_0x8a03,0xcd));var _0x38a0=function(_0x9ffe74,_0x57d477){_0x9ffe74=_0x9ffe74-0x0;var _0x220cfa=_0x8a03[_0x9ffe74];return _0x220cfa;};'use strict';var _=require(_0x38a0('0x0'));var util=require(_0x38a0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x38a0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x38a0('0x3'));var rimraf=require(_0x38a0('0x4'));var config=require(_0x38a0('0x5'));var attributes=require(_0x38a0('0x6'));module['exports']=function(_0x39d7c6,_0x4c4ecb){return _0x39d7c6['define'](_0x38a0('0x7'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x38a0('0x8'),'fields':['resourceId',_0x38a0('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0eab=['../../config/environment','./userProfileResource.attributes','exports','UserProfileResource','resourceId','sectionId','util','../../config/logger','api','request-promise','path'];(function(_0x3bd71c,_0x4aaf56){var _0x2a7c21=function(_0x4610b5){while(--_0x4610b5){_0x3bd71c['push'](_0x3bd71c['shift']());}};_0x2a7c21(++_0x4aaf56);}(_0x0eab,0xed));var _0xb0ea=function(_0x36b107,_0x35aa09){_0x36b107=_0x36b107-0x0;var _0x3365de=_0x0eab[_0x36b107];return _0x3365de;};'use strict';var _=require('lodash');var util=require(_0xb0ea('0x0'));var logger=require(_0xb0ea('0x1'))(_0xb0ea('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb0ea('0x3'));var fs=require('fs');var path=require(_0xb0ea('0x4'));var rimraf=require('rimraf');var config=require(_0xb0ea('0x5'));var attributes=require(_0xb0ea('0x6'));module[_0xb0ea('0x7')]=function(_0x5e5aa6,_0x2af7a2){return _0x5e5aa6['define'](_0xb0ea('0x8'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xb0ea('0x9'),_0xb0ea('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 99dc359..83913ad 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 _0x6463=['error','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5550b3,_0x2d0ee0){var _0x4b8fc4=function(_0x22393a){while(--_0x22393a){_0x5550b3['push'](_0x5550b3['shift']());}};_0x4b8fc4(++_0x2d0ee0);}(_0x6463,0xe9));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3646('0x0'));var moment=require('moment');var BPromise=require(_0x3646('0x1'));var rs=require(_0x3646('0x2'));var fs=require('fs');var Redis=require(_0x3646('0x3'));var db=require(_0x3646('0x4'))['db'];var utils=require(_0x3646('0x5'));var logger=require('../../config/logger')(_0x3646('0x6'));var config=require(_0x3646('0x7'));var jayson=require(_0x3646('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x253908,_0x38a2dc,_0x54e64c){return new BPromise(function(_0x4a5e60,_0x29c528){return client[_0x3646('0x9')](_0x253908,_0x54e64c)[_0x3646('0xa')](function(_0xd8a128){logger['info'](_0x3646('0xb'),_0x38a2dc,_0x3646('0xc'));logger['debug']('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x38a2dc,_0x3646('0xc'),JSON[_0x3646('0xd')](_0xd8a128));if(_0xd8a128[_0x3646('0xe')]){if(_0xd8a128[_0x3646('0xe')]['code']===0x1f4){logger['error'](_0x3646('0xb'),_0x38a2dc,_0xd8a128[_0x3646('0xe')][_0x3646('0xf')]);return _0x29c528(_0xd8a128[_0x3646('0xe')][_0x3646('0xf')]);}logger[_0x3646('0xe')](_0x3646('0xb'),_0x38a2dc,_0xd8a128[_0x3646('0xe')][_0x3646('0xf')]);return _0x4a5e60(_0xd8a128[_0x3646('0xe')]['message']);}else{logger[_0x3646('0x10')](_0x3646('0xb'),_0x38a2dc,_0x3646('0xc'));_0x4a5e60(_0xd8a128[_0x3646('0x11')][_0x3646('0xf')]);}})[_0x3646('0x12')](function(_0x321749){logger[_0x3646('0xe')](_0x3646('0xb'),_0x38a2dc,_0x321749);_0x29c528(_0x321749);});});} \ No newline at end of file +var _0x698b=['debug','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x30227e,_0x5bc972){var _0x2b87b0=function(_0x5d4334){while(--_0x5d4334){_0x30227e['push'](_0x30227e['shift']());}};_0x2b87b0(++_0x5bc972);}(_0x698b,0x80));var _0xb698=function(_0xd50b22,_0x4d2692){_0xd50b22=_0xd50b22-0x0;var _0xd6c86f=_0x698b[_0xd50b22];return _0xd6c86f;};'use strict';var _=require(_0xb698('0x0'));var util=require('util');var moment=require(_0xb698('0x1'));var BPromise=require(_0xb698('0x2'));var rs=require(_0xb698('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb698('0x4'))['db'];var utils=require(_0xb698('0x5'));var logger=require(_0xb698('0x6'))(_0xb698('0x7'));var config=require(_0xb698('0x8'));var jayson=require(_0xb698('0x9'));var client=jayson[_0xb698('0xa')][_0xb698('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5edd28,_0x5a45d2,_0x5d9d84){return new BPromise(function(_0x2847a1,_0x450f71){return client[_0xb698('0xc')](_0x5edd28,_0x5d9d84)[_0xb698('0xd')](function(_0x308321){logger['info'](_0xb698('0xe'),_0x5a45d2,_0xb698('0xf'));logger[_0xb698('0x10')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x5a45d2,_0xb698('0xf'),JSON[_0xb698('0x11')](_0x308321));if(_0x308321['error']){if(_0x308321[_0xb698('0x12')][_0xb698('0x13')]===0x1f4){logger[_0xb698('0x12')](_0xb698('0xe'),_0x5a45d2,_0x308321[_0xb698('0x12')][_0xb698('0x14')]);return _0x450f71(_0x308321[_0xb698('0x12')]['message']);}logger[_0xb698('0x12')](_0xb698('0xe'),_0x5a45d2,_0x308321[_0xb698('0x12')]['message']);return _0x2847a1(_0x308321[_0xb698('0x12')][_0xb698('0x14')]);}else{logger[_0xb698('0x15')](_0xb698('0xe'),_0x5a45d2,_0xb698('0xf'));_0x2847a1(_0x308321[_0xb698('0x16')]['message']);}})[_0xb698('0x17')](function(_0x41daad){logger[_0xb698('0x12')](_0xb698('0xe'),_0x5a45d2,_0x41daad);_0x450f71(_0x41daad);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index acb53b8..52ac064 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 _0x126c=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get'];(function(_0x55b1f5,_0x450e6d){var _0x1557d4=function(_0x114154){while(--_0x114154){_0x55b1f5['push'](_0x55b1f5['shift']());}};_0x1557d4(++_0x450e6d);}(_0x126c,0x64));var _0xc126=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x126c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc126('0x0'));var util=require(_0xc126('0x1'));var path=require(_0xc126('0x2'));var timeout=require('connect-timeout');var express=require(_0xc126('0x3'));var router=express[_0xc126('0x4')]();var fs_extra=require(_0xc126('0x5'));var auth=require(_0xc126('0x6'));var interaction=require(_0xc126('0x7'));var config=require('../../config/environment');var controller=require(_0xc126('0x8'));router[_0xc126('0x9')]('/',auth[_0xc126('0xa')](),controller[_0xc126('0xb')]);router['get'](_0xc126('0xc'),auth[_0xc126('0xa')](),controller[_0xc126('0xd')]);router['get'](_0xc126('0xe'),auth[_0xc126('0xa')](),controller[_0xc126('0xf')]);router[_0xc126('0x10')]('/',auth[_0xc126('0xa')](),controller[_0xc126('0x11')]);router[_0xc126('0x12')]('/:id',auth[_0xc126('0xa')](),controller[_0xc126('0x13')]);router['delete']('/:id',auth[_0xc126('0xa')](),controller[_0xc126('0x14')]);module[_0xc126('0x15')]=router; \ No newline at end of file +var _0x948e=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','post','create','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0x31c0e5,_0x472b48){var _0x16dce4=function(_0x3fe675){while(--_0x3fe675){_0x31c0e5['push'](_0x31c0e5['shift']());}};_0x16dce4(++_0x472b48);}(_0x948e,0x1d0));var _0xe948=function(_0x1bb2c5,_0x5a3a8f){_0x1bb2c5=_0x1bb2c5-0x0;var _0x50782b=_0x948e[_0x1bb2c5];return _0x50782b;};'use strict';var multer=require(_0xe948('0x0'));var util=require(_0xe948('0x1'));var path=require(_0xe948('0x2'));var timeout=require(_0xe948('0x3'));var express=require(_0xe948('0x4'));var router=express[_0xe948('0x5')]();var fs_extra=require(_0xe948('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe948('0x7'));var config=require(_0xe948('0x8'));var controller=require('./userProfileSection.controller');router[_0xe948('0x9')]('/',auth[_0xe948('0xa')](),controller['index']);router[_0xe948('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe948('0xb')]);router[_0xe948('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xe948('0xc')]('/',auth[_0xe948('0xa')](),controller[_0xe948('0xd')]);router['put']('/:id',auth[_0xe948('0xa')](),controller[_0xe948('0xe')]);router[_0xe948('0xf')](_0xe948('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0xe948('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 0d5f47f..4f7d7d3 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 _0xb574=['BOOLEAN','setDataValue','crudPermissions','sequelize','exports','STRING','INTEGER'];(function(_0x622aa8,_0x1025d1){var _0x308e81=function(_0x1e8a67){while(--_0x1e8a67){_0x622aa8['push'](_0x622aa8['shift']());}};_0x308e81(++_0x1025d1);}(_0xb574,0x106));var _0x4b57=function(_0x174fc3,_0x3f56d8){_0x174fc3=_0x174fc3-0x0;var _0xd373cb=_0xb574[_0x174fc3];return _0xd373cb;};'use strict';var Sequelize=require(_0x4b57('0x0'));module[_0x4b57('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x4b57('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x4b57('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x4b57('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x4b57('0x2')],'set':function(_0x168524){this[_0x4b57('0x5')](_0x4b57('0x6'),_0x168524?_0x168524['join'](''):[]);},'get':function(){return this['getDataValue'](_0x4b57('0x6'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file +var _0xb9be=['exports','STRING','INTEGER','BOOLEAN','join','getDataValue','crudPermissions','split','sequelize'];(function(_0x9de4b2,_0x57b840){var _0x6d37fb=function(_0x259214){while(--_0x259214){_0x9de4b2['push'](_0x9de4b2['shift']());}};_0x6d37fb(++_0x57b840);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xb9be[_0x3ce2c4];return _0x4047c1;};'use strict';var Sequelize=require(_0xeb9b('0x0'));module[_0xeb9b('0x1')]={'name':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xeb9b('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xeb9b('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xeb9b('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xeb9b('0x2')],'set':function(_0x288aaa){this['setDataValue']('crudPermissions',_0x288aaa?_0x288aaa[_0xeb9b('0x5')](''):[]);},'get':function(){return this[_0xeb9b('0x6')](_0xeb9b('0x7'))?this['getDataValue'](_0xeb9b('0x7'))[_0xeb9b('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index cb75517..0a99207 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 _0xf4d1=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4b92b9,_0x1bd47d){var _0x157b9d=function(_0x41d8e4){while(--_0x41d8e4){_0x4b92b9['push'](_0x4b92b9['shift']());}};_0x157b9d(++_0x1bd47d);}(_0xf4d1,0xc5));var _0x1f4d=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xf4d1[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0x1f4d('0x0'));var rimraf=require(_0x1f4d('0x1'));var zipdir=require(_0x1f4d('0x2'));var jsonpatch=require(_0x1f4d('0x3'));var rp=require(_0x1f4d('0x4'));var moment=require(_0x1f4d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x1f4d('0x6'));var util=require(_0x1f4d('0x7'));var path=require(_0x1f4d('0x8'));var sox=require('sox');var csv=require(_0x1f4d('0x9'));var ejs=require(_0x1f4d('0xa'));var fs=require('fs');var fs_extra=require(_0x1f4d('0xb'));var _=require('lodash');var squel=require(_0x1f4d('0xc'));var crypto=require(_0x1f4d('0xd'));var jsforce=require(_0x1f4d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1f4d('0x9'));var querystring=require(_0x1f4d('0xf'));var Papa=require('papaparse');var Redis=require(_0x1f4d('0x10'));var authService=require(_0x1f4d('0x11'));var qs=require(_0x1f4d('0x12'));var as=require(_0x1f4d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f4d('0x14'))(_0x1f4d('0x15'));var utils=require(_0x1f4d('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1f4d('0x17'))['db'];function respondWithStatusCode(_0x123ac8,_0x1c07c3){_0x1c07c3=_0x1c07c3||0xcc;return function(_0x4ec981){if(_0x4ec981){return _0x123ac8[_0x1f4d('0x18')](_0x1c07c3);}return _0x123ac8[_0x1f4d('0x19')](_0x1c07c3)[_0x1f4d('0x1a')]();};}function respondWithResult(_0x27be05,_0x21d62f){_0x21d62f=_0x21d62f||0xc8;return function(_0x16be90){if(_0x16be90){return _0x27be05[_0x1f4d('0x19')](_0x21d62f)[_0x1f4d('0x1b')](_0x16be90);}};}function respondWithFilteredResult(_0x3c21b6,_0x4359a3){return function(_0x26eddc){if(_0x26eddc){var _0x49b585=typeof _0x4359a3['offset']===_0x1f4d('0x1c')&&typeof _0x4359a3[_0x1f4d('0x1d')]===_0x1f4d('0x1c');var _0x2a2c88=_0x26eddc[_0x1f4d('0x1e')];var _0x18d1ca=_0x49b585?0x0:_0x4359a3[_0x1f4d('0x1f')];var _0x4a1350=_0x49b585?_0x26eddc[_0x1f4d('0x1e')]:_0x4359a3[_0x1f4d('0x1f')]+_0x4359a3['limit'];var _0x5980fe;if(_0x4a1350>=_0x2a2c88){_0x4a1350=_0x2a2c88;_0x5980fe=0xc8;}else{_0x5980fe=0xce;}_0x3c21b6[_0x1f4d('0x19')](_0x5980fe);return _0x3c21b6[_0x1f4d('0x20')](_0x1f4d('0x21'),_0x18d1ca+'-'+_0x4a1350+'/'+_0x2a2c88)[_0x1f4d('0x1b')](_0x26eddc);}return null;};}function patchUpdates(_0x1531c5){return function(_0x3bcc12){try{jsonpatch[_0x1f4d('0x22')](_0x3bcc12,_0x1531c5,!![]);}catch(_0x285e34){return BPromise[_0x1f4d('0x23')](_0x285e34);}return _0x3bcc12['save']();};}function saveUpdates(_0x253f7f,_0x2df70f){return function(_0x812f76){if(_0x812f76){return _0x812f76[_0x1f4d('0x24')](_0x253f7f)['then'](function(_0x1aa9ac){return _0x1aa9ac;});}return null;};}function removeEntity(_0x299a87,_0x53f944){return function(_0x57b625){if(_0x57b625){return _0x57b625['destroy']()[_0x1f4d('0x25')](function(){_0x299a87[_0x1f4d('0x19')](0xcc)[_0x1f4d('0x1a')]();});}};}function handleEntityNotFound(_0x24515b,_0x44bac7){return function(_0x2a692c){if(!_0x2a692c){_0x24515b[_0x1f4d('0x18')](0x194);}return _0x2a692c;};}function handleError(_0x433e4f,_0x5a09e3){_0x5a09e3=_0x5a09e3||0x1f4;return function(_0x16ee10){logger['error'](_0x16ee10['stack']);if(_0x16ee10['name']){delete _0x16ee10[_0x1f4d('0x26')];}_0x433e4f[_0x1f4d('0x19')](_0x5a09e3)[_0x1f4d('0x27')](_0x16ee10);};}exports[_0x1f4d('0x28')]=function(_0xe89277,_0x49d278){var _0x3b6d09={},_0x401218={},_0x4c9310={'count':0x0,'rows':[]};var _0x3b2d13=_[_0x1f4d('0x29')](db[_0x1f4d('0x2a')][_0x1f4d('0x2b')],function(_0x503a69){return{'name':_0x503a69[_0x1f4d('0x2c')],'type':_0x503a69[_0x1f4d('0x2d')]['key']};});_0x401218[_0x1f4d('0x2e')]=_['map'](_0x3b2d13,_0x1f4d('0x26'));_0x401218[_0x1f4d('0x2f')]=_[_0x1f4d('0x30')](_0xe89277[_0x1f4d('0x2f')]);_0x401218[_0x1f4d('0x31')]=_[_0x1f4d('0x32')](_0x401218[_0x1f4d('0x2e')],_0x401218[_0x1f4d('0x2f')]);_0x3b6d09[_0x1f4d('0x33')]=_['intersection'](_0x401218[_0x1f4d('0x2e')],qs[_0x1f4d('0x34')](_0xe89277[_0x1f4d('0x2f')][_0x1f4d('0x34')]));_0x3b6d09[_0x1f4d('0x33')]=_0x3b6d09[_0x1f4d('0x33')][_0x1f4d('0x35')]?_0x3b6d09[_0x1f4d('0x33')]:_0x401218[_0x1f4d('0x2e')];if(!_0xe89277[_0x1f4d('0x2f')][_0x1f4d('0x36')](_0x1f4d('0x37'))){_0x3b6d09[_0x1f4d('0x1d')]=qs[_0x1f4d('0x1d')](_0xe89277[_0x1f4d('0x2f')]['limit']);_0x3b6d09['offset']=qs[_0x1f4d('0x1f')](_0xe89277[_0x1f4d('0x2f')]['offset']);}_0x3b6d09[_0x1f4d('0x38')]=qs[_0x1f4d('0x39')](_0xe89277['query'][_0x1f4d('0x39')]);_0x3b6d09[_0x1f4d('0x3a')]=qs['filters'](_['pick'](_0xe89277[_0x1f4d('0x2f')],_0x401218[_0x1f4d('0x31')]),_0x3b2d13);if(_0xe89277[_0x1f4d('0x2f')][_0x1f4d('0x3b')]){_0x3b6d09[_0x1f4d('0x3a')]=_[_0x1f4d('0x3c')](_0x3b6d09[_0x1f4d('0x3a')],{'$or':_[_0x1f4d('0x29')](_0x3b2d13,function(_0x57ebf7){if(_0x57ebf7['type']!=='VIRTUAL'){var _0x3659a8={};_0x3659a8[_0x57ebf7['name']]={'$like':'%'+_0xe89277[_0x1f4d('0x2f')][_0x1f4d('0x3b')]+'%'};return _0x3659a8;}})});}_0x3b6d09=_[_0x1f4d('0x3c')]({},_0x3b6d09,_0xe89277[_0x1f4d('0x3d')]);var _0x307e70={'where':_0x3b6d09[_0x1f4d('0x3a')]};return db['UserProfileSection']['count'](_0x307e70)['then'](function(_0x55bb31){_0x4c9310['count']=_0x55bb31;if(_0xe89277[_0x1f4d('0x2f')]['includeAll']){_0x3b6d09[_0x1f4d('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x1f4d('0x3f')](_0x3b6d09);})['then'](function(_0x52b827){_0x4c9310['rows']=_0x52b827;return _0x4c9310;})[_0x1f4d('0x25')](respondWithFilteredResult(_0x49d278,_0x3b6d09))[_0x1f4d('0x40')](handleError(_0x49d278,null));};exports[_0x1f4d('0x41')]=function(_0xbd444,_0x554fd7){var _0x35211f={'raw':![],'where':{'id':_0xbd444[_0x1f4d('0x42')]['id']}},_0x5ce7f3={};_0x5ce7f3[_0x1f4d('0x2e')]=_[_0x1f4d('0x30')](db[_0x1f4d('0x2a')][_0x1f4d('0x2b')]);_0x5ce7f3[_0x1f4d('0x2f')]=_[_0x1f4d('0x30')](_0xbd444['query']);_0x5ce7f3[_0x1f4d('0x31')]=_['intersection'](_0x5ce7f3[_0x1f4d('0x2e')],_0x5ce7f3[_0x1f4d('0x2f')]);_0x35211f[_0x1f4d('0x33')]=_[_0x1f4d('0x32')](_0x5ce7f3[_0x1f4d('0x2e')],qs[_0x1f4d('0x34')](_0xbd444[_0x1f4d('0x2f')][_0x1f4d('0x34')]));_0x35211f['attributes']=_0x35211f[_0x1f4d('0x33')][_0x1f4d('0x35')]?_0x35211f[_0x1f4d('0x33')]:_0x5ce7f3[_0x1f4d('0x2e')];if(_0xbd444[_0x1f4d('0x2f')][_0x1f4d('0x43')]){_0x35211f[_0x1f4d('0x3e')]=[{'all':!![]}];}_0x35211f=_[_0x1f4d('0x3c')]({},_0x35211f,_0xbd444[_0x1f4d('0x3d')]);return db[_0x1f4d('0x2a')][_0x1f4d('0x44')](_0x35211f)[_0x1f4d('0x25')](handleEntityNotFound(_0x554fd7,null))[_0x1f4d('0x25')](respondWithResult(_0x554fd7,null))[_0x1f4d('0x40')](handleError(_0x554fd7,null));};exports[_0x1f4d('0x45')]=function(_0x1b5ca1,_0x29123e){return db[_0x1f4d('0x2a')][_0x1f4d('0x45')](_0x1b5ca1[_0x1f4d('0x46')],{})['then'](respondWithResult(_0x29123e,0xc9))[_0x1f4d('0x40')](handleError(_0x29123e,null));};exports[_0x1f4d('0x24')]=function(_0x48d19d,_0x4df771){if(_0x48d19d[_0x1f4d('0x46')]['id']){delete _0x48d19d[_0x1f4d('0x46')]['id'];}return db[_0x1f4d('0x2a')]['find']({'where':{'id':_0x48d19d[_0x1f4d('0x42')]['id']}})[_0x1f4d('0x25')](handleEntityNotFound(_0x4df771,null))['then'](saveUpdates(_0x48d19d['body'],null))['then'](respondWithResult(_0x4df771,null))[_0x1f4d('0x40')](handleError(_0x4df771,null));};exports['destroy']=function(_0x3e3c94,_0x4cb082){return db['UserProfileSection'][_0x1f4d('0x44')]({'where':{'id':_0x3e3c94['params']['id']}})['then'](handleEntityNotFound(_0x4cb082,null))[_0x1f4d('0x25')](removeEntity(_0x4cb082,null))[_0x1f4d('0x40')](handleError(_0x4cb082,null));};exports[_0x1f4d('0x47')]=function(_0x27f092,_0x4989c7){return db[_0x1f4d('0x2a')]['describe']()[_0x1f4d('0x25')](respondWithResult(_0x4989c7,null))[_0x1f4d('0x40')](handleError(_0x4989c7,null));}; \ No newline at end of file +var _0xc019=['create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../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','reject','save','update','then','destroy','error','name','UserProfileSection','key','map','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find'];(function(_0x12a481,_0x31905c){var _0x32d1ca=function(_0x443bbc){while(--_0x443bbc){_0x12a481['push'](_0x12a481['shift']());}};_0x32d1ca(++_0x31905c);}(_0xc019,0x98));var _0x9c01=function(_0x29c0ea,_0x172a2b){_0x29c0ea=_0x29c0ea-0x0;var _0x1e65bf=_0xc019[_0x29c0ea];return _0x1e65bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c01('0x0'));var zipdir=require(_0x9c01('0x1'));var jsonpatch=require(_0x9c01('0x2'));var rp=require(_0x9c01('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9c01('0x4'));var util=require(_0x9c01('0x5'));var path=require(_0x9c01('0x6'));var sox=require(_0x9c01('0x7'));var csv=require(_0x9c01('0x8'));var ejs=require(_0x9c01('0x9'));var fs=require('fs');var fs_extra=require(_0x9c01('0xa'));var _=require('lodash');var squel=require(_0x9c01('0xb'));var crypto=require(_0x9c01('0xc'));var jsforce=require(_0x9c01('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9c01('0x8'));var querystring=require(_0x9c01('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9c01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9c01('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c01('0x11'))(_0x9c01('0x12'));var utils=require(_0x9c01('0x13'));var config=require(_0x9c01('0x14'));var licenseUtil=require(_0x9c01('0x15'));var db=require(_0x9c01('0x16'))['db'];function respondWithStatusCode(_0x28da1c,_0x5d2034){_0x5d2034=_0x5d2034||0xcc;return function(_0x478dce){if(_0x478dce){return _0x28da1c[_0x9c01('0x17')](_0x5d2034);}return _0x28da1c[_0x9c01('0x18')](_0x5d2034)[_0x9c01('0x19')]();};}function respondWithResult(_0x48eb8d,_0x4fa985){_0x4fa985=_0x4fa985||0xc8;return function(_0x441073){if(_0x441073){return _0x48eb8d[_0x9c01('0x18')](_0x4fa985)[_0x9c01('0x1a')](_0x441073);}};}function respondWithFilteredResult(_0x3336a8,_0x1286e0){return function(_0x1638cf){if(_0x1638cf){var _0x20dc09=typeof _0x1286e0[_0x9c01('0x1b')]===_0x9c01('0x1c')&&typeof _0x1286e0[_0x9c01('0x1d')]==='undefined';var _0x10650a=_0x1638cf[_0x9c01('0x1e')];var _0x6246dc=_0x20dc09?0x0:_0x1286e0[_0x9c01('0x1b')];var _0x2a50f7=_0x20dc09?_0x1638cf[_0x9c01('0x1e')]:_0x1286e0[_0x9c01('0x1b')]+_0x1286e0['limit'];var _0x5caac7;if(_0x2a50f7>=_0x10650a){_0x2a50f7=_0x10650a;_0x5caac7=0xc8;}else{_0x5caac7=0xce;}_0x3336a8[_0x9c01('0x18')](_0x5caac7);return _0x3336a8[_0x9c01('0x1f')](_0x9c01('0x20'),_0x6246dc+'-'+_0x2a50f7+'/'+_0x10650a)[_0x9c01('0x1a')](_0x1638cf);}return null;};}function patchUpdates(_0x4921dc){return function(_0x434a0d){try{jsonpatch[_0x9c01('0x21')](_0x434a0d,_0x4921dc,!![]);}catch(_0x3fed00){return BPromise[_0x9c01('0x22')](_0x3fed00);}return _0x434a0d[_0x9c01('0x23')]();};}function saveUpdates(_0xed0056,_0x5d441c){return function(_0x594295){if(_0x594295){return _0x594295[_0x9c01('0x24')](_0xed0056)[_0x9c01('0x25')](function(_0x13abcc){return _0x13abcc;});}return null;};}function removeEntity(_0x2a50bf,_0xbcff69){return function(_0xc28caf){if(_0xc28caf){return _0xc28caf[_0x9c01('0x26')]()['then'](function(){_0x2a50bf[_0x9c01('0x18')](0xcc)[_0x9c01('0x19')]();});}};}function handleEntityNotFound(_0x490107,_0x58087c){return function(_0x1f2293){if(!_0x1f2293){_0x490107[_0x9c01('0x17')](0x194);}return _0x1f2293;};}function handleError(_0x3c700d,_0x243739){_0x243739=_0x243739||0x1f4;return function(_0x44fee5){logger[_0x9c01('0x27')](_0x44fee5['stack']);if(_0x44fee5[_0x9c01('0x28')]){delete _0x44fee5[_0x9c01('0x28')];}_0x3c700d['status'](_0x243739)['send'](_0x44fee5);};}exports['index']=function(_0x58500e,_0x54963c){var _0x44e009={},_0x546dea={},_0x31a5ac={'count':0x0,'rows':[]};var _0x3b521c=_['map'](db[_0x9c01('0x29')]['rawAttributes'],function(_0x33b574){return{'name':_0x33b574['fieldName'],'type':_0x33b574['type'][_0x9c01('0x2a')]};});_0x546dea['model']=_[_0x9c01('0x2b')](_0x3b521c,'name');_0x546dea[_0x9c01('0x2c')]=_['keys'](_0x58500e[_0x9c01('0x2c')]);_0x546dea[_0x9c01('0x2d')]=_['intersection'](_0x546dea['model'],_0x546dea[_0x9c01('0x2c')]);_0x44e009[_0x9c01('0x2e')]=_[_0x9c01('0x2f')](_0x546dea[_0x9c01('0x30')],qs[_0x9c01('0x31')](_0x58500e[_0x9c01('0x2c')][_0x9c01('0x31')]));_0x44e009[_0x9c01('0x2e')]=_0x44e009['attributes'][_0x9c01('0x32')]?_0x44e009[_0x9c01('0x2e')]:_0x546dea[_0x9c01('0x30')];if(!_0x58500e[_0x9c01('0x2c')][_0x9c01('0x33')](_0x9c01('0x34'))){_0x44e009['limit']=qs[_0x9c01('0x1d')](_0x58500e['query'][_0x9c01('0x1d')]);_0x44e009['offset']=qs[_0x9c01('0x1b')](_0x58500e[_0x9c01('0x2c')]['offset']);}_0x44e009[_0x9c01('0x35')]=qs['sort'](_0x58500e[_0x9c01('0x2c')][_0x9c01('0x36')]);_0x44e009[_0x9c01('0x37')]=qs[_0x9c01('0x2d')](_[_0x9c01('0x38')](_0x58500e[_0x9c01('0x2c')],_0x546dea[_0x9c01('0x2d')]),_0x3b521c);if(_0x58500e[_0x9c01('0x2c')][_0x9c01('0x39')]){_0x44e009[_0x9c01('0x37')]=_['merge'](_0x44e009[_0x9c01('0x37')],{'$or':_[_0x9c01('0x2b')](_0x3b521c,function(_0x4e24c0){if(_0x4e24c0[_0x9c01('0x3a')]!=='VIRTUAL'){var _0x56db55={};_0x56db55[_0x4e24c0[_0x9c01('0x28')]]={'$like':'%'+_0x58500e['query'][_0x9c01('0x39')]+'%'};return _0x56db55;}})});}_0x44e009=_[_0x9c01('0x3b')]({},_0x44e009,_0x58500e[_0x9c01('0x3c')]);var _0x1ce43c={'where':_0x44e009[_0x9c01('0x37')]};return db[_0x9c01('0x29')]['count'](_0x1ce43c)[_0x9c01('0x25')](function(_0x4dfcf0){_0x31a5ac[_0x9c01('0x1e')]=_0x4dfcf0;if(_0x58500e['query'][_0x9c01('0x3d')]){_0x44e009[_0x9c01('0x3e')]=[{'all':!![]}];}return db['UserProfileSection'][_0x9c01('0x3f')](_0x44e009);})[_0x9c01('0x25')](function(_0x4a7828){_0x31a5ac[_0x9c01('0x40')]=_0x4a7828;return _0x31a5ac;})['then'](respondWithFilteredResult(_0x54963c,_0x44e009))[_0x9c01('0x41')](handleError(_0x54963c,null));};exports[_0x9c01('0x42')]=function(_0x3e2cdb,_0x5b5071){var _0x477d7b={'raw':![],'where':{'id':_0x3e2cdb['params']['id']}},_0x45292d={};_0x45292d[_0x9c01('0x30')]=_['keys'](db['UserProfileSection'][_0x9c01('0x43')]);_0x45292d[_0x9c01('0x2c')]=_[_0x9c01('0x44')](_0x3e2cdb[_0x9c01('0x2c')]);_0x45292d['filters']=_[_0x9c01('0x2f')](_0x45292d['model'],_0x45292d[_0x9c01('0x2c')]);_0x477d7b[_0x9c01('0x2e')]=_[_0x9c01('0x2f')](_0x45292d[_0x9c01('0x30')],qs[_0x9c01('0x31')](_0x3e2cdb[_0x9c01('0x2c')][_0x9c01('0x31')]));_0x477d7b['attributes']=_0x477d7b[_0x9c01('0x2e')][_0x9c01('0x32')]?_0x477d7b[_0x9c01('0x2e')]:_0x45292d[_0x9c01('0x30')];if(_0x3e2cdb['query']['includeAll']){_0x477d7b['include']=[{'all':!![]}];}_0x477d7b=_[_0x9c01('0x3b')]({},_0x477d7b,_0x3e2cdb[_0x9c01('0x3c')]);return db['UserProfileSection'][_0x9c01('0x45')](_0x477d7b)[_0x9c01('0x25')](handleEntityNotFound(_0x5b5071,null))[_0x9c01('0x25')](respondWithResult(_0x5b5071,null))[_0x9c01('0x41')](handleError(_0x5b5071,null));};exports[_0x9c01('0x46')]=function(_0x2ab702,_0x15384c){return db[_0x9c01('0x29')]['create'](_0x2ab702[_0x9c01('0x47')],{})[_0x9c01('0x25')](respondWithResult(_0x15384c,0xc9))[_0x9c01('0x41')](handleError(_0x15384c,null));};exports[_0x9c01('0x24')]=function(_0x2af3a5,_0xf81588){if(_0x2af3a5['body']['id']){delete _0x2af3a5[_0x9c01('0x47')]['id'];}return db[_0x9c01('0x29')][_0x9c01('0x45')]({'where':{'id':_0x2af3a5[_0x9c01('0x48')]['id']}})[_0x9c01('0x25')](handleEntityNotFound(_0xf81588,null))[_0x9c01('0x25')](saveUpdates(_0x2af3a5[_0x9c01('0x47')],null))['then'](respondWithResult(_0xf81588,null))[_0x9c01('0x41')](handleError(_0xf81588,null));};exports[_0x9c01('0x26')]=function(_0x2b5f79,_0x10b9f1){return db[_0x9c01('0x29')][_0x9c01('0x45')]({'where':{'id':_0x2b5f79[_0x9c01('0x48')]['id']}})[_0x9c01('0x25')](handleEntityNotFound(_0x10b9f1,null))[_0x9c01('0x25')](removeEntity(_0x10b9f1,null))[_0x9c01('0x41')](handleError(_0x10b9f1,null));};exports[_0x9c01('0x49')]=function(_0x344492,_0x2f94dc){return db[_0x9c01('0x29')]['describe']()['then'](respondWithResult(_0x2f94dc,null))[_0x9c01('0x41')](handleError(_0x2f94dc,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index fe7e006..32eae4d 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 _0x60d7=['rimraf','../../config/environment','./userProfileSection.attributes','exports','define','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4d94fd,_0x24cc0e){var _0x447e0f=function(_0x5921e2){while(--_0x5921e2){_0x4d94fd['push'](_0x4d94fd['shift']());}};_0x447e0f(++_0x24cc0e);}(_0x60d7,0xe9));var _0x760d=function(_0x559a04,_0x259888){_0x559a04=_0x559a04-0x0;var _0xc59e25=_0x60d7[_0x559a04];return _0xc59e25;};'use strict';var _=require(_0x760d('0x0'));var util=require(_0x760d('0x1'));var logger=require('../../config/logger')(_0x760d('0x2'));var moment=require(_0x760d('0x3'));var BPromise=require(_0x760d('0x4'));var rp=require(_0x760d('0x5'));var fs=require('fs');var path=require(_0x760d('0x6'));var rimraf=require(_0x760d('0x7'));var config=require(_0x760d('0x8'));var attributes=require(_0x760d('0x9'));module[_0x760d('0xa')]=function(_0x13f14c,_0x1b6239){return _0x13f14c[_0x760d('0xb')]('UserProfileSection',attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x760d('0xc'),'fields':[_0x760d('0xd'),_0x760d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa445=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','define','UserProfileSection','userProfileId','lodash'];(function(_0xe743f4,_0x21e6ae){var _0x457471=function(_0xabc2fd){while(--_0xabc2fd){_0xe743f4['push'](_0xe743f4['shift']());}};_0x457471(++_0x21e6ae);}(_0xa445,0x1ac));var _0x5a44=function(_0x139110,_0x496a0e){_0x139110=_0x139110-0x0;var _0x35d3d5=_0xa445[_0x139110];return _0x35d3d5;};'use strict';var _=require(_0x5a44('0x0'));var util=require(_0x5a44('0x1'));var logger=require(_0x5a44('0x2'))(_0x5a44('0x3'));var moment=require(_0x5a44('0x4'));var BPromise=require('bluebird');var rp=require(_0x5a44('0x5'));var fs=require('fs');var path=require(_0x5a44('0x6'));var rimraf=require(_0x5a44('0x7'));var config=require(_0x5a44('0x8'));var attributes=require(_0x5a44('0x9'));module['exports']=function(_0x4fc61a,_0x254336){return _0x4fc61a[_0x5a44('0xa')](_0x5a44('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0x5a44('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 0c807aa..e1b0c16 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 _0xc99e=['message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x55bd03,_0x249e17){var _0x4b77ef=function(_0xaccea1){while(--_0xaccea1){_0x55bd03['push'](_0x55bd03['shift']());}};_0x4b77ef(++_0x249e17);}(_0xc99e,0x1d8));var _0xec99=function(_0x355af6,_0x4173ac){_0x355af6=_0x355af6-0x0;var _0x5ef45d=_0xc99e[_0x355af6];return _0x5ef45d;};'use strict';var _=require(_0xec99('0x0'));var util=require(_0xec99('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xec99('0x2'));var fs=require('fs');var Redis=require(_0xec99('0x3'));var db=require(_0xec99('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xec99('0x5'))('rpc');var config=require(_0xec99('0x6'));var jayson=require(_0xec99('0x7'));var client=jayson[_0xec99('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b715e,_0x40f7ac,_0x569d7a){return new BPromise(function(_0x2ece33,_0xbd70d3){return client['request'](_0x5b715e,_0x569d7a)['then'](function(_0x3fc23e){logger['info'](_0xec99('0x9'),_0x40f7ac,_0xec99('0xa'));logger[_0xec99('0xb')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x40f7ac,_0xec99('0xa'),JSON['stringify'](_0x3fc23e));if(_0x3fc23e[_0xec99('0xc')]){if(_0x3fc23e[_0xec99('0xc')][_0xec99('0xd')]===0x1f4){logger[_0xec99('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x40f7ac,_0x3fc23e[_0xec99('0xc')][_0xec99('0xe')]);return _0xbd70d3(_0x3fc23e[_0xec99('0xc')][_0xec99('0xe')]);}logger[_0xec99('0xc')](_0xec99('0x9'),_0x40f7ac,_0x3fc23e[_0xec99('0xc')][_0xec99('0xe')]);return _0x2ece33(_0x3fc23e[_0xec99('0xc')][_0xec99('0xe')]);}else{logger[_0xec99('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x40f7ac,_0xec99('0xa'));_0x2ece33(_0x3fc23e[_0xec99('0x10')][_0xec99('0xe')]);}})[_0xec99('0x11')](function(_0x32e18c){logger[_0xec99('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x40f7ac,_0x32e18c);_0xbd70d3(_0x32e18c);});});} \ No newline at end of file +var _0xdc3c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0xd67723,_0x1e576f){var _0x53b62b=function(_0x2460a3){while(--_0x2460a3){_0xd67723['push'](_0xd67723['shift']());}};_0x53b62b(++_0x1e576f);}(_0xdc3c,0x1b4));var _0xcdc3=function(_0x43d240,_0xbdc22d){_0x43d240=_0x43d240-0x0;var _0xae4327=_0xdc3c[_0x43d240];return _0xae4327;};'use strict';var _=require(_0xcdc3('0x0'));var util=require('util');var moment=require(_0xcdc3('0x1'));var BPromise=require(_0xcdc3('0x2'));var rs=require(_0xcdc3('0x3'));var fs=require('fs');var Redis=require(_0xcdc3('0x4'));var db=require(_0xcdc3('0x5'))['db'];var utils=require(_0xcdc3('0x6'));var logger=require(_0xcdc3('0x7'))(_0xcdc3('0x8'));var config=require(_0xcdc3('0x9'));var jayson=require(_0xcdc3('0xa'));var client=jayson[_0xcdc3('0xb')][_0xcdc3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x406814,_0x428b03,_0x79b6b1){return new BPromise(function(_0xcbc8f1,_0x58c8f3){return client['request'](_0x406814,_0x79b6b1)['then'](function(_0x3aa1b2){logger[_0xcdc3('0xd')](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));logger[_0xcdc3('0x10')](_0xcdc3('0x11'),_0x428b03,_0xcdc3('0xf'),JSON[_0xcdc3('0x12')](_0x3aa1b2));if(_0x3aa1b2[_0xcdc3('0x13')]){if(_0x3aa1b2['error']['code']===0x1f4){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);return _0x58c8f3(_0x3aa1b2[_0xcdc3('0x13')][_0xcdc3('0x14')]);}logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0x3aa1b2['error'][_0xcdc3('0x14')]);return _0xcbc8f1(_0x3aa1b2['error'][_0xcdc3('0x14')]);}else{logger['info'](_0xcdc3('0xe'),_0x428b03,_0xcdc3('0xf'));_0xcbc8f1(_0x3aa1b2[_0xcdc3('0x15')][_0xcdc3('0x14')]);}})[_0xcdc3('0x16')](function(_0xaf3ec3){logger[_0xcdc3('0x13')](_0xcdc3('0xe'),_0x428b03,_0xaf3ec3);_0x58c8f3(_0xaf3ec3);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 2f34064..8d9e58c 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x3b0598,_0x15100f){var _0x5e2198=function(_0x19aeb7){while(--_0x19aeb7){_0x3b0598['push'](_0x3b0598['shift']());}};_0x5e2198(++_0x15100f);}(_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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xcf3e65,_0xceb51a){var _0x119319=function(_0x5d2c0d){while(--_0x5d2c0d){_0xcf3e65['push'](_0xcf3e65['shift']());}};_0x119319(++_0xceb51a);}(_0xe706,0xa3));var _0x6e70=function(_0x3e3f94,_0x27528b){_0x3e3f94=_0x3e3f94-0x0;var _0x5548bb=_0xe706[_0x3e3f94];return _0x5548bb;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 5bdce76..76f28ef 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 _0x4577=['INTEGER','sequelize'];(function(_0x413e60,_0x4c01d9){var _0x5f0f42=function(_0xe05c37){while(--_0xe05c37){_0x413e60['push'](_0x413e60['shift']());}};_0x5f0f42(++_0x4c01d9);}(_0x4577,0x117));var _0x7457=function(_0x38c7d8,_0x253557){_0x38c7d8=_0x38c7d8-0x0;var _0x266426=_0x4577[_0x38c7d8];return _0x266426;};'use strict';var Sequelize=require(_0x7457('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7457('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2d88=['exports','sequelize'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0x2d88,0x127));var _0x82d8=function(_0x378722,_0xfd8413){_0x378722=_0x378722-0x0;var _0x48ae1a=_0x2d88[_0x378722];return _0x48ae1a;};'use strict';var Sequelize=require(_0x82d8('0x0'));module[_0x82d8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index fb24cb2..600a9c2 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 _0x7ee1=['user_has_sms_queues','lodash','moment','bluebird','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x5ed102,_0x2426a6){var _0x38ac89=function(_0x10f723){while(--_0x10f723){_0x5ed102['push'](_0x5ed102['shift']());}};_0x38ac89(++_0x2426a6);}(_0x7ee1,0x8d));var _0x17ee=function(_0x41c3d9,_0x90fcc3){_0x41c3d9=_0x41c3d9-0x0;var _0x2a6439=_0x7ee1[_0x41c3d9];return _0x2a6439;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('UserSmsQueue',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3024=['user_has_sms_queues','lodash','util','api','moment','path','../../config/environment','./userSmsQueue.attributes','UserSmsQueue'];(function(_0x1d103d,_0x10e299){var _0x2dd21c=function(_0x363cab){while(--_0x363cab){_0x1d103d['push'](_0x1d103d['shift']());}};_0x2dd21c(++_0x10e299);}(_0x3024,0x64));var _0x4302=function(_0x34fe76,_0x1c215b){_0x34fe76=_0x34fe76-0x0;var _0x2c9649=_0x3024[_0x34fe76];return _0x2c9649;};'use strict';var _=require(_0x4302('0x0'));var util=require(_0x4302('0x1'));var logger=require('../../config/logger')(_0x4302('0x2'));var moment=require(_0x4302('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4302('0x4'));var rimraf=require('rimraf');var config=require(_0x4302('0x5'));var attributes=require(_0x4302('0x6'));module['exports']=function(_0x13d051,_0x5f20){return _0x13d051['define'](_0x4302('0x7'),attributes,{'tableName':_0x4302('0x8'),'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 45a92cf..bbcd70c 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 _0x64d9=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x64d9,0xa8));var _0x964d=function(_0x460b9e,_0x3e016d){_0x460b9e=_0x460b9e-0x0;var _0x373e93=_0x64d9[_0x460b9e];return _0x373e93;};'use strict';var _=require(_0x964d('0x0'));var util=require(_0x964d('0x1'));var moment=require(_0x964d('0x2'));var BPromise=require('bluebird');var rs=require(_0x964d('0x3'));var fs=require('fs');var Redis=require(_0x964d('0x4'));var db=require(_0x964d('0x5'))['db'];var utils=require(_0x964d('0x6'));var logger=require('../../config/logger')(_0x964d('0x7'));var config=require('../../config/environment');var jayson=require(_0x964d('0x8'));var client=jayson[_0x964d('0x9')][_0x964d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48b198,_0x5b8201,_0x5965c3){return new BPromise(function(_0x2e61ea,_0x59f5da){return client[_0x964d('0xb')](_0x48b198,_0x5965c3)[_0x964d('0xc')](function(_0x14b3f3){logger[_0x964d('0xd')](_0x964d('0xe'),_0x5b8201,'request\x20sent');logger[_0x964d('0xf')](_0x964d('0x10'),_0x5b8201,_0x964d('0x11'),JSON[_0x964d('0x12')](_0x14b3f3));if(_0x14b3f3[_0x964d('0x13')]){if(_0x14b3f3[_0x964d('0x13')][_0x964d('0x14')]===0x1f4){logger[_0x964d('0x13')](_0x964d('0xe'),_0x5b8201,_0x14b3f3[_0x964d('0x13')][_0x964d('0x15')]);return _0x59f5da(_0x14b3f3[_0x964d('0x13')]['message']);}logger[_0x964d('0x13')](_0x964d('0xe'),_0x5b8201,_0x14b3f3[_0x964d('0x13')][_0x964d('0x15')]);return _0x2e61ea(_0x14b3f3[_0x964d('0x13')][_0x964d('0x15')]);}else{logger[_0x964d('0xd')](_0x964d('0xe'),_0x5b8201,'request\x20sent');_0x2e61ea(_0x14b3f3[_0x964d('0x16')][_0x964d('0x15')]);}})[_0x964d('0x17')](function(_0x4ed82b){logger[_0x964d('0x13')](_0x964d('0xe'),_0x5b8201,_0x4ed82b);_0x59f5da(_0x4ed82b);});});} \ No newline at end of file +var _0xd70e=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','then','UserSmsQueue,\x20%s,\x20%s'];(function(_0xed4f9e,_0x328fce){var _0x3f542b=function(_0x1054f0){while(--_0x1054f0){_0xed4f9e['push'](_0xed4f9e['shift']());}};_0x3f542b(++_0x328fce);}(_0xd70e,0x185));var _0xed70=function(_0x5e895f,_0x3167d7){_0x5e895f=_0x5e895f-0x0;var _0x1a6d33=_0xd70e[_0x5e895f];return _0x1a6d33;};'use strict';var _=require(_0xed70('0x0'));var util=require('util');var moment=require(_0xed70('0x1'));var BPromise=require('bluebird');var rs=require(_0xed70('0x2'));var fs=require('fs');var Redis=require(_0xed70('0x3'));var db=require(_0xed70('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xed70('0x5'));var jayson=require(_0xed70('0x6'));var client=jayson['client'][_0xed70('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xed22b9,_0x23c4f0,_0x362d1c){return new BPromise(function(_0x49a0d2,_0x56f408){return client['request'](_0xed22b9,_0x362d1c)[_0xed70('0x8')](function(_0x184b72){logger['info'](_0xed70('0x9'),_0x23c4f0,_0xed70('0xa'));logger[_0xed70('0xb')](_0xed70('0xc'),_0x23c4f0,_0xed70('0xa'),JSON['stringify'](_0x184b72));if(_0x184b72['error']){if(_0x184b72[_0xed70('0xd')][_0xed70('0xe')]===0x1f4){logger['error'](_0xed70('0x9'),_0x23c4f0,_0x184b72[_0xed70('0xd')][_0xed70('0xf')]);return _0x56f408(_0x184b72[_0xed70('0xd')][_0xed70('0xf')]);}logger[_0xed70('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x23c4f0,_0x184b72[_0xed70('0xd')]['message']);return _0x49a0d2(_0x184b72[_0xed70('0xd')][_0xed70('0xf')]);}else{logger[_0xed70('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x23c4f0,_0xed70('0xa'));_0x49a0d2(_0x184b72[_0xed70('0x11')]['message']);}})[_0xed70('0x12')](function(_0x487d6e){logger['error'](_0xed70('0x9'),_0x23c4f0,_0x487d6e);_0x56f408(_0x487d6e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 6e54f52..5526576 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 _0x940a=['sequelize','INTEGER'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x940a,0x1c6));var _0xa940=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0x940a[_0x10df18];return _0x1f9a1d;};'use strict';var Sequelize=require(_0xa940('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xa940('0x1')]}}; \ No newline at end of file +var _0x822b=['INTEGER','sequelize','exports'];(function(_0x28b2f6,_0x53be77){var _0x2fff94=function(_0x4efe84){while(--_0x4efe84){_0x28b2f6['push'](_0x28b2f6['shift']());}};_0x2fff94(++_0x53be77);}(_0x822b,0xa0));var _0xb822=function(_0x48c9fe,_0x4f32c9){_0x48c9fe=_0x48c9fe-0x0;var _0xa3ed1c=_0x822b[_0x48c9fe];return _0xa3ed1c;};'use strict';var Sequelize=require(_0xb822('0x0'));module[_0xb822('0x1')]={'UserId':{'type':Sequelize[_0xb822('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb822('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 89c5074..3d9b58f 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(_0x2315a3,_0x32abb7){var _0x2f0fe5=function(_0x303aed){while(--_0x303aed){_0x2315a3['push'](_0x2315a3['shift']());}};_0x2f0fe5(++_0x32abb7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x5d24a5,_0x1b1374){var _0x15ea33=function(_0x5b813f){while(--_0x5b813f){_0x5d24a5['push'](_0x5d24a5['shift']());}};_0x15ea33(++_0x1b1374);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 e220e5c..066c978 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5b43ac,_0x9424bc){var _0x2f0a71=function(_0x777c0d){while(--_0x777c0d){_0x5b43ac['push'](_0x5b43ac['shift']());}};_0x2f0a71(++_0x9424bc);}(_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 +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x7e3bb8,_0x27c048){var _0x44c887=function(_0x55d7c6){while(--_0x55d7c6){_0x7e3bb8['push'](_0x7e3bb8['shift']());}};_0x44c887(++_0x27c048);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 4ab57c9..48d1b98 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 _0xcfad=['sequelize','INTEGER'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0xcfad,0x1d6));var _0xdcfa=function(_0x497e65,_0x30f499){_0x497e65=_0x497e65-0x0;var _0x48422f=_0xcfad[_0x497e65];return _0x48422f;};'use strict';var Sequelize=require(_0xdcfa('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdcfa('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe58b=['sequelize','exports','INTEGER'];(function(_0x4c2c23,_0x3d8d28){var _0x5c992e=function(_0x5cfed7){while(--_0x5cfed7){_0x4c2c23['push'](_0x4c2c23['shift']());}};_0x5c992e(++_0x3d8d28);}(_0xe58b,0x1e3));var _0xbe58=function(_0x41669a,_0x56a70f){_0x41669a=_0x41669a-0x0;var _0x427693=_0xe58b[_0x41669a];return _0x427693;};'use strict';var Sequelize=require(_0xbe58('0x0'));module[_0xbe58('0x1')]={'penalty':{'type':Sequelize[_0xbe58('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 a1bbce9..33e7cfc 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 _0xd2a8=['./userVoiceQueue.attributes','exports','define','user_has_voice_queues','util','../../config/logger','api','bluebird','path','../../config/environment'];(function(_0x8a0b0d,_0x5767c6){var _0x2043c9=function(_0x4d3f74){while(--_0x4d3f74){_0x8a0b0d['push'](_0x8a0b0d['shift']());}};_0x2043c9(++_0x5767c6);}(_0xd2a8,0x1ee));var _0x8d2a=function(_0x15a64c,_0x180366){_0x15a64c=_0x15a64c-0x0;var _0x1ee0ef=_0xd2a8[_0x15a64c];return _0x1ee0ef;};'use strict';var _=require('lodash');var util=require(_0x8d2a('0x0'));var logger=require(_0x8d2a('0x1'))(_0x8d2a('0x2'));var moment=require('moment');var BPromise=require(_0x8d2a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8d2a('0x4'));var rimraf=require('rimraf');var config=require(_0x8d2a('0x5'));var attributes=require(_0x8d2a('0x6'));module[_0x8d2a('0x7')]=function(_0x292f62,_0x42a19f){return _0x292f62[_0x8d2a('0x8')]('UserVoiceQueue',attributes,{'tableName':_0x8d2a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x375d=['rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x2fbb74,_0x1004db){var _0x5505a4=function(_0x58e232){while(--_0x58e232){_0x2fbb74['push'](_0x2fbb74['shift']());}};_0x5505a4(++_0x1004db);}(_0x375d,0x96));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd375('0x0'));var util=require('util');var logger=require(_0xd375('0x1'))(_0xd375('0x2'));var moment=require('moment');var BPromise=require(_0xd375('0x3'));var rp=require(_0xd375('0x4'));var fs=require('fs');var path=require(_0xd375('0x5'));var rimraf=require(_0xd375('0x6'));var config=require(_0xd375('0x7'));var attributes=require(_0xd375('0x8'));module[_0xd375('0x9')]=function(_0x23ae9f,_0x5002ab){return _0x23ae9f[_0xd375('0xa')](_0xd375('0xb'),attributes,{'tableName':'user_has_voice_queues','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 5f887b9..0bf1856 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 _0x8f69=['client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x499ce5,_0xa244a9){var _0x2f59fa=function(_0x483bab){while(--_0x483bab){_0x499ce5['push'](_0x499ce5['shift']());}};_0x2f59fa(++_0xa244a9);}(_0x8f69,0x15c));var _0x98f6=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0x8f69[_0x27604f];return _0x40d189;};'use strict';var _=require(_0x98f6('0x0'));var util=require('util');var moment=require(_0x98f6('0x1'));var BPromise=require(_0x98f6('0x2'));var rs=require(_0x98f6('0x3'));var fs=require('fs');var Redis=require(_0x98f6('0x4'));var db=require(_0x98f6('0x5'))['db'];var utils=require(_0x98f6('0x6'));var logger=require('../../config/logger')(_0x98f6('0x7'));var config=require(_0x98f6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98f6('0x9')][_0x98f6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29358d,_0x23d3b5,_0x34dd15){return new BPromise(function(_0x857d72,_0x435c61){return client[_0x98f6('0xb')](_0x29358d,_0x34dd15)[_0x98f6('0xc')](function(_0x51e6e0){logger[_0x98f6('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x23d3b5,'request\x20sent');logger['debug'](_0x98f6('0xe'),_0x23d3b5,'request\x20sent',JSON['stringify'](_0x51e6e0));if(_0x51e6e0['error']){if(_0x51e6e0[_0x98f6('0xf')][_0x98f6('0x10')]===0x1f4){logger[_0x98f6('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x23d3b5,_0x51e6e0[_0x98f6('0xf')][_0x98f6('0x11')]);return _0x435c61(_0x51e6e0['error'][_0x98f6('0x11')]);}logger['error'](_0x98f6('0x12'),_0x23d3b5,_0x51e6e0[_0x98f6('0xf')][_0x98f6('0x11')]);return _0x857d72(_0x51e6e0['error'][_0x98f6('0x11')]);}else{logger[_0x98f6('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x23d3b5,_0x98f6('0x13'));_0x857d72(_0x51e6e0['result'][_0x98f6('0x11')]);}})[_0x98f6('0x14')](function(_0x791048){logger[_0x98f6('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x23d3b5,_0x791048);_0x435c61(_0x791048);});});} \ No newline at end of file +var _0xdfe9=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xdfe9,0x127));var _0x9dfe=function(_0x4d8189,_0x34c824){_0x4d8189=_0x4d8189-0x0;var _0x8a3703=_0xdfe9[_0x4d8189];return _0x8a3703;};'use strict';var _=require(_0x9dfe('0x0'));var util=require(_0x9dfe('0x1'));var moment=require(_0x9dfe('0x2'));var BPromise=require(_0x9dfe('0x3'));var rs=require(_0x9dfe('0x4'));var fs=require('fs');var Redis=require(_0x9dfe('0x5'));var db=require(_0x9dfe('0x6'))['db'];var utils=require(_0x9dfe('0x7'));var logger=require(_0x9dfe('0x8'))(_0x9dfe('0x9'));var config=require(_0x9dfe('0xa'));var jayson=require(_0x9dfe('0xb'));var client=jayson[_0x9dfe('0xc')][_0x9dfe('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x64bf8,_0x6721ea,_0x42acf1){return new BPromise(function(_0x1ad181,_0x3db7c4){return client[_0x9dfe('0xe')](_0x64bf8,_0x42acf1)[_0x9dfe('0xf')](function(_0x5ba71a){logger[_0x9dfe('0x10')](_0x9dfe('0x11'),_0x6721ea,_0x9dfe('0x12'));logger['debug'](_0x9dfe('0x13'),_0x6721ea,_0x9dfe('0x12'),JSON['stringify'](_0x5ba71a));if(_0x5ba71a[_0x9dfe('0x14')]){if(_0x5ba71a[_0x9dfe('0x14')]['code']===0x1f4){logger[_0x9dfe('0x14')](_0x9dfe('0x11'),_0x6721ea,_0x5ba71a[_0x9dfe('0x14')]['message']);return _0x3db7c4(_0x5ba71a[_0x9dfe('0x14')]['message']);}logger['error'](_0x9dfe('0x11'),_0x6721ea,_0x5ba71a[_0x9dfe('0x14')]['message']);return _0x1ad181(_0x5ba71a[_0x9dfe('0x14')]['message']);}else{logger[_0x9dfe('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x6721ea,_0x9dfe('0x12'));_0x1ad181(_0x5ba71a[_0x9dfe('0x15')][_0x9dfe('0x16')]);}})[_0x9dfe('0x17')](function(_0x4a95a3){logger[_0x9dfe('0x14')](_0x9dfe('0x11'),_0x6721ea,_0x4a95a3);_0x3db7c4(_0x4a95a3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 671ac15..ea8e317 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x488554,_0x47914c){var _0x471a8a=function(_0x597684){while(--_0x597684){_0x488554['push'](_0x488554['shift']());}};_0x471a8a(++_0x47914c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x73766e,_0x1ab89b){var _0x2faf10=function(_0x554e07){while(--_0x554e07){_0x73766e['push'](_0x73766e['shift']());}};_0x2faf10(++_0x1ab89b);}(_0x70e0,0x17b));var _0x070e=function(_0x89e653,_0x28e2c2){_0x89e653=_0x89e653-0x0;var _0x522ae9=_0x70e0[_0x89e653];return _0x522ae9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 5ce81b7..8125eb5 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 _0xc55e=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x2d982d,_0x121028){var _0x4f36b0=function(_0x11f3a9){while(--_0x11f3a9){_0x2d982d['push'](_0x2d982d['shift']());}};_0x4f36b0(++_0x121028);}(_0xc55e,0x1d9));var _0xec55=function(_0x241c57,_0x3d2ca4){_0x241c57=_0x241c57-0x0;var _0x28d5cf=_0xc55e[_0x241c57];return _0x28d5cf;};'use strict';var Sequelize=require(_0xec55('0x0'));module[_0xec55('0x1')]={'uniqueid':{'type':Sequelize[_0xec55('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xec55('0x3')},'membername':{'type':Sequelize[_0xec55('0x4')],'allowNull':![],'comment':_0xec55('0x3')},'UserId':{'type':Sequelize[_0xec55('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xec55('0x4')],'allowNull':![],'unique':_0xec55('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xec55('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xec55('0x4')],'allowNull':![],'unique':_0xec55('0x5'),'comment':_0xec55('0x3')},'penalty':{'type':Sequelize[_0xec55('0x2')](0xb),'defaultValue':0x0,'comment':_0xec55('0x3')},'paused':{'type':Sequelize[_0xec55('0x2')](0xb),'defaultValue':0x0,'comment':_0xec55('0x3')}}; \ No newline at end of file +var _0x3728=['STRING','queue_interface','INTEGER','exports','Required\x20by\x20Asterisk'];(function(_0x5c211e,_0xfeba9e){var _0x2bb13a=function(_0x229212){while(--_0x229212){_0x5c211e['push'](_0x5c211e['shift']());}};_0x2bb13a(++_0xfeba9e);}(_0x3728,0x125));var _0x8372=function(_0x10c4bd,_0x204147){_0x10c4bd=_0x10c4bd-0x0;var _0x2bcb1=_0x3728[_0x10c4bd];return _0x2bcb1;};'use strict';var Sequelize=require('sequelize');module[_0x8372('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x8372('0x1')},'membername':{'type':Sequelize[_0x8372('0x2')],'allowNull':![],'comment':_0x8372('0x1')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8372('0x2')],'allowNull':![],'unique':_0x8372('0x3'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x8372('0x4')],'allowNull':![]},'interface':{'type':Sequelize[_0x8372('0x2')],'allowNull':![],'unique':_0x8372('0x3'),'comment':_0x8372('0x1')},'penalty':{'type':Sequelize[_0x8372('0x4')](0xb),'defaultValue':0x0,'comment':_0x8372('0x1')},'paused':{'type':Sequelize[_0x8372('0x4')](0xb),'defaultValue':0x0,'comment':_0x8372('0x1')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index cb2e615..c87a266 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 _0xb43b=['setMaxListeners','save','update','remove','emit','hook','exports','events'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0xb43b,0xa7));var _0xbb43=function(_0x2d0b1c,_0x2d540d){_0x2d0b1c=_0x2d0b1c-0x0;var _0x4fa512=_0xb43b[_0x2d0b1c];return _0x4fa512;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xbb43('0x1')](0x0);var events={'afterCreate':_0xbb43('0x2'),'afterUpdate':_0xbb43('0x3'),'afterDestroy':_0xbb43('0x4')};function emitEvent(_0x3d1b98){return function(_0x1af147,_0x5c67d2,_0x36145){UserVoiceQueueRtEvents[_0xbb43('0x5')](_0x3d1b98+':'+_0x1af147['id'],_0x1af147);UserVoiceQueueRtEvents[_0xbb43('0x5')](_0x3d1b98,_0x1af147);_0x36145(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xbb43('0x6')](e,emitEvent(event));}}module[_0xbb43('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xe459=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x51b661,_0x566ef8){var _0x5d1971=function(_0x5cc6b8){while(--_0x5cc6b8){_0x51b661['push'](_0x51b661['shift']());}};_0x5d1971(++_0x566ef8);}(_0xe459,0x1d9));var _0x9e45=function(_0x47cd85,_0xe3a0fc){_0x47cd85=_0x47cd85-0x0;var _0x319a13=_0xe459[_0x47cd85];return _0x319a13;};'use strict';var EventEmitter=require(_0x9e45('0x0'));var UserVoiceQueueRt=require(_0x9e45('0x1'))['db'][_0x9e45('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x9e45('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9e45('0x4'),'afterDestroy':_0x9e45('0x5')};function emitEvent(_0xa5b96){return function(_0x2a6ba4,_0x27a27d,_0x121efc){UserVoiceQueueRtEvents[_0x9e45('0x6')](_0xa5b96+':'+_0x2a6ba4['id'],_0x2a6ba4);UserVoiceQueueRtEvents[_0x9e45('0x6')](_0xa5b96,_0x2a6ba4);_0x121efc(null);};}for(var e in events){if(events[_0x9e45('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x9e45('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 8642d8c..ba29d23 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 _0x4503=['bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','api','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4503,0x104));var _0x3450=function(_0x195497,_0x3dd4bf){_0x195497=_0x195497-0x0;var _0xcf9de6=_0x4503[_0x195497];return _0xcf9de6;};'use strict';var _=require(_0x3450('0x0'));var util=require(_0x3450('0x1'));var logger=require('../../config/logger')(_0x3450('0x2'));var moment=require(_0x3450('0x3'));var BPromise=require(_0x3450('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3450('0x5'));var config=require(_0x3450('0x6'));var attributes=require(_0x3450('0x7'));module[_0x3450('0x8')]=function(_0x2f49de,_0x5cbf5c){return _0x2f49de[_0x3450('0x9')](_0x3450('0xa'),attributes,{'tableName':_0x3450('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc089=['user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports','define','UserVoiceQueueRt'];(function(_0x4382d9,_0x43aaf8){var _0x4b812c=function(_0xcd2bd2){while(--_0xcd2bd2){_0x4382d9['push'](_0x4382d9['shift']());}};_0x4b812c(++_0x43aaf8);}(_0xc089,0xdd));var _0x9c08=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xc089[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x9c08('0x0'));var logger=require(_0x9c08('0x1'))(_0x9c08('0x2'));var moment=require(_0x9c08('0x3'));var BPromise=require(_0x9c08('0x4'));var rp=require(_0x9c08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9c08('0x6'));var attributes=require('./userVoiceQueueRt.attributes');module[_0x9c08('0x7')]=function(_0x133f13,_0x1d033d){return _0x133f13[_0x9c08('0x8')](_0x9c08('0x9'),attributes,{'tableName':_0x9c08('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 31c777a..10e8f2d 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 _0x82cf=['request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','where','sequelize','COUNT','literal','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','redis','defaults','localhost','./userVoiceQueueRt.socket','register','then','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x49eda7,_0x3a5a72){var _0x1a2d40=function(_0x2d8127){while(--_0x2d8127){_0x49eda7['push'](_0x49eda7['shift']());}};_0x1a2d40(++_0x3a5a72);}(_0x82cf,0x74));var _0xf82c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x82cf[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xf82c('0x0'));var util=require(_0xf82c('0x1'));var moment=require('moment');var BPromise=require(_0xf82c('0x2'));var rs=require(_0xf82c('0x3'));var fs=require('fs');var Redis=require(_0xf82c('0x4'));var db=require(_0xf82c('0x5'))['db'];var utils=require(_0xf82c('0x6'));var logger=require('../../config/logger')(_0xf82c('0x7'));var config=require(_0xf82c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xf82c('0x9')]=_[_0xf82c('0xa')](config[_0xf82c('0x9')],{'host':_0xf82c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf82c('0x9')]));require(_0xf82c('0xc'))[_0xf82c('0xd')](socket);function respondWithRpcPromise(_0x436c54,_0xb0751e,_0x3b050e){return new BPromise(function(_0x300006,_0x4ef255){return client['request'](_0x436c54,_0x3b050e)[_0xf82c('0xe')](function(_0xc8e962){logger['info'](_0xf82c('0xf'),_0xb0751e,_0xf82c('0x10'));logger[_0xf82c('0x11')](_0xf82c('0x12'),_0xb0751e,_0xf82c('0x10'),JSON[_0xf82c('0x13')](_0xc8e962));if(_0xc8e962[_0xf82c('0x14')]){if(_0xc8e962[_0xf82c('0x14')][_0xf82c('0x15')]===0x1f4){logger[_0xf82c('0x14')](_0xf82c('0xf'),_0xb0751e,_0xc8e962[_0xf82c('0x14')][_0xf82c('0x16')]);return _0x4ef255(_0xc8e962[_0xf82c('0x14')][_0xf82c('0x16')]);}logger[_0xf82c('0x14')](_0xf82c('0xf'),_0xb0751e,_0xc8e962[_0xf82c('0x14')][_0xf82c('0x16')]);return _0x300006(_0xc8e962[_0xf82c('0x14')]['message']);}else{logger[_0xf82c('0x17')](_0xf82c('0xf'),_0xb0751e,'request\x20sent');_0x300006(_0xc8e962[_0xf82c('0x18')][_0xf82c('0x16')]);}})[_0xf82c('0x19')](function(_0xca82e4){logger[_0xf82c('0x14')](_0xf82c('0xf'),_0xb0751e,_0xca82e4);_0x4ef255(_0xca82e4);});});}exports[_0xf82c('0x1a')]=function(_0x137007){var _0x22783d=this;return new Promise(function(_0x1864ea,_0x39c4cd){return db[_0xf82c('0x1b')]['findAll']({'raw':_0x137007[_0xf82c('0x1c')]?_0x137007['options']['raw']===undefined?!![]:![]:!![],'where':_0x137007['options']?_0x137007[_0xf82c('0x1c')][_0xf82c('0x1d')]||null:null,'attributes':[[db[_0xf82c('0x1e')]['fn'](_0xf82c('0x1f'),db[_0xf82c('0x1e')]['fn']('IF',db[_0xf82c('0x1e')][_0xf82c('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xf82c('0xe')](function(_0x2dd05a){logger['info']('GetVoiceQueueRtPauses',_0x137007);logger['debug'](_0xf82c('0x1a'),_0x137007,JSON[_0xf82c('0x13')](_0x2dd05a));_0x1864ea(_0x2dd05a);})[_0xf82c('0x19')](function(_0x2a5a4e){logger['error'](_0xf82c('0x1a'),_0x2a5a4e[_0xf82c('0x16')],_0x137007);_0x39c4cd(_0x22783d[_0xf82c('0x14')](0x1f4,_0x2a5a4e[_0xf82c('0x16')]));});});}; \ No newline at end of file +var _0x4fae=['UserVoiceQueueRt','options','raw','COUNT','sequelize','literal','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueRtPauses'];(function(_0x14562a,_0x4d3bed){var _0x1d1f9a=function(_0x373dee){while(--_0x373dee){_0x14562a['push'](_0x14562a['shift']());}};_0x1d1f9a(++_0x4d3bed);}(_0x4fae,0xba));var _0xe4fa=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x4fae[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xe4fa('0x0'));var util=require(_0xe4fa('0x1'));var moment=require(_0xe4fa('0x2'));var BPromise=require(_0xe4fa('0x3'));var rs=require(_0xe4fa('0x4'));var fs=require('fs');var Redis=require(_0xe4fa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4fa('0x6'));var logger=require(_0xe4fa('0x7'))(_0xe4fa('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xe4fa('0x9')]({'port':0x232a});config['redis']=_[_0xe4fa('0xa')](config[_0xe4fa('0xb')],{'host':_0xe4fa('0xc'),'port':0x18eb});var socket=require(_0xe4fa('0xd'))(new Redis(config[_0xe4fa('0xb')]));require(_0xe4fa('0xe'))[_0xe4fa('0xf')](socket);function respondWithRpcPromise(_0x3a1b40,_0x3d0aec,_0x311257){return new BPromise(function(_0x2af8e8,_0x6b17c3){return client[_0xe4fa('0x10')](_0x3a1b40,_0x311257)[_0xe4fa('0x11')](function(_0x2f6768){logger[_0xe4fa('0x12')](_0xe4fa('0x13'),_0x3d0aec,'request\x20sent');logger[_0xe4fa('0x14')](_0xe4fa('0x15'),_0x3d0aec,'request\x20sent',JSON[_0xe4fa('0x16')](_0x2f6768));if(_0x2f6768[_0xe4fa('0x17')]){if(_0x2f6768['error'][_0xe4fa('0x18')]===0x1f4){logger[_0xe4fa('0x17')](_0xe4fa('0x13'),_0x3d0aec,_0x2f6768[_0xe4fa('0x17')][_0xe4fa('0x19')]);return _0x6b17c3(_0x2f6768[_0xe4fa('0x17')][_0xe4fa('0x19')]);}logger[_0xe4fa('0x17')](_0xe4fa('0x13'),_0x3d0aec,_0x2f6768['error']['message']);return _0x2af8e8(_0x2f6768[_0xe4fa('0x17')][_0xe4fa('0x19')]);}else{logger[_0xe4fa('0x12')](_0xe4fa('0x13'),_0x3d0aec,_0xe4fa('0x1a'));_0x2af8e8(_0x2f6768[_0xe4fa('0x1b')][_0xe4fa('0x19')]);}})[_0xe4fa('0x1c')](function(_0x442dcd){logger[_0xe4fa('0x17')](_0xe4fa('0x13'),_0x3d0aec,_0x442dcd);_0x6b17c3(_0x442dcd);});});}exports[_0xe4fa('0x1d')]=function(_0x2eee10){var _0x5e0999=this;return new Promise(function(_0x50c114,_0xc2fa2d){return db[_0xe4fa('0x1e')]['findAll']({'raw':_0x2eee10['options']?_0x2eee10[_0xe4fa('0x1f')][_0xe4fa('0x20')]===undefined?!![]:![]:!![],'where':_0x2eee10['options']?_0x2eee10[_0xe4fa('0x1f')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xe4fa('0x21'),db[_0xe4fa('0x22')]['fn']('IF',db[_0xe4fa('0x22')][_0xe4fa('0x23')]('`paused`\x20=\x201,\x201,\x20null'))),'outboundQueuePauses']]})[_0xe4fa('0x11')](function(_0x45d1a6){logger[_0xe4fa('0x12')](_0xe4fa('0x1d'),_0x2eee10);logger[_0xe4fa('0x14')](_0xe4fa('0x1d'),_0x2eee10,JSON[_0xe4fa('0x16')](_0x45d1a6));_0x50c114(_0x45d1a6);})[_0xe4fa('0x1c')](function(_0x51d498){logger[_0xe4fa('0x17')]('GetVoiceQueueRtPauses',_0x51d498['message'],_0x2eee10);_0xc2fa2d(_0x5e0999[_0xe4fa('0x17')](0x1f4,_0x51d498[_0xe4fa('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index ff5b961..5171ec9 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 _0xa786=['removeListener','register','length','userVoiceQueueRt:','remove','update','emit'];(function(_0x521e85,_0x48b8b0){var _0xb27342=function(_0xf2f4da){while(--_0xf2f4da){_0x521e85['push'](_0x521e85['shift']());}};_0xb27342(++_0x48b8b0);}(_0xa786,0x1d2));var _0x6a78=function(_0x5bdcaf,_0x10ff0e){_0x5bdcaf=_0x5bdcaf-0x0;var _0x2ae15b=_0xa786[_0x5bdcaf];return _0x2ae15b;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x6a78('0x0'),_0x6a78('0x1')];function createListener(_0x96d812,_0x2c7e2a){return function(_0x22723f){_0x2c7e2a[_0x6a78('0x2')](_0x96d812,_0x22723f);};}function removeListener(_0x34b520,_0x521b4a){return function(){UserVoiceQueueRtEvents[_0x6a78('0x3')](_0x34b520,_0x521b4a);};}exports[_0x6a78('0x4')]=function(_0xc0be8b){for(var _0x45470e=0x0,_0x28d286=events[_0x6a78('0x5')];_0x45470e<_0x28d286;_0x45470e++){var _0x2b8c4c=events[_0x45470e];var _0x2a6de6=createListener(_0x6a78('0x6')+_0x2b8c4c,_0xc0be8b);UserVoiceQueueRtEvents['on'](_0x2b8c4c,_0x2a6de6);}}; \ No newline at end of file +var _0xf693=['userVoiceQueueRt:','save','remove','update','emit','removeListener','register','length'];(function(_0x53f7a0,_0x101cb4){var _0x51eb77=function(_0x10e001){while(--_0x10e001){_0x53f7a0['push'](_0x53f7a0['shift']());}};_0x51eb77(++_0x101cb4);}(_0xf693,0x181));var _0x3f69=function(_0x478230,_0x43d1d1){_0x478230=_0x478230-0x0;var _0x4dea62=_0xf693[_0x478230];return _0x4dea62;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3f69('0x0'),_0x3f69('0x1'),_0x3f69('0x2')];function createListener(_0x250a1d,_0x339d06){return function(_0x3dcdd6){_0x339d06[_0x3f69('0x3')](_0x250a1d,_0x3dcdd6);};}function removeListener(_0x527646,_0xf2fdd8){return function(){UserVoiceQueueRtEvents[_0x3f69('0x4')](_0x527646,_0xf2fdd8);};}exports[_0x3f69('0x5')]=function(_0x489d4d){for(var _0x3e4c37=0x0,_0x45461a=events[_0x3f69('0x6')];_0x3e4c37<_0x45461a;_0x3e4c37++){var _0x32544e=events[_0x3e4c37];var _0x1ac268=createListener(_0x3f69('0x7')+_0x32544e,_0x489d4d);UserVoiceQueueRtEvents['on'](_0x32544e,_0x1ac268);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 68bc3c3..5fb74a1 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(_0x52fde9,_0x5f4440){var _0x1a8bc5=function(_0x5fb76){while(--_0x5fb76){_0x52fde9['push'](_0x52fde9['shift']());}};_0x1a8bc5(++_0x5f4440);}(_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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x23f81d,_0x74a4c5){var _0x244b49=function(_0x143332){while(--_0x143332){_0x23f81d['push'](_0x23f81d['shift']());}};_0x244b49(++_0x74a4c5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 731054a..b70e058 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 _0x5eb6=['INTEGER','sequelize','exports'];(function(_0x406af3,_0x4b4988){var _0x28c25a=function(_0x2cf4a1){while(--_0x2cf4a1){_0x406af3['push'](_0x406af3['shift']());}};_0x28c25a(++_0x4b4988);}(_0x5eb6,0x9a));var _0x65eb=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x5eb6[_0x4e676e];return _0x336a3c;};'use strict';var Sequelize=require(_0x65eb('0x0'));module[_0x65eb('0x1')]={'penalty':{'type':Sequelize[_0x65eb('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x216e=['INTEGER','sequelize'];(function(_0x2e97b7,_0x5ea48e){var _0x43b6a2=function(_0x2dc407){while(--_0x2dc407){_0x2e97b7['push'](_0x2e97b7['shift']());}};_0x43b6a2(++_0x5ea48e);}(_0x216e,0x15f));var _0xe216=function(_0x1a16ad,_0x40a08b){_0x1a16ad=_0x1a16ad-0x0;var _0x59f9c2=_0x216e[_0x1a16ad];return _0x59f9c2;};'use strict';var Sequelize=require(_0xe216('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xe216('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index cbf2465..00e153d 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 _0x1fda=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x39ebde,_0x3544c3){var _0x595669=function(_0x54ae36){while(--_0x54ae36){_0x39ebde['push'](_0x39ebde['shift']());}};_0x595669(++_0x3544c3);}(_0x1fda,0x1a9));var _0xa1fd=function(_0x1b57b2,_0x2a5d29){_0x1b57b2=_0x1b57b2-0x0;var _0x344553=_0x1fda[_0x1b57b2];return _0x344553;};'use strict';var _=require(_0xa1fd('0x0'));var util=require(_0xa1fd('0x1'));var logger=require(_0xa1fd('0x2'))(_0xa1fd('0x3'));var moment=require(_0xa1fd('0x4'));var BPromise=require(_0xa1fd('0x5'));var rp=require(_0xa1fd('0x6'));var fs=require('fs');var path=require(_0xa1fd('0x7'));var rimraf=require(_0xa1fd('0x8'));var config=require(_0xa1fd('0x9'));var attributes=require('./userWhatsappQueue.attributes');module['exports']=function(_0x4af882,_0x47665f){return _0x4af882[_0xa1fd('0xa')](_0xa1fd('0xb'),attributes,{'tableName':_0xa1fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5663=['../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5663,0x144));var _0x3566=function(_0x515f78,_0x3b69be){_0x515f78=_0x515f78-0x0;var _0x506f6c=_0x5663[_0x515f78];return _0x506f6c;};'use strict';var _=require(_0x3566('0x0'));var util=require('util');var logger=require(_0x3566('0x1'))('api');var moment=require(_0x3566('0x2'));var BPromise=require(_0x3566('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3566('0x4'));var rimraf=require(_0x3566('0x5'));var config=require(_0x3566('0x6'));var attributes=require(_0x3566('0x7'));module['exports']=function(_0x26328b,_0x4ede79){return _0x26328b[_0x3566('0x8')](_0x3566('0x9'),attributes,{'tableName':_0x3566('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 37bc689..4a21dfa 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 _0xf9a1=['../../config/environment','jayson/promise','client','http','request','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xfc0fcf,_0x70887f){var _0x39d3c3=function(_0x172e6f){while(--_0x172e6f){_0xfc0fcf['push'](_0xfc0fcf['shift']());}};_0x39d3c3(++_0x70887f);}(_0xf9a1,0x195));var _0x1f9a=function(_0x51a0e8,_0x58bfc2){_0x51a0e8=_0x51a0e8-0x0;var _0x4c1f30=_0xf9a1[_0x51a0e8];return _0x4c1f30;};'use strict';var _=require(_0x1f9a('0x0'));var util=require(_0x1f9a('0x1'));var moment=require(_0x1f9a('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f9a('0x3'));var fs=require('fs');var Redis=require(_0x1f9a('0x4'));var db=require(_0x1f9a('0x5'))['db'];var utils=require(_0x1f9a('0x6'));var logger=require(_0x1f9a('0x7'))(_0x1f9a('0x8'));var config=require(_0x1f9a('0x9'));var jayson=require(_0x1f9a('0xa'));var client=jayson[_0x1f9a('0xb')][_0x1f9a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x469d66,_0x292c04,_0x160b4c){return new BPromise(function(_0x303809,_0x5e53ba){return client[_0x1f9a('0xd')](_0x469d66,_0x160b4c)['then'](function(_0x513258){logger[_0x1f9a('0xe')](_0x1f9a('0xf'),_0x292c04,_0x1f9a('0x10'));logger['debug'](_0x1f9a('0x11'),_0x292c04,_0x1f9a('0x10'),JSON[_0x1f9a('0x12')](_0x513258));if(_0x513258[_0x1f9a('0x13')]){if(_0x513258[_0x1f9a('0x13')][_0x1f9a('0x14')]===0x1f4){logger[_0x1f9a('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0x292c04,_0x513258[_0x1f9a('0x13')][_0x1f9a('0x15')]);return _0x5e53ba(_0x513258['error'][_0x1f9a('0x15')]);}logger[_0x1f9a('0x13')](_0x1f9a('0xf'),_0x292c04,_0x513258[_0x1f9a('0x13')]['message']);return _0x303809(_0x513258[_0x1f9a('0x13')][_0x1f9a('0x15')]);}else{logger['info'](_0x1f9a('0xf'),_0x292c04,_0x1f9a('0x10'));_0x303809(_0x513258['result'][_0x1f9a('0x15')]);}})[_0x1f9a('0x16')](function(_0x434d5a){logger[_0x1f9a('0x13')](_0x1f9a('0xf'),_0x292c04,_0x434d5a);_0x5e53ba(_0x434d5a);});});} \ No newline at end of file +var _0xc36a=['info','UserWhatsappQueue,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','util','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x2d1f80,_0x4e96b8){var _0x277c2d=function(_0x5e343c){while(--_0x5e343c){_0x2d1f80['push'](_0x2d1f80['shift']());}};_0x277c2d(++_0x4e96b8);}(_0xc36a,0x10d));var _0xac36=function(_0x5931c7,_0x2e6267){_0x5931c7=_0x5931c7-0x0;var _0x4fec52=_0xc36a[_0x5931c7];return _0x4fec52;};'use strict';var _=require(_0xac36('0x0'));var util=require(_0xac36('0x1'));var moment=require('moment');var BPromise=require(_0xac36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac36('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac36('0x4'));var config=require(_0xac36('0x5'));var jayson=require(_0xac36('0x6'));var client=jayson[_0xac36('0x7')][_0xac36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28916c,_0x469820,_0x11bd1d){return new BPromise(function(_0x2bb47c,_0x156d05){return client[_0xac36('0x9')](_0x28916c,_0x11bd1d)[_0xac36('0xa')](function(_0x41ef1f){logger[_0xac36('0xb')](_0xac36('0xc'),_0x469820,'request\x20sent');logger[_0xac36('0xd')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x469820,'request\x20sent',JSON[_0xac36('0xe')](_0x41ef1f));if(_0x41ef1f['error']){if(_0x41ef1f[_0xac36('0xf')]['code']===0x1f4){logger[_0xac36('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x469820,_0x41ef1f[_0xac36('0xf')][_0xac36('0x10')]);return _0x156d05(_0x41ef1f[_0xac36('0xf')][_0xac36('0x10')]);}logger[_0xac36('0xf')]('UserWhatsappQueue,\x20%s,\x20%s',_0x469820,_0x41ef1f['error'][_0xac36('0x10')]);return _0x2bb47c(_0x41ef1f[_0xac36('0xf')][_0xac36('0x10')]);}else{logger[_0xac36('0xb')](_0xac36('0xc'),_0x469820,_0xac36('0x11'));_0x2bb47c(_0x41ef1f[_0xac36('0x12')][_0xac36('0x10')]);}})[_0xac36('0x13')](function(_0x5e52ca){logger[_0xac36('0xf')](_0xac36('0xc'),_0x469820,_0x5e52ca);_0x156d05(_0x5e52ca);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 816336f..7962c53 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 _0x62c8=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','path','Router','fs-extra'];(function(_0x447291,_0x571423){var _0x412a17=function(_0xcc7b61){while(--_0xcc7b61){_0x447291['push'](_0x447291['shift']());}};_0x412a17(++_0x571423);}(_0x62c8,0x1ad));var _0x862c=function(_0x348ee4,_0x47ab69){_0x348ee4=_0x348ee4-0x0;var _0x2a5264=_0x62c8[_0x348ee4];return _0x2a5264;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x862c('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x862c('0x1')]();var fs_extra=require(_0x862c('0x2'));var auth=require(_0x862c('0x3'));var interaction=require(_0x862c('0x4'));var config=require(_0x862c('0x5'));var controller=require(_0x862c('0x6'));router['get']('/',auth[_0x862c('0x7')](),controller[_0x862c('0x8')]);router[_0x862c('0x9')](_0x862c('0xa'),auth[_0x862c('0x7')](),controller[_0x862c('0xb')]);router[_0x862c('0xc')]('/',auth[_0x862c('0x7')](),controller[_0x862c('0xd')]);router[_0x862c('0xe')](_0x862c('0xa'),auth['isAuthenticated'](),controller[_0x862c('0xf')]);router[_0x862c('0x10')](_0x862c('0xa'),auth[_0x862c('0x7')](),controller[_0x862c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb91a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x5cbf1c,_0x51a890){var _0x4265fb=function(_0x16c9b5){while(--_0x16c9b5){_0x5cbf1c['push'](_0x5cbf1c['shift']());}};_0x4265fb(++_0x51a890);}(_0xb91a,0xf4));var _0xab91=function(_0x54d5ad,_0x3c0989){_0x54d5ad=_0x54d5ad-0x0;var _0x24b9c5=_0xb91a[_0x54d5ad];return _0x24b9c5;};'use strict';var multer=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var path=require(_0xab91('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xab91('0x3')]();var fs_extra=require(_0xab91('0x4'));var auth=require(_0xab91('0x5'));var interaction=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var controller=require(_0xab91('0x8'));router[_0xab91('0x9')]('/',auth[_0xab91('0xa')](),controller[_0xab91('0xb')]);router[_0xab91('0x9')]('/:id',auth[_0xab91('0xa')](),controller[_0xab91('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xab91('0xd')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0xf')]);router[_0xab91('0x10')](_0xab91('0xe'),auth[_0xab91('0xa')](),controller[_0xab91('0x11')]);module[_0xab91('0x12')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7431c59..97ec12a 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 _0x0fcf=['name','STRING'];(function(_0x18270f,_0x475de9){var _0x4bc4a2=function(_0x559273){while(--_0x559273){_0x18270f['push'](_0x18270f['shift']());}};_0x4bc4a2(++_0x475de9);}(_0x0fcf,0xdb));var _0xf0fc=function(_0x1bee27,_0x9de998){_0x1bee27=_0x1bee27-0x0;var _0x1348eb=_0x0fcf[_0x1bee27];return _0x1348eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf0fc('0x0')],'unique':_0xf0fc('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf0fc('0x0')]}}; \ No newline at end of file +var _0xf4e7=['name','sequelize','exports','STRING'];(function(_0x43941d,_0x45fd0d){var _0x27b82a=function(_0x21851e){while(--_0x21851e){_0x43941d['push'](_0x43941d['shift']());}};_0x27b82a(++_0x45fd0d);}(_0xf4e7,0x139));var _0x7f4e=function(_0x57cc54,_0x6862b1){_0x57cc54=_0x57cc54-0x0;var _0xa93acc=_0xf4e7[_0x57cc54];return _0xa93acc;};'use strict';var Sequelize=require(_0x7f4e('0x0'));module[_0x7f4e('0x1')]={'name':{'type':Sequelize[_0x7f4e('0x2')],'unique':_0x7f4e('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7f4e('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index cf33810..d58bdf6 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 _0xf966=['UserProfileSection','userProfileId','autoAssociation','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Variables','end','error','stack','send','index','map','Variable','rawAttributes','fieldName','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x178118,_0x293a41){var _0x5beaa2=function(_0x5c825b){while(--_0x5c825b){_0x178118['push'](_0x178118['shift']());}};_0x5beaa2(++_0x293a41);}(_0xf966,0x1bd));var _0x6f96=function(_0xed6d48,_0x4f16e4){_0xed6d48=_0xed6d48-0x0;var _0x49a35f=_0xf966[_0xed6d48];return _0x49a35f;};'use strict';var emlformat=require(_0x6f96('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6f96('0x1'));var jsonpatch=require(_0x6f96('0x2'));var rp=require(_0x6f96('0x3'));var moment=require(_0x6f96('0x4'));var BPromise=require(_0x6f96('0x5'));var Mustache=require(_0x6f96('0x6'));var util=require(_0x6f96('0x7'));var path=require('path');var sox=require(_0x6f96('0x8'));var csv=require(_0x6f96('0x9'));var ejs=require(_0x6f96('0xa'));var fs=require('fs');var fs_extra=require(_0x6f96('0xb'));var _=require(_0x6f96('0xc'));var squel=require(_0x6f96('0xd'));var crypto=require(_0x6f96('0xe'));var jsforce=require(_0x6f96('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f96('0x10'));var Papa=require(_0x6f96('0x11'));var Redis=require(_0x6f96('0x12'));var authService=require(_0x6f96('0x13'));var qs=require(_0x6f96('0x14'));var as=require(_0x6f96('0x15'));var hardwareService=require(_0x6f96('0x16'));var logger=require(_0x6f96('0x17'))(_0x6f96('0x18'));var utils=require(_0x6f96('0x19'));var config=require(_0x6f96('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x6f96('0x1b'))['db'];function respondWithStatusCode(_0x421494,_0x57c646){_0x57c646=_0x57c646||0xcc;return function(_0x9219fa){if(_0x9219fa){return _0x421494[_0x6f96('0x1c')](_0x57c646);}return _0x421494[_0x6f96('0x1d')](_0x57c646)['end']();};}function respondWithResult(_0x206e5d,_0x470331){_0x470331=_0x470331||0xc8;return function(_0x105ade){if(_0x105ade){return _0x206e5d[_0x6f96('0x1d')](_0x470331)[_0x6f96('0x1e')](_0x105ade);}};}function respondWithFilteredResult(_0x4e859b,_0x9aef9b){return function(_0x4a3b0e){if(_0x4a3b0e){var _0x50d8ad=typeof _0x9aef9b[_0x6f96('0x1f')]==='undefined'&&typeof _0x9aef9b[_0x6f96('0x20')]==='undefined';var _0x2d38b7=_0x4a3b0e[_0x6f96('0x21')];var _0x1b6e48=_0x50d8ad?0x0:_0x9aef9b['offset'];var _0x5ad2c4=_0x50d8ad?_0x4a3b0e[_0x6f96('0x21')]:_0x9aef9b[_0x6f96('0x1f')]+_0x9aef9b['limit'];var _0x3dc3c3;if(_0x5ad2c4>=_0x2d38b7){_0x5ad2c4=_0x2d38b7;_0x3dc3c3=0xc8;}else{_0x3dc3c3=0xce;}_0x4e859b[_0x6f96('0x1d')](_0x3dc3c3);return _0x4e859b['set'](_0x6f96('0x22'),_0x1b6e48+'-'+_0x5ad2c4+'/'+_0x2d38b7)[_0x6f96('0x1e')](_0x4a3b0e);}return null;};}function patchUpdates(_0x4f0600){return function(_0x2531cd){try{jsonpatch[_0x6f96('0x23')](_0x2531cd,_0x4f0600,!![]);}catch(_0x5daffe){return BPromise[_0x6f96('0x24')](_0x5daffe);}return _0x2531cd[_0x6f96('0x25')]();};}function saveUpdates(_0x1f0fc8,_0x10b986){return function(_0x791fcc){if(_0x791fcc){return _0x791fcc[_0x6f96('0x26')](_0x1f0fc8)['then'](function(_0x395a2d){return _0x395a2d;});}return null;};}function removeEntity(_0x30810b,_0x49e01f){return function(_0x333bed){if(_0x333bed){return _0x333bed[_0x6f96('0x27')]()[_0x6f96('0x28')](function(){var _0x3d06d4=_0x333bed[_0x6f96('0x29')]({'plain':!![]});var _0x1a17ec=_0x6f96('0x2a');return db['UserProfileResource']['destroy']({'where':{'type':_0x1a17ec,'resourceId':_0x3d06d4['id']}})['then'](function(){return _0x333bed;});})[_0x6f96('0x28')](function(){_0x30810b['status'](0xcc)[_0x6f96('0x2b')]();});}};}function handleEntityNotFound(_0x1a2791,_0x307551){return function(_0x3394bb){if(!_0x3394bb){_0x1a2791[_0x6f96('0x1c')](0x194);}return _0x3394bb;};}function handleError(_0x17be04,_0x11df66){_0x11df66=_0x11df66||0x1f4;return function(_0x4385cb){logger[_0x6f96('0x2c')](_0x4385cb[_0x6f96('0x2d')]);if(_0x4385cb['name']){delete _0x4385cb['name'];}_0x17be04[_0x6f96('0x1d')](_0x11df66)[_0x6f96('0x2e')](_0x4385cb);};}exports[_0x6f96('0x2f')]=function(_0x503782,_0x1d53d5){var _0x311888={},_0x110df7={},_0xad62e={'count':0x0,'rows':[]};var _0xa3b45c=_[_0x6f96('0x30')](db[_0x6f96('0x31')][_0x6f96('0x32')],function(_0x28527c){return{'name':_0x28527c[_0x6f96('0x33')],'type':_0x28527c['type']['key']};});_0x110df7[_0x6f96('0x34')]=_['map'](_0xa3b45c,_0x6f96('0x35'));_0x110df7[_0x6f96('0x36')]=_[_0x6f96('0x37')](_0x503782[_0x6f96('0x36')]);_0x110df7['filters']=_[_0x6f96('0x38')](_0x110df7['model'],_0x110df7['query']);_0x311888[_0x6f96('0x39')]=_[_0x6f96('0x38')](_0x110df7[_0x6f96('0x34')],qs[_0x6f96('0x3a')](_0x503782[_0x6f96('0x36')]['fields']));_0x311888[_0x6f96('0x39')]=_0x311888[_0x6f96('0x39')][_0x6f96('0x3b')]?_0x311888[_0x6f96('0x39')]:_0x110df7['model'];if(!_0x503782['query'][_0x6f96('0x3c')](_0x6f96('0x3d'))){_0x311888[_0x6f96('0x20')]=qs[_0x6f96('0x20')](_0x503782['query'][_0x6f96('0x20')]);_0x311888[_0x6f96('0x1f')]=qs['offset'](_0x503782['query'][_0x6f96('0x1f')]);}_0x311888[_0x6f96('0x3e')]=qs[_0x6f96('0x3f')](_0x503782[_0x6f96('0x36')][_0x6f96('0x3f')]);_0x311888[_0x6f96('0x40')]=qs[_0x6f96('0x41')](_[_0x6f96('0x42')](_0x503782[_0x6f96('0x36')],_0x110df7[_0x6f96('0x41')]),_0xa3b45c);if(_0x503782[_0x6f96('0x36')][_0x6f96('0x43')]){_0x311888[_0x6f96('0x40')]=_[_0x6f96('0x44')](_0x311888[_0x6f96('0x40')],{'$or':_[_0x6f96('0x30')](_0xa3b45c,function(_0x528760){if(_0x528760[_0x6f96('0x45')]!==_0x6f96('0x46')){var _0x28abae={};_0x28abae[_0x528760['name']]={'$like':'%'+_0x503782[_0x6f96('0x36')][_0x6f96('0x43')]+'%'};return _0x28abae;}})});}_0x311888=_[_0x6f96('0x44')]({},_0x311888,_0x503782[_0x6f96('0x47')]);var _0x554ece={'where':_0x311888[_0x6f96('0x40')]};return db[_0x6f96('0x31')][_0x6f96('0x21')](_0x554ece)[_0x6f96('0x28')](function(_0x274970){_0xad62e['count']=_0x274970;if(_0x503782['query'][_0x6f96('0x48')]){_0x311888[_0x6f96('0x49')]=[{'all':!![]}];}return db[_0x6f96('0x31')][_0x6f96('0x4a')](_0x311888);})[_0x6f96('0x28')](function(_0x393244){_0xad62e[_0x6f96('0x4b')]=_0x393244;return _0xad62e;})[_0x6f96('0x28')](respondWithFilteredResult(_0x1d53d5,_0x311888))[_0x6f96('0x4c')](handleError(_0x1d53d5,null));};exports[_0x6f96('0x4d')]=function(_0x4e338d,_0x541496){var _0x4778fa={'raw':!![],'where':{'id':_0x4e338d[_0x6f96('0x4e')]['id']}},_0x3a5bbe={};_0x3a5bbe[_0x6f96('0x34')]=_[_0x6f96('0x37')](db[_0x6f96('0x31')][_0x6f96('0x32')]);_0x3a5bbe['query']=_[_0x6f96('0x37')](_0x4e338d['query']);_0x3a5bbe[_0x6f96('0x41')]=_[_0x6f96('0x38')](_0x3a5bbe['model'],_0x3a5bbe[_0x6f96('0x36')]);_0x4778fa[_0x6f96('0x39')]=_[_0x6f96('0x38')](_0x3a5bbe['model'],qs['fields'](_0x4e338d['query'][_0x6f96('0x3a')]));_0x4778fa[_0x6f96('0x39')]=_0x4778fa[_0x6f96('0x39')]['length']?_0x4778fa[_0x6f96('0x39')]:_0x3a5bbe[_0x6f96('0x34')];if(_0x4e338d['query'][_0x6f96('0x48')]){_0x4778fa[_0x6f96('0x49')]=[{'all':!![]}];}_0x4778fa=_['merge']({},_0x4778fa,_0x4e338d[_0x6f96('0x47')]);return db[_0x6f96('0x31')]['find'](_0x4778fa)[_0x6f96('0x28')](handleEntityNotFound(_0x541496,null))[_0x6f96('0x28')](respondWithResult(_0x541496,null))[_0x6f96('0x4c')](handleError(_0x541496,null));};exports[_0x6f96('0x4f')]=function(_0x73fd2f,_0x523531){return db[_0x6f96('0x31')][_0x6f96('0x4f')](_0x73fd2f['body'],{})[_0x6f96('0x28')](function(_0x564d9f){var _0x361de8=_0x73fd2f[_0x6f96('0x50')][_0x6f96('0x29')]({'plain':!![]});if(!_0x361de8)throw new Error(_0x6f96('0x51'));if(_0x361de8[_0x6f96('0x52')]===_0x6f96('0x50')){var _0x3034f6=_0x564d9f[_0x6f96('0x29')]({'plain':!![]});var _0x594e89=_0x6f96('0x2a');return db[_0x6f96('0x53')]['find']({'where':{'name':_0x594e89,'userProfileId':_0x361de8[_0x6f96('0x54')]},'raw':!![]})[_0x6f96('0x28')](function(_0x34b66c){if(_0x34b66c&&_0x34b66c[_0x6f96('0x55')]===0x0){return db['UserProfileResource'][_0x6f96('0x4f')]({'name':_0x3034f6['name'],'resourceId':_0x3034f6['id'],'type':_0x34b66c[_0x6f96('0x35')],'sectionId':_0x34b66c['id']},{})[_0x6f96('0x28')](function(){return _0x564d9f;});}else{return _0x564d9f;}})[_0x6f96('0x4c')](function(_0x1d14cf){logger[_0x6f96('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d14cf);throw _0x1d14cf;});}return _0x564d9f;})['then'](respondWithResult(_0x523531,0xc9))[_0x6f96('0x4c')](handleError(_0x523531,null));};exports[_0x6f96('0x26')]=function(_0x12a572,_0x169120){if(_0x12a572[_0x6f96('0x56')]['id']){delete _0x12a572[_0x6f96('0x56')]['id'];}return db['Variable'][_0x6f96('0x57')]({'where':{'id':_0x12a572[_0x6f96('0x4e')]['id']}})['then'](handleEntityNotFound(_0x169120,null))[_0x6f96('0x28')](saveUpdates(_0x12a572[_0x6f96('0x56')],null))['then'](respondWithResult(_0x169120,null))[_0x6f96('0x4c')](handleError(_0x169120,null));};exports[_0x6f96('0x27')]=function(_0x29a195,_0x3a2149){return db[_0x6f96('0x31')][_0x6f96('0x57')]({'where':{'id':_0x29a195[_0x6f96('0x4e')]['id']}})[_0x6f96('0x28')](handleEntityNotFound(_0x3a2149,null))['then'](removeEntity(_0x3a2149,null))[_0x6f96('0x4c')](handleError(_0x3a2149,null));}; \ No newline at end of file +var _0xe34a=['zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','Variables','UserProfileResource','destroy','end','stack','name','send','index','map','Variable','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf'];(function(_0xd75b98,_0x15ad99){var _0xdd720e=function(_0x326b38){while(--_0x326b38){_0xd75b98['push'](_0xd75b98['shift']());}};_0xdd720e(++_0x15ad99);}(_0xe34a,0x189));var _0xae34=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xe34a[_0x18a436];return _0x5c2cf8;};'use strict';var emlformat=require(_0xae34('0x0'));var rimraf=require(_0xae34('0x1'));var zipdir=require(_0xae34('0x2'));var jsonpatch=require(_0xae34('0x3'));var rp=require(_0xae34('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xae34('0x5'));var util=require(_0xae34('0x6'));var path=require(_0xae34('0x7'));var sox=require('sox');var csv=require(_0xae34('0x8'));var ejs=require(_0xae34('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae34('0xa'));var squel=require(_0xae34('0xb'));var crypto=require(_0xae34('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xae34('0x8'));var querystring=require(_0xae34('0xd'));var Papa=require(_0xae34('0xe'));var Redis=require(_0xae34('0xf'));var authService=require(_0xae34('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae34('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xae34('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xae34('0x13'))['db'];function respondWithStatusCode(_0x56ba1b,_0x54ea52){_0x54ea52=_0x54ea52||0xcc;return function(_0x47aba3){if(_0x47aba3){return _0x56ba1b[_0xae34('0x14')](_0x54ea52);}return _0x56ba1b['status'](_0x54ea52)['end']();};}function respondWithResult(_0xe6f520,_0xf9f8c8){_0xf9f8c8=_0xf9f8c8||0xc8;return function(_0x32eab4){if(_0x32eab4){return _0xe6f520[_0xae34('0x15')](_0xf9f8c8)[_0xae34('0x16')](_0x32eab4);}};}function respondWithFilteredResult(_0x62850,_0x359c72){return function(_0x3a5496){if(_0x3a5496){var _0x5d0f86=typeof _0x359c72[_0xae34('0x17')]===_0xae34('0x18')&&typeof _0x359c72[_0xae34('0x19')]==='undefined';var _0x3f281c=_0x3a5496[_0xae34('0x1a')];var _0xde7ded=_0x5d0f86?0x0:_0x359c72[_0xae34('0x17')];var _0x3d9b8a=_0x5d0f86?_0x3a5496[_0xae34('0x1a')]:_0x359c72[_0xae34('0x17')]+_0x359c72[_0xae34('0x19')];var _0x5e1ba3;if(_0x3d9b8a>=_0x3f281c){_0x3d9b8a=_0x3f281c;_0x5e1ba3=0xc8;}else{_0x5e1ba3=0xce;}_0x62850[_0xae34('0x15')](_0x5e1ba3);return _0x62850[_0xae34('0x1b')](_0xae34('0x1c'),_0xde7ded+'-'+_0x3d9b8a+'/'+_0x3f281c)[_0xae34('0x16')](_0x3a5496);}return null;};}function patchUpdates(_0x493597){return function(_0x52225d){try{jsonpatch['apply'](_0x52225d,_0x493597,!![]);}catch(_0x20f950){return BPromise[_0xae34('0x1d')](_0x20f950);}return _0x52225d['save']();};}function saveUpdates(_0x5ee879,_0x34ea14){return function(_0x298882){if(_0x298882){return _0x298882[_0xae34('0x1e')](_0x5ee879)[_0xae34('0x1f')](function(_0x584c7f){return _0x584c7f;});}return null;};}function removeEntity(_0x39c6a3,_0x54107b){return function(_0x55112e){if(_0x55112e){return _0x55112e['destroy']()['then'](function(){var _0x14e46e=_0x55112e[_0xae34('0x20')]({'plain':!![]});var _0x1fced2=_0xae34('0x21');return db[_0xae34('0x22')][_0xae34('0x23')]({'where':{'type':_0x1fced2,'resourceId':_0x14e46e['id']}})['then'](function(){return _0x55112e;});})[_0xae34('0x1f')](function(){_0x39c6a3[_0xae34('0x15')](0xcc)[_0xae34('0x24')]();});}};}function handleEntityNotFound(_0x28e247,_0x1a90e4){return function(_0x51e9fa){if(!_0x51e9fa){_0x28e247[_0xae34('0x14')](0x194);}return _0x51e9fa;};}function handleError(_0x4f1ed4,_0x3d7098){_0x3d7098=_0x3d7098||0x1f4;return function(_0x3d2870){logger['error'](_0x3d2870[_0xae34('0x25')]);if(_0x3d2870[_0xae34('0x26')]){delete _0x3d2870[_0xae34('0x26')];}_0x4f1ed4['status'](_0x3d7098)[_0xae34('0x27')](_0x3d2870);};}exports[_0xae34('0x28')]=function(_0x5b061b,_0x162795){var _0x348dc3={},_0x199f32={},_0x74ea16={'count':0x0,'rows':[]};var _0x2de3f4=_[_0xae34('0x29')](db[_0xae34('0x2a')]['rawAttributes'],function(_0x35e15e){return{'name':_0x35e15e[_0xae34('0x2b')],'type':_0x35e15e[_0xae34('0x2c')][_0xae34('0x2d')]};});_0x199f32[_0xae34('0x2e')]=_[_0xae34('0x29')](_0x2de3f4,_0xae34('0x26'));_0x199f32[_0xae34('0x2f')]=_[_0xae34('0x30')](_0x5b061b['query']);_0x199f32[_0xae34('0x31')]=_[_0xae34('0x32')](_0x199f32['model'],_0x199f32[_0xae34('0x2f')]);_0x348dc3[_0xae34('0x33')]=_[_0xae34('0x32')](_0x199f32[_0xae34('0x2e')],qs[_0xae34('0x34')](_0x5b061b['query']['fields']));_0x348dc3[_0xae34('0x33')]=_0x348dc3[_0xae34('0x33')][_0xae34('0x35')]?_0x348dc3[_0xae34('0x33')]:_0x199f32[_0xae34('0x2e')];if(!_0x5b061b[_0xae34('0x2f')]['hasOwnProperty'](_0xae34('0x36'))){_0x348dc3[_0xae34('0x19')]=qs['limit'](_0x5b061b['query'][_0xae34('0x19')]);_0x348dc3[_0xae34('0x17')]=qs[_0xae34('0x17')](_0x5b061b[_0xae34('0x2f')][_0xae34('0x17')]);}_0x348dc3[_0xae34('0x37')]=qs[_0xae34('0x38')](_0x5b061b['query'][_0xae34('0x38')]);_0x348dc3[_0xae34('0x39')]=qs[_0xae34('0x31')](_[_0xae34('0x3a')](_0x5b061b[_0xae34('0x2f')],_0x199f32['filters']),_0x2de3f4);if(_0x5b061b[_0xae34('0x2f')]['filter']){_0x348dc3[_0xae34('0x39')]=_[_0xae34('0x3b')](_0x348dc3[_0xae34('0x39')],{'$or':_[_0xae34('0x29')](_0x2de3f4,function(_0x3c45bd){if(_0x3c45bd['type']!==_0xae34('0x3c')){var _0x26d20e={};_0x26d20e[_0x3c45bd[_0xae34('0x26')]]={'$like':'%'+_0x5b061b[_0xae34('0x2f')][_0xae34('0x3d')]+'%'};return _0x26d20e;}})});}_0x348dc3=_[_0xae34('0x3b')]({},_0x348dc3,_0x5b061b[_0xae34('0x3e')]);var _0xc8ec={'where':_0x348dc3['where']};return db[_0xae34('0x2a')][_0xae34('0x1a')](_0xc8ec)[_0xae34('0x1f')](function(_0x3bab41){_0x74ea16[_0xae34('0x1a')]=_0x3bab41;if(_0x5b061b[_0xae34('0x2f')][_0xae34('0x3f')]){_0x348dc3[_0xae34('0x40')]=[{'all':!![]}];}return db[_0xae34('0x2a')]['findAll'](_0x348dc3);})[_0xae34('0x1f')](function(_0xa1c5e1){_0x74ea16[_0xae34('0x41')]=_0xa1c5e1;return _0x74ea16;})[_0xae34('0x1f')](respondWithFilteredResult(_0x162795,_0x348dc3))[_0xae34('0x42')](handleError(_0x162795,null));};exports[_0xae34('0x43')]=function(_0xc83f36,_0x335725){var _0x59d310={'raw':!![],'where':{'id':_0xc83f36[_0xae34('0x44')]['id']}},_0x1709ea={};_0x1709ea[_0xae34('0x2e')]=_[_0xae34('0x30')](db['Variable'][_0xae34('0x45')]);_0x1709ea['query']=_[_0xae34('0x30')](_0xc83f36[_0xae34('0x2f')]);_0x1709ea[_0xae34('0x31')]=_[_0xae34('0x32')](_0x1709ea[_0xae34('0x2e')],_0x1709ea[_0xae34('0x2f')]);_0x59d310[_0xae34('0x33')]=_[_0xae34('0x32')](_0x1709ea['model'],qs[_0xae34('0x34')](_0xc83f36[_0xae34('0x2f')][_0xae34('0x34')]));_0x59d310[_0xae34('0x33')]=_0x59d310[_0xae34('0x33')][_0xae34('0x35')]?_0x59d310['attributes']:_0x1709ea[_0xae34('0x2e')];if(_0xc83f36[_0xae34('0x2f')][_0xae34('0x3f')]){_0x59d310[_0xae34('0x40')]=[{'all':!![]}];}_0x59d310=_[_0xae34('0x3b')]({},_0x59d310,_0xc83f36[_0xae34('0x3e')]);return db[_0xae34('0x2a')][_0xae34('0x46')](_0x59d310)[_0xae34('0x1f')](handleEntityNotFound(_0x335725,null))[_0xae34('0x1f')](respondWithResult(_0x335725,null))['catch'](handleError(_0x335725,null));};exports[_0xae34('0x47')]=function(_0x2dab4f,_0x5eeaa3){return db[_0xae34('0x2a')]['create'](_0x2dab4f[_0xae34('0x48')],{})[_0xae34('0x1f')](function(_0x61e592){var _0x51bf5e=_0x2dab4f[_0xae34('0x49')][_0xae34('0x20')]({'plain':!![]});if(!_0x51bf5e)throw new Error(_0xae34('0x4a'));if(_0x51bf5e['role']==='user'){var _0x5f0716=_0x61e592[_0xae34('0x20')]({'plain':!![]});var _0x4292b4='Variables';return db[_0xae34('0x4b')][_0xae34('0x46')]({'where':{'name':_0x4292b4,'userProfileId':_0x51bf5e[_0xae34('0x4c')]},'raw':!![]})['then'](function(_0x1daba9){if(_0x1daba9&&_0x1daba9['autoAssociation']===0x0){return db[_0xae34('0x22')]['create']({'name':_0x5f0716[_0xae34('0x26')],'resourceId':_0x5f0716['id'],'type':_0x1daba9[_0xae34('0x26')],'sectionId':_0x1daba9['id']},{})['then'](function(){return _0x61e592;});}else{return _0x61e592;}})[_0xae34('0x42')](function(_0x2b9422){logger[_0xae34('0x4d')](_0xae34('0x4e'),_0x2b9422);throw _0x2b9422;});}return _0x61e592;})[_0xae34('0x1f')](respondWithResult(_0x5eeaa3,0xc9))[_0xae34('0x42')](handleError(_0x5eeaa3,null));};exports['update']=function(_0x308908,_0x2d9978){if(_0x308908[_0xae34('0x48')]['id']){delete _0x308908[_0xae34('0x48')]['id'];}return db[_0xae34('0x2a')][_0xae34('0x46')]({'where':{'id':_0x308908[_0xae34('0x44')]['id']}})[_0xae34('0x1f')](handleEntityNotFound(_0x2d9978,null))[_0xae34('0x1f')](saveUpdates(_0x308908[_0xae34('0x48')],null))[_0xae34('0x1f')](respondWithResult(_0x2d9978,null))['catch'](handleError(_0x2d9978,null));};exports[_0xae34('0x23')]=function(_0x163194,_0x1042ba){return db[_0xae34('0x2a')][_0xae34('0x46')]({'where':{'id':_0x163194[_0xae34('0x44')]['id']}})['then'](handleEntityNotFound(_0x1042ba,null))[_0xae34('0x1f')](removeEntity(_0x1042ba,null))[_0xae34('0x42')](handleError(_0x1042ba,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 202f81d..ae37b8e 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 _0xf04e=['Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0xf04e,0x16a));var _0xef04=function(_0x888093,_0x585cc1){_0x888093=_0x888093-0x0;var _0x44b54a=_0xf04e[_0x888093];return _0x44b54a;};'use strict';var _=require(_0xef04('0x0'));var util=require(_0xef04('0x1'));var logger=require(_0xef04('0x2'))(_0xef04('0x3'));var moment=require('moment');var BPromise=require(_0xef04('0x4'));var rp=require(_0xef04('0x5'));var fs=require('fs');var path=require(_0xef04('0x6'));var rimraf=require(_0xef04('0x7'));var config=require('../../config/environment');var attributes=require('./variable.attributes');module[_0xef04('0x8')]=function(_0x27270a,_0x3f2d02){return _0x27270a[_0xef04('0x9')](_0xef04('0xa'),attributes,{'tableName':_0xef04('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x909b=['define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x909b,0x189));var _0xb909=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x909b[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xb909('0x0'));var util=require('util');var logger=require(_0xb909('0x1'))(_0xb909('0x2'));var moment=require(_0xb909('0x3'));var BPromise=require(_0xb909('0x4'));var rp=require(_0xb909('0x5'));var fs=require('fs');var path=require(_0xb909('0x6'));var rimraf=require('rimraf');var config=require(_0xb909('0x7'));var attributes=require(_0xb909('0x8'));module[_0xb909('0x9')]=function(_0x3aa839,_0x451f3c){return _0x3aa839[_0xb909('0xa')](_0xb909('0xb'),attributes,{'tableName':_0xb909('0xc'),'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 c970ea6..0669bdd 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 _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x2ee1cc,_0x59ce25){var _0x4dae8f=function(_0x435860){while(--_0x435860){_0x2ee1cc['push'](_0x2ee1cc['shift']());}};_0x4dae8f(++_0x59ce25);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var 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']('Variable,\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);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x458897,_0x4aac86){var _0xbc7b62=function(_0x50e2b1){while(--_0x50e2b1){_0x458897['push'](_0x458897['shift']());}};_0xbc7b62(++_0x4aac86);}(_0xf494,0x1c6));var _0x4f49=function(_0x1d525d,_0x491998){_0x1d525d=_0x1d525d-0x0;var _0x135719=_0xf494[_0x1d525d];return _0x135719;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b2840d8..6e1f58a 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 _0xb81d=['index','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get'];(function(_0x4ab9a7,_0x291df1){var _0xd08799=function(_0x32bd6a){while(--_0x32bd6a){_0x4ab9a7['push'](_0x4ab9a7['shift']());}};_0xd08799(++_0x291df1);}(_0xb81d,0x182));var _0xdb81=function(_0x45af53,_0x59f613){_0x45af53=_0x45af53-0x0;var _0x5cddfd=_0xb81d[_0x45af53];return _0x5cddfd;};'use strict';var express=require(_0xdb81('0x0'));var router=express[_0xdb81('0x1')]();var auth=require(_0xdb81('0x2'));var controller=require(_0xdb81('0x3'));router[_0xdb81('0x4')]('/',controller[_0xdb81('0x5')]);router[_0xdb81('0x4')]('/fetch',auth['isAuthenticated'](),auth[_0xdb81('0x6')](),controller[_0xdb81('0x7')]);router[_0xdb81('0x4')](_0xdb81('0x8'),auth[_0xdb81('0x9')](),auth['canUpdate'](),controller['reset']);router[_0xdb81('0x4')](_0xdb81('0xa'),auth[_0xdb81('0x9')](),auth[_0xdb81('0x6')](),controller[_0xdb81('0xb')]);router[_0xdb81('0x4')](_0xdb81('0xc'),auth[_0xdb81('0x9')](),controller[_0xdb81('0xd')]);router[_0xdb81('0x4')](_0xdb81('0xe'),controller[_0xdb81('0xf')]);module[_0xdb81('0x10')]=router; \ No newline at end of file +var _0x657e=['express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/pull','pull','/restart','restart','/migrations'];(function(_0x49b80a,_0x5886a6){var _0x3026f4=function(_0x4e4acb){while(--_0x4e4acb){_0x49b80a['push'](_0x49b80a['shift']());}};_0x3026f4(++_0x5886a6);}(_0x657e,0xf0));var _0xe657=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0x657e[_0x376db5];return _0x304c17;};'use strict';var express=require(_0xe657('0x0'));var router=express[_0xe657('0x1')]();var auth=require(_0xe657('0x2'));var controller=require(_0xe657('0x3'));router[_0xe657('0x4')]('/',controller[_0xe657('0x5')]);router[_0xe657('0x4')](_0xe657('0x6'),auth[_0xe657('0x7')](),auth[_0xe657('0x8')](),controller[_0xe657('0x9')]);router['get']('/reset',auth[_0xe657('0x7')](),auth[_0xe657('0x8')](),controller['reset']);router[_0xe657('0x4')](_0xe657('0xa'),auth[_0xe657('0x7')](),auth[_0xe657('0x8')](),controller[_0xe657('0xb')]);router[_0xe657('0x4')](_0xe657('0xc'),auth[_0xe657('0x7')](),controller[_0xe657('0xd')]);router['get'](_0xe657('0xe'),controller['migrations']);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 1aed051..0a2dc88 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 _0x46fa=['motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','join','root','server','migrations','length','replace','.js','sort','sequelize','Migration','getQueryInterface','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','update','simple-git','exports','version','query','latest','fetch','tags','json','status','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart'];(function(_0x347d05,_0x250cbc){var _0xbfb33e=function(_0x30f03d){while(--_0x30f03d){_0x347d05['push'](_0x347d05['shift']());}};_0xbfb33e(++_0x250cbc);}(_0x46fa,0x182));var _0xa46f=function(_0x4288f5,_0x3e9da9){_0x4288f5=_0x4288f5-0x0;var _0x2da1c0=_0x46fa[_0x4288f5];return _0x2da1c0;};'use strict';var Umzug=require(_0xa46f('0x0'));var path=require('path');var fs=require('fs');var _=require(_0xa46f('0x1'));var pkginfo=require(_0xa46f('0x2'))(module,'version');var compareVersions=require(_0xa46f('0x3'));var exec=require(_0xa46f('0x4'))[_0xa46f('0x5')];var db=require(_0xa46f('0x6'))['db'];var config=require(_0xa46f('0x7'));var pm2=require(_0xa46f('0x8'));var logger=require('../../config/logger')(_0xa46f('0x9'));var git=require(_0xa46f('0xa'))(config['root']);exports['index']=function(_0x4e56a7,_0x5f056f){var _0x54f216={'current':module[_0xa46f('0xb')][_0xa46f('0xc')],'phonebar':0x2};if(_0x4e56a7[_0xa46f('0xd')]&&_0x4e56a7[_0xa46f('0xd')][_0xa46f('0xe')]){return git[_0xa46f('0xf')]()[_0xa46f('0x10')](function(_0x19d1b9,_0x38fc86){_0x54f216[_0xa46f('0xe')]=(_0x19d1b9?module['exports'][_0xa46f('0xc')]:_0x38fc86[_0xa46f('0xe')])||'2.0.0';return _0x5f056f['status'](0xc8)[_0xa46f('0x11')](_0x54f216);});}else{return _0x5f056f[_0xa46f('0x12')](0xc8)[_0xa46f('0x11')](_0x54f216);}};exports['fetch']=function(_0xbbf3b2,_0x20ebe6){return git[_0xa46f('0xf')]([_0xa46f('0x13'),_0xa46f('0x14')],function(_0x49dd01){if(_0x49dd01){logger[_0xa46f('0x15')](_0x49dd01);return _0x20ebe6[_0xa46f('0x12')](0x1f4)[_0xa46f('0x11')](_0x49dd01);}logger[_0xa46f('0x16')](_0xa46f('0x17'));return _0x20ebe6[_0xa46f('0x12')](0xc8)[_0xa46f('0x11')]({'output':_0xa46f('0x18')});});};exports[_0xa46f('0x19')]=function(_0x5b08ec,_0x23a473){return git['reset'](['--hard','FETCH_HEAD'],function(_0x395c8c){if(_0x395c8c){logger[_0xa46f('0x15')](_0x395c8c);return _0x23a473[_0xa46f('0x12')](0x1f4)[_0xa46f('0x11')](_0x395c8c);}logger['info'](_0xa46f('0x1a'));return _0x23a473[_0xa46f('0x12')](0xc8)[_0xa46f('0x11')]({'output':_0xa46f('0x1b')});});};exports['pull']=function(_0x50d207,_0x23a741){exec(_0xa46f('0x1c'),function(_0x53e7b0,_0x3f49b9,_0x24c052){logger[_0xa46f('0x16')](_0x3f49b9);logger[_0xa46f('0x16')](_0x24c052);if(_0x53e7b0){logger[_0xa46f('0x15')](_0x53e7b0);return _0x23a741[_0xa46f('0x12')](0x1f4)[_0xa46f('0x11')](_0x53e7b0);}return _0x23a741['status'](0xc8)[_0xa46f('0x11')]({'output':_0x3f49b9});});};exports[_0xa46f('0x1d')]=function(_0x4c3bf2,_0xb6cb01){return pm2[_0xa46f('0x1d')](_0xa46f('0x1e'))[_0xa46f('0x1f')](function(_0x4a8241){logger[_0xa46f('0x16')](_0xa46f('0x20'),_0x4a8241);return _0xb6cb01['status'](0xc8)['json']({'output':_0xa46f('0x21')});})['catch'](function(_0x3813e2){logger[_0xa46f('0x15')](_0x3813e2);return _0xb6cb01[_0xa46f('0x12')](0x1f4)[_0xa46f('0x11')](_0x3813e2);});};exports['migrations']=function(_0x1e0269,_0x1ff119){var _0x5ca202=fs['readdirSync'](path[_0xa46f('0x22')](config[_0xa46f('0x23')],_0xa46f('0x24'),_0xa46f('0x25')));var _0x26b052=[];for(var _0x42e307=0x0;_0x42e307<_0x5ca202[_0xa46f('0x26')];_0x42e307++){var _0x4826c7=_0x5ca202[_0x42e307][_0xa46f('0x27')](_0xa46f('0x28'),'');if(compareVersions(module[_0xa46f('0xb')][_0xa46f('0xc')],_0x4826c7)===-0x1){_0x26b052['push'](_0x4826c7);}}if(_0x26b052[_0xa46f('0x26')]){var _0x529255=_0x26b052[_0xa46f('0x29')](compareVersions);var _0xb1d521=new Umzug({'storage':_0xa46f('0x2a'),'storageOptions':{'model':db[_0xa46f('0x2b')],'modelName':_0xa46f('0x2b'),'columnName':_0xa46f('0xc')},'migrations':{'params':[db[_0xa46f('0x2a')][_0xa46f('0x2c')](),db[_0xa46f('0x2a')]['constructor'],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[_0xa46f('0x22')](config[_0xa46f('0x23')],_0xa46f('0x24'),_0xa46f('0x25')),'pattern':/\.js$/}});_0xb1d521['up']({'migrations':_[_0xa46f('0x2d')](_0x529255,function(_0x4db2cf){return _0x4db2cf+_0xa46f('0x28');})})[_0xa46f('0x1f')](function(){return _0x1ff119[_0xa46f('0x12')](0xc8)[_0xa46f('0x11')]({'output':_0xa46f('0x2e')+module[_0xa46f('0xb')][_0xa46f('0xc')]+_0xa46f('0x2f')+_[_0xa46f('0x30')](_0x529255),'migrations':_[_0xa46f('0x22')](_0x529255)});})[_0xa46f('0x31')](function(_0x44c6f1){if(_0x44c6f1 instanceof db[_0xa46f('0x2a')][_0xa46f('0x32')]){return _0x1ff119['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1ff119[_0xa46f('0x12')](0x1f4)[_0xa46f('0x11')](_0x44c6f1);}});}else{return _0x1ff119[_0xa46f('0x12')](0xc8)[_0xa46f('0x11')]({'output':_0xa46f('0x33')});}}; \ No newline at end of file +var _0xe223=['npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','join','root','length','replace','.js','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','Database\x20already\x20up-to-date','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','update','simple-git','index','exports','query','latest','fetch','tags','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','pull'];(function(_0x4e6d27,_0x3f8628){var _0x5ec2d2=function(_0x4055ad){while(--_0x4055ad){_0x4e6d27['push'](_0x4e6d27['shift']());}};_0x5ec2d2(++_0x3f8628);}(_0xe223,0x1a5));var _0x3e22=function(_0x2bff9c,_0xe5758){_0x2bff9c=_0x2bff9c-0x0;var _0x24ca0b=_0xe223[_0x2bff9c];return _0x24ca0b;};'use strict';var Umzug=require('umzug');var path=require(_0x3e22('0x0'));var fs=require('fs');var _=require(_0x3e22('0x1'));var pkginfo=require('pkginfo')(module,_0x3e22('0x2'));var compareVersions=require(_0x3e22('0x3'));var exec=require(_0x3e22('0x4'))[_0x3e22('0x5')];var db=require(_0x3e22('0x6'))['db'];var config=require(_0x3e22('0x7'));var pm2=require('../../config/pm2');var logger=require(_0x3e22('0x8'))(_0x3e22('0x9'));var git=require(_0x3e22('0xa'))(config['root']);exports[_0x3e22('0xb')]=function(_0x4cd44f,_0xb24e92){var _0x1c108b={'current':module[_0x3e22('0xc')]['version'],'phonebar':0x2};if(_0x4cd44f[_0x3e22('0xd')]&&_0x4cd44f[_0x3e22('0xd')][_0x3e22('0xe')]){return git[_0x3e22('0xf')]()[_0x3e22('0x10')](function(_0xd4cb6b,_0x304fb2){_0x1c108b[_0x3e22('0xe')]=(_0xd4cb6b?module[_0x3e22('0xc')][_0x3e22('0x2')]:_0x304fb2[_0x3e22('0xe')])||_0x3e22('0x11');return _0xb24e92[_0x3e22('0x12')](0xc8)['json'](_0x1c108b);});}else{return _0xb24e92[_0x3e22('0x12')](0xc8)[_0x3e22('0x13')](_0x1c108b);}};exports[_0x3e22('0xf')]=function(_0x1698d1,_0x3f02fd){return git[_0x3e22('0xf')]([_0x3e22('0x14'),'master'],function(_0xe56610){if(_0xe56610){logger[_0x3e22('0x15')](_0xe56610);return _0x3f02fd['status'](0x1f4)[_0x3e22('0x13')](_0xe56610);}logger['info'](_0x3e22('0x16'));return _0x3f02fd[_0x3e22('0x12')](0xc8)[_0x3e22('0x13')]({'output':_0x3e22('0x17')});});};exports[_0x3e22('0x18')]=function(_0x468200,_0xe06fd2){return git[_0x3e22('0x18')]([_0x3e22('0x19'),_0x3e22('0x1a')],function(_0x16d065){if(_0x16d065){logger[_0x3e22('0x15')](_0x16d065);return _0xe06fd2[_0x3e22('0x12')](0x1f4)[_0x3e22('0x13')](_0x16d065);}logger[_0x3e22('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0xe06fd2[_0x3e22('0x12')](0xc8)[_0x3e22('0x13')]({'output':'git\x20reset\x20--hard'});});};exports[_0x3e22('0x1c')]=function(_0x5d7bf6,_0x4ceaa9){exec(_0x3e22('0x1d'),function(_0xbe065f,_0x3db71b,_0x1555f5){logger[_0x3e22('0x1b')](_0x3db71b);logger[_0x3e22('0x1b')](_0x1555f5);if(_0xbe065f){logger[_0x3e22('0x15')](_0xbe065f);return _0x4ceaa9[_0x3e22('0x12')](0x1f4)[_0x3e22('0x13')](_0xbe065f);}return _0x4ceaa9[_0x3e22('0x12')](0xc8)['json']({'output':_0x3db71b});});};exports[_0x3e22('0x1e')]=function(_0x180c46,_0x4eb581){return pm2[_0x3e22('0x1e')](_0x3e22('0x1f'))[_0x3e22('0x20')](function(_0xf68e8c){logger[_0x3e22('0x1b')]('pm2\x20restart\x20motion\x20%s',_0xf68e8c);return _0x4eb581[_0x3e22('0x12')](0xc8)[_0x3e22('0x13')]({'output':_0x3e22('0x21')});})[_0x3e22('0x22')](function(_0x558d02){logger[_0x3e22('0x15')](_0x558d02);return _0x4eb581[_0x3e22('0x12')](0x1f4)[_0x3e22('0x13')](_0x558d02);});};exports[_0x3e22('0x23')]=function(_0x1a6409,_0x3325f7){var _0x332af4=fs['readdirSync'](path[_0x3e22('0x24')](config[_0x3e22('0x25')],'server',_0x3e22('0x23')));var _0x1b9818=[];for(var _0x21e925=0x0;_0x21e925<_0x332af4[_0x3e22('0x26')];_0x21e925++){var _0x31e421=_0x332af4[_0x21e925][_0x3e22('0x27')](_0x3e22('0x28'),'');if(compareVersions(module[_0x3e22('0xc')][_0x3e22('0x2')],_0x31e421)===-0x1){_0x1b9818['push'](_0x31e421);}}if(_0x1b9818[_0x3e22('0x26')]){var _0x46514d=_0x1b9818[_0x3e22('0x29')](compareVersions);var _0x76bcce=new Umzug({'storage':_0x3e22('0x2a'),'storageOptions':{'model':db[_0x3e22('0x2b')],'modelName':'Migration','columnName':_0x3e22('0x2')},'migrations':{'params':[db[_0x3e22('0x2a')][_0x3e22('0x2c')](),db[_0x3e22('0x2a')]['constructor'],function(){throw new Error(_0x3e22('0x2d'));}],'path':path[_0x3e22('0x24')](config[_0x3e22('0x25')],'server',_0x3e22('0x23')),'pattern':/\.js$/}});_0x76bcce['up']({'migrations':_[_0x3e22('0x2e')](_0x46514d,function(_0x155bcd){return _0x155bcd+_0x3e22('0x28');})})[_0x3e22('0x20')](function(){return _0x3325f7['status'](0xc8)[_0x3e22('0x13')]({'output':_0x3e22('0x2f')+module[_0x3e22('0xc')][_0x3e22('0x2')]+_0x3e22('0x30')+_['last'](_0x46514d),'migrations':_[_0x3e22('0x24')](_0x46514d)});})[_0x3e22('0x22')](function(_0x5c457b){if(_0x5c457b instanceof db[_0x3e22('0x2a')]['UniqueConstraintError']){return _0x3325f7[_0x3e22('0x12')](0xc8)[_0x3e22('0x13')]({'output':_0x3e22('0x31')});}else{return _0x3325f7[_0x3e22('0x12')](0x1f4)[_0x3e22('0x13')](_0x5c457b);}});}else{return _0x3325f7[_0x3e22('0x12')](0xc8)['json']({'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 7927d13..4b1a87b 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 _0xce68=['get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller'];(function(_0x4b836a,_0x12298e){var _0x24bfcd=function(_0x502d33){while(--_0x502d33){_0x4b836a['push'](_0x4b836a['shift']());}};_0x24bfcd(++_0x12298e);}(_0xce68,0x1ea));var _0x8ce6=function(_0x2725d5,_0x4ab4ff){_0x2725d5=_0x2725d5-0x0;var _0xac4edb=_0xce68[_0x2725d5];return _0xac4edb;};'use strict';var multer=require(_0x8ce6('0x0'));var util=require(_0x8ce6('0x1'));var path=require(_0x8ce6('0x2'));var timeout=require(_0x8ce6('0x3'));var express=require(_0x8ce6('0x4'));var router=express['Router']();var fs_extra=require(_0x8ce6('0x5'));var auth=require(_0x8ce6('0x6'));var interaction=require(_0x8ce6('0x7'));var config=require(_0x8ce6('0x8'));var controller=require(_0x8ce6('0x9'));router[_0x8ce6('0xa')]('/',auth[_0x8ce6('0xb')](),controller[_0x8ce6('0xc')]);router[_0x8ce6('0xa')]('/describe',auth[_0x8ce6('0xb')](),controller['describe']);router[_0x8ce6('0xa')](_0x8ce6('0xd'),auth[_0x8ce6('0xb')](),controller['show']);router[_0x8ce6('0xe')]('/',auth['isAuthenticated'](),controller[_0x8ce6('0xf')]);router[_0x8ce6('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x8ce6('0x11')]);router[_0x8ce6('0x12')](_0x8ce6('0xd'),auth[_0x8ce6('0xb')](),controller['destroy']);module[_0x8ce6('0x13')]=router; \ No newline at end of file +var _0xad98=['show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','describe','/:id'];(function(_0x4ede09,_0x18801d){var _0x253193=function(_0xa4c752){while(--_0xa4c752){_0x4ede09['push'](_0x4ede09['shift']());}};_0x253193(++_0x18801d);}(_0xad98,0x1bb));var _0x8ad9=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0xad98[_0x3a4318];return _0x36d746;};'use strict';var multer=require(_0x8ad9('0x0'));var util=require(_0x8ad9('0x1'));var path=require(_0x8ad9('0x2'));var timeout=require(_0x8ad9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ad9('0x4'));var auth=require(_0x8ad9('0x5'));var interaction=require(_0x8ad9('0x6'));var config=require(_0x8ad9('0x7'));var controller=require(_0x8ad9('0x8'));router[_0x8ad9('0x9')]('/',auth[_0x8ad9('0xa')](),controller['index']);router['get']('/describe',auth[_0x8ad9('0xa')](),controller[_0x8ad9('0xb')]);router[_0x8ad9('0x9')](_0x8ad9('0xc'),auth['isAuthenticated'](),controller[_0x8ad9('0xd')]);router['post']('/',auth[_0x8ad9('0xa')](),controller['create']);router[_0x8ad9('0xe')](_0x8ad9('0xc'),auth['isAuthenticated'](),controller[_0x8ad9('0xf')]);router[_0x8ad9('0x10')](_0x8ad9('0xc'),auth[_0x8ad9('0xa')](),controller[_0x8ad9('0x11')]);module[_0x8ad9('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 9cf1b5f..ddd0eb9 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 _0xa30a=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'type':{'type':Sequelize[_0xaa30('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xaa30('0x2')]},'calleridname':{'type':Sequelize[_0xaa30('0x2')]},'queue':{'type':Sequelize[_0xaa30('0x2')]},'interface':{'type':Sequelize[_0xaa30('0x2')]},'membername':{'type':Sequelize[_0xaa30('0x2')]},'agentcalledAt':{'type':Sequelize[_0xaa30('0x3')]},'agentconnectAt':{'type':Sequelize[_0xaa30('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xaa30('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xaa30('0x4')]},'agentcomplete':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xaa30('0x4')]},'agentacw':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xaa30('0x4')]},'reason':{'type':Sequelize[_0xaa30('0x2')]},'lastevent':{'type':Sequelize[_0xaa30('0x2')]},'channel':{'type':Sequelize[_0xaa30('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xaa30('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaa30('0x2')]},'accountcode':{'type':Sequelize[_0xaa30('0x2')]},'context':{'type':Sequelize[_0xaa30('0x2')]},'exten':{'type':Sequelize[_0xaa30('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xaa30('0x2')]},'destchannelstate':{'type':Sequelize[_0xaa30('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xaa30('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0xaa30('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xaa30('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xaa30('0x2')]},'destlanguage':{'type':Sequelize[_0xaa30('0x2')]},'destaccountcode':{'type':Sequelize[_0xaa30('0x2')]},'destcontext':{'type':Sequelize[_0xaa30('0x2')]},'destexten':{'type':Sequelize[_0xaa30('0x2')]},'destpriority':{'type':Sequelize[_0xaa30('0x2')]},'destuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xaa30('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaa30('0x2')]},'transferuniqueid':{'type':Sequelize[_0xaa30('0x2')]},'agententerreason':{'type':Sequelize[_0xaa30('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x15b8=['FORWARD,\x20BLIND,\x20ATTENDED','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x535780,_0x5d5d47){var _0x1a03fb=function(_0x3c9eaa){while(--_0x3c9eaa){_0x535780['push'](_0x535780['shift']());}};_0x1a03fb(++_0x5d5d47);}(_0x15b8,0xcd));var _0x815b=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x15b8[_0x33032e];return _0x13316b;};'use strict';var Sequelize=require('sequelize');module[_0x815b('0x0')]={'type':{'type':Sequelize[_0x815b('0x1')]},'uniqueid':{'type':Sequelize[_0x815b('0x1')]},'calleridnum':{'type':Sequelize[_0x815b('0x1')]},'calleridname':{'type':Sequelize[_0x815b('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x815b('0x1')]},'membername':{'type':Sequelize[_0x815b('0x1')]},'agentcalledAt':{'type':Sequelize[_0x815b('0x2')]},'agentconnectAt':{'type':Sequelize[_0x815b('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x815b('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0x815b('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x815b('0x3')]},'agentcomplete':{'type':Sequelize[_0x815b('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x815b('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x815b('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x815b('0x3')]},'agentacw':{'type':Sequelize[_0x815b('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x815b('0x3')]},'reason':{'type':Sequelize[_0x815b('0x1')]},'lastevent':{'type':Sequelize[_0x815b('0x1')]},'channel':{'type':Sequelize[_0x815b('0x1')]},'channelstate':{'type':Sequelize[_0x815b('0x3')]},'channelstatedesc':{'type':Sequelize[_0x815b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x815b('0x1')]},'connectedlinename':{'type':Sequelize[_0x815b('0x1')]},'language':{'type':Sequelize[_0x815b('0x1')]},'accountcode':{'type':Sequelize[_0x815b('0x1')]},'context':{'type':Sequelize[_0x815b('0x1')]},'exten':{'type':Sequelize[_0x815b('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x815b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x815b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x815b('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x815b('0x1')]},'destexten':{'type':Sequelize[_0x815b('0x1')]},'destpriority':{'type':Sequelize[_0x815b('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x815b('0x1')]},'transfer':{'type':Sequelize[_0x815b('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x815b('0x1')],'comment':_0x815b('0x5')},'transferexten':{'type':Sequelize[_0x815b('0x1')]},'transferuniqueid':{'type':Sequelize[_0x815b('0x1')]},'agententerreason':{'type':Sequelize[_0x815b('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 3194749..810632b 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(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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 3c1a91a..f12cfea 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 _0x7118=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','../../config/logger','api','bluebird','request-promise','path'];(function(_0x1b1ce5,_0x508743){var _0x432ff6=function(_0x28fd31){while(--_0x28fd31){_0x1b1ce5['push'](_0x1b1ce5['shift']());}};_0x432ff6(++_0x508743);}(_0x7118,0x159));var _0x8711=function(_0x3fdd56,_0x411f03){_0x3fdd56=_0x3fdd56-0x0;var _0xee31f5=_0x7118[_0x3fdd56];return _0xee31f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8711('0x0'))(_0x8711('0x1'));var moment=require('moment');var BPromise=require(_0x8711('0x2'));var rp=require(_0x8711('0x3'));var fs=require('fs');var path=require(_0x8711('0x4'));var rimraf=require(_0x8711('0x5'));var config=require(_0x8711('0x6'));var attributes=require(_0x8711('0x7'));module[_0x8711('0x8')]=function(_0x54885e,_0x385033){return _0x54885e[_0x8711('0x9')](_0x8711('0xa'),attributes,{'tableName':_0x8711('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8711('0xc'),_0x8711('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x615a=['path','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x8e7caa,_0x4bfb46){var _0x2ce00d=function(_0x550eb5){while(--_0x550eb5){_0x8e7caa['push'](_0x8e7caa['shift']());}};_0x2ce00d(++_0x4bfb46);}(_0x615a,0x119));var _0xa615=function(_0x71b765,_0x3053f8){_0x71b765=_0x71b765-0x0;var _0x34cb24=_0x615a[_0x71b765];return _0x34cb24;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var logger=require(_0xa615('0x1'))('api');var moment=require(_0xa615('0x2'));var BPromise=require(_0xa615('0x3'));var rp=require(_0xa615('0x4'));var fs=require('fs');var path=require(_0xa615('0x5'));var rimraf=require('rimraf');var config=require(_0xa615('0x6'));var attributes=require(_0xa615('0x7'));module['exports']=function(_0x320680,_0x5d04bd){return _0x320680[_0xa615('0x8')](_0xa615('0x9'),attributes,{'tableName':_0xa615('0xa'),'paranoid':![],'indexes':[{'fields':[_0xa615('0xb'),_0xa615('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d9573de..5ffb120 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 _0x5a44=['body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','limit','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceAgentReport','create'];(function(_0x26c974,_0x50a4b9){var _0x1a6fd5=function(_0x40eb90){while(--_0x40eb90){_0x26c974['push'](_0x26c974['shift']());}};_0x1a6fd5(++_0x50a4b9);}(_0x5a44,0x1e8));var _0x45a4=function(_0x1491a8,_0xa3e0d2){_0x1491a8=_0x1491a8-0x0;var _0xab8ad1=_0x5a44[_0x1491a8];return _0xab8ad1;};'use strict';var _=require(_0x45a4('0x0'));var util=require(_0x45a4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x45a4('0x2'));var fs=require('fs');var Redis=require(_0x45a4('0x3'));var db=require(_0x45a4('0x4'))['db'];var utils=require(_0x45a4('0x5'));var logger=require('../../config/logger')(_0x45a4('0x6'));var config=require(_0x45a4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x45a4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1140bf,_0x3a7a5d,_0x4f2ecf){return new BPromise(function(_0x252b9b,_0x31297b){return client[_0x45a4('0x9')](_0x1140bf,_0x4f2ecf)[_0x45a4('0xa')](function(_0x7c766a){logger[_0x45a4('0xb')](_0x45a4('0xc'),_0x3a7a5d,_0x45a4('0xd'));logger[_0x45a4('0xe')](_0x45a4('0xf'),_0x3a7a5d,_0x45a4('0xd'),JSON[_0x45a4('0x10')](_0x7c766a));if(_0x7c766a[_0x45a4('0x11')]){if(_0x7c766a[_0x45a4('0x11')][_0x45a4('0x12')]===0x1f4){logger['error'](_0x45a4('0xc'),_0x3a7a5d,_0x7c766a[_0x45a4('0x11')][_0x45a4('0x13')]);return _0x31297b(_0x7c766a[_0x45a4('0x11')][_0x45a4('0x13')]);}logger[_0x45a4('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x3a7a5d,_0x7c766a[_0x45a4('0x11')]['message']);return _0x252b9b(_0x7c766a[_0x45a4('0x11')][_0x45a4('0x13')]);}else{logger[_0x45a4('0xb')](_0x45a4('0xc'),_0x3a7a5d,_0x45a4('0xd'));_0x252b9b(_0x7c766a['result']['message']);}})['catch'](function(_0x156581){logger[_0x45a4('0x11')](_0x45a4('0xc'),_0x3a7a5d,_0x156581);_0x31297b(_0x156581);});});}exports['CreateVoiceAgentReport']=function(_0x2811f6){var _0x4f5c96=this;return new Promise(function(_0x2f6035,_0x84881a){return db[_0x45a4('0x14')][_0x45a4('0x15')](_0x2811f6[_0x45a4('0x16')],{'raw':_0x2811f6[_0x45a4('0x17')]?_0x2811f6['options'][_0x45a4('0x18')]===undefined?!![]:![]:!![]})[_0x45a4('0xa')](function(_0x3c702f){logger[_0x45a4('0xb')](_0x45a4('0x19'),_0x2811f6);logger['debug'](_0x45a4('0x19'),_0x2811f6,JSON[_0x45a4('0x10')](_0x3c702f));_0x2f6035(_0x3c702f);})['catch'](function(_0x26e4e1){logger[_0x45a4('0x11')](_0x45a4('0x19'),_0x26e4e1['message'],_0x2811f6);_0x84881a(_0x4f5c96[_0x45a4('0x11')](0x1f4,_0x26e4e1[_0x45a4('0x13')]));});});};exports[_0x45a4('0x1a')]=function(_0xc2c1c){var _0x3dd9b4=this;return new Promise(function(_0x5d7c67,_0x172b99){return db[_0x45a4('0x14')][_0x45a4('0x1b')](_0xc2c1c[_0x45a4('0x16')],{'raw':_0xc2c1c[_0x45a4('0x17')]?_0xc2c1c[_0x45a4('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc2c1c[_0x45a4('0x17')]?_0xc2c1c[_0x45a4('0x17')]['where']||null:null,'attributes':_0xc2c1c[_0x45a4('0x17')]?_0xc2c1c[_0x45a4('0x17')]['attributes']||null:null,'limit':_0xc2c1c[_0x45a4('0x17')]?_0xc2c1c[_0x45a4('0x17')][_0x45a4('0x1c')]||null:null})[_0x45a4('0xa')](function(_0x382f37){logger[_0x45a4('0xb')](_0x45a4('0x1a'),_0xc2c1c);logger[_0x45a4('0xe')]('UpdateVoiceAgentReport',_0xc2c1c,JSON[_0x45a4('0x10')](_0x382f37));_0x5d7c67(_0x382f37);})[_0x45a4('0x1d')](function(_0x49ed33){logger[_0x45a4('0x11')](_0x45a4('0x1a'),_0x49ed33[_0x45a4('0x13')],_0xc2c1c);_0x172b99(_0x3dd9b4[_0x45a4('0x11')](0x1f4,_0x49ed33[_0x45a4('0x13')]));});});}; \ No newline at end of file +var _0xeb9d=['attributes','limit','UpdateVoiceAgentReport','stringify','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','then','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','VoiceAgentReport,\x20%s,\x20%s','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','update','where'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0xeb9d,0x1a4));var _0xdeb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xeb9d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xdeb9('0x0'));var BPromise=require('bluebird');var rs=require(_0xdeb9('0x1'));var fs=require('fs');var Redis=require(_0xdeb9('0x2'));var db=require(_0xdeb9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xdeb9('0x4'))(_0xdeb9('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xdeb9('0x6')][_0xdeb9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2d28da,_0x629054,_0xb166a5){return new BPromise(function(_0xe427cd,_0x34ee9f){return client[_0xdeb9('0x8')](_0x2d28da,_0xb166a5)[_0xdeb9('0x9')](function(_0x2a4e3d){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x629054,'request\x20sent');logger[_0xdeb9('0xa')](_0xdeb9('0xb'),_0x629054,_0xdeb9('0xc'),JSON['stringify'](_0x2a4e3d));if(_0x2a4e3d[_0xdeb9('0xd')]){if(_0x2a4e3d['error'][_0xdeb9('0xe')]===0x1f4){logger[_0xdeb9('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x629054,_0x2a4e3d[_0xdeb9('0xd')][_0xdeb9('0xf')]);return _0x34ee9f(_0x2a4e3d[_0xdeb9('0xd')][_0xdeb9('0xf')]);}logger[_0xdeb9('0xd')](_0xdeb9('0x10'),_0x629054,_0x2a4e3d['error'][_0xdeb9('0xf')]);return _0xe427cd(_0x2a4e3d[_0xdeb9('0xd')][_0xdeb9('0xf')]);}else{logger[_0xdeb9('0x11')](_0xdeb9('0x10'),_0x629054,'request\x20sent');_0xe427cd(_0x2a4e3d[_0xdeb9('0x12')][_0xdeb9('0xf')]);}})[_0xdeb9('0x13')](function(_0x306ade){logger[_0xdeb9('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x629054,_0x306ade);_0x34ee9f(_0x306ade);});});}exports[_0xdeb9('0x14')]=function(_0x4a3bd2){var _0x8230c4=this;return new Promise(function(_0x28ffe1,_0x2483bc){return db[_0xdeb9('0x15')][_0xdeb9('0x16')](_0x4a3bd2[_0xdeb9('0x17')],{'raw':_0x4a3bd2[_0xdeb9('0x18')]?_0x4a3bd2[_0xdeb9('0x18')][_0xdeb9('0x19')]===undefined?!![]:![]:!![]})[_0xdeb9('0x9')](function(_0x253665){logger[_0xdeb9('0x11')](_0xdeb9('0x14'),_0x4a3bd2);logger[_0xdeb9('0xa')](_0xdeb9('0x14'),_0x4a3bd2,JSON['stringify'](_0x253665));_0x28ffe1(_0x253665);})[_0xdeb9('0x13')](function(_0x153d83){logger[_0xdeb9('0xd')](_0xdeb9('0x14'),_0x153d83[_0xdeb9('0xf')],_0x4a3bd2);_0x2483bc(_0x8230c4['error'](0x1f4,_0x153d83[_0xdeb9('0xf')]));});});};exports['UpdateVoiceAgentReport']=function(_0x1a5f29){var _0x1e47a8=this;return new Promise(function(_0x4a51b4,_0x2a5818){return db[_0xdeb9('0x15')][_0xdeb9('0x1a')](_0x1a5f29[_0xdeb9('0x17')],{'raw':_0x1a5f29[_0xdeb9('0x18')]?_0x1a5f29[_0xdeb9('0x18')][_0xdeb9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a5f29[_0xdeb9('0x18')]?_0x1a5f29['options'][_0xdeb9('0x1b')]||null:null,'attributes':_0x1a5f29[_0xdeb9('0x18')]?_0x1a5f29[_0xdeb9('0x18')][_0xdeb9('0x1c')]||null:null,'limit':_0x1a5f29['options']?_0x1a5f29[_0xdeb9('0x18')][_0xdeb9('0x1d')]||null:null})[_0xdeb9('0x9')](function(_0x5d1749){logger[_0xdeb9('0x11')](_0xdeb9('0x1e'),_0x1a5f29);logger[_0xdeb9('0xa')](_0xdeb9('0x1e'),_0x1a5f29,JSON[_0xdeb9('0x1f')](_0x5d1749));_0x4a51b4(_0x5d1749);})[_0xdeb9('0x13')](function(_0x412b55){logger[_0xdeb9('0xd')](_0xdeb9('0x1e'),_0x412b55['message'],_0x1a5f29);_0x2a5818(_0x1e47a8[_0xdeb9('0xd')](0x1f4,_0x412b55['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9324ee4..cf99327 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 _0x29d4=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','update','destroy','exports','multer','path','connect-timeout'];(function(_0x345377,_0x5332cd){var _0x2f054a=function(_0x3284c8){while(--_0x3284c8){_0x345377['push'](_0x345377['shift']());}};_0x2f054a(++_0x5332cd);}(_0x29d4,0x1a1));var _0x429d=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x29d4[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x429d('0x0'));var util=require('util');var path=require(_0x429d('0x1'));var timeout=require(_0x429d('0x2'));var express=require(_0x429d('0x3'));var router=express[_0x429d('0x4')]();var fs_extra=require(_0x429d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x429d('0x6'));var config=require(_0x429d('0x7'));var controller=require(_0x429d('0x8'));router[_0x429d('0x9')]('/',auth[_0x429d('0xa')](),controller[_0x429d('0xb')]);router[_0x429d('0x9')](_0x429d('0xc'),auth['isAuthenticated'](),controller[_0x429d('0xd')]);router['get'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0xf')]);router['post']('/',auth[_0x429d('0xa')](),controller[_0x429d('0x10')]);router['put'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x11')]);router['delete'](_0x429d('0xe'),auth[_0x429d('0xa')](),controller[_0x429d('0x12')]);module[_0x429d('0x13')]=router; \ No newline at end of file +var _0x9a19=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x51f533,_0x86f49c){var _0x557ef4=function(_0x444dee){while(--_0x444dee){_0x51f533['push'](_0x51f533['shift']());}};_0x557ef4(++_0x86f49c);}(_0x9a19,0x114));var _0x99a1=function(_0x215dc8,_0x52c245){_0x215dc8=_0x215dc8-0x0;var _0x583ea3=_0x9a19[_0x215dc8];return _0x583ea3;};'use strict';var multer=require(_0x99a1('0x0'));var util=require(_0x99a1('0x1'));var path=require(_0x99a1('0x2'));var timeout=require('connect-timeout');var express=require(_0x99a1('0x3'));var router=express[_0x99a1('0x4')]();var fs_extra=require(_0x99a1('0x5'));var auth=require(_0x99a1('0x6'));var interaction=require(_0x99a1('0x7'));var config=require(_0x99a1('0x8'));var controller=require(_0x99a1('0x9'));router[_0x99a1('0xa')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xc')]);router[_0x99a1('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x99a1('0xa')](_0x99a1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x99a1('0xe')]('/',auth[_0x99a1('0xb')](),controller[_0x99a1('0xf')]);router[_0x99a1('0x10')](_0x99a1('0xd'),auth['isAuthenticated'](),controller[_0x99a1('0x11')]);router[_0x99a1('0x12')](_0x99a1('0xd'),auth[_0x99a1('0xb')](),controller[_0x99a1('0x13')]);module[_0x99a1('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 acca2e3..9859510 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 _0x6222=['exports','STRING','inbound','inbound-fax','TEXT','DATE','INTEGER'];(function(_0x385e92,_0xb98f63){var _0x13f730=function(_0x898ed0){while(--_0x898ed0){_0x385e92['push'](_0x385e92['shift']());}};_0x13f730(++_0xb98f63);}(_0x6222,0x9a));var _0x2622=function(_0x2f6973,_0x535c1f){_0x2f6973=_0x2f6973-0x0;var _0x2c0290=_0x6222[_0x2f6973];return _0x2c0290;};'use strict';var Sequelize=require('sequelize');module[_0x2622('0x0')]={'uniqueid':{'type':Sequelize[_0x2622('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2622('0x2'),'internal','outbound',_0x2622('0x3'),'outbound-fax','dialer')},'tag':{'type':Sequelize[_0x2622('0x1')]},'accountcode':{'type':Sequelize[_0x2622('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x2622('0x1')]},'destinationcontext':{'type':Sequelize[_0x2622('0x1')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2622('0x1')]},'destinationchannel':{'type':Sequelize[_0x2622('0x1')]},'lastapplication':{'type':Sequelize[_0x2622('0x1')]},'lastdata':{'type':Sequelize[_0x2622('0x4')]},'starttime':{'type':Sequelize[_0x2622('0x5')]},'systemanswertime':{'type':Sequelize[_0x2622('0x5')]},'answertime':{'type':Sequelize[_0x2622('0x5')]},'endtime':{'type':Sequelize[_0x2622('0x5')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x2622('0x6')]},'mohtime':{'type':Sequelize[_0x2622('0x6')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2622('0x1')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x2622('0x1')]},'userDisposition':{'type':Sequelize[_0x2622('0x1')]},'userSecondDisposition':{'type':Sequelize[_0x2622('0x1')]},'userThirdDisposition':{'type':Sequelize[_0x2622('0x1')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x2622('0x1')]},'routeid':{'type':Sequelize[_0x2622('0x6')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbbbc=['outbound','outbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal'];(function(_0x559703,_0x9147c3){var _0x33fb73=function(_0x4ff555){while(--_0x4ff555){_0x559703['push'](_0x559703['shift']());}};_0x33fb73(++_0x9147c3);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x5778c9,_0x9e0f59){_0x5778c9=_0x5778c9-0x0;var _0x3f3f66=_0xbbbc[_0x5778c9];return _0x3f3f66;};'use strict';var Sequelize=require(_0xcbbb('0x0'));module[_0xcbbb('0x1')]={'uniqueid':{'type':Sequelize[_0xcbbb('0x2')]},'type':{'type':Sequelize[_0xcbbb('0x3')](_0xcbbb('0x4'),_0xcbbb('0x5'),_0xcbbb('0x6'),'inbound-fax',_0xcbbb('0x7'),_0xcbbb('0x8'))},'tag':{'type':Sequelize[_0xcbbb('0x2')]},'accountcode':{'type':Sequelize[_0xcbbb('0x2')]},'source':{'type':Sequelize[_0xcbbb('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0xcbbb('0x2')]},'callerid':{'type':Sequelize[_0xcbbb('0x2')]},'channel':{'type':Sequelize[_0xcbbb('0x2')]},'destinationchannel':{'type':Sequelize[_0xcbbb('0x2')]},'lastapplication':{'type':Sequelize[_0xcbbb('0x2')]},'lastdata':{'type':Sequelize[_0xcbbb('0x9')]},'starttime':{'type':Sequelize[_0xcbbb('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xcbbb('0xa')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xcbbb('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcbbb('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xcbbb('0x2')]},'userDisposition':{'type':Sequelize[_0xcbbb('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xcbbb('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xcbbb('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0xcbbb('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 3b8f965..747cc6a 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 _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x58c20f,_0x4cdb1b){var _0x3b0318=function(_0x36fa84){while(--_0x36fa84){_0x58c20f['push'](_0x58c20f['shift']());}};_0x3b0318(++_0x4cdb1b);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b9e47,_0x1edc31){_0x1b9e47=_0x1b9e47-0x0;var _0xf228ee=_0x2ef3[_0x1b9e47];return _0xf228ee;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file +var _0x2ef3=['pick','filter','merge','options','VoiceCallReport','then','includeAll','include','fullname','alias','User','findAll','rows','catch','show','params','keys','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where'];(function(_0x28611e,_0x586726){var _0x530f69=function(_0x407906){while(--_0x407906){_0x28611e['push'](_0x28611e['shift']());}};_0x530f69(++_0x586726);}(_0x2ef3,0xba));var _0x32ef=function(_0x1b7d96,_0x152003){_0x1b7d96=_0x1b7d96-0x0;var _0x3aa660=_0x2ef3[_0x1b7d96];return _0x3aa660;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['VoiceCallReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'attributes':['id',_0x32ef('0x27'),_0x32ef('0x41'),_0x32ef('0x42')],'model':db[_0x32ef('0x43')],'as':'User'}];}return db['VoiceCallReport'][_0x32ef('0x44')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x2a33dd){_0x3c569d[_0x32ef('0x45')]=_0x2a33dd;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x46')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x47')]=function(_0x5d2f06,_0x4744ba){var _0x4bc5bc={'raw':!![],'where':{'id':_0x5d2f06[_0x32ef('0x48')]['id']}},_0xcb3c08={};_0xcb3c08[_0x32ef('0x2e')]=_[_0x32ef('0x49')](db[_0x32ef('0x3d')][_0x32ef('0x2a')]);_0xcb3c08[_0x32ef('0x2f')]=_[_0x32ef('0x49')](_0x5d2f06[_0x32ef('0x2f')]);_0xcb3c08[_0x32ef('0x30')]=_['intersection'](_0xcb3c08[_0x32ef('0x2e')],_0xcb3c08['query']);_0x4bc5bc[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0xcb3c08[_0x32ef('0x2e')],qs['fields'](_0x5d2f06[_0x32ef('0x2f')][_0x32ef('0x33')]));_0x4bc5bc[_0x32ef('0x31')]=_0x4bc5bc[_0x32ef('0x31')][_0x32ef('0x34')]?_0x4bc5bc[_0x32ef('0x31')]:_0xcb3c08[_0x32ef('0x2e')];if(_0x5d2f06['query']['includeAll']){_0x4bc5bc[_0x32ef('0x40')]=[{'all':!![]}];}_0x4bc5bc=_[_0x32ef('0x3b')]({},_0x4bc5bc,_0x5d2f06[_0x32ef('0x3c')]);return db[_0x32ef('0x3d')][_0x32ef('0x4a')](_0x4bc5bc)[_0x32ef('0x3e')](handleEntityNotFound(_0x4744ba,null))[_0x32ef('0x3e')](respondWithResult(_0x4744ba,null))[_0x32ef('0x46')](handleError(_0x4744ba,null));};exports[_0x32ef('0x4b')]=function(_0x1ebedf,_0x35a294){return db[_0x32ef('0x3d')][_0x32ef('0x4b')](_0x1ebedf['body'],{})[_0x32ef('0x3e')](respondWithResult(_0x35a294,0xc9))[_0x32ef('0x46')](handleError(_0x35a294,null));};exports[_0x32ef('0x4c')]=function(_0xd42609,_0x1cc9f3){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'id':_0xd42609[_0x32ef('0x48')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x1cc9f3,null))[_0x32ef('0x3e')](removeEntity(_0x1cc9f3,null))[_0x32ef('0x46')](handleError(_0x1cc9f3,null));};exports[_0x32ef('0x4d')]=function(_0x272377,_0x326445){return db[_0x32ef('0x3d')][_0x32ef('0x4d')]()[_0x32ef('0x3e')](respondWithResult(_0x326445,null))[_0x32ef('0x46')](handleError(_0x326445,null));};exports['update']=function(_0x515ac9,_0x179c2f){if(_0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')]){delete _0x515ac9[_0x32ef('0x4e')][_0x32ef('0x4f')];}return db[_0x32ef('0x3d')][_0x32ef('0x4a')]({'where':{'uniqueid':_0x515ac9[_0x32ef('0x48')]['id'],'UserId':{'$or':[null,_0x515ac9[_0x32ef('0x50')]['id']]}}})[_0x32ef('0x3e')](handleEntityNotFound(_0x179c2f,null))[_0x32ef('0x3e')](saveUpdates(_0x515ac9['body'],null))[_0x32ef('0x3e')](respondWithResult(_0x179c2f,null))[_0x32ef('0x46')](handleError(_0x179c2f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 258080b..34f0651 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 _0xe65c=['moment','request-promise','rimraf','../../config/environment','exports','define','VoiceCallReport','lodash','util','../../config/logger','api'];(function(_0x3b2ba0,_0x239053){var _0x282218=function(_0x45129f){while(--_0x45129f){_0x3b2ba0['push'](_0x3b2ba0['shift']());}};_0x282218(++_0x239053);}(_0xe65c,0x19e));var _0xce65=function(_0xf738ad,_0x5e1d7f){_0xf738ad=_0xf738ad-0x0;var _0x598570=_0xe65c[_0xf738ad];return _0x598570;};'use strict';var _=require(_0xce65('0x0'));var util=require(_0xce65('0x1'));var logger=require(_0xce65('0x2'))(_0xce65('0x3'));var moment=require(_0xce65('0x4'));var BPromise=require('bluebird');var rp=require(_0xce65('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce65('0x6'));var config=require(_0xce65('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0xce65('0x8')]=function(_0x330dcc,_0xa52a98){return _0x330dcc[_0xce65('0x9')](_0xce65('0xa'),attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfa7c=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_call','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x3130b5,_0x23faf7){var _0xa6d8a3=function(_0x175be7){while(--_0x175be7){_0x3130b5['push'](_0x3130b5['shift']());}};_0xa6d8a3(++_0x23faf7);}(_0xfa7c,0x15b));var _0xcfa7=function(_0x3340e0,_0x3c5199){_0x3340e0=_0x3340e0-0x0;var _0x3b41cf=_0xfa7c[_0x3340e0];return _0x3b41cf;};'use strict';var _=require(_0xcfa7('0x0'));var util=require('util');var logger=require(_0xcfa7('0x1'))(_0xcfa7('0x2'));var moment=require(_0xcfa7('0x3'));var BPromise=require(_0xcfa7('0x4'));var rp=require(_0xcfa7('0x5'));var fs=require('fs');var path=require(_0xcfa7('0x6'));var rimraf=require(_0xcfa7('0x7'));var config=require(_0xcfa7('0x8'));var attributes=require('./voiceCallReport.attributes');module[_0xcfa7('0x9')]=function(_0x3bf816,_0x9d96a2){return _0x3bf816[_0xcfa7('0xa')]('VoiceCallReport',attributes,{'tableName':_0xcfa7('0xb'),'paranoid':![],'indexes':[{'fields':[_0xcfa7('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 9c0e085..cbd4a7f 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 _0x338a=['util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','UpdateVoiceCallReport','update','limit','lodash'];(function(_0x2d93ec,_0x3f091f){var _0x49fbfd=function(_0x45ae76){while(--_0x45ae76){_0x2d93ec['push'](_0x2d93ec['shift']());}};_0x49fbfd(++_0x3f091f);}(_0x338a,0xf4));var _0xa338=function(_0x1b04dd,_0x394bec){_0x1b04dd=_0x1b04dd-0x0;var _0x191c99=_0x338a[_0x1b04dd];return _0x191c99;};'use strict';var _=require(_0xa338('0x0'));var util=require(_0xa338('0x1'));var moment=require('moment');var BPromise=require(_0xa338('0x2'));var rs=require(_0xa338('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa338('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa338('0x5'))(_0xa338('0x6'));var config=require('../../config/environment');var jayson=require(_0xa338('0x7'));var client=jayson[_0xa338('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d0bf1,_0x5f517b,_0xc2a2ee){return new BPromise(function(_0x463060,_0x3fbc36){return client[_0xa338('0x9')](_0x5d0bf1,_0xc2a2ee)[_0xa338('0xa')](function(_0x4a8d1b){logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x5f517b,_0xa338('0xb'));logger[_0xa338('0xc')](_0xa338('0xd'),_0x5f517b,_0xa338('0xb'),JSON[_0xa338('0xe')](_0x4a8d1b));if(_0x4a8d1b['error']){if(_0x4a8d1b[_0xa338('0xf')][_0xa338('0x10')]===0x1f4){logger[_0xa338('0xf')](_0xa338('0x11'),_0x5f517b,_0x4a8d1b[_0xa338('0xf')][_0xa338('0x12')]);return _0x3fbc36(_0x4a8d1b['error'][_0xa338('0x12')]);}logger[_0xa338('0xf')](_0xa338('0x11'),_0x5f517b,_0x4a8d1b[_0xa338('0xf')]['message']);return _0x463060(_0x4a8d1b[_0xa338('0xf')][_0xa338('0x12')]);}else{logger[_0xa338('0x13')](_0xa338('0x11'),_0x5f517b,_0xa338('0xb'));_0x463060(_0x4a8d1b[_0xa338('0x14')]['message']);}})[_0xa338('0x15')](function(_0x2a5f8a){logger['error'](_0xa338('0x11'),_0x5f517b,_0x2a5f8a);_0x3fbc36(_0x2a5f8a);});});}exports[_0xa338('0x16')]=function(_0x2baa7b){var _0xfc6896=this;return new Promise(function(_0x3574d2,_0x762a17){return db[_0xa338('0x17')]['findAll']({'raw':_0x2baa7b[_0xa338('0x18')]?_0x2baa7b[_0xa338('0x18')][_0xa338('0x19')]===undefined?!![]:![]:!![],'where':_0x2baa7b[_0xa338('0x18')]?_0x2baa7b[_0xa338('0x18')][_0xa338('0x1a')]||null:null,'attributes':_0x2baa7b[_0xa338('0x18')]?_0x2baa7b[_0xa338('0x18')][_0xa338('0x1b')]||null:null,'limit':_0x2baa7b[_0xa338('0x18')]?_0x2baa7b[_0xa338('0x18')]['limit']||null:null,'include':_0x2baa7b[_0xa338('0x18')]?_0x2baa7b[_0xa338('0x18')][_0xa338('0x1c')]?_[_0xa338('0x1d')](_0x2baa7b[_0xa338('0x18')][_0xa338('0x1c')],function(_0x45a7bf){return{'model':db[_0x45a7bf['model']],'as':_0x45a7bf['as'],'attributes':_0x45a7bf[_0xa338('0x1b')],'include':_0x45a7bf['include']?_[_0xa338('0x1d')](_0x45a7bf[_0xa338('0x1c')],function(_0x32d37f){return{'model':db[_0x32d37f[_0xa338('0x1e')]],'as':_0x32d37f['as'],'attributes':_0x32d37f[_0xa338('0x1b')],'include':_0x32d37f[_0xa338('0x1c')]?_[_0xa338('0x1d')](_0x32d37f['include'],function(_0x487e1a){return{'model':db[_0x487e1a[_0xa338('0x1e')]],'as':_0x487e1a['as'],'attributes':_0x487e1a[_0xa338('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0e8d){logger[_0xa338('0x13')](_0xa338('0x16'),_0x2baa7b);logger[_0xa338('0xc')](_0xa338('0x16'),_0x2baa7b,JSON['stringify'](_0x2a0e8d));_0x3574d2(_0x2a0e8d);})[_0xa338('0x15')](function(_0x93a191){logger[_0xa338('0xf')](_0xa338('0x16'),_0x93a191[_0xa338('0x12')],_0x2baa7b);_0x762a17(_0xfc6896[_0xa338('0xf')](0x1f4,_0x93a191[_0xa338('0x12')]));});});};exports[_0xa338('0x1f')]=function(_0x2eb2f2){var _0x44f7ea=this;return new Promise(function(_0x166df7,_0x2e755f){return db[_0xa338('0x17')]['create'](_0x2eb2f2['body'],{'raw':_0x2eb2f2[_0xa338('0x18')]?_0x2eb2f2[_0xa338('0x18')][_0xa338('0x19')]===undefined?!![]:![]:!![]})[_0xa338('0xa')](function(_0xf3c2f5){logger[_0xa338('0x13')]('CreateVoiceCallReport',_0x2eb2f2);logger[_0xa338('0xc')]('CreateVoiceCallReport',_0x2eb2f2,JSON['stringify'](_0xf3c2f5));_0x166df7(_0xf3c2f5);})[_0xa338('0x15')](function(_0xb326cc){logger[_0xa338('0xf')](_0xa338('0x1f'),_0xb326cc[_0xa338('0x12')],_0x2eb2f2);_0x2e755f(_0x44f7ea['error'](0x1f4,_0xb326cc['message']));});});};exports[_0xa338('0x20')]=function(_0x49794f){var _0x22b081=this;return new Promise(function(_0xdacddc,_0x4a78b4){return db['VoiceCallReport'][_0xa338('0x21')](_0x49794f['body'],{'raw':_0x49794f['options']?_0x49794f[_0xa338('0x18')][_0xa338('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49794f[_0xa338('0x18')]?_0x49794f['options'][_0xa338('0x1a')]||null:null,'attributes':_0x49794f['options']?_0x49794f[_0xa338('0x18')][_0xa338('0x1b')]||null:null,'limit':_0x49794f[_0xa338('0x18')]?_0x49794f[_0xa338('0x18')][_0xa338('0x22')]||null:null})['then'](function(_0x50c22d){logger[_0xa338('0x13')]('UpdateVoiceCallReport',_0x49794f);logger['debug']('UpdateVoiceCallReport',_0x49794f,JSON[_0xa338('0xe')](_0x50c22d));_0xdacddc(_0x50c22d);})[_0xa338('0x15')](function(_0x51b579){logger['error'](_0xa338('0x20'),_0x51b579[_0xa338('0x12')],_0x49794f);_0x4a78b4(_0x22b081[_0xa338('0xf')](0x1f4,_0x51b579[_0xa338('0x12')]));});});}; \ No newline at end of file +var _0xdce4=['client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceCallReport','VoiceCallReport','options','raw','where','attributes','include','map','model','stringify','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xdce4,0x186));var _0x4dce=function(_0x1bac78,_0x58c4a1){_0x1bac78=_0x1bac78-0x0;var _0x40c15e=_0xdce4[_0x1bac78];return _0x40c15e;};'use strict';var _=require(_0x4dce('0x0'));var util=require('util');var moment=require(_0x4dce('0x1'));var BPromise=require(_0x4dce('0x2'));var rs=require(_0x4dce('0x3'));var fs=require('fs');var Redis=require(_0x4dce('0x4'));var db=require(_0x4dce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4dce('0x6'))(_0x4dce('0x7'));var config=require(_0x4dce('0x8'));var jayson=require(_0x4dce('0x9'));var client=jayson[_0x4dce('0xa')][_0x4dce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24c4d4,_0x466422,_0x34af6b){return new BPromise(function(_0x1e51ca,_0x117f50){return client[_0x4dce('0xc')](_0x24c4d4,_0x34af6b)[_0x4dce('0xd')](function(_0x3835fa){logger[_0x4dce('0xe')](_0x4dce('0xf'),_0x466422,_0x4dce('0x10'));logger[_0x4dce('0x11')](_0x4dce('0x12'),_0x466422,_0x4dce('0x10'),JSON['stringify'](_0x3835fa));if(_0x3835fa[_0x4dce('0x13')]){if(_0x3835fa[_0x4dce('0x13')][_0x4dce('0x14')]===0x1f4){logger[_0x4dce('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x466422,_0x3835fa[_0x4dce('0x13')][_0x4dce('0x15')]);return _0x117f50(_0x3835fa[_0x4dce('0x13')][_0x4dce('0x15')]);}logger[_0x4dce('0x13')](_0x4dce('0xf'),_0x466422,_0x3835fa[_0x4dce('0x13')]['message']);return _0x1e51ca(_0x3835fa[_0x4dce('0x13')][_0x4dce('0x15')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x466422,'request\x20sent');_0x1e51ca(_0x3835fa[_0x4dce('0x16')][_0x4dce('0x15')]);}})['catch'](function(_0x1d3300){logger[_0x4dce('0x13')](_0x4dce('0xf'),_0x466422,_0x1d3300);_0x117f50(_0x1d3300);});});}exports[_0x4dce('0x17')]=function(_0x429302){var _0x46dd0c=this;return new Promise(function(_0x19f212,_0x24d6e1){return db[_0x4dce('0x18')]['findAll']({'raw':_0x429302[_0x4dce('0x19')]?_0x429302[_0x4dce('0x19')][_0x4dce('0x1a')]===undefined?!![]:![]:!![],'where':_0x429302[_0x4dce('0x19')]?_0x429302['options'][_0x4dce('0x1b')]||null:null,'attributes':_0x429302['options']?_0x429302[_0x4dce('0x19')][_0x4dce('0x1c')]||null:null,'limit':_0x429302[_0x4dce('0x19')]?_0x429302['options']['limit']||null:null,'include':_0x429302[_0x4dce('0x19')]?_0x429302[_0x4dce('0x19')][_0x4dce('0x1d')]?_[_0x4dce('0x1e')](_0x429302[_0x4dce('0x19')][_0x4dce('0x1d')],function(_0xfea8ab){return{'model':db[_0xfea8ab[_0x4dce('0x1f')]],'as':_0xfea8ab['as'],'attributes':_0xfea8ab[_0x4dce('0x1c')],'include':_0xfea8ab[_0x4dce('0x1d')]?_['map'](_0xfea8ab[_0x4dce('0x1d')],function(_0x4892d7){return{'model':db[_0x4892d7[_0x4dce('0x1f')]],'as':_0x4892d7['as'],'attributes':_0x4892d7[_0x4dce('0x1c')],'include':_0x4892d7[_0x4dce('0x1d')]?_[_0x4dce('0x1e')](_0x4892d7[_0x4dce('0x1d')],function(_0x343e80){return{'model':db[_0x343e80[_0x4dce('0x1f')]],'as':_0x343e80['as'],'attributes':_0x343e80[_0x4dce('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4dce('0xd')](function(_0x2e950c){logger[_0x4dce('0xe')](_0x4dce('0x17'),_0x429302);logger[_0x4dce('0x11')](_0x4dce('0x17'),_0x429302,JSON[_0x4dce('0x20')](_0x2e950c));_0x19f212(_0x2e950c);})[_0x4dce('0x21')](function(_0x29d71d){logger[_0x4dce('0x13')](_0x4dce('0x17'),_0x29d71d['message'],_0x429302);_0x24d6e1(_0x46dd0c[_0x4dce('0x13')](0x1f4,_0x29d71d[_0x4dce('0x15')]));});});};exports[_0x4dce('0x22')]=function(_0x3a3ef2){var _0x1e70fb=this;return new Promise(function(_0x291329,_0x4ba006){return db[_0x4dce('0x18')][_0x4dce('0x23')](_0x3a3ef2[_0x4dce('0x24')],{'raw':_0x3a3ef2['options']?_0x3a3ef2[_0x4dce('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4dce('0xd')](function(_0xbe3a55){logger['info'](_0x4dce('0x22'),_0x3a3ef2);logger[_0x4dce('0x11')](_0x4dce('0x22'),_0x3a3ef2,JSON['stringify'](_0xbe3a55));_0x291329(_0xbe3a55);})[_0x4dce('0x21')](function(_0x4cf2a5){logger[_0x4dce('0x13')](_0x4dce('0x22'),_0x4cf2a5[_0x4dce('0x15')],_0x3a3ef2);_0x4ba006(_0x1e70fb[_0x4dce('0x13')](0x1f4,_0x4cf2a5[_0x4dce('0x15')]));});});};exports[_0x4dce('0x25')]=function(_0x1bc184){var _0x269e81=this;return new Promise(function(_0x36d725,_0x678f46){return db['VoiceCallReport'][_0x4dce('0x26')](_0x1bc184[_0x4dce('0x24')],{'raw':_0x1bc184['options']?_0x1bc184['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bc184[_0x4dce('0x19')]?_0x1bc184['options'][_0x4dce('0x1b')]||null:null,'attributes':_0x1bc184[_0x4dce('0x19')]?_0x1bc184[_0x4dce('0x19')][_0x4dce('0x1c')]||null:null,'limit':_0x1bc184[_0x4dce('0x19')]?_0x1bc184[_0x4dce('0x19')][_0x4dce('0x27')]||null:null})[_0x4dce('0xd')](function(_0x222580){logger[_0x4dce('0xe')]('UpdateVoiceCallReport',_0x1bc184);logger['debug'](_0x4dce('0x25'),_0x1bc184,JSON['stringify'](_0x222580));_0x36d725(_0x222580);})[_0x4dce('0x21')](function(_0x197924){logger[_0x4dce('0x13')]('UpdateVoiceCallReport',_0x197924[_0x4dce('0x15')],_0x1bc184);_0x678f46(_0x269e81['error'](0x1f4,_0x197924[_0x4dce('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index b145794..49f6994 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 _0x5ea2=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','index','get','/:id','post','put','isAuthenticated','update','delete','destroy'];(function(_0x19c0ab,_0x4070c8){var _0x598fe5=function(_0x6432cd){while(--_0x6432cd){_0x19c0ab['push'](_0x19c0ab['shift']());}};_0x598fe5(++_0x4070c8);}(_0x5ea2,0x166));var _0x25ea=function(_0x4d7b76,_0x36fdbe){_0x4d7b76=_0x4d7b76-0x0;var _0x21ad3d=_0x5ea2[_0x4d7b76];return _0x21ad3d;};'use strict';var multer=require(_0x25ea('0x0'));var util=require(_0x25ea('0x1'));var path=require(_0x25ea('0x2'));var timeout=require(_0x25ea('0x3'));var express=require(_0x25ea('0x4'));var router=express[_0x25ea('0x5')]();var fs_extra=require(_0x25ea('0x6'));var auth=require(_0x25ea('0x7'));var interaction=require(_0x25ea('0x8'));var config=require(_0x25ea('0x9'));var controller=require(_0x25ea('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0x25ea('0xb')]);router[_0x25ea('0xc')](_0x25ea('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x25ea('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x25ea('0xf')](_0x25ea('0xd'),auth[_0x25ea('0x10')](),controller[_0x25ea('0x11')]);router[_0x25ea('0x12')](_0x25ea('0xd'),auth[_0x25ea('0x10')](),controller[_0x25ea('0x13')]);module[_0x25ea('0x14')]=router; \ No newline at end of file +var _0x5691=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','get','/:id','show','post','create','put','update','destroy','multer','util','path','connect-timeout'];(function(_0x316149,_0xf27859){var _0xaa33cf=function(_0x407338){while(--_0x407338){_0x316149['push'](_0x316149['shift']());}};_0xaa33cf(++_0xf27859);}(_0x5691,0x1c4));var _0x1569=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5691[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1569('0x0'));var util=require(_0x1569('0x1'));var path=require(_0x1569('0x2'));var timeout=require(_0x1569('0x3'));var express=require(_0x1569('0x4'));var router=express[_0x1569('0x5')]();var fs_extra=require(_0x1569('0x6'));var auth=require(_0x1569('0x7'));var interaction=require(_0x1569('0x8'));var config=require('../../config/environment');var controller=require(_0x1569('0x9'));router['get']('/',auth[_0x1569('0xa')](),controller['index']);router[_0x1569('0xb')](_0x1569('0xc'),auth['isAuthenticated'](),controller[_0x1569('0xd')]);router[_0x1569('0xe')]('/',auth[_0x1569('0xa')](),controller[_0x1569('0xf')]);router[_0x1569('0x10')](_0x1569('0xc'),auth[_0x1569('0xa')](),controller[_0x1569('0x11')]);router['delete'](_0x1569('0xc'),auth[_0x1569('0xa')](),controller[_0x1569('0x12')]);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 fec1630..5ecdcbd 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 _0xf194=['sequelize','exports','STRING','options','join','getDataValue','split','BOOLEAN'];(function(_0x327cab,_0x2c14bd){var _0x59e760=function(_0xdace9e){while(--_0xdace9e){_0x327cab['push'](_0x327cab['shift']());}};_0x59e760(++_0x2c14bd);}(_0xf194,0x160));var _0x4f19=function(_0x11ec6a,_0x128f50){_0x11ec6a=_0x11ec6a-0x0;var _0x316f8e=_0xf194[_0x11ec6a];return _0x316f8e;};'use strict';var Sequelize=require(_0x4f19('0x0'));module[_0x4f19('0x1')]={'name':{'type':Sequelize[_0x4f19('0x2')]},'prefix':{'type':Sequelize[_0x4f19('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x4f19('0x2')],'set':function(_0x1d7e3f){this['setDataValue'](_0x4f19('0x3'),_0x1d7e3f?_0x1d7e3f[_0x4f19('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x4f19('0x3'))?this[_0x4f19('0x5')](_0x4f19('0x3'))[_0x4f19('0x6')](''):[];}},'auth':{'type':Sequelize[_0x4f19('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize[_0x4f19('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4f19('0x2')]},'description':{'type':Sequelize[_0x4f19('0x2')]}}; \ No newline at end of file +var _0xd2c8=['options','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x1e1965,_0x55785c){var _0x1a2e96=function(_0x27d366){while(--_0x27d366){_0x1e1965['push'](_0x1e1965['shift']());}};_0x1a2e96(++_0x55785c);}(_0xd2c8,0x1e4));var _0x8d2c=function(_0x2c2a2c,_0x21ccc6){_0x2c2a2c=_0x2c2a2c-0x0;var _0x5ab26d=_0xd2c8[_0x2c2a2c];return _0x5ab26d;};'use strict';var Sequelize=require(_0x8d2c('0x0'));module[_0x8d2c('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x8d2c('0x2')],'set':function(_0x532883){this[_0x8d2c('0x3')](_0x8d2c('0x4'),_0x532883?_0x532883['join'](''):[]);},'get':function(){return this[_0x8d2c('0x5')]('options')?this[_0x8d2c('0x5')](_0x8d2c('0x4'))[_0x8d2c('0x6')](''):[];}},'auth':{'type':Sequelize[_0x8d2c('0x7')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x8d2c('0x2')]},'description':{'type':Sequelize[_0x8d2c('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index c8dbd11..9bc027a 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 _0xee5b=['params','length','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','order','where','pick','merge','VIRTUAL','filter','options','VoiceChanSpy','includeAll','include','rows','catch','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee5b,0x1f4));var _0xbee5=function(_0x122e56,_0x321375){_0x122e56=_0x122e56-0x0;var _0x36434f=_0xee5b[_0x122e56];return _0x36434f;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));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(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];function respondWithStatusCode(_0xcef158,_0x48f771){_0x48f771=_0x48f771||0xcc;return function(_0x14e032){if(_0x14e032){return _0xcef158['sendStatus'](_0x48f771);}return _0xcef158[_0xbee5('0x17')](_0x48f771)[_0xbee5('0x18')]();};}function respondWithResult(_0x8a268f,_0x593ecb){_0x593ecb=_0x593ecb||0xc8;return function(_0x5092f2){if(_0x5092f2){return _0x8a268f[_0xbee5('0x17')](_0x593ecb)['json'](_0x5092f2);}};}function respondWithFilteredResult(_0x40afcb,_0x5426c9){return function(_0x1a24bd){if(_0x1a24bd){var _0x141878=typeof _0x5426c9[_0xbee5('0x19')]==='undefined'&&typeof _0x5426c9[_0xbee5('0x1a')]===_0xbee5('0x1b');var _0x5a0ae5=_0x1a24bd[_0xbee5('0x1c')];var _0x538460=_0x141878?0x0:_0x5426c9[_0xbee5('0x19')];var _0x3c3f4e=_0x141878?_0x1a24bd[_0xbee5('0x1c')]:_0x5426c9[_0xbee5('0x19')]+_0x5426c9[_0xbee5('0x1a')];var _0xa50ec9;if(_0x3c3f4e>=_0x5a0ae5){_0x3c3f4e=_0x5a0ae5;_0xa50ec9=0xc8;}else{_0xa50ec9=0xce;}_0x40afcb[_0xbee5('0x17')](_0xa50ec9);return _0x40afcb[_0xbee5('0x1d')](_0xbee5('0x1e'),_0x538460+'-'+_0x3c3f4e+'/'+_0x5a0ae5)[_0xbee5('0x1f')](_0x1a24bd);}return null;};}function patchUpdates(_0x35d7d3){return function(_0x40a06){try{jsonpatch[_0xbee5('0x20')](_0x40a06,_0x35d7d3,!![]);}catch(_0x47af8e){return BPromise['reject'](_0x47af8e);}return _0x40a06[_0xbee5('0x21')]();};}function saveUpdates(_0x48bfb5,_0x205491){return function(_0x117cb3){if(_0x117cb3){return _0x117cb3[_0xbee5('0x22')](_0x48bfb5)[_0xbee5('0x23')](function(_0x3f23c5){return _0x3f23c5;});}return null;};}function removeEntity(_0xb665df,_0x359ccf){return function(_0x3cfa8d){if(_0x3cfa8d){return _0x3cfa8d[_0xbee5('0x24')]()['then'](function(){var _0x5b43b3=_0x3cfa8d['get']({'plain':!![]});var _0x519473='ChanSpies';return db[_0xbee5('0x25')][_0xbee5('0x24')]({'where':{'type':_0x519473,'resourceId':_0x5b43b3['id']}})[_0xbee5('0x23')](function(){return _0x3cfa8d;});})[_0xbee5('0x23')](function(){_0xb665df[_0xbee5('0x17')](0xcc)[_0xbee5('0x18')]();});}};}function handleEntityNotFound(_0x3c8643,_0x4e9a79){return function(_0x36b50f){if(!_0x36b50f){_0x3c8643[_0xbee5('0x26')](0x194);}return _0x36b50f;};}function handleError(_0x179d14,_0x39da95){_0x39da95=_0x39da95||0x1f4;return function(_0x1a8bcc){logger['error'](_0x1a8bcc[_0xbee5('0x27')]);if(_0x1a8bcc[_0xbee5('0x28')]){delete _0x1a8bcc[_0xbee5('0x28')];}_0x179d14[_0xbee5('0x17')](_0x39da95)[_0xbee5('0x29')](_0x1a8bcc);};}exports[_0xbee5('0x2a')]=function(_0x34b7df,_0x36e8bb){var _0x2ccb91={},_0x59c2e4={},_0x22df5f={'count':0x0,'rows':[]};var _0x5b10a6=_[_0xbee5('0x2b')](db['VoiceChanSpy'][_0xbee5('0x2c')],function(_0x52dad9){return{'name':_0x52dad9[_0xbee5('0x2d')],'type':_0x52dad9['type'][_0xbee5('0x2e')]};});_0x59c2e4[_0xbee5('0x2f')]=_[_0xbee5('0x2b')](_0x5b10a6,_0xbee5('0x28'));_0x59c2e4['query']=_[_0xbee5('0x30')](_0x34b7df[_0xbee5('0x31')]);_0x59c2e4[_0xbee5('0x32')]=_[_0xbee5('0x33')](_0x59c2e4['model'],_0x59c2e4[_0xbee5('0x31')]);_0x2ccb91[_0xbee5('0x34')]=_[_0xbee5('0x33')](_0x59c2e4[_0xbee5('0x2f')],qs['fields'](_0x34b7df[_0xbee5('0x31')][_0xbee5('0x35')]));_0x2ccb91[_0xbee5('0x34')]=_0x2ccb91[_0xbee5('0x34')]['length']?_0x2ccb91[_0xbee5('0x34')]:_0x59c2e4['model'];if(!_0x34b7df[_0xbee5('0x31')]['hasOwnProperty']('nolimit')){_0x2ccb91['limit']=qs[_0xbee5('0x1a')](_0x34b7df[_0xbee5('0x31')][_0xbee5('0x1a')]);_0x2ccb91[_0xbee5('0x19')]=qs[_0xbee5('0x19')](_0x34b7df[_0xbee5('0x31')][_0xbee5('0x19')]);}_0x2ccb91[_0xbee5('0x36')]=qs['sort'](_0x34b7df[_0xbee5('0x31')]['sort']);_0x2ccb91[_0xbee5('0x37')]=qs[_0xbee5('0x32')](_[_0xbee5('0x38')](_0x34b7df[_0xbee5('0x31')],_0x59c2e4['filters']),_0x5b10a6);if(_0x34b7df[_0xbee5('0x31')]['filter']){_0x2ccb91['where']=_[_0xbee5('0x39')](_0x2ccb91[_0xbee5('0x37')],{'$or':_[_0xbee5('0x2b')](_0x5b10a6,function(_0x1974f2){if(_0x1974f2['type']!==_0xbee5('0x3a')){var _0x2819e2={};_0x2819e2[_0x1974f2[_0xbee5('0x28')]]={'$like':'%'+_0x34b7df[_0xbee5('0x31')][_0xbee5('0x3b')]+'%'};return _0x2819e2;}})});}_0x2ccb91=_[_0xbee5('0x39')]({},_0x2ccb91,_0x34b7df[_0xbee5('0x3c')]);var _0x297294={'where':_0x2ccb91[_0xbee5('0x37')]};return db[_0xbee5('0x3d')]['count'](_0x297294)[_0xbee5('0x23')](function(_0x371015){_0x22df5f['count']=_0x371015;if(_0x34b7df[_0xbee5('0x31')][_0xbee5('0x3e')]){_0x2ccb91[_0xbee5('0x3f')]=[{'all':!![]}];}return db[_0xbee5('0x3d')]['findAll'](_0x2ccb91);})['then'](function(_0x4b4641){_0x22df5f[_0xbee5('0x40')]=_0x4b4641;return _0x22df5f;})[_0xbee5('0x23')](respondWithFilteredResult(_0x36e8bb,_0x2ccb91))[_0xbee5('0x41')](handleError(_0x36e8bb,null));};exports[_0xbee5('0x42')]=function(_0x4012fd,_0x3f5441){var _0x41cea0={'raw':![],'where':{'id':_0x4012fd[_0xbee5('0x43')]['id']}},_0x2c4464={};_0x2c4464['model']=_['keys'](db[_0xbee5('0x3d')]['rawAttributes']);_0x2c4464[_0xbee5('0x31')]=_[_0xbee5('0x30')](_0x4012fd['query']);_0x2c4464[_0xbee5('0x32')]=_[_0xbee5('0x33')](_0x2c4464['model'],_0x2c4464['query']);_0x41cea0[_0xbee5('0x34')]=_[_0xbee5('0x33')](_0x2c4464['model'],qs[_0xbee5('0x35')](_0x4012fd[_0xbee5('0x31')]['fields']));_0x41cea0[_0xbee5('0x34')]=_0x41cea0[_0xbee5('0x34')][_0xbee5('0x44')]?_0x41cea0[_0xbee5('0x34')]:_0x2c4464[_0xbee5('0x2f')];if(_0x4012fd[_0xbee5('0x31')][_0xbee5('0x3e')]){_0x41cea0['include']=[{'all':!![]}];}_0x41cea0=_[_0xbee5('0x39')]({},_0x41cea0,_0x4012fd[_0xbee5('0x3c')]);return db[_0xbee5('0x3d')][_0xbee5('0x45')](_0x41cea0)['then'](handleEntityNotFound(_0x3f5441,null))[_0xbee5('0x23')](respondWithResult(_0x3f5441,null))[_0xbee5('0x41')](handleError(_0x3f5441,null));};exports[_0xbee5('0x46')]=function(_0x4aa21a,_0x44d4b1){return db[_0xbee5('0x3d')]['create'](_0x4aa21a['body'],{})['then'](function(_0x3a27bb){var _0x501167=_0x4aa21a[_0xbee5('0x47')][_0xbee5('0x48')]({'plain':!![]});if(!_0x501167)throw new Error(_0xbee5('0x49'));if(_0x501167[_0xbee5('0x4a')]===_0xbee5('0x47')){var _0x296fc8=_0x3a27bb['get']({'plain':!![]});var _0x24274d=_0xbee5('0x4b');return db[_0xbee5('0x4c')][_0xbee5('0x45')]({'where':{'name':_0x24274d,'userProfileId':_0x501167['userProfileId']},'raw':!![]})[_0xbee5('0x23')](function(_0x594dcf){if(_0x594dcf&&_0x594dcf[_0xbee5('0x4d')]===0x0){return db[_0xbee5('0x25')][_0xbee5('0x46')]({'name':_0x296fc8[_0xbee5('0x28')],'resourceId':_0x296fc8['id'],'type':_0x594dcf[_0xbee5('0x28')],'sectionId':_0x594dcf['id']},{})[_0xbee5('0x23')](function(){return _0x3a27bb;});}else{return _0x3a27bb;}})[_0xbee5('0x41')](function(_0x35f1d1){logger[_0xbee5('0x4e')](_0xbee5('0x4f'),_0x35f1d1);throw _0x35f1d1;});}return _0x3a27bb;})[_0xbee5('0x23')](respondWithResult(_0x44d4b1,0xc9))[_0xbee5('0x41')](handleError(_0x44d4b1,null));};exports[_0xbee5('0x22')]=function(_0x359738,_0x37cf74){if(_0x359738['body']['id']){delete _0x359738[_0xbee5('0x50')]['id'];}return db[_0xbee5('0x3d')][_0xbee5('0x45')]({'where':{'id':_0x359738['params']['id']}})[_0xbee5('0x23')](handleEntityNotFound(_0x37cf74,null))[_0xbee5('0x23')](saveUpdates(_0x359738[_0xbee5('0x50')],null))['then'](respondWithResult(_0x37cf74,null))[_0xbee5('0x41')](handleError(_0x37cf74,null));};exports['destroy']=function(_0x131c45,_0x4ee645){return db[_0xbee5('0x3d')][_0xbee5('0x45')]({'where':{'id':_0x131c45[_0xbee5('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ee645,null))['then'](removeEntity(_0x4ee645,null))['catch'](handleError(_0x4ee645,null));}; \ No newline at end of file +var _0x4156=['ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','ChanSpies','UserProfileResource','destroy','error','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','nolimit','order','sort','filters','pick','where','type','filter','merge','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','fields','length','find','create','body','user','get','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','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4156,0xf1));var _0x6415=function(_0x44f95b,_0x535874){_0x44f95b=_0x44f95b-0x0;var _0x1d6d38=_0x4156[_0x44f95b];return _0x1d6d38;};'use strict';var emlformat=require(_0x6415('0x0'));var rimraf=require(_0x6415('0x1'));var zipdir=require(_0x6415('0x2'));var jsonpatch=require(_0x6415('0x3'));var rp=require(_0x6415('0x4'));var moment=require('moment');var BPromise=require(_0x6415('0x5'));var Mustache=require(_0x6415('0x6'));var util=require(_0x6415('0x7'));var path=require(_0x6415('0x8'));var sox=require(_0x6415('0x9'));var csv=require(_0x6415('0xa'));var ejs=require(_0x6415('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6415('0xc'));var squel=require('squel');var crypto=require(_0x6415('0xd'));var jsforce=require(_0x6415('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6415('0xa'));var querystring=require(_0x6415('0xf'));var Papa=require(_0x6415('0x10'));var Redis=require(_0x6415('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6415('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6415('0x13'))(_0x6415('0x14'));var utils=require(_0x6415('0x15'));var config=require(_0x6415('0x16'));var licenseUtil=require(_0x6415('0x17'));var db=require(_0x6415('0x18'))['db'];function respondWithStatusCode(_0x455f44,_0x596b97){_0x596b97=_0x596b97||0xcc;return function(_0x5b3493){if(_0x5b3493){return _0x455f44[_0x6415('0x19')](_0x596b97);}return _0x455f44[_0x6415('0x1a')](_0x596b97)[_0x6415('0x1b')]();};}function respondWithResult(_0xf75bec,_0x21ae74){_0x21ae74=_0x21ae74||0xc8;return function(_0x5b2a26){if(_0x5b2a26){return _0xf75bec['status'](_0x21ae74)[_0x6415('0x1c')](_0x5b2a26);}};}function respondWithFilteredResult(_0x780643,_0x48017d){return function(_0x1d540c){if(_0x1d540c){var _0x41f9b0=typeof _0x48017d['offset']==='undefined'&&typeof _0x48017d[_0x6415('0x1d')]===_0x6415('0x1e');var _0x3f739d=_0x1d540c[_0x6415('0x1f')];var _0x2ef73b=_0x41f9b0?0x0:_0x48017d[_0x6415('0x20')];var _0x2c74c6=_0x41f9b0?_0x1d540c[_0x6415('0x1f')]:_0x48017d[_0x6415('0x20')]+_0x48017d['limit'];var _0x551985;if(_0x2c74c6>=_0x3f739d){_0x2c74c6=_0x3f739d;_0x551985=0xc8;}else{_0x551985=0xce;}_0x780643['status'](_0x551985);return _0x780643[_0x6415('0x21')](_0x6415('0x22'),_0x2ef73b+'-'+_0x2c74c6+'/'+_0x3f739d)[_0x6415('0x1c')](_0x1d540c);}return null;};}function patchUpdates(_0x1e58f2){return function(_0x551632){try{jsonpatch[_0x6415('0x23')](_0x551632,_0x1e58f2,!![]);}catch(_0x3f4400){return BPromise[_0x6415('0x24')](_0x3f4400);}return _0x551632['save']();};}function saveUpdates(_0x287ac9,_0x266f97){return function(_0x7c567f){if(_0x7c567f){return _0x7c567f[_0x6415('0x25')](_0x287ac9)[_0x6415('0x26')](function(_0x3e33d3){return _0x3e33d3;});}return null;};}function removeEntity(_0x339c50,_0x41c266){return function(_0x1496c1){if(_0x1496c1){return _0x1496c1['destroy']()[_0x6415('0x26')](function(){var _0xa1f297=_0x1496c1['get']({'plain':!![]});var _0x15be31=_0x6415('0x27');return db[_0x6415('0x28')][_0x6415('0x29')]({'where':{'type':_0x15be31,'resourceId':_0xa1f297['id']}})[_0x6415('0x26')](function(){return _0x1496c1;});})['then'](function(){_0x339c50[_0x6415('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24528f,_0xbe3a32){return function(_0x25d459){if(!_0x25d459){_0x24528f['sendStatus'](0x194);}return _0x25d459;};}function handleError(_0x4dea9d,_0x514f51){_0x514f51=_0x514f51||0x1f4;return function(_0x61e827){logger[_0x6415('0x2a')](_0x61e827['stack']);if(_0x61e827['name']){delete _0x61e827[_0x6415('0x2b')];}_0x4dea9d[_0x6415('0x1a')](_0x514f51)[_0x6415('0x2c')](_0x61e827);};}exports[_0x6415('0x2d')]=function(_0x25e97f,_0x2ba17d){var _0x5b15fd={},_0xeb5401={},_0x228be0={'count':0x0,'rows':[]};var _0x900b7b=_[_0x6415('0x2e')](db['VoiceChanSpy']['rawAttributes'],function(_0x5681aa){return{'name':_0x5681aa[_0x6415('0x2f')],'type':_0x5681aa['type'][_0x6415('0x30')]};});_0xeb5401['model']=_[_0x6415('0x2e')](_0x900b7b,_0x6415('0x2b'));_0xeb5401[_0x6415('0x31')]=_[_0x6415('0x32')](_0x25e97f['query']);_0xeb5401['filters']=_[_0x6415('0x33')](_0xeb5401[_0x6415('0x34')],_0xeb5401[_0x6415('0x31')]);_0x5b15fd[_0x6415('0x35')]=_[_0x6415('0x33')](_0xeb5401[_0x6415('0x34')],qs['fields'](_0x25e97f[_0x6415('0x31')]['fields']));_0x5b15fd['attributes']=_0x5b15fd['attributes']['length']?_0x5b15fd[_0x6415('0x35')]:_0xeb5401[_0x6415('0x34')];if(!_0x25e97f[_0x6415('0x31')]['hasOwnProperty'](_0x6415('0x36'))){_0x5b15fd[_0x6415('0x1d')]=qs['limit'](_0x25e97f[_0x6415('0x31')][_0x6415('0x1d')]);_0x5b15fd[_0x6415('0x20')]=qs[_0x6415('0x20')](_0x25e97f[_0x6415('0x31')]['offset']);}_0x5b15fd[_0x6415('0x37')]=qs['sort'](_0x25e97f[_0x6415('0x31')][_0x6415('0x38')]);_0x5b15fd['where']=qs[_0x6415('0x39')](_[_0x6415('0x3a')](_0x25e97f['query'],_0xeb5401['filters']),_0x900b7b);if(_0x25e97f[_0x6415('0x31')]['filter']){_0x5b15fd[_0x6415('0x3b')]=_['merge'](_0x5b15fd[_0x6415('0x3b')],{'$or':_[_0x6415('0x2e')](_0x900b7b,function(_0x5cf158){if(_0x5cf158[_0x6415('0x3c')]!=='VIRTUAL'){var _0x37b93f={};_0x37b93f[_0x5cf158[_0x6415('0x2b')]]={'$like':'%'+_0x25e97f[_0x6415('0x31')][_0x6415('0x3d')]+'%'};return _0x37b93f;}})});}_0x5b15fd=_[_0x6415('0x3e')]({},_0x5b15fd,_0x25e97f[_0x6415('0x3f')]);var _0x366b4d={'where':_0x5b15fd[_0x6415('0x3b')]};return db[_0x6415('0x40')][_0x6415('0x1f')](_0x366b4d)[_0x6415('0x26')](function(_0x35b203){_0x228be0[_0x6415('0x1f')]=_0x35b203;if(_0x25e97f[_0x6415('0x31')][_0x6415('0x41')]){_0x5b15fd[_0x6415('0x42')]=[{'all':!![]}];}return db[_0x6415('0x40')][_0x6415('0x43')](_0x5b15fd);})[_0x6415('0x26')](function(_0x581573){_0x228be0[_0x6415('0x44')]=_0x581573;return _0x228be0;})['then'](respondWithFilteredResult(_0x2ba17d,_0x5b15fd))[_0x6415('0x45')](handleError(_0x2ba17d,null));};exports[_0x6415('0x46')]=function(_0x586b68,_0x28c3f4){var _0x122eca={'raw':![],'where':{'id':_0x586b68[_0x6415('0x47')]['id']}},_0x202c93={};_0x202c93['model']=_['keys'](db[_0x6415('0x40')]['rawAttributes']);_0x202c93[_0x6415('0x31')]=_['keys'](_0x586b68[_0x6415('0x31')]);_0x202c93[_0x6415('0x39')]=_[_0x6415('0x33')](_0x202c93[_0x6415('0x34')],_0x202c93[_0x6415('0x31')]);_0x122eca[_0x6415('0x35')]=_[_0x6415('0x33')](_0x202c93['model'],qs[_0x6415('0x48')](_0x586b68[_0x6415('0x31')]['fields']));_0x122eca[_0x6415('0x35')]=_0x122eca['attributes'][_0x6415('0x49')]?_0x122eca[_0x6415('0x35')]:_0x202c93[_0x6415('0x34')];if(_0x586b68[_0x6415('0x31')][_0x6415('0x41')]){_0x122eca['include']=[{'all':!![]}];}_0x122eca=_[_0x6415('0x3e')]({},_0x122eca,_0x586b68['options']);return db[_0x6415('0x40')][_0x6415('0x4a')](_0x122eca)[_0x6415('0x26')](handleEntityNotFound(_0x28c3f4,null))[_0x6415('0x26')](respondWithResult(_0x28c3f4,null))['catch'](handleError(_0x28c3f4,null));};exports[_0x6415('0x4b')]=function(_0x518643,_0x4130c5){return db[_0x6415('0x40')]['create'](_0x518643[_0x6415('0x4c')],{})[_0x6415('0x26')](function(_0x39af0a){var _0x479632=_0x518643[_0x6415('0x4d')][_0x6415('0x4e')]({'plain':!![]});if(!_0x479632)throw new Error(_0x6415('0x4f'));if(_0x479632[_0x6415('0x50')]===_0x6415('0x4d')){var _0x14b1e1=_0x39af0a[_0x6415('0x4e')]({'plain':!![]});var _0xebcebe='ChanSpies';return db[_0x6415('0x51')][_0x6415('0x4a')]({'where':{'name':_0xebcebe,'userProfileId':_0x479632[_0x6415('0x52')]},'raw':!![]})[_0x6415('0x26')](function(_0xdac05d){if(_0xdac05d&&_0xdac05d['autoAssociation']===0x0){return db[_0x6415('0x28')][_0x6415('0x4b')]({'name':_0x14b1e1[_0x6415('0x2b')],'resourceId':_0x14b1e1['id'],'type':_0xdac05d[_0x6415('0x2b')],'sectionId':_0xdac05d['id']},{})[_0x6415('0x26')](function(){return _0x39af0a;});}else{return _0x39af0a;}})[_0x6415('0x45')](function(_0xdeda6a){logger[_0x6415('0x2a')](_0x6415('0x53'),_0xdeda6a);throw _0xdeda6a;});}return _0x39af0a;})[_0x6415('0x26')](respondWithResult(_0x4130c5,0xc9))['catch'](handleError(_0x4130c5,null));};exports[_0x6415('0x25')]=function(_0x5ee3a8,_0x17ba20){if(_0x5ee3a8[_0x6415('0x4c')]['id']){delete _0x5ee3a8[_0x6415('0x4c')]['id'];}return db['VoiceChanSpy'][_0x6415('0x4a')]({'where':{'id':_0x5ee3a8[_0x6415('0x47')]['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x17ba20,null))['then'](saveUpdates(_0x5ee3a8[_0x6415('0x4c')],null))[_0x6415('0x26')](respondWithResult(_0x17ba20,null))[_0x6415('0x45')](handleError(_0x17ba20,null));};exports[_0x6415('0x29')]=function(_0xde1fb6,_0x116927){return db['VoiceChanSpy'][_0x6415('0x4a')]({'where':{'id':_0xde1fb6['params']['id']}})[_0x6415('0x26')](handleEntityNotFound(_0x116927,null))[_0x6415('0x26')](removeEntity(_0x116927,null))['catch'](handleError(_0x116927,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 699d923..15286cd 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 _0xa709=['Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','password','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','User','findAll','internal','agent','then','exports','models','VoiceChanSpy','VoiceExtension','bulkCreate','catch','destroy','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','prefix','system','push','merge'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xa709,0xd4));var _0x9a70=function(_0x1dfa63,_0x362bd4){_0x1dfa63=_0x1dfa63-0x0;var _0x26f2a9=_0xa709[_0x1dfa63];return _0x26f2a9;};'use strict';var _=require('lodash');var util=require(_0x9a70('0x0'));var BPromise=require(_0x9a70('0x1'));var attributes=require(_0x9a70('0x2'));var getUserApplications=function(_0x229a85,_0x4be36f,_0x2a8377){var _0xd45ec4=0x1;var _0x58dc64=[];var _0x29acbe={'context':_0x4be36f[_0x9a70('0x3')]||_0x9a70('0x4'),'exten':util[_0x9a70('0x5')]('%s%s',_0x229a85[_0x9a70('0x6')],_0x2a8377),'type':_0x9a70('0x7'),'isApp':![],'ChanSpyId':_0x229a85['id'],'UserId':_0x4be36f['id']};_0x58dc64[_0x9a70('0x8')](_[_0x9a70('0x9')]({'app':_0x9a70('0xa'),'appdata':util['format'](_0x9a70('0xb'),_0x9a70('0xc')),'priority':_0xd45ec4++},_0x29acbe));if(_0x229a85[_0x9a70('0xd')]){_0x58dc64[_0x9a70('0x8')](_[_0x9a70('0x9')]({'app':_0x9a70('0xe'),'appdata':util['format']('${UNIQUEID}.%s,a',_0x229a85[_0x9a70('0xf')]),'priority':_0xd45ec4++},_0x29acbe));}if(_0x229a85[_0x9a70('0x10')]){_0x58dc64['push'](_[_0x9a70('0x9')]({'app':'Authenticate','appdata':_0x229a85[_0x9a70('0x11')],'priority':_0xd45ec4++},_0x29acbe));}_0x58dc64[_0x9a70('0x8')](_[_0x9a70('0x9')]({'app':'ChanSpy','appdata':util[_0x9a70('0x5')](_0x9a70('0x12'),_0x4be36f[_0x9a70('0x13')],_0x229a85[_0x9a70('0x14')]?_0x229a85[_0x9a70('0x14')][_0x9a70('0x15')](''):''),'priority':_0xd45ec4++},_0x29acbe));if(_0x229a85[_0x9a70('0xd')]){_0x58dc64[_0x9a70('0x8')](_[_0x9a70('0x9')]({'app':_0x9a70('0x16'),'priority':_0xd45ec4++},_0x29acbe));}return _0x58dc64;};var getChanSpyApplications=function(_0x3b06c5,_0x3e5055){var _0x3957fa=[];for(var _0x5cabd7=0x0,_0x38d5bd=0x1;_0x5cabd7<_0x3e5055[_0x9a70('0x17')];_0x5cabd7++,_0x38d5bd=0x1){_0x3957fa=_0x3957fa[_0x9a70('0x18')](getUserApplications(_0x3b06c5,_0x3e5055[_0x5cabd7],_0x3e5055[_0x5cabd7]['internal']));if(_0x3e5055[_0x5cabd7]['internal']!=_0x3e5055[_0x5cabd7][_0x9a70('0x13')]){_0x3957fa=_0x3957fa[_0x9a70('0x18')](getUserApplications(_0x3b06c5,_0x3e5055[_0x5cabd7],_0x3e5055[_0x5cabd7][_0x9a70('0x13')]));}}return _0x3957fa;};var getChanSpyPromise=function(_0x4d11b3,_0x55079d){return new BPromise(function(_0x112d01,_0x59b330){return _0x4d11b3[_0x9a70('0x19')][_0x9a70('0x1a')]({'attributes':['id',_0x9a70('0x13'),_0x9a70('0x1b')],'where':{'role':_0x9a70('0x1c'),'chanspy':!![]},'raw':!![]})[_0x9a70('0x1d')](function(_0x5a7723){if(_0x5a7723){return _0x112d01(getChanSpyApplications(_0x55079d,_0x5a7723));}return _0x112d01([]);})['catch'](function(_0x3945e1){_0x59b330(_0x3945e1);});});};module[_0x9a70('0x1e')]=function(_0x1c2094,_0x58d099){var _0x54e233=_0x1c2094[_0x9a70('0x1f')];return _0x1c2094['define'](_0x9a70('0x20'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ac7e7,_0x2cf5e4,_0x2334dc){return getChanSpyPromise(_0x54e233,_0x2ac7e7)['then'](function(_0x107eb3){if(_0x107eb3&&_0x107eb3[_0x9a70('0x17')]){return _0x54e233[_0x9a70('0x21')][_0x9a70('0x22')](_0x107eb3);}})[_0x9a70('0x1d')](function(){_0x2334dc();})[_0x9a70('0x23')](function(_0x39994b){_0x2334dc(_0x39994b);});},'afterUpdate':function(_0x45806a,_0x180348,_0x1e5086){return _0x54e233[_0x9a70('0x21')][_0x9a70('0x24')]({'where':{'ChanSpyId':_0x45806a['id']}})[_0x9a70('0x1d')](function(){return getChanSpyPromise(_0x54e233,_0x45806a);})[_0x9a70('0x1d')](function(_0x27f87b){if(_0x27f87b&&_0x27f87b[_0x9a70('0x17')]){return _0x54e233[_0x9a70('0x21')][_0x9a70('0x22')](_0x27f87b);}})[_0x9a70('0x1d')](function(){_0x1e5086();})['catch'](function(_0x2c95b0){_0x1e5086(_0x2c95b0);});},'afterDestroy':function(_0x509d0e,_0x3f07e0,_0x376998){return _0x54e233[_0x9a70('0x21')][_0x9a70('0x24')]({'where':{'ChanSpyId':_0x509d0e['id']}})[_0x9a70('0x1d')](function(){_0x376998();})['catch'](function(_0x5a982c){_0x376998(_0x5a982c);});}}});}; \ No newline at end of file +var _0x9c13=['merge','chanspy','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','internal','concat','findAll','agent','exports','models','VoiceChanSpy','voice_chanspy','then','length','bulkCreate','destroy','VoiceExtension','lodash','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0x9c13,0x12a));var _0x39c1=function(_0x2bcd1f,_0x4f1972){_0x2bcd1f=_0x2bcd1f-0x0;var _0x2381ca=_0x9c13[_0x2bcd1f];return _0x2381ca;};'use strict';var _=require(_0x39c1('0x0'));var util=require('util');var BPromise=require(_0x39c1('0x1'));var attributes=require(_0x39c1('0x2'));var getUserApplications=function(_0x3dd41b,_0x394afc,_0x7c80a4){var _0x1819aa=0x1;var _0x344e36=[];var _0x256ec1={'context':_0x394afc[_0x39c1('0x3')]||_0x39c1('0x4'),'exten':util[_0x39c1('0x5')](_0x39c1('0x6'),_0x3dd41b['prefix'],_0x7c80a4),'type':'system','isApp':![],'ChanSpyId':_0x3dd41b['id'],'UserId':_0x394afc['id']};_0x344e36[_0x39c1('0x7')](_[_0x39c1('0x8')]({'app':'Set','appdata':util[_0x39c1('0x5')]('CDR(type)=%s',_0x39c1('0x9')),'priority':_0x1819aa++},_0x256ec1));if(_0x3dd41b[_0x39c1('0xa')]){_0x344e36[_0x39c1('0x7')](_[_0x39c1('0x8')]({'app':_0x39c1('0xb'),'appdata':util[_0x39c1('0x5')]('${UNIQUEID}.%s,a',_0x3dd41b[_0x39c1('0xc')]),'priority':_0x1819aa++},_0x256ec1));}if(_0x3dd41b[_0x39c1('0xd')]){_0x344e36[_0x39c1('0x7')](_[_0x39c1('0x8')]({'app':_0x39c1('0xe'),'appdata':_0x3dd41b[_0x39c1('0xf')],'priority':_0x1819aa++},_0x256ec1));}_0x344e36[_0x39c1('0x7')](_[_0x39c1('0x8')]({'app':_0x39c1('0x10'),'appdata':util[_0x39c1('0x5')](_0x39c1('0x11'),_0x394afc[_0x39c1('0x12')],_0x3dd41b[_0x39c1('0x13')]?_0x3dd41b[_0x39c1('0x13')][_0x39c1('0x14')](''):''),'priority':_0x1819aa++},_0x256ec1));if(_0x3dd41b[_0x39c1('0xa')]){_0x344e36[_0x39c1('0x7')](_[_0x39c1('0x8')]({'app':'StopMixMonitor','priority':_0x1819aa++},_0x256ec1));}return _0x344e36;};var getChanSpyApplications=function(_0x3dca3c,_0x52cca6){var _0x2279dc=[];for(var _0x16c35f=0x0,_0x1f2d43=0x1;_0x16c35f<_0x52cca6['length'];_0x16c35f++,_0x1f2d43=0x1){_0x2279dc=_0x2279dc['concat'](getUserApplications(_0x3dca3c,_0x52cca6[_0x16c35f],_0x52cca6[_0x16c35f]['internal']));if(_0x52cca6[_0x16c35f][_0x39c1('0x15')]!=_0x52cca6[_0x16c35f]['name']){_0x2279dc=_0x2279dc[_0x39c1('0x16')](getUserApplications(_0x3dca3c,_0x52cca6[_0x16c35f],_0x52cca6[_0x16c35f][_0x39c1('0x12')]));}}return _0x2279dc;};var getChanSpyPromise=function(_0x553eca,_0x5c3d31){return new BPromise(function(_0x3933b7,_0x51acda){return _0x553eca['User'][_0x39c1('0x17')]({'attributes':['id',_0x39c1('0x12'),'internal'],'where':{'role':_0x39c1('0x18'),'chanspy':!![]},'raw':!![]})['then'](function(_0x387458){if(_0x387458){return _0x3933b7(getChanSpyApplications(_0x5c3d31,_0x387458));}return _0x3933b7([]);})['catch'](function(_0x128327){_0x51acda(_0x128327);});});};module[_0x39c1('0x19')]=function(_0x48042b,_0x590566){var _0x50366e=_0x48042b[_0x39c1('0x1a')];return _0x48042b['define'](_0x39c1('0x1b'),attributes,{'tableName':_0x39c1('0x1c'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x169f1b,_0x3cc545,_0x2d8921){return getChanSpyPromise(_0x50366e,_0x169f1b)[_0x39c1('0x1d')](function(_0x42f38b){if(_0x42f38b&&_0x42f38b[_0x39c1('0x1e')]){return _0x50366e['VoiceExtension'][_0x39c1('0x1f')](_0x42f38b);}})['then'](function(){_0x2d8921();})['catch'](function(_0x1540cd){_0x2d8921(_0x1540cd);});},'afterUpdate':function(_0x103d88,_0x45d32d,_0x30c09e){return _0x50366e['VoiceExtension'][_0x39c1('0x20')]({'where':{'ChanSpyId':_0x103d88['id']}})[_0x39c1('0x1d')](function(){return getChanSpyPromise(_0x50366e,_0x103d88);})[_0x39c1('0x1d')](function(_0x52c9c7){if(_0x52c9c7&&_0x52c9c7[_0x39c1('0x1e')]){return _0x50366e[_0x39c1('0x21')][_0x39c1('0x1f')](_0x52c9c7);}})[_0x39c1('0x1d')](function(){_0x30c09e();})['catch'](function(_0x5a1bce){_0x30c09e(_0x5a1bce);});},'afterDestroy':function(_0x4a5188,_0x2a73b0,_0x4f08fe){return _0x50366e[_0x39c1('0x21')][_0x39c1('0x20')]({'where':{'ChanSpyId':_0x4a5188['id']}})[_0x39c1('0x1d')](function(){_0x4f08fe();})['catch'](function(_0x35f5a8){_0x4f08fe(_0x35f5a8);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index f93b683..ec98085 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 _0x96cc=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x2df93d,_0x26ba91){var _0x11a251=function(_0x31c881){while(--_0x31c881){_0x2df93d['push'](_0x2df93d['shift']());}};_0x11a251(++_0x26ba91);}(_0x96cc,0x16c));var _0xc96c=function(_0x501c32,_0x2f24c9){_0x501c32=_0x501c32-0x0;var _0x9bd372=_0x96cc[_0x501c32];return _0x9bd372;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var moment=require(_0xc96c('0x1'));var BPromise=require('bluebird');var rs=require(_0xc96c('0x2'));var fs=require('fs');var Redis=require(_0xc96c('0x3'));var db=require(_0xc96c('0x4'))['db'];var utils=require(_0xc96c('0x5'));var logger=require(_0xc96c('0x6'))(_0xc96c('0x7'));var config=require(_0xc96c('0x8'));var jayson=require(_0xc96c('0x9'));var client=jayson[_0xc96c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10b411,_0x18eb9c,_0x408afb){return new BPromise(function(_0x86c1a8,_0x13363d){return client[_0xc96c('0xb')](_0x10b411,_0x408afb)[_0xc96c('0xc')](function(_0x54e765){logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));logger['debug'](_0xc96c('0x10'),_0x18eb9c,'request\x20sent',JSON[_0xc96c('0x11')](_0x54e765));if(_0x54e765['error']){if(_0x54e765[_0xc96c('0x12')][_0xc96c('0x13')]===0x1f4){logger[_0xc96c('0x12')](_0xc96c('0xe'),_0x18eb9c,_0x54e765['error'][_0xc96c('0x14')]);return _0x13363d(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}logger[_0xc96c('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x18eb9c,_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);return _0x86c1a8(_0x54e765[_0xc96c('0x12')][_0xc96c('0x14')]);}else{logger[_0xc96c('0xd')](_0xc96c('0xe'),_0x18eb9c,_0xc96c('0xf'));_0x86c1a8(_0x54e765[_0xc96c('0x15')][_0xc96c('0x14')]);}})[_0xc96c('0x16')](function(_0x861230){logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x18eb9c,_0x861230);_0x13363d(_0x861230);});});} \ No newline at end of file +var _0x6953=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x6953,0x91));var _0x3695=function(_0x2bf14b,_0x409fc8){_0x2bf14b=_0x2bf14b-0x0;var _0x32f2d4=_0x6953[_0x2bf14b];return _0x32f2d4;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3695('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var config=require('../../config/environment');var jayson=require(_0x3695('0x6'));var client=jayson['client'][_0x3695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14eb32,_0x912099,_0x1a4e75){return new BPromise(function(_0x301e46,_0x4e337b){return client[_0x3695('0x8')](_0x14eb32,_0x1a4e75)['then'](function(_0x1fcd43){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x3695('0x9'));logger['debug'](_0x3695('0xa'),_0x912099,_0x3695('0x9'),JSON[_0x3695('0xb')](_0x1fcd43));if(_0x1fcd43[_0x3695('0xc')]){if(_0x1fcd43[_0x3695('0xc')][_0x3695('0xd')]===0x1f4){logger['error'](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x4e337b(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}logger[_0x3695('0xc')](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x301e46(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}else{logger['info'](_0x3695('0xe'),_0x912099,_0x3695('0x9'));_0x301e46(_0x1fcd43[_0x3695('0x10')][_0x3695('0xf')]);}})[_0x3695('0x11')](function(_0x1973ee){logger[_0x3695('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x1973ee);_0x4e337b(_0x1973ee);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2ebee55..802edcb 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 _0x9719=['exports','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','/:id','isAuthenticated','post','create','put','update','delete','destroy'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x9719,0x144));var _0x9971=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9719[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9971('0x0'));var timeout=require(_0x9971('0x1'));var express=require(_0x9971('0x2'));var router=express[_0x9971('0x3')]();var fs_extra=require(_0x9971('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9971('0x5'));var controller=require('./voiceContext.controller');router[_0x9971('0x6')]('/',auth['isAuthenticated'](),controller[_0x9971('0x7')]);router['get'](_0x9971('0x8'),auth[_0x9971('0x9')](),controller['show']);router[_0x9971('0xa')]('/',auth['isAuthenticated'](),controller[_0x9971('0xb')]);router[_0x9971('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x9971('0xd')]);router[_0x9971('0xe')](_0x9971('0x8'),auth[_0x9971('0x9')](),controller[_0x9971('0xf')]);module[_0x9971('0x10')]=router; \ No newline at end of file +var _0xf583=['index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x3e91fc,_0x4bd4ad){var _0x4ada99=function(_0x28956b){while(--_0x28956b){_0x3e91fc['push'](_0x3e91fc['shift']());}};_0x4ada99(++_0x4bd4ad);}(_0xf583,0x81));var _0x3f58=function(_0x10004e,_0xd701e6){_0x10004e=_0x10004e-0x0;var _0x5af990=_0xf583[_0x10004e];return _0x5af990;};'use strict';var multer=require(_0x3f58('0x0'));var util=require(_0x3f58('0x1'));var path=require(_0x3f58('0x2'));var timeout=require('connect-timeout');var express=require(_0x3f58('0x3'));var router=express[_0x3f58('0x4')]();var fs_extra=require(_0x3f58('0x5'));var auth=require(_0x3f58('0x6'));var interaction=require(_0x3f58('0x7'));var config=require(_0x3f58('0x8'));var controller=require('./voiceContext.controller');router[_0x3f58('0x9')]('/',auth[_0x3f58('0xa')](),controller[_0x3f58('0xb')]);router[_0x3f58('0x9')](_0x3f58('0xc'),auth[_0x3f58('0xa')](),controller['show']);router[_0x3f58('0xd')]('/',auth[_0x3f58('0xa')](),controller[_0x3f58('0xe')]);router[_0x3f58('0xf')](_0x3f58('0xc'),auth[_0x3f58('0xa')](),controller[_0x3f58('0x10')]);router[_0x3f58('0x11')](_0x3f58('0xc'),auth[_0x3f58('0xa')](),controller[_0x3f58('0x12')]);module[_0x3f58('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 3373ddc..987121e 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 _0x9784=['BOOLEAN','STRING'];(function(_0x26ed29,_0x2288f1){var _0x26182c=function(_0x23dc71){while(--_0x23dc71){_0x26ed29['push'](_0x26ed29['shift']());}};_0x26182c(++_0x2288f1);}(_0x9784,0xed));var _0x4978=function(_0x4a454c,_0x57eb8c){_0x4a454c=_0x4a454c-0x0;var _0x445b67=_0x9784[_0x4a454c];return _0x445b67;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4978('0x0')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x4978('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0760=['BOOLEAN','sequelize','exports','STRING','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x0760,0x15f));var _0x0076=function(_0x588dd2,_0x5c8152){_0x588dd2=_0x588dd2-0x0;var _0x4f208e=_0x0760[_0x588dd2];return _0x4f208e;};'use strict';var Sequelize=require(_0x0076('0x0'));module[_0x0076('0x1')]={'name':{'type':Sequelize[_0x0076('0x2')],'unique':_0x0076('0x3')},'description':{'type':Sequelize[_0x0076('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x0076('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 2224206..0886a3b 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 _0x30bc=['status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','Contexts','UserProfileResource','stack','name','send','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','includeAll','find','create','body','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','Reload','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0xb64e94,_0x5d1255){var _0x45e191=function(_0x4653a9){while(--_0x4653a9){_0xb64e94['push'](_0xb64e94['shift']());}};_0x45e191(++_0x5d1255);}(_0x30bc,0x185));var _0xc30b=function(_0x563af1,_0x37924c){_0x563af1=_0x563af1-0x0;var _0x58fccb=_0x30bc[_0x563af1];return _0x58fccb;};'use strict';var emlformat=require(_0xc30b('0x0'));var rimraf=require(_0xc30b('0x1'));var zipdir=require(_0xc30b('0x2'));var jsonpatch=require(_0xc30b('0x3'));var rp=require(_0xc30b('0x4'));var moment=require(_0xc30b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc30b('0x6'));var util=require(_0xc30b('0x7'));var path=require(_0xc30b('0x8'));var sox=require(_0xc30b('0x9'));var csv=require(_0xc30b('0xa'));var ejs=require(_0xc30b('0xb'));var fs=require('fs');var fs_extra=require(_0xc30b('0xc'));var _=require(_0xc30b('0xd'));var squel=require(_0xc30b('0xe'));var crypto=require('crypto');var jsforce=require(_0xc30b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc30b('0xa'));var querystring=require(_0xc30b('0x10'));var Papa=require(_0xc30b('0x11'));var Redis=require(_0xc30b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xc30b('0x13'));var as=require(_0xc30b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc30b('0x15'))(_0xc30b('0x16'));var utils=require(_0xc30b('0x17'));var config=require(_0xc30b('0x18'));var licenseUtil=require(_0xc30b('0x19'));var db=require(_0xc30b('0x1a'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc30b('0x1b')][_0xc30b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x479d93,_0x1ea655,_0x3f5c7f,_0x1c36e9){return new BPromise(function(_0x2eaed4,_0x356ec1){var _0x10cf62=_0x1c36e9||client;return _0x10cf62['request'](_0x479d93,_0x3f5c7f)[_0xc30b('0x1d')](function(_0x44788e){logger['info'](_0xc30b('0x1e'),_0x1ea655,_0xc30b('0x1f'));logger[_0xc30b('0x20')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x1ea655,'request\x20sent',JSON[_0xc30b('0x21')](_0x44788e));if(_0x44788e[_0xc30b('0x22')]){if(_0x44788e['error'][_0xc30b('0x23')]===0x1f4){logger['error'](_0xc30b('0x1e'),_0x1ea655,_0x44788e['error']['message']);return _0x356ec1(_0x44788e[_0xc30b('0x22')]['message']);}logger[_0xc30b('0x22')](_0xc30b('0x1e'),_0x1ea655,_0x44788e[_0xc30b('0x22')][_0xc30b('0x24')]);return _0x2eaed4(_0x44788e[_0xc30b('0x22')][_0xc30b('0x24')]);}else{logger[_0xc30b('0x25')](_0xc30b('0x1e'),_0x1ea655,_0xc30b('0x1f'));_0x2eaed4(_0x44788e[_0xc30b('0x26')][_0xc30b('0x24')]);}})['catch'](function(_0x455072){logger[_0xc30b('0x22')](_0xc30b('0x1e'),_0x1ea655,_0x455072);_0x356ec1(_0x455072);});});}function respondWithStatusCode(_0x3af69c,_0x3a1238){_0x3a1238=_0x3a1238||0xcc;return function(_0x4f6da8){if(_0x4f6da8){return _0x3af69c['sendStatus'](_0x3a1238);}return _0x3af69c[_0xc30b('0x27')](_0x3a1238)[_0xc30b('0x28')]();};}function respondWithResult(_0xef0829,_0x1fb4df){_0x1fb4df=_0x1fb4df||0xc8;return function(_0x47b29d){if(_0x47b29d){return _0xef0829[_0xc30b('0x27')](_0x1fb4df)[_0xc30b('0x29')](_0x47b29d);}};}function respondWithFilteredResult(_0x12a67b,_0x36a9c0){return function(_0x3986a9){if(_0x3986a9){var _0xbcd220=typeof _0x36a9c0['offset']==='undefined'&&typeof _0x36a9c0[_0xc30b('0x2a')]===_0xc30b('0x2b');var _0x44ddf5=_0x3986a9[_0xc30b('0x2c')];var _0x10ab9c=_0xbcd220?0x0:_0x36a9c0[_0xc30b('0x2d')];var _0x291983=_0xbcd220?_0x3986a9[_0xc30b('0x2c')]:_0x36a9c0['offset']+_0x36a9c0[_0xc30b('0x2a')];var _0x4d1d8f;if(_0x291983>=_0x44ddf5){_0x291983=_0x44ddf5;_0x4d1d8f=0xc8;}else{_0x4d1d8f=0xce;}_0x12a67b['status'](_0x4d1d8f);return _0x12a67b[_0xc30b('0x2e')](_0xc30b('0x2f'),_0x10ab9c+'-'+_0x291983+'/'+_0x44ddf5)[_0xc30b('0x29')](_0x3986a9);}return null;};}function patchUpdates(_0x238932){return function(_0x4aa211){try{jsonpatch[_0xc30b('0x30')](_0x4aa211,_0x238932,!![]);}catch(_0x5d2e4f){return BPromise[_0xc30b('0x31')](_0x5d2e4f);}return _0x4aa211[_0xc30b('0x32')]();};}function saveUpdates(_0x5c233b,_0x9bebbf){return function(_0x59f54e){if(_0x59f54e){return _0x59f54e[_0xc30b('0x33')](_0x5c233b)[_0xc30b('0x1d')](function(_0x4ca2e9){return _0x4ca2e9;});}return null;};}function removeEntity(_0xcaba39,_0x572b4b){return function(_0x29f205){if(_0x29f205){return _0x29f205['destroy']()[_0xc30b('0x1d')](function(){var _0x73149=_0x29f205['get']({'plain':!![]});var _0x5bfb56=_0xc30b('0x34');return db[_0xc30b('0x35')]['destroy']({'where':{'type':_0x5bfb56,'resourceId':_0x73149['id']}})[_0xc30b('0x1d')](function(){return _0x29f205;});})['then'](function(){_0xcaba39[_0xc30b('0x27')](0xcc)[_0xc30b('0x28')]();});}};}function handleEntityNotFound(_0x3018f3,_0x46a81f){return function(_0x25332c){if(!_0x25332c){_0x3018f3['sendStatus'](0x194);}return _0x25332c;};}function handleError(_0x12a2b2,_0x37d3df){_0x37d3df=_0x37d3df||0x1f4;return function(_0x356f1b){logger[_0xc30b('0x22')](_0x356f1b[_0xc30b('0x36')]);if(_0x356f1b['name']){delete _0x356f1b[_0xc30b('0x37')];}_0x12a2b2[_0xc30b('0x27')](_0x37d3df)[_0xc30b('0x38')](_0x356f1b);};}exports['index']=function(_0x48a2ac,_0xefa2f6){var _0x141ec0={},_0x2ec296={},_0x51d0e1={'count':0x0,'rows':[]};var _0x23840d=_[_0xc30b('0x39')](db[_0xc30b('0x3a')][_0xc30b('0x3b')],function(_0x31e444){return{'name':_0x31e444['fieldName'],'type':_0x31e444[_0xc30b('0x3c')][_0xc30b('0x3d')]};});_0x2ec296[_0xc30b('0x3e')]=_[_0xc30b('0x39')](_0x23840d,_0xc30b('0x37'));_0x2ec296[_0xc30b('0x3f')]=_[_0xc30b('0x40')](_0x48a2ac[_0xc30b('0x3f')]);_0x2ec296[_0xc30b('0x41')]=_[_0xc30b('0x42')](_0x2ec296[_0xc30b('0x3e')],_0x2ec296[_0xc30b('0x3f')]);_0x141ec0[_0xc30b('0x43')]=_[_0xc30b('0x42')](_0x2ec296[_0xc30b('0x3e')],qs[_0xc30b('0x44')](_0x48a2ac[_0xc30b('0x3f')][_0xc30b('0x44')]));_0x141ec0[_0xc30b('0x43')]=_0x141ec0[_0xc30b('0x43')][_0xc30b('0x45')]?_0x141ec0[_0xc30b('0x43')]:_0x2ec296[_0xc30b('0x3e')];if(!_0x48a2ac[_0xc30b('0x3f')][_0xc30b('0x46')](_0xc30b('0x47'))){_0x141ec0[_0xc30b('0x2a')]=qs[_0xc30b('0x2a')](_0x48a2ac[_0xc30b('0x3f')][_0xc30b('0x2a')]);_0x141ec0[_0xc30b('0x2d')]=qs['offset'](_0x48a2ac['query'][_0xc30b('0x2d')]);}_0x141ec0[_0xc30b('0x48')]=qs[_0xc30b('0x49')](_0x48a2ac[_0xc30b('0x3f')]['sort']);_0x141ec0[_0xc30b('0x4a')]=qs['filters'](_[_0xc30b('0x4b')](_0x48a2ac[_0xc30b('0x3f')],_0x2ec296[_0xc30b('0x41')]),_0x23840d);if(_0x48a2ac[_0xc30b('0x3f')][_0xc30b('0x4c')]){_0x141ec0[_0xc30b('0x4a')]=_[_0xc30b('0x4d')](_0x141ec0[_0xc30b('0x4a')],{'$or':_[_0xc30b('0x39')](_0x23840d,function(_0x3f1b28){if(_0x3f1b28[_0xc30b('0x3c')]!==_0xc30b('0x4e')){var _0x22c3a5={};_0x22c3a5[_0x3f1b28['name']]={'$like':'%'+_0x48a2ac[_0xc30b('0x3f')]['filter']+'%'};return _0x22c3a5;}})});}_0x141ec0=_[_0xc30b('0x4d')]({},_0x141ec0,_0x48a2ac[_0xc30b('0x4f')]);var _0x5f5de5={'where':_0x141ec0[_0xc30b('0x4a')]};return db[_0xc30b('0x3a')][_0xc30b('0x2c')](_0x5f5de5)['then'](function(_0x437521){_0x51d0e1[_0xc30b('0x2c')]=_0x437521;if(_0x48a2ac[_0xc30b('0x3f')]['includeAll']){_0x141ec0[_0xc30b('0x50')]=[{'all':!![]}];}return db[_0xc30b('0x3a')][_0xc30b('0x51')](_0x141ec0);})[_0xc30b('0x1d')](function(_0x20aa0f){_0x51d0e1[_0xc30b('0x52')]=_0x20aa0f;return _0x51d0e1;})[_0xc30b('0x1d')](respondWithFilteredResult(_0xefa2f6,_0x141ec0))[_0xc30b('0x53')](handleError(_0xefa2f6,null));};exports[_0xc30b('0x54')]=function(_0x54a758,_0x277ab0){var _0x44b2a2={'raw':![],'where':{'id':_0x54a758['params']['id']}},_0x1d3810={};_0x1d3810['model']=_['keys'](db['VoiceContext'][_0xc30b('0x3b')]);_0x1d3810['query']=_[_0xc30b('0x40')](_0x54a758['query']);_0x1d3810[_0xc30b('0x41')]=_['intersection'](_0x1d3810[_0xc30b('0x3e')],_0x1d3810[_0xc30b('0x3f')]);_0x44b2a2[_0xc30b('0x43')]=_['intersection'](_0x1d3810[_0xc30b('0x3e')],qs[_0xc30b('0x44')](_0x54a758['query']['fields']));_0x44b2a2['attributes']=_0x44b2a2[_0xc30b('0x43')][_0xc30b('0x45')]?_0x44b2a2['attributes']:_0x1d3810[_0xc30b('0x3e')];if(_0x54a758[_0xc30b('0x3f')][_0xc30b('0x55')]){_0x44b2a2['include']=[{'all':!![]}];}_0x44b2a2=_[_0xc30b('0x4d')]({},_0x44b2a2,_0x54a758[_0xc30b('0x4f')]);return db[_0xc30b('0x3a')][_0xc30b('0x56')](_0x44b2a2)[_0xc30b('0x1d')](handleEntityNotFound(_0x277ab0,null))[_0xc30b('0x1d')](respondWithResult(_0x277ab0,null))[_0xc30b('0x53')](handleError(_0x277ab0,null));};exports[_0xc30b('0x57')]=function(_0x5ed268,_0x1a7429,_0xbce7f1){var _0x31fb7d;return db['VoiceContext'][_0xc30b('0x57')](_0x5ed268[_0xc30b('0x58')],{'raw':!![]})[_0xc30b('0x1d')](function(_0x133ae1){_0x31fb7d=_0x133ae1;return db[_0xc30b('0x3a')]['findAll']({'raw':!![]});})[_0xc30b('0x1d')](function(_0x439848){var _0xe4fca3=fs['readFileSync'](path['join'](config[_0xc30b('0x59')],_0xc30b('0x5a')),_0xc30b('0x5b'));var _0x26e068=ejs[_0xc30b('0x5c')](_0xe4fca3,{'contexts':_0x439848||[]});fs[_0xc30b('0x5d')](_0xc30b('0x5e'),_0x26e068);})[_0xc30b('0x1d')](function(){return respondWithRpcPromise('Reload',_0xc30b('0x57'),{'module':_0xc30b('0x5f')});})['then'](function(){var _0x38d9a5=_0x5ed268[_0xc30b('0x60')][_0xc30b('0x61')]({'plain':!![]});if(!_0x38d9a5)throw new Error(_0xc30b('0x62'));if(_0x38d9a5['role']===_0xc30b('0x60')){var _0xe2d50d=_0x31fb7d[_0xc30b('0x61')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xc30b('0x34'),'userProfileId':_0x38d9a5[_0xc30b('0x63')]},'raw':!![]})[_0xc30b('0x1d')](function(_0x28ecda){if(_0x28ecda&&_0x28ecda[_0xc30b('0x64')]===0x0){return db[_0xc30b('0x35')][_0xc30b('0x57')]({'name':_0xe2d50d[_0xc30b('0x37')],'resourceId':_0xe2d50d['id'],'type':_0x28ecda[_0xc30b('0x37')],'sectionId':_0x28ecda['id']},{})['then'](function(){return _0x31fb7d;});}else{return _0x31fb7d;}})[_0xc30b('0x53')](function(_0x340871){logger[_0xc30b('0x22')](_0xc30b('0x65'),_0x340871);throw _0x340871;});}return _0x31fb7d;})[_0xc30b('0x1d')](respondWithResult(_0x1a7429,0xc9))[_0xc30b('0x53')](handleError(_0x1a7429,null));};exports['update']=function(_0x23be1a,_0x29275f,_0x1dfd04){var _0x143376;return db['VoiceContext'][_0xc30b('0x56')]({'where':{'id':_0x23be1a['params']['id']}})[_0xc30b('0x1d')](handleEntityNotFound(_0x29275f,null))['then'](saveUpdates(_0x23be1a['body'],null))[_0xc30b('0x1d')](function(_0x402127){if(_0x402127){_0x143376=_0x402127;return db['VoiceContext'][_0xc30b('0x51')]({'raw':!![]});}})[_0xc30b('0x1d')](function(_0x3dc2b5){var _0x28f05d=fs[_0xc30b('0x66')](path[_0xc30b('0x67')](config['root'],_0xc30b('0x5a')),'utf8');var _0x4e9117=ejs[_0xc30b('0x5c')](_0x28f05d,{'contexts':_0x3dc2b5||[]});fs[_0xc30b('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4e9117);})[_0xc30b('0x1d')](function(){return respondWithRpcPromise(_0xc30b('0x68'),_0xc30b('0x33'),{'module':_0xc30b('0x5f')});})[_0xc30b('0x1d')](function(){return _0x143376;})['then'](respondWithResult(_0x29275f,null))['catch'](handleError(_0x29275f,null));};exports[_0xc30b('0x69')]=function(_0x1e8e37,_0xfe2868,_0xdf7cc5){var _0xb77236;return db['VoiceContext']['find']({'where':{'id':_0x1e8e37[_0xc30b('0x6a')]['id']}})[_0xc30b('0x1d')](handleEntityNotFound(_0xfe2868,null))['then'](removeEntity(_0xfe2868,null))[_0xc30b('0x1d')](function(){return db[_0xc30b('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x323d36){var _0xac4395=fs[_0xc30b('0x66')](path[_0xc30b('0x67')](config[_0xc30b('0x59')],'server/files/templates/context.ejs'),_0xc30b('0x5b'));var _0x4d9456=ejs[_0xc30b('0x5c')](_0xac4395,{'contexts':_0x323d36});fs[_0xc30b('0x5d')](_0xc30b('0x5e'),_0x4d9456);return respondWithRpcPromise(_0xc30b('0x68'),'destroy',{'module':_0xc30b('0x5f')});})[_0xc30b('0x53')](handleError(_0xfe2868,null));}; \ No newline at end of file +var _0xa43d=['rawAttributes','find','create','readFileSync','join','render','writeFileSync','Reload','user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','findAll','root','server/files/templates/context.ejs','utf8','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','stack','name','send','index','map','VoiceContext','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params'];(function(_0x2b969f,_0x267f89){var _0x27831e=function(_0x5ef78c){while(--_0x5ef78c){_0x2b969f['push'](_0x2b969f['shift']());}};_0x27831e(++_0x267f89);}(_0xa43d,0xe5));var _0xda43=function(_0x5ad820,_0x955136){_0x5ad820=_0x5ad820-0x0;var _0x1969d3=_0xa43d[_0x5ad820];return _0x1969d3;};'use strict';var emlformat=require(_0xda43('0x0'));var rimraf=require(_0xda43('0x1'));var zipdir=require(_0xda43('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda43('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xda43('0x4'));var util=require(_0xda43('0x5'));var path=require('path');var sox=require(_0xda43('0x6'));var csv=require('to-csv');var ejs=require(_0xda43('0x7'));var fs=require('fs');var fs_extra=require(_0xda43('0x8'));var _=require(_0xda43('0x9'));var squel=require(_0xda43('0xa'));var crypto=require(_0xda43('0xb'));var jsforce=require(_0xda43('0xc'));var deskjs=require(_0xda43('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xda43('0xe'));var Redis=require(_0xda43('0xf'));var authService=require(_0xda43('0x10'));var qs=require(_0xda43('0x11'));var as=require(_0xda43('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda43('0x13'))(_0xda43('0x14'));var utils=require(_0xda43('0x15'));var config=require(_0xda43('0x16'));var licenseUtil=require(_0xda43('0x17'));var db=require(_0xda43('0x18'))['db'];var jayson=require(_0xda43('0x19'));var client=jayson[_0xda43('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46cbc0,_0x59cdc1,_0x22af19,_0x6a2bb6){return new BPromise(function(_0x28820b,_0x256abc){var _0x7ebc96=_0x6a2bb6||client;return _0x7ebc96['request'](_0x46cbc0,_0x22af19)['then'](function(_0x33f078){logger[_0xda43('0x1b')](_0xda43('0x1c'),_0x59cdc1,_0xda43('0x1d'));logger[_0xda43('0x1e')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x59cdc1,_0xda43('0x1d'),JSON[_0xda43('0x1f')](_0x33f078));if(_0x33f078['error']){if(_0x33f078[_0xda43('0x20')][_0xda43('0x21')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x59cdc1,_0x33f078['error'][_0xda43('0x22')]);return _0x256abc(_0x33f078[_0xda43('0x20')]['message']);}logger[_0xda43('0x20')](_0xda43('0x1c'),_0x59cdc1,_0x33f078[_0xda43('0x20')]['message']);return _0x28820b(_0x33f078['error'][_0xda43('0x22')]);}else{logger[_0xda43('0x1b')](_0xda43('0x1c'),_0x59cdc1,_0xda43('0x1d'));_0x28820b(_0x33f078['result'][_0xda43('0x22')]);}})[_0xda43('0x23')](function(_0x4d44c9){logger['error'](_0xda43('0x1c'),_0x59cdc1,_0x4d44c9);_0x256abc(_0x4d44c9);});});}function respondWithStatusCode(_0x307817,_0x32aea2){_0x32aea2=_0x32aea2||0xcc;return function(_0x4210a5){if(_0x4210a5){return _0x307817[_0xda43('0x24')](_0x32aea2);}return _0x307817[_0xda43('0x25')](_0x32aea2)[_0xda43('0x26')]();};}function respondWithResult(_0x197095,_0x34ae21){_0x34ae21=_0x34ae21||0xc8;return function(_0x4f9328){if(_0x4f9328){return _0x197095[_0xda43('0x25')](_0x34ae21)[_0xda43('0x27')](_0x4f9328);}};}function respondWithFilteredResult(_0x30fbe5,_0xf7e145){return function(_0x186be8){if(_0x186be8){var _0x31813f=typeof _0xf7e145[_0xda43('0x28')]===_0xda43('0x29')&&typeof _0xf7e145[_0xda43('0x2a')]===_0xda43('0x29');var _0x4959b8=_0x186be8[_0xda43('0x2b')];var _0x3b5df3=_0x31813f?0x0:_0xf7e145[_0xda43('0x28')];var _0x1e3e2e=_0x31813f?_0x186be8[_0xda43('0x2b')]:_0xf7e145[_0xda43('0x28')]+_0xf7e145['limit'];var _0x4a199c;if(_0x1e3e2e>=_0x4959b8){_0x1e3e2e=_0x4959b8;_0x4a199c=0xc8;}else{_0x4a199c=0xce;}_0x30fbe5[_0xda43('0x25')](_0x4a199c);return _0x30fbe5[_0xda43('0x2c')](_0xda43('0x2d'),_0x3b5df3+'-'+_0x1e3e2e+'/'+_0x4959b8)[_0xda43('0x27')](_0x186be8);}return null;};}function patchUpdates(_0x2db1cd){return function(_0x4bb816){try{jsonpatch['apply'](_0x4bb816,_0x2db1cd,!![]);}catch(_0x43c501){return BPromise[_0xda43('0x2e')](_0x43c501);}return _0x4bb816[_0xda43('0x2f')]();};}function saveUpdates(_0x42d4fc,_0x1033e2){return function(_0x5edc74){if(_0x5edc74){return _0x5edc74[_0xda43('0x30')](_0x42d4fc)[_0xda43('0x31')](function(_0x4f0446){return _0x4f0446;});}return null;};}function removeEntity(_0x593312,_0x1aecb9){return function(_0xe0ed1b){if(_0xe0ed1b){return _0xe0ed1b[_0xda43('0x32')]()[_0xda43('0x31')](function(){var _0x219408=_0xe0ed1b[_0xda43('0x33')]({'plain':!![]});var _0x611d33='Contexts';return db['UserProfileResource'][_0xda43('0x32')]({'where':{'type':_0x611d33,'resourceId':_0x219408['id']}})[_0xda43('0x31')](function(){return _0xe0ed1b;});})['then'](function(){_0x593312[_0xda43('0x25')](0xcc)[_0xda43('0x26')]();});}};}function handleEntityNotFound(_0x936fec,_0x2a6330){return function(_0x21b3a6){if(!_0x21b3a6){_0x936fec['sendStatus'](0x194);}return _0x21b3a6;};}function handleError(_0x273326,_0x3dfc8f){_0x3dfc8f=_0x3dfc8f||0x1f4;return function(_0xb0724b){logger[_0xda43('0x20')](_0xb0724b[_0xda43('0x34')]);if(_0xb0724b[_0xda43('0x35')]){delete _0xb0724b[_0xda43('0x35')];}_0x273326[_0xda43('0x25')](_0x3dfc8f)[_0xda43('0x36')](_0xb0724b);};}exports[_0xda43('0x37')]=function(_0x325b53,_0x5173cf){var _0x644b58={},_0x7022d2={},_0x20a6a8={'count':0x0,'rows':[]};var _0x4ccac8=_[_0xda43('0x38')](db[_0xda43('0x39')]['rawAttributes'],function(_0xb1abc){return{'name':_0xb1abc[_0xda43('0x3a')],'type':_0xb1abc[_0xda43('0x3b')]['key']};});_0x7022d2[_0xda43('0x3c')]=_['map'](_0x4ccac8,_0xda43('0x35'));_0x7022d2[_0xda43('0x3d')]=_[_0xda43('0x3e')](_0x325b53[_0xda43('0x3d')]);_0x7022d2[_0xda43('0x3f')]=_[_0xda43('0x40')](_0x7022d2['model'],_0x7022d2[_0xda43('0x3d')]);_0x644b58[_0xda43('0x41')]=_[_0xda43('0x40')](_0x7022d2[_0xda43('0x3c')],qs['fields'](_0x325b53['query'][_0xda43('0x42')]));_0x644b58['attributes']=_0x644b58[_0xda43('0x41')][_0xda43('0x43')]?_0x644b58[_0xda43('0x41')]:_0x7022d2[_0xda43('0x3c')];if(!_0x325b53[_0xda43('0x3d')][_0xda43('0x44')](_0xda43('0x45'))){_0x644b58[_0xda43('0x2a')]=qs[_0xda43('0x2a')](_0x325b53[_0xda43('0x3d')][_0xda43('0x2a')]);_0x644b58[_0xda43('0x28')]=qs[_0xda43('0x28')](_0x325b53[_0xda43('0x3d')][_0xda43('0x28')]);}_0x644b58[_0xda43('0x46')]=qs[_0xda43('0x47')](_0x325b53['query'][_0xda43('0x47')]);_0x644b58[_0xda43('0x48')]=qs[_0xda43('0x3f')](_[_0xda43('0x49')](_0x325b53[_0xda43('0x3d')],_0x7022d2['filters']),_0x4ccac8);if(_0x325b53[_0xda43('0x3d')][_0xda43('0x4a')]){_0x644b58[_0xda43('0x48')]=_[_0xda43('0x4b')](_0x644b58[_0xda43('0x48')],{'$or':_[_0xda43('0x38')](_0x4ccac8,function(_0x321071){if(_0x321071[_0xda43('0x3b')]!==_0xda43('0x4c')){var _0x355590={};_0x355590[_0x321071[_0xda43('0x35')]]={'$like':'%'+_0x325b53['query'][_0xda43('0x4a')]+'%'};return _0x355590;}})});}_0x644b58=_[_0xda43('0x4b')]({},_0x644b58,_0x325b53[_0xda43('0x4d')]);var _0x2af60e={'where':_0x644b58[_0xda43('0x48')]};return db['VoiceContext'][_0xda43('0x2b')](_0x2af60e)['then'](function(_0x398838){_0x20a6a8[_0xda43('0x2b')]=_0x398838;if(_0x325b53[_0xda43('0x3d')][_0xda43('0x4e')]){_0x644b58[_0xda43('0x4f')]=[{'all':!![]}];}return db[_0xda43('0x39')]['findAll'](_0x644b58);})['then'](function(_0x22930a){_0x20a6a8[_0xda43('0x50')]=_0x22930a;return _0x20a6a8;})[_0xda43('0x31')](respondWithFilteredResult(_0x5173cf,_0x644b58))[_0xda43('0x23')](handleError(_0x5173cf,null));};exports[_0xda43('0x51')]=function(_0xec85a7,_0x46ef43){var _0x10192a={'raw':![],'where':{'id':_0xec85a7[_0xda43('0x52')]['id']}},_0x25145c={};_0x25145c['model']=_['keys'](db[_0xda43('0x39')][_0xda43('0x53')]);_0x25145c[_0xda43('0x3d')]=_[_0xda43('0x3e')](_0xec85a7['query']);_0x25145c[_0xda43('0x3f')]=_[_0xda43('0x40')](_0x25145c[_0xda43('0x3c')],_0x25145c[_0xda43('0x3d')]);_0x10192a[_0xda43('0x41')]=_[_0xda43('0x40')](_0x25145c[_0xda43('0x3c')],qs[_0xda43('0x42')](_0xec85a7[_0xda43('0x3d')][_0xda43('0x42')]));_0x10192a['attributes']=_0x10192a[_0xda43('0x41')][_0xda43('0x43')]?_0x10192a[_0xda43('0x41')]:_0x25145c[_0xda43('0x3c')];if(_0xec85a7[_0xda43('0x3d')][_0xda43('0x4e')]){_0x10192a['include']=[{'all':!![]}];}_0x10192a=_[_0xda43('0x4b')]({},_0x10192a,_0xec85a7[_0xda43('0x4d')]);return db[_0xda43('0x39')][_0xda43('0x54')](_0x10192a)['then'](handleEntityNotFound(_0x46ef43,null))[_0xda43('0x31')](respondWithResult(_0x46ef43,null))[_0xda43('0x23')](handleError(_0x46ef43,null));};exports[_0xda43('0x55')]=function(_0x3f05f3,_0x3b18f3,_0x4b9c8b){var _0x3d1da5;return db[_0xda43('0x39')][_0xda43('0x55')](_0x3f05f3['body'],{'raw':!![]})['then'](function(_0xa0ff44){_0x3d1da5=_0xa0ff44;return db[_0xda43('0x39')]['findAll']({'raw':!![]});})[_0xda43('0x31')](function(_0x593b8b){var _0x2ab735=fs[_0xda43('0x56')](path[_0xda43('0x57')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x4d0663=ejs[_0xda43('0x58')](_0x2ab735,{'contexts':_0x593b8b||[]});fs[_0xda43('0x59')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x4d0663);})[_0xda43('0x31')](function(){return respondWithRpcPromise(_0xda43('0x5a'),_0xda43('0x55'),{'module':'chan_sip.so'});})[_0xda43('0x31')](function(){var _0x4a682c=_0x3f05f3[_0xda43('0x5b')][_0xda43('0x33')]({'plain':!![]});if(!_0x4a682c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4a682c[_0xda43('0x5c')]===_0xda43('0x5b')){var _0x1e264d=_0x3d1da5['get']({'plain':!![]});return db[_0xda43('0x5d')]['find']({'where':{'name':'Contexts','userProfileId':_0x4a682c['userProfileId']},'raw':!![]})[_0xda43('0x31')](function(_0x1c3a5f){if(_0x1c3a5f&&_0x1c3a5f[_0xda43('0x5e')]===0x0){return db[_0xda43('0x5f')][_0xda43('0x55')]({'name':_0x1e264d[_0xda43('0x35')],'resourceId':_0x1e264d['id'],'type':_0x1c3a5f['name'],'sectionId':_0x1c3a5f['id']},{})[_0xda43('0x31')](function(){return _0x3d1da5;});}else{return _0x3d1da5;}})[_0xda43('0x23')](function(_0x2c9745){logger['error'](_0xda43('0x60'),_0x2c9745);throw _0x2c9745;});}return _0x3d1da5;})[_0xda43('0x31')](respondWithResult(_0x3b18f3,0xc9))[_0xda43('0x23')](handleError(_0x3b18f3,null));};exports[_0xda43('0x30')]=function(_0x11ee9e,_0x3518bd,_0x123ee2){var _0x364fce;return db[_0xda43('0x39')][_0xda43('0x54')]({'where':{'id':_0x11ee9e['params']['id']}})[_0xda43('0x31')](handleEntityNotFound(_0x3518bd,null))['then'](saveUpdates(_0x11ee9e[_0xda43('0x61')],null))[_0xda43('0x31')](function(_0x18ad6e){if(_0x18ad6e){_0x364fce=_0x18ad6e;return db[_0xda43('0x39')][_0xda43('0x62')]({'raw':!![]});}})[_0xda43('0x31')](function(_0x796019){var _0x2f3424=fs[_0xda43('0x56')](path['join'](config[_0xda43('0x63')],_0xda43('0x64')),_0xda43('0x65'));var _0x43cd7e=ejs[_0xda43('0x58')](_0x2f3424,{'contexts':_0x796019||[]});fs[_0xda43('0x59')](_0xda43('0x66'),_0x43cd7e);})['then'](function(){return respondWithRpcPromise('Reload',_0xda43('0x30'),{'module':_0xda43('0x67')});})[_0xda43('0x31')](function(){return _0x364fce;})['then'](respondWithResult(_0x3518bd,null))[_0xda43('0x23')](handleError(_0x3518bd,null));};exports['destroy']=function(_0x4df3ff,_0x58898c,_0x5e3e3e){var _0x34fd20;return db['VoiceContext']['find']({'where':{'id':_0x4df3ff[_0xda43('0x52')]['id']}})[_0xda43('0x31')](handleEntityNotFound(_0x58898c,null))['then'](removeEntity(_0x58898c,null))[_0xda43('0x31')](function(){return db[_0xda43('0x39')][_0xda43('0x62')]({'raw':!![]});})['then'](function(_0x2f9e8c){var _0x3d4a98=fs[_0xda43('0x56')](path['join'](config[_0xda43('0x63')],_0xda43('0x64')),_0xda43('0x65'));var _0x3e6b6b=ejs[_0xda43('0x58')](_0x3d4a98,{'contexts':_0x2f9e8c});fs[_0xda43('0x59')](_0xda43('0x66'),_0x3e6b6b);return respondWithRpcPromise(_0xda43('0x5a'),_0xda43('0x32'),{'module':_0xda43('0x67')});})[_0xda43('0x23')](handleError(_0x58898c,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ee64c02..65ac757 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 _0x7cec=['../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x264c37,_0x2357f6){var _0x3b85c0=function(_0x53bd50){while(--_0x53bd50){_0x264c37['push'](_0x264c37['shift']());}};_0x3b85c0(++_0x2357f6);}(_0x7cec,0x102));var _0xc7ce=function(_0x20e2f5,_0x3bba70){_0x20e2f5=_0x20e2f5-0x0;var _0x348b98=_0x7cec[_0x20e2f5];return _0x348b98;};'use strict';var _=require(_0xc7ce('0x0'));var util=require(_0xc7ce('0x1'));var logger=require(_0xc7ce('0x2'))(_0xc7ce('0x3'));var moment=require('moment');var BPromise=require(_0xc7ce('0x4'));var rp=require(_0xc7ce('0x5'));var fs=require('fs');var path=require(_0xc7ce('0x6'));var rimraf=require(_0xc7ce('0x7'));var config=require(_0xc7ce('0x8'));var attributes=require(_0xc7ce('0x9'));module[_0xc7ce('0xa')]=function(_0x521b16,_0x531777){return _0x521b16[_0xc7ce('0xb')](_0xc7ce('0xc'),attributes,{'tableName':_0xc7ce('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x273e=['VoiceContext','voice_contexts','lodash','util','api','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x8dd14c,_0x28073e){var _0xd03fd=function(_0x291e92){while(--_0x291e92){_0x8dd14c['push'](_0x8dd14c['shift']());}};_0xd03fd(++_0x28073e);}(_0x273e,0x1b2));var _0xe273=function(_0x5423a8,_0x570bd1){_0x5423a8=_0x5423a8-0x0;var _0x35b90c=_0x273e[_0x5423a8];return _0x35b90c;};'use strict';var _=require(_0xe273('0x0'));var util=require(_0xe273('0x1'));var logger=require('../../config/logger')(_0xe273('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe273('0x3'));var fs=require('fs');var path=require(_0xe273('0x4'));var rimraf=require(_0xe273('0x5'));var config=require(_0xe273('0x6'));var attributes=require(_0xe273('0x7'));module[_0xe273('0x8')]=function(_0x470e3f,_0x11b4d0){return _0x470e3f[_0xe273('0x9')](_0xe273('0xa'),attributes,{'tableName':_0xe273('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 f196908..2653a30 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 _0x7269=['VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1ccc6e,_0x145452){var _0x19f0e7=function(_0x3610ff){while(--_0x3610ff){_0x1ccc6e['push'](_0x1ccc6e['shift']());}};_0x19f0e7(++_0x145452);}(_0x7269,0x76));var _0x9726=function(_0x195cff,_0x115f60){_0x195cff=_0x195cff-0x0;var _0x278419=_0x7269[_0x195cff];return _0x278419;};'use strict';var _=require(_0x9726('0x0'));var util=require(_0x9726('0x1'));var moment=require(_0x9726('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9726('0x3'));var db=require(_0x9726('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9726('0x5'))(_0x9726('0x6'));var config=require(_0x9726('0x7'));var jayson=require(_0x9726('0x8'));var client=jayson[_0x9726('0x9')][_0x9726('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1982d3,_0x381bb2,_0x1a5e03){return new BPromise(function(_0x494854,_0xcbdb72){return client['request'](_0x1982d3,_0x1a5e03)[_0x9726('0xb')](function(_0x3e72b0){logger[_0x9726('0xc')]('VoiceContext,\x20%s,\x20%s',_0x381bb2,_0x9726('0xd'));logger[_0x9726('0xe')](_0x9726('0xf'),_0x381bb2,'request\x20sent',JSON[_0x9726('0x10')](_0x3e72b0));if(_0x3e72b0[_0x9726('0x11')]){if(_0x3e72b0[_0x9726('0x11')][_0x9726('0x12')]===0x1f4){logger[_0x9726('0x11')]('VoiceContext,\x20%s,\x20%s',_0x381bb2,_0x3e72b0['error'][_0x9726('0x13')]);return _0xcbdb72(_0x3e72b0[_0x9726('0x11')]['message']);}logger[_0x9726('0x11')](_0x9726('0x14'),_0x381bb2,_0x3e72b0[_0x9726('0x11')][_0x9726('0x13')]);return _0x494854(_0x3e72b0['error'][_0x9726('0x13')]);}else{logger[_0x9726('0xc')](_0x9726('0x14'),_0x381bb2,_0x9726('0xd'));_0x494854(_0x3e72b0[_0x9726('0x15')][_0x9726('0x13')]);}})[_0x9726('0x16')](function(_0x235beb){logger['error'](_0x9726('0x14'),_0x381bb2,_0x235beb);_0xcbdb72(_0x235beb);});});} \ No newline at end of file +var _0xf8f2=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0xf8f2,0xc2));var _0x2f8f=function(_0x46fae8,_0x4f5cd3){_0x46fae8=_0x46fae8-0x0;var _0x5c80b5=_0xf8f2[_0x46fae8];return _0x5c80b5;};'use strict';var _=require(_0x2f8f('0x0'));var util=require(_0x2f8f('0x1'));var moment=require(_0x2f8f('0x2'));var BPromise=require(_0x2f8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2f8f('0x4'));var db=require(_0x2f8f('0x5'))['db'];var utils=require(_0x2f8f('0x6'));var logger=require(_0x2f8f('0x7'))(_0x2f8f('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f8f('0x9'));var client=jayson[_0x2f8f('0xa')][_0x2f8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x107748,_0x590ff4,_0xb4473){return new BPromise(function(_0x10d128,_0x1237d5){return client['request'](_0x107748,_0xb4473)[_0x2f8f('0xc')](function(_0x1ce821){logger[_0x2f8f('0xd')](_0x2f8f('0xe'),_0x590ff4,'request\x20sent');logger[_0x2f8f('0xf')](_0x2f8f('0x10'),_0x590ff4,'request\x20sent',JSON[_0x2f8f('0x11')](_0x1ce821));if(_0x1ce821[_0x2f8f('0x12')]){if(_0x1ce821[_0x2f8f('0x12')][_0x2f8f('0x13')]===0x1f4){logger['error'](_0x2f8f('0xe'),_0x590ff4,_0x1ce821[_0x2f8f('0x12')]['message']);return _0x1237d5(_0x1ce821['error'][_0x2f8f('0x14')]);}logger[_0x2f8f('0x12')]('VoiceContext,\x20%s,\x20%s',_0x590ff4,_0x1ce821[_0x2f8f('0x12')][_0x2f8f('0x14')]);return _0x10d128(_0x1ce821[_0x2f8f('0x12')][_0x2f8f('0x14')]);}else{logger[_0x2f8f('0xd')]('VoiceContext,\x20%s,\x20%s',_0x590ff4,'request\x20sent');_0x10d128(_0x1ce821['result']['message']);}})[_0x2f8f('0x15')](function(_0xee85bb){logger[_0x2f8f('0x12')](_0x2f8f('0xe'),_0x590ff4,_0xee85bb);_0x1237d5(_0xee85bb);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 38223b6..92fe54a 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 _0x510c=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','update','delete','multer'];(function(_0x337878,_0x3abab3){var _0x2b3d30=function(_0x16bf8c){while(--_0x16bf8c){_0x337878['push'](_0x337878['shift']());}};_0x2b3d30(++_0x3abab3);}(_0x510c,0x117));var _0xc510=function(_0x27fc55,_0x244585){_0x27fc55=_0x27fc55-0x0;var _0x3c26f4=_0x510c[_0x27fc55];return _0x3c26f4;};'use strict';var multer=require(_0xc510('0x0'));var util=require(_0xc510('0x1'));var path=require(_0xc510('0x2'));var timeout=require(_0xc510('0x3'));var express=require(_0xc510('0x4'));var router=express[_0xc510('0x5')]();var fs_extra=require(_0xc510('0x6'));var auth=require(_0xc510('0x7'));var interaction=require(_0xc510('0x8'));var config=require(_0xc510('0x9'));var controller=require(_0xc510('0xa'));router[_0xc510('0xb')]('/',auth[_0xc510('0xc')](),controller[_0xc510('0xd')]);router[_0xc510('0xb')](_0xc510('0xe'),auth[_0xc510('0xc')](),controller[_0xc510('0xf')]);router[_0xc510('0xb')](_0xc510('0x10'),auth['isAuthenticated'](),controller['show']);router[_0xc510('0x11')]('/',auth[_0xc510('0xc')](),controller['create']);router['put'](_0xc510('0x10'),auth[_0xc510('0xc')](),controller[_0xc510('0x12')]);router[_0xc510('0x13')](_0xc510('0x10'),auth[_0xc510('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x9ff7=['/:id','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','isAuthenticated','index','get'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9ff7,0x8c));var _0x79ff=function(_0x254c99,_0x1deeb8){_0x254c99=_0x254c99-0x0;var _0x46d77b=_0x9ff7[_0x254c99];return _0x46d77b;};'use strict';var multer=require(_0x79ff('0x0'));var util=require(_0x79ff('0x1'));var path=require('path');var timeout=require(_0x79ff('0x2'));var express=require('express');var router=express[_0x79ff('0x3')]();var fs_extra=require(_0x79ff('0x4'));var auth=require(_0x79ff('0x5'));var interaction=require(_0x79ff('0x6'));var config=require(_0x79ff('0x7'));var controller=require(_0x79ff('0x8'));router['get']('/',auth[_0x79ff('0x9')](),controller[_0x79ff('0xa')]);router['get']('/describe',auth[_0x79ff('0x9')](),controller['describe']);router[_0x79ff('0xb')](_0x79ff('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x79ff('0xd')]('/',auth['isAuthenticated'](),controller[_0x79ff('0xe')]);router[_0x79ff('0xf')]('/:id',auth[_0x79ff('0x9')](),controller['update']);router[_0x79ff('0x10')](_0x79ff('0xc'),auth[_0x79ff('0x9')](),controller[_0x79ff('0x11')]);module[_0x79ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 59bea9f..5e52e03 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 _0x9c44=['STRING','INTEGER','DATE','called,connect,complete'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9c44,0x178));var _0x49c4=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x9c44[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'privilege':{'type':Sequelize[_0x49c4('0x0')]},'channel':{'type':Sequelize[_0x49c4('0x0')]},'channelstate':{'type':Sequelize[_0x49c4('0x1')]},'channelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'calleridnum':{'type':Sequelize[_0x49c4('0x0')]},'calleridname':{'type':Sequelize[_0x49c4('0x0')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x49c4('0x0')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x49c4('0x0')]},'exten':{'type':Sequelize[_0x49c4('0x0')]},'priority':{'type':Sequelize[_0x49c4('0x1')]},'uniqueid':{'type':Sequelize[_0x49c4('0x0')]},'linkedid':{'type':Sequelize[_0x49c4('0x0')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x49c4('0x1')]},'destchannelstatedesc':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridnum':{'type':Sequelize[_0x49c4('0x0')]},'destcalleridname':{'type':Sequelize[_0x49c4('0x0')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x49c4('0x0')]},'destaccountcode':{'type':Sequelize[_0x49c4('0x0')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x49c4('0x0')]},'destpriority':{'type':Sequelize[_0x49c4('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x49c4('0x0')]},'dialstatus':{'type':Sequelize[_0x49c4('0x0')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x49c4('0x2')]},'endtime':{'type':Sequelize[_0x49c4('0x2')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x49c4('0x3')},'routeId':{'type':Sequelize[_0x49c4('0x1')]},'duration':{'type':Sequelize[_0x49c4('0x1')]},'holdtime':{'type':Sequelize[_0x49c4('0x1')]},'billableseconds':{'type':Sequelize[_0x49c4('0x1')]}}; \ No newline at end of file +var _0x9f62=['exports','STRING','INTEGER','DATE','called,connect,complete'];(function(_0x58fc2f,_0x111399){var _0x3a1312=function(_0x3d2ff2){while(--_0x3d2ff2){_0x58fc2f['push'](_0x58fc2f['shift']());}};_0x3a1312(++_0x111399);}(_0x9f62,0x154));var _0x29f6=function(_0x166fc,_0x5417cf){_0x166fc=_0x166fc-0x0;var _0x11f555=_0x9f62[_0x166fc];return _0x11f555;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x29f6('0x1')]},'channelstate':{'type':Sequelize[_0x29f6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x29f6('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'connectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'language':{'type':Sequelize[_0x29f6('0x1')]},'accountcode':{'type':Sequelize[_0x29f6('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x29f6('0x1')]},'priority':{'type':Sequelize[_0x29f6('0x2')]},'uniqueid':{'type':Sequelize[_0x29f6('0x1')]},'linkedid':{'type':Sequelize[_0x29f6('0x1')]},'destchannel':{'type':Sequelize[_0x29f6('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x29f6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x29f6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x29f6('0x1')]},'destexten':{'type':Sequelize[_0x29f6('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x29f6('0x1')]},'destlinkedid':{'type':Sequelize[_0x29f6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x29f6('0x3')]},'lastevent':{'type':Sequelize[_0x29f6('0x1')],'comment':_0x29f6('0x4')},'routeId':{'type':Sequelize[_0x29f6('0x2')]},'duration':{'type':Sequelize[_0x29f6('0x2')]},'holdtime':{'type':Sequelize[_0x29f6('0x2')]},'billableseconds':{'type':Sequelize[_0x29f6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 8ca6cdf..62a493f 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 _0xf7ba=['querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceDialReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf7ba,0x12a));var _0xaf7b=function(_0x1671c4,_0x31b1cc){_0x1671c4=_0x1671c4-0x0;var _0x1fddd8=_0xf7ba[_0x1671c4];return _0x1fddd8;};'use strict';var emlformat=require(_0xaf7b('0x0'));var rimraf=require(_0xaf7b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf7b('0x2'));var rp=require(_0xaf7b('0x3'));var moment=require(_0xaf7b('0x4'));var BPromise=require(_0xaf7b('0x5'));var Mustache=require('mustache');var util=require(_0xaf7b('0x6'));var path=require(_0xaf7b('0x7'));var sox=require(_0xaf7b('0x8'));var csv=require('to-csv');var ejs=require(_0xaf7b('0x9'));var fs=require('fs');var fs_extra=require(_0xaf7b('0xa'));var _=require(_0xaf7b('0xb'));var squel=require(_0xaf7b('0xc'));var crypto=require('crypto');var jsforce=require(_0xaf7b('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaf7b('0xe'));var Papa=require(_0xaf7b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf7b('0x10'));var as=require(_0xaf7b('0x11'));var hardwareService=require(_0xaf7b('0x12'));var logger=require('../../config/logger')(_0xaf7b('0x13'));var utils=require(_0xaf7b('0x14'));var config=require(_0xaf7b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xaf7b('0x16'))['db'];function respondWithStatusCode(_0x1b5d98,_0x3c9d39){_0x3c9d39=_0x3c9d39||0xcc;return function(_0x530a8d){if(_0x530a8d){return _0x1b5d98[_0xaf7b('0x17')](_0x3c9d39);}return _0x1b5d98['status'](_0x3c9d39)[_0xaf7b('0x18')]();};}function respondWithResult(_0x4665ee,_0x294717){_0x294717=_0x294717||0xc8;return function(_0x4f19d2){if(_0x4f19d2){return _0x4665ee[_0xaf7b('0x19')](_0x294717)[_0xaf7b('0x1a')](_0x4f19d2);}};}function respondWithFilteredResult(_0x2d4034,_0x4ae735){return function(_0x5d8186){if(_0x5d8186){var _0x12eeea=typeof _0x4ae735[_0xaf7b('0x1b')]===_0xaf7b('0x1c')&&typeof _0x4ae735[_0xaf7b('0x1d')]===_0xaf7b('0x1c');var _0xbb949=_0x5d8186[_0xaf7b('0x1e')];var _0x1c1be7=_0x12eeea?0x0:_0x4ae735['offset'];var _0x474549=_0x12eeea?_0x5d8186[_0xaf7b('0x1e')]:_0x4ae735[_0xaf7b('0x1b')]+_0x4ae735[_0xaf7b('0x1d')];var _0x1d3611;if(_0x474549>=_0xbb949){_0x474549=_0xbb949;_0x1d3611=0xc8;}else{_0x1d3611=0xce;}_0x2d4034[_0xaf7b('0x19')](_0x1d3611);return _0x2d4034[_0xaf7b('0x1f')](_0xaf7b('0x20'),_0x1c1be7+'-'+_0x474549+'/'+_0xbb949)[_0xaf7b('0x1a')](_0x5d8186);}return null;};}function patchUpdates(_0x2330ce){return function(_0x15e6a7){try{jsonpatch[_0xaf7b('0x21')](_0x15e6a7,_0x2330ce,!![]);}catch(_0x6b52df){return BPromise[_0xaf7b('0x22')](_0x6b52df);}return _0x15e6a7[_0xaf7b('0x23')]();};}function saveUpdates(_0xe20c18,_0x4cc005){return function(_0x58dbcc){if(_0x58dbcc){return _0x58dbcc[_0xaf7b('0x24')](_0xe20c18)[_0xaf7b('0x25')](function(_0x441ff3){return _0x441ff3;});}return null;};}function removeEntity(_0xfe74b,_0x42fc66){return function(_0x10f532){if(_0x10f532){return _0x10f532[_0xaf7b('0x26')]()[_0xaf7b('0x25')](function(){_0xfe74b[_0xaf7b('0x19')](0xcc)[_0xaf7b('0x18')]();});}};}function handleEntityNotFound(_0x1ed3ab,_0x37f971){return function(_0x2f5c80){if(!_0x2f5c80){_0x1ed3ab[_0xaf7b('0x17')](0x194);}return _0x2f5c80;};}function handleError(_0x18fe52,_0x5e99db){_0x5e99db=_0x5e99db||0x1f4;return function(_0x3c1350){logger[_0xaf7b('0x27')](_0x3c1350[_0xaf7b('0x28')]);if(_0x3c1350[_0xaf7b('0x29')]){delete _0x3c1350[_0xaf7b('0x29')];}_0x18fe52[_0xaf7b('0x19')](_0x5e99db)[_0xaf7b('0x2a')](_0x3c1350);};}exports[_0xaf7b('0x2b')]=function(_0x45969d,_0xf211b1){var _0x24094c={},_0x4c4cf1={},_0x2566c6={'count':0x0,'rows':[]};var _0x414004=_[_0xaf7b('0x2c')](db['VoiceDialReport'][_0xaf7b('0x2d')],function(_0x55c9f4){return{'name':_0x55c9f4[_0xaf7b('0x2e')],'type':_0x55c9f4[_0xaf7b('0x2f')][_0xaf7b('0x30')]};});_0x4c4cf1[_0xaf7b('0x31')]=_[_0xaf7b('0x2c')](_0x414004,'name');_0x4c4cf1[_0xaf7b('0x32')]=_[_0xaf7b('0x33')](_0x45969d[_0xaf7b('0x32')]);_0x4c4cf1[_0xaf7b('0x34')]=_[_0xaf7b('0x35')](_0x4c4cf1[_0xaf7b('0x31')],_0x4c4cf1[_0xaf7b('0x32')]);_0x24094c[_0xaf7b('0x36')]=_['intersection'](_0x4c4cf1[_0xaf7b('0x31')],qs[_0xaf7b('0x37')](_0x45969d['query'][_0xaf7b('0x37')]));_0x24094c[_0xaf7b('0x36')]=_0x24094c[_0xaf7b('0x36')][_0xaf7b('0x38')]?_0x24094c[_0xaf7b('0x36')]:_0x4c4cf1[_0xaf7b('0x31')];if(!_0x45969d[_0xaf7b('0x32')][_0xaf7b('0x39')](_0xaf7b('0x3a'))){_0x24094c[_0xaf7b('0x1d')]=qs[_0xaf7b('0x1d')](_0x45969d[_0xaf7b('0x32')]['limit']);_0x24094c[_0xaf7b('0x1b')]=qs['offset'](_0x45969d['query']['offset']);}_0x24094c[_0xaf7b('0x3b')]=qs[_0xaf7b('0x3c')](_0x45969d[_0xaf7b('0x32')][_0xaf7b('0x3c')]);_0x24094c[_0xaf7b('0x3d')]=qs[_0xaf7b('0x34')](_[_0xaf7b('0x3e')](_0x45969d['query'],_0x4c4cf1[_0xaf7b('0x34')]),_0x414004);if(_0x45969d[_0xaf7b('0x32')][_0xaf7b('0x3f')]){_0x24094c['where']=_[_0xaf7b('0x40')](_0x24094c[_0xaf7b('0x3d')],{'$or':_['map'](_0x414004,function(_0x393adc){if(_0x393adc[_0xaf7b('0x2f')]!=='VIRTUAL'){var _0x3cc900={};_0x3cc900[_0x393adc['name']]={'$like':'%'+_0x45969d[_0xaf7b('0x32')][_0xaf7b('0x3f')]+'%'};return _0x3cc900;}})});}_0x24094c=_[_0xaf7b('0x40')]({},_0x24094c,_0x45969d[_0xaf7b('0x41')]);var _0x3bb4cc={'where':_0x24094c[_0xaf7b('0x3d')]};return db[_0xaf7b('0x42')]['count'](_0x3bb4cc)[_0xaf7b('0x25')](function(_0x198dd3){_0x2566c6[_0xaf7b('0x1e')]=_0x198dd3;if(_0x45969d[_0xaf7b('0x32')][_0xaf7b('0x43')]){_0x24094c[_0xaf7b('0x44')]=[{'all':!![]}];}return db[_0xaf7b('0x42')][_0xaf7b('0x45')](_0x24094c);})[_0xaf7b('0x25')](function(_0x1c7293){_0x2566c6[_0xaf7b('0x46')]=_0x1c7293;return _0x2566c6;})[_0xaf7b('0x25')](respondWithFilteredResult(_0xf211b1,_0x24094c))[_0xaf7b('0x47')](handleError(_0xf211b1,null));};exports[_0xaf7b('0x48')]=function(_0x2e832e,_0x2485ac){var _0x19add6={'raw':!![],'where':{'id':_0x2e832e[_0xaf7b('0x49')]['id']}},_0x57c714={};_0x57c714[_0xaf7b('0x31')]=_[_0xaf7b('0x33')](db[_0xaf7b('0x42')][_0xaf7b('0x2d')]);_0x57c714[_0xaf7b('0x32')]=_['keys'](_0x2e832e['query']);_0x57c714['filters']=_[_0xaf7b('0x35')](_0x57c714['model'],_0x57c714['query']);_0x19add6[_0xaf7b('0x36')]=_[_0xaf7b('0x35')](_0x57c714[_0xaf7b('0x31')],qs[_0xaf7b('0x37')](_0x2e832e[_0xaf7b('0x32')][_0xaf7b('0x37')]));_0x19add6[_0xaf7b('0x36')]=_0x19add6['attributes']['length']?_0x19add6[_0xaf7b('0x36')]:_0x57c714[_0xaf7b('0x31')];if(_0x2e832e[_0xaf7b('0x32')][_0xaf7b('0x43')]){_0x19add6[_0xaf7b('0x44')]=[{'all':!![]}];}_0x19add6=_['merge']({},_0x19add6,_0x2e832e[_0xaf7b('0x41')]);return db[_0xaf7b('0x42')]['find'](_0x19add6)['then'](handleEntityNotFound(_0x2485ac,null))[_0xaf7b('0x25')](respondWithResult(_0x2485ac,null))['catch'](handleError(_0x2485ac,null));};exports[_0xaf7b('0x4a')]=function(_0x2c766b,_0x572d6f){return db[_0xaf7b('0x42')]['create'](_0x2c766b[_0xaf7b('0x4b')],{})[_0xaf7b('0x25')](respondWithResult(_0x572d6f,0xc9))['catch'](handleError(_0x572d6f,null));};exports['update']=function(_0x52a7c1,_0x1771f4){if(_0x52a7c1[_0xaf7b('0x4b')]['id']){delete _0x52a7c1[_0xaf7b('0x4b')]['id'];}return db[_0xaf7b('0x42')][_0xaf7b('0x4c')]({'where':{'id':_0x52a7c1[_0xaf7b('0x49')]['id']}})[_0xaf7b('0x25')](handleEntityNotFound(_0x1771f4,null))[_0xaf7b('0x25')](saveUpdates(_0x52a7c1[_0xaf7b('0x4b')],null))[_0xaf7b('0x25')](respondWithResult(_0x1771f4,null))[_0xaf7b('0x47')](handleError(_0x1771f4,null));};exports[_0xaf7b('0x26')]=function(_0x5f3e,_0x3115d6){return db[_0xaf7b('0x42')][_0xaf7b('0x4c')]({'where':{'id':_0x5f3e['params']['id']}})[_0xaf7b('0x25')](handleEntityNotFound(_0x3115d6,null))[_0xaf7b('0x25')](removeEntity(_0x3115d6,null))[_0xaf7b('0x47')](handleError(_0x3115d6,null));};exports[_0xaf7b('0x4d')]=function(_0x120020,_0x46a172){return db[_0xaf7b('0x42')][_0xaf7b('0x4d')]()[_0xaf7b('0x25')](respondWithResult(_0x46a172,null))[_0xaf7b('0x47')](handleError(_0x46a172,null));}; \ No newline at end of file +var _0x4eb1=['sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','save','update','then','error','stack','name','send','index','VoiceDialReport','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x5c4473,_0x34ef3c){var _0x166b82=function(_0x4665f2){while(--_0x4665f2){_0x5c4473['push'](_0x5c4473['shift']());}};_0x166b82(++_0x34ef3c);}(_0x4eb1,0xce));var _0x14eb=function(_0x37f227,_0x310131){_0x37f227=_0x37f227-0x0;var _0x501e88=_0x4eb1[_0x37f227];return _0x501e88;};'use strict';var emlformat=require(_0x14eb('0x0'));var rimraf=require(_0x14eb('0x1'));var zipdir=require(_0x14eb('0x2'));var jsonpatch=require(_0x14eb('0x3'));var rp=require(_0x14eb('0x4'));var moment=require(_0x14eb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x14eb('0x6'));var util=require(_0x14eb('0x7'));var path=require('path');var sox=require(_0x14eb('0x8'));var csv=require('to-csv');var ejs=require(_0x14eb('0x9'));var fs=require('fs');var fs_extra=require(_0x14eb('0xa'));var _=require(_0x14eb('0xb'));var squel=require(_0x14eb('0xc'));var crypto=require(_0x14eb('0xd'));var jsforce=require(_0x14eb('0xe'));var deskjs=require(_0x14eb('0xf'));var toCsv=require(_0x14eb('0x10'));var querystring=require('querystring');var Papa=require(_0x14eb('0x11'));var Redis=require(_0x14eb('0x12'));var authService=require(_0x14eb('0x13'));var qs=require(_0x14eb('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x14eb('0x15'));var logger=require(_0x14eb('0x16'))(_0x14eb('0x17'));var utils=require(_0x14eb('0x18'));var config=require(_0x14eb('0x19'));var licenseUtil=require(_0x14eb('0x1a'));var db=require(_0x14eb('0x1b'))['db'];function respondWithStatusCode(_0x162e10,_0x175277){_0x175277=_0x175277||0xcc;return function(_0x2244d3){if(_0x2244d3){return _0x162e10[_0x14eb('0x1c')](_0x175277);}return _0x162e10['status'](_0x175277)[_0x14eb('0x1d')]();};}function respondWithResult(_0x10fc08,_0x163ff6){_0x163ff6=_0x163ff6||0xc8;return function(_0x32e056){if(_0x32e056){return _0x10fc08[_0x14eb('0x1e')](_0x163ff6)[_0x14eb('0x1f')](_0x32e056);}};}function respondWithFilteredResult(_0x3c1944,_0x406d43){return function(_0x1ce9d4){if(_0x1ce9d4){var _0x258071=typeof _0x406d43['offset']===_0x14eb('0x20')&&typeof _0x406d43[_0x14eb('0x21')]==='undefined';var _0x512c03=_0x1ce9d4[_0x14eb('0x22')];var _0x4a2e2d=_0x258071?0x0:_0x406d43[_0x14eb('0x23')];var _0x56dada=_0x258071?_0x1ce9d4['count']:_0x406d43[_0x14eb('0x23')]+_0x406d43[_0x14eb('0x21')];var _0x5a8c1b;if(_0x56dada>=_0x512c03){_0x56dada=_0x512c03;_0x5a8c1b=0xc8;}else{_0x5a8c1b=0xce;}_0x3c1944['status'](_0x5a8c1b);return _0x3c1944['set'](_0x14eb('0x24'),_0x4a2e2d+'-'+_0x56dada+'/'+_0x512c03)[_0x14eb('0x1f')](_0x1ce9d4);}return null;};}function patchUpdates(_0xc817a8){return function(_0xffd387){try{jsonpatch['apply'](_0xffd387,_0xc817a8,!![]);}catch(_0x48386f){return BPromise['reject'](_0x48386f);}return _0xffd387[_0x14eb('0x25')]();};}function saveUpdates(_0x149239,_0x12c617){return function(_0x417974){if(_0x417974){return _0x417974[_0x14eb('0x26')](_0x149239)[_0x14eb('0x27')](function(_0x5c54a5){return _0x5c54a5;});}return null;};}function removeEntity(_0x5d07c4,_0x1ba803){return function(_0x3f8b2d){if(_0x3f8b2d){return _0x3f8b2d['destroy']()['then'](function(){_0x5d07c4[_0x14eb('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5323ec,_0x5e9890){return function(_0x119f05){if(!_0x119f05){_0x5323ec['sendStatus'](0x194);}return _0x119f05;};}function handleError(_0xb9c59c,_0x319d16){_0x319d16=_0x319d16||0x1f4;return function(_0x30a834){logger[_0x14eb('0x28')](_0x30a834[_0x14eb('0x29')]);if(_0x30a834[_0x14eb('0x2a')]){delete _0x30a834[_0x14eb('0x2a')];}_0xb9c59c[_0x14eb('0x1e')](_0x319d16)[_0x14eb('0x2b')](_0x30a834);};}exports[_0x14eb('0x2c')]=function(_0x4a6363,_0x25331e){var _0x5cf507={},_0x3d9a34={},_0x5bf380={'count':0x0,'rows':[]};var _0x3563f5=_['map'](db[_0x14eb('0x2d')]['rawAttributes'],function(_0x4145cb){return{'name':_0x4145cb['fieldName'],'type':_0x4145cb[_0x14eb('0x2e')][_0x14eb('0x2f')]};});_0x3d9a34[_0x14eb('0x30')]=_[_0x14eb('0x31')](_0x3563f5,_0x14eb('0x2a'));_0x3d9a34['query']=_['keys'](_0x4a6363[_0x14eb('0x32')]);_0x3d9a34[_0x14eb('0x33')]=_[_0x14eb('0x34')](_0x3d9a34[_0x14eb('0x30')],_0x3d9a34[_0x14eb('0x32')]);_0x5cf507[_0x14eb('0x35')]=_[_0x14eb('0x34')](_0x3d9a34[_0x14eb('0x30')],qs[_0x14eb('0x36')](_0x4a6363[_0x14eb('0x32')][_0x14eb('0x36')]));_0x5cf507[_0x14eb('0x35')]=_0x5cf507[_0x14eb('0x35')][_0x14eb('0x37')]?_0x5cf507['attributes']:_0x3d9a34['model'];if(!_0x4a6363[_0x14eb('0x32')][_0x14eb('0x38')](_0x14eb('0x39'))){_0x5cf507[_0x14eb('0x21')]=qs[_0x14eb('0x21')](_0x4a6363[_0x14eb('0x32')][_0x14eb('0x21')]);_0x5cf507[_0x14eb('0x23')]=qs[_0x14eb('0x23')](_0x4a6363[_0x14eb('0x32')][_0x14eb('0x23')]);}_0x5cf507['order']=qs[_0x14eb('0x3a')](_0x4a6363[_0x14eb('0x32')]['sort']);_0x5cf507[_0x14eb('0x3b')]=qs[_0x14eb('0x33')](_[_0x14eb('0x3c')](_0x4a6363[_0x14eb('0x32')],_0x3d9a34[_0x14eb('0x33')]),_0x3563f5);if(_0x4a6363['query'][_0x14eb('0x3d')]){_0x5cf507[_0x14eb('0x3b')]=_[_0x14eb('0x3e')](_0x5cf507[_0x14eb('0x3b')],{'$or':_['map'](_0x3563f5,function(_0x18495){if(_0x18495[_0x14eb('0x2e')]!==_0x14eb('0x3f')){var _0x569389={};_0x569389[_0x18495[_0x14eb('0x2a')]]={'$like':'%'+_0x4a6363[_0x14eb('0x32')][_0x14eb('0x3d')]+'%'};return _0x569389;}})});}_0x5cf507=_[_0x14eb('0x3e')]({},_0x5cf507,_0x4a6363['options']);var _0x4dd7f1={'where':_0x5cf507['where']};return db[_0x14eb('0x2d')][_0x14eb('0x22')](_0x4dd7f1)[_0x14eb('0x27')](function(_0x4bc806){_0x5bf380[_0x14eb('0x22')]=_0x4bc806;if(_0x4a6363[_0x14eb('0x32')][_0x14eb('0x40')]){_0x5cf507['include']=[{'all':!![]}];}return db[_0x14eb('0x2d')][_0x14eb('0x41')](_0x5cf507);})[_0x14eb('0x27')](function(_0x540278){_0x5bf380[_0x14eb('0x42')]=_0x540278;return _0x5bf380;})[_0x14eb('0x27')](respondWithFilteredResult(_0x25331e,_0x5cf507))[_0x14eb('0x43')](handleError(_0x25331e,null));};exports['show']=function(_0x2f6e9e,_0x4336c8){var _0x487692={'raw':!![],'where':{'id':_0x2f6e9e[_0x14eb('0x44')]['id']}},_0x4cb363={};_0x4cb363[_0x14eb('0x30')]=_[_0x14eb('0x45')](db[_0x14eb('0x2d')][_0x14eb('0x46')]);_0x4cb363[_0x14eb('0x32')]=_[_0x14eb('0x45')](_0x2f6e9e[_0x14eb('0x32')]);_0x4cb363[_0x14eb('0x33')]=_[_0x14eb('0x34')](_0x4cb363['model'],_0x4cb363[_0x14eb('0x32')]);_0x487692[_0x14eb('0x35')]=_['intersection'](_0x4cb363['model'],qs[_0x14eb('0x36')](_0x2f6e9e[_0x14eb('0x32')]['fields']));_0x487692[_0x14eb('0x35')]=_0x487692[_0x14eb('0x35')]['length']?_0x487692[_0x14eb('0x35')]:_0x4cb363[_0x14eb('0x30')];if(_0x2f6e9e[_0x14eb('0x32')][_0x14eb('0x40')]){_0x487692[_0x14eb('0x47')]=[{'all':!![]}];}_0x487692=_[_0x14eb('0x3e')]({},_0x487692,_0x2f6e9e[_0x14eb('0x48')]);return db[_0x14eb('0x2d')][_0x14eb('0x49')](_0x487692)[_0x14eb('0x27')](handleEntityNotFound(_0x4336c8,null))[_0x14eb('0x27')](respondWithResult(_0x4336c8,null))[_0x14eb('0x43')](handleError(_0x4336c8,null));};exports['create']=function(_0x19c3ed,_0x2ce4b3){return db[_0x14eb('0x2d')][_0x14eb('0x4a')](_0x19c3ed[_0x14eb('0x4b')],{})[_0x14eb('0x27')](respondWithResult(_0x2ce4b3,0xc9))[_0x14eb('0x43')](handleError(_0x2ce4b3,null));};exports['update']=function(_0x3a3d53,_0x395ba1){if(_0x3a3d53['body']['id']){delete _0x3a3d53[_0x14eb('0x4b')]['id'];}return db[_0x14eb('0x2d')][_0x14eb('0x49')]({'where':{'id':_0x3a3d53[_0x14eb('0x44')]['id']}})[_0x14eb('0x27')](handleEntityNotFound(_0x395ba1,null))[_0x14eb('0x27')](saveUpdates(_0x3a3d53['body'],null))['then'](respondWithResult(_0x395ba1,null))[_0x14eb('0x43')](handleError(_0x395ba1,null));};exports[_0x14eb('0x4c')]=function(_0x1e5e16,_0x4f2204){return db['VoiceDialReport'][_0x14eb('0x49')]({'where':{'id':_0x1e5e16[_0x14eb('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f2204,null))['then'](removeEntity(_0x4f2204,null))[_0x14eb('0x43')](handleError(_0x4f2204,null));};exports[_0x14eb('0x4d')]=function(_0x546bda,_0x24371f){return db['VoiceDialReport'][_0x14eb('0x4d')]()[_0x14eb('0x27')](respondWithResult(_0x24371f,null))['catch'](handleError(_0x24371f,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ae1e032..e5ba763 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 _0x37cc=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','VoiceDialReport','report_dial','lodash'];(function(_0x6eb7b,_0x3ba1c0){var _0x1d687d=function(_0x682669){while(--_0x682669){_0x6eb7b['push'](_0x6eb7b['shift']());}};_0x1d687d(++_0x3ba1c0);}(_0x37cc,0x185));var _0xc37c=function(_0x41a58f,_0x507593){_0x41a58f=_0x41a58f-0x0;var _0x138039=_0x37cc[_0x41a58f];return _0x138039;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var logger=require(_0xc37c('0x2'))(_0xc37c('0x3'));var moment=require(_0xc37c('0x4'));var BPromise=require(_0xc37c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc37c('0x6'));var config=require(_0xc37c('0x7'));var attributes=require(_0xc37c('0x8'));module[_0xc37c('0x9')]=function(_0x4c9dcd,_0x582100){return _0x4c9dcd[_0xc37c('0xa')](_0xc37c('0xb'),attributes,{'tableName':_0xc37c('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x7917=['./voiceDialReport.attributes','exports','define','report_dial','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4d6146,_0x4318eb){var _0x3973fe=function(_0x4a5618){while(--_0x4a5618){_0x4d6146['push'](_0x4d6146['shift']());}};_0x3973fe(++_0x4318eb);}(_0x7917,0x131));var _0x7791=function(_0x33b569,_0x2d709d){_0x33b569=_0x33b569-0x0;var _0x3d99af=_0x7917[_0x33b569];return _0x3d99af;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7791('0x0'))(_0x7791('0x1'));var moment=require(_0x7791('0x2'));var BPromise=require(_0x7791('0x3'));var rp=require(_0x7791('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7791('0x5'));var config=require(_0x7791('0x6'));var attributes=require(_0x7791('0x7'));module[_0x7791('0x8')]=function(_0x3e5175,_0x5c377e){return _0x3e5175[_0x7791('0x9')]('VoiceDialReport',attributes,{'tableName':_0x7791('0xa'),'paranoid':![],'indexes':[{'fields':[_0x7791('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b98b528..224123a 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 _0x72a9=['raw','UpdateVoiceDialReport','update','body','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','options'];(function(_0x34a4fd,_0x5c07f2){var _0xf89bcb=function(_0x575bbe){while(--_0x575bbe){_0x34a4fd['push'](_0x34a4fd['shift']());}};_0xf89bcb(++_0x5c07f2);}(_0x72a9,0x10e));var _0x972a=function(_0x4cb6dc,_0x47dbc9){_0x4cb6dc=_0x4cb6dc-0x0;var _0x5204be=_0x72a9[_0x4cb6dc];return _0x5204be;};'use strict';var _=require(_0x972a('0x0'));var util=require(_0x972a('0x1'));var moment=require(_0x972a('0x2'));var BPromise=require('bluebird');var rs=require(_0x972a('0x3'));var fs=require('fs');var Redis=require(_0x972a('0x4'));var db=require(_0x972a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x972a('0x6'))(_0x972a('0x7'));var config=require(_0x972a('0x8'));var jayson=require(_0x972a('0x9'));var client=jayson[_0x972a('0xa')][_0x972a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x502392,_0x2bce2a,_0x3a26f7){return new BPromise(function(_0x5d34cb,_0x2e691a){return client['request'](_0x502392,_0x3a26f7)[_0x972a('0xc')](function(_0x17e1a3){logger[_0x972a('0xd')](_0x972a('0xe'),_0x2bce2a,_0x972a('0xf'));logger[_0x972a('0x10')](_0x972a('0x11'),_0x2bce2a,_0x972a('0xf'),JSON[_0x972a('0x12')](_0x17e1a3));if(_0x17e1a3[_0x972a('0x13')]){if(_0x17e1a3['error'][_0x972a('0x14')]===0x1f4){logger['error'](_0x972a('0xe'),_0x2bce2a,_0x17e1a3[_0x972a('0x13')][_0x972a('0x15')]);return _0x2e691a(_0x17e1a3[_0x972a('0x13')][_0x972a('0x15')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x2bce2a,_0x17e1a3[_0x972a('0x13')][_0x972a('0x15')]);return _0x5d34cb(_0x17e1a3[_0x972a('0x13')][_0x972a('0x15')]);}else{logger[_0x972a('0xd')](_0x972a('0xe'),_0x2bce2a,'request\x20sent');_0x5d34cb(_0x17e1a3[_0x972a('0x16')][_0x972a('0x15')]);}})[_0x972a('0x17')](function(_0x582b0d){logger[_0x972a('0x13')](_0x972a('0xe'),_0x2bce2a,_0x582b0d);_0x2e691a(_0x582b0d);});});}exports[_0x972a('0x18')]=function(_0x6a5479){var _0x3856da=this;return new Promise(function(_0x47574,_0x32d47f){return db[_0x972a('0x19')]['create'](_0x6a5479['body'],{'raw':_0x6a5479['options']?_0x6a5479[_0x972a('0x1a')][_0x972a('0x1b')]===undefined?!![]:![]:!![]})[_0x972a('0xc')](function(_0x61088c){logger['info'](_0x972a('0x18'),_0x6a5479);logger[_0x972a('0x10')](_0x972a('0x18'),_0x6a5479,JSON[_0x972a('0x12')](_0x61088c));_0x47574(_0x61088c);})[_0x972a('0x17')](function(_0x257fe2){logger[_0x972a('0x13')]('CreateVoiceDialReport',_0x257fe2[_0x972a('0x15')],_0x6a5479);_0x32d47f(_0x3856da[_0x972a('0x13')](0x1f4,_0x257fe2['message']));});});};exports[_0x972a('0x1c')]=function(_0x5c201a){var _0x2bc719=this;return new Promise(function(_0xd485ee,_0x2d8227){return db['VoiceDialReport'][_0x972a('0x1d')](_0x5c201a[_0x972a('0x1e')],{'raw':_0x5c201a[_0x972a('0x1a')]?_0x5c201a[_0x972a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c201a['options']?_0x5c201a[_0x972a('0x1a')]['where']||null:null,'attributes':_0x5c201a[_0x972a('0x1a')]?_0x5c201a['options'][_0x972a('0x1f')]||null:null,'limit':_0x5c201a['options']?_0x5c201a[_0x972a('0x1a')][_0x972a('0x20')]||null:null})[_0x972a('0xc')](function(_0x21262a){logger['info'](_0x972a('0x1c'),_0x5c201a);logger[_0x972a('0x10')]('UpdateVoiceDialReport',_0x5c201a,JSON['stringify'](_0x21262a));_0xd485ee(_0x21262a);})[_0x972a('0x17')](function(_0x2a7d17){logger[_0x972a('0x13')](_0x972a('0x1c'),_0x2a7d17['message'],_0x5c201a);_0x2d8227(_0x2bc719[_0x972a('0x13')](0x1f4,_0x2a7d17['message']));});});}; \ No newline at end of file +var _0xd84e=['client','http','then','info','debug','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','catch','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','stringify','where','attributes','UpdateVoiceDialReport','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x9dfdb,_0x592cd1){var _0x2d5f38=function(_0x211dbd){while(--_0x211dbd){_0x9dfdb['push'](_0x9dfdb['shift']());}};_0x2d5f38(++_0x592cd1);}(_0xd84e,0x141));var _0xed84=function(_0x2cf5e6,_0x2a27d4){_0x2cf5e6=_0x2cf5e6-0x0;var _0x296ecb=_0xd84e[_0x2cf5e6];return _0x296ecb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed84('0x0'));var BPromise=require(_0xed84('0x1'));var rs=require(_0xed84('0x2'));var fs=require('fs');var Redis=require(_0xed84('0x3'));var db=require(_0xed84('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xed84('0x5'))(_0xed84('0x6'));var config=require(_0xed84('0x7'));var jayson=require(_0xed84('0x8'));var client=jayson[_0xed84('0x9')][_0xed84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1be6a2,_0x35c4fb,_0x963df0){return new BPromise(function(_0x8f3456,_0x5ab0ea){return client['request'](_0x1be6a2,_0x963df0)[_0xed84('0xb')](function(_0x3245ee){logger[_0xed84('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x35c4fb,'request\x20sent');logger[_0xed84('0xd')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x35c4fb,_0xed84('0xe'),JSON['stringify'](_0x3245ee));if(_0x3245ee[_0xed84('0xf')]){if(_0x3245ee[_0xed84('0xf')][_0xed84('0x10')]===0x1f4){logger[_0xed84('0xf')](_0xed84('0x11'),_0x35c4fb,_0x3245ee[_0xed84('0xf')]['message']);return _0x5ab0ea(_0x3245ee[_0xed84('0xf')]['message']);}logger[_0xed84('0xf')](_0xed84('0x11'),_0x35c4fb,_0x3245ee[_0xed84('0xf')]['message']);return _0x8f3456(_0x3245ee['error'][_0xed84('0x12')]);}else{logger[_0xed84('0xc')](_0xed84('0x11'),_0x35c4fb,_0xed84('0xe'));_0x8f3456(_0x3245ee['result'][_0xed84('0x12')]);}})[_0xed84('0x13')](function(_0x4cb79d){logger[_0xed84('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x35c4fb,_0x4cb79d);_0x5ab0ea(_0x4cb79d);});});}exports['CreateVoiceDialReport']=function(_0x5d0660){var _0x5e1dc0=this;return new Promise(function(_0x3f0470,_0x2c19ee){return db[_0xed84('0x14')][_0xed84('0x15')](_0x5d0660[_0xed84('0x16')],{'raw':_0x5d0660[_0xed84('0x17')]?_0x5d0660[_0xed84('0x17')][_0xed84('0x18')]===undefined?!![]:![]:!![]})[_0xed84('0xb')](function(_0x2d587d){logger['info'](_0xed84('0x19'),_0x5d0660);logger[_0xed84('0xd')](_0xed84('0x19'),_0x5d0660,JSON[_0xed84('0x1a')](_0x2d587d));_0x3f0470(_0x2d587d);})[_0xed84('0x13')](function(_0x1a5b0a){logger[_0xed84('0xf')](_0xed84('0x19'),_0x1a5b0a[_0xed84('0x12')],_0x5d0660);_0x2c19ee(_0x5e1dc0[_0xed84('0xf')](0x1f4,_0x1a5b0a[_0xed84('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x2000fa){var _0x39fbce=this;return new Promise(function(_0x4ab691,_0x2128b9){return db['VoiceDialReport']['update'](_0x2000fa['body'],{'raw':_0x2000fa['options']?_0x2000fa[_0xed84('0x17')][_0xed84('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2000fa[_0xed84('0x17')]?_0x2000fa[_0xed84('0x17')][_0xed84('0x1b')]||null:null,'attributes':_0x2000fa[_0xed84('0x17')]?_0x2000fa[_0xed84('0x17')][_0xed84('0x1c')]||null:null,'limit':_0x2000fa[_0xed84('0x17')]?_0x2000fa['options']['limit']||null:null})['then'](function(_0x360cb6){logger[_0xed84('0xc')]('UpdateVoiceDialReport',_0x2000fa);logger[_0xed84('0xd')](_0xed84('0x1d'),_0x2000fa,JSON[_0xed84('0x1a')](_0x360cb6));_0x4ab691(_0x360cb6);})['catch'](function(_0x38ebe1){logger[_0xed84('0xf')]('UpdateVoiceDialReport',_0x38ebe1[_0xed84('0x12')],_0x2000fa);_0x2128b9(_0x39fbce['error'](0x1f4,_0x38ebe1[_0xed84('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index eb8e532..6c7f901 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 _0x4bbc=['delete','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','index','/:id','isAuthenticated','show','post','create','/:id/applications','put'];(function(_0xc05c55,_0x4c61ea){var _0x4a22b8=function(_0x4761dd){while(--_0x4761dd){_0xc05c55['push'](_0xc05c55['shift']());}};_0x4a22b8(++_0x4c61ea);}(_0x4bbc,0x1a7));var _0xc4bb=function(_0x183fac,_0x5c4b00){_0x183fac=_0x183fac-0x0;var _0x5ee86a=_0x4bbc[_0x183fac];return _0x5ee86a;};'use strict';var multer=require(_0xc4bb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc4bb('0x1'));var express=require(_0xc4bb('0x2'));var router=express['Router']();var fs_extra=require(_0xc4bb('0x3'));var auth=require(_0xc4bb('0x4'));var interaction=require(_0xc4bb('0x5'));var config=require(_0xc4bb('0x6'));var controller=require(_0xc4bb('0x7'));router[_0xc4bb('0x8')]('/',auth['isAuthenticated'](),controller[_0xc4bb('0x9')]);router[_0xc4bb('0x8')](_0xc4bb('0xa'),auth[_0xc4bb('0xb')](),controller[_0xc4bb('0xc')]);router[_0xc4bb('0xd')]('/',auth[_0xc4bb('0xb')](),controller[_0xc4bb('0xe')]);router['post'](_0xc4bb('0xf'),auth[_0xc4bb('0xb')](),controller['addApplications']);router[_0xc4bb('0x10')]('/:id',auth[_0xc4bb('0xb')](),controller['update']);router[_0xc4bb('0x11')]('/:id',auth[_0xc4bb('0xb')](),controller[_0xc4bb('0x12')]);module[_0xc4bb('0x13')]=router; \ No newline at end of file +var _0x970a=['get','isAuthenticated','post','create','/:id/applications','addApplications','put','update','delete','/:id','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x970a,0xdd));var _0xa970=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x970a[_0x30c649];return _0x3edfb9;};'use strict';var multer=require(_0xa970('0x0'));var util=require(_0xa970('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa970('0x2'));var router=express[_0xa970('0x3')]();var fs_extra=require(_0xa970('0x4'));var auth=require(_0xa970('0x5'));var interaction=require(_0xa970('0x6'));var config=require(_0xa970('0x7'));var controller=require(_0xa970('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xa970('0x9')]);router[_0xa970('0xa')]('/:id',auth[_0xa970('0xb')](),controller['show']);router[_0xa970('0xc')]('/',auth[_0xa970('0xb')](),controller[_0xa970('0xd')]);router[_0xa970('0xc')](_0xa970('0xe'),auth[_0xa970('0xb')](),controller[_0xa970('0xf')]);router[_0xa970('0x10')]('/:id',auth[_0xa970('0xb')](),controller[_0xa970('0x11')]);router[_0xa970('0x12')](_0xa970('0x13'),auth[_0xa970('0xb')](),controller['destroy']);module[_0xa970('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index bfb85ca..d3e0e26 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 _0xb86e=['system','any','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','compositeIndex','STRING','ENUM','inbound','internal','inbound-fax','outbound-fax'];(function(_0x102bb7,_0x5bd5c4){var _0x4c3301=function(_0x4b5397){while(--_0x4b5397){_0x102bb7['push'](_0x102bb7['shift']());}};_0x4c3301(++_0x5bd5c4);}(_0xb86e,0xb8));var _0xeb86=function(_0x58b332,_0x54787d){_0x58b332=_0x58b332-0x0;var _0xb8e97e=_0xb86e[_0x58b332];return _0xb8e97e;};'use strict';var Sequelize=require('sequelize');module[_0xeb86('0x0')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xeb86('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xeb86('0x2')],'allowNull':![],'unique':_0xeb86('0x1')},'priority':{'type':Sequelize[_0xeb86('0x2')],'allowNull':![],'defaultValue':'1','unique':_0xeb86('0x1')},'tag':{'type':Sequelize[_0xeb86('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xeb86('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0xeb86('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xeb86('0x3')](_0xeb86('0x4'),'outbound',_0xeb86('0x5'),_0xeb86('0x6'),_0xeb86('0x7'),_0xeb86('0x8'),_0xeb86('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0xeb86('0x2')]},'interval':{'type':Sequelize[_0xeb86('0x2')],'allowNull':![],'defaultValue':_0xeb86('0xa')},'IntervalId':{'type':Sequelize[_0xeb86('0xb')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize['STRING'],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xeb86('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xeb86('0xb')]},'recordingFormat':{'type':Sequelize[_0xeb86('0x2')],'defaultValue':_0xeb86('0xd')},'answer':{'type':Sequelize[_0xeb86('0xc')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2b4807){return this[_0xeb86('0xe')](_0xeb86('0xf'));}},'alias':{'type':Sequelize[_0xeb86('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0f1d=['internal','inbound-fax','system','*,*,*,*','BOOLEAN','VIRTUAL','exten','STRING','compositeIndex','NoOp','ENUM','outbound'];(function(_0x221019,_0x15c3c1){var _0x1b3cae=function(_0x7a192d){while(--_0x7a192d){_0x221019['push'](_0x221019['shift']());}};_0x1b3cae(++_0x15c3c1);}(_0x0f1d,0x1e7));var _0xd0f1=function(_0x50ee83,_0x106751){_0x50ee83=_0x50ee83-0x0;var _0x3099ea=_0x0f1d[_0x50ee83];return _0x3099ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0xd0f1('0x0')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd0f1('0x1')},'priority':{'type':Sequelize[_0xd0f1('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd0f1('0x2')},'appdata':{'type':Sequelize[_0xd0f1('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd0f1('0x3')]('inbound',_0xd0f1('0x4'),_0xd0f1('0x5'),_0xd0f1('0x6'),'outbound-fax',_0xd0f1('0x7'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0xd0f1('0x0')]},'interval':{'type':Sequelize[_0xd0f1('0x0')],'allowNull':![],'defaultValue':_0xd0f1('0x8')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd0f1('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd0f1('0x0')],'allowNull':!![]},'record':{'type':Sequelize[_0xd0f1('0x9')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0xd0f1('0x0')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xd0f1('0x9')],'defaultValue':!![]},'name':{'type':Sequelize[_0xd0f1('0xa')],'get':function(_0x185952){return this['getDataValue'](_0xd0f1('0xb'));}},'alias':{'type':Sequelize[_0xd0f1('0x0')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index a637ab4..9f2e62e 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 _0xc3ab=['status','json','offset','limit','undefined','count','set','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','type','find','UserProfileResource','then','error','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','intersection','model','query','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','mandatoryDisposition','addApplications','transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x5de26c,_0x1a9fae){var _0x5f4736=function(_0x32711c){while(--_0x32711c){_0x5de26c['push'](_0x5de26c['shift']());}};_0x5f4736(++_0x1a9fae);}(_0xc3ab,0x1a8));var _0xbc3a=function(_0x54a1b7,_0x1b3fce){_0x54a1b7=_0x54a1b7-0x0;var _0xf72e18=_0xc3ab[_0x54a1b7];return _0xf72e18;};'use strict';var _=require(_0xbc3a('0x0'));var Redis=require('ioredis');var qs=require(_0xbc3a('0x1'));var logger=require(_0xbc3a('0x2'))(_0xbc3a('0x3'));var config=require('../../config/environment');var db=require(_0xbc3a('0x4'))['db'];config['redis']=_[_0xbc3a('0x5')](config[_0xbc3a('0x6')],{'host':_0xbc3a('0x7'),'port':0x18eb});var socket=require(_0xbc3a('0x8'))(new Redis(config[_0xbc3a('0x6')]));require(_0xbc3a('0x9'))[_0xbc3a('0xa')](socket);function respondWithStatusCode(_0x1d50cb,_0x29feca){_0x29feca=_0x29feca||0xcc;return function(_0x33dbee){if(_0x33dbee){return _0x1d50cb['sendStatus'](_0x29feca);}return _0x1d50cb[_0xbc3a('0xb')](_0x29feca)['end']();};}function respondWithResult(_0x3c1a6d,_0x1f4b93){_0x1f4b93=_0x1f4b93||0xc8;return function(_0x31c0ee){if(_0x31c0ee){return _0x3c1a6d[_0xbc3a('0xb')](_0x1f4b93)[_0xbc3a('0xc')](_0x31c0ee);}};}function respondWithFilteredResult(_0x55026e,_0x264169){return function(_0x2af023){if(_0x2af023){var _0x3ffa35=typeof _0x264169[_0xbc3a('0xd')]==='undefined'&&typeof _0x264169[_0xbc3a('0xe')]===_0xbc3a('0xf');var _0x394f9f=_0x2af023[_0xbc3a('0x10')];var _0x196066=_0x3ffa35?0x0:_0x264169[_0xbc3a('0xd')];var _0xc9356c=_0x3ffa35?_0x2af023[_0xbc3a('0x10')]:_0x264169[_0xbc3a('0xd')]+_0x264169['limit'];var _0x364ff8;if(_0xc9356c>=_0x394f9f){_0xc9356c=_0x394f9f;_0x364ff8=0xc8;}else{_0x364ff8=0xce;}_0x55026e[_0xbc3a('0xb')](_0x364ff8);return _0x55026e[_0xbc3a('0x11')]('Content-Range',_0x196066+'-'+_0xc9356c+'/'+_0x394f9f)[_0xbc3a('0xc')](_0x2af023);}return null;};}function removeEntity(_0x52ad4e){return function(_0x19f5b3){if(_0x19f5b3){return _0x19f5b3[_0xbc3a('0x12')]()['then'](function(){var _0x1c577a=_0x19f5b3[_0xbc3a('0x13')]({'plain':!![]});var _0x1bc80e=[{'name':_0xbc3a('0x14'),'value':_0xbc3a('0x15'),'ignore':![]},{'name':_0xbc3a('0x16'),'value':_0xbc3a('0x17'),'ignore':![]},{'name':_0xbc3a('0x18'),'value':_0xbc3a('0x19'),'ignore':![]}];var _0x444317=_(_0x1bc80e)['filter'](_0xbc3a('0x1a'))[_0xbc3a('0x1b')](_0xbc3a('0x1c'))[_0xbc3a('0x1c')]();if(_[_0xbc3a('0x1d')](_0x444317,_0x1c577a[_0xbc3a('0x1e')])){return;}var _0x2e6156=_[_0xbc3a('0x1f')](_0x1bc80e,[_0xbc3a('0x1c'),_0x1c577a[_0xbc3a('0x1e')]])['name'];return db[_0xbc3a('0x20')][_0xbc3a('0x12')]({'where':{'type':_0x2e6156,'resourceId':_0x1c577a['id']}})[_0xbc3a('0x21')](function(){return _0x19f5b3;});})['then'](function(){_0x52ad4e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x478cc1){return function(_0x216301){if(!_0x216301){_0x478cc1['sendStatus'](0x194);}return _0x216301;};}function handleError(_0x587e2b,_0x45dc1c){_0x45dc1c=_0x45dc1c||0x1f4;return function(_0x27e1ca){logger[_0xbc3a('0x22')](_0x27e1ca[_0xbc3a('0x23')]);if(_0x27e1ca[_0xbc3a('0x24')]){delete _0x27e1ca[_0xbc3a('0x24')];}_0x587e2b['status'](_0x45dc1c)[_0xbc3a('0x25')](_0x27e1ca);};}exports[_0xbc3a('0x26')]=function(_0x2971a0,_0x48c8d1){var _0x3c03d5={},_0x41ee88={},_0x339a99={'count':0x0,'rows':[]};var _0x5adb8d=_[_0xbc3a('0x1b')](db[_0xbc3a('0x27')][_0xbc3a('0x28')],function(_0x546150){return{'name':_0x546150[_0xbc3a('0x29')],'type':_0x546150[_0xbc3a('0x1e')][_0xbc3a('0x2a')]};});_0x41ee88['model']=_[_0xbc3a('0x1b')](_0x5adb8d,_0xbc3a('0x24'));_0x41ee88['query']=_['keys'](_0x2971a0['query']);_0x41ee88['filters']=_[_0xbc3a('0x2b')](_0x41ee88[_0xbc3a('0x2c')],_0x41ee88[_0xbc3a('0x2d')]);_0x3c03d5[_0xbc3a('0x2e')]=_['intersection'](_0x41ee88[_0xbc3a('0x2c')],qs[_0xbc3a('0x2f')](_0x2971a0[_0xbc3a('0x2d')][_0xbc3a('0x2f')]));_0x3c03d5['attributes']=_0x3c03d5[_0xbc3a('0x2e')]['length']?_0x3c03d5[_0xbc3a('0x2e')]:_0x41ee88[_0xbc3a('0x2c')];if(!_0x2971a0[_0xbc3a('0x2d')]['hasOwnProperty'](_0xbc3a('0x30'))){_0x3c03d5[_0xbc3a('0xe')]=qs[_0xbc3a('0xe')](_0x2971a0[_0xbc3a('0x2d')][_0xbc3a('0xe')]);_0x3c03d5[_0xbc3a('0xd')]=qs[_0xbc3a('0xd')](_0x2971a0[_0xbc3a('0x2d')][_0xbc3a('0xd')]);}_0x3c03d5[_0xbc3a('0x31')]=qs[_0xbc3a('0x32')](_0x2971a0['query'][_0xbc3a('0x32')]);_0x3c03d5[_0xbc3a('0x33')]=qs[_0xbc3a('0x34')](_[_0xbc3a('0x35')](_0x2971a0['query'],_0x41ee88['filters']),_0x5adb8d);if(_0x2971a0[_0xbc3a('0x2d')]['filter']){_0x3c03d5[_0xbc3a('0x33')]=_[_0xbc3a('0x36')](_0x3c03d5[_0xbc3a('0x33')],{'$or':_[_0xbc3a('0x1b')](_0x5adb8d,function(_0x52d325){if(_0x52d325[_0xbc3a('0x1e')]!==_0xbc3a('0x37')){var _0x93b11b={};_0x93b11b[_0x52d325[_0xbc3a('0x24')]]={'$like':'%'+_0x2971a0['query'][_0xbc3a('0x38')]+'%'};return _0x93b11b;}})});}_0x3c03d5=_['merge']({},_0x3c03d5,_0x2971a0[_0xbc3a('0x39')]);var _0x26b178={'where':_0x3c03d5['where']};return db['VoiceExtension'][_0xbc3a('0x10')](_0x26b178)[_0xbc3a('0x21')](function(_0x16150b){_0x339a99['count']=_0x16150b;if(_0x2971a0[_0xbc3a('0x2d')][_0xbc3a('0x3a')]){_0x3c03d5[_0xbc3a('0x3b')]=[{'all':!![]}];}return db[_0xbc3a('0x27')][_0xbc3a('0x3c')](_0x3c03d5);})[_0xbc3a('0x21')](function(_0x3a4959){_0x339a99['rows']=_0x3a4959;return _0x339a99;})[_0xbc3a('0x21')](respondWithFilteredResult(_0x48c8d1,_0x3c03d5))[_0xbc3a('0x3d')](handleError(_0x48c8d1,null));};exports[_0xbc3a('0x3e')]=function(_0x5d313a,_0x53a003){var _0x4a03e9={'raw':![],'where':{'id':_0x5d313a[_0xbc3a('0x3f')]['id']}},_0x11e5cf={};_0x11e5cf[_0xbc3a('0x2c')]=_['keys'](db['VoiceExtension'][_0xbc3a('0x28')]);_0x11e5cf[_0xbc3a('0x2d')]=_[_0xbc3a('0x40')](_0x5d313a['query']);_0x11e5cf[_0xbc3a('0x34')]=_[_0xbc3a('0x2b')](_0x11e5cf[_0xbc3a('0x2c')],_0x11e5cf[_0xbc3a('0x2d')]);_0x4a03e9[_0xbc3a('0x2e')]=_['intersection'](_0x11e5cf[_0xbc3a('0x2c')],qs[_0xbc3a('0x2f')](_0x5d313a[_0xbc3a('0x2d')][_0xbc3a('0x2f')]));_0x4a03e9['attributes']=_0x4a03e9[_0xbc3a('0x2e')]['length']?_0x4a03e9[_0xbc3a('0x2e')]:_0x11e5cf['model'];if(_0x5d313a[_0xbc3a('0x2d')][_0xbc3a('0x3a')]){_0x4a03e9[_0xbc3a('0x3b')]=[{'all':!![]}];}_0x4a03e9=_['merge']({},_0x4a03e9,_0x5d313a[_0xbc3a('0x39')]);return db[_0xbc3a('0x27')][_0xbc3a('0x1f')](_0x4a03e9)[_0xbc3a('0x21')](handleEntityNotFound(_0x53a003,null))[_0xbc3a('0x21')](respondWithResult(_0x53a003,null))['catch'](handleError(_0x53a003,null));};exports[_0xbc3a('0x12')]=function(_0x4f7626,_0x4d78d0){return db[_0xbc3a('0x27')]['find']({'where':{'id':_0x4f7626['params']['id']}})['then'](handleEntityNotFound(_0x4d78d0,null))[_0xbc3a('0x21')](removeEntity(_0x4d78d0,null))[_0xbc3a('0x3d')](handleError(_0x4d78d0,null));};exports['create']=function(_0x20631a,_0x5227f){if(_0x20631a[_0xbc3a('0x41')][_0xbc3a('0x1e')]===_0xbc3a('0x17')&&!_['startsWith'](_0x20631a[_0xbc3a('0x41')][_0xbc3a('0x42')],'_')){_0x20631a[_0xbc3a('0x41')][_0xbc3a('0x42')]='_'['concat'](_0x20631a[_0xbc3a('0x41')][_0xbc3a('0x42')]);}return db[_0xbc3a('0x27')]['create'](_0x20631a[_0xbc3a('0x41')],{'raw':![]})[_0xbc3a('0x21')](function(_0x46259f){var _0x6f49d=_0x20631a[_0xbc3a('0x43')][_0xbc3a('0x13')]({'plain':!![]});if(!_0x6f49d)throw new Error(_0xbc3a('0x44'));if(_0x6f49d[_0xbc3a('0x45')]===_0xbc3a('0x43')){var _0x466b73=_0x46259f[_0xbc3a('0x13')]({'plain':!![]});var _0x468fbf=[{'name':_0xbc3a('0x14'),'value':_0xbc3a('0x15')},{'name':'OutboundRoutes','value':_0xbc3a('0x17')},{'name':_0xbc3a('0x18'),'value':_0xbc3a('0x19')}];var _0x592d69=_[_0xbc3a('0x1f')](_0x468fbf,[_0xbc3a('0x1c'),_0x466b73[_0xbc3a('0x1e')]])[_0xbc3a('0x24')];return db[_0xbc3a('0x46')]['find']({'where':{'name':_0x592d69,'userProfileId':_0x6f49d['userProfileId']},'raw':!![]})[_0xbc3a('0x21')](function(_0x2c81b0){if(_0x2c81b0&&_0x2c81b0['autoAssociation']===0x0){return db['UserProfileResource'][_0xbc3a('0x47')]({'name':_0x466b73[_0xbc3a('0x24')],'resourceId':_0x466b73['id'],'type':_0x2c81b0[_0xbc3a('0x24')],'sectionId':_0x2c81b0['id']},{})[_0xbc3a('0x21')](function(){return _0x46259f;});}else{return _0x46259f;}})['catch'](function(_0x23bb53){logger['error'](_0xbc3a('0x48'),_0x23bb53);throw _0x23bb53;});}return _0x46259f;})[_0xbc3a('0x21')](respondWithResult(_0x5227f,0xc9))[_0xbc3a('0x3d')](handleError(_0x5227f,null));};exports['update']=function(_0x2562d1,_0x46a262){if(_0x2562d1['body']['id']){delete _0x2562d1[_0xbc3a('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x2562d1[_0xbc3a('0x3f')]['id']}})['then'](handleEntityNotFound(_0x46a262,null))[_0xbc3a('0x21')](function(_0xee1850){if(_0xee1850){return db[_0xbc3a('0x27')][_0xbc3a('0x49')](_['pick'](_0x2562d1[_0xbc3a('0x41')],['exten',_0xbc3a('0x4a'),'description','recordingFormat',_0xbc3a('0x4b'),_0xbc3a('0x4c'),'alias']),{'where':{'context':_0xee1850[_0xbc3a('0x4a')],'exten':_0xee1850[_0xbc3a('0x42')]},'individualHooks':!![]})[_0xbc3a('0x21')](function(_0x193ca8){return _0x193ca8;});}return null;})[_0xbc3a('0x21')](respondWithStatusCode(_0x46a262,null))['catch'](handleError(_0x46a262,null));};exports[_0xbc3a('0x4d')]=function(_0x19a328,_0x26270c){var _0x2c48d3=_0x19a328['params']['id'];var _0x4be99a=_0x19a328[_0xbc3a('0x41')];var _0x214371=0xc8;var _0x1e5406=null;return db['sequelize'][_0xbc3a('0x4e')]({'isolationLevel':db['sequelize']['Transaction'][_0xbc3a('0x4f')]['READ_COMMITTED']},function(_0xb43e2){return db[_0xbc3a('0x27')][_0xbc3a('0x50')]({'where':{'id':_0x2c48d3},'transaction':_0xb43e2})[_0xbc3a('0x21')](function(_0x40d37a){if(_0x40d37a){return db[_0xbc3a('0x27')][_0xbc3a('0x12')]({'where':{'VoiceExtensionId':_0x2c48d3},'transaction':_0xb43e2})[_0xbc3a('0x21')](function(){var _0x3f114e=_[_0xbc3a('0x1b')](_0x4be99a,function(_0x479e69){_0x479e69[_0xbc3a('0x51')]=_0x2c48d3;_0x479e69[_0xbc3a('0x52')]=!![];return _0x479e69;});return _0x40d37a[_0xbc3a('0x53')](_0x3f114e);})[_0xbc3a('0x21')](function(_0x311602){return db[_0xbc3a('0x27')][_0xbc3a('0x54')](_0x311602,{'transaction':_0xb43e2});});}else{_0x214371=0x194;_0x1e5406=[];}});})[_0xbc3a('0x21')](function(){if(_0x214371!==0x194){return db['VoiceExtension'][_0xbc3a('0x55')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2c48d3},'order':_0xbc3a('0x56')})[_0xbc3a('0x21')](function(_0x133411){_0x1e5406=_0x133411;});}})['catch'](function(_0x512260){_0x214371=0x1f4;logger[_0xbc3a('0x22')](_0x512260[_0xbc3a('0x23')]);if(_0x512260['name']){delete _0x512260[_0xbc3a('0x24')];}_0x1e5406=_0x512260;})['finally'](function(){if(_0x1e5406===null){_0x26270c['sendStatus'](_0x214371);}else{if(_0x214371===0x1f4){_0x26270c['status'](_0x214371)[_0xbc3a('0x25')](_0x1e5406);}else{_0x26270c[_0xbc3a('0xb')](_0x214371)[_0xbc3a('0xc')](_0x1e5406);}}});}; \ No newline at end of file +var _0x5c8e=['createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','send','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','ignore','includes','type','find','value','error','stack','name','index','VoiceExtension','rawAttributes','key','map','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','InternalRoutes','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp'];(function(_0x37ee53,_0x513761){var _0x4cde24=function(_0xc34ff6){while(--_0xc34ff6){_0x37ee53['push'](_0x37ee53['shift']());}};_0x4cde24(++_0x513761);}(_0x5c8e,0xc1));var _0xe5c8=function(_0x3ec8e,_0xb6aebd){_0x3ec8e=_0x3ec8e-0x0;var _0x330b6f=_0x5c8e[_0x3ec8e];return _0x330b6f;};'use strict';var _=require(_0xe5c8('0x0'));var Redis=require(_0xe5c8('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xe5c8('0x2'));var config=require(_0xe5c8('0x3'));var db=require(_0xe5c8('0x4'))['db'];config[_0xe5c8('0x5')]=_['defaults'](config[_0xe5c8('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xe5c8('0x6'))(new Redis(config[_0xe5c8('0x5')]));require(_0xe5c8('0x7'))[_0xe5c8('0x8')](socket);function respondWithStatusCode(_0x32d81e,_0x8449b2){_0x8449b2=_0x8449b2||0xcc;return function(_0x2b7dce){if(_0x2b7dce){return _0x32d81e[_0xe5c8('0x9')](_0x8449b2);}return _0x32d81e[_0xe5c8('0xa')](_0x8449b2)[_0xe5c8('0xb')]();};}function respondWithResult(_0x19f7bd,_0x2708e8){_0x2708e8=_0x2708e8||0xc8;return function(_0x583968){if(_0x583968){return _0x19f7bd[_0xe5c8('0xa')](_0x2708e8)[_0xe5c8('0xc')](_0x583968);}};}function respondWithFilteredResult(_0xd44d84,_0x52b1e0){return function(_0x1b743a){if(_0x1b743a){var _0x25a4c9=typeof _0x52b1e0['offset']==='undefined'&&typeof _0x52b1e0['limit']==='undefined';var _0x5beab5=_0x1b743a[_0xe5c8('0xd')];var _0x3c6f46=_0x25a4c9?0x0:_0x52b1e0[_0xe5c8('0xe')];var _0x17c6bd=_0x25a4c9?_0x1b743a['count']:_0x52b1e0[_0xe5c8('0xe')]+_0x52b1e0[_0xe5c8('0xf')];var _0x19ec37;if(_0x17c6bd>=_0x5beab5){_0x17c6bd=_0x5beab5;_0x19ec37=0xc8;}else{_0x19ec37=0xce;}_0xd44d84[_0xe5c8('0xa')](_0x19ec37);return _0xd44d84[_0xe5c8('0x10')](_0xe5c8('0x11'),_0x3c6f46+'-'+_0x17c6bd+'/'+_0x5beab5)[_0xe5c8('0xc')](_0x1b743a);}return null;};}function removeEntity(_0x1ececb){return function(_0x2fe195){if(_0x2fe195){return _0x2fe195[_0xe5c8('0x12')]()[_0xe5c8('0x13')](function(){var _0x490475=_0x2fe195[_0xe5c8('0x14')]({'plain':!![]});var _0x4b574c=[{'name':_0xe5c8('0x15'),'value':_0xe5c8('0x16'),'ignore':![]},{'name':_0xe5c8('0x17'),'value':_0xe5c8('0x18'),'ignore':![]},{'name':'InternalRoutes','value':_0xe5c8('0x19'),'ignore':![]}];var _0x1a93d5=_(_0x4b574c)['filter'](_0xe5c8('0x1a'))['map']('value')['value']();if(_[_0xe5c8('0x1b')](_0x1a93d5,_0x490475[_0xe5c8('0x1c')])){return;}var _0x53a1b3=_[_0xe5c8('0x1d')](_0x4b574c,[_0xe5c8('0x1e'),_0x490475[_0xe5c8('0x1c')]])['name'];return db['UserProfileResource'][_0xe5c8('0x12')]({'where':{'type':_0x53a1b3,'resourceId':_0x490475['id']}})[_0xe5c8('0x13')](function(){return _0x2fe195;});})[_0xe5c8('0x13')](function(){_0x1ececb['status'](0xcc)[_0xe5c8('0xb')]();});}};}function handleEntityNotFound(_0x29bc08){return function(_0xd83658){if(!_0xd83658){_0x29bc08[_0xe5c8('0x9')](0x194);}return _0xd83658;};}function handleError(_0x3b492f,_0x5089a1){_0x5089a1=_0x5089a1||0x1f4;return function(_0x111558){logger[_0xe5c8('0x1f')](_0x111558[_0xe5c8('0x20')]);if(_0x111558[_0xe5c8('0x21')]){delete _0x111558[_0xe5c8('0x21')];}_0x3b492f[_0xe5c8('0xa')](_0x5089a1)['send'](_0x111558);};}exports[_0xe5c8('0x22')]=function(_0x212545,_0xc812a6){var _0x29234a={},_0x19bf7a={},_0x47c854={'count':0x0,'rows':[]};var _0x3025d3=_['map'](db[_0xe5c8('0x23')][_0xe5c8('0x24')],function(_0xb7a9a9){return{'name':_0xb7a9a9['fieldName'],'type':_0xb7a9a9[_0xe5c8('0x1c')][_0xe5c8('0x25')]};});_0x19bf7a['model']=_[_0xe5c8('0x26')](_0x3025d3,_0xe5c8('0x21'));_0x19bf7a[_0xe5c8('0x27')]=_['keys'](_0x212545['query']);_0x19bf7a['filters']=_[_0xe5c8('0x28')](_0x19bf7a['model'],_0x19bf7a[_0xe5c8('0x27')]);_0x29234a[_0xe5c8('0x29')]=_[_0xe5c8('0x28')](_0x19bf7a[_0xe5c8('0x2a')],qs[_0xe5c8('0x2b')](_0x212545[_0xe5c8('0x27')]['fields']));_0x29234a['attributes']=_0x29234a[_0xe5c8('0x29')][_0xe5c8('0x2c')]?_0x29234a[_0xe5c8('0x29')]:_0x19bf7a[_0xe5c8('0x2a')];if(!_0x212545[_0xe5c8('0x27')][_0xe5c8('0x2d')](_0xe5c8('0x2e'))){_0x29234a[_0xe5c8('0xf')]=qs[_0xe5c8('0xf')](_0x212545['query']['limit']);_0x29234a[_0xe5c8('0xe')]=qs[_0xe5c8('0xe')](_0x212545[_0xe5c8('0x27')]['offset']);}_0x29234a[_0xe5c8('0x2f')]=qs['sort'](_0x212545[_0xe5c8('0x27')][_0xe5c8('0x30')]);_0x29234a['where']=qs[_0xe5c8('0x31')](_[_0xe5c8('0x32')](_0x212545[_0xe5c8('0x27')],_0x19bf7a[_0xe5c8('0x31')]),_0x3025d3);if(_0x212545[_0xe5c8('0x27')]['filter']){_0x29234a['where']=_['merge'](_0x29234a[_0xe5c8('0x33')],{'$or':_[_0xe5c8('0x26')](_0x3025d3,function(_0x25fa25){if(_0x25fa25[_0xe5c8('0x1c')]!=='VIRTUAL'){var _0x1fe8d3={};_0x1fe8d3[_0x25fa25[_0xe5c8('0x21')]]={'$like':'%'+_0x212545[_0xe5c8('0x27')][_0xe5c8('0x34')]+'%'};return _0x1fe8d3;}})});}_0x29234a=_[_0xe5c8('0x35')]({},_0x29234a,_0x212545[_0xe5c8('0x36')]);var _0x169d6f={'where':_0x29234a['where']};return db[_0xe5c8('0x23')][_0xe5c8('0xd')](_0x169d6f)[_0xe5c8('0x13')](function(_0x5027e6){_0x47c854[_0xe5c8('0xd')]=_0x5027e6;if(_0x212545[_0xe5c8('0x27')][_0xe5c8('0x37')]){_0x29234a[_0xe5c8('0x38')]=[{'all':!![]}];}return db[_0xe5c8('0x23')][_0xe5c8('0x39')](_0x29234a);})[_0xe5c8('0x13')](function(_0x2a57e6){_0x47c854[_0xe5c8('0x3a')]=_0x2a57e6;return _0x47c854;})[_0xe5c8('0x13')](respondWithFilteredResult(_0xc812a6,_0x29234a))['catch'](handleError(_0xc812a6,null));};exports[_0xe5c8('0x3b')]=function(_0x186602,_0x1b68b2){var _0xb74b1={'raw':![],'where':{'id':_0x186602[_0xe5c8('0x3c')]['id']}},_0x5c0c43={};_0x5c0c43['model']=_[_0xe5c8('0x3d')](db[_0xe5c8('0x23')]['rawAttributes']);_0x5c0c43['query']=_[_0xe5c8('0x3d')](_0x186602[_0xe5c8('0x27')]);_0x5c0c43[_0xe5c8('0x31')]=_['intersection'](_0x5c0c43[_0xe5c8('0x2a')],_0x5c0c43[_0xe5c8('0x27')]);_0xb74b1[_0xe5c8('0x29')]=_[_0xe5c8('0x28')](_0x5c0c43[_0xe5c8('0x2a')],qs[_0xe5c8('0x2b')](_0x186602[_0xe5c8('0x27')][_0xe5c8('0x2b')]));_0xb74b1[_0xe5c8('0x29')]=_0xb74b1[_0xe5c8('0x29')][_0xe5c8('0x2c')]?_0xb74b1[_0xe5c8('0x29')]:_0x5c0c43['model'];if(_0x186602['query'][_0xe5c8('0x37')]){_0xb74b1[_0xe5c8('0x38')]=[{'all':!![]}];}_0xb74b1=_['merge']({},_0xb74b1,_0x186602['options']);return db[_0xe5c8('0x23')][_0xe5c8('0x1d')](_0xb74b1)[_0xe5c8('0x13')](handleEntityNotFound(_0x1b68b2,null))['then'](respondWithResult(_0x1b68b2,null))[_0xe5c8('0x3e')](handleError(_0x1b68b2,null));};exports[_0xe5c8('0x12')]=function(_0x5cc100,_0x1312ea){return db[_0xe5c8('0x23')]['find']({'where':{'id':_0x5cc100[_0xe5c8('0x3c')]['id']}})[_0xe5c8('0x13')](handleEntityNotFound(_0x1312ea,null))[_0xe5c8('0x13')](removeEntity(_0x1312ea,null))['catch'](handleError(_0x1312ea,null));};exports[_0xe5c8('0x3f')]=function(_0x4e4b81,_0x3291c2){if(_0x4e4b81[_0xe5c8('0x40')][_0xe5c8('0x1c')]===_0xe5c8('0x18')&&!_[_0xe5c8('0x41')](_0x4e4b81[_0xe5c8('0x40')][_0xe5c8('0x42')],'_')){_0x4e4b81['body'][_0xe5c8('0x42')]='_'[_0xe5c8('0x43')](_0x4e4b81[_0xe5c8('0x40')][_0xe5c8('0x42')]);}return db[_0xe5c8('0x23')][_0xe5c8('0x3f')](_0x4e4b81['body'],{'raw':![]})[_0xe5c8('0x13')](function(_0x4a92a3){var _0x32b6b9=_0x4e4b81['user'][_0xe5c8('0x14')]({'plain':!![]});if(!_0x32b6b9)throw new Error(_0xe5c8('0x44'));if(_0x32b6b9['role']===_0xe5c8('0x45')){var _0x28c125=_0x4a92a3[_0xe5c8('0x14')]({'plain':!![]});var _0x1ea80c=[{'name':_0xe5c8('0x15'),'value':_0xe5c8('0x16')},{'name':_0xe5c8('0x17'),'value':_0xe5c8('0x18')},{'name':_0xe5c8('0x46'),'value':_0xe5c8('0x19')}];var _0x51c158=_[_0xe5c8('0x1d')](_0x1ea80c,[_0xe5c8('0x1e'),_0x28c125['type']])['name'];return db['UserProfileSection'][_0xe5c8('0x1d')]({'where':{'name':_0x51c158,'userProfileId':_0x32b6b9['userProfileId']},'raw':!![]})[_0xe5c8('0x13')](function(_0x4f9991){if(_0x4f9991&&_0x4f9991[_0xe5c8('0x47')]===0x0){return db[_0xe5c8('0x48')][_0xe5c8('0x3f')]({'name':_0x28c125[_0xe5c8('0x21')],'resourceId':_0x28c125['id'],'type':_0x4f9991[_0xe5c8('0x21')],'sectionId':_0x4f9991['id']},{})[_0xe5c8('0x13')](function(){return _0x4a92a3;});}else{return _0x4a92a3;}})['catch'](function(_0x5f3f44){logger['error'](_0xe5c8('0x49'),_0x5f3f44);throw _0x5f3f44;});}return _0x4a92a3;})[_0xe5c8('0x13')](respondWithResult(_0x3291c2,0xc9))[_0xe5c8('0x3e')](handleError(_0x3291c2,null));};exports[_0xe5c8('0x4a')]=function(_0x342100,_0x1d5770){if(_0x342100[_0xe5c8('0x40')]['id']){delete _0x342100[_0xe5c8('0x40')]['id'];}return db[_0xe5c8('0x23')][_0xe5c8('0x1d')]({'where':{'id':_0x342100[_0xe5c8('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1d5770,null))[_0xe5c8('0x13')](function(_0x139b51){if(_0x139b51){return db[_0xe5c8('0x23')][_0xe5c8('0x4a')](_[_0xe5c8('0x32')](_0x342100[_0xe5c8('0x40')],[_0xe5c8('0x42'),'context',_0xe5c8('0x4b'),_0xe5c8('0x4c'),_0xe5c8('0x4d'),_0xe5c8('0x4e'),_0xe5c8('0x4f')]),{'where':{'context':_0x139b51[_0xe5c8('0x50')],'exten':_0x139b51[_0xe5c8('0x42')]},'individualHooks':!![]})[_0xe5c8('0x13')](function(_0x6b36ec){return _0x6b36ec;});}return null;})[_0xe5c8('0x13')](respondWithStatusCode(_0x1d5770,null))[_0xe5c8('0x3e')](handleError(_0x1d5770,null));};exports[_0xe5c8('0x51')]=function(_0x4e9568,_0x3931c9){var _0x3e4621=_0x4e9568[_0xe5c8('0x3c')]['id'];var _0x16069d=_0x4e9568[_0xe5c8('0x40')];var _0x579330=0xc8;var _0x12212d=null;return db[_0xe5c8('0x52')][_0xe5c8('0x53')]({'isolationLevel':db['sequelize'][_0xe5c8('0x54')][_0xe5c8('0x55')]['READ_COMMITTED']},function(_0x89f41e){return db['VoiceExtension'][_0xe5c8('0x56')]({'where':{'id':_0x3e4621},'transaction':_0x89f41e})[_0xe5c8('0x13')](function(_0x341383){if(_0x341383){return db[_0xe5c8('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x3e4621},'transaction':_0x89f41e})[_0xe5c8('0x13')](function(){var _0x4dbde3=_[_0xe5c8('0x26')](_0x16069d,function(_0xedb798){_0xedb798[_0xe5c8('0x57')]=_0x3e4621;_0xedb798[_0xe5c8('0x58')]=!![];return _0xedb798;});return _0x341383[_0xe5c8('0x59')](_0x4dbde3);})['then'](function(_0x4e766b){return db[_0xe5c8('0x23')][_0xe5c8('0x5a')](_0x4e766b,{'transaction':_0x89f41e});});}else{_0x579330=0x194;_0x12212d=[];}});})[_0xe5c8('0x13')](function(){if(_0x579330!==0x194){return db[_0xe5c8('0x23')][_0xe5c8('0x5b')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3e4621},'order':_0xe5c8('0x5c')})['then'](function(_0x4374b0){_0x12212d=_0x4374b0;});}})[_0xe5c8('0x3e')](function(_0x13749a){_0x579330=0x1f4;logger[_0xe5c8('0x1f')](_0x13749a[_0xe5c8('0x20')]);if(_0x13749a[_0xe5c8('0x21')]){delete _0x13749a[_0xe5c8('0x21')];}_0x12212d=_0x13749a;})['finally'](function(){if(_0x12212d===null){_0x3931c9[_0xe5c8('0x9')](_0x579330);}else{if(_0x579330===0x1f4){_0x3931c9['status'](_0x579330)[_0xe5c8('0x5d')](_0x12212d);}else{_0x3931c9[_0xe5c8('0xa')](_0x579330)[_0xe5c8('0xc')](_0x12212d);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 42c12de..46c2fb6 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 _0x3c26=['../../mysqldb','VoiceExtension','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3c26,0x171));var _0x63c2=function(_0x220d65,_0x25aa6b){_0x220d65=_0x220d65-0x0;var _0x808a10=_0x3c26[_0x220d65];return _0x808a10;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x63c2('0x0'))['db'][_0x63c2('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x63c2('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x63c2('0x3'),'afterDestroy':_0x63c2('0x4')};function emitEvent(_0x4ee0d1){return function(_0x523064,_0xd5cb09,_0x44d778){VoiceExtensionEvents[_0x63c2('0x5')](_0x4ee0d1+':'+_0x523064['id'],_0x523064);VoiceExtensionEvents[_0x63c2('0x5')](_0x4ee0d1,_0x523064);_0x44d778(null);};}for(var e in events){if(events[_0x63c2('0x6')](e)){var event=events[e];VoiceExtension[_0x63c2('0x7')](e,emitEvent(event));}}module[_0x63c2('0x8')]=VoiceExtensionEvents; \ No newline at end of file +var _0xd569=['events','VoiceExtension','setMaxListeners','save','update','remove','emit','exports'];(function(_0x41a1b2,_0x1a50e5){var _0x4eca05=function(_0x3fd07c){while(--_0x3fd07c){_0x41a1b2['push'](_0x41a1b2['shift']());}};_0x4eca05(++_0x1a50e5);}(_0xd569,0x170));var _0x9d56=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0xd569[_0x1ac77b];return _0x161584;};'use strict';var EventEmitter=require(_0x9d56('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x9d56('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9d56('0x2')](0x0);var events={'afterCreate':_0x9d56('0x3'),'afterUpdate':_0x9d56('0x4'),'afterDestroy':_0x9d56('0x5')};function emitEvent(_0x300b44){return function(_0x1ac5f5,_0x1e7ddd,_0x2aaa28){VoiceExtensionEvents[_0x9d56('0x6')](_0x300b44+':'+_0x1ac5f5['id'],_0x1ac5f5);VoiceExtensionEvents[_0x9d56('0x6')](_0x300b44,_0x1ac5f5);_0x2aaa28(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x9d56('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c3bd46e..8294ad3 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 _0x971d=['map','filter','toLowerCase','tag','CDR(tag)=','ExecIf','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','playback','includes','app','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority','last','concat','catch','VoiceExtension','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','alias','NoOp','No\x20alias\x20set','push','inbound','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','options','split','length','name','param','phone','prefix','SIP','join','none','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','IntervalId','interval','intervals'];(function(_0x23e1fe,_0x42ee7d){var _0x496cb8=function(_0x2a37d7){while(--_0x2a37d7){_0x23e1fe['push'](_0x23e1fe['shift']());}};_0x496cb8(++_0x42ee7d);}(_0x971d,0xc5));var _0xd971=function(_0x1ef891,_0x36a321){_0x1ef891=_0x1ef891-0x0;var _0x5dc7c7=_0x971d[_0x1ef891];return _0x5dc7c7;};'use strict';var _=require(_0xd971('0x0'));var attributes=require(_0xd971('0x1'));module[_0xd971('0x2')]=function(_0x33d485){var _0x5e22cb=_0x33d485[_0xd971('0x3')];function _0x4a3823(_0x78272f){var _0x224a7a=0x2;var _0x271319=[{'type':_0x78272f[_0xd971('0x4')],'app':_0xd971('0x5'),'appdata':_0xd971('0x6')+_0x78272f[_0xd971('0x4')],'context':_0x78272f[_0xd971('0x7')],'exten':_0x78272f[_0xd971('0x8')],'priority':_0x224a7a++,'VoiceExtensionId':_0x78272f['id']},{'type':_0x78272f[_0xd971('0x4')],'app':_0x78272f[_0xd971('0x9')]?'Set':_0xd971('0xa'),'appdata':_0x78272f[_0xd971('0x9')]?'CDR(routeAlias)='+_0x78272f[_0xd971('0x9')]:_0xd971('0xb'),'context':_0x78272f[_0xd971('0x7')],'exten':_0x78272f[_0xd971('0x8')],'priority':_0x224a7a++,'VoiceExtensionId':_0x78272f['id']}];if(_0x78272f['type']==='inbound'){_0x271319[_0xd971('0xc')]({'type':_0xd971('0xd'),'app':_0xd971('0x5'),'appdata':_0xd971('0xe')+_0x78272f['id'],'context':_0x78272f['context'],'exten':_0x78272f[_0xd971('0x8')],'priority':_0x224a7a++,'VoiceExtensionId':_0x78272f['id']});}_0x271319['push']({'type':_0x78272f[_0xd971('0x4')],'app':_0xd971('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x78272f[_0xd971('0x7')],'exten':_0x78272f['exten'],'priority':_0x224a7a++,'VoiceExtensionId':_0x78272f['id']},{'type':_0x78272f[_0xd971('0x4')],'app':_0xd971('0x5'),'appdata':_0xd971('0xf'),'context':_0x78272f[_0xd971('0x7')],'exten':_0x78272f[_0xd971('0x8')],'priority':_0x224a7a++,'VoiceExtensionId':_0x78272f['id']},{'type':_0x78272f[_0xd971('0x4')],'app':'Set','appdata':_0xd971('0x10'),'context':_0x78272f['context'],'exten':_0x78272f[_0xd971('0x8')],'priority':_0x224a7a++,'VoiceExtensionId':_0x78272f['id']});return _0x271319;}function _0x3ff93e(_0x1e2037){var _0x499a31=0x2;var _0x2d92ca=[{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':_0xd971('0x12'),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037['exten'],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0x1e2037['alias']?'Set':_0xd971('0xa'),'appdata':_0x1e2037['alias']?_0xd971('0x13')+_0x1e2037['alias']:_0xd971('0xb'),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':_0xd971('0x14')+(_0x1e2037[_0xd971('0x15')]?_0xd971('0x16')+_0x1e2037[_0xd971('0x15')]+'}':_0xd971('0x17')),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':_0xd971('0xe')+_0x1e2037['id'],'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':'ExecIf','appdata':_0xd971('0x18')+(_0x499a31+0x2)+_0xd971('0x19')+(_0x499a31+0x1)+')','context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':_0x1e2037[_0xd971('0x15')]?_0xd971('0x1a')+_0x1e2037[_0xd971('0x15')]+'}':_0xd971('0x1b'),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1e2037['context'],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':'outbound','app':_0xd971('0x5'),'appdata':_0xd971('0x10'),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':'outboundrouteid='+_0x1e2037['id'],'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']}];if(_0x1e2037[_0xd971('0x1c')](_0xd971('0x1d'))&&_0x1e2037[_0xd971('0x1d')]!=='none'){_0x2d92ca['push']({'type':_0xd971('0x11'),'app':'Set','appdata':_0xd971('0x1e'),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037['exten'],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']},{'type':_0xd971('0x11'),'app':_0xd971('0x5'),'appdata':_0xd971('0x1f')+_0x1e2037[_0xd971('0x1d')]||_0xd971('0x20'),'context':_0x1e2037[_0xd971('0x7')],'exten':_0x1e2037[_0xd971('0x8')],'priority':_0x499a31++,'VoiceExtensionId':_0x1e2037['id']});}return _0x2d92ca;}function _0x55d2af(_0x382842,_0x22aa1d){var _0x5623b0=[{'name':_0xd971('0x21'),'param':0x0},{'name':_0xd971('0x22'),'param':0x1},{'name':_0xd971('0x23'),'param':0x2},{'name':'url','param':0x3}];var _0x262383={};var _0x3c2bf8=_0x22aa1d[_0xd971('0x24')](',');var _0x29ccbb=[];for(var _0x2355de=0x0;_0x2355de<_0x5623b0[_0xd971('0x25')];_0x2355de++){switch(_0x5623b0[_0x2355de][_0xd971('0x26')]){case _0xd971('0x21'):_0x262383['trunk']=_0x3c2bf8[_0x5623b0[_0x2355de][_0xd971('0x27')]][_0xd971('0x24')]('/')[0x1];_0x262383[_0xd971('0x28')]=_0x3c2bf8[_0x5623b0[_0x2355de][_0xd971('0x27')]]['split']('/')[0x2];_0x262383[_0xd971('0x29')]=_0x262383[_0xd971('0x28')]?_0x262383[_0xd971('0x28')][_0xd971('0x24')]('$')[0x0]:undefined;_0x262383[_0xd971('0x28')]=_0x382842[_0xd971('0x15')]?(_0x262383[_0xd971('0x29')]||'')+_0xd971('0x16')+_0x382842[_0xd971('0x15')]+'}':(_0x262383['prefix']||'')+_0xd971('0x17');_0x29ccbb[_0x5623b0[_0x2355de][_0xd971('0x27')]]=[_0xd971('0x2a'),_0x262383[_0xd971('0x21')],_0x262383[_0xd971('0x28')]][_0xd971('0x2b')]('/');break;case _0xd971('0x23'):_0x262383[_0xd971('0x23')]=_0x3c2bf8[_0x5623b0[_0x2355de][_0xd971('0x27')]];if(_0x382842[_0xd971('0x1d')]!==_0xd971('0x2c')){if(_0x262383[_0xd971('0x23')]['indexOf'](_0xd971('0x2d'))<0x0){_0x262383[_0xd971('0x23')]+=_0xd971('0x2d');}}else{_0x262383[_0xd971('0x23')]=_0x262383['options'][_0xd971('0x2e')](_0xd971('0x2d'),'');}_0x29ccbb[_0x5623b0[_0x2355de]['param']]=_0x262383[_0xd971('0x23')];break;default:_0x29ccbb[_0x5623b0[_0x2355de]['param']]=_0x3c2bf8[_0x5623b0[_0x2355de]['param']];}}return _0x29ccbb[_0xd971('0x2b')](',');}function _0x17d59e(_0x1150bc,_0x57cf41,_0x59414b){return new Promise(function(_0x548e14,_0x5f132b){var _0x3f9e9f=[];if(_[_0xd971('0x2f')](_0x57cf41))return _0x548e14(_0x3f9e9f);_0x5e22cb['Interval'][_0xd971('0x30')]({'attributes':['id','interval',_0xd971('0x31')],'raw':!![]})['then'](function(_0x3b8b25){for(var _0x505b47=0x0,_0x1a3cc4=0x0;_0x505b47<_0x57cf41[_0xd971('0x25')];_0x505b47++,_0x1a3cc4=0x0){var _0x454901=_0x57cf41[_0x505b47];var _0x833ffb=[];var _0x3c0b70=[];delete _0x454901['id'];if(_0x454901[_0xd971('0x32')]!=='*,*,*,*'){_0x454901[_0xd971('0x33')]=[_0x454901[_0xd971('0x32')]];}else{_0x454901[_0xd971('0x33')]=_0x454901[_0xd971('0x31')]?_[_0xd971('0x34')](_[_0xd971('0x35')](_0x3b8b25,{'IntervalId':_0x454901[_0xd971('0x31')]}),'interval'):[];}_0x454901[_0xd971('0x7')]=_0x1150bc[_0xd971('0x7')];_0x454901[_0xd971('0x8')]=_0x1150bc[_0xd971('0x8')];if(_0x454901[_0xd971('0x4')])_0x454901['type']=_0x454901[_0xd971('0x4')][_0xd971('0x36')]();if(_0x1150bc[_0xd971('0x4')]==='outbound'){if(_0x454901[_0xd971('0x1c')](_0xd971('0x37'))&&_0x454901[_0xd971('0x37')]&&_0x454901[_0xd971('0x37')]!=='--'){_0x833ffb[_0xd971('0xc')]({'type':_0x454901[_0xd971('0x4')]['toLowerCase'](),'app':_0xd971('0x5'),'appdata':_0xd971('0x38')+_0x454901[_0xd971('0x37')],'context':_0x1150bc['context'],'exten':_0x1150bc[_0xd971('0x8')],'priority':_0x454901[_0xd971('0x33')][_0xd971('0x25')]+_0x59414b+_0x1a3cc4++,'VoiceExtensionId':_0x1150bc['id']});}_0x833ffb[_0xd971('0xc')]({'type':_0x454901[_0xd971('0x4')]['toLowerCase'](),'app':_0xd971('0x39'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x454901['callerID']?_0xd971('0x3a')+_0x454901[_0xd971('0x3b')]+')':_0xd971('0x3c')),'context':_0x1150bc[_0xd971('0x7')],'exten':_0x1150bc[_0xd971('0x8')],'priority':_0x454901[_0xd971('0x33')]['length']+_0x59414b+_0x1a3cc4++,'VoiceExtensionId':_0x1150bc['id']});}else{if(_0x454901[_0xd971('0x1c')]('answer')){if(['queue',_0xd971('0x3d')][_0xd971('0x3e')](_0x454901[_0xd971('0x3f')]['toLowerCase']())&&_0x454901['appType']!=='custom'){if(_0x454901[_0xd971('0x40')]){_0x833ffb[_0xd971('0xc')]({'type':_0x454901['type'][_0xd971('0x36')](),'app':_0xd971('0x39'),'appdata':_0xd971('0x41'),'context':_0x1150bc[_0xd971('0x7')],'exten':_0x1150bc[_0xd971('0x8')],'priority':_0x454901[_0xd971('0x33')][_0xd971('0x25')]+_0x59414b+_0x1a3cc4++,'VoiceExtensionId':_0x1150bc['id']});_0x833ffb[_0xd971('0xc')]({'type':_0x454901[_0xd971('0x4')][_0xd971('0x36')](),'app':_0xd971('0x5'),'appdata':_0xd971('0x42'),'context':_0x1150bc[_0xd971('0x7')],'exten':_0x1150bc[_0xd971('0x8')],'priority':_0x454901['intervals']['length']+_0x59414b+_0x1a3cc4++,'VoiceExtensionId':_0x1150bc['id']});}else{_0x833ffb['push']({'type':_0x454901['type'][_0xd971('0x36')](),'app':'ExecIf','appdata':_0xd971('0x43'),'context':_0x1150bc[_0xd971('0x7')],'exten':_0x1150bc[_0xd971('0x8')],'priority':_0x454901[_0xd971('0x33')][_0xd971('0x25')]+_0x59414b+_0x1a3cc4++,'VoiceExtensionId':_0x1150bc['id']});_0x833ffb[_0xd971('0xc')]({'type':_0x454901['type'][_0xd971('0x36')](),'app':_0xd971('0x5'),'appdata':_0xd971('0x44'),'context':_0x1150bc['context'],'exten':_0x1150bc[_0xd971('0x8')],'priority':_0x454901['intervals'][_0xd971('0x25')]+_0x59414b+_0x1a3cc4++,'VoiceExtensionId':_0x1150bc['id']});}}}}for(var _0x21e039=0x0;_0x21e039<_0x454901[_0xd971('0x33')][_0xd971('0x25')];_0x21e039++){var _0x5c1a4e=_0x59414b+_0x454901[_0xd971('0x33')][_0xd971('0x25')];var _0x58432e=_0x21e039===_0x454901[_0xd971('0x33')]['length']-0x1?_0x59414b+_0x833ffb['length']+_0x3c0b70[_0xd971('0x25')]+0x2:_0x59414b+_0x21e039+0x1;_0x833ffb[_0xd971('0x45')](_0x21e039,0x0,{'type':_0x1150bc[_0xd971('0x4')],'app':_0xd971('0x46'),'appdata':_0x454901[_0xd971('0x33')][_0x21e039]+'?'+_0x1150bc[_0xd971('0x7')]+_0xd971('0x47')+_0x5c1a4e+':'+_0x1150bc['context']+_0xd971('0x47')+_0x58432e,'exten':_0x1150bc[_0xd971('0x8')],'context':_0x1150bc[_0xd971('0x7')],'priority':_0x59414b+_0x21e039,'VoiceExtensionId':_0x1150bc['id']});}if(_0x454901[_0xd971('0x48')]===_0xd971('0x49'))_0x454901[_0xd971('0x4a')]=_0x55d2af(_0x1150bc,_0x454901[_0xd971('0x4a')]);_0x454901[_0xd971('0x4b')]=_0x833ffb[_0xd971('0x25')]?_[_0xd971('0x4c')](_0x833ffb)[_0xd971('0x4b')]+0x1:_0x59414b;_0x3f9e9f=_[_0xd971('0x4d')](_0x3f9e9f,_0x833ffb,[_0x454901],_0x3c0b70);_0x59414b=_[_0xd971('0x4c')](_0x3f9e9f)[_0xd971('0x4b')]+0x1;}return _0x548e14(_0x3f9e9f);})[_0xd971('0x4e')](function(_0x1b5e4b){_0x5f132b(_0x1b5e4b);});});}return _0x33d485['define'](_0xd971('0x4f'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x21ccc6){var _0x17740f=this[_0xd971('0x50')]({'plain':!![]});var _0x700f69=_0x17740f[_0xd971('0x4')]===_0xd971('0x11')?_0x3ff93e(_0x17740f):_0x4a3823(_0x17740f);return _0x17d59e(_0x17740f,_0x21ccc6,_[_0xd971('0x4c')](_0x700f69)['priority']+0x1)[_0xd971('0x51')](function(_0x2cef11){var _0x54bbd2=_[_0xd971('0x4d')](_0x700f69,_0x2cef11);_0x54bbd2[_0xd971('0xc')]({'type':_0x17740f['type'],'app':_0xd971('0x52'),'exten':_0x17740f[_0xd971('0x8')],'context':_0x17740f[_0xd971('0x7')],'priority':_[_0xd971('0x4c')](_0x54bbd2)[_0xd971('0x4b')]+0x1,'VoiceExtensionId':_0x17740f['id']});return _0x54bbd2;});}}});}; \ No newline at end of file +var _0xd6d6=['NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','outboundDial','appdata','priority','concat','last','catch','define','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','alias','NoOp','No\x20alias\x20set','push','inbound','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','name','param','phone','prefix','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','replace','Interval','IntervalId','then','interval','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0xd6d6,0xbe));var _0x6d6d=function(_0x863b0e,_0x536678){_0x863b0e=_0x863b0e-0x0;var _0xe7b05c=_0xd6d6[_0x863b0e];return _0xe7b05c;};'use strict';var _=require(_0x6d6d('0x0'));var attributes=require(_0x6d6d('0x1'));module[_0x6d6d('0x2')]=function(_0x33226e){var _0x536523=_0x33226e[_0x6d6d('0x3')];function _0x3b743d(_0x1b8610){var _0x2a838a=0x2;var _0x5207c9=[{'type':_0x1b8610[_0x6d6d('0x4')],'app':_0x6d6d('0x5'),'appdata':'CDR(type)='+_0x1b8610[_0x6d6d('0x4')],'context':_0x1b8610[_0x6d6d('0x6')],'exten':_0x1b8610[_0x6d6d('0x7')],'priority':_0x2a838a++,'VoiceExtensionId':_0x1b8610['id']},{'type':_0x1b8610[_0x6d6d('0x4')],'app':_0x1b8610[_0x6d6d('0x8')]?_0x6d6d('0x5'):_0x6d6d('0x9'),'appdata':_0x1b8610['alias']?'CDR(routeAlias)='+_0x1b8610[_0x6d6d('0x8')]:_0x6d6d('0xa'),'context':_0x1b8610[_0x6d6d('0x6')],'exten':_0x1b8610[_0x6d6d('0x7')],'priority':_0x2a838a++,'VoiceExtensionId':_0x1b8610['id']}];if(_0x1b8610[_0x6d6d('0x4')]==='inbound'){_0x5207c9[_0x6d6d('0xb')]({'type':_0x6d6d('0xc'),'app':'Set','appdata':'CDR(routeid)='+_0x1b8610['id'],'context':_0x1b8610[_0x6d6d('0x6')],'exten':_0x1b8610[_0x6d6d('0x7')],'priority':_0x2a838a++,'VoiceExtensionId':_0x1b8610['id']});}_0x5207c9[_0x6d6d('0xb')]({'type':_0x1b8610[_0x6d6d('0x4')],'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0xd'),'context':_0x1b8610[_0x6d6d('0x6')],'exten':_0x1b8610[_0x6d6d('0x7')],'priority':_0x2a838a++,'VoiceExtensionId':_0x1b8610['id']},{'type':_0x1b8610['type'],'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0xe'),'context':_0x1b8610[_0x6d6d('0x6')],'exten':_0x1b8610[_0x6d6d('0x7')],'priority':_0x2a838a++,'VoiceExtensionId':_0x1b8610['id']},{'type':_0x1b8610[_0x6d6d('0x4')],'app':'Set','appdata':_0x6d6d('0xf'),'context':_0x1b8610['context'],'exten':_0x1b8610[_0x6d6d('0x7')],'priority':_0x2a838a++,'VoiceExtensionId':_0x1b8610['id']});return _0x5207c9;}function _0x2cbc86(_0x1cc02b){var _0x4bb3d1=0x2;var _0x499c2e=[{'type':_0x6d6d('0x10'),'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0x11'),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b['exten'],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':'outbound','app':_0x1cc02b[_0x6d6d('0x8')]?'Set':_0x6d6d('0x9'),'appdata':_0x1cc02b[_0x6d6d('0x8')]?_0x6d6d('0x12')+_0x1cc02b[_0x6d6d('0x8')]:_0x6d6d('0xa'),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0x13')+(_0x1cc02b[_0x6d6d('0x14')]?_0x6d6d('0x15')+_0x1cc02b[_0x6d6d('0x14')]+'}':_0x6d6d('0x16')),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':'Set','appdata':_0x6d6d('0x17')+_0x1cc02b['id'],'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':_0x6d6d('0x18'),'appdata':_0x6d6d('0x19')+(_0x4bb3d1+0x2)+'):Goto('+(_0x4bb3d1+0x1)+')','context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':_0x6d6d('0x5'),'appdata':_0x1cc02b[_0x6d6d('0x14')]?_0x6d6d('0x1a')+_0x1cc02b[_0x6d6d('0x14')]+'}':'CDR(prefix)=noprefix','context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':'outbound','app':'Set','appdata':_0x6d6d('0xd'),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':'outbound','app':_0x6d6d('0x5'),'appdata':_0x6d6d('0xe'),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0xf'),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':'Set','appdata':_0x6d6d('0x1b')+_0x1cc02b['id'],'context':_0x1cc02b['context'],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']}];if(_0x1cc02b[_0x6d6d('0x1c')](_0x6d6d('0x1d'))&&_0x1cc02b[_0x6d6d('0x1d')]!=='none'){_0x499c2e[_0x6d6d('0xb')]({'type':'outbound','app':_0x6d6d('0x5'),'appdata':_0x6d6d('0x1e'),'context':_0x1cc02b['context'],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']},{'type':_0x6d6d('0x10'),'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0x1f')+_0x1cc02b[_0x6d6d('0x1d')]||_0x6d6d('0x20'),'context':_0x1cc02b[_0x6d6d('0x6')],'exten':_0x1cc02b[_0x6d6d('0x7')],'priority':_0x4bb3d1++,'VoiceExtensionId':_0x1cc02b['id']});}return _0x499c2e;}function _0x243555(_0x1d0545,_0x2fcf88){var _0x3693da=[{'name':_0x6d6d('0x21'),'param':0x0},{'name':_0x6d6d('0x22'),'param':0x1},{'name':'options','param':0x2},{'name':_0x6d6d('0x23'),'param':0x3}];var _0xf98bfa={};var _0x3e2415=_0x2fcf88[_0x6d6d('0x24')](',');var _0x4acf0f=[];for(var _0x52481b=0x0;_0x52481b<_0x3693da[_0x6d6d('0x25')];_0x52481b++){switch(_0x3693da[_0x52481b][_0x6d6d('0x26')]){case _0x6d6d('0x21'):_0xf98bfa['trunk']=_0x3e2415[_0x3693da[_0x52481b][_0x6d6d('0x27')]][_0x6d6d('0x24')]('/')[0x1];_0xf98bfa[_0x6d6d('0x28')]=_0x3e2415[_0x3693da[_0x52481b][_0x6d6d('0x27')]]['split']('/')[0x2];_0xf98bfa['prefix']=_0xf98bfa['phone']?_0xf98bfa[_0x6d6d('0x28')][_0x6d6d('0x24')]('$')[0x0]:undefined;_0xf98bfa[_0x6d6d('0x28')]=_0x1d0545[_0x6d6d('0x14')]?(_0xf98bfa['prefix']||'')+_0x6d6d('0x15')+_0x1d0545[_0x6d6d('0x14')]+'}':(_0xf98bfa[_0x6d6d('0x29')]||'')+_0x6d6d('0x16');_0x4acf0f[_0x3693da[_0x52481b][_0x6d6d('0x27')]]=[_0x6d6d('0x2a'),_0xf98bfa['trunk'],_0xf98bfa[_0x6d6d('0x28')]][_0x6d6d('0x2b')]('/');break;case _0x6d6d('0x2c'):_0xf98bfa[_0x6d6d('0x2c')]=_0x3e2415[_0x3693da[_0x52481b][_0x6d6d('0x27')]];if(_0x1d0545[_0x6d6d('0x1d')]!==_0x6d6d('0x2d')){if(_0xf98bfa['options'][_0x6d6d('0x2e')](_0x6d6d('0x2f'))<0x0){_0xf98bfa[_0x6d6d('0x2c')]+=_0x6d6d('0x2f');}}else{_0xf98bfa[_0x6d6d('0x2c')]=_0xf98bfa['options'][_0x6d6d('0x30')](_0x6d6d('0x2f'),'');}_0x4acf0f[_0x3693da[_0x52481b]['param']]=_0xf98bfa[_0x6d6d('0x2c')];break;default:_0x4acf0f[_0x3693da[_0x52481b]['param']]=_0x3e2415[_0x3693da[_0x52481b][_0x6d6d('0x27')]];}}return _0x4acf0f[_0x6d6d('0x2b')](',');}function _0x5ef65a(_0x2c191b,_0x3324ec,_0x252cbe){return new Promise(function(_0x4041f3,_0xf7ea0d){var _0x513506=[];if(_['isEmpty'](_0x3324ec))return _0x4041f3(_0x513506);_0x536523[_0x6d6d('0x31')]['findAll']({'attributes':['id','interval',_0x6d6d('0x32')],'raw':!![]})[_0x6d6d('0x33')](function(_0x2f236a){for(var _0x49aa5d=0x0,_0x21589d=0x0;_0x49aa5d<_0x3324ec['length'];_0x49aa5d++,_0x21589d=0x0){var _0x1a2d4c=_0x3324ec[_0x49aa5d];var _0x26fc7c=[];var _0x1d3826=[];delete _0x1a2d4c['id'];if(_0x1a2d4c[_0x6d6d('0x34')]!==_0x6d6d('0x35')){_0x1a2d4c[_0x6d6d('0x36')]=[_0x1a2d4c[_0x6d6d('0x34')]];}else{_0x1a2d4c['intervals']=_0x1a2d4c[_0x6d6d('0x32')]?_[_0x6d6d('0x37')](_[_0x6d6d('0x38')](_0x2f236a,{'IntervalId':_0x1a2d4c[_0x6d6d('0x32')]}),_0x6d6d('0x34')):[];}_0x1a2d4c[_0x6d6d('0x6')]=_0x2c191b[_0x6d6d('0x6')];_0x1a2d4c[_0x6d6d('0x7')]=_0x2c191b[_0x6d6d('0x7')];if(_0x1a2d4c['type'])_0x1a2d4c['type']=_0x1a2d4c[_0x6d6d('0x4')][_0x6d6d('0x39')]();if(_0x2c191b[_0x6d6d('0x4')]===_0x6d6d('0x10')){if(_0x1a2d4c[_0x6d6d('0x1c')]('tag')&&_0x1a2d4c[_0x6d6d('0x3a')]&&_0x1a2d4c[_0x6d6d('0x3a')]!=='--'){_0x26fc7c[_0x6d6d('0xb')]({'type':_0x1a2d4c[_0x6d6d('0x4')][_0x6d6d('0x39')](),'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0x3b')+_0x1a2d4c[_0x6d6d('0x3a')],'context':_0x2c191b[_0x6d6d('0x6')],'exten':_0x2c191b[_0x6d6d('0x7')],'priority':_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')]+_0x252cbe+_0x21589d++,'VoiceExtensionId':_0x2c191b['id']});}_0x26fc7c['push']({'type':_0x1a2d4c[_0x6d6d('0x4')][_0x6d6d('0x39')](),'app':_0x6d6d('0x18'),'appdata':_0x6d6d('0x3c')+(_0x1a2d4c[_0x6d6d('0x3d')]?'Set(CALLERID(all)='+_0x1a2d4c[_0x6d6d('0x3d')]+')':_0x6d6d('0x3e')),'context':_0x2c191b[_0x6d6d('0x6')],'exten':_0x2c191b['exten'],'priority':_0x1a2d4c['intervals'][_0x6d6d('0x25')]+_0x252cbe+_0x21589d++,'VoiceExtensionId':_0x2c191b['id']});}else{if(_0x1a2d4c['hasOwnProperty'](_0x6d6d('0x3f'))){if([_0x6d6d('0x40'),_0x6d6d('0x41')][_0x6d6d('0x42')](_0x1a2d4c[_0x6d6d('0x43')][_0x6d6d('0x39')]())&&_0x1a2d4c[_0x6d6d('0x44')]!==_0x6d6d('0x45')){if(_0x1a2d4c[_0x6d6d('0x3f')]){_0x26fc7c[_0x6d6d('0xb')]({'type':_0x1a2d4c['type'][_0x6d6d('0x39')](),'app':_0x6d6d('0x18'),'appdata':_0x6d6d('0x46'),'context':_0x2c191b[_0x6d6d('0x6')],'exten':_0x2c191b[_0x6d6d('0x7')],'priority':_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')]+_0x252cbe+_0x21589d++,'VoiceExtensionId':_0x2c191b['id']});_0x26fc7c['push']({'type':_0x1a2d4c['type'][_0x6d6d('0x39')](),'app':_0x6d6d('0x5'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x2c191b[_0x6d6d('0x6')],'exten':_0x2c191b[_0x6d6d('0x7')],'priority':_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')]+_0x252cbe+_0x21589d++,'VoiceExtensionId':_0x2c191b['id']});}else{_0x26fc7c[_0x6d6d('0xb')]({'type':_0x1a2d4c[_0x6d6d('0x4')][_0x6d6d('0x39')](),'app':_0x6d6d('0x18'),'appdata':_0x6d6d('0x47'),'context':_0x2c191b[_0x6d6d('0x6')],'exten':_0x2c191b[_0x6d6d('0x7')],'priority':_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')]+_0x252cbe+_0x21589d++,'VoiceExtensionId':_0x2c191b['id']});_0x26fc7c[_0x6d6d('0xb')]({'type':_0x1a2d4c[_0x6d6d('0x4')]['toLowerCase'](),'app':_0x6d6d('0x5'),'appdata':_0x6d6d('0x48'),'context':_0x2c191b['context'],'exten':_0x2c191b[_0x6d6d('0x7')],'priority':_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')]+_0x252cbe+_0x21589d++,'VoiceExtensionId':_0x2c191b['id']});}}}}for(var _0x407357=0x0;_0x407357<_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')];_0x407357++){var _0x1c1d8d=_0x252cbe+_0x1a2d4c[_0x6d6d('0x36')][_0x6d6d('0x25')];var _0x5f1b29=_0x407357===_0x1a2d4c['intervals'][_0x6d6d('0x25')]-0x1?_0x252cbe+_0x26fc7c[_0x6d6d('0x25')]+_0x1d3826[_0x6d6d('0x25')]+0x2:_0x252cbe+_0x407357+0x1;_0x26fc7c['splice'](_0x407357,0x0,{'type':_0x2c191b['type'],'app':_0x6d6d('0x49'),'appdata':_0x1a2d4c['intervals'][_0x407357]+'?'+_0x2c191b[_0x6d6d('0x6')]+',${EXTEN},'+_0x1c1d8d+':'+_0x2c191b[_0x6d6d('0x6')]+_0x6d6d('0x4a')+_0x5f1b29,'exten':_0x2c191b[_0x6d6d('0x7')],'context':_0x2c191b[_0x6d6d('0x6')],'priority':_0x252cbe+_0x407357,'VoiceExtensionId':_0x2c191b['id']});}if(_0x1a2d4c[_0x6d6d('0x44')]===_0x6d6d('0x4b'))_0x1a2d4c['appdata']=_0x243555(_0x2c191b,_0x1a2d4c[_0x6d6d('0x4c')]);_0x1a2d4c['priority']=_0x26fc7c[_0x6d6d('0x25')]?_['last'](_0x26fc7c)[_0x6d6d('0x4d')]+0x1:_0x252cbe;_0x513506=_[_0x6d6d('0x4e')](_0x513506,_0x26fc7c,[_0x1a2d4c],_0x1d3826);_0x252cbe=_[_0x6d6d('0x4f')](_0x513506)[_0x6d6d('0x4d')]+0x1;}return _0x4041f3(_0x513506);})[_0x6d6d('0x50')](function(_0x163bb7){_0xf7ea0d(_0x163bb7);});});}return _0x33226e[_0x6d6d('0x51')]('VoiceExtension',attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x466a15){var _0x582380=this[_0x6d6d('0x52')]({'plain':!![]});var _0x53b77a=_0x582380[_0x6d6d('0x4')]===_0x6d6d('0x10')?_0x2cbc86(_0x582380):_0x3b743d(_0x582380);return _0x5ef65a(_0x582380,_0x466a15,_[_0x6d6d('0x4f')](_0x53b77a)[_0x6d6d('0x4d')]+0x1)[_0x6d6d('0x33')](function(_0x2ee7c9){var _0x5dd3b0=_[_0x6d6d('0x4e')](_0x53b77a,_0x2ee7c9);_0x5dd3b0[_0x6d6d('0xb')]({'type':_0x582380[_0x6d6d('0x4')],'app':_0x6d6d('0x53'),'exten':_0x582380[_0x6d6d('0x7')],'context':_0x582380[_0x6d6d('0x6')],'priority':_[_0x6d6d('0x4f')](_0x5dd3b0)['priority']+0x1,'VoiceExtensionId':_0x582380['id']});return _0x5dd3b0;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 83fca3d..3453607 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 _0x5f71=['../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceExtension','findAll','options','where','limit','map','attributes','include','GetVoiceExtension','lodash','moment','randomstring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5f71,0xc9));var _0x15f7=function(_0x38d0b7,_0x4320fa){_0x38d0b7=_0x38d0b7-0x0;var _0x394e61=_0x5f71[_0x38d0b7];return _0x394e61;};'use strict';var _=require(_0x15f7('0x0'));var util=require('util');var moment=require(_0x15f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x15f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x15f7('0x3'))(_0x15f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x15f7('0x5'));var client=jayson[_0x15f7('0x6')][_0x15f7('0x7')]({'port':0x232a});config[_0x15f7('0x8')]=_[_0x15f7('0x9')](config[_0x15f7('0x8')],{'host':_0x15f7('0xa'),'port':0x18eb});var socket=require(_0x15f7('0xb'))(new Redis(config[_0x15f7('0x8')]));require(_0x15f7('0xc'))[_0x15f7('0xd')](socket);function respondWithRpcPromise(_0x40dbfa,_0x4b53ab,_0x4f09e7){return new BPromise(function(_0x4fddfc,_0x121607){return client['request'](_0x40dbfa,_0x4f09e7)[_0x15f7('0xe')](function(_0x9cbf6){logger[_0x15f7('0xf')](_0x15f7('0x10'),_0x4b53ab,_0x15f7('0x11'));logger[_0x15f7('0x12')](_0x15f7('0x13'),_0x4b53ab,'request\x20sent',JSON[_0x15f7('0x14')](_0x9cbf6));if(_0x9cbf6[_0x15f7('0x15')]){if(_0x9cbf6[_0x15f7('0x15')]['code']===0x1f4){logger[_0x15f7('0x15')](_0x15f7('0x10'),_0x4b53ab,_0x9cbf6['error'][_0x15f7('0x16')]);return _0x121607(_0x9cbf6[_0x15f7('0x15')][_0x15f7('0x16')]);}logger[_0x15f7('0x15')](_0x15f7('0x10'),_0x4b53ab,_0x9cbf6[_0x15f7('0x15')][_0x15f7('0x16')]);return _0x4fddfc(_0x9cbf6['error'][_0x15f7('0x16')]);}else{logger[_0x15f7('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x4b53ab,_0x15f7('0x11'));_0x4fddfc(_0x9cbf6[_0x15f7('0x17')][_0x15f7('0x16')]);}})[_0x15f7('0x18')](function(_0x26627b){logger[_0x15f7('0x15')](_0x15f7('0x10'),_0x4b53ab,_0x26627b);_0x121607(_0x26627b);});});}exports['GetVoiceExtension']=function(_0x299fcf){var _0xb6ea4f=this;return new Promise(function(_0x1362e1,_0x422c6e){return db[_0x15f7('0x19')][_0x15f7('0x1a')]({'raw':_0x299fcf[_0x15f7('0x1b')]?_0x299fcf['options']['raw']===undefined?!![]:![]:!![],'where':_0x299fcf[_0x15f7('0x1b')]?_0x299fcf[_0x15f7('0x1b')][_0x15f7('0x1c')]||null:null,'attributes':_0x299fcf[_0x15f7('0x1b')]?_0x299fcf[_0x15f7('0x1b')]['attributes']||null:null,'limit':_0x299fcf[_0x15f7('0x1b')]?_0x299fcf['options'][_0x15f7('0x1d')]||null:null,'include':_0x299fcf[_0x15f7('0x1b')]?_0x299fcf['options']['include']?_[_0x15f7('0x1e')](_0x299fcf['options']['include'],function(_0x2928fa){return{'model':db[_0x2928fa['model']],'as':_0x2928fa['as'],'attributes':_0x2928fa[_0x15f7('0x1f')],'include':_0x2928fa[_0x15f7('0x20')]?_[_0x15f7('0x1e')](_0x2928fa[_0x15f7('0x20')],function(_0x2d4d2d){return{'model':db[_0x2d4d2d['model']],'as':_0x2d4d2d['as'],'attributes':_0x2d4d2d[_0x15f7('0x1f')],'include':_0x2d4d2d[_0x15f7('0x20')]?_[_0x15f7('0x1e')](_0x2d4d2d['include'],function(_0x4dd3d6){return{'model':db[_0x4dd3d6['model']],'as':_0x4dd3d6['as'],'attributes':_0x4dd3d6['attributes']};}):[]};}):[]};}):[]:[]})[_0x15f7('0xe')](function(_0x432384){logger[_0x15f7('0xf')](_0x15f7('0x21'),_0x299fcf);logger[_0x15f7('0x12')](_0x15f7('0x21'),_0x299fcf,JSON['stringify'](_0x432384));_0x1362e1(_0x432384);})['catch'](function(_0x31bf43){logger[_0x15f7('0x15')](_0x15f7('0x21'),_0x31bf43['message'],_0x299fcf);_0x422c6e(_0xb6ea4f[_0x15f7('0x15')](0x1f4,_0x31bf43['message']));});});}; \ No newline at end of file +var _0x9ade=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetVoiceExtension','VoiceExtension','options','raw','attributes','limit','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0xa63570,_0x19cefe){var _0x3c12c6=function(_0x2d7598){while(--_0x2d7598){_0xa63570['push'](_0xa63570['shift']());}};_0x3c12c6(++_0x19cefe);}(_0x9ade,0x8e));var _0xe9ad=function(_0x36f641,_0x1a3063){_0x36f641=_0x36f641-0x0;var _0x39b299=_0x9ade[_0x36f641];return _0x39b299;};'use strict';var _=require(_0xe9ad('0x0'));var util=require(_0xe9ad('0x1'));var moment=require(_0xe9ad('0x2'));var BPromise=require(_0xe9ad('0x3'));var rs=require(_0xe9ad('0x4'));var fs=require('fs');var Redis=require(_0xe9ad('0x5'));var db=require(_0xe9ad('0x6'))['db'];var utils=require(_0xe9ad('0x7'));var logger=require(_0xe9ad('0x8'))(_0xe9ad('0x9'));var config=require('../../config/environment');var jayson=require(_0xe9ad('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0xe9ad('0xb')]=_[_0xe9ad('0xc')](config[_0xe9ad('0xb')],{'host':_0xe9ad('0xd'),'port':0x18eb});var socket=require(_0xe9ad('0xe'))(new Redis(config[_0xe9ad('0xb')]));require(_0xe9ad('0xf'))[_0xe9ad('0x10')](socket);function respondWithRpcPromise(_0x3a8a47,_0x2fb264,_0x2aabf3){return new BPromise(function(_0x5c3981,_0x153f7e){return client[_0xe9ad('0x11')](_0x3a8a47,_0x2aabf3)['then'](function(_0x418e9d){logger[_0xe9ad('0x12')](_0xe9ad('0x13'),_0x2fb264,'request\x20sent');logger[_0xe9ad('0x14')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x2fb264,'request\x20sent',JSON[_0xe9ad('0x15')](_0x418e9d));if(_0x418e9d[_0xe9ad('0x16')]){if(_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x17')]===0x1f4){logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x18')]);return _0x153f7e(_0x418e9d['error'][_0xe9ad('0x18')]);}logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x418e9d[_0xe9ad('0x16')][_0xe9ad('0x18')]);return _0x5c3981(_0x418e9d[_0xe9ad('0x16')]['message']);}else{logger[_0xe9ad('0x12')](_0xe9ad('0x13'),_0x2fb264,_0xe9ad('0x19'));_0x5c3981(_0x418e9d[_0xe9ad('0x1a')][_0xe9ad('0x18')]);}})[_0xe9ad('0x1b')](function(_0x25ccc4){logger[_0xe9ad('0x16')](_0xe9ad('0x13'),_0x2fb264,_0x25ccc4);_0x153f7e(_0x25ccc4);});});}exports[_0xe9ad('0x1c')]=function(_0x4017a3){var _0x509fd8=this;return new Promise(function(_0x43f22d,_0x5e775f){return db[_0xe9ad('0x1d')]['findAll']({'raw':_0x4017a3[_0xe9ad('0x1e')]?_0x4017a3['options'][_0xe9ad('0x1f')]===undefined?!![]:![]:!![],'where':_0x4017a3[_0xe9ad('0x1e')]?_0x4017a3[_0xe9ad('0x1e')]['where']||null:null,'attributes':_0x4017a3['options']?_0x4017a3[_0xe9ad('0x1e')][_0xe9ad('0x20')]||null:null,'limit':_0x4017a3['options']?_0x4017a3[_0xe9ad('0x1e')][_0xe9ad('0x21')]||null:null,'include':_0x4017a3[_0xe9ad('0x1e')]?_0x4017a3['options'][_0xe9ad('0x22')]?_[_0xe9ad('0x23')](_0x4017a3[_0xe9ad('0x1e')][_0xe9ad('0x22')],function(_0x37e926){return{'model':db[_0x37e926['model']],'as':_0x37e926['as'],'attributes':_0x37e926[_0xe9ad('0x20')],'include':_0x37e926[_0xe9ad('0x22')]?_[_0xe9ad('0x23')](_0x37e926[_0xe9ad('0x22')],function(_0x20ee77){return{'model':db[_0x20ee77[_0xe9ad('0x24')]],'as':_0x20ee77['as'],'attributes':_0x20ee77['attributes'],'include':_0x20ee77['include']?_[_0xe9ad('0x23')](_0x20ee77['include'],function(_0x23cd32){return{'model':db[_0x23cd32[_0xe9ad('0x24')]],'as':_0x23cd32['as'],'attributes':_0x23cd32['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9ad('0x25')](function(_0x2cfbfd){logger[_0xe9ad('0x12')](_0xe9ad('0x1c'),_0x4017a3);logger[_0xe9ad('0x14')](_0xe9ad('0x1c'),_0x4017a3,JSON[_0xe9ad('0x15')](_0x2cfbfd));_0x43f22d(_0x2cfbfd);})['catch'](function(_0x193cf2){logger[_0xe9ad('0x16')](_0xe9ad('0x1c'),_0x193cf2[_0xe9ad('0x18')],_0x4017a3);_0x5e775f(_0x509fd8[_0xe9ad('0x16')](0x1f4,_0x193cf2[_0xe9ad('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index d41357a..51ef352 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0xaa1963,_0x5c4cc1){var _0x5a902e=function(_0x1084d4){while(--_0x1084d4){_0xaa1963['push'](_0xaa1963['shift']());}};_0x5a902e(++_0x5c4cc1);}(_0xf494,0x1c6));var _0x4f49=function(_0x2913c9,_0x40213d){_0x2913c9=_0x2913c9-0x0;var _0x39d430=_0xf494[_0x2913c9];return _0x39d430;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x0295=['emit','removeListener','register','voiceExtension:','./voiceExtension.events','update'];(function(_0x3a7fac,_0x3562bd){var _0x2c1e61=function(_0x1e1a30){while(--_0x1e1a30){_0x3a7fac['push'](_0x3a7fac['shift']());}};_0x2c1e61(++_0x3562bd);}(_0x0295,0x1f0));var _0x5029=function(_0x4fdb79,_0x12c116){_0x4fdb79=_0x4fdb79-0x0;var _0x3ec15b=_0x0295[_0x4fdb79];return _0x3ec15b;};'use strict';var VoiceExtensionEvents=require(_0x5029('0x0'));var events=['save','remove',_0x5029('0x1')];function createListener(_0x4f552a,_0x53c2e1){return function(_0x315589){_0x53c2e1[_0x5029('0x2')](_0x4f552a,_0x315589);};}function removeListener(_0x157a4f,_0x3d0af1){return function(){VoiceExtensionEvents[_0x5029('0x3')](_0x157a4f,_0x3d0af1);};}exports[_0x5029('0x4')]=function(_0x200217){for(var _0x215955=0x0,_0x5b3cd=events['length'];_0x215955<_0x5b3cd;_0x215955++){var _0x54978f=events[_0x215955];var _0x4ee867=createListener(_0x5029('0x5')+_0x54978f,_0x200217);VoiceExtensionEvents['on'](_0x54978f,_0x4ee867);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 2d26e8a..955c46b 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 _0x4888=['/:id/messages','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0x4888,0x198));var _0x8488=function(_0x1bba6c,_0x1f94cf){_0x1bba6c=_0x1bba6c-0x0;var _0x415735=_0x4888[_0x1bba6c];return _0x415735;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['getMessages']);router[_0x8488('0xd')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')]('/:id',auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x11')](_0x8488('0x12'),auth[_0x8488('0xa')](),controller['destroy']);module[_0x8488('0x13')]=router; \ No newline at end of file +var _0x66fa=['isAuthenticated','index','get','/:id','post','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xc376e1,_0x1a2b83){var _0x63e01c=function(_0x3cd0f8){while(--_0x3cd0f8){_0xc376e1['push'](_0xc376e1['shift']());}};_0x63e01c(++_0x1a2b83);}(_0x66fa,0x117));var _0xa66f=function(_0x2b5db1,_0x4c8026){_0x2b5db1=_0x2b5db1-0x0;var _0x410f6b=_0x66fa[_0x2b5db1];return _0x410f6b;};'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('./voiceMail.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xb')]('/:id/messages',auth[_0xa66f('0x9')](),controller['getMessages']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xe')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index f7322eb..0a9f18b 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 _0xd4fc=['email','string','trim','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xd4fc,0xd8));var _0xcd4f=function(_0x174d2e,_0x18e463){_0x174d2e=_0x174d2e-0x0;var _0x3fc354=_0xd4fc[_0x174d2e];return _0x3fc354;};'use strict';var Sequelize=require(_0xcd4f('0x0'));module['exports']={'customer_id':{'type':Sequelize[_0xcd4f('0x1')]},'context':{'type':Sequelize[_0xcd4f('0x1')],'defaultValue':_0xcd4f('0x2'),'unique':_0xcd4f('0x3')},'mailbox':{'type':Sequelize[_0xcd4f('0x1')],'defaultValue':'','allowNull':![],'unique':_0xcd4f('0x3')},'password':{'type':Sequelize[_0xcd4f('0x1')]},'fullname':{'type':Sequelize[_0xcd4f('0x1')]},'email':{'type':Sequelize[_0xcd4f('0x1')],'validate':{'isEmail':!![]},'set':function(_0x1ce6b6){this[_0xcd4f('0x4')](_0xcd4f('0x5'),typeof _0x1ce6b6===_0xcd4f('0x6')&&_0x1ce6b6[_0xcd4f('0x7')]()?_0x1ce6b6['trim']():null);}},'pager':{'type':Sequelize[_0xcd4f('0x1')]},'tz':{'type':Sequelize[_0xcd4f('0x1')],'defaultValue':'central'},'attach':{'type':Sequelize[_0xcd4f('0x8')]('yes','no'),'defaultValue':_0xcd4f('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xcd4f('0x8')](_0xcd4f('0x9'),'no'),'defaultValue':_0xcd4f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xcd4f('0x1')]},'callback':{'type':Sequelize[_0xcd4f('0x1')]},'review':{'type':Sequelize[_0xcd4f('0x8')](_0xcd4f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xcd4f('0x8')](_0xcd4f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xcd4f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xcd4f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xcd4f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xcd4f('0x8')](_0xcd4f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xcd4f('0x8')](_0xcd4f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xcd4f('0x8')]('yes','no'),'defaultValue':_0xcd4f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xcd4f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xcd4f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xcd4f('0x8')](_0xcd4f('0x9'),'no'),'defaultValue':_0xcd4f('0x9'),'allowNull':![]},'stamp':{'type':_0xcd4f('0xb')},'emailsubject':{'type':Sequelize[_0xcd4f('0x1')]},'emailbody':{'type':Sequelize[_0xcd4f('0x1')]},'maxsecs':{'type':Sequelize[_0xcd4f('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xcd4f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xcd4f('0xd')],'get':function(){return this[_0xcd4f('0xe')](_0xcd4f('0xf'))+_0xcd4f('0x10')+this[_0xcd4f('0xe')]('mailbox');}}}; \ No newline at end of file +var _0xb56e=['exports','STRING','contest_mailbox','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','mailbox','sequelize'];(function(_0x57961b,_0x549ebf){var _0x407742=function(_0x49be39){while(--_0x49be39){_0x57961b['push'](_0x57961b['shift']());}};_0x407742(++_0x549ebf);}(_0xb56e,0x15f));var _0xeb56=function(_0x5ae65f,_0x5966e3){_0x5ae65f=_0x5ae65f-0x0;var _0x479b25=_0xb56e[_0x5ae65f];return _0x479b25;};'use strict';var Sequelize=require(_0xeb56('0x0'));module[_0xeb56('0x1')]={'customer_id':{'type':Sequelize[_0xeb56('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0xeb56('0x3')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xeb56('0x3')},'password':{'type':Sequelize[_0xeb56('0x2')]},'fullname':{'type':Sequelize[_0xeb56('0x2')]},'email':{'type':Sequelize[_0xeb56('0x2')],'validate':{'isEmail':!![]},'set':function(_0x3749fe){this['setDataValue']('email',typeof _0x3749fe===_0xeb56('0x4')&&_0x3749fe[_0xeb56('0x5')]()?_0x3749fe['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xeb56('0x2')],'defaultValue':_0xeb56('0x6')},'attach':{'type':Sequelize[_0xeb56('0x7')]('yes','no'),'defaultValue':_0xeb56('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':_0xeb56('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xeb56('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xeb56('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':_0xeb56('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xeb56('0x7')](_0xeb56('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xeb56('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xeb56('0xa')},'emailsubject':{'type':Sequelize[_0xeb56('0x2')]},'emailbody':{'type':Sequelize[_0xeb56('0x2')]},'maxsecs':{'type':Sequelize[_0xeb56('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xeb56('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xeb56('0xc')],'get':function(){return this[_0xeb56('0xd')](_0xeb56('0xe'))+'\x20-\x20'+this[_0xeb56('0xd')](_0xeb56('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e5534c4..5270ac7 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 _0xb58b=['destroy','then','get','Voicemails','error','stack','name','send','index','VoiceMail','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','body','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update'];(function(_0x36909d,_0x2795f1){var _0x1fd29d=function(_0x27d0fa){while(--_0x27d0fa){_0x36909d['push'](_0x36909d['shift']());}};_0x1fd29d(++_0x2795f1);}(_0xb58b,0x1f1));var _0xbb58=function(_0x5c6bf6,_0x3869ed){_0x5c6bf6=_0x5c6bf6-0x0;var _0x42b3d8=_0xb58b[_0x5c6bf6];return _0x42b3d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb58('0x0'));var zipdir=require(_0xbb58('0x1'));var jsonpatch=require(_0xbb58('0x2'));var rp=require('request-promise');var moment=require(_0xbb58('0x3'));var BPromise=require(_0xbb58('0x4'));var Mustache=require('mustache');var util=require(_0xbb58('0x5'));var path=require('path');var sox=require(_0xbb58('0x6'));var csv=require(_0xbb58('0x7'));var ejs=require(_0xbb58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb58('0x9'));var squel=require(_0xbb58('0xa'));var crypto=require(_0xbb58('0xb'));var jsforce=require(_0xbb58('0xc'));var deskjs=require(_0xbb58('0xd'));var toCsv=require(_0xbb58('0x7'));var querystring=require(_0xbb58('0xe'));var Papa=require(_0xbb58('0xf'));var Redis=require(_0xbb58('0x10'));var authService=require(_0xbb58('0x11'));var qs=require(_0xbb58('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb58('0x13'));var logger=require('../../config/logger')(_0xbb58('0x14'));var utils=require(_0xbb58('0x15'));var config=require(_0xbb58('0x16'));var licenseUtil=require(_0xbb58('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe88799,_0x18810f){_0x18810f=_0x18810f||0xcc;return function(_0x4cda21){if(_0x4cda21){return _0xe88799[_0xbb58('0x18')](_0x18810f);}return _0xe88799[_0xbb58('0x19')](_0x18810f)[_0xbb58('0x1a')]();};}function respondWithResult(_0x3b9406,_0x19ceda){_0x19ceda=_0x19ceda||0xc8;return function(_0x58245f){if(_0x58245f){return _0x3b9406[_0xbb58('0x19')](_0x19ceda)[_0xbb58('0x1b')](_0x58245f);}};}function respondWithFilteredResult(_0x5f4751,_0x4ba30e){return function(_0x33c20f){if(_0x33c20f){var _0x445b1f=typeof _0x4ba30e[_0xbb58('0x1c')]==='undefined'&&typeof _0x4ba30e['limit']==='undefined';var _0x55156e=_0x33c20f[_0xbb58('0x1d')];var _0x3134ea=_0x445b1f?0x0:_0x4ba30e['offset'];var _0xbee66=_0x445b1f?_0x33c20f['count']:_0x4ba30e[_0xbb58('0x1c')]+_0x4ba30e[_0xbb58('0x1e')];var _0x3c33d9;if(_0xbee66>=_0x55156e){_0xbee66=_0x55156e;_0x3c33d9=0xc8;}else{_0x3c33d9=0xce;}_0x5f4751[_0xbb58('0x19')](_0x3c33d9);return _0x5f4751[_0xbb58('0x1f')](_0xbb58('0x20'),_0x3134ea+'-'+_0xbee66+'/'+_0x55156e)[_0xbb58('0x1b')](_0x33c20f);}return null;};}function patchUpdates(_0x497fd0){return function(_0x84f34){try{jsonpatch[_0xbb58('0x21')](_0x84f34,_0x497fd0,!![]);}catch(_0x3e64fe){return BPromise[_0xbb58('0x22')](_0x3e64fe);}return _0x84f34[_0xbb58('0x23')]();};}function saveUpdates(_0x5d4a91,_0x49453a){return function(_0x350be7){if(_0x350be7){return _0x350be7[_0xbb58('0x24')](_0x5d4a91)['then'](function(_0x27806d){return _0x27806d;});}return null;};}function removeEntity(_0x53b693,_0x21964d){return function(_0x287822){if(_0x287822){return _0x287822[_0xbb58('0x25')]()[_0xbb58('0x26')](function(){var _0x2d111c=_0x287822[_0xbb58('0x27')]({'plain':!![]});var _0x2d556a=_0xbb58('0x28');return db['UserProfileResource'][_0xbb58('0x25')]({'where':{'type':_0x2d556a,'resourceId':_0x2d111c['id']}})[_0xbb58('0x26')](function(){return _0x287822;});})[_0xbb58('0x26')](function(){_0x53b693[_0xbb58('0x19')](0xcc)[_0xbb58('0x1a')]();});}};}function handleEntityNotFound(_0x521d0c,_0x3608dc){return function(_0x2ce7c3){if(!_0x2ce7c3){_0x521d0c[_0xbb58('0x18')](0x194);}return _0x2ce7c3;};}function handleError(_0x2d5b39,_0xf6687e){_0xf6687e=_0xf6687e||0x1f4;return function(_0x28b3a3){logger[_0xbb58('0x29')](_0x28b3a3[_0xbb58('0x2a')]);if(_0x28b3a3[_0xbb58('0x2b')]){delete _0x28b3a3['name'];}_0x2d5b39[_0xbb58('0x19')](_0xf6687e)[_0xbb58('0x2c')](_0x28b3a3);};}exports[_0xbb58('0x2d')]=function(_0x3c9cee,_0x3304b9){var _0x9d379f={},_0x1ba526={},_0x643e0e={'count':0x0,'rows':[]};var _0x3f8db3=_['map'](db[_0xbb58('0x2e')][_0xbb58('0x2f')],function(_0x3edc34){return{'name':_0x3edc34[_0xbb58('0x30')],'type':_0x3edc34[_0xbb58('0x31')][_0xbb58('0x32')]};});_0x1ba526[_0xbb58('0x33')]=_[_0xbb58('0x34')](_0x3f8db3,_0xbb58('0x2b'));_0x1ba526[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3c9cee[_0xbb58('0x35')]);_0x1ba526[_0xbb58('0x37')]=_['intersection'](_0x1ba526['model'],_0x1ba526['query']);_0x9d379f[_0xbb58('0x38')]=_[_0xbb58('0x39')](_0x1ba526[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3a')]));_0x9d379f[_0xbb58('0x38')]=_0x9d379f[_0xbb58('0x38')]['length']?_0x9d379f[_0xbb58('0x38')]:_0x1ba526[_0xbb58('0x33')];if(!_0x3c9cee['query'][_0xbb58('0x3b')]('nolimit')){_0x9d379f[_0xbb58('0x1e')]=qs['limit'](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1e')]);_0x9d379f['offset']=qs[_0xbb58('0x1c')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x1c')]);}_0x9d379f[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x3d')]);_0x9d379f[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3c9cee[_0xbb58('0x35')],_0x1ba526[_0xbb58('0x37')]),_0x3f8db3);if(_0x3c9cee['query']['filter']){_0x9d379f[_0xbb58('0x3e')]=_['merge'](_0x9d379f[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x3f8db3,function(_0x2ab2d8){if(_0x2ab2d8['type']!=='VIRTUAL'){var _0xc29171={};_0xc29171[_0x2ab2d8[_0xbb58('0x2b')]]={'$like':'%'+_0x3c9cee[_0xbb58('0x35')][_0xbb58('0x40')]+'%'};return _0xc29171;}})});}_0x9d379f=_[_0xbb58('0x41')]({},_0x9d379f,_0x3c9cee[_0xbb58('0x42')]);var _0x5797e7={'where':_0x9d379f[_0xbb58('0x3e')]};return db[_0xbb58('0x2e')][_0xbb58('0x1d')](_0x5797e7)[_0xbb58('0x26')](function(_0x1185b3){_0x643e0e[_0xbb58('0x1d')]=_0x1185b3;if(_0x3c9cee['query'][_0xbb58('0x43')]){_0x9d379f['include']=[{'all':!![]}];}return db[_0xbb58('0x2e')][_0xbb58('0x44')](_0x9d379f);})[_0xbb58('0x26')](function(_0x45817f){_0x643e0e['rows']=_0x45817f;return _0x643e0e;})[_0xbb58('0x26')](respondWithFilteredResult(_0x3304b9,_0x9d379f))[_0xbb58('0x45')](handleError(_0x3304b9,null));};exports[_0xbb58('0x46')]=function(_0x3a732c,_0x5b95f7){var _0x2ecc1b={'raw':!![],'where':{'id':_0x3a732c[_0xbb58('0x47')]['id']}},_0x5250e0={};_0x5250e0[_0xbb58('0x33')]=_[_0xbb58('0x36')](db[_0xbb58('0x2e')][_0xbb58('0x2f')]);_0x5250e0[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3a732c[_0xbb58('0x35')]);_0x5250e0[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x5250e0[_0xbb58('0x33')],_0x5250e0[_0xbb58('0x35')]);_0x2ecc1b[_0xbb58('0x38')]=_['intersection'](_0x5250e0[_0xbb58('0x33')],qs['fields'](_0x3a732c['query'][_0xbb58('0x3a')]));_0x2ecc1b[_0xbb58('0x38')]=_0x2ecc1b[_0xbb58('0x38')][_0xbb58('0x48')]?_0x2ecc1b[_0xbb58('0x38')]:_0x5250e0[_0xbb58('0x33')];if(_0x3a732c[_0xbb58('0x35')][_0xbb58('0x43')]){_0x2ecc1b[_0xbb58('0x49')]=[{'all':!![]}];}_0x2ecc1b=_[_0xbb58('0x41')]({},_0x2ecc1b,_0x3a732c[_0xbb58('0x42')]);return db['VoiceMail'][_0xbb58('0x4a')](_0x2ecc1b)[_0xbb58('0x26')](handleEntityNotFound(_0x5b95f7,null))['then'](respondWithResult(_0x5b95f7,null))[_0xbb58('0x45')](handleError(_0x5b95f7,null));};exports[_0xbb58('0x4b')]=function(_0xf94897,_0xdb0ff7){return db['VoiceMail'][_0xbb58('0x4b')](_0xf94897['body'],{})[_0xbb58('0x26')](function(_0x336598){var _0x471917=_0xf94897['user'][_0xbb58('0x27')]({'plain':!![]});if(!_0x471917)throw new Error(_0xbb58('0x4c'));if(_0x471917['role']===_0xbb58('0x4d')){var _0x4ca201=_0x336598[_0xbb58('0x27')]({'plain':!![]});var _0x2d81e0=_0xbb58('0x28');return db[_0xbb58('0x4e')][_0xbb58('0x4a')]({'where':{'name':_0x2d81e0,'userProfileId':_0x471917[_0xbb58('0x4f')]},'raw':!![]})[_0xbb58('0x26')](function(_0x4cb975){if(_0x4cb975&&_0x4cb975[_0xbb58('0x50')]===0x0){return db[_0xbb58('0x51')]['create']({'name':_0x4ca201[_0xbb58('0x2b')],'resourceId':_0x4ca201['id'],'type':_0x4cb975[_0xbb58('0x2b')],'sectionId':_0x4cb975['id']},{})['then'](function(){return _0x336598;});}else{return _0x336598;}})[_0xbb58('0x45')](function(_0x44636b){logger[_0xbb58('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x44636b);throw _0x44636b;});}return _0x336598;})[_0xbb58('0x26')](respondWithResult(_0xdb0ff7,0xc9))[_0xbb58('0x45')](handleError(_0xdb0ff7,null));};exports[_0xbb58('0x24')]=function(_0x592879,_0x537ed5){if(_0x592879['body']['id']){delete _0x592879[_0xbb58('0x52')]['id'];}return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x592879['params']['id']}})['then'](handleEntityNotFound(_0x537ed5,null))[_0xbb58('0x26')](saveUpdates(_0x592879[_0xbb58('0x52')],null))[_0xbb58('0x26')](respondWithResult(_0x537ed5,null))[_0xbb58('0x45')](handleError(_0x537ed5,null));};exports[_0xbb58('0x25')]=function(_0x5290be,_0x362b91){return db[_0xbb58('0x2e')][_0xbb58('0x4a')]({'where':{'id':_0x5290be['params']['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x362b91,null))[_0xbb58('0x26')](removeEntity(_0x362b91,null))[_0xbb58('0x45')](handleError(_0x362b91,null));};exports[_0xbb58('0x53')]=function(_0x3f5add,_0x5e7ae0,_0x1174b1){return db[_0xbb58('0x2e')][_0xbb58('0x54')]({'where':{'id':_0x3f5add[_0xbb58('0x47')]['id']}})[_0xbb58('0x26')](handleEntityNotFound(_0x5e7ae0,null))[_0xbb58('0x26')](function(_0x85278c){var _0x58ced2;var _0x55d5be={},_0x344b0d={};_0x344b0d['model']=_[_0xbb58('0x36')](db[_0xbb58('0x55')][_0xbb58('0x2f')]);_0x344b0d[_0xbb58('0x35')]=_[_0xbb58('0x36')](_0x3f5add[_0xbb58('0x35')]);_0x344b0d[_0xbb58('0x37')]=_[_0xbb58('0x39')](_0x344b0d[_0xbb58('0x33')],_0x344b0d[_0xbb58('0x35')]);_0x55d5be[_0xbb58('0x38')]=_['intersection'](_0x344b0d[_0xbb58('0x33')],qs[_0xbb58('0x3a')](_0x3f5add[_0xbb58('0x35')]['fields']));_0x55d5be[_0xbb58('0x38')]=_0x55d5be['attributes'][_0xbb58('0x48')]?_0x55d5be[_0xbb58('0x38')]:_0x344b0d['model'];if(!_0x3f5add[_0xbb58('0x35')][_0xbb58('0x3b')](_0xbb58('0x56'))){_0x55d5be[_0xbb58('0x1e')]=qs[_0xbb58('0x1e')](_0x3f5add['query']['limit']);_0x55d5be[_0xbb58('0x1c')]=qs[_0xbb58('0x1c')](_0x3f5add[_0xbb58('0x35')]['offset']);}_0x55d5be[_0xbb58('0x3c')]=qs[_0xbb58('0x3d')](_0x3f5add['query'][_0xbb58('0x3d')]);_0x55d5be[_0xbb58('0x3e')]=qs['filters'](_[_0xbb58('0x3f')](_0x3f5add[_0xbb58('0x35')],_0x344b0d[_0xbb58('0x37')]));if(_0x3f5add[_0xbb58('0x35')][_0xbb58('0x40')]){_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'$or':_[_0xbb58('0x34')](_0x55d5be[_0xbb58('0x38')],function(_0x2c9093){var _0x5e17fc={};_0x5e17fc[_0x2c9093]={'$like':'%'+_0x3f5add['query'][_0xbb58('0x40')]+'%'};return _0x5e17fc;})});}_0x55d5be['where']=_[_0xbb58('0x41')](_0x55d5be[_0xbb58('0x3e')],{'mailboxuser':_0x85278c[_0xbb58('0x57')]});_0x55d5be=_[_0xbb58('0x41')]({},_0x55d5be,_0x3f5add[_0xbb58('0x42')]);return db[_0xbb58('0x55')][_0xbb58('0x58')](_0x55d5be)[_0xbb58('0x26')](respondWithFilteredResult(_0x5e7ae0,_0x55d5be));})[_0xbb58('0x45')](handleError(_0x5e7ae0,null));}; \ No newline at end of file +var _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x2ec823,_0x3d97fd){var _0x35e778=function(_0xbb312f){while(--_0xbb312f){_0x2ec823['push'](_0x2ec823['shift']());}};_0x35e778(++_0x3d97fd);}(_0x9c00,0x1a0));var _0x09c0=function(_0x4e7551,_0x398ee5){_0x4e7551=_0x4e7551-0x0;var _0x2c2ae8=_0x9c00[_0x4e7551];return _0x2c2ae8;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 89877ee..887cee7 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 _0x455c=['define','VoiceMail','voice_voicemail','mailbox_context','util','api','bluebird','request-promise','path','rimraf','./voiceMail.attributes','exports'];(function(_0x1dd712,_0x33e5f8){var _0x5c1059=function(_0xa30dde){while(--_0xa30dde){_0x1dd712['push'](_0x1dd712['shift']());}};_0x5c1059(++_0x33e5f8);}(_0x455c,0x1f0));var _0xc455=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0x455c[_0x38ced4];return _0x547c07;};'use strict';var _=require('lodash');var util=require(_0xc455('0x0'));var logger=require('../../config/logger')(_0xc455('0x1'));var moment=require('moment');var BPromise=require(_0xc455('0x2'));var rp=require(_0xc455('0x3'));var fs=require('fs');var path=require(_0xc455('0x4'));var rimraf=require(_0xc455('0x5'));var config=require('../../config/environment');var attributes=require(_0xc455('0x6'));module[_0xc455('0x7')]=function(_0x2ad71a,_0xbade5){return _0x2ad71a[_0xc455('0x8')](_0xc455('0x9'),attributes,{'tableName':_0xc455('0xa'),'paranoid':![],'indexes':[{'name':_0xc455('0xb'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe128=['lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context'];(function(_0x2d9be7,_0x38afd1){var _0x58ac74=function(_0x154981){while(--_0x154981){_0x2d9be7['push'](_0x2d9be7['shift']());}};_0x58ac74(++_0x38afd1);}(_0xe128,0xf0));var _0x8e12=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0xe128[_0x3f8282];return _0x50f918;};'use strict';var _=require(_0x8e12('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8e12('0x1'));var moment=require('moment');var BPromise=require(_0x8e12('0x2'));var rp=require(_0x8e12('0x3'));var fs=require('fs');var path=require(_0x8e12('0x4'));var rimraf=require(_0x8e12('0x5'));var config=require(_0x8e12('0x6'));var attributes=require(_0x8e12('0x7'));module[_0x8e12('0x8')]=function(_0x5d04b6,_0x57b731){return _0x5d04b6[_0x8e12('0x9')](_0x8e12('0xa'),attributes,{'tableName':_0x8e12('0xb'),'paranoid':![],'indexes':[{'name':_0x8e12('0xc'),'fields':[_0x8e12('0xd'),_0x8e12('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 3556664..0ce2097 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 _0x53ec=['http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x53ec,0xaf));var _0xc53e=function(_0x1c3331,_0x49ecd7){_0x1c3331=_0x1c3331-0x0;var _0x4a2b9f=_0x53ec[_0x1c3331];return _0x4a2b9f;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc53e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x5'));var logger=require(_0xc53e('0x6'))('rpc');var config=require(_0xc53e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x8')][_0xc53e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2df8f2,_0x5b2f38,_0x55ad03){return new BPromise(function(_0x22f8ab,_0x4ec49d){return client[_0xc53e('0xa')](_0x2df8f2,_0x55ad03)[_0xc53e('0xb')](function(_0x33f449){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x5b2f38,_0xc53e('0xe'));logger[_0xc53e('0xf')](_0xc53e('0x10'),_0x5b2f38,_0xc53e('0xe'),JSON[_0xc53e('0x11')](_0x33f449));if(_0x33f449['error']){if(_0x33f449[_0xc53e('0x12')][_0xc53e('0x13')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x5b2f38,_0x33f449[_0xc53e('0x12')]['message']);return _0x4ec49d(_0x33f449[_0xc53e('0x12')]['message']);}logger['error'](_0xc53e('0xd'),_0x5b2f38,_0x33f449[_0xc53e('0x12')]['message']);return _0x22f8ab(_0x33f449[_0xc53e('0x12')]['message']);}else{logger['info'](_0xc53e('0xd'),_0x5b2f38,_0xc53e('0xe'));_0x22f8ab(_0x33f449[_0xc53e('0x14')][_0xc53e('0x15')]);}})[_0xc53e('0x16')](function(_0x1dd78d){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x5b2f38,_0x1dd78d);_0x4ec49d(_0x1dd78d);});});} \ No newline at end of file +var _0x6310=['request\x20sent','debug','stringify','error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s'];(function(_0xcfeb13,_0x58814e){var _0x368e52=function(_0xa1e3bd){while(--_0xa1e3bd){_0xcfeb13['push'](_0xcfeb13['shift']());}};_0x368e52(++_0x58814e);}(_0x6310,0x197));var _0x0631=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6310[_0x1ccdf7];return _0x52a0ae;};'use strict';var _=require(_0x0631('0x0'));var util=require('util');var moment=require(_0x0631('0x1'));var BPromise=require(_0x0631('0x2'));var rs=require(_0x0631('0x3'));var fs=require('fs');var Redis=require(_0x0631('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0631('0x5'));var logger=require('../../config/logger')(_0x0631('0x6'));var config=require(_0x0631('0x7'));var jayson=require(_0x0631('0x8'));var client=jayson[_0x0631('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x284cfa,_0xc44613,_0x1ee5b5){return new BPromise(function(_0x135467,_0xc851c5){return client[_0x0631('0xa')](_0x284cfa,_0x1ee5b5)[_0x0631('0xb')](function(_0x876ad){logger['info'](_0x0631('0xc'),_0xc44613,_0x0631('0xd'));logger[_0x0631('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0xc44613,_0x0631('0xd'),JSON[_0x0631('0xf')](_0x876ad));if(_0x876ad[_0x0631('0x10')]){if(_0x876ad[_0x0631('0x10')]['code']===0x1f4){logger[_0x0631('0x10')](_0x0631('0xc'),_0xc44613,_0x876ad[_0x0631('0x10')][_0x0631('0x11')]);return _0xc851c5(_0x876ad[_0x0631('0x10')][_0x0631('0x11')]);}logger[_0x0631('0x10')](_0x0631('0xc'),_0xc44613,_0x876ad[_0x0631('0x10')]['message']);return _0x135467(_0x876ad[_0x0631('0x10')]['message']);}else{logger[_0x0631('0x12')]('VoiceMail,\x20%s,\x20%s',_0xc44613,'request\x20sent');_0x135467(_0x876ad['result'][_0x0631('0x11')]);}})[_0x0631('0x13')](function(_0x4cb38e){logger['error'](_0x0631('0xc'),_0xc44613,_0x4cb38e);_0xc851c5(_0x4cb38e);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index fd4a214..c2b8d3a 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 _0x3873=['../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3184bf,_0x302c1d){var _0x2c5f00=function(_0x4fbe5c){while(--_0x4fbe5c){_0x3184bf['push'](_0x3184bf['shift']());}};_0x2c5f00(++_0x302c1d);}(_0x3873,0xf4));var _0x3387=function(_0x2e4574,_0x2e7660){_0x2e4574=_0x2e4574-0x0;var _0x15d5a5=_0x3873[_0x2e4574];return _0x15d5a5;};'use strict';var multer=require(_0x3387('0x0'));var util=require(_0x3387('0x1'));var path=require(_0x3387('0x2'));var timeout=require(_0x3387('0x3'));var express=require(_0x3387('0x4'));var router=express[_0x3387('0x5')]();var fs_extra=require(_0x3387('0x6'));var auth=require(_0x3387('0x7'));var interaction=require(_0x3387('0x8'));var config=require(_0x3387('0x9'));var controller=require(_0x3387('0xa'));router['get']('/',auth[_0x3387('0xb')](),controller[_0x3387('0xc')]);router[_0x3387('0xd')](_0x3387('0xe'),auth[_0x3387('0xb')](),controller[_0x3387('0xf')]);router[_0x3387('0xd')](_0x3387('0x10'),auth[_0x3387('0xb')](),controller['download']);router[_0x3387('0x11')]('/',auth[_0x3387('0xb')](),controller['create']);router['put']('/:id',auth[_0x3387('0xb')](),controller[_0x3387('0x12')]);router['delete'](_0x3387('0xe'),auth[_0x3387('0xb')](),controller[_0x3387('0x13')]);module[_0x3387('0x14')]=router; \ No newline at end of file +var _0x5c66=['/:id','/:id/download','download','post','create','put','delete','destroy','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index'];(function(_0x120382,_0x419928){var _0x12903c=function(_0x1505c3){while(--_0x1505c3){_0x120382['push'](_0x120382['shift']());}};_0x12903c(++_0x419928);}(_0x5c66,0x6e));var _0x65c6=function(_0x41fc79,_0x1d5205){_0x41fc79=_0x41fc79-0x0;var _0x59ff40=_0x5c66[_0x41fc79];return _0x59ff40;};'use strict';var multer=require(_0x65c6('0x0'));var util=require('util');var path=require(_0x65c6('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x65c6('0x2'));var auth=require(_0x65c6('0x3'));var interaction=require(_0x65c6('0x4'));var config=require('../../config/environment');var controller=require(_0x65c6('0x5'));router[_0x65c6('0x6')]('/',auth[_0x65c6('0x7')](),controller[_0x65c6('0x8')]);router[_0x65c6('0x6')](_0x65c6('0x9'),auth[_0x65c6('0x7')](),controller['show']);router['get'](_0x65c6('0xa'),auth['isAuthenticated'](),controller[_0x65c6('0xb')]);router[_0x65c6('0xc')]('/',auth[_0x65c6('0x7')](),controller[_0x65c6('0xd')]);router[_0x65c6('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x65c6('0xf')]('/:id',auth[_0x65c6('0x7')](),controller[_0x65c6('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 7af772b..d03bebb 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 _0xd587=['getDataValue','INTEGER','STRING','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd587,0x167));var _0x7d58=function(_0xa8315f,_0x574184){_0xa8315f=_0xa8315f-0x0;var _0x2a85f9=_0xd587[_0xa8315f];return _0x2a85f9;};'use strict';var Sequelize=require(_0x7d58('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x515aa5){return this[_0x7d58('0x1')]('id');}},'msgnum':{'type':Sequelize[_0x7d58('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x7d58('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x7d58('0x3')],'defaultValue':''},'stamp':{'type':_0x7d58('0x5'),'defaultValue':Sequelize[_0x7d58('0x6')](_0x7d58('0x7'))}}; \ No newline at end of file +var _0x713e=['CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x48475b,_0x4d3077){var _0x3b241a=function(_0x5c4a49){while(--_0x5c4a49){_0x48475b['push'](_0x48475b['shift']());}};_0x3b241a(++_0x4d3077);}(_0x713e,0x1a9));var _0xe713=function(_0xe9f4a2,_0x50f0c4){_0xe9f4a2=_0xe9f4a2-0x0;var _0x25e066=_0x713e[_0xe9f4a2];return _0x25e066;};'use strict';var Sequelize=require(_0xe713('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x46e7cc){return this[_0xe713('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xe713('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0xe713('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xe713('0x3')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xe713('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xe713('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xe713('0x4')](_0xe713('0x5')),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xe713('0x3')],'defaultValue':''},'stamp':{'type':_0xe713('0x6'),'defaultValue':Sequelize['literal'](_0xe713('0x7'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6f56bb3..5d47696 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 _0x4c92=['rows','catch','show','params','keys','length','options','find','create','body','destroy','download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','set','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','update','then','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','filter','merge','type','VIRTUAL','VoiceMailMessage','includeAll','include','findAll'];(function(_0x3880b3,_0x4b148e){var _0x2a73c1=function(_0x369826){while(--_0x369826){_0x3880b3['push'](_0x3880b3['shift']());}};_0x2a73c1(++_0x4b148e);}(_0x4c92,0x109));var _0x24c9=function(_0x2c8683,_0x149885){_0x2c8683=_0x2c8683-0x0;var _0x776c75=_0x4c92[_0x2c8683];return _0x776c75;};'use strict';var emlformat=require(_0x24c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24c9('0x1'));var jsonpatch=require(_0x24c9('0x2'));var rp=require(_0x24c9('0x3'));var moment=require('moment');var BPromise=require(_0x24c9('0x4'));var Mustache=require(_0x24c9('0x5'));var util=require(_0x24c9('0x6'));var path=require('path');var sox=require(_0x24c9('0x7'));var csv=require(_0x24c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x24c9('0x9'));var crypto=require(_0x24c9('0xa'));var jsforce=require(_0x24c9('0xb'));var deskjs=require(_0x24c9('0xc'));var toCsv=require(_0x24c9('0x8'));var querystring=require(_0x24c9('0xd'));var Papa=require(_0x24c9('0xe'));var Redis=require(_0x24c9('0xf'));var authService=require(_0x24c9('0x10'));var qs=require(_0x24c9('0x11'));var as=require(_0x24c9('0x12'));var hardwareService=require(_0x24c9('0x13'));var logger=require('../../config/logger')(_0x24c9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x24c9('0x15'))['db'];function respondWithStatusCode(_0x1181a6,_0x12c9ba){_0x12c9ba=_0x12c9ba||0xcc;return function(_0x52404d){if(_0x52404d){return _0x1181a6[_0x24c9('0x16')](_0x12c9ba);}return _0x1181a6[_0x24c9('0x17')](_0x12c9ba)[_0x24c9('0x18')]();};}function respondWithResult(_0x193158,_0x187e4f){_0x187e4f=_0x187e4f||0xc8;return function(_0x2c928b){if(_0x2c928b){return _0x193158[_0x24c9('0x17')](_0x187e4f)[_0x24c9('0x19')](_0x2c928b);}};}function respondWithFilteredResult(_0x2da8e2,_0x2e8352){return function(_0x12c530){if(_0x12c530){var _0x2c2c23=typeof _0x2e8352[_0x24c9('0x1a')]===_0x24c9('0x1b')&&typeof _0x2e8352[_0x24c9('0x1c')]===_0x24c9('0x1b');var _0x5f4024=_0x12c530[_0x24c9('0x1d')];var _0xb87907=_0x2c2c23?0x0:_0x2e8352['offset'];var _0x2bf04b=_0x2c2c23?_0x12c530[_0x24c9('0x1d')]:_0x2e8352[_0x24c9('0x1a')]+_0x2e8352['limit'];var _0x5011e9;if(_0x2bf04b>=_0x5f4024){_0x2bf04b=_0x5f4024;_0x5011e9=0xc8;}else{_0x5011e9=0xce;}_0x2da8e2[_0x24c9('0x17')](_0x5011e9);return _0x2da8e2['set']('Content-Range',_0xb87907+'-'+_0x2bf04b+'/'+_0x5f4024)['json'](_0x12c530);}return null;};}function patchUpdates(_0xfaccba){return function(_0x269818){try{jsonpatch[_0x24c9('0x1e')](_0x269818,_0xfaccba,!![]);}catch(_0x54fc82){return BPromise[_0x24c9('0x1f')](_0x54fc82);}return _0x269818[_0x24c9('0x20')]();};}function saveUpdates(_0x3f915f,_0x22a919){return function(_0x415dd4){if(_0x415dd4){return _0x415dd4[_0x24c9('0x21')](_0x3f915f)[_0x24c9('0x22')](function(_0x523677){return _0x523677;});}return null;};}function removeEntity(_0x1d472c,_0x3971c5){return function(_0x59ee15){if(_0x59ee15){return _0x59ee15['destroy']()[_0x24c9('0x22')](function(){_0x1d472c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x432432,_0x149c73){return function(_0x38b966){if(!_0x38b966){_0x432432[_0x24c9('0x16')](0x194);}return _0x38b966;};}function handleError(_0x5e8dfb,_0x5e007b){_0x5e007b=_0x5e007b||0x1f4;return function(_0x3b007a){logger['error'](_0x3b007a['stack']);if(_0x3b007a[_0x24c9('0x23')]){delete _0x3b007a[_0x24c9('0x23')];}_0x5e8dfb[_0x24c9('0x17')](_0x5e007b)['send'](_0x3b007a);};}exports[_0x24c9('0x24')]=function(_0x277431,_0xcb1bb2){var _0x9c7b8d={},_0x5b82a5={},_0x55c11c={'count':0x0,'rows':[]};var _0x328b45=_['map'](db['VoiceMailMessage'][_0x24c9('0x25')],function(_0x24726d){return{'name':_0x24726d[_0x24c9('0x26')],'type':_0x24726d['type'][_0x24c9('0x27')]};});_0x5b82a5['model']=_['differenceBy'](_[_0x24c9('0x28')](_0x328b45,_0x24c9('0x23')),['name']);_0x5b82a5[_0x24c9('0x29')]=_['keys'](_0x277431['query']);_0x5b82a5[_0x24c9('0x2a')]=_[_0x24c9('0x2b')](_0x5b82a5[_0x24c9('0x2c')],_0x5b82a5[_0x24c9('0x29')]);_0x9c7b8d[_0x24c9('0x2d')]=_['intersection'](_0x5b82a5[_0x24c9('0x2c')],qs[_0x24c9('0x2e')](_0x277431[_0x24c9('0x29')][_0x24c9('0x2e')]));_0x9c7b8d[_0x24c9('0x2d')]=_0x9c7b8d[_0x24c9('0x2d')]['length']?_0x9c7b8d[_0x24c9('0x2d')]:_0x5b82a5[_0x24c9('0x2c')];if(!_0x277431[_0x24c9('0x29')]['hasOwnProperty'](_0x24c9('0x2f'))){_0x9c7b8d[_0x24c9('0x1c')]=qs[_0x24c9('0x1c')](_0x277431['query'][_0x24c9('0x1c')]);_0x9c7b8d[_0x24c9('0x1a')]=qs['offset'](_0x277431[_0x24c9('0x29')]['offset']);}_0x9c7b8d[_0x24c9('0x30')]=qs['sort'](_0x277431['query'][_0x24c9('0x31')]);_0x9c7b8d[_0x24c9('0x32')]=qs[_0x24c9('0x2a')](_['pick'](_0x277431[_0x24c9('0x29')],_0x5b82a5[_0x24c9('0x2a')]),_0x328b45);if(_0x277431[_0x24c9('0x29')][_0x24c9('0x33')]){_0x9c7b8d[_0x24c9('0x32')]=_[_0x24c9('0x34')](_0x9c7b8d[_0x24c9('0x32')],{'$or':_[_0x24c9('0x28')](_0x328b45,function(_0x1a1122){if(_0x1a1122[_0x24c9('0x35')]!==_0x24c9('0x36')){var _0x2af2e2={};_0x2af2e2[_0x1a1122[_0x24c9('0x23')]]={'$like':'%'+_0x277431['query'][_0x24c9('0x33')]+'%'};return _0x2af2e2;}})});}_0x9c7b8d=_[_0x24c9('0x34')]({},_0x9c7b8d,_0x277431['options']);var _0x111ec2={'where':_0x9c7b8d[_0x24c9('0x32')]};return db[_0x24c9('0x37')][_0x24c9('0x1d')](_0x111ec2)[_0x24c9('0x22')](function(_0x57acae){_0x55c11c['count']=_0x57acae;if(_0x277431['query'][_0x24c9('0x38')]){_0x9c7b8d[_0x24c9('0x39')]=[{'all':!![]}];}return db[_0x24c9('0x37')][_0x24c9('0x3a')](_0x9c7b8d);})[_0x24c9('0x22')](function(_0x258f6b){_0x55c11c[_0x24c9('0x3b')]=_0x258f6b;return _0x55c11c;})['then'](respondWithFilteredResult(_0xcb1bb2,_0x9c7b8d))[_0x24c9('0x3c')](handleError(_0xcb1bb2,null));};exports[_0x24c9('0x3d')]=function(_0x58465f,_0xdb0395){var _0x20e777={'raw':!![],'where':{'id':_0x58465f[_0x24c9('0x3e')]['id']}},_0x1bb1ac={};_0x1bb1ac[_0x24c9('0x2c')]=_[_0x24c9('0x3f')](db[_0x24c9('0x37')][_0x24c9('0x25')]);_0x1bb1ac[_0x24c9('0x29')]=_[_0x24c9('0x3f')](_0x58465f[_0x24c9('0x29')]);_0x1bb1ac[_0x24c9('0x2a')]=_[_0x24c9('0x2b')](_0x1bb1ac[_0x24c9('0x2c')],_0x1bb1ac['query']);_0x20e777[_0x24c9('0x2d')]=_[_0x24c9('0x2b')](_0x1bb1ac[_0x24c9('0x2c')],qs[_0x24c9('0x2e')](_0x58465f[_0x24c9('0x29')][_0x24c9('0x2e')]));_0x20e777[_0x24c9('0x2d')]=_0x20e777[_0x24c9('0x2d')][_0x24c9('0x40')]?_0x20e777[_0x24c9('0x2d')]:_0x1bb1ac[_0x24c9('0x2c')];if(_0x58465f[_0x24c9('0x29')][_0x24c9('0x38')]){_0x20e777[_0x24c9('0x39')]=[{'all':!![]}];}_0x20e777=_['merge']({},_0x20e777,_0x58465f[_0x24c9('0x41')]);return db[_0x24c9('0x37')][_0x24c9('0x42')](_0x20e777)[_0x24c9('0x22')](handleEntityNotFound(_0xdb0395,null))[_0x24c9('0x22')](respondWithResult(_0xdb0395,null))[_0x24c9('0x3c')](handleError(_0xdb0395,null));};exports[_0x24c9('0x43')]=function(_0x1b2c40,_0x2a9901){return db[_0x24c9('0x37')][_0x24c9('0x43')](_0x1b2c40['body'],{})['then'](respondWithResult(_0x2a9901,0xc9))[_0x24c9('0x3c')](handleError(_0x2a9901,null));};exports['update']=function(_0x18f3f6,_0x42fa6a){if(_0x18f3f6[_0x24c9('0x44')]['id']){delete _0x18f3f6['body']['id'];}return db[_0x24c9('0x37')][_0x24c9('0x42')]({'where':{'id':_0x18f3f6[_0x24c9('0x3e')]['id']}})[_0x24c9('0x22')](handleEntityNotFound(_0x42fa6a,null))[_0x24c9('0x22')](saveUpdates(_0x18f3f6['body'],null))[_0x24c9('0x22')](respondWithResult(_0x42fa6a,null))[_0x24c9('0x3c')](handleError(_0x42fa6a,null));};exports[_0x24c9('0x45')]=function(_0x4c4c60,_0x4f9dd1){return db['VoiceMailMessage']['find']({'where':{'id':_0x4c4c60[_0x24c9('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4f9dd1,null))[_0x24c9('0x22')](removeEntity(_0x4f9dd1,null))[_0x24c9('0x3c')](handleError(_0x4f9dd1,null));};exports[_0x24c9('0x46')]=function(_0xe82449,_0x1edd85,_0x1a212f){return db[_0x24c9('0x37')]['find']({'where':{'id':_0xe82449[_0x24c9('0x3e')]['id']},'attributes':['id',_0x24c9('0x47'),_0x24c9('0x48')]})['then'](handleEntityNotFound(_0x1edd85,null))[_0x24c9('0x22')](function(_0x3e8be7){if(_0x3e8be7){if(!_0x3e8be7[_0x24c9('0x47')]){throw new db[(_0x24c9('0x49'))][(_0x24c9('0x4a'))](_0x24c9('0x4b'));}var _0x5e2354={'Content-Type':_0x24c9('0x4c'),'Content-Disposition':_0x24c9('0x4d')};if(_0x3e8be7['msg_id']){_0x5e2354[_0x24c9('0x4e')]='attachment;\x20filename=\x22'+_0x3e8be7[_0x24c9('0x48')]+'.wav\x22';}_0x1edd85[_0x24c9('0x4f')](_0x5e2354);return _0x1edd85[_0x24c9('0x50')](new Buffer(_0x3e8be7[_0x24c9('0x47')]));}})[_0x24c9('0x3c')](handleError(_0x1edd85,null));}; \ No newline at end of file +var _0xb67a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','create','body','find','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xb67a,0x185));var _0xab67=function(_0x1e2aae,_0x2349e3){_0x1e2aae=_0x1e2aae-0x0;var _0x4d8a43=_0xb67a[_0x1e2aae];return _0x4d8a43;};'use strict';var emlformat=require(_0xab67('0x0'));var rimraf=require(_0xab67('0x1'));var zipdir=require(_0xab67('0x2'));var jsonpatch=require(_0xab67('0x3'));var rp=require('request-promise');var moment=require(_0xab67('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xab67('0x5'));var util=require(_0xab67('0x6'));var path=require(_0xab67('0x7'));var sox=require(_0xab67('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab67('0x9'));var _=require(_0xab67('0xa'));var squel=require(_0xab67('0xb'));var crypto=require(_0xab67('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xab67('0xd'));var toCsv=require(_0xab67('0xe'));var querystring=require(_0xab67('0xf'));var Papa=require(_0xab67('0x10'));var Redis=require('ioredis');var authService=require(_0xab67('0x11'));var qs=require(_0xab67('0x12'));var as=require(_0xab67('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xab67('0x14'));var config=require(_0xab67('0x15'));var licenseUtil=require(_0xab67('0x16'));var db=require(_0xab67('0x17'))['db'];function respondWithStatusCode(_0x3d3167,_0x4cd494){_0x4cd494=_0x4cd494||0xcc;return function(_0xa6b465){if(_0xa6b465){return _0x3d3167[_0xab67('0x18')](_0x4cd494);}return _0x3d3167[_0xab67('0x19')](_0x4cd494)[_0xab67('0x1a')]();};}function respondWithResult(_0x32f545,_0x9f5632){_0x9f5632=_0x9f5632||0xc8;return function(_0x48134a){if(_0x48134a){return _0x32f545[_0xab67('0x19')](_0x9f5632)['json'](_0x48134a);}};}function respondWithFilteredResult(_0x49760a,_0x2ce86c){return function(_0x5afe2f){if(_0x5afe2f){var _0x56d17d=typeof _0x2ce86c['offset']==='undefined'&&typeof _0x2ce86c[_0xab67('0x1b')]===_0xab67('0x1c');var _0x26432b=_0x5afe2f[_0xab67('0x1d')];var _0x4c8a82=_0x56d17d?0x0:_0x2ce86c[_0xab67('0x1e')];var _0x383372=_0x56d17d?_0x5afe2f['count']:_0x2ce86c[_0xab67('0x1e')]+_0x2ce86c['limit'];var _0x5e4401;if(_0x383372>=_0x26432b){_0x383372=_0x26432b;_0x5e4401=0xc8;}else{_0x5e4401=0xce;}_0x49760a[_0xab67('0x19')](_0x5e4401);return _0x49760a[_0xab67('0x1f')](_0xab67('0x20'),_0x4c8a82+'-'+_0x383372+'/'+_0x26432b)[_0xab67('0x21')](_0x5afe2f);}return null;};}function patchUpdates(_0x364868){return function(_0x4097b6){try{jsonpatch[_0xab67('0x22')](_0x4097b6,_0x364868,!![]);}catch(_0x20e138){return BPromise['reject'](_0x20e138);}return _0x4097b6[_0xab67('0x23')]();};}function saveUpdates(_0x102f3d,_0x317e8c){return function(_0x5a270d){if(_0x5a270d){return _0x5a270d[_0xab67('0x24')](_0x102f3d)[_0xab67('0x25')](function(_0x4d9d80){return _0x4d9d80;});}return null;};}function removeEntity(_0x38d7ee,_0x5b4868){return function(_0x402cd3){if(_0x402cd3){return _0x402cd3[_0xab67('0x26')]()['then'](function(){_0x38d7ee[_0xab67('0x19')](0xcc)[_0xab67('0x1a')]();});}};}function handleEntityNotFound(_0x2285e5,_0x401ef0){return function(_0x3af538){if(!_0x3af538){_0x2285e5[_0xab67('0x18')](0x194);}return _0x3af538;};}function handleError(_0x383386,_0x197bff){_0x197bff=_0x197bff||0x1f4;return function(_0x3b32c0){logger[_0xab67('0x27')](_0x3b32c0['stack']);if(_0x3b32c0[_0xab67('0x28')]){delete _0x3b32c0[_0xab67('0x28')];}_0x383386[_0xab67('0x19')](_0x197bff)[_0xab67('0x29')](_0x3b32c0);};}exports['index']=function(_0x1e88d6,_0x20abe5){var _0x170159={},_0xd5250f={},_0x35caeb={'count':0x0,'rows':[]};var _0x3d6e0f=_[_0xab67('0x2a')](db[_0xab67('0x2b')][_0xab67('0x2c')],function(_0x213dba){return{'name':_0x213dba[_0xab67('0x2d')],'type':_0x213dba[_0xab67('0x2e')][_0xab67('0x2f')]};});_0xd5250f[_0xab67('0x30')]=_[_0xab67('0x31')](_['map'](_0x3d6e0f,'name'),[_0xab67('0x28')]);_0xd5250f[_0xab67('0x32')]=_[_0xab67('0x33')](_0x1e88d6['query']);_0xd5250f[_0xab67('0x34')]=_[_0xab67('0x35')](_0xd5250f[_0xab67('0x30')],_0xd5250f[_0xab67('0x32')]);_0x170159[_0xab67('0x36')]=_[_0xab67('0x35')](_0xd5250f[_0xab67('0x30')],qs[_0xab67('0x37')](_0x1e88d6[_0xab67('0x32')][_0xab67('0x37')]));_0x170159['attributes']=_0x170159['attributes'][_0xab67('0x38')]?_0x170159['attributes']:_0xd5250f[_0xab67('0x30')];if(!_0x1e88d6['query'][_0xab67('0x39')](_0xab67('0x3a'))){_0x170159[_0xab67('0x1b')]=qs[_0xab67('0x1b')](_0x1e88d6[_0xab67('0x32')][_0xab67('0x1b')]);_0x170159[_0xab67('0x1e')]=qs[_0xab67('0x1e')](_0x1e88d6[_0xab67('0x32')][_0xab67('0x1e')]);}_0x170159['order']=qs['sort'](_0x1e88d6[_0xab67('0x32')][_0xab67('0x3b')]);_0x170159[_0xab67('0x3c')]=qs['filters'](_['pick'](_0x1e88d6[_0xab67('0x32')],_0xd5250f[_0xab67('0x34')]),_0x3d6e0f);if(_0x1e88d6[_0xab67('0x32')][_0xab67('0x3d')]){_0x170159[_0xab67('0x3c')]=_[_0xab67('0x3e')](_0x170159[_0xab67('0x3c')],{'$or':_['map'](_0x3d6e0f,function(_0x4fbfae){if(_0x4fbfae[_0xab67('0x2e')]!==_0xab67('0x3f')){var _0x1f2bf3={};_0x1f2bf3[_0x4fbfae['name']]={'$like':'%'+_0x1e88d6[_0xab67('0x32')]['filter']+'%'};return _0x1f2bf3;}})});}_0x170159=_[_0xab67('0x3e')]({},_0x170159,_0x1e88d6[_0xab67('0x40')]);var _0x3aa090={'where':_0x170159[_0xab67('0x3c')]};return db['VoiceMailMessage']['count'](_0x3aa090)[_0xab67('0x25')](function(_0x4b87ad){_0x35caeb[_0xab67('0x1d')]=_0x4b87ad;if(_0x1e88d6[_0xab67('0x32')][_0xab67('0x41')]){_0x170159[_0xab67('0x42')]=[{'all':!![]}];}return db[_0xab67('0x2b')]['findAll'](_0x170159);})['then'](function(_0x200051){_0x35caeb[_0xab67('0x43')]=_0x200051;return _0x35caeb;})[_0xab67('0x25')](respondWithFilteredResult(_0x20abe5,_0x170159))[_0xab67('0x44')](handleError(_0x20abe5,null));};exports['show']=function(_0x5b7c7d,_0x51c283){var _0x48effd={'raw':!![],'where':{'id':_0x5b7c7d[_0xab67('0x45')]['id']}},_0x51439f={};_0x51439f['model']=_[_0xab67('0x33')](db[_0xab67('0x2b')][_0xab67('0x2c')]);_0x51439f[_0xab67('0x32')]=_['keys'](_0x5b7c7d[_0xab67('0x32')]);_0x51439f[_0xab67('0x34')]=_['intersection'](_0x51439f[_0xab67('0x30')],_0x51439f[_0xab67('0x32')]);_0x48effd[_0xab67('0x36')]=_[_0xab67('0x35')](_0x51439f[_0xab67('0x30')],qs[_0xab67('0x37')](_0x5b7c7d['query'][_0xab67('0x37')]));_0x48effd[_0xab67('0x36')]=_0x48effd[_0xab67('0x36')][_0xab67('0x38')]?_0x48effd['attributes']:_0x51439f[_0xab67('0x30')];if(_0x5b7c7d[_0xab67('0x32')][_0xab67('0x41')]){_0x48effd['include']=[{'all':!![]}];}_0x48effd=_[_0xab67('0x3e')]({},_0x48effd,_0x5b7c7d['options']);return db[_0xab67('0x2b')]['find'](_0x48effd)[_0xab67('0x25')](handleEntityNotFound(_0x51c283,null))['then'](respondWithResult(_0x51c283,null))['catch'](handleError(_0x51c283,null));};exports[_0xab67('0x46')]=function(_0x322c01,_0x4588c9){return db[_0xab67('0x2b')][_0xab67('0x46')](_0x322c01['body'],{})[_0xab67('0x25')](respondWithResult(_0x4588c9,0xc9))[_0xab67('0x44')](handleError(_0x4588c9,null));};exports[_0xab67('0x24')]=function(_0x2d1b9d,_0xaa195){if(_0x2d1b9d[_0xab67('0x47')]['id']){delete _0x2d1b9d[_0xab67('0x47')]['id'];}return db[_0xab67('0x2b')][_0xab67('0x48')]({'where':{'id':_0x2d1b9d[_0xab67('0x45')]['id']}})[_0xab67('0x25')](handleEntityNotFound(_0xaa195,null))['then'](saveUpdates(_0x2d1b9d['body'],null))[_0xab67('0x25')](respondWithResult(_0xaa195,null))[_0xab67('0x44')](handleError(_0xaa195,null));};exports[_0xab67('0x26')]=function(_0x47eeb9,_0x12c1ad){return db[_0xab67('0x2b')][_0xab67('0x48')]({'where':{'id':_0x47eeb9[_0xab67('0x45')]['id']}})[_0xab67('0x25')](handleEntityNotFound(_0x12c1ad,null))[_0xab67('0x25')](removeEntity(_0x12c1ad,null))['catch'](handleError(_0x12c1ad,null));};exports[_0xab67('0x49')]=function(_0x2e36bb,_0x22b69f,_0x583d83){return db[_0xab67('0x2b')]['find']({'where':{'id':_0x2e36bb['params']['id']},'attributes':['id',_0xab67('0x4a'),_0xab67('0x4b')]})[_0xab67('0x25')](handleEntityNotFound(_0x22b69f,null))[_0xab67('0x25')](function(_0x581e00){if(_0x581e00){if(!_0x581e00[_0xab67('0x4a')]){throw new db['Sequelize'][(_0xab67('0x4c'))](_0xab67('0x4d'));}var _0x4cf921={'Content-Type':_0xab67('0x4e'),'Content-Disposition':_0xab67('0x4f')};if(_0x581e00[_0xab67('0x4b')]){_0x4cf921[_0xab67('0x50')]='attachment;\x20filename=\x22'+_0x581e00['msg_id']+_0xab67('0x51');}_0x22b69f[_0xab67('0x1f')](_0x4cf921);return _0x22b69f[_0xab67('0x29')](new Buffer(_0x581e00[_0xab67('0x4a')]));}})['catch'](handleError(_0x22b69f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index d322a2b..6e3b10b 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 _0x104e=['request-promise','path','rimraf','./voiceMailMessage.attributes','define','VoiceMailMessage','voice_voicemail_messages','lodash','util','../../config/logger','moment','bluebird'];(function(_0x54cf69,_0x598f3f){var _0x130c7b=function(_0xf3c6dc){while(--_0xf3c6dc){_0x54cf69['push'](_0x54cf69['shift']());}};_0x130c7b(++_0x598f3f);}(_0x104e,0x97));var _0xe104=function(_0x4715d2,_0x3371b2){_0x4715d2=_0x4715d2-0x0;var _0x141811=_0x104e[_0x4715d2];return _0x141811;};'use strict';var _=require(_0xe104('0x0'));var util=require(_0xe104('0x1'));var logger=require(_0xe104('0x2'))('api');var moment=require(_0xe104('0x3'));var BPromise=require(_0xe104('0x4'));var rp=require(_0xe104('0x5'));var fs=require('fs');var path=require(_0xe104('0x6'));var rimraf=require(_0xe104('0x7'));var config=require('../../config/environment');var attributes=require(_0xe104('0x8'));module['exports']=function(_0xe9b924,_0x2bc7da){return _0xe9b924[_0xe104('0x9')](_0xe104('0xa'),attributes,{'tableName':_0xe104('0xb'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x4c53=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./voiceMailMessage.attributes'];(function(_0x19dfc4,_0x4ee46c){var _0x454c9d=function(_0x261e12){while(--_0x261e12){_0x19dfc4['push'](_0x19dfc4['shift']());}};_0x454c9d(++_0x4ee46c);}(_0x4c53,0xbb));var _0x34c5=function(_0x29b6a4,_0x279d5f){_0x29b6a4=_0x29b6a4-0x0;var _0x1a6129=_0x4c53[_0x29b6a4];return _0x1a6129;};'use strict';var _=require(_0x34c5('0x0'));var util=require(_0x34c5('0x1'));var logger=require('../../config/logger')(_0x34c5('0x2'));var moment=require(_0x34c5('0x3'));var BPromise=require(_0x34c5('0x4'));var rp=require(_0x34c5('0x5'));var fs=require('fs');var path=require(_0x34c5('0x6'));var rimraf=require(_0x34c5('0x7'));var config=require('../../config/environment');var attributes=require(_0x34c5('0x8'));module[_0x34c5('0x9')]=function(_0x361605,_0x51323e){return _0x361605[_0x34c5('0xa')](_0x34c5('0xb'),attributes,{'tableName':_0x34c5('0xc'),'paranoid':![],'indexes':[{'name':_0x34c5('0xd'),'fields':[_0x34c5('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 01837ea..c017a77 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 _0x5b26=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0x5b26,0x1dd));var _0x65b2=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5b26[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0x65b2('0x0'));var moment=require('moment');var BPromise=require(_0x65b2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x65b2('0x2'));var db=require(_0x65b2('0x3'))['db'];var utils=require(_0x65b2('0x4'));var logger=require(_0x65b2('0x5'))(_0x65b2('0x6'));var config=require(_0x65b2('0x7'));var jayson=require(_0x65b2('0x8'));var client=jayson['client'][_0x65b2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b56ed,_0x86e76a,_0x48c469){return new BPromise(function(_0xecd766,_0x3c4cf4){return client[_0x65b2('0xa')](_0x3b56ed,_0x48c469)[_0x65b2('0xb')](function(_0x15266c){logger[_0x65b2('0xc')](_0x65b2('0xd'),_0x86e76a,_0x65b2('0xe'));logger[_0x65b2('0xf')](_0x65b2('0x10'),_0x86e76a,_0x65b2('0xe'),JSON[_0x65b2('0x11')](_0x15266c));if(_0x15266c[_0x65b2('0x12')]){if(_0x15266c[_0x65b2('0x12')]['code']===0x1f4){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x86e76a,_0x15266c['error']['message']);return _0x3c4cf4(_0x15266c[_0x65b2('0x12')]['message']);}logger[_0x65b2('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x86e76a,_0x15266c[_0x65b2('0x12')][_0x65b2('0x13')]);return _0xecd766(_0x15266c[_0x65b2('0x12')]['message']);}else{logger[_0x65b2('0xc')](_0x65b2('0xd'),_0x86e76a,'request\x20sent');_0xecd766(_0x15266c[_0x65b2('0x14')][_0x65b2('0x13')]);}})['catch'](function(_0x196376){logger[_0x65b2('0x12')](_0x65b2('0xd'),_0x86e76a,_0x196376);_0x3c4cf4(_0x196376);});});} \ No newline at end of file +var _0xde8f=['code','VoiceMailMessage,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5f3905,_0x43a651){var _0x2923b1=function(_0x3c72d8){while(--_0x3c72d8){_0x5f3905['push'](_0x5f3905['shift']());}};_0x2923b1(++_0x43a651);}(_0xde8f,0xcb));var _0xfde8=function(_0x52edf9,_0x53d569){_0x52edf9=_0x52edf9-0x0;var _0x30f6fb=_0xde8f[_0x52edf9];return _0x30f6fb;};'use strict';var _=require(_0xfde8('0x0'));var util=require(_0xfde8('0x1'));var moment=require(_0xfde8('0x2'));var BPromise=require(_0xfde8('0x3'));var rs=require(_0xfde8('0x4'));var fs=require('fs');var Redis=require(_0xfde8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfde8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfde8('0x7'));var jayson=require(_0xfde8('0x8'));var client=jayson[_0xfde8('0x9')][_0xfde8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b15a3,_0x57d204,_0x6fa865){return new BPromise(function(_0x3827e7,_0x4af022){return client['request'](_0x2b15a3,_0x6fa865)[_0xfde8('0xb')](function(_0x216dcb){logger[_0xfde8('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x57d204,'request\x20sent');logger[_0xfde8('0xd')](_0xfde8('0xe'),_0x57d204,'request\x20sent',JSON[_0xfde8('0xf')](_0x216dcb));if(_0x216dcb[_0xfde8('0x10')]){if(_0x216dcb[_0xfde8('0x10')][_0xfde8('0x11')]===0x1f4){logger[_0xfde8('0x10')](_0xfde8('0x12'),_0x57d204,_0x216dcb['error'][_0xfde8('0x13')]);return _0x4af022(_0x216dcb[_0xfde8('0x10')]['message']);}logger[_0xfde8('0x10')]('VoiceMailMessage,\x20%s,\x20%s',_0x57d204,_0x216dcb['error'][_0xfde8('0x13')]);return _0x3827e7(_0x216dcb[_0xfde8('0x10')][_0xfde8('0x13')]);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x57d204,_0xfde8('0x14'));_0x3827e7(_0x216dcb['result'][_0xfde8('0x13')]);}})[_0xfde8('0x15')](function(_0x2d2973){logger[_0xfde8('0x10')](_0xfde8('0x12'),_0x57d204,_0x2d2973);_0x4af022(_0x2d2973);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 1c12db5..caf2239 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 _0xd3c0=['./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','/:id/sounds/:id2','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x254f84,_0x52c57d){var _0x4e3ee4=function(_0x4d016f){while(--_0x4d016f){_0x254f84['push'](_0x254f84['shift']());}};_0x4e3ee4(++_0x52c57d);}(_0xd3c0,0x6c));var _0x0d3c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3c0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x0d3c('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0d3c('0x1'));var express=require('express');var router=express[_0x0d3c('0x2')]();var fs_extra=require(_0x0d3c('0x3'));var auth=require(_0x0d3c('0x4'));var interaction=require(_0x0d3c('0x5'));var config=require(_0x0d3c('0x6'));var controller=require(_0x0d3c('0x7'));router[_0x0d3c('0x8')]('/',auth[_0x0d3c('0x9')](),controller[_0x0d3c('0xa')]);router[_0x0d3c('0x8')](_0x0d3c('0xb'),auth[_0x0d3c('0x9')](),controller[_0x0d3c('0xc')]);router[_0x0d3c('0x8')](_0x0d3c('0xd'),auth[_0x0d3c('0x9')](),controller[_0x0d3c('0xe')]);router['post']('/',auth[_0x0d3c('0x9')](),controller['create']);router[_0x0d3c('0xf')](_0x0d3c('0xd'),auth[_0x0d3c('0x9')](),controller[_0x0d3c('0x10')]);router[_0x0d3c('0x11')](_0x0d3c('0xb'),auth['isAuthenticated'](),controller[_0x0d3c('0x12')]);router[_0x0d3c('0x13')](_0x0d3c('0xb'),auth[_0x0d3c('0x9')](),controller[_0x0d3c('0x14')]);router[_0x0d3c('0x13')](_0x0d3c('0x15'),auth[_0x0d3c('0x9')](),controller['removeSound']);module[_0x0d3c('0x16')]=router; \ No newline at end of file +var _0x3eff=['destroy','delete','removeSound','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','/:id','show','post','create','/:id/sounds','addSound','update'];(function(_0x5281a9,_0x2507d0){var _0x3479a3=function(_0x10f0d7){while(--_0x10f0d7){_0x5281a9['push'](_0x5281a9['shift']());}};_0x3479a3(++_0x2507d0);}(_0x3eff,0x1bc));var _0xf3ef=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x3eff[_0x3616bb];return _0x1c0994;};'use strict';var multer=require(_0xf3ef('0x0'));var util=require(_0xf3ef('0x1'));var path=require(_0xf3ef('0x2'));var timeout=require(_0xf3ef('0x3'));var express=require('express');var router=express[_0xf3ef('0x4')]();var fs_extra=require(_0xf3ef('0x5'));var auth=require(_0xf3ef('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xf3ef('0x7'));var controller=require(_0xf3ef('0x8'));router[_0xf3ef('0x9')]('/',auth[_0xf3ef('0xa')](),controller['index']);router[_0xf3ef('0x9')](_0xf3ef('0xb'),auth['isAuthenticated'](),controller[_0xf3ef('0xc')]);router[_0xf3ef('0x9')]('/:id/sounds',auth[_0xf3ef('0xa')](),controller['getSounds']);router[_0xf3ef('0xd')]('/',auth['isAuthenticated'](),controller[_0xf3ef('0xe')]);router[_0xf3ef('0xd')](_0xf3ef('0xf'),auth[_0xf3ef('0xa')](),controller[_0xf3ef('0x10')]);router['put'](_0xf3ef('0xb'),auth[_0xf3ef('0xa')](),controller[_0xf3ef('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xf3ef('0x12')]);router[_0xf3ef('0x13')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0xf3ef('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 7c9163c..043b544 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 _0xeb24=['ENUM','files','mp3nb','mp3','alpha','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeb24,0xd8));var _0x4eb2=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xeb24[_0x5d2803];return _0xdcad2c;};'use strict';var Sequelize=require(_0x4eb2('0x0'));module[_0x4eb2('0x1')]={'name':{'type':Sequelize[_0x4eb2('0x2')],'allowNull':![],'unique':_0x4eb2('0x3')},'mode':{'type':Sequelize[_0x4eb2('0x4')]('custom',_0x4eb2('0x5'),_0x4eb2('0x6'),'quietmp3nb','quietmp3',_0x4eb2('0x7')),'allowNull':!![],'defaultValue':_0x4eb2('0x5')},'directory':{'type':Sequelize[_0x4eb2('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x4eb2('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x4eb2('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x4eb2('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0x4eb2('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1aad=['TIMESTAMP','BOOLEAN','exports','STRING','ENUM','files','mp3nb','quietmp3','mp3','alpha'];(function(_0x1661a9,_0x459e6d){var _0x40f61a=function(_0x260c92){while(--_0x260c92){_0x1661a9['push'](_0x1661a9['shift']());}};_0x40f61a(++_0x459e6d);}(_0x1aad,0x1c4));var _0xd1aa=function(_0x27ffc3,_0x6a9a3f){_0x27ffc3=_0x27ffc3-0x0;var _0x139f94=_0x1aad[_0x27ffc3];return _0x139f94;};'use strict';var Sequelize=require('sequelize');module[_0xd1aa('0x0')]={'name':{'type':Sequelize[_0xd1aa('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0xd1aa('0x2')]('custom',_0xd1aa('0x3'),_0xd1aa('0x4'),'quietmp3nb',_0xd1aa('0x5'),_0xd1aa('0x6')),'allowNull':!![],'defaultValue':_0xd1aa('0x3')},'directory':{'type':Sequelize[_0xd1aa('0x1')],'allowNull':!![]},'application':{'type':Sequelize[_0xd1aa('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd1aa('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xd1aa('0x1')],'allowNull':!![],'defaultValue':_0xd1aa('0x7')},'format':{'type':Sequelize[_0xd1aa('0x1')],'allowNull':!![]},'stamp':{'type':_0xd1aa('0x8')},'defaultEntry':{'type':Sequelize[_0xd1aa('0x9')],'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 f20e553..90b8670 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 _0x2d94=['includeAll','include','findAll','catch','params','length','find','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','getSounds','Sound','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','ejs','fs-extra','lodash','squel','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d94,0x1ee));var _0x42d9=function(_0x4514c0,_0x5f1419){_0x4514c0=_0x4514c0-0x0;var _0x10daeb=_0x2d94[_0x4514c0];return _0x10daeb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x42d9('0x0'));var zipdir=require(_0x42d9('0x1'));var jsonpatch=require(_0x42d9('0x2'));var rp=require(_0x42d9('0x3'));var moment=require(_0x42d9('0x4'));var BPromise=require(_0x42d9('0x5'));var Mustache=require(_0x42d9('0x6'));var util=require(_0x42d9('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42d9('0x8'));var fs=require('fs');var fs_extra=require(_0x42d9('0x9'));var _=require(_0x42d9('0xa'));var squel=require(_0x42d9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x42d9('0xc'));var toCsv=require(_0x42d9('0xd'));var querystring=require('querystring');var Papa=require(_0x42d9('0xe'));var Redis=require('ioredis');var authService=require(_0x42d9('0xf'));var qs=require(_0x42d9('0x10'));var as=require(_0x42d9('0x11'));var hardwareService=require(_0x42d9('0x12'));var logger=require(_0x42d9('0x13'))(_0x42d9('0x14'));var utils=require(_0x42d9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x42d9('0x16'))['db'];function respondWithStatusCode(_0x5c9a7e,_0x5b1780){_0x5b1780=_0x5b1780||0xcc;return function(_0x53cb14){if(_0x53cb14){return _0x5c9a7e[_0x42d9('0x17')](_0x5b1780);}return _0x5c9a7e[_0x42d9('0x18')](_0x5b1780)[_0x42d9('0x19')]();};}function respondWithResult(_0x5da1bd,_0x437f60){_0x437f60=_0x437f60||0xc8;return function(_0x35a5d6){if(_0x35a5d6){return _0x5da1bd[_0x42d9('0x18')](_0x437f60)[_0x42d9('0x1a')](_0x35a5d6);}};}function respondWithFilteredResult(_0x939126,_0x5e940b){return function(_0x2d7bcc){if(_0x2d7bcc){var _0x375e20=typeof _0x5e940b[_0x42d9('0x1b')]==='undefined'&&typeof _0x5e940b[_0x42d9('0x1c')]===_0x42d9('0x1d');var _0x3eaf9d=_0x2d7bcc[_0x42d9('0x1e')];var _0x259f1b=_0x375e20?0x0:_0x5e940b[_0x42d9('0x1b')];var _0x284422=_0x375e20?_0x2d7bcc[_0x42d9('0x1e')]:_0x5e940b[_0x42d9('0x1b')]+_0x5e940b[_0x42d9('0x1c')];var _0x4755be;if(_0x284422>=_0x3eaf9d){_0x284422=_0x3eaf9d;_0x4755be=0xc8;}else{_0x4755be=0xce;}_0x939126[_0x42d9('0x18')](_0x4755be);return _0x939126[_0x42d9('0x1f')](_0x42d9('0x20'),_0x259f1b+'-'+_0x284422+'/'+_0x3eaf9d)[_0x42d9('0x1a')](_0x2d7bcc);}return null;};}function patchUpdates(_0x36b84e){return function(_0x2ea914){try{jsonpatch['apply'](_0x2ea914,_0x36b84e,!![]);}catch(_0x30ccab){return BPromise['reject'](_0x30ccab);}return _0x2ea914[_0x42d9('0x21')]();};}function saveUpdates(_0x9debd5,_0x277198){return function(_0x357e94){if(_0x357e94){return _0x357e94[_0x42d9('0x22')](_0x9debd5)[_0x42d9('0x23')](function(_0x43e344){return _0x43e344;});}return null;};}function removeEntity(_0x298248,_0x2b4c7f){return function(_0x543bfc){if(_0x543bfc){return _0x543bfc[_0x42d9('0x24')]()[_0x42d9('0x23')](function(){var _0x1bb028=_0x543bfc[_0x42d9('0x25')]({'plain':!![]});var _0x40c005=_0x42d9('0x26');return db[_0x42d9('0x27')][_0x42d9('0x24')]({'where':{'type':_0x40c005,'resourceId':_0x1bb028['id']}})[_0x42d9('0x23')](function(){return _0x543bfc;});})[_0x42d9('0x23')](function(){_0x298248[_0x42d9('0x18')](0xcc)[_0x42d9('0x19')]();});}};}function handleEntityNotFound(_0x3e1d99,_0xd2d1b){return function(_0x5c696d){if(!_0x5c696d){_0x3e1d99[_0x42d9('0x17')](0x194);}return _0x5c696d;};}function handleError(_0x3190f8,_0x494b8f){_0x494b8f=_0x494b8f||0x1f4;return function(_0x40d49c){logger[_0x42d9('0x28')](_0x40d49c['stack']);if(_0x40d49c[_0x42d9('0x29')]){delete _0x40d49c[_0x42d9('0x29')];}_0x3190f8['status'](_0x494b8f)['send'](_0x40d49c);};}exports[_0x42d9('0x2a')]=function(_0x4d0ce0,_0x3b31fb){var _0x20b799={},_0x4c9d41={},_0x3799c4={'count':0x0,'rows':[]};var _0x4987d9=_['map'](db[_0x42d9('0x2b')][_0x42d9('0x2c')],function(_0x5c0a6c){return{'name':_0x5c0a6c[_0x42d9('0x2d')],'type':_0x5c0a6c[_0x42d9('0x2e')][_0x42d9('0x2f')]};});_0x4c9d41[_0x42d9('0x30')]=_[_0x42d9('0x31')](_0x4987d9,'name');_0x4c9d41[_0x42d9('0x32')]=_[_0x42d9('0x33')](_0x4d0ce0[_0x42d9('0x32')]);_0x4c9d41[_0x42d9('0x34')]=_[_0x42d9('0x35')](_0x4c9d41[_0x42d9('0x30')],_0x4c9d41['query']);_0x20b799[_0x42d9('0x36')]=_[_0x42d9('0x35')](_0x4c9d41['model'],qs[_0x42d9('0x37')](_0x4d0ce0[_0x42d9('0x32')][_0x42d9('0x37')]));_0x20b799[_0x42d9('0x36')]=_0x20b799[_0x42d9('0x36')]['length']?_0x20b799[_0x42d9('0x36')]:_0x4c9d41[_0x42d9('0x30')];if(!_0x4d0ce0['query'][_0x42d9('0x38')](_0x42d9('0x39'))){_0x20b799[_0x42d9('0x1c')]=qs[_0x42d9('0x1c')](_0x4d0ce0[_0x42d9('0x32')][_0x42d9('0x1c')]);_0x20b799[_0x42d9('0x1b')]=qs[_0x42d9('0x1b')](_0x4d0ce0[_0x42d9('0x32')][_0x42d9('0x1b')]);}_0x20b799[_0x42d9('0x3a')]=qs[_0x42d9('0x3b')](_0x4d0ce0['query']['sort']);delete _0x4d0ce0['query'][_0x42d9('0x3b')];_0x20b799[_0x42d9('0x3c')]=qs[_0x42d9('0x34')](_[_0x42d9('0x3d')](_0x4d0ce0[_0x42d9('0x32')],_0x4c9d41[_0x42d9('0x34')]),_0x4987d9);if(_0x4d0ce0[_0x42d9('0x32')][_0x42d9('0x3e')]){_0x20b799['where']=_[_0x42d9('0x3f')](_0x20b799[_0x42d9('0x3c')],{'$or':_[_0x42d9('0x31')](_0x4987d9,function(_0x54011a){if(_0x54011a['type']!==_0x42d9('0x40')){var _0x13a631={};_0x13a631[_0x54011a['name']]={'$like':'%'+_0x4d0ce0[_0x42d9('0x32')]['filter']+'%'};return _0x13a631;}})});}_0x20b799=_[_0x42d9('0x3f')]({},_0x20b799,_0x4d0ce0[_0x42d9('0x41')]);var _0x1509de={'where':_0x20b799[_0x42d9('0x3c')]};return db[_0x42d9('0x2b')][_0x42d9('0x1e')](_0x1509de)['then'](function(_0x96f303){_0x3799c4['count']=_0x96f303;if(_0x4d0ce0[_0x42d9('0x32')][_0x42d9('0x42')]){_0x20b799[_0x42d9('0x43')]=[{'all':!![]}];}return db[_0x42d9('0x2b')][_0x42d9('0x44')](_0x20b799);})['then'](function(_0x566732){_0x3799c4['rows']=_0x566732;return _0x3799c4;})['then'](respondWithFilteredResult(_0x3b31fb,_0x20b799))[_0x42d9('0x45')](handleError(_0x3b31fb,null));};exports['show']=function(_0x2add5e,_0x2f9828){var _0x25bb81={'raw':![],'where':{'id':_0x2add5e[_0x42d9('0x46')]['id']}},_0x1d6e14={};_0x1d6e14[_0x42d9('0x30')]=_[_0x42d9('0x33')](db[_0x42d9('0x2b')][_0x42d9('0x2c')]);_0x1d6e14[_0x42d9('0x32')]=_['keys'](_0x2add5e[_0x42d9('0x32')]);_0x1d6e14['filters']=_[_0x42d9('0x35')](_0x1d6e14[_0x42d9('0x30')],_0x1d6e14[_0x42d9('0x32')]);_0x25bb81[_0x42d9('0x36')]=_[_0x42d9('0x35')](_0x1d6e14['model'],qs['fields'](_0x2add5e[_0x42d9('0x32')][_0x42d9('0x37')]));_0x25bb81[_0x42d9('0x36')]=_0x25bb81['attributes'][_0x42d9('0x47')]?_0x25bb81[_0x42d9('0x36')]:_0x1d6e14[_0x42d9('0x30')];if(_0x2add5e[_0x42d9('0x32')][_0x42d9('0x42')]){_0x25bb81['include']=[{'all':!![]}];}_0x25bb81=_[_0x42d9('0x3f')]({},_0x25bb81,_0x2add5e[_0x42d9('0x41')]);return db[_0x42d9('0x2b')][_0x42d9('0x48')](_0x25bb81)[_0x42d9('0x23')](handleEntityNotFound(_0x2f9828,null))[_0x42d9('0x23')](respondWithResult(_0x2f9828,null))[_0x42d9('0x45')](handleError(_0x2f9828,null));};exports[_0x42d9('0x22')]=function(_0x14f643,_0x279442){if(_0x14f643[_0x42d9('0x49')]['id']){delete _0x14f643[_0x42d9('0x49')]['id'];}return db[_0x42d9('0x2b')][_0x42d9('0x48')]({'where':{'id':_0x14f643['params']['id']}})[_0x42d9('0x23')](handleEntityNotFound(_0x279442,null))[_0x42d9('0x23')](saveUpdates(_0x14f643[_0x42d9('0x49')],null))[_0x42d9('0x23')](respondWithResult(_0x279442,null))[_0x42d9('0x45')](handleError(_0x279442,null));};exports[_0x42d9('0x4a')]=function(_0x5d53fa,_0x5f20c1,_0x450301){return db['sequelize'][_0x42d9('0x4b')](function(_0x5d635f){if(_0x5d53fa[_0x42d9('0x49')][_0x42d9('0x4c')]===_0x42d9('0x4d')){_0x5d53fa[_0x42d9('0x49')][_0x42d9('0x4e')]=path[_0x42d9('0x4f')](config[_0x42d9('0x50')],_0x42d9('0x51'),_0x5d53fa['body']['name']);}return db[_0x42d9('0x2b')][_0x42d9('0x4a')](_0x5d53fa[_0x42d9('0x49')],{'transaction':_0x5d635f})[_0x42d9('0x23')](function(_0x45e08b){if(_0x5d53fa[_0x42d9('0x49')][_0x42d9('0x4c')]===_0x42d9('0x4d')){fs[_0x42d9('0x52')](_0x45e08b['directory'],parseInt(_0x42d9('0x53'),0x8));}var _0x40d014=_0x5d53fa[_0x42d9('0x54')][_0x42d9('0x25')]({'plain':!![]});if(!_0x40d014)throw new Error(_0x42d9('0x55'));if(_0x40d014[_0x42d9('0x56')]===_0x42d9('0x54')){var _0x4af121=_0x45e08b[_0x42d9('0x25')]({'plain':!![]});return db[_0x42d9('0x57')]['find']({'where':{'name':_0x42d9('0x26'),'userProfileId':_0x40d014[_0x42d9('0x58')]},'raw':!![]})[_0x42d9('0x23')](function(_0x12184a){if(_0x12184a&&_0x12184a['autoAssociation']===0x0){return db[_0x42d9('0x27')][_0x42d9('0x4a')]({'name':_0x4af121[_0x42d9('0x29')],'resourceId':_0x4af121['id'],'type':_0x12184a['name'],'sectionId':_0x12184a['id']},{})['then'](function(){return _0x45e08b;});}else{return _0x45e08b;}})[_0x42d9('0x45')](function(_0xab9017){logger[_0x42d9('0x28')](_0x42d9('0x59'),_0xab9017);});}return _0x45e08b;});})[_0x42d9('0x23')](respondWithResult(_0x5f20c1,0xc9))['catch'](handleError(_0x5f20c1,null));};exports[_0x42d9('0x24')]=function(_0x4c4e18,_0x36c376,_0x3dcaf4){var _0x14df76;return db[_0x42d9('0x2b')][_0x42d9('0x48')]({'where':{'id':_0x4c4e18[_0x42d9('0x46')]['id']}})['then'](function(_0x1e99ac){if(_0x1e99ac){return db[_0x42d9('0x5a')][_0x42d9('0x4b')](function(_0x5986c1){return _0x1e99ac[_0x42d9('0x24')]({'transaction':_0x5986c1,'raw':!![]})['then'](function(_0x543832){if(_0x543832[_0x42d9('0x4e')]){fs['readdirSync'](_0x543832[_0x42d9('0x4e')])[_0x42d9('0x5b')](function(_0x19c04e){fs[_0x42d9('0x5c')](path['join'](_0x543832[_0x42d9('0x4e')],_0x19c04e));});fs[_0x42d9('0x5d')](_0x543832[_0x42d9('0x4e')]);}return _0x543832;});})[_0x42d9('0x45')](function(_0x400b4c){throw new db[(_0x42d9('0x5e'))][(_0x42d9('0x5f'))](_0x400b4c[_0x42d9('0x60')]);});}})[_0x42d9('0x23')](handleEntityNotFound(_0x36c376,null))[_0x42d9('0x23')](removeEntity(_0x36c376,null))[_0x42d9('0x45')](handleError(_0x36c376,null));};exports[_0x42d9('0x61')]=function(_0x578df8,_0x514867,_0x2fdf50){return db[_0x42d9('0x5a')][_0x42d9('0x4b')](function(_0x55192d){var _0x259960;return db['VoiceMusicOnHold'][_0x42d9('0x48')]({'where':{'id':_0x578df8[_0x42d9('0x46')]['id']}})[_0x42d9('0x23')](function(_0x3cf233){if(_0x3cf233){_0x259960=_0x3cf233;return _0x3cf233[_0x42d9('0x61')](_0x578df8['body']['id'],{'transaction':_0x55192d});}})[_0x42d9('0x23')](function(_0x16b692){if(_0x16b692){return db['Sound'][_0x42d9('0x62')]({'where':{'id':_0x578df8['body']['id']},'attributes':['id',_0x42d9('0x29'),_0x42d9('0x63'),_0x42d9('0x64'),_0x42d9('0x65')],'raw':!![]});}})[_0x42d9('0x23')](function(_0x4d8039){if(_0x4d8039){var _0x13a846=path[_0x42d9('0x4f')](config['root'],_0x42d9('0x66'),util[_0x42d9('0x67')](_0x42d9('0x68'),path[_0x42d9('0x69')](_0x4d8039[_0x42d9('0x63')],path[_0x42d9('0x6a')](_0x4d8039[_0x42d9('0x63')])),_0x4d8039['converted_format']));var _0xf2c610=path[_0x42d9('0x4f')](config[_0x42d9('0x50')],_0x42d9('0x51'),_0x259960['name'],util[_0x42d9('0x67')](_0x42d9('0x68'),_0x4d8039[_0x42d9('0x29')],_0x4d8039[_0x42d9('0x64')]));fs[_0x42d9('0x6b')](_0x13a846,_0xf2c610);return _0x4d8039;}})['catch'](function(_0x185122){throw new db[(_0x42d9('0x5e'))][(_0x42d9('0x5f'))](_0x185122[_0x42d9('0x60')]);});})[_0x42d9('0x23')](handleEntityNotFound(_0x514867,null))['then'](respondWithResult(_0x514867,0xc9))['catch'](handleError(_0x514867,null));};exports[_0x42d9('0x6c')]=function(_0x4a525c,_0x1dc109,_0xd8c681){return db[_0x42d9('0x5a')]['transaction'](function(_0x58d8e7){var _0x5767d5;return db[_0x42d9('0x2b')][_0x42d9('0x62')]({'where':{'id':_0x4a525c[_0x42d9('0x46')]['id']}})['then'](handleEntityNotFound(_0x1dc109,null))[_0x42d9('0x23')](function(_0x7a6a3b){if(_0x7a6a3b){_0x5767d5=_0x7a6a3b;return _0x7a6a3b[_0x42d9('0x6c')](_0x4a525c[_0x42d9('0x46')][_0x42d9('0x6d')]);}})[_0x42d9('0x23')](function(_0x54fe54){if(_0x54fe54){return db['Sound'][_0x42d9('0x62')]({'where':{'id':_0x4a525c[_0x42d9('0x46')][_0x42d9('0x6d')]},'attributes':['id',_0x42d9('0x29'),_0x42d9('0x63'),_0x42d9('0x64'),'createdAt'],'raw':!![]});}})[_0x42d9('0x23')](function(_0x1f1abf){if(_0x1f1abf){fs[_0x42d9('0x5c')](path[_0x42d9('0x4f')](_0x5767d5[_0x42d9('0x4e')],util[_0x42d9('0x67')](_0x42d9('0x68'),_0x1f1abf[_0x42d9('0x29')],_0x1f1abf[_0x42d9('0x64')])));return _0x1f1abf;}})[_0x42d9('0x45')](function(_0x2337a2){throw new db[(_0x42d9('0x5e'))][(_0x42d9('0x5f'))](_0x2337a2[_0x42d9('0x60')]);});})['then'](handleEntityNotFound(_0x1dc109,null))[_0x42d9('0x23')](respondWithStatusCode(_0x1dc109,0xcc))['catch'](handleError(_0x1dc109,null));};exports[_0x42d9('0x6e')]=function(_0x28d53b,_0x2882ba,_0xc75c8f){var _0x5ee9be={};var _0x2d6d25={};var _0x273a21;var _0x173e9f;return db[_0x42d9('0x2b')]['findOne']({'where':{'id':_0x28d53b['params']['id']}})[_0x42d9('0x23')](handleEntityNotFound(_0x2882ba,null))[_0x42d9('0x23')](function(_0x534ae5){if(_0x534ae5){_0x273a21=_0x534ae5;_0x2d6d25[_0x42d9('0x30')]=_['keys'](db[_0x42d9('0x6f')][_0x42d9('0x2c')]);_0x2d6d25[_0x42d9('0x32')]=_[_0x42d9('0x33')](_0x28d53b[_0x42d9('0x32')]);_0x2d6d25['filters']=_[_0x42d9('0x35')](_0x2d6d25[_0x42d9('0x30')],_0x2d6d25[_0x42d9('0x32')]);_0x5ee9be['attributes']=_[_0x42d9('0x35')](_0x2d6d25[_0x42d9('0x30')],qs['fields'](_0x28d53b['query'][_0x42d9('0x37')]));_0x5ee9be[_0x42d9('0x36')]=_0x5ee9be[_0x42d9('0x36')][_0x42d9('0x47')]?_0x5ee9be[_0x42d9('0x36')]:_0x2d6d25['model'];_0x5ee9be['order']=qs['sort'](_0x28d53b[_0x42d9('0x32')][_0x42d9('0x3b')]);_0x5ee9be[_0x42d9('0x3c')]=qs[_0x42d9('0x34')](_[_0x42d9('0x3d')](_0x28d53b['query'],_0x2d6d25['filters']));if(_0x28d53b[_0x42d9('0x32')]['filter']){_0x5ee9be['where']=_[_0x42d9('0x3f')](_0x5ee9be['where'],{'$or':_[_0x42d9('0x31')](_0x5ee9be[_0x42d9('0x36')],function(_0x145a42){var _0x23711d={};_0x23711d[_0x145a42]={'$like':'%'+_0x28d53b[_0x42d9('0x32')][_0x42d9('0x3e')]+'%'};return _0x23711d;})});}_0x5ee9be=_[_0x42d9('0x3f')]({},_0x5ee9be,_0x28d53b[_0x42d9('0x41')]);return _0x273a21[_0x42d9('0x6e')](_0x5ee9be);}})[_0x42d9('0x23')](function(_0x432dac){if(_0x432dac){_0x173e9f=_0x432dac[_0x42d9('0x47')];if(!_0x28d53b[_0x42d9('0x32')][_0x42d9('0x38')](_0x42d9('0x39'))){_0x5ee9be[_0x42d9('0x1c')]=qs['limit'](_0x28d53b[_0x42d9('0x32')]['limit']);_0x5ee9be['offset']=qs['offset'](_0x28d53b[_0x42d9('0x32')]['offset']);}return _0x273a21[_0x42d9('0x6e')](_0x5ee9be);}})[_0x42d9('0x23')](function(_0x4a18f3){if(_0x4a18f3){return _0x4a18f3?{'count':_0x173e9f,'rows':_0x4a18f3}:null;}})['then'](respondWithResult(_0x2882ba,null))['catch'](handleError(_0x2882ba,null));}; \ No newline at end of file +var _0xce34=['../../mysqldb','status','end','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','name','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','body','create','sequelize','transaction','mode','directory','join','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','extname','save_name','symlinkSync','removeSound','id2','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xce34,0x131));var _0x4ce3=function(_0x2fd9a3,_0x5e1a95){_0x2fd9a3=_0x2fd9a3-0x0;var _0x34866a=_0xce34[_0x2fd9a3];return _0x34866a;};'use strict';var emlformat=require(_0x4ce3('0x0'));var rimraf=require(_0x4ce3('0x1'));var zipdir=require(_0x4ce3('0x2'));var jsonpatch=require(_0x4ce3('0x3'));var rp=require(_0x4ce3('0x4'));var moment=require(_0x4ce3('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4ce3('0x6'));var util=require(_0x4ce3('0x7'));var path=require(_0x4ce3('0x8'));var sox=require(_0x4ce3('0x9'));var csv=require(_0x4ce3('0xa'));var ejs=require(_0x4ce3('0xb'));var fs=require('fs');var fs_extra=require(_0x4ce3('0xc'));var _=require(_0x4ce3('0xd'));var squel=require(_0x4ce3('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4ce3('0xf'));var toCsv=require(_0x4ce3('0xa'));var querystring=require(_0x4ce3('0x10'));var Papa=require(_0x4ce3('0x11'));var Redis=require(_0x4ce3('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4ce3('0x13'));var as=require(_0x4ce3('0x14'));var hardwareService=require(_0x4ce3('0x15'));var logger=require(_0x4ce3('0x16'))('api');var utils=require(_0x4ce3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ce3('0x18'));var db=require(_0x4ce3('0x19'))['db'];function respondWithStatusCode(_0x450e80,_0x4dc339){_0x4dc339=_0x4dc339||0xcc;return function(_0xbd6a09){if(_0xbd6a09){return _0x450e80['sendStatus'](_0x4dc339);}return _0x450e80[_0x4ce3('0x1a')](_0x4dc339)[_0x4ce3('0x1b')]();};}function respondWithResult(_0x1a2e4a,_0x57f728){_0x57f728=_0x57f728||0xc8;return function(_0x44e72d){if(_0x44e72d){return _0x1a2e4a[_0x4ce3('0x1a')](_0x57f728)['json'](_0x44e72d);}};}function respondWithFilteredResult(_0x11e30f,_0x34647a){return function(_0x4c3c81){if(_0x4c3c81){var _0x2eacd4=typeof _0x34647a[_0x4ce3('0x1c')]===_0x4ce3('0x1d')&&typeof _0x34647a['limit']===_0x4ce3('0x1d');var _0x574212=_0x4c3c81[_0x4ce3('0x1e')];var _0x535f92=_0x2eacd4?0x0:_0x34647a[_0x4ce3('0x1c')];var _0x2c9405=_0x2eacd4?_0x4c3c81[_0x4ce3('0x1e')]:_0x34647a[_0x4ce3('0x1c')]+_0x34647a['limit'];var _0x5db7a8;if(_0x2c9405>=_0x574212){_0x2c9405=_0x574212;_0x5db7a8=0xc8;}else{_0x5db7a8=0xce;}_0x11e30f[_0x4ce3('0x1a')](_0x5db7a8);return _0x11e30f['set'](_0x4ce3('0x1f'),_0x535f92+'-'+_0x2c9405+'/'+_0x574212)['json'](_0x4c3c81);}return null;};}function patchUpdates(_0x3c7538){return function(_0x5530d9){try{jsonpatch[_0x4ce3('0x20')](_0x5530d9,_0x3c7538,!![]);}catch(_0x5b0a56){return BPromise[_0x4ce3('0x21')](_0x5b0a56);}return _0x5530d9[_0x4ce3('0x22')]();};}function saveUpdates(_0x2e13eb,_0x34d855){return function(_0x44be46){if(_0x44be46){return _0x44be46[_0x4ce3('0x23')](_0x2e13eb)[_0x4ce3('0x24')](function(_0x25fa4a){return _0x25fa4a;});}return null;};}function removeEntity(_0x2df01b,_0x584459){return function(_0x2d0e46){if(_0x2d0e46){return _0x2d0e46[_0x4ce3('0x25')]()[_0x4ce3('0x24')](function(){var _0xd2c492=_0x2d0e46[_0x4ce3('0x26')]({'plain':!![]});var _0x3f68a2=_0x4ce3('0x27');return db[_0x4ce3('0x28')]['destroy']({'where':{'type':_0x3f68a2,'resourceId':_0xd2c492['id']}})[_0x4ce3('0x24')](function(){return _0x2d0e46;});})[_0x4ce3('0x24')](function(){_0x2df01b[_0x4ce3('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59e20f,_0x1b15e8){return function(_0x7d3316){if(!_0x7d3316){_0x59e20f[_0x4ce3('0x29')](0x194);}return _0x7d3316;};}function handleError(_0x33c899,_0xf77c39){_0xf77c39=_0xf77c39||0x1f4;return function(_0x2b585e){logger[_0x4ce3('0x2a')](_0x2b585e['stack']);if(_0x2b585e[_0x4ce3('0x2b')]){delete _0x2b585e['name'];}_0x33c899[_0x4ce3('0x1a')](_0xf77c39)[_0x4ce3('0x2c')](_0x2b585e);};}exports['index']=function(_0x3b041f,_0x2bed40){var _0x4c4c2e={},_0x570165={},_0x50871f={'count':0x0,'rows':[]};var _0x1880d3=_[_0x4ce3('0x2d')](db[_0x4ce3('0x2e')][_0x4ce3('0x2f')],function(_0x5538f6){return{'name':_0x5538f6[_0x4ce3('0x30')],'type':_0x5538f6[_0x4ce3('0x31')][_0x4ce3('0x32')]};});_0x570165[_0x4ce3('0x33')]=_[_0x4ce3('0x2d')](_0x1880d3,_0x4ce3('0x2b'));_0x570165[_0x4ce3('0x34')]=_[_0x4ce3('0x35')](_0x3b041f[_0x4ce3('0x34')]);_0x570165[_0x4ce3('0x36')]=_[_0x4ce3('0x37')](_0x570165['model'],_0x570165[_0x4ce3('0x34')]);_0x4c4c2e[_0x4ce3('0x38')]=_[_0x4ce3('0x37')](_0x570165[_0x4ce3('0x33')],qs['fields'](_0x3b041f['query'][_0x4ce3('0x39')]));_0x4c4c2e[_0x4ce3('0x38')]=_0x4c4c2e[_0x4ce3('0x38')][_0x4ce3('0x3a')]?_0x4c4c2e[_0x4ce3('0x38')]:_0x570165['model'];if(!_0x3b041f[_0x4ce3('0x34')][_0x4ce3('0x3b')](_0x4ce3('0x3c'))){_0x4c4c2e['limit']=qs[_0x4ce3('0x3d')](_0x3b041f[_0x4ce3('0x34')][_0x4ce3('0x3d')]);_0x4c4c2e[_0x4ce3('0x1c')]=qs[_0x4ce3('0x1c')](_0x3b041f[_0x4ce3('0x34')]['offset']);}_0x4c4c2e[_0x4ce3('0x3e')]=qs['sort'](_0x3b041f[_0x4ce3('0x34')][_0x4ce3('0x3f')]);delete _0x3b041f[_0x4ce3('0x34')][_0x4ce3('0x3f')];_0x4c4c2e[_0x4ce3('0x40')]=qs[_0x4ce3('0x36')](_[_0x4ce3('0x41')](_0x3b041f[_0x4ce3('0x34')],_0x570165[_0x4ce3('0x36')]),_0x1880d3);if(_0x3b041f['query'][_0x4ce3('0x42')]){_0x4c4c2e[_0x4ce3('0x40')]=_[_0x4ce3('0x43')](_0x4c4c2e[_0x4ce3('0x40')],{'$or':_[_0x4ce3('0x2d')](_0x1880d3,function(_0x4b1ca2){if(_0x4b1ca2[_0x4ce3('0x31')]!==_0x4ce3('0x44')){var _0x2a4d46={};_0x2a4d46[_0x4b1ca2['name']]={'$like':'%'+_0x3b041f[_0x4ce3('0x34')][_0x4ce3('0x42')]+'%'};return _0x2a4d46;}})});}_0x4c4c2e=_[_0x4ce3('0x43')]({},_0x4c4c2e,_0x3b041f['options']);var _0x50cc45={'where':_0x4c4c2e[_0x4ce3('0x40')]};return db[_0x4ce3('0x2e')][_0x4ce3('0x1e')](_0x50cc45)[_0x4ce3('0x24')](function(_0x2e4c39){_0x50871f[_0x4ce3('0x1e')]=_0x2e4c39;if(_0x3b041f[_0x4ce3('0x34')][_0x4ce3('0x45')]){_0x4c4c2e[_0x4ce3('0x46')]=[{'all':!![]}];}return db[_0x4ce3('0x2e')][_0x4ce3('0x47')](_0x4c4c2e);})['then'](function(_0x426bdd){_0x50871f[_0x4ce3('0x48')]=_0x426bdd;return _0x50871f;})['then'](respondWithFilteredResult(_0x2bed40,_0x4c4c2e))[_0x4ce3('0x49')](handleError(_0x2bed40,null));};exports['show']=function(_0x300d58,_0x15dfbe){var _0x2e9620={'raw':![],'where':{'id':_0x300d58[_0x4ce3('0x4a')]['id']}},_0x5588b0={};_0x5588b0[_0x4ce3('0x33')]=_[_0x4ce3('0x35')](db[_0x4ce3('0x2e')][_0x4ce3('0x2f')]);_0x5588b0['query']=_[_0x4ce3('0x35')](_0x300d58[_0x4ce3('0x34')]);_0x5588b0[_0x4ce3('0x36')]=_['intersection'](_0x5588b0[_0x4ce3('0x33')],_0x5588b0[_0x4ce3('0x34')]);_0x2e9620['attributes']=_[_0x4ce3('0x37')](_0x5588b0['model'],qs[_0x4ce3('0x39')](_0x300d58['query'][_0x4ce3('0x39')]));_0x2e9620[_0x4ce3('0x38')]=_0x2e9620['attributes'][_0x4ce3('0x3a')]?_0x2e9620[_0x4ce3('0x38')]:_0x5588b0['model'];if(_0x300d58[_0x4ce3('0x34')]['includeAll']){_0x2e9620[_0x4ce3('0x46')]=[{'all':!![]}];}_0x2e9620=_[_0x4ce3('0x43')]({},_0x2e9620,_0x300d58[_0x4ce3('0x4b')]);return db[_0x4ce3('0x2e')]['find'](_0x2e9620)[_0x4ce3('0x24')](handleEntityNotFound(_0x15dfbe,null))[_0x4ce3('0x24')](respondWithResult(_0x15dfbe,null))['catch'](handleError(_0x15dfbe,null));};exports[_0x4ce3('0x23')]=function(_0x5745c4,_0x32227c){if(_0x5745c4[_0x4ce3('0x4c')]['id']){delete _0x5745c4['body']['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x5745c4['params']['id']}})[_0x4ce3('0x24')](handleEntityNotFound(_0x32227c,null))['then'](saveUpdates(_0x5745c4[_0x4ce3('0x4c')],null))[_0x4ce3('0x24')](respondWithResult(_0x32227c,null))[_0x4ce3('0x49')](handleError(_0x32227c,null));};exports[_0x4ce3('0x4d')]=function(_0x393812,_0x57c49c,_0x28a5d0){return db[_0x4ce3('0x4e')][_0x4ce3('0x4f')](function(_0x315fc8){if(_0x393812['body'][_0x4ce3('0x50')]==='files'){_0x393812[_0x4ce3('0x4c')][_0x4ce3('0x51')]=path[_0x4ce3('0x52')](config['root'],_0x4ce3('0x53'),_0x393812['body'][_0x4ce3('0x2b')]);}return db[_0x4ce3('0x2e')][_0x4ce3('0x4d')](_0x393812[_0x4ce3('0x4c')],{'transaction':_0x315fc8})['then'](function(_0x3de810){if(_0x393812[_0x4ce3('0x4c')][_0x4ce3('0x50')]==='files'){fs[_0x4ce3('0x54')](_0x3de810[_0x4ce3('0x51')],parseInt('0777',0x8));}var _0x122bdd=_0x393812[_0x4ce3('0x55')][_0x4ce3('0x26')]({'plain':!![]});if(!_0x122bdd)throw new Error(_0x4ce3('0x56'));if(_0x122bdd[_0x4ce3('0x57')]==='user'){var _0x2c5f56=_0x3de810[_0x4ce3('0x26')]({'plain':!![]});return db[_0x4ce3('0x58')][_0x4ce3('0x59')]({'where':{'name':'MusicOnHolds','userProfileId':_0x122bdd['userProfileId']},'raw':!![]})['then'](function(_0x35506d){if(_0x35506d&&_0x35506d['autoAssociation']===0x0){return db['UserProfileResource'][_0x4ce3('0x4d')]({'name':_0x2c5f56['name'],'resourceId':_0x2c5f56['id'],'type':_0x35506d[_0x4ce3('0x2b')],'sectionId':_0x35506d['id']},{})[_0x4ce3('0x24')](function(){return _0x3de810;});}else{return _0x3de810;}})[_0x4ce3('0x49')](function(_0x35f9db){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35f9db);});}return _0x3de810;});})['then'](respondWithResult(_0x57c49c,0xc9))[_0x4ce3('0x49')](handleError(_0x57c49c,null));};exports[_0x4ce3('0x25')]=function(_0x42fe4d,_0xee1d74,_0x4500da){var _0x400124;return db[_0x4ce3('0x2e')][_0x4ce3('0x59')]({'where':{'id':_0x42fe4d[_0x4ce3('0x4a')]['id']}})[_0x4ce3('0x24')](function(_0x53cb5a){if(_0x53cb5a){return db[_0x4ce3('0x4e')][_0x4ce3('0x4f')](function(_0x3a150c){return _0x53cb5a[_0x4ce3('0x25')]({'transaction':_0x3a150c,'raw':!![]})['then'](function(_0x2bd4ce){if(_0x2bd4ce[_0x4ce3('0x51')]){fs['readdirSync'](_0x2bd4ce[_0x4ce3('0x51')])['forEach'](function(_0x32a9f5){fs[_0x4ce3('0x5a')](path['join'](_0x2bd4ce['directory'],_0x32a9f5));});fs['rmdirSync'](_0x2bd4ce['directory']);}return _0x2bd4ce;});})[_0x4ce3('0x49')](function(_0x118e2c){throw new db[(_0x4ce3('0x5b'))][(_0x4ce3('0x5c'))](_0x118e2c[_0x4ce3('0x5d')]);});}})[_0x4ce3('0x24')](handleEntityNotFound(_0xee1d74,null))['then'](removeEntity(_0xee1d74,null))[_0x4ce3('0x49')](handleError(_0xee1d74,null));};exports['addSound']=function(_0x5cb550,_0x5b8f59,_0x7a6619){return db[_0x4ce3('0x4e')][_0x4ce3('0x4f')](function(_0x384900){var _0x43eb23;return db[_0x4ce3('0x2e')][_0x4ce3('0x59')]({'where':{'id':_0x5cb550[_0x4ce3('0x4a')]['id']}})['then'](function(_0x4a25f0){if(_0x4a25f0){_0x43eb23=_0x4a25f0;return _0x4a25f0[_0x4ce3('0x5e')](_0x5cb550[_0x4ce3('0x4c')]['id'],{'transaction':_0x384900});}})[_0x4ce3('0x24')](function(_0x5434f5){if(_0x5434f5){return db[_0x4ce3('0x5f')][_0x4ce3('0x60')]({'where':{'id':_0x5cb550[_0x4ce3('0x4c')]['id']},'attributes':['id','name','save_name',_0x4ce3('0x61'),_0x4ce3('0x62')],'raw':!![]});}})['then'](function(_0x1f70ae){if(_0x1f70ae){var _0x16b7ed=path[_0x4ce3('0x52')](config[_0x4ce3('0x63')],_0x4ce3('0x64'),util[_0x4ce3('0x65')](_0x4ce3('0x66'),path[_0x4ce3('0x67')](_0x1f70ae['save_name'],path[_0x4ce3('0x68')](_0x1f70ae[_0x4ce3('0x69')])),_0x1f70ae[_0x4ce3('0x61')]));var _0xe1cd38=path[_0x4ce3('0x52')](config[_0x4ce3('0x63')],_0x4ce3('0x53'),_0x43eb23[_0x4ce3('0x2b')],util[_0x4ce3('0x65')](_0x4ce3('0x66'),_0x1f70ae[_0x4ce3('0x2b')],_0x1f70ae['converted_format']));fs[_0x4ce3('0x6a')](_0x16b7ed,_0xe1cd38);return _0x1f70ae;}})['catch'](function(_0x565576){throw new db['Sequelize'][(_0x4ce3('0x5c'))](_0x565576[_0x4ce3('0x5d')]);});})['then'](handleEntityNotFound(_0x5b8f59,null))[_0x4ce3('0x24')](respondWithResult(_0x5b8f59,0xc9))[_0x4ce3('0x49')](handleError(_0x5b8f59,null));};exports[_0x4ce3('0x6b')]=function(_0x3afa7e,_0x481919,_0x229eb0){return db[_0x4ce3('0x4e')][_0x4ce3('0x4f')](function(_0x3e4e82){var _0x22aaab;return db[_0x4ce3('0x2e')][_0x4ce3('0x60')]({'where':{'id':_0x3afa7e[_0x4ce3('0x4a')]['id']}})[_0x4ce3('0x24')](handleEntityNotFound(_0x481919,null))['then'](function(_0xf05272){if(_0xf05272){_0x22aaab=_0xf05272;return _0xf05272[_0x4ce3('0x6b')](_0x3afa7e['params'][_0x4ce3('0x6c')]);}})[_0x4ce3('0x24')](function(_0x101ff0){if(_0x101ff0){return db[_0x4ce3('0x5f')][_0x4ce3('0x60')]({'where':{'id':_0x3afa7e[_0x4ce3('0x4a')][_0x4ce3('0x6c')]},'attributes':['id','name',_0x4ce3('0x69'),_0x4ce3('0x61'),_0x4ce3('0x62')],'raw':!![]});}})[_0x4ce3('0x24')](function(_0xa8c6ae){if(_0xa8c6ae){fs['unlinkSync'](path[_0x4ce3('0x52')](_0x22aaab[_0x4ce3('0x51')],util[_0x4ce3('0x65')](_0x4ce3('0x66'),_0xa8c6ae[_0x4ce3('0x2b')],_0xa8c6ae[_0x4ce3('0x61')])));return _0xa8c6ae;}})[_0x4ce3('0x49')](function(_0x13279e){throw new db[(_0x4ce3('0x5b'))][(_0x4ce3('0x5c'))](_0x13279e[_0x4ce3('0x5d')]);});})[_0x4ce3('0x24')](handleEntityNotFound(_0x481919,null))['then'](respondWithStatusCode(_0x481919,0xcc))['catch'](handleError(_0x481919,null));};exports['getSounds']=function(_0x3e51f8,_0x7ee8dd,_0x379fb5){var _0x12ce88={};var _0x5af6d5={};var _0x1bad88;var _0x2e648f;return db[_0x4ce3('0x2e')]['findOne']({'where':{'id':_0x3e51f8[_0x4ce3('0x4a')]['id']}})[_0x4ce3('0x24')](handleEntityNotFound(_0x7ee8dd,null))[_0x4ce3('0x24')](function(_0x78f453){if(_0x78f453){_0x1bad88=_0x78f453;_0x5af6d5[_0x4ce3('0x33')]=_[_0x4ce3('0x35')](db[_0x4ce3('0x5f')]['rawAttributes']);_0x5af6d5[_0x4ce3('0x34')]=_['keys'](_0x3e51f8[_0x4ce3('0x34')]);_0x5af6d5[_0x4ce3('0x36')]=_[_0x4ce3('0x37')](_0x5af6d5[_0x4ce3('0x33')],_0x5af6d5[_0x4ce3('0x34')]);_0x12ce88['attributes']=_[_0x4ce3('0x37')](_0x5af6d5[_0x4ce3('0x33')],qs['fields'](_0x3e51f8['query']['fields']));_0x12ce88[_0x4ce3('0x38')]=_0x12ce88[_0x4ce3('0x38')][_0x4ce3('0x3a')]?_0x12ce88[_0x4ce3('0x38')]:_0x5af6d5[_0x4ce3('0x33')];_0x12ce88[_0x4ce3('0x3e')]=qs[_0x4ce3('0x3f')](_0x3e51f8['query']['sort']);_0x12ce88[_0x4ce3('0x40')]=qs[_0x4ce3('0x36')](_['pick'](_0x3e51f8[_0x4ce3('0x34')],_0x5af6d5[_0x4ce3('0x36')]));if(_0x3e51f8[_0x4ce3('0x34')][_0x4ce3('0x42')]){_0x12ce88[_0x4ce3('0x40')]=_[_0x4ce3('0x43')](_0x12ce88[_0x4ce3('0x40')],{'$or':_[_0x4ce3('0x2d')](_0x12ce88['attributes'],function(_0x193ee7){var _0x48ed4a={};_0x48ed4a[_0x193ee7]={'$like':'%'+_0x3e51f8[_0x4ce3('0x34')][_0x4ce3('0x42')]+'%'};return _0x48ed4a;})});}_0x12ce88=_[_0x4ce3('0x43')]({},_0x12ce88,_0x3e51f8[_0x4ce3('0x4b')]);return _0x1bad88['getSounds'](_0x12ce88);}})['then'](function(_0x143d61){if(_0x143d61){_0x2e648f=_0x143d61[_0x4ce3('0x3a')];if(!_0x3e51f8[_0x4ce3('0x34')][_0x4ce3('0x3b')](_0x4ce3('0x3c'))){_0x12ce88[_0x4ce3('0x3d')]=qs['limit'](_0x3e51f8['query'][_0x4ce3('0x3d')]);_0x12ce88[_0x4ce3('0x1c')]=qs['offset'](_0x3e51f8['query'][_0x4ce3('0x1c')]);}return _0x1bad88[_0x4ce3('0x6d')](_0x12ce88);}})[_0x4ce3('0x24')](function(_0x2048fc){if(_0x2048fc){return _0x2048fc?{'count':_0x2e648f,'rows':_0x2048fc}:null;}})[_0x4ce3('0x24')](respondWithResult(_0x7ee8dd,null))['catch'](handleError(_0x7ee8dd,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index bece3b1..18f9684 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 _0x6ed7=['../../config/environment','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x6ed7,0x163));var _0x76ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ed7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x76ed('0x0'));var util=require(_0x76ed('0x1'));var logger=require(_0x76ed('0x2'))(_0x76ed('0x3'));var moment=require(_0x76ed('0x4'));var BPromise=require(_0x76ed('0x5'));var rp=require(_0x76ed('0x6'));var fs=require('fs');var path=require(_0x76ed('0x7'));var rimraf=require(_0x76ed('0x8'));var config=require(_0x76ed('0x9'));var attributes=require(_0x76ed('0xa'));module[_0x76ed('0xb')]=function(_0x55947d,_0x4ec97b){return _0x55947d['define'](_0x76ed('0xc'),attributes,{'tableName':_0x76ed('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x76d5=['path','../../config/environment','./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0x59a483,_0x3f37de){var _0x3311f6=function(_0x243e75){while(--_0x243e75){_0x59a483['push'](_0x59a483['shift']());}};_0x3311f6(++_0x3f37de);}(_0x76d5,0x9b));var _0x576d=function(_0x4b6f84,_0x3f5e22){_0x4b6f84=_0x4b6f84-0x0;var _0x4f6909=_0x76d5[_0x4b6f84];return _0x4f6909;};'use strict';var _=require(_0x576d('0x0'));var util=require('util');var logger=require(_0x576d('0x1'))('api');var moment=require(_0x576d('0x2'));var BPromise=require(_0x576d('0x3'));var rp=require(_0x576d('0x4'));var fs=require('fs');var path=require(_0x576d('0x5'));var rimraf=require('rimraf');var config=require(_0x576d('0x6'));var attributes=require(_0x576d('0x7'));module['exports']=function(_0xe0c143,_0x589bc9){return _0xe0c143[_0x576d('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x576d('0x9'),'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 2b51afa..0746f63 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x48754e,_0x53227e){var _0x248110=function(_0x43059f){while(--_0x43059f){_0x48754e['push'](_0x48754e['shift']());}};_0x248110(++_0x53227e);}(_0x70e0,0x17b));var _0x070e=function(_0x8dbe8f,_0x4511e9){_0x8dbe8f=_0x8dbe8f-0x0;var _0x3490dc=_0x70e0[_0x8dbe8f];return _0x3490dc;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x19ee1d,_0x92fcba){var _0x3b8e65=function(_0x5e982b){while(--_0x5e982b){_0x19ee1d['push'](_0x19ee1d['shift']());}};_0x3b8e65(++_0x92fcba);}(_0x9c44,0x178));var _0x49c4=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x9c44[_0x15bc81];return _0x59440e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 7a37fbe..81d5867 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 _0x74eb=['index','isAuthenticated','/:id','show','getAgents','/:id/teams','getTeams','post','/:id/users','addAgents','addTeams','update','delete','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x74eb,0x13b));var _0xb74e=function(_0x525d3c,_0x33a8b3){_0x525d3c=_0x525d3c-0x0;var _0x3de256=_0x74eb[_0x525d3c];return _0x3de256;};'use strict';var multer=require(_0xb74e('0x0'));var util=require(_0xb74e('0x1'));var path=require(_0xb74e('0x2'));var timeout=require('connect-timeout');var express=require(_0xb74e('0x3'));var router=express[_0xb74e('0x4')]();var fs_extra=require(_0xb74e('0x5'));var auth=require(_0xb74e('0x6'));var interaction=require(_0xb74e('0x7'));var config=require(_0xb74e('0x8'));var controller=require('./voicePrefix.controller');router[_0xb74e('0x9')]('/',auth['isAuthenticated'](),controller[_0xb74e('0xa')]);router[_0xb74e('0x9')]('/describe',auth[_0xb74e('0xb')](),controller['describe']);router['get'](_0xb74e('0xc'),auth['isAuthenticated'](),controller[_0xb74e('0xd')]);router[_0xb74e('0x9')]('/:id/users',auth[_0xb74e('0xb')](),controller[_0xb74e('0xe')]);router[_0xb74e('0x9')](_0xb74e('0xf'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x10')]);router[_0xb74e('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb74e('0x11')](_0xb74e('0x12'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x13')]);router[_0xb74e('0x11')](_0xb74e('0xf'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x14')]);router['put'](_0xb74e('0xc'),auth[_0xb74e('0xb')](),controller[_0xb74e('0x15')]);router['delete']('/:id',auth[_0xb74e('0xb')](),controller['destroy']);router[_0xb74e('0x16')]('/:id/users',auth[_0xb74e('0xb')](),controller[_0xb74e('0x17')]);router[_0xb74e('0x16')](_0xb74e('0xf'),auth['isAuthenticated'](),controller['removeTeams']);module[_0xb74e('0x18')]=router; \ No newline at end of file +var _0x35c8=['destroy','/:id/users','removeAgents','removeTeams','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','show','getAgents','/:id/teams','create','post','addAgents','addTeams','put','/:id','delete'];(function(_0x11b4b5,_0x11fc74){var _0x42cf0d=function(_0x3e2b5f){while(--_0x3e2b5f){_0x11b4b5['push'](_0x11b4b5['shift']());}};_0x42cf0d(++_0x11fc74);}(_0x35c8,0xa6));var _0x835c=function(_0x4c2230,_0x469f3b){_0x4c2230=_0x4c2230-0x0;var _0x49a111=_0x35c8[_0x4c2230];return _0x49a111;};'use strict';var multer=require(_0x835c('0x0'));var util=require(_0x835c('0x1'));var path=require(_0x835c('0x2'));var timeout=require(_0x835c('0x3'));var express=require(_0x835c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x835c('0x5'));var interaction=require(_0x835c('0x6'));var config=require(_0x835c('0x7'));var controller=require(_0x835c('0x8'));router[_0x835c('0x9')]('/',auth[_0x835c('0xa')](),controller[_0x835c('0xb')]);router[_0x835c('0x9')]('/describe',auth[_0x835c('0xa')](),controller[_0x835c('0xc')]);router[_0x835c('0x9')]('/:id',auth[_0x835c('0xa')](),controller[_0x835c('0xd')]);router[_0x835c('0x9')]('/:id/users',auth[_0x835c('0xa')](),controller[_0x835c('0xe')]);router[_0x835c('0x9')](_0x835c('0xf'),auth[_0x835c('0xa')](),controller['getTeams']);router['post']('/',auth[_0x835c('0xa')](),controller[_0x835c('0x10')]);router[_0x835c('0x11')]('/:id/users',auth[_0x835c('0xa')](),controller[_0x835c('0x12')]);router['post']('/:id/teams',auth[_0x835c('0xa')](),controller[_0x835c('0x13')]);router[_0x835c('0x14')](_0x835c('0x15'),auth[_0x835c('0xa')](),controller['update']);router[_0x835c('0x16')](_0x835c('0x15'),auth[_0x835c('0xa')](),controller[_0x835c('0x17')]);router[_0x835c('0x16')](_0x835c('0x18'),auth[_0x835c('0xa')](),controller[_0x835c('0x19')]);router[_0x835c('0x16')](_0x835c('0xf'),auth[_0x835c('0xa')](),controller[_0x835c('0x1a')]);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 284dd93..9b93137 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 _0x1a35=['STRING','sequelize','VIRTUAL','system-','getDataValue','name'];(function(_0x3bef15,_0x248e6b){var _0x4b649e=function(_0xb6b3ca){while(--_0xb6b3ca){_0x3bef15['push'](_0x3bef15['shift']());}};_0x4b649e(++_0x248e6b);}(_0x1a35,0x1ab));var _0x51a3=function(_0x597f4a,_0x3823fa){_0x597f4a=_0x597f4a-0x0;var _0x496da0=_0x1a35[_0x597f4a];return _0x496da0;};'use strict';var Sequelize=require(_0x51a3('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x51a3('0x1')],'get':function(_0x5e1163){return _0x51a3('0x2')+this[_0x51a3('0x3')](_0x51a3('0x4'))+'-';}},'description':{'type':Sequelize[_0x51a3('0x5')]},'callerIdAll':{'type':Sequelize[_0x51a3('0x5')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb8f6=['getDataValue','exports','STRING','name','VIRTUAL'];(function(_0x2b13f6,_0x11949d){var _0x4a2ee0=function(_0x505b6d){while(--_0x505b6d){_0x2b13f6['push'](_0x2b13f6['shift']());}};_0x4a2ee0(++_0x11949d);}(_0xb8f6,0x141));var _0x6b8f=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xb8f6[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require('sequelize');module[_0x6b8f('0x0')]={'name':{'type':Sequelize[_0x6b8f('0x1')],'allowNull':![],'unique':_0x6b8f('0x2')},'prefix':{'type':Sequelize[_0x6b8f('0x3')],'get':function(_0x3cba6d){return'system-'+this[_0x6b8f('0x4')](_0x6b8f('0x2'))+'-';}},'description':{'type':Sequelize[_0x6b8f('0x1')]},'callerIdAll':{'type':Sequelize[_0x6b8f('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 239b835..6083456 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 _0x32b6=['request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','destroy','get','VoicePrefixes','UserProfileResource','then','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','key','map','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','type','merge','options','includeAll','include','rows','params','find','catch','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','system','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','nolimit','getTeams','hasOwnProperty','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','from','team_has_voice_prefixes','join','VoicePrefixId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','isEmpty','eml-format','rimraf','fast-json-patch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x32b6,0x1d1));var _0x632b=function(_0x19f2d7,_0x5a963a){_0x19f2d7=_0x19f2d7-0x0;var _0x543612=_0x32b6[_0x19f2d7];return _0x543612;};'use strict';var emlformat=require(_0x632b('0x0'));var rimraf=require(_0x632b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x632b('0x2'));var rp=require(_0x632b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x632b('0x4'));var util=require(_0x632b('0x5'));var path=require(_0x632b('0x6'));var sox=require(_0x632b('0x7'));var csv=require(_0x632b('0x8'));var ejs=require(_0x632b('0x9'));var fs=require('fs');var fs_extra=require(_0x632b('0xa'));var _=require(_0x632b('0xb'));var squel=require(_0x632b('0xc'));var crypto=require(_0x632b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x632b('0xe'));var toCsv=require(_0x632b('0x8'));var querystring=require(_0x632b('0xf'));var Papa=require(_0x632b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x632b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x632b('0x12'))(_0x632b('0x13'));var utils=require(_0x632b('0x14'));var config=require(_0x632b('0x15'));var licenseUtil=require(_0x632b('0x16'));var db=require(_0x632b('0x17'))['db'];config[_0x632b('0x18')]=_[_0x632b('0x19')](config[_0x632b('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x632b('0x1a'))(new Redis(config[_0x632b('0x18')]));require(_0x632b('0x1b'))['register'](socket);function respondWithStatusCode(_0x721883,_0x1a3a60){_0x1a3a60=_0x1a3a60||0xcc;return function(_0x108249){if(_0x108249){return _0x721883[_0x632b('0x1c')](_0x1a3a60);}return _0x721883[_0x632b('0x1d')](_0x1a3a60)[_0x632b('0x1e')]();};}function respondWithResult(_0x4efe39,_0x17ddc5){_0x17ddc5=_0x17ddc5||0xc8;return function(_0x52f353){if(_0x52f353){return _0x4efe39['status'](_0x17ddc5)[_0x632b('0x1f')](_0x52f353);}};}function respondWithFilteredResult(_0x5afa1e,_0x2c8340){return function(_0x3bb27f){if(_0x3bb27f){var _0x28c472=typeof _0x2c8340['offset']===_0x632b('0x20')&&typeof _0x2c8340[_0x632b('0x21')]===_0x632b('0x20');var _0x3683e4=_0x3bb27f['count'];var _0x472e34=_0x28c472?0x0:_0x2c8340[_0x632b('0x22')];var _0x4f377f=_0x28c472?_0x3bb27f[_0x632b('0x23')]:_0x2c8340['offset']+_0x2c8340['limit'];var _0x1b1092;if(_0x4f377f>=_0x3683e4){_0x4f377f=_0x3683e4;_0x1b1092=0xc8;}else{_0x1b1092=0xce;}_0x5afa1e['status'](_0x1b1092);return _0x5afa1e[_0x632b('0x24')](_0x632b('0x25'),_0x472e34+'-'+_0x4f377f+'/'+_0x3683e4)[_0x632b('0x1f')](_0x3bb27f);}return null;};}function patchUpdates(_0x540bfb){return function(_0x10fc32){try{jsonpatch[_0x632b('0x26')](_0x10fc32,_0x540bfb,!![]);}catch(_0x59d83a){return BPromise[_0x632b('0x27')](_0x59d83a);}return _0x10fc32[_0x632b('0x28')]();};}function saveUpdates(_0x30ffb9,_0x1e448c){return function(_0x45d017){if(_0x45d017){return _0x45d017[_0x632b('0x29')](_0x30ffb9)['then'](function(_0x5e7b20){return _0x5e7b20;});}return null;};}function removeEntity(_0x11fe61,_0x4d3a70){return function(_0x4ebd26){if(_0x4ebd26){return _0x4ebd26[_0x632b('0x2a')]()['then'](function(){var _0x273e89=_0x4ebd26[_0x632b('0x2b')]({'plain':!![]});var _0x29d9aa=_0x632b('0x2c');return db[_0x632b('0x2d')][_0x632b('0x2a')]({'where':{'type':_0x29d9aa,'resourceId':_0x273e89['id']}})[_0x632b('0x2e')](function(){return _0x4ebd26;});})[_0x632b('0x2e')](function(){_0x11fe61[_0x632b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bb484,_0x35348e){return function(_0x1819fa){if(!_0x1819fa){_0x1bb484[_0x632b('0x1c')](0x194);}return _0x1819fa;};}function handleError(_0x17a5ba,_0x2a34fa){_0x2a34fa=_0x2a34fa||0x1f4;return function(_0x3c5dc9){logger[_0x632b('0x2f')](_0x3c5dc9[_0x632b('0x30')]);if(_0x3c5dc9[_0x632b('0x31')]){delete _0x3c5dc9[_0x632b('0x31')];}_0x17a5ba[_0x632b('0x1d')](_0x2a34fa)[_0x632b('0x32')](_0x3c5dc9);};}exports[_0x632b('0x33')]=function(_0x227497,_0x3dff99){var _0x18efab={},_0x36936d={},_0x3f3dc4={'count':0x0,'rows':[]};var _0x12f00=_['map'](db[_0x632b('0x34')][_0x632b('0x35')],function(_0x397f36){return{'name':_0x397f36[_0x632b('0x36')],'type':_0x397f36['type'][_0x632b('0x37')]};});_0x36936d['model']=_[_0x632b('0x38')](_0x12f00,_0x632b('0x31'));_0x36936d['query']=_[_0x632b('0x39')](_0x227497[_0x632b('0x3a')]);_0x36936d[_0x632b('0x3b')]=_[_0x632b('0x3c')](_0x36936d[_0x632b('0x3d')],_0x36936d[_0x632b('0x3a')]);_0x18efab[_0x632b('0x3e')]=_[_0x632b('0x3c')](_0x36936d['model'],qs['fields'](_0x227497[_0x632b('0x3a')][_0x632b('0x3f')]));_0x18efab[_0x632b('0x3e')]=_0x18efab[_0x632b('0x3e')][_0x632b('0x40')]?_0x18efab[_0x632b('0x3e')]:_0x36936d[_0x632b('0x3d')];if(!_0x227497[_0x632b('0x3a')]['hasOwnProperty']('nolimit')){_0x18efab[_0x632b('0x21')]=qs['limit'](_0x227497[_0x632b('0x3a')][_0x632b('0x21')]);_0x18efab[_0x632b('0x22')]=qs[_0x632b('0x22')](_0x227497[_0x632b('0x3a')][_0x632b('0x22')]);}_0x18efab[_0x632b('0x41')]=qs[_0x632b('0x42')](_0x227497[_0x632b('0x3a')][_0x632b('0x42')]);_0x18efab[_0x632b('0x43')]=qs[_0x632b('0x3b')](_[_0x632b('0x44')](_0x227497[_0x632b('0x3a')],_0x36936d[_0x632b('0x3b')]),_0x12f00);if(_0x227497[_0x632b('0x3a')][_0x632b('0x45')]){_0x18efab['where']=_['merge'](_0x18efab['where'],{'$or':_['map'](_0x12f00,function(_0x57f099){if(_0x57f099[_0x632b('0x46')]!=='VIRTUAL'){var _0x5529cb={};_0x5529cb[_0x57f099['name']]={'$like':'%'+_0x227497[_0x632b('0x3a')][_0x632b('0x45')]+'%'};return _0x5529cb;}})});}_0x18efab=_[_0x632b('0x47')]({},_0x18efab,_0x227497[_0x632b('0x48')]);var _0x5a1017={'where':_0x18efab[_0x632b('0x43')]};return db[_0x632b('0x34')][_0x632b('0x23')](_0x5a1017)['then'](function(_0x15bb30){_0x3f3dc4[_0x632b('0x23')]=_0x15bb30;if(_0x227497[_0x632b('0x3a')][_0x632b('0x49')]){_0x18efab[_0x632b('0x4a')]=[{'all':!![]}];}return db[_0x632b('0x34')]['findAll'](_0x18efab);})[_0x632b('0x2e')](function(_0x2b90c8){_0x3f3dc4[_0x632b('0x4b')]=_0x2b90c8;return _0x3f3dc4;})[_0x632b('0x2e')](respondWithFilteredResult(_0x3dff99,_0x18efab))['catch'](handleError(_0x3dff99,null));};exports['show']=function(_0x39b17c,_0x26b35b){var _0x70ddc9={'raw':![],'where':{'id':_0x39b17c[_0x632b('0x4c')]['id']}},_0x3566e7={};_0x3566e7[_0x632b('0x3d')]=_['keys'](db[_0x632b('0x34')][_0x632b('0x35')]);_0x3566e7[_0x632b('0x3a')]=_[_0x632b('0x39')](_0x39b17c[_0x632b('0x3a')]);_0x3566e7[_0x632b('0x3b')]=_[_0x632b('0x3c')](_0x3566e7[_0x632b('0x3d')],_0x3566e7['query']);_0x70ddc9[_0x632b('0x3e')]=_['intersection'](_0x3566e7[_0x632b('0x3d')],qs['fields'](_0x39b17c[_0x632b('0x3a')][_0x632b('0x3f')]));_0x70ddc9[_0x632b('0x3e')]=_0x70ddc9[_0x632b('0x3e')][_0x632b('0x40')]?_0x70ddc9['attributes']:_0x3566e7[_0x632b('0x3d')];if(_0x39b17c[_0x632b('0x3a')][_0x632b('0x49')]){_0x70ddc9['include']=[{'all':!![]}];}_0x70ddc9=_[_0x632b('0x47')]({},_0x70ddc9,_0x39b17c[_0x632b('0x48')]);return db[_0x632b('0x34')][_0x632b('0x4d')](_0x70ddc9)[_0x632b('0x2e')](handleEntityNotFound(_0x26b35b,null))['then'](respondWithResult(_0x26b35b,null))[_0x632b('0x4e')](handleError(_0x26b35b,null));};exports['destroy']=function(_0x33da2b,_0x369cdc){return db[_0x632b('0x34')][_0x632b('0x4d')]({'where':{'id':_0x33da2b[_0x632b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x369cdc,null))['then'](removeEntity(_0x369cdc,null))[_0x632b('0x4e')](handleError(_0x369cdc,null));};exports[_0x632b('0x4f')]=function(_0x3ad524,_0xdc6242){return db[_0x632b('0x34')][_0x632b('0x4f')]()['then'](respondWithResult(_0xdc6242,null))[_0x632b('0x4e')](handleError(_0xdc6242,null));};exports[_0x632b('0x50')]=function(_0x3ff81c,_0x4dc021){var _0x33e428;return db[_0x632b('0x51')][_0x632b('0x52')](function(_0x1a79fa){return db['VoicePrefix'][_0x632b('0x50')](_0x3ff81c[_0x632b('0x53')],{'transaction':_0x1a79fa})[_0x632b('0x2e')](function(_0x92884f){_0x33e428=_0x92884f[_0x632b('0x2b')]({'plain':!![]});return db['VoiceExtension'][_0x632b('0x4d')]({'where':{'id':_0x33e428[_0x632b('0x54')]},'raw':!![]})[_0x632b('0x2e')](function(_0x36a7c5){return createVoicePrefixExtensions(_0x33e428,_0x36a7c5,_0x1a79fa);});});})[_0x632b('0x2e')](function(){var _0x5d1d05=_0x3ff81c[_0x632b('0x55')][_0x632b('0x2b')]({'plain':!![]});if(!_0x5d1d05)throw new Error(_0x632b('0x56'));if(_0x5d1d05[_0x632b('0x57')]===_0x632b('0x55')){var _0x9accea=_0x33e428;return db[_0x632b('0x58')][_0x632b('0x4d')]({'where':{'name':_0x632b('0x2c'),'userProfileId':_0x5d1d05[_0x632b('0x59')]},'raw':!![]})[_0x632b('0x2e')](function(_0x5ca000){if(_0x5ca000&&_0x5ca000[_0x632b('0x5a')]===0x0){return db[_0x632b('0x2d')][_0x632b('0x50')]({'name':_0x9accea[_0x632b('0x31')],'resourceId':_0x9accea['id'],'type':_0x5ca000[_0x632b('0x31')],'sectionId':_0x5ca000['id']},{})['then'](function(){return _0x33e428;});}else{return _0x33e428;}})[_0x632b('0x4e')](function(_0x2239ec){logger[_0x632b('0x2f')](_0x632b('0x5b'),_0x2239ec);throw _0x2239ec;});}return _0x33e428;})[_0x632b('0x2e')](respondWithResult(_0x4dc021,null))[_0x632b('0x4e')](handleError(_0x4dc021,null));};function Extension(_0x3e14d0,_0x4ffa35,_0x14ee44,_0x4b7307){this[_0x632b('0x5c')]='from-sip';this[_0x632b('0x5d')]=_0x3e14d0;this['app']=_0x14ee44;this[_0x632b('0x46')]=_0x632b('0x5e');this['description']='Voice\x20Prefix\x20Extension';this[_0x632b('0x5f')]=_0x4ffa35;this[_0x632b('0x60')]=_0x4b7307;}function createVoicePrefixExtensions(_0x1618b3,_0xbbaf46,_0x52eed9){return new BPromise(function(_0x1420d9,_0x20672b){var _0x5abf95=new Extension(formatPrefixName(_0x1618b3[_0x632b('0x61')]),0x1,'NoOp',_0x632b('0x62'));_0x5abf95[_0x632b('0x63')]=_0x1618b3['id'];return db['VoiceExtension'][_0x632b('0x50')](_0x5abf95,{'transaction':_0x52eed9})[_0x632b('0x2e')](function(_0x32cc27){var _0x1bf6f4=_0x32cc27['get']({'plain':!![]});var _0x2711d5=_[_0x632b('0x38')](addVoicePrefixExtensions(_0x1618b3,_0xbbaf46),function(_0x3d1ac3){_0x3d1ac3[_0x632b('0x54')]=_0x1bf6f4['id'];_0x3d1ac3['VoicePrefixId']=_0x1618b3['id'];return _0x3d1ac3;});return db[_0x632b('0x64')][_0x632b('0x65')](_0x2711d5,{'transaction':_0x52eed9})[_0x632b('0x2e')](function(_0x3fd888){if(!_0x3fd888){return _0x20672b(_0x632b('0x66'));}else{return _0x1420d9(_0x3fd888);}})[_0x632b('0x4e')](function(_0x5c614e){return _0x20672b(_0x5c614e);});});;});};function addVoicePrefixExtensions(_0x132223,_0x83d8f9){var _0x307132=[];var _0x5b0c6d=formatPrefixName(_0x132223['prefix']);_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x2,_0x632b('0x68'),_0x632b('0x69')+_0x132223[_0x632b('0x31')]));if(_0x132223[_0x632b('0x6a')]){_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x3,_0x632b('0x68'),'PREFIX-CALLERIDALL='+_0x132223[_0x632b('0x6a')]));}else{_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x3,_0x632b('0x6b'),_0x632b('0x6c')));}_0x307132[_0x632b('0x67')](new Extension(_0x5b0c6d,0x4,_0x632b('0x6d'),_0x83d8f9['context']+','+_0x632b('0x6e')+(0x8+_0x132223[_0x632b('0x31')][_0x632b('0x40')])+'}'+','+0x1));return _0x307132;}function formatPrefixName(_0x14b55f){var _0x51cb45='_';for(var _0x3a3f80=0x0;_0x3a3f80<_0x14b55f[_0x632b('0x40')];_0x3a3f80++){if(_0x14b55f[_0x632b('0x6f')](_0x3a3f80)=='-'){_0x51cb45+=_0x14b55f['charAt'](_0x3a3f80);}else{_0x51cb45+='['+_0x14b55f[_0x632b('0x6f')](_0x3a3f80)+']';}}_0x51cb45+='.';return _0x51cb45;}exports[_0x632b('0x29')]=function(_0x3aa6ca,_0x26f891,_0x225d81){var _0x4599fc=_0x3aa6ca['body'];_0x4599fc[_0x632b('0x61')]=_0x632b('0x70')+_0x4599fc['name']+'-';return db['sequelize']['transaction'](function(_0x3605b6){return db[_0x632b('0x34')][_0x632b('0x29')](_0x4599fc,{'where':{'id':_0x4599fc['id']},'transaction':_0x3605b6})[_0x632b('0x2e')](function(){return db[_0x632b('0x64')]['destroy']({'where':{'VoicePrefixId':_0x4599fc['id']},'transaction':_0x3605b6})['then'](function(){return db[_0x632b('0x64')][_0x632b('0x4d')]({'where':{'id':_0x4599fc['VoiceExtensionId']},'raw':!![]})['then'](function(_0x11cc11){return createVoicePrefixExtensions(_0x4599fc,_0x11cc11,_0x3605b6);});});});})[_0x632b('0x2e')](function(){return db['VoicePrefix'][_0x632b('0x71')](_0x4599fc['id']);})[_0x632b('0x2e')](respondWithResult(_0x26f891,null))[_0x632b('0x4e')](handleError(_0x26f891,null));};exports['addAgents']=function(_0x495a99,_0x563cfa,_0x2ff526){return db[_0x632b('0x34')][_0x632b('0x4d')]({'where':{'id':_0x495a99['params']['id']}})['then'](handleEntityNotFound(_0x563cfa,null))['then'](function(_0x38190c){if(_0x38190c){return _0x38190c['addAgents'](_0x495a99[_0x632b('0x53')][_0x632b('0x72')],_[_0x632b('0x73')](_0x495a99[_0x632b('0x53')],[_0x632b('0x72'),'id'])||{})[_0x632b('0x74')](function(_0xa87c08){for(var _0x360796=0x0;_0x360796<_0x495a99[_0x632b('0x53')][_0x632b('0x72')]['length'];_0x360796+=0x1){socket['emit'](_0x632b('0x75'),{'UserId':Number(_0x495a99['body'][_0x632b('0x72')][_0x360796]),'VoicePrefixId':Number(_0x495a99[_0x632b('0x4c')]['id'])});}return _0xa87c08;});}})[_0x632b('0x2e')](respondWithResult(_0x563cfa,null))[_0x632b('0x4e')](handleError(_0x563cfa,null));};exports['removeAgents']=function(_0x2a3d8f,_0x4febe2,_0x57edcb){return db['VoicePrefix'][_0x632b('0x4d')]({'where':{'id':_0x2a3d8f['params']['id']}})[_0x632b('0x2e')](handleEntityNotFound(_0x4febe2,null))[_0x632b('0x2e')](function(_0x48ccd3){if(_0x48ccd3){return _0x48ccd3[_0x632b('0x76')](_0x2a3d8f[_0x632b('0x3a')]['ids'])['then'](function(){if(_[_0x632b('0x77')](_0x2a3d8f[_0x632b('0x3a')][_0x632b('0x72')])){for(var _0xff7d0b=0x0;_0xff7d0b<_0x2a3d8f[_0x632b('0x3a')][_0x632b('0x72')][_0x632b('0x40')];_0xff7d0b+=0x1){socket['emit'](_0x632b('0x78'),{'UserId':Number(_0x2a3d8f[_0x632b('0x3a')]['ids'][_0xff7d0b]),'VoicePrefixId':Number(_0x2a3d8f['params']['id'])});}}else{socket[_0x632b('0x79')]('userVoicePrefix:remove',{'UserId':Number(_0x2a3d8f['query'][_0x632b('0x72')]),'VoicePrefixId':Number(_0x2a3d8f['params']['id'])});}});}})[_0x632b('0x2e')](respondWithStatusCode(_0x4febe2,null))['catch'](handleError(_0x4febe2,null));};exports[_0x632b('0x7a')]=function(_0x590e68,_0x4393e9,_0x3669d9){var _0x57a2a6={};var _0x10c901={};var _0x64f45a;var _0x1e07da;return db[_0x632b('0x34')][_0x632b('0x7b')]({'where':{'id':_0x590e68[_0x632b('0x4c')]['id']}})[_0x632b('0x2e')](handleEntityNotFound(_0x4393e9,null))[_0x632b('0x2e')](function(_0x5a90f7){if(_0x5a90f7){_0x64f45a=_0x5a90f7;_0x10c901['model']=_[_0x632b('0x39')](db[_0x632b('0x7c')][_0x632b('0x35')]);_0x10c901[_0x632b('0x3a')]=_[_0x632b('0x39')](_0x590e68[_0x632b('0x3a')]);_0x10c901['filters']=_[_0x632b('0x3c')](_0x10c901['model'],_0x10c901[_0x632b('0x3a')]);_0x57a2a6['attributes']=_[_0x632b('0x3c')](_0x10c901[_0x632b('0x3d')],qs[_0x632b('0x3f')](_0x590e68[_0x632b('0x3a')]['fields']));_0x57a2a6[_0x632b('0x3e')]=_0x57a2a6[_0x632b('0x3e')]['length']?_0x57a2a6[_0x632b('0x3e')]:_0x10c901[_0x632b('0x3d')];_0x57a2a6[_0x632b('0x41')]=qs[_0x632b('0x42')](_0x590e68[_0x632b('0x3a')]['sort']);_0x57a2a6[_0x632b('0x43')]=qs[_0x632b('0x3b')](_['pick'](_0x590e68[_0x632b('0x3a')],_0x10c901['filters']));if(_0x590e68[_0x632b('0x3a')]['filter']){_0x57a2a6[_0x632b('0x43')]=_['merge'](_0x57a2a6[_0x632b('0x43')],{'$or':_[_0x632b('0x38')](_0x57a2a6[_0x632b('0x3e')],function(_0x1f5d21){var _0x405b3c={};_0x405b3c[_0x1f5d21]={'$like':'%'+_0x590e68['query'][_0x632b('0x45')]+'%'};return _0x405b3c;})});}_0x57a2a6=_[_0x632b('0x47')]({},_0x57a2a6,_0x590e68['options']);return _0x64f45a[_0x632b('0x7a')](_0x57a2a6);}})['then'](function(_0x1bbb23){if(_0x1bbb23){_0x1e07da=_0x1bbb23['length'];if(!_0x590e68[_0x632b('0x3a')]['hasOwnProperty'](_0x632b('0x7d'))){_0x57a2a6[_0x632b('0x21')]=qs[_0x632b('0x21')](_0x590e68['query'][_0x632b('0x21')]);_0x57a2a6[_0x632b('0x22')]=qs[_0x632b('0x22')](_0x590e68[_0x632b('0x3a')][_0x632b('0x22')]);}return _0x64f45a[_0x632b('0x7a')](_0x57a2a6);}})[_0x632b('0x2e')](function(_0x31eee9){if(_0x31eee9){return _0x31eee9?{'count':_0x1e07da,'rows':_0x31eee9}:null;}})[_0x632b('0x2e')](respondWithResult(_0x4393e9,null))[_0x632b('0x4e')](handleError(_0x4393e9,null));};exports[_0x632b('0x7e')]=function(_0xf1a293,_0x1fcb2a,_0x55c36d){var _0x23385d={};var _0x376112={};var _0x1e6905;var _0x3293be;return db[_0x632b('0x34')][_0x632b('0x7b')]({'where':{'id':_0xf1a293[_0x632b('0x4c')]['id']}})[_0x632b('0x2e')](handleEntityNotFound(_0x1fcb2a,null))[_0x632b('0x2e')](function(_0x40fb13){if(_0x40fb13){_0x1e6905=_0x40fb13;_0x376112[_0x632b('0x3d')]=_[_0x632b('0x39')](db['Team'][_0x632b('0x35')]);_0x376112[_0x632b('0x3a')]=_[_0x632b('0x39')](_0xf1a293[_0x632b('0x3a')]);_0x376112[_0x632b('0x3b')]=_[_0x632b('0x3c')](_0x376112[_0x632b('0x3d')],_0x376112[_0x632b('0x3a')]);_0x23385d['attributes']=_[_0x632b('0x3c')](_0x376112[_0x632b('0x3d')],qs[_0x632b('0x3f')](_0xf1a293[_0x632b('0x3a')][_0x632b('0x3f')]));_0x23385d[_0x632b('0x3e')]=_0x23385d[_0x632b('0x3e')][_0x632b('0x40')]?_0x23385d[_0x632b('0x3e')]:_0x376112['model'];_0x23385d[_0x632b('0x41')]=qs[_0x632b('0x42')](_0xf1a293[_0x632b('0x3a')][_0x632b('0x42')]);_0x23385d[_0x632b('0x43')]=qs[_0x632b('0x3b')](_['pick'](_0xf1a293[_0x632b('0x3a')],_0x376112[_0x632b('0x3b')]));if(_0xf1a293[_0x632b('0x3a')]['filter']){_0x23385d['where']=_[_0x632b('0x47')](_0x23385d[_0x632b('0x43')],{'$or':_[_0x632b('0x38')](_0x23385d[_0x632b('0x3e')],function(_0x16c798){var _0x384439={};_0x384439[_0x16c798]={'$like':'%'+_0xf1a293[_0x632b('0x3a')]['filter']+'%'};return _0x384439;})});}_0x23385d=_[_0x632b('0x47')]({},_0x23385d,_0xf1a293['options']);return _0x1e6905[_0x632b('0x7e')](_0x23385d);}})['then'](function(_0x4d3bb7){if(_0x4d3bb7){_0x3293be=_0x4d3bb7[_0x632b('0x40')];if(!_0xf1a293[_0x632b('0x3a')][_0x632b('0x7f')]('nolimit')){_0x23385d['limit']=qs[_0x632b('0x21')](_0xf1a293[_0x632b('0x3a')][_0x632b('0x21')]);_0x23385d['offset']=qs['offset'](_0xf1a293[_0x632b('0x3a')][_0x632b('0x22')]);}return _0x1e6905[_0x632b('0x7e')](_0x23385d);}})[_0x632b('0x2e')](function(_0x66cbf3){if(_0x66cbf3){return _0x66cbf3?{'count':_0x3293be,'rows':_0x66cbf3}:null;}})[_0x632b('0x2e')](respondWithResult(_0x1fcb2a,null))['catch'](handleError(_0x1fcb2a,null));};exports[_0x632b('0x80')]=function(_0x352ba8,_0x3b7be7,_0x32facd){var _0x366643=_0x352ba8[_0x632b('0x53')]['ids'];var _0x5db842;return db[_0x632b('0x81')][_0x632b('0x82')]({'where':{'id':_0x366643},'attributes':['id'],'include':[{'model':db['User'],'as':_0x632b('0x83'),'attributes':['id',_0x632b('0x31'),_0x632b('0x84'),_0x632b('0x85'),_0x632b('0x86')],'raw':!![]}]})[_0x632b('0x2e')](function(_0x17bfa2){if(_0x17bfa2){_0x5db842=_0x17bfa2;var _0x28b626=_['flatMap'](_0x17bfa2,function(_0x4ce406){var _0x1b274d=_0x4ce406[_0x632b('0x2b')]({'plain':!![]});return _0x1b274d['Agents'];});return db[_0x632b('0x34')][_0x632b('0x4d')]({'where':{'id':_0x352ba8[_0x632b('0x4c')]['id']}})[_0x632b('0x2e')](function(_0x36564e){return db['sequelize']['transaction'](function(_0x824140){return _0x36564e[_0x632b('0x80')](_0x366643,{'transaction':_0x824140})[_0x632b('0x2e')](function(){return BPromise[_0x632b('0x87')](_0x5db842,function(_0x214851){return db[_0x632b('0x88')]['upsert']({'TeamId':_0x214851['id'],'VoicePrefixId':_0x352ba8[_0x632b('0x4c')]['id']},{'transaction':_0x824140});});})['then'](function(){return BPromise[_0x632b('0x87')](_0x28b626,function(_0x26e1a9){return db[_0x632b('0x89')][_0x632b('0x8a')]({'where':{'UserId':_0x26e1a9['id'],'VoicePrefixId':_0x352ba8[_0x632b('0x4c')]['id']},'transaction':_0x824140});});})[_0x632b('0x2e')](function(){_0x28b626[_0x632b('0x8b')](function(_0x19d11e){socket[_0x632b('0x79')](_0x632b('0x75'),{'UserId':_0x19d11e['id'],'VoicePrefixId':_0x36564e['id']});});});});});}})['then'](respondWithStatusCode(_0x3b7be7,null))[_0x632b('0x4e')](handleError(_0x3b7be7,null));};exports[_0x632b('0x8c')]=function(_0x36244e,_0x1cc52f,_0x5cd2b7){return db[_0x632b('0x81')][_0x632b('0x82')]({'where':{'id':_0x36244e['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x632b('0x83'),'attributes':['id'],'raw':!![]}]})[_0x632b('0x2e')](handleEntityNotFound(_0x1cc52f,null))[_0x632b('0x2e')](function(_0x2a45f3){var _0x56d205=_[_0x632b('0x38')](_0x2a45f3,'id');var _0x392b6b=[];var _0x1cfc20=[];var _0x5bd1bb=squel[_0x632b('0x8d')]();_0x5bd1bb['field']('tq.TeamId')[_0x632b('0x8e')](_0x632b('0x8f'),'tq')[_0x632b('0x90')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x632b('0x91'),_0x36244e[_0x632b('0x4c')]['id']);for(var _0x2d0712=0x0;_0x2d0712<_0x2a45f3['length'];_0x2d0712+=0x1){let _0x1f9cb4=_0x2a45f3[_0x2d0712];for(var _0x90b25c=0x0;_0x90b25c<_0x1f9cb4[_0x632b('0x83')][_0x632b('0x40')];_0x90b25c+=0x1){let _0x163ad2=_0x1f9cb4['Agents'][_0x90b25c];var _0x21af7a=_0x5bd1bb['clone']();_0x21af7a['where'](_0x632b('0x92'),_0x163ad2['id']);_0x1cfc20[_0x632b('0x67')](db['sequelize']['query'](_0x21af7a[_0x632b('0x93')](),{'type':db[_0x632b('0x51')][_0x632b('0x94')]['SELECT']})[_0x632b('0x2e')](function(_0x53c0c4){if(_0x53c0c4['length']===0x1){return _0x163ad2['id'];}else{var _0x112ecc=_[_0x632b('0x95')](_[_0x632b('0x38')](_0x53c0c4,_0x632b('0x96')),function(_0x4e5523){return _[_0x632b('0x97')](_0x56d205,_0x4e5523);});if(_0x112ecc){return _0x163ad2['id'];}}}));}}return BPromise[_0x632b('0x98')](_0x1cfc20)[_0x632b('0x2e')](function(_0x350a1b){_0x392b6b=_(_0x392b6b)[_0x632b('0x99')](_0x350a1b)[_0x632b('0x9a')]()['value']();return db[_0x632b('0x34')]['find']({'where':{'id':_0x36244e[_0x632b('0x4c')]['id']}})['then'](function(_0x460dce){return db[_0x632b('0x51')][_0x632b('0x52')](function(_0x2c88a){return _0x460dce[_0x632b('0x8c')](_0x36244e[_0x632b('0x3a')][_0x632b('0x72')],{'transaction':_0x2c88a})[_0x632b('0x2e')](function(){if(!_[_0x632b('0x9b')](_0x392b6b)){return _0x460dce[_0x632b('0x76')](_0x392b6b,{'transaction':_0x2c88a});}})[_0x632b('0x2e')](function(){_0x392b6b[_0x632b('0x8b')](function(_0x3784d2){socket[_0x632b('0x79')](_0x632b('0x78'),{'UserId':_0x3784d2,'VoicePrefixId':_0x460dce['id']});});});});});});})['then'](respondWithStatusCode(_0x1cc52f,null))[_0x632b('0x4e')](handleError(_0x1cc52f,null));}; \ No newline at end of file +var _0x5c3c=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','UserProfileResource','error','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','sequelize','transaction','get','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','VoicePrefixes','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','body','system-','VoiceExtensionId','findById','addAgents','ids','omit','removeAgents','isArray','userVoicePrefix:remove','emit','getAgents','findOne','User','pick','getTeams','addTeams','Team','findAll','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','tq.TeamId','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','TeamId','union','compact','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x36d14b,_0x1ba5eb){var _0x4be643=function(_0x2f638f){while(--_0x2f638f){_0x36d14b['push'](_0x36d14b['shift']());}};_0x4be643(++_0x1ba5eb);}(_0x5c3c,0x132));var _0xc5c3=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x5c3c[_0x50007c];return _0x5c1ec7;};'use strict';var emlformat=require(_0xc5c3('0x0'));var rimraf=require(_0xc5c3('0x1'));var zipdir=require(_0xc5c3('0x2'));var jsonpatch=require(_0xc5c3('0x3'));var rp=require('request-promise');var moment=require(_0xc5c3('0x4'));var BPromise=require(_0xc5c3('0x5'));var Mustache=require(_0xc5c3('0x6'));var util=require(_0xc5c3('0x7'));var path=require(_0xc5c3('0x8'));var sox=require(_0xc5c3('0x9'));var csv=require(_0xc5c3('0xa'));var ejs=require(_0xc5c3('0xb'));var fs=require('fs');var fs_extra=require(_0xc5c3('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc5c3('0xd'));var deskjs=require(_0xc5c3('0xe'));var toCsv=require('to-csv');var querystring=require(_0xc5c3('0xf'));var Papa=require(_0xc5c3('0x10'));var Redis=require('ioredis');var authService=require(_0xc5c3('0x11'));var qs=require(_0xc5c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c3('0x13'));var logger=require(_0xc5c3('0x14'))(_0xc5c3('0x15'));var utils=require('../../config/utils');var config=require(_0xc5c3('0x16'));var licenseUtil=require(_0xc5c3('0x17'));var db=require('../../mysqldb')['db'];config[_0xc5c3('0x18')]=_[_0xc5c3('0x19')](config[_0xc5c3('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xc5c3('0x1a'))(new Redis(config[_0xc5c3('0x18')]));require(_0xc5c3('0x1b'))[_0xc5c3('0x1c')](socket);function respondWithStatusCode(_0xc8a636,_0x5f34bb){_0x5f34bb=_0x5f34bb||0xcc;return function(_0x5c0341){if(_0x5c0341){return _0xc8a636[_0xc5c3('0x1d')](_0x5f34bb);}return _0xc8a636[_0xc5c3('0x1e')](_0x5f34bb)[_0xc5c3('0x1f')]();};}function respondWithResult(_0xef8b21,_0x5ecd4b){_0x5ecd4b=_0x5ecd4b||0xc8;return function(_0x4ff2de){if(_0x4ff2de){return _0xef8b21[_0xc5c3('0x1e')](_0x5ecd4b)['json'](_0x4ff2de);}};}function respondWithFilteredResult(_0xa9bc84,_0x17ec62){return function(_0x2ff158){if(_0x2ff158){var _0x13c867=typeof _0x17ec62[_0xc5c3('0x20')]==='undefined'&&typeof _0x17ec62[_0xc5c3('0x21')]===_0xc5c3('0x22');var _0x123dba=_0x2ff158[_0xc5c3('0x23')];var _0x4e570f=_0x13c867?0x0:_0x17ec62[_0xc5c3('0x20')];var _0x41578a=_0x13c867?_0x2ff158[_0xc5c3('0x23')]:_0x17ec62[_0xc5c3('0x20')]+_0x17ec62[_0xc5c3('0x21')];var _0x564815;if(_0x41578a>=_0x123dba){_0x41578a=_0x123dba;_0x564815=0xc8;}else{_0x564815=0xce;}_0xa9bc84[_0xc5c3('0x1e')](_0x564815);return _0xa9bc84[_0xc5c3('0x24')](_0xc5c3('0x25'),_0x4e570f+'-'+_0x41578a+'/'+_0x123dba)[_0xc5c3('0x26')](_0x2ff158);}return null;};}function patchUpdates(_0x1c5793){return function(_0x67445){try{jsonpatch[_0xc5c3('0x27')](_0x67445,_0x1c5793,!![]);}catch(_0x5996a0){return BPromise['reject'](_0x5996a0);}return _0x67445[_0xc5c3('0x28')]();};}function saveUpdates(_0x38dd9e,_0x53ab72){return function(_0x5c7329){if(_0x5c7329){return _0x5c7329[_0xc5c3('0x29')](_0x38dd9e)[_0xc5c3('0x2a')](function(_0x38a3df){return _0x38a3df;});}return null;};}function removeEntity(_0x52e54a,_0x4af067){return function(_0x2df06b){if(_0x2df06b){return _0x2df06b[_0xc5c3('0x2b')]()[_0xc5c3('0x2a')](function(){var _0x29791c=_0x2df06b['get']({'plain':!![]});var _0x21efd6='VoicePrefixes';return db[_0xc5c3('0x2c')]['destroy']({'where':{'type':_0x21efd6,'resourceId':_0x29791c['id']}})[_0xc5c3('0x2a')](function(){return _0x2df06b;});})[_0xc5c3('0x2a')](function(){_0x52e54a[_0xc5c3('0x1e')](0xcc)[_0xc5c3('0x1f')]();});}};}function handleEntityNotFound(_0x15361c,_0x2d07e1){return function(_0x35a397){if(!_0x35a397){_0x15361c['sendStatus'](0x194);}return _0x35a397;};}function handleError(_0xbcafd6,_0x4a3300){_0x4a3300=_0x4a3300||0x1f4;return function(_0xc4b134){logger[_0xc5c3('0x2d')](_0xc4b134['stack']);if(_0xc4b134['name']){delete _0xc4b134[_0xc5c3('0x2e')];}_0xbcafd6[_0xc5c3('0x1e')](_0x4a3300)[_0xc5c3('0x2f')](_0xc4b134);};}exports[_0xc5c3('0x30')]=function(_0x52adcf,_0x3f9591){var _0x24aa70={},_0x3ebcbc={},_0x303eab={'count':0x0,'rows':[]};var _0x1b4538=_[_0xc5c3('0x31')](db[_0xc5c3('0x32')][_0xc5c3('0x33')],function(_0x1d1e6d){return{'name':_0x1d1e6d['fieldName'],'type':_0x1d1e6d[_0xc5c3('0x34')][_0xc5c3('0x35')]};});_0x3ebcbc[_0xc5c3('0x36')]=_[_0xc5c3('0x31')](_0x1b4538,_0xc5c3('0x2e'));_0x3ebcbc[_0xc5c3('0x37')]=_[_0xc5c3('0x38')](_0x52adcf['query']);_0x3ebcbc['filters']=_[_0xc5c3('0x39')](_0x3ebcbc['model'],_0x3ebcbc[_0xc5c3('0x37')]);_0x24aa70[_0xc5c3('0x3a')]=_[_0xc5c3('0x39')](_0x3ebcbc[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x52adcf['query'][_0xc5c3('0x3b')]));_0x24aa70[_0xc5c3('0x3a')]=_0x24aa70['attributes'][_0xc5c3('0x3c')]?_0x24aa70[_0xc5c3('0x3a')]:_0x3ebcbc[_0xc5c3('0x36')];if(!_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x3d')](_0xc5c3('0x3e'))){_0x24aa70[_0xc5c3('0x21')]=qs[_0xc5c3('0x21')](_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x21')]);_0x24aa70['offset']=qs[_0xc5c3('0x20')](_0x52adcf['query']['offset']);}_0x24aa70[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x40')]);_0x24aa70[_0xc5c3('0x41')]=qs['filters'](_['pick'](_0x52adcf[_0xc5c3('0x37')],_0x3ebcbc[_0xc5c3('0x42')]),_0x1b4538);if(_0x52adcf['query'][_0xc5c3('0x43')]){_0x24aa70['where']=_[_0xc5c3('0x44')](_0x24aa70[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x1b4538,function(_0x59c9cb){if(_0x59c9cb[_0xc5c3('0x34')]!==_0xc5c3('0x45')){var _0x525ef8={};_0x525ef8[_0x59c9cb[_0xc5c3('0x2e')]]={'$like':'%'+_0x52adcf['query'][_0xc5c3('0x43')]+'%'};return _0x525ef8;}})});}_0x24aa70=_[_0xc5c3('0x44')]({},_0x24aa70,_0x52adcf['options']);var _0x4d2056={'where':_0x24aa70['where']};return db[_0xc5c3('0x32')][_0xc5c3('0x23')](_0x4d2056)['then'](function(_0x1a8490){_0x303eab[_0xc5c3('0x23')]=_0x1a8490;if(_0x52adcf[_0xc5c3('0x37')][_0xc5c3('0x46')]){_0x24aa70['include']=[{'all':!![]}];}return db[_0xc5c3('0x32')]['findAll'](_0x24aa70);})['then'](function(_0x1363fa){_0x303eab[_0xc5c3('0x47')]=_0x1363fa;return _0x303eab;})['then'](respondWithFilteredResult(_0x3f9591,_0x24aa70))[_0xc5c3('0x48')](handleError(_0x3f9591,null));};exports[_0xc5c3('0x49')]=function(_0x590e65,_0x333c38){var _0x4ffc5a={'raw':![],'where':{'id':_0x590e65[_0xc5c3('0x4a')]['id']}},_0x122a6d={};_0x122a6d['model']=_[_0xc5c3('0x38')](db['VoicePrefix'][_0xc5c3('0x33')]);_0x122a6d[_0xc5c3('0x37')]=_['keys'](_0x590e65[_0xc5c3('0x37')]);_0x122a6d[_0xc5c3('0x42')]=_[_0xc5c3('0x39')](_0x122a6d[_0xc5c3('0x36')],_0x122a6d[_0xc5c3('0x37')]);_0x4ffc5a[_0xc5c3('0x3a')]=_['intersection'](_0x122a6d[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x590e65[_0xc5c3('0x37')][_0xc5c3('0x3b')]));_0x4ffc5a[_0xc5c3('0x3a')]=_0x4ffc5a['attributes']['length']?_0x4ffc5a[_0xc5c3('0x3a')]:_0x122a6d[_0xc5c3('0x36')];if(_0x590e65[_0xc5c3('0x37')]['includeAll']){_0x4ffc5a[_0xc5c3('0x4b')]=[{'all':!![]}];}_0x4ffc5a=_[_0xc5c3('0x44')]({},_0x4ffc5a,_0x590e65[_0xc5c3('0x4c')]);return db[_0xc5c3('0x32')][_0xc5c3('0x4d')](_0x4ffc5a)[_0xc5c3('0x2a')](handleEntityNotFound(_0x333c38,null))[_0xc5c3('0x2a')](respondWithResult(_0x333c38,null))['catch'](handleError(_0x333c38,null));};exports[_0xc5c3('0x2b')]=function(_0x3ff21e,_0x4538ab){return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x3ff21e[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x4538ab,null))[_0xc5c3('0x2a')](removeEntity(_0x4538ab,null))[_0xc5c3('0x48')](handleError(_0x4538ab,null));};exports['describe']=function(_0xd716e6,_0x58204c){return db[_0xc5c3('0x32')]['describe']()[_0xc5c3('0x2a')](respondWithResult(_0x58204c,null))[_0xc5c3('0x48')](handleError(_0x58204c,null));};exports[_0xc5c3('0x4e')]=function(_0x325643,_0x1311de){var _0x4be969;return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x348960){return db[_0xc5c3('0x32')][_0xc5c3('0x4e')](_0x325643['body'],{'transaction':_0x348960})[_0xc5c3('0x2a')](function(_0x34bf9c){_0x4be969=_0x34bf9c[_0xc5c3('0x51')]({'plain':!![]});return db['VoiceExtension'][_0xc5c3('0x4d')]({'where':{'id':_0x4be969['VoiceExtensionId']},'raw':!![]})['then'](function(_0x39f83a){return createVoicePrefixExtensions(_0x4be969,_0x39f83a,_0x348960);});});})[_0xc5c3('0x2a')](function(){var _0x110105=_0x325643[_0xc5c3('0x52')][_0xc5c3('0x51')]({'plain':!![]});if(!_0x110105)throw new Error(_0xc5c3('0x53'));if(_0x110105['role']===_0xc5c3('0x52')){var _0x1ad3aa=_0x4be969;return db[_0xc5c3('0x54')][_0xc5c3('0x4d')]({'where':{'name':_0xc5c3('0x55'),'userProfileId':_0x110105[_0xc5c3('0x56')]},'raw':!![]})[_0xc5c3('0x2a')](function(_0x524aff){if(_0x524aff&&_0x524aff['autoAssociation']===0x0){return db[_0xc5c3('0x2c')][_0xc5c3('0x4e')]({'name':_0x1ad3aa['name'],'resourceId':_0x1ad3aa['id'],'type':_0x524aff[_0xc5c3('0x2e')],'sectionId':_0x524aff['id']},{})[_0xc5c3('0x2a')](function(){return _0x4be969;});}else{return _0x4be969;}})[_0xc5c3('0x48')](function(_0x41bcf7){logger['error'](_0xc5c3('0x57'),_0x41bcf7);throw _0x41bcf7;});}return _0x4be969;})[_0xc5c3('0x2a')](respondWithResult(_0x1311de,null))[_0xc5c3('0x48')](handleError(_0x1311de,null));};function Extension(_0x314392,_0x1b66bf,_0x36420a,_0x90e30b){this[_0xc5c3('0x58')]=_0xc5c3('0x59');this['exten']=_0x314392;this[_0xc5c3('0x5a')]=_0x36420a;this[_0xc5c3('0x34')]=_0xc5c3('0x5b');this['description']=_0xc5c3('0x5c');this[_0xc5c3('0x5d')]=_0x1b66bf;this[_0xc5c3('0x5e')]=_0x90e30b;}function createVoicePrefixExtensions(_0x30226f,_0x32d5e2,_0x5067ed){return new BPromise(function(_0xf54924,_0xea569b){var _0xf40f27=new Extension(formatPrefixName(_0x30226f[_0xc5c3('0x5f')]),0x1,_0xc5c3('0x60'),_0xc5c3('0x61'));_0xf40f27[_0xc5c3('0x62')]=_0x30226f['id'];return db['VoiceExtension'][_0xc5c3('0x4e')](_0xf40f27,{'transaction':_0x5067ed})[_0xc5c3('0x2a')](function(_0x397fc8){var _0x13f6a1=_0x397fc8[_0xc5c3('0x51')]({'plain':!![]});var _0x3cd213=_[_0xc5c3('0x31')](addVoicePrefixExtensions(_0x30226f,_0x32d5e2),function(_0x5b9013){_0x5b9013['VoiceExtensionId']=_0x13f6a1['id'];_0x5b9013[_0xc5c3('0x62')]=_0x30226f['id'];return _0x5b9013;});return db[_0xc5c3('0x63')][_0xc5c3('0x64')](_0x3cd213,{'transaction':_0x5067ed})[_0xc5c3('0x2a')](function(_0x1ed757){if(!_0x1ed757){return _0xea569b(_0xc5c3('0x65'));}else{return _0xf54924(_0x1ed757);}})[_0xc5c3('0x48')](function(_0x2cdd7a){return _0xea569b(_0x2cdd7a);});});;});};function addVoicePrefixExtensions(_0x385b39,_0x4d3e6f){var _0x92c6cf=[];var _0x358b83=formatPrefixName(_0x385b39['prefix']);_0x92c6cf['push'](new Extension(_0x358b83,0x2,_0xc5c3('0x66'),_0xc5c3('0x67')+_0x385b39[_0xc5c3('0x2e')]));if(_0x385b39[_0xc5c3('0x68')]){_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x3,_0xc5c3('0x66'),_0xc5c3('0x6a')+_0x385b39[_0xc5c3('0x68')]));}else{_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x3,'NoOp',_0xc5c3('0x6b')));}_0x92c6cf[_0xc5c3('0x69')](new Extension(_0x358b83,0x4,_0xc5c3('0x6c'),_0x4d3e6f[_0xc5c3('0x58')]+','+_0xc5c3('0x6d')+(0x8+_0x385b39[_0xc5c3('0x2e')][_0xc5c3('0x3c')])+'}'+','+0x1));return _0x92c6cf;}function formatPrefixName(_0x114c90){var _0x22606a='_';for(var _0x31e280=0x0;_0x31e280<_0x114c90[_0xc5c3('0x3c')];_0x31e280++){if(_0x114c90['charAt'](_0x31e280)=='-'){_0x22606a+=_0x114c90['charAt'](_0x31e280);}else{_0x22606a+='['+_0x114c90[_0xc5c3('0x6e')](_0x31e280)+']';}}_0x22606a+='.';return _0x22606a;}exports[_0xc5c3('0x29')]=function(_0x6281e5,_0x1951a5,_0x5540c0){var _0x2da018=_0x6281e5[_0xc5c3('0x6f')];_0x2da018[_0xc5c3('0x5f')]=_0xc5c3('0x70')+_0x2da018[_0xc5c3('0x2e')]+'-';return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x4a3f71){return db[_0xc5c3('0x32')]['update'](_0x2da018,{'where':{'id':_0x2da018['id']},'transaction':_0x4a3f71})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x63')][_0xc5c3('0x2b')]({'where':{'VoicePrefixId':_0x2da018['id']},'transaction':_0x4a3f71})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x63')][_0xc5c3('0x4d')]({'where':{'id':_0x2da018[_0xc5c3('0x71')]},'raw':!![]})[_0xc5c3('0x2a')](function(_0x4813a0){return createVoicePrefixExtensions(_0x2da018,_0x4813a0,_0x4a3f71);});});});})[_0xc5c3('0x2a')](function(){return db[_0xc5c3('0x32')][_0xc5c3('0x72')](_0x2da018['id']);})['then'](respondWithResult(_0x1951a5,null))['catch'](handleError(_0x1951a5,null));};exports[_0xc5c3('0x73')]=function(_0x5d6b6b,_0x5bcbd3,_0x1f222f){return db[_0xc5c3('0x32')]['find']({'where':{'id':_0x5d6b6b[_0xc5c3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5bcbd3,null))['then'](function(_0x2dbe80){if(_0x2dbe80){return _0x2dbe80[_0xc5c3('0x73')](_0x5d6b6b[_0xc5c3('0x6f')][_0xc5c3('0x74')],_[_0xc5c3('0x75')](_0x5d6b6b['body'],[_0xc5c3('0x74'),'id'])||{})['spread'](function(_0x110167){for(var _0x109cfa=0x0;_0x109cfa<_0x5d6b6b[_0xc5c3('0x6f')][_0xc5c3('0x74')][_0xc5c3('0x3c')];_0x109cfa+=0x1){socket['emit']('userVoicePrefix:save',{'UserId':Number(_0x5d6b6b['body'][_0xc5c3('0x74')][_0x109cfa]),'VoicePrefixId':Number(_0x5d6b6b[_0xc5c3('0x4a')]['id'])});}return _0x110167;});}})[_0xc5c3('0x2a')](respondWithResult(_0x5bcbd3,null))['catch'](handleError(_0x5bcbd3,null));};exports[_0xc5c3('0x76')]=function(_0x41222d,_0x5dcd4d,_0x3afa94){return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x41222d[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x5dcd4d,null))[_0xc5c3('0x2a')](function(_0x4b0d02){if(_0x4b0d02){return _0x4b0d02[_0xc5c3('0x76')](_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')])[_0xc5c3('0x2a')](function(){if(_[_0xc5c3('0x77')](_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')])){for(var _0x1f36f8=0x0;_0x1f36f8<_0x41222d['query']['ids']['length'];_0x1f36f8+=0x1){socket['emit'](_0xc5c3('0x78'),{'UserId':Number(_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')][_0x1f36f8]),'VoicePrefixId':Number(_0x41222d[_0xc5c3('0x4a')]['id'])});}}else{socket[_0xc5c3('0x79')](_0xc5c3('0x78'),{'UserId':Number(_0x41222d[_0xc5c3('0x37')][_0xc5c3('0x74')]),'VoicePrefixId':Number(_0x41222d[_0xc5c3('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x5dcd4d,null))[_0xc5c3('0x48')](handleError(_0x5dcd4d,null));};exports[_0xc5c3('0x7a')]=function(_0x3aa5e2,_0x1efa1d,_0x2fae6d){var _0x258e36={};var _0x2f1be8={};var _0x550966;var _0x5733a2;return db[_0xc5c3('0x32')][_0xc5c3('0x7b')]({'where':{'id':_0x3aa5e2[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x1efa1d,null))[_0xc5c3('0x2a')](function(_0x306d22){if(_0x306d22){_0x550966=_0x306d22;_0x2f1be8[_0xc5c3('0x36')]=_[_0xc5c3('0x38')](db[_0xc5c3('0x7c')][_0xc5c3('0x33')]);_0x2f1be8[_0xc5c3('0x37')]=_['keys'](_0x3aa5e2[_0xc5c3('0x37')]);_0x2f1be8[_0xc5c3('0x42')]=_[_0xc5c3('0x39')](_0x2f1be8[_0xc5c3('0x36')],_0x2f1be8[_0xc5c3('0x37')]);_0x258e36['attributes']=_[_0xc5c3('0x39')](_0x2f1be8[_0xc5c3('0x36')],qs[_0xc5c3('0x3b')](_0x3aa5e2[_0xc5c3('0x37')]['fields']));_0x258e36[_0xc5c3('0x3a')]=_0x258e36[_0xc5c3('0x3a')][_0xc5c3('0x3c')]?_0x258e36['attributes']:_0x2f1be8[_0xc5c3('0x36')];_0x258e36[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x40')]);_0x258e36[_0xc5c3('0x41')]=qs[_0xc5c3('0x42')](_[_0xc5c3('0x7d')](_0x3aa5e2[_0xc5c3('0x37')],_0x2f1be8[_0xc5c3('0x42')]));if(_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x43')]){_0x258e36[_0xc5c3('0x41')]=_[_0xc5c3('0x44')](_0x258e36[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x258e36['attributes'],function(_0x2bf9d2){var _0x8aaa64={};_0x8aaa64[_0x2bf9d2]={'$like':'%'+_0x3aa5e2['query'][_0xc5c3('0x43')]+'%'};return _0x8aaa64;})});}_0x258e36=_['merge']({},_0x258e36,_0x3aa5e2[_0xc5c3('0x4c')]);return _0x550966[_0xc5c3('0x7a')](_0x258e36);}})[_0xc5c3('0x2a')](function(_0x1800a0){if(_0x1800a0){_0x5733a2=_0x1800a0[_0xc5c3('0x3c')];if(!_0x3aa5e2['query'][_0xc5c3('0x3d')](_0xc5c3('0x3e'))){_0x258e36[_0xc5c3('0x21')]=qs['limit'](_0x3aa5e2['query'][_0xc5c3('0x21')]);_0x258e36['offset']=qs[_0xc5c3('0x20')](_0x3aa5e2[_0xc5c3('0x37')][_0xc5c3('0x20')]);}return _0x550966['getAgents'](_0x258e36);}})[_0xc5c3('0x2a')](function(_0x3325b6){if(_0x3325b6){return _0x3325b6?{'count':_0x5733a2,'rows':_0x3325b6}:null;}})[_0xc5c3('0x2a')](respondWithResult(_0x1efa1d,null))[_0xc5c3('0x48')](handleError(_0x1efa1d,null));};exports[_0xc5c3('0x7e')]=function(_0x57070d,_0x2f5315,_0x37ef35){var _0x2dcae5={};var _0x5d5248={};var _0xd3091c;var _0x26292e;return db[_0xc5c3('0x32')][_0xc5c3('0x7b')]({'where':{'id':_0x57070d[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](handleEntityNotFound(_0x2f5315,null))[_0xc5c3('0x2a')](function(_0x12d800){if(_0x12d800){_0xd3091c=_0x12d800;_0x5d5248['model']=_[_0xc5c3('0x38')](db['Team'][_0xc5c3('0x33')]);_0x5d5248[_0xc5c3('0x37')]=_['keys'](_0x57070d[_0xc5c3('0x37')]);_0x5d5248[_0xc5c3('0x42')]=_['intersection'](_0x5d5248[_0xc5c3('0x36')],_0x5d5248[_0xc5c3('0x37')]);_0x2dcae5[_0xc5c3('0x3a')]=_[_0xc5c3('0x39')](_0x5d5248[_0xc5c3('0x36')],qs['fields'](_0x57070d[_0xc5c3('0x37')][_0xc5c3('0x3b')]));_0x2dcae5[_0xc5c3('0x3a')]=_0x2dcae5[_0xc5c3('0x3a')][_0xc5c3('0x3c')]?_0x2dcae5[_0xc5c3('0x3a')]:_0x5d5248['model'];_0x2dcae5[_0xc5c3('0x3f')]=qs[_0xc5c3('0x40')](_0x57070d['query']['sort']);_0x2dcae5[_0xc5c3('0x41')]=qs[_0xc5c3('0x42')](_['pick'](_0x57070d[_0xc5c3('0x37')],_0x5d5248[_0xc5c3('0x42')]));if(_0x57070d[_0xc5c3('0x37')]['filter']){_0x2dcae5[_0xc5c3('0x41')]=_[_0xc5c3('0x44')](_0x2dcae5[_0xc5c3('0x41')],{'$or':_[_0xc5c3('0x31')](_0x2dcae5[_0xc5c3('0x3a')],function(_0x86d21a){var _0x53f1d={};_0x53f1d[_0x86d21a]={'$like':'%'+_0x57070d[_0xc5c3('0x37')][_0xc5c3('0x43')]+'%'};return _0x53f1d;})});}_0x2dcae5=_[_0xc5c3('0x44')]({},_0x2dcae5,_0x57070d[_0xc5c3('0x4c')]);return _0xd3091c[_0xc5c3('0x7e')](_0x2dcae5);}})['then'](function(_0x48e3a2){if(_0x48e3a2){_0x26292e=_0x48e3a2[_0xc5c3('0x3c')];if(!_0x57070d['query']['hasOwnProperty'](_0xc5c3('0x3e'))){_0x2dcae5['limit']=qs[_0xc5c3('0x21')](_0x57070d[_0xc5c3('0x37')]['limit']);_0x2dcae5['offset']=qs[_0xc5c3('0x20')](_0x57070d['query']['offset']);}return _0xd3091c[_0xc5c3('0x7e')](_0x2dcae5);}})[_0xc5c3('0x2a')](function(_0x3ce0e9){if(_0x3ce0e9){return _0x3ce0e9?{'count':_0x26292e,'rows':_0x3ce0e9}:null;}})[_0xc5c3('0x2a')](respondWithResult(_0x2f5315,null))[_0xc5c3('0x48')](handleError(_0x2f5315,null));};exports[_0xc5c3('0x7f')]=function(_0x116965,_0xa4672a,_0x1aba09){var _0x557b8f=_0x116965['body'][_0xc5c3('0x74')];var _0x389c96;return db[_0xc5c3('0x80')][_0xc5c3('0x81')]({'where':{'id':_0x557b8f},'attributes':['id'],'include':[{'model':db[_0xc5c3('0x7c')],'as':'Agents','attributes':['id',_0xc5c3('0x2e'),'online',_0xc5c3('0x82'),_0xc5c3('0x83')],'raw':!![]}]})[_0xc5c3('0x2a')](function(_0x2c8937){if(_0x2c8937){_0x389c96=_0x2c8937;var _0x9e9372=_[_0xc5c3('0x84')](_0x2c8937,function(_0x1dcde5){var _0x2c8fdb=_0x1dcde5['get']({'plain':!![]});return _0x2c8fdb['Agents'];});return db['VoicePrefix'][_0xc5c3('0x4d')]({'where':{'id':_0x116965[_0xc5c3('0x4a')]['id']}})[_0xc5c3('0x2a')](function(_0x3cc60b){return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x2c5fd2){return _0x3cc60b[_0xc5c3('0x7f')](_0x557b8f,{'transaction':_0x2c5fd2})[_0xc5c3('0x2a')](function(){return BPromise[_0xc5c3('0x85')](_0x389c96,function(_0x554787){return db[_0xc5c3('0x86')][_0xc5c3('0x87')]({'TeamId':_0x554787['id'],'VoicePrefixId':_0x116965[_0xc5c3('0x4a')]['id']},{'transaction':_0x2c5fd2});});})[_0xc5c3('0x2a')](function(){return BPromise[_0xc5c3('0x85')](_0x9e9372,function(_0x589e28){return db[_0xc5c3('0x88')][_0xc5c3('0x89')]({'where':{'UserId':_0x589e28['id'],'VoicePrefixId':_0x116965[_0xc5c3('0x4a')]['id']},'transaction':_0x2c5fd2});});})['then'](function(){_0x9e9372[_0xc5c3('0x8a')](function(_0x2dd850){socket[_0xc5c3('0x79')](_0xc5c3('0x8b'),{'UserId':_0x2dd850['id'],'VoicePrefixId':_0x3cc60b['id']});});});});});}})[_0xc5c3('0x2a')](respondWithStatusCode(_0xa4672a,null))[_0xc5c3('0x48')](handleError(_0xa4672a,null));};exports[_0xc5c3('0x8c')]=function(_0x53a502,_0x762654,_0x37459f){return db['Team'][_0xc5c3('0x81')]({'where':{'id':_0x53a502[_0xc5c3('0x37')][_0xc5c3('0x74')]},'attributes':['id'],'include':[{'model':db[_0xc5c3('0x7c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc5c3('0x2a')](handleEntityNotFound(_0x762654,null))[_0xc5c3('0x2a')](function(_0x3aafa0){var _0xe80b2b=_[_0xc5c3('0x31')](_0x3aafa0,'id');var _0x2b49da=[];var _0x47bd08=[];var _0x314072=squel[_0xc5c3('0x8d')]();_0x314072['field'](_0xc5c3('0x8e'))['from'](_0xc5c3('0x8f'),'tq')[_0xc5c3('0x90')](_0xc5c3('0x91'),'ut',_0xc5c3('0x92'))['where']('VoicePrefixId\x20=\x20?',_0x53a502['params']['id']);for(var _0x3b5ca9=0x0;_0x3b5ca9<_0x3aafa0[_0xc5c3('0x3c')];_0x3b5ca9+=0x1){let _0x283935=_0x3aafa0[_0x3b5ca9];for(var _0x5cebbc=0x0;_0x5cebbc<_0x283935[_0xc5c3('0x93')]['length'];_0x5cebbc+=0x1){let _0x423b48=_0x283935[_0xc5c3('0x93')][_0x5cebbc];var _0x2a8dfc=_0x314072[_0xc5c3('0x94')]();_0x2a8dfc[_0xc5c3('0x41')](_0xc5c3('0x95'),_0x423b48['id']);_0x47bd08[_0xc5c3('0x69')](db[_0xc5c3('0x4f')][_0xc5c3('0x37')](_0x2a8dfc[_0xc5c3('0x96')](),{'type':db['sequelize'][_0xc5c3('0x97')]['SELECT']})[_0xc5c3('0x2a')](function(_0x397543){if(_0x397543[_0xc5c3('0x3c')]===0x1){return _0x423b48['id'];}else{var _0x21941a=_['every'](_[_0xc5c3('0x31')](_0x397543,_0xc5c3('0x98')),function(_0x1b7fc8){return _['includes'](_0xe80b2b,_0x1b7fc8);});if(_0x21941a){return _0x423b48['id'];}}}));}}return BPromise['all'](_0x47bd08)[_0xc5c3('0x2a')](function(_0x5731da){_0x2b49da=_(_0x2b49da)[_0xc5c3('0x99')](_0x5731da)[_0xc5c3('0x9a')]()['value']();return db[_0xc5c3('0x32')][_0xc5c3('0x4d')]({'where':{'id':_0x53a502['params']['id']}})['then'](function(_0x288b93){return db[_0xc5c3('0x4f')][_0xc5c3('0x50')](function(_0x187a7a){return _0x288b93['removeTeams'](_0x53a502[_0xc5c3('0x37')][_0xc5c3('0x74')],{'transaction':_0x187a7a})[_0xc5c3('0x2a')](function(){if(!_['isEmpty'](_0x2b49da)){return _0x288b93[_0xc5c3('0x76')](_0x2b49da,{'transaction':_0x187a7a});}})[_0xc5c3('0x2a')](function(){_0x2b49da['forEach'](function(_0x8ec6b6){socket[_0xc5c3('0x79')](_0xc5c3('0x78'),{'UserId':_0x8ec6b6,'VoicePrefixId':_0x288b93['id']});});});});});});})[_0xc5c3('0x2a')](respondWithStatusCode(_0x762654,null))[_0xc5c3('0x48')](handleError(_0x762654,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index d1072ef..3f53257 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 _0xe550=['hook','events','VoicePrefix','setMaxListeners','save','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe550,0xa2));var _0x0e55=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe550[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x0e55('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x0e55('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x0e55('0x2')](0x0);var events={'afterCreate':_0x0e55('0x3'),'afterUpdate':_0x0e55('0x4'),'afterDestroy':'remove'};function emitEvent(_0x43337b){return function(_0xa6e04a,_0x4f25cb,_0x116396){VoicePrefixEvents[_0x0e55('0x5')](_0x43337b+':'+_0xa6e04a['id'],_0xa6e04a);VoicePrefixEvents['emit'](_0x43337b,_0xa6e04a);_0x116396(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x0e55('0x6')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x0132=['hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit'];(function(_0x12a7ff,_0x3f5340){var _0x5a5c12=function(_0x533f09){while(--_0x533f09){_0x12a7ff['push'](_0x12a7ff['shift']());}};_0x5a5c12(++_0x3f5340);}(_0x0132,0x11b));var _0x2013=function(_0x5e9cf1,_0x342adb){_0x5e9cf1=_0x5e9cf1-0x0;var _0x15b058=_0x0132[_0x5e9cf1];return _0x15b058;};'use strict';var EventEmitter=require(_0x2013('0x0'));var VoicePrefix=require(_0x2013('0x1'))['db'][_0x2013('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x2013('0x3')](0x0);var events={'afterCreate':_0x2013('0x4'),'afterUpdate':'update','afterDestroy':_0x2013('0x5')};function emitEvent(_0x525f1e){return function(_0x3310d5,_0x47e358,_0x131297){VoicePrefixEvents[_0x2013('0x6')](_0x525f1e+':'+_0x3310d5['id'],_0x3310d5);VoicePrefixEvents['emit'](_0x525f1e,_0x3310d5);_0x131297(null);};}for(var e in events){if(events[_0x2013('0x7')](e)){var event=events[e];VoicePrefix[_0x2013('0x8')](e,emitEvent(event));}}module[_0x2013('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3897545..099880b 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 _0xe0ed=['./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4510f2,_0x1cc8dc){var _0x3bc792=function(_0x21084f){while(--_0x21084f){_0x4510f2['push'](_0x4510f2['shift']());}};_0x3bc792(++_0x1cc8dc);}(_0xe0ed,0xe2));var _0xde0e=function(_0x1d9894,_0x350e81){_0x1d9894=_0x1d9894-0x0;var _0x3dbd26=_0xe0ed[_0x1d9894];return _0x3dbd26;};'use strict';var _=require(_0xde0e('0x0'));var util=require(_0xde0e('0x1'));var logger=require(_0xde0e('0x2'))(_0xde0e('0x3'));var moment=require(_0xde0e('0x4'));var BPromise=require(_0xde0e('0x5'));var rp=require(_0xde0e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde0e('0x7'));var config=require('../../config/environment');var attributes=require(_0xde0e('0x8'));module[_0xde0e('0x9')]=function(_0x37b7c1,_0x3f4c5d){return _0x37b7c1[_0xde0e('0xa')](_0xde0e('0xb'),attributes,{'tableName':_0xde0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4384=['voice_prefixes','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x4384,0xbc));var _0x4438=function(_0x1b1168,_0x5a48e8){_0x1b1168=_0x1b1168-0x0;var _0x5335d5=_0x4384[_0x1b1168];return _0x5335d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4438('0x0'))(_0x4438('0x1'));var moment=require(_0x4438('0x2'));var BPromise=require(_0x4438('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4438('0x4'));var rimraf=require(_0x4438('0x5'));var config=require(_0x4438('0x6'));var attributes=require(_0x4438('0x7'));module[_0x4438('0x8')]=function(_0x5f3e5b,_0xfbcd69){return _0x5f3e5b['define'](_0x4438('0x9'),attributes,{'tableName':_0x4438('0xa'),'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 3e40504..c4b7128 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 _0x714c=['randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','info','debug','request\x20sent','stringify','error','VoicePrefix,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x714c,0x18d));var _0xc714=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x714c[_0x5cbace];return _0x6de5b8;};'use strict';var _=require('lodash');var util=require(_0xc714('0x0'));var moment=require(_0xc714('0x1'));var BPromise=require(_0xc714('0x2'));var rs=require(_0xc714('0x3'));var fs=require('fs');var Redis=require(_0xc714('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc714('0x5'));var logger=require(_0xc714('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc714('0x7'));var client=jayson[_0xc714('0x8')][_0xc714('0x9')]({'port':0x232a});config[_0xc714('0xa')]=_['defaults'](config['redis'],{'host':_0xc714('0xb'),'port':0x18eb});var socket=require(_0xc714('0xc'))(new Redis(config[_0xc714('0xa')]));require(_0xc714('0xd'))[_0xc714('0xe')](socket);function respondWithRpcPromise(_0x5b6aa5,_0x226622,_0x34a03f){return new BPromise(function(_0x3438b4,_0x263f56){return client[_0xc714('0xf')](_0x5b6aa5,_0x34a03f)['then'](function(_0xaa2acc){logger[_0xc714('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x226622,'request\x20sent');logger[_0xc714('0x11')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x226622,_0xc714('0x12'),JSON[_0xc714('0x13')](_0xaa2acc));if(_0xaa2acc[_0xc714('0x14')]){if(_0xaa2acc[_0xc714('0x14')]['code']===0x1f4){logger[_0xc714('0x14')](_0xc714('0x15'),_0x226622,_0xaa2acc[_0xc714('0x14')][_0xc714('0x16')]);return _0x263f56(_0xaa2acc[_0xc714('0x14')][_0xc714('0x16')]);}logger[_0xc714('0x14')](_0xc714('0x15'),_0x226622,_0xaa2acc['error']['message']);return _0x3438b4(_0xaa2acc[_0xc714('0x14')][_0xc714('0x16')]);}else{logger[_0xc714('0x10')](_0xc714('0x15'),_0x226622,_0xc714('0x12'));_0x3438b4(_0xaa2acc[_0xc714('0x17')][_0xc714('0x16')]);}})[_0xc714('0x18')](function(_0x50a84a){logger[_0xc714('0x14')](_0xc714('0x15'),_0x226622,_0x50a84a);_0x263f56(_0x50a84a);});});} \ No newline at end of file +var _0xc962=['result','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','info','VoicePrefix,\x20%s,\x20%s'];(function(_0x2044ba,_0x1ebab8){var _0x2fa276=function(_0x20f79c){while(--_0x20f79c){_0x2044ba['push'](_0x2044ba['shift']());}};_0x2fa276(++_0x1ebab8);}(_0xc962,0x6d));var _0x2c96=function(_0x56b950,_0x25b33e){_0x56b950=_0x56b950-0x0;var _0x1cc75d=_0xc962[_0x56b950];return _0x1cc75d;};'use strict';var _=require(_0x2c96('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2c96('0x1'));var fs=require('fs');var Redis=require(_0x2c96('0x2'));var db=require(_0x2c96('0x3'))['db'];var utils=require(_0x2c96('0x4'));var logger=require(_0x2c96('0x5'))(_0x2c96('0x6'));var config=require(_0x2c96('0x7'));var jayson=require(_0x2c96('0x8'));var client=jayson['client'][_0x2c96('0x9')]({'port':0x232a});config[_0x2c96('0xa')]=_[_0x2c96('0xb')](config[_0x2c96('0xa')],{'host':_0x2c96('0xc'),'port':0x18eb});var socket=require(_0x2c96('0xd'))(new Redis(config[_0x2c96('0xa')]));require(_0x2c96('0xe'))[_0x2c96('0xf')](socket);function respondWithRpcPromise(_0x55f8ed,_0x4860c3,_0x238c6b){return new BPromise(function(_0x3a3f4c,_0x2c6fbf){return client[_0x2c96('0x10')](_0x55f8ed,_0x238c6b)[_0x2c96('0x11')](function(_0x43abec){logger['info']('VoicePrefix,\x20%s,\x20%s',_0x4860c3,_0x2c96('0x12'));logger[_0x2c96('0x13')](_0x2c96('0x14'),_0x4860c3,_0x2c96('0x12'),JSON[_0x2c96('0x15')](_0x43abec));if(_0x43abec[_0x2c96('0x16')]){if(_0x43abec[_0x2c96('0x16')]['code']===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x4860c3,_0x43abec[_0x2c96('0x16')][_0x2c96('0x17')]);return _0x2c6fbf(_0x43abec['error'][_0x2c96('0x17')]);}logger[_0x2c96('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x4860c3,_0x43abec[_0x2c96('0x16')][_0x2c96('0x17')]);return _0x3a3f4c(_0x43abec[_0x2c96('0x16')][_0x2c96('0x17')]);}else{logger[_0x2c96('0x18')](_0x2c96('0x19'),_0x4860c3,_0x2c96('0x12'));_0x3a3f4c(_0x43abec[_0x2c96('0x1a')][_0x2c96('0x17')]);}})['catch'](function(_0x518fc5){logger[_0x2c96('0x16')](_0x2c96('0x19'),_0x4860c3,_0x518fc5);_0x2c6fbf(_0x518fc5);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index d4e66b0..dfacd68 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 _0x885e=['removeListener','register','length','voicePrefix:','./voicePrefix.events','save','update','emit'];(function(_0x464a5d,_0x1b64cb){var _0xd8e7c6=function(_0x32c8a8){while(--_0x32c8a8){_0x464a5d['push'](_0x464a5d['shift']());}};_0xd8e7c6(++_0x1b64cb);}(_0x885e,0xe4));var _0xe885=function(_0xe2d607,_0xae3084){_0xe2d607=_0xe2d607-0x0;var _0x35a1ab=_0x885e[_0xe2d607];return _0x35a1ab;};'use strict';var VoicePrefixEvents=require(_0xe885('0x0'));var events=[_0xe885('0x1'),'remove',_0xe885('0x2')];function createListener(_0x1cd11a,_0x162982){return function(_0xfea0bc){_0x162982[_0xe885('0x3')](_0x1cd11a,_0xfea0bc);};}function removeListener(_0x4fcd9b,_0x499ab6){return function(){VoicePrefixEvents[_0xe885('0x4')](_0x4fcd9b,_0x499ab6);};}exports[_0xe885('0x5')]=function(_0x33286a){for(var _0x1a5fd6=0x0,_0x55d2b2=events[_0xe885('0x6')];_0x1a5fd6<_0x55d2b2;_0x1a5fd6++){var _0x597bdc=events[_0x1a5fd6];var _0x2e8fe0=createListener(_0xe885('0x7')+_0x597bdc,_0x33286a);VoicePrefixEvents['on'](_0x597bdc,_0x2e8fe0);}}; \ No newline at end of file +var _0xd353=['update','emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save'];(function(_0x26e73f,_0x36cd86){var _0x3dc6da=function(_0x26d2f2){while(--_0x26d2f2){_0x26e73f['push'](_0x26e73f['shift']());}};_0x3dc6da(++_0x36cd86);}(_0xd353,0x7e));var _0x3d35=function(_0x21a17d,_0x2be3af){_0x21a17d=_0x21a17d-0x0;var _0x560add=_0xd353[_0x21a17d];return _0x560add;};'use strict';var VoicePrefixEvents=require(_0x3d35('0x0'));var events=[_0x3d35('0x1'),'remove',_0x3d35('0x2')];function createListener(_0x408bd9,_0x4e0c68){return function(_0x528f0e){_0x4e0c68[_0x3d35('0x3')](_0x408bd9,_0x528f0e);};}function removeListener(_0x4e0869,_0x3bc47e){return function(){VoicePrefixEvents[_0x3d35('0x4')](_0x4e0869,_0x3bc47e);};}exports[_0x3d35('0x5')]=function(_0xb43971){for(var _0x16965f=0x0,_0x174b6b=events[_0x3d35('0x6')];_0x16965f<_0x174b6b;_0x16965f++){var _0x5db879=events[_0x16965f];var _0x2dd75b=createListener(_0x3d35('0x7')+_0x5db879,_0xb43971);VoicePrefixEvents['on'](_0x5db879,_0x2dd75b);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 2287d09..d48895b 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x3340c8,_0x3d67d7){var _0x30ca8a=function(_0x435fff){while(--_0x435fff){_0x3340c8['push'](_0x3340c8['shift']());}};_0x30ca8a(++_0x3d67d7);}(_0xb10b,0x12a));var _0xbb10=function(_0x5a60ce,_0x48f080){_0x5a60ce=_0x5a60ce-0x0;var _0x393e5e=_0xb10b[_0x5a60ce];return _0x393e5e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x41a332,_0x67b939){var _0x15ae65=function(_0x2f392a){while(--_0x2f392a){_0x41a332['push'](_0x41a332['shift']());}};_0x15ae65(++_0x67b939);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 867d5c6..5c3b44a 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 _0x50fc=['setDataValue','strategy','rrmemory','getDataValue','dialMethod','outbound','preview','booked','roundrobin','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','acw','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','Dial\x20Method.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','UNSIGNED','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\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)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','#AMD\x20Initial\x20Silence','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','leastrecent','fewestcalls','linear','wrandom','rrordered','ringall'];(function(_0x2f9de8,_0x2b8fc9){var _0x26843a=function(_0x534c67){while(--_0x534c67){_0x2f9de8['push'](_0x2f9de8['shift']());}};_0x26843a(++_0x2b8fc9);}(_0x50fc,0x1b5));var _0xc50f=function(_0x4de1b1,_0x18c64c){_0x4de1b1=_0x4de1b1-0x0;var _0x639f27=_0x50fc[_0x4de1b1];return _0x639f27;};'use strict';var Sequelize=require(_0xc50f('0x0'));module[_0xc50f('0x1')]={'name':{'type':Sequelize[_0xc50f('0x2')],'allowNull':![],'unique':_0xc50f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x5'),'outbound'),'allowNull':![],'defaultValue':_0xc50f('0x5')},'musiconhold':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':_0xc50f('0x6')},'announce':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xc50f('0x4')]('rr','ringall',_0xc50f('0x7'),_0xc50f('0x8'),'random','rrmemory',_0xc50f('0x9'),_0xc50f('0xa'),_0xc50f('0xb')),'allowNull':![],'defaultValue':_0xc50f('0xc'),'set':function(_0x32cc04){this[_0xc50f('0xd')](_0xc50f('0xe'),_0x32cc04?_0x32cc04:_0xc50f('0xf'));},'get':function(){var _0x1973a6=this[_0xc50f('0x10')]('type');var _0x7c79f2=this[_0xc50f('0x10')](_0xc50f('0x11'));var _0x1debc2=this['getDataValue'](_0xc50f('0xe'));if(_0x1973a6===_0xc50f('0x12')){if(_0x7c79f2===_0xc50f('0x13')){return null;}if(_0x7c79f2===_0xc50f('0x14')&&![_0xc50f('0xf'),_0xc50f('0x15')]['includes'](_0x1debc2)){this[_0xc50f('0xd')]('strategy','rrmemory');}}return _0x1debc2;}},'servicelevel':{'type':Sequelize[_0xc50f('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xc50f('0x16')](0xb)},'timeout':{'type':Sequelize[_0xc50f('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xc50f('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':_0xc50f('0x17')},'autopause':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no',_0xc50f('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xc50f('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xc50f('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xc50f('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xc50f('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xc50f('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xc50f('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':_0xc50f('0x17')},'announce_holdtime':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no',_0xc50f('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xc50f('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xc50f('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xc50f('0x2')]},'queue_quantity1':{'type':Sequelize[_0xc50f('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0xc50f('0x2')]},'queue_less_than':{'type':Sequelize[_0xc50f('0x2')]},'periodic_announce':{'type':Sequelize[_0xc50f('0x1a')],'set':function(_0x4e52f9){this[_0xc50f('0xd')](_0xc50f('0x1b'),_0x4e52f9?_0x4e52f9[_0xc50f('0x1c')](','):[]);},'get':function(){return this[_0xc50f('0x10')](_0xc50f('0x1b'))?this[_0xc50f('0x10')](_0xc50f('0x1b'))[_0xc50f('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':_0xc50f('0x17'),'set':function(_0xac6ac4){this[_0xc50f('0xd')](_0xc50f('0x1e'),_0xac6ac4?_0xac6ac4[_0xc50f('0x1c')](','):undefined);},'get':function(){return this[_0xc50f('0x10')]('joinempty')?this[_0xc50f('0x10')](_0xc50f('0x1e'))[_0xc50f('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':'no','set':function(_0x2cebe0){this[_0xc50f('0xd')]('leavewhenempty',_0x2cebe0?_0x2cebe0[_0xc50f('0x1c')](','):undefined);},'get':function(){return this[_0xc50f('0x10')]('leavewhenempty')?this[_0xc50f('0x10')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xc50f('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xc50f('0x2')]},'description':{'type':Sequelize[_0xc50f('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x5f1ba2){this[_0xc50f('0xd')](_0xc50f('0x1f'),_0x5f1ba2);if(_0x5f1ba2){if(this['getDataValue']('wrapuptime')<0x2){this[_0xc50f('0xd')](_0xc50f('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xc50f('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xc50f('0x21')],'defaultValue':0x0,'comment':_0xc50f('0x22')},'dialMethod':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x13'),_0xc50f('0x23'),'power','predictive','booked'),'defaultValue':_0xc50f('0x23'),'comment':_0xc50f('0x24')},'dialLimitChannel':{'type':Sequelize[_0xc50f('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xc50f('0x25')},'dialPowerLevel':{'type':Sequelize[_0xc50f('0x26')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x27'),_0xc50f('0x28')),'defaultValue':'dropRate','comment':_0xc50f('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xc50f('0x26')](0x2)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xc50f('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xc50f('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc50f('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc50f('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xc50f('0x2a')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc50f('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':'tTxX','comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0xc50f('0x2')],'comment':_0xc50f('0x2e')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc50f('0x2f')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc50f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc50f('0x30')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc50f('0x31')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc50f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc50f('0x16')](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc50f('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc50f('0x33')},'dialTimezone':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xc50f('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x34'),_0xc50f('0x35'),'onlyIfOpen'),'defaultValue':_0xc50f('0x34')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc50f('0x16')](0x9)[_0xc50f('0x2a')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc50f('0x36')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc50f('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc50f('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc50f('0x38')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xc50f('0x2a')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc50f('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc50f('0x16')](0x9)[_0xc50f('0x2a')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc50f('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc50f('0x16')](0x9)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc50f('0x3b')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc50f('0x16')](0x5)[_0xc50f('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc50f('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc50f('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xc50f('0x16')](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc50f('0x4')](_0xc50f('0x3d'),_0xc50f('0x3e')),'defaultValue':_0xc50f('0x3d')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xc50f('0x2e')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xc50f('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xc50f('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc50f('0x3f')},'dialCutDigit':{'type':Sequelize[_0xc50f('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc50f('0x40')},'dialDropMaxRetry':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xc50f('0x16')](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc50f('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc50f('0x41')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc50f('0x16')](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc50f('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc50f('0x43')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc50f('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc50f('0x44')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc50f('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc50f('0x45')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc50f('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc50f('0x46')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':_0xc50f('0x47')},'mandatoryDisposition':{'type':Sequelize[_0xc50f('0x21')],'defaultValue':![],'comment':_0xc50f('0x48'),'set':function(_0x22c433){if(!_0x22c433)this[_0xc50f('0xd')](_0xc50f('0x49'),null);this[_0xc50f('0xd')](_0xc50f('0x4a'),_0x22c433);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xc50f('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xc50f('0x16')](0x3)[_0xc50f('0x2a')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xc50f('0x21')],'defaultValue':![]}}; \ No newline at end of file +var _0x3469=['Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','once','TEXT','setDataValue','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','power','predictive','progressive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','never','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC'];(function(_0x26bd05,_0x53869e){var _0xc24e01=function(_0x440e7e){while(--_0x440e7e){_0x26bd05['push'](_0x26bd05['shift']());}};_0xc24e01(++_0x53869e);}(_0x3469,0x19b));var _0x9346=function(_0x4c04b6,_0x5e89e2){_0x4c04b6=_0x4c04b6-0x0;var _0x5c092a=_0x3469[_0x4c04b6];return _0x5c092a;};'use strict';var Sequelize=require(_0x9346('0x0'));module[_0x9346('0x1')]={'name':{'type':Sequelize[_0x9346('0x2')],'allowNull':![],'unique':_0x9346('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x5'),'outbound'),'allowNull':![],'defaultValue':_0x9346('0x5')},'musiconhold':{'type':Sequelize[_0x9346('0x2')],'defaultValue':_0x9346('0x6')},'announce':{'type':Sequelize[_0x9346('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x9346('0x4')]('rr',_0x9346('0x7'),_0x9346('0x8'),_0x9346('0x9'),_0x9346('0xa'),_0x9346('0xb'),_0x9346('0xc'),'wrandom',_0x9346('0xd')),'allowNull':![],'defaultValue':_0x9346('0x7'),'set':function(_0x436580){this['setDataValue'](_0x9346('0xe'),_0x436580?_0x436580:_0x9346('0xb'));},'get':function(){var _0x85223a=this[_0x9346('0xf')](_0x9346('0x10'));var _0x142f91=this[_0x9346('0xf')](_0x9346('0x11'));var _0x520ccf=this[_0x9346('0xf')](_0x9346('0xe'));if(_0x85223a==='outbound'){if(_0x142f91===_0x9346('0x12')){return null;}if(_0x142f91===_0x9346('0x13')&&![_0x9346('0xb'),_0x9346('0x14')][_0x9346('0x15')](_0x520ccf)){this['setDataValue']('strategy',_0x9346('0xb'));}}return _0x520ccf;}},'servicelevel':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9346('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':_0x9346('0x17')},'autopause':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9346('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x9346('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9346('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9346('0x4')]('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9346('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':_0x9346('0x17')},'announce_holdtime':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no',_0x9346('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9346('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x9346('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9346('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9346('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9346('0x2')]},'queue_youarenext':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9346('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9346('0x2')]},'queue_quantity1':{'type':Sequelize[_0x9346('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x9346('0x2')]},'queue_less_than':{'type':Sequelize[_0x9346('0x2')]},'periodic_announce':{'type':Sequelize[_0x9346('0x19')],'set':function(_0x5f3949){this[_0x9346('0x1a')](_0x9346('0x1b'),_0x5f3949?_0x5f3949[_0x9346('0x1c')](','):[]);},'get':function(){return this[_0x9346('0xf')](_0x9346('0x1b'))?this[_0x9346('0xf')]('periodic_announce')[_0x9346('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x9346('0x2')],'defaultValue':_0x9346('0x17'),'set':function(_0x412426){this[_0x9346('0x1a')]('joinempty',_0x412426?_0x412426[_0x9346('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0x9346('0x1e'))?this[_0x9346('0xf')]('joinempty')[_0x9346('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9346('0x2')],'defaultValue':'no','set':function(_0x24c84a){this['setDataValue'](_0x9346('0x1f'),_0x24c84a?_0x24c84a[_0x9346('0x1c')](','):undefined);},'get':function(){return this[_0x9346('0xf')](_0x9346('0x1f'))?this[_0x9346('0xf')](_0x9346('0x1f'))[_0x9346('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9346('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x9346('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9346('0x2')]},'acw':{'type':Sequelize[_0x9346('0x20')],'defaultValue':0x0,'set':function(_0x35bc50){this[_0x9346('0x1a')](_0x9346('0x21'),_0x35bc50);if(_0x35bc50){if(this[_0x9346('0xf')]('wrapuptime')<0x2){this[_0x9346('0x1a')](_0x9346('0x22'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9346('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9346('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x9346('0x4')]('preview','progressive',_0x9346('0x23'),_0x9346('0x24'),_0x9346('0x13')),'defaultValue':_0x9346('0x25'),'comment':_0x9346('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0x9346('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9346('0x28')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0x9346('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x9346('0x29')](0x2)[_0x9346('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9346('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x9346('0x2b')),'defaultValue':_0x9346('0x2b'),'comment':_0x9346('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9346('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9346('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9346('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9346('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9346('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9346('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize[_0x9346('0x2')],'defaultValue':_0x9346('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9346('0x30')},'dialQueueProject':{'type':Sequelize[_0x9346('0x2')],'comment':_0x9346('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9346('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9346('0x33')},'dialBusyMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9346('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9346('0x35')},'dialTimezone':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x9346('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9346('0x4')](_0x9346('0x36'),_0x9346('0x37'),_0x9346('0x38')),'defaultValue':_0x9346('0x36')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9346('0x16')](0x9)[_0x9346('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9346('0x39')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9346('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9346('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9346('0x16')](0x9)[_0x9346('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9346('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x9346('0x16')](0x9)[_0x9346('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9346('0x3c')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9346('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x9346('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9346('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9346('0x16')](0x9)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9346('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9346('0x16')](0x5)[_0x9346('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9346('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9346('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9346('0x41')},'dialRecallMeTimeout':{'type':Sequelize[_0x9346('0x16')](0x5)[_0x9346('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9346('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9346('0x43'),_0x9346('0x44')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x9346('0x2')],'comment':_0x9346('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9346('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9346('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9346('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9346('0x45')},'dialCutDigit':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9346('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9346('0x16')](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9346('0x47')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x9346('0x16')](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9346('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9346('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9346('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9346('0x16')](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9346('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9346('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9346('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9346('0x16')],'allowNull':!![],'comment':_0x9346('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0x9346('0x20')],'defaultValue':![],'comment':_0x9346('0x4e'),'set':function(_0x751389){if(!_0x751389)this[_0x9346('0x1a')]('mandatoryDispositionPauseId',null);this[_0x9346('0x1a')](_0x9346('0x4f'),_0x751389);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x9346('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9346('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9346('0x16')](0x3)[_0x9346('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9346('0x20')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index d4fba3b..6560c01 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 _0x5419=['api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','destroy','then','get','VoiceQueues','inbound','outbound','filter','ignore','value','type','name','UserProfileResource','error','stack','send','index','map','rawAttributes','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','VoiceQueue','includeAll','include','findAll','catch','show','params','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','length','omit','createdAt','updatedAt','QueueCampaigns','getHoppers','findOne','VoiceQueueId','CmHopper','rows','getHopperHistories','CmHopperHistory','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','voicePause','interface','forEach','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','QueryTypes','every','TeamId','includes','all','compact','isEmpty','removeAgents','addAgents','online','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','scheduledAt','ContactId','ListId','phone','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','fromQuery','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','CmList','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0x5419,0x175));var _0x9541=function(_0x57f74a,_0x3f8b13){_0x57f74a=_0x57f74a-0x0;var _0x15b677=_0x5419[_0x57f74a];return _0x15b677;};'use strict';var emlformat=require(_0x9541('0x0'));var rimraf=require(_0x9541('0x1'));var zipdir=require(_0x9541('0x2'));var jsonpatch=require(_0x9541('0x3'));var rp=require(_0x9541('0x4'));var moment=require(_0x9541('0x5'));var BPromise=require(_0x9541('0x6'));var Mustache=require(_0x9541('0x7'));var util=require(_0x9541('0x8'));var path=require(_0x9541('0x9'));var sox=require('sox');var csv=require(_0x9541('0xa'));var ejs=require(_0x9541('0xb'));var fs=require('fs');var fs_extra=require(_0x9541('0xc'));var _=require(_0x9541('0xd'));var squel=require(_0x9541('0xe'));var crypto=require(_0x9541('0xf'));var jsforce=require(_0x9541('0x10'));var deskjs=require(_0x9541('0x11'));var toCsv=require('to-csv');var querystring=require(_0x9541('0x12'));var Papa=require('papaparse');var Redis=require(_0x9541('0x13'));var authService=require(_0x9541('0x14'));var qs=require(_0x9541('0x15'));var as=require(_0x9541('0x16'));var hardwareService=require(_0x9541('0x17'));var logger=require(_0x9541('0x18'))(_0x9541('0x19'));var utils=require('../../config/utils');var config=require(_0x9541('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x9541('0x1b')]=_['defaults'](config[_0x9541('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x9541('0x1c'))(new Redis(config[_0x9541('0x1b')]));require(_0x9541('0x1d'))[_0x9541('0x1e')](socket);function respondWithStatusCode(_0x28316e,_0x4114bf){_0x4114bf=_0x4114bf||0xcc;return function(_0x551b66){if(_0x551b66){return _0x28316e[_0x9541('0x1f')](_0x4114bf);}return _0x28316e['status'](_0x4114bf)[_0x9541('0x20')]();};}function respondWithResult(_0x569b6d,_0x421985){_0x421985=_0x421985||0xc8;return function(_0x5ad2f5){if(_0x5ad2f5){return _0x569b6d[_0x9541('0x21')](_0x421985)[_0x9541('0x22')](_0x5ad2f5);}};}function respondWithFilteredResult(_0xcc7699,_0x3eda42){return function(_0xf5a87e){if(_0xf5a87e){var _0x43238e=typeof _0x3eda42['offset']==='undefined'&&typeof _0x3eda42[_0x9541('0x23')]===_0x9541('0x24');var _0x594ba4=_0xf5a87e['count'];var _0x2aafdb=_0x43238e?0x0:_0x3eda42[_0x9541('0x25')];var _0x2417e4=_0x43238e?_0xf5a87e[_0x9541('0x26')]:_0x3eda42[_0x9541('0x25')]+_0x3eda42[_0x9541('0x23')];var _0xf225bb;if(_0x2417e4>=_0x594ba4){_0x2417e4=_0x594ba4;_0xf225bb=0xc8;}else{_0xf225bb=0xce;}_0xcc7699[_0x9541('0x21')](_0xf225bb);return _0xcc7699[_0x9541('0x27')](_0x9541('0x28'),_0x2aafdb+'-'+_0x2417e4+'/'+_0x594ba4)[_0x9541('0x22')](_0xf5a87e);}return null;};}function patchUpdates(_0x54a827){return function(_0x30b08b){try{jsonpatch[_0x9541('0x29')](_0x30b08b,_0x54a827,!![]);}catch(_0x41abc5){return BPromise[_0x9541('0x2a')](_0x41abc5);}return _0x30b08b[_0x9541('0x2b')]();};}function saveUpdates(_0x2f6b0a,_0x1b5adb){return function(_0x451013){if(_0x451013){return _0x451013[_0x9541('0x2c')](_0x2f6b0a)['then'](function(_0x35ec2c){return _0x35ec2c;});}return null;};}function removeEntity(_0x48987e,_0xbaf6cb){return function(_0x10fafe){if(_0x10fafe){return _0x10fafe[_0x9541('0x2d')]()[_0x9541('0x2e')](function(){var _0x4b6faf=_0x10fafe[_0x9541('0x2f')]({'plain':!![]});var _0x46ea7e=[{'name':_0x9541('0x30'),'value':_0x9541('0x31'),'ignore':![]},{'name':'QueueCampaigns','value':_0x9541('0x32'),'ignore':![]}];var _0x56645d=_(_0x46ea7e)[_0x9541('0x33')](_0x9541('0x34'))['map'](_0x9541('0x35'))[_0x9541('0x35')]();if(_['includes'](_0x56645d,_0x4b6faf[_0x9541('0x36')])){return;}var _0xda879d=_['find'](_0x46ea7e,[_0x9541('0x35'),_0x4b6faf['type']])[_0x9541('0x37')];return db[_0x9541('0x38')][_0x9541('0x2d')]({'where':{'type':_0xda879d,'resourceId':_0x4b6faf['id']}})[_0x9541('0x2e')](function(){return _0x10fafe;});})[_0x9541('0x2e')](function(){_0x48987e[_0x9541('0x21')](0xcc)[_0x9541('0x20')]();});}};}function handleEntityNotFound(_0x575c1c,_0xfb7156){return function(_0x451816){if(!_0x451816){_0x575c1c[_0x9541('0x1f')](0x194);}return _0x451816;};}function handleError(_0x299f03,_0x47443c){_0x47443c=_0x47443c||0x1f4;return function(_0x19c3e3){logger[_0x9541('0x39')](_0x19c3e3[_0x9541('0x3a')]);if(_0x19c3e3[_0x9541('0x37')]){delete _0x19c3e3[_0x9541('0x37')];}_0x299f03[_0x9541('0x21')](_0x47443c)[_0x9541('0x3b')](_0x19c3e3);};}exports[_0x9541('0x3c')]=function(_0x1275da,_0x63a068){var _0x1957f6={},_0x2d4611={},_0xe9b68f={'count':0x0,'rows':[]};var _0x43d4ea=_[_0x9541('0x3d')](db['VoiceQueue'][_0x9541('0x3e')],function(_0x4bf7ad){return{'name':_0x4bf7ad['fieldName'],'type':_0x4bf7ad['type']['key']};});_0x2d4611[_0x9541('0x3f')]=_[_0x9541('0x3d')](_0x43d4ea,_0x9541('0x37'));_0x2d4611['query']=_[_0x9541('0x40')](_0x1275da[_0x9541('0x41')]);_0x2d4611['filters']=_[_0x9541('0x42')](_0x2d4611[_0x9541('0x3f')],_0x2d4611[_0x9541('0x41')]);_0x1957f6[_0x9541('0x43')]=_[_0x9541('0x42')](_0x2d4611[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x1275da[_0x9541('0x41')][_0x9541('0x44')]));_0x1957f6[_0x9541('0x43')]=_0x1957f6['attributes']['length']?_0x1957f6[_0x9541('0x43')]:_0x2d4611[_0x9541('0x3f')];if(!_0x1275da[_0x9541('0x41')][_0x9541('0x45')](_0x9541('0x46'))){_0x1957f6[_0x9541('0x23')]=qs[_0x9541('0x23')](_0x1275da[_0x9541('0x41')][_0x9541('0x23')]);_0x1957f6['offset']=qs[_0x9541('0x25')](_0x1275da['query'][_0x9541('0x25')]);}_0x1957f6[_0x9541('0x47')]=qs[_0x9541('0x48')](_0x1275da[_0x9541('0x41')]['sort']);_0x1957f6[_0x9541('0x49')]=qs[_0x9541('0x4a')](_[_0x9541('0x4b')](_0x1275da[_0x9541('0x41')],_0x2d4611[_0x9541('0x4a')]),_0x43d4ea);if(_0x1275da[_0x9541('0x41')][_0x9541('0x33')]){_0x1957f6[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x1957f6['where'],{'$or':_['map'](_0x43d4ea,function(_0x41b5d6){if(_0x41b5d6[_0x9541('0x36')]!==_0x9541('0x4d')){var _0x5e9c1a={};_0x5e9c1a[_0x41b5d6[_0x9541('0x37')]]={'$like':'%'+_0x1275da['query'][_0x9541('0x33')]+'%'};return _0x5e9c1a;}})});}_0x1957f6=_['merge']({},_0x1957f6,_0x1275da[_0x9541('0x4e')]);var _0x309f5c={'where':_0x1957f6[_0x9541('0x49')]};return db[_0x9541('0x4f')]['count'](_0x309f5c)[_0x9541('0x2e')](function(_0x2bbd04){_0xe9b68f[_0x9541('0x26')]=_0x2bbd04;if(_0x1275da['query'][_0x9541('0x50')]){_0x1957f6[_0x9541('0x51')]=[{'all':!![]}];}return db[_0x9541('0x4f')][_0x9541('0x52')](_0x1957f6);})['then'](function(_0x531890){_0xe9b68f['rows']=_0x531890;return _0xe9b68f;})['then'](respondWithFilteredResult(_0x63a068,_0x1957f6))[_0x9541('0x53')](handleError(_0x63a068,null));};exports[_0x9541('0x54')]=function(_0x3681b9,_0x38d9fa){var _0x283a35={'raw':![],'where':{'id':_0x3681b9[_0x9541('0x55')]['id']}},_0x593b9f={};_0x593b9f[_0x9541('0x3f')]=_[_0x9541('0x40')](db['VoiceQueue']['rawAttributes']);_0x593b9f[_0x9541('0x41')]=_[_0x9541('0x40')](_0x3681b9[_0x9541('0x41')]);_0x593b9f['filters']=_['intersection'](_0x593b9f[_0x9541('0x3f')],_0x593b9f[_0x9541('0x41')]);_0x283a35[_0x9541('0x43')]=_[_0x9541('0x42')](_0x593b9f[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x3681b9[_0x9541('0x41')]['fields']));_0x283a35[_0x9541('0x43')]=_0x283a35[_0x9541('0x43')]['length']?_0x283a35['attributes']:_0x593b9f[_0x9541('0x3f')];if(_0x3681b9[_0x9541('0x41')][_0x9541('0x50')]){_0x283a35[_0x9541('0x51')]=[{'all':!![]}];}_0x283a35=_[_0x9541('0x4c')]({},_0x283a35,_0x3681b9[_0x9541('0x4e')]);return db[_0x9541('0x4f')]['find'](_0x283a35)['then'](handleEntityNotFound(_0x38d9fa,null))[_0x9541('0x2e')](respondWithResult(_0x38d9fa,null))['catch'](handleError(_0x38d9fa,null));};exports[_0x9541('0x56')]=function(_0x24a316,_0x10c23d){return db['VoiceQueue'][_0x9541('0x56')](_0x24a316[_0x9541('0x57')],{})[_0x9541('0x2e')](function(_0x6c85e4){var _0x3c7385=_0x24a316[_0x9541('0x58')][_0x9541('0x2f')]({'plain':!![]});if(!_0x3c7385)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c7385[_0x9541('0x59')]==='user'){var _0x278d80=_0x6c85e4[_0x9541('0x2f')]({'plain':!![]});var _0x578f66=[{'name':_0x9541('0x30'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x9541('0x32')}];var _0x3d9f7c=_['find'](_0x578f66,[_0x9541('0x35'),_0x278d80[_0x9541('0x36')]])[_0x9541('0x37')];return db[_0x9541('0x5a')][_0x9541('0x5b')]({'where':{'name':_0x3d9f7c,'userProfileId':_0x3c7385[_0x9541('0x5c')]},'raw':!![]})[_0x9541('0x2e')](function(_0x13e98c){if(_0x13e98c&&_0x13e98c[_0x9541('0x5d')]===0x0){return db['UserProfileResource'][_0x9541('0x56')]({'name':_0x278d80[_0x9541('0x37')],'resourceId':_0x278d80['id'],'type':_0x13e98c[_0x9541('0x37')],'sectionId':_0x13e98c['id']},{})[_0x9541('0x2e')](function(){return _0x6c85e4;});}else{return _0x6c85e4;}})[_0x9541('0x53')](function(_0x24e77a){logger[_0x9541('0x39')](_0x9541('0x5e'),_0x24e77a);throw _0x24e77a;});}return _0x6c85e4;})['then'](respondWithResult(_0x10c23d,0xc9))[_0x9541('0x53')](handleError(_0x10c23d,null));};exports['clone']=function(_0x4aa097,_0x1ad597){var _0x1ce01b={'where':{'id':_0x4aa097['params']['id']}},_0x4c280c={};_0x4c280c['model']=_['keys'](db[_0x9541('0x4f')]['rawAttributes']);_0x1ce01b[_0x9541('0x43')]=_[_0x9541('0x42')](_0x4c280c[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x4aa097[_0x9541('0x41')][_0x9541('0x44')]));_0x1ce01b[_0x9541('0x43')]=_0x1ce01b[_0x9541('0x43')][_0x9541('0x5f')]?_0x1ce01b[_0x9541('0x43')]:_0x4c280c[_0x9541('0x3f')];if(_0x4aa097['query'][_0x9541('0x50')]){_0x1ce01b['include']=[{'all':!![]}];}_0x1ce01b=_['merge']({},_0x1ce01b,_0x4aa097[_0x9541('0x4e')]);return db[_0x9541('0x4f')][_0x9541('0x5b')](_0x1ce01b)[_0x9541('0x2e')](handleEntityNotFound(_0x1ad597,null))[_0x9541('0x2e')](function(_0x207321){if(_0x207321){var _0x2d6848=_0x207321[_0x9541('0x2f')]({'plain':!![]});_0x2d6848=qs[_0x9541('0x60')](_0x2d6848,['id',_0x9541('0x61'),_0x9541('0x62')]);_0x4aa097[_0x9541('0x57')]=_[_0x9541('0x60')](_0x4aa097[_0x9541('0x57')],['id',_0x9541('0x61'),_0x9541('0x62')]);return db[_0x9541('0x4f')][_0x9541('0x56')](_[_0x9541('0x4c')](_0x2d6848,_0x4aa097[_0x9541('0x57')]),{'include':_0x4aa097[_0x9541('0x41')][_0x9541('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x386fb0){var _0x396869=_0x4aa097['user']['get']({'plain':!![]});if(!_0x396869)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x396869[_0x9541('0x59')]===_0x9541('0x58')){var _0x22b7b8=_0x386fb0[_0x9541('0x2f')]({'plain':!![]});var _0x4aac14=[{'name':_0x9541('0x30'),'value':_0x9541('0x31')},{'name':_0x9541('0x63'),'value':_0x9541('0x32')}];var _0x3cdcc4=_[_0x9541('0x5b')](_0x4aac14,['value',_0x22b7b8[_0x9541('0x36')]])[_0x9541('0x37')];return db['UserProfileSection']['find']({'where':{'name':_0x3cdcc4,'userProfileId':_0x396869['userProfileId']},'raw':!![]})['then'](function(_0x47d5cb){if(_0x47d5cb&&_0x47d5cb['autoAssociation']===0x0){return db[_0x9541('0x38')][_0x9541('0x56')]({'name':_0x22b7b8[_0x9541('0x37')],'resourceId':_0x22b7b8['id'],'type':_0x47d5cb['name'],'sectionId':_0x47d5cb['id']},{})[_0x9541('0x2e')](function(){return _0x386fb0;});}else{return _0x386fb0;}})[_0x9541('0x53')](function(_0x16c8d8){logger[_0x9541('0x39')](_0x9541('0x5e'),_0x16c8d8);throw _0x16c8d8;});}return _0x386fb0;});}})[_0x9541('0x2e')](respondWithResult(_0x1ad597,0xc9))[_0x9541('0x53')](handleError(_0x1ad597,null));};exports[_0x9541('0x2c')]=function(_0x2348bf,_0x25c486){if(_0x2348bf[_0x9541('0x57')]['id']){delete _0x2348bf[_0x9541('0x57')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x2348bf[_0x9541('0x55')]['id']}})['then'](handleEntityNotFound(_0x25c486,null))[_0x9541('0x2e')](saveUpdates(_0x2348bf[_0x9541('0x57')],null))['then'](respondWithResult(_0x25c486,null))[_0x9541('0x53')](handleError(_0x25c486,null));};exports[_0x9541('0x2d')]=function(_0x557cf5,_0x1585ea){return db['VoiceQueue'][_0x9541('0x5b')]({'where':{'id':_0x557cf5['params']['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x1585ea,null))[_0x9541('0x2e')](removeEntity(_0x1585ea,null))[_0x9541('0x53')](handleError(_0x1585ea,null));};exports[_0x9541('0x64')]=function(_0x4868f6,_0x1ef053,_0x51b190){var _0x3d0e8c={'raw':![],'where':{}};var _0x489962={};var _0x130c19={'count':0x0,'rows':[]};return db[_0x9541('0x4f')][_0x9541('0x65')]({'where':{'id':_0x4868f6[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x1ef053,null))[_0x9541('0x2e')](function(_0x265a75){if(_0x265a75){_0x489962[_0x9541('0x3f')]=_[_0x9541('0x40')](db['CmHopper'][_0x9541('0x3e')]);_0x489962[_0x9541('0x41')]=_[_0x9541('0x40')](_0x4868f6[_0x9541('0x41')]);_0x489962['filters']=_[_0x9541('0x42')](_0x489962['model'],_0x489962[_0x9541('0x41')]);_0x3d0e8c[_0x9541('0x43')]=_[_0x9541('0x42')](_0x489962[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x4868f6['query'][_0x9541('0x44')]));_0x3d0e8c[_0x9541('0x43')]=_0x3d0e8c[_0x9541('0x43')][_0x9541('0x5f')]?_0x3d0e8c[_0x9541('0x43')]:_0x489962[_0x9541('0x3f')];if(!_0x4868f6[_0x9541('0x41')][_0x9541('0x45')](_0x9541('0x46'))){_0x3d0e8c['limit']=qs[_0x9541('0x23')](_0x4868f6['query'][_0x9541('0x23')]);_0x3d0e8c[_0x9541('0x25')]=qs[_0x9541('0x25')](_0x4868f6['query'][_0x9541('0x25')]);}_0x3d0e8c['order']=qs['sort'](_0x4868f6['query'][_0x9541('0x48')]);_0x3d0e8c[_0x9541('0x49')]=qs['filters'](_[_0x9541('0x4b')](_0x4868f6[_0x9541('0x41')],_0x489962['filters']));_0x3d0e8c[_0x9541('0x49')][_0x9541('0x66')]=_0x265a75['id'];if(_0x4868f6['query']['filter']){_0x3d0e8c[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x3d0e8c[_0x9541('0x49')],{'$or':_['map'](_0x3d0e8c[_0x9541('0x43')],function(_0x17567a){var _0x46bd09={};_0x46bd09[_0x17567a]={'$like':'%'+_0x4868f6[_0x9541('0x41')][_0x9541('0x33')]+'%'};return _0x46bd09;})});}_0x3d0e8c=_[_0x9541('0x4c')]({},_0x3d0e8c,_0x4868f6[_0x9541('0x4e')]);return db[_0x9541('0x67')]['count']({'where':_0x3d0e8c['where']})[_0x9541('0x2e')](function(_0x1af68e){_0x130c19[_0x9541('0x26')]=_0x1af68e;if(_0x4868f6[_0x9541('0x41')][_0x9541('0x50')]){_0x3d0e8c[_0x9541('0x51')]=[{'all':!![]}];}return db[_0x9541('0x67')]['findAll'](_0x3d0e8c);})['then'](function(_0x2fa48a){_0x130c19[_0x9541('0x68')]=_0x2fa48a;return _0x130c19;});}})[_0x9541('0x2e')](respondWithFilteredResult(_0x1ef053,_0x3d0e8c))['catch'](handleError(_0x1ef053,null));};exports[_0x9541('0x69')]=function(_0x5d8d48,_0x43a18e,_0x137745){var _0x15d1db={'raw':!![],'where':{}};var _0x586a00={};var _0x422c29={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9541('0x65')]({'where':{'id':_0x5d8d48[_0x9541('0x55')]['id']}})['then'](handleEntityNotFound(_0x43a18e,null))[_0x9541('0x2e')](function(_0x448941){if(_0x448941){_0x586a00[_0x9541('0x3f')]=_[_0x9541('0x40')](db[_0x9541('0x6a')][_0x9541('0x3e')]);_0x586a00['query']=_[_0x9541('0x40')](_0x5d8d48[_0x9541('0x41')]);_0x586a00[_0x9541('0x4a')]=_['intersection'](_0x586a00[_0x9541('0x3f')],_0x586a00['query']);_0x15d1db[_0x9541('0x43')]=_[_0x9541('0x42')](_0x586a00[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x5d8d48[_0x9541('0x41')]['fields']));_0x15d1db[_0x9541('0x43')]=_0x15d1db[_0x9541('0x43')][_0x9541('0x5f')]?_0x15d1db[_0x9541('0x43')]:_0x586a00['model'];if(!_0x5d8d48['query'][_0x9541('0x45')](_0x9541('0x46'))){_0x15d1db['limit']=qs[_0x9541('0x23')](_0x5d8d48['query']['limit']);_0x15d1db['offset']=qs[_0x9541('0x25')](_0x5d8d48[_0x9541('0x41')][_0x9541('0x25')]);}_0x15d1db[_0x9541('0x47')]=qs['sort'](_0x5d8d48[_0x9541('0x41')][_0x9541('0x48')]);_0x15d1db[_0x9541('0x49')]=qs['filters'](_[_0x9541('0x4b')](_0x5d8d48[_0x9541('0x41')],_0x586a00['filters']));_0x15d1db[_0x9541('0x49')][_0x9541('0x66')]=_0x448941['id'];if(_0x5d8d48['query'][_0x9541('0x33')]){_0x15d1db[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x15d1db[_0x9541('0x49')],{'$or':_['map'](_0x15d1db[_0x9541('0x43')],function(_0x1c634a){var _0x44dda1={};_0x44dda1[_0x1c634a]={'$like':'%'+_0x5d8d48[_0x9541('0x41')]['filter']+'%'};return _0x44dda1;})});}_0x15d1db=_['merge']({},_0x15d1db,_0x5d8d48[_0x9541('0x4e')]);return db['CmHopperHistory']['count']({'where':_0x15d1db[_0x9541('0x49')]})[_0x9541('0x2e')](function(_0x5a74be){_0x422c29['count']=_0x5a74be;if(_0x5d8d48[_0x9541('0x41')][_0x9541('0x50')]){_0x15d1db[_0x9541('0x51')]=[{'all':!![]}];}return db[_0x9541('0x6a')]['findAll'](_0x15d1db);})['then'](function(_0x43f62b){_0x422c29[_0x9541('0x68')]=_0x43f62b;return _0x422c29;});}})['then'](respondWithFilteredResult(_0x43a18e,_0x15d1db))[_0x9541('0x53')](handleError(_0x43a18e,null));};exports['getHopperFinals']=function(_0xc759e5,_0xf03be4,_0x137bec){var _0x4153e3={'raw':!![],'where':{}};var _0x4bc0f6={};var _0x29f08e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xc759e5[_0x9541('0x55')]['id']}})['then'](handleEntityNotFound(_0xf03be4,null))[_0x9541('0x2e')](function(_0x1b4737){if(_0x1b4737){_0x4bc0f6[_0x9541('0x3f')]=_[_0x9541('0x40')](db['CmHopperFinal'][_0x9541('0x3e')]);_0x4bc0f6[_0x9541('0x41')]=_[_0x9541('0x40')](_0xc759e5[_0x9541('0x41')]);_0x4bc0f6['filters']=_[_0x9541('0x42')](_0x4bc0f6[_0x9541('0x3f')],_0x4bc0f6['query']);_0x4153e3[_0x9541('0x43')]=_[_0x9541('0x42')](_0x4bc0f6[_0x9541('0x3f')],qs['fields'](_0xc759e5['query'][_0x9541('0x44')]));_0x4153e3[_0x9541('0x43')]=_0x4153e3[_0x9541('0x43')][_0x9541('0x5f')]?_0x4153e3[_0x9541('0x43')]:_0x4bc0f6['model'];if(!_0xc759e5[_0x9541('0x41')][_0x9541('0x45')](_0x9541('0x46'))){_0x4153e3['limit']=qs[_0x9541('0x23')](_0xc759e5[_0x9541('0x41')][_0x9541('0x23')]);_0x4153e3[_0x9541('0x25')]=qs[_0x9541('0x25')](_0xc759e5['query'][_0x9541('0x25')]);}_0x4153e3[_0x9541('0x47')]=qs['sort'](_0xc759e5[_0x9541('0x41')][_0x9541('0x48')]);_0x4153e3[_0x9541('0x49')]=qs[_0x9541('0x4a')](_['pick'](_0xc759e5['query'],_0x4bc0f6['filters']));_0x4153e3[_0x9541('0x49')][_0x9541('0x66')]=_0x1b4737['id'];if(_0xc759e5[_0x9541('0x41')]['filter']){_0x4153e3[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x4153e3[_0x9541('0x49')],{'$or':_[_0x9541('0x3d')](_0x4153e3['attributes'],function(_0x16e5d6){var _0x24810e={};_0x24810e[_0x16e5d6]={'$like':'%'+_0xc759e5['query']['filter']+'%'};return _0x24810e;})});}_0x4153e3=_[_0x9541('0x4c')]({},_0x4153e3,_0xc759e5[_0x9541('0x4e')]);return db['CmHopperFinal']['count']({'where':_0x4153e3[_0x9541('0x49')]})['then'](function(_0xe0d0b1){_0x29f08e[_0x9541('0x26')]=_0xe0d0b1;if(_0xc759e5[_0x9541('0x41')][_0x9541('0x50')]){_0x4153e3['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x9541('0x52')](_0x4153e3);})['then'](function(_0x267753){_0x29f08e['rows']=_0x267753;return _0x29f08e;});}})[_0x9541('0x2e')](respondWithFilteredResult(_0xf03be4,_0x4153e3))[_0x9541('0x53')](handleError(_0xf03be4,null));};exports['getHopperBlacks']=function(_0x47833c,_0x3ada67,_0x55be8b){var _0x1e3f3f={'raw':!![],'where':{}};var _0x1b677c={};var _0x49d945={'count':0x0,'rows':[]};return db[_0x9541('0x4f')][_0x9541('0x65')]({'where':{'id':_0x47833c[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x3ada67,null))['then'](function(_0x53e51f){if(_0x53e51f){_0x1b677c[_0x9541('0x3f')]=_[_0x9541('0x40')](db[_0x9541('0x6b')]['rawAttributes']);_0x1b677c[_0x9541('0x41')]=_['keys'](_0x47833c[_0x9541('0x41')]);_0x1b677c[_0x9541('0x4a')]=_[_0x9541('0x42')](_0x1b677c[_0x9541('0x3f')],_0x1b677c['query']);_0x1e3f3f['attributes']=_[_0x9541('0x42')](_0x1b677c[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x47833c[_0x9541('0x41')][_0x9541('0x44')]));_0x1e3f3f[_0x9541('0x43')]=_0x1e3f3f['attributes'][_0x9541('0x5f')]?_0x1e3f3f['attributes']:_0x1b677c[_0x9541('0x3f')];if(!_0x47833c['query'][_0x9541('0x45')](_0x9541('0x46'))){_0x1e3f3f[_0x9541('0x23')]=qs[_0x9541('0x23')](_0x47833c[_0x9541('0x41')][_0x9541('0x23')]);_0x1e3f3f[_0x9541('0x25')]=qs[_0x9541('0x25')](_0x47833c[_0x9541('0x41')][_0x9541('0x25')]);}_0x1e3f3f['order']=qs[_0x9541('0x48')](_0x47833c[_0x9541('0x41')][_0x9541('0x48')]);_0x1e3f3f[_0x9541('0x49')]=qs[_0x9541('0x4a')](_[_0x9541('0x4b')](_0x47833c[_0x9541('0x41')],_0x1b677c[_0x9541('0x4a')]));_0x1e3f3f[_0x9541('0x49')][_0x9541('0x66')]=_0x53e51f['id'];if(_0x47833c[_0x9541('0x41')][_0x9541('0x33')]){_0x1e3f3f[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x1e3f3f[_0x9541('0x49')],{'$or':_['map'](_0x1e3f3f[_0x9541('0x43')],function(_0x4a5ee9){var _0x1d627d={};_0x1d627d[_0x4a5ee9]={'$like':'%'+_0x47833c['query'][_0x9541('0x33')]+'%'};return _0x1d627d;})});}_0x1e3f3f=_[_0x9541('0x4c')]({},_0x1e3f3f,_0x47833c['options']);return db[_0x9541('0x6b')][_0x9541('0x26')]({'where':_0x1e3f3f['where']})[_0x9541('0x2e')](function(_0x4dcf5c){_0x49d945[_0x9541('0x26')]=_0x4dcf5c;if(_0x47833c[_0x9541('0x41')][_0x9541('0x50')]){_0x1e3f3f[_0x9541('0x51')]=[{'all':!![]}];}return db[_0x9541('0x6b')][_0x9541('0x52')](_0x1e3f3f);})[_0x9541('0x2e')](function(_0x5366f8){_0x49d945[_0x9541('0x68')]=_0x5366f8;return _0x49d945;});}})[_0x9541('0x2e')](respondWithFilteredResult(_0x3ada67,_0x1e3f3f))[_0x9541('0x53')](handleError(_0x3ada67,null));};exports[_0x9541('0x6c')]=function(_0x416aba,_0x126f0c,_0x2b5278){var _0x1a0d7c={};var _0x1bc9bb={};var _0x46ccb8;var _0x5ce36f;return db[_0x9541('0x4f')][_0x9541('0x65')]({'where':{'id':_0x416aba[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x126f0c,null))[_0x9541('0x2e')](function(_0x5e915){if(_0x5e915){_0x46ccb8=_0x5e915;_0x1bc9bb[_0x9541('0x3f')]=_[_0x9541('0x40')](db[_0x9541('0x6d')][_0x9541('0x3e')]);_0x1bc9bb[_0x9541('0x41')]=_[_0x9541('0x40')](_0x416aba['query']);_0x1bc9bb['filters']=_[_0x9541('0x42')](_0x1bc9bb[_0x9541('0x3f')],_0x1bc9bb['query']);_0x1a0d7c['attributes']=_[_0x9541('0x42')](_0x1bc9bb[_0x9541('0x3f')],qs['fields'](_0x416aba['query'][_0x9541('0x44')]));_0x1a0d7c[_0x9541('0x43')]=_0x1a0d7c[_0x9541('0x43')][_0x9541('0x5f')]?_0x1a0d7c[_0x9541('0x43')]:_0x1bc9bb[_0x9541('0x3f')];_0x1a0d7c[_0x9541('0x47')]=qs[_0x9541('0x48')](_0x416aba[_0x9541('0x41')][_0x9541('0x48')]);_0x1a0d7c[_0x9541('0x49')]=qs[_0x9541('0x4a')](_[_0x9541('0x4b')](_0x416aba[_0x9541('0x41')],_0x1bc9bb[_0x9541('0x4a')]));if(_0x416aba[_0x9541('0x41')][_0x9541('0x33')]){_0x1a0d7c['where']=_[_0x9541('0x4c')](_0x1a0d7c[_0x9541('0x49')],{'$or':_[_0x9541('0x3d')](_0x1a0d7c[_0x9541('0x43')],function(_0x12db86){var _0x405e1d={};_0x405e1d[_0x12db86]={'$like':'%'+_0x416aba[_0x9541('0x41')]['filter']+'%'};return _0x405e1d;})});}_0x1a0d7c=_[_0x9541('0x4c')]({},_0x1a0d7c,_0x416aba[_0x9541('0x4e')]);return _0x46ccb8[_0x9541('0x6c')](_0x1a0d7c);}})[_0x9541('0x2e')](function(_0xca4964){if(_0xca4964){_0x5ce36f=_0xca4964[_0x9541('0x5f')];if(!_0x416aba[_0x9541('0x41')][_0x9541('0x45')](_0x9541('0x46'))){_0x1a0d7c['limit']=qs[_0x9541('0x23')](_0x416aba[_0x9541('0x41')][_0x9541('0x23')]);_0x1a0d7c['offset']=qs[_0x9541('0x25')](_0x416aba['query'][_0x9541('0x25')]);}return _0x46ccb8['getTeams'](_0x1a0d7c);}})[_0x9541('0x2e')](function(_0x70baa9){if(_0x70baa9){return _0x70baa9?{'count':_0x5ce36f,'rows':_0x70baa9}:null;}})['then'](respondWithResult(_0x126f0c,null))[_0x9541('0x53')](handleError(_0x126f0c,null));};exports[_0x9541('0x6e')]=function(_0x3ac566,_0x46b842,_0xe8b755){var _0x1bc42b=_0x3ac566[_0x9541('0x57')][_0x9541('0x6f')];var _0x5ef2e3=_['map'](_0x1bc42b,'id');return db['Team'][_0x9541('0x52')]({'where':{'id':_0x5ef2e3},'attributes':['id'],'include':[{'model':db[_0x9541('0x70')],'as':_0x9541('0x71'),'attributes':['id',_0x9541('0x37'),'online',_0x9541('0x72'),_0x9541('0x73')],'raw':!![]}]})[_0x9541('0x2e')](function(_0x252ff3){if(_0x252ff3){var _0x5a4865=_['flatMap'](_0x252ff3,function(_0x43e1a3){var _0x2fcdfa=_0x43e1a3[_0x9541('0x2f')]({'plain':!![]});_0x2fcdfa['Agents'][_0x9541('0x74')](function(_0x2c360b){_0x2c360b['penalty']=_[_0x9541('0x5b')](_0x1bc42b,{'id':_0x2fcdfa['id']})['penalty'];});return _0x2fcdfa['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0x3ac566['params']['id']}})[_0x9541('0x2e')](function(_0x21f5ee){return db[_0x9541('0x75')][_0x9541('0x76')](function(_0xd0bc68){return _0x21f5ee[_0x9541('0x6e')](_0x5ef2e3,{'transaction':_0xd0bc68})[_0x9541('0x2e')](function(){return BPromise[_0x9541('0x77')](_0x1bc42b,function(_0x6c7e32){return db[_0x9541('0x78')][_0x9541('0x79')]({'TeamId':_0x6c7e32['id'],'VoiceQueueId':_0x3ac566[_0x9541('0x55')]['id'],'penalty':_0x6c7e32['penalty']},{'transaction':_0xd0bc68});});})[_0x9541('0x2e')](function(){return BPromise[_0x9541('0x77')](_0x5a4865,function(_0x3e5204){return db[_0x9541('0x7a')][_0x9541('0x7b')]({'where':{'UserId':_0x3e5204['id'],'VoiceQueueId':_0x3ac566[_0x9541('0x55')]['id']},'defaults':{'penalty':_0x3e5204[_0x9541('0x7c')]},'transaction':_0xd0bc68});});})[_0x9541('0x2e')](function(){return BPromise[_0x9541('0x77')](_[_0x9541('0x33')](_0x5a4865,{'online':!![]}),function(_0xde3f4b){return db[_0x9541('0x7d')][_0x9541('0x79')]({'membername':_0xde3f4b[_0x9541('0x37')],'UserId':_0xde3f4b['id'],'queue_name':_0x21f5ee[_0x9541('0x37')],'VoiceQueueId':_0x21f5ee['id'],'interface':_[_0x9541('0x7e')](_0xde3f4b[_0x9541('0x73')])?util[_0x9541('0x7f')](_0x9541('0x80'),_0xde3f4b['name']):_0xde3f4b[_0x9541('0x73')],'paused':_0xde3f4b['voicePause']||![],'penalty':_0xde3f4b[_0x9541('0x7c')]},{'transaction':_0xd0bc68});});})[_0x9541('0x2e')](function(){_0x5a4865[_0x9541('0x74')](function(_0x4dcac5){socket[_0x9541('0x81')](_0x9541('0x82'),{'UserId':_0x4dcac5['id'],'VoiceQueueId':_0x21f5ee['id']});});});});});}})[_0x9541('0x2e')](respondWithStatusCode(_0x46b842,null))[_0x9541('0x53')](handleError(_0x46b842,null));};exports[_0x9541('0x83')]=function(_0x18f7b3,_0x5be1c9,_0x4c6b39){return db['Team'][_0x9541('0x52')]({'where':{'id':_0x18f7b3[_0x9541('0x41')][_0x9541('0x84')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9541('0x71'),'attributes':['id'],'raw':!![]}]})[_0x9541('0x2e')](handleEntityNotFound(_0x5be1c9,null))[_0x9541('0x2e')](function(_0x507675){var _0xc29fbd=_[_0x9541('0x3d')](_0x507675,'id');var _0x250ccd=[];var _0x21fa3d=[];var _0x2e79e8=squel[_0x9541('0x85')]();_0x2e79e8[_0x9541('0x86')](_0x9541('0x87'))[_0x9541('0x88')](_0x9541('0x89'),'tq')['join'](_0x9541('0x8a'),'ut',_0x9541('0x8b'))[_0x9541('0x49')]('VoiceQueueId\x20=\x20?',_0x18f7b3[_0x9541('0x55')]['id']);for(var _0x18d1e4=0x0;_0x18d1e4<_0x507675[_0x9541('0x5f')];_0x18d1e4+=0x1){let _0xdfc3e1=_0x507675[_0x18d1e4];for(var _0x59c506=0x0;_0x59c506<_0xdfc3e1[_0x9541('0x71')][_0x9541('0x5f')];_0x59c506+=0x1){let _0x3dbba8=_0xdfc3e1[_0x9541('0x71')][_0x59c506];var _0x54285e=_0x2e79e8[_0x9541('0x8c')]();_0x54285e['where']('ut.UserId\x20=\x20?',_0x3dbba8['id']);_0x21fa3d[_0x9541('0x8d')](db[_0x9541('0x75')][_0x9541('0x41')](_0x54285e[_0x9541('0x8e')](),{'type':db['sequelize'][_0x9541('0x8f')]['SELECT']})['then'](function(_0x22171f){if(_0x22171f[_0x9541('0x5f')]===0x1){return _0x3dbba8['id'];}else{var _0x5ee725=_[_0x9541('0x90')](_[_0x9541('0x3d')](_0x22171f,_0x9541('0x91')),function(_0x54eec9){return _[_0x9541('0x92')](_0xc29fbd,_0x54eec9);});if(_0x5ee725){return _0x3dbba8['id'];}}}));}}return BPromise[_0x9541('0x93')](_0x21fa3d)['then'](function(_0x32e4f6){_0x250ccd=_(_0x250ccd)['union'](_0x32e4f6)[_0x9541('0x94')]()['value']();return db[_0x9541('0x4f')][_0x9541('0x5b')]({'where':{'id':_0x18f7b3[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](function(_0x428d39){return db[_0x9541('0x75')][_0x9541('0x76')](function(_0x206ee7){return _0x428d39['removeTeams'](_0x18f7b3['query']['ids'],{'transaction':_0x206ee7})['then'](function(){if(!_[_0x9541('0x95')](_0x250ccd)){return _0x428d39[_0x9541('0x96')](_0x250ccd,{'transaction':_0x206ee7})[_0x9541('0x2e')](function(){return db[_0x9541('0x7d')][_0x9541('0x2d')]({'where':{'VoiceQueueId':_0x18f7b3[_0x9541('0x55')]['id'],'UserId':_0x250ccd},'transaction':_0x206ee7});});}})['then'](function(){_0x250ccd['forEach'](function(_0x5ce6a0){socket[_0x9541('0x81')]('userVoiceQueue:remove',{'UserId':_0x5ce6a0,'VoiceQueueId':_0x428d39['id']});});});});});});})['then'](respondWithStatusCode(_0x5be1c9,null))['catch'](handleError(_0x5be1c9,null));};exports[_0x9541('0x97')]=function(_0x129c30,_0x49554a,_0x5bf677){var _0x9743b7,_0xb11f72;return db[_0x9541('0x4f')]['find']({'where':{'id':_0x129c30[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x49554a,null))[_0x9541('0x2e')](function(_0x31afe7){if(_0x31afe7){_0xb11f72=_0x31afe7;return _0x31afe7[_0x9541('0x97')](_0x129c30[_0x9541('0x57')][_0x9541('0x84')],_['omit'](_0x129c30[_0x9541('0x57')],[_0x9541('0x84'),'id'])||{})['spread'](function(_0x404dbc){for(var _0x5f5b8a=0x0;_0x5f5b8a<_0x129c30[_0x9541('0x57')][_0x9541('0x84')][_0x9541('0x5f')];_0x5f5b8a+=0x1){socket['emit'](_0x9541('0x82'),{'UserId':Number(_0x129c30[_0x9541('0x57')][_0x9541('0x84')][_0x5f5b8a]),'VoiceQueueId':Number(_0x129c30[_0x9541('0x55')]['id'])});}return _0x404dbc;});}})[_0x9541('0x2e')](function(_0x1c7c37){_0x9743b7=_0x1c7c37||[];if(_0xb11f72){return db[_0x9541('0x70')][_0x9541('0x52')]({'where':{'id':_0x129c30[_0x9541('0x57')][_0x9541('0x84')]},'attributes':['id',_0x9541('0x37'),_0x9541('0x98'),_0x9541('0x72'),'interface'],'raw':!![]});}})['then'](function(_0x402baf){if(!_[_0x9541('0x95')](_0x402baf)){var _0x5b7a53=[];for(var _0xc6b003=0x0;_0xc6b003<_0x402baf[_0x9541('0x5f')];_0xc6b003++){if(_0x402baf[_0xc6b003][_0x9541('0x98')]){_0x5b7a53[_0x9541('0x8d')](db[_0x9541('0x7d')][_0x9541('0x79')]({'membername':_0x402baf[_0xc6b003][_0x9541('0x37')],'UserId':_0x402baf[_0xc6b003]['id'],'queue_name':_0xb11f72[_0x9541('0x37')],'VoiceQueueId':_0xb11f72['id'],'interface':_[_0x9541('0x7e')](_0x402baf[_0xc6b003][_0x9541('0x73')])?util[_0x9541('0x7f')]('SIP/%s',_0x402baf[_0xc6b003][_0x9541('0x37')]):_0x402baf[_0xc6b003][_0x9541('0x73')],'paused':_0x402baf[_0xc6b003]['voicePause']||![],'penalty':_0x129c30[_0x9541('0x57')][_0x9541('0x7c')]||0x0}));}}return BPromise[_0x9541('0x93')](_0x5b7a53);}})[_0x9541('0x2e')](function(){return _0x9743b7;})[_0x9541('0x2e')](respondWithResult(_0x49554a,null))[_0x9541('0x53')](handleError(_0x49554a,null));};exports[_0x9541('0x96')]=function(_0x52b978,_0x26cc9a,_0x566d90){return db[_0x9541('0x4f')][_0x9541('0x5b')]({'where':{'id':_0x52b978[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x26cc9a,null))[_0x9541('0x2e')](function(_0x3f0c1a){if(_0x3f0c1a){return _0x3f0c1a['removeAgents'](_0x52b978[_0x9541('0x41')][_0x9541('0x84')])[_0x9541('0x2e')](function(){if(_[_0x9541('0x99')](_0x52b978[_0x9541('0x41')][_0x9541('0x84')])){for(var _0x5c3385=0x0;_0x5c3385<_0x52b978[_0x9541('0x41')]['ids'][_0x9541('0x5f')];_0x5c3385+=0x1){socket[_0x9541('0x81')](_0x9541('0x9a'),{'UserId':Number(_0x52b978['query'][_0x9541('0x84')][_0x5c3385]),'VoiceQueueId':Number(_0x52b978[_0x9541('0x55')]['id'])});}}else{socket[_0x9541('0x81')](_0x9541('0x9a'),{'UserId':Number(_0x52b978[_0x9541('0x41')][_0x9541('0x84')]),'VoiceQueueId':Number(_0x52b978[_0x9541('0x55')]['id'])});}});}})[_0x9541('0x2e')](function(_0x4b626f){return db[_0x9541('0x7d')][_0x9541('0x2d')]({'where':{'VoiceQueueId':_0x52b978[_0x9541('0x55')]['id'],'UserId':_0x52b978[_0x9541('0x41')]['ids']}})[_0x9541('0x2e')](function(){return _0x4b626f;});})[_0x9541('0x2e')](respondWithStatusCode(_0x26cc9a,null))[_0x9541('0x53')](handleError(_0x26cc9a,null));};exports[_0x9541('0x9b')]=function(_0x3370b0,_0x3a4104,_0xda03b4){var _0x475e7a={};var _0x15dac0={};var _0x6f05de;var _0x36a9e7;return db['VoiceQueue']['findOne']({'where':{'id':_0x3370b0['params']['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x3a4104,null))[_0x9541('0x2e')](function(_0x328803){if(_0x328803){_0x6f05de=_0x328803;_0x15dac0[_0x9541('0x3f')]=_['keys'](db[_0x9541('0x70')][_0x9541('0x3e')]);_0x15dac0[_0x9541('0x41')]=_[_0x9541('0x40')](_0x3370b0[_0x9541('0x41')]);_0x15dac0[_0x9541('0x4a')]=_[_0x9541('0x42')](_0x15dac0[_0x9541('0x3f')],_0x15dac0[_0x9541('0x41')]);_0x475e7a['attributes']=_[_0x9541('0x42')](_0x15dac0[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x3370b0['query'][_0x9541('0x44')]));_0x475e7a[_0x9541('0x43')]=_0x475e7a[_0x9541('0x43')][_0x9541('0x5f')]?_0x475e7a[_0x9541('0x43')]:_0x15dac0[_0x9541('0x3f')];_0x475e7a[_0x9541('0x47')]=qs[_0x9541('0x48')](_0x3370b0[_0x9541('0x41')][_0x9541('0x48')]);_0x475e7a['where']=qs[_0x9541('0x4a')](_[_0x9541('0x4b')](_0x3370b0[_0x9541('0x41')],_0x15dac0['filters']));if(_0x3370b0[_0x9541('0x41')]['filter']){_0x475e7a[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x475e7a[_0x9541('0x49')],{'$or':_[_0x9541('0x3d')](_0x475e7a['attributes'],function(_0x8a34b1){var _0x26b43e={};_0x26b43e[_0x8a34b1]={'$like':'%'+_0x3370b0[_0x9541('0x41')][_0x9541('0x33')]+'%'};return _0x26b43e;})});}_0x475e7a=_[_0x9541('0x4c')]({},_0x475e7a,_0x3370b0['options']);return _0x6f05de[_0x9541('0x9b')](_0x475e7a);}})[_0x9541('0x2e')](function(_0x29b134){if(_0x29b134){_0x36a9e7=_0x29b134[_0x9541('0x5f')];if(!_0x3370b0[_0x9541('0x41')][_0x9541('0x45')]('nolimit')){_0x475e7a[_0x9541('0x23')]=qs['limit'](_0x3370b0[_0x9541('0x41')][_0x9541('0x23')]);_0x475e7a[_0x9541('0x25')]=qs['offset'](_0x3370b0[_0x9541('0x41')]['offset']);}return _0x6f05de[_0x9541('0x9b')](_0x475e7a);}})['then'](function(_0x2934eb){if(_0x2934eb){return _0x2934eb?{'count':_0x36a9e7,'rows':_0x2934eb}:null;}})['then'](respondWithResult(_0x3a4104,null))['catch'](handleError(_0x3a4104,null));};exports[_0x9541('0x9c')]=function(_0x489f14,_0x57879f,_0x4c40dd){var _0x48f0e5={};var _0x9b688c={};var _0x6997d6;var _0xf18aee;return db['VoiceQueue'][_0x9541('0x65')]({'where':{'id':_0x489f14[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x57879f,null))['then'](function(_0x3b420c){if(_0x3b420c){_0x6997d6=_0x3b420c;_0x9b688c[_0x9541('0x3f')]=_['keys'](db['UserVoiceQueueRt'][_0x9541('0x3e')]);_0x9b688c[_0x9541('0x41')]=_[_0x9541('0x40')](_0x489f14[_0x9541('0x41')]);_0x9b688c[_0x9541('0x4a')]=_[_0x9541('0x42')](_0x9b688c[_0x9541('0x3f')],_0x9b688c['query']);_0x48f0e5[_0x9541('0x43')]=_[_0x9541('0x42')](_0x9b688c['model'],qs[_0x9541('0x44')](_0x489f14['query'][_0x9541('0x44')]));_0x48f0e5[_0x9541('0x43')]=_0x48f0e5[_0x9541('0x43')][_0x9541('0x5f')]?_0x48f0e5[_0x9541('0x43')]:_0x9b688c[_0x9541('0x3f')];_0x48f0e5[_0x9541('0x47')]=qs[_0x9541('0x48')](_0x489f14[_0x9541('0x41')][_0x9541('0x48')]);_0x48f0e5[_0x9541('0x49')]=qs[_0x9541('0x4a')](_[_0x9541('0x4b')](_0x489f14[_0x9541('0x41')],_0x9b688c[_0x9541('0x4a')]));if(_0x489f14['query'][_0x9541('0x33')]){_0x48f0e5[_0x9541('0x49')]=_[_0x9541('0x4c')](_0x48f0e5[_0x9541('0x49')],{'$or':_[_0x9541('0x3d')](_0x48f0e5[_0x9541('0x43')],function(_0x4095c9){var _0x470eb3={};_0x470eb3[_0x4095c9]={'$like':'%'+_0x489f14['query'][_0x9541('0x33')]+'%'};return _0x470eb3;})});}_0x48f0e5=_[_0x9541('0x4c')]({},_0x48f0e5,_0x489f14[_0x9541('0x4e')]);return _0x6997d6[_0x9541('0x9c')](_0x48f0e5);}})[_0x9541('0x2e')](function(_0x3cc5c7){if(_0x3cc5c7){_0xf18aee=_0x3cc5c7[_0x9541('0x5f')];if(!_0x489f14[_0x9541('0x41')]['hasOwnProperty']('nolimit')){_0x48f0e5[_0x9541('0x23')]=qs[_0x9541('0x23')](_0x489f14[_0x9541('0x41')]['limit']);_0x48f0e5[_0x9541('0x25')]=qs[_0x9541('0x25')](_0x489f14['query'][_0x9541('0x25')]);}return _0x6997d6[_0x9541('0x9c')](_0x48f0e5);}})[_0x9541('0x2e')](function(_0x495135){return _0x495135?{'count':_0xf18aee,'rows':_0x495135}:null;})[_0x9541('0x2e')](respondWithResult(_0x57879f,null))['catch'](handleError(_0x57879f,null));};exports[_0x9541('0x9d')]=function(_0x30ce51,_0x8f6a57,_0x211fff){var _0x532df5={};var _0xc25c83={};var _0x4d1ef8;var _0x4669f5;return db[_0x9541('0x4f')][_0x9541('0x65')]({'where':{'id':_0x30ce51[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x8f6a57,null))[_0x9541('0x2e')](function(_0x270109){if(_0x270109){_0x4d1ef8=_0x270109;_0xc25c83['model']=_[_0x9541('0x40')](db['CmList'][_0x9541('0x3e')]);_0xc25c83[_0x9541('0x41')]=_[_0x9541('0x40')](_0x30ce51[_0x9541('0x41')]);_0xc25c83['filters']=_['intersection'](_0xc25c83[_0x9541('0x3f')],_0xc25c83[_0x9541('0x41')]);_0x532df5[_0x9541('0x43')]=_['intersection'](_0xc25c83[_0x9541('0x3f')],qs['fields'](_0x30ce51['query']['fields']));_0x532df5['attributes']=_0x532df5[_0x9541('0x43')][_0x9541('0x5f')]?_0x532df5['attributes']:_0xc25c83[_0x9541('0x3f')];_0x532df5['order']=qs['sort'](_0x30ce51[_0x9541('0x41')]['sort']);_0x532df5['where']=qs['filters'](_[_0x9541('0x4b')](_0x30ce51['query'],_0xc25c83[_0x9541('0x4a')]));if(_0x30ce51[_0x9541('0x41')][_0x9541('0x33')]){_0x532df5['where']=_['merge'](_0x532df5[_0x9541('0x49')],{'$or':_[_0x9541('0x3d')](_0x532df5[_0x9541('0x43')],function(_0x5d161b){var _0x2dec8f={};_0x2dec8f[_0x5d161b]={'$like':'%'+_0x30ce51[_0x9541('0x41')][_0x9541('0x33')]+'%'};return _0x2dec8f;})});}_0x532df5=_[_0x9541('0x4c')]({},_0x532df5,_0x30ce51[_0x9541('0x4e')]);return _0x4d1ef8['getLists'](_0x532df5);}})['then'](function(_0xa0c39b){if(_0xa0c39b){_0x4669f5=_0xa0c39b[_0x9541('0x5f')];if(!_0x30ce51[_0x9541('0x41')]['hasOwnProperty'](_0x9541('0x46'))){_0x532df5['limit']=qs[_0x9541('0x23')](_0x30ce51[_0x9541('0x41')][_0x9541('0x23')]);_0x532df5[_0x9541('0x25')]=qs[_0x9541('0x25')](_0x30ce51['query'][_0x9541('0x25')]);}return _0x4d1ef8[_0x9541('0x9d')](_0x532df5);}})[_0x9541('0x2e')](function(_0x2c8686){if(_0x2c8686){return _0x2c8686?{'count':_0x4669f5,'rows':_0x2c8686}:null;}})[_0x9541('0x2e')](respondWithResult(_0x8f6a57,null))[_0x9541('0x53')](handleError(_0x8f6a57,null));};exports[_0x9541('0x9e')]=function(_0x3b9ac7,_0x276c5d,_0x48525b){var _0x9db09e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x2d870a,_0xb2bd77;return db[_0x9541('0x4f')][_0x9541('0x5b')]({'where':{'id':_0x3b9ac7[_0x9541('0x55')]['id']}})['then'](handleEntityNotFound(_0x276c5d,null))[_0x9541('0x2e')](function(_0x49932e){if(_0x49932e){_0xb2bd77=_0x49932e;return _0x49932e[_0x9541('0x9e')](_0x3b9ac7[_0x9541('0x57')][_0x9541('0x84')],_['omit'](_0x3b9ac7[_0x9541('0x57')],[_0x9541('0x84'),'id'])||{});}return null;})[_0x9541('0x9f')](function(_0x2cbcbc){var _0x3c16e0;_0x2d870a=_0x2cbcbc||[];var _0x2307b2=[];if(_0x2cbcbc){for(var _0x2365b2=0x0;_0x2365b2<_0x2cbcbc['length'];_0x2365b2+=0x1){var _0x160abe=_0x2cbcbc[_0x2365b2][_0x9541('0x2f')]({'plain':!![]});_0xb2bd77['dialCheckDuplicateType']=_0x3b9ac7[_0x9541('0x57')][_0x9541('0xa0')]?_0x3b9ac7['body']['dialCheckDuplicateType']:_0xb2bd77['dialCheckDuplicateType'];switch(_0xb2bd77[_0x9541('0xa0')]){case _0x9541('0xa1'):_0x3c16e0=squel['insert']()[_0x9541('0xa2')](_0x9541('0xa3'))['fromQuery'](['phone',_0x9541('0xa4'),_0x9541('0xa5'),_0x9541('0xa6'),'VoiceQueueId',_0x9541('0x61'),_0x9541('0x62')],squel['select']()[_0x9541('0x86')]('phone',_0x9541('0xa7'))['field']('\x27'+_0x9db09e+'\x27',_0x9541('0xa4'))[_0x9541('0x86')]('id',_0x9541('0xa5'))[_0x9541('0x86')](_0x160abe[_0x9541('0xa8')][_0x9541('0x8e')](),'ListId')[_0x9541('0x86')](_0x3b9ac7[_0x9541('0x55')]['id'][_0x9541('0x8e')](),_0x9541('0x66'))[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27','createdAt')[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27',_0x9541('0x62'))[_0x9541('0x88')](_0x9541('0xa9'))[_0x9541('0x49')](_0x9541('0xaa'))[_0x9541('0x49')](_0x9541('0xab'),_0x160abe['CmListId'][_0x9541('0x8e')]())[_0x9541('0x49')](_0x9541('0xac'))[_0x9541('0x49')](_0x9541('0xad'),squel[_0x9541('0x85')]()[_0x9541('0x86')](_0x9541('0xae'))[_0x9541('0x88')](_0x9541('0xaf'))[_0x9541('0x49')](_0x9541('0xb0'),_0x3b9ac7['params']['id']['toString']()))[_0x9541('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9541('0x85')]()[_0x9541('0x86')](_0x9541('0xb1'))[_0x9541('0x88')]('cm_hopper')[_0x9541('0x49')](_0x9541('0xb0'),_0x3b9ac7[_0x9541('0x55')]['id'][_0x9541('0x8e')]())))[_0x9541('0x8e')]();break;case _0x9541('0xb2'):_0x3c16e0=squel[_0x9541('0xb3')]()[_0x9541('0xa2')](_0x9541('0xa3'))[_0x9541('0xb4')]([_0x9541('0xa7'),_0x9541('0xa4'),_0x9541('0xa5'),'ListId',_0x9541('0x66'),_0x9541('0x61'),_0x9541('0x62')],squel[_0x9541('0x85')]()[_0x9541('0x86')]('phone','phone')[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27',_0x9541('0xa4'))['field']('id','ContactId')[_0x9541('0x86')](_0x160abe[_0x9541('0xa8')]['toString'](),'ListId')['field'](_0x3b9ac7[_0x9541('0x55')]['id']['toString'](),_0x9541('0x66'))['field']('\x27'+_0x9db09e+'\x27',_0x9541('0x61'))[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27',_0x9541('0x62'))[_0x9541('0x88')](_0x9541('0xa9'))[_0x9541('0x49')]('deletedAt\x20IS\x20NULL')[_0x9541('0x49')](_0x9541('0xab'),_0x160abe['CmListId']['toString']())[_0x9541('0x49')](_0x9541('0xac'))[_0x9541('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0x9541('0x85')]()[_0x9541('0x86')](_0x9541('0xb1'))[_0x9541('0x88')](_0x9541('0xa3'))[_0x9541('0x49')](_0x9541('0xb0'),_0x3b9ac7[_0x9541('0x55')]['id'][_0x9541('0x8e')]())))[_0x9541('0x8e')]();break;default:_0x3c16e0=squel[_0x9541('0xb3')]()[_0x9541('0xa2')](_0x9541('0xa3'))['fromQuery']([_0x9541('0xa7'),_0x9541('0xa4'),_0x9541('0xa5'),_0x9541('0xa6'),_0x9541('0x66'),_0x9541('0x61'),_0x9541('0x62')],squel[_0x9541('0x85')]()['field'](_0x9541('0xa7'),_0x9541('0xa7'))['field']('\x27'+_0x9db09e+'\x27',_0x9541('0xa4'))[_0x9541('0x86')]('id',_0x9541('0xa5'))[_0x9541('0x86')](_0x160abe[_0x9541('0xa8')][_0x9541('0x8e')](),_0x9541('0xa6'))['field'](_0x3b9ac7[_0x9541('0x55')]['id']['toString'](),_0x9541('0x66'))[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27',_0x9541('0x61'))[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27',_0x9541('0x62'))['from'](_0x9541('0xa9'))['where']('deletedAt\x20IS\x20NULL')[_0x9541('0x49')](_0x9541('0xab'),_0x160abe[_0x9541('0xa8')][_0x9541('0x8e')]())[_0x9541('0x49')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x2307b2['push'](db['sequelize'][_0x9541('0x41')](_0x3c16e0));}return BPromise[_0x9541('0x93')](_0x2307b2);}})[_0x9541('0x2e')](function(){var _0xa44561=[];var _0x1e9616=squel['insert']()[_0x9541('0xa2')](_0x9541('0xb5'))['fromQuery']([_0x9541('0xb6'),'phone',_0x9541('0xb7'),'createdAt','updatedAt'],squel['select']()[_0x9541('0x86')](_0x9541('0xb8'))[_0x9541('0x86')](_0x9541('0xb9'))[_0x9541('0x86')](_0x9541('0xba'))[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27',_0x9541('0x61'))[_0x9541('0x86')]('\x27'+_0x9db09e+'\x27','updatedAt')[_0x9541('0x88')]('cm_contact_has_items','ci')[_0x9541('0xbb')](_0x9541('0xa3'),'h',_0x9541('0xbc'))[_0x9541('0x49')](_0x9541('0xbd'),_0x9db09e)[_0x9541('0x49')](_0x9541('0xbe'),_0x9541('0xbf')))[_0x9541('0x8e')]();_0xa44561[_0x9541('0x8d')](db[_0x9541('0x75')][_0x9541('0x41')](_0x1e9616));return BPromise[_0x9541('0x93')](_0xa44561);})[_0x9541('0x2e')](function(){return _0x2d870a;})[_0x9541('0x2e')](respondWithResult(_0x276c5d,null))[_0x9541('0x53')](handleError(_0x276c5d,null));};exports['removeLists']=function(_0x2e29d4,_0x443262,_0x34bbac){return db[_0x9541('0x4f')][_0x9541('0x5b')]({'where':{'id':_0x2e29d4[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x443262,null))[_0x9541('0x2e')](function(_0x19f82b){if(_0x19f82b){return _0x19f82b[_0x9541('0xc0')](_0x2e29d4['query'][_0x9541('0x84')]);}})[_0x9541('0x2e')](function(_0x3c0917){if(_0x3c0917){return db[_0x9541('0x67')][_0x9541('0x2d')]({'where':{'ListId':_0x2e29d4[_0x9541('0x41')][_0x9541('0x84')],'VoiceQueueId':_0x2e29d4[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](function(){return _0x3c0917;});}})[_0x9541('0x2e')](respondWithStatusCode(_0x443262,null))['catch'](handleError(_0x443262,null));};exports['getBlackLists']=function(_0x5ed08c,_0x993f72,_0x211f45){var _0x4c55ff={};var _0x48fb26={};var _0x1069b2;var _0x206e7b;return db['VoiceQueue']['findOne']({'where':{'id':_0x5ed08c[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](handleEntityNotFound(_0x993f72,null))[_0x9541('0x2e')](function(_0x23b974){if(_0x23b974){_0x1069b2=_0x23b974;_0x48fb26[_0x9541('0x3f')]=_[_0x9541('0x40')](db[_0x9541('0xc1')][_0x9541('0x3e')]);_0x48fb26['query']=_[_0x9541('0x40')](_0x5ed08c['query']);_0x48fb26[_0x9541('0x4a')]=_['intersection'](_0x48fb26[_0x9541('0x3f')],_0x48fb26['query']);_0x4c55ff['attributes']=_[_0x9541('0x42')](_0x48fb26[_0x9541('0x3f')],qs[_0x9541('0x44')](_0x5ed08c['query']['fields']));_0x4c55ff[_0x9541('0x43')]=_0x4c55ff[_0x9541('0x43')]['length']?_0x4c55ff['attributes']:_0x48fb26[_0x9541('0x3f')];_0x4c55ff[_0x9541('0x47')]=qs['sort'](_0x5ed08c[_0x9541('0x41')][_0x9541('0x48')]);_0x4c55ff[_0x9541('0x49')]=qs[_0x9541('0x4a')](_[_0x9541('0x4b')](_0x5ed08c[_0x9541('0x41')],_0x48fb26[_0x9541('0x4a')]));if(_0x5ed08c['query'][_0x9541('0x33')]){_0x4c55ff[_0x9541('0x49')]=_['merge'](_0x4c55ff[_0x9541('0x49')],{'$or':_[_0x9541('0x3d')](_0x4c55ff[_0x9541('0x43')],function(_0x30586f){var _0x52435f={};_0x52435f[_0x30586f]={'$like':'%'+_0x5ed08c[_0x9541('0x41')][_0x9541('0x33')]+'%'};return _0x52435f;})});}_0x4c55ff=_[_0x9541('0x4c')]({},_0x4c55ff,_0x5ed08c[_0x9541('0x4e')]);return _0x1069b2[_0x9541('0xc2')](_0x4c55ff);}})['then'](function(_0x560650){if(_0x560650){_0x206e7b=_0x560650[_0x9541('0x5f')];if(!_0x5ed08c[_0x9541('0x41')][_0x9541('0x45')](_0x9541('0x46'))){_0x4c55ff['limit']=qs[_0x9541('0x23')](_0x5ed08c['query'][_0x9541('0x23')]);_0x4c55ff['offset']=qs[_0x9541('0x25')](_0x5ed08c[_0x9541('0x41')]['offset']);}return _0x1069b2['getBlackLists'](_0x4c55ff);}})[_0x9541('0x2e')](function(_0x21584a){if(_0x21584a){return _0x21584a?{'count':_0x206e7b,'rows':_0x21584a}:null;}})[_0x9541('0x2e')](respondWithResult(_0x993f72,null))[_0x9541('0x53')](handleError(_0x993f72,null));};exports[_0x9541('0xc3')]=function(_0x25da7f,_0x143796,_0x85ab6f){var _0xc48bda,_0x17db8b;return db[_0x9541('0x4f')][_0x9541('0x5b')]({'where':{'id':_0x25da7f[_0x9541('0x55')]['id']}})['then'](handleEntityNotFound(_0x143796,null))[_0x9541('0x2e')](function(_0x3b233c){if(_0x3b233c){_0x17db8b=_0x3b233c;return _0x3b233c[_0x9541('0xc3')](_0x25da7f[_0x9541('0x57')][_0x9541('0x84')],_[_0x9541('0x60')](_0x25da7f[_0x9541('0x57')],[_0x9541('0x84'),'id'])||{});}return null;})[_0x9541('0x9f')](function(_0x32fd2e){var _0x4e6cf7;_0xc48bda=_0x32fd2e||[];var _0x37bed3=[];if(_0x32fd2e){for(var _0x938110=0x0;_0x938110<_0x32fd2e['length'];_0x938110+=0x1){var _0x4b3761=_0x32fd2e[_0x938110]['get']({'plain':!![]});_0x4e6cf7=squel[_0x9541('0xb3')]()[_0x9541('0xa2')](_0x9541('0xc4'))['fromQuery']([_0x9541('0xa7'),'ContactId',_0x9541('0xa6'),_0x9541('0x66'),'createdAt',_0x9541('0x62')],squel[_0x9541('0x85')]()[_0x9541('0x86')](_0x9541('0xa7'),'phone')[_0x9541('0x86')]('id','ContactId')[_0x9541('0x86')](_0x4b3761[_0x9541('0xa8')][_0x9541('0x8e')](),_0x9541('0xa6'))[_0x9541('0x86')](_0x25da7f[_0x9541('0x55')]['id'][_0x9541('0x8e')](),_0x9541('0x66'))[_0x9541('0x86')](_0x9541('0xc5'),_0x9541('0x61'))[_0x9541('0x86')](_0x9541('0xc5'),_0x9541('0x62'))[_0x9541('0x88')](_0x9541('0xa9'))['where'](_0x9541('0xaa'))[_0x9541('0x49')](_0x9541('0xab'),_0x4b3761[_0x9541('0xa8')][_0x9541('0x8e')]())[_0x9541('0x49')](_0x9541('0xac')))[_0x9541('0x8e')]();_0x37bed3[_0x9541('0x8d')](db[_0x9541('0x75')][_0x9541('0x41')](_0x4e6cf7));}return BPromise[_0x9541('0x93')](_0x37bed3);}})[_0x9541('0x2e')](function(){return _0xc48bda;})[_0x9541('0x2e')](respondWithResult(_0x143796,null))[_0x9541('0x53')](handleError(_0x143796,null));};exports[_0x9541('0xc6')]=function(_0x3321a2,_0x1a5dee,_0x284341){return db[_0x9541('0x4f')][_0x9541('0x5b')]({'where':{'id':_0x3321a2[_0x9541('0x55')]['id']}})['then'](handleEntityNotFound(_0x1a5dee,null))[_0x9541('0x2e')](function(_0x4d525b){if(_0x4d525b){return _0x4d525b['removeBlackLists'](_0x3321a2[_0x9541('0x41')][_0x9541('0x84')]);}})[_0x9541('0x2e')](function(_0x58c0ae){if(_0x58c0ae){return db['CmHopperBlack'][_0x9541('0x2d')]({'where':{'ListId':_0x3321a2[_0x9541('0x41')]['ids'],'VoiceQueueId':_0x3321a2[_0x9541('0x55')]['id']}})[_0x9541('0x2e')](function(){return _0x58c0ae;});}})[_0x9541('0x2e')](respondWithStatusCode(_0x1a5dee,null))[_0x9541('0x53')](handleError(_0x1a5dee,null));}; \ No newline at end of file +var _0x7c09=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','toString','every','TeamId','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ListId','field','ContactId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','cm_contacts','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','h.ContactId=ci.CmContactId','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','UserProfileResource','error','stack','name','send','index','VoiceQueue','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','update','getHoppers','findOne','CmHopper','VoiceQueueId','options','getHopperHistories','CmHopperHistory','hasOwnProperty','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','Team','User','Agents','online','voicePause','interface','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','from','team_has_voice_queues','join'];(function(_0x5e5c27,_0x401fdb){var _0x2b7e1c=function(_0x552db5){while(--_0x552db5){_0x5e5c27['push'](_0x5e5c27['shift']());}};_0x2b7e1c(++_0x401fdb);}(_0x7c09,0x102));var _0x97c0=function(_0x53d645,_0x32d721){_0x53d645=_0x53d645-0x0;var _0x3cfbba=_0x7c09[_0x53d645];return _0x3cfbba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97c0('0x0'));var zipdir=require(_0x97c0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97c0('0x2'));var moment=require(_0x97c0('0x3'));var BPromise=require(_0x97c0('0x4'));var Mustache=require(_0x97c0('0x5'));var util=require(_0x97c0('0x6'));var path=require(_0x97c0('0x7'));var sox=require(_0x97c0('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var licenseUtil=require(_0x97c0('0x16'));var db=require(_0x97c0('0x17'))['db'];config[_0x97c0('0x18')]=_[_0x97c0('0x19')](config[_0x97c0('0x18')],{'host':_0x97c0('0x1a'),'port':0x18eb});var socket=require(_0x97c0('0x1b'))(new Redis(config[_0x97c0('0x18')]));require('./voiceQueue.socket')[_0x97c0('0x1c')](socket);function respondWithStatusCode(_0x15b336,_0xcac10b){_0xcac10b=_0xcac10b||0xcc;return function(_0x496017){if(_0x496017){return _0x15b336[_0x97c0('0x1d')](_0xcac10b);}return _0x15b336[_0x97c0('0x1e')](_0xcac10b)[_0x97c0('0x1f')]();};}function respondWithResult(_0x21e5f7,_0x482be5){_0x482be5=_0x482be5||0xc8;return function(_0x13d46e){if(_0x13d46e){return _0x21e5f7['status'](_0x482be5)[_0x97c0('0x20')](_0x13d46e);}};}function respondWithFilteredResult(_0x3ae7c4,_0x51180e){return function(_0x560ac0){if(_0x560ac0){var _0x16918b=typeof _0x51180e[_0x97c0('0x21')]===_0x97c0('0x22')&&typeof _0x51180e[_0x97c0('0x23')]===_0x97c0('0x22');var _0x4fed42=_0x560ac0[_0x97c0('0x24')];var _0x432705=_0x16918b?0x0:_0x51180e[_0x97c0('0x21')];var _0x4ca20a=_0x16918b?_0x560ac0['count']:_0x51180e[_0x97c0('0x21')]+_0x51180e[_0x97c0('0x23')];var _0x169f19;if(_0x4ca20a>=_0x4fed42){_0x4ca20a=_0x4fed42;_0x169f19=0xc8;}else{_0x169f19=0xce;}_0x3ae7c4['status'](_0x169f19);return _0x3ae7c4[_0x97c0('0x25')](_0x97c0('0x26'),_0x432705+'-'+_0x4ca20a+'/'+_0x4fed42)[_0x97c0('0x20')](_0x560ac0);}return null;};}function patchUpdates(_0x272314){return function(_0x30fba2){try{jsonpatch[_0x97c0('0x27')](_0x30fba2,_0x272314,!![]);}catch(_0x9dff60){return BPromise['reject'](_0x9dff60);}return _0x30fba2[_0x97c0('0x28')]();};}function saveUpdates(_0x29b3aa,_0x1f7adb){return function(_0x216785){if(_0x216785){return _0x216785['update'](_0x29b3aa)[_0x97c0('0x29')](function(_0x14cada){return _0x14cada;});}return null;};}function removeEntity(_0x52a429,_0x2ec9d6){return function(_0x2bb908){if(_0x2bb908){return _0x2bb908[_0x97c0('0x2a')]()['then'](function(){var _0x4f11ba=_0x2bb908['get']({'plain':!![]});var _0x11b8ad=[{'name':_0x97c0('0x2b'),'value':_0x97c0('0x2c'),'ignore':![]},{'name':_0x97c0('0x2d'),'value':_0x97c0('0x2e'),'ignore':![]}];var _0x153b14=_(_0x11b8ad)['filter'](_0x97c0('0x2f'))[_0x97c0('0x30')](_0x97c0('0x31'))['value']();if(_[_0x97c0('0x32')](_0x153b14,_0x4f11ba[_0x97c0('0x33')])){return;}var _0x21ba0d=_[_0x97c0('0x34')](_0x11b8ad,[_0x97c0('0x31'),_0x4f11ba['type']])['name'];return db[_0x97c0('0x35')][_0x97c0('0x2a')]({'where':{'type':_0x21ba0d,'resourceId':_0x4f11ba['id']}})[_0x97c0('0x29')](function(){return _0x2bb908;});})['then'](function(){_0x52a429[_0x97c0('0x1e')](0xcc)[_0x97c0('0x1f')]();});}};}function handleEntityNotFound(_0x52bdfe,_0x30147b){return function(_0x22833e){if(!_0x22833e){_0x52bdfe[_0x97c0('0x1d')](0x194);}return _0x22833e;};}function handleError(_0x10015b,_0x28ed7d){_0x28ed7d=_0x28ed7d||0x1f4;return function(_0x2aa05b){logger[_0x97c0('0x36')](_0x2aa05b[_0x97c0('0x37')]);if(_0x2aa05b[_0x97c0('0x38')]){delete _0x2aa05b[_0x97c0('0x38')];}_0x10015b[_0x97c0('0x1e')](_0x28ed7d)[_0x97c0('0x39')](_0x2aa05b);};}exports[_0x97c0('0x3a')]=function(_0x11485f,_0x287739){var _0x566c10={},_0x292560={},_0x1548b6={'count':0x0,'rows':[]};var _0x2b7f9a=_[_0x97c0('0x30')](db[_0x97c0('0x3b')][_0x97c0('0x3c')],function(_0x40a780){return{'name':_0x40a780[_0x97c0('0x3d')],'type':_0x40a780['type'][_0x97c0('0x3e')]};});_0x292560['model']=_[_0x97c0('0x30')](_0x2b7f9a,_0x97c0('0x38'));_0x292560[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x11485f[_0x97c0('0x3f')]);_0x292560[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x292560[_0x97c0('0x43')],_0x292560[_0x97c0('0x3f')]);_0x566c10[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x292560['model'],qs[_0x97c0('0x45')](_0x11485f[_0x97c0('0x3f')]['fields']));_0x566c10[_0x97c0('0x44')]=_0x566c10[_0x97c0('0x44')][_0x97c0('0x46')]?_0x566c10[_0x97c0('0x44')]:_0x292560['model'];if(!_0x11485f[_0x97c0('0x3f')]['hasOwnProperty'](_0x97c0('0x47'))){_0x566c10[_0x97c0('0x23')]=qs['limit'](_0x11485f[_0x97c0('0x3f')][_0x97c0('0x23')]);_0x566c10[_0x97c0('0x21')]=qs[_0x97c0('0x21')](_0x11485f[_0x97c0('0x3f')][_0x97c0('0x21')]);}_0x566c10[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x11485f[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x566c10[_0x97c0('0x4a')]=qs[_0x97c0('0x41')](_[_0x97c0('0x4b')](_0x11485f['query'],_0x292560[_0x97c0('0x41')]),_0x2b7f9a);if(_0x11485f[_0x97c0('0x3f')][_0x97c0('0x4c')]){_0x566c10[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x566c10[_0x97c0('0x4a')],{'$or':_[_0x97c0('0x30')](_0x2b7f9a,function(_0x5157c9){if(_0x5157c9['type']!==_0x97c0('0x4e')){var _0x3785a8={};_0x3785a8[_0x5157c9[_0x97c0('0x38')]]={'$like':'%'+_0x11485f[_0x97c0('0x3f')][_0x97c0('0x4c')]+'%'};return _0x3785a8;}})});}_0x566c10=_['merge']({},_0x566c10,_0x11485f['options']);var _0x4874b0={'where':_0x566c10[_0x97c0('0x4a')]};return db['VoiceQueue']['count'](_0x4874b0)[_0x97c0('0x29')](function(_0x2d3604){_0x1548b6[_0x97c0('0x24')]=_0x2d3604;if(_0x11485f[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x566c10['include']=[{'all':!![]}];}return db[_0x97c0('0x3b')][_0x97c0('0x50')](_0x566c10);})[_0x97c0('0x29')](function(_0x10a8ea){_0x1548b6[_0x97c0('0x51')]=_0x10a8ea;return _0x1548b6;})[_0x97c0('0x29')](respondWithFilteredResult(_0x287739,_0x566c10))[_0x97c0('0x52')](handleError(_0x287739,null));};exports[_0x97c0('0x53')]=function(_0x2c50ff,_0x8a952c){var _0x4b1a6e={'raw':![],'where':{'id':_0x2c50ff[_0x97c0('0x54')]['id']}},_0x278904={};_0x278904[_0x97c0('0x43')]=_[_0x97c0('0x40')](db['VoiceQueue']['rawAttributes']);_0x278904[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x2c50ff[_0x97c0('0x3f')]);_0x278904['filters']=_[_0x97c0('0x42')](_0x278904[_0x97c0('0x43')],_0x278904[_0x97c0('0x3f')]);_0x4b1a6e[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x278904['model'],qs[_0x97c0('0x45')](_0x2c50ff[_0x97c0('0x3f')][_0x97c0('0x45')]));_0x4b1a6e['attributes']=_0x4b1a6e['attributes'][_0x97c0('0x46')]?_0x4b1a6e['attributes']:_0x278904['model'];if(_0x2c50ff[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x4b1a6e[_0x97c0('0x55')]=[{'all':!![]}];}_0x4b1a6e=_['merge']({},_0x4b1a6e,_0x2c50ff['options']);return db['VoiceQueue'][_0x97c0('0x34')](_0x4b1a6e)[_0x97c0('0x29')](handleEntityNotFound(_0x8a952c,null))[_0x97c0('0x29')](respondWithResult(_0x8a952c,null))[_0x97c0('0x52')](handleError(_0x8a952c,null));};exports[_0x97c0('0x56')]=function(_0x3c4c82,_0x242a84){return db['VoiceQueue'][_0x97c0('0x56')](_0x3c4c82[_0x97c0('0x57')],{})[_0x97c0('0x29')](function(_0x31e90a){var _0x426947=_0x3c4c82[_0x97c0('0x58')]['get']({'plain':!![]});if(!_0x426947)throw new Error(_0x97c0('0x59'));if(_0x426947[_0x97c0('0x5a')]==='user'){var _0x245f2a=_0x31e90a[_0x97c0('0x5b')]({'plain':!![]});var _0xa84af8=[{'name':_0x97c0('0x2b'),'value':_0x97c0('0x2c')},{'name':_0x97c0('0x2d'),'value':_0x97c0('0x2e')}];var _0x4e2cec=_[_0x97c0('0x34')](_0xa84af8,[_0x97c0('0x31'),_0x245f2a[_0x97c0('0x33')]])[_0x97c0('0x38')];return db[_0x97c0('0x5c')][_0x97c0('0x34')]({'where':{'name':_0x4e2cec,'userProfileId':_0x426947[_0x97c0('0x5d')]},'raw':!![]})[_0x97c0('0x29')](function(_0x11780e){if(_0x11780e&&_0x11780e[_0x97c0('0x5e')]===0x0){return db[_0x97c0('0x35')][_0x97c0('0x56')]({'name':_0x245f2a[_0x97c0('0x38')],'resourceId':_0x245f2a['id'],'type':_0x11780e['name'],'sectionId':_0x11780e['id']},{})[_0x97c0('0x29')](function(){return _0x31e90a;});}else{return _0x31e90a;}})[_0x97c0('0x52')](function(_0x405cda){logger[_0x97c0('0x36')](_0x97c0('0x5f'),_0x405cda);throw _0x405cda;});}return _0x31e90a;})[_0x97c0('0x29')](respondWithResult(_0x242a84,0xc9))['catch'](handleError(_0x242a84,null));};exports[_0x97c0('0x60')]=function(_0x1ad855,_0x5f3803){var _0x2813e8={'where':{'id':_0x1ad855[_0x97c0('0x54')]['id']}},_0x3c9f09={};_0x3c9f09['model']=_[_0x97c0('0x40')](db['VoiceQueue'][_0x97c0('0x3c')]);_0x2813e8[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x3c9f09[_0x97c0('0x43')],qs[_0x97c0('0x45')](_0x1ad855[_0x97c0('0x3f')][_0x97c0('0x45')]));_0x2813e8[_0x97c0('0x44')]=_0x2813e8[_0x97c0('0x44')][_0x97c0('0x46')]?_0x2813e8[_0x97c0('0x44')]:_0x3c9f09['model'];if(_0x1ad855[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x2813e8[_0x97c0('0x55')]=[{'all':!![]}];}_0x2813e8=_[_0x97c0('0x4d')]({},_0x2813e8,_0x1ad855['options']);return db[_0x97c0('0x3b')][_0x97c0('0x34')](_0x2813e8)[_0x97c0('0x29')](handleEntityNotFound(_0x5f3803,null))[_0x97c0('0x29')](function(_0x51bd32){if(_0x51bd32){var _0x32881c=_0x51bd32[_0x97c0('0x5b')]({'plain':!![]});_0x32881c=qs[_0x97c0('0x61')](_0x32881c,['id','createdAt',_0x97c0('0x62')]);_0x1ad855[_0x97c0('0x57')]=_[_0x97c0('0x61')](_0x1ad855[_0x97c0('0x57')],['id',_0x97c0('0x63'),_0x97c0('0x62')]);return db[_0x97c0('0x3b')]['create'](_['merge'](_0x32881c,_0x1ad855[_0x97c0('0x57')]),{'include':_0x1ad855[_0x97c0('0x3f')]['includeAll']?[{'all':!![]}]:undefined})[_0x97c0('0x29')](function(_0x5a4738){var _0x5dc808=_0x1ad855[_0x97c0('0x58')]['get']({'plain':!![]});if(!_0x5dc808)throw new Error(_0x97c0('0x59'));if(_0x5dc808[_0x97c0('0x5a')]==='user'){var _0x496336=_0x5a4738['get']({'plain':!![]});var _0x3186b9=[{'name':'VoiceQueues','value':_0x97c0('0x2c')},{'name':_0x97c0('0x2d'),'value':_0x97c0('0x2e')}];var _0x26bed6=_[_0x97c0('0x34')](_0x3186b9,[_0x97c0('0x31'),_0x496336[_0x97c0('0x33')]])[_0x97c0('0x38')];return db[_0x97c0('0x5c')][_0x97c0('0x34')]({'where':{'name':_0x26bed6,'userProfileId':_0x5dc808[_0x97c0('0x5d')]},'raw':!![]})['then'](function(_0x1c1182){if(_0x1c1182&&_0x1c1182[_0x97c0('0x5e')]===0x0){return db[_0x97c0('0x35')][_0x97c0('0x56')]({'name':_0x496336[_0x97c0('0x38')],'resourceId':_0x496336['id'],'type':_0x1c1182['name'],'sectionId':_0x1c1182['id']},{})[_0x97c0('0x29')](function(){return _0x5a4738;});}else{return _0x5a4738;}})[_0x97c0('0x52')](function(_0x579f54){logger[_0x97c0('0x36')](_0x97c0('0x5f'),_0x579f54);throw _0x579f54;});}return _0x5a4738;});}})[_0x97c0('0x29')](respondWithResult(_0x5f3803,0xc9))['catch'](handleError(_0x5f3803,null));};exports[_0x97c0('0x64')]=function(_0x100d97,_0x10f1aa){if(_0x100d97[_0x97c0('0x57')]['id']){delete _0x100d97['body']['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x100d97[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x10f1aa,null))[_0x97c0('0x29')](saveUpdates(_0x100d97[_0x97c0('0x57')],null))[_0x97c0('0x29')](respondWithResult(_0x10f1aa,null))[_0x97c0('0x52')](handleError(_0x10f1aa,null));};exports[_0x97c0('0x2a')]=function(_0x1e28fa,_0x4edc4b){return db['VoiceQueue'][_0x97c0('0x34')]({'where':{'id':_0x1e28fa['params']['id']}})['then'](handleEntityNotFound(_0x4edc4b,null))['then'](removeEntity(_0x4edc4b,null))[_0x97c0('0x52')](handleError(_0x4edc4b,null));};exports[_0x97c0('0x65')]=function(_0x123a99,_0x30968e,_0x4399f2){var _0x4dccd6={'raw':![],'where':{}};var _0x4b9523={};var _0x35ced3={'count':0x0,'rows':[]};return db[_0x97c0('0x3b')][_0x97c0('0x66')]({'where':{'id':_0x123a99[_0x97c0('0x54')]['id']}})['then'](handleEntityNotFound(_0x30968e,null))[_0x97c0('0x29')](function(_0x512e74){if(_0x512e74){_0x4b9523[_0x97c0('0x43')]=_[_0x97c0('0x40')](db[_0x97c0('0x67')][_0x97c0('0x3c')]);_0x4b9523[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x123a99[_0x97c0('0x3f')]);_0x4b9523[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x4b9523[_0x97c0('0x43')],_0x4b9523['query']);_0x4dccd6[_0x97c0('0x44')]=_['intersection'](_0x4b9523['model'],qs[_0x97c0('0x45')](_0x123a99[_0x97c0('0x3f')]['fields']));_0x4dccd6[_0x97c0('0x44')]=_0x4dccd6['attributes'][_0x97c0('0x46')]?_0x4dccd6[_0x97c0('0x44')]:_0x4b9523['model'];if(!_0x123a99[_0x97c0('0x3f')]['hasOwnProperty']('nolimit')){_0x4dccd6['limit']=qs[_0x97c0('0x23')](_0x123a99[_0x97c0('0x3f')]['limit']);_0x4dccd6[_0x97c0('0x21')]=qs[_0x97c0('0x21')](_0x123a99[_0x97c0('0x3f')][_0x97c0('0x21')]);}_0x4dccd6[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x123a99[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x4dccd6['where']=qs[_0x97c0('0x41')](_['pick'](_0x123a99['query'],_0x4b9523[_0x97c0('0x41')]));_0x4dccd6['where'][_0x97c0('0x68')]=_0x512e74['id'];if(_0x123a99[_0x97c0('0x3f')]['filter']){_0x4dccd6[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x4dccd6[_0x97c0('0x4a')],{'$or':_[_0x97c0('0x30')](_0x4dccd6[_0x97c0('0x44')],function(_0x550a68){var _0xe8d30c={};_0xe8d30c[_0x550a68]={'$like':'%'+_0x123a99[_0x97c0('0x3f')][_0x97c0('0x4c')]+'%'};return _0xe8d30c;})});}_0x4dccd6=_['merge']({},_0x4dccd6,_0x123a99[_0x97c0('0x69')]);return db[_0x97c0('0x67')][_0x97c0('0x24')]({'where':_0x4dccd6[_0x97c0('0x4a')]})['then'](function(_0x3b253e){_0x35ced3[_0x97c0('0x24')]=_0x3b253e;if(_0x123a99[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x4dccd6[_0x97c0('0x55')]=[{'all':!![]}];}return db['CmHopper'][_0x97c0('0x50')](_0x4dccd6);})[_0x97c0('0x29')](function(_0x5b232f){_0x35ced3['rows']=_0x5b232f;return _0x35ced3;});}})[_0x97c0('0x29')](respondWithFilteredResult(_0x30968e,_0x4dccd6))[_0x97c0('0x52')](handleError(_0x30968e,null));};exports[_0x97c0('0x6a')]=function(_0x532810,_0x479876,_0xd091e2){var _0x5e7d2e={'raw':!![],'where':{}};var _0x2a7f52={};var _0x1c58f7={'count':0x0,'rows':[]};return db[_0x97c0('0x3b')][_0x97c0('0x66')]({'where':{'id':_0x532810[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x479876,null))[_0x97c0('0x29')](function(_0x56ef2b){if(_0x56ef2b){_0x2a7f52[_0x97c0('0x43')]=_[_0x97c0('0x40')](db[_0x97c0('0x6b')][_0x97c0('0x3c')]);_0x2a7f52[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x532810[_0x97c0('0x3f')]);_0x2a7f52[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x2a7f52[_0x97c0('0x43')],_0x2a7f52[_0x97c0('0x3f')]);_0x5e7d2e[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x2a7f52[_0x97c0('0x43')],qs['fields'](_0x532810[_0x97c0('0x3f')][_0x97c0('0x45')]));_0x5e7d2e[_0x97c0('0x44')]=_0x5e7d2e[_0x97c0('0x44')]['length']?_0x5e7d2e[_0x97c0('0x44')]:_0x2a7f52[_0x97c0('0x43')];if(!_0x532810[_0x97c0('0x3f')][_0x97c0('0x6c')](_0x97c0('0x47'))){_0x5e7d2e[_0x97c0('0x23')]=qs[_0x97c0('0x23')](_0x532810['query'][_0x97c0('0x23')]);_0x5e7d2e['offset']=qs[_0x97c0('0x21')](_0x532810[_0x97c0('0x3f')][_0x97c0('0x21')]);}_0x5e7d2e['order']=qs[_0x97c0('0x49')](_0x532810[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x5e7d2e[_0x97c0('0x4a')]=qs[_0x97c0('0x41')](_['pick'](_0x532810[_0x97c0('0x3f')],_0x2a7f52['filters']));_0x5e7d2e[_0x97c0('0x4a')][_0x97c0('0x68')]=_0x56ef2b['id'];if(_0x532810['query'][_0x97c0('0x4c')]){_0x5e7d2e[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x5e7d2e[_0x97c0('0x4a')],{'$or':_[_0x97c0('0x30')](_0x5e7d2e[_0x97c0('0x44')],function(_0x3ebd11){var _0x44b374={};_0x44b374[_0x3ebd11]={'$like':'%'+_0x532810['query'][_0x97c0('0x4c')]+'%'};return _0x44b374;})});}_0x5e7d2e=_[_0x97c0('0x4d')]({},_0x5e7d2e,_0x532810[_0x97c0('0x69')]);return db['CmHopperHistory']['count']({'where':_0x5e7d2e[_0x97c0('0x4a')]})[_0x97c0('0x29')](function(_0x406d59){_0x1c58f7[_0x97c0('0x24')]=_0x406d59;if(_0x532810[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x5e7d2e[_0x97c0('0x55')]=[{'all':!![]}];}return db[_0x97c0('0x6b')][_0x97c0('0x50')](_0x5e7d2e);})[_0x97c0('0x29')](function(_0x393375){_0x1c58f7[_0x97c0('0x51')]=_0x393375;return _0x1c58f7;});}})[_0x97c0('0x29')](respondWithFilteredResult(_0x479876,_0x5e7d2e))['catch'](handleError(_0x479876,null));};exports[_0x97c0('0x6d')]=function(_0x3459e2,_0x2ea171,_0x2ec94a){var _0x2383d5={'raw':!![],'where':{}};var _0x548280={};var _0x46249e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3459e2[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x2ea171,null))['then'](function(_0x5b172f){if(_0x5b172f){_0x548280['model']=_[_0x97c0('0x40')](db[_0x97c0('0x6e')][_0x97c0('0x3c')]);_0x548280[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x3459e2[_0x97c0('0x3f')]);_0x548280['filters']=_[_0x97c0('0x42')](_0x548280[_0x97c0('0x43')],_0x548280['query']);_0x2383d5[_0x97c0('0x44')]=_['intersection'](_0x548280[_0x97c0('0x43')],qs[_0x97c0('0x45')](_0x3459e2[_0x97c0('0x3f')][_0x97c0('0x45')]));_0x2383d5[_0x97c0('0x44')]=_0x2383d5['attributes'][_0x97c0('0x46')]?_0x2383d5[_0x97c0('0x44')]:_0x548280[_0x97c0('0x43')];if(!_0x3459e2['query'][_0x97c0('0x6c')](_0x97c0('0x47'))){_0x2383d5['limit']=qs[_0x97c0('0x23')](_0x3459e2[_0x97c0('0x3f')][_0x97c0('0x23')]);_0x2383d5[_0x97c0('0x21')]=qs[_0x97c0('0x21')](_0x3459e2[_0x97c0('0x3f')][_0x97c0('0x21')]);}_0x2383d5[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x3459e2[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x2383d5['where']=qs[_0x97c0('0x41')](_[_0x97c0('0x4b')](_0x3459e2['query'],_0x548280['filters']));_0x2383d5[_0x97c0('0x4a')][_0x97c0('0x68')]=_0x5b172f['id'];if(_0x3459e2[_0x97c0('0x3f')][_0x97c0('0x4c')]){_0x2383d5[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x2383d5[_0x97c0('0x4a')],{'$or':_['map'](_0x2383d5[_0x97c0('0x44')],function(_0x5d4719){var _0xcc410={};_0xcc410[_0x5d4719]={'$like':'%'+_0x3459e2['query'][_0x97c0('0x4c')]+'%'};return _0xcc410;})});}_0x2383d5=_[_0x97c0('0x4d')]({},_0x2383d5,_0x3459e2[_0x97c0('0x69')]);return db['CmHopperFinal'][_0x97c0('0x24')]({'where':_0x2383d5[_0x97c0('0x4a')]})['then'](function(_0x27deae){_0x46249e[_0x97c0('0x24')]=_0x27deae;if(_0x3459e2[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x2383d5['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x97c0('0x50')](_0x2383d5);})['then'](function(_0x2a3aeb){_0x46249e['rows']=_0x2a3aeb;return _0x46249e;});}})[_0x97c0('0x29')](respondWithFilteredResult(_0x2ea171,_0x2383d5))[_0x97c0('0x52')](handleError(_0x2ea171,null));};exports[_0x97c0('0x6f')]=function(_0x14727a,_0x5a8027,_0x4529dc){var _0x323dc5={'raw':!![],'where':{}};var _0x537435={};var _0x5b4dbf={'count':0x0,'rows':[]};return db[_0x97c0('0x3b')][_0x97c0('0x66')]({'where':{'id':_0x14727a[_0x97c0('0x54')]['id']}})['then'](handleEntityNotFound(_0x5a8027,null))['then'](function(_0xabc21f){if(_0xabc21f){_0x537435['model']=_[_0x97c0('0x40')](db[_0x97c0('0x70')][_0x97c0('0x3c')]);_0x537435[_0x97c0('0x3f')]=_['keys'](_0x14727a[_0x97c0('0x3f')]);_0x537435[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x537435['model'],_0x537435[_0x97c0('0x3f')]);_0x323dc5[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x537435[_0x97c0('0x43')],qs[_0x97c0('0x45')](_0x14727a['query'][_0x97c0('0x45')]));_0x323dc5[_0x97c0('0x44')]=_0x323dc5[_0x97c0('0x44')][_0x97c0('0x46')]?_0x323dc5[_0x97c0('0x44')]:_0x537435[_0x97c0('0x43')];if(!_0x14727a[_0x97c0('0x3f')][_0x97c0('0x6c')](_0x97c0('0x47'))){_0x323dc5[_0x97c0('0x23')]=qs[_0x97c0('0x23')](_0x14727a['query']['limit']);_0x323dc5[_0x97c0('0x21')]=qs['offset'](_0x14727a['query'][_0x97c0('0x21')]);}_0x323dc5[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x14727a['query'][_0x97c0('0x49')]);_0x323dc5[_0x97c0('0x4a')]=qs[_0x97c0('0x41')](_['pick'](_0x14727a['query'],_0x537435[_0x97c0('0x41')]));_0x323dc5['where'][_0x97c0('0x68')]=_0xabc21f['id'];if(_0x14727a['query'][_0x97c0('0x4c')]){_0x323dc5[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x323dc5['where'],{'$or':_[_0x97c0('0x30')](_0x323dc5[_0x97c0('0x44')],function(_0x1450ad){var _0x256ca0={};_0x256ca0[_0x1450ad]={'$like':'%'+_0x14727a[_0x97c0('0x3f')]['filter']+'%'};return _0x256ca0;})});}_0x323dc5=_[_0x97c0('0x4d')]({},_0x323dc5,_0x14727a[_0x97c0('0x69')]);return db[_0x97c0('0x70')][_0x97c0('0x24')]({'where':_0x323dc5[_0x97c0('0x4a')]})[_0x97c0('0x29')](function(_0x3f64b5){_0x5b4dbf[_0x97c0('0x24')]=_0x3f64b5;if(_0x14727a[_0x97c0('0x3f')][_0x97c0('0x4f')]){_0x323dc5[_0x97c0('0x55')]=[{'all':!![]}];}return db[_0x97c0('0x70')]['findAll'](_0x323dc5);})[_0x97c0('0x29')](function(_0x13e1f1){_0x5b4dbf[_0x97c0('0x51')]=_0x13e1f1;return _0x5b4dbf;});}})[_0x97c0('0x29')](respondWithFilteredResult(_0x5a8027,_0x323dc5))[_0x97c0('0x52')](handleError(_0x5a8027,null));};exports[_0x97c0('0x71')]=function(_0xcb15ba,_0x3cad5b,_0x291180){var _0x335e24={};var _0x141849={};var _0x11ad52;var _0x3a6443;return db['VoiceQueue'][_0x97c0('0x66')]({'where':{'id':_0xcb15ba[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x3cad5b,null))[_0x97c0('0x29')](function(_0x5a2400){if(_0x5a2400){_0x11ad52=_0x5a2400;_0x141849[_0x97c0('0x43')]=_[_0x97c0('0x40')](db['Team'][_0x97c0('0x3c')]);_0x141849[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0xcb15ba[_0x97c0('0x3f')]);_0x141849[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x141849['model'],_0x141849[_0x97c0('0x3f')]);_0x335e24[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x141849['model'],qs[_0x97c0('0x45')](_0xcb15ba[_0x97c0('0x3f')]['fields']));_0x335e24[_0x97c0('0x44')]=_0x335e24[_0x97c0('0x44')][_0x97c0('0x46')]?_0x335e24[_0x97c0('0x44')]:_0x141849[_0x97c0('0x43')];_0x335e24['order']=qs[_0x97c0('0x49')](_0xcb15ba[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x335e24['where']=qs[_0x97c0('0x41')](_[_0x97c0('0x4b')](_0xcb15ba['query'],_0x141849[_0x97c0('0x41')]));if(_0xcb15ba[_0x97c0('0x3f')][_0x97c0('0x4c')]){_0x335e24[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x335e24[_0x97c0('0x4a')],{'$or':_['map'](_0x335e24['attributes'],function(_0x1415f9){var _0x28bc4c={};_0x28bc4c[_0x1415f9]={'$like':'%'+_0xcb15ba['query']['filter']+'%'};return _0x28bc4c;})});}_0x335e24=_[_0x97c0('0x4d')]({},_0x335e24,_0xcb15ba['options']);return _0x11ad52[_0x97c0('0x71')](_0x335e24);}})[_0x97c0('0x29')](function(_0x5e0a2d){if(_0x5e0a2d){_0x3a6443=_0x5e0a2d['length'];if(!_0xcb15ba[_0x97c0('0x3f')][_0x97c0('0x6c')](_0x97c0('0x47'))){_0x335e24[_0x97c0('0x23')]=qs['limit'](_0xcb15ba[_0x97c0('0x3f')][_0x97c0('0x23')]);_0x335e24[_0x97c0('0x21')]=qs[_0x97c0('0x21')](_0xcb15ba['query'][_0x97c0('0x21')]);}return _0x11ad52[_0x97c0('0x71')](_0x335e24);}})[_0x97c0('0x29')](function(_0x117083){if(_0x117083){return _0x117083?{'count':_0x3a6443,'rows':_0x117083}:null;}})['then'](respondWithResult(_0x3cad5b,null))[_0x97c0('0x52')](handleError(_0x3cad5b,null));};exports[_0x97c0('0x72')]=function(_0x2098fc,_0x423d51,_0x82de09){var _0x49b8e3=_0x2098fc[_0x97c0('0x57')]['teams'];var _0x3fb8de=_[_0x97c0('0x30')](_0x49b8e3,'id');return db[_0x97c0('0x73')][_0x97c0('0x50')]({'where':{'id':_0x3fb8de},'attributes':['id'],'include':[{'model':db[_0x97c0('0x74')],'as':_0x97c0('0x75'),'attributes':['id',_0x97c0('0x38'),_0x97c0('0x76'),_0x97c0('0x77'),_0x97c0('0x78')],'raw':!![]}]})[_0x97c0('0x29')](function(_0x33e794){if(_0x33e794){var _0x165174=_['flatMap'](_0x33e794,function(_0x375181){var _0x1c195e=_0x375181['get']({'plain':!![]});_0x1c195e[_0x97c0('0x75')]['forEach'](function(_0x1149bd){_0x1149bd[_0x97c0('0x79')]=_[_0x97c0('0x34')](_0x49b8e3,{'id':_0x1c195e['id']})[_0x97c0('0x79')];});return _0x1c195e[_0x97c0('0x75')];});return db[_0x97c0('0x3b')][_0x97c0('0x34')]({'where':{'id':_0x2098fc[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](function(_0x35670f){return db[_0x97c0('0x7a')][_0x97c0('0x7b')](function(_0x317c93){return _0x35670f[_0x97c0('0x72')](_0x3fb8de,{'transaction':_0x317c93})['then'](function(){return BPromise['each'](_0x49b8e3,function(_0x6564e6){return db[_0x97c0('0x7c')][_0x97c0('0x7d')]({'TeamId':_0x6564e6['id'],'VoiceQueueId':_0x2098fc[_0x97c0('0x54')]['id'],'penalty':_0x6564e6[_0x97c0('0x79')]},{'transaction':_0x317c93});});})[_0x97c0('0x29')](function(){return BPromise[_0x97c0('0x7e')](_0x165174,function(_0x2c367b){return db[_0x97c0('0x7f')][_0x97c0('0x80')]({'where':{'UserId':_0x2c367b['id'],'VoiceQueueId':_0x2098fc[_0x97c0('0x54')]['id']},'defaults':{'penalty':_0x2c367b[_0x97c0('0x79')]},'transaction':_0x317c93});});})[_0x97c0('0x29')](function(){return BPromise[_0x97c0('0x7e')](_[_0x97c0('0x4c')](_0x165174,{'online':!![]}),function(_0x3f2d71){return db[_0x97c0('0x81')][_0x97c0('0x7d')]({'membername':_0x3f2d71['name'],'UserId':_0x3f2d71['id'],'queue_name':_0x35670f[_0x97c0('0x38')],'VoiceQueueId':_0x35670f['id'],'interface':_['isNil'](_0x3f2d71[_0x97c0('0x78')])?util['format'](_0x97c0('0x82'),_0x3f2d71[_0x97c0('0x38')]):_0x3f2d71['interface'],'paused':_0x3f2d71[_0x97c0('0x77')]||![],'penalty':_0x3f2d71[_0x97c0('0x79')]},{'transaction':_0x317c93});});})[_0x97c0('0x29')](function(){_0x165174[_0x97c0('0x83')](function(_0x1c9b66){socket[_0x97c0('0x84')](_0x97c0('0x85'),{'UserId':_0x1c9b66['id'],'VoiceQueueId':_0x35670f['id']});});});});});}})[_0x97c0('0x29')](respondWithStatusCode(_0x423d51,null))[_0x97c0('0x52')](handleError(_0x423d51,null));};exports[_0x97c0('0x86')]=function(_0x524073,_0x512c14,_0x11e0b5){return db[_0x97c0('0x73')][_0x97c0('0x50')]({'where':{'id':_0x524073[_0x97c0('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x97c0('0x75'),'attributes':['id'],'raw':!![]}]})[_0x97c0('0x29')](handleEntityNotFound(_0x512c14,null))[_0x97c0('0x29')](function(_0x20c042){var _0x25a329=_[_0x97c0('0x30')](_0x20c042,'id');var _0x334177=[];var _0x4e0774=[];var _0x3de976=squel[_0x97c0('0x87')]();_0x3de976['field'](_0x97c0('0x88'))[_0x97c0('0x89')](_0x97c0('0x8a'),'tq')[_0x97c0('0x8b')](_0x97c0('0x8c'),'ut',_0x97c0('0x8d'))[_0x97c0('0x4a')]('VoiceQueueId\x20=\x20?',_0x524073[_0x97c0('0x54')]['id']);for(var _0x7f867c=0x0;_0x7f867c<_0x20c042[_0x97c0('0x46')];_0x7f867c+=0x1){let _0x1fd3d8=_0x20c042[_0x7f867c];for(var _0x43f4db=0x0;_0x43f4db<_0x1fd3d8[_0x97c0('0x75')][_0x97c0('0x46')];_0x43f4db+=0x1){let _0x39b505=_0x1fd3d8[_0x97c0('0x75')][_0x43f4db];var _0x410d29=_0x3de976['clone']();_0x410d29[_0x97c0('0x4a')](_0x97c0('0x8e'),_0x39b505['id']);_0x4e0774[_0x97c0('0x8f')](db[_0x97c0('0x7a')][_0x97c0('0x3f')](_0x410d29[_0x97c0('0x90')](),{'type':db[_0x97c0('0x7a')]['QueryTypes']['SELECT']})[_0x97c0('0x29')](function(_0x10ec60){if(_0x10ec60[_0x97c0('0x46')]===0x1){return _0x39b505['id'];}else{var _0x39194c=_[_0x97c0('0x91')](_[_0x97c0('0x30')](_0x10ec60,_0x97c0('0x92')),function(_0xfd90be){return _['includes'](_0x25a329,_0xfd90be);});if(_0x39194c){return _0x39b505['id'];}}}));}}return BPromise[_0x97c0('0x93')](_0x4e0774)[_0x97c0('0x29')](function(_0x3bc884){_0x334177=_(_0x334177)[_0x97c0('0x94')](_0x3bc884)[_0x97c0('0x95')]()[_0x97c0('0x31')]();return db[_0x97c0('0x3b')][_0x97c0('0x34')]({'where':{'id':_0x524073[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](function(_0x30ce29){return db[_0x97c0('0x7a')][_0x97c0('0x7b')](function(_0x25dea8){return _0x30ce29[_0x97c0('0x86')](_0x524073['query'][_0x97c0('0x96')],{'transaction':_0x25dea8})['then'](function(){if(!_[_0x97c0('0x97')](_0x334177)){return _0x30ce29[_0x97c0('0x98')](_0x334177,{'transaction':_0x25dea8})[_0x97c0('0x29')](function(){return db[_0x97c0('0x81')][_0x97c0('0x2a')]({'where':{'VoiceQueueId':_0x524073['params']['id'],'UserId':_0x334177},'transaction':_0x25dea8});});}})[_0x97c0('0x29')](function(){_0x334177[_0x97c0('0x83')](function(_0x273558){socket[_0x97c0('0x84')](_0x97c0('0x99'),{'UserId':_0x273558,'VoiceQueueId':_0x30ce29['id']});});});});});});})['then'](respondWithStatusCode(_0x512c14,null))['catch'](handleError(_0x512c14,null));};exports[_0x97c0('0x9a')]=function(_0x43e8b4,_0x456a7d,_0x2b51e1){var _0xa90f5,_0x20cf7c;return db['VoiceQueue'][_0x97c0('0x34')]({'where':{'id':_0x43e8b4['params']['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x456a7d,null))[_0x97c0('0x29')](function(_0x1f3309){if(_0x1f3309){_0x20cf7c=_0x1f3309;return _0x1f3309[_0x97c0('0x9a')](_0x43e8b4[_0x97c0('0x57')][_0x97c0('0x96')],_[_0x97c0('0x61')](_0x43e8b4['body'],[_0x97c0('0x96'),'id'])||{})[_0x97c0('0x9b')](function(_0x395398){for(var _0x15d6db=0x0;_0x15d6db<_0x43e8b4[_0x97c0('0x57')]['ids'][_0x97c0('0x46')];_0x15d6db+=0x1){socket['emit'](_0x97c0('0x85'),{'UserId':Number(_0x43e8b4[_0x97c0('0x57')]['ids'][_0x15d6db]),'VoiceQueueId':Number(_0x43e8b4[_0x97c0('0x54')]['id'])});}return _0x395398;});}})[_0x97c0('0x29')](function(_0x2e109e){_0xa90f5=_0x2e109e||[];if(_0x20cf7c){return db['User']['findAll']({'where':{'id':_0x43e8b4['body'][_0x97c0('0x96')]},'attributes':['id',_0x97c0('0x38'),_0x97c0('0x76'),'voicePause',_0x97c0('0x78')],'raw':!![]});}})[_0x97c0('0x29')](function(_0x475c93){if(!_[_0x97c0('0x97')](_0x475c93)){var _0x3fd88e=[];for(var _0x8e54b1=0x0;_0x8e54b1<_0x475c93[_0x97c0('0x46')];_0x8e54b1++){if(_0x475c93[_0x8e54b1]['online']){_0x3fd88e[_0x97c0('0x8f')](db[_0x97c0('0x81')][_0x97c0('0x7d')]({'membername':_0x475c93[_0x8e54b1][_0x97c0('0x38')],'UserId':_0x475c93[_0x8e54b1]['id'],'queue_name':_0x20cf7c[_0x97c0('0x38')],'VoiceQueueId':_0x20cf7c['id'],'interface':_[_0x97c0('0x9c')](_0x475c93[_0x8e54b1][_0x97c0('0x78')])?util[_0x97c0('0x9d')](_0x97c0('0x82'),_0x475c93[_0x8e54b1][_0x97c0('0x38')]):_0x475c93[_0x8e54b1][_0x97c0('0x78')],'paused':_0x475c93[_0x8e54b1][_0x97c0('0x77')]||![],'penalty':_0x43e8b4[_0x97c0('0x57')][_0x97c0('0x79')]||0x0}));}}return BPromise[_0x97c0('0x93')](_0x3fd88e);}})[_0x97c0('0x29')](function(){return _0xa90f5;})[_0x97c0('0x29')](respondWithResult(_0x456a7d,null))['catch'](handleError(_0x456a7d,null));};exports['removeAgents']=function(_0x57d834,_0x174c28,_0x991217){return db['VoiceQueue']['find']({'where':{'id':_0x57d834[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x174c28,null))['then'](function(_0x5d5baa){if(_0x5d5baa){return _0x5d5baa['removeAgents'](_0x57d834['query'][_0x97c0('0x96')])[_0x97c0('0x29')](function(){if(_[_0x97c0('0x9e')](_0x57d834['query'][_0x97c0('0x96')])){for(var _0x23f3d4=0x0;_0x23f3d4<_0x57d834[_0x97c0('0x3f')][_0x97c0('0x96')][_0x97c0('0x46')];_0x23f3d4+=0x1){socket[_0x97c0('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x57d834[_0x97c0('0x3f')][_0x97c0('0x96')][_0x23f3d4]),'VoiceQueueId':Number(_0x57d834[_0x97c0('0x54')]['id'])});}}else{socket[_0x97c0('0x84')]('userVoiceQueue:remove',{'UserId':Number(_0x57d834['query'][_0x97c0('0x96')]),'VoiceQueueId':Number(_0x57d834[_0x97c0('0x54')]['id'])});}});}})[_0x97c0('0x29')](function(_0x58da3b){return db['UserVoiceQueueRt'][_0x97c0('0x2a')]({'where':{'VoiceQueueId':_0x57d834[_0x97c0('0x54')]['id'],'UserId':_0x57d834[_0x97c0('0x3f')][_0x97c0('0x96')]}})[_0x97c0('0x29')](function(){return _0x58da3b;});})[_0x97c0('0x29')](respondWithStatusCode(_0x174c28,null))[_0x97c0('0x52')](handleError(_0x174c28,null));};exports[_0x97c0('0x9f')]=function(_0x1ba9fc,_0x531dfb,_0x4b01dc){var _0x2a0cfc={};var _0x5017de={};var _0x44d287;var _0x270006;return db[_0x97c0('0x3b')][_0x97c0('0x66')]({'where':{'id':_0x1ba9fc[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x531dfb,null))['then'](function(_0x3adf66){if(_0x3adf66){_0x44d287=_0x3adf66;_0x5017de[_0x97c0('0x43')]=_['keys'](db['User']['rawAttributes']);_0x5017de[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x1ba9fc[_0x97c0('0x3f')]);_0x5017de[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x5017de['model'],_0x5017de[_0x97c0('0x3f')]);_0x2a0cfc[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x5017de['model'],qs[_0x97c0('0x45')](_0x1ba9fc['query'][_0x97c0('0x45')]));_0x2a0cfc[_0x97c0('0x44')]=_0x2a0cfc['attributes'][_0x97c0('0x46')]?_0x2a0cfc['attributes']:_0x5017de[_0x97c0('0x43')];_0x2a0cfc[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x1ba9fc[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x2a0cfc[_0x97c0('0x4a')]=qs[_0x97c0('0x41')](_['pick'](_0x1ba9fc[_0x97c0('0x3f')],_0x5017de['filters']));if(_0x1ba9fc[_0x97c0('0x3f')]['filter']){_0x2a0cfc['where']=_[_0x97c0('0x4d')](_0x2a0cfc['where'],{'$or':_[_0x97c0('0x30')](_0x2a0cfc[_0x97c0('0x44')],function(_0x28e5e7){var _0x535af5={};_0x535af5[_0x28e5e7]={'$like':'%'+_0x1ba9fc[_0x97c0('0x3f')][_0x97c0('0x4c')]+'%'};return _0x535af5;})});}_0x2a0cfc=_['merge']({},_0x2a0cfc,_0x1ba9fc[_0x97c0('0x69')]);return _0x44d287[_0x97c0('0x9f')](_0x2a0cfc);}})[_0x97c0('0x29')](function(_0x183852){if(_0x183852){_0x270006=_0x183852[_0x97c0('0x46')];if(!_0x1ba9fc[_0x97c0('0x3f')][_0x97c0('0x6c')](_0x97c0('0x47'))){_0x2a0cfc['limit']=qs[_0x97c0('0x23')](_0x1ba9fc[_0x97c0('0x3f')]['limit']);_0x2a0cfc[_0x97c0('0x21')]=qs['offset'](_0x1ba9fc[_0x97c0('0x3f')][_0x97c0('0x21')]);}return _0x44d287[_0x97c0('0x9f')](_0x2a0cfc);}})[_0x97c0('0x29')](function(_0x21bd8d){if(_0x21bd8d){return _0x21bd8d?{'count':_0x270006,'rows':_0x21bd8d}:null;}})[_0x97c0('0x29')](respondWithResult(_0x531dfb,null))['catch'](handleError(_0x531dfb,null));};exports[_0x97c0('0xa0')]=function(_0x19e635,_0x1aa96e,_0x10cd3f){var _0x108830={};var _0x62b744={};var _0x58a2bf;var _0x2522ac;return db[_0x97c0('0x3b')]['findOne']({'where':{'id':_0x19e635['params']['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x1aa96e,null))[_0x97c0('0x29')](function(_0x5dc920){if(_0x5dc920){_0x58a2bf=_0x5dc920;_0x62b744[_0x97c0('0x43')]=_[_0x97c0('0x40')](db[_0x97c0('0x81')][_0x97c0('0x3c')]);_0x62b744[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x19e635['query']);_0x62b744[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x62b744[_0x97c0('0x43')],_0x62b744['query']);_0x108830[_0x97c0('0x44')]=_[_0x97c0('0x42')](_0x62b744['model'],qs[_0x97c0('0x45')](_0x19e635[_0x97c0('0x3f')][_0x97c0('0x45')]));_0x108830[_0x97c0('0x44')]=_0x108830[_0x97c0('0x44')]['length']?_0x108830[_0x97c0('0x44')]:_0x62b744[_0x97c0('0x43')];_0x108830[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x19e635[_0x97c0('0x3f')][_0x97c0('0x49')]);_0x108830['where']=qs[_0x97c0('0x41')](_[_0x97c0('0x4b')](_0x19e635['query'],_0x62b744[_0x97c0('0x41')]));if(_0x19e635[_0x97c0('0x3f')][_0x97c0('0x4c')]){_0x108830[_0x97c0('0x4a')]=_[_0x97c0('0x4d')](_0x108830[_0x97c0('0x4a')],{'$or':_['map'](_0x108830['attributes'],function(_0x39bd6e){var _0x33bc29={};_0x33bc29[_0x39bd6e]={'$like':'%'+_0x19e635[_0x97c0('0x3f')][_0x97c0('0x4c')]+'%'};return _0x33bc29;})});}_0x108830=_[_0x97c0('0x4d')]({},_0x108830,_0x19e635['options']);return _0x58a2bf[_0x97c0('0xa0')](_0x108830);}})[_0x97c0('0x29')](function(_0x4990e1){if(_0x4990e1){_0x2522ac=_0x4990e1['length'];if(!_0x19e635[_0x97c0('0x3f')]['hasOwnProperty']('nolimit')){_0x108830[_0x97c0('0x23')]=qs[_0x97c0('0x23')](_0x19e635[_0x97c0('0x3f')]['limit']);_0x108830[_0x97c0('0x21')]=qs['offset'](_0x19e635[_0x97c0('0x3f')]['offset']);}return _0x58a2bf[_0x97c0('0xa0')](_0x108830);}})[_0x97c0('0x29')](function(_0x58443f){return _0x58443f?{'count':_0x2522ac,'rows':_0x58443f}:null;})['then'](respondWithResult(_0x1aa96e,null))[_0x97c0('0x52')](handleError(_0x1aa96e,null));};exports[_0x97c0('0xa1')]=function(_0x16dc83,_0x1642bc,_0x342a55){var _0x117207={};var _0xc1e78e={};var _0xd7abe6;var _0x18c40f;return db[_0x97c0('0x3b')][_0x97c0('0x66')]({'where':{'id':_0x16dc83['params']['id']}})['then'](handleEntityNotFound(_0x1642bc,null))[_0x97c0('0x29')](function(_0x188933){if(_0x188933){_0xd7abe6=_0x188933;_0xc1e78e[_0x97c0('0x43')]=_[_0x97c0('0x40')](db[_0x97c0('0xa2')][_0x97c0('0x3c')]);_0xc1e78e[_0x97c0('0x3f')]=_[_0x97c0('0x40')](_0x16dc83[_0x97c0('0x3f')]);_0xc1e78e['filters']=_[_0x97c0('0x42')](_0xc1e78e[_0x97c0('0x43')],_0xc1e78e[_0x97c0('0x3f')]);_0x117207['attributes']=_['intersection'](_0xc1e78e[_0x97c0('0x43')],qs[_0x97c0('0x45')](_0x16dc83['query']['fields']));_0x117207['attributes']=_0x117207[_0x97c0('0x44')]['length']?_0x117207['attributes']:_0xc1e78e[_0x97c0('0x43')];_0x117207[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x16dc83['query'][_0x97c0('0x49')]);_0x117207['where']=qs[_0x97c0('0x41')](_[_0x97c0('0x4b')](_0x16dc83[_0x97c0('0x3f')],_0xc1e78e[_0x97c0('0x41')]));if(_0x16dc83['query'][_0x97c0('0x4c')]){_0x117207[_0x97c0('0x4a')]=_['merge'](_0x117207[_0x97c0('0x4a')],{'$or':_[_0x97c0('0x30')](_0x117207[_0x97c0('0x44')],function(_0x2a2f48){var _0x1b1dcf={};_0x1b1dcf[_0x2a2f48]={'$like':'%'+_0x16dc83[_0x97c0('0x3f')][_0x97c0('0x4c')]+'%'};return _0x1b1dcf;})});}_0x117207=_[_0x97c0('0x4d')]({},_0x117207,_0x16dc83['options']);return _0xd7abe6['getLists'](_0x117207);}})[_0x97c0('0x29')](function(_0x2adafc){if(_0x2adafc){_0x18c40f=_0x2adafc[_0x97c0('0x46')];if(!_0x16dc83[_0x97c0('0x3f')]['hasOwnProperty']('nolimit')){_0x117207[_0x97c0('0x23')]=qs[_0x97c0('0x23')](_0x16dc83[_0x97c0('0x3f')][_0x97c0('0x23')]);_0x117207[_0x97c0('0x21')]=qs[_0x97c0('0x21')](_0x16dc83[_0x97c0('0x3f')][_0x97c0('0x21')]);}return _0xd7abe6['getLists'](_0x117207);}})[_0x97c0('0x29')](function(_0x5d4303){if(_0x5d4303){return _0x5d4303?{'count':_0x18c40f,'rows':_0x5d4303}:null;}})[_0x97c0('0x29')](respondWithResult(_0x1642bc,null))[_0x97c0('0x52')](handleError(_0x1642bc,null));};exports['addLists']=function(_0x14574e,_0x520fd2,_0x17d67b){var _0x54095d=moment()[_0x97c0('0x9d')](_0x97c0('0xa3'));var _0x168831,_0x7416fb;return db[_0x97c0('0x3b')][_0x97c0('0x34')]({'where':{'id':_0x14574e[_0x97c0('0x54')]['id']}})['then'](handleEntityNotFound(_0x520fd2,null))[_0x97c0('0x29')](function(_0x221ef9){if(_0x221ef9){_0x7416fb=_0x221ef9;return _0x221ef9[_0x97c0('0xa4')](_0x14574e[_0x97c0('0x57')][_0x97c0('0x96')],_['omit'](_0x14574e[_0x97c0('0x57')],[_0x97c0('0x96'),'id'])||{});}return null;})[_0x97c0('0x9b')](function(_0x132525){var _0x3fc66b;_0x168831=_0x132525||[];var _0x59c8c8=[];if(_0x132525){for(var _0x47264a=0x0;_0x47264a<_0x132525[_0x97c0('0x46')];_0x47264a+=0x1){var _0x3579cf=_0x132525[_0x47264a][_0x97c0('0x5b')]({'plain':!![]});_0x7416fb[_0x97c0('0xa5')]=_0x14574e[_0x97c0('0x57')]['dialCheckDuplicateType']?_0x14574e[_0x97c0('0x57')][_0x97c0('0xa5')]:_0x7416fb[_0x97c0('0xa5')];switch(_0x7416fb['dialCheckDuplicateType']){case _0x97c0('0xa6'):_0x3fc66b=squel[_0x97c0('0xa7')]()[_0x97c0('0xa8')](_0x97c0('0xa9'))['fromQuery']([_0x97c0('0xaa'),_0x97c0('0xab'),'ContactId',_0x97c0('0xac'),_0x97c0('0x68'),'createdAt',_0x97c0('0x62')],squel['select']()['field'](_0x97c0('0xaa'),_0x97c0('0xaa'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0xab'))[_0x97c0('0xad')]('id',_0x97c0('0xae'))[_0x97c0('0xad')](_0x3579cf['CmListId'][_0x97c0('0x90')](),'ListId')[_0x97c0('0xad')](_0x14574e[_0x97c0('0x54')]['id'][_0x97c0('0x90')](),'VoiceQueueId')[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0x63'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0x62'))[_0x97c0('0x89')]('cm_contacts')['where'](_0x97c0('0xaf'))[_0x97c0('0x4a')](_0x97c0('0xb0'),_0x3579cf[_0x97c0('0xb1')][_0x97c0('0x90')]())[_0x97c0('0x4a')](_0x97c0('0xb2'))[_0x97c0('0x4a')](_0x97c0('0xb3'),squel[_0x97c0('0x87')]()[_0x97c0('0xad')]('COALESCE(calleridnum,\x27\x27)')[_0x97c0('0x89')](_0x97c0('0xb4'))[_0x97c0('0x4a')](_0x97c0('0xb5'),_0x14574e[_0x97c0('0x54')]['id'][_0x97c0('0x90')]()))[_0x97c0('0x4a')](_0x97c0('0xb3'),squel[_0x97c0('0x87')]()[_0x97c0('0xad')](_0x97c0('0xb6'))[_0x97c0('0x89')]('cm_hopper')['where'](_0x97c0('0xb5'),_0x14574e[_0x97c0('0x54')]['id'][_0x97c0('0x90')]())))[_0x97c0('0x90')]();break;case _0x97c0('0xb7'):_0x3fc66b=squel[_0x97c0('0xa7')]()[_0x97c0('0xa8')](_0x97c0('0xa9'))[_0x97c0('0xb8')]([_0x97c0('0xaa'),'scheduledAt',_0x97c0('0xae'),_0x97c0('0xac'),_0x97c0('0x68'),_0x97c0('0x63'),_0x97c0('0x62')],squel[_0x97c0('0x87')]()[_0x97c0('0xad')](_0x97c0('0xaa'),_0x97c0('0xaa'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27','scheduledAt')[_0x97c0('0xad')]('id',_0x97c0('0xae'))[_0x97c0('0xad')](_0x3579cf['CmListId'][_0x97c0('0x90')](),_0x97c0('0xac'))[_0x97c0('0xad')](_0x14574e[_0x97c0('0x54')]['id']['toString'](),_0x97c0('0x68'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0x63'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27','updatedAt')['from'](_0x97c0('0xb9'))['where']('deletedAt\x20IS\x20NULL')[_0x97c0('0x4a')]('ListId\x20=\x20?',_0x3579cf[_0x97c0('0xb1')][_0x97c0('0x90')]())[_0x97c0('0x4a')](_0x97c0('0xb2'))[_0x97c0('0x4a')](_0x97c0('0xb3'),squel[_0x97c0('0x87')]()[_0x97c0('0xad')](_0x97c0('0xb6'))[_0x97c0('0x89')]('cm_hopper')[_0x97c0('0x4a')]('VoiceQueueId\x20=\x20?',_0x14574e[_0x97c0('0x54')]['id'][_0x97c0('0x90')]())))[_0x97c0('0x90')]();break;default:_0x3fc66b=squel[_0x97c0('0xa7')]()[_0x97c0('0xa8')]('cm_hopper')[_0x97c0('0xb8')]([_0x97c0('0xaa'),'scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0x97c0('0x87')]()[_0x97c0('0xad')]('phone',_0x97c0('0xaa'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0xab'))['field']('id',_0x97c0('0xae'))[_0x97c0('0xad')](_0x3579cf[_0x97c0('0xb1')][_0x97c0('0x90')](),_0x97c0('0xac'))[_0x97c0('0xad')](_0x14574e[_0x97c0('0x54')]['id'][_0x97c0('0x90')](),_0x97c0('0x68'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0x63'))['field']('\x27'+_0x54095d+'\x27','updatedAt')[_0x97c0('0x89')](_0x97c0('0xb9'))[_0x97c0('0x4a')]('deletedAt\x20IS\x20NULL')[_0x97c0('0x4a')]('ListId\x20=\x20?',_0x3579cf[_0x97c0('0xb1')][_0x97c0('0x90')]())[_0x97c0('0x4a')](_0x97c0('0xb2')))[_0x97c0('0x90')]();}_0x59c8c8[_0x97c0('0x8f')](db[_0x97c0('0x7a')][_0x97c0('0x3f')](_0x3fc66b));}return BPromise[_0x97c0('0x93')](_0x59c8c8);}})[_0x97c0('0x29')](function(){var _0x40acfd=[];var _0x210832=squel[_0x97c0('0xa7')]()[_0x97c0('0xa8')](_0x97c0('0xba'))[_0x97c0('0xb8')]([_0x97c0('0xbb'),_0x97c0('0xaa'),_0x97c0('0xbc'),_0x97c0('0x63'),_0x97c0('0x62')],squel['select']()[_0x97c0('0xad')](_0x97c0('0xbd'))[_0x97c0('0xad')](_0x97c0('0xbe'))[_0x97c0('0xad')](_0x97c0('0xbf'))['field']('\x27'+_0x54095d+'\x27',_0x97c0('0x63'))[_0x97c0('0xad')]('\x27'+_0x54095d+'\x27',_0x97c0('0x62'))[_0x97c0('0x89')]('cm_contact_has_items','ci')[_0x97c0('0x8b')]('cm_hopper','h',_0x97c0('0xc0'))[_0x97c0('0x4a')]('h.scheduledat=?',_0x54095d)[_0x97c0('0x4a')](_0x97c0('0xc1'),_0x97c0('0xc2')))[_0x97c0('0x90')]();_0x40acfd[_0x97c0('0x8f')](db['sequelize'][_0x97c0('0x3f')](_0x210832));return BPromise[_0x97c0('0x93')](_0x40acfd);})[_0x97c0('0x29')](function(){return _0x168831;})[_0x97c0('0x29')](respondWithResult(_0x520fd2,null))[_0x97c0('0x52')](handleError(_0x520fd2,null));};exports[_0x97c0('0xc3')]=function(_0x8cc112,_0x5cbdb4,_0x48835f){return db['VoiceQueue'][_0x97c0('0x34')]({'where':{'id':_0x8cc112['params']['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x5cbdb4,null))['then'](function(_0x33b017){if(_0x33b017){return _0x33b017[_0x97c0('0xc3')](_0x8cc112[_0x97c0('0x3f')]['ids']);}})[_0x97c0('0x29')](function(_0x57a580){if(_0x57a580){return db[_0x97c0('0x67')][_0x97c0('0x2a')]({'where':{'ListId':_0x8cc112[_0x97c0('0x3f')][_0x97c0('0x96')],'VoiceQueueId':_0x8cc112[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](function(){return _0x57a580;});}})[_0x97c0('0x29')](respondWithStatusCode(_0x5cbdb4,null))[_0x97c0('0x52')](handleError(_0x5cbdb4,null));};exports[_0x97c0('0xc4')]=function(_0x315203,_0x162028,_0x540b6c){var _0x1844d0={};var _0xe3382c={};var _0x2a5c5c;var _0x41e2e1;return db[_0x97c0('0x3b')]['findOne']({'where':{'id':_0x315203[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x162028,null))[_0x97c0('0x29')](function(_0x11c887){if(_0x11c887){_0x2a5c5c=_0x11c887;_0xe3382c[_0x97c0('0x43')]=_['keys'](db[_0x97c0('0xa2')][_0x97c0('0x3c')]);_0xe3382c[_0x97c0('0x3f')]=_['keys'](_0x315203[_0x97c0('0x3f')]);_0xe3382c[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0xe3382c[_0x97c0('0x43')],_0xe3382c['query']);_0x1844d0['attributes']=_[_0x97c0('0x42')](_0xe3382c[_0x97c0('0x43')],qs[_0x97c0('0x45')](_0x315203[_0x97c0('0x3f')][_0x97c0('0x45')]));_0x1844d0[_0x97c0('0x44')]=_0x1844d0[_0x97c0('0x44')]['length']?_0x1844d0[_0x97c0('0x44')]:_0xe3382c[_0x97c0('0x43')];_0x1844d0[_0x97c0('0x48')]=qs[_0x97c0('0x49')](_0x315203['query']['sort']);_0x1844d0[_0x97c0('0x4a')]=qs[_0x97c0('0x41')](_['pick'](_0x315203[_0x97c0('0x3f')],_0xe3382c['filters']));if(_0x315203[_0x97c0('0x3f')][_0x97c0('0x4c')]){_0x1844d0[_0x97c0('0x4a')]=_['merge'](_0x1844d0[_0x97c0('0x4a')],{'$or':_['map'](_0x1844d0['attributes'],function(_0x7b0a94){var _0x5dd17e={};_0x5dd17e[_0x7b0a94]={'$like':'%'+_0x315203['query'][_0x97c0('0x4c')]+'%'};return _0x5dd17e;})});}_0x1844d0=_[_0x97c0('0x4d')]({},_0x1844d0,_0x315203[_0x97c0('0x69')]);return _0x2a5c5c[_0x97c0('0xc4')](_0x1844d0);}})[_0x97c0('0x29')](function(_0x2107d5){if(_0x2107d5){_0x41e2e1=_0x2107d5[_0x97c0('0x46')];if(!_0x315203[_0x97c0('0x3f')]['hasOwnProperty'](_0x97c0('0x47'))){_0x1844d0[_0x97c0('0x23')]=qs[_0x97c0('0x23')](_0x315203[_0x97c0('0x3f')][_0x97c0('0x23')]);_0x1844d0['offset']=qs['offset'](_0x315203[_0x97c0('0x3f')][_0x97c0('0x21')]);}return _0x2a5c5c['getBlackLists'](_0x1844d0);}})['then'](function(_0x3899f){if(_0x3899f){return _0x3899f?{'count':_0x41e2e1,'rows':_0x3899f}:null;}})['then'](respondWithResult(_0x162028,null))[_0x97c0('0x52')](handleError(_0x162028,null));};exports[_0x97c0('0xc5')]=function(_0x3ffaa5,_0x2627b6,_0x40e9ff){var _0x4311a5,_0x5d16a2;return db['VoiceQueue'][_0x97c0('0x34')]({'where':{'id':_0x3ffaa5[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x2627b6,null))[_0x97c0('0x29')](function(_0xe3d973){if(_0xe3d973){_0x5d16a2=_0xe3d973;return _0xe3d973[_0x97c0('0xc5')](_0x3ffaa5['body']['ids'],_[_0x97c0('0x61')](_0x3ffaa5[_0x97c0('0x57')],[_0x97c0('0x96'),'id'])||{});}return null;})[_0x97c0('0x9b')](function(_0x1f432b){var _0x36243c;_0x4311a5=_0x1f432b||[];var _0x13d79b=[];if(_0x1f432b){for(var _0x2a3286=0x0;_0x2a3286<_0x1f432b['length'];_0x2a3286+=0x1){var _0x49147d=_0x1f432b[_0x2a3286][_0x97c0('0x5b')]({'plain':!![]});_0x36243c=squel[_0x97c0('0xa7')]()[_0x97c0('0xa8')]('cm_hopper_black')[_0x97c0('0xb8')]([_0x97c0('0xaa'),_0x97c0('0xae'),'ListId',_0x97c0('0x68'),_0x97c0('0x63'),'updatedAt'],squel[_0x97c0('0x87')]()[_0x97c0('0xad')]('phone',_0x97c0('0xaa'))[_0x97c0('0xad')]('id',_0x97c0('0xae'))[_0x97c0('0xad')](_0x49147d['CmListId'][_0x97c0('0x90')](),_0x97c0('0xac'))['field'](_0x3ffaa5[_0x97c0('0x54')]['id'][_0x97c0('0x90')](),_0x97c0('0x68'))[_0x97c0('0xad')](_0x97c0('0xc6'),_0x97c0('0x63'))['field'](_0x97c0('0xc6'),_0x97c0('0x62'))[_0x97c0('0x89')](_0x97c0('0xb9'))[_0x97c0('0x4a')](_0x97c0('0xaf'))['where'](_0x97c0('0xb0'),_0x49147d['CmListId']['toString']())['where'](_0x97c0('0xb2')))['toString']();_0x13d79b[_0x97c0('0x8f')](db[_0x97c0('0x7a')]['query'](_0x36243c));}return BPromise[_0x97c0('0x93')](_0x13d79b);}})['then'](function(){return _0x4311a5;})['then'](respondWithResult(_0x2627b6,null))['catch'](handleError(_0x2627b6,null));};exports['removeBlackLists']=function(_0x1e324f,_0x1fcf6c,_0x50b557){return db['VoiceQueue'][_0x97c0('0x34')]({'where':{'id':_0x1e324f[_0x97c0('0x54')]['id']}})[_0x97c0('0x29')](handleEntityNotFound(_0x1fcf6c,null))[_0x97c0('0x29')](function(_0x3da6d7){if(_0x3da6d7){return _0x3da6d7['removeBlackLists'](_0x1e324f[_0x97c0('0x3f')][_0x97c0('0x96')]);}})[_0x97c0('0x29')](function(_0x22b239){if(_0x22b239){return db[_0x97c0('0x70')]['destroy']({'where':{'ListId':_0x1e324f[_0x97c0('0x3f')][_0x97c0('0x96')],'VoiceQueueId':_0x1e324f['params']['id']}})[_0x97c0('0x29')](function(){return _0x22b239;});}})['then'](respondWithStatusCode(_0x1fcf6c,null))[_0x97c0('0x52')](handleError(_0x1fcf6c,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2382b5b..fa3d433 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 _0xdb00=['hook','events','save','update','remove','emit','hasOwnProperty'];(function(_0x57944f,_0x4f975f){var _0x44d4d7=function(_0x3bd083){while(--_0x3bd083){_0x57944f['push'](_0x57944f['shift']());}};_0x44d4d7(++_0x4f975f);}(_0xdb00,0x151));var _0x0db0=function(_0xecc93b,_0xc0dab9){_0xecc93b=_0xecc93b-0x0;var _0x5b1795=_0xdb00[_0xecc93b];return _0x5b1795;};'use strict';var EventEmitter=require(_0x0db0('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0db0('0x1'),'afterUpdate':_0x0db0('0x2'),'afterDestroy':_0x0db0('0x3')};function emitEvent(_0x24f347){return function(_0xb2cdd0,_0xcc51c1,_0x2887f8){VoiceQueueEvents[_0x0db0('0x4')](_0x24f347+':'+_0xb2cdd0['id'],_0xb2cdd0);VoiceQueueEvents[_0x0db0('0x4')](_0x24f347,_0xb2cdd0);_0x2887f8(null);};}for(var e in events){if(events[_0x0db0('0x5')](e)){var event=events[e];VoiceQueue[_0x0db0('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file +var _0x05f2=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x2965d8,_0x43ce2a){var _0x4ac486=function(_0x42179f){while(--_0x42179f){_0x2965d8['push'](_0x2965d8['shift']());}};_0x4ac486(++_0x43ce2a);}(_0x05f2,0x89));var _0x205f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x05f2[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x205f('0x0'))['db'][_0x205f('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x205f('0x2')](0x0);var events={'afterCreate':_0x205f('0x3'),'afterUpdate':_0x205f('0x4'),'afterDestroy':_0x205f('0x5')};function emitEvent(_0x5cbb5e){return function(_0x19389e,_0x4b077b,_0x2e5957){VoiceQueueEvents[_0x205f('0x6')](_0x5cbb5e+':'+_0x19389e['id'],_0x19389e);VoiceQueueEvents[_0x205f('0x6')](_0x5cbb5e,_0x19389e);_0x2e5957(null);};}for(var e in events){if(events[_0x205f('0x7')](e)){var event=events[e];VoiceQueue[_0x205f('0x8')](e,emitEvent(event));}}module[_0x205f('0x9')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 036dc11..251a8e3 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 _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x46a635,_0x3cf6f0){var _0xff72f1=function(_0x3ac57b){while(--_0x3ac57b){_0x46a635['push'](_0x46a635['shift']());}};_0xff72f1(++_0x3cf6f0);}(_0x3e74,0x175));var _0x43e7=function(_0x505902,_0x107378){_0x505902=_0x505902-0x0;var _0x2fe882=_0x3e74[_0x505902];return _0x2fe882;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','VoiceQueue','voice_queues','lodash','../../config/logger','api','moment','path','../../config/environment','./voiceQueue.attributes'];(function(_0x3055ab,_0x4d1f74){var _0x31d336=function(_0x207a6a){while(--_0x207a6a){_0x3055ab['push'](_0x3055ab['shift']());}};_0x31d336(++_0x4d1f74);}(_0x3e74,0x175));var _0x43e7=function(_0x134109,_0x37a9e3){_0x134109=_0x134109-0x0;var _0x423aa4=_0x3e74[_0x134109];return _0x423aa4;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index d4d437d..893a4f3 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 _0x590f=['error','VoiceQueue,\x20%s,\x20%s','message','result','catch','GetVoiceQueue','VoiceQueue','options','raw','where','attributes','limit','include','map','model','ShowVoiceQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','then','info','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xbd43f2,_0x104733){var _0x12b6a4=function(_0x3e31e5){while(--_0x3e31e5){_0xbd43f2['push'](_0xbd43f2['shift']());}};_0x12b6a4(++_0x104733);}(_0x590f,0x11b));var _0xf590=function(_0x234f91,_0x3e8f17){_0x234f91=_0x234f91-0x0;var _0x191255=_0x590f[_0x234f91];return _0x191255;};'use strict';var _=require(_0xf590('0x0'));var util=require('util');var moment=require(_0xf590('0x1'));var BPromise=require(_0xf590('0x2'));var rs=require(_0xf590('0x3'));var fs=require('fs');var Redis=require(_0xf590('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf590('0x5'));var logger=require('../../config/logger')(_0xf590('0x6'));var config=require(_0xf590('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf590('0x8')]['http']({'port':0x232a});config[_0xf590('0x9')]=_[_0xf590('0xa')](config[_0xf590('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf590('0xb'))(new Redis(config[_0xf590('0x9')]));require(_0xf590('0xc'))[_0xf590('0xd')](socket);function respondWithRpcPromise(_0x1a48c6,_0x20ff4f,_0x24d26f){return new BPromise(function(_0x4c346c,_0x5e2c60){return client[_0xf590('0xe')](_0x1a48c6,_0x24d26f)[_0xf590('0xf')](function(_0x550178){logger[_0xf590('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x20ff4f,_0xf590('0x11'));logger[_0xf590('0x12')](_0xf590('0x13'),_0x20ff4f,_0xf590('0x11'),JSON[_0xf590('0x14')](_0x550178));if(_0x550178['error']){if(_0x550178[_0xf590('0x15')]['code']===0x1f4){logger[_0xf590('0x15')](_0xf590('0x16'),_0x20ff4f,_0x550178[_0xf590('0x15')][_0xf590('0x17')]);return _0x5e2c60(_0x550178['error'][_0xf590('0x17')]);}logger[_0xf590('0x15')](_0xf590('0x16'),_0x20ff4f,_0x550178[_0xf590('0x15')][_0xf590('0x17')]);return _0x4c346c(_0x550178['error'][_0xf590('0x17')]);}else{logger[_0xf590('0x10')](_0xf590('0x16'),_0x20ff4f,_0xf590('0x11'));_0x4c346c(_0x550178[_0xf590('0x18')][_0xf590('0x17')]);}})[_0xf590('0x19')](function(_0x5673fc){logger[_0xf590('0x15')](_0xf590('0x16'),_0x20ff4f,_0x5673fc);_0x5e2c60(_0x5673fc);});});}exports[_0xf590('0x1a')]=function(_0x3f06d4){var _0xc1055f=this;return new Promise(function(_0x35d33d,_0x5f1b9d){return db[_0xf590('0x1b')]['findAll']({'raw':_0x3f06d4[_0xf590('0x1c')]?_0x3f06d4[_0xf590('0x1c')][_0xf590('0x1d')]===undefined?!![]:![]:!![],'where':_0x3f06d4['options']?_0x3f06d4[_0xf590('0x1c')][_0xf590('0x1e')]||null:null,'attributes':_0x3f06d4[_0xf590('0x1c')]?_0x3f06d4[_0xf590('0x1c')][_0xf590('0x1f')]||null:null,'limit':_0x3f06d4[_0xf590('0x1c')]?_0x3f06d4[_0xf590('0x1c')][_0xf590('0x20')]||null:null,'include':_0x3f06d4[_0xf590('0x1c')]?_0x3f06d4[_0xf590('0x1c')][_0xf590('0x21')]?_[_0xf590('0x22')](_0x3f06d4['options'][_0xf590('0x21')],function(_0x15242d){return{'model':db[_0x15242d['model']],'as':_0x15242d['as'],'attributes':_0x15242d[_0xf590('0x1f')],'include':_0x15242d['include']?_['map'](_0x15242d[_0xf590('0x21')],function(_0x13fb5c){return{'model':db[_0x13fb5c[_0xf590('0x23')]],'as':_0x13fb5c['as'],'attributes':_0x13fb5c['attributes'],'include':_0x13fb5c[_0xf590('0x21')]?_[_0xf590('0x22')](_0x13fb5c[_0xf590('0x21')],function(_0x125ac4){return{'model':db[_0x125ac4[_0xf590('0x23')]],'as':_0x125ac4['as'],'attributes':_0x125ac4[_0xf590('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf590('0xf')](function(_0x4ff095){logger[_0xf590('0x10')]('GetVoiceQueue',_0x3f06d4);logger[_0xf590('0x12')](_0xf590('0x1a'),_0x3f06d4,JSON[_0xf590('0x14')](_0x4ff095));_0x35d33d(_0x4ff095);})['catch'](function(_0x186b1d){logger['error'](_0xf590('0x1a'),_0x186b1d[_0xf590('0x17')],_0x3f06d4);_0x5f1b9d(_0xc1055f[_0xf590('0x15')](0x1f4,_0x186b1d[_0xf590('0x17')]));});});};exports[_0xf590('0x24')]=function(_0x66f04f){var _0x1c0f3b=this;return new Promise(function(_0x38dca6,_0x4befe0){return db[_0xf590('0x1b')][_0xf590('0x25')]({'raw':_0x66f04f[_0xf590('0x1c')]?_0x66f04f[_0xf590('0x1c')][_0xf590('0x1d')]===undefined?!![]:![]:!![],'where':_0x66f04f['options']?_0x66f04f[_0xf590('0x1c')][_0xf590('0x1e')]||null:null,'attributes':_0x66f04f[_0xf590('0x1c')]?_0x66f04f[_0xf590('0x1c')][_0xf590('0x1f')]||null:null,'include':_0x66f04f[_0xf590('0x1c')]?_0x66f04f[_0xf590('0x1c')][_0xf590('0x21')]?_[_0xf590('0x22')](_0x66f04f['options'][_0xf590('0x21')],function(_0x553361){return{'model':db[_0x553361[_0xf590('0x23')]],'as':_0x553361['as'],'attributes':_0x553361[_0xf590('0x1f')],'include':_0x553361[_0xf590('0x21')]?_[_0xf590('0x22')](_0x553361[_0xf590('0x21')],function(_0x3297c2){return{'model':db[_0x3297c2[_0xf590('0x23')]],'as':_0x3297c2['as'],'attributes':_0x3297c2[_0xf590('0x1f')],'include':_0x3297c2['include']?_['map'](_0x3297c2[_0xf590('0x21')],function(_0x15a2a5){return{'model':db[_0x15a2a5[_0xf590('0x23')]],'as':_0x15a2a5['as'],'attributes':_0x15a2a5[_0xf590('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xf590('0xf')](function(_0x51182e){logger['info'](_0xf590('0x24'),_0x66f04f);logger[_0xf590('0x12')](_0xf590('0x24'),_0x66f04f,JSON[_0xf590('0x14')](_0x51182e));_0x38dca6(_0x51182e);})[_0xf590('0x19')](function(_0x37d926){logger[_0xf590('0x15')](_0xf590('0x24'),_0x37d926[_0xf590('0x17')],_0x66f04f);_0x4befe0(_0x1c0f3b[_0xf590('0x15')](0x1f4,_0x37d926[_0xf590('0x17')]));});});}; \ No newline at end of file +var _0x2648=['socket.io-emitter','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','attributes','limit','include','map','model','then','ShowVoiceQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2648,0x165));var _0x8264=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2648[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8264('0x0'));var util=require('util');var moment=require(_0x8264('0x1'));var BPromise=require(_0x8264('0x2'));var rs=require(_0x8264('0x3'));var fs=require('fs');var Redis=require(_0x8264('0x4'));var db=require(_0x8264('0x5'))['db'];var utils=require(_0x8264('0x6'));var logger=require(_0x8264('0x7'))(_0x8264('0x8'));var config=require(_0x8264('0x9'));var jayson=require(_0x8264('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x8264('0xb')]=_[_0x8264('0xc')](config[_0x8264('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x8264('0xd'))(new Redis(config[_0x8264('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x56e1b3,_0x117ddc,_0x41dff0){return new BPromise(function(_0x5c15fe,_0x7173b5){return client[_0x8264('0xe')](_0x56e1b3,_0x41dff0)['then'](function(_0x27662a){logger[_0x8264('0xf')](_0x8264('0x10'),_0x117ddc,_0x8264('0x11'));logger[_0x8264('0x12')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x117ddc,_0x8264('0x11'),JSON[_0x8264('0x13')](_0x27662a));if(_0x27662a[_0x8264('0x14')]){if(_0x27662a[_0x8264('0x14')][_0x8264('0x15')]===0x1f4){logger['error'](_0x8264('0x10'),_0x117ddc,_0x27662a[_0x8264('0x14')]['message']);return _0x7173b5(_0x27662a[_0x8264('0x14')][_0x8264('0x16')]);}logger['error'](_0x8264('0x10'),_0x117ddc,_0x27662a[_0x8264('0x14')][_0x8264('0x16')]);return _0x5c15fe(_0x27662a['error'][_0x8264('0x16')]);}else{logger[_0x8264('0xf')](_0x8264('0x10'),_0x117ddc,'request\x20sent');_0x5c15fe(_0x27662a['result'][_0x8264('0x16')]);}})[_0x8264('0x17')](function(_0x20883b){logger['error'](_0x8264('0x10'),_0x117ddc,_0x20883b);_0x7173b5(_0x20883b);});});}exports[_0x8264('0x18')]=function(_0x12c1c3){var _0x4077dc=this;return new Promise(function(_0x1336fb,_0x3548e5){return db[_0x8264('0x19')][_0x8264('0x1a')]({'raw':_0x12c1c3[_0x8264('0x1b')]?_0x12c1c3[_0x8264('0x1b')][_0x8264('0x1c')]===undefined?!![]:![]:!![],'where':_0x12c1c3[_0x8264('0x1b')]?_0x12c1c3['options']['where']||null:null,'attributes':_0x12c1c3[_0x8264('0x1b')]?_0x12c1c3['options'][_0x8264('0x1d')]||null:null,'limit':_0x12c1c3[_0x8264('0x1b')]?_0x12c1c3[_0x8264('0x1b')][_0x8264('0x1e')]||null:null,'include':_0x12c1c3['options']?_0x12c1c3[_0x8264('0x1b')][_0x8264('0x1f')]?_[_0x8264('0x20')](_0x12c1c3['options'][_0x8264('0x1f')],function(_0x38b374){return{'model':db[_0x38b374[_0x8264('0x21')]],'as':_0x38b374['as'],'attributes':_0x38b374[_0x8264('0x1d')],'include':_0x38b374[_0x8264('0x1f')]?_[_0x8264('0x20')](_0x38b374['include'],function(_0x55b454){return{'model':db[_0x55b454[_0x8264('0x21')]],'as':_0x55b454['as'],'attributes':_0x55b454[_0x8264('0x1d')],'include':_0x55b454['include']?_[_0x8264('0x20')](_0x55b454['include'],function(_0x4d05e3){return{'model':db[_0x4d05e3[_0x8264('0x21')]],'as':_0x4d05e3['as'],'attributes':_0x4d05e3[_0x8264('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8264('0x22')](function(_0x4cb7a3){logger[_0x8264('0xf')]('GetVoiceQueue',_0x12c1c3);logger[_0x8264('0x12')](_0x8264('0x18'),_0x12c1c3,JSON[_0x8264('0x13')](_0x4cb7a3));_0x1336fb(_0x4cb7a3);})[_0x8264('0x17')](function(_0x1bd783){logger[_0x8264('0x14')]('GetVoiceQueue',_0x1bd783['message'],_0x12c1c3);_0x3548e5(_0x4077dc['error'](0x1f4,_0x1bd783[_0x8264('0x16')]));});});};exports[_0x8264('0x23')]=function(_0x49884f){var _0x56d487=this;return new Promise(function(_0x538993,_0x1cab02){return db[_0x8264('0x19')]['find']({'raw':_0x49884f[_0x8264('0x1b')]?_0x49884f[_0x8264('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x49884f['options']?_0x49884f[_0x8264('0x1b')][_0x8264('0x24')]||null:null,'attributes':_0x49884f[_0x8264('0x1b')]?_0x49884f[_0x8264('0x1b')]['attributes']||null:null,'include':_0x49884f[_0x8264('0x1b')]?_0x49884f[_0x8264('0x1b')][_0x8264('0x1f')]?_['map'](_0x49884f['options'][_0x8264('0x1f')],function(_0x19606e){return{'model':db[_0x19606e['model']],'as':_0x19606e['as'],'attributes':_0x19606e[_0x8264('0x1d')],'include':_0x19606e[_0x8264('0x1f')]?_['map'](_0x19606e[_0x8264('0x1f')],function(_0x106e73){return{'model':db[_0x106e73[_0x8264('0x21')]],'as':_0x106e73['as'],'attributes':_0x106e73[_0x8264('0x1d')],'include':_0x106e73['include']?_[_0x8264('0x20')](_0x106e73[_0x8264('0x1f')],function(_0x2ed182){return{'model':db[_0x2ed182[_0x8264('0x21')]],'as':_0x2ed182['as'],'attributes':_0x2ed182['attributes']};}):[]};}):[]};}):[]:[]})[_0x8264('0x22')](function(_0x28200d){logger[_0x8264('0xf')]('ShowVoiceQueue',_0x49884f);logger['debug'](_0x8264('0x23'),_0x49884f,JSON[_0x8264('0x13')](_0x28200d));_0x538993(_0x28200d);})['catch'](function(_0x4b40ad){logger[_0x8264('0x14')]('ShowVoiceQueue',_0x4b40ad['message'],_0x49884f);_0x1cab02(_0x56d487[_0x8264('0x14')](0x1f4,_0x4b40ad[_0x8264('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9ffa189..27b9707 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 _0x0ed7=['update','emit','removeListener','length','voiceQueue:','save','remove'];(function(_0x395aa1,_0x9e643d){var _0x57ef82=function(_0x4160a0){while(--_0x4160a0){_0x395aa1['push'](_0x395aa1['shift']());}};_0x57ef82(++_0x9e643d);}(_0x0ed7,0x8a));var _0x70ed=function(_0x55291a,_0x814018){_0x55291a=_0x55291a-0x0;var _0x3c870c=_0x0ed7[_0x55291a];return _0x3c870c;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x70ed('0x0'),_0x70ed('0x1'),_0x70ed('0x2')];function createListener(_0x274868,_0x42bc9c){return function(_0x453f7b){_0x42bc9c[_0x70ed('0x3')](_0x274868,_0x453f7b);};}function removeListener(_0x267f2e,_0x1fc110){return function(){VoiceQueueEvents[_0x70ed('0x4')](_0x267f2e,_0x1fc110);};}exports['register']=function(_0x22152e){for(var _0x19b5b3=0x0,_0x4f9878=events[_0x70ed('0x5')];_0x19b5b3<_0x4f9878;_0x19b5b3++){var _0x3680b5=events[_0x19b5b3];var _0x68d325=createListener(_0x70ed('0x6')+_0x3680b5,_0x22152e);VoiceQueueEvents['on'](_0x3680b5,_0x68d325);}}; \ No newline at end of file +var _0x8bc9=['removeListener','length','voiceQueue:','./voiceQueue.events','save','remove','update','emit'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x8bc9,0x1f3));var _0x98bc=function(_0x3ce811,_0x204963){_0x3ce811=_0x3ce811-0x0;var _0xbecbf0=_0x8bc9[_0x3ce811];return _0xbecbf0;};'use strict';var VoiceQueueEvents=require(_0x98bc('0x0'));var events=[_0x98bc('0x1'),_0x98bc('0x2'),_0x98bc('0x3')];function createListener(_0x293409,_0x15a9bb){return function(_0x2d2bee){_0x15a9bb[_0x98bc('0x4')](_0x293409,_0x2d2bee);};}function removeListener(_0x48e7cb,_0x525148){return function(){VoiceQueueEvents[_0x98bc('0x5')](_0x48e7cb,_0x525148);};}exports['register']=function(_0x3e2ab0){for(var _0x277615=0x0,_0x1a7b86=events[_0x98bc('0x6')];_0x277615<_0x1a7b86;_0x277615++){var _0x3fea69=events[_0x277615];var _0xfe732f=createListener(_0x98bc('0x7')+_0x3fea69,_0x3e2ab0);VoiceQueueEvents['on'](_0x3fea69,_0xfe732f);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index c746682..6b2b9c2 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 _0x3bc7=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','getVoiceQueuesReport','/:id','post','create','update','delete','exports','multer'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0x3bc7,0x1c1));var _0x73bc=function(_0x360d26,_0x700e92){_0x360d26=_0x360d26-0x0;var _0x180eef=_0x3bc7[_0x360d26];return _0x180eef;};'use strict';var multer=require(_0x73bc('0x0'));var util=require(_0x73bc('0x1'));var path=require(_0x73bc('0x2'));var timeout=require('connect-timeout');var express=require(_0x73bc('0x3'));var router=express['Router']();var fs_extra=require(_0x73bc('0x4'));var auth=require(_0x73bc('0x5'));var interaction=require(_0x73bc('0x6'));var config=require(_0x73bc('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x73bc('0x8')]('/',auth[_0x73bc('0x9')](),controller[_0x73bc('0xa')]);router[_0x73bc('0x8')]('/describe',auth[_0x73bc('0x9')](),controller['describe']);router['get']('/index',auth[_0x73bc('0x9')](),controller[_0x73bc('0xb')]);router[_0x73bc('0x8')](_0x73bc('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x73bc('0xd')]('/',auth[_0x73bc('0x9')](),controller[_0x73bc('0xe')]);router['put'](_0x73bc('0xc'),auth[_0x73bc('0x9')](),controller[_0x73bc('0xf')]);router[_0x73bc('0x10')](_0x73bc('0xc'),auth[_0x73bc('0x9')](),controller['destroy']);module[_0x73bc('0x11')]=router; \ No newline at end of file +var _0x3479=['/describe','get','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated','index'];(function(_0x385dc0,_0x2de1e7){var _0x308e7a=function(_0x4f9257){while(--_0x4f9257){_0x385dc0['push'](_0x385dc0['shift']());}};_0x308e7a(++_0x2de1e7);}(_0x3479,0x186));var _0x9347=function(_0x57d671,_0x1a101c){_0x57d671=_0x57d671-0x0;var _0x450dfe=_0x3479[_0x57d671];return _0x450dfe;};'use strict';var multer=require(_0x9347('0x0'));var util=require('util');var path=require(_0x9347('0x1'));var timeout=require('connect-timeout');var express=require(_0x9347('0x2'));var router=express['Router']();var fs_extra=require(_0x9347('0x3'));var auth=require(_0x9347('0x4'));var interaction=require(_0x9347('0x5'));var config=require('../../config/environment');var controller=require(_0x9347('0x6'));router['get']('/',auth[_0x9347('0x7')](),controller[_0x9347('0x8')]);router['get'](_0x9347('0x9'),auth[_0x9347('0x7')](),controller['describe']);router[_0x9347('0xa')]('/index',auth[_0x9347('0x7')](),controller[_0x9347('0xb')]);router['get'](_0x9347('0xc'),auth[_0x9347('0x7')](),controller[_0x9347('0xd')]);router[_0x9347('0xe')]('/',auth[_0x9347('0x7')](),controller[_0x9347('0xf')]);router[_0x9347('0x10')](_0x9347('0xc'),auth[_0x9347('0x7')](),controller[_0x9347('0x11')]);router['delete'](_0x9347('0xc'),auth['isAuthenticated'](),controller[_0x9347('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 143bfd3..92a3b4f 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 _0xf72a=['seconds','setDataValue','holdtime','INTEGER','BOOLEAN','moment','exports','STRING','DATE','getDataValue','format','YYYY-MM-DD\x20HH:mm:ss','diff'];(function(_0x23d0a1,_0x5011a){var _0x1ef866=function(_0x5103d4){while(--_0x5103d4){_0x23d0a1['push'](_0x23d0a1['shift']());}};_0x1ef866(++_0x5011a);}(_0xf72a,0x1f3));var _0xaf72=function(_0xbc7159,_0x5e1abb){_0xbc7159=_0xbc7159-0x0;var _0x5cc0ba=_0xf72a[_0xbc7159];return _0x5cc0ba;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xaf72('0x0'));module[_0xaf72('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xaf72('0x2')]},'calleridnum':{'type':Sequelize[_0xaf72('0x2')]},'calleridname':{'type':Sequelize[_0xaf72('0x2')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0xaf72('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xaf72('0x3')],'set':function(_0x9d8d94){var _0x225d5a=moment(_0x9d8d94);var _0xd2096c=moment(this[_0xaf72('0x4')]('queuecallerjoinAt'))[_0xaf72('0x5')](_0xaf72('0x6'));var _0x847df0=_0x225d5a[_0xaf72('0x7')](_0xd2096c,_0xaf72('0x8'));this[_0xaf72('0x9')]('queuecallerleaveAt',_0x9d8d94);this[_0xaf72('0x9')](_0xaf72('0xa'),_0x847df0||null);}},'position':{'type':Sequelize[_0xaf72('0xb')]},'count':{'type':Sequelize[_0xaf72('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xaf72('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xaf72('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xaf72('0x3')]},'queuecallerexit':{'type':Sequelize[_0xaf72('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xaf72('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xaf72('0xb')]},'channel':{'type':Sequelize[_0xaf72('0x2')]},'connectedlinenum':{'type':Sequelize[_0xaf72('0x2')]},'connectedlinename':{'type':Sequelize[_0xaf72('0x2')]},'accountcode':{'type':Sequelize[_0xaf72('0x2')]},'context':{'type':Sequelize[_0xaf72('0x2')]},'exten':{'type':Sequelize[_0xaf72('0x2')]},'priority':{'type':Sequelize[_0xaf72('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xaf72('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xaf72('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xaf72('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xaf72('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xaf72('0x2')]},'transferuniqueid':{'type':Sequelize[_0xaf72('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xaf72('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xaf72('0x2')]}}; \ No newline at end of file +var _0x11e3=['STRING','DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','queuecallerleaveAt','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x11e3,0xdd));var _0x311e=function(_0x345f21,_0x54c57c){_0x345f21=_0x345f21-0x0;var _0x21b23e=_0x11e3[_0x345f21];return _0x21b23e;};'use strict';var Sequelize=require(_0x311e('0x0'));var moment=require(_0x311e('0x1'));module[_0x311e('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x311e('0x3')]},'calleridnum':{'type':Sequelize[_0x311e('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x311e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x311e('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x311e('0x4')],'set':function(_0x2d6838){var _0xe5740b=moment(_0x2d6838);var _0x43fee6=moment(this['getDataValue'](_0x311e('0x5')))[_0x311e('0x6')](_0x311e('0x7'));var _0x2c222f=_0xe5740b[_0x311e('0x8')](_0x43fee6,_0x311e('0x9'));this[_0x311e('0xa')](_0x311e('0xb'),_0x2d6838);this[_0x311e('0xa')]('holdtime',_0x2c222f||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x311e('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x311e('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x311e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x311e('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x311e('0x4')]},'queuecallerexit':{'type':Sequelize[_0x311e('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x311e('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x311e('0x3')],'comment':_0x311e('0xe')},'originalposition':{'type':Sequelize[_0x311e('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x311e('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x311e('0x3')]},'exten':{'type':Sequelize[_0x311e('0x3')]},'priority':{'type':Sequelize[_0x311e('0x3')]},'holdtime':{'type':Sequelize[_0x311e('0xc')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x311e('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x311e('0x3')]},'transfer':{'type':Sequelize[_0x311e('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x311e('0x3')],'comment':_0x311e('0xf')},'transferexten':{'type':Sequelize[_0x311e('0x3')]},'transferuniqueid':{'type':Sequelize[_0x311e('0x3')]},'disposition':{'type':Sequelize[_0x311e('0x3')]},'secondDisposition':{'type':Sequelize[_0x311e('0x3')]},'thirdDisposition':{'type':Sequelize[_0x311e('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x311e('0xc')],'defaultValue':0x0},'note':{'type':Sequelize[_0x311e('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index af447a9..0b49cac 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 _0x212d=['where','pick','filter','merge','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','intersection','include','options','find','create','body','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','status','error','stack','name','index','map','VoiceQueueReport','fieldName','type','key','model','filters','query','attributes','fields','length','hasOwnProperty','order','sort'];(function(_0x3490f4,_0x29b7ce){var _0x24dfc5=function(_0x3a7b89){while(--_0x3a7b89){_0x3490f4['push'](_0x3490f4['shift']());}};_0x24dfc5(++_0x29b7ce);}(_0x212d,0xc1));var _0xd212=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x212d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd212('0x0'));var rimraf=require(_0xd212('0x1'));var zipdir=require(_0xd212('0x2'));var jsonpatch=require(_0xd212('0x3'));var rp=require(_0xd212('0x4'));var moment=require(_0xd212('0x5'));var BPromise=require(_0xd212('0x6'));var Mustache=require(_0xd212('0x7'));var util=require(_0xd212('0x8'));var path=require(_0xd212('0x9'));var sox=require('sox');var csv=require(_0xd212('0xa'));var ejs=require(_0xd212('0xb'));var fs=require('fs');var fs_extra=require(_0xd212('0xc'));var _=require(_0xd212('0xd'));var squel=require(_0xd212('0xe'));var crypto=require(_0xd212('0xf'));var jsforce=require(_0xd212('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd212('0xa'));var querystring=require(_0xd212('0x11'));var Papa=require('papaparse');var Redis=require(_0xd212('0x12'));var authService=require(_0xd212('0x13'));var qs=require(_0xd212('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd212('0x15'));var logger=require(_0xd212('0x16'))(_0xd212('0x17'));var utils=require(_0xd212('0x18'));var config=require(_0xd212('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd212('0x1a'))['db'];config[_0xd212('0x1b')]=_[_0xd212('0x1c')](config[_0xd212('0x1b')],{'host':_0xd212('0x1d'),'port':0x18eb});var socket=require(_0xd212('0x1e'))(new Redis(config[_0xd212('0x1b')]));require(_0xd212('0x1f'))[_0xd212('0x20')](socket);function respondWithStatusCode(_0x26881c,_0x2ceed5){_0x2ceed5=_0x2ceed5||0xcc;return function(_0x41f5e8){if(_0x41f5e8){return _0x26881c[_0xd212('0x21')](_0x2ceed5);}return _0x26881c['status'](_0x2ceed5)[_0xd212('0x22')]();};}function respondWithResult(_0x249009,_0x2f9b37){_0x2f9b37=_0x2f9b37||0xc8;return function(_0x19bf1e){if(_0x19bf1e){return _0x249009['status'](_0x2f9b37)['json'](_0x19bf1e);}};}function respondWithFilteredResult(_0x58d1cc,_0x3b41f0){return function(_0x2049e9){if(_0x2049e9){var _0x436b2a=typeof _0x3b41f0[_0xd212('0x23')]===_0xd212('0x24')&&typeof _0x3b41f0[_0xd212('0x25')]===_0xd212('0x24');var _0x240346=_0x2049e9[_0xd212('0x26')];var _0x11142=_0x436b2a?0x0:_0x3b41f0[_0xd212('0x23')];var _0x4a7d41=_0x436b2a?_0x2049e9[_0xd212('0x26')]:_0x3b41f0[_0xd212('0x23')]+_0x3b41f0[_0xd212('0x25')];var _0x1e078f;if(_0x4a7d41>=_0x240346){_0x4a7d41=_0x240346;_0x1e078f=0xc8;}else{_0x1e078f=0xce;}_0x58d1cc['status'](_0x1e078f);return _0x58d1cc['set'](_0xd212('0x27'),_0x11142+'-'+_0x4a7d41+'/'+_0x240346)[_0xd212('0x28')](_0x2049e9);}return null;};}function patchUpdates(_0x33cf69){return function(_0x3e2204){try{jsonpatch[_0xd212('0x29')](_0x3e2204,_0x33cf69,!![]);}catch(_0x521be3){return BPromise[_0xd212('0x2a')](_0x521be3);}return _0x3e2204['save']();};}function saveUpdates(_0x4eaca8,_0xd8eb92){return function(_0x4caf2b){if(_0x4caf2b){return _0x4caf2b[_0xd212('0x2b')](_0x4eaca8)[_0xd212('0x2c')](function(_0x1d21de){return _0x1d21de;});}return null;};}function removeEntity(_0x2c6435,_0x23e8b8){return function(_0xd859af){if(_0xd859af){return _0xd859af[_0xd212('0x2d')]()[_0xd212('0x2c')](function(){_0x2c6435[_0xd212('0x2e')](0xcc)[_0xd212('0x22')]();});}};}function handleEntityNotFound(_0x15d6b6,_0x2655b2){return function(_0x5abd14){if(!_0x5abd14){_0x15d6b6[_0xd212('0x21')](0x194);}return _0x5abd14;};}function handleError(_0x34e751,_0x2c03c1){_0x2c03c1=_0x2c03c1||0x1f4;return function(_0x4d17a7){logger[_0xd212('0x2f')](_0x4d17a7[_0xd212('0x30')]);if(_0x4d17a7['name']){delete _0x4d17a7[_0xd212('0x31')];}_0x34e751['status'](_0x2c03c1)['send'](_0x4d17a7);};}exports[_0xd212('0x32')]=function(_0x2b3ce5,_0x55832b){var _0x41c5a8={},_0x448a63={},_0x1f0b83={'count':0x0,'rows':[]};var _0x40ede2=_[_0xd212('0x33')](db[_0xd212('0x34')]['rawAttributes'],function(_0x4d9762){return{'name':_0x4d9762[_0xd212('0x35')],'type':_0x4d9762[_0xd212('0x36')][_0xd212('0x37')]};});_0x448a63[_0xd212('0x38')]=_['map'](_0x40ede2,_0xd212('0x31'));_0x448a63['query']=_['keys'](_0x2b3ce5['query']);_0x448a63[_0xd212('0x39')]=_['intersection'](_0x448a63['model'],_0x448a63[_0xd212('0x3a')]);_0x41c5a8[_0xd212('0x3b')]=_['intersection'](_0x448a63[_0xd212('0x38')],qs[_0xd212('0x3c')](_0x2b3ce5[_0xd212('0x3a')]['fields']));_0x41c5a8[_0xd212('0x3b')]=_0x41c5a8['attributes'][_0xd212('0x3d')]?_0x41c5a8['attributes']:_0x448a63[_0xd212('0x38')];if(!_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x3e')]('nolimit')){_0x41c5a8[_0xd212('0x25')]=qs[_0xd212('0x25')](_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x25')]);_0x41c5a8['offset']=qs[_0xd212('0x23')](_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x23')]);}_0x41c5a8[_0xd212('0x3f')]=qs[_0xd212('0x40')](_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x40')]);_0x41c5a8[_0xd212('0x41')]=qs[_0xd212('0x39')](_[_0xd212('0x42')](_0x2b3ce5['query'],_0x448a63[_0xd212('0x39')]),_0x40ede2);if(_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x43')]){_0x41c5a8[_0xd212('0x41')]=_[_0xd212('0x44')](_0x41c5a8['where'],{'$or':_[_0xd212('0x33')](_0x40ede2,function(_0x259f59){if(_0x259f59[_0xd212('0x36')]!=='VIRTUAL'){var _0x1c6c6d={};_0x1c6c6d[_0x259f59['name']]={'$like':'%'+_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x43')]+'%'};return _0x1c6c6d;}})});}_0x41c5a8=_[_0xd212('0x44')]({},_0x41c5a8,_0x2b3ce5['options']);var _0x54277f={'where':_0x41c5a8['where']};return db[_0xd212('0x34')][_0xd212('0x26')](_0x54277f)[_0xd212('0x2c')](function(_0xf94f9f){_0x1f0b83[_0xd212('0x26')]=_0xf94f9f;if(_0x2b3ce5[_0xd212('0x3a')][_0xd212('0x45')]){_0x41c5a8['include']=[{'all':!![]}];}return db[_0xd212('0x34')][_0xd212('0x46')](_0x41c5a8);})[_0xd212('0x2c')](function(_0x109cc4){_0x1f0b83[_0xd212('0x47')]=_0x109cc4;return _0x1f0b83;})[_0xd212('0x2c')](respondWithFilteredResult(_0x55832b,_0x41c5a8))[_0xd212('0x48')](handleError(_0x55832b,null));};exports[_0xd212('0x49')]=function(_0x4a22d6,_0x4123a3){var _0x14c562={'raw':![],'where':{'id':_0x4a22d6[_0xd212('0x4a')]['id']}},_0x52bb68={};_0x52bb68[_0xd212('0x38')]=_[_0xd212('0x4b')](db[_0xd212('0x34')][_0xd212('0x4c')]);_0x52bb68['query']=_[_0xd212('0x4b')](_0x4a22d6[_0xd212('0x3a')]);_0x52bb68[_0xd212('0x39')]=_[_0xd212('0x4d')](_0x52bb68[_0xd212('0x38')],_0x52bb68[_0xd212('0x3a')]);_0x14c562[_0xd212('0x3b')]=_['intersection'](_0x52bb68[_0xd212('0x38')],qs['fields'](_0x4a22d6[_0xd212('0x3a')][_0xd212('0x3c')]));_0x14c562[_0xd212('0x3b')]=_0x14c562['attributes']['length']?_0x14c562[_0xd212('0x3b')]:_0x52bb68[_0xd212('0x38')];if(_0x4a22d6[_0xd212('0x3a')][_0xd212('0x45')]){_0x14c562[_0xd212('0x4e')]=[{'all':!![]}];}_0x14c562=_[_0xd212('0x44')]({},_0x14c562,_0x4a22d6[_0xd212('0x4f')]);return db[_0xd212('0x34')][_0xd212('0x50')](_0x14c562)[_0xd212('0x2c')](handleEntityNotFound(_0x4123a3,null))[_0xd212('0x2c')](respondWithResult(_0x4123a3,null))[_0xd212('0x48')](handleError(_0x4123a3,null));};exports[_0xd212('0x51')]=function(_0x55cc62,_0x40b033){return db[_0xd212('0x34')][_0xd212('0x51')](_0x55cc62['body'],{})[_0xd212('0x2c')](respondWithResult(_0x40b033,0xc9))[_0xd212('0x48')](handleError(_0x40b033,null));};exports[_0xd212('0x2b')]=function(_0x3a2f88,_0x5de026){if(_0x3a2f88[_0xd212('0x52')]['id']){delete _0x3a2f88['body']['id'];}return db[_0xd212('0x34')][_0xd212('0x50')]({'where':{'id':_0x3a2f88[_0xd212('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5de026,null))[_0xd212('0x2c')](saveUpdates(_0x3a2f88[_0xd212('0x52')],null))[_0xd212('0x2c')](respondWithResult(_0x5de026,null))[_0xd212('0x48')](handleError(_0x5de026,null));};exports[_0xd212('0x2d')]=function(_0x597517,_0x5968f8){return db['VoiceQueueReport'][_0xd212('0x50')]({'where':{'id':_0x597517[_0xd212('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5968f8,null))['then'](removeEntity(_0x5968f8,null))['catch'](handleError(_0x5968f8,null));};exports[_0xd212('0x53')]=function(_0x5e6bec,_0x20f5c8){return db[_0xd212('0x34')]['describe']()[_0xd212('0x2c')](respondWithResult(_0x20f5c8,null))[_0xd212('0x48')](handleError(_0x20f5c8,null));};exports[_0xd212('0x54')]=function(_0x22a3fb,_0x681f28){var _0x124671={},_0x3d674a={},_0x3291da={'count':0x0,'rows':[]};_0x3d674a[_0xd212('0x38')]=_['keys'](db[_0xd212('0x34')][_0xd212('0x4c')]);_0x3d674a['query']=_[_0xd212('0x4b')](_0x22a3fb[_0xd212('0x3a')]);_0x3d674a[_0xd212('0x39')]=_[_0xd212('0x4d')](_0x3d674a[_0xd212('0x38')],_0x3d674a[_0xd212('0x3a')]);_0x124671['attributes']=_['intersection'](_0x3d674a[_0xd212('0x38')],qs[_0xd212('0x3c')](_0x22a3fb[_0xd212('0x3a')][_0xd212('0x3c')]));_0x124671[_0xd212('0x3b')]=_0x124671[_0xd212('0x3b')][_0xd212('0x3d')]?_0x124671[_0xd212('0x3b')]:_0x3d674a[_0xd212('0x38')];if(!_0x22a3fb[_0xd212('0x3a')]['hasOwnProperty'](_0xd212('0x55'))){_0x124671[_0xd212('0x25')]=qs[_0xd212('0x25')](_0x22a3fb['query'][_0xd212('0x25')]);_0x124671[_0xd212('0x23')]=qs[_0xd212('0x23')](_0x22a3fb['query'][_0xd212('0x23')]);}_0x124671[_0xd212('0x3f')]=qs[_0xd212('0x40')](_0x22a3fb[_0xd212('0x3a')][_0xd212('0x40')]);_0x124671[_0xd212('0x41')]=qs[_0xd212('0x39')](_['pick'](_0x22a3fb[_0xd212('0x3a')],_0x3d674a[_0xd212('0x39')]));if(_0x22a3fb[_0xd212('0x3a')][_0xd212('0x43')]){_0x124671[_0xd212('0x41')]=_[_0xd212('0x44')](_0x124671['where'],{'$or':_[_0xd212('0x33')](_0x124671[_0xd212('0x3b')],function(_0x1bf68a){var _0x4fed1f={};_0x4fed1f[_0x1bf68a]={'$like':'%'+_0x22a3fb[_0xd212('0x3a')][_0xd212('0x43')]+'%'};return _0x4fed1f;})});}_0x124671=_[_0xd212('0x44')]({},_0x124671,_0x22a3fb[_0xd212('0x4f')]);var _0x1c36c0={'where':_0x124671[_0xd212('0x41')]};return db[_0xd212('0x34')][_0xd212('0x26')](_0x1c36c0)['then'](function(_0x396d3a){_0x3291da[_0xd212('0x26')]=_0x396d3a;if(_0x22a3fb[_0xd212('0x3a')][_0xd212('0x45')]){_0x124671[_0xd212('0x4e')]=[{'all':!![]}];}return db[_0xd212('0x34')][_0xd212('0x46')](_0x124671);})['then'](function(_0x1c880a){_0x3291da[_0xd212('0x47')]=_0x1c880a;return _0x3291da;})['then'](respondWithFilteredResult(_0x681f28,_0x124671,_0xd212('0x54')))[_0xd212('0x48')](handleError(_0x681f28,null,_0xd212('0x54')));}; \ No newline at end of file +var _0x7b09=['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','./voiceQueueReport.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','intersection','attributes','model','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','VoiceQueueReport','includeAll','include','findAll','rows','show','params','keys','fields','find','create','body','catch','describe','getVoiceQueuesReport','eml-format','zip-dir','request-promise','bluebird','sox','ejs','lodash','jsforce','desk.js','to-csv'];(function(_0x1a0d09,_0x228e8f){var _0x507f0a=function(_0x1af1fd){while(--_0x1af1fd){_0x1a0d09['push'](_0x1a0d09['shift']());}};_0x507f0a(++_0x228e8f);}(_0x7b09,0x12e));var _0x97b0=function(_0x11ebc8,_0x46146e){_0x11ebc8=_0x11ebc8-0x0;var _0x5856a7=_0x7b09[_0x11ebc8];return _0x5856a7;};'use strict';var emlformat=require(_0x97b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x97b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x97b0('0x2'));var moment=require('moment');var BPromise=require(_0x97b0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x97b0('0x4'));var csv=require('to-csv');var ejs=require(_0x97b0('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97b0('0x6'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x97b0('0x7'));var deskjs=require(_0x97b0('0x8'));var toCsv=require(_0x97b0('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97b0('0xa'));var authService=require(_0x97b0('0xb'));var qs=require(_0x97b0('0xc'));var as=require(_0x97b0('0xd'));var hardwareService=require(_0x97b0('0xe'));var logger=require(_0x97b0('0xf'))('api');var utils=require(_0x97b0('0x10'));var config=require(_0x97b0('0x11'));var licenseUtil=require(_0x97b0('0x12'));var db=require('../../mysqldb')['db'];config[_0x97b0('0x13')]=_[_0x97b0('0x14')](config[_0x97b0('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x97b0('0x15'))(new Redis(config[_0x97b0('0x13')]));require(_0x97b0('0x16'))[_0x97b0('0x17')](socket);function respondWithStatusCode(_0x20cd7d,_0x12b471){_0x12b471=_0x12b471||0xcc;return function(_0x357193){if(_0x357193){return _0x20cd7d['sendStatus'](_0x12b471);}return _0x20cd7d[_0x97b0('0x18')](_0x12b471)['end']();};}function respondWithResult(_0x479fcd,_0x32f17e){_0x32f17e=_0x32f17e||0xc8;return function(_0x1ec32d){if(_0x1ec32d){return _0x479fcd[_0x97b0('0x18')](_0x32f17e)[_0x97b0('0x19')](_0x1ec32d);}};}function respondWithFilteredResult(_0x1a8146,_0x25435b){return function(_0x398b14){if(_0x398b14){var _0x3db525=typeof _0x25435b['offset']===_0x97b0('0x1a')&&typeof _0x25435b[_0x97b0('0x1b')]===_0x97b0('0x1a');var _0x50eedf=_0x398b14[_0x97b0('0x1c')];var _0x258dec=_0x3db525?0x0:_0x25435b[_0x97b0('0x1d')];var _0x5ab319=_0x3db525?_0x398b14['count']:_0x25435b[_0x97b0('0x1d')]+_0x25435b[_0x97b0('0x1b')];var _0x2feb66;if(_0x5ab319>=_0x50eedf){_0x5ab319=_0x50eedf;_0x2feb66=0xc8;}else{_0x2feb66=0xce;}_0x1a8146[_0x97b0('0x18')](_0x2feb66);return _0x1a8146[_0x97b0('0x1e')](_0x97b0('0x1f'),_0x258dec+'-'+_0x5ab319+'/'+_0x50eedf)[_0x97b0('0x19')](_0x398b14);}return null;};}function patchUpdates(_0x337583){return function(_0x3aa40c){try{jsonpatch[_0x97b0('0x20')](_0x3aa40c,_0x337583,!![]);}catch(_0x21b3f5){return BPromise['reject'](_0x21b3f5);}return _0x3aa40c[_0x97b0('0x21')]();};}function saveUpdates(_0x2ffe9e,_0x280262){return function(_0x5a7fdb){if(_0x5a7fdb){return _0x5a7fdb[_0x97b0('0x22')](_0x2ffe9e)['then'](function(_0x460ad1){return _0x460ad1;});}return null;};}function removeEntity(_0x355619,_0x23def8){return function(_0x55da7e){if(_0x55da7e){return _0x55da7e[_0x97b0('0x23')]()[_0x97b0('0x24')](function(){_0x355619[_0x97b0('0x18')](0xcc)[_0x97b0('0x25')]();});}};}function handleEntityNotFound(_0x5dbbf1,_0x2f46f3){return function(_0x4a5694){if(!_0x4a5694){_0x5dbbf1[_0x97b0('0x26')](0x194);}return _0x4a5694;};}function handleError(_0x56f18c,_0x3ba400){_0x3ba400=_0x3ba400||0x1f4;return function(_0x558c79){logger[_0x97b0('0x27')](_0x558c79[_0x97b0('0x28')]);if(_0x558c79[_0x97b0('0x29')]){delete _0x558c79[_0x97b0('0x29')];}_0x56f18c[_0x97b0('0x18')](_0x3ba400)[_0x97b0('0x2a')](_0x558c79);};}exports[_0x97b0('0x2b')]=function(_0x511819,_0x5a1cea){var _0x5049a4={},_0x2b2010={},_0x188d9e={'count':0x0,'rows':[]};var _0x519fdf=_[_0x97b0('0x2c')](db['VoiceQueueReport'][_0x97b0('0x2d')],function(_0x53382e){return{'name':_0x53382e['fieldName'],'type':_0x53382e[_0x97b0('0x2e')][_0x97b0('0x2f')]};});_0x2b2010['model']=_[_0x97b0('0x2c')](_0x519fdf,'name');_0x2b2010['query']=_['keys'](_0x511819['query']);_0x2b2010['filters']=_[_0x97b0('0x30')](_0x2b2010['model'],_0x2b2010['query']);_0x5049a4[_0x97b0('0x31')]=_[_0x97b0('0x30')](_0x2b2010[_0x97b0('0x32')],qs['fields'](_0x511819[_0x97b0('0x33')]['fields']));_0x5049a4['attributes']=_0x5049a4['attributes'][_0x97b0('0x34')]?_0x5049a4[_0x97b0('0x31')]:_0x2b2010[_0x97b0('0x32')];if(!_0x511819['query'][_0x97b0('0x35')](_0x97b0('0x36'))){_0x5049a4[_0x97b0('0x1b')]=qs['limit'](_0x511819[_0x97b0('0x33')]['limit']);_0x5049a4[_0x97b0('0x1d')]=qs[_0x97b0('0x1d')](_0x511819[_0x97b0('0x33')][_0x97b0('0x1d')]);}_0x5049a4[_0x97b0('0x37')]=qs['sort'](_0x511819[_0x97b0('0x33')][_0x97b0('0x38')]);_0x5049a4[_0x97b0('0x39')]=qs[_0x97b0('0x3a')](_[_0x97b0('0x3b')](_0x511819['query'],_0x2b2010['filters']),_0x519fdf);if(_0x511819['query'][_0x97b0('0x3c')]){_0x5049a4[_0x97b0('0x39')]=_['merge'](_0x5049a4['where'],{'$or':_['map'](_0x519fdf,function(_0x6bf53c){if(_0x6bf53c[_0x97b0('0x2e')]!=='VIRTUAL'){var _0x382cc4={};_0x382cc4[_0x6bf53c['name']]={'$like':'%'+_0x511819[_0x97b0('0x33')][_0x97b0('0x3c')]+'%'};return _0x382cc4;}})});}_0x5049a4=_[_0x97b0('0x3d')]({},_0x5049a4,_0x511819[_0x97b0('0x3e')]);var _0x4ed4d2={'where':_0x5049a4[_0x97b0('0x39')]};return db[_0x97b0('0x3f')][_0x97b0('0x1c')](_0x4ed4d2)[_0x97b0('0x24')](function(_0x15ee2d){_0x188d9e[_0x97b0('0x1c')]=_0x15ee2d;if(_0x511819[_0x97b0('0x33')][_0x97b0('0x40')]){_0x5049a4[_0x97b0('0x41')]=[{'all':!![]}];}return db[_0x97b0('0x3f')][_0x97b0('0x42')](_0x5049a4);})[_0x97b0('0x24')](function(_0x35145a){_0x188d9e[_0x97b0('0x43')]=_0x35145a;return _0x188d9e;})[_0x97b0('0x24')](respondWithFilteredResult(_0x5a1cea,_0x5049a4))['catch'](handleError(_0x5a1cea,null));};exports[_0x97b0('0x44')]=function(_0x3f6bd1,_0x4269a2){var _0xeb251a={'raw':![],'where':{'id':_0x3f6bd1[_0x97b0('0x45')]['id']}},_0x2f60f6={};_0x2f60f6[_0x97b0('0x32')]=_[_0x97b0('0x46')](db[_0x97b0('0x3f')][_0x97b0('0x2d')]);_0x2f60f6[_0x97b0('0x33')]=_[_0x97b0('0x46')](_0x3f6bd1[_0x97b0('0x33')]);_0x2f60f6[_0x97b0('0x3a')]=_['intersection'](_0x2f60f6[_0x97b0('0x32')],_0x2f60f6[_0x97b0('0x33')]);_0xeb251a[_0x97b0('0x31')]=_['intersection'](_0x2f60f6[_0x97b0('0x32')],qs[_0x97b0('0x47')](_0x3f6bd1[_0x97b0('0x33')][_0x97b0('0x47')]));_0xeb251a['attributes']=_0xeb251a['attributes'][_0x97b0('0x34')]?_0xeb251a[_0x97b0('0x31')]:_0x2f60f6['model'];if(_0x3f6bd1[_0x97b0('0x33')][_0x97b0('0x40')]){_0xeb251a[_0x97b0('0x41')]=[{'all':!![]}];}_0xeb251a=_['merge']({},_0xeb251a,_0x3f6bd1[_0x97b0('0x3e')]);return db['VoiceQueueReport'][_0x97b0('0x48')](_0xeb251a)[_0x97b0('0x24')](handleEntityNotFound(_0x4269a2,null))[_0x97b0('0x24')](respondWithResult(_0x4269a2,null))['catch'](handleError(_0x4269a2,null));};exports['create']=function(_0x13652d,_0x26b75a){return db['VoiceQueueReport'][_0x97b0('0x49')](_0x13652d['body'],{})[_0x97b0('0x24')](respondWithResult(_0x26b75a,0xc9))['catch'](handleError(_0x26b75a,null));};exports['update']=function(_0x28d731,_0x16c79a){if(_0x28d731[_0x97b0('0x4a')]['id']){delete _0x28d731[_0x97b0('0x4a')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x28d731[_0x97b0('0x45')]['id']}})[_0x97b0('0x24')](handleEntityNotFound(_0x16c79a,null))[_0x97b0('0x24')](saveUpdates(_0x28d731[_0x97b0('0x4a')],null))['then'](respondWithResult(_0x16c79a,null))['catch'](handleError(_0x16c79a,null));};exports[_0x97b0('0x23')]=function(_0x3effe3,_0x51b857){return db[_0x97b0('0x3f')][_0x97b0('0x48')]({'where':{'id':_0x3effe3[_0x97b0('0x45')]['id']}})[_0x97b0('0x24')](handleEntityNotFound(_0x51b857,null))[_0x97b0('0x24')](removeEntity(_0x51b857,null))[_0x97b0('0x4b')](handleError(_0x51b857,null));};exports[_0x97b0('0x4c')]=function(_0x159d87,_0x444bbf){return db[_0x97b0('0x3f')][_0x97b0('0x4c')]()[_0x97b0('0x24')](respondWithResult(_0x444bbf,null))['catch'](handleError(_0x444bbf,null));};exports[_0x97b0('0x4d')]=function(_0x322723,_0x147c04){var _0x49d538={},_0x538949={},_0x52c5a2={'count':0x0,'rows':[]};_0x538949['model']=_['keys'](db['VoiceQueueReport'][_0x97b0('0x2d')]);_0x538949['query']=_[_0x97b0('0x46')](_0x322723[_0x97b0('0x33')]);_0x538949[_0x97b0('0x3a')]=_['intersection'](_0x538949[_0x97b0('0x32')],_0x538949[_0x97b0('0x33')]);_0x49d538[_0x97b0('0x31')]=_['intersection'](_0x538949[_0x97b0('0x32')],qs[_0x97b0('0x47')](_0x322723[_0x97b0('0x33')][_0x97b0('0x47')]));_0x49d538[_0x97b0('0x31')]=_0x49d538['attributes'][_0x97b0('0x34')]?_0x49d538[_0x97b0('0x31')]:_0x538949[_0x97b0('0x32')];if(!_0x322723['query'][_0x97b0('0x35')](_0x97b0('0x36'))){_0x49d538['limit']=qs[_0x97b0('0x1b')](_0x322723[_0x97b0('0x33')][_0x97b0('0x1b')]);_0x49d538[_0x97b0('0x1d')]=qs[_0x97b0('0x1d')](_0x322723[_0x97b0('0x33')][_0x97b0('0x1d')]);}_0x49d538['order']=qs['sort'](_0x322723[_0x97b0('0x33')][_0x97b0('0x38')]);_0x49d538[_0x97b0('0x39')]=qs[_0x97b0('0x3a')](_[_0x97b0('0x3b')](_0x322723[_0x97b0('0x33')],_0x538949[_0x97b0('0x3a')]));if(_0x322723[_0x97b0('0x33')]['filter']){_0x49d538[_0x97b0('0x39')]=_[_0x97b0('0x3d')](_0x49d538[_0x97b0('0x39')],{'$or':_[_0x97b0('0x2c')](_0x49d538[_0x97b0('0x31')],function(_0x4e6cb1){var _0x591fed={};_0x591fed[_0x4e6cb1]={'$like':'%'+_0x322723[_0x97b0('0x33')][_0x97b0('0x3c')]+'%'};return _0x591fed;})});}_0x49d538=_[_0x97b0('0x3d')]({},_0x49d538,_0x322723[_0x97b0('0x3e')]);var _0x3616b2={'where':_0x49d538[_0x97b0('0x39')]};return db[_0x97b0('0x3f')][_0x97b0('0x1c')](_0x3616b2)[_0x97b0('0x24')](function(_0x4d2148){_0x52c5a2[_0x97b0('0x1c')]=_0x4d2148;if(_0x322723[_0x97b0('0x33')][_0x97b0('0x40')]){_0x49d538[_0x97b0('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x97b0('0x42')](_0x49d538);})['then'](function(_0x268537){_0x52c5a2[_0x97b0('0x43')]=_0x268537;return _0x52c5a2;})['then'](respondWithFilteredResult(_0x147c04,_0x49d538,_0x97b0('0x4d')))[_0x97b0('0x4b')](handleError(_0x147c04,null,_0x97b0('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index ea6aa74..9be40a8 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 _0x32fe=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','emit'];(function(_0x41b904,_0x2e93cc){var _0x5add06=function(_0x599118){while(--_0x599118){_0x41b904['push'](_0x41b904['shift']());}};_0x5add06(++_0x2e93cc);}(_0x32fe,0x78));var _0xe32f=function(_0x39e164,_0x2cb93b){_0x39e164=_0x39e164-0x0;var _0x13fa6b=_0x32fe[_0x39e164];return _0x13fa6b;};'use strict';var EventEmitter=require(_0xe32f('0x0'));var VoiceQueueReport=require(_0xe32f('0x1'))['db'][_0xe32f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe32f('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe32f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x29985c){return function(_0x59cc10,_0xc97ecc,_0x1ba1a2){VoiceQueueReportEvents['emit'](_0x29985c+':'+_0x59cc10['id'],_0x59cc10);VoiceQueueReportEvents[_0xe32f('0x5')](_0x29985c,_0x59cc10);_0x1ba1a2(null);};}for(var e in events){if(events[_0xe32f('0x6')](e)){var event=events[e];VoiceQueueReport[_0xe32f('0x7')](e,emitEvent(event));}}module[_0xe32f('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x4119=['save','update','remove','emit','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x41a2dc,_0x18bf0c){var _0x3b27cb=function(_0x5e6024){while(--_0x5e6024){_0x41a2dc['push'](_0x41a2dc['shift']());}};_0x3b27cb(++_0x18bf0c);}(_0x4119,0x149));var _0x9411=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x4119[_0x550d12];return _0x12103d;};'use strict';var EventEmitter=require(_0x9411('0x0'));var VoiceQueueReport=require(_0x9411('0x1'))['db'][_0x9411('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9411('0x3')](0x0);var events={'afterCreate':_0x9411('0x4'),'afterUpdate':_0x9411('0x5'),'afterDestroy':_0x9411('0x6')};function emitEvent(_0x5787de){return function(_0x1e620a,_0x558c3b,_0x4c8f18){VoiceQueueReportEvents[_0x9411('0x7')](_0x5787de+':'+_0x1e620a['id'],_0x1e620a);VoiceQueueReportEvents[_0x9411('0x7')](_0x5787de,_0x1e620a);_0x4c8f18(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x9411('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9c7c9bc..ed788b1 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 _0x0fb6=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','../../config/logger'];(function(_0x410e36,_0x40f74f){var _0x127f2a=function(_0x3f6257){while(--_0x3f6257){_0x410e36['push'](_0x410e36['shift']());}};_0x127f2a(++_0x40f74f);}(_0x0fb6,0x12e));var _0x60fb=function(_0x4968a7,_0x1cc0ab){_0x4968a7=_0x4968a7-0x0;var _0x405d52=_0x0fb6[_0x4968a7];return _0x405d52;};'use strict';var _=require(_0x60fb('0x0'));var util=require('util');var logger=require(_0x60fb('0x1'))(_0x60fb('0x2'));var moment=require(_0x60fb('0x3'));var BPromise=require(_0x60fb('0x4'));var rp=require(_0x60fb('0x5'));var fs=require('fs');var path=require(_0x60fb('0x6'));var rimraf=require(_0x60fb('0x7'));var config=require(_0x60fb('0x8'));var attributes=require(_0x60fb('0x9'));module[_0x60fb('0xa')]=function(_0x590d67,_0x4c3da5){return _0x590d67[_0x60fb('0xb')](_0x60fb('0xc'),attributes,{'tableName':_0x60fb('0xd'),'paranoid':![],'indexes':[{'fields':[_0x60fb('0xe')]},{'fields':[_0x60fb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf14=['uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1cc2ec,_0x3528b1){var _0x1ab30f=function(_0x2668c2){while(--_0x2668c2){_0x1cc2ec['push'](_0x1cc2ec['shift']());}};_0x1ab30f(++_0x3528b1);}(_0xcf14,0x1f0));var _0x4cf1=function(_0x53c370,_0x20a23b){_0x53c370=_0x53c370-0x0;var _0x5c2b39=_0xcf14[_0x53c370];return _0x5c2b39;};'use strict';var _=require(_0x4cf1('0x0'));var util=require(_0x4cf1('0x1'));var logger=require(_0x4cf1('0x2'))(_0x4cf1('0x3'));var moment=require(_0x4cf1('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cf1('0x5'));var fs=require('fs');var path=require(_0x4cf1('0x6'));var rimraf=require(_0x4cf1('0x7'));var config=require(_0x4cf1('0x8'));var attributes=require('./voiceQueueReport.attributes');module[_0x4cf1('0x9')]=function(_0x3a3b60,_0x26840a){return _0x3a3b60[_0x4cf1('0xa')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0x4cf1('0xb')]},{'fields':[_0x4cf1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index dab11e0..0b6ef7b 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 _0xff25=['info','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueueReport,\x20%s,\x20%s','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','raw','options','attributes','limit','include','model','map','then','debug','stringify','CreateVoiceQueueReport','create','UpdateVoiceQueueReport','update','body','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','request'];(function(_0x84a8ae,_0x17c724){var _0x13f8ee=function(_0x3f7581){while(--_0x3f7581){_0x84a8ae['push'](_0x84a8ae['shift']());}};_0x13f8ee(++_0x17c724);}(_0xff25,0xc8));var _0x5ff2=function(_0x212f99,_0x23f9f9){_0x212f99=_0x212f99-0x0;var _0x13a95c=_0xff25[_0x212f99];return _0x13a95c;};'use strict';var _=require(_0x5ff2('0x0'));var util=require('util');var moment=require(_0x5ff2('0x1'));var BPromise=require(_0x5ff2('0x2'));var rs=require(_0x5ff2('0x3'));var fs=require('fs');var Redis=require(_0x5ff2('0x4'));var db=require(_0x5ff2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5ff2('0x6'))('rpc');var config=require(_0x5ff2('0x7'));var jayson=require(_0x5ff2('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x5ff2('0x9')]=_[_0x5ff2('0xa')](config[_0x5ff2('0x9')],{'host':_0x5ff2('0xb'),'port':0x18eb});var socket=require(_0x5ff2('0xc'))(new Redis(config[_0x5ff2('0x9')]));require(_0x5ff2('0xd'))['register'](socket);function respondWithRpcPromise(_0x3e556c,_0x2f4aa2,_0x4b0323){return new BPromise(function(_0x24c871,_0xf5d7cd){return client[_0x5ff2('0xe')](_0x3e556c,_0x4b0323)['then'](function(_0x14ea58){logger[_0x5ff2('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x2f4aa2,_0x5ff2('0x10'));logger['debug'](_0x5ff2('0x11'),_0x2f4aa2,_0x5ff2('0x10'),JSON['stringify'](_0x14ea58));if(_0x14ea58['error']){if(_0x14ea58[_0x5ff2('0x12')][_0x5ff2('0x13')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x2f4aa2,_0x14ea58[_0x5ff2('0x12')][_0x5ff2('0x14')]);return _0xf5d7cd(_0x14ea58[_0x5ff2('0x12')][_0x5ff2('0x14')]);}logger[_0x5ff2('0x12')](_0x5ff2('0x15'),_0x2f4aa2,_0x14ea58[_0x5ff2('0x12')][_0x5ff2('0x14')]);return _0x24c871(_0x14ea58[_0x5ff2('0x12')][_0x5ff2('0x14')]);}else{logger[_0x5ff2('0xf')](_0x5ff2('0x15'),_0x2f4aa2,_0x5ff2('0x10'));_0x24c871(_0x14ea58[_0x5ff2('0x16')][_0x5ff2('0x14')]);}})[_0x5ff2('0x17')](function(_0x426bb8){logger['error'](_0x5ff2('0x15'),_0x2f4aa2,_0x426bb8);_0xf5d7cd(_0x426bb8);});});}exports[_0x5ff2('0x18')]=function(_0x330bbd){var _0x2c4a1e=this;return new Promise(function(_0x327c1e,_0x55fa43){return db[_0x5ff2('0x19')][_0x5ff2('0x1a')]({'raw':_0x330bbd['options']?_0x330bbd['options'][_0x5ff2('0x1b')]===undefined?!![]:![]:!![],'where':_0x330bbd['options']?_0x330bbd['options']['where']||null:null,'attributes':_0x330bbd['options']?_0x330bbd[_0x5ff2('0x1c')][_0x5ff2('0x1d')]||null:null,'limit':_0x330bbd[_0x5ff2('0x1c')]?_0x330bbd[_0x5ff2('0x1c')][_0x5ff2('0x1e')]||null:null,'include':_0x330bbd[_0x5ff2('0x1c')]?_0x330bbd[_0x5ff2('0x1c')][_0x5ff2('0x1f')]?_['map'](_0x330bbd[_0x5ff2('0x1c')][_0x5ff2('0x1f')],function(_0x2aefd0){return{'model':db[_0x2aefd0[_0x5ff2('0x20')]],'as':_0x2aefd0['as'],'attributes':_0x2aefd0[_0x5ff2('0x1d')],'include':_0x2aefd0[_0x5ff2('0x1f')]?_[_0x5ff2('0x21')](_0x2aefd0[_0x5ff2('0x1f')],function(_0x322eb6){return{'model':db[_0x322eb6['model']],'as':_0x322eb6['as'],'attributes':_0x322eb6[_0x5ff2('0x1d')],'include':_0x322eb6['include']?_[_0x5ff2('0x21')](_0x322eb6[_0x5ff2('0x1f')],function(_0x43a249){return{'model':db[_0x43a249[_0x5ff2('0x20')]],'as':_0x43a249['as'],'attributes':_0x43a249[_0x5ff2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5ff2('0x22')](function(_0x5324db){logger[_0x5ff2('0xf')](_0x5ff2('0x18'),_0x330bbd);logger[_0x5ff2('0x23')](_0x5ff2('0x18'),_0x330bbd,JSON[_0x5ff2('0x24')](_0x5324db));_0x327c1e(_0x5324db);})['catch'](function(_0x465e7c){logger[_0x5ff2('0x12')](_0x5ff2('0x18'),_0x465e7c['message'],_0x330bbd);_0x55fa43(_0x2c4a1e[_0x5ff2('0x12')](0x1f4,_0x465e7c[_0x5ff2('0x14')]));});});};exports[_0x5ff2('0x25')]=function(_0x1589f5){var _0x27d644=this;return new Promise(function(_0x500e3a,_0x3434ec){return db[_0x5ff2('0x19')][_0x5ff2('0x26')](_0x1589f5['body'],{'raw':_0x1589f5[_0x5ff2('0x1c')]?_0x1589f5[_0x5ff2('0x1c')][_0x5ff2('0x1b')]===undefined?!![]:![]:!![]})[_0x5ff2('0x22')](function(_0x294968){logger[_0x5ff2('0xf')](_0x5ff2('0x25'),_0x1589f5);logger[_0x5ff2('0x23')]('CreateVoiceQueueReport',_0x1589f5,JSON['stringify'](_0x294968));_0x500e3a(_0x294968);})[_0x5ff2('0x17')](function(_0x22b09d){logger['error'](_0x5ff2('0x25'),_0x22b09d['message'],_0x1589f5);_0x3434ec(_0x27d644[_0x5ff2('0x12')](0x1f4,_0x22b09d[_0x5ff2('0x14')]));});});};exports[_0x5ff2('0x27')]=function(_0x389c60){var _0x3679dd=this;return new Promise(function(_0x161c9b,_0x174bc1){return db[_0x5ff2('0x19')][_0x5ff2('0x28')](_0x389c60[_0x5ff2('0x29')],{'raw':_0x389c60[_0x5ff2('0x1c')]?_0x389c60['options'][_0x5ff2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x389c60[_0x5ff2('0x1c')]?_0x389c60[_0x5ff2('0x1c')][_0x5ff2('0x2a')]||null:null,'attributes':_0x389c60[_0x5ff2('0x1c')]?_0x389c60[_0x5ff2('0x1c')][_0x5ff2('0x1d')]||null:null,'limit':_0x389c60['options']?_0x389c60['options'][_0x5ff2('0x1e')]||null:null})['then'](function(_0x10d5ac){logger[_0x5ff2('0xf')]('UpdateVoiceQueueReport',_0x389c60);logger[_0x5ff2('0x23')](_0x5ff2('0x27'),_0x389c60,JSON[_0x5ff2('0x24')](_0x10d5ac));_0x161c9b(_0x10d5ac);})['catch'](function(_0x2187ef){logger[_0x5ff2('0x12')]('UpdateVoiceQueueReport',_0x2187ef['message'],_0x389c60);_0x174bc1(_0x3679dd[_0x5ff2('0x12')](0x1f4,_0x2187ef[_0x5ff2('0x14')]));});});}; \ No newline at end of file +var _0xcd30=['redis','defaults','socket.io-emitter','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','map','include','model','attributes','catch','create','body','raw','CreateVoiceQueueReport','update','limit','UpdateVoiceQueueReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4847c3,_0x45f8aa){var _0x14822e=function(_0x52b941){while(--_0x52b941){_0x4847c3['push'](_0x4847c3['shift']());}};_0x14822e(++_0x45f8aa);}(_0xcd30,0xbd));var _0x0cd3=function(_0x500923,_0x3689d9){_0x500923=_0x500923-0x0;var _0x4c4e33=_0xcd30[_0x500923];return _0x4c4e33;};'use strict';var _=require(_0x0cd3('0x0'));var util=require(_0x0cd3('0x1'));var moment=require('moment');var BPromise=require(_0x0cd3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0cd3('0x3'));var db=require(_0x0cd3('0x4'))['db'];var utils=require(_0x0cd3('0x5'));var logger=require(_0x0cd3('0x6'))(_0x0cd3('0x7'));var config=require(_0x0cd3('0x8'));var jayson=require(_0x0cd3('0x9'));var client=jayson['client'][_0x0cd3('0xa')]({'port':0x232a});config[_0x0cd3('0xb')]=_[_0x0cd3('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0cd3('0xd'))(new Redis(config[_0x0cd3('0xb')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithRpcPromise(_0x545261,_0x81e2ec,_0x32a9df){return new BPromise(function(_0x2aea78,_0x2dda01){return client[_0x0cd3('0xe')](_0x545261,_0x32a9df)[_0x0cd3('0xf')](function(_0x2a4e8e){logger[_0x0cd3('0x10')](_0x0cd3('0x11'),_0x81e2ec,_0x0cd3('0x12'));logger[_0x0cd3('0x13')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x81e2ec,_0x0cd3('0x12'),JSON[_0x0cd3('0x14')](_0x2a4e8e));if(_0x2a4e8e[_0x0cd3('0x15')]){if(_0x2a4e8e['error']['code']===0x1f4){logger[_0x0cd3('0x15')](_0x0cd3('0x11'),_0x81e2ec,_0x2a4e8e['error'][_0x0cd3('0x16')]);return _0x2dda01(_0x2a4e8e[_0x0cd3('0x15')][_0x0cd3('0x16')]);}logger[_0x0cd3('0x15')](_0x0cd3('0x11'),_0x81e2ec,_0x2a4e8e[_0x0cd3('0x15')][_0x0cd3('0x16')]);return _0x2aea78(_0x2a4e8e[_0x0cd3('0x15')]['message']);}else{logger[_0x0cd3('0x10')](_0x0cd3('0x11'),_0x81e2ec,_0x0cd3('0x12'));_0x2aea78(_0x2a4e8e[_0x0cd3('0x17')][_0x0cd3('0x16')]);}})['catch'](function(_0x4a1207){logger[_0x0cd3('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x81e2ec,_0x4a1207);_0x2dda01(_0x4a1207);});});}exports[_0x0cd3('0x18')]=function(_0x24e65a){var _0x55e257=this;return new Promise(function(_0x583d11,_0x7ebff0){return db[_0x0cd3('0x19')][_0x0cd3('0x1a')]({'raw':_0x24e65a['options']?_0x24e65a[_0x0cd3('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x24e65a['options']?_0x24e65a[_0x0cd3('0x1b')]['where']||null:null,'attributes':_0x24e65a[_0x0cd3('0x1b')]?_0x24e65a[_0x0cd3('0x1b')]['attributes']||null:null,'limit':_0x24e65a[_0x0cd3('0x1b')]?_0x24e65a[_0x0cd3('0x1b')]['limit']||null:null,'include':_0x24e65a[_0x0cd3('0x1b')]?_0x24e65a[_0x0cd3('0x1b')]['include']?_[_0x0cd3('0x1c')](_0x24e65a[_0x0cd3('0x1b')][_0x0cd3('0x1d')],function(_0x46d6bb){return{'model':db[_0x46d6bb[_0x0cd3('0x1e')]],'as':_0x46d6bb['as'],'attributes':_0x46d6bb[_0x0cd3('0x1f')],'include':_0x46d6bb[_0x0cd3('0x1d')]?_['map'](_0x46d6bb[_0x0cd3('0x1d')],function(_0x2acdec){return{'model':db[_0x2acdec[_0x0cd3('0x1e')]],'as':_0x2acdec['as'],'attributes':_0x2acdec[_0x0cd3('0x1f')],'include':_0x2acdec[_0x0cd3('0x1d')]?_[_0x0cd3('0x1c')](_0x2acdec['include'],function(_0x5c4963){return{'model':db[_0x5c4963[_0x0cd3('0x1e')]],'as':_0x5c4963['as'],'attributes':_0x5c4963[_0x0cd3('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0cd3('0xf')](function(_0x4bc2b2){logger[_0x0cd3('0x10')](_0x0cd3('0x18'),_0x24e65a);logger[_0x0cd3('0x13')](_0x0cd3('0x18'),_0x24e65a,JSON['stringify'](_0x4bc2b2));_0x583d11(_0x4bc2b2);})[_0x0cd3('0x20')](function(_0x533f0c){logger[_0x0cd3('0x15')](_0x0cd3('0x18'),_0x533f0c[_0x0cd3('0x16')],_0x24e65a);_0x7ebff0(_0x55e257[_0x0cd3('0x15')](0x1f4,_0x533f0c[_0x0cd3('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x13333b){var _0x1b48d8=this;return new Promise(function(_0x5c26b5,_0x425772){return db[_0x0cd3('0x19')][_0x0cd3('0x21')](_0x13333b[_0x0cd3('0x22')],{'raw':_0x13333b[_0x0cd3('0x1b')]?_0x13333b[_0x0cd3('0x1b')][_0x0cd3('0x23')]===undefined?!![]:![]:!![]})[_0x0cd3('0xf')](function(_0x21d63b){logger['info'](_0x0cd3('0x24'),_0x13333b);logger[_0x0cd3('0x13')](_0x0cd3('0x24'),_0x13333b,JSON['stringify'](_0x21d63b));_0x5c26b5(_0x21d63b);})['catch'](function(_0xfea59c){logger[_0x0cd3('0x15')](_0x0cd3('0x24'),_0xfea59c[_0x0cd3('0x16')],_0x13333b);_0x425772(_0x1b48d8[_0x0cd3('0x15')](0x1f4,_0xfea59c[_0x0cd3('0x16')]));});});};exports['UpdateVoiceQueueReport']=function(_0x4b99d3){var _0x595459=this;return new Promise(function(_0x8aab55,_0x182de3){return db[_0x0cd3('0x19')][_0x0cd3('0x25')](_0x4b99d3[_0x0cd3('0x22')],{'raw':_0x4b99d3[_0x0cd3('0x1b')]?_0x4b99d3[_0x0cd3('0x1b')][_0x0cd3('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b99d3[_0x0cd3('0x1b')]?_0x4b99d3[_0x0cd3('0x1b')]['where']||null:null,'attributes':_0x4b99d3[_0x0cd3('0x1b')]?_0x4b99d3[_0x0cd3('0x1b')]['attributes']||null:null,'limit':_0x4b99d3[_0x0cd3('0x1b')]?_0x4b99d3['options'][_0x0cd3('0x26')]||null:null})[_0x0cd3('0xf')](function(_0x4a5f6b){logger['info'](_0x0cd3('0x27'),_0x4b99d3);logger[_0x0cd3('0x13')](_0x0cd3('0x27'),_0x4b99d3,JSON[_0x0cd3('0x14')](_0x4a5f6b));_0x8aab55(_0x4a5f6b);})[_0x0cd3('0x20')](function(_0x2e911a){logger['error']('UpdateVoiceQueueReport',_0x2e911a[_0x0cd3('0x16')],_0x4b99d3);_0x182de3(_0x595459['error'](0x1f4,_0x2e911a[_0x0cd3('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index e86aa95..14d5a8e 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 _0x2fda=['./voiceQueueReport.events','update','emit','register','length','voiceQueueReport:'];(function(_0x1c79c5,_0x3cc84c){var _0x558010=function(_0x488739){while(--_0x488739){_0x1c79c5['push'](_0x1c79c5['shift']());}};_0x558010(++_0x3cc84c);}(_0x2fda,0x186));var _0xa2fd=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0x2fda[_0x55f8b4];return _0x2475f9;};'use strict';var VoiceQueueReportEvents=require(_0xa2fd('0x0'));var events=['save','remove',_0xa2fd('0x1')];function createListener(_0x3042fc,_0x25ffbf){return function(_0x329784){_0x25ffbf[_0xa2fd('0x2')](_0x3042fc,_0x329784);};}function removeListener(_0x5a36d9,_0x497c5f){return function(){VoiceQueueReportEvents['removeListener'](_0x5a36d9,_0x497c5f);};}exports[_0xa2fd('0x3')]=function(_0x1bab5a){for(var _0x4c6b0b=0x0,_0x11994b=events[_0xa2fd('0x4')];_0x4c6b0b<_0x11994b;_0x4c6b0b++){var _0x290063=events[_0x4c6b0b];var _0x4abb3a=createListener(_0xa2fd('0x5')+_0x290063,_0x1bab5a);VoiceQueueReportEvents['on'](_0x290063,_0x4abb3a);}}; \ No newline at end of file +var _0x9752=['emit','removeListener','register','voiceQueueReport:','save','remove','update'];(function(_0x1ff0c1,_0x31a16d){var _0x4d72bf=function(_0x1bc246){while(--_0x1bc246){_0x1ff0c1['push'](_0x1ff0c1['shift']());}};_0x4d72bf(++_0x31a16d);}(_0x9752,0x90));var _0x2975=function(_0x5f5183,_0x12c602){_0x5f5183=_0x5f5183-0x0;var _0x3948e9=_0x9752[_0x5f5183];return _0x3948e9;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x2975('0x0'),_0x2975('0x1'),_0x2975('0x2')];function createListener(_0x339e5e,_0x586021){return function(_0xd14963){_0x586021[_0x2975('0x3')](_0x339e5e,_0xd14963);};}function removeListener(_0x3ab330,_0x43c0a8){return function(){VoiceQueueReportEvents[_0x2975('0x4')](_0x3ab330,_0x43c0a8);};}exports[_0x2975('0x5')]=function(_0x8d643d){for(var _0x288fbd=0x0,_0x3183f1=events['length'];_0x288fbd<_0x3183f1;_0x288fbd++){var _0x404fb1=events[_0x288fbd];var _0x309302=createListener(_0x2975('0x6')+_0x404fb1,_0x8d643d);VoiceQueueReportEvents['on'](_0x404fb1,_0x309302);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 182b5cf..4f2b123 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 _0xacc8=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','index','isAuthenticated','post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0xacc8,0xc5));var _0x8acc=function(_0x367a3d,_0x452717){_0x367a3d=_0x367a3d-0x0;var _0x460539=_0xacc8[_0x367a3d];return _0x460539;};'use strict';var multer=require(_0x8acc('0x0'));var util=require('util');var path=require(_0x8acc('0x1'));var timeout=require(_0x8acc('0x2'));var express=require(_0x8acc('0x3'));var router=express[_0x8acc('0x4')]();var fs_extra=require(_0x8acc('0x5'));var auth=require(_0x8acc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8acc('0x7'));var controller=require(_0x8acc('0x8'));router[_0x8acc('0x9')]('/',auth['isAuthenticated'](),controller[_0x8acc('0xa')]);router['get']('/:id',auth[_0x8acc('0xb')](),controller['show']);router[_0x8acc('0xc')]('/',auth['isAuthenticated'](),controller[_0x8acc('0xd')]);router[_0x8acc('0xe')]('/:id',auth[_0x8acc('0xb')](),controller[_0x8acc('0xf')]);router[_0x8acc('0x10')](_0x8acc('0x11'),auth[_0x8acc('0xb')](),controller[_0x8acc('0x12')]);module[_0x8acc('0x13')]=router; \ No newline at end of file +var _0xeeea=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xeeea,0x1a3));var _0xaeee=function(_0x1e0688,_0x1b335c){_0x1e0688=_0x1e0688-0x0;var _0x483687=_0xeeea[_0x1e0688];return _0x483687;};'use strict';var multer=require(_0xaeee('0x0'));var util=require(_0xaeee('0x1'));var path=require(_0xaeee('0x2'));var timeout=require(_0xaeee('0x3'));var express=require(_0xaeee('0x4'));var router=express[_0xaeee('0x5')]();var fs_extra=require(_0xaeee('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xaeee('0x7'));var config=require(_0xaeee('0x8'));var controller=require(_0xaeee('0x9'));router[_0xaeee('0xa')]('/',auth[_0xaeee('0xb')](),controller[_0xaeee('0xc')]);router[_0xaeee('0xa')](_0xaeee('0xd'),auth[_0xaeee('0xb')](),controller[_0xaeee('0xe')]);router[_0xaeee('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xaeee('0x10')]('/:id',auth[_0xaeee('0xb')](),controller[_0xaeee('0x11')]);router[_0xaeee('0x12')](_0xaeee('0xd'),auth[_0xaeee('0xb')](),controller[_0xaeee('0x13')]);module[_0xaeee('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 717341f..6f799d3 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 _0x7c3d=['sequelize','moment','exports','STRING','literal'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7c3d,0x73));var _0xd7c3=function(_0x1b9629,_0x5554b4){_0x1b9629=_0x1b9629-0x0;var _0x4ade3a=_0x7c3d[_0x1b9629];return _0x4ade3a;};'use strict';var Sequelize=require(_0xd7c3('0x0'));var moment=require(_0xd7c3('0x1'));module[_0xd7c3('0x2')]={'time':{'type':Sequelize[_0xd7c3('0x3')]},'callid':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xd7c3('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xd7c3('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x2f25=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x57fcc0,_0x585004){var _0x5270df=function(_0x5f2db0){while(--_0x5f2db0){_0x57fcc0['push'](_0x57fcc0['shift']());}};_0x5270df(++_0x585004);}(_0x2f25,0x1e7));var _0x52f2=function(_0x15bb83,_0x248a8f){_0x15bb83=_0x15bb83-0x0;var _0x17e30f=_0x2f25[_0x15bb83];return _0x17e30f;};'use strict';var Sequelize=require(_0x52f2('0x0'));var moment=require(_0x52f2('0x1'));module[_0x52f2('0x2')]={'time':{'type':Sequelize[_0x52f2('0x3')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x52f2('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x52f2('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x52f2('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x52f2('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x52f2('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x52f2('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x52f2('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x52f2('0x5')](_0x52f2('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4a984a9..d1a5184 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 _0x10a4=['filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueuesLog','then','include','findAll','show','params','create','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','sendStatus','name','map','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x3169e0,_0x1c21d0){var _0x5a1959=function(_0x1feeb6){while(--_0x1feeb6){_0x3169e0['push'](_0x3169e0['shift']());}};_0x5a1959(++_0x1c21d0);}(_0x10a4,0xe7));var _0x410a=function(_0x2f57b2,_0xa8e91a){_0x2f57b2=_0x2f57b2-0x0;var _0x5ace77=_0x10a4[_0x2f57b2];return _0x5ace77;};'use strict';var emlformat=require(_0x410a('0x0'));var rimraf=require(_0x410a('0x1'));var zipdir=require(_0x410a('0x2'));var jsonpatch=require(_0x410a('0x3'));var rp=require(_0x410a('0x4'));var moment=require('moment');var BPromise=require(_0x410a('0x5'));var Mustache=require(_0x410a('0x6'));var util=require(_0x410a('0x7'));var path=require(_0x410a('0x8'));var sox=require('sox');var csv=require(_0x410a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x410a('0xa'));var _=require(_0x410a('0xb'));var squel=require('squel');var crypto=require(_0x410a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x410a('0xd'));var Papa=require('papaparse');var Redis=require(_0x410a('0xe'));var authService=require(_0x410a('0xf'));var qs=require(_0x410a('0x10'));var as=require(_0x410a('0x11'));var hardwareService=require(_0x410a('0x12'));var logger=require('../../config/logger')(_0x410a('0x13'));var utils=require(_0x410a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x410a('0x15'));var db=require(_0x410a('0x16'))['db'];function respondWithStatusCode(_0x14bfed,_0xba5770){_0xba5770=_0xba5770||0xcc;return function(_0x24aa10){if(_0x24aa10){return _0x14bfed['sendStatus'](_0xba5770);}return _0x14bfed[_0x410a('0x17')](_0xba5770)[_0x410a('0x18')]();};}function respondWithResult(_0xcbb6aa,_0x4552d4){_0x4552d4=_0x4552d4||0xc8;return function(_0x30e845){if(_0x30e845){return _0xcbb6aa[_0x410a('0x17')](_0x4552d4)[_0x410a('0x19')](_0x30e845);}};}function respondWithFilteredResult(_0x461177,_0x2b0827){return function(_0x16b985){if(_0x16b985){var _0x5dec7c=typeof _0x2b0827[_0x410a('0x1a')]===_0x410a('0x1b')&&typeof _0x2b0827['limit']===_0x410a('0x1b');var _0x369b15=_0x16b985[_0x410a('0x1c')];var _0x17cc70=_0x5dec7c?0x0:_0x2b0827[_0x410a('0x1a')];var _0x2b1784=_0x5dec7c?_0x16b985[_0x410a('0x1c')]:_0x2b0827['offset']+_0x2b0827[_0x410a('0x1d')];var _0x265e29;if(_0x2b1784>=_0x369b15){_0x2b1784=_0x369b15;_0x265e29=0xc8;}else{_0x265e29=0xce;}_0x461177[_0x410a('0x17')](_0x265e29);return _0x461177[_0x410a('0x1e')](_0x410a('0x1f'),_0x17cc70+'-'+_0x2b1784+'/'+_0x369b15)['json'](_0x16b985);}return null;};}function patchUpdates(_0x49239a){return function(_0x14b015){try{jsonpatch[_0x410a('0x20')](_0x14b015,_0x49239a,!![]);}catch(_0x44a4bb){return BPromise[_0x410a('0x21')](_0x44a4bb);}return _0x14b015[_0x410a('0x22')]();};}function saveUpdates(_0x4abd3d,_0x437578){return function(_0x4679ae){if(_0x4679ae){return _0x4679ae['update'](_0x4abd3d)['then'](function(_0x1f669e){return _0x1f669e;});}return null;};}function removeEntity(_0x387a41,_0xf0d694){return function(_0x2fcb95){if(_0x2fcb95){return _0x2fcb95['destroy']()['then'](function(){_0x387a41[_0x410a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c1300,_0x454740){return function(_0x309367){if(!_0x309367){_0x4c1300[_0x410a('0x23')](0x194);}return _0x309367;};}function handleError(_0x2e9773,_0x5f15d6){_0x5f15d6=_0x5f15d6||0x1f4;return function(_0x59b8ab){logger['error'](_0x59b8ab['stack']);if(_0x59b8ab[_0x410a('0x24')]){delete _0x59b8ab[_0x410a('0x24')];}_0x2e9773[_0x410a('0x17')](_0x5f15d6)['send'](_0x59b8ab);};}exports['index']=function(_0x6d4392,_0x2dca6b){var _0x1cb16b={},_0x277523={},_0x4e8fa4={'count':0x0,'rows':[]};var _0xec5ff2=_[_0x410a('0x25')](db['VoiceQueuesLog'][_0x410a('0x26')],function(_0xae660){return{'name':_0xae660[_0x410a('0x27')],'type':_0xae660[_0x410a('0x28')][_0x410a('0x29')]};});_0x277523[_0x410a('0x2a')]=_['map'](_0xec5ff2,_0x410a('0x24'));_0x277523[_0x410a('0x2b')]=_[_0x410a('0x2c')](_0x6d4392['query']);_0x277523[_0x410a('0x2d')]=_[_0x410a('0x2e')](_0x277523[_0x410a('0x2a')],_0x277523['query']);_0x1cb16b[_0x410a('0x2f')]=_['intersection'](_0x277523['model'],qs[_0x410a('0x30')](_0x6d4392['query'][_0x410a('0x30')]));_0x1cb16b[_0x410a('0x2f')]=_0x1cb16b[_0x410a('0x2f')][_0x410a('0x31')]?_0x1cb16b[_0x410a('0x2f')]:_0x277523[_0x410a('0x2a')];if(!_0x6d4392['query']['hasOwnProperty']('nolimit')){_0x1cb16b[_0x410a('0x1d')]=qs[_0x410a('0x1d')](_0x6d4392[_0x410a('0x2b')][_0x410a('0x1d')]);_0x1cb16b[_0x410a('0x1a')]=qs[_0x410a('0x1a')](_0x6d4392[_0x410a('0x2b')][_0x410a('0x1a')]);}_0x1cb16b[_0x410a('0x32')]=qs[_0x410a('0x33')](_0x6d4392[_0x410a('0x2b')][_0x410a('0x33')]);_0x1cb16b[_0x410a('0x34')]=qs[_0x410a('0x2d')](_[_0x410a('0x35')](_0x6d4392['query'],_0x277523[_0x410a('0x2d')]),_0xec5ff2);if(_0x6d4392[_0x410a('0x2b')]['filter']){_0x1cb16b['where']=_[_0x410a('0x36')](_0x1cb16b[_0x410a('0x34')],{'$or':_['map'](_0xec5ff2,function(_0x4ad7b5){if(_0x4ad7b5[_0x410a('0x28')]!==_0x410a('0x37')){var _0x50d1f3={};_0x50d1f3[_0x4ad7b5[_0x410a('0x24')]]={'$like':'%'+_0x6d4392[_0x410a('0x2b')][_0x410a('0x38')]+'%'};return _0x50d1f3;}})});}_0x1cb16b=_['merge']({},_0x1cb16b,_0x6d4392[_0x410a('0x39')]);var _0x264f0b={'where':_0x1cb16b['where']};return db[_0x410a('0x3a')][_0x410a('0x1c')](_0x264f0b)[_0x410a('0x3b')](function(_0x4abf6e){_0x4e8fa4['count']=_0x4abf6e;if(_0x6d4392[_0x410a('0x2b')]['includeAll']){_0x1cb16b[_0x410a('0x3c')]=[{'all':!![]}];}return db[_0x410a('0x3a')][_0x410a('0x3d')](_0x1cb16b);})[_0x410a('0x3b')](function(_0x2109c3){_0x4e8fa4['rows']=_0x2109c3;return _0x4e8fa4;})[_0x410a('0x3b')](respondWithFilteredResult(_0x2dca6b,_0x1cb16b))['catch'](handleError(_0x2dca6b,null));};exports[_0x410a('0x3e')]=function(_0x2c2921,_0x2a43e7){var _0x5541f0={'raw':!![],'where':{'id':_0x2c2921[_0x410a('0x3f')]['id']}},_0x45c359={};_0x45c359['model']=_[_0x410a('0x2c')](db['VoiceQueuesLog'][_0x410a('0x26')]);_0x45c359[_0x410a('0x2b')]=_['keys'](_0x2c2921['query']);_0x45c359['filters']=_[_0x410a('0x2e')](_0x45c359[_0x410a('0x2a')],_0x45c359['query']);_0x5541f0[_0x410a('0x2f')]=_[_0x410a('0x2e')](_0x45c359[_0x410a('0x2a')],qs[_0x410a('0x30')](_0x2c2921[_0x410a('0x2b')][_0x410a('0x30')]));_0x5541f0['attributes']=_0x5541f0[_0x410a('0x2f')][_0x410a('0x31')]?_0x5541f0['attributes']:_0x45c359[_0x410a('0x2a')];if(_0x2c2921[_0x410a('0x2b')]['includeAll']){_0x5541f0['include']=[{'all':!![]}];}_0x5541f0=_[_0x410a('0x36')]({},_0x5541f0,_0x2c2921[_0x410a('0x39')]);return db[_0x410a('0x3a')]['find'](_0x5541f0)['then'](handleEntityNotFound(_0x2a43e7,null))['then'](respondWithResult(_0x2a43e7,null))['catch'](handleError(_0x2a43e7,null));};exports[_0x410a('0x40')]=function(_0x3bf691,_0xe742ab){return db[_0x410a('0x3a')]['create'](_0x3bf691['body'],{})[_0x410a('0x3b')](respondWithResult(_0xe742ab,0xc9))[_0x410a('0x41')](handleError(_0xe742ab,null));};exports[_0x410a('0x42')]=function(_0x20e0b0,_0x4831ed){if(_0x20e0b0[_0x410a('0x43')]['id']){delete _0x20e0b0[_0x410a('0x43')]['id'];}return db[_0x410a('0x3a')]['find']({'where':{'id':_0x20e0b0[_0x410a('0x3f')]['id']}})[_0x410a('0x3b')](handleEntityNotFound(_0x4831ed,null))[_0x410a('0x3b')](saveUpdates(_0x20e0b0[_0x410a('0x43')],null))[_0x410a('0x3b')](respondWithResult(_0x4831ed,null))[_0x410a('0x41')](handleError(_0x4831ed,null));};exports['destroy']=function(_0x324058,_0x472d6e){return db[_0x410a('0x3a')][_0x410a('0x44')]({'where':{'id':_0x324058[_0x410a('0x3f')]['id']}})[_0x410a('0x3b')](handleEntityNotFound(_0x472d6e,null))[_0x410a('0x3b')](removeEntity(_0x472d6e,null))['catch'](handleError(_0x472d6e,null));}; \ No newline at end of file +var _0xd72a=['offset','set','apply','reject','update','then','error','stack','name','send','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','length','create','body','find','destroy','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count'];(function(_0x5a4212,_0x52ddbc){var _0x44f62b=function(_0x516320){while(--_0x516320){_0x5a4212['push'](_0x5a4212['shift']());}};_0x44f62b(++_0x52ddbc);}(_0xd72a,0x1e8));var _0xad72=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xd72a[_0x33032e];return _0x13316b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad72('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xad72('0x1'));var rp=require('request-promise');var moment=require(_0xad72('0x2'));var BPromise=require(_0xad72('0x3'));var Mustache=require(_0xad72('0x4'));var util=require('util');var path=require(_0xad72('0x5'));var sox=require(_0xad72('0x6'));var csv=require(_0xad72('0x7'));var ejs=require(_0xad72('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xad72('0x9'));var crypto=require(_0xad72('0xa'));var jsforce=require(_0xad72('0xb'));var deskjs=require(_0xad72('0xc'));var toCsv=require(_0xad72('0x7'));var querystring=require(_0xad72('0xd'));var Papa=require(_0xad72('0xe'));var Redis=require(_0xad72('0xf'));var authService=require(_0xad72('0x10'));var qs=require(_0xad72('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad72('0x12'));var logger=require('../../config/logger')(_0xad72('0x13'));var utils=require('../../config/utils');var config=require(_0xad72('0x14'));var licenseUtil=require(_0xad72('0x15'));var db=require(_0xad72('0x16'))['db'];function respondWithStatusCode(_0x537c80,_0x27b1c){_0x27b1c=_0x27b1c||0xcc;return function(_0x3f4af0){if(_0x3f4af0){return _0x537c80[_0xad72('0x17')](_0x27b1c);}return _0x537c80[_0xad72('0x18')](_0x27b1c)[_0xad72('0x19')]();};}function respondWithResult(_0xea6ec1,_0x296014){_0x296014=_0x296014||0xc8;return function(_0x3d6dde){if(_0x3d6dde){return _0xea6ec1[_0xad72('0x18')](_0x296014)[_0xad72('0x1a')](_0x3d6dde);}};}function respondWithFilteredResult(_0x229cbd,_0x33d191){return function(_0x2438d1){if(_0x2438d1){var _0x4d945e=typeof _0x33d191['offset']===_0xad72('0x1b')&&typeof _0x33d191[_0xad72('0x1c')]===_0xad72('0x1b');var _0x451804=_0x2438d1[_0xad72('0x1d')];var _0x2a1147=_0x4d945e?0x0:_0x33d191[_0xad72('0x1e')];var _0x58dd41=_0x4d945e?_0x2438d1['count']:_0x33d191[_0xad72('0x1e')]+_0x33d191[_0xad72('0x1c')];var _0x56f820;if(_0x58dd41>=_0x451804){_0x58dd41=_0x451804;_0x56f820=0xc8;}else{_0x56f820=0xce;}_0x229cbd[_0xad72('0x18')](_0x56f820);return _0x229cbd[_0xad72('0x1f')]('Content-Range',_0x2a1147+'-'+_0x58dd41+'/'+_0x451804)[_0xad72('0x1a')](_0x2438d1);}return null;};}function patchUpdates(_0x4488ba){return function(_0x1d8829){try{jsonpatch[_0xad72('0x20')](_0x1d8829,_0x4488ba,!![]);}catch(_0x42722a){return BPromise[_0xad72('0x21')](_0x42722a);}return _0x1d8829['save']();};}function saveUpdates(_0x135665,_0x15de79){return function(_0x1b06e9){if(_0x1b06e9){return _0x1b06e9[_0xad72('0x22')](_0x135665)[_0xad72('0x23')](function(_0x131f97){return _0x131f97;});}return null;};}function removeEntity(_0x1fb988,_0x34cd5f){return function(_0x967ab9){if(_0x967ab9){return _0x967ab9['destroy']()[_0xad72('0x23')](function(){_0x1fb988[_0xad72('0x18')](0xcc)[_0xad72('0x19')]();});}};}function handleEntityNotFound(_0x23ca7e,_0x822a68){return function(_0x487310){if(!_0x487310){_0x23ca7e[_0xad72('0x17')](0x194);}return _0x487310;};}function handleError(_0x7c3793,_0x2e75c7){_0x2e75c7=_0x2e75c7||0x1f4;return function(_0x321462){logger[_0xad72('0x24')](_0x321462[_0xad72('0x25')]);if(_0x321462[_0xad72('0x26')]){delete _0x321462[_0xad72('0x26')];}_0x7c3793[_0xad72('0x18')](_0x2e75c7)[_0xad72('0x27')](_0x321462);};}exports['index']=function(_0x555105,_0xde9010){var _0x9d5003={},_0x10610e={},_0xe5ad61={'count':0x0,'rows':[]};var _0x2564c3=_[_0xad72('0x28')](db[_0xad72('0x29')][_0xad72('0x2a')],function(_0x5dc284){return{'name':_0x5dc284[_0xad72('0x2b')],'type':_0x5dc284[_0xad72('0x2c')][_0xad72('0x2d')]};});_0x10610e[_0xad72('0x2e')]=_['map'](_0x2564c3,'name');_0x10610e[_0xad72('0x2f')]=_['keys'](_0x555105[_0xad72('0x2f')]);_0x10610e[_0xad72('0x30')]=_[_0xad72('0x31')](_0x10610e['model'],_0x10610e[_0xad72('0x2f')]);_0x9d5003[_0xad72('0x32')]=_[_0xad72('0x31')](_0x10610e[_0xad72('0x2e')],qs[_0xad72('0x33')](_0x555105['query'][_0xad72('0x33')]));_0x9d5003[_0xad72('0x32')]=_0x9d5003[_0xad72('0x32')]['length']?_0x9d5003[_0xad72('0x32')]:_0x10610e[_0xad72('0x2e')];if(!_0x555105[_0xad72('0x2f')]['hasOwnProperty'](_0xad72('0x34'))){_0x9d5003[_0xad72('0x1c')]=qs[_0xad72('0x1c')](_0x555105[_0xad72('0x2f')][_0xad72('0x1c')]);_0x9d5003[_0xad72('0x1e')]=qs[_0xad72('0x1e')](_0x555105[_0xad72('0x2f')][_0xad72('0x1e')]);}_0x9d5003[_0xad72('0x35')]=qs[_0xad72('0x36')](_0x555105['query'][_0xad72('0x36')]);_0x9d5003[_0xad72('0x37')]=qs[_0xad72('0x30')](_[_0xad72('0x38')](_0x555105[_0xad72('0x2f')],_0x10610e[_0xad72('0x30')]),_0x2564c3);if(_0x555105[_0xad72('0x2f')][_0xad72('0x39')]){_0x9d5003[_0xad72('0x37')]=_['merge'](_0x9d5003[_0xad72('0x37')],{'$or':_[_0xad72('0x28')](_0x2564c3,function(_0x9a42a1){if(_0x9a42a1['type']!==_0xad72('0x3a')){var _0x13c886={};_0x13c886[_0x9a42a1['name']]={'$like':'%'+_0x555105[_0xad72('0x2f')][_0xad72('0x39')]+'%'};return _0x13c886;}})});}_0x9d5003=_[_0xad72('0x3b')]({},_0x9d5003,_0x555105[_0xad72('0x3c')]);var _0x38bde0={'where':_0x9d5003[_0xad72('0x37')]};return db[_0xad72('0x29')][_0xad72('0x1d')](_0x38bde0)[_0xad72('0x23')](function(_0x216825){_0xe5ad61[_0xad72('0x1d')]=_0x216825;if(_0x555105[_0xad72('0x2f')][_0xad72('0x3d')]){_0x9d5003[_0xad72('0x3e')]=[{'all':!![]}];}return db[_0xad72('0x29')][_0xad72('0x3f')](_0x9d5003);})[_0xad72('0x23')](function(_0x8fd4cf){_0xe5ad61[_0xad72('0x40')]=_0x8fd4cf;return _0xe5ad61;})[_0xad72('0x23')](respondWithFilteredResult(_0xde9010,_0x9d5003))[_0xad72('0x41')](handleError(_0xde9010,null));};exports[_0xad72('0x42')]=function(_0x24e4f8,_0x35f93f){var _0x14bc9a={'raw':!![],'where':{'id':_0x24e4f8[_0xad72('0x43')]['id']}},_0x564100={};_0x564100[_0xad72('0x2e')]=_[_0xad72('0x44')](db[_0xad72('0x29')][_0xad72('0x2a')]);_0x564100[_0xad72('0x2f')]=_['keys'](_0x24e4f8['query']);_0x564100['filters']=_['intersection'](_0x564100['model'],_0x564100[_0xad72('0x2f')]);_0x14bc9a[_0xad72('0x32')]=_['intersection'](_0x564100[_0xad72('0x2e')],qs[_0xad72('0x33')](_0x24e4f8[_0xad72('0x2f')][_0xad72('0x33')]));_0x14bc9a[_0xad72('0x32')]=_0x14bc9a['attributes'][_0xad72('0x45')]?_0x14bc9a[_0xad72('0x32')]:_0x564100['model'];if(_0x24e4f8['query'][_0xad72('0x3d')]){_0x14bc9a[_0xad72('0x3e')]=[{'all':!![]}];}_0x14bc9a=_['merge']({},_0x14bc9a,_0x24e4f8['options']);return db['VoiceQueuesLog']['find'](_0x14bc9a)[_0xad72('0x23')](handleEntityNotFound(_0x35f93f,null))[_0xad72('0x23')](respondWithResult(_0x35f93f,null))[_0xad72('0x41')](handleError(_0x35f93f,null));};exports['create']=function(_0x2c7000,_0x29ee01){return db['VoiceQueuesLog'][_0xad72('0x46')](_0x2c7000[_0xad72('0x47')],{})[_0xad72('0x23')](respondWithResult(_0x29ee01,0xc9))['catch'](handleError(_0x29ee01,null));};exports[_0xad72('0x22')]=function(_0x2e2fda,_0x51e31a){if(_0x2e2fda[_0xad72('0x47')]['id']){delete _0x2e2fda[_0xad72('0x47')]['id'];}return db[_0xad72('0x29')][_0xad72('0x48')]({'where':{'id':_0x2e2fda[_0xad72('0x43')]['id']}})['then'](handleEntityNotFound(_0x51e31a,null))[_0xad72('0x23')](saveUpdates(_0x2e2fda[_0xad72('0x47')],null))[_0xad72('0x23')](respondWithResult(_0x51e31a,null))[_0xad72('0x41')](handleError(_0x51e31a,null));};exports[_0xad72('0x49')]=function(_0x4e8d39,_0x1e286f){return db['VoiceQueuesLog'][_0xad72('0x48')]({'where':{'id':_0x4e8d39[_0xad72('0x43')]['id']}})[_0xad72('0x23')](handleEntityNotFound(_0x1e286f,null))[_0xad72('0x23')](removeEntity(_0x1e286f,null))[_0xad72('0x41')](handleError(_0x1e286f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8221134..95cc3f2 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 _0x1f71=['exports','define','VoiceQueuesLog','event_dtm','dtm','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0x1f71,0xaa));var _0x11f7=function(_0x3db99d,_0x57332f){_0x3db99d=_0x3db99d-0x0;var _0x1151e4=_0x1f71[_0x3db99d];return _0x1151e4;};'use strict';var _=require('lodash');var util=require(_0x11f7('0x0'));var logger=require(_0x11f7('0x1'))(_0x11f7('0x2'));var moment=require(_0x11f7('0x3'));var BPromise=require(_0x11f7('0x4'));var rp=require(_0x11f7('0x5'));var fs=require('fs');var path=require(_0x11f7('0x6'));var rimraf=require(_0x11f7('0x7'));var config=require(_0x11f7('0x8'));var attributes=require(_0x11f7('0x9'));module[_0x11f7('0xa')]=function(_0x5110aa,_0x48f717){return _0x5110aa[_0x11f7('0xb')](_0x11f7('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x11f7('0xd'),'fields':['event',_0x11f7('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x0ae5=['path','rimraf','./voiceQueuesLog.attributes','voice_queues_log','event_dtm','dtm','lodash','util','../../config/logger','api','bluebird'];(function(_0x45d80c,_0x35c0ff){var _0x449a98=function(_0x1b5ab7){while(--_0x1b5ab7){_0x45d80c['push'](_0x45d80c['shift']());}};_0x449a98(++_0x35c0ff);}(_0x0ae5,0x1a8));var _0x50ae=function(_0x4ed798,_0x248054){_0x4ed798=_0x4ed798-0x0;var _0x1c3572=_0x0ae5[_0x4ed798];return _0x1c3572;};'use strict';var _=require(_0x50ae('0x0'));var util=require(_0x50ae('0x1'));var logger=require(_0x50ae('0x2'))(_0x50ae('0x3'));var moment=require('moment');var BPromise=require(_0x50ae('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x50ae('0x5'));var rimraf=require(_0x50ae('0x6'));var config=require('../../config/environment');var attributes=require(_0x50ae('0x7'));module['exports']=function(_0x27a756,_0x4475cd){return _0x27a756['define']('VoiceQueuesLog',attributes,{'tableName':_0x50ae('0x8'),'paranoid':![],'indexes':[{'name':_0x50ae('0x9'),'fields':['event',_0x50ae('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index bb67c9d..c97696b 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 _0x0922=['jayson/promise','client','http','request','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','code','message','VoiceQueuesLog,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/environment'];(function(_0x3ec5c4,_0x310d2d){var _0xb4c6b2=function(_0xbca717){while(--_0xbca717){_0x3ec5c4['push'](_0x3ec5c4['shift']());}};_0xb4c6b2(++_0x310d2d);}(_0x0922,0x77));var _0x2092=function(_0x9d639c,_0x524dbe){_0x9d639c=_0x9d639c-0x0;var _0x1671de=_0x0922[_0x9d639c];return _0x1671de;};'use strict';var _=require(_0x2092('0x0'));var util=require(_0x2092('0x1'));var moment=require(_0x2092('0x2'));var BPromise=require(_0x2092('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2092('0x4'));var db=require(_0x2092('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2092('0x6'));var jayson=require(_0x2092('0x7'));var client=jayson[_0x2092('0x8')][_0x2092('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c0f2b,_0x342602,_0x5472a0){return new BPromise(function(_0x3f0460,_0x36f231){return client[_0x2092('0xa')](_0x4c0f2b,_0x5472a0)['then'](function(_0x3931e3){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x342602,_0x2092('0xb'));logger[_0x2092('0xc')](_0x2092('0xd'),_0x342602,'request\x20sent',JSON['stringify'](_0x3931e3));if(_0x3931e3[_0x2092('0xe')]){if(_0x3931e3[_0x2092('0xe')][_0x2092('0xf')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x342602,_0x3931e3[_0x2092('0xe')][_0x2092('0x10')]);return _0x36f231(_0x3931e3[_0x2092('0xe')][_0x2092('0x10')]);}logger['error'](_0x2092('0x11'),_0x342602,_0x3931e3[_0x2092('0xe')][_0x2092('0x10')]);return _0x3f0460(_0x3931e3[_0x2092('0xe')][_0x2092('0x10')]);}else{logger[_0x2092('0x12')](_0x2092('0x11'),_0x342602,_0x2092('0xb'));_0x3f0460(_0x3931e3[_0x2092('0x13')]['message']);}})[_0x2092('0x14')](function(_0x5d9938){logger[_0x2092('0xe')](_0x2092('0x11'),_0x342602,_0x5d9938);_0x36f231(_0x5d9938);});});} \ No newline at end of file +var _0xf980=['debug','stringify','error','message','info','request\x20sent','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceQueuesLog,\x20%s,\x20%s'];(function(_0x458c56,_0x302d55){var _0x285d87=function(_0x1da558){while(--_0x1da558){_0x458c56['push'](_0x458c56['shift']());}};_0x285d87(++_0x302d55);}(_0xf980,0x1cf));var _0x0f98=function(_0x324f55,_0x2e6ca4){_0x324f55=_0x324f55-0x0;var _0x284952=_0xf980[_0x324f55];return _0x284952;};'use strict';var _=require('lodash');var util=require(_0x0f98('0x0'));var moment=require(_0x0f98('0x1'));var BPromise=require(_0x0f98('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f98('0x3'));var db=require(_0x0f98('0x4'))['db'];var utils=require(_0x0f98('0x5'));var logger=require('../../config/logger')(_0x0f98('0x6'));var config=require(_0x0f98('0x7'));var jayson=require(_0x0f98('0x8'));var client=jayson[_0x0f98('0x9')][_0x0f98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cbc50,_0x228042,_0x2eef66){return new BPromise(function(_0x2a76ed,_0x24e651){return client['request'](_0x1cbc50,_0x2eef66)['then'](function(_0x124303){logger['info'](_0x0f98('0xb'),_0x228042,'request\x20sent');logger[_0x0f98('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x228042,'request\x20sent',JSON[_0x0f98('0xd')](_0x124303));if(_0x124303['error']){if(_0x124303[_0x0f98('0xe')]['code']===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x228042,_0x124303[_0x0f98('0xe')]['message']);return _0x24e651(_0x124303[_0x0f98('0xe')][_0x0f98('0xf')]);}logger[_0x0f98('0xe')](_0x0f98('0xb'),_0x228042,_0x124303[_0x0f98('0xe')][_0x0f98('0xf')]);return _0x2a76ed(_0x124303[_0x0f98('0xe')][_0x0f98('0xf')]);}else{logger[_0x0f98('0x10')](_0x0f98('0xb'),_0x228042,_0x0f98('0x11'));_0x2a76ed(_0x124303['result']['message']);}})[_0x0f98('0x12')](function(_0x2c5852){logger[_0x0f98('0xe')](_0x0f98('0xb'),_0x228042,_0x2c5852);_0x24e651(_0x2c5852);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 5cbc819..749cef8 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 _0x26e9=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','/:id/downloads','downloads','post','create','/:id/transcribe','put','update','delete','destroy','exports','multer','util'];(function(_0x266e3f,_0x4f62a3){var _0x2cfe54=function(_0xff61c){while(--_0xff61c){_0x266e3f['push'](_0x266e3f['shift']());}};_0x2cfe54(++_0x4f62a3);}(_0x26e9,0x1ae));var _0x926e=function(_0x270061,_0x4e41e1){_0x270061=_0x270061-0x0;var _0x329604=_0x26e9[_0x270061];return _0x329604;};'use strict';var multer=require(_0x926e('0x0'));var util=require(_0x926e('0x1'));var path=require(_0x926e('0x2'));var timeout=require('connect-timeout');var express=require(_0x926e('0x3'));var router=express[_0x926e('0x4')]();var fs_extra=require(_0x926e('0x5'));var auth=require(_0x926e('0x6'));var interaction=require(_0x926e('0x7'));var config=require('../../config/environment');var controller=require(_0x926e('0x8'));router[_0x926e('0x9')]('/',auth[_0x926e('0xa')](),controller[_0x926e('0xb')]);router['get'](_0x926e('0xc'),auth[_0x926e('0xa')](),controller[_0x926e('0xd')]);router[_0x926e('0x9')](_0x926e('0xe'),auth[_0x926e('0xa')](),controller[_0x926e('0xf')]);router[_0x926e('0x9')]('/:id/download',auth[_0x926e('0xa')](),controller[_0x926e('0x10')]);router[_0x926e('0x9')](_0x926e('0x11'),controller[_0x926e('0x12')]);router[_0x926e('0x9')]('/:id/transcribe',auth[_0x926e('0xa')](),controller['downloadTranscribe']);router[_0x926e('0x13')]('/',auth[_0x926e('0xa')](),controller[_0x926e('0x14')]);router[_0x926e('0x13')](_0x926e('0x15'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x926e('0x16')](_0x926e('0xe'),auth[_0x926e('0xa')](),controller[_0x926e('0x17')]);router[_0x926e('0x18')](_0x926e('0xe'),auth[_0x926e('0xa')](),controller[_0x926e('0x19')]);module[_0x926e('0x1a')]=router; \ No newline at end of file +var _0x84cc=['multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports'];(function(_0x36460e,_0x5d91a7){var _0x1174fc=function(_0x4dd76d){while(--_0x4dd76d){_0x36460e['push'](_0x36460e['shift']());}};_0x1174fc(++_0x5d91a7);}(_0x84cc,0x1e6));var _0xc84c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x84cc[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xc84c('0x0'));var util=require(_0xc84c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc84c('0x2'));var router=express[_0xc84c('0x3')]();var fs_extra=require(_0xc84c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc84c('0x5'));var config=require(_0xc84c('0x6'));var controller=require(_0xc84c('0x7'));router[_0xc84c('0x8')]('/',auth[_0xc84c('0x9')](),controller['index']);router['get'](_0xc84c('0xa'),auth[_0xc84c('0x9')](),controller[_0xc84c('0xb')]);router[_0xc84c('0x8')](_0xc84c('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xc84c('0xd'),auth[_0xc84c('0x9')](),controller[_0xc84c('0xe')]);router[_0xc84c('0x8')](_0xc84c('0xf'),controller[_0xc84c('0x10')]);router['get'](_0xc84c('0x11'),auth['isAuthenticated'](),controller[_0xc84c('0x12')]);router[_0xc84c('0x13')]('/',auth[_0xc84c('0x9')](),controller[_0xc84c('0x14')]);router[_0xc84c('0x13')](_0xc84c('0x11'),auth[_0xc84c('0x9')](),controller[_0xc84c('0x15')]);router[_0xc84c('0x16')](_0xc84c('0xc'),auth['isAuthenticated'](),controller[_0xc84c('0x17')]);router[_0xc84c('0x18')](_0xc84c('0xc'),auth[_0xc84c('0x9')](),controller[_0xc84c('0x19')]);module[_0xc84c('0x1a')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index d7420d3..7201050 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(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'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 8e2d9f4..c3e98e9 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 _0xe791=['model','differenceBy','format','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','downloads','../../components/encryptor','sequelize','token','$and','push','decryptFile','unlink','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','.cypher','isNil','info','unlinkSync','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Setting','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','data1','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','json','offset','limit','undefined','count','Content-Range','apply','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key'];(function(_0x51cb3a,_0xb28635){var _0x51d40b=function(_0x20a81a){while(--_0x20a81a){_0x51cb3a['push'](_0x51cb3a['shift']());}};_0x51d40b(++_0xb28635);}(_0xe791,0xf5));var _0x1e79=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xe791[_0x6cf19c];return _0xce14f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1e79('0x0'));var zipdir=require(_0x1e79('0x1'));var jsonpatch=require(_0x1e79('0x2'));var rp=require('request-promise');var moment=require(_0x1e79('0x3'));var BPromise=require(_0x1e79('0x4'));var Mustache=require(_0x1e79('0x5'));var util=require('util');var path=require('path');var sox=require(_0x1e79('0x6'));var csv=require(_0x1e79('0x7'));var ejs=require(_0x1e79('0x8'));var fs=require('fs');var fs_extra=require(_0x1e79('0x9'));var _=require('lodash');var squel=require(_0x1e79('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e79('0xb'));var deskjs=require(_0x1e79('0xc'));var toCsv=require(_0x1e79('0x7'));var querystring=require(_0x1e79('0xd'));var Papa=require(_0x1e79('0xe'));var AWS=require(_0x1e79('0xf'));var uuidv4=require(_0x1e79('0x10'));var Redis=require(_0x1e79('0x11'));var authService=require(_0x1e79('0x12'));var qs=require(_0x1e79('0x13'));var as=require(_0x1e79('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e79('0x15'))(_0x1e79('0x16'));var utils=require(_0x1e79('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x366ec3,_0x1c46da){_0x1c46da=_0x1c46da||0xcc;return function(_0x280ff2){if(_0x280ff2){return _0x366ec3['sendStatus'](_0x1c46da);}return _0x366ec3[_0x1e79('0x18')](_0x1c46da)['end']();};}function respondWithResult(_0x263c92,_0x34f22e){_0x34f22e=_0x34f22e||0xc8;return function(_0x5aff7b){if(_0x5aff7b){return _0x263c92[_0x1e79('0x18')](_0x34f22e)[_0x1e79('0x19')](_0x5aff7b);}};}function respondWithFilteredResult(_0x4a9577,_0x333527){return function(_0x1653c5){if(_0x1653c5){var _0x1ccf5a=typeof _0x333527[_0x1e79('0x1a')]==='undefined'&&typeof _0x333527[_0x1e79('0x1b')]===_0x1e79('0x1c');var _0x4771c4=_0x1653c5[_0x1e79('0x1d')];var _0x473662=_0x1ccf5a?0x0:_0x333527[_0x1e79('0x1a')];var _0x3ea698=_0x1ccf5a?_0x1653c5[_0x1e79('0x1d')]:_0x333527[_0x1e79('0x1a')]+_0x333527[_0x1e79('0x1b')];var _0x1083f2;if(_0x3ea698>=_0x4771c4){_0x3ea698=_0x4771c4;_0x1083f2=0xc8;}else{_0x1083f2=0xce;}_0x4a9577[_0x1e79('0x18')](_0x1083f2);return _0x4a9577['set'](_0x1e79('0x1e'),_0x473662+'-'+_0x3ea698+'/'+_0x4771c4)[_0x1e79('0x19')](_0x1653c5);}return null;};}function patchUpdates(_0x4723d6){return function(_0x41d62c){try{jsonpatch[_0x1e79('0x1f')](_0x41d62c,_0x4723d6,!![]);}catch(_0x212247){return BPromise['reject'](_0x212247);}return _0x41d62c['save']();};}function saveUpdates(_0x5af2a3,_0x3c2373){return function(_0x913a0b){if(_0x913a0b){return _0x913a0b['update'](_0x5af2a3)[_0x1e79('0x20')](function(_0x5b3594){return _0x5b3594;});}return null;};}function removeEntity(_0x40b158,_0x44ccf9){return function(_0x358b89){if(_0x358b89){return _0x358b89[_0x1e79('0x21')]()[_0x1e79('0x20')](function(){_0x40b158['status'](0xcc)[_0x1e79('0x22')]();});}};}function handleEntityNotFound(_0x12bc14,_0x43bf92){return function(_0x3c62e7){if(!_0x3c62e7){_0x12bc14[_0x1e79('0x23')](0x194);}return _0x3c62e7;};}function handleError(_0x28449a,_0x2b17bc){_0x2b17bc=_0x2b17bc||0x1f4;return function(_0x3b4b67){logger['error'](_0x3b4b67[_0x1e79('0x24')]);if(_0x3b4b67[_0x1e79('0x25')]){delete _0x3b4b67[_0x1e79('0x25')];}_0x28449a[_0x1e79('0x18')](_0x2b17bc)[_0x1e79('0x26')](_0x3b4b67);};}exports[_0x1e79('0x27')]=function(_0x40c7b5,_0x173c73){var _0x3a2582={},_0x29fe6e={},_0x40c5ee={'count':0x0,'rows':[]};var _0x376a67=_[_0x1e79('0x28')](db[_0x1e79('0x29')][_0x1e79('0x2a')],function(_0x233eba){return{'name':_0x233eba[_0x1e79('0x2b')],'type':_0x233eba['type'][_0x1e79('0x2c')]};});_0x29fe6e[_0x1e79('0x2d')]=_[_0x1e79('0x2e')](_[_0x1e79('0x28')](_0x376a67,_0x1e79('0x25')),[_0x1e79('0x2f')]);_0x29fe6e[_0x1e79('0x30')]=_[_0x1e79('0x31')](_0x40c7b5[_0x1e79('0x30')]);_0x29fe6e['filters']=_['intersection'](_0x29fe6e['model'],_0x29fe6e[_0x1e79('0x30')]);_0x3a2582[_0x1e79('0x32')]=_[_0x1e79('0x33')](_0x29fe6e[_0x1e79('0x2d')],qs[_0x1e79('0x34')](_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x34')]));_0x3a2582[_0x1e79('0x32')]=_0x3a2582['attributes'][_0x1e79('0x35')]?_0x3a2582[_0x1e79('0x32')]:_0x29fe6e[_0x1e79('0x2d')];if(!_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x36')](_0x1e79('0x37'))){_0x3a2582['limit']=qs[_0x1e79('0x1b')](_0x40c7b5['query']['limit']);_0x3a2582[_0x1e79('0x1a')]=qs[_0x1e79('0x1a')](_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x1a')]);}_0x3a2582[_0x1e79('0x38')]=qs[_0x1e79('0x39')](_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x39')]);_0x3a2582[_0x1e79('0x3a')]=qs[_0x1e79('0x3b')](_[_0x1e79('0x3c')](_0x40c7b5['query'],_0x29fe6e['filters']),_0x376a67);if(_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x3d')]){_0x3a2582['where']=_[_0x1e79('0x3e')](_0x3a2582[_0x1e79('0x3a')],{'$or':_[_0x1e79('0x28')](_0x376a67,function(_0x41c288){if(_0x41c288[_0x1e79('0x3f')]!=='VIRTUAL'){var _0xe88b11={};_0xe88b11[_0x41c288[_0x1e79('0x25')]]={'$like':'%'+_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x3d')]+'%'};return _0xe88b11;}})});}_0x3a2582=_['merge']({},_0x3a2582,_0x40c7b5[_0x1e79('0x40')]);var _0x190368={'where':_0x3a2582[_0x1e79('0x3a')]};return db[_0x1e79('0x29')]['count'](_0x190368)[_0x1e79('0x20')](function(_0x1c9370){_0x40c5ee[_0x1e79('0x1d')]=_0x1c9370;if(_0x40c7b5[_0x1e79('0x30')][_0x1e79('0x41')]){_0x3a2582[_0x1e79('0x42')]=[{'all':!![]}];}return db[_0x1e79('0x29')]['findAll'](_0x3a2582);})[_0x1e79('0x20')](function(_0x31b491){_0x40c5ee[_0x1e79('0x43')]=_0x31b491;return _0x40c5ee;})['then'](respondWithFilteredResult(_0x173c73,_0x3a2582))[_0x1e79('0x44')](handleError(_0x173c73,null));};exports[_0x1e79('0x45')]=function(_0x39daa5,_0x313f2d){var _0x1e3a43={'raw':![],'where':{'id':_0x39daa5[_0x1e79('0x46')]['id']}},_0x287ff1={};_0x287ff1[_0x1e79('0x2d')]=_[_0x1e79('0x31')](db[_0x1e79('0x29')][_0x1e79('0x2a')]);_0x287ff1[_0x1e79('0x30')]=_[_0x1e79('0x31')](_0x39daa5['query']);_0x287ff1['filters']=_[_0x1e79('0x33')](_0x287ff1[_0x1e79('0x2d')],_0x287ff1['query']);_0x1e3a43[_0x1e79('0x32')]=_['intersection'](_0x287ff1[_0x1e79('0x2d')],qs[_0x1e79('0x34')](_0x39daa5['query']['fields']));_0x1e3a43[_0x1e79('0x32')]=_0x1e3a43[_0x1e79('0x32')][_0x1e79('0x35')]?_0x1e3a43[_0x1e79('0x32')]:_0x287ff1[_0x1e79('0x2d')];if(_0x39daa5[_0x1e79('0x30')][_0x1e79('0x41')]){_0x1e3a43[_0x1e79('0x42')]=[{'all':!![]}];}_0x1e3a43=_[_0x1e79('0x3e')]({},_0x1e3a43,_0x39daa5[_0x1e79('0x40')]);return db['VoiceRecording'][_0x1e79('0x47')](_0x1e3a43)[_0x1e79('0x20')](handleEntityNotFound(_0x313f2d,null))[_0x1e79('0x20')](respondWithResult(_0x313f2d,null))[_0x1e79('0x44')](handleError(_0x313f2d,null));};exports['create']=function(_0x3b3950,_0x4c0571){return db[_0x1e79('0x29')][_0x1e79('0x48')](_0x3b3950[_0x1e79('0x49')],{})[_0x1e79('0x20')](respondWithResult(_0x4c0571,0xc9))[_0x1e79('0x44')](handleError(_0x4c0571,null));};exports['update']=function(_0x10ca71,_0xdfa967){if(_0x10ca71[_0x1e79('0x49')]['id']){delete _0x10ca71['body']['id'];}return db[_0x1e79('0x29')]['find']({'where':{'id':_0x10ca71[_0x1e79('0x46')]['id']}})[_0x1e79('0x20')](handleEntityNotFound(_0xdfa967,null))[_0x1e79('0x20')](saveUpdates(_0x10ca71[_0x1e79('0x49')],null))[_0x1e79('0x20')](respondWithResult(_0xdfa967,null))[_0x1e79('0x44')](handleError(_0xdfa967,null));};exports[_0x1e79('0x4a')]=function(_0x42838a,_0xa818){return db[_0x1e79('0x29')]['describe']()[_0x1e79('0x20')](respondWithResult(_0xa818,null))['catch'](handleError(_0xa818,null));};exports[_0x1e79('0x4b')]=function(_0x351d7b,_0x96548a,_0x4fcde4){var _0xaafaed=require('../../components/encryptor');var _0x3761a2=![];var _0x244893={};if(_0x351d7b[_0x1e79('0x30')][_0x1e79('0x3f')]&&_0x351d7b[_0x1e79('0x30')]['type']==='uniqueid'){_0x244893[_0x1e79('0x4c')]=_0x351d7b[_0x1e79('0x46')]['id'];}else{_0x244893['id']=_0x351d7b[_0x1e79('0x46')]['id'];}return db[_0x1e79('0x29')][_0x1e79('0x47')]({'where':_0x244893,'attributes':['id',_0x1e79('0x4d')],'raw':!![]})[_0x1e79('0x20')](handleEntityNotFound(_0x96548a,null))['then'](function(_0x5f2b18){if(_0x5f2b18){var _0x546663=_0x5f2b18[_0x1e79('0x4d')];var _0x2735ec=util['format'](_0x1e79('0x4e'),_0x546663);if(fs[_0x1e79('0x4f')](_0x2735ec)){_0x3761a2=!![];return _0xaafaed['decryptFile'](_0x2735ec,_0x546663,config[_0x1e79('0x50')][_0x1e79('0x51')])['then'](function(){return _0x5f2b18;});}return _0x5f2b18;}})[_0x1e79('0x20')](function(_0xc2f464){if(_0xc2f464){var _0x594a6a=_0xc2f464['value'];if(!fs[_0x1e79('0x4f')](_0x594a6a)){throw new db[(_0x1e79('0x52'))][(_0x1e79('0x53'))](_0x1e79('0x54'));}if(_0xc2f464[_0x1e79('0x55')]){return _0x96548a['download'](_0x594a6a,_0xc2f464['filename']+path[_0x1e79('0x56')](_0x594a6a),function(){if(_0x3761a2){fs['unlink'](_0x594a6a);}});}else{return _0x96548a[_0x1e79('0x4b')](_0x594a6a,function(_0x2b5ea9){if(_0x3761a2){fs['unlink'](_0x594a6a);}});}}})[_0x1e79('0x44')](function(_0x485e37){if(_0x485e37['message']===_0x1e79('0x54')){_0x96548a[_0x1e79('0x18')](0x194)[_0x1e79('0x26')]('Not\x20found');}else{return handleError(_0x96548a,null);}});};exports[_0x1e79('0x57')]=function(_0x1b5e72,_0x57b38c,_0x3ca286){var _0x76ec1a=require(_0x1e79('0x58'));var _0x599c9a=![];var _0x3b41fa={'$and':[db[_0x1e79('0x59')][_0x1e79('0x3a')](db[_0x1e79('0x59')]['fn']('MD5',db[_0x1e79('0x59')]['col'](_0x1e79('0x4c'))),_0x1b5e72[_0x1e79('0x30')][_0x1e79('0x5a')])]};if(_0x1b5e72[_0x1e79('0x30')][_0x1e79('0x3f')]&&_0x1b5e72[_0x1e79('0x30')][_0x1e79('0x3f')]==='uniqueid'){_0x3b41fa[_0x1e79('0x5b')][_0x1e79('0x5c')]({'uniqueid':_0x1b5e72[_0x1e79('0x46')]['id']});}else{_0x3b41fa['$and']['push']({'id':_0x1b5e72['params']['id']});}return db[_0x1e79('0x29')]['find']({'where':_0x3b41fa,'attributes':['id',_0x1e79('0x4d')],'raw':!![]})[_0x1e79('0x20')](handleEntityNotFound(_0x57b38c,null))[_0x1e79('0x20')](function(_0x2762a4){if(_0x2762a4){var _0x58f13b=util[_0x1e79('0x2f')](_0x1e79('0x4e'),_0x2762a4[_0x1e79('0x4d')]);if(fs[_0x1e79('0x4f')](_0x58f13b)){_0x599c9a=!![];return _0x76ec1a[_0x1e79('0x5d')](_0x58f13b,_0x2762a4[_0x1e79('0x4d')],config['secrets'][_0x1e79('0x51')])[_0x1e79('0x20')](function(){return _0x2762a4;});}return _0x2762a4;}})[_0x1e79('0x20')](function(_0x396924){if(_0x396924){if(!fs[_0x1e79('0x4f')](_0x396924[_0x1e79('0x4d')])){throw new db[(_0x1e79('0x52'))][(_0x1e79('0x53'))](_0x1e79('0x54'));}if(_0x396924[_0x1e79('0x55')]){return _0x57b38c[_0x1e79('0x4b')](_0x396924[_0x1e79('0x4d')],_0x396924[_0x1e79('0x55')]+path[_0x1e79('0x56')](_0x396924['value']),function(){if(_0x599c9a){fs[_0x1e79('0x5e')](_0x396924[_0x1e79('0x4d')]);}});}else{return _0x57b38c[_0x1e79('0x4b')](_0x396924[_0x1e79('0x4d')],function(_0x4092fa){if(_0x599c9a){fs['unlink'](_0x396924[_0x1e79('0x4d')]);}});}}})[_0x1e79('0x44')](handleError(_0x57b38c,null));};exports['destroy']=function(_0x5e7af4,_0x2cf33d){return db[_0x1e79('0x29')][_0x1e79('0x47')]({'where':{'id':_0x5e7af4[_0x1e79('0x46')]['id']}})[_0x1e79('0x20')](function(_0x1af186){if(_['isNil'](_0x1af186)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1af186;})[_0x1e79('0x20')](function(_0x3236ea){var _0x41d26f=_0x3236ea['value'];logger['info'](_0x1e79('0x5f'),_0x41d26f);if(!_['isNil'](_0x3236ea[_0x1e79('0x4d')])&&fs[_0x1e79('0x4f')](_0x41d26f)){logger['info'](_0x1e79('0x60')+_0x41d26f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x41d26f);}_0x41d26f=_0x41d26f+_0x1e79('0x61');if(!_[_0x1e79('0x62')](_0x3236ea[_0x1e79('0x4d')])&&fs[_0x1e79('0x4f')](_0x41d26f)){logger[_0x1e79('0x63')](_0x1e79('0x60')+_0x41d26f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x1e79('0x64')](_0x41d26f);}return _0x3236ea;})[_0x1e79('0x20')](function(_0x1b96d8){if(!_0x1b96d8)throw new InternalError();return _0x1b96d8[_0x1e79('0x21')]();})[_0x1e79('0x20')](function(){_0x2cf33d[_0x1e79('0x18')](0xcc)[_0x1e79('0x22')]();})[_0x1e79('0x44')](handleError(_0x2cf33d,null));};function getBucketslist(_0x1a1596,_0x14e2ec,_0x4f8802){return new Promise(function(_0x3c9fb,_0x3aae8d){var _0x24853a=new AWS['S3']({'accessKeyId':_0x14e2ec,'secretAccessKey':_0x1a1596,'region':_0x4f8802});_0x24853a[_0x1e79('0x65')]({},function(_0x3dbe5a,_0x552f89){if(_0x3dbe5a){return _0x3aae8d(_0x3dbe5a);}else{return _0x3c9fb(_0x552f89);}});});}function createBucket(_0x2ee200,_0x55ef87,_0x1ce751,_0x18520f){return new Promise(function(_0x1a6c22,_0x4638db){var _0x124dd4=new AWS['S3']({'accessKeyId':_0x55ef87,'secretAccessKey':_0x2ee200,'region':_0x1ce751});_0x124dd4[_0x1e79('0x66')]({'Bucket':_0x18520f},function(_0x5eb908,_0x1541dd){if(_0x5eb908){return _0x4638db(_0x5eb908);}else{return _0x1a6c22(_0x1541dd);}});});}function uploadFile(_0x4b2a8e,_0x5edd8f,_0x5de85f,_0x3ef814,_0x17bac2,_0x1a3950){return new Promise(function(_0x4380c4,_0xbddb04){var _0x5052f1=new AWS['S3']({'accessKeyId':_0x5edd8f,'secretAccessKey':_0x4b2a8e,'region':_0x5de85f});_0x5052f1['upload']({'Bucket':_0x3ef814,'Key':_0x17bac2,'Body':_0x1a3950},function(_0x229163,_0x421305){if(_0x229163){return _0xbddb04(_0x229163);}else{return _0x4380c4(_0x421305);}});});}function startTranscribe(_0x5cce64,_0x464326,_0x179b87,_0xc4e4b4,_0x345042,_0x472343){return new Promise(function(_0x62b9a5,_0x4b21a0){var _0x14fd70=new AWS[(_0x1e79('0x67'))]({'accessKeyId':_0x464326,'secretAccessKey':_0x5cce64,'region':_0x179b87});_0x14fd70[_0x1e79('0x68')]({'TranscriptionJobName':_0xc4e4b4,'LanguageCode':_0x345042,'Media':{'MediaFileUri':_0x472343}},function(_0x1eaa71,_0x17b27b){if(_0x1eaa71){return _0x4b21a0(_0x1eaa71);}else{return _0x62b9a5(_0x17b27b);}});});}function transcribe(_0x565a9a,_0xb1c9bc,_0x29996a,_0x4b6510,_0x42b55d,_0x11298b,_0x35191f){return new Promise(function(_0x15a140,_0x477195){var _0x523a8c={};logger['info'](util[_0x1e79('0x2f')](_0x1e79('0x69'),_0x565a9a,_0x42b55d));return uploadFile(_0xb1c9bc,_0x29996a,_0x4b6510,_0x42b55d,path[_0x1e79('0x6a')](_0x11298b),fs['readFileSync'](_0x11298b))[_0x1e79('0x20')](function(_0x12756c){logger[_0x1e79('0x63')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x565a9a,_0x42b55d,_0x12756c[_0x1e79('0x6b')]));_0x523a8c[_0x1e79('0x6c')]=_0x12756c[_0x1e79('0x6d')];_0x523a8c[_0x1e79('0x6e')]=_0x12756c[_0x1e79('0x6b')];logger[_0x1e79('0x63')](util['format'](_0x1e79('0x6f'),_0x565a9a));return startTranscribe(_0xb1c9bc,_0x29996a,_0x4b6510,uuidv4(),_0x35191f,_0x12756c[_0x1e79('0x6b')]);})[_0x1e79('0x20')](function(_0x58f85f){logger[_0x1e79('0x63')](util[_0x1e79('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x565a9a,_0x58f85f[_0x1e79('0x70')][_0x1e79('0x71')]));_0x523a8c[_0x1e79('0x72')]=_0x58f85f[_0x1e79('0x70')][_0x1e79('0x71')];_0x523a8c[_0x1e79('0x73')]=_0x58f85f[_0x1e79('0x70')][_0x1e79('0x74')];return _0x15a140(_0x523a8c);})[_0x1e79('0x44')](function(_0x3b8dd3){return _0x477195(_0x3b8dd3);});});}exports['runTranscribe']=function(_0x1fae06,_0x345139,_0x1982fd){var _0x52e12b;var _0x5f3729;var _0xbc2a78;var _0x191723=require(_0x1e79('0x58'));return db[_0x1e79('0x29')][_0x1e79('0x75')]({'where':{'id':_0x1fae06[_0x1e79('0x46')]['id']}})['then'](function(_0x515ecd){if(_0x515ecd){var _0x59cec3=util[_0x1e79('0x2f')](_0x1e79('0x4e'),_0x515ecd[_0x1e79('0x4d')]);if(fs[_0x1e79('0x4f')](_0x59cec3)){cypher=!![];return _0x191723[_0x1e79('0x5d')](_0x59cec3,_0x515ecd[_0x1e79('0x4d')],config[_0x1e79('0x50')][_0x1e79('0x51')])['then'](function(){return _0x515ecd;});}return _0x515ecd;}})['then'](function(_0x5bb2e2){if(!_0x5bb2e2){throw new db[(_0x1e79('0x52'))][(_0x1e79('0x53'))]('Voice\x20Recording\x20not\x20found');}_0x5f3729=_0x5bb2e2;return db[_0x1e79('0x76')]['findOne']({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x345139,null))['then'](function(_0x2b39f3){if(_0x2b39f3){_0x52e12b=_0x2b39f3;if(!_0x52e12b[_0x1e79('0x77')]||!_0x52e12b[_0x1e79('0x78')]||!_0x52e12b['transcribeRegion']||!_0x52e12b[_0x1e79('0x79')]||!_0x52e12b[_0x1e79('0x6c')]){throw new db[(_0x1e79('0x52'))][(_0x1e79('0x53'))](_0x1e79('0x7a'));}if(_0x1fae06['body']['runSentiment']&&(!_0x52e12b[_0x1e79('0x7b')]||!_0x52e12b['sentimentAccountId']||!_0x52e12b[_0x1e79('0x7c')]||!_0x52e12b[_0x1e79('0x79')]||!_0x52e12b[_0x1e79('0x6c')])){throw new db[(_0x1e79('0x52'))][(_0x1e79('0x53'))](_0x1e79('0x7d'));}return db[_0x1e79('0x7e')][_0x1e79('0x75')]({'where':{'id':_0x52e12b[_0x1e79('0x78')]}});}})[_0x1e79('0x20')](function(_0x27016d){if(!_0x27016d){throw new db[(_0x1e79('0x52'))]['ValidationError'](_0x1e79('0x7f'));}if(!_0x27016d['data1']||!_0x27016d[_0x1e79('0x80')]){throw new db['Sequelize'][(_0x1e79('0x53'))]('Cloud\x20Provider\x20not\x20configured');}_0xbc2a78=_0x27016d;return getBucketslist(_0xbc2a78[_0x1e79('0x81')],_0xbc2a78[_0x1e79('0x80')],_0x52e12b[_0x1e79('0x82')]);})[_0x1e79('0x20')](function(_0xa2d626){if(_0xa2d626&&_0xa2d626[_0x1e79('0x83')]){var _0x1f9c83=_[_0x1e79('0x47')](_0xa2d626[_0x1e79('0x83')],function(_0x46cf23){return _0x46cf23[_0x1e79('0x84')]===_0x52e12b[_0x1e79('0x6c')];});if(!_0x1f9c83){logger[_0x1e79('0x63')](util[_0x1e79('0x2f')](_0x1e79('0x85'),_0x1fae06[_0x1e79('0x46')]['id'],_0x52e12b['bucket']));return createBucket(_0xbc2a78[_0x1e79('0x81')],_0xbc2a78[_0x1e79('0x80')],_0x52e12b[_0x1e79('0x82')],_0x52e12b[_0x1e79('0x6c')]);}logger[_0x1e79('0x63')](util[_0x1e79('0x2f')](_0x1e79('0x86'),_0x1fae06[_0x1e79('0x46')]['id'],_0x52e12b[_0x1e79('0x6c')]));return;}})['then'](function(_0x37d9d2){if(_0x5f3729[_0x1e79('0x73')]===_0x1e79('0x87')){return transcribe(_0x1fae06[_0x1e79('0x46')]['id'],_0xbc2a78['data1'],_0xbc2a78['data2'],_0x52e12b[_0x1e79('0x82')],_0x52e12b[_0x1e79('0x6c')],_0x5f3729[_0x1e79('0x4d')],_0x52e12b[_0x1e79('0x79')]);}else{logger[_0x1e79('0x63')](util[_0x1e79('0x2f')](_0x1e79('0x88'),_0x1fae06[_0x1e79('0x46')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0x1e79('0x20')](function(_0x2ce4c1){if(_0x2ce4c1){_0x2ce4c1[_0x1e79('0x89')]=_0x1fae06[_0x1e79('0x49')][_0x1e79('0x8a')];return _0x5f3729[_0x1e79('0x8b')](_0x2ce4c1);}})[_0x1e79('0x20')](respondWithResult(_0x345139,null))[_0x1e79('0x44')](handleError(_0x345139,null));};function writeFile(_0x51f43f,_0x779faf){return new Promise(function(_0x509801,_0xb43186){fs['writeFile'](_0x779faf,_0x51f43f,function(_0x186739,_0x319c1b){if(_0x186739){return _0xb43186(_0x186739);}else{return _0x509801(_0x319c1b);}});});}exports[_0x1e79('0x8c')]=function(_0x43ef49,_0x521090,_0xfe5272){return db[_0x1e79('0x29')][_0x1e79('0x75')]({'where':{'id':_0x43ef49[_0x1e79('0x46')]['id']}})[_0x1e79('0x20')](handleEntityNotFound(_0x521090))[_0x1e79('0x20')](function(_0x487b4c){if(_0x487b4c&&_0x487b4c[_0x1e79('0x8d')]){var _0x547370=_0x487b4c['fileText'];var _0x315169=config[_0x1e79('0x8e')]+_0x1e79('0x8f')+_0x487b4c['id']+_0x1e79('0x90');if(fs[_0x1e79('0x4f')](_0x315169)){return _0x315169;}return writeFile(_0x547370,_0x315169)['then'](function(){return _0x315169;});}else{throw new db[(_0x1e79('0x52'))][(_0x1e79('0x53'))]('Transcript\x20not\x20available');}})[_0x1e79('0x20')](function(_0x5f4e42){return _0x521090['download'](_0x5f4e42);})[_0x1e79('0x44')](handleError(_0x521090));}; \ No newline at end of file +var _0xc617=['transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','then','destroy','sendStatus','stack','name','index','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','describe','uniqueid','value','existsSync','decryptFile','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','downloads','sequelize','MD5','token','$and','push','%s.cypher','secrets','ValidationError','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','listBuckets','TranscribeService','startTranscriptionJob','basename','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJob','transcribeStatus','TranscriptionJobStatus','runTranscribe','../../components/encryptor','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeAccountId'];(function(_0x3173bf,_0x41b765){var _0x7871d=function(_0x367d44){while(--_0x367d44){_0x3173bf['push'](_0x3173bf['shift']());}};_0x7871d(++_0x41b765);}(_0xc617,0xb0));var _0x7c61=function(_0x369829,_0x5149ad){_0x369829=_0x369829-0x0;var _0xb9c603=_0xc617[_0x369829];return _0xb9c603;};'use strict';var emlformat=require(_0x7c61('0x0'));var rimraf=require(_0x7c61('0x1'));var zipdir=require(_0x7c61('0x2'));var jsonpatch=require(_0x7c61('0x3'));var rp=require(_0x7c61('0x4'));var moment=require(_0x7c61('0x5'));var BPromise=require(_0x7c61('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7c61('0x7'));var csv=require(_0x7c61('0x8'));var ejs=require(_0x7c61('0x9'));var fs=require('fs');var fs_extra=require(_0x7c61('0xa'));var _=require(_0x7c61('0xb'));var squel=require(_0x7c61('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7c61('0xd'));var toCsv=require(_0x7c61('0x8'));var querystring=require(_0x7c61('0xe'));var Papa=require('papaparse');var AWS=require(_0x7c61('0xf'));var uuidv4=require(_0x7c61('0x10'));var Redis=require(_0x7c61('0x11'));var authService=require(_0x7c61('0x12'));var qs=require(_0x7c61('0x13'));var as=require(_0x7c61('0x14'));var hardwareService=require(_0x7c61('0x15'));var logger=require(_0x7c61('0x16'))(_0x7c61('0x17'));var utils=require('../../config/utils');var config=require(_0x7c61('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c61('0x19'))['db'];function respondWithStatusCode(_0x52e60a,_0x42e824){_0x42e824=_0x42e824||0xcc;return function(_0x18238f){if(_0x18238f){return _0x52e60a['sendStatus'](_0x42e824);}return _0x52e60a[_0x7c61('0x1a')](_0x42e824)[_0x7c61('0x1b')]();};}function respondWithResult(_0x36ed44,_0x548fde){_0x548fde=_0x548fde||0xc8;return function(_0x274c85){if(_0x274c85){return _0x36ed44[_0x7c61('0x1a')](_0x548fde)['json'](_0x274c85);}};}function respondWithFilteredResult(_0x51f40c,_0x512eaf){return function(_0x1fa813){if(_0x1fa813){var _0x2feda1=typeof _0x512eaf[_0x7c61('0x1c')]===_0x7c61('0x1d')&&typeof _0x512eaf[_0x7c61('0x1e')]==='undefined';var _0x5dcab7=_0x1fa813[_0x7c61('0x1f')];var _0x179c56=_0x2feda1?0x0:_0x512eaf[_0x7c61('0x1c')];var _0x12c8fc=_0x2feda1?_0x1fa813[_0x7c61('0x1f')]:_0x512eaf[_0x7c61('0x1c')]+_0x512eaf[_0x7c61('0x1e')];var _0x22ae4a;if(_0x12c8fc>=_0x5dcab7){_0x12c8fc=_0x5dcab7;_0x22ae4a=0xc8;}else{_0x22ae4a=0xce;}_0x51f40c[_0x7c61('0x1a')](_0x22ae4a);return _0x51f40c['set'](_0x7c61('0x20'),_0x179c56+'-'+_0x12c8fc+'/'+_0x5dcab7)[_0x7c61('0x21')](_0x1fa813);}return null;};}function patchUpdates(_0x431924){return function(_0x412046){try{jsonpatch[_0x7c61('0x22')](_0x412046,_0x431924,!![]);}catch(_0x6be8c3){return BPromise[_0x7c61('0x23')](_0x6be8c3);}return _0x412046[_0x7c61('0x24')]();};}function saveUpdates(_0xd4df70,_0x2591c1){return function(_0x1e55a6){if(_0x1e55a6){return _0x1e55a6['update'](_0xd4df70)[_0x7c61('0x25')](function(_0x3a39dd){return _0x3a39dd;});}return null;};}function removeEntity(_0x1021fb,_0x4e9de1){return function(_0x331e6b){if(_0x331e6b){return _0x331e6b[_0x7c61('0x26')]()[_0x7c61('0x25')](function(){_0x1021fb['status'](0xcc)[_0x7c61('0x1b')]();});}};}function handleEntityNotFound(_0xd9f80,_0x27b6ef){return function(_0x133684){if(!_0x133684){_0xd9f80[_0x7c61('0x27')](0x194);}return _0x133684;};}function handleError(_0x781a01,_0x218dab){_0x218dab=_0x218dab||0x1f4;return function(_0x2633fe){logger['error'](_0x2633fe[_0x7c61('0x28')]);if(_0x2633fe[_0x7c61('0x29')]){delete _0x2633fe[_0x7c61('0x29')];}_0x781a01[_0x7c61('0x1a')](_0x218dab)['send'](_0x2633fe);};}exports[_0x7c61('0x2a')]=function(_0xb51609,_0x3c69a1){var _0x1608aa={},_0xf3fb6e={},_0x43ecc7={'count':0x0,'rows':[]};var _0x5e574a=_[_0x7c61('0x2b')](db[_0x7c61('0x2c')][_0x7c61('0x2d')],function(_0x3ba395){return{'name':_0x3ba395[_0x7c61('0x2e')],'type':_0x3ba395[_0x7c61('0x2f')][_0x7c61('0x30')]};});_0xf3fb6e[_0x7c61('0x31')]=_[_0x7c61('0x32')](_[_0x7c61('0x2b')](_0x5e574a,_0x7c61('0x29')),[_0x7c61('0x33')]);_0xf3fb6e['query']=_[_0x7c61('0x34')](_0xb51609[_0x7c61('0x35')]);_0xf3fb6e[_0x7c61('0x36')]=_[_0x7c61('0x37')](_0xf3fb6e[_0x7c61('0x31')],_0xf3fb6e[_0x7c61('0x35')]);_0x1608aa['attributes']=_[_0x7c61('0x37')](_0xf3fb6e['model'],qs[_0x7c61('0x38')](_0xb51609[_0x7c61('0x35')][_0x7c61('0x38')]));_0x1608aa[_0x7c61('0x39')]=_0x1608aa[_0x7c61('0x39')][_0x7c61('0x3a')]?_0x1608aa[_0x7c61('0x39')]:_0xf3fb6e[_0x7c61('0x31')];if(!_0xb51609['query']['hasOwnProperty'](_0x7c61('0x3b'))){_0x1608aa['limit']=qs[_0x7c61('0x1e')](_0xb51609[_0x7c61('0x35')][_0x7c61('0x1e')]);_0x1608aa[_0x7c61('0x1c')]=qs[_0x7c61('0x1c')](_0xb51609['query']['offset']);}_0x1608aa[_0x7c61('0x3c')]=qs[_0x7c61('0x3d')](_0xb51609['query'][_0x7c61('0x3d')]);_0x1608aa[_0x7c61('0x3e')]=qs[_0x7c61('0x36')](_[_0x7c61('0x3f')](_0xb51609['query'],_0xf3fb6e[_0x7c61('0x36')]),_0x5e574a);if(_0xb51609['query'][_0x7c61('0x40')]){_0x1608aa[_0x7c61('0x3e')]=_[_0x7c61('0x41')](_0x1608aa[_0x7c61('0x3e')],{'$or':_[_0x7c61('0x2b')](_0x5e574a,function(_0x1fb659){if(_0x1fb659[_0x7c61('0x2f')]!==_0x7c61('0x42')){var _0x1ba301={};_0x1ba301[_0x1fb659[_0x7c61('0x29')]]={'$like':'%'+_0xb51609[_0x7c61('0x35')][_0x7c61('0x40')]+'%'};return _0x1ba301;}})});}_0x1608aa=_[_0x7c61('0x41')]({},_0x1608aa,_0xb51609['options']);var _0x1c254f={'where':_0x1608aa['where']};return db[_0x7c61('0x2c')]['count'](_0x1c254f)[_0x7c61('0x25')](function(_0x2f6d28){_0x43ecc7['count']=_0x2f6d28;if(_0xb51609['query'][_0x7c61('0x43')]){_0x1608aa[_0x7c61('0x44')]=[{'all':!![]}];}return db[_0x7c61('0x2c')][_0x7c61('0x45')](_0x1608aa);})['then'](function(_0x1e4130){_0x43ecc7[_0x7c61('0x46')]=_0x1e4130;return _0x43ecc7;})[_0x7c61('0x25')](respondWithFilteredResult(_0x3c69a1,_0x1608aa))[_0x7c61('0x47')](handleError(_0x3c69a1,null));};exports[_0x7c61('0x48')]=function(_0x3a4cb2,_0x29d30a){var _0x26ca69={'raw':![],'where':{'id':_0x3a4cb2[_0x7c61('0x49')]['id']}},_0x17b185={};_0x17b185[_0x7c61('0x31')]=_['keys'](db[_0x7c61('0x2c')][_0x7c61('0x2d')]);_0x17b185[_0x7c61('0x35')]=_['keys'](_0x3a4cb2[_0x7c61('0x35')]);_0x17b185['filters']=_[_0x7c61('0x37')](_0x17b185[_0x7c61('0x31')],_0x17b185['query']);_0x26ca69[_0x7c61('0x39')]=_[_0x7c61('0x37')](_0x17b185[_0x7c61('0x31')],qs['fields'](_0x3a4cb2['query']['fields']));_0x26ca69['attributes']=_0x26ca69[_0x7c61('0x39')]['length']?_0x26ca69[_0x7c61('0x39')]:_0x17b185[_0x7c61('0x31')];if(_0x3a4cb2[_0x7c61('0x35')][_0x7c61('0x43')]){_0x26ca69['include']=[{'all':!![]}];}_0x26ca69=_[_0x7c61('0x41')]({},_0x26ca69,_0x3a4cb2[_0x7c61('0x4a')]);return db[_0x7c61('0x2c')][_0x7c61('0x4b')](_0x26ca69)[_0x7c61('0x25')](handleEntityNotFound(_0x29d30a,null))[_0x7c61('0x25')](respondWithResult(_0x29d30a,null))['catch'](handleError(_0x29d30a,null));};exports[_0x7c61('0x4c')]=function(_0x18db30,_0x55622b){return db[_0x7c61('0x2c')]['create'](_0x18db30[_0x7c61('0x4d')],{})[_0x7c61('0x25')](respondWithResult(_0x55622b,0xc9))[_0x7c61('0x47')](handleError(_0x55622b,null));};exports[_0x7c61('0x4e')]=function(_0x4cd5a4,_0x666876){if(_0x4cd5a4['body']['id']){delete _0x4cd5a4[_0x7c61('0x4d')]['id'];}return db[_0x7c61('0x2c')][_0x7c61('0x4b')]({'where':{'id':_0x4cd5a4[_0x7c61('0x49')]['id']}})[_0x7c61('0x25')](handleEntityNotFound(_0x666876,null))[_0x7c61('0x25')](saveUpdates(_0x4cd5a4['body'],null))[_0x7c61('0x25')](respondWithResult(_0x666876,null))[_0x7c61('0x47')](handleError(_0x666876,null));};exports[_0x7c61('0x4f')]=function(_0x1ce4ed,_0xc0cd06){return db[_0x7c61('0x2c')][_0x7c61('0x4f')]()[_0x7c61('0x25')](respondWithResult(_0xc0cd06,null))[_0x7c61('0x47')](handleError(_0xc0cd06,null));};exports['download']=function(_0x508657,_0x104d61,_0x57d4a5){var _0x46d1a1=require('../../components/encryptor');var _0x3e82b3=![];var _0x326719={};if(_0x508657[_0x7c61('0x35')]['type']&&_0x508657[_0x7c61('0x35')][_0x7c61('0x2f')]===_0x7c61('0x50')){_0x326719['uniqueid']=_0x508657[_0x7c61('0x49')]['id'];}else{_0x326719['id']=_0x508657['params']['id'];}return db['VoiceRecording'][_0x7c61('0x4b')]({'where':_0x326719,'attributes':['id',_0x7c61('0x51')],'raw':!![]})[_0x7c61('0x25')](handleEntityNotFound(_0x104d61,null))[_0x7c61('0x25')](function(_0x43de2d){if(_0x43de2d){var _0x2c779b=_0x43de2d[_0x7c61('0x51')];var _0x985053=util[_0x7c61('0x33')]('%s.cypher',_0x2c779b);if(fs[_0x7c61('0x52')](_0x985053)){_0x3e82b3=!![];return _0x46d1a1[_0x7c61('0x53')](_0x985053,_0x2c779b,config['secrets'][_0x7c61('0x54')])[_0x7c61('0x25')](function(){return _0x43de2d;});}return _0x43de2d;}})[_0x7c61('0x25')](function(_0x30aa34){if(_0x30aa34){var _0x33f116=_0x30aa34['value'];if(!fs[_0x7c61('0x52')](_0x33f116)){throw new db[(_0x7c61('0x55'))]['ValidationError'](_0x7c61('0x56'));}if(_0x30aa34[_0x7c61('0x57')]){return _0x104d61['download'](_0x33f116,_0x30aa34[_0x7c61('0x57')]+path[_0x7c61('0x58')](_0x33f116),function(){if(_0x3e82b3){fs[_0x7c61('0x59')](_0x33f116);}});}else{return _0x104d61[_0x7c61('0x5a')](_0x33f116,function(_0x212e2f){if(_0x3e82b3){fs[_0x7c61('0x59')](_0x33f116);}});}}})[_0x7c61('0x47')](function(_0x4a44c5){if(_0x4a44c5['message']===_0x7c61('0x56')){_0x104d61[_0x7c61('0x1a')](0x194)['send'](_0x7c61('0x5b'));}else{return handleError(_0x104d61,null);}});};exports[_0x7c61('0x5c')]=function(_0x1cc421,_0x190f08,_0x1a7f83){var _0x4dfe64=require('../../components/encryptor');var _0xe82743=![];var _0xa428f7={'$and':[db[_0x7c61('0x5d')][_0x7c61('0x3e')](db[_0x7c61('0x5d')]['fn'](_0x7c61('0x5e'),db[_0x7c61('0x5d')]['col'](_0x7c61('0x50'))),_0x1cc421[_0x7c61('0x35')][_0x7c61('0x5f')])]};if(_0x1cc421['query']['type']&&_0x1cc421[_0x7c61('0x35')][_0x7c61('0x2f')]==='uniqueid'){_0xa428f7[_0x7c61('0x60')]['push']({'uniqueid':_0x1cc421['params']['id']});}else{_0xa428f7[_0x7c61('0x60')][_0x7c61('0x61')]({'id':_0x1cc421[_0x7c61('0x49')]['id']});}return db['VoiceRecording'][_0x7c61('0x4b')]({'where':_0xa428f7,'attributes':['id',_0x7c61('0x51')],'raw':!![]})[_0x7c61('0x25')](handleEntityNotFound(_0x190f08,null))[_0x7c61('0x25')](function(_0x539cbc){if(_0x539cbc){var _0x12ce44=util['format'](_0x7c61('0x62'),_0x539cbc[_0x7c61('0x51')]);if(fs[_0x7c61('0x52')](_0x12ce44)){_0xe82743=!![];return _0x4dfe64['decryptFile'](_0x12ce44,_0x539cbc['value'],config[_0x7c61('0x63')]['recording'])[_0x7c61('0x25')](function(){return _0x539cbc;});}return _0x539cbc;}})['then'](function(_0x5b7524){if(_0x5b7524){if(!fs['existsSync'](_0x5b7524[_0x7c61('0x51')])){throw new db[(_0x7c61('0x55'))][(_0x7c61('0x64'))](_0x7c61('0x56'));}if(_0x5b7524[_0x7c61('0x57')]){return _0x190f08['download'](_0x5b7524[_0x7c61('0x51')],_0x5b7524[_0x7c61('0x57')]+path[_0x7c61('0x58')](_0x5b7524['value']),function(){if(_0xe82743){fs[_0x7c61('0x59')](_0x5b7524[_0x7c61('0x51')]);}});}else{return _0x190f08[_0x7c61('0x5a')](_0x5b7524['value'],function(_0x2e93e9){if(_0xe82743){fs[_0x7c61('0x59')](_0x5b7524[_0x7c61('0x51')]);}});}}})['catch'](handleError(_0x190f08,null));};exports[_0x7c61('0x26')]=function(_0x1813f1,_0x4a78f3){return db[_0x7c61('0x2c')][_0x7c61('0x4b')]({'where':{'id':_0x1813f1[_0x7c61('0x49')]['id']}})[_0x7c61('0x25')](function(_0x53a872){if(_[_0x7c61('0x65')](_0x53a872)){throw new ReferenceError(_0x7c61('0x66'));}return _0x53a872;})[_0x7c61('0x25')](function(_0x2808ec){var _0x3be429=_0x2808ec[_0x7c61('0x51')];logger[_0x7c61('0x67')](_0x7c61('0x68'),_0x3be429);if(!_[_0x7c61('0x65')](_0x2808ec[_0x7c61('0x51')])&&fs[_0x7c61('0x52')](_0x3be429)){logger[_0x7c61('0x67')]('File:\x20\x22'+_0x3be429+_0x7c61('0x69'));fs['unlinkSync'](_0x3be429);}_0x3be429=_0x3be429+_0x7c61('0x6a');if(!_['isNil'](_0x2808ec[_0x7c61('0x51')])&&fs[_0x7c61('0x52')](_0x3be429)){logger[_0x7c61('0x67')]('File:\x20\x22'+_0x3be429+_0x7c61('0x69'));fs['unlinkSync'](_0x3be429);}return _0x2808ec;})['then'](function(_0x59d344){if(!_0x59d344)throw new InternalError();return _0x59d344[_0x7c61('0x26')]();})[_0x7c61('0x25')](function(){_0x4a78f3['status'](0xcc)[_0x7c61('0x1b')]();})['catch'](handleError(_0x4a78f3,null));};function getBucketslist(_0xcc0978,_0x52f4ab,_0x508c76){return new Promise(function(_0x140eee,_0x45594d){var _0x6599fe=new AWS['S3']({'accessKeyId':_0x52f4ab,'secretAccessKey':_0xcc0978,'region':_0x508c76});_0x6599fe[_0x7c61('0x6b')]({},function(_0x32fcea,_0x1b72fc){if(_0x32fcea){return _0x45594d(_0x32fcea);}else{return _0x140eee(_0x1b72fc);}});});}function createBucket(_0x2b34eb,_0x5527a8,_0x4f3c4f,_0x25a45d){return new Promise(function(_0x6aef6f,_0x5f4d69){var _0x3245e3=new AWS['S3']({'accessKeyId':_0x5527a8,'secretAccessKey':_0x2b34eb,'region':_0x4f3c4f});_0x3245e3['createBucket']({'Bucket':_0x25a45d},function(_0xaa49bb,_0x54c49d){if(_0xaa49bb){return _0x5f4d69(_0xaa49bb);}else{return _0x6aef6f(_0x54c49d);}});});}function uploadFile(_0x113c3c,_0x463593,_0x525bea,_0x567b43,_0x370345,_0xbe0ae2){return new Promise(function(_0x5383f2,_0x5f410f){var _0x35b860=new AWS['S3']({'accessKeyId':_0x463593,'secretAccessKey':_0x113c3c,'region':_0x525bea});_0x35b860['upload']({'Bucket':_0x567b43,'Key':_0x370345,'Body':_0xbe0ae2},function(_0x207070,_0x2b57ce){if(_0x207070){return _0x5f410f(_0x207070);}else{return _0x5383f2(_0x2b57ce);}});});}function startTranscribe(_0x9a51cd,_0x52d87f,_0x481424,_0x25c2d8,_0x45074d,_0x3c8a20){return new Promise(function(_0x624c3e,_0x19ff4d){var _0x3a4351=new AWS[(_0x7c61('0x6c'))]({'accessKeyId':_0x52d87f,'secretAccessKey':_0x9a51cd,'region':_0x481424});_0x3a4351[_0x7c61('0x6d')]({'TranscriptionJobName':_0x25c2d8,'LanguageCode':_0x45074d,'Media':{'MediaFileUri':_0x3c8a20}},function(_0x26796b,_0x1bb772){if(_0x26796b){return _0x19ff4d(_0x26796b);}else{return _0x624c3e(_0x1bb772);}});});}function transcribe(_0x36b864,_0x10fc89,_0x2f00e7,_0x136723,_0xae1458,_0x3b14e0,_0x411e75){return new Promise(function(_0x24ae62,_0x1c08cb){var _0x11c26d={};logger[_0x7c61('0x67')](util[_0x7c61('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x36b864,_0xae1458));return uploadFile(_0x10fc89,_0x2f00e7,_0x136723,_0xae1458,path[_0x7c61('0x6e')](_0x3b14e0),fs['readFileSync'](_0x3b14e0))[_0x7c61('0x25')](function(_0x5e088d){logger[_0x7c61('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x36b864,_0xae1458,_0x5e088d[_0x7c61('0x6f')]));_0x11c26d[_0x7c61('0x70')]=_0x5e088d['Bucket'];_0x11c26d['location']=_0x5e088d[_0x7c61('0x6f')];logger[_0x7c61('0x67')](util['format'](_0x7c61('0x71'),_0x36b864));return startTranscribe(_0x10fc89,_0x2f00e7,_0x136723,uuidv4(),_0x411e75,_0x5e088d[_0x7c61('0x6f')]);})[_0x7c61('0x25')](function(_0x5a8af9){logger['info'](util[_0x7c61('0x33')](_0x7c61('0x72'),_0x36b864,_0x5a8af9['TranscriptionJob'][_0x7c61('0x73')]));_0x11c26d[_0x7c61('0x74')]=_0x5a8af9[_0x7c61('0x75')][_0x7c61('0x73')];_0x11c26d[_0x7c61('0x76')]=_0x5a8af9[_0x7c61('0x75')][_0x7c61('0x77')];return _0x24ae62(_0x11c26d);})[_0x7c61('0x47')](function(_0xa492b1){return _0x1c08cb(_0xa492b1);});});}exports[_0x7c61('0x78')]=function(_0x3edd9b,_0x14b53c,_0x3ba082){var _0x1b7e6c;var _0x123f1e;var _0x5369fc;var _0x4fb6e9=require(_0x7c61('0x79'));return db[_0x7c61('0x2c')][_0x7c61('0x7a')]({'where':{'id':_0x3edd9b[_0x7c61('0x49')]['id']}})[_0x7c61('0x25')](function(_0x3d9393){if(_0x3d9393){var _0x293019=util[_0x7c61('0x33')]('%s.cypher',_0x3d9393[_0x7c61('0x51')]);if(fs['existsSync'](_0x293019)){cypher=!![];return _0x4fb6e9[_0x7c61('0x53')](_0x293019,_0x3d9393[_0x7c61('0x51')],config[_0x7c61('0x63')][_0x7c61('0x54')])['then'](function(){return _0x3d9393;});}return _0x3d9393;}})[_0x7c61('0x25')](function(_0x4ef72f){if(!_0x4ef72f){throw new db[(_0x7c61('0x55'))][(_0x7c61('0x64'))](_0x7c61('0x7b'));}_0x123f1e=_0x4ef72f;return db[_0x7c61('0x7c')][_0x7c61('0x7a')]({'where':{'id':0x1}});})[_0x7c61('0x25')](handleEntityNotFound(_0x14b53c,null))['then'](function(_0x4fffb3){if(_0x4fffb3){_0x1b7e6c=_0x4fffb3;if(!_0x1b7e6c['transcribe']||!_0x1b7e6c[_0x7c61('0x7d')]||!_0x1b7e6c[_0x7c61('0x7e')]||!_0x1b7e6c[_0x7c61('0x7f')]||!_0x1b7e6c[_0x7c61('0x70')]){throw new db[(_0x7c61('0x55'))][(_0x7c61('0x64'))](_0x7c61('0x80'));}if(_0x3edd9b[_0x7c61('0x4d')][_0x7c61('0x81')]&&(!_0x1b7e6c[_0x7c61('0x82')]||!_0x1b7e6c[_0x7c61('0x83')]||!_0x1b7e6c[_0x7c61('0x84')]||!_0x1b7e6c[_0x7c61('0x7f')]||!_0x1b7e6c[_0x7c61('0x70')])){throw new db['Sequelize'][(_0x7c61('0x64'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x7c61('0x85')][_0x7c61('0x7a')]({'where':{'id':_0x1b7e6c[_0x7c61('0x7d')]}});}})[_0x7c61('0x25')](function(_0x30fe6c){if(!_0x30fe6c){throw new db[(_0x7c61('0x55'))][(_0x7c61('0x64'))](_0x7c61('0x86'));}if(!_0x30fe6c['data1']||!_0x30fe6c['data2']){throw new db['Sequelize'][(_0x7c61('0x64'))](_0x7c61('0x87'));}_0x5369fc=_0x30fe6c;return getBucketslist(_0x5369fc[_0x7c61('0x88')],_0x5369fc[_0x7c61('0x89')],_0x1b7e6c[_0x7c61('0x7e')]);})[_0x7c61('0x25')](function(_0x469c9e){if(_0x469c9e&&_0x469c9e[_0x7c61('0x8a')]){var _0xd6ea8d=_[_0x7c61('0x4b')](_0x469c9e[_0x7c61('0x8a')],function(_0x5e5cd0){return _0x5e5cd0[_0x7c61('0x8b')]===_0x1b7e6c[_0x7c61('0x70')];});if(!_0xd6ea8d){logger['info'](util[_0x7c61('0x33')](_0x7c61('0x8c'),_0x3edd9b[_0x7c61('0x49')]['id'],_0x1b7e6c[_0x7c61('0x70')]));return createBucket(_0x5369fc[_0x7c61('0x88')],_0x5369fc[_0x7c61('0x89')],_0x1b7e6c[_0x7c61('0x7e')],_0x1b7e6c[_0x7c61('0x70')]);}logger[_0x7c61('0x67')](util[_0x7c61('0x33')](_0x7c61('0x8d'),_0x3edd9b[_0x7c61('0x49')]['id'],_0x1b7e6c['bucket']));return;}})[_0x7c61('0x25')](function(_0x5509d9){if(_0x123f1e[_0x7c61('0x76')]===_0x7c61('0x8e')){return transcribe(_0x3edd9b[_0x7c61('0x49')]['id'],_0x5369fc[_0x7c61('0x88')],_0x5369fc['data2'],_0x1b7e6c['transcribeRegion'],_0x1b7e6c[_0x7c61('0x70')],_0x123f1e[_0x7c61('0x51')],_0x1b7e6c['language']);}else{logger['info'](util['format'](_0x7c61('0x8f'),_0x3edd9b['params']['id']));return{'transcribeStatus':_0x7c61('0x90')};}})['then'](function(_0x31d746){if(_0x31d746){_0x31d746[_0x7c61('0x91')]=_0x3edd9b[_0x7c61('0x4d')][_0x7c61('0x81')];return _0x123f1e['updateAttributes'](_0x31d746);}})['then'](respondWithResult(_0x14b53c,null))[_0x7c61('0x47')](handleError(_0x14b53c,null));};function writeFile(_0x1a944d,_0x27ec9c){return new Promise(function(_0x1dab60,_0x584b91){fs[_0x7c61('0x92')](_0x27ec9c,_0x1a944d,function(_0xf74512,_0x5e363d){if(_0xf74512){return _0x584b91(_0xf74512);}else{return _0x1dab60(_0x5e363d);}});});}exports[_0x7c61('0x93')]=function(_0x3f4ba5,_0x5a13c6,_0x32ee53){return db[_0x7c61('0x2c')][_0x7c61('0x7a')]({'where':{'id':_0x3f4ba5[_0x7c61('0x49')]['id']}})[_0x7c61('0x25')](handleEntityNotFound(_0x5a13c6))[_0x7c61('0x25')](function(_0x5bd0f0){if(_0x5bd0f0&&_0x5bd0f0[_0x7c61('0x94')]){var _0x3cd8e1=_0x5bd0f0[_0x7c61('0x94')];var _0x19e3ea=config[_0x7c61('0x95')]+'/server/files/transcribes/transcribe_'+_0x5bd0f0['id']+'.txt';if(fs[_0x7c61('0x52')](_0x19e3ea)){return _0x19e3ea;}return writeFile(_0x3cd8e1,_0x19e3ea)[_0x7c61('0x25')](function(){return _0x19e3ea;});}else{throw new db[(_0x7c61('0x55'))][(_0x7c61('0x64'))](_0x7c61('0x96'));}})[_0x7c61('0x25')](function(_0x28fa10){return _0x5a13c6['download'](_0x28fa10);})['catch'](handleError(_0x5a13c6));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 9981361..37d5772 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 _0xcab6=['uniqueid','transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','voice_recordings'];(function(_0x590ef3,_0x364cd0){var _0x313665=function(_0x4dd1de){while(--_0x4dd1de){_0x590ef3['push'](_0x590ef3['shift']());}};_0x313665(++_0x364cd0);}(_0xcab6,0xd4));var _0x6cab=function(_0x13ca6a,_0x2fa96a){_0x13ca6a=_0x13ca6a-0x0;var _0x2faabd=_0xcab6[_0x13ca6a];return _0x2faabd;};'use strict';var attributes=require(_0x6cab('0x0'));module['exports']=function(_0x45b94e,_0xcc7aeb){return _0x45b94e[_0x6cab('0x1')](_0x6cab('0x2'),attributes,{'tableName':_0x6cab('0x3'),'paranoid':![],'indexes':[{'name':_0x6cab('0x4'),'fields':['uniqueid']},{'name':_0x6cab('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x430e=['voice_recordings','uniqueid','transcribeStatus','exports','define','VoiceRecording'];(function(_0x332109,_0x474add){var _0x7a6ab2=function(_0x5132dd){while(--_0x5132dd){_0x332109['push'](_0x332109['shift']());}};_0x7a6ab2(++_0x474add);}(_0x430e,0x105));var _0xe430=function(_0x286855,_0x2747ad){_0x286855=_0x286855-0x0;var _0x3644c9=_0x430e[_0x286855];return _0x3644c9;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xe430('0x0')]=function(_0x2984a5,_0x4eaa9b){return _0x2984a5[_0xe430('0x1')](_0xe430('0x2'),attributes,{'tableName':_0xe430('0x3'),'paranoid':![],'indexes':[{'name':_0xe430('0x4'),'fields':['uniqueid']},{'name':_0xe430('0x5'),'fields':[_0xe430('0x5')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 415d93b..124b6b7 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 _0xfcbb=['VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','options','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','create','body','existsSync','value','format','%s.cypher','encryptFile','recording','unlink','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x367bad,_0x1eea19){var _0x3a99d3=function(_0x403c33){while(--_0x403c33){_0x367bad['push'](_0x367bad['shift']());}};_0x3a99d3(++_0x1eea19);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x57a60f,_0x2c3c15){_0x57a60f=_0x57a60f-0x0;var _0x2cddf0=_0xfcbb[_0x57a60f];return _0x2cddf0;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['where']||null:null,'attributes':_0xba1d6['options']?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1a')]||null:null,'limit':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')][_0xbfcb('0x1b')]||null:null})['then'](function(_0x365d6c){logger[_0xbfcb('0xb')](_0xbfcb('0x16'),_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x365d6c));_0x3404aa(_0x365d6c);})[_0xbfcb('0x15')](function(_0x14e43c){logger[_0xbfcb('0x10')](_0xbfcb('0x16'),_0x14e43c[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x14e43c[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1c')]=function(_0x3e954d){var _0x2a1272=this;return new Promise(function(_0x5cd703,_0x3465f5){var _0x2881f8=require('../../components/encryptor');var _0x64a69;return db[_0xbfcb('0x1d')][_0xbfcb('0x1e')]({'attributes':['id',_0xbfcb('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xbfcb('0xa')](function(_0x3542e9){_0x64a69=_0x3542e9;return db[_0xbfcb('0x17')][_0xbfcb('0x20')](_0x3e954d[_0xbfcb('0x21')]);})[_0xbfcb('0xa')](function(_0x59719b){if(_0x64a69[_0xbfcb('0x1f')]&&fs[_0xbfcb('0x22')](_0x59719b[_0xbfcb('0x23')])){var _0x43de3c=util[_0xbfcb('0x24')](_0xbfcb('0x25'),_0x59719b[_0xbfcb('0x23')]);return _0x2881f8[_0xbfcb('0x26')](_0x59719b[_0xbfcb('0x23')],_0x43de3c,config['secrets'][_0xbfcb('0x27')])[_0xbfcb('0xa')](function(){fs[_0xbfcb('0x28')](_0x59719b[_0xbfcb('0x23')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x59719b;});}return _0x59719b;})[_0xbfcb('0xa')](function(_0x35925b){logger[_0xbfcb('0xb')](_0xbfcb('0x1c'),_0x3e954d);logger[_0xbfcb('0xd')](_0xbfcb('0x1c'),_0x3e954d,JSON[_0xbfcb('0xf')](_0x35925b));_0x5cd703(_0x35925b);})['catch'](function(_0x504d81){logger['error'](_0xbfcb('0x1c'),_0x504d81['message'],_0x3e954d);_0x3465f5(_0x2a1272[_0xbfcb('0x10')](0x1f4,_0x504d81[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0xd7d1=['unlink','CreateVoiceRecording\x20file\x20encrypted','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','update','body','options','raw','where','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','format','%s.cypher','value','encryptFile','secrets','recording'];(function(_0xd22d95,_0xc59f8f){var _0x15d7a3=function(_0x3db95c){while(--_0x3db95c){_0xd22d95['push'](_0xd22d95['shift']());}};_0x15d7a3(++_0xc59f8f);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x680b2a,_0x3e68b0){_0x680b2a=_0x680b2a-0x0;var _0x94e14c=_0xd7d1[_0x680b2a];return _0x94e14c;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('VoiceRecording,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('VoiceRecording,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});}exports[_0x1d7d('0x19')]=function(_0x4db4f2){var _0x664e3f=this;return new Promise(function(_0x191024,_0x5cbb8f){return db['VoiceRecording'][_0x1d7d('0x1a')](_0x4db4f2[_0x1d7d('0x1b')],{'raw':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2[_0x1d7d('0x1c')][_0x1d7d('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2['options'][_0x1d7d('0x1e')]||null:null,'attributes':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2[_0x1d7d('0x1c')]['attributes']||null:null,'limit':_0x4db4f2[_0x1d7d('0x1c')]?_0x4db4f2[_0x1d7d('0x1c')]['limit']||null:null})['then'](function(_0x1dcaf2){logger[_0x1d7d('0xf')](_0x1d7d('0x19'),_0x4db4f2);logger['debug'](_0x1d7d('0x19'),_0x4db4f2,JSON[_0x1d7d('0x13')](_0x1dcaf2));_0x191024(_0x1dcaf2);})[_0x1d7d('0x18')](function(_0x21e59){logger['error'](_0x1d7d('0x19'),_0x21e59[_0x1d7d('0x16')],_0x4db4f2);_0x5cbb8f(_0x664e3f['error'](0x1f4,_0x21e59['message']));});});};exports[_0x1d7d('0x1f')]=function(_0x52c618){var _0x38c323=this;return new Promise(function(_0x2d4de4,_0x3bc6e8){var _0x22c40d=require(_0x1d7d('0x20'));var _0x59f827;return db[_0x1d7d('0x21')][_0x1d7d('0x22')]({'attributes':['id',_0x1d7d('0x23')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x78adbe){_0x59f827=_0x78adbe;return db[_0x1d7d('0x24')][_0x1d7d('0x25')](_0x52c618['body']);})['then'](function(_0x53e25c){if(_0x59f827[_0x1d7d('0x23')]&&fs[_0x1d7d('0x26')](_0x53e25c['value'])){var _0x1ebcbc=util[_0x1d7d('0x27')](_0x1d7d('0x28'),_0x53e25c[_0x1d7d('0x29')]);return _0x22c40d[_0x1d7d('0x2a')](_0x53e25c[_0x1d7d('0x29')],_0x1ebcbc,config[_0x1d7d('0x2b')][_0x1d7d('0x2c')])[_0x1d7d('0xe')](function(){fs[_0x1d7d('0x2d')](_0x53e25c['value']);logger['info'](_0x1d7d('0x2e'));return _0x53e25c;});}return _0x53e25c;})[_0x1d7d('0xe')](function(_0x90e852){logger[_0x1d7d('0xf')](_0x1d7d('0x1f'),_0x52c618);logger[_0x1d7d('0x2f')](_0x1d7d('0x1f'),_0x52c618,JSON[_0x1d7d('0x13')](_0x90e852));_0x2d4de4(_0x90e852);})[_0x1d7d('0x18')](function(_0x47b6b2){logger[_0x1d7d('0x14')](_0x1d7d('0x1f'),_0x47b6b2[_0x1d7d('0x16')],_0x52c618);_0x3bc6e8(_0x38c323[_0x1d7d('0x14')](0x1f4,_0x47b6b2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index c8c07a3..7b43418 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 _0x5595=['../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','describe','post','create','delete','destroy','exports','connect-timeout','express','Router','fs-extra'];(function(_0x952637,_0x435725){var _0x25c8b3=function(_0x10aebb){while(--_0x10aebb){_0x952637['push'](_0x952637['shift']());}};_0x25c8b3(++_0x435725);}(_0x5595,0xfb));var _0x5559=function(_0x5ed835,_0x316f89){_0x5ed835=_0x5ed835-0x0;var _0x2b567b=_0x5595[_0x5ed835];return _0x2b567b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5559('0x0'));var express=require(_0x5559('0x1'));var router=express[_0x5559('0x2')]();var fs_extra=require(_0x5559('0x3'));var auth=require(_0x5559('0x4'));var interaction=require(_0x5559('0x5'));var config=require('../../config/environment');var controller=require(_0x5559('0x6'));router[_0x5559('0x7')]('/',auth['isAuthenticated'](),controller[_0x5559('0x8')]);router[_0x5559('0x7')](_0x5559('0x9'),auth[_0x5559('0xa')](),controller[_0x5559('0xb')]);router[_0x5559('0x7')]('/:id',auth[_0x5559('0xa')](),controller['show']);router[_0x5559('0xc')]('/',auth[_0x5559('0xa')](),controller[_0x5559('0xd')]);router['put']('/:id',auth[_0x5559('0xa')](),controller['update']);router[_0x5559('0xe')]('/:id',auth[_0x5559('0xa')](),controller[_0x5559('0xf')]);module[_0x5559('0x10')]=router; \ No newline at end of file +var _0x9b7b=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','put'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x9b7b,0x1cf));var _0xb9b7=function(_0x218fa3,_0xc5ad81){_0x218fa3=_0x218fa3-0x0;var _0x548b90=_0x9b7b[_0x218fa3];return _0x548b90;};'use strict';var multer=require(_0xb9b7('0x0'));var util=require(_0xb9b7('0x1'));var path=require(_0xb9b7('0x2'));var timeout=require(_0xb9b7('0x3'));var express=require(_0xb9b7('0x4'));var router=express[_0xb9b7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb9b7('0x6'));var interaction=require(_0xb9b7('0x7'));var config=require('../../config/environment');var controller=require(_0xb9b7('0x8'));router[_0xb9b7('0x9')]('/',auth[_0xb9b7('0xa')](),controller[_0xb9b7('0xb')]);router[_0xb9b7('0x9')](_0xb9b7('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xb9b7('0xd'),auth[_0xb9b7('0xa')](),controller[_0xb9b7('0xe')]);router[_0xb9b7('0xf')]('/',auth[_0xb9b7('0xa')](),controller['create']);router[_0xb9b7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb9b7('0x11')]);router['delete'](_0xb9b7('0xd'),auth[_0xb9b7('0xa')](),controller[_0xb9b7('0x12')]);module[_0xb9b7('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 5eb8611..3493ea1 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 _0x8888=['STRING','sequelize','exports','attended'];(function(_0x1d418e,_0x418ae6){var _0x13014b=function(_0x3e8461){while(--_0x3e8461){_0x1d418e['push'](_0x1d418e['shift']());}};_0x13014b(++_0x418ae6);}(_0x8888,0x14d));var _0x8888=function(_0x26a6e3,_0x4f23ff){_0x26a6e3=_0x26a6e3-0x0;var _0x2ca6a1=_0x8888[_0x26a6e3];return _0x2ca6a1;};'use strict';var Sequelize=require(_0x8888('0x0'));var moment=require('moment');module[_0x8888('0x1')]={'type':{'type':Sequelize['ENUM']('blind',_0x8888('0x2'))},'result':{'type':Sequelize[_0x8888('0x3')]},'transfererchannel':{'type':Sequelize[_0x8888('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x8888('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x8888('0x3')]},'transferercontext':{'type':Sequelize[_0x8888('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x8888('0x3')]},'transfereechannel':{'type':Sequelize[_0x8888('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x8888('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x8888('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x8888('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x8888('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x8888('0x3')]},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x8888('0x3')]}}; \ No newline at end of file +var _0xe18e=['blind','attended','STRING','ENUM','Yes','sequelize','moment'];(function(_0x3b9815,_0x21a16f){var _0x46fa98=function(_0x1e9f92){while(--_0x1e9f92){_0x3b9815['push'](_0x3b9815['shift']());}};_0x46fa98(++_0x21a16f);}(_0xe18e,0xe5));var _0xee18=function(_0x511401,_0x22fa74){_0x511401=_0x511401-0x0;var _0x10c9bb=_0xe18e[_0x511401];return _0x10c9bb;};'use strict';var Sequelize=require(_0xee18('0x0'));var moment=require(_0xee18('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xee18('0x2'),_0xee18('0x3'))},'result':{'type':Sequelize[_0xee18('0x4')]},'transfererchannel':{'type':Sequelize[_0xee18('0x4')]},'transferercalleridnum':{'type':Sequelize[_0xee18('0x4')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0xee18('0x4')]},'transfererconnectedlinename':{'type':Sequelize[_0xee18('0x4')]},'transfereraccountcode':{'type':Sequelize[_0xee18('0x4')]},'transferercontext':{'type':Sequelize[_0xee18('0x4')]},'transfererexten':{'type':Sequelize[_0xee18('0x4')]},'transfererlinkedid':{'type':Sequelize[_0xee18('0x4')]},'transfereechannel':{'type':Sequelize[_0xee18('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0xee18('0x4')]},'transfereecalleridname':{'type':Sequelize[_0xee18('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xee18('0x4')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xee18('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xee18('0x4')]},'isexternal':{'type':Sequelize[_0xee18('0x5')](_0xee18('0x6'),'No')},'context':{'type':Sequelize[_0xee18('0x4')]},'extension':{'type':Sequelize[_0xee18('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 958471d..8e8c86f 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 _0x7c37=['limit','Content-Range','apply','reject','update','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0x7c37,0x10a));var _0x77c3=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x7c37[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x77c3('0x0'));var jsonpatch=require(_0x77c3('0x1'));var rp=require(_0x77c3('0x2'));var moment=require(_0x77c3('0x3'));var BPromise=require(_0x77c3('0x4'));var Mustache=require(_0x77c3('0x5'));var util=require(_0x77c3('0x6'));var path=require(_0x77c3('0x7'));var sox=require(_0x77c3('0x8'));var csv=require(_0x77c3('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77c3('0xa'));var _=require(_0x77c3('0xb'));var squel=require(_0x77c3('0xc'));var crypto=require(_0x77c3('0xd'));var jsforce=require(_0x77c3('0xe'));var deskjs=require(_0x77c3('0xf'));var toCsv=require(_0x77c3('0x9'));var querystring=require(_0x77c3('0x10'));var Papa=require(_0x77c3('0x11'));var Redis=require(_0x77c3('0x12'));var authService=require(_0x77c3('0x13'));var qs=require(_0x77c3('0x14'));var as=require(_0x77c3('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77c3('0x16'))(_0x77c3('0x17'));var utils=require(_0x77c3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x77c3('0x19'));var db=require(_0x77c3('0x1a'))['db'];function respondWithStatusCode(_0x4e7822,_0x236c9a){_0x236c9a=_0x236c9a||0xcc;return function(_0x56d951){if(_0x56d951){return _0x4e7822[_0x77c3('0x1b')](_0x236c9a);}return _0x4e7822[_0x77c3('0x1c')](_0x236c9a)[_0x77c3('0x1d')]();};}function respondWithResult(_0x21d538,_0x33a96e){_0x33a96e=_0x33a96e||0xc8;return function(_0x551b91){if(_0x551b91){return _0x21d538[_0x77c3('0x1c')](_0x33a96e)[_0x77c3('0x1e')](_0x551b91);}};}function respondWithFilteredResult(_0x3b9838,_0x2c1b48){return function(_0x2b73c7){if(_0x2b73c7){var _0x386c49=typeof _0x2c1b48['offset']===_0x77c3('0x1f')&&typeof _0x2c1b48['limit']===_0x77c3('0x1f');var _0x37dcdc=_0x2b73c7[_0x77c3('0x20')];var _0x5257e9=_0x386c49?0x0:_0x2c1b48['offset'];var _0x7355d0=_0x386c49?_0x2b73c7[_0x77c3('0x20')]:_0x2c1b48[_0x77c3('0x21')]+_0x2c1b48[_0x77c3('0x22')];var _0x17bbba;if(_0x7355d0>=_0x37dcdc){_0x7355d0=_0x37dcdc;_0x17bbba=0xc8;}else{_0x17bbba=0xce;}_0x3b9838['status'](_0x17bbba);return _0x3b9838['set'](_0x77c3('0x23'),_0x5257e9+'-'+_0x7355d0+'/'+_0x37dcdc)[_0x77c3('0x1e')](_0x2b73c7);}return null;};}function patchUpdates(_0x1a6038){return function(_0x5d6508){try{jsonpatch[_0x77c3('0x24')](_0x5d6508,_0x1a6038,!![]);}catch(_0x11f5d4){return BPromise[_0x77c3('0x25')](_0x11f5d4);}return _0x5d6508['save']();};}function saveUpdates(_0x57703d,_0xe9c6ce){return function(_0x52afcb){if(_0x52afcb){return _0x52afcb[_0x77c3('0x26')](_0x57703d)[_0x77c3('0x27')](function(_0x68bf6f){return _0x68bf6f;});}return null;};}function removeEntity(_0x2dedc9,_0xf615fa){return function(_0x5128ac){if(_0x5128ac){return _0x5128ac['destroy']()[_0x77c3('0x27')](function(){_0x2dedc9['status'](0xcc)[_0x77c3('0x1d')]();});}};}function handleEntityNotFound(_0x3675ad,_0x56b8d6){return function(_0x275f9e){if(!_0x275f9e){_0x3675ad[_0x77c3('0x1b')](0x194);}return _0x275f9e;};}function handleError(_0x18179d,_0x570a49){_0x570a49=_0x570a49||0x1f4;return function(_0x86a53e){logger[_0x77c3('0x28')](_0x86a53e[_0x77c3('0x29')]);if(_0x86a53e[_0x77c3('0x2a')]){delete _0x86a53e[_0x77c3('0x2a')];}_0x18179d[_0x77c3('0x1c')](_0x570a49)[_0x77c3('0x2b')](_0x86a53e);};}exports['index']=function(_0x5392a6,_0x252493){var _0x4f37e8={},_0x559fbf={},_0x57e3d8={'count':0x0,'rows':[]};var _0x1e4d8d=_[_0x77c3('0x2c')](db[_0x77c3('0x2d')][_0x77c3('0x2e')],function(_0x674ad5){return{'name':_0x674ad5['fieldName'],'type':_0x674ad5['type']['key']};});_0x559fbf['model']=_[_0x77c3('0x2c')](_0x1e4d8d,_0x77c3('0x2a'));_0x559fbf[_0x77c3('0x2f')]=_[_0x77c3('0x30')](_0x5392a6[_0x77c3('0x2f')]);_0x559fbf[_0x77c3('0x31')]=_[_0x77c3('0x32')](_0x559fbf[_0x77c3('0x33')],_0x559fbf[_0x77c3('0x2f')]);_0x4f37e8[_0x77c3('0x34')]=_[_0x77c3('0x32')](_0x559fbf['model'],qs[_0x77c3('0x35')](_0x5392a6[_0x77c3('0x2f')][_0x77c3('0x35')]));_0x4f37e8[_0x77c3('0x34')]=_0x4f37e8[_0x77c3('0x34')][_0x77c3('0x36')]?_0x4f37e8[_0x77c3('0x34')]:_0x559fbf[_0x77c3('0x33')];if(!_0x5392a6[_0x77c3('0x2f')][_0x77c3('0x37')]('nolimit')){_0x4f37e8['limit']=qs[_0x77c3('0x22')](_0x5392a6[_0x77c3('0x2f')][_0x77c3('0x22')]);_0x4f37e8[_0x77c3('0x21')]=qs[_0x77c3('0x21')](_0x5392a6['query'][_0x77c3('0x21')]);}_0x4f37e8[_0x77c3('0x38')]=qs['sort'](_0x5392a6[_0x77c3('0x2f')][_0x77c3('0x39')]);_0x4f37e8[_0x77c3('0x3a')]=qs[_0x77c3('0x31')](_['pick'](_0x5392a6[_0x77c3('0x2f')],_0x559fbf['filters']),_0x1e4d8d);if(_0x5392a6['query'][_0x77c3('0x3b')]){_0x4f37e8[_0x77c3('0x3a')]=_['merge'](_0x4f37e8[_0x77c3('0x3a')],{'$or':_[_0x77c3('0x2c')](_0x1e4d8d,function(_0xd832bb){if(_0xd832bb[_0x77c3('0x3c')]!==_0x77c3('0x3d')){var _0x33ff7c={};_0x33ff7c[_0xd832bb[_0x77c3('0x2a')]]={'$like':'%'+_0x5392a6[_0x77c3('0x2f')][_0x77c3('0x3b')]+'%'};return _0x33ff7c;}})});}_0x4f37e8=_[_0x77c3('0x3e')]({},_0x4f37e8,_0x5392a6[_0x77c3('0x3f')]);var _0x4fdf3f={'where':_0x4f37e8[_0x77c3('0x3a')]};return db[_0x77c3('0x2d')][_0x77c3('0x20')](_0x4fdf3f)[_0x77c3('0x27')](function(_0xf58cc5){_0x57e3d8['count']=_0xf58cc5;if(_0x5392a6[_0x77c3('0x2f')]['includeAll']){_0x4f37e8[_0x77c3('0x40')]=[{'all':!![]}];}return db[_0x77c3('0x2d')][_0x77c3('0x41')](_0x4f37e8);})[_0x77c3('0x27')](function(_0x365ce2){_0x57e3d8[_0x77c3('0x42')]=_0x365ce2;return _0x57e3d8;})[_0x77c3('0x27')](respondWithFilteredResult(_0x252493,_0x4f37e8))['catch'](handleError(_0x252493,null));};exports[_0x77c3('0x43')]=function(_0x171c48,_0x426b5c){var _0x52cf75={'raw':!![],'where':{'id':_0x171c48[_0x77c3('0x44')]['id']}},_0x293fb5={};_0x293fb5[_0x77c3('0x33')]=_[_0x77c3('0x30')](db[_0x77c3('0x2d')][_0x77c3('0x2e')]);_0x293fb5['query']=_[_0x77c3('0x30')](_0x171c48[_0x77c3('0x2f')]);_0x293fb5[_0x77c3('0x31')]=_[_0x77c3('0x32')](_0x293fb5['model'],_0x293fb5['query']);_0x52cf75['attributes']=_[_0x77c3('0x32')](_0x293fb5['model'],qs[_0x77c3('0x35')](_0x171c48[_0x77c3('0x2f')][_0x77c3('0x35')]));_0x52cf75[_0x77c3('0x34')]=_0x52cf75[_0x77c3('0x34')][_0x77c3('0x36')]?_0x52cf75[_0x77c3('0x34')]:_0x293fb5[_0x77c3('0x33')];if(_0x171c48['query'][_0x77c3('0x45')]){_0x52cf75['include']=[{'all':!![]}];}_0x52cf75=_['merge']({},_0x52cf75,_0x171c48[_0x77c3('0x3f')]);return db[_0x77c3('0x2d')][_0x77c3('0x46')](_0x52cf75)[_0x77c3('0x27')](handleEntityNotFound(_0x426b5c,null))[_0x77c3('0x27')](respondWithResult(_0x426b5c,null))[_0x77c3('0x47')](handleError(_0x426b5c,null));};exports[_0x77c3('0x48')]=function(_0x3165c3,_0x26a283){return db[_0x77c3('0x2d')][_0x77c3('0x48')](_0x3165c3[_0x77c3('0x49')],{})['then'](respondWithResult(_0x26a283,0xc9))[_0x77c3('0x47')](handleError(_0x26a283,null));};exports['update']=function(_0x2e5ce5,_0x3be64f){if(_0x2e5ce5[_0x77c3('0x49')]['id']){delete _0x2e5ce5['body']['id'];}return db[_0x77c3('0x2d')][_0x77c3('0x46')]({'where':{'id':_0x2e5ce5[_0x77c3('0x44')]['id']}})[_0x77c3('0x27')](handleEntityNotFound(_0x3be64f,null))[_0x77c3('0x27')](saveUpdates(_0x2e5ce5[_0x77c3('0x49')],null))['then'](respondWithResult(_0x3be64f,null))['catch'](handleError(_0x3be64f,null));};exports['destroy']=function(_0x4113e9,_0x56e23e){return db['VoiceTransferReport'][_0x77c3('0x46')]({'where':{'id':_0x4113e9[_0x77c3('0x44')]['id']}})[_0x77c3('0x27')](handleEntityNotFound(_0x56e23e,null))['then'](removeEntity(_0x56e23e,null))[_0x77c3('0x47')](handleError(_0x56e23e,null));};exports['describe']=function(_0x252fea,_0x501cc0){return db[_0x77c3('0x2d')][_0x77c3('0x4a')]()[_0x77c3('0x27')](respondWithResult(_0x501cc0,null))[_0x77c3('0x47')](handleError(_0x501cc0,null));}; \ No newline at end of file +var _0xf5f9=['then','sendStatus','error','stack','name','send','map','VoiceTransferReport','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy'];(function(_0x2cb180,_0xd7fe){var _0x2ac7cd=function(_0x3efa5a){while(--_0x3efa5a){_0x2cb180['push'](_0x2cb180['shift']());}};_0x2ac7cd(++_0xd7fe);}(_0xf5f9,0xb2));var _0x9f5f=function(_0x2a24a,_0x36f29d){_0x2a24a=_0x2a24a-0x0;var _0x5d3c69=_0xf5f9[_0x2a24a];return _0x5d3c69;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9f5f('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f5f('0x1'));var moment=require(_0x9f5f('0x2'));var BPromise=require(_0x9f5f('0x3'));var Mustache=require(_0x9f5f('0x4'));var util=require(_0x9f5f('0x5'));var path=require(_0x9f5f('0x6'));var sox=require('sox');var csv=require(_0x9f5f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f5f('0x8'));var _=require('lodash');var squel=require(_0x9f5f('0x9'));var crypto=require(_0x9f5f('0xa'));var jsforce=require(_0x9f5f('0xb'));var deskjs=require(_0x9f5f('0xc'));var toCsv=require(_0x9f5f('0x7'));var querystring=require(_0x9f5f('0xd'));var Papa=require(_0x9f5f('0xe'));var Redis=require(_0x9f5f('0xf'));var authService=require(_0x9f5f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9f5f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f5f('0x12'))(_0x9f5f('0x13'));var utils=require(_0x9f5f('0x14'));var config=require(_0x9f5f('0x15'));var licenseUtil=require(_0x9f5f('0x16'));var db=require(_0x9f5f('0x17'))['db'];function respondWithStatusCode(_0x15a6c1,_0xfc6d47){_0xfc6d47=_0xfc6d47||0xcc;return function(_0x295aa1){if(_0x295aa1){return _0x15a6c1['sendStatus'](_0xfc6d47);}return _0x15a6c1[_0x9f5f('0x18')](_0xfc6d47)['end']();};}function respondWithResult(_0x20625b,_0x487644){_0x487644=_0x487644||0xc8;return function(_0x5902e3){if(_0x5902e3){return _0x20625b[_0x9f5f('0x18')](_0x487644)[_0x9f5f('0x19')](_0x5902e3);}};}function respondWithFilteredResult(_0xeb152a,_0x472920){return function(_0x198e2e){if(_0x198e2e){var _0x376bea=typeof _0x472920[_0x9f5f('0x1a')]==='undefined'&&typeof _0x472920[_0x9f5f('0x1b')]===_0x9f5f('0x1c');var _0x16feb6=_0x198e2e['count'];var _0x5c6509=_0x376bea?0x0:_0x472920[_0x9f5f('0x1a')];var _0x39557e=_0x376bea?_0x198e2e[_0x9f5f('0x1d')]:_0x472920['offset']+_0x472920['limit'];var _0x12513a;if(_0x39557e>=_0x16feb6){_0x39557e=_0x16feb6;_0x12513a=0xc8;}else{_0x12513a=0xce;}_0xeb152a['status'](_0x12513a);return _0xeb152a['set'](_0x9f5f('0x1e'),_0x5c6509+'-'+_0x39557e+'/'+_0x16feb6)[_0x9f5f('0x19')](_0x198e2e);}return null;};}function patchUpdates(_0x208e9a){return function(_0x4b95d8){try{jsonpatch[_0x9f5f('0x1f')](_0x4b95d8,_0x208e9a,!![]);}catch(_0x655ef){return BPromise['reject'](_0x655ef);}return _0x4b95d8[_0x9f5f('0x20')]();};}function saveUpdates(_0x1501b3,_0xc0bb0a){return function(_0x4954e6){if(_0x4954e6){return _0x4954e6[_0x9f5f('0x21')](_0x1501b3)['then'](function(_0x1236df){return _0x1236df;});}return null;};}function removeEntity(_0x21bce2,_0x5675cb){return function(_0x27fa3d){if(_0x27fa3d){return _0x27fa3d[_0x9f5f('0x22')]()[_0x9f5f('0x23')](function(){_0x21bce2[_0x9f5f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ecd67,_0x4020f3){return function(_0x51d42f){if(!_0x51d42f){_0x4ecd67[_0x9f5f('0x24')](0x194);}return _0x51d42f;};}function handleError(_0x2bd757,_0x5d20fb){_0x5d20fb=_0x5d20fb||0x1f4;return function(_0xecefa9){logger[_0x9f5f('0x25')](_0xecefa9[_0x9f5f('0x26')]);if(_0xecefa9['name']){delete _0xecefa9[_0x9f5f('0x27')];}_0x2bd757[_0x9f5f('0x18')](_0x5d20fb)[_0x9f5f('0x28')](_0xecefa9);};}exports['index']=function(_0x10b21d,_0x2c5b6c){var _0x5154e9={},_0x18ab2f={},_0x4f5635={'count':0x0,'rows':[]};var _0x36df3a=_[_0x9f5f('0x29')](db[_0x9f5f('0x2a')]['rawAttributes'],function(_0x80f8b2){return{'name':_0x80f8b2['fieldName'],'type':_0x80f8b2['type'][_0x9f5f('0x2b')]};});_0x18ab2f[_0x9f5f('0x2c')]=_['map'](_0x36df3a,_0x9f5f('0x27'));_0x18ab2f[_0x9f5f('0x2d')]=_[_0x9f5f('0x2e')](_0x10b21d['query']);_0x18ab2f[_0x9f5f('0x2f')]=_['intersection'](_0x18ab2f[_0x9f5f('0x2c')],_0x18ab2f['query']);_0x5154e9[_0x9f5f('0x30')]=_[_0x9f5f('0x31')](_0x18ab2f['model'],qs['fields'](_0x10b21d[_0x9f5f('0x2d')]['fields']));_0x5154e9['attributes']=_0x5154e9['attributes'][_0x9f5f('0x32')]?_0x5154e9[_0x9f5f('0x30')]:_0x18ab2f['model'];if(!_0x10b21d[_0x9f5f('0x2d')][_0x9f5f('0x33')]('nolimit')){_0x5154e9['limit']=qs[_0x9f5f('0x1b')](_0x10b21d[_0x9f5f('0x2d')]['limit']);_0x5154e9[_0x9f5f('0x1a')]=qs[_0x9f5f('0x1a')](_0x10b21d[_0x9f5f('0x2d')][_0x9f5f('0x1a')]);}_0x5154e9['order']=qs[_0x9f5f('0x34')](_0x10b21d[_0x9f5f('0x2d')][_0x9f5f('0x34')]);_0x5154e9['where']=qs[_0x9f5f('0x2f')](_[_0x9f5f('0x35')](_0x10b21d['query'],_0x18ab2f[_0x9f5f('0x2f')]),_0x36df3a);if(_0x10b21d[_0x9f5f('0x2d')][_0x9f5f('0x36')]){_0x5154e9[_0x9f5f('0x37')]=_[_0x9f5f('0x38')](_0x5154e9['where'],{'$or':_[_0x9f5f('0x29')](_0x36df3a,function(_0x3f027a){if(_0x3f027a['type']!==_0x9f5f('0x39')){var _0x58fe7a={};_0x58fe7a[_0x3f027a[_0x9f5f('0x27')]]={'$like':'%'+_0x10b21d['query'][_0x9f5f('0x36')]+'%'};return _0x58fe7a;}})});}_0x5154e9=_[_0x9f5f('0x38')]({},_0x5154e9,_0x10b21d[_0x9f5f('0x3a')]);var _0x10dfb6={'where':_0x5154e9[_0x9f5f('0x37')]};return db[_0x9f5f('0x2a')][_0x9f5f('0x1d')](_0x10dfb6)[_0x9f5f('0x23')](function(_0x2f1209){_0x4f5635['count']=_0x2f1209;if(_0x10b21d[_0x9f5f('0x2d')]['includeAll']){_0x5154e9[_0x9f5f('0x3b')]=[{'all':!![]}];}return db[_0x9f5f('0x2a')][_0x9f5f('0x3c')](_0x5154e9);})[_0x9f5f('0x23')](function(_0x39973e){_0x4f5635[_0x9f5f('0x3d')]=_0x39973e;return _0x4f5635;})[_0x9f5f('0x23')](respondWithFilteredResult(_0x2c5b6c,_0x5154e9))[_0x9f5f('0x3e')](handleError(_0x2c5b6c,null));};exports[_0x9f5f('0x3f')]=function(_0x35ff2b,_0x3a7941){var _0x2500da={'raw':!![],'where':{'id':_0x35ff2b[_0x9f5f('0x40')]['id']}},_0x113fd7={};_0x113fd7[_0x9f5f('0x2c')]=_[_0x9f5f('0x2e')](db[_0x9f5f('0x2a')][_0x9f5f('0x41')]);_0x113fd7[_0x9f5f('0x2d')]=_[_0x9f5f('0x2e')](_0x35ff2b[_0x9f5f('0x2d')]);_0x113fd7[_0x9f5f('0x2f')]=_['intersection'](_0x113fd7['model'],_0x113fd7['query']);_0x2500da[_0x9f5f('0x30')]=_['intersection'](_0x113fd7[_0x9f5f('0x2c')],qs[_0x9f5f('0x42')](_0x35ff2b[_0x9f5f('0x2d')]['fields']));_0x2500da[_0x9f5f('0x30')]=_0x2500da[_0x9f5f('0x30')]['length']?_0x2500da['attributes']:_0x113fd7['model'];if(_0x35ff2b[_0x9f5f('0x2d')]['includeAll']){_0x2500da[_0x9f5f('0x3b')]=[{'all':!![]}];}_0x2500da=_[_0x9f5f('0x38')]({},_0x2500da,_0x35ff2b[_0x9f5f('0x3a')]);return db[_0x9f5f('0x2a')][_0x9f5f('0x43')](_0x2500da)['then'](handleEntityNotFound(_0x3a7941,null))[_0x9f5f('0x23')](respondWithResult(_0x3a7941,null))['catch'](handleError(_0x3a7941,null));};exports[_0x9f5f('0x44')]=function(_0x7e0752,_0xb8400e){return db[_0x9f5f('0x2a')]['create'](_0x7e0752[_0x9f5f('0x45')],{})[_0x9f5f('0x23')](respondWithResult(_0xb8400e,0xc9))[_0x9f5f('0x3e')](handleError(_0xb8400e,null));};exports[_0x9f5f('0x21')]=function(_0x516326,_0x3816c2){if(_0x516326['body']['id']){delete _0x516326['body']['id'];}return db[_0x9f5f('0x2a')][_0x9f5f('0x43')]({'where':{'id':_0x516326[_0x9f5f('0x40')]['id']}})[_0x9f5f('0x23')](handleEntityNotFound(_0x3816c2,null))[_0x9f5f('0x23')](saveUpdates(_0x516326['body'],null))[_0x9f5f('0x23')](respondWithResult(_0x3816c2,null))[_0x9f5f('0x3e')](handleError(_0x3816c2,null));};exports[_0x9f5f('0x22')]=function(_0x210588,_0x4ddde1){return db['VoiceTransferReport'][_0x9f5f('0x43')]({'where':{'id':_0x210588['params']['id']}})[_0x9f5f('0x23')](handleEntityNotFound(_0x4ddde1,null))[_0x9f5f('0x23')](removeEntity(_0x4ddde1,null))['catch'](handleError(_0x4ddde1,null));};exports[_0x9f5f('0x46')]=function(_0x5aec01,_0x3e269b){return db[_0x9f5f('0x2a')][_0x9f5f('0x46')]()[_0x9f5f('0x23')](respondWithResult(_0x3e269b,null))[_0x9f5f('0x3e')](handleError(_0x3e269b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index d9e18d8..eb08459 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 _0xe4b9=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VoiceTransferReport','report_call_transfer'];(function(_0x2af76d,_0x5031cf){var _0xa6005e=function(_0x4da736){while(--_0x4da736){_0x2af76d['push'](_0x2af76d['shift']());}};_0xa6005e(++_0x5031cf);}(_0xe4b9,0xf0));var _0x9e4b=function(_0x2fce53,_0x10ef75){_0x2fce53=_0x2fce53-0x0;var _0x449d75=_0xe4b9[_0x2fce53];return _0x449d75;};'use strict';var _=require('lodash');var util=require(_0x9e4b('0x0'));var logger=require(_0x9e4b('0x1'))(_0x9e4b('0x2'));var moment=require(_0x9e4b('0x3'));var BPromise=require(_0x9e4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9e4b('0x5'));var rimraf=require(_0x9e4b('0x6'));var config=require(_0x9e4b('0x7'));var attributes=require('./voiceTransferReport.attributes');module[_0x9e4b('0x8')]=function(_0x3015ad,_0x31404c){return _0x3015ad[_0x9e4b('0x9')](_0x9e4b('0xa'),attributes,{'tableName':_0x9e4b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d43=['api','moment','bluebird','request-promise','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','lodash','util','../../config/logger'];(function(_0x35268e,_0x4acfd1){var _0x28ba11=function(_0x34f637){while(--_0x34f637){_0x35268e['push'](_0x35268e['shift']());}};_0x28ba11(++_0x4acfd1);}(_0x7d43,0xc9));var _0x37d4=function(_0x515095,_0x2ee9b8){_0x515095=_0x515095-0x0;var _0x3dfd35=_0x7d43[_0x515095];return _0x3dfd35;};'use strict';var _=require(_0x37d4('0x0'));var util=require(_0x37d4('0x1'));var logger=require(_0x37d4('0x2'))(_0x37d4('0x3'));var moment=require(_0x37d4('0x4'));var BPromise=require(_0x37d4('0x5'));var rp=require(_0x37d4('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x37d4('0x7'));var attributes=require(_0x37d4('0x8'));module[_0x37d4('0x9')]=function(_0x38bcdb,_0x58dcf9){return _0x38bcdb[_0x37d4('0xa')](_0x37d4('0xb'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 5f417b9..dbd8f7f 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 _0x74d1=['body','options','raw','CreateVoiceTransferReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','catch','VoiceTransferReport','create'];(function(_0x1f2218,_0xa2204){var _0x27c45b=function(_0x3240db){while(--_0x3240db){_0x1f2218['push'](_0x1f2218['shift']());}};_0x27c45b(++_0xa2204);}(_0x74d1,0x100));var _0x174d=function(_0x51306b,_0x4910b1){_0x51306b=_0x51306b-0x0;var _0x32b6eb=_0x74d1[_0x51306b];return _0x32b6eb;};'use strict';var _=require(_0x174d('0x0'));var util=require(_0x174d('0x1'));var moment=require(_0x174d('0x2'));var BPromise=require('bluebird');var rs=require(_0x174d('0x3'));var fs=require('fs');var Redis=require(_0x174d('0x4'));var db=require(_0x174d('0x5'))['db'];var utils=require(_0x174d('0x6'));var logger=require(_0x174d('0x7'))(_0x174d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x174d('0x9')][_0x174d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8c4174,_0x2e85db,_0x4253a6){return new BPromise(function(_0x3a63ac,_0x167143){return client[_0x174d('0xb')](_0x8c4174,_0x4253a6)[_0x174d('0xc')](function(_0x3d6de4){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2e85db,_0x174d('0xd'));logger[_0x174d('0xe')](_0x174d('0xf'),_0x2e85db,'request\x20sent',JSON[_0x174d('0x10')](_0x3d6de4));if(_0x3d6de4[_0x174d('0x11')]){if(_0x3d6de4[_0x174d('0x11')][_0x174d('0x12')]===0x1f4){logger[_0x174d('0x11')](_0x174d('0x13'),_0x2e85db,_0x3d6de4['error']['message']);return _0x167143(_0x3d6de4['error'][_0x174d('0x14')]);}logger[_0x174d('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2e85db,_0x3d6de4[_0x174d('0x11')]['message']);return _0x3a63ac(_0x3d6de4[_0x174d('0x11')][_0x174d('0x14')]);}else{logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x2e85db,_0x174d('0xd'));_0x3a63ac(_0x3d6de4['result'][_0x174d('0x14')]);}})[_0x174d('0x15')](function(_0x4dae6d){logger[_0x174d('0x11')](_0x174d('0x13'),_0x2e85db,_0x4dae6d);_0x167143(_0x4dae6d);});});}exports['CreateVoiceTransferReport']=function(_0x4ba9b4){var _0x1d4d5c=this;return new Promise(function(_0x1398e6,_0x477be1){return db[_0x174d('0x16')][_0x174d('0x17')](_0x4ba9b4[_0x174d('0x18')],{'raw':_0x4ba9b4['options']?_0x4ba9b4[_0x174d('0x19')][_0x174d('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3c4a3b){logger['info']('CreateVoiceTransferReport',_0x4ba9b4);logger[_0x174d('0xe')](_0x174d('0x1b'),_0x4ba9b4,JSON[_0x174d('0x10')](_0x3c4a3b));_0x1398e6(_0x3c4a3b);})[_0x174d('0x15')](function(_0x3d543e){logger['error'](_0x174d('0x1b'),_0x3d543e['message'],_0x4ba9b4);_0x477be1(_0x1d4d5c[_0x174d('0x11')](0x1f4,_0x3d543e[_0x174d('0x14')]));});});}; \ No newline at end of file +var _0x8fda=['http','request','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1e77ed,_0x5720c1){var _0x32ed55=function(_0x282f65){while(--_0x282f65){_0x1e77ed['push'](_0x1e77ed['shift']());}};_0x32ed55(++_0x5720c1);}(_0x8fda,0x1d2));var _0xa8fd=function(_0xbf977,_0x379773){_0xbf977=_0xbf977-0x0;var _0x2fb0d6=_0x8fda[_0xbf977];return _0x2fb0d6;};'use strict';var _=require(_0xa8fd('0x0'));var util=require('util');var moment=require(_0xa8fd('0x1'));var BPromise=require(_0xa8fd('0x2'));var rs=require(_0xa8fd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8fd('0x4'))['db'];var utils=require(_0xa8fd('0x5'));var logger=require('../../config/logger')(_0xa8fd('0x6'));var config=require(_0xa8fd('0x7'));var jayson=require(_0xa8fd('0x8'));var client=jayson[_0xa8fd('0x9')][_0xa8fd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x354270,_0x44206d,_0x2fab5e){return new BPromise(function(_0x5da0ea,_0x2f7505){return client[_0xa8fd('0xb')](_0x354270,_0x2fab5e)[_0xa8fd('0xc')](function(_0x32c062){logger[_0xa8fd('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x44206d,'request\x20sent');logger[_0xa8fd('0xe')](_0xa8fd('0xf'),_0x44206d,_0xa8fd('0x10'),JSON[_0xa8fd('0x11')](_0x32c062));if(_0x32c062[_0xa8fd('0x12')]){if(_0x32c062[_0xa8fd('0x12')][_0xa8fd('0x13')]===0x1f4){logger[_0xa8fd('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x44206d,_0x32c062['error'][_0xa8fd('0x14')]);return _0x2f7505(_0x32c062['error'][_0xa8fd('0x14')]);}logger[_0xa8fd('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x44206d,_0x32c062['error'][_0xa8fd('0x14')]);return _0x5da0ea(_0x32c062[_0xa8fd('0x12')][_0xa8fd('0x14')]);}else{logger[_0xa8fd('0xd')](_0xa8fd('0x15'),_0x44206d,'request\x20sent');_0x5da0ea(_0x32c062['result'][_0xa8fd('0x14')]);}})[_0xa8fd('0x16')](function(_0x123c7f){logger[_0xa8fd('0x12')](_0xa8fd('0x15'),_0x44206d,_0x123c7f);_0x2f7505(_0x123c7f);});});}exports[_0xa8fd('0x17')]=function(_0x41aefd){var _0x22817b=this;return new Promise(function(_0x55445f,_0x1d3a1e){return db[_0xa8fd('0x18')][_0xa8fd('0x19')](_0x41aefd['body'],{'raw':_0x41aefd[_0xa8fd('0x1a')]?_0x41aefd[_0xa8fd('0x1a')][_0xa8fd('0x1b')]===undefined?!![]:![]:!![]})[_0xa8fd('0xc')](function(_0x42e67d){logger['info'](_0xa8fd('0x17'),_0x41aefd);logger[_0xa8fd('0xe')]('CreateVoiceTransferReport',_0x41aefd,JSON[_0xa8fd('0x11')](_0x42e67d));_0x55445f(_0x42e67d);})['catch'](function(_0x33388b){logger[_0xa8fd('0x12')](_0xa8fd('0x17'),_0x33388b[_0xa8fd('0x14')],_0x41aefd);_0x1d3a1e(_0x22817b['error'](0x1f4,_0x33388b['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 8b97a8d..05b35de 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 _0x9c44=['/answer','answer','/hold','/unhold','unhold','/transfer','transfer','exports','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x49c4('0x0'));var controller=require(_0x49c4('0x1'));router[_0x49c4('0x2')](_0x49c4('0x3'),auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['originate']);router['post'](_0x49c4('0x6'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0x7')]);router[_0x49c4('0x2')](_0x49c4('0x8'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller[_0x49c4('0x9')]);router[_0x49c4('0x2')](_0x49c4('0xa'),auth[_0x49c4('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0x49c4('0x2')](_0x49c4('0xb'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xc')]);router['post']('/calls',auth[_0x49c4('0x4')](),auth[_0x49c4('0x5')](),controller['calls']);router[_0x49c4('0x2')](_0x49c4('0xd'),auth['isAuthenticated'](),auth[_0x49c4('0x5')](),controller[_0x49c4('0xe')]);module[_0x49c4('0xf')]=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x4bf97d,_0x4a6696){var _0x2d5df7=function(_0x6d321){while(--_0x6d321){_0x4bf97d['push'](_0x4bf97d['shift']());}};_0x2d5df7(++_0x4a6696);}(_0xdace,0xc5));var _0xedac=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xdace[_0x1da04e];return _0xdd8c41;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index d0d927c..5531628 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 _0x6f7a=['findOne','agent','then','VoiceChannels','all','filter','rows','UserId','length','sessionId\x20','originate','originate\x20fired:','body','json','userId','callNumber','callerId','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup','hangup\x20fired:','sessionId','format','webbar:hangup','hangup\x20executed!','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound','code','catch','User'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x92eaf8,_0x38ec84){_0x92eaf8=_0x92eaf8-0x0;var _0x11ffdf=_0x6f7a[_0x92eaf8];return _0x11ffdf;};'use strict';var path=require(_0xa6f7('0x0'));var fs=require('fs');var _=require(_0xa6f7('0x1'));var db=require(_0xa6f7('0x2'))['db'];var config=require(_0xa6f7('0x3'));var util=require('util');var BPromise=require(_0xa6f7('0x4'));var jayson=require(_0xa6f7('0x5'));var amiClient=jayson[_0xa6f7('0x6')][_0xa6f7('0x7')]({'port':0x232a});var logger=require(_0xa6f7('0x8'))(_0xa6f7('0x9'));var Redis=require(_0xa6f7('0xa'));config[_0xa6f7('0xb')]=_[_0xa6f7('0xc')](config[_0xa6f7('0xb')],{'host':_0xa6f7('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0xa6f7('0xe'));var originateValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'callNumber':{'type':_0xa6f7('0x11'),'required':[!![],_0xa6f7('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xa6f7('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':_0xa6f7('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xa6f7('0x11'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':_0xa6f7('0x11'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xa6f7('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xa6f7('0xf'),'required':[!![],_0xa6f7('0x10')]}});function emit(_0x6efd38,_0x47e664,_0xdb37e2){logger[_0xa6f7('0x13')](_0x6efd38,_0x47e664,JSON[_0xa6f7('0x14')](_0xdb37e2));io['to'](_0x6efd38)[_0xa6f7('0x15')](_0x47e664,_0xdb37e2);}function handleError(_0x5681d5){return function(_0x4a8827){console[_0xa6f7('0x16')]('handleError:',_0x4a8827,_0x4a8827 instanceof RangeError);logger[_0xa6f7('0x17')](_0x4a8827[_0xa6f7('0x18')]);if(_0x4a8827 instanceof RangeError){if(_0x4a8827['name']){delete _0x4a8827[_0xa6f7('0x19')];}_0x5681d5[_0xa6f7('0x1a')](0x194)[_0xa6f7('0x1b')](_0x4a8827);}else{if(_0x4a8827[_0xa6f7('0x19')]){delete _0x4a8827[_0xa6f7('0x19')];}_0x5681d5[_0xa6f7('0x1a')](0x1f4)['send'](_0x4a8827);}};}function checkError(){return function(_0x3c0c55){if(!_0x3c0c55){throw new RangeError(_0xa6f7('0x1c'));}return _0x3c0c55;};}function respondWithRpcPromise(_0x58b6a1,_0x5d1159){return new BPromise(function(_0x5ddc8d,_0x1de6c9){var _0x119950=amiClient;return _0x119950['request'](_0x58b6a1,_0x5d1159)['then'](function(_0x50e2be){if(_0x50e2be[_0xa6f7('0x17')]){if(_0x50e2be[_0xa6f7('0x17')][_0xa6f7('0x1d')]===0x1f4){return _0x1de6c9(_0x50e2be['error']['message']);}return _0x5ddc8d(_0x50e2be[_0xa6f7('0x17')]['message']);}else{_0x5ddc8d(_0x50e2be['result']);}})[_0xa6f7('0x1e')](function(_0x5efdce){_0x1de6c9(_0x5efdce);});});}function getAgent(_0x35847e){return db[_0xa6f7('0x1f')][_0xa6f7('0x20')]({'where':{'id':_0x35847e,'role':_0xa6f7('0x21')}})[_0xa6f7('0x22')](checkError());}function getAgentCheckSession(_0x4b8d2b,_0x51db47){return new BPromise(function(_0x1c419b,_0x2ad0d9){var _0x55d45a=respondWithRpcPromise(_0xa6f7('0x23'));var _0x27babb=getAgent(_0x4b8d2b);Promise[_0xa6f7('0x24')]([_0x55d45a,_0x27babb])[_0xa6f7('0x22')](function(_0x224f5a){var _0x10bf77=_0x224f5a[0x0];var _0x353de8=_0x224f5a[0x1];var _0x54f72c=_[_0xa6f7('0x25')](_0x10bf77[_0xa6f7('0x26')],function(_0x40b0f8){return _0x40b0f8[_0xa6f7('0x27')]==_0x353de8['id']&&_0x40b0f8['sessionId']==_0x51db47;});if(_0x54f72c[_0xa6f7('0x28')]==0x1){_0x1c419b(_0x353de8);}else{_0x2ad0d9(new RangeError(_0xa6f7('0x29')+_0x51db47+'\x20not\x20found!'));}});});}exports[_0xa6f7('0x2a')]=function(_0x34d571,_0x4d79d8){logger['info'](_0xa6f7('0x2b'),_0x34d571[_0xa6f7('0x2c')]);var _0x2b33d=originateValidation[_0xa6f7('0xe')](_0x34d571[_0xa6f7('0x2c')]);if(_0x2b33d['length']>0x0){return _0x4d79d8['status'](0x190)[_0xa6f7('0x2d')](_0x2b33d);}var _0x4c2acd=_0x34d571[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0xfa0fb6=_0x34d571[_0xa6f7('0x2c')][_0xa6f7('0x2f')];var _0xbdfc5a=_0x34d571['body'][_0xa6f7('0x30')];var _0xb1a7f8=_0x34d571[_0xa6f7('0x2c')]['callbackUrl'];return getAgent(_0x4c2acd)[_0xa6f7('0x22')](function(_0x5ab03d){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x5ab03d[_0xa6f7('0x19')]);emit(util['format'](_0xa6f7('0x32'),_0x5ab03d[_0xa6f7('0x19')]),_0xa6f7('0x33'),{'callNumber':_0xfa0fb6,'callerId':_0xbdfc5a,'callbackUrl':_0xb1a7f8});return _0x4d79d8[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x34')});})['catch'](handleError(_0x4d79d8));};exports[_0xa6f7('0x35')]=function(_0xd930e8,_0xc25a1b){logger[_0xa6f7('0x13')](_0xa6f7('0x36'),_0xd930e8[_0xa6f7('0x2c')]);var _0x45acdd=hangupValidation[_0xa6f7('0xe')](_0xd930e8['body']);if(_0x45acdd[_0xa6f7('0x28')]>0x0){return _0xc25a1b[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x45acdd);}var _0x518088=_0xd930e8[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x589d94=_0xd930e8[_0xa6f7('0x2c')][_0xa6f7('0x37')];return getAgent(_0x518088)[_0xa6f7('0x22')](function(_0x14d532){logger[_0xa6f7('0x13')]('entityFound:',_0x14d532[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x14d532[_0xa6f7('0x19')]),_0xa6f7('0x39'),{'sessionId':_0x589d94});return _0xc25a1b[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x3a')});})['catch'](handleError(_0xc25a1b));};exports['answer']=function(_0x12f7b5,_0x3e1535){logger[_0xa6f7('0x13')](_0xa6f7('0x3b'),_0x12f7b5[_0xa6f7('0x2c')]);var _0x387714=answerValidation[_0xa6f7('0xe')](_0x12f7b5[_0xa6f7('0x2c')]);if(_0x387714[_0xa6f7('0x28')]>0x0){return _0x3e1535[_0xa6f7('0x1a')](0x190)['json'](_0x387714);}var _0x41917c=_0x12f7b5[_0xa6f7('0x2c')]['userId'];var _0x22d500=_0x12f7b5[_0xa6f7('0x2c')][_0xa6f7('0x37')];return getAgent(_0x41917c)[_0xa6f7('0x22')](function(_0x51de13){logger[_0xa6f7('0x13')]('entityFound:',_0x51de13['name']);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x51de13[_0xa6f7('0x19')]),_0xa6f7('0x3c'),{'sessionId':_0x22d500});return _0x3e1535[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x3d')});})['catch'](handleError(_0x3e1535));};exports[_0xa6f7('0x3e')]=function(_0x40dbe6,_0x55cb70){logger[_0xa6f7('0x13')](_0xa6f7('0x3f'),_0x40dbe6[_0xa6f7('0x2c')]);var _0x5cc89c=holdValidation[_0xa6f7('0xe')](_0x40dbe6['body']);if(_0x5cc89c[_0xa6f7('0x28')]>0x0){return _0x55cb70[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x5cc89c);}var _0x5f3c84=_0x40dbe6['body'][_0xa6f7('0x2e')];var _0x5928e4=_0x40dbe6[_0xa6f7('0x2c')]['sessionId'];return getAgent(_0x5f3c84)['then'](function(_0x1e7089){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x1e7089[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x1e7089['name']),_0xa6f7('0x40'),{'sessionId':_0x5928e4});return _0x55cb70[_0xa6f7('0x1a')](0xc8)['json']({'error':![],'message':_0xa6f7('0x41')});})['catch'](handleError(_0x55cb70));};exports[_0xa6f7('0x42')]=function(_0x59091a,_0x488efc){logger[_0xa6f7('0x13')](_0xa6f7('0x43'),_0x59091a[_0xa6f7('0x2c')]);var _0x2b3de2=unholdValidation[_0xa6f7('0xe')](_0x59091a['body']);if(_0x2b3de2[_0xa6f7('0x28')]>0x0){return _0x488efc[_0xa6f7('0x1a')](0x190)['json'](_0x2b3de2);}var _0x4b83f6=_0x59091a['body'][_0xa6f7('0x2e')];var _0x1c2099=_0x59091a[_0xa6f7('0x2c')]['sessionId'];return getAgent(_0x4b83f6)[_0xa6f7('0x22')](function(_0x5dab05){logger[_0xa6f7('0x13')](_0xa6f7('0x31'),_0x5dab05[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x5dab05['name']),'webbar:unhold',{'sessionId':_0x1c2099});return _0x488efc[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':_0xa6f7('0x44')});})[_0xa6f7('0x1e')](handleError(_0x488efc));};exports['calls']=function(_0x9d901e,_0x2105dd){logger[_0xa6f7('0x13')](_0xa6f7('0x45'),_0x2105dd[_0xa6f7('0x2c')]);var _0x39538e=callsValidation['validate'](_0x9d901e[_0xa6f7('0x2c')]);if(_0x39538e[_0xa6f7('0x28')]>0x0){return _0x2105dd[_0xa6f7('0x1a')](0x190)['json'](_0x39538e);}var _0xb049d7=_0x9d901e[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x4496f1=respondWithRpcPromise('VoiceChannels');var _0x4ec005=getAgent(_0xb049d7);return Promise[_0xa6f7('0x24')]([_0x4496f1,_0x4ec005])[_0xa6f7('0x22')](function(_0x1103c6){var _0x52e647=_0x1103c6[0x0];var _0x301327=_0x1103c6[0x1];var _0x269249=_[_0xa6f7('0x25')](_0x52e647['rows'],function(_0x169bbe){return _0x169bbe[_0xa6f7('0x27')]==_0x301327['id'];});return _0x2105dd[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'count':_0x269249[_0xa6f7('0x28')],'rows':_0x269249});})[_0xa6f7('0x1e')](handleError(_0x2105dd));};exports[_0xa6f7('0x46')]=function(_0x3bc870,_0x444177){logger[_0xa6f7('0x13')](_0xa6f7('0x47'),_0x3bc870['body']);var _0x224e33=conferenceValidation['validate'](_0x3bc870[_0xa6f7('0x2c')]);if(_0x224e33['length']>0x0){return _0x444177[_0xa6f7('0x1a')](0x190)[_0xa6f7('0x2d')](_0x224e33);}var _0x5a158f=_0x3bc870[_0xa6f7('0x2c')][_0xa6f7('0x2e')];return getAgent(_0x5a158f)[_0xa6f7('0x22')](function(_0x501503){logger[_0xa6f7('0x13')]('entityFound:',_0x501503[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')]('user:%s',_0x501503[_0xa6f7('0x19')]),'webbar:conference');return _0x444177[_0xa6f7('0x1a')](0xc8)['json']({'error':![],'message':_0xa6f7('0x48')});})[_0xa6f7('0x1e')](handleError(_0x444177));};exports[_0xa6f7('0x49')]=function(_0xca47c2,_0x315939){logger[_0xa6f7('0x13')](_0xa6f7('0x4a'),_0xca47c2[_0xa6f7('0x2c')]);var _0x153635=transferValidation[_0xa6f7('0xe')](_0xca47c2[_0xa6f7('0x2c')]);if(_0x153635[_0xa6f7('0x28')]>0x0){return _0x315939['status'](0x190)[_0xa6f7('0x2d')](_0x153635);}var _0x3c0c6e=_0xca47c2[_0xa6f7('0x2c')][_0xa6f7('0x2e')];var _0x154c78=_0xca47c2[_0xa6f7('0x2c')][_0xa6f7('0x37')];var _0x3a5700=_0xca47c2['body'][_0xa6f7('0x4b')];return getAgent(_0x3c0c6e)[_0xa6f7('0x22')](function(_0x9c102f){logger['info'](_0xa6f7('0x31'),_0x9c102f[_0xa6f7('0x19')]);emit(util[_0xa6f7('0x38')](_0xa6f7('0x32'),_0x9c102f[_0xa6f7('0x19')]),_0xa6f7('0x4c'),{'sessionId':_0x154c78,'transferNumber':_0x3a5700});return _0x315939[_0xa6f7('0x1a')](0xc8)[_0xa6f7('0x2d')]({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x315939));}; \ No newline at end of file +var _0xd404=['sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','validate','body','length','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup\x20fired:','json','format','webbar:hangup','status','hangup\x20executed!','answer','answer\x20fired:','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','rows','conference','conference\x20fired:','webbar:conference','transfer\x20fired:','transferNumber','webbar:transfer','path','lodash','../../config/environment','util','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','callNumber\x20is\x20required','string','userId\x20is\x20required','sessionId\x20is\x20required','info','stringify','log','error','stack','name','send','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','filter','UserId','sessionId'];(function(_0x30f795,_0x1ba771){var _0x1af357=function(_0x4b7e0e){while(--_0x4b7e0e){_0x30f795['push'](_0x30f795['shift']());}};_0x1af357(++_0x1ba771);}(_0xd404,0x15b));var _0x4d40=function(_0x2be972,_0x188ba3){_0x2be972=_0x2be972-0x0;var _0x56533d=_0xd404[_0x2be972];return _0x56533d;};'use strict';var path=require(_0x4d40('0x0'));var fs=require('fs');var _=require(_0x4d40('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x4d40('0x2'));var util=require(_0x4d40('0x3'));var BPromise=require('bluebird');var jayson=require(_0x4d40('0x4'));var amiClient=jayson[_0x4d40('0x5')][_0x4d40('0x6')]({'port':0x232a});var logger=require(_0x4d40('0x7'))(_0x4d40('0x8'));var Redis=require(_0x4d40('0x9'));config[_0x4d40('0xa')]=_[_0x4d40('0xb')](config[_0x4d40('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x4d40('0xc'))(new Redis(config[_0x4d40('0xa')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x4d40('0xe')]},'callerId':{'type':_0x4d40('0xf')},'callbackUrl':{'type':_0x4d40('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]},'sessionId':{'type':_0x4d40('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]},'sessionId':{'type':_0x4d40('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]},'sessionId':{'type':_0x4d40('0xf'),'required':[!![],_0x4d40('0x11')]},'transferNumber':{'type':_0x4d40('0xf'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]},'sessionId':{'type':_0x4d40('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0x4d40('0xd'),'required':[!![],_0x4d40('0x10')]}});function emit(_0x453857,_0x361a41,_0x10518e){logger[_0x4d40('0x12')](_0x453857,_0x361a41,JSON[_0x4d40('0x13')](_0x10518e));io['to'](_0x453857)['emit'](_0x361a41,_0x10518e);}function handleError(_0x535989){return function(_0x1ae5c7){console[_0x4d40('0x14')]('handleError:',_0x1ae5c7,_0x1ae5c7 instanceof RangeError);logger[_0x4d40('0x15')](_0x1ae5c7[_0x4d40('0x16')]);if(_0x1ae5c7 instanceof RangeError){if(_0x1ae5c7['name']){delete _0x1ae5c7[_0x4d40('0x17')];}_0x535989['status'](0x194)[_0x4d40('0x18')](_0x1ae5c7);}else{if(_0x1ae5c7[_0x4d40('0x17')]){delete _0x1ae5c7['name'];}_0x535989['status'](0x1f4)[_0x4d40('0x18')](_0x1ae5c7);}};}function checkError(){return function(_0x569190){if(!_0x569190){throw new RangeError('NotFound');}return _0x569190;};}function respondWithRpcPromise(_0xc458da,_0x3684eb){return new BPromise(function(_0x30f058,_0x5d4c24){var _0x356fd6=amiClient;return _0x356fd6[_0x4d40('0x19')](_0xc458da,_0x3684eb)[_0x4d40('0x1a')](function(_0x5ca0a0){if(_0x5ca0a0['error']){if(_0x5ca0a0[_0x4d40('0x15')][_0x4d40('0x1b')]===0x1f4){return _0x5d4c24(_0x5ca0a0[_0x4d40('0x15')][_0x4d40('0x1c')]);}return _0x30f058(_0x5ca0a0[_0x4d40('0x15')]['message']);}else{_0x30f058(_0x5ca0a0[_0x4d40('0x1d')]);}})[_0x4d40('0x1e')](function(_0x560df8){_0x5d4c24(_0x560df8);});});}function getAgent(_0x5540ee){return db[_0x4d40('0x1f')][_0x4d40('0x20')]({'where':{'id':_0x5540ee,'role':_0x4d40('0x21')}})[_0x4d40('0x1a')](checkError());}function getAgentCheckSession(_0x4a8ad6,_0x325f6f){return new BPromise(function(_0x105635,_0x35dd32){var _0x2892ac=respondWithRpcPromise(_0x4d40('0x22'));var _0x1c0fcf=getAgent(_0x4a8ad6);Promise['all']([_0x2892ac,_0x1c0fcf])['then'](function(_0x52f706){var _0x158a86=_0x52f706[0x0];var _0x350488=_0x52f706[0x1];var _0x1ac240=_[_0x4d40('0x23')](_0x158a86['rows'],function(_0x18e601){return _0x18e601[_0x4d40('0x24')]==_0x350488['id']&&_0x18e601[_0x4d40('0x25')]==_0x325f6f;});if(_0x1ac240['length']==0x1){_0x105635(_0x350488);}else{_0x35dd32(new RangeError(_0x4d40('0x26')+_0x325f6f+_0x4d40('0x27')));}});});}exports[_0x4d40('0x28')]=function(_0x1f9577,_0x41bbfc){logger['info'](_0x4d40('0x29'),_0x1f9577['body']);var _0x263d0a=originateValidation[_0x4d40('0x2a')](_0x1f9577[_0x4d40('0x2b')]);if(_0x263d0a[_0x4d40('0x2c')]>0x0){return _0x41bbfc['status'](0x190)['json'](_0x263d0a);}var _0x5e483c=_0x1f9577[_0x4d40('0x2b')][_0x4d40('0x2d')];var _0x1e1e2f=_0x1f9577['body'][_0x4d40('0x2e')];var _0x5f1d1c=_0x1f9577[_0x4d40('0x2b')][_0x4d40('0x2f')];var _0x4481f3=_0x1f9577[_0x4d40('0x2b')][_0x4d40('0x30')];return getAgent(_0x5e483c)[_0x4d40('0x1a')](function(_0x1d1ba9){logger[_0x4d40('0x12')](_0x4d40('0x31'),_0x1d1ba9[_0x4d40('0x17')]);emit(util['format'](_0x4d40('0x32'),_0x1d1ba9[_0x4d40('0x17')]),'webbar:originate',{'callNumber':_0x1e1e2f,'callerId':_0x5f1d1c,'callbackUrl':_0x4481f3});return _0x41bbfc['status'](0xc8)['json']({'error':![],'message':_0x4d40('0x33')});})[_0x4d40('0x1e')](handleError(_0x41bbfc));};exports['hangup']=function(_0x256cc8,_0x1fefa3){logger[_0x4d40('0x12')](_0x4d40('0x34'),_0x256cc8[_0x4d40('0x2b')]);var _0x59f1fd=hangupValidation[_0x4d40('0x2a')](_0x256cc8[_0x4d40('0x2b')]);if(_0x59f1fd['length']>0x0){return _0x1fefa3['status'](0x190)[_0x4d40('0x35')](_0x59f1fd);}var _0x11ed1a=_0x256cc8['body'][_0x4d40('0x2d')];var _0x1aad00=_0x256cc8['body'][_0x4d40('0x25')];return getAgent(_0x11ed1a)[_0x4d40('0x1a')](function(_0x4c756c){logger[_0x4d40('0x12')](_0x4d40('0x31'),_0x4c756c['name']);emit(util[_0x4d40('0x36')]('user:%s',_0x4c756c[_0x4d40('0x17')]),_0x4d40('0x37'),{'sessionId':_0x1aad00});return _0x1fefa3[_0x4d40('0x38')](0xc8)[_0x4d40('0x35')]({'error':![],'message':_0x4d40('0x39')});})[_0x4d40('0x1e')](handleError(_0x1fefa3));};exports[_0x4d40('0x3a')]=function(_0x340740,_0x7c0faa){logger['info'](_0x4d40('0x3b'),_0x340740[_0x4d40('0x2b')]);var _0x1c2fa8=answerValidation[_0x4d40('0x2a')](_0x340740[_0x4d40('0x2b')]);if(_0x1c2fa8['length']>0x0){return _0x7c0faa[_0x4d40('0x38')](0x190)['json'](_0x1c2fa8);}var _0x2e7f75=_0x340740[_0x4d40('0x2b')][_0x4d40('0x2d')];var _0x41c21a=_0x340740['body'][_0x4d40('0x25')];return getAgent(_0x2e7f75)[_0x4d40('0x1a')](function(_0x4dc363){logger[_0x4d40('0x12')]('entityFound:',_0x4dc363[_0x4d40('0x17')]);emit(util[_0x4d40('0x36')](_0x4d40('0x32'),_0x4dc363[_0x4d40('0x17')]),'webbar:answer',{'sessionId':_0x41c21a});return _0x7c0faa[_0x4d40('0x38')](0xc8)['json']({'error':![],'message':_0x4d40('0x3c')});})[_0x4d40('0x1e')](handleError(_0x7c0faa));};exports[_0x4d40('0x3d')]=function(_0x6a7772,_0x4de681){logger[_0x4d40('0x12')](_0x4d40('0x3e'),_0x6a7772[_0x4d40('0x2b')]);var _0x363fcc=holdValidation['validate'](_0x6a7772[_0x4d40('0x2b')]);if(_0x363fcc[_0x4d40('0x2c')]>0x0){return _0x4de681['status'](0x190)[_0x4d40('0x35')](_0x363fcc);}var _0x493d8e=_0x6a7772[_0x4d40('0x2b')][_0x4d40('0x2d')];var _0xb45ea=_0x6a7772[_0x4d40('0x2b')][_0x4d40('0x25')];return getAgent(_0x493d8e)[_0x4d40('0x1a')](function(_0x30be7b){logger[_0x4d40('0x12')](_0x4d40('0x31'),_0x30be7b['name']);emit(util[_0x4d40('0x36')](_0x4d40('0x32'),_0x30be7b[_0x4d40('0x17')]),_0x4d40('0x3f'),{'sessionId':_0xb45ea});return _0x4de681[_0x4d40('0x38')](0xc8)['json']({'error':![],'message':_0x4d40('0x40')});})[_0x4d40('0x1e')](handleError(_0x4de681));};exports['unhold']=function(_0xdf0235,_0x48ffd7){logger[_0x4d40('0x12')](_0x4d40('0x41'),_0xdf0235[_0x4d40('0x2b')]);var _0x53d73a=unholdValidation[_0x4d40('0x2a')](_0xdf0235[_0x4d40('0x2b')]);if(_0x53d73a[_0x4d40('0x2c')]>0x0){return _0x48ffd7[_0x4d40('0x38')](0x190)[_0x4d40('0x35')](_0x53d73a);}var _0x52861d=_0xdf0235[_0x4d40('0x2b')][_0x4d40('0x2d')];var _0x5aef99=_0xdf0235[_0x4d40('0x2b')]['sessionId'];return getAgent(_0x52861d)[_0x4d40('0x1a')](function(_0x5db89f){logger[_0x4d40('0x12')](_0x4d40('0x31'),_0x5db89f['name']);emit(util[_0x4d40('0x36')](_0x4d40('0x32'),_0x5db89f[_0x4d40('0x17')]),_0x4d40('0x42'),{'sessionId':_0x5aef99});return _0x48ffd7[_0x4d40('0x38')](0xc8)[_0x4d40('0x35')]({'error':![],'message':_0x4d40('0x43')});})[_0x4d40('0x1e')](handleError(_0x48ffd7));};exports[_0x4d40('0x44')]=function(_0x217a94,_0x36ed10){logger[_0x4d40('0x12')](_0x4d40('0x45'),_0x36ed10[_0x4d40('0x2b')]);var _0x204b0b=callsValidation[_0x4d40('0x2a')](_0x217a94[_0x4d40('0x2b')]);if(_0x204b0b[_0x4d40('0x2c')]>0x0){return _0x36ed10[_0x4d40('0x38')](0x190)['json'](_0x204b0b);}var _0x8c4b62=_0x217a94[_0x4d40('0x2b')]['userId'];var _0x5cebfc=respondWithRpcPromise(_0x4d40('0x22'));var _0x43f120=getAgent(_0x8c4b62);return Promise['all']([_0x5cebfc,_0x43f120])['then'](function(_0x33b61b){var _0x4c9df4=_0x33b61b[0x0];var _0x13b343=_0x33b61b[0x1];var _0x54e787=_[_0x4d40('0x23')](_0x4c9df4[_0x4d40('0x46')],function(_0x42bdd3){return _0x42bdd3[_0x4d40('0x24')]==_0x13b343['id'];});return _0x36ed10[_0x4d40('0x38')](0xc8)['json']({'count':_0x54e787['length'],'rows':_0x54e787});})['catch'](handleError(_0x36ed10));};exports[_0x4d40('0x47')]=function(_0x323373,_0x40962b){logger[_0x4d40('0x12')](_0x4d40('0x48'),_0x323373['body']);var _0x339835=conferenceValidation['validate'](_0x323373[_0x4d40('0x2b')]);if(_0x339835[_0x4d40('0x2c')]>0x0){return _0x40962b[_0x4d40('0x38')](0x190)[_0x4d40('0x35')](_0x339835);}var _0x3df411=_0x323373[_0x4d40('0x2b')]['userId'];return getAgent(_0x3df411)['then'](function(_0xdabcda){logger[_0x4d40('0x12')](_0x4d40('0x31'),_0xdabcda[_0x4d40('0x17')]);emit(util[_0x4d40('0x36')](_0x4d40('0x32'),_0xdabcda[_0x4d40('0x17')]),_0x4d40('0x49'));return _0x40962b['status'](0xc8)[_0x4d40('0x35')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x40962b));};exports['transfer']=function(_0x37e643,_0x3e5c28){logger[_0x4d40('0x12')](_0x4d40('0x4a'),_0x37e643['body']);var _0x450c99=transferValidation[_0x4d40('0x2a')](_0x37e643[_0x4d40('0x2b')]);if(_0x450c99[_0x4d40('0x2c')]>0x0){return _0x3e5c28[_0x4d40('0x38')](0x190)['json'](_0x450c99);}var _0x5f4ef0=_0x37e643[_0x4d40('0x2b')]['userId'];var _0x42edc2=_0x37e643[_0x4d40('0x2b')][_0x4d40('0x25')];var _0x5233f6=_0x37e643['body'][_0x4d40('0x4b')];return getAgent(_0x5f4ef0)['then'](function(_0x19b92c){logger[_0x4d40('0x12')]('entityFound:',_0x19b92c[_0x4d40('0x17')]);emit(util[_0x4d40('0x36')](_0x4d40('0x32'),_0x19b92c[_0x4d40('0x17')]),_0x4d40('0x4c'),{'sessionId':_0x42edc2,'transferNumber':_0x5233f6});return _0x3e5c28[_0x4d40('0x38')](0xc8)['json']({'error':![],'message':'transfer\x20executed!'});})['catch'](handleError(_0x3e5c28));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 99b0149..c6363dc 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 _0xf61e=['getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','send','put','/:id','update','delete','destroy','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','index','isAuthenticated','describe','show','/:id/dispositions'];(function(_0x3f2f83,_0x417389){var _0x2a2fba=function(_0x373acd){while(--_0x373acd){_0x3f2f83['push'](_0x3f2f83['shift']());}};_0x2a2fba(++_0x417389);}(_0xf61e,0x191));var _0xef61=function(_0x5ecc41,_0x2d809b){_0x5ecc41=_0x5ecc41-0x0;var _0x2e7b5=_0xf61e[_0x5ecc41];return _0x2e7b5;};'use strict';var multer=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var path=require(_0xef61('0x2'));var timeout=require(_0xef61('0x3'));var express=require(_0xef61('0x4'));var router=express[_0xef61('0x5')]();var fs_extra=require(_0xef61('0x6'));var auth=require(_0xef61('0x7'));var interaction=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var controller=require(_0xef61('0xa'));router[_0xef61('0xb')]('/',auth['isAuthenticated'](),controller[_0xef61('0xc')]);router[_0xef61('0xb')]('/describe',auth[_0xef61('0xd')](),controller[_0xef61('0xe')]);router[_0xef61('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0xf')]);router[_0xef61('0xb')](_0xef61('0x10'),auth[_0xef61('0xd')](),controller[_0xef61('0x11')]);router[_0xef61('0xb')](_0xef61('0x12'),auth[_0xef61('0xd')](),controller[_0xef61('0x13')]);router[_0xef61('0xb')](_0xef61('0x14'),auth[_0xef61('0xd')](),controller[_0xef61('0x15')]);router[_0xef61('0xb')]('/:id/applications',auth[_0xef61('0xd')](),controller['getApplications']);router[_0xef61('0x16')]('/',auth[_0xef61('0xd')](),controller[_0xef61('0x17')]);router[_0xef61('0x16')]('/:id/dispositions',auth[_0xef61('0xd')](),controller[_0xef61('0x18')]);router[_0xef61('0x16')](_0xef61('0x12'),auth['isAuthenticated'](),controller[_0xef61('0x19')]);router[_0xef61('0x16')]('/:id/users',auth[_0xef61('0xd')](),controller[_0xef61('0x1a')]);router[_0xef61('0x16')](_0xef61('0x1b'),auth[_0xef61('0xd')](),controller[_0xef61('0x1c')]);router[_0xef61('0x16')]('/:id/notify',controller[_0xef61('0x1d')]);router[_0xef61('0x16')]('/:id/send',auth[_0xef61('0xd')](),controller[_0xef61('0x1e')]);router[_0xef61('0x1f')](_0xef61('0x20'),auth[_0xef61('0xd')](),controller[_0xef61('0x21')]);router[_0xef61('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xef61('0x23')]);router['delete'](_0xef61('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xef61('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xef61('0x24')]);router[_0xef61('0x22')](_0xef61('0x14'),auth[_0xef61('0xd')](),controller['removeAgents']);module[_0xef61('0x25')]=router; \ No newline at end of file +var _0xba34=['getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addDisposition','/:id/canned_answers','addAnswer','addAgents','/:id/notify','notify','/:id/send','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions'];(function(_0x56be25,_0x1b71d5){var _0x2c41d4=function(_0x5298f5){while(--_0x5298f5){_0x56be25['push'](_0x56be25['shift']());}};_0x2c41d4(++_0x1b71d5);}(_0xba34,0x119));var _0x4ba3=function(_0x32b3bc,_0x2f23e1){_0x32b3bc=_0x32b3bc-0x0;var _0x45bb30=_0xba34[_0x32b3bc];return _0x45bb30;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0x8')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x8')]('/:id/canned_answers',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x10')]);router['get'](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x12')]);router['get'](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x14')]);router[_0x4ba3('0x15')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x16')]);router[_0x4ba3('0x15')](_0x4ba3('0xe'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x17')]);router[_0x4ba3('0x15')](_0x4ba3('0x18'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x19')]);router[_0x4ba3('0x15')](_0x4ba3('0x11'),auth['isAuthenticated'](),controller[_0x4ba3('0x1a')]);router[_0x4ba3('0x15')](_0x4ba3('0x13'),auth[_0x4ba3('0x9')](),controller['addApplications']);router[_0x4ba3('0x15')](_0x4ba3('0x1b'),controller[_0x4ba3('0x1c')]);router[_0x4ba3('0x15')](_0x4ba3('0x1d'),auth[_0x4ba3('0x9')](),controller['send']);router['put'](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x1e')]);router[_0x4ba3('0x1f')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x20')]);router[_0x4ba3('0x1f')]('/:id/dispositions',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x21')]);router['delete'](_0x4ba3('0x18'),auth['isAuthenticated'](),controller[_0x4ba3('0x22')]);router[_0x4ba3('0x1f')](_0x4ba3('0x11'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0x23')]);module[_0x4ba3('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 0598425..53d4a25 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 _0xb04e=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDispositionPauseId','setDataValue','exports','STRING','name','sinch','TEXT'];(function(_0x8cb193,_0x4a568a){var _0x33e743=function(_0x2f9963){while(--_0x2f9963){_0x8cb193['push'](_0x8cb193['shift']());}};_0x33e743(++_0x4a568a);}(_0xb04e,0x163));var _0xeb04=function(_0x2e34f8,_0x53a191){_0x2e34f8=_0x2e34f8-0x0;var _0x2b147a=_0xb04e[_0x2e34f8];return _0x2b147a;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xeb04('0x0')]={'name':{'type':Sequelize[_0xeb04('0x1')],'unique':_0xeb04('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xeb04('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0xeb04('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0xeb04('0x1')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xeb04('0x1')]},'type':{'type':Sequelize['ENUM']('twilio',_0xeb04('0x3'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xeb04('0x1')]},'authToken':{'type':Sequelize[_0xeb04('0x1')]},'notificationTemplate':{'type':Sequelize[_0xeb04('0x4')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xeb04('0x5')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xeb04('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xeb04('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xeb04('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xeb04('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xeb04('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xeb04('0x6')],'comment':_0xeb04('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5b8aa5){if(!_0x5b8aa5){this['setDataValue'](_0xeb04('0x8'),null);}this[_0xeb04('0x9')]('mandatoryDisposition',_0x5b8aa5);}},'description':{'type':Sequelize[_0xeb04('0x1')]}}; \ No newline at end of file +var _0x249f=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','generate','ENUM','sinch'];(function(_0x4e52b9,_0x3b39b2){var _0xca4e2a=function(_0x11515d){while(--_0x11515d){_0x4e52b9['push'](_0x4e52b9['shift']());}};_0xca4e2a(++_0x3b39b2);}(_0x249f,0x120));var _0xf249=function(_0x1f44e8,_0x384602){_0x1f44e8=_0x1f44e8-0x0;var _0x2fcbb1=_0x249f[_0x1f44e8];return _0x2fcbb1;};'use strict';var Sequelize=require(_0xf249('0x0'));var rs=require('randomstring');module[_0xf249('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xf249('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xf249('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf249('0x3')]();}},'phone':{'type':Sequelize[_0xf249('0x2')]},'type':{'type':Sequelize[_0xf249('0x4')]('twilio',_0xf249('0x5'))},'accountSid':{'type':Sequelize[_0xf249('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xf249('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf249('0x6')],'defaultValue':function(){return _0xf249('0x7');}},'notificationSound':{'type':Sequelize[_0xf249('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xf249('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf249('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf249('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf249('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf249('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf249('0x9')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf249('0x8')],'defaultValue':![],'comment':_0xf249('0xa'),'set':function(_0x47afd2){if(!_0x47afd2){this[_0xf249('0xb')](_0xf249('0xc'),null);}this[_0xf249('0xb')](_0xf249('0xd'),_0x47afd2);}},'description':{'type':Sequelize[_0xf249('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8ab1d03..fa57bad 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 _0x0270=['type','VIRTUAL','filter','options','includeAll','rows','show','create','body','user','role','WhatsappAccounts','UserProfileSection','find','autoAssociation','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','include','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','priority','finally','getApplications','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','whatsapp:','Body','messageId','notifications','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','DESC','list','omit','Contacts','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge'];(function(_0x3328b4,_0x403a24){var _0x530143=function(_0x53db2a){while(--_0x53db2a){_0x3328b4['push'](_0x3328b4['shift']());}};_0x530143(++_0x403a24);}(_0x0270,0x1e7));var _0x0027=function(_0x29b265,_0x5aa8b8){_0x29b265=_0x29b265-0x0;var _0xe58ea7=_0x0270[_0x29b265];return _0xe58ea7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0027('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0027('0x1'));var rp=require(_0x0027('0x2'));var moment=require(_0x0027('0x3'));var BPromise=require(_0x0027('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0027('0x5'));var sox=require(_0x0027('0x6'));var csv=require('to-csv');var ejs=require(_0x0027('0x7'));var fs=require('fs');var fs_extra=require(_0x0027('0x8'));var _=require(_0x0027('0x9'));var squel=require('squel');var crypto=require(_0x0027('0xa'));var jsforce=require(_0x0027('0xb'));var deskjs=require(_0x0027('0xc'));var toCsv=require(_0x0027('0xd'));var querystring=require(_0x0027('0xe'));var Papa=require(_0x0027('0xf'));var Redis=require(_0x0027('0x10'));var authService=require(_0x0027('0x11'));var qs=require(_0x0027('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0027('0x13'));var logger=require(_0x0027('0x14'))(_0x0027('0x15'));var utils=require(_0x0027('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0027('0x17'));var db=require(_0x0027('0x18'))['db'];config[_0x0027('0x19')]=_[_0x0027('0x1a')](config[_0x0027('0x19')],{'host':_0x0027('0x1b'),'port':0x18eb});var socket=require(_0x0027('0x1c'))(new Redis(config[_0x0027('0x19')]));require(_0x0027('0x1d'))[_0x0027('0x1e')](socket);var jayson=require(_0x0027('0x1f'));var client=jayson['client'][_0x0027('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x5589db,_0x5f432e,_0x45070e,_0x32982f){return new BPromise(function(_0x2d7b7e,_0x572ded){var _0x208d55=_0x32982f||client;return _0x208d55['request'](_0x5589db,_0x45070e)[_0x0027('0x21')](function(_0x59b189){logger[_0x0027('0x22')](_0x0027('0x23'),_0x5f432e,'request\x20sent');logger['debug'](_0x0027('0x24'),_0x5f432e,'request\x20sent',JSON[_0x0027('0x25')](_0x59b189));if(_0x59b189[_0x0027('0x26')]){if(_0x59b189[_0x0027('0x26')][_0x0027('0x27')]===0x1f4){logger[_0x0027('0x26')](_0x0027('0x23'),_0x5f432e,_0x59b189[_0x0027('0x26')][_0x0027('0x28')]);return _0x572ded(_0x59b189['error']['message']);}logger[_0x0027('0x26')](_0x0027('0x23'),_0x5f432e,_0x59b189['error']['message']);return _0x2d7b7e(_0x59b189['error']['message']);}else{logger[_0x0027('0x22')](_0x0027('0x23'),_0x5f432e,'request\x20sent');_0x2d7b7e(_0x59b189[_0x0027('0x29')][_0x0027('0x28')]);}})[_0x0027('0x2a')](function(_0x4b701f){logger['error'](_0x0027('0x23'),_0x5f432e,_0x4b701f);_0x572ded(_0x4b701f);});});}function respondWithStatusCode(_0x43ad1c,_0x479e02){_0x479e02=_0x479e02||0xcc;return function(_0x449559){if(_0x449559){return _0x43ad1c[_0x0027('0x2b')](_0x479e02);}return _0x43ad1c[_0x0027('0x2c')](_0x479e02)[_0x0027('0x2d')]();};}function respondWithResult(_0x28adbe,_0x1778fc){_0x1778fc=_0x1778fc||0xc8;return function(_0x457130){if(_0x457130){return _0x28adbe[_0x0027('0x2c')](_0x1778fc)[_0x0027('0x2e')](_0x457130);}};}function respondWithFilteredResult(_0x37457a,_0x4699f9){return function(_0x26f346){if(_0x26f346){var _0x4e93b1=typeof _0x4699f9[_0x0027('0x2f')]===_0x0027('0x30')&&typeof _0x4699f9[_0x0027('0x31')]==='undefined';var _0x55ee8d=_0x26f346[_0x0027('0x32')];var _0x177ec4=_0x4e93b1?0x0:_0x4699f9[_0x0027('0x2f')];var _0x51a849=_0x4e93b1?_0x26f346[_0x0027('0x32')]:_0x4699f9[_0x0027('0x2f')]+_0x4699f9['limit'];var _0x14daed;if(_0x51a849>=_0x55ee8d){_0x51a849=_0x55ee8d;_0x14daed=0xc8;}else{_0x14daed=0xce;}_0x37457a[_0x0027('0x2c')](_0x14daed);return _0x37457a[_0x0027('0x33')](_0x0027('0x34'),_0x177ec4+'-'+_0x51a849+'/'+_0x55ee8d)['json'](_0x26f346);}return null;};}function patchUpdates(_0x3e7b7c){return function(_0x24c5de){try{jsonpatch['apply'](_0x24c5de,_0x3e7b7c,!![]);}catch(_0x5ec78){return BPromise['reject'](_0x5ec78);}return _0x24c5de[_0x0027('0x35')]();};}function saveUpdates(_0x558419,_0x4fe3e8){return function(_0x165741){if(_0x165741){return _0x165741[_0x0027('0x36')](_0x558419)[_0x0027('0x21')](function(_0x4e631d){return _0x4e631d;});}return null;};}function removeEntity(_0x5c89c4,_0xb351eb){return function(_0x529c8b){if(_0x529c8b){return _0x529c8b[_0x0027('0x37')]()[_0x0027('0x21')](function(){var _0x393b65=_0x529c8b[_0x0027('0x38')]({'plain':!![]});var _0x218cf7='WhatsappAccounts';return db[_0x0027('0x39')][_0x0027('0x37')]({'where':{'type':_0x218cf7,'resourceId':_0x393b65['id']}})['then'](function(){return _0x529c8b;});})[_0x0027('0x21')](function(){_0x5c89c4[_0x0027('0x2c')](0xcc)[_0x0027('0x2d')]();});}};}function handleEntityNotFound(_0x1646b4,_0x594af0){return function(_0x36082a){if(!_0x36082a){_0x1646b4[_0x0027('0x2b')](0x194);}return _0x36082a;};}function handleError(_0x39c583,_0x5d8ff1){_0x5d8ff1=_0x5d8ff1||0x1f4;return function(_0x474a97){logger['error'](_0x474a97[_0x0027('0x3a')]);if(_0x474a97[_0x0027('0x3b')]){delete _0x474a97[_0x0027('0x3b')];}_0x39c583['status'](_0x5d8ff1)[_0x0027('0x3c')](_0x474a97);};}exports[_0x0027('0x3d')]=function(_0x1d51b7,_0x1c7c2d){var _0x26a29c={'include':[{'model':db[_0x0027('0x3e')],'as':_0x0027('0x3f')}]},_0x53fc75={},_0x5c4a55={'count':0x0,'rows':[]};var _0x5d0f09=_[_0x0027('0x40')](db[_0x0027('0x41')][_0x0027('0x42')],function(_0x1b0d5e){return{'name':_0x1b0d5e['fieldName'],'type':_0x1b0d5e['type'][_0x0027('0x43')]};});_0x53fc75[_0x0027('0x44')]=_['map'](_0x5d0f09,'name');_0x53fc75[_0x0027('0x45')]=_[_0x0027('0x46')](_0x1d51b7['query']);_0x53fc75[_0x0027('0x47')]=_['intersection'](_0x53fc75['model'],_0x53fc75['query']);_0x26a29c['attributes']=_[_0x0027('0x48')](_0x53fc75['model'],qs[_0x0027('0x49')](_0x1d51b7['query'][_0x0027('0x49')]));_0x26a29c[_0x0027('0x4a')]=_0x26a29c['attributes'][_0x0027('0x4b')]?_0x26a29c[_0x0027('0x4a')]:_0x53fc75[_0x0027('0x44')];if(!_0x1d51b7[_0x0027('0x45')][_0x0027('0x4c')](_0x0027('0x4d'))){_0x26a29c[_0x0027('0x31')]=qs[_0x0027('0x31')](_0x1d51b7['query'][_0x0027('0x31')]);_0x26a29c[_0x0027('0x2f')]=qs[_0x0027('0x2f')](_0x1d51b7[_0x0027('0x45')]['offset']);}_0x26a29c[_0x0027('0x4e')]=qs[_0x0027('0x4f')](_0x1d51b7[_0x0027('0x45')][_0x0027('0x4f')]);_0x26a29c[_0x0027('0x50')]=qs['filters'](_[_0x0027('0x51')](_0x1d51b7['query'],_0x53fc75['filters']),_0x5d0f09);if(_0x1d51b7[_0x0027('0x45')]['filter']){_0x26a29c[_0x0027('0x50')]=_[_0x0027('0x52')](_0x26a29c[_0x0027('0x50')],{'$or':_[_0x0027('0x40')](_0x5d0f09,function(_0x187258){if(_0x187258[_0x0027('0x53')]!==_0x0027('0x54')){var _0xefbec4={};_0xefbec4[_0x187258[_0x0027('0x3b')]]={'$like':'%'+_0x1d51b7[_0x0027('0x45')][_0x0027('0x55')]+'%'};return _0xefbec4;}})});}_0x26a29c=_[_0x0027('0x52')]({},_0x26a29c,_0x1d51b7[_0x0027('0x56')]);var _0x27ecfd={'where':_0x26a29c['where']};return db[_0x0027('0x41')]['count'](_0x27ecfd)[_0x0027('0x21')](function(_0x2917b2){_0x5c4a55['count']=_0x2917b2;if(_0x1d51b7['query'][_0x0027('0x57')]){_0x26a29c['include']=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x26a29c);})[_0x0027('0x21')](function(_0x5d1a29){_0x5c4a55[_0x0027('0x58')]=_0x5d1a29;return _0x5c4a55;})[_0x0027('0x21')](respondWithFilteredResult(_0x1c7c2d,_0x26a29c))[_0x0027('0x2a')](handleError(_0x1c7c2d,null));};exports[_0x0027('0x59')]=function(_0x268db5,_0x38da08){var _0x3f710e={'raw':![],'where':{'id':_0x268db5['params']['id']},'include':[{'model':db[_0x0027('0x3e')],'as':_0x0027('0x3f')}]},_0x49ca0b={};_0x49ca0b[_0x0027('0x44')]=_[_0x0027('0x46')](db['WhatsappAccount'][_0x0027('0x42')]);_0x49ca0b[_0x0027('0x45')]=_['keys'](_0x268db5[_0x0027('0x45')]);_0x49ca0b[_0x0027('0x47')]=_[_0x0027('0x48')](_0x49ca0b[_0x0027('0x44')],_0x49ca0b[_0x0027('0x45')]);_0x3f710e['attributes']=_[_0x0027('0x48')](_0x49ca0b[_0x0027('0x44')],qs['fields'](_0x268db5['query'][_0x0027('0x49')]));_0x3f710e['attributes']=_0x3f710e['attributes'][_0x0027('0x4b')]?_0x3f710e['attributes']:_0x49ca0b[_0x0027('0x44')];if(_0x268db5['query'][_0x0027('0x57')]){_0x3f710e['include']=[{'all':!![]}];}_0x3f710e=_['merge']({},_0x3f710e,_0x268db5['options']);return db[_0x0027('0x41')]['find'](_0x3f710e)[_0x0027('0x21')](handleEntityNotFound(_0x38da08,null))['then'](respondWithResult(_0x38da08,null))[_0x0027('0x2a')](handleError(_0x38da08,null));};exports['create']=function(_0x3cc762,_0x155975){return db[_0x0027('0x41')][_0x0027('0x5a')](_0x3cc762[_0x0027('0x5b')],{})[_0x0027('0x21')](function(_0x4a7f39){var _0x4e7ba5=_0x3cc762[_0x0027('0x5c')][_0x0027('0x38')]({'plain':!![]});if(!_0x4e7ba5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e7ba5[_0x0027('0x5d')]===_0x0027('0x5c')){var _0x5d2ff5=_0x4a7f39[_0x0027('0x38')]({'plain':!![]});var _0x3e820c=_0x0027('0x5e');return db[_0x0027('0x5f')][_0x0027('0x60')]({'where':{'name':_0x3e820c,'userProfileId':_0x4e7ba5['userProfileId']},'raw':!![]})[_0x0027('0x21')](function(_0xd9b4f8){if(_0xd9b4f8&&_0xd9b4f8[_0x0027('0x61')]===0x0){return db[_0x0027('0x39')]['create']({'name':_0x5d2ff5['name'],'resourceId':_0x5d2ff5['id'],'type':_0xd9b4f8['name'],'sectionId':_0xd9b4f8['id']},{})[_0x0027('0x21')](function(){return _0x4a7f39;});}else{return _0x4a7f39;}})[_0x0027('0x2a')](function(_0x1956da){logger[_0x0027('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1956da);throw _0x1956da;});}return _0x4a7f39;})[_0x0027('0x21')](respondWithResult(_0x155975,0xc9))['catch'](handleError(_0x155975,null));};exports[_0x0027('0x36')]=function(_0x425b6f,_0x4470e8){if(_0x425b6f[_0x0027('0x5b')]['id']){delete _0x425b6f['body']['id'];}return db['WhatsappAccount'][_0x0027('0x60')]({'where':{'id':_0x425b6f[_0x0027('0x62')]['id']},'include':[{'model':db['Pause'],'as':_0x0027('0x3f')}]})[_0x0027('0x21')](handleEntityNotFound(_0x4470e8,null))['then'](saveUpdates(_0x425b6f['body'],null))['then'](respondWithResult(_0x4470e8,null))['catch'](handleError(_0x4470e8,null));};exports['destroy']=function(_0x2f1029,_0x270563){return db[_0x0027('0x41')][_0x0027('0x60')]({'where':{'id':_0x2f1029[_0x0027('0x62')]['id']}})['then'](handleEntityNotFound(_0x270563,null))[_0x0027('0x21')](removeEntity(_0x270563,null))[_0x0027('0x2a')](handleError(_0x270563,null));};exports[_0x0027('0x63')]=function(_0x451829,_0x5e2a29){return db[_0x0027('0x41')][_0x0027('0x63')]()['then'](respondWithResult(_0x5e2a29,null))[_0x0027('0x2a')](handleError(_0x5e2a29,null));};exports[_0x0027('0x64')]=function(_0x4801d6,_0x1f1781,_0x4a87f8){if(_0x4801d6[_0x0027('0x5b')]['id']){delete _0x4801d6[_0x0027('0x5b')]['id'];}return db[_0x0027('0x41')]['find']({'where':{'id':_0x4801d6[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x1f1781,null))[_0x0027('0x21')](function(_0x494d84){if(_0x494d84){_0x4801d6[_0x0027('0x5b')][_0x0027('0x65')]=_0x494d84['id'];return db[_0x0027('0x66')]['create'](_0x4801d6['body']);}})[_0x0027('0x21')](respondWithResult(_0x1f1781,null))['catch'](handleError(_0x1f1781,null));};exports[_0x0027('0x67')]=function(_0x3325e1,_0x56ebad,_0x40c4b6){var _0x5bca8f={'raw':![],'where':{}};var _0x33f4dc={};var _0x5098de={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x0027('0x68')]({'where':{'id':_0x3325e1[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x56ebad,null))['then'](function(_0x5106fb){if(_0x5106fb){_0x33f4dc[_0x0027('0x44')]=_['keys'](db[_0x0027('0x66')][_0x0027('0x42')]);_0x33f4dc[_0x0027('0x45')]=_[_0x0027('0x46')](_0x3325e1['query']);_0x33f4dc[_0x0027('0x47')]=_[_0x0027('0x48')](_0x33f4dc[_0x0027('0x44')],_0x33f4dc['query']);_0x5bca8f[_0x0027('0x4a')]=_[_0x0027('0x48')](_0x33f4dc[_0x0027('0x44')],qs[_0x0027('0x49')](_0x3325e1[_0x0027('0x45')][_0x0027('0x49')]));_0x5bca8f[_0x0027('0x4a')]=_0x5bca8f['attributes'][_0x0027('0x4b')]?_0x5bca8f[_0x0027('0x4a')]:_0x33f4dc[_0x0027('0x44')];if(!_0x3325e1[_0x0027('0x45')]['hasOwnProperty'](_0x0027('0x4d'))){_0x5bca8f[_0x0027('0x31')]=qs[_0x0027('0x31')](_0x3325e1[_0x0027('0x45')][_0x0027('0x31')]);_0x5bca8f[_0x0027('0x2f')]=qs[_0x0027('0x2f')](_0x3325e1[_0x0027('0x45')][_0x0027('0x2f')]);}_0x5bca8f['order']=qs[_0x0027('0x4f')](_0x3325e1[_0x0027('0x45')][_0x0027('0x4f')]);_0x5bca8f[_0x0027('0x50')]=qs['filters'](_[_0x0027('0x51')](_0x3325e1[_0x0027('0x45')],_0x33f4dc['filters']));_0x5bca8f[_0x0027('0x50')][_0x0027('0x65')]=_0x5106fb['id'];if(_0x3325e1[_0x0027('0x45')][_0x0027('0x55')]){_0x5bca8f['where']=_[_0x0027('0x52')](_0x5bca8f['where'],{'$or':_['map'](_0x5bca8f['attributes'],function(_0x25cf19){var _0x3b1fb2={};_0x3b1fb2[_0x25cf19]={'$like':'%'+_0x3325e1['query'][_0x0027('0x55')]+'%'};return _0x3b1fb2;})});}_0x5bca8f=_[_0x0027('0x52')]({},_0x5bca8f,_0x3325e1['options']);return db[_0x0027('0x66')][_0x0027('0x32')]({'where':_0x5bca8f['where']})['then'](function(_0x505244){_0x5098de[_0x0027('0x32')]=_0x505244;if(_0x3325e1['query'][_0x0027('0x57')]){_0x5bca8f[_0x0027('0x69')]=[{'all':!![]}];}return db[_0x0027('0x66')][_0x0027('0x6a')](_0x5bca8f);})[_0x0027('0x21')](function(_0x40ea4a){_0x5098de[_0x0027('0x58')]=_0x40ea4a;return _0x5098de;});}})['then'](respondWithFilteredResult(_0x56ebad,_0x5bca8f))[_0x0027('0x2a')](handleError(_0x56ebad,null));};exports['removeDispositions']=function(_0x3841ab,_0x22c2f3,_0x32f388){return db[_0x0027('0x41')]['find']({'where':{'id':_0x3841ab[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x22c2f3,null))[_0x0027('0x21')](function(_0x57e92f){if(_0x57e92f){return _0x57e92f[_0x0027('0x6b')](_0x3841ab['query'][_0x0027('0x6c')]);}})[_0x0027('0x21')](respondWithStatusCode(_0x22c2f3,null))[_0x0027('0x2a')](handleError(_0x22c2f3,null));};exports[_0x0027('0x6d')]=function(_0x2b04c5,_0x341768,_0x56dd20){if(_0x2b04c5[_0x0027('0x5b')]['id']){delete _0x2b04c5[_0x0027('0x5b')]['id'];}return db['WhatsappAccount'][_0x0027('0x60')]({'where':{'id':_0x2b04c5[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x341768,null))['then'](function(_0x3615c9){if(_0x3615c9){_0x2b04c5[_0x0027('0x5b')]['WhatsappAccountId']=_0x3615c9['id'];return db['CannedAnswer'][_0x0027('0x5a')](_0x2b04c5[_0x0027('0x5b')]);}})[_0x0027('0x21')](respondWithResult(_0x341768,null))[_0x0027('0x2a')](handleError(_0x341768,null));};exports[_0x0027('0x6e')]=function(_0x165ce7,_0x2b88bd,_0x5b522d){var _0x3358bc={'raw':![],'where':{}};var _0x344aca={};var _0x48ac4b={'count':0x0,'rows':[]};return db[_0x0027('0x41')][_0x0027('0x68')]({'where':{'id':_0x165ce7[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x2b88bd,null))[_0x0027('0x21')](function(_0x3b015e){if(_0x3b015e){_0x344aca[_0x0027('0x44')]=_['keys'](db[_0x0027('0x6f')][_0x0027('0x42')]);_0x344aca[_0x0027('0x45')]=_[_0x0027('0x46')](_0x165ce7[_0x0027('0x45')]);_0x344aca[_0x0027('0x47')]=_[_0x0027('0x48')](_0x344aca['model'],_0x344aca[_0x0027('0x45')]);_0x3358bc['attributes']=_[_0x0027('0x48')](_0x344aca['model'],qs['fields'](_0x165ce7[_0x0027('0x45')][_0x0027('0x49')]));_0x3358bc['attributes']=_0x3358bc[_0x0027('0x4a')][_0x0027('0x4b')]?_0x3358bc[_0x0027('0x4a')]:_0x344aca[_0x0027('0x44')];if(!_0x165ce7[_0x0027('0x45')][_0x0027('0x4c')](_0x0027('0x4d'))){_0x3358bc['limit']=qs['limit'](_0x165ce7[_0x0027('0x45')][_0x0027('0x31')]);_0x3358bc['offset']=qs[_0x0027('0x2f')](_0x165ce7[_0x0027('0x45')][_0x0027('0x2f')]);}_0x3358bc['order']=qs[_0x0027('0x4f')](_0x165ce7[_0x0027('0x45')][_0x0027('0x4f')]);_0x3358bc[_0x0027('0x50')]=qs[_0x0027('0x47')](_[_0x0027('0x51')](_0x165ce7['query'],_0x344aca[_0x0027('0x47')]));_0x3358bc['where'][_0x0027('0x65')]=_0x3b015e['id'];if(_0x165ce7[_0x0027('0x45')][_0x0027('0x55')]){_0x3358bc['where']=_[_0x0027('0x52')](_0x3358bc[_0x0027('0x50')],{'$or':_['map'](_0x3358bc['attributes'],function(_0xa2191a){var _0x82ad4a={};_0x82ad4a[_0xa2191a]={'$like':'%'+_0x165ce7[_0x0027('0x45')]['filter']+'%'};return _0x82ad4a;})});}_0x3358bc=_[_0x0027('0x52')]({},_0x3358bc,_0x165ce7[_0x0027('0x56')]);return db[_0x0027('0x6f')][_0x0027('0x32')]({'where':_0x3358bc['where']})[_0x0027('0x21')](function(_0x36e0c2){_0x48ac4b[_0x0027('0x32')]=_0x36e0c2;if(_0x165ce7[_0x0027('0x45')][_0x0027('0x57')]){_0x3358bc[_0x0027('0x69')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x3358bc);})[_0x0027('0x21')](function(_0x1b30e1){_0x48ac4b['rows']=_0x1b30e1;return _0x48ac4b;});}})[_0x0027('0x21')](respondWithFilteredResult(_0x2b88bd,_0x3358bc))[_0x0027('0x2a')](handleError(_0x2b88bd,null));};exports[_0x0027('0x70')]=function(_0x1bfe77,_0x5d6414,_0x223c9b){return db['WhatsappAccount']['find']({'where':{'id':_0x1bfe77[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x5d6414,null))[_0x0027('0x21')](function(_0xe2cdd6){if(_0xe2cdd6){return _0xe2cdd6[_0x0027('0x70')](_0x1bfe77[_0x0027('0x45')]['ids']);}})['then'](respondWithStatusCode(_0x5d6414,null))[_0x0027('0x2a')](handleError(_0x5d6414,null));};exports[_0x0027('0x71')]=function(_0x40a391,_0x35ba99,_0xa7af22){return db['WhatsappAccount']['find']({'where':{'id':_0x40a391[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x35ba99,null))['then'](function(_0x42db0b){if(_0x42db0b){return _0x42db0b['addAgents'](_0x40a391[_0x0027('0x5b')]['ids'],_['omit'](_0x40a391[_0x0027('0x5b')],[_0x0027('0x6c'),'id'])||{})[_0x0027('0x72')](function(_0x4606a0){for(var _0x38fe99=0x0;_0x38fe99<_0x40a391['body'][_0x0027('0x6c')]['length'];_0x38fe99+=0x1){socket[_0x0027('0x73')](_0x0027('0x74'),{'UserId':Number(_0x40a391['body'][_0x0027('0x6c')][_0x38fe99]),'WhatsappAccountId':Number(_0x40a391[_0x0027('0x62')]['id'])});}return _0x4606a0;});}})['then'](respondWithResult(_0x35ba99,null))[_0x0027('0x2a')](handleError(_0x35ba99,null));};exports[_0x0027('0x75')]=function(_0x107c30,_0x93001e,_0x1d7261){return db[_0x0027('0x41')][_0x0027('0x60')]({'where':{'id':_0x107c30['params']['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x93001e,null))[_0x0027('0x21')](function(_0x62b2e9){if(_0x62b2e9){return _0x62b2e9['removeAgents'](_0x107c30[_0x0027('0x45')][_0x0027('0x6c')])['then'](function(){if(_[_0x0027('0x76')](_0x107c30['query'][_0x0027('0x6c')])){for(var _0x4e8dad=0x0;_0x4e8dad<_0x107c30[_0x0027('0x45')][_0x0027('0x6c')][_0x0027('0x4b')];_0x4e8dad+=0x1){socket[_0x0027('0x73')](_0x0027('0x77'),{'UserId':Number(_0x107c30['query'][_0x0027('0x6c')][_0x4e8dad]),'WhatsappAccountId':Number(_0x107c30[_0x0027('0x62')]['id'])});}}else{socket[_0x0027('0x73')](_0x0027('0x77'),{'UserId':Number(_0x107c30['query']['ids']),'WhatsappAccountId':Number(_0x107c30['params']['id'])});}});}})[_0x0027('0x21')](respondWithStatusCode(_0x93001e,null))[_0x0027('0x2a')](handleError(_0x93001e,null));};exports['getAgents']=function(_0x2d27cd,_0x2ce16c,_0x594452){var _0x3a3229={};var _0x38db5f={};var _0x10ba7f;var _0xca5dbd;return db[_0x0027('0x41')][_0x0027('0x68')]({'where':{'id':_0x2d27cd[_0x0027('0x62')]['id']}})[_0x0027('0x21')](handleEntityNotFound(_0x2ce16c,null))[_0x0027('0x21')](function(_0x4e0ec4){if(_0x4e0ec4){_0x10ba7f=_0x4e0ec4;_0x38db5f[_0x0027('0x44')]=_['keys'](db['User'][_0x0027('0x42')]);_0x38db5f[_0x0027('0x45')]=_[_0x0027('0x46')](_0x2d27cd[_0x0027('0x45')]);_0x38db5f[_0x0027('0x47')]=_['intersection'](_0x38db5f[_0x0027('0x44')],_0x38db5f[_0x0027('0x45')]);_0x3a3229[_0x0027('0x4a')]=_[_0x0027('0x48')](_0x38db5f[_0x0027('0x44')],qs['fields'](_0x2d27cd[_0x0027('0x45')][_0x0027('0x49')]));_0x3a3229[_0x0027('0x4a')]=_0x3a3229[_0x0027('0x4a')][_0x0027('0x4b')]?_0x3a3229[_0x0027('0x4a')]:_0x38db5f[_0x0027('0x44')];_0x3a3229[_0x0027('0x4e')]=qs['sort'](_0x2d27cd['query'][_0x0027('0x4f')]);_0x3a3229[_0x0027('0x50')]=qs[_0x0027('0x47')](_['pick'](_0x2d27cd[_0x0027('0x45')],_0x38db5f[_0x0027('0x47')]));if(_0x2d27cd['query'][_0x0027('0x55')]){_0x3a3229[_0x0027('0x50')]=_[_0x0027('0x52')](_0x3a3229[_0x0027('0x50')],{'$or':_[_0x0027('0x40')](_0x3a3229['attributes'],function(_0x781d8f){var _0x28b2fb={};_0x28b2fb[_0x781d8f]={'$like':'%'+_0x2d27cd[_0x0027('0x45')][_0x0027('0x55')]+'%'};return _0x28b2fb;})});}_0x3a3229=_[_0x0027('0x52')]({},_0x3a3229,_0x2d27cd['options']);return _0x10ba7f[_0x0027('0x78')](_0x3a3229);}})[_0x0027('0x21')](function(_0x5024ff){if(_0x5024ff){_0xca5dbd=_0x5024ff[_0x0027('0x4b')];if(!_0x2d27cd['query'][_0x0027('0x4c')](_0x0027('0x4d'))){_0x3a3229['limit']=qs[_0x0027('0x31')](_0x2d27cd['query'][_0x0027('0x31')]);_0x3a3229['offset']=qs['offset'](_0x2d27cd[_0x0027('0x45')][_0x0027('0x2f')]);}return _0x10ba7f[_0x0027('0x78')](_0x3a3229);}})[_0x0027('0x21')](function(_0x2cd603){if(_0x2cd603){return _0x2cd603?{'count':_0xca5dbd,'rows':_0x2cd603}:null;}})['then'](respondWithResult(_0x2ce16c,null))[_0x0027('0x2a')](handleError(_0x2ce16c,null));};exports[_0x0027('0x79')]=function(_0x5dfe45,_0x55660a){var _0x5e1aed=_0x5dfe45[_0x0027('0x62')]['id'];var _0x243174=_0x5dfe45['body'];var _0x2fc781=0xc8;var _0x28f80f=null;return db[_0x0027('0x7a')][_0x0027('0x7b')]({'isolationLevel':db[_0x0027('0x7a')][_0x0027('0x7c')][_0x0027('0x7d')]['READ_COMMITTED']},function(_0x36ed01){return db[_0x0027('0x41')][_0x0027('0x68')]({'where':{'id':_0x5e1aed},'transaction':_0x36ed01})[_0x0027('0x21')](function(_0x154199){if(_0x154199){return db[_0x0027('0x7e')][_0x0027('0x37')]({'where':{'WhatsappAccountId':_0x5e1aed},'transaction':_0x36ed01})['then'](function(){var _0x35cf09=_[_0x0027('0x40')](_0x243174,function(_0x146ac4){_0x146ac4[_0x0027('0x65')]=_0x5e1aed;return _0x146ac4;});return db['WhatsappApplication']['bulkCreate'](_0x35cf09,{'transaction':_0x36ed01});});}else{_0x2fc781=0x194;_0x28f80f=[];}});})[_0x0027('0x21')](function(){if(_0x2fc781!==0x194){return db[_0x0027('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x5e1aed},'order':_0x0027('0x7f')})[_0x0027('0x21')](function(_0x5d7552){_0x28f80f=_0x5d7552;});}})[_0x0027('0x2a')](function(_0x15fc15){_0x2fc781=0x1f4;logger[_0x0027('0x26')](_0x15fc15['stack']);if(_0x15fc15[_0x0027('0x3b')]){delete _0x15fc15[_0x0027('0x3b')];}_0x28f80f=_0x15fc15;})[_0x0027('0x80')](function(){if(_0x28f80f===null){_0x55660a[_0x0027('0x2b')](_0x2fc781);}else{if(_0x2fc781===0x1f4){_0x55660a[_0x0027('0x2c')](_0x2fc781)[_0x0027('0x3c')](_0x28f80f);}else{_0x55660a[_0x0027('0x2c')](_0x2fc781)[_0x0027('0x2e')](_0x28f80f);}}});};exports[_0x0027('0x81')]=function(_0x50ceed,_0x425a7f,_0x4483cb){var _0x1fbc02={};var _0x1c2532={};var _0x56401d;var _0x293a80;return db[_0x0027('0x41')][_0x0027('0x68')]({'where':{'id':_0x50ceed[_0x0027('0x62')]['id']}})['then'](handleEntityNotFound(_0x425a7f,null))['then'](function(_0xc6ba73){if(_0xc6ba73){_0x56401d=_0xc6ba73;_0x1c2532[_0x0027('0x44')]=_[_0x0027('0x46')](db[_0x0027('0x7e')]['rawAttributes']);_0x1c2532[_0x0027('0x45')]=_[_0x0027('0x46')](_0x50ceed[_0x0027('0x45')]);_0x1c2532[_0x0027('0x47')]=_[_0x0027('0x48')](_0x1c2532[_0x0027('0x44')],_0x1c2532['query']);_0x1fbc02[_0x0027('0x4a')]=_[_0x0027('0x48')](_0x1c2532[_0x0027('0x44')],qs[_0x0027('0x49')](_0x50ceed[_0x0027('0x45')][_0x0027('0x49')]));_0x1fbc02[_0x0027('0x4a')]=_0x1fbc02[_0x0027('0x4a')][_0x0027('0x4b')]?_0x1fbc02[_0x0027('0x4a')]:_0x1c2532[_0x0027('0x44')];_0x1fbc02[_0x0027('0x4e')]=qs[_0x0027('0x4f')](_0x50ceed[_0x0027('0x45')][_0x0027('0x4f')]);_0x1fbc02['where']=qs[_0x0027('0x47')](_[_0x0027('0x51')](_0x50ceed[_0x0027('0x45')],_0x1c2532[_0x0027('0x47')]));if(_0x50ceed[_0x0027('0x45')][_0x0027('0x55')]){_0x1fbc02[_0x0027('0x50')]=_[_0x0027('0x52')](_0x1fbc02[_0x0027('0x50')],{'$or':_[_0x0027('0x40')](_0x1fbc02['attributes'],function(_0x3b9575){var _0x45a387={};_0x45a387[_0x3b9575]={'$like':'%'+_0x50ceed[_0x0027('0x45')][_0x0027('0x55')]+'%'};return _0x45a387;})});}_0x1fbc02=_[_0x0027('0x52')]({},_0x1fbc02,_0x50ceed['options']);return _0x56401d[_0x0027('0x81')](_0x1fbc02);}})[_0x0027('0x21')](function(_0x3d0d3d){if(_0x3d0d3d){_0x293a80=_0x3d0d3d[_0x0027('0x4b')];if(!_0x50ceed[_0x0027('0x45')]['hasOwnProperty']('nolimit')){_0x1fbc02[_0x0027('0x31')]=qs[_0x0027('0x31')](_0x50ceed[_0x0027('0x45')]['limit']);_0x1fbc02['offset']=qs[_0x0027('0x2f')](_0x50ceed['query']['offset']);}return _0x56401d[_0x0027('0x81')](_0x1fbc02);}})[_0x0027('0x21')](function(_0x762253){if(_0x762253){return _0x762253?{'count':_0x293a80,'rows':_0x762253}:null;}})['then'](respondWithResult(_0x425a7f,null))[_0x0027('0x2a')](handleError(_0x425a7f,null));};exports['notify']=function(_0x267686,_0x204c8a,_0x25b950){var _0x343e1e={'channel':_0x0027('0x82')};var _0x251e8d=[];var _0x4eb7b8=[];var _0x336814={};return db['WhatsappAccount'][_0x0027('0x60')]({'where':{'id':_0x267686[_0x0027('0x62')]['id']},'include':[{'model':db[_0x0027('0x7e')],'as':'Applications'}]})[_0x0027('0x21')](handleEntityNotFound(_0x204c8a,null))[_0x0027('0x21')](function(_0x1832cb){_0x343e1e['account']=_0x1832cb;if(_0x343e1e[_0x0027('0x83')]&&_0x343e1e['account'][_0x0027('0x53')]===_0x0027('0x84')&&_0x267686[_0x0027('0x5b')][_0x0027('0x85')]){if(_0x267686[_0x0027('0x5b')][_0x0027('0x85')][_0x0027('0x4b')]===0x0)return;if(_0x267686[_0x0027('0x5b')][_0x0027('0x85')][0x0][_0x0027('0x86')]!==_0x0027('0x87'))return;return db[_0x0027('0x88')]['update']({'read':!![],'readAt':_0x267686[_0x0027('0x5b')]['statuses'][0x0][_0x0027('0x89')]},{'where':{'messageId':_0x267686['body'][_0x0027('0x85')][0x0][_0x0027('0x8a')]},'individualHooks':!![]})['then'](function(_0x3cdf9){return _0x204c8a[_0x0027('0x2c')](0xc8)[_0x0027('0x2e')](_0x3cdf9);});}_0x343e1e[_0x0027('0x8b')]=_[_0x0027('0x8c')](_0x1832cb[_0x0027('0x8d')],[_0x0027('0x7f')],[_0x0027('0x8e')]);if(_0x343e1e[_0x0027('0x83')][_0x0027('0x8d')]){delete _0x343e1e['account'][_0x0027('0x8d')];}return db[_0x0027('0x8f')]['describe']()[_0x0027('0x21')](function(_0x32afac){if(!_0x32afac){throw new db[(_0x0027('0x90'))]['ValidationError'](_0x0027('0x91'));}_0x251e8d=_['difference'](_['keys'](_0x32afac),[_0x0027('0x92'),_0x0027('0x93')]);_0x4eb7b8=_[_0x0027('0x94')](_[_0x0027('0x46')](_0x32afac),[_0x0027('0x92'),_0x0027('0x93'),_0x0027('0x95'),_0x0027('0x96')]);_0x343e1e[_0x0027('0x5b')]={'mapKey':'mobile'};if(_0x343e1e['account']&&_0x343e1e[_0x0027('0x83')]['type']==='twilio'){_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')]=_0x267686[_0x0027('0x5b')]['From']['replace'](_0x0027('0x98'),'');_0x343e1e[_0x0027('0x5b')][_0x0027('0x5b')]=_0x267686[_0x0027('0x5b')][_0x0027('0x99')];_0x343e1e['body'][_0x0027('0x9a')]=_0x267686[_0x0027('0x5b')]['MessageSid'];}if(_0x343e1e[_0x0027('0x83')]&&_0x343e1e['account'][_0x0027('0x53')]===_0x0027('0x84')){_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')]=_0x267686['body'][_0x0027('0x9b')][0x0][_0x0027('0x97')];_0x343e1e[_0x0027('0x5b')][_0x0027('0x5b')]=_0x267686['body'][_0x0027('0x9b')][0x0]['message'][_0x0027('0x5b')];_0x343e1e[_0x0027('0x5b')]['messageId']=_0x267686[_0x0027('0x5b')]['notifications'][0x0][_0x0027('0x8a')];}if(_0x343e1e['body']['id']){delete _0x343e1e[_0x0027('0x5b')]['id'];}if(_[_0x0027('0x9c')](_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')])){throw new db[(_0x0027('0x90'))][(_0x0027('0x9d'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x343e1e[_0x0027('0x5b')]['body'])||_0x343e1e[_0x0027('0x5b')][_0x0027('0x5b')]===''){throw new db[(_0x0027('0x90'))]['ValidationError'](_0x0027('0x9e'));}if(_['isNil'](_0x343e1e[_0x0027('0x5b')][_0x0027('0x9f')])){throw new db['Sequelize']['ValidationError'](_0x0027('0xa0')+_0x4eb7b8);}if(!_[_0x0027('0xa1')](_0x4eb7b8,_0x343e1e[_0x0027('0x5b')][_0x0027('0x9f')])){throw new db[(_0x0027('0x90'))][(_0x0027('0x9d'))](_0x0027('0xa2')+_0x4eb7b8);}_0x336814[_0x343e1e[_0x0027('0x5b')][_0x0027('0x9f')]]=_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')];return db['CmList'][_0x0027('0x60')]({'where':{'id':_0x343e1e[_0x0027('0x83')]['ListId']},'include':[{'model':db[_0x0027('0x8f')],'as':'Contacts','where':_0x336814,'limit':0x1,'order':[[_0x0027('0x93'),_0x0027('0xa3')]]}]});})['then'](handleEntityNotFound(_0x204c8a,null))[_0x0027('0x21')](function(_0x390798){if(_0x390798){_0x343e1e[_0x0027('0xa4')]=_[_0x0027('0xa5')](_0x390798,[_0x0027('0xa6')]);if(_0x390798[_0x0027('0xa6')][_0x0027('0x4b')]){return _0x390798['Contacts'][0x0];}var _0x2017fc=_[_0x0027('0x1a')](_0x343e1e[_0x0027('0x5b')],{'firstName':_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')],'ListId':_0x390798['id']});_0x2017fc[_0x343e1e[_0x0027('0x5b')]['mapKey']]=_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')];return db[_0x0027('0x8f')]['create'](_0x2017fc,{'fields':_0x251e8d,'raw':!![]});}})['then'](handleEntityNotFound(_0x204c8a,null))[_0x0027('0x21')](function(_0x369fbe){if(_0x369fbe){_0x343e1e['contact']=_0x369fbe;var _0xa9b955={'ContactId':_0x369fbe['id'],'phone':_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')],'WhatsappAccountId':_0x267686[_0x0027('0x62')]['id']};var _0x180b33={'ContactId':_0x369fbe['id'],'WhatsappAccountId':_0x267686['params']['id'],'closed':![]};return db[_0x0027('0xa7')][_0x0027('0x60')]({'where':_0x180b33})[_0x0027('0x21')](function(_0x47cc65){if(_0x47cc65){return[_0x47cc65,![]];}return db[_0x0027('0xa7')]['create'](_0xa9b955)[_0x0027('0x21')](function(_0x92389){return[_0x92389,!![]];});});}})[_0x0027('0x72')](function(_0x216ffd,_0x3cdd52){_0x343e1e[_0x0027('0xa8')]=_0x216ffd[_0x0027('0x38')]({'plain':!![]});_0x343e1e['interaction'][_0x0027('0xa9')]=![];if(_0x3cdd52){if(_0x343e1e[_0x0027('0x83')][_0x0027('0xaa')]){_0x343e1e['applications'][_0x0027('0xab')]({'id':0x0,'priority':_0x343e1e[_0x0027('0x8b')][_0x0027('0x4b')]+0x1,'app':'close','appdata':_0x0027('0xac'),'interval':_0x0027('0xad')});}_0x343e1e[_0x0027('0xa8')][_0x0027('0xa9')]=!![];}return db[_0x0027('0x88')]['create']({'phone':_0x343e1e[_0x0027('0x5b')][_0x0027('0x97')],'messageId':_0x343e1e[_0x0027('0x5b')][_0x0027('0x9a')],'body':_0x343e1e['body'][_0x0027('0x5b')],'WhatsappAccountId':_0x267686[_0x0027('0x62')]['id'],'WhatsappInteractionId':_0x216ffd['id'],'direction':'in','ContactId':_0x216ffd[_0x0027('0xae')],'AttachmentId':_0x343e1e[_0x0027('0x5b')]['AttachmentId']});})['then'](function(_0xd4be35){_0x343e1e['message']=_0xd4be35;if(_0x343e1e[_0x0027('0xa8')][_0x0027('0xaf')]){return db['User'][_0x0027('0x60')]({'attributes':['id','name'],'where':{'id':_0x343e1e['interaction']['UserId']}})[_0x0027('0x21')](function(_0x19e571){if(_0x19e571){_0x343e1e[_0x0027('0x8b')][_0x0027('0xb0')]({'id':0x0,'priority':0x0,'app':_0x0027('0xb1'),'appdata':_0x19e571[_0x0027('0x3b')]+','+(_0x343e1e[_0x0027('0x83')][_0x0027('0xb2')]||0xa),'interval':_0x0027('0xad')});}return respondWithRpcPromise(_0x0027('0xb3'),'startRouting',_0x343e1e);});}return respondWithRpcPromise('Start',_0x0027('0xb4'),_0x343e1e);})['then'](function(_0x1b54ec){if(_0x1b54ec){var _0xe8b66a=0xc8;var _0x51e84b=_0x0027('0xb5');logger[_0x0027('0x22')](_0x0027('0x24'),_0x51e84b,_0xe8b66a,'entity\x20found');logger['debug'](_0x0027('0xb6'),_0x51e84b,_0xe8b66a,_0x0027('0xb7'),JSON['stringify'](_0x1b54ec));if(_0x343e1e[_0x0027('0x83')]['type']==='twilio'){return _0x204c8a['status'](_0xe8b66a)[_0x0027('0x33')]('Content-Type','text/xml')[_0x0027('0x3c')]('\x0a');}else{return _0x204c8a[_0x0027('0x2c')](_0xe8b66a)['json'](_0x1b54ec);}}});})[_0x0027('0x2a')](handleError(_0x204c8a,null));};exports[_0x0027('0x3c')]=function(_0x52ddf1,_0x303f46,_0x52b398){var _0xd01ba,_0x1dfc02,_0x4a8f40;if(_['isNil'](_0x52ddf1[_0x0027('0x5b')][_0x0027('0x5b')])||_0x52ddf1[_0x0027('0x5b')][_0x0027('0x5b')]===''){throw new db['Sequelize'][(_0x0027('0x9d'))](_0x0027('0x9e'));}if(_[_0x0027('0x9c')](_0x52ddf1['body']['to'])){throw new db[(_0x0027('0x90'))][(_0x0027('0x9d'))](_0x0027('0xb8'));}_0xd01ba=_0x52ddf1['body']['to'];return db[_0x0027('0x41')][_0x0027('0x60')]({'where':{'id':_0x52ddf1[_0x0027('0x62')]['id']},'include':[{'model':db[_0x0027('0xb9')],'as':'List','include':[{'model':db['CmContact'],'as':_0x0027('0xa6'),'where':{'mobile':_0xd01ba},'limit':0x1,'order':[[_0x0027('0x93'),_0x0027('0xa3')]]}]}]})[_0x0027('0x21')](handleEntityNotFound(_0x303f46,null))['then'](function(_0x156e37){if(_0x156e37&&_0x156e37[_0x0027('0xba')]){_0x1dfc02=_0x156e37[_0x0027('0x38')]({'plain':!![]});if(_0x1dfc02[_0x0027('0xba')]&&_0x1dfc02[_0x0027('0xba')][_0x0027('0xa6')][_0x0027('0x4b')]){return _0x1dfc02[_0x0027('0xba')][_0x0027('0xa6')][0x0];}return db[_0x0027('0x8f')]['create'](_['defaults'](_0x52ddf1[_0x0027('0x5b')],{'firstName':_0xd01ba,'mobile':_0xd01ba,'phone':_0xd01ba,'ListId':_0x1dfc02['ListId']}));}})[_0x0027('0x21')](handleEntityNotFound(_0x303f46,null))['then'](function(_0x14caeb){if(_0x14caeb){_0x4a8f40=_0x14caeb;return db[_0x0027('0xa7')]['find']({'where':{'ContactId':_0x4a8f40['id'],'closed':![],'WhatsappAccountId':_0x1dfc02['id']}})[_0x0027('0x21')](function(_0x36ac32){if(_0x36ac32){return[_0x36ac32,![]];}return db[_0x0027('0xa7')][_0x0027('0x5a')]({'UserId':_0x52ddf1['user']['id'],'ContactId':_0x4a8f40['id'],'WhatsappAccountId':_0x1dfc02['id'],'phone':_0xd01ba,'firstMsgDirection':_0x0027('0xbb'),'Messages':[_['merge'](_0x52ddf1[_0x0027('0x5b')],{'read':![],'body':_0x52ddf1[_0x0027('0x5b')][_0x0027('0x5b')],'phone':_0xd01ba,'WhatsappAccountId':_0x1dfc02['id'],'UserId':_0x52ddf1['user']['id'],'ContactId':_0x4a8f40['id']})]},{'include':[{'model':db[_0x0027('0x88')],'as':_0x0027('0xbc')}]})[_0x0027('0x21')](function(_0x3fc6d6){return[_0x3fc6d6,!![]];});});}})[_0x0027('0x72')](function(_0x354b6a,_0x31341e){if(_0x31341e){return _0x354b6a;}return db[_0x0027('0x88')][_0x0027('0x5a')](_[_0x0027('0x52')](_0x52ddf1[_0x0027('0x5b')],{'read':![],'body':_0x52ddf1[_0x0027('0x5b')]['body'],'phone':_0xd01ba,'WhatsappAccountId':_0x1dfc02['id'],'WhatsappInteractionId':_0x354b6a['id'],'UserId':_0x52ddf1[_0x0027('0x5c')]['id'],'ContactId':_0x4a8f40['id']}))['then'](function(_0x50ca56){_0x354b6a['dataValues']['Messages']=[];_0x354b6a['dataValues']['Messages'][_0x0027('0xab')](_0x50ca56[_0x0027('0xbd')]);return _0x354b6a;});})[_0x0027('0x21')](respondWithResult(_0x303f46,null))[_0x0027('0x2a')](handleError(_0x303f46,null));}; \ No newline at end of file +var _0xfe7c=['account','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','From','replace','Body','messageId','MessageSid','notifications','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','list','Contacts','CmContact','contact','WhatsappInteraction','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','UserId','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','twilio','set','Content-Type','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','DESC','out','Messages','dataValues','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','count','apply','reject','save','update','destroy','WhatsappAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','WhatsappAccount','includeAll','include','rows','params','find','create','body','user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Disposition','getDispositions','findOne','nolimit','pick','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','findAll','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications'];(function(_0x22c4d7,_0xeb8a06){var _0x5c87ba=function(_0x436e95){while(--_0x436e95){_0x22c4d7['push'](_0x22c4d7['shift']());}};_0x5c87ba(++_0xeb8a06);}(_0xfe7c,0x1b1));var _0xcfe7=function(_0x5340b7,_0x4e97d6){_0x5340b7=_0x5340b7-0x0;var _0x4fd38b=_0xfe7c[_0x5340b7];return _0x4fd38b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcfe7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcfe7('0x1'));var rp=require(_0xcfe7('0x2'));var moment=require('moment');var BPromise=require(_0xcfe7('0x3'));var Mustache=require('mustache');var util=require(_0xcfe7('0x4'));var path=require(_0xcfe7('0x5'));var sox=require(_0xcfe7('0x6'));var csv=require('to-csv');var ejs=require(_0xcfe7('0x7'));var fs=require('fs');var fs_extra=require(_0xcfe7('0x8'));var _=require(_0xcfe7('0x9'));var squel=require('squel');var crypto=require(_0xcfe7('0xa'));var jsforce=require(_0xcfe7('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xcfe7('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcfe7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcfe7('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcfe7('0xf'));var utils=require(_0xcfe7('0x10'));var config=require(_0xcfe7('0x11'));var licenseUtil=require(_0xcfe7('0x12'));var db=require('../../mysqldb')['db'];config[_0xcfe7('0x13')]=_[_0xcfe7('0x14')](config[_0xcfe7('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0xcfe7('0x15'))(new Redis(config['redis']));require(_0xcfe7('0x16'))[_0xcfe7('0x17')](socket);var jayson=require(_0xcfe7('0x18'));var client=jayson[_0xcfe7('0x19')][_0xcfe7('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x30e58c,_0x49b429,_0x5b2694,_0x42dde9){return new BPromise(function(_0x166e60,_0xdb24c2){var _0x149f84=_0x42dde9||client;return _0x149f84[_0xcfe7('0x1b')](_0x30e58c,_0x5b2694)[_0xcfe7('0x1c')](function(_0x581372){logger['info'](_0xcfe7('0x1d'),_0x49b429,'request\x20sent');logger[_0xcfe7('0x1e')](_0xcfe7('0x1f'),_0x49b429,'request\x20sent',JSON[_0xcfe7('0x20')](_0x581372));if(_0x581372[_0xcfe7('0x21')]){if(_0x581372[_0xcfe7('0x21')][_0xcfe7('0x22')]===0x1f4){logger[_0xcfe7('0x21')](_0xcfe7('0x1d'),_0x49b429,_0x581372[_0xcfe7('0x21')]['message']);return _0xdb24c2(_0x581372[_0xcfe7('0x21')]['message']);}logger['error'](_0xcfe7('0x1d'),_0x49b429,_0x581372[_0xcfe7('0x21')][_0xcfe7('0x23')]);return _0x166e60(_0x581372['error'][_0xcfe7('0x23')]);}else{logger['info'](_0xcfe7('0x1d'),_0x49b429,'request\x20sent');_0x166e60(_0x581372[_0xcfe7('0x24')][_0xcfe7('0x23')]);}})[_0xcfe7('0x25')](function(_0xcc5818){logger['error'](_0xcfe7('0x1d'),_0x49b429,_0xcc5818);_0xdb24c2(_0xcc5818);});});}function respondWithStatusCode(_0x145f68,_0x3710d2){_0x3710d2=_0x3710d2||0xcc;return function(_0x5df70d){if(_0x5df70d){return _0x145f68[_0xcfe7('0x26')](_0x3710d2);}return _0x145f68[_0xcfe7('0x27')](_0x3710d2)[_0xcfe7('0x28')]();};}function respondWithResult(_0x5ad911,_0xb12a69){_0xb12a69=_0xb12a69||0xc8;return function(_0x412d78){if(_0x412d78){return _0x5ad911[_0xcfe7('0x27')](_0xb12a69)[_0xcfe7('0x29')](_0x412d78);}};}function respondWithFilteredResult(_0x133f38,_0x48131e){return function(_0x1371e8){if(_0x1371e8){var _0x5e9236=typeof _0x48131e[_0xcfe7('0x2a')]==='undefined'&&typeof _0x48131e[_0xcfe7('0x2b')]==='undefined';var _0x179a74=_0x1371e8[_0xcfe7('0x2c')];var _0x370b54=_0x5e9236?0x0:_0x48131e['offset'];var _0x531074=_0x5e9236?_0x1371e8[_0xcfe7('0x2c')]:_0x48131e['offset']+_0x48131e[_0xcfe7('0x2b')];var _0x15abca;if(_0x531074>=_0x179a74){_0x531074=_0x179a74;_0x15abca=0xc8;}else{_0x15abca=0xce;}_0x133f38['status'](_0x15abca);return _0x133f38['set']('Content-Range',_0x370b54+'-'+_0x531074+'/'+_0x179a74)['json'](_0x1371e8);}return null;};}function patchUpdates(_0x1cee4b){return function(_0x1a4784){try{jsonpatch[_0xcfe7('0x2d')](_0x1a4784,_0x1cee4b,!![]);}catch(_0x8ae018){return BPromise[_0xcfe7('0x2e')](_0x8ae018);}return _0x1a4784[_0xcfe7('0x2f')]();};}function saveUpdates(_0x4577af,_0x59249e){return function(_0x16137f){if(_0x16137f){return _0x16137f[_0xcfe7('0x30')](_0x4577af)['then'](function(_0x10df81){return _0x10df81;});}return null;};}function removeEntity(_0xc5087,_0x38d647){return function(_0x5cbfd6){if(_0x5cbfd6){return _0x5cbfd6[_0xcfe7('0x31')]()[_0xcfe7('0x1c')](function(){var _0x3eda83=_0x5cbfd6['get']({'plain':!![]});var _0x34f3a9=_0xcfe7('0x32');return db[_0xcfe7('0x33')][_0xcfe7('0x31')]({'where':{'type':_0x34f3a9,'resourceId':_0x3eda83['id']}})['then'](function(){return _0x5cbfd6;});})[_0xcfe7('0x1c')](function(){_0xc5087[_0xcfe7('0x27')](0xcc)[_0xcfe7('0x28')]();});}};}function handleEntityNotFound(_0x775ff1,_0x11eb09){return function(_0x4cffc3){if(!_0x4cffc3){_0x775ff1[_0xcfe7('0x26')](0x194);}return _0x4cffc3;};}function handleError(_0x377b79,_0x5b7442){_0x5b7442=_0x5b7442||0x1f4;return function(_0x259950){logger[_0xcfe7('0x21')](_0x259950[_0xcfe7('0x34')]);if(_0x259950['name']){delete _0x259950['name'];}_0x377b79[_0xcfe7('0x27')](_0x5b7442)[_0xcfe7('0x35')](_0x259950);};}exports[_0xcfe7('0x36')]=function(_0x966ab4,_0x3aceb8){var _0x19e84c={'include':[{'model':db[_0xcfe7('0x37')],'as':_0xcfe7('0x38')}]},_0x26e871={},_0x5ac1a5={'count':0x0,'rows':[]};var _0x1a1a8b=_[_0xcfe7('0x39')](db['WhatsappAccount'][_0xcfe7('0x3a')],function(_0x11c183){return{'name':_0x11c183[_0xcfe7('0x3b')],'type':_0x11c183[_0xcfe7('0x3c')]['key']};});_0x26e871[_0xcfe7('0x3d')]=_['map'](_0x1a1a8b,_0xcfe7('0x3e'));_0x26e871[_0xcfe7('0x3f')]=_[_0xcfe7('0x40')](_0x966ab4[_0xcfe7('0x3f')]);_0x26e871[_0xcfe7('0x41')]=_[_0xcfe7('0x42')](_0x26e871[_0xcfe7('0x3d')],_0x26e871[_0xcfe7('0x3f')]);_0x19e84c[_0xcfe7('0x43')]=_[_0xcfe7('0x42')](_0x26e871[_0xcfe7('0x3d')],qs['fields'](_0x966ab4[_0xcfe7('0x3f')][_0xcfe7('0x44')]));_0x19e84c['attributes']=_0x19e84c[_0xcfe7('0x43')][_0xcfe7('0x45')]?_0x19e84c['attributes']:_0x26e871[_0xcfe7('0x3d')];if(!_0x966ab4[_0xcfe7('0x3f')][_0xcfe7('0x46')]('nolimit')){_0x19e84c[_0xcfe7('0x2b')]=qs[_0xcfe7('0x2b')](_0x966ab4[_0xcfe7('0x3f')][_0xcfe7('0x2b')]);_0x19e84c[_0xcfe7('0x2a')]=qs[_0xcfe7('0x2a')](_0x966ab4[_0xcfe7('0x3f')][_0xcfe7('0x2a')]);}_0x19e84c[_0xcfe7('0x47')]=qs[_0xcfe7('0x48')](_0x966ab4['query'][_0xcfe7('0x48')]);_0x19e84c['where']=qs[_0xcfe7('0x41')](_['pick'](_0x966ab4[_0xcfe7('0x3f')],_0x26e871['filters']),_0x1a1a8b);if(_0x966ab4['query']['filter']){_0x19e84c[_0xcfe7('0x49')]=_[_0xcfe7('0x4a')](_0x19e84c[_0xcfe7('0x49')],{'$or':_[_0xcfe7('0x39')](_0x1a1a8b,function(_0x14e259){if(_0x14e259[_0xcfe7('0x3c')]!==_0xcfe7('0x4b')){var _0x5290dd={};_0x5290dd[_0x14e259['name']]={'$like':'%'+_0x966ab4[_0xcfe7('0x3f')][_0xcfe7('0x4c')]+'%'};return _0x5290dd;}})});}_0x19e84c=_[_0xcfe7('0x4a')]({},_0x19e84c,_0x966ab4[_0xcfe7('0x4d')]);var _0x91a720={'where':_0x19e84c['where']};return db[_0xcfe7('0x4e')][_0xcfe7('0x2c')](_0x91a720)[_0xcfe7('0x1c')](function(_0x3d4e79){_0x5ac1a5[_0xcfe7('0x2c')]=_0x3d4e79;if(_0x966ab4[_0xcfe7('0x3f')][_0xcfe7('0x4f')]){_0x19e84c[_0xcfe7('0x50')]=[{'all':!![]}];}return db[_0xcfe7('0x4e')]['findAll'](_0x19e84c);})[_0xcfe7('0x1c')](function(_0x5eb501){_0x5ac1a5[_0xcfe7('0x51')]=_0x5eb501;return _0x5ac1a5;})[_0xcfe7('0x1c')](respondWithFilteredResult(_0x3aceb8,_0x19e84c))[_0xcfe7('0x25')](handleError(_0x3aceb8,null));};exports['show']=function(_0x153f49,_0x410ab3){var _0x55158a={'raw':![],'where':{'id':_0x153f49[_0xcfe7('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xcfe7('0x38')}]},_0xb89f1={};_0xb89f1['model']=_[_0xcfe7('0x40')](db[_0xcfe7('0x4e')][_0xcfe7('0x3a')]);_0xb89f1['query']=_['keys'](_0x153f49[_0xcfe7('0x3f')]);_0xb89f1['filters']=_['intersection'](_0xb89f1[_0xcfe7('0x3d')],_0xb89f1[_0xcfe7('0x3f')]);_0x55158a[_0xcfe7('0x43')]=_[_0xcfe7('0x42')](_0xb89f1[_0xcfe7('0x3d')],qs[_0xcfe7('0x44')](_0x153f49[_0xcfe7('0x3f')]['fields']));_0x55158a['attributes']=_0x55158a['attributes'][_0xcfe7('0x45')]?_0x55158a[_0xcfe7('0x43')]:_0xb89f1[_0xcfe7('0x3d')];if(_0x153f49[_0xcfe7('0x3f')][_0xcfe7('0x4f')]){_0x55158a[_0xcfe7('0x50')]=[{'all':!![]}];}_0x55158a=_[_0xcfe7('0x4a')]({},_0x55158a,_0x153f49[_0xcfe7('0x4d')]);return db[_0xcfe7('0x4e')][_0xcfe7('0x53')](_0x55158a)[_0xcfe7('0x1c')](handleEntityNotFound(_0x410ab3,null))[_0xcfe7('0x1c')](respondWithResult(_0x410ab3,null))[_0xcfe7('0x25')](handleError(_0x410ab3,null));};exports[_0xcfe7('0x54')]=function(_0x55eb52,_0x4b159d){return db[_0xcfe7('0x4e')][_0xcfe7('0x54')](_0x55eb52[_0xcfe7('0x55')],{})['then'](function(_0x21f27c){var _0x1bf972=_0x55eb52[_0xcfe7('0x56')]['get']({'plain':!![]});if(!_0x1bf972)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bf972[_0xcfe7('0x57')]==='user'){var _0xefa75e=_0x21f27c[_0xcfe7('0x58')]({'plain':!![]});var _0x216c03=_0xcfe7('0x32');return db[_0xcfe7('0x59')][_0xcfe7('0x53')]({'where':{'name':_0x216c03,'userProfileId':_0x1bf972['userProfileId']},'raw':!![]})[_0xcfe7('0x1c')](function(_0x2de3ac){if(_0x2de3ac&&_0x2de3ac[_0xcfe7('0x5a')]===0x0){return db[_0xcfe7('0x33')][_0xcfe7('0x54')]({'name':_0xefa75e[_0xcfe7('0x3e')],'resourceId':_0xefa75e['id'],'type':_0x2de3ac[_0xcfe7('0x3e')],'sectionId':_0x2de3ac['id']},{})[_0xcfe7('0x1c')](function(){return _0x21f27c;});}else{return _0x21f27c;}})[_0xcfe7('0x25')](function(_0x185e84){logger['error'](_0xcfe7('0x5b'),_0x185e84);throw _0x185e84;});}return _0x21f27c;})[_0xcfe7('0x1c')](respondWithResult(_0x4b159d,0xc9))['catch'](handleError(_0x4b159d,null));};exports['update']=function(_0x593b9b,_0x3b7a3c){if(_0x593b9b['body']['id']){delete _0x593b9b['body']['id'];}return db[_0xcfe7('0x4e')]['find']({'where':{'id':_0x593b9b[_0xcfe7('0x52')]['id']},'include':[{'model':db[_0xcfe7('0x37')],'as':'mandatoryDispositionPause'}]})[_0xcfe7('0x1c')](handleEntityNotFound(_0x3b7a3c,null))['then'](saveUpdates(_0x593b9b['body'],null))[_0xcfe7('0x1c')](respondWithResult(_0x3b7a3c,null))['catch'](handleError(_0x3b7a3c,null));};exports[_0xcfe7('0x31')]=function(_0x4b8ed4,_0x4433e9){return db['WhatsappAccount']['find']({'where':{'id':_0x4b8ed4['params']['id']}})['then'](handleEntityNotFound(_0x4433e9,null))['then'](removeEntity(_0x4433e9,null))[_0xcfe7('0x25')](handleError(_0x4433e9,null));};exports['describe']=function(_0x5b6316,_0x20c3b4){return db[_0xcfe7('0x4e')]['describe']()[_0xcfe7('0x1c')](respondWithResult(_0x20c3b4,null))[_0xcfe7('0x25')](handleError(_0x20c3b4,null));};exports['addDisposition']=function(_0x228dbd,_0x1cb794,_0x3547dc){if(_0x228dbd[_0xcfe7('0x55')]['id']){delete _0x228dbd[_0xcfe7('0x55')]['id'];}return db[_0xcfe7('0x4e')][_0xcfe7('0x53')]({'where':{'id':_0x228dbd[_0xcfe7('0x52')]['id']}})['then'](handleEntityNotFound(_0x1cb794,null))[_0xcfe7('0x1c')](function(_0x3b4ad5){if(_0x3b4ad5){_0x228dbd[_0xcfe7('0x55')]['WhatsappAccountId']=_0x3b4ad5['id'];return db[_0xcfe7('0x5c')][_0xcfe7('0x54')](_0x228dbd['body']);}})['then'](respondWithResult(_0x1cb794,null))['catch'](handleError(_0x1cb794,null));};exports[_0xcfe7('0x5d')]=function(_0x29ab48,_0x40044d,_0x46fb92){var _0x53cc13={'raw':![],'where':{}};var _0x320961={};var _0x1d28b3={'count':0x0,'rows':[]};return db[_0xcfe7('0x4e')][_0xcfe7('0x5e')]({'where':{'id':_0x29ab48[_0xcfe7('0x52')]['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x40044d,null))['then'](function(_0xb67a34){if(_0xb67a34){_0x320961[_0xcfe7('0x3d')]=_[_0xcfe7('0x40')](db['Disposition']['rawAttributes']);_0x320961[_0xcfe7('0x3f')]=_[_0xcfe7('0x40')](_0x29ab48[_0xcfe7('0x3f')]);_0x320961['filters']=_[_0xcfe7('0x42')](_0x320961[_0xcfe7('0x3d')],_0x320961[_0xcfe7('0x3f')]);_0x53cc13[_0xcfe7('0x43')]=_['intersection'](_0x320961[_0xcfe7('0x3d')],qs[_0xcfe7('0x44')](_0x29ab48[_0xcfe7('0x3f')]['fields']));_0x53cc13['attributes']=_0x53cc13[_0xcfe7('0x43')][_0xcfe7('0x45')]?_0x53cc13[_0xcfe7('0x43')]:_0x320961[_0xcfe7('0x3d')];if(!_0x29ab48['query'][_0xcfe7('0x46')](_0xcfe7('0x5f'))){_0x53cc13[_0xcfe7('0x2b')]=qs['limit'](_0x29ab48[_0xcfe7('0x3f')][_0xcfe7('0x2b')]);_0x53cc13['offset']=qs[_0xcfe7('0x2a')](_0x29ab48[_0xcfe7('0x3f')][_0xcfe7('0x2a')]);}_0x53cc13[_0xcfe7('0x47')]=qs[_0xcfe7('0x48')](_0x29ab48[_0xcfe7('0x3f')][_0xcfe7('0x48')]);_0x53cc13[_0xcfe7('0x49')]=qs[_0xcfe7('0x41')](_[_0xcfe7('0x60')](_0x29ab48['query'],_0x320961[_0xcfe7('0x41')]));_0x53cc13[_0xcfe7('0x49')][_0xcfe7('0x61')]=_0xb67a34['id'];if(_0x29ab48[_0xcfe7('0x3f')][_0xcfe7('0x4c')]){_0x53cc13[_0xcfe7('0x49')]=_['merge'](_0x53cc13[_0xcfe7('0x49')],{'$or':_['map'](_0x53cc13[_0xcfe7('0x43')],function(_0x432290){var _0x1d0cf7={};_0x1d0cf7[_0x432290]={'$like':'%'+_0x29ab48[_0xcfe7('0x3f')]['filter']+'%'};return _0x1d0cf7;})});}_0x53cc13=_[_0xcfe7('0x4a')]({},_0x53cc13,_0x29ab48[_0xcfe7('0x4d')]);return db[_0xcfe7('0x5c')]['count']({'where':_0x53cc13['where']})[_0xcfe7('0x1c')](function(_0x42f503){_0x1d28b3['count']=_0x42f503;if(_0x29ab48['query'][_0xcfe7('0x4f')]){_0x53cc13[_0xcfe7('0x50')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x53cc13);})[_0xcfe7('0x1c')](function(_0x55683a){_0x1d28b3['rows']=_0x55683a;return _0x1d28b3;});}})['then'](respondWithFilteredResult(_0x40044d,_0x53cc13))[_0xcfe7('0x25')](handleError(_0x40044d,null));};exports['removeDispositions']=function(_0x11c9ee,_0x44141e,_0x5a8946){return db['WhatsappAccount']['find']({'where':{'id':_0x11c9ee['params']['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x44141e,null))['then'](function(_0x30c62b){if(_0x30c62b){return _0x30c62b[_0xcfe7('0x62')](_0x11c9ee[_0xcfe7('0x3f')][_0xcfe7('0x63')]);}})[_0xcfe7('0x1c')](respondWithStatusCode(_0x44141e,null))[_0xcfe7('0x25')](handleError(_0x44141e,null));};exports[_0xcfe7('0x64')]=function(_0x36800b,_0x39c3fc,_0x2a0071){if(_0x36800b[_0xcfe7('0x55')]['id']){delete _0x36800b['body']['id'];}return db[_0xcfe7('0x4e')]['find']({'where':{'id':_0x36800b[_0xcfe7('0x52')]['id']}})['then'](handleEntityNotFound(_0x39c3fc,null))[_0xcfe7('0x1c')](function(_0x3bc4d6){if(_0x3bc4d6){_0x36800b[_0xcfe7('0x55')][_0xcfe7('0x61')]=_0x3bc4d6['id'];return db[_0xcfe7('0x65')][_0xcfe7('0x54')](_0x36800b[_0xcfe7('0x55')]);}})[_0xcfe7('0x1c')](respondWithResult(_0x39c3fc,null))[_0xcfe7('0x25')](handleError(_0x39c3fc,null));};exports['getAnswers']=function(_0x20d915,_0x1d4141,_0x123f5f){var _0x1b51dc={'raw':![],'where':{}};var _0x4d7309={};var _0x1449e3={'count':0x0,'rows':[]};return db[_0xcfe7('0x4e')][_0xcfe7('0x5e')]({'where':{'id':_0x20d915['params']['id']}})['then'](handleEntityNotFound(_0x1d4141,null))[_0xcfe7('0x1c')](function(_0x10f85a){if(_0x10f85a){_0x4d7309[_0xcfe7('0x3d')]=_[_0xcfe7('0x40')](db[_0xcfe7('0x65')]['rawAttributes']);_0x4d7309['query']=_[_0xcfe7('0x40')](_0x20d915[_0xcfe7('0x3f')]);_0x4d7309[_0xcfe7('0x41')]=_[_0xcfe7('0x42')](_0x4d7309[_0xcfe7('0x3d')],_0x4d7309[_0xcfe7('0x3f')]);_0x1b51dc[_0xcfe7('0x43')]=_['intersection'](_0x4d7309[_0xcfe7('0x3d')],qs[_0xcfe7('0x44')](_0x20d915[_0xcfe7('0x3f')]['fields']));_0x1b51dc['attributes']=_0x1b51dc[_0xcfe7('0x43')][_0xcfe7('0x45')]?_0x1b51dc[_0xcfe7('0x43')]:_0x4d7309['model'];if(!_0x20d915['query'][_0xcfe7('0x46')](_0xcfe7('0x5f'))){_0x1b51dc[_0xcfe7('0x2b')]=qs['limit'](_0x20d915[_0xcfe7('0x3f')]['limit']);_0x1b51dc[_0xcfe7('0x2a')]=qs['offset'](_0x20d915[_0xcfe7('0x3f')][_0xcfe7('0x2a')]);}_0x1b51dc['order']=qs[_0xcfe7('0x48')](_0x20d915['query'][_0xcfe7('0x48')]);_0x1b51dc[_0xcfe7('0x49')]=qs[_0xcfe7('0x41')](_[_0xcfe7('0x60')](_0x20d915[_0xcfe7('0x3f')],_0x4d7309['filters']));_0x1b51dc[_0xcfe7('0x49')][_0xcfe7('0x61')]=_0x10f85a['id'];if(_0x20d915[_0xcfe7('0x3f')][_0xcfe7('0x4c')]){_0x1b51dc[_0xcfe7('0x49')]=_[_0xcfe7('0x4a')](_0x1b51dc[_0xcfe7('0x49')],{'$or':_[_0xcfe7('0x39')](_0x1b51dc['attributes'],function(_0x38b70d){var _0xaa74ff={};_0xaa74ff[_0x38b70d]={'$like':'%'+_0x20d915['query'][_0xcfe7('0x4c')]+'%'};return _0xaa74ff;})});}_0x1b51dc=_[_0xcfe7('0x4a')]({},_0x1b51dc,_0x20d915['options']);return db[_0xcfe7('0x65')][_0xcfe7('0x2c')]({'where':_0x1b51dc['where']})[_0xcfe7('0x1c')](function(_0x1cfa42){_0x1449e3[_0xcfe7('0x2c')]=_0x1cfa42;if(_0x20d915[_0xcfe7('0x3f')]['includeAll']){_0x1b51dc[_0xcfe7('0x50')]=[{'all':!![]}];}return db[_0xcfe7('0x65')][_0xcfe7('0x66')](_0x1b51dc);})[_0xcfe7('0x1c')](function(_0x126d91){_0x1449e3[_0xcfe7('0x51')]=_0x126d91;return _0x1449e3;});}})['then'](respondWithFilteredResult(_0x1d4141,_0x1b51dc))[_0xcfe7('0x25')](handleError(_0x1d4141,null));};exports[_0xcfe7('0x67')]=function(_0x468eba,_0x203dbe,_0x37525c){return db[_0xcfe7('0x4e')][_0xcfe7('0x53')]({'where':{'id':_0x468eba[_0xcfe7('0x52')]['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x203dbe,null))[_0xcfe7('0x1c')](function(_0x31721d){if(_0x31721d){return _0x31721d[_0xcfe7('0x67')](_0x468eba[_0xcfe7('0x3f')][_0xcfe7('0x63')]);}})['then'](respondWithStatusCode(_0x203dbe,null))[_0xcfe7('0x25')](handleError(_0x203dbe,null));};exports[_0xcfe7('0x68')]=function(_0xecdc31,_0x1a3021,_0x438d25){return db[_0xcfe7('0x4e')]['find']({'where':{'id':_0xecdc31['params']['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x1a3021,null))[_0xcfe7('0x1c')](function(_0x326107){if(_0x326107){return _0x326107[_0xcfe7('0x68')](_0xecdc31[_0xcfe7('0x55')][_0xcfe7('0x63')],_[_0xcfe7('0x69')](_0xecdc31[_0xcfe7('0x55')],[_0xcfe7('0x63'),'id'])||{})[_0xcfe7('0x6a')](function(_0x353191){for(var _0x9f5668=0x0;_0x9f5668<_0xecdc31[_0xcfe7('0x55')][_0xcfe7('0x63')]['length'];_0x9f5668+=0x1){socket[_0xcfe7('0x6b')](_0xcfe7('0x6c'),{'UserId':Number(_0xecdc31[_0xcfe7('0x55')][_0xcfe7('0x63')][_0x9f5668]),'WhatsappAccountId':Number(_0xecdc31[_0xcfe7('0x52')]['id'])});}return _0x353191;});}})[_0xcfe7('0x1c')](respondWithResult(_0x1a3021,null))[_0xcfe7('0x25')](handleError(_0x1a3021,null));};exports[_0xcfe7('0x6d')]=function(_0x38db2c,_0x25a7f8,_0x2883a7){return db[_0xcfe7('0x4e')][_0xcfe7('0x53')]({'where':{'id':_0x38db2c['params']['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x25a7f8,null))[_0xcfe7('0x1c')](function(_0x5992e9){if(_0x5992e9){return _0x5992e9[_0xcfe7('0x6d')](_0x38db2c['query']['ids'])[_0xcfe7('0x1c')](function(){if(_[_0xcfe7('0x6e')](_0x38db2c[_0xcfe7('0x3f')][_0xcfe7('0x63')])){for(var _0x33170a=0x0;_0x33170a<_0x38db2c[_0xcfe7('0x3f')][_0xcfe7('0x63')][_0xcfe7('0x45')];_0x33170a+=0x1){socket['emit'](_0xcfe7('0x6f'),{'UserId':Number(_0x38db2c['query'][_0xcfe7('0x63')][_0x33170a]),'WhatsappAccountId':Number(_0x38db2c[_0xcfe7('0x52')]['id'])});}}else{socket[_0xcfe7('0x6b')]('userWhatsappAccount:remove',{'UserId':Number(_0x38db2c['query'][_0xcfe7('0x63')]),'WhatsappAccountId':Number(_0x38db2c[_0xcfe7('0x52')]['id'])});}});}})[_0xcfe7('0x1c')](respondWithStatusCode(_0x25a7f8,null))[_0xcfe7('0x25')](handleError(_0x25a7f8,null));};exports[_0xcfe7('0x70')]=function(_0x35ccc1,_0xdb067e,_0x33a360){var _0x4b37dd={};var _0x6fae84={};var _0x58ea82;var _0x594d50;return db[_0xcfe7('0x4e')][_0xcfe7('0x5e')]({'where':{'id':_0x35ccc1[_0xcfe7('0x52')]['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0xdb067e,null))[_0xcfe7('0x1c')](function(_0x5c714d){if(_0x5c714d){_0x58ea82=_0x5c714d;_0x6fae84[_0xcfe7('0x3d')]=_[_0xcfe7('0x40')](db[_0xcfe7('0x71')][_0xcfe7('0x3a')]);_0x6fae84[_0xcfe7('0x3f')]=_[_0xcfe7('0x40')](_0x35ccc1[_0xcfe7('0x3f')]);_0x6fae84['filters']=_['intersection'](_0x6fae84[_0xcfe7('0x3d')],_0x6fae84[_0xcfe7('0x3f')]);_0x4b37dd[_0xcfe7('0x43')]=_[_0xcfe7('0x42')](_0x6fae84[_0xcfe7('0x3d')],qs[_0xcfe7('0x44')](_0x35ccc1[_0xcfe7('0x3f')]['fields']));_0x4b37dd[_0xcfe7('0x43')]=_0x4b37dd[_0xcfe7('0x43')][_0xcfe7('0x45')]?_0x4b37dd[_0xcfe7('0x43')]:_0x6fae84['model'];_0x4b37dd[_0xcfe7('0x47')]=qs['sort'](_0x35ccc1[_0xcfe7('0x3f')][_0xcfe7('0x48')]);_0x4b37dd[_0xcfe7('0x49')]=qs['filters'](_[_0xcfe7('0x60')](_0x35ccc1[_0xcfe7('0x3f')],_0x6fae84[_0xcfe7('0x41')]));if(_0x35ccc1[_0xcfe7('0x3f')][_0xcfe7('0x4c')]){_0x4b37dd[_0xcfe7('0x49')]=_[_0xcfe7('0x4a')](_0x4b37dd['where'],{'$or':_['map'](_0x4b37dd[_0xcfe7('0x43')],function(_0x303a4e){var _0x5921f4={};_0x5921f4[_0x303a4e]={'$like':'%'+_0x35ccc1[_0xcfe7('0x3f')][_0xcfe7('0x4c')]+'%'};return _0x5921f4;})});}_0x4b37dd=_['merge']({},_0x4b37dd,_0x35ccc1[_0xcfe7('0x4d')]);return _0x58ea82[_0xcfe7('0x70')](_0x4b37dd);}})['then'](function(_0x5e7b62){if(_0x5e7b62){_0x594d50=_0x5e7b62[_0xcfe7('0x45')];if(!_0x35ccc1['query'][_0xcfe7('0x46')](_0xcfe7('0x5f'))){_0x4b37dd[_0xcfe7('0x2b')]=qs[_0xcfe7('0x2b')](_0x35ccc1[_0xcfe7('0x3f')][_0xcfe7('0x2b')]);_0x4b37dd[_0xcfe7('0x2a')]=qs[_0xcfe7('0x2a')](_0x35ccc1['query'][_0xcfe7('0x2a')]);}return _0x58ea82[_0xcfe7('0x70')](_0x4b37dd);}})[_0xcfe7('0x1c')](function(_0x5b2ead){if(_0x5b2ead){return _0x5b2ead?{'count':_0x594d50,'rows':_0x5b2ead}:null;}})['then'](respondWithResult(_0xdb067e,null))[_0xcfe7('0x25')](handleError(_0xdb067e,null));};exports[_0xcfe7('0x72')]=function(_0xe99c3d,_0x57ad99){var _0x2ec378=_0xe99c3d[_0xcfe7('0x52')]['id'];var _0x64721a=_0xe99c3d['body'];var _0x1562ca=0xc8;var _0x314a61=null;return db['sequelize'][_0xcfe7('0x73')]({'isolationLevel':db[_0xcfe7('0x74')][_0xcfe7('0x75')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x399ec0){return db[_0xcfe7('0x4e')][_0xcfe7('0x5e')]({'where':{'id':_0x2ec378},'transaction':_0x399ec0})[_0xcfe7('0x1c')](function(_0x43757a){if(_0x43757a){return db['WhatsappApplication'][_0xcfe7('0x31')]({'where':{'WhatsappAccountId':_0x2ec378},'transaction':_0x399ec0})[_0xcfe7('0x1c')](function(){var _0x312a6e=_[_0xcfe7('0x39')](_0x64721a,function(_0x3206b2){_0x3206b2['WhatsappAccountId']=_0x2ec378;return _0x3206b2;});return db[_0xcfe7('0x76')][_0xcfe7('0x77')](_0x312a6e,{'transaction':_0x399ec0});});}else{_0x1562ca=0x194;_0x314a61=[];}});})[_0xcfe7('0x1c')](function(){if(_0x1562ca!==0x194){return db['WhatsappApplication'][_0xcfe7('0x78')]({'where':{'WhatsappAccountId':_0x2ec378},'order':_0xcfe7('0x79')})[_0xcfe7('0x1c')](function(_0xc9a738){_0x314a61=_0xc9a738;});}})['catch'](function(_0x1609cb){_0x1562ca=0x1f4;logger[_0xcfe7('0x21')](_0x1609cb[_0xcfe7('0x34')]);if(_0x1609cb[_0xcfe7('0x3e')]){delete _0x1609cb[_0xcfe7('0x3e')];}_0x314a61=_0x1609cb;})['finally'](function(){if(_0x314a61===null){_0x57ad99[_0xcfe7('0x26')](_0x1562ca);}else{if(_0x1562ca===0x1f4){_0x57ad99[_0xcfe7('0x27')](_0x1562ca)[_0xcfe7('0x35')](_0x314a61);}else{_0x57ad99['status'](_0x1562ca)[_0xcfe7('0x29')](_0x314a61);}}});};exports['getApplications']=function(_0x5c98c4,_0x18cd09,_0x3bdb07){var _0x814d64={};var _0x7893bc={};var _0x2416a4;var _0x3c0fbd;return db[_0xcfe7('0x4e')]['findOne']({'where':{'id':_0x5c98c4['params']['id']}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x18cd09,null))['then'](function(_0x3cf757){if(_0x3cf757){_0x2416a4=_0x3cf757;_0x7893bc[_0xcfe7('0x3d')]=_[_0xcfe7('0x40')](db['WhatsappApplication'][_0xcfe7('0x3a')]);_0x7893bc['query']=_['keys'](_0x5c98c4['query']);_0x7893bc[_0xcfe7('0x41')]=_[_0xcfe7('0x42')](_0x7893bc[_0xcfe7('0x3d')],_0x7893bc[_0xcfe7('0x3f')]);_0x814d64[_0xcfe7('0x43')]=_[_0xcfe7('0x42')](_0x7893bc[_0xcfe7('0x3d')],qs[_0xcfe7('0x44')](_0x5c98c4[_0xcfe7('0x3f')][_0xcfe7('0x44')]));_0x814d64['attributes']=_0x814d64[_0xcfe7('0x43')]['length']?_0x814d64[_0xcfe7('0x43')]:_0x7893bc[_0xcfe7('0x3d')];_0x814d64[_0xcfe7('0x47')]=qs[_0xcfe7('0x48')](_0x5c98c4['query'][_0xcfe7('0x48')]);_0x814d64['where']=qs[_0xcfe7('0x41')](_['pick'](_0x5c98c4[_0xcfe7('0x3f')],_0x7893bc['filters']));if(_0x5c98c4['query'][_0xcfe7('0x4c')]){_0x814d64[_0xcfe7('0x49')]=_[_0xcfe7('0x4a')](_0x814d64[_0xcfe7('0x49')],{'$or':_['map'](_0x814d64[_0xcfe7('0x43')],function(_0x184def){var _0x34b2f0={};_0x34b2f0[_0x184def]={'$like':'%'+_0x5c98c4['query']['filter']+'%'};return _0x34b2f0;})});}_0x814d64=_[_0xcfe7('0x4a')]({},_0x814d64,_0x5c98c4['options']);return _0x2416a4[_0xcfe7('0x7a')](_0x814d64);}})[_0xcfe7('0x1c')](function(_0x418e86){if(_0x418e86){_0x3c0fbd=_0x418e86[_0xcfe7('0x45')];if(!_0x5c98c4[_0xcfe7('0x3f')][_0xcfe7('0x46')](_0xcfe7('0x5f'))){_0x814d64[_0xcfe7('0x2b')]=qs[_0xcfe7('0x2b')](_0x5c98c4['query'][_0xcfe7('0x2b')]);_0x814d64['offset']=qs[_0xcfe7('0x2a')](_0x5c98c4[_0xcfe7('0x3f')][_0xcfe7('0x2a')]);}return _0x2416a4[_0xcfe7('0x7a')](_0x814d64);}})[_0xcfe7('0x1c')](function(_0x540540){if(_0x540540){return _0x540540?{'count':_0x3c0fbd,'rows':_0x540540}:null;}})[_0xcfe7('0x1c')](respondWithResult(_0x18cd09,null))[_0xcfe7('0x25')](handleError(_0x18cd09,null));};exports[_0xcfe7('0x7b')]=function(_0x1d96c5,_0x339311,_0x45a678){var _0xe64ccf={'channel':'whatsapp'};var _0x3499b4=[];var _0x1bdce4=[];var _0x5523a7={};return db['WhatsappAccount'][_0xcfe7('0x53')]({'where':{'id':_0x1d96c5['params']['id']},'include':[{'model':db[_0xcfe7('0x76')],'as':_0xcfe7('0x7c')}]})['then'](handleEntityNotFound(_0x339311,null))[_0xcfe7('0x1c')](function(_0x26762d){_0xe64ccf[_0xcfe7('0x7d')]=_0x26762d;if(_0xe64ccf['account']&&_0xe64ccf['account'][_0xcfe7('0x3c')]==='sinch'&&_0x1d96c5[_0xcfe7('0x55')]['statuses']){if(_0x1d96c5['body'][_0xcfe7('0x7e')]['length']===0x0)return;if(_0x1d96c5[_0xcfe7('0x55')]['statuses'][0x0][_0xcfe7('0x7f')]!==_0xcfe7('0x80'))return;return db[_0xcfe7('0x81')][_0xcfe7('0x30')]({'read':!![],'readAt':_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x7e')][0x0][_0xcfe7('0x82')]},{'where':{'messageId':_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x7e')][0x0][_0xcfe7('0x83')]},'individualHooks':!![]})[_0xcfe7('0x1c')](function(_0x499624){return _0x339311[_0xcfe7('0x27')](0xc8)[_0xcfe7('0x29')](_0x499624);});}_0xe64ccf[_0xcfe7('0x84')]=_[_0xcfe7('0x85')](_0x26762d[_0xcfe7('0x7c')],[_0xcfe7('0x79')],[_0xcfe7('0x86')]);if(_0xe64ccf[_0xcfe7('0x7d')][_0xcfe7('0x7c')]){delete _0xe64ccf[_0xcfe7('0x7d')]['Applications'];}return db['CmContact'][_0xcfe7('0x87')]()['then'](function(_0x5356b9){if(!_0x5356b9){throw new db[(_0xcfe7('0x88'))][(_0xcfe7('0x89'))](_0xcfe7('0x8a'));}_0x3499b4=_[_0xcfe7('0x8b')](_[_0xcfe7('0x40')](_0x5356b9),[_0xcfe7('0x8c'),_0xcfe7('0x8d')]);_0x1bdce4=_[_0xcfe7('0x8b')](_['keys'](_0x5356b9),[_0xcfe7('0x8c'),_0xcfe7('0x8d'),_0xcfe7('0x8e'),_0xcfe7('0x8f')]);_0xe64ccf[_0xcfe7('0x55')]={'mapKey':'mobile'};if(_0xe64ccf['account']&&_0xe64ccf['account'][_0xcfe7('0x3c')]==='twilio'){_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x90')]=_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x91')][_0xcfe7('0x92')]('whatsapp:','');_0xe64ccf['body'][_0xcfe7('0x55')]=_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x93')];_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x94')]=_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x95')];}if(_0xe64ccf[_0xcfe7('0x7d')]&&_0xe64ccf['account'][_0xcfe7('0x3c')]==='sinch'){_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x90')]=_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x96')][0x0]['from'];_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x55')]=_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x96')][0x0][_0xcfe7('0x23')][_0xcfe7('0x55')];_0xe64ccf[_0xcfe7('0x55')]['messageId']=_0x1d96c5[_0xcfe7('0x55')][_0xcfe7('0x96')][0x0][_0xcfe7('0x83')];}if(_0xe64ccf[_0xcfe7('0x55')]['id']){delete _0xe64ccf[_0xcfe7('0x55')]['id'];}if(_[_0xcfe7('0x97')](_0xe64ccf[_0xcfe7('0x55')]['from'])){throw new db[(_0xcfe7('0x88'))][(_0xcfe7('0x89'))]('from\x20is\x20mandatory');}if(_[_0xcfe7('0x97')](_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x55')])||_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x55')]===''){throw new db[(_0xcfe7('0x88'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xcfe7('0x97')](_0xe64ccf['body'][_0xcfe7('0x98')])){throw new db[(_0xcfe7('0x88'))]['ValidationError'](_0xcfe7('0x99')+_0x1bdce4);}if(!_[_0xcfe7('0x9a')](_0x1bdce4,_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x98')])){throw new db[(_0xcfe7('0x88'))][(_0xcfe7('0x89'))](_0xcfe7('0x9b')+_0x1bdce4);}_0x5523a7[_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x98')]]=_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x90')];return db[_0xcfe7('0x9c')][_0xcfe7('0x53')]({'where':{'id':_0xe64ccf[_0xcfe7('0x7d')][_0xcfe7('0x8f')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x5523a7,'limit':0x1,'order':[[_0xcfe7('0x8d'),'DESC']]}]});})[_0xcfe7('0x1c')](handleEntityNotFound(_0x339311,null))['then'](function(_0x548936){if(_0x548936){_0xe64ccf[_0xcfe7('0x9d')]=_[_0xcfe7('0x69')](_0x548936,[_0xcfe7('0x9e')]);if(_0x548936['Contacts'][_0xcfe7('0x45')]){return _0x548936[_0xcfe7('0x9e')][0x0];}var _0x17817c=_[_0xcfe7('0x14')](_0xe64ccf[_0xcfe7('0x55')],{'firstName':_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x90')],'ListId':_0x548936['id']});_0x17817c[_0xe64ccf['body'][_0xcfe7('0x98')]]=_0xe64ccf['body']['from'];return db[_0xcfe7('0x9f')]['create'](_0x17817c,{'fields':_0x3499b4,'raw':!![]});}})[_0xcfe7('0x1c')](handleEntityNotFound(_0x339311,null))[_0xcfe7('0x1c')](function(_0x1cacaf){if(_0x1cacaf){_0xe64ccf[_0xcfe7('0xa0')]=_0x1cacaf;var _0x38fb91={'ContactId':_0x1cacaf['id'],'phone':_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x90')],'WhatsappAccountId':_0x1d96c5[_0xcfe7('0x52')]['id']};var _0x15a875={'ContactId':_0x1cacaf['id'],'WhatsappAccountId':_0x1d96c5[_0xcfe7('0x52')]['id'],'closed':![]};return db[_0xcfe7('0xa1')][_0xcfe7('0x53')]({'where':_0x15a875})[_0xcfe7('0x1c')](function(_0x297064){if(_0x297064){return[_0x297064,![]];}return db[_0xcfe7('0xa1')][_0xcfe7('0x54')](_0x38fb91)[_0xcfe7('0x1c')](function(_0x362833){return[_0x362833,!![]];});});}})[_0xcfe7('0x6a')](function(_0x2afd3b,_0x3f6390){_0xe64ccf['interaction']=_0x2afd3b[_0xcfe7('0x58')]({'plain':!![]});_0xe64ccf[_0xcfe7('0xa2')][_0xcfe7('0xa3')]=![];if(_0x3f6390){if(_0xe64ccf['account']['autoclose']){_0xe64ccf[_0xcfe7('0x84')][_0xcfe7('0xa4')]({'id':0x0,'priority':_0xe64ccf['applications']['length']+0x1,'app':_0xcfe7('0xa5'),'appdata':_0xcfe7('0xa6'),'interval':_0xcfe7('0xa7')});}_0xe64ccf[_0xcfe7('0xa2')][_0xcfe7('0xa3')]=!![];}return db[_0xcfe7('0x81')][_0xcfe7('0x54')]({'phone':_0xe64ccf['body'][_0xcfe7('0x90')],'messageId':_0xe64ccf[_0xcfe7('0x55')][_0xcfe7('0x94')],'body':_0xe64ccf[_0xcfe7('0x55')]['body'],'WhatsappAccountId':_0x1d96c5['params']['id'],'WhatsappInteractionId':_0x2afd3b['id'],'direction':'in','ContactId':_0x2afd3b[_0xcfe7('0xa8')],'AttachmentId':_0xe64ccf['body']['AttachmentId']});})[_0xcfe7('0x1c')](function(_0x242483){_0xe64ccf[_0xcfe7('0x23')]=_0x242483;if(_0xe64ccf[_0xcfe7('0xa2')]['UserId']){return db[_0xcfe7('0x71')][_0xcfe7('0x53')]({'attributes':['id',_0xcfe7('0x3e')],'where':{'id':_0xe64ccf[_0xcfe7('0xa2')][_0xcfe7('0xa9')]}})['then'](function(_0x54eceb){if(_0x54eceb){_0xe64ccf['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x54eceb[_0xcfe7('0x3e')]+','+(_0xe64ccf[_0xcfe7('0x7d')][_0xcfe7('0xaa')]||0xa),'interval':_0xcfe7('0xa7')});}return respondWithRpcPromise(_0xcfe7('0xab'),_0xcfe7('0xac'),_0xe64ccf);});}return respondWithRpcPromise('Start',_0xcfe7('0xac'),_0xe64ccf);})[_0xcfe7('0x1c')](function(_0x528d18){if(_0x528d18){var _0x27489e=0xc8;var _0x59a62e=_0xcfe7('0xad');logger['info'](_0xcfe7('0x1f'),_0x59a62e,_0x27489e,_0xcfe7('0xae'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x59a62e,_0x27489e,_0xcfe7('0xae'),JSON[_0xcfe7('0x20')](_0x528d18));if(_0xe64ccf['account'][_0xcfe7('0x3c')]===_0xcfe7('0xaf')){return _0x339311[_0xcfe7('0x27')](_0x27489e)[_0xcfe7('0xb0')](_0xcfe7('0xb1'),'text/xml')[_0xcfe7('0x35')](_0xcfe7('0xb2'));}else{return _0x339311['status'](_0x27489e)[_0xcfe7('0x29')](_0x528d18);}}});})[_0xcfe7('0x25')](handleError(_0x339311,null));};exports[_0xcfe7('0x35')]=function(_0x33550b,_0xa5db4d,_0x45c30b){var _0x279b79,_0x597df4,_0x379ee3;if(_[_0xcfe7('0x97')](_0x33550b['body'][_0xcfe7('0x55')])||_0x33550b['body'][_0xcfe7('0x55')]===''){throw new db['Sequelize'][(_0xcfe7('0x89'))](_0xcfe7('0xb3'));}if(_[_0xcfe7('0x97')](_0x33550b[_0xcfe7('0x55')]['to'])){throw new db[(_0xcfe7('0x88'))][(_0xcfe7('0x89'))](_0xcfe7('0xb4'));}_0x279b79=_0x33550b[_0xcfe7('0x55')]['to'];return db[_0xcfe7('0x4e')]['find']({'where':{'id':_0x33550b[_0xcfe7('0x52')]['id']},'include':[{'model':db[_0xcfe7('0x9c')],'as':_0xcfe7('0xb5'),'include':[{'model':db['CmContact'],'as':_0xcfe7('0x9e'),'where':{'mobile':_0x279b79},'limit':0x1,'order':[[_0xcfe7('0x8d'),_0xcfe7('0xb6')]]}]}]})[_0xcfe7('0x1c')](handleEntityNotFound(_0xa5db4d,null))[_0xcfe7('0x1c')](function(_0x32d8e8){if(_0x32d8e8&&_0x32d8e8[_0xcfe7('0xb5')]){_0x597df4=_0x32d8e8[_0xcfe7('0x58')]({'plain':!![]});if(_0x597df4['List']&&_0x597df4[_0xcfe7('0xb5')][_0xcfe7('0x9e')]['length']){return _0x597df4['List'][_0xcfe7('0x9e')][0x0];}return db[_0xcfe7('0x9f')][_0xcfe7('0x54')](_[_0xcfe7('0x14')](_0x33550b[_0xcfe7('0x55')],{'firstName':_0x279b79,'mobile':_0x279b79,'phone':_0x279b79,'ListId':_0x597df4[_0xcfe7('0x8f')]}));}})[_0xcfe7('0x1c')](handleEntityNotFound(_0xa5db4d,null))[_0xcfe7('0x1c')](function(_0x340ba0){if(_0x340ba0){_0x379ee3=_0x340ba0;return db[_0xcfe7('0xa1')][_0xcfe7('0x53')]({'where':{'ContactId':_0x379ee3['id'],'closed':![],'WhatsappAccountId':_0x597df4['id']}})[_0xcfe7('0x1c')](function(_0x35d14b){if(_0x35d14b){return[_0x35d14b,![]];}return db[_0xcfe7('0xa1')][_0xcfe7('0x54')]({'UserId':_0x33550b[_0xcfe7('0x56')]['id'],'ContactId':_0x379ee3['id'],'WhatsappAccountId':_0x597df4['id'],'phone':_0x279b79,'firstMsgDirection':_0xcfe7('0xb7'),'Messages':[_[_0xcfe7('0x4a')](_0x33550b[_0xcfe7('0x55')],{'read':![],'body':_0x33550b[_0xcfe7('0x55')]['body'],'phone':_0x279b79,'WhatsappAccountId':_0x597df4['id'],'UserId':_0x33550b['user']['id'],'ContactId':_0x379ee3['id']})]},{'include':[{'model':db[_0xcfe7('0x81')],'as':_0xcfe7('0xb8')}]})[_0xcfe7('0x1c')](function(_0x4317af){return[_0x4317af,!![]];});});}})[_0xcfe7('0x6a')](function(_0x469f84,_0x4161c2){if(_0x4161c2){return _0x469f84;}return db[_0xcfe7('0x81')]['create'](_[_0xcfe7('0x4a')](_0x33550b[_0xcfe7('0x55')],{'read':![],'body':_0x33550b[_0xcfe7('0x55')][_0xcfe7('0x55')],'phone':_0x279b79,'WhatsappAccountId':_0x597df4['id'],'WhatsappInteractionId':_0x469f84['id'],'UserId':_0x33550b[_0xcfe7('0x56')]['id'],'ContactId':_0x379ee3['id']}))[_0xcfe7('0x1c')](function(_0x5544a5){_0x469f84[_0xcfe7('0xb9')][_0xcfe7('0xb8')]=[];_0x469f84['dataValues'][_0xcfe7('0xb8')][_0xcfe7('0xa4')](_0x5544a5['dataValues']);return _0x469f84;});})[_0xcfe7('0x1c')](respondWithResult(_0xa5db4d,null))[_0xcfe7('0x25')](handleError(_0xa5db4d,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 8380d6a..b4a4bf6 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 _0x939e=['remove','emit','hasOwnProperty','hook','exports','events','WhatsappAccount','update'];(function(_0x45582e,_0x29951a){var _0x58bfca=function(_0x1fa0dd){while(--_0x1fa0dd){_0x45582e['push'](_0x45582e['shift']());}};_0x58bfca(++_0x29951a);}(_0x939e,0x17d));var _0xe939=function(_0x2e689d,_0x4c3b29){_0x2e689d=_0x2e689d-0x0;var _0x540160=_0x939e[_0x2e689d];return _0x540160;};'use strict';var EventEmitter=require(_0xe939('0x0'));var WhatsappAccount=require('../../mysqldb')['db'][_0xe939('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe939('0x2'),'afterDestroy':_0xe939('0x3')};function emitEvent(_0x57cc3a){return function(_0xcebbec,_0x176957,_0x341e3b){WhatsappAccountEvents[_0xe939('0x4')](_0x57cc3a+':'+_0xcebbec['id'],_0xcebbec);WhatsappAccountEvents[_0xe939('0x4')](_0x57cc3a,_0xcebbec);_0x341e3b(null);};}for(var e in events){if(events[_0xe939('0x5')](e)){var event=events[e];WhatsappAccount[_0xe939('0x6')](e,emitEvent(event));}}module[_0xe939('0x7')]=WhatsappAccountEvents; \ No newline at end of file +var _0x5311=['hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x302f76,_0xdc2ff9){var _0xbbff35=function(_0x49c10f){while(--_0x49c10f){_0x302f76['push'](_0x302f76['shift']());}};_0xbbff35(++_0xdc2ff9);}(_0x5311,0xea));var _0x1531=function(_0x317ce1,_0xb66707){_0x317ce1=_0x317ce1-0x0;var _0x597aa7=_0x5311[_0x317ce1];return _0x597aa7;};'use strict';var EventEmitter=require(_0x1531('0x0'));var WhatsappAccount=require(_0x1531('0x1'))['db'][_0x1531('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x1531('0x3')](0x0);var events={'afterCreate':_0x1531('0x4'),'afterUpdate':_0x1531('0x5'),'afterDestroy':_0x1531('0x6')};function emitEvent(_0x1cb3f9){return function(_0x2b629b,_0x10fe12,_0x49a7ca){WhatsappAccountEvents[_0x1531('0x7')](_0x1cb3f9+':'+_0x2b629b['id'],_0x2b629b);WhatsappAccountEvents[_0x1531('0x7')](_0x1cb3f9,_0x2b629b);_0x49a7ca(null);};}for(var e in events){if(events[_0x1531('0x8')](e)){var event=events[e];WhatsappAccount[_0x1531('0x9')](e,emitEvent(event));}}module[_0x1531('0xa')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 981d76b..4f423e2 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 _0xbd88=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x20fb3c,_0x2b68f0){var _0x3b5f0e=function(_0x1447bd){while(--_0x1447bd){_0x20fb3c['push'](_0x20fb3c['shift']());}};_0x3b5f0e(++_0x2b68f0);}(_0xbd88,0x142));var _0x8bd8=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xbd88[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x8bd8('0x0'));var util=require(_0x8bd8('0x1'));var logger=require(_0x8bd8('0x2'))(_0x8bd8('0x3'));var moment=require(_0x8bd8('0x4'));var BPromise=require(_0x8bd8('0x5'));var rp=require(_0x8bd8('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bd8('0x7'));var config=require(_0x8bd8('0x8'));var attributes=require(_0x8bd8('0x9'));module[_0x8bd8('0xa')]=function(_0x3de2e0,_0x2f0c1f){return _0x3de2e0[_0x8bd8('0xb')](_0x8bd8('0xc'),attributes,{'tableName':_0x8bd8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x16d2=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','define','WhatsappAccount','whatsapp_accounts','lodash','util'];(function(_0x3a6efd,_0x2a5102){var _0x487b9a=function(_0x104f89){while(--_0x104f89){_0x3a6efd['push'](_0x3a6efd['shift']());}};_0x487b9a(++_0x2a5102);}(_0x16d2,0xa6));var _0x216d=function(_0x222619,_0x589023){_0x222619=_0x222619-0x0;var _0x5d76f8=_0x16d2[_0x222619];return _0x5d76f8;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var logger=require(_0x216d('0x2'))(_0x216d('0x3'));var moment=require('moment');var BPromise=require(_0x216d('0x4'));var rp=require(_0x216d('0x5'));var fs=require('fs');var path=require(_0x216d('0x6'));var rimraf=require('rimraf');var config=require(_0x216d('0x7'));var attributes=require(_0x216d('0x8'));module['exports']=function(_0x25ed70,_0x3f6be4){return _0x25ed70[_0x216d('0x9')](_0x216d('0xa'),attributes,{'tableName':_0x216d('0xb'),'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 54aa477..2b5a3f9 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 _0x6528=['map','model','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6528,0x160));var _0x8652=function(_0x482396,_0x2c242b){_0x482396=_0x482396-0x0;var _0x50bc94=_0x6528[_0x482396];return _0x50bc94;};'use strict';var _=require(_0x8652('0x0'));var util=require(_0x8652('0x1'));var moment=require(_0x8652('0x2'));var BPromise=require('bluebird');var rs=require(_0x8652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8652('0x4'));var logger=require(_0x8652('0x5'))(_0x8652('0x6'));var config=require('../../config/environment');var jayson=require(_0x8652('0x7'));var client=jayson[_0x8652('0x8')][_0x8652('0x9')]({'port':0x232a});config[_0x8652('0xa')]=_['defaults'](config[_0x8652('0xa')],{'host':_0x8652('0xb'),'port':0x18eb});var socket=require(_0x8652('0xc'))(new Redis(config[_0x8652('0xa')]));require(_0x8652('0xd'))['register'](socket);function respondWithRpcPromise(_0x18dd67,_0x374753,_0x15e2ae){return new BPromise(function(_0x1836f1,_0x26fc2d){return client[_0x8652('0xe')](_0x18dd67,_0x15e2ae)[_0x8652('0xf')](function(_0x2afa1b){logger[_0x8652('0x10')](_0x8652('0x11'),_0x374753,_0x8652('0x12'));logger['debug'](_0x8652('0x13'),_0x374753,_0x8652('0x12'),JSON[_0x8652('0x14')](_0x2afa1b));if(_0x2afa1b[_0x8652('0x15')]){if(_0x2afa1b['error'][_0x8652('0x16')]===0x1f4){logger[_0x8652('0x15')](_0x8652('0x11'),_0x374753,_0x2afa1b['error'][_0x8652('0x17')]);return _0x26fc2d(_0x2afa1b[_0x8652('0x15')][_0x8652('0x17')]);}logger[_0x8652('0x15')](_0x8652('0x11'),_0x374753,_0x2afa1b[_0x8652('0x15')][_0x8652('0x17')]);return _0x1836f1(_0x2afa1b[_0x8652('0x15')][_0x8652('0x17')]);}else{logger[_0x8652('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x374753,_0x8652('0x12'));_0x1836f1(_0x2afa1b[_0x8652('0x18')][_0x8652('0x17')]);}})[_0x8652('0x19')](function(_0x2e177b){logger[_0x8652('0x15')]('WhatsappAccount,\x20%s,\x20%s',_0x374753,_0x2e177b);_0x26fc2d(_0x2e177b);});});}exports[_0x8652('0x1a')]=function(_0x557e45){var _0x2bdfa6=this;return new Promise(function(_0x3e62a9,_0x287f1a){return db[_0x8652('0x1b')][_0x8652('0x1c')]({'raw':_0x557e45[_0x8652('0x1d')]?_0x557e45['options']['raw']===undefined?!![]:![]:!![],'where':_0x557e45[_0x8652('0x1d')]?_0x557e45[_0x8652('0x1d')][_0x8652('0x1e')]||null:null,'attributes':_0x557e45[_0x8652('0x1d')]?_0x557e45[_0x8652('0x1d')][_0x8652('0x1f')]||null:null,'include':_0x557e45[_0x8652('0x1d')]?_0x557e45[_0x8652('0x1d')][_0x8652('0x20')]?_[_0x8652('0x21')](_0x557e45[_0x8652('0x1d')][_0x8652('0x20')],function(_0x551b0f){return{'model':db[_0x551b0f['model']],'as':_0x551b0f['as'],'attributes':_0x551b0f[_0x8652('0x1f')],'include':_0x551b0f['include']?_[_0x8652('0x21')](_0x551b0f[_0x8652('0x20')],function(_0x5b9f1d){return{'model':db[_0x5b9f1d['model']],'as':_0x5b9f1d['as'],'attributes':_0x5b9f1d['attributes'],'include':_0x5b9f1d[_0x8652('0x20')]?_['map'](_0x5b9f1d[_0x8652('0x20')],function(_0x2ac48d){return{'model':db[_0x2ac48d[_0x8652('0x22')]],'as':_0x2ac48d['as'],'attributes':_0x2ac48d[_0x8652('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c122d){logger['info'](_0x8652('0x1a'),_0x557e45);logger['debug'](_0x8652('0x1a'),_0x557e45,JSON[_0x8652('0x14')](_0x5c122d));_0x3e62a9(_0x5c122d);})[_0x8652('0x19')](function(_0x407113){logger['error'](_0x8652('0x1a'),_0x407113[_0x8652('0x17')],_0x557e45);_0x287f1a(_0x2bdfa6['error'](0x1f4,_0x407113[_0x8652('0x17')]));});});}; \ No newline at end of file +var _0xc133=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','model','map','lodash'];(function(_0x3720f6,_0x4ab838){var _0x5a2527=function(_0x2cd4ed){while(--_0x2cd4ed){_0x3720f6['push'](_0x3720f6['shift']());}};_0x5a2527(++_0x4ab838);}(_0xc133,0xe3));var _0x3c13=function(_0x1f1a14,_0x531c79){_0x1f1a14=_0x1f1a14-0x0;var _0x4a6944=_0xc133[_0x1f1a14];return _0x4a6944;};'use strict';var _=require(_0x3c13('0x0'));var util=require(_0x3c13('0x1'));var moment=require(_0x3c13('0x2'));var BPromise=require(_0x3c13('0x3'));var rs=require(_0x3c13('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c13('0x5'))['db'];var utils=require(_0x3c13('0x6'));var logger=require('../../config/logger')(_0x3c13('0x7'));var config=require(_0x3c13('0x8'));var jayson=require(_0x3c13('0x9'));var client=jayson[_0x3c13('0xa')][_0x3c13('0xb')]({'port':0x232a});config[_0x3c13('0xc')]=_[_0x3c13('0xd')](config[_0x3c13('0xc')],{'host':_0x3c13('0xe'),'port':0x18eb});var socket=require(_0x3c13('0xf'))(new Redis(config[_0x3c13('0xc')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0x41cf73,_0x3ac429,_0xc1af3){return new BPromise(function(_0x1f2ffd,_0x1b3e1f){return client[_0x3c13('0x10')](_0x41cf73,_0xc1af3)[_0x3c13('0x11')](function(_0x371a84){logger['info'](_0x3c13('0x12'),_0x3ac429,'request\x20sent');logger[_0x3c13('0x13')](_0x3c13('0x14'),_0x3ac429,_0x3c13('0x15'),JSON[_0x3c13('0x16')](_0x371a84));if(_0x371a84[_0x3c13('0x17')]){if(_0x371a84[_0x3c13('0x17')][_0x3c13('0x18')]===0x1f4){logger[_0x3c13('0x17')](_0x3c13('0x12'),_0x3ac429,_0x371a84['error'][_0x3c13('0x19')]);return _0x1b3e1f(_0x371a84['error'][_0x3c13('0x19')]);}logger[_0x3c13('0x17')](_0x3c13('0x12'),_0x3ac429,_0x371a84['error'][_0x3c13('0x19')]);return _0x1f2ffd(_0x371a84[_0x3c13('0x17')][_0x3c13('0x19')]);}else{logger[_0x3c13('0x1a')](_0x3c13('0x12'),_0x3ac429,_0x3c13('0x15'));_0x1f2ffd(_0x371a84[_0x3c13('0x1b')][_0x3c13('0x19')]);}})[_0x3c13('0x1c')](function(_0x1d691d){logger[_0x3c13('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x3ac429,_0x1d691d);_0x1b3e1f(_0x1d691d);});});}exports[_0x3c13('0x1d')]=function(_0x5ec601){var _0x5793ab=this;return new Promise(function(_0x3e5764,_0x2c307c){return db[_0x3c13('0x1e')][_0x3c13('0x1f')]({'raw':_0x5ec601[_0x3c13('0x20')]?_0x5ec601[_0x3c13('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5ec601[_0x3c13('0x20')]?_0x5ec601[_0x3c13('0x20')][_0x3c13('0x21')]||null:null,'attributes':_0x5ec601[_0x3c13('0x20')]?_0x5ec601[_0x3c13('0x20')][_0x3c13('0x22')]||null:null,'include':_0x5ec601[_0x3c13('0x20')]?_0x5ec601[_0x3c13('0x20')][_0x3c13('0x23')]?_['map'](_0x5ec601[_0x3c13('0x20')][_0x3c13('0x23')],function(_0x332e02){return{'model':db[_0x332e02[_0x3c13('0x24')]],'as':_0x332e02['as'],'attributes':_0x332e02['attributes'],'include':_0x332e02[_0x3c13('0x23')]?_[_0x3c13('0x25')](_0x332e02['include'],function(_0x4c1788){return{'model':db[_0x4c1788[_0x3c13('0x24')]],'as':_0x4c1788['as'],'attributes':_0x4c1788[_0x3c13('0x22')],'include':_0x4c1788[_0x3c13('0x23')]?_[_0x3c13('0x25')](_0x4c1788['include'],function(_0x2bbf20){return{'model':db[_0x2bbf20['model']],'as':_0x2bbf20['as'],'attributes':_0x2bbf20['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c13('0x11')](function(_0x5469c5){logger[_0x3c13('0x1a')](_0x3c13('0x1d'),_0x5ec601);logger[_0x3c13('0x13')](_0x3c13('0x1d'),_0x5ec601,JSON[_0x3c13('0x16')](_0x5469c5));_0x3e5764(_0x5469c5);})[_0x3c13('0x1c')](function(_0xadafb){logger[_0x3c13('0x17')](_0x3c13('0x1d'),_0xadafb[_0x3c13('0x19')],_0x5ec601);_0x2c307c(_0x5793ab[_0x3c13('0x17')](0x1f4,_0xadafb[_0x3c13('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2cfc6e4..eb462f0 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 _0xbba7=['register','length','whatsappAccount:','./whatsappAccount.events','update','emit'];(function(_0x5362c6,_0x51167b){var _0x50e498=function(_0x40832f){while(--_0x40832f){_0x5362c6['push'](_0x5362c6['shift']());}};_0x50e498(++_0x51167b);}(_0xbba7,0x1a7));var _0x7bba=function(_0x11e001,_0xb3367b){_0x11e001=_0x11e001-0x0;var _0x417419=_0xbba7[_0x11e001];return _0x417419;};'use strict';var WhatsappAccountEvents=require(_0x7bba('0x0'));var events=['save','remove',_0x7bba('0x1')];function createListener(_0x2d8583,_0xee9288){return function(_0x39ae4d){_0xee9288[_0x7bba('0x2')](_0x2d8583,_0x39ae4d);};}function removeListener(_0x6d3e67,_0x274369){return function(){WhatsappAccountEvents['removeListener'](_0x6d3e67,_0x274369);};}exports[_0x7bba('0x3')]=function(_0x282b06){for(var _0x3154b0=0x0,_0x2ac7c4=events[_0x7bba('0x4')];_0x3154b0<_0x2ac7c4;_0x3154b0++){var _0x3d23a7=events[_0x3154b0];var _0x582e0a=createListener(_0x7bba('0x5')+_0x3d23a7,_0x282b06);WhatsappAccountEvents['on'](_0x3d23a7,_0x582e0a);}}; \ No newline at end of file +var _0x9a00=['save','remove','emit','removeListener','register','length','./whatsappAccount.events'];(function(_0xdb7cdd,_0x44ed20){var _0x5e3859=function(_0x3576cf){while(--_0x3576cf){_0xdb7cdd['push'](_0xdb7cdd['shift']());}};_0x5e3859(++_0x44ed20);}(_0x9a00,0xd8));var _0x09a0=function(_0x2ec5be,_0x4288dc){_0x2ec5be=_0x2ec5be-0x0;var _0x5ca0cc=_0x9a00[_0x2ec5be];return _0x5ca0cc;};'use strict';var WhatsappAccountEvents=require(_0x09a0('0x0'));var events=[_0x09a0('0x1'),_0x09a0('0x2'),'update'];function createListener(_0x1adcdb,_0x1c3fde){return function(_0x1af0bf){_0x1c3fde[_0x09a0('0x3')](_0x1adcdb,_0x1af0bf);};}function removeListener(_0x14ed5f,_0x27912f){return function(){WhatsappAccountEvents[_0x09a0('0x4')](_0x14ed5f,_0x27912f);};}exports[_0x09a0('0x5')]=function(_0x5e0899){for(var _0xd376f0=0x0,_0x4866e4=events[_0x09a0('0x6')];_0xd376f0<_0x4866e4;_0xd376f0++){var _0x17343f=events[_0xd376f0];var _0x59518e=createListener('whatsappAccount:'+_0x17343f,_0x5e0899);WhatsappAccountEvents['on'](_0x17343f,_0x59518e);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 4351d1d..fd19ffb 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 _0xd80d=['./whatsappApplication.controller','isAuthenticated','index','/:id','show','put','update','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd80d,0x159));var _0xdd80=function(_0x28b4dd,_0x57de01){_0x28b4dd=_0x28b4dd-0x0;var _0x1f8883=_0xd80d[_0x28b4dd];return _0x1f8883;};'use strict';var multer=require(_0xdd80('0x0'));var util=require(_0xdd80('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdd80('0x2')]();var fs_extra=require(_0xdd80('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xdd80('0x4'));var config=require(_0xdd80('0x5'));var controller=require(_0xdd80('0x6'));router['get']('/',auth[_0xdd80('0x7')](),controller[_0xdd80('0x8')]);router['get'](_0xdd80('0x9'),auth['isAuthenticated'](),controller[_0xdd80('0xa')]);router['post']('/',auth[_0xdd80('0x7')](),controller['create']);router[_0xdd80('0xb')](_0xdd80('0x9'),auth[_0xdd80('0x7')](),controller[_0xdd80('0xc')]);router['delete'](_0xdd80('0x9'),auth[_0xdd80('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf807=['/:id','update','destroy','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','create','put'];(function(_0x394af,_0x309993){var _0x11fb2d=function(_0x411e15){while(--_0x411e15){_0x394af['push'](_0x394af['shift']());}};_0x11fb2d(++_0x309993);}(_0xf807,0x1c3));var _0x7f80=function(_0x4aab29,_0xe600b8){_0x4aab29=_0x4aab29-0x0;var _0x521231=_0xf807[_0x4aab29];return _0x521231;};'use strict';var multer=require(_0x7f80('0x0'));var util=require(_0x7f80('0x1'));var path=require(_0x7f80('0x2'));var timeout=require('connect-timeout');var express=require(_0x7f80('0x3'));var router=express['Router']();var fs_extra=require(_0x7f80('0x4'));var auth=require(_0x7f80('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7f80('0x6'));var controller=require('./whatsappApplication.controller');router[_0x7f80('0x7')]('/',auth[_0x7f80('0x8')](),controller[_0x7f80('0x9')]);router[_0x7f80('0x7')]('/:id',auth[_0x7f80('0x8')](),controller[_0x7f80('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7f80('0xb')]);router[_0x7f80('0xc')](_0x7f80('0xd'),auth['isAuthenticated'](),controller[_0x7f80('0xe')]);router['delete'](_0x7f80('0xd'),auth[_0x7f80('0x8')](),controller[_0x7f80('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index b162b16..9102af9 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 _0x5520=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x2aeadf,_0x5ee7d7){var _0x395577=function(_0x5b4377){while(--_0x5b4377){_0x2aeadf['push'](_0x2aeadf['shift']());}};_0x395577(++_0x5ee7d7);}(_0x5520,0xe9));var _0x0552=function(_0x335f64,_0x2d304b){_0x335f64=_0x335f64-0x0;var _0x3df65b=_0x5520[_0x335f64];return _0x3df65b;};'use strict';var Sequelize=require(_0x0552('0x0'));module[_0x0552('0x1')]={'priority':{'type':Sequelize[_0x0552('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0552('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x0552('0x4')]()},'description':{'type':Sequelize[_0x0552('0x3')]},'interval':{'type':Sequelize[_0x0552('0x3')],'defaultValue':_0x0552('0x5')}}; \ No newline at end of file +var _0x541f=['*,*,*,*','sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x52d7a0,_0x2d26bd){var _0x47e1f2=function(_0x200a10){while(--_0x200a10){_0x52d7a0['push'](_0x52d7a0['shift']());}};_0x47e1f2(++_0x2d26bd);}(_0x541f,0x10b));var _0xf541=function(_0x4dab14,_0x164ea0){_0x4dab14=_0x4dab14-0x0;var _0xf41aa=_0x541f[_0x4dab14];return _0xf41aa;};'use strict';var Sequelize=require(_0xf541('0x0'));module[_0xf541('0x1')]={'priority':{'type':Sequelize[_0xf541('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf541('0x3')],'allowNull':![],'defaultValue':_0xf541('0x4')},'appdata':{'type':Sequelize[_0xf541('0x5')]()},'description':{'type':Sequelize[_0xf541('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf541('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index ea578b9..b13de34 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 _0x8ed7=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','update','body','rimraf','zip-dir','fast-json-patch'];(function(_0x2fe85a,_0x28c346){var _0x468e0f=function(_0x515887){while(--_0x515887){_0x2fe85a['push'](_0x2fe85a['shift']());}};_0x468e0f(++_0x28c346);}(_0x8ed7,0x8b));var _0x78ed=function(_0x367927,_0x450a5d){_0x367927=_0x367927-0x0;var _0x142e2f=_0x8ed7[_0x367927];return _0x142e2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78ed('0x0'));var zipdir=require(_0x78ed('0x1'));var jsonpatch=require(_0x78ed('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x78ed('0x3'));var Mustache=require(_0x78ed('0x4'));var util=require(_0x78ed('0x5'));var path=require(_0x78ed('0x6'));var sox=require(_0x78ed('0x7'));var csv=require(_0x78ed('0x8'));var ejs=require(_0x78ed('0x9'));var fs=require('fs');var fs_extra=require(_0x78ed('0xa'));var _=require(_0x78ed('0xb'));var squel=require('squel');var crypto=require(_0x78ed('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x78ed('0xd'));var toCsv=require('to-csv');var querystring=require(_0x78ed('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x78ed('0xf'));var qs=require(_0x78ed('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x78ed('0x11'));var logger=require(_0x78ed('0x12'))('api');var utils=require(_0x78ed('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x78ed('0x14'));var db=require(_0x78ed('0x15'))['db'];function respondWithStatusCode(_0x3ec02d,_0x2cb17b){_0x2cb17b=_0x2cb17b||0xcc;return function(_0x1a5254){if(_0x1a5254){return _0x3ec02d[_0x78ed('0x16')](_0x2cb17b);}return _0x3ec02d['status'](_0x2cb17b)[_0x78ed('0x17')]();};}function respondWithResult(_0x4b97ba,_0x538306){_0x538306=_0x538306||0xc8;return function(_0x510322){if(_0x510322){return _0x4b97ba['status'](_0x538306)['json'](_0x510322);}};}function respondWithFilteredResult(_0x2e88ad,_0x272171){return function(_0x2e9007){if(_0x2e9007){var _0x195b7e=typeof _0x272171[_0x78ed('0x18')]===_0x78ed('0x19')&&typeof _0x272171[_0x78ed('0x1a')]===_0x78ed('0x19');var _0x17d0d6=_0x2e9007[_0x78ed('0x1b')];var _0x2dd98c=_0x195b7e?0x0:_0x272171['offset'];var _0x2f442b=_0x195b7e?_0x2e9007[_0x78ed('0x1b')]:_0x272171['offset']+_0x272171['limit'];var _0x2868d1;if(_0x2f442b>=_0x17d0d6){_0x2f442b=_0x17d0d6;_0x2868d1=0xc8;}else{_0x2868d1=0xce;}_0x2e88ad[_0x78ed('0x1c')](_0x2868d1);return _0x2e88ad[_0x78ed('0x1d')](_0x78ed('0x1e'),_0x2dd98c+'-'+_0x2f442b+'/'+_0x17d0d6)[_0x78ed('0x1f')](_0x2e9007);}return null;};}function patchUpdates(_0x3bd736){return function(_0x3479ec){try{jsonpatch[_0x78ed('0x20')](_0x3479ec,_0x3bd736,!![]);}catch(_0x376076){return BPromise[_0x78ed('0x21')](_0x376076);}return _0x3479ec[_0x78ed('0x22')]();};}function saveUpdates(_0x4f1edb,_0x5ee188){return function(_0x425310){if(_0x425310){return _0x425310['update'](_0x4f1edb)[_0x78ed('0x23')](function(_0x55f0e8){return _0x55f0e8;});}return null;};}function removeEntity(_0x4675d3,_0x590d90){return function(_0x2af200){if(_0x2af200){return _0x2af200[_0x78ed('0x24')]()[_0x78ed('0x23')](function(){_0x4675d3['status'](0xcc)[_0x78ed('0x17')]();});}};}function handleEntityNotFound(_0x5a8b87,_0x137c7c){return function(_0x2a4573){if(!_0x2a4573){_0x5a8b87[_0x78ed('0x16')](0x194);}return _0x2a4573;};}function handleError(_0x59349a,_0x5abe1b){_0x5abe1b=_0x5abe1b||0x1f4;return function(_0x464050){logger['error'](_0x464050[_0x78ed('0x25')]);if(_0x464050['name']){delete _0x464050[_0x78ed('0x26')];}_0x59349a[_0x78ed('0x1c')](_0x5abe1b)[_0x78ed('0x27')](_0x464050);};}exports[_0x78ed('0x28')]=function(_0xafc1cf,_0x624bb1){var _0x3cd100={},_0x312801={},_0x10ea7d={'count':0x0,'rows':[]};var _0x4f6cdd=_[_0x78ed('0x29')](db[_0x78ed('0x2a')][_0x78ed('0x2b')],function(_0x1afab4){return{'name':_0x1afab4['fieldName'],'type':_0x1afab4['type']['key']};});_0x312801['model']=_[_0x78ed('0x29')](_0x4f6cdd,_0x78ed('0x26'));_0x312801[_0x78ed('0x2c')]=_[_0x78ed('0x2d')](_0xafc1cf[_0x78ed('0x2c')]);_0x312801[_0x78ed('0x2e')]=_[_0x78ed('0x2f')](_0x312801['model'],_0x312801[_0x78ed('0x2c')]);_0x3cd100['attributes']=_[_0x78ed('0x2f')](_0x312801[_0x78ed('0x30')],qs['fields'](_0xafc1cf[_0x78ed('0x2c')][_0x78ed('0x31')]));_0x3cd100[_0x78ed('0x32')]=_0x3cd100[_0x78ed('0x32')][_0x78ed('0x33')]?_0x3cd100[_0x78ed('0x32')]:_0x312801[_0x78ed('0x30')];if(!_0xafc1cf[_0x78ed('0x2c')]['hasOwnProperty'](_0x78ed('0x34'))){_0x3cd100['limit']=qs[_0x78ed('0x1a')](_0xafc1cf[_0x78ed('0x2c')][_0x78ed('0x1a')]);_0x3cd100[_0x78ed('0x18')]=qs[_0x78ed('0x18')](_0xafc1cf[_0x78ed('0x2c')][_0x78ed('0x18')]);}_0x3cd100['order']=qs[_0x78ed('0x35')](_0xafc1cf[_0x78ed('0x2c')][_0x78ed('0x35')]);_0x3cd100[_0x78ed('0x36')]=qs[_0x78ed('0x2e')](_[_0x78ed('0x37')](_0xafc1cf[_0x78ed('0x2c')],_0x312801[_0x78ed('0x2e')]),_0x4f6cdd);if(_0xafc1cf[_0x78ed('0x2c')][_0x78ed('0x38')]){_0x3cd100[_0x78ed('0x36')]=_['merge'](_0x3cd100['where'],{'$or':_[_0x78ed('0x29')](_0x4f6cdd,function(_0x4a7506){if(_0x4a7506[_0x78ed('0x39')]!==_0x78ed('0x3a')){var _0x4edc9c={};_0x4edc9c[_0x4a7506[_0x78ed('0x26')]]={'$like':'%'+_0xafc1cf[_0x78ed('0x2c')][_0x78ed('0x38')]+'%'};return _0x4edc9c;}})});}_0x3cd100=_[_0x78ed('0x3b')]({},_0x3cd100,_0xafc1cf[_0x78ed('0x3c')]);var _0x37c26d={'where':_0x3cd100['where']};return db[_0x78ed('0x2a')][_0x78ed('0x1b')](_0x37c26d)[_0x78ed('0x23')](function(_0x2323de){_0x10ea7d['count']=_0x2323de;if(_0xafc1cf['query'][_0x78ed('0x3d')]){_0x3cd100[_0x78ed('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0x78ed('0x3f')](_0x3cd100);})[_0x78ed('0x23')](function(_0x48629a){_0x10ea7d['rows']=_0x48629a;return _0x10ea7d;})[_0x78ed('0x23')](respondWithFilteredResult(_0x624bb1,_0x3cd100))[_0x78ed('0x40')](handleError(_0x624bb1,null));};exports[_0x78ed('0x41')]=function(_0x37e5de,_0x58177d){var _0x5c42fe={'raw':!![],'where':{'id':_0x37e5de[_0x78ed('0x42')]['id']}},_0x4ebdd6={};_0x4ebdd6['model']=_[_0x78ed('0x2d')](db['WhatsappApplication'][_0x78ed('0x2b')]);_0x4ebdd6[_0x78ed('0x2c')]=_[_0x78ed('0x2d')](_0x37e5de[_0x78ed('0x2c')]);_0x4ebdd6[_0x78ed('0x2e')]=_['intersection'](_0x4ebdd6[_0x78ed('0x30')],_0x4ebdd6[_0x78ed('0x2c')]);_0x5c42fe[_0x78ed('0x32')]=_[_0x78ed('0x2f')](_0x4ebdd6[_0x78ed('0x30')],qs['fields'](_0x37e5de['query'][_0x78ed('0x31')]));_0x5c42fe[_0x78ed('0x32')]=_0x5c42fe[_0x78ed('0x32')][_0x78ed('0x33')]?_0x5c42fe['attributes']:_0x4ebdd6[_0x78ed('0x30')];if(_0x37e5de[_0x78ed('0x2c')][_0x78ed('0x3d')]){_0x5c42fe[_0x78ed('0x3e')]=[{'all':!![]}];}_0x5c42fe=_[_0x78ed('0x3b')]({},_0x5c42fe,_0x37e5de[_0x78ed('0x3c')]);return db['WhatsappApplication'][_0x78ed('0x43')](_0x5c42fe)['then'](handleEntityNotFound(_0x58177d,null))[_0x78ed('0x23')](respondWithResult(_0x58177d,null))['catch'](handleError(_0x58177d,null));};exports[_0x78ed('0x44')]=function(_0x2a164e,_0x1020d9){return db[_0x78ed('0x2a')][_0x78ed('0x44')](_0x2a164e['body'],{})['then'](respondWithResult(_0x1020d9,0xc9))[_0x78ed('0x40')](handleError(_0x1020d9,null));};exports[_0x78ed('0x45')]=function(_0x39da99,_0x4c68f1){if(_0x39da99[_0x78ed('0x46')]['id']){delete _0x39da99[_0x78ed('0x46')]['id'];}return db[_0x78ed('0x2a')]['find']({'where':{'id':_0x39da99['params']['id']}})[_0x78ed('0x23')](handleEntityNotFound(_0x4c68f1,null))['then'](saveUpdates(_0x39da99[_0x78ed('0x46')],null))[_0x78ed('0x23')](respondWithResult(_0x4c68f1,null))['catch'](handleError(_0x4c68f1,null));};exports['destroy']=function(_0xd8fb3d,_0x192061){return db[_0x78ed('0x2a')][_0x78ed('0x43')]({'where':{'id':_0xd8fb3d[_0x78ed('0x42')]['id']}})[_0x78ed('0x23')](handleEntityNotFound(_0x192061,null))[_0x78ed('0x23')](removeEntity(_0x192061,null))[_0x78ed('0x40')](handleError(_0x192061,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','WhatsappApplication','includeAll','rows','catch','show'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x0295,0x1f0));var _0x5029=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x0295[_0x138836];return _0x322688;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['WhatsappApplication'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':!![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['WhatsappApplication'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 44ed923..ba57dec 100644 --- a/server/api/whatsappApplication/whatsappApplication.model.js +++ b/server/api/whatsappApplication/whatsappApplication.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x44ae=['WhatsappApplication','whatsapp_applications','utf8mb4','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x1bc370,_0x95b8e1){var _0x2368d0=function(_0x30d664){while(--_0x30d664){_0x1bc370['push'](_0x1bc370['shift']());}};_0x2368d0(++_0x95b8e1);}(_0x44ae,0x17d));var _0xe44a=function(_0x584e52,_0x5443dc){_0x584e52=_0x584e52-0x0;var _0x5cf710=_0x44ae[_0x584e52];return _0x5cf710;};'use strict';var _=require(_0xe44a('0x0'));var util=require(_0xe44a('0x1'));var logger=require(_0xe44a('0x2'))(_0xe44a('0x3'));var moment=require('moment');var BPromise=require(_0xe44a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe44a('0x5'));var rimraf=require(_0xe44a('0x6'));var config=require(_0xe44a('0x7'));var attributes=require(_0xe44a('0x8'));module[_0xe44a('0x9')]=function(_0x3f9763,_0x5c1c49){return _0x3f9763[_0xe44a('0xa')](_0xe44a('0xb'),attributes,{'tableName':_0xe44a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe44a('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x61a5=['../../config/environment','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1458e2,_0x1b45c2){var _0x4d191c=function(_0x5e1696){while(--_0x5e1696){_0x1458e2['push'](_0x1458e2['shift']());}};_0x4d191c(++_0x1b45c2);}(_0x61a5,0xf0));var _0x561a=function(_0x5adb18,_0x222326){_0x5adb18=_0x5adb18-0x0;var _0x420c98=_0x61a5[_0x5adb18];return _0x420c98;};'use strict';var _=require(_0x561a('0x0'));var util=require('util');var logger=require(_0x561a('0x1'))(_0x561a('0x2'));var moment=require(_0x561a('0x3'));var BPromise=require(_0x561a('0x4'));var rp=require(_0x561a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x561a('0x6'));var config=require(_0x561a('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0x561a('0x8')]=function(_0x31f762,_0x24c89a){return _0x31f762[_0x561a('0x9')](_0x561a('0xa'),attributes,{'tableName':_0x561a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x561a('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 2b27c70..9cd1513 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x33f557,_0x12b78d){var _0x3514a6=function(_0x3925e7){while(--_0x3925e7){_0x33f557['push'](_0x33f557['shift']());}};_0x3514a6(++_0x12b78d);}(_0x207c,0x1e8));var _0xc207=function(_0x40dcd1,_0x5cd1da){_0x40dcd1=_0x40dcd1-0x0;var _0x5c056b=_0x207c[_0x40dcd1];return _0x5c056b;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xdace,0xc5));var _0xedac=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xdace[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 80ec165..92e82bb 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 _0xc359=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/messages','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','util','connect-timeout','express'];(function(_0x25663b,_0x2386ae){var _0x425c4f=function(_0x7430b8){while(--_0x7430b8){_0x25663b['push'](_0x25663b['shift']());}};_0x425c4f(++_0x2386ae);}(_0xc359,0x1d9));var _0x9c35=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0xc359[_0x590851];return _0x3b0115;};'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('./whatsappInteraction.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['getMessages']);router['get']('/:id/download',auth[_0x9c35('0x7')](),controller['download']);router[_0x9c35('0xc')]('/',auth[_0x9c35('0x7')](),controller[_0x9c35('0xd')]);router['post'](_0x9c35('0xb'),auth[_0x9c35('0x7')](),controller[_0x9c35('0xe')]);router[_0x9c35('0xc')](_0x9c35('0xf'),auth['isAuthenticated'](),interaction[_0x9c35('0x10')](_0x9c35('0x11'),_0x9c35('0x12')),controller[_0x9c35('0x13')]);router[_0x9c35('0x14')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),interaction[_0x9c35('0x10')](_0x9c35('0x11'),_0x9c35('0x15')),controller[_0x9c35('0x16')]);router[_0x9c35('0x17')](_0x9c35('0x9'),auth[_0x9c35('0x7')](),interaction[_0x9c35('0x10')]('whatsapp',_0x9c35('0x18')),controller[_0x9c35('0x19')]);router[_0x9c35('0x17')](_0x9c35('0xf'),auth['isAuthenticated'](),controller[_0x9c35('0x1a')]);module[_0x9c35('0x1b')]=router; \ No newline at end of file +var _0x2d72=['/:id/download','post','/:id/messages','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','getMessages'];(function(_0x17fbec,_0x18c977){var _0x220fb1=function(_0x461fd3){while(--_0x461fd3){_0x17fbec['push'](_0x17fbec['shift']());}};_0x220fb1(++_0x18c977);}(_0x2d72,0xa8));var _0x22d7=function(_0x2afe4e,_0x58a3cf){_0x2afe4e=_0x2afe4e-0x0;var _0x30625c=_0x2d72[_0x2afe4e];return _0x30625c;};'use strict';var multer=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var path=require(_0x22d7('0x2'));var timeout=require(_0x22d7('0x3'));var express=require(_0x22d7('0x4'));var router=express[_0x22d7('0x5')]();var fs_extra=require(_0x22d7('0x6'));var auth=require(_0x22d7('0x7'));var interaction=require(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var controller=require(_0x22d7('0xa'));router[_0x22d7('0xb')]('/',auth[_0x22d7('0xc')](),controller[_0x22d7('0xd')]);router['get'](_0x22d7('0xe'),auth[_0x22d7('0xc')](),controller['describe']);router[_0x22d7('0xb')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),controller[_0x22d7('0x10')]);router['get']('/:id/messages',auth[_0x22d7('0xc')](),controller[_0x22d7('0x11')]);router[_0x22d7('0xb')](_0x22d7('0x12'),auth[_0x22d7('0xc')](),controller['download']);router['post']('/',auth[_0x22d7('0xc')](),controller['create']);router[_0x22d7('0x13')](_0x22d7('0x14'),auth['isAuthenticated'](),controller[_0x22d7('0x15')]);router[_0x22d7('0x13')](_0x22d7('0x16'),auth[_0x22d7('0xc')](),interaction[_0x22d7('0x17')](_0x22d7('0x18'),_0x22d7('0x19')),controller[_0x22d7('0x1a')]);router['put'](_0x22d7('0xf'),auth[_0x22d7('0xc')](),interaction[_0x22d7('0x17')]('whatsapp','whatsappinteraction:update'),controller['update']);router[_0x22d7('0x1b')](_0x22d7('0xf'),auth[_0x22d7('0xc')](),interaction[_0x22d7('0x17')](_0x22d7('0x18'),'whatsappinteraction:destroy'),controller[_0x22d7('0x1c')]);router[_0x22d7('0x1b')](_0x22d7('0x16'),auth['isAuthenticated'](),controller[_0x22d7('0x1d')]);module[_0x22d7('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 0b6b2f7..86a16e9 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 _0x20d6=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x64c9bd,_0x71b468){var _0x2aa707=function(_0x5b15b9){while(--_0x5b15b9){_0x64c9bd['push'](_0x64c9bd['shift']());}};_0x2aa707(++_0x71b468);}(_0x20d6,0x9d));var _0x620d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x20d6[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x620d('0x0'));var moment=require(_0x620d('0x1'));module[_0x620d('0x2')]={'closed':{'type':Sequelize[_0x620d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x620d('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x620d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x620d('0x5')]},'note':{'type':Sequelize[_0x620d('0x5')]},'phone':{'type':Sequelize[_0x620d('0x5')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x620d('0x6')]('in',_0x620d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x620d('0x6')]('in',_0x620d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x620d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf961=['moment','exports','BOOLEAN','STRING','DATE','ENUM','out','sequelize'];(function(_0x5a183f,_0x5284b5){var _0x3e8e4e=function(_0x5368e4){while(--_0x5368e4){_0x5a183f['push'](_0x5a183f['shift']());}};_0x3e8e4e(++_0x5284b5);}(_0xf961,0x1cf));var _0x1f96=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xf961[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0x1f96('0x0'));var moment=require(_0x1f96('0x1'));module[_0x1f96('0x2')]={'closed':{'type':Sequelize[_0x1f96('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x1f96('0x4')]},'secondDisposition':{'type':Sequelize[_0x1f96('0x4')]},'thirdDisposition':{'type':Sequelize[_0x1f96('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1f96('0x4')]},'read1stAt':{'type':Sequelize[_0x1f96('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x1f96('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1f96('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1f96('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1f96('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 8075a8c..ac91d9c 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 _0xf1c3=['path','ejs','ioredis','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','error','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','catch','show','keys','rawAttributes','query','filters','model','attributes','intersection','fields','length','includeAll','include','merge','options','create','body','params','find','addMessage','omit','ids','getMessages','findOne','WhatsappMessage','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','emit','whatsappInteractionTags:save','download','toString','join','root','server','files','format','User','fullname','push','CmContact','Contact','attachments','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','get','Whatsapp','Owner','N.A.','closedAt','disposition','basename','existsSync','createReadStream','System','firstName','lastName','value','views','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','moment','bluebird','util'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0xf1c3,0x1d8));var _0x3f1c=function(_0x121886,_0x8cd8e5){_0x121886=_0x121886-0x0;var _0x20ca01=_0xf1c3[_0x121886];return _0x20ca01;};'use strict';var rimraf=require(_0x3f1c('0x0'));var zipdir=require('zip-dir');var moment=require(_0x3f1c('0x1'));var BPromise=require(_0x3f1c('0x2'));var util=require(_0x3f1c('0x3'));var path=require(_0x3f1c('0x4'));var ejs=require(_0x3f1c('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x3f1c('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x3f1c('0x7'));var logger=require(_0x3f1c('0x8'))('api');var config=require(_0x3f1c('0x9'));var db=require('../../mysqldb')['db'];config[_0x3f1c('0xa')]=_[_0x3f1c('0xb')](config[_0x3f1c('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f1c('0xc'))(new Redis(config[_0x3f1c('0xa')]));require('./whatsappInteraction.socket')[_0x3f1c('0xd')](socket);function respondWithStatusCode(_0x1d37f6,_0x5018dd){_0x5018dd=_0x5018dd||0xcc;return function(_0x259487){if(_0x259487){return _0x1d37f6[_0x3f1c('0xe')](_0x5018dd);}return _0x1d37f6[_0x3f1c('0xf')](_0x5018dd)['end']();};}function respondWithResult(_0x107fea,_0x9160b3){_0x9160b3=_0x9160b3||0xc8;return function(_0x51bec8){if(_0x51bec8){return _0x107fea['status'](_0x9160b3)[_0x3f1c('0x10')](_0x51bec8);}};}function respondWithFilteredResult(_0x371a8c,_0xc4f632){return function(_0x2619db){if(_0x2619db){var _0x5468ce=typeof _0xc4f632[_0x3f1c('0x11')]===_0x3f1c('0x12')&&typeof _0xc4f632[_0x3f1c('0x13')]===_0x3f1c('0x12');var _0x370902=_0x2619db[_0x3f1c('0x14')];var _0x540645=_0x5468ce?0x0:_0xc4f632[_0x3f1c('0x11')];var _0x1cc175=_0x5468ce?_0x2619db['count']:_0xc4f632['offset']+_0xc4f632['limit'];var _0x3c1406;if(_0x1cc175>=_0x370902){_0x1cc175=_0x370902;_0x3c1406=0xc8;}else{_0x3c1406=0xce;}_0x371a8c[_0x3f1c('0xf')](_0x3c1406);return _0x371a8c[_0x3f1c('0x15')](_0x3f1c('0x16'),_0x540645+'-'+_0x1cc175+'/'+_0x370902)[_0x3f1c('0x10')](_0x2619db);}return null;};}function saveUpdates(_0x5a814d){return function(_0x4f2e19){if(_0x4f2e19){return _0x4f2e19[_0x3f1c('0x17')](_0x5a814d)[_0x3f1c('0x18')](function(_0x28ca68){return _0x28ca68;});}return null;};}function removeEntity(_0x12ebfb){return function(_0xcbb6d3){if(_0xcbb6d3){return _0xcbb6d3['destroy']()[_0x3f1c('0x18')](function(){_0x12ebfb[_0x3f1c('0xf')](0xcc)[_0x3f1c('0x19')]();});}};}function handleEntityNotFound(_0x4386c2){return function(_0x5d1b7f){if(!_0x5d1b7f){_0x4386c2[_0x3f1c('0xe')](0x194);}return _0x5d1b7f;};}function handleError(_0x220eca,_0x1ed5ba){_0x1ed5ba=_0x1ed5ba||0x1f4;return function(_0x22a52d){logger[_0x3f1c('0x1a')](_0x22a52d[_0x3f1c('0x1b')]);if(_0x22a52d[_0x3f1c('0x1c')]){delete _0x22a52d[_0x3f1c('0x1c')];}_0x220eca[_0x3f1c('0xf')](_0x1ed5ba)[_0x3f1c('0x1d')](_0x22a52d);};}exports[_0x3f1c('0x1e')]=function(_0x3715c2,_0x28dec4){var _0x4290fa={};var _0x24e91c=_[_0x3f1c('0x1f')](db[_0x3f1c('0x20')]['rawAttributes'],function(_0x1c7efb){return{'name':_0x1c7efb[_0x3f1c('0x21')],'type':_0x1c7efb[_0x3f1c('0x22')][_0x3f1c('0x23')]};});_0x4290fa=qs[_0x3f1c('0x24')](_0x24e91c,_0x3715c2);return interaction[_0x3f1c('0x25')](_0x3f1c('0x26'),_0x3715c2['query'],_0x3715c2['user'],_0x4290fa,_0x24e91c)['then'](respondWithFilteredResult(_0x28dec4,_0x4290fa))[_0x3f1c('0x27')](handleError(_0x28dec4,null));};exports[_0x3f1c('0x28')]=function(_0x2d5f8e,_0x410181){var _0x4e05ad={'raw':![],'where':{'id':_0x2d5f8e['params']['id']}},_0x2fc1ff={};_0x2fc1ff['model']=_[_0x3f1c('0x29')](db[_0x3f1c('0x20')][_0x3f1c('0x2a')]);_0x2fc1ff[_0x3f1c('0x2b')]=_[_0x3f1c('0x29')](_0x2d5f8e['query']);_0x2fc1ff[_0x3f1c('0x2c')]=_['intersection'](_0x2fc1ff[_0x3f1c('0x2d')],_0x2fc1ff[_0x3f1c('0x2b')]);_0x4e05ad[_0x3f1c('0x2e')]=_[_0x3f1c('0x2f')](_0x2fc1ff['model'],qs[_0x3f1c('0x30')](_0x2d5f8e[_0x3f1c('0x2b')]['fields']));_0x4e05ad[_0x3f1c('0x2e')]=_0x4e05ad[_0x3f1c('0x2e')][_0x3f1c('0x31')]?_0x4e05ad[_0x3f1c('0x2e')]:_0x2fc1ff['model'];if(_0x2d5f8e['query'][_0x3f1c('0x32')]){_0x4e05ad[_0x3f1c('0x33')]=[{'all':!![]}];}_0x4e05ad=_[_0x3f1c('0x34')]({},_0x4e05ad,_0x2d5f8e[_0x3f1c('0x35')]);return db['WhatsappInteraction']['find'](_0x4e05ad)[_0x3f1c('0x18')](handleEntityNotFound(_0x410181,null))[_0x3f1c('0x18')](respondWithResult(_0x410181,null))[_0x3f1c('0x27')](handleError(_0x410181,null));};exports[_0x3f1c('0x36')]=function(_0x402149,_0x198779){return db[_0x3f1c('0x20')][_0x3f1c('0x36')](_0x402149[_0x3f1c('0x37')],{})[_0x3f1c('0x18')](respondWithResult(_0x198779,0xc9))[_0x3f1c('0x27')](handleError(_0x198779,null));};exports[_0x3f1c('0x17')]=function(_0x6ca9fb,_0xbdc457){if(_0x6ca9fb[_0x3f1c('0x37')]['id']){delete _0x6ca9fb[_0x3f1c('0x37')]['id'];}return db[_0x3f1c('0x20')]['find']({'where':{'id':_0x6ca9fb[_0x3f1c('0x38')]['id']}})[_0x3f1c('0x18')](handleEntityNotFound(_0xbdc457,null))['then'](saveUpdates(_0x6ca9fb['body'],null))[_0x3f1c('0x18')](respondWithResult(_0xbdc457,null))[_0x3f1c('0x27')](handleError(_0xbdc457,null));};exports['destroy']=function(_0x46ac0a,_0x5d60d3){return db[_0x3f1c('0x20')][_0x3f1c('0x39')]({'where':{'id':_0x46ac0a[_0x3f1c('0x38')]['id']}})[_0x3f1c('0x18')](handleEntityNotFound(_0x5d60d3,null))[_0x3f1c('0x18')](removeEntity(_0x5d60d3,null))[_0x3f1c('0x27')](handleError(_0x5d60d3,null));};exports['describe']=function(_0xf96e3c,_0x1be1d7){return db[_0x3f1c('0x20')]['describe']()['then'](respondWithResult(_0x1be1d7,null))['catch'](handleError(_0x1be1d7,null));};exports[_0x3f1c('0x3a')]=function(_0x2befed,_0x3da0dd){return db['WhatsappMessage'][_0x3f1c('0x39')]({'where':{'id':_0x2befed[_0x3f1c('0x38')]['id']}})[_0x3f1c('0x18')](handleEntityNotFound(_0x3da0dd,null))[_0x3f1c('0x18')](function(_0x14df48){if(_0x14df48){return _0x14df48[_0x3f1c('0x3a')](_0x2befed[_0x3f1c('0x37')]['ids'],_[_0x3f1c('0x3b')](_0x2befed[_0x3f1c('0x37')],[_0x3f1c('0x3c'),'id'])||{});}})[_0x3f1c('0x18')](respondWithResult(_0x3da0dd,null))[_0x3f1c('0x27')](handleError(_0x3da0dd,null));};exports[_0x3f1c('0x3d')]=function(_0x56b5cc,_0x208c89){var _0x161f95={'raw':![],'where':{}};var _0x328c52={};var _0x36258b={'count':0x0,'rows':[]};return db[_0x3f1c('0x20')][_0x3f1c('0x3e')]({'where':{'id':_0x56b5cc[_0x3f1c('0x38')]['id']}})[_0x3f1c('0x18')](handleEntityNotFound(_0x208c89,null))[_0x3f1c('0x18')](function(_0x1b8c6b){if(_0x1b8c6b){_0x328c52['model']=_[_0x3f1c('0x29')](db[_0x3f1c('0x3f')][_0x3f1c('0x2a')]);_0x328c52[_0x3f1c('0x2b')]=_[_0x3f1c('0x29')](_0x56b5cc[_0x3f1c('0x2b')]);_0x328c52[_0x3f1c('0x2c')]=_[_0x3f1c('0x2f')](_0x328c52[_0x3f1c('0x2d')],_0x328c52[_0x3f1c('0x2b')]);_0x161f95[_0x3f1c('0x2e')]=_['intersection'](_0x328c52[_0x3f1c('0x2d')],qs[_0x3f1c('0x30')](_0x56b5cc[_0x3f1c('0x2b')]['fields']));_0x161f95[_0x3f1c('0x2e')]=_0x161f95['attributes'][_0x3f1c('0x31')]?_0x161f95['attributes']:_0x328c52[_0x3f1c('0x2d')];if(!_0x56b5cc[_0x3f1c('0x2b')]['hasOwnProperty'](_0x3f1c('0x40'))){_0x161f95[_0x3f1c('0x13')]=qs[_0x3f1c('0x13')](_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x13')]);_0x161f95[_0x3f1c('0x11')]=qs[_0x3f1c('0x11')](_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x11')]);}_0x161f95[_0x3f1c('0x41')]=qs['sort'](_0x56b5cc['query'][_0x3f1c('0x42')]);_0x161f95[_0x3f1c('0x43')]=qs[_0x3f1c('0x2c')](_[_0x3f1c('0x44')](_0x56b5cc[_0x3f1c('0x2b')],_0x328c52[_0x3f1c('0x2c')]));_0x161f95['where'][_0x3f1c('0x45')]=_0x1b8c6b['id'];if(_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x46')]){_0x161f95['where']=_[_0x3f1c('0x34')](_0x161f95[_0x3f1c('0x43')],{'$or':_[_0x3f1c('0x1f')](_0x161f95[_0x3f1c('0x2e')],function(_0x1f0677){var _0x3a1f0c={};_0x3a1f0c[_0x1f0677]={'$like':'%'+_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x46')]+'%'};return _0x3a1f0c;})});}if(_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x47')]){var _0x1f33b5=_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x47')]['split'](',');var _0x596bc3={};_0x596bc3[_0x1f33b5[0x0]]={'$gte':moment(_0x1f33b5[0x1])['format'](_0x3f1c('0x48'))};_0x161f95[_0x3f1c('0x43')]=_[_0x3f1c('0x34')](_0x161f95['where'],_0x596bc3);}_0x161f95=_[_0x3f1c('0x34')]({},_0x161f95,_0x56b5cc['options']);return db[_0x3f1c('0x3f')][_0x3f1c('0x14')]({'where':_0x161f95[_0x3f1c('0x43')]})[_0x3f1c('0x18')](function(_0x504ebd){_0x36258b[_0x3f1c('0x14')]=_0x504ebd;if(_0x56b5cc[_0x3f1c('0x2b')][_0x3f1c('0x32')]){_0x161f95[_0x3f1c('0x33')]=[{'all':!![]}];}return db[_0x3f1c('0x3f')]['findAll'](_0x161f95);})[_0x3f1c('0x18')](function(_0x474726){_0x36258b[_0x3f1c('0x49')]=_0x474726;return _0x36258b;});}})[_0x3f1c('0x18')](respondWithFilteredResult(_0x208c89,_0x161f95))['catch'](handleError(_0x208c89,null));};exports[_0x3f1c('0x4a')]=function(_0x11ad18,_0x51e340){return db['WhatsappInteraction'][_0x3f1c('0x39')]({'where':{'id':_0x11ad18['params']['id']}})['then'](handleEntityNotFound(_0x51e340,null))[_0x3f1c('0x18')](function(_0x5936d4){if(_0x5936d4){return _0x5936d4[_0x3f1c('0x4b')](_0x11ad18['body'][_0x3f1c('0x3c')],_['omit'](_0x11ad18[_0x3f1c('0x37')],[_0x3f1c('0x3c'),'id'])||{})['spread'](function(){return db[_0x3f1c('0x4c')]['findAll']({'attributes':['id',_0x3f1c('0x1c'),'color'],'where':{'id':_0x11ad18[_0x3f1c('0x37')][_0x3f1c('0x3c')]}});})['then'](function(_0x49a7eb){socket[_0x3f1c('0x4d')](_0x3f1c('0x4e'),{'id':Number(_0x11ad18[_0x3f1c('0x38')]['id']),'tags':_0x49a7eb||[]});return{'id':Number(_0x11ad18[_0x3f1c('0x38')]['id']),'tags':_0x49a7eb||[]};});}})[_0x3f1c('0x18')](respondWithResult(_0x51e340,null))['catch'](handleError(_0x51e340,null));};exports['removeTags']=function(_0x2aa2da,_0x5d84c3){return db[_0x3f1c('0x20')][_0x3f1c('0x39')]({'where':{'id':_0x2aa2da[_0x3f1c('0x38')]['id']}})[_0x3f1c('0x18')](handleEntityNotFound(_0x5d84c3,null))['then'](function(_0x2a1e50){if(_0x2a1e50){return _0x2a1e50['removeTags'](_0x2aa2da[_0x3f1c('0x2b')][_0x3f1c('0x3c')]);}})['then'](respondWithStatusCode(_0x5d84c3,null))[_0x3f1c('0x27')](handleError(_0x5d84c3,null));};exports[_0x3f1c('0x4f')]=function(_0x5f5045,_0x11e0bd){var _0x551d2e=moment()['unix']()[_0x3f1c('0x50')]();var _0x553b07=path[_0x3f1c('0x51')](config[_0x3f1c('0x52')],_0x3f1c('0x53'),_0x3f1c('0x54'),'tmp');var _0x322ed0=path['join'](config[_0x3f1c('0x52')],'server',_0x3f1c('0x54'),'attachments');var _0x46c38a=path['join'](_0x553b07,_0x551d2e);var _0x4b0c25=util[_0x3f1c('0x55')]('transcript-%d-%s.zip',_0x5f5045[_0x3f1c('0x38')]['id'],_0x551d2e);var _0x1a495e=path['join'](_0x553b07,_0x4b0c25);var _0x115830=[];_0x115830['push']({'model':db[_0x3f1c('0x56')],'as':_0x3f1c('0x56'),'attributes':['id',_0x3f1c('0x57')],'raw':!![]});_0x115830[_0x3f1c('0x58')]({'model':db[_0x3f1c('0x59')],'as':_0x3f1c('0x5a'),'attributes':['id','firstName','lastName'],'raw':!![]});if(_0x5f5045[_0x3f1c('0x2b')][_0x3f1c('0x5b')]){_0x115830[_0x3f1c('0x58')]({'model':db[_0x3f1c('0x5c')],'as':_0x3f1c('0x5c'),'raw':!![]});}var _0x3d07e7=[{'model':db[_0x3f1c('0x3f')],'as':_0x3f1c('0x5d'),'attributes':['id',_0x3f1c('0x37'),_0x3f1c('0x5e'),_0x3f1c('0x5f'),_0x3f1c('0x60'),_0x3f1c('0x61')],'include':_0x115830}];_0x3d07e7[_0x3f1c('0x58')]({'model':db[_0x3f1c('0x62')],'as':_0x3f1c('0x63'),'attributes':['id',_0x3f1c('0x1c')]});_0x3d07e7[_0x3f1c('0x58')]({'model':db[_0x3f1c('0x56')],'as':'Owner','attributes':['id',_0x3f1c('0x57')]});return db[_0x3f1c('0x20')]['find']({'where':{'id':_0x5f5045[_0x3f1c('0x38')]['id']},'include':_0x3d07e7})[_0x3f1c('0x18')](handleEntityNotFound(_0x11e0bd,null))[_0x3f1c('0x18')](function(_0x39135b){if(_0x39135b){var _0x3cfa47=_0x39135b[_0x3f1c('0x64')]({'plain':!![]});fs['mkdirSync'](_0x46c38a);var _0x3174d6={'channel':_0x3f1c('0x65'),'account':_0x3cfa47['Account'][_0x3f1c('0x1c')],'agent':_0x3cfa47[_0x3f1c('0x66')]?_0x3cfa47[_0x3f1c('0x66')][_0x3f1c('0x57')]:_0x3f1c('0x67'),'createdAt':moment(_0x3cfa47[_0x3f1c('0x5e')])[_0x3f1c('0x55')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3f1c('0x50')](),'closedAt':_0x3cfa47['closed']?moment(_0x3cfa47[_0x3f1c('0x68')])[_0x3f1c('0x55')](_0x3f1c('0x48'))['toString']():'','disposition':_0x3cfa47[_0x3f1c('0x69')],'messages':_(_0x3cfa47['Messages'])[_0x3f1c('0x46')]({'secret':![]})[_0x3f1c('0x1f')](function(_0x468f08){if(_0x468f08[_0x3f1c('0x5c')]){var _0x122f12=path['join'](_0x322ed0,_0x468f08['Attachment'][_0x3f1c('0x6a')]);if(fs[_0x3f1c('0x6b')](_0x122f12)){fs[_0x3f1c('0x6c')](_0x122f12)['pipe'](fs['createWriteStream'](path[_0x3f1c('0x51')](_0x46c38a,_0x468f08[_0x3f1c('0x5c')]['basename'])));}}return{'date':moment(_0x468f08['createdAt'])[_0x3f1c('0x55')](_0x3f1c('0x48'))[_0x3f1c('0x50')](),'sender':_0x468f08[_0x3f1c('0x5f')]==='out'?_0x468f08[_0x3f1c('0x56')]?_0x468f08[_0x3f1c('0x56')]['fullname']:_0x3f1c('0x6d'):_0x468f08[_0x3f1c('0x5a')][_0x3f1c('0x6e')]+(_0x468f08['Contact'][_0x3f1c('0x6f')]?'\x20'+_0x468f08[_0x3f1c('0x5a')][_0x3f1c('0x6f')]:''),'body':_0x468f08[_0x3f1c('0x5c')]?_0x468f08[_0x3f1c('0x5c')][_0x3f1c('0x6a')]:_0x468f08[_0x3f1c('0x37')],'direction':_0x468f08['direction']==='out'?'A':'C','secret':_0x468f08[_0x3f1c('0x60')],'read':_0x468f08[_0x3f1c('0x61')],'attachment':_0x468f08[_0x3f1c('0x5c')]};})[_0x3f1c('0x70')]()};return ejs['renderFile'](path[_0x3f1c('0x51')](config[_0x3f1c('0x52')],'server',_0x3f1c('0x71'),'downloadInteraction.ejs'),{'interaction':_0x3174d6})['then'](function(_0x28fa8d){var _0x2b2e2c=path['join'](_0x46c38a,'transcript-'+_0x3cfa47['id']+'-'+_0x551d2e+_0x3f1c('0x72'));var _0x1d28b0={'path':_0x2b2e2c,'channel':_0x3f1c('0x65'),'interactionId':_0x3cfa47['id']};return pdf[_0x3f1c('0x73')](_0x28fa8d,_0x1d28b0);})[_0x3f1c('0x18')](function(){return new BPromise(function(_0x3c39ee,_0x3fce14){zipdir(_0x46c38a,{'saveTo':_0x1a495e},function(_0x2908e8,_0x1bcea0){if(_0x2908e8)return _0x3fce14(_0x2908e8);return _0x3c39ee(_0x1bcea0);});})[_0x3f1c('0x18')](function(){return new BPromise(function(_0x534379,_0x539484){rimraf(_0x46c38a,function(_0x2f962c){if(_0x2f962c)_0x539484(_0x2f962c);return _0x534379();});});})[_0x3f1c('0x18')](function(){return _0x11e0bd['download'](_0x1a495e,_0x4b0c25,function(_0x255654){if(_0x255654){console[_0x3f1c('0x74')](_0x3f1c('0x75'),_0x255654);}else{fs[_0x3f1c('0x76')](_0x1a495e);}});});});}else{return _0x11e0bd['sendStatus'](0xc8);}})['catch'](handleError(_0x11e0bd,null));}; \ No newline at end of file +var _0x411f=['WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','update','describe','addMessage','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappInteractionId','filter','$gte','rows','setTags','Tag','color','emit','removeTags','download','toString','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','Account','mkdirSync','Whatsapp','Owner','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','join','basename','createReadStream','pipe','System','out','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','log','err','unlinkSync','rimraf','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','localhost','socket.io-emitter','redis','register','status','json','offset','limit','count','set','Content-Range','then','destroy','sendStatus','error','stack','name','map'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x411f,0x14e));var _0xf411=function(_0x10a542,_0x4893a5){_0x10a542=_0x10a542-0x0;var _0x388527=_0x411f[_0x10a542];return _0x388527;};'use strict';var rimraf=require(_0xf411('0x0'));var zipdir=require('zip-dir');var moment=require(_0xf411('0x1'));var BPromise=require('bluebird');var util=require(_0xf411('0x2'));var path=require('path');var ejs=require(_0xf411('0x3'));var fs=require('fs');var _=require(_0xf411('0x4'));var Redis=require(_0xf411('0x5'));var interaction=require(_0xf411('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0xf411('0x7'));var logger=require(_0xf411('0x8'))(_0xf411('0x9'));var config=require(_0xf411('0xa'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xf411('0xb'),'port':0x18eb});var socket=require(_0xf411('0xc'))(new Redis(config[_0xf411('0xd')]));require('./whatsappInteraction.socket')[_0xf411('0xe')](socket);function respondWithStatusCode(_0x340bdf,_0x2c7ec1){_0x2c7ec1=_0x2c7ec1||0xcc;return function(_0x46402e){if(_0x46402e){return _0x340bdf['sendStatus'](_0x2c7ec1);}return _0x340bdf['status'](_0x2c7ec1)['end']();};}function respondWithResult(_0x8272aa,_0x5471a4){_0x5471a4=_0x5471a4||0xc8;return function(_0x54e555){if(_0x54e555){return _0x8272aa[_0xf411('0xf')](_0x5471a4)[_0xf411('0x10')](_0x54e555);}};}function respondWithFilteredResult(_0x42ffb6,_0x5d46ad){return function(_0x2fe676){if(_0x2fe676){var _0x3e0219=typeof _0x5d46ad[_0xf411('0x11')]==='undefined'&&typeof _0x5d46ad[_0xf411('0x12')]==='undefined';var _0x46d796=_0x2fe676['count'];var _0x6bd0e2=_0x3e0219?0x0:_0x5d46ad['offset'];var _0x44d700=_0x3e0219?_0x2fe676[_0xf411('0x13')]:_0x5d46ad[_0xf411('0x11')]+_0x5d46ad['limit'];var _0x407b17;if(_0x44d700>=_0x46d796){_0x44d700=_0x46d796;_0x407b17=0xc8;}else{_0x407b17=0xce;}_0x42ffb6[_0xf411('0xf')](_0x407b17);return _0x42ffb6[_0xf411('0x14')](_0xf411('0x15'),_0x6bd0e2+'-'+_0x44d700+'/'+_0x46d796)[_0xf411('0x10')](_0x2fe676);}return null;};}function saveUpdates(_0x291a9a){return function(_0x5a66e5){if(_0x5a66e5){return _0x5a66e5['update'](_0x291a9a)[_0xf411('0x16')](function(_0x1b2031){return _0x1b2031;});}return null;};}function removeEntity(_0x1d3333){return function(_0x24c2ef){if(_0x24c2ef){return _0x24c2ef[_0xf411('0x17')]()[_0xf411('0x16')](function(){_0x1d3333[_0xf411('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172a1e){return function(_0x22d594){if(!_0x22d594){_0x172a1e[_0xf411('0x18')](0x194);}return _0x22d594;};}function handleError(_0x50e6dc,_0x58b69e){_0x58b69e=_0x58b69e||0x1f4;return function(_0x180862){logger[_0xf411('0x19')](_0x180862[_0xf411('0x1a')]);if(_0x180862[_0xf411('0x1b')]){delete _0x180862[_0xf411('0x1b')];}_0x50e6dc[_0xf411('0xf')](_0x58b69e)['send'](_0x180862);};}exports['index']=function(_0x255f81,_0x3e3f1b){var _0x43206f={};var _0x4e85d1=_[_0xf411('0x1c')](db[_0xf411('0x1d')][_0xf411('0x1e')],function(_0x95ad9){return{'name':_0x95ad9[_0xf411('0x1f')],'type':_0x95ad9[_0xf411('0x20')][_0xf411('0x21')]};});_0x43206f=qs[_0xf411('0x22')](_0x4e85d1,_0x255f81);return interaction[_0xf411('0x23')](_0xf411('0x24'),_0x255f81[_0xf411('0x25')],_0x255f81['user'],_0x43206f,_0x4e85d1)[_0xf411('0x16')](respondWithFilteredResult(_0x3e3f1b,_0x43206f))[_0xf411('0x26')](handleError(_0x3e3f1b,null));};exports[_0xf411('0x27')]=function(_0x3cf4cd,_0x51be04){var _0x33ac9d={'raw':![],'where':{'id':_0x3cf4cd[_0xf411('0x28')]['id']}},_0x3ba308={};_0x3ba308[_0xf411('0x29')]=_[_0xf411('0x2a')](db[_0xf411('0x1d')]['rawAttributes']);_0x3ba308[_0xf411('0x25')]=_['keys'](_0x3cf4cd[_0xf411('0x25')]);_0x3ba308[_0xf411('0x2b')]=_[_0xf411('0x2c')](_0x3ba308[_0xf411('0x29')],_0x3ba308[_0xf411('0x25')]);_0x33ac9d[_0xf411('0x2d')]=_['intersection'](_0x3ba308[_0xf411('0x29')],qs[_0xf411('0x2e')](_0x3cf4cd[_0xf411('0x25')][_0xf411('0x2e')]));_0x33ac9d[_0xf411('0x2d')]=_0x33ac9d['attributes'][_0xf411('0x2f')]?_0x33ac9d[_0xf411('0x2d')]:_0x3ba308[_0xf411('0x29')];if(_0x3cf4cd[_0xf411('0x25')][_0xf411('0x30')]){_0x33ac9d[_0xf411('0x31')]=[{'all':!![]}];}_0x33ac9d=_[_0xf411('0x32')]({},_0x33ac9d,_0x3cf4cd[_0xf411('0x33')]);return db[_0xf411('0x1d')][_0xf411('0x34')](_0x33ac9d)[_0xf411('0x16')](handleEntityNotFound(_0x51be04,null))[_0xf411('0x16')](respondWithResult(_0x51be04,null))[_0xf411('0x26')](handleError(_0x51be04,null));};exports[_0xf411('0x35')]=function(_0x17f8cb,_0x100f4f){return db['WhatsappInteraction'][_0xf411('0x35')](_0x17f8cb[_0xf411('0x36')],{})[_0xf411('0x16')](respondWithResult(_0x100f4f,0xc9))[_0xf411('0x26')](handleError(_0x100f4f,null));};exports[_0xf411('0x37')]=function(_0xeb9aa2,_0x275711){if(_0xeb9aa2[_0xf411('0x36')]['id']){delete _0xeb9aa2[_0xf411('0x36')]['id'];}return db[_0xf411('0x1d')][_0xf411('0x34')]({'where':{'id':_0xeb9aa2[_0xf411('0x28')]['id']}})[_0xf411('0x16')](handleEntityNotFound(_0x275711,null))[_0xf411('0x16')](saveUpdates(_0xeb9aa2[_0xf411('0x36')],null))[_0xf411('0x16')](respondWithResult(_0x275711,null))['catch'](handleError(_0x275711,null));};exports[_0xf411('0x17')]=function(_0x4cb048,_0x2f58db){return db[_0xf411('0x1d')][_0xf411('0x34')]({'where':{'id':_0x4cb048[_0xf411('0x28')]['id']}})[_0xf411('0x16')](handleEntityNotFound(_0x2f58db,null))[_0xf411('0x16')](removeEntity(_0x2f58db,null))[_0xf411('0x26')](handleError(_0x2f58db,null));};exports['describe']=function(_0x58cffa,_0x44d2b6){return db['WhatsappInteraction'][_0xf411('0x38')]()[_0xf411('0x16')](respondWithResult(_0x44d2b6,null))[_0xf411('0x26')](handleError(_0x44d2b6,null));};exports[_0xf411('0x39')]=function(_0x1d42e5,_0x4eafa6){return db[_0xf411('0x3a')][_0xf411('0x34')]({'where':{'id':_0x1d42e5['params']['id']}})['then'](handleEntityNotFound(_0x4eafa6,null))[_0xf411('0x16')](function(_0x4cdef6){if(_0x4cdef6){return _0x4cdef6[_0xf411('0x39')](_0x1d42e5[_0xf411('0x36')][_0xf411('0x3b')],_[_0xf411('0x3c')](_0x1d42e5[_0xf411('0x36')],['ids','id'])||{});}})['then'](respondWithResult(_0x4eafa6,null))[_0xf411('0x26')](handleError(_0x4eafa6,null));};exports['getMessages']=function(_0xca159,_0x2731dc){var _0x30047b={'raw':![],'where':{}};var _0x56030f={};var _0x31f17c={'count':0x0,'rows':[]};return db[_0xf411('0x1d')][_0xf411('0x3d')]({'where':{'id':_0xca159['params']['id']}})[_0xf411('0x16')](handleEntityNotFound(_0x2731dc,null))[_0xf411('0x16')](function(_0x5a0798){if(_0x5a0798){_0x56030f['model']=_[_0xf411('0x2a')](db[_0xf411('0x3a')]['rawAttributes']);_0x56030f[_0xf411('0x25')]=_[_0xf411('0x2a')](_0xca159[_0xf411('0x25')]);_0x56030f['filters']=_[_0xf411('0x2c')](_0x56030f[_0xf411('0x29')],_0x56030f[_0xf411('0x25')]);_0x30047b[_0xf411('0x2d')]=_[_0xf411('0x2c')](_0x56030f[_0xf411('0x29')],qs[_0xf411('0x2e')](_0xca159['query'][_0xf411('0x2e')]));_0x30047b[_0xf411('0x2d')]=_0x30047b[_0xf411('0x2d')][_0xf411('0x2f')]?_0x30047b['attributes']:_0x56030f[_0xf411('0x29')];if(!_0xca159[_0xf411('0x25')][_0xf411('0x3e')](_0xf411('0x3f'))){_0x30047b[_0xf411('0x12')]=qs['limit'](_0xca159[_0xf411('0x25')][_0xf411('0x12')]);_0x30047b[_0xf411('0x11')]=qs['offset'](_0xca159[_0xf411('0x25')][_0xf411('0x11')]);}_0x30047b[_0xf411('0x40')]=qs[_0xf411('0x41')](_0xca159['query']['sort']);_0x30047b[_0xf411('0x42')]=qs[_0xf411('0x2b')](_[_0xf411('0x43')](_0xca159[_0xf411('0x25')],_0x56030f[_0xf411('0x2b')]));_0x30047b[_0xf411('0x42')][_0xf411('0x44')]=_0x5a0798['id'];if(_0xca159['query'][_0xf411('0x45')]){_0x30047b[_0xf411('0x42')]=_[_0xf411('0x32')](_0x30047b[_0xf411('0x42')],{'$or':_[_0xf411('0x1c')](_0x30047b[_0xf411('0x2d')],function(_0x5a4351){var _0x2e1e1f={};_0x2e1e1f[_0x5a4351]={'$like':'%'+_0xca159[_0xf411('0x25')][_0xf411('0x45')]+'%'};return _0x2e1e1f;})});}if(_0xca159[_0xf411('0x25')][_0xf411('0x46')]){var _0x3a5c6b=_0xca159[_0xf411('0x25')][_0xf411('0x46')]['split'](',');var _0x3f371c={};_0x3f371c[_0x3a5c6b[0x0]]={'$gte':moment(_0x3a5c6b[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x30047b[_0xf411('0x42')]=_['merge'](_0x30047b[_0xf411('0x42')],_0x3f371c);}_0x30047b=_[_0xf411('0x32')]({},_0x30047b,_0xca159[_0xf411('0x33')]);return db[_0xf411('0x3a')][_0xf411('0x13')]({'where':_0x30047b[_0xf411('0x42')]})[_0xf411('0x16')](function(_0x2ce99c){_0x31f17c[_0xf411('0x13')]=_0x2ce99c;if(_0xca159[_0xf411('0x25')][_0xf411('0x30')]){_0x30047b[_0xf411('0x31')]=[{'all':!![]}];}return db[_0xf411('0x3a')][_0xf411('0x23')](_0x30047b);})['then'](function(_0x58dfc4){_0x31f17c[_0xf411('0x47')]=_0x58dfc4;return _0x31f17c;});}})[_0xf411('0x16')](respondWithFilteredResult(_0x2731dc,_0x30047b))[_0xf411('0x26')](handleError(_0x2731dc,null));};exports['addTags']=function(_0x1c0cef,_0x1032f0){return db[_0xf411('0x1d')][_0xf411('0x34')]({'where':{'id':_0x1c0cef[_0xf411('0x28')]['id']}})[_0xf411('0x16')](handleEntityNotFound(_0x1032f0,null))['then'](function(_0x555f59){if(_0x555f59){return _0x555f59[_0xf411('0x48')](_0x1c0cef[_0xf411('0x36')][_0xf411('0x3b')],_[_0xf411('0x3c')](_0x1c0cef[_0xf411('0x36')],[_0xf411('0x3b'),'id'])||{})['spread'](function(){return db[_0xf411('0x49')][_0xf411('0x23')]({'attributes':['id',_0xf411('0x1b'),_0xf411('0x4a')],'where':{'id':_0x1c0cef[_0xf411('0x36')][_0xf411('0x3b')]}});})[_0xf411('0x16')](function(_0x9c65fc){socket[_0xf411('0x4b')]('whatsappInteractionTags:save',{'id':Number(_0x1c0cef[_0xf411('0x28')]['id']),'tags':_0x9c65fc||[]});return{'id':Number(_0x1c0cef[_0xf411('0x28')]['id']),'tags':_0x9c65fc||[]};});}})[_0xf411('0x16')](respondWithResult(_0x1032f0,null))[_0xf411('0x26')](handleError(_0x1032f0,null));};exports[_0xf411('0x4c')]=function(_0x558af5,_0x1f4d0e){return db[_0xf411('0x1d')][_0xf411('0x34')]({'where':{'id':_0x558af5[_0xf411('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f4d0e,null))[_0xf411('0x16')](function(_0x16c723){if(_0x16c723){return _0x16c723['removeTags'](_0x558af5[_0xf411('0x25')][_0xf411('0x3b')]);}})[_0xf411('0x16')](respondWithStatusCode(_0x1f4d0e,null))[_0xf411('0x26')](handleError(_0x1f4d0e,null));};exports[_0xf411('0x4d')]=function(_0x4e0331,_0x33a31e){var _0x4721c2=moment()['unix']()[_0xf411('0x4e')]();var _0x2d5857=path['join'](config[_0xf411('0x4f')],_0xf411('0x50'),_0xf411('0x51'),_0xf411('0x52'));var _0x40f8cb=path['join'](config[_0xf411('0x4f')],_0xf411('0x50'),'files',_0xf411('0x53'));var _0x4539b9=path['join'](_0x2d5857,_0x4721c2);var _0x28011b=util[_0xf411('0x54')](_0xf411('0x55'),_0x4e0331[_0xf411('0x28')]['id'],_0x4721c2);var _0x27a5ce=path['join'](_0x2d5857,_0x28011b);var _0x3b4bfb=[];_0x3b4bfb[_0xf411('0x56')]({'model':db[_0xf411('0x57')],'as':'User','attributes':['id',_0xf411('0x58')],'raw':!![]});_0x3b4bfb[_0xf411('0x56')]({'model':db['CmContact'],'as':_0xf411('0x59'),'attributes':['id',_0xf411('0x5a'),_0xf411('0x5b')],'raw':!![]});if(_0x4e0331[_0xf411('0x25')][_0xf411('0x53')]){_0x3b4bfb[_0xf411('0x56')]({'model':db[_0xf411('0x5c')],'as':_0xf411('0x5c'),'raw':!![]});}var _0x130dca=[{'model':db[_0xf411('0x3a')],'as':_0xf411('0x5d'),'attributes':['id',_0xf411('0x36'),'createdAt',_0xf411('0x5e'),_0xf411('0x5f'),_0xf411('0x60')],'include':_0x3b4bfb}];_0x130dca[_0xf411('0x56')]({'model':db['WhatsappAccount'],'as':_0xf411('0x61'),'attributes':['id',_0xf411('0x1b')]});_0x130dca['push']({'model':db['User'],'as':'Owner','attributes':['id',_0xf411('0x58')]});return db[_0xf411('0x1d')][_0xf411('0x34')]({'where':{'id':_0x4e0331[_0xf411('0x28')]['id']},'include':_0x130dca})[_0xf411('0x16')](handleEntityNotFound(_0x33a31e,null))[_0xf411('0x16')](function(_0x426076){if(_0x426076){var _0x403867=_0x426076['get']({'plain':!![]});fs[_0xf411('0x62')](_0x4539b9);var _0x1745a9={'channel':_0xf411('0x63'),'account':_0x403867[_0xf411('0x61')][_0xf411('0x1b')],'agent':_0x403867[_0xf411('0x64')]?_0x403867[_0xf411('0x64')]['fullname']:_0xf411('0x65'),'createdAt':moment(_0x403867[_0xf411('0x66')])['format'](_0xf411('0x67'))[_0xf411('0x4e')](),'closedAt':_0x403867[_0xf411('0x68')]?moment(_0x403867[_0xf411('0x69')])[_0xf411('0x54')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x403867[_0xf411('0x6a')],'messages':_(_0x403867['Messages'])['filter']({'secret':![]})[_0xf411('0x1c')](function(_0x585fad){if(_0x585fad['Attachment']){var _0x4092fa=path[_0xf411('0x6b')](_0x40f8cb,_0x585fad[_0xf411('0x5c')][_0xf411('0x6c')]);if(fs['existsSync'](_0x4092fa)){fs[_0xf411('0x6d')](_0x4092fa)[_0xf411('0x6e')](fs['createWriteStream'](path['join'](_0x4539b9,_0x585fad[_0xf411('0x5c')][_0xf411('0x6c')])));}}return{'date':moment(_0x585fad['createdAt'])[_0xf411('0x54')](_0xf411('0x67'))[_0xf411('0x4e')](),'sender':_0x585fad[_0xf411('0x5e')]==='out'?_0x585fad[_0xf411('0x57')]?_0x585fad[_0xf411('0x57')][_0xf411('0x58')]:_0xf411('0x6f'):_0x585fad[_0xf411('0x59')][_0xf411('0x5a')]+(_0x585fad['Contact'][_0xf411('0x5b')]?'\x20'+_0x585fad[_0xf411('0x59')][_0xf411('0x5b')]:''),'body':_0x585fad[_0xf411('0x5c')]?_0x585fad[_0xf411('0x5c')]['basename']:_0x585fad[_0xf411('0x36')],'direction':_0x585fad[_0xf411('0x5e')]===_0xf411('0x70')?'A':'C','secret':_0x585fad['secret'],'read':_0x585fad[_0xf411('0x60')],'attachment':_0x585fad[_0xf411('0x5c')]};})[_0xf411('0x71')]()};return ejs[_0xf411('0x72')](path[_0xf411('0x6b')](config['root'],_0xf411('0x50'),'views',_0xf411('0x73')),{'interaction':_0x1745a9})['then'](function(_0x257fb0){var _0x2728af=path[_0xf411('0x6b')](_0x4539b9,_0xf411('0x74')+_0x403867['id']+'-'+_0x4721c2+_0xf411('0x75'));var _0x32c2e4={'path':_0x2728af,'channel':'Whatsapp','interactionId':_0x403867['id']};return pdf['createPdfFromHTML'](_0x257fb0,_0x32c2e4);})[_0xf411('0x16')](function(){return new BPromise(function(_0x20f339,_0x4469a6){zipdir(_0x4539b9,{'saveTo':_0x27a5ce},function(_0x23f3d5,_0x23b3b0){if(_0x23f3d5)return _0x4469a6(_0x23f3d5);return _0x20f339(_0x23b3b0);});})['then'](function(){return new BPromise(function(_0x3439f9,_0x2da691){rimraf(_0x4539b9,function(_0x425d48){if(_0x425d48)_0x2da691(_0x425d48);return _0x3439f9();});});})[_0xf411('0x16')](function(){return _0x33a31e[_0xf411('0x4d')](_0x27a5ce,_0x28011b,function(_0x425e3c){if(_0x425e3c){console[_0xf411('0x76')](_0xf411('0x77'),_0x425e3c);}else{fs[_0xf411('0x78')](_0x27a5ce);}});});});}else{return _0x33a31e[_0xf411('0x18')](0xc8);}})[_0xf411('0x26')](handleError(_0x33a31e,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 5dca6d0..e2d99d6 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 _0x0434=['catch','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','remove','then','map','findAll','setDataValue','unreadMessages','length','emit'];(function(_0x2cb472,_0x483e33){var _0x1abf19=function(_0xa791cb){while(--_0xa791cb){_0x2cb472['push'](_0x2cb472['shift']());}};_0x1abf19(++_0x483e33);}(_0x0434,0x1ad));var _0x4043=function(_0x23b655,_0x4feb2b){_0x23b655=_0x23b655-0x0;var _0x364b32=_0x0434[_0x23b655];return _0x364b32;};'use strict';var EventEmitter=require(_0x4043('0x0'));var WhatsappInteraction=require(_0x4043('0x1'))['db'][_0x4043('0x2')];var WhatsappMessage=require(_0x4043('0x1'))['db'][_0x4043('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4043('0x4'),'afterDestroy':_0x4043('0x5')};function emitEvent(_0x3e475f){return function(_0x2e1aec,_0x424a16,_0x1dba57){_0x2e1aec['getUsers']({'attributes':['id'],'raw':!![]})[_0x4043('0x6')](function(_0x1ed6c4){_0x2e1aec['setDataValue']('Users',_0x1ed6c4[_0x4043('0x7')](function(_0x2b959b){return{'id':_0x2b959b['id']};}));return WhatsappMessage[_0x4043('0x8')]({'where':{'WhatsappInteractionId':_0x2e1aec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4043('0x6')](function(_0x30f083){_0x2e1aec[_0x4043('0x9')](_0x4043('0xa'),_0x30f083[_0x4043('0xb')]);WhatsappInteractionEvents['emit'](_0x3e475f+':'+_0x2e1aec['id'],_0x2e1aec);WhatsappInteractionEvents[_0x4043('0xc')](_0x3e475f,_0x2e1aec);_0x1dba57(null);})[_0x4043('0xd')](_0x1dba57(null));};}for(var e in events){if(events[_0x4043('0xe')](e)){var event=events[e];WhatsappInteraction[_0x4043('0xf')](e,emitEvent(event));}}module[_0x4043('0x10')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xa902=['WhatsappInteraction','WhatsappMessage','save','getUsers','then','setDataValue','findAll','length','emit','catch','hook','events','../../mysqldb'];(function(_0x9fd887,_0x47f76c){var _0x1a54ab=function(_0xb65c08){while(--_0xb65c08){_0x9fd887['push'](_0x9fd887['shift']());}};_0x1a54ab(++_0x47f76c);}(_0xa902,0x8d));var _0x2a90=function(_0x5c136e,_0x451813){_0x5c136e=_0x5c136e-0x0;var _0x30019c=_0xa902[_0x5c136e];return _0x30019c;};'use strict';var EventEmitter=require(_0x2a90('0x0'));var WhatsappInteraction=require(_0x2a90('0x1'))['db'][_0x2a90('0x2')];var WhatsappMessage=require(_0x2a90('0x1'))['db'][_0x2a90('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2a90('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x169808){return function(_0x2b40c0,_0x203ecf,_0x21e1d2){_0x2b40c0[_0x2a90('0x5')]({'attributes':['id'],'raw':!![]})[_0x2a90('0x6')](function(_0x58369a){_0x2b40c0[_0x2a90('0x7')]('Users',_0x58369a['map'](function(_0xc75b6e){return{'id':_0xc75b6e['id']};}));return WhatsappMessage[_0x2a90('0x8')]({'where':{'WhatsappInteractionId':_0x2b40c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2a90('0x6')](function(_0x2b0a20){_0x2b40c0[_0x2a90('0x7')]('unreadMessages',_0x2b0a20[_0x2a90('0x9')]);WhatsappInteractionEvents[_0x2a90('0xa')](_0x169808+':'+_0x2b40c0['id'],_0x2b40c0);WhatsappInteractionEvents[_0x2a90('0xa')](_0x169808,_0x2b40c0);_0x21e1d2(null);})[_0x2a90('0xb')](_0x21e1d2(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x2a90('0xc')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index c19ea47..603a486 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 _0x09d1=['WhatsappInteraction','whatsapp_interactions','closed','format','util','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define'];(function(_0xfb9d2d,_0x4067c9){var _0xd2eac7=function(_0x4b597f){while(--_0x4b597f){_0xfb9d2d['push'](_0xfb9d2d['shift']());}};_0xd2eac7(++_0x4067c9);}(_0x09d1,0xac));var _0x109d=function(_0x58b8d6,_0x2611e6){_0x58b8d6=_0x58b8d6-0x0;var _0x21d2b5=_0x09d1[_0x58b8d6];return _0x21d2b5;};'use strict';var _=require('lodash');var util=require(_0x109d('0x0'));var logger=require('../../config/logger')(_0x109d('0x1'));var moment=require(_0x109d('0x2'));var BPromise=require(_0x109d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x109d('0x4'));var rimraf=require(_0x109d('0x5'));var config=require(_0x109d('0x6'));var attributes=require(_0x109d('0x7'));module[_0x109d('0x8')]=function(_0x3fa215,_0x12a700){return _0x3fa215[_0x109d('0x9')](_0x109d('0xa'),attributes,{'tableName':_0x109d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x58132d,_0x5181dc,_0x3c894e){if(_0x58132d['changed'](_0x109d('0xc'))){_0x58132d['closedAt']=moment()[_0x109d('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3c894e(null,_0x58132d);}}});}; \ No newline at end of file +var _0x6d6d=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x340be0,_0x7a8caf){var _0x226a31=function(_0x26d1c0){while(--_0x26d1c0){_0x340be0['push'](_0x340be0['shift']());}};_0x226a31(++_0x7a8caf);}(_0x6d6d,0xd2));var _0xd6d6=function(_0x5db3ff,_0x2c4fda){_0x5db3ff=_0x5db3ff-0x0;var _0x4329d6=_0x6d6d[_0x5db3ff];return _0x4329d6;};'use strict';var _=require('lodash');var util=require(_0xd6d6('0x0'));var logger=require(_0xd6d6('0x1'))(_0xd6d6('0x2'));var moment=require('moment');var BPromise=require(_0xd6d6('0x3'));var rp=require(_0xd6d6('0x4'));var fs=require('fs');var path=require(_0xd6d6('0x5'));var rimraf=require(_0xd6d6('0x6'));var config=require(_0xd6d6('0x7'));var attributes=require(_0xd6d6('0x8'));module[_0xd6d6('0x9')]=function(_0x1539cd,_0x45a8ec){return _0x1539cd['define']('WhatsappInteraction',attributes,{'tableName':_0xd6d6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4cba4e,_0x34705e,_0xcb9639){if(_0x4cba4e['changed'](_0xd6d6('0xb'))){_0x4cba4e[_0xd6d6('0xc')]=moment()[_0xd6d6('0xd')](_0xd6d6('0xe'));}_0xcb9639(null,_0x4cba4e);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 3bcfd4f..96bc226 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 _0xca96=['result','catch','UpdateWhatsappInteraction','WhatsappInteraction','body','options','where','debug','find','addTags','omit','ids','spread','AddTags','util','moment','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info'];(function(_0x38fc06,_0x295510){var _0x9d818c=function(_0xd12d38){while(--_0xd12d38){_0x38fc06['push'](_0x38fc06['shift']());}};_0x9d818c(++_0x295510);}(_0xca96,0x111));var _0x6ca9=function(_0x5b05cc,_0x416758){_0x5b05cc=_0x5b05cc-0x0;var _0x45b14e=_0xca96[_0x5b05cc];return _0x45b14e;};'use strict';var _=require('lodash');var util=require(_0x6ca9('0x0'));var moment=require(_0x6ca9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ca9('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ca9('0x3'))(_0x6ca9('0x4'));var config=require('../../config/environment');var jayson=require(_0x6ca9('0x5'));var client=jayson[_0x6ca9('0x6')][_0x6ca9('0x7')]({'port':0x232a});config[_0x6ca9('0x8')]=_[_0x6ca9('0x9')](config[_0x6ca9('0x8')],{'host':_0x6ca9('0xa'),'port':0x18eb});var socket=require(_0x6ca9('0xb'))(new Redis(config[_0x6ca9('0x8')]));require(_0x6ca9('0xc'))[_0x6ca9('0xd')](socket);function respondWithRpcPromise(_0x112e24,_0x4cfd10,_0x30e8e2){return new BPromise(function(_0x521dd3,_0x3d2b52){return client[_0x6ca9('0xe')](_0x112e24,_0x30e8e2)[_0x6ca9('0xf')](function(_0x5d5d88){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x4cfd10,_0x6ca9('0x10'));logger['debug']('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x4cfd10,_0x6ca9('0x10'),JSON[_0x6ca9('0x11')](_0x5d5d88));if(_0x5d5d88[_0x6ca9('0x12')]){if(_0x5d5d88[_0x6ca9('0x12')][_0x6ca9('0x13')]===0x1f4){logger[_0x6ca9('0x12')](_0x6ca9('0x14'),_0x4cfd10,_0x5d5d88[_0x6ca9('0x12')][_0x6ca9('0x15')]);return _0x3d2b52(_0x5d5d88[_0x6ca9('0x12')][_0x6ca9('0x15')]);}logger[_0x6ca9('0x12')](_0x6ca9('0x14'),_0x4cfd10,_0x5d5d88['error']['message']);return _0x521dd3(_0x5d5d88[_0x6ca9('0x12')][_0x6ca9('0x15')]);}else{logger[_0x6ca9('0x16')](_0x6ca9('0x14'),_0x4cfd10,'request\x20sent');_0x521dd3(_0x5d5d88[_0x6ca9('0x17')][_0x6ca9('0x15')]);}})[_0x6ca9('0x18')](function(_0x418c97){logger[_0x6ca9('0x12')](_0x6ca9('0x14'),_0x4cfd10,_0x418c97);_0x3d2b52(_0x418c97);});});}exports[_0x6ca9('0x19')]=function(_0x1f0d3f){var _0x475e79=this;return new Promise(function(_0x57bfdb,_0x35c7cb){return db[_0x6ca9('0x1a')]['update'](_0x1f0d3f[_0x6ca9('0x1b')],{'raw':_0x1f0d3f[_0x6ca9('0x1c')]?_0x1f0d3f[_0x6ca9('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0d3f[_0x6ca9('0x1c')]?_0x1f0d3f[_0x6ca9('0x1c')][_0x6ca9('0x1d')]||null:null,'attributes':_0x1f0d3f['options']?_0x1f0d3f['options']['attributes']||null:null,'limit':_0x1f0d3f[_0x6ca9('0x1c')]?_0x1f0d3f[_0x6ca9('0x1c')]['limit']||null:null})[_0x6ca9('0xf')](function(_0x51a737){logger[_0x6ca9('0x16')](_0x6ca9('0x19'),_0x1f0d3f);logger[_0x6ca9('0x1e')]('UpdateWhatsappInteraction',_0x1f0d3f,JSON[_0x6ca9('0x11')](_0x51a737));_0x57bfdb(_0x51a737);})[_0x6ca9('0x18')](function(_0x4f3549){logger[_0x6ca9('0x12')](_0x6ca9('0x19'),_0x4f3549['message'],_0x1f0d3f);_0x35c7cb(_0x475e79[_0x6ca9('0x12')](0x1f4,_0x4f3549['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x363fa9){return new Promise(function(_0x5c52d4,_0x32db14){return db[_0x6ca9('0x1a')][_0x6ca9('0x1f')]({'where':_0x363fa9[_0x6ca9('0x1c')]?_0x363fa9['options'][_0x6ca9('0x1d')]||null:null})['then'](function(_0x2673fc){if(_0x2673fc){return _0x2673fc[_0x6ca9('0x20')](_0x363fa9[_0x6ca9('0x1b')]['ids'],_[_0x6ca9('0x21')](_0x363fa9[_0x6ca9('0x1b')],[_0x6ca9('0x22'),'id'])||{});}})[_0x6ca9('0x23')](function(_0x5158ba){logger[_0x6ca9('0x16')](_0x6ca9('0x24'),_0x363fa9);logger['debug'](_0x6ca9('0x24'),_0x363fa9,JSON['stringify'](_0x5158ba));_0x5c52d4(_0x5158ba);})['catch'](function(_0x585393){logger[_0x6ca9('0x12')](_0x6ca9('0x24'),_0x585393[_0x6ca9('0x15')],_0x363fa9);_0x32db14(_this[_0x6ca9('0x12')](0x1f4,_0x585393[_0x6ca9('0x15')]));});});}; \ No newline at end of file +var _0xa11e=['result','catch','UpdateWhatsappInteraction','update','options','limit','stringify','AddTagsToWhatsappInteraction','WhatsappInteraction','where','addTags','body','ids','omit','AddTags','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','error','code','message'];(function(_0xa8b370,_0x2b77db){var _0x643e37=function(_0x1486eb){while(--_0x1486eb){_0xa8b370['push'](_0xa8b370['shift']());}};_0x643e37(++_0x2b77db);}(_0xa11e,0x1e3));var _0xea11=function(_0x205b05,_0x5c50e2){_0x205b05=_0x205b05-0x0;var _0x254e78=_0xa11e[_0x205b05];return _0x254e78;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xea11('0x0'));var BPromise=require(_0xea11('0x1'));var rs=require(_0xea11('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea11('0x3'))['db'];var utils=require(_0xea11('0x4'));var logger=require(_0xea11('0x5'))(_0xea11('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xea11('0x7')]['http']({'port':0x232a});config[_0xea11('0x8')]=_[_0xea11('0x9')](config[_0xea11('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xea11('0xa'))(new Redis(config[_0xea11('0x8')]));require(_0xea11('0xb'))[_0xea11('0xc')](socket);function respondWithRpcPromise(_0x38bbff,_0x81ce5f,_0x3cd648){return new BPromise(function(_0x3f5edb,_0x367a9){return client[_0xea11('0xd')](_0x38bbff,_0x3cd648)[_0xea11('0xe')](function(_0x4f937a){logger[_0xea11('0xf')](_0xea11('0x10'),_0x81ce5f,'request\x20sent');logger[_0xea11('0x11')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x81ce5f,'request\x20sent',JSON['stringify'](_0x4f937a));if(_0x4f937a[_0xea11('0x12')]){if(_0x4f937a['error'][_0xea11('0x13')]===0x1f4){logger[_0xea11('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x81ce5f,_0x4f937a[_0xea11('0x12')]['message']);return _0x367a9(_0x4f937a[_0xea11('0x12')][_0xea11('0x14')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x81ce5f,_0x4f937a[_0xea11('0x12')]['message']);return _0x3f5edb(_0x4f937a[_0xea11('0x12')][_0xea11('0x14')]);}else{logger['info'](_0xea11('0x10'),_0x81ce5f,'request\x20sent');_0x3f5edb(_0x4f937a[_0xea11('0x15')][_0xea11('0x14')]);}})[_0xea11('0x16')](function(_0x51c4d9){logger['error'](_0xea11('0x10'),_0x81ce5f,_0x51c4d9);_0x367a9(_0x51c4d9);});});}exports[_0xea11('0x17')]=function(_0x388a12){var _0x4c7959=this;return new Promise(function(_0x10195e,_0x289aba){return db['WhatsappInteraction'][_0xea11('0x18')](_0x388a12['body'],{'raw':_0x388a12['options']?_0x388a12[_0xea11('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x388a12['options']?_0x388a12['options']['where']||null:null,'attributes':_0x388a12[_0xea11('0x19')]?_0x388a12['options']['attributes']||null:null,'limit':_0x388a12[_0xea11('0x19')]?_0x388a12[_0xea11('0x19')][_0xea11('0x1a')]||null:null})[_0xea11('0xe')](function(_0x3abea8){logger[_0xea11('0xf')](_0xea11('0x17'),_0x388a12);logger[_0xea11('0x11')](_0xea11('0x17'),_0x388a12,JSON[_0xea11('0x1b')](_0x3abea8));_0x10195e(_0x3abea8);})['catch'](function(_0x4dbfbe){logger[_0xea11('0x12')](_0xea11('0x17'),_0x4dbfbe[_0xea11('0x14')],_0x388a12);_0x289aba(_0x4c7959[_0xea11('0x12')](0x1f4,_0x4dbfbe[_0xea11('0x14')]));});});};exports[_0xea11('0x1c')]=function(_0x198632){return new Promise(function(_0x1dc039,_0x474b11){return db[_0xea11('0x1d')]['find']({'where':_0x198632[_0xea11('0x19')]?_0x198632['options'][_0xea11('0x1e')]||null:null})[_0xea11('0xe')](function(_0x25c975){if(_0x25c975){return _0x25c975[_0xea11('0x1f')](_0x198632[_0xea11('0x20')][_0xea11('0x21')],_[_0xea11('0x22')](_0x198632[_0xea11('0x20')],[_0xea11('0x21'),'id'])||{});}})['spread'](function(_0x457625){logger['info'](_0xea11('0x23'),_0x198632);logger[_0xea11('0x11')](_0xea11('0x23'),_0x198632,JSON[_0xea11('0x1b')](_0x457625));_0x1dc039(_0x457625);})[_0xea11('0x16')](function(_0x15b1f6){logger['error'](_0xea11('0x23'),_0x15b1f6['message'],_0x198632);_0x474b11(_this[_0xea11('0x12')](0x1f4,_0x15b1f6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index b1da1d2..ede59ca 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 _0x21a1=['emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x4702ee,_0xaf6a45){var _0x62ca7d=function(_0x5b3af7){while(--_0x5b3af7){_0x4702ee['push'](_0x4702ee['shift']());}};_0x62ca7d(++_0xaf6a45);}(_0x21a1,0x6c));var _0x121a=function(_0x20a8e6,_0x4accde){_0x20a8e6=_0x20a8e6-0x0;var _0x100769=_0x21a1[_0x20a8e6];return _0x100769;};'use strict';var WhatsappInteractionEvents=require(_0x121a('0x0'));var events=[_0x121a('0x1'),_0x121a('0x2'),_0x121a('0x3')];function createListener(_0x480881,_0x1c6b58){return function(_0x312e67){_0x1c6b58[_0x121a('0x4')](_0x480881,_0x312e67);};}function removeListener(_0x131c7b,_0x4c7d2e){return function(){WhatsappInteractionEvents[_0x121a('0x5')](_0x131c7b,_0x4c7d2e);};}exports[_0x121a('0x6')]=function(_0x59131b){for(var _0x3626f3=0x0,_0x2587a9=events['length'];_0x3626f3<_0x2587a9;_0x3626f3++){var _0x6c525f=events[_0x3626f3];var _0x336dc2=createListener(_0x121a('0x7')+_0x6c525f,_0x59131b);WhatsappInteractionEvents['on'](_0x6c525f,_0x336dc2);}}; \ No newline at end of file +var _0xe6b8=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','remove'];(function(_0x25b410,_0x4bdbd4){var _0x4a14bb=function(_0x21aa68){while(--_0x21aa68){_0x25b410['push'](_0x25b410['shift']());}};_0x4a14bb(++_0x4bdbd4);}(_0xe6b8,0xde));var _0x8e6b=function(_0x522388,_0x1d9bfb){_0x522388=_0x522388-0x0;var _0x1dff61=_0xe6b8[_0x522388];return _0x1dff61;};'use strict';var WhatsappInteractionEvents=require(_0x8e6b('0x0'));var events=['save',_0x8e6b('0x1'),_0x8e6b('0x2')];function createListener(_0x202a8e,_0x1b7d47){return function(_0x17d167){_0x1b7d47[_0x8e6b('0x3')](_0x202a8e,_0x17d167);};}function removeListener(_0x52532e,_0xeda94e){return function(){WhatsappInteractionEvents[_0x8e6b('0x4')](_0x52532e,_0xeda94e);};}exports[_0x8e6b('0x5')]=function(_0x5b55c1){for(var _0x25dc42=0x0,_0xf70106=events[_0x8e6b('0x6')];_0x25dc42<_0xf70106;_0x25dc42++){var _0x4e6447=events[_0x25dc42];var _0x273cfe=createListener(_0x8e6b('0x7')+_0x4e6447,_0x5b55c1);WhatsappInteractionEvents['on'](_0x4e6447,_0x273cfe);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9d57b75..b33a542 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 _0xf19d=['isAuthenticated','index','get','/describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x1b307b,_0x5f4370){var _0x5de8dc=function(_0x1d5c47){while(--_0x1d5c47){_0x1b307b['push'](_0x1b307b['shift']());}};_0x5de8dc(++_0x5f4370);}(_0xf19d,0xc7));var _0xdf19=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xf19d[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var path=require(_0xdf19('0x2'));var timeout=require(_0xdf19('0x3'));var express=require(_0xdf19('0x4'));var router=express[_0xdf19('0x5')]();var fs_extra=require(_0xdf19('0x6'));var auth=require(_0xdf19('0x7'));var interaction=require(_0xdf19('0x8'));var config=require(_0xdf19('0x9'));var controller=require(_0xdf19('0xa'));router['get']('/',auth[_0xdf19('0xb')](),controller[_0xdf19('0xc')]);router[_0xdf19('0xd')](_0xdf19('0xe'),auth[_0xdf19('0xb')](),controller['describe']);router[_0xdf19('0xd')](_0xdf19('0xf'),auth[_0xdf19('0xb')](),controller[_0xdf19('0x10')]);router[_0xdf19('0x11')]('/',auth[_0xdf19('0xb')](),interaction[_0xdf19('0x12')](_0xdf19('0x13'),_0xdf19('0x14')),controller[_0xdf19('0x15')]);router[_0xdf19('0x11')]('/:id/status',controller[_0xdf19('0x16')]);router[_0xdf19('0x17')](_0xdf19('0xf'),auth[_0xdf19('0xb')](),controller['update']);router[_0xdf19('0x17')](_0xdf19('0x18'),auth[_0xdf19('0xb')](),controller[_0xdf19('0x19')]);router[_0xdf19('0x17')](_0xdf19('0x1a'),auth[_0xdf19('0xb')](),controller[_0xdf19('0x1b')]);router[_0xdf19('0x1c')](_0xdf19('0xf'),auth[_0xdf19('0xb')](),controller['destroy']);module[_0xdf19('0x1d')]=router; \ No newline at end of file +var _0xb8b8=['reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','whatsapp','whatsappmessage:create','/:id/status','status','put','update','/:id/accept'];(function(_0x526fb4,_0x8f1eb8){var _0xcc91e5=function(_0x282032){while(--_0x282032){_0x526fb4['push'](_0x526fb4['shift']());}};_0xcc91e5(++_0x8f1eb8);}(_0xb8b8,0x1b9));var _0x8b8b=function(_0x26234e,_0x5f35da){_0x26234e=_0x26234e-0x0;var _0x547c65=_0xb8b8[_0x26234e];return _0x547c65;};'use strict';var multer=require(_0x8b8b('0x0'));var util=require(_0x8b8b('0x1'));var path=require(_0x8b8b('0x2'));var timeout=require('connect-timeout');var express=require(_0x8b8b('0x3'));var router=express[_0x8b8b('0x4')]();var fs_extra=require(_0x8b8b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b8b('0x6'));var config=require(_0x8b8b('0x7'));var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x8b8b('0x8')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x8b8b('0x9')](_0x8b8b('0xa'),auth[_0x8b8b('0x8')](),controller['show']);router[_0x8b8b('0xb')]('/',auth[_0x8b8b('0x8')](),interaction['tracked'](_0x8b8b('0xc'),_0x8b8b('0xd')),controller['create']);router['post'](_0x8b8b('0xe'),controller[_0x8b8b('0xf')]);router[_0x8b8b('0x10')](_0x8b8b('0xa'),auth[_0x8b8b('0x8')](),controller[_0x8b8b('0x11')]);router[_0x8b8b('0x10')](_0x8b8b('0x12'),auth[_0x8b8b('0x8')](),controller['accept']);router[_0x8b8b('0x10')]('/:id/reject',auth[_0x8b8b('0x8')](),controller[_0x8b8b('0x13')]);router[_0x8b8b('0x14')]('/:id',auth[_0x8b8b('0x8')](),controller[_0x8b8b('0x15')]);module[_0x8b8b('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 89800ac..bfb33b0 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 _0x2d83=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0xdc1188,_0x59a276){var _0x56c881=function(_0x27b2d7){while(--_0x27b2d7){_0xdc1188['push'](_0xdc1188['shift']());}};_0x56c881(++_0x59a276);}(_0x2d83,0x1dc));var _0x32d8=function(_0x23dd27,_0x16f544){_0x23dd27=_0x23dd27-0x0;var _0x27209f=_0x2d83[_0x23dd27];return _0x27209f;};'use strict';var Sequelize=require(_0x32d8('0x0'));module[_0x32d8('0x1')]={'body':{'type':Sequelize[_0x32d8('0x2')](_0x32d8('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x32d8('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x32d8('0x5')]('in',_0x32d8('0x6')),'defaultValue':_0x32d8('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x32d8('0x7')]},'readAt':{'type':Sequelize[_0x32d8('0x8')]},'secret':{'type':Sequelize[_0x32d8('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x32d8('0x7')]},'providerResponse':{'type':Sequelize[_0x32d8('0x2')]}}; \ No newline at end of file +var _0x5ede=['STRING','DATE','sequelize','medium','BOOLEAN','out'];(function(_0x5a5dc9,_0x436f28){var _0x262950=function(_0x37a46c){while(--_0x37a46c){_0x5a5dc9['push'](_0x5a5dc9['shift']());}};_0x262950(++_0x436f28);}(_0x5ede,0x13a));var _0xe5ed=function(_0x2eef18,_0x3e708d){_0x2eef18=_0x2eef18-0x0;var _0x4e215f=_0x5ede[_0x2eef18];return _0x4e215f;};'use strict';var Sequelize=require(_0xe5ed('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xe5ed('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xe5ed('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xe5ed('0x3')),'defaultValue':_0xe5ed('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe5ed('0x4')](0xbe)},'phone':{'type':Sequelize[_0xe5ed('0x4')]},'readAt':{'type':Sequelize[_0xe5ed('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'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 0a8a546..d4148d9 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 _0xd246=['querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','json','offset','undefined','count','limit','status','apply','update','destroy','end','name','send','map','WhatsappMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','params','options','create','body','describe','whatsapp-interactions','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','find','get','WhatsappInteraction','isNil','read1stAt','interaction','user','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','reject','whatsapp','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x10cd14,_0x6e6edc){var _0x72228c=function(_0x36353d){while(--_0x36353d){_0x10cd14['push'](_0x10cd14['shift']());}};_0x72228c(++_0x6e6edc);}(_0xd246,0x76));var _0x6d24=function(_0x343dfb,_0xed8587){_0x343dfb=_0x343dfb-0x0;var _0x297fe2=_0xd246[_0x343dfb];return _0x297fe2;};'use strict';var emlformat=require(_0x6d24('0x0'));var rimraf=require(_0x6d24('0x1'));var zipdir=require(_0x6d24('0x2'));var jsonpatch=require(_0x6d24('0x3'));var rp=require(_0x6d24('0x4'));var moment=require(_0x6d24('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6d24('0x6'));var util=require(_0x6d24('0x7'));var path=require(_0x6d24('0x8'));var sox=require('sox');var csv=require(_0x6d24('0x9'));var ejs=require(_0x6d24('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6d24('0xb'));var squel=require(_0x6d24('0xc'));var crypto=require(_0x6d24('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6d24('0xe'));var toCsv=require(_0x6d24('0x9'));var querystring=require(_0x6d24('0xf'));var Papa=require(_0x6d24('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6d24('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6d24('0x12'));var logger=require(_0x6d24('0x13'))('api');var utils=require(_0x6d24('0x14'));var config=require(_0x6d24('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x6d24('0x16')]=_['defaults'](config[_0x6d24('0x16')],{'host':_0x6d24('0x17'),'port':0x18eb});var socket=require(_0x6d24('0x18'))(new Redis(config['redis']));require(_0x6d24('0x19'))[_0x6d24('0x1a')](socket);var jayson=require(_0x6d24('0x1b'));var client=jayson['client'][_0x6d24('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0x6d24('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x56241b,_0x3e8d40,_0x2dafd9,_0x4fc49d){return new BPromise(function(_0x100020,_0x46b31a){var _0x3856c2=_0x4fc49d||client;return _0x3856c2['request'](_0x56241b,_0x2dafd9)[_0x6d24('0x1d')](function(_0xd4a183){logger['info'](_0x6d24('0x1e'),_0x3e8d40,_0x6d24('0x1f'));logger[_0x6d24('0x20')](_0x6d24('0x21'),_0x3e8d40,_0x6d24('0x1f'),JSON[_0x6d24('0x22')](_0xd4a183));if(_0xd4a183[_0x6d24('0x23')]){if(_0xd4a183[_0x6d24('0x23')][_0x6d24('0x24')]===0x1f4){logger[_0x6d24('0x23')](_0x6d24('0x1e'),_0x3e8d40,_0xd4a183['error']['message']);return _0x46b31a(_0xd4a183[_0x6d24('0x23')][_0x6d24('0x25')]);}logger[_0x6d24('0x23')](_0x6d24('0x1e'),_0x3e8d40,_0xd4a183[_0x6d24('0x23')][_0x6d24('0x25')]);return _0x100020(_0xd4a183['error']['message']);}else{logger[_0x6d24('0x26')](_0x6d24('0x1e'),_0x3e8d40,_0x6d24('0x1f'));_0x100020(_0xd4a183['result'][_0x6d24('0x25')]);}})['catch'](function(_0x849030){logger[_0x6d24('0x23')](_0x6d24('0x1e'),_0x3e8d40,_0x849030);_0x46b31a(_0x849030);});});}function respondWithStatusCode(_0xe30449,_0x3c8d08){_0x3c8d08=_0x3c8d08||0xcc;return function(_0x42d08e){if(_0x42d08e){return _0xe30449[_0x6d24('0x27')](_0x3c8d08);}return _0xe30449['status'](_0x3c8d08)['end']();};}function respondWithResult(_0x2eb262,_0x58fbb7){_0x58fbb7=_0x58fbb7||0xc8;return function(_0x140918){if(_0x140918){return _0x2eb262['status'](_0x58fbb7)[_0x6d24('0x28')](_0x140918);}};}function respondWithFilteredResult(_0xc32e3f,_0x2aa1d1){return function(_0xd07e8b){if(_0xd07e8b){var _0xcc9959=typeof _0x2aa1d1[_0x6d24('0x29')]===_0x6d24('0x2a')&&typeof _0x2aa1d1['limit']===_0x6d24('0x2a');var _0x1559c9=_0xd07e8b[_0x6d24('0x2b')];var _0x4422ee=_0xcc9959?0x0:_0x2aa1d1[_0x6d24('0x29')];var _0xf4d9e0=_0xcc9959?_0xd07e8b[_0x6d24('0x2b')]:_0x2aa1d1['offset']+_0x2aa1d1[_0x6d24('0x2c')];var _0x11f593;if(_0xf4d9e0>=_0x1559c9){_0xf4d9e0=_0x1559c9;_0x11f593=0xc8;}else{_0x11f593=0xce;}_0xc32e3f[_0x6d24('0x2d')](_0x11f593);return _0xc32e3f['set']('Content-Range',_0x4422ee+'-'+_0xf4d9e0+'/'+_0x1559c9)[_0x6d24('0x28')](_0xd07e8b);}return null;};}function patchUpdates(_0x11d219){return function(_0x40d8ff){try{jsonpatch[_0x6d24('0x2e')](_0x40d8ff,_0x11d219,!![]);}catch(_0x22b53c){return BPromise['reject'](_0x22b53c);}return _0x40d8ff['save']();};}function saveUpdates(_0x5e0a7c,_0x33ab82){return function(_0x3796d0){if(_0x3796d0){return _0x3796d0[_0x6d24('0x2f')](_0x5e0a7c)[_0x6d24('0x1d')](function(_0x1c17e4){return _0x1c17e4;});}return null;};}function removeEntity(_0x3adffa,_0x31ae0f){return function(_0x3c4501){if(_0x3c4501){return _0x3c4501[_0x6d24('0x30')]()[_0x6d24('0x1d')](function(){_0x3adffa[_0x6d24('0x2d')](0xcc)[_0x6d24('0x31')]();});}};}function handleEntityNotFound(_0x1d7207,_0x1f9baf){return function(_0x22e554){if(!_0x22e554){_0x1d7207[_0x6d24('0x27')](0x194);}return _0x22e554;};}function handleError(_0x1cc37f,_0x39a147){_0x39a147=_0x39a147||0x1f4;return function(_0x1a4fb8){logger[_0x6d24('0x23')](_0x1a4fb8['stack']);if(_0x1a4fb8[_0x6d24('0x32')]){delete _0x1a4fb8[_0x6d24('0x32')];}_0x1cc37f[_0x6d24('0x2d')](_0x39a147)[_0x6d24('0x33')](_0x1a4fb8);};}exports['index']=function(_0x34d2f5,_0x473ed1){var _0x3b82a3={},_0x4ab0a1={},_0x59e7c7={'count':0x0,'rows':[]};var _0x28da45=_[_0x6d24('0x34')](db[_0x6d24('0x35')][_0x6d24('0x36')],function(_0x3de7e9){return{'name':_0x3de7e9[_0x6d24('0x37')],'type':_0x3de7e9['type'][_0x6d24('0x38')]};});_0x4ab0a1[_0x6d24('0x39')]=_[_0x6d24('0x34')](_0x28da45,_0x6d24('0x32'));_0x4ab0a1[_0x6d24('0x3a')]=_[_0x6d24('0x3b')](_0x34d2f5[_0x6d24('0x3a')]);_0x4ab0a1[_0x6d24('0x3c')]=_[_0x6d24('0x3d')](_0x4ab0a1[_0x6d24('0x39')],_0x4ab0a1[_0x6d24('0x3a')]);_0x3b82a3[_0x6d24('0x3e')]=_[_0x6d24('0x3d')](_0x4ab0a1[_0x6d24('0x39')],qs[_0x6d24('0x3f')](_0x34d2f5[_0x6d24('0x3a')][_0x6d24('0x3f')]));_0x3b82a3[_0x6d24('0x3e')]=_0x3b82a3[_0x6d24('0x3e')][_0x6d24('0x40')]?_0x3b82a3[_0x6d24('0x3e')]:_0x4ab0a1[_0x6d24('0x39')];if(!_0x34d2f5[_0x6d24('0x3a')]['hasOwnProperty'](_0x6d24('0x41'))){_0x3b82a3['limit']=qs[_0x6d24('0x2c')](_0x34d2f5[_0x6d24('0x3a')]['limit']);_0x3b82a3[_0x6d24('0x29')]=qs[_0x6d24('0x29')](_0x34d2f5[_0x6d24('0x3a')]['offset']);}_0x3b82a3[_0x6d24('0x42')]=qs[_0x6d24('0x43')](_0x34d2f5[_0x6d24('0x3a')]['sort']);_0x3b82a3[_0x6d24('0x44')]=qs[_0x6d24('0x3c')](_[_0x6d24('0x45')](_0x34d2f5[_0x6d24('0x3a')],_0x4ab0a1['filters']),_0x28da45);if(_0x34d2f5[_0x6d24('0x3a')][_0x6d24('0x46')]){_0x3b82a3[_0x6d24('0x44')]=_[_0x6d24('0x47')](_0x3b82a3[_0x6d24('0x44')],{'$or':_[_0x6d24('0x34')](_0x28da45,function(_0x3e7590){if(_0x3e7590[_0x6d24('0x48')]!=='VIRTUAL'){var _0x23ce0a={};_0x23ce0a[_0x3e7590[_0x6d24('0x32')]]={'$like':'%'+_0x34d2f5[_0x6d24('0x3a')]['filter']+'%'};return _0x23ce0a;}})});}_0x3b82a3=_['merge']({},_0x3b82a3,_0x34d2f5['options']);var _0x2efdec={'where':_0x3b82a3['where']};return db[_0x6d24('0x35')]['count'](_0x2efdec)[_0x6d24('0x1d')](function(_0x32438f){_0x59e7c7[_0x6d24('0x2b')]=_0x32438f;if(_0x34d2f5[_0x6d24('0x3a')][_0x6d24('0x49')]){_0x3b82a3[_0x6d24('0x4a')]=[{'all':!![]}];}return db[_0x6d24('0x35')][_0x6d24('0x4b')](_0x3b82a3);})[_0x6d24('0x1d')](function(_0x65a19c){_0x59e7c7['rows']=_0x65a19c;return _0x59e7c7;})[_0x6d24('0x1d')](respondWithFilteredResult(_0x473ed1,_0x3b82a3))[_0x6d24('0x4c')](handleError(_0x473ed1,null));};exports['show']=function(_0x283679,_0x3817d7){var _0x4cab22={'raw':!![],'where':{'id':_0x283679[_0x6d24('0x4d')]['id']}},_0x6ad73f={};_0x6ad73f[_0x6d24('0x39')]=_[_0x6d24('0x3b')](db[_0x6d24('0x35')][_0x6d24('0x36')]);_0x6ad73f[_0x6d24('0x3a')]=_[_0x6d24('0x3b')](_0x283679[_0x6d24('0x3a')]);_0x6ad73f[_0x6d24('0x3c')]=_['intersection'](_0x6ad73f[_0x6d24('0x39')],_0x6ad73f[_0x6d24('0x3a')]);_0x4cab22['attributes']=_[_0x6d24('0x3d')](_0x6ad73f[_0x6d24('0x39')],qs[_0x6d24('0x3f')](_0x283679['query'][_0x6d24('0x3f')]));_0x4cab22[_0x6d24('0x3e')]=_0x4cab22['attributes']['length']?_0x4cab22[_0x6d24('0x3e')]:_0x6ad73f[_0x6d24('0x39')];if(_0x283679['query'][_0x6d24('0x49')]){_0x4cab22['include']=[{'all':!![]}];}_0x4cab22=_['merge']({},_0x4cab22,_0x283679[_0x6d24('0x4e')]);return db['WhatsappMessage']['find'](_0x4cab22)['then'](handleEntityNotFound(_0x3817d7,null))['then'](respondWithResult(_0x3817d7,null))['catch'](handleError(_0x3817d7,null));};exports[_0x6d24('0x4f')]=function(_0x20c330,_0x2ea75e){return db[_0x6d24('0x35')]['create'](_0x20c330[_0x6d24('0x50')],{})[_0x6d24('0x1d')](respondWithResult(_0x2ea75e,0xc9))['catch'](handleError(_0x2ea75e,null));};exports[_0x6d24('0x2f')]=function(_0x3e00fc,_0x24bc89){if(_0x3e00fc[_0x6d24('0x50')]['id']){delete _0x3e00fc[_0x6d24('0x50')]['id'];}return db[_0x6d24('0x35')]['find']({'where':{'id':_0x3e00fc['params']['id']}})['then'](handleEntityNotFound(_0x24bc89,null))[_0x6d24('0x1d')](saveUpdates(_0x3e00fc[_0x6d24('0x50')],null))['then'](respondWithResult(_0x24bc89,null))[_0x6d24('0x4c')](handleError(_0x24bc89,null));};exports[_0x6d24('0x30')]=function(_0x30b8db,_0x52bef9){return db[_0x6d24('0x35')]['find']({'where':{'id':_0x30b8db[_0x6d24('0x4d')]['id']}})[_0x6d24('0x1d')](handleEntityNotFound(_0x52bef9,null))[_0x6d24('0x1d')](removeEntity(_0x52bef9,null))[_0x6d24('0x4c')](handleError(_0x52bef9,null));};exports[_0x6d24('0x51')]=function(_0x3ac234,_0x283083){return db[_0x6d24('0x35')][_0x6d24('0x51')]()[_0x6d24('0x1d')](respondWithResult(_0x283083,null))[_0x6d24('0x4c')](handleError(_0x283083,null));};var interaction_log=require(_0x6d24('0x13'))(_0x6d24('0x52'));exports['accept']=function(_0x2194cd,_0x3d28b9,_0x1afd64){var _0xd8c45f={'agent':{},'channel':'whatsapp'};if(_0x2194cd[_0x6d24('0x50')]['id']){delete _0x2194cd[_0x6d24('0x50')]['id'];}_0x2194cd[_0x6d24('0x50')]['read']=!![];_0x2194cd[_0x6d24('0x50')][_0x6d24('0x53')]=moment()[_0x6d24('0x54')](_0x6d24('0x55'));_0x2194cd['body'][_0x6d24('0x56')]=_0x2194cd['body'][_0x6d24('0x56')]||_0x2194cd['user']['id'];_0xd8c45f[_0x6d24('0x57')]['id']=_0x2194cd[_0x6d24('0x50')][_0x6d24('0x56')];return db[_0x6d24('0x35')][_0x6d24('0x58')]({'where':{'id':_0x2194cd[_0x6d24('0x4d')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3d28b9,null))[_0x6d24('0x1d')](saveUpdates(_0x2194cd[_0x6d24('0x50')],null))[_0x6d24('0x1d')](function(_0x4928d7){if(_0x4928d7){_0xd8c45f[_0x6d24('0x25')]=_0x4928d7[_0x6d24('0x59')]({'plain':!![]});return db[_0x6d24('0x5a')][_0x6d24('0x58')]({'where':{'id':_0x4928d7['WhatsappInteractionId']}});}return null;})[_0x6d24('0x1d')](handleEntityNotFound(_0x3d28b9,null))[_0x6d24('0x1d')](function(_0x591c47){if(_0x591c47){return _0x591c47['update']({'UserId':_0x2194cd[_0x6d24('0x50')][_0x6d24('0x56')],'read1stAt':_[_0x6d24('0x5b')](_0x591c47[_0x6d24('0x5c')])?moment()[_0x6d24('0x54')](_0x6d24('0x55')):undefined});}return null;})[_0x6d24('0x1d')](function(_0x5af4eb){if(_0x5af4eb){_0xd8c45f[_0x6d24('0x5d')]=_0x5af4eb['get']({'plain':!![]});interaction_log[_0x6d24('0x26')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2194cd['user']['id'],_0x2194cd[_0x6d24('0x5e')][_0x6d24('0x32')],_0x2194cd[_0x6d24('0x5e')][_0x6d24('0x5f')],_0xd8c45f[_0x6d24('0x5d')]['id'],_0x2194cd[_0x6d24('0x50')]?JSON[_0x6d24('0x22')](_0x2194cd[_0x6d24('0x50')]):_0x6d24('0x60'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xd8c45f);}return null;})['then'](function(_0x5ce51c){var _0x7086d4=_0x6d24('0x61')+_0x5ce51c[_0x6d24('0x25')][_0x6d24('0x62')];return db[_0x6d24('0x63')][_0x6d24('0x3a')](_0x7086d4,{'type':db[_0x6d24('0x64')][_0x6d24('0x65')][_0x6d24('0x66')],'raw':!![]})[_0x6d24('0x1d')](function(_0x47c2a6){return _0x47c2a6;});})[_0x6d24('0x1d')](function(_0x4a841d){if(_0x4a841d){_0xd8c45f['message'][_0x6d24('0x67')]=_0x4a841d[0x0];if(!_0x2194cd[_0x6d24('0x50')]['UserId'])return;return db[_0x6d24('0x68')][_0x6d24('0x58')]({'where':{'id':_0x2194cd[_0x6d24('0x50')][_0x6d24('0x56')],'role':_0x6d24('0x57')},'attributes':['id',_0x6d24('0x32'),_0x6d24('0x69'),_0x6d24('0x6a'),_0x6d24('0x6b')],'raw':!![]});}return null;})[_0x6d24('0x1d')](function(_0x44e336){if(!_0x44e336)return null;_0xd8c45f[_0x6d24('0x25')][_0x6d24('0x57')]=_0x44e336;return _0xd8c45f;})['then'](function(_0x18f123){if(_0x18f123){if(_0x2194cd[_0x6d24('0x50')][_0x6d24('0x6c')]){_0xd8c45f[_0x6d24('0x25')][_0x6d24('0x6d')]=util[_0x6d24('0x54')](_0x6d24('0x6e'),_0x2194cd[_0x6d24('0x5e')][_0x6d24('0x32')]);_0xd8c45f[_0x6d24('0x25')][_0x6d24('0x6f')]=_0xd8c45f[_0x6d24('0x6f')];_0xd8c45f[_0x6d24('0x25')][_0x6d24('0x70')]=_0xd8c45f[_0x6d24('0x6f')];_0xd8c45f[_0x6d24('0x25')][_0x6d24('0x71')]=_0x6d24('0x72');return respondWithRpcPromise(_0x6d24('0x73'),'EventManager',{'event':_0x6d24('0x74'),'message':_0xd8c45f['message']},client9002)[_0x6d24('0x1d')](function(){return _0xd8c45f;});}return _0xd8c45f;}return null;})[_0x6d24('0x1d')](respondWithResult(_0x3d28b9,null))[_0x6d24('0x4c')](handleError(_0x3d28b9,null));};var interaction_log=require(_0x6d24('0x13'))('whatsapp-interactions');exports[_0x6d24('0x75')]=function(_0xf0371a,_0x1d0bba,_0x2a9666){var _0x3c4bfb={'agent':{},'channel':_0x6d24('0x76')};if(_0xf0371a[_0x6d24('0x50')]['id']){delete _0xf0371a['body']['id'];}_0xf0371a[_0x6d24('0x50')][_0x6d24('0x56')]=_0xf0371a['body'][_0x6d24('0x56')]||_0xf0371a[_0x6d24('0x5e')]['id'];_0x3c4bfb[_0x6d24('0x57')]['id']=_0xf0371a[_0x6d24('0x50')][_0x6d24('0x56')];return db[_0x6d24('0x35')]['find']({'where':{'id':_0xf0371a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1d0bba,null))[_0x6d24('0x1d')](function(_0x13f4d2){if(_0x13f4d2){_0x3c4bfb['message']=_0x13f4d2[_0x6d24('0x59')]({'plain':!![]});return db['WhatsappInteraction'][_0x6d24('0x58')]({'where':{'id':_0x13f4d2[_0x6d24('0x77')]}});}return null;})[_0x6d24('0x1d')](handleEntityNotFound(_0x1d0bba,null))[_0x6d24('0x1d')](function(_0x20ab59){if(_0x20ab59){_0x3c4bfb[_0x6d24('0x5d')]=_0x20ab59[_0x6d24('0x59')]({'plain':!![]});interaction_log['info'](_0x6d24('0x78'),_0xf0371a[_0x6d24('0x5e')]['id'],_0xf0371a['user'][_0x6d24('0x32')],_0xf0371a[_0x6d24('0x5e')][_0x6d24('0x5f')],_0x3c4bfb[_0x6d24('0x5d')]['id'],_0xf0371a[_0x6d24('0x50')]?JSON['stringify'](_0xf0371a['body']):'null');return respondWithRpcPromise(_0x6d24('0x79'),_0x6d24('0x7a'),_0x3c4bfb);}return null;})[_0x6d24('0x1d')](function(_0x321a1d){var _0x28a27b=_0x6d24('0x61')+_0x321a1d[_0x6d24('0x25')][_0x6d24('0x62')];return db['sequelize'][_0x6d24('0x3a')](_0x28a27b,{'type':db[_0x6d24('0x64')]['QueryTypes'][_0x6d24('0x66')],'raw':!![]})[_0x6d24('0x1d')](function(_0x22d40f){return _0x22d40f;});})['then'](function(_0x1de2d5){if(_0x1de2d5){_0x3c4bfb[_0x6d24('0x25')][_0x6d24('0x67')]=_0x1de2d5[0x0];if(!_0xf0371a[_0x6d24('0x50')][_0x6d24('0x56')])return;return db[_0x6d24('0x68')][_0x6d24('0x58')]({'where':{'id':_0xf0371a[_0x6d24('0x50')][_0x6d24('0x56')],'role':_0x6d24('0x57')},'attributes':['id',_0x6d24('0x32'),_0x6d24('0x69'),_0x6d24('0x6a'),_0x6d24('0x6b')],'raw':!![]});}return null;})[_0x6d24('0x1d')](function(_0x3673d6){if(!_0x3673d6)return null;_0x3c4bfb['message']['agent']=_0x3673d6;return _0x3c4bfb;})[_0x6d24('0x1d')](function(_0x549f93){if(_0x549f93){_0x549f93[_0x6d24('0x25')][_0x6d24('0x6d')]=util['format'](_0x6d24('0x6e'),_0xf0371a[_0x6d24('0x5e')]['name']);_0x549f93['message'][_0x6d24('0x6f')]=_0x3c4bfb[_0x6d24('0x6f')];_0x549f93['message'][_0x6d24('0x70')]=_0x3c4bfb[_0x6d24('0x6f')];_0x549f93[_0x6d24('0x25')]['event']='reject';respondWithRpcPromise('EventManager',_0x6d24('0x73'),{'event':'rejectmessage','message':_0x549f93[_0x6d24('0x25')]},client9002);return _0x3c4bfb;}return null;})[_0x6d24('0x1d')](respondWithResult(_0x1d0bba,null))['catch'](handleError(_0x1d0bba,null));};exports['status']=function(_0x40a7d9,_0x1ffcfd,_0x12b68d){if(_0x40a7d9[_0x6d24('0x50')]['id']){delete _0x40a7d9['body']['id'];}var _0x12817a;return db[_0x6d24('0x35')]['find']({'where':{'id':_0x40a7d9[_0x6d24('0x4d')]['id']}})[_0x6d24('0x1d')](handleEntityNotFound(_0x1ffcfd,null))[_0x6d24('0x1d')](function(_0x19d76f){if(_0x19d76f){_0x12817a=_0x19d76f;return db[_0x6d24('0x7b')][_0x6d24('0x58')]({'where':{'id':_0x19d76f[_0x6d24('0x7c')]}});}})['then'](handleEntityNotFound(_0x1ffcfd,null))[_0x6d24('0x1d')](function(_0x4c2b38){if(_0x4c2b38){logger[_0x6d24('0x20')](_0x6d24('0x7d'),_0x6d24('0x2d'),'received\x20delivery\x20report\x20from',_0x4c2b38['type'],util[_0x6d24('0x7e')](_0x40a7d9['body'],{'showHidden':![],'depth':null}));switch(_0x4c2b38[_0x6d24('0x48')]){case _0x6d24('0x7f'):if(_0x40a7d9[_0x6d24('0x50')][_0x6d24('0x80')]&&_0x40a7d9[_0x6d24('0x50')][_0x6d24('0x80')]===_0x12817a[_0x6d24('0x81')]&&_0x40a7d9[_0x6d24('0x50')][_0x6d24('0x82')]&&_0x40a7d9[_0x6d24('0x50')][_0x6d24('0x82')]===_0x6d24('0x83')){return _0x12817a[_0x6d24('0x2f')]({'read':!![]});}else{logger[_0x6d24('0x23')](_0x6d24('0x84'),_0x6d24('0x2d'),_0x6d24('0x7f'),util['inspect'](_0x40a7d9[_0x6d24('0x50')],{'showHidden':![],'depth':null}));}break;}return _0x12817a;}})[_0x6d24('0x1d')](respondWithResult(_0x1ffcfd,null))[_0x6d24('0x4c')](handleError(_0x1ffcfd,null));}; \ No newline at end of file +var _0xd245=['rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','params','keys','includeAll','include','find','body','describe','whatsapp-interactions','accept','whatsapp','read','readAt','format','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','contact','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','index','map','WhatsappMessage'];(function(_0x34bcce,_0x3b1cf0){var _0x799430=function(_0x2d77ef){while(--_0x2d77ef){_0x34bcce['push'](_0x34bcce['shift']());}};_0x799430(++_0x3b1cf0);}(_0xd245,0xdb));var _0x5d24=function(_0x460666,_0x24bfa0){_0x460666=_0x460666-0x0;var _0x555cbf=_0xd245[_0x460666];return _0x555cbf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5d24('0x0'));var jsonpatch=require(_0x5d24('0x1'));var rp=require(_0x5d24('0x2'));var moment=require(_0x5d24('0x3'));var BPromise=require(_0x5d24('0x4'));var Mustache=require(_0x5d24('0x5'));var util=require(_0x5d24('0x6'));var path=require(_0x5d24('0x7'));var sox=require('sox');var csv=require(_0x5d24('0x8'));var ejs=require(_0x5d24('0x9'));var fs=require('fs');var fs_extra=require(_0x5d24('0xa'));var _=require(_0x5d24('0xb'));var squel=require(_0x5d24('0xc'));var crypto=require('crypto');var jsforce=require(_0x5d24('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5d24('0x8'));var querystring=require(_0x5d24('0xe'));var Papa=require(_0x5d24('0xf'));var Redis=require(_0x5d24('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5d24('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d24('0x12'))('api');var utils=require(_0x5d24('0x13'));var config=require(_0x5d24('0x14'));var licenseUtil=require(_0x5d24('0x15'));var db=require(_0x5d24('0x16'))['db'];config[_0x5d24('0x17')]=_[_0x5d24('0x18')](config[_0x5d24('0x17')],{'host':_0x5d24('0x19'),'port':0x18eb});var socket=require(_0x5d24('0x1a'))(new Redis(config[_0x5d24('0x17')]));require(_0x5d24('0x1b'))[_0x5d24('0x1c')](socket);var jayson=require(_0x5d24('0x1d'));var client=jayson[_0x5d24('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x5d24('0x1e')][_0x5d24('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x16e103,_0x1b8a9a,_0x267286,_0x153536){return new BPromise(function(_0x17a37d,_0x388075){var _0x5b4618=_0x153536||client;return _0x5b4618['request'](_0x16e103,_0x267286)[_0x5d24('0x20')](function(_0x3f748e){logger[_0x5d24('0x21')](_0x5d24('0x22'),_0x1b8a9a,_0x5d24('0x23'));logger['debug'](_0x5d24('0x24'),_0x1b8a9a,_0x5d24('0x23'),JSON['stringify'](_0x3f748e));if(_0x3f748e[_0x5d24('0x25')]){if(_0x3f748e[_0x5d24('0x25')][_0x5d24('0x26')]===0x1f4){logger['error'](_0x5d24('0x22'),_0x1b8a9a,_0x3f748e[_0x5d24('0x25')][_0x5d24('0x27')]);return _0x388075(_0x3f748e[_0x5d24('0x25')][_0x5d24('0x27')]);}logger[_0x5d24('0x25')]('WhatsappMessage,\x20%s,\x20%s',_0x1b8a9a,_0x3f748e[_0x5d24('0x25')][_0x5d24('0x27')]);return _0x17a37d(_0x3f748e[_0x5d24('0x25')][_0x5d24('0x27')]);}else{logger[_0x5d24('0x21')](_0x5d24('0x22'),_0x1b8a9a,_0x5d24('0x23'));_0x17a37d(_0x3f748e[_0x5d24('0x28')][_0x5d24('0x27')]);}})[_0x5d24('0x29')](function(_0x21e25a){logger[_0x5d24('0x25')](_0x5d24('0x22'),_0x1b8a9a,_0x21e25a);_0x388075(_0x21e25a);});});}function respondWithStatusCode(_0x422bcd,_0x25d5a3){_0x25d5a3=_0x25d5a3||0xcc;return function(_0x1d288a){if(_0x1d288a){return _0x422bcd['sendStatus'](_0x25d5a3);}return _0x422bcd[_0x5d24('0x2a')](_0x25d5a3)['end']();};}function respondWithResult(_0x4546c1,_0x553fb8){_0x553fb8=_0x553fb8||0xc8;return function(_0x3d55d4){if(_0x3d55d4){return _0x4546c1[_0x5d24('0x2a')](_0x553fb8)[_0x5d24('0x2b')](_0x3d55d4);}};}function respondWithFilteredResult(_0x5d8a61,_0x2c3a1b){return function(_0x2611c3){if(_0x2611c3){var _0x345410=typeof _0x2c3a1b[_0x5d24('0x2c')]===_0x5d24('0x2d')&&typeof _0x2c3a1b[_0x5d24('0x2e')]===_0x5d24('0x2d');var _0x2e26c9=_0x2611c3['count'];var _0x46910f=_0x345410?0x0:_0x2c3a1b[_0x5d24('0x2c')];var _0x2cf28f=_0x345410?_0x2611c3[_0x5d24('0x2f')]:_0x2c3a1b[_0x5d24('0x2c')]+_0x2c3a1b[_0x5d24('0x2e')];var _0x581788;if(_0x2cf28f>=_0x2e26c9){_0x2cf28f=_0x2e26c9;_0x581788=0xc8;}else{_0x581788=0xce;}_0x5d8a61['status'](_0x581788);return _0x5d8a61['set'](_0x5d24('0x30'),_0x46910f+'-'+_0x2cf28f+'/'+_0x2e26c9)['json'](_0x2611c3);}return null;};}function patchUpdates(_0x205c7d){return function(_0x1cc814){try{jsonpatch[_0x5d24('0x31')](_0x1cc814,_0x205c7d,!![]);}catch(_0x46f750){return BPromise[_0x5d24('0x32')](_0x46f750);}return _0x1cc814[_0x5d24('0x33')]();};}function saveUpdates(_0x2c56ee,_0x2070cc){return function(_0x3d65ff){if(_0x3d65ff){return _0x3d65ff[_0x5d24('0x34')](_0x2c56ee)[_0x5d24('0x20')](function(_0x2005b9){return _0x2005b9;});}return null;};}function removeEntity(_0x54d943,_0x5b9f38){return function(_0x4e2be3){if(_0x4e2be3){return _0x4e2be3[_0x5d24('0x35')]()[_0x5d24('0x20')](function(){_0x54d943['status'](0xcc)[_0x5d24('0x36')]();});}};}function handleEntityNotFound(_0x2bd2fe,_0x5e6c3a){return function(_0x2d10ce){if(!_0x2d10ce){_0x2bd2fe[_0x5d24('0x37')](0x194);}return _0x2d10ce;};}function handleError(_0x379559,_0x1b9542){_0x1b9542=_0x1b9542||0x1f4;return function(_0x43d7a0){logger['error'](_0x43d7a0[_0x5d24('0x38')]);if(_0x43d7a0['name']){delete _0x43d7a0[_0x5d24('0x39')];}_0x379559[_0x5d24('0x2a')](_0x1b9542)['send'](_0x43d7a0);};}exports[_0x5d24('0x3a')]=function(_0xe3b9f7,_0x1e04a0){var _0x44751d={},_0x156fd1={},_0xd3b33a={'count':0x0,'rows':[]};var _0x1b165c=_[_0x5d24('0x3b')](db[_0x5d24('0x3c')][_0x5d24('0x3d')],function(_0x5c672e){return{'name':_0x5c672e[_0x5d24('0x3e')],'type':_0x5c672e[_0x5d24('0x3f')][_0x5d24('0x40')]};});_0x156fd1[_0x5d24('0x41')]=_[_0x5d24('0x3b')](_0x1b165c,_0x5d24('0x39'));_0x156fd1[_0x5d24('0x42')]=_['keys'](_0xe3b9f7[_0x5d24('0x42')]);_0x156fd1[_0x5d24('0x43')]=_['intersection'](_0x156fd1[_0x5d24('0x41')],_0x156fd1[_0x5d24('0x42')]);_0x44751d[_0x5d24('0x44')]=_[_0x5d24('0x45')](_0x156fd1[_0x5d24('0x41')],qs[_0x5d24('0x46')](_0xe3b9f7['query']['fields']));_0x44751d[_0x5d24('0x44')]=_0x44751d[_0x5d24('0x44')][_0x5d24('0x47')]?_0x44751d[_0x5d24('0x44')]:_0x156fd1[_0x5d24('0x41')];if(!_0xe3b9f7[_0x5d24('0x42')][_0x5d24('0x48')](_0x5d24('0x49'))){_0x44751d[_0x5d24('0x2e')]=qs[_0x5d24('0x2e')](_0xe3b9f7['query'][_0x5d24('0x2e')]);_0x44751d[_0x5d24('0x2c')]=qs[_0x5d24('0x2c')](_0xe3b9f7[_0x5d24('0x42')][_0x5d24('0x2c')]);}_0x44751d[_0x5d24('0x4a')]=qs[_0x5d24('0x4b')](_0xe3b9f7[_0x5d24('0x42')][_0x5d24('0x4b')]);_0x44751d['where']=qs[_0x5d24('0x43')](_[_0x5d24('0x4c')](_0xe3b9f7[_0x5d24('0x42')],_0x156fd1[_0x5d24('0x43')]),_0x1b165c);if(_0xe3b9f7[_0x5d24('0x42')][_0x5d24('0x4d')]){_0x44751d[_0x5d24('0x4e')]=_[_0x5d24('0x4f')](_0x44751d['where'],{'$or':_[_0x5d24('0x3b')](_0x1b165c,function(_0x2912b5){if(_0x2912b5[_0x5d24('0x3f')]!==_0x5d24('0x50')){var _0x58c949={};_0x58c949[_0x2912b5[_0x5d24('0x39')]]={'$like':'%'+_0xe3b9f7[_0x5d24('0x42')][_0x5d24('0x4d')]+'%'};return _0x58c949;}})});}_0x44751d=_['merge']({},_0x44751d,_0xe3b9f7[_0x5d24('0x51')]);var _0x34218a={'where':_0x44751d[_0x5d24('0x4e')]};return db[_0x5d24('0x3c')][_0x5d24('0x2f')](_0x34218a)[_0x5d24('0x20')](function(_0x2f8b44){_0xd3b33a['count']=_0x2f8b44;if(_0xe3b9f7[_0x5d24('0x42')]['includeAll']){_0x44751d['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0x5d24('0x52')](_0x44751d);})['then'](function(_0x1336b9){_0xd3b33a[_0x5d24('0x53')]=_0x1336b9;return _0xd3b33a;})[_0x5d24('0x20')](respondWithFilteredResult(_0x1e04a0,_0x44751d))[_0x5d24('0x29')](handleError(_0x1e04a0,null));};exports['show']=function(_0x40b273,_0x179372){var _0x8c2e00={'raw':!![],'where':{'id':_0x40b273[_0x5d24('0x54')]['id']}},_0x189bc0={};_0x189bc0[_0x5d24('0x41')]=_[_0x5d24('0x55')](db[_0x5d24('0x3c')][_0x5d24('0x3d')]);_0x189bc0[_0x5d24('0x42')]=_[_0x5d24('0x55')](_0x40b273[_0x5d24('0x42')]);_0x189bc0[_0x5d24('0x43')]=_[_0x5d24('0x45')](_0x189bc0[_0x5d24('0x41')],_0x189bc0[_0x5d24('0x42')]);_0x8c2e00[_0x5d24('0x44')]=_[_0x5d24('0x45')](_0x189bc0['model'],qs[_0x5d24('0x46')](_0x40b273[_0x5d24('0x42')][_0x5d24('0x46')]));_0x8c2e00['attributes']=_0x8c2e00[_0x5d24('0x44')][_0x5d24('0x47')]?_0x8c2e00[_0x5d24('0x44')]:_0x189bc0[_0x5d24('0x41')];if(_0x40b273[_0x5d24('0x42')][_0x5d24('0x56')]){_0x8c2e00[_0x5d24('0x57')]=[{'all':!![]}];}_0x8c2e00=_[_0x5d24('0x4f')]({},_0x8c2e00,_0x40b273[_0x5d24('0x51')]);return db['WhatsappMessage'][_0x5d24('0x58')](_0x8c2e00)[_0x5d24('0x20')](handleEntityNotFound(_0x179372,null))[_0x5d24('0x20')](respondWithResult(_0x179372,null))[_0x5d24('0x29')](handleError(_0x179372,null));};exports['create']=function(_0x2e4d3d,_0x59d6e9){return db[_0x5d24('0x3c')]['create'](_0x2e4d3d[_0x5d24('0x59')],{})[_0x5d24('0x20')](respondWithResult(_0x59d6e9,0xc9))[_0x5d24('0x29')](handleError(_0x59d6e9,null));};exports[_0x5d24('0x34')]=function(_0x1d4a39,_0x147912){if(_0x1d4a39[_0x5d24('0x59')]['id']){delete _0x1d4a39[_0x5d24('0x59')]['id'];}return db['WhatsappMessage'][_0x5d24('0x58')]({'where':{'id':_0x1d4a39[_0x5d24('0x54')]['id']}})['then'](handleEntityNotFound(_0x147912,null))[_0x5d24('0x20')](saveUpdates(_0x1d4a39['body'],null))[_0x5d24('0x20')](respondWithResult(_0x147912,null))[_0x5d24('0x29')](handleError(_0x147912,null));};exports[_0x5d24('0x35')]=function(_0xba338,_0x5eab66){return db['WhatsappMessage']['find']({'where':{'id':_0xba338[_0x5d24('0x54')]['id']}})[_0x5d24('0x20')](handleEntityNotFound(_0x5eab66,null))['then'](removeEntity(_0x5eab66,null))[_0x5d24('0x29')](handleError(_0x5eab66,null));};exports[_0x5d24('0x5a')]=function(_0x19590c,_0x3ac95b){return db[_0x5d24('0x3c')][_0x5d24('0x5a')]()['then'](respondWithResult(_0x3ac95b,null))[_0x5d24('0x29')](handleError(_0x3ac95b,null));};var interaction_log=require('../../config/logger')(_0x5d24('0x5b'));exports[_0x5d24('0x5c')]=function(_0x15cc9e,_0xff2956,_0xfd3bb9){var _0xb0a893={'agent':{},'channel':_0x5d24('0x5d')};if(_0x15cc9e[_0x5d24('0x59')]['id']){delete _0x15cc9e[_0x5d24('0x59')]['id'];}_0x15cc9e[_0x5d24('0x59')][_0x5d24('0x5e')]=!![];_0x15cc9e[_0x5d24('0x59')][_0x5d24('0x5f')]=moment()[_0x5d24('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x15cc9e[_0x5d24('0x59')][_0x5d24('0x61')]=_0x15cc9e[_0x5d24('0x59')][_0x5d24('0x61')]||_0x15cc9e['user']['id'];_0xb0a893['agent']['id']=_0x15cc9e['body'][_0x5d24('0x61')];return db[_0x5d24('0x3c')][_0x5d24('0x58')]({'where':{'id':_0x15cc9e[_0x5d24('0x54')]['id'],'UserId':null}})[_0x5d24('0x20')](handleEntityNotFound(_0xff2956,null))[_0x5d24('0x20')](saveUpdates(_0x15cc9e['body'],null))['then'](function(_0x46ff16){if(_0x46ff16){_0xb0a893[_0x5d24('0x27')]=_0x46ff16[_0x5d24('0x62')]({'plain':!![]});return db[_0x5d24('0x63')][_0x5d24('0x58')]({'where':{'id':_0x46ff16[_0x5d24('0x64')]}});}return null;})['then'](handleEntityNotFound(_0xff2956,null))[_0x5d24('0x20')](function(_0x452902){if(_0x452902){return _0x452902['update']({'UserId':_0x15cc9e[_0x5d24('0x59')][_0x5d24('0x61')],'read1stAt':_[_0x5d24('0x65')](_0x452902[_0x5d24('0x66')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x5d24('0x20')](function(_0x53892a){if(_0x53892a){_0xb0a893[_0x5d24('0x67')]=_0x53892a['get']({'plain':!![]});interaction_log[_0x5d24('0x21')](_0x5d24('0x68'),_0x15cc9e[_0x5d24('0x69')]['id'],_0x15cc9e[_0x5d24('0x69')][_0x5d24('0x39')],_0x15cc9e['user'][_0x5d24('0x6a')],_0xb0a893[_0x5d24('0x67')]['id'],_0x15cc9e[_0x5d24('0x59')]?JSON[_0x5d24('0x6b')](_0x15cc9e[_0x5d24('0x59')]):_0x5d24('0x6c'));return respondWithRpcPromise(_0x5d24('0x6d'),_0x5d24('0x6e'),_0xb0a893);}return null;})['then'](function(_0x3c74f9){var _0x46dfd4=_0x5d24('0x6f')+_0x3c74f9[_0x5d24('0x27')][_0x5d24('0x70')];return db['sequelize'][_0x5d24('0x42')](_0x46dfd4,{'type':db[_0x5d24('0x71')][_0x5d24('0x72')][_0x5d24('0x73')],'raw':!![]})[_0x5d24('0x20')](function(_0x1152ec){return _0x1152ec;});})[_0x5d24('0x20')](function(_0x444159){if(_0x444159){_0xb0a893['message']['contact']=_0x444159[0x0];if(!_0x15cc9e[_0x5d24('0x59')][_0x5d24('0x61')])return;return db[_0x5d24('0x74')][_0x5d24('0x58')]({'where':{'id':_0x15cc9e['body'][_0x5d24('0x61')],'role':'agent'},'attributes':['id',_0x5d24('0x39'),_0x5d24('0x75'),_0x5d24('0x76'),_0x5d24('0x77')],'raw':!![]});}return null;})[_0x5d24('0x20')](function(_0x1001bd){if(!_0x1001bd)return null;_0xb0a893[_0x5d24('0x27')][_0x5d24('0x78')]=_0x1001bd;return _0xb0a893;})['then'](function(_0x2cf965){if(_0x2cf965){if(_0x15cc9e['body'][_0x5d24('0x79')]){_0xb0a893[_0x5d24('0x27')][_0x5d24('0x7a')]=util[_0x5d24('0x60')](_0x5d24('0x7b'),_0x15cc9e['user'][_0x5d24('0x39')]);_0xb0a893[_0x5d24('0x27')][_0x5d24('0x7c')]=_0xb0a893['channel'];_0xb0a893[_0x5d24('0x27')][_0x5d24('0x7d')]=_0xb0a893['channel'];_0xb0a893[_0x5d24('0x27')][_0x5d24('0x7e')]=_0x5d24('0x5c');return respondWithRpcPromise(_0x5d24('0x7f'),_0x5d24('0x7f'),{'event':_0x5d24('0x80'),'message':_0xb0a893[_0x5d24('0x27')]},client9002)[_0x5d24('0x20')](function(){return _0xb0a893;});}return _0xb0a893;}return null;})[_0x5d24('0x20')](respondWithResult(_0xff2956,null))[_0x5d24('0x29')](handleError(_0xff2956,null));};var interaction_log=require(_0x5d24('0x12'))('whatsapp-interactions');exports[_0x5d24('0x32')]=function(_0xa6342c,_0x1d995e,_0x2fa42a){var _0x3f74e0={'agent':{},'channel':_0x5d24('0x5d')};if(_0xa6342c[_0x5d24('0x59')]['id']){delete _0xa6342c[_0x5d24('0x59')]['id'];}_0xa6342c[_0x5d24('0x59')]['UserId']=_0xa6342c[_0x5d24('0x59')][_0x5d24('0x61')]||_0xa6342c[_0x5d24('0x69')]['id'];_0x3f74e0[_0x5d24('0x78')]['id']=_0xa6342c[_0x5d24('0x59')][_0x5d24('0x61')];return db[_0x5d24('0x3c')][_0x5d24('0x58')]({'where':{'id':_0xa6342c[_0x5d24('0x54')]['id'],'UserId':null}})[_0x5d24('0x20')](handleEntityNotFound(_0x1d995e,null))['then'](function(_0x304052){if(_0x304052){_0x3f74e0[_0x5d24('0x27')]=_0x304052[_0x5d24('0x62')]({'plain':!![]});return db[_0x5d24('0x63')][_0x5d24('0x58')]({'where':{'id':_0x304052[_0x5d24('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1d995e,null))[_0x5d24('0x20')](function(_0x4d389c){if(_0x4d389c){_0x3f74e0[_0x5d24('0x67')]=_0x4d389c[_0x5d24('0x62')]({'plain':!![]});interaction_log[_0x5d24('0x21')](_0x5d24('0x81'),_0xa6342c[_0x5d24('0x69')]['id'],_0xa6342c[_0x5d24('0x69')]['name'],_0xa6342c[_0x5d24('0x69')][_0x5d24('0x6a')],_0x3f74e0[_0x5d24('0x67')]['id'],_0xa6342c[_0x5d24('0x59')]?JSON['stringify'](_0xa6342c[_0x5d24('0x59')]):'null');return respondWithRpcPromise(_0x5d24('0x82'),'rejectMessage',_0x3f74e0);}return null;})[_0x5d24('0x20')](function(_0x342074){var _0x36d5b8=_0x5d24('0x6f')+_0x342074[_0x5d24('0x27')][_0x5d24('0x70')];return db['sequelize']['query'](_0x36d5b8,{'type':db[_0x5d24('0x71')][_0x5d24('0x72')]['SELECT'],'raw':!![]})[_0x5d24('0x20')](function(_0x5a001a){return _0x5a001a;});})['then'](function(_0x117cd9){if(_0x117cd9){_0x3f74e0[_0x5d24('0x27')][_0x5d24('0x83')]=_0x117cd9[0x0];if(!_0xa6342c['body'][_0x5d24('0x61')])return;return db['User'][_0x5d24('0x58')]({'where':{'id':_0xa6342c[_0x5d24('0x59')][_0x5d24('0x61')],'role':'agent'},'attributes':['id','name',_0x5d24('0x75'),_0x5d24('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x272f50){if(!_0x272f50)return null;_0x3f74e0[_0x5d24('0x27')][_0x5d24('0x78')]=_0x272f50;return _0x3f74e0;})['then'](function(_0x34dee1){if(_0x34dee1){_0x34dee1[_0x5d24('0x27')][_0x5d24('0x7a')]=util[_0x5d24('0x60')](_0x5d24('0x7b'),_0xa6342c[_0x5d24('0x69')]['name']);_0x34dee1[_0x5d24('0x27')]['channel']=_0x3f74e0[_0x5d24('0x7c')];_0x34dee1[_0x5d24('0x27')][_0x5d24('0x7d')]=_0x3f74e0[_0x5d24('0x7c')];_0x34dee1[_0x5d24('0x27')]['event']=_0x5d24('0x32');respondWithRpcPromise(_0x5d24('0x7f'),'EventManager',{'event':'rejectmessage','message':_0x34dee1[_0x5d24('0x27')]},client9002);return _0x3f74e0;}return null;})[_0x5d24('0x20')](respondWithResult(_0x1d995e,null))[_0x5d24('0x29')](handleError(_0x1d995e,null));};exports[_0x5d24('0x2a')]=function(_0x542313,_0x28a3e7,_0x263ffe){if(_0x542313[_0x5d24('0x59')]['id']){delete _0x542313[_0x5d24('0x59')]['id'];}var _0x5d4b57;return db[_0x5d24('0x3c')]['find']({'where':{'id':_0x542313[_0x5d24('0x54')]['id']}})[_0x5d24('0x20')](handleEntityNotFound(_0x28a3e7,null))[_0x5d24('0x20')](function(_0x5810c4){if(_0x5810c4){_0x5d4b57=_0x5810c4;return db[_0x5d24('0x84')][_0x5d24('0x58')]({'where':{'id':_0x5810c4[_0x5d24('0x85')]}});}})['then'](handleEntityNotFound(_0x28a3e7,null))['then'](function(_0x5b7b7c){if(_0x5b7b7c){logger['debug'](_0x5d24('0x86'),_0x5d24('0x2a'),_0x5d24('0x87'),_0x5b7b7c[_0x5d24('0x3f')],util[_0x5d24('0x88')](_0x542313[_0x5d24('0x59')],{'showHidden':![],'depth':null}));switch(_0x5b7b7c[_0x5d24('0x3f')]){case'twilio':if(_0x542313[_0x5d24('0x59')][_0x5d24('0x89')]&&_0x542313[_0x5d24('0x59')]['MessageSid']===_0x5d4b57['messageId']&&_0x542313[_0x5d24('0x59')][_0x5d24('0x8a')]&&_0x542313[_0x5d24('0x59')][_0x5d24('0x8a')]==='read'){return _0x5d4b57[_0x5d24('0x34')]({'read':!![]});}else{logger[_0x5d24('0x25')](_0x5d24('0x8b'),_0x5d24('0x2a'),'twilio',util['inspect'](_0x542313[_0x5d24('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x5d4b57;}})[_0x5d24('0x20')](respondWithResult(_0x28a3e7,null))[_0x5d24('0x29')](handleError(_0x28a3e7,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9cb90cf..97913e6 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 _0x3070=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x5e3663,_0x52a47b){var _0x4d2fb3=function(_0x3b59e6){while(--_0x3b59e6){_0x5e3663['push'](_0x5e3663['shift']());}};_0x4d2fb3(++_0x52a47b);}(_0x3070,0x75));var _0x0307=function(_0x32be0c,_0x351f62){_0x32be0c=_0x32be0c-0x0;var _0x31f690=_0x3070[_0x32be0c];return _0x31f690;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x0307('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x0307('0x1')](0x0);var events={'afterCreate':_0x0307('0x2'),'afterUpdate':_0x0307('0x3'),'afterDestroy':_0x0307('0x4')};function emitEvent(_0x3dd3a5){return function(_0xb7229f,_0x5b39b8,_0x5e4edd){WhatsappMessageEvents[_0x0307('0x5')](_0x3dd3a5+':'+_0xb7229f['id'],_0xb7229f);WhatsappMessageEvents[_0x0307('0x5')](_0x3dd3a5,_0xb7229f);_0x5e4edd(null);};}for(var e in events){if(events[_0x0307('0x6')](e)){var event=events[e];WhatsappMessage[_0x0307('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x91a7=['../../mysqldb','WhatsappMessage','setMaxListeners','update','emit','hasOwnProperty','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x91a7,0xe7));var _0x791a=function(_0x5b5cb2,_0x9fb221){_0x5b5cb2=_0x5b5cb2-0x0;var _0x3e0709=_0x91a7[_0x5b5cb2];return _0x3e0709;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x791a('0x0'))['db'][_0x791a('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x791a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x791a('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6392){return function(_0x535640,_0x50ab29,_0x32fe2b){WhatsappMessageEvents[_0x791a('0x4')](_0x2f6392+':'+_0x535640['id'],_0x535640);WhatsappMessageEvents['emit'](_0x2f6392,_0x535640);_0x32fe2b(null);};}for(var e in events){if(events[_0x791a('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0x791a('0x6')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index ae79ec1..4d782da 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 _0x8055=['utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','direction','toLowerCase','out','secret','isNil','findOne','WhatsappInteractionId','then','createdAt','catch','error','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','statuses','message_id','WhatsappMessage,\x20%s','finally'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x8055,0x1c2));var _0x5805=function(_0x96d0d0,_0xfc9233){_0x96d0d0=_0x96d0d0-0x0;var _0x2b6758=_0x8055[_0x96d0d0];return _0x2b6758;};'use strict';var _=require('lodash');var util=require(_0x5805('0x0'));var logger=require('../../config/logger')(_0x5805('0x1'));var moment=require(_0x5805('0x2'));var BPromise=require(_0x5805('0x3'));var rp=require(_0x5805('0x4'));var fetch=require(_0x5805('0x5'));var fs=require('fs');var path=require(_0x5805('0x6'));var rimraf=require(_0x5805('0x7'));var config=require(_0x5805('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0x5805('0x9')]=function(_0x1ca7ac,_0x164332){return _0x1ca7ac['define'](_0x5805('0xa'),attributes,{'tableName':_0x5805('0xb'),'paranoid':![],'indexes':[{'name':_0x5805('0xc'),'fields':[_0x5805('0xc')]},{'name':_0x5805('0xd'),'fields':[_0x5805('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa1d838,_0x23d126,_0x202808){var _0x120ab7=_0x1ca7ac[_0x5805('0xf')];var _0x58e8a3=_0xa1d838['get']({'plain':!![]});if(_0x58e8a3[_0x5805('0x10')][_0x5805('0x11')]()==='in'||_0x58e8a3[_0x5805('0x10')][_0x5805('0x11')]()===_0x5805('0x12')&&!_0x58e8a3[_0x5805('0x13')]&&!_[_0x5805('0x14')](_0x58e8a3['UserId'])){_0x120ab7['WhatsappInteraction'][_0x5805('0x15')]({'where':{'id':_0x58e8a3[_0x5805('0x16')]}})[_0x5805('0x17')](function(_0x405879){if(_0x405879){_0x405879['update']({'lastMsgAt':_0x58e8a3[_0x5805('0x18')],'lastMsgDirection':_0x58e8a3[_0x5805('0x10')][_0x5805('0x11')]()});}})[_0x5805('0x19')](function(_0x43eb38){console[_0x5805('0x1a')](_0x43eb38);});}if(_0x58e8a3[_0x5805('0x10')]==='out'&&!_0x58e8a3[_0x5805('0x13')]){var _0x37b5a6;_0x120ab7[_0x5805('0x1b')][_0x5805('0x1c')]({'where':{'id':_0x58e8a3[_0x5805('0x1d')]},'raw':!![]})[_0x5805('0x17')](function(_0x1f4203){_0x37b5a6=_0x1f4203;if(_0x37b5a6&&_0x37b5a6[_0x5805('0x1e')]){switch(_0x37b5a6[_0x5805('0x1e')]){case _0x5805('0x1f'):var _0x37d7bc=require(_0x5805('0x1f'));if(_0x37b5a6[_0x5805('0x20')]&&_0x37b5a6[_0x5805('0x21')]&&_0x37b5a6[_0x5805('0x22')]){var _0x5b3fb8=new _0x37d7bc(_0x37b5a6[_0x5805('0x20')],_0x37b5a6[_0x5805('0x21')]);_0x5b3fb8[_0x5805('0x23')][_0x5805('0x24')]({'body':_0x58e8a3[_0x5805('0xe')],'to':_0x5805('0x25')+_0x58e8a3[_0x5805('0x22')],'from':_0x5805('0x25')+_0x37b5a6[_0x5805('0x22')],'statusCallback':_0x37b5a6[_0x5805('0x26')]+'/api/whatsapp/messages/'+_0x58e8a3['id']+_0x5805('0x27')+_0x37b5a6[_0x5805('0x28')]})['then'](function(_0x185fba){if(_0x185fba[_0x5805('0x29')]){return _0xa1d838[_0x5805('0x2a')]({'messageId':_0x185fba[_0x5805('0x29')]});}})['catch'](function(_0x23a418){logger[_0x5805('0x1a')](_0x5805('0x2b'),'afterCreate',_0x5805('0x1f'),util['inspect'](_0x23a418,{'showHidden':![],'depth':null}));});}else{logger[_0x5805('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5805('0x2c'),'twilio','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'sinch':var _0x4ce82d=_0x37b5a6[_0x5805('0x20')];var _0x178ffd=_0x37b5a6[_0x5805('0x21')];var _0x4323a8=_0x37b5a6[_0x5805('0x2d')]+_0x5805('0x2e')+_0x4ce82d+'/messages/';var _0x34e214={'to':[_0x58e8a3['phone']],'message':{'type':_0x5805('0x2f'),'text':_0x58e8a3['body']}};var _0xdc1952={'method':_0x5805('0x30'),'uri':_0x4323a8,'headers':{'Authorization':_0x5805('0x31')+_0x178ffd,'Content-Type':'application/json'},'body':_0x34e214,'json':!![]};rp(_0xdc1952)[_0x5805('0x17')](function(_0x384d49){if(_0x384d49[_0x5805('0x32')][0x0][_0x5805('0x33')]){return _0xa1d838['update']({'messageId':_0x384d49[_0x5805('0x32')][0x0]['message_id']});}})[_0x5805('0x19')](function(_0x105f0d){logger['err'](_0x5805('0x34'),_0x105f0d);});break;}}})[_0x5805('0x35')](function(){_0x202808();});}else{_0x202808();}}},'charset':_0x5805('0x36'),'collate':_0x5805('0x37')});}; \ No newline at end of file +var _0x7246=['body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','error','WhatsappAccount','type','twilio','accountSid','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','authToken','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','finally','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','node-fetch','path','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7246,0x155));var _0x6724=function(_0x4bcdc3,_0x20766c){_0x4bcdc3=_0x4bcdc3-0x0;var _0x2a8b56=_0x7246[_0x4bcdc3];return _0x2a8b56;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6724('0x0'));var moment=require(_0x6724('0x1'));var BPromise=require(_0x6724('0x2'));var rp=require(_0x6724('0x3'));var fetch=require(_0x6724('0x4'));var fs=require('fs');var path=require(_0x6724('0x5'));var rimraf=require('rimraf');var config=require(_0x6724('0x6'));var attributes=require(_0x6724('0x7'));module[_0x6724('0x8')]=function(_0x1156de,_0x220f45){return _0x1156de['define'](_0x6724('0x9'),attributes,{'tableName':_0x6724('0xa'),'paranoid':![],'indexes':[{'name':_0x6724('0xb'),'fields':['messageId']},{'name':_0x6724('0xc'),'fields':[_0x6724('0xd')],'type':_0x6724('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x56f39f,_0x1f0cfa,_0x4278f1){var _0x35c82e=_0x1156de['models'];var _0xe36541=_0x56f39f['get']({'plain':!![]});if(_0xe36541[_0x6724('0xf')][_0x6724('0x10')]()==='in'||_0xe36541[_0x6724('0xf')][_0x6724('0x10')]()===_0x6724('0x11')&&!_0xe36541[_0x6724('0x12')]&&!_[_0x6724('0x13')](_0xe36541[_0x6724('0x14')])){_0x35c82e['WhatsappInteraction'][_0x6724('0x15')]({'where':{'id':_0xe36541[_0x6724('0x16')]}})[_0x6724('0x17')](function(_0x53e6fd){if(_0x53e6fd){_0x53e6fd[_0x6724('0x18')]({'lastMsgAt':_0xe36541[_0x6724('0x19')],'lastMsgDirection':_0xe36541['direction'][_0x6724('0x10')]()});}})['catch'](function(_0x3a58e5){console[_0x6724('0x1a')](_0x3a58e5);});}if(_0xe36541[_0x6724('0xf')]==='out'&&!_0xe36541[_0x6724('0x12')]){var _0x221f40;_0x35c82e[_0x6724('0x1b')]['find']({'where':{'id':_0xe36541['WhatsappAccountId']},'raw':!![]})['then'](function(_0x2fbd56){_0x221f40=_0x2fbd56;if(_0x221f40&&_0x221f40[_0x6724('0x1c')]){switch(_0x221f40[_0x6724('0x1c')]){case'twilio':var _0x2e91df=require(_0x6724('0x1d'));if(_0x221f40[_0x6724('0x1e')]&&_0x221f40['authToken']&&_0x221f40[_0x6724('0x1f')]){var _0x353a80=new _0x2e91df(_0x221f40['accountSid'],_0x221f40['authToken']);_0x353a80[_0x6724('0x20')][_0x6724('0x21')]({'body':_0xe36541[_0x6724('0xd')],'to':_0x6724('0x22')+_0xe36541['phone'],'from':'whatsapp:'+_0x221f40[_0x6724('0x1f')],'statusCallback':_0x221f40[_0x6724('0x23')]+'/api/whatsapp/messages/'+_0xe36541['id']+_0x6724('0x24')+_0x221f40[_0x6724('0x25')]})[_0x6724('0x17')](function(_0x23d993){if(_0x23d993[_0x6724('0x26')]){return _0x56f39f[_0x6724('0x18')]({'messageId':_0x23d993[_0x6724('0x26')]});}})[_0x6724('0x27')](function(_0x78559b){logger[_0x6724('0x1a')](_0x6724('0x28'),_0x6724('0x29'),_0x6724('0x1d'),util[_0x6724('0x2a')](_0x78559b,{'showHidden':![],'depth':null}));});}else{logger[_0x6724('0x1a')](_0x6724('0x28'),_0x6724('0x29'),'twilio',_0x6724('0x2b'));}break;case _0x6724('0x2c'):var _0x221f39=_0x221f40['accountSid'];var _0x51edb9=_0x221f40[_0x6724('0x2d')];var _0x377b8e=_0x221f40[_0x6724('0x2e')]+_0x6724('0x2f')+_0x221f39+_0x6724('0x30');var _0x3b2079={'to':[_0xe36541[_0x6724('0x1f')]],'message':{'type':_0x6724('0x31'),'text':_0xe36541[_0x6724('0xd')]}};var _0x8a5dbf={'method':_0x6724('0x32'),'uri':_0x377b8e,'headers':{'Authorization':_0x6724('0x33')+_0x51edb9,'Content-Type':_0x6724('0x34')},'body':_0x3b2079,'json':!![]};rp(_0x8a5dbf)[_0x6724('0x17')](function(_0x1c8a6d){if(_0x1c8a6d[_0x6724('0x35')][0x0][_0x6724('0x36')]){return _0x56f39f[_0x6724('0x18')]({'messageId':_0x1c8a6d['statuses'][0x0][_0x6724('0x36')]});}})['catch'](function(_0x3352d0){logger[_0x6724('0x37')]('WhatsappMessage,\x20%s',_0x3352d0);});break;}}})[_0x6724('0x38')](function(){_0x4278f1();});}else{_0x4278f1();}}},'charset':_0x6724('0x39'),'collate':_0x6724('0x3a')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 9ebc480..3a2cff2 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 _0x5108=['error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappMessage.socket','register','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1fc4e2,_0x493c3b){var _0x2ba184=function(_0x58e64f){while(--_0x58e64f){_0x1fc4e2['push'](_0x1fc4e2['shift']());}};_0x2ba184(++_0x493c3b);}(_0x5108,0x18a));var _0x8510=function(_0x29d5f1,_0x3c4e15){_0x29d5f1=_0x29d5f1-0x0;var _0x48a2ea=_0x5108[_0x29d5f1];return _0x48a2ea;};'use strict';var _=require(_0x8510('0x0'));var util=require('util');var moment=require(_0x8510('0x1'));var BPromise=require(_0x8510('0x2'));var rs=require(_0x8510('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8510('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8510('0x5'))(_0x8510('0x6'));var config=require(_0x8510('0x7'));var jayson=require(_0x8510('0x8'));var client=jayson['client'][_0x8510('0x9')]({'port':0x232a});config[_0x8510('0xa')]=_[_0x8510('0xb')](config[_0x8510('0xa')],{'host':_0x8510('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8510('0xa')]));require(_0x8510('0xd'))[_0x8510('0xe')](socket);function respondWithRpcPromise(_0xccec06,_0x28b6a1,_0x15d984){return new BPromise(function(_0x23fb3e,_0x3cc792){return client[_0x8510('0xf')](_0xccec06,_0x15d984)['then'](function(_0x204706){logger[_0x8510('0x10')](_0x8510('0x11'),_0x28b6a1,'request\x20sent');logger[_0x8510('0x12')](_0x8510('0x13'),_0x28b6a1,_0x8510('0x14'),JSON[_0x8510('0x15')](_0x204706));if(_0x204706['error']){if(_0x204706[_0x8510('0x16')]['code']===0x1f4){logger[_0x8510('0x16')](_0x8510('0x11'),_0x28b6a1,_0x204706[_0x8510('0x16')][_0x8510('0x17')]);return _0x3cc792(_0x204706[_0x8510('0x16')][_0x8510('0x17')]);}logger[_0x8510('0x16')](_0x8510('0x11'),_0x28b6a1,_0x204706[_0x8510('0x16')][_0x8510('0x17')]);return _0x23fb3e(_0x204706[_0x8510('0x16')][_0x8510('0x17')]);}else{logger[_0x8510('0x10')](_0x8510('0x11'),_0x28b6a1,_0x8510('0x14'));_0x23fb3e(_0x204706[_0x8510('0x18')][_0x8510('0x17')]);}})[_0x8510('0x19')](function(_0x3e6f2e){logger[_0x8510('0x16')](_0x8510('0x11'),_0x28b6a1,_0x3e6f2e);_0x3cc792(_0x3e6f2e);});});}exports[_0x8510('0x1a')]=function(_0x1d5a13){var _0x25b85d=this;return new Promise(function(_0x2a2b1a,_0x272b02){return db[_0x8510('0x1b')][_0x8510('0x1c')](_0x1d5a13[_0x8510('0x1d')],{'raw':_0x1d5a13[_0x8510('0x1e')]?_0x1d5a13[_0x8510('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x8510('0x1f')](function(_0x408819){logger[_0x8510('0x10')](_0x8510('0x1a'),_0x1d5a13);logger['debug']('CreateWhatsappMessage',_0x1d5a13,JSON['stringify'](_0x408819));_0x2a2b1a(_0x408819);})[_0x8510('0x19')](function(_0x32a62f){logger[_0x8510('0x16')](_0x8510('0x1a'),_0x32a62f[_0x8510('0x17')],_0x1d5a13);_0x272b02(_0x25b85d[_0x8510('0x16')](0x1f4,_0x32a62f[_0x8510('0x17')]));});});}; \ No newline at end of file +var _0x175c=['request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateWhatsappMessage','create','body','options','raw','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','./whatsappMessage.socket'];(function(_0x2b4438,_0x504846){var _0x556612=function(_0x13571e){while(--_0x13571e){_0x2b4438['push'](_0x2b4438['shift']());}};_0x556612(++_0x504846);}(_0x175c,0x1b3));var _0xc175=function(_0x4c34b3,_0x4cf941){_0x4c34b3=_0x4c34b3-0x0;var _0x56cc8c=_0x175c[_0x4c34b3];return _0x56cc8c;};'use strict';var _=require(_0xc175('0x0'));var util=require(_0xc175('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc175('0x2'));var fs=require('fs');var Redis=require(_0xc175('0x3'));var db=require(_0xc175('0x4'))['db'];var utils=require(_0xc175('0x5'));var logger=require(_0xc175('0x6'))(_0xc175('0x7'));var config=require(_0xc175('0x8'));var jayson=require(_0xc175('0x9'));var client=jayson[_0xc175('0xa')]['http']({'port':0x232a});config['redis']=_[_0xc175('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc175('0xc'))['register'](socket);function respondWithRpcPromise(_0x297899,_0x16f0c1,_0x1c308e){return new BPromise(function(_0x21a3d8,_0x4032f7){return client[_0xc175('0xd')](_0x297899,_0x1c308e)[_0xc175('0xe')](function(_0x57303c){logger['info'](_0xc175('0xf'),_0x16f0c1,_0xc175('0x10'));logger[_0xc175('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x16f0c1,_0xc175('0x10'),JSON[_0xc175('0x12')](_0x57303c));if(_0x57303c[_0xc175('0x13')]){if(_0x57303c['error'][_0xc175('0x14')]===0x1f4){logger['error'](_0xc175('0xf'),_0x16f0c1,_0x57303c['error'][_0xc175('0x15')]);return _0x4032f7(_0x57303c['error'][_0xc175('0x15')]);}logger[_0xc175('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x16f0c1,_0x57303c[_0xc175('0x13')][_0xc175('0x15')]);return _0x21a3d8(_0x57303c['error'][_0xc175('0x15')]);}else{logger['info'](_0xc175('0xf'),_0x16f0c1,_0xc175('0x10'));_0x21a3d8(_0x57303c['result'][_0xc175('0x15')]);}})['catch'](function(_0x40968d){logger[_0xc175('0x13')](_0xc175('0xf'),_0x16f0c1,_0x40968d);_0x4032f7(_0x40968d);});});}exports[_0xc175('0x16')]=function(_0x26f898){var _0x2c9f23=this;return new Promise(function(_0x59d159,_0x183fc5){return db['WhatsappMessage'][_0xc175('0x17')](_0x26f898[_0xc175('0x18')],{'raw':_0x26f898[_0xc175('0x19')]?_0x26f898[_0xc175('0x19')][_0xc175('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x42170f){logger['info']('CreateWhatsappMessage',_0x26f898);logger['debug']('CreateWhatsappMessage',_0x26f898,JSON[_0xc175('0x12')](_0x42170f));_0x59d159(_0x42170f);})[_0xc175('0x1b')](function(_0x39d2f7){logger[_0xc175('0x13')](_0xc175('0x16'),_0x39d2f7[_0xc175('0x15')],_0x26f898);_0x183fc5(_0x2c9f23[_0xc175('0x13')](0x1f4,_0x39d2f7[_0xc175('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 18fa8a2..302ed28 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 _0xc367=['update','emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove'];(function(_0x58fb40,_0x1d1eb5){var _0x57b67f=function(_0x555b04){while(--_0x555b04){_0x58fb40['push'](_0x58fb40['shift']());}};_0x57b67f(++_0x1d1eb5);}(_0xc367,0x166));var _0x7c36=function(_0x64c96e,_0x24a5c6){_0x64c96e=_0x64c96e-0x0;var _0x1a6a60=_0xc367[_0x64c96e];return _0x1a6a60;};'use strict';var WhatsappMessageEvents=require(_0x7c36('0x0'));var events=['save',_0x7c36('0x1'),_0x7c36('0x2')];function createListener(_0x2f0e38,_0x20f882){return function(_0x3e6511){_0x20f882[_0x7c36('0x3')](_0x2f0e38,_0x3e6511);};}function removeListener(_0x113723,_0x598eb1){return function(){WhatsappMessageEvents[_0x7c36('0x4')](_0x113723,_0x598eb1);};}exports[_0x7c36('0x5')]=function(_0x3ce7d7){for(var _0x3ff2fd=0x0,_0x1241fc=events[_0x7c36('0x6')];_0x3ff2fd<_0x1241fc;_0x3ff2fd++){var _0x7da136=events[_0x3ff2fd];var _0x1dcf7b=createListener(_0x7c36('0x7')+_0x7da136,_0x3ce7d7);WhatsappMessageEvents['on'](_0x7da136,_0x1dcf7b);}}; \ No newline at end of file +var _0x0fcf=['update','emit','whatsappMessage:','save'];(function(_0x1af504,_0x35233e){var _0x5e463c=function(_0x5a5bab){while(--_0x5a5bab){_0x1af504['push'](_0x1af504['shift']());}};_0x5e463c(++_0x35233e);}(_0x0fcf,0x10b));var _0xf0fc=function(_0x4e8325,_0x4f5371){_0x4e8325=_0x4e8325-0x0;var _0x563e3f=_0x0fcf[_0x4e8325];return _0x563e3f;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=[_0xf0fc('0x0'),'remove',_0xf0fc('0x1')];function createListener(_0x57ae89,_0x1fa15a){return function(_0x440dff){_0x1fa15a[_0xf0fc('0x2')](_0x57ae89,_0x440dff);};}function removeListener(_0x43cb32,_0xb91dc9){return function(){WhatsappMessageEvents['removeListener'](_0x43cb32,_0xb91dc9);};}exports['register']=function(_0x5e6bef){for(var _0x4d05a8=0x0,_0x357a01=events['length'];_0x4d05a8<_0x357a01;_0x4d05a8++){var _0x379b01=events[_0x4d05a8];var _0x1bb2f9=createListener(_0xf0fc('0x3')+_0x379b01,_0x5e6bef);WhatsappMessageEvents['on'](_0x379b01,_0x1bb2f9);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 730023f..7c8f88e 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 _0xc4fc=['removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','update','delete','destroy'];(function(_0x38122a,_0x3e0a8d){var _0x345158=function(_0x4bf954){while(--_0x4bf954){_0x38122a['push'](_0x38122a['shift']());}};_0x345158(++_0x3e0a8d);}(_0xc4fc,0x1b5));var _0xcc4f=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xc4fc[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require(_0xcc4f('0x0'));var util=require(_0xcc4f('0x1'));var path=require(_0xcc4f('0x2'));var timeout=require(_0xcc4f('0x3'));var express=require(_0xcc4f('0x4'));var router=express[_0xcc4f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xcc4f('0x6'));var interaction=require(_0xcc4f('0x7'));var config=require('../../config/environment');var controller=require(_0xcc4f('0x8'));router[_0xcc4f('0x9')]('/',auth[_0xcc4f('0xa')](),controller[_0xcc4f('0xb')]);router[_0xcc4f('0x9')](_0xcc4f('0xc'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0xd')]);router[_0xcc4f('0x9')](_0xcc4f('0xe'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0xf')]);router['get'](_0xcc4f('0x10'),auth[_0xcc4f('0xa')](),controller['getMembers']);router[_0xcc4f('0x9')](_0xcc4f('0x11'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x12')]);router[_0xcc4f('0x9')](_0xcc4f('0x13'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x14')]);router['post']('/',auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x15')]);router[_0xcc4f('0x16')](_0xcc4f('0x11'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x17')]);router[_0xcc4f('0x16')](_0xcc4f('0x13'),auth[_0xcc4f('0xa')](),controller['addAgents']);router[_0xcc4f('0x18')](_0xcc4f('0xe'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x19')]);router[_0xcc4f('0x1a')](_0xcc4f('0xe'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x1b')]);router[_0xcc4f('0x1a')](_0xcc4f('0x11'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x1c')]);router[_0xcc4f('0x1a')](_0xcc4f('0x13'),auth[_0xcc4f('0xa')](),controller[_0xcc4f('0x1d')]);module[_0xcc4f('0x1e')]=router; \ No newline at end of file +var _0x60df=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','create','post','addAgents','put','update','delete','destroy'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x60df,0x15f));var _0xf60d=function(_0xbdbce3,_0xda64b7){_0xbdbce3=_0xbdbce3-0x0;var _0x27d6e7=_0x60df[_0xbdbce3];return _0x27d6e7;};'use strict';var multer=require(_0xf60d('0x0'));var util=require(_0xf60d('0x1'));var path=require(_0xf60d('0x2'));var timeout=require('connect-timeout');var express=require(_0xf60d('0x3'));var router=express[_0xf60d('0x4')]();var fs_extra=require(_0xf60d('0x5'));var auth=require(_0xf60d('0x6'));var interaction=require(_0xf60d('0x7'));var config=require(_0xf60d('0x8'));var controller=require(_0xf60d('0x9'));router[_0xf60d('0xa')]('/',auth[_0xf60d('0xb')](),controller[_0xf60d('0xc')]);router[_0xf60d('0xa')](_0xf60d('0xd'),auth[_0xf60d('0xb')](),controller['describe']);router[_0xf60d('0xa')](_0xf60d('0xe'),auth[_0xf60d('0xb')](),controller['show']);router[_0xf60d('0xa')](_0xf60d('0xf'),auth[_0xf60d('0xb')](),controller[_0xf60d('0x10')]);router[_0xf60d('0xa')](_0xf60d('0x11'),auth[_0xf60d('0xb')](),controller[_0xf60d('0x12')]);router[_0xf60d('0xa')](_0xf60d('0x13'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0xf60d('0xb')](),controller[_0xf60d('0x14')]);router['post'](_0xf60d('0x11'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf60d('0x15')](_0xf60d('0x13'),auth['isAuthenticated'](),controller[_0xf60d('0x16')]);router[_0xf60d('0x17')](_0xf60d('0xe'),auth[_0xf60d('0xb')](),controller[_0xf60d('0x18')]);router[_0xf60d('0x19')](_0xf60d('0xe'),auth[_0xf60d('0xb')](),controller[_0xf60d('0x1a')]);router[_0xf60d('0x19')](_0xf60d('0x11'),auth[_0xf60d('0xb')](),controller['removeTeams']);router[_0xf60d('0x19')](_0xf60d('0x13'),auth[_0xf60d('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index c860ec7..78ebbe9 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 _0xc368=['ENUM','rrmemory','beepall','STRING','exports','name','INTEGER'];(function(_0x55821d,_0x27a22e){var _0x58ea8a=function(_0x5bdd3d){while(--_0x5bdd3d){_0x55821d['push'](_0x55821d['shift']());}};_0x58ea8a(++_0x27a22e);}(_0xc368,0x7b));var _0x8c36=function(_0x566591,_0x3fadbb){_0x566591=_0x566591-0x0;var _0x55ed13=_0xc368[_0x566591];return _0x55ed13;};'use strict';var Sequelize=require('sequelize');module[_0x8c36('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x8c36('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x8c36('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c36('0x3')](_0x8c36('0x4'),_0x8c36('0x5'),'roundrobin')},'description':{'type':Sequelize[_0x8c36('0x6')]}}; \ No newline at end of file +var _0x292e=['sequelize','exports','STRING','name','rrmemory','beepall','roundrobin'];(function(_0x5ebe34,_0x421337){var _0x36a3ee=function(_0x1d3306){while(--_0x1d3306){_0x5ebe34['push'](_0x5ebe34['shift']());}};_0x36a3ee(++_0x421337);}(_0x292e,0xcb));var _0xe292=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x292e[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xe292('0x0'));module[_0xe292('0x1')]={'name':{'type':Sequelize[_0xe292('0x2')],'unique':_0xe292('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe292('0x4'),_0xe292('0x5'),_0xe292('0x6'))},'description':{'type':Sequelize[_0xe292('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 4236607..af3c8fd 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 _0x3bfd=['show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','UserProfileResource','body','describe','getMembers','findOne','WhatsappQueueId','filter','UserWhatsappQueue','User','findAndCountAll','agent','updatedAt','createdAt','format','SIP','whatsappPause','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','sequelize','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','compact','value','transaction','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./whatsappQueue.socket','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','WhatsappQueues','destroy','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','WhatsappQueue','includeAll','include','findAll','rows','catch'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x3bfd,0x1f1));var _0xd3bf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3bfd[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xd3bf('0x0'));var rimraf=require(_0xd3bf('0x1'));var zipdir=require(_0xd3bf('0x2'));var jsonpatch=require(_0xd3bf('0x3'));var rp=require('request-promise');var moment=require(_0xd3bf('0x4'));var BPromise=require(_0xd3bf('0x5'));var Mustache=require(_0xd3bf('0x6'));var util=require(_0xd3bf('0x7'));var path=require('path');var sox=require(_0xd3bf('0x8'));var csv=require(_0xd3bf('0x9'));var ejs=require(_0xd3bf('0xa'));var fs=require('fs');var fs_extra=require(_0xd3bf('0xb'));var _=require(_0xd3bf('0xc'));var squel=require(_0xd3bf('0xd'));var crypto=require(_0xd3bf('0xe'));var jsforce=require(_0xd3bf('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xd3bf('0x9'));var querystring=require(_0xd3bf('0x10'));var Papa=require('papaparse');var Redis=require(_0xd3bf('0x11'));var authService=require(_0xd3bf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd3bf('0x13'));var hardwareService=require(_0xd3bf('0x14'));var logger=require(_0xd3bf('0x15'))(_0xd3bf('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd3bf('0x17'));var db=require(_0xd3bf('0x18'))['db'];config['redis']=_[_0xd3bf('0x19')](config[_0xd3bf('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xd3bf('0x1b'))(new Redis(config['redis']));require(_0xd3bf('0x1c'))['register'](socket);function respondWithStatusCode(_0x6f992b,_0xc7972d){_0xc7972d=_0xc7972d||0xcc;return function(_0xdc5a68){if(_0xdc5a68){return _0x6f992b['sendStatus'](_0xc7972d);}return _0x6f992b[_0xd3bf('0x1d')](_0xc7972d)[_0xd3bf('0x1e')]();};}function respondWithResult(_0x4f9523,_0x3b0719){_0x3b0719=_0x3b0719||0xc8;return function(_0x3ef268){if(_0x3ef268){return _0x4f9523[_0xd3bf('0x1d')](_0x3b0719)[_0xd3bf('0x1f')](_0x3ef268);}};}function respondWithFilteredResult(_0x37eca2,_0x4ef76e){return function(_0x223819){if(_0x223819){var _0x1cf865=typeof _0x4ef76e['offset']===_0xd3bf('0x20')&&typeof _0x4ef76e[_0xd3bf('0x21')]===_0xd3bf('0x20');var _0x2f2d27=_0x223819[_0xd3bf('0x22')];var _0x90317=_0x1cf865?0x0:_0x4ef76e[_0xd3bf('0x23')];var _0x555c74=_0x1cf865?_0x223819[_0xd3bf('0x22')]:_0x4ef76e['offset']+_0x4ef76e['limit'];var _0x25ebaa;if(_0x555c74>=_0x2f2d27){_0x555c74=_0x2f2d27;_0x25ebaa=0xc8;}else{_0x25ebaa=0xce;}_0x37eca2['status'](_0x25ebaa);return _0x37eca2[_0xd3bf('0x24')](_0xd3bf('0x25'),_0x90317+'-'+_0x555c74+'/'+_0x2f2d27)[_0xd3bf('0x1f')](_0x223819);}return null;};}function patchUpdates(_0x176475){return function(_0x7649e5){try{jsonpatch[_0xd3bf('0x26')](_0x7649e5,_0x176475,!![]);}catch(_0x2bfcf0){return BPromise[_0xd3bf('0x27')](_0x2bfcf0);}return _0x7649e5[_0xd3bf('0x28')]();};}function saveUpdates(_0x396076,_0x3dc805){return function(_0x3caf7b){if(_0x3caf7b){return _0x3caf7b[_0xd3bf('0x29')](_0x396076)[_0xd3bf('0x2a')](function(_0x1bab00){return _0x1bab00;});}return null;};}function removeEntity(_0x1b033e,_0x417cfe){return function(_0xf80602){if(_0xf80602){return _0xf80602['destroy']()[_0xd3bf('0x2a')](function(){var _0x24f475=_0xf80602[_0xd3bf('0x2b')]({'plain':!![]});var _0x4151b6=_0xd3bf('0x2c');return db['UserProfileResource'][_0xd3bf('0x2d')]({'where':{'type':_0x4151b6,'resourceId':_0x24f475['id']}})[_0xd3bf('0x2a')](function(){return _0xf80602;});})[_0xd3bf('0x2a')](function(){_0x1b033e[_0xd3bf('0x1d')](0xcc)[_0xd3bf('0x1e')]();});}};}function handleEntityNotFound(_0x4a1dc5,_0x4a5b44){return function(_0x55c1d9){if(!_0x55c1d9){_0x4a1dc5[_0xd3bf('0x2e')](0x194);}return _0x55c1d9;};}function handleError(_0x19b425,_0x3113d4){_0x3113d4=_0x3113d4||0x1f4;return function(_0x4f9c71){logger[_0xd3bf('0x2f')](_0x4f9c71[_0xd3bf('0x30')]);if(_0x4f9c71[_0xd3bf('0x31')]){delete _0x4f9c71[_0xd3bf('0x31')];}_0x19b425['status'](_0x3113d4)[_0xd3bf('0x32')](_0x4f9c71);};}exports['index']=function(_0x397233,_0x1a44fc){var _0xdd8a35={},_0x42d6da={},_0x1c64df={'count':0x0,'rows':[]};var _0x431aa5=_[_0xd3bf('0x33')](db['WhatsappQueue'][_0xd3bf('0x34')],function(_0x145f5d){return{'name':_0x145f5d[_0xd3bf('0x35')],'type':_0x145f5d[_0xd3bf('0x36')][_0xd3bf('0x37')]};});_0x42d6da[_0xd3bf('0x38')]=_[_0xd3bf('0x33')](_0x431aa5,'name');_0x42d6da[_0xd3bf('0x39')]=_[_0xd3bf('0x3a')](_0x397233[_0xd3bf('0x39')]);_0x42d6da[_0xd3bf('0x3b')]=_['intersection'](_0x42d6da[_0xd3bf('0x38')],_0x42d6da[_0xd3bf('0x39')]);_0xdd8a35['attributes']=_[_0xd3bf('0x3c')](_0x42d6da[_0xd3bf('0x38')],qs[_0xd3bf('0x3d')](_0x397233[_0xd3bf('0x39')][_0xd3bf('0x3d')]));_0xdd8a35[_0xd3bf('0x3e')]=_0xdd8a35['attributes'][_0xd3bf('0x3f')]?_0xdd8a35[_0xd3bf('0x3e')]:_0x42d6da['model'];if(!_0x397233['query'][_0xd3bf('0x40')](_0xd3bf('0x41'))){_0xdd8a35[_0xd3bf('0x21')]=qs[_0xd3bf('0x21')](_0x397233[_0xd3bf('0x39')][_0xd3bf('0x21')]);_0xdd8a35['offset']=qs[_0xd3bf('0x23')](_0x397233[_0xd3bf('0x39')][_0xd3bf('0x23')]);}_0xdd8a35[_0xd3bf('0x42')]=qs[_0xd3bf('0x43')](_0x397233[_0xd3bf('0x39')][_0xd3bf('0x43')]);_0xdd8a35[_0xd3bf('0x44')]=qs[_0xd3bf('0x3b')](_[_0xd3bf('0x45')](_0x397233[_0xd3bf('0x39')],_0x42d6da[_0xd3bf('0x3b')]),_0x431aa5);if(_0x397233['query']['filter']){_0xdd8a35['where']=_['merge'](_0xdd8a35[_0xd3bf('0x44')],{'$or':_['map'](_0x431aa5,function(_0x491f91){if(_0x491f91[_0xd3bf('0x36')]!==_0xd3bf('0x46')){var _0x3207c7={};_0x3207c7[_0x491f91['name']]={'$like':'%'+_0x397233[_0xd3bf('0x39')]['filter']+'%'};return _0x3207c7;}})});}_0xdd8a35=_[_0xd3bf('0x47')]({},_0xdd8a35,_0x397233[_0xd3bf('0x48')]);var _0x23d1f4={'where':_0xdd8a35[_0xd3bf('0x44')]};return db[_0xd3bf('0x49')]['count'](_0x23d1f4)[_0xd3bf('0x2a')](function(_0x5378d8){_0x1c64df['count']=_0x5378d8;if(_0x397233[_0xd3bf('0x39')][_0xd3bf('0x4a')]){_0xdd8a35[_0xd3bf('0x4b')]=[{'all':!![]}];}return db['WhatsappQueue'][_0xd3bf('0x4c')](_0xdd8a35);})[_0xd3bf('0x2a')](function(_0x718de9){_0x1c64df[_0xd3bf('0x4d')]=_0x718de9;return _0x1c64df;})['then'](respondWithFilteredResult(_0x1a44fc,_0xdd8a35))[_0xd3bf('0x4e')](handleError(_0x1a44fc,null));};exports[_0xd3bf('0x4f')]=function(_0x32b71e,_0x14c65f){var _0x49cc38={'raw':!![],'where':{'id':_0x32b71e[_0xd3bf('0x50')]['id']}},_0x4d4da0={};_0x4d4da0[_0xd3bf('0x38')]=_[_0xd3bf('0x3a')](db[_0xd3bf('0x49')]['rawAttributes']);_0x4d4da0[_0xd3bf('0x39')]=_[_0xd3bf('0x3a')](_0x32b71e[_0xd3bf('0x39')]);_0x4d4da0[_0xd3bf('0x3b')]=_[_0xd3bf('0x3c')](_0x4d4da0['model'],_0x4d4da0[_0xd3bf('0x39')]);_0x49cc38[_0xd3bf('0x3e')]=_['intersection'](_0x4d4da0[_0xd3bf('0x38')],qs[_0xd3bf('0x3d')](_0x32b71e[_0xd3bf('0x39')][_0xd3bf('0x3d')]));_0x49cc38[_0xd3bf('0x3e')]=_0x49cc38[_0xd3bf('0x3e')]['length']?_0x49cc38['attributes']:_0x4d4da0[_0xd3bf('0x38')];if(_0x32b71e[_0xd3bf('0x39')][_0xd3bf('0x4a')]){_0x49cc38[_0xd3bf('0x4b')]=[{'all':!![]}];}_0x49cc38=_[_0xd3bf('0x47')]({},_0x49cc38,_0x32b71e[_0xd3bf('0x48')]);return db[_0xd3bf('0x49')]['find'](_0x49cc38)['then'](handleEntityNotFound(_0x14c65f,null))[_0xd3bf('0x2a')](respondWithResult(_0x14c65f,null))[_0xd3bf('0x4e')](handleError(_0x14c65f,null));};exports[_0xd3bf('0x51')]=function(_0x166ede,_0x45caa6){return db[_0xd3bf('0x49')][_0xd3bf('0x51')](_0x166ede['body'],{})[_0xd3bf('0x2a')](function(_0x2925d3){var _0x2e5522=_0x166ede[_0xd3bf('0x52')][_0xd3bf('0x2b')]({'plain':!![]});if(!_0x2e5522)throw new Error(_0xd3bf('0x53'));if(_0x2e5522['role']===_0xd3bf('0x52')){var _0x2818b3=_0x2925d3[_0xd3bf('0x2b')]({'plain':!![]});var _0x5a6e54='WhatsappQueues';return db[_0xd3bf('0x54')][_0xd3bf('0x55')]({'where':{'name':_0x5a6e54,'userProfileId':_0x2e5522[_0xd3bf('0x56')]},'raw':!![]})[_0xd3bf('0x2a')](function(_0x40af2c){if(_0x40af2c&&_0x40af2c['autoAssociation']===0x0){return db[_0xd3bf('0x57')]['create']({'name':_0x2818b3['name'],'resourceId':_0x2818b3['id'],'type':_0x40af2c[_0xd3bf('0x31')],'sectionId':_0x40af2c['id']},{})[_0xd3bf('0x2a')](function(){return _0x2925d3;});}else{return _0x2925d3;}})[_0xd3bf('0x4e')](function(_0x301bc2){logger[_0xd3bf('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x301bc2);throw _0x301bc2;});}return _0x2925d3;})[_0xd3bf('0x2a')](respondWithResult(_0x45caa6,0xc9))[_0xd3bf('0x4e')](handleError(_0x45caa6,null));};exports['update']=function(_0x4636b6,_0x3e006a){if(_0x4636b6[_0xd3bf('0x58')]['id']){delete _0x4636b6[_0xd3bf('0x58')]['id'];}return db[_0xd3bf('0x49')]['find']({'where':{'id':_0x4636b6['params']['id']}})[_0xd3bf('0x2a')](handleEntityNotFound(_0x3e006a,null))[_0xd3bf('0x2a')](saveUpdates(_0x4636b6[_0xd3bf('0x58')],null))[_0xd3bf('0x2a')](respondWithResult(_0x3e006a,null))[_0xd3bf('0x4e')](handleError(_0x3e006a,null));};exports['destroy']=function(_0x38f272,_0x15ad31){return db[_0xd3bf('0x49')][_0xd3bf('0x55')]({'where':{'id':_0x38f272[_0xd3bf('0x50')]['id']}})[_0xd3bf('0x2a')](handleEntityNotFound(_0x15ad31,null))['then'](removeEntity(_0x15ad31,null))[_0xd3bf('0x4e')](handleError(_0x15ad31,null));};exports['describe']=function(_0x581ae8,_0x357430){return db[_0xd3bf('0x49')][_0xd3bf('0x59')]()['then'](respondWithResult(_0x357430,null))[_0xd3bf('0x4e')](handleError(_0x357430,null));};exports[_0xd3bf('0x5a')]=function(_0x66e4c1,_0xceb3be,_0x4b8422){var _0x4d38f5={'raw':!![],'where':{}},_0x1889b5={},_0x5bffa2;return db['WhatsappQueue'][_0xd3bf('0x5b')]({'where':{'id':_0x66e4c1[_0xd3bf('0x50')]['id']}})[_0xd3bf('0x2a')](handleEntityNotFound(_0xceb3be,null))[_0xd3bf('0x2a')](function(_0x119659){if(_0x119659){_0x5bffa2=_0x119659[_0xd3bf('0x2b')]({'plain':!![]});_0x1889b5[_0xd3bf('0x38')]=_[_0xd3bf('0x3a')](db['UserWhatsappQueue'][_0xd3bf('0x34')]);_0x1889b5['query']=_[_0xd3bf('0x3a')](_0x66e4c1[_0xd3bf('0x39')]);_0x1889b5['filters']=_['intersection'](_0x1889b5['model'],_0x1889b5[_0xd3bf('0x39')]);_0x4d38f5[_0xd3bf('0x3e')]=_[_0xd3bf('0x3c')](_0x1889b5[_0xd3bf('0x38')],qs[_0xd3bf('0x3d')](_0x66e4c1[_0xd3bf('0x39')][_0xd3bf('0x3d')]));_0x4d38f5[_0xd3bf('0x3e')]=_0x4d38f5[_0xd3bf('0x3e')]['length']?_0x4d38f5[_0xd3bf('0x3e')]:_0x1889b5[_0xd3bf('0x38')];if(!_0x66e4c1[_0xd3bf('0x39')][_0xd3bf('0x40')]('nolimit')){_0x4d38f5[_0xd3bf('0x21')]=qs[_0xd3bf('0x21')](_0x66e4c1[_0xd3bf('0x39')]['limit']);_0x4d38f5['offset']=qs[_0xd3bf('0x23')](_0x66e4c1[_0xd3bf('0x39')][_0xd3bf('0x23')]);}_0x4d38f5[_0xd3bf('0x42')]=qs[_0xd3bf('0x43')](_0x66e4c1[_0xd3bf('0x39')][_0xd3bf('0x43')]);_0x4d38f5['where']=qs[_0xd3bf('0x3b')](_['pick'](_0x66e4c1['query'],_0x1889b5[_0xd3bf('0x3b')]));_0x4d38f5[_0xd3bf('0x44')][_0xd3bf('0x5c')]=_0x119659['id'];if(_0x66e4c1[_0xd3bf('0x39')]['filter']){_0x4d38f5[_0xd3bf('0x44')]=_['merge'](_0x4d38f5[_0xd3bf('0x44')],{'$or':_[_0xd3bf('0x33')](_0x4d38f5[_0xd3bf('0x3e')],function(_0x2eb01e){var _0x575f10={};_0x575f10[_0x2eb01e]={'$like':'%'+_0x66e4c1['query'][_0xd3bf('0x5d')]+'%'};return _0x575f10;})});}_0x4d38f5=_[_0xd3bf('0x47')]({},_0x4d38f5,_0x66e4c1[_0xd3bf('0x48')]);return db[_0xd3bf('0x5e')]['findAll'](_0x4d38f5);}})[_0xd3bf('0x2a')](function(_0x3fd5b7){if(_0x3fd5b7){return db[_0xd3bf('0x5f')][_0xd3bf('0x60')]({'where':{'id':_[_0xd3bf('0x33')](_0x3fd5b7,'UserId'),'role':_0xd3bf('0x61')},'attributes':['id',_0xd3bf('0x31'),'whatsappPause',_0xd3bf('0x62'),_0xd3bf('0x63')]});}})[_0xd3bf('0x2a')](function(_0x14787d){if(_0x14787d){return{'count':_0x14787d[_0xd3bf('0x22')],'rows':_[_0xd3bf('0x33')](_0x14787d['rows'],function(_0x4b8a72){return{'membername':_0x4b8a72[_0xd3bf('0x31')],'UserId':_0x4b8a72['id'],'queue_name':_0x5bffa2[_0xd3bf('0x31')],'WhatsappQueueId':_0x5bffa2['id'],'interface':util[_0xd3bf('0x64')]('%s/%s',_0xd3bf('0x65'),_0x4b8a72[_0xd3bf('0x31')]),'penalty':0x0,'paused':_0x4b8a72[_0xd3bf('0x66')],'createdAt':_0x4b8a72[_0xd3bf('0x63')],'updatedAt':_0x4b8a72[_0xd3bf('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd3bf('0x2a')](respondWithFilteredResult(_0xceb3be,_0x4d38f5))[_0xd3bf('0x4e')](handleError(_0xceb3be,null));};exports[_0xd3bf('0x67')]=function(_0x56cb84,_0x2c6824,_0x29231b){var _0x5953df={};var _0x54e8af={};var _0x3fff0f;var _0x2b8b9a;return db[_0xd3bf('0x49')]['findOne']({'where':{'id':_0x56cb84[_0xd3bf('0x50')]['id']}})[_0xd3bf('0x2a')](handleEntityNotFound(_0x2c6824,null))[_0xd3bf('0x2a')](function(_0x286b90){if(_0x286b90){_0x3fff0f=_0x286b90;_0x54e8af[_0xd3bf('0x38')]=_['keys'](db[_0xd3bf('0x68')][_0xd3bf('0x34')]);_0x54e8af[_0xd3bf('0x39')]=_[_0xd3bf('0x3a')](_0x56cb84[_0xd3bf('0x39')]);_0x54e8af[_0xd3bf('0x3b')]=_[_0xd3bf('0x3c')](_0x54e8af['model'],_0x54e8af[_0xd3bf('0x39')]);_0x5953df[_0xd3bf('0x3e')]=_[_0xd3bf('0x3c')](_0x54e8af[_0xd3bf('0x38')],qs['fields'](_0x56cb84[_0xd3bf('0x39')][_0xd3bf('0x3d')]));_0x5953df['attributes']=_0x5953df[_0xd3bf('0x3e')][_0xd3bf('0x3f')]?_0x5953df[_0xd3bf('0x3e')]:_0x54e8af['model'];_0x5953df[_0xd3bf('0x42')]=qs[_0xd3bf('0x43')](_0x56cb84[_0xd3bf('0x39')][_0xd3bf('0x43')]);_0x5953df[_0xd3bf('0x44')]=qs['filters'](_[_0xd3bf('0x45')](_0x56cb84[_0xd3bf('0x39')],_0x54e8af['filters']));if(_0x56cb84['query'][_0xd3bf('0x5d')]){_0x5953df['where']=_[_0xd3bf('0x47')](_0x5953df[_0xd3bf('0x44')],{'$or':_['map'](_0x5953df[_0xd3bf('0x3e')],function(_0x2d412b){var _0x4f095f={};_0x4f095f[_0x2d412b]={'$like':'%'+_0x56cb84['query'][_0xd3bf('0x5d')]+'%'};return _0x4f095f;})});}_0x5953df=_[_0xd3bf('0x47')]({},_0x5953df,_0x56cb84[_0xd3bf('0x48')]);return _0x3fff0f[_0xd3bf('0x67')](_0x5953df);}})[_0xd3bf('0x2a')](function(_0x9f049f){if(_0x9f049f){_0x2b8b9a=_0x9f049f[_0xd3bf('0x3f')];if(!_0x56cb84[_0xd3bf('0x39')]['hasOwnProperty'](_0xd3bf('0x41'))){_0x5953df[_0xd3bf('0x21')]=qs[_0xd3bf('0x21')](_0x56cb84[_0xd3bf('0x39')][_0xd3bf('0x21')]);_0x5953df['offset']=qs['offset'](_0x56cb84['query'][_0xd3bf('0x23')]);}return _0x3fff0f[_0xd3bf('0x67')](_0x5953df);}})['then'](function(_0x3ee871){if(_0x3ee871){return _0x3ee871?{'count':_0x2b8b9a,'rows':_0x3ee871}:null;}})[_0xd3bf('0x2a')](respondWithResult(_0x2c6824,null))['catch'](handleError(_0x2c6824,null));};exports[_0xd3bf('0x69')]=function(_0x16e476,_0x3ecc38,_0x2f1be1){var _0x48b7fa=_0x16e476[_0xd3bf('0x58')][_0xd3bf('0x6a')];return db[_0xd3bf('0x68')][_0xd3bf('0x4c')]({'where':{'id':_0x48b7fa},'attributes':['id'],'include':[{'model':db[_0xd3bf('0x5f')],'as':_0xd3bf('0x6b'),'attributes':['id',_0xd3bf('0x31'),_0xd3bf('0x6c'),_0xd3bf('0x6d'),_0xd3bf('0x6e')],'raw':!![]}]})[_0xd3bf('0x2a')](function(_0x2c3e38){if(_0x2c3e38){var _0x440808=_['flatMap'](_0x2c3e38,function(_0x304e98){var _0x5ee665=_0x304e98[_0xd3bf('0x2b')]({'plain':!![]});return _0x5ee665[_0xd3bf('0x6b')];});return db[_0xd3bf('0x49')][_0xd3bf('0x55')]({'where':{'id':_0x16e476['params']['id']}})[_0xd3bf('0x2a')](function(_0x25b8e5){return db[_0xd3bf('0x6f')]['transaction'](function(_0x22b600){return _0x25b8e5[_0xd3bf('0x69')](_0x48b7fa,{'transaction':_0x22b600})[_0xd3bf('0x2a')](function(){return BPromise[_0xd3bf('0x70')](_0x440808,function(_0x186bc0){return db[_0xd3bf('0x5e')][_0xd3bf('0x71')]({'where':{'UserId':_0x186bc0['id'],'WhatsappQueueId':_0x16e476[_0xd3bf('0x50')]['id']},'transaction':_0x22b600});});})['then'](function(){_0x440808['forEach'](function(_0x229395){socket[_0xd3bf('0x72')](_0xd3bf('0x73'),{'UserId':_0x229395['id'],'WhatsappQueueId':_0x25b8e5['id']});});});});});}})[_0xd3bf('0x2a')](respondWithStatusCode(_0x3ecc38,null))[_0xd3bf('0x4e')](handleError(_0x3ecc38,null));};exports[_0xd3bf('0x74')]=function(_0x98c241,_0x4ef75b,_0x31096b){return db[_0xd3bf('0x68')][_0xd3bf('0x4c')]({'where':{'id':_0x98c241[_0xd3bf('0x39')][_0xd3bf('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xd3bf('0x5f')],'as':_0xd3bf('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xd3bf('0x2a')](handleEntityNotFound(_0x4ef75b,null))[_0xd3bf('0x2a')](function(_0x30b094){var _0x535680=_[_0xd3bf('0x33')](_0x30b094,'id');var _0x208def=[];var _0x34dc37=[];var _0x541a7c=squel[_0xd3bf('0x75')]();_0x541a7c[_0xd3bf('0x76')](_0xd3bf('0x77'))[_0xd3bf('0x78')](_0xd3bf('0x79'),'tq')[_0xd3bf('0x7a')](_0xd3bf('0x7b'),'ut',_0xd3bf('0x7c'))[_0xd3bf('0x44')]('WhatsappQueueId\x20=\x20?',_0x98c241[_0xd3bf('0x50')]['id']);for(var _0x59eb74=0x0;_0x59eb74<_0x30b094['length'];_0x59eb74+=0x1){let _0x5235e7=_0x30b094[_0x59eb74];for(var _0x174b37=0x0;_0x174b37<_0x5235e7[_0xd3bf('0x6b')][_0xd3bf('0x3f')];_0x174b37+=0x1){let _0x4c518c=_0x5235e7[_0xd3bf('0x6b')][_0x174b37];var _0x169f5e=_0x541a7c[_0xd3bf('0x7d')]();_0x169f5e['where'](_0xd3bf('0x7e'),_0x4c518c['id']);_0x34dc37[_0xd3bf('0x7f')](db['sequelize'][_0xd3bf('0x39')](_0x169f5e[_0xd3bf('0x80')](),{'type':db['sequelize']['QueryTypes'][_0xd3bf('0x81')]})[_0xd3bf('0x2a')](function(_0x5af995){if(_0x5af995['length']===0x1){return _0x4c518c['id'];}else{var _0x3984b7=_[_0xd3bf('0x82')](_[_0xd3bf('0x33')](_0x5af995,_0xd3bf('0x83')),function(_0x41592a){return _['includes'](_0x535680,_0x41592a);});if(_0x3984b7){return _0x4c518c['id'];}}}));}}return BPromise['all'](_0x34dc37)[_0xd3bf('0x2a')](function(_0x3ca661){_0x208def=_(_0x208def)['union'](_0x3ca661)[_0xd3bf('0x84')]()[_0xd3bf('0x85')]();return db[_0xd3bf('0x49')][_0xd3bf('0x55')]({'where':{'id':_0x98c241[_0xd3bf('0x50')]['id']}})['then'](function(_0x1cc309){return db[_0xd3bf('0x6f')][_0xd3bf('0x86')](function(_0x172ee9){return _0x1cc309[_0xd3bf('0x74')](_0x98c241[_0xd3bf('0x39')][_0xd3bf('0x6a')],{'transaction':_0x172ee9})[_0xd3bf('0x2a')](function(){if(!_[_0xd3bf('0x87')](_0x208def)){return _0x1cc309[_0xd3bf('0x88')](_0x208def,{'transaction':_0x172ee9});}})[_0xd3bf('0x2a')](function(){_0x208def[_0xd3bf('0x89')](function(_0x4c144f){socket[_0xd3bf('0x72')](_0xd3bf('0x8a'),{'UserId':_0x4c144f,'WhatsappQueueId':_0x1cc309['id']});});});});});});})['then'](respondWithStatusCode(_0x4ef75b,null))[_0xd3bf('0x4e')](handleError(_0x4ef75b,null));};exports[_0xd3bf('0x8b')]=function(_0x15f4e9,_0x2b60db,_0x31c7d8){return db[_0xd3bf('0x49')]['find']({'where':{'id':_0x15f4e9['params']['id']}})['then'](handleEntityNotFound(_0x2b60db,null))[_0xd3bf('0x2a')](function(_0x339972){if(_0x339972){return _0x339972[_0xd3bf('0x8b')](_0x15f4e9[_0xd3bf('0x58')]['ids'],_[_0xd3bf('0x8c')](_0x15f4e9[_0xd3bf('0x58')],[_0xd3bf('0x6a'),'id'])||{})[_0xd3bf('0x8d')](function(_0x374e36){for(var _0x538c16=0x0;_0x538c16<_0x15f4e9['body'][_0xd3bf('0x6a')][_0xd3bf('0x3f')];_0x538c16+=0x1){socket['emit'](_0xd3bf('0x73'),{'UserId':Number(_0x15f4e9[_0xd3bf('0x58')]['ids'][_0x538c16]),'WhatsappQueueId':Number(_0x15f4e9['params']['id'])});}return _0x374e36;});}})[_0xd3bf('0x2a')](respondWithResult(_0x2b60db,null))['catch'](handleError(_0x2b60db,null));};exports[_0xd3bf('0x88')]=function(_0x41f767,_0x20968c,_0x1411c3){return db['WhatsappQueue'][_0xd3bf('0x55')]({'where':{'id':_0x41f767[_0xd3bf('0x50')]['id']}})['then'](handleEntityNotFound(_0x20968c,null))[_0xd3bf('0x2a')](function(_0x4f6204){if(_0x4f6204){return _0x4f6204['removeAgents'](_0x41f767[_0xd3bf('0x39')][_0xd3bf('0x6a')])[_0xd3bf('0x2a')](function(){if(_[_0xd3bf('0x8e')](_0x41f767[_0xd3bf('0x39')]['ids'])){for(var _0x18822b=0x0;_0x18822b<_0x41f767[_0xd3bf('0x39')][_0xd3bf('0x6a')]['length'];_0x18822b+=0x1){socket['emit'](_0xd3bf('0x8a'),{'UserId':Number(_0x41f767['query'][_0xd3bf('0x6a')][_0x18822b]),'WhatsappQueueId':Number(_0x41f767[_0xd3bf('0x50')]['id'])});}}else{socket['emit'](_0xd3bf('0x8a'),{'UserId':Number(_0x41f767[_0xd3bf('0x39')][_0xd3bf('0x6a')]),'WhatsappQueueId':Number(_0x41f767[_0xd3bf('0x50')]['id'])});}});}})[_0xd3bf('0x2a')](respondWithStatusCode(_0x20968c,null))[_0xd3bf('0x4e')](handleError(_0x20968c,null));};exports[_0xd3bf('0x8f')]=function(_0x627c07,_0x4916da,_0x1b5c63){var _0x351b57={};var _0x3314bb={};var _0x4286a3;var _0x204455;return db[_0xd3bf('0x49')][_0xd3bf('0x5b')]({'where':{'id':_0x627c07['params']['id']}})['then'](handleEntityNotFound(_0x4916da,null))[_0xd3bf('0x2a')](function(_0x5a19a6){if(_0x5a19a6){_0x4286a3=_0x5a19a6;_0x3314bb[_0xd3bf('0x38')]=_[_0xd3bf('0x3a')](db['User'][_0xd3bf('0x34')]);_0x3314bb['query']=_[_0xd3bf('0x3a')](_0x627c07[_0xd3bf('0x39')]);_0x3314bb['filters']=_[_0xd3bf('0x3c')](_0x3314bb[_0xd3bf('0x38')],_0x3314bb[_0xd3bf('0x39')]);_0x351b57[_0xd3bf('0x3e')]=_['intersection'](_0x3314bb[_0xd3bf('0x38')],qs['fields'](_0x627c07[_0xd3bf('0x39')][_0xd3bf('0x3d')]));_0x351b57['attributes']=_0x351b57['attributes']['length']?_0x351b57['attributes']:_0x3314bb[_0xd3bf('0x38')];_0x351b57[_0xd3bf('0x42')]=qs[_0xd3bf('0x43')](_0x627c07[_0xd3bf('0x39')]['sort']);_0x351b57[_0xd3bf('0x44')]=qs['filters'](_[_0xd3bf('0x45')](_0x627c07[_0xd3bf('0x39')],_0x3314bb['filters']));if(_0x627c07[_0xd3bf('0x39')]['filter']){_0x351b57[_0xd3bf('0x44')]=_[_0xd3bf('0x47')](_0x351b57[_0xd3bf('0x44')],{'$or':_[_0xd3bf('0x33')](_0x351b57['attributes'],function(_0x5b5774){var _0x4d6734={};_0x4d6734[_0x5b5774]={'$like':'%'+_0x627c07[_0xd3bf('0x39')]['filter']+'%'};return _0x4d6734;})});}_0x351b57=_[_0xd3bf('0x47')]({},_0x351b57,_0x627c07[_0xd3bf('0x48')]);return _0x4286a3[_0xd3bf('0x8f')](_0x351b57);}})['then'](function(_0x3727b2){if(_0x3727b2){_0x204455=_0x3727b2[_0xd3bf('0x3f')];if(!_0x627c07[_0xd3bf('0x39')][_0xd3bf('0x40')](_0xd3bf('0x41'))){_0x351b57[_0xd3bf('0x21')]=qs[_0xd3bf('0x21')](_0x627c07[_0xd3bf('0x39')][_0xd3bf('0x21')]);_0x351b57[_0xd3bf('0x23')]=qs[_0xd3bf('0x23')](_0x627c07[_0xd3bf('0x39')][_0xd3bf('0x23')]);}return _0x4286a3['getAgents'](_0x351b57);}})['then'](function(_0x3512bb){if(_0x3512bb){return _0x3512bb?{'count':_0x204455,'rows':_0x3512bb}:null;}})[_0xd3bf('0x2a')](respondWithResult(_0x4916da,null))['catch'](handleError(_0x4916da,null));}; \ No newline at end of file +var _0x8be5=['limit','set','Content-Range','apply','save','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','sendStatus','error','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','keys','model','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','hasOwnProperty','WhatsappQueueId','UserWhatsappQueue','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','User','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','userWhatsappQueue:save','select','field','join','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','removeTeams','ids','isEmpty','userWhatsappQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','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','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','status','json','offset','undefined','count'];(function(_0x4e6e33,_0x587fcc){var _0x395905=function(_0xcc2911){while(--_0xcc2911){_0x4e6e33['push'](_0x4e6e33['shift']());}};_0x395905(++_0x587fcc);}(_0x8be5,0xf8));var _0x58be=function(_0x48b230,_0x239969){_0x48b230=_0x48b230-0x0;var _0x37a6cd=_0x8be5[_0x48b230];return _0x37a6cd;};'use strict';var emlformat=require(_0x58be('0x0'));var rimraf=require(_0x58be('0x1'));var zipdir=require(_0x58be('0x2'));var jsonpatch=require(_0x58be('0x3'));var rp=require(_0x58be('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x58be('0x5'));var util=require(_0x58be('0x6'));var path=require(_0x58be('0x7'));var sox=require('sox');var csv=require(_0x58be('0x8'));var ejs=require(_0x58be('0x9'));var fs=require('fs');var fs_extra=require(_0x58be('0xa'));var _=require(_0x58be('0xb'));var squel=require('squel');var crypto=require(_0x58be('0xc'));var jsforce=require(_0x58be('0xd'));var deskjs=require(_0x58be('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x58be('0xf'));var Redis=require(_0x58be('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x58be('0x11'));var as=require(_0x58be('0x12'));var hardwareService=require(_0x58be('0x13'));var logger=require(_0x58be('0x14'))('api');var utils=require(_0x58be('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x58be('0x16'));var db=require('../../mysqldb')['db'];config[_0x58be('0x17')]=_[_0x58be('0x18')](config[_0x58be('0x17')],{'host':_0x58be('0x19'),'port':0x18eb});var socket=require(_0x58be('0x1a'))(new Redis(config['redis']));require(_0x58be('0x1b'))[_0x58be('0x1c')](socket);function respondWithStatusCode(_0x2130cc,_0x3f7059){_0x3f7059=_0x3f7059||0xcc;return function(_0x3bcbf9){if(_0x3bcbf9){return _0x2130cc['sendStatus'](_0x3f7059);}return _0x2130cc[_0x58be('0x1d')](_0x3f7059)['end']();};}function respondWithResult(_0xab53ca,_0x4f37fd){_0x4f37fd=_0x4f37fd||0xc8;return function(_0x131a37){if(_0x131a37){return _0xab53ca[_0x58be('0x1d')](_0x4f37fd)[_0x58be('0x1e')](_0x131a37);}};}function respondWithFilteredResult(_0x5f2db8,_0x2f0422){return function(_0xc13cc9){if(_0xc13cc9){var _0x59c419=typeof _0x2f0422[_0x58be('0x1f')]==='undefined'&&typeof _0x2f0422['limit']===_0x58be('0x20');var _0x3ebd11=_0xc13cc9[_0x58be('0x21')];var _0x3edf0d=_0x59c419?0x0:_0x2f0422[_0x58be('0x1f')];var _0x4d86d3=_0x59c419?_0xc13cc9['count']:_0x2f0422['offset']+_0x2f0422[_0x58be('0x22')];var _0x45fda9;if(_0x4d86d3>=_0x3ebd11){_0x4d86d3=_0x3ebd11;_0x45fda9=0xc8;}else{_0x45fda9=0xce;}_0x5f2db8[_0x58be('0x1d')](_0x45fda9);return _0x5f2db8[_0x58be('0x23')](_0x58be('0x24'),_0x3edf0d+'-'+_0x4d86d3+'/'+_0x3ebd11)['json'](_0xc13cc9);}return null;};}function patchUpdates(_0x29ef9a){return function(_0x4c8a0c){try{jsonpatch[_0x58be('0x25')](_0x4c8a0c,_0x29ef9a,!![]);}catch(_0x291cd1){return BPromise['reject'](_0x291cd1);}return _0x4c8a0c[_0x58be('0x26')]();};}function saveUpdates(_0x2e9653,_0x2948c7){return function(_0x26c90b){if(_0x26c90b){return _0x26c90b[_0x58be('0x27')](_0x2e9653)[_0x58be('0x28')](function(_0x285deb){return _0x285deb;});}return null;};}function removeEntity(_0x5cd9b2,_0x3ab2fc){return function(_0x144def){if(_0x144def){return _0x144def[_0x58be('0x29')]()[_0x58be('0x28')](function(){var _0x2722e5=_0x144def[_0x58be('0x2a')]({'plain':!![]});var _0x3c7ba8=_0x58be('0x2b');return db[_0x58be('0x2c')][_0x58be('0x29')]({'where':{'type':_0x3c7ba8,'resourceId':_0x2722e5['id']}})[_0x58be('0x28')](function(){return _0x144def;});})['then'](function(){_0x5cd9b2['status'](0xcc)[_0x58be('0x2d')]();});}};}function handleEntityNotFound(_0x21313e,_0x4f3a8e){return function(_0x15f90a){if(!_0x15f90a){_0x21313e[_0x58be('0x2e')](0x194);}return _0x15f90a;};}function handleError(_0x5712ea,_0x5c74ad){_0x5c74ad=_0x5c74ad||0x1f4;return function(_0x112c0f){logger[_0x58be('0x2f')](_0x112c0f[_0x58be('0x30')]);if(_0x112c0f['name']){delete _0x112c0f[_0x58be('0x31')];}_0x5712ea['status'](_0x5c74ad)[_0x58be('0x32')](_0x112c0f);};}exports['index']=function(_0x41b703,_0x2cf75c){var _0x8abebd={},_0xaa52fa={},_0x4cea50={'count':0x0,'rows':[]};var _0x34a972=_[_0x58be('0x33')](db[_0x58be('0x34')][_0x58be('0x35')],function(_0x2462ae){return{'name':_0x2462ae[_0x58be('0x36')],'type':_0x2462ae[_0x58be('0x37')][_0x58be('0x38')]};});_0xaa52fa['model']=_[_0x58be('0x33')](_0x34a972,_0x58be('0x31'));_0xaa52fa['query']=_[_0x58be('0x39')](_0x41b703['query']);_0xaa52fa['filters']=_['intersection'](_0xaa52fa[_0x58be('0x3a')],_0xaa52fa[_0x58be('0x3b')]);_0x8abebd['attributes']=_[_0x58be('0x3c')](_0xaa52fa[_0x58be('0x3a')],qs[_0x58be('0x3d')](_0x41b703[_0x58be('0x3b')][_0x58be('0x3d')]));_0x8abebd[_0x58be('0x3e')]=_0x8abebd[_0x58be('0x3e')][_0x58be('0x3f')]?_0x8abebd[_0x58be('0x3e')]:_0xaa52fa['model'];if(!_0x41b703['query']['hasOwnProperty'](_0x58be('0x40'))){_0x8abebd[_0x58be('0x22')]=qs[_0x58be('0x22')](_0x41b703['query'][_0x58be('0x22')]);_0x8abebd[_0x58be('0x1f')]=qs[_0x58be('0x1f')](_0x41b703['query']['offset']);}_0x8abebd[_0x58be('0x41')]=qs[_0x58be('0x42')](_0x41b703[_0x58be('0x3b')][_0x58be('0x42')]);_0x8abebd['where']=qs[_0x58be('0x43')](_[_0x58be('0x44')](_0x41b703[_0x58be('0x3b')],_0xaa52fa[_0x58be('0x43')]),_0x34a972);if(_0x41b703[_0x58be('0x3b')][_0x58be('0x45')]){_0x8abebd[_0x58be('0x46')]=_[_0x58be('0x47')](_0x8abebd[_0x58be('0x46')],{'$or':_[_0x58be('0x33')](_0x34a972,function(_0x413b31){if(_0x413b31[_0x58be('0x37')]!==_0x58be('0x48')){var _0x2f40d2={};_0x2f40d2[_0x413b31[_0x58be('0x31')]]={'$like':'%'+_0x41b703[_0x58be('0x3b')][_0x58be('0x45')]+'%'};return _0x2f40d2;}})});}_0x8abebd=_[_0x58be('0x47')]({},_0x8abebd,_0x41b703[_0x58be('0x49')]);var _0xfc1c80={'where':_0x8abebd[_0x58be('0x46')]};return db[_0x58be('0x34')][_0x58be('0x21')](_0xfc1c80)['then'](function(_0x3bf591){_0x4cea50[_0x58be('0x21')]=_0x3bf591;if(_0x41b703[_0x58be('0x3b')]['includeAll']){_0x8abebd['include']=[{'all':!![]}];}return db['WhatsappQueue'][_0x58be('0x4a')](_0x8abebd);})['then'](function(_0x12a7d1){_0x4cea50[_0x58be('0x4b')]=_0x12a7d1;return _0x4cea50;})[_0x58be('0x28')](respondWithFilteredResult(_0x2cf75c,_0x8abebd))[_0x58be('0x4c')](handleError(_0x2cf75c,null));};exports[_0x58be('0x4d')]=function(_0xe199f5,_0x4e0121){var _0x4a909b={'raw':!![],'where':{'id':_0xe199f5['params']['id']}},_0x55f3dd={};_0x55f3dd[_0x58be('0x3a')]=_[_0x58be('0x39')](db[_0x58be('0x34')][_0x58be('0x35')]);_0x55f3dd[_0x58be('0x3b')]=_[_0x58be('0x39')](_0xe199f5[_0x58be('0x3b')]);_0x55f3dd[_0x58be('0x43')]=_[_0x58be('0x3c')](_0x55f3dd[_0x58be('0x3a')],_0x55f3dd[_0x58be('0x3b')]);_0x4a909b[_0x58be('0x3e')]=_[_0x58be('0x3c')](_0x55f3dd[_0x58be('0x3a')],qs['fields'](_0xe199f5[_0x58be('0x3b')]['fields']));_0x4a909b[_0x58be('0x3e')]=_0x4a909b[_0x58be('0x3e')][_0x58be('0x3f')]?_0x4a909b[_0x58be('0x3e')]:_0x55f3dd[_0x58be('0x3a')];if(_0xe199f5[_0x58be('0x3b')][_0x58be('0x4e')]){_0x4a909b['include']=[{'all':!![]}];}_0x4a909b=_[_0x58be('0x47')]({},_0x4a909b,_0xe199f5[_0x58be('0x49')]);return db[_0x58be('0x34')][_0x58be('0x4f')](_0x4a909b)[_0x58be('0x28')](handleEntityNotFound(_0x4e0121,null))[_0x58be('0x28')](respondWithResult(_0x4e0121,null))[_0x58be('0x4c')](handleError(_0x4e0121,null));};exports[_0x58be('0x50')]=function(_0x52794b,_0x573937){return db[_0x58be('0x34')][_0x58be('0x50')](_0x52794b[_0x58be('0x51')],{})['then'](function(_0x530380){var _0x5097b5=_0x52794b[_0x58be('0x52')][_0x58be('0x2a')]({'plain':!![]});if(!_0x5097b5)throw new Error(_0x58be('0x53'));if(_0x5097b5[_0x58be('0x54')]===_0x58be('0x52')){var _0x4cb081=_0x530380[_0x58be('0x2a')]({'plain':!![]});var _0x58b0fc=_0x58be('0x2b');return db[_0x58be('0x55')][_0x58be('0x4f')]({'where':{'name':_0x58b0fc,'userProfileId':_0x5097b5['userProfileId']},'raw':!![]})[_0x58be('0x28')](function(_0x2ea51b){if(_0x2ea51b&&_0x2ea51b[_0x58be('0x56')]===0x0){return db[_0x58be('0x2c')][_0x58be('0x50')]({'name':_0x4cb081[_0x58be('0x31')],'resourceId':_0x4cb081['id'],'type':_0x2ea51b[_0x58be('0x31')],'sectionId':_0x2ea51b['id']},{})[_0x58be('0x28')](function(){return _0x530380;});}else{return _0x530380;}})[_0x58be('0x4c')](function(_0x2b8a9f){logger[_0x58be('0x2f')](_0x58be('0x57'),_0x2b8a9f);throw _0x2b8a9f;});}return _0x530380;})[_0x58be('0x28')](respondWithResult(_0x573937,0xc9))[_0x58be('0x4c')](handleError(_0x573937,null));};exports[_0x58be('0x27')]=function(_0x4def72,_0x13d418){if(_0x4def72['body']['id']){delete _0x4def72[_0x58be('0x51')]['id'];}return db[_0x58be('0x34')][_0x58be('0x4f')]({'where':{'id':_0x4def72[_0x58be('0x58')]['id']}})['then'](handleEntityNotFound(_0x13d418,null))['then'](saveUpdates(_0x4def72['body'],null))[_0x58be('0x28')](respondWithResult(_0x13d418,null))['catch'](handleError(_0x13d418,null));};exports[_0x58be('0x29')]=function(_0x16fd3d,_0x227835){return db[_0x58be('0x34')][_0x58be('0x4f')]({'where':{'id':_0x16fd3d['params']['id']}})[_0x58be('0x28')](handleEntityNotFound(_0x227835,null))[_0x58be('0x28')](removeEntity(_0x227835,null))[_0x58be('0x4c')](handleError(_0x227835,null));};exports['describe']=function(_0x59f0b6,_0xc9ffa5){return db['WhatsappQueue'][_0x58be('0x59')]()[_0x58be('0x28')](respondWithResult(_0xc9ffa5,null))[_0x58be('0x4c')](handleError(_0xc9ffa5,null));};exports[_0x58be('0x5a')]=function(_0x1a8396,_0x156a5a,_0x4f3f7a){var _0x1027cb={'raw':!![],'where':{}},_0x48ffa1={},_0x3d1f14;return db['WhatsappQueue'][_0x58be('0x5b')]({'where':{'id':_0x1a8396[_0x58be('0x58')]['id']}})[_0x58be('0x28')](handleEntityNotFound(_0x156a5a,null))[_0x58be('0x28')](function(_0x39691c){if(_0x39691c){_0x3d1f14=_0x39691c['get']({'plain':!![]});_0x48ffa1['model']=_[_0x58be('0x39')](db['UserWhatsappQueue'][_0x58be('0x35')]);_0x48ffa1[_0x58be('0x3b')]=_[_0x58be('0x39')](_0x1a8396[_0x58be('0x3b')]);_0x48ffa1[_0x58be('0x43')]=_['intersection'](_0x48ffa1[_0x58be('0x3a')],_0x48ffa1[_0x58be('0x3b')]);_0x1027cb[_0x58be('0x3e')]=_[_0x58be('0x3c')](_0x48ffa1[_0x58be('0x3a')],qs[_0x58be('0x3d')](_0x1a8396[_0x58be('0x3b')][_0x58be('0x3d')]));_0x1027cb[_0x58be('0x3e')]=_0x1027cb[_0x58be('0x3e')]['length']?_0x1027cb[_0x58be('0x3e')]:_0x48ffa1[_0x58be('0x3a')];if(!_0x1a8396['query'][_0x58be('0x5c')](_0x58be('0x40'))){_0x1027cb[_0x58be('0x22')]=qs[_0x58be('0x22')](_0x1a8396[_0x58be('0x3b')][_0x58be('0x22')]);_0x1027cb[_0x58be('0x1f')]=qs[_0x58be('0x1f')](_0x1a8396['query']['offset']);}_0x1027cb[_0x58be('0x41')]=qs[_0x58be('0x42')](_0x1a8396[_0x58be('0x3b')][_0x58be('0x42')]);_0x1027cb[_0x58be('0x46')]=qs[_0x58be('0x43')](_[_0x58be('0x44')](_0x1a8396[_0x58be('0x3b')],_0x48ffa1[_0x58be('0x43')]));_0x1027cb['where'][_0x58be('0x5d')]=_0x39691c['id'];if(_0x1a8396[_0x58be('0x3b')][_0x58be('0x45')]){_0x1027cb[_0x58be('0x46')]=_[_0x58be('0x47')](_0x1027cb['where'],{'$or':_[_0x58be('0x33')](_0x1027cb[_0x58be('0x3e')],function(_0x37ae61){var _0x135368={};_0x135368[_0x37ae61]={'$like':'%'+_0x1a8396[_0x58be('0x3b')][_0x58be('0x45')]+'%'};return _0x135368;})});}_0x1027cb=_[_0x58be('0x47')]({},_0x1027cb,_0x1a8396[_0x58be('0x49')]);return db[_0x58be('0x5e')][_0x58be('0x4a')](_0x1027cb);}})[_0x58be('0x28')](function(_0x510100){if(_0x510100){return db['User'][_0x58be('0x5f')]({'where':{'id':_[_0x58be('0x33')](_0x510100,_0x58be('0x60')),'role':_0x58be('0x61')},'attributes':['id',_0x58be('0x31'),_0x58be('0x62'),_0x58be('0x63'),_0x58be('0x64')]});}})[_0x58be('0x28')](function(_0x5e57b1){if(_0x5e57b1){return{'count':_0x5e57b1[_0x58be('0x21')],'rows':_[_0x58be('0x33')](_0x5e57b1[_0x58be('0x4b')],function(_0x198d03){return{'membername':_0x198d03['name'],'UserId':_0x198d03['id'],'queue_name':_0x3d1f14[_0x58be('0x31')],'WhatsappQueueId':_0x3d1f14['id'],'interface':util[_0x58be('0x65')](_0x58be('0x66'),_0x58be('0x67'),_0x198d03[_0x58be('0x31')]),'penalty':0x0,'paused':_0x198d03['whatsappPause'],'createdAt':_0x198d03[_0x58be('0x64')],'updatedAt':_0x198d03[_0x58be('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x156a5a,_0x1027cb))['catch'](handleError(_0x156a5a,null));};exports[_0x58be('0x68')]=function(_0x11535e,_0x156be2,_0x389bff){var _0xbae820={};var _0x14379c={};var _0x19451a;var _0x176377;return db[_0x58be('0x34')][_0x58be('0x5b')]({'where':{'id':_0x11535e[_0x58be('0x58')]['id']}})[_0x58be('0x28')](handleEntityNotFound(_0x156be2,null))[_0x58be('0x28')](function(_0x2d94cd){if(_0x2d94cd){_0x19451a=_0x2d94cd;_0x14379c[_0x58be('0x3a')]=_[_0x58be('0x39')](db[_0x58be('0x69')][_0x58be('0x35')]);_0x14379c[_0x58be('0x3b')]=_[_0x58be('0x39')](_0x11535e[_0x58be('0x3b')]);_0x14379c['filters']=_[_0x58be('0x3c')](_0x14379c[_0x58be('0x3a')],_0x14379c[_0x58be('0x3b')]);_0xbae820[_0x58be('0x3e')]=_[_0x58be('0x3c')](_0x14379c['model'],qs[_0x58be('0x3d')](_0x11535e[_0x58be('0x3b')][_0x58be('0x3d')]));_0xbae820[_0x58be('0x3e')]=_0xbae820[_0x58be('0x3e')][_0x58be('0x3f')]?_0xbae820[_0x58be('0x3e')]:_0x14379c[_0x58be('0x3a')];_0xbae820[_0x58be('0x41')]=qs[_0x58be('0x42')](_0x11535e[_0x58be('0x3b')][_0x58be('0x42')]);_0xbae820['where']=qs['filters'](_[_0x58be('0x44')](_0x11535e[_0x58be('0x3b')],_0x14379c[_0x58be('0x43')]));if(_0x11535e[_0x58be('0x3b')][_0x58be('0x45')]){_0xbae820[_0x58be('0x46')]=_[_0x58be('0x47')](_0xbae820[_0x58be('0x46')],{'$or':_[_0x58be('0x33')](_0xbae820[_0x58be('0x3e')],function(_0x37e6f3){var _0x4d4c66={};_0x4d4c66[_0x37e6f3]={'$like':'%'+_0x11535e[_0x58be('0x3b')][_0x58be('0x45')]+'%'};return _0x4d4c66;})});}_0xbae820=_[_0x58be('0x47')]({},_0xbae820,_0x11535e['options']);return _0x19451a[_0x58be('0x68')](_0xbae820);}})[_0x58be('0x28')](function(_0x509a10){if(_0x509a10){_0x176377=_0x509a10[_0x58be('0x3f')];if(!_0x11535e[_0x58be('0x3b')]['hasOwnProperty'](_0x58be('0x40'))){_0xbae820[_0x58be('0x22')]=qs[_0x58be('0x22')](_0x11535e[_0x58be('0x3b')][_0x58be('0x22')]);_0xbae820[_0x58be('0x1f')]=qs[_0x58be('0x1f')](_0x11535e[_0x58be('0x3b')]['offset']);}return _0x19451a[_0x58be('0x68')](_0xbae820);}})[_0x58be('0x28')](function(_0x321c0d){if(_0x321c0d){return _0x321c0d?{'count':_0x176377,'rows':_0x321c0d}:null;}})['then'](respondWithResult(_0x156be2,null))[_0x58be('0x4c')](handleError(_0x156be2,null));};exports['addTeams']=function(_0x3ec5c6,_0x2bac40,_0x4a9876){var _0x6c7c5b=_0x3ec5c6[_0x58be('0x51')]['ids'];return db[_0x58be('0x69')][_0x58be('0x4a')]({'where':{'id':_0x6c7c5b},'attributes':['id'],'include':[{'model':db[_0x58be('0x6a')],'as':_0x58be('0x6b'),'attributes':['id','name',_0x58be('0x6c'),_0x58be('0x6d'),'interface'],'raw':!![]}]})[_0x58be('0x28')](function(_0x1cef06){if(_0x1cef06){var _0x4bd3eb=_[_0x58be('0x6e')](_0x1cef06,function(_0x8ec0c9){var _0x288045=_0x8ec0c9[_0x58be('0x2a')]({'plain':!![]});return _0x288045[_0x58be('0x6b')];});return db[_0x58be('0x34')]['find']({'where':{'id':_0x3ec5c6[_0x58be('0x58')]['id']}})[_0x58be('0x28')](function(_0x5bf0c4){return db[_0x58be('0x6f')][_0x58be('0x70')](function(_0xa75a9f){return _0x5bf0c4[_0x58be('0x71')](_0x6c7c5b,{'transaction':_0xa75a9f})[_0x58be('0x28')](function(){return BPromise['each'](_0x4bd3eb,function(_0x235cf9){return db['UserWhatsappQueue'][_0x58be('0x72')]({'where':{'UserId':_0x235cf9['id'],'WhatsappQueueId':_0x3ec5c6['params']['id']},'transaction':_0xa75a9f});});})[_0x58be('0x28')](function(){_0x4bd3eb[_0x58be('0x73')](function(_0x24cc2f){socket[_0x58be('0x74')](_0x58be('0x75'),{'UserId':_0x24cc2f['id'],'WhatsappQueueId':_0x5bf0c4['id']});});});});});}})[_0x58be('0x28')](respondWithStatusCode(_0x2bac40,null))['catch'](handleError(_0x2bac40,null));};exports['removeTeams']=function(_0x4ff35c,_0x2f3021,_0x1e40dd){return db[_0x58be('0x69')][_0x58be('0x4a')]({'where':{'id':_0x4ff35c['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x58be('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2f3021,null))['then'](function(_0x490eb3){var _0x568408=_[_0x58be('0x33')](_0x490eb3,'id');var _0x375041=[];var _0x90c743=[];var _0x35dce5=squel[_0x58be('0x76')]();_0x35dce5[_0x58be('0x77')]('tq.TeamId')['from']('team_has_whatsapp_queues','tq')[_0x58be('0x78')](_0x58be('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x58be('0x46')](_0x58be('0x7a'),_0x4ff35c[_0x58be('0x58')]['id']);for(var _0x29cf33=0x0;_0x29cf33<_0x490eb3[_0x58be('0x3f')];_0x29cf33+=0x1){let _0xe860ab=_0x490eb3[_0x29cf33];for(var _0x5a5b0a=0x0;_0x5a5b0a<_0xe860ab[_0x58be('0x6b')]['length'];_0x5a5b0a+=0x1){let _0x4bec68=_0xe860ab['Agents'][_0x5a5b0a];var _0x5ae887=_0x35dce5[_0x58be('0x7b')]();_0x5ae887[_0x58be('0x46')](_0x58be('0x7c'),_0x4bec68['id']);_0x90c743[_0x58be('0x7d')](db[_0x58be('0x6f')][_0x58be('0x3b')](_0x5ae887['toString'](),{'type':db[_0x58be('0x6f')][_0x58be('0x7e')][_0x58be('0x7f')]})[_0x58be('0x28')](function(_0xea5f40){if(_0xea5f40[_0x58be('0x3f')]===0x1){return _0x4bec68['id'];}else{var _0x4dde1b=_['every'](_[_0x58be('0x33')](_0xea5f40,_0x58be('0x80')),function(_0xb6b8a){return _[_0x58be('0x81')](_0x568408,_0xb6b8a);});if(_0x4dde1b){return _0x4bec68['id'];}}}));}}return BPromise[_0x58be('0x82')](_0x90c743)[_0x58be('0x28')](function(_0x40bf66){_0x375041=_(_0x375041)[_0x58be('0x83')](_0x40bf66)['compact']()['value']();return db['WhatsappQueue'][_0x58be('0x4f')]({'where':{'id':_0x4ff35c['params']['id']}})[_0x58be('0x28')](function(_0x2bb7bf){return db[_0x58be('0x6f')]['transaction'](function(_0xf02bd8){return _0x2bb7bf[_0x58be('0x84')](_0x4ff35c[_0x58be('0x3b')][_0x58be('0x85')],{'transaction':_0xf02bd8})[_0x58be('0x28')](function(){if(!_[_0x58be('0x86')](_0x375041)){return _0x2bb7bf['removeAgents'](_0x375041,{'transaction':_0xf02bd8});}})[_0x58be('0x28')](function(){_0x375041[_0x58be('0x73')](function(_0x196e3e){socket['emit'](_0x58be('0x87'),{'UserId':_0x196e3e,'WhatsappQueueId':_0x2bb7bf['id']});});});});});});})[_0x58be('0x28')](respondWithStatusCode(_0x2f3021,null))[_0x58be('0x4c')](handleError(_0x2f3021,null));};exports[_0x58be('0x88')]=function(_0x24e803,_0x4c72ec,_0x9809b5){return db[_0x58be('0x34')][_0x58be('0x4f')]({'where':{'id':_0x24e803[_0x58be('0x58')]['id']}})[_0x58be('0x28')](handleEntityNotFound(_0x4c72ec,null))[_0x58be('0x28')](function(_0x2b3669){if(_0x2b3669){return _0x2b3669[_0x58be('0x88')](_0x24e803[_0x58be('0x51')][_0x58be('0x85')],_['omit'](_0x24e803[_0x58be('0x51')],['ids','id'])||{})[_0x58be('0x89')](function(_0xe5d5b0){for(var _0x37f24f=0x0;_0x37f24f<_0x24e803[_0x58be('0x51')]['ids'][_0x58be('0x3f')];_0x37f24f+=0x1){socket['emit'](_0x58be('0x75'),{'UserId':Number(_0x24e803[_0x58be('0x51')][_0x58be('0x85')][_0x37f24f]),'WhatsappQueueId':Number(_0x24e803[_0x58be('0x58')]['id'])});}return _0xe5d5b0;});}})[_0x58be('0x28')](respondWithResult(_0x4c72ec,null))[_0x58be('0x4c')](handleError(_0x4c72ec,null));};exports[_0x58be('0x8a')]=function(_0x55f540,_0x14bbb5,_0x3e59ca){return db['WhatsappQueue'][_0x58be('0x4f')]({'where':{'id':_0x55f540['params']['id']}})['then'](handleEntityNotFound(_0x14bbb5,null))[_0x58be('0x28')](function(_0x592924){if(_0x592924){return _0x592924[_0x58be('0x8a')](_0x55f540[_0x58be('0x3b')][_0x58be('0x85')])[_0x58be('0x28')](function(){if(_[_0x58be('0x8b')](_0x55f540['query'][_0x58be('0x85')])){for(var _0x2e355d=0x0;_0x2e355d<_0x55f540[_0x58be('0x3b')][_0x58be('0x85')]['length'];_0x2e355d+=0x1){socket[_0x58be('0x74')](_0x58be('0x87'),{'UserId':Number(_0x55f540['query'][_0x58be('0x85')][_0x2e355d]),'WhatsappQueueId':Number(_0x55f540[_0x58be('0x58')]['id'])});}}else{socket[_0x58be('0x74')](_0x58be('0x87'),{'UserId':Number(_0x55f540['query'][_0x58be('0x85')]),'WhatsappQueueId':Number(_0x55f540[_0x58be('0x58')]['id'])});}});}})[_0x58be('0x28')](respondWithStatusCode(_0x14bbb5,null))[_0x58be('0x4c')](handleError(_0x14bbb5,null));};exports[_0x58be('0x8c')]=function(_0x4e0154,_0x3af4a7,_0x575cb5){var _0x549600={};var _0x41e860={};var _0x71cc2c;var _0x26cce8;return db[_0x58be('0x34')][_0x58be('0x5b')]({'where':{'id':_0x4e0154[_0x58be('0x58')]['id']}})['then'](handleEntityNotFound(_0x3af4a7,null))['then'](function(_0x4065a5){if(_0x4065a5){_0x71cc2c=_0x4065a5;_0x41e860[_0x58be('0x3a')]=_[_0x58be('0x39')](db['User'][_0x58be('0x35')]);_0x41e860[_0x58be('0x3b')]=_[_0x58be('0x39')](_0x4e0154[_0x58be('0x3b')]);_0x41e860[_0x58be('0x43')]=_[_0x58be('0x3c')](_0x41e860[_0x58be('0x3a')],_0x41e860[_0x58be('0x3b')]);_0x549600[_0x58be('0x3e')]=_['intersection'](_0x41e860[_0x58be('0x3a')],qs['fields'](_0x4e0154[_0x58be('0x3b')][_0x58be('0x3d')]));_0x549600[_0x58be('0x3e')]=_0x549600[_0x58be('0x3e')][_0x58be('0x3f')]?_0x549600['attributes']:_0x41e860[_0x58be('0x3a')];_0x549600[_0x58be('0x41')]=qs[_0x58be('0x42')](_0x4e0154[_0x58be('0x3b')]['sort']);_0x549600[_0x58be('0x46')]=qs[_0x58be('0x43')](_[_0x58be('0x44')](_0x4e0154[_0x58be('0x3b')],_0x41e860[_0x58be('0x43')]));if(_0x4e0154['query']['filter']){_0x549600[_0x58be('0x46')]=_['merge'](_0x549600[_0x58be('0x46')],{'$or':_[_0x58be('0x33')](_0x549600['attributes'],function(_0x1f682a){var _0x165ee4={};_0x165ee4[_0x1f682a]={'$like':'%'+_0x4e0154[_0x58be('0x3b')]['filter']+'%'};return _0x165ee4;})});}_0x549600=_['merge']({},_0x549600,_0x4e0154['options']);return _0x71cc2c['getAgents'](_0x549600);}})[_0x58be('0x28')](function(_0x3aad9f){if(_0x3aad9f){_0x26cce8=_0x3aad9f[_0x58be('0x3f')];if(!_0x4e0154[_0x58be('0x3b')][_0x58be('0x5c')](_0x58be('0x40'))){_0x549600[_0x58be('0x22')]=qs[_0x58be('0x22')](_0x4e0154[_0x58be('0x3b')]['limit']);_0x549600[_0x58be('0x1f')]=qs[_0x58be('0x1f')](_0x4e0154['query']['offset']);}return _0x71cc2c[_0x58be('0x8c')](_0x549600);}})[_0x58be('0x28')](function(_0x12bf29){if(_0x12bf29){return _0x12bf29?{'count':_0x26cce8,'rows':_0x12bf29}:null;}})['then'](respondWithResult(_0x3af4a7,null))[_0x58be('0x4c')](handleError(_0x3af4a7,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index ae7c94d..718817f 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 _0xb0b5=['WhatsappQueue','setMaxListeners','update','remove','emit','hasOwnProperty','exports','../../mysqldb'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xb0b5,0x177));var _0x5b0b=function(_0x346f5a,_0x33de62){_0x346f5a=_0x346f5a-0x0;var _0x2c1254=_0xb0b5[_0x346f5a];return _0x2c1254;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x5b0b('0x0'))['db'][_0x5b0b('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5b0b('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5b0b('0x3'),'afterDestroy':_0x5b0b('0x4')};function emitEvent(_0x57d597){return function(_0xcf6e28,_0x54cd80,_0x1c2cb7){WhatsappQueueEvents[_0x5b0b('0x5')](_0x57d597+':'+_0xcf6e28['id'],_0xcf6e28);WhatsappQueueEvents['emit'](_0x57d597,_0xcf6e28);_0x1c2cb7(null);};}for(var e in events){if(events[_0x5b0b('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5b0b('0x7')]=WhatsappQueueEvents; \ No newline at end of file +var _0x8388=['setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x7902d0,_0x378152){var _0x2ab4ac=function(_0x1837ee){while(--_0x1837ee){_0x7902d0['push'](_0x7902d0['shift']());}};_0x2ab4ac(++_0x378152);}(_0x8388,0x1cd));var _0x8838=function(_0x406115,_0x19f7a1){_0x406115=_0x406115-0x0;var _0xbbabdb=_0x8388[_0x406115];return _0xbbabdb;};'use strict';var EventEmitter=require(_0x8838('0x0'));var WhatsappQueue=require('../../mysqldb')['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x8838('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8838('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2d473a){return function(_0x4f269b,_0x2e2eeb,_0x4a525e){WhatsappQueueEvents[_0x8838('0x3')](_0x2d473a+':'+_0x4f269b['id'],_0x4f269b);WhatsappQueueEvents[_0x8838('0x3')](_0x2d473a,_0x4f269b);_0x4a525e(null);};}for(var e in events){if(events[_0x8838('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x8838('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 43c03b4..910200f 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 _0xa347=['bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','lodash','util','api','moment'];(function(_0x1582b6,_0x223ad6){var _0x3ddb37=function(_0x4ac245){while(--_0x4ac245){_0x1582b6['push'](_0x1582b6['shift']());}};_0x3ddb37(++_0x223ad6);}(_0xa347,0xc2));var _0x7a34=function(_0x59e7e0,_0x3ec148){_0x59e7e0=_0x59e7e0-0x0;var _0x26b058=_0xa347[_0x59e7e0];return _0x26b058;};'use strict';var _=require(_0x7a34('0x0'));var util=require(_0x7a34('0x1'));var logger=require('../../config/logger')(_0x7a34('0x2'));var moment=require(_0x7a34('0x3'));var BPromise=require(_0x7a34('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7a34('0x5'));var rimraf=require(_0x7a34('0x6'));var config=require(_0x7a34('0x7'));var attributes=require(_0x7a34('0x8'));module[_0x7a34('0x9')]=function(_0x9e2849,_0x381cf4){return _0x9e2849['define'](_0x7a34('0xa'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88fc=['moment','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','api'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x88fc,0x171));var _0xc88f=function(_0xbe8d60,_0x50e378){_0xbe8d60=_0xbe8d60-0x0;var _0x2e68f7=_0x88fc[_0xbe8d60];return _0x2e68f7;};'use strict';var _=require(_0xc88f('0x0'));var util=require(_0xc88f('0x1'));var logger=require('../../config/logger')(_0xc88f('0x2'));var moment=require(_0xc88f('0x3'));var BPromise=require('bluebird');var rp=require(_0xc88f('0x4'));var fs=require('fs');var path=require(_0xc88f('0x5'));var rimraf=require(_0xc88f('0x6'));var config=require(_0xc88f('0x7'));var attributes=require(_0xc88f('0x8'));module['exports']=function(_0x277cf0,_0x1663c1){return _0x277cf0[_0xc88f('0x9')](_0xc88f('0xa'),attributes,{'tableName':_0xc88f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.rpc.js b/server/api/whatsappQueue/whatsappQueue.rpc.js index 0e08249..a500fd5 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 _0xa864=['catch','GetWhatsappQueue','findAll','options','raw','where','attributes','limit','include','model','map','info','stringify','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x1a2929,_0x7fa0fd){var _0x1be4d0=function(_0x1153c4){while(--_0x1153c4){_0x1a2929['push'](_0x1a2929['shift']());}};_0x1be4d0(++_0x7fa0fd);}(_0xa864,0x118));var _0x4a86=function(_0x1db831,_0x42b7b5){_0x1db831=_0x1db831-0x0;var _0x39ba56=_0xa864[_0x1db831];return _0x39ba56;};'use strict';var _=require(_0x4a86('0x0'));var util=require('util');var moment=require(_0x4a86('0x1'));var BPromise=require(_0x4a86('0x2'));var rs=require(_0x4a86('0x3'));var fs=require('fs');var Redis=require(_0x4a86('0x4'));var db=require(_0x4a86('0x5'))['db'];var utils=require(_0x4a86('0x6'));var logger=require(_0x4a86('0x7'))(_0x4a86('0x8'));var config=require(_0x4a86('0x9'));var jayson=require(_0x4a86('0xa'));var client=jayson[_0x4a86('0xb')][_0x4a86('0xc')]({'port':0x232a});config[_0x4a86('0xd')]=_[_0x4a86('0xe')](config[_0x4a86('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x4a86('0xf'))(new Redis(config[_0x4a86('0xd')]));require(_0x4a86('0x10'))[_0x4a86('0x11')](socket);function respondWithRpcPromise(_0x4f56dc,_0x130e57,_0x133a82){return new BPromise(function(_0x11f097,_0x27cf4f){return client[_0x4a86('0x12')](_0x4f56dc,_0x133a82)[_0x4a86('0x13')](function(_0x4805ce){logger['info'](_0x4a86('0x14'),_0x130e57,_0x4a86('0x15'));logger[_0x4a86('0x16')](_0x4a86('0x17'),_0x130e57,_0x4a86('0x15'),JSON['stringify'](_0x4805ce));if(_0x4805ce[_0x4a86('0x18')]){if(_0x4805ce['error'][_0x4a86('0x19')]===0x1f4){logger[_0x4a86('0x18')]('WhatsappQueue,\x20%s,\x20%s',_0x130e57,_0x4805ce[_0x4a86('0x18')][_0x4a86('0x1a')]);return _0x27cf4f(_0x4805ce[_0x4a86('0x18')][_0x4a86('0x1a')]);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x130e57,_0x4805ce['error'][_0x4a86('0x1a')]);return _0x11f097(_0x4805ce[_0x4a86('0x18')][_0x4a86('0x1a')]);}else{logger['info'](_0x4a86('0x14'),_0x130e57,'request\x20sent');_0x11f097(_0x4805ce[_0x4a86('0x1b')][_0x4a86('0x1a')]);}})[_0x4a86('0x1c')](function(_0x3bb725){logger[_0x4a86('0x18')](_0x4a86('0x14'),_0x130e57,_0x3bb725);_0x27cf4f(_0x3bb725);});});}exports[_0x4a86('0x1d')]=function(_0x28594e){var _0x11ff50=this;return new Promise(function(_0x55ed40,_0x57cadd){return db['WhatsappQueue'][_0x4a86('0x1e')]({'raw':_0x28594e['options']?_0x28594e[_0x4a86('0x1f')][_0x4a86('0x20')]===undefined?!![]:![]:!![],'where':_0x28594e[_0x4a86('0x1f')]?_0x28594e[_0x4a86('0x1f')][_0x4a86('0x21')]||null:null,'attributes':_0x28594e[_0x4a86('0x1f')]?_0x28594e[_0x4a86('0x1f')][_0x4a86('0x22')]||null:null,'limit':_0x28594e[_0x4a86('0x1f')]?_0x28594e[_0x4a86('0x1f')][_0x4a86('0x23')]||null:null,'include':_0x28594e[_0x4a86('0x1f')]?_0x28594e[_0x4a86('0x1f')][_0x4a86('0x24')]?_['map'](_0x28594e[_0x4a86('0x1f')][_0x4a86('0x24')],function(_0x3ad134){return{'model':db[_0x3ad134[_0x4a86('0x25')]],'as':_0x3ad134['as'],'attributes':_0x3ad134[_0x4a86('0x22')],'include':_0x3ad134[_0x4a86('0x24')]?_['map'](_0x3ad134[_0x4a86('0x24')],function(_0x2a45aa){return{'model':db[_0x2a45aa['model']],'as':_0x2a45aa['as'],'attributes':_0x2a45aa[_0x4a86('0x22')],'include':_0x2a45aa[_0x4a86('0x24')]?_[_0x4a86('0x26')](_0x2a45aa[_0x4a86('0x24')],function(_0x14dfe9){return{'model':db[_0x14dfe9[_0x4a86('0x25')]],'as':_0x14dfe9['as'],'attributes':_0x14dfe9['attributes']};}):[]};}):[]};}):[]:[]})[_0x4a86('0x13')](function(_0x5877e7){logger[_0x4a86('0x27')](_0x4a86('0x1d'),_0x28594e);logger['debug'](_0x4a86('0x1d'),_0x28594e,JSON[_0x4a86('0x28')](_0x5877e7));_0x55ed40(_0x5877e7);})[_0x4a86('0x1c')](function(_0x199efe){logger[_0x4a86('0x18')](_0x4a86('0x1d'),_0x199efe[_0x4a86('0x1a')],_0x28594e);_0x57cadd(_0x11ff50[_0x4a86('0x18')](0x1f4,_0x199efe['message']));});});};exports[_0x4a86('0x29')]=function(_0x13ac85){var _0x460d2c=this;return new Promise(function(_0x2ba919,_0x41fc7a){return db[_0x4a86('0x2a')][_0x4a86('0x2b')]({'raw':_0x13ac85[_0x4a86('0x1f')]?_0x13ac85['options'][_0x4a86('0x20')]===undefined?!![]:![]:!![],'where':_0x13ac85[_0x4a86('0x1f')]?_0x13ac85[_0x4a86('0x1f')][_0x4a86('0x21')]||null:null,'attributes':_0x13ac85['options']?_0x13ac85[_0x4a86('0x1f')][_0x4a86('0x22')]||null:null,'include':_0x13ac85['options']?_0x13ac85[_0x4a86('0x1f')][_0x4a86('0x24')]?_[_0x4a86('0x26')](_0x13ac85[_0x4a86('0x1f')][_0x4a86('0x24')],function(_0x2498e0){return{'model':db[_0x2498e0[_0x4a86('0x25')]],'as':_0x2498e0['as'],'attributes':_0x2498e0[_0x4a86('0x22')],'include':_0x2498e0[_0x4a86('0x24')]?_[_0x4a86('0x26')](_0x2498e0[_0x4a86('0x24')],function(_0x5550ec){return{'model':db[_0x5550ec[_0x4a86('0x25')]],'as':_0x5550ec['as'],'attributes':_0x5550ec['attributes'],'include':_0x5550ec[_0x4a86('0x24')]?_[_0x4a86('0x26')](_0x5550ec[_0x4a86('0x24')],function(_0x3f7f33){return{'model':db[_0x3f7f33[_0x4a86('0x25')]],'as':_0x3f7f33['as'],'attributes':_0x3f7f33[_0x4a86('0x22')]};}):[]};}):[]};}):[]:[]})[_0x4a86('0x13')](function(_0x5af858){logger[_0x4a86('0x27')](_0x4a86('0x29'),_0x13ac85);logger[_0x4a86('0x16')]('ShowWhatsappQueue',_0x13ac85,JSON[_0x4a86('0x28')](_0x5af858));_0x2ba919(_0x5af858);})[_0x4a86('0x1c')](function(_0x516e35){logger['error'](_0x4a86('0x29'),_0x516e35[_0x4a86('0x1a')],_0x13ac85);_0x41fc7a(_0x460d2c[_0x4a86('0x18')](0x1f4,_0x516e35[_0x4a86('0x1a')]));});});}; \ No newline at end of file +var _0xa8d1=['register','request','then','info','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','result','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model','catch','ShowWhatsappQueue','find','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket'];(function(_0x442a83,_0x1c4aeb){var _0x2c1038=function(_0x4e5e6f){while(--_0x4e5e6f){_0x442a83['push'](_0x442a83['shift']());}};_0x2c1038(++_0x1c4aeb);}(_0xa8d1,0x111));var _0x1a8d=function(_0x2edf17,_0x5c731d){_0x2edf17=_0x2edf17-0x0;var _0x3c028a=_0xa8d1[_0x2edf17];return _0x3c028a;};'use strict';var _=require(_0x1a8d('0x0'));var util=require(_0x1a8d('0x1'));var moment=require(_0x1a8d('0x2'));var BPromise=require('bluebird');var rs=require(_0x1a8d('0x3'));var fs=require('fs');var Redis=require(_0x1a8d('0x4'));var db=require(_0x1a8d('0x5'))['db'];var utils=require(_0x1a8d('0x6'));var logger=require('../../config/logger')(_0x1a8d('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1a8d('0x8')][_0x1a8d('0x9')]({'port':0x232a});config[_0x1a8d('0xa')]=_['defaults'](config[_0x1a8d('0xa')],{'host':_0x1a8d('0xb'),'port':0x18eb});var socket=require(_0x1a8d('0xc'))(new Redis(config[_0x1a8d('0xa')]));require(_0x1a8d('0xd'))[_0x1a8d('0xe')](socket);function respondWithRpcPromise(_0xd8dba2,_0x2f0dff,_0x2d73be){return new BPromise(function(_0x1e4903,_0x51ef61){return client[_0x1a8d('0xf')](_0xd8dba2,_0x2d73be)[_0x1a8d('0x10')](function(_0x182c12){logger[_0x1a8d('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x2f0dff,'request\x20sent');logger['debug'](_0x1a8d('0x12'),_0x2f0dff,_0x1a8d('0x13'),JSON[_0x1a8d('0x14')](_0x182c12));if(_0x182c12['error']){if(_0x182c12['error'][_0x1a8d('0x15')]===0x1f4){logger[_0x1a8d('0x16')](_0x1a8d('0x17'),_0x2f0dff,_0x182c12[_0x1a8d('0x16')][_0x1a8d('0x18')]);return _0x51ef61(_0x182c12[_0x1a8d('0x16')][_0x1a8d('0x18')]);}logger['error'](_0x1a8d('0x17'),_0x2f0dff,_0x182c12[_0x1a8d('0x16')][_0x1a8d('0x18')]);return _0x1e4903(_0x182c12['error'][_0x1a8d('0x18')]);}else{logger[_0x1a8d('0x11')](_0x1a8d('0x17'),_0x2f0dff,'request\x20sent');_0x1e4903(_0x182c12[_0x1a8d('0x19')][_0x1a8d('0x18')]);}})['catch'](function(_0x552a8e){logger['error'](_0x1a8d('0x17'),_0x2f0dff,_0x552a8e);_0x51ef61(_0x552a8e);});});}exports[_0x1a8d('0x1a')]=function(_0x1c8a63){var _0x2035ca=this;return new Promise(function(_0x3fcaec,_0x49e97b){return db[_0x1a8d('0x1b')][_0x1a8d('0x1c')]({'raw':_0x1c8a63['options']?_0x1c8a63[_0x1a8d('0x1d')][_0x1a8d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c8a63[_0x1a8d('0x1d')]?_0x1c8a63[_0x1a8d('0x1d')][_0x1a8d('0x1f')]||null:null,'attributes':_0x1c8a63[_0x1a8d('0x1d')]?_0x1c8a63[_0x1a8d('0x1d')][_0x1a8d('0x20')]||null:null,'limit':_0x1c8a63['options']?_0x1c8a63['options'][_0x1a8d('0x21')]||null:null,'include':_0x1c8a63[_0x1a8d('0x1d')]?_0x1c8a63['options'][_0x1a8d('0x22')]?_[_0x1a8d('0x23')](_0x1c8a63['options'][_0x1a8d('0x22')],function(_0x1bb53c){return{'model':db[_0x1bb53c['model']],'as':_0x1bb53c['as'],'attributes':_0x1bb53c[_0x1a8d('0x20')],'include':_0x1bb53c[_0x1a8d('0x22')]?_[_0x1a8d('0x23')](_0x1bb53c[_0x1a8d('0x22')],function(_0x16e1df){return{'model':db[_0x16e1df[_0x1a8d('0x24')]],'as':_0x16e1df['as'],'attributes':_0x16e1df['attributes'],'include':_0x16e1df[_0x1a8d('0x22')]?_['map'](_0x16e1df[_0x1a8d('0x22')],function(_0x142994){return{'model':db[_0x142994[_0x1a8d('0x24')]],'as':_0x142994['as'],'attributes':_0x142994[_0x1a8d('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1a8d('0x10')](function(_0x17f6e7){logger['info'](_0x1a8d('0x1a'),_0x1c8a63);logger['debug'](_0x1a8d('0x1a'),_0x1c8a63,JSON[_0x1a8d('0x14')](_0x17f6e7));_0x3fcaec(_0x17f6e7);})[_0x1a8d('0x25')](function(_0x293ac8){logger['error']('GetWhatsappQueue',_0x293ac8[_0x1a8d('0x18')],_0x1c8a63);_0x49e97b(_0x2035ca[_0x1a8d('0x16')](0x1f4,_0x293ac8[_0x1a8d('0x18')]));});});};exports[_0x1a8d('0x26')]=function(_0x1b16d2){var _0x2d319d=this;return new Promise(function(_0x2f07f5,_0x1eb92a){return db[_0x1a8d('0x1b')][_0x1a8d('0x27')]({'raw':_0x1b16d2[_0x1a8d('0x1d')]?_0x1b16d2['options'][_0x1a8d('0x1e')]===undefined?!![]:![]:!![],'where':_0x1b16d2[_0x1a8d('0x1d')]?_0x1b16d2['options'][_0x1a8d('0x1f')]||null:null,'attributes':_0x1b16d2[_0x1a8d('0x1d')]?_0x1b16d2[_0x1a8d('0x1d')][_0x1a8d('0x20')]||null:null,'include':_0x1b16d2['options']?_0x1b16d2[_0x1a8d('0x1d')][_0x1a8d('0x22')]?_['map'](_0x1b16d2[_0x1a8d('0x1d')][_0x1a8d('0x22')],function(_0x54a1c3){return{'model':db[_0x54a1c3[_0x1a8d('0x24')]],'as':_0x54a1c3['as'],'attributes':_0x54a1c3[_0x1a8d('0x20')],'include':_0x54a1c3[_0x1a8d('0x22')]?_[_0x1a8d('0x23')](_0x54a1c3[_0x1a8d('0x22')],function(_0x4314eb){return{'model':db[_0x4314eb['model']],'as':_0x4314eb['as'],'attributes':_0x4314eb[_0x1a8d('0x20')],'include':_0x4314eb[_0x1a8d('0x22')]?_[_0x1a8d('0x23')](_0x4314eb[_0x1a8d('0x22')],function(_0xc2b038){return{'model':db[_0xc2b038['model']],'as':_0xc2b038['as'],'attributes':_0xc2b038[_0x1a8d('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41bcf2){logger[_0x1a8d('0x11')](_0x1a8d('0x26'),_0x1b16d2);logger[_0x1a8d('0x28')](_0x1a8d('0x26'),_0x1b16d2,JSON[_0x1a8d('0x14')](_0x41bcf2));_0x2f07f5(_0x41bcf2);})[_0x1a8d('0x25')](function(_0x2edc98){logger[_0x1a8d('0x16')](_0x1a8d('0x26'),_0x2edc98[_0x1a8d('0x18')],_0x1b16d2);_0x1eb92a(_0x2d319d[_0x1a8d('0x16')](0x1f4,_0x2edc98['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index aeb4849..1c2359c 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 _0xb344=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x150c8d,_0x4efab9){var _0x9e7d3e=function(_0x44f529){while(--_0x44f529){_0x150c8d['push'](_0x150c8d['shift']());}};_0x9e7d3e(++_0x4efab9);}(_0xb344,0x196));var _0x4b34=function(_0x2b395a,_0x35db69){_0x2b395a=_0x2b395a-0x0;var _0x1beba0=_0xb344[_0x2b395a];return _0x1beba0;};'use strict';var WhatsappQueueEvents=require(_0x4b34('0x0'));var events=[_0x4b34('0x1'),'remove',_0x4b34('0x2')];function createListener(_0x717393,_0xdc18a9){return function(_0x491bbb){_0xdc18a9[_0x4b34('0x3')](_0x717393,_0x491bbb);};}function removeListener(_0x28a535,_0x2ab371){return function(){WhatsappQueueEvents[_0x4b34('0x4')](_0x28a535,_0x2ab371);};}exports[_0x4b34('0x5')]=function(_0x5507d7){for(var _0x55aa09=0x0,_0x59919c=events[_0x4b34('0x6')];_0x55aa09<_0x59919c;_0x55aa09++){var _0x267d11=events[_0x55aa09];var _0xd1ebb4=createListener(_0x4b34('0x7')+_0x267d11,_0x5507d7);WhatsappQueueEvents['on'](_0x267d11,_0xd1ebb4);}}; \ No newline at end of file +var _0x4d14=['save','remove','update','removeListener','register','length','whatsappQueue:','./whatsappQueue.events'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x4d14,0xa7));var _0x44d1=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x4d14[_0x616290];return _0x453879;};'use strict';var WhatsappQueueEvents=require(_0x44d1('0x0'));var events=[_0x44d1('0x1'),_0x44d1('0x2'),_0x44d1('0x3')];function createListener(_0xaf25b0,_0x3b18bc){return function(_0x81c1b2){_0x3b18bc['emit'](_0xaf25b0,_0x81c1b2);};}function removeListener(_0xc2be7a,_0x370e1e){return function(){WhatsappQueueEvents[_0x44d1('0x4')](_0xc2be7a,_0x370e1e);};}exports[_0x44d1('0x5')]=function(_0x3aab1a){for(var _0x29ecb7=0x0,_0x42dba8=events[_0x44d1('0x6')];_0x29ecb7<_0x42dba8;_0x29ecb7++){var _0xc860bf=events[_0x29ecb7];var _0x424f05=createListener(_0x44d1('0x7')+_0xc860bf,_0x3aab1a);WhatsappQueueEvents['on'](_0xc860bf,_0x424f05);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 0f85dfc..034aaf1 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 _0x0c14=['./whatsappQueueReport.controller','index','get','isAuthenticated','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x50f18b,_0x1d9950){var _0xc8895b=function(_0x4b823c){while(--_0x4b823c){_0x50f18b['push'](_0x50f18b['shift']());}};_0xc8895b(++_0x1d9950);}(_0x0c14,0x183));var _0x40c1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x0c14[_0x138adb];return _0x1b27f2;};'use strict';var multer=require(_0x40c1('0x0'));var util=require(_0x40c1('0x1'));var path=require(_0x40c1('0x2'));var timeout=require(_0x40c1('0x3'));var express=require(_0x40c1('0x4'));var router=express[_0x40c1('0x5')]();var fs_extra=require(_0x40c1('0x6'));var auth=require(_0x40c1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x40c1('0x8'));var controller=require(_0x40c1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x40c1('0xa')]);router[_0x40c1('0xb')]('/describe',auth[_0x40c1('0xc')](),controller['describe']);router[_0x40c1('0xb')](_0x40c1('0xd'),auth['isAuthenticated'](),controller[_0x40c1('0xe')]);router[_0x40c1('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x40c1('0x10')](_0x40c1('0xd'),auth[_0x40c1('0xc')](),controller['update']);router[_0x40c1('0x11')](_0x40c1('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x392c=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/describe','isAuthenticated','show','create','delete','/:id','destroy','multer','util'];(function(_0xd3773f,_0x43811b){var _0x5deefc=function(_0x456a00){while(--_0x456a00){_0xd3773f['push'](_0xd3773f['shift']());}};_0x5deefc(++_0x43811b);}(_0x392c,0x1eb));var _0xc392=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x392c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc392('0x0'));var util=require(_0xc392('0x1'));var path=require(_0xc392('0x2'));var timeout=require(_0xc392('0x3'));var express=require(_0xc392('0x4'));var router=express[_0xc392('0x5')]();var fs_extra=require(_0xc392('0x6'));var auth=require(_0xc392('0x7'));var interaction=require(_0xc392('0x8'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router[_0xc392('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc392('0x9')](_0xc392('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xc392('0x9')]('/:id',auth[_0xc392('0xb')](),controller[_0xc392('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc392('0xd')]);router['put']('/:id',auth[_0xc392('0xb')](),controller['update']);router[_0xc392('0xe')](_0xc392('0xf'),auth[_0xc392('0xb')](),controller[_0xc392('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index fa4628b..c07e850 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(_0x193e06,_0x2a0dbc){var _0x1d86ad=function(_0x5616bf){while(--_0x5616bf){_0x193e06['push'](_0x193e06['shift']());}};_0x1d86ad(++_0x2a0dbc);}(_0x7a54,0x106));var _0x47a5=function(_0xaf99ec,_0x3d777e){_0xaf99ec=_0xaf99ec-0x0;var _0x5b0436=_0x7a54[_0xaf99ec];return _0x5b0436;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x1e2f66,_0x275ca1){var _0x1ded49=function(_0x402361){while(--_0x402361){_0x1e2f66['push'](_0x1e2f66['shift']());}};_0x1ded49(++_0x275ca1);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 848e964..fbb19bb 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 _0x4e81=['limit','count','Content-Range','apply','reject','save','then','end','error','stack','name','send','index','WhatsappQueueReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4e81,0x1bc));var _0x14e8=function(_0x1c2f29,_0x5a2668){_0x1c2f29=_0x1c2f29-0x0;var _0x258465=_0x4e81[_0x1c2f29];return _0x258465;};'use strict';var emlformat=require(_0x14e8('0x0'));var rimraf=require(_0x14e8('0x1'));var zipdir=require(_0x14e8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x14e8('0x3'));var Mustache=require(_0x14e8('0x4'));var util=require(_0x14e8('0x5'));var path=require(_0x14e8('0x6'));var sox=require(_0x14e8('0x7'));var csv=require(_0x14e8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e8('0x9'));var squel=require(_0x14e8('0xa'));var crypto=require(_0x14e8('0xb'));var jsforce=require(_0x14e8('0xc'));var deskjs=require(_0x14e8('0xd'));var toCsv=require(_0x14e8('0x8'));var querystring=require(_0x14e8('0xe'));var Papa=require(_0x14e8('0xf'));var Redis=require(_0x14e8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x14e8('0x11'));var as=require(_0x14e8('0x12'));var hardwareService=require(_0x14e8('0x13'));var logger=require(_0x14e8('0x14'))(_0x14e8('0x15'));var utils=require(_0x14e8('0x16'));var config=require(_0x14e8('0x17'));var licenseUtil=require(_0x14e8('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37eccb,_0x59c6c9){_0x59c6c9=_0x59c6c9||0xcc;return function(_0x2607ef){if(_0x2607ef){return _0x37eccb[_0x14e8('0x19')](_0x59c6c9);}return _0x37eccb[_0x14e8('0x1a')](_0x59c6c9)['end']();};}function respondWithResult(_0x22fa86,_0x4e1064){_0x4e1064=_0x4e1064||0xc8;return function(_0x458e4a){if(_0x458e4a){return _0x22fa86['status'](_0x4e1064)[_0x14e8('0x1b')](_0x458e4a);}};}function respondWithFilteredResult(_0x3761a1,_0xc6101f){return function(_0x135996){if(_0x135996){var _0x52e64f=typeof _0xc6101f[_0x14e8('0x1c')]===_0x14e8('0x1d')&&typeof _0xc6101f[_0x14e8('0x1e')]===_0x14e8('0x1d');var _0xd4d6b2=_0x135996[_0x14e8('0x1f')];var _0x10dc8b=_0x52e64f?0x0:_0xc6101f[_0x14e8('0x1c')];var _0x5a38c1=_0x52e64f?_0x135996[_0x14e8('0x1f')]:_0xc6101f[_0x14e8('0x1c')]+_0xc6101f[_0x14e8('0x1e')];var _0x7b10f2;if(_0x5a38c1>=_0xd4d6b2){_0x5a38c1=_0xd4d6b2;_0x7b10f2=0xc8;}else{_0x7b10f2=0xce;}_0x3761a1[_0x14e8('0x1a')](_0x7b10f2);return _0x3761a1['set'](_0x14e8('0x20'),_0x10dc8b+'-'+_0x5a38c1+'/'+_0xd4d6b2)[_0x14e8('0x1b')](_0x135996);}return null;};}function patchUpdates(_0x2abfec){return function(_0x48e30a){try{jsonpatch[_0x14e8('0x21')](_0x48e30a,_0x2abfec,!![]);}catch(_0x47f060){return BPromise[_0x14e8('0x22')](_0x47f060);}return _0x48e30a[_0x14e8('0x23')]();};}function saveUpdates(_0x3e8d5c,_0x117b00){return function(_0xcf673){if(_0xcf673){return _0xcf673['update'](_0x3e8d5c)[_0x14e8('0x24')](function(_0x5b11f9){return _0x5b11f9;});}return null;};}function removeEntity(_0x31bdd3,_0x185a0e){return function(_0x4ffc8b){if(_0x4ffc8b){return _0x4ffc8b['destroy']()['then'](function(){_0x31bdd3[_0x14e8('0x1a')](0xcc)[_0x14e8('0x25')]();});}};}function handleEntityNotFound(_0x3eae0b,_0x20bfe8){return function(_0x333d44){if(!_0x333d44){_0x3eae0b['sendStatus'](0x194);}return _0x333d44;};}function handleError(_0x23a9dc,_0x3fd96d){_0x3fd96d=_0x3fd96d||0x1f4;return function(_0x3c09cb){logger[_0x14e8('0x26')](_0x3c09cb[_0x14e8('0x27')]);if(_0x3c09cb[_0x14e8('0x28')]){delete _0x3c09cb[_0x14e8('0x28')];}_0x23a9dc['status'](_0x3fd96d)[_0x14e8('0x29')](_0x3c09cb);};}exports[_0x14e8('0x2a')]=function(_0x393ab0,_0x5f5abb){var _0x48eed0={},_0x5cacd7={},_0x8fe0e2={'count':0x0,'rows':[]};var _0x2a408d=_['map'](db[_0x14e8('0x2b')][_0x14e8('0x2c')],function(_0x176e8f){return{'name':_0x176e8f[_0x14e8('0x2d')],'type':_0x176e8f['type'][_0x14e8('0x2e')]};});_0x5cacd7[_0x14e8('0x2f')]=_[_0x14e8('0x30')](_0x2a408d,_0x14e8('0x28'));_0x5cacd7[_0x14e8('0x31')]=_['keys'](_0x393ab0[_0x14e8('0x31')]);_0x5cacd7[_0x14e8('0x32')]=_[_0x14e8('0x33')](_0x5cacd7[_0x14e8('0x2f')],_0x5cacd7['query']);_0x48eed0[_0x14e8('0x34')]=_['intersection'](_0x5cacd7[_0x14e8('0x2f')],qs[_0x14e8('0x35')](_0x393ab0[_0x14e8('0x31')][_0x14e8('0x35')]));_0x48eed0[_0x14e8('0x34')]=_0x48eed0[_0x14e8('0x34')][_0x14e8('0x36')]?_0x48eed0[_0x14e8('0x34')]:_0x5cacd7[_0x14e8('0x2f')];if(!_0x393ab0[_0x14e8('0x31')][_0x14e8('0x37')](_0x14e8('0x38'))){_0x48eed0['limit']=qs['limit'](_0x393ab0['query'][_0x14e8('0x1e')]);_0x48eed0['offset']=qs[_0x14e8('0x1c')](_0x393ab0['query'][_0x14e8('0x1c')]);}_0x48eed0[_0x14e8('0x39')]=qs[_0x14e8('0x3a')](_0x393ab0[_0x14e8('0x31')]['sort']);_0x48eed0[_0x14e8('0x3b')]=qs['filters'](_[_0x14e8('0x3c')](_0x393ab0[_0x14e8('0x31')],_0x5cacd7[_0x14e8('0x32')]),_0x2a408d);if(_0x393ab0[_0x14e8('0x31')][_0x14e8('0x3d')]){_0x48eed0[_0x14e8('0x3b')]=_['merge'](_0x48eed0[_0x14e8('0x3b')],{'$or':_['map'](_0x2a408d,function(_0x30baf1){if(_0x30baf1[_0x14e8('0x3e')]!==_0x14e8('0x3f')){var _0x4cafe6={};_0x4cafe6[_0x30baf1[_0x14e8('0x28')]]={'$like':'%'+_0x393ab0[_0x14e8('0x31')]['filter']+'%'};return _0x4cafe6;}})});}_0x48eed0=_[_0x14e8('0x40')]({},_0x48eed0,_0x393ab0[_0x14e8('0x41')]);var _0x1f429a={'where':_0x48eed0[_0x14e8('0x3b')]};return db[_0x14e8('0x2b')][_0x14e8('0x1f')](_0x1f429a)[_0x14e8('0x24')](function(_0x38ec58){_0x8fe0e2[_0x14e8('0x1f')]=_0x38ec58;if(_0x393ab0[_0x14e8('0x31')][_0x14e8('0x42')]){_0x48eed0[_0x14e8('0x43')]=[{'all':!![]}];}return db[_0x14e8('0x2b')][_0x14e8('0x44')](_0x48eed0);})[_0x14e8('0x24')](function(_0x596ac7){_0x8fe0e2[_0x14e8('0x45')]=_0x596ac7;return _0x8fe0e2;})['then'](respondWithFilteredResult(_0x5f5abb,_0x48eed0))['catch'](handleError(_0x5f5abb,null));};exports['show']=function(_0x3d2d95,_0x5ed821){var _0x46a3c4={'raw':!![],'where':{'id':_0x3d2d95[_0x14e8('0x46')]['id']}},_0x45bff0={};_0x45bff0[_0x14e8('0x2f')]=_[_0x14e8('0x47')](db[_0x14e8('0x2b')][_0x14e8('0x2c')]);_0x45bff0[_0x14e8('0x31')]=_[_0x14e8('0x47')](_0x3d2d95[_0x14e8('0x31')]);_0x45bff0[_0x14e8('0x32')]=_['intersection'](_0x45bff0[_0x14e8('0x2f')],_0x45bff0[_0x14e8('0x31')]);_0x46a3c4[_0x14e8('0x34')]=_[_0x14e8('0x33')](_0x45bff0['model'],qs[_0x14e8('0x35')](_0x3d2d95[_0x14e8('0x31')]['fields']));_0x46a3c4['attributes']=_0x46a3c4[_0x14e8('0x34')]['length']?_0x46a3c4['attributes']:_0x45bff0[_0x14e8('0x2f')];if(_0x3d2d95[_0x14e8('0x31')]['includeAll']){_0x46a3c4[_0x14e8('0x43')]=[{'all':!![]}];}_0x46a3c4=_[_0x14e8('0x40')]({},_0x46a3c4,_0x3d2d95['options']);return db[_0x14e8('0x2b')][_0x14e8('0x48')](_0x46a3c4)[_0x14e8('0x24')](handleEntityNotFound(_0x5ed821,null))[_0x14e8('0x24')](respondWithResult(_0x5ed821,null))[_0x14e8('0x49')](handleError(_0x5ed821,null));};exports[_0x14e8('0x4a')]=function(_0x343529,_0x2541ad){return db[_0x14e8('0x2b')][_0x14e8('0x4a')](_0x343529[_0x14e8('0x4b')],{})[_0x14e8('0x24')](respondWithResult(_0x2541ad,0xc9))[_0x14e8('0x49')](handleError(_0x2541ad,null));};exports[_0x14e8('0x4c')]=function(_0x1bf742,_0x1f50bc){if(_0x1bf742['body']['id']){delete _0x1bf742[_0x14e8('0x4b')]['id'];}return db['WhatsappQueueReport'][_0x14e8('0x48')]({'where':{'id':_0x1bf742[_0x14e8('0x46')]['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x1f50bc,null))[_0x14e8('0x24')](saveUpdates(_0x1bf742['body'],null))['then'](respondWithResult(_0x1f50bc,null))['catch'](handleError(_0x1f50bc,null));};exports[_0x14e8('0x4d')]=function(_0x49657e,_0x55f9b0){return db[_0x14e8('0x2b')][_0x14e8('0x48')]({'where':{'id':_0x49657e['params']['id']}})[_0x14e8('0x24')](handleEntityNotFound(_0x55f9b0,null))[_0x14e8('0x24')](removeEntity(_0x55f9b0,null))[_0x14e8('0x49')](handleError(_0x55f9b0,null));};exports[_0x14e8('0x4e')]=function(_0x4cc86a,_0x519c9c){return db[_0x14e8('0x2b')][_0x14e8('0x4e')]()[_0x14e8('0x24')](respondWithResult(_0x519c9c,null))[_0x14e8('0x49')](handleError(_0x519c9c,null));}; \ No newline at end of file +var _0x9354=['rows','show','keys','length','find','catch','create','body','params','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','apply','reject','save','update','then','destroy','error','stack','name','map','WhatsappQueueReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','offset','sort','filter','where','merge','type','options','includeAll','include','findAll'];(function(_0x5367b5,_0x3bec4a){var _0x2f94ce=function(_0x23d364){while(--_0x23d364){_0x5367b5['push'](_0x5367b5['shift']());}};_0x2f94ce(++_0x3bec4a);}(_0x9354,0x96));var _0x4935=function(_0xb0de07,_0x3ca2a0){_0xb0de07=_0xb0de07-0x0;var _0x4633d8=_0x9354[_0xb0de07];return _0x4633d8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4935('0x0'));var zipdir=require(_0x4935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4935('0x2'));var moment=require(_0x4935('0x3'));var BPromise=require(_0x4935('0x4'));var Mustache=require(_0x4935('0x5'));var util=require('util');var path=require(_0x4935('0x6'));var sox=require(_0x4935('0x7'));var csv=require(_0x4935('0x8'));var ejs=require(_0x4935('0x9'));var fs=require('fs');var fs_extra=require(_0x4935('0xa'));var _=require(_0x4935('0xb'));var squel=require(_0x4935('0xc'));var crypto=require(_0x4935('0xd'));var jsforce=require(_0x4935('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4935('0x8'));var querystring=require('querystring');var Papa=require(_0x4935('0xf'));var Redis=require(_0x4935('0x10'));var authService=require(_0x4935('0x11'));var qs=require(_0x4935('0x12'));var as=require(_0x4935('0x13'));var hardwareService=require(_0x4935('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x4935('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4935('0x16'))['db'];function respondWithStatusCode(_0x32916f,_0x3bb388){_0x3bb388=_0x3bb388||0xcc;return function(_0x1c6c22){if(_0x1c6c22){return _0x32916f[_0x4935('0x17')](_0x3bb388);}return _0x32916f[_0x4935('0x18')](_0x3bb388)[_0x4935('0x19')]();};}function respondWithResult(_0x3a7c30,_0x57549f){_0x57549f=_0x57549f||0xc8;return function(_0x237e28){if(_0x237e28){return _0x3a7c30[_0x4935('0x18')](_0x57549f)[_0x4935('0x1a')](_0x237e28);}};}function respondWithFilteredResult(_0xa41961,_0x3652c4){return function(_0x24cc99){if(_0x24cc99){var _0x395a43=typeof _0x3652c4['offset']===_0x4935('0x1b')&&typeof _0x3652c4[_0x4935('0x1c')]===_0x4935('0x1b');var _0x123300=_0x24cc99[_0x4935('0x1d')];var _0x429ef3=_0x395a43?0x0:_0x3652c4['offset'];var _0xd70eff=_0x395a43?_0x24cc99[_0x4935('0x1d')]:_0x3652c4['offset']+_0x3652c4[_0x4935('0x1c')];var _0x10407f;if(_0xd70eff>=_0x123300){_0xd70eff=_0x123300;_0x10407f=0xc8;}else{_0x10407f=0xce;}_0xa41961[_0x4935('0x18')](_0x10407f);return _0xa41961['set']('Content-Range',_0x429ef3+'-'+_0xd70eff+'/'+_0x123300)[_0x4935('0x1a')](_0x24cc99);}return null;};}function patchUpdates(_0x6b849f){return function(_0x1ae059){try{jsonpatch[_0x4935('0x1e')](_0x1ae059,_0x6b849f,!![]);}catch(_0x41d76e){return BPromise[_0x4935('0x1f')](_0x41d76e);}return _0x1ae059[_0x4935('0x20')]();};}function saveUpdates(_0xe482a5,_0x58b2f3){return function(_0x2f520a){if(_0x2f520a){return _0x2f520a[_0x4935('0x21')](_0xe482a5)[_0x4935('0x22')](function(_0x2c701f){return _0x2c701f;});}return null;};}function removeEntity(_0x52c65a,_0x53530f){return function(_0x4dc1f5){if(_0x4dc1f5){return _0x4dc1f5[_0x4935('0x23')]()[_0x4935('0x22')](function(){_0x52c65a[_0x4935('0x18')](0xcc)[_0x4935('0x19')]();});}};}function handleEntityNotFound(_0x344e51,_0x1c37ba){return function(_0x3784f9){if(!_0x3784f9){_0x344e51[_0x4935('0x17')](0x194);}return _0x3784f9;};}function handleError(_0x2e1583,_0xf4abb2){_0xf4abb2=_0xf4abb2||0x1f4;return function(_0x1d08b5){logger[_0x4935('0x24')](_0x1d08b5[_0x4935('0x25')]);if(_0x1d08b5[_0x4935('0x26')]){delete _0x1d08b5[_0x4935('0x26')];}_0x2e1583['status'](_0xf4abb2)['send'](_0x1d08b5);};}exports['index']=function(_0x1fc218,_0x76ea7d){var _0x4f1163={},_0x3f0707={},_0x20755a={'count':0x0,'rows':[]};var _0x24a3b6=_[_0x4935('0x27')](db[_0x4935('0x28')][_0x4935('0x29')],function(_0x28afc2){return{'name':_0x28afc2[_0x4935('0x2a')],'type':_0x28afc2['type'][_0x4935('0x2b')]};});_0x3f0707[_0x4935('0x2c')]=_['map'](_0x24a3b6,'name');_0x3f0707[_0x4935('0x2d')]=_['keys'](_0x1fc218[_0x4935('0x2d')]);_0x3f0707[_0x4935('0x2e')]=_[_0x4935('0x2f')](_0x3f0707['model'],_0x3f0707['query']);_0x4f1163[_0x4935('0x30')]=_[_0x4935('0x2f')](_0x3f0707['model'],qs[_0x4935('0x31')](_0x1fc218[_0x4935('0x2d')][_0x4935('0x31')]));_0x4f1163[_0x4935('0x30')]=_0x4f1163[_0x4935('0x30')]['length']?_0x4f1163['attributes']:_0x3f0707[_0x4935('0x2c')];if(!_0x1fc218[_0x4935('0x2d')]['hasOwnProperty']('nolimit')){_0x4f1163[_0x4935('0x1c')]=qs['limit'](_0x1fc218[_0x4935('0x2d')][_0x4935('0x1c')]);_0x4f1163[_0x4935('0x32')]=qs[_0x4935('0x32')](_0x1fc218[_0x4935('0x2d')][_0x4935('0x32')]);}_0x4f1163['order']=qs[_0x4935('0x33')](_0x1fc218['query'][_0x4935('0x33')]);_0x4f1163['where']=qs[_0x4935('0x2e')](_['pick'](_0x1fc218[_0x4935('0x2d')],_0x3f0707[_0x4935('0x2e')]),_0x24a3b6);if(_0x1fc218[_0x4935('0x2d')][_0x4935('0x34')]){_0x4f1163[_0x4935('0x35')]=_[_0x4935('0x36')](_0x4f1163[_0x4935('0x35')],{'$or':_['map'](_0x24a3b6,function(_0x57e1ca){if(_0x57e1ca[_0x4935('0x37')]!=='VIRTUAL'){var _0x4e8b2e={};_0x4e8b2e[_0x57e1ca[_0x4935('0x26')]]={'$like':'%'+_0x1fc218['query'][_0x4935('0x34')]+'%'};return _0x4e8b2e;}})});}_0x4f1163=_[_0x4935('0x36')]({},_0x4f1163,_0x1fc218[_0x4935('0x38')]);var _0x99b7c5={'where':_0x4f1163[_0x4935('0x35')]};return db['WhatsappQueueReport']['count'](_0x99b7c5)[_0x4935('0x22')](function(_0x2be169){_0x20755a[_0x4935('0x1d')]=_0x2be169;if(_0x1fc218[_0x4935('0x2d')][_0x4935('0x39')]){_0x4f1163[_0x4935('0x3a')]=[{'all':!![]}];}return db[_0x4935('0x28')][_0x4935('0x3b')](_0x4f1163);})['then'](function(_0x4e94f6){_0x20755a[_0x4935('0x3c')]=_0x4e94f6;return _0x20755a;})[_0x4935('0x22')](respondWithFilteredResult(_0x76ea7d,_0x4f1163))['catch'](handleError(_0x76ea7d,null));};exports[_0x4935('0x3d')]=function(_0x157950,_0x4706eb){var _0xe5c9f5={'raw':!![],'where':{'id':_0x157950['params']['id']}},_0x52ab0c={};_0x52ab0c[_0x4935('0x2c')]=_[_0x4935('0x3e')](db['WhatsappQueueReport'][_0x4935('0x29')]);_0x52ab0c[_0x4935('0x2d')]=_[_0x4935('0x3e')](_0x157950['query']);_0x52ab0c[_0x4935('0x2e')]=_[_0x4935('0x2f')](_0x52ab0c[_0x4935('0x2c')],_0x52ab0c[_0x4935('0x2d')]);_0xe5c9f5[_0x4935('0x30')]=_[_0x4935('0x2f')](_0x52ab0c[_0x4935('0x2c')],qs[_0x4935('0x31')](_0x157950[_0x4935('0x2d')][_0x4935('0x31')]));_0xe5c9f5[_0x4935('0x30')]=_0xe5c9f5[_0x4935('0x30')][_0x4935('0x3f')]?_0xe5c9f5[_0x4935('0x30')]:_0x52ab0c[_0x4935('0x2c')];if(_0x157950[_0x4935('0x2d')][_0x4935('0x39')]){_0xe5c9f5[_0x4935('0x3a')]=[{'all':!![]}];}_0xe5c9f5=_['merge']({},_0xe5c9f5,_0x157950[_0x4935('0x38')]);return db['WhatsappQueueReport'][_0x4935('0x40')](_0xe5c9f5)[_0x4935('0x22')](handleEntityNotFound(_0x4706eb,null))[_0x4935('0x22')](respondWithResult(_0x4706eb,null))[_0x4935('0x41')](handleError(_0x4706eb,null));};exports['create']=function(_0x2a3404,_0x9c8bad){return db[_0x4935('0x28')][_0x4935('0x42')](_0x2a3404[_0x4935('0x43')],{})[_0x4935('0x22')](respondWithResult(_0x9c8bad,0xc9))[_0x4935('0x41')](handleError(_0x9c8bad,null));};exports[_0x4935('0x21')]=function(_0x29b932,_0x392cba){if(_0x29b932['body']['id']){delete _0x29b932[_0x4935('0x43')]['id'];}return db[_0x4935('0x28')]['find']({'where':{'id':_0x29b932[_0x4935('0x44')]['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x392cba,null))[_0x4935('0x22')](saveUpdates(_0x29b932[_0x4935('0x43')],null))[_0x4935('0x22')](respondWithResult(_0x392cba,null))[_0x4935('0x41')](handleError(_0x392cba,null));};exports[_0x4935('0x23')]=function(_0x471fb1,_0x4b9c70){return db[_0x4935('0x28')]['find']({'where':{'id':_0x471fb1['params']['id']}})[_0x4935('0x22')](handleEntityNotFound(_0x4b9c70,null))[_0x4935('0x22')](removeEntity(_0x4b9c70,null))[_0x4935('0x41')](handleError(_0x4b9c70,null));};exports[_0x4935('0x45')]=function(_0x2dd30f,_0x487cf3){return db[_0x4935('0x28')][_0x4935('0x45')]()[_0x4935('0x22')](respondWithResult(_0x487cf3,null))[_0x4935('0x41')](handleError(_0x487cf3,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 25c1fdb..14cef6e 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 _0x9550=['api','moment','bluebird','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger'];(function(_0x150dc2,_0x3e7980){var _0x30e51a=function(_0x5580f0){while(--_0x5580f0){_0x150dc2['push'](_0x150dc2['shift']());}};_0x30e51a(++_0x3e7980);}(_0x9550,0x11b));var _0x0955=function(_0x31e1d6,_0x2462d8){_0x31e1d6=_0x31e1d6-0x0;var _0xa91ba6=_0x9550[_0x31e1d6];return _0xa91ba6;};'use strict';var _=require(_0x0955('0x0'));var util=require(_0x0955('0x1'));var logger=require(_0x0955('0x2'))(_0x0955('0x3'));var moment=require(_0x0955('0x4'));var BPromise=require(_0x0955('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0955('0x6'));var config=require(_0x0955('0x7'));var attributes=require(_0x0955('0x8'));module[_0x0955('0x9')]=function(_0x5a5d14,_0x1519ce){return _0x5a5d14['define'](_0x0955('0xa'),attributes,{'tableName':_0x0955('0xb'),'paranoid':![],'indexes':[{'name':_0x0955('0xc'),'fields':[_0x0955('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x923e=['lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0x923e,0x15f));var _0xe923=function(_0x5e7e66,_0x358d66){_0x5e7e66=_0x5e7e66-0x0;var _0x1fa296=_0x923e[_0x5e7e66];return _0x1fa296;};'use strict';var _=require(_0xe923('0x0'));var util=require('util');var logger=require(_0xe923('0x1'))(_0xe923('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe923('0x3'));var fs=require('fs');var path=require(_0xe923('0x4'));var rimraf=require(_0xe923('0x5'));var config=require(_0xe923('0x6'));var attributes=require(_0xe923('0x7'));module[_0xe923('0x8')]=function(_0x2302ed,_0x2d53c9){return _0x2302ed[_0xe923('0x9')](_0xe923('0xa'),attributes,{'tableName':_0xe923('0xb'),'paranoid':![],'indexes':[{'name':_0xe923('0xc'),'fields':[_0xe923('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 90149ef..c18227b 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 _0xf8c4=['info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','then','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','WhatsappQueueReport','options','raw','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x411665,_0x1ae5e8){var _0x361e61=function(_0x1dcb11){while(--_0x1dcb11){_0x411665['push'](_0x411665['shift']());}};_0x361e61(++_0x1ae5e8);}(_0xf8c4,0x1b8));var _0x4f8c=function(_0x62c958,_0x2bfdbc){_0x62c958=_0x62c958-0x0;var _0x57ec61=_0xf8c4[_0x62c958];return _0x57ec61;};'use strict';var _=require(_0x4f8c('0x0'));var util=require('util');var moment=require(_0x4f8c('0x1'));var BPromise=require(_0x4f8c('0x2'));var rs=require(_0x4f8c('0x3'));var fs=require('fs');var Redis=require(_0x4f8c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f8c('0x5'));var logger=require('../../config/logger')(_0x4f8c('0x6'));var config=require(_0x4f8c('0x7'));var jayson=require(_0x4f8c('0x8'));var client=jayson[_0x4f8c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb8caa,_0x56ef25,_0x196945){return new BPromise(function(_0x2eba4c,_0x3c6371){return client['request'](_0xb8caa,_0x196945)['then'](function(_0x5961b3){logger[_0x4f8c('0xa')](_0x4f8c('0xb'),_0x56ef25,_0x4f8c('0xc'));logger[_0x4f8c('0xd')](_0x4f8c('0xe'),_0x56ef25,_0x4f8c('0xc'),JSON[_0x4f8c('0xf')](_0x5961b3));if(_0x5961b3['error']){if(_0x5961b3[_0x4f8c('0x10')][_0x4f8c('0x11')]===0x1f4){logger[_0x4f8c('0x10')](_0x4f8c('0xb'),_0x56ef25,_0x5961b3[_0x4f8c('0x10')]['message']);return _0x3c6371(_0x5961b3[_0x4f8c('0x10')][_0x4f8c('0x12')]);}logger['error'](_0x4f8c('0xb'),_0x56ef25,_0x5961b3[_0x4f8c('0x10')][_0x4f8c('0x12')]);return _0x2eba4c(_0x5961b3['error']['message']);}else{logger[_0x4f8c('0xa')](_0x4f8c('0xb'),_0x56ef25,'request\x20sent');_0x2eba4c(_0x5961b3[_0x4f8c('0x13')][_0x4f8c('0x12')]);}})[_0x4f8c('0x14')](function(_0xa53b53){logger[_0x4f8c('0x10')](_0x4f8c('0xb'),_0x56ef25,_0xa53b53);_0x3c6371(_0xa53b53);});});}exports['CreateWhatsappQueueReport']=function(_0x2cc57e){var _0x3b8b07=this;return new Promise(function(_0x2ef2e9,_0x3fd9d6){return db['WhatsappQueueReport']['create'](_0x2cc57e[_0x4f8c('0x15')],{'raw':_0x2cc57e['options']?_0x2cc57e['options']['raw']===undefined?!![]:![]:!![]})[_0x4f8c('0x16')](function(_0x28199d){logger[_0x4f8c('0xa')](_0x4f8c('0x17'),_0x2cc57e);logger['debug'](_0x4f8c('0x17'),_0x2cc57e,JSON[_0x4f8c('0xf')](_0x28199d));_0x2ef2e9(_0x28199d);})['catch'](function(_0x58adc5){logger[_0x4f8c('0x10')](_0x4f8c('0x17'),_0x58adc5[_0x4f8c('0x12')],_0x2cc57e);_0x3fd9d6(_0x3b8b07[_0x4f8c('0x10')](0x1f4,_0x58adc5['message']));});});};exports[_0x4f8c('0x18')]=function(_0x40015a){var _0x2aa72d=this;return new Promise(function(_0x306b71,_0x594a3e){return db[_0x4f8c('0x19')]['update'](_0x40015a['body'],{'raw':_0x40015a[_0x4f8c('0x1a')]?_0x40015a[_0x4f8c('0x1a')][_0x4f8c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40015a[_0x4f8c('0x1a')]?_0x40015a['options']['where']||null:null,'attributes':_0x40015a['options']?_0x40015a[_0x4f8c('0x1a')][_0x4f8c('0x1c')]||null:null,'limit':_0x40015a[_0x4f8c('0x1a')]?_0x40015a[_0x4f8c('0x1a')][_0x4f8c('0x1d')]||null:null})[_0x4f8c('0x16')](function(_0x70719a){logger[_0x4f8c('0xa')](_0x4f8c('0x18'),_0x40015a);logger[_0x4f8c('0xd')](_0x4f8c('0x18'),_0x40015a,JSON[_0x4f8c('0xf')](_0x70719a));_0x306b71(_0x70719a);})[_0x4f8c('0x14')](function(_0xf94924){logger[_0x4f8c('0x10')](_0x4f8c('0x18'),_0xf94924[_0x4f8c('0x12')],_0x40015a);_0x594a3e(_0x2aa72d[_0x4f8c('0x10')](0x1f4,_0xf94924[_0x4f8c('0x12')]));});});}; \ No newline at end of file +var _0x5692=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','stringify','UpdateWhatsappQueueReport','update','where','limit','moment'];(function(_0x492d04,_0x16d67c){var _0x1e3c21=function(_0x31e8b9){while(--_0x31e8b9){_0x492d04['push'](_0x492d04['shift']());}};_0x1e3c21(++_0x16d67c);}(_0x5692,0x154));var _0x2569=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5692[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2569('0x0'));var BPromise=require('bluebird');var rs=require(_0x2569('0x1'));var fs=require('fs');var Redis=require(_0x2569('0x2'));var db=require(_0x2569('0x3'))['db'];var utils=require(_0x2569('0x4'));var logger=require('../../config/logger')(_0x2569('0x5'));var config=require(_0x2569('0x6'));var jayson=require(_0x2569('0x7'));var client=jayson['client'][_0x2569('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1bb01b,_0x421548,_0x174184){return new BPromise(function(_0x49bf57,_0x4a43d7){return client[_0x2569('0x9')](_0x1bb01b,_0x174184)[_0x2569('0xa')](function(_0x3e819c){logger[_0x2569('0xb')](_0x2569('0xc'),_0x421548,_0x2569('0xd'));logger[_0x2569('0xe')](_0x2569('0xf'),_0x421548,_0x2569('0xd'),JSON['stringify'](_0x3e819c));if(_0x3e819c[_0x2569('0x10')]){if(_0x3e819c[_0x2569('0x10')][_0x2569('0x11')]===0x1f4){logger[_0x2569('0x10')](_0x2569('0xc'),_0x421548,_0x3e819c['error'][_0x2569('0x12')]);return _0x4a43d7(_0x3e819c[_0x2569('0x10')][_0x2569('0x12')]);}logger[_0x2569('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x421548,_0x3e819c[_0x2569('0x10')][_0x2569('0x12')]);return _0x49bf57(_0x3e819c[_0x2569('0x10')][_0x2569('0x12')]);}else{logger[_0x2569('0xb')](_0x2569('0xc'),_0x421548,_0x2569('0xd'));_0x49bf57(_0x3e819c['result'][_0x2569('0x12')]);}})[_0x2569('0x13')](function(_0x590cd4){logger['error'](_0x2569('0xc'),_0x421548,_0x590cd4);_0x4a43d7(_0x590cd4);});});}exports[_0x2569('0x14')]=function(_0x15cee9){var _0xc7d3f1=this;return new Promise(function(_0x8f45ba,_0x150b00){return db[_0x2569('0x15')][_0x2569('0x16')](_0x15cee9[_0x2569('0x17')],{'raw':_0x15cee9[_0x2569('0x18')]?_0x15cee9[_0x2569('0x18')][_0x2569('0x19')]===undefined?!![]:![]:!![]})[_0x2569('0xa')](function(_0x4b042b){logger['info'](_0x2569('0x14'),_0x15cee9);logger[_0x2569('0xe')]('CreateWhatsappQueueReport',_0x15cee9,JSON[_0x2569('0x1a')](_0x4b042b));_0x8f45ba(_0x4b042b);})[_0x2569('0x13')](function(_0x36ed2a){logger['error'](_0x2569('0x14'),_0x36ed2a['message'],_0x15cee9);_0x150b00(_0xc7d3f1[_0x2569('0x10')](0x1f4,_0x36ed2a[_0x2569('0x12')]));});});};exports[_0x2569('0x1b')]=function(_0x3622d5){var _0x5740bc=this;return new Promise(function(_0x2b8aa0,_0x27e4a9){return db[_0x2569('0x15')][_0x2569('0x1c')](_0x3622d5['body'],{'raw':_0x3622d5[_0x2569('0x18')]?_0x3622d5[_0x2569('0x18')][_0x2569('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3622d5[_0x2569('0x18')]?_0x3622d5[_0x2569('0x18')][_0x2569('0x1d')]||null:null,'attributes':_0x3622d5['options']?_0x3622d5[_0x2569('0x18')]['attributes']||null:null,'limit':_0x3622d5[_0x2569('0x18')]?_0x3622d5['options'][_0x2569('0x1e')]||null:null})[_0x2569('0xa')](function(_0x5bb76c){logger[_0x2569('0xb')](_0x2569('0x1b'),_0x3622d5);logger[_0x2569('0xe')]('UpdateWhatsappQueueReport',_0x3622d5,JSON[_0x2569('0x1a')](_0x5bb76c));_0x2b8aa0(_0x5bb76c);})[_0x2569('0x13')](function(_0x3a9246){logger['error'](_0x2569('0x1b'),_0x3a9246[_0x2569('0x12')],_0x3622d5);_0x27e4a9(_0x5740bc[_0x2569('0x10')](0x1f4,_0x3a9246['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9e957e6..0f04c21 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 _0xd5c3=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe','create','update','delete','/:id','destroy'];(function(_0x38f955,_0x4e65e6){var _0xd8b97=function(_0x4d61ff){while(--_0x4d61ff){_0x38f955['push'](_0x38f955['shift']());}};_0xd8b97(++_0x4e65e6);}(_0xd5c3,0x79));var _0x3d5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5c3[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3d5c('0x0'));var util=require(_0x3d5c('0x1'));var path=require(_0x3d5c('0x2'));var timeout=require(_0x3d5c('0x3'));var express=require(_0x3d5c('0x4'));var router=express[_0x3d5c('0x5')]();var fs_extra=require(_0x3d5c('0x6'));var auth=require(_0x3d5c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3d5c('0x8'));router[_0x3d5c('0x9')]('/',auth[_0x3d5c('0xa')](),controller[_0x3d5c('0xb')]);router[_0x3d5c('0x9')](_0x3d5c('0xc'),auth[_0x3d5c('0xa')](),controller[_0x3d5c('0xd')]);router[_0x3d5c('0x9')]('/:id',auth[_0x3d5c('0xa')](),controller['show']);router['post']('/',auth[_0x3d5c('0xa')](),controller[_0x3d5c('0xe')]);router['put']('/:id',auth[_0x3d5c('0xa')](),controller[_0x3d5c('0xf')]);router[_0x3d5c('0x10')](_0x3d5c('0x11'),auth[_0x3d5c('0xa')](),controller[_0x3d5c('0x12')]);module[_0x3d5c('0x13')]=router; \ No newline at end of file +var _0x4c9d=['/:id','show','create','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x3d03e4,_0x2b855c){var _0x227fea=function(_0x36e419){while(--_0x36e419){_0x3d03e4['push'](_0x3d03e4['shift']());}};_0x227fea(++_0x2b855c);}(_0x4c9d,0xd1));var _0xd4c9=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4c9d[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xd4c9('0x0'));var path=require(_0xd4c9('0x1'));var timeout=require(_0xd4c9('0x2'));var express=require(_0xd4c9('0x3'));var router=express['Router']();var fs_extra=require(_0xd4c9('0x4'));var auth=require(_0xd4c9('0x5'));var interaction=require(_0xd4c9('0x6'));var config=require(_0xd4c9('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xd4c9('0x8')]('/',auth[_0xd4c9('0x9')](),controller[_0xd4c9('0xa')]);router[_0xd4c9('0x8')]('/describe',auth[_0xd4c9('0x9')](),controller[_0xd4c9('0xb')]);router['get'](_0xd4c9('0xc'),auth[_0xd4c9('0x9')](),controller[_0xd4c9('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd4c9('0xe')]);router['put'](_0xd4c9('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd4c9('0xc'),auth[_0xd4c9('0x9')](),controller[_0xd4c9('0xf')]);module[_0xd4c9('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 0dff605..e64549d 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 _0xe458=['queue','DATE','sequelize','exports','ENUM','account','agent'];(function(_0x133ee2,_0x1365ff){var _0x28e86f=function(_0x162938){while(--_0x162938){_0x133ee2['push'](_0x133ee2['shift']());}};_0x28e86f(++_0x1365ff);}(_0xe458,0x160));var _0x8e45=function(_0x149075,_0x38a419){_0x149075=_0x149075-0x0;var _0x2d7768=_0xe458[_0x149075];return _0x2d7768;};'use strict';var Sequelize=require(_0x8e45('0x0'));module[_0x8e45('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8e45('0x2')](_0x8e45('0x3'),_0x8e45('0x4'),_0x8e45('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x8e45('0x6')]}}; \ No newline at end of file +var _0xfa4d=['sequelize','exports','ENUM','DATE'];(function(_0x365611,_0x570d76){var _0x578fd0=function(_0x1042e2){while(--_0x1042e2){_0x365611['push'](_0x365611['shift']());}};_0x578fd0(++_0x570d76);}(_0xfa4d,0x90));var _0xdfa4=function(_0x99b7b7,_0x267f0c){_0x99b7b7=_0x99b7b7-0x0;var _0x176068=_0xfa4d[_0x99b7b7];return _0x176068;};'use strict';var Sequelize=require(_0xdfa4('0x0'));module[_0xdfa4('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xdfa4('0x2')]('account','agent','queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xdfa4('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index aedac1d..ef25ec4 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 _0x041e=['then','destroy','error','name','send','index','map','WhatsappTransferReport','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','Content-Range','json','apply','save','update'];(function(_0x312fd5,_0x5730aa){var _0x1ef873=function(_0x4f0d2b){while(--_0x4f0d2b){_0x312fd5['push'](_0x312fd5['shift']());}};_0x1ef873(++_0x5730aa);}(_0x041e,0x73));var _0xe041=function(_0x3fd03a,_0x66d28b){_0x3fd03a=_0x3fd03a-0x0;var _0x5a7fe0=_0x041e[_0x3fd03a];return _0x5a7fe0;};'use strict';var emlformat=require(_0xe041('0x0'));var rimraf=require(_0xe041('0x1'));var zipdir=require(_0xe041('0x2'));var jsonpatch=require(_0xe041('0x3'));var rp=require(_0xe041('0x4'));var moment=require(_0xe041('0x5'));var BPromise=require(_0xe041('0x6'));var Mustache=require(_0xe041('0x7'));var util=require(_0xe041('0x8'));var path=require(_0xe041('0x9'));var sox=require('sox');var csv=require(_0xe041('0xa'));var ejs=require(_0xe041('0xb'));var fs=require('fs');var fs_extra=require(_0xe041('0xc'));var _=require('lodash');var squel=require(_0xe041('0xd'));var crypto=require(_0xe041('0xe'));var jsforce=require(_0xe041('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xe041('0xa'));var querystring=require(_0xe041('0x10'));var Papa=require(_0xe041('0x11'));var Redis=require(_0xe041('0x12'));var authService=require(_0xe041('0x13'));var qs=require(_0xe041('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe041('0x15'));var logger=require(_0xe041('0x16'))('api');var utils=require(_0xe041('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe041('0x18'));var db=require(_0xe041('0x19'))['db'];function respondWithStatusCode(_0x2c14b1,_0x463a16){_0x463a16=_0x463a16||0xcc;return function(_0x1ee609){if(_0x1ee609){return _0x2c14b1[_0xe041('0x1a')](_0x463a16);}return _0x2c14b1[_0xe041('0x1b')](_0x463a16)[_0xe041('0x1c')]();};}function respondWithResult(_0x481421,_0x55d555){_0x55d555=_0x55d555||0xc8;return function(_0x467192){if(_0x467192){return _0x481421[_0xe041('0x1b')](_0x55d555)['json'](_0x467192);}};}function respondWithFilteredResult(_0x5bfa82,_0x436b0e){return function(_0x425573){if(_0x425573){var _0xda6769=typeof _0x436b0e[_0xe041('0x1d')]===_0xe041('0x1e')&&typeof _0x436b0e[_0xe041('0x1f')]===_0xe041('0x1e');var _0x1a6d4e=_0x425573['count'];var _0x5aed99=_0xda6769?0x0:_0x436b0e[_0xe041('0x1d')];var _0x1d1cd1=_0xda6769?_0x425573['count']:_0x436b0e[_0xe041('0x1d')]+_0x436b0e[_0xe041('0x1f')];var _0x597383;if(_0x1d1cd1>=_0x1a6d4e){_0x1d1cd1=_0x1a6d4e;_0x597383=0xc8;}else{_0x597383=0xce;}_0x5bfa82['status'](_0x597383);return _0x5bfa82['set'](_0xe041('0x20'),_0x5aed99+'-'+_0x1d1cd1+'/'+_0x1a6d4e)[_0xe041('0x21')](_0x425573);}return null;};}function patchUpdates(_0x291129){return function(_0x509f42){try{jsonpatch[_0xe041('0x22')](_0x509f42,_0x291129,!![]);}catch(_0x4550a0){return BPromise['reject'](_0x4550a0);}return _0x509f42[_0xe041('0x23')]();};}function saveUpdates(_0xa54e04,_0x7a47d4){return function(_0x3709c9){if(_0x3709c9){return _0x3709c9[_0xe041('0x24')](_0xa54e04)[_0xe041('0x25')](function(_0x34040c){return _0x34040c;});}return null;};}function removeEntity(_0x2ada93,_0x349f11){return function(_0x2fc032){if(_0x2fc032){return _0x2fc032[_0xe041('0x26')]()[_0xe041('0x25')](function(){_0x2ada93[_0xe041('0x1b')](0xcc)[_0xe041('0x1c')]();});}};}function handleEntityNotFound(_0x3b5888,_0x4550b3){return function(_0x56cc58){if(!_0x56cc58){_0x3b5888[_0xe041('0x1a')](0x194);}return _0x56cc58;};}function handleError(_0x4a14a0,_0x41d004){_0x41d004=_0x41d004||0x1f4;return function(_0x194de4){logger[_0xe041('0x27')](_0x194de4['stack']);if(_0x194de4[_0xe041('0x28')]){delete _0x194de4['name'];}_0x4a14a0[_0xe041('0x1b')](_0x41d004)[_0xe041('0x29')](_0x194de4);};}exports[_0xe041('0x2a')]=function(_0x59a277,_0x432480){var _0x21829e={},_0x5dae8b={},_0x1cb13e={'count':0x0,'rows':[]};var _0x39c343=_[_0xe041('0x2b')](db[_0xe041('0x2c')][_0xe041('0x2d')],function(_0x4d4eba){return{'name':_0x4d4eba['fieldName'],'type':_0x4d4eba[_0xe041('0x2e')]['key']};});_0x5dae8b[_0xe041('0x2f')]=_['map'](_0x39c343,'name');_0x5dae8b[_0xe041('0x30')]=_['keys'](_0x59a277[_0xe041('0x30')]);_0x5dae8b[_0xe041('0x31')]=_[_0xe041('0x32')](_0x5dae8b[_0xe041('0x2f')],_0x5dae8b[_0xe041('0x30')]);_0x21829e['attributes']=_[_0xe041('0x32')](_0x5dae8b[_0xe041('0x2f')],qs[_0xe041('0x33')](_0x59a277[_0xe041('0x30')][_0xe041('0x33')]));_0x21829e[_0xe041('0x34')]=_0x21829e[_0xe041('0x34')][_0xe041('0x35')]?_0x21829e['attributes']:_0x5dae8b[_0xe041('0x2f')];if(!_0x59a277['query'][_0xe041('0x36')](_0xe041('0x37'))){_0x21829e['limit']=qs[_0xe041('0x1f')](_0x59a277[_0xe041('0x30')][_0xe041('0x1f')]);_0x21829e['offset']=qs[_0xe041('0x1d')](_0x59a277[_0xe041('0x30')][_0xe041('0x1d')]);}_0x21829e[_0xe041('0x38')]=qs[_0xe041('0x39')](_0x59a277[_0xe041('0x30')][_0xe041('0x39')]);_0x21829e[_0xe041('0x3a')]=qs[_0xe041('0x31')](_[_0xe041('0x3b')](_0x59a277[_0xe041('0x30')],_0x5dae8b[_0xe041('0x31')]),_0x39c343);if(_0x59a277['query'][_0xe041('0x3c')]){_0x21829e[_0xe041('0x3a')]=_[_0xe041('0x3d')](_0x21829e[_0xe041('0x3a')],{'$or':_['map'](_0x39c343,function(_0x32bf85){if(_0x32bf85[_0xe041('0x2e')]!=='VIRTUAL'){var _0x3ca0a4={};_0x3ca0a4[_0x32bf85[_0xe041('0x28')]]={'$like':'%'+_0x59a277['query'][_0xe041('0x3c')]+'%'};return _0x3ca0a4;}})});}_0x21829e=_[_0xe041('0x3d')]({},_0x21829e,_0x59a277[_0xe041('0x3e')]);var _0x5ab932={'where':_0x21829e[_0xe041('0x3a')]};return db[_0xe041('0x2c')][_0xe041('0x3f')](_0x5ab932)[_0xe041('0x25')](function(_0x1f2384){_0x1cb13e['count']=_0x1f2384;if(_0x59a277[_0xe041('0x30')][_0xe041('0x40')]){_0x21829e[_0xe041('0x41')]=[{'all':!![]}];}return db[_0xe041('0x2c')][_0xe041('0x42')](_0x21829e);})[_0xe041('0x25')](function(_0x2f6264){_0x1cb13e[_0xe041('0x43')]=_0x2f6264;return _0x1cb13e;})['then'](respondWithFilteredResult(_0x432480,_0x21829e))[_0xe041('0x44')](handleError(_0x432480,null));};exports[_0xe041('0x45')]=function(_0x5b2513,_0x54d44d){var _0x1c1e1b={'raw':!![],'where':{'id':_0x5b2513[_0xe041('0x46')]['id']}},_0x5b5c68={};_0x5b5c68[_0xe041('0x2f')]=_[_0xe041('0x47')](db[_0xe041('0x2c')]['rawAttributes']);_0x5b5c68['query']=_[_0xe041('0x47')](_0x5b2513['query']);_0x5b5c68[_0xe041('0x31')]=_[_0xe041('0x32')](_0x5b5c68[_0xe041('0x2f')],_0x5b5c68[_0xe041('0x30')]);_0x1c1e1b[_0xe041('0x34')]=_['intersection'](_0x5b5c68['model'],qs[_0xe041('0x33')](_0x5b2513[_0xe041('0x30')][_0xe041('0x33')]));_0x1c1e1b[_0xe041('0x34')]=_0x1c1e1b[_0xe041('0x34')][_0xe041('0x35')]?_0x1c1e1b[_0xe041('0x34')]:_0x5b5c68[_0xe041('0x2f')];if(_0x5b2513['query'][_0xe041('0x40')]){_0x1c1e1b[_0xe041('0x41')]=[{'all':!![]}];}_0x1c1e1b=_[_0xe041('0x3d')]({},_0x1c1e1b,_0x5b2513[_0xe041('0x3e')]);return db[_0xe041('0x2c')][_0xe041('0x48')](_0x1c1e1b)[_0xe041('0x25')](handleEntityNotFound(_0x54d44d,null))[_0xe041('0x25')](respondWithResult(_0x54d44d,null))[_0xe041('0x44')](handleError(_0x54d44d,null));};exports[_0xe041('0x49')]=function(_0x6a25d3,_0x4e14f8){return db[_0xe041('0x2c')]['create'](_0x6a25d3[_0xe041('0x4a')],{})[_0xe041('0x25')](respondWithResult(_0x4e14f8,0xc9))[_0xe041('0x44')](handleError(_0x4e14f8,null));};exports[_0xe041('0x24')]=function(_0x20af34,_0x1c0773){if(_0x20af34[_0xe041('0x4a')]['id']){delete _0x20af34['body']['id'];}return db[_0xe041('0x2c')][_0xe041('0x48')]({'where':{'id':_0x20af34[_0xe041('0x46')]['id']}})[_0xe041('0x25')](handleEntityNotFound(_0x1c0773,null))[_0xe041('0x25')](saveUpdates(_0x20af34[_0xe041('0x4a')],null))[_0xe041('0x25')](respondWithResult(_0x1c0773,null))[_0xe041('0x44')](handleError(_0x1c0773,null));};exports[_0xe041('0x26')]=function(_0x2de46e,_0xed98da){return db[_0xe041('0x2c')][_0xe041('0x48')]({'where':{'id':_0x2de46e[_0xe041('0x46')]['id']}})[_0xe041('0x25')](handleEntityNotFound(_0xed98da,null))['then'](removeEntity(_0xed98da,null))[_0xe041('0x44')](handleError(_0xed98da,null));};exports[_0xe041('0x4b')]=function(_0x5d8900,_0x4aa84d){return db['WhatsappTransferReport'][_0xe041('0x4b')]()['then'](respondWithResult(_0x4aa84d,null))[_0xe041('0x44')](handleError(_0x4aa84d,null));}; \ No newline at end of file +var _0x2292=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','include','findAll','rows','catch','params','length','includeAll','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x413c74,_0x3dbe7e){var _0x426ecd=function(_0xc3ae9b){while(--_0xc3ae9b){_0x413c74['push'](_0x413c74['shift']());}};_0x426ecd(++_0x3dbe7e);}(_0x2292,0x11e));var _0x2229=function(_0x559e51,_0x2836f7){_0x559e51=_0x559e51-0x0;var _0x3d228c=_0x2292[_0x559e51];return _0x3d228c;};'use strict';var emlformat=require(_0x2229('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2229('0x1'));var jsonpatch=require(_0x2229('0x2'));var rp=require(_0x2229('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2229('0x4'));var util=require(_0x2229('0x5'));var path=require(_0x2229('0x6'));var sox=require(_0x2229('0x7'));var csv=require(_0x2229('0x8'));var ejs=require(_0x2229('0x9'));var fs=require('fs');var fs_extra=require(_0x2229('0xa'));var _=require(_0x2229('0xb'));var squel=require('squel');var crypto=require(_0x2229('0xc'));var jsforce=require(_0x2229('0xd'));var deskjs=require(_0x2229('0xe'));var toCsv=require('to-csv');var querystring=require(_0x2229('0xf'));var Papa=require(_0x2229('0x10'));var Redis=require(_0x2229('0x11'));var authService=require(_0x2229('0x12'));var qs=require(_0x2229('0x13'));var as=require(_0x2229('0x14'));var hardwareService=require(_0x2229('0x15'));var logger=require(_0x2229('0x16'))(_0x2229('0x17'));var utils=require('../../config/utils');var config=require(_0x2229('0x18'));var licenseUtil=require(_0x2229('0x19'));var db=require(_0x2229('0x1a'))['db'];function respondWithStatusCode(_0xc8c2fd,_0x155b8b){_0x155b8b=_0x155b8b||0xcc;return function(_0x2d2929){if(_0x2d2929){return _0xc8c2fd[_0x2229('0x1b')](_0x155b8b);}return _0xc8c2fd[_0x2229('0x1c')](_0x155b8b)[_0x2229('0x1d')]();};}function respondWithResult(_0x2c60a0,_0x5c7820){_0x5c7820=_0x5c7820||0xc8;return function(_0x68f54d){if(_0x68f54d){return _0x2c60a0[_0x2229('0x1c')](_0x5c7820)['json'](_0x68f54d);}};}function respondWithFilteredResult(_0x45fead,_0x5c9a1e){return function(_0xe05734){if(_0xe05734){var _0x56df18=typeof _0x5c9a1e[_0x2229('0x1e')]===_0x2229('0x1f')&&typeof _0x5c9a1e[_0x2229('0x20')]===_0x2229('0x1f');var _0x51c785=_0xe05734[_0x2229('0x21')];var _0x3aa259=_0x56df18?0x0:_0x5c9a1e[_0x2229('0x1e')];var _0x10c342=_0x56df18?_0xe05734[_0x2229('0x21')]:_0x5c9a1e[_0x2229('0x1e')]+_0x5c9a1e[_0x2229('0x20')];var _0x204d63;if(_0x10c342>=_0x51c785){_0x10c342=_0x51c785;_0x204d63=0xc8;}else{_0x204d63=0xce;}_0x45fead[_0x2229('0x1c')](_0x204d63);return _0x45fead[_0x2229('0x22')](_0x2229('0x23'),_0x3aa259+'-'+_0x10c342+'/'+_0x51c785)[_0x2229('0x24')](_0xe05734);}return null;};}function patchUpdates(_0x32033f){return function(_0x4369eb){try{jsonpatch['apply'](_0x4369eb,_0x32033f,!![]);}catch(_0x3694a8){return BPromise['reject'](_0x3694a8);}return _0x4369eb[_0x2229('0x25')]();};}function saveUpdates(_0x4d29ca,_0x27c75c){return function(_0x47d1eb){if(_0x47d1eb){return _0x47d1eb[_0x2229('0x26')](_0x4d29ca)[_0x2229('0x27')](function(_0x1ab22c){return _0x1ab22c;});}return null;};}function removeEntity(_0x31ccac,_0x41a0b1){return function(_0x1ea80f){if(_0x1ea80f){return _0x1ea80f[_0x2229('0x28')]()['then'](function(){_0x31ccac['status'](0xcc)[_0x2229('0x1d')]();});}};}function handleEntityNotFound(_0x97a60b,_0x179a58){return function(_0x5ae9f1){if(!_0x5ae9f1){_0x97a60b[_0x2229('0x1b')](0x194);}return _0x5ae9f1;};}function handleError(_0xbee5d9,_0x29cd2c){_0x29cd2c=_0x29cd2c||0x1f4;return function(_0x31974b){logger['error'](_0x31974b[_0x2229('0x29')]);if(_0x31974b[_0x2229('0x2a')]){delete _0x31974b['name'];}_0xbee5d9[_0x2229('0x1c')](_0x29cd2c)[_0x2229('0x2b')](_0x31974b);};}exports[_0x2229('0x2c')]=function(_0x54bb8d,_0x32945a){var _0x4dbd01={},_0x4ff16b={},_0x44447a={'count':0x0,'rows':[]};var _0x1c11a4=_['map'](db[_0x2229('0x2d')][_0x2229('0x2e')],function(_0x1bf64b){return{'name':_0x1bf64b[_0x2229('0x2f')],'type':_0x1bf64b['type'][_0x2229('0x30')]};});_0x4ff16b[_0x2229('0x31')]=_[_0x2229('0x32')](_0x1c11a4,_0x2229('0x2a'));_0x4ff16b['query']=_[_0x2229('0x33')](_0x54bb8d[_0x2229('0x34')]);_0x4ff16b[_0x2229('0x35')]=_[_0x2229('0x36')](_0x4ff16b[_0x2229('0x31')],_0x4ff16b[_0x2229('0x34')]);_0x4dbd01[_0x2229('0x37')]=_['intersection'](_0x4ff16b[_0x2229('0x31')],qs[_0x2229('0x38')](_0x54bb8d['query'][_0x2229('0x38')]));_0x4dbd01[_0x2229('0x37')]=_0x4dbd01['attributes']['length']?_0x4dbd01[_0x2229('0x37')]:_0x4ff16b['model'];if(!_0x54bb8d[_0x2229('0x34')][_0x2229('0x39')](_0x2229('0x3a'))){_0x4dbd01[_0x2229('0x20')]=qs[_0x2229('0x20')](_0x54bb8d['query']['limit']);_0x4dbd01[_0x2229('0x1e')]=qs[_0x2229('0x1e')](_0x54bb8d[_0x2229('0x34')]['offset']);}_0x4dbd01['order']=qs[_0x2229('0x3b')](_0x54bb8d[_0x2229('0x34')][_0x2229('0x3b')]);_0x4dbd01['where']=qs[_0x2229('0x35')](_[_0x2229('0x3c')](_0x54bb8d['query'],_0x4ff16b[_0x2229('0x35')]),_0x1c11a4);if(_0x54bb8d[_0x2229('0x34')][_0x2229('0x3d')]){_0x4dbd01[_0x2229('0x3e')]=_[_0x2229('0x3f')](_0x4dbd01['where'],{'$or':_[_0x2229('0x32')](_0x1c11a4,function(_0xd75823){if(_0xd75823[_0x2229('0x40')]!=='VIRTUAL'){var _0x2bfb91={};_0x2bfb91[_0xd75823[_0x2229('0x2a')]]={'$like':'%'+_0x54bb8d[_0x2229('0x34')][_0x2229('0x3d')]+'%'};return _0x2bfb91;}})});}_0x4dbd01=_[_0x2229('0x3f')]({},_0x4dbd01,_0x54bb8d['options']);var _0x28a345={'where':_0x4dbd01[_0x2229('0x3e')]};return db[_0x2229('0x2d')][_0x2229('0x21')](_0x28a345)[_0x2229('0x27')](function(_0x56ad78){_0x44447a[_0x2229('0x21')]=_0x56ad78;if(_0x54bb8d[_0x2229('0x34')]['includeAll']){_0x4dbd01[_0x2229('0x41')]=[{'all':!![]}];}return db[_0x2229('0x2d')][_0x2229('0x42')](_0x4dbd01);})[_0x2229('0x27')](function(_0x4a33e6){_0x44447a[_0x2229('0x43')]=_0x4a33e6;return _0x44447a;})[_0x2229('0x27')](respondWithFilteredResult(_0x32945a,_0x4dbd01))[_0x2229('0x44')](handleError(_0x32945a,null));};exports['show']=function(_0x311e9a,_0x2b7c55){var _0x5ad35c={'raw':!![],'where':{'id':_0x311e9a[_0x2229('0x45')]['id']}},_0x12a620={};_0x12a620[_0x2229('0x31')]=_[_0x2229('0x33')](db[_0x2229('0x2d')]['rawAttributes']);_0x12a620[_0x2229('0x34')]=_[_0x2229('0x33')](_0x311e9a[_0x2229('0x34')]);_0x12a620['filters']=_[_0x2229('0x36')](_0x12a620[_0x2229('0x31')],_0x12a620[_0x2229('0x34')]);_0x5ad35c[_0x2229('0x37')]=_[_0x2229('0x36')](_0x12a620['model'],qs[_0x2229('0x38')](_0x311e9a[_0x2229('0x34')]['fields']));_0x5ad35c[_0x2229('0x37')]=_0x5ad35c[_0x2229('0x37')][_0x2229('0x46')]?_0x5ad35c[_0x2229('0x37')]:_0x12a620[_0x2229('0x31')];if(_0x311e9a[_0x2229('0x34')][_0x2229('0x47')]){_0x5ad35c['include']=[{'all':!![]}];}_0x5ad35c=_[_0x2229('0x3f')]({},_0x5ad35c,_0x311e9a[_0x2229('0x48')]);return db[_0x2229('0x2d')][_0x2229('0x49')](_0x5ad35c)[_0x2229('0x27')](handleEntityNotFound(_0x2b7c55,null))['then'](respondWithResult(_0x2b7c55,null))[_0x2229('0x44')](handleError(_0x2b7c55,null));};exports['create']=function(_0x15574d,_0x3a67f5){return db['WhatsappTransferReport'][_0x2229('0x4a')](_0x15574d[_0x2229('0x4b')],{})[_0x2229('0x27')](respondWithResult(_0x3a67f5,0xc9))[_0x2229('0x44')](handleError(_0x3a67f5,null));};exports[_0x2229('0x26')]=function(_0x4a1b70,_0x4d7e2c){if(_0x4a1b70[_0x2229('0x4b')]['id']){delete _0x4a1b70[_0x2229('0x4b')]['id'];}return db[_0x2229('0x2d')][_0x2229('0x49')]({'where':{'id':_0x4a1b70[_0x2229('0x45')]['id']}})[_0x2229('0x27')](handleEntityNotFound(_0x4d7e2c,null))['then'](saveUpdates(_0x4a1b70['body'],null))[_0x2229('0x27')](respondWithResult(_0x4d7e2c,null))[_0x2229('0x44')](handleError(_0x4d7e2c,null));};exports[_0x2229('0x28')]=function(_0x4d575b,_0x2b6f95){return db[_0x2229('0x2d')][_0x2229('0x49')]({'where':{'id':_0x4d575b[_0x2229('0x45')]['id']}})[_0x2229('0x27')](handleEntityNotFound(_0x2b6f95,null))['then'](removeEntity(_0x2b6f95,null))[_0x2229('0x44')](handleError(_0x2b6f95,null));};exports[_0x2229('0x4c')]=function(_0x728837,_0x1871ab){return db[_0x2229('0x2d')][_0x2229('0x4c')]()[_0x2229('0x27')](respondWithResult(_0x1871ab,null))[_0x2229('0x44')](handleError(_0x1871ab,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 8b905dc..38a3141 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 _0xc70a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2966f6,_0x9550cd){var _0x36c4b3=function(_0x20bab4){while(--_0x20bab4){_0x2966f6['push'](_0x2966f6['shift']());}};_0x36c4b3(++_0x9550cd);}(_0xc70a,0x1cb));var _0xac70=function(_0x211695,_0x53d57c){_0x211695=_0x211695-0x0;var _0x4c1a75=_0xc70a[_0x211695];return _0x4c1a75;};'use strict';var _=require(_0xac70('0x0'));var util=require(_0xac70('0x1'));var logger=require(_0xac70('0x2'))(_0xac70('0x3'));var moment=require(_0xac70('0x4'));var BPromise=require(_0xac70('0x5'));var rp=require(_0xac70('0x6'));var fs=require('fs');var path=require(_0xac70('0x7'));var rimraf=require(_0xac70('0x8'));var config=require(_0xac70('0x9'));var attributes=require('./whatsappTransferReport.attributes');module[_0xac70('0xa')]=function(_0x590368,_0x16aa7c){return _0x590368['define'](_0xac70('0xb'),attributes,{'tableName':_0xac70('0xc'),'paranoid':![],'indexes':[{'name':_0xac70('0xd'),'fields':[_0xac70('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88c8=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x88c8,0x1df));var _0x888c=function(_0x24e8f1,_0x27ff55){_0x24e8f1=_0x24e8f1-0x0;var _0x5a5905=_0x88c8[_0x24e8f1];return _0x5a5905;};'use strict';var _=require(_0x888c('0x0'));var util=require(_0x888c('0x1'));var logger=require(_0x888c('0x2'))(_0x888c('0x3'));var moment=require(_0x888c('0x4'));var BPromise=require(_0x888c('0x5'));var rp=require(_0x888c('0x6'));var fs=require('fs');var path=require(_0x888c('0x7'));var rimraf=require(_0x888c('0x8'));var config=require('../../config/environment');var attributes=require(_0x888c('0x9'));module[_0x888c('0xa')]=function(_0x1d243d,_0x40f761){return _0x1d243d['define']('WhatsappTransferReport',attributes,{'tableName':_0x888c('0xb'),'paranoid':![],'indexes':[{'name':_0x888c('0xc'),'fields':[_0x888c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index b6e33ea..2973bbc 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 _0xa406=['stringify','error','code','message','result','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0xd5709b,_0x101823){var _0x3dc484=function(_0x28a409){while(--_0x28a409){_0xd5709b['push'](_0xd5709b['shift']());}};_0x3dc484(++_0x101823);}(_0xa406,0xfc));var _0x6a40=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa406[_0x19e35c];return _0x3e1fe8;};'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(_0x6a40('0x0'));var db=require(_0x6a40('0x1'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a40('0x2'))(_0x6a40('0x3'));var config=require(_0x6a40('0x4'));var jayson=require(_0x6a40('0x5'));var client=jayson[_0x6a40('0x6')][_0x6a40('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bd5e9,_0x1693c7,_0x3c9074){return new BPromise(function(_0x58cf53,_0x14d73b){return client[_0x6a40('0x8')](_0x1bd5e9,_0x3c9074)[_0x6a40('0x9')](function(_0x53cfd5){logger[_0x6a40('0xa')](_0x6a40('0xb'),_0x1693c7,_0x6a40('0xc'));logger['debug'](_0x6a40('0xd'),_0x1693c7,_0x6a40('0xc'),JSON[_0x6a40('0xe')](_0x53cfd5));if(_0x53cfd5['error']){if(_0x53cfd5[_0x6a40('0xf')][_0x6a40('0x10')]===0x1f4){logger[_0x6a40('0xf')](_0x6a40('0xb'),_0x1693c7,_0x53cfd5[_0x6a40('0xf')][_0x6a40('0x11')]);return _0x14d73b(_0x53cfd5[_0x6a40('0xf')][_0x6a40('0x11')]);}logger[_0x6a40('0xf')]('WhatsappTransferReport,\x20%s,\x20%s',_0x1693c7,_0x53cfd5[_0x6a40('0xf')]['message']);return _0x58cf53(_0x53cfd5[_0x6a40('0xf')][_0x6a40('0x11')]);}else{logger['info'](_0x6a40('0xb'),_0x1693c7,_0x6a40('0xc'));_0x58cf53(_0x53cfd5[_0x6a40('0x12')][_0x6a40('0x11')]);}})['catch'](function(_0x2484ec){logger[_0x6a40('0xf')](_0x6a40('0xb'),_0x1693c7,_0x2484ec);_0x14d73b(_0x2484ec);});});} \ No newline at end of file +var _0xf7fc=['debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3bc834,_0x55f0ae){var _0x3a18aa=function(_0x41a10b){while(--_0x41a10b){_0x3bc834['push'](_0x3bc834['shift']());}};_0x3a18aa(++_0x55f0ae);}(_0xf7fc,0x1d0));var _0xcf7f=function(_0x4b58dc,_0x5aeca5){_0x4b58dc=_0x4b58dc-0x0;var _0x3a1fe6=_0xf7fc[_0x4b58dc];return _0x3a1fe6;};'use strict';var _=require(_0xcf7f('0x0'));var util=require('util');var moment=require(_0xcf7f('0x1'));var BPromise=require(_0xcf7f('0x2'));var rs=require(_0xcf7f('0x3'));var fs=require('fs');var Redis=require(_0xcf7f('0x4'));var db=require(_0xcf7f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf7f('0x6'))(_0xcf7f('0x7'));var config=require(_0xcf7f('0x8'));var jayson=require(_0xcf7f('0x9'));var client=jayson[_0xcf7f('0xa')][_0xcf7f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x104269,_0x53a31b,_0x58181f){return new BPromise(function(_0x375729,_0x391f7f){return client['request'](_0x104269,_0x58181f)[_0xcf7f('0xc')](function(_0x4343e6){logger[_0xcf7f('0xd')](_0xcf7f('0xe'),_0x53a31b,_0xcf7f('0xf'));logger[_0xcf7f('0x10')](_0xcf7f('0x11'),_0x53a31b,_0xcf7f('0xf'),JSON[_0xcf7f('0x12')](_0x4343e6));if(_0x4343e6[_0xcf7f('0x13')]){if(_0x4343e6[_0xcf7f('0x13')][_0xcf7f('0x14')]===0x1f4){logger[_0xcf7f('0x13')](_0xcf7f('0xe'),_0x53a31b,_0x4343e6[_0xcf7f('0x13')][_0xcf7f('0x15')]);return _0x391f7f(_0x4343e6[_0xcf7f('0x13')][_0xcf7f('0x15')]);}logger[_0xcf7f('0x13')](_0xcf7f('0xe'),_0x53a31b,_0x4343e6[_0xcf7f('0x13')][_0xcf7f('0x15')]);return _0x375729(_0x4343e6[_0xcf7f('0x13')]['message']);}else{logger[_0xcf7f('0xd')]('WhatsappTransferReport,\x20%s,\x20%s',_0x53a31b,_0xcf7f('0xf'));_0x375729(_0x4343e6[_0xcf7f('0x16')]['message']);}})[_0xcf7f('0x17')](function(_0x34c8d2){logger[_0xcf7f('0x13')](_0xcf7f('0xe'),_0x53a31b,_0x34c8d2);_0x391f7f(_0x34c8d2);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 91099e3..1f9b089 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3dd6=['online','join','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','seedDB','default','then','info','start','filter','exitCode','length','map','pm2_env','name','Online\x20apps:'];(function(_0x4b9617,_0x1bdf76){var _0x5f04ab=function(_0x5c0dee){while(--_0x5c0dee){_0x4b9617['push'](_0x4b9617['shift']());}};_0x5f04ab(++_0x1bdf76);}(_0x3dd6,0xcf));var _0x63dd=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x3dd6[_0x53abe5];return _0xc1c37e;};'use strict';var _=require('lodash');var db=require('./mysqldb')['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x63dd('0x0'));var rpc=require(_0x63dd('0x1'));var config=require(_0x63dd('0x2'));var logger=require(_0x63dd('0x3'))(_0x63dd('0x4'));var pm2=require(_0x63dd('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x63dd('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x63dd('0x7'));var transcribe=require(_0x63dd('0x8'));var provider=require(_0x63dd('0x9'));function main(){return db[_0x63dd('0xa')][_0x63dd('0xb')]()['then'](function(){if(config[_0x63dd('0xc')]){return seedDb[_0x63dd('0xd')]();}})[_0x63dd('0xe')](function(){return checkLicense[_0x63dd('0xd')]();})['then'](function(){return rpc['listen']();})[_0x63dd('0xe')](function(_0x1508c4){logger[_0x63dd('0xf')](_0x1508c4);return chat[_0x63dd('0x10')]();})[_0x63dd('0xe')](function(){return whatsapp['start']();})[_0x63dd('0xe')](function(){return schedule[_0x63dd('0x10')]();})[_0x63dd('0xe')](function(){return transcribe[_0x63dd('0x10')]();})['then'](function(){return provider[_0x63dd('0x10')]();})[_0x63dd('0xe')](function(_0x3ed4ea){logger[_0x63dd('0xf')](_0x3ed4ea);return pm2[_0x63dd('0x10')](pm2Config);})[_0x63dd('0xe')](function(_0x56c030){var _0x5b2f9f=_0x56c030[_0x63dd('0x11')](function(_0xa6ffcf){return typeof _0xa6ffcf[_0x63dd('0x12')]==='number'&&_0xa6ffcf[_0x63dd('0x12')]>=0x0;});if(_0x5b2f9f[_0x63dd('0x13')]>0x0){throw new Error(_0x5b2f9f[_0x63dd('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x63dd('0x14')](_0x5b2f9f,function(_0x368f85){return'\x22'+_0x368f85[_0x63dd('0x15')][_0x63dd('0x16')]+'\x22';}));}logger[_0x63dd('0xf')](_0x63dd('0x17'),_[_0x63dd('0x14')](_[_0x63dd('0x11')](_0x56c030,{'status':_0x63dd('0x18')}),_0x63dd('0x16'))[_0x63dd('0x19')]());logger[_0x63dd('0xf')]('Offline\x20apps:',_[_0x63dd('0x14')](_['filter'](_0x56c030,function(_0x466dac){return _0x466dac[_0x63dd('0x1a')]!==_0x63dd('0x18');}),'name')[_0x63dd('0x19')]()||_0x63dd('0x1b'));console[_0x63dd('0x1c')](_0x63dd('0x1d'));})[_0x63dd('0x1e')](function(_0x147928){console[_0x63dd('0x1c')](_0x63dd('0x1f'),_0x147928);logger[_0x63dd('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x147928);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x1a28=['./config/license','./rpc','./config/environment','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB'];(function(_0x2d05fa,_0x16fe4e){var _0x4fc9b7=function(_0x4d193c){while(--_0x4d193c){_0x2d05fa['push'](_0x2d05fa['shift']());}};_0x4fc9b7(++_0x16fe4e);}(_0x1a28,0x10e));var _0x81a2=function(_0x4bd06e,_0x593701){_0x4bd06e=_0x4bd06e-0x0;var _0x85ebb=_0x1a28[_0x4bd06e];return _0x85ebb;};'use strict';var _=require(_0x81a2('0x0'));var db=require(_0x81a2('0x1'))['db'];var seedDb=require(_0x81a2('0x2'));var checkLicense=require(_0x81a2('0x3'));var rpc=require(_0x81a2('0x4'));var config=require(_0x81a2('0x5'));var logger=require('./config/logger')('app');var pm2=require(_0x81a2('0x6'));var pm2Config=require(_0x81a2('0x7'));var schedule=require(_0x81a2('0x8'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x81a2('0x9'));var transcribe=require(_0x81a2('0xa'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x81a2('0xb')][_0x81a2('0xc')]()[_0x81a2('0xd')](function(){if(config[_0x81a2('0xe')]){return seedDb[_0x81a2('0xf')]();}})[_0x81a2('0xd')](function(){return checkLicense[_0x81a2('0xf')]();})[_0x81a2('0xd')](function(){return rpc[_0x81a2('0x10')]();})['then'](function(_0x19f67a){logger[_0x81a2('0x11')](_0x19f67a);return chat[_0x81a2('0x12')]();})[_0x81a2('0xd')](function(){return whatsapp[_0x81a2('0x12')]();})['then'](function(){return schedule[_0x81a2('0x12')]();})[_0x81a2('0xd')](function(){return transcribe[_0x81a2('0x12')]();})[_0x81a2('0xd')](function(){return provider[_0x81a2('0x12')]();})[_0x81a2('0xd')](function(_0x2c7724){logger[_0x81a2('0x11')](_0x2c7724);return pm2['start'](pm2Config);})[_0x81a2('0xd')](function(_0x58ce36){var _0x22290b=_0x58ce36[_0x81a2('0x13')](function(_0x5887a7){return typeof _0x5887a7[_0x81a2('0x14')]==='number'&&_0x5887a7[_0x81a2('0x14')]>=0x0;});if(_0x22290b[_0x81a2('0x15')]>0x0){throw new Error(_0x22290b[_0x81a2('0x15')]+_0x81a2('0x16')+_[_0x81a2('0x17')](_0x22290b,function(_0x3b39b2){return'\x22'+_0x3b39b2[_0x81a2('0x18')][_0x81a2('0x19')]+'\x22';}));}logger['info'](_0x81a2('0x1a'),_[_0x81a2('0x17')](_[_0x81a2('0x13')](_0x58ce36,{'status':_0x81a2('0x1b')}),_0x81a2('0x19'))[_0x81a2('0x1c')]());logger[_0x81a2('0x11')](_0x81a2('0x1d'),_[_0x81a2('0x17')](_[_0x81a2('0x13')](_0x58ce36,function(_0x5e1436){return _0x5e1436[_0x81a2('0x1e')]!=='online';}),'name')[_0x81a2('0x1c')]()||_0x81a2('0x1f'));console['log'](_0x81a2('0x20'));})[_0x81a2('0x21')](function(_0x2db7c9){console[_0x81a2('0x22')](_0x81a2('0x23'),_0x2db7c9);logger[_0x81a2('0x24')](_0x81a2('0x25'),_0x2db7c9);process[_0x81a2('0x26')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 509d703..98bc99f 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 _0xed3c=['join','promisify','sign','secret','secrets','session','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','crypto','bluebird','util','moment','fullname','userpic','permissions','md5secret','voicePause','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','findOne','params','disposition','then','closed','unmanaged','json','catch','isAuthenticated','headers','authorization','startsWith','User','find','name','authenticate','pass','status','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','blockDuration','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','minutes','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','generateApiKey','apiKeyIat','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','splice','unshift','encryptString'];(function(_0x572926,_0x513114){var _0x1ddbc0=function(_0x227178){while(--_0x227178){_0x572926['push'](_0x572926['shift']());}};_0x1ddbc0(++_0x513114);}(_0xed3c,0x1a6));var _0xced3=function(_0x10a1ac,_0x25f5b0){_0x10a1ac=_0x10a1ac-0x0;var _0x45b99e=_0xed3c[_0x10a1ac];return _0x45b99e;};'use strict';var db=require(_0xced3('0x0'))['db'];var config=require(_0xced3('0x1'));var hardwareConf=require(_0xced3('0x2'));var licenseUtil=require(_0xced3('0x3'));var encryptor=require('../encryptor');var _=require(_0xced3('0x4'));var jwt=require(_0xced3('0x5'));var expressJwt=require(_0xced3('0x6'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0xced3('0x7'));var BPromise=require(_0xced3('0x8'));var util=require(_0xced3('0x9'));var moment=require(_0xced3('0xa'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id','role',_0xced3('0xb'),'name','internal','email',_0xced3('0xc'),_0xced3('0xd'),_0xced3('0xe'),_0xced3('0xf'),_0xced3('0x10'),'mailPause',_0xced3('0x11'),_0xced3('0x12'),_0xced3('0x13'),'pauseType',_0xced3('0x14'),_0xced3('0x15'),_0xced3('0x16'),_0xced3('0x17'),_0xced3('0x18'),_0xced3('0x19'),_0xced3('0x1a'),'phoneBarAutoAnswer',_0xced3('0x1b'),'phoneBarDnd',_0xced3('0x1c'),_0xced3('0x1d'),_0xced3('0x1e'),_0xced3('0x1f'),'phoneBarPrefixRequired',_0xced3('0x20'),_0xced3('0x21'),'hotdesk',_0xced3('0x22'),_0xced3('0x23'),_0xced3('0x24'),_0xced3('0x25'),'wssPort',_0xced3('0x26'),'downloadOmnichannelInteractions',_0xced3('0x27'),_0xced3('0x28'),_0xced3('0x29'),_0xced3('0x2a'),_0xced3('0x2b'),_0xced3('0x2c'),_0xced3('0x2d'),_0xced3('0x2e'),_0xced3('0x2f'),_0xced3('0x30'),_0xced3('0x31'),'faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0xced3('0x32'),_0xced3('0x33')];exports[_0xced3('0x34')]=function(){return this['isAuthenticated'](!![])[_0xced3('0x35')](function(_0x30d984,_0x526854,_0x559fa2){if(_0x30d984[_0xced3('0x36')]){_0x559fa2();}else{return db[_0xced3('0x37')][_0xced3('0x38')]({'where':{'id':_0x30d984[_0xced3('0x39')]['id']},'attributes':['id','closed',_0xced3('0x3a')],'raw':!![]})[_0xced3('0x3b')](function(_0x4fc285){if(_0x4fc285&&_0x4fc285[_0xced3('0x3c')]){return _0x526854['status'](_0x4fc285[_0xced3('0x3a')]===_0xced3('0x3d')?0x195:0x193)[_0xced3('0x3e')]({'message':_0x4fc285[_0xced3('0x3a')]===_0xced3('0x3d')?'Unmanaged.':'Forbidden.'});}else{_0x559fa2();}})[_0xced3('0x3f')](function(_0x5bb425){_0x559fa2(_0x5bb425);});}});};exports[_0xced3('0x40')]=function isAuthenticated(_0x1e6923){return compose()['use'](function(_0x3db664,_0x4024fa,_0x196956){var _0x1032d6;if(_0x3db664[_0xced3('0x41')][_0xced3('0x42')]){if(_[_0xced3('0x43')](_0x3db664[_0xced3('0x41')][_0xced3('0x42')],'Basic')){var _0xa78899=basicAuth(_0x3db664);db[_0xced3('0x44')][_0xced3('0x45')]({'where':{'name':_0xa78899[_0xced3('0x46')]}})[_0xced3('0x3b')](function(_0x21e4a2){if(!_0x21e4a2||!_0x21e4a2[_0xced3('0x47')](_0xa78899[_0xced3('0x48')])){return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x4a')});}_0x3db664[_0xced3('0x36')]={'id':_0x21e4a2['id']};_0x196956();})[_0xced3('0x3f')](function(_0x407a24){_0x196956(_0x407a24);});}else if(_[_0xced3('0x43')](_0x3db664[_0xced3('0x41')][_0xced3('0x42')],_0xced3('0x4b'))){validateJwt(_0x3db664,_0x4024fa,_0x196956);}else{if(_0x1e6923){_0x196956();}else{return _0x4024fa[_0xced3('0x49')](0x193)[_0xced3('0x3e')]({'message':_0xced3('0x4c')});}}}else if(_0x3db664['query'][_0xced3('0x4d')]){try{var _0x55e3ac={'audience':hardwareConf[_0xced3('0x4e')](),'issuer':hardwareConf[_0xced3('0x4e')]()};verifyJwt(_0x3db664[_0xced3('0x4f')][_0xced3('0x4d')],_0x55e3ac)[_0xced3('0x3b')](function(_0xefac3d){return db[_0xced3('0x44')][_0xced3('0x45')]({'where':{'id':_0xefac3d[_0xced3('0x50')]}})[_0xced3('0x3b')](function(_0x5c290d){_0x1032d6=_0x5c290d;return db[_0xced3('0x51')][_0xced3('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xced3('0x52')],'raw':!![]});})[_0xced3('0x3b')](function(_0x1b5956){if(!_0x1032d6||!_['isEqual'](_0x1032d6['apiKeyNonce'],_0xefac3d[_0xced3('0x53')])){return _0x4024fa['status'](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x54')});}if(_0x1032d6['disabled']){return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x55')});}if(_0x1032d6['blocked']){if(_0x1b5956[_0xced3('0x52')]>0x0){if(moment(_0x1032d6['blockedAt'])['add'](_0x1b5956[_0xced3('0x52')],_0xced3('0x56'))>moment()){return _0x4024fa[_0xced3('0x49')](0x191)['json']({'message':_0xced3('0x55')});}}else{return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x55')});}}_0x3db664[_0xced3('0x36')]={'id':_0x1032d6['id']};_0x196956();});})[_0xced3('0x3f')](function(){return _0x4024fa[_0xced3('0x49')](0x191)[_0xced3('0x3e')]({'message':_0xced3('0x55')});});}catch(_0x3eca11){_0x196956(_0x3eca11);}}else if(_0x1e6923){_0x196956();}else{return _0x4024fa[_0xced3('0x49')](0x193)[_0xced3('0x3e')]({'message':_0xced3('0x4c')});}})[_0xced3('0x35')](function(_0x1ced3a,_0x489546,_0x4279a3){if(_0x1ced3a[_0xced3('0x36')]){db[_0xced3('0x44')][_0xced3('0x45')]({'where':{'id':_0x1ced3a[_0xced3('0x36')]['id']},'attributes':userAttributes})[_0xced3('0x3b')](function(_0x145157){if(!_0x145157){return _0x489546[_0xced3('0x49')](0x194)[_0xced3('0x3e')]({'message':'User\x20not\x20found.'});}_0x1ced3a[_0xced3('0x36')]=_0x145157;_0x4279a3();})['catch'](function(_0x5f4599){_0x4279a3(_0x5f4599);});}else if(_0x1e6923){_0x4279a3();}else{return _0x489546[_0xced3('0x49')](0x194)[_0xced3('0x3e')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xced3('0x57')]=function canUpdate(){return compose()[_0xced3('0x35')](function(_0x3569f3,_0x26b8ac,_0x5373ab){return licenseUtil[_0xced3('0x58')]()[_0xced3('0x3b')](function(_0xbf8cbc){if(_0xbf8cbc[_0xced3('0x59')]){_0x5373ab();}else{return _0x26b8ac[_0xced3('0x49')](0x193)['json']({'message':_0xced3('0x5a')});}})[_0xced3('0x3f')](function(_0x1dced4){_0x5373ab(_0x1dced4);});});};exports[_0xced3('0x5b')]=function isWebrtcLicence(){return compose()[_0xced3('0x35')](function(_0x740743,_0x3fa9fd,_0x532db9){return licenseUtil[_0xced3('0x58')]()[_0xced3('0x3b')](function(_0x4804e3){if(_0x4804e3['webrtc']){_0x532db9();}else{return _0x3fa9fd[_0xced3('0x49')](0x193)['json']({'message':_0xced3('0x5a')});}})[_0xced3('0x3f')](function(_0x33441c){_0x532db9(_0x33441c);});});};exports[_0xced3('0x5c')]=function(_0x2c70e3,_0x1b3396,_0x3700ed){_0x2c70e3[_0xced3('0x5c')]=!![];return _0x3700ed();};exports[_0xced3('0x5d')]=function signToken(_0x5b3529){return signJwt(_0x5b3529);};exports[_0xced3('0x5e')]=function(_0x8df206,_0x2aa876){if(!_0x8df206[_0xced3('0x36')]){return _0x2aa876[_0xced3('0x49')](0x194)[_0xced3('0x3e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x420b90={'payload':{'id':_0x8df206[_0xced3('0x36')]['id'],'role':_0x8df206[_0xced3('0x36')][_0xced3('0x5f')]},'options':{'expiresIn':0x15180}};return signJwt(_0x420b90)[_0xced3('0x3b')](function(_0x14dbfe){_0x2aa876[_0xced3('0x60')](_0xced3('0x61'),_0x14dbfe);_0x2aa876[_0xced3('0x62')](_0xced3('0x63'));})[_0xced3('0x3f')](function(_0x3e2a19){return _0x2aa876['status'](0x1f4)[_0xced3('0x64')](_0x3e2a19);});};exports['retrieveApiKey']=function(_0x466ffb){if(_[_0xced3('0x65')](_0x466ffb[_0xced3('0x66')])||_['isNil'](_0x466ffb['apiKeyIat'])){return null;}else{return createJwt(_0x466ffb);}};exports[_0xced3('0x67')]=function(_0x219a11){_0x219a11['apiKeyNonce']=generateNonce();_0x219a11[_0xced3('0x68')]=generateIssuedAt();return createJwt(_0x219a11);};exports['regenerateApiKey']=function(_0x3dba69,_0x3f9582){var _0x4f1860=_0x3dba69[_0xced3('0x4f')][_0xced3('0x4d')];if(_0x4f1860){var _0xf4d7bf={'nonce':_0x3f9582['apiKeyNonce'],'iat':_0x3f9582[_0xced3('0x68')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xced3('0x4e')]()};return verifyJwt(_0x4f1860,_0xf4d7bf)[_0xced3('0x3b')](function(){return generateApiKey(_0x3f9582);});}else{throw{'message':_0xced3('0x69')};}};exports[_0xced3('0x6a')]=function(_0x1c17a8){var _0xd3c7b9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xd3c7b9[_0xced3('0x6b')](_0x1c17a8))throw new db[(_0xced3('0x6c'))][(_0xced3('0x6d'))](_0xced3('0x6e'));return;};exports[_0xced3('0x6f')]=function(_0x4b14dd,_0x3859e8,_0x3de35d){var _0x40a2a2=encryptor[_0xced3('0x70')](_0x3859e8)[_0xced3('0x71')](',');for(var _0xbad036=0x0;_0xbad036<_0x3de35d;_0xbad036++){if(!_0x40a2a2[_0xbad036])break;if(_0x4b14dd['toLowerCase']()===_0x40a2a2[_0xbad036][_0xced3('0x72')]()){var _0x171081=util[_0xced3('0x73')](_0xced3('0x74'),_0x3de35d);if(_0x3de35d===0x1){_0x171081=_0xced3('0x75');}throw new db[(_0xced3('0x6c'))]['ValidationError'](_0x171081);}}return;};exports[_0xced3('0x76')]=function(_0x53844d,_0xc0cd87){var _0x5d9813=_0xc0cd87?encryptor[_0xced3('0x70')](_0xc0cd87)[_0xced3('0x71')](','):[];if(_0x5d9813['length']===0x5){_0x5d9813[_0xced3('0x77')](-0x1,0x1);}_0x5d9813[_0xced3('0x78')](_0x53844d);return encryptor[_0xced3('0x79')](_0x5d9813[_0xced3('0x7a')](','));};function signJwt(_0x1ec94b){var _0x21eeec=BPromise[_0xced3('0x7b')](jwt[_0xced3('0x7c')],{'context':jwt});var _0x18fe01=_0x1ec94b[_0xced3('0x7d')]||config[_0xced3('0x7e')][_0xced3('0x7f')];return new BPromise(function(_0x38033f,_0x4dea99){_0x21eeec(_0x1ec94b[_0xced3('0x80')],_0x18fe01,_0x1ec94b[_0xced3('0x81')])[_0xced3('0x3b')](function(_0x353a8e){_0x38033f(_0x353a8e);})['catch'](function(_0x463ca4){_0x4dea99(_0x463ca4);});});}function verifyJwt(_0x979b24,_0x404241,_0x373f31){var _0x2a62f5=BPromise[_0xced3('0x7b')](jwt[_0xced3('0x82')],{'context':jwt});var _0x4df923=_0x373f31||config[_0xced3('0x7e')][_0xced3('0x7f')];return new BPromise(function(_0x5db4eb,_0x1630d7){_0x2a62f5(_0x979b24,_0x4df923,_0x404241)[_0xced3('0x3b')](function(_0x3a9dac){_0x5db4eb(_0x3a9dac);})[_0xced3('0x3f')](function(_0x58d7fc){_0x1630d7(_0x58d7fc);});});}function generateNonce(){return crypto[_0xced3('0x83')](0x10)[_0xced3('0x84')](_0xced3('0x85'));}function generateIssuedAt(){return Math[_0xced3('0x86')](Date[_0xced3('0x87')]()/0x3e8)[_0xced3('0x84')]();}function createJwt(_0x236445){var _0x3ad0e7={'payload':{'iat':_0x236445[_0xced3('0x68')],'nonce':_0x236445[_0xced3('0x66')]},'options':{'algorithm':'HS512','subject':_0x236445['id'][_0xced3('0x84')](),'issuer':hardwareConf[_0xced3('0x4e')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x3ad0e7)['then'](function(_0xbec2b7){return{'iat':_0x236445['apiKeyIat'],'nonce':_0x236445[_0xced3('0x66')],'token':_0xbec2b7};});} \ No newline at end of file +var _0xf4f4=['isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','User','find','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','payload','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x50bcaf,_0xb5649){var _0x11bb42=function(_0xe9b0e9){while(--_0xe9b0e9){_0x50bcaf['push'](_0x50bcaf['shift']());}};_0x11bb42(++_0xb5649);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x295994,_0x2c24d0){_0x295994=_0x295994-0x0;var _0x5ad90d=_0xf4f4[_0x295994];return _0x5ad90d;};'use strict';var db=require(_0x4f4f('0x0'))['db'];var config=require(_0x4f4f('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x4f4f('0x2'));var encryptor=require(_0x4f4f('0x3'));var _=require(_0x4f4f('0x4'));var jwt=require(_0x4f4f('0x5'));var expressJwt=require(_0x4f4f('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x4f4f('0x7'));var crypto=require('crypto');var BPromise=require(_0x4f4f('0x8'));var util=require(_0x4f4f('0x9'));var moment=require(_0x4f4f('0xa'));var validateJwt=expressJwt({'secret':config[_0x4f4f('0xb')][_0x4f4f('0xc')]});var userAttributes=['id',_0x4f4f('0xd'),_0x4f4f('0xe'),_0x4f4f('0xf'),'internal',_0x4f4f('0x10'),_0x4f4f('0x11'),_0x4f4f('0x12'),_0x4f4f('0x13'),_0x4f4f('0x14'),_0x4f4f('0x15'),_0x4f4f('0x16'),_0x4f4f('0x17'),'smsPause','openchannelPause',_0x4f4f('0x18'),_0x4f4f('0x19'),_0x4f4f('0x1a'),_0x4f4f('0x1b'),_0x4f4f('0x1c'),_0x4f4f('0x1d'),'passwordResetAt',_0x4f4f('0x1e'),'phoneBarAutoAnswer',_0x4f4f('0x1f'),_0x4f4f('0x20'),_0x4f4f('0x21'),_0x4f4f('0x22'),'phoneBarEnableSettings',_0x4f4f('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x4f4f('0x24'),_0x4f4f('0x25'),_0x4f4f('0x26'),_0x4f4f('0x27'),_0x4f4f('0x28'),_0x4f4f('0x29'),_0x4f4f('0x2a'),_0x4f4f('0x2b'),_0x4f4f('0x2c'),_0x4f4f('0x2d'),_0x4f4f('0x2e'),_0x4f4f('0x2f'),'chatAutoanswerDelay',_0x4f4f('0x30'),_0x4f4f('0x31'),_0x4f4f('0x32'),_0x4f4f('0x33'),_0x4f4f('0x34'),_0x4f4f('0x35'),_0x4f4f('0x36'),_0x4f4f('0x37'),_0x4f4f('0x38'),_0x4f4f('0x39'),_0x4f4f('0x3a')];exports[_0x4f4f('0x3b')]=function(){return this[_0x4f4f('0x3c')](!![])[_0x4f4f('0x3d')](function(_0x5bda88,_0x4f7261,_0x525529){if(_0x5bda88[_0x4f4f('0x3e')]){_0x525529();}else{return db[_0x4f4f('0x3f')]['findOne']({'where':{'id':_0x5bda88[_0x4f4f('0x40')]['id']},'attributes':['id',_0x4f4f('0x41'),_0x4f4f('0x42')],'raw':!![]})[_0x4f4f('0x43')](function(_0x113ff7){if(_0x113ff7&&_0x113ff7[_0x4f4f('0x41')]){return _0x4f7261[_0x4f4f('0x44')](_0x113ff7['disposition']===_0x4f4f('0x45')?0x195:0x193)[_0x4f4f('0x46')]({'message':_0x113ff7[_0x4f4f('0x42')]===_0x4f4f('0x45')?_0x4f4f('0x47'):'Forbidden.'});}else{_0x525529();}})[_0x4f4f('0x48')](function(_0xaf3de1){_0x525529(_0xaf3de1);});}});};exports[_0x4f4f('0x3c')]=function isAuthenticated(_0x5deda9){return compose()['use'](function(_0x4c2490,_0x73b8bb,_0x5b4f6a){var _0x354266;if(_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')]){if(_['startsWith'](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],'Basic')){var _0x413b71=basicAuth(_0x4c2490);db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'name':_0x413b71['name']}})[_0x4f4f('0x43')](function(_0x343c75){if(!_0x343c75||!_0x343c75['authenticate'](_0x413b71['pass'])){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x4d')});}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x343c75['id']};_0x5b4f6a();})[_0x4f4f('0x48')](function(_0x8d0f53){_0x5b4f6a(_0x8d0f53);});}else if(_[_0x4f4f('0x4e')](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],_0x4f4f('0x4f'))){validateJwt(_0x4c2490,_0x73b8bb,_0x5b4f6a);}else{if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)['json']({'message':_0x4f4f('0x50')});}}}else if(_0x4c2490['query'][_0x4f4f('0x51')]){try{var _0x423c89={'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};verifyJwt(_0x4c2490[_0x4f4f('0x53')][_0x4f4f('0x51')],_0x423c89)[_0x4f4f('0x43')](function(_0x24834a){return db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'id':_0x24834a[_0x4f4f('0x54')]}})[_0x4f4f('0x43')](function(_0x492fac){_0x354266=_0x492fac;return db[_0x4f4f('0x55')][_0x4f4f('0x56')]({'where':{'id':0x1},'attributes':[_0x4f4f('0x57'),_0x4f4f('0x58')],'raw':!![]});})[_0x4f4f('0x43')](function(_0x34fe84){if(!_0x354266||!_[_0x4f4f('0x59')](_0x354266[_0x4f4f('0x5a')],_0x24834a[_0x4f4f('0x5b')])){return _0x73b8bb['status'](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5c')});}if(_0x354266[_0x4f4f('0x5d')]){return _0x73b8bb['status'](0x191)['json']({'message':_0x4f4f('0x5e')});}if(_0x354266[_0x4f4f('0x5f')]){if(_0x34fe84[_0x4f4f('0x58')]>0x0){if(moment(_0x354266[_0x4f4f('0x60')])[_0x4f4f('0x61')](_0x34fe84[_0x4f4f('0x58')],_0x4f4f('0x62'))>moment()){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});}}else{return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x354266['id']};_0x5b4f6a();});})[_0x4f4f('0x48')](function(){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});});}catch(_0x598d65){_0x5b4f6a(_0x598d65);}}else if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x50')});}})[_0x4f4f('0x3d')](function(_0xa8f1a5,_0x4a4184,_0x1aaf2c){if(_0xa8f1a5['user']){db[_0x4f4f('0x4b')]['find']({'where':{'id':_0xa8f1a5['user']['id']},'attributes':userAttributes})[_0x4f4f('0x43')](function(_0x4f3a0f){if(!_0x4f3a0f){return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':'User\x20not\x20found.'});}_0xa8f1a5[_0x4f4f('0x3e')]=_0x4f3a0f;_0x1aaf2c();})[_0x4f4f('0x48')](function(_0x4e782c){_0x1aaf2c(_0x4e782c);});}else if(_0x5deda9){_0x1aaf2c();}else{return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x63')});}});};exports[_0x4f4f('0x64')]=function canUpdate(){return compose()[_0x4f4f('0x3d')](function(_0x62b468,_0xb0d1b2,_0x15f0a1){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0x475969){if(_0x475969[_0x4f4f('0x66')]){_0x15f0a1();}else{return _0xb0d1b2[_0x4f4f('0x44')](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x67')});}})['catch'](function(_0x636b63){_0x15f0a1(_0x636b63);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x31349a,_0x4363c9,_0x5cf4da){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0xea9617){if(_0xea9617[_0x4f4f('0x68')]){_0x5cf4da();}else{return _0x4363c9[_0x4f4f('0x44')](0x193)['json']({'message':_0x4f4f('0x67')});}})[_0x4f4f('0x48')](function(_0x30674f){_0x5cf4da(_0x30674f);});});};exports[_0x4f4f('0x69')]=function(_0x196426,_0x433787,_0x29314b){_0x196426[_0x4f4f('0x69')]=!![];return _0x29314b();};exports[_0x4f4f('0x6a')]=function signToken(_0x540b3c){return signJwt(_0x540b3c);};exports[_0x4f4f('0x6b')]=function(_0xd3b763,_0x4b33a5){if(!_0xd3b763['user']){return _0x4b33a5['status'](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x6c')});}var _0x3a2ae3={'payload':{'id':_0xd3b763['user']['id'],'role':_0xd3b763[_0x4f4f('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3a2ae3)[_0x4f4f('0x43')](function(_0x1c181e){_0x4b33a5[_0x4f4f('0x6d')](_0x4f4f('0x6e'),_0x1c181e);_0x4b33a5[_0x4f4f('0x6f')](_0x4f4f('0x70'));})[_0x4f4f('0x48')](function(_0x88054a){return _0x4b33a5[_0x4f4f('0x44')](0x1f4)['send'](_0x88054a);});};exports['retrieveApiKey']=function(_0x36cfcf){if(_[_0x4f4f('0x71')](_0x36cfcf['apiKeyNonce'])||_['isNil'](_0x36cfcf[_0x4f4f('0x72')])){return null;}else{return createJwt(_0x36cfcf);}};exports[_0x4f4f('0x73')]=function(_0x15fd73){_0x15fd73['apiKeyNonce']=generateNonce();_0x15fd73['apiKeyIat']=generateIssuedAt();return createJwt(_0x15fd73);};exports[_0x4f4f('0x74')]=function(_0x3205ef,_0x179998){var _0x3bd569=_0x3205ef[_0x4f4f('0x53')][_0x4f4f('0x51')];if(_0x3bd569){var _0xe66fc={'nonce':_0x179998[_0x4f4f('0x5a')],'iat':_0x179998[_0x4f4f('0x72')],'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};return verifyJwt(_0x3bd569,_0xe66fc)['then'](function(){return generateApiKey(_0x179998);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x4f4f('0x75')]=function(_0x136d83){var _0x161943=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x161943[_0x4f4f('0x76')](_0x136d83))throw new db['Sequelize'][(_0x4f4f('0x77'))]('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[_0x4f4f('0x78')]=function(_0x3f57c2,_0x1c6489,_0x4901f5){var _0x550342=encryptor[_0x4f4f('0x79')](_0x1c6489)[_0x4f4f('0x7a')](',');for(var _0x4f26af=0x0;_0x4f26af<_0x4901f5;_0x4f26af++){if(!_0x550342[_0x4f26af])break;if(_0x3f57c2[_0x4f4f('0x7b')]()===_0x550342[_0x4f26af][_0x4f4f('0x7b')]()){var _0x1d48fb=util['format'](_0x4f4f('0x7c'),_0x4901f5);if(_0x4901f5===0x1){_0x1d48fb=_0x4f4f('0x7d');}throw new db[(_0x4f4f('0x7e'))]['ValidationError'](_0x1d48fb);}}return;};exports[_0x4f4f('0x7f')]=function(_0x5418cd,_0x35701d){var _0x3b637d=_0x35701d?encryptor[_0x4f4f('0x79')](_0x35701d)[_0x4f4f('0x7a')](','):[];if(_0x3b637d[_0x4f4f('0x80')]===0x5){_0x3b637d[_0x4f4f('0x81')](-0x1,0x1);}_0x3b637d[_0x4f4f('0x82')](_0x5418cd);return encryptor[_0x4f4f('0x83')](_0x3b637d[_0x4f4f('0x84')](','));};function signJwt(_0x36f369){var _0x269e0d=BPromise['promisify'](jwt[_0x4f4f('0x85')],{'context':jwt});var _0x297c9c=_0x36f369[_0x4f4f('0x86')]||config['secrets'][_0x4f4f('0xc')];return new BPromise(function(_0x43908e,_0x151c75){_0x269e0d(_0x36f369[_0x4f4f('0x87')],_0x297c9c,_0x36f369['options'])[_0x4f4f('0x43')](function(_0x213163){_0x43908e(_0x213163);})[_0x4f4f('0x48')](function(_0x24928a){_0x151c75(_0x24928a);});});}function verifyJwt(_0x157af6,_0x5e2ef4,_0xe105e9){var _0x484ae2=BPromise[_0x4f4f('0x88')](jwt[_0x4f4f('0x89')],{'context':jwt});var _0x2da4ea=_0xe105e9||config[_0x4f4f('0xb')][_0x4f4f('0xc')];return new BPromise(function(_0x23366b,_0x4bbbf6){_0x484ae2(_0x157af6,_0x2da4ea,_0x5e2ef4)['then'](function(_0x15c86f){_0x23366b(_0x15c86f);})['catch'](function(_0x4252fa){_0x4bbbf6(_0x4252fa);});});}function generateNonce(){return crypto[_0x4f4f('0x8a')](0x10)[_0x4f4f('0x8b')](_0x4f4f('0x8c'));}function generateIssuedAt(){return Math[_0x4f4f('0x8d')](Date[_0x4f4f('0x8e')]()/0x3e8)[_0x4f4f('0x8b')]();}function createJwt(_0x346ebb){var _0x356224={'payload':{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')]},'options':{'algorithm':'HS512','subject':_0x346ebb['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x4f4f('0x52')]()}};return signJwt(_0x356224)[_0x4f4f('0x43')](function(_0x49c7c4){return{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')],'token':_0x49c7c4};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 3e9acf9..d531b7d 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 _0xc4f0=['findAll','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','count','User','getFilteredContacts','rows','catch','describe','keys','cf_','CmCustomField','findOne','slice','all','length','fieldType','type','map','../../mysqldb'];(function(_0x57f2ea,_0x513dad){var _0x325f7c=function(_0x41ad0f){while(--_0x41ad0f){_0x57f2ea['push'](_0x57f2ea['shift']());}};_0x325f7c(++_0x513dad);}(_0xc4f0,0x1e9));var _0x0c4f=function(_0x4803c4,_0x419b99){_0x4803c4=_0x4803c4-0x0;var _0x499d8d=_0xc4f0[_0x4803c4];return _0x499d8d;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0x0c4f('0x0'))['db'];exports[_0x0c4f('0x1')]=function(_0x488db0,_0x1b07b1,_0x21b9f1,_0x2283ed){var _0x3e5879={'count':0x0,'rows':[]};var _0x2c06ac=sqlUtils['skipContactsQuery'](_0x1b07b1,_0x488db0);if(_0x2c06ac){return Promise[_0x0c4f('0x2')](_0x3e5879);}var _0x1ba0c5=sqlUtils[_0x0c4f('0x3')]();var _0x323bb1={};var _0x4453ef=![];var _0x5caa6c=![];return Promise[_0x0c4f('0x2')]()[_0x0c4f('0x4')](function(){if(_0x488db0[_0x0c4f('0x5')]){return sqlUtils[_0x0c4f('0x6')](_0x488db0[_0x0c4f('0x5')],_0x2283ed);}else{return sqlUtils[_0x0c4f('0x7')](_0x488db0,_0x2283ed);}})['then'](function(_0x3aab58){_0x1ba0c5[_0x0c4f('0x8')](_0x3aab58[_0x0c4f('0x9')]);_0x1ba0c5[_0x0c4f('0x8')](_0x3aab58[_0x0c4f('0xa')]);_0x1ba0c5[_0x0c4f('0x8')](_0x3aab58[_0x0c4f('0xb')]);_0x1ba0c5[_0x0c4f('0x8')](_0x3aab58[_0x0c4f('0xc')][_0x0c4f('0xd')]);_0x323bb1=_0x3aab58[_0x0c4f('0xe')];_0x5caa6c=_0x3aab58[_0x0c4f('0xc')][_0x0c4f('0xf')];return sqlUtils[_0x0c4f('0x10')](_0x1b07b1,_0x488db0,_0x5caa6c);})[_0x0c4f('0x4')](function(_0x499b9e){_0x1ba0c5['where'](_0x499b9e);var _0x2a73cb=_0x488db0[_0x0c4f('0x5')]?_0x323bb1[_0x0c4f('0x11')]:_0x488db0[_0x0c4f('0x12')];_0x4453ef=_0x2a73cb?!![]:![];return sqlUtils['countFilteredContacts'](_0x1ba0c5,_0x2a73cb);})[_0x0c4f('0x4')](function(_0x22a90b){_0x3e5879['count']=_0x22a90b;if(_0x3e5879[_0x0c4f('0x13')]===0x0){return;}if(_0x488db0[_0x0c4f('0x14')]){_0x5caa6c=!![];}return sqlUtils['buildContactsQuery'](_0x1ba0c5,_0x488db0['fields'],_0x21b9f1,_0x4453ef,_0x323bb1[_0x0c4f('0xd')],_0x5caa6c);})[_0x0c4f('0x4')](function(_0x475d73){if(!_0x475d73){return[];}return sqlUtils[_0x0c4f('0x15')](_0x475d73,_0x488db0,_0x21b9f1);})[_0x0c4f('0x4')](function(_0x366d8f){_0x3e5879[_0x0c4f('0x16')]=_0x366d8f;return _0x3e5879;})[_0x0c4f('0x17')](function(_0x490b78){throw _0x490b78;});};exports[_0x0c4f('0x18')]=function(){var _0x24874f={};var _0x56da5c=[];return db['CmContact'][_0x0c4f('0x18')]()[_0x0c4f('0x4')](function(_0x4c3609){_0x24874f=_0x4c3609;var _0x288c45=Object[_0x0c4f('0x19')](_0x24874f)['filter'](function(_0x188b1a){return _['startsWith'](_0x188b1a,_0x0c4f('0x1a'))?_0x188b1a:undefined;});var _0x2016c0=_0x288c45['map'](function(_0x1f48ad){return db[_0x0c4f('0x1b')][_0x0c4f('0x1c')]({'where':{'id':_0x1f48ad[_0x0c4f('0x1d')](0x3)},'raw':!![]});});return Promise[_0x0c4f('0x1e')](_0x2016c0);})[_0x0c4f('0x4')](function(_0x43c475){for(var _0x26e2d6=0x0;_0x26e2d6<_0x43c475[_0x0c4f('0x1f')];_0x26e2d6++){if(_0x43c475[_0x26e2d6]){var _0x5110f2=_0x0c4f('0x1a')+_0x43c475[_0x26e2d6]['id'];_0x24874f[_0x5110f2][_0x0c4f('0x20')]=_0x43c475[_0x26e2d6][_0x0c4f('0x21')];}}_0x56da5c=_[_0x0c4f('0x22')](Object['keys'](_0x24874f),function(_0x4c1f10){return{'name':_0x4c1f10,'type':_0x24874f[_0x4c1f10]['type']};});return _0x56da5c;})[_0x0c4f('0x17')](function(_0x2fd922){throw _0x2fd922;});}; \ No newline at end of file +var _0x161a=['CmCustomField','findOne','slice','length','fieldType','lodash','../../mysqldb','findAll','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','tags','skip','ids','tag','countFilteredContacts','count','clause','getFilteredContacts','rows','describe','keys','filter','startsWith','cf_','map'];(function(_0x21412d,_0x4fb58e){var _0x37f896=function(_0x5211f8){while(--_0x5211f8){_0x21412d['push'](_0x21412d['shift']());}};_0x37f896(++_0x4fb58e);}(_0x161a,0x145));var _0xa161=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0x161a[_0x323d87];return _0x5e8f74;};'use strict';var _=require(_0xa161('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0xa161('0x1'))['db'];exports[_0xa161('0x2')]=function(_0x1302fe,_0xb237c4,_0x220f21,_0x54fbd2){var _0x315623={'count':0x0,'rows':[]};var _0x392abd=sqlUtils['skipContactsQuery'](_0xb237c4,_0x1302fe);if(_0x392abd){return Promise[_0xa161('0x3')](_0x315623);}var _0x4ecb05=sqlUtils[_0xa161('0x4')]();var _0x2ec25b={};var _0xd62160=![];var _0x16d330=![];return Promise[_0xa161('0x3')]()['then'](function(){if(_0x1302fe[_0xa161('0x5')]){return sqlUtils[_0xa161('0x6')](_0x1302fe[_0xa161('0x5')],_0x54fbd2);}else{return sqlUtils[_0xa161('0x7')](_0x1302fe,_0x54fbd2);}})[_0xa161('0x8')](function(_0x3951ff){_0x4ecb05[_0xa161('0x9')](_0x3951ff[_0xa161('0xa')]);_0x4ecb05[_0xa161('0x9')](_0x3951ff[_0xa161('0xb')]);_0x4ecb05[_0xa161('0x9')](_0x3951ff['filter']);_0x4ecb05[_0xa161('0x9')](_0x3951ff['user']['clause']);_0x2ec25b=_0x3951ff[_0xa161('0xc')];_0x16d330=_0x3951ff['user'][_0xa161('0xd')];return sqlUtils['checkListsRestrictions'](_0xb237c4,_0x1302fe,_0x16d330);})[_0xa161('0x8')](function(_0x1d344f){_0x4ecb05[_0xa161('0x9')](_0x1d344f);var _0x42dde3=_0x1302fe['search']?_0x2ec25b[_0xa161('0xe')]:_0x1302fe[_0xa161('0xf')];_0xd62160=_0x42dde3?!![]:![];return sqlUtils[_0xa161('0x10')](_0x4ecb05,_0x42dde3);})[_0xa161('0x8')](function(_0x11a200){_0x315623['count']=_0x11a200;if(_0x315623[_0xa161('0x11')]===0x0){return;}if(_0x1302fe['User']){_0x16d330=!![];}return sqlUtils['buildContactsQuery'](_0x4ecb05,_0x1302fe[_0xa161('0xb')],_0x220f21,_0xd62160,_0x2ec25b[_0xa161('0x12')],_0x16d330);})['then'](function(_0x418ce1){if(!_0x418ce1){return[];}return sqlUtils[_0xa161('0x13')](_0x418ce1,_0x1302fe,_0x220f21);})[_0xa161('0x8')](function(_0x52ebd8){_0x315623[_0xa161('0x14')]=_0x52ebd8;return _0x315623;})['catch'](function(_0x37ee4c){throw _0x37ee4c;});};exports['describe']=function(){var _0x57e881={};var _0x337abd=[];return db['CmContact'][_0xa161('0x15')]()[_0xa161('0x8')](function(_0xea471b){_0x57e881=_0xea471b;var _0x1dd6a2=Object[_0xa161('0x16')](_0x57e881)[_0xa161('0x17')](function(_0x37d5b6){return _[_0xa161('0x18')](_0x37d5b6,_0xa161('0x19'))?_0x37d5b6:undefined;});var _0x12dea4=_0x1dd6a2[_0xa161('0x1a')](function(_0x14951d){return db[_0xa161('0x1b')][_0xa161('0x1c')]({'where':{'id':_0x14951d[_0xa161('0x1d')](0x3)},'raw':!![]});});return Promise['all'](_0x12dea4);})['then'](function(_0x200de9){for(var _0x268f03=0x0;_0x268f03<_0x200de9[_0xa161('0x1e')];_0x268f03++){if(_0x200de9[_0x268f03]){var _0x58beaf=_0xa161('0x19')+_0x200de9[_0x268f03]['id'];_0x57e881[_0x58beaf][_0xa161('0x1f')]=_0x200de9[_0x268f03]['type'];}}_0x337abd=_[_0xa161('0x1a')](Object['keys'](_0x57e881),function(_0x27fe4d){return{'name':_0x27fe4d,'type':_0x57e881[_0x27fe4d]['type']};});return _0x337abd;})['catch'](function(_0x45dd21){throw _0x45dd21;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index f7f0dd9..1faf6e4 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 _0x55d3=['\x20=\x20?','resolve','then','fields','tag','filter','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','Tags','clone','COUNT(*)','toString','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','from','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','lastName','mobile','fax','email','push','forEach','TagIds','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','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?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','datetime','castTo','DATE','buildExpression','type','default','text','value','end','Tag','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','c.ListId\x20IN\x20?','concat'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x55d3,0x1aa));var _0x355d=function(_0x248fc3,_0x49ff02){_0x248fc3=_0x248fc3-0x0;var _0x4e4ead=_0x55d3[_0x248fc3];return _0x4e4ead;};'use strict';var _=require(_0x355d('0x0'));var squel=require(_0x355d('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x355d('0x2'));var utils=require(_0x355d('0x3'));var db=require(_0x355d('0x4'))['db'];function skipContactsQuery(_0x3a08d6,_0x4ce1e7){var _0x161754=![];if(_0x3a08d6[_0x355d('0x5')]===_0x355d('0x6')&&!_0x4ce1e7[_0x355d('0x7')]&&!_0x4ce1e7[_0x355d('0x8')]&&_0x4ce1e7[_0x355d('0x9')]!=='true'){_0x161754=!![];}return _0x161754;}function getContactsSubquery(){return squel['select']()[_0x355d('0xa')]('cm_contacts','c')[_0x355d('0xb')](_0x355d('0xc'));}function applyJoinClauses(_0x47458f,_0x444ac1){var _0x1b82c6=_0x444ac1?'c':_0x355d('0xd');_0x47458f[_0x355d('0xe')]('cm_user_has_contacts','uc',_0x355d('0xf')+_0x1b82c6+'.id')[_0x355d('0xe')](_0x355d('0x10'),'ct',_0x355d('0x11')+_0x1b82c6+'.id')['left_join']('tools_tags','t',_0x355d('0x12'));return _0x47458f;}function addFieldsToQuery(_0x2332b0,_0x40f5d6,_0x8ca907,_0x567296,_0x189c51){var _0x6efae1=_0x189c51?'c':_0x355d('0xd');if(!_0x40f5d6){_0x40f5d6=['id','firstName',_0x355d('0x13'),'phone',_0x355d('0x14'),_0x355d('0x15'),_0x355d('0x16'),'ListId','CompanyId','createdAt','updatedAt','deletedAt','TagIds'];}else if(!_0x40f5d6['includes']('id')){_0x40f5d6[_0x355d('0x17')]('id');}var _0x734592=_0x8ca907&&_0x189c51||!_0x8ca907&&!_0x189c51;if(_0x567296){_0x734592=_0x567296&&_0x189c51||!_0x567296&&!_0x189c51;}_0x40f5d6[_0x355d('0x18')](function(_0x19f912){if(_0x19f912===_0x355d('0x19')){if(_0x734592){_0x2332b0[_0x355d('0x1a')](_0x355d('0x1b'),_0x19f912);}else if(_0x8ca907||_0x567296){_0x2332b0[_0x355d('0x1a')](_0x6efae1+'.'+_0x19f912);}}else{_0x2332b0[_0x355d('0x1a')](_0x6efae1+'.'+_0x19f912);}});return _0x2332b0;}function getSqlClauses(){var _0x43906d={'default':squel['expr'](),'fields':squel['expr'](),'filter':squel['expr'](),'tags':{'clause':squel[_0x355d('0x1c')](),'ids':null},'user':{'clause':squel[_0x355d('0x1c')](),'skip':![]}};return _0x43906d;}function parseTagParameter(_0x8a9236){var _0x38ebe6=squel[_0x355d('0x1c')]();if(_0x8a9236){var _0x4b14c7=utils[_0x355d('0x1d')](_0x8a9236);_0x4b14c7['forEach'](function(_0xb4ecb6){_0x38ebe6['or'](_0x355d('0x1e'),'%,'+_0xb4ecb6+',%');});}return _0x38ebe6;}function parseSearchFilter(_0xfeb61b){var _0x4d7c2c=squel['expr']();if(_0xfeb61b){var _0x31dd24=_0xfeb61b[_0x355d('0x1f')]('\x5c','\x5c\x5c')[_0x355d('0x1f')](/'/g,'\x27\x27');if(_0x31dd24[_0x355d('0x20')]('\x20')[_0x355d('0x21')]>0x1){_0x4d7c2c['or'](_0x355d('0x22'),qs['getFullTextValue'](_0x31dd24,!![]),null);}else{if(qs[_0x355d('0x23')](_0x31dd24)){_0x4d7c2c['or']('c.id\x20LIKE\x20?',_0x31dd24+'%');_0x4d7c2c['or'](_0x355d('0x24'),_0x31dd24+'%');_0x4d7c2c['or']('c.mobile\x20LIKE\x20?',_0x31dd24+'%');_0x4d7c2c['or']('c.fax\x20LIKE\x20?',_0x31dd24+'%');}else if(qs[_0x355d('0x25')](_0x31dd24)){_0x4d7c2c['or'](_0x355d('0x26'),_0x31dd24+'%');}else{_0x4d7c2c['or'](_0x355d('0x27'),'%'+_0x31dd24+'%');_0x4d7c2c['or'](_0x355d('0x28'),'%'+_0x31dd24+'%');_0x4d7c2c['or'](_0x355d('0x26'),'%'+_0x31dd24+'%');}}}return _0x4d7c2c;}function parseAdvancedSearchFilter(_0x15c278,_0x4964d2){var _0x1fba12=getSqlClauses();var _0x213e29=as['parseSearch'](_0x15c278);var _0xf07bb7=_0x213e29[_0x355d('0x29')];for(var _0x58e8ea=0x0;_0x58e8ea<_0x213e29[_0x355d('0x2a')][_0x355d('0x21')];_0x58e8ea++){var _0x17d652=_0x213e29[_0x355d('0x2a')][_0x58e8ea];var _0x3bfe7f='c';var _0x5a0570=_[_0x355d('0x2b')](_0x4964d2,[_0x355d('0x2c'),_0x17d652[_0x355d('0x1a')]]);if(_0x5a0570){if(_0x17d652[_0x355d('0x1a')]==='dateOfBirth'||_0x5a0570['fieldType']===_0x355d('0x2d')){_0x17d652[_0x355d('0x2e')]=_0x355d('0x2f');}var _0x34c645=as[_0x355d('0x30')](_0x3bfe7f,_0x5a0570[_0x355d('0x31')],_0x17d652);_0x1fba12[_0x355d('0x32')][_0xf07bb7](_0x34c645[_0x355d('0x33')],_0x34c645[_0x355d('0x34')]['start'],_0x34c645[_0x355d('0x34')][_0x355d('0x35')]);}else{if(_0x17d652[_0x355d('0x1a')]===_0x355d('0x36')){var _0x2f6b4e=_0x17d652[_0x355d('0x34')][_0x355d('0x20')](',')[_0x355d('0x37')](function(_0x1decff){return Number(_0x1decff);});var _0x52204d=parseTagParameter(_0x2f6b4e);_0x1fba12[_0x355d('0x38')][_0x355d('0x39')][_0x355d('0x3a')](_0x52204d);_0x1fba12[_0x355d('0x38')][_0x355d('0x3b')]=_0x2f6b4e;}else if(_0x17d652[_0x355d('0x1a')]===_0x355d('0x3c')){_0x1fba12[_0x355d('0x3d')][_0x355d('0x39')][_0x355d('0x3a')](_0x355d('0x3e'),_0x17d652[_0x355d('0x34')]);_0x1fba12[_0x355d('0x3d')][_0x355d('0x3f')]=!![];}}}return _0x1fba12;}function parseModelFields(_0x5e5d3e,_0x5e7742){var _0x1af972=squel[_0x355d('0x1c')]();var _0x10d3f5=_(_0x5e5d3e)[_0x355d('0x40')]()[_0x355d('0x37')](function(_0x26020b){return _[_0x355d('0x41')](_0x5e7742,[_0x355d('0x2c'),_0x26020b])?_0x26020b:undefined;})['compact']()['value']();if(_0x5e5d3e[_0x355d('0x42')]){_0x10d3f5[_0x355d('0x17')]('Contact');}if(_0x5e5d3e['User']){_0x10d3f5[_0x355d('0x17')](_0x355d('0x3c'));}if(_0x10d3f5[_0x355d('0x21')]>0x0){_0x10d3f5[_0x355d('0x18')](function(_0x380cf8){if(_0x380cf8===_0x355d('0x8')){_0x1af972[_0x355d('0x3a')](_0x355d('0x43'),[][_0x355d('0x44')](_0x5e5d3e[_0x380cf8]));}else if(_0x380cf8===_0x355d('0x42')){var _0x248f34='%'+_0x5e5d3e[_0x380cf8]+'%';_0x1af972[_0x355d('0x3a')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x248f34);}else if(_0x380cf8===_0x355d('0x3c')){_0x1af972[_0x355d('0x3a')]('uc.UserId\x20=\x20?',_0x5e5d3e[_0x380cf8]);}else{_0x1af972['and']('c.'+_0x380cf8+_0x355d('0x45'),_0x5e5d3e[_0x380cf8]);}});}return _0x1af972;}function parseQueryParameters(_0x406d66,_0x3aa945){var _0x4b0c57=getSqlClauses();return Promise[_0x355d('0x46')]()[_0x355d('0x47')](function(){return parseModelFields(_0x406d66,_0x3aa945);})[_0x355d('0x47')](function(_0x5c3923){_0x4b0c57[_0x355d('0x48')]['and'](_0x5c3923);return parseTagParameter(_0x406d66[_0x355d('0x49')]);})[_0x355d('0x47')](function(_0x2a4836){_0x4b0c57[_0x355d('0x38')][_0x355d('0x39')][_0x355d('0x3a')](_0x2a4836);return parseSearchFilter(_0x406d66[_0x355d('0x4a')]);})[_0x355d('0x47')](function(_0x3810a3){_0x4b0c57[_0x355d('0x4a')]=_0x3810a3;return _0x4b0c57;});}function checkListsRestrictions(_0x5f14f2,_0x4c4042,_0x1e8534){var _0x5582e8=squel[_0x355d('0x1c')]();return Promise[_0x355d('0x46')]()[_0x355d('0x47')](function(){if(_0x4c4042[_0x355d('0x7')]&&_0x5f14f2[_0x355d('0x5')]==='agent'&&!_0x1e8534){return _0x5f14f2['getLists']({'attributes':['id'],'raw':!![]});}})[_0x355d('0x47')](function(_0x2dfef9){if(_0x2dfef9){if(_0x2dfef9[_0x355d('0x21')]===0x0){_0x5582e8[_0x355d('0x3a')](_0x355d('0x4b'));}else{_0x5582e8[_0x355d('0x3a')]('c.ListId\x20IN\x20?',_['map'](_0x2dfef9,'id'));}}})[_0x355d('0x47')](function(){return _0x5582e8;});}function buildContactsQuery(_0x8cf8e4,_0x44431b,_0x172e40,_0x274af5,_0x31a248,_0x346942){if(_0x44431b){_0x44431b=_0x172e40[_0x355d('0x4c')];}_0x8cf8e4=addFieldsToQuery(_0x8cf8e4,_0x44431b,_0x274af5,_0x346942,!![]);var _0x56d92e=squel['select']();_0x56d92e=addFieldsToQuery(_0x56d92e,_0x44431b,_0x274af5,_0x346942,![]);if(_0x274af5||_0x346942){_0x8cf8e4=applyJoinClauses(_0x8cf8e4,!![]);_0x8cf8e4[_0x355d('0x4d')](_0x355d('0x4e'));if(_0x172e40[_0x355d('0x4f')]){_0x56d92e[_0x355d('0x4f')](_0x172e40[_0x355d('0x4f')]);}if(_0x172e40[_0x355d('0x50')]){_0x56d92e[_0x355d('0x50')](_0x172e40[_0x355d('0x50')]);}}else{_0x56d92e=applyJoinClauses(_0x56d92e,![]);_0x56d92e[_0x355d('0x4d')]('subqry.id');if(_0x172e40[_0x355d('0x4f')]){_0x8cf8e4['limit'](_0x172e40[_0x355d('0x4f')]);}if(_0x172e40['offset']){_0x8cf8e4[_0x355d('0x50')](_0x172e40['offset']);}}_0x56d92e[_0x355d('0x51')](_0x31a248);if(_0x172e40['order']){_0x172e40[_0x355d('0x52')][_0x355d('0x18')](function(_0xc511aa){_0x8cf8e4[_0x355d('0x52')]('c.'+_0xc511aa[0x0],_0xc511aa[0x1]===_0x355d('0x53')?![]:!![]);_0x56d92e[_0x355d('0x52')](_0x355d('0x54')+_0xc511aa[0x0],_0xc511aa[0x1]==='DESC'?![]:!![]);});}_0x56d92e[_0x355d('0xa')](_0x8cf8e4,_0x355d('0xd'));return _0x56d92e;}function getFilteredContacts(_0x4769f7){var _0x40c0d9=[];return db['Tag'][_0x355d('0x55')]({'attributes':['id',_0x355d('0x2c'),_0x355d('0x56')],'raw':!![]})[_0x355d('0x47')](function(_0x18172e){_0x40c0d9=_[_0x355d('0x57')](_0x18172e,'id');var _0x41d0e0={'type':db[_0x355d('0x58')][_0x355d('0x59')][_0x355d('0x5a')],'model':db[_0x355d('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x355d('0x5c')][_0x355d('0x5d')](_0x4769f7['toString'](),_0x41d0e0);})['then'](function(_0xb3a43d){_0xb3a43d[_0x355d('0x18')](function(_0x5613f2){if(_0x5613f2['TagIds']){_0x5613f2[_0x355d('0x5e')]=[];_0x5613f2[_0x355d('0x19')][_0x355d('0x20')](',')['forEach'](function(_0xcbba43){_0x5613f2[_0x355d('0x5e')][_0x355d('0x17')](_0x40c0d9[_0xcbba43]);});}delete _0x5613f2[_0x355d('0x19')];});return _0xb3a43d;});}function countFilteredContacts(_0x3a9263,_0x1e736f){var _0x266de2=_0x3a9263[_0x355d('0x5f')]();_0x266de2[_0x355d('0x1a')](_0x355d('0x60'));_0x266de2=applyJoinClauses(_0x266de2,!![]);_0x3a9263[_0x355d('0x4d')](_0x355d('0x4e'));var _0x33e6e7=utils['getSelectedTags'](_0x1e736f);if(!_['isEmpty'](_0x33e6e7)){_0x266de2[_0x355d('0xb')]('t.id\x20IN\x20?',_0x33e6e7);}var _0xd0f854={'type':db[_0x355d('0x58')][_0x355d('0x59')]['SELECT'],'raw':!![]};return db[_0x355d('0x5c')][_0x355d('0x5d')](_0x266de2[_0x355d('0x61')](),_0xd0f854)['then'](function(_0x1c2e7a){return _0x1c2e7a[0x0]['COUNT(*)'];});}module[_0x355d('0x62')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x85b1=['updatedAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','name','dateOfBirth','fieldType','datetime','castTo','type','value','end','Tag','map','clause','and','tags','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','Contact','push','c.ListId\x20IN\x20?','concat','\x20=\x20?','then','fields','tag','filter','resolve','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','COUNT(*)','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','tools_tags','t.id\x20=\x20ct.TagId','lastName','phone','mobile','fax','email','CompanyId'];(function(_0x5af842,_0x3c388b){var _0x3fc955=function(_0x308f27){while(--_0x308f27){_0x5af842['push'](_0x5af842['shift']());}};_0x3fc955(++_0x3c388b);}(_0x85b1,0x11b));var _0x185b=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x85b1[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x185b('0x0'));var squel=require(_0x185b('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x185b('0x2'));var utils=require(_0x185b('0x3'));var db=require(_0x185b('0x4'))['db'];function skipContactsQuery(_0x44ea06,_0x4f4f70){var _0x1e2d6d=![];if(_0x44ea06[_0x185b('0x5')]===_0x185b('0x6')&&!_0x4f4f70[_0x185b('0x7')]&&!_0x4f4f70[_0x185b('0x8')]&&_0x4f4f70[_0x185b('0x9')]!==_0x185b('0xa')){_0x1e2d6d=!![];}return _0x1e2d6d;}function getContactsSubquery(){return squel[_0x185b('0xb')]()[_0x185b('0xc')](_0x185b('0xd'),'c')['where'](_0x185b('0xe'));}function applyJoinClauses(_0x2a64ad,_0x2a7291){var _0xabacb5=_0x2a7291?'c':_0x185b('0xf');_0x2a64ad[_0x185b('0x10')](_0x185b('0x11'),'uc',_0x185b('0x12')+_0xabacb5+_0x185b('0x13'))['left_join'](_0x185b('0x14'),'ct','ct.CmContactId\x20=\x20'+_0xabacb5+_0x185b('0x13'))[_0x185b('0x10')](_0x185b('0x15'),'t',_0x185b('0x16'));return _0x2a64ad;}function addFieldsToQuery(_0x353fe8,_0x1a695b,_0x8848a0,_0x5dec00,_0x40ddfd){var _0x2be659=_0x40ddfd?'c':_0x185b('0xf');if(!_0x1a695b){_0x1a695b=['id','firstName',_0x185b('0x17'),_0x185b('0x18'),_0x185b('0x19'),_0x185b('0x1a'),_0x185b('0x1b'),'ListId',_0x185b('0x1c'),'createdAt',_0x185b('0x1d'),_0x185b('0x1e'),_0x185b('0x1f')];}else if(!_0x1a695b['includes']('id')){_0x1a695b['push']('id');}var _0x275f3e=_0x8848a0&&_0x40ddfd||!_0x8848a0&&!_0x40ddfd;if(_0x5dec00){_0x275f3e=_0x5dec00&&_0x40ddfd||!_0x5dec00&&!_0x40ddfd;}_0x1a695b[_0x185b('0x20')](function(_0x2e5659){if(_0x2e5659==='TagIds'){if(_0x275f3e){_0x353fe8[_0x185b('0x21')](_0x185b('0x22'),_0x2e5659);}else if(_0x8848a0||_0x5dec00){_0x353fe8[_0x185b('0x21')](_0x2be659+'.'+_0x2e5659);}}else{_0x353fe8[_0x185b('0x21')](_0x2be659+'.'+_0x2e5659);}});return _0x353fe8;}function getSqlClauses(){var _0x3adf3f={'default':squel['expr'](),'fields':squel[_0x185b('0x23')](),'filter':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x185b('0x23')](),'skip':![]}};return _0x3adf3f;}function parseTagParameter(_0x5897e7){var _0x3b9bd6=squel[_0x185b('0x23')]();if(_0x5897e7){var _0x111df5=utils[_0x185b('0x24')](_0x5897e7);_0x111df5[_0x185b('0x20')](function(_0x5c607a){_0x3b9bd6['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x5c607a+',%');});}return _0x3b9bd6;}function parseSearchFilter(_0x2acab3){var _0x4dd323=squel[_0x185b('0x23')]();if(_0x2acab3){var _0x1788cd=_0x2acab3[_0x185b('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x1788cd[_0x185b('0x26')]('\x20')['length']>0x1){_0x4dd323['or'](_0x185b('0x27'),qs[_0x185b('0x28')](_0x1788cd,!![]),null);}else{if(qs['isNumeric'](_0x1788cd)){_0x4dd323['or'](_0x185b('0x29'),_0x1788cd+'%');_0x4dd323['or']('c.phone\x20LIKE\x20?',_0x1788cd+'%');_0x4dd323['or']('c.mobile\x20LIKE\x20?',_0x1788cd+'%');_0x4dd323['or'](_0x185b('0x2a'),_0x1788cd+'%');}else if(qs['isEmail'](_0x1788cd)){_0x4dd323['or']('c.email\x20LIKE\x20?',_0x1788cd+'%');}else{_0x4dd323['or']('c.firstName\x20LIKE\x20?','%'+_0x1788cd+'%');_0x4dd323['or'](_0x185b('0x2b'),'%'+_0x1788cd+'%');_0x4dd323['or'](_0x185b('0x2c'),'%'+_0x1788cd+'%');}}}return _0x4dd323;}function parseAdvancedSearchFilter(_0x1dfc35,_0x5d30ca){var _0x81f180=getSqlClauses();var _0x4ec364=as[_0x185b('0x2d')](_0x1dfc35);var _0x348a70=_0x4ec364[_0x185b('0x2e')];for(var _0x2f716a=0x0;_0x2f716a<_0x4ec364[_0x185b('0x2f')][_0x185b('0x30')];_0x2f716a++){var _0x56d89d=_0x4ec364['conditions'][_0x2f716a];var _0x4f15ff='c';var _0x4a9ec4=_['find'](_0x5d30ca,[_0x185b('0x31'),_0x56d89d[_0x185b('0x21')]]);if(_0x4a9ec4){if(_0x56d89d[_0x185b('0x21')]===_0x185b('0x32')||_0x4a9ec4[_0x185b('0x33')]===_0x185b('0x34')){_0x56d89d[_0x185b('0x35')]='DATE';}var _0x357730=as['buildExpression'](_0x4f15ff,_0x4a9ec4[_0x185b('0x36')],_0x56d89d);_0x81f180['default'][_0x348a70](_0x357730['text'],_0x357730['value']['start'],_0x357730[_0x185b('0x37')][_0x185b('0x38')]);}else{if(_0x56d89d['field']===_0x185b('0x39')){var _0x2e6e28=_0x56d89d[_0x185b('0x37')][_0x185b('0x26')](',')[_0x185b('0x3a')](function(_0x5debfd){return Number(_0x5debfd);});var _0x4783e9=parseTagParameter(_0x2e6e28);_0x81f180['tags'][_0x185b('0x3b')][_0x185b('0x3c')](_0x4783e9);_0x81f180[_0x185b('0x3d')][_0x185b('0x3e')]=_0x2e6e28;}else if(_0x56d89d['field']===_0x185b('0x3f')){_0x81f180[_0x185b('0x40')]['clause'][_0x185b('0x3c')](_0x185b('0x41'),_0x56d89d[_0x185b('0x37')]);_0x81f180[_0x185b('0x40')][_0x185b('0x42')]=!![];}}}return _0x81f180;}function parseModelFields(_0x1fa2d0,_0x32e588){var _0x391fe9=squel['expr']();var _0x48e0a3=_(_0x1fa2d0)[_0x185b('0x43')]()[_0x185b('0x3a')](function(_0x3677d6){return _[_0x185b('0x44')](_0x32e588,['name',_0x3677d6])?_0x3677d6:undefined;})['compact']()[_0x185b('0x37')]();if(_0x1fa2d0['Contact']){_0x48e0a3['push'](_0x185b('0x45'));}if(_0x1fa2d0['User']){_0x48e0a3[_0x185b('0x46')]('User');}if(_0x48e0a3[_0x185b('0x30')]>0x0){_0x48e0a3[_0x185b('0x20')](function(_0x2b3739){if(_0x2b3739===_0x185b('0x8')){_0x391fe9[_0x185b('0x3c')](_0x185b('0x47'),[][_0x185b('0x48')](_0x1fa2d0[_0x2b3739]));}else if(_0x2b3739==='Contact'){var _0x513051='%'+_0x1fa2d0[_0x2b3739]+'%';_0x391fe9[_0x185b('0x3c')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x513051);}else if(_0x2b3739===_0x185b('0x3f')){_0x391fe9[_0x185b('0x3c')]('uc.UserId\x20=\x20?',_0x1fa2d0[_0x2b3739]);}else{_0x391fe9[_0x185b('0x3c')]('c.'+_0x2b3739+_0x185b('0x49'),_0x1fa2d0[_0x2b3739]);}});}return _0x391fe9;}function parseQueryParameters(_0x3f26ad,_0x1bcb11){var _0x312702=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x3f26ad,_0x1bcb11);})[_0x185b('0x4a')](function(_0x20dd1d){_0x312702[_0x185b('0x4b')][_0x185b('0x3c')](_0x20dd1d);return parseTagParameter(_0x3f26ad[_0x185b('0x4c')]);})[_0x185b('0x4a')](function(_0x4b1cda){_0x312702[_0x185b('0x3d')]['clause'][_0x185b('0x3c')](_0x4b1cda);return parseSearchFilter(_0x3f26ad[_0x185b('0x4d')]);})[_0x185b('0x4a')](function(_0x1962fa){_0x312702[_0x185b('0x4d')]=_0x1962fa;return _0x312702;});}function checkListsRestrictions(_0xc581d0,_0x438e51,_0x47996a){var _0x23ab7f=squel[_0x185b('0x23')]();return Promise[_0x185b('0x4e')]()['then'](function(){if(_0x438e51[_0x185b('0x7')]&&_0xc581d0[_0x185b('0x5')]==='agent'&&!_0x47996a){return _0xc581d0['getLists']({'attributes':['id'],'raw':!![]});}})[_0x185b('0x4a')](function(_0x213057){if(_0x213057){if(_0x213057['length']===0x0){_0x23ab7f['and'](_0x185b('0x4f'));}else{_0x23ab7f[_0x185b('0x3c')](_0x185b('0x47'),_[_0x185b('0x3a')](_0x213057,'id'));}}})[_0x185b('0x4a')](function(){return _0x23ab7f;});}function buildContactsQuery(_0x18e402,_0x2d385f,_0x3cd449,_0x1b0aa7,_0x1a6cd7,_0x2505c6){if(_0x2d385f){_0x2d385f=_0x3cd449[_0x185b('0x50')];}_0x18e402=addFieldsToQuery(_0x18e402,_0x2d385f,_0x1b0aa7,_0x2505c6,!![]);var _0x5282bc=squel[_0x185b('0xb')]();_0x5282bc=addFieldsToQuery(_0x5282bc,_0x2d385f,_0x1b0aa7,_0x2505c6,![]);if(_0x1b0aa7||_0x2505c6){_0x18e402=applyJoinClauses(_0x18e402,!![]);_0x18e402['group'](_0x185b('0x51'));if(_0x3cd449[_0x185b('0x52')]){_0x5282bc[_0x185b('0x52')](_0x3cd449[_0x185b('0x52')]);}if(_0x3cd449[_0x185b('0x53')]){_0x5282bc[_0x185b('0x53')](_0x3cd449['offset']);}}else{_0x5282bc=applyJoinClauses(_0x5282bc,![]);_0x5282bc[_0x185b('0x54')](_0x185b('0x55'));if(_0x3cd449[_0x185b('0x52')]){_0x18e402[_0x185b('0x52')](_0x3cd449['limit']);}if(_0x3cd449[_0x185b('0x53')]){_0x18e402[_0x185b('0x53')](_0x3cd449['offset']);}}_0x5282bc[_0x185b('0x56')](_0x1a6cd7);if(_0x3cd449[_0x185b('0x57')]){_0x3cd449[_0x185b('0x57')][_0x185b('0x20')](function(_0xc77046){_0x18e402[_0x185b('0x57')]('c.'+_0xc77046[0x0],_0xc77046[0x1]===_0x185b('0x58')?![]:!![]);_0x5282bc[_0x185b('0x57')](_0x185b('0x59')+_0xc77046[0x0],_0xc77046[0x1]==='DESC'?![]:!![]);});}_0x5282bc[_0x185b('0xc')](_0x18e402,_0x185b('0xf'));return _0x5282bc;}function getFilteredContacts(_0x430148){var _0x52128f=[];return db[_0x185b('0x39')][_0x185b('0x5a')]({'attributes':['id',_0x185b('0x31'),_0x185b('0x5b')],'raw':!![]})[_0x185b('0x4a')](function(_0x2ed9b3){_0x52128f=_[_0x185b('0x5c')](_0x2ed9b3,'id');var _0x2ccd71={'type':db[_0x185b('0x5d')][_0x185b('0x5e')][_0x185b('0x5f')],'model':db[_0x185b('0x60')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x185b('0x61')][_0x185b('0x62')](_0x430148[_0x185b('0x63')](),_0x2ccd71);})[_0x185b('0x4a')](function(_0x5a5d08){_0x5a5d08[_0x185b('0x20')](function(_0x4e1a7e){if(_0x4e1a7e[_0x185b('0x1f')]){_0x4e1a7e[_0x185b('0x64')]=[];_0x4e1a7e[_0x185b('0x1f')]['split'](',')[_0x185b('0x20')](function(_0x44211b){_0x4e1a7e[_0x185b('0x64')][_0x185b('0x46')](_0x52128f[_0x44211b]);});}delete _0x4e1a7e[_0x185b('0x1f')];});return _0x5a5d08;});}function countFilteredContacts(_0x434ad3,_0x17b369){var _0x541624=_0x434ad3['clone']();_0x541624[_0x185b('0x21')](_0x185b('0x65'));_0x541624=applyJoinClauses(_0x541624,!![]);_0x434ad3[_0x185b('0x54')]('c.id');var _0x3be014=utils[_0x185b('0x24')](_0x17b369);if(!_['isEmpty'](_0x3be014)){_0x541624['where'](_0x185b('0x66'),_0x3be014);}var _0x4b38e1={'type':db[_0x185b('0x5d')][_0x185b('0x5e')][_0x185b('0x5f')],'raw':!![]};return db[_0x185b('0x61')][_0x185b('0x62')](_0x541624[_0x185b('0x63')](),_0x4b38e1)[_0x185b('0x4a')](function(_0x1ce391){return _0x1ce391[0x0]['COUNT(*)'];});}module[_0x185b('0x67')]={'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 10ebf93..a21493c 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 _0x6cdc=['base64','decryptString','crypto','../../config/environment','../../config/logger','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','final','unlink','decryptFile','createDecipher','close','encryptString','utf8'];(function(_0x291167,_0x482eff){var _0x102c7b=function(_0x5c2d5e){while(--_0x5c2d5e){_0x291167['push'](_0x291167['shift']());}};_0x102c7b(++_0x482eff);}(_0x6cdc,0x1c2));var _0xc6cd=function(_0x11bb60,_0x3dc734){_0x11bb60=_0x11bb60-0x0;var _0x37357e=_0x6cdc[_0x11bb60];return _0x37357e;};'use strict';var crypto=require(_0xc6cd('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require(_0xc6cd('0x1'));var logger=require(_0xc6cd('0x2'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc6cd('0x3')][_0xc6cd('0x4')],'algorithm':_0xc6cd('0x5')};const fileOptions={'algorithm':_0xc6cd('0x6')};if(config[_0xc6cd('0x7')]&&config[_0xc6cd('0x7')][_0xc6cd('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc6cd('0x8')]);if(isSupported){fileOptions[_0xc6cd('0x8')]=config[_0xc6cd('0x7')][_0xc6cd('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config[_0xc6cd('0x7')][_0xc6cd('0x8')],_0xc6cd('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x16d966){return AES_SUPPORTED_RX['test'](_0x16d966);}function getSupportedCiphers(){return crypto[_0xc6cd('0xa')]()[_0xc6cd('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x56281d){return getSupportedCiphers()[_0xc6cd('0xc')](_0x56281d)>-0x1;}function combineOptions(_0x24c59b){var _0x41ef6c={};for(var _0x9a8808 in fileOptions){if(fileOptions[_0xc6cd('0xd')](_0x9a8808)){_0x41ef6c[_0x9a8808]=fileOptions[_0x9a8808];}}if(_0x24c59b){for(var _0x51c03f in _0x24c59b){if(_0x24c59b[_0xc6cd('0xd')](_0x51c03f)){_0x41ef6c[_0x51c03f]=_0x24c59b[_0x51c03f];}}}return _0x41ef6c;}exports[_0xc6cd('0xe')]=function(_0x230ce5,_0x252d9a,_0x7a8584,_0x52a6b0){return new BPromise(function(_0xb282ad,_0x2e16dd){_0x52a6b0=combineOptions(_0x52a6b0);var _0x36dd95=new Buffer(_0x7a8584);var _0x47661c=fs[_0xc6cd('0xf')](_0x230ce5);var _0x8c70d3=fs[_0xc6cd('0x10')](_0x252d9a);var _0x4b8625=crypto[_0xc6cd('0x11')](_0x52a6b0[_0xc6cd('0x8')],_0x36dd95);_0x47661c['on'](_0xc6cd('0x12'),function(_0x11d6c4){var _0xadcd4b=new Buffer(_0x4b8625[_0xc6cd('0x13')](_0x11d6c4),_0xc6cd('0x14'));_0x8c70d3[_0xc6cd('0x15')](_0xadcd4b);});_0x47661c['on'](_0xc6cd('0x16'),function(){try{var _0x375540=new Buffer(_0x4b8625[_0xc6cd('0x17')](_0xc6cd('0x14')),_0xc6cd('0x14'));_0x8c70d3[_0xc6cd('0x15')](_0x375540);_0x8c70d3['end']();_0x8c70d3['on']('close',function(){return _0xb282ad(_0x252d9a);});}catch(_0x38ff11){fs[_0xc6cd('0x18')](_0x252d9a);return _0x2e16dd(_0x38ff11);}});});};exports[_0xc6cd('0x19')]=function(_0x3347f5,_0x182bc1,_0x3d72e0,_0x16730b){return new BPromise(function(_0x5e4a90,_0x299c56){_0x16730b=combineOptions(_0x16730b);var _0x4f504e=new Buffer(_0x3d72e0);var _0x77a5f=fs[_0xc6cd('0xf')](_0x3347f5);var _0x52dce1=fs['createWriteStream'](_0x182bc1);var _0x1f95b8=crypto[_0xc6cd('0x1a')](_0x16730b[_0xc6cd('0x8')],_0x4f504e);_0x77a5f['on']('data',function(_0x52a560){var _0x501995=new Buffer(_0x1f95b8[_0xc6cd('0x13')](_0x52a560),_0xc6cd('0x14'));_0x52dce1['write'](_0x501995);});_0x77a5f['on'](_0xc6cd('0x16'),function(){try{var _0x33db9e=new Buffer(_0x1f95b8[_0xc6cd('0x17')](_0xc6cd('0x14')),_0xc6cd('0x14'));_0x52dce1[_0xc6cd('0x15')](_0x33db9e);_0x52dce1['end']();_0x52dce1['on'](_0xc6cd('0x1b'),function(){return _0x5e4a90(_0x182bc1);});}catch(_0x58c51e){fs[_0xc6cd('0x18')](_0x182bc1);return _0x299c56(_0x58c51e);}});});};exports[_0xc6cd('0x1c')]=function(_0x4526e4,_0x2b30db,_0x32b41f){var _0x30917b=_0x32b41f||stringOptions[_0xc6cd('0x8')];var _0x39dda6=_0x2b30db||stringOptions['secret'];var _0x4e7e24=crypto['createCipher'](_0x30917b,_0x39dda6);var _0x1a7515=_0x4e7e24[_0xc6cd('0x13')](_0x4526e4,_0xc6cd('0x1d'),_0xc6cd('0x1e'));_0x1a7515+=_0x4e7e24[_0xc6cd('0x17')](_0xc6cd('0x1e'));return _0x1a7515;};exports[_0xc6cd('0x1f')]=function(_0x349dd2,_0x47f8ce,_0x3e5dd8){var _0x36751a=_0x3e5dd8||stringOptions[_0xc6cd('0x8')];var _0x425ba9=_0x47f8ce||stringOptions['secret'];var _0x47fb37=crypto[_0xc6cd('0x1a')](_0x36751a,_0x425ba9);var _0x1dd73f=_0x47fb37[_0xc6cd('0x13')](_0x349dd2,_0xc6cd('0x1e'),_0xc6cd('0x1d'));_0x1dd73f+=_0x47fb37[_0xc6cd('0x17')](_0xc6cd('0x1d'));return _0x1dd73f;}; \ No newline at end of file +var _0xb856=['../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final','createDecipher','close','encryptString','secret','createCipher','base64','decryptString','utf8','crypto','lodash','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb856,0x13d));var _0x6b85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb856[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require(_0x6b85('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x6b85('0x1'));var config=require(_0x6b85('0x2'));var logger=require(_0x6b85('0x3'))(_0x6b85('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x6b85('0x5')][_0x6b85('0x6')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x6b85('0x7')};if(config['encrypt']&&config['encrypt']['algorithm']){var isSupported=isAlgorithmSupported(config[_0x6b85('0x8')][_0x6b85('0x9')]);if(isSupported){fileOptions[_0x6b85('0x9')]=config['encrypt'][_0x6b85('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x6b85('0xa')](',\x20');logger[_0x6b85('0xb')](config[_0x6b85('0x8')][_0x6b85('0x9')],_0x6b85('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x47c2e3){return AES_SUPPORTED_RX[_0x6b85('0xd')](_0x47c2e3);}function getSupportedCiphers(){return crypto[_0x6b85('0xe')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0xefafe6){return getSupportedCiphers()['indexOf'](_0xefafe6)>-0x1;}function combineOptions(_0xfc654d){var _0x25c9fc={};for(var _0x5bfb84 in fileOptions){if(fileOptions['hasOwnProperty'](_0x5bfb84)){_0x25c9fc[_0x5bfb84]=fileOptions[_0x5bfb84];}}if(_0xfc654d){for(var _0x56d454 in _0xfc654d){if(_0xfc654d['hasOwnProperty'](_0x56d454)){_0x25c9fc[_0x56d454]=_0xfc654d[_0x56d454];}}}return _0x25c9fc;}exports[_0x6b85('0xf')]=function(_0x7e588a,_0x1904a2,_0x4361d7,_0x315969){return new BPromise(function(_0x4fae84,_0x11a736){_0x315969=combineOptions(_0x315969);var _0x50a921=new Buffer(_0x4361d7);var _0x47db8c=fs[_0x6b85('0x10')](_0x7e588a);var _0x46ce89=fs[_0x6b85('0x11')](_0x1904a2);var _0x26ddcc=crypto['createCipher'](_0x315969[_0x6b85('0x9')],_0x50a921);_0x47db8c['on'](_0x6b85('0x12'),function(_0x288fa9){var _0x406f46=new Buffer(_0x26ddcc[_0x6b85('0x13')](_0x288fa9),_0x6b85('0x14'));_0x46ce89[_0x6b85('0x15')](_0x406f46);});_0x47db8c['on'](_0x6b85('0x16'),function(){try{var _0x1b203e=new Buffer(_0x26ddcc[_0x6b85('0x17')](_0x6b85('0x14')),_0x6b85('0x14'));_0x46ce89[_0x6b85('0x15')](_0x1b203e);_0x46ce89[_0x6b85('0x16')]();_0x46ce89['on']('close',function(){return _0x4fae84(_0x1904a2);});}catch(_0x559dba){fs['unlink'](_0x1904a2);return _0x11a736(_0x559dba);}});});};exports['decryptFile']=function(_0x5cdb54,_0x3cc3bc,_0x2c106f,_0x38e524){return new BPromise(function(_0x4036e8,_0x56486c){_0x38e524=combineOptions(_0x38e524);var _0x23d819=new Buffer(_0x2c106f);var _0x35cb69=fs[_0x6b85('0x10')](_0x5cdb54);var _0x1d2478=fs['createWriteStream'](_0x3cc3bc);var _0x1c2c9b=crypto[_0x6b85('0x18')](_0x38e524['algorithm'],_0x23d819);_0x35cb69['on'](_0x6b85('0x12'),function(_0x21411c){var _0x344a84=new Buffer(_0x1c2c9b[_0x6b85('0x13')](_0x21411c),_0x6b85('0x14'));_0x1d2478[_0x6b85('0x15')](_0x344a84);});_0x35cb69['on'](_0x6b85('0x16'),function(){try{var _0x565183=new Buffer(_0x1c2c9b['final'](_0x6b85('0x14')),_0x6b85('0x14'));_0x1d2478['write'](_0x565183);_0x1d2478['end']();_0x1d2478['on'](_0x6b85('0x19'),function(){return _0x4036e8(_0x3cc3bc);});}catch(_0x37b10e){fs['unlink'](_0x3cc3bc);return _0x56486c(_0x37b10e);}});});};exports[_0x6b85('0x1a')]=function(_0x51812f,_0x5df26a,_0x499d40){var _0x4d4739=_0x499d40||stringOptions[_0x6b85('0x9')];var _0x3f9760=_0x5df26a||stringOptions[_0x6b85('0x1b')];var _0x6fd269=crypto[_0x6b85('0x1c')](_0x4d4739,_0x3f9760);var _0x5129ba=_0x6fd269[_0x6b85('0x13')](_0x51812f,'utf8',_0x6b85('0x1d'));_0x5129ba+=_0x6fd269[_0x6b85('0x17')](_0x6b85('0x1d'));return _0x5129ba;};exports[_0x6b85('0x1e')]=function(_0x39ecb3,_0x1e27a9,_0x4d80de){var _0x23c3c8=_0x4d80de||stringOptions[_0x6b85('0x9')];var _0x42c2f6=_0x1e27a9||stringOptions[_0x6b85('0x1b')];var _0x117f3f=crypto[_0x6b85('0x18')](_0x23c3c8,_0x42c2f6);var _0x284d50=_0x117f3f['update'](_0x39ecb3,'base64',_0x6b85('0x1f'));_0x284d50+=_0x117f3f[_0x6b85('0x17')](_0x6b85('0x1f'));return _0x284d50;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index d414487..a842325 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 _0x38ee=['Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','util','path','lodash','to-csv','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','split','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV'];(function(_0x59888e,_0x2eb24a){var _0xe76e9f=function(_0x27df6f){while(--_0x27df6f){_0x59888e['push'](_0x59888e['shift']());}};_0xe76e9f(++_0x2eb24a);}(_0x38ee,0x113));var _0xe38e=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x38ee[_0x1ab0e6];return _0x248815;};'use strict';var util=require(_0xe38e('0x0'));var path=require(_0xe38e('0x1'));var _=require(_0xe38e('0x2'));var csv=require(_0xe38e('0x3'));var fs=require('fs');var BPromise=require(_0xe38e('0x4'));var zipdir=require(_0xe38e('0x5'));var rimraf=require('rimraf');var db=require(_0xe38e('0x6'))['db'];var dbH=require(_0xe38e('0x6'))[_0xe38e('0x7')];var logger=require(_0xe38e('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xe38e('0x9')][0x3];var PATH=process[_0xe38e('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x441d24,_0x207849){var _0x31e4f7={'status':_0x441d24};var _0x1829ca={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x207849){_0x31e4f7[_0xe38e('0xa')]=_0x207849;}return db[_0xe38e('0xb')][_0xe38e('0xc')](_0x31e4f7,_0x1829ca);}function main(){var _0x463f7c=0x1388;var _0x34f163;logger[_0xe38e('0xd')](util[_0xe38e('0xe')](_0xe38e('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xe38e('0x10')][_0xe38e('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xe38e('0x12')]})[_0xe38e('0x13')](function(_0x395c3f){if(_0x395c3f){_0x34f163=_0x395c3f;_0x463f7c=_0x34f163[_0xe38e('0x12')]||0x1388;}})[_0xe38e('0x13')](function(){return dbH[_0xe38e('0x14')][_0xe38e('0x15')](util[_0xe38e('0xe')](_0xe38e('0x16'),QUERY),{'type':dbH[_0xe38e('0x14')][_0xe38e('0x17')][_0xe38e('0x18')]});})['then'](function(_0x2a321c){if(!_0x2a321c[0x0][_0xe38e('0x19')]){return analyticExtractedReport(_0xe38e('0x1a'));}var _0x263073=[];var _0x22e6ff=0x0;if(_0x34f163[_0xe38e('0x1b')]){if(_0x2a321c&&_0x2a321c[_0xe38e('0x1c')]){var _0x189654=_[_0xe38e('0x1d')](_0x2a321c[0x0][_0xe38e('0x19')]/_0x463f7c);var _0x356bcd=Number[_0xe38e('0x1e')](_0x2a321c[0x0][_0xe38e('0x19')]/_0x463f7c)?_0x2a321c[0x0][_0xe38e('0x19')]%_0x463f7c:0x0;_0x189654[_0xe38e('0x1f')](function(_0x3b99da){if(_0x3b99da>0x0){_0x22e6ff+=_0x463f7c;}_0x263073['push'](dbH[_0xe38e('0x14')][_0xe38e('0x15')](util[_0xe38e('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x463f7c,_0x22e6ff),{'type':dbH['sequelize'][_0xe38e('0x17')][_0xe38e('0x18')]}));});if(_0x356bcd>0x0){_0x22e6ff+=_0x463f7c;_0x263073[_0xe38e('0x20')](dbH[_0xe38e('0x14')][_0xe38e('0x15')](util[_0xe38e('0xe')](_0xe38e('0x21'),QUERY,_0x356bcd,_0x22e6ff),{'type':dbH[_0xe38e('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x263073[_0xe38e('0x20')](dbH[_0xe38e('0x14')]['query'](QUERY,{'type':dbH['sequelize'][_0xe38e('0x17')][_0xe38e('0x18')]}));}var _0x5b1519=path[_0xe38e('0x22')](PATH);var _0x8767f9=path[_0xe38e('0x23')](PATH,_0xe38e('0x24'));var _0x3262eb=_0x34f163[_0xe38e('0x1b')]&&_0x263073[_0xe38e('0x1c')]>0x1;var _0x5d8f24=[];if(!fs[_0xe38e('0x25')](path[_0xe38e('0x26')](_0x5b1519,_0x8767f9))&&_0x3262eb){fs[_0xe38e('0x27')](path[_0xe38e('0x26')](_0x5b1519,_0x8767f9));}return BPromise[_0xe38e('0x28')](_0x263073,function(_0x155cc4){_0x5d8f24[_0xe38e('0x20')](_0x155cc4);})[_0xe38e('0x13')](function(){for(var _0x299e38=0x0;_0x299e38<_0x5d8f24['length'];_0x299e38+=0x1){var _0x1f3834;var _0x25791c=_0x5d8f24[_0x299e38];if(_0x3262eb){_0x1f3834=path['join'](_0x5b1519,_0x8767f9,util[_0xe38e('0xe')](_0xe38e('0x29'),_0x8767f9,_0x299e38,'csv'));}else{_0x1f3834=path['join'](_0x5b1519,util[_0xe38e('0xe')]('%s.%s',_0x8767f9,_0xe38e('0x2a')));}fs[_0xe38e('0x2b')](_0x1f3834,csv(_0x25791c));}})[_0xe38e('0x13')](function(){if(_0x3262eb){return new Promise(function(_0x39627b){zipdir(path[_0xe38e('0x26')](_0x5b1519,_0x8767f9),{'saveTo':path['join'](_0x5b1519,util[_0xe38e('0xe')](_0xe38e('0x2c'),_0x8767f9,_0xe38e('0x2d')))},function(_0x2a3482,_0x27904b){rimraf(path['join'](_0x5b1519,_0x8767f9),function(){});_0x39627b(_0xe38e('0x2e'));});});}})['then'](function(){logger['info'](util[_0xe38e('0xe')](_0xe38e('0x2f'),EXTRACTED_REPORT_ID,_0xe38e('0x30')));return analyticExtractedReport(_0xe38e('0x31'),_0x3262eb?util[_0xe38e('0xe')](_0xe38e('0x2c'),_0x8767f9,_0x3262eb?'zip':_0xe38e('0x2a')):null);});})[_0xe38e('0x32')](function(_0x335b95){logger[_0xe38e('0xd')](util[_0xe38e('0xe')](_0xe38e('0x33'),EXTRACTED_REPORT_ID,_0xe38e('0x30')),util[_0xe38e('0x34')](_0x335b95,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe38e('0x35'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5859=['analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','query','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','../../mysqldb','../../config/logger'];(function(_0x10a09c,_0x1cad85){var _0x54dd51=function(_0x4588e5){while(--_0x4588e5){_0x10a09c['push'](_0x10a09c['shift']());}};_0x54dd51(++_0x1cad85);}(_0x5859,0xfd));var _0x9585=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x5859[_0x5f1391];return _0x50ebe3;};'use strict';var util=require(_0x9585('0x0'));var path=require(_0x9585('0x1'));var _=require(_0x9585('0x2'));var csv=require(_0x9585('0x3'));var fs=require('fs');var BPromise=require(_0x9585('0x4'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x9585('0x5'))['db'];var dbH=require(_0x9585('0x5'))['dbH'];var logger=require(_0x9585('0x6'))(_0x9585('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x9585('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x9585('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4de32d,_0x502369){var _0x2b2704={'status':_0x4de32d};var _0x2f9802={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x502369){_0x2b2704[_0x9585('0x9')]=_0x502369;}return db[_0x9585('0xa')][_0x9585('0xb')](_0x2b2704,_0x2f9802);}function main(){var _0x10efe1=0x1388;var _0x576860;logger[_0x9585('0xc')](util[_0x9585('0xd')](_0x9585('0xe'),EXTRACTED_REPORT_ID,_0x9585('0xf')));return db[_0x9585('0x10')][_0x9585('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9585('0x12'),_0x9585('0x13')]})[_0x9585('0x14')](function(_0x599287){if(_0x599287){_0x576860=_0x599287;_0x10efe1=_0x576860[_0x9585('0x13')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x9585('0x15')](util[_0x9585('0xd')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x9585('0x16')][_0x9585('0x17')][_0x9585('0x18')]});})[_0x9585('0x14')](function(_0x472ee9){if(!_0x472ee9[0x0][_0x9585('0x19')]){return analyticExtractedReport(_0x9585('0x1a'));}var _0x15af8d=[];var _0x3ab00a=0x0;if(_0x576860[_0x9585('0x12')]){if(_0x472ee9&&_0x472ee9[_0x9585('0x1b')]){var _0x30c909=_[_0x9585('0x1c')](_0x472ee9[0x0][_0x9585('0x19')]/_0x10efe1);var _0xea9b04=Number[_0x9585('0x1d')](_0x472ee9[0x0][_0x9585('0x19')]/_0x10efe1)?_0x472ee9[0x0]['num']%_0x10efe1:0x0;_0x30c909[_0x9585('0x1e')](function(_0x19af80){if(_0x19af80>0x0){_0x3ab00a+=_0x10efe1;}_0x15af8d[_0x9585('0x1f')](dbH['sequelize'][_0x9585('0x15')](util[_0x9585('0xd')](_0x9585('0x20'),QUERY,_0x10efe1,_0x3ab00a),{'type':dbH[_0x9585('0x16')][_0x9585('0x17')][_0x9585('0x18')]}));});if(_0xea9b04>0x0){_0x3ab00a+=_0x10efe1;_0x15af8d[_0x9585('0x1f')](dbH[_0x9585('0x16')][_0x9585('0x15')](util[_0x9585('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xea9b04,_0x3ab00a),{'type':dbH['sequelize'][_0x9585('0x17')][_0x9585('0x18')]}));}}}else{_0x15af8d[_0x9585('0x1f')](dbH[_0x9585('0x16')][_0x9585('0x15')](QUERY,{'type':dbH['sequelize'][_0x9585('0x17')][_0x9585('0x18')]}));}var _0x456a9c=path['dirname'](PATH);var _0x3c31ef=path[_0x9585('0x21')](PATH,_0x9585('0x22'));var _0x4dad52=_0x576860[_0x9585('0x12')]&&_0x15af8d[_0x9585('0x1b')]>0x1;var _0x36f758=[];if(!fs[_0x9585('0x23')](path[_0x9585('0x24')](_0x456a9c,_0x3c31ef))&&_0x4dad52){fs[_0x9585('0x25')](path[_0x9585('0x24')](_0x456a9c,_0x3c31ef));}return BPromise[_0x9585('0x26')](_0x15af8d,function(_0x181820){_0x36f758[_0x9585('0x1f')](_0x181820);})['then'](function(){for(var _0x2e3016=0x0;_0x2e3016<_0x36f758[_0x9585('0x1b')];_0x2e3016+=0x1){var _0x31ea59;var _0x2edbf8=_0x36f758[_0x2e3016];if(_0x4dad52){_0x31ea59=path[_0x9585('0x24')](_0x456a9c,_0x3c31ef,util[_0x9585('0xd')](_0x9585('0x27'),_0x3c31ef,_0x2e3016,_0x9585('0x28')));}else{_0x31ea59=path[_0x9585('0x24')](_0x456a9c,util[_0x9585('0xd')](_0x9585('0x29'),_0x3c31ef,_0x9585('0x28')));}fs[_0x9585('0x2a')](_0x31ea59,csv(_0x2edbf8));}})[_0x9585('0x14')](function(){if(_0x4dad52){return new Promise(function(_0x1f9c8a){zipdir(path[_0x9585('0x24')](_0x456a9c,_0x3c31ef),{'saveTo':path[_0x9585('0x24')](_0x456a9c,util[_0x9585('0xd')](_0x9585('0x29'),_0x3c31ef,_0x9585('0x2b')))},function(_0xe6f09a,_0x1a7616){rimraf(path['join'](_0x456a9c,_0x3c31ef),function(){});_0x1f9c8a(_0x9585('0x2c'));});});}})[_0x9585('0x14')](function(){logger[_0x9585('0xc')](util[_0x9585('0xd')](_0x9585('0x2d'),EXTRACTED_REPORT_ID,_0x9585('0xf')));return analyticExtractedReport(_0x9585('0x2e'),_0x4dad52?util[_0x9585('0xd')](_0x9585('0x29'),_0x3c31ef,_0x4dad52?_0x9585('0x2b'):'csv'):null);});})[_0x9585('0x2f')](function(_0x5b48ac){logger[_0x9585('0xc')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x9585('0x30')](_0x5b48ac,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9585('0x31'));})[_0x9585('0x32')](function(){process[_0x9585('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 1f3f806..def607a 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 _0x3c9c=['createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Failed','/fonts/arial-regular.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','footer','pipe','finish','error','end','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','body','concat','chunk','keys','push','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','header','pageBreak','before','margin','landscape','\x20/\x20','Arial','black','right','Empty','Setting','split','splitSizePdf','then','range','num','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','existsSync','join','flatten'];(function(_0x1ba123,_0xfd52d0){var _0x576bd4=function(_0x4bcc2c){while(--_0x4bcc2c){_0x1ba123['push'](_0x1ba123['shift']());}};_0x576bd4(++_0xfd52d0);}(_0x3c9c,0x17d));var _0xc3c9=function(_0x4d829d,_0x583866){_0x4d829d=_0x4d829d-0x0;var _0x292c64=_0x3c9c[_0x4d829d];return _0x292c64;};'use strict';var _=require(_0xc3c9('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xc3c9('0x1'));var moment=require(_0xc3c9('0x2'));var htmlToPdfmake=require(_0xc3c9('0x3'));var PdfPrinter=require(_0xc3c9('0x4'));var zipdir=require(_0xc3c9('0x5'));var rimraf=require(_0xc3c9('0x6'));var JSDOM=require(_0xc3c9('0x7'))[_0xc3c9('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0xc3c9('0x9'));var db=require(_0xc3c9('0xa'))['db'];var dbH=require('../../mysqldb')[_0xc3c9('0xb')];var logger=require(_0xc3c9('0xc'))(_0xc3c9('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xc3c9('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc3c9('0xe')][0x4];var NAME=process[_0xc3c9('0xe')][0x5];var FORMAT=_0xc3c9('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x21916e,_0x226525){var _0x5a5ffa={'status':_0x21916e};var _0x35e5b6={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x226525){_0x5a5ffa[_0xc3c9('0x10')]=_0x226525;}return db['AnalyticExtractedReport'][_0xc3c9('0x11')](_0x5a5ffa,_0x35e5b6);}function getHeaders(_0x497259){return _[_0xc3c9('0x12')](_0x497259,function(_0x46ec0d){return{'text':_0x46ec0d,'style':_0xc3c9('0x13')};});}function getRows(_0x37cea5,_0x102f5a){return _[_0xc3c9('0x12')](_0x102f5a,function(_0x52f629){return _(_0x52f629)[_0xc3c9('0x14')](_0x37cea5)['map'](function(_0x525dcc){return _0x525dcc?_[_0xc3c9('0x15')](_0x525dcc):'';})[_0xc3c9('0x16')]();});}function createTable(_0x2bd39c,_0xabeae7){var _0x1a3ce8={'widths':_[_0xc3c9('0x17')](Array(_0x2bd39c[_0xc3c9('0x18')]),0x91),'heights':function(_0x3d11a1){return _0x3d11a1===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x412020=getHeaders(_0x2bd39c);_0x1a3ce8[_0xc3c9('0x19')]['push'](_0x412020);var _0x34359f=getRows(_0x2bd39c,_0xabeae7);_0x1a3ce8[_0xc3c9('0x19')]=_0x1a3ce8[_0xc3c9('0x19')][_0xc3c9('0x1a')](_0x34359f);return _0x1a3ce8;}function createTables(_0x13cb82){var _0x5988dd=[];var _0x283859=_[_0xc3c9('0x1b')](Object[_0xc3c9('0x1c')](_0x13cb82[0x0]),0x5);_0x283859['forEach'](function(_0x38dc5c){_0x5988dd[_0xc3c9('0x1d')](createTable(_0x38dc5c,_0x13cb82));});return _0x5988dd;}function getPDFDocDefinition(_0x4e0bf2){var _0x33a088=util[_0xc3c9('0x1e')](_0xc3c9('0x1f'),NAME,EXTRACTED_REPORT[_0xc3c9('0x20')],moment(EXTRACTED_REPORT['startDate'])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xc3c9('0x1e')](FORMAT));var _0x29d026=[];for(var _0x42e1fe=0x0;_0x42e1fe<_0x4e0bf2[_0xc3c9('0x18')];_0x42e1fe++){var _0x2b46dd=[];if(_0x42e1fe===0x0){_0x2b46dd[_0xc3c9('0x1d')]({'text':_0x33a088,'style':_0xc3c9('0x21')});}var _0x556d1f={'table':_0x4e0bf2[_0x42e1fe]};if(_0x42e1fe>0x0){_0x556d1f[_0xc3c9('0x22')]=_0xc3c9('0x23');_0x556d1f[_0xc3c9('0x24')]=[0x0,0x46,0x0,0x0];}_0x2b46dd[_0xc3c9('0x1d')](_0x556d1f);_0x29d026[_0xc3c9('0x1d')](_0x2b46dd);}return{'pageSize':'A4','pageOrientation':_0xc3c9('0x25'),'content':_0x29d026,'footer':function(_0x451707,_0x1fd1a){return{'text':_0x451707[_0xc3c9('0x15')]()+_0xc3c9('0x26')+_0x1fd1a,'style':'footer'};},'defaultStyle':{'font':_0xc3c9('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc3c9('0x28')},'footer':{'alignment':_0xc3c9('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5e2196){var _0x2924d6=0x1388;var _0x153a53;if(!_0x5e2196[0x0]['num']){return analyticExtractedReport(_0xc3c9('0x2a'));}return db[_0xc3c9('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc3c9('0x2c'),_0xc3c9('0x2d')]})[_0xc3c9('0x2e')](function(_0x190482){if(_0x190482){_0x153a53=_0x190482;_0x2924d6=_0x153a53['splitSizePdf']||0x3e8;}})[_0xc3c9('0x2e')](function(){var _0x34ddff=[];var _0x4e9575=0x0;if(_0x153a53[_0xc3c9('0x2c')]){if(_0x5e2196&&_0x5e2196['length']){var _0x529c6e=_[_0xc3c9('0x2f')](_0x5e2196[0x0][_0xc3c9('0x30')]/_0x2924d6);var _0xef90a5=Number[_0xc3c9('0x31')](_0x5e2196[0x0][_0xc3c9('0x30')]/_0x2924d6)?_0x5e2196[0x0][_0xc3c9('0x30')]%_0x2924d6:0x0;_0x529c6e[_0xc3c9('0x32')](function(_0x435455){if(_0x435455>0x0){_0x4e9575+=_0x2924d6;}_0x34ddff[_0xc3c9('0x1d')](dbH['sequelize'][_0xc3c9('0x33')](util[_0xc3c9('0x1e')](_0xc3c9('0x34'),QUERY,_0x2924d6,_0x4e9575),{'type':dbH['sequelize'][_0xc3c9('0x35')][_0xc3c9('0x36')]}));});if(_0xef90a5>0x0){_0x4e9575+=_0x2924d6;_0x34ddff[_0xc3c9('0x1d')](dbH['sequelize'][_0xc3c9('0x33')](util['format'](_0xc3c9('0x34'),QUERY,_0xef90a5,_0x4e9575),{'type':dbH[_0xc3c9('0x37')][_0xc3c9('0x35')][_0xc3c9('0x36')]}));}}}else{_0x34ddff[_0xc3c9('0x1d')](dbH[_0xc3c9('0x37')][_0xc3c9('0x33')](QUERY,{'type':dbH[_0xc3c9('0x37')][_0xc3c9('0x35')][_0xc3c9('0x36')]}));}var _0x94d1c6=path['dirname'](PATH);var _0x397267=path['basename'](PATH,'.pdf');var _0x242a06=_0x153a53[_0xc3c9('0x2c')]&&_0x34ddff[_0xc3c9('0x18')]>0x1;var _0x4293e5=[];if(!fs[_0xc3c9('0x38')](path[_0xc3c9('0x39')](_0x94d1c6,_0x397267))&&_0x242a06){fs['mkdirSync'](path['join'](_0x94d1c6,_0x397267));}return BPromise['each'](_0x34ddff,function(_0x3a7e61){_0x4293e5[_0xc3c9('0x1d')](_0x3a7e61);})[_0xc3c9('0x2e')](function(){var _0x3bed4b=[];for(var _0xa11709=0x0;_0xa11709<_0x4293e5[_0xc3c9('0x18')];_0xa11709+=0x1){var _0x4d162c=_0x4293e5[_0xa11709];var _0x376215=createTables(_[_0xc3c9('0x3a')](_0x4d162c));var _0x3f2f50;var _0x250359=getPDFDocDefinition(_0x376215);var _0x8f5ef2=getPDFPrinter();var _0x594bad=_0x8f5ef2[_0xc3c9('0x3b')](_0x250359);if(_0x242a06){_0x3f2f50=path[_0xc3c9('0x39')](_0x94d1c6,_0x397267,util[_0xc3c9('0x1e')](_0xc3c9('0x3c'),_0x397267,_0xa11709,_0xc3c9('0x3d')));}else{_0x3f2f50=path[_0xc3c9('0x39')](_0x94d1c6,util['format'](_0xc3c9('0x3e'),_0x397267,_0xc3c9('0x3d')));}_0x3bed4b[_0xc3c9('0x1d')](writePDFDocument(_0x594bad,_0x3f2f50));}return Promise[_0xc3c9('0x3f')](_0x3bed4b);})['then'](function(){if(_0x242a06){return new Promise(function(_0x1a0f6e){zipdir(path[_0xc3c9('0x39')](_0x94d1c6,_0x397267),{'saveTo':path[_0xc3c9('0x39')](_0x94d1c6,util[_0xc3c9('0x1e')](_0xc3c9('0x3e'),_0x397267,_0xc3c9('0x40')))},function(){rimraf(path['join'](_0x94d1c6,_0x397267),function(){});_0x1a0f6e('zip\x20finished');});});}})[_0xc3c9('0x2e')](function(){if(!_0x242a06)return;rimraf(path[_0xc3c9('0x39')](_0x94d1c6,_0x397267),function(){});})[_0xc3c9('0x2e')](function(){logger[_0xc3c9('0x41')](util['format'](_0xc3c9('0x42'),EXTRACTED_REPORT_ID,_0xc3c9('0x43')));return analyticExtractedReport(_0xc3c9('0x44'),_0x242a06?util[_0xc3c9('0x1e')](_0xc3c9('0x3e'),_0x397267,_0x242a06?_0xc3c9('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xc3c9('0x1e')](_0xc3c9('0x45'),EXTRACTED_REPORT_ID,_0xc3c9('0x43')));return db[_0xc3c9('0x46')][_0xc3c9('0x47')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc3c9('0x2e')](function(_0x14a858){EXTRACTED_REPORT=_0x14a858;return dbH['sequelize'][_0xc3c9('0x33')](util[_0xc3c9('0x1e')](_0xc3c9('0x48'),QUERY),{'type':dbH[_0xc3c9('0x37')]['QueryTypes'][_0xc3c9('0x36')]});})[_0xc3c9('0x2e')](extractReport)[_0xc3c9('0x49')](function(_0x48c61c){logger[_0xc3c9('0x41')](util[_0xc3c9('0x1e')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc3c9('0x43')),util['inspect'](_0x48c61c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc3c9('0x4a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x39f15d=new PdfPrinter({'Arial':{'normal':__dirname+_0xc3c9('0x4b'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x39f15d;}function getPDFDocDefinitionFromHTML(_0x5885db,_0x27fd53){var _0x65a546=util[_0xc3c9('0x1e')](_0xc3c9('0x4c'),_0x27fd53[_0xc3c9('0x4d')],_0x27fd53[_0xc3c9('0x4e')]);var _0x533bd7=moment()['format'](_0xc3c9('0x4f'))[_0xc3c9('0x15')]();var _0x31fc29=htmlToPdfmake(_0x5885db,{'window':window,'tableAutoSize':!![]});return{'content':[_0x31fc29],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc3c9('0x50'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc3c9('0x50'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0xc3c9('0x51'),'style':_0xc3c9('0x21')}];},'footer':function(_0x26c839,_0x57390e){return[{'text':util[_0xc3c9('0x1e')](_0xc3c9('0x52'),_0x65a546,_0x26c839,_0x57390e,_0x533bd7),'style':_0xc3c9('0x53')}];}};}function writePDFDocument(_0x56ff92,_0x1f8ba4){return new Promise(function(_0x2a75d5,_0x5befad){var _0x56534b=_0x56ff92[_0xc3c9('0x54')](fs['createWriteStream'](_0x1f8ba4));_0x56534b['on'](_0xc3c9('0x55'),function(){_0x2a75d5(_0xc3c9('0x55'));});_0x56534b['on'](_0xc3c9('0x56'),function(_0x21faa9){_0x5befad(_0x21faa9);});_0x56ff92[_0xc3c9('0x57')]();});}exports['createPdfFromHTML']=function(_0x25803f,_0x443383){var _0x548bf7=getPDFPrinter();var _0x530f38=getPDFDocDefinitionFromHTML(_0x25803f,_0x443383);var _0x1b4cb8=_0x548bf7[_0xc3c9('0x3b')](_0x530f38);return writePDFDocument(_0x1b4cb8,_0x443383[_0xc3c9('0x1')])['catch'](function(_0x3d75c9){throw _0x3d75c9;});}; \ No newline at end of file +var _0xe873=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','path','catch','util','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','\x20/\x20','footer','black','right','num','Empty','Setting','find','split','splitSizePdf','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','SELECT','basename','.pdf','existsSync','join','mkdirSync','each','then','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','info','PDF','Completed','findOne'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0xe873,0x1db));var _0x3e87=function(_0x4cfd0d,_0x1693d1){_0x4cfd0d=_0x4cfd0d-0x0;var _0x5587f4=_0xe873[_0x4cfd0d];return _0x5587f4;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x3e87('0x0'));var path=require('path');var moment=require(_0x3e87('0x1'));var htmlToPdfmake=require(_0x3e87('0x2'));var PdfPrinter=require(_0x3e87('0x3'));var zipdir=require(_0x3e87('0x4'));var rimraf=require(_0x3e87('0x5'));var JSDOM=require(_0x3e87('0x6'))[_0x3e87('0x7')];var window=new JSDOM('')['window'];var BPromise=require(_0x3e87('0x8'));var db=require(_0x3e87('0x9'))['db'];var dbH=require(_0x3e87('0x9'))[_0x3e87('0xa')];var logger=require(_0x3e87('0xb'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x3e87('0xc')][0x2]);var QUERY=process[_0x3e87('0xc')][0x3];var PATH=process[_0x3e87('0xc')][0x4];var NAME=process[_0x3e87('0xc')][0x5];var FORMAT=_0x3e87('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x4d26f6,_0x5cedfe){var _0x493d12={'status':_0x4d26f6};var _0x35478c={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5cedfe){_0x493d12[_0x3e87('0xe')]=_0x5cedfe;}return db['AnalyticExtractedReport'][_0x3e87('0xf')](_0x493d12,_0x35478c);}function getHeaders(_0x242b45){return _[_0x3e87('0x10')](_0x242b45,function(_0x450469){return{'text':_0x450469,'style':_0x3e87('0x11')};});}function getRows(_0x14a16b,_0x5eb5ca){return _[_0x3e87('0x10')](_0x5eb5ca,function(_0x5bd9e0){return _(_0x5bd9e0)[_0x3e87('0x12')](_0x14a16b)[_0x3e87('0x10')](function(_0x421929){return _0x421929?_[_0x3e87('0x13')](_0x421929):'';})[_0x3e87('0x14')]();});}function createTable(_0x437d98,_0x398002){var _0x3a6d39={'widths':_[_0x3e87('0x15')](Array(_0x437d98[_0x3e87('0x16')]),0x91),'heights':function(_0x9d4717){return _0x9d4717===0x0?_0x3e87('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x10db65=getHeaders(_0x437d98);_0x3a6d39[_0x3e87('0x18')][_0x3e87('0x19')](_0x10db65);var _0x492c16=getRows(_0x437d98,_0x398002);_0x3a6d39[_0x3e87('0x18')]=_0x3a6d39[_0x3e87('0x18')][_0x3e87('0x1a')](_0x492c16);return _0x3a6d39;}function createTables(_0x109546){var _0x156660=[];var _0x3baf47=_[_0x3e87('0x1b')](Object[_0x3e87('0x1c')](_0x109546[0x0]),0x5);_0x3baf47[_0x3e87('0x1d')](function(_0x2f13d2){_0x156660['push'](createTable(_0x2f13d2,_0x109546));});return _0x156660;}function getPDFDocDefinition(_0x3adc76){var _0x370fef=util[_0x3e87('0x1e')](_0x3e87('0x1f'),NAME,EXTRACTED_REPORT[_0x3e87('0x20')],moment(EXTRACTED_REPORT['startDate'])[_0x3e87('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x3e87('0x21')])[_0x3e87('0x1e')](FORMAT));var _0x3bc5f5=[];for(var _0x564b3f=0x0;_0x564b3f<_0x3adc76[_0x3e87('0x16')];_0x564b3f++){var _0x4203ef=[];if(_0x564b3f===0x0){_0x4203ef[_0x3e87('0x19')]({'text':_0x370fef,'style':_0x3e87('0x22')});}var _0x217889={'table':_0x3adc76[_0x564b3f]};if(_0x564b3f>0x0){_0x217889[_0x3e87('0x23')]=_0x3e87('0x24');_0x217889['margin']=[0x0,0x46,0x0,0x0];}_0x4203ef[_0x3e87('0x19')](_0x217889);_0x3bc5f5[_0x3e87('0x19')](_0x4203ef);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x3bc5f5,'footer':function(_0x33d34a,_0xf5436f){return{'text':_0x33d34a[_0x3e87('0x13')]()+_0x3e87('0x25')+_0xf5436f,'style':_0x3e87('0x26')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x3e87('0x27')},'footer':{'alignment':_0x3e87('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x1129b5){var _0x17af72=0x1388;var _0x4cb7c7;if(!_0x1129b5[0x0][_0x3e87('0x29')]){return analyticExtractedReport(_0x3e87('0x2a'));}return db[_0x3e87('0x2b')][_0x3e87('0x2c')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e87('0x2d'),_0x3e87('0x2e')]})['then'](function(_0x4cc852){if(_0x4cc852){_0x4cb7c7=_0x4cc852;_0x17af72=_0x4cb7c7[_0x3e87('0x2e')]||0x3e8;}})['then'](function(){var _0x224c6c=[];var _0xbe5d43=0x0;if(_0x4cb7c7[_0x3e87('0x2d')]){if(_0x1129b5&&_0x1129b5[_0x3e87('0x16')]){var _0x5d43b8=_[_0x3e87('0x2f')](_0x1129b5[0x0][_0x3e87('0x29')]/_0x17af72);var _0x54a95e=Number[_0x3e87('0x30')](_0x1129b5[0x0][_0x3e87('0x29')]/_0x17af72)?_0x1129b5[0x0][_0x3e87('0x29')]%_0x17af72:0x0;_0x5d43b8[_0x3e87('0x1d')](function(_0x395117){if(_0x395117>0x0){_0xbe5d43+=_0x17af72;}_0x224c6c[_0x3e87('0x19')](dbH[_0x3e87('0x31')]['query'](util[_0x3e87('0x1e')](_0x3e87('0x32'),QUERY,_0x17af72,_0xbe5d43),{'type':dbH[_0x3e87('0x31')]['QueryTypes']['SELECT']}));});if(_0x54a95e>0x0){_0xbe5d43+=_0x17af72;_0x224c6c[_0x3e87('0x19')](dbH[_0x3e87('0x31')][_0x3e87('0x33')](util[_0x3e87('0x1e')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x54a95e,_0xbe5d43),{'type':dbH[_0x3e87('0x31')][_0x3e87('0x34')][_0x3e87('0x35')]}));}}}else{_0x224c6c[_0x3e87('0x19')](dbH['sequelize'][_0x3e87('0x33')](QUERY,{'type':dbH[_0x3e87('0x31')]['QueryTypes'][_0x3e87('0x35')]}));}var _0x51c7f0=path['dirname'](PATH);var _0x39bbdf=path[_0x3e87('0x36')](PATH,_0x3e87('0x37'));var _0x9f973e=_0x4cb7c7[_0x3e87('0x2d')]&&_0x224c6c[_0x3e87('0x16')]>0x1;var _0x3855cc=[];if(!fs[_0x3e87('0x38')](path[_0x3e87('0x39')](_0x51c7f0,_0x39bbdf))&&_0x9f973e){fs[_0x3e87('0x3a')](path[_0x3e87('0x39')](_0x51c7f0,_0x39bbdf));}return BPromise[_0x3e87('0x3b')](_0x224c6c,function(_0x3d114e){_0x3855cc[_0x3e87('0x19')](_0x3d114e);})[_0x3e87('0x3c')](function(){var _0x252f28=[];for(var _0x4b6856=0x0;_0x4b6856<_0x3855cc[_0x3e87('0x16')];_0x4b6856+=0x1){var _0x5164d2=_0x3855cc[_0x4b6856];var _0xd47b79=createTables(_['flatten'](_0x5164d2));var _0x43b952;var _0x4c7ad9=getPDFDocDefinition(_0xd47b79);var _0x4a4b7f=getPDFPrinter();var _0x44c4a9=_0x4a4b7f[_0x3e87('0x3d')](_0x4c7ad9);if(_0x9f973e){_0x43b952=path[_0x3e87('0x39')](_0x51c7f0,_0x39bbdf,util[_0x3e87('0x1e')](_0x3e87('0x3e'),_0x39bbdf,_0x4b6856,_0x3e87('0x3f')));}else{_0x43b952=path[_0x3e87('0x39')](_0x51c7f0,util[_0x3e87('0x1e')](_0x3e87('0x40'),_0x39bbdf,_0x3e87('0x3f')));}_0x252f28[_0x3e87('0x19')](writePDFDocument(_0x44c4a9,_0x43b952));}return Promise['all'](_0x252f28);})['then'](function(){if(_0x9f973e){return new Promise(function(_0x189228){zipdir(path[_0x3e87('0x39')](_0x51c7f0,_0x39bbdf),{'saveTo':path[_0x3e87('0x39')](_0x51c7f0,util[_0x3e87('0x1e')](_0x3e87('0x40'),_0x39bbdf,_0x3e87('0x41')))},function(){rimraf(path['join'](_0x51c7f0,_0x39bbdf),function(){});_0x189228(_0x3e87('0x42'));});});}})[_0x3e87('0x3c')](function(){if(!_0x9f973e)return;rimraf(path[_0x3e87('0x39')](_0x51c7f0,_0x39bbdf),function(){});})[_0x3e87('0x3c')](function(){logger[_0x3e87('0x43')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3e87('0x44')));return analyticExtractedReport(_0x3e87('0x45'),_0x9f973e?util[_0x3e87('0x1e')]('%s.%s',_0x39bbdf,_0x9f973e?_0x3e87('0x41'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x3e87('0x43')](util[_0x3e87('0x1e')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3e87('0x44')));return db['AnalyticExtractedReport'][_0x3e87('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x3e87('0x3c')](function(_0x1ea9ba){EXTRACTED_REPORT=_0x1ea9ba;return dbH[_0x3e87('0x31')][_0x3e87('0x33')](util[_0x3e87('0x1e')](_0x3e87('0x47'),QUERY),{'type':dbH[_0x3e87('0x31')][_0x3e87('0x34')][_0x3e87('0x35')]});})['then'](extractReport)['catch'](function(_0x1aebb3){logger[_0x3e87('0x43')](util['format'](_0x3e87('0x48'),EXTRACTED_REPORT_ID,'PDF'),util[_0x3e87('0x49')](_0x1aebb3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3e87('0x4a'));})[_0x3e87('0x4b')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x2e3d89=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x3e87('0x4c'),'italics':__dirname+_0x3e87('0x4d'),'bolditalics':__dirname+_0x3e87('0x4e')}});return _0x2e3d89;}function getPDFDocDefinitionFromHTML(_0x5d619d,_0x82aea5){var _0x5246d9=util[_0x3e87('0x1e')](_0x3e87('0x4f'),_0x82aea5['channel'],_0x82aea5[_0x3e87('0x50')]);var _0x53b4d2=moment()[_0x3e87('0x1e')](_0x3e87('0x51'))[_0x3e87('0x13')]();var _0x2fe4a3=htmlToPdfmake(_0x5d619d,{'window':window,'tableAutoSize':!![]});return{'content':[_0x2fe4a3],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x3e87('0x52'),'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':_0x3e87('0x52')}},'header':function(){return[{'text':'Interaction\x20Transcript','style':'header'}];},'footer':function(_0x42483f,_0x59491f){return[{'text':util[_0x3e87('0x1e')](_0x3e87('0x53'),_0x5246d9,_0x42483f,_0x59491f,_0x53b4d2),'style':_0x3e87('0x26')}];}};}function writePDFDocument(_0x16b08c,_0x84b6b6){return new Promise(function(_0x15a670,_0x111460){var _0xb2eab1=_0x16b08c[_0x3e87('0x54')](fs[_0x3e87('0x55')](_0x84b6b6));_0xb2eab1['on'](_0x3e87('0x56'),function(){_0x15a670(_0x3e87('0x56'));});_0xb2eab1['on'](_0x3e87('0x57'),function(_0x16a32b){_0x111460(_0x16a32b);});_0x16b08c[_0x3e87('0x58')]();});}exports['createPdfFromHTML']=function(_0x3d49f2,_0x4a2136){var _0x2385ac=getPDFPrinter();var _0x7da606=getPDFDocDefinitionFromHTML(_0x3d49f2,_0x4a2136);var _0x34b6b8=_0x2385ac[_0x3e87('0x3d')](_0x7da606);return writePDFDocument(_0x34b6b8,_0x4a2136[_0x3e87('0x59')])[_0x3e87('0x5a')](function(_0x54e421){throw _0x54e421;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 93d414b..2d4b788 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 _0x6123=['finally','exit','path','lodash','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','XLSX','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','length','range','isInteger','forEach','push','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','Completed','catch','Failed'];(function(_0x10d670,_0x178996){var _0x20d6f8=function(_0x4a4b87){while(--_0x4a4b87){_0x10d670['push'](_0x10d670['shift']());}};_0x20d6f8(++_0x178996);}(_0x6123,0x1e2));var _0x3612=function(_0x16637f,_0x49c8ec){_0x16637f=_0x16637f-0x0;var _0xb9441c=_0x6123[_0x16637f];return _0xb9441c;};'use strict';var util=require('util');var path=require(_0x3612('0x0'));var _=require(_0x3612('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x3612('0x2'));var zipdir=require(_0x3612('0x3'));var rimraf=require('rimraf');var db=require(_0x3612('0x4'))['db'];var dbH=require(_0x3612('0x4'))[_0x3612('0x5')];var logger=require(_0x3612('0x6'))(_0x3612('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x3612('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x3612('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b6890,_0x5c768b){var _0x9ea90c={'status':_0x5b6890};var _0x25955b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c768b){_0x9ea90c['savename']=_0x5c768b;}return db[_0x3612('0x9')][_0x3612('0xa')](_0x9ea90c,_0x25955b);}function main(){var _0x1f58f3=0x1388;var _0xc739fd;logger[_0x3612('0xb')](util[_0x3612('0xc')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3612('0xd')));return db['Setting'][_0x3612('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3612('0xf'),_0x3612('0x10')]})[_0x3612('0x11')](function(_0xc40f7d){if(_0xc40f7d){_0xc739fd=_0xc40f7d;_0x1f58f3=_0xc739fd[_0x3612('0x10')]||0x1388;}})[_0x3612('0x11')](function(){return dbH['sequelize']['query'](util[_0x3612('0xc')](_0x3612('0x12'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x3612('0x13')]});})[_0x3612('0x11')](function(_0x576fa8){if(!_0x576fa8[0x0][_0x3612('0x14')]){return analyticExtractedReport(_0x3612('0x15'));}var _0x3b68d7=[];var _0x425eda=0x0;if(_0xc739fd['split']){if(_0x576fa8&&_0x576fa8[_0x3612('0x16')]){var _0x53688e=_[_0x3612('0x17')](_0x576fa8[0x0]['num']/_0x1f58f3);var _0x371a6f=Number[_0x3612('0x18')](_0x576fa8[0x0][_0x3612('0x14')]/_0x1f58f3)?_0x576fa8[0x0]['num']%_0x1f58f3:0x0;_0x53688e[_0x3612('0x19')](function(_0x1ababd){if(_0x1ababd>0x0){_0x425eda+=_0x1f58f3;}_0x3b68d7[_0x3612('0x1a')](dbH[_0x3612('0x1b')][_0x3612('0x1c')](util[_0x3612('0xc')](_0x3612('0x1d'),QUERY,_0x1f58f3,_0x425eda),{'type':dbH['sequelize']['QueryTypes'][_0x3612('0x13')]}));});if(_0x371a6f>0x0){_0x425eda+=_0x1f58f3;_0x3b68d7[_0x3612('0x1a')](dbH['sequelize'][_0x3612('0x1c')](util[_0x3612('0xc')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x371a6f,_0x425eda),{'type':dbH[_0x3612('0x1b')][_0x3612('0x1e')][_0x3612('0x13')]}));}}}else{_0x3b68d7['push'](dbH[_0x3612('0x1b')][_0x3612('0x1c')](QUERY,{'type':dbH['sequelize'][_0x3612('0x1e')]['SELECT']}));}var _0x35a16b=path['dirname'](PATH);var _0x582ff4=path[_0x3612('0x1f')](PATH,'.xlsx');var _0x95186b=_0xc739fd['split']&&_0x3b68d7[_0x3612('0x16')]>0x1;var _0x391293=[];if(!fs[_0x3612('0x20')](path[_0x3612('0x21')](_0x35a16b,_0x582ff4))&&_0x95186b){fs[_0x3612('0x22')](path['join'](_0x35a16b,_0x582ff4));}return BPromise[_0x3612('0x23')](_0x3b68d7,function(_0x4d5527){_0x391293['push'](_0x4d5527);})[_0x3612('0x11')](function(){for(var _0x53500a=0x0;_0x53500a<_0x391293[_0x3612('0x16')];_0x53500a+=0x1){var _0x283444;var _0x38b412=_0x391293[_0x53500a];if(_0x95186b){_0x283444=path['join'](_0x35a16b,_0x582ff4,util['format'](_0x3612('0x24'),_0x582ff4,_0x53500a,_0x3612('0x25')));}else{_0x283444=path[_0x3612('0x21')](_0x35a16b,util['format'](_0x3612('0x26'),_0x582ff4,'xlsx'));}fs[_0x3612('0x27')](_0x283444,json2xls(_0x38b412),_0x3612('0x28'));}})['then'](function(){if(_0x95186b){return new Promise(function(_0x5401fb){zipdir(path[_0x3612('0x21')](_0x35a16b,_0x582ff4),{'saveTo':path['join'](_0x35a16b,util[_0x3612('0xc')](_0x3612('0x26'),_0x582ff4,_0x3612('0x29')))},function(_0x2fc6e0,_0x215c7e){rimraf(path[_0x3612('0x21')](_0x35a16b,_0x582ff4),function(){});_0x5401fb(_0x3612('0x2a'));});});}})[_0x3612('0x11')](function(){logger[_0x3612('0xb')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3612('0xd')));return analyticExtractedReport(_0x3612('0x2b'),_0x95186b?util['format']('%s.%s',_0x582ff4,_0x95186b?'zip':_0x3612('0x25')):null);});})[_0x3612('0x2c')](function(_0x184fa2){logger[_0x3612('0xb')](util[_0x3612('0xc')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3612('0xd')),util['inspect'](_0x184fa2,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3612('0x2d'));})[_0x3612('0x2e')](function(){process[_0x3612('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xaecf=['%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.xlsx','length','mkdirSync','join','each','xlsx','writeFileSync','binary','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','bluebird','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split','then','splitSizeXlsx','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','range','isInteger','forEach','push'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0xaecf,0x149));var _0xfaec=function(_0xf8fac9,_0x425e56){_0xf8fac9=_0xf8fac9-0x0;var _0xe3c35e=_0xaecf[_0xf8fac9];return _0xe3c35e;};'use strict';var util=require(_0xfaec('0x0'));var path=require(_0xfaec('0x1'));var _=require(_0xfaec('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xfaec('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0xfaec('0x4'));var db=require(_0xfaec('0x5'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xfaec('0x6'))(_0xfaec('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xfaec('0x8')][0x2]);var QUERY=process[_0xfaec('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x10e8a2,_0x51da3b){var _0x229a96={'status':_0x10e8a2};var _0x5f1851={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x51da3b){_0x229a96[_0xfaec('0x9')]=_0x51da3b;}return db[_0xfaec('0xa')]['update'](_0x229a96,_0x5f1851);}function main(){var _0x31de79=0x1388;var _0x5e378e;logger[_0xfaec('0xb')](util[_0xfaec('0xc')](_0xfaec('0xd'),EXTRACTED_REPORT_ID,_0xfaec('0xe')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfaec('0xf'),'splitSizeXlsx']})[_0xfaec('0x10')](function(_0x26eac5){if(_0x26eac5){_0x5e378e=_0x26eac5;_0x31de79=_0x5e378e[_0xfaec('0x11')]||0x1388;}})[_0xfaec('0x10')](function(){return dbH[_0xfaec('0x12')][_0xfaec('0x13')](util[_0xfaec('0xc')](_0xfaec('0x14'),QUERY),{'type':dbH[_0xfaec('0x12')]['QueryTypes'][_0xfaec('0x15')]});})['then'](function(_0x53ed65){if(!_0x53ed65[0x0][_0xfaec('0x16')]){return analyticExtractedReport(_0xfaec('0x17'));}var _0x3aad7d=[];var _0x101a3e=0x0;if(_0x5e378e[_0xfaec('0xf')]){if(_0x53ed65&&_0x53ed65['length']){var _0x58ce9a=_[_0xfaec('0x18')](_0x53ed65[0x0][_0xfaec('0x16')]/_0x31de79);var _0x35d6c=Number[_0xfaec('0x19')](_0x53ed65[0x0][_0xfaec('0x16')]/_0x31de79)?_0x53ed65[0x0][_0xfaec('0x16')]%_0x31de79:0x0;_0x58ce9a[_0xfaec('0x1a')](function(_0x47aea8){if(_0x47aea8>0x0){_0x101a3e+=_0x31de79;}_0x3aad7d[_0xfaec('0x1b')](dbH[_0xfaec('0x12')][_0xfaec('0x13')](util[_0xfaec('0xc')](_0xfaec('0x1c'),QUERY,_0x31de79,_0x101a3e),{'type':dbH[_0xfaec('0x12')][_0xfaec('0x1d')][_0xfaec('0x15')]}));});if(_0x35d6c>0x0){_0x101a3e+=_0x31de79;_0x3aad7d['push'](dbH['sequelize'][_0xfaec('0x13')](util['format'](_0xfaec('0x1c'),QUERY,_0x35d6c,_0x101a3e),{'type':dbH['sequelize'][_0xfaec('0x1d')][_0xfaec('0x15')]}));}}}else{_0x3aad7d[_0xfaec('0x1b')](dbH[_0xfaec('0x12')][_0xfaec('0x13')](QUERY,{'type':dbH['sequelize']['QueryTypes'][_0xfaec('0x15')]}));}var _0xc86113=path[_0xfaec('0x1e')](PATH);var _0x4a1754=path[_0xfaec('0x1f')](PATH,_0xfaec('0x20'));var _0x19f069=_0x5e378e[_0xfaec('0xf')]&&_0x3aad7d[_0xfaec('0x21')]>0x1;var _0x4a70db=[];if(!fs['existsSync'](path['join'](_0xc86113,_0x4a1754))&&_0x19f069){fs[_0xfaec('0x22')](path[_0xfaec('0x23')](_0xc86113,_0x4a1754));}return BPromise[_0xfaec('0x24')](_0x3aad7d,function(_0x206499){_0x4a70db[_0xfaec('0x1b')](_0x206499);})[_0xfaec('0x10')](function(){for(var _0x30d01e=0x0;_0x30d01e<_0x4a70db[_0xfaec('0x21')];_0x30d01e+=0x1){var _0x18005a;var _0x176a1b=_0x4a70db[_0x30d01e];if(_0x19f069){_0x18005a=path['join'](_0xc86113,_0x4a1754,util['format']('%s%d.%s',_0x4a1754,_0x30d01e,'xlsx'));}else{_0x18005a=path['join'](_0xc86113,util[_0xfaec('0xc')]('%s.%s',_0x4a1754,_0xfaec('0x25')));}fs[_0xfaec('0x26')](_0x18005a,json2xls(_0x176a1b),_0xfaec('0x27'));}})['then'](function(){if(_0x19f069){return new Promise(function(_0x391ea7){zipdir(path[_0xfaec('0x23')](_0xc86113,_0x4a1754),{'saveTo':path[_0xfaec('0x23')](_0xc86113,util['format']('%s.%s',_0x4a1754,_0xfaec('0x28')))},function(_0x46f2db,_0x3c8df6){rimraf(path['join'](_0xc86113,_0x4a1754),function(){});_0x391ea7(_0xfaec('0x29'));});});}})[_0xfaec('0x10')](function(){logger[_0xfaec('0xb')](util[_0xfaec('0xc')](_0xfaec('0x2a'),EXTRACTED_REPORT_ID,_0xfaec('0xe')));return analyticExtractedReport(_0xfaec('0x2b'),_0x19f069?util[_0xfaec('0xc')](_0xfaec('0x2c'),_0x4a1754,_0x19f069?_0xfaec('0x28'):_0xfaec('0x25')):null);});})[_0xfaec('0x2d')](function(_0x33846b){logger['info'](util[_0xfaec('0xc')](_0xfaec('0x2e'),EXTRACTED_REPORT_ID,'XLSX'),util[_0xfaec('0x2f')](_0x33846b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfaec('0x30'));})[_0xfaec('0x31')](function(){process[_0xfaec('0x32')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3581a85..0ec8487 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 _0x0596=['models','findAll','then','VoiceExtension','uniq','exten','filter','groupBy','queue','hasOwnProperty','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','intervals','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','indexOf','app','custom','answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','bulkCreate','sortBy','error','rewrite','util'];(function(_0x527660,_0x52afee){var _0x317a43=function(_0x272627){while(--_0x272627){_0x527660['push'](_0x527660['shift']());}};_0x317a43(++_0x52afee);}(_0x0596,0x167));var _0x6059=function(_0x28d572,_0x1eb718){_0x28d572=_0x28d572-0x0;var _0x18ac52=_0x0596[_0x28d572];return _0x18ac52;};'use strict';var _=require('lodash');var util=require(_0x6059('0x0'));function rewrite(_0x1ab22c,_0x4e5247){var _0xcbd765=this;return _0x1ab22c[_0x6059('0x1')]['Interval'][_0x6059('0x2')]({'raw':!![]})[_0x6059('0x3')](function(_0x18ece2){_0xcbd765['intervals']=_0x18ece2;return _0x1ab22c['models'][_0x6059('0x4')]['findAll']({'where':{'IntervalId':_0x4e5247['IntervalId']},'raw':!![]});})[_0x6059('0x3')](function(_0x44b4b6){return _0x1ab22c[_0x6059('0x1')][_0x6059('0x4')]['findAll']({'where':{'exten':{'$in':_[_0x6059('0x5')](_['map'](_0x44b4b6,_0x6059('0x6')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x2e0fb7){var _0x14cd84=_[_0x6059('0x7')](_0x2e0fb7,{'priority':'1'});var _0x53cac1=_[_0x6059('0x7')](_0x2e0fb7,{'isApp':0x1});var _0x3fbbab=_[_0x6059('0x8')](_0x53cac1,_0x6059('0x6'));var _0x932b93=[_0x6059('0x9'),'playback'];var _0x36befd=[];var _0x51916a=[];for(var _0x359ad8 in _0x3fbbab){if(_0x3fbbab[_0x6059('0xa')](_0x359ad8)){_0xcbd765['priority']=0x2;_0xcbd765['extensions']=[];_0xcbd765[_0x6059('0xb')]=_[_0x6059('0xc')](_0x14cd84,{'exten':_0x3fbbab[_0x359ad8][0x0]['exten']});_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':util[_0x6059('0x11')](_0x6059('0x12'),_0x3fbbab[_0x359ad8][0x0]['type']),'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});if(_0x3fbbab[_0x359ad8][0x0]['type']===_0x6059('0x16')){_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x17')+_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')],'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765['priority']++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0]['VoiceExtensionId']});}else if(_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')]===_0x6059('0x18')){if(_0xcbd765[_0x6059('0xb')]){_0xcbd765[_0x6059('0xd')]['push']({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x19')+(_0xcbd765[_0x6059('0xb')]['cutdigits']?'${EXTEN:'+_0xcbd765[_0x6059('0xb')][_0x6059('0x1a')]+'}':_0x6059('0x1b')),'context':_0x3fbbab[_0x359ad8][0x0]['context'],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765['priority']++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});}_0xcbd765[_0x6059('0xd')]['push']({'type':_0x3fbbab[_0x359ad8][0x0]['type'],'app':_0x6059('0x10'),'appdata':_0x6059('0x17')+_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')],'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0]['exten'],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});var _0x1a0aa8=_0xcbd765['priority']++;_0xcbd765['extensions'][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x1c'),'appdata':_0x6059('0x1d')+(_0x1a0aa8+0x2)+_0x6059('0x1e')+(_0x1a0aa8+0x1)+')','context':_0x3fbbab[_0x359ad8][0x0]['context'],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0x1a0aa8,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});if(_0xcbd765[_0x6059('0xb')]){_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0xcbd765[_0x6059('0xb')][_0x6059('0x1a')]?_0x6059('0x1f')+_0xcbd765[_0x6059('0xb')][_0x6059('0x1a')]+'}':_0x6059('0x20'),'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});}_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x21')+_0x3fbbab[_0x359ad8][0x0]['VoiceExtensionId'],'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0]['exten'],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});if(_0xcbd765[_0x6059('0xb')]&&_0xcbd765[_0x6059('0xb')][_0x6059('0xa')](_0x6059('0x22'))&&_0xcbd765[_0x6059('0xb')][_0x6059('0x22')]!==_0x6059('0x23')){_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xcbd765[_0x6059('0xb')][_0x6059('0x22')]||_0x6059('0x24'),'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});}}_0xcbd765[_0x6059('0xd')]['push']({'type':_0x3fbbab[_0x359ad8][0x0]['type'],'app':_0x6059('0x10'),'appdata':_0x6059('0x25'),'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0]['VoiceExtensionId']});_0xcbd765['extensions'][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x26'),'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'priority':_0xcbd765[_0x6059('0x14')]++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0]['VoiceExtensionId']});_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0][_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x27'),'context':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x13')],'exten':_0x3fbbab[_0x359ad8][0x0]['exten'],'priority':_0xcbd765['priority']++,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});for(var _0x535516=0x0,_0x1687d4=0x0;_0x535516<_0x3fbbab[_0x359ad8][_0x6059('0x28')];_0x535516+=0x1,_0x1687d4=0x0){var _0x5ce23d=_0x3fbbab[_0x359ad8][_0x535516];if(_0x5ce23d[_0x6059('0xf')]){_0x5ce23d['type']=_0x5ce23d[_0x6059('0xf')][_0x6059('0x29')]();}var _0x3422b3=[];var _0xf07b21=[];delete _0x5ce23d['id'];delete _0x5ce23d[_0x6059('0x2a')];delete _0x5ce23d[_0x6059('0x2b')];var _0x537f5d=_0x5ce23d[_0x6059('0x2c')]!==_0x6059('0x2d')?[_0x5ce23d[_0x6059('0x2c')]]:_0x5ce23d[_0x6059('0x2e')]?_[_0x6059('0x2f')](_[_0x6059('0x7')](_0xcbd765[_0x6059('0x30')],{'IntervalId':_0x5ce23d[_0x6059('0x2e')]}),_0x6059('0x2c')):[];if(_0x5ce23d[_0x6059('0xa')](_0x6059('0x31'))){if(_0x5ce23d[_0x6059('0x31')]&&_0x5ce23d[_0x6059('0x31')]!=='--'){_0x3422b3[_0x6059('0xe')]({'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x32')+_0x5ce23d[_0x6059('0x31')],'context':_0x5ce23d['context'],'exten':_0x5ce23d[_0x6059('0x6')],'priority':_0x537f5d[_0x6059('0x28')]+_0xcbd765[_0x6059('0x14')]+_0x1687d4++,'VoiceExtensionId':_0x5ce23d[_0x6059('0x15')]});}}if(_0x5ce23d[_0x6059('0xf')]===_0x6059('0x18')&&_0x5ce23d[_0x6059('0xa')](_0x6059('0x33'))){if(_0x5ce23d[_0x6059('0x33')]){_0x3422b3[_0x6059('0xe')]({'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x1c'),'appdata':_0x6059('0x34')+_0x5ce23d[_0x6059('0x33')]+')','context':_0x5ce23d[_0x6059('0x13')],'exten':_0x5ce23d[_0x6059('0x6')],'priority':_0x537f5d[_0x6059('0x28')]+_0xcbd765[_0x6059('0x14')]+_0x1687d4++,'VoiceExtensionId':_0x5ce23d[_0x6059('0x15')]});}else{_0x3422b3[_0x6059('0xe')]({'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x1c'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x5ce23d[_0x6059('0x13')],'exten':_0x5ce23d[_0x6059('0x6')],'priority':_0x537f5d[_0x6059('0x28')]+_0xcbd765['priority']+_0x1687d4++,'VoiceExtensionId':_0x5ce23d[_0x6059('0x15')]});}}if(_0x5ce23d['hasOwnProperty']('answer')){if(_0x932b93[_0x6059('0x35')](_0x5ce23d[_0x6059('0x36')]['toLowerCase']())>=0x0&&_0x5ce23d['appType']!==_0x6059('0x37')){if(_0x5ce23d[_0x6059('0x38')]){_0x3422b3['push']({'type':_0x5ce23d['type'],'app':_0x6059('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5ce23d[_0x6059('0x13')],'exten':_0x5ce23d[_0x6059('0x6')],'priority':_0x537f5d['length']+_0xcbd765[_0x6059('0x14')]+_0x1687d4++,'VoiceExtensionId':_0x5ce23d[_0x6059('0x15')]});_0x3422b3[_0x6059('0xe')]({'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x39'),'context':_0x5ce23d[_0x6059('0x13')],'exten':_0x5ce23d['exten'],'priority':_0x537f5d['length']+_0xcbd765[_0x6059('0x14')]+_0x1687d4++,'VoiceExtensionId':_0x5ce23d[_0x6059('0x15')]});}else{_0x3422b3[_0x6059('0xe')]({'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x1c'),'appdata':_0x6059('0x3a'),'context':_0x5ce23d[_0x6059('0x13')],'exten':_0x5ce23d[_0x6059('0x6')],'priority':_0x537f5d[_0x6059('0x28')]+_0xcbd765[_0x6059('0x14')]+_0x1687d4++,'VoiceExtensionId':_0x5ce23d['VoiceExtensionId']});_0x3422b3[_0x6059('0xe')]({'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x10'),'appdata':_0x6059('0x3b'),'context':_0x5ce23d[_0x6059('0x13')],'exten':_0x5ce23d[_0x6059('0x6')],'priority':_0x537f5d[_0x6059('0x28')]+_0xcbd765[_0x6059('0x14')]+_0x1687d4++,'VoiceExtensionId':_0x5ce23d[_0x6059('0x15')]});}}}for(var _0x4d9c94=0x0;_0x4d9c94<_0x537f5d[_0x6059('0x28')];_0x4d9c94+=0x1){var _0x283e96=_0xcbd765[_0x6059('0x14')]+_0x537f5d['length'];var _0x39da0d=_0x4d9c94===_0x537f5d['length']-0x1?_0xcbd765['priority']+_0x3422b3[_0x6059('0x28')]+_0xf07b21[_0x6059('0x28')]+0x2:_0xcbd765[_0x6059('0x14')]+_0x4d9c94+0x1;_0x3422b3[_0x6059('0x3c')](_0x4d9c94,0x0,{'type':_0x5ce23d[_0x6059('0xf')],'app':_0x6059('0x3d'),'appdata':_0x537f5d[_0x4d9c94]+'?'+_0x5ce23d['context']+_0x6059('0x3e')+_0x283e96+':'+_0x5ce23d[_0x6059('0x13')]+_0x6059('0x3e')+_0x39da0d,'exten':_0x5ce23d[_0x6059('0x6')],'context':_0x5ce23d['context'],'priority':_0xcbd765[_0x6059('0x14')]+_0x4d9c94,'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});}_0x5ce23d[_0x6059('0x14')]=_0x3422b3['length']?_[_0x6059('0x3f')](_0x3422b3)[_0x6059('0x14')]+0x1:_0xcbd765['priority'];_0xcbd765['priority']=(_0xf07b21['length']?_[_0x6059('0x3f')](_0xf07b21)['priority']:_0x5ce23d['priority'])+0x1;_0xcbd765[_0x6059('0xd')]=_[_0x6059('0x40')](_0xcbd765[_0x6059('0xd')],_0x3422b3,[_0x5ce23d],_0xf07b21);}_0xcbd765[_0x6059('0xd')][_0x6059('0xe')]({'type':_0x3fbbab[_0x359ad8][0x0]['type'],'app':_0x6059('0x41'),'exten':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x6')],'context':_0x3fbbab[_0x359ad8][0x0]['context'],'priority':_0xcbd765['priority'],'VoiceExtensionId':_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]});_0x36befd[_0x6059('0xe')](_0x3fbbab[_0x359ad8][0x0][_0x6059('0x15')]);_0x51916a=_['concat'](_0x51916a,_0xcbd765[_0x6059('0xd')]);}}return _0x1ab22c[_0x6059('0x42')](function(_0x511773){return _0x1ab22c[_0x6059('0x1')][_0x6059('0x4')][_0x6059('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x36befd}},'transaction':_0x511773})['then'](function(_0x19d8e2){return _0x1ab22c[_0x6059('0x1')][_0x6059('0x4')][_0x6059('0x44')](_[_0x6059('0x45')](_0x51916a,_0x6059('0x14')),{'transaction':_0x511773});});});})['catch'](function(_0x563c74){console[_0x6059('0x46')](_0x563c74);});}exports[_0x6059('0x47')]=rewrite; \ No newline at end of file +var _0x94ab=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','indexOf','app','appType','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','Hangup','concat','transaction','destroy','bulkCreate','catch','error','rewrite','lodash','util','models','then','intervals','VoiceExtension','findAll','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','hasOwnProperty','extensions','extension','find','push','type','format','CDR(type)=%s','context','priority','Set','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto('];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0x94ab,0x18c));var _0xb94a=function(_0x51580a,_0x1ba894){_0x51580a=_0x51580a-0x0;var _0x87b723=_0x94ab[_0x51580a];return _0x87b723;};'use strict';var _=require(_0xb94a('0x0'));var util=require(_0xb94a('0x1'));function rewrite(_0xd3fe26,_0x1e7e45){var _0x34d976=this;return _0xd3fe26[_0xb94a('0x2')]['Interval']['findAll']({'raw':!![]})[_0xb94a('0x3')](function(_0x40d747){_0x34d976[_0xb94a('0x4')]=_0x40d747;return _0xd3fe26[_0xb94a('0x2')][_0xb94a('0x5')][_0xb94a('0x6')]({'where':{'IntervalId':_0x1e7e45[_0xb94a('0x7')]},'raw':!![]});})['then'](function(_0xe57a29){return _0xd3fe26[_0xb94a('0x2')][_0xb94a('0x5')][_0xb94a('0x6')]({'where':{'exten':{'$in':_[_0xb94a('0x8')](_[_0xb94a('0x9')](_0xe57a29,_0xb94a('0xa')))}},'order':[{'raw':_0xb94a('0xb')}],'raw':!![]});})[_0xb94a('0x3')](function(_0xd8399){var _0x4f65e5=_[_0xb94a('0xc')](_0xd8399,{'priority':'1'});var _0x593ec3=_[_0xb94a('0xc')](_0xd8399,{'isApp':0x1});var _0x107d4b=_[_0xb94a('0xd')](_0x593ec3,_0xb94a('0xa'));var _0x5422fa=[_0xb94a('0xe'),'playback'];var _0x518e11=[];var _0x2c485b=[];for(var _0x344241 in _0x107d4b){if(_0x107d4b[_0xb94a('0xf')](_0x344241)){_0x34d976['priority']=0x2;_0x34d976[_0xb94a('0x10')]=[];_0x34d976[_0xb94a('0x11')]=_[_0xb94a('0x12')](_0x4f65e5,{'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')]});_0x34d976[_0xb94a('0x10')][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':'Set','appdata':util[_0xb94a('0x15')](_0xb94a('0x16'),_0x107d4b[_0x344241][0x0]['type']),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0]['exten'],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0]['VoiceExtensionId']});if(_0x107d4b[_0x344241][0x0][_0xb94a('0x14')]==='inbound'){_0x34d976[_0xb94a('0x10')]['push']({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x1a')+_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')],'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});}else if(_0x107d4b[_0x344241][0x0][_0xb94a('0x14')]===_0xb94a('0x1c')){if(_0x34d976['extension']){_0x34d976[_0xb94a('0x10')][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x1d')+(_0x34d976['extension'][_0xb94a('0x1e')]?_0xb94a('0x1f')+_0x34d976[_0xb94a('0x11')][_0xb94a('0x1e')]+'}':_0xb94a('0x20')),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});}_0x34d976['extensions'][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':'CDR(routeid)='+_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')],'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});var _0x1af965=_0x34d976[_0xb94a('0x18')]++;_0x34d976[_0xb94a('0x10')][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0]['type'],'app':_0xb94a('0x21'),'appdata':_0xb94a('0x22')+(_0x1af965+0x2)+_0xb94a('0x23')+(_0x1af965+0x1)+')','context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x1af965,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});if(_0x34d976['extension']){_0x34d976[_0xb94a('0x10')][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0x34d976['extension'][_0xb94a('0x1e')]?_0xb94a('0x24')+_0x34d976[_0xb94a('0x11')]['cutdigits']+'}':_0xb94a('0x25'),'context':_0x107d4b[_0x344241][0x0]['context'],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});}_0x34d976[_0xb94a('0x10')]['push']({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x26')+_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')],'context':_0x107d4b[_0x344241][0x0]['context'],'exten':_0x107d4b[_0x344241][0x0]['exten'],'priority':_0x34d976['priority']++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});if(_0x34d976['extension']&&_0x34d976[_0xb94a('0x11')]['hasOwnProperty'](_0xb94a('0x27'))&&_0x34d976['extension'][_0xb94a('0x27')]!==_0xb94a('0x28')){_0x34d976[_0xb94a('0x10')][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x29'),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});_0x34d976[_0xb94a('0x10')][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x34d976[_0xb94a('0x11')][_0xb94a('0x27')]||_0xb94a('0x2a'),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});}}_0x34d976[_0xb94a('0x10')]['push']({'type':_0x107d4b[_0x344241][0x0]['type'],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x2b'),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0]['exten'],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0]['VoiceExtensionId']});_0x34d976[_0xb94a('0x10')]['push']({'type':_0x107d4b[_0x344241][0x0]['type'],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x2c'),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0]['VoiceExtensionId']});_0x34d976['extensions'][_0xb94a('0x13')]({'type':_0x107d4b[_0x344241][0x0][_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x2d'),'context':_0x107d4b[_0x344241][0x0][_0xb94a('0x17')],'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'priority':_0x34d976[_0xb94a('0x18')]++,'VoiceExtensionId':_0x107d4b[_0x344241][0x0]['VoiceExtensionId']});for(var _0x5ca32d=0x0,_0x3f4865=0x0;_0x5ca32d<_0x107d4b[_0x344241][_0xb94a('0x2e')];_0x5ca32d+=0x1,_0x3f4865=0x0){var _0x214dcb=_0x107d4b[_0x344241][_0x5ca32d];if(_0x214dcb[_0xb94a('0x14')]){_0x214dcb[_0xb94a('0x14')]=_0x214dcb[_0xb94a('0x14')][_0xb94a('0x2f')]();}var _0x11910a=[];var _0xe5b24a=[];delete _0x214dcb['id'];delete _0x214dcb['createdAt'];delete _0x214dcb[_0xb94a('0x30')];var _0x90126c=_0x214dcb['interval']!==_0xb94a('0x31')?[_0x214dcb[_0xb94a('0x32')]]:_0x214dcb[_0xb94a('0x7')]?_['map'](_['filter'](_0x34d976['intervals'],{'IntervalId':_0x214dcb[_0xb94a('0x7')]}),_0xb94a('0x32')):[];if(_0x214dcb['hasOwnProperty'](_0xb94a('0x33'))){if(_0x214dcb[_0xb94a('0x33')]&&_0x214dcb[_0xb94a('0x33')]!=='--'){_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb['type'],'app':'Set','appdata':_0xb94a('0x34')+_0x214dcb[_0xb94a('0x33')],'context':_0x214dcb['context'],'exten':_0x214dcb[_0xb94a('0xa')],'priority':_0x90126c[_0xb94a('0x2e')]+_0x34d976[_0xb94a('0x18')]+_0x3f4865++,'VoiceExtensionId':_0x214dcb[_0xb94a('0x1b')]});}}if(_0x214dcb[_0xb94a('0x14')]===_0xb94a('0x1c')&&_0x214dcb['hasOwnProperty']('callerID')){if(_0x214dcb[_0xb94a('0x35')]){_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb[_0xb94a('0x14')],'app':_0xb94a('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x214dcb[_0xb94a('0x35')]+')','context':_0x214dcb['context'],'exten':_0x214dcb[_0xb94a('0xa')],'priority':_0x90126c['length']+_0x34d976['priority']+_0x3f4865++,'VoiceExtensionId':_0x214dcb['VoiceExtensionId']});}else{_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb['type'],'app':_0xb94a('0x21'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x214dcb['context'],'exten':_0x214dcb['exten'],'priority':_0x90126c[_0xb94a('0x2e')]+_0x34d976[_0xb94a('0x18')]+_0x3f4865++,'VoiceExtensionId':_0x214dcb[_0xb94a('0x1b')]});}}if(_0x214dcb[_0xb94a('0xf')]('answer')){if(_0x5422fa[_0xb94a('0x36')](_0x214dcb[_0xb94a('0x37')][_0xb94a('0x2f')]())>=0x0&&_0x214dcb[_0xb94a('0x38')]!=='custom'){if(_0x214dcb[_0xb94a('0x39')]){_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb['type'],'app':'ExecIf','appdata':_0xb94a('0x3a'),'context':_0x214dcb['context'],'exten':_0x214dcb['exten'],'priority':_0x90126c[_0xb94a('0x2e')]+_0x34d976[_0xb94a('0x18')]+_0x3f4865++,'VoiceExtensionId':_0x214dcb[_0xb94a('0x1b')]});_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb[_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x214dcb[_0xb94a('0x17')],'exten':_0x214dcb['exten'],'priority':_0x90126c['length']+_0x34d976['priority']+_0x3f4865++,'VoiceExtensionId':_0x214dcb[_0xb94a('0x1b')]});}else{_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb[_0xb94a('0x14')],'app':_0xb94a('0x21'),'appdata':_0xb94a('0x3b'),'context':_0x214dcb[_0xb94a('0x17')],'exten':_0x214dcb['exten'],'priority':_0x90126c['length']+_0x34d976[_0xb94a('0x18')]+_0x3f4865++,'VoiceExtensionId':_0x214dcb[_0xb94a('0x1b')]});_0x11910a[_0xb94a('0x13')]({'type':_0x214dcb[_0xb94a('0x14')],'app':_0xb94a('0x19'),'appdata':_0xb94a('0x3c'),'context':_0x214dcb['context'],'exten':_0x214dcb[_0xb94a('0xa')],'priority':_0x90126c[_0xb94a('0x2e')]+_0x34d976['priority']+_0x3f4865++,'VoiceExtensionId':_0x214dcb[_0xb94a('0x1b')]});}}}for(var _0x57c688=0x0;_0x57c688<_0x90126c[_0xb94a('0x2e')];_0x57c688+=0x1){var _0x4a67ef=_0x34d976[_0xb94a('0x18')]+_0x90126c[_0xb94a('0x2e')];var _0x4baf3c=_0x57c688===_0x90126c[_0xb94a('0x2e')]-0x1?_0x34d976['priority']+_0x11910a[_0xb94a('0x2e')]+_0xe5b24a[_0xb94a('0x2e')]+0x2:_0x34d976[_0xb94a('0x18')]+_0x57c688+0x1;_0x11910a[_0xb94a('0x3d')](_0x57c688,0x0,{'type':_0x214dcb[_0xb94a('0x14')],'app':_0xb94a('0x3e'),'appdata':_0x90126c[_0x57c688]+'?'+_0x214dcb[_0xb94a('0x17')]+_0xb94a('0x3f')+_0x4a67ef+':'+_0x214dcb[_0xb94a('0x17')]+_0xb94a('0x3f')+_0x4baf3c,'exten':_0x214dcb[_0xb94a('0xa')],'context':_0x214dcb[_0xb94a('0x17')],'priority':_0x34d976[_0xb94a('0x18')]+_0x57c688,'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});}_0x214dcb[_0xb94a('0x18')]=_0x11910a[_0xb94a('0x2e')]?_['last'](_0x11910a)[_0xb94a('0x18')]+0x1:_0x34d976['priority'];_0x34d976['priority']=(_0xe5b24a[_0xb94a('0x2e')]?_['last'](_0xe5b24a)[_0xb94a('0x18')]:_0x214dcb['priority'])+0x1;_0x34d976[_0xb94a('0x10')]=_['concat'](_0x34d976[_0xb94a('0x10')],_0x11910a,[_0x214dcb],_0xe5b24a);}_0x34d976[_0xb94a('0x10')]['push']({'type':_0x107d4b[_0x344241][0x0]['type'],'app':_0xb94a('0x40'),'exten':_0x107d4b[_0x344241][0x0][_0xb94a('0xa')],'context':_0x107d4b[_0x344241][0x0]['context'],'priority':_0x34d976[_0xb94a('0x18')],'VoiceExtensionId':_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]});_0x518e11[_0xb94a('0x13')](_0x107d4b[_0x344241][0x0][_0xb94a('0x1b')]);_0x2c485b=_[_0xb94a('0x41')](_0x2c485b,_0x34d976[_0xb94a('0x10')]);}}return _0xd3fe26[_0xb94a('0x42')](function(_0x5cb538){return _0xd3fe26[_0xb94a('0x2')][_0xb94a('0x5')][_0xb94a('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x518e11}},'transaction':_0x5cb538})['then'](function(_0x129f3b){return _0xd3fe26['models']['VoiceExtension'][_0xb94a('0x44')](_['sortBy'](_0x2c485b,'priority'),{'transaction':_0x5cb538});});});})[_0xb94a('0x45')](function(_0x244567){console[_0xb94a('0x46')](_0x244567);});}exports[_0xb94a('0x47')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5c22659..02669a4 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 _0x3c9b=['firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','duplicate','Duplicate\x20Contact','CmContact','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','inspect','insert','into','cm_hopper','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','phone','field','NOW()','toString','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_black','findAll','dialCheckDuplicateType','CmList','Lists','then','always','VoiceQueueId','onlyIfOpen','sequelize','query','all','VoiceQueue','outbound','get','Campaign','CampaignId','BlackLists','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','info','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data'];(function(_0x381e27,_0x5627ba){var _0x49e063=function(_0x17ecef){while(--_0x17ecef){_0x381e27['push'](_0x381e27['shift']());}};_0x49e063(++_0x5627ba);}(_0x3c9b,0xb9));var _0xb3c9=function(_0x345461,_0x5d75a7){_0x345461=_0x345461-0x0;var _0x295e7a=_0x3c9b[_0x345461];return _0x295e7a;};'use strict';var BPromise=require('bluebird');var util=require(_0xb3c9('0x0'));var _=require(_0xb3c9('0x1'));var fs=require('fs');var squel=require(_0xb3c9('0x2'));var Papa=require(_0xb3c9('0x3'));var Redis=require(_0xb3c9('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xb3c9('0x5'));var logger=require(_0xb3c9('0x6'))(_0xb3c9('0x7'));config[_0xb3c9('0x8')]=_[_0xb3c9('0x9')](config['redis'],{'host':_0xb3c9('0xa'),'port':0x18eb});var socket=require(_0xb3c9('0xb'))(new Redis(config[_0xb3c9('0x8')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0xb3c9('0xc')][0x2]||process[_0xb3c9('0xc')][0x2]===_0xb3c9('0xd')||process['argv'][0x2]==='null'){throw new Error(_0xb3c9('0xe'));}var FILEPATH=process[_0xb3c9('0xc')][0x2];if(!process['argv'][0x3]||process[_0xb3c9('0xc')][0x3]===_0xb3c9('0xd')||process['argv'][0x3]==='null'||!process[_0xb3c9('0xc')][0x4]||process['argv'][0x4]===_0xb3c9('0xd')||process[_0xb3c9('0xc')][0x4]===_0xb3c9('0xf')){throw new Error(_0xb3c9('0x10'));}var FIELDS=_[_0xb3c9('0x11')](process[_0xb3c9('0xc')][0x3][_0xb3c9('0x12')](','),process['argv'][0x4][_0xb3c9('0x12')](','));if(!process[_0xb3c9('0xc')][0x5]||process['argv'][0x5]==='undefined'||process[_0xb3c9('0xc')][0x5]===_0xb3c9('0xf')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xb3c9('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xb3c9('0xc')][0x6]!=='undefined'&&process[_0xb3c9('0xc')][0x6]!==_0xb3c9('0xf')?process[_0xb3c9('0xc')][0x6]:null;var DUPLICATES=process[_0xb3c9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0xb3c9('0xf')?process[_0xb3c9('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0xb3c9('0xc')][0x8]===_0xb3c9('0xd')||process['argv'][0x8]===_0xb3c9('0xf')){throw new Error(_0xb3c9('0x13'));}var SOCKET_TIMESTAMP=process[_0xb3c9('0xc')][0x8];}catch(_0x5212c4){logger['error'](_0x5212c4);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(_0x53b9b9,_0x517aca,_0x238a63,_0x3a47ee){var _0x327e6c={'message':_0x517aca};_0x327e6c[_0x53b9b9]=!![];if(_0x238a63){_0x327e6c['contact']=_0x238a63;}if(_0x3a47ee){_0x327e6c['index']=_0x3a47ee;}return _0x327e6c;}function isEmail(_0x3b4128){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))*$/[_0xb3c9('0x14')](_0x3b4128);}function checkRow(_0x31f07a,_0x121595,_0x65c211){return new BPromise(function(_0x9e65e2,_0x2e78d2){if(_[_0xb3c9('0x15')](_0x31f07a)){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x16'),_0xb3c9('0x17'),null,_0x65c211));}if(_0x31f07a[_0xb3c9('0x18')]&&_0x31f07a['errors'][_0xb3c9('0x19')]){var _0x26acf5=_[_0xb3c9('0x1a')](_0x31f07a['errors'],_0xb3c9('0x1b'))[_0xb3c9('0x1c')](';');return _0x2e78d2(handleCheckRowError('error',_0x26acf5,null,_0x65c211));}var _0x2a08c5={};for(var _0x25dbd6 in FIELDS){if(FIELDS[_0xb3c9('0x1d')](_0x25dbd6)&&FIELDS[_0x25dbd6]){_0x2a08c5[_0x25dbd6]=_0x31f07a[_0xb3c9('0x1e')][0x0][FIELDS[_0x25dbd6]]||_0x31f07a['data'][0x0]['\ufeff'+FIELDS[_0x25dbd6]];}}if(!_0x2a08c5[_0xb3c9('0x1f')]){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x16'),_0xb3c9('0x20'),null,_0x65c211));}if(!_0x2a08c5['phone']){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x16'),_0xb3c9('0x21'),null,_0x65c211));}if(_0x2a08c5[_0xb3c9('0x22')]){var _0x59a5f7=moment(_0x2a08c5['birthDate'],_0xb3c9('0x23'));if(!_0x59a5f7[_0xb3c9('0x24')]()){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x16'),_0xb3c9('0x25'),null,_0x65c211));}}if(_0x2a08c5['email']){if(!isEmail(_0x2a08c5[_0xb3c9('0x26')])){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x16'),'email\x20format\x20is\x20not\x20valid!',null,_0x65c211));}}_0x2a08c5['ListId']=LISTID;_0x2a08c5['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x121595){var _0x5b2bb9={};for(var _0xdb75ca=0x0,_0x701a5d=DUPLICATES[_0xb3c9('0x19')];_0xdb75ca<_0x701a5d;_0xdb75ca+=0x1){_0x5b2bb9[DUPLICATES[_0xdb75ca]]=_0x2a08c5[DUPLICATES[_0xdb75ca]];}var _0x24acf4=_['find'](_0x121595,_0x5b2bb9);if(_0x24acf4){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x27'),_0xb3c9('0x28'),_0x24acf4,_0x65c211));}}return db[_0xb3c9('0x29')]['create'](_0x2a08c5,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2a08c5)})['then'](function(_0x3d217d){if(DUPLICATES&&DUPLICATES[_0xb3c9('0x19')]&&_0x121595){_0x121595[_0xb3c9('0x2a')](_[_0xb3c9('0x2b')](_0x2a08c5,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3d217d['id'];return _0x9e65e2();})[_0xb3c9('0x2c')](function(_0x5258b4){return _0x2e78d2(handleCheckRowError(_0xb3c9('0x16'),_0xb3c9('0x2d')+(_0x5258b4[_0xb3c9('0x1b')]||JSON[_0xb3c9('0x2e')](_0x5258b4)),null,_0x65c211));});});}function checkHopper(){function _0x2698ba(){return function(_0x17ab26){logger[_0xb3c9('0x16')]('cmContact','checkHopper',util[_0xb3c9('0x2f')](_0x17ab26,{'showHidden':![],'depth':null}));};}var _0x598977=function(_0x5f44e4,_0x51e21b){var _0x217bea=squel[_0xb3c9('0x30')]()[_0xb3c9('0x31')](_0xb3c9('0x32'))['fromQuery'](['phone',_0xb3c9('0x33'),_0xb3c9('0x34'),_0xb3c9('0x35'),_0x51e21b,_0xb3c9('0x36'),_0xb3c9('0x37')],squel[_0xb3c9('0x38')]()['field'](_0xb3c9('0x39'),_0xb3c9('0x39'))[_0xb3c9('0x3a')](_0xb3c9('0x3b'),_0xb3c9('0x33'))[_0xb3c9('0x3a')]('id',_0xb3c9('0x34'))[_0xb3c9('0x3a')](LISTID[_0xb3c9('0x3c')](),'ListId')['field'](_0x5f44e4['id']['toString'](),_0x51e21b)[_0xb3c9('0x3a')](_0xb3c9('0x3b'),_0xb3c9('0x36'))[_0xb3c9('0x3a')](_0xb3c9('0x3b'),_0xb3c9('0x37'))[_0xb3c9('0x3d')](_0xb3c9('0x3e'))['where']('deletedAt\x20IS\x20NULL')[_0xb3c9('0x3f')](_0xb3c9('0x40'),LISTID['toString']())[_0xb3c9('0x3f')](_0xb3c9('0x41'))['where'](_0xb3c9('0x42'),squel[_0xb3c9('0x38')]()[_0xb3c9('0x3a')](_0xb3c9('0x39'))[_0xb3c9('0x3d')](_0xb3c9('0x32'))['where'](_0x51e21b+_0xb3c9('0x43'),_0x5f44e4['id'][_0xb3c9('0x3c')]())))[_0xb3c9('0x3c')]();return _0x217bea;};var _0x30ff5f=function(_0xb7ba5a,_0x3298a8){var _0x213fe2=squel[_0xb3c9('0x30')]()[_0xb3c9('0x31')](_0xb3c9('0x32'))[_0xb3c9('0x44')](['phone',_0xb3c9('0x33'),'ContactId',_0xb3c9('0x35'),_0x3298a8,_0xb3c9('0x36'),'updatedAt'],squel[_0xb3c9('0x38')]()[_0xb3c9('0x3a')](_0xb3c9('0x39'),_0xb3c9('0x39'))[_0xb3c9('0x3a')](_0xb3c9('0x3b'),_0xb3c9('0x33'))[_0xb3c9('0x3a')]('id',_0xb3c9('0x34'))[_0xb3c9('0x3a')](LISTID[_0xb3c9('0x3c')](),_0xb3c9('0x35'))[_0xb3c9('0x3a')](_0xb7ba5a['id'][_0xb3c9('0x3c')](),_0x3298a8)[_0xb3c9('0x3a')]('NOW()',_0xb3c9('0x36'))[_0xb3c9('0x3a')]('NOW()',_0xb3c9('0x37'))['from']('cm_contacts')[_0xb3c9('0x3f')](_0xb3c9('0x45'))['where'](_0xb3c9('0x40'),LISTID[_0xb3c9('0x3c')]())['where'](_0xb3c9('0x46'),squel[_0xb3c9('0x47')](hopperContacts))[_0xb3c9('0x3f')](_0xb3c9('0x41'))[_0xb3c9('0x3f')](_0xb3c9('0x42'),squel[_0xb3c9('0x38')]()[_0xb3c9('0x3a')](_0xb3c9('0x48'))['from']('cm_hopper_final')[_0xb3c9('0x3f')](_0x3298a8+_0xb3c9('0x43'),_0xb7ba5a['id']['toString']()))[_0xb3c9('0x3f')](_0xb3c9('0x42'),squel['select']()[_0xb3c9('0x3a')](_0xb3c9('0x39'))[_0xb3c9('0x3d')](_0xb3c9('0x32'))[_0xb3c9('0x3f')](_0x3298a8+_0xb3c9('0x43'),_0xb7ba5a['id'][_0xb3c9('0x3c')]())))[_0xb3c9('0x3c')]();return _0x213fe2;};function _0x560069(_0xce687b,_0x307276){var _0x41fe1b=squel['insert']()[_0xb3c9('0x31')](_0xb3c9('0x32'))['fromQuery']([_0xb3c9('0x39'),_0xb3c9('0x33'),_0xb3c9('0x34'),_0xb3c9('0x35'),_0x307276,_0xb3c9('0x36'),_0xb3c9('0x37')],squel[_0xb3c9('0x38')]()[_0xb3c9('0x3a')](_0xb3c9('0x39'),'phone')[_0xb3c9('0x3a')](_0xb3c9('0x3b'),'scheduledAt')[_0xb3c9('0x3a')]('id',_0xb3c9('0x34'))[_0xb3c9('0x3a')](LISTID[_0xb3c9('0x3c')](),'ListId')[_0xb3c9('0x3a')](_0xce687b['id']['toString'](),_0x307276)[_0xb3c9('0x3a')](_0xb3c9('0x3b'),_0xb3c9('0x36'))['field'](_0xb3c9('0x3b'),'updatedAt')[_0xb3c9('0x3d')](_0xb3c9('0x3e'))['where'](_0xb3c9('0x45'))[_0xb3c9('0x3f')]('ListId\x20=\x20?',LISTID[_0xb3c9('0x3c')]())[_0xb3c9('0x3f')](_0xb3c9('0x46'),squel['str'](hopperContacts))[_0xb3c9('0x3f')](_0xb3c9('0x41')))[_0xb3c9('0x3c')]();return _0x41fe1b;}function _0x18cd19(_0x586712,_0x36916b){var _0x237ab3=squel[_0xb3c9('0x30')]()['into'](_0xb3c9('0x49'))[_0xb3c9('0x44')](['phone',_0xb3c9('0x34'),_0xb3c9('0x35'),_0x36916b,'createdAt',_0xb3c9('0x37')],squel['select']()[_0xb3c9('0x3a')](_0xb3c9('0x39'),_0xb3c9('0x39'))['field']('id','ContactId')[_0xb3c9('0x3a')](LISTID[_0xb3c9('0x3c')](),'ListId')['field'](_0x586712['id']['toString'](),_0x36916b)[_0xb3c9('0x3a')]('NOW()',_0xb3c9('0x36'))[_0xb3c9('0x3a')](_0xb3c9('0x3b'),'updatedAt')[_0xb3c9('0x3d')]('cm_contacts')['where'](_0xb3c9('0x45'))[_0xb3c9('0x3f')](_0xb3c9('0x40'),LISTID[_0xb3c9('0x3c')]())[_0xb3c9('0x3f')](_0xb3c9('0x46'),squel[_0xb3c9('0x47')](hopperContacts))[_0xb3c9('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0xb3c9('0x3c')]();return _0x237ab3;}return db['VoiceQueue'][_0xb3c9('0x4a')]({'where':{'type':'outbound'},'attributes':['id',_0xb3c9('0x4b')],'include':[{'model':db[_0xb3c9('0x4c')],'as':_0xb3c9('0x4d'),'where':{'id':LISTID}}]})[_0xb3c9('0x4e')](function(_0x2759ed){var _0x2c56ac=[];if(_0x2759ed){var _0x355597;for(var _0x2c4027=0x0,_0x4397ba;_0x2c4027<_0x2759ed['length'];_0x2c4027+=0x1){_0x4397ba=_0x2759ed[_0x2c4027]['get']({'plain':!![]});switch(_0x4397ba['dialCheckDuplicateType']){case _0xb3c9('0x4f'):_0x2c56ac[_0xb3c9('0x2a')](db['sequelize']['query'](_0x30ff5f(_0x4397ba,_0xb3c9('0x50')))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));break;case _0xb3c9('0x51'):_0x2c56ac[_0xb3c9('0x2a')](db[_0xb3c9('0x52')][_0xb3c9('0x53')](_0x598977(_0x4397ba,_0xb3c9('0x50')))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));break;default:_0x2c56ac['push'](db[_0xb3c9('0x52')][_0xb3c9('0x53')](_0x560069(_0x4397ba,'VoiceQueueId'))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));}}}return _0x2c56ac;})[_0xb3c9('0x54')]()['then'](function(){return db[_0xb3c9('0x55')][_0xb3c9('0x4a')]({'where':{'type':_0xb3c9('0x56')},'attributes':['id'],'include':[{'model':db[_0xb3c9('0x4c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xb3c9('0x4e')](function(_0x15b40a){var _0x3c6e24=[];if(_0x15b40a){var _0x17ac76;for(var _0x204d81=0x0,_0x4702db;_0x204d81<_0x15b40a[_0xb3c9('0x19')];_0x204d81+=0x1){_0x4702db=_0x15b40a[_0x204d81][_0xb3c9('0x57')]({'plain':!![]});_0x3c6e24[_0xb3c9('0x2a')](db['sequelize']['query'](_0x18cd19(_0x4702db,_0xb3c9('0x50')))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));}}return _0x3c6e24;})[_0xb3c9('0x54')]();})['then'](function(){return db[_0xb3c9('0x58')][_0xb3c9('0x4a')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0xb3c9('0x4e')](function(_0x14ba3b){var _0x809b0f=[];if(_0x14ba3b){for(var _0x4d3b04=0x0,_0x138e81;_0x4d3b04<_0x14ba3b[_0xb3c9('0x19')];_0x4d3b04+=0x1){_0x138e81=_0x14ba3b[_0x4d3b04][_0xb3c9('0x57')]({'plain':!![]});switch(_0x138e81[_0xb3c9('0x4b')]){case'always':_0x809b0f['push'](db[_0xb3c9('0x52')]['query'](_0x30ff5f(_0x138e81,_0xb3c9('0x59')))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));break;case _0xb3c9('0x51'):_0x809b0f[_0xb3c9('0x2a')](db[_0xb3c9('0x52')][_0xb3c9('0x53')](_0x598977(_0x138e81,_0xb3c9('0x59')))['then'](function(){})[_0xb3c9('0x2c')](_0x2698ba()));break;default:_0x809b0f['push'](db[_0xb3c9('0x52')][_0xb3c9('0x53')](_0x560069(_0x138e81,_0xb3c9('0x59')))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));}}}return _0x809b0f;})[_0xb3c9('0x54')]();})[_0xb3c9('0x4e')](function(){return db[_0xb3c9('0x58')][_0xb3c9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0xb3c9('0x4c')],'as':_0xb3c9('0x5a'),'where':{'id':LISTID}}]})[_0xb3c9('0x4e')](function(_0x560017){var _0x46da5f=[];if(_0x560017){for(var _0x193b8d=0x0,_0x5636cf;_0x193b8d<_0x560017['length'];_0x193b8d+=0x1){_0x5636cf=_0x560017[_0x193b8d][_0xb3c9('0x57')]({'plain':!![]});_0x46da5f[_0xb3c9('0x2a')](db[_0xb3c9('0x52')][_0xb3c9('0x53')](_0x18cd19(_0x5636cf,_0xb3c9('0x59')))[_0xb3c9('0x4e')](function(){})[_0xb3c9('0x2c')](_0x2698ba()));}}return _0x46da5f;})[_0xb3c9('0x54')]();})[_0xb3c9('0x2c')](function(_0x4a2fff){logger[_0xb3c9('0x16')]('cmContact,\x20%s,\x20%s',_0xb3c9('0x5b'),_0x4a2fff[_0xb3c9('0x1b')]);});}var processPromises=function(_0x2fa5ef){return BPromise[_0xb3c9('0x54')](promises)[_0xb3c9('0x4e')](function(_0x4ba9f4){})[_0xb3c9('0x2c')](function(_0x535334){logger[_0xb3c9('0x16')](_0xb3c9('0x5c'),JSON[_0xb3c9('0x2e')](_0x535334));})['finally'](function(){socket['emit'](_0xb3c9('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2fa5ef){return _0x2fa5ef[_0xb3c9('0x5e')]();}});};var endCsv=function(){return BPromise[_0xb3c9('0x5f')]()[_0xb3c9('0x4e')](function(){if(hopperContacts){return checkHopper();}})[_0xb3c9('0x4e')](function(){socket[_0xb3c9('0x60')](_0xb3c9('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb3c9('0x61')](FILEPATH);}catch(_0x521263){logger[_0xb3c9('0x16')](_0xb3c9('0x62'),JSON[_0xb3c9('0x2e')](_0x521263));}finally{process[_0xb3c9('0x63')](0x0);}});};process['on'](_0xb3c9('0x64'),function(){logger[_0xb3c9('0x65')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0xb3c9('0x5f')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xb3c9('0x12')](',');return db[_0xb3c9('0x29')][_0xb3c9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1e2707){var _0x113cde=fs[_0xb3c9('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb3c9('0x67')](_0x113cde,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3a31f9,_0x59e372){total+=0x1;var _0x36540d=total;promises[_0xb3c9('0x2a')](checkRow(_0x3a31f9,_0x1e2707,_0x36540d)[_0xb3c9('0x4e')](function(){success+=0x1;})[_0xb3c9('0x2c')](function(_0x52d472){if(_0x52d472[_0xb3c9('0x16')]){errors+=0x1;delete _0x52d472[_0xb3c9('0x16')];}else if(_0x52d472[_0xb3c9('0x27')]){duplicates+=0x1;delete _0x52d472['duplicate'];}rows['push'](_0x52d472);}));if(total%0xc8===0x0){_0x59e372[_0xb3c9('0x68')]();return processPromises(_0x59e372);}},'complete':function(){return processPromises()[_0xb3c9('0x4e')](function(){logger[_0xb3c9('0x65')](_0xb3c9('0x69'));endCsv();});},'error':function(_0x16263f,_0x9136be){logger['info'](_0xb3c9('0x6a'),JSON[_0xb3c9('0x2e')](_0x16263f));endCsv();}});})[_0xb3c9('0x2c')](function(_0xf7ee67){logger['error'](_0xb3c9('0x6b'),JSON[_0xb3c9('0x2e')](_0xf7ee67));});}main(); \ No newline at end of file +var _0x75d5=['YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','CmContact','create','then','push','pick','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','select','field','NOW()','ContactId','toString','from','cm_contacts','where','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','phone\x20IS\x20NOT\x20NULL','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','catch','Campaign','Lists','get','CampaignId','stringify','finally','contact:csv_','resume','resolve','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','parse','duplicate','pause','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','split','Missing\x20ListId\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','phone','phone\x20not\x20specified!'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x75d5,0xa9));var _0x575d=function(_0x529c2b,_0x58f134){_0x529c2b=_0x529c2b-0x0;var _0x1f88f6=_0x75d5[_0x529c2b];return _0x1f88f6;};'use strict';var BPromise=require(_0x575d('0x0'));var util=require('util');var _=require(_0x575d('0x1'));var fs=require('fs');var squel=require(_0x575d('0x2'));var Papa=require(_0x575d('0x3'));var Redis=require('ioredis');var db=require(_0x575d('0x4'))['db'];var config=require(_0x575d('0x5'));var logger=require(_0x575d('0x6'))(_0x575d('0x7'));config[_0x575d('0x8')]=_[_0x575d('0x9')](config['redis'],{'host':_0x575d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x575d('0x8')]));require(_0x575d('0xb'))['register'](socket);try{if(!process[_0x575d('0xc')][0x2]||process[_0x575d('0xc')][0x2]===_0x575d('0xd')||process[_0x575d('0xc')][0x2]===_0x575d('0xe')){throw new Error(_0x575d('0xf'));}var FILEPATH=process[_0x575d('0xc')][0x2];if(!process[_0x575d('0xc')][0x3]||process[_0x575d('0xc')][0x3]==='undefined'||process[_0x575d('0xc')][0x3]===_0x575d('0xe')||!process[_0x575d('0xc')][0x4]||process['argv'][0x4]==='undefined'||process[_0x575d('0xc')][0x4]===_0x575d('0xe')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_['zipObject'](process['argv'][0x3][_0x575d('0x10')](','),process[_0x575d('0xc')][0x4][_0x575d('0x10')](','));if(!process[_0x575d('0xc')][0x5]||process[_0x575d('0xc')][0x5]===_0x575d('0xd')||process[_0x575d('0xc')][0x5]===_0x575d('0xe')){throw new Error(_0x575d('0x11'));}var LISTID=process[_0x575d('0xc')][0x5];var COMPANYID=process[_0x575d('0xc')][0x6]&&process[_0x575d('0xc')][0x6]!=='undefined'&&process[_0x575d('0xc')][0x6]!=='null'?process[_0x575d('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x575d('0xc')][0x7]!==_0x575d('0xd')&&process[_0x575d('0xc')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x575d('0xc')][0x8]||process[_0x575d('0xc')][0x8]===_0x575d('0xd')||process[_0x575d('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x575d('0xc')][0x8];}catch(_0x4245a3){logger[_0x575d('0x12')](_0x4245a3);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(_0x10a3bc,_0x2372ea,_0x16306f,_0x3970c2){var _0x26799d={'message':_0x2372ea};_0x26799d[_0x10a3bc]=!![];if(_0x16306f){_0x26799d[_0x575d('0x13')]=_0x16306f;}if(_0x3970c2){_0x26799d['index']=_0x3970c2;}return _0x26799d;}function isEmail(_0xcd6044){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))*$/[_0x575d('0x14')](_0xcd6044);}function checkRow(_0x66b790,_0x215d69,_0x5691ca){return new BPromise(function(_0x59465e,_0x3b3c10){if(_[_0x575d('0x15')](_0x66b790)){return _0x3b3c10(handleCheckRowError('error',_0x575d('0x16'),null,_0x5691ca));}if(_0x66b790[_0x575d('0x17')]&&_0x66b790[_0x575d('0x17')][_0x575d('0x18')]){var _0x3bd85b=_['map'](_0x66b790[_0x575d('0x17')],_0x575d('0x19'))['join'](';');return _0x3b3c10(handleCheckRowError(_0x575d('0x12'),_0x3bd85b,null,_0x5691ca));}var _0x481514={};for(var _0x2d86a9 in FIELDS){if(FIELDS[_0x575d('0x1a')](_0x2d86a9)&&FIELDS[_0x2d86a9]){_0x481514[_0x2d86a9]=_0x66b790['data'][0x0][FIELDS[_0x2d86a9]]||_0x66b790['data'][0x0]['\ufeff'+FIELDS[_0x2d86a9]];}}if(!_0x481514['firstName']){return _0x3b3c10(handleCheckRowError(_0x575d('0x12'),'firstName\x20not\x20specified!',null,_0x5691ca));}if(!_0x481514[_0x575d('0x1b')]){return _0x3b3c10(handleCheckRowError('error',_0x575d('0x1c'),null,_0x5691ca));}if(_0x481514['birthDate']){var _0x1b0bcf=moment(_0x481514['birthDate'],_0x575d('0x1d'));if(!_0x1b0bcf[_0x575d('0x1e')]()){return _0x3b3c10(handleCheckRowError('error',_0x575d('0x1f'),null,_0x5691ca));}}if(_0x481514[_0x575d('0x20')]){if(!isEmail(_0x481514[_0x575d('0x20')])){return _0x3b3c10(handleCheckRowError(_0x575d('0x12'),_0x575d('0x21'),null,_0x5691ca));}}_0x481514[_0x575d('0x22')]=LISTID;_0x481514[_0x575d('0x23')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x575d('0x18')]&&_0x215d69){var _0x19fdb9={};for(var _0x2becaa=0x0,_0x19c49e=DUPLICATES['length'];_0x2becaa<_0x19c49e;_0x2becaa+=0x1){_0x19fdb9[DUPLICATES[_0x2becaa]]=_0x481514[DUPLICATES[_0x2becaa]];}var _0x1d3064=_['find'](_0x215d69,_0x19fdb9);if(_0x1d3064){return _0x3b3c10(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x1d3064,_0x5691ca));}}return db[_0x575d('0x24')][_0x575d('0x25')](_0x481514,{'raw':!![],'hooks':![],'fields':_['keys'](_0x481514)})[_0x575d('0x26')](function(_0x5f1ab1){if(DUPLICATES&&DUPLICATES[_0x575d('0x18')]&&_0x215d69){_0x215d69[_0x575d('0x27')](_[_0x575d('0x28')](_0x481514,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5f1ab1['id'];return _0x59465e();})['catch'](function(_0x5fecfc){return _0x3b3c10(handleCheckRowError(_0x575d('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5fecfc[_0x575d('0x19')]||JSON['stringify'](_0x5fecfc)),null,_0x5691ca));});});}function checkHopper(){function _0x70ab52(){return function(_0x1e6822){logger[_0x575d('0x12')]('cmContact','checkHopper',util[_0x575d('0x29')](_0x1e6822,{'showHidden':![],'depth':null}));};}var _0x2df84b=function(_0x33508d,_0x41d7af){var _0x6730cf=squel[_0x575d('0x2a')]()[_0x575d('0x2b')](_0x575d('0x2c'))[_0x575d('0x2d')]([_0x575d('0x1b'),_0x575d('0x2e'),'ContactId','ListId',_0x41d7af,_0x575d('0x2f'),_0x575d('0x30')],squel[_0x575d('0x31')]()[_0x575d('0x32')](_0x575d('0x1b'),_0x575d('0x1b'))['field'](_0x575d('0x33'),_0x575d('0x2e'))[_0x575d('0x32')]('id',_0x575d('0x34'))[_0x575d('0x32')](LISTID[_0x575d('0x35')](),_0x575d('0x22'))[_0x575d('0x32')](_0x33508d['id'][_0x575d('0x35')](),_0x41d7af)['field'](_0x575d('0x33'),_0x575d('0x2f'))[_0x575d('0x32')](_0x575d('0x33'),_0x575d('0x30'))[_0x575d('0x36')](_0x575d('0x37'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x575d('0x35')]())[_0x575d('0x38')]('phone\x20IS\x20NOT\x20NULL')[_0x575d('0x38')](_0x575d('0x39'),squel[_0x575d('0x31')]()['field'](_0x575d('0x1b'))['from']('cm_hopper')['where'](_0x41d7af+_0x575d('0x3a'),_0x33508d['id'][_0x575d('0x35')]())))['toString']();return _0x6730cf;};var _0x173541=function(_0xfa87d9,_0x2e8257){var _0x2c9945=squel[_0x575d('0x2a')]()['into'](_0x575d('0x2c'))[_0x575d('0x2d')]([_0x575d('0x1b'),_0x575d('0x2e'),'ContactId',_0x575d('0x22'),_0x2e8257,'createdAt',_0x575d('0x30')],squel[_0x575d('0x31')]()[_0x575d('0x32')](_0x575d('0x1b'),_0x575d('0x1b'))[_0x575d('0x32')](_0x575d('0x33'),_0x575d('0x2e'))[_0x575d('0x32')]('id',_0x575d('0x34'))['field'](LISTID[_0x575d('0x35')](),_0x575d('0x22'))[_0x575d('0x32')](_0xfa87d9['id'][_0x575d('0x35')](),_0x2e8257)['field'](_0x575d('0x33'),_0x575d('0x2f'))['field'](_0x575d('0x33'),_0x575d('0x30'))['from'](_0x575d('0x37'))[_0x575d('0x38')](_0x575d('0x3b'))[_0x575d('0x38')](_0x575d('0x3c'),LISTID['toString']())[_0x575d('0x38')]('id\x20IN\x20?',squel[_0x575d('0x3d')](hopperContacts))[_0x575d('0x38')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x575d('0x31')]()[_0x575d('0x32')](_0x575d('0x3e'))['from'](_0x575d('0x3f'))[_0x575d('0x38')](_0x2e8257+_0x575d('0x3a'),_0xfa87d9['id']['toString']()))[_0x575d('0x38')](_0x575d('0x39'),squel[_0x575d('0x31')]()[_0x575d('0x32')](_0x575d('0x1b'))[_0x575d('0x36')](_0x575d('0x2c'))[_0x575d('0x38')](_0x2e8257+_0x575d('0x3a'),_0xfa87d9['id'][_0x575d('0x35')]())))[_0x575d('0x35')]();return _0x2c9945;};function _0x3dc85f(_0x43bf27,_0xf6780){var _0x198622=squel[_0x575d('0x2a')]()[_0x575d('0x2b')](_0x575d('0x2c'))[_0x575d('0x2d')](['phone',_0x575d('0x2e'),_0x575d('0x34'),_0x575d('0x22'),_0xf6780,_0x575d('0x2f'),'updatedAt'],squel[_0x575d('0x31')]()[_0x575d('0x32')]('phone','phone')['field'](_0x575d('0x33'),_0x575d('0x2e'))['field']('id',_0x575d('0x34'))[_0x575d('0x32')](LISTID['toString'](),'ListId')[_0x575d('0x32')](_0x43bf27['id'][_0x575d('0x35')](),_0xf6780)[_0x575d('0x32')](_0x575d('0x33'),_0x575d('0x2f'))['field'](_0x575d('0x33'),'updatedAt')[_0x575d('0x36')]('cm_contacts')[_0x575d('0x38')](_0x575d('0x3b'))[_0x575d('0x38')](_0x575d('0x3c'),LISTID[_0x575d('0x35')]())['where'](_0x575d('0x40'),squel[_0x575d('0x3d')](hopperContacts))[_0x575d('0x38')](_0x575d('0x41')))[_0x575d('0x35')]();return _0x198622;}function _0x250f5f(_0x1259b0,_0x3600d3){var _0x5f3783=squel['insert']()[_0x575d('0x2b')](_0x575d('0x42'))[_0x575d('0x2d')]([_0x575d('0x1b'),_0x575d('0x34'),'ListId',_0x3600d3,_0x575d('0x2f'),_0x575d('0x30')],squel['select']()[_0x575d('0x32')]('phone',_0x575d('0x1b'))[_0x575d('0x32')]('id',_0x575d('0x34'))[_0x575d('0x32')](LISTID[_0x575d('0x35')](),_0x575d('0x22'))[_0x575d('0x32')](_0x1259b0['id']['toString'](),_0x3600d3)[_0x575d('0x32')](_0x575d('0x33'),_0x575d('0x2f'))[_0x575d('0x32')]('NOW()','updatedAt')[_0x575d('0x36')]('cm_contacts')[_0x575d('0x38')](_0x575d('0x3b'))[_0x575d('0x38')](_0x575d('0x3c'),LISTID[_0x575d('0x35')]())[_0x575d('0x38')](_0x575d('0x40'),squel[_0x575d('0x3d')](hopperContacts))[_0x575d('0x38')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5f3783;}return db[_0x575d('0x43')][_0x575d('0x44')]({'where':{'type':_0x575d('0x45')},'attributes':['id',_0x575d('0x46')],'include':[{'model':db[_0x575d('0x47')],'as':'Lists','where':{'id':LISTID}}]})[_0x575d('0x26')](function(_0x3353c6){var _0x4b66e6=[];if(_0x3353c6){var _0x309da3;for(var _0x4a758e=0x0,_0x437e5c;_0x4a758e<_0x3353c6['length'];_0x4a758e+=0x1){_0x437e5c=_0x3353c6[_0x4a758e]['get']({'plain':!![]});switch(_0x437e5c[_0x575d('0x46')]){case _0x575d('0x48'):_0x4b66e6[_0x575d('0x27')](db[_0x575d('0x49')][_0x575d('0x4a')](_0x173541(_0x437e5c,_0x575d('0x4b')))[_0x575d('0x26')](function(){})['catch'](_0x70ab52()));break;case _0x575d('0x4c'):_0x4b66e6[_0x575d('0x27')](db[_0x575d('0x49')][_0x575d('0x4a')](_0x2df84b(_0x437e5c,_0x575d('0x4b')))[_0x575d('0x26')](function(){})['catch'](_0x70ab52()));break;default:_0x4b66e6[_0x575d('0x27')](db[_0x575d('0x49')][_0x575d('0x4a')](_0x3dc85f(_0x437e5c,_0x575d('0x4b')))['then'](function(){})['catch'](_0x70ab52()));}}}return _0x4b66e6;})[_0x575d('0x4d')]()[_0x575d('0x26')](function(){return db['VoiceQueue'][_0x575d('0x44')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x575d('0x47')],'as':_0x575d('0x4e'),'where':{'id':LISTID}}]})[_0x575d('0x26')](function(_0x110cf2){var _0x2346ab=[];if(_0x110cf2){var _0x19e360;for(var _0xd28e2d=0x0,_0x229e9d;_0xd28e2d<_0x110cf2[_0x575d('0x18')];_0xd28e2d+=0x1){_0x229e9d=_0x110cf2[_0xd28e2d]['get']({'plain':!![]});_0x2346ab[_0x575d('0x27')](db[_0x575d('0x49')][_0x575d('0x4a')](_0x250f5f(_0x229e9d,_0x575d('0x4b')))[_0x575d('0x26')](function(){})[_0x575d('0x4f')](_0x70ab52()));}}return _0x2346ab;})[_0x575d('0x4d')]();})[_0x575d('0x26')](function(){return db[_0x575d('0x50')][_0x575d('0x44')]({'attributes':['id',_0x575d('0x46')],'include':[{'model':db[_0x575d('0x47')],'as':_0x575d('0x51'),'where':{'id':LISTID}}]})[_0x575d('0x26')](function(_0x271d76){var _0x56a6a6=[];if(_0x271d76){for(var _0x27289d=0x0,_0x58a0a7;_0x27289d<_0x271d76['length'];_0x27289d+=0x1){_0x58a0a7=_0x271d76[_0x27289d][_0x575d('0x52')]({'plain':!![]});switch(_0x58a0a7['dialCheckDuplicateType']){case'always':_0x56a6a6[_0x575d('0x27')](db['sequelize'][_0x575d('0x4a')](_0x173541(_0x58a0a7,_0x575d('0x53')))[_0x575d('0x26')](function(){})[_0x575d('0x4f')](_0x70ab52()));break;case'onlyIfOpen':_0x56a6a6['push'](db[_0x575d('0x49')][_0x575d('0x4a')](_0x2df84b(_0x58a0a7,_0x575d('0x53')))[_0x575d('0x26')](function(){})[_0x575d('0x4f')](_0x70ab52()));break;default:_0x56a6a6['push'](db[_0x575d('0x49')][_0x575d('0x4a')](_0x3dc85f(_0x58a0a7,_0x575d('0x53')))[_0x575d('0x26')](function(){})[_0x575d('0x4f')](_0x70ab52()));}}}return _0x56a6a6;})[_0x575d('0x4d')]();})[_0x575d('0x26')](function(){return db['Campaign'][_0x575d('0x44')]({'attributes':['id'],'include':[{'model':db[_0x575d('0x47')],'as':_0x575d('0x4e'),'where':{'id':LISTID}}]})[_0x575d('0x26')](function(_0x396a01){var _0x24c9dd=[];if(_0x396a01){for(var _0x319374=0x0,_0xc4e3c5;_0x319374<_0x396a01[_0x575d('0x18')];_0x319374+=0x1){_0xc4e3c5=_0x396a01[_0x319374][_0x575d('0x52')]({'plain':!![]});_0x24c9dd['push'](db[_0x575d('0x49')][_0x575d('0x4a')](_0x250f5f(_0xc4e3c5,_0x575d('0x53')))[_0x575d('0x26')](function(){})[_0x575d('0x4f')](_0x70ab52()));}}return _0x24c9dd;})['all']();})[_0x575d('0x4f')](function(_0x144e3b){logger[_0x575d('0x12')]('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x144e3b[_0x575d('0x19')]);});}var processPromises=function(_0x3e0f4d){return BPromise[_0x575d('0x4d')](promises)[_0x575d('0x26')](function(_0x21b6bd){})['catch'](function(_0x549f78){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0x575d('0x54')](_0x549f78));})[_0x575d('0x55')](function(){socket['emit'](_0x575d('0x56')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3e0f4d){return _0x3e0f4d[_0x575d('0x57')]();}});};var endCsv=function(){return BPromise[_0x575d('0x58')]()[_0x575d('0x26')](function(){if(hopperContacts){return checkHopper();}})[_0x575d('0x26')](function(){socket['emit'](_0x575d('0x56')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x575d('0x59')](FILEPATH);}catch(_0x8b1b87){logger[_0x575d('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x8b1b87));}finally{process[_0x575d('0x5a')](0x0);}});};process['on'](_0x575d('0x5b'),function(){logger['info'](_0x575d('0x5c'));endCsv();});function main(){return BPromise[_0x575d('0x58')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x575d('0x24')][_0x575d('0x44')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x575d('0x26')](function(_0x444594){var _0x19528a=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x575d('0x5d')](_0x19528a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x3bdef8,_0x3f4f05){total+=0x1;var _0x335ae2=total;promises['push'](checkRow(_0x3bdef8,_0x444594,_0x335ae2)[_0x575d('0x26')](function(){success+=0x1;})['catch'](function(_0x5e06e3){if(_0x5e06e3[_0x575d('0x12')]){errors+=0x1;delete _0x5e06e3[_0x575d('0x12')];}else if(_0x5e06e3[_0x575d('0x5e')]){duplicates+=0x1;delete _0x5e06e3[_0x575d('0x5e')];}rows[_0x575d('0x27')](_0x5e06e3);}));if(total%0xc8===0x0){_0x3f4f05[_0x575d('0x5f')]();return processPromises(_0x3f4f05);}},'complete':function(){return processPromises()['then'](function(){logger['info']('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x5bab9f,_0x361647){logger[_0x575d('0x60')](_0x575d('0x61'),JSON[_0x575d('0x54')](_0x5bab9f));endCsv();}});})[_0x575d('0x4f')](function(_0x145ce2){logger[_0x575d('0x12')](_0x575d('0x62'),JSON[_0x575d('0x54')](_0x145ce2));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 58cb1bc..520021a 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 _0x405a=['No\x20agent\x20available','SIGINT','path','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','import','defaults','redis','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','phone','from','join','.id\x20=\x20','where','\x20=\x20','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','findOne','update','updated','CmContactHasItem','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','fromQuery','.CmListId','field','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','into','cm_contacts','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_hopper.ListId\x20=\x20?','concat','CompanyId','deletedAt\x20IS\x20NULL','MIN(id)','info','Received\x20SIGINT','message','exit','errors','sequelize','query','spread','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','binding','clone','socket_timestamp','root','.csv','keys','includes','name','header','parse','createReadStream','rows','data','find','_description','hasOwnProperty','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','replace','itemTypeId','appendFileSync','emit','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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()','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x405a,0x164));var _0xa405=function(_0x312962,_0x282d40){_0x312962=_0x312962-0x0;var _0x3e85d0=_0x405a[_0x312962];return _0x3e85d0;};'use strict';var fs=require('fs');var path=require(_0xa405('0x0'));var _=require('lodash');var Papa=require(_0xa405('0x1'));var util=require(_0xa405('0x2'));var BPromise=require(_0xa405('0x3'));var moment=require(_0xa405('0x4'));var squel=require('squel');var Redis=require(_0xa405('0x5'));var db=require(_0xa405('0x6'))['db'];var config=require(_0xa405('0x7'));var shared=require(_0xa405('0x8'));var logger=require('../../../config/logger')(_0xa405('0x9'));config['redis']=_[_0xa405('0xa')](config[_0xa405('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa405('0xc'))(new Redis(config[_0xa405('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xa405('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xa405('0xe')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x72c56f){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'](_0x72c56f);}function selectNotIn(_0x323395,_0x451bdc,_0x26cfca,_0x4c5f67,_0x12f729){return squel['select']()['field'](_0xa405('0xf'))[_0xa405('0x10')](_0x4c5f67)[_0xa405('0x11')](_0x451bdc,null,_0x451bdc+_0xa405('0x12')+_0x4c5f67+'.'+_0x26cfca)[_0xa405('0x13')](_0x4c5f67+'.'+_0x26cfca+_0xa405('0x14')+_0x323395+'.'+_0x26cfca)['where'](_0x451bdc+'.dialCheckDuplicateType\x20IN\x20('+_0x12f729[_0xa405('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x30ad59,_0x3d9feb){promisesAdditionalPhones=[];return db['CmContact'][_0xa405('0x15')]({'raw':!![],'attributes':['id',_0xa405('0x16')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xa405('0x17')](function(_0x4028cd){if(_0x4028cd!==null){var _0x5439b2=[];for(var _0x493bf8=0x0;_0x493bf8<_0x4028cd[_0xa405('0x18')];_0x493bf8++){var _0x47947e=_0x4028cd[_0x493bf8];_0x5439b2[_0xa405('0x19')](insertAdditionalPhones(_0x47947e));}}Promise[_0xa405('0x1a')](_0x5439b2)[_0xa405('0x17')](function(){_0x30ad59({'val':0x1});});});});}function insertAdditionalPhones(_0x42149e){return new Promise(function(_0x383adc,_0x22258d){var _0x96e5c8=_0x42149e[_0xa405('0x16')];var _0x139707=_0x96e5c8[_0xa405('0x1b')](';');var _0x16e638=[];orderBy=0x0;for(var _0x4b1372=0x0;_0x4b1372<_0x139707[_0xa405('0x18')];_0x4b1372++){_0x16e638['push'](splitAdditionalPhone(_0x42149e['id'],_0x139707[_0x4b1372]));}Promise[_0xa405('0x1a')](_0x16e638)[_0xa405('0x17')](function(){_0x383adc({'val':_0x139707[_0xa405('0x18')]});});});}function splitAdditionalPhone(_0x5d82d5,_0x44d1ff){return new Promise(function(_0x5aca37,_0x40cd2a){var _0x27e972=_0x44d1ff[_0xa405('0x1b')](':');var _0x2105d8=_0x27e972[0x0];var _0x548f87=_0x27e972[0x1];if(!_[_0xa405('0x1c')](_0x548f87)){var _0x140df7=_0x548f87[_0xa405('0x1b')]('|');var _0x3ccd62=[];for(var _0x1f2605=0x0;_0x1f2605<_0x140df7[_0xa405('0x18')];_0x1f2605++){if(_0x140df7[_0x1f2605]!==''){var _0x1ad072=_[_0xa405('0x1d')](promisesAdditionalPhones,{'contactId':_0x5d82d5,'phone':_0x140df7[_0x1f2605]});if(_0x1ad072[_0xa405('0x18')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x5d82d5,'contactTypeId':_0x2105d8,'phone':_0x140df7[_0x1f2605],'orderBy':orderBy});}}}_0x5aca37({'ok':0x1});}else _0x5aca37({'res':0x0});});}function createAdditionalPhone(_0x2747ad,_0x1f2397,_0x620156,_0x5f27cc){var _0x5c08a0='';var _0x5e99f4='';var _0x53828a=_0x620156[_0xa405('0x1b')]('§');_0x5c08a0=_0x53828a[0x0];if(_0x53828a['length']==0x2)_0x5e99f4=_0x53828a[0x1];return new Promise(function(_0x540acb,_0x2a5a2f){return db['CmContactHasItem'][_0xa405('0x1e')]({'where':{'CmContactId':_0x2747ad,'item':_0x5c08a0}})[_0xa405('0x17')](function(_0x4c7ae7){if(_0x4c7ae7){return db['CmContactHasItem'][_0xa405('0x1f')]({'ItemTypeId':_0x1f2397,'description':_0x5e99f4,'OrderBy':_0x5f27cc},{'where':{'CmContactId':_0x2747ad,'item':_0x5c08a0}})[_0xa405('0x17')](function(_0x2882d2){_0x540acb({'res':_0xa405('0x20')});});}else{return db[_0xa405('0x21')][_0xa405('0x22')]({'CmContactId':_0x2747ad,'item':_0x5c08a0,'description':_0x5e99f4,'ItemTypeId':_0x1f2397,'OrderBy':_0x5f27cc,'ItemClass':_0xa405('0x23')})[_0xa405('0x17')](function(_0x43892c){_0x540acb({'res':_0xa405('0x24')});});}});});}function insertCmHopper(_0x503ad9,_0x1cc701,_0x202d92,_0x4f0e32,_0xc3dceb){var _0x559e9d=[_0xa405('0x25'),_0xa405('0x26'),_0xa405('0x27'),_0xa405('0x28'),_0x1cc701+'.'+_0x4f0e32,_0xa405('0x29'),_0xa405('0x2a'),_0xa405('0x2b'),_0xa405('0x2c'),'\x22'+_0xc3dceb+'\x22'];return squel[_0xa405('0x2d')]()['into'](_0xa405('0x2e'))['fromQuery']([_0xa405('0xf'),_0xa405('0x2f'),_0xa405('0x30'),_0xa405('0x31'),_0x4f0e32,_0xa405('0x32'),_0xa405('0x33'),_0xa405('0x34'),_0xa405('0x35'),_0xa405('0x36')],squel[_0xa405('0x37')]()[_0xa405('0x38')](_0x559e9d)['from'](_0x1cc701)[_0xa405('0x11')]('cm_contacts',null,_0xa405('0x39')+_0x1cc701+'.CmListId')[_0xa405('0x11')](_0x202d92,null,_0x202d92+'.id\x20=\x20'+_0x1cc701+'.'+_0x4f0e32)['where'](_0x1cc701+_0xa405('0x3a'),_0x503ad9)[_0xa405('0x13')](_0xa405('0x3b'),NOW)[_0xa405('0x13')](_0xa405('0x3c'),selectNotIn(_0x1cc701,_0x202d92,_0x4f0e32,_0xa405('0x2e'),[_0xa405('0x3d'),_0xa405('0x3e')]))[_0xa405('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1cc701,_0x202d92,_0x4f0e32,_0xa405('0x2e'),[_0xa405('0x3d')])))['toString']();}function insertCmHopperBlack(_0x2e5aa9,_0x3fbb04,_0xb472d,_0x1ff37e){var _0x5236a7=[_0xa405('0x25'),_0xa405('0x27'),'cm_contacts.ListId',_0x3fbb04+'.'+_0x1ff37e,_0xa405('0x29'),_0xa405('0x2a')];return squel[_0xa405('0x2d')]()['into'](_0xa405('0x3f'))[_0xa405('0x40')]([_0xa405('0xf'),_0xa405('0x30'),_0xa405('0x31'),_0x1ff37e,_0xa405('0x32'),_0xa405('0x33')],squel[_0xa405('0x37')]()[_0xa405('0x38')](_0x5236a7)[_0xa405('0x10')](_0x3fbb04)[_0xa405('0x11')]('cm_contacts',null,_0xa405('0x39')+_0x3fbb04+_0xa405('0x41'))['join'](_0xb472d,null,_0xb472d+_0xa405('0x12')+_0x3fbb04+'.'+_0x1ff37e)[_0xa405('0x13')](_0x3fbb04+_0xa405('0x3a'),_0x2e5aa9)['where'](_0xa405('0x3b'),NOW)[_0xa405('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xa405('0x37')]()[_0xa405('0x42')](_0xa405('0xf'))['from'](_0xa405('0x3f'))['where'](_0xa405('0x43'),_0x2e5aa9)[_0xa405('0x13')](_0x1ff37e+'\x20=\x20'+_0x3fbb04+'.'+_0x1ff37e)))[_0xa405('0x44')]();}function insertTzCmHopper(_0x562966,_0x568d71,_0x5a73f1,_0x27a31d,_0xf7691f,_0x27e43f){var _0x33fdd0=[_0xa405('0x25'),_0xa405('0x45')+_0x27e43f+_0xa405('0x46'),_0xa405('0x27'),_0xa405('0x28'),_0x568d71+'.'+_0x27a31d,_0xa405('0x29'),'cm_contacts.updatedAt',_0xa405('0x2b'),'cm_contacts.UserId','\x22'+_0xf7691f+'\x22'];var _0x57ef9b=squel[_0xa405('0x2d')]()['into'](_0xa405('0x2e'))[_0xa405('0x40')]([_0xa405('0xf'),'scheduledat',_0xa405('0x30'),_0xa405('0x31'),_0x27a31d,_0xa405('0x32'),'updatedAt',_0xa405('0x34'),_0xa405('0x35'),_0xa405('0x36')],squel[_0xa405('0x37')]()['fields'](_0x33fdd0)[_0xa405('0x10')](_0x568d71)[_0xa405('0x11')]('cm_contacts',null,_0xa405('0x39')+_0x568d71+'.CmListId')[_0xa405('0x11')](_0x5a73f1,null,_0x5a73f1+_0xa405('0x12')+_0x568d71+'.'+_0x27a31d)[_0xa405('0x11')](_0x27e43f,null,_0x27e43f+_0xa405('0x12')+_0x568d71+'.'+_0x27a31d)[_0xa405('0x13')](_0x568d71+_0xa405('0x3a'),_0x562966)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xa405('0x3c'),selectNotIn(_0x568d71,_0x5a73f1,_0x27a31d,_0xa405('0x2e'),[_0xa405('0x3d'),'\x22onlyIfOpen\x22']))[_0xa405('0x13')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x568d71,_0x5a73f1,_0x27a31d,_0xa405('0x2e'),[_0xa405('0x3d')])))['toString']();return _0x57ef9b;}function insertTzCmHopperBlack(_0x27396f,_0x2ae8b9,_0x318884,_0xbba5a9){var _0x3496d1=[_0xa405('0x25'),_0xa405('0x27'),_0xa405('0x28'),_0x2ae8b9+'.'+_0xbba5a9,_0xa405('0x29'),_0xa405('0x2a')];return squel[_0xa405('0x2d')]()[_0xa405('0x47')]('cm_hopper_black')[_0xa405('0x40')]([_0xa405('0xf'),_0xa405('0x30'),'ListId',_0xbba5a9,_0xa405('0x32'),'updatedAt'],squel[_0xa405('0x37')]()[_0xa405('0x38')](_0x3496d1)[_0xa405('0x10')](_0x2ae8b9)[_0xa405('0x11')](_0xa405('0x48'),null,'cm_contacts.ListId\x20=\x20'+_0x2ae8b9+_0xa405('0x41'))['join'](_0x318884,null,_0x318884+_0xa405('0x12')+_0x2ae8b9+'.'+_0xbba5a9)[_0xa405('0x13')](_0x2ae8b9+_0xa405('0x3a'),_0x27396f)[_0xa405('0x13')](_0xa405('0x3b'),NOW)[_0xa405('0x13')](_0xa405('0x3c'),squel[_0xa405('0x37')]()[_0xa405('0x42')](_0xa405('0xf'))[_0xa405('0x10')]('cm_hopper_black')[_0xa405('0x13')](_0xa405('0x43'),_0x27396f)[_0xa405('0x13')](_0xbba5a9+'\x20=\x20'+_0x2ae8b9+'.'+_0xbba5a9)))[_0xa405('0x44')]();}function insertCmHopperAdditionalPhones(_0x12efc2){var _0x1d6dd8=[_0xa405('0x49'),_0xa405('0x4a'),_0xa405('0x4b'),_0xa405('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0xa405('0x2d')]()[_0xa405('0x47')](_0xa405('0x4d'))[_0xa405('0x40')]([_0xa405('0x4e'),_0xa405('0xf'),'OrderBy',_0xa405('0x32'),_0xa405('0x33')],squel[_0xa405('0x37')]()[_0xa405('0x38')](_0x1d6dd8)[_0xa405('0x10')](_0xa405('0x2e'))[_0xa405('0x11')](_0xa405('0x48'),null,_0xa405('0x4f'))['join'](_0xa405('0x50'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xa405('0x51'),_0x12efc2)[_0xa405('0x13')](_0xa405('0x3b'),NOW))[_0xa405('0x44')]();}function insertCmContact(_0x270f04,_0x38ecf1,_0x6e34aa,_0xe0066b){var _0x256112=_[_0xa405('0x52')](_['keys'](_0xe0066b),['ListId',_0xa405('0x53'),_0xa405('0x32'),'updatedAt','scheduledAt']);return squel[_0xa405('0x2d')]()[_0xa405('0x47')](_0xa405('0x48'))['fromQuery'](_0x256112,squel[_0xa405('0x37')]()['fields'](_0x256112)[_0xa405('0x10')](_0x38ecf1)[_0xa405('0x13')]('('+_0x6e34aa[_0xa405('0x11')](',')+')\x20NOT\x20IN\x20?',squel[_0xa405('0x37')]()[_0xa405('0x38')](_0x6e34aa)['from']('cm_contacts')['where'](_0xa405('0x43'),_0x270f04)['where'](_0xa405('0x54')))[_0xa405('0x13')]('id\x20IN\x20?',squel[_0xa405('0x37')]()[_0xa405('0x42')](_0xa405('0x55'),'min_id')[_0xa405('0x10')](_0x38ecf1)['group'](_0x6e34aa[_0xa405('0x11')](','))))[_0xa405('0x44')]();}function handleStop(){logger[_0xa405('0x56')](_0xa405('0x57'));stopped=!![];}function handleUncaughtException(_0x5dd20a){logger['error'](_0x5dd20a[_0xa405('0x58')]);process[_0xa405('0x59')](0x1);}function handleError(_0x2b50bb,_0x56e0d4){stats[_0xa405('0x5a')]['push']({'name':_0x56e0d4['code'],'message':_0x56e0d4[_0xa405('0x58')],'row':_0x2b50bb});}function handleQuery(_0x9be36d){logger[_0xa405('0x56')](_0x9be36d);return db[_0xa405('0x5b')][_0xa405('0x5c')](_0x9be36d)[_0xa405('0x5d')](function(_0x5ea897){results[_0xa405('0x19')](_0x5ea897);})['catch'](function(_0x558f6c){logger[_0xa405('0x5e')](_0x558f6c[_0xa405('0x58')]);});}function updateTzCampaigns(_0x377946){return new Promise(function(_0xaf95d5,_0x11d420){var _0x139c81=squel[_0xa405('0x37')]()[_0xa405('0x38')]([_0xa405('0x5f'),_0xa405('0x60')])[_0xa405('0x10')](_0xa405('0x61'))[_0xa405('0x11')](_0xa405('0x62'),null,_0xa405('0x63'))[_0xa405('0x13')](_0xa405('0x64')+_0x377946);db[_0xa405('0x5b')][_0xa405('0x5c')](_0x139c81[_0xa405('0x44')]())[_0xa405('0x5d')](function(_0x17e6f1){var _0x4046fe=[];for(var _0x2726c1=0x0;_0x2726c1<_0x17e6f1[_0xa405('0x18')];_0x2726c1++){_0x4046fe[_0xa405('0x19')](getTimezoneData(_0x17e6f1[_0x2726c1],tmp_campaigns));}BPromise[_0xa405('0x1a')](_0x4046fe)['then'](function(){_0xaf95d5({'val':0x1});});})[_0xa405('0x65')](function(_0x353b79){logger[_0xa405('0x5e')](_0x353b79[_0xa405('0x58')]);_0xaf95d5({'val':0x0});});});}function updateTzVoiceQueues(_0x2616f4){return new Promise(function(_0x2113ff,_0x521c0e){var _0x85f8d3=squel[_0xa405('0x37')]()[_0xa405('0x38')]([_0xa405('0x66'),_0xa405('0x67')])[_0xa405('0x10')](_0xa405('0x68'))['join'](_0xa405('0x69'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xa405('0x13')](_0xa405('0x6a')+_0x2616f4);db[_0xa405('0x5b')][_0xa405('0x5c')](_0x85f8d3['toString']())['spread'](function(_0x29666c){var _0x5d69c2=[];for(var _0x559d14=0x0;_0x559d14<_0x29666c['length'];_0x559d14++){_0x5d69c2[_0xa405('0x19')](getTimezoneData(_0x29666c[_0x559d14],tmp_voice_queues));}BPromise[_0xa405('0x1a')](_0x5d69c2)[_0xa405('0x17')](function(){_0x2113ff({'val':0x1});});})[_0xa405('0x65')](function(_0x28647c){logger[_0xa405('0x5e')](_0x28647c[_0xa405('0x58')]);_0x2113ff({'val':0x0});});});}function getTimezoneData(_0x640d02,_0x27134c){return new Promise(function(_0x5745d5,_0x4a11b9){var _0xa537e1=shared[_0xa405('0x6b')];var _0x4e4948=_0xa537e1[_0x640d02[_0xa405('0x6c')]];if(_[_0xa405('0x1c')](_0x4e4948)){_0x5745d5({'ret':0x1});}else{var _0x35fa28=_0x4e4948[_0xa405('0x6d')];var _0x41e58e=squel[_0xa405('0x2d')]()[_0xa405('0x47')](_0x27134c)['set']('id',_0x640d02['id'])[_0xa405('0x6e')](_0xa405('0x6f'),_0x35fa28)[_0xa405('0x6e')](_0xa405('0x6c'),_0x640d02[_0xa405('0x6c')])[_0xa405('0x44')]();return db['sequelize'][_0xa405('0x5c')](_0x41e58e)[_0xa405('0x5d')](function(_0x39e4b5){_0x5745d5({'ret':0x1});})['catch'](function(_0x32c8b9){logger[_0xa405('0x5e')](_0x32c8b9['message']);_0x4a11b9({'ret':0x1});});}});}function handleTZQuery(_0x25a6f8){logger[_0xa405('0x56')](_0x25a6f8);return db['sequelize'][_0xa405('0x5c')](_0x25a6f8)[_0xa405('0x5d')](function(_0x5d8956){})[_0xa405('0x65')](function(_0x525812){logger[_0xa405('0x5e')](_0x525812[_0xa405('0x58')]);});}function main(_0xfdfbf7,_0x250c1a,_0x500c0a,_0x3cec15){logger[_0xa405('0x56')](_0xa405('0x70'),_0xfdfbf7,JSON['stringify'](_0x250c1a));process[_0xa405('0x71')]('start');var _0x13bb62=_0x250c1a[_0xa405('0x72')];var _0x4acae3=_[_0xa405('0x73')](_0x13bb62);var _0x488f5e=_0x250c1a[_0xa405('0x74')];var _0x48384a=path[_0xa405('0x11')](config[_0xa405('0x75')],'server/files/tmp',_0x488f5e+_0xa405('0x76'));hasTZ=_[_0xa405('0x77')](_0x13bb62)[_0xa405('0x78')]('dialTimezone');var _0x4a0554=_['keys'](_0x13bb62)[_0xa405('0x11')]();logger[_0xa405('0x56')]('header',_0x4a0554);db['ContactItemType'][_0xa405('0x15')]({'raw':!![],'attributes':['id',_0xa405('0x79')]})[_0xa405('0x17')](function(_0x16156d){for(var _0x562f2a=0x0;_0x562f2a<_0x16156d[_0xa405('0x18')];_0x562f2a++){if(_0x16156d[_0x562f2a][_0xa405('0x79')]in _0x13bb62){contactItemTypes[_0xa405('0x19')](_0x16156d[_0x562f2a]);delete _0x4acae3[_0x16156d[_0x562f2a][_0xa405('0x79')]];hasAdditionalPhones=!![];}for(var _0x30087a in _0x13bb62){if(_0x16156d[_0x562f2a][_0xa405('0x79')]+'_description'===_0x30087a){phoneDescriptions[_0xa405('0x19')]({'itemTypeId':_0x16156d[_0x562f2a]['id'],'description':_0x30087a});delete _0x4acae3[_0x30087a];}}}if(hasAdditionalPhones)_0x4acae3['AdditionalPhones']='';var _0x37334e=_[_0xa405('0x77')](_0x4acae3)['join']();logger[_0xa405('0x56')](_0xa405('0x7a'),_0x37334e);fs['writeFileSync'](_0x48384a,_0x37334e+'\x0a');Papa[_0xa405('0x7b')](fs[_0xa405('0x7c')](_0xfdfbf7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x34e090,_0x3d7c36){try{for(var _0x6b2da6=0x0,_0x2aa5e7=[];_0x6b2da6<_0x34e090['data'][_0xa405('0x18')];_0x6b2da6++){stats[_0xa405('0x7d')]+=0x1;if(_0x34e090['errors'][_0x6b2da6]){handleError(_0x34e090[_0xa405('0x7e')][_0x6b2da6],_0x34e090[_0xa405('0x5a')][_0x6b2da6]);}else{var _0x58e7f9=[];var _0x34705f=[];var _0x4bf449={};for(var _0x1c46d2 in _0x13bb62){let _0x168d48=contactItemTypes[_0xa405('0x7f')](_0xb69e30=>_0xb69e30['name']===_0x1c46d2);let _0x45e67a=contactItemTypes[_0xa405('0x7f')](_0x45bfb2=>_0x45bfb2[_0xa405('0x79')]+_0xa405('0x80')===_0x1c46d2);if(_[_0xa405('0x1c')](_0x168d48)&&_[_0xa405('0x1c')](_0x45e67a)){if(_0x13bb62[_0xa405('0x81')](_0x1c46d2)){if(_0x34e090[_0xa405('0x7e')][_0x6b2da6][_0x13bb62[_0x1c46d2]]){var _0x1bb096=_[_0xa405('0x82')](_0x34e090[_0xa405('0x7e')][_0x6b2da6][_0x13bb62[_0x1c46d2]]['replace'](/"/g,'\x27'));switch(_0x1c46d2){case _0xa405('0x2f'):var _0x35972c=moment(_0x1bb096,_0xa405('0xd'),!![]);if(_0x35972c['isValid']()){_0x2aa5e7['push']('\x22'+_0x1bb096+'\x22');}else{_0x58e7f9['push'](_0xa405('0x83'));}break;case _0xa405('0x34'):var _0x52249e=parseInt(_0x1bb096);_0x1bb096=_['isNaN'](_0x52249e)||_0x52249e<0x0||_0x52249e>0x4?_0x3cec15?0x3:0x2:_0x52249e;_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x1bb096+'\x22');break;case'UserId':var _0x7f2327=parseInt(_0x1bb096);if(_[_0xa405('0x84')](_0x7f2327)&&_[_0xa405('0x78')](_0x500c0a,_0x7f2327)){_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x7f2327+'\x22');}else{_0x58e7f9[_0xa405('0x19')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x1bb096)){_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x1bb096+'\x22');}else{_0x58e7f9['push'](_0xa405('0x85'));}break;case _0xa405('0x86'):var _0x2b1ec5=moment(_0x1bb096,_0xa405('0x87'),!![]);if(_0x2b1ec5[_0xa405('0x88')]()){_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x1bb096+'\x22');}else{_0x58e7f9['push'](_0xa405('0x89'));}break;case _0xa405('0x6c'):var _0x4440a1=shared[_0xa405('0x6b')];var _0x5baa24=_0x4440a1[_0x1bb096];if(!_[_0xa405('0x1c')](_0x5baa24)){var _0x4fe833=_0x5baa24[_0xa405('0x6d')];_0x2aa5e7['push']('\x22'+_0x1bb096+'\x22');_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x4fe833+'\x22');}break;default:_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x1bb096+'\x22');}}else{switch(_0x1c46d2){case'firstName':case'phone':_0x58e7f9[_0xa405('0x19')](_0x1c46d2+'\x20not\x20specified');break;default:_0x2aa5e7[_0xa405('0x19')]('\x22\x22');}}}}else{var _0x3338ab='';if(!_[_0xa405('0x1c')](_0x168d48)){if(!_0x4bf449[_0xa405('0x81')](_0x168d48['id'])){if(!_[_0xa405('0x1c')](_0x34e090['data'][_0x6b2da6][_0x13bb62[_0x1c46d2]])){var _0x1bb096=_['trim'](_0x34e090[_0xa405('0x7e')][_0x6b2da6][_0x13bb62[_0x1c46d2]][_0xa405('0x8a')](/"/g,'\x27'));var _0x31eabb=phoneDescriptions[_0xa405('0x7f')](_0x59e2ca=>_0x59e2ca[_0xa405('0x8b')]===_0x168d48['id']);if(!_['isNil'](_0x31eabb)){var _0x155bbd=_[_0xa405('0x82')](_0x34e090[_0xa405('0x7e')][_0x6b2da6][_0x13bb62[_0x31eabb['description']]][_0xa405('0x8a')](/"/g,'\x27'));if(!_[_0xa405('0x1c')](_0x155bbd))_0x1bb096=_0x1bb096+'§'+_0x155bbd;}if(_0x3338ab=='')_0x3338ab=_0x1bb096;else _0x3338ab+='|'+_0x1bb096;}_0x34705f[_0xa405('0x19')](_0x168d48['id']+':'+_0x3338ab);_0x4bf449[_0x168d48['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2aa5e7[_0xa405('0x19')]('\x22'+_0x34705f[_0xa405('0x11')](';')+'\x22');}if(_0x58e7f9['length']){handleError(_0x34e090[_0xa405('0x7e')][_0x6b2da6],{'code':'SystemRow','message':_0x58e7f9[_0xa405('0x11')]()});}else{fs[_0xa405('0x8c')](_0x48384a,_0x2aa5e7[_0xa405('0x11')]()+'\x0a');}_0x2aa5e7=[];}if(!(stats[_0xa405('0x7d')]%0xc8)){socket[_0xa405('0x8d')]('contact:import:'+_0x488f5e,stats);stats[_0xa405('0x5a')]=[];}}if(stopped){logger[_0xa405('0x56')]('Abort\x20parser');_0x3d7c36['abort']();}}catch(_0xb0715b){handleError(_0x34e090[_0xa405('0x7e')][_0x6b2da6],{'code':'SystemError','message':_0xb0715b[_0xa405('0x58')]});logger[_0xa405('0x5e')](_0xa405('0x8e'),_0xb0715b[_0xa405('0x58')]);}},'complete':function(){try{var _0x39f2a2=[];var _0x41dcaa=[];var _0x11d27c=_0xa405('0x48');if(_0x250c1a[_0xa405('0x8f')]&&_0x250c1a[_0xa405('0x8f')]['length']){_0x11d27c=_0xa405('0x90')+_0x488f5e;_0x39f2a2['push'](_0xa405('0x91')+_0x11d27c+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xa405('0x92')+_0x488f5e;tmp_voice_queues=_0xa405('0x93')+_0x488f5e;_0x41dcaa[_0xa405('0x19')](_0xa405('0x91')+tmp_campaigns+_0xa405('0x94'));_0x41dcaa[_0xa405('0x19')](_0xa405('0x91')+tmp_voice_queues+_0xa405('0x94'));BPromise[_0xa405('0x95')](_0x41dcaa,handleTZQuery)['then'](function(_0x435845){updateTzCampaigns(_0x250c1a[_0xa405('0x31')])[_0xa405('0x17')](function(_0xf2d636){updateTzVoiceQueues(_0x250c1a[_0xa405('0x31')])['then'](function(_0x103de9){if(hasTZ)_0x37334e=_0x37334e[_0xa405('0x8a')]('dialTimezone','dialTimezone,utcOffset');var _0x2ac54a=util[_0xa405('0xe')](_0xa405('0x96'),_0x48384a,_0x11d27c,_0x37334e,_0x250c1a[_0xa405('0x31')],_0x250c1a['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x13bb62[_0xa405('0x2f')])){_0x2ac54a+=_0xa405('0x97');}_0x39f2a2['push'](_0x2ac54a);if(_0x250c1a['duplicates']&&_0x250c1a[_0xa405('0x8f')][_0xa405('0x18')]){_0x39f2a2[_0xa405('0x19')](insertCmContact(_0x250c1a['ListId'],_0x11d27c,_0x250c1a['duplicates'],_0x13bb62));_0x39f2a2[_0xa405('0x19')]('DROP\x20TABLE\x20'+_0x11d27c+';');}BPromise[_0xa405('0x95')](_0x39f2a2,handleQuery)['then'](function(_0x4ed7cc){BPromise[_0xa405('0x1a')]([handleAdditionalPhones()])['then'](function(){_0x39f2a2=[];for(var _0x17a65d=0x0;_0x17a65d\x20\x20','existsSync','parse','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../config/environment/shared','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','all','length','split','isNil','filter','push','CmContactHasItem','findOne','update','updated','PHONE','inserted','cm_contacts.scheduledat','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','into','ContactId','ListId','updatedAt','priority','recallme','fields','cm_contacts','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','insert','cm_hopper_black','createdAt','ListId\x20=\x20?','cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper','fromQuery','scheduledat','cm_contacts.ListId\x20=\x20','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','concat','keys','CompanyId'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe2db,0x127));var _0xbe2d=function(_0x577d48,_0x2a293e){_0x577d48=_0x577d48-0x0;var _0x1bfed4=_0xe2db[_0x577d48];return _0x1bfed4;};'use strict';var fs=require('fs');var path=require(_0xbe2d('0x0'));var _=require(_0xbe2d('0x1'));var Papa=require('papaparse');var util=require(_0xbe2d('0x2'));var BPromise=require(_0xbe2d('0x3'));var moment=require(_0xbe2d('0x4'));var squel=require(_0xbe2d('0x5'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0xbe2d('0x6'));var logger=require('../../../config/logger')(_0xbe2d('0x7'));config['redis']=_[_0xbe2d('0x8')](config[_0xbe2d('0x9')],{'host':_0xbe2d('0xa'),'port':0x18eb});var socket=require(_0xbe2d('0xb'))(new Redis(config[_0xbe2d('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xbe2d('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0xbe2d('0xc')](_0xbe2d('0xd'));function isEmail(_0x471dd8){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))*$/[_0xbe2d('0xe')](_0x471dd8);}function selectNotIn(_0x1bede7,_0x381f7f,_0x15ae6a,_0x5064d2,_0x1bbce3){return squel[_0xbe2d('0xf')]()[_0xbe2d('0x10')](_0xbe2d('0x11'))[_0xbe2d('0x12')](_0x5064d2)[_0xbe2d('0x13')](_0x381f7f,null,_0x381f7f+_0xbe2d('0x14')+_0x5064d2+'.'+_0x15ae6a)['where'](_0x5064d2+'.'+_0x15ae6a+_0xbe2d('0x15')+_0x1bede7+'.'+_0x15ae6a)['where'](_0x381f7f+_0xbe2d('0x16')+_0x1bbce3['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x50188b,_0x21b258){promisesAdditionalPhones=[];return db[_0xbe2d('0x17')][_0xbe2d('0x18')]({'raw':!![],'attributes':['id',_0xbe2d('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xbe2d('0x1a')](function(_0x46afce){if(_0x46afce!==null){var _0x31255c=[];for(var _0xd1887e=0x0;_0xd1887e<_0x46afce['length'];_0xd1887e++){var _0x5399ac=_0x46afce[_0xd1887e];_0x31255c['push'](insertAdditionalPhones(_0x5399ac));}}Promise[_0xbe2d('0x1b')](_0x31255c)[_0xbe2d('0x1a')](function(){_0x50188b({'val':0x1});});});});}function insertAdditionalPhones(_0x135c5d){return new Promise(function(_0x1f5a53,_0x43b1d9){var _0x13996f=_0x135c5d[_0xbe2d('0x19')];var _0x44e0f2=_0x13996f['split'](';');var _0x56d409=[];orderBy=0x0;for(var _0x3f1ee2=0x0;_0x3f1ee2<_0x44e0f2['length'];_0x3f1ee2++){_0x56d409['push'](splitAdditionalPhone(_0x135c5d['id'],_0x44e0f2[_0x3f1ee2]));}Promise[_0xbe2d('0x1b')](_0x56d409)[_0xbe2d('0x1a')](function(){_0x1f5a53({'val':_0x44e0f2[_0xbe2d('0x1c')]});});});}function splitAdditionalPhone(_0x4b8a4f,_0x1503c6){return new Promise(function(_0x4ef2ef,_0x91bd74){var _0xb7a646=_0x1503c6[_0xbe2d('0x1d')](':');var _0x3bcf70=_0xb7a646[0x0];var _0x5d6171=_0xb7a646[0x1];if(!_[_0xbe2d('0x1e')](_0x5d6171)){var _0x51d8ff=_0x5d6171[_0xbe2d('0x1d')]('|');var _0x1e98cc=[];for(var _0x44a00e=0x0;_0x44a00e<_0x51d8ff[_0xbe2d('0x1c')];_0x44a00e++){if(_0x51d8ff[_0x44a00e]!==''){var _0x55873d=_[_0xbe2d('0x1f')](promisesAdditionalPhones,{'contactId':_0x4b8a4f,'phone':_0x51d8ff[_0x44a00e]});if(_0x55873d['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbe2d('0x20')]({'contactId':_0x4b8a4f,'contactTypeId':_0x3bcf70,'phone':_0x51d8ff[_0x44a00e],'orderBy':orderBy});}}}_0x4ef2ef({'ok':0x1});}else _0x4ef2ef({'res':0x0});});}function createAdditionalPhone(_0x4b8ac0,_0x5511dc,_0x5c2cec,_0x470cc4){var _0x2c0abe='';var _0x51e1b3='';var _0x8ca156=_0x5c2cec[_0xbe2d('0x1d')]('§');_0x2c0abe=_0x8ca156[0x0];if(_0x8ca156[_0xbe2d('0x1c')]==0x2)_0x51e1b3=_0x8ca156[0x1];return new Promise(function(_0x5f2c94,_0x282bea){return db[_0xbe2d('0x21')][_0xbe2d('0x22')]({'where':{'CmContactId':_0x4b8ac0,'item':_0x2c0abe}})['then'](function(_0x1fc953){if(_0x1fc953){return db[_0xbe2d('0x21')][_0xbe2d('0x23')]({'ItemTypeId':_0x5511dc,'description':_0x51e1b3,'OrderBy':_0x470cc4},{'where':{'CmContactId':_0x4b8ac0,'item':_0x2c0abe}})[_0xbe2d('0x1a')](function(_0x5b15c5){_0x5f2c94({'res':_0xbe2d('0x24')});});}else{return db['CmContactHasItem']['create']({'CmContactId':_0x4b8ac0,'item':_0x2c0abe,'description':_0x51e1b3,'ItemTypeId':_0x5511dc,'OrderBy':_0x470cc4,'ItemClass':_0xbe2d('0x25')})[_0xbe2d('0x1a')](function(_0x276dde){_0x5f2c94({'res':_0xbe2d('0x26')});});}});});}function insertCmHopper(_0x166824,_0x57ec32,_0x51396b,_0x233f62,_0x533188){var _0x1817a5=['cm_contacts.phone',_0xbe2d('0x27'),'cm_contacts.id',_0xbe2d('0x28'),_0x57ec32+'.'+_0x233f62,_0xbe2d('0x29'),_0xbe2d('0x2a'),_0xbe2d('0x2b'),_0xbe2d('0x2c'),'\x22'+_0x533188+'\x22'];return squel['insert']()[_0xbe2d('0x2d')]('cm_hopper')['fromQuery']([_0xbe2d('0x11'),'scheduledat',_0xbe2d('0x2e'),_0xbe2d('0x2f'),_0x233f62,'createdAt',_0xbe2d('0x30'),_0xbe2d('0x31'),'UserId',_0xbe2d('0x32')],squel[_0xbe2d('0xf')]()[_0xbe2d('0x33')](_0x1817a5)[_0xbe2d('0x12')](_0x57ec32)[_0xbe2d('0x13')](_0xbe2d('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x57ec32+_0xbe2d('0x35'))[_0xbe2d('0x13')](_0x51396b,null,_0x51396b+_0xbe2d('0x14')+_0x57ec32+'.'+_0x233f62)[_0xbe2d('0x36')](_0x57ec32+_0xbe2d('0x37'),_0x166824)[_0xbe2d('0x36')](_0xbe2d('0x38'),NOW)['where'](_0xbe2d('0x39'),selectNotIn(_0x57ec32,_0x51396b,_0x233f62,'cm_hopper',[_0xbe2d('0x3a'),_0xbe2d('0x3b')]))[_0xbe2d('0x36')](_0xbe2d('0x39'),selectNotIn(_0x57ec32,_0x51396b,_0x233f62,'cm_hopper',[_0xbe2d('0x3a')])))[_0xbe2d('0x3c')]();}function insertCmHopperBlack(_0x4dee70,_0x295b7a,_0xfa7cb3,_0x4b6f3d){var _0x232ffd=['cm_contacts.phone',_0xbe2d('0x3d'),_0xbe2d('0x28'),_0x295b7a+'.'+_0x4b6f3d,_0xbe2d('0x29'),_0xbe2d('0x2a')];return squel[_0xbe2d('0x3e')]()['into'](_0xbe2d('0x3f'))['fromQuery']([_0xbe2d('0x11'),'ContactId',_0xbe2d('0x2f'),_0x4b6f3d,_0xbe2d('0x40'),_0xbe2d('0x30')],squel[_0xbe2d('0xf')]()['fields'](_0x232ffd)['from'](_0x295b7a)[_0xbe2d('0x13')](_0xbe2d('0x34'),null,'cm_contacts.ListId\x20=\x20'+_0x295b7a+_0xbe2d('0x35'))['join'](_0xfa7cb3,null,_0xfa7cb3+_0xbe2d('0x14')+_0x295b7a+'.'+_0x4b6f3d)[_0xbe2d('0x36')](_0x295b7a+_0xbe2d('0x37'),_0x4dee70)['where'](_0xbe2d('0x38'),NOW)[_0xbe2d('0x36')](_0xbe2d('0x39'),squel[_0xbe2d('0xf')]()[_0xbe2d('0x10')](_0xbe2d('0x11'))['from'](_0xbe2d('0x3f'))[_0xbe2d('0x36')](_0xbe2d('0x41'),_0x4dee70)[_0xbe2d('0x36')](_0x4b6f3d+_0xbe2d('0x15')+_0x295b7a+'.'+_0x4b6f3d)))['toString']();}function insertTzCmHopper(_0x1578e4,_0x447254,_0x4a16d5,_0x23161c,_0x3ae648,_0x3384c0){var _0x195d0b=[_0xbe2d('0x42'),_0xbe2d('0x43')+_0x3384c0+_0xbe2d('0x44'),_0xbe2d('0x3d'),_0xbe2d('0x28'),_0x447254+'.'+_0x23161c,'cm_contacts.createdAt',_0xbe2d('0x2a'),'cm_contacts.priority',_0xbe2d('0x2c'),'\x22'+_0x3ae648+'\x22'];var _0x38e591=squel[_0xbe2d('0x3e')]()[_0xbe2d('0x2d')](_0xbe2d('0x45'))[_0xbe2d('0x46')]([_0xbe2d('0x11'),_0xbe2d('0x47'),_0xbe2d('0x2e'),_0xbe2d('0x2f'),_0x23161c,_0xbe2d('0x40'),_0xbe2d('0x30'),_0xbe2d('0x31'),'UserId',_0xbe2d('0x32')],squel[_0xbe2d('0xf')]()[_0xbe2d('0x33')](_0x195d0b)['from'](_0x447254)['join'](_0xbe2d('0x34'),null,_0xbe2d('0x48')+_0x447254+'.CmListId')['join'](_0x4a16d5,null,_0x4a16d5+_0xbe2d('0x14')+_0x447254+'.'+_0x23161c)[_0xbe2d('0x13')](_0x3384c0,null,_0x3384c0+_0xbe2d('0x14')+_0x447254+'.'+_0x23161c)[_0xbe2d('0x36')](_0x447254+_0xbe2d('0x37'),_0x1578e4)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbe2d('0x36')](_0xbe2d('0x39'),selectNotIn(_0x447254,_0x4a16d5,_0x23161c,_0xbe2d('0x45'),['\x22always\x22',_0xbe2d('0x3b')]))[_0xbe2d('0x36')](_0xbe2d('0x39'),selectNotIn(_0x447254,_0x4a16d5,_0x23161c,_0xbe2d('0x45'),[_0xbe2d('0x3a')])))[_0xbe2d('0x3c')]();return _0x38e591;}function insertTzCmHopperBlack(_0x5d1cf4,_0x49320a,_0xc7f2d1,_0x5b9565){var _0x2f013a=[_0xbe2d('0x42'),'cm_contacts.id',_0xbe2d('0x28'),_0x49320a+'.'+_0x5b9565,_0xbe2d('0x29'),_0xbe2d('0x2a')];return squel[_0xbe2d('0x3e')]()[_0xbe2d('0x2d')](_0xbe2d('0x3f'))['fromQuery']([_0xbe2d('0x11'),_0xbe2d('0x2e'),_0xbe2d('0x2f'),_0x5b9565,_0xbe2d('0x40'),_0xbe2d('0x30')],squel[_0xbe2d('0xf')]()[_0xbe2d('0x33')](_0x2f013a)['from'](_0x49320a)[_0xbe2d('0x13')](_0xbe2d('0x34'),null,_0xbe2d('0x48')+_0x49320a+_0xbe2d('0x35'))[_0xbe2d('0x13')](_0xc7f2d1,null,_0xc7f2d1+_0xbe2d('0x14')+_0x49320a+'.'+_0x5b9565)[_0xbe2d('0x36')](_0x49320a+_0xbe2d('0x37'),_0x5d1cf4)[_0xbe2d('0x36')](_0xbe2d('0x38'),NOW)['where'](_0xbe2d('0x39'),squel['select']()['field'](_0xbe2d('0x11'))[_0xbe2d('0x12')](_0xbe2d('0x3f'))['where'](_0xbe2d('0x41'),_0x5d1cf4)[_0xbe2d('0x36')](_0x5b9565+_0xbe2d('0x15')+_0x49320a+'.'+_0x5b9565)))['toString']();}function insertCmHopperAdditionalPhones(_0x1ed413){var _0x14f64d=['cm_hopper.id',_0xbe2d('0x49'),_0xbe2d('0x4a'),'cm_contact_has_items.createdAt',_0xbe2d('0x4b')];return squel[_0xbe2d('0x3e')]()[_0xbe2d('0x2d')]('cm_hopper_additional_phones')[_0xbe2d('0x46')]([_0xbe2d('0x4c'),_0xbe2d('0x11'),_0xbe2d('0x4d'),_0xbe2d('0x40'),_0xbe2d('0x30')],squel['select']()[_0xbe2d('0x33')](_0x14f64d)['from'](_0xbe2d('0x45'))[_0xbe2d('0x13')](_0xbe2d('0x34'),null,_0xbe2d('0x4e'))[_0xbe2d('0x13')](_0xbe2d('0x4f'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xbe2d('0x36')]('cm_hopper.ListId\x20=\x20?',_0x1ed413)['where'](_0xbe2d('0x38'),NOW))[_0xbe2d('0x3c')]();}function insertCmContact(_0x14f547,_0x5bd92b,_0x58b095,_0x1a5c99){var _0x5ed24b=_[_0xbe2d('0x50')](_[_0xbe2d('0x51')](_0x1a5c99),[_0xbe2d('0x2f'),_0xbe2d('0x52'),_0xbe2d('0x40'),_0xbe2d('0x30'),'scheduledAt']);return squel[_0xbe2d('0x3e')]()[_0xbe2d('0x2d')](_0xbe2d('0x34'))[_0xbe2d('0x46')](_0x5ed24b,squel[_0xbe2d('0xf')]()[_0xbe2d('0x33')](_0x5ed24b)[_0xbe2d('0x12')](_0x5bd92b)[_0xbe2d('0x36')]('('+_0x58b095[_0xbe2d('0x13')](',')+_0xbe2d('0x53'),squel[_0xbe2d('0xf')]()[_0xbe2d('0x33')](_0x58b095)['from'](_0xbe2d('0x34'))['where'](_0xbe2d('0x41'),_0x14f547)[_0xbe2d('0x36')]('deletedAt\x20IS\x20NULL'))['where'](_0xbe2d('0x54'),squel[_0xbe2d('0xf')]()[_0xbe2d('0x10')]('MIN(id)',_0xbe2d('0x55'))['from'](_0x5bd92b)['group'](_0x58b095[_0xbe2d('0x13')](','))))[_0xbe2d('0x3c')]();}function handleStop(){logger[_0xbe2d('0x56')](_0xbe2d('0x57'));stopped=!![];}function handleUncaughtException(_0x1a9140){logger[_0xbe2d('0x58')](_0x1a9140[_0xbe2d('0x59')]);process['exit'](0x1);}function handleError(_0x54aa5e,_0x251eb0){stats[_0xbe2d('0x5a')][_0xbe2d('0x20')]({'name':_0x251eb0[_0xbe2d('0x5b')],'message':_0x251eb0['message'],'row':_0x54aa5e});}function handleQuery(_0x246a93){logger['info'](_0x246a93);return db[_0xbe2d('0x5c')]['query'](_0x246a93)[_0xbe2d('0x5d')](function(_0x5e9836){results[_0xbe2d('0x20')](_0x5e9836);})[_0xbe2d('0x5e')](function(_0x12b2cc){logger['error'](_0x12b2cc['message']);});}function updateTzCampaigns(_0x248e9a){return new Promise(function(_0x151548,_0x45b639){var _0x108623=squel['select']()[_0xbe2d('0x33')](['campaigns.id',_0xbe2d('0x5f')])[_0xbe2d('0x12')](_0xbe2d('0x60'))[_0xbe2d('0x13')](_0xbe2d('0x61'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xbe2d('0x36')](_0xbe2d('0x62')+_0x248e9a);db[_0xbe2d('0x5c')][_0xbe2d('0x63')](_0x108623[_0xbe2d('0x3c')]())[_0xbe2d('0x5d')](function(_0x2d65fe){var _0x4d2b40=[];for(var _0xbdf78a=0x0;_0xbdf78a<_0x2d65fe[_0xbe2d('0x1c')];_0xbdf78a++){_0x4d2b40[_0xbe2d('0x20')](getTimezoneData(_0x2d65fe[_0xbdf78a],tmp_campaigns));}BPromise[_0xbe2d('0x1b')](_0x4d2b40)[_0xbe2d('0x1a')](function(){_0x151548({'val':0x1});});})[_0xbe2d('0x5e')](function(_0x46224e){logger[_0xbe2d('0x58')](_0x46224e[_0xbe2d('0x59')]);_0x151548({'val':0x0});});});}function updateTzVoiceQueues(_0x5aaed5){return new Promise(function(_0x1a3fa4,_0x215e9d){var _0x131003=squel[_0xbe2d('0xf')]()[_0xbe2d('0x33')]([_0xbe2d('0x64'),_0xbe2d('0x65')])[_0xbe2d('0x12')](_0xbe2d('0x66'))[_0xbe2d('0x13')]('voice_queues_has_cm_lists',null,_0xbe2d('0x67'))[_0xbe2d('0x36')](_0xbe2d('0x68')+_0x5aaed5);db[_0xbe2d('0x5c')][_0xbe2d('0x63')](_0x131003[_0xbe2d('0x3c')]())[_0xbe2d('0x5d')](function(_0x33e4e6){var _0x4e2a00=[];for(var _0x3b862=0x0;_0x3b862<_0x33e4e6[_0xbe2d('0x1c')];_0x3b862++){_0x4e2a00['push'](getTimezoneData(_0x33e4e6[_0x3b862],tmp_voice_queues));}BPromise['all'](_0x4e2a00)[_0xbe2d('0x1a')](function(){_0x1a3fa4({'val':0x1});});})[_0xbe2d('0x5e')](function(_0x6a38d0){logger[_0xbe2d('0x58')](_0x6a38d0[_0xbe2d('0x59')]);_0x1a3fa4({'val':0x0});});});}function getTimezoneData(_0x4a68ef,_0x1422f1){return new Promise(function(_0x930020,_0x163b12){var _0x20c091=shared[_0xbe2d('0x69')];var _0x352413=_0x20c091[_0x4a68ef[_0xbe2d('0x6a')]];if(_[_0xbe2d('0x1e')](_0x352413)){_0x930020({'ret':0x1});}else{var _0x4bbcb2=_0x352413['utcOffset'];var _0x13c94c=squel[_0xbe2d('0x3e')]()['into'](_0x1422f1)[_0xbe2d('0x6b')]('id',_0x4a68ef['id'])[_0xbe2d('0x6b')]('offset',_0x4bbcb2)[_0xbe2d('0x6b')](_0xbe2d('0x6a'),_0x4a68ef[_0xbe2d('0x6a')])['toString']();return db[_0xbe2d('0x5c')][_0xbe2d('0x63')](_0x13c94c)['spread'](function(_0xf9607f){_0x930020({'ret':0x1});})[_0xbe2d('0x5e')](function(_0x46a959){logger['error'](_0x46a959[_0xbe2d('0x59')]);_0x163b12({'ret':0x1});});}});}function handleTZQuery(_0x5cda9d){logger[_0xbe2d('0x56')](_0x5cda9d);return db[_0xbe2d('0x5c')][_0xbe2d('0x63')](_0x5cda9d)[_0xbe2d('0x5d')](function(_0x467c81){})[_0xbe2d('0x5e')](function(_0x546927){logger[_0xbe2d('0x58')](_0x546927[_0xbe2d('0x59')]);});}function main(_0x2b3be9,_0x471f19,_0x2c2c87,_0x3a57a4){logger[_0xbe2d('0x56')](_0xbe2d('0x6c'),_0x2b3be9,JSON[_0xbe2d('0x6d')](_0x471f19));process[_0xbe2d('0x6e')](_0xbe2d('0x6f'));var _0x424cfd=_0x471f19[_0xbe2d('0x70')];var _0x556d27=_[_0xbe2d('0x71')](_0x424cfd);var _0x1e84ec=_0x471f19[_0xbe2d('0x72')];var _0x23593c=path['join'](config[_0xbe2d('0x73')],'server/files/tmp',_0x1e84ec+_0xbe2d('0x74'));hasTZ=_[_0xbe2d('0x51')](_0x424cfd)[_0xbe2d('0x75')]('dialTimezone');var _0x47bfc4=_['keys'](_0x424cfd)[_0xbe2d('0x13')]();logger['info'](_0xbe2d('0x76'),_0x47bfc4);db[_0xbe2d('0x77')][_0xbe2d('0x18')]({'raw':!![],'attributes':['id',_0xbe2d('0x78')]})['then'](function(_0x1702f9){for(var _0x41737d=0x0;_0x41737d<_0x1702f9['length'];_0x41737d++){if(_0x1702f9[_0x41737d]['name']in _0x424cfd){contactItemTypes[_0xbe2d('0x20')](_0x1702f9[_0x41737d]);delete _0x556d27[_0x1702f9[_0x41737d][_0xbe2d('0x78')]];hasAdditionalPhones=!![];}for(var _0x1992be in _0x424cfd){if(_0x1702f9[_0x41737d]['name']+_0xbe2d('0x79')===_0x1992be){phoneDescriptions[_0xbe2d('0x20')]({'itemTypeId':_0x1702f9[_0x41737d]['id'],'description':_0x1992be});delete _0x556d27[_0x1992be];}}}if(hasAdditionalPhones)_0x556d27[_0xbe2d('0x19')]='';var _0x2103b2=_[_0xbe2d('0x51')](_0x556d27)[_0xbe2d('0x13')]();logger[_0xbe2d('0x56')](_0xbe2d('0x76'),_0x2103b2);fs[_0xbe2d('0x7a')](_0x23593c,_0x2103b2+'\x0a');Papa['parse'](fs[_0xbe2d('0x7b')](_0x2b3be9),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4ae14d,_0x2ee2c7){try{for(var _0x4cccc4=0x0,_0x4c5773=[];_0x4cccc4<_0x4ae14d[_0xbe2d('0x7c')][_0xbe2d('0x1c')];_0x4cccc4++){stats['rows']+=0x1;if(_0x4ae14d['errors'][_0x4cccc4]){handleError(_0x4ae14d['data'][_0x4cccc4],_0x4ae14d[_0xbe2d('0x5a')][_0x4cccc4]);}else{var _0x40bad1=[];var _0x325de2=[];var _0x43d793={};for(var _0x5398ee in _0x424cfd){let _0x28011e=contactItemTypes[_0xbe2d('0x7d')](_0x4198a3=>_0x4198a3['name']===_0x5398ee);let _0x431b62=contactItemTypes[_0xbe2d('0x7d')](_0x615125=>_0x615125['name']+_0xbe2d('0x79')===_0x5398ee);if(_[_0xbe2d('0x1e')](_0x28011e)&&_[_0xbe2d('0x1e')](_0x431b62)){if(_0x424cfd[_0xbe2d('0x7e')](_0x5398ee)){if(_0x4ae14d['data'][_0x4cccc4][_0x424cfd[_0x5398ee]]){var _0x1457bc=_[_0xbe2d('0x7f')](_0x4ae14d['data'][_0x4cccc4][_0x424cfd[_0x5398ee]][_0xbe2d('0x80')](/"/g,'\x27'));switch(_0x5398ee){case'scheduledat':var _0x261b9b=moment(_0x1457bc,_0xbe2d('0xd'),!![]);if(_0x261b9b['isValid']()){_0x4c5773['push']('\x22'+_0x1457bc+'\x22');}else{_0x40bad1['push'](_0xbe2d('0x81'));}break;case _0xbe2d('0x31'):var _0x4fc32c=parseInt(_0x1457bc);_0x1457bc=_['isNaN'](_0x4fc32c)||_0x4fc32c<0x0||_0x4fc32c>0x4?_0x3a57a4?0x3:0x2:_0x4fc32c;_0x4c5773['push']('\x22'+_0x1457bc+'\x22');break;case _0xbe2d('0x82'):var _0x1f26eb=parseInt(_0x1457bc);if(_['isNumber'](_0x1f26eb)&&_[_0xbe2d('0x75')](_0x2c2c87,_0x1f26eb)){_0x4c5773[_0xbe2d('0x20')]('\x22'+_0x1f26eb+'\x22');}else{_0x40bad1[_0xbe2d('0x20')](_0xbe2d('0x83'));}break;case _0xbe2d('0x84'):if(isEmail(_0x1457bc)){_0x4c5773[_0xbe2d('0x20')]('\x22'+_0x1457bc+'\x22');}else{_0x40bad1[_0xbe2d('0x20')](_0xbe2d('0x85'));}break;case _0xbe2d('0x86'):var _0x5c9ab3=moment(_0x1457bc,_0xbe2d('0x87'),!![]);if(_0x5c9ab3[_0xbe2d('0x88')]()){_0x4c5773[_0xbe2d('0x20')]('\x22'+_0x1457bc+'\x22');}else{_0x40bad1[_0xbe2d('0x20')](_0xbe2d('0x89'));}break;case _0xbe2d('0x6a'):var _0x4bd060=shared[_0xbe2d('0x69')];var _0x42cc7f=_0x4bd060[_0x1457bc];if(!_[_0xbe2d('0x1e')](_0x42cc7f)){var _0x3683a8=_0x42cc7f[_0xbe2d('0x8a')];_0x4c5773[_0xbe2d('0x20')]('\x22'+_0x1457bc+'\x22');_0x4c5773['push']('\x22'+_0x3683a8+'\x22');}break;default:_0x4c5773['push']('\x22'+_0x1457bc+'\x22');}}else{switch(_0x5398ee){case _0xbe2d('0x8b'):case'phone':_0x40bad1['push'](_0x5398ee+_0xbe2d('0x8c'));break;default:_0x4c5773['push']('\x22\x22');}}}}else{var _0x33f1f9='';if(!_[_0xbe2d('0x1e')](_0x28011e)){if(!_0x43d793[_0xbe2d('0x7e')](_0x28011e['id'])){if(!_['isNil'](_0x4ae14d[_0xbe2d('0x7c')][_0x4cccc4][_0x424cfd[_0x5398ee]])){var _0x1457bc=_[_0xbe2d('0x7f')](_0x4ae14d[_0xbe2d('0x7c')][_0x4cccc4][_0x424cfd[_0x5398ee]]['replace'](/"/g,'\x27'));var _0x34ffbc=phoneDescriptions['find'](_0x397732=>_0x397732[_0xbe2d('0x8d')]===_0x28011e['id']);if(!_['isNil'](_0x34ffbc)){var _0x31add2=_[_0xbe2d('0x7f')](_0x4ae14d[_0xbe2d('0x7c')][_0x4cccc4][_0x424cfd[_0x34ffbc[_0xbe2d('0x8e')]]]['replace'](/"/g,'\x27'));if(!_[_0xbe2d('0x1e')](_0x31add2))_0x1457bc=_0x1457bc+'§'+_0x31add2;}if(_0x33f1f9=='')_0x33f1f9=_0x1457bc;else _0x33f1f9+='|'+_0x1457bc;}_0x325de2[_0xbe2d('0x20')](_0x28011e['id']+':'+_0x33f1f9);_0x43d793[_0x28011e['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4c5773['push']('\x22'+_0x325de2[_0xbe2d('0x13')](';')+'\x22');}if(_0x40bad1[_0xbe2d('0x1c')]){handleError(_0x4ae14d[_0xbe2d('0x7c')][_0x4cccc4],{'code':_0xbe2d('0x8f'),'message':_0x40bad1[_0xbe2d('0x13')]()});}else{fs[_0xbe2d('0x90')](_0x23593c,_0x4c5773[_0xbe2d('0x13')]()+'\x0a');}_0x4c5773=[];}if(!(stats[_0xbe2d('0x91')]%0xc8)){socket[_0xbe2d('0x92')](_0xbe2d('0x93')+_0x1e84ec,stats);stats[_0xbe2d('0x5a')]=[];}}if(stopped){logger[_0xbe2d('0x56')](_0xbe2d('0x94'));_0x2ee2c7[_0xbe2d('0x95')]();}}catch(_0x46413b){handleError(_0x4ae14d[_0xbe2d('0x7c')][_0x4cccc4],{'code':_0xbe2d('0x96'),'message':_0x46413b[_0xbe2d('0x59')]});logger[_0xbe2d('0x58')](_0xbe2d('0x97'),_0x46413b[_0xbe2d('0x59')]);}},'complete':function(){try{var _0xb51ee=[];var _0x5de528=[];var _0xf129c3=_0xbe2d('0x34');if(_0x471f19[_0xbe2d('0x98')]&&_0x471f19[_0xbe2d('0x98')]['length']){_0xf129c3=_0xbe2d('0x99')+_0x1e84ec;_0xb51ee[_0xbe2d('0x20')]('CREATE\x20TABLE\x20'+_0xf129c3+_0xbe2d('0x9a'));}tmp_campaigns=_0xbe2d('0x9b')+_0x1e84ec;tmp_voice_queues=_0xbe2d('0x9c')+_0x1e84ec;_0x5de528[_0xbe2d('0x20')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xbe2d('0x9d'));_0x5de528[_0xbe2d('0x20')](_0xbe2d('0x9e')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0xbe2d('0x9f')](_0x5de528,handleTZQuery)[_0xbe2d('0x1a')](function(_0x58d723){updateTzCampaigns(_0x471f19[_0xbe2d('0x2f')])['then'](function(_0x34ba16){updateTzVoiceQueues(_0x471f19[_0xbe2d('0x2f')])[_0xbe2d('0x1a')](function(_0x241f21){if(hasTZ)_0x2103b2=_0x2103b2[_0xbe2d('0x80')](_0xbe2d('0x6a'),_0xbe2d('0xa0'));var _0x56926c=util[_0xbe2d('0xc')](_0xbe2d('0xa1'),_0x23593c,_0xf129c3,_0x2103b2,_0x471f19[_0xbe2d('0x2f')],_0x471f19[_0xbe2d('0x52')]||null,NOW,NOW);if(_[_0xbe2d('0x1e')](_0x424cfd[_0xbe2d('0x47')])){_0x56926c+=_0xbe2d('0xa2');}_0xb51ee['push'](_0x56926c);if(_0x471f19['duplicates']&&_0x471f19[_0xbe2d('0x98')]['length']){_0xb51ee[_0xbe2d('0x20')](insertCmContact(_0x471f19[_0xbe2d('0x2f')],_0xf129c3,_0x471f19[_0xbe2d('0x98')],_0x424cfd));_0xb51ee[_0xbe2d('0x20')](_0xbe2d('0xa3')+_0xf129c3+';');}BPromise[_0xbe2d('0x9f')](_0xb51ee,handleQuery)[_0xbe2d('0x1a')](function(_0x498341){BPromise['all']([handleAdditionalPhones()])[_0xbe2d('0x1a')](function(){_0xb51ee=[];for(var _0x305b25=0x0;_0x305b25\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1956,0x15c));var _0x6195=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x1956[_0x310504];return _0x5b36d0;};'use strict';var fs=require('fs');var path=require(_0x6195('0x0'));var _=require(_0x6195('0x1'));var Papa=require(_0x6195('0x2'));var util=require(_0x6195('0x3'));var BPromise=require(_0x6195('0x4'));var moment=require(_0x6195('0x5'));var squel=require(_0x6195('0x6'));var Redis=require('ioredis');var db=require(_0x6195('0x7'))['db'];var config=require(_0x6195('0x8'));var logger=require(_0x6195('0x9'))(_0x6195('0xa'));config[_0x6195('0xb')]=_[_0x6195('0xc')](config[_0x6195('0xb')],{'host':_0x6195('0xd'),'port':0x18eb});var socket=require(_0x6195('0xe'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x6195('0xf')](_0x6195('0x10'));var tempTableName=_0x6195('0x11')+moment()[_0x6195('0xf')](_0x6195('0x12'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x4b5834){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))*$/[_0x6195('0x13')](_0x4b5834);}function selectNotIn(_0x1870d9,_0x5ce5c1,_0x4b0cbd,_0x4df791,_0x66e0b4){return squel[_0x6195('0x14')]()[_0x6195('0x15')](_0x6195('0x16'))[_0x6195('0x17')](_0x4df791)[_0x6195('0x18')](_0x5ce5c1,null,_0x5ce5c1+'.id\x20=\x20'+_0x4df791+'.'+_0x4b0cbd)[_0x6195('0x19')](_0x4df791+'.'+_0x4b0cbd+_0x6195('0x1a')+_0x1870d9+'.'+_0x4b0cbd)['where'](_0x5ce5c1+_0x6195('0x1b')+_0x66e0b4[_0x6195('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5320f7,_0x25a4c9){promisesAdditionalPhones=[];promisesContact=[];return db[_0x6195('0x1c')][_0x6195('0x1d')](_0x6195('0x1e')+tempTableName)[_0x6195('0x1f')](function(_0x1a555f){if(_0x1a555f!==null){var _0x3b481a=[];for(var _0x232399=0x0;_0x232399<_0x1a555f['length'];_0x232399++){var _0x5c0176=_0x1a555f[_0x232399];if(!_[_0x6195('0x20')](_0x5c0176[_0x6195('0x16')])){if(!_[_0x6195('0x20')](_0x5c0176[_0x6195('0x21')]))_0x3b481a[_0x6195('0x22')](insertAdditionalPhones(_0x5c0176));promisesContact['push']({'contact':_0x5c0176});}}}Promise[_0x6195('0x23')](_0x3b481a)['then'](function(){_0x5320f7({'val':0x1});});})[_0x6195('0x24')](function(_0x1f17f2){logger[_0x6195('0x25')](_0x1f17f2[_0x6195('0x26')]);});});}function insertAdditionalPhones(_0x44a502){return new Promise(function(_0x4e9673,_0x4cadf3){var _0x582deb=_0x44a502['AdditionalPhones'];if(_[_0x6195('0x20')](_0x582deb))_0x4cadf3({'val':0x0});else{var _0x395588=_0x582deb[_0x6195('0x27')](';');var _0x4f2d43=[];orderBy=0x0;for(var _0x5bed95=0x0;_0x5bed95<_0x395588[_0x6195('0x28')];_0x5bed95++){_0x4f2d43['push'](splitAdditionalPhone(_0x44a502['id'],_0x395588[_0x5bed95]));}Promise[_0x6195('0x23')](_0x4f2d43)[_0x6195('0x29')](function(){_0x4e9673({'val':_0x395588[_0x6195('0x28')]});});}});}function splitAdditionalPhone(_0x5dbe2c,_0x8f9c09){return new Promise(function(_0x19c505,_0xd03b87){var _0x571abb=_0x8f9c09['split'](':');var _0x5d3859=_0x571abb[0x0];var _0x449360=_0x571abb[0x1];if(_0x449360!==''){var _0x467935=_0x449360[_0x6195('0x27')]('|');var _0x2aa569=[];for(var _0x283829=0x0;_0x283829<_0x467935[_0x6195('0x28')];_0x283829++){if(_0x467935[_0x283829]!==''){var _0x251e21=_[_0x6195('0x2a')](promisesAdditionalPhones,{'contactId':_0x5dbe2c,'phone':_0x467935[_0x283829]});if(_0x251e21[_0x6195('0x28')]==0x0){orderBy++;promisesAdditionalPhones[_0x6195('0x22')]({'contactId':_0x5dbe2c,'contactTypeId':_0x5d3859,'phone':_0x467935[_0x283829],'orderBy':orderBy});}}}_0x19c505({'ok':0x1});}else _0x19c505({'res':0x0});});}function createAdditionalPhone(_0x566e1e,_0x20c3e2,_0x5af2af,_0x126409){var _0x47563b='';var _0x418144='';var _0x3688d6=_0x5af2af[_0x6195('0x27')]('§');_0x47563b=_0x3688d6[0x0];if(_0x3688d6[_0x6195('0x28')]==0x2)_0x418144=_0x3688d6[0x1];return new Promise(function(_0x1bca0a,_0x208c93){return db[_0x6195('0x2b')][_0x6195('0x2c')]({'where':{'CmContactId':_0x566e1e,'item':_0x47563b}})[_0x6195('0x29')](function(_0x52d3ff){if(_0x52d3ff){return db[_0x6195('0x2b')][_0x6195('0x2d')]({'ItemTypeId':_0x20c3e2,'description':_0x418144,'OrderBy':_0x126409},{'where':{'CmContactId':_0x566e1e,'item':_0x47563b}})[_0x6195('0x29')](function(_0x169c0c){_0x1bca0a({'res':'updated'});});}else{return db[_0x6195('0x2b')]['create']({'CmContactId':_0x566e1e,'item':_0x47563b,'ItemTypeId':_0x20c3e2,'description':_0x418144,'OrderBy':_0x126409,'ItemClass':_0x6195('0x2e')})[_0x6195('0x29')](function(_0x53f49b){_0x1bca0a({'res':_0x6195('0x2f')});});}});});}function updateContact(_0xbe61d3){return new Promise(function(_0x4c7f03,_0x12df71){var _0x7adb4e=_0xbe61d3['id'];delete _0xbe61d3['id'];return db[_0x6195('0x30')][_0x6195('0x2d')](_0xbe61d3,{'where':{'id':_0x7adb4e}})[_0x6195('0x29')](function(_0x370675){updatedRows+=0x1;return db[_0x6195('0x31')][_0x6195('0x2d')]({'phone':_0xbe61d3[_0x6195('0x16')]},{'where':{'ContactId':_0x7adb4e}})['then'](function(_0x8e6083){_0x4c7f03({'ret':'OK'});});});});}function insertCmHopper(_0x32f222,_0x275405,_0x4e7467,_0x35bc21,_0x3c0525){var _0x191aec=[_0x6195('0x32'),'cm_contacts.scheduledat',_0x6195('0x33'),_0x6195('0x34'),_0x275405+'.'+_0x35bc21,_0x6195('0x35'),_0x6195('0x36'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x3c0525+'\x22'];return squel[_0x6195('0x37')]()[_0x6195('0x38')]('cm_hopper')[_0x6195('0x39')]([_0x6195('0x16'),'scheduledat',_0x6195('0x3a'),_0x6195('0x3b'),_0x35bc21,_0x6195('0x3c'),_0x6195('0x3d'),_0x6195('0x3e'),_0x6195('0x3f'),_0x6195('0x40')],squel[_0x6195('0x14')]()['fields'](_0x191aec)[_0x6195('0x17')](_0x275405)[_0x6195('0x18')](_0x6195('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x275405+_0x6195('0x42'))[_0x6195('0x18')](_0x4e7467,null,_0x4e7467+_0x6195('0x43')+_0x275405+'.'+_0x35bc21)[_0x6195('0x19')](_0x275405+_0x6195('0x44'),_0x32f222)['where'](_0x6195('0x45'),NOW)[_0x6195('0x19')](_0x6195('0x46'),selectNotIn(_0x275405,_0x4e7467,_0x35bc21,_0x6195('0x47'),[_0x6195('0x48'),_0x6195('0x49')]))[_0x6195('0x19')](_0x6195('0x46'),selectNotIn(_0x275405,_0x4e7467,_0x35bc21,_0x6195('0x47'),[_0x6195('0x48')])))[_0x6195('0x4a')]();}function insertCmHopperBlack(_0x51b4f3,_0x2dc47b,_0x2f7895,_0x45a188){var _0x9743fd=[_0x6195('0x32'),'cm_contacts.id',_0x6195('0x34'),_0x2dc47b+'.'+_0x45a188,_0x6195('0x35'),_0x6195('0x36')];return squel[_0x6195('0x37')]()[_0x6195('0x38')](_0x6195('0x4b'))[_0x6195('0x39')]([_0x6195('0x16'),'ContactId',_0x6195('0x3b'),_0x45a188,_0x6195('0x3c'),_0x6195('0x3d')],squel[_0x6195('0x14')]()[_0x6195('0x4c')](_0x9743fd)[_0x6195('0x17')](_0x2dc47b)['join'](_0x6195('0x41'),null,_0x6195('0x4d')+_0x2dc47b+_0x6195('0x42'))[_0x6195('0x18')](_0x2f7895,null,_0x2f7895+_0x6195('0x43')+_0x2dc47b+'.'+_0x45a188)[_0x6195('0x19')](_0x2dc47b+_0x6195('0x44'),_0x51b4f3)['where'](_0x6195('0x45'),NOW)[_0x6195('0x19')](_0x6195('0x46'),squel[_0x6195('0x14')]()['field']('phone')[_0x6195('0x17')]('cm_hopper_black')[_0x6195('0x19')](_0x6195('0x4e'),_0x51b4f3)[_0x6195('0x19')](_0x45a188+_0x6195('0x4f'),_0x2dc47b+'.'+_0x45a188)))['toString']();}function insertCmHopperAdditionalPhones(_0x27c74b){var _0x1b1a29=[_0x6195('0x50'),_0x6195('0x51'),'cm_contact_has_items.OrderBy',_0x6195('0x52'),_0x6195('0x53')];return squel['insert']()['into'](_0x6195('0x54'))['fromQuery']([_0x6195('0x55'),_0x6195('0x16'),'OrderBy','createdAt','updatedAt'],squel[_0x6195('0x14')]()[_0x6195('0x4c')](_0x1b1a29)[_0x6195('0x17')]('cm_hopper')[_0x6195('0x18')](_0x6195('0x41'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x6195('0x18')](_0x6195('0x56'),null,_0x6195('0x57'))[_0x6195('0x19')](_0x6195('0x58'),_0x27c74b)[_0x6195('0x19')](_0x6195('0x45'),NOW))[_0x6195('0x4a')]();}function insertCmContact(_0x5842c0,_0x15cbd8,_0x3344c0,_0x5623cd){var _0x11272f=_[_0x6195('0x59')](_['keys'](_0x5623cd),[_0x6195('0x3b'),_0x6195('0x5a'),'createdAt',_0x6195('0x3d')]);return squel[_0x6195('0x37')]()['into'](_0x6195('0x41'))[_0x6195('0x39')](_0x11272f,squel[_0x6195('0x14')]()[_0x6195('0x4c')](_0x11272f)[_0x6195('0x17')](_0x15cbd8)[_0x6195('0x19')]('('+_0x3344c0[_0x6195('0x18')](',')+_0x6195('0x5b'),squel[_0x6195('0x14')]()[_0x6195('0x4c')](_0x3344c0)['from']('cm_contacts')[_0x6195('0x19')](_0x6195('0x4e'),_0x5842c0))[_0x6195('0x19')](_0x6195('0x5c'),squel[_0x6195('0x14')]()[_0x6195('0x15')]('MIN(id)',_0x6195('0x5d'))[_0x6195('0x17')](_0x15cbd8)[_0x6195('0x5e')](_0x3344c0[_0x6195('0x18')](','))))['toString']();}function handleStop(){logger[_0x6195('0x5f')](_0x6195('0x60'));stopped=!![];}function handleUncaughtException(_0x365de1){logger[_0x6195('0x25')](_0x365de1[_0x6195('0x26')]);process['exit'](0x1);}function handleError(_0x5cc7fa,_0x40b606){stats[_0x6195('0x61')][_0x6195('0x22')]({'name':_0x40b606[_0x6195('0x62')],'message':_0x40b606[_0x6195('0x26')],'row':_0x5cc7fa});}function handleQuery(_0x1c61b9){logger[_0x6195('0x5f')](_0x1c61b9);return db[_0x6195('0x1c')][_0x6195('0x1d')](_0x1c61b9)[_0x6195('0x1f')](function(_0x440696){results['push'](_0x440696);})[_0x6195('0x24')](function(_0x24dc44){logger[_0x6195('0x25')](_0x24dc44[_0x6195('0x26')]);});}function main(_0x1ef3e4,_0x45a6c1,_0x17aece,_0x3437f6){logger[_0x6195('0x5f')](_0x6195('0x63'),_0x1ef3e4,JSON[_0x6195('0x64')](_0x45a6c1));process[_0x6195('0x65')](_0x6195('0x66'));var _0x265db2=_0x45a6c1[_0x6195('0x67')];var _0x5677fd=_[_0x6195('0x68')](_0x265db2);var _0x130076=_0x45a6c1[_0x6195('0x69')];var _0xdbb393=path[_0x6195('0x18')](config[_0x6195('0x6a')],_0x6195('0x6b'),_0x130076+'.csv');logger[_0x6195('0x5f')](_0x6195('0x6c'),_0x45a6c1);db[_0x6195('0x6d')][_0x6195('0x6e')]({'raw':!![],'attributes':['id',_0x6195('0x6f')]})[_0x6195('0x29')](function(_0x18d97f){for(var _0x38f75e=0x0;_0x38f75e<_0x18d97f['length'];_0x38f75e++){if(_0x18d97f[_0x38f75e]['name']in _0x265db2){contactItemTypes[_0x6195('0x22')](_0x18d97f[_0x38f75e]);delete _0x5677fd[_0x18d97f[_0x38f75e][_0x6195('0x6f')]];hasAdditionalPhones=!![];}for(var _0x46ad8f in _0x265db2){if(_0x18d97f[_0x38f75e][_0x6195('0x6f')]+_0x6195('0x70')===_0x46ad8f){phoneDescriptions[_0x6195('0x22')]({'itemTypeId':_0x18d97f[_0x38f75e]['id'],'description':_0x46ad8f});delete _0x5677fd[_0x46ad8f];}}}if(hasAdditionalPhones)_0x5677fd['AdditionalPhones']='';var _0x11754d=_[_0x6195('0x71')](_0x5677fd)[_0x6195('0x18')]();logger['info']('header',_0x11754d);fs[_0x6195('0x72')](_0xdbb393,_0x11754d+'\x0a');Papa[_0x6195('0x73')](fs[_0x6195('0x74')](_0x1ef3e4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3ecfba,_0x1bc14a){try{for(var _0x2d7dfa=0x0,_0x2e2f06=[];_0x2d7dfa<_0x3ecfba[_0x6195('0x75')][_0x6195('0x28')];_0x2d7dfa++){stats[_0x6195('0x76')]+=0x1;if(_0x3ecfba['errors'][_0x2d7dfa]){handleError(_0x3ecfba[_0x6195('0x75')][_0x2d7dfa],_0x3ecfba[_0x6195('0x61')][_0x2d7dfa]);}else{var _0x31cb77=[];var _0x4cd3a7=[];var _0x1e7a78={};for(var _0x4c6e92 in _0x265db2){let _0x5ae1fa=contactItemTypes[_0x6195('0x77')](_0x33a36c=>_0x33a36c[_0x6195('0x6f')]===_0x4c6e92);let _0x2154d4=contactItemTypes[_0x6195('0x77')](_0xe55333=>_0xe55333[_0x6195('0x6f')]+'_description'===_0x4c6e92);if(_[_0x6195('0x20')](_0x5ae1fa)&&_[_0x6195('0x20')](_0x2154d4)){if(_0x265db2['hasOwnProperty'](_0x4c6e92)){if(_0x3ecfba[_0x6195('0x75')][_0x2d7dfa][_0x265db2[_0x4c6e92]]){var _0x1bccef=_[_0x6195('0x78')](_0x3ecfba[_0x6195('0x75')][_0x2d7dfa][_0x265db2[_0x4c6e92]]['replace'](/"/g,'\x27'));switch(_0x4c6e92){case _0x6195('0x79'):var _0x2e1b0a=moment(_0x1bccef,_0x6195('0x10'),!![]);if(_0x2e1b0a['isValid']()){_0x2e2f06[_0x6195('0x22')]('\x22'+_0x1bccef+'\x22');}else{_0x31cb77[_0x6195('0x22')](_0x6195('0x7a'));}break;case _0x6195('0x3e'):var _0xdac436=parseInt(_0x1bccef);_0x1bccef=_[_0x6195('0x7b')](_0xdac436)||_0xdac436<0x0||_0xdac436>0x4?_0x3437f6?0x3:0x2:_0xdac436;_0x2e2f06[_0x6195('0x22')]('\x22'+_0x1bccef+'\x22');break;case'UserId':var _0x2d68e2=parseInt(_0x1bccef);if(_[_0x6195('0x7c')](_0x2d68e2)&&_[_0x6195('0x7d')](_0x17aece,_0x2d68e2)){_0x2e2f06['push']('\x22'+_0x2d68e2+'\x22');}else{_0x31cb77[_0x6195('0x22')](_0x6195('0x7e'));}break;case'email':if(isEmail(_0x1bccef)){_0x2e2f06['push']('\x22'+_0x1bccef+'\x22');}else{_0x31cb77[_0x6195('0x22')](_0x6195('0x7f'));}break;case _0x6195('0x80'):var _0x559599=moment(_0x1bccef,_0x6195('0x81'),!![]);if(_0x559599[_0x6195('0x82')]()){_0x2e2f06['push']('\x22'+_0x1bccef+'\x22');}else{_0x31cb77['push'](_0x6195('0x83'));}break;default:_0x2e2f06['push']('\x22'+_0x1bccef+'\x22');}}else{switch(_0x4c6e92){case _0x6195('0x84'):case _0x6195('0x16'):_0x31cb77[_0x6195('0x22')](_0x4c6e92+_0x6195('0x85'));break;default:_0x2e2f06[_0x6195('0x22')]('\x22\x22');}}}}else{var _0x42774f='';if(!_[_0x6195('0x20')](_0x5ae1fa)){if(!_0x1e7a78[_0x6195('0x86')](_0x5ae1fa['id'])){for(var _0x1959ee=0x0;_0x1959ee<_0x265db2[_0x4c6e92][_0x6195('0x28')];_0x1959ee++){var _0x1bccef=_[_0x6195('0x78')](_0x3ecfba[_0x6195('0x75')][_0x2d7dfa][_0x265db2[_0x4c6e92][_0x1959ee]][_0x6195('0x87')](/"/g,'\x27'));var _0x3dd403=phoneDescriptions['find'](_0x4134ed=>_0x4134ed[_0x6195('0x88')]===_0x5ae1fa['id']);if(!_[_0x6195('0x20')](_0x3dd403)){var _0x195ba1=_[_0x6195('0x78')](_0x3ecfba[_0x6195('0x75')][_0x2d7dfa][_0x265db2[_0x3dd403[_0x6195('0x89')]][0x0]][_0x6195('0x87')](/"/g,'\x27'));if(!_['isNil'](_0x195ba1))_0x1bccef=_0x1bccef+'§'+_0x195ba1;}if(_0x42774f=='')_0x42774f=_0x1bccef;else _0x42774f+='|'+_0x1bccef;}_0x4cd3a7[_0x6195('0x22')](_0x5ae1fa['id']+':'+_0x42774f);_0x1e7a78[_0x5ae1fa['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2e2f06[_0x6195('0x22')]('\x22'+_0x4cd3a7['join'](';')+'\x22');}if(_0x31cb77[_0x6195('0x28')]){handleError(_0x3ecfba[_0x6195('0x75')][_0x2d7dfa],{'code':_0x6195('0x8a'),'message':_0x31cb77[_0x6195('0x18')]()});}else{fs[_0x6195('0x8b')](_0xdbb393,_0x2e2f06[_0x6195('0x18')]()+'\x0a');}_0x2e2f06=[];}if(!(stats['rows']%0xc8)){socket[_0x6195('0x8c')](_0x6195('0x8d')+_0x130076,stats);stats[_0x6195('0x61')]=[];}}if(stopped){logger[_0x6195('0x5f')](_0x6195('0x8e'));_0x1bc14a[_0x6195('0x8f')]();}}catch(_0x3be6f0){handleError(_0x3ecfba[_0x6195('0x75')][_0x2d7dfa],{'code':'SystemError','message':_0x3be6f0['message']});logger[_0x6195('0x25')](_0x6195('0x90'),_0x3be6f0['message']);}},'complete':function(){try{var _0x1d1a81=[];var _0x5f5329=tempTableName;_0x1d1a81[_0x6195('0x22')](_0x6195('0x91')+_0x5f5329+_0x6195('0x92'));logger[_0x6195('0x5f')](_0x6195('0x93'),contactItemTypes['length']);var _0x297380=util[_0x6195('0xf')](_0x6195('0x94'),_0xdbb393,_0x5f5329,_0x11754d,_0x45a6c1[_0x6195('0x3b')],_0x45a6c1['CompanyId']||null,NOW,NOW);if(_[_0x6195('0x20')](_0x265db2[_0x6195('0x79')])){_0x297380+=_0x6195('0x95');}_0x1d1a81[_0x6195('0x22')](_0x297380);BPromise[_0x6195('0x96')](_0x1d1a81,handleQuery)[_0x6195('0x29')](function(_0x285124){BPromise['all']([handleAdditionalPhones()])[_0x6195('0x29')](function(){_0x1d1a81=[];for(var _0x31bc12=0x0;_0x31bc12_0x2859a0[_0xb30c('0x68')]===_0x5adca1);let _0x425459=contactItemTypes[_0xb30c('0x70')](_0x4dac7e=>_0x4dac7e[_0xb30c('0x68')]+_0xb30c('0x69')===_0x5adca1);if(_[_0xb30c('0x22')](_0x422ff9)&&_['isNil'](_0x425459)){if(_0x31deb2[_0xb30c('0x71')](_0x5adca1)){if(_0x5bf73e['data'][_0x39c61c][_0x31deb2[_0x5adca1]]){var _0x559113=_[_0xb30c('0x72')](_0x5bf73e[_0xb30c('0x6e')][_0x39c61c][_0x31deb2[_0x5adca1]]['replace'](/"/g,'\x27'));switch(_0x5adca1){case _0xb30c('0x35'):var _0x25d4fd=moment(_0x559113,_0xb30c('0xf'),!![]);if(_0x25d4fd[_0xb30c('0x73')]()){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}else{_0x4728b3['push'](_0xb30c('0x74'));}break;case'priority':var _0x2eaefd=parseInt(_0x559113);_0x559113=_[_0xb30c('0x75')](_0x2eaefd)||_0x2eaefd<0x0||_0x2eaefd>0x4?_0x4dfe31?0x3:0x2:_0x2eaefd;_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');break;case _0xb30c('0x39'):var _0x44723a=parseInt(_0x559113);if(_[_0xb30c('0x76')](_0x44723a)&&_[_0xb30c('0x77')](_0x1493eb,_0x44723a)){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x44723a+'\x22');}else{_0x4728b3[_0xb30c('0x1c')]('agent\x20not\x20exists');}break;case _0xb30c('0x78'):if(isEmail(_0x559113)){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}else{_0x4728b3[_0xb30c('0x1c')](_0xb30c('0x79'));}break;case _0xb30c('0x7a'):var _0x4cab39=moment(_0x559113,_0xb30c('0x7b'),!![]);if(_0x4cab39[_0xb30c('0x73')]()){_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}else{_0x4728b3[_0xb30c('0x1c')](_0xb30c('0x7c'));}break;default:_0x1d7ad4[_0xb30c('0x1c')]('\x22'+_0x559113+'\x22');}}else{switch(_0x5adca1){case'firstName':case _0xb30c('0x12'):_0x4728b3[_0xb30c('0x1c')](_0x5adca1+'\x20not\x20specified');break;default:_0x1d7ad4[_0xb30c('0x1c')]('\x22\x22');}}}}else{var _0x1d7fbf='';if(!_[_0xb30c('0x22')](_0x422ff9)){if(!_0x1b89e0['hasOwnProperty'](_0x422ff9['id'])){for(var _0x3dc4e6=0x0;_0x3dc4e6<_0x31deb2[_0x5adca1][_0xb30c('0x1a')];_0x3dc4e6++){var _0x559113=_[_0xb30c('0x72')](_0x5bf73e['data'][_0x39c61c][_0x31deb2[_0x5adca1][_0x3dc4e6]][_0xb30c('0x7d')](/"/g,'\x27'));var _0x31e9ed=phoneDescriptions[_0xb30c('0x70')](_0x2a881e=>_0x2a881e[_0xb30c('0x7e')]===_0x422ff9['id']);if(!_['isNil'](_0x31e9ed)){var _0x7e4342=_[_0xb30c('0x72')](_0x5bf73e[_0xb30c('0x6e')][_0x39c61c][_0x31deb2[_0x31e9ed[_0xb30c('0x7f')]][0x0]][_0xb30c('0x7d')](/"/g,'\x27'));if(!_[_0xb30c('0x22')](_0x7e4342))_0x559113=_0x559113+'§'+_0x7e4342;}if(_0x1d7fbf=='')_0x1d7fbf=_0x559113;else _0x1d7fbf+='|'+_0x559113;}_0x1f16a8[_0xb30c('0x1c')](_0x422ff9['id']+':'+_0x1d7fbf);_0x1b89e0[_0x422ff9['id']]=0x1;}}}}if(hasAdditionalPhones){_0x1d7ad4['push']('\x22'+_0x1f16a8[_0xb30c('0x17')](';')+'\x22');}if(_0x4728b3[_0xb30c('0x1a')]){handleError(_0x5bf73e['data'][_0x39c61c],{'code':_0xb30c('0x80'),'message':_0x4728b3[_0xb30c('0x17')]()});}else{fs[_0xb30c('0x81')](_0x481537,_0x1d7ad4[_0xb30c('0x17')]()+'\x0a');}_0x1d7ad4=[];}if(!(stats['rows']%0xc8)){socket[_0xb30c('0x82')]('contact:import:'+_0x5875c6,stats);stats[_0xb30c('0x5c')]=[];}}if(stopped){logger[_0xb30c('0x59')](_0xb30c('0x83'));_0x2f3747[_0xb30c('0x84')]();}}catch(_0x1b5472){handleError(_0x5bf73e[_0xb30c('0x6e')][_0x39c61c],{'code':'SystemError','message':_0x1b5472[_0xb30c('0x21')]});logger[_0xb30c('0x20')]('step',_0x1b5472[_0xb30c('0x21')]);}},'complete':function(){try{var _0x3b80f1=[];var _0x99e471=tempTableName;_0x3b80f1[_0xb30c('0x1c')](_0xb30c('0x85')+_0x99e471+_0xb30c('0x86'));logger['info'](_0xb30c('0x87'),contactItemTypes[_0xb30c('0x1a')]);var _0x4e03fc=util[_0xb30c('0xe')]('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',_0x481537,_0x99e471,_0x504300,_0x125143[_0xb30c('0x46')],_0x125143[_0xb30c('0x54')]||null,NOW,NOW);if(_[_0xb30c('0x22')](_0x31deb2[_0xb30c('0x35')])){_0x4e03fc+=_0xb30c('0x88');}_0x3b80f1[_0xb30c('0x1c')](_0x4e03fc);BPromise[_0xb30c('0x89')](_0x3b80f1,handleQuery)[_0xb30c('0x1e')](function(_0x343714){BPromise[_0xb30c('0x1d')]([handleAdditionalPhones()])[_0xb30c('0x1e')](function(){_0x3b80f1=[];for(var _0x3bb275=0x0;_0x3bb275\x20\x20');}var _0x529573=path[_0xb30c('0x17')](config[_0xb30c('0x64')],_0xb30c('0x65'),process[_0xb30c('0x91')][0x2]);if(!fs[_0xb30c('0x92')](_0x529573)){throw new Error(_0xb30c('0x93'));}var _0x1b0c15={};try{_0x1b0c15=JSON[_0xb30c('0x6c')](process[_0xb30c('0x91')][0x3]);if(!_0x1b0c15[_0xb30c('0x63')]){throw new Error(_0xb30c('0x94'));}var _0xa2521d=0x0;if(_0x1b0c15[_0xb30c('0x63')][_0xb30c('0x39')]){_0xa2521d=0x1;}if(!_0x1b0c15['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1f258c){throw new Error(_0xb30c('0x95'));}var _0x3bbe88=[];try{_0x3bbe88=_[_0xb30c('0x96')](JSON[_0xb30c('0x6c')](process[_0xb30c('0x91')][0x4]),'id');}catch(_0x31efd9){logger['info']('No\x20agent\x20available');}main(_0x529573,_0x1b0c15,_0x3bbe88,_0xa2521d);}validate();process['on'](_0xb30c('0x97'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index f360f70..6f292ca 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce20=['Duration','duration','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','Agent\x20Number','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentconnectAt','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xce20,0x129));var _0x0ce2=function(_0x40ddb6,_0x4ef32e){_0x40ddb6=_0x40ddb6-0x0;var _0x23fba8=_0xce20[_0x40ddb6];return _0x23fba8;};'use strict';exports[_0x0ce2('0x0')]=function(_0x3126c9,_0x48d4f2){var _0x1d3d21=[{'type':_0x0ce2('0x1'),'content':_0x0ce2('0x2'),'variableName':null}];switch(_0x3126c9['toLowerCase']()){case _0x0ce2('0x3'):switch(_0x48d4f2[_0x0ce2('0x4')]()){case _0x0ce2('0x5'):_0x1d3d21[_0x0ce2('0x6')]({'type':_0x0ce2('0x7'),'content':'','variableName':_0x0ce2('0x8')});_0x1d3d21[_0x0ce2('0x6')]({'type':_0x0ce2('0x7'),'content':'','variableName':_0x0ce2('0x9')});break;case _0x0ce2('0xa'):_0x1d3d21[_0x0ce2('0x6')]({'type':_0x0ce2('0x1'),'content':_0x0ce2('0xb'),'variableName':null});_0x1d3d21['push']({'type':_0x0ce2('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x1d3d21;};exports['getDescriptions']=function(_0x3fae6d,_0x10ccda){var _0x2f0929=[];switch(_0x3fae6d['toLowerCase']()){case _0x0ce2('0x3'):switch(_0x10ccda[_0x0ce2('0x4')]()){case _0x0ce2('0x5'):_0x2f0929=[{'type':_0x0ce2('0x1'),'content':_0x0ce2('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x0ce2('0xd'),'content':'','key':'Caller\x20Number','keyType':'variable','variableName':_0x0ce2('0x9')},{'type':'keyValue','content':'','key':'Caller\x20Name','keyType':_0x0ce2('0x7'),'variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x0ce2('0xe'),'keyType':_0x0ce2('0x7'),'variableName':_0x0ce2('0xf')},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x10'),'keyType':_0x0ce2('0x7'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x0ce2('0x11'),'keyType':_0x0ce2('0x7'),'variableName':_0x0ce2('0x12')},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x13'),'keyType':_0x0ce2('0x7'),'variableName':_0x0ce2('0x14')},{'type':_0x0ce2('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x15'),'keyType':'variable','variableName':'destcalleridname'},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x16'),'keyType':_0x0ce2('0x7'),'variableName':_0x0ce2('0x17')},{'type':_0x0ce2('0x1'),'content':_0x0ce2('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x19'),'keyType':'variable','variableName':_0x0ce2('0x14')},{'type':_0x0ce2('0xd'),'content':'','key':'Agent\x20Connect','keyType':'variable','variableName':_0x0ce2('0x1a')},{'type':_0x0ce2('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x0ce2('0x7'),'variableName':_0x0ce2('0x1b')},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x1c'),'keyType':_0x0ce2('0x7'),'variableName':_0x0ce2('0x1d')},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x1e'),'keyType':'variable','variableName':_0x0ce2('0x1f')}];break;case _0x0ce2('0xa'):_0x2f0929=[{'type':_0x0ce2('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0x0ce2('0x20'),'keyType':_0x0ce2('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x21'),'keyType':'variable','keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':'UniqueId','keyType':_0x0ce2('0x7'),'keyContent':'','variableName':_0x0ce2('0x12')},{'type':'keyValue','content':'','key':'Date','keyType':'variable','keyContent':'','variableName':_0x0ce2('0x22')},{'type':_0x0ce2('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x23'),'keyType':_0x0ce2('0x7'),'keyContent':'','variableName':_0x0ce2('0x24')},{'type':_0x0ce2('0xd'),'content':'','key':_0x0ce2('0x25'),'keyType':_0x0ce2('0x7'),'keyContent':'','variableName':_0x0ce2('0x26')},{'type':'keyValue','content':'','key':_0x0ce2('0x27'),'keyType':'variable','keyContent':'','variableName':_0x0ce2('0x28')},{'type':_0x0ce2('0xd'),'content':'','key':'Billable\x20Time','keyType':_0x0ce2('0x7'),'keyContent':'','variableName':_0x0ce2('0x29')}];break;}}return _0x2f0929;}; \ No newline at end of file +var _0x8c7a=['duration','Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','variable','queue','push','calleridnum','outbound','Outbound\x20Call','getDescriptions','voice','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','Agent\x20Number','destcalleridnum','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','Called\x20Number','membername','starttime','***\x20Time\x20Info\x20***','Complete\x20Time','endtime','Duration'];(function(_0x469a57,_0x535f81){var _0x19bade=function(_0x4533ad){while(--_0x4533ad){_0x469a57['push'](_0x469a57['shift']());}};_0x19bade(++_0x535f81);}(_0x8c7a,0x137));var _0xa8c7=function(_0x3e6d05,_0x1c993c){_0x3e6d05=_0x3e6d05-0x0;var _0x35b314=_0x8c7a[_0x3e6d05];return _0x35b314;};'use strict';exports[_0xa8c7('0x0')]=function(_0x18c06c,_0x43724e){var _0x33b4dd=[{'type':_0xa8c7('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x18c06c[_0xa8c7('0x2')]()){case'voice':switch(_0x43724e[_0xa8c7('0x2')]()){case'inbound':_0x33b4dd['push']({'type':_0xa8c7('0x3'),'content':'','variableName':_0xa8c7('0x4')});_0x33b4dd[_0xa8c7('0x5')]({'type':_0xa8c7('0x3'),'content':'','variableName':_0xa8c7('0x6')});break;case _0xa8c7('0x7'):_0x33b4dd['push']({'type':'string','content':_0xa8c7('0x8'),'variableName':null});_0x33b4dd['push']({'type':_0xa8c7('0x3'),'content':'','variableName':'destcalleridnum'});break;}}return _0x33b4dd;};exports[_0xa8c7('0x9')]=function(_0x56c9e1,_0x4bd56a){var _0xa97b3f=[];switch(_0x56c9e1[_0xa8c7('0x2')]()){case _0xa8c7('0xa'):switch(_0x4bd56a[_0xa8c7('0x2')]()){case _0xa8c7('0xb'):_0xa97b3f=[{'type':'string','content':_0xa8c7('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0xe'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x6')},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0xf'),'keyType':'variable','variableName':_0xa8c7('0x10')},{'type':'keyValue','content':'','key':_0xa8c7('0x11'),'keyType':_0xa8c7('0x3'),'variableName':'destexten'},{'type':'keyValue','content':'','key':_0xa8c7('0x12'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x4')},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0x13'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x14')},{'type':'keyValue','content':'','key':_0xa8c7('0x15'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x16')},{'type':_0xa8c7('0x1'),'content':_0xa8c7('0x17'),'key':null,'keyType':null,'variableName':null},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0x18'),'keyType':_0xa8c7('0x3'),'variableName':'destcalleridname'},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0x19'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x1a')},{'type':_0xa8c7('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xa8c7('0xd'),'content':'','key':'Agent\x20Ring','keyType':'variable','variableName':_0xa8c7('0x16')},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0x1b'),'keyType':'variable','variableName':_0xa8c7('0x1c')},{'type':'keyValue','content':'','key':_0xa8c7('0x1d'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x1e')},{'type':'keyValue','content':'','key':_0xa8c7('0x1f'),'keyType':_0xa8c7('0x3'),'variableName':_0xa8c7('0x20')},{'type':'keyValue','content':'','key':_0xa8c7('0x21'),'keyType':_0xa8c7('0x3'),'variableName':'talktime'}];break;case'outbound':_0xa97b3f=[{'type':'string','content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':_0xa8c7('0x22'),'keyType':'variable','keyContent':'','variableName':_0xa8c7('0x1a')},{'type':_0xa8c7('0xd'),'content':'','key':'Member\x20Name','keyType':_0xa8c7('0x3'),'keyContent':'','variableName':_0xa8c7('0x23')},{'type':'keyValue','content':'','key':'UniqueId','keyType':'variable','keyContent':'','variableName':_0xa8c7('0x14')},{'type':_0xa8c7('0xd'),'content':'','key':'Date','keyType':_0xa8c7('0x3'),'keyContent':'','variableName':_0xa8c7('0x24')},{'type':_0xa8c7('0x1'),'content':_0xa8c7('0x25')},{'type':'keyValue','content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0x26'),'keyType':_0xa8c7('0x3'),'keyContent':'','variableName':_0xa8c7('0x27')},{'type':'keyValue','content':'','key':_0xa8c7('0x28'),'keyType':_0xa8c7('0x3'),'keyContent':'','variableName':_0xa8c7('0x29')},{'type':_0xa8c7('0xd'),'content':'','key':_0xa8c7('0x2a'),'keyType':'variable','keyContent':'','variableName':_0xa8c7('0x2b')}];break;}}return _0xa97b3f;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index bc59e64..b8fb7eb 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa019=['parseAdvancedSearchFilter','parseQueryParameters','where','contact','default','fields','user','having','tags','checkAccountsRestrictions','group','i.id','tag','countFilteredInteractions','length','count','order','forEach','contactName','DESC','closed','getClosedOrderClause','getFilteredInteractions','catch','query','clone','body','phone','mobile','updateUser','./sql-utils','findAll','skipInteractionsQuery','getInteractionsQuery','resolve','then','search'];(function(_0x337d3a,_0x4c936c){var _0x5da6b4=function(_0x1ebdea){while(--_0x1ebdea){_0x337d3a['push'](_0x337d3a['shift']());}};_0x5da6b4(++_0x4c936c);}(_0xa019,0x121));var _0x9a01=function(_0x28060b,_0x4fab74){_0x28060b=_0x28060b-0x0;var _0x6d9d3e=_0xa019[_0x28060b];return _0x6d9d3e;};'use strict';var _=require('lodash');var sqlUtils=require(_0x9a01('0x0'));var utils=require('./utils');exports[_0x9a01('0x1')]=function(_0x50b140,_0x532b2c,_0x5961cb,_0x1b387f,_0x5735d9){var _0x281023={'count':0x0,'rows':[]};var _0x32f5ec=sqlUtils[_0x9a01('0x2')](_0x50b140,_0x5961cb,_0x532b2c);if(_0x32f5ec){return Promise['resolve'](_0x281023);}var _0x5704a4=sqlUtils[_0x9a01('0x3')](_0x50b140);var _0x47e4a4={};return Promise[_0x9a01('0x4')]()[_0x9a01('0x5')](function(){if(_0x532b2c[_0x9a01('0x6')]){return sqlUtils[_0x9a01('0x7')](_0x532b2c[_0x9a01('0x6')],_0x5735d9);}else{return sqlUtils[_0x9a01('0x8')](_0x50b140,_0x532b2c,_0x5735d9);}})[_0x9a01('0x5')](function(_0x2432aa){_0x5704a4[_0x9a01('0x9')](_0x2432aa['body']);_0x5704a4[_0x9a01('0x9')](_0x2432aa[_0x9a01('0xa')]);_0x5704a4[_0x9a01('0x9')](_0x2432aa[_0x9a01('0xb')]);_0x5704a4['where'](_0x2432aa[_0x9a01('0xc')]);_0x5704a4['where'](_0x2432aa['filter']);_0x5704a4['where'](_0x2432aa[_0x9a01('0xd')]);_0x5704a4[_0x9a01('0xe')](_0x2432aa['read']);_0x47e4a4=_0x2432aa[_0x9a01('0xf')];return sqlUtils[_0x9a01('0x10')](_0x50b140,_0x5961cb,_0x532b2c);})[_0x9a01('0x5')](function(_0x4380ae){_0x5704a4[_0x9a01('0x9')](_0x4380ae);_0x5704a4[_0x9a01('0x11')](_0x9a01('0x12'));var _0x275116=_0x532b2c[_0x9a01('0x6')]?_0x47e4a4['ids']:_0x532b2c[_0x9a01('0x13')];return sqlUtils[_0x9a01('0x14')](_0x5704a4,_0x275116);})[_0x9a01('0x5')](function(_0x5d2d3a){_0x281023['count']=_0x5d2d3a[_0x9a01('0x15')];if(_0x281023[_0x9a01('0x16')]===0x0){return[];}_0x5704a4[_0x9a01('0xe')](_0x47e4a4['clause']);if(_0x1b387f[_0x9a01('0x17')]){_0x1b387f['order'][_0x9a01('0x18')](function(_0xba96c7){var _0x33f16a=_0xba96c7[0x0]===_0x9a01('0x19')?_0xba96c7[0x0]:'i.'+_0xba96c7[0x0];_0x5704a4['order'](_0x33f16a,_0xba96c7[0x1]===_0x9a01('0x1a')?![]:!![]);if(_0xba96c7[0x0]===_0x9a01('0x1b')){var _0x547f4e=sqlUtils[_0x9a01('0x1c')](_0x50b140,_0x532b2c);_0x5704a4[_0x9a01('0x17')](_0x547f4e,_0xba96c7[0x1]===_0x9a01('0x1a')?![]:!![]);}});}return sqlUtils[_0x9a01('0x1d')](_0x50b140,_0x5704a4,_0x532b2c,_0x1b387f);})[_0x9a01('0x5')](function(_0x161990){_0x281023['rows']=_0x161990;return _0x281023;})[_0x9a01('0x1e')](function(_0x4d295d){throw _0x4d295d;});};exports['tracked']=function(_0x3b9e1e,_0x50d3ae){return function(_0x105dcf,_0x1558d1,_0x190537){var _0x2ccc69=_0x105dcf['user'];var _0x4323eb={};var _0x5c57d9=_0x105dcf[_0x9a01('0x1f')];if(_0x4323eb){_0x4323eb=_[_0x9a01('0x20')](_0x105dcf[_0x9a01('0x21')]);_0x4323eb=_['omit'](_0x4323eb,[_0x9a01('0x21'),'html',_0x9a01('0x22'),'fax',_0x9a01('0x23')]);}utils[_0x9a01('0x24')](_0x2ccc69,_0x4323eb,_0x5c57d9,_0x3b9e1e,_0x50d3ae);_0x190537(null);};}; \ No newline at end of file +var _0x2460=['html','phone','fax','mobile','updateUser','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','parseQueryParameters','body','where','contact','default','fields','filter','user','read','tags','group','i.id','tag','countFilteredInteractions','length','having','clause','order','forEach','DESC','closed','getClosedOrderClause','getFilteredInteractions','catch','tracked','omit'];(function(_0x268fb6,_0x420be1){var _0x55feeb=function(_0x380690){while(--_0x380690){_0x268fb6['push'](_0x268fb6['shift']());}};_0x55feeb(++_0x420be1);}(_0x2460,0x16d));var _0x0246=function(_0xaa6406,_0x3c76fc){_0xaa6406=_0xaa6406-0x0;var _0x2a3b03=_0x2460[_0xaa6406];return _0x2a3b03;};'use strict';var _=require('lodash');var sqlUtils=require(_0x0246('0x0'));var utils=require(_0x0246('0x1'));exports[_0x0246('0x2')]=function(_0x9619da,_0x5c1541,_0x270baf,_0x3a8fb9,_0x3e1fb5){var _0x23fdaf={'count':0x0,'rows':[]};var _0x4a36ef=sqlUtils[_0x0246('0x3')](_0x9619da,_0x270baf,_0x5c1541);if(_0x4a36ef){return Promise[_0x0246('0x4')](_0x23fdaf);}var _0x2b459f=sqlUtils[_0x0246('0x5')](_0x9619da);var _0x158c7f={};return Promise[_0x0246('0x4')]()[_0x0246('0x6')](function(){if(_0x5c1541[_0x0246('0x7')]){return sqlUtils[_0x0246('0x8')](_0x5c1541[_0x0246('0x7')],_0x3e1fb5);}else{return sqlUtils[_0x0246('0x9')](_0x9619da,_0x5c1541,_0x3e1fb5);}})[_0x0246('0x6')](function(_0x212de0){_0x2b459f['where'](_0x212de0[_0x0246('0xa')]);_0x2b459f[_0x0246('0xb')](_0x212de0[_0x0246('0xc')]);_0x2b459f[_0x0246('0xb')](_0x212de0[_0x0246('0xd')]);_0x2b459f[_0x0246('0xb')](_0x212de0[_0x0246('0xe')]);_0x2b459f['where'](_0x212de0[_0x0246('0xf')]);_0x2b459f[_0x0246('0xb')](_0x212de0[_0x0246('0x10')]);_0x2b459f['having'](_0x212de0[_0x0246('0x11')]);_0x158c7f=_0x212de0[_0x0246('0x12')];return sqlUtils['checkAccountsRestrictions'](_0x9619da,_0x270baf,_0x5c1541);})[_0x0246('0x6')](function(_0x10c144){_0x2b459f[_0x0246('0xb')](_0x10c144);_0x2b459f[_0x0246('0x13')](_0x0246('0x14'));var _0x5e5315=_0x5c1541[_0x0246('0x7')]?_0x158c7f['ids']:_0x5c1541[_0x0246('0x15')];return sqlUtils[_0x0246('0x16')](_0x2b459f,_0x5e5315);})[_0x0246('0x6')](function(_0x4739d0){_0x23fdaf['count']=_0x4739d0[_0x0246('0x17')];if(_0x23fdaf['count']===0x0){return[];}_0x2b459f[_0x0246('0x18')](_0x158c7f[_0x0246('0x19')]);if(_0x3a8fb9[_0x0246('0x1a')]){_0x3a8fb9[_0x0246('0x1a')][_0x0246('0x1b')](function(_0x53d221){var _0x490d0a=_0x53d221[0x0]==='contactName'?_0x53d221[0x0]:'i.'+_0x53d221[0x0];_0x2b459f[_0x0246('0x1a')](_0x490d0a,_0x53d221[0x1]===_0x0246('0x1c')?![]:!![]);if(_0x53d221[0x0]===_0x0246('0x1d')){var _0x35e7cb=sqlUtils[_0x0246('0x1e')](_0x9619da,_0x5c1541);_0x2b459f[_0x0246('0x1a')](_0x35e7cb,_0x53d221[0x1]==='DESC'?![]:!![]);}});}return sqlUtils[_0x0246('0x1f')](_0x9619da,_0x2b459f,_0x5c1541,_0x3a8fb9);})[_0x0246('0x6')](function(_0x1df01c){_0x23fdaf['rows']=_0x1df01c;return _0x23fdaf;})[_0x0246('0x20')](function(_0x377971){throw _0x377971;});};exports[_0x0246('0x21')]=function(_0x5e6d1c,_0x3fb7f){return function(_0x25da16,_0x8ba290,_0x486ef1){var _0x87f027=_0x25da16[_0x0246('0x10')];var _0x376817={};var _0x12281c=_0x25da16['query'];if(_0x376817){_0x376817=_['clone'](_0x25da16[_0x0246('0xa')]);_0x376817=_[_0x0246('0x22')](_0x376817,[_0x0246('0xa'),_0x0246('0x23'),_0x0246('0x24'),_0x0246('0x25'),_0x0246('0x26')]);}utils[_0x0246('0x27')](_0x87f027,_0x376817,_0x12281c,_0x5e6d1c,_0x3fb7f);_0x486ef1(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 130feb8..836a981 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8932=['UserId','body','plainBody','text','getAccountFK','keys','some','compact','concat','createdAt','parse','$lte','null','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NULL','i.thirdDisposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','query','keyBy','attributes','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.secondDisposition','i.to','i.ContactId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','limit','offset','sequelize','toString','groupBy','findOne','enableEmailPreview','all','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','SELECT','exports','lodash','../parsers/advancedSearch','./update-interaction','./utils','../../mysqldb','role','agent','search','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','select','interactions','cm_contacts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','expr','getSelectedTags','forEach','replace','{OPERATOR}','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','length','buildExpression','type','default','value','start','end','unreadMessages','read','and','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','Tag','tags','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x5db96a,_0x60039){var _0x13fdb0=function(_0x1efab0){while(--_0x1efab0){_0x5db96a['push'](_0x5db96a['shift']());}};_0x13fdb0(++_0x60039);}(_0x8932,0x1a4));var _0x2893=function(_0x4b1a32,_0x2c3e0b){_0x4b1a32=_0x4b1a32-0x0;var _0x1ee2d9=_0x8932[_0x4b1a32];return _0x1ee2d9;};'use strict';var _=require(_0x2893('0x0'));var squel=require('squel');var as=require(_0x2893('0x1'));var qs=require('../parsers/qs');var updateInteraction=require(_0x2893('0x2'))['updateInteraction'];var utils=require(_0x2893('0x3'));var db=require(_0x2893('0x4'))['db'];function skipInteractionsQuery(_0xd56c48,_0x247309,_0xddcc8a){var _0x3a7b9b=![];var _0x3839bd=utils['getAccountFK'](_0xd56c48);if(_0x247309[_0x2893('0x5')]===_0x2893('0x6')&&!_0xddcc8a[_0x2893('0x7')]&&!_0xddcc8a[_0x3839bd]){_0x3a7b9b=!![];}return _0x3a7b9b;}function getTagsQuery(){return squel['select']()[_0x2893('0x8')]('id')['field'](_0x2893('0x9'))[_0x2893('0x8')](_0x2893('0xa'))[_0x2893('0xb')](_0x2893('0xc'));}function getUsersQuery(_0x6f94b9,_0x343f22){var _0x32a4db=utils[_0x2893('0xd')](_0x6f94b9);var _0x5d3ace=_0x2893('0xe')+_0x6f94b9+_0x2893('0xf');var _0x1e67ae=squel['select']()[_0x2893('0x8')](_0x2893('0x10'))['field'](_0x2893('0x11'))['field'](_0x2893('0x12')+_0x32a4db)[_0x2893('0xb')](_0x5d3ace,'ui')[_0x2893('0x13')](_0x2893('0x14'),'u',_0x2893('0x15'));if(_0x343f22['length']>0x0){_0x1e67ae[_0x2893('0x16')](_0x2893('0x12')+_0x32a4db+_0x2893('0x17'),_[_0x2893('0x18')](_0x343f22,'id'));}return _0x1e67ae;}function getInteractionsQuery(_0xc97603){var _0x220b86=utils[_0x2893('0x19')](_0xc97603);var _0x439f29=utils['getAccountFK'](_0xc97603);var _0x463545=utils['getInteractionFK'](_0xc97603);return squel[_0x2893('0x1a')]()[_0x2893('0xb')](_0x220b86[_0x2893('0x1b')],'i')[_0x2893('0x13')](_0x2893('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x2893('0x13')]('users','o','o.id\x20=\x20i.UserId')[_0x2893('0x13')](_0x220b86['accounts'],'a',_0x2893('0x1d')+_0x439f29)['left_join'](_0x220b86[_0x2893('0x1e')],'me',_0x2893('0x1f')+_0x463545+_0x2893('0x20'))[_0x2893('0x13')](_0x220b86[_0x2893('0x21')],'it','it.'+_0x463545+_0x2893('0x20'))[_0x2893('0x13')](_0x2893('0xc'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x217065={'body':squel[_0x2893('0x22')](),'contact':squel[_0x2893('0x22')](),'default':squel[_0x2893('0x22')](),'fields':squel[_0x2893('0x22')](),'filter':squel[_0x2893('0x22')](),'read':squel[_0x2893('0x22')](),'tags':{'clause':squel[_0x2893('0x22')](),'ids':null},'user':squel[_0x2893('0x22')]()};return _0x217065;}function parseTagParameter(_0x268ec1){var _0x2f7e8f=squel['expr']();if(_0x268ec1){var _0x4d1224=utils[_0x2893('0x23')](_0x268ec1);_0x4d1224[_0x2893('0x24')](function(_0x287df2){_0x2f7e8f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x287df2+',%');});}return _0x2f7e8f;}function parseReadParameter(_0x2a837c){var _0x561604='';if(_0x2a837c){_0x561604='unreadMessages\x20{OPERATOR}\x200';if(_0x2a837c==='1'){_0x561604=_0x561604[_0x2893('0x25')](_0x2893('0x26'),'=');}else{_0x561604=_0x561604[_0x2893('0x25')]('{OPERATOR}','>');}}return _0x561604;}function parseSearchFilter(_0x5c191c,_0x50963e){var _0x62d5bd=squel['expr']();if(_0x50963e){var _0x1bd79f=_0x50963e['replace']('\x5c','\x5c\x5c')[_0x2893('0x25')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1bd79f)){_0x62d5bd['or'](_0x2893('0x27'),_0x1bd79f+'%');if([_0x2893('0x28'),_0x2893('0x29')]['includes'](_0x5c191c)){_0x62d5bd['or'](_0x2893('0x2a'),_0x1bd79f+'%');}else if(_0x5c191c===_0x2893('0x2b')){_0x62d5bd['or'](_0x2893('0x2c'),_0x1bd79f+'%');}else if(_0x5c191c==='openchannel'){_0x62d5bd['or'](_0x2893('0x2d'),_0x1bd79f+'%');}}else if(_0x5c191c===_0x2893('0x2e')&&qs[_0x2893('0x2f')](_0x1bd79f)){_0x62d5bd['or'](_0x2893('0x30'),_0x1bd79f+'%');}else{if(_0x5c191c===_0x2893('0x2e')){_0x62d5bd['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2893('0x31')](_0x1bd79f,!![]))['or'](_0x2893('0x32'),qs['getFullTextValue'](_0x1bd79f));}else if(_0x5c191c!==_0x2893('0x2b')){_0x62d5bd['or'](_0x2893('0x33'),qs['getFullTextValue'](_0x1bd79f));}_0x62d5bd['or'](_0x2893('0x34'),qs['getFullTextValue'](_0x1bd79f,!![]),null);}}return _0x62d5bd;}function parseAdvancedSearchFilter(_0x51bfe5,_0x46bf80){var _0x128a98=getSqlClauses();var _0x4bb469=as['parseSearch'](_0x51bfe5);var _0x521c1a=_0x4bb469[_0x2893('0x35')];for(var _0x5a1689=0x0;_0x5a1689<_0x4bb469[_0x2893('0x36')][_0x2893('0x37')];_0x5a1689++){var _0x145c59=_0x4bb469[_0x2893('0x36')][_0x5a1689];var _0x540253='i';var _0x304d25=_['find'](_0x46bf80,['name',_0x145c59[_0x2893('0x8')]]);if(_0x304d25){var _0x31a252=as[_0x2893('0x38')](_0x540253,_0x304d25[_0x2893('0x39')],_0x145c59);_0x128a98[_0x2893('0x3a')][_0x521c1a](_0x31a252['text'],_0x31a252[_0x2893('0x3b')][_0x2893('0x3c')],_0x31a252['value'][_0x2893('0x3d')]);}else{switch(_0x145c59[_0x2893('0x8')]){case _0x2893('0x3e'):var _0x2411df=parseReadParameter(_0x145c59[_0x2893('0x3b')]);_0x128a98[_0x2893('0x3f')][_0x2893('0x40')](_0x2411df);break;case'Contact':if(_0x145c59[_0x2893('0x41')]===_0x2893('0x42')){if(_0x145c59[_0x2893('0x3b')][_0x2893('0x43')]('\x20')[_0x2893('0x37')]>0x1){_0x128a98['contact'][_0x521c1a](_0x2893('0x34'),qs[_0x2893('0x31')](_0x145c59['value'],!![]),null);}else{var _0x937e89='%'+_0x145c59[_0x2893('0x3b')]+'%';_0x128a98[_0x2893('0x44')][_0x521c1a](_0x2893('0x45'),_0x937e89,_0x937e89,_0x937e89);}}else{_0x304d25=_[_0x2893('0x46')](_0x46bf80,['name',_0x2893('0x47')]);_0x145c59[_0x2893('0x8')]='ContactId';_0x31a252=as[_0x2893('0x38')](_0x540253,_0x304d25[_0x2893('0x39')],_0x145c59);_0x128a98[_0x2893('0x44')][_0x521c1a](_0x31a252['text'],_0x31a252[_0x2893('0x3b')][_0x2893('0x3c')],_0x31a252[_0x2893('0x3b')][_0x2893('0x3d')]);}break;case _0x2893('0x48'):var _0x5518d3=_0x145c59['value'][_0x2893('0x43')](',')[_0x2893('0x18')](function(_0x2d00d9){return Number(_0x2d00d9);});var _0x9fab81=parseTagParameter(_0x5518d3);_0x128a98['tags']['clause'][_0x2893('0x40')](_0x9fab81);_0x128a98[_0x2893('0x49')][_0x2893('0x4a')]=_0x5518d3;break;case _0x2893('0x4b'):if(_0x145c59['operator']==='$substring'){_0x128a98[_0x2893('0x4c')][_0x521c1a](_0x2893('0x4d'),'%'+_0x145c59[_0x2893('0x3b')]+'%',null);}else{_0x304d25=_[_0x2893('0x46')](_0x46bf80,[_0x2893('0x9'),_0x2893('0x4e')]);_0x145c59[_0x2893('0x8')]='UserId';_0x31a252=as[_0x2893('0x38')](_0x540253,_0x304d25[_0x2893('0x39')],_0x145c59);_0x128a98[_0x2893('0x4c')][_0x521c1a](_0x31a252['text'],_0x31a252[_0x2893('0x3b')][_0x2893('0x3c')],_0x31a252[_0x2893('0x3b')][_0x2893('0x3d')]);}break;case _0x2893('0x4f'):case _0x2893('0x50'):_0x31a252=as[_0x2893('0x38')]('me',null,_0x145c59);_0x128a98[_0x2893('0x4f')][_0x521c1a](_0x31a252[_0x2893('0x51')],_0x31a252[_0x2893('0x3b')][_0x2893('0x3c')],_0x31a252[_0x2893('0x3b')]['end']);break;}}}return _0x128a98;}function parseModelFields(_0x57183a,_0x156333,_0x5e3378){var _0x32cb2a=utils[_0x2893('0x52')](_0x57183a);var _0x50f784=squel['expr']();var _0x24332b=_(_0x156333)[_0x2893('0x53')]()[_0x2893('0x18')](function(_0x95096e){return _[_0x2893('0x54')](_0x5e3378,[_0x2893('0x9'),_0x95096e])?_0x95096e:undefined;})[_0x2893('0x55')]()[_0x2893('0x3b')]();if(_0x24332b['length']>0x0){_0x24332b[_0x2893('0x24')](function(_0x287263){if(_0x287263===_0x32cb2a){_0x50f784[_0x2893('0x40')]('i.'+_0x32cb2a+_0x2893('0x17'),[][_0x2893('0x56')](_0x156333[_0x287263]));}else if(_0x287263===_0x2893('0x57')){var _0x504002=JSON[_0x2893('0x58')](_0x156333[_0x287263])['$gte'];var _0x4f164c=JSON['parse'](_0x156333[_0x287263])[_0x2893('0x59')];_0x50f784[_0x2893('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x504002,_0x4f164c);}else{if(_0x156333[_0x287263]===_0x2893('0x5a')){_0x50f784[_0x2893('0x40')]('i.'+_0x287263+'\x20IS\x20NULL');}else{_0x50f784[_0x2893('0x40')]('i.'+_0x287263+_0x2893('0x5b'),_0x156333[_0x287263]);}}});}return _0x50f784;}function parseQueryParameters(_0x1710b3,_0x5d0e71,_0x2e542c){var _0x600265=getSqlClauses();return Promise[_0x2893('0x5c')]()[_0x2893('0x5d')](function(){return parseModelFields(_0x1710b3,_0x5d0e71,_0x2e542c);})[_0x2893('0x5d')](function(_0x46e0e9){_0x600265[_0x2893('0x5e')][_0x2893('0x40')](_0x46e0e9);return parseReadParameter(_0x5d0e71[_0x2893('0x3f')]);})[_0x2893('0x5d')](function(_0x1f3b45){_0x600265[_0x2893('0x3f')]['and'](_0x1f3b45);return parseTagParameter(_0x5d0e71[_0x2893('0x5f')]);})[_0x2893('0x5d')](function(_0x172152){_0x600265[_0x2893('0x49')]['clause']['and'](_0x172152);return parseSearchFilter(_0x1710b3,_0x5d0e71['filter']);})['then'](function(_0x2e4981){_0x600265[_0x2893('0x60')]=_0x2e4981;return _0x600265;});}function checkAccountsRestrictions(_0x3aa194,_0x1624a7,_0x8e7d84){var _0x3441f7=utils[_0x2893('0x52')](_0x3aa194);var _0x243e26=_0x2893('0x61')+_[_0x2893('0x62')](_0x3aa194)+(_0x3aa194===_0x2893('0x63')?_0x2893('0x64'):_0x2893('0x65'));var _0x26f72b=squel[_0x2893('0x22')]();return Promise[_0x2893('0x5c')]()[_0x2893('0x5d')](function(){if(_0x8e7d84['search']&&_0x1624a7['role']===_0x2893('0x6')){return _0x1624a7[_0x243e26]({'attributes':['id'],'raw':!![]});}})[_0x2893('0x5d')](function(_0x493139){if(_0x493139){if(_0x493139[_0x2893('0x37')]===0x0){_0x26f72b[_0x2893('0x40')]('i.'+_0x3441f7+_0x2893('0x66'));}else{_0x26f72b['and']('i.'+_0x3441f7+_0x2893('0x17'),_[_0x2893('0x18')](_0x493139,'id'));}}else if(!_0x8e7d84[_0x3441f7]){_0x26f72b['and']('i.'+_0x3441f7+'\x20IS\x20NOT\x20NULL');}})[_0x2893('0x5d')](function(){return _0x26f72b;});}function getClosedOrderClause(_0x3c805b,_0x79fea1){var _0x3c14ff='';var _0x2a3b66=[_0x2893('0x67'),'i.secondDisposition','i.disposition'];if(_0x3c805b==='mail'){_0x2a3b66['unshift'](_0x2893('0x68'));}if(_0x79fea1[_0x2893('0x69')]==='0'&&_0x3c805b===_0x2893('0x2e')){_0x3c14ff=_0x2893('0x68');}else{if(_0x79fea1[_0x2893('0x69')]==='1'){_0x2a3b66[_0x2893('0x6a')]();}_0x3c14ff=_0x2893('0x6b')+_0x2a3b66[_0x2893('0x6c')](',\x20')+')';}return _0x3c14ff;}function getFilteredInteractions(_0x33d042,_0x1a98e3,_0x6e9c92,_0x4d6a50){var _0x27b755=utils['getInteractionFK'](_0x33d042);var _0x380400=_[_0x2893('0x62')](_0x33d042)+_0x2893('0x6d');var _0x5e2b6a=[];var _0x5dbe40=getTagsQuery();var _0x299a0e={'type':db[_0x2893('0x6e')][_0x2893('0x6f')]['SELECT'],'raw':!![]};var _0x5eb336=[];var _0x3894ac=[];return db['sequelize'][_0x2893('0x70')](_0x5dbe40['toString'](),_0x299a0e)[_0x2893('0x5d')](function(_0x554be7){_0x5e2b6a=_[_0x2893('0x71')](_0x554be7,'id');_0x299a0e=_['merge'](_0x299a0e,{'model':db[_0x380400],'mapToModel':!![],'nest':!![]});if(_0x6e9c92[_0x2893('0x5e')]){_0x4d6a50[_0x2893('0x72')][_0x2893('0x24')](function(_0x355c1d){_0x1a98e3['field']('i.'+_0x355c1d);});}else{_0x1a98e3['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x1a98e3[_0x2893('0x8')](_0x2893('0x73'),_0x2893('0x74'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x75'),_0x2893('0x76'));if(_0x33d042==='mail'){_0x1a98e3[_0x2893('0x8')](_0x2893('0x77'),_0x2893('0x78'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x79'),_0x2893('0x7a'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x7b'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x7c'));_0x1a98e3['field'](_0x2893('0x7d'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x7e'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x7f'));_0x1a98e3['field'](_0x2893('0x80'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x81'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x82'));_0x1a98e3['field'](_0x2893('0x83'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x84'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x85'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x67'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x68'));_0x1a98e3['field'](_0x2893('0x86'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x87'));_0x1a98e3[_0x2893('0x8')]('i.MailAccountId');_0x1a98e3[_0x2893('0x8')]('i.UserId');}else if(_0x33d042===_0x2893('0x88')){_0x1a98e3[_0x2893('0x8')](_0x2893('0x89'),_0x2893('0x7a'));}else{_0x1a98e3[_0x2893('0x8')](_0x2893('0x8a'),_0x2893('0x7a'));}if(_0x33d042!==_0x2893('0x2e')){_0x1a98e3[_0x2893('0x8')](_0x2893('0x8b'));}_0x1a98e3[_0x2893('0x8')](_0x2893('0x8c'),'Contact.firstName');_0x1a98e3[_0x2893('0x8')](_0x2893('0x8d'),_0x2893('0x8e'));_0x1a98e3['field'](_0x2893('0x8f'),_0x2893('0x90'));_0x1a98e3[_0x2893('0x8')]('c.phone',_0x2893('0x91'));_0x1a98e3['field'](_0x2893('0x92'),_0x2893('0x93'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x94'),_0x2893('0x95'));_0x1a98e3[_0x2893('0x8')](_0x2893('0x96'),_0x2893('0x97'));_0x1a98e3['field']('o.internal','Owner.internal');_0x1a98e3[_0x2893('0x8')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x4d6a50[_0x2893('0x98')]){_0x1a98e3[_0x2893('0x98')](_0x4d6a50[_0x2893('0x98')]);}if(_0x4d6a50['offset']){_0x1a98e3[_0x2893('0x99')](_0x4d6a50['offset']);}return db[_0x2893('0x9a')][_0x2893('0x70')](_0x1a98e3[_0x2893('0x9b')](),_0x299a0e);})[_0x2893('0x5d')](function(_0x54cc9d){_0x5eb336=_0x54cc9d;var _0x2fa8f4=getUsersQuery(_0x33d042,_0x5eb336);return db[_0x2893('0x9a')][_0x2893('0x70')](_0x2fa8f4[_0x2893('0x9b')](),_0x299a0e);})['then'](function(_0x132cdd){_0x3894ac=_[_0x2893('0x9c')](_0x132cdd,_0x27b755);if(_0x33d042==='mail'){return db['Setting'][_0x2893('0x9d')]({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x2893('0x5d')](function(_0xe8e63a){var _0x208e42=_0xe8e63a?_0xe8e63a[_0x2893('0x9e')]:undefined;var _0x4b5f52=_0x5eb336[_0x2893('0x18')](function(_0x4756b3){return updateInteraction(_0x4756b3,_0x5e2b6a,_0x3894ac,_0x208e42);});return Promise[_0x2893('0x9f')](_0x4b5f52);});}function countFilteredInteractions(_0x53d929,_0x261918){var _0x36d087=_0x53d929[_0x2893('0xa0')]();_0x36d087['field']('COUNT(*)');_0x36d087['field'](_0x2893('0xa1'),_0x2893('0x3e'));var _0x306b13=utils[_0x2893('0x23')](_0x261918);if(!_[_0x2893('0xa2')](_0x306b13)){_0x36d087[_0x2893('0x16')](_0x2893('0xa3'),_0x306b13);}var _0x155553={'type':db['Sequelize']['QueryTypes'][_0x2893('0xa4')],'raw':!![]};return db[_0x2893('0x9a')][_0x2893('0x70')](_0x36d087[_0x2893('0x9b')](),_0x155553);}module[_0x2893('0xa5')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd385=['length','\x20IN\x20?','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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','default','start','value','unreadMessages','read','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','type','text','end','Tag','map','tags','clause','ids','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','getAccountFK','keys','some','and','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','Websites','search','agent','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','o.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','select','field','name','tools_tags','getInteractionFK','_interactions','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd385,0x137));var _0x5d38=function(_0x5788f3,_0x275670){_0x5788f3=_0x5788f3-0x0;var _0x4f1d41=_0xd385[_0x5788f3];return _0x4f1d41;};'use strict';var _=require(_0x5d38('0x0'));var squel=require(_0x5d38('0x1'));var as=require(_0x5d38('0x2'));var qs=require(_0x5d38('0x3'));var updateInteraction=require('./update-interaction')['updateInteraction'];var utils=require('./utils');var db=require(_0x5d38('0x4'))['db'];function skipInteractionsQuery(_0x3f3339,_0x459c1d,_0x4e6967){var _0x337805=![];var _0x439e0c=utils['getAccountFK'](_0x3f3339);if(_0x459c1d[_0x5d38('0x5')]==='agent'&&!_0x4e6967['search']&&!_0x4e6967[_0x439e0c]){_0x337805=!![];}return _0x337805;}function getTagsQuery(){return squel[_0x5d38('0x6')]()[_0x5d38('0x7')]('id')[_0x5d38('0x7')](_0x5d38('0x8'))['field']('color')['from'](_0x5d38('0x9'));}function getUsersQuery(_0x235d4f,_0x464d46){var _0xc16277=utils[_0x5d38('0xa')](_0x235d4f);var _0x5a278a='user_has_'+_0x235d4f+_0x5d38('0xb');var _0x2608a9=squel['select']()[_0x5d38('0x7')](_0x5d38('0xc'))[_0x5d38('0x7')](_0x5d38('0xd'))[_0x5d38('0x7')](_0x5d38('0xe')+_0xc16277)[_0x5d38('0xf')](_0x5a278a,'ui')[_0x5d38('0x10')](_0x5d38('0x11'),'u',_0x5d38('0x12'));if(_0x464d46[_0x5d38('0x13')]>0x0){_0x2608a9['where']('ui.'+_0xc16277+_0x5d38('0x14'),_['map'](_0x464d46,'id'));}return _0x2608a9;}function getInteractionsQuery(_0xf808f3){var _0x3e16b5=utils['getInteractionsTables'](_0xf808f3);var _0x3409f2=utils['getAccountFK'](_0xf808f3);var _0x39e371=utils[_0x5d38('0xa')](_0xf808f3);return squel[_0x5d38('0x6')]()[_0x5d38('0xf')](_0x3e16b5[_0x5d38('0x15')],'i')['left_join']('cm_contacts','c',_0x5d38('0x16'))[_0x5d38('0x10')]('users','o',_0x5d38('0x17'))[_0x5d38('0x10')](_0x3e16b5[_0x5d38('0x18')],'a',_0x5d38('0x19')+_0x3409f2)[_0x5d38('0x10')](_0x3e16b5['messages'],'me',_0x5d38('0x1a')+_0x39e371+_0x5d38('0x1b'))[_0x5d38('0x10')](_0x3e16b5[_0x5d38('0x1c')],'it',_0x5d38('0x1d')+_0x39e371+'\x20=\x20i.id')['left_join'](_0x5d38('0x9'),'t',_0x5d38('0x1e'));}function getSqlClauses(){var _0xcacc2={'body':squel[_0x5d38('0x1f')](),'contact':squel[_0x5d38('0x1f')](),'default':squel[_0x5d38('0x1f')](),'fields':squel[_0x5d38('0x1f')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x5d38('0x1f')](),'ids':null},'user':squel[_0x5d38('0x1f')]()};return _0xcacc2;}function parseTagParameter(_0x26b0ff){var _0x156e5f=squel['expr']();if(_0x26b0ff){var _0x2ff4ab=utils[_0x5d38('0x20')](_0x26b0ff);_0x2ff4ab[_0x5d38('0x21')](function(_0x5b2ab8){_0x156e5f['or'](_0x5d38('0x22'),'%,'+_0x5b2ab8+',%');});}return _0x156e5f;}function parseReadParameter(_0x3e2045){var _0x26fa7a='';if(_0x3e2045){_0x26fa7a=_0x5d38('0x23');if(_0x3e2045==='1'){_0x26fa7a=_0x26fa7a[_0x5d38('0x24')](_0x5d38('0x25'),'=');}else{_0x26fa7a=_0x26fa7a['replace'](_0x5d38('0x25'),'>');}}return _0x26fa7a;}function parseSearchFilter(_0x27adfd,_0x411c25){var _0x18bb9e=squel[_0x5d38('0x1f')]();if(_0x411c25){var _0x163c0b=_0x411c25[_0x5d38('0x24')]('\x5c','\x5c\x5c')[_0x5d38('0x24')](/'/g,'\x27\x27');if(qs[_0x5d38('0x26')](_0x163c0b)){_0x18bb9e['or'](_0x5d38('0x27'),_0x163c0b+'%');if([_0x5d38('0x28'),_0x5d38('0x29')][_0x5d38('0x2a')](_0x27adfd)){_0x18bb9e['or'](_0x5d38('0x2b'),_0x163c0b+'%');}else if(_0x27adfd===_0x5d38('0x2c')){_0x18bb9e['or']('i.fax\x20LIKE\x20?',_0x163c0b+'%');}else if(_0x27adfd===_0x5d38('0x2d')){_0x18bb9e['or'](_0x5d38('0x2e'),_0x163c0b+'%');}}else if(_0x27adfd===_0x5d38('0x2f')&&qs[_0x5d38('0x30')](_0x163c0b)){_0x18bb9e['or'](_0x5d38('0x31'),_0x163c0b+'%');}else{if(_0x27adfd==='mail'){_0x18bb9e['or'](_0x5d38('0x32'),qs[_0x5d38('0x33')](_0x163c0b,!![]))['or'](_0x5d38('0x34'),qs[_0x5d38('0x33')](_0x163c0b));}else if(_0x27adfd!==_0x5d38('0x2c')){_0x18bb9e['or'](_0x5d38('0x35'),qs[_0x5d38('0x33')](_0x163c0b));}_0x18bb9e['or'](_0x5d38('0x36'),qs[_0x5d38('0x33')](_0x163c0b,!![]),null);}}return _0x18bb9e;}function parseAdvancedSearchFilter(_0x42c276,_0x4336df){var _0xa99966=getSqlClauses();var _0x13f57f=as[_0x5d38('0x37')](_0x42c276);var _0x42dc35=_0x13f57f[_0x5d38('0x38')];for(var _0x4c22d4=0x0;_0x4c22d4<_0x13f57f['conditions']['length'];_0x4c22d4++){var _0x59bd9b=_0x13f57f[_0x5d38('0x39')][_0x4c22d4];var _0x23badb='i';var _0x30ffcd=_[_0x5d38('0x3a')](_0x4336df,[_0x5d38('0x8'),_0x59bd9b[_0x5d38('0x7')]]);if(_0x30ffcd){var _0x4c3783=as['buildExpression'](_0x23badb,_0x30ffcd['type'],_0x59bd9b);_0xa99966[_0x5d38('0x3b')][_0x42dc35](_0x4c3783['text'],_0x4c3783['value'][_0x5d38('0x3c')],_0x4c3783[_0x5d38('0x3d')]['end']);}else{switch(_0x59bd9b['field']){case _0x5d38('0x3e'):var _0x551369=parseReadParameter(_0x59bd9b['value']);_0xa99966[_0x5d38('0x3f')]['and'](_0x551369);break;case _0x5d38('0x40'):if(_0x59bd9b[_0x5d38('0x41')]==='$substring'){if(_0x59bd9b['value'][_0x5d38('0x42')]('\x20')[_0x5d38('0x13')]>0x1){_0xa99966[_0x5d38('0x43')][_0x42dc35](_0x5d38('0x36'),qs[_0x5d38('0x33')](_0x59bd9b[_0x5d38('0x3d')],!![]),null);}else{var _0x3f0bd4='%'+_0x59bd9b[_0x5d38('0x3d')]+'%';_0xa99966[_0x5d38('0x43')][_0x42dc35](_0x5d38('0x44'),_0x3f0bd4,_0x3f0bd4,_0x3f0bd4);}}else{_0x30ffcd=_[_0x5d38('0x3a')](_0x4336df,[_0x5d38('0x8'),_0x5d38('0x45')]);_0x59bd9b[_0x5d38('0x7')]=_0x5d38('0x45');_0x4c3783=as['buildExpression'](_0x23badb,_0x30ffcd[_0x5d38('0x46')],_0x59bd9b);_0xa99966['contact'][_0x42dc35](_0x4c3783[_0x5d38('0x47')],_0x4c3783['value'][_0x5d38('0x3c')],_0x4c3783[_0x5d38('0x3d')][_0x5d38('0x48')]);}break;case _0x5d38('0x49'):var _0x1adcf0=_0x59bd9b['value'][_0x5d38('0x42')](',')[_0x5d38('0x4a')](function(_0x4fcefa){return Number(_0x4fcefa);});var _0x26cf7e=parseTagParameter(_0x1adcf0);_0xa99966[_0x5d38('0x4b')][_0x5d38('0x4c')]['and'](_0x26cf7e);_0xa99966[_0x5d38('0x4b')][_0x5d38('0x4d')]=_0x1adcf0;break;case _0x5d38('0x4e'):if(_0x59bd9b['operator']===_0x5d38('0x4f')){_0xa99966[_0x5d38('0x50')][_0x42dc35](_0x5d38('0x51'),'%'+_0x59bd9b[_0x5d38('0x3d')]+'%',null);}else{_0x30ffcd=_[_0x5d38('0x3a')](_0x4336df,[_0x5d38('0x8'),_0x5d38('0x52')]);_0x59bd9b[_0x5d38('0x7')]='UserId';_0x4c3783=as[_0x5d38('0x53')](_0x23badb,_0x30ffcd['type'],_0x59bd9b);_0xa99966[_0x5d38('0x50')][_0x42dc35](_0x4c3783['text'],_0x4c3783[_0x5d38('0x3d')]['start'],_0x4c3783[_0x5d38('0x3d')][_0x5d38('0x48')]);}break;case _0x5d38('0x54'):case'plainBody':_0x4c3783=as[_0x5d38('0x53')]('me',null,_0x59bd9b);_0xa99966[_0x5d38('0x54')][_0x42dc35](_0x4c3783['text'],_0x4c3783[_0x5d38('0x3d')][_0x5d38('0x3c')],_0x4c3783[_0x5d38('0x3d')]['end']);break;}}}return _0xa99966;}function parseModelFields(_0x1cf9f2,_0x20fc68,_0x43094a){var _0x151782=utils[_0x5d38('0x55')](_0x1cf9f2);var _0x389f4e=squel['expr']();var _0x1fd4fd=_(_0x20fc68)[_0x5d38('0x56')]()[_0x5d38('0x4a')](function(_0x2bd9da){return _[_0x5d38('0x57')](_0x43094a,['name',_0x2bd9da])?_0x2bd9da:undefined;})['compact']()[_0x5d38('0x3d')]();if(_0x1fd4fd[_0x5d38('0x13')]>0x0){_0x1fd4fd[_0x5d38('0x21')](function(_0x1b71a0){if(_0x1b71a0===_0x151782){_0x389f4e[_0x5d38('0x58')]('i.'+_0x151782+_0x5d38('0x14'),[]['concat'](_0x20fc68[_0x1b71a0]));}else if(_0x1b71a0==='createdAt'){var _0x57520e=JSON[_0x5d38('0x59')](_0x20fc68[_0x1b71a0])['$gte'];var _0x109035=JSON[_0x5d38('0x59')](_0x20fc68[_0x1b71a0])[_0x5d38('0x5a')];_0x389f4e[_0x5d38('0x58')](_0x5d38('0x5b'),_0x57520e,_0x109035);}else{if(_0x20fc68[_0x1b71a0]===_0x5d38('0x5c')){_0x389f4e[_0x5d38('0x58')]('i.'+_0x1b71a0+_0x5d38('0x5d'));}else{_0x389f4e['and']('i.'+_0x1b71a0+_0x5d38('0x5e'),_0x20fc68[_0x1b71a0]);}}});}return _0x389f4e;}function parseQueryParameters(_0x4ccf17,_0x253b35,_0x563e85){var _0xa3b2f5=getSqlClauses();return Promise[_0x5d38('0x5f')]()['then'](function(){return parseModelFields(_0x4ccf17,_0x253b35,_0x563e85);})[_0x5d38('0x60')](function(_0x2457b6){_0xa3b2f5[_0x5d38('0x61')][_0x5d38('0x58')](_0x2457b6);return parseReadParameter(_0x253b35['read']);})[_0x5d38('0x60')](function(_0x337eb4){_0xa3b2f5[_0x5d38('0x3f')][_0x5d38('0x58')](_0x337eb4);return parseTagParameter(_0x253b35[_0x5d38('0x62')]);})[_0x5d38('0x60')](function(_0x27e0ea){_0xa3b2f5['tags'][_0x5d38('0x4c')]['and'](_0x27e0ea);return parseSearchFilter(_0x4ccf17,_0x253b35[_0x5d38('0x63')]);})[_0x5d38('0x60')](function(_0x5bbf9f){_0xa3b2f5[_0x5d38('0x63')]=_0x5bbf9f;return _0xa3b2f5;});}function checkAccountsRestrictions(_0x23c257,_0x589648,_0x4f5003){var _0x378c15=utils['getAccountFK'](_0x23c257);var _0x52c4f7=_0x5d38('0x64')+_[_0x5d38('0x65')](_0x23c257)+(_0x23c257==='chat'?_0x5d38('0x66'):'Accounts');var _0x44ff70=squel[_0x5d38('0x1f')]();return Promise[_0x5d38('0x5f')]()[_0x5d38('0x60')](function(){if(_0x4f5003[_0x5d38('0x67')]&&_0x589648[_0x5d38('0x5')]===_0x5d38('0x68')){return _0x589648[_0x52c4f7]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x45bcbc){if(_0x45bcbc){if(_0x45bcbc[_0x5d38('0x13')]===0x0){_0x44ff70[_0x5d38('0x58')]('i.'+_0x378c15+_0x5d38('0x5d'));}else{_0x44ff70[_0x5d38('0x58')]('i.'+_0x378c15+_0x5d38('0x14'),_['map'](_0x45bcbc,'id'));}}else if(!_0x4f5003[_0x378c15]){_0x44ff70[_0x5d38('0x58')]('i.'+_0x378c15+_0x5d38('0x69'));}})[_0x5d38('0x60')](function(){return _0x44ff70;});}function getClosedOrderClause(_0x47994c,_0x1ea791){var _0x300ff6='';var _0x561299=[_0x5d38('0x6a'),_0x5d38('0x6b'),_0x5d38('0x6c')];if(_0x47994c==='mail'){_0x561299[_0x5d38('0x6d')](_0x5d38('0x6e'));}if(_0x1ea791[_0x5d38('0x6f')]==='0'&&_0x47994c===_0x5d38('0x2f')){_0x300ff6=_0x5d38('0x6e');}else{if(_0x1ea791['closed']==='1'){_0x561299['shift']();}_0x300ff6=_0x5d38('0x70')+_0x561299['join'](',\x20')+')';}return _0x300ff6;}function getFilteredInteractions(_0x33c644,_0x172199,_0x57c38a,_0x528949){var _0x5c26d7=utils[_0x5d38('0xa')](_0x33c644);var _0xf8d40c=_[_0x5d38('0x65')](_0x33c644)+'Interaction';var _0x26162c=[];var _0x4e5803=getTagsQuery();var _0x382390={'type':db[_0x5d38('0x71')][_0x5d38('0x72')][_0x5d38('0x73')],'raw':!![]};var _0x31b5b9=[];var _0x205292=[];return db['sequelize'][_0x5d38('0x74')](_0x4e5803[_0x5d38('0x75')](),_0x382390)['then'](function(_0x47d945){_0x26162c=_[_0x5d38('0x76')](_0x47d945,'id');_0x382390=_[_0x5d38('0x77')](_0x382390,{'model':db[_0xf8d40c],'mapToModel':!![],'nest':!![]});if(_0x57c38a[_0x5d38('0x61')]){_0x528949[_0x5d38('0x78')][_0x5d38('0x21')](function(_0x3afe6d){_0x172199[_0x5d38('0x7')]('i.'+_0x3afe6d);});}else{_0x172199[_0x5d38('0x7')](_0x5d38('0x79'),'unreadMessages');_0x172199[_0x5d38('0x7')](_0x5d38('0x7a'),_0x5d38('0x7b'));_0x172199[_0x5d38('0x7')]('a.mandatoryDisposition',_0x5d38('0x7c'));if(_0x33c644===_0x5d38('0x2f')){_0x172199['field'](_0x5d38('0x7d'),_0x5d38('0x7e'));_0x172199[_0x5d38('0x7')](_0x5d38('0x7f'),_0x5d38('0x80'));_0x172199[_0x5d38('0x7')]('i.id');_0x172199[_0x5d38('0x7')]('i.createdAt');_0x172199[_0x5d38('0x7')](_0x5d38('0x81'));_0x172199['field'](_0x5d38('0x82'));_0x172199['field'](_0x5d38('0x83'));_0x172199[_0x5d38('0x7')](_0x5d38('0x84'));_0x172199[_0x5d38('0x7')]('i.lastMsgAt');_0x172199[_0x5d38('0x7')](_0x5d38('0x85'));_0x172199[_0x5d38('0x7')](_0x5d38('0x86'));_0x172199[_0x5d38('0x7')](_0x5d38('0x6c'));_0x172199['field'](_0x5d38('0x6b'));_0x172199[_0x5d38('0x7')](_0x5d38('0x6a'));_0x172199[_0x5d38('0x7')](_0x5d38('0x6e'));_0x172199['field'](_0x5d38('0x87'));_0x172199[_0x5d38('0x7')](_0x5d38('0x88'));_0x172199['field'](_0x5d38('0x89'));_0x172199['field'](_0x5d38('0x8a'));}else if(_0x33c644===_0x5d38('0x2d')){_0x172199[_0x5d38('0x7')](_0x5d38('0x8b'),'contactName');}else{_0x172199[_0x5d38('0x7')]('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',_0x5d38('0x80'));}if(_0x33c644!==_0x5d38('0x2f')){_0x172199['field'](_0x5d38('0x8c'));}_0x172199[_0x5d38('0x7')]('c.firstName',_0x5d38('0x8d'));_0x172199[_0x5d38('0x7')](_0x5d38('0x8e'),_0x5d38('0x8f'));_0x172199[_0x5d38('0x7')](_0x5d38('0x90'),_0x5d38('0x91'));_0x172199[_0x5d38('0x7')](_0x5d38('0x92'),'Contact.phone');_0x172199[_0x5d38('0x7')](_0x5d38('0x93'),_0x5d38('0x94'));_0x172199[_0x5d38('0x7')]('c.fax','Contact.fax');_0x172199[_0x5d38('0x7')](_0x5d38('0x95'),'Owner.fullname');_0x172199[_0x5d38('0x7')](_0x5d38('0x96'),'Owner.internal');_0x172199[_0x5d38('0x7')](_0x5d38('0x97'),_0x5d38('0x98'));}if(_0x528949[_0x5d38('0x99')]){_0x172199[_0x5d38('0x99')](_0x528949[_0x5d38('0x99')]);}if(_0x528949[_0x5d38('0x9a')]){_0x172199['offset'](_0x528949[_0x5d38('0x9a')]);}return db[_0x5d38('0x9b')][_0x5d38('0x74')](_0x172199[_0x5d38('0x75')](),_0x382390);})['then'](function(_0x4d15c8){_0x31b5b9=_0x4d15c8;var _0xa88657=getUsersQuery(_0x33c644,_0x31b5b9);return db[_0x5d38('0x9b')]['query'](_0xa88657[_0x5d38('0x75')](),_0x382390);})[_0x5d38('0x60')](function(_0x4d85fa){_0x205292=_[_0x5d38('0x9c')](_0x4d85fa,_0x5c26d7);if(_0x33c644===_0x5d38('0x2f')){return db[_0x5d38('0x9d')]['findOne']({'attributes':[_0x5d38('0x9e')],'raw':!![]});}})['then'](function(_0x1ba360){var _0x211635=_0x1ba360?_0x1ba360['enableEmailPreview']:undefined;var _0x4d3688=_0x31b5b9['map'](function(_0x5a1a90){return updateInteraction(_0x5a1a90,_0x26162c,_0x205292,_0x211635);});return Promise[_0x5d38('0x9f')](_0x4d3688);});}function countFilteredInteractions(_0x574e22,_0x209008){var _0x40e8f1=_0x574e22[_0x5d38('0xa0')]();_0x40e8f1['field'](_0x5d38('0xa1'));_0x40e8f1[_0x5d38('0x7')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5d38('0x3e'));var _0x56ddc4=utils[_0x5d38('0x20')](_0x209008);if(!_[_0x5d38('0xa2')](_0x56ddc4)){_0x40e8f1[_0x5d38('0xa3')]('t.id\x20IN\x20?',_0x56ddc4);}var _0x467c88={'type':db[_0x5d38('0x71')][_0x5d38('0x72')]['SELECT'],'raw':!![]};return db[_0x5d38('0x9b')][_0x5d38('0x74')](_0x40e8f1[_0x5d38('0x75')](),_0x467c88);}module[_0x5d38('0xa4')]={'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 2e4e4b1..834b32b 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 _0x9c52=['closed','UserId','disposition','MailMessage','out','then','plainBody','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','lodash','../../mysqldb','fullname','push','waiting','talking','answered','unmanaged','abandoned'];(function(_0x36d4a4,_0x38472c){var _0x4a99e5=function(_0x379dc6){while(--_0x379dc6){_0x36d4a4['push'](_0x36d4a4['shift']());}};_0x4a99e5(++_0x38472c);}(_0x9c52,0x12b));var _0x29c5=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c52[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x29c5('0x0'));var db=require(_0x29c5('0x1'))['db'];function getInteractionUsers(_0xb28e9c,_0x4c4178){return new Promise(function(_0x288c19,_0x121689){try{var _0x3eea77=[];if(_0x4c4178[_0xb28e9c]){_0x3eea77=_0x4c4178[_0xb28e9c]['map'](function(_0x1cf41a){return{'id':_0x1cf41a['id'],'fullname':_0x1cf41a[_0x29c5('0x2')]};});}return _0x288c19(_0x3eea77);}catch(_0x25df5a){_0x121689(_0x25df5a);}});}function getInteractionTags(_0x38b4ba,_0x3da1a6){var _0x3f6c91=[];if(_0x38b4ba){_0x38b4ba['split'](',')['forEach'](function(_0x33bc80){_0x3f6c91[_0x29c5('0x3')](_0x3da1a6[_0x33bc80]);});}return _0x3f6c91;}function updateWaitingCounter(_0x1ecee6){if(_0x1ecee6[_0x29c5('0x4')]){_0x1ecee6[_0x29c5('0x4')]-=0x1;}}function updateInteractionCounters(_0x444b42){_0x444b42[_0x29c5('0x4')]=0x0;_0x444b42[_0x29c5('0x5')]=0x0;_0x444b42[_0x29c5('0x6')]=0x0;_0x444b42[_0x29c5('0x7')]=0x0;_0x444b42[_0x29c5('0x8')]=0x0;_0x444b42['total']=0x0;if(_0x444b42[_0x29c5('0x9')]){if(_0x444b42['disposition']==='abandoned'){_0x444b42[_0x29c5('0x8')]+=0x1;updateWaitingCounter(_0x444b42);}if(_0x444b42[_0x29c5('0xa')]){_0x444b42['answered']+=0x1;if(_0x444b42['talking']){_0x444b42['talking']-=0x1;}}else{if(_0x444b42[_0x29c5('0xb')]){_0x444b42[_0x29c5('0x7')]+=0x1;updateWaitingCounter(_0x444b42);}}}else{if(!_0x444b42[_0x29c5('0xa')]){_0x444b42[_0x29c5('0x4')]+=0x1;}if(_0x444b42[_0x29c5('0xa')]){_0x444b42[_0x29c5('0x5')]+=0x1;updateWaitingCounter(_0x444b42);}}_0x444b42['total']+=0x1;return _0x444b42;}function getLastMessageText(_0x26851b){return db[_0x29c5('0xc')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x26851b['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x29c5('0xd')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':'-id','raw':!![]})[_0x29c5('0xe')](function(_0x19d41c){if(_0x19d41c&&_0x19d41c[_0x29c5('0xf')]){_0x26851b[_0x29c5('0x10')]=_[_0x29c5('0x11')](_0x19d41c[_0x29c5('0xf')]);}return _0x26851b;})[_0x29c5('0x12')](function(_0x10719f){throw _0x10719f;});}exports[_0x29c5('0x13')]=function(_0x479161,_0x153a80,_0x25235a,_0x8eae67){return new Promise(function(_0x49f903,_0xa2a97e){return getInteractionUsers(_0x479161['id'],_0x25235a)[_0x29c5('0xe')](function(_0x237325){_0x479161[_0x29c5('0x14')]=_0x237325;return getInteractionTags(_0x479161[_0x29c5('0x15')],_0x153a80);})['then'](function(_0x3460ec){_0x479161['Tags']=_0x3460ec;delete _0x479161[_0x29c5('0x15')];return updateInteractionCounters(_0x479161);})[_0x29c5('0xe')](function(_0x371f77){if(_0x8eae67){return getLastMessageText(_0x371f77);}else{return _0x371f77;}})[_0x29c5('0xe')](function(_0x55ccaf){_0x49f903(_0x55ccaf);})['catch'](function(_0x5bb6a8){_0xa2a97e(_0x5bb6a8);});});}; \ No newline at end of file +var _0xf1d2=['abandoned','total','closed','disposition','UserId','findOne','out','-id','plainBody','lastMsgText','trimStart','catch','updateInteraction','then','TagIds','Tags','lodash','../../mysqldb','map','fullname','split','waiting','talking','answered','unmanaged'];(function(_0x1679cc,_0x242c53){var _0x4aaec8=function(_0x303c5f){while(--_0x303c5f){_0x1679cc['push'](_0x1679cc['shift']());}};_0x4aaec8(++_0x242c53);}(_0xf1d2,0xa6));var _0x2f1d=function(_0x22cb5f,_0x2cdd63){_0x22cb5f=_0x22cb5f-0x0;var _0x274d36=_0xf1d2[_0x22cb5f];return _0x274d36;};'use strict';var _=require(_0x2f1d('0x0'));var db=require(_0x2f1d('0x1'))['db'];function getInteractionUsers(_0x2dc0d6,_0x117474){return new Promise(function(_0x2b934d,_0x271cbc){try{var _0xbc3a68=[];if(_0x117474[_0x2dc0d6]){_0xbc3a68=_0x117474[_0x2dc0d6][_0x2f1d('0x2')](function(_0x49955f){return{'id':_0x49955f['id'],'fullname':_0x49955f[_0x2f1d('0x3')]};});}return _0x2b934d(_0xbc3a68);}catch(_0x87fed8){_0x271cbc(_0x87fed8);}});}function getInteractionTags(_0x27b552,_0x438b80){var _0x59055e=[];if(_0x27b552){_0x27b552[_0x2f1d('0x4')](',')['forEach'](function(_0xb0dcb7){_0x59055e['push'](_0x438b80[_0xb0dcb7]);});}return _0x59055e;}function updateWaitingCounter(_0x565f44){if(_0x565f44[_0x2f1d('0x5')]){_0x565f44['waiting']-=0x1;}}function updateInteractionCounters(_0x5a33be){_0x5a33be['waiting']=0x0;_0x5a33be[_0x2f1d('0x6')]=0x0;_0x5a33be[_0x2f1d('0x7')]=0x0;_0x5a33be[_0x2f1d('0x8')]=0x0;_0x5a33be[_0x2f1d('0x9')]=0x0;_0x5a33be[_0x2f1d('0xa')]=0x0;if(_0x5a33be[_0x2f1d('0xb')]){if(_0x5a33be[_0x2f1d('0xc')]===_0x2f1d('0x9')){_0x5a33be[_0x2f1d('0x9')]+=0x1;updateWaitingCounter(_0x5a33be);}if(_0x5a33be[_0x2f1d('0xd')]){_0x5a33be[_0x2f1d('0x7')]+=0x1;if(_0x5a33be[_0x2f1d('0x6')]){_0x5a33be['talking']-=0x1;}}else{if(_0x5a33be['disposition']){_0x5a33be['unmanaged']+=0x1;updateWaitingCounter(_0x5a33be);}}}else{if(!_0x5a33be[_0x2f1d('0xd')]){_0x5a33be[_0x2f1d('0x5')]+=0x1;}if(_0x5a33be[_0x2f1d('0xd')]){_0x5a33be['talking']+=0x1;updateWaitingCounter(_0x5a33be);}}_0x5a33be[_0x2f1d('0xa')]+=0x1;return _0x5a33be;}function getLastMessageText(_0x3e6fa5){return db['MailMessage'][_0x2f1d('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3e6fa5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2f1d('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2f1d('0x10'),'raw':!![]})['then'](function(_0x5e15c5){if(_0x5e15c5&&_0x5e15c5[_0x2f1d('0x11')]){_0x3e6fa5[_0x2f1d('0x12')]=_[_0x2f1d('0x13')](_0x5e15c5['plainBody']);}return _0x3e6fa5;})[_0x2f1d('0x14')](function(_0x4a30f4){throw _0x4a30f4;});}exports[_0x2f1d('0x15')]=function(_0x4d26d0,_0x3aca1b,_0x2342df,_0x147e8a){return new Promise(function(_0x1e83ec,_0x469f4c){return getInteractionUsers(_0x4d26d0['id'],_0x2342df)[_0x2f1d('0x16')](function(_0x3a48de){_0x4d26d0['Users']=_0x3a48de;return getInteractionTags(_0x4d26d0[_0x2f1d('0x17')],_0x3aca1b);})[_0x2f1d('0x16')](function(_0x1155f0){_0x4d26d0[_0x2f1d('0x18')]=_0x1155f0;delete _0x4d26d0[_0x2f1d('0x17')];return updateInteractionCounters(_0x4d26d0);})[_0x2f1d('0x16')](function(_0x3f2dba){if(_0x147e8a){return getLastMessageText(_0x3f2dba);}else{return _0x3f2dba;}})[_0x2f1d('0x16')](function(_0x3b99a8){_0x1e83ec(_0x3b99a8);})[_0x2f1d('0x14')](function(_0x3aa009){_0x469f4c(_0x3aa009);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 331fa5b..d088d6f 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 _0x5ed3=['null','Interaction','then','update','info','error','exports','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','toLowerCase','toUpperCase','name','role','stringify'];(function(_0x243177,_0x2f429e){var _0x579844=function(_0x5e234c){while(--_0x5e234c){_0x243177['push'](_0x243177['shift']());}};_0x579844(++_0x2f429e);}(_0x5ed3,0xd9));var _0x35ed=function(_0x4ba197,_0x486ddc){_0x4ba197=_0x4ba197-0x0;var _0x397202=_0x5ed3[_0x4ba197];return _0x397202;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')('openchannel-interactions'),'mail':require(_0x35ed('0x0'))('mail-interactions'),'fax':require('../../config/logger')(_0x35ed('0x1')),'sms':require(_0x35ed('0x0'))(_0x35ed('0x2')),'chat':require(_0x35ed('0x0'))(_0x35ed('0x3')),'whatsapp':require('../../config/logger')(_0x35ed('0x4'))};function getAccountFK(_0x167c7f){return _[_0x35ed('0x5')](_0x167c7f)+(_0x167c7f===_0x35ed('0x6')?_0x35ed('0x7'):_0x35ed('0x8'))+'Id';}function getInteractionFK(_0x4fb59d){return _['capitalize'](_0x4fb59d)+_0x35ed('0x9');}function getInteractionId(_0x334981,_0x378402,_0x4f0833){if(_0x334981&&_0x334981[_['upperFirst'](_0x4f0833)+_0x35ed('0x9')]){return _0x334981[_[_0x35ed('0xa')](_0x4f0833)+'InteractionId'];}else if(_0x334981&&_0x334981['id']){return _0x334981['id'];}else if(_0x378402&&_0x378402['id']){return _0x378402['id'];}else{return _0x35ed('0xb');}}function getInteractionsTables(_0x162d57){return{'accounts':_0x162d57+'_'+(_0x162d57===_0x35ed('0x6')?_0x35ed('0xc'):_0x35ed('0xd')),'interactions':_0x162d57+_0x35ed('0xe'),'interactionsTags':_0x162d57+_0x35ed('0xf'),'messages':_0x162d57+'_messages','userInteractions':_0x35ed('0x10')+_0x162d57+_0x35ed('0xe')};}function getSelectedTags(_0x386d19){var _0x4d6ef8=[];if(_0x386d19){_0x4d6ef8=Array[_0x35ed('0x11')](_0x386d19)?_0x386d19:[_0x386d19];}return _0x4d6ef8;}function log(_0x480d8f,_0x25c2a1,_0x1ffff2,_0x5b25be,_0x3cd07c,_0xc6275c){loggers[_0x3cd07c[_0x35ed('0x12')]()][_0x480d8f]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xc6275c[_0x35ed('0x13')](),_0x25c2a1?_0x25c2a1['id']:null,_0x25c2a1?_0x25c2a1[_0x35ed('0x14')]:null,_0x25c2a1?_0x25c2a1[_0x35ed('0x15')]:null,getInteractionId(_0x1ffff2,_0x5b25be,_0x3cd07c),_0x1ffff2?JSON[_0x35ed('0x16')](_0x1ffff2):_0x35ed('0x17'));}function updateUser(_0x114d55,_0x15d6c2,_0x26d4a4,_0x7a7b7b,_0x497427){db[_['upperFirst'](_0x7a7b7b)+_0x35ed('0x18')]['findOne']({'where':{'id':getInteractionId(_0x15d6c2,_0x26d4a4,_0x7a7b7b)}})[_0x35ed('0x19')](function(_0x584912){if(_0x584912){return _0x584912[_0x35ed('0x1a')]({'UserId':_0x114d55?_0x114d55['id']:null});}})[_0x35ed('0x19')](function(_0x1fa3c6){if(_0x1fa3c6){log(_0x35ed('0x1b'),_0x114d55,_0x15d6c2,_0x26d4a4,_0x7a7b7b,_0x497427);}})['catch'](function(){log(_0x35ed('0x1c'),_0x114d55,_0x15d6c2,_0x26d4a4,_0x7a7b7b,_0x497427);});}module[_0x35ed('0x1d')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xa880=['info','catch','error','exports','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','findOne','then'];(function(_0x5a2473,_0x402e8d){var _0x3079ad=function(_0x5c7513){while(--_0x5c7513){_0x5a2473['push'](_0x5a2473['shift']());}};_0x3079ad(++_0x402e8d);}(_0xa880,0x80));var _0x0a88=function(_0x6d0143,_0x3d7c30){_0x6d0143=_0x6d0143-0x0;var _0x29cb75=_0xa880[_0x6d0143];return _0x29cb75;};'use strict';var _=require(_0x0a88('0x0'));var db=require(_0x0a88('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x0a88('0x2')),'mail':require(_0x0a88('0x3'))(_0x0a88('0x4')),'fax':require(_0x0a88('0x3'))(_0x0a88('0x5')),'sms':require(_0x0a88('0x3'))('sms-interactions'),'chat':require(_0x0a88('0x3'))('chat-interactions'),'whatsapp':require(_0x0a88('0x3'))(_0x0a88('0x6'))};function getAccountFK(_0x36a7e0){return _[_0x0a88('0x7')](_0x36a7e0)+(_0x36a7e0===_0x0a88('0x8')?_0x0a88('0x9'):_0x0a88('0xa'))+'Id';}function getInteractionFK(_0x162d59){return _['capitalize'](_0x162d59)+_0x0a88('0xb');}function getInteractionId(_0x39dd67,_0x2f8305,_0x51650d){if(_0x39dd67&&_0x39dd67[_[_0x0a88('0xc')](_0x51650d)+_0x0a88('0xb')]){return _0x39dd67[_[_0x0a88('0xc')](_0x51650d)+_0x0a88('0xb')];}else if(_0x39dd67&&_0x39dd67['id']){return _0x39dd67['id'];}else if(_0x2f8305&&_0x2f8305['id']){return _0x2f8305['id'];}else{return _0x0a88('0xd');}}function getInteractionsTables(_0x58a3c1){return{'accounts':_0x58a3c1+'_'+(_0x58a3c1===_0x0a88('0x8')?_0x0a88('0xe'):_0x0a88('0xf')),'interactions':_0x58a3c1+_0x0a88('0x10'),'interactionsTags':_0x58a3c1+_0x0a88('0x11'),'messages':_0x58a3c1+'_messages','userInteractions':_0x0a88('0x12')+_0x58a3c1+_0x0a88('0x10')};}function getSelectedTags(_0x513abf){var _0x2359b5=[];if(_0x513abf){_0x2359b5=Array[_0x0a88('0x13')](_0x513abf)?_0x513abf:[_0x513abf];}return _0x2359b5;}function log(_0x5e362e,_0x7ba555,_0x598df0,_0x5e2a55,_0x309edb,_0x1e675f){loggers[_0x309edb['toLowerCase']()][_0x5e362e](_0x0a88('0x14'),_0x1e675f['toUpperCase'](),_0x7ba555?_0x7ba555['id']:null,_0x7ba555?_0x7ba555[_0x0a88('0x15')]:null,_0x7ba555?_0x7ba555[_0x0a88('0x16')]:null,getInteractionId(_0x598df0,_0x5e2a55,_0x309edb),_0x598df0?JSON['stringify'](_0x598df0):_0x0a88('0x17'));}function updateUser(_0x5e104c,_0x3d8039,_0x13060f,_0x31fce0,_0x2f4dc0){db[_['upperFirst'](_0x31fce0)+_0x0a88('0x18')][_0x0a88('0x19')]({'where':{'id':getInteractionId(_0x3d8039,_0x13060f,_0x31fce0)}})[_0x0a88('0x1a')](function(_0x24a1f0){if(_0x24a1f0){return _0x24a1f0['update']({'UserId':_0x5e104c?_0x5e104c['id']:null});}})[_0x0a88('0x1a')](function(_0x2f4ef9){if(_0x2f4ef9){log(_0x0a88('0x1b'),_0x5e104c,_0x3d8039,_0x13060f,_0x31fce0,_0x2f4dc0);}})[_0x0a88('0x1c')](function(){log(_0x0a88('0x1d'),_0x5e104c,_0x3d8039,_0x13060f,_0x31fce0,_0x2f4dc0);});}module[_0x0a88('0x1e')]={'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 eebb052..6153b36 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 _0xe069=['parse','hasOwnProperty','License','findOne','then','count','status','json','catch','users','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8'];(function(_0x5c1a19,_0x3f93d7){var _0x3aea0e=function(_0x43d348){while(--_0x43d348){_0x5c1a19['push'](_0x5c1a19['shift']());}};_0x3aea0e(++_0x3f93d7);}(_0xe069,0xa8));var _0x9e06=function(_0x12ceb6,_0x1f293d){_0x12ceb6=_0x12ceb6-0x0;var _0x31e5d0=_0xe069[_0x12ceb6];return _0x31e5d0;};'use strict';var crypto=require('crypto');var util=require(_0x9e06('0x0'));var compose=require(_0x9e06('0x1'));var db=require(_0x9e06('0x2'))['db'];var config=require(_0x9e06('0x3'));function getValueFromLicense(_0x4f8e78,_0x5ece97){if(_0x4f8e78&&_0x5ece97){if(_0x5ece97[_0x9e06('0x4')]&&_0x5ece97[_0x9e06('0x5')]){var _0x368e2f=_0x5ece97[_0x9e06('0x4')];var _0x1df51b=_0x5ece97['license'];var _0x59fd3c=_0x368e2f[_0x9e06('0x6')]('-')[0x4];var _0x440932=_0x368e2f[_0x9e06('0x6')]('-')[0x0];var _0x445803=crypto[_0x9e06('0x7')](_0x9e06('0x8'),util[_0x9e06('0x9')](_0x9e06('0xa'),_0x59fd3c,_0x368e2f,_0x440932));var _0x3391da=_0x445803[_0x9e06('0xb')](_0x1df51b,_0x9e06('0xc'),'utf8');_0x3391da+=_0x445803['final'](_0x9e06('0xd'));var _0xd8da2=JSON[_0x9e06('0xe')](_0x3391da);return _0xd8da2[_0x9e06('0xf')](_0x4f8e78)?_0xd8da2[_0x4f8e78]:null;}}return null;}function isLimit(_0x5c8426,_0x132479,_0xb9f1f5,_0x2930a6){var _0x333c0f=_0x132479;return compose()['use'](function(_0x25cfd9,_0x423ddb,_0x4e58b2){return db[_0x9e06('0x10')][_0x9e06('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x55b609){var _0x460490=getValueFromLicense(_0x5c8426,_0x55b609);return _0x460490?_0x460490:_0x333c0f;})[_0x9e06('0x12')](function(_0x561bab){_0x333c0f=_0x561bab;return _0xb9f1f5[_0x9e06('0x13')](_0x2930a6);})['then'](function(_0x14ea08){if(_0x14ea08>=_0x333c0f){return _0x423ddb[_0x9e06('0x14')](0x193)[_0x9e06('0x15')]({'message':util[_0x9e06('0x9')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5c8426)});}_0x4e58b2();})[_0x9e06('0x16')](function(_0x5ac667){_0x4e58b2(_0x5ac667);});});}function isUserLimit(){return isLimit(_0x9e06('0x17'),0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x9e06('0x18')}]}});}exports[_0x9e06('0x19')]=isUserLimit; \ No newline at end of file +var _0x0959=['users','User','admin','user','crypto','util','composable-middleware','data1','createDecipher','aes-256-ctr','%s:%s:%s','update','base64','utf8','final','parse','use','License','findOne','then','count','status','catch'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x0959,0xea));var _0x9095=function(_0x247134,_0x2a768a){_0x247134=_0x247134-0x0;var _0x5b1417=_0x0959[_0x247134];return _0x5b1417;};'use strict';var crypto=require(_0x9095('0x0'));var util=require(_0x9095('0x1'));var compose=require(_0x9095('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x54e00f,_0x37cf14){if(_0x54e00f&&_0x37cf14){if(_0x37cf14[_0x9095('0x3')]&&_0x37cf14['license']){var _0x3c3ae5=_0x37cf14[_0x9095('0x3')];var _0x4859d4=_0x37cf14['license'];var _0x1288ed=_0x3c3ae5['split']('-')[0x4];var _0x1f4d6a=_0x3c3ae5['split']('-')[0x0];var _0x1bcae1=crypto[_0x9095('0x4')](_0x9095('0x5'),util['format'](_0x9095('0x6'),_0x1288ed,_0x3c3ae5,_0x1f4d6a));var _0x456130=_0x1bcae1[_0x9095('0x7')](_0x4859d4,_0x9095('0x8'),_0x9095('0x9'));_0x456130+=_0x1bcae1[_0x9095('0xa')](_0x9095('0x9'));var _0x241b5e=JSON[_0x9095('0xb')](_0x456130);return _0x241b5e['hasOwnProperty'](_0x54e00f)?_0x241b5e[_0x54e00f]:null;}}return null;}function isLimit(_0x5d4750,_0x247e4c,_0x2d54e,_0x2d4b65){var _0x2ccc42=_0x247e4c;return compose()[_0x9095('0xc')](function(_0x5709f6,_0x407d70,_0x4c78b3){return db[_0x9095('0xd')][_0x9095('0xe')]({'where':{'id':0x1},'raw':!![]})[_0x9095('0xf')](function(_0x5b2d7d){var _0x3b226a=getValueFromLicense(_0x5d4750,_0x5b2d7d);return _0x3b226a?_0x3b226a:_0x2ccc42;})[_0x9095('0xf')](function(_0x40cd29){_0x2ccc42=_0x40cd29;return _0x2d54e[_0x9095('0x10')](_0x2d4b65);})[_0x9095('0xf')](function(_0x3fd8d6){if(_0x3fd8d6>=_0x2ccc42){return _0x407d70[_0x9095('0x11')](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5d4750)});}_0x4c78b3();})[_0x9095('0x12')](function(_0x284bd5){_0x4c78b3(_0x284bd5);});});}function isUserLimit(){return isLimit(_0x9095('0x13'),0x1,db[_0x9095('0x14')],{'where':{'$or':[{'role':_0x9095('0x15')},{'role':_0x9095('0x16')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 5ff410c..6615464 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 _0x1700=['split','length','slice','forEach','shift','match','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$lte','add','days','text','CAST(','castTo','field','$ne','$notIn','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$eq','<>\x20?','$endsWith','LIKE\x20?','$lt','$gt','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','$startsWith','pop','utcOffset','format','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]'];(function(_0x18a6a2,_0x1bf4a0){var _0x1cee6f=function(_0x520c3e){while(--_0x520c3e){_0x18a6a2['push'](_0x18a6a2['shift']());}};_0x1cee6f(++_0x1bf4a0);}(_0x1700,0x1de));var _0x0170=function(_0x16a95d,_0xdf3e5c){_0x16a95d=_0x16a95d-0x0;var _0x1fbddd=_0x1700[_0x16a95d];return _0x1fbddd;};'use strict';var _=require(_0x0170('0x0'));var moment=require(_0x0170('0x1'));exports['parseSearch']=function(_0x3ed521){var _0xd498b0={'conditions':[]};_0xd498b0[_0x0170('0x2')]=_[_0x0170('0x3')](_0x3ed521,_0x0170('0x4'))?'or':_0x0170('0x5');var _0x31be23=_0x3ed521[_0x0170('0x6')](_0x0170('0x7'),'')[_0x0170('0x6')]('[$or]','')[_0x0170('0x8')]('||');for(var _0x20fdaa=0x0;_0x20fdaa<_0x31be23[_0x0170('0x9')];_0x20fdaa++){var _0x21eb97=_0x31be23[_0x20fdaa]['split'](':=');var _0xac72f2=_0x21eb97[0x0];var _0x4c91bb=_0x21eb97[_0x0170('0xa')](0x1);_0x4c91bb[_0x0170('0xb')](function(_0x3c43c8){var _0x334fd4=_0x3c43c8[_0x0170('0x8')]('[')[_0x0170('0xc')]();var _0x403773=_0x3c43c8[_0x0170('0xd')](/\[(.*?)\]/g);_0x403773[_0x0170('0xb')](function(_0x2d3fe4){var _0x532b15=_0x2d3fe4[_0x0170('0x8')]('[')['filter'](function(_0x3bef7a){return _0x3bef7a[_0x0170('0xe')](']')>-0x1;})[_0x0170('0xf')](function(_0x32fbc8){return _0x32fbc8[_0x0170('0x8')](']')[0x0];})[0x0];_0xd498b0[_0x0170('0x10')][_0x0170('0x11')]({'field':_0xac72f2,'operator':_0x334fd4,'value':_0x532b15});});});}return _0xd498b0;};exports[_0x0170('0x12')]=function(_0x3d6026,_0x496ab1,_0x1f6951){var _0xc758fe={};if(_0x496ab1===_0x0170('0x13')){if(_0x1f6951[_0x0170('0x14')]==='$eq'){_0x1f6951[_0x0170('0x14')]=_0x0170('0x15');_0x1f6951[_0x0170('0x16')]+=','+_0x1f6951[_0x0170('0x16')];}else if(_[_0x0170('0x17')](['$gt',_0x0170('0x18')],_0x1f6951['operator'])){_0x1f6951['value']=moment(_0x1f6951[_0x0170('0x16')])[_0x0170('0x19')](0x1,_0x0170('0x1a'))['format']('YYYY-MM-DD');}}if(_0x1f6951['castTo']){_0x496ab1=_0x1f6951['castTo'];_0xc758fe[_0x0170('0x1b')]=_0x0170('0x1c')+_0x3d6026+'.'+_0x1f6951['field']+'\x20AS\x20'+_0x1f6951[_0x0170('0x1d')]+')\x20'+parseOperator(_0x1f6951[_0x0170('0x14')]);}else{_0xc758fe[_0x0170('0x1b')]=_0x3d6026+'.'+_0x1f6951[_0x0170('0x1e')]+'\x20'+parseOperator(_0x1f6951[_0x0170('0x14')]);}if(_[_0x0170('0x17')]([_0x0170('0x1f'),_0x0170('0x20')],_0x1f6951[_0x0170('0x14')]))_0xc758fe[_0x0170('0x1b')]='('+_0xc758fe[_0x0170('0x1b')]+_0x0170('0x21')+_0x3d6026+'.'+_0x1f6951[_0x0170('0x1e')]+'\x20IS\x20NULL)';_0xc758fe[_0x0170('0x16')]=parseValue(_0x496ab1,_0x1f6951[_0x0170('0x14')],_0x1f6951['value']);return _0xc758fe;};function parseOperator(_0x40f58b){var _0x2cd043;switch(_0x40f58b){case _0x0170('0x22'):_0x2cd043=_0x0170('0x23');break;case _0x0170('0x20'):_0x2cd043=_0x0170('0x24');break;case _0x0170('0x25'):_0x2cd043='=\x20?';break;case _0x0170('0x1f'):_0x2cd043=_0x0170('0x26');break;case'$substring':case'$startsWith':case _0x0170('0x27'):_0x2cd043=_0x0170('0x28');break;case _0x0170('0x29'):_0x2cd043='<\x20?';break;case _0x0170('0x2a'):_0x2cd043='>\x20?';break;case'$lte':_0x2cd043='<=\x20?';break;case _0x0170('0x2b'):_0x2cd043=_0x0170('0x2c');break;case'$between':_0x2cd043=_0x0170('0x2d');break;}return _0x2cd043;}function parseValue(_0x2422bd,_0x2b2126,_0x40fbba){var _0x3c64c9={'start':undefined,'end':undefined};switch(_0x2b2126){case _0x0170('0x22'):case _0x0170('0x20'):_0x3c64c9[_0x0170('0x2e')]=_0x40fbba[_0x0170('0x8')](',');break;case _0x0170('0x2f'):_0x3c64c9[_0x0170('0x2e')]='%'+_0x40fbba+'%';break;case _0x0170('0x30'):_0x3c64c9['start']=_0x40fbba+'%';break;case'$endsWith':_0x3c64c9[_0x0170('0x2e')]='%'+_0x40fbba;break;case _0x0170('0x15'):var _0x33f90b=_0x40fbba['split'](',');var _0x40fbba=_0x33f90b[_0x0170('0xc')]();var _0x7bbc13=_0x33f90b[_0x0170('0x31')]();if(_0x2422bd==='DATE'){_0x40fbba=moment(_0x40fbba)[_0x0170('0x32')](0x0,!![])[_0x0170('0x33')]();_0x7bbc13=moment(_0x7bbc13)[_0x0170('0x32')](0x0,!![])[_0x0170('0x19')](0x17,'hours')[_0x0170('0x19')](0x3b,_0x0170('0x34'))[_0x0170('0x19')](0x3b,_0x0170('0x35'))[_0x0170('0x33')]();}_0x3c64c9={'start':_0x40fbba,'end':_0x7bbc13};break;default:_0x3c64c9['start']=_0x40fbba;break;}return _0x3c64c9;} \ No newline at end of file +var _0xfbb2=['days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$notIn','\x20OR\x20','$in','IN\x20?','$eq','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','$gt','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','[$and]','replace','length','slice','forEach','split','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$lte','add'];(function(_0x48f7cf,_0x4baa04){var _0xc201c0=function(_0x23ff34){while(--_0x23ff34){_0x48f7cf['push'](_0x48f7cf['shift']());}};_0xc201c0(++_0x4baa04);}(_0xfbb2,0x106));var _0x2fbb=function(_0x1ee5be,_0x5f46e3){_0x1ee5be=_0x1ee5be-0x0;var _0x177140=_0xfbb2[_0x1ee5be];return _0x177140;};'use strict';var _=require(_0x2fbb('0x0'));var moment=require(_0x2fbb('0x1'));exports[_0x2fbb('0x2')]=function(_0x3eb151){var _0x4f42ee={'conditions':[]};_0x4f42ee[_0x2fbb('0x3')]=_[_0x2fbb('0x4')](_0x3eb151,_0x2fbb('0x5'))?'or':_0x2fbb('0x6');var _0x5f2da7=_0x3eb151['replace'](_0x2fbb('0x7'),'')[_0x2fbb('0x8')](_0x2fbb('0x5'),'')['split']('||');for(var _0x24e4ee=0x0;_0x24e4ee<_0x5f2da7[_0x2fbb('0x9')];_0x24e4ee++){var _0x2a9a91=_0x5f2da7[_0x24e4ee]['split'](':=');var _0x5ac566=_0x2a9a91[0x0];var _0x15350f=_0x2a9a91[_0x2fbb('0xa')](0x1);_0x15350f[_0x2fbb('0xb')](function(_0x28be19){var _0x5f403b=_0x28be19[_0x2fbb('0xc')]('[')[_0x2fbb('0xd')]();var _0x354536=_0x28be19[_0x2fbb('0xe')](/\[(.*?)\]/g);_0x354536[_0x2fbb('0xb')](function(_0x5dee35){var _0x18d5e4=_0x5dee35['split']('[')[_0x2fbb('0xf')](function(_0x20ab7c){return _0x20ab7c[_0x2fbb('0x10')](']')>-0x1;})[_0x2fbb('0x11')](function(_0x5c0585){return _0x5c0585[_0x2fbb('0xc')](']')[0x0];})[0x0];_0x4f42ee[_0x2fbb('0x12')][_0x2fbb('0x13')]({'field':_0x5ac566,'operator':_0x5f403b,'value':_0x18d5e4});});});}return _0x4f42ee;};exports[_0x2fbb('0x14')]=function(_0x30c991,_0x52bacf,_0x466854){var _0x1b59b9={};if(_0x52bacf===_0x2fbb('0x15')){if(_0x466854['operator']==='$eq'){_0x466854[_0x2fbb('0x16')]=_0x2fbb('0x17');_0x466854[_0x2fbb('0x18')]+=','+_0x466854[_0x2fbb('0x18')];}else if(_[_0x2fbb('0x19')](['$gt',_0x2fbb('0x1a')],_0x466854[_0x2fbb('0x16')])){_0x466854[_0x2fbb('0x18')]=moment(_0x466854[_0x2fbb('0x18')])[_0x2fbb('0x1b')](0x1,_0x2fbb('0x1c'))[_0x2fbb('0x1d')](_0x2fbb('0x1e'));}}if(_0x466854[_0x2fbb('0x1f')]){_0x52bacf=_0x466854['castTo'];_0x1b59b9[_0x2fbb('0x20')]=_0x2fbb('0x21')+_0x30c991+'.'+_0x466854[_0x2fbb('0x22')]+_0x2fbb('0x23')+_0x466854[_0x2fbb('0x1f')]+')\x20'+parseOperator(_0x466854[_0x2fbb('0x16')]);}else{_0x1b59b9['text']=_0x30c991+'.'+_0x466854[_0x2fbb('0x22')]+'\x20'+parseOperator(_0x466854[_0x2fbb('0x16')]);}if(_[_0x2fbb('0x19')](['$ne',_0x2fbb('0x24')],_0x466854[_0x2fbb('0x16')]))_0x1b59b9['text']='('+_0x1b59b9[_0x2fbb('0x20')]+_0x2fbb('0x25')+_0x30c991+'.'+_0x466854['field']+'\x20IS\x20NULL)';_0x1b59b9[_0x2fbb('0x18')]=parseValue(_0x52bacf,_0x466854[_0x2fbb('0x16')],_0x466854[_0x2fbb('0x18')]);return _0x1b59b9;};function parseOperator(_0x52d9d1){var _0x50be28;switch(_0x52d9d1){case _0x2fbb('0x26'):_0x50be28=_0x2fbb('0x27');break;case _0x2fbb('0x24'):_0x50be28='NOT\x20IN\x20?';break;case _0x2fbb('0x28'):_0x50be28=_0x2fbb('0x29');break;case'$ne':_0x50be28=_0x2fbb('0x2a');break;case _0x2fbb('0x2b'):case _0x2fbb('0x2c'):case _0x2fbb('0x2d'):_0x50be28=_0x2fbb('0x2e');break;case _0x2fbb('0x2f'):_0x50be28='<\x20?';break;case _0x2fbb('0x30'):_0x50be28='>\x20?';break;case'$lte':_0x50be28=_0x2fbb('0x31');break;case _0x2fbb('0x32'):_0x50be28=_0x2fbb('0x33');break;case _0x2fbb('0x17'):_0x50be28='BETWEEN\x20?\x20AND\x20?';break;}return _0x50be28;}function parseValue(_0x30df31,_0x2fae8a,_0xe4d23c){var _0x58a5f8={'start':undefined,'end':undefined};switch(_0x2fae8a){case'$in':case _0x2fbb('0x24'):_0x58a5f8[_0x2fbb('0x34')]=_0xe4d23c['split'](',');break;case _0x2fbb('0x2b'):_0x58a5f8[_0x2fbb('0x34')]='%'+_0xe4d23c+'%';break;case _0x2fbb('0x2c'):_0x58a5f8[_0x2fbb('0x34')]=_0xe4d23c+'%';break;case'$endsWith':_0x58a5f8[_0x2fbb('0x34')]='%'+_0xe4d23c;break;case _0x2fbb('0x17'):var _0x5d0980=_0xe4d23c['split'](',');var _0xe4d23c=_0x5d0980['shift']();var _0x10d23d=_0x5d0980[_0x2fbb('0x35')]();if(_0x30df31===_0x2fbb('0x15')){_0xe4d23c=moment(_0xe4d23c)['utcOffset'](0x0,!![])['format']();_0x10d23d=moment(_0x10d23d)[_0x2fbb('0x36')](0x0,!![])[_0x2fbb('0x1b')](0x17,_0x2fbb('0x37'))['add'](0x3b,_0x2fbb('0x38'))[_0x2fbb('0x1b')](0x3b,_0x2fbb('0x39'))[_0x2fbb('0x1d')]();}_0x58a5f8={'start':_0xe4d23c,'end':_0x10d23d};break;default:_0x58a5f8['start']=_0xe4d23c;break;}return _0x58a5f8;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c394dad..da3a3c0 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 _0x774e=['utc','$lte','subtract','uniqueid','isArray','split','offset','sort','map','indexOf','cast','priority','unsigned','substr','DESC','col','ASC','omit','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','\x22{EXPR}\x22','{EXPR}','forEach','push','getOptions','$id','query','model','name','intersection','attributes','fields','length','limit','order','where','pick','filter','object','columns','value','merge','VIRTUAL','lower','lodash','sequelize','moment','parse','keys','includes','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD'];(function(_0xc0a6d,_0x4e626e){var _0xdb4f25=function(_0x127988){while(--_0x127988){_0xc0a6d['push'](_0xc0a6d['shift']());}};_0xdb4f25(++_0x4e626e);}(_0x774e,0x130));var _0xe774=function(_0x38b254,_0x6d7ed6){_0x38b254=_0x38b254-0x0;var _0x547c7c=_0x774e[_0x38b254];return _0x547c7c;};'use strict';var _=require(_0xe774('0x0'));var sequelize=require(_0xe774('0x1'));var moment=require(_0xe774('0x2'));var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x45ea88){var _0xcc2593=['ne'];try{var _0x5a8387=JSON[_0xe774('0x3')](_0x45ea88);var _0xe3eb30=Object[_0xe774('0x4')](_0x5a8387)[0x0];return _0xcc2593[_0xe774('0x5')](_0xe3eb30);}catch(_0x59e80b){return![];}}function getOperatorValue(_0x59ff0b){var _0x35ffe4=JSON[_0xe774('0x3')](_0x59ff0b);var _0x2fe0bc=Object[_0xe774('0x4')](_0x35ffe4)[0x0];var _0x52fcb9=_0x35ffe4[_0x2fe0bc];return{['$'+_0x2fe0bc]:_0x52fcb9};}exports['fields']=function(_0x2ab4c9){var _0x5a5d03=null;if(_0x2ab4c9){_0x5a5d03=_0x2ab4c9['split'](',');}return _0x5a5d03;};exports[_0xe774('0x6')]=function(_0x1f6c49,_0x834578){var _0x507eb5={};if(!_[_0xe774('0x7')](_0x1f6c49)){_[_0xe774('0x8')](_0x1f6c49,function(_0x2989c7,_0x53d1bd){try{if(_0x834578){var _0x13e208=_[_0xe774('0x9')](_0x834578,{'name':_0x53d1bd})||{};if(hasSequelizeOperator(_0x2989c7)){_0x507eb5[_0x53d1bd]=getOperatorValue(_0x2989c7);}else if(_0x13e208[_0xe774('0xa')]===_0xe774('0xb')&&_[_0xe774('0xc')](_0x2989c7)){var _0x48e4a2=JSON[_0xe774('0x3')](_0x2989c7);var _0x7ad6f5={'$gte':moment(moment(_0x48e4a2[_0xe774('0xd')])[_0xe774('0xe')](_0xe774('0xf')))[_0xe774('0x10')]()[_0xe774('0xe')](),'$lte':moment(moment(_0x48e4a2[_0xe774('0x11')])[_0xe774('0xe')]('YYYY-MM-DD'))[_0xe774('0x10')]()[_0xe774('0x12')](0x1,'s')[_0xe774('0xe')]()};_0x507eb5[_0x53d1bd]=_0x7ad6f5;}else if(_0x13e208['name']===_0xe774('0x13')){_0x507eb5[_0x53d1bd]=_0x2989c7;}else{_0x507eb5[_0x53d1bd]=_[_0xe774('0x14')](_0x2989c7)?_0x2989c7:JSON['parse'](_0x2989c7);}}else{_0x507eb5[_0x53d1bd]=_[_0xe774('0x14')](_0x2989c7)?_0x2989c7:JSON[_0xe774('0x3')](_0x2989c7);}}catch(_0xf72201){_0x507eb5[_0x53d1bd]=_0x2989c7[_0xe774('0x15')](',');}});}return _0x507eb5;};exports['limit']=function(_0x55337b){_0x55337b=parseInt(_0x55337b,0xa);if(!_0x55337b||_0x55337b<0x0){_0x55337b=LIMIT_VALUE;}return _0x55337b;};exports[_0xe774('0x16')]=function(_0x366768){_0x366768=parseInt(_0x366768,0xa);if(!_0x366768||_0x366768<0x0){_0x366768=0x0;}return _0x366768;};exports[_0xe774('0x17')]=function(_0x22008b){var _0x566a00,_0x505dc9=null;if(_0x22008b){_0x566a00=_0x22008b[_0xe774('0x15')](',');_0x505dc9=_[_0xe774('0x18')](_0x566a00,function(_0x3dee87){if(_0x3dee87[_0xe774('0x19')]('-')===0x0){return[_0x3dee87==='priority'?sequelize[_0xe774('0x1a')](sequelize['col'](_0xe774('0x1b')),_0xe774('0x1c')):_0x3dee87[_0xe774('0x1d')](0x1),_0xe774('0x1e')];}else{return[_0x3dee87===_0xe774('0x1b')?sequelize[_0xe774('0x1a')](sequelize[_0xe774('0x1f')](_0xe774('0x1b')),_0xe774('0x1c')):_0x3dee87,_0xe774('0x20')];}});}return _0x505dc9;};exports[_0xe774('0x21')]=function(_0x52c43f,_0x1f5b81){if(_['isEmpty'](_0x52c43f)){return _0x52c43f;}if(_['isArray'](_0x52c43f)){for(var _0x8561bf=0x0;_0x8561bf<_0x52c43f['length'];_0x8561bf+=0x1){_0x52c43f[_0x8561bf]=this['omit'](_0x52c43f[_0x8561bf],_0x1f5b81);}return _0x52c43f;}if(!_[_0xe774('0x22')](_0x52c43f)){return _0x52c43f;}if(_['isString'](_0x1f5b81)){_0x1f5b81=[_0x1f5b81];}if(!_[_0xe774('0x14')](_0x1f5b81)){return _0x52c43f;}for(var _0x418c4d=0x0;_0x418c4d<_0x1f5b81['length'];_0x418c4d+=0x1){_[_0xe774('0x23')](_0x52c43f,_0x1f5b81[_0x418c4d]);}for(var _0x4ce11d in _0x52c43f){if(_0x52c43f[_0xe774('0x24')](_0x4ce11d)){_0x52c43f[_0x4ce11d]=this[_0xe774('0x21')](_0x52c43f[_0x4ce11d],_0x1f5b81);}}return _0x52c43f;};exports[_0xe774('0x25')]=function(_0x35de3a){return _0x35de3a[_0xe774('0x26')](RegExp(_0xe774('0x27')))?!![]:![];};exports['isEmail']=function(_0x3365c4){return _0x3365c4[_0xe774('0x26')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x543ffc,_0x481ab3){var _0x2cd8a1=[];var _0x5f0ae5=/[ `!@#$%^&*()_\-?~]/;var _0x1fb455=_0x481ab3?_0xe774('0x28'):_0xe774('0x29');_0x543ffc[_0xe774('0x15')](/[ ,]+/)[_0xe774('0x2a')](function(_0x5a9858){_0x5a9858=_0x5a9858['replace'](/([^:]")"+/g,'$1');_0x5a9858='+'+_0x5a9858+'*';var _0x3b55bf=_0x5a9858[_0xe774('0x26')](_0x5f0ae5);if(_0x3b55bf){_0x5a9858='\x22'+_0x5a9858+'\x22';}_0x2cd8a1[_0xe774('0x2b')](_0x5a9858);});_0x1fb455=_0x1fb455['replace'](_0xe774('0x29'),_0x2cd8a1['join']('\x20'));return _0x1fb455;};exports[_0xe774('0x2c')]=function(_0x3a3665,_0x5ebfe8,_0x12c532){var _0x135d55={},_0x487080={};if(_0x5ebfe8['query'][_0xe774('0x2d')]){_0x5ebfe8[_0xe774('0x2e')]['id']=_0x5ebfe8['query'][_0xe774('0x2d')];delete _0x5ebfe8[_0xe774('0x2e')][_0xe774('0x2d')];}_0x135d55[_0xe774('0x2f')]=_[_0xe774('0x18')](_0x3a3665,_0xe774('0x30'));_0x135d55['query']=_[_0xe774('0x4')](_0x5ebfe8[_0xe774('0x2e')]);_0x135d55[_0xe774('0x6')]=_[_0xe774('0x31')](_0x135d55[_0xe774('0x2f')],_0x135d55[_0xe774('0x2e')]);_0x487080[_0xe774('0x32')]=_['intersection'](_0x135d55['model'],this[_0xe774('0x33')](_0x5ebfe8['query'][_0xe774('0x33')]));_0x487080['attributes']=_0x487080['attributes'][_0xe774('0x34')]?_0x487080[_0xe774('0x32')]:_0x135d55[_0xe774('0x2f')];if(!_0x5ebfe8[_0xe774('0x2e')][_0xe774('0x24')]('nolimit')){_0x487080[_0xe774('0x35')]=this['limit'](_0x5ebfe8[_0xe774('0x2e')]['limit']);_0x487080[_0xe774('0x16')]=this[_0xe774('0x16')](_0x5ebfe8[_0xe774('0x2e')]['offset']);}_0x487080[_0xe774('0x36')]=this[_0xe774('0x17')](_0x5ebfe8[_0xe774('0x2e')][_0xe774('0x17')]);_0x487080[_0xe774('0x37')]=this[_0xe774('0x6')](_[_0xe774('0x38')](_0x5ebfe8[_0xe774('0x2e')],_0x135d55[_0xe774('0x6')]),_0x3a3665);if(_0x5ebfe8[_0xe774('0x2e')][_0xe774('0x39')]){var _0x1c913c=_0x3a3665;var _0x6cb799=_0x5ebfe8[_0xe774('0x2e')][_0xe774('0x39')];if(typeof _0x6cb799===_0xe774('0x3a')){_0x1c913c=_[_0xe774('0x39')](_0x3a3665,function(_0x35b246){return _[_0xe774('0x5')](_0x6cb799[_0xe774('0x3b')],_0x35b246[_0xe774('0x30')]);});_0x6cb799=_0x6cb799[_0xe774('0x3c')];}_0x487080[_0xe774('0x37')]=_[_0xe774('0x3d')](_0x487080[_0xe774('0x37')],{'$or':_[_0xe774('0x18')](_0x1c913c,function(_0x2af30b){if(_0x2af30b[_0xe774('0xa')]!==_0xe774('0x3e')){if(_0x12c532){return sequelize[_0xe774('0x37')](sequelize['fn'](_0xe774('0x3f'),sequelize[_0xe774('0x1f')](_0x2af30b[_0xe774('0x30')])),{'$like':sequelize['fn'](_0xe774('0x3f'),'%'+_0x5ebfe8[_0xe774('0x2e')]['filter']+'%')});}else{var _0x5f542d={};_0x5f542d[_0x2af30b[_0xe774('0x30')]]={'$like':'%'+_0x5ebfe8[_0xe774('0x2e')][_0xe774('0x39')]+'%'};return _0x5f542d;}}})});}_0x487080=_[_0xe774('0x3d')]({},_0x487080,_0x5ebfe8['options']);return _0x487080;}; \ No newline at end of file +var _0x0de6=['nolimit','order','where','pick','object','value','merge','VIRTUAL','lower','filter','options','lodash','sequelize','parse','keys','includes','fields','filters','forOwn','find','type','DATE','isPlainObject','$gte','YYYY-MM-DD','format','utc','isArray','split','limit','offset','sort','map','priority','cast','col','unsigned','substr','DESC','ASC','length','omit','unset','hasOwnProperty','match','^[+]?[0-9]*$','getFullTextValue','{EXPR}','forEach','replace','push','join','getOptions','query','$id','model','name','intersection','attributes'];(function(_0x4d1aa6,_0x1e9544){var _0x393c7a=function(_0x5873dd){while(--_0x5873dd){_0x4d1aa6['push'](_0x4d1aa6['shift']());}};_0x393c7a(++_0x1e9544);}(_0x0de6,0x1a8));var _0x60de=function(_0x342303,_0x13e1a9){_0x342303=_0x342303-0x0;var _0x5d2bf2=_0x0de6[_0x342303];return _0x5d2bf2;};'use strict';var _=require(_0x60de('0x0'));var sequelize=require(_0x60de('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xe7c2c5){var _0x208e92=['ne'];try{var _0x732ab6=JSON[_0x60de('0x2')](_0xe7c2c5);var _0x26afac=Object[_0x60de('0x3')](_0x732ab6)[0x0];return _0x208e92[_0x60de('0x4')](_0x26afac);}catch(_0x2dbb39){return![];}}function getOperatorValue(_0x3698ad){var _0x5edac2=JSON[_0x60de('0x2')](_0x3698ad);var _0x1b0fb2=Object['keys'](_0x5edac2)[0x0];var _0x331b2f=_0x5edac2[_0x1b0fb2];return{['$'+_0x1b0fb2]:_0x331b2f};}exports[_0x60de('0x5')]=function(_0x10eba3){var _0x5238e8=null;if(_0x10eba3){_0x5238e8=_0x10eba3['split'](',');}return _0x5238e8;};exports[_0x60de('0x6')]=function(_0x45a389,_0x2c4dbb){var _0x5e2501={};if(!_['isEmpty'](_0x45a389)){_[_0x60de('0x7')](_0x45a389,function(_0x1d7dcd,_0x145bc1){try{if(_0x2c4dbb){var _0x12a064=_[_0x60de('0x8')](_0x2c4dbb,{'name':_0x145bc1})||{};if(hasSequelizeOperator(_0x1d7dcd)){_0x5e2501[_0x145bc1]=getOperatorValue(_0x1d7dcd);}else if(_0x12a064[_0x60de('0x9')]===_0x60de('0xa')&&_[_0x60de('0xb')](_0x1d7dcd)){var _0x547424=JSON[_0x60de('0x2')](_0x1d7dcd);var _0x211960={'$gte':moment(moment(_0x547424[_0x60de('0xc')])['format'](_0x60de('0xd')))['utc']()[_0x60de('0xe')](),'$lte':moment(moment(_0x547424['$lte'])['format'](_0x60de('0xd')))[_0x60de('0xf')]()['subtract'](0x1,'s')[_0x60de('0xe')]()};_0x5e2501[_0x145bc1]=_0x211960;}else if(_0x12a064['name']==='uniqueid'){_0x5e2501[_0x145bc1]=_0x1d7dcd;}else{_0x5e2501[_0x145bc1]=_[_0x60de('0x10')](_0x1d7dcd)?_0x1d7dcd:JSON[_0x60de('0x2')](_0x1d7dcd);}}else{_0x5e2501[_0x145bc1]=_['isArray'](_0x1d7dcd)?_0x1d7dcd:JSON[_0x60de('0x2')](_0x1d7dcd);}}catch(_0x53490b){_0x5e2501[_0x145bc1]=_0x1d7dcd[_0x60de('0x11')](',');}});}return _0x5e2501;};exports[_0x60de('0x12')]=function(_0x5a3c5c){_0x5a3c5c=parseInt(_0x5a3c5c,0xa);if(!_0x5a3c5c||_0x5a3c5c<0x0){_0x5a3c5c=LIMIT_VALUE;}return _0x5a3c5c;};exports[_0x60de('0x13')]=function(_0x281852){_0x281852=parseInt(_0x281852,0xa);if(!_0x281852||_0x281852<0x0){_0x281852=0x0;}return _0x281852;};exports[_0x60de('0x14')]=function(_0x5daf05){var _0xbcc328,_0x24e647=null;if(_0x5daf05){_0xbcc328=_0x5daf05[_0x60de('0x11')](',');_0x24e647=_[_0x60de('0x15')](_0xbcc328,function(_0x4e155e){if(_0x4e155e['indexOf']('-')===0x0){return[_0x4e155e===_0x60de('0x16')?sequelize[_0x60de('0x17')](sequelize[_0x60de('0x18')](_0x60de('0x16')),_0x60de('0x19')):_0x4e155e[_0x60de('0x1a')](0x1),_0x60de('0x1b')];}else{return[_0x4e155e===_0x60de('0x16')?sequelize[_0x60de('0x17')](sequelize[_0x60de('0x18')](_0x60de('0x16')),_0x60de('0x19')):_0x4e155e,_0x60de('0x1c')];}});}return _0x24e647;};exports['omit']=function(_0x567560,_0x350b37){if(_['isEmpty'](_0x567560)){return _0x567560;}if(_[_0x60de('0x10')](_0x567560)){for(var _0x2b914e=0x0;_0x2b914e<_0x567560[_0x60de('0x1d')];_0x2b914e+=0x1){_0x567560[_0x2b914e]=this[_0x60de('0x1e')](_0x567560[_0x2b914e],_0x350b37);}return _0x567560;}if(!_['isObject'](_0x567560)){return _0x567560;}if(_['isString'](_0x350b37)){_0x350b37=[_0x350b37];}if(!_[_0x60de('0x10')](_0x350b37)){return _0x567560;}for(var _0x1722e6=0x0;_0x1722e6<_0x350b37[_0x60de('0x1d')];_0x1722e6+=0x1){_[_0x60de('0x1f')](_0x567560,_0x350b37[_0x1722e6]);}for(var _0x3da3b8 in _0x567560){if(_0x567560[_0x60de('0x20')](_0x3da3b8)){_0x567560[_0x3da3b8]=this[_0x60de('0x1e')](_0x567560[_0x3da3b8],_0x350b37);}}return _0x567560;};exports['isNumeric']=function(_0x363446){return _0x363446[_0x60de('0x21')](RegExp(_0x60de('0x22')))?!![]:![];};exports['isEmail']=function(_0x410499){return _0x410499[_0x60de('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0x60de('0x23')]=function(_0x5a24e2,_0x386b39){var _0x13e0c6=[];var _0x32b21f=/[ `!@#$%^&*()_\-?~]/;var _0x4245ca=_0x386b39?'\x22{EXPR}\x22':_0x60de('0x24');_0x5a24e2[_0x60de('0x11')](/[ ,]+/)[_0x60de('0x25')](function(_0x635e44){_0x635e44=_0x635e44[_0x60de('0x26')](/([^:]")"+/g,'$1');_0x635e44='+'+_0x635e44+'*';var _0x53ab47=_0x635e44['match'](_0x32b21f);if(_0x53ab47){_0x635e44='\x22'+_0x635e44+'\x22';}_0x13e0c6[_0x60de('0x27')](_0x635e44);});_0x4245ca=_0x4245ca[_0x60de('0x26')](_0x60de('0x24'),_0x13e0c6[_0x60de('0x28')]('\x20'));return _0x4245ca;};exports[_0x60de('0x29')]=function(_0xce15af,_0x31f85b,_0x4fc1aa){var _0x215c54={},_0xcde894={};if(_0x31f85b[_0x60de('0x2a')][_0x60de('0x2b')]){_0x31f85b[_0x60de('0x2a')]['id']=_0x31f85b[_0x60de('0x2a')][_0x60de('0x2b')];delete _0x31f85b[_0x60de('0x2a')][_0x60de('0x2b')];}_0x215c54[_0x60de('0x2c')]=_[_0x60de('0x15')](_0xce15af,_0x60de('0x2d'));_0x215c54['query']=_['keys'](_0x31f85b['query']);_0x215c54['filters']=_[_0x60de('0x2e')](_0x215c54[_0x60de('0x2c')],_0x215c54[_0x60de('0x2a')]);_0xcde894['attributes']=_[_0x60de('0x2e')](_0x215c54[_0x60de('0x2c')],this[_0x60de('0x5')](_0x31f85b[_0x60de('0x2a')]['fields']));_0xcde894['attributes']=_0xcde894[_0x60de('0x2f')]['length']?_0xcde894[_0x60de('0x2f')]:_0x215c54['model'];if(!_0x31f85b[_0x60de('0x2a')][_0x60de('0x20')](_0x60de('0x30'))){_0xcde894[_0x60de('0x12')]=this['limit'](_0x31f85b[_0x60de('0x2a')]['limit']);_0xcde894[_0x60de('0x13')]=this[_0x60de('0x13')](_0x31f85b[_0x60de('0x2a')][_0x60de('0x13')]);}_0xcde894[_0x60de('0x31')]=this['sort'](_0x31f85b[_0x60de('0x2a')]['sort']);_0xcde894[_0x60de('0x32')]=this[_0x60de('0x6')](_[_0x60de('0x33')](_0x31f85b[_0x60de('0x2a')],_0x215c54[_0x60de('0x6')]),_0xce15af);if(_0x31f85b[_0x60de('0x2a')]['filter']){var _0x57fa71=_0xce15af;var _0x109786=_0x31f85b[_0x60de('0x2a')]['filter'];if(typeof _0x109786===_0x60de('0x34')){_0x57fa71=_['filter'](_0xce15af,function(_0x558146){return _[_0x60de('0x4')](_0x109786['columns'],_0x558146['name']);});_0x109786=_0x109786[_0x60de('0x35')];}_0xcde894[_0x60de('0x32')]=_[_0x60de('0x36')](_0xcde894[_0x60de('0x32')],{'$or':_['map'](_0x57fa71,function(_0x189a6b){if(_0x189a6b[_0x60de('0x9')]!==_0x60de('0x37')){if(_0x4fc1aa){return sequelize[_0x60de('0x32')](sequelize['fn']('lower',sequelize[_0x60de('0x18')](_0x189a6b[_0x60de('0x2d')])),{'$like':sequelize['fn'](_0x60de('0x38'),'%'+_0x31f85b['query'][_0x60de('0x39')]+'%')});}else{var _0x2f46d2={};_0x2f46d2[_0x189a6b[_0x60de('0x2d')]]={'$like':'%'+_0x31f85b[_0x60de('0x2a')]['filter']+'%'};return _0x2f46d2;}}})});}_0xcde894=_[_0x60de('0x36')]({},_0xcde894,_0x31f85b[_0x60de('0x3a')]);return _0xcde894;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 66b1119..720257b 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 _0xc275=['openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','http','chatPause','mailPause','smsPause','voicePause','whatsappPause','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','faxStatus','openchannelStatus','smsStatus','whatsappStatus','request','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','unknown','getAgentStatus','isArray','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','busy','getAgentIdsByStatus','resolve','User','findAll','fullname','openchannelPause','find','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','address','faxPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime'];(function(_0x374627,_0x118f6c){var _0x29c435=function(_0x37ef85){while(--_0x37ef85){_0x374627['push'](_0x374627['shift']());}};_0x29c435(++_0x118f6c);}(_0xc275,0x6f));var _0x5c27=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xc275[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x5c27('0x0'));var jayson=require(_0x5c27('0x1'));var db=require(_0x5c27('0x2'))['db'];var amiClient=jayson[_0x5c27('0x3')][_0x5c27('0x4')]({'port':0x232a});var routingClient=jayson[_0x5c27('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x4dee55,_0x8840e3){var _0x2a6a48=[_0x4dee55[_0x5c27('0x5')],_0x4dee55['faxPause'],_0x4dee55[_0x5c27('0x6')],_0x4dee55['openchannelPause'],_0x4dee55[_0x5c27('0x7')],_0x4dee55[_0x5c27('0x8')],_0x4dee55[_0x5c27('0x9')]];if(!_0x8840e3)return _['every'](_0x2a6a48);var _0x431e16=_[_0x5c27('0xa')](_0x2a6a48);return _0x431e16[_0x5c27('0xb')]>0x0&&_0x431e16['length']<_0x2a6a48['length']?!![]:![];}function isIdle(_0x37d11b){return _0x37d11b===_0x5c27('0xc')||_0x37d11b==='unknown'||_0x37d11b===_0x5c27('0xd')||_0x37d11b===_0x5c27('0xe')||_[_0x5c27('0xf')](_0x37d11b);}function isAgentIdle(_0xde4c82){if(_0xde4c82[_0x5c27('0x10')]!=='idle'&&_0xde4c82[_0x5c27('0x8')]){_0xde4c82[_0x5c27('0x10')]=_0x5c27('0x11');return![];}return _[_0x5c27('0x12')]([_0xde4c82[_0x5c27('0x13')],_0xde4c82[_0x5c27('0x14')],_0xde4c82['mailStatus'],_0xde4c82[_0x5c27('0x15')],_0xde4c82[_0x5c27('0x16')],_0xde4c82[_0x5c27('0x10')],_0xde4c82[_0x5c27('0x17')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x5c27('0x18')]('Agents',{})[_0x5c27('0x19')](function(_0x25ebe9){if(_0x25ebe9['error']){throw new Error(_0x5c27('0x1a'));}var _0x3e39f4=_0x25ebe9[_0x5c27('0x1b')];return routingClient['request'](_0x5c27('0x1c'),{})[_0x5c27('0x19')](function(_0x1fa526){if(_0x1fa526[_0x5c27('0x1d')]){throw new Error(_0x5c27('0x1e'));}var _0x159d54=_0x1fa526[_0x5c27('0x1b')];return _[_0x5c27('0x1f')]({},_0x3e39f4,_0x159d54);});})[_0x5c27('0x20')](function(_0x5c0c97){throw _0x5c0c97;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x55bbe8){var _0x50866e=_0x5c27('0x21');if(isAgentPaused(_0x55bbe8))_0x50866e=_0x5c27('0x11');else if(isAgentPaused(_0x55bbe8,!![]))_0x50866e='*pause';else if(isAgentIdle(_0x55bbe8))_0x50866e=_0x5c27('0xc');else _0x50866e='busy';return _0x50866e;}exports[_0x5c27('0x22')]=getAgentStatus;function getAgentIdsByQueues(_0x4a131a,_0x1b2551){var _0x35bb3c=_[_0x5c27('0x23')](_0x4a131a)?_0x4a131a:[_0x4a131a];var _0x5c1b08=_['startCase'](_0x1b2551)+'Queue';var _0x2a5979=_[_0x5c27('0x24')](_0x35bb3c,function(_0x4b6df2){return db[_0x5c1b08][_0x5c27('0x25')]({'where':{'id':_0x4b6df2}})[_0x5c27('0x19')](function(_0x58522c){if(!_0x58522c)return[];return _0x58522c[_0x5c27('0x26')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5c27('0x27')](_0x2a5979)[_0x5c27('0x19')](function(_0x5da9ce){var _0x48a1a0=_(_0x5da9ce)[_0x5c27('0x28')]()[_0x5c27('0x24')]('id')[_0x5c27('0x29')]()[_0x5c27('0x2a')]();return _0x48a1a0;});}exports[_0x5c27('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x73683f,_0x22558f,_0x30ea71){try{if(_0x22558f['length']>0x0){_0x73683f=_0x73683f['filter'](function(_0x5aef24){return _0x22558f[_0x5c27('0x2c')](_0x5aef24['id']);});}var _0x3d6e05=_0x73683f[_0x5c27('0xa')](function(_0x548673){var _0x2869fc=_0x5c27('0x2d');if(isAgentIdle(_0x548673)){_0x2869fc=_0x5c27('0xc');}return _0x2869fc===_0x30ea71;});return _[_0x5c27('0x24')](_0x3d6e05,'id');}catch(_0x3915af){throw _0x3915af;}}exports[_0x5c27('0x2e')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x59e540,_0x202cbe,_0x486dfa){return Promise[_0x5c27('0x2f')]()['then'](function(){if(_0x202cbe[_0x5c27('0xb')]>0x0){_0x59e540=_0x59e540['filter'](function(_0xdaea){return _0x202cbe[_0x5c27('0x2c')](_0xdaea['id']);});}return _0x59e540;})[_0x5c27('0x19')](function(){return db[_0x5c27('0x30')][_0x5c27('0x31')]({'attributes':['id','name',_0x5c27('0x32'),_0x5c27('0x5'),'faxPause',_0x5c27('0x6'),_0x5c27('0x33'),_0x5c27('0x7'),_0x5c27('0x8'),_0x5c27('0x9'),'pauseType'],'where':{'id':{'$in':_[_0x5c27('0x24')](_0x59e540,'id')}},'raw':!![]});})['then'](function(_0x53ac0b){return _0x53ac0b[_0x5c27('0x24')](function(_0x79846b){var _0x3086f7=_[_0x5c27('0x34')](_0x59e540,['id',_0x79846b['id']]);var _0x1cf24d=filterAgentAttributes(_0x3086f7);_['merge'](_0x79846b,_0x1cf24d);_0x79846b['globalStatus']=getAgentStatus(_0x79846b);return _0x79846b;});})[_0x5c27('0x19')](function(_0x360751){var _0x2c1b87=sortAgentsByStatus(_0x360751,_0x486dfa);return _[_0x5c27('0x24')](_0x2c1b87,'id');})[_0x5c27('0x20')](function(_0x42b64f){throw _0x42b64f;});}exports[_0x5c27('0x35')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x50b6b8){var _0x153397={'fields':[],'order':null};var _0x3a97aa=_0x50b6b8[_0x5c27('0x36')](',');_0x153397[_0x5c27('0x37')]=_[_0x5c27('0xa')](_0x3a97aa,function(_0x2d6f02){if(!_0x2d6f02['includes'](_0x5c27('0x38'))){return!![];}_0x153397[_0x5c27('0x39')]=_[_0x5c27('0x3a')](_0x2d6f02,'-')?'DESC':_0x5c27('0x3b');return![];});return _0x153397;}exports[_0x5c27('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x5766b3){if(_0x5766b3[_0x5c27('0x2c')](_0x5c27('0x32'))&&!_0x5766b3[_0x5c27('0x2c')](_0x5c27('0x3d'))){var _0x7c17a1=_0x5766b3[_0x5c27('0x3e')](0x0,_0x5766b3[_0x5c27('0x3f')](_0x5c27('0x32')));_0x5766b3+=','+_0x7c17a1+'internal';}return _0x5766b3;}exports[_0x5c27('0x40')]=validateSortParameter;function sortAgentsByStatus(_0x45e8b7,_0x312375){var _0x215f19=_0x45e8b7[_0x5c27('0x41')](function(_0x47d24c,_0x318cac){if(_0x47d24c[_0x5c27('0x38')]===_0x318cac[_0x5c27('0x38')]){if(_0x47d24c[_0x5c27('0x38')]===_0x5c27('0x11')){if(_0x312375===_0x5c27('0x42')){return(_0x47d24c[_0x5c27('0x43')]||'')<(_0x318cac['pauseType']||'')||_0x47d24c[_0x5c27('0x32')]['toLowerCase']()>_0x318cac[_0x5c27('0x32')][_0x5c27('0x44')]()?0x1:-0x1;}else{return(_0x47d24c[_0x5c27('0x43')]||'')<(_0x318cac['pauseType']||'')||_0x47d24c[_0x5c27('0x32')][_0x5c27('0x44')]()>_0x318cac['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x312375===_0x5c27('0x42')){return _0x47d24c[_0x5c27('0x32')]['toLowerCase']()<_0x318cac[_0x5c27('0x32')][_0x5c27('0x44')]()?0x1:-0x1;}else{return _0x47d24c[_0x5c27('0x32')][_0x5c27('0x44')]()<_0x318cac[_0x5c27('0x32')][_0x5c27('0x44')]()?-0x1:0x1;}}}else{if(_0x312375===_0x5c27('0x42')){return _0x47d24c[_0x5c27('0x38')]<_0x318cac[_0x5c27('0x38')]?0x1:-0x1;}else{return _0x47d24c[_0x5c27('0x38')]<_0x318cac[_0x5c27('0x38')]?-0x1:0x1;}}});return _0x215f19;}exports[_0x5c27('0x45')]=sortAgentsByStatus;function filterAgentAttributes(_0x59013f){var _0x13e516=['userpic',_0x5c27('0x46'),_0x5c27('0x47'),'lastPauseAt',_0x5c27('0x43'),_0x5c27('0x48'),_0x5c27('0x3d'),_0x5c27('0x49'),_0x5c27('0x5'),'openchannelPause',_0x5c27('0x6'),_0x5c27('0x7'),_0x5c27('0x9'),_0x5c27('0x4a'),_0x5c27('0x8'),_0x5c27('0x4b'),_0x5c27('0x4c'),_0x5c27('0x4d'),_0x5c27('0x4e'),_0x5c27('0x4f'),'faxCapacity',_0x5c27('0x50'),_0x5c27('0x51'),_0x5c27('0x52'),_0x5c27('0x53'),_0x5c27('0x54'),_0x5c27('0x55'),_0x5c27('0x13'),_0x5c27('0x15'),'mailStatus','smsStatus',_0x5c27('0x17'),'faxStatus',_0x5c27('0x10'),_0x5c27('0x56'),_0x5c27('0x57'),_0x5c27('0x58'),_0x5c27('0x59'),_0x5c27('0x5a'),_0x5c27('0x5b'),_0x5c27('0x5c'),'queue',_0x5c27('0x5d'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x5c27('0x5e'),_0x5c27('0x5f')];var _0x225afb=[_0x5c27('0x5'),_0x5c27('0x33'),'mailPause',_0x5c27('0x7'),_0x5c27('0x9'),'faxPause',_0x5c27('0x8'),_0x5c27('0x46')];var _0xda8e1e=_(_0x59013f)[_0x5c27('0x60')](_0x225afb)[_0x5c27('0x61')](_0x13e516)['value']();return _0xda8e1e;}exports[_0x5c27('0x62')]=filterAgentAttributes; \ No newline at end of file +var _0xa785=['mailPause','openchannelPause','voicePause','whatsappPause','every','filter','length','unknown','unavailable','ringing','isNil','idle','voiceStatus','pause','chatStatus','faxStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','catch','busy','getAgentStatus','isArray','startCase','map','findOne','getAgents','all','uniq','getAgentIdsByQueues','includes','getAgentIdsByStatus','findAll','fullname','pauseType','globalStatus','getSortedAgentsIdsByStatus','fields','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','openchannelCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','mailStatus','whatsappStatus','chatStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','lodash','client','http','chatPause','faxPause'];(function(_0x2b0d57,_0x262032){var _0x4b5484=function(_0x3d9ec4){while(--_0x3d9ec4){_0x2b0d57['push'](_0x2b0d57['shift']());}};_0x4b5484(++_0x262032);}(_0xa785,0x1ae));var _0x5a78=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xa785[_0x1fc122];return _0xa2cb13;};'use strict';var _=require(_0x5a78('0x0'));var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x5a78('0x1')][_0x5a78('0x2')]({'port':0x232a});var routingClient=jayson[_0x5a78('0x1')][_0x5a78('0x2')]({'port':0x232c});function isAgentPaused(_0x3bcf60,_0x7dff6d){var _0x5c5c80=[_0x3bcf60[_0x5a78('0x3')],_0x3bcf60[_0x5a78('0x4')],_0x3bcf60[_0x5a78('0x5')],_0x3bcf60[_0x5a78('0x6')],_0x3bcf60['smsPause'],_0x3bcf60[_0x5a78('0x7')],_0x3bcf60[_0x5a78('0x8')]];if(!_0x7dff6d)return _[_0x5a78('0x9')](_0x5c5c80);var _0x154937=_[_0x5a78('0xa')](_0x5c5c80);return _0x154937['length']>0x0&&_0x154937['length']<_0x5c5c80[_0x5a78('0xb')]?!![]:![];}function isIdle(_0x161dbb){return _0x161dbb==='idle'||_0x161dbb===_0x5a78('0xc')||_0x161dbb===_0x5a78('0xd')||_0x161dbb===_0x5a78('0xe')||_[_0x5a78('0xf')](_0x161dbb);}function isAgentIdle(_0x438f6b){if(_0x438f6b['voiceStatus']!==_0x5a78('0x10')&&_0x438f6b['voicePause']){_0x438f6b[_0x5a78('0x11')]=_0x5a78('0x12');return![];}return _[_0x5a78('0x9')]([_0x438f6b[_0x5a78('0x13')],_0x438f6b[_0x5a78('0x14')],_0x438f6b['mailStatus'],_0x438f6b[_0x5a78('0x15')],_0x438f6b[_0x5a78('0x16')],_0x438f6b[_0x5a78('0x11')],_0x438f6b['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x5a78('0x17')](_0x5a78('0x18'),{})[_0x5a78('0x19')](function(_0xb6e1e){if(_0xb6e1e[_0x5a78('0x1a')]){throw new Error(_0x5a78('0x1b'));}var _0x29c801=_0xb6e1e['result'];return routingClient[_0x5a78('0x17')](_0x5a78('0x18'),{})[_0x5a78('0x19')](function(_0x5cfe80){if(_0x5cfe80['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0xb5305a=_0x5cfe80[_0x5a78('0x1c')];return _[_0x5a78('0x1d')]({},_0x29c801,_0xb5305a);});})[_0x5a78('0x1e')](function(_0xbe8d7d){throw _0xbe8d7d;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x5545b2){var _0x418878=_0x5a78('0xc');if(isAgentPaused(_0x5545b2))_0x418878=_0x5a78('0x12');else if(isAgentPaused(_0x5545b2,!![]))_0x418878='*pause';else if(isAgentIdle(_0x5545b2))_0x418878='idle';else _0x418878=_0x5a78('0x1f');return _0x418878;}exports[_0x5a78('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x5a739d,_0x1b01d1){var _0x3169de=_[_0x5a78('0x21')](_0x5a739d)?_0x5a739d:[_0x5a739d];var _0x505c11=_[_0x5a78('0x22')](_0x1b01d1)+'Queue';var _0x301452=_[_0x5a78('0x23')](_0x3169de,function(_0x16dcaa){return db[_0x505c11][_0x5a78('0x24')]({'where':{'id':_0x16dcaa}})[_0x5a78('0x19')](function(_0x47b10e){if(!_0x47b10e)return[];return _0x47b10e[_0x5a78('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x5a78('0x26')](_0x301452)[_0x5a78('0x19')](function(_0x3f422c){var _0x395857=_(_0x3f422c)['flatten']()[_0x5a78('0x23')]('id')[_0x5a78('0x27')]()['value']();return _0x395857;});}exports[_0x5a78('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x774e86,_0x549dfb,_0x16e436){try{if(_0x549dfb[_0x5a78('0xb')]>0x0){_0x774e86=_0x774e86['filter'](function(_0x34416d){return _0x549dfb[_0x5a78('0x29')](_0x34416d['id']);});}var _0x31fd1a=_0x774e86[_0x5a78('0xa')](function(_0x422a0c){var _0x53bc44=_0x5a78('0x1f');if(isAgentIdle(_0x422a0c)){_0x53bc44=_0x5a78('0x10');}return _0x53bc44===_0x16e436;});return _[_0x5a78('0x23')](_0x31fd1a,'id');}catch(_0x3b3bd9){throw _0x3b3bd9;}}exports[_0x5a78('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5168a3,_0x49bc80,_0x575ba0){return Promise['resolve']()[_0x5a78('0x19')](function(){if(_0x49bc80[_0x5a78('0xb')]>0x0){_0x5168a3=_0x5168a3[_0x5a78('0xa')](function(_0x2454ba){return _0x49bc80[_0x5a78('0x29')](_0x2454ba['id']);});}return _0x5168a3;})[_0x5a78('0x19')](function(){return db['User'][_0x5a78('0x2b')]({'attributes':['id','name',_0x5a78('0x2c'),'chatPause','faxPause','mailPause',_0x5a78('0x6'),'smsPause',_0x5a78('0x7'),_0x5a78('0x8'),_0x5a78('0x2d')],'where':{'id':{'$in':_[_0x5a78('0x23')](_0x5168a3,'id')}},'raw':!![]});})['then'](function(_0x43a390){return _0x43a390[_0x5a78('0x23')](function(_0x4eb888){var _0xe748a6=_['find'](_0x5168a3,['id',_0x4eb888['id']]);var _0x952480=filterAgentAttributes(_0xe748a6);_[_0x5a78('0x1d')](_0x4eb888,_0x952480);_0x4eb888[_0x5a78('0x2e')]=getAgentStatus(_0x4eb888);return _0x4eb888;});})[_0x5a78('0x19')](function(_0x14ec84){var _0x20f357=sortAgentsByStatus(_0x14ec84,_0x575ba0);return _[_0x5a78('0x23')](_0x20f357,'id');})[_0x5a78('0x1e')](function(_0x2a0782){throw _0x2a0782;});}exports[_0x5a78('0x2f')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2302f7){var _0x3f0a48={'fields':[],'order':null};var _0x5a23e0=_0x2302f7['split'](',');_0x3f0a48[_0x5a78('0x30')]=_[_0x5a78('0xa')](_0x5a23e0,function(_0x223cd1){if(!_0x223cd1[_0x5a78('0x29')](_0x5a78('0x2e'))){return!![];}_0x3f0a48['order']=_[_0x5a78('0x31')](_0x223cd1,'-')?_0x5a78('0x32'):_0x5a78('0x33');return![];});return _0x3f0a48;}exports[_0x5a78('0x34')]=getUpdatedSortOptions;function validateSortParameter(_0x3a5139){if(_0x3a5139[_0x5a78('0x29')]('fullname')&&!_0x3a5139['includes'](_0x5a78('0x35'))){var _0x5e4a62=_0x3a5139[_0x5a78('0x36')](0x0,_0x3a5139[_0x5a78('0x37')]('fullname'));_0x3a5139+=','+_0x5e4a62+_0x5a78('0x35');}return _0x3a5139;}exports[_0x5a78('0x38')]=validateSortParameter;function sortAgentsByStatus(_0x14e2e3,_0x4e4ab1){var _0x3169a4=_0x14e2e3[_0x5a78('0x39')](function(_0x27a513,_0x2134d2){if(_0x27a513[_0x5a78('0x2e')]===_0x2134d2['globalStatus']){if(_0x27a513[_0x5a78('0x2e')]===_0x5a78('0x12')){if(_0x4e4ab1===_0x5a78('0x32')){return(_0x27a513['pauseType']||'')<(_0x2134d2[_0x5a78('0x2d')]||'')||_0x27a513['fullname'][_0x5a78('0x3a')]()>_0x2134d2['fullname'][_0x5a78('0x3a')]()?0x1:-0x1;}else{return(_0x27a513[_0x5a78('0x2d')]||'')<(_0x2134d2[_0x5a78('0x2d')]||'')||_0x27a513['fullname']['toLowerCase']()>_0x2134d2[_0x5a78('0x2c')][_0x5a78('0x3a')]()?-0x1:0x1;}}else{if(_0x4e4ab1===_0x5a78('0x32')){return _0x27a513['fullname']['toLowerCase']()<_0x2134d2[_0x5a78('0x2c')][_0x5a78('0x3a')]()?0x1:-0x1;}else{return _0x27a513[_0x5a78('0x2c')][_0x5a78('0x3a')]()<_0x2134d2[_0x5a78('0x2c')][_0x5a78('0x3a')]()?-0x1:0x1;}}}else{if(_0x4e4ab1===_0x5a78('0x32')){return _0x27a513['globalStatus']<_0x2134d2[_0x5a78('0x2e')]?0x1:-0x1;}else{return _0x27a513[_0x5a78('0x2e')]<_0x2134d2[_0x5a78('0x2e')]?-0x1:0x1;}}});return _0x3169a4;}exports[_0x5a78('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0x4a2e1a){var _0x10d9be=[_0x5a78('0x3c'),_0x5a78('0x3d'),_0x5a78('0x3e'),_0x5a78('0x3f'),_0x5a78('0x2d'),_0x5a78('0x3f'),_0x5a78('0x35'),'address',_0x5a78('0x3'),'openchannelPause','mailPause','smsPause',_0x5a78('0x8'),'faxPause',_0x5a78('0x7'),_0x5a78('0x40'),_0x5a78('0x41'),'mailCapacity','smsCapacity',_0x5a78('0x42'),_0x5a78('0x43'),_0x5a78('0x44'),'openchannelCurrentCapacity','mailCurrentCapacity',_0x5a78('0x45'),_0x5a78('0x46'),_0x5a78('0x47'),_0x5a78('0x13'),_0x5a78('0x15'),_0x5a78('0x48'),'smsStatus',_0x5a78('0x49'),_0x5a78('0x14'),_0x5a78('0x11'),_0x5a78('0x4a'),'openchannelStatusTime','mailStatusTime',_0x5a78('0x4b'),_0x5a78('0x4c'),_0x5a78('0x4d'),'voiceStatusTime','queue',_0x5a78('0x4e'),_0x5a78('0x4f'),_0x5a78('0x50'),_0x5a78('0x51'),_0x5a78('0x52')];var _0x1ce0a6=['chatPause',_0x5a78('0x6'),_0x5a78('0x5'),'smsPause','whatsappPause',_0x5a78('0x4'),_0x5a78('0x7'),_0x5a78('0x3d')];var _0x34e771=_(_0x4a2e1a)[_0x5a78('0x53')](_0x1ce0a6)[_0x5a78('0x54')](_0x10d9be)[_0x5a78('0x55')]();return _0x34e771;}exports[_0x5a78('0x56')]=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 493565e..b02a264 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 _0xbf23=['predictiveIntervalAvgTalktime','request','startCase','Queues','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','voice','inbound','concat','map','get','find','pick','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','pTalking','originated','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbf23,0x131));var _0x3bf2=function(_0x4be3f3,_0x20efd7){_0x4be3f3=_0x4be3f3-0x0;var _0x5278b3=_0xbf23[_0x4be3f3];return _0x5278b3;};'use strict';var _=require(_0x3bf2('0x0'));var jayson=require(_0x3bf2('0x1'));var util=require('util');var amiClient=jayson[_0x3bf2('0x2')][_0x3bf2('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x3bf2('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3bf2('0x4'),_0x3bf2('0x5'),_0x3bf2('0x6'),_0x3bf2('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x3bf2('0x8'),'inUse',_0x3bf2('0x9'),_0x3bf2('0xa'),_0x3bf2('0xb'),_0x3bf2('0xc'),'ringing',_0x3bf2('0xd'),_0x3bf2('0xe'),'unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3bf2('0xf'),_0x3bf2('0x10'),'message',_0x3bf2('0x11'),_0x3bf2('0x12'),_0x3bf2('0x13'),_0x3bf2('0x14'),_0x3bf2('0x15'),_0x3bf2('0x16'),'erlangCalls','erlangCallToSecond',_0x3bf2('0x17'),'erlangBusyFactor',_0x3bf2('0x18'),_0x3bf2('0x19'),_0x3bf2('0x1a'),_0x3bf2('0x1b'),'predictiveIntervalTotalCalls',_0x3bf2('0x1c'),_0x3bf2('0x1d'),'predictiveIntervalDroppedCallsCallersExit',_0x3bf2('0x1e'),_0x3bf2('0x1f')];function getRealtimeQueues(_0x270509,_0x58a4b6){var _0x31fbac=_0x58a4b6==='voice'?amiClient:routingClient;return _0x31fbac[_0x3bf2('0x20')](_[_0x3bf2('0x21')](_0x58a4b6)+_0x3bf2('0x22'),_0x270509)['then'](function(_0x3df871){if(_0x3df871[_0x3bf2('0x23')])throw new Error(util[_0x3bf2('0x24')](_0x3bf2('0x25'),_0x58a4b6));return _0x3df871[_0x3bf2('0x26')];})['catch'](function(_0x3fc7d1){throw _0x3fc7d1;});}exports[_0x3bf2('0x27')]=getRealtimeQueues;function initializeQueues(_0x1a546a,_0x560849,_0x10f771,_0x3dec52){var _0x3aa235=DEFAULT_QUEUE_ATTRIBUTES;if(_0x10f771===_0x3bf2('0x28')){if(_0x3dec52===_0x3bf2('0x29')){_0x3aa235=_0x3aa235[_0x3bf2('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3dec52==='outbound'){_0x3aa235=_0x3aa235[_0x3bf2('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1a546a[_0x3bf2('0x2b')](function(_0x4e5c52){var _0x487c0f=_0x4e5c52[_0x3bf2('0x2c')]({'plain':!![]});_0x487c0f['paused']=0x0;_0x487c0f[_0x3bf2('0xa')]=0x0;_0x487c0f['loggedIn']=0x0;_0x487c0f[_0x3bf2('0x4')]=0x0;_0x487c0f['waiting']=0x0;if(_0x10f771===_0x3bf2('0x28')){_0x487c0f[_0x3bf2('0xe')]=0x0;_0x487c0f['busy']=0x0;if(_0x3dec52==='outbound'){_0x487c0f[_0x3bf2('0xf')]=0x0;_0x487c0f[_0x3bf2('0x10')]=0x0;}}var _0x34e048=_[_0x3bf2('0x2d')](_0x560849,['id',_0x487c0f['id']]);if(_0x34e048){_['merge'](_0x487c0f,_[_0x3bf2('0x2e')](_0x34e048,_0x3aa235));}return _0x487c0f;});}exports[_0x3bf2('0x2f')]=initializeQueues; \ No newline at end of file +var _0x687f=['erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','startCase','Queues','then','error','format','result','catch','getRealtimeQueues','outbound','concat','get','find','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','inUse','invalid','loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','erlangCalls','erlangAbandonmentRate'];(function(_0x40aafa,_0x14ec4a){var _0x222a7e=function(_0x3f3f69){while(--_0x3f3f69){_0x40aafa['push'](_0x40aafa['shift']());}};_0x222a7e(++_0x14ec4a);}(_0x687f,0x11e));var _0xf687=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x687f[_0xe66cf2];return _0x2d84e7;};'use strict';var _=require(_0xf687('0x0'));var jayson=require(_0xf687('0x1'));var util=require(_0xf687('0x2'));var amiClient=jayson[_0xf687('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xf687('0x3')][_0xf687('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xf687('0x5'),_0xf687('0x6'),_0xf687('0x7'),_0xf687('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0xf687('0x9'),_0xf687('0xa'),_0xf687('0xb'),_0xf687('0xc'),'notInUse',_0xf687('0xd'),_0xf687('0xe'),_0xf687('0xf'),_0xf687('0x10'),_0xf687('0x11'),_0xf687('0x12')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xf687('0x13'),_0xf687('0x14'),_0xf687('0x15'),_0xf687('0x16'),'dialActive',_0xf687('0x17'),'Trunk','startPredictive','startProgressive',_0xf687('0x18'),'erlangCallToSecond',_0xf687('0x19'),_0xf687('0x1a'),_0xf687('0x1b'),'dialPredictiveIntervalMaxThreshold',_0xf687('0x1c'),_0xf687('0x1d'),_0xf687('0x1e'),_0xf687('0x1f'),_0xf687('0x20'),_0xf687('0x21'),_0xf687('0x22'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x969b6a,_0x202bdf){var _0x499f6f=_0x202bdf===_0xf687('0x23')?amiClient:routingClient;return _0x499f6f[_0xf687('0x24')](_[_0xf687('0x25')](_0x202bdf)+_0xf687('0x26'),_0x969b6a)[_0xf687('0x27')](function(_0x3f4620){if(_0x3f4620[_0xf687('0x28')])throw new Error(util[_0xf687('0x29')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x202bdf));return _0x3f4620[_0xf687('0x2a')];})[_0xf687('0x2b')](function(_0x126a93){throw _0x126a93;});}exports[_0xf687('0x2c')]=getRealtimeQueues;function initializeQueues(_0x10f29e,_0x96b2bf,_0x288a43,_0x355421){var _0x18f4dc=DEFAULT_QUEUE_ATTRIBUTES;if(_0x288a43==='voice'){if(_0x355421==='inbound'){_0x18f4dc=_0x18f4dc['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x355421===_0xf687('0x2d')){_0x18f4dc=_0x18f4dc[_0xf687('0x2e')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x10f29e['map'](function(_0x34e7ad){var _0x6a7369=_0x34e7ad[_0xf687('0x2f')]({'plain':!![]});_0x6a7369[_0xf687('0x7')]=0x0;_0x6a7369[_0xf687('0xc')]=0x0;_0x6a7369['loggedIn']=0x0;_0x6a7369[_0xf687('0x5')]=0x0;_0x6a7369[_0xf687('0x8')]=0x0;if(_0x288a43===_0xf687('0x23')){_0x6a7369[_0xf687('0x10')]=0x0;_0x6a7369[_0xf687('0x9')]=0x0;if(_0x355421==='outbound'){_0x6a7369[_0xf687('0x13')]=0x0;_0x6a7369[_0xf687('0x14')]=0x0;}}var _0x1c0f78=_[_0xf687('0x30')](_0x96b2bf,['id',_0x6a7369['id']]);if(_0x1c0f78){_[_0xf687('0x31')](_0x6a7369,_[_0xf687('0x32')](_0x1c0f78,_0x18f4dc));}return _0x6a7369;});}exports[_0xf687('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5f19f84..56a2b15 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(_0x55fcfe,_0x55fc30){var _0x170825=function(_0x11d637){while(--_0x11d637){_0x55fcfe['push'](_0x55fcfe['shift']());}};_0x170825(++_0x55fc30);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'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(_0x46891a,_0x3e3051){var _0x4c578d=function(_0x3cf400){while(--_0x3cf400){_0x46891a['push'](_0x46891a['shift']());}};_0x4c578d(++_0x3e3051);}(_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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index baa070c..03824a7 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 _0x715f=['00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','createHash','md5','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','length','filter','family','IPv4','head','mac'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x715f,0x85));var _0xf715=function(_0x2887b2,_0x588e01){_0x2887b2=_0x2887b2-0x0;var _0x18340e=_0x715f[_0x2887b2];return _0x18340e;};'use strict';var _=require(_0xf715('0x0'));var os=require('os');var crypto=require(_0xf715('0x1'));var machine=require(_0xf715('0x2'));var exec=require(_0xf715('0x3'))[_0xf715('0x4')];var config=require(_0xf715('0x5'));function getInterfaces(){var _0x20a745=[];var _0x4e5db7=os[_0xf715('0x6')]();var _0x2c58e1=_[_0xf715('0x7')](_[_0xf715('0x8')](_0x4e5db7));for(var _0x5c25b1=0x0;_0x5c25b1<_0x2c58e1[_0xf715('0x9')];_0x5c25b1++){var _0x76e84=_0x4e5db7[_0x2c58e1[_0x5c25b1]][_0xf715('0xa')](function(_0x1f9559){return _0x1f9559[_0xf715('0xb')]===_0xf715('0xc')&&_0x1f9559['internal']===![];});_0x20a745=_0x20a745['concat'](_0x76e84);}return _0x20a745;}function getFirstInterface(){var _0x2f141f=_[_0xf715('0xd')](getInterfaces());return{'macAddress':_0x2f141f&&_0x2f141f[_0xf715('0xe')]?_0x2f141f[_0xf715('0xe')]:_0xf715('0xf'),'ipAddress':_0x2f141f&&_0x2f141f[_0xf715('0x10')]?_0x2f141f[_0xf715('0x10')]:_0xf715('0x11')};}exports[_0xf715('0x12')]=getFirstInterface;function getCPUhash(){var _0x2d2263=_[_0xf715('0x7')](os[_0xf715('0x13')]()['map'](function(_0x431fd9){return _0x431fd9[_0xf715('0x14')];}))['join'](':');return crypto[_0xf715('0x15')](_0xf715('0x16'))['update'](_0x2d2263)[_0xf715('0x17')](_0xf715('0x18'));}exports[_0xf715('0x19')]=function(){var _0x38f37e=os['platform']();var _0x2170cb=/[0-9a-f-]{36}/;if(config[_0xf715('0x1a')]&&_0x2170cb[_0xf715('0x1b')](config[_0xf715('0x1a')])){return config['licenseToken'];}else if(_0x38f37e===_0xf715('0x1c')){return exec(_0xf715('0x1d'),{'encoding':_0xf715('0x1e')})[_0xf715('0x1f')]('\x0d\x0a','');}else{var _0x446181=getFirstInterface();var _0x14f176=getCPUhash();var _0x34f2e2=_0x14f176+'|'+os[_0xf715('0x20')]()+'|'+_0x446181[_0xf715('0x21')]+'|'+_0x446181[_0xf715('0x22')];var _0x525912=crypto[_0xf715('0x15')](_0xf715('0x16'))[_0xf715('0x23')](_0x34f2e2)[_0xf715('0x17')](_0xf715('0x18'));return _0x525912[_0xf715('0x24')](0x0,0x8)+'-'+_0x525912[_0xf715('0x24')](0x8,0xc)+'-'+_0x525912[_0xf715('0x24')](0xc,0x10)+'-'+_0x525912[_0xf715('0x24')](0x10,0x14)+'-'+_0x525912['substring'](0x14);}}; \ No newline at end of file +var _0xbea0=['join','md5','update','digest','hex','getUuid','platform','test','licenseToken','dmidecode\x20--string\x20system-uuid','macAddress','ipAddress','createHash','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','keys','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map'];(function(_0x539bcd,_0x126e46){var _0x40425b=function(_0x3802ea){while(--_0x3802ea){_0x539bcd['push'](_0x539bcd['shift']());}};_0x40425b(++_0x126e46);}(_0xbea0,0xe0));var _0x0bea=function(_0x1a6356,_0xc49463){_0x1a6356=_0x1a6356-0x0;var _0x21ed34=_0xbea0[_0x1a6356];return _0x21ed34;};'use strict';var _=require(_0x0bea('0x0'));var os=require('os');var crypto=require(_0x0bea('0x1'));var machine=require(_0x0bea('0x2'));var exec=require(_0x0bea('0x3'))[_0x0bea('0x4')];var config=require(_0x0bea('0x5'));function getInterfaces(){var _0x12271b=[];var _0x533ed7=os[_0x0bea('0x6')]();var _0x418f50=_[_0x0bea('0x7')](_[_0x0bea('0x8')](_0x533ed7));for(var _0x2a7d3a=0x0;_0x2a7d3a<_0x418f50['length'];_0x2a7d3a++){var _0x32bfbd=_0x533ed7[_0x418f50[_0x2a7d3a]][_0x0bea('0x9')](function(_0xaa7eba){return _0xaa7eba[_0x0bea('0xa')]==='IPv4'&&_0xaa7eba[_0x0bea('0xb')]===![];});_0x12271b=_0x12271b[_0x0bea('0xc')](_0x32bfbd);}return _0x12271b;}function getFirstInterface(){var _0x5be29b=_[_0x0bea('0xd')](getInterfaces());return{'macAddress':_0x5be29b&&_0x5be29b[_0x0bea('0xe')]?_0x5be29b['mac']:_0x0bea('0xf'),'ipAddress':_0x5be29b&&_0x5be29b[_0x0bea('0x10')]?_0x5be29b[_0x0bea('0x10')]:_0x0bea('0x11')};}exports[_0x0bea('0x12')]=getFirstInterface;function getCPUhash(){var _0x1b54aa=_[_0x0bea('0x7')](os[_0x0bea('0x13')]()[_0x0bea('0x14')](function(_0x134040){return _0x134040['model'];}))[_0x0bea('0x15')](':');return crypto['createHash'](_0x0bea('0x16'))[_0x0bea('0x17')](_0x1b54aa)[_0x0bea('0x18')](_0x0bea('0x19'));}exports[_0x0bea('0x1a')]=function(){var _0x4b0828=os[_0x0bea('0x1b')]();var _0x388caa=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x388caa[_0x0bea('0x1c')](config[_0x0bea('0x1d')])){return config[_0x0bea('0x1d')];}else if(_0x4b0828==='win32'){return exec(_0x0bea('0x1e'),{'encoding':'utf8'})['replace']('\x0d\x0a','');}else{var _0x537377=getFirstInterface();var _0x384a9e=getCPUhash();var _0x13cc29=_0x384a9e+'|'+os['hostname']()+'|'+_0x537377[_0x0bea('0x1f')]+'|'+_0x537377[_0x0bea('0x20')];var _0x2e2925=crypto[_0x0bea('0x21')](_0x0bea('0x16'))['update'](_0x13cc29)['digest'](_0x0bea('0x19'));return _0x2e2925[_0x0bea('0x22')](0x0,0x8)+'-'+_0x2e2925['substring'](0x8,0xc)+'-'+_0x2e2925['substring'](0xc,0x10)+'-'+_0x2e2925[_0x0bea('0x22')](0x10,0x14)+'-'+_0x2e2925[_0x0bea('0x22')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 6a446fe..c380393 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 _0x3859=['get','data1','then','info','data2','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','util','moment','bluebird','pkginfo','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'];(function(_0x542c47,_0x2db9f3){var _0x2ed53b=function(_0x1dbd21){while(--_0x1dbd21){_0x542c47['push'](_0x542c47['shift']());}};_0x2ed53b(++_0x2db9f3);}(_0x3859,0x19e));var _0x9385=function(_0x7d0191,_0x16a6cd){_0x7d0191=_0x7d0191-0x0;var _0x2e852a=_0x3859[_0x7d0191];return _0x2e852a;};'use strict';var util=require(_0x9385('0x0'));var moment=require(_0x9385('0x1'));var rp=require('request-promise');var BPromise=require(_0x9385('0x2'));var pkginfo=require(_0x9385('0x3'))(module,_0x9385('0x4'));var db=require(_0x9385('0x5'))['db'];var encryptor=require(_0x9385('0x6'));var hardware=require(_0x9385('0x7'));var logger=require(_0x9385('0x8'))(_0x9385('0x9'));var HOST=_0x9385('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1cf181){return new BPromise(function(_0x41775b,_0x51116d){var _0x1eb1d2=util[_0x9385('0xb')](_0x9385('0xc'),HOST,_0x1cf181,module[_0x9385('0xd')]['version']);if(oldToken){_0x1eb1d2=util[_0x9385('0xb')](_0x9385('0xe'),HOST,_0x1cf181,module[_0x9385('0xd')]['version'],oldToken);}var _0x1387c7={'uri':_0x1eb1d2,'method':_0x9385('0xf'),'timeout':0xea60,'json':!![]};return rp(_0x1387c7)['then'](function(_0x5d5542){_0x41775b(_0x5d5542);})['catch'](function(_0x20a2b2){_0x51116d(_0x20a2b2);});});}function manageLicense(_0xbcc275,_0x4c30e7){var _0x54f972=_0x4c30e7[_0x9385('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x54f972['data1']!==_0xbcc275&&!_0x54f972['data2']){oldToken=_0x54f972[_0x9385('0x11')];}httpRequest(_0xbcc275)[_0x9385('0x12')](function(_0x2cc8f2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x2cc8f2['active']){isOldTokenSent=![];if(!_0x54f972['license']&&_0x54f972[_0x9385('0x9')]!=_0x2cc8f2[_0x9385('0x9')]||_0x54f972['license']&&_0x54f972['data2']){logger[_0x9385('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x54f972[_0x9385('0x9')]&&!_0x54f972[_0x9385('0x14')]&&_0x54f972['license']!=_0x2cc8f2[_0x9385('0x9')]){logger[_0x9385('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x54f972['license']&&!_0x54f972['data2']&&_0x54f972[_0x9385('0x9')]==_0x2cc8f2['license']){return _0x4c30e7;}return _0x4c30e7[_0x9385('0x15')]({'data1':_0xbcc275,'data2':null,'license':_0x2cc8f2[_0x9385('0x9')]});}else{if(_0x2cc8f2[_0x9385('0x9')]||_0x54f972[_0x9385('0x9')]){if(!_0x54f972['data2']){if(_0x54f972[_0x9385('0x11')]==_0xbcc275){GRAY_PERIOD_REASON=_0x9385('0x16');logger[_0x9385('0x13')](_0x9385('0x17'));}else{GRAY_PERIOD_REASON=_0x9385('0x18');logger[_0x9385('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x54f972[_0x9385('0x11')],_0xbcc275);}logger['info'](_0x9385('0x19'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format'](_0x9385('0x1a')));return _0x4c30e7[_0x9385('0x15')]({'data2':encryptor[_0x9385('0x1b')](moment()[_0x9385('0xb')](_0x9385('0x1a')))});}else{if(moment()[_0x9385('0x1c')](encryptor[_0x9385('0x1d')](_0x54f972[_0x9385('0x14')]),_0x9385('0x1e'))>DAYS){logger[_0x9385('0x13')](_0x9385('0x1f'),moment()[_0x9385('0xb')](_0x9385('0x1a')));isOldTokenSent=![];return _0x4c30e7[_0x9385('0x15')]({'data1':_0xbcc275,'data2':null,'license':null});}}}else{if(_0x54f972[_0x9385('0x11')]!=_0xbcc275){logger[_0x9385('0x13')](_0x9385('0x20'),_0x54f972[_0x9385('0x11')],_0xbcc275);return _0x4c30e7[_0x9385('0x15')]({'data1':_0xbcc275,'data2':null,'license':null});}}}return _0x4c30e7;})[_0x9385('0x12')](function(_0x57b8a8){_0x4c30e7=_0x57b8a8;})[_0x9385('0x21')](function(_0x2843db){logger[_0x9385('0x22')](_0x2843db['message']);})[_0x9385('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x4c30e7);},TIME);});}function defaultLicense(){var _0x2890b6=hardware[_0x9385('0x24')]();if(_0x2890b6){return db[_0x9385('0x25')][_0x9385('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x2890b6}})[_0x9385('0x27')](function(_0x1d9012,_0x105b40){logger['info'](_0x9385('0x28'),_0x2890b6);manageLicense(_0x2890b6,_0x1d9012);})[_0x9385('0x21')](function(_0x569054){logger[_0x9385('0x22')](_0x569054[_0x9385('0x29')]);});}}exports[_0x9385('0x2a')]=defaultLicense; \ No newline at end of file +var _0xb498=['data2','active','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','info','toUpperCase','YYYY-MM-DD\x20HH:mm','decryptString','days','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','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1'];(function(_0x7d653b,_0x3f3341){var _0x3a30e7=function(_0x4e7b60){while(--_0x4e7b60){_0x7d653b['push'](_0x7d653b['shift']());}};_0x3a30e7(++_0x3f3341);}(_0xb498,0xf9));var _0x8b49=function(_0x46e60c,_0x15bd11){_0x46e60c=_0x46e60c-0x0;var _0x133bf6=_0xb498[_0x46e60c];return _0x133bf6;};'use strict';var util=require('util');var moment=require(_0x8b49('0x0'));var rp=require(_0x8b49('0x1'));var BPromise=require(_0x8b49('0x2'));var pkginfo=require(_0x8b49('0x3'))(module,_0x8b49('0x4'));var db=require(_0x8b49('0x5'))['db'];var encryptor=require(_0x8b49('0x6'));var hardware=require(_0x8b49('0x7'));var logger=require(_0x8b49('0x8'))(_0x8b49('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x17e027){return new BPromise(function(_0x14d17b,_0x51f592){var _0x3a420f=util[_0x8b49('0xa')]('%s/api/servers/%s/check?version=%s',HOST,_0x17e027,module[_0x8b49('0xb')]['version']);if(oldToken){_0x3a420f=util[_0x8b49('0xa')](_0x8b49('0xc'),HOST,_0x17e027,module[_0x8b49('0xb')][_0x8b49('0x4')],oldToken);}var _0x212012={'uri':_0x3a420f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x212012)[_0x8b49('0xd')](function(_0x1b217e){_0x14d17b(_0x1b217e);})[_0x8b49('0xe')](function(_0x105d35){_0x51f592(_0x105d35);});});}function manageLicense(_0x4ef07f,_0x4a34ea){var _0x4cf918=_0x4a34ea[_0x8b49('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4cf918[_0x8b49('0x10')]!==_0x4ef07f&&!_0x4cf918[_0x8b49('0x11')]){oldToken=_0x4cf918['data1'];}httpRequest(_0x4ef07f)[_0x8b49('0xd')](function(_0x440486){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x440486[_0x8b49('0x12')]){isOldTokenSent=![];if(!_0x4cf918[_0x8b49('0x9')]&&_0x4cf918[_0x8b49('0x9')]!=_0x440486[_0x8b49('0x9')]||_0x4cf918[_0x8b49('0x9')]&&_0x4cf918[_0x8b49('0x11')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4cf918[_0x8b49('0x9')]&&!_0x4cf918['data2']&&_0x4cf918[_0x8b49('0x9')]!=_0x440486[_0x8b49('0x9')]){logger['info'](_0x8b49('0x13'));}if(_0x4cf918[_0x8b49('0x9')]&&!_0x4cf918[_0x8b49('0x11')]&&_0x4cf918[_0x8b49('0x9')]==_0x440486[_0x8b49('0x9')]){return _0x4a34ea;}return _0x4a34ea[_0x8b49('0x14')]({'data1':_0x4ef07f,'data2':null,'license':_0x440486[_0x8b49('0x9')]});}else{if(_0x440486[_0x8b49('0x9')]||_0x4cf918[_0x8b49('0x9')]){if(!_0x4cf918[_0x8b49('0x11')]){if(_0x4cf918[_0x8b49('0x10')]==_0x4ef07f){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x8b49('0x15'));}else{GRAY_PERIOD_REASON=_0x8b49('0x16');logger[_0x8b49('0x17')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4cf918[_0x8b49('0x10')],_0x4ef07f);}logger[_0x8b49('0x17')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x8b49('0x18')](),moment()[_0x8b49('0xa')](_0x8b49('0x19')));return _0x4a34ea['update']({'data2':encryptor['encryptString'](moment()[_0x8b49('0xa')](_0x8b49('0x19')))});}else{if(moment()['diff'](encryptor[_0x8b49('0x1a')](_0x4cf918[_0x8b49('0x11')]),_0x8b49('0x1b'))>DAYS){logger[_0x8b49('0x17')](_0x8b49('0x1c'),moment()[_0x8b49('0xa')](_0x8b49('0x19')));isOldTokenSent=![];return _0x4a34ea[_0x8b49('0x14')]({'data1':_0x4ef07f,'data2':null,'license':null});}}}else{if(_0x4cf918['data1']!=_0x4ef07f){logger[_0x8b49('0x17')](_0x8b49('0x1d'),_0x4cf918[_0x8b49('0x10')],_0x4ef07f);return _0x4a34ea['update']({'data1':_0x4ef07f,'data2':null,'license':null});}}}return _0x4a34ea;})[_0x8b49('0xd')](function(_0x244ce4){_0x4a34ea=_0x244ce4;})['catch'](function(_0xe7bae7){logger[_0x8b49('0x1e')](_0xe7bae7[_0x8b49('0x1f')]);})[_0x8b49('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x8b49('0x21')](),_0x4a34ea);},TIME);});}function defaultLicense(){var _0xa963df=hardware['getUuid']();if(_0xa963df){return db['License'][_0x8b49('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0xa963df}})[_0x8b49('0x23')](function(_0x466b70,_0xa99b50){logger[_0x8b49('0x17')](_0x8b49('0x24'),_0xa963df);manageLicense(_0xa963df,_0x466b70);})['catch'](function(_0x36c23c){logger[_0x8b49('0x1e')](_0x36c23c['message']);});}}exports[_0x8b49('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 93f89fc..e1a65d0 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 _0x5a07=['data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','add','days','grayReason','changed','disabled','User','findAll','role','COUNT','sequelize','count','telephones','user','countBy','admin','telephone','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','defaults','then','catch','uuid'];(function(_0xf6676d,_0x4fc3fe){var _0x59974b=function(_0x55ae4e){while(--_0x55ae4e){_0xf6676d['push'](_0xf6676d['shift']());}};_0x59974b(++_0x4fc3fe);}(_0x5a07,0xf0));var _0x75a0=function(_0x131316,_0x256d3a){_0x131316=_0x131316-0x0;var _0x2c570c=_0x5a07[_0x131316];return _0x2c570c;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');var BPromise=require(_0x75a0('0x0'));var hardware=require('./hardware');var encryptor=require(_0x75a0('0x1'));var db=require(_0x75a0('0x2'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x75a0('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x75a0('0x4'),'machineUuid':hardware[_0x75a0('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x75a0('0x3'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x75a0('0x6'),'machineUuid':hardware[_0x75a0('0x5')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x215298){return new BPromise(function(_0x5b8458,_0x3b4f89){return db['License'][_0x75a0('0x7')](_[_0x75a0('0x8')](_0x215298,{'raw':!![],'where':{'id':0x1}}))[_0x75a0('0x9')](function(_0x58e700){return checkLicense(_0x58e700,null);})[_0x75a0('0x9')](function(_0x3de7dd){_0x5b8458(_0x3de7dd);return;})[_0x75a0('0xa')](function(_0x2cff02){_0x3b4f89(_0x2cff02);});});}function checkLicense(_0x395908,_0x197243){if(!_0x395908){demoLicense[_0x75a0('0xb')]=_0x395908[_0x75a0('0xc')];return demoLicense;}try{var _0x535365=_0x197243||_0x395908[_0x75a0('0xd')];if(_[_0x75a0('0xe')](_0x535365)){throw new Error(_0x75a0('0xf'));}var _0x1335e4=_0x395908[_0x75a0('0xc')];var _0x3003e6=_0x395908[_0x75a0('0x10')];var _0x5f25b6=_0x1335e4['split']('-')[0x4];var _0xd7e9b7=_0x1335e4['split']('-')[0x0];var _0x317165=encryptor['decryptString'](_0x535365,util[_0x75a0('0x11')](_0x75a0('0x12'),_0x5f25b6,_0x1335e4,_0xd7e9b7));var _0x3e5ca0=JSON[_0x75a0('0x13')](_0x317165);_0x3e5ca0[_0x75a0('0x14')]=![];_0x3e5ca0[_0x75a0('0xb')]=_0x1335e4;_0x3e5ca0[_0x75a0('0x15')]=hardware[_0x75a0('0x5')]();if(_0x3003e6){var _0x2a1fcd=encryptor['decryptString'](_0x3003e6);_0x3e5ca0[_0x75a0('0x16')]=_0x2a1fcd;_0x3e5ca0[_0x75a0('0x17')]=moment(_0x2a1fcd)[_0x75a0('0x18')](0x7,_0x75a0('0x19'))[_0x75a0('0x11')]();_0x3e5ca0[_0x75a0('0x1a')]=_0x3e5ca0[_0x75a0('0xb')]!=_0x3e5ca0[_0x75a0('0x15')]?_0x75a0('0x1b'):_0x75a0('0x1c');}return _0x3e5ca0;}catch(_0x409b67){breakingLicense[_0x75a0('0xb')]=_0x395908[_0x75a0('0xc')];breakingLicense['message']=_0x409b67['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5449c9,_0x4ff0f3){getLicense()['then'](function(_0xdad734){return db[_0x75a0('0x1d')][_0x75a0('0x1e')]({'attributes':[_0x75a0('0x1f'),[db['sequelize']['fn'](_0x75a0('0x20'),db[_0x75a0('0x21')]['col'](_0x75a0('0x1f'))),_0x75a0('0x22')]],'group':_0x75a0('0x1f'),'where':{'role':{'$or':['admin','user','telephone']}},'raw':!![]})['then'](function(_0x38b239){var _0x5c906b={'user':_0xdad734['users']||0x0,'telephone':_0xdad734[_0x75a0('0x23')]||0x0};_0x38b239['forEach'](function(_0x488bcb){var _0x24e2ef=_0x488bcb['role']==='admin'?_0x75a0('0x24'):_0x488bcb[_0x75a0('0x1f')];_0x5c906b[_0x24e2ef]-=_0x488bcb[_0x75a0('0x22')];if(_0x5c906b[_0x24e2ef]<0x0)_0x5c906b[_0x24e2ef]=0x0;});_0x5449c9(_0x5c906b);return;});})[_0x75a0('0xa')](function(_0x27cb7c){_0x4ff0f3(_0x27cb7c);});});}function checkUserLimits(_0x1e084a){return new BPromise(function(_0x3f7ff4,_0x57d75c){getLimits()[_0x75a0('0x9')](function(_0x59949a){var _0x580537=_['pick'](_[_0x75a0('0x25')](_0x1e084a,_0x75a0('0x1f')),[_0x75a0('0x26'),_0x75a0('0x24'),_0x75a0('0x27')]);var _0x5b3f35=(_0x580537['admin']||0x0)+(_0x580537['user']||0x0);var _0xac354=_0x580537['telephone']||0x0;if(_0x5b3f35>_0x59949a[_0x75a0('0x24')])return _0x57d75c(_0x75a0('0x28'));if(_0xac354>_0x59949a[_0x75a0('0x27')])return _0x57d75c(_0x75a0('0x29'));return _0x3f7ff4();})['catch'](function(_0xc381c7){_0x57d75c(_0xc381c7);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xabd0=['message','User','findAll','role','sequelize','COUNT','admin','telephone','users','telephones','user','count','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','parse','demo','uuid','gray','add','grayReason','machineUuid','changed','disabled'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xabd0,0xca));var _0x0abd=function(_0x1a258a,_0x23d5db){_0x1a258a=_0x1a258a-0x0;var _0x50e08b=_0xabd0[_0x1a258a];return _0x50e08b;};'use strict';var util=require(_0x0abd('0x0'));var _=require(_0x0abd('0x1'));var moment=require(_0x0abd('0x2'));var BPromise=require(_0x0abd('0x3'));var hardware=require(_0x0abd('0x4'));var encryptor=require(_0x0abd('0x5'));var db=require(_0x0abd('0x6'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0abd('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0abd('0x8'),'machineUuid':hardware[_0x0abd('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0abd('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0abd('0xa'),'machineUuid':hardware[_0x0abd('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5c5fd2){return new BPromise(function(_0x3f342a,_0x28e1ab){return db[_0x0abd('0xb')][_0x0abd('0xc')](_[_0x0abd('0xd')](_0x5c5fd2,{'raw':!![],'where':{'id':0x1}}))[_0x0abd('0xe')](function(_0x20ac51){return checkLicense(_0x20ac51,null);})[_0x0abd('0xe')](function(_0x489147){_0x3f342a(_0x489147);return;})[_0x0abd('0xf')](function(_0x2c770a){_0x28e1ab(_0x2c770a);});});}function checkLicense(_0x4d63f4,_0x50895c){if(!_0x4d63f4){demoLicense['uuid']=_0x4d63f4[_0x0abd('0x10')];return demoLicense;}try{var _0x703276=_0x50895c||_0x4d63f4[_0x0abd('0x11')];if(_[_0x0abd('0x12')](_0x703276)){throw new Error(_0x0abd('0x13'));}var _0x1511cd=_0x4d63f4['data1'];var _0x5d21e4=_0x4d63f4[_0x0abd('0x14')];var _0x1ac5d0=_0x1511cd[_0x0abd('0x15')]('-')[0x4];var _0x43ffac=_0x1511cd[_0x0abd('0x15')]('-')[0x0];var _0x27ee96=encryptor[_0x0abd('0x16')](_0x703276,util[_0x0abd('0x17')]('%s:%s:%s',_0x1ac5d0,_0x1511cd,_0x43ffac));var _0x4a6aac=JSON[_0x0abd('0x18')](_0x27ee96);_0x4a6aac[_0x0abd('0x19')]=![];_0x4a6aac[_0x0abd('0x1a')]=_0x1511cd;_0x4a6aac['machineUuid']=hardware[_0x0abd('0x9')]();if(_0x5d21e4){var _0x55efd1=encryptor['decryptString'](_0x5d21e4);_0x4a6aac[_0x0abd('0x1b')]=_0x55efd1;_0x4a6aac['deadline']=moment(_0x55efd1)[_0x0abd('0x1c')](0x7,'days')[_0x0abd('0x17')]();_0x4a6aac[_0x0abd('0x1d')]=_0x4a6aac['uuid']!=_0x4a6aac[_0x0abd('0x1e')]?_0x0abd('0x1f'):_0x0abd('0x20');}return _0x4a6aac;}catch(_0x2c7b03){breakingLicense['uuid']=_0x4d63f4[_0x0abd('0x10')];breakingLicense[_0x0abd('0x21')]=_0x2c7b03[_0x0abd('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5c21f4,_0x48e039){getLicense()[_0x0abd('0xe')](function(_0x143324){return db[_0x0abd('0x22')][_0x0abd('0x23')]({'attributes':[_0x0abd('0x24'),[db[_0x0abd('0x25')]['fn'](_0x0abd('0x26'),db[_0x0abd('0x25')]['col'](_0x0abd('0x24'))),'count']],'group':'role','where':{'role':{'$or':[_0x0abd('0x27'),'user',_0x0abd('0x28')]}},'raw':!![]})[_0x0abd('0xe')](function(_0x1f7a13){var _0xbca259={'user':_0x143324[_0x0abd('0x29')]||0x0,'telephone':_0x143324[_0x0abd('0x2a')]||0x0};_0x1f7a13['forEach'](function(_0x36349a){var _0x2c8367=_0x36349a[_0x0abd('0x24')]===_0x0abd('0x27')?_0x0abd('0x2b'):_0x36349a[_0x0abd('0x24')];_0xbca259[_0x2c8367]-=_0x36349a[_0x0abd('0x2c')];if(_0xbca259[_0x2c8367]<0x0)_0xbca259[_0x2c8367]=0x0;});_0x5c21f4(_0xbca259);return;});})['catch'](function(_0x38c38d){_0x48e039(_0x38c38d);});});}function checkUserLimits(_0x551565){return new BPromise(function(_0x5690ec,_0xf6afcb){getLimits()[_0x0abd('0xe')](function(_0x3e1d41){var _0x976ede=_['pick'](_['countBy'](_0x551565,_0x0abd('0x24')),[_0x0abd('0x27'),_0x0abd('0x2b'),_0x0abd('0x28')]);var _0x32af6a=(_0x976ede[_0x0abd('0x27')]||0x0)+(_0x976ede[_0x0abd('0x2b')]||0x0);var _0x1bffe7=_0x976ede[_0x0abd('0x28')]||0x0;if(_0x32af6a>_0x3e1d41['user'])return _0xf6afcb('License\x20limit\x20reached\x20for\x20users');if(_0x1bffe7>_0x3e1d41[_0x0abd('0x28')])return _0xf6afcb(_0x0abd('0x2d'));return _0x5690ec();})[_0x0abd('0xf')](function(_0x43a44c){_0xf6afcb(_0x43a44c);});});}module[_0x0abd('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index fdf9a3b..63dde81 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 _0xdb28=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x954620,_0x54fd40){var _0x390926=function(_0x2f5635){while(--_0x2f5635){_0x954620['push'](_0x954620['shift']());}};_0x390926(++_0x54fd40);}(_0xdb28,0x106));var _0x8db2=function(_0x15ed5e,_0x3c6dfa){_0x15ed5e=_0x15ed5e-0x0;var _0x184805=_0xdb28[_0x15ed5e];return _0x184805;};'use strict';module[_0x8db2('0x0')]={'DOMAIN':_0x8db2('0x1'),'SESSION_SECRET':_0x8db2('0x2'),'GOOGLE_ID':_0x8db2('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x5c3c=['myappanuglar-secret','app-id','exports','http://localhost:9000'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x5c3c,0x132));var _0xc5c3=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0x5c3c[_0x9fd887];return _0x1a54ab;};'use strict';module[_0xc5c3('0x0')]={'DOMAIN':_0xc5c3('0x1'),'SESSION_SECRET':_0xc5c3('0x2'),'GOOGLE_ID':_0xc5c3('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2f72fc2..60c8e84 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a6d=['exports','fileLogger'];(function(_0x513545,_0x158f2e){var _0x18b7c5=function(_0x58514c){while(--_0x58514c){_0x513545['push'](_0x513545['shift']());}};_0x18b7c5(++_0x158f2e);}(_0x2a6d,0x1d1));var _0xd2a6=function(_0x136889,_0x196f54){_0x136889=_0x136889-0x0;var _0x4e6f8f=_0x2a6d[_0x136889];return _0x4e6f8f;};'use strict';var fileLogger=require('../utils/loggers')[_0xd2a6('0x0')];module[_0xd2a6('0x1')]=fileLogger; \ No newline at end of file +var _0x214c=['../utils/loggers','fileLogger'];(function(_0x3d6116,_0x32238b){var _0xfabc77=function(_0x5bef07){while(--_0x5bef07){_0x3d6116['push'](_0x3d6116['shift']());}};_0xfabc77(++_0x32238b);}(_0x214c,0x190));var _0xc214=function(_0x2e7087,_0x112eec){_0x2e7087=_0x2e7087-0x0;var _0xb5b3a6=_0x214c[_0x2e7087];return _0xb5b3a6;};'use strict';var fileLogger=require(_0xc214('0x0'))[_0xc214('0x1')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 3a85d7a..e92b74a 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 _0xc0f5=['xdr','path','../../config/environment','resolve','join','legacy-libs','ami','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xc0f5,0x12d));var _0x5c0f=function(_0x11163d,_0x24489b){_0x11163d=_0x11163d-0x0;var _0x5aec20=_0xc0f5[_0x11163d];return _0x5aec20;};'use strict';var path=require(_0x5c0f('0x0'));var cfg=require(_0x5c0f('0x1'));var env={'NODE_PATH':path[_0x5c0f('0x2')](path[_0x5c0f('0x3')](cfg['root'],_0x5c0f('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x5c0f('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x5c0f('0x5'),'script':path[_0x5c0f('0x3')](__dirname,_0x5c0f('0x6')),'env':env},{'name':'agi','script':path[_0x5c0f('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x5c0f('0x7'),'script':path[_0x5c0f('0x3')](__dirname,_0x5c0f('0x8')),'env':env},{'name':_0x5c0f('0x9'),'script':path[_0x5c0f('0x3')](__dirname,_0x5c0f('0xa')),'env':env},{'name':_0x5c0f('0xb'),'script':path[_0x5c0f('0x3')](__dirname,'../../services/xdr/index.js'),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0x6ec3=['path','resolve','root','legacy-libs','join','../../services/express/index.js','ami','agi','../../services/email/index.js','routing','../../services/routing/index.js','exports'];(function(_0x5fa5c4,_0x464825){var _0x1ceb61=function(_0x2ede85){while(--_0x2ede85){_0x5fa5c4['push'](_0x5fa5c4['shift']());}};_0x1ceb61(++_0x464825);}(_0x6ec3,0x180));var _0x36ec=function(_0x1095d0,_0x3c45db){_0x1095d0=_0x1095d0-0x0;var _0x393aeb=_0x6ec3[_0x1095d0];return _0x393aeb;};'use strict';var path=require(_0x36ec('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x36ec('0x1')](path['join'](cfg[_0x36ec('0x2')],_0x36ec('0x3')))};var pm2config={'apps':[{'name':'express','script':path[_0x36ec('0x4')](__dirname,_0x36ec('0x5')),'env':env},{'name':_0x36ec('0x6'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x36ec('0x7'),'script':path['join'](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0x36ec('0x4')](__dirname,_0x36ec('0x8')),'env':env},{'name':_0x36ec('0x9'),'script':path[_0x36ec('0x4')](__dirname,_0x36ec('0xa')),'env':env},{'name':'xdr','script':path['join'](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x36ec('0xb')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 35af7c7..d5e7a68 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 _0xe521=['connect','connected','start','then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config'];(function(_0x44be14,_0x2b0d44){var _0x5d53b8=function(_0xc405f7){while(--_0xc405f7){_0x44be14['push'](_0x44be14['shift']());}};_0x5d53b8(++_0x2b0d44);}(_0xe521,0x174));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require(_0x1e52('0x0'));var BPromise=require(_0x1e52('0x1'));var config=require(_0x1e52('0x2'));function connect(){return new BPromise(function(_0x21ad52,_0xecfe3b){return pm2[_0x1e52('0x3')](function(_0x3c9cc1){if(_0x3c9cc1){return _0xecfe3b(_0x3c9cc1);}return _0x21ad52(_0x1e52('0x4'));});});};exports[_0x1e52('0x5')]=function(_0x26e4b3){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0x4eb59e,_0x1e97ad){return pm2['start'](_0x26e4b3,function(_0xa69753,_0x59066b){if(_0xa69753){return _0x1e97ad(_0xa69753);}pm2[_0x1e52('0x7')]();return _0x4eb59e(_0x59066b);});});});};exports['stop']=function(_0x16318b){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0x3fe0f1,_0x19df65){return pm2[_0x1e52('0x8')](_0x16318b,function(_0x3130c1,_0x212d05){if(_0x3130c1){return _0x19df65(_0x3130c1);}pm2[_0x1e52('0x7')]();return _0x3fe0f1(_0x212d05);});});});};exports['restart']=function(_0x2cc4d8){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0x4b702b,_0x351152){return pm2[_0x1e52('0x9')](_0x2cc4d8,function(_0x5765d6,_0x329080){if(_0x5765d6){return _0x351152(_0x5765d6);}pm2[_0x1e52('0x7')]();return _0x4b702b(_0x329080);});});});};exports[_0x1e52('0xa')]=function(){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0x24e999,_0xa682bf){return pm2[_0x1e52('0xa')](function(_0x4bd2d9,_0x36ce6b){if(_0x4bd2d9){return _0xa682bf(_0x4bd2d9);}pm2[_0x1e52('0x7')]();return _0x24e999(_0x36ce6b);});});});};exports[_0x1e52('0xb')]=function(_0x3e4b14){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0xee6f86,_0x2f0fba){return pm2[_0x1e52('0xb')](_0x3e4b14,function(_0x14141c,_0x4fcda4){if(_0x14141c){return _0x2f0fba(_0x14141c);}pm2[_0x1e52('0x7')]();return _0xee6f86(_0x4fcda4);});});});};exports[_0x1e52('0xc')]=function(_0x58ef4a){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0x29c574,_0x5812ab){return pm2[_0x1e52('0xc')](_0x58ef4a,function(_0x640f8c,_0x3bbe1a){if(_0x640f8c){return _0x5812ab(_0x640f8c);}pm2['disconnect']();return _0x29c574(_0x3bbe1a);});});});};exports[_0x1e52('0xd')]=function(){return connect()[_0x1e52('0x6')](function(){return new BPromise(function(_0x38ff7b,_0x1b27b0){return pm2['dump'](function(_0x282b5a){if(_0x282b5a){return _0x1b27b0(_0x282b5a);}return _0x38ff7b(_0x1e52('0xe'));});});});}; \ No newline at end of file +var _0xd76f=['start','then','stop','disconnect','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected'];(function(_0x4d729f,_0x52bf8b){var _0x5ce12a=function(_0x3ae6a6){while(--_0x3ae6a6){_0x4d729f['push'](_0x4d729f['shift']());}};_0x5ce12a(++_0x52bf8b);}(_0xd76f,0x1db));var _0xfd76=function(_0x2f0b82,_0xa07e26){_0x2f0b82=_0x2f0b82-0x0;var _0x5d6fb1=_0xd76f[_0x2f0b82];return _0x5d6fb1;};'use strict';var pm2=require(_0xfd76('0x0'));var BPromise=require(_0xfd76('0x1'));var config=require(_0xfd76('0x2'));function connect(){return new BPromise(function(_0x4e7446,_0x15303d){return pm2[_0xfd76('0x3')](function(_0x1d8051){if(_0x1d8051){return _0x15303d(_0x1d8051);}return _0x4e7446(_0xfd76('0x4'));});});};exports[_0xfd76('0x5')]=function(_0x5f5052){return connect()[_0xfd76('0x6')](function(){return new BPromise(function(_0x37b5b3,_0x2cce90){return pm2[_0xfd76('0x5')](_0x5f5052,function(_0x4f5322,_0x571967){if(_0x4f5322){return _0x2cce90(_0x4f5322);}pm2['disconnect']();return _0x37b5b3(_0x571967);});});});};exports[_0xfd76('0x7')]=function(_0x441f95){return connect()[_0xfd76('0x6')](function(){return new BPromise(function(_0x3837ad,_0x468d0a){return pm2[_0xfd76('0x7')](_0x441f95,function(_0x3e1f76,_0x1eff51){if(_0x3e1f76){return _0x468d0a(_0x3e1f76);}pm2[_0xfd76('0x8')]();return _0x3837ad(_0x1eff51);});});});};exports[_0xfd76('0x9')]=function(_0x4767f5){return connect()['then'](function(){return new BPromise(function(_0xc6aeb7,_0x1addf4){return pm2['restart'](_0x4767f5,function(_0x580337,_0x15bc07){if(_0x580337){return _0x1addf4(_0x580337);}pm2[_0xfd76('0x8')]();return _0xc6aeb7(_0x15bc07);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x8380e1,_0x2477ab){return pm2[_0xfd76('0xa')](function(_0x48e965,_0x207842){if(_0x48e965){return _0x2477ab(_0x48e965);}pm2[_0xfd76('0x8')]();return _0x8380e1(_0x207842);});});});};exports[_0xfd76('0xb')]=function(_0x487711){return connect()[_0xfd76('0x6')](function(){return new BPromise(function(_0x204639,_0x1d55d3){return pm2[_0xfd76('0xb')](_0x487711,function(_0x24f410,_0x273df1){if(_0x24f410){return _0x1d55d3(_0x24f410);}pm2[_0xfd76('0x8')]();return _0x204639(_0x273df1);});});});};exports['delete']=function(_0x525c8d){return connect()[_0xfd76('0x6')](function(){return new BPromise(function(_0x9e6204,_0x45230e){return pm2[_0xfd76('0xc')](_0x525c8d,function(_0x340228,_0x236d02){if(_0x340228){return _0x45230e(_0x340228);}pm2[_0xfd76('0x8')]();return _0x9e6204(_0x236d02);});});});};exports[_0xfd76('0xd')]=function(){return connect()[_0xfd76('0x6')](function(){return new BPromise(function(_0x4580d0,_0x1a7200){return pm2[_0xfd76('0xd')](function(_0x314754){if(_0x314754){return _0x1a7200(_0x314754);}return _0x4580d0(_0xfd76('0xe'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index d599b95..8ba6265 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 _0xcb5d=['system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update'];(function(_0xbaf0e0,_0x14d9fc){var _0x12ee7f=function(_0x1fbaee){while(--_0x1fbaee){_0xbaf0e0['push'](_0xbaf0e0['shift']());}};_0x12ee7f(++_0x14d9fc);}(_0xcb5d,0x82));var _0xdcb5=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xcb5d[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var moment=require(_0xdcb5('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0xdcb5('0x1'));var db=require('../../mysqldb')['db'];var logger=require(_0xdcb5('0x2'))(_0xdcb5('0x3'));config[_0xdcb5('0x4')]=_['defaults'](config[_0xdcb5('0x4')],{'host':_0xdcb5('0x5'),'port':0x18eb});var io=require(_0xdcb5('0x6'))(new Redis(config[_0xdcb5('0x4')]));function closeInteractions(){var _0x25ac60=0x0;var _0x7bfe73=[];return db['Setting'][_0xdcb5('0x7')]({'raw':!![],'attributes':['id',_0xdcb5('0x8')],'where':{'id':0x1}})[_0xdcb5('0x9')](function(_0x4186be){_0x25ac60=_0x4186be[_0xdcb5('0x8')];if(_0x25ac60){return db[_0xdcb5('0xa')][_0xdcb5('0xb')]({'raw':!![],'attributes':['id',_0xdcb5('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xdcb5('0xd')](_0x4186be['chatTimeout'],'minutes')}}});}else{return[];}})[_0xdcb5('0x9')](function(_0x59db03){if(_0x59db03&&_0x59db03[_0xdcb5('0xe')]){_0x7bfe73=_[_0xdcb5('0xf')](_0x59db03||[],'id');logger[_0xdcb5('0x10')](_0xdcb5('0x11'),_0x7bfe73[_0xdcb5('0x12')]());return db['ChatInteraction'][_0xdcb5('0x13')]({'closeReason':_0xdcb5('0x14'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xdcb5('0x15')](_0xdcb5('0x16'))},{'where':{'id':_0x7bfe73}});}})[_0xdcb5('0x9')](function(){if(_0x7bfe73&&_0x7bfe73['length']){logger[_0xdcb5('0x10')](_0xdcb5('0x17'),_0x7bfe73['join']());for(var _0x4d2003=0x0;_0x4d2003<_0x7bfe73[_0xdcb5('0xe')];_0x4d2003++){io['emit'](_0xdcb5('0x18'),{'id':_0x7bfe73[_0x4d2003],'closed':!![]});}}})[_0xdcb5('0x19')](function(_0xee192e){logger[_0xdcb5('0x1a')](_0xdcb5('0x1b'),_0xee192e?util[_0xdcb5('0x1c')](_0xee192e,{'showHidden':![],'depth':null}):'');});}exports[_0xdcb5('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x2a49=['subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt'];(function(_0x2753d2,_0x491941){var _0x439f90=function(_0x531bb4){while(--_0x531bb4){_0x2753d2['push'](_0x2753d2['shift']());}};_0x439f90(++_0x491941);}(_0x2a49,0x17b));var _0x92a4=function(_0x2f3a28,_0x5ca175){_0x2f3a28=_0x2f3a28-0x0;var _0x354f41=_0x2a49[_0x2f3a28];return _0x354f41;};'use strict';var _=require(_0x92a4('0x0'));var moment=require(_0x92a4('0x1'));var Redis=require(_0x92a4('0x2'));var util=require(_0x92a4('0x3'));var config=require('../../config/environment');var db=require(_0x92a4('0x4'))['db'];var logger=require(_0x92a4('0x5'))(_0x92a4('0x6'));config[_0x92a4('0x7')]=_[_0x92a4('0x8')](config[_0x92a4('0x7')],{'host':_0x92a4('0x9'),'port':0x18eb});var io=require(_0x92a4('0xa'))(new Redis(config[_0x92a4('0x7')]));function closeInteractions(){var _0x145811=0x0;var _0x3aa0aa=[];return db[_0x92a4('0xb')][_0x92a4('0xc')]({'raw':!![],'attributes':['id',_0x92a4('0xd')],'where':{'id':0x1}})[_0x92a4('0xe')](function(_0x1687f1){_0x145811=_0x1687f1[_0x92a4('0xd')];if(_0x145811){return db[_0x92a4('0xf')]['findAll']({'raw':!![],'attributes':['id',_0x92a4('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x92a4('0x11')](_0x1687f1['chatTimeout'],_0x92a4('0x12'))}}});}else{return[];}})['then'](function(_0x3bd9e9){if(_0x3bd9e9&&_0x3bd9e9[_0x92a4('0x13')]){_0x3aa0aa=_[_0x92a4('0x14')](_0x3bd9e9||[],'id');logger[_0x92a4('0x15')](_0x92a4('0x16'),_0x3aa0aa[_0x92a4('0x17')]());return db['ChatInteraction'][_0x92a4('0x18')]({'closeReason':_0x92a4('0x19'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x92a4('0x1a'))},{'where':{'id':_0x3aa0aa}});}})[_0x92a4('0xe')](function(){if(_0x3aa0aa&&_0x3aa0aa[_0x92a4('0x13')]){logger[_0x92a4('0x15')](_0x92a4('0x1b'),_0x3aa0aa[_0x92a4('0x17')]());for(var _0x37c3ee=0x0;_0x37c3ee<_0x3aa0aa[_0x92a4('0x13')];_0x37c3ee++){io['emit'](_0x92a4('0x1c'),{'id':_0x3aa0aa[_0x37c3ee],'closed':!![]});}}})['catch'](function(_0xcc63db){logger[_0x92a4('0x1d')](_0x92a4('0x1e'),_0xcc63db?util[_0x92a4('0x1f')](_0xcc63db,{'showHidden':![],'depth':null}):'');});}exports[_0x92a4('0x20')]=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 b820abe..435b3a0 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 _0x13e5=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x5294c1,_0x8dfcd7){var _0x419b17=function(_0x11b5d4){while(--_0x11b5d4){_0x5294c1['push'](_0x5294c1['shift']());}};_0x419b17(++_0x8dfcd7);}(_0x13e5,0x173));var _0x513e=function(_0x3439fd,_0x202462){_0x3439fd=_0x3439fd-0x0;var _0x9d6e86=_0x13e5[_0x3439fd];return _0x9d6e86;};'use strict';function start(){var _0x538997=require(_0x513e('0x0'));return _0x538997[_0x513e('0x1')]();}module[_0x513e('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x7776=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0xaf7e43,_0x3b2cc3){var _0x10b0fc=function(_0x3f1ba6){while(--_0x3f1ba6){_0xaf7e43['push'](_0xaf7e43['shift']());}};_0x10b0fc(++_0x3b2cc3);}(_0x7776,0x1aa));var _0x6777=function(_0x1ae6a8,_0x488651){_0x1ae6a8=_0x1ae6a8-0x0;var _0x27699d=_0x7776[_0x1ae6a8];return _0x27699d;};'use strict';function start(){var _0x3c7cdc=require(_0x6777('0x0'));return _0x3c7cdc[_0x6777('0x1')]();}module[_0x6777('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 058da71..6de2cfa 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 _0x8e29=['../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','info','email','MailAccount','name','user','bcc','subtractNumber','subtractUnit','join','../../files/reports','savename','format','basename','extname','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','request','then','error\x20mail','email\x20sent','catch','error','data','Smtp','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','isNil','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','start','stop\x20cron','update\x20cron','run','util','path','lodash','jayson/promise','bluebird','schedule'];(function(_0x261520,_0x14f629){var _0x2aa400=function(_0x262d3c){while(--_0x262d3c){_0x261520['push'](_0x261520['shift']());}};_0x2aa400(++_0x14f629);}(_0x8e29,0x94));var _0x98e2=function(_0x12f4e5,_0x159c80){_0x12f4e5=_0x12f4e5-0x0;var _0x10f23d=_0x8e29[_0x12f4e5];return _0x10f23d;};'use strict';var fs=require('fs');var util=require(_0x98e2('0x0'));var path=require(_0x98e2('0x1'));var _=require(_0x98e2('0x2'));var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x98e2('0x3'));var BPromise=require(_0x98e2('0x4'));var logger=require('../logger')(_0x98e2('0x5'));var db=require(_0x98e2('0x6'))['db'];var analyticCustomReportController=require(_0x98e2('0x7'));var analyticDefaultReportController=require(_0x98e2('0x8'));var client=jayson['client'][_0x98e2('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2184df,_0x347300){return function(){logger[_0x98e2('0xa')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x2184df[_0x98e2('0xb')]);var _0x7c27ce=!![];var _0x166b39=_0x2184df[_0x98e2('0xc')]['getSmtpOptions']();var _0x2e288c={'account':_0x166b39,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x2184df[_0x98e2('0xc')][_0x98e2('0xd')],_0x2184df[_0x98e2('0xc')][_0x98e2('0xb')]||_0x2184df[_0x98e2('0xc')]['Smtp'][_0x98e2('0xe')]),'to':_0x2184df['email'],'cc':_0x2184df['cc'],'bcc':_0x2184df[_0x98e2('0xf')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x347300['name'],_0x2184df[_0x98e2('0x10')],_0x2184df[_0x98e2('0x11')])}};var _0x5b6d61=path[_0x98e2('0x12')](__dirname,_0x98e2('0x13'));var _0x19b7fe=_0x347300[_0x98e2('0x14')];var _0x4fe4e6=util[_0x98e2('0x15')]('%s.%s',path[_0x98e2('0x16')](_0x347300[_0x98e2('0x14')],path[_0x98e2('0x17')](_0x347300[_0x98e2('0x14')])),'zip');var _0x260b94=path[_0x98e2('0x12')](_0x5b6d61,_0x19b7fe);var _0x32ddd7=path['join'](_0x5b6d61,_0x4fe4e6);if(fs[_0x98e2('0x18')](_0x260b94)){_0x347300[_0x98e2('0x19')]=_0x98e2('0x1a');_0x2e288c[_0x98e2('0x1b')][_0x98e2('0x1c')]=[{'filename':_0x19b7fe,'path':_0x260b94}];_0x2e288c[_0x98e2('0x1b')][_0x98e2('0x1d')]=util[_0x98e2('0x15')](_0x98e2('0x1e'),JSON[_0x98e2('0x1f')](_0x347300,null,0x2));}else if(fs[_0x98e2('0x18')](_0x32ddd7)){_0x347300[_0x98e2('0x19')]='Sent';_0x2e288c[_0x98e2('0x1b')][_0x98e2('0x1c')]=[{'filename':_0x4fe4e6,'path':_0x32ddd7}];}else{_0x2e288c[_0x98e2('0x1b')]['text']=_0x98e2('0x20');if(!_0x2184df['sendIfEmpty']){_0x7c27ce=![];logger[_0x98e2('0xa')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x7c27ce){return client[_0x98e2('0x21')]('SendMail',_0x2e288c)[_0x98e2('0x22')](function(_0x146c97){if(_0x146c97['error']){return logger['error'](_0x98e2('0x23'),JSON[_0x98e2('0x1f')](_0x146c97));}return logger[_0x98e2('0xa')](_0x98e2('0x24'));})[_0x98e2('0x25')](function(_0x474d79){return logger[_0x98e2('0x26')](_0x98e2('0x23'),JSON[_0x98e2('0x1f')](_0x474d79));});}};}function handleError(){return function(_0x253f2c){return logger[_0x98e2('0x26')](JSON[_0x98e2('0x1f')](_0x253f2c));};}function handleResult(_0x4eb744){return function(_0x1f8f7a){logger[_0x98e2('0xa')](_0x98e2('0x27'),JSON[_0x98e2('0x1f')](_0x1f8f7a));if(_0x4eb744[_0x98e2('0xc')]&&_0x4eb744[_0x98e2('0xc')][_0x98e2('0x28')]&&!_['isNil'](_0x4eb744[_0x98e2('0xb')])){setTimeout(handleSendEmail(_0x4eb744,_0x1f8f7a),0x3c*0x3e8);}};}function handleJob(_0x554e90){return function(){try{if(_['isNil'](_0x554e90[_0x98e2('0x10')])){return logger[_0x98e2('0xa')](_0x98e2('0x29'));}if(_['isNil'](_0x554e90[_0x98e2('0x11')])){return logger[_0x98e2('0xa')](_0x98e2('0x2a'));}var _0x115868={'startDate':moment()['subtract'](_0x554e90[_0x98e2('0x10')],_0x554e90[_0x98e2('0x11')])[_0x98e2('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x98e2('0x2b')),'type':_0x98e2('0x2c'),'output':_0x554e90[_0x98e2('0x2d')],'name':_0x554e90[_0x98e2('0xd')]};if(!_[_0x98e2('0x2e')](_0x554e90[_0x98e2('0x2f')])){logger[_0x98e2('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x554e90[_0x98e2('0x2f')]);return analyticDefaultReportController[_0x98e2('0x30')]({'id':_0x554e90[_0x98e2('0x2f')]},_0x115868)[_0x98e2('0x22')](handleResult(_0x554e90))[_0x98e2('0x25')](handleError());}if(!_[_0x98e2('0x2e')](_0x554e90['CustomReportId'])){logger['info'](_0x98e2('0x31'),_0x554e90[_0x98e2('0x32')]);return analyticCustomReportController[_0x98e2('0x30')]({'id':_0x554e90[_0x98e2('0x32')]},_0x115868)[_0x98e2('0x22')](handleResult(_0x554e90))[_0x98e2('0x25')](handleError());}}catch(_0x44e5cd){logger['error'](JSON[_0x98e2('0x1f')](_0x44e5cd));}return logger[_0x98e2('0xa')](_0x98e2('0x33'));};}function getJobs(_0x432913){var _0x19ff40={};if(_0x432913){_0x19ff40['id']=_0x432913;}return db[_0x98e2('0x34')][_0x98e2('0x35')]({'where':_0x19ff40,'include':[{'model':db[_0x98e2('0xc')],'attributes':['id',_0x98e2('0xd'),_0x98e2('0xb')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})['then'](function(_0x37358e){var _0x537e3a=_[_0x98e2('0x36')](manager['jobs']);var _0x18bae4=_[_0x98e2('0x37')](_0x37358e,function(_0x215392){return _0x215392['id'][_0x98e2('0x38')]();});var _0x565994=_[_0x98e2('0x39')](_0x37358e,function(_0x2aebe1){return _0x2aebe1['id'][_0x98e2('0x38')]();});var _0x4d9cd0=_0x432913?_0x18bae4:_[_0x98e2('0x3a')](_0x18bae4,_0x537e3a);var _0x47f3e5=_[_0x98e2('0x3b')](_0x18bae4,_0x537e3a);var _0x240a00=_[_0x98e2('0x3a')](_0x537e3a,_0x18bae4);var _0x258863;var _0x3c967e;for(_0x258863=0x0;_0x258863<_0x240a00[_0x98e2('0x3c')]&&!_0x432913;_0x258863+=0x1){_0x3c967e=_0x240a00[_0x258863][_0x98e2('0x38')]();if(manager[_0x98e2('0x3d')](_0x3c967e)){manager[_0x98e2('0x3e')](_0x3c967e);manager['deleteJob'](_0x3c967e);logger['info'](_0x98e2('0x3f'),_0x3c967e);}}logger[_0x98e2('0xa')](_0x98e2('0x40'),JSON[_0x98e2('0x1f')](_0x4d9cd0));for(_0x258863=0x0;_0x258863<_0x4d9cd0[_0x98e2('0x3c')];_0x258863+=0x1){_0x3c967e=_0x4d9cd0[_0x258863][_0x98e2('0x38')]();logger['info']('index',_0x3c967e);if(_0x432913){logger[_0x98e2('0xa')](_0x98e2('0x41'),_0x432913);logger['info'](JSON['stringify'](_0x565994[_0x3c967e]));BPromise[_0x98e2('0x42')]()[_0x98e2('0x22')](handleJob(_0x565994[_0x3c967e]));logger[_0x98e2('0xa')]('run\x20job',_0x565994[_0x3c967e]['name'],_0x565994[_0x3c967e][_0x98e2('0x43')]);}else if(_0x565994[_0x3c967e][_0x98e2('0x43')]&&_0x565994[_0x3c967e][_0x98e2('0x44')]&&moment()[_0x98e2('0x45')](_0x565994[_0x3c967e][_0x98e2('0x46')],_0x565994[_0x3c967e][_0x98e2('0x47')])){manager[_0x98e2('0x48')](_0x3c967e,_0x565994[_0x3c967e]['cron'],handleJob(_0x565994[_0x3c967e]));manager[_0x98e2('0x49')](_0x3c967e);logger['info']('add\x20cron',_0x565994[_0x3c967e][_0x98e2('0xd')],_0x565994[_0x3c967e][_0x98e2('0x43')]);}else if(manager[_0x98e2('0x3d')](_0x3c967e)){manager[_0x98e2('0x3e')](_0x3c967e);manager['deleteJob'](_0x3c967e);logger[_0x98e2('0xa')](_0x98e2('0x4a'),_0x565994[_0x3c967e]['name'],_0x565994[_0x3c967e]['cron']);}}for(_0x258863=0x0,_0x3c967e;_0x258863<_0x47f3e5['length']&&!_0x432913;_0x258863+=0x1){_0x3c967e=_0x47f3e5[_0x258863][_0x98e2('0x38')]();if(manager[_0x98e2('0x3d')](_0x3c967e)){if(_0x565994[_0x3c967e][_0x98e2('0x43')]&&_0x565994[_0x3c967e]['active']&&moment()['isBetween'](_0x565994[_0x3c967e][_0x98e2('0x46')],_0x565994[_0x3c967e][_0x98e2('0x47')])){manager['update'](_0x3c967e,_0x565994[_0x3c967e][_0x98e2('0x43')],handleJob(_0x565994[_0x3c967e]));logger[_0x98e2('0xa')](_0x98e2('0x4b'),_0x565994[_0x3c967e][_0x98e2('0xd')],_0x565994[_0x3c967e][_0x98e2('0x43')]);}else{manager[_0x98e2('0x3e')](_0x3c967e);manager['deleteJob'](_0x3c967e);logger[_0x98e2('0xa')](_0x98e2('0x4a'),_0x565994[_0x3c967e][_0x98e2('0xd')],_0x565994[_0x3c967e][_0x98e2('0x43')]);}}}})[_0x98e2('0x25')](function(_0x34b0a8){logger[_0x98e2('0x26')](JSON['stringify'](_0x34b0a8));});}exports[_0x98e2('0x4c')]=function(_0x52a03c){return getJobs(_0x52a03c);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x73a2=['bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','basename','savename','extname','zip','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','request','SendMail','error','error\x20mail','email\x20sent','catch','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','then','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','toString','difference','intersection','length','exists','toRun','index','resolve','run\x20job','cron','active','isBetween','startAt','start','add\x20cron','stop','deleteJob','stop\x20cron','endAt','update','update\x20cron','util','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','email','Smtp'];(function(_0x2fe611,_0x2b1a82){var _0x8645d7=function(_0x2bf2fb){while(--_0x2bf2fb){_0x2fe611['push'](_0x2fe611['shift']());}};_0x8645d7(++_0x2b1a82);}(_0x73a2,0x12a));var _0x273a=function(_0x3dd4a7,_0x334013){_0x3dd4a7=_0x3dd4a7-0x0;var _0x4ef8e0=_0x73a2[_0x3dd4a7];return _0x4ef8e0;};'use strict';var fs=require('fs');var util=require(_0x273a('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x273a('0x1'));var jayson=require(_0x273a('0x2'));var BPromise=require(_0x273a('0x3'));var logger=require(_0x273a('0x4'))(_0x273a('0x5'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x273a('0x6'));var analyticDefaultReportController=require(_0x273a('0x7'));var client=jayson[_0x273a('0x8')][_0x273a('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x1b05a2,_0x5325b3){return function(){logger['info'](_0x273a('0xa'),_0x1b05a2['email']);var _0x1a7235=!![];var _0x1d9217=_0x1b05a2[_0x273a('0xb')][_0x273a('0xc')]();var _0x3cf07d={'account':_0x1d9217,'message':{'from':util[_0x273a('0xd')](_0x273a('0xe'),_0x1b05a2[_0x273a('0xb')][_0x273a('0xf')],_0x1b05a2[_0x273a('0xb')][_0x273a('0x10')]||_0x1b05a2[_0x273a('0xb')][_0x273a('0x11')]['user']),'to':_0x1b05a2[_0x273a('0x10')],'cc':_0x1b05a2['cc'],'bcc':_0x1b05a2[_0x273a('0x12')],'subject':util[_0x273a('0xd')](_0x273a('0x13'),_0x5325b3[_0x273a('0xf')],_0x1b05a2[_0x273a('0x14')],_0x1b05a2[_0x273a('0x15')])}};var _0x5a531a=path[_0x273a('0x16')](__dirname,_0x273a('0x17'));var _0x6f7057=_0x5325b3['savename'];var _0x41e16d=util['format']('%s.%s',path[_0x273a('0x18')](_0x5325b3[_0x273a('0x19')],path[_0x273a('0x1a')](_0x5325b3[_0x273a('0x19')])),_0x273a('0x1b'));var _0x394e07=path['join'](_0x5a531a,_0x6f7057);var _0x2acb91=path[_0x273a('0x16')](_0x5a531a,_0x41e16d);if(fs[_0x273a('0x1c')](_0x394e07)){_0x5325b3[_0x273a('0x1d')]=_0x273a('0x1e');_0x3cf07d['message'][_0x273a('0x1f')]=[{'filename':_0x6f7057,'path':_0x394e07}];_0x3cf07d[_0x273a('0x20')][_0x273a('0x21')]=util[_0x273a('0xd')](_0x273a('0x22'),JSON[_0x273a('0x23')](_0x5325b3,null,0x2));}else if(fs[_0x273a('0x1c')](_0x2acb91)){_0x5325b3[_0x273a('0x1d')]='Sent';_0x3cf07d[_0x273a('0x20')]['attachments']=[{'filename':_0x41e16d,'path':_0x2acb91}];}else{_0x3cf07d[_0x273a('0x20')][_0x273a('0x21')]=_0x273a('0x24');if(!_0x1b05a2['sendIfEmpty']){_0x1a7235=![];logger[_0x273a('0x25')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0x1a7235){return client[_0x273a('0x26')](_0x273a('0x27'),_0x3cf07d)['then'](function(_0x1d681e){if(_0x1d681e[_0x273a('0x28')]){return logger[_0x273a('0x28')](_0x273a('0x29'),JSON[_0x273a('0x23')](_0x1d681e));}return logger['info'](_0x273a('0x2a'));})[_0x273a('0x2b')](function(_0x4e34f2){return logger[_0x273a('0x28')](_0x273a('0x29'),JSON[_0x273a('0x23')](_0x4e34f2));});}};}function handleError(){return function(_0x3eae4){return logger['error'](JSON[_0x273a('0x23')](_0x3eae4));};}function handleResult(_0x565582){return function(_0x59feb3){logger['info']('data',JSON[_0x273a('0x23')](_0x59feb3));if(_0x565582[_0x273a('0xb')]&&_0x565582['MailAccount']['Smtp']&&!_['isNil'](_0x565582[_0x273a('0x10')])){setTimeout(handleSendEmail(_0x565582,_0x59feb3),0x3c*0x3e8);}};}function handleJob(_0x5dbb34){return function(){try{if(_[_0x273a('0x2c')](_0x5dbb34[_0x273a('0x14')])){return logger[_0x273a('0x25')](_0x273a('0x2d'));}if(_[_0x273a('0x2c')](_0x5dbb34['subtractUnit'])){return logger['info'](_0x273a('0x2e'));}var _0x57c1ab={'startDate':moment()['subtract'](_0x5dbb34[_0x273a('0x14')],_0x5dbb34[_0x273a('0x15')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0x273a('0xd')](_0x273a('0x2f')),'type':_0x273a('0x30'),'output':_0x5dbb34['output'],'name':_0x5dbb34[_0x273a('0xf')]};if(!_[_0x273a('0x2c')](_0x5dbb34[_0x273a('0x31')])){logger['info'](_0x273a('0x32'),_0x5dbb34['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x5dbb34[_0x273a('0x31')]},_0x57c1ab)[_0x273a('0x33')](handleResult(_0x5dbb34))[_0x273a('0x2b')](handleError());}if(!_[_0x273a('0x2c')](_0x5dbb34['CustomReportId'])){logger[_0x273a('0x25')]('exec\x20custom\x20report\x20id:%s',_0x5dbb34[_0x273a('0x34')]);return analyticCustomReportController['runReport']({'id':_0x5dbb34[_0x273a('0x34')]},_0x57c1ab)['then'](handleResult(_0x5dbb34))['catch'](handleError());}}catch(_0x3f8208){logger[_0x273a('0x28')](JSON['stringify'](_0x3f8208));}return logger[_0x273a('0x25')](_0x273a('0x35'));};}function getJobs(_0x47cd31){var _0x55fc2d={};if(_0x47cd31){_0x55fc2d['id']=_0x47cd31;}return db[_0x273a('0x36')][_0x273a('0x37')]({'where':_0x55fc2d,'include':[{'model':db['MailAccount'],'attributes':['id','name',_0x273a('0x10')],'include':[{'model':db['MailServerOut'],'as':_0x273a('0x11'),'include':[{'model':db[_0x273a('0x38')],'as':_0x273a('0x38')}]}]}]})[_0x273a('0x33')](function(_0x174b27){var _0xd79974=_[_0x273a('0x39')](manager['jobs']);var _0x784a7a=_['map'](_0x174b27,function(_0x56a56a){return _0x56a56a['id'][_0x273a('0x3a')]();});var _0x48aeb3=_['keyBy'](_0x174b27,function(_0x294d84){return _0x294d84['id'][_0x273a('0x3a')]();});var _0x508bb2=_0x47cd31?_0x784a7a:_[_0x273a('0x3b')](_0x784a7a,_0xd79974);var _0x2346a0=_[_0x273a('0x3c')](_0x784a7a,_0xd79974);var _0x70a29=_['difference'](_0xd79974,_0x784a7a);var _0x5901ec;var _0x944a7a;for(_0x5901ec=0x0;_0x5901ec<_0x70a29[_0x273a('0x3d')]&&!_0x47cd31;_0x5901ec+=0x1){_0x944a7a=_0x70a29[_0x5901ec][_0x273a('0x3a')]();if(manager[_0x273a('0x3e')](_0x944a7a)){manager['stop'](_0x944a7a);manager['deleteJob'](_0x944a7a);logger[_0x273a('0x25')]('delete\x20cron',_0x944a7a);}}logger[_0x273a('0x25')](_0x273a('0x3f'),JSON[_0x273a('0x23')](_0x508bb2));for(_0x5901ec=0x0;_0x5901ec<_0x508bb2[_0x273a('0x3d')];_0x5901ec+=0x1){_0x944a7a=_0x508bb2[_0x5901ec][_0x273a('0x3a')]();logger[_0x273a('0x25')](_0x273a('0x40'),_0x944a7a);if(_0x47cd31){logger[_0x273a('0x25')]('my\x20id',_0x47cd31);logger['info'](JSON['stringify'](_0x48aeb3[_0x944a7a]));BPromise[_0x273a('0x41')]()[_0x273a('0x33')](handleJob(_0x48aeb3[_0x944a7a]));logger[_0x273a('0x25')](_0x273a('0x42'),_0x48aeb3[_0x944a7a][_0x273a('0xf')],_0x48aeb3[_0x944a7a]['cron']);}else if(_0x48aeb3[_0x944a7a][_0x273a('0x43')]&&_0x48aeb3[_0x944a7a][_0x273a('0x44')]&&moment()[_0x273a('0x45')](_0x48aeb3[_0x944a7a][_0x273a('0x46')],_0x48aeb3[_0x944a7a]['endAt'])){manager['add'](_0x944a7a,_0x48aeb3[_0x944a7a]['cron'],handleJob(_0x48aeb3[_0x944a7a]));manager[_0x273a('0x47')](_0x944a7a);logger[_0x273a('0x25')](_0x273a('0x48'),_0x48aeb3[_0x944a7a][_0x273a('0xf')],_0x48aeb3[_0x944a7a]['cron']);}else if(manager['exists'](_0x944a7a)){manager[_0x273a('0x49')](_0x944a7a);manager[_0x273a('0x4a')](_0x944a7a);logger['info'](_0x273a('0x4b'),_0x48aeb3[_0x944a7a]['name'],_0x48aeb3[_0x944a7a][_0x273a('0x43')]);}}for(_0x5901ec=0x0,_0x944a7a;_0x5901ec<_0x2346a0[_0x273a('0x3d')]&&!_0x47cd31;_0x5901ec+=0x1){_0x944a7a=_0x2346a0[_0x5901ec][_0x273a('0x3a')]();if(manager[_0x273a('0x3e')](_0x944a7a)){if(_0x48aeb3[_0x944a7a][_0x273a('0x43')]&&_0x48aeb3[_0x944a7a][_0x273a('0x44')]&&moment()['isBetween'](_0x48aeb3[_0x944a7a][_0x273a('0x46')],_0x48aeb3[_0x944a7a][_0x273a('0x4c')])){manager[_0x273a('0x4d')](_0x944a7a,_0x48aeb3[_0x944a7a][_0x273a('0x43')],handleJob(_0x48aeb3[_0x944a7a]));logger[_0x273a('0x25')](_0x273a('0x4e'),_0x48aeb3[_0x944a7a]['name'],_0x48aeb3[_0x944a7a][_0x273a('0x43')]);}else{manager[_0x273a('0x49')](_0x944a7a);manager[_0x273a('0x4a')](_0x944a7a);logger[_0x273a('0x25')]('stop\x20cron',_0x48aeb3[_0x944a7a][_0x273a('0xf')],_0x48aeb3[_0x944a7a]['cron']);}}}})[_0x273a('0x2b')](function(_0x4770fe){logger[_0x273a('0x28')](JSON[_0x273a('0x23')](_0x4770fe));});}exports['run']=function(_0xc00875){return getJobs(_0xc00875);};exports[_0x273a('0x47')]=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 9cd38c3..b60eb18 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 _0xe7b9=['forEach','all','start','lodash','aws-sdk','request-promise','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','transcribeRegion','then','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','fileText','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','sentimentAccountId','data1','Cloud\x20Provider\x20not\x20configured','data2','Sentiment','SentimentScore','Negative','Neutral','update','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Mixed','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','findOne','transcribe','transcribeAccountId','Transcribe\x20not\x20configured'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe7b9,0x170));var _0x9e7b=function(_0x7aecb0,_0x2b5d3d){_0x7aecb0=_0x7aecb0-0x0;var _0x55bbbe=_0xe7b9[_0x7aecb0];return _0x55bbbe;};var _=require(_0x9e7b('0x0'));var AWS=require(_0x9e7b('0x1'));var rp=require(_0x9e7b('0x2'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x9e7b('0x3'))['db'];var logger=require(_0x9e7b('0x4'))('transcribe');function getTranscriptionJob(_0x48b654,_0xc8f709,_0x53cec5,_0xe1692e){return new Promise(function(_0x543b7e,_0x4dda21){var _0x1e2f86=new AWS[(_0x9e7b('0x5'))]({'accessKeyId':_0xc8f709,'secretAccessKey':_0x48b654,'region':_0x53cec5});_0x1e2f86[_0x9e7b('0x6')]({'TranscriptionJobName':_0xe1692e},function(_0x5ed982,_0x46e445){if(_0x5ed982){return _0x4dda21(_0x5ed982);}else{return _0x543b7e(_0x46e445);}});});}function sentiment(_0x3166ec,_0x35640b,_0x128bac,_0xc8bbba,_0x5cfbb5){return new Promise(function(_0x47b442,_0x5a36ca){var _0xe74d52=new AWS[(_0x9e7b('0x7'))]({'accessKeyId':_0x35640b,'secretAccessKey':_0x3166ec,'region':_0x128bac});_0xe74d52[_0x9e7b('0x8')]({'Text':_0xc8bbba,'LanguageCode':_0x5cfbb5[_0x9e7b('0x9')](0x0,0x2)},function(_0x187278,_0x1a8b4b){if(_0x187278){return _0x5a36ca(_0x187278);}else{return _0x47b442(_0x1a8b4b);}});});}function checkTranscribeJob(_0x5bd9ad,_0x1ab7d0,_0x41cd2c){var _0x2aca68;return new BPromise(function(_0x327875,_0x4af825){logger[_0x9e7b('0xa')](util['format'](_0x9e7b('0xb'),_0x5bd9ad['id'],_0x5bd9ad[_0x9e7b('0xc')]));return getTranscriptionJob(_0x41cd2c['data1'],_0x41cd2c['data2'],_0x1ab7d0[_0x9e7b('0xd')],_0x5bd9ad[_0x9e7b('0xc')])[_0x9e7b('0xe')](function(_0x59b4b3){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')](_0x9e7b('0x10'),_0x5bd9ad['id'],_0x5bd9ad[_0x9e7b('0xc')],_0x59b4b3[_0x9e7b('0x11')][_0x9e7b('0x12')]));if(!_0x5bd9ad['fileText']){switch(_0x59b4b3[_0x9e7b('0x11')][_0x9e7b('0x12')]){case _0x9e7b('0x13'):var _0x451dff={'transcribeStatus':_0x59b4b3[_0x9e7b('0x11')][_0x9e7b('0x12')],'fileUri':_0x59b4b3['TranscriptionJob']['Transcript'][_0x9e7b('0x14')]};logger[_0x9e7b('0xa')](util['format'](_0x9e7b('0x15'),_0x5bd9ad['id']));return rp({'uri':_0x59b4b3[_0x9e7b('0x11')][_0x9e7b('0x16')][_0x9e7b('0x14')],'json':!![]})[_0x9e7b('0xe')](function(_0x622932){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x5bd9ad['id']));if(_0x622932&&_0x622932[_0x9e7b('0x17')]&&_0x622932[_0x9e7b('0x17')][_0x9e7b('0x18')]&&_0x622932[_0x9e7b('0x17')][_0x9e7b('0x18')][_0x9e7b('0x19')]){_0x451dff[_0x9e7b('0x1a')]='';for(var _0x49a4c5=0x0;_0x49a4c5<_0x622932['results'][_0x9e7b('0x18')][_0x9e7b('0x19')];_0x49a4c5++){_0x451dff[_0x9e7b('0x1a')]+=_0x622932['results'][_0x9e7b('0x18')][_0x49a4c5]['transcript']+'';}}return _0x5bd9ad['update'](_0x451dff);})[_0x9e7b('0xe')](function(){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')](_0x9e7b('0x1b'),_0x5bd9ad['id']));if(!_0x5bd9ad[_0x9e7b('0x1c')]){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))](_0x9e7b('0x1f'));}if(!_0x1ab7d0[_0x9e7b('0x20')]||!_0x1ab7d0['sentimentAccountId']||!_0x1ab7d0[_0x9e7b('0x21')]||!_0x1ab7d0[_0x9e7b('0x22')]||!_0x1ab7d0[_0x9e7b('0x23')]){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))](_0x9e7b('0x24'));}if(!_0x451dff['fileText']){throw new Error(_0x9e7b('0x25'));}if(_0x1ab7d0['sentimentAccountId']===_0x41cd2c['id']){return _0x41cd2c;}else{return db[_0x9e7b('0x26')]['findOne']({'where':{'id':_settings[_0x9e7b('0x27')]}});}})[_0x9e7b('0xe')](function(_0x5b5510){if(!_0x5b5510){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5b5510[_0x9e7b('0x28')]||!_0x5b5510['data2']){throw new db['Sequelize'][(_0x9e7b('0x1e'))](_0x9e7b('0x29'));}_0x2aca68=_0x5b5510;logger['info'](util[_0x9e7b('0xf')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5bd9ad['id']));return sentiment(_0x2aca68['data1'],_0x2aca68[_0x9e7b('0x2a')],_0x1ab7d0['sentimentRegion'],_0x451dff[_0x9e7b('0x1a')],_0x1ab7d0[_0x9e7b('0x22')]);})[_0x9e7b('0xe')](function(_0x1fbe38){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x5bd9ad['id']));return _0x5bd9ad['update']({'sentiment':_0x1fbe38[_0x9e7b('0x2b')],'sPositive':_0x1fbe38[_0x9e7b('0x2c')]['Positive'],'sNegative':_0x1fbe38[_0x9e7b('0x2c')][_0x9e7b('0x2d')],'sMixed':_0x1fbe38[_0x9e7b('0x2c')]['Mixed'],'sNeutral':_0x1fbe38[_0x9e7b('0x2c')][_0x9e7b('0x2e')]});})[_0x9e7b('0xe')](function(){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')](_0x9e7b('0x1b'),_0x5bd9ad['id']));_0x327875();});case'FAILED':return _0x5bd9ad[_0x9e7b('0x2f')]({'transcribeStatus':_0x9e7b('0x30'),'failureReason':_0x59b4b3[_0x9e7b('0x11')]['FailureReason']})[_0x9e7b('0xe')](function(){logger['info'](util['format'](_0x9e7b('0x1b'),_0x5bd9ad['id']));_0x327875();});default:logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')](_0x9e7b('0x31'),_0x5bd9ad['id']));break;}}else{return BPromise[_0x9e7b('0x32')]()[_0x9e7b('0xe')](function(){if(!_0x5bd9ad[_0x9e7b('0x1c')]){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x1ab7d0['sentiment']||!_0x1ab7d0[_0x9e7b('0x27')]||!_0x1ab7d0[_0x9e7b('0x21')]||!_0x1ab7d0[_0x9e7b('0x22')]||!_0x1ab7d0[_0x9e7b('0x23')]){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))](_0x9e7b('0x24'));}if(!_0x5bd9ad[_0x9e7b('0x1a')]){throw new Error(_0x9e7b('0x25'));}if(_0x1ab7d0[_0x9e7b('0x27')]===_0x41cd2c['id']){return _0x41cd2c;}else{return db[_0x9e7b('0x26')]['findOne']({'where':{'id':_settings[_0x9e7b('0x27')]}});}})[_0x9e7b('0xe')](function(_0x23bb24){if(!_0x23bb24){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))](_0x9e7b('0x33'));}if(!_0x23bb24[_0x9e7b('0x28')]||!_0x23bb24[_0x9e7b('0x2a')]){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))](_0x9e7b('0x29'));}_0x2aca68=_0x23bb24;logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')](_0x9e7b('0x34'),_0x5bd9ad['id']));return sentiment(_0x2aca68[_0x9e7b('0x28')],_0x2aca68['data2'],_0x1ab7d0[_0x9e7b('0x21')],_0x5bd9ad[_0x9e7b('0x1a')],_0x1ab7d0[_0x9e7b('0x22')]);})[_0x9e7b('0xe')](function(_0x398f94){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')](_0x9e7b('0x35'),_0x5bd9ad['id']));return _0x5bd9ad[_0x9e7b('0x2f')]({'sentiment':_0x398f94[_0x9e7b('0x2b')],'sPositive':_0x398f94[_0x9e7b('0x2c')][_0x9e7b('0x36')],'sNegative':_0x398f94[_0x9e7b('0x2c')][_0x9e7b('0x2d')],'sMixed':_0x398f94['SentimentScore'][_0x9e7b('0x37')],'sNeutral':_0x398f94[_0x9e7b('0x2c')][_0x9e7b('0x2e')],'transcribeStatus':_0x9e7b('0x13')});})[_0x9e7b('0xe')](function(){logger[_0x9e7b('0xa')](util[_0x9e7b('0xf')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5bd9ad['id']));_0x327875();});}})[_0x9e7b('0x38')](function(_0x116b62){if(_0x116b62){if(!_0x116b62['name']||_0x116b62[_0x9e7b('0x39')]!==_0x9e7b('0x3a')){logger[_0x9e7b('0x3b')](util[_0x9e7b('0xf')](_0x9e7b('0x3c'),_0x5bd9ad['id']),util[_0x9e7b('0x3d')](_0x116b62,{'showHidden':![],'depth':null}));}}_0x327875();});});}function checkTranscribe(){var _0x155158;var _0x3e3425;var _0x1f8a3f;return db[_0x9e7b('0x3e')][_0x9e7b('0x3f')]({'where':{'transcribeStatus':_0x9e7b('0x40')}})[_0x9e7b('0xe')](function(_0x40a996){if(!_0x40a996||!_0x40a996[_0x9e7b('0x19')]){throw new db[(_0x9e7b('0x1d'))]['ValidationError'](_0x9e7b('0x41'));}_0x155158=_0x40a996;return db['Setting'][_0x9e7b('0x42')]({'where':{'id':0x1}});})['then'](function(_0x36c875){if(!_0x36c875){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))]('Settings\x20not\x20available');}_0x3e3425=_0x36c875;if(!_0x3e3425[_0x9e7b('0x43')]||!_0x3e3425[_0x9e7b('0x44')]||!_0x3e3425['transcribeRegion']||!_0x3e3425[_0x9e7b('0x22')]||!_0x3e3425[_0x9e7b('0x23')]){throw new db[(_0x9e7b('0x1d'))]['ValidationError'](_0x9e7b('0x45'));}return db[_0x9e7b('0x26')][_0x9e7b('0x42')]({'where':{'id':_0x3e3425['transcribeAccountId']}});})['then'](function(_0x1ebb33){if(!_0x1ebb33){throw new db['Sequelize']['ValidationError'](_0x9e7b('0x33'));}if(!_0x1ebb33[_0x9e7b('0x28')]||!_0x1ebb33[_0x9e7b('0x2a')]){throw new db[(_0x9e7b('0x1d'))][(_0x9e7b('0x1e'))](_0x9e7b('0x29'));}_0x1f8a3f=_0x1ebb33;var _0x43b9d2=[];_0x155158[_0x9e7b('0x46')](function(_0x4448f4){_0x43b9d2['push'](checkTranscribeJob(_0x4448f4,_0x3e3425,_0x1f8a3f));});return BPromise[_0x9e7b('0x47')](_0x43b9d2);})[_0x9e7b('0x38')](function(_0x3ebc45){if(_0x3ebc45){if(!_0x3ebc45[_0x9e7b('0x39')]||_0x3ebc45['name']!=='SequelizeValidationError'){logger[_0x9e7b('0x3b')](util[_0x9e7b('0x3d')](_0x3ebc45,{'showHidden':![],'depth':null}));}}});}exports[_0x9e7b('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x2697=['SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','Settings\x20not\x20available','transcribeAccountId','Cloud\x20Provider\x20not\x20configured','forEach','push','all','start','aws-sdk','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','Sentiment','Positive','SentimentScore','Negative','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','sentiment','CloudProvider','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','catch','name'];(function(_0x29cfbe,_0x2c5232){var _0x3d629e=function(_0x4d2342){while(--_0x4d2342){_0x29cfbe['push'](_0x29cfbe['shift']());}};_0x3d629e(++_0x2c5232);}(_0x2697,0x120));var _0x7269=function(_0x3048ea,_0x3838c2){_0x3048ea=_0x3048ea-0x0;var _0x1a13c4=_0x2697[_0x3048ea];return _0x1a13c4;};var _=require('lodash');var AWS=require(_0x7269('0x0'));var rp=require(_0x7269('0x1'));var util=require(_0x7269('0x2'));var BPromise=require(_0x7269('0x3'));var db=require(_0x7269('0x4'))['db'];var logger=require('../../config/logger')(_0x7269('0x5'));function getTranscriptionJob(_0x4a084b,_0x5bc3e4,_0x2b2be8,_0x350aeb){return new Promise(function(_0x320ed5,_0x438f7c){var _0x1e47e3=new AWS[(_0x7269('0x6'))]({'accessKeyId':_0x5bc3e4,'secretAccessKey':_0x4a084b,'region':_0x2b2be8});_0x1e47e3[_0x7269('0x7')]({'TranscriptionJobName':_0x350aeb},function(_0x328097,_0x572969){if(_0x328097){return _0x438f7c(_0x328097);}else{return _0x320ed5(_0x572969);}});});}function sentiment(_0x2c5866,_0x5408ad,_0x33d5bc,_0x1395a1,_0x5c236a){return new Promise(function(_0x3c21f9,_0x5e1cbf){var _0x300f31=new AWS['Comprehend']({'accessKeyId':_0x5408ad,'secretAccessKey':_0x2c5866,'region':_0x33d5bc});_0x300f31[_0x7269('0x8')]({'Text':_0x1395a1,'LanguageCode':_0x5c236a['substring'](0x0,0x2)},function(_0x255fcb,_0xa7fec7){if(_0x255fcb){return _0x5e1cbf(_0x255fcb);}else{return _0x3c21f9(_0xa7fec7);}});});}function checkTranscribeJob(_0x404f34,_0x4c115b,_0x29a0ca){var _0x2c5957;return new BPromise(function(_0x5dbe57,_0x35cbf0){logger[_0x7269('0x9')](util[_0x7269('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x404f34['id'],_0x404f34[_0x7269('0xb')]));return getTranscriptionJob(_0x29a0ca[_0x7269('0xc')],_0x29a0ca[_0x7269('0xd')],_0x4c115b[_0x7269('0xe')],_0x404f34[_0x7269('0xb')])[_0x7269('0xf')](function(_0x880b51){logger[_0x7269('0x9')](util['format'](_0x7269('0x10'),_0x404f34['id'],_0x404f34[_0x7269('0xb')],_0x880b51[_0x7269('0x11')][_0x7269('0x12')]));if(!_0x404f34['fileText']){switch(_0x880b51['TranscriptionJob']['TranscriptionJobStatus']){case _0x7269('0x13'):var _0x1c9163={'transcribeStatus':_0x880b51[_0x7269('0x11')][_0x7269('0x12')],'fileUri':_0x880b51[_0x7269('0x11')][_0x7269('0x14')][_0x7269('0x15')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x404f34['id']));return rp({'uri':_0x880b51[_0x7269('0x11')]['Transcript'][_0x7269('0x15')],'json':!![]})['then'](function(_0x2a5a5c){logger[_0x7269('0x9')](util['format'](_0x7269('0x16'),_0x404f34['id']));if(_0x2a5a5c&&_0x2a5a5c[_0x7269('0x17')]&&_0x2a5a5c['results'][_0x7269('0x18')]&&_0x2a5a5c[_0x7269('0x17')][_0x7269('0x18')][_0x7269('0x19')]){_0x1c9163['fileText']='';for(var _0x2c7cf3=0x0;_0x2c7cf3<_0x2a5a5c[_0x7269('0x17')][_0x7269('0x18')][_0x7269('0x19')];_0x2c7cf3++){_0x1c9163[_0x7269('0x1a')]+=_0x2a5a5c[_0x7269('0x17')]['transcripts'][_0x2c7cf3][_0x7269('0x1b')]+'';}}return _0x404f34[_0x7269('0x1c')](_0x1c9163);})[_0x7269('0xf')](function(){logger[_0x7269('0x9')](util[_0x7269('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x404f34['id']));if(!_0x404f34[_0x7269('0x1d')]){throw new db[(_0x7269('0x1e'))]['ValidationError'](_0x7269('0x1f'));}if(!_0x4c115b['sentiment']||!_0x4c115b[_0x7269('0x20')]||!_0x4c115b[_0x7269('0x21')]||!_0x4c115b[_0x7269('0x22')]||!_0x4c115b[_0x7269('0x23')]){throw new db[(_0x7269('0x1e'))]['ValidationError'](_0x7269('0x24'));}if(!_0x1c9163[_0x7269('0x1a')]){throw new Error(_0x7269('0x25'));}if(_0x4c115b[_0x7269('0x20')]===_0x29a0ca['id']){return _0x29a0ca;}else{return db['CloudProvider'][_0x7269('0x26')]({'where':{'id':_settings[_0x7269('0x20')]}});}})['then'](function(_0x50058d){if(!_0x50058d){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))](_0x7269('0x28'));}if(!_0x50058d[_0x7269('0xc')]||!_0x50058d[_0x7269('0xd')]){throw new db[(_0x7269('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2c5957=_0x50058d;logger[_0x7269('0x9')](util[_0x7269('0xa')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x404f34['id']));return sentiment(_0x2c5957[_0x7269('0xc')],_0x2c5957['data2'],_0x4c115b[_0x7269('0x21')],_0x1c9163[_0x7269('0x1a')],_0x4c115b[_0x7269('0x22')]);})[_0x7269('0xf')](function(_0xb20df){logger[_0x7269('0x9')](util[_0x7269('0xa')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x404f34['id']));return _0x404f34[_0x7269('0x1c')]({'sentiment':_0xb20df[_0x7269('0x29')],'sPositive':_0xb20df['SentimentScore'][_0x7269('0x2a')],'sNegative':_0xb20df[_0x7269('0x2b')][_0x7269('0x2c')],'sMixed':_0xb20df['SentimentScore'][_0x7269('0x2d')],'sNeutral':_0xb20df[_0x7269('0x2b')][_0x7269('0x2e')]});})[_0x7269('0xf')](function(){logger['info'](util[_0x7269('0xa')](_0x7269('0x2f'),_0x404f34['id']));_0x5dbe57();});case _0x7269('0x30'):return _0x404f34[_0x7269('0x1c')]({'transcribeStatus':_0x7269('0x30'),'failureReason':_0x880b51['TranscriptionJob'][_0x7269('0x31')]})[_0x7269('0xf')](function(){logger[_0x7269('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x404f34['id']));_0x5dbe57();});default:logger[_0x7269('0x9')](util['format'](_0x7269('0x32'),_0x404f34['id']));break;}}else{return BPromise['resolve']()[_0x7269('0xf')](function(){if(!_0x404f34[_0x7269('0x1d')]){throw new db['Sequelize']['ValidationError'](_0x7269('0x1f'));}if(!_0x4c115b[_0x7269('0x33')]||!_0x4c115b[_0x7269('0x20')]||!_0x4c115b[_0x7269('0x21')]||!_0x4c115b[_0x7269('0x22')]||!_0x4c115b[_0x7269('0x23')]){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))](_0x7269('0x24'));}if(!_0x404f34[_0x7269('0x1a')]){throw new Error(_0x7269('0x25'));}if(_0x4c115b['sentimentAccountId']===_0x29a0ca['id']){return _0x29a0ca;}else{return db[_0x7269('0x34')][_0x7269('0x26')]({'where':{'id':_settings[_0x7269('0x20')]}});}})[_0x7269('0xf')](function(_0x41ecc7){if(!_0x41ecc7){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))](_0x7269('0x28'));}if(!_0x41ecc7['data1']||!_0x41ecc7['data2']){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))]('Cloud\x20Provider\x20not\x20configured');}_0x2c5957=_0x41ecc7;logger['info'](util['format'](_0x7269('0x35'),_0x404f34['id']));return sentiment(_0x2c5957[_0x7269('0xc')],_0x2c5957['data2'],_0x4c115b[_0x7269('0x21')],_0x404f34[_0x7269('0x1a')],_0x4c115b[_0x7269('0x22')]);})[_0x7269('0xf')](function(_0x1ae342){logger['info'](util['format'](_0x7269('0x36'),_0x404f34['id']));return _0x404f34[_0x7269('0x1c')]({'sentiment':_0x1ae342[_0x7269('0x29')],'sPositive':_0x1ae342[_0x7269('0x2b')][_0x7269('0x2a')],'sNegative':_0x1ae342['SentimentScore'][_0x7269('0x2c')],'sMixed':_0x1ae342[_0x7269('0x2b')]['Mixed'],'sNeutral':_0x1ae342['SentimentScore']['Neutral'],'transcribeStatus':_0x7269('0x13')});})[_0x7269('0xf')](function(){logger[_0x7269('0x9')](util['format'](_0x7269('0x2f'),_0x404f34['id']));_0x5dbe57();});}})[_0x7269('0x37')](function(_0x11944e){if(_0x11944e){if(!_0x11944e[_0x7269('0x38')]||_0x11944e['name']!==_0x7269('0x39')){logger[_0x7269('0x3a')](util[_0x7269('0xa')](_0x7269('0x3b'),_0x404f34['id']),util[_0x7269('0x3c')](_0x11944e,{'showHidden':![],'depth':null}));}}_0x5dbe57();});});}function checkTranscribe(){var _0xb2aeee;var _0x80dba9;var _0x22e647;return db['VoiceRecording'][_0x7269('0x3d')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x7269('0xf')](function(_0x2be305){if(!_0x2be305||!_0x2be305[_0x7269('0x19')]){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))]('No\x20transcribe\x20job\x20to\x20check');}_0xb2aeee=_0x2be305;return db['Setting'][_0x7269('0x26')]({'where':{'id':0x1}});})[_0x7269('0xf')](function(_0x5d193e){if(!_0x5d193e){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))](_0x7269('0x3e'));}_0x80dba9=_0x5d193e;if(!_0x80dba9['transcribe']||!_0x80dba9[_0x7269('0x3f')]||!_0x80dba9[_0x7269('0xe')]||!_0x80dba9[_0x7269('0x22')]||!_0x80dba9['bucket']){throw new db['Sequelize'][(_0x7269('0x27'))]('Transcribe\x20not\x20configured');}return db[_0x7269('0x34')]['findOne']({'where':{'id':_0x80dba9[_0x7269('0x3f')]}});})[_0x7269('0xf')](function(_0x1826d2){if(!_0x1826d2){throw new db[(_0x7269('0x1e'))]['ValidationError'](_0x7269('0x28'));}if(!_0x1826d2['data1']||!_0x1826d2[_0x7269('0xd')]){throw new db[(_0x7269('0x1e'))][(_0x7269('0x27'))](_0x7269('0x40'));}_0x22e647=_0x1826d2;var _0x2d529f=[];_0xb2aeee[_0x7269('0x41')](function(_0x3cfcc1){_0x2d529f[_0x7269('0x42')](checkTranscribeJob(_0x3cfcc1,_0x80dba9,_0x22e647));});return BPromise[_0x7269('0x43')](_0x2d529f);})[_0x7269('0x37')](function(_0x55e6ae){if(_0x55e6ae){if(!_0x55e6ae[_0x7269('0x38')]||_0x55e6ae[_0x7269('0x38')]!==_0x7269('0x39')){logger[_0x7269('0x3a')](util[_0x7269('0x3c')](_0x55e6ae,{'showHidden':![],'depth':null}));}}});}exports[_0x7269('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 82ae463..917b75a 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 _0x0962=['inspect','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','subtract','hours','then','length','map','info','join','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0962,0x1b5));var _0x2096=function(_0x55ffa5,_0x332fee){_0x55ffa5=_0x55ffa5-0x0;var _0x9acde5=_0x0962[_0x55ffa5];return _0x9acde5;};'use strict';var _=require(_0x2096('0x0'));var moment=require(_0x2096('0x1'));var Redis=require(_0x2096('0x2'));var util=require(_0x2096('0x3'));var config=require(_0x2096('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x2096('0x5'))(_0x2096('0x6'));config[_0x2096('0x7')]=_['defaults'](config['redis'],{'host':_0x2096('0x8'),'port':0x18eb});var io=require(_0x2096('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x244f81=[];return db[_0x2096('0xa')]['findAll']({'raw':!![],'attributes':['id',_0x2096('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x2096('0xc')](0x18,_0x2096('0xd'))}}})[_0x2096('0xe')](function(_0x70d54e){if(_0x70d54e&&_0x70d54e[_0x2096('0xf')]){_0x244f81=_[_0x2096('0x10')](_0x70d54e||[],'id');logger[_0x2096('0x11')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x244f81[_0x2096('0x12')]());return db['WhatsappInteraction'][_0x2096('0x13')]({'closeReason':'system','disposition':_0x2096('0x14'),'closed':!![],'closedAt':moment()[_0x2096('0x15')](_0x2096('0x16'))},{'where':{'id':_0x244f81}});}})[_0x2096('0xe')](function(){if(_0x244f81&&_0x244f81['length']){logger[_0x2096('0x11')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x244f81[_0x2096('0x12')]());for(var _0x55ef49=0x0;_0x55ef49<_0x244f81[_0x2096('0xf')];_0x55ef49++){io[_0x2096('0x17')](_0x2096('0x18'),{'id':_0x244f81[_0x55ef49],'closed':!![]});}}})['catch'](function(_0x219f19){logger[_0x2096('0x19')](_0x2096('0x1a'),_0x219f19?util[_0x2096('0x1b')](_0x219f19,{'showHidden':![],'depth':null}):'');});}exports[_0x2096('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0eb1=['subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','inspect','moment','util','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction'];(function(_0x190c1a,_0x2fa91e){var _0x3254b6=function(_0x57a7d2){while(--_0x57a7d2){_0x190c1a['push'](_0x190c1a['shift']());}};_0x3254b6(++_0x2fa91e);}(_0x0eb1,0xf2));var _0x10eb=function(_0x828472,_0x34df5a){_0x828472=_0x828472-0x0;var _0x2d7702=_0x0eb1[_0x828472];return _0x2d7702;};'use strict';var _=require('lodash');var moment=require(_0x10eb('0x0'));var Redis=require('ioredis');var util=require(_0x10eb('0x1'));var config=require(_0x10eb('0x2'));var db=require(_0x10eb('0x3'))['db'];var logger=require(_0x10eb('0x4'))('schedule');config[_0x10eb('0x5')]=_[_0x10eb('0x6')](config['redis'],{'host':_0x10eb('0x7'),'port':0x18eb});var io=require(_0x10eb('0x8'))(new Redis(config[_0x10eb('0x5')]));function closeInteractions(){var _0xebcf27=[];return db[_0x10eb('0x9')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x10eb('0xa')](0x18,_0x10eb('0xb'))}}})['then'](function(_0x28f919){if(_0x28f919&&_0x28f919[_0x10eb('0xc')]){_0xebcf27=_[_0x10eb('0xd')](_0x28f919||[],'id');logger[_0x10eb('0xe')](_0x10eb('0xf'),_0xebcf27[_0x10eb('0x10')]());return db['WhatsappInteraction'][_0x10eb('0x11')]({'closeReason':_0x10eb('0x12'),'disposition':_0x10eb('0x13'),'closed':!![],'closedAt':moment()[_0x10eb('0x14')](_0x10eb('0x15'))},{'where':{'id':_0xebcf27}});}})[_0x10eb('0x16')](function(){if(_0xebcf27&&_0xebcf27[_0x10eb('0xc')]){logger[_0x10eb('0xe')](_0x10eb('0x17'),_0xebcf27[_0x10eb('0x10')]());for(var _0x267b2c=0x0;_0x267b2c<_0xebcf27[_0x10eb('0xc')];_0x267b2c++){io['emit'](_0x10eb('0x18'),{'id':_0xebcf27[_0x267b2c],'closed':!![]});}}})[_0x10eb('0x19')](function(_0x4699e9){logger[_0x10eb('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4699e9?util[_0x10eb('0x1b')](_0x4699e9,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index e00d949..af2012f 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1280=['bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper2','catch','../mysqldb','push','Innocenzo','Biondo','@xcally.com','now','CmContact','destroy','then'];(function(_0x1673bc,_0x533131){var _0x57d6fc=function(_0x361b85){while(--_0x361b85){_0x1673bc['push'](_0x1673bc['shift']());}};_0x57d6fc(++_0x533131);}(_0x1280,0x167));var _0x0128=function(_0x1ca9eb,_0x99a10b){_0x1ca9eb=_0x1ca9eb-0x0;var _0x2e284e=_0x1280[_0x1ca9eb];return _0x2e284e;};'use strict';var util=require('util');var db=require(_0x0128('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x0128('0x1')]({'id':i,'firstName':_0x0128('0x2')+i,'lastName':_0x0128('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0128('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x0128('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x0128('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0128('0x5')](),'updatedAt':Date[_0x0128('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x0128('0x1')]({'id':i,'firstName':_0x0128('0x2')+i,'lastName':_0x0128('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x0128('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x0128('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x0128('0x5')](),'updatedAt':Date[_0x0128('0x5')]()});}db[_0x0128('0x6')][_0x0128('0x7')]({'where':{}})[_0x0128('0x8')](function(){return db['CmContact'][_0x0128('0x9')](contacts);})['then'](function(){console[_0x0128('0xa')](_0x0128('0xb'),_0x0128('0xc'));return db[_0x0128('0xd')][_0x0128('0x7')]({'where':{}});})[_0x0128('0x8')](function(){return db[_0x0128('0xd')][_0x0128('0x9')](hopper);})[_0x0128('0x8')](function(){console['log'](_0x0128('0xb'),'hopper1');return db[_0x0128('0x6')]['bulkCreate'](contacts2);})[_0x0128('0x8')](function(){console[_0x0128('0xa')](_0x0128('0xb'),'contacts2');return db[_0x0128('0xd')]['bulkCreate'](hopper2);})['then'](function(){console[_0x0128('0xa')]('finished\x20populating',_0x0128('0xe'));})[_0x0128('0xf')](function(_0x470715){console[_0x0128('0xa')](_0x470715);}); \ No newline at end of file +var _0x0e79=['innocenzo.biondo','destroy','then','CmContact','log','contacts1','CmHopper','bulkCreate','finished\x20populating','hopper1','contacts2','catch','util','Innocenzo','Biondo','@xcally.com','push','now'];(function(_0x2401af,_0x5b1373){var _0x2abcc2=function(_0x369077){while(--_0x369077){_0x2401af['push'](_0x2401af['shift']());}};_0x2abcc2(++_0x5b1373);}(_0x0e79,0x9c));var _0x90e7=function(_0x4f8d61,_0x29eff0){_0x4f8d61=_0x4f8d61-0x0;var _0x3bc078=_0x0e79[_0x4f8d61];return _0x3bc078;};'use strict';var util=require(_0x90e7('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x90e7('0x1')+i,'lastName':_0x90e7('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x90e7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x90e7('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x90e7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x90e7('0x5')](),'updatedAt':Date[_0x90e7('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x90e7('0x4')]({'id':i,'firstName':_0x90e7('0x1')+i,'lastName':_0x90e7('0x2')+i,'phone':0xf879fb460+i,'email':_0x90e7('0x6')+i+_0x90e7('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x90e7('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x90e7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x90e7('0x5')](),'updatedAt':Date[_0x90e7('0x5')]()});}db['CmContact'][_0x90e7('0x7')]({'where':{}})[_0x90e7('0x8')](function(){return db[_0x90e7('0x9')]['bulkCreate'](contacts);})['then'](function(){console[_0x90e7('0xa')]('finished\x20populating',_0x90e7('0xb'));return db[_0x90e7('0xc')][_0x90e7('0x7')]({'where':{}});})[_0x90e7('0x8')](function(){return db[_0x90e7('0xc')][_0x90e7('0xd')](hopper);})['then'](function(){console[_0x90e7('0xa')](_0x90e7('0xe'),_0x90e7('0xf'));return db[_0x90e7('0x9')]['bulkCreate'](contacts2);})['then'](function(){console['log']('finished\x20populating',_0x90e7('0x10'));return db[_0x90e7('0xc')][_0x90e7('0xd')](hopper2);})['then'](function(){console[_0x90e7('0xa')]('finished\x20populating','hopper2');})[_0x90e7('0x11')](function(_0x590133){console[_0x90e7('0xa')](_0x590133);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7514fb2..7eeafe2 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc974=['wss','all','yes','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','push','format','agent','%s%s','%s%s@xcally.com','udp'];(function(_0x3d30ed,_0x1a6ea3){var _0x531392=function(_0x5925da){while(--_0x5925da){_0x3d30ed['push'](_0x3d30ed['shift']());}};_0x531392(++_0x1a6ea3);}(_0xc974,0x15e));var _0x4c97=function(_0x5e9b52,_0x5765c8){_0x5e9b52=_0x5e9b52-0x0;var _0x5a1b22=_0xc974[_0x5e9b52];return _0x5a1b22;};'use strict';var util=require(_0x4c97('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x4c97('0x1')]({'name':util[_0x4c97('0x2')]('%s%s',_0x4c97('0x3'),i),'fullname':util[_0x4c97('0x2')](_0x4c97('0x4'),'agent',i),'email':util['format'](_0x4c97('0x5'),_0x4c97('0x3'),i),'role':_0x4c97('0x3'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x4c97('0x6'),'ws',_0x4c97('0x7')],'disallow':[_0x4c97('0x8')],'allow':['ulaw'],'defaultuser':util[_0x4c97('0x2')](_0x4c97('0x4'),_0x4c97('0x3'),i),'encryption':_0x4c97('0x9'),'avpf':_0x4c97('0x9'),'force_avp':'yes','icesupport':_0x4c97('0x9'),'dtlsenable':_0x4c97('0x9'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0x4c97('0xa'),'callerid':util[_0x4c97('0x2')](_0x4c97('0xb'),util['format'](_0x4c97('0x4'),_0x4c97('0x3'),i),0xfa0+i)});}db[_0x4c97('0xc')]['bulkCreate'](users)[_0x4c97('0xd')](function(){console[_0x4c97('0xe')](_0x4c97('0xf'));})[_0x4c97('0x10')](function(_0x87191d){console[_0x4c97('0xe')](_0x87191d);}); \ No newline at end of file +var _0x163a=['%s%s@xcally.com','agent','password','friend','wss','all','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','log','catch','util','../mysqldb','push','format','%s%s'];(function(_0x21782e,_0xa08f7e){var _0x1e8d3b=function(_0x2fca05){while(--_0x2fca05){_0x21782e['push'](_0x21782e['shift']());}};_0x1e8d3b(++_0xa08f7e);}(_0x163a,0x64));var _0xa163=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0x163a[_0x3f3f40];return _0x403b7a;};'use strict';var util=require(_0xa163('0x0'));var db=require(_0xa163('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xa163('0x2')]({'name':util[_0xa163('0x3')](_0xa163('0x4'),'agent',i),'fullname':util[_0xa163('0x3')]('%s%s','agent',i),'email':util[_0xa163('0x3')](_0xa163('0x5'),_0xa163('0x6'),i),'role':_0xa163('0x6'),'password':_0xa163('0x7'),'internal':0xfa0+i,'type':_0xa163('0x8'),'transport':['udp','ws',_0xa163('0x9')],'disallow':[_0xa163('0xa')],'allow':[_0xa163('0xb')],'defaultuser':util[_0xa163('0x3')]('%s%s',_0xa163('0x6'),i),'encryption':'yes','avpf':'yes','force_avp':_0xa163('0xc'),'icesupport':_0xa163('0xc'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0xa163('0xd'),'dtlsprivatekey':_0xa163('0xe'),'dtlssetup':_0xa163('0xf'),'callerid':util[_0xa163('0x3')](_0xa163('0x10'),util[_0xa163('0x3')](_0xa163('0x4'),'agent',i),0xfa0+i)});}db[_0xa163('0x11')][_0xa163('0x12')](users)['then'](function(){console[_0xa163('0x13')]('add\x20user');})[_0xa163('0x14')](function(_0x54e488){console[_0xa163('0x13')](_0x54e488);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 4903959..88526f7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed1c=['OpenchannelQueue','Trunk','user','voice:outbound','WhatsappQueues','WhatsappQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','all','chat','sms','mail','openchannel','whatsapp','telephone:%s','leave','map','emit','user_has_chat_interactions:remove','user_has_mail_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','Agents','User','name','agent','telephone','type','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','findAll','Telephones','Trunks','IvrCampaigns','resourceId','where','role','Campaign','format','%s:queue:%s','length','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteraction','user:%s','admin','voice:inbound','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xed1c,0xe4));var _0xced1=function(_0x2666e5,_0x28f58c){_0x2666e5=_0x2666e5-0x0;var _0x29ed8f=_0xed1c[_0x2666e5];return _0x29ed8f;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id','name'],'include':[{'as':_0xced1('0x2'),'model':db[_0xced1('0x3')],'attributes':['id',_0xced1('0x4'),'role'],'raw':!![],'where':{'role':_0xced1('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xced1('0x4')],'where':{'role':_0xced1('0x6')}};var queryTrunks={'raw':!![],'attributes':['id',_0xced1('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xced1('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xced1('0x4'),_0xced1('0x7')],'where':{'type':_0xced1('0x8')}};function getAssociatedResources(_0x354203,_0x3221b6,_0x325dd2){return db[_0xced1('0x9')]['findOne']({'where':{'name':_0x354203,'userProfileId':_0x3221b6},'raw':!![]})[_0xced1('0xa')](function(_0x59c820){if(_0x59c820){if(_0x59c820[_0xced1('0xb')]){switch(_0x354203){case _0xced1('0xc'):case _0xced1('0xd'):case _0xced1('0xe'):case _0xced1('0xf'):case _0xced1('0x10'):case _0xced1('0x11'):case'WhatsappQueues':return db[_0x325dd2][_0xced1('0x12')](queryQueues);case _0xced1('0x13'):return db[_0x325dd2][_0xced1('0x12')](queryTelephones);case _0xced1('0x14'):return db[_0x325dd2]['findAll'](queryTrunks);case _0xced1('0x15'):return db[_0x325dd2][_0xced1('0x12')](queryCampaigns);}}else{return db['UserProfileResource'][_0xced1('0x12')]({'attributes':[_0xced1('0x16')],'where':{'sectionId':_0x59c820['id']},'raw':!![]})[_0xced1('0xa')](function(_0x32100b){if(_0x32100b){var _0x47baec={'where':{'id':_['map'](_0x32100b,_0xced1('0x16'))},'raw':!![]};switch(_0x325dd2){case _0xced1('0x3'):_0x47baec[_0xced1('0x17')][_0xced1('0x18')]=_0xced1('0x6');break;case _0xced1('0x19'):_0x47baec['where']['type']=_0xced1('0x8');break;}return db[_0x325dd2][_0xced1('0x12')](_0x47baec);}else{return[];}});}}else{return[];}})[_0xced1('0xa')](function(_0x5257e7){return _0x5257e7;});}function joinOrLeaveQueues(_0x1eac14,_0x25f0df,_0x3e51e4,_0x4eed16){_0x1eac14[_0x25f0df](util[_0xced1('0x1a')](_0xced1('0x1b'),_0x3e51e4,_0x4eed16[_0xced1('0x4')]));if(_0x4eed16['Agents']){for(var _0x138c8b=0x0;_0x138c8b<_0x4eed16[_0xced1('0x2')][_0xced1('0x1c')];_0x138c8b+=0x1){_0x1eac14[_0x25f0df](util['format']('user:%s',_0x4eed16[_0xced1('0x2')][_0x138c8b][_0xced1('0x4')]));}}}function joinOrLeave(_0x2a6248,_0x20dcb4,_0x210d7e){var _0x49c8b9;if(_0x2a6248[_0xced1('0x1d')][_0xced1('0x1e')]['id']){db['User']['find']({'attributes':['id',_0xced1('0x4'),_0xced1('0x18'),_0xced1('0x1f')],'where':{'id':_0x2a6248[_0xced1('0x1d')][_0xced1('0x1e')]['id']},'include':[{'model':db[_0xced1('0x20')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xced1('0x21')],'as':_0xced1('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xced1('0x23')],'as':_0xced1('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xced1('0x25')],'as':_0xced1('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xced1('0x27')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xced1('0x28')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xced1('0xa')](function(_0x2c2269){if(_0x2c2269){_0x49c8b9=_0x2c2269;_0x2a6248[_0x20dcb4](util[_0xced1('0x1a')](_0xced1('0x29'),_0x2c2269['name']));var _0x59361e=[];switch(_0x2c2269[_0xced1('0x18')]){case _0xced1('0x2a'):_0x2a6248[_0x20dcb4](_0xced1('0x2b'));_0x2a6248[_0x20dcb4]('voice:outbound');if(queryQueues['hasOwnProperty']('include')){delete queryQueues[_0xced1('0x2c')];}_0x59361e[_0xced1('0x2d')](db[_0xced1('0x2e')][_0xced1('0x12')](queryQueues));_0x59361e['push'](db[_0xced1('0x2f')][_0xced1('0x12')](queryQueues));_0x59361e[_0xced1('0x2d')](db[_0xced1('0x30')][_0xced1('0x12')](queryQueues));_0x59361e[_0xced1('0x2d')](db[_0xced1('0x31')]['findAll'](queryQueues));_0x59361e['push'](db[_0xced1('0x32')][_0xced1('0x12')](queryQueues));_0x59361e[_0xced1('0x2d')](db[_0xced1('0x33')][_0xced1('0x12')](queryQueues));_0x59361e[_0xced1('0x2d')](db['WhatsappQueue']['findAll'](queryQueues));_0x59361e['push'](db['User'][_0xced1('0x12')](queryTelephones));_0x59361e[_0xced1('0x2d')](db[_0xced1('0x34')][_0xced1('0x12')](queryTrunks));_0x59361e[_0xced1('0x2d')](db[_0xced1('0x19')][_0xced1('0x12')](queryCampaigns));_0x59361e[_0xced1('0x2d')](db[_0xced1('0x3')][_0xced1('0x12')](queryAgents));break;case _0xced1('0x35'):_0x2a6248[_0x20dcb4](_0xced1('0x2b'));_0x2a6248[_0x20dcb4](_0xced1('0x36'));_0x59361e['push'](getAssociatedResources(_0xced1('0xc'),_0x2c2269[_0xced1('0x1f')],_0xced1('0x2e')));_0x59361e[_0xced1('0x2d')](getAssociatedResources(_0xced1('0xd'),_0x2c2269[_0xced1('0x1f')],'ChatQueue'));_0x59361e[_0xced1('0x2d')](getAssociatedResources(_0xced1('0xe'),_0x2c2269[_0xced1('0x1f')],_0xced1('0x30')));_0x59361e[_0xced1('0x2d')](getAssociatedResources(_0xced1('0xf'),_0x2c2269[_0xced1('0x1f')],_0xced1('0x31')));_0x59361e[_0xced1('0x2d')](getAssociatedResources(_0xced1('0x10'),_0x2c2269[_0xced1('0x1f')],'MailQueue'));_0x59361e['push'](getAssociatedResources(_0xced1('0x11'),_0x2c2269[_0xced1('0x1f')],_0xced1('0x33')));_0x59361e['push'](getAssociatedResources(_0xced1('0x37'),_0x2c2269[_0xced1('0x1f')],_0xced1('0x38')));_0x59361e['push'](getAssociatedResources(_0xced1('0x13'),_0x2c2269[_0xced1('0x1f')],'User'));_0x59361e[_0xced1('0x2d')](getAssociatedResources('Trunks',_0x2c2269[_0xced1('0x1f')],_0xced1('0x34')));_0x59361e['push'](getAssociatedResources(_0xced1('0x15'),_0x2c2269[_0xced1('0x1f')],_0xced1('0x19')));_0x59361e['push'](db[_0xced1('0x3')][_0xced1('0x12')](queryAgents));break;case'agent':_0x2a6248[_0x20dcb4](_0xced1('0x2b'));_0x2a6248[_0x20dcb4]('voice:outbound');_0x59361e['push'](_0x2c2269[_0xced1('0x39')]({'attributes':['id','name']}));_0x59361e[_0xced1('0x2d')](_0x2c2269[_0xced1('0x3a')]({'attributes':['id',_0xced1('0x4')]}));_0x59361e['push'](_0x2c2269[_0xced1('0x3b')]({'attributes':['id','name']}));_0x59361e[_0xced1('0x2d')](_0x2c2269[_0xced1('0x3c')]({'attributes':['id',_0xced1('0x4')]}));_0x59361e[_0xced1('0x2d')](_0x2c2269['getMailQueues']({'attributes':['id',_0xced1('0x4')]}));_0x59361e[_0xced1('0x2d')](_0x2c2269['getOpenchannelQueues']({'attributes':['id',_0xced1('0x4')]}));_0x59361e[_0xced1('0x2d')](_0x2c2269['getWhatsappQueues']({'attributes':['id',_0xced1('0x4')]}));break;}return BPromise[_0xced1('0x3d')](_0x59361e);}})[_0xced1('0xa')](function(_0x59f1ba){if(_0x59f1ba&&_0x59f1ba[_0xced1('0x1c')]){for(var _0xcfbed8=0x0;_0xcfbed8<_0x59f1ba[_0xced1('0x1c')];_0xcfbed8+=0x1){for(var _0x3333e6=0x0;_0x3333e6<_0x59f1ba[_0xcfbed8][_0xced1('0x1c')];_0x3333e6+=0x1){switch(_0xcfbed8){case 0x0:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,'voice',_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x1:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,_0xced1('0x3e'),_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x2:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,'fax',_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x3:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,_0xced1('0x3f'),_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x4:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,_0xced1('0x40'),_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x5:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,_0xced1('0x41'),_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x6:joinOrLeaveQueues(_0x2a6248,_0x20dcb4,_0xced1('0x42'),_0x59f1ba[_0xcfbed8][_0x3333e6]);break;case 0x7:if(_0x49c8b9[_0xced1('0x18')]!==_0xced1('0x5'))_0x2a6248[_0x20dcb4](util['format'](_0xced1('0x43'),_0x59f1ba[_0xcfbed8][_0x3333e6][_0xced1('0x4')]));break;case 0x8:if(_0x49c8b9['role']!==_0xced1('0x5'))_0x2a6248[_0x20dcb4](util['format']('trunk:%s',_0x59f1ba[_0xcfbed8][_0x3333e6][_0xced1('0x4')]));break;case 0x9:if(_0x49c8b9[_0xced1('0x18')]!==_0xced1('0x5'))_0x2a6248[_0x20dcb4](util[_0xced1('0x1a')]('campaign:%s:%s',_0x59f1ba[_0xcfbed8][_0x3333e6][_0xced1('0x7')],_0x59f1ba[_0xcfbed8][_0x3333e6][_0xced1('0x4')]));break;case 0xa:_0x2a6248[_0x20dcb4](util[_0xced1('0x1a')]('user:%s',_0x59f1ba[_0xcfbed8][_0x3333e6]['name']));break;}}}}})[_0xced1('0xa')](function(){if(_0x20dcb4===_0xced1('0x44')){var _0xad1d9f=_[_0xced1('0x45')](_0x49c8b9['ChatInteractions'],'id');return _0x49c8b9['removeChatInteractions'](_0xad1d9f)['then'](function(){for(var _0x7df9c5=0x0;_0x7df9c5<_0xad1d9f[_0xced1('0x1c')];_0x7df9c5+=0x1){_0x210d7e[_0xced1('0x46')](_0xced1('0x47'),{'ChatInteractionId':Number(_0xad1d9f[_0x7df9c5]),'UserId':Number(_0x49c8b9['id'])});}});}})[_0xced1('0xa')](function(){if(_0x20dcb4===_0xced1('0x44')){var _0x211fd0=_[_0xced1('0x45')](_0x49c8b9[_0xced1('0x22')],'id');return _0x49c8b9['removeMailInteractions'](_0x211fd0)[_0xced1('0xa')](function(){for(var _0x3f44e6=0x0;_0x3f44e6<_0x211fd0[_0xced1('0x1c')];_0x3f44e6+=0x1){_0x210d7e['emit'](_0xced1('0x48'),{'MailInteractionId':Number(_0x211fd0[_0x3f44e6]),'UserId':Number(_0x49c8b9['id'])});}});}})[_0xced1('0xa')](function(){if(_0x20dcb4===_0xced1('0x44')){var _0x2acfd3=_['map'](_0x49c8b9[_0xced1('0x24')],'id');return _0x49c8b9['removeFaxInteractions'](_0x2acfd3)['then'](function(){for(var _0x1a2b65=0x0;_0x1a2b65<_0x2acfd3[_0xced1('0x1c')];_0x1a2b65+=0x1){_0x210d7e['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2acfd3[_0x1a2b65]),'UserId':Number(_0x49c8b9['id'])});}});}})['then'](function(){if(_0x20dcb4===_0xced1('0x44')){var _0x5dfcf4=_[_0xced1('0x45')](_0x49c8b9[_0xced1('0x26')],'id');return _0x49c8b9[_0xced1('0x49')](_0x5dfcf4)[_0xced1('0xa')](function(){for(var _0x39fa12=0x0;_0x39fa12<_0x5dfcf4[_0xced1('0x1c')];_0x39fa12+=0x1){_0x210d7e[_0xced1('0x46')](_0xced1('0x4a'),{'SmsInteractionId':Number(_0x5dfcf4[_0x39fa12]),'UserId':Number(_0x49c8b9['id'])});}});}})['then'](function(){if(_0x20dcb4==='leave'){var _0x4832d2=_[_0xced1('0x45')](_0x49c8b9[_0xced1('0x4b')],'id');return _0x49c8b9[_0xced1('0x4c')](_0x4832d2)['then'](function(){for(var _0x455134=0x0;_0x455134<_0x4832d2[_0xced1('0x1c')];_0x455134+=0x1){_0x210d7e[_0xced1('0x46')](_0xced1('0x4d'),{'OpenchannelInteractionId':Number(_0x4832d2[_0x455134]),'UserId':Number(_0x49c8b9['id'])});}});}})['then'](function(){if(_0x20dcb4===_0xced1('0x44')){var _0x2abd02=_[_0xced1('0x45')](_0x49c8b9[_0xced1('0x4e')],'id');return _0x49c8b9[_0xced1('0x4f')](_0x2abd02)[_0xced1('0xa')](function(){for(var _0x44cfbe=0x0;_0x44cfbe<_0x2abd02[_0xced1('0x1c')];_0x44cfbe+=0x1){_0x210d7e['emit']('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x2abd02[_0x44cfbe]),'UserId':Number(_0x49c8b9['id'])});}});}})['catch'](function(_0x440b22){_0x2a6248['log'](_0x440b22);});}}function onDisconnect(_0x398264,_0x5d28cc){joinOrLeave(_0x398264,'leave',_0x5d28cc);}function onConnect(_0x37bec5){joinOrLeave(_0x37bec5,_0xced1('0x50'));}exports[_0xced1('0x51')]=function(_0x2bdcea){_0x2bdcea['on'](_0xced1('0x52'),function(_0x466da1){_0x466da1[_0xced1('0x53')](0x0);_0x466da1[_0xced1('0x54')]=_0x466da1[_0xced1('0x55')][_0xced1('0x52')][_0xced1('0x56')]+':'+_0x466da1['request'][_0xced1('0x52')][_0xced1('0x57')];_0x466da1['connectedAt']=new Date();_0x466da1[_0xced1('0x58')]=function(_0x26f154){console['log'](_0xced1('0x59')+_0x466da1[_0xced1('0x5a')][_0xced1('0x4')]+'['+_0x466da1[_0xced1('0x54')]+']',_0x26f154);};_0x466da1['on'](_0xced1('0x5b'),function(){onDisconnect(_0x466da1,_0x2bdcea);_0x466da1['log']('DISCONNECTED');});onConnect(_0x466da1);_0x466da1['log'](_0xced1('0x5c'));});}; \ No newline at end of file +var _0x534b=['./environment','name','User','role','agent','telephone','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','then','map','where','Campaign','format','Agents','length','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','MailQueue','OpenchannelQueue','Trunk','user','FaxQueues','SmsQueue','OpenchannelQueues','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','MailInteractions','removeMailInteractions','user_has_mail_interactions:remove','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','DISCONNECTED','CONNECTED','lodash','util','../mysqldb'];(function(_0x35c6ef,_0x2b8800){var _0x4e6777=function(_0x305027){while(--_0x305027){_0x35c6ef['push'](_0x35c6ef['shift']());}};_0x4e6777(++_0x2b8800);}(_0x534b,0xbd));var _0xb534=function(_0x268781,_0x5b8193){_0x268781=_0x268781-0x0;var _0x1ba147=_0x534b[_0x268781];return _0x1ba147;};'use strict';var _=require(_0xb534('0x0'));var util=require(_0xb534('0x1'));var BPromise=require('bluebird');var db=require(_0xb534('0x2'))['db'];var config=require(_0xb534('0x3'));var queryQueues={'attributes':['id',_0xb534('0x4')],'include':[{'as':'Agents','model':db[_0xb534('0x5')],'attributes':['id','name',_0xb534('0x6')],'raw':!![],'where':{'role':_0xb534('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xb534('0x4')],'where':{'role':_0xb534('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xb534('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xb534('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xb534('0x4'),_0xb534('0x9')],'where':{'type':_0xb534('0xa')}};function getAssociatedResources(_0x30df34,_0x331332,_0x43a29e){return db['UserProfileSection'][_0xb534('0xb')]({'where':{'name':_0x30df34,'userProfileId':_0x331332},'raw':!![]})['then'](function(_0x772bdf){if(_0x772bdf){if(_0x772bdf[_0xb534('0xc')]){switch(_0x30df34){case _0xb534('0xd'):case _0xb534('0xe'):case'FaxQueues':case _0xb534('0xf'):case _0xb534('0x10'):case'OpenchannelQueues':case _0xb534('0x11'):return db[_0x43a29e][_0xb534('0x12')](queryQueues);case _0xb534('0x13'):return db[_0x43a29e]['findAll'](queryTelephones);case _0xb534('0x14'):return db[_0x43a29e][_0xb534('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x43a29e]['findAll'](queryCampaigns);}}else{return db[_0xb534('0x15')][_0xb534('0x12')]({'attributes':[_0xb534('0x16')],'where':{'sectionId':_0x772bdf['id']},'raw':!![]})[_0xb534('0x17')](function(_0xfbb070){if(_0xfbb070){var _0x3d9a0d={'where':{'id':_[_0xb534('0x18')](_0xfbb070,_0xb534('0x16'))},'raw':!![]};switch(_0x43a29e){case _0xb534('0x5'):_0x3d9a0d[_0xb534('0x19')]['role']=_0xb534('0x8');break;case _0xb534('0x1a'):_0x3d9a0d[_0xb534('0x19')][_0xb534('0x9')]=_0xb534('0xa');break;}return db[_0x43a29e][_0xb534('0x12')](_0x3d9a0d);}else{return[];}});}}else{return[];}})[_0xb534('0x17')](function(_0x229144){return _0x229144;});}function joinOrLeaveQueues(_0x3e1f5b,_0x5815c4,_0x58fab7,_0x3afad4){_0x3e1f5b[_0x5815c4](util[_0xb534('0x1b')]('%s:queue:%s',_0x58fab7,_0x3afad4[_0xb534('0x4')]));if(_0x3afad4['Agents']){for(var _0x16d7ca=0x0;_0x16d7ca<_0x3afad4[_0xb534('0x1c')][_0xb534('0x1d')];_0x16d7ca+=0x1){_0x3e1f5b[_0x5815c4](util[_0xb534('0x1b')](_0xb534('0x1e'),_0x3afad4[_0xb534('0x1c')][_0x16d7ca][_0xb534('0x4')]));}}}function joinOrLeave(_0x49a903,_0x30fa7e,_0x574b1c){var _0x1a72da;if(_0x49a903[_0xb534('0x1f')][_0xb534('0x20')]['id']){db[_0xb534('0x5')][_0xb534('0x21')]({'attributes':['id',_0xb534('0x4'),_0xb534('0x6'),_0xb534('0x22')],'where':{'id':_0x49a903[_0xb534('0x1f')]['query']['id']},'include':[{'model':db[_0xb534('0x23')],'as':_0xb534('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x25')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x26')],'as':_0xb534('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x28')],'as':_0xb534('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x2a')],'as':_0xb534('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0xb534('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xb534('0x17')](function(_0x285ee6){if(_0x285ee6){_0x1a72da=_0x285ee6;_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x1e'),_0x285ee6[_0xb534('0x4')]));var _0x2dcf82=[];switch(_0x285ee6[_0xb534('0x6')]){case _0xb534('0x2d'):_0x49a903[_0x30fa7e](_0xb534('0x2e'));_0x49a903[_0x30fa7e](_0xb534('0x2f'));if(queryQueues['hasOwnProperty'](_0xb534('0x30'))){delete queryQueues[_0xb534('0x30')];}_0x2dcf82['push'](db[_0xb534('0x31')][_0xb534('0x12')](queryQueues));_0x2dcf82['push'](db['ChatQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82['push'](db['FaxQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db['SmsQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x33')][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x34')][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db['WhatsappQueue'][_0xb534('0x12')](queryQueues));_0x2dcf82[_0xb534('0x32')](db['User'][_0xb534('0x12')](queryTelephones));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x35')][_0xb534('0x12')](queryTrunks));_0x2dcf82[_0xb534('0x32')](db['Campaign'][_0xb534('0x12')](queryCampaigns));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x5')][_0xb534('0x12')](queryAgents));break;case _0xb534('0x36'):_0x49a903[_0x30fa7e](_0xb534('0x2e'));_0x49a903[_0x30fa7e](_0xb534('0x2f'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0xd'),_0x285ee6[_0xb534('0x22')],'VoiceQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0xe'),_0x285ee6[_0xb534('0x22')],'ChatQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x37'),_0x285ee6[_0xb534('0x22')],'FaxQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0xf'),_0x285ee6[_0xb534('0x22')],_0xb534('0x38')));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x10'),_0x285ee6[_0xb534('0x22')],_0xb534('0x33')));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x39'),_0x285ee6[_0xb534('0x22')],'OpenchannelQueue'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources(_0xb534('0x11'),_0x285ee6[_0xb534('0x22')],'WhatsappQueue'));_0x2dcf82['push'](getAssociatedResources(_0xb534('0x13'),_0x285ee6[_0xb534('0x22')],'User'));_0x2dcf82[_0xb534('0x32')](getAssociatedResources('Trunks',_0x285ee6[_0xb534('0x22')],_0xb534('0x35')));_0x2dcf82['push'](getAssociatedResources('IvrCampaigns',_0x285ee6['userProfileId'],_0xb534('0x1a')));_0x2dcf82[_0xb534('0x32')](db[_0xb534('0x5')][_0xb534('0x12')](queryAgents));break;case _0xb534('0x7'):_0x49a903[_0x30fa7e](_0xb534('0x2e'));_0x49a903[_0x30fa7e](_0xb534('0x2f'));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3a')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3b')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6['getFaxQueues']({'attributes':['id','name']}));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3c')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6['getMailQueues']({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82['push'](_0x285ee6[_0xb534('0x3d')]({'attributes':['id',_0xb534('0x4')]}));_0x2dcf82[_0xb534('0x32')](_0x285ee6[_0xb534('0x3e')]({'attributes':['id',_0xb534('0x4')]}));break;}return BPromise[_0xb534('0x3f')](_0x2dcf82);}})[_0xb534('0x17')](function(_0x45ab63){if(_0x45ab63&&_0x45ab63[_0xb534('0x1d')]){for(var _0x3f5a03=0x0;_0x3f5a03<_0x45ab63[_0xb534('0x1d')];_0x3f5a03+=0x1){for(var _0x6be6a9=0x0;_0x6be6a9<_0x45ab63[_0x3f5a03][_0xb534('0x1d')];_0x6be6a9+=0x1){switch(_0x3f5a03){case 0x0:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x40'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x1:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x41'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x2:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x42'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x3:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x43'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x4:joinOrLeaveQueues(_0x49a903,_0x30fa7e,'mail',_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x5:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x44'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x6:joinOrLeaveQueues(_0x49a903,_0x30fa7e,_0xb534('0x45'),_0x45ab63[_0x3f5a03][_0x6be6a9]);break;case 0x7:if(_0x1a72da['role']!=='agent')_0x49a903[_0x30fa7e](util['format'](_0xb534('0x46'),_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x4')]));break;case 0x8:if(_0x1a72da['role']!==_0xb534('0x7'))_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x47'),_0x45ab63[_0x3f5a03][_0x6be6a9]['name']));break;case 0x9:if(_0x1a72da[_0xb534('0x6')]!==_0xb534('0x7'))_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x48'),_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x9')],_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x4')]));break;case 0xa:_0x49a903[_0x30fa7e](util[_0xb534('0x1b')](_0xb534('0x1e'),_0x45ab63[_0x3f5a03][_0x6be6a9][_0xb534('0x4')]));break;}}}}})[_0xb534('0x17')](function(){if(_0x30fa7e===_0xb534('0x49')){var _0x25b542=_[_0xb534('0x18')](_0x1a72da[_0xb534('0x24')],'id');return _0x1a72da['removeChatInteractions'](_0x25b542)['then'](function(){for(var _0x226148=0x0;_0x226148<_0x25b542[_0xb534('0x1d')];_0x226148+=0x1){_0x574b1c[_0xb534('0x4a')](_0xb534('0x4b'),{'ChatInteractionId':Number(_0x25b542[_0x226148]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e===_0xb534('0x49')){var _0x10b729=_['map'](_0x1a72da[_0xb534('0x4c')],'id');return _0x1a72da[_0xb534('0x4d')](_0x10b729)[_0xb534('0x17')](function(){for(var _0x26224e=0x0;_0x26224e<_0x10b729['length'];_0x26224e+=0x1){_0x574b1c[_0xb534('0x4a')](_0xb534('0x4e'),{'MailInteractionId':Number(_0x10b729[_0x26224e]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e==='leave'){var _0x548b63=_[_0xb534('0x18')](_0x1a72da['FaxInteractions'],'id');return _0x1a72da['removeFaxInteractions'](_0x548b63)[_0xb534('0x17')](function(){for(var _0x38cb93=0x0;_0x38cb93<_0x548b63[_0xb534('0x1d')];_0x38cb93+=0x1){_0x574b1c[_0xb534('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x548b63[_0x38cb93]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e==='leave'){var _0x2e500b=_['map'](_0x1a72da[_0xb534('0x29')],'id');return _0x1a72da['removeSmsInteractions'](_0x2e500b)[_0xb534('0x17')](function(){for(var _0x695202=0x0;_0x695202<_0x2e500b[_0xb534('0x1d')];_0x695202+=0x1){_0x574b1c[_0xb534('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x2e500b[_0x695202]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e==='leave'){var _0x142e5e=_['map'](_0x1a72da[_0xb534('0x2b')],'id');return _0x1a72da['removeOpenchannelInteractions'](_0x142e5e)[_0xb534('0x17')](function(){for(var _0x5472b0=0x0;_0x5472b0<_0x142e5e['length'];_0x5472b0+=0x1){_0x574b1c['emit'](_0xb534('0x4f'),{'OpenchannelInteractionId':Number(_0x142e5e[_0x5472b0]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x17')](function(){if(_0x30fa7e===_0xb534('0x49')){var _0x5a9b53=_[_0xb534('0x18')](_0x1a72da[_0xb534('0x50')],'id');return _0x1a72da[_0xb534('0x51')](_0x5a9b53)['then'](function(){for(var _0x528f3e=0x0;_0x528f3e<_0x5a9b53[_0xb534('0x1d')];_0x528f3e+=0x1){_0x574b1c[_0xb534('0x4a')](_0xb534('0x52'),{'WhatsappInteractionId':Number(_0x5a9b53[_0x528f3e]),'UserId':Number(_0x1a72da['id'])});}});}})[_0xb534('0x53')](function(_0x1ba810){_0x49a903[_0xb534('0x54')](_0x1ba810);});}}function onDisconnect(_0x50df5b,_0x4d3bcd){joinOrLeave(_0x50df5b,'leave',_0x4d3bcd);}function onConnect(_0x33710b){joinOrLeave(_0x33710b,'join');}exports[_0xb534('0x55')]=function(_0x7bd149){_0x7bd149['on'](_0xb534('0x56'),function(_0x642079){_0x642079[_0xb534('0x57')](0x0);_0x642079[_0xb534('0x58')]=_0x642079[_0xb534('0x59')][_0xb534('0x56')][_0xb534('0x5a')]+':'+_0x642079['request']['connection']['remotePort'];_0x642079[_0xb534('0x5b')]=new Date();_0x642079[_0xb534('0x54')]=function(_0xd72c42){console[_0xb534('0x54')](_0xb534('0x5c')+_0x642079[_0xb534('0x5d')]['name']+'['+_0x642079[_0xb534('0x58')]+']',_0xd72c42);};_0x642079['on']('disconnect',function(){onDisconnect(_0x642079,_0x7bd149);_0x642079[_0xb534('0x54')](_0xb534('0x5e'));});onConnect(_0x642079);_0x642079[_0xb534('0x54')](_0xb534('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 94b2bc8..8528ada 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 _0x20f1=['hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','newmessage','ChatOfflineMessage','Sms','SmsInteraction','closedinteraction','Whatsapp','WhatsappMessage','Fax','FaxInteraction','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','code','error','catch','motionChannel','direction','ContactId','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','event','offlineMessage','get','opened','query','Sequelize','undefined','AfterCreate','closed','changed','substatus','User','find','email','internal','default'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x20f1,0x1b6));var _0x120f=function(_0x52a6f3,_0x29edd6){_0x52a6f3=_0x52a6f3-0x0;var _0x530bf7=_0x20f1[_0x52a6f3];return _0x530bf7;};'use strict';var util=require(_0x120f('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0x120f('0x1'));var logger=require('../logger')(_0x120f('0x2'));var client=jayson[_0x120f('0x3')]['http']({'port':0x232a});var triggers=[{'channel':_0x120f('0x4'),'model':_0x120f('0x5'),'event':_0x120f('0x6'),'condition':_0x120f('0x7'),'callback':afterCreate},{'channel':_0x120f('0x4'),'model':_0x120f('0x5'),'event':_0x120f('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x120f('0x4'),'model':'ChatMessage','event':_0x120f('0x6'),'condition':_0x120f('0x9'),'callback':afterCreateMessage},{'channel':_0x120f('0x4'),'model':_0x120f('0xa'),'event':'afterCreate','condition':_0x120f('0x9'),'callback':afterCreateOfflineMessage},{'channel':_0x120f('0xb'),'model':'SmsInteraction','event':_0x120f('0x6'),'condition':_0x120f('0x7'),'callback':afterCreate},{'channel':_0x120f('0xb'),'model':_0x120f('0xc'),'event':_0x120f('0x8'),'condition':_0x120f('0xd'),'callback':afterUpdate},{'channel':_0x120f('0xb'),'model':'SmsMessage','event':'afterCreate','condition':_0x120f('0x9'),'callback':afterCreateMessage},{'channel':_0x120f('0xe'),'model':'WhatsappInteraction','event':_0x120f('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0x120f('0x8'),'condition':_0x120f('0xd'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0x120f('0xf'),'event':_0x120f('0x6'),'condition':_0x120f('0x9'),'callback':afterCreateMessage},{'channel':_0x120f('0x10'),'model':_0x120f('0x11'),'event':_0x120f('0x6'),'condition':_0x120f('0x7'),'callback':afterCreate},{'channel':_0x120f('0x10'),'model':'FaxInteraction','event':_0x120f('0x8'),'condition':_0x120f('0xd'),'callback':afterUpdate},{'channel':_0x120f('0x10'),'model':'FaxMessage','event':_0x120f('0x6'),'condition':_0x120f('0x9'),'callback':afterCreateMessage},{'channel':_0x120f('0x12'),'model':'MailInteraction','event':_0x120f('0x6'),'condition':_0x120f('0x7'),'callback':afterCreate},{'channel':_0x120f('0x12'),'model':_0x120f('0x13'),'event':_0x120f('0x8'),'condition':_0x120f('0xd'),'callback':afterUpdate},{'channel':_0x120f('0x12'),'model':_0x120f('0x14'),'event':'afterCreate','condition':_0x120f('0x9'),'callback':afterCreateMessage},{'channel':_0x120f('0x15'),'model':_0x120f('0x16'),'event':_0x120f('0x6'),'condition':_0x120f('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':'OpenchannelInteraction','event':_0x120f('0x8'),'condition':_0x120f('0xd'),'callback':afterUpdate},{'channel':_0x120f('0x15'),'model':_0x120f('0x17'),'event':_0x120f('0x6'),'condition':'newmessage','callback':afterCreateMessage}];function request(_0x4440c8){return client[_0x120f('0x18')]('EventManager',_0x4440c8)[_0x120f('0x19')](function(_0x126681){logger[_0x120f('0x1a')](_0x120f('0x1b'),_0x120f('0x1c'),_0x126681);if(_0x126681['error']){if(_0x126681['error'][_0x120f('0x1d')]===0x1f4){logger[_0x120f('0x1e')]('Trigger,\x20%s',_0x120f('0x1c'),_0x126681['error']);}}})[_0x120f('0x1f')](function(_0x103493){logger[_0x120f('0x1e')](_0x120f('0x1b'),_0x120f('0x1c'),_0x103493);});}function afterCreateMessage(_0x5391e3){return function(_0x407a4c){_0x407a4c=_0x407a4c['get']({'plain':!![]});_0x407a4c['channel']=_0x5391e3;_0x407a4c[_0x120f('0x20')]=_0x5391e3;_0x407a4c['event']=_0x407a4c[_0x120f('0x21')];Promise['resolve']()[_0x120f('0x19')](function(){if(typeof _0x407a4c[_0x120f('0x22')]==='undefined')return null;var _0x2163e2=_0x120f('0x23')+_0x407a4c[_0x120f('0x22')];return db[_0x120f('0x24')]['query'](_0x2163e2,{'type':db['Sequelize'][_0x120f('0x25')][_0x120f('0x26')],'raw':!![]});})[_0x120f('0x19')](function(_0x2a2519){if(_0x2a2519){_0x407a4c[_0x120f('0x27')]=_0x2a2519[0x0];}if(typeof _0x407a4c[_0x120f('0x28')]==='undefined')return;return getAgent(_0x407a4c[_0x120f('0x28')]);})[_0x120f('0x19')](function(_0x1fe77e){if(_0x1fe77e){_0x407a4c[_0x120f('0x29')]=util[_0x120f('0x2a')](_0x120f('0x2b'),_0x1fe77e[_0x120f('0x2c')]);_0x407a4c[_0x120f('0x2d')]=_0x1fe77e;_0x407a4c[_0x120f('0x2e')]=_0x5391e3;return request({'event':_0x120f('0x2f'),'message':_0x407a4c});}else{return request({'event':_0x120f('0x30'),'message':_0x407a4c});}})[_0x120f('0x1f')](function(_0x47e05a){logger[_0x120f('0x1e')](_0x120f('0x1b'),_0x120f('0x31'),_0x47e05a);});};}function afterCreateOfflineMessage(_0x399541){return function(_0x40a18c){_0x40a18c=_0x40a18c['get']({'plain':!![]});_0x40a18c[_0x120f('0x2e')]=_0x399541;_0x40a18c[_0x120f('0x20')]=_0x399541;_0x40a18c[_0x120f('0x32')]=_0x120f('0x33');return request({'event':_0x40a18c[_0x120f('0x32')],'message':_0x40a18c});};}function afterCreate(_0x292c79,_0x652db6){return function(_0x1cc049){_0x1cc049=_0x1cc049[_0x120f('0x34')]({'plain':!![]});_0x1cc049[_0x120f('0x2e')]=_0x292c79;_0x1cc049[_0x120f('0x20')]=_0x292c79;_0x1cc049[_0x120f('0x32')]=_0x120f('0x35');Promise['resolve']()[_0x120f('0x19')](function(){var _0x10707b=_0x120f('0x23')+_0x1cc049['ContactId'];return db[_0x120f('0x24')][_0x120f('0x36')](_0x10707b,{'type':db[_0x120f('0x37')][_0x120f('0x25')][_0x120f('0x26')],'raw':!![]});})['then'](function(_0x13ab3b){if(_0x13ab3b){_0x1cc049['contact']=_0x13ab3b[0x0];}if(typeof _0x1cc049['UserId']===_0x120f('0x38'))return;return getAgent(_0x1cc049[_0x120f('0x28')]);})[_0x120f('0x19')](function(_0x4a1a77){if(_0x4a1a77){_0x1cc049[_0x120f('0x29')]=util['format'](_0x120f('0x2b'),_0x4a1a77[_0x120f('0x2c')]);_0x1cc049[_0x120f('0x2d')]=_0x4a1a77;}return request({'event':_0x652db6,'message':_0x1cc049});})[_0x120f('0x1f')](function(_0xbc14c0){logger[_0x120f('0x1e')](_0x120f('0x1b'),_0x120f('0x39'),_0xbc14c0);});};}function afterUpdate(_0xa4acb1){return function(_0x38deee){var _0x34cda2=_0x38deee['changed'](_0x120f('0x3a'))&&_0x38deee[_0x120f('0x3a')];var _0xc2fdb6=_0x38deee[_0x120f('0x3b')](_0x120f('0x3c'));if(_0x34cda2||_0xc2fdb6){var _0x1d034a=_0x34cda2?'closedinteraction':'substatus';var _0x166e32=_0x38deee[_0x120f('0x34')]({'plain':!![]});_0x166e32[_0x120f('0x2e')]=_0xa4acb1;_0x166e32[_0x120f('0x20')]=_0xa4acb1;_0x166e32[_0x120f('0x32')]=_0x34cda2?_0x120f('0x3a'):_0x120f('0x3c');var _0x3aaf94='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x166e32[_0x120f('0x22')];return db['sequelize'][_0x120f('0x36')](_0x3aaf94,{'type':db[_0x120f('0x37')]['QueryTypes'][_0x120f('0x26')],'raw':!![]})[_0x120f('0x19')](function(_0x116853){if(_0x116853){_0x166e32[_0x120f('0x27')]=_0x116853[0x0];}if(typeof _0x166e32[_0x120f('0x28')]==='undefined')return;return getAgent(_0x166e32[_0x120f('0x28')]);})[_0x120f('0x19')](function(_0x554374){if(_0x554374){_0x166e32[_0x120f('0x29')]=util[_0x120f('0x2a')]('SIP/%s',_0x554374['name']);_0x166e32[_0x120f('0x2d')]=_0x554374;}return request({'event':_0x1d034a,'message':_0x166e32});})[_0x120f('0x1f')](function(_0x44b63e){logger[_0x120f('0x1e')](_0x120f('0x1b'),'AfterUpdate',_0x44b63e);});}};}function getAgent(_0x49e330){return db[_0x120f('0x3d')][_0x120f('0x3e')]({'where':{'id':_0x49e330},'attributes':['id',_0x120f('0x2c'),'fullname',_0x120f('0x3f'),_0x120f('0x40')],'raw':!![]})[_0x120f('0x19')](function(_0xf134ee){return _0xf134ee;});}exports[_0x120f('0x41')]=function(){for(var _0x1ddfee=0x0;_0x1ddfee=_0xa969ae[_0x71a7('0x13')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x12af02(_0x4ef75e);})[_0x71a7('0x14')](function(_0x2cdb21){_0x22c19a(_0x2cdb21);});});}; \ No newline at end of file +var _0x9013=['./license/util','voice','mail','chat','sms','whatsapp','openchannel','getChannels','isValidChannel','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','../mysqldb'];(function(_0x172fc5,_0x18eedb){var _0x40524e=function(_0x46e375){while(--_0x46e375){_0x172fc5['push'](_0x172fc5['shift']());}};_0x40524e(++_0x18eedb);}(_0x9013,0x11d));var _0x3901=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x9013[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x3901('0x0'));var BPromise=require(_0x3901('0x1'));var db=require(_0x3901('0x2'))['db'];var util=require(_0x3901('0x3'));var channels=[_0x3901('0x4'),_0x3901('0x5'),_0x3901('0x6'),'fax',_0x3901('0x7'),_0x3901('0x8'),_0x3901('0x9')];exports[_0x3901('0xa')]=function(){return channels;};exports[_0x3901('0xb')]=function(_0x6a41d8){_0x6a41d8=_0x6a41d8['toLowerCase']();return _[_0x3901('0xc')](channels,_0x6a41d8);};exports[_0x3901('0xd')]=function(_0x2e7d50,_0x53c289,_0x324d55,_0x4f3b16){var _0x197c92={'loginAttempts':_0x53c289,'blocked':_0x324d55};if(!_[_0x3901('0xe')](_0x4f3b16)){_0x197c92[_0x3901('0xf')]=_0x4f3b16;}return _0x2e7d50[_0x3901('0x10')](_0x197c92);};exports['getLicense']=function(_0x2e4185){return new BPromise(function(_0x5f2444,_0x5550a0){var _0x40146b=0x0;if(_0x2e4185[_0x3901('0x11')]!==_0x3901('0x12')){_0x5f2444(_0x2e4185);}db[_0x3901('0x13')][_0x3901('0x14')]({'where':{'role':_0x3901('0x12'),'online':!![],'id':{'$ne':_0x2e4185['id']}}})[_0x3901('0x15')](function(_0x49751e){_0x40146b=_0x49751e;return util['getLicense']();})[_0x3901('0x15')](function(_0x2af2b2){if(_0x2af2b2&&_0x2af2b2[_0x3901('0x16')]&&_0x40146b>=_0x2af2b2['agents']){throw Error(_0x3901('0x17'));}_0x5f2444(_0x2e4185);})['catch'](function(_0xa55f55){_0x5550a0(_0xa55f55);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 249289b..d2020d0 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa88=['Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','Error','inherits','Entity\x20not\x20found'];(function(_0x2688d0,_0x51446f){var _0x38a49d=function(_0x7b462e){while(--_0x7b462e){_0x2688d0['push'](_0x2688d0['shift']());}};_0x38a49d(++_0x51446f);}(_0xaa88,0x137));var _0x8aa8=function(_0x31b31b,_0x5f044e){_0x31b31b=_0x31b31b-0x0;var _0x2c8fc2=_0xaa88[_0x31b31b];return _0x2c8fc2;};'use strict';var util=require(_0x8aa8('0x0'));var logger=require(_0x8aa8('0x1'))(_0x8aa8('0x2'));var APIError=function(_0x51c79b,_0x4aee38){this[_0x8aa8('0x3')]=_0x51c79b||_0x8aa8('0x4');this[_0x8aa8('0x5')]=_0x4aee38||_0x8aa8('0x6');util[_0x8aa8('0x7')](APIError,Error);};var APIBadRequestError=function(_0x350e8b){this['message']=_0x350e8b||'Bad\x20Request';this[_0x8aa8('0x5')]='Bad\x20Request';util[_0x8aa8('0x7')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x1ed84d){this[_0x8aa8('0x3')]=_0x1ed84d||_0x8aa8('0x8');this['name']=_0x8aa8('0x9');util[_0x8aa8('0x7')](APINotFoundError,APIError);};function getStatusCode(_0x224f25){switch(_0x224f25){case'Bad\x20Request':return 0x190;case _0x8aa8('0xa'),_0x8aa8('0xb'):return 0x193;case _0x8aa8('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x33cc5c){return function(_0x583688){logger[_0x8aa8('0xc')](_0x583688[_0x8aa8('0xd')]);var _0x50787d=getStatusCode(_0x583688[_0x8aa8('0x5')]);if(_0x583688[_0x8aa8('0x5')])delete _0x583688[_0x8aa8('0x5')];return _0x33cc5c['status'](_0x50787d)[_0x8aa8('0xe')](_0x583688);};}module[_0x8aa8('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x91a7=['name','inherits','Entity\x20not\x20found','Not\x20Found','Forbidden','OutOfInterval','error','stack','status','send','../config/logger','api','message'];(function(_0x4c8f44,_0x43caf3){var _0x138d99=function(_0x5ae824){while(--_0x5ae824){_0x4c8f44['push'](_0x4c8f44['shift']());}};_0x138d99(++_0x43caf3);}(_0x91a7,0xe7));var _0x791a=function(_0xf73a11,_0x295aeb){_0xf73a11=_0xf73a11-0x0;var _0x57081e=_0x91a7[_0xf73a11];return _0x57081e;};'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 diff --git a/server/errors/index.js b/server/errors/index.js index 31e2bea..4536194 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66e5=['json','exports','status','render'];(function(_0x401fd6,_0x2051db){var _0x3260e6=function(_0x50ba7d){while(--_0x50ba7d){_0x401fd6['push'](_0x401fd6['shift']());}};_0x3260e6(++_0x2051db);}(_0x66e5,0x1a1));var _0x566e=function(_0x4f3da4,_0x121375){_0x4f3da4=_0x4f3da4-0x0;var _0x1df1a1=_0x66e5[_0x4f3da4];return _0x1df1a1;};'use strict';module[_0x566e('0x0')][0x194]=function pageNotFound(_0x5b934e,_0x5e02a4){var _0x10680e='404';var _0x473887=0x194;var _0x1bb931={'status':_0x473887};_0x5e02a4[_0x566e('0x1')](_0x1bb931[_0x566e('0x1')]);_0x5e02a4[_0x566e('0x2')](_0x10680e,{},function(_0x54866a,_0x36fb76){if(_0x54866a){return _0x5e02a4[_0x566e('0x1')](_0x1bb931[_0x566e('0x1')])[_0x566e('0x3')](_0x1bb931);}_0x5e02a4['send'](_0x36fb76);});}; \ No newline at end of file +var _0x7dc9=['render','status','send'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7dc9,0x84));var _0x97dc=function(_0x56c292,_0x18b8a7){_0x56c292=_0x56c292-0x0;var _0x29b759=_0x7dc9[_0x56c292];return _0x29b759;};'use strict';module['exports'][0x194]=function pageNotFound(_0x31295d,_0x241ab9){var _0x27da6c='404';var _0x683565=0x194;var _0x1a776f={'status':_0x683565};_0x241ab9['status'](_0x1a776f['status']);_0x241ab9[_0x97dc('0x0')](_0x27da6c,{},function(_0x3487fa,_0x2b5fab){if(_0x3487fa){return _0x241ab9[_0x97dc('0x1')](_0x1a776f['status'])['json'](_0x1a776f);}_0x241ab9[_0x97dc('0x2')](_0x2b5fab);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index ff294e2..be56f0b 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(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 adebc52..f385ae5 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x17cb=['/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','/api/analytics/tree_reports','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/square/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','/api/migrations','./api/migration','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/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/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/apidoc','static','join','root','/www','/demo','/snippet','/server/files/plugins','route','get','resolve','appPath','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','/api/voice/chanspy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany'];(function(_0x13e45b,_0x5dff4e){var _0xc86a8d=function(_0x642ae2){while(--_0x642ae2){_0x13e45b['push'](_0x13e45b['shift']());}};_0xc86a8d(++_0x5dff4e);}(_0x17cb,0xb5));var _0xb17c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x17cb[_0x321bb2];return _0x9c12ed;};'use strict';var path=require('path');var express=require('express');var errors=require(_0xb17c('0x0'));var config=require(_0xb17c('0x1'));var setupLoggers=require(_0xb17c('0x2'))[_0xb17c('0x3')];var clientSideLogs=require(_0xb17c('0x4'));exports[_0xb17c('0x5')]=function(_0xaddbe0){return setupLoggers(_0xaddbe0)[_0xb17c('0x6')](function(){_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x8'),require('./api/user'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x9'),require('./api/voiceChanSpy'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xa'),require('./api/voiceContext'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xb'),require(_0xb17c('0xc')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xd'),require(_0xb17c('0xe')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf'),require(_0xb17c('0x10')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x11'),require(_0xb17c('0x12')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x13'),require('./api/screenRecording'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x14'),require(_0xb17c('0x15')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x16'),require(_0xb17c('0x17')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x18'),require('./api/voiceCallReport'));_0xaddbe0[_0xb17c('0x7')]('/api/voice/dials/reports',require(_0xb17c('0x19')));_0xaddbe0[_0xb17c('0x7')]('/api/voice/agents/reports',require(_0xb17c('0x1a')));_0xaddbe0[_0xb17c('0x7')]('/api/voice/queues/reports',require(_0xb17c('0x1b')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x1c'),require(_0xb17c('0x1d')));_0xaddbe0['use']('/api/trunks',require(_0xb17c('0x1e')));_0xaddbe0['use'](_0xb17c('0x1f'),require(_0xb17c('0x20')));_0xaddbe0['use'](_0xb17c('0x21'),require(_0xb17c('0x22')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x23'),require(_0xb17c('0x24')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x25'),require(_0xb17c('0x26')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x27'),require(_0xb17c('0x28')));_0xaddbe0['use'](_0xb17c('0x29'),require(_0xb17c('0x2a')));_0xaddbe0[_0xb17c('0x7')]('/api/mail/messages',require(_0xb17c('0x2b')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x2c'),require(_0xb17c('0x2d')));_0xaddbe0['use']('/api/mail/reports/queue',require(_0xb17c('0x2e')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x2f'),require(_0xb17c('0x30')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x31'),require(_0xb17c('0x32')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x33'),require(_0xb17c('0x34')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x35'),require(_0xb17c('0x36')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x37'),require(_0xb17c('0x38')));_0xaddbe0[_0xb17c('0x7')]('/api/fax/messages',require(_0xb17c('0x39')));_0xaddbe0[_0xb17c('0x7')]('/api/fax/queues',require(_0xb17c('0x3a')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x3b'),require('./api/faxQueueReport'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x3c'),require(_0xb17c('0x3d')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x3e'),require(_0xb17c('0x3f')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x40'),require(_0xb17c('0x41')));_0xaddbe0['use'](_0xb17c('0x42'),require(_0xb17c('0x43')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x44'),require(_0xb17c('0x45')));_0xaddbe0[_0xb17c('0x7')]('/api/openchannel/accounts',require(_0xb17c('0x46')));_0xaddbe0['use']('/api/openchannel/applications',require(_0xb17c('0x47')));_0xaddbe0[_0xb17c('0x7')]('/api/openchannel/interactions',require(_0xb17c('0x48')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x49'),require(_0xb17c('0x4a')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x4b'),require(_0xb17c('0x4c')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x4d'),require(_0xb17c('0x4e')));_0xaddbe0['use'](_0xb17c('0x4f'),require(_0xb17c('0x50')));_0xaddbe0[_0xb17c('0x7')]('/api/chat/applications',require(_0xb17c('0x51')));_0xaddbe0[_0xb17c('0x7')]('/api/chat/interactions',require(_0xb17c('0x52')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x53'),require(_0xb17c('0x54')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x55'),require(_0xb17c('0x56')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x57'),require(_0xb17c('0x58')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x59'),require(_0xb17c('0x5a')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x5b'),require(_0xb17c('0x5c')));_0xaddbe0['use'](_0xb17c('0x5d'),require(_0xb17c('0x5e')));_0xaddbe0['use'](_0xb17c('0x5f'),require('./api/cmContact'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x60'),require(_0xb17c('0x61')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x62'),require(_0xb17c('0x63')));_0xaddbe0[_0xb17c('0x7')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0xaddbe0[_0xb17c('0x7')]('/api/cm/hopper_history',require(_0xb17c('0x64')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x65'),require(_0xb17c('0x66')));_0xaddbe0['use'](_0xb17c('0x67'),require(_0xb17c('0x68')));_0xaddbe0['use'](_0xb17c('0x69'),require(_0xb17c('0x6a')));_0xaddbe0[_0xb17c('0x7')]('/api/canned_answers',require(_0xb17c('0x6b')));_0xaddbe0['use'](_0xb17c('0x6c'),require(_0xb17c('0x6d')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x6e'),require(_0xb17c('0x6f')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x70'),require(_0xb17c('0x71')));_0xaddbe0[_0xb17c('0x7')]('/api/pauses',require('./api/pause'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x72'),require(_0xb17c('0x73')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x74'),require(_0xb17c('0x75')));_0xaddbe0[_0xb17c('0x7')]('/api/schedules',require('./api/schedule'));_0xaddbe0[_0xb17c('0x7')]('/api/sounds',require(_0xb17c('0x76')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x77'),require(_0xb17c('0x78')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x79'),require('./api/contactItemType'));_0xaddbe0[_0xb17c('0x7')]('/api/cm_contact_has_items',require(_0xb17c('0x7a')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x7b'),require('./api/cmHopperAdditionalPhone'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x7c'),require('./api/template'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x7d'),require('./api/trigger'));_0xaddbe0[_0xb17c('0x7')]('/api/variables',require(_0xb17c('0x7e')));_0xaddbe0['use']('/api/integrations',require(_0xb17c('0x7f')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x80'),require(_0xb17c('0x81')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x82'),require(_0xb17c('0x83')));_0xaddbe0['use'](_0xb17c('0x84'),require(_0xb17c('0x85')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x86'),require(_0xb17c('0x87')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x88'),require(_0xb17c('0x89')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x8a'),require('./api/analyticFieldReport'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x8b'),require('./api/analyticTreeReport'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x8c'),require('./api/intSalesforceAccount'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x8d'),require(_0xb17c('0x8e')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x8f'),require('./api/intSalesforceField'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x90'),require('./api/intSugarcrmAccount'));_0xaddbe0[_0xb17c('0x7')]('/api/integrations/sugarcrm/configurations',require(_0xb17c('0x91')));_0xaddbe0[_0xb17c('0x7')]('/api/integrations/sugarcrm/fields',require(_0xb17c('0x92')));_0xaddbe0['use'](_0xb17c('0x93'),require(_0xb17c('0x94')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x95'),require(_0xb17c('0x96')));_0xaddbe0['use']('/api/integrations/desk/fields',require(_0xb17c('0x97')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x98'),require(_0xb17c('0x99')));_0xaddbe0['use'](_0xb17c('0x9a'),require(_0xb17c('0x9b')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x9c'),require(_0xb17c('0x9d')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x9e'),require('./api/intZendeskAccount'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x9f'),require(_0xb17c('0xa0')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xa1'),require(_0xb17c('0xa2')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xa3'),require(_0xb17c('0xa4')));_0xaddbe0['use'](_0xb17c('0xa5'),require(_0xb17c('0xa6')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xa7'),require(_0xb17c('0xa8')));_0xaddbe0['use'](_0xb17c('0xa9'),require(_0xb17c('0xaa')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xab'),require(_0xb17c('0xac')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xad'),require(_0xb17c('0xae')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xaf'),require('./api/intServicenowAccount'));_0xaddbe0['use'](_0xb17c('0xb0'),require('./api/intServicenowConfiguration'));_0xaddbe0['use'](_0xb17c('0xb1'),require('./api/intServicenowField'));_0xaddbe0['use'](_0xb17c('0xb2'),require(_0xb17c('0xb3')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xb4'),require(_0xb17c('0xb5')));_0xaddbe0['use']('/api/integrations/dynamics365/fields',require(_0xb17c('0xb6')));_0xaddbe0[_0xb17c('0x7')]('/api/integrations/freshsales/accounts',require(_0xb17c('0xb7')));_0xaddbe0['use'](_0xb17c('0xb8'),require(_0xb17c('0xb9')));_0xaddbe0[_0xb17c('0x7')]('/api/integrations/freshsales/fields',require(_0xb17c('0xba')));_0xaddbe0['use']('/api/networks',require(_0xb17c('0xbb')));_0xaddbe0['use'](_0xb17c('0xbc'),require(_0xb17c('0xbd')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xbe'),require('./api/chatInternalMessage'));_0xaddbe0['use'](_0xb17c('0xbf'),require('./api/jscriptyAnswerReport'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xc0'),require(_0xb17c('0xc1')));_0xaddbe0[_0xb17c('0x7')]('/api/jscripty/sessions/reports',require(_0xb17c('0xc2')));_0xaddbe0[_0xb17c('0x7')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xc3'),require('./api/squareReport'));_0xaddbe0[_0xb17c('0x7')]('/api/square/details/reports',require('./api/squareReportDetail'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xc4'),require(_0xb17c('0xc5')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xc6'),require('./api/setting'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xc7'),require(_0xb17c('0xc8')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xc9'),require('./api/squareProject'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xca'),require('./api/squareRecording'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xcb'),require(_0xb17c('0xcc')));_0xaddbe0[_0xb17c('0x7')]('/api/teams',require(_0xb17c('0xcd')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xce'),require(_0xb17c('0xcf')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xd0'),require('./api/campaign'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xd1'),require(_0xb17c('0xd2')));_0xaddbe0['use'](_0xb17c('0xd3'),require('./api/attachment'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xd4'),require(_0xb17c('0xd5')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xd6'),require(_0xb17c('0xd7')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xd8'),require(_0xb17c('0xd9')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xda'),require('./api/faxTransferReport'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xdb'),require(_0xb17c('0xdc')));_0xaddbe0['use'](_0xb17c('0xdd'),require(_0xb17c('0xde')));_0xaddbe0[_0xb17c('0x7')]('/api/cm/lists',require(_0xb17c('0xdf')));_0xaddbe0[_0xb17c('0x7')]('/api/voice/prefixes',require(_0xb17c('0xe0')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xe1'),require(_0xb17c('0xe2')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xe3'),require(_0xb17c('0xe4')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xe5'),require(_0xb17c('0xe6')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xe7'),require(_0xb17c('0xe8')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xe9'),require('./api/whatsappAccount'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xea'),require(_0xb17c('0xeb')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xec'),require(_0xb17c('0xed')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xee'),require(_0xb17c('0xef')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf0'),require(_0xb17c('0xf1')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf2'),require(_0xb17c('0xf3')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf4'),require('./api/whatsappQueue'));_0xaddbe0[_0xb17c('0x7')]('/api/cloudProviders',require(_0xb17c('0xf5')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf6'),require(_0xb17c('0xf7')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf8'),require('./api/user-setting'));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xf9'),require(_0xb17c('0xfa')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xfb'),require(_0xb17c('0xfc')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xfd'),require(_0xb17c('0xfe')));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0xff'),require(_0xb17c('0x100')));_0xaddbe0[_0xb17c('0x7')]('/api/rpc',require(_0xb17c('0x101')));_0xaddbe0['use'](_0xb17c('0x102'),require('./api/version'));_0xaddbe0['use'](_0xb17c('0x103'),require(_0xb17c('0x104')));_0xaddbe0['use'](_0xb17c('0x105'),require(_0xb17c('0x106')));_0xaddbe0[_0xb17c('0x7')]('/api/webbar',require(_0xb17c('0x107')));_0xaddbe0['use']('/api/logs',clientSideLogs);_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x108'),express[_0xb17c('0x109')](path[_0xb17c('0x10a')](config[_0xb17c('0x10b')],'/apidoc')));_0xaddbe0['use'](_0xb17c('0x10c'),express[_0xb17c('0x109')](path[_0xb17c('0x10a')](config[_0xb17c('0x10b')],_0xb17c('0x10c'))));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x10d'),express['static'](path[_0xb17c('0x10a')](config['root'],_0xb17c('0x10d'))));_0xaddbe0[_0xb17c('0x7')](_0xb17c('0x10e'),express[_0xb17c('0x109')](path[_0xb17c('0x10a')](config[_0xb17c('0x10b')],'snippet','3.1.0')));_0xaddbe0[_0xb17c('0x7')]('/plugins',express[_0xb17c('0x109')](path[_0xb17c('0x10a')](config[_0xb17c('0x10b')],_0xb17c('0x10f'))));_0xaddbe0[_0xb17c('0x110')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xb17c('0x111')](errors[0x194]);_0xaddbe0[_0xb17c('0x110')]('/*')['get'](function(_0xef200f,_0x274661){_0x274661['sendFile'](path[_0xb17c('0x112')](_0xaddbe0[_0xb17c('0x111')](_0xb17c('0x113'))+'/index.html'));});return _0xaddbe0;});}; \ No newline at end of file +var _0x710f=['/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','snippet','/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','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','/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/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','./api/openchannelQueue','/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/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/schedules','./api/schedule','/api/sounds','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/settings','./api/setting','/api/square/odbc','./api/squareProject','./api/squareRecording','/api/square/messages','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication'];(function(_0x70d9fb,_0xde504e){var _0x19a53a=function(_0x3ebd6d){while(--_0x3ebd6d){_0x70d9fb['push'](_0x70d9fb['shift']());}};_0x19a53a(++_0xde504e);}(_0x710f,0x145));var _0xf710=function(_0x3d0825,_0x30b4a2){_0x3d0825=_0x3d0825-0x0;var _0x3bd889=_0x710f[_0x3d0825];return _0x3bd889;};'use strict';var path=require(_0xf710('0x0'));var express=require(_0xf710('0x1'));var errors=require(_0xf710('0x2'));var config=require(_0xf710('0x3'));var setupLoggers=require(_0xf710('0x4'))[_0xf710('0x5')];var clientSideLogs=require(_0xf710('0x6'));exports[_0xf710('0x7')]=function(_0x1222b6){return setupLoggers(_0x1222b6)[_0xf710('0x8')](function(){_0x1222b6[_0xf710('0x9')](_0xf710('0xa'),require(_0xf710('0xb')));_0x1222b6[_0xf710('0x9')](_0xf710('0xc'),require('./api/voiceChanSpy'));_0x1222b6[_0xf710('0x9')](_0xf710('0xd'),require(_0xf710('0xe')));_0x1222b6['use'](_0xf710('0xf'),require(_0xf710('0x10')));_0x1222b6[_0xf710('0x9')](_0xf710('0x11'),require(_0xf710('0x12')));_0x1222b6['use'](_0xf710('0x13'),require(_0xf710('0x14')));_0x1222b6[_0xf710('0x9')](_0xf710('0x15'),require(_0xf710('0x16')));_0x1222b6['use'](_0xf710('0x17'),require(_0xf710('0x18')));_0x1222b6[_0xf710('0x9')](_0xf710('0x19'),require('./api/voiceMail'));_0x1222b6[_0xf710('0x9')]('/api/voice/mails/messages',require('./api/voiceMailMessage'));_0x1222b6['use'](_0xf710('0x1a'),require(_0xf710('0x1b')));_0x1222b6['use'](_0xf710('0x1c'),require(_0xf710('0x1d')));_0x1222b6[_0xf710('0x9')](_0xf710('0x1e'),require(_0xf710('0x1f')));_0x1222b6['use'](_0xf710('0x20'),require(_0xf710('0x21')));_0x1222b6[_0xf710('0x9')](_0xf710('0x22'),require(_0xf710('0x23')));_0x1222b6[_0xf710('0x9')](_0xf710('0x24'),require(_0xf710('0x25')));_0x1222b6['use'](_0xf710('0x26'),require('./api/voiceTransferReport'));_0x1222b6[_0xf710('0x9')](_0xf710('0x27'),require(_0xf710('0x28')));_0x1222b6['use'](_0xf710('0x29'),require(_0xf710('0x2a')));_0x1222b6['use']('/api/mail/queues',require(_0xf710('0x2b')));_0x1222b6['use']('/api/mail/substatuses',require(_0xf710('0x2c')));_0x1222b6['use']('/api/mail/interactions',require('./api/mailInteraction'));_0x1222b6[_0xf710('0x9')](_0xf710('0x2d'),require(_0xf710('0x2e')));_0x1222b6[_0xf710('0x9')](_0xf710('0x2f'),require(_0xf710('0x30')));_0x1222b6[_0xf710('0x9')](_0xf710('0x31'),require(_0xf710('0x32')));_0x1222b6[_0xf710('0x9')](_0xf710('0x33'),require(_0xf710('0x34')));_0x1222b6[_0xf710('0x9')](_0xf710('0x35'),require('./api/dashboardItem'));_0x1222b6[_0xf710('0x9')](_0xf710('0x36'),require(_0xf710('0x37')));_0x1222b6[_0xf710('0x9')](_0xf710('0x38'),require(_0xf710('0x39')));_0x1222b6[_0xf710('0x9')]('/api/fax/interactions',require(_0xf710('0x3a')));_0x1222b6[_0xf710('0x9')](_0xf710('0x3b'),require(_0xf710('0x3c')));_0x1222b6[_0xf710('0x9')]('/api/fax/queues',require(_0xf710('0x3d')));_0x1222b6[_0xf710('0x9')](_0xf710('0x3e'),require(_0xf710('0x3f')));_0x1222b6[_0xf710('0x9')]('/api/sms/accounts',require(_0xf710('0x40')));_0x1222b6[_0xf710('0x9')](_0xf710('0x41'),require(_0xf710('0x42')));_0x1222b6[_0xf710('0x9')](_0xf710('0x43'),require('./api/smsInteraction'));_0x1222b6['use'](_0xf710('0x44'),require(_0xf710('0x45')));_0x1222b6[_0xf710('0x9')](_0xf710('0x46'),require('./api/smsQueue'));_0x1222b6[_0xf710('0x9')](_0xf710('0x47'),require(_0xf710('0x48')));_0x1222b6[_0xf710('0x9')](_0xf710('0x49'),require(_0xf710('0x4a')));_0x1222b6['use'](_0xf710('0x4b'),require(_0xf710('0x4c')));_0x1222b6[_0xf710('0x9')]('/api/openchannel/messages',require(_0xf710('0x4d')));_0x1222b6[_0xf710('0x9')]('/api/openchannel/queues',require(_0xf710('0x4e')));_0x1222b6[_0xf710('0x9')]('/api/chat/websites',require('./api/chatWebsite'));_0x1222b6['use'](_0xf710('0x4f'),require(_0xf710('0x50')));_0x1222b6[_0xf710('0x9')](_0xf710('0x51'),require(_0xf710('0x52')));_0x1222b6[_0xf710('0x9')](_0xf710('0x53'),require(_0xf710('0x54')));_0x1222b6[_0xf710('0x9')](_0xf710('0x55'),require(_0xf710('0x56')));_0x1222b6[_0xf710('0x9')](_0xf710('0x57'),require(_0xf710('0x58')));_0x1222b6[_0xf710('0x9')](_0xf710('0x59'),require('./api/chatQueue'));_0x1222b6['use']('/api/chat/groups',require(_0xf710('0x5a')));_0x1222b6['use'](_0xf710('0x5b'),require(_0xf710('0x5c')));_0x1222b6[_0xf710('0x9')]('/api/cm/companies',require(_0xf710('0x5d')));_0x1222b6[_0xf710('0x9')](_0xf710('0x5e'),require(_0xf710('0x5f')));_0x1222b6[_0xf710('0x9')](_0xf710('0x60'),require('./api/cmHopper'));_0x1222b6[_0xf710('0x9')]('/api/cm/hopper_black',require(_0xf710('0x61')));_0x1222b6[_0xf710('0x9')](_0xf710('0x62'),require(_0xf710('0x63')));_0x1222b6[_0xf710('0x9')](_0xf710('0x64'),require('./api/cmHopperHistory'));_0x1222b6[_0xf710('0x9')](_0xf710('0x65'),require(_0xf710('0x66')));_0x1222b6[_0xf710('0x9')](_0xf710('0x67'),require(_0xf710('0x68')));_0x1222b6['use']('/api/automations',require(_0xf710('0x69')));_0x1222b6[_0xf710('0x9')](_0xf710('0x6a'),require('./api/cannedAnswer'));_0x1222b6[_0xf710('0x9')]('/api/dispositions',require(_0xf710('0x6b')));_0x1222b6[_0xf710('0x9')](_0xf710('0x6c'),require(_0xf710('0x6d')));_0x1222b6[_0xf710('0x9')](_0xf710('0x6e'),require(_0xf710('0x6f')));_0x1222b6[_0xf710('0x9')](_0xf710('0x70'),require('./api/pause'));_0x1222b6[_0xf710('0x9')](_0xf710('0x71'),require(_0xf710('0x72')));_0x1222b6[_0xf710('0x9')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x1222b6[_0xf710('0x9')](_0xf710('0x73'),require(_0xf710('0x74')));_0x1222b6[_0xf710('0x9')](_0xf710('0x75'),require('./api/sound'));_0x1222b6[_0xf710('0x9')]('/api/tags',require(_0xf710('0x76')));_0x1222b6['use'](_0xf710('0x77'),require('./api/contactItemType'));_0x1222b6[_0xf710('0x9')](_0xf710('0x78'),require(_0xf710('0x79')));_0x1222b6[_0xf710('0x9')](_0xf710('0x7a'),require(_0xf710('0x7b')));_0x1222b6['use'](_0xf710('0x7c'),require(_0xf710('0x7d')));_0x1222b6['use'](_0xf710('0x7e'),require(_0xf710('0x7f')));_0x1222b6['use']('/api/variables',require(_0xf710('0x80')));_0x1222b6['use'](_0xf710('0x81'),require(_0xf710('0x82')));_0x1222b6[_0xf710('0x9')](_0xf710('0x83'),require(_0xf710('0x84')));_0x1222b6[_0xf710('0x9')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x1222b6[_0xf710('0x9')]('/api/analytics/default_reports',require(_0xf710('0x85')));_0x1222b6['use'](_0xf710('0x86'),require(_0xf710('0x87')));_0x1222b6['use'](_0xf710('0x88'),require(_0xf710('0x89')));_0x1222b6[_0xf710('0x9')]('/api/analytics/field_reports',require('./api/analyticFieldReport'));_0x1222b6[_0xf710('0x9')](_0xf710('0x8a'),require(_0xf710('0x8b')));_0x1222b6['use']('/api/integrations/salesforce/accounts',require(_0xf710('0x8c')));_0x1222b6['use'](_0xf710('0x8d'),require(_0xf710('0x8e')));_0x1222b6[_0xf710('0x9')](_0xf710('0x8f'),require(_0xf710('0x90')));_0x1222b6[_0xf710('0x9')](_0xf710('0x91'),require(_0xf710('0x92')));_0x1222b6[_0xf710('0x9')](_0xf710('0x93'),require(_0xf710('0x94')));_0x1222b6[_0xf710('0x9')]('/api/integrations/sugarcrm/fields',require(_0xf710('0x95')));_0x1222b6['use'](_0xf710('0x96'),require(_0xf710('0x97')));_0x1222b6[_0xf710('0x9')](_0xf710('0x98'),require(_0xf710('0x99')));_0x1222b6['use'](_0xf710('0x9a'),require('./api/intDeskField'));_0x1222b6[_0xf710('0x9')](_0xf710('0x9b'),require(_0xf710('0x9c')));_0x1222b6[_0xf710('0x9')](_0xf710('0x9d'),require('./api/intZohoConfiguration'));_0x1222b6[_0xf710('0x9')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x1222b6[_0xf710('0x9')](_0xf710('0x9e'),require(_0xf710('0x9f')));_0x1222b6[_0xf710('0x9')]('/api/integrations/zendesk/configurations',require(_0xf710('0xa0')));_0x1222b6[_0xf710('0x9')](_0xf710('0xa1'),require(_0xf710('0xa2')));_0x1222b6[_0xf710('0x9')]('/api/integrations/freshdesk/accounts',require(_0xf710('0xa3')));_0x1222b6[_0xf710('0x9')](_0xf710('0xa4'),require(_0xf710('0xa5')));_0x1222b6[_0xf710('0x9')](_0xf710('0xa6'),require(_0xf710('0xa7')));_0x1222b6['use'](_0xf710('0xa8'),require(_0xf710('0xa9')));_0x1222b6['use'](_0xf710('0xaa'),require(_0xf710('0xab')));_0x1222b6[_0xf710('0x9')]('/api/integrations/vtiger/fields',require(_0xf710('0xac')));_0x1222b6[_0xf710('0x9')](_0xf710('0xad'),require('./api/intServicenowAccount'));_0x1222b6[_0xf710('0x9')](_0xf710('0xae'),require('./api/intServicenowConfiguration'));_0x1222b6[_0xf710('0x9')](_0xf710('0xaf'),require(_0xf710('0xb0')));_0x1222b6[_0xf710('0x9')](_0xf710('0xb1'),require('./api/intDynamics365Account'));_0x1222b6['use'](_0xf710('0xb2'),require(_0xf710('0xb3')));_0x1222b6[_0xf710('0x9')]('/api/integrations/dynamics365/fields',require(_0xf710('0xb4')));_0x1222b6['use'](_0xf710('0xb5'),require(_0xf710('0xb6')));_0x1222b6[_0xf710('0x9')](_0xf710('0xb7'),require(_0xf710('0xb8')));_0x1222b6[_0xf710('0x9')]('/api/integrations/freshsales/fields',require(_0xf710('0xb9')));_0x1222b6[_0xf710('0x9')]('/api/networks',require('./api/network'));_0x1222b6['use'](_0xf710('0xba'),require(_0xf710('0xbb')));_0x1222b6[_0xf710('0x9')](_0xf710('0xbc'),require('./api/chatInternalMessage'));_0x1222b6['use'](_0xf710('0xbd'),require(_0xf710('0xbe')));_0x1222b6['use'](_0xf710('0xbf'),require(_0xf710('0xc0')));_0x1222b6[_0xf710('0x9')](_0xf710('0xc1'),require(_0xf710('0xc2')));_0x1222b6[_0xf710('0x9')](_0xf710('0xc3'),require(_0xf710('0xc4')));_0x1222b6[_0xf710('0x9')]('/api/square/reports',require(_0xf710('0xc5')));_0x1222b6[_0xf710('0x9')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x1222b6[_0xf710('0x9')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x1222b6[_0xf710('0x9')](_0xf710('0xc6'),require(_0xf710('0xc7')));_0x1222b6[_0xf710('0x9')](_0xf710('0xc8'),require('./api/squareOdbc'));_0x1222b6[_0xf710('0x9')]('/api/square/projects',require(_0xf710('0xc9')));_0x1222b6['use']('/api/square/recordings',require(_0xf710('0xca')));_0x1222b6[_0xf710('0x9')](_0xf710('0xcb'),require('./api/squareMessage'));_0x1222b6[_0xf710('0x9')](_0xf710('0xcc'),require(_0xf710('0xcd')));_0x1222b6[_0xf710('0x9')](_0xf710('0xce'),require(_0xf710('0xcf')));_0x1222b6[_0xf710('0x9')](_0xf710('0xd0'),require(_0xf710('0xd1')));_0x1222b6[_0xf710('0x9')](_0xf710('0xd2'),require('./api/migration'));_0x1222b6[_0xf710('0x9')](_0xf710('0xd3'),require(_0xf710('0xd4')));_0x1222b6[_0xf710('0x9')]('/api/plugins',require('./api/plugin'));_0x1222b6[_0xf710('0x9')](_0xf710('0xd5'),require(_0xf710('0xd6')));_0x1222b6[_0xf710('0x9')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1222b6[_0xf710('0x9')](_0xf710('0xd7'),require(_0xf710('0xd8')));_0x1222b6[_0xf710('0x9')](_0xf710('0xd9'),require('./api/openchannelTransferReport'));_0x1222b6['use'](_0xf710('0xda'),require(_0xf710('0xdb')));_0x1222b6[_0xf710('0x9')](_0xf710('0xdc'),require('./api/cmList'));_0x1222b6['use'](_0xf710('0xdd'),require(_0xf710('0xde')));_0x1222b6['use'](_0xf710('0xdf'),require(_0xf710('0xe0')));_0x1222b6[_0xf710('0x9')](_0xf710('0xe1'),require(_0xf710('0xe2')));_0x1222b6[_0xf710('0x9')]('/api/userProfile/resources',require(_0xf710('0xe3')));_0x1222b6[_0xf710('0x9')](_0xf710('0xe4'),require(_0xf710('0xe5')));_0x1222b6[_0xf710('0x9')](_0xf710('0xe6'),require(_0xf710('0xe7')));_0x1222b6[_0xf710('0x9')]('/api/whatsapp/applications',require(_0xf710('0xe8')));_0x1222b6['use'](_0xf710('0xe9'),require('./api/whatsappInteraction'));_0x1222b6[_0xf710('0x9')](_0xf710('0xea'),require(_0xf710('0xeb')));_0x1222b6[_0xf710('0x9')]('/api/whatsapp/reports/queue',require(_0xf710('0xec')));_0x1222b6[_0xf710('0x9')](_0xf710('0xed'),require(_0xf710('0xee')));_0x1222b6[_0xf710('0x9')](_0xf710('0xef'),require(_0xf710('0xf0')));_0x1222b6[_0xf710('0x9')](_0xf710('0xf1'),require(_0xf710('0xf2')));_0x1222b6[_0xf710('0x9')](_0xf710('0xf3'),require('./api/realtime'));_0x1222b6[_0xf710('0x9')](_0xf710('0xf4'),require(_0xf710('0xf5')));_0x1222b6[_0xf710('0x9')]('/api/auth/local',require(_0xf710('0xf6')));_0x1222b6['use'](_0xf710('0xf7'),require(_0xf710('0xf8')));_0x1222b6[_0xf710('0x9')](_0xf710('0xf9'),require(_0xf710('0xfa')));_0x1222b6[_0xf710('0x9')](_0xf710('0xfb'),require(_0xf710('0xfc')));_0x1222b6[_0xf710('0x9')]('/api/rpc',require(_0xf710('0xfd')));_0x1222b6['use'](_0xf710('0xfe'),require(_0xf710('0xff')));_0x1222b6[_0xf710('0x9')](_0xf710('0x100'),require(_0xf710('0x101')));_0x1222b6[_0xf710('0x9')](_0xf710('0x102'),require(_0xf710('0x103')));_0x1222b6[_0xf710('0x9')](_0xf710('0x104'),require(_0xf710('0x105')));_0x1222b6[_0xf710('0x9')](_0xf710('0x106'),clientSideLogs);_0x1222b6[_0xf710('0x9')](_0xf710('0x107'),express[_0xf710('0x108')](path['join'](config[_0xf710('0x109')],_0xf710('0x107'))));_0x1222b6[_0xf710('0x9')](_0xf710('0x10a'),express[_0xf710('0x108')](path[_0xf710('0x10b')](config[_0xf710('0x109')],_0xf710('0x10a'))));_0x1222b6[_0xf710('0x9')](_0xf710('0x10c'),express[_0xf710('0x108')](path[_0xf710('0x10b')](config['root'],_0xf710('0x10c'))));_0x1222b6[_0xf710('0x9')]('/snippet',express['static'](path[_0xf710('0x10b')](config[_0xf710('0x109')],_0xf710('0x10d'),'3.1.0')));_0x1222b6[_0xf710('0x9')](_0xf710('0x10e'),express['static'](path['join'](config[_0xf710('0x109')],_0xf710('0x10f'))));_0x1222b6[_0xf710('0x110')](_0xf710('0x111'))[_0xf710('0x112')](errors[0x194]);_0x1222b6[_0xf710('0x110')]('/*')['get'](function(_0x2fb068,_0x2331dd){_0x2331dd[_0xf710('0x113')](path[_0xf710('0x114')](_0x1222b6['get'](_0xf710('0x115'))+_0xf710('0x116')));});return _0x1222b6;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index dbf1414..d2bddf7 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb83d=['../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.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/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.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/squareReport/squareReport.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','rpc','port','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc'];(function(_0x361d16,_0x40b1f1){var _0x4c99c1=function(_0x4d30fd){while(--_0x4d30fd){_0x361d16['push'](_0x361d16['shift']());}};_0x4c99c1(++_0x40b1f1);}(_0xb83d,0x1d0));var _0xdb83=function(_0xcb097d,_0x2acfb7){_0xcb097d=_0xcb097d-0x0;var _0x132e06=_0xb83d[_0xcb097d];return _0x132e06;};'use strict';var jayson=require(_0xdb83('0x0'));var _=require('lodash');var config=require(_0xdb83('0x1'));exports[_0xdb83('0x2')]=function(){return new Promise(function(_0x58c0d7,_0x294f8c){var _0x114e46={};_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/user/user.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x4')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x5')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x6')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x7')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x8')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x9')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0xa')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/memberReport/memberReport.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0xb')));_0x114e46=_['merge'](_0x114e46,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0xc')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0xd')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0xe')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0xf')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x10')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/mailMessage/mailMessage.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x11')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x12')));_0x114e46=_['merge'](_0x114e46,require('../api/faxAccount/faxAccount.rpc'));_0x114e46=_['merge'](_0x114e46,require('../api/faxApplication/faxApplication.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/faxInteraction/faxInteraction.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x13')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x14')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x15')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/smsInteraction/smsInteraction.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x16')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x17')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x18')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x19')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x1a')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x1b')));_0x114e46=_['merge'](_0x114e46,require('../api/chatInteraction/chatInteraction.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x1c')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x1d')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/cmContact/cmContact.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x1e')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x1f')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x20')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x21')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x22')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x23')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x24')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x25')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x26')));_0x114e46=_['merge'](_0x114e46,require('../api/trigger/trigger.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x27')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x28')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x29')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x2a')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x2b')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x2c')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x2d')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x2e')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x2f')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x30')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x31')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x32')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x33')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x34')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x35')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/squareRecording/squareRecording.rpc'));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x36')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require('../api/campaign/campaign.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x37')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x38')));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x39')));_0x114e46=_['merge'](_0x114e46,require(_0xdb83('0x3a')));_0x114e46=_['merge'](_0x114e46,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x114e46=_[_0xdb83('0x3')](_0x114e46,require(_0xdb83('0x3b')));_0x114e46=_['merge'](_0x114e46,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x54bb49=jayson[_0xdb83('0x3c')](_0x114e46)['http']();var _0x9cb79b=config[_0xdb83('0x3d')][_0xdb83('0x3e')]||config['port']+0x1;var _0x2f8b67=config[_0xdb83('0x3d')]['ip']||_0xdb83('0x3f');_0x54bb49['on']('error',function(_0x46c84c){return _0x294f8c(_0x46c84c);});_0x54bb49[_0xdb83('0x2')](_0x9cb79b,_0x2f8b67,function(){console[_0xdb83('0x40')](_0xdb83('0x41'),_0x2f8b67,_0x9cb79b);require(_0xdb83('0x42'))[_0xdb83('0x43')]();return _0x58c0d7(_0xdb83('0x44')+_0x2f8b67+':'+_0x9cb79b);});});}; \ No newline at end of file +var _0x1aae=['../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/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/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/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','server','rpc','port','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/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc'];(function(_0x38ff36,_0x1e5069){var _0x358e24=function(_0x1be783){while(--_0x1be783){_0x38ff36['push'](_0x38ff36['shift']());}};_0x358e24(++_0x1e5069);}(_0x1aae,0x11d));var _0xe1aa=function(_0x137e5d,_0x3aeaac){_0x137e5d=_0x137e5d-0x0;var _0xb9d177=_0x1aae[_0x137e5d];return _0xb9d177;};'use strict';var jayson=require(_0xe1aa('0x0'));var _=require(_0xe1aa('0x1'));var config=require(_0xe1aa('0x2'));exports[_0xe1aa('0x3')]=function(){return new Promise(function(_0x5c0a14,_0x24268e){var _0x46fcd6={};_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x5')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x6')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x7')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x8')));_0x46fcd6=_['merge'](_0x46fcd6,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x9')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0xa')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0xb')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/trunk/trunk.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0xc')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0xd')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0xe')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0xf')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/mailQueue/mailQueue.rpc'));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x10')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x11')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x12')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x13')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x14')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x15')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x16')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x17')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x18')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x19')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x1a')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x1b')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x1c')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x1d')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x1e')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x1f')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x20')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x21')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x22')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x23')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/chatMessage/chatMessage.rpc'));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x24')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x25')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x26')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x27')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x28')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x29')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x2a')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x2b')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x2c')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x2d')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x2e')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x2f')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/trigger/trigger.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x30')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x31')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x32')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x33')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x34')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x35')));_0x46fcd6=_['merge'](_0x46fcd6,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x36')));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x37')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x38')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x39')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x3a')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x3b')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/squareOdbc/squareOdbc.rpc'));_0x46fcd6=_['merge'](_0x46fcd6,require(_0xe1aa('0x3c')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x3d')));_0x46fcd6=_['merge'](_0x46fcd6,require('../api/squareMessage/squareMessage.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x3e')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x3f')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x40')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x41')));_0x46fcd6=_['merge'](_0x46fcd6,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require(_0xe1aa('0x42')));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x46fcd6=_[_0xe1aa('0x4')](_0x46fcd6,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x344976=jayson[_0xe1aa('0x43')](_0x46fcd6)['http']();var _0x4d0545=config[_0xe1aa('0x44')][_0xe1aa('0x45')]||config[_0xe1aa('0x45')]+0x1;var _0xa41093=config[_0xe1aa('0x44')]['ip']||_0xe1aa('0x46');_0x344976['on']('error',function(_0xba3081){return _0x24268e(_0xba3081);});_0x344976[_0xe1aa('0x3')](_0x4d0545,_0xa41093,function(){console[_0xe1aa('0x47')](_0xe1aa('0x48'),_0xa41093,_0x4d0545);require(_0xe1aa('0x49'))[_0xe1aa('0x4a')]();return _0x5c0a14(_0xe1aa('0x4b')+_0xa41093+':'+_0x4d0545);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f552562..e736fd3 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 _0x1a0c=['command','function','write','inherits','sendRequest','sync','prototype','answer','ANSWER','beep','format','NO\x20MESSAGE','join','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','noop','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','wav','BEEP','streamFile','AGI','exec','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','call','utf8','setEncoding','headers','emit','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','no\x20code','result=','indexOf','startsWith','length','match','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe'];(function(_0x16f4b5,_0x41b541){var _0x1d06a6=function(_0x238fa4){while(--_0x238fa4){_0x16f4b5['push'](_0x16f4b5['shift']());}};_0x1d06a6(++_0x41b541);}(_0x1a0c,0xc0));var _0xc1a0=function(_0x4949ba,_0x5a9616){_0x4949ba=_0x4949ba-0x0;var _0x543b99=_0x1a0c[_0x4949ba];return _0x543b99;};'use strict';var util=require(_0xc1a0('0x0'));var _=require(_0xc1a0('0x1'));var EventEmitter=require('events')[_0xc1a0('0x2')];var AGIReply=require(_0xc1a0('0x3'));var AGIError=require('./error');function AGIChannel(_0xfbce5d){var _0x529e9b=this,_0x115eca=new AGIReply(),_0x3dbf2d=![],_0x541d27={};EventEmitter[_0xc1a0('0x4')](_0x529e9b);_0xfbce5d['setEncoding'](_0xc1a0('0x5'));_0xfbce5d['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x115eca[_0xc1a0('0x6')]('utf8');_0x115eca['on'](_0xc1a0('0x7'),function(_0x1dbc7b){for(var _0x1d8cb9 in _0x1dbc7b){_0x529e9b[_0x1d8cb9]=_0x1dbc7b[_0x1d8cb9];}_0x529e9b[_0xc1a0('0x8')]('ready');});_0x115eca['on'](_0xc1a0('0x9'),function(_0x5aafb5){if(_0x5aafb5[_0xc1a0('0xa')]()==_0xc1a0('0xb')){_0x529e9b[_0xc1a0('0x8')](_0xc1a0('0xb'));return;}if(_0x5aafb5[_0xc1a0('0xc')](0x0,0xb)==_0xc1a0('0xd')){_0x3dbf2d=!![];}if(_0x3dbf2d){_0x541d27['rx']+=_0x5aafb5+'\x0a';if(_0x5aafb5[_0xc1a0('0xe')](_0xc1a0('0xf'))!=-0x1){_0x3dbf2d=![];}}else{_0x541d27['rx']=_0x5aafb5;}if(_0x3dbf2d){return;}if(typeof _0x541d27['cb']=='function'){var _0x3d2f43=_0x541d27['rx'][_0xc1a0('0xc')](0x0,0x3),_0x55a240=null,_0x10ccfb=null;_0x3d2f43=parseInt(_0x3d2f43);if(isNaN(_0x3d2f43)){_0x541d27['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xc1a0('0x10')});return;}if(_0x3d2f43!=0xc8){_0x541d27['cb'](null,{'code':_0x3d2f43,'result':-0x1,'extra':'KO'});return;}_0x55a240=_0x541d27['rx'][_0xc1a0('0xc')](0x4)['replace'](_0xc1a0('0x11'),'');if(_0x55a240[_0xc1a0('0x12')]('\x20')!=-0x1){_0x55a240=_0x55a240['substr'](0x0,_0x55a240[_0xc1a0('0x12')]('\x20'));}if(_[_0xc1a0('0x13')](_0x55a240,'-1')){_0x55a240=parseInt(_0x55a240);}_0x10ccfb=_0x541d27['rx']['split']('\x20');if(_0x10ccfb[_0xc1a0('0x14')]==0x3){_0x10ccfb=_0x10ccfb[0x2][_0xc1a0('0xc')](0x1,_0x10ccfb[0x2][_0xc1a0('0x14')]-0x1);}else if(_0x10ccfb[_0xc1a0('0x14')]>0x3){var _0x8e4f5f=/\((.+)\)/;var _0x29aeae=_0x541d27['rx'][_0xc1a0('0x15')](_0x8e4f5f);if(_0x29aeae){_0x10ccfb=_0x29aeae[0x1];}else{_0x10ccfb=null;}}else{_0x10ccfb=null;}_0x541d27['cb'](null,{'code':_0x3d2f43,'result':_0x55a240,'extra':_0x10ccfb});}});_0xfbce5d['on']('error',function(_0x111c84){_0x529e9b['emit']('error',new AGIError('E_AGI_SOCKET_ERROR',_0x111c84[_0xc1a0('0x16')]));});_0xfbce5d['on'](_0xc1a0('0x17'),function(){_0x529e9b[_0xc1a0('0x8')]('close',new AGIError('E_AGI_SOCKET_CLOSE'));});_0xfbce5d['on']('timeout',function(){_0x529e9b[_0xc1a0('0x8')](_0xc1a0('0x18'),new AGIError(_0xc1a0('0x19')));_0xfbce5d['destroy']();});_0xfbce5d[_0xc1a0('0x1a')](_0x115eca);this[_0xc1a0('0x1b')]=function(_0x1f962b,_0x57971d){var _0x1f962b=_0x1f962b||'',_0x57971d=typeof _0x57971d==_0xc1a0('0x1c')?_0x57971d:new Function();_0x541d27={'tx':_0x1f962b,'rx':'','cb':_0x57971d};_0xfbce5d[_0xc1a0('0x1d')](_0x1f962b+'\x0a');},this[_0xc1a0('0x17')]=function(){_0xfbce5d['destroy']();};}util[_0xc1a0('0x1e')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xc1a0('0x1f')]=function(_0xe2a0bd){return this[_0xc1a0('0x1b')][_0xc1a0('0x20')](this,_0xe2a0bd);};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0x22')]=function(){return this[_0xc1a0('0x1f')](_0xc1a0('0x23'));};AGIChannel[_0xc1a0('0x21')]['getData']=function(_0x50a9e5,_0x286d20,_0xfe9dc8){_0x50a9e5=_0x50a9e5===undefined?_0xc1a0('0x24'):_0x50a9e5;_0x286d20=_0x286d20===undefined?'5':_0x286d20;_0xfe9dc8=_0xfe9dc8===undefined?'1':_0xfe9dc8;return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x50a9e5,_0x286d20*0x3e8,_0xfe9dc8));};AGIChannel[_0xc1a0('0x21')]['noop']=function(_0x2e15e0){_0x2e15e0=_0x2e15e0||_0xc1a0('0x26');return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')]('VERBOSE\x20\x22%s\x22',_0x2e15e0));};AGIChannel[_0xc1a0('0x21')]['exec']=function(_0x43b59e,_0x5a91ce){if(_['isArray'](_0x5a91ce)){return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')]('EXEC\x20%s\x20%s',_0x43b59e,_0x5a91ce[_0xc1a0('0x27')](',')));}return this['sendRequest'](util[_0xc1a0('0x25')](_0xc1a0('0x28'),_0x43b59e,_0x5a91ce));};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0x29')]=function(_0x34c9b7){return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')](_0xc1a0('0x2a'),_0x34c9b7));};AGIChannel['prototype'][_0xc1a0('0x2b')]=function(_0x4ef994){return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')](_0xc1a0('0x2c'),_0x4ef994));};AGIChannel['prototype'][_0xc1a0('0x2d')]=function(_0x2a8d5c){return this['sendRequest'](util[_0xc1a0('0x25')](_0xc1a0('0x2e'),_0x2a8d5c));};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0xb')]=function(){return this[_0xc1a0('0x1f')](_0xc1a0('0x2f'));};AGIChannel[_0xc1a0('0x21')]['setVariable']=function(_0x289e94,_0x4740c2){var _0xd00a1=_[_0xc1a0('0x30')](_0x4740c2)||_[_0xc1a0('0x31')](_0x4740c2)?_0x4740c2[_0xc1a0('0x32')]():_0x4740c2;return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x289e94,_0xd00a1?_0xd00a1[_0xc1a0('0x32')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xc1a0('0x33')]=function(_0x493fa7,_0xcc2cd3){return this['sendRequest'](util[_0xc1a0('0x25')](_0xc1a0('0x34'),_0x493fa7,_0xcc2cd3));};AGIChannel['prototype'][_0xc1a0('0x35')]=function(_0x4d91cd,_0x1101a1){return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')](_0xc1a0('0x36'),_0x4d91cd,_0x1101a1));};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0x37')]=function(_0x3d390a,_0x196dfc){return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')](_0xc1a0('0x38'),_0x3d390a,_0x196dfc));};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0x39')]=function(_0x5d955f,_0x386eb4,_0x3be56d){_0x386eb4=_0x386eb4||this[_0xc1a0('0x3a')];_0x3be56d=_0x3be56d||0x1;this['setContext'](_0x5d955f);this[_0xc1a0('0x2b')](_0x386eb4);this[_0xc1a0('0x2d')](_0x3be56d);return this[_0xc1a0('0x3b')](util['format'](_0xc1a0('0x3c'),_0x5d955f,_0x386eb4,_0x3be56d));};AGIChannel['prototype'][_0xc1a0('0x3d')]=function(_0x501ac5){return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')](_0xc1a0('0x3e'),_0x501ac5));};AGIChannel[_0xc1a0('0x21')]['recordFile']=function(_0x42517a,_0x436815,_0x238196,_0x1c8360,_0x583a46,_0x149329){_0x436815=_0x436815||_0xc1a0('0x3f');_0x238196=_0x238196||'';_0x1c8360=_0x1c8360===undefined?-0x1:_0x1c8360==='-1'?-0x1:_0x1c8360*0x3e8;_0x583a46=_0x583a46===undefined?'':'s='+_0x583a46;_0x149329=_0x149329?_0xc1a0('0x40'):'';return this[_0xc1a0('0x1f')](util[_0xc1a0('0x25')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x42517a,_0x436815,_0x238196,_0x1c8360,_0x149329,_0x583a46));};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0x41')]=function(_0x247b58,_0x31b37a){_0x31b37a=_0x31b37a||'';return this['sendRequest'](util[_0xc1a0('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x247b58,_0x31b37a));};AGIChannel[_0xc1a0('0x21')]['agi']=function(_0x2ffadb){return this['exec'](_0xc1a0('0x42'),_0x2ffadb);};AGIChannel[_0xc1a0('0x21')]['wait']=function(_0xc0843e){return this[_0xc1a0('0x43')](_0xc1a0('0x44'),_0xc0843e);};AGIChannel[_0xc1a0('0x21')][_0xc1a0('0x45')]=function(_0x4a3c31,_0x4d9924){this[_0xc1a0('0x3b')](util['format'](_0xc1a0('0x46'),_0x4a3c31['id'],_0x4a3c31[_0xc1a0('0x47')],_0x4d9924));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xc1a0('0x48')]=AGIChannel; \ No newline at end of file +var _0x5355=['toLowerCase','hangup','emit','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','exec','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','getVariable','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','events','EventEmitter','./reply','setEncoding','utf8','headers','ready','line'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5355,0x91));var _0x5535=function(_0x56d1b5,_0x289333){_0x56d1b5=_0x56d1b5-0x0;var _0x4ad91e=_0x5355[_0x56d1b5];return _0x4ad91e;};'use strict';var util=require(_0x5535('0x0'));var _=require('lodash');var EventEmitter=require(_0x5535('0x1'))[_0x5535('0x2')];var AGIReply=require(_0x5535('0x3'));var AGIError=require('./error');function AGIChannel(_0x2b6648){var _0x39b030=this,_0x20c686=new AGIReply(),_0x4adc95=![],_0x38c24f={};EventEmitter['call'](_0x39b030);_0x2b6648[_0x5535('0x4')](_0x5535('0x5'));_0x2b6648['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x20c686[_0x5535('0x4')](_0x5535('0x5'));_0x20c686['on'](_0x5535('0x6'),function(_0x74cefc){for(var _0x5f0494 in _0x74cefc){_0x39b030[_0x5f0494]=_0x74cefc[_0x5f0494];}_0x39b030['emit'](_0x5535('0x7'));});_0x20c686['on'](_0x5535('0x8'),function(_0x3ababe){if(_0x3ababe[_0x5535('0x9')]()==_0x5535('0xa')){_0x39b030[_0x5535('0xb')](_0x5535('0xa'));return;}if(_0x3ababe[_0x5535('0xc')](0x0,0xb)=='520-Invalid'){_0x4adc95=!![];}if(_0x4adc95){_0x38c24f['rx']+=_0x3ababe+'\x0a';if(_0x3ababe[_0x5535('0xd')](_0x5535('0xe'))!=-0x1){_0x4adc95=![];}}else{_0x38c24f['rx']=_0x3ababe;}if(_0x4adc95){return;}if(typeof _0x38c24f['cb']==_0x5535('0xf')){var _0x19bdc9=_0x38c24f['rx'][_0x5535('0xc')](0x0,0x3),_0xd96b4c=null,_0x2712e9=null;_0x19bdc9=parseInt(_0x19bdc9);if(isNaN(_0x19bdc9)){_0x38c24f['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x5535('0x10')});return;}if(_0x19bdc9!=0xc8){_0x38c24f['cb'](null,{'code':_0x19bdc9,'result':-0x1,'extra':'KO'});return;}_0xd96b4c=_0x38c24f['rx'][_0x5535('0xc')](0x4)[_0x5535('0x11')](_0x5535('0x12'),'');if(_0xd96b4c[_0x5535('0x13')]('\x20')!=-0x1){_0xd96b4c=_0xd96b4c[_0x5535('0x14')](0x0,_0xd96b4c[_0x5535('0x13')]('\x20'));}if(_[_0x5535('0x15')](_0xd96b4c,'-1')){_0xd96b4c=parseInt(_0xd96b4c);}_0x2712e9=_0x38c24f['rx'][_0x5535('0x16')]('\x20');if(_0x2712e9[_0x5535('0x17')]==0x3){_0x2712e9=_0x2712e9[0x2][_0x5535('0xc')](0x1,_0x2712e9[0x2][_0x5535('0x17')]-0x1);}else if(_0x2712e9[_0x5535('0x17')]>0x3){var _0x5684d8=/\((.+)\)/;var _0x4e4951=_0x38c24f['rx'][_0x5535('0x18')](_0x5684d8);if(_0x4e4951){_0x2712e9=_0x4e4951[0x1];}else{_0x2712e9=null;}}else{_0x2712e9=null;}_0x38c24f['cb'](null,{'code':_0x19bdc9,'result':_0xd96b4c,'extra':_0x2712e9});}});_0x2b6648['on'](_0x5535('0x19'),function(_0x1d22d5){_0x39b030[_0x5535('0xb')](_0x5535('0x19'),new AGIError(_0x5535('0x1a'),_0x1d22d5[_0x5535('0x1b')]));});_0x2b6648['on']('close',function(){_0x39b030['emit'](_0x5535('0x1c'),new AGIError(_0x5535('0x1d')));});_0x2b6648['on'](_0x5535('0x1e'),function(){_0x39b030[_0x5535('0xb')](_0x5535('0x1e'),new AGIError(_0x5535('0x1f')));_0x2b6648[_0x5535('0x20')]();});_0x2b6648['pipe'](_0x20c686);this['command']=function(_0x19b301,_0x3ab4aa){var _0x19b301=_0x19b301||'',_0x3ab4aa=typeof _0x3ab4aa==_0x5535('0xf')?_0x3ab4aa:new Function();_0x38c24f={'tx':_0x19b301,'rx':'','cb':_0x3ab4aa};_0x2b6648['write'](_0x19b301+'\x0a');},this[_0x5535('0x1c')]=function(){_0x2b6648[_0x5535('0x20')]();};}util[_0x5535('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x5535('0x22')][_0x5535('0x23')]=function(_0xd50cd0){return this['command'][_0x5535('0x24')](this,_0xd50cd0);};AGIChannel['prototype'][_0x5535('0x25')]=function(){return this[_0x5535('0x23')](_0x5535('0x26'));};AGIChannel[_0x5535('0x22')][_0x5535('0x27')]=function(_0xf23012,_0x1cfb82,_0x4185e2){_0xf23012=_0xf23012===undefined?'beep':_0xf23012;_0x1cfb82=_0x1cfb82===undefined?'5':_0x1cfb82;_0x4185e2=_0x4185e2===undefined?'1':_0x4185e2;return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x29'),_0xf23012,_0x1cfb82*0x3e8,_0x4185e2));};AGIChannel['prototype'][_0x5535('0x2a')]=function(_0x27b985){_0x27b985=_0x27b985||'NO\x20MESSAGE';return this['sendRequest'](util[_0x5535('0x28')]('VERBOSE\x20\x22%s\x22',_0x27b985));};AGIChannel[_0x5535('0x22')][_0x5535('0x2b')]=function(_0x52bfe3,_0x1f5d2f){if(_['isArray'](_0x1f5d2f)){return this[_0x5535('0x23')](util['format'](_0x5535('0x2c'),_0x52bfe3,_0x1f5d2f[_0x5535('0x2d')](',')));}return this['sendRequest'](util[_0x5535('0x28')](_0x5535('0x2c'),_0x52bfe3,_0x1f5d2f));};AGIChannel['prototype']['setContext']=function(_0x536da3){return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x2e'),_0x536da3));};AGIChannel['prototype'][_0x5535('0x2f')]=function(_0x551c48){return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x30'),_0x551c48));};AGIChannel[_0x5535('0x22')][_0x5535('0x31')]=function(_0x3ec141){return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x32'),_0x3ec141));};AGIChannel['prototype'][_0x5535('0xa')]=function(){return this['sendRequest'](_0x5535('0x33'));};AGIChannel['prototype'][_0x5535('0x34')]=function(_0x4e6f16,_0x2f7363){var _0x1a3418=_['isBoolean'](_0x2f7363)||_[_0x5535('0x35')](_0x2f7363)?_0x2f7363['toString']():_0x2f7363;return this['sendRequest'](util[_0x5535('0x28')](_0x5535('0x36'),_0x4e6f16,_0x1a3418?_0x1a3418[_0x5535('0x37')]()[_0x5535('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x5535('0x22')][_0x5535('0x38')]=function(_0x4e6fe7,_0x2858ec){return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x39'),_0x4e6fe7,_0x2858ec));};AGIChannel[_0x5535('0x22')][_0x5535('0x3a')]=function(_0x448afc,_0x5307e5){return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x3b'),_0x448afc,_0x5307e5));};AGIChannel[_0x5535('0x22')][_0x5535('0x3c')]=function(_0x5ac902,_0x2d5c3c){return this['sendRequest'](util[_0x5535('0x28')](_0x5535('0x3d'),_0x5ac902,_0x2d5c3c));};AGIChannel[_0x5535('0x22')][_0x5535('0x3e')]=function(_0x5a6d15,_0x3dadb9,_0x4ad7c6){_0x3dadb9=_0x3dadb9||this[_0x5535('0x3f')];_0x4ad7c6=_0x4ad7c6||0x1;this[_0x5535('0x40')](_0x5a6d15);this[_0x5535('0x2f')](_0x3dadb9);this[_0x5535('0x31')](_0x4ad7c6);return this[_0x5535('0x2a')](util[_0x5535('0x28')](_0x5535('0x41'),_0x5a6d15,_0x3dadb9,_0x4ad7c6));};AGIChannel[_0x5535('0x22')][_0x5535('0x42')]=function(_0x38a16a){return this[_0x5535('0x23')](util[_0x5535('0x28')]('GET\x20VARIABLE\x20\x22%s\x22',_0x38a16a));};AGIChannel[_0x5535('0x22')]['recordFile']=function(_0x20a9f1,_0x3c7ba2,_0x12cd07,_0x547de4,_0x40b84c,_0x197482){_0x3c7ba2=_0x3c7ba2||_0x5535('0x43');_0x12cd07=_0x12cd07||'';_0x547de4=_0x547de4===undefined?-0x1:_0x547de4==='-1'?-0x1:_0x547de4*0x3e8;_0x40b84c=_0x40b84c===undefined?'':'s='+_0x40b84c;_0x197482=_0x197482?'BEEP':'';return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x44'),_0x20a9f1,_0x3c7ba2,_0x12cd07,_0x547de4,_0x197482,_0x40b84c));};AGIChannel['prototype']['streamFile']=function(_0x3c8f92,_0x4167f8){_0x4167f8=_0x4167f8||'';return this[_0x5535('0x23')](util[_0x5535('0x28')](_0x5535('0x45'),_0x3c8f92,_0x4167f8));};AGIChannel['prototype'][_0x5535('0x46')]=function(_0x55b529){return this[_0x5535('0x2b')](_0x5535('0x47'),_0x55b529);};AGIChannel[_0x5535('0x22')][_0x5535('0x48')]=function(_0x27f493){return this[_0x5535('0x2b')](_0x5535('0x49'),_0x27f493);};AGIChannel[_0x5535('0x22')][_0x5535('0x19')]=function(_0x322923,_0x18a321){this['noop'](util['format'](_0x5535('0x4a'),_0x322923['id'],_0x322923[_0x5535('0x4b')],_0x18a321));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x5535('0x4c')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 4a29204..d04547f 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 _0xbaca=['name','exports','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.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbaca,0xc8));var _0xabac=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xbaca[_0x725a4c];return _0x37b2cc;};'use strict';var util=require(_0xabac('0x0'));var error={'E_AGI_UNDEFINED':_0xabac('0x1'),'E_AGI_ARGUMENT_PORT':_0xabac('0x2'),'E_AGI_SERVER_ERROR':_0xabac('0x3'),'E_AGI_SERVER_CLOSE':_0xabac('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xabac('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xabac('0x6'),'E_AGI_SOCKET_ERROR':_0xabac('0x7'),'E_AGI_SOCKET_CLOSE':_0xabac('0x8'),'E_AGI_SOCKET_TIMEOUT':_0xabac('0x9'),'E_AGI_COMMAND_EMPTY':_0xabac('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xabac('0xb'),'E_AGI_IVR_ENTRY':_0xabac('0xc')};function AGIError(_0x4234ba){var _0x4234ba=_0x4234ba||null,_0x40dd5f=_0x40dd5f||[],_0x86eabb=0x1,_0x43ab22='';if(!error[_0x4234ba]){_0x4234ba='E_AGI_UNDEFINED';}_0x40dd5f[_0xabac('0xd')](error[_0x4234ba]);while(arguments[_0x86eabb]){_0x40dd5f[_0xabac('0xd')](arguments[_0x86eabb]);_0x86eabb++;}_0x43ab22=util[_0xabac('0xe')]['apply'](util,_0x40dd5f);this[_0xabac('0xf')]=_0x43ab22;this[_0xabac('0x10')]=_0x4234ba;}module[_0xabac('0x11')]=AGIError; \ No newline at end of file +var _0x040f=['Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','format','apply','message','name','exports','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.'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x040f,0x90));var _0xf040=function(_0x25099c,_0x2588bf){_0x25099c=_0x25099c-0x0;var _0x5f0f01=_0x040f[_0x25099c];return _0x5f0f01;};'use strict';var util=require(_0xf040('0x0'));var error={'E_AGI_UNDEFINED':_0xf040('0x1'),'E_AGI_ARGUMENT_PORT':_0xf040('0x2'),'E_AGI_SERVER_ERROR':_0xf040('0x3'),'E_AGI_SERVER_CLOSE':_0xf040('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xf040('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0xf040('0x6'),'E_AGI_SOCKET_ERROR':_0xf040('0x7'),'E_AGI_SOCKET_CLOSE':_0xf040('0x8'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xf040('0x9'),'E_AGI_IVR_ENTRY':_0xf040('0xa')};function AGIError(_0x294956){var _0x294956=_0x294956||null,_0x27f7a3=_0x27f7a3||[],_0x2704a8=0x1,_0x187a2f='';if(!error[_0x294956]){_0x294956='E_AGI_UNDEFINED';}_0x27f7a3[_0xf040('0xb')](error[_0x294956]);while(arguments[_0x2704a8]){_0x27f7a3[_0xf040('0xb')](arguments[_0x2704a8]);_0x2704a8++;}_0x187a2f=util[_0xf040('0xc')][_0xf040('0xd')](util,_0x27f7a3);this[_0xf040('0xe')]=_0x187a2f;this[_0xf040('0xf')]=_0x294956;}module[_0xf040('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index f7cbae8..3d058be 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 _0x9739=['localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','lodash','events','ioredis','./error','../../config/environment','redis','defaults'];(function(_0x76457,_0x25993d){var _0x25ec0d=function(_0x106b58){while(--_0x106b58){_0x76457['push'](_0x76457['shift']());}};_0x25ec0d(++_0x25993d);}(_0x9739,0x70));var _0x9973=function(_0x447ef1,_0x374cd2){_0x447ef1=_0x447ef1-0x0;var _0x3d72ec=_0x9739[_0x447ef1];return _0x3d72ec;};'use strict';var _=require(_0x9973('0x0'));var EventEmitter=require(_0x9973('0x1'))['EventEmitter'];var Redis=require(_0x9973('0x2'));var AGIError=require(_0x9973('0x3'));var config=require(_0x9973('0x4'));config[_0x9973('0x5')]=_[_0x9973('0x6')](config['redis'],{'host':_0x9973('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x9973('0x5')]);sub[_0x9973('0x8')](_0x9973('0x9'),function(_0x2d4b37){if(_0x2d4b37)return eventEmitter[_0x9973('0xa')](_0x9973('0xb'),new AGIError(_0x9973('0xc'),_0x2d4b37));});sub['on'](_0x9973('0xd'),function(_0x2d8165,_0x59a4e6){if(_0x2d8165!==_0x9973('0x9'))return;try{var _0x190c40=JSON[_0x9973('0xe')](_0x59a4e6);eventEmitter[_0x9973('0xa')](_0x9973('0xf'),_0x190c40);}catch(_0x26d62c){eventEmitter['emit']('error',new AGIError(_0x9973('0xc'),_0x26d62c));}});module[_0x9973('0x10')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xf462=['agi','emit','error','E_AGI_SERVER_ERROR','parse','projectUpdate','exports','lodash','EventEmitter','ioredis','./error','redis','subscribe'];(function(_0xcfd89f,_0x106e8f){var _0x59acd4=function(_0x2e187c){while(--_0x2e187c){_0xcfd89f['push'](_0xcfd89f['shift']());}};_0x59acd4(++_0x106e8f);}(_0xf462,0x132));var _0x2f46=function(_0x33155c,_0x3fdde1){_0x33155c=_0x33155c-0x0;var _0x5becf7=_0xf462[_0x33155c];return _0x5becf7;};'use strict';var _=require(_0x2f46('0x0'));var EventEmitter=require('events')[_0x2f46('0x1')];var Redis=require(_0x2f46('0x2'));var AGIError=require(_0x2f46('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x2f46('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x2f46('0x4')]);sub[_0x2f46('0x5')](_0x2f46('0x6'),function(_0x1d5aef){if(_0x1d5aef)return eventEmitter[_0x2f46('0x7')](_0x2f46('0x8'),new AGIError(_0x2f46('0x9'),_0x1d5aef));});sub['on']('message',function(_0x2dc4be,_0x4bd276){if(_0x2dc4be!==_0x2f46('0x6'))return;try{var _0x2ce2ec=JSON[_0x2f46('0xa')](_0x4bd276);eventEmitter['emit'](_0x2f46('0xb'),_0x2ce2ec);}catch(_0x266469){eventEmitter[_0x2f46('0x7')](_0x2f46('0x8'),new AGIError('E_AGI_SERVER_ERROR',_0x266469));}});module[_0x2f46('0xc')]={'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 626bb99..b906075 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 _0x527a=['includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','getdigits','getsecretdigits','vertices','edges','prototype','addEdge','push','numberOfEdges','size','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','menu','invalid'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x527a,0x1a8));var _0xa527=function(_0x579f6f,_0x669523){_0x579f6f=_0x579f6f-0x0;var _0x4c9ad9=_0x527a[_0x579f6f];return _0x4c9ad9;};'use strict';var _=require(_0xa527('0x0'));var logger=require(_0xa527('0x1'))('agi');var verticesWithRetry=['menu',_0xa527('0x2'),_0xa527('0x3')];var Graph=function(){this[_0xa527('0x4')]={};this[_0xa527('0x5')]={};this['numberOfEdges']=0x0;};Graph[_0xa527('0x6')]['addVertex']=function(_0x2ac709){this[_0xa527('0x4')][_0x2ac709['id']]=_0x2ac709;this[_0xa527('0x5')][_0x2ac709['id']]=[];};Graph['prototype'][_0xa527('0x7')]=function(_0x5cc221,_0x323b64,_0x1342d9){this[_0xa527('0x5')][_0x5cc221][_0xa527('0x8')]({'target':_0x323b64,'condition':_0x1342d9});this[_0xa527('0x9')]+=0x1;};Graph[_0xa527('0x6')]['size']=function(){return _[_0xa527('0xa')](this[_0xa527('0x4')]);};Graph[_0xa527('0x6')]['relations']=function(){return this[_0xa527('0x9')];};Graph['prototype'][_0xa527('0xb')]=function(_0x338628){return this[_0xa527('0x4')][_0x338628];};Graph[_0xa527('0x6')][_0xa527('0xc')]=function(_0x3e322b,_0x4c01f2){if(!this[_0xa527('0x4')][_0x3e322b]){return logger['info'](_0xa527('0xd'));}var _0x204c10=_0x4c01f2(this[_0xa527('0x4')][_0x3e322b]);if(!_0x204c10){return logger[_0xa527('0xe')](_0xa527('0xf'));}if(this[_0xa527('0x5')][_0x3e322b][_0xa527('0x10')]===0x0){return logger[_0xa527('0xe')](_0xa527('0x11'));}for(var _0x3e8c5f=0x0,_0x67ab2f=[],_0xe9c59d=![];_0x3e8c5f\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','then','catch','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','close','timeout','hangup','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6893,0x103));var _0x3689=function(_0x6b4e41,_0x3ed208){_0x6b4e41=_0x6b4e41-0x0;var _0x346877=_0x6893[_0x6b4e41];return _0x346877;};'use strict';var _=require('lodash');var syncho=require(_0x3689('0x0'));var util=require(_0x3689('0x1'));var config=require(_0x3689('0x2'));var logger=require('../../config/logger')(_0x3689('0x3'));var utilLicense=require(_0x3689('0x4'));var rpc=require(_0x3689('0x5'));var Project=require(_0x3689('0x6'));var AGIEmitter=require('./events')[_0x3689('0x7')];var projects=[];config[_0x3689('0x3')]=_[_0x3689('0x8')](config[_0x3689('0x3')],{'ip':_0x3689('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x5aa346){process[_0x3689('0xa')](function(){syncho(function(){try{setChannelVariables(_0x5aa346);agiHandler(_0x5aa346);}catch(_0x159736){logger[_0x3689('0xb')](_0x159736[_0x3689('0xc')]);}});});}function projectUpdateHandler(_0x2aac25){try{var _0x2436d3=_[_0x3689('0xd')](projects,['id',_0x2aac25['id']]);if(_0x2436d3>-0x1){if(_0x2aac25['deleted']===!![]){projects[_0x3689('0xe')](_0x2436d3,0x1);}else{projects[_0x2436d3]=_0x2aac25;}}else{projects[_0x3689('0xf')](_0x2aac25);}}catch(_0x4601ab){logger['error'](_0x4601ab[_0x3689('0xc')]);}}function listeningHandler(){console[_0x3689('0x10')](_0x3689('0x11'),config[_0x3689('0x3')][_0x3689('0x12')]);logger[_0x3689('0x13')](util[_0x3689('0x14')](_0x3689('0x15'),config[_0x3689('0x3')]['ip'],config[_0x3689('0x3')][_0x3689('0x12')]));}function errorHandler(_0x45c392){if(_0x45c392&&_0x45c392[_0x3689('0x16')]&&_0x45c392[_0x3689('0x17')]){logger[_0x3689('0xb')](util[_0x3689('0x14')](_0x3689('0x18'),_0x45c392[_0x3689('0x16')],_0x45c392['message']));}else{logger['error'](util[_0x3689('0x14')](_0x3689('0x19'),_0x45c392[_0x3689('0xc')]));}}function closeHandler(){logger[_0x3689('0x13')](util[_0x3689('0x14')](_0x3689('0x1a'),this[_0x3689('0x1b')],this[_0x3689('0x1c')],this['callerid'],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x3126e6){logger[_0x3689('0xb')](_0x3126e6['stack']);}}function timeoutHandler(){logger[_0x3689('0x13')](util[_0x3689('0x14')](_0x3689('0x1d'),this['arg_1'],this[_0x3689('0x1c')],this['callerid'],this['dnid'],this[_0x3689('0x1e')]));}function hangupHandler(){logger[_0x3689('0x13')](util['format'](_0x3689('0x1f'),this[_0x3689('0x1b')],this[_0x3689('0x1c')],this['callerid'],this['dnid'],this[_0x3689('0x1e')]));this[_0x3689('0x20')]=!![];}function createSquareReport(_0x51fb5d,_0x417767){rpc['createSquareReport'](_0x51fb5d)[_0x3689('0x21')](function(_0x435acb){if(_0x417767){_0x417767(null,_0x435acb);}})[_0x3689('0x22')](function(_0x31827d){if(_0x417767){_0x417767(null,_0x31827d);}});}function setChannelVariables(_0x3b967b){for(var _0x1d2d5c in _0x3b967b){if(_0x3b967b['hasOwnProperty'](_0x1d2d5c)){if(_0x1d2d5c['indexOf'](_0x3689('0x23'))===0x0){_0x3b967b[_0x1d2d5c['substring'](0x4)]=_0x3b967b[_0x1d2d5c];delete _0x3b967b[_0x1d2d5c];}}}}function agiHandler(_0x9e6f35){logger[_0x3689('0x24')](_0x3689('0x25'),JSON[_0x3689('0x26')](_0x9e6f35,null,0x2));logger[_0x3689('0x13')](util[_0x3689('0x14')](_0x3689('0x27'),_0x9e6f35[_0x3689('0x1b')],_0x9e6f35[_0x3689('0x1c')],_0x9e6f35[_0x3689('0x28')],_0x9e6f35[_0x3689('0x29')],_0x9e6f35[_0x3689('0x1e')]));_0x9e6f35['on'](_0x3689('0xb'),errorHandler);_0x9e6f35['on'](_0x3689('0x2a'),closeHandler);_0x9e6f35['on'](_0x3689('0x2b'),timeoutHandler);_0x9e6f35['evtHangup']=![];_0x9e6f35['on'](_0x3689('0x2c'),hangupHandler);var _0x5b3c9e=_[_0x3689('0x2d')](projects,[_0x3689('0x16'),_0x9e6f35[_0x3689('0x1b')]]);if(!_0x5b3c9e)return Project[_0x3689('0x2e')](_0x9e6f35);if(!_0x5b3c9e[_0x3689('0x2f')])return Project[_0x3689('0x30')](_0x9e6f35);return Project[_0x3689('0x31')](_0x5b3c9e,_0x9e6f35);}function main(){var _0x5ca6a3;return utilLicense[_0x3689('0x32')]()[_0x3689('0x21')](function(_0x5742fa){if(!_0x5742fa)return;if(_0x5742fa[_0x3689('0x33')]){if(_0x5742fa[_0x3689('0x34')]&&_0x5742fa[_0x3689('0x34')]>0x0){logger[_0x3689('0x13')](util[_0x3689('0x14')](_0x3689('0x35'),_0x5742fa[_0x3689('0x34')]));_0x5ca6a3=_0x5742fa['callysquare'];}else{logger[_0x3689('0x13')](_0x3689('0x36'));}}else{logger[_0x3689('0x13')](_0x3689('0x37'));_0x5ca6a3=-0x1;}})['then'](function(){return Project[_0x3689('0x38')]();})['then'](function(_0x5d4e44){projects=_0x5d4e44;return;})[_0x3689('0x22')](function(_0x111840){logger['error'](_0x3689('0x39'),_0x111840[_0x3689('0xc')]);})[_0x3689('0x3a')](function(){var _0x1d2806=require('./server')(config[_0x3689('0x3')][_0x3689('0x12')],config[_0x3689('0x3')]['ip'],_0x5ca6a3);_0x1d2806['on'](_0x3689('0xb'),errorHandler);_0x1d2806['on'](_0x3689('0x3b'),listeningHandler);_0x1d2806['on'](_0x3689('0x3c'),connectionHandler);_0x1d2806['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x073d=['handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./rpc','./project','./events','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','dnid','uniqueid','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','close','hangup'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x073d,0x87));var _0xd073=function(_0x1d98da,_0x532964){_0x1d98da=_0x1d98da-0x0;var _0x2a56f2=_0x073d[_0x1d98da];return _0x2a56f2;};'use strict';var _=require(_0xd073('0x0'));var syncho=require(_0xd073('0x1'));var util=require(_0xd073('0x2'));var config=require(_0xd073('0x3'));var logger=require('../../config/logger')(_0xd073('0x4'));var utilLicense=require(_0xd073('0x5'));var rpc=require(_0xd073('0x6'));var Project=require(_0xd073('0x7'));var AGIEmitter=require(_0xd073('0x8'))['EventEmitter'];var projects=[];config[_0xd073('0x4')]=_['defaults'](config[_0xd073('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xd073('0x9'),projectUpdateHandler);function connectionHandler(_0x191da3){process[_0xd073('0xa')](function(){syncho(function(){try{setChannelVariables(_0x191da3);agiHandler(_0x191da3);}catch(_0x3700d3){logger[_0xd073('0xb')](_0x3700d3[_0xd073('0xc')]);}});});}function projectUpdateHandler(_0x1e6e42){try{var _0x177cb2=_[_0xd073('0xd')](projects,['id',_0x1e6e42['id']]);if(_0x177cb2>-0x1){if(_0x1e6e42[_0xd073('0xe')]===!![]){projects[_0xd073('0xf')](_0x177cb2,0x1);}else{projects[_0x177cb2]=_0x1e6e42;}}else{projects['push'](_0x1e6e42);}}catch(_0xc2ffd4){logger[_0xd073('0xb')](_0xc2ffd4[_0xd073('0xc')]);}}function listeningHandler(){console[_0xd073('0x10')](_0xd073('0x11'),config['agi'][_0xd073('0x12')]);logger[_0xd073('0x13')](util[_0xd073('0x14')](_0xd073('0x15'),config[_0xd073('0x4')]['ip'],config['agi'][_0xd073('0x12')]));}function errorHandler(_0x56b5a8){if(_0x56b5a8&&_0x56b5a8[_0xd073('0x16')]&&_0x56b5a8[_0xd073('0x17')]){logger[_0xd073('0xb')](util['format'](_0xd073('0x18'),_0x56b5a8[_0xd073('0x16')],_0x56b5a8['message']));}else{logger[_0xd073('0xb')](util[_0xd073('0x14')](_0xd073('0x19'),_0x56b5a8[_0xd073('0xc')]));}}function closeHandler(){logger[_0xd073('0x13')](util[_0xd073('0x14')](_0xd073('0x1a'),this['arg_1'],this[_0xd073('0x1b')],this[_0xd073('0x1c')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x4b6f9b){logger['error'](_0x4b6f9b['stack']);}}function timeoutHandler(){logger[_0xd073('0x13')](util['format'](_0xd073('0x1d'),this['arg_1'],this[_0xd073('0x1b')],this[_0xd073('0x1c')],this['dnid'],this['uniqueid']));}function hangupHandler(){logger[_0xd073('0x13')](util[_0xd073('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd073('0x1e')],this[_0xd073('0x1b')],this[_0xd073('0x1c')],this[_0xd073('0x1f')],this[_0xd073('0x20')]));this[_0xd073('0x21')]=!![];}function createSquareReport(_0x33fe05,_0x42c7fa){rpc[_0xd073('0x22')](_0x33fe05)[_0xd073('0x23')](function(_0x1db260){if(_0x42c7fa){_0x42c7fa(null,_0x1db260);}})[_0xd073('0x24')](function(_0x1e1bba){if(_0x42c7fa){_0x42c7fa(null,_0x1e1bba);}});}function setChannelVariables(_0xa1038a){for(var _0x220162 in _0xa1038a){if(_0xa1038a[_0xd073('0x25')](_0x220162)){if(_0x220162[_0xd073('0x26')](_0xd073('0x27'))===0x0){_0xa1038a[_0x220162[_0xd073('0x28')](0x4)]=_0xa1038a[_0x220162];delete _0xa1038a[_0x220162];}}}}function agiHandler(_0x37d0ea){logger['debug'](_0xd073('0x29'),JSON[_0xd073('0x2a')](_0x37d0ea,null,0x2));logger['info'](util[_0xd073('0x14')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x37d0ea['arg_1'],_0x37d0ea[_0xd073('0x1b')],_0x37d0ea[_0xd073('0x1c')],_0x37d0ea[_0xd073('0x1f')],_0x37d0ea[_0xd073('0x20')]));_0x37d0ea['on'](_0xd073('0xb'),errorHandler);_0x37d0ea['on'](_0xd073('0x2b'),closeHandler);_0x37d0ea['on']('timeout',timeoutHandler);_0x37d0ea['evtHangup']=![];_0x37d0ea['on'](_0xd073('0x2c'),hangupHandler);var _0x2701ba=_['find'](projects,[_0xd073('0x16'),_0x37d0ea[_0xd073('0x1e')]]);if(!_0x2701ba)return Project[_0xd073('0x2d')](_0x37d0ea);if(!_0x2701ba[_0xd073('0x2e')])return Project[_0xd073('0x2f')](_0x37d0ea);return Project[_0xd073('0x30')](_0x2701ba,_0x37d0ea);}function main(){var _0x2509d8;return utilLicense[_0xd073('0x31')]()[_0xd073('0x23')](function(_0x3abc72){if(!_0x3abc72)return;if(_0x3abc72[_0xd073('0x32')]){if(_0x3abc72[_0xd073('0x33')]&&_0x3abc72[_0xd073('0x33')]>0x0){logger[_0xd073('0x13')](util[_0xd073('0x14')](_0xd073('0x34'),_0x3abc72[_0xd073('0x33')]));_0x2509d8=_0x3abc72['callysquare'];}else{logger[_0xd073('0x13')](_0xd073('0x35'));}}else{logger[_0xd073('0x13')](_0xd073('0x36'));_0x2509d8=-0x1;}})[_0xd073('0x23')](function(){return Project[_0xd073('0x37')]();})[_0xd073('0x23')](function(_0x16e23b){projects=_0x16e23b;return;})[_0xd073('0x24')](function(_0x43a585){logger['error'](_0xd073('0x38'),_0x43a585[_0xd073('0xc')]);})[_0xd073('0x39')](function(){var _0x932035=require('./server')(config['agi'][_0xd073('0x12')],config[_0xd073('0x4')]['ip'],_0x2509d8);_0x932035['on'](_0xd073('0xb'),errorHandler);_0x932035['on'](_0xd073('0x3a'),listeningHandler);_0x932035['on'](_0xd073('0x3b'),connectionHandler);_0x932035['on'](_0xd073('0x2b'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index b976d30..93733f8 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 _0x1a79=['error','result','catch','SendMail','bluebird','http','request','then'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x1a79,0x18c));var _0x91a7=function(_0x4ffafb,_0x20171a){_0x4ffafb=_0x4ffafb-0x0;var _0x4ab472=_0x1a79[_0x4ffafb];return _0x4ab472;};'use strict';var BPromise=require(_0x91a7('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91a7('0x1')]({'port':0x232b});function request(_0x2241dd,_0x4c46a0){return new BPromise(function(_0x3ccc45,_0x101e54){return client[_0x91a7('0x2')](_0x2241dd,_0x4c46a0)[_0x91a7('0x3')](function(_0x479189){if(_0x479189['error']){return _0x101e54(_0x479189[_0x91a7('0x4')]['message']);}else{return _0x3ccc45(_0x479189[_0x91a7('0x5')]);}})[_0x91a7('0x6')](function(_0x4341c3){return _0x101e54(_0x4341c3);});});}exports['sendMailMessage']=function(_0x14af70,_0x5257d0){return request(_0x91a7('0x7'),{'account':_0x14af70,'message':_0x5257d0});}; \ No newline at end of file +var _0x2e39=['SendMail','bluebird','http','request','then','error','message','result','catch','sendMailMessage'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x2e39,0x1c3));var _0x92e3=function(_0x6df0c6,_0x31c818){_0x6df0c6=_0x6df0c6-0x0;var _0x582cfb=_0x2e39[_0x6df0c6];return _0x582cfb;};'use strict';var BPromise=require(_0x92e3('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x92e3('0x1')]({'port':0x232b});function request(_0x3bd50f,_0x17ad19){return new BPromise(function(_0x1bbee5,_0xea8e4a){return client[_0x92e3('0x2')](_0x3bd50f,_0x17ad19)[_0x92e3('0x3')](function(_0x490057){if(_0x490057[_0x92e3('0x4')]){return _0xea8e4a(_0x490057[_0x92e3('0x4')][_0x92e3('0x5')]);}else{return _0x1bbee5(_0x490057[_0x92e3('0x6')]);}})[_0x92e3('0x7')](function(_0xc7e1bd){return _0xea8e4a(_0xc7e1bd);});});}exports[_0x92e3('0x8')]=function(_0x12a140,_0x674bb0){return request(_0x92e3('0x9'),{'account':_0x12a140,'message':_0x674bb0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 2156811..0827273 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 _0xe670=['getSquareProjects','error','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','isUndefined','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','arg_1','toString','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','xml2json','util','../../config/logger','./graph','./vertices'];(function(_0x527930,_0x34c538){var _0x4e643c=function(_0x2b81c3){while(--_0x2b81c3){_0x527930['push'](_0x527930['shift']());}};_0x4e643c(++_0x34c538);}(_0xe670,0x15c));var _0x0e67=function(_0x57b432,_0x1589a0){_0x57b432=_0x57b432-0x0;var _0x2edf2a=_0xe670[_0x57b432];return _0x2edf2a;};'use strict';var _=require('lodash');var moment=require(_0x0e67('0x0'));var parser=require(_0x0e67('0x1'));var util=require(_0x0e67('0x2'));var logger=require(_0x0e67('0x3'))('agi');var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x0e67('0x4'));var Vertices=require(_0x0e67('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x0e67('0x6')]()['catch'](function(_0x26ad50){logger[_0x0e67('0x7')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x26ad50['stack']);return[];});}function addVertex(_0xfcb110,_0x4af28b,_0x5f488e){_0x4af28b[_0x0e67('0x8')]=_0x5f488e;if(_0x4af28b['hasOwnProperty'](_0x0e67('0x9'))){_0x4af28b[_0x0e67('0xa')]=parseInt(_0x4af28b[_0x0e67('0x9')],0xa);}_0xfcb110[_0x0e67('0xb')](_[_0x0e67('0xc')](_0x4af28b,_0x0e67('0xd')));}function initGraph(_0x562438,_0x4fdcec){var _0x4a8dd1=new Graph();for(var _0x5a79c9 in _0x562438){if(_0x562438[_0x0e67('0xe')](_0x5a79c9)){if(_['isArray'](_0x562438[_0x5a79c9])){for(var _0x21831f=0x0;_0x21831f<_0x562438[_0x5a79c9][_0x0e67('0xf')];_0x21831f+=0x1){addVertex(_0x4a8dd1,_0x562438[_0x5a79c9][_0x21831f],_0x5a79c9);}}else{addVertex(_0x4a8dd1,_0x562438[_0x5a79c9],_0x5a79c9);}}}for(var _0x55bcd4=0x0;_0x55bcd4<_0x4fdcec[_0x0e67('0xf')];_0x55bcd4+=0x1){if(_0x4fdcec[_0x55bcd4][_0x0e67('0x10')]&&_0x4fdcec[_0x55bcd4][_0x0e67('0x11')]){_0x4a8dd1[_0x0e67('0x12')](_0x4fdcec[_0x55bcd4][_0x0e67('0x10')],_0x4fdcec[_0x55bcd4][_0x0e67('0x11')],_0x4fdcec[_0x55bcd4][_0x0e67('0x13')]);}}return _0x4a8dd1;}function getRoot(_0x2ccf26){return parser[_0x0e67('0x14')](_0x2ccf26,{'object':!![]})[_0x0e67('0x15')][_0x0e67('0x16')];}function inspect(_0x46db79){return util[_0x0e67('0x17')](_0x46db79,{'showHidden':![],'depth':null});}function initialize(_0x1123df,_0x83645f){var _0x14be61=getRoot(_0x1123df['production']);if(!_0x14be61||!_0x14be61[_0x0e67('0x18')])return;var _0x5d56f7,_0xe3bdd,_0x4e2856;logger[_0x0e67('0x19')]('root',JSON[_0x0e67('0x1a')](_0x14be61,null,0x2));_0x83645f[_0x0e67('0x1b')]=moment()[_0x0e67('0x1c')](_0x0e67('0x1d'));_0x5d56f7=initGraph(_['omit'](_0x14be61,'mxCell'),_0x14be61[_0x0e67('0xd')]);_0xe3bdd=new Vertices(_0x83645f,rpc,mailRpc);logger[_0x0e67('0x1e')](util['format']('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x83645f['arg_1'],_0x83645f[_0x0e67('0x1f')],_0x83645f[_0x0e67('0x20')],_0x83645f[_0x0e67('0x21')],_0x83645f[_0x0e67('0x22')]));_0x5d56f7[_0x0e67('0x23')](_0x14be61[_0x0e67('0x18')]['id'],function(_0x59d82c){try{_0x59d82c=_0xe3bdd[_0x0e67('0x24')](_0x59d82c);logger[_0x0e67('0x19')](_0x0e67('0x25'),JSON[_0x0e67('0x1a')](_0x59d82c,null,0x2));if(_0x59d82c[_0x0e67('0x8')]===_0x0e67('0x26')){logger[_0x0e67('0x1e')](_0x0e67('0x27'));_0x83645f[_0x0e67('0x28')]=_0x59d82c['context']||_0x83645f[_0x0e67('0x28')];_0x83645f[_0x0e67('0x29')]=_0x59d82c[_0x0e67('0x29')];_0x83645f['priority']=_0x59d82c[_0x0e67('0x2a')]?_0x59d82c['priority']-0x1:0x1;return null;}else if(_0x59d82c&&_0xe3bdd[_0x59d82c[_0x0e67('0x8')]]){_0x4e2856=_0xe3bdd[_0x59d82c[_0x0e67('0x8')]](_0x59d82c);logger[_0x0e67('0x1e')](_0x0e67('0x2b'),JSON[_0x0e67('0x1a')](_0x4e2856,null,0x2));if(_0x4e2856&&_0x4e2856['code']===AGI_CODE_SUCCESS&&_0x4e2856[_0x0e67('0x2c')]!==AGI_RESULT_ERROR&&!_0x83645f[_0x0e67('0x2d')]){logger[_0x0e67('0x19')](_0x0e67('0x2b'),inspect(_0x4e2856));return _[_0x0e67('0x2e')](_0x4e2856['result'])?null:_0x4e2856[_0x0e67('0x2c')]['toString']();}else{logger[_0x0e67('0x7')]('response',inspect(_0x4e2856));return null;}}else{logger[_0x0e67('0x7')](_0x0e67('0x2f'));return null;}}catch(_0x47570f){logger[_0x0e67('0x7')](_0x47570f[_0x0e67('0x30')]);return null;}});if(_0x14be61[_0x0e67('0x31')]){logger[_0x0e67('0x1e')](util[_0x0e67('0x1c')](_0x0e67('0x32'),_0x83645f[_0x0e67('0x33')],_0x83645f['calleridname'],_0x83645f[_0x0e67('0x20')],_0x83645f[_0x0e67('0x21')],_0x83645f[_0x0e67('0x22')]));_0x5d56f7['traverseBFS'](_0x14be61[_0x0e67('0x31')]['id'],function(_0x493280){try{_0x493280=_0xe3bdd[_0x0e67('0x24')](_0x493280);logger['debug'](_0x0e67('0x25'),JSON['stringify'](_0x493280,null,0x2));if(_0x493280&&_0xe3bdd[_0x493280[_0x0e67('0x8')]]){_0x4e2856=_0xe3bdd[_0x493280[_0x0e67('0x8')]](_0x493280);if(_0x4e2856){logger[_0x0e67('0x19')](_0x0e67('0x2b'),inspect(_0x4e2856));return _[_0x0e67('0x2e')](_0x4e2856[_0x0e67('0x2c')])?null:_0x4e2856[_0x0e67('0x2c')][_0x0e67('0x34')]();}else{logger[_0x0e67('0x7')](_0x0e67('0x2b'),inspect(_0x4e2856));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x19cc99){logger['error'](_0x19cc99['stack']);return null;}});}logger['info'](util[_0x0e67('0x1c')](_0x0e67('0x35'),_0x83645f[_0x0e67('0x33')],_0x83645f['calleridname'],_0x83645f[_0x0e67('0x20')],_0x83645f[_0x0e67('0x21')],_0x83645f[_0x0e67('0x22')]));logger['info'](util[_0x0e67('0x1c')](_0x0e67('0x36'),_0x83645f[_0x0e67('0x28')],_0x83645f[_0x0e67('0x29')],parseInt(_0x83645f[_0x0e67('0x2a')],0xa)+0x1));_0x83645f[_0x0e67('0x37')](_0x83645f['context'],_0x83645f['extension'],parseInt(_0x83645f['priority'],0xa)+0x1);_0x83645f['close']();}function handleNotFound(_0x46edc2){logger[_0x0e67('0x7')](util[_0x0e67('0x1c')](_0x0e67('0x38'),_0x46edc2[_0x0e67('0x33')]));_0x46edc2[_0x0e67('0x37')](_0x46edc2[_0x0e67('0x28')],_0x46edc2[_0x0e67('0x29')],parseInt(_0x46edc2[_0x0e67('0x2a')],0xa)+0x1);_0x46edc2['close']();}function handleUnpublished(_0x41fe6a){logger[_0x0e67('0x7')](util['format'](_0x0e67('0x39'),_0x41fe6a[_0x0e67('0x33')]));_0x41fe6a[_0x0e67('0x37')](_0x41fe6a[_0x0e67('0x28')],_0x41fe6a[_0x0e67('0x29')],parseInt(_0x41fe6a[_0x0e67('0x2a')],0xa)+0x1);_0x41fe6a['close']();}module[_0x0e67('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xdb49=['format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','info','response','code','evtHangup','isUndefined','result','toString','finally','callerid','traverseBFS','agicommand\x20not\x20found','[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','priority','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','xml2json','util','../../config/logger','agi','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','retry','addVertex','omit','isArray','length','source','target','value','toJson','mxGraphModel','root','production','start','debug','joinAt'];(function(_0x449002,_0x261478){var _0x48a924=function(_0x5c9552){while(--_0x5c9552){_0x449002['push'](_0x449002['shift']());}};_0x48a924(++_0x261478);}(_0xdb49,0x152));var _0x9db4=function(_0xdf44d0,_0x4a169a){_0xdf44d0=_0xdf44d0-0x0;var _0x521571=_0xdb49[_0xdf44d0];return _0x521571;};'use strict';var _=require(_0x9db4('0x0'));var moment=require('moment');var parser=require(_0x9db4('0x1'));var util=require(_0x9db4('0x2'));var logger=require(_0x9db4('0x3'))(_0x9db4('0x4'));var rpc=require('./rpc');var mailRpc=require('./mailRpc');var Graph=require(_0x9db4('0x5'));var Vertices=require(_0x9db4('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x9db4('0x7')]()[_0x9db4('0x8')](function(_0x1fe0ef){logger[_0x9db4('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x1fe0ef[_0x9db4('0xa')]);return[];});}function addVertex(_0x5f0b5d,_0x1b8495,_0x1c1fb0){_0x1b8495[_0x9db4('0xb')]=_0x1c1fb0;if(_0x1b8495[_0x9db4('0xc')](_0x9db4('0xd'))){_0x1b8495['maxRetry']=parseInt(_0x1b8495[_0x9db4('0xd')],0xa);}_0x5f0b5d[_0x9db4('0xe')](_[_0x9db4('0xf')](_0x1b8495,'mxCell'));}function initGraph(_0x22bb94,_0x3420e0){var _0x50d591=new Graph();for(var _0x5b1bfe in _0x22bb94){if(_0x22bb94['hasOwnProperty'](_0x5b1bfe)){if(_[_0x9db4('0x10')](_0x22bb94[_0x5b1bfe])){for(var _0x141165=0x0;_0x141165<_0x22bb94[_0x5b1bfe][_0x9db4('0x11')];_0x141165+=0x1){addVertex(_0x50d591,_0x22bb94[_0x5b1bfe][_0x141165],_0x5b1bfe);}}else{addVertex(_0x50d591,_0x22bb94[_0x5b1bfe],_0x5b1bfe);}}}for(var _0x35147b=0x0;_0x35147b<_0x3420e0[_0x9db4('0x11')];_0x35147b+=0x1){if(_0x3420e0[_0x35147b][_0x9db4('0x12')]&&_0x3420e0[_0x35147b][_0x9db4('0x13')]){_0x50d591['addEdge'](_0x3420e0[_0x35147b][_0x9db4('0x12')],_0x3420e0[_0x35147b][_0x9db4('0x13')],_0x3420e0[_0x35147b][_0x9db4('0x14')]);}}return _0x50d591;}function getRoot(_0x1c110f){return parser[_0x9db4('0x15')](_0x1c110f,{'object':!![]})[_0x9db4('0x16')][_0x9db4('0x17')];}function inspect(_0x4b0150){return util['inspect'](_0x4b0150,{'showHidden':![],'depth':null});}function initialize(_0x3eec06,_0x5f07f6){var _0x17d671=getRoot(_0x3eec06[_0x9db4('0x18')]);if(!_0x17d671||!_0x17d671[_0x9db4('0x19')])return;var _0x1880ea,_0x5089cf,_0x2f8e55;logger[_0x9db4('0x1a')](_0x9db4('0x17'),JSON['stringify'](_0x17d671,null,0x2));_0x5f07f6[_0x9db4('0x1b')]=moment()[_0x9db4('0x1c')](_0x9db4('0x1d'));_0x1880ea=initGraph(_['omit'](_0x17d671,'mxCell'),_0x17d671[_0x9db4('0x1e')]);_0x5089cf=new Vertices(_0x5f07f6,rpc,mailRpc);logger['info'](util[_0x9db4('0x1c')](_0x9db4('0x1f'),_0x5f07f6[_0x9db4('0x20')],_0x5f07f6[_0x9db4('0x21')],_0x5f07f6['callerid'],_0x5f07f6[_0x9db4('0x22')],_0x5f07f6[_0x9db4('0x23')]));_0x1880ea['traverseBFS'](_0x17d671[_0x9db4('0x19')]['id'],function(_0x42ca7b){try{_0x42ca7b=_0x5089cf[_0x9db4('0x24')](_0x42ca7b);logger['debug'](_0x9db4('0x25'),JSON[_0x9db4('0x26')](_0x42ca7b,null,0x2));if(_0x42ca7b['agicommand']===_0x9db4('0x27')){logger['info'](_0x9db4('0x28'));_0x5f07f6['context']=_0x42ca7b[_0x9db4('0x29')]||_0x5f07f6[_0x9db4('0x29')];_0x5f07f6[_0x9db4('0x2a')]=_0x42ca7b['extension'];_0x5f07f6['priority']=_0x42ca7b['priority']?_0x42ca7b['priority']-0x1:0x1;return null;}else if(_0x42ca7b&&_0x5089cf[_0x42ca7b[_0x9db4('0xb')]]){_0x2f8e55=_0x5089cf[_0x42ca7b[_0x9db4('0xb')]](_0x42ca7b);logger[_0x9db4('0x2b')](_0x9db4('0x2c'),JSON[_0x9db4('0x26')](_0x2f8e55,null,0x2));if(_0x2f8e55&&_0x2f8e55[_0x9db4('0x2d')]===AGI_CODE_SUCCESS&&_0x2f8e55['result']!==AGI_RESULT_ERROR&&!_0x5f07f6[_0x9db4('0x2e')]){logger[_0x9db4('0x1a')]('response',inspect(_0x2f8e55));return _[_0x9db4('0x2f')](_0x2f8e55[_0x9db4('0x30')])?null:_0x2f8e55[_0x9db4('0x30')][_0x9db4('0x31')]();}else{logger[_0x9db4('0x9')](_0x9db4('0x2c'),inspect(_0x2f8e55));return null;}}else{logger[_0x9db4('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x248619){logger[_0x9db4('0x9')](_0x248619['stack']);return null;}});if(_0x17d671[_0x9db4('0x32')]){logger[_0x9db4('0x2b')](util[_0x9db4('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5f07f6['arg_1'],_0x5f07f6[_0x9db4('0x21')],_0x5f07f6[_0x9db4('0x33')],_0x5f07f6[_0x9db4('0x22')],_0x5f07f6[_0x9db4('0x23')]));_0x1880ea[_0x9db4('0x34')](_0x17d671[_0x9db4('0x32')]['id'],function(_0x5e11a5){try{_0x5e11a5=_0x5089cf[_0x9db4('0x24')](_0x5e11a5);logger['debug'](_0x9db4('0x25'),JSON[_0x9db4('0x26')](_0x5e11a5,null,0x2));if(_0x5e11a5&&_0x5089cf[_0x5e11a5['agicommand']]){_0x2f8e55=_0x5089cf[_0x5e11a5['agicommand']](_0x5e11a5);if(_0x2f8e55){logger['debug'](_0x9db4('0x2c'),inspect(_0x2f8e55));return _[_0x9db4('0x2f')](_0x2f8e55[_0x9db4('0x30')])?null:_0x2f8e55[_0x9db4('0x30')][_0x9db4('0x31')]();}else{logger['error'](_0x9db4('0x2c'),inspect(_0x2f8e55));return null;}}else{logger[_0x9db4('0x9')](_0x9db4('0x35'));return null;}}catch(_0x415b1f){logger[_0x9db4('0x9')](_0x415b1f['stack']);return null;}});}logger[_0x9db4('0x2b')](util[_0x9db4('0x1c')](_0x9db4('0x36'),_0x5f07f6[_0x9db4('0x20')],_0x5f07f6[_0x9db4('0x21')],_0x5f07f6[_0x9db4('0x33')],_0x5f07f6[_0x9db4('0x22')],_0x5f07f6['uniqueid']));logger[_0x9db4('0x2b')](util[_0x9db4('0x1c')](_0x9db4('0x37'),_0x5f07f6[_0x9db4('0x29')],_0x5f07f6[_0x9db4('0x2a')],parseInt(_0x5f07f6[_0x9db4('0x38')],0xa)+0x1));_0x5f07f6[_0x9db4('0x39')](_0x5f07f6['context'],_0x5f07f6[_0x9db4('0x2a')],parseInt(_0x5f07f6[_0x9db4('0x38')],0xa)+0x1);_0x5f07f6[_0x9db4('0x3a')]();}function handleNotFound(_0x19e39e){logger[_0x9db4('0x9')](util[_0x9db4('0x1c')](_0x9db4('0x3b'),_0x19e39e[_0x9db4('0x20')]));_0x19e39e[_0x9db4('0x39')](_0x19e39e['context'],_0x19e39e[_0x9db4('0x2a')],parseInt(_0x19e39e[_0x9db4('0x38')],0xa)+0x1);_0x19e39e[_0x9db4('0x3a')]();}function handleUnpublished(_0x30bc25){logger[_0x9db4('0x9')](util[_0x9db4('0x1c')]('Project\x20%s\x20not\x20published',_0x30bc25['arg_1']));_0x30bc25[_0x9db4('0x39')](_0x30bc25[_0x9db4('0x29')],_0x30bc25[_0x9db4('0x2a')],parseInt(_0x30bc25[_0x9db4('0x38')],0xa)+0x1);_0x30bc25['close']();}module[_0x9db4('0x3c')]={'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 ccfbf4d..78cf8a8 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 _0xe0c0=['trim','emit','headers','line','exports','util','Transform','call','_localBuffer','inherits','prototype','_transform','_inBody','indexOf','substring','length','split','slice'];(function(_0x15dc5f,_0x165eaa){var _0x15531f=function(_0x9364f9){while(--_0x9364f9){_0x15dc5f['push'](_0x15dc5f['shift']());}};_0x15531f(++_0x165eaa);}(_0xe0c0,0xa7));var _0x0e0c=function(_0x379e37,_0x2830b9){_0x379e37=_0x379e37-0x0;var _0x33e469=_0xe0c0[_0x379e37];return _0x33e469;};'use strict';var util=require(_0x0e0c('0x0'));var Transform=require('stream')[_0x0e0c('0x1')];function AGIReply(_0x22f967){Transform[_0x0e0c('0x2')](this,_0x22f967);this[_0x0e0c('0x3')]='';this['_inBody']=![];}util[_0x0e0c('0x4')](AGIReply,Transform);AGIReply[_0x0e0c('0x5')][_0x0e0c('0x6')]=function(_0x54c73b,_0x4271d1,_0x2856d7){var _0x4a094c='\x0a',_0x14e5de=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xd67cf8=-0x1,_0xf7de29=-0x1,_0x13e45d='',_0xe3ccce=0x0,_0x512f83='',_0x4bc377='';this[_0x0e0c('0x3')]+=_0x54c73b['toString']();_0x512f83=this[_0x0e0c('0x3')];if(!this[_0x0e0c('0x7')]){_0xe3ccce=0x0;while(_0x14e5de[_0xe3ccce]){while((_0xf7de29=_0x512f83[_0x0e0c('0x8')](_0x14e5de[_0xe3ccce]))!=-0x1){_0x13e45d=_0x14e5de[_0xe3ccce];_0x4bc377=_0x512f83[_0x0e0c('0x9')](0x0,_0xf7de29);_0x512f83=_0x512f83[_0x0e0c('0x9')](_0xf7de29+_0x13e45d[_0x0e0c('0xa')]);var _0x45b7fb=_0x4bc377[_0x0e0c('0xb')](_0x4a094c),_0x348502=0x0,_0x5b514a={},_0x246fd6='',_0x5c31c7='',_0x5794fa=-0x1;while(_0x45b7fb[_0x348502]){_0x5794fa=_0x45b7fb[_0x348502][_0x0e0c('0x8')](':');if(_0x5794fa!=-0x1){_0x246fd6=_0x45b7fb[_0x348502][_0x0e0c('0xc')](0x0,_0x5794fa)[_0x0e0c('0xd')]();_0x5c31c7=_0x45b7fb[_0x348502][_0x0e0c('0xc')](_0x5794fa+0x1)[_0x0e0c('0xd')]();if(_0x246fd6['length']>0x0){_0x5b514a[_0x246fd6]=_0x5c31c7;}}else{}_0x348502++;}this[_0x0e0c('0xe')](_0x0e0c('0xf'),_0x5b514a);this[_0x0e0c('0x7')]=!![];}_0xe3ccce++;}this['_localBuffer']=_0x512f83;}else{while((_0xd67cf8=_0x512f83[_0x0e0c('0x8')](_0x4a094c))!=-0x1){_0x4bc377=_0x512f83[_0x0e0c('0x9')](0x0,_0xd67cf8);this[_0x0e0c('0xe')](_0x0e0c('0x10'),_0x4bc377);_0x512f83=_0x512f83[_0x0e0c('0x9')](_0xd67cf8+_0x4a094c[_0x0e0c('0xa')]);}this[_0x0e0c('0x3')]=_0x512f83;}_0x2856d7();};module[_0x0e0c('0x11')]=AGIReply; \ No newline at end of file +var _0x2720=['substring','length','split','indexOf','slice','trim','headers','exports','stream','Transform','call','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','toString','_localBuffer'];(function(_0x95e565,_0x59e36d){var _0x30ac1d=function(_0x1cfc5a){while(--_0x1cfc5a){_0x95e565['push'](_0x95e565['shift']());}};_0x30ac1d(++_0x59e36d);}(_0x2720,0x13a));var _0x0272=function(_0x5381df,_0x1c490c){_0x5381df=_0x5381df-0x0;var _0x586b24=_0x2720[_0x5381df];return _0x586b24;};'use strict';var util=require('util');var Transform=require(_0x0272('0x0'))[_0x0272('0x1')];function AGIReply(_0x3e0292){Transform[_0x0272('0x2')](this,_0x3e0292);this['_localBuffer']='';this[_0x0272('0x3')]=![];}util[_0x0272('0x4')](AGIReply,Transform);AGIReply['prototype'][_0x0272('0x5')]=function(_0x4345a8,_0x21cf87,_0x5bd0b2){var _0x23932a='\x0a',_0x22f461=['\x0a\x0a',_0x0272('0x6')],_0xe4a89b=-0x1,_0x1fc177=-0x1,_0x349058='',_0x404284=0x0,_0x26c52a='',_0x2d0ccc='';this['_localBuffer']+=_0x4345a8[_0x0272('0x7')]();_0x26c52a=this[_0x0272('0x8')];if(!this[_0x0272('0x3')]){_0x404284=0x0;while(_0x22f461[_0x404284]){while((_0x1fc177=_0x26c52a['indexOf'](_0x22f461[_0x404284]))!=-0x1){_0x349058=_0x22f461[_0x404284];_0x2d0ccc=_0x26c52a[_0x0272('0x9')](0x0,_0x1fc177);_0x26c52a=_0x26c52a[_0x0272('0x9')](_0x1fc177+_0x349058[_0x0272('0xa')]);var _0x4e8276=_0x2d0ccc[_0x0272('0xb')](_0x23932a),_0x2ba021=0x0,_0x2ebcfb={},_0x37c6f4='',_0x248f55='',_0x778baf=-0x1;while(_0x4e8276[_0x2ba021]){_0x778baf=_0x4e8276[_0x2ba021][_0x0272('0xc')](':');if(_0x778baf!=-0x1){_0x37c6f4=_0x4e8276[_0x2ba021][_0x0272('0xd')](0x0,_0x778baf)['trim']();_0x248f55=_0x4e8276[_0x2ba021][_0x0272('0xd')](_0x778baf+0x1)[_0x0272('0xe')]();if(_0x37c6f4[_0x0272('0xa')]>0x0){_0x2ebcfb[_0x37c6f4]=_0x248f55;}}else{}_0x2ba021++;}this['emit'](_0x0272('0xf'),_0x2ebcfb);this[_0x0272('0x3')]=!![];}_0x404284++;}this[_0x0272('0x8')]=_0x26c52a;}else{while((_0xe4a89b=_0x26c52a['indexOf'](_0x23932a))!=-0x1){_0x2d0ccc=_0x26c52a[_0x0272('0x9')](0x0,_0xe4a89b);this['emit']('line',_0x2d0ccc);_0x26c52a=_0x26c52a[_0x0272('0x9')](_0xe4a89b+_0x23932a[_0x0272('0xa')]);}this[_0x0272('0x8')]=_0x26c52a;}_0x5bd0b2();};module[_0x0272('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 8e4e41f..29f9244 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 _0x581a=['ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','lodash','moment','client','http','then','error','message','result','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById'];(function(_0x3bba3e,_0x1ca95f){var _0xb7279a=function(_0x3c7f2a){while(--_0x3c7f2a){_0x3bba3e['push'](_0x3bba3e['shift']());}};_0xb7279a(++_0x1ca95f);}(_0x581a,0x127));var _0xa581=function(_0x4e3a1e,_0x33f92d){_0x4e3a1e=_0x4e3a1e-0x0;var _0x4fbe3f=_0x581a[_0x4e3a1e];return _0x4fbe3f;};'use strict';var _=require(_0xa581('0x0'));var moment=require(_0xa581('0x1'));var jayson=require('jayson/promise');var client=jayson[_0xa581('0x2')][_0xa581('0x3')]({'port':0x2329});function request(_0xbe2ff0,_0x22d913){return new Promise(function(_0x3f5c21,_0x4e64cc){return client['request'](_0xbe2ff0,_0x22d913)[_0xa581('0x4')](function(_0x510f40){if(_0x510f40[_0xa581('0x5')]){return _0x4e64cc(_0x510f40[_0xa581('0x5')][_0xa581('0x6')]);}else{return _0x3f5c21(_0x510f40[_0xa581('0x7')]);}})[_0xa581('0x8')](function(_0x1875a5){return _0x4e64cc(_0x1875a5);});});}exports[_0xa581('0x9')]=function(){return request(_0xa581('0xa'),{'options':{'raw':![],'attributes':['id',_0xa581('0xb'),_0xa581('0xc')]}});};exports[_0xa581('0xd')]=function(_0x59edee){return request(_0xa581('0xe'),{'options':{'raw':![],'where':{'name':_0x59edee},'attributes':[_0xa581('0xc')]}});};exports[_0xa581('0xf')]=function(_0x5034a2){return request(_0xa581('0x10'),{'options':{'raw':![],'where':{'id':_0x5034a2},'include':[{'model':_0xa581('0x11'),'as':_0xa581('0x12'),'include':[{'model':'CloudProvider','as':_0xa581('0x13')}]}],'attributes':['id',_0xa581('0xb'),_0xa581('0x14')],'smtp':!![]}});};exports[_0xa581('0x15')]=function(_0x202296){return request('ShowSquareProject',{'options':{'where':{'id':_0x202296},'attributes':[_0xa581('0xb')]}});};exports[_0xa581('0x16')]=function(_0x23b205){return request(_0xa581('0x17'),{'options':{'where':{'id':_0x23b205},'attributes':['name']}});};exports['getVariableById']=function(_0x57d86e){return request(_0xa581('0x18'),{'options':{'where':{'id':_0x57d86e},'attributes':[_0xa581('0xb')]}});};exports[_0xa581('0x19')]=function(_0xf6f762){return request('ShowSquareOdbc',{'options':{'where':{'id':_0xf6f762},'attributes':[_0xa581('0x1a')]}});};exports[_0xa581('0x1b')]=function(_0x1bebe0){return request(_0xa581('0x1c'),{'options':{'where':{'id':_0x1bebe0},'attributes':[_0xa581('0xb')]}});};exports[_0xa581('0x1d')]=function(_0x547074){return request('GetContactByPhone',{'options':{'where':{'phone':_0x547074[_0xa581('0x1e')]},'attributes':['id']}});};exports[_0xa581('0x1f')]=function(_0x2a789a){return request('ShowTrunk',{'options':{'where':{'id':_0x2a789a},'attributes':[_0xa581('0xb')]}});};exports[_0xa581('0x20')]=function(_0x13c4bc){return request(_0xa581('0x21'),{'options':{'where':{'id':_0x13c4bc},'attributes':[_0xa581('0x22')]}});};exports[_0xa581('0x23')]=function(_0x256e26){return request(_0xa581('0x24'),{'options':{'raw':![],'where':{'id':_0x256e26},'include':[{'model':_0xa581('0x25'),'as':_0xa581('0x26')}]}});};exports[_0xa581('0x27')]=function(_0x4706d0){return request(_0xa581('0x28'),{'options':{'where':{'id':_0x4706d0},'attributes':['id','name']}});};exports[_0xa581('0x29')]=function(_0x44fa06){return request(_0xa581('0x2a'),{'body':_0x44fa06});};exports[_0xa581('0x2b')]=function(_0x460d1e){return request(_0xa581('0x2c'),{'body':_0x460d1e});};exports[_0xa581('0x2d')]=function(_0x2207b7){return request(_0xa581('0x2e'),{'body':_[_0xa581('0x2f')](_0x2207b7,{'project_name':_0x2207b7[_0xa581('0x30')],'prev_project_name':_0x2207b7[_0xa581('0x31')]||'','is_subproject':_0x2207b7[_0xa581('0x31')]?!![]:![],'leaveAt':moment()[_0xa581('0x32')](_0xa581('0x33'))})});};exports[_0xa581('0x34')]=function(_0x49fd7b){return request(_0xa581('0x35'),{'body':_0x49fd7b});};exports[_0xa581('0x36')]=function(_0x32388a){return request('CreateSquareMessage',{'body':_0x32388a});};exports[_0xa581('0x37')]=function(_0x1d585b){return request(_0xa581('0x38'),{'options':{'raw':![],'where':{'phone':_0x1d585b[_0xa581('0x1e')],'ListId':_0x1d585b[_0xa581('0x39')]}}})['then'](function(_0x46243b){if(_0x46243b){return _0x46243b;}return request('CreateCmContact',{'body':_0x1d585b});});};exports[_0xa581('0x3a')]=function(_0x54f8db){return request(_0xa581('0x3b'),{'options':{'where':{'id':_0x54f8db},'attributes':[_0xa581('0xb')]}});};exports[_0xa581('0x3c')]=function(_0x329b2e,_0x597b98){return request(_0xa581('0x3d'),{'body':{'interface':_0x597b98},'options':{'where':_0x329b2e}});};exports[_0xa581('0x3e')]=function(_0x2f06c4,_0x5e047a,_0x3b9653){return request(_0xa581('0x3f'),{'body':{'type':_0x5e047a,'uniqueid':_0x3b9653},'options':{'where':_0x2f06c4}});};exports[_0xa581('0x40')]=function(_0x19ea24){return request(_0xa581('0x41'),{'body':{},'options':{'where':_0x19ea24}});};exports['agentLogout']=function(_0x24ec46){return request(_0xa581('0x42'),{'body':{},'options':{'where':_0x24ec46}});}; \ No newline at end of file +var _0x89fe=['YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','LogoutUser','lodash','moment','jayson/promise','client','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','ShowUser','GetContactByPhone','phone','getTrunkById','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSquareDetailsReport','createSquareReport','arg_1','arg_2','format'];(function(_0x50aa2e,_0xfbd6f0){var _0x5e07f0=function(_0x3ed540){while(--_0x3ed540){_0x50aa2e['push'](_0x50aa2e['shift']());}};_0x5e07f0(++_0xfbd6f0);}(_0x89fe,0x83));var _0xe89f=function(_0x2ccddc,_0x40c85c){_0x2ccddc=_0x2ccddc-0x0;var _0x3d508c=_0x89fe[_0x2ccddc];return _0x3d508c;};'use strict';var _=require(_0xe89f('0x0'));var moment=require(_0xe89f('0x1'));var jayson=require(_0xe89f('0x2'));var client=jayson[_0xe89f('0x3')]['http']({'port':0x2329});function request(_0xebfbaa,_0x4445f1){return new Promise(function(_0x580dce,_0x3d3aa8){return client[_0xe89f('0x4')](_0xebfbaa,_0x4445f1)[_0xe89f('0x5')](function(_0x33a0fd){if(_0x33a0fd[_0xe89f('0x6')]){return _0x3d3aa8(_0x33a0fd[_0xe89f('0x6')][_0xe89f('0x7')]);}else{return _0x580dce(_0x33a0fd['result']);}})[_0xe89f('0x8')](function(_0x3e9998){return _0x3d3aa8(_0x3e9998);});});}exports[_0xe89f('0x9')]=function(){return request(_0xe89f('0xa'),{'options':{'raw':![],'attributes':['id',_0xe89f('0xb'),'production']}});};exports[_0xe89f('0xc')]=function(_0x1c6d8f){return request(_0xe89f('0xd'),{'options':{'raw':![],'where':{'name':_0x1c6d8f},'attributes':[_0xe89f('0xe')]}});};exports[_0xe89f('0xf')]=function(_0x104647){return request(_0xe89f('0x10'),{'options':{'raw':![],'where':{'id':_0x104647},'include':[{'model':_0xe89f('0x11'),'as':_0xe89f('0x12'),'include':[{'model':_0xe89f('0x13'),'as':'CloudProvider'}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x4bbdb6){return request(_0xe89f('0xd'),{'options':{'where':{'id':_0x4bbdb6},'attributes':[_0xe89f('0xb')]}});};exports['getVoiceQueueById']=function(_0x489ef2){return request(_0xe89f('0x14'),{'options':{'where':{'id':_0x489ef2},'attributes':[_0xe89f('0xb')]}});};exports[_0xe89f('0x15')]=function(_0x45d41e){return request(_0xe89f('0x16'),{'options':{'where':{'id':_0x45d41e},'attributes':[_0xe89f('0xb')]}});};exports[_0xe89f('0x17')]=function(_0x3de8a1){return request(_0xe89f('0x18'),{'options':{'where':{'id':_0x3de8a1},'attributes':[_0xe89f('0x19')]}});};exports['getUserById']=function(_0x23f097){return request(_0xe89f('0x1a'),{'options':{'where':{'id':_0x23f097},'attributes':['name']}});};exports['getContactByPhone']=function(_0x11e5e1){return request(_0xe89f('0x1b'),{'options':{'where':{'phone':_0x11e5e1[_0xe89f('0x1c')]},'attributes':['id']}});};exports[_0xe89f('0x1d')]=function(_0xff80f5){return request('ShowTrunk',{'options':{'where':{'id':_0xff80f5},'attributes':['name']}});};exports[_0xe89f('0x1e')]=function(_0x55d126){return request(_0xe89f('0x1f'),{'options':{'where':{'id':_0x55d126},'attributes':[_0xe89f('0x20')]}});};exports[_0xe89f('0x21')]=function(_0x24715c){return request(_0xe89f('0x22'),{'options':{'raw':![],'where':{'id':_0x24715c},'include':[{'model':_0xe89f('0x23'),'as':_0xe89f('0x24')}]}});};exports['getSmsAccountById']=function(_0x415505){return request(_0xe89f('0x25'),{'options':{'where':{'id':_0x415505},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x18b52e){return request('CreateSmsMessage',{'body':_0x18b52e});};exports[_0xe89f('0x26')]=function(_0xe9e162){return request('CreateSquareDetailsReport',{'body':_0xe9e162});};exports[_0xe89f('0x27')]=function(_0x24b0f1){return request('CreateSquareReport',{'body':_['merge'](_0x24b0f1,{'project_name':_0x24b0f1[_0xe89f('0x28')],'prev_project_name':_0x24b0f1[_0xe89f('0x29')]||'','is_subproject':_0x24b0f1[_0xe89f('0x29')]?!![]:![],'leaveAt':moment()[_0xe89f('0x2a')](_0xe89f('0x2b'))})});};exports[_0xe89f('0x2c')]=function(_0x45bf7b){return request('CreateSquareRecording',{'body':_0x45bf7b});};exports['createSquareMessage']=function(_0x2f3642){return request(_0xe89f('0x2d'),{'body':_0x2f3642});};exports[_0xe89f('0x2e')]=function(_0xed3fc9){return request(_0xe89f('0x2f'),{'options':{'raw':![],'where':{'phone':_0xed3fc9['phone'],'ListId':_0xed3fc9[_0xe89f('0x30')]}}})[_0xe89f('0x5')](function(_0x29f7c2){if(_0x29f7c2){return _0x29f7c2;}return request(_0xe89f('0x31'),{'body':_0xed3fc9});});};exports[_0xe89f('0x32')]=function(_0x9944ef){return request(_0xe89f('0x33'),{'options':{'where':{'id':_0x9944ef},'attributes':['name']}});};exports[_0xe89f('0x34')]=function(_0xd2a29,_0x5380c8){return request(_0xe89f('0x35'),{'body':{'interface':_0x5380c8},'options':{'where':_0xd2a29}});};exports[_0xe89f('0x36')]=function(_0x222c40,_0x3670fd,_0x395990){return request(_0xe89f('0x37'),{'body':{'type':_0x3670fd,'uniqueid':_0x395990},'options':{'where':_0x222c40}});};exports['agentUnpause']=function(_0x171abb){return request(_0xe89f('0x38'),{'body':{},'options':{'where':_0x171abb}});};exports['agentLogout']=function(_0x2e3454){return request(_0xe89f('0x39'),{'body':{},'options':{'where':_0x2e3454}});}; \ 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 a63dbc2..bc080a9 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 _0x432b=['exports','./polly'];(function(_0x421e74,_0x38f8b4){var _0x1f4f38=function(_0xafecf9){while(--_0xafecf9){_0x421e74['push'](_0x421e74['shift']());}};_0x1f4f38(++_0x38f8b4);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};var polly=require(_0xb432('0x0'));var lex=require('./lex');module[_0xb432('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x398a=['./polly','./lex','exports'];(function(_0x4f7fe0,_0x18201f){var _0x1e2851=function(_0x448ddc){while(--_0x448ddc){_0x4f7fe0['push'](_0x4f7fe0['shift']());}};_0x1e2851(++_0x18201f);}(_0x398a,0x11a));var _0xa398=function(_0x5c3b18,_0x46ef55){_0x5c3b18=_0x5c3b18-0x0;var _0x1fafde=_0x398a[_0x5c3b18];return _0x1fafde;};var polly=require(_0xa398('0x0'));var lex=require(_0xa398('0x1'));module[_0xa398('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a97c499..baaae97 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 _0xd8b0=['exports','./lib/api'];(function(_0x526a27,_0x8ee13a){var _0x29db51=function(_0x1fd303){while(--_0x1fd303){_0x526a27['push'](_0x526a27['shift']());}};_0x29db51(++_0x8ee13a);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var lex=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]=function(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1){return lex(_0x5a55a3,_0x585166,_0x4b72b0,_0x3ff8df,_0x5b9b89,_0x43bca1);}; \ No newline at end of file +var _0xee5b=['./lib/api'];(function(_0x2effbc,_0x59797f){var _0x3d4f19=function(_0x5567a6){while(--_0x5567a6){_0x2effbc['push'](_0x2effbc['shift']());}};_0x3d4f19(++_0x59797f);}(_0xee5b,0x1f4));var _0xbee5=function(_0x730144,_0x84316b){_0x730144=_0x730144-0x0;var _0xdc0e52=_0xee5b[_0x730144];return _0xdc0e52;};'use strict';var lex=require(_0xbee5('0x0'));module['exports']=function(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857){return lex(_0x7b2344,_0x203bba,_0x4f850a,_0x1893e4,_0x2b93c2,_0x2eb857);}; \ 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 090b385..bf114db 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(_0x2e1d21,_0x492e1a){var _0x22efe8=function(_0x521461){while(--_0x521461){_0x2e1d21['push'](_0x2e1d21['shift']());}};_0x22efe8(++_0x492e1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0xc0c481,_0x2f2339){var _0x33d551=function(_0xa49768){while(--_0xa49768){_0xc0c481['push'](_0xc0c481['shift']());}};_0x33d551(++_0x2f2339);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 9330a5c..b18f58d 100644 --- a/server/services/agi/scripts/aws/polly/index.js +++ b/server/services/agi/scripts/aws/polly/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x990d=['exports','./lib/api'];(function(_0x1524e5,_0x3fbc03){var _0xfdf9bd=function(_0x3ce238){while(--_0x3ce238){_0x1524e5['push'](_0x1524e5['shift']());}};_0xfdf9bd(++_0x3fbc03);}(_0x990d,0x1d7));var _0xd990=function(_0x30bdff,_0x308063){_0x30bdff=_0x30bdff-0x0;var _0x1e7ca9=_0x990d[_0x30bdff];return _0x1e7ca9;};'use strict';var polly=require(_0xd990('0x0'));module[_0xd990('0x1')]=function(_0x198d44,_0x4d8a01,_0x14f3ad,_0x20e4ab,_0x12f889,_0x567c0b,_0x429e55){return polly(_0x198d44,_0x4d8a01,_0x14f3ad,_0x20e4ab,_0x12f889,_0x567c0b,_0x429e55);}; \ No newline at end of file +var _0xc672=['./lib/api','exports'];(function(_0x468200,_0x34c2a7){var _0x28205e=function(_0x244db2){while(--_0x244db2){_0x468200['push'](_0x468200['shift']());}};_0x28205e(++_0x34c2a7);}(_0xc672,0xae));var _0x2c67=function(_0x125571,_0x37d17c){_0x125571=_0x125571-0x0;var _0x5eca5f=_0xc672[_0x125571];return _0x5eca5f;};'use strict';var polly=require(_0x2c67('0x0'));module[_0x2c67('0x1')]=function(_0x6d6d78,_0x5861b6,_0x2865ab,_0xd8f933,_0x39300f,_0x25e263,_0x42ff50){return polly(_0x6d6d78,_0x5861b6,_0x2865ab,_0xd8f933,_0x39300f,_0x25e263,_0x42ff50);}; \ 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 41f6c7d..82718f3 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 _0x09df=['path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','text','mp3'];(function(_0x4a3acd,_0x4bf641){var _0x3efdaa=function(_0x32842d){while(--_0x32842d){_0x4a3acd['push'](_0x4a3acd['shift']());}};_0x3efdaa(++_0x4bf641);}(_0x09df,0x1d4));var _0xf09d=function(_0x479509,_0x1daf8a){_0x479509=_0x479509-0x0;var _0x382da8=_0x09df[_0x479509];return _0x382da8;};'use strict';var fs=require('fs');var path=require(_0xf09d('0x0'));var BPromise=require(_0xf09d('0x1'));var rs=require('randomstring');var AWS=require(_0xf09d('0x2'));function pollyResult(_0x1b7df7,_0x4a1bdb,_0x1b4259){return new BPromise(function(_0x29fc75,_0x5c4c28){_0x1b7df7[_0xf09d('0x3')](_0x4a1bdb,function(_0x5b5d0c,_0x34bb74){if(_0x5b5d0c){_0x5c4c28(_0x5b5d0c);}else if(_0x34bb74){if(_0x34bb74[_0xf09d('0x4')]instanceof Buffer){fs['writeFile'](_0x1b4259,_0x34bb74['AudioStream'],function(_0x8ddd43){if(_0x8ddd43){_0x5c4c28(_0x8ddd43);}else{_0x29fc75();}});}else{_0x5c4c28(new Error(_0xf09d('0x5')));}}else{_0x5c4c28(new Error(_0xf09d('0x6')));}});});}module['exports']=function(_0x2d008b,_0x5ae0d1,_0x549a13,_0x7f48,_0x57aef2,_0x4c3acb,_0x4069bd){var _0x54ef48=new AWS['Polly']({'accessKeyId':_0x2d008b,'secretAccessKey':_0x5ae0d1,'region':_0x549a13});var _0x226cdd={'Text':_0x57aef2,'TextType':_0x4c3acb||_0xf09d('0x7'),'OutputFormat':_0xf09d('0x8'),'VoiceId':_0x7f48};return pollyResult(_0x54ef48,_0x226cdd,_0x4069bd);}; \ No newline at end of file +var _0x7e8c=['Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream'];(function(_0x232a04,_0x1ec03e){var _0x226847=function(_0x26483a){while(--_0x26483a){_0x232a04['push'](_0x232a04['shift']());}};_0x226847(++_0x1ec03e);}(_0x7e8c,0xd1));var _0xc7e8=function(_0x2f6536,_0x328b23){_0x2f6536=_0x2f6536-0x0;var _0x333210=_0x7e8c[_0x2f6536];return _0x333210;};'use strict';var fs=require('fs');var path=require(_0xc7e8('0x0'));var BPromise=require(_0xc7e8('0x1'));var rs=require(_0xc7e8('0x2'));var AWS=require(_0xc7e8('0x3'));function pollyResult(_0x27413b,_0x498d77,_0xbde4ae){return new BPromise(function(_0x2bfaa6,_0x50e6c3){_0x27413b[_0xc7e8('0x4')](_0x498d77,function(_0x210f2a,_0x516686){if(_0x210f2a){_0x50e6c3(_0x210f2a);}else if(_0x516686){if(_0x516686['AudioStream']instanceof Buffer){fs[_0xc7e8('0x5')](_0xbde4ae,_0x516686[_0xc7e8('0x6')],function(_0x53678f){if(_0x53678f){_0x50e6c3(_0x53678f);}else{_0x2bfaa6();}});}else{_0x50e6c3(new Error(_0xc7e8('0x7')));}}else{_0x50e6c3(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xc7e8('0x8')]=function(_0x50633e,_0x1ebce9,_0x2fb811,_0x1f1bea,_0x3669b3,_0x2f1087,_0x12a58d){var _0x5c9a12=new AWS[(_0xc7e8('0x9'))]({'accessKeyId':_0x50633e,'secretAccessKey':_0x1ebce9,'region':_0x2fb811});var _0x3d841d={'Text':_0x3669b3,'TextType':_0x2f1087||_0xc7e8('0xa'),'OutputFormat':_0xc7e8('0xb'),'VoiceId':_0x1f1bea};return pollyResult(_0x5c9a12,_0x3d841d,_0x12a58d);}; \ 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 6280b21..09c0729 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 _0xbb28=['./lib/api','exports'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0xbb28,0x70));var _0x8bb2=function(_0x2475f4,_0x357db6){_0x2475f4=_0x2475f4-0x0;var _0x574e75=_0xbb28[_0x2475f4];return _0x574e75;};'use strict';var asr=require(_0x8bb2('0x0'));module[_0x8bb2('0x1')]=function(_0x112987,_0x2c0a44,_0x3184ee,_0x521fe9){return asr(_0x112987,_0x2c0a44,_0x3184ee);}; \ No newline at end of file +var _0xf24e=['./lib/api'];(function(_0x3db26b,_0x2b9645){var _0x252130=function(_0x28ccaf){while(--_0x28ccaf){_0x3db26b['push'](_0x3db26b['shift']());}};_0x252130(++_0x2b9645);}(_0xf24e,0x1c8));var _0xef24=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0xf24e[_0x3ec333];return _0x15ccb8;};'use strict';var asr=require(_0xef24('0x0'));module['exports']=function(_0x2693e7,_0x417e7b,_0xdc4add,_0x5e2052){return asr(_0x2693e7,_0x417e7b,_0xdc4add);}; \ 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 d104158..869fe70 100644 --- a/server/services/agi/scripts/google/asr/lib/api.js +++ b/server/services/agi/scripts/google/asr/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2121=['undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','8000','url','bluebird','string','filepath\x20should\x20be\x20a\x20string','length','key\x20should\x20be\x20a\x20string'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0x2121,0x1b4));var _0x1212=function(_0x32f790,_0x1eb6fd){_0x32f790=_0x32f790-0x0;var _0x21e667=_0x2121[_0x32f790];return _0x21e667;};'use strict';var url=require(_0x1212('0x0'));var BPromise=require(_0x1212('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x1e00c4,_0x3081d8,_0x3929a1){return new BPromise(function(_0x2447e3,_0x44337c){var _0x553ed1;if(typeof _0x1e00c4!==_0x1212('0x2')||_0x1e00c4['length']===0x0){return _0x44337c(_0x1212('0x3'));}if(typeof _0x3081d8!==_0x1212('0x2')||_0x3081d8[_0x1212('0x4')]===0x0){return _0x44337c(_0x1212('0x5'));}if(typeof _0x3929a1!==_0x1212('0x6')&&(typeof _0x3929a1!==_0x1212('0x2')||_0x3929a1['length']===0x0)){return _0x44337c(_0x1212('0x7'));}try{_0x553ed1=fs[_0x1212('0x8')](_0x1e00c4)[_0x1212('0x9')](_0x1212('0xa'));}catch(_0x15011d){return _0x44337c(_0x15011d);}return _0x2447e3({'method':_0x1212('0xb'),'uri':host+'/v1/speech:recognize?key='+_0x3081d8,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x1212('0xc'),'languageCode':_0x3929a1},'audio':{'content':_0x553ed1}},'json':!![]});});}; \ No newline at end of file +var _0x495e=['string','length','filepath\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','LINEAR16','8000','url','exports'];(function(_0xea5313,_0x5ced37){var _0x5ca006=function(_0x5d0ef3){while(--_0x5d0ef3){_0xea5313['push'](_0xea5313['shift']());}};_0x5ca006(++_0x5ced37);}(_0x495e,0xfb));var _0xe495=function(_0x5814ca,_0x3b6713){_0x5814ca=_0x5814ca-0x0;var _0xeb1833=_0x495e[_0x5814ca];return _0xeb1833;};'use strict';var url=require(_0xe495('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module[_0xe495('0x1')]=function(_0x37c8ad,_0x3fe3a3,_0x2c85b8){return new BPromise(function(_0x4e5ce9,_0x3f119c){var _0x442101;if(typeof _0x37c8ad!==_0xe495('0x2')||_0x37c8ad[_0xe495('0x3')]===0x0){return _0x3f119c(_0xe495('0x4'));}if(typeof _0x3fe3a3!==_0xe495('0x2')||_0x3fe3a3[_0xe495('0x3')]===0x0){return _0x3f119c('key\x20should\x20be\x20a\x20string');}if(typeof _0x2c85b8!=='undefined'&&(typeof _0x2c85b8!=='string'||_0x2c85b8[_0xe495('0x3')]===0x0)){return _0x3f119c('lang\x20should\x20be\x20a\x20string');}try{_0x442101=fs[_0xe495('0x5')](_0x37c8ad)[_0xe495('0x6')](_0xe495('0x7'));}catch(_0x41983d){return _0x3f119c(_0x41983d);}return _0x4e5ce9({'method':_0xe495('0x8'),'uri':host+'/v1/speech:recognize?key='+_0x3fe3a3,'body':{'config':{'encoding':_0xe495('0x9'),'sampleRateHertz':_0xe495('0xa'),'languageCode':_0x2c85b8},'audio':{'content':_0x442101}},'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 e3331e8..5b7cf4d 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 _0xa1b0=['exports'];(function(_0x3b8342,_0x5781a5){var _0x1ed49c=function(_0x56120c){while(--_0x56120c){_0x3b8342['push'](_0x3b8342['shift']());}};_0x1ed49c(++_0x5781a5);}(_0xa1b0,0x140));var _0x0a1b=function(_0x43e226,_0x1e045b){_0x43e226=_0x43e226-0x0;var _0x42e235=_0xa1b0[_0x43e226];return _0x42e235;};var asr=require('./asr');module[_0x0a1b('0x0')]={'asr':asr}; \ No newline at end of file +var _0xfef2=['./asr','exports'];(function(_0x10fd8a,_0x15d6f9){var _0x48e1dc=function(_0x5e0ba9){while(--_0x5e0ba9){_0x10fd8a['push'](_0x10fd8a['shift']());}};_0x48e1dc(++_0x15d6f9);}(_0xfef2,0x12a));var _0x2fef=function(_0x59dd83,_0x573f1b){_0x59dd83=_0x59dd83-0x0;var _0x5dd0de=_0xfef2[_0x59dd83];return _0x5dd0de;};var asr=require(_0x2fef('0x0'));module[_0x2fef('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 2e3eaa0..5e7520f 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 _0xdcb5=['chmodSync','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','resolve','tmp','.mp3','from','audioContent','.wav','googleCloudTTS\x20path','split','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','displayName','queryText','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','channelData','CustomAction','Data','audiofile','apiai-promise','bluebird','dialogflow','http','https','md5','querystring','request-promise','randomstring','sox','google-tts-api','url','parse','util','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','host','path','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','statusCode','finish','finish\x20download\x20file','unlink','pipe','end','https:','WHAT_EVER','data','wav','info','finish\x20to\x20convert','generate','writeFileSync','base64','then'];(function(_0xcc577d,_0x34c2b0){var _0x56366c=function(_0x1ec692){while(--_0x1ec692){_0xcc577d['push'](_0xcc577d['shift']());}};_0x56366c(++_0x34c2b0);}(_0xdcb5,0x1ea));var _0x5dcb=function(_0x1e48d0,_0x20f45a){_0x1e48d0=_0x1e48d0-0x0;var _0x35f8fa=_0xdcb5[_0x1e48d0];return _0x35f8fa;};'use strict';var apiai=require(_0x5dcb('0x0'));var BPromise=require(_0x5dcb('0x1'));var dialogflow=require(_0x5dcb('0x2'));var fs=require('fs');var http=require(_0x5dcb('0x3'));var https=require(_0x5dcb('0x4'));var md5=require(_0x5dcb('0x5'));var path=require('path');var querystring=require(_0x5dcb('0x6'));var rp=require(_0x5dcb('0x7'));var rs=require(_0x5dcb('0x8'));var sox=require(_0x5dcb('0x9'));var tts=require(_0x5dcb('0xa'));var urlParse=require(_0x5dcb('0xb'))[_0x5dcb('0xc')];var util=require(_0x5dcb('0xd'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x5dcb('0xe'));var tilde=require(_0x5dcb('0xf'));var logger=require('../../../config/logger')(_0x5dcb('0x10'));var ISPEECH_API=_0x5dcb('0x11');function downloadFile(_0xd70a2d,_0x271fd5){return new BPromise(function(_0x34f42d,_0x556a4f){var _0x580817=urlParse(_0xd70a2d);var _0xc6fd2=_0x580817[_0x5dcb('0x12')]==='https:'?https:http;var _0x5373f8={'host':_0x580817[_0x5dcb('0x13')],'path':_0x580817[_0x5dcb('0x14')],'headers':{'user-agent':'WHAT_EVER'}};_0xc6fd2[_0x5dcb('0x15')](_0x5373f8,function(_0x535ba1){if(_0x535ba1['statusCode']!==0xc8){logger[_0x5dcb('0x16')](_0x5dcb('0x17')+_0xd70a2d+_0x5dcb('0x18')+_0x535ba1['statusCode']+'\x20('+_0x535ba1[_0x5dcb('0x19')]+')');_0x556a4f(new Error(_0x5dcb('0x17')+_0xd70a2d+_0x5dcb('0x18')+_0x535ba1[_0x5dcb('0x1a')]+'\x20('+_0x535ba1['statusMessage']+')'));return;}var _0x140d98=fs['createWriteStream'](_0x271fd5);_0x140d98['on'](_0x5dcb('0x1b'),function(){logger['info'](_0x5dcb('0x1c'));_0x140d98['close'](_0x34f42d);});_0x140d98['on']('error',function(_0x38d1d6){fs[_0x5dcb('0x1d')](_0x271fd5);logger[_0x5dcb('0x16')]('download\x20error',_0x38d1d6);_0x556a4f(_0x38d1d6);});_0x535ba1[_0x5dcb('0x1e')](_0x140d98);})['on']('error',function(_0x2dc735){logger[_0x5dcb('0x16')](_0x2dc735);_0x556a4f(_0x2dc735);})[_0x5dcb('0x1f')]();});}function uploadFile(_0x1a0c8d){return new BPromise(function(_0x2e00a5,_0x1f65fd){var _0x36753d=urlParse(_0x1a0c8d);var _0x167e77=_0x36753d[_0x5dcb('0x12')]===_0x5dcb('0x20')?https:http;var _0x499ee6={'host':_0x36753d[_0x5dcb('0x13')],'path':_0x36753d['path'],'headers':{'user-agent':_0x5dcb('0x21')}};_0x167e77['get'](_0x499ee6,function(_0x29f5cc){if(_0x29f5cc[_0x5dcb('0x1a')]!==0xc8){_0x1f65fd(new Error('request\x20to\x20'+_0x1a0c8d+_0x5dcb('0x18')+_0x29f5cc['statusCode']+'\x20('+_0x29f5cc[_0x5dcb('0x19')]+')'));return;}var _0x183b5d='';_0x29f5cc['on'](_0x5dcb('0x22'),function(_0xf4422a){_0x183b5d+=_0xf4422a;});_0x29f5cc['on'](_0x5dcb('0x1f'),function(){_0x2e00a5(_0x183b5d);});})['on']('error',function(_0x77c7e5){_0x1f65fd(_0x77c7e5);})['end']();});}function convertFile(_0x340c5b,_0x3c84bc){return new BPromise(function(_0x456a6b,_0x15459d){var _0x3c18e9=sox['transcode'](_0x340c5b,_0x3c84bc,{'sampleRate':0x1f40,'format':_0x5dcb('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c18e9['on'](_0x5dcb('0x16'),function(_0x116de3){logger[_0x5dcb('0x16')]('error\x20convert',_0x116de3);_0x15459d(_0x116de3);});_0x3c18e9['on']('end',function(){logger[_0x5dcb('0x24')](_0x5dcb('0x25'));_0x456a6b();});_0x3c18e9['start']();});}function base64Decode(_0x4fcc9c,_0x11e118){var _0x1c696e=path['resolve'](__dirname,'tmp',rs[_0x5dcb('0x26')](0x4)+'.wav');fs[_0x5dcb('0x27')](_0x1c696e,_0x4fcc9c,_0x5dcb('0x28'));return convertFile(_0x1c696e,_0x11e118)[_0x5dcb('0x29')](function(){try{fs[_0x5dcb('0x1d')](_0x1c696e);fs[_0x5dcb('0x2a')](_0x11e118,_0x5dcb('0x2b'));}catch(_0x3ab4a5){logger[_0x5dcb('0x16')](_0x3ab4a5);}return _0x11e118['split']('.')[0x0];});}function base64Encode(_0x1ac03c){var _0x3d560d=fs[_0x5dcb('0x2c')](_0x1ac03c);return new Buffer(_0x3d560d)[_0x5dcb('0x2d')]('base64');}exports['googleCloudTTS']=function(_0x399bee,_0x467274,_0x30573c,_0x4fa0ce,_0x3c1764,_0x1a5d7c){var _0x40e9d9,_0x1adc83;var _0x1f6805=_0x5dcb('0x2e');var _0x1223c0=_0x5dcb('0x2f')+_0x399bee;var _0x24763c={};if(_0x467274===_0x5dcb('0x30')){_0x24763c[_0x5dcb('0x31')]={'ssml':_0x30573c};}else{_0x24763c[_0x5dcb('0x31')]={'text':_0x30573c};};_0x24763c[_0x5dcb('0x32')]={'languageCode':_0x4fa0ce,'ssmlGender':_0x3c1764};_0x24763c[_0x5dcb('0x33')]={'audioEncoding':_0x5dcb('0x34'),'sampleRateHertz':0x1f40};var _0x4fd7e4={'url':_0x1f6805+_0x5dcb('0x35')+_0x1223c0,'method':'POST','json':!![],'body':_0x24763c};return rp(_0x4fd7e4)[_0x5dcb('0x29')](function(_0xd4fc3d){return new BPromise(function(_0x32448c,_0x303906){_0x40e9d9=path[_0x5dcb('0x36')](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+_0x5dcb('0x38'));var _0x512ecf=Buffer[_0x5dcb('0x39')](_0xd4fc3d[_0x5dcb('0x3a')],_0x5dcb('0x28'));return fs['writeFile'](_0x40e9d9,_0x512ecf,function(_0x2250fe){_0x303906(_0x2250fe);},function(_0x56c708){fs[_0x5dcb('0x2a')](_0x40e9d9,_0x5dcb('0x2b'));_0x32448c(_0x56c708);});});})[_0x5dcb('0x29')](function(_0x284fce){_0x1adc83=path[_0x5dcb('0x36')](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+_0x5dcb('0x3b'));return convertFile(_0x40e9d9,_0x1adc83);})[_0x5dcb('0x29')](function(){try{fs[_0x5dcb('0x1d')](_0x40e9d9);fs[_0x5dcb('0x2a')](_0x1adc83,_0x5dcb('0x2b'));}catch(_0x49892e){logger['error'](_0x49892e);}logger['info'](_0x5dcb('0x3c'),_0x1adc83['split']('.')[0x0]);return _0x1adc83[_0x5dcb('0x3d')]('.')[0x0];});};exports['googleTTS']=function(_0x2850eb,_0x3079cc){var _0x2516b1=_0x5dcb('0x3e');var _0x1e6637,_0x2fd8ca;var _0x803765;var _0x3ac793={'encoding':_0x5dcb('0x3f'),'method':'POST','timeout':0x2710,'url':_0x2516b1,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':'f.req='+encodeURIComponent(JSON[_0x5dcb('0x40')]([[['jQ1olc',JSON[_0x5dcb('0x40')]([_0x2850eb,_0x3079cc||'en',![],_0x5dcb('0x41')]),null,_0x5dcb('0x42')]]]))};return rp(_0x3ac793)[_0x5dcb('0x29')](function(_0x2cd3e0){try{_0x803765=eval(_0x2cd3e0[_0x5dcb('0x43')](0x5))[0x0][0x2];}catch(_0x3f0329){throw new Error(_0x5dcb('0x44')+_0x2cd3e0[_0x5dcb('0x22')]);}if(!_0x803765){if(_0x2850eb[_0x5dcb('0x45')]>0xc8){throw new Error(_0x5dcb('0x46'));}else{throw new Error(_0x5dcb('0x47')+_0x3079cc+'\x22\x20might\x20not\x20exist');}}try{_0x803765=eval(_0x803765)[0x0];}catch(_0x404957){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x5dcb('0x22')]);}const _0x457acd=_0x803765;_0x1e6637=path['resolve'](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+_0x5dcb('0x38'));fs[_0x5dcb('0x27')](_0x1e6637,_0x803765,{'encoding':'base64'});_0x2fd8ca=path[_0x5dcb('0x36')](__dirname,'tmp',rs[_0x5dcb('0x26')](0x4)+'.wav');return convertFile(_0x1e6637,_0x2fd8ca);})['then'](function(){try{fs['unlink'](_0x1e6637);fs[_0x5dcb('0x2a')](_0x2fd8ca,_0x5dcb('0x2b'));}catch(_0x271b98){logger[_0x5dcb('0x16')](_0x271b98);}logger[_0x5dcb('0x24')](_0x5dcb('0x48'),_0x2fd8ca[_0x5dcb('0x3d')]('.')[0x0]);return _0x2fd8ca['split']('.')[0x0];});};exports[_0x5dcb('0x49')]=function(_0x3adbea,_0x3e5ca0,_0x5abec9){return google[_0x5dcb('0x4a')](_0x3adbea,_0x3e5ca0,_0x5abec9)[_0x5dcb('0x29')](function(_0x3993e9){logger[_0x5dcb('0x24')](_0x3993e9[_0x5dcb('0x4b')]);return rp(_0x3993e9);})['then'](function(_0x12590e){var _0x364d80='';var _0x5ee021=0x0;try{fs[_0x5dcb('0x1d')](_0x3adbea);}catch(_0x5c4ae7){logger['error'](_0x5c4ae7);}if(_0x12590e&&_0x12590e[_0x5dcb('0x4c')]){_0x364d80=_0x12590e['results'][_0x5dcb('0x4d')](function(_0x56c719){return _0x56c719&&_0x56c719[_0x5dcb('0x4e')][0x0]&&_0x56c719[_0x5dcb('0x4e')][0x0][_0x5dcb('0x4f')]?_0x56c719['alternatives'][0x0][_0x5dcb('0x4f')]:'';})[_0x5dcb('0x50')]('\x0a');_0x5ee021=_0x12590e[_0x5dcb('0x4c')][_0x5dcb('0x4d')](function(_0x282284){return _0x282284&&_0x282284['alternatives'][0x0]&&_0x282284[_0x5dcb('0x4e')][0x0][_0x5dcb('0x51')]?_0x282284['alternatives'][0x0][_0x5dcb('0x51')]:0x0;})['join']('\x0a');}logger[_0x5dcb('0x24')](_0x5dcb('0x52'),_0x364d80);logger['info']('googleASR\x20confidence',_0x5ee021);return{'transcript':_0x364d80,'confidence':_0x5ee021};})['catch'](function(_0x50cc77){logger[_0x5dcb('0x16')](_0x5dcb('0x53'),_0x50cc77['statusCode'],_0x50cc77[_0x5dcb('0x54')],_0x50cc77[_0x5dcb('0x55')]);});};exports[_0x5dcb('0x56')]=function(_0x55eb30,_0x3f42f5,_0x1c4dc2,_0x21ac1f){var _0x346461=apiai(_0x3f42f5,{'language':_0x21ac1f||'en'});return _0x346461[_0x5dcb('0x57')](_0x1c4dc2,{'sessionId':md5(_0x55eb30)})[_0x5dcb('0x29')](function(_0x30ffe8){logger['info'](JSON['stringify'](_0x30ffe8));return{'source':_0x30ffe8[_0x5dcb('0x58')][_0x5dcb('0x59')],'resolvedQuery':_0x30ffe8['result']['resolvedQuery'],'action':_0x30ffe8['result'][_0x5dcb('0x5a')],'actionIncomplete':_0x30ffe8[_0x5dcb('0x58')][_0x5dcb('0x5b')],'speech':_0x30ffe8[_0x5dcb('0x58')][_0x5dcb('0x5c')][_0x5dcb('0x5d')],'score':_0x30ffe8[_0x5dcb('0x58')][_0x5dcb('0x5e')],'statusCode':_0x30ffe8['status'][_0x5dcb('0x5f')],'endConversation':_0x30ffe8[_0x5dcb('0x58')][_0x5dcb('0x60')][_0x5dcb('0x61')]||![],'isFallbackIntent':_0x30ffe8[_0x5dcb('0x58')][_0x5dcb('0x60')][_0x5dcb('0x62')]};});};exports[_0x5dcb('0x63')]=function(_0xe5f9aa,_0x1c1317,_0x2046eb,_0x928f58,_0x335f55,_0xd3205f){var _0x4074b3=_0x928f58[_0x5dcb('0x64')](/\\n/g,'\x0a');var _0x33570a={'credentials':{'private_key':_0x4074b3,'client_email':_0x2046eb}};var _0x38450e=new dialogflow[(_0x5dcb('0x65'))](_0x33570a);var _0xdb8978=_0x38450e[_0x5dcb('0x66')](_0x1c1317,md5(_0xe5f9aa));var _0xe4daca={'session':_0xdb8978,'queryInput':{'text':{'text':_0x335f55,'languageCode':_0xd3205f}}};return _0x38450e['detectIntent'](_0xe4daca)[_0x5dcb('0x29')](function(_0x5e1fe0){if(_0x5e1fe0&&_0x5e1fe0['length']){logger[_0x5dcb('0x24')](_0x5dcb('0x67'),JSON[_0x5dcb('0x40')](_0x5e1fe0));var _0x45156c=_0x5e1fe0[0x0];if(_0x45156c){var _0x363590={'action':_0x45156c[_0x5dcb('0x68')][_0x5dcb('0x5a')],'allRequiredParamsPresent':_0x45156c[_0x5dcb('0x68')][_0x5dcb('0x69')],'endConversation':_0x45156c['queryResult'][_0x5dcb('0x6a')]&&_0x45156c[_0x5dcb('0x68')]['diagnosticInfo'][_0x5dcb('0x6b')]?_0x45156c[_0x5dcb('0x68')][_0x5dcb('0x6a')][_0x5dcb('0x6b')][_0x5dcb('0x6c')]['boolValue']:![],'fulfillmentText':_0x45156c[_0x5dcb('0x68')][_0x5dcb('0x6d')],'intentName':_0x45156c['queryResult'][_0x5dcb('0x6e')][_0x5dcb('0x54')],'intentDisplayName':_0x45156c[_0x5dcb('0x68')]['intent'][_0x5dcb('0x6f')],'isFallbackIntent':_0x45156c[_0x5dcb('0x68')]['intent']['isFallback'],'languageCode':_0x45156c[_0x5dcb('0x68')]['languageCode'],'queryText':_0x45156c[_0x5dcb('0x68')][_0x5dcb('0x70')],'responseId':_0x45156c[_0x5dcb('0x71')],'score':_0x45156c[_0x5dcb('0x68')]['intentDetectionConfidence'],'speech':_0x45156c[_0x5dcb('0x68')][_0x5dcb('0x6d')],'providerResponse':JSON[_0x5dcb('0x40')](_0x5e1fe0)};return _0x363590;}}});};exports[_0x5dcb('0x72')]=function(_0x141b4a,_0x4a93da,_0x2b11db,_0x1c87c5){return tilde['asr'](_0x141b4a,_0x4a93da,_0x2b11db,_0x1c87c5)[_0x5dcb('0x29')](function(_0xc25b47){try{fs[_0x5dcb('0x1d')](_0x141b4a);}catch(_0x27b9c0){logger[_0x5dcb('0x16')](_0x27b9c0);}logger[_0x5dcb('0x24')](_0x5dcb('0x73'),_0xc25b47['transcript']);logger[_0x5dcb('0x24')](_0x5dcb('0x74'),_0xc25b47['confidence']);return _0xc25b47;});};exports[_0x5dcb('0x75')]=function(_0x593d6a,_0xba126a,_0x6cc83a,_0x523241,_0x438921,_0x3a1d19){var _0x2c3a89=path[_0x5dcb('0x36')](__dirname,_0x5dcb('0x37'),rs['generate'](0x4)+_0x5dcb('0x38'));var _0x42c330;return aws[_0x5dcb('0x76')](_0x593d6a,_0xba126a,_0x6cc83a,_0x523241,_0x438921,_0x3a1d19,_0x2c3a89)[_0x5dcb('0x29')](function(){_0x42c330=path[_0x5dcb('0x36')](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+_0x5dcb('0x3b'));return convertFile(_0x2c3a89,_0x42c330);})['then'](function(){try{fs[_0x5dcb('0x1d')](_0x2c3a89);fs['chmodSync'](_0x42c330,_0x5dcb('0x2b'));}catch(_0x513c25){logger['error'](_0x513c25);}return _0x42c330[_0x5dcb('0x3d')]('.')[0x0];});};exports[_0x5dcb('0x77')]=function(_0x3b2059,_0x510b80,_0x225867,_0xfe2c92,_0x3f7251,_0x363737){return aws[_0x5dcb('0x78')](_0x3b2059,_0x510b80,_0x225867,_0xfe2c92,_0x3f7251,_0x363737)[_0x5dcb('0x29')](function(_0x14342a){logger[_0x5dcb('0x24')](JSON['stringify'](_0x14342a));return _0x14342a;});};exports['ispeechTTS']=function(_0x548bea,_0x2effdc,_0x41597c,_0x11dca3){var _0x3909ac=util[_0x5dcb('0x79')](_0x5dcb('0x7a'),ISPEECH_API,_0x548bea,encodeURIComponent(_0x2effdc),_0x41597c,_0x11dca3);var _0xe90d3b=path[_0x5dcb('0x36')](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+_0x5dcb('0x38'));var _0x3dab4c;return downloadFile(_0x3909ac,_0xe90d3b)['then'](function(){_0x3dab4c=path[_0x5dcb('0x36')](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+_0x5dcb('0x3b'));return convertFile(_0xe90d3b,_0x3dab4c);})['then'](function(){try{fs[_0x5dcb('0x1d')](_0xe90d3b);fs[_0x5dcb('0x2a')](_0x3dab4c,_0x5dcb('0x2b'));}catch(_0x838f1d){logger[_0x5dcb('0x16')](_0x838f1d);}return _0x3dab4c['split']('.')[0x0];});};exports[_0x5dcb('0x7b')]=function(_0x37d442,_0x4b0087,_0x3141f1,_0x2e132c){var _0x33ae42=util[_0x5dcb('0x79')](_0x5dcb('0x7c'),ISPEECH_API,_0x4b0087,_0x3141f1,base64Encode(_0x37d442),_0x2e132c?util['format'](_0x5dcb('0x7d'),encodeURIComponent(_0x2e132c)):_0x5dcb('0x7e'));return uploadFile(_0x33ae42)[_0x5dcb('0x29')](function(_0x33706d){return querystring['parse'](_0x33706d);});};exports[_0x5dcb('0x7f')]=function(_0x2ca853,_0x5e72bd){return sestek[_0x5dcb('0x80')](_0x2ca853,_0x5e72bd)[_0x5dcb('0x29')](function(_0x5594b8){logger['info'](JSON['stringify'](_0x5594b8));var _0x42fd6f={'speech':_0x5594b8['text'],'action':_0x5594b8[_0x5dcb('0x81')]?_0x5594b8[_0x5dcb('0x81')][_0x5dcb('0x82')]:undefined,'actiondata':_0x5594b8[_0x5dcb('0x81')]?_0x5594b8[_0x5dcb('0x81')]['CustomActionData']:undefined};if(_0x5594b8[_0x5dcb('0x81')]&&_0x5594b8[_0x5dcb('0x81')]['AudioFromTts']){return base64Decode(_0x5594b8[_0x5dcb('0x81')]['AudioFromTts'][_0x5dcb('0x83')],path['resolve'](__dirname,_0x5dcb('0x37'),rs[_0x5dcb('0x26')](0x4)+'.wav'))[_0x5dcb('0x29')](function(_0x23c9e4){_0x42fd6f[_0x5dcb('0x84')]=_0x23c9e4;return _0x42fd6f;});}return _0x42fd6f;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0x5615=['[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','endConversation','isFallbackIntent','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','languageCode','queryText','responseId','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','nda','channelData','CustomAction','AudioFromTts','Data','dirName','apiai-promise','dialogflow','http','md5','path','querystring','randomstring','sox','google-tts-api','parse','util','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','WHAT_EVER','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','request\x20to\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','https:','data','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','split','readFileSync','toString','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','777','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','confidence','catch'];(function(_0x204eb7,_0x4974c3){var _0x37e444=function(_0x390613){while(--_0x390613){_0x204eb7['push'](_0x204eb7['shift']());}};_0x37e444(++_0x4974c3);}(_0x5615,0x1be));var _0x5561=function(_0x29f01f,_0x3b3803){_0x29f01f=_0x29f01f-0x0;var _0x3c81e1=_0x5615[_0x29f01f];return _0x3c81e1;};'use strict';var apiai=require(_0x5561('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x5561('0x1'));var fs=require('fs');var http=require(_0x5561('0x2'));var https=require('https');var md5=require(_0x5561('0x3'));var path=require(_0x5561('0x4'));var querystring=require(_0x5561('0x5'));var rp=require('request-promise');var rs=require(_0x5561('0x6'));var sox=require(_0x5561('0x7'));var tts=require(_0x5561('0x8'));var urlParse=require('url')[_0x5561('0x9')];var util=require(_0x5561('0xa'));var aws=require('./aws');var google=require(_0x5561('0xb'));var sestek=require(_0x5561('0xc'));var tilde=require('./tilde');var logger=require(_0x5561('0xd'))(_0x5561('0xe'));var ISPEECH_API=_0x5561('0xf');function downloadFile(_0x37f14b,_0x4a9b5f){return new BPromise(function(_0x2b274f,_0x8af18a){var _0x238612=urlParse(_0x37f14b);var _0x3c60d9=_0x238612[_0x5561('0x10')]==='https:'?https:http;var _0x2afbf6={'host':_0x238612[_0x5561('0x11')],'path':_0x238612['path'],'headers':{'user-agent':_0x5561('0x12')}};_0x3c60d9[_0x5561('0x13')](_0x2afbf6,function(_0x5f082e){if(_0x5f082e['statusCode']!==0xc8){logger[_0x5561('0x14')]('request\x20to\x20'+_0x37f14b+_0x5561('0x15')+_0x5f082e[_0x5561('0x16')]+'\x20('+_0x5f082e[_0x5561('0x17')]+')');_0x8af18a(new Error(_0x5561('0x18')+_0x37f14b+_0x5561('0x15')+_0x5f082e['statusCode']+'\x20('+_0x5f082e[_0x5561('0x17')]+')'));return;}var _0x190da3=fs[_0x5561('0x19')](_0x4a9b5f);_0x190da3['on'](_0x5561('0x1a'),function(){logger[_0x5561('0x1b')](_0x5561('0x1c'));_0x190da3['close'](_0x2b274f);});_0x190da3['on'](_0x5561('0x14'),function(_0x5350b7){fs[_0x5561('0x1d')](_0x4a9b5f);logger[_0x5561('0x14')](_0x5561('0x1e'),_0x5350b7);_0x8af18a(_0x5350b7);});_0x5f082e[_0x5561('0x1f')](_0x190da3);})['on']('error',function(_0x11c729){logger['error'](_0x11c729);_0x8af18a(_0x11c729);})[_0x5561('0x20')]();});}function uploadFile(_0x3f2c2b){return new BPromise(function(_0x146422,_0x6e1fad){var _0x1b07a1=urlParse(_0x3f2c2b);var _0x589303=_0x1b07a1[_0x5561('0x10')]===_0x5561('0x21')?https:http;var _0x1a0486={'host':_0x1b07a1['host'],'path':_0x1b07a1[_0x5561('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x589303[_0x5561('0x13')](_0x1a0486,function(_0x43ad57){if(_0x43ad57['statusCode']!==0xc8){_0x6e1fad(new Error(_0x5561('0x18')+_0x3f2c2b+'\x20failed,\x20status\x20code\x20=\x20'+_0x43ad57['statusCode']+'\x20('+_0x43ad57[_0x5561('0x17')]+')'));return;}var _0x3ac2bb='';_0x43ad57['on'](_0x5561('0x22'),function(_0x192d8f){_0x3ac2bb+=_0x192d8f;});_0x43ad57['on'](_0x5561('0x20'),function(){_0x146422(_0x3ac2bb);});})['on'](_0x5561('0x14'),function(_0x3e84dd){_0x6e1fad(_0x3e84dd);})[_0x5561('0x20')]();});}function convertFile(_0x41bcfb,_0xe7f251){return new BPromise(function(_0x565955,_0x387625){var _0x53e595=sox['transcode'](_0x41bcfb,_0xe7f251,{'sampleRate':0x1f40,'format':_0x5561('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x53e595['on'](_0x5561('0x14'),function(_0x20d712){logger[_0x5561('0x14')](_0x5561('0x24'),_0x20d712);_0x387625(_0x20d712);});_0x53e595['on'](_0x5561('0x20'),function(){logger[_0x5561('0x1b')](_0x5561('0x25'));_0x565955();});_0x53e595[_0x5561('0x26')]();});}function base64Decode(_0x2f7495,_0xfcb29d){var _0x55d641=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs[_0x5561('0x29')](0x4)+_0x5561('0x2a'));fs[_0x5561('0x2b')](_0x55d641,_0x2f7495,_0x5561('0x2c'));return convertFile(_0x55d641,_0xfcb29d)[_0x5561('0x2d')](function(){try{fs[_0x5561('0x1d')](_0x55d641);fs[_0x5561('0x2e')](_0xfcb29d,'777');}catch(_0x5dbdda){logger[_0x5561('0x14')](_0x5dbdda);}return _0xfcb29d[_0x5561('0x2f')]('.')[0x0];});}function base64Encode(_0x281307){var _0x2ec590=fs[_0x5561('0x30')](_0x281307);return new Buffer(_0x2ec590)[_0x5561('0x31')](_0x5561('0x2c'));}exports['googleCloudTTS']=function(_0x31155d,_0x2107ea,_0x5550ed,_0x2e1f2f,_0x27fc19,_0x30582f){var _0x2115a8,_0x5eb414;var _0x21e0d5='https://texttospeech.googleapis.com/v1/';var _0x1a801a=_0x5561('0x32')+_0x31155d;var _0x26f416={};if(_0x2107ea==='ssml'){_0x26f416[_0x5561('0x33')]={'ssml':_0x5550ed};}else{_0x26f416[_0x5561('0x33')]={'text':_0x5550ed};};_0x26f416[_0x5561('0x34')]={'languageCode':_0x2e1f2f,'ssmlGender':_0x27fc19};_0x26f416[_0x5561('0x35')]={'audioEncoding':_0x5561('0x36'),'sampleRateHertz':0x1f40};var _0x2cd9c7={'url':_0x21e0d5+_0x5561('0x37')+_0x1a801a,'method':_0x5561('0x38'),'json':!![],'body':_0x26f416};return rp(_0x2cd9c7)[_0x5561('0x2d')](function(_0x46f9dc){return new BPromise(function(_0x2dcc5d,_0x543639){_0x2115a8=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs['generate'](0x4)+_0x5561('0x39'));var _0x5e59ea=Buffer[_0x5561('0x3a')](_0x46f9dc['audioContent'],'base64');return fs['writeFile'](_0x2115a8,_0x5e59ea,function(_0x5f0861){_0x543639(_0x5f0861);},function(_0x4df999){fs[_0x5561('0x2e')](_0x2115a8,_0x5561('0x3b'));_0x2dcc5d(_0x4df999);});});})[_0x5561('0x2d')](function(_0x2f148e){_0x5eb414=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs['generate'](0x4)+_0x5561('0x2a'));return convertFile(_0x2115a8,_0x5eb414);})[_0x5561('0x2d')](function(){try{fs[_0x5561('0x1d')](_0x2115a8);fs[_0x5561('0x2e')](_0x5eb414,_0x5561('0x3b'));}catch(_0xe93f9e){logger[_0x5561('0x14')](_0xe93f9e);}logger['info'](_0x5561('0x3c'),_0x5eb414[_0x5561('0x2f')]('.')[0x0]);return _0x5eb414[_0x5561('0x2f')]('.')[0x0];});};exports[_0x5561('0x3d')]=function(_0x23d594,_0x25accc){var _0x10e98e=_0x5561('0x3e');var _0x1a25f2,_0x4f6878;var _0x1dade6;var _0x104854={'encoding':_0x5561('0x3f'),'method':_0x5561('0x38'),'timeout':0x2710,'url':_0x10e98e,'headers':{'Content-Type':_0x5561('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0x5561('0x41')]([[[_0x5561('0x42'),JSON[_0x5561('0x41')]([_0x23d594,_0x25accc||'en',![],_0x5561('0x43')]),null,_0x5561('0x44')]]]))};return rp(_0x104854)[_0x5561('0x2d')](function(_0x44a56a){try{_0x1dade6=eval(_0x44a56a['slice'](0x5))[0x0][0x2];}catch(_0x3b43cd){throw new Error(_0x5561('0x45')+_0x44a56a['data']);}if(!_0x1dade6){if(_0x23d594['length']>0xc8){throw new Error(_0x5561('0x46'));}else{throw new Error(_0x5561('0x47')+_0x25accc+_0x5561('0x48'));}}try{_0x1dade6=eval(_0x1dade6)[0x0];}catch(_0x218989){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x541349=_0x1dade6;_0x1a25f2=path['resolve'](__dirname,_0x5561('0x28'),rs['generate'](0x4)+_0x5561('0x39'));fs[_0x5561('0x2b')](_0x1a25f2,_0x1dade6,{'encoding':'base64'});_0x4f6878=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs[_0x5561('0x29')](0x4)+_0x5561('0x2a'));return convertFile(_0x1a25f2,_0x4f6878);})[_0x5561('0x2d')](function(){try{fs[_0x5561('0x1d')](_0x1a25f2);fs[_0x5561('0x2e')](_0x4f6878,_0x5561('0x3b'));}catch(_0xf8d814){logger['error'](_0xf8d814);}logger[_0x5561('0x1b')](_0x5561('0x49'),_0x4f6878[_0x5561('0x2f')]('.')[0x0]);return _0x4f6878[_0x5561('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x4c6f18,_0x5de8a6,_0x2db067){return google[_0x5561('0x4a')](_0x4c6f18,_0x5de8a6,_0x2db067)['then'](function(_0xaed04c){logger[_0x5561('0x1b')](_0xaed04c[_0x5561('0x4b')]);return rp(_0xaed04c);})[_0x5561('0x2d')](function(_0x13890e){var _0x5c2b2b='';var _0x589626=0x0;try{fs[_0x5561('0x1d')](_0x4c6f18);}catch(_0x5339be){logger[_0x5561('0x14')](_0x5339be);}if(_0x13890e&&_0x13890e[_0x5561('0x4c')]){_0x5c2b2b=_0x13890e['results']['map'](function(_0x23dafe){return _0x23dafe&&_0x23dafe[_0x5561('0x4d')][0x0]&&_0x23dafe['alternatives'][0x0][_0x5561('0x4e')]?_0x23dafe[_0x5561('0x4d')][0x0][_0x5561('0x4e')]:'';})[_0x5561('0x4f')]('\x0a');_0x589626=_0x13890e['results']['map'](function(_0x506238){return _0x506238&&_0x506238[_0x5561('0x4d')][0x0]&&_0x506238[_0x5561('0x4d')][0x0]['confidence']?_0x506238[_0x5561('0x4d')][0x0][_0x5561('0x50')]:0x0;})[_0x5561('0x4f')]('\x0a');}logger[_0x5561('0x1b')]('googleASR\x20transcription',_0x5c2b2b);logger[_0x5561('0x1b')]('googleASR\x20confidence',_0x589626);return{'transcript':_0x5c2b2b,'confidence':_0x589626};})[_0x5561('0x51')](function(_0x21a566){logger[_0x5561('0x14')](_0x5561('0x52'),_0x21a566[_0x5561('0x16')],_0x21a566[_0x5561('0x53')],_0x21a566[_0x5561('0x54')]);});};exports[_0x5561('0x55')]=function(_0x380418,_0xbcfdd0,_0x588c68,_0xda5bc7){var _0x491c20=apiai(_0xbcfdd0,{'language':_0xda5bc7||'en'});return _0x491c20[_0x5561('0x56')](_0x588c68,{'sessionId':md5(_0x380418)})[_0x5561('0x2d')](function(_0x326ef7){logger['info'](JSON[_0x5561('0x41')](_0x326ef7));return{'source':_0x326ef7['result']['source'],'resolvedQuery':_0x326ef7[_0x5561('0x57')][_0x5561('0x58')],'action':_0x326ef7[_0x5561('0x57')][_0x5561('0x59')],'actionIncomplete':_0x326ef7[_0x5561('0x57')][_0x5561('0x5a')],'speech':_0x326ef7[_0x5561('0x57')][_0x5561('0x5b')][_0x5561('0x5c')],'score':_0x326ef7[_0x5561('0x57')][_0x5561('0x5d')],'statusCode':_0x326ef7[_0x5561('0x5e')][_0x5561('0x5f')],'endConversation':_0x326ef7['result'][_0x5561('0x60')][_0x5561('0x61')]||![],'isFallbackIntent':_0x326ef7[_0x5561('0x57')]['metadata'][_0x5561('0x62')]};});};exports['googleDialogflowV2']=function(_0x52a2af,_0x3a48fd,_0x14647b,_0x4ce052,_0x2ab75e,_0x5ec509){var _0x1c167e=_0x4ce052[_0x5561('0x63')](/\\n/g,'\x0a');var _0x23b5e1={'credentials':{'private_key':_0x1c167e,'client_email':_0x14647b}};var _0x32afba=new dialogflow[(_0x5561('0x64'))](_0x23b5e1);var _0x5066ed=_0x32afba[_0x5561('0x65')](_0x3a48fd,md5(_0x52a2af));var _0x1bf08e={'session':_0x5066ed,'queryInput':{'text':{'text':_0x2ab75e,'languageCode':_0x5ec509}}};return _0x32afba[_0x5561('0x66')](_0x1bf08e)[_0x5561('0x2d')](function(_0x2840ea){if(_0x2840ea&&_0x2840ea[_0x5561('0x67')]){logger[_0x5561('0x1b')](_0x5561('0x68'),JSON['stringify'](_0x2840ea));var _0x6fa5fd=_0x2840ea[0x0];if(_0x6fa5fd){var _0x2ee721={'action':_0x6fa5fd[_0x5561('0x69')][_0x5561('0x59')],'allRequiredParamsPresent':_0x6fa5fd['queryResult'][_0x5561('0x6a')],'endConversation':_0x6fa5fd[_0x5561('0x69')][_0x5561('0x6b')]&&_0x6fa5fd[_0x5561('0x69')][_0x5561('0x6b')][_0x5561('0x6c')]?_0x6fa5fd[_0x5561('0x69')][_0x5561('0x6b')][_0x5561('0x6c')][_0x5561('0x6d')][_0x5561('0x6e')]:![],'fulfillmentText':_0x6fa5fd[_0x5561('0x69')]['fulfillmentText'],'intentName':_0x6fa5fd[_0x5561('0x69')][_0x5561('0x6f')][_0x5561('0x53')],'intentDisplayName':_0x6fa5fd[_0x5561('0x69')][_0x5561('0x6f')]['displayName'],'isFallbackIntent':_0x6fa5fd['queryResult'][_0x5561('0x6f')]['isFallback'],'languageCode':_0x6fa5fd['queryResult'][_0x5561('0x70')],'queryText':_0x6fa5fd['queryResult'][_0x5561('0x71')],'responseId':_0x6fa5fd[_0x5561('0x72')],'score':_0x6fa5fd[_0x5561('0x69')]['intentDetectionConfidence'],'speech':_0x6fa5fd['queryResult'][_0x5561('0x73')],'providerResponse':JSON[_0x5561('0x41')](_0x2840ea)};return _0x2ee721;}}});};exports[_0x5561('0x74')]=function(_0x3d04c4,_0x287e42,_0x2783e9,_0x1827e0){return tilde[_0x5561('0x4a')](_0x3d04c4,_0x287e42,_0x2783e9,_0x1827e0)[_0x5561('0x2d')](function(_0x308d94){try{fs[_0x5561('0x1d')](_0x3d04c4);}catch(_0xa71f2e){logger[_0x5561('0x14')](_0xa71f2e);}logger[_0x5561('0x1b')](_0x5561('0x75'),_0x308d94[_0x5561('0x4e')]);logger[_0x5561('0x1b')]('Tilde\x20ASR\x20confidence',_0x308d94[_0x5561('0x50')]);return _0x308d94;});};exports[_0x5561('0x76')]=function(_0x451f04,_0x466e2a,_0x1f33a1,_0x42c784,_0x4b98da,_0x15552b){var _0x2f7505=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs[_0x5561('0x29')](0x4)+_0x5561('0x39'));var _0x22f4fb;return aws[_0x5561('0x77')](_0x451f04,_0x466e2a,_0x1f33a1,_0x42c784,_0x4b98da,_0x15552b,_0x2f7505)[_0x5561('0x2d')](function(){_0x22f4fb=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs['generate'](0x4)+_0x5561('0x2a'));return convertFile(_0x2f7505,_0x22f4fb);})[_0x5561('0x2d')](function(){try{fs[_0x5561('0x1d')](_0x2f7505);fs[_0x5561('0x2e')](_0x22f4fb,_0x5561('0x3b'));}catch(_0x55d625){logger['error'](_0x55d625);}return _0x22f4fb[_0x5561('0x2f')]('.')[0x0];});};exports[_0x5561('0x78')]=function(_0x5125a9,_0x5ab40f,_0x410665,_0x587542,_0x28f63b,_0x1d6cf5){return aws['lex'](_0x5125a9,_0x5ab40f,_0x410665,_0x587542,_0x28f63b,_0x1d6cf5)[_0x5561('0x2d')](function(_0x55bbc8){logger[_0x5561('0x1b')](JSON[_0x5561('0x41')](_0x55bbc8));return _0x55bbc8;});};exports['ispeechTTS']=function(_0x33e1c6,_0x56a712,_0x559476,_0x2933a2){var _0x43deb4=util[_0x5561('0x79')](_0x5561('0x7a'),ISPEECH_API,_0x33e1c6,encodeURIComponent(_0x56a712),_0x559476,_0x2933a2);var _0x512ef5=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs['generate'](0x4)+_0x5561('0x39'));var _0x1052b6;return downloadFile(_0x43deb4,_0x512ef5)['then'](function(){_0x1052b6=path[_0x5561('0x27')](__dirname,_0x5561('0x28'),rs[_0x5561('0x29')](0x4)+_0x5561('0x2a'));return convertFile(_0x512ef5,_0x1052b6);})[_0x5561('0x2d')](function(){try{fs['unlink'](_0x512ef5);fs[_0x5561('0x2e')](_0x1052b6,_0x5561('0x3b'));}catch(_0x28aa10){logger['error'](_0x28aa10);}return _0x1052b6[_0x5561('0x2f')]('.')[0x0];});};exports[_0x5561('0x7b')]=function(_0x553738,_0x37fb75,_0x445fcd,_0xaf48e8){var _0x47c814=util[_0x5561('0x79')](_0x5561('0x7c'),ISPEECH_API,_0x37fb75,_0x445fcd,base64Encode(_0x553738),_0xaf48e8?util[_0x5561('0x79')]('model=%s',encodeURIComponent(_0xaf48e8)):'freeform=3');return uploadFile(_0x47c814)['then'](function(_0x2f7d76){return querystring['parse'](_0x2f7d76);});};exports[_0x5561('0x7d')]=function(_0x343609,_0x430050){return sestek[_0x5561('0x7e')](_0x343609,_0x430050)['then'](function(_0x393366){logger[_0x5561('0x1b')](JSON[_0x5561('0x41')](_0x393366));var _0xf318b4={'speech':_0x393366['text'],'action':_0x393366[_0x5561('0x7f')]?_0x393366[_0x5561('0x7f')][_0x5561('0x80')]:undefined,'actiondata':_0x393366[_0x5561('0x7f')]?_0x393366['channelData']['CustomActionData']:undefined};if(_0x393366[_0x5561('0x7f')]&&_0x393366[_0x5561('0x7f')][_0x5561('0x81')]){return base64Decode(_0x393366[_0x5561('0x7f')][_0x5561('0x81')][_0x5561('0x82')],path[_0x5561('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0x5561('0x2a')))['then'](function(_0x39e331){_0xf318b4['audiofile']=_0x39e331;return _0xf318b4;});}return _0xf318b4;});};exports[_0x5561('0x83')]=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 df474ea..309096b 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 _0x0c24=['./nda'];(function(_0x754ab4,_0x56daa7){var _0x34079a=function(_0x295ec1){while(--_0x295ec1){_0x754ab4['push'](_0x754ab4['shift']());}};_0x34079a(++_0x56daa7);}(_0x0c24,0x1a2));var _0x40c2=function(_0x4cee82,_0x208e67){_0x4cee82=_0x4cee82-0x0;var _0x200c1d=_0x0c24[_0x4cee82];return _0x200c1d;};var nda=require(_0x40c2('0x0'));module['exports']={'nda':nda}; \ No newline at end of file +var _0x009d=['./nda','exports'];(function(_0x34d3a7,_0x2fcfe2){var _0x1d93e2=function(_0x27c55f){while(--_0x27c55f){_0x34d3a7['push'](_0x34d3a7['shift']());}};_0x1d93e2(++_0x2fcfe2);}(_0x009d,0xe0));var _0xd009=function(_0x411c60,_0x5274ed){_0x411c60=_0x411c60-0x0;var _0x53531c=_0x009d[_0x411c60];return _0x53531c;};var nda=require(_0xd009('0x0'));module[_0xd009('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 76f1aef..350b816 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 _0x630e=['Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','CustomAction','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','resolve','ndauth_url','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','uniqueid','callerid','calleridname','dnid','text'];(function(_0x364a36,_0x1e2677){var _0x5cd6fa=function(_0x58d692){while(--_0x58d692){_0x364a36['push'](_0x364a36['shift']());}};_0x5cd6fa(++_0x1e2677);}(_0x630e,0x1af));var _0xe630=function(_0x1f48b0,_0x1ed1f2){_0x1f48b0=_0x1f48b0-0x0;var _0x4bf08a=_0x630e[_0x1f48b0];return _0x4bf08a;};'use strict';var rp=require(_0xe630('0x0'));var url=require('url');var logger=require(_0xe630('0x1'))('agi');module['exports']=function(_0x36902e,_0x143cb6){var _0x12449c={'method':'POST','uri':url[_0xe630('0x2')](_0x143cb6[_0xe630('0x3')],_0xe630('0x4')),'form':{'grant_type':_0xe630('0x5'),'username':_0x143cb6[_0xe630('0x6')],'password':_0x143cb6['password']},'json':!![]};return rp(_0x12449c)[_0xe630('0x7')](function(_0x34bad4){var _0x5a73ad={'method':_0xe630('0x8'),'uri':url['resolve'](_0x143cb6[_0xe630('0x9')],_0xe630('0xa')),'body':{'type':_0x143cb6[_0xe630('0xb')]||'message','channelId':'Nda','conversation':{'id':_0x36902e[_0xe630('0xc')]},'from':{'id':_0x36902e[_0xe630('0xd')],'name':_0x36902e[_0xe630('0xe')]},'recipient':{'id':_0x36902e[_0xe630('0xf')],'name':_0x36902e['extension']},'text':_0x143cb6[_0xe630('0x10')],'channelData':{}},'headers':{'Authorization':_0xe630('0x11')+_0x34bad4[_0xe630('0x12')]},'json':!![]};if(_0x143cb6[_0xe630('0x13')]){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x16')]=_0x143cb6[_0xe630('0x13')];}if(_0x143cb6[_0xe630('0x17')]=='1'){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xe630('0x19')};}if(_0x143cb6['custom_action']){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x1a')]=_0x143cb6[_0xe630('0x1b')];if(_0x143cb6[_0xe630('0x1c')]){_0x5a73ad[_0xe630('0x14')][_0xe630('0x15')][_0xe630('0x1d')]=_0x143cb6[_0xe630('0x1c')];}}logger[_0xe630('0x1e')](JSON[_0xe630('0x1f')](_0x5a73ad));return rp(_0x5a73ad);});}; \ No newline at end of file +var _0x1cf3=['extension','text','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','info','request-promise','url','../../../../../config/logger','agi','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','ndaactivity_type','message','Nda','callerid','calleridname','dnid'];(function(_0x1bbea5,_0x33f791){var _0x130204=function(_0xa98419){while(--_0xa98419){_0x1bbea5['push'](_0x1bbea5['shift']());}};_0x130204(++_0x33f791);}(_0x1cf3,0x1be));var _0x31cf=function(_0x49bee2,_0xf5aae9){_0x49bee2=_0x49bee2-0x0;var _0x59ec35=_0x1cf3[_0x49bee2];return _0x59ec35;};'use strict';var rp=require(_0x31cf('0x0'));var url=require(_0x31cf('0x1'));var logger=require(_0x31cf('0x2'))(_0x31cf('0x3'));module['exports']=function(_0x20aa57,_0x5a2ae7){var _0x160147={'method':_0x31cf('0x4'),'uri':url[_0x31cf('0x5')](_0x5a2ae7[_0x31cf('0x6')],_0x31cf('0x7')),'form':{'grant_type':_0x31cf('0x8'),'username':_0x5a2ae7[_0x31cf('0x9')],'password':_0x5a2ae7[_0x31cf('0x8')]},'json':!![]};return rp(_0x160147)[_0x31cf('0xa')](function(_0x6be80){var _0x3f7b2e={'method':_0x31cf('0x4'),'uri':url[_0x31cf('0x5')](_0x5a2ae7[_0x31cf('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x5a2ae7[_0x31cf('0xc')]||_0x31cf('0xd'),'channelId':_0x31cf('0xe'),'conversation':{'id':_0x20aa57['uniqueid']},'from':{'id':_0x20aa57[_0x31cf('0xf')],'name':_0x20aa57[_0x31cf('0x10')]},'recipient':{'id':_0x20aa57[_0x31cf('0x11')],'name':_0x20aa57[_0x31cf('0x12')]},'text':_0x5a2ae7[_0x31cf('0x13')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x6be80['access_token']},'json':!![]};if(_0x5a2ae7[_0x31cf('0x14')]){_0x3f7b2e[_0x31cf('0x15')][_0x31cf('0x16')][_0x31cf('0x17')]=_0x5a2ae7['project'];}if(_0x5a2ae7[_0x31cf('0x18')]=='1'){_0x3f7b2e[_0x31cf('0x15')][_0x31cf('0x16')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x31cf('0x19')};}if(_0x5a2ae7[_0x31cf('0x1a')]){_0x3f7b2e[_0x31cf('0x15')][_0x31cf('0x16')]['CustomAction']=_0x5a2ae7['custom_action'];if(_0x5a2ae7[_0x31cf('0x1b')]){_0x3f7b2e[_0x31cf('0x15')][_0x31cf('0x16')]['CustomActionData']=_0x5a2ae7[_0x31cf('0x1b')];}}logger[_0x31cf('0x1c')](JSON['stringify'](_0x3f7b2e));return rp(_0x3f7b2e);});}; \ 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 fa129c8..8419e15 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 _0xd476=['exports','./lib/api'];(function(_0x35c9dd,_0x3ecd16){var _0x2d3259=function(_0x5e6a85){while(--_0x5e6a85){_0x35c9dd['push'](_0x35c9dd['shift']());}};_0x2d3259(++_0x3ecd16);}(_0xd476,0x181));var _0x6d47=function(_0x191f98,_0x17361b){_0x191f98=_0x191f98-0x0;var _0x980d3c=_0xd476[_0x191f98];return _0x980d3c;};'use strict';var asr=require(_0x6d47('0x0'));module[_0x6d47('0x1')]=function(_0x3f15c6,_0x4ef336,_0x52a999,_0x362c8a){return asr(_0x3f15c6,_0x4ef336,_0x52a999,_0x362c8a);}; \ No newline at end of file +var _0x3620=['./lib/api','exports'];(function(_0x493c8c,_0x470567){var _0x17344b=function(_0x47aee7){while(--_0x47aee7){_0x493c8c['push'](_0x493c8c['shift']());}};_0x17344b(++_0x470567);}(_0x3620,0x1c8));var _0x0362=function(_0x449ff7,_0x200ef9){_0x449ff7=_0x449ff7-0x0;var _0x407b28=_0x3620[_0x449ff7];return _0x407b28;};'use strict';var asr=require(_0x0362('0x0'));module[_0x0362('0x1')]=function(_0x356f80,_0x18ce17,_0x28f25d,_0x5c34de){return asr(_0x356f80,_0x18ce17,_0x28f25d,_0x5c34de);}; \ 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 5641b02..516d4a8 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 _0xaedc=['crypto','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','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','Error\x20Tilde\x20ASR\x20socket','isObject','lodash','moment'];(function(_0x3c498f,_0x1a9eef){var _0x2104b8=function(_0x2d8b1a){while(--_0x2d8b1a){_0x3c498f['push'](_0x3c498f['shift']());}};_0x2104b8(++_0x1a9eef);}(_0xaedc,0x166));var _0xcaed=function(_0x38b84f,_0x26fd1a){_0x38b84f=_0x38b84f-0x0;var _0x2bc63b=_0xaedc[_0x38b84f];return _0x2bc63b;};'use strict';var BPromise=require('bluebird');var _=require(_0xcaed('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xcaed('0x1'));var crypto=require(_0xcaed('0x2'));var logger=require('../../../../../../config/logger')(_0xcaed('0x3'));module[_0xcaed('0x4')]=function(_0x2dcda7,_0x1ee94b,_0x281fd9,_0x415f94){return new BPromise(function(_0x38835d,_0x373443){logger[_0xcaed('0x5')](_0xcaed('0x6'),_0x415f94||_0xcaed('0x7'));var _0x3d5d8b=new WebSocket(_0x415f94||_0xcaed('0x7'),{'perMessageDeflate':![]});var _0x18d0da='';var _0x1ef420='0';var _0x293074='1';var _0x2d1718=_0xcaed('0x8');function _0x4e6118(_0x281da0){var _0x58ae3c=crypto[_0xcaed('0x9')](_0xcaed('0xa'));_0x58ae3c[_0xcaed('0xb')](_0x281da0);return _0x58ae3c[_0xcaed('0xc')](_0xcaed('0xd'));}function _0x5aa5cb(){try{logger[_0xcaed('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x48a2cc=moment()[_0xcaed('0xe')]();var _0x2bcde5=_0x4e6118(_0x48a2cc+_0x1ee94b+_0x281fd9);_0x3d5d8b[_0xcaed('0xf')](JSON[_0xcaed('0x10')]({'appID':_0x1ee94b,'timestamp':_0x48a2cc,'appKey':_0x2bcde5}));var _0x5a1a7d=fs[_0xcaed('0x11')](_0x2dcda7);_0x5a1a7d['on'](_0xcaed('0x12'),function(_0x557615){_0x3d5d8b[_0xcaed('0xf')](_0x557615);});_0x5a1a7d['on'](_0xcaed('0x13'),function(){_0x3d5d8b[_0xcaed('0xf')](_0xcaed('0x14'));});}catch(_0x4a9579){logger[_0xcaed('0x15')](_0xcaed('0x16'),JSON[_0xcaed('0x10')](_0x4a9579));_0x3d5d8b[_0xcaed('0x17')]();}}function _0x12c1d1(_0x7cd156){try{if(_0x7cd156){var _0x58bf12=JSON['parse'](_0x7cd156);switch(_0x58bf12[_0xcaed('0x18')]){case 0x0:if(_0x58bf12[_0xcaed('0x19')]){if(_0x58bf12[_0xcaed('0x19')][_0xcaed('0x1a')]){logger[_0xcaed('0x5')](_0xcaed('0x1b'),JSON[_0xcaed('0x10')](_0x58bf12[_0xcaed('0x19')]['hypotheses']));_0x18d0da=_0x58bf12[_0xcaed('0x19')]['hypotheses'][0x0]['transcript'];_0x1ef420=_0x58bf12[_0xcaed('0x19')]['hypotheses'][0x0]['likelihood'];_0x293074='0';_0x2d1718=_0xcaed('0x1c');_0x3d5d8b[_0xcaed('0x17')]();}}break;case 0x1:logger[_0xcaed('0x5')](_0xcaed('0x8'));_0x293074='1';_0x2d1718=_0xcaed('0x8');break;case 0x2:logger[_0xcaed('0x5')](_0xcaed('0x1d'));_0x293074='2';_0x2d1718=_0xcaed('0x1d');break;case 0x9:logger['info'](_0xcaed('0x1e'));_0x293074='9';_0x2d1718='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger['info'](_0xcaed('0x1f'));_0x293074='10';_0x2d1718=_0xcaed('0x1f');break;case 0xb:logger[_0xcaed('0x5')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x293074='11';_0x2d1718=_0xcaed('0x20');}}}catch(_0x51cd2f){logger[_0xcaed('0x15')](_0xcaed('0x21'),JSON['stringify'](_0x51cd2f));_0x3d5d8b[_0xcaed('0x17')]();}}function _0x1e789d(){logger[_0xcaed('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x38835d({'transcript':_0x18d0da,'confidence':_0x1ef420,'status':_0x293074,'status_message':_0x2d1718});}function _0x35ea60(_0x6b69b8){logger[_0xcaed('0x15')](_0xcaed('0x22'));if(!_['isNil'](_0x6b69b8)){logger[_0xcaed('0x15')](_[_0xcaed('0x23')](_0x6b69b8)?JSON[_0xcaed('0x10')](_0x6b69b8):_0x6b69b8);}}_0x3d5d8b['on']('open',_0x5aa5cb);_0x3d5d8b['on']('message',_0x12c1d1);_0x3d5d8b['on'](_0xcaed('0x13'),_0x1e789d);_0x3d5d8b['on'](_0xcaed('0x15'),_0x35ea60);});}; \ No newline at end of file +var _0xcb5e=['transcript','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','error','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','lodash','moment','../../../../../../config/logger','agi','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final'];(function(_0x2590d7,_0xc2ce70){var _0x53c66b=function(_0x1b3ace){while(--_0x1b3ace){_0x2590d7['push'](_0x2590d7['shift']());}};_0x53c66b(++_0xc2ce70);}(_0xcb5e,0x1bc));var _0xecb5=function(_0xced704,_0x535540){_0xced704=_0xced704-0x0;var _0x43c180=_0xcb5e[_0xced704];return _0x43c180;};'use strict';var BPromise=require('bluebird');var _=require(_0xecb5('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xecb5('0x1'));var crypto=require('crypto');var logger=require(_0xecb5('0x2'))(_0xecb5('0x3'));module['exports']=function(_0x5e3c2d,_0x3896a7,_0x274196,_0x53db17){return new BPromise(function(_0x5159ce,_0x9fba0b){logger[_0xecb5('0x4')](_0xecb5('0x5'),_0x53db17||_0xecb5('0x6'));var _0x541059=new WebSocket(_0x53db17||_0xecb5('0x6'),{'perMessageDeflate':![]});var _0x2bd95d='';var _0x397f2e='0';var _0x56e2d8='1';var _0x16b449=_0xecb5('0x7');function _0x3d8137(_0x52f00e){var _0x2c9a0c=crypto['createHash'](_0xecb5('0x8'));_0x2c9a0c[_0xecb5('0x9')](_0x52f00e);return _0x2c9a0c['digest']('hex');}function _0x49be40(){try{logger[_0xecb5('0x4')](_0xecb5('0xa'));var _0x57f049=moment()[_0xecb5('0xb')]();var _0x304ec6=_0x3d8137(_0x57f049+_0x3896a7+_0x274196);_0x541059[_0xecb5('0xc')](JSON[_0xecb5('0xd')]({'appID':_0x3896a7,'timestamp':_0x57f049,'appKey':_0x304ec6}));var _0x1c1013=fs[_0xecb5('0xe')](_0x5e3c2d);_0x1c1013['on'](_0xecb5('0xf'),function(_0x1f01ad){_0x541059[_0xecb5('0xc')](_0x1f01ad);});_0x1c1013['on'](_0xecb5('0x10'),function(){_0x541059[_0xecb5('0xc')](_0xecb5('0x11'));});}catch(_0x37f8c3){logger['error'](_0xecb5('0x12'),JSON['stringify'](_0x37f8c3));_0x541059[_0xecb5('0x13')]();}}function _0x3eca00(_0x5adc96){try{if(_0x5adc96){var _0x3a3093=JSON[_0xecb5('0x14')](_0x5adc96);switch(_0x3a3093[_0xecb5('0x15')]){case 0x0:if(_0x3a3093['result']){if(_0x3a3093[_0xecb5('0x16')][_0xecb5('0x17')]){logger[_0xecb5('0x4')]('Tilde\x20ASR\x20hypoteses',JSON[_0xecb5('0xd')](_0x3a3093[_0xecb5('0x16')]['hypotheses']));_0x2bd95d=_0x3a3093[_0xecb5('0x16')]['hypotheses'][0x0][_0xecb5('0x18')];_0x397f2e=_0x3a3093[_0xecb5('0x16')]['hypotheses'][0x0]['likelihood'];_0x56e2d8='0';_0x16b449=_0xecb5('0x19');_0x541059[_0xecb5('0x13')]();}}break;case 0x1:logger['info'](_0xecb5('0x7'));_0x56e2d8='1';_0x16b449=_0xecb5('0x7');break;case 0x2:logger[_0xecb5('0x4')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x56e2d8='2';_0x16b449=_0xecb5('0x1a');break;case 0x9:logger[_0xecb5('0x4')](_0xecb5('0x1b'));_0x56e2d8='9';_0x16b449=_0xecb5('0x1b');break;case 0xa:logger['info'](_0xecb5('0x1c'));_0x56e2d8='10';_0x16b449=_0xecb5('0x1c');break;case 0xb:logger[_0xecb5('0x4')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x56e2d8='11';_0x16b449=_0xecb5('0x1d');}}}catch(_0x3180f1){logger['error'](_0xecb5('0x1e'),JSON[_0xecb5('0xd')](_0x3180f1));_0x541059[_0xecb5('0x13')]();}}function _0x1fab01(){logger[_0xecb5('0x4')]('Close\x20Tilde\x20ASR\x20socket');_0x5159ce({'transcript':_0x2bd95d,'confidence':_0x397f2e,'status':_0x56e2d8,'status_message':_0x16b449});}function _0xcea001(_0x434df8){logger[_0xecb5('0x1f')](_0xecb5('0x20'));if(!_[_0xecb5('0x21')](_0x434df8)){logger[_0xecb5('0x1f')](_['isObject'](_0x434df8)?JSON[_0xecb5('0xd')](_0x434df8):_0x434df8);}}_0x541059['on'](_0xecb5('0x22'),_0x49be40);_0x541059['on'](_0xecb5('0x23'),_0x3eca00);_0x541059['on'](_0xecb5('0x10'),_0x1fab01);_0x541059['on'](_0xecb5('0x1f'),_0xcea001);});}; \ 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 15fde50..905ea13 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 _0xe714=['exports','./asr'];(function(_0x4710d1,_0x4eb4b6){var _0x18b60f=function(_0x18965d){while(--_0x18965d){_0x4710d1['push'](_0x4710d1['shift']());}};_0x18b60f(++_0x4eb4b6);}(_0xe714,0xd5));var _0x4e71=function(_0x11a8fd,_0x1ee4c7){_0x11a8fd=_0x11a8fd-0x0;var _0x12c1c9=_0xe714[_0x11a8fd];return _0x12c1c9;};var asr=require(_0x4e71('0x0'));module[_0x4e71('0x1')]={'asr':asr}; \ No newline at end of file +var _0xb830=['exports'];(function(_0xb80aa4,_0x30db4d){var _0x5e781d=function(_0x1ed7de){while(--_0x1ed7de){_0xb80aa4['push'](_0xb80aa4['shift']());}};_0x5e781d(++_0x30db4d);}(_0xb830,0x18f));var _0x0b83=function(_0x300f9a,_0x3326a9){_0x300f9a=_0x300f9a-0x0;var _0x34ff7b=_0xb830[_0x300f9a];return _0x34ff7b;};var asr=require('./asr');module[_0x0b83('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 026c66f..0698f0a 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x31efe7,_0x52fe9e){var _0x24b6ee=function(_0x65ae94){while(--_0x65ae94){_0x31efe7['push'](_0x31efe7['shift']());}};_0x24b6ee(++_0x52fe9e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x164be6,_0x43734c){var _0x3e7c89=function(_0x3fae8c){while(--_0x3fae8c){_0x164be6['push'](_0x164be6['shift']());}};_0x3e7c89(++_0x43734c);}(_0x34e8,0x12c));var _0x834e=function(_0x1c168c,_0x5e4729){_0x1c168c=_0x1c168c-0x0;var _0x121218=_0x34e8[_0x1c168c];return _0x121218;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index e2b9cf9..7ea6a9b 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 _0x5a1c=['getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundById','save_name','getMailAccount','sendMailMessage','IntervalId','map','Intervals','interval','getSoundPath','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','format','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','MALE','MP3','googleTTS','google_tts_language','restAPI','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','url','headers','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','key','appid','appsecret','clear','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','length','saveRestApiResult','%s.%s','setVariable','split','extra','getAndSetVariable','getVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Wait\x20%s\x20seconds\x20before\x20answer','wait','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','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','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','unlink','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','DIAL','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','%s/recordings/%s','NOBEEP','recordFile','intKey','GOOGLE_ASR_%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','tildeASR','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','streamFile','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','no\x20file\x20audio\x20selected','getData','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue_id','getVoiceQueue','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','replaceAll','join','exports','util','lodash','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','then','name','catch','getSquareProject'];(function(_0x356f83,_0x4b6fa7){var _0x35d5c9=function(_0xd110c0){while(--_0xd110c0){_0x356f83['push'](_0x356f83['shift']());}};_0x35d5c9(++_0x4b6fa7);}(_0x5a1c,0x1b5));var _0xc5a1=function(_0x2bc780,_0x32a247){_0x2bc780=_0x2bc780-0x0;var _0x42f7b5=_0x5a1c[_0x2bc780];return _0x42f7b5;};'use strict';var fs=require('fs');var util=require(_0xc5a1('0x0'));var _=require(_0xc5a1('0x1'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0xc5a1('0x2'));var moment=require('moment');var Mustache=require(_0xc5a1('0x3'));var rp=require(_0xc5a1('0x4'));var logger=require(_0xc5a1('0x5'))(_0xc5a1('0x6'));var config=require('../../config/environment');var shared=require(_0xc5a1('0x7'));var scripts=require(_0xc5a1('0x8'));var FILES_PATH=_0xc5a1('0x9');var recursiveMapAttributes=['rawHeaders',_0xc5a1('0xa')];var verticesWithRetry=[_0xc5a1('0xb'),_0xc5a1('0xc'),_0xc5a1('0xd')];var AGIVertices=function(_0x42b181,_0x54a2de,_0x28234b){this[_0xc5a1('0xe')]=_0x42b181;this[_0xc5a1('0xf')]=_0x54a2de;this[_0xc5a1('0x10')]=_0x28234b;};AGIVertices[_0xc5a1('0x11')]['getVariable']=function(_0x15fc14,_0x460c4e){this['rpc']['getVariableById'](_0x15fc14)[_0xc5a1('0x12')](function(_0x514744){_0x460c4e(null,_0x514744?_0x514744[_0xc5a1('0x13')]:![]);})[_0xc5a1('0x14')](function(_0x37b863){_0x460c4e(_0x37b863);});};AGIVertices[_0xc5a1('0x11')]['getVoiceQueue']=function(_0x380147,_0x4b8056){this[_0xc5a1('0xf')]['getVoiceQueueById'](_0x380147)[_0xc5a1('0x12')](function(_0xf0a6a9){_0x4b8056(null,_0xf0a6a9?_0xf0a6a9[_0xc5a1('0x13')]:![]);})[_0xc5a1('0x14')](function(_0x3e99b5){_0x4b8056(_0x3e99b5);});};AGIVertices['prototype'][_0xc5a1('0x15')]=function(_0x2d1d2f,_0x1a8e41){this[_0xc5a1('0xf')][_0xc5a1('0x16')](_0x2d1d2f)[_0xc5a1('0x12')](function(_0x174693){_0x1a8e41(null,_0x174693?_0x174693['name']:![]);})[_0xc5a1('0x14')](function(_0x2742f0){_0x1a8e41(_0x2742f0);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x17')]=function(_0x5f1409,_0x40815e){this[_0xc5a1('0xf')][_0xc5a1('0x18')](_0x5f1409)[_0xc5a1('0x12')](function(_0x13d8e6){_0x40815e(null,_0x13d8e6?_0x13d8e6[_0xc5a1('0x19')]:![]);})[_0xc5a1('0x14')](function(_0x1bde6c){_0x40815e(_0x1bde6c);});};AGIVertices['prototype'][_0xc5a1('0x1a')]=function(_0x578788,_0x4137e6){this[_0xc5a1('0xf')]['getUserById'](_0x578788)[_0xc5a1('0x12')](function(_0x2085fa){_0x4137e6(null,_0x2085fa?_0x2085fa['name']:![]);})['catch'](function(_0xc726f7){_0x4137e6(_0xc726f7);});};AGIVertices[_0xc5a1('0x11')]['getTrunk']=function(_0x9168e2,_0x4b9c67){this[_0xc5a1('0xf')][_0xc5a1('0x1b')](_0x9168e2)[_0xc5a1('0x12')](function(_0xfad798){_0x4b9c67(null,_0xfad798?_0xfad798[_0xc5a1('0x13')]:![]);})[_0xc5a1('0x14')](function(_0x29e7cf){_0x4b9c67(_0x29e7cf);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1c')]=function(_0x3eec16,_0x411aac){var _0x48ac66=this;this[_0xc5a1('0xf')][_0xc5a1('0x1d')](_0x3eec16)['then'](function(_0x3671cd){_0x411aac(null,_0x3671cd?_0x48ac66['getSoundPath'](_0x3671cd[_0xc5a1('0x1e')]):![]);})['catch'](function(_0x40ae05){_0x411aac(_0x40ae05);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1f')]=function(_0x3151d9,_0x1bf164){this[_0xc5a1('0xf')]['getMailAccountById'](_0x3151d9)[_0xc5a1('0x12')](function(_0x542508){_0x1bf164(null,_0x542508?_0x542508:![]);})['catch'](function(_0x4768ed){_0x1bf164(_0x4768ed);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x20')]=function(_0x153ab1,_0x517200,_0x371b25){this['mailRpc'][_0xc5a1('0x20')](_0x153ab1,_0x517200)['then'](function(){_0x371b25(null);})[_0xc5a1('0x14')](function(_0x2178ff){_0x371b25(_0x2178ff);});};AGIVertices[_0xc5a1('0x11')]['getIntervals']=function(_0xd5c649,_0x430654){this[_0xc5a1('0xf')]['getIntervalById'](_0xd5c649)[_0xc5a1('0x12')](function(_0x5c2a2c){if(_0x5c2a2c){if(_0x5c2a2c[_0xc5a1('0x21')]){_0x430654(null,[_0x5c2a2c['interval']]);}else{_0x430654(null,_[_0xc5a1('0x22')](_0x5c2a2c[_0xc5a1('0x23')],_0xc5a1('0x24')));}}else{_0x430654(null,![]);}})[_0xc5a1('0x14')](function(_0x441a52){_0x430654(_0x441a52);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x25')]=function(_0x14327e){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x14327e);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x26')]=function(_0x3def61,_0x299caf,_0x4fd625){odbc[_0xc5a1('0x27')](_0x3def61,function(_0x284cab){if(_0x284cab){logger[_0xc5a1('0x28')](_0xc5a1('0x29'),_0x284cab);_0x4fd625(_0x284cab);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xc5a1('0x2a')](_0x299caf,function(_0x564171,_0x567c95){if(_0x564171){logger[_0xc5a1('0x2b')](_0xc5a1('0x2c'),_0x299caf);_0x4fd625(_0x564171);}else{logger[_0xc5a1('0x2b')](_0xc5a1('0x2d'),_0x299caf);odbc[_0xc5a1('0x2e')](function(_0x3dc458){if(_0x3dc458){logger['error'](_0xc5a1('0x2f'),_0x3dc458);}_0x4fd625(null,_0x567c95);});}});}});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x30')]=function(_0x3d18c3,_0x5d7b57){this['rpc'][_0xc5a1('0x31')](_0x3d18c3)[_0xc5a1('0x12')](function(_0x14a91f){_0x5d7b57(null,_0x14a91f?_0x14a91f:![]);})[_0xc5a1('0x14')](function(_0x4ff059){_0x5d7b57(_0x4ff059);});};AGIVertices['prototype'][_0xc5a1('0x32')]=function(_0x591e25,_0x15005a){this[_0xc5a1('0xf')][_0xc5a1('0x32')](_0x591e25)['then'](function(_0x5cd707){_0x15005a(null,_0x5cd707);})[_0xc5a1('0x14')](function(_0x1fb5ca){_0x15005a(_0x1fb5ca);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x33')]=function(_0x4309f4,_0x40b37a,_0x1aca42){this[_0xc5a1('0xf')][_0xc5a1('0x33')]({'uniqueid':this[_0xc5a1('0xe')][_0xc5a1('0x34')],'node':_0x4309f4[_0xc5a1('0x35')],'application':_0x4309f4['agicommand'],'data':_0x40b37a||null,'project_name':this['channel'][_0xc5a1('0x36')],'callerid':this[_0xc5a1('0xe')]['callerid']})[_0xc5a1('0x12')](function(_0x5e6df6){if(_0x1aca42){_0x1aca42(null,_0x5e6df6);}})['catch'](function(_0x145fe3){if(_0x1aca42){_0x1aca42(_0x145fe3);}});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x37')]=function(_0x3074b5,_0x3db41d,_0x5f3cea,_0x1e9216){this[_0xc5a1('0xf')][_0xc5a1('0x37')]({'uniqueid':this[_0xc5a1('0xe')][_0xc5a1('0x34')],'callerid':this[_0xc5a1('0xe')][_0xc5a1('0x38')],'calleridname':this['channel'][_0xc5a1('0x39')],'context':this['channel'][_0xc5a1('0x3a')],'extension':this[_0xc5a1('0xe')][_0xc5a1('0x3b')],'priority':this[_0xc5a1('0xe')][_0xc5a1('0x3c')],'accountcode':this[_0xc5a1('0xe')][_0xc5a1('0x3d')],'dnid':this[_0xc5a1('0xe')][_0xc5a1('0x3e')],'projectName':this[_0xc5a1('0xe')][_0xc5a1('0x36')],'saveName':_0x3db41d,'filename':_0x3074b5['file']||_0x3db41d,'savePath':_0x5f3cea})['then'](function(_0x456b78){_0x1e9216(null,_0x456b78);})['catch'](function(_0x566305){_0x1e9216(_0x566305);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x3f')]=function(_0x34488a,_0x3eaff7,_0x31538d,_0x305b11,_0x36e82b){this[_0xc5a1('0xf')][_0xc5a1('0x3f')]({'uniqueid':this['channel'][_0xc5a1('0x34')],'body':_0x34488a,'direction':_0x3eaff7,'providerName':_0x31538d,'providerResponse':_0x305b11})['then'](function(_0x2a6b47){if(_0x36e82b){_0x36e82b(null,_0x2a6b47);}})['catch'](function(_0x5018fc){if(_0x36e82b){_0x36e82b(_0x5018fc);}});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x40')]=function(_0x3cc7f9,_0x1f96ee){this['rpc']['createCmContact']({'firstName':_[_0xc5a1('0x41')](_0x3cc7f9['name'])||_[_0xc5a1('0x42')](_0x3cc7f9['name'])?'callback_'+Math[_0xc5a1('0x43')]():_0x3cc7f9[_0xc5a1('0x13')],'lastName':_['isEmpty'](_0x3cc7f9[_0xc5a1('0x44')])||_[_0xc5a1('0x42')](_0x3cc7f9['lastName'])?null:_0x3cc7f9[_0xc5a1('0x44')],'phone':_0x3cc7f9[_0xc5a1('0x45')],'ListId':_0x3cc7f9[_0xc5a1('0x46')],'scheduledat':_0x3cc7f9[_0xc5a1('0x47')],'callbackUniqueid':this[_0xc5a1('0xe')][_0xc5a1('0x34')],'tags':_0xc5a1('0x48'),'description':_0xc5a1('0x49')+_0x3cc7f9[_0xc5a1('0x47')][_0xc5a1('0x4a')](),'priority':_0x3cc7f9[_0xc5a1('0x4b')]})[_0xc5a1('0x12')](function(_0x21a3cf){_0x1f96ee(null,_0x21a3cf);})[_0xc5a1('0x14')](function(_0x1791c0){_0x1f96ee(_0x1791c0);});};AGIVertices[_0xc5a1('0x11')]['getPause']=function(_0x29e3f7,_0x4260e7){this['rpc']['getPauseById'](_0x29e3f7)[_0xc5a1('0x12')](function(_0x10748f){_0x4260e7(null,_0x10748f?_0x10748f[_0xc5a1('0x13')]:![]);})['catch'](function(_0x35e64e){_0x4260e7(_0x35e64e);});};AGIVertices[_0xc5a1('0x11')]['agentPause']=function(_0x495a04,_0x5cadc4,_0x52028b){var _0x3f90fb={'role':'agent'};_0x3f90fb[_0x495a04]=this[_0xc5a1('0xe')][_0xc5a1('0x38')];this[_0xc5a1('0xf')][_0xc5a1('0x4c')](_0x3f90fb,_0x5cadc4,this['channel'][_0xc5a1('0x34')])[_0xc5a1('0x12')](function(_0x27b1a1){_0x52028b(null,_[_0xc5a1('0x42')](_0x27b1a1)?![]:!![]);})[_0xc5a1('0x14')](function(_0x4bc556){logger[_0xc5a1('0x28')](_0x4bc556);_0x52028b(null,![]);});};AGIVertices['prototype'][_0xc5a1('0x4d')]=function(_0x591a58,_0x159582){var _0x1c302e={'role':'agent'};_0x1c302e[_0x591a58]=this[_0xc5a1('0xe')][_0xc5a1('0x38')];this[_0xc5a1('0xf')]['agentUnpause'](_0x1c302e)[_0xc5a1('0x12')](function(_0x5c3edc){_0x159582(null,_[_0xc5a1('0x42')](_0x5c3edc)?![]:!![]);})[_0xc5a1('0x14')](function(_0x4dbe94){logger['error'](_0x4dbe94);_0x159582(null,![]);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x4e')]=function(_0xde32da,_0x314a7c){var _0x48ba43={'role':_0xc5a1('0x4f')};_0x48ba43[_0xde32da]=this['channel'][_0xc5a1('0x38')];this[_0xc5a1('0xf')][_0xc5a1('0x4e')](_0x48ba43)[_0xc5a1('0x12')](function(_0x1071f9){_0x314a7c(null,_[_0xc5a1('0x42')](_0x1071f9)?![]:!![]);})[_0xc5a1('0x14')](function(_0x45c6a0){logger[_0xc5a1('0x28')](_0x45c6a0);_0x314a7c(null,![]);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x50')]=function(_0x3f4139,_0x1d793a){var _0x157be5={'role':'agent'};_0x157be5[_0x3f4139]=this['channel'][_0xc5a1('0x38')];var _0x4fa711=_0x3f4139!=_0xc5a1('0x51')?util[_0xc5a1('0x52')](_0xc5a1('0x53'),_0xc5a1('0x54'),this[_0xc5a1('0xe')][_0xc5a1('0x38')]):undefined;this[_0xc5a1('0xf')]['agentLogin'](_0x157be5,_0x4fa711)['then'](function(_0x45b74e){_0x1d793a(null,_['isNil'](_0x45b74e)?![]:!![]);})['catch'](function(_0x14459a){logger[_0xc5a1('0x28')](_0x14459a);_0x1d793a(null,![]);});};AGIVertices[_0xc5a1('0x11')]['shellCommand']=function(_0x46d1f5,_0x3cea21){sh[_0xc5a1('0x55')](_[_0xc5a1('0x56')](_0x46d1f5),function(_0x37cac3,_0x4f063d){var _0x5bc04a=_0x4f063d[_0xc5a1('0x57')](/(\r\n|\n|\r)/gm,'');_0x3cea21(null,_0x5bc04a);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x58')]=function(_0x39d2b6,_0x1a1874){scripts[_0xc5a1('0x58')](_0x39d2b6[_0xc5a1('0x59')],_0x39d2b6[_0xc5a1('0x5a')]||_0xc5a1('0x5b'),_0x39d2b6['text'],_0x39d2b6[_0xc5a1('0x5c')]||_0xc5a1('0x5d'),_0x39d2b6['ssmlGender']||_0xc5a1('0x5e'),_0x39d2b6['audioEncoding']||_0xc5a1('0x5f'))['then'](function(_0x175f97){_0x1a1874(null,_0x175f97);})[_0xc5a1('0x14')](function(_0x404637){_0x1a1874(_0x404637);});};AGIVertices['prototype'][_0xc5a1('0x60')]=function(_0x5ad811,_0x2ac795){scripts['googleTTS'](_0x5ad811[_0xc5a1('0x5b')],_0x5ad811[_0xc5a1('0x61')]||'en',0x1)['then'](function(_0xaa32ed){_0x2ac795(null,_0xaa32ed);})[_0xc5a1('0x14')](function(_0x3c6c51){_0x2ac795(_0x3c6c51);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x62')]=function(_0x292d8c,_0x3cd47a){var _0x5c664e={'uri':_0x292d8c['url'],'method':_0x292d8c[_0xc5a1('0x63')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x292d8c[_0xc5a1('0x64')])===_0xc5a1('0x65')&&parseInt(_0x292d8c[_0xc5a1('0x64')])>=0x1?parseInt(_0x292d8c['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xc5a1('0x66')]([_0xc5a1('0x67'),_0xc5a1('0x68')],_0x5c664e[_0xc5a1('0x63')][_0xc5a1('0x69')]())){try{_0x5c664e[_0xc5a1('0x6a')]=_0x292d8c[_0xc5a1('0xa')]?JSON[_0xc5a1('0x6b')](_0x292d8c[_0xc5a1('0xa')]):{};}catch(_0x308ac0){logger[_0xc5a1('0x28')](_0xc5a1('0x6c'),_0x308ac0);}}try{_0x5c664e['headers']=_0x292d8c[_0xc5a1('0x6d')]?JSON[_0xc5a1('0x6b')](_0x292d8c[_0xc5a1('0x6d')]):{};}catch(_0x4eba66){logger['error'](_0xc5a1('0x6e'),_0x4eba66);}if(_0x292d8c['computedVariables']){try{var _0x116462=require(_0x292d8c['computedVariables'])[_0xc5a1('0x6f')](this,_0x5c664e);_0x5c664e[_0xc5a1('0x70')]=Mustache[_0xc5a1('0x71')](_0x292d8c[_0xc5a1('0x72')],_0x116462,{},['$$','$$']);if(_0x5c664e[_0xc5a1('0x73')]){_0x5c664e['headers']=JSON['parse'](Mustache[_0xc5a1('0x71')](JSON['stringify'](_0x5c664e[_0xc5a1('0x73')]),_0x116462,{},['$$','$$']));}if(_0x5c664e[_0xc5a1('0x6a')]){_0x5c664e[_0xc5a1('0x6a')]=JSON[_0xc5a1('0x6b')](Mustache[_0xc5a1('0x71')](JSON[_0xc5a1('0x74')](_0x5c664e[_0xc5a1('0x6a')]),_0x116462,{},['$$','$$']));}}catch(_0x5c7bcf){logger[_0xc5a1('0x28')](_0xc5a1('0x75'),_0x5c7bcf);}}rp(_0x5c664e)[_0xc5a1('0x12')](function(_0x33c9bd){var _0x3ebf51={'statusCode':_0x33c9bd[_0xc5a1('0x76')]||0xc8,'statusMessage':_0x33c9bd[_0xc5a1('0x77')]||'OK','headers':_0x33c9bd[_0xc5a1('0x73')]||{},'body':_0x33c9bd[_0xc5a1('0x6a')]||{}};_0x3cd47a(null,_0x3ebf51);})[_0xc5a1('0x14')](function(_0x569ad4){var _0x43cb42={'statusCode':_0x569ad4[_0xc5a1('0x76')]||0x1f4,'statusMessage':_0x569ad4[_0xc5a1('0x78')]||_0xc5a1('0x79'),'headers':_0x569ad4[_0xc5a1('0x7a')][_0xc5a1('0x73')]||{},'body':_0x569ad4['options'][_0xc5a1('0x6a')]||{}};_0x3cd47a(null,_0x43cb42);});};AGIVertices[_0xc5a1('0x11')]['googleDialogflow']=function(_0x367043,_0x25967c){scripts['googleDialogflow'](this['channel'][_0xc5a1('0x34')],_0x367043['key'],_0x367043[_0xc5a1('0x5b')],_0x367043[_0xc5a1('0x7b')]||'en')[_0xc5a1('0x12')](function(_0x2d0af9){_0x25967c(null,_0x2d0af9);})[_0xc5a1('0x14')](function(_0x453c80){_0x25967c(_0x453c80);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x7c')]=function(_0x4fa5d2,_0x2bcb32){scripts[_0xc5a1('0x7c')](this[_0xc5a1('0xe')][_0xc5a1('0x34')],_0x4fa5d2[_0xc5a1('0x7d')],_0x4fa5d2[_0xc5a1('0x7e')],_0x4fa5d2[_0xc5a1('0x7f')],_0x4fa5d2[_0xc5a1('0x5b')],_0x4fa5d2['dialogflowV2_language']||'en')[_0xc5a1('0x12')](function(_0x48991c){_0x2bcb32(null,_0x48991c);})[_0xc5a1('0x14')](function(_0x318b5f){_0x2bcb32(_0x318b5f);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x80')]=function(_0xb3d6b9,_0x47c6d9){scripts[_0xc5a1('0x80')](this[_0xc5a1('0xe')],_0xb3d6b9)['then'](function(_0x4f72e2){_0x47c6d9(null,_0x4f72e2);})['catch'](function(_0x27f206){_0x47c6d9(_0x27f206);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x81')]=function(_0x41f41e,_0x1b2ec1){scripts[_0xc5a1('0x81')](_0x41f41e['key'],_0x41f41e[_0xc5a1('0x5b')],_0x41f41e['ispeech_tts_language']||_0xc5a1('0x5d'),_0x41f41e['speed'])['then'](function(_0x4c1d8f){_0x1b2ec1(null,_0x4c1d8f);})[_0xc5a1('0x14')](function(_0x2ca134){_0x1b2ec1(_0x2ca134);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x82')]=function(_0x4cf97f,_0x5ac3f3,_0x683136){scripts[_0xc5a1('0x82')](_0x5ac3f3,_0x4cf97f['key'],_0x4cf97f[_0xc5a1('0x83')]||_0xc5a1('0x5d'),this[_0xc5a1('0x84')](_0x4cf97f[_0xc5a1('0x85')])?_0x4cf97f['model']:undefined)['then'](function(_0x431aa9){_0x683136(null,_0x431aa9);})[_0xc5a1('0x14')](function(_0x3197b2){_0x683136(_0x3197b2);});};AGIVertices[_0xc5a1('0x11')]['awsPolly']=function(_0x39714d,_0x3b735a){scripts[_0xc5a1('0x86')](_0x39714d[_0xc5a1('0x87')],_0x39714d[_0xc5a1('0x88')],_0x39714d[_0xc5a1('0x89')],_0x39714d[_0xc5a1('0x8a')]||'Amy',_0x39714d[_0xc5a1('0x5b')],_0x39714d[_0xc5a1('0x8b')]||_0xc5a1('0x5b'))[_0xc5a1('0x12')](function(_0x104742){_0x3b735a(null,_0x104742);})[_0xc5a1('0x14')](function(_0x2c6608){_0x3b735a(_0x2c6608);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x8c')]=function(_0x3e6dd1,_0x3c343b){scripts[_0xc5a1('0x8c')](this['channel']['uniqueid'],_0x3e6dd1[_0xc5a1('0x87')],_0x3e6dd1[_0xc5a1('0x88')],_0x3e6dd1[_0xc5a1('0x8d')],_0x3e6dd1[_0xc5a1('0x5b')],_0x3e6dd1[_0xc5a1('0x8e')])[_0xc5a1('0x12')](function(_0x44a907){_0x3c343b(null,_0x44a907);})[_0xc5a1('0x14')](function(_0x3f0fc3){_0x3c343b(_0x3f0fc3);});};AGIVertices[_0xc5a1('0x11')]['googleASR']=function(_0x350d69,_0x443464,_0x265c55){scripts[_0xc5a1('0x8f')](_0x443464,_0x350d69[_0xc5a1('0x90')],_0x350d69['google_asr_language']||_0xc5a1('0x5d'))[_0xc5a1('0x12')](function(_0x2f6a4b){_0x265c55(null,_0x2f6a4b);})[_0xc5a1('0x14')](function(_0x77a7bf){_0x265c55(_0x77a7bf);});};AGIVertices['prototype']['tildeASR']=function(_0x211077,_0x1675ef,_0x39e960){scripts['tildeASR'](_0x1675ef,_0x211077[_0xc5a1('0x91')],_0x211077[_0xc5a1('0x92')],_0x211077['uri'])[_0xc5a1('0x12')](function(_0x4eb451){_0x39e960(null,_0x4eb451);})[_0xc5a1('0x14')](function(_0x34b614){_0x39e960(_0x34b614);});};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x93')]=function(_0x4b871d){var _0x2a6f24=_[_0xc5a1('0x66')](verticesWithRetry,_0x4b871d['agicommand'])?_0x4b871d:_['clone'](_0x4b871d);for(var _0x338357 in _0x2a6f24){if(_0x2a6f24['hasOwnProperty'](_0x338357)){if(_0x2a6f24[_0x338357]&&_[_0xc5a1('0x94')](_0x2a6f24[_0x338357])){if(_[_0xc5a1('0x66')](recursiveMapAttributes,_0x338357)){_0x2a6f24[_0x338357]=this[_0xc5a1('0x95')](_0x2a6f24[_0x338357]);}else{_0x2a6f24[_0x338357]=this[_0xc5a1('0x96')](_0x2a6f24[_0x338357]);}}}}return _0x2a6f24;};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x97')]=function(_0x273dbc){for(var _0x445979 in _0x273dbc){if(_0x273dbc[_0xc5a1('0x98')](_0x445979)){if(_[_0xc5a1('0x99')](_0x273dbc[_0x445979])){this[_0xc5a1('0x97')](_0x273dbc[_0x445979]);}else if(_['isArray'](_0x273dbc[_0x445979])){for(var _0xca67b8=0x0;_0xca67b8<_0x273dbc[_0x445979][_0xc5a1('0x9a')];_0xca67b8++){this[_0xc5a1('0x97')](_0x273dbc[_0x445979][_0xca67b8]);}}else if(_['isString'](_0x273dbc[_0x445979])){_0x273dbc[_0x445979]=this[_0xc5a1('0x96')](_0x273dbc[_0x445979]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x38f2b6,_0x2fd4a9){for(var _0x1a9fe9 in _0x38f2b6){if(_0x38f2b6[_0xc5a1('0x98')](_0x1a9fe9)){if(_[_0xc5a1('0x99')](_0x38f2b6[_0x1a9fe9])){if(!_[_0xc5a1('0x41')](_0x38f2b6[_0x1a9fe9])){this[_0xc5a1('0x9b')](_0x38f2b6[_0x1a9fe9],util[_0xc5a1('0x52')]('%s.%s',_0x2fd4a9,_0x1a9fe9));}}else if(_['isArray'](_0x38f2b6[_0x1a9fe9])){for(var _0x4a58a4=0x0;_0x4a58a4<_0x38f2b6[_0x1a9fe9][_0xc5a1('0x9a')];_0x4a58a4++){this[_0xc5a1('0x9b')](_0x38f2b6[_0x1a9fe9][_0x4a58a4],util[_0xc5a1('0x52')](_0xc5a1('0x9c'),_0x2fd4a9,_0x1a9fe9+'['+_0x4a58a4+']'));}}else{if(!_[_0xc5a1('0x42')](_0x38f2b6[_0x1a9fe9])){this['channel'][_0xc5a1('0x9d')](util[_0xc5a1('0x52')]('%s.%s',_0x2fd4a9,_0x1a9fe9),_0x38f2b6[_0x1a9fe9]);}}}}};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x95')]=function(_0x3bc023){try{var _0x3b7a35=JSON['parse'](_0x3bc023);this[_0xc5a1('0x97')](_0x3b7a35);return JSON[_0xc5a1('0x74')](_0x3b7a35);}catch(_0x2d5bbf){return this[_0xc5a1('0x96')](_0x3bc023);}};AGIVertices[_0xc5a1('0x11')]['replaceAllVariables']=function(_0x404b9f){var _0xc12ef3=_0x404b9f[_0xc5a1('0x9e')]('{');for(var _0x2c8cb2=0x1;_0x2c8cb2<_0xc12ef3[_0xc5a1('0x9a')];_0x2c8cb2+=0x1){var _0x6b7163=_0xc12ef3[_0x2c8cb2][_0xc5a1('0x9e')]('}');if(_0x6b7163[_0xc5a1('0x9a')]>0x1){_0x404b9f=_0x404b9f['replaceAll']('{'+_0x6b7163[0x0]+'}',this[_0xc5a1('0xe')]['getVariable'](_0x6b7163[0x0])[_0xc5a1('0x9f')]||_0x6b7163[0x0]);}}if(_0xc12ef3[_0xc5a1('0x9a')]===0x1){return _0x404b9f['toString']();}return this['replaceAllVariables'](_0x404b9f);};AGIVertices['prototype'][_0xc5a1('0xa0')]=function(_0x1be363,_0x5d9d3c){var _0x356713=this[_0xc5a1('0xe')][_0xc5a1('0xa1')](_0x1be363);if(_0x356713['result']===-0x1){return _0x356713;}logger[_0xc5a1('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5d9d3c,_0x356713[_0xc5a1('0x9f')]));return this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0x5d9d3c,_0x356713[_0xc5a1('0x9f')]);};AGIVertices['prototype'][_0xc5a1('0x84')]=function(_0x542d43){return _0x542d43&&_0x542d43!=='0'&&_0x542d43!=='-1'&&_0x542d43!=='';};AGIVertices['prototype'][_0xc5a1('0xa2')]=function(_0x20a463){this[_0xc5a1('0x33')]['sync'](this,_0x20a463,'-');_0x20a463[_0xc5a1('0xa3')]=_0x20a463[_0xc5a1('0xa2')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xa4')]=function(_0x215140){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0xa5'),_0x215140['label']));if(!this[_0xc5a1('0x84')](_0x215140[_0xc5a1('0x5b')])){return this['channel']['noop'](_0xc5a1('0xa6'));}var _0x3d4971='\x22'+_0x215140[_0xc5a1('0x5b')]+'\x22';if(this[_0xc5a1('0x84')](_0x215140[_0xc5a1('0x7a')])){_0x3d4971+=','+_0x215140[_0xc5a1('0x7a')];}var _0x142551=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0xc5a1('0xa7'),_0x3d4971);if(_0x142551[_0xc5a1('0xa8')]===-0x1){return _0x142551;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xaa'),_0x3d4971));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xab')]=function(_0x3ea1b7){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xac'),_0x3ea1b7[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x3ea1b7['grammar'])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xad'));}var _0x4ad135=_0x3ea1b7[_0xc5a1('0xae')];if(this[_0xc5a1('0x84')](_0x3ea1b7[_0xc5a1('0x7a')])){_0x4ad135+=','+_0x3ea1b7[_0xc5a1('0x7a')];}var _0x38bcf2=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0xc5a1('0xaf'),_0x4ad135);if(_0x38bcf2[_0xc5a1('0xa8')]===-0x1){return _0x38bcf2;}var _0x3ee0c4=this[_0xc5a1('0xa0')](_0xc5a1('0xb0'),_0xc5a1('0xb1'));if(_0x3ee0c4[_0xc5a1('0xa8')]===-0x1){return _0x3ee0c4;}var _0x4c3ffb=this['getAndSetVariable'](_0xc5a1('0xb2'),_0xc5a1('0xb3'));if(_0x4c3ffb[_0xc5a1('0xa8')]===-0x1){return _0x4c3ffb;}var _0x4d7027=this[_0xc5a1('0xa0')](_0xc5a1('0xb4'),_0xc5a1('0xb5'));if(_0x4d7027[_0xc5a1('0xa8')]===-0x1){return _0x4d7027;}return this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xb6'),_0x4ad135));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x6')]=function(_0x396752){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xb7'),_0x396752[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')][_0xc5a1('0x6')]([_0x396752[_0xc5a1('0xb8')],_0x396752[_0xc5a1('0xb9')]]);};AGIVertices[_0xc5a1('0x11')]['answer']=function(_0x55453c){logger['info'](util[_0xc5a1('0x52')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x55453c['label']));if(this[_0xc5a1('0x84')](_0x55453c['timeout'])){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xba'),_0x55453c[_0xc5a1('0x64')]));var _0x27afe3=this['channel'][_0xc5a1('0xbb')](_0x55453c['timeout']);if(_0x27afe3[_0xc5a1('0xa8')]===-0x1){return _0x27afe3;}}return this[_0xc5a1('0xe')][_0xc5a1('0xbc')]();};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x48')]=function(_0x40be73){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xbd'),_0x40be73[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x40be73[_0xc5a1('0x46')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x40be73,_0xc5a1('0xbe'));}_0x40be73[_0xc5a1('0x47')]=moment();if(this[_0xc5a1('0x84')](_0x40be73[_0xc5a1('0xbf')])){_0x40be73[_0xc5a1('0x47')]=moment()[_0xc5a1('0xc0')](_0x40be73[_0xc5a1('0xbf')],_0xc5a1('0xc1'));}if(!this[_0xc5a1('0x84')](_0x40be73['callback_priority'])){_0x40be73[_0xc5a1('0x4b')]=0x2;}this[_0xc5a1('0x40')][_0xc5a1('0x6f')](this,_0x40be73);return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x40be73['phone'],_0x40be73[_0xc5a1('0x46')],_0x40be73[_0xc5a1('0x47')]));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xc2')]=function(_0x4de812){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0xc3'),_0x4de812[_0xc5a1('0x35')]));var _0x391b2d=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0x4de812[_0xc5a1('0xc4')],_0x4de812[_0xc5a1('0x7a')]);if(_0x391b2d[_0xc5a1('0xa8')]===-0x1){return _0x391b2d;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xc5'),_0x4de812[_0xc5a1('0xc4')],_0x4de812[_0xc5a1('0x7a')]));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xc6')]=function(_0x3fa6e2){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xc7'),_0x3fa6e2[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x3fa6e2[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}var _0x18e2a4='\x22'+_0x3fa6e2['text']+'\x22';if(this[_0xc5a1('0x84')](_0x3fa6e2[_0xc5a1('0x7a')])){_0x18e2a4+=','+_0x3fa6e2['options'];}var _0x43fb97=this['channel'][_0xc5a1('0x55')](_0xc5a1('0xa7'),_0x18e2a4);if(_0x43fb97[_0xc5a1('0xa8')]===-0x1){return _0x43fb97;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format'](_0xc5a1('0xaa'),_0x18e2a4));};AGIVertices[_0xc5a1('0x11')]['sestektts']=function(_0x280442){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0xc8'),_0x280442['label']));if(!this['isConfigured'](_0x280442[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')]['noop'](_0xc5a1('0xa6'));}var _0xfce71a='\x22'+_0x280442[_0xc5a1('0x5b')]+'\x22';if(this[_0xc5a1('0x84')](_0x280442[_0xc5a1('0x7a')])){_0xfce71a+=','+_0x280442[_0xc5a1('0x7a')];}var _0x36eded=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0xc5a1('0xa7'),_0xfce71a);if(_0x36eded[_0xc5a1('0xa8')]===-0x1){return _0x36eded;}return this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xaa'),_0xfce71a));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xc9')]=function(_0x5259b5){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xca'),_0x5259b5[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x5259b5[_0xc5a1('0xae')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')]('no\x20grammar\x20configured');}var _0x43e722=_0x5259b5[_0xc5a1('0xae')];if(this[_0xc5a1('0x84')](_0x5259b5[_0xc5a1('0x7a')])){_0x43e722+=','+_0x5259b5[_0xc5a1('0x7a')];}var _0x22368f=this['channel']['exec']('MRCPRecog',_0x43e722);if(_0x22368f['result']===-0x1){return _0x22368f;}var _0x35551d=this[_0xc5a1('0xa0')](_0xc5a1('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x35551d['result']===-0x1){return _0x35551d;}var _0x29658d=this[_0xc5a1('0xa0')](_0xc5a1('0xb2'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x29658d[_0xc5a1('0xa8')]===-0x1){return _0x29658d;}var _0x169d9e=this[_0xc5a1('0xa0')](_0xc5a1('0xb4'),'LUMENVOX_ASR_INSTANCE');if(_0x169d9e[_0xc5a1('0xa8')]===-0x1){return _0x169d9e;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format'](_0xc5a1('0xb6'),_0x43e722));};AGIVertices['prototype'][_0xc5a1('0xcb')]=function(_0x14c99c){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0xcc'),_0x14c99c[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x14c99c[_0xc5a1('0xae')])){return this['channel'][_0xc5a1('0xa9')](_0xc5a1('0xad'));}var _0x116d9c=_0x14c99c[_0xc5a1('0xae')];if(this[_0xc5a1('0x84')](_0x14c99c[_0xc5a1('0x7a')])){_0x116d9c+=','+_0x14c99c[_0xc5a1('0x7a')];}var _0x4ce078=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0xc5a1('0xaf'),_0x116d9c);if(_0x4ce078[_0xc5a1('0xa8')]===-0x1){return _0x4ce078;}var _0x1cfaf0=this[_0xc5a1('0xa0')]('RECOG_CONFIDENCE()',_0xc5a1('0xcd'));if(_0x1cfaf0['result']===-0x1){return _0x1cfaf0;}var _0x51d4e5=this[_0xc5a1('0xa0')](_0xc5a1('0xb2'),_0xc5a1('0xce'));if(_0x51d4e5[_0xc5a1('0xa8')]===-0x1){return _0x51d4e5;}var _0x128a41=this[_0xc5a1('0xa0')]('RECOG_INSTANCE()',_0xc5a1('0xcf'));if(_0x128a41[_0xc5a1('0xa8')]===-0x1){return _0x128a41;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('Executed\x20command\x20MRCPRecog\x20%s',_0x116d9c));};AGIVertices[_0xc5a1('0x11')]['database']=function(_0x4f819d){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x4f819d['label']));if(!this[_0xc5a1('0x84')](_0x4f819d[_0xc5a1('0xd0')])){return this['channel'][_0xc5a1('0x28')](_0x4f819d,_0xc5a1('0xd1'));}var _0x13affc=this[_0xc5a1('0x17')][_0xc5a1('0x6f')](this,_0x4f819d[_0xc5a1('0xd0')]);if(!_0x13affc){return this[_0xc5a1('0xe')]['error'](_0x4f819d,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x4f819d[_0xc5a1('0x2a')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x4f819d,_0xc5a1('0xd2'));}var _0x5077fc=_0x4f819d['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xd3'),_0x5077fc));var _0x4084d6=this[_0xc5a1('0x26')][_0xc5a1('0x6f')](this,_0x13affc,_0x5077fc);this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x4f819d,_0x5077fc);if(!this[_0xc5a1('0x84')](_0x4f819d[_0xc5a1('0xd4')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xd5'));}var _0x33e9da=this[_0xc5a1('0xa1')][_0xc5a1('0x6f')](this,_0x4f819d[_0xc5a1('0xd4')]);if(!_0x33e9da){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x4f819d,'no\x20variable\x20found');}var _0x40bd15=this;_0x4084d6[_0xc5a1('0xd6')](function(_0x4a50dc,_0x6cbd87){Object[_0xc5a1('0xd7')](_0x4a50dc)[_0xc5a1('0xd6')](function(_0x54be1e){_0x40bd15['channel'][_0xc5a1('0x9d')](util[_0xc5a1('0x52')]('%s[%s][%s]',_0x33e9da,_0x6cbd87,_0x54be1e),_0x4a50dc[_0x54be1e]);});});this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util[_0xc5a1('0x52')](_0xc5a1('0xd8'),_0x33e9da),_0x4084d6[_0xc5a1('0x9a')]);return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format'](_0xc5a1('0xd9'),_0x33e9da));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xda')]=function(_0x285a69){logger[_0xc5a1('0xdb')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x285a69['label']));if(!this[_0xc5a1('0x84')](_0x285a69[_0xc5a1('0xdc')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x285a69,_0xc5a1('0xdd'));}var _0x53c43e=this['getUser'][_0xc5a1('0x6f')](this,_0x285a69[_0xc5a1('0xdc')]);if(!_0x53c43e){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x285a69,_0xc5a1('0xde'));}var _0x18325e=this['channel'][_0xc5a1('0x55')]('DIAL',[util[_0xc5a1('0x52')](_0xc5a1('0xdf'),_0x53c43e),_0x285a69[_0xc5a1('0x64')],_0x285a69['opts'],_0x285a69[_0xc5a1('0x72')]]);if(_0x18325e[_0xc5a1('0xa8')]===-0x1){return _0x18325e;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xe0'),'DIAL'));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xe1')]=function(_0x1f5ed1){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0xe2'),_0x1f5ed1[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x1f5ed1['key'])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xe3'));}if(!this[_0xc5a1('0x84')](_0x1f5ed1[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')]['noop'](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')]['bot']=!![];this[_0xc5a1('0x33')](_0x1f5ed1);this[_0xc5a1('0x3f')](_0x1f5ed1[_0xc5a1('0x5b')],'in','','');this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('Trying\x20Dialogflow:\x20%s',_0x1f5ed1['text']));var _0x2af5fd=this['googleDialogflow']['sync'](this,_0x1f5ed1);if(_0x2af5fd){for(var _0x46dbbc in _0x2af5fd){if(_0x2af5fd['hasOwnProperty'](_0x46dbbc)){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util[_0xc5a1('0x52')]('DIALOGFLOW_%s',_0x46dbbc[_0xc5a1('0x69')]()),_0x2af5fd[_0x46dbbc]);}}this[_0xc5a1('0x3f')](_0x2af5fd[_0xc5a1('0xe4')],_0xc5a1('0xe5'),_0xc5a1('0xe1'),'');return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xe6'),_0x2af5fd['speech']));}return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x1f5ed1,_0xc5a1('0xe7'));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xe8')]=function(_0xb146ab){logger['info'](util['format'](_0xc5a1('0xe9'),_0xb146ab[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0xb146ab[_0xc5a1('0x7d')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xea'));}if(!this[_0xc5a1('0x84')](_0xb146ab['client_email'])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0xb146ab['private_key'])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xeb'));}if(!this['isConfigured'](_0xb146ab[_0xc5a1('0xec')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xed'));}if(!this[_0xc5a1('0x84')](_0xb146ab[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}this['channel'][_0xc5a1('0xee')]=!![];this[_0xc5a1('0x33')](_0xb146ab);this[_0xc5a1('0x3f')](_0xb146ab['text'],'in','','');this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xef'),_0xb146ab[_0xc5a1('0x5b')]));var _0x59a9c5=this[_0xc5a1('0x7c')][_0xc5a1('0x6f')](this,_0xb146ab);if(_0x59a9c5){for(var _0x25d975 in _0x59a9c5){if(_0x59a9c5[_0xc5a1('0x98')](_0x25d975)){if(_0x25d975!=='providerResponse'){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util[_0xc5a1('0x52')](_0xc5a1('0xf0'),_0x25d975['toUpperCase']()),_0x59a9c5[_0x25d975]);}}}this['createSquareMessage'](_0x59a9c5[_0xc5a1('0xe4')],_0xc5a1('0xe5'),'dialogflowV2',_0x59a9c5[_0xc5a1('0xf1')]);return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xf2'),_0x59a9c5['speech']));}return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0xb146ab,_0xc5a1('0xf3'));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xf4')]=function(_0x2d2401){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0xf5'),_0x2d2401[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x2d2401[_0xc5a1('0xf6')])){return this[_0xc5a1('0xe')]['noop'](_0xc5a1('0xf7'));}if(!this[_0xc5a1('0x84')](_0x2d2401[_0xc5a1('0xf8')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')]('no\x20username\x20configured');}if(!this[_0xc5a1('0x84')](_0x2d2401[_0xc5a1('0xf9')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xfa'));}if(!this['isConfigured'](_0x2d2401[_0xc5a1('0xfb')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')]['bot']=!![];this[_0xc5a1('0x33')](_0x2d2401);this[_0xc5a1('0x3f')](_0x2d2401[_0xc5a1('0x5b')],'in','','');this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('Trying\x20SestekNDA:\x20%s',_0x2d2401[_0xc5a1('0x5b')]));var _0x56069e=this['sestekNDA']['sync'](this,_0x2d2401);if(_0x56069e){for(var _0x3661f2 in _0x56069e){if(_0x56069e[_0xc5a1('0x98')](_0x3661f2)){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util['format'](_0xc5a1('0xfc'),_0x3661f2['toUpperCase']()),_0x56069e[_0x3661f2]);}}this[_0xc5a1('0x3f')](_0x56069e[_0xc5a1('0xe4')],_0xc5a1('0xe5'),_0xc5a1('0xf4'),'');if(_0x56069e[_0xc5a1('0xfd')]){this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xfe'),_0x56069e[_0xc5a1('0xfd')]));var _0x29816a=this[_0xc5a1('0xe')]['streamFile'](_0x56069e[_0xc5a1('0xfd')]);try{fs[_0xc5a1('0xff')](_0x56069e['audiofile']+_0xc5a1('0x100'));}catch(_0x1a1e29){logger[_0xc5a1('0x28')](_0x1a1e29);}return _0x29816a;}else{return this[_0xc5a1('0xe')]['noop'](util[_0xc5a1('0x52')](_0xc5a1('0x101'),_0x56069e['speech']));}}return this['channel'][_0xc5a1('0x28')](_0x2d2401,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x102')]=function(_0x527270){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x103'),_0x527270['label']));return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x102'));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x104')]=function(_0x178f49){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x105'),_0x178f49[_0xc5a1('0x35')]));var _0x4154d8='';if(_0x178f49[_0xc5a1('0x106')]){if(!this[_0xc5a1('0x84')](_0x178f49[_0xc5a1('0x106')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x178f49,_0xc5a1('0x107'));}else{var _0x19932c=parseInt(_0x178f49[_0xc5a1('0x106')],0xa);if(isNaN(_0x19932c)){_0x4154d8=_0x178f49['trunk_id'];}else{_0x4154d8=this[_0xc5a1('0x108')][_0xc5a1('0x6f')](this,_0x178f49[_0xc5a1('0x106')]);if(!_0x4154d8){return this['channel'][_0xc5a1('0x28')](_0x178f49,_0xc5a1('0x109'));}}}}else if(_0x178f49[_0xc5a1('0x10a')]){_0x4154d8=_0x178f49[_0xc5a1('0x10a')];}else{return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x178f49,'no\x20trunk\x20selected');}var _0x36ee5e=this['channel']['exec'](_0xc5a1('0x10b'),[util['format'](_0xc5a1('0x10c'),_0x4154d8,_0x178f49[_0xc5a1('0x45')]),_0x178f49['timeout'],_0x178f49[_0xc5a1('0x10d')],_0x178f49[_0xc5a1('0x72')]]);if(_0x36ee5e[_0xc5a1('0xa8')]===-0x1){return _0x36ee5e;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xe0'),_0xc5a1('0x10b')));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x10e')]=function(_0x1db141){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x10f'),_0x1db141[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')]['noop'](_0xc5a1('0x10e'));};AGIVertices['prototype']['getdigits']=function(_0x54446e){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x54446e[_0xc5a1('0x35')]));if(_0x54446e[_0xc5a1('0xa3')]===0x0){return this[_0xc5a1('0xa2')](_0x54446e);}_0x54446e[_0xc5a1('0xa3')]-=0x1;if(!this[_0xc5a1('0x84')](_0x54446e[_0xc5a1('0x110')])){return this[_0xc5a1('0xe')]['error'](_0x54446e,'no\x20file\x20audio\x20selected');}var _0x7c2653=this['getSound'][_0xc5a1('0x6f')](this,_0x54446e[_0xc5a1('0x110')]);if(!_0x7c2653){return this[_0xc5a1('0xe')]['error'](_0x54446e,_0xc5a1('0x111'));}if(!this[_0xc5a1('0x84')](_0x54446e['variable_id'])){return this['channel'][_0xc5a1('0x28')](_0xc5a1('0xd5'));}var _0x135156=this['channel']['getData'](_0x7c2653,_0x54446e['response'],_0x54446e[_0xc5a1('0x112')]);var _0x36adbd=_0x135156['result']?_0x135156[_0xc5a1('0xa8')][_0xc5a1('0x4a')]():'';logger['info'](_0xc5a1('0x113'),JSON['stringify'](_0x135156));if(_0x135156[_0xc5a1('0xa8')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0x54446e,_0x36adbd);return _0x135156;}else if(_0x135156[_0xc5a1('0x9f')]===_0xc5a1('0x64')){_0x135156['result']=_0x36adbd[_0xc5a1('0x9a')]>=parseInt(_0x54446e[_0xc5a1('0x114')])?'x':'i';}else{_0x135156[_0xc5a1('0xa8')]=_0x36adbd[_0xc5a1('0x9a')]>=parseInt(_0x54446e['mindigit'])&&_0x36adbd[_0xc5a1('0x9a')]<=parseInt(_0x54446e[_0xc5a1('0x112')])?'x':'i';}var _0x3a6d8f=this['getVariable'][_0xc5a1('0x6f')](this,_0x54446e[_0xc5a1('0xd4')]);if(!_0x3a6d8f){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x54446e,_0xc5a1('0x115'));}this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0x3a6d8f,_0x36adbd);if(this['isConfigured'](_0x54446e['hiddendigitsnum'])){var _0x3ed6e0=parseInt(_0x54446e[_0xc5a1('0x116')],0xa);var _0x4de5e5=rs['generate']({'charset':'*','length':_0x3ed6e0});var _0x1144bd=_0x36adbd[_0xc5a1('0x9a')];if(_0x1144bd>0x0){if(_0x1144bd>_0x3ed6e0){this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x54446e,_0x54446e[_0xc5a1('0x117')]==='first'?_0x4de5e5+_0x36adbd['substr'](_0x3ed6e0):_0x36adbd['substr'](0x0,_0x1144bd-_0x3ed6e0)+_0x4de5e5);}else{this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x54446e,rs[_0xc5a1('0x118')]({'charset':'*','length':_0x1144bd}));}}else{this[_0xc5a1('0x33')]['sync'](this,_0x54446e,'');}}else{this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x54446e,_0x36adbd);}return _0x135156;};AGIVertices['prototype'][_0xc5a1('0xd')]=function(_0x2426f7){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x119'),_0x2426f7[_0xc5a1('0x35')]));return this[_0xc5a1('0xc')](_0x2426f7);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x11a')]=function(_0x515fd5){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x11b'),_0x515fd5['label']));this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x515fd5,_0x515fd5[_0xc5a1('0x11c')]);return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('GOAL\x20%s',_0x515fd5[_0xc5a1('0x11c')]));};AGIVertices['prototype'][_0xc5a1('0x11d')]=function(_0x11340d){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x11340d[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x11340d['aws_access_key_id'])||!this[_0xc5a1('0x84')](_0x11340d[_0xc5a1('0x88')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x11e'));}if(!this[_0xc5a1('0x84')](_0x11340d[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x11f'),_0x11340d['text']));var _0x569e95=this[_0xc5a1('0x86')][_0xc5a1('0x6f')](this,_0x11340d);if(_0x569e95){this['channel'][_0xc5a1('0xa9')](util['format']('aws\x20Polly\x20%s\x20file\x20created',_0x569e95));var _0xb67cfa=this[_0xc5a1('0xe')]['streamFile'](_0x569e95);try{fs[_0xc5a1('0xff')](_0x569e95+_0xc5a1('0x100'));}catch(_0x1bc604){logger[_0xc5a1('0x28')](_0x1bc604);}return _0xb67cfa;}return this[_0xc5a1('0xe')]['error'](_0x11340d,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x120')]=function(_0xbe8c07){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x121'),_0xbe8c07[_0xc5a1('0x35')]));if(!this['isConfigured'](_0xbe8c07['aws_access_key_id'])||!this['isConfigured'](_0xbe8c07[_0xc5a1('0x88')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0xbe8c07[_0xc5a1('0x8e')])){return this['channel'][_0xc5a1('0xa9')](_0xc5a1('0x122'));}if(!this[_0xc5a1('0x84')](_0xbe8c07[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')][_0xc5a1('0xee')]=!![];this['createSquareDetailsReport'](_0xbe8c07);this[_0xc5a1('0x3f')](_0xbe8c07[_0xc5a1('0x5b')],'in','','');this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x123'),_0xbe8c07['text']));var _0x11787b=this['awsLex']['sync'](this,_0xbe8c07);if(_0x11787b){for(var _0x281f53 in _0x11787b){if(_0x11787b['hasOwnProperty'](_0x281f53)&&_[_0xc5a1('0x94')](_0x11787b[_0x281f53])){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util['format'](_0xc5a1('0x124'),_0x281f53[_0xc5a1('0x69')]()),_0x11787b[_0x281f53]);}}if(_[_0xc5a1('0x42')](_0x11787b[_0xc5a1('0x78')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x125'));}else{this[_0xc5a1('0x3f')](_0x11787b[_0xc5a1('0x78')],_0xc5a1('0xe5'),_0xc5a1('0x126'),'');return this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x127'),_0x11787b[_0xc5a1('0x78')]));}}return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0xbe8c07,_0xc5a1('0x128'));};AGIVertices['prototype'][_0xc5a1('0x129')]=function(_0x2a92a7){logger['info'](util[_0xc5a1('0x52')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x2a92a7[_0xc5a1('0x35')],_0x2a92a7[_0xc5a1('0x64')]));if(!this[_0xc5a1('0x84')](_0x2a92a7[_0xc5a1('0x90')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')]('no\x20key\x20configured');}var _0x2ffbf8='wav';var _0x923587=util[_0xc5a1('0x52')](_0xc5a1('0x12a'),FILES_PATH,rs[_0xc5a1('0x118')](0x4));var _0x75aa9a=util[_0xc5a1('0x52')](_0xc5a1('0x9c'),_0x923587,_0x2ffbf8);var _0x2d9b6d=!![];if(_0x2a92a7['beep']===_0xc5a1('0x12b')){_0x2d9b6d=![];}var _0x425d26=this[_0xc5a1('0xe')][_0xc5a1('0x12c')](_0x923587,_0x2ffbf8,_0x2a92a7[_0xc5a1('0x12d')],_0x2a92a7[_0xc5a1('0x64')],undefined,_0x2d9b6d);if(_0x425d26[_0xc5a1('0xa8')]!==-0x1){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('google\x20%s\x20file\x20created',_0x75aa9a));var _0x369f2d=this['googleASR'][_0xc5a1('0x6f')](this,_0x2a92a7,_0x75aa9a);if(_0x369f2d){for(var _0x1b4a9f in _0x369f2d){if(_0x369f2d[_0xc5a1('0x98')](_0x1b4a9f)){this[_0xc5a1('0xe')]['setVariable'](util[_0xc5a1('0x52')](_0xc5a1('0x12e'),_0x1b4a9f[_0xc5a1('0x69')]()),_0x369f2d[_0x1b4a9f]);}}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('GoogleASR\x20Result\x20%s',JSON[_0xc5a1('0x74')](_0x369f2d)));}}return _0x425d26;};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x12f')]=function(_0x3c755f){logger['info'](util['format'](_0xc5a1('0x130'),_0x3c755f[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x3c755f[_0xc5a1('0x91')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x131'));}if(!this[_0xc5a1('0x84')](_0x3c755f[_0xc5a1('0x92')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x132'));}var _0x4b7f5b='wav';var _0x49320d=util[_0xc5a1('0x52')](_0xc5a1('0x12a'),FILES_PATH,rs[_0xc5a1('0x118')](0x4));var _0x292de3=util[_0xc5a1('0x52')]('%s.%s',_0x49320d,_0x4b7f5b);var _0xfa051a=!![];if(_0x3c755f[_0xc5a1('0x133')]==='NOBEEP'){_0xfa051a=![];}var _0x13739f=this[_0xc5a1('0xe')][_0xc5a1('0x12c')](_0x49320d,_0x4b7f5b,_0x3c755f[_0xc5a1('0x12d')],_0x3c755f[_0xc5a1('0x64')],undefined,_0xfa051a);if(_0x13739f[_0xc5a1('0xa8')]!==-0x1){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x134'),_0x292de3));var _0x14d701=this[_0xc5a1('0x135')]['sync'](this,_0x3c755f,_0x292de3);if(_0x14d701){for(var _0x449ab1 in _0x14d701){if(_0x14d701['hasOwnProperty'](_0x449ab1)){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util[_0xc5a1('0x52')]('TILDE_ASR_%s',_0x449ab1[_0xc5a1('0x69')]()),_0x14d701[_0x449ab1]);}}return this[_0xc5a1('0xe')]['noop'](util[_0xc5a1('0x52')]('TildeASR\x20Result\x20%s',JSON[_0xc5a1('0x74')](_0x14d701)));}}return _0x13739f;};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x136')]=function(_0x2dce18){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0x137'),_0x2dce18[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')][_0xc5a1('0x138')](_0x2dce18[_0xc5a1('0x3a')],_0x2dce18[_0xc5a1('0x3b')],_0x2dce18[_0xc5a1('0x3c')]);};AGIVertices['prototype'][_0xc5a1('0x139')]=function(_0x34f3bf){logger[_0xc5a1('0x2b')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x34f3bf[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x34f3bf['condition'])){return this[_0xc5a1('0xe')]['error'](_0x34f3bf,_0xc5a1('0x13a'));}try{var _0x4c4667=eval(_0x34f3bf[_0xc5a1('0x13b')])?_0xc5a1('0x13c'):_0xc5a1('0x13d');this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x13e'),_0x34f3bf[_0xc5a1('0x13b')],_0x4c4667));return{'code':0xc8,'result':_0x4c4667};}catch(_0x44d814){return{'code':0xc8,'result':_0xc5a1('0x13d')};}};AGIVertices[_0xc5a1('0x11')]['gotoiftime']=function(_0x5145d9){logger[_0xc5a1('0x2b')](util['format']('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5145d9[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x5145d9[_0xc5a1('0x13f')])){return this['channel']['error'](_0x5145d9,_0xc5a1('0x140'));}var _0x958772=this[_0xc5a1('0x141')][_0xc5a1('0x6f')](this,_0x5145d9[_0xc5a1('0x13f')]);if(!_0x958772){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x5145d9,_0xc5a1('0x142'));}for(var _0x32a552=0x0;_0x32a552<_0x958772[_0xc5a1('0x9a')];_0x32a552+=0x1){var _0x3af701=this[_0xc5a1('0xe')][_0xc5a1('0xa1')](util[_0xc5a1('0x52')](_0xc5a1('0x143'),_0x958772[_0x32a552]));if(_0x3af701['result']===-0x1){return _0x3af701;}logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x144'),_0x958772[_0x32a552],_0x3af701[_0xc5a1('0x9f')]));if(_0x3af701[_0xc5a1('0x9f')]==='true'){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('IFTIME\x20%s\x20%s',_0x958772[_0x32a552],_0xc5a1('0x13c')));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('IFTIME\x20%s\x20%s',_0x958772[_0x32a552],_0xc5a1('0x13c')));return{'code':0xc8,'result':'true'};}else{logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('IFTIME\x20%s\x20%s',_0x958772[_0x32a552],_0xc5a1('0x13d')));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format'](_0xc5a1('0x144'),_0x958772[_0x32a552],_0xc5a1('0x13d')));}}return{'code':0xc8,'result':_0xc5a1('0x13d')};};AGIVertices[_0xc5a1('0x11')]['hangup']=function(_0x104db5){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x145'),_0x104db5['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0xc5a1('0x146')]=function(_0x551457){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x147'),_0x551457['label']));if(!this[_0xc5a1('0x84')](_0x551457['key'])){return this['channel']['noop']('no\x20key\x20configured');}var _0x2fa15b=_0xc5a1('0x148');var _0x5b25d1=util['format'](_0xc5a1('0x12a'),FILES_PATH,rs[_0xc5a1('0x118')](0x4));var _0x5f30e7=util['format'](_0xc5a1('0x9c'),_0x5b25d1,_0x2fa15b);var _0x103ee3=!![];if(_0x551457[_0xc5a1('0x133')]===_0xc5a1('0x12b')){_0x103ee3=![];}var _0x5107c4=this[_0xc5a1('0xe')]['recordFile'](_0x5b25d1,_0x2fa15b,_0x551457[_0xc5a1('0x12d')],_0x551457[_0xc5a1('0x64')],undefined,_0x103ee3);if(_0x5107c4[_0xc5a1('0xa8')]!==-0x1){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x149'),_0x5f30e7));var _0x568296=this[_0xc5a1('0x82')]['sync'](this,_0x551457,_0x5f30e7);if(_0x568296){for(var _0xc8344e in _0x568296){if(_0x568296[_0xc5a1('0x98')](_0xc8344e)){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](util[_0xc5a1('0x52')](_0xc5a1('0x14a'),_0xc8344e['toUpperCase']()),_0x568296[_0xc8344e]);}}return this[_0xc5a1('0xe')]['noop'](util[_0xc5a1('0x52')]('IspeechASR\x20Result\x20%s',JSON[_0xc5a1('0x74')](_0x568296)));}}return _0x5107c4;};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x14b')]=function(_0x1f8755){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x14c'),_0x1f8755['label']));if(!this[_0xc5a1('0x84')](_0x1f8755['key'])){return this['channel'][_0xc5a1('0xa9')]('no\x20key\x20configured');}if(!this[_0xc5a1('0x84')](_0x1f8755[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')]['noop'](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')]['noop'](util[_0xc5a1('0x52')](_0xc5a1('0x14d'),_0x1f8755[_0xc5a1('0x5b')]));var _0x570d87=this[_0xc5a1('0x81')][_0xc5a1('0x6f')](this,_0x1f8755);if(_0x570d87){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('ispeech\x20%s\x20file\x20created',_0x570d87));var _0x29431a=this[_0xc5a1('0xe')][_0xc5a1('0x14e')](_0x570d87,_0x1f8755[_0xc5a1('0x12d')]);try{fs[_0xc5a1('0xff')](_0x570d87+_0xc5a1('0x100'));}catch(_0x5a76fb){logger['error'](_0x5a76fb);}return _0x29431a;}return this[_0xc5a1('0xe')]['error'](_0x1f8755,_0xc5a1('0x14f'));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x150')]=function(_0x59b0e6){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x151'),_0x59b0e6[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x59b0e6[_0xc5a1('0x152')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x59b0e6,'no\x20find\x20by\x20configured');}logger[_0xc5a1('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x59b0e6['findBy']));var _0xe1c51f=this['agentLogin']['sync'](this,_0x59b0e6[_0xc5a1('0x152')]);if(_0xe1c51f){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc5a1('0xe')]['callerid'],_0x59b0e6[_0xc5a1('0x152')]));this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x59b0e6['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x59b0e6[_0xc5a1('0x152')]));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x153'),this['channel']['callerid'],_0x59b0e6[_0xc5a1('0x152')]));return{'code':0xc8,'result':_0xc5a1('0x154')};}};AGIVertices[_0xc5a1('0x11')]['logout']=function(_0x300b84){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0x155'),_0x300b84[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x300b84[_0xc5a1('0x152')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x300b84,'no\x20find\x20by\x20configured');}logger[_0xc5a1('0x2b')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xc5a1('0xe')]['callerid'],_0x300b84[_0xc5a1('0x152')]));var _0x460b5c=this[_0xc5a1('0x4e')]['sync'](this,_0x300b84['findBy']);if(_0x460b5c){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x156'),this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x300b84[_0xc5a1('0x152')]));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x156'),this['channel'][_0xc5a1('0x38')],_0x300b84[_0xc5a1('0x152')]));return{'code':0xc8,'result':_0xc5a1('0x157')};}else{logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x153'),this['channel'][_0xc5a1('0x38')],_0x300b84[_0xc5a1('0x152')]));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x300b84[_0xc5a1('0x152')]));return{'code':0xc8,'result':_0xc5a1('0x154')};}};AGIVertices[_0xc5a1('0x11')]['math']=function(_0x4ed5e7){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x158'),_0x4ed5e7['label']));if(!this[_0xc5a1('0x84')](_0x4ed5e7[_0xc5a1('0x159')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x4ed5e7,_0xc5a1('0x15a'));}this['channel'][_0xc5a1('0xa9')](util['format'](_0xc5a1('0x15b'),_0x4ed5e7['operation']));var _0x4f4ac4=eval(_0x4ed5e7[_0xc5a1('0x159')]);if(!this['isConfigured'](_0x4ed5e7[_0xc5a1('0xd4')])){return this['channel']['noop'](_0xc5a1('0xd5'));}var _0x4c6b36=this[_0xc5a1('0xa1')][_0xc5a1('0x6f')](this,_0x4ed5e7[_0xc5a1('0xd4')]);if(!_0x4c6b36){return this[_0xc5a1('0xe')]['error'](_0x4ed5e7,_0xc5a1('0x115'));}if(_['isArray'](_0x4f4ac4)){var _0x24c88b=this;_0x4f4ac4[_0xc5a1('0xd6')](function(_0x7429f1,_0x537f45){_0x24c88b['channel'][_0xc5a1('0x9d')](util[_0xc5a1('0x52')](_0xc5a1('0x15c'),_0x4c6b36,_0x537f45),_0x7429f1);});return this['channel'][_0xc5a1('0xa9')](util['format'](_0xc5a1('0x15d'),_0x4c6b36));}else{return this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0x4c6b36,_0x4f4ac4);}};AGIVertices['prototype'][_0xc5a1('0xb')]=function(_0x302619){logger['info'](util[_0xc5a1('0x52')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x302619[_0xc5a1('0x35')]));if(_0x302619[_0xc5a1('0xa3')]===0x0){return this[_0xc5a1('0xa2')](_0x302619);}_0x302619['retry']-=0x1;if(!this['isConfigured'](_0x302619[_0xc5a1('0x110')])){return this[_0xc5a1('0xe')]['error'](_0x302619,_0xc5a1('0x15e'));}var _0x1c840b=this[_0xc5a1('0x1c')][_0xc5a1('0x6f')](this,_0x302619[_0xc5a1('0x110')]);if(!_0x1c840b){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x302619,_0xc5a1('0x111'));}var _0x1c8b99=this['channel'][_0xc5a1('0x15f')](_0x1c840b,_0x302619[_0xc5a1('0x160')],_0x302619[_0xc5a1('0x161')]);var _0x59398c=_0x1c8b99[_0xc5a1('0xa8')];if(_0x1c8b99['result']===-0x1){this['createSquareDetailsReport'][_0xc5a1('0x6f')](this,_0x302619,'-1');return _0x1c8b99;}else if(_0x1c8b99[_0xc5a1('0x9f')]===_0xc5a1('0x64')){_0x1c8b99[_0xc5a1('0xa8')]=_0x1c8b99[_0xc5a1('0xa8')][_0xc5a1('0x9a')]>0x0?_0x1c8b99[_0xc5a1('0xa8')]:'t';}else if(_[_0xc5a1('0x41')](_0x1c8b99[_0xc5a1('0xa8')])){_0x1c8b99['result']='#';_0x59398c='#';}if(!this[_0xc5a1('0x84')](_0x302619[_0xc5a1('0xd4')])){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xd5'));}else{var _0x1c2dd2=this['getVariable'][_0xc5a1('0x6f')](this,_0x302619[_0xc5a1('0xd4')]);if(!_0x1c2dd2){return this[_0xc5a1('0xe')]['error'](_0x302619,_0xc5a1('0x115'));}this['channel'][_0xc5a1('0x9d')](_0x1c2dd2,_0x59398c);}this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x302619,_0x59398c);return _0x1c8b99;};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0xa9')]=function(_0x47875a){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x162'),_0x47875a[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0x47875a[_0xc5a1('0x163')]||_0x47875a['label']);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x164')]=function(_0x5b313c){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x165'),_0x5b313c[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x5b313c[_0xc5a1('0x152')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x5b313c,'no\x20find\x20by\x20configured');}logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x166'),this[_0xc5a1('0xe')]['callerid'],_0x5b313c[_0xc5a1('0x152')]));var _0x296efe=this[_0xc5a1('0x167')][_0xc5a1('0x6f')](this,_0x5b313c['pause_id']);var _0x4ab71c=this['agentPause'][_0xc5a1('0x6f')](this,_0x5b313c[_0xc5a1('0x152')],_0x296efe);if(_0x4ab71c){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x156'),this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x5b313c['findBy']));this['channel']['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x5b313c['findBy']));return{'code':0xc8,'result':_0xc5a1('0x157')};}else{logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x5b313c[_0xc5a1('0x152')]));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x5b313c[_0xc5a1('0x152')]));return{'code':0xc8,'result':_0xc5a1('0x154')};}};AGIVertices['prototype'][_0xc5a1('0x168')]=function(_0x1bf384){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x169'),_0x1bf384['label']));if(!this[_0xc5a1('0x84')](_0x1bf384[_0xc5a1('0x110')])){return this['channel']['error'](_0x1bf384,_0xc5a1('0x15e'));}var _0x38f152=this[_0xc5a1('0x1c')][_0xc5a1('0x6f')](this,_0x1bf384[_0xc5a1('0x110')]);if(!_0x38f152){return this[_0xc5a1('0xe')]['error'](_0x1bf384,'no\x20file\x20audio\x20found');}var _0x411bc9=this[_0xc5a1('0xe')][_0xc5a1('0x55')]('PLAYBACK',[_0x38f152,_0x1bf384[_0xc5a1('0x10d')]]);if(_0x411bc9['result']===-0x1){return _0x411bc9;}return this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x38f152));};AGIVertices[_0xc5a1('0x11')]['queue']=function(_0x1c5bfa){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x1c5bfa[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x1c5bfa[_0xc5a1('0x16a')])){return this[_0xc5a1('0xe')]['error'](_0x1c5bfa,'no\x20queue\x20selected');}var _0x2b12bf='';var _0x445e0f=parseInt(_0x1c5bfa[_0xc5a1('0x16a')],0xa);if(isNaN(_0x445e0f)){_0x2b12bf=_0x1c5bfa['queue_id'];}else{_0x2b12bf=this[_0xc5a1('0x16b')][_0xc5a1('0x6f')](this,_0x1c5bfa[_0xc5a1('0x16a')]);if(!_0x2b12bf){return this['channel']['error'](_0x1c5bfa,'no\x20queue\x20found');}}var _0x97d987='';if(this[_0xc5a1('0x84')](_0x1c5bfa[_0xc5a1('0x110')])){var _0x5fc773=this[_0xc5a1('0x1c')][_0xc5a1('0x6f')](this,_0x1c5bfa['file_id']);if(_0x5fc773){_0x97d987=_0x5fc773;}}this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x1c5bfa,_0x2b12bf);if(_0x1c5bfa['opts']['indexOf']('x')<0x0){_0x1c5bfa['opts']+='x';}if(_0x1c5bfa[_0xc5a1('0x10d')][_0xc5a1('0x16c')]('X')<0x0){_0x1c5bfa[_0xc5a1('0x10d')]+='X';}this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0xc5a1('0x16d'),_0x2b12bf?_0x2b12bf[_0xc5a1('0x16e')]():'');var _0x53359b=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0xc5a1('0x16f'),[_0x2b12bf,_0x1c5bfa['opts'],_0x1c5bfa[_0xc5a1('0x72')],_0x97d987,_0x1c5bfa[_0xc5a1('0x64')],_0x1c5bfa['agi'],_0x1c5bfa['macro'],_0x1c5bfa[_0xc5a1('0x170')],'',_0x1c5bfa[_0xc5a1('0x171')]]);if(_0x53359b[_0xc5a1('0xa8')]===-0x1){return _0x53359b;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xc5'),'QUEUE',_0x2b12bf));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x172')]=function(_0x14c275){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x14c275[_0xc5a1('0x35')]));var _0x36d307=_0x14c275[_0xc5a1('0x173')]||_0xc5a1('0x148');var _0x286516=util[_0xc5a1('0x52')](_0xc5a1('0x174'),this[_0xc5a1('0xe')][_0xc5a1('0x34')],rs[_0xc5a1('0x118')](0x5));var _0x591d3e=util[_0xc5a1('0x52')]('%s/recordings/%s.%s',FILES_PATH,_0x286516,_0x36d307);var _0x2c5377=util['format'](_0xc5a1('0x12a'),FILES_PATH,_0x286516);this[_0xc5a1('0x37')]['sync'](this,_0x14c275,_0x286516,_0x591d3e);this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0xc5a1('0x175'),_0x286516);logger[_0xc5a1('0x2b')](_0xc5a1('0x176'),_0x2c5377,_0x36d307,_0x14c275[_0xc5a1('0x177')],_0x14c275[_0xc5a1('0x64')]);return this[_0xc5a1('0xe')][_0xc5a1('0x12c')](_0x2c5377,_0x36d307,_0x14c275['escape_digits'],_0x14c275['timeout'],undefined,!![]);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x178')]=function(_0x52fbaf){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x179'),_0x52fbaf[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x52fbaf[_0xc5a1('0x72')])){return this[_0xc5a1('0xe')]['noop'](_0xc5a1('0x17a'));}var _0x14e211=this['restAPI'][_0xc5a1('0x6f')](this,_0x52fbaf);logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x17b'),util[_0xc5a1('0x17c')](_0x14e211,{'showHidden':![],'depth':null})));if(!this[_0xc5a1('0x84')](_0x52fbaf[_0xc5a1('0xd4')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x17d'));}var _0x4e34ec=this['getVariable'][_0xc5a1('0x6f')](this,_0x52fbaf[_0xc5a1('0xd4')]);if(!_0x4e34ec){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x52fbaf,'no\x20variable\x20found');}this[_0xc5a1('0xe')]['setVariable'](util[_0xc5a1('0x52')](_0xc5a1('0x17e'),_0x4e34ec),_0x14e211[_0xc5a1('0x76')]?_0x14e211[_0xc5a1('0x76')]:'200');this[_0xc5a1('0xe')]['setVariable'](util[_0xc5a1('0x52')](_0xc5a1('0x17f'),_0x4e34ec),_0x14e211[_0xc5a1('0x77')]?_0x14e211[_0xc5a1('0x77')]:'OK');if(_0x14e211['body']){try{this['saveRestApiResult'](_0x14e211[_0xc5a1('0x6a')],_0x4e34ec);}catch(_0x18b9e3){logger['error'](util[_0xc5a1('0x52')](_0xc5a1('0x180'),_0x4e34ec));}}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format'](_0xc5a1('0xd9'),_0x4e34ec));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x181')]=function(_0x1fe256){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1fe256[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')][_0xc5a1('0x182')](_0x1fe256[_0xc5a1('0x183')][_0xc5a1('0x57')](/\s+/g,''),_0x1fe256[_0xc5a1('0x177')]);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x184')]=function(_0x13efc5){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0x185'),_0x13efc5[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')][_0xc5a1('0x186')](_0x13efc5['number'][_0xc5a1('0x57')](/\s+/g,''),_0x13efc5[_0xc5a1('0x177')]);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x187')]=function(_0x1ee79a){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x188'),_0x1ee79a[_0xc5a1('0x35')]));return this[_0xc5a1('0xe')][_0xc5a1('0x189')](_0x1ee79a[_0xc5a1('0x5b')],_0x1ee79a[_0xc5a1('0x177')]);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x18a')]=function(_0x2ada32){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x2ada32[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x2ada32['account_id'])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x18b'));}var _0x36ce8d=this['getMailAccount'][_0xc5a1('0x6f')](this,_0x2ada32[_0xc5a1('0x18c')]);if(!_0x36ce8d||!_0x36ce8d[_0xc5a1('0x18d')]){return this['channel'][_0xc5a1('0x28')](_0x2ada32,_0xc5a1('0x18e'));}var _0x357a76={'from':util[_0xc5a1('0x52')](_0xc5a1('0x18f'),_0x36ce8d['name'],_0x36ce8d['email']||_0x36ce8d[_0xc5a1('0x18d')][_0xc5a1('0x190')]),'to':_0x2ada32['to']||'','cc':_0x2ada32['cc']||'','bcc':_0x2ada32[_0xc5a1('0x191')]||'','subject':_0x2ada32[_0xc5a1('0x192')],'html':_0x2ada32['text'],'text':_0x2ada32[_0xc5a1('0x5b')]};if(this['isConfigured'](_0x2ada32[_0xc5a1('0x193')])){}logger[_0xc5a1('0xdb')]('sendMail\x20message',JSON['stringify'](_0x357a76));this['createSquareDetailsReport'][_0xc5a1('0x6f')](this,_0x2ada32,_0x2ada32[_0xc5a1('0x18c')]);this[_0xc5a1('0xe')]['noop'](util[_0xc5a1('0x52')](_0xc5a1('0x194'),_0x36ce8d[_0xc5a1('0x13')]));this[_0xc5a1('0x20')][_0xc5a1('0x6f')](this,_0x36ce8d[_0xc5a1('0x195')],_0x357a76);return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x196'));};AGIVertices['prototype']['sendFax']=function(_0x43c119){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x197'),_0x43c119['label']));return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x198'));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x199')]=function(_0x27f701){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x19a'),_0x27f701[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x27f701['sms_account_id'])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x19b'));}var _0x355970=this[_0xc5a1('0x30')][_0xc5a1('0x6f')](this,_0x27f701[_0xc5a1('0x19c')]);if(!_0x355970){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x27f701,_0xc5a1('0x19d'));}var _0x36f22b={'body':_0x27f701[_0xc5a1('0x19e')],'phone':_0x27f701['to']||'','SmsAccountId':_0x355970['id']};logger[_0xc5a1('0xdb')](_0xc5a1('0x19f'),JSON[_0xc5a1('0x74')](_0x36f22b));this[_0xc5a1('0x33')][_0xc5a1('0x6f')](this,_0x27f701,_0x27f701[_0xc5a1('0x19c')]);this['channel'][_0xc5a1('0xa9')](util['format'](_0xc5a1('0x1a0'),_0x355970[_0xc5a1('0x13')]));this[_0xc5a1('0x32')]['sync'](this,_0x36f22b);return this[_0xc5a1('0xe')][_0xc5a1('0xa9')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1a1')]=function(_0xe186e4){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0x1a2'),_0xe186e4[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0xe186e4[_0xc5a1('0xd4')])){return this[_0xc5a1('0xe')]['error'](_0xe186e4,_0xc5a1('0x1a3'));}var _0x55bf49=this[_0xc5a1('0xa1')][_0xc5a1('0x6f')](this,_0xe186e4[_0xc5a1('0xd4')]);if(!_0x55bf49){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0xe186e4,_0xc5a1('0x115'));}return this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0x55bf49,_0xe186e4[_0xc5a1('0x1a4')]);};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1a5')]=function(_0x5e34f7){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x1a6'),_0x5e34f7[_0xc5a1('0x35')]));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x1a7'));if(_0x5e34f7['answer']===_0xc5a1('0x1a8')){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x1a9'));return this[_0xc5a1('0xe')][_0xc5a1('0xbc')]();}return this['channel'][_0xc5a1('0xa9')](_0xc5a1('0x1aa'));};AGIVertices[_0xc5a1('0x11')]['subproject']=function(_0x2a8e8e){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x1ab'),_0x2a8e8e[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x2a8e8e[_0xc5a1('0x1ac')])){return this[_0xc5a1('0xe')]['error'](_0x2a8e8e,_0xc5a1('0x1ad'));}var _0x46dff4=this['getSquareProject'][_0xc5a1('0x6f')](this,_0x2a8e8e[_0xc5a1('0x1ac')]);if(!this['isConfigured'](_0x46dff4)){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x2a8e8e,util[_0xc5a1('0x52')](_0xc5a1('0x1ae'),_0x2a8e8e[_0xc5a1('0x1ac')]));}if(_0x46dff4===this[_0xc5a1('0xe')]['arg_1']){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x2a8e8e,_0xc5a1('0x1af'));}this['createSquareDetailsReport'][_0xc5a1('0x6f')](this,_0x2a8e8e,_0x46dff4);var _0x36d771=this[_0xc5a1('0xe')]['exec'](_0xc5a1('0x1b0'),util[_0xc5a1('0x52')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xc5a1('0x6')][_0xc5a1('0x1b1')]||_0xc5a1('0x1b2'),_0x46dff4,this[_0xc5a1('0xe')][_0xc5a1('0x36')]));if(_0x36d771[_0xc5a1('0xa8')]===-0x1){return _0x36d771;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util['format'](_0xc5a1('0xc5'),'AGI',_0x46dff4));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1b3')]=function(_0x1253c3){logger['info'](util[_0xc5a1('0x52')](_0xc5a1('0x1b4'),_0x1253c3[_0xc5a1('0x35')]));var _0x45c002=this[_0xc5a1('0x1b5')][_0xc5a1('0x6f')](this,_0x1253c3[_0xc5a1('0xb8')]);this['createSquareDetailsReport'][_0xc5a1('0x6f')](this,_0x1253c3,_0x1253c3[_0xc5a1('0xb8')]);if(this[_0xc5a1('0x84')](_0x1253c3[_0xc5a1('0xd4')])){var _0x5b64dc=this[_0xc5a1('0xa1')][_0xc5a1('0x6f')](this,_0x1253c3['variable_id']);if(_0x5b64dc){this[_0xc5a1('0xe')][_0xc5a1('0x9d')](_0x5b64dc,_0x45c002);return this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x1b6'),_0x1253c3[_0xc5a1('0xb8')],_0x5b64dc));}}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x1b7'),_0x1253c3['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x45d4e6){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x1b8'),_0x45d4e6['label']));_0x45d4e6[_0xc5a1('0x5b')]=_0x45d4e6[_0xc5a1('0x5b')][_0xc5a1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x45d4e6[_0xc5a1('0x59')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0x1b9'));}if(!this[_0xc5a1('0x84')](_0x45d4e6[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x45d4e6['text']));var _0x605f9a=this[_0xc5a1('0x58')]['sync'](this,_0x45d4e6);if(_0x605f9a){this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x1ba'),_0x605f9a));var _0x300b5b=this[_0xc5a1('0xe')][_0xc5a1('0x14e')](_0x605f9a);try{fs[_0xc5a1('0xff')](_0x605f9a+'.wav');}catch(_0x1239fb){logger[_0xc5a1('0x28')](_0x1239fb);}return _0x300b5b;}return this[_0xc5a1('0xe')]['error'](_0x45d4e6,_0xc5a1('0x1bb'));};AGIVertices['prototype'][_0xc5a1('0x1bc')]=function(_0x352b7d){logger['info'](util['format'](_0xc5a1('0x1bd'),_0x352b7d[_0xc5a1('0x35')]));_0x352b7d['text']=_0x352b7d[_0xc5a1('0x5b')][_0xc5a1('0x57')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xc5a1('0x84')](_0x352b7d[_0xc5a1('0x5b')])){return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](_0xc5a1('0xa6'));}this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x1be'),_0x352b7d[_0xc5a1('0x5b')]));var _0x1f8520=this[_0xc5a1('0x60')][_0xc5a1('0x6f')](this,_0x352b7d);if(_0x1f8520){this['channel'][_0xc5a1('0xa9')](util['format'](_0xc5a1('0x1bf'),_0x1f8520));var _0x3db7e3=this[_0xc5a1('0xe')][_0xc5a1('0x14e')](_0x1f8520);try{fs[_0xc5a1('0xff')](_0x1f8520+_0xc5a1('0x100'));}catch(_0x1fdc4f){logger[_0xc5a1('0x28')](_0x1fdc4f);}return _0x3db7e3;}return this[_0xc5a1('0xe')]['error'](_0x352b7d,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1c0')]=function(_0x40684c){logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x1c1'),_0x40684c[_0xc5a1('0x35')]));if(!this[_0xc5a1('0x84')](_0x40684c[_0xc5a1('0x152')])){return this['channel']['error'](_0x40684c,_0xc5a1('0x1c2'));}logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x166'),this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x40684c['findBy']));var _0x421a6f=this['agentUnpause'][_0xc5a1('0x6f')](this,_0x40684c[_0xc5a1('0x152')]);if(_0x421a6f){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x156'),this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x40684c['findBy']));this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x156'),this['channel'][_0xc5a1('0x38')],_0x40684c[_0xc5a1('0x152')]));return{'code':0xc8,'result':_0xc5a1('0x157')};}else{logger[_0xc5a1('0x2b')](util['format'](_0xc5a1('0x153'),this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x40684c[_0xc5a1('0x152')]));this['channel'][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0x153'),this[_0xc5a1('0xe')][_0xc5a1('0x38')],_0x40684c[_0xc5a1('0x152')]));return{'code':0xc8,'result':_0xc5a1('0x154')};}};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1c3')]=function(_0x52a588){logger[_0xc5a1('0x2b')](util[_0xc5a1('0x52')](_0xc5a1('0x1c4'),_0x52a588[_0xc5a1('0x35')]));var _0x35c778=this[_0xc5a1('0xe')][_0xc5a1('0x55')](_0xc5a1('0x1c5'),[_0x52a588[_0xc5a1('0x1c6')],_0x52a588[_0xc5a1('0x7a')]]);if(_0x35c778[_0xc5a1('0xa8')]===-0x1){return _0x35c778;}return this[_0xc5a1('0xe')][_0xc5a1('0xa9')](util[_0xc5a1('0x52')](_0xc5a1('0xc5'),'VOICEMAIL',_0x52a588[_0xc5a1('0x1c6')]));};AGIVertices[_0xc5a1('0x11')][_0xc5a1('0x1c7')]=function(_0x4b5409){logger['info'](util[_0xc5a1('0x52')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4b5409[_0xc5a1('0x35')]));if(!this['isConfigured'](_0x4b5409[_0xc5a1('0xd4')])){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x4b5409,_0xc5a1('0x1a3'));}var _0x17a984=this[_0xc5a1('0xa1')][_0xc5a1('0x6f')](this,_0x4b5409[_0xc5a1('0xd4')]);if(!_0x17a984){return this[_0xc5a1('0xe')][_0xc5a1('0x28')](_0x4b5409,_0xc5a1('0x115'));}var _0x34b6ea=this[_0xc5a1('0xe')][_0xc5a1('0xa1')](_0x17a984);return{'code':0xc8,'result':_0x34b6ea[_0xc5a1('0x9f')]?_0x34b6ea[_0xc5a1('0x9f')]:'-'};};String['prototype'][_0xc5a1('0x1c8')]=function(_0xa78376,_0x358f75){return this['split'](_0xa78376)[_0xc5a1('0x1c9')](_0x358f75);};module[_0xc5a1('0x1ca')]=AGIVertices; \ No newline at end of file +var _0x3c66=['beep','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','isArray','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','Enter\x20in\x20NOOP\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','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','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Answer','Skipped\x20Answer','subproject','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','agi://%s/square,\x22%s\x22,\x22%s\x22','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','../../config/environment/shared','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','getVoiceQueue','getVoiceQueueById','name','getSquareProjectById','catch','dsn','getUser','getUserById','then','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','arg_1','createSquareRecording','uniqueid','calleridname','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback','toString','callback_priority','agentPause','agent','agentUnpause','callerid','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','text','google_tts_language','restAPI','method','timeout','number','includes','PUT','toUpperCase','body','rawBody','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','uri','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceAllVariables','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','recursiveNodeIndex','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','no\x20list\x20selected','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','sync','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','speech','Dialogflow\x20is\x20unreachable','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','private_key','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','Executed\x20command\x20%s','Enter\x20in\x20FINALLY\x20(%s)\x20block','finally','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','generate'];(function(_0x239b99,_0x698032){var _0xea4e1c=function(_0x1aba6d){while(--_0x1aba6d){_0x239b99['push'](_0x239b99['shift']());}};_0xea4e1c(++_0x698032);}(_0x3c66,0x8b));var _0x63c6=function(_0xff56be,_0x37da1f){_0xff56be=_0xff56be-0x0;var _0xd46ccd=_0x3c66[_0xff56be];return _0xd46ccd;};'use strict';var fs=require('fs');var util=require('util');var _=require('lodash');var sh=require('shelljs');var odbc=require(_0x63c6('0x0'))();var rs=require(_0x63c6('0x1'));var moment=require(_0x63c6('0x2'));var Mustache=require(_0x63c6('0x3'));var rp=require(_0x63c6('0x4'));var logger=require(_0x63c6('0x5'))(_0x63c6('0x6'));var config=require(_0x63c6('0x7'));var shared=require(_0x63c6('0x8'));var scripts=require(_0x63c6('0x9'));var FILES_PATH=_0x63c6('0xa');var recursiveMapAttributes=[_0x63c6('0xb'),'rawBody'];var verticesWithRetry=[_0x63c6('0xc'),'getdigits',_0x63c6('0xd')];var AGIVertices=function(_0x3445a3,_0x50bd4f,_0x386110){this[_0x63c6('0xe')]=_0x3445a3;this[_0x63c6('0xf')]=_0x50bd4f;this[_0x63c6('0x10')]=_0x386110;};AGIVertices[_0x63c6('0x11')][_0x63c6('0x12')]=function(_0x541d40,_0x1b7547){this[_0x63c6('0xf')][_0x63c6('0x13')](_0x541d40)['then'](function(_0x4c58ee){_0x1b7547(null,_0x4c58ee?_0x4c58ee['name']:![]);})['catch'](function(_0x59373e){_0x1b7547(_0x59373e);});};AGIVertices['prototype'][_0x63c6('0x14')]=function(_0x69911c,_0x1cd490){this[_0x63c6('0xf')][_0x63c6('0x15')](_0x69911c)['then'](function(_0x286eb8){_0x1cd490(null,_0x286eb8?_0x286eb8[_0x63c6('0x16')]:![]);})['catch'](function(_0x2b835a){_0x1cd490(_0x2b835a);});};AGIVertices['prototype']['getSquareProject']=function(_0x1abfbd,_0x571022){this[_0x63c6('0xf')][_0x63c6('0x17')](_0x1abfbd)['then'](function(_0xd5a3b5){_0x571022(null,_0xd5a3b5?_0xd5a3b5[_0x63c6('0x16')]:![]);})[_0x63c6('0x18')](function(_0x35ee57){_0x571022(_0x35ee57);});};AGIVertices[_0x63c6('0x11')]['getSquareOdbc']=function(_0x55a992,_0x491c80){this[_0x63c6('0xf')]['getSquareOdbcById'](_0x55a992)['then'](function(_0xb7ba4f){_0x491c80(null,_0xb7ba4f?_0xb7ba4f[_0x63c6('0x19')]:![]);})['catch'](function(_0x41db9a){_0x491c80(_0x41db9a);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1a')]=function(_0x3f9360,_0x430a6e){this['rpc'][_0x63c6('0x1b')](_0x3f9360)[_0x63c6('0x1c')](function(_0x19fd72){_0x430a6e(null,_0x19fd72?_0x19fd72[_0x63c6('0x16')]:![]);})[_0x63c6('0x18')](function(_0x2d72c9){_0x430a6e(_0x2d72c9);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1d')]=function(_0x4c0d24,_0x336d8a){this[_0x63c6('0xf')][_0x63c6('0x1e')](_0x4c0d24)['then'](function(_0x52f9b1){_0x336d8a(null,_0x52f9b1?_0x52f9b1[_0x63c6('0x16')]:![]);})['catch'](function(_0x2a0ccf){_0x336d8a(_0x2a0ccf);});};AGIVertices['prototype']['getSound']=function(_0x34ce41,_0x154e31){var _0x147c50=this;this['rpc'][_0x63c6('0x1f')](_0x34ce41)['then'](function(_0x1c6a20){_0x154e31(null,_0x1c6a20?_0x147c50[_0x63c6('0x20')](_0x1c6a20[_0x63c6('0x21')]):![]);})[_0x63c6('0x18')](function(_0xe77aa8){_0x154e31(_0xe77aa8);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x22')]=function(_0xccd510,_0x5896cf){this[_0x63c6('0xf')][_0x63c6('0x23')](_0xccd510)[_0x63c6('0x1c')](function(_0x1a5bb6){_0x5896cf(null,_0x1a5bb6?_0x1a5bb6:![]);})['catch'](function(_0xff8be4){_0x5896cf(_0xff8be4);});};AGIVertices['prototype']['sendMailMessage']=function(_0x35733d,_0x477527,_0x26285f){this[_0x63c6('0x10')][_0x63c6('0x24')](_0x35733d,_0x477527)[_0x63c6('0x1c')](function(){_0x26285f(null);})[_0x63c6('0x18')](function(_0x54a5e7){_0x26285f(_0x54a5e7);});};AGIVertices[_0x63c6('0x11')]['getIntervals']=function(_0x394451,_0x49632a){this[_0x63c6('0xf')]['getIntervalById'](_0x394451)[_0x63c6('0x1c')](function(_0x5f043e){if(_0x5f043e){if(_0x5f043e['IntervalId']){_0x49632a(null,[_0x5f043e[_0x63c6('0x25')]]);}else{_0x49632a(null,_[_0x63c6('0x26')](_0x5f043e[_0x63c6('0x27')],'interval'));}}else{_0x49632a(null,![]);}})[_0x63c6('0x18')](function(_0x1d438f){_0x49632a(_0x1d438f);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x20')]=function(_0x4930fc){return util[_0x63c6('0x28')](_0x63c6('0x29'),FILES_PATH,_0x4930fc);};AGIVertices['prototype'][_0x63c6('0x2a')]=function(_0x413995,_0x218200,_0x26d94d){odbc[_0x63c6('0x2b')](_0x413995,function(_0x1827d9){if(_0x1827d9){logger[_0x63c6('0x2c')](_0x63c6('0x2d'),_0x1827d9);_0x26d94d(_0x1827d9);}else{logger[_0x63c6('0x2e')](_0x63c6('0x2f'));odbc[_0x63c6('0x30')](_0x218200,function(_0x437b7f,_0x48204d){if(_0x437b7f){logger[_0x63c6('0x2e')]('Error\x20executing\x20query\x20%s',_0x218200);_0x26d94d(_0x437b7f);}else{logger[_0x63c6('0x2e')](_0x63c6('0x31'),_0x218200);odbc['close'](function(_0x589753){if(_0x589753){logger[_0x63c6('0x2c')](_0x63c6('0x32'),_0x589753);}_0x26d94d(null,_0x48204d);});}});}});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x33')]=function(_0x357fd5,_0x4b6ca6){this[_0x63c6('0xf')]['getSmsAccountById'](_0x357fd5)['then'](function(_0x267b5c){_0x4b6ca6(null,_0x267b5c?_0x267b5c:![]);})[_0x63c6('0x18')](function(_0x51e0be){_0x4b6ca6(_0x51e0be);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x34')]=function(_0x2f1562,_0x36bc5e){this[_0x63c6('0xf')][_0x63c6('0x34')](_0x2f1562)[_0x63c6('0x1c')](function(_0x137023){_0x36bc5e(null,_0x137023);})[_0x63c6('0x18')](function(_0x1a83c9){_0x36bc5e(_0x1a83c9);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x35')]=function(_0x1ebd6b,_0x6b1ec8,_0xedd052){this[_0x63c6('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x63c6('0xe')]['uniqueid'],'node':_0x1ebd6b['label'],'application':_0x1ebd6b['agicommand'],'data':_0x6b1ec8||null,'project_name':this['channel'][_0x63c6('0x36')],'callerid':this[_0x63c6('0xe')]['callerid']})[_0x63c6('0x1c')](function(_0x50fe19){if(_0xedd052){_0xedd052(null,_0x50fe19);}})[_0x63c6('0x18')](function(_0x25cb9e){if(_0xedd052){_0xedd052(_0x25cb9e);}});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x37')]=function(_0x5d69ea,_0x23ed4a,_0x41e4c2,_0x2afe29){this[_0x63c6('0xf')][_0x63c6('0x37')]({'uniqueid':this[_0x63c6('0xe')][_0x63c6('0x38')],'callerid':this[_0x63c6('0xe')]['callerid'],'calleridname':this[_0x63c6('0xe')][_0x63c6('0x39')],'context':this[_0x63c6('0xe')]['context'],'extension':this[_0x63c6('0xe')][_0x63c6('0x3a')],'priority':this[_0x63c6('0xe')][_0x63c6('0x3b')],'accountcode':this[_0x63c6('0xe')]['accountcode'],'dnid':this[_0x63c6('0xe')][_0x63c6('0x3c')],'projectName':this['channel'][_0x63c6('0x36')],'saveName':_0x23ed4a,'filename':_0x5d69ea[_0x63c6('0x3d')]||_0x23ed4a,'savePath':_0x41e4c2})[_0x63c6('0x1c')](function(_0x1bd464){_0x2afe29(null,_0x1bd464);})[_0x63c6('0x18')](function(_0x3871b9){_0x2afe29(_0x3871b9);});};AGIVertices['prototype'][_0x63c6('0x3e')]=function(_0xfc2918,_0x224f27,_0xdf4f43,_0x5c8fc9,_0xab96b7){this[_0x63c6('0xf')]['createSquareMessage']({'uniqueid':this[_0x63c6('0xe')][_0x63c6('0x38')],'body':_0xfc2918,'direction':_0x224f27,'providerName':_0xdf4f43,'providerResponse':_0x5c8fc9})['then'](function(_0x5892ac){if(_0xab96b7){_0xab96b7(null,_0x5892ac);}})[_0x63c6('0x18')](function(_0x2b4823){if(_0xab96b7){_0xab96b7(_0x2b4823);}});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x3f')]=function(_0x4b00a4,_0x4fbdef){this[_0x63c6('0xf')]['createCmContact']({'firstName':_[_0x63c6('0x40')](_0x4b00a4[_0x63c6('0x16')])||_[_0x63c6('0x41')](_0x4b00a4[_0x63c6('0x16')])?_0x63c6('0x42')+Math['random']():_0x4b00a4[_0x63c6('0x16')],'lastName':_[_0x63c6('0x40')](_0x4b00a4[_0x63c6('0x43')])||_['isNil'](_0x4b00a4['lastName'])?null:_0x4b00a4[_0x63c6('0x43')],'phone':_0x4b00a4[_0x63c6('0x44')],'ListId':_0x4b00a4[_0x63c6('0x45')],'scheduledat':_0x4b00a4[_0x63c6('0x46')],'callbackUniqueid':this[_0x63c6('0xe')][_0x63c6('0x38')],'tags':_0x63c6('0x47'),'description':'Callback\x20scheduled\x20at\x20'+_0x4b00a4[_0x63c6('0x46')][_0x63c6('0x48')](),'priority':_0x4b00a4[_0x63c6('0x49')]})[_0x63c6('0x1c')](function(_0x1e7f87){_0x4fbdef(null,_0x1e7f87);})[_0x63c6('0x18')](function(_0x1d304c){_0x4fbdef(_0x1d304c);});};AGIVertices['prototype']['getPause']=function(_0x9c5298,_0x13d834){this[_0x63c6('0xf')]['getPauseById'](_0x9c5298)[_0x63c6('0x1c')](function(_0x18fb7a){_0x13d834(null,_0x18fb7a?_0x18fb7a[_0x63c6('0x16')]:![]);})[_0x63c6('0x18')](function(_0x26fbc5){_0x13d834(_0x26fbc5);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x4a')]=function(_0x182324,_0xa5e8b4,_0x21380d){var _0x575bcd={'role':_0x63c6('0x4b')};_0x575bcd[_0x182324]=this['channel']['callerid'];this[_0x63c6('0xf')]['agentPause'](_0x575bcd,_0xa5e8b4,this[_0x63c6('0xe')][_0x63c6('0x38')])[_0x63c6('0x1c')](function(_0x1fb7e3){_0x21380d(null,_['isNil'](_0x1fb7e3)?![]:!![]);})[_0x63c6('0x18')](function(_0xc2fa85){logger['error'](_0xc2fa85);_0x21380d(null,![]);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x4c')]=function(_0x4beacd,_0x450577){var _0x2c13fe={'role':'agent'};_0x2c13fe[_0x4beacd]=this['channel'][_0x63c6('0x4d')];this[_0x63c6('0xf')][_0x63c6('0x4c')](_0x2c13fe)['then'](function(_0x45372a){_0x450577(null,_['isNil'](_0x45372a)?![]:!![]);})[_0x63c6('0x18')](function(_0xa54384){logger[_0x63c6('0x2c')](_0xa54384);_0x450577(null,![]);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x4e')]=function(_0x41fec0,_0x56636d){var _0x5b4a1b={'role':_0x63c6('0x4b')};_0x5b4a1b[_0x41fec0]=this[_0x63c6('0xe')]['callerid'];this[_0x63c6('0xf')]['agentLogout'](_0x5b4a1b)[_0x63c6('0x1c')](function(_0xbebffa){_0x56636d(null,_[_0x63c6('0x41')](_0xbebffa)?![]:!![]);})[_0x63c6('0x18')](function(_0xca620e){logger['error'](_0xca620e);_0x56636d(null,![]);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x4f')]=function(_0x5afa4a,_0x14d6dd){var _0x11afc9={'role':_0x63c6('0x4b')};_0x11afc9[_0x5afa4a]=this[_0x63c6('0xe')]['callerid'];var _0x91e1f=_0x5afa4a!='internal'?util[_0x63c6('0x28')](_0x63c6('0x50'),_0x63c6('0x51'),this[_0x63c6('0xe')][_0x63c6('0x4d')]):undefined;this[_0x63c6('0xf')][_0x63c6('0x4f')](_0x11afc9,_0x91e1f)[_0x63c6('0x1c')](function(_0x568f0c){_0x14d6dd(null,_[_0x63c6('0x41')](_0x568f0c)?![]:!![]);})[_0x63c6('0x18')](function(_0x426653){logger['error'](_0x426653);_0x14d6dd(null,![]);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x52')]=function(_0x4ff95c,_0xccc05d){sh[_0x63c6('0x53')](_[_0x63c6('0x54')](_0x4ff95c),function(_0x3a5f46,_0x598bbf){var _0x472bb1=_0x598bbf[_0x63c6('0x55')](/(\r\n|\n|\r)/gm,'');_0xccc05d(null,_0x472bb1);});};AGIVertices[_0x63c6('0x11')]['googleCloudTTS']=function(_0x4f6c0d,_0x102796){scripts[_0x63c6('0x56')](_0x4f6c0d[_0x63c6('0x57')],_0x4f6c0d[_0x63c6('0x58')]||'text',_0x4f6c0d['text'],_0x4f6c0d[_0x63c6('0x59')]||_0x63c6('0x5a'),_0x4f6c0d[_0x63c6('0x5b')]||_0x63c6('0x5c'),_0x4f6c0d[_0x63c6('0x5d')]||_0x63c6('0x5e'))['then'](function(_0x5b21eb){_0x102796(null,_0x5b21eb);})[_0x63c6('0x18')](function(_0x31c2ae){_0x102796(_0x31c2ae);});};AGIVertices[_0x63c6('0x11')]['googleTTS']=function(_0x1e0fd2,_0x29d4aa){scripts['googleTTS'](_0x1e0fd2[_0x63c6('0x5f')],_0x1e0fd2[_0x63c6('0x60')]||'en',0x1)[_0x63c6('0x1c')](function(_0x3847c6){_0x29d4aa(null,_0x3847c6);})[_0x63c6('0x18')](function(_0x58b5b9){_0x29d4aa(_0x58b5b9);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x61')]=function(_0x301b28,_0x561045){var _0xe82035={'uri':_0x301b28['url'],'method':_0x301b28[_0x63c6('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x301b28[_0x63c6('0x63')])===_0x63c6('0x64')&&parseInt(_0x301b28[_0x63c6('0x63')])>=0x1?parseInt(_0x301b28['timeout'])*0x3e8:0x5*0x3e8};if(_[_0x63c6('0x65')](['POST',_0x63c6('0x66')],_0xe82035[_0x63c6('0x62')][_0x63c6('0x67')]())){try{_0xe82035[_0x63c6('0x68')]=_0x301b28[_0x63c6('0x69')]?JSON[_0x63c6('0x6a')](_0x301b28[_0x63c6('0x69')]):{};}catch(_0xc11a7c){logger[_0x63c6('0x2c')](_0x63c6('0x6b'),_0xc11a7c);}}try{_0xe82035[_0x63c6('0x6c')]=_0x301b28[_0x63c6('0xb')]?JSON[_0x63c6('0x6a')](_0x301b28[_0x63c6('0xb')]):{};}catch(_0x10a86b){logger[_0x63c6('0x2c')](_0x63c6('0x6d'),_0x10a86b);}if(_0x301b28[_0x63c6('0x6e')]){try{var _0xc95601=require(_0x301b28[_0x63c6('0x6e')])['sync'](this,_0xe82035);_0xe82035[_0x63c6('0x6f')]=Mustache[_0x63c6('0x70')](_0x301b28[_0x63c6('0x71')],_0xc95601,{},['$$','$$']);if(_0xe82035[_0x63c6('0x6c')]){_0xe82035[_0x63c6('0x6c')]=JSON[_0x63c6('0x6a')](Mustache[_0x63c6('0x70')](JSON[_0x63c6('0x72')](_0xe82035[_0x63c6('0x6c')]),_0xc95601,{},['$$','$$']));}if(_0xe82035[_0x63c6('0x68')]){_0xe82035['body']=JSON['parse'](Mustache[_0x63c6('0x70')](JSON[_0x63c6('0x72')](_0xe82035[_0x63c6('0x68')]),_0xc95601,{},['$$','$$']));}}catch(_0x107698){logger[_0x63c6('0x2c')](_0x63c6('0x73'),_0x107698);}}rp(_0xe82035)[_0x63c6('0x1c')](function(_0x77b33f){var _0x1c1fa7={'statusCode':_0x77b33f[_0x63c6('0x74')]||0xc8,'statusMessage':_0x77b33f[_0x63c6('0x75')]||'OK','headers':_0x77b33f[_0x63c6('0x6c')]||{},'body':_0x77b33f['body']||{}};_0x561045(null,_0x1c1fa7);})[_0x63c6('0x18')](function(_0x3c0952){var _0x10a45c={'statusCode':_0x3c0952[_0x63c6('0x74')]||0x1f4,'statusMessage':_0x3c0952[_0x63c6('0x76')]||_0x63c6('0x77'),'headers':_0x3c0952[_0x63c6('0x78')][_0x63c6('0x6c')]||{},'body':_0x3c0952[_0x63c6('0x78')][_0x63c6('0x68')]||{}};_0x561045(null,_0x10a45c);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x79')]=function(_0x4e80e9,_0x5cfdf9){scripts['googleDialogflow'](this[_0x63c6('0xe')][_0x63c6('0x38')],_0x4e80e9[_0x63c6('0x7a')],_0x4e80e9[_0x63c6('0x5f')],_0x4e80e9[_0x63c6('0x7b')]||'en')[_0x63c6('0x1c')](function(_0x194ec8){_0x5cfdf9(null,_0x194ec8);})[_0x63c6('0x18')](function(_0x4482d6){_0x5cfdf9(_0x4482d6);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x7c')]=function(_0x1002aa,_0x47ffbd){scripts[_0x63c6('0x7c')](this[_0x63c6('0xe')][_0x63c6('0x38')],_0x1002aa[_0x63c6('0x7d')],_0x1002aa[_0x63c6('0x7e')],_0x1002aa['private_key'],_0x1002aa['text'],_0x1002aa['dialogflowV2_language']||'en')[_0x63c6('0x1c')](function(_0x2291f5){_0x47ffbd(null,_0x2291f5);})[_0x63c6('0x18')](function(_0x2cc212){_0x47ffbd(_0x2cc212);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x7f')]=function(_0x5ec110,_0x3ba2be){scripts[_0x63c6('0x7f')](this[_0x63c6('0xe')],_0x5ec110)[_0x63c6('0x1c')](function(_0xf061e4){_0x3ba2be(null,_0xf061e4);})[_0x63c6('0x18')](function(_0x27339b){_0x3ba2be(_0x27339b);});};AGIVertices['prototype'][_0x63c6('0x80')]=function(_0x3a40cf,_0x2b9124){scripts[_0x63c6('0x80')](_0x3a40cf[_0x63c6('0x7a')],_0x3a40cf[_0x63c6('0x5f')],_0x3a40cf['ispeech_tts_language']||'en-US',_0x3a40cf['speed'])['then'](function(_0xd92784){_0x2b9124(null,_0xd92784);})[_0x63c6('0x18')](function(_0x577e04){_0x2b9124(_0x577e04);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x81')]=function(_0x50c879,_0x3072f8,_0x4bd343){scripts[_0x63c6('0x81')](_0x3072f8,_0x50c879['key'],_0x50c879[_0x63c6('0x82')]||_0x63c6('0x5a'),this[_0x63c6('0x83')](_0x50c879[_0x63c6('0x84')])?_0x50c879[_0x63c6('0x84')]:undefined)[_0x63c6('0x1c')](function(_0xe3b8f9){_0x4bd343(null,_0xe3b8f9);})[_0x63c6('0x18')](function(_0x1cde28){_0x4bd343(_0x1cde28);});};AGIVertices[_0x63c6('0x11')]['awsPolly']=function(_0xf2ba8a,_0x218475){scripts[_0x63c6('0x85')](_0xf2ba8a[_0x63c6('0x86')],_0xf2ba8a[_0x63c6('0x87')],_0xf2ba8a[_0x63c6('0x88')],_0xf2ba8a[_0x63c6('0x89')]||_0x63c6('0x8a'),_0xf2ba8a[_0x63c6('0x5f')],_0xf2ba8a[_0x63c6('0x8b')]||_0x63c6('0x5f'))[_0x63c6('0x1c')](function(_0x21cdfe){_0x218475(null,_0x21cdfe);})[_0x63c6('0x18')](function(_0x3990cc){_0x218475(_0x3990cc);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x8c')]=function(_0x5c719a,_0x4dd9f0){scripts[_0x63c6('0x8c')](this[_0x63c6('0xe')][_0x63c6('0x38')],_0x5c719a['aws_access_key_id'],_0x5c719a[_0x63c6('0x87')],_0x5c719a[_0x63c6('0x8d')],_0x5c719a[_0x63c6('0x5f')],_0x5c719a['aws_bot_name'])[_0x63c6('0x1c')](function(_0x1975ce){_0x4dd9f0(null,_0x1975ce);})[_0x63c6('0x18')](function(_0x394606){_0x4dd9f0(_0x394606);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x8e')]=function(_0x40117c,_0x190957,_0x4d5170){scripts['googleASR'](_0x190957,_0x40117c[_0x63c6('0x7a')],_0x40117c[_0x63c6('0x8f')]||_0x63c6('0x5a'))['then'](function(_0x2b5b27){_0x4d5170(null,_0x2b5b27);})['catch'](function(_0x2c489d){_0x4d5170(_0x2c489d);});};AGIVertices[_0x63c6('0x11')][_0x63c6('0x90')]=function(_0x362a57,_0x167e5a,_0x12fdee){scripts['tildeASR'](_0x167e5a,_0x362a57[_0x63c6('0x91')],_0x362a57[_0x63c6('0x92')],_0x362a57[_0x63c6('0x6f')])[_0x63c6('0x1c')](function(_0x4e2089){_0x12fdee(null,_0x4e2089);})[_0x63c6('0x18')](function(_0x34e60a){_0x12fdee(_0x34e60a);});};AGIVertices['prototype'][_0x63c6('0x93')]=function(_0x4116ec){var _0x5a1089=_['includes'](verticesWithRetry,_0x4116ec[_0x63c6('0x94')])?_0x4116ec:_[_0x63c6('0x95')](_0x4116ec);for(var _0x29bb3a in _0x5a1089){if(_0x5a1089[_0x63c6('0x96')](_0x29bb3a)){if(_0x5a1089[_0x29bb3a]&&_[_0x63c6('0x97')](_0x5a1089[_0x29bb3a])){if(_[_0x63c6('0x65')](recursiveMapAttributes,_0x29bb3a)){_0x5a1089[_0x29bb3a]=this['replaceObjectAllVariables'](_0x5a1089[_0x29bb3a]);}else{_0x5a1089[_0x29bb3a]=this[_0x63c6('0x98')](_0x5a1089[_0x29bb3a]);}}}}return _0x5a1089;};AGIVertices[_0x63c6('0x11')]['recursiveNodeIndex']=function(_0x4fc2a5){for(var _0x527b10 in _0x4fc2a5){if(_0x4fc2a5[_0x63c6('0x96')](_0x527b10)){if(_['isPlainObject'](_0x4fc2a5[_0x527b10])){this['recursiveNodeIndex'](_0x4fc2a5[_0x527b10]);}else if(_['isArray'](_0x4fc2a5[_0x527b10])){for(var _0x1d52eb=0x0;_0x1d52eb<_0x4fc2a5[_0x527b10][_0x63c6('0x99')];_0x1d52eb++){this['recursiveNodeIndex'](_0x4fc2a5[_0x527b10][_0x1d52eb]);}}else if(_['isString'](_0x4fc2a5[_0x527b10])){_0x4fc2a5[_0x527b10]=this[_0x63c6('0x98')](_0x4fc2a5[_0x527b10]);}}}};AGIVertices[_0x63c6('0x11')][_0x63c6('0x9a')]=function(_0xe485a0,_0x202d11){for(var _0x9d8d1a in _0xe485a0){if(_0xe485a0[_0x63c6('0x96')](_0x9d8d1a)){if(_[_0x63c6('0x9b')](_0xe485a0[_0x9d8d1a])){if(!_[_0x63c6('0x40')](_0xe485a0[_0x9d8d1a])){this[_0x63c6('0x9a')](_0xe485a0[_0x9d8d1a],util['format'](_0x63c6('0x9c'),_0x202d11,_0x9d8d1a));}}else if(_['isArray'](_0xe485a0[_0x9d8d1a])){for(var _0x4a61d3=0x0;_0x4a61d3<_0xe485a0[_0x9d8d1a]['length'];_0x4a61d3++){this[_0x63c6('0x9a')](_0xe485a0[_0x9d8d1a][_0x4a61d3],util['format']('%s.%s',_0x202d11,_0x9d8d1a+'['+_0x4a61d3+']'));}}else{if(!_[_0x63c6('0x41')](_0xe485a0[_0x9d8d1a])){this[_0x63c6('0xe')][_0x63c6('0x9d')](util['format']('%s.%s',_0x202d11,_0x9d8d1a),_0xe485a0[_0x9d8d1a]);}}}}};AGIVertices[_0x63c6('0x11')]['replaceObjectAllVariables']=function(_0x1eb841){try{var _0x4c6800=JSON[_0x63c6('0x6a')](_0x1eb841);this[_0x63c6('0x9e')](_0x4c6800);return JSON[_0x63c6('0x72')](_0x4c6800);}catch(_0x4a7a3d){return this[_0x63c6('0x98')](_0x1eb841);}};AGIVertices[_0x63c6('0x11')][_0x63c6('0x98')]=function(_0x2c1c2a){var _0x300fd7=_0x2c1c2a['split']('{');for(var _0x1c24ed=0x1;_0x1c24ed<_0x300fd7[_0x63c6('0x99')];_0x1c24ed+=0x1){var _0x5957fb=_0x300fd7[_0x1c24ed][_0x63c6('0x9f')]('}');if(_0x5957fb[_0x63c6('0x99')]>0x1){_0x2c1c2a=_0x2c1c2a[_0x63c6('0xa0')]('{'+_0x5957fb[0x0]+'}',this[_0x63c6('0xe')]['getVariable'](_0x5957fb[0x0])[_0x63c6('0xa1')]||_0x5957fb[0x0]);}}if(_0x300fd7['length']===0x1){return _0x2c1c2a[_0x63c6('0x48')]();}return this[_0x63c6('0x98')](_0x2c1c2a);};AGIVertices[_0x63c6('0x11')][_0x63c6('0xa2')]=function(_0x1ecf6f,_0x443e4c){var _0x511d05=this[_0x63c6('0xe')]['getVariable'](_0x1ecf6f);if(_0x511d05[_0x63c6('0xa3')]===-0x1){return _0x511d05;}logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xa4'),_0x443e4c,_0x511d05[_0x63c6('0xa1')]));return this[_0x63c6('0xe')][_0x63c6('0x9d')](_0x443e4c,_0x511d05['extra']);};AGIVertices['prototype'][_0x63c6('0x83')]=function(_0x27bb8e){return _0x27bb8e&&_0x27bb8e!=='0'&&_0x27bb8e!=='-1'&&_0x27bb8e!=='';};AGIVertices[_0x63c6('0x11')][_0x63c6('0xa5')]=function(_0x2a1853){this[_0x63c6('0x35')]['sync'](this,_0x2a1853,'-');_0x2a1853['retry']=_0x2a1853[_0x63c6('0xa5')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x63c6('0x11')][_0x63c6('0xa6')]=function(_0x431433){logger['info'](util['format'](_0x63c6('0xa7'),_0x431433[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x431433['text'])){return this[_0x63c6('0xe')]['noop'](_0x63c6('0xa9'));}var _0x2a518d='\x22'+_0x431433[_0x63c6('0x5f')]+'\x22';if(this[_0x63c6('0x83')](_0x431433['options'])){_0x2a518d+=','+_0x431433[_0x63c6('0x78')];}var _0x5cecde=this[_0x63c6('0xe')][_0x63c6('0x53')](_0x63c6('0xaa'),_0x2a518d);if(_0x5cecde['result']===-0x1){return _0x5cecde;}return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0xac'),_0x2a518d));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xad')]=function(_0x250471){logger['info'](util[_0x63c6('0x28')](_0x63c6('0xae'),_0x250471[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x250471[_0x63c6('0xaf')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xb0'));}var _0x5bd942=_0x250471[_0x63c6('0xaf')];if(this['isConfigured'](_0x250471[_0x63c6('0x78')])){_0x5bd942+=','+_0x250471[_0x63c6('0x78')];}var _0xf3b2c9=this['channel'][_0x63c6('0x53')](_0x63c6('0xb1'),_0x5bd942);if(_0xf3b2c9[_0x63c6('0xa3')]===-0x1){return _0xf3b2c9;}var _0x6f7937=this[_0x63c6('0xa2')](_0x63c6('0xb2'),_0x63c6('0xb3'));if(_0x6f7937[_0x63c6('0xa3')]===-0x1){return _0x6f7937;}var _0x7ad25f=this[_0x63c6('0xa2')](_0x63c6('0xb4'),_0x63c6('0xb5'));if(_0x7ad25f[_0x63c6('0xa3')]===-0x1){return _0x7ad25f;}var _0x2856b7=this[_0x63c6('0xa2')](_0x63c6('0xb6'),'MRCP_RECOG_INSTANCE');if(_0x2856b7['result']===-0x1){return _0x2856b7;}return this[_0x63c6('0xe')]['noop'](util[_0x63c6('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5bd942));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x6')]=function(_0x524751){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xb7'),_0x524751[_0x63c6('0xa8')]));return this[_0x63c6('0xe')][_0x63c6('0x6')]([_0x524751['command'],_0x524751['args']]);};AGIVertices[_0x63c6('0x11')][_0x63c6('0xb8')]=function(_0x36c556){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x36c556[_0x63c6('0xa8')]));if(this[_0x63c6('0x83')](_0x36c556['timeout'])){logger['info'](util['format'](_0x63c6('0xb9'),_0x36c556[_0x63c6('0x63')]));var _0x17869f=this[_0x63c6('0xe')][_0x63c6('0xba')](_0x36c556[_0x63c6('0x63')]);if(_0x17869f[_0x63c6('0xa3')]===-0x1){return _0x17869f;}}return this['channel'][_0x63c6('0xb8')]();};AGIVertices[_0x63c6('0x11')]['callback']=function(_0x468549){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x468549['label']));if(!this[_0x63c6('0x83')](_0x468549[_0x63c6('0x45')])){return this['channel'][_0x63c6('0x2c')](_0x468549,_0x63c6('0xbb'));}_0x468549[_0x63c6('0x46')]=moment();if(this['isConfigured'](_0x468549[_0x63c6('0xbc')])){_0x468549[_0x63c6('0x46')]=moment()['add'](_0x468549['delay'],_0x63c6('0xbd'));}if(!this[_0x63c6('0x83')](_0x468549['callback_priority'])){_0x468549['callback_priority']=0x2;}this[_0x63c6('0x3f')]['sync'](this,_0x468549);return this['channel'][_0x63c6('0xab')](util['format'](_0x63c6('0xbe'),_0x468549[_0x63c6('0x44')],_0x468549[_0x63c6('0x45')],_0x468549[_0x63c6('0x46')]));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xbf')]=function(_0x30e608){logger['info'](util[_0x63c6('0x28')](_0x63c6('0xc0'),_0x30e608[_0x63c6('0xa8')]));var _0x481aa6=this['channel']['exec'](_0x30e608[_0x63c6('0xc1')],_0x30e608[_0x63c6('0x78')]);if(_0x481aa6[_0x63c6('0xa3')]===-0x1){return _0x481aa6;}return this[_0x63c6('0xe')]['noop'](util['format'](_0x63c6('0xc2'),_0x30e608['application'],_0x30e608[_0x63c6('0x78')]));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xc3')]=function(_0x49d68a){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x49d68a[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x49d68a[_0x63c6('0x5f')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xa9'));}var _0xf1ffa5='\x22'+_0x49d68a[_0x63c6('0x5f')]+'\x22';if(this['isConfigured'](_0x49d68a[_0x63c6('0x78')])){_0xf1ffa5+=','+_0x49d68a[_0x63c6('0x78')];}var _0x2399c8=this['channel'][_0x63c6('0x53')]('MRCPSynth',_0xf1ffa5);if(_0x2399c8[_0x63c6('0xa3')]===-0x1){return _0x2399c8;}return this['channel'][_0x63c6('0xab')](util[_0x63c6('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0xf1ffa5));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xc4')]=function(_0x4e95c9){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xc5'),_0x4e95c9[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x4e95c9[_0x63c6('0x5f')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xa9'));}var _0x38f9b2='\x22'+_0x4e95c9[_0x63c6('0x5f')]+'\x22';if(this[_0x63c6('0x83')](_0x4e95c9['options'])){_0x38f9b2+=','+_0x4e95c9[_0x63c6('0x78')];}var _0x229ef9=this[_0x63c6('0xe')]['exec']('MRCPSynth',_0x38f9b2);if(_0x229ef9[_0x63c6('0xa3')]===-0x1){return _0x229ef9;}return this[_0x63c6('0xe')][_0x63c6('0xab')](util['format'](_0x63c6('0xac'),_0x38f9b2));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xc6')]=function(_0x10b64b){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xc7'),_0x10b64b[_0x63c6('0xa8')]));if(!this['isConfigured'](_0x10b64b[_0x63c6('0xaf')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xb0'));}var _0x5115de=_0x10b64b['grammar'];if(this[_0x63c6('0x83')](_0x10b64b[_0x63c6('0x78')])){_0x5115de+=','+_0x10b64b['options'];}var _0x403c83=this['channel'][_0x63c6('0x53')]('MRCPRecog',_0x5115de);if(_0x403c83[_0x63c6('0xa3')]===-0x1){return _0x403c83;}var _0x285019=this['getAndSetVariable'](_0x63c6('0xb2'),'LUMENVOX_ASR_CONFIDENCE');if(_0x285019[_0x63c6('0xa3')]===-0x1){return _0x285019;}var _0x3ed3eb=this[_0x63c6('0xa2')](_0x63c6('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x3ed3eb[_0x63c6('0xa3')]===-0x1){return _0x3ed3eb;}var _0x2ae4c9=this[_0x63c6('0xa2')](_0x63c6('0xb6'),_0x63c6('0xc8'));if(_0x2ae4c9[_0x63c6('0xa3')]===-0x1){return _0x2ae4c9;}return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5115de));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xc9')]=function(_0x3aec4f){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x3aec4f['label']));if(!this['isConfigured'](_0x3aec4f[_0x63c6('0xaf')])){return this[_0x63c6('0xe')]['noop'](_0x63c6('0xb0'));}var _0x110a21=_0x3aec4f[_0x63c6('0xaf')];if(this['isConfigured'](_0x3aec4f['options'])){_0x110a21+=','+_0x3aec4f[_0x63c6('0x78')];}var _0x34f57b=this[_0x63c6('0xe')][_0x63c6('0x53')](_0x63c6('0xb1'),_0x110a21);if(_0x34f57b[_0x63c6('0xa3')]===-0x1){return _0x34f57b;}var _0x325a0d=this[_0x63c6('0xa2')](_0x63c6('0xb2'),_0x63c6('0xca'));if(_0x325a0d[_0x63c6('0xa3')]===-0x1){return _0x325a0d;}var _0x5d1d6a=this[_0x63c6('0xa2')]('RECOG_INPUT()','SESTEK_ASR_TRANSCRIPT');if(_0x5d1d6a['result']===-0x1){return _0x5d1d6a;}var _0x568b90=this[_0x63c6('0xa2')](_0x63c6('0xb6'),_0x63c6('0xcb'));if(_0x568b90[_0x63c6('0xa3')]===-0x1){return _0x568b90;}return this[_0x63c6('0xe')]['noop'](util['format'](_0x63c6('0xcc'),_0x110a21));};AGIVertices['prototype'][_0x63c6('0xcd')]=function(_0x5158c7){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xce'),_0x5158c7[_0x63c6('0xa8')]));if(!this['isConfigured'](_0x5158c7['odbc_id'])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x5158c7,_0x63c6('0xcf'));}var _0x5a8fac=this[_0x63c6('0xd0')][_0x63c6('0xd1')](this,_0x5158c7['odbc_id']);if(!_0x5a8fac){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x5158c7,_0x63c6('0xd2'));}if(!this['isConfigured'](_0x5158c7[_0x63c6('0x30')])){return this[_0x63c6('0xe')]['error'](_0x5158c7,_0x63c6('0xd3'));}var _0x465667=_0x5158c7[_0x63c6('0x30')][_0x63c6('0x55')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0xd4'),_0x465667));var _0x3ba07a=this[_0x63c6('0x2a')]['sync'](this,_0x5a8fac,_0x465667);this['createSquareDetailsReport'][_0x63c6('0xd1')](this,_0x5158c7,_0x465667);if(!this[_0x63c6('0x83')](_0x5158c7[_0x63c6('0xd5')])){return this[_0x63c6('0xe')]['noop'](_0x63c6('0xd6'));}var _0x5ecb72=this['getVariable'][_0x63c6('0xd1')](this,_0x5158c7['variable_id']);if(!_0x5ecb72){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x5158c7,_0x63c6('0xd7'));}var _0x2ec6fa=this;_0x3ba07a[_0x63c6('0xd8')](function(_0x5c36ce,_0x166472){Object[_0x63c6('0xd9')](_0x5c36ce)['forEach'](function(_0x39455b){_0x2ec6fa['channel']['setVariable'](util['format'](_0x63c6('0xda'),_0x5ecb72,_0x166472,_0x39455b),_0x5c36ce[_0x39455b]);});});this[_0x63c6('0xe')][_0x63c6('0x9d')](util[_0x63c6('0x28')]('%s_ROWS_COUNT',_0x5ecb72),_0x3ba07a['length']);return this['channel'][_0x63c6('0xab')](util[_0x63c6('0x28')]('variable\x20%s\x20set',_0x5ecb72));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xdb')]=function(_0x3c7d0d){logger[_0x63c6('0xdc')](util[_0x63c6('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x3c7d0d['label']));if(!this[_0x63c6('0x83')](_0x3c7d0d[_0x63c6('0xdd')])){return this['channel'][_0x63c6('0x2c')](_0x3c7d0d,_0x63c6('0xde'));}var _0x1c4c43=this[_0x63c6('0x1a')]['sync'](this,_0x3c7d0d['sip_id']);if(!_0x1c4c43){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x3c7d0d,_0x63c6('0xdf'));}var _0x49d960=this[_0x63c6('0xe')][_0x63c6('0x53')](_0x63c6('0xe0'),[util[_0x63c6('0x28')](_0x63c6('0xe1'),_0x1c4c43),_0x3c7d0d[_0x63c6('0x63')],_0x3c7d0d[_0x63c6('0xe2')],_0x3c7d0d[_0x63c6('0x71')]]);if(_0x49d960[_0x63c6('0xa3')]===-0x1){return _0x49d960;}return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')]('Executed\x20command\x20%s',_0x63c6('0xe0')));};AGIVertices[_0x63c6('0x11')][_0x63c6('0xe3')]=function(_0x1e2470){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xe4'),_0x1e2470[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x1e2470['key'])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xe5'));}if(!this[_0x63c6('0x83')](_0x1e2470[_0x63c6('0x5f')])){return this[_0x63c6('0xe')][_0x63c6('0xab')]('no\x20text\x20configured');}this['channel'][_0x63c6('0xe6')]=!![];this['createSquareDetailsReport'](_0x1e2470);this[_0x63c6('0x3e')](_0x1e2470[_0x63c6('0x5f')],'in','','');this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0xe7'),_0x1e2470[_0x63c6('0x5f')]));var _0x9cc588=this[_0x63c6('0x79')]['sync'](this,_0x1e2470);if(_0x9cc588){for(var _0x58cb27 in _0x9cc588){if(_0x9cc588['hasOwnProperty'](_0x58cb27)){this[_0x63c6('0xe')][_0x63c6('0x9d')](util[_0x63c6('0x28')](_0x63c6('0xe8'),_0x58cb27[_0x63c6('0x67')]()),_0x9cc588[_0x58cb27]);}}this[_0x63c6('0x3e')](_0x9cc588['speech'],_0x63c6('0xe9'),_0x63c6('0xe3'),'');return this[_0x63c6('0xe')][_0x63c6('0xab')](util['format']('Dialogflow\x20Result\x20%s',_0x9cc588[_0x63c6('0xea')]));}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x1e2470,_0x63c6('0xeb'));};AGIVertices[_0x63c6('0x11')]['dialogflowV2']=function(_0x88b1f7){logger['info'](util[_0x63c6('0x28')](_0x63c6('0xec'),_0x88b1f7[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x88b1f7[_0x63c6('0x7d')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xed'));}if(!this['isConfigured'](_0x88b1f7['client_email'])){return this[_0x63c6('0xe')][_0x63c6('0xab')]('no\x20client_email\x20configured');}if(!this[_0x63c6('0x83')](_0x88b1f7[_0x63c6('0xee')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xef'));}if(!this[_0x63c6('0x83')](_0x88b1f7[_0x63c6('0xf0')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xf1'));}if(!this[_0x63c6('0x83')](_0x88b1f7['text'])){return this[_0x63c6('0xe')]['noop']('no\x20text\x20configured');}this[_0x63c6('0xe')][_0x63c6('0xe6')]=!![];this[_0x63c6('0x35')](_0x88b1f7);this[_0x63c6('0x3e')](_0x88b1f7[_0x63c6('0x5f')],'in','','');this[_0x63c6('0xe')]['noop'](util[_0x63c6('0x28')](_0x63c6('0xf2'),_0x88b1f7['text']));var _0x219874=this[_0x63c6('0x7c')][_0x63c6('0xd1')](this,_0x88b1f7);if(_0x219874){for(var _0x4e3443 in _0x219874){if(_0x219874[_0x63c6('0x96')](_0x4e3443)){if(_0x4e3443!==_0x63c6('0xf3')){this[_0x63c6('0xe')][_0x63c6('0x9d')](util[_0x63c6('0x28')](_0x63c6('0xe8'),_0x4e3443[_0x63c6('0x67')]()),_0x219874[_0x4e3443]);}}}this[_0x63c6('0x3e')](_0x219874[_0x63c6('0xea')],_0x63c6('0xe9'),_0x63c6('0xf4'),_0x219874['providerResponse']);return this[_0x63c6('0xe')][_0x63c6('0xab')](util['format'](_0x63c6('0xf5'),_0x219874['speech']));}return this[_0x63c6('0xe')]['error'](_0x88b1f7,_0x63c6('0xf6'));};AGIVertices['prototype'][_0x63c6('0xf7')]=function(_0x2bb38f){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0xf8'),_0x2bb38f[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x2bb38f[_0x63c6('0xf9')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xfa'));}if(!this[_0x63c6('0x83')](_0x2bb38f['username'])){return this[_0x63c6('0xe')][_0x63c6('0xab')]('no\x20username\x20configured');}if(!this['isConfigured'](_0x2bb38f[_0x63c6('0xfb')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xfc'));}if(!this[_0x63c6('0x83')](_0x2bb38f[_0x63c6('0xfd')])){return this['channel']['noop'](_0x63c6('0xa9'));}this[_0x63c6('0xe')][_0x63c6('0xe6')]=!![];this['createSquareDetailsReport'](_0x2bb38f);this['createSquareMessage'](_0x2bb38f[_0x63c6('0x5f')],'in','','');this[_0x63c6('0xe')][_0x63c6('0xab')](util['format'](_0x63c6('0xfe'),_0x2bb38f[_0x63c6('0x5f')]));var _0xaba0d6=this[_0x63c6('0x7f')]['sync'](this,_0x2bb38f);if(_0xaba0d6){for(var _0x3b16dc in _0xaba0d6){if(_0xaba0d6['hasOwnProperty'](_0x3b16dc)){this[_0x63c6('0xe')][_0x63c6('0x9d')](util[_0x63c6('0x28')](_0x63c6('0xff'),_0x3b16dc['toUpperCase']()),_0xaba0d6[_0x3b16dc]);}}this[_0x63c6('0x3e')](_0xaba0d6[_0x63c6('0xea')],_0x63c6('0xe9'),_0x63c6('0xf7'),'');if(_0xaba0d6[_0x63c6('0x100')]){this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x101'),_0xaba0d6[_0x63c6('0x100')]));var _0xdb51fa=this['channel'][_0x63c6('0x102')](_0xaba0d6['audiofile']);try{fs[_0x63c6('0x103')](_0xaba0d6[_0x63c6('0x100')]+_0x63c6('0x104'));}catch(_0x33de61){logger[_0x63c6('0x2c')](_0x33de61);}return _0xdb51fa;}else{return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x105'),_0xaba0d6[_0x63c6('0xea')]));}}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x2bb38f,_0x63c6('0x106'));};AGIVertices[_0x63c6('0x11')]['end']=function(_0x1a9c05){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x107'),_0x1a9c05[_0x63c6('0xa8')]));return this['channel'][_0x63c6('0xab')](_0x63c6('0x108'));};AGIVertices[_0x63c6('0x11')]['ext_dial']=function(_0x40b376){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x109'),_0x40b376['label']));var _0x30442d='';if(_0x40b376['trunk_id']){if(!this[_0x63c6('0x83')](_0x40b376[_0x63c6('0x10a')])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x40b376,_0x63c6('0x10b'));}else{var _0x492ba5=parseInt(_0x40b376[_0x63c6('0x10a')],0xa);if(isNaN(_0x492ba5)){_0x30442d=_0x40b376[_0x63c6('0x10a')];}else{_0x30442d=this[_0x63c6('0x1d')][_0x63c6('0xd1')](this,_0x40b376[_0x63c6('0x10a')]);if(!_0x30442d){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x40b376,_0x63c6('0x10c'));}}}}else if(_0x40b376['trunk_name']){_0x30442d=_0x40b376[_0x63c6('0x10d')];}else{return this['channel']['error'](_0x40b376,_0x63c6('0x10b'));}var _0x5e6c93=this[_0x63c6('0xe')][_0x63c6('0x53')](_0x63c6('0xe0'),[util['format']('SIP/%s/%s',_0x30442d,_0x40b376[_0x63c6('0x44')]),_0x40b376[_0x63c6('0x63')],_0x40b376[_0x63c6('0xe2')],_0x40b376[_0x63c6('0x71')]]);if(_0x5e6c93[_0x63c6('0xa3')]===-0x1){return _0x5e6c93;}return this[_0x63c6('0xe')][_0x63c6('0xab')](util['format'](_0x63c6('0x10e'),'DIAL'));};AGIVertices[_0x63c6('0x11')]['finally']=function(_0x186edb){logger['info'](util[_0x63c6('0x28')](_0x63c6('0x10f'),_0x186edb[_0x63c6('0xa8')]));return this['channel'][_0x63c6('0xab')](_0x63c6('0x110'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x111')]=function(_0x2a1b69){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x112'),_0x2a1b69['label']));if(_0x2a1b69[_0x63c6('0x113')]===0x0){return this[_0x63c6('0xa5')](_0x2a1b69);}_0x2a1b69[_0x63c6('0x113')]-=0x1;if(!this[_0x63c6('0x83')](_0x2a1b69['file_id'])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x2a1b69,'no\x20file\x20audio\x20selected');}var _0xd08929=this[_0x63c6('0x114')][_0x63c6('0xd1')](this,_0x2a1b69['file_id']);if(!_0xd08929){return this['channel'][_0x63c6('0x2c')](_0x2a1b69,_0x63c6('0x115'));}if(!this[_0x63c6('0x83')](_0x2a1b69[_0x63c6('0xd5')])){return this['channel'][_0x63c6('0x2c')](_0x63c6('0xd6'));}var _0x12c8a7=this[_0x63c6('0xe')][_0x63c6('0x116')](_0xd08929,_0x2a1b69[_0x63c6('0x117')],_0x2a1b69[_0x63c6('0x118')]);var _0x40f425=_0x12c8a7[_0x63c6('0xa3')]?_0x12c8a7[_0x63c6('0xa3')][_0x63c6('0x48')]():'';logger[_0x63c6('0x2e')](_0x63c6('0x119'),JSON[_0x63c6('0x72')](_0x12c8a7));if(_0x12c8a7[_0x63c6('0xa3')]===-0x1){this[_0x63c6('0x35')]['sync'](this,_0x2a1b69,_0x40f425);return _0x12c8a7;}else if(_0x12c8a7[_0x63c6('0xa1')]===_0x63c6('0x63')){_0x12c8a7['result']=_0x40f425[_0x63c6('0x99')]>=parseInt(_0x2a1b69[_0x63c6('0x11a')])?'x':'i';}else{_0x12c8a7[_0x63c6('0xa3')]=_0x40f425['length']>=parseInt(_0x2a1b69['mindigit'])&&_0x40f425[_0x63c6('0x99')]<=parseInt(_0x2a1b69[_0x63c6('0x118')])?'x':'i';}var _0x216b7c=this[_0x63c6('0x12')]['sync'](this,_0x2a1b69[_0x63c6('0xd5')]);if(!_0x216b7c){return this['channel'][_0x63c6('0x2c')](_0x2a1b69,'no\x20variable\x20found');}this[_0x63c6('0xe')]['setVariable'](_0x216b7c,_0x40f425);if(this[_0x63c6('0x83')](_0x2a1b69[_0x63c6('0x11b')])){var _0x5c996e=parseInt(_0x2a1b69[_0x63c6('0x11b')],0xa);var _0x3871ae=rs['generate']({'charset':'*','length':_0x5c996e});var _0x42b4bf=_0x40f425[_0x63c6('0x99')];if(_0x42b4bf>0x0){if(_0x42b4bf>_0x5c996e){this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x2a1b69,_0x2a1b69['hiddendigitspos']==='first'?_0x3871ae+_0x40f425[_0x63c6('0x11c')](_0x5c996e):_0x40f425[_0x63c6('0x11c')](0x0,_0x42b4bf-_0x5c996e)+_0x3871ae);}else{this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x2a1b69,rs['generate']({'charset':'*','length':_0x42b4bf}));}}else{this['createSquareDetailsReport'][_0x63c6('0xd1')](this,_0x2a1b69,'');}}else{this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x2a1b69,_0x40f425);}return _0x12c8a7;};AGIVertices[_0x63c6('0x11')]['getsecretdigits']=function(_0x5e9711){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x11d'),_0x5e9711[_0x63c6('0xa8')]));return this['getdigits'](_0x5e9711);};AGIVertices[_0x63c6('0x11')][_0x63c6('0x11e')]=function(_0x31da85){logger['info'](util['format'](_0x63c6('0x11f'),_0x31da85['label']));this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x31da85,_0x31da85[_0x63c6('0x120')]);return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x121'),_0x31da85[_0x63c6('0x120')]));};AGIVertices[_0x63c6('0x11')]['awspolly']=function(_0x4580bd){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x122'),_0x4580bd[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x4580bd['aws_access_key_id'])||!this[_0x63c6('0x83')](_0x4580bd['aws_secret_access_key'])){return this[_0x63c6('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x4580bd[_0x63c6('0x5f')])){return this['channel']['noop'](_0x63c6('0xa9'));}this['channel'][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x123'),_0x4580bd[_0x63c6('0x5f')]));var _0xeaaf1=this[_0x63c6('0x85')][_0x63c6('0xd1')](this,_0x4580bd);if(_0xeaaf1){this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x124'),_0xeaaf1));var _0x39413d=this[_0x63c6('0xe')][_0x63c6('0x102')](_0xeaaf1);try{fs[_0x63c6('0x103')](_0xeaaf1+_0x63c6('0x104'));}catch(_0x454580){logger['error'](_0x454580);}return _0x39413d;}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x4580bd,_0x63c6('0x125'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x126')]=function(_0x4624f8){logger['info'](util['format'](_0x63c6('0x127'),_0x4624f8[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x4624f8[_0x63c6('0x86')])||!this[_0x63c6('0x83')](_0x4624f8['aws_secret_access_key'])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x128'));}if(!this['isConfigured'](_0x4624f8[_0x63c6('0x129')])){return this['channel'][_0x63c6('0xab')](_0x63c6('0x12a'));}if(!this['isConfigured'](_0x4624f8['text'])){return this['channel']['noop'](_0x63c6('0xa9'));}this[_0x63c6('0xe')][_0x63c6('0xe6')]=!![];this[_0x63c6('0x35')](_0x4624f8);this[_0x63c6('0x3e')](_0x4624f8[_0x63c6('0x5f')],'in','','');this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x12b'),_0x4624f8[_0x63c6('0x5f')]));var _0x50e776=this[_0x63c6('0x8c')]['sync'](this,_0x4624f8);if(_0x50e776){for(var _0x2c642f in _0x50e776){if(_0x50e776[_0x63c6('0x96')](_0x2c642f)&&_['isString'](_0x50e776[_0x2c642f])){this[_0x63c6('0xe')][_0x63c6('0x9d')](util[_0x63c6('0x28')](_0x63c6('0x12c'),_0x2c642f['toUpperCase']()),_0x50e776[_0x2c642f]);}}if(_[_0x63c6('0x41')](_0x50e776[_0x63c6('0x76')])){return this['channel'][_0x63c6('0xab')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x63c6('0x3e')](_0x50e776[_0x63c6('0x76')],'out',_0x63c6('0x12d'),'');return this[_0x63c6('0xe')][_0x63c6('0xab')](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x50e776[_0x63c6('0x76')]));}}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x4624f8,_0x63c6('0x12e'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x12f')]=function(_0x44f6d8){logger['info'](util[_0x63c6('0x28')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x44f6d8[_0x63c6('0xa8')],_0x44f6d8[_0x63c6('0x63')]));if(!this[_0x63c6('0x83')](_0x44f6d8[_0x63c6('0x7a')])){return this[_0x63c6('0xe')]['noop'](_0x63c6('0xe5'));}var _0x1db033='wav';var _0x58a2d9=util[_0x63c6('0x28')](_0x63c6('0x130'),FILES_PATH,rs['generate'](0x4));var _0x459182=util[_0x63c6('0x28')](_0x63c6('0x9c'),_0x58a2d9,_0x1db033);var _0x566e60=!![];if(_0x44f6d8['beep']===_0x63c6('0x131')){_0x566e60=![];}var _0x4fa531=this['channel'][_0x63c6('0x132')](_0x58a2d9,_0x1db033,_0x44f6d8[_0x63c6('0x133')],_0x44f6d8[_0x63c6('0x63')],undefined,_0x566e60);if(_0x4fa531[_0x63c6('0xa3')]!==-0x1){this[_0x63c6('0xe')]['noop'](util['format'](_0x63c6('0x134'),_0x459182));var _0x17bc51=this[_0x63c6('0x8e')][_0x63c6('0xd1')](this,_0x44f6d8,_0x459182);if(_0x17bc51){for(var _0x4fd945 in _0x17bc51){if(_0x17bc51['hasOwnProperty'](_0x4fd945)){this[_0x63c6('0xe')][_0x63c6('0x9d')](util[_0x63c6('0x28')](_0x63c6('0x135'),_0x4fd945[_0x63c6('0x67')]()),_0x17bc51[_0x4fd945]);}}return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x136'),JSON[_0x63c6('0x72')](_0x17bc51)));}}return _0x4fa531;};AGIVertices[_0x63c6('0x11')][_0x63c6('0x137')]=function(_0x4ca6a5){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x138'),_0x4ca6a5[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x4ca6a5[_0x63c6('0x91')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x139'));}if(!this[_0x63c6('0x83')](_0x4ca6a5[_0x63c6('0x92')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x13a'));}var _0x2eb529=_0x63c6('0x13b');var _0x4de491=util[_0x63c6('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x63c6('0x13c')](0x4));var _0x577fb0=util['format']('%s.%s',_0x4de491,_0x2eb529);var _0x554d1=!![];if(_0x4ca6a5[_0x63c6('0x13d')]===_0x63c6('0x131')){_0x554d1=![];}var _0x44bd67=this[_0x63c6('0xe')]['recordFile'](_0x4de491,_0x2eb529,_0x4ca6a5[_0x63c6('0x133')],_0x4ca6a5['timeout'],undefined,_0x554d1);if(_0x44bd67[_0x63c6('0xa3')]!==-0x1){this[_0x63c6('0xe')]['noop'](util[_0x63c6('0x28')](_0x63c6('0x13e'),_0x577fb0));var _0x5cee58=this[_0x63c6('0x90')]['sync'](this,_0x4ca6a5,_0x577fb0);if(_0x5cee58){for(var _0x35c848 in _0x5cee58){if(_0x5cee58[_0x63c6('0x96')](_0x35c848)){this[_0x63c6('0xe')][_0x63c6('0x9d')](util['format'](_0x63c6('0x13f'),_0x35c848[_0x63c6('0x67')]()),_0x5cee58[_0x35c848]);}}return this['channel'][_0x63c6('0xab')](util['format']('TildeASR\x20Result\x20%s',JSON[_0x63c6('0x72')](_0x5cee58)));}}return _0x44bd67;};AGIVertices[_0x63c6('0x11')][_0x63c6('0x140')]=function(_0x1996fd){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x141'),_0x1996fd['label']));return this['channel'][_0x63c6('0x142')](_0x1996fd[_0x63c6('0x143')],_0x1996fd['extension'],_0x1996fd[_0x63c6('0x3b')]);};AGIVertices[_0x63c6('0x11')][_0x63c6('0x144')]=function(_0x1754f3){logger['info'](util['format'](_0x63c6('0x145'),_0x1754f3[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x1754f3['condition'])){return this[_0x63c6('0xe')]['error'](_0x1754f3,_0x63c6('0x146'));}try{var _0x34f804=eval(_0x1754f3[_0x63c6('0x147')])?'true':_0x63c6('0x148');this[_0x63c6('0xe')][_0x63c6('0xab')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x1754f3[_0x63c6('0x147')],_0x34f804));return{'code':0xc8,'result':_0x34f804};}catch(_0x3c20be){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x63c6('0x11')][_0x63c6('0x149')]=function(_0x4a3a82){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x14a'),_0x4a3a82['label']));if(!this[_0x63c6('0x83')](_0x4a3a82[_0x63c6('0x14b')])){return this[_0x63c6('0xe')]['error'](_0x4a3a82,_0x63c6('0x14c'));}var _0x19bcae=this[_0x63c6('0x14d')][_0x63c6('0xd1')](this,_0x4a3a82[_0x63c6('0x14b')]);if(!_0x19bcae){return this[_0x63c6('0xe')]['error'](_0x4a3a82,_0x63c6('0x14e'));}for(var _0x564264=0x0;_0x564264<_0x19bcae[_0x63c6('0x99')];_0x564264+=0x1){var _0x27bd0b=this[_0x63c6('0xe')][_0x63c6('0x12')](util[_0x63c6('0x28')](_0x63c6('0x14f'),_0x19bcae[_0x564264]));if(_0x27bd0b[_0x63c6('0xa3')]===-0x1){return _0x27bd0b;}logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('IFTIME\x20%s\x20%s',_0x19bcae[_0x564264],_0x27bd0b[_0x63c6('0xa1')]));if(_0x27bd0b[_0x63c6('0xa1')]===_0x63c6('0x150')){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x151'),_0x19bcae[_0x564264],_0x63c6('0x150')));this['channel']['noop'](util[_0x63c6('0x28')](_0x63c6('0x151'),_0x19bcae[_0x564264],_0x63c6('0x150')));return{'code':0xc8,'result':_0x63c6('0x150')};}else{logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('IFTIME\x20%s\x20%s',_0x19bcae[_0x564264],_0x63c6('0x148')));this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')]('IFTIME\x20%s\x20%s',_0x19bcae[_0x564264],_0x63c6('0x148')));}}return{'code':0xc8,'result':_0x63c6('0x148')};};AGIVertices['prototype'][_0x63c6('0x152')]=function(_0x28c2ad){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x28c2ad['label']));return this[_0x63c6('0xe')][_0x63c6('0x152')]();};AGIVertices[_0x63c6('0x11')][_0x63c6('0x153')]=function(_0x30509a){logger['info'](util['format'](_0x63c6('0x154'),_0x30509a[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x30509a[_0x63c6('0x7a')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xe5'));}var _0x5d6844=_0x63c6('0x13b');var _0x3ef167=util[_0x63c6('0x28')](_0x63c6('0x130'),FILES_PATH,rs[_0x63c6('0x13c')](0x4));var _0x3d419d=util[_0x63c6('0x28')](_0x63c6('0x9c'),_0x3ef167,_0x5d6844);var _0x30f891=!![];if(_0x30509a[_0x63c6('0x13d')]===_0x63c6('0x131')){_0x30f891=![];}var _0x44dc2c=this[_0x63c6('0xe')][_0x63c6('0x132')](_0x3ef167,_0x5d6844,_0x30509a[_0x63c6('0x133')],_0x30509a[_0x63c6('0x63')],undefined,_0x30f891);if(_0x44dc2c['result']!==-0x1){this['channel'][_0x63c6('0xab')](util['format'](_0x63c6('0x155'),_0x3d419d));var _0x38c8b1=this[_0x63c6('0x81')]['sync'](this,_0x30509a,_0x3d419d);if(_0x38c8b1){for(var _0x2548d6 in _0x38c8b1){if(_0x38c8b1[_0x63c6('0x96')](_0x2548d6)){this[_0x63c6('0xe')][_0x63c6('0x9d')](util['format']('ISPEECH_ASR_%s',_0x2548d6['toUpperCase']()),_0x38c8b1[_0x2548d6]);}}return this[_0x63c6('0xe')]['noop'](util[_0x63c6('0x28')]('IspeechASR\x20Result\x20%s',JSON['stringify'](_0x38c8b1)));}}return _0x44dc2c;};AGIVertices[_0x63c6('0x11')]['ispeechtts']=function(_0x360445){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x156'),_0x360445[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x360445[_0x63c6('0x7a')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xe5'));}if(!this[_0x63c6('0x83')](_0x360445[_0x63c6('0x5f')])){return this[_0x63c6('0xe')]['noop'](_0x63c6('0xa9'));}this['channel']['noop'](util['format'](_0x63c6('0x157'),_0x360445[_0x63c6('0x5f')]));var _0x5a65a8=this[_0x63c6('0x80')][_0x63c6('0xd1')](this,_0x360445);if(_0x5a65a8){this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x155'),_0x5a65a8));var _0x26ba79=this[_0x63c6('0xe')][_0x63c6('0x102')](_0x5a65a8,_0x360445[_0x63c6('0x133')]);try{fs['unlink'](_0x5a65a8+'.wav');}catch(_0x572da4){logger[_0x63c6('0x2c')](_0x572da4);}return _0x26ba79;}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x360445,_0x63c6('0x158'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x159')]=function(_0x43059c){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x15a'),_0x43059c[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x43059c['findBy'])){return this[_0x63c6('0xe')]['error'](_0x43059c,_0x63c6('0x15b'));}logger['info'](util[_0x63c6('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x63c6('0x4d')],_0x43059c[_0x63c6('0x15c')]));var _0x5c91b3=this[_0x63c6('0x4f')][_0x63c6('0xd1')](this,_0x43059c[_0x63c6('0x15c')]);if(_0x5c91b3){logger['info'](util[_0x63c6('0x28')](_0x63c6('0x15d'),this['channel'][_0x63c6('0x4d')],_0x43059c['findBy']));this[_0x63c6('0xe')]['noop'](util['format'](_0x63c6('0x15d'),this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x43059c['findBy']));return{'code':0xc8,'result':_0x63c6('0x15e')};}else{logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x43059c[_0x63c6('0x15c')]));this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x15f'),this[_0x63c6('0xe')]['callerid'],_0x43059c['findBy']));return{'code':0xc8,'result':_0x63c6('0x160')};}};AGIVertices[_0x63c6('0x11')][_0x63c6('0x161')]=function(_0x292251){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x162'),_0x292251[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x292251[_0x63c6('0x15c')])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x292251,_0x63c6('0x15b'));}logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x163'),this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x292251[_0x63c6('0x15c')]));var _0x49b58d=this['agentLogout'][_0x63c6('0xd1')](this,_0x292251['findBy']);if(_0x49b58d){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x15d'),this[_0x63c6('0xe')]['callerid'],_0x292251[_0x63c6('0x15c')]));this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x15d'),this[_0x63c6('0xe')]['callerid'],_0x292251[_0x63c6('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x15f'),this[_0x63c6('0xe')]['callerid'],_0x292251['findBy']));this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x15f'),this['channel'][_0x63c6('0x4d')],_0x292251['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x63c6('0x164')]=function(_0x4ab6f3){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x165'),_0x4ab6f3[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x4ab6f3[_0x63c6('0x166')])){return this['channel']['error'](_0x4ab6f3,'no\x20operation\x20configured');}this['channel'][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x167'),_0x4ab6f3[_0x63c6('0x166')]));var _0x646a93=eval(_0x4ab6f3['operation']);if(!this['isConfigured'](_0x4ab6f3[_0x63c6('0xd5')])){return this[_0x63c6('0xe')][_0x63c6('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5340c7=this[_0x63c6('0x12')][_0x63c6('0xd1')](this,_0x4ab6f3['variable_id']);if(!_0x5340c7){return this['channel'][_0x63c6('0x2c')](_0x4ab6f3,_0x63c6('0xd7'));}if(_[_0x63c6('0x168')](_0x646a93)){var _0xd0c846=this;_0x646a93[_0x63c6('0xd8')](function(_0x43c35d,_0x3b961c){_0xd0c846['channel'][_0x63c6('0x9d')](util[_0x63c6('0x28')]('%s[%s]',_0x5340c7,_0x3b961c),_0x43c35d);});return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')]('variable\x20%s[key]\x20set',_0x5340c7));}else{return this['channel'][_0x63c6('0x9d')](_0x5340c7,_0x646a93);}};AGIVertices[_0x63c6('0x11')][_0x63c6('0xc')]=function(_0x5968c7){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x169'),_0x5968c7[_0x63c6('0xa8')]));if(_0x5968c7['retry']===0x0){return this[_0x63c6('0xa5')](_0x5968c7);}_0x5968c7[_0x63c6('0x113')]-=0x1;if(!this[_0x63c6('0x83')](_0x5968c7[_0x63c6('0x16a')])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x5968c7,_0x63c6('0x16b'));}var _0xe08ec9=this['getSound']['sync'](this,_0x5968c7['file_id']);if(!_0xe08ec9){return this[_0x63c6('0xe')]['error'](_0x5968c7,'no\x20file\x20audio\x20found');}var _0x134299=this[_0x63c6('0xe')]['getData'](_0xe08ec9,_0x5968c7['response'],_0x5968c7['digit']);var _0x33c4df=_0x134299[_0x63c6('0xa3')];if(_0x134299[_0x63c6('0xa3')]===-0x1){this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x5968c7,'-1');return _0x134299;}else if(_0x134299[_0x63c6('0xa1')]===_0x63c6('0x63')){_0x134299[_0x63c6('0xa3')]=_0x134299[_0x63c6('0xa3')][_0x63c6('0x99')]>0x0?_0x134299[_0x63c6('0xa3')]:'t';}else if(_[_0x63c6('0x40')](_0x134299[_0x63c6('0xa3')])){_0x134299[_0x63c6('0xa3')]='#';_0x33c4df='#';}if(!this[_0x63c6('0x83')](_0x5968c7[_0x63c6('0xd5')])){this[_0x63c6('0xe')][_0x63c6('0xab')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x1ccfb7=this['getVariable'][_0x63c6('0xd1')](this,_0x5968c7[_0x63c6('0xd5')]);if(!_0x1ccfb7){return this['channel']['error'](_0x5968c7,'no\x20variable\x20found');}this[_0x63c6('0xe')]['setVariable'](_0x1ccfb7,_0x33c4df);}this[_0x63c6('0x35')]['sync'](this,_0x5968c7,_0x33c4df);return _0x134299;};AGIVertices[_0x63c6('0x11')][_0x63c6('0xab')]=function(_0xc84a4f){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x16c'),_0xc84a4f['label']));return this['channel'][_0x63c6('0xab')](_0xc84a4f['output']||_0xc84a4f[_0x63c6('0xa8')]);};AGIVertices[_0x63c6('0x11')]['pause']=function(_0x130957){logger['info'](util[_0x63c6('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x130957[_0x63c6('0xa8')]));if(!this['isConfigured'](_0x130957[_0x63c6('0x15c')])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x130957,_0x63c6('0x15b'));}logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x163'),this['channel'][_0x63c6('0x4d')],_0x130957[_0x63c6('0x15c')]));var _0x5ca5ce=this[_0x63c6('0x16d')][_0x63c6('0xd1')](this,_0x130957[_0x63c6('0x16e')]);var _0x270bdb=this[_0x63c6('0x4a')][_0x63c6('0xd1')](this,_0x130957['findBy'],_0x5ca5ce);if(_0x270bdb){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x63c6('0xe')]['callerid'],_0x130957['findBy']));this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x15d'),this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x130957[_0x63c6('0x15c')]));return{'code':0xc8,'result':_0x63c6('0x15e')};}else{logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x130957[_0x63c6('0x15c')]));this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x15d'),this['channel'][_0x63c6('0x4d')],_0x130957['findBy']));return{'code':0xc8,'result':_0x63c6('0x160')};}};AGIVertices['prototype'][_0x63c6('0x16f')]=function(_0x2bee9d){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x170'),_0x2bee9d['label']));if(!this[_0x63c6('0x83')](_0x2bee9d['file_id'])){return this['channel']['error'](_0x2bee9d,_0x63c6('0x16b'));}var _0x2fe8cd=this[_0x63c6('0x114')][_0x63c6('0xd1')](this,_0x2bee9d[_0x63c6('0x16a')]);if(!_0x2fe8cd){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x2bee9d,_0x63c6('0x115'));}var _0x533ecb=this[_0x63c6('0xe')][_0x63c6('0x53')](_0x63c6('0x171'),[_0x2fe8cd,_0x2bee9d[_0x63c6('0xe2')]]);if(_0x533ecb[_0x63c6('0xa3')]===-0x1){return _0x533ecb;}return this[_0x63c6('0xe')]['noop'](util[_0x63c6('0x28')](_0x63c6('0xc2'),_0x63c6('0x171'),_0x2fe8cd));};AGIVertices[_0x63c6('0x11')]['queue']=function(_0x95a375){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x172'),_0x95a375[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x95a375['queue_id'])){return this['channel'][_0x63c6('0x2c')](_0x95a375,_0x63c6('0x173'));}var _0x397db2='';var _0x107b02=parseInt(_0x95a375[_0x63c6('0x174')],0xa);if(isNaN(_0x107b02)){_0x397db2=_0x95a375[_0x63c6('0x174')];}else{_0x397db2=this[_0x63c6('0x14')][_0x63c6('0xd1')](this,_0x95a375['queue_id']);if(!_0x397db2){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x95a375,_0x63c6('0x175'));}}var _0x5e7149='';if(this[_0x63c6('0x83')](_0x95a375['file_id'])){var _0x4963f7=this[_0x63c6('0x114')][_0x63c6('0xd1')](this,_0x95a375['file_id']);if(_0x4963f7){_0x5e7149=_0x4963f7;}}this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x95a375,_0x397db2);if(_0x95a375['opts'][_0x63c6('0x176')]('x')<0x0){_0x95a375[_0x63c6('0xe2')]+='x';}if(_0x95a375[_0x63c6('0xe2')][_0x63c6('0x176')]('X')<0x0){_0x95a375[_0x63c6('0xe2')]+='X';}this[_0x63c6('0xe')][_0x63c6('0x9d')]('XMCS-QUEUE',_0x397db2?_0x397db2[_0x63c6('0x177')]():'');var _0x3bcce4=this[_0x63c6('0xe')]['exec'](_0x63c6('0x178'),[_0x397db2,_0x95a375['opts'],_0x95a375[_0x63c6('0x71')],_0x5e7149,_0x95a375[_0x63c6('0x63')],_0x95a375[_0x63c6('0x6')],_0x95a375[_0x63c6('0x179')],_0x95a375[_0x63c6('0x17a')],'',_0x95a375[_0x63c6('0x17b')]]);if(_0x3bcce4[_0x63c6('0xa3')]===-0x1){return _0x3bcce4;}return this['channel'][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0xc2'),_0x63c6('0x178'),_0x397db2));};AGIVertices['prototype']['record']=function(_0x4fcf4f){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x17c'),_0x4fcf4f[_0x63c6('0xa8')]));var _0x25081e=_0x4fcf4f[_0x63c6('0x17d')]||_0x63c6('0x13b');var _0xf56ca2=util['format']('%s_%s',this['channel']['uniqueid'],rs[_0x63c6('0x13c')](0x5));var _0x5189a3=util[_0x63c6('0x28')]('%s/recordings/%s.%s',FILES_PATH,_0xf56ca2,_0x25081e);var _0x8ee132=util['format']('%s/recordings/%s',FILES_PATH,_0xf56ca2);this[_0x63c6('0x37')][_0x63c6('0xd1')](this,_0x4fcf4f,_0xf56ca2,_0x5189a3);this[_0x63c6('0xe')][_0x63c6('0x9d')]('RECORDING_SAVENAME',_0xf56ca2);logger[_0x63c6('0x2e')](_0x63c6('0x17e'),_0x8ee132,_0x25081e,_0x4fcf4f[_0x63c6('0x17f')],_0x4fcf4f['timeout']);return this['channel'][_0x63c6('0x132')](_0x8ee132,_0x25081e,_0x4fcf4f[_0x63c6('0x17f')],_0x4fcf4f[_0x63c6('0x63')],undefined,!![]);};AGIVertices[_0x63c6('0x11')]['restapi']=function(_0xcbc618){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xcbc618[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0xcbc618[_0x63c6('0x71')])){return this['channel']['noop'](_0x63c6('0x180'));}var _0x18789a=this[_0x63c6('0x61')][_0x63c6('0xd1')](this,_0xcbc618);logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x181'),util['inspect'](_0x18789a,{'showHidden':![],'depth':null})));if(!this[_0x63c6('0x83')](_0xcbc618['variable_id'])){return this['channel'][_0x63c6('0xab')](_0x63c6('0x182'));}var _0x359a22=this['getVariable']['sync'](this,_0xcbc618[_0x63c6('0xd5')]);if(!_0x359a22){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0xcbc618,_0x63c6('0xd7'));}this['channel'][_0x63c6('0x9d')](util[_0x63c6('0x28')](_0x63c6('0x183'),_0x359a22),_0x18789a[_0x63c6('0x74')]?_0x18789a[_0x63c6('0x74')]:_0x63c6('0x184'));this[_0x63c6('0xe')][_0x63c6('0x9d')](util['format'](_0x63c6('0x185'),_0x359a22),_0x18789a[_0x63c6('0x75')]?_0x18789a[_0x63c6('0x75')]:'OK');if(_0x18789a[_0x63c6('0x68')]){try{this['saveRestApiResult'](_0x18789a[_0x63c6('0x68')],_0x359a22);}catch(_0x533a5d){logger[_0x63c6('0x2c')](util[_0x63c6('0x28')](_0x63c6('0x186'),_0x359a22));}}return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x187'),_0x359a22));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x188')]=function(_0x305a15){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x189'),_0x305a15[_0x63c6('0xa8')]));return this[_0x63c6('0xe')][_0x63c6('0x18a')](_0x305a15[_0x63c6('0x18b')]['replace'](/\s+/g,''),_0x305a15[_0x63c6('0x17f')]);};AGIVertices[_0x63c6('0x11')][_0x63c6('0x18c')]=function(_0x55a283){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x55a283[_0x63c6('0xa8')]));return this[_0x63c6('0xe')][_0x63c6('0x18d')](_0x55a283[_0x63c6('0x64')][_0x63c6('0x55')](/\s+/g,''),_0x55a283['escape_digits']);};AGIVertices[_0x63c6('0x11')][_0x63c6('0x18e')]=function(_0xcaec46){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x18f'),_0xcaec46['label']));return this[_0x63c6('0xe')][_0x63c6('0x190')](_0xcaec46[_0x63c6('0x5f')],_0xcaec46[_0x63c6('0x17f')]);};AGIVertices[_0x63c6('0x11')]['sendMail']=function(_0x196935){logger['info'](util[_0x63c6('0x28')](_0x63c6('0x191'),_0x196935[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x196935['account_id'])){return this[_0x63c6('0xe')][_0x63c6('0xab')]('no\x20mail\x20account\x20configured');}var _0x28acb8=this[_0x63c6('0x22')]['sync'](this,_0x196935[_0x63c6('0x192')]);if(!_0x28acb8||!_0x28acb8[_0x63c6('0x193')]){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x196935,'no\x20mail\x20account\x20found');}var _0x2a053f={'from':util['format'](_0x63c6('0x194'),_0x28acb8[_0x63c6('0x16')],_0x28acb8[_0x63c6('0x195')]||_0x28acb8[_0x63c6('0x193')][_0x63c6('0x196')]),'to':_0x196935['to']||'','cc':_0x196935['cc']||'','bcc':_0x196935[_0x63c6('0x197')]||'','subject':_0x196935[_0x63c6('0x198')],'html':_0x196935['text'],'text':_0x196935[_0x63c6('0x5f')]};if(this[_0x63c6('0x83')](_0x196935['template_id'])){}logger[_0x63c6('0xdc')]('sendMail\x20message',JSON['stringify'](_0x2a053f));this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x196935,_0x196935[_0x63c6('0x192')]);this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x199'),_0x28acb8[_0x63c6('0x16')]));this['sendMailMessage'][_0x63c6('0xd1')](this,_0x28acb8['smtpOptions'],_0x2a053f);return this['channel'][_0x63c6('0xab')](_0x63c6('0x19a'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x19b')]=function(_0x4e0e01){logger[_0x63c6('0x2e')](util['format'](_0x63c6('0x19c'),_0x4e0e01['label']));return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x19d'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x19e')]=function(_0x2cc688){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x19f'),_0x2cc688[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x2cc688[_0x63c6('0x1a0')])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x1a1'));}var _0xfdd32d=this[_0x63c6('0x33')]['sync'](this,_0x2cc688[_0x63c6('0x1a0')]);if(!_0xfdd32d){return this[_0x63c6('0xe')]['error'](_0x2cc688,'no\x20sms\x20account\x20found');}var _0x39ce3f={'body':_0x2cc688['sms_text'],'phone':_0x2cc688['to']||'','SmsAccountId':_0xfdd32d['id']};logger['debug'](_0x63c6('0x1a2'),JSON[_0x63c6('0x72')](_0x39ce3f));this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x2cc688,_0x2cc688[_0x63c6('0x1a0')]);this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x1a3'),_0xfdd32d['name']));this[_0x63c6('0x34')][_0x63c6('0xd1')](this,_0x39ce3f);return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x1a4'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1a5')]=function(_0x1078d1){logger['info'](util[_0x63c6('0x28')](_0x63c6('0x1a6'),_0x1078d1['label']));if(!this[_0x63c6('0x83')](_0x1078d1[_0x63c6('0xd5')])){return this['channel'][_0x63c6('0x2c')](_0x1078d1,_0x63c6('0x1a7'));}var _0x1c3463=this['getVariable']['sync'](this,_0x1078d1[_0x63c6('0xd5')]);if(!_0x1c3463){return this[_0x63c6('0xe')]['error'](_0x1078d1,_0x63c6('0xd7'));}return this[_0x63c6('0xe')][_0x63c6('0x9d')](_0x1c3463,_0x1078d1[_0x63c6('0x1a8')]);};AGIVertices[_0x63c6('0x11')]['start']=function(_0xf1ac49){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x1a9'),_0xf1ac49['label']));this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x1aa'));if(_0xf1ac49[_0x63c6('0xb8')]==='yes'){this[_0x63c6('0xe')]['noop'](_0x63c6('0x1ab'));return this[_0x63c6('0xe')][_0x63c6('0xb8')]();}return this['channel'][_0x63c6('0xab')](_0x63c6('0x1ac'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1ad')]=function(_0x40a75b){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x1ae'),_0x40a75b[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x40a75b['project_id'])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x40a75b,'no\x20subproject\x20selected');}var _0x2e0299=this['getSquareProject'][_0x63c6('0xd1')](this,_0x40a75b[_0x63c6('0x1af')]);if(!this[_0x63c6('0x83')](_0x2e0299)){return this[_0x63c6('0xe')]['error'](_0x40a75b,util[_0x63c6('0x28')](_0x63c6('0x1b0'),_0x40a75b[_0x63c6('0x1af')]));}if(_0x2e0299===this['channel'][_0x63c6('0x36')]){return this['channel']['error'](_0x40a75b,_0x63c6('0x1b1'));}this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x40a75b,_0x2e0299);var _0x3958be=this['channel'][_0x63c6('0x53')](_0x63c6('0x1b2'),util[_0x63c6('0x28')](_0x63c6('0x1b3'),config['agi']['host']||'127.0.0.1',_0x2e0299,this[_0x63c6('0xe')][_0x63c6('0x36')]));if(_0x3958be[_0x63c6('0xa3')]===-0x1){return _0x3958be;}return this['channel']['noop'](util[_0x63c6('0x28')](_0x63c6('0xc2'),_0x63c6('0x1b2'),_0x2e0299));};AGIVertices['prototype'][_0x63c6('0x1b4')]=function(_0x1cd9b9){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x1cd9b9['label']));var _0xfcacd6=this[_0x63c6('0x52')][_0x63c6('0xd1')](this,_0x1cd9b9['command']);this[_0x63c6('0x35')][_0x63c6('0xd1')](this,_0x1cd9b9,_0x1cd9b9[_0x63c6('0x1b5')]);if(this[_0x63c6('0x83')](_0x1cd9b9[_0x63c6('0xd5')])){var _0x256288=this[_0x63c6('0x12')][_0x63c6('0xd1')](this,_0x1cd9b9['variable_id']);if(_0x256288){this[_0x63c6('0xe')][_0x63c6('0x9d')](_0x256288,_0xfcacd6);return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x1b6'),_0x1cd9b9[_0x63c6('0x1b5')],_0x256288));}}return this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x1b7'),_0x1cd9b9[_0x63c6('0x1b5')]));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1b8')]=function(_0x29fd74){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x1b9'),_0x29fd74['label']));_0x29fd74[_0x63c6('0x5f')]=_0x29fd74[_0x63c6('0x5f')][_0x63c6('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x29fd74['apiKey'])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0x1ba'));}if(!this[_0x63c6('0x83')](_0x29fd74['text'])){return this[_0x63c6('0xe')][_0x63c6('0xab')](_0x63c6('0xa9'));}this[_0x63c6('0xe')]['noop'](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x29fd74[_0x63c6('0x5f')]));var _0x237539=this['googleCloudTTS'][_0x63c6('0xd1')](this,_0x29fd74);if(_0x237539){this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')]('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x237539));var _0x3aa50d=this[_0x63c6('0xe')]['streamFile'](_0x237539);try{fs['unlink'](_0x237539+_0x63c6('0x104'));}catch(_0x29e78e){logger[_0x63c6('0x2c')](_0x29e78e);}return _0x3aa50d;}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x29fd74,_0x63c6('0x1bb'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1bc')]=function(_0x362a68){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x1bd'),_0x362a68['label']));_0x362a68['text']=_0x362a68[_0x63c6('0x5f')][_0x63c6('0x55')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x63c6('0x83')](_0x362a68[_0x63c6('0x5f')])){return this[_0x63c6('0xe')]['noop']('no\x20text\x20configured');}this[_0x63c6('0xe')][_0x63c6('0xab')](util[_0x63c6('0x28')](_0x63c6('0x1be'),_0x362a68[_0x63c6('0x5f')]));var _0x4a58f7=this[_0x63c6('0x1bf')][_0x63c6('0xd1')](this,_0x362a68);if(_0x4a58f7){this[_0x63c6('0xe')]['noop'](util[_0x63c6('0x28')](_0x63c6('0x1c0'),_0x4a58f7));var _0x260ffe=this[_0x63c6('0xe')][_0x63c6('0x102')](_0x4a58f7);try{fs[_0x63c6('0x103')](_0x4a58f7+'.wav');}catch(_0x48d81d){logger['error'](_0x48d81d);}return _0x260ffe;}return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x362a68,_0x63c6('0x1c1'));};AGIVertices[_0x63c6('0x11')][_0x63c6('0x1c2')]=function(_0x19e981){logger['info'](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x19e981[_0x63c6('0xa8')]));if(!this[_0x63c6('0x83')](_0x19e981['findBy'])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x19e981,_0x63c6('0x15b'));}logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x163'),this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x19e981[_0x63c6('0x15c')]));var _0x3f04a3=this[_0x63c6('0x4c')][_0x63c6('0xd1')](this,_0x19e981[_0x63c6('0x15c')]);if(_0x3f04a3){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x19e981['findBy']));this['channel']['noop'](util['format'](_0x63c6('0x15d'),this['channel']['callerid'],_0x19e981[_0x63c6('0x15c')]));return{'code':0xc8,'result':_0x63c6('0x15e')};}else{logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x15f'),this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x19e981[_0x63c6('0x15c')]));this['channel']['noop'](util[_0x63c6('0x28')](_0x63c6('0x15f'),this[_0x63c6('0xe')][_0x63c6('0x4d')],_0x19e981['findBy']));return{'code':0xc8,'result':_0x63c6('0x160')};}};AGIVertices['prototype'][_0x63c6('0x1c3')]=function(_0x577b12){logger['info'](util[_0x63c6('0x28')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x577b12[_0x63c6('0xa8')]));var _0x277b64=this[_0x63c6('0xe')]['exec']('VOICEMAIL',[_0x577b12[_0x63c6('0x1c4')],_0x577b12[_0x63c6('0x78')]]);if(_0x277b64['result']===-0x1){return _0x277b64;}return this['channel']['noop'](util[_0x63c6('0x28')](_0x63c6('0xc2'),'VOICEMAIL',_0x577b12['mailbox']));};AGIVertices[_0x63c6('0x11')]['vswitch']=function(_0x154244){logger[_0x63c6('0x2e')](util[_0x63c6('0x28')](_0x63c6('0x1c5'),_0x154244[_0x63c6('0xa8')]));if(!this['isConfigured'](_0x154244[_0x63c6('0xd5')])){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x154244,_0x63c6('0x1a7'));}var _0x413545=this[_0x63c6('0x12')][_0x63c6('0xd1')](this,_0x154244[_0x63c6('0xd5')]);if(!_0x413545){return this[_0x63c6('0xe')][_0x63c6('0x2c')](_0x154244,_0x63c6('0xd7'));}var _0x3dea6b=this[_0x63c6('0xe')][_0x63c6('0x12')](_0x413545);return{'code':0xc8,'result':_0x3dea6b[_0x63c6('0xa1')]?_0x3dea6b[_0x63c6('0xa1')]:'-'};};String['prototype'][_0x63c6('0xa0')]=function(_0x15af01,_0x26f6db){return this[_0x63c6('0x9f')](_0x15af01)[_0x63c6('0x1c6')](_0x26f6db);};module[_0x63c6('0x1c7')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 118d74f..3c60dab 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 _0x5e11=['syncAgentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','lastPauseAt','update','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnect]\x20%s','isUndefined','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER: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','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','custom:agentConnectPreview'];(function(_0x29d52c,_0x49669a){var _0x33c6c5=function(_0x2c47f7){while(--_0x2c47f7){_0x29d52c['push'](_0x29d52c['shift']());}};_0x33c6c5(++_0x49669a);}(_0x5e11,0x96));var _0x15e1=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x5e11[_0x30033a];return _0x5e3518;};'use strict';var _=require(_0x15e1('0x0'));var moment=require(_0x15e1('0x1'));var ami=require(_0x15e1('0x2'));var logger=require(_0x15e1('0x3'))(_0x15e1('0x4'));var RpcUser=require(_0x15e1('0x5'));var RpcVoiceAgentReport=require(_0x15e1('0x6'));function Acw(_0x28d5ae){this['voiceQueues']=_0x28d5ae[_0x15e1('0x7')];this[_0x15e1('0x8')]=_0x28d5ae['agents'];this['timers']=_0x28d5ae[_0x15e1('0x9')];this[_0x15e1('0xa')]={};ami['on'](_0x15e1('0xb'),this[_0x15e1('0xc')][_0x15e1('0xd')](this));ami['on'](_0x15e1('0xe'),this[_0x15e1('0xf')][_0x15e1('0xd')](this));ami['on'](_0x15e1('0x10'),this[_0x15e1('0x11')]['bind'](this));ami['on'](_0x15e1('0x12'),this[_0x15e1('0x13')][_0x15e1('0xd')](this));ami['on'](_0x15e1('0x14'),this['syncAttendedTransfer']['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0x15e1('0xd')](this));ami['on'](_0x15e1('0x15'),this[_0x15e1('0x16')][_0x15e1('0xd')](this));}function getDiff(_0x5e636a){var _0x315c08=moment()[_0x15e1('0x17')](0x0);var _0x422e55=moment(_0x5e636a)[_0x15e1('0x17')](0x0);return _0x315c08[_0x15e1('0x18')](_0x422e55,_0x15e1('0x19'));}Acw[_0x15e1('0x1a')][_0x15e1('0x1b')]=function(_0x3e2c9d){try{var _0x5a662f=this;var _0x4bd192=this['channels'][_0x3e2c9d][_0x15e1('0x1c')];var _0xffffae=this['channels'][_0x3e2c9d][_0x15e1('0x1d')];var _0x23ca92=this['voiceQueues'][_0xffffae];var _0x2057c8=![];var _0x4833e4='ACW';if(_0x23ca92[_0x15e1('0x1e')]){if(_0x23ca92[_0x15e1('0x1f')][_0x15e1('0x20')]){_0x2057c8=!![];_0x4833e4=_0x23ca92['mandatoryDispositionPause'][_0x15e1('0x20')];}}return ami[_0x15e1('0x21')]({'action':_0x15e1('0x22'),'interface':_0x4bd192,'paused':!![],'reason':_0x4833e4})[_0x15e1('0x23')](function(){if(_0x5a662f[_0x15e1('0x8')][_0x4bd192]){return RpcUser[_0x15e1('0x24')](_0x5a662f[_0x15e1('0x8')][_0x4bd192]['id'])[_0x15e1('0x23')](function(_0x1ea392){if(_0x1ea392&&!_0x1ea392[_0x15e1('0x25')]){logger[_0x15e1('0x26')](_0x15e1('0x27'),_0x3e2c9d,_0x4bd192,_0xffffae);var _0x1f947f=_0x5a662f[_0x15e1('0xa')][_0x3e2c9d][_0x15e1('0x28')]&&_0x5a662f[_0x15e1('0xa')][_0x3e2c9d]['destlinkedid']?_0x5a662f[_0x15e1('0xa')][_0x3e2c9d][_0x15e1('0x29')]:_0x3e2c9d;return RpcUser[_0x15e1('0x2a')](_0x5a662f[_0x15e1('0x8')][_0x4bd192],_0x4833e4,_0x1f947f)[_0x15e1('0x23')](function(){if(!_0x2057c8){_0x5a662f['timers'][_0x4bd192]={};logger[_0x15e1('0x26')](_0x15e1('0x2b'),_0x3e2c9d,_0x5a662f[_0x15e1('0x7')][_0xffffae][_0x15e1('0x2c')],_0x4bd192,_0xffffae);_0x5a662f['timers'][_0x4bd192][_0x15e1('0x2d')]=setTimeout(_0x5a662f[_0x15e1('0x2e')][_0x15e1('0xd')](_0x5a662f,_0x4bd192),_0x5a662f[_0x15e1('0x7')][_0xffffae][_0x15e1('0x2c')]*0x3e8);_0x5a662f['timers'][_0x4bd192]['lastPauseAt']=moment()['format'](_0x15e1('0x2f'));_0x5a662f['timers'][_0x4bd192][_0x15e1('0x30')]=_0x3e2c9d;_0x5a662f[_0x15e1('0x9')][_0x4bd192]['queue']=_0xffffae;_0x5a662f['timers'][_0x4bd192][_0x15e1('0x31')]=function(){var _0xf2b9d4=getDiff(_0x5a662f[_0x15e1('0x9')][_0x4bd192][_0x15e1('0x32')]);clearTimeout(_0x5a662f[_0x15e1('0x9')][_0x4bd192]['timer']);_0x5a662f[_0x15e1('0x9')][_0x4bd192][_0x15e1('0x2d')]=![];RpcVoiceAgentReport[_0x15e1('0x33')]({'acwtime':_0xf2b9d4},_0x5a662f[_0x15e1('0x9')][_0x4bd192]['uniqueid'],_0x4bd192)[_0x15e1('0x23')](function(_0x1f9f1a){logger[_0x15e1('0x26')](_0x15e1('0x34'),_0x3e2c9d,_0xf2b9d4,_0x1f9f1a);})[_0x15e1('0x35')](function(_0x3d5318){logger['error'](_0x15e1('0x36'),_0x3e2c9d,_0x3d5318);});delete _0x5a662f['timers'][_0x4bd192];};}});}else{logger[_0x15e1('0x26')](_0x15e1('0x37'),_0x3e2c9d,_0x4bd192,_0xffffae);}});}})[_0x15e1('0x35')](function(){logger[_0x15e1('0x38')](_0x15e1('0x2b'),_0x3e2c9d,_0x5a662f[_0x15e1('0x7')][_0xffffae][_0x15e1('0x2c')],_0x4bd192,_0xffffae);})[_0x15e1('0x39')](function(){delete _0x5a662f[_0x15e1('0xa')][_0x3e2c9d];});}catch(_0x3a508b){logger['error'](_0x15e1('0x3a'),_0x3a508b[_0x15e1('0x3b')]);}};Acw[_0x15e1('0x1a')][_0x15e1('0x2e')]=function(_0x11915d){try{var _0x4e8237=this;if(_0x4e8237[_0x15e1('0x9')][_0x11915d]){_0x4e8237[_0x15e1('0x9')][_0x11915d][_0x15e1('0x2d')]=![];var _0x32f2c0=_0x4e8237[_0x15e1('0x9')][_0x11915d][_0x15e1('0x30')];var _0x5338dc=_0x4e8237[_0x15e1('0x9')][_0x11915d][_0x15e1('0x1d')];var _0x351516=_0x4e8237[_0x15e1('0x7')][_0x5338dc][_0x15e1('0x2c')];logger[_0x15e1('0x26')](_0x15e1('0x3c'),_0x32f2c0,_0x11915d);RpcUser[_0x15e1('0x3d')](this[_0x15e1('0x8')][_0x11915d]);RpcVoiceAgentReport[_0x15e1('0x33')]({'acwtime':_0x351516,'agentacw':!![]},_0x32f2c0,_0x11915d)[_0x15e1('0x23')](function(_0x380ce9){logger[_0x15e1('0x26')](_0x15e1('0x34'),_0x32f2c0,_0x351516,_0x380ce9);})[_0x15e1('0x35')](function(_0x2c009b){logger[_0x15e1('0x38')](_0x15e1('0x36'),_0x32f2c0,_0x2c009b);});}else{logger['error'](_0x15e1('0x3e'),_0x11915d);if(_0x4e8237[_0x15e1('0x9')]){logger[_0x15e1('0x26')](_0x15e1('0x3f'),JSON[_0x15e1('0x40')](_0x4e8237['timers']));}}}catch(_0x398c8e){logger[_0x15e1('0x38')]('[ACW][STOP]\x20%s',_0x398c8e[_0x15e1('0x3b')]);}};Acw['prototype']['syncAgentConnect']=function(_0x3e0adf){try{if(this[_0x15e1('0x7')][_0x3e0adf[_0x15e1('0x1d')]]&&(this[_0x15e1('0x7')][_0x3e0adf[_0x15e1('0x1d')]]['acw']||this['voiceQueues'][_0x3e0adf[_0x15e1('0x1d')]][_0x15e1('0x1e')])){if(this[_0x15e1('0x8')][_0x3e0adf[_0x15e1('0x1c')]]){this[_0x15e1('0xa')][_0x3e0adf[_0x15e1('0x30')]]={'queue':_0x3e0adf[_0x15e1('0x1d')],'interface':_0x3e0adf[_0x15e1('0x1c')],'destlinkedid':_0x3e0adf['destlinkedid']};}}}catch(_0x3b7143){logger[_0x15e1('0x38')](_0x15e1('0x41'),_0x3b7143['message']);}};Acw[_0x15e1('0x1a')][_0x15e1('0x16')]=function(_0x3a88ce){try{if(this[_0x15e1('0x7')][_0x3a88ce['queue']]&&(this[_0x15e1('0x7')][_0x3a88ce['queue']][_0x15e1('0x4')]||this['voiceQueues'][_0x3a88ce[_0x15e1('0x1d')]][_0x15e1('0x1e')])){if(this[_0x15e1('0x8')][_0x3a88ce['interface']]){this['channels'][_0x3a88ce[_0x15e1('0x30')]]={'queue':_0x3a88ce[_0x15e1('0x1d')],'interface':_0x3a88ce[_0x15e1('0x1c')]};}}}catch(_0x58f2e5){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x58f2e5[_0x15e1('0x3b')]);}};Acw['prototype'][_0x15e1('0xf')]=function(_0x45e5b1){try{if(this['channels'][_0x45e5b1['uniqueid']]&&_[_0x15e1('0x42')](this[_0x15e1('0xa')][_0x45e5b1['uniqueid']]['attended'])){logger[_0x15e1('0x26')]('[%s][HANGUP:UNIQUEID]',_0x45e5b1['uniqueid']);this[_0x15e1('0x1b')](_0x45e5b1[_0x15e1('0x30')]);}else if(this[_0x15e1('0xa')][_0x45e5b1['linkedid']]&&_[_0x15e1('0x42')](this[_0x15e1('0xa')][_0x45e5b1['linkedid']][_0x15e1('0x28')])){logger['info']('[%s][HANGUP:LINKEDID]',_0x45e5b1[_0x15e1('0x43')]);this[_0x15e1('0x1b')](_0x45e5b1[_0x15e1('0x43')]);}}catch(_0x4ad2c0){logger[_0x15e1('0x38')]('[ACW][syncHangupRequest]\x20%s',_0x4ad2c0[_0x15e1('0x3b')]);}};Acw[_0x15e1('0x1a')][_0x15e1('0x11')]=function(_0x506c63){try{if(this[_0x15e1('0xa')][_0x506c63[_0x15e1('0x30')]]&&this[_0x15e1('0xa')][_0x506c63[_0x15e1('0x30')]][_0x15e1('0x28')]){logger[_0x15e1('0x26')](_0x15e1('0x44'),_0x506c63[_0x15e1('0x30')]);this[_0x15e1('0x1b')](_0x506c63[_0x15e1('0x30')]);}else if(this['channels'][_0x506c63[_0x15e1('0x43')]]&&this[_0x15e1('0xa')][_0x506c63['linkedid']][_0x15e1('0x28')]){logger[_0x15e1('0x26')](_0x15e1('0x45'),_0x506c63[_0x15e1('0x43')]);this['startAcw'](_0x506c63[_0x15e1('0x43')]);}}catch(_0x33ff57){logger['error'](_0x15e1('0x46'),_0x33ff57[_0x15e1('0x3b')]);}};Acw[_0x15e1('0x1a')][_0x15e1('0x47')]=function(_0x26ba6b){try{if(!_[_0x15e1('0x48')](this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x49')]])){this[_0x15e1('0x1b')](_0x26ba6b[_0x15e1('0x49')]);if(this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4a')]]){this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4a')]]['attended']=!![];this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4b')]]=this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4a')]];delete this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4a')]];}}else if(!_[_0x15e1('0x48')](this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4b')]])){this[_0x15e1('0x1b')](_0x26ba6b['transfertargetuniqueid']);if(this['channels'][_0x26ba6b[_0x15e1('0x4c')]]){this[_0x15e1('0xa')][_0x26ba6b['origtransfereruniqueid']]['attended']=!![];this['channels'][_0x26ba6b['transfereeuniqueid']]=this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4c')]];delete this[_0x15e1('0xa')][_0x26ba6b[_0x15e1('0x4c')]];}}}catch(_0x525f44){logger[_0x15e1('0x38')](_0x15e1('0x4d'),_0x525f44['message']);}};Acw[_0x15e1('0x1a')]['syncBlindTransfer']=function(_0x598913){try{if(this['channels'][_0x598913['transfereruniqueid']]){logger[_0x15e1('0x26')](_0x15e1('0x4e'),JSON[_0x15e1('0x40')](_0x598913['transfereruniqueid']));this['startAcw'](_0x598913[_0x15e1('0x4f')]);}else if(this[_0x15e1('0xa')][_0x598913[_0x15e1('0x50')]]){logger[_0x15e1('0x26')](_0x15e1('0x51'),JSON[_0x15e1('0x40')](_0x598913['transfererlinkedid']));this[_0x15e1('0x1b')](_0x598913[_0x15e1('0x50')]);}}catch(_0x664105){logger[_0x15e1('0x38')](_0x15e1('0x52'),_0x664105['message']);}};Acw[_0x15e1('0x1a')]['syncAgentRingNoAnswer']=function(_0x22c59a){try{if(this[_0x15e1('0x7')][_0x22c59a[_0x15e1('0x1d')]]&&this[_0x15e1('0x7')][_0x22c59a[_0x15e1('0x1d')]][_0x15e1('0x53')]==='all'){if(this[_0x15e1('0x8')][_0x22c59a[_0x15e1('0x1c')]]){logger[_0x15e1('0x26')](_0x15e1('0x54'),_0x22c59a['uniqueid'],_0x22c59a[_0x15e1('0x1c')],_0x22c59a[_0x15e1('0x1d')]);return RpcUser['savePause'](this['agents'][_0x22c59a[_0x15e1('0x1c')]],_0x15e1('0x55'),_0x22c59a[_0x15e1('0x30')]);}}}catch(_0x1776a1){logger[_0x15e1('0x38')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x1776a1['message']);}};module['exports']=Acw; \ No newline at end of file +var _0x9c8c=['mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','format','uniqueid','updateAcw','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','catch','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','linkedid','[ACW][syncHangupRequest]\x20%s','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','[ACW][syncAgentRingNoAnswer]\x20%s','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0x9c8c,0x88));var _0xc9c8=function(_0x8790ef,_0x281e08){_0x8790ef=_0x8790ef-0x0;var _0x1fb10d=_0x9c8c[_0x8790ef];return _0x1fb10d;};'use strict';var _=require('lodash');var moment=require(_0xc9c8('0x0'));var ami=require(_0xc9c8('0x1'));var logger=require(_0xc9c8('0x2'))(_0xc9c8('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xc9c8('0x4'));function Acw(_0xb8ada3){this[_0xc9c8('0x5')]=_0xb8ada3[_0xc9c8('0x5')];this['agents']=_0xb8ada3[_0xc9c8('0x6')];this[_0xc9c8('0x7')]=_0xb8ada3[_0xc9c8('0x7')];this[_0xc9c8('0x8')]={};ami['on'](_0xc9c8('0x9'),this[_0xc9c8('0xa')][_0xc9c8('0xb')](this));ami['on'](_0xc9c8('0xc'),this[_0xc9c8('0xd')][_0xc9c8('0xb')](this));ami['on'](_0xc9c8('0xe'),this['syncHangup']['bind'](this));ami['on'](_0xc9c8('0xf'),this[_0xc9c8('0x10')][_0xc9c8('0xb')](this));ami['on']('attendedtransfer',this[_0xc9c8('0x11')]['bind'](this));ami['on'](_0xc9c8('0x12'),this['syncBlindTransfer'][_0xc9c8('0xb')](this));ami['on'](_0xc9c8('0x13'),this[_0xc9c8('0x14')][_0xc9c8('0xb')](this));}function getDiff(_0x32b33a){var _0x1bb679=moment()[_0xc9c8('0x15')](0x0);var _0x2763b9=moment(_0x32b33a)['milliseconds'](0x0);return _0x1bb679['diff'](_0x2763b9,'seconds');}Acw[_0xc9c8('0x16')][_0xc9c8('0x17')]=function(_0x3a0dfb){try{var _0x5759fd=this;var _0xbd6b6=this['channels'][_0x3a0dfb][_0xc9c8('0x18')];var _0x4fffd3=this[_0xc9c8('0x8')][_0x3a0dfb][_0xc9c8('0x19')];var _0x18c6bc=this[_0xc9c8('0x5')][_0x4fffd3];var _0x1dd5a0=![];var _0x5f1b8b=_0xc9c8('0x1a');if(_0x18c6bc[_0xc9c8('0x1b')]){if(_0x18c6bc[_0xc9c8('0x1c')][_0xc9c8('0x1d')]){_0x1dd5a0=!![];_0x5f1b8b=_0x18c6bc[_0xc9c8('0x1c')][_0xc9c8('0x1d')];}}return ami[_0xc9c8('0x1e')]({'action':_0xc9c8('0x1f'),'interface':_0xbd6b6,'paused':!![],'reason':_0x5f1b8b})[_0xc9c8('0x20')](function(){if(_0x5759fd['agents'][_0xbd6b6]){return RpcUser[_0xc9c8('0x21')](_0x5759fd['agents'][_0xbd6b6]['id'])[_0xc9c8('0x20')](function(_0x290639){if(_0x290639&&!_0x290639[_0xc9c8('0x22')]){logger[_0xc9c8('0x23')](_0xc9c8('0x24'),_0x3a0dfb,_0xbd6b6,_0x4fffd3);var _0x1782cf=_0x5759fd['channels'][_0x3a0dfb]['attended']&&_0x5759fd[_0xc9c8('0x8')][_0x3a0dfb][_0xc9c8('0x25')]?_0x5759fd[_0xc9c8('0x8')][_0x3a0dfb][_0xc9c8('0x25')]:_0x3a0dfb;return RpcUser['savePause'](_0x5759fd['agents'][_0xbd6b6],_0x5f1b8b,_0x1782cf)[_0xc9c8('0x20')](function(){if(!_0x1dd5a0){_0x5759fd[_0xc9c8('0x7')][_0xbd6b6]={};logger[_0xc9c8('0x23')](_0xc9c8('0x26'),_0x3a0dfb,_0x5759fd[_0xc9c8('0x5')][_0x4fffd3][_0xc9c8('0x27')],_0xbd6b6,_0x4fffd3);_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x28')]=setTimeout(_0x5759fd[_0xc9c8('0x29')]['bind'](_0x5759fd,_0xbd6b6),_0x5759fd[_0xc9c8('0x5')][_0x4fffd3][_0xc9c8('0x27')]*0x3e8);_0x5759fd['timers'][_0xbd6b6]['lastPauseAt']=moment()[_0xc9c8('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x2b')]=_0x3a0dfb;_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x19')]=_0x4fffd3;_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x2c')]=function(){var _0x18d659=getDiff(_0x5759fd[_0xc9c8('0x7')][_0xbd6b6]['lastPauseAt']);clearTimeout(_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x28')]);_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x18d659},_0x5759fd[_0xc9c8('0x7')][_0xbd6b6][_0xc9c8('0x2b')],_0xbd6b6)['then'](function(_0x350b59){logger[_0xc9c8('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x3a0dfb,_0x18d659,_0x350b59);})['catch'](function(_0x391344){logger['error'](_0xc9c8('0x2d'),_0x3a0dfb,_0x391344);});delete _0x5759fd[_0xc9c8('0x7')][_0xbd6b6];};}});}else{logger[_0xc9c8('0x23')](_0xc9c8('0x2e'),_0x3a0dfb,_0xbd6b6,_0x4fffd3);}});}})['catch'](function(){logger[_0xc9c8('0x2f')](_0xc9c8('0x26'),_0x3a0dfb,_0x5759fd[_0xc9c8('0x5')][_0x4fffd3]['acwTimeout'],_0xbd6b6,_0x4fffd3);})[_0xc9c8('0x30')](function(){delete _0x5759fd[_0xc9c8('0x8')][_0x3a0dfb];});}catch(_0x3bcc72){logger[_0xc9c8('0x2f')](_0xc9c8('0x31'),_0x3bcc72['message']);}};Acw[_0xc9c8('0x16')][_0xc9c8('0x29')]=function(_0x5d2a79){try{var _0x44e021=this;if(_0x44e021[_0xc9c8('0x7')][_0x5d2a79]){_0x44e021[_0xc9c8('0x7')][_0x5d2a79]['timer']=![];var _0x16bff8=_0x44e021[_0xc9c8('0x7')][_0x5d2a79][_0xc9c8('0x2b')];var _0x1867b8=_0x44e021[_0xc9c8('0x7')][_0x5d2a79][_0xc9c8('0x19')];var _0x188453=_0x44e021['voiceQueues'][_0x1867b8][_0xc9c8('0x27')];logger[_0xc9c8('0x23')](_0xc9c8('0x32'),_0x16bff8,_0x5d2a79);RpcUser['saveUnpause'](this['agents'][_0x5d2a79]);RpcVoiceAgentReport['update']({'acwtime':_0x188453,'agentacw':!![]},_0x16bff8,_0x5d2a79)[_0xc9c8('0x20')](function(_0x34ed98){logger['info']('[%s][UPDATE][ACWTIME:%s]',_0x16bff8,_0x188453,_0x34ed98);})[_0xc9c8('0x33')](function(_0x5dc5df){logger[_0xc9c8('0x2f')](_0xc9c8('0x2d'),_0x16bff8,_0x5dc5df);});}else{logger[_0xc9c8('0x2f')](_0xc9c8('0x34'),_0x5d2a79);if(_0x44e021[_0xc9c8('0x7')]){logger['info'](_0xc9c8('0x35'),JSON[_0xc9c8('0x36')](_0x44e021[_0xc9c8('0x7')]));}}}catch(_0x525c28){logger[_0xc9c8('0x2f')](_0xc9c8('0x37'),_0x525c28[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')][_0xc9c8('0xa')]=function(_0x27301d){try{if(this[_0xc9c8('0x5')][_0x27301d[_0xc9c8('0x19')]]&&(this[_0xc9c8('0x5')][_0x27301d[_0xc9c8('0x19')]][_0xc9c8('0x3')]||this[_0xc9c8('0x5')][_0x27301d['queue']][_0xc9c8('0x1b')])){if(this[_0xc9c8('0x6')][_0x27301d['interface']]){this[_0xc9c8('0x8')][_0x27301d[_0xc9c8('0x2b')]]={'queue':_0x27301d[_0xc9c8('0x19')],'interface':_0x27301d[_0xc9c8('0x18')],'destlinkedid':_0x27301d[_0xc9c8('0x25')]};}}}catch(_0x1c8b00){logger[_0xc9c8('0x2f')](_0xc9c8('0x39'),_0x1c8b00[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')]['syncAgentConnectPreview']=function(_0x396025){try{if(this['voiceQueues'][_0x396025['queue']]&&(this['voiceQueues'][_0x396025['queue']][_0xc9c8('0x3')]||this[_0xc9c8('0x5')][_0x396025[_0xc9c8('0x19')]]['mandatoryDisposition'])){if(this[_0xc9c8('0x6')][_0x396025['interface']]){this['channels'][_0x396025[_0xc9c8('0x2b')]]={'queue':_0x396025[_0xc9c8('0x19')],'interface':_0x396025[_0xc9c8('0x18')]};}}}catch(_0xc606ca){logger['error'](_0xc9c8('0x3a'),_0xc606ca[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')][_0xc9c8('0xd')]=function(_0x383b1b){try{if(this[_0xc9c8('0x8')][_0x383b1b[_0xc9c8('0x2b')]]&&_[_0xc9c8('0x3b')](this[_0xc9c8('0x8')][_0x383b1b['uniqueid']][_0xc9c8('0x3c')])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x383b1b[_0xc9c8('0x2b')]);this[_0xc9c8('0x17')](_0x383b1b[_0xc9c8('0x2b')]);}else if(this[_0xc9c8('0x8')][_0x383b1b[_0xc9c8('0x3d')]]&&_[_0xc9c8('0x3b')](this[_0xc9c8('0x8')][_0x383b1b[_0xc9c8('0x3d')]]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x383b1b[_0xc9c8('0x3d')]);this[_0xc9c8('0x17')](_0x383b1b[_0xc9c8('0x3d')]);}}catch(_0x185f6f){logger[_0xc9c8('0x2f')](_0xc9c8('0x3e'),_0x185f6f[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')][_0xc9c8('0x3f')]=function(_0x4ea099){try{if(this[_0xc9c8('0x8')][_0x4ea099['uniqueid']]&&this['channels'][_0x4ea099[_0xc9c8('0x2b')]][_0xc9c8('0x3c')]){logger[_0xc9c8('0x23')](_0xc9c8('0x40'),_0x4ea099['uniqueid']);this[_0xc9c8('0x17')](_0x4ea099[_0xc9c8('0x2b')]);}else if(this[_0xc9c8('0x8')][_0x4ea099[_0xc9c8('0x3d')]]&&this['channels'][_0x4ea099['linkedid']][_0xc9c8('0x3c')]){logger[_0xc9c8('0x23')](_0xc9c8('0x41'),_0x4ea099['linkedid']);this[_0xc9c8('0x17')](_0x4ea099[_0xc9c8('0x3d')]);}}catch(_0x28087a){logger[_0xc9c8('0x2f')](_0xc9c8('0x42'),_0x28087a[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')]['syncAttendedTransfer']=function(_0x3aa4d1){try{if(!_['isNil'](this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x43')]])){this[_0xc9c8('0x17')](_0x3aa4d1[_0xc9c8('0x43')]);if(this['channels'][_0x3aa4d1['secondtransfereruniqueid']]){this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x44')]][_0xc9c8('0x3c')]=!![];this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x45')]]=this[_0xc9c8('0x8')][_0x3aa4d1['secondtransfereruniqueid']];delete this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x44')]];}}else if(!_[_0xc9c8('0x46')](this[_0xc9c8('0x8')][_0x3aa4d1['transfertargetuniqueid']])){this[_0xc9c8('0x17')](_0x3aa4d1[_0xc9c8('0x45')]);if(this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x47')]]){this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x47')]][_0xc9c8('0x3c')]=!![];this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x43')]]=this[_0xc9c8('0x8')][_0x3aa4d1[_0xc9c8('0x47')]];delete this['channels'][_0x3aa4d1['origtransfereruniqueid']];}}}catch(_0x29ab72){logger[_0xc9c8('0x2f')](_0xc9c8('0x48'),_0x29ab72[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')]['syncBlindTransfer']=function(_0x5c7b0a){try{if(this[_0xc9c8('0x8')][_0x5c7b0a[_0xc9c8('0x49')]]){logger[_0xc9c8('0x23')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xc9c8('0x36')](_0x5c7b0a['transfereruniqueid']));this[_0xc9c8('0x17')](_0x5c7b0a['transfereruniqueid']);}else if(this[_0xc9c8('0x8')][_0x5c7b0a[_0xc9c8('0x4a')]]){logger[_0xc9c8('0x23')](_0xc9c8('0x4b'),JSON[_0xc9c8('0x36')](_0x5c7b0a[_0xc9c8('0x4a')]));this[_0xc9c8('0x17')](_0x5c7b0a[_0xc9c8('0x4a')]);}}catch(_0x334042){logger[_0xc9c8('0x2f')](_0xc9c8('0x4c'),_0x334042[_0xc9c8('0x38')]);}};Acw[_0xc9c8('0x16')][_0xc9c8('0x10')]=function(_0x3f86e1){try{if(this[_0xc9c8('0x5')][_0x3f86e1[_0xc9c8('0x19')]]&&this['voiceQueues'][_0x3f86e1[_0xc9c8('0x19')]][_0xc9c8('0x4d')]===_0xc9c8('0x4e')){if(this['agents'][_0x3f86e1[_0xc9c8('0x18')]]){logger[_0xc9c8('0x23')](_0xc9c8('0x4f'),_0x3f86e1[_0xc9c8('0x2b')],_0x3f86e1['interface'],_0x3f86e1[_0xc9c8('0x19')]);return RpcUser[_0xc9c8('0x50')](this[_0xc9c8('0x6')][_0x3f86e1['interface']],'Auto-Pause',_0x3f86e1[_0xc9c8('0x2b')]);}}}catch(_0x23eeef){logger[_0xc9c8('0x2f')](_0xc9c8('0x51'),_0x23eeef[_0xc9c8('0x38')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 5fa12ce..95f204c 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 _0x917f=['port','username','password','keepConnected','Action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','[ami.js][fullybooted]','exports','asterisk-manager','util','ami','asterisk'];(function(_0x287a47,_0x2f731c){var _0x3fb726=function(_0xbedc33){while(--_0xbedc33){_0x287a47['push'](_0x287a47['shift']());}};_0x3fb726(++_0x2f731c);}(_0x917f,0x188));var _0xf917=function(_0x36f8b1,_0xfd77da){_0x36f8b1=_0x36f8b1-0x0;var _0x329930=_0x917f[_0x36f8b1];return _0x329930;};'use strict';var Manager=require(_0xf917('0x0'));var BPromise=require('bluebird');var util=require(_0xf917('0x1'));var logger=require('../../config/logger')(_0xf917('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0xf917('0x3')][_0xf917('0x4')],config[_0xf917('0x3')]['ip'],config[_0xf917('0x3')][_0xf917('0x5')],config['asterisk'][_0xf917('0x6')],!![]);ami[_0xf917('0x7')]();ami[_0xf917('0x8')]=BPromise['promisify'](ami['action']);function error(_0x4f0fe3){logger[_0xf917('0x9')](util[_0xf917('0xa')](_0xf917('0xb'),config[_0xf917('0x3')]['username'],config[_0xf917('0x3')]['ip'],config[_0xf917('0x3')]['port'],util['inspect'](_0x4f0fe3,![],null)));}function close(){logger[_0xf917('0x9')](util[_0xf917('0xa')](_0xf917('0xc'),config[_0xf917('0x3')]['username'],config[_0xf917('0x3')]['ip'],config[_0xf917('0x3')][_0xf917('0x4')]));}ami['actionSipShowRegistry']=function(){return function(){return ami[_0xf917('0x8')]({'action':_0xf917('0xd')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xf917('0xe')});};};ami[_0xf917('0xf')]=function(){return function(){return ami['Action']({'action':_0xf917('0x10')});};};ami[_0xf917('0x11')]=function(){return function(){return ami[_0xf917('0x8')]({'action':_0xf917('0x12')});};};ami[_0xf917('0x13')]=function(){return function(){return ami[_0xf917('0x8')]({'action':_0xf917('0x14')});};};function connect(){logger[_0xf917('0x15')](util[_0xf917('0xa')](_0xf917('0x16'),config[_0xf917('0x3')][_0xf917('0x5')],config[_0xf917('0x3')]['ip'],config[_0xf917('0x3')]['port']));ami[_0xf917('0x17')](_0xf917('0x9'),error);ami['once'](_0xf917('0x18'),close);}ami['on'](_0xf917('0x19'),connect);ami['on'](_0xf917('0x1a'),function(_0x426096){logger[_0xf917('0x15')](util[_0xf917('0xa')](_0xf917('0x1b'),config[_0xf917('0x3')][_0xf917('0x5')],config['asterisk']['ip'],config[_0xf917('0x3')]['port'],util[_0xf917('0x1c')](_0x426096,![],null)));});ami['on'](_0xf917('0x1d'),function(){logger[_0xf917('0x15')](util[_0xf917('0xa')](_0xf917('0x1e'),config[_0xf917('0x3')][_0xf917('0x5')],config['asterisk']['ip'],config[_0xf917('0x3')][_0xf917('0x4')]));return Promise[_0xf917('0x1f')]()[_0xf917('0x20')](ami['actionSipShowRegistry']())[_0xf917('0x20')](ami[_0xf917('0x21')]())['then'](ami[_0xf917('0xf')]())[_0xf917('0x20')](ami[_0xf917('0x11')]())[_0xf917('0x20')](ami['actionCoreShowChannels']())['catch'](function(_0x363a86){logger['error'](_0xf917('0x22'),util[_0xf917('0x1c')](_0x363a86,{'showHidden':![],'depth':null}));});});ami['once'](_0xf917('0x9'),error);ami[_0xf917('0x17')](_0xf917('0x18'),close);module[_0xf917('0x23')]=ami; \ No newline at end of file +var _0x6acb=['action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','resolve','then','catch','[ami.js][fullybooted]','exports','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action'];(function(_0x1b3dfb,_0x18e1e7){var _0x479ec2=function(_0x15e248){while(--_0x15e248){_0x1b3dfb['push'](_0x1b3dfb['shift']());}};_0x479ec2(++_0x18e1e7);}(_0x6acb,0x184));var _0xb6ac=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x6acb[_0x2134b7];return _0x6c5914;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require('util');var logger=require(_0xb6ac('0x0'))('ami');var config=require(_0xb6ac('0x1'));var ami=new Manager(config[_0xb6ac('0x2')][_0xb6ac('0x3')],config[_0xb6ac('0x2')]['ip'],config[_0xb6ac('0x2')][_0xb6ac('0x4')],config[_0xb6ac('0x2')][_0xb6ac('0x5')],!![]);ami[_0xb6ac('0x6')]();ami[_0xb6ac('0x7')]=BPromise['promisify'](ami[_0xb6ac('0x8')]);function error(_0x217342){logger[_0xb6ac('0x9')](util[_0xb6ac('0xa')](_0xb6ac('0xb'),config[_0xb6ac('0x2')][_0xb6ac('0x4')],config['asterisk']['ip'],config[_0xb6ac('0x2')]['port'],util[_0xb6ac('0xc')](_0x217342,![],null)));}function close(){logger[_0xb6ac('0x9')](util['format'](_0xb6ac('0xd'),config['asterisk'][_0xb6ac('0x4')],config['asterisk']['ip'],config['asterisk'][_0xb6ac('0x3')]));}ami[_0xb6ac('0xe')]=function(){return function(){return ami[_0xb6ac('0x7')]({'action':'sipshowregistry'});};};ami[_0xb6ac('0xf')]=function(){return function(){return ami['Action']({'action':_0xb6ac('0x10')});};};ami[_0xb6ac('0x11')]=function(){return function(){return ami[_0xb6ac('0x7')]({'action':_0xb6ac('0x12')});};};ami[_0xb6ac('0x13')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0xb6ac('0x14')]=function(){return function(){return ami[_0xb6ac('0x7')]({'action':'coreshowchannels'});};};function connect(){logger[_0xb6ac('0x15')](util['format'](_0xb6ac('0x16'),config['asterisk']['username'],config[_0xb6ac('0x2')]['ip'],config[_0xb6ac('0x2')][_0xb6ac('0x3')]));ami['once']('error',error);ami[_0xb6ac('0x17')](_0xb6ac('0x18'),close);}ami['on'](_0xb6ac('0x19'),connect);ami['on']('shutdown',function(_0x6e66c6){logger[_0xb6ac('0x15')](util['format'](_0xb6ac('0x1a'),config[_0xb6ac('0x2')][_0xb6ac('0x4')],config['asterisk']['ip'],config['asterisk'][_0xb6ac('0x3')],util['inspect'](_0x6e66c6,![],null)));});ami['on'](_0xb6ac('0x1b'),function(){logger['info'](util[_0xb6ac('0xa')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0xb6ac('0x2')][_0xb6ac('0x4')],config[_0xb6ac('0x2')]['ip'],config[_0xb6ac('0x2')]['port']));return Promise[_0xb6ac('0x1c')]()[_0xb6ac('0x1d')](ami[_0xb6ac('0xe')]())['then'](ami[_0xb6ac('0xf')]())['then'](ami[_0xb6ac('0x11')]())['then'](ami['actionQueueSummary']())[_0xb6ac('0x1d')](ami[_0xb6ac('0x14')]())[_0xb6ac('0x1e')](function(_0x42b6ac){logger[_0xb6ac('0x9')](_0xb6ac('0x1f'),util[_0xb6ac('0xc')](_0x42b6ac,{'showHidden':![],'depth':null}));});});ami[_0xb6ac('0x17')](_0xb6ac('0x9'),error);ami[_0xb6ac('0x17')](_0xb6ac('0x18'),close);module[_0xb6ac('0x20')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 38845ab..cf841a9 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x70e0,0x17b));var _0x070e=function(_0x281d73,_0x1098cc){_0x281d73=_0x281d73-0x0;var _0x5bd8a1=_0x70e0[_0x281d73];return _0x5bd8a1;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb7e7[_0x580576];return _0x3f55a0;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index c250561..1cbef24 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 _0xadaa=['voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','VoiceQueueId','[rescheduleContact][Abandoned]','endtime','syncNewExten','channel','actionid','rrmemory','roundrobin','isNil','locked','paused','agents','stateinterface','queueBooked','idHopper','strategy','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','HANGUP','outboundAnswerAgiCallsDay','AMD','custom:amd','buildObj','amd','saveInDb','[syncHangupInAMD]','Machine','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','value','HangupInAMD','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','queuesSummary','running','isPreviewCampaign','resolve','statusMessage','available','talking','pTalking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','filter','dialPreviewRecallmeReminder','online','reachable','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','[uniqueid]','clearZombieChannels','[actions]','enqueue','No\x20such\x20channel','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','user:%s','launchHandleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialAgentRejectRetryFrequency','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','custom:agentreject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','swapAdditionalPhones','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalDroppedCallsTimeout','predictiveIntervalHitRate','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','dialPredictiveOptimizationPercentage','predictiveIntervalPauses','[CatchErlangB]','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','tryOriginatePredictive','[handlePredictive][limitChannel]','getContactDialer','countReScheduled','RUNNING','[actionOriginate]\x20','checkIsBlackList','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','exports','util','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','../ami','defaults','socket.io-emitter','redis','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','tail','sequence','preview','voiceQueues','campaigns','trunks','maxNumberOriginate','channels','actions','contactsId','startProgressive','ivrOriginated','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','varset','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','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','---------\x20ErlangB\x20---------','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','inspect','checkContactLowerLimitOriginate','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','starttime','queueStatusComplete','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','Error','stringify','prototype','isTrunkReachable','active','SIP/%s','status','unmonitored','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','Action','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','push','then','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','checkIsTrunkReachable','dialTimezone','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','[ifTime][promiseAll]','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','queue','uniqueId','uniqueid','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','syncAgentComplete','ivr','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','createHistory','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','countdropretry','countglobal','verifyAdditionalPhones'];(function(_0x5b221c,_0x343dde){var _0x189120=function(_0x115556){while(--_0x115556){_0x5b221c['push'](_0x5b221c['shift']());}};_0x189120(++_0x343dde);}(_0xadaa,0x14a));var _0xaada=function(_0x5bb0b3,_0x25f641){_0x5bb0b3=_0x5bb0b3-0x0;var _0x2df54b=_0xadaa[_0x5bb0b3];return _0x2df54b;};'use strict';var util=require(_0xaada('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require(_0xaada('0x1'));var rr=require('rr');var Redis=require(_0xaada('0x2'));var utils=require(_0xaada('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0xaada('0x4'));var config=require(_0xaada('0x5'));var logger=require(_0xaada('0x6'))('dialer');var loggerBooked=require(_0xaada('0x6'))(_0xaada('0x7'));var loggerPredictive=require('../../../config/logger')(_0xaada('0x8'));var loggerPredictiveCalls=require(_0xaada('0x6'))(_0xaada('0x9'));var loggerSyncQueueSummary=require(_0xaada('0x6'))('syncQueueSummary');var ami=require(_0xaada('0xa'));config['redis']=_[_0xaada('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xaada('0xc'))(new Redis(config[_0xaada('0xd')]));var cmHopper=require(_0xaada('0xe'));var voiceQueueRt=require(_0xaada('0xf'));var RpcSetting=require(_0xaada('0x10'));var Interval=require(_0xaada('0x11'));var Action=require(_0xaada('0x12'));var History=require(_0xaada('0x13'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0xaada('0x14'));var Hangup=require(_0xaada('0x15'));var ipAgi=process[_0xaada('0x16')][_0xaada('0x17')]||_0xaada('0x18');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x4a912d){this[_0xaada('0x19')]=this[_0xaada('0x19')]?this['tail']['finally'](_0x4a912d):_0x4a912d();};function Dialer(_0x44e12d,_0x5998e2){this[_0xaada('0x1a')]=new Sequence();this[_0xaada('0x1b')]=_0x5998e2;this[_0xaada('0x1c')]=_0x44e12d['voiceQueues'];this[_0xaada('0x1d')]=_0x44e12d[_0xaada('0x1d')];this['agents']=_0x44e12d['agents'];this[_0xaada('0x1e')]=_0x44e12d[_0xaada('0x1e')];this[_0xaada('0x1f')]=config[_0xaada('0x1f')]||0x2;this[_0xaada('0x20')]={};this[_0xaada('0x21')]={};this[_0xaada('0x22')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0xaada('0x23')]={};this[_0xaada('0x24')]={};this['queueBooked']={};this[_0xaada('0x25')]={};this['queuesSummary']={};ami['on'](_0xaada('0x26'),this[_0xaada('0x27')][_0xaada('0x28')](this));ami['on'](_0xaada('0x29'),this[_0xaada('0x2a')]['bind'](this));ami['on'](_0xaada('0x2b'),this['syncOriginateResponse']['bind'](this));ami['on'](_0xaada('0x2c'),this['syncAgentComplete']['bind'](this));ami['on'](_0xaada('0x2d'),this[_0xaada('0x2e')][_0xaada('0x28')](this));ami['on'](_0xaada('0x2f'),this[_0xaada('0x30')][_0xaada('0x28')](this));ami['on']('hangup',this[_0xaada('0x31')][_0xaada('0x28')](this));ami['on'](_0xaada('0x32'),this['syncNewExten']['bind'](this));ami['on'](_0xaada('0x33'),this['syncVarSet']['bind'](this));ami['on']('queuemember',this[_0xaada('0x34')][_0xaada('0x28')](this));ami['on'](_0xaada('0x35'),this[_0xaada('0x36')]['bind'](this));this[_0xaada('0x37')]();this['loopClearZombieChannels']();RpcSetting[_0xaada('0x38')]()['then'](function(_0x1a3182){previewRecallmeReminderInterval=_0x1a3182['previewRecallmeReminderInterval'];});}function isNotNull(_0x20d96a){return _0x20d96a!==null&&!_[_0xaada('0x39')](_0x20d96a);}function msgResponse(_0x541e91,_0x4370b7,_0x15bc31){return{'action':_0x541e91,'response':_0x4370b7,'message':_0x15bc31,'stack':_0x15bc31};}function emit(_0x392f5d,_0x1c262f,_0x53238b){io['to'](_0x392f5d)[_0xaada('0x3a')](_0x1c262f,_0x53238b);}function emitOutboundVoiceQueueSummary(_0x4b91d5){if(_0x4b91d5[_0xaada('0x3b')]==='outbound'){logger[_0xaada('0x3c')](_0xaada('0x3d'),util['inspect'](_0x4b91d5,{'showHidden':![],'depth':null}));emit(util[_0xaada('0x3e')](_0xaada('0x3f'),_0x4b91d5[_0xaada('0x40')]),_0xaada('0x41'),_0x4b91d5);}}function checkGetDataPredictive(_0x978491){if(isNotNull(_0x978491)&&!_[_0xaada('0x42')](_0x978491)){loggerPredictive[_0xaada('0x43')](_0xaada('0x44'));loggerPredictive[_0xaada('0x43')](_0xaada('0x45'),_0x978491[_0xaada('0x46')]);loggerPredictive['info'](_0xaada('0x47'),_0x978491[_0xaada('0x48')]);loggerPredictive[_0xaada('0x43')](_0xaada('0x49'),_0x978491['predictiveIntervalDroppedCallsTimeout']);loggerPredictive['info'](_0xaada('0x4a'),_0x978491[_0xaada('0x4b')]);loggerPredictive[_0xaada('0x43')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x978491[_0xaada('0x4c')]);loggerPredictive[_0xaada('0x43')](_0xaada('0x4d'),_0x978491[_0xaada('0x4e')]);loggerPredictive[_0xaada('0x43')](_0xaada('0x4f'));if(_0x978491[_0xaada('0x46')]>0x0){if(!_['isUndefined'](_0x978491[_0xaada('0x4e')])&&_0x978491[_0xaada('0x4e')]>0x0){return!![];}loggerPredictive['info'](_0xaada('0x50'));if(!_[_0xaada('0x39')](_0x978491[_0xaada('0x4c')])&&_0x978491[_0xaada('0x4c')]>0x0){return!![];}loggerPredictive[_0xaada('0x43')](_0xaada('0x51'));}else{loggerPredictive[_0xaada('0x43')](_0xaada('0x52'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0xf9b066){return function(_0x54a2ed){loggerPredictive[_0xaada('0x43')](_0xaada('0x53'));loggerPredictive[_0xaada('0x43')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54a2ed[_0xaada('0x54')]);loggerPredictive[_0xaada('0x43')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54a2ed[_0xaada('0x55')]);loggerPredictive[_0xaada('0x43')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x54a2ed[_0xaada('0x56')]);loggerPredictive[_0xaada('0x43')](_0xaada('0x57'),_0x54a2ed[_0xaada('0x58')]);loggerPredictive[_0xaada('0x43')](_0xaada('0x59'),_0x54a2ed[_0xaada('0x56')]);loggerPredictive[_0xaada('0x43')](_0xaada('0x4f'));_[_0xaada('0x5a')](_0xf9b066,_0x54a2ed);};}function ifInterval(_0x23ed86,_0xae8c67){if(_['isUndefined'](_0xae8c67)){return![];}return utils[_0xaada('0x5b')](undefined,_0xae8c67)<_0x23ed86*0x3c;}function clearPredictiveAttributes(_0x4e30dd){if(_0x4e30dd['startProgressive']){_0x4e30dd[_0xaada('0x23')]=undefined;loggerPredictive[_0xaada('0x3c')](_0x4e30dd['name'],_0xaada('0x5c'));}if(_0x4e30dd['startPredictive']){_0x4e30dd[_0xaada('0x5d')]=undefined;loggerPredictive[_0xaada('0x3c')](_0x4e30dd[_0xaada('0x40')],_0xaada('0x5e'));}if(_0x4e30dd[_0xaada('0x5f')]){clearInterval(_0x4e30dd[_0xaada('0x5f')]);_0x4e30dd[_0xaada('0x5f')]=undefined;loggerPredictive[_0xaada('0x3c')](_0x4e30dd['name'],_0xaada('0x60'));}}function loggerCatchPredictive(_0x10ca8b,_0x5b0e1c){return function(_0x541ee2){loggerPredictive[_0xaada('0x61')](_0x5b0e1c[_0xaada('0x40')],_0x10ca8b);loggerPredictive[_0xaada('0x61')](_0x541ee2[_0xaada('0x62')]);clearPredictiveAttributes(_0x5b0e1c);};}function loggerCatch(_0x2d69d8){return function(_0x4ff3e2){logger[_0xaada('0x61')](_0x2d69d8,util[_0xaada('0x63')](_0x4ff3e2,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4bb155,_0x4d63e2,_0x49c8cc){return function(_0x52b7fd){utils[_0xaada('0x64')](_0x4d63e2,_0x49c8cc,0x0);logger[_0xaada('0x61')](_0x4bb155,util['inspect'](_0x52b7fd,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x3e2f39){return function(_0x131176){if(isNotNull(_0x131176)&&isNotNull(_0x131176[0x0])){if(_0x131176[0x0][_0xaada('0x65')]>0x0){_0x3e2f39[_0xaada('0x66')]=utils['CAMPAIGN_STATUS'][_0xaada('0x67')];logger[_0xaada('0x43')](_0xaada('0x68')+_0x3e2f39[_0xaada('0x40')],_0x131176[0x0][_0xaada('0x65')],_0xaada('0x69'));}else{_0x3e2f39[_0xaada('0x66')]=utils[_0xaada('0x6a')]['NO_AVAILABLE_CONTACTS'];logger['info'](_0xaada('0x6b')+_0x3e2f39['name']);}}};}function createObjHistory(_0x46e116,_0x3d1ce6,_0x56bee6,_0x346c53,_0x22c72c){_0x46e116[_0xaada('0x66')]=_0x56bee6;var _0x3aa511=new Action(_0x46e116,_0x3d1ce6);var _0x1efd9a=new History(_0x3aa511);_0x1efd9a[_0xaada('0x6c')]=_0x346c53;_0x1efd9a[_0xaada('0x6d')]=_0x22c72c;_0x1efd9a['endtime']=_0x3aa511[_0xaada('0x6e')];return _0x1efd9a;}function unlockQueueStatus(_0x31777f,_0x529f79){setTimeout(function(){if(_[_0xaada('0x39')](_0x31777f[_0xaada('0x6f')])){loggerBooked[_0xaada('0x61')]('[unlockQueueStatus][undefined]',_0x529f79);}_0x31777f[_0xaada('0x6f')]=!![];loggerBooked[_0xaada('0x43')]('[booked][unlockQueueStatus]',_0x529f79,JSON['stringify'](_[_0xaada('0x70')](_0x31777f,[_0xaada('0x40'),_0xaada('0x6f')])));},0x1f3);}function checkInterval(_0x10d32e){return function(){if(!isNotNull(_0x10d32e[_0xaada('0x71')])){_0x10d32e[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x72')];throw _0x10d32e[_0xaada('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x10d32e[_0xaada('0x71')][_0xaada('0x73')])){_0x10d32e[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x72')];throw _0x10d32e[_0xaada('0x40')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0xaada('0x42')](_0x10d32e[_0xaada('0x71')][_0xaada('0x73')]))){_0x10d32e[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x72')];throw _0x10d32e[_0xaada('0x40')]+_0xaada('0x74');}};}function checkIsIVRCampaignActive(_0x4c9bda){return function(){if(!utils[_0xaada('0x75')](_0x4c9bda)){_0x4c9bda[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x76')];throw _0x4c9bda[_0xaada('0x40')]+_0xaada('0x77');}};}function emitCampaignSummary(_0x16a478){if(utils[_0xaada('0x78')](_0x16a478)){emit(util[_0xaada('0x3e')]('campaign:ivr:%s',_0x16a478[_0xaada('0x40')]),_0xaada('0x79'),_0x16a478);}}function loggerCatchQueueSummary(_0x1cbcb9,_0xdd8ec6){return function(_0x2f27e9){clearPredictiveAttributes(_0xdd8ec6);emitCampaignSummary(_0xdd8ec6);loggerSyncQueueSummary[_0xaada('0x3c')](_0x1cbcb9,util[_0xaada('0x63')](_0x2f27e9,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3a53d0){if(_0x3a53d0[_0xaada('0x7a')]){if(_0x3a53d0['originated']===0x0){_0x3a53d0[_0xaada('0x7a')]=![];_0x3a53d0[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x76')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3a53d0['name'],_0xaada('0x7b'));}else{_0x3a53d0[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x7c')];loggerSyncQueueSummary['debug'](_0xaada('0x7d'),_0x3a53d0['name'],_0xaada('0x7e'));}emitCampaignSummary(_0x3a53d0);}}function myreject(_0x83dadc){return function(_0x1d0022){return _0x83dadc(msgResponse('[ifTime][Action]',_0xaada('0x7f'),JSON[_0xaada('0x80')](_0x1d0022)));};}Dialer[_0xaada('0x81')][_0xaada('0x82')]=function(_0x553da2){return!_[_0xaada('0x39')](_0x553da2)&&_0x553da2&&!_['isUndefined'](_0x553da2['name'])&&!_[_0xaada('0x39')](_0x553da2[_0xaada('0x83')])&&_0x553da2['active']&&(this[_0xaada('0x1e')][util[_0xaada('0x3e')](_0xaada('0x84'),_0x553da2['name'])][_0xaada('0x85')]==='reachable'||this[_0xaada('0x1e')][util[_0xaada('0x3e')](_0xaada('0x84'),_0x553da2[_0xaada('0x40')])]['status']===_0xaada('0x86'));};Dialer['prototype']['checkIsTrunkReachable']=function(_0x594066){var _0x4e8131=this;return function(){if(!_0x4e8131[_0xaada('0x82')](_0x594066[_0xaada('0x87')])){if(!_0x4e8131[_0xaada('0x82')](_0x594066[_0xaada('0x88')])){_0x594066[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x89')];throw _0x594066[_0xaada('0x40')]+_0xaada('0x8a');}}};};Dialer[_0xaada('0x81')][_0xaada('0x8b')]=function(_0x55ff94,_0x278937,_0x59c40f,_0x6b77c9){var _0x7bfd8e=this;return function(){var _0x1786de=!![];return _0x7bfd8e[_0xaada('0x8c')](_0x55ff94,_0x278937,_0x59c40f,_0x6b77c9,_0x1786de);};};Dialer[_0xaada('0x81')][_0xaada('0x8d')]=function(_0x4f2d37,_0x452f90,_0x19b078,_0x52d696){var _0x166036=this;return function(){var _0x5991b9=![];return _0x166036[_0xaada('0x8c')](_0x4f2d37['Intervals'],_0x452f90,_0x19b078,_0x52d696,_0x5991b9);};};Dialer[_0xaada('0x81')]['ifTimeIvr']=function(_0x28642d,_0x23ce32,_0x4bee7c,_0xaa9984,_0x174b7a){var _0x1d7130=[];return new Promise(function(_0x4535e9,_0x52c13f){if(!isNotNull(_0x28642d)){_0xaa9984[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x72')];return _0x52c13f(msgResponse('ifTime',_0xaada('0x8e'),_0x4bee7c+_0xaada('0x8f')));}if(_[_0xaada('0x42')](_0x28642d)){_0xaa9984[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x90')];return _0x52c13f(msgResponse(_0xaada('0x91'),'Failure',_0x4bee7c+_0xaada('0x92')));}if(_0x23ce32&&_[_0xaada('0x39')](config[_0xaada('0x93')][_0x23ce32])){_0xaa9984[_0xaada('0x66')]=utils['CAMPAIGN_STATUS'][_0xaada('0x94')];return _0x52c13f(msgResponse(_0xaada('0x91'),_0xaada('0x8e'),_0x4bee7c+_0xaada('0x95')+_0x23ce32));}if(_[_0xaada('0x96')](_0x28642d)){for(var _0x36f1fa=0x0;_0x36f1fa<_0x28642d[_0xaada('0x97')];_0x36f1fa+=0x1){_0x1d7130['push'](ami[_0xaada('0x98')]({'action':_0xaada('0x99'),'command':util['format'](_0xaada('0x9a'),_0x28642d[_0x36f1fa][_0xaada('0x9b')],!_[_0xaada('0x39')](config['timezones'][_0x23ce32])?_0x23ce32:'')})['then'](function(_0x4ec6f6){return _0x4ec6f6[_0xaada('0x9c')][_0xaada('0x9d')](_0xaada('0x9e'))>=0x0;})[_0xaada('0x9f')](myreject(_0x52c13f)));}}else{_0x1d7130[_0xaada('0xa0')](ami[_0xaada('0x98')]({'action':_0xaada('0x99'),'command':util[_0xaada('0x3e')]('iftime\x20%s,%s',_0x28642d,!_['isUndefined'](config[_0xaada('0x93')][_0x23ce32])?_0x23ce32:'')})[_0xaada('0xa1')](function(_0x198e9e){return _0x198e9e[_0xaada('0x9c')]['indexOf']('true')>=0x0;})[_0xaada('0x9f')](myreject(_0x52c13f)));}Promise['all'](_0x1d7130)[_0xaada('0xa1')](function(_0x5e3329){var _0x42de42=_['some'](_0x5e3329);if(_0x42de42){return _0x4535e9(_0x42de42);}else{_0xaa9984[_0xaada('0x66')]=_0x174b7a?utils[_0xaada('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0xaada('0xa2')];return _0x52c13f(msgResponse('[ifTime][promiseAll]',_0xaada('0x8e'),_0xaada('0xa3')+_0x174b7a+'\x20'+_0x4bee7c+_0xaada('0xa4')+util[_0xaada('0x63')](_0x28642d,{'showHidden':![],'depth':null})+_0xaada('0xa5')+_0x23ce32));}})[_0xaada('0x9f')](function(_0x3da74f){return _0x52c13f(msgResponse(_0xaada('0x91'),'Failure',JSON['stringify'](_0x3da74f)));});});};Dialer[_0xaada('0x81')][_0xaada('0x37')]=function(){var _0x40ca64=this;return cmHopper[_0xaada('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0xaada('0xa1')](function(){setInterval(function(){_0x40ca64[_0xaada('0xa7')]();},0x3e8);});};Dialer[_0xaada('0x81')]['syncCampaigns']=function(){var _0x17a05f=this;var _0x17fbe2;for(var _0x5944c1 in this[_0xaada('0x1d')]){if(typeof this[_0xaada('0x1d')][_0x5944c1]!=='undefined'){_0x17fbe2=this[_0xaada('0x1d')][_0x5944c1];if(utils[_0xaada('0x78')](_0x17fbe2)&&utils[_0xaada('0x75')](_0x17fbe2)){_0x17fbe2[_0xaada('0x7a')]=!![];Promise['resolve']()[_0xaada('0xa1')](checkIsIVRCampaignActive(_0x17fbe2))['then'](checkInterval(_0x17fbe2))[_0xaada('0xa1')](_0x17a05f[_0xaada('0xa8')](_0x17fbe2))['then'](_0x17a05f['checkIfTime'](_0x17fbe2['dialGlobalInterval'],_0x17fbe2[_0xaada('0xa9')],_0x17fbe2[_0xaada('0x40')],_0x17fbe2))[_0xaada('0xa1')](_0x17a05f['checkIfTimeIntervals'](_0x17fbe2['Interval'],_0x17fbe2[_0xaada('0xa9')],_0x17fbe2[_0xaada('0x40')],_0x17fbe2))[_0xaada('0xa1')](_0x17a05f['launchHandleIvr'](_0x17fbe2))[_0xaada('0x9f')](loggerCatchQueueSummary('[syncCampaigns]',_0x17fbe2));}else{notSendMessagesCampaign(_0x17fbe2);}}}};Dialer[_0xaada('0x81')][_0xaada('0xaa')]=function(_0x11ab25){if(_0x11ab25[_0xaada('0xab')]!=='predictive'){clearPredictiveAttributes(_0x11ab25);}switch(_0x11ab25['dialMethod']){case _0xaada('0xac'):this[_0xaada('0xad')](_0x11ab25,0x1);break;case _0xaada('0xae'):this[_0xaada('0xad')](_0x11ab25,_0x11ab25[_0xaada('0xaf')]);break;case _0xaada('0x8'):this['predictive'](_0x11ab25);break;case _0xaada('0x7'):this['handlePower'](_0x11ab25,0x1);break;default:logger[_0xaada('0x61')](_0xaada('0xb0'),_0x11ab25[_0xaada('0x40')],_0xaada('0xb1'));}};Dialer[_0xaada('0x81')][_0xaada('0x91')]=function(_0x19d941,_0xae47c9){var _0x464e6d=_0x19d941[_0xaada('0xa9')];var _0x349630=_0xae47c9?_0x19d941['dialGlobalInterval']:_0x19d941[_0xaada('0x71')][_0xaada('0x73')];logger[_0xaada('0xb2')](_0xaada('0xb3'),_0x349630,_0x464e6d,_0x19d941[_0xaada('0x40')],util[_0xaada('0x3e')](_0xaada('0xb4'),_0x19d941[_0xaada('0x40')],_0x19d941['id']));var _0x246316=null;return Interval['intervalIftime'](_0x349630,_0x464e6d)[_0xaada('0xa1')](function(_0x4545ba){if(_0x4545ba===!![]){return _0x4545ba;}else{_0x19d941[_0xaada('0x66')]=_0xae47c9?utils[_0xaada('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xaada('0x6a')]['OVERTIME_INTERVAL'];_0x246316=msgResponse(_0xaada('0xb5'),_0xaada('0x8e'),_0xaada('0xa3')+_0xae47c9+'\x20'+_0x19d941[_0xaada('0x40')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0xaada('0x63')](_0x349630,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x464e6d);}if(_0x246316!==null){logger['silly'](_0xaada('0xb6'),_0x246316);_0x246316['isGlobal']=_0xae47c9;throw _0x246316;}})['catch'](function(_0x7a4c1a){logger[_0xaada('0x61')](_0xaada('0xb7'),_0x7a4c1a);throw msgResponse('[ifTime][Action]',_0xaada('0x7f'),util[_0xaada('0x63')](_0x7a4c1a,{'showHidden':![],'depth':null}));});};Dialer[_0xaada('0x81')][_0xaada('0x27')]=function(_0x4ca21e){if(this[_0xaada('0x1c')][_0x4ca21e[_0xaada('0xb8')]]){if(this[_0xaada('0xb9')][_0x4ca21e[_0xaada('0xba')]]&&this['uniqueId'][_0x4ca21e[_0xaada('0xba')]][_0xaada('0x3b')]!=='ivr'){this[_0xaada('0xbb')](this[_0xaada('0x1c')][_0x4ca21e['queue']]);this[_0xaada('0xb9')][_0x4ca21e[_0xaada('0xba')]]['answertime']=moment()[_0xaada('0x3e')](_0xaada('0xbc'));}}};Dialer['prototype'][_0xaada('0xbd')]=function(_0x5ba536){var _0x14bbe5=this[_0xaada('0xb9')][_0x5ba536[_0xaada('0xba')]];if(this['voiceQueues'][_0x5ba536[_0xaada('0xb8')]]){if(_0x14bbe5&&_0x14bbe5[_0xaada('0x3b')]!==_0xaada('0xbe')){delete this[_0xaada('0xb9')][_0x5ba536[_0xaada('0xba')]];this['voiceQueues'][_0x5ba536['queue']][_0xaada('0xbf')]+=0x1;var _0x5f50fc=new AgentComplete(_0x14bbe5,_0x5ba536);if(_0x5ba536[_0xaada('0xc0')]===_0xaada('0xc1')){_0x5f50fc[_0xaada('0xc2')]=this[_0xaada('0x1c')][_0x5ba536['queue']][_0xaada('0xc3')]&&this['voiceQueues'][_0x5ba536[_0xaada('0xb8')]]['dialAgiAfterHangupAgent']?moment()['format'](_0xaada('0xbc')):undefined;}hopperUtils[_0xaada('0xc4')](_0x5f50fc)[_0xaada('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0xaada('0xc5')](_0x5f50fc)['catch'](loggerCatch(_0xaada('0xc6')));}}};Dialer[_0xaada('0x81')][_0xaada('0x2a')]=function(_0x409dd8){var _0x35b40e=this[_0xaada('0xb9')][_0x409dd8[_0xaada('0xba')]];var _0x5bf82e=this;var _0x254c9e=![];var _0x9e5a6d;var _0x1b82b3;if(this['voiceQueues'][_0x409dd8[_0xaada('0xb8')]]){if(_0x35b40e&&_0x35b40e['type']!=='ivr'){delete this[_0xaada('0xb9')][_0x409dd8[_0xaada('0xba')]];this[_0xaada('0xbb')](this[_0xaada('0x1c')][_0x409dd8['queue']]);_0x35b40e[_0xaada('0xc7')]=moment()['format'](_0xaada('0xbc'));var _0x4c7d26=new QueueCallerAbandon(_0x35b40e,_0x409dd8);if(utils['getSeconds'](_0x35b40e['droptime'],_0x35b40e[_0xaada('0xc8')])>=_0x35b40e[_0xaada('0xc9')]){this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]]['outboundDropCallsDayTimeout']+=0x1;this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]][_0xaada('0xca')]+=0x1;_0x4c7d26[_0xaada('0x6c')]=0xa;_0x4c7d26['statedesc']='Drop';_0x4c7d26[_0xaada('0xcb')]='TIMEOUT';_0x4c7d26[_0xaada('0xc2')]=this['voiceQueues'][_0x409dd8[_0xaada('0xb8')]][_0xaada('0xc3')]?moment()[_0xaada('0x3e')](_0xaada('0xbc')):undefined;_0x4c7d26[_0xaada('0xcc')]+=0x1;_0x4c7d26[_0xaada('0xcd')]+=0x1;_0x9e5a6d=this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]]['dialDropRetryFrequency'];_0x1b82b3=this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0xaada('0xce')](_0x4c7d26,_0x4c7d26[_0xaada('0x6c')],_0x35b40e[_0xaada('0xcf')])[_0xaada('0xa1')](function(_0x4d5fb4){_0x254c9e=_0x4d5fb4[_0xaada('0xd0')]==0x1;if(_0x4c7d26[_0xaada('0xcc')]>=_0x5bf82e['voiceQueues'][_0x409dd8[_0xaada('0xb8')]]['dialDropMaxRetry']){_0x5bf82e[_0xaada('0xd1')](_0x4c7d26,_0x4d5fb4['additional']);}else{hopperUtils[_0xaada('0xd2')]({'active':![],'countdropretry':_0x4c7d26[_0xaada('0xcc')],'scheduledat':moment()[_0xaada('0xd3')](_0x5bf82e[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]][_0xaada('0xd4')],_0xaada('0xd5'))[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x35b40e[_0xaada('0xd6')],'ListId':_0x35b40e[_0xaada('0xd7')],'VoiceQueueId':_0x35b40e['VoiceQueueId']||undefined,'CampaignId':_0x35b40e[_0xaada('0xd8')]||undefined})['catch'](loggerCatch(_0xaada('0xd9')));var _0x3d81f2=new History(_0x4c7d26);_0x3d81f2[_0xaada('0x6c')]=0xa;_0x3d81f2[_0xaada('0x6d')]='Drop';_0x3d81f2[_0xaada('0x6e')]=moment()[_0xaada('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3d81f2['endtime']=_0x3d81f2[_0xaada('0x6e')];_0x3d81f2[_0xaada('0xda')]=_0x4c7d26[_0xaada('0xda')];_0x3d81f2[_0xaada('0xdb')]=_0x4c7d26[_0xaada('0xdb')];hopperUtils[_0xaada('0xc4')](_0x3d81f2)[_0xaada('0x9f')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0xaada('0xa1')](function(){if(_0x254c9e)hopperUtils['swapAdditionalPhones'](_0x4c7d26,_0x9e5a6d,_0x1b82b3)[_0xaada('0xa1')](function(){return 0x1;});});}else{this['voiceQueues'][_0x409dd8[_0xaada('0xb8')]][_0xaada('0x4b')]+=0x1;this[_0xaada('0x1c')][_0x409dd8['queue']][_0xaada('0xdc')]+=0x1;_0x4c7d26[_0xaada('0x6c')]=0xb;_0x4c7d26[_0xaada('0x6d')]=_0xaada('0xdd');_0x4c7d26[_0xaada('0xcb')]='CALLEREXIT';_0x4c7d26[_0xaada('0xde')]+=0x1;_0x4c7d26[_0xaada('0xcd')]+=0x1;_0x9e5a6d=this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]][_0xaada('0xdf')];_0x1b82b3=this[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]][_0xaada('0xe0')];hopperUtils[_0xaada('0xce')](_0x4c7d26,_0x4c7d26[_0xaada('0x6c')],_0x35b40e['voiceQueue'])['then'](function(_0x48280c){if(_0x4c7d26['countabandonedretry']>=_0x5bf82e[_0xaada('0x1c')][_0x409dd8[_0xaada('0xb8')]][_0xaada('0xe1')]){_0x5bf82e[_0xaada('0xd1')](_0x4c7d26,_0x48280c['additional']);}else{hopperUtils[_0xaada('0xd2')]({'active':![],'countabandonedretry':_0x4c7d26[_0xaada('0xde')],'scheduledat':moment()[_0xaada('0xd3')](_0x5bf82e[_0xaada('0x1c')][_0x409dd8['queue']][_0xaada('0xdf')],'minutes')[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x35b40e[_0xaada('0xd6')],'ListId':_0x35b40e[_0xaada('0xd7')],'VoiceQueueId':_0x35b40e[_0xaada('0xe2')]||undefined,'CampaignId':_0x35b40e[_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0xe3')));var _0x8e2997=new History(_0x4c7d26);_0x8e2997['state']=0xb;_0x8e2997[_0xaada('0x6d')]='Abandoned';_0x8e2997[_0xaada('0x6e')]=moment()[_0xaada('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');_0x8e2997[_0xaada('0xe4')]=_0x8e2997[_0xaada('0x6e')];_0x8e2997[_0xaada('0xda')]=_0x4c7d26[_0xaada('0xda')];_0x8e2997[_0xaada('0xdb')]=_0x4c7d26[_0xaada('0xdb')];hopperUtils['createHistory'](_0x8e2997)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0xaada('0xa1')](function(){if(_0x254c9e)hopperUtils['swapAdditionalPhones'](_0x4c7d26,_0x9e5a6d,_0x1b82b3)['then'](function(){return 0x1;});});}}}};Dialer[_0xaada('0x81')][_0xaada('0xe5')]=function(_0x203bba){if(this['actions'][_0x203bba[_0xaada('0xba')]]){this[_0xaada('0x21')][_0x203bba[_0xaada('0xba')]][_0xaada('0xe6')]=_0x203bba[_0xaada('0xe6')];}if(this[_0xaada('0xb9')][_0x203bba['uniqueid']]){this[_0xaada('0xb9')][_0x203bba[_0xaada('0xba')]][_0xaada('0xe6')]=_0x203bba[_0xaada('0xe6')];}};Dialer[_0xaada('0x81')][_0xaada('0x34')]=function(_0x3f9802){if(!this['actions'][_0x3f9802[_0xaada('0xe7')]]){return;}var _0x93751c=this[_0xaada('0x1c')][this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]][_0xaada('0xb8')]]['strategy']||_0xaada('0xe8');if(_0x93751c===_0xaada('0xe9')){if(this['actions'][_0x3f9802[_0xaada('0xe7')]]&&_[_0xaada('0xea')](this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]][_0xaada('0xeb')])&&_0x3f9802[_0xaada('0x85')]==='1'&&_0x3f9802[_0xaada('0xec')]==='0'){if(this[_0xaada('0xed')][_0x3f9802[_0xaada('0xee')]]){if(!this[_0xaada('0xed')][_0x3f9802[_0xaada('0xee')]][_0xaada('0xeb')]){this[_0xaada('0xed')][_0x3f9802[_0xaada('0xee')]][_0xaada('0xeb')]=!![];this[_0xaada('0x21')][_0x3f9802['actionid']]['locked']=!![];this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]][_0xaada('0xee')]=_0x3f9802['stateinterface'];}}}}else if(_0x93751c===_0xaada('0xe8')){if(this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]]){if(this[_0xaada('0xed')][_0x3f9802[_0xaada('0xee')]]){this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]]['stateinterface']=_0x3f9802[_0xaada('0xee')];if(_[_0xaada('0xea')](this['queueBooked'][this[_0xaada('0x21')][_0x3f9802['actionid']][_0xaada('0xb8')]])){this[_0xaada('0xef')][this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]][_0xaada('0xb8')]]=[];}this[_0xaada('0xef')][this[_0xaada('0x21')][_0x3f9802[_0xaada('0xe7')]][_0xaada('0xb8')]][_0xaada('0xa0')](_[_0xaada('0x5a')](_['pick'](this[_0xaada('0x21')][_0x3f9802['actionid']],[_0xaada('0xf0'),_0xaada('0xee')]),{'status':_0x3f9802['status'],'paused':_0x3f9802[_0xaada('0xec')]}));}}}};Dialer['prototype'][_0xaada('0x36')]=function(_0x25a50e){if(!this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]]){return;}var _0x38672a=this;var _0x118548=this[_0xaada('0x1c')][this['actions'][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]];var _0x53fea8=_0x118548[_0xaada('0xf1')]||_0xaada('0xe8');if(_0x53fea8===_0xaada('0xe9')){if(this[_0xaada('0x21')][_0x25a50e['actionid']]&&this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]]['stateinterface']){this[_0xaada('0x1b')]['run'](this[_0xaada('0x21')][_0x25a50e['actionid']]['idHopper'],this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xee')])['catch'](function(_0x3d675b){logger[_0xaada('0x61')](_0xaada('0xf2'),util['inspect'](_0x3d675b,{'showHidden':![],'depth':null}));})[_0xaada('0xf3')](function(){_0x38672a[_0xaada('0xbb')](_0x38672a[_0xaada('0x1c')][_0x38672a[_0xaada('0x21')][_0x25a50e['actionid']][_0xaada('0xb8')]]);_0x38672a[_0xaada('0xed')][_0x38672a[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xee')]][_0xaada('0xeb')]=![];delete _0x38672a[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]];unlockQueueStatus(_0x118548);});}else{this[_0xaada('0xbb')](this['voiceQueues'][this['actions'][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]]);hopperUtils[_0xaada('0xd2')]({'active':![],'ContactId':this[_0xaada('0x21')][_0x25a50e['actionid']]['ContactId'],'ListId':this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xd7')],'VoiceQueueId':this['actions'][_0x25a50e[_0xaada('0xe7')]]['VoiceQueueId']||undefined,'CampaignId':this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0xf4')));delete this['actions'][_0x25a50e['actionid']];unlockQueueStatus(_0x118548);}}else if(_0x53fea8===_0xaada('0xe8')){var _0x3e6e67;if(this['actions'][_0x25a50e[_0xaada('0xe7')]]&&!_[_0xaada('0x42')](this[_0xaada('0xef')][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]])){if(this[_0xaada('0x25')][_0x38672a[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]]){this['queueBookedRR'][_0x38672a[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]]=this[_0xaada('0x25')][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]]?this[_0xaada('0x25')][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]]:this['queueBooked'][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]]['queue']]?this[_0xaada('0xef')][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]][_0xaada('0xb8')]][_0xaada('0xf5')]||0x0:0x0;}this[_0xaada('0xef')][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]]['queue']]['_rr']=this['queueBookedRR'][this[_0xaada('0x21')][_0x25a50e[_0xaada('0xe7')]]['queue']];for(var _0x21e4db=0x0;_0x21e4db=_0x2c4b57[_0xaada('0x119')]){_0x591352[_0xaada('0x11a')](_0x2930a6,_0x466f0f,_0x511b95,_0xaada('0x11b'));}else{if(_0x2930a6[_0xaada('0x117')]>=_0x2c4b57[_0xaada('0x11c')]){_0x591352[_0xaada('0x11d')](_0x2930a6,_0x466f0f,_0x511b95,_0xaada('0x11e'));}else{hopperUtils[_0xaada('0xd2')]({'active':![],'countmachineretry':_0x2930a6[_0xaada('0x117')],'scheduledat':moment()[_0xaada('0xd3')](_0x2c4b57[_0xaada('0x11f')],_0xaada('0xd5'))[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x2930a6[_0xaada('0xd6')],'ListId':_0x2930a6[_0xaada('0xd7')],'VoiceQueueId':_0x2930a6['VoiceQueueId']||undefined,'CampaignId':_0x2930a6['CampaignId']||undefined})['catch'](loggerCatch(_0xaada('0x120')));_0x466f0f({'reschedule':0x1});}}});}if(_0x3a87f4[_0xaada('0x3b')]==='ivr'&&this[_0xaada('0x1d')][_0x3a87f4[_0xaada('0xb8')]][_0xaada('0x108')]&&_0x5142ef[_0xaada('0x121')]===_0xaada('0x109')){delete this[_0xaada('0xb9')][_0x5142ef[_0xaada('0xba')]];this[_0xaada('0xbb')](this[_0xaada('0x1d')][_0x3a87f4[_0xaada('0xb8')]]);_0x317954=new Hangup(_0x3a87f4,_0x5142ef);_0x317954['state']=0x12;_0x317954['statedesc']=_0xaada('0x122');_0x317954[_0xaada('0x123')]=_0xaada('0x10b');ami[_0xaada('0x3a')](_0xaada('0x10c'),ut[_0xaada('0x10d')](_0x317954,'amd'));this['saveInDb'](_0x317954,_0xaada('0x124'),_0xaada('0x125'));}if(_0x3a87f4[_0xaada('0x3b')]===_0xaada('0xbe')&&this[_0xaada('0x1d')][_0x3a87f4['queue']][_0xaada('0x108')]&&_0x5142ef[_0xaada('0x121')]==='MACHINE'){return new Promise(function(_0x4b5fa1,_0x104c6a){delete _0x591352[_0xaada('0xb9')][_0x5142ef['uniqueid']];_0x591352[_0xaada('0xbb')](_0x591352[_0xaada('0x1d')][_0x3a87f4['queue']]);_0x591352[_0xaada('0x1d')][_0x3a87f4[_0xaada('0xb8')]][_0xaada('0xbf')]+=0x1;_0x591352['campaigns'][_0x3a87f4['queue']][_0xaada('0x10a')]+=0x1;var _0x19ca58=_0x591352[_0xaada('0x1d')][_0x3a87f4['queue']];var _0x4c5d2e=new Hangup(_0x3a87f4,_0x5142ef);_0x4c5d2e[_0xaada('0x6c')]=0x13;_0x4c5d2e[_0xaada('0x6d')]=_0xaada('0x111');_0x4c5d2e[_0xaada('0x123')]=_0xaada('0x10b');_0x4c5d2e[_0xaada('0x117')]+=0x1;_0x4c5d2e[_0xaada('0xcd')]+=0x1;_0x4c5d2e[_0xaada('0x10e')]=!![];ami[_0xaada('0x3a')](_0xaada('0x10c'),ut[_0xaada('0x10d')](_0x4c5d2e,'amd'));hopperUtils[_0xaada('0xc4')](_0x4c5d2e)['catch'](loggerCatch(_0xaada('0x112')));if(_0x4c5d2e[_0xaada('0x113')]+_0x4c5d2e['countcongestionretry']+_0x4c5d2e[_0xaada('0x115')]+_0x4c5d2e[_0xaada('0x116')]+_0x4c5d2e['countdropretry']+_0x4c5d2e['countabandonedretry']+_0x4c5d2e[_0xaada('0x117')]+_0x4c5d2e['countagentrejectretry']>=_0x19ca58[_0xaada('0x119')]){_0x591352[_0xaada('0x11a')](_0x4c5d2e,_0x4b5fa1,_0x104c6a,_0xaada('0x11b'));}else{if(_0x4c5d2e['countmachineretry']>=_0x19ca58[_0xaada('0x11c')]){_0x591352[_0xaada('0x11d')](_0x4c5d2e,_0x4b5fa1,_0x104c6a,'reason\x2019\x20machine....');}else{hopperUtils[_0xaada('0xd2')]({'active':![],'countmachineretry':_0x4c5d2e[_0xaada('0x117')],'scheduledat':moment()['add'](_0x19ca58[_0xaada('0x11f')],'minutes')['format'](_0xaada('0xbc')),'ContactId':_0x4c5d2e[_0xaada('0xd6')],'ListId':_0x4c5d2e[_0xaada('0xd7')],'VoiceQueueId':_0x4c5d2e['VoiceQueueId']||undefined,'CampaignId':_0x4c5d2e[_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0x120')));_0x4b5fa1({'reschedule':0x1});}}});}}};Dialer[_0xaada('0x81')][_0xaada('0x31')]=function(_0x52ffed){var _0x2e6926=this['uniqueId'][_0x52ffed[_0xaada('0xba')]];var _0x359293;if(_0x2e6926&&_0x2e6926[_0xaada('0x3b')]==='ivr'){delete this[_0xaada('0xb9')][_0x52ffed[_0xaada('0xba')]];this[_0xaada('0xbb')](this[_0xaada('0x1d')][_0x2e6926[_0xaada('0xb8')]]);this['campaigns'][_0x2e6926['queue']]['ivrAnswerCallsDay']+=0x1;_0x359293=new Hangup(_0x2e6926,_0x52ffed);hopperUtils['createHistory'](_0x359293)[_0xaada('0x9f')](loggerCatch(_0xaada('0x126')));hopperUtils['moveContactManagedDialer'](_0x359293)[_0xaada('0x9f')](loggerCatch(_0xaada('0x127')));}if(_0x2e6926&&_0x2e6926[_0xaada('0x3b')]!=='ivr'&&isNotNull(this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]][_0xaada('0x128')])){delete this[_0xaada('0xb9')][_0x52ffed[_0xaada('0xba')]];this[_0xaada('0xbb')](this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]]);this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]][_0xaada('0xbf')]+=0x1;this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]][_0xaada('0x10a')]+=0x1;_0x359293=new Hangup(_0x2e6926,_0x52ffed);_0x359293[_0xaada('0x6c')]=0x10;_0x359293['statedesc']=_0xaada('0x129');_0x359293[_0xaada('0x123')]=_0xaada('0x12a');hopperUtils[_0xaada('0xc4')](_0x359293)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xaada('0xc5')](_0x359293)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x2e6926&&_0x2e6926['type']!==_0xaada('0xbe')&&!isNotNull(this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]]['dialQueueProject'])){delete this[_0xaada('0xb9')][_0x52ffed['uniqueid']];this[_0xaada('0xbb')](this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]]);this[_0xaada('0x1c')][_0x2e6926[_0xaada('0xb8')]][_0xaada('0x12b')]+=0x1;_0x359293=new Hangup(_0x2e6926,_0x52ffed);_0x359293[_0xaada('0x6c')]=0xc;_0x359293[_0xaada('0x6d')]=_0x52ffed['cause-txt'];_0x359293[_0xaada('0x123')]=_0xaada('0x12c');hopperUtils[_0xaada('0xc4')](_0x359293)[_0xaada('0x9f')](loggerCatch(_0xaada('0x126')));hopperUtils[_0xaada('0xc5')](_0x359293)[_0xaada('0x9f')](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xaada('0x81')][_0xaada('0x2e')]=function(_0x4285ec){var _0x1a1609=this;if(!_0x1a1609[_0xaada('0x12d')][_0x4285ec[_0xaada('0x40')]]){_0x1a1609['queuesSummary'][_0x4285ec[_0xaada('0x40')]]={'running':![]};}else if(_0x1a1609['queuesSummary'][_0x4285ec[_0xaada('0x40')]]['running']===!![]){return;}else if(_0x1a1609[_0xaada('0x12d')][_0x4285ec[_0xaada('0x40')]][_0xaada('0x12e')]===![]){_0x1a1609[_0xaada('0x12d')][_0x4285ec[_0xaada('0x40')]][_0xaada('0x12e')]=!![];}var _0xa0c8f9=_0x1a1609[_0xaada('0x1c')][_0x4285ec['name']];var _0x3f956e=_0xa0c8f9[_0xaada('0x66')]!==utils[_0xaada('0x6a')][_0xaada('0x76')];var _0x16462f=utils[_0xaada('0x12f')](_0xa0c8f9);_0xa0c8f9['statusMessage']=utils['getQueueCampaignStatusMessage'](_0xa0c8f9,_0x1a1609[_0xaada('0x1e')]);Promise[_0xaada('0x130')]()[_0xaada('0xa1')](function(){if(_0xa0c8f9[_0xaada('0x131')]===utils['CAMPAIGN_STATUS'][_0xaada('0x76')]){if(_0x3f956e){clearPredictiveAttributes(_0xa0c8f9);_0x4285ec[_0xaada('0x5d')]=undefined;_0x4285ec[_0xaada('0x23')]=undefined;}if(_0xa0c8f9[_0xaada('0x131')]===utils['CAMPAIGN_STATUS'][_0xaada('0x76')]){_0x4285ec[_0xaada('0x132')]=0x0;_0x4285ec[_0xaada('0xec')]=0x0;_0x4285ec['inUse']=0x0;_0x4285ec[_0xaada('0x133')]=0x0;_0x4285ec[_0xaada('0x134')]=0x0;}}else if(_0xa0c8f9[_0xaada('0x131')]===utils['CAMPAIGN_STATUS'][_0xaada('0x135')]&&!_0x16462f){return _0x1a1609['ifTime'](_0xa0c8f9,!![])[_0xaada('0xa1')](function(){return _0x1a1609[_0xaada('0x91')](_0xa0c8f9,![]);})['then'](function(){return _0x1a1609[_0xaada('0xaa')](_0xa0c8f9);})['catch'](function(_0x46942c){loggerSyncQueueSummary[_0xaada('0x3c')](_0xaada('0x136'),util[_0xaada('0x63')](_0x46942c,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xa0c8f9);});}else{clearPredictiveAttributes(_0xa0c8f9);}})['then'](function(){var _0x53716c=_0x4285ec['compareToOutboundQueue'](_0xa0c8f9);if(_0x53716c||_0xa0c8f9[_0xaada('0x137')]){_0xa0c8f9[_0xaada('0x137')]=![];_0x4285ec[_0xaada('0x138')](_0xa0c8f9);Object['assign'](_0xa0c8f9,_0x4285ec);emitOutboundVoiceQueueSummary(_0x4285ec);}_0x1a1609[_0xaada('0x12d')][_0xa0c8f9[_0xaada('0x40')]][_0xaada('0x12e')]=![];})[_0xaada('0x9f')](function(_0x2be7a2){logger['error'](_0xaada('0x136'),util[_0xaada('0x63')](_0x2be7a2,{'showHidden':![],'depth':null}));_0x1a1609['queuesSummary'][_0xa0c8f9[_0xaada('0x40')]][_0xaada('0x12e')]=![];});};Dialer[_0xaada('0x81')][_0xaada('0x30')]=_['throttle'](function(){var _0xc19bef=_[_0xaada('0x139')](this[_0xaada('0x1c')],function(_0x56591b){return _0x56591b[_0xaada('0x13a')];});var _0x26fedb=_[_0xaada('0x139')](this[_0xaada('0xed')],function(_0x936797){return _0x936797[_0xaada('0x13b')]&&_0x936797[_0xaada('0x85')]===_0xaada('0x13c');});if(_0xc19bef[_0xaada('0x97')]>0x0&&_0x26fedb[_0xaada('0x97')]>0x0){return Promise[_0xaada('0x130')]()[_0xaada('0xa1')](cmHopper[_0xaada('0x13d')](_[_0xaada('0x13e')](_0xc19bef,'id'),previewRecallmeReminderInterval,_[_0xaada('0x13e')](_0x26fedb,'id')))['then'](function(_0x561225){for(var _0x2d6edd=0x0;_0x2d6edd<_0x561225[_0xaada('0x97')];_0x2d6edd++){var _0x20e186=_0x561225[_0x2d6edd][_0xaada('0x13f')][_0xaada('0x40')];if(_0x20e186)io['to'](util['format']('user:%s',_0x20e186))[_0xaada('0x3a')](_0xaada('0x140'),{'hopper':_0x561225[_0x2d6edd]});}})[_0xaada('0x9f')](function(_0x52e74d){logger[_0xaada('0x61')](_0xaada('0x141'),_0x52e74d);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xaada('0x81')][_0xaada('0x142')]=function(){var _0xa37a51=this;setInterval(function(){_0xa37a51['clearZombieChannels'](_0xa37a51[_0xaada('0xb9')],_0xaada('0x143'));_0xa37a51[_0xaada('0x144')](_0xa37a51[_0xaada('0x21')],_0xaada('0x145'));},0x32c8);};Dialer[_0xaada('0x81')]['clearZombieChannels']=function(_0x592e2a,_0x239425){var _0x119bc6=this;for(var _0x54d799 in _0x592e2a){if(typeof _0x592e2a[_0x54d799]!=='undefined'){this[_0xaada('0x1a')][_0xaada('0x146')](function(){if(!_[_0xaada('0xea')](_0x592e2a[_0x54d799])){return ami[_0xaada('0x98')]({'action':_0xaada('0x85'),'channel':_0x592e2a[_0x54d799][_0xaada('0xe6')]})[_0xaada('0x9f')](function(_0x32f028){if(_0x32f028[_0xaada('0x66')]===_0xaada('0x147')){setTimeout(function(){if(_0x592e2a[_0x54d799]&&_0x592e2a[_0x54d799][_0xaada('0x3b')]!==_0xaada('0xbe')){_0x119bc6['updateOriginated'](_0x119bc6[_0xaada('0x1c')][_0x592e2a[_0x54d799]['queue']]);logger[_0xaada('0x61')]('[Dialer][checkChannel]',_0x239425,_0x54d799,_0x592e2a[_0x54d799][_0xaada('0xb8')]);delete _0x592e2a[_0x54d799];}if(_0x592e2a[_0x54d799]&&_0x592e2a[_0x54d799][_0xaada('0x3b')]===_0xaada('0xbe')){_0x119bc6[_0xaada('0xbb')](_0x119bc6[_0xaada('0x1d')][_0x592e2a[_0x54d799][_0xaada('0xb8')]]);logger[_0xaada('0x61')]('[Dialer][checkChannel][ivr]',_0x239425,_0x54d799,_0x592e2a[_0x54d799][_0xaada('0xb8')]);delete _0x592e2a[_0x54d799];}},0x2328);}});}});}}};Dialer['prototype'][_0xaada('0x148')]=function(_0x358d37){return Promise[_0xaada('0x130')]()[_0xaada('0xa1')](voiceQueueRt[_0xaada('0x148')](_0x358d37))['catch'](loggerCatch(_0xaada('0x149')));};Dialer[_0xaada('0x81')]['updateOriginated']=function(_0x19b373){if(!_[_0xaada('0x39')](_0x19b373)&&_0x19b373!==null){if(typeof _0x19b373[_0xaada('0x14a')]!==_0xaada('0x14b')){if(_0x19b373[_0xaada('0x14a')]>0x0){_0x19b373[_0xaada('0x14a')]-=0x1;}else{logger[_0xaada('0x61')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0xaada('0x81')][_0xaada('0x14c')]=function(_0x3e77fa,_0x416271){var _0x288bb2=this;return function(_0x3efb88){_0x288bb2[_0xaada('0xbb')](_0x416271);logger[_0xaada('0x61')](_0x3e77fa,util[_0xaada('0x63')](_0x3efb88,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0xaada('0x14d')]=function(_0x5e24e8,_0x225c8d,_0x4c21cd){var _0x3f2240={'state':0x19,'statedesc':_0xaada('0x14e')};this[_0xaada('0xbb')](_0x225c8d);this[_0xaada('0x10f')](_[_0xaada('0x5a')](_0x3f2240,_[_0xaada('0x70')](_0x4c21cd,[_0xaada('0xd6'),_0xaada('0xd7'),_0xaada('0x14f'),_0xaada('0xe2'),_0xaada('0xd8')])),'[emptyContact][createHistory]',_0xaada('0x150'));logger[_0xaada('0x61')](_0x5e24e8);};Dialer[_0xaada('0x81')][_0xaada('0x10f')]=function(_0x1f8f1b,_0x22095d,_0x19b220){hopperUtils['createHistory'](_0x1f8f1b)[_0xaada('0x9f')](loggerCatch(_0x22095d));hopperUtils['moveContactManagedDialer'](_0x1f8f1b)[_0xaada('0x9f')](loggerCatch(_0x19b220));};Dialer['prototype'][_0xaada('0xd1')]=function(_0x1dfdcf,_0x491d6e){hopperUtils['createHistory'](_0x1dfdcf)[_0xaada('0x9f')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x491d6e==0x0){hopperUtils[_0xaada('0xc5')](_0x1dfdcf)[_0xaada('0x9f')](loggerCatch(_0xaada('0x151')));}};Dialer[_0xaada('0x81')][_0xaada('0x141')]=function(_0x498903){return Promise[_0xaada('0x130')]()[_0xaada('0xa1')](cmHopper['handlePreviewRecallNotifications'](_0x498903['id'],previewRecallmeReminderInterval))[_0xaada('0xa1')](function(_0x4a6585){for(var _0x143a40=0x0;_0x143a40<_0x4a6585['length'];_0x143a40++){var _0x48a2c8=_0x4a6585[_0x143a40][_0xaada('0x13f')][_0xaada('0x40')];if(_0x48a2c8)io['to'](util['format'](_0xaada('0x152'),_0x48a2c8))[_0xaada('0x3a')](_0xaada('0x140'),{'hopper':_0x4a6585[_0x143a40]});}})[_0xaada('0x9f')](function(){});};Dialer['prototype'][_0xaada('0x153')]=function(_0xb668f6){var _0x1bb2dc=this;return function(){_0x1bb2dc['handleIvr'](_0xb668f6);};};Dialer['prototype'][_0xaada('0x154')]=function(_0x92f804,_0x3d5bad){var _0x525275=this;var _0xa4c5a0=uuid['v4']();this[_0xaada('0x21')][_0xa4c5a0]=new Action(_0x92f804,_0x3d5bad,_0xa4c5a0);return new Promise(function(_0x4f3b1f,_0x50a96d){if(_[_0xaada('0x39')](_0x92f804)&&typeof _0x92f804!==_0xaada('0x155')){return _0x50a96d(msgResponse(_0xaada('0x156'),'Failure',_0xaada('0x157')));}if(_[_0xaada('0x39')](_0x3d5bad['phone'])||_0x3d5bad[_0xaada('0x158')]===null){return _0x50a96d(msgResponse(_0xaada('0x156'),_0xaada('0x8e'),_0xaada('0x159')));}var _0x38cd85={'XMD-CALLERID':_0x525275[_0xaada('0x21')][_0xa4c5a0][_0xaada('0x15a')](),'XMD-AGI':_0x92f804['dialQueueProject']?util[_0xaada('0x3e')](_0xaada('0x15b'),ipAgi,_0x92f804[_0xaada('0x128')]):_0xaada('0x15c'),'XMD-AGIAFTER':_0x92f804['dialQueueProject2']?util[_0xaada('0x3e')](_0xaada('0x15b'),ipAgi,_0x92f804[_0xaada('0xc3')]):'NONE','XMD-QUEUE':utils[_0xaada('0x15d')](_0x92f804)?util[_0xaada('0x3e')]('\x22%s,%s%s,,,%s\x22',_0x92f804[_0xaada('0x40')],_0x92f804[_0xaada('0x15e')]||'',_0x92f804['dialAgiAfterHangupAgent']?'c':'',_0x92f804[_0xaada('0xc9')]||0x3):_0xaada('0x15c'),'XMD-CONTACTID':_0x3d5bad[_0xaada('0xd6')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x525275[_0xaada('0x21')][_0xa4c5a0]['getCaller'](),'XMD-AMD':_0x92f804[_0xaada('0x108')]?_0xaada('0x135'):_0xaada('0x15c'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x92f804[_0xaada('0x108')]){_0x38cd85[_0xaada('0x15f')]=_0x92f804[_0xaada('0x160')]||0x9c4;_0x38cd85['XMD-AMDGREETING']=_0x92f804[_0xaada('0x161')]||0x5dc;_0x38cd85[_0xaada('0x162')]=_0x92f804[_0xaada('0x163')]||0x320;_0x38cd85[_0xaada('0x164')]=_0x92f804['dialAMDTotalAnalysisTime']||0x1388;_0x38cd85['XMD-AMDMINWORDLENGTH']=_0x92f804[_0xaada('0x165')]||0x64;_0x38cd85[_0xaada('0x166')]=_0x92f804[_0xaada('0x167')]||0x32;_0x38cd85[_0xaada('0x168')]=_0x92f804['dialAMDMaximumNumberOfWords']||0x3;_0x38cd85[_0xaada('0x169')]=_0x92f804[_0xaada('0x16a')]||0x100;_0x38cd85[_0xaada('0x16b')]=_0x92f804[_0xaada('0x16c')]||0x1388;}if(utils[_0xaada('0x15d')](_0x92f804)){_0x38cd85[_0xaada('0x16d')]=_0x3d5bad[_0xaada('0xe2')];}else{_0x38cd85[_0xaada('0x16e')]=_0x3d5bad[_0xaada('0xd8')];}var _0x39e7ea=utils[_0xaada('0x16f')](_0x3d5bad[_0xaada('0x170')]);Object['assign'](_0x38cd85,_0x39e7ea);var _0x5e2c4c=_0x525275[_0xaada('0x82')](_0x92f804['Trunk'])?utils[_0xaada('0x171')](_0x92f804[_0xaada('0x87')][_0xaada('0x172')],_0x92f804[_0xaada('0x173')],_0x92f804[_0xaada('0x174')]>0x0?utils['getCallerIdRandom'](_0x92f804[_0xaada('0x175')],_0x92f804[_0xaada('0x174')]):_0x92f804[_0xaada('0x175')]):utils['getCallerId'](_[_0xaada('0xea')](_0x92f804[_0xaada('0x88')])?_0x92f804['Trunk'][_0xaada('0x172')]:_0x92f804[_0xaada('0x88')]['callerid'],_0x92f804[_0xaada('0x173')],_0x92f804[_0xaada('0x174')]>0x0?utils[_0xaada('0x176')](_0x92f804[_0xaada('0x175')],_0x92f804[_0xaada('0x174')]):_0x92f804[_0xaada('0x175')]);if(_0x5e2c4c){_0x38cd85[_0xaada('0x177')]=_0x525275[_0xaada('0x21')][_0xa4c5a0][_0xaada('0x178')]=utils['extractCalleridName'](_0x5e2c4c);_0x38cd85[_0xaada('0x179')]=_0x3d5bad[_0xaada('0x158')];}_0x92f804[_0xaada('0x17a')]=_0x38cd85;return ami[_0xaada('0x98')]({'actionid':_0xa4c5a0,'action':'originate','channel':_0x525275[_0xaada('0x82')](_0x92f804[_0xaada('0x87')])?util[_0xaada('0x3e')](_0xaada('0x17b'),_0x92f804[_0xaada('0x87')]['name'],isNotNull(_0x92f804[_0xaada('0x17c')])?_0x92f804[_0xaada('0x17c')]['trim']()||'':'',_0x92f804[_0xaada('0x17d')]>0x0?_0x3d5bad['phone'][_0xaada('0x17e')](_0x92f804[_0xaada('0x17d')]):_0x3d5bad[_0xaada('0x158')]):util[_0xaada('0x3e')](_0xaada('0x17b'),_[_0xaada('0xea')](_0x92f804[_0xaada('0x88')])?_0x92f804[_0xaada('0x87')][_0xaada('0x40')]:_0x92f804['TrunkBackup'][_0xaada('0x40')],isNotNull(_0x92f804[_0xaada('0x17c')])?_0x92f804[_0xaada('0x17c')]['trim']()||'':'',_0x92f804[_0xaada('0x17d')]>0x0?_0x3d5bad['phone'][_0xaada('0x17e')](_0x92f804[_0xaada('0x17d')]):_0x3d5bad[_0xaada('0x158')]),'callerid':_0x5e2c4c,'Exten':_0xaada('0x107'),'Context':_0xaada('0x17f'),'Priority':'1','variable':_0x38cd85,'timeout':(_0x92f804[_0xaada('0x180')]||0x1e)*0x3e8,'async':!![],'channelid':_0xa4c5a0})[_0xaada('0xa1')](function(_0x90f49){return _0x4f3b1f(_0x90f49);})['catch'](function(_0x402060){_0x92f804[_0xaada('0x181')]+=0x1;var _0x55889f=new History(_0x525275[_0xaada('0x21')][_0xa4c5a0]);logger[_0xaada('0x61')](util[_0xaada('0x3e')](_0xaada('0x182'),JSON[_0xaada('0x80')](_0x402060)));_0x55889f[_0xaada('0x6c')]=0xe;_0x55889f[_0xaada('0x6d')]=_0xaada('0x183');_0x55889f['starttime']=moment()[_0xaada('0x3e')](_0xaada('0xbc'));_0x55889f[_0xaada('0xe4')]=_0x55889f[_0xaada('0x6e')];hopperUtils[_0xaada('0xc4')](_0x55889f)[_0xaada('0x9f')](loggerCatch(_0xaada('0x184')));_0x525275[_0xaada('0xc5')](_0x55889f)[_0xaada('0x9f')](loggerCatch(_0xaada('0x184')))[_0xaada('0xf3')](function(){delete _0x525275[_0xaada('0x21')][_0xa4c5a0];return _0x50a96d(msgResponse(_0xaada('0x156'),_0xaada('0x7f'),_0xaada('0x185')));});});});};Dialer['prototype']['checkRetriveMax']=function(_0x5cca35,_0x43893f,_0x5b4f20){var _0x12c11b=new History(_0x43893f);if(_0x12c11b['countbusyretry']+_0x12c11b[_0xaada('0x114')]+_0x12c11b[_0xaada('0x115')]+_0x12c11b[_0xaada('0x116')]+_0x12c11b[_0xaada('0xcc')]+_0x12c11b[_0xaada('0xde')]+_0x12c11b[_0xaada('0x117')]+_0x12c11b['countagentrejectretry']>=_0x5b4f20[_0xaada('0x119')]-0x1){return!![];}switch(_0x5cca35){case 0x3:if(_0x12c11b[_0xaada('0x115')]>=_0x5b4f20['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xaada('0xd2')]({'active':![],'countnoanswerretry':_0x12c11b[_0xaada('0x115')]+=0x1,'scheduledat':moment()['add'](_0x5b4f20['dialNoAnswerRetryFrequency'],_0xaada('0xd5'))[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b[_0xaada('0xd7')],'VoiceQueueId':_0x12c11b[_0xaada('0xe2')]||undefined,'CampaignId':_0x12c11b[_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0x186')));break;case 0x5:if(_0x12c11b[_0xaada('0x113')]>=_0x5b4f20['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xaada('0xd2')]({'active':![],'countbusyretry':_0x12c11b[_0xaada('0x113')]+=0x1,'scheduledat':moment()[_0xaada('0xd3')](_0x5b4f20[_0xaada('0x187')],_0xaada('0xd5'))[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b['ListId'],'VoiceQueueId':_0x12c11b[_0xaada('0xe2')]||undefined,'CampaignId':_0x12c11b[_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x12c11b[_0xaada('0x114')]>=_0x5b4f20[_0xaada('0x188')]-0x1){return!![];}hopperUtils[_0xaada('0xd2')]({'active':![],'countcongestionretry':_0x12c11b['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x5b4f20[_0xaada('0x189')],_0xaada('0xd5'))['format'](_0xaada('0xbc')),'ContactId':_0x12c11b['ContactId'],'ListId':_0x12c11b[_0xaada('0xd7')],'VoiceQueueId':_0x12c11b[_0xaada('0xe2')]||undefined,'CampaignId':_0x12c11b['CampaignId']||undefined})['catch'](loggerCatch(_0xaada('0x18a')));break;case 0x0:if(_0x12c11b[_0xaada('0x116')]>=_0x5b4f20[_0xaada('0x18b')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x12c11b[_0xaada('0x116')]+=0x1,'scheduledat':moment()[_0xaada('0xd3')](_0x5b4f20[_0xaada('0x18c')],'minutes')['format'](_0xaada('0xbc')),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b[_0xaada('0xd7')],'VoiceQueueId':_0x12c11b[_0xaada('0xe2')]||undefined,'CampaignId':_0x12c11b[_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0x18d')));}break;case 0xa:if(_0x12c11b['countdropretry']>=_0x5b4f20[_0xaada('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x12c11b[_0xaada('0xcc')]+=0x1,'scheduledat':moment()['add'](_0x5b4f20['dialDropRetryFrequency'],_0xaada('0xd5'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b[_0xaada('0xd7')],'VoiceQueueId':_0x12c11b['VoiceQueueId']||undefined,'CampaignId':_0x12c11b[_0xaada('0xd8')]||undefined})['catch'](loggerCatch(_0xaada('0xd9')));break;case 0xb:if(_0x12c11b[_0xaada('0xde')]>=_0x5b4f20[_0xaada('0xe1')]-0x1){return!![];}hopperUtils[_0xaada('0xd2')]({'active':![],'countabandonedretry':_0x12c11b[_0xaada('0xde')]+=0x1,'scheduledat':moment()[_0xaada('0xd3')](_0x5b4f20[_0xaada('0xdf')],_0xaada('0xd5'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b['ListId'],'VoiceQueueId':_0x12c11b['VoiceQueueId']||undefined,'CampaignId':_0x12c11b['CampaignId']||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0xe3')));break;case 0x13:if(_0x12c11b[_0xaada('0x117')]>=_0x5b4f20[_0xaada('0x11c')]-0x1){return!![];}hopperUtils[_0xaada('0xd2')]({'active':![],'countmachineretry':_0x12c11b[_0xaada('0x117')]+=0x1,'scheduledat':moment()[_0xaada('0xd3')](_0x5b4f20[_0xaada('0x11f')],_0xaada('0xd5'))[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b[_0xaada('0xd7')],'VoiceQueueId':_0x12c11b[_0xaada('0xe2')]||undefined,'CampaignId':_0x12c11b[_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0x120')));break;case 0x14:if(_0x12c11b[_0xaada('0x118')]>=_0x5b4f20['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x12c11b[_0xaada('0x118')]+=0x1,'scheduledat':moment()[_0xaada('0xd3')](_0x5b4f20[_0xaada('0x18f')],_0xaada('0xd5'))[_0xaada('0x3e')](_0xaada('0xbc')),'ContactId':_0x12c11b[_0xaada('0xd6')],'ListId':_0x12c11b[_0xaada('0xd7')],'VoiceQueueId':_0x12c11b['VoiceQueueId']||undefined,'CampaignId':_0x12c11b['CampaignId']||undefined})[_0xaada('0x9f')](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xaada('0x81')][_0xaada('0x102')]=function(_0x4e0c30,_0x1f03f7,_0x3eb0ce){var _0x4c0b09=this;var _0x12ad80=new History(_0x4e0c30);var _0x2b9b41=![];var _0x32f1e4;var _0x54ea2f;return new Promise(function(_0x30a2bc,_0x20d299){if(_['isUndefined'](_0x1f03f7)&&typeof _0x1f03f7!=='object'){return _0x20d299(msgResponse(_0xaada('0x190'),_0xaada('0x8e'),_0xaada('0x191')));}if(_[_0xaada('0x39')](_0x3eb0ce)&&typeof _0x3eb0ce!==_0xaada('0x155')){return _0x20d299(msgResponse('[callProgressDetecting]','Failure',_0xaada('0x192')));}hopperUtils[_0xaada('0xce')](_0x12ad80,_0x3eb0ce[_0xaada('0xc0')],_0x1f03f7)[_0xaada('0xa1')](function(_0x2354c8){if(_0x2354c8['additional']==0x1)_0x2b9b41=!![];switch(_0x3eb0ce[_0xaada('0xc0')]){case'0':_0x1f03f7[_0xaada('0x193')]+=0x1;_0x12ad80['state']=0x0;_0x12ad80['statedesc']=_0xaada('0x194');_0x12ad80[_0xaada('0x116')]+=0x1;_0x12ad80[_0xaada('0xcd')]+=0x1;ami['emit'](_0xaada('0x195'),ut[_0xaada('0x10d')](_0x4e0c30,_0xaada('0x196')));_0x32f1e4=_0x1f03f7[_0xaada('0x18c')];_0x54ea2f=_0x1f03f7[_0xaada('0xe0')];hopperUtils[_0xaada('0xc4')](_0x12ad80)[_0xaada('0x9f')](loggerCatch(_0xaada('0x112')));if(_0x4c0b09[_0xaada('0x197')](0x0,_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80[_0xaada('0x116')]>=_0x1f03f7[_0xaada('0x18b')]){_0x4c0b09['createStateFinal'](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x198'));}else{_0x4c0b09['stateGlobal'](_0x12ad80,_0x30a2bc,_0x20d299,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1f03f7[_0xaada('0x199')]+=0x1;_0x12ad80[_0xaada('0x6c')]=0x3;_0x12ad80['statedesc']=_0xaada('0x19a');_0x12ad80[_0xaada('0x115')]+=0x1;_0x12ad80[_0xaada('0xcd')]+=0x1;var _0x5a1407=ut[_0xaada('0x19b')](_0x4e0c30,_0x1f03f7);ami[_0xaada('0x3a')](_0xaada('0x19c'),_0x5a1407);_0x32f1e4=_0x1f03f7[_0xaada('0x19d')];_0x54ea2f=_0x1f03f7[_0xaada('0xe0')];hopperUtils[_0xaada('0xc4')](_0x12ad80)['catch'](loggerCatch(_0xaada('0x19e')));if(_0x4c0b09[_0xaada('0x197')](0x3,_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80[_0xaada('0x115')]>=_0x1f03f7['dialNoAnswerMaxRetry']){_0x4c0b09[_0xaada('0x11d')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x19f'));}else{_0x4c0b09[_0xaada('0x11a')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x19f'));}}break;case'5':_0x1f03f7[_0xaada('0x1a0')]+=0x1;_0x12ad80[_0xaada('0x6c')]=0x5;_0x12ad80[_0xaada('0x6d')]='Busy';_0x12ad80[_0xaada('0x113')]+=0x1;_0x12ad80[_0xaada('0xcd')]+=0x1;ami[_0xaada('0x3a')]('custom:agentbusy',ut['buildObj'](_0x4e0c30,_0xaada('0x1a1')));_0x32f1e4=_0x1f03f7['dialBusyRetryFrequency'];_0x54ea2f=_0x1f03f7[_0xaada('0xe0')];hopperUtils[_0xaada('0xc4')](_0x12ad80)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x4c0b09[_0xaada('0x197')](0x5,_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80['countbusyretry']>=_0x1f03f7[_0xaada('0x1a2')]){_0x4c0b09[_0xaada('0x11d')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1a3'));}else{_0x4c0b09[_0xaada('0x11a')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1a3'));}}break;case'8':_0x1f03f7[_0xaada('0x1a4')]+=0x1;_0x12ad80[_0xaada('0x6c')]=0x8;_0x12ad80[_0xaada('0x6d')]=_0xaada('0x1a5');_0x12ad80[_0xaada('0x114')]+=0x1;_0x12ad80[_0xaada('0xcd')]+=0x1;_0x32f1e4=_0x1f03f7[_0xaada('0x189')];_0x54ea2f=_0x1f03f7[_0xaada('0xe0')];ami[_0xaada('0x3a')](_0xaada('0x1a6'),ut[_0xaada('0x10d')](_0x4e0c30,_0xaada('0x1a7')));hopperUtils['createHistory'](_0x12ad80)[_0xaada('0x9f')](loggerCatch(_0xaada('0x1a8')));if(_0x4c0b09[_0xaada('0x197')](0x8,_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80[_0xaada('0x114')]>=_0x1f03f7[_0xaada('0x188')]){_0x4c0b09[_0xaada('0x11d')](_0x12ad80,_0x30a2bc,_0x20d299,'reason\x208\x20congestion');}else{_0x4c0b09[_0xaada('0x11a')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1a9'));}}break;case'11':_0x1f03f7[_0xaada('0x1aa')]+=0x1;_0x12ad80[_0xaada('0x6c')]=0xb;_0x12ad80[_0xaada('0x6d')]=_0xaada('0xdd');_0x12ad80[_0xaada('0xde')]+=0x1;_0x12ad80[_0xaada('0xcd')]+=0x1;_0x32f1e4=_0x1f03f7[_0xaada('0xdf')];_0x54ea2f=_0x1f03f7['callAdditionalPhoneAfterMin'];hopperUtils[_0xaada('0xc4')](_0x12ad80)[_0xaada('0x9f')](loggerCatch(_0xaada('0x1ab')));if(_0x4c0b09[_0xaada('0x197')](0xb,_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80[_0xaada('0xde')]>=_0x1f03f7['dialAbandonedMaxRetry']){_0x4c0b09[_0xaada('0x11d')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1ac'));}else{_0x4c0b09[_0xaada('0x11a')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1ac'));}}break;case'20':_0x1f03f7['outboundRejectCallsDay']+=0x1;_0x12ad80[_0xaada('0x6c')]=0x14;_0x12ad80['statedesc']='AgentReject';_0x12ad80['countagentrejectretry']+=0x1;_0x12ad80[_0xaada('0xcd')]+=0x1;_0x32f1e4=_0x1f03f7[_0xaada('0x18f')];_0x54ea2f=_0x1f03f7['callAdditionalPhoneAfterMin'];ami[_0xaada('0x3a')](_0xaada('0x1ad'),ut[_0xaada('0x10d')](_0x4e0c30,'agentreject'));hopperUtils[_0xaada('0xc4')](_0x12ad80)[_0xaada('0x9f')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x4c0b09[_0xaada('0x197')](0x14,_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80[_0xaada('0x118')]>=_0x1f03f7[_0xaada('0x1ae')]){_0x4c0b09[_0xaada('0x11d')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1af'));}else{_0x4c0b09[_0xaada('0x11a')](_0x12ad80,_0x30a2bc,_0x20d299,_0xaada('0x1af'));}}break;default:_0x1f03f7[_0xaada('0x12b')]+=0x1;_0x12ad80['state']=0xc;_0x12ad80[_0xaada('0x6d')]=_0x3eb0ce[_0xaada('0xc0')];_0x32f1e4=_0x1f03f7[_0xaada('0x18f')];_0x54ea2f=_0x1f03f7[_0xaada('0xe0')];hopperUtils[_0xaada('0xc4')](_0x12ad80)['catch'](loggerCatch(_0xaada('0x1b0')));if(_0x4c0b09[_0xaada('0x197')](_0x3eb0ce['reason'],_0x4e0c30,_0x1f03f7)&&!_0x2b9b41){if(_0x12ad80['countbusyretry']+_0x12ad80[_0xaada('0x114')]+_0x12ad80['countnoanswerretry']+_0x12ad80[_0xaada('0x116')]+_0x12ad80[_0xaada('0xcc')]+_0x12ad80[_0xaada('0xde')]+_0x12ad80[_0xaada('0x117')]+_0x12ad80[_0xaada('0x118')]>=_0x1f03f7['dialGlobalMaxRetry']){_0x4c0b09['stateGlobal'](_0x12ad80,_0x30a2bc,_0x20d299,_0x3eb0ce[_0xaada('0xc0')]);}else{_0x4c0b09[_0xaada('0x11d')](_0x12ad80,_0x30a2bc,_0x20d299,_0x3eb0ce[_0xaada('0xc0')]);}}}})[_0xaada('0xa1')](function(){if(_0x2b9b41){hopperUtils[_0xaada('0x1b1')](_0x12ad80,_0x32f1e4,_0x54ea2f)['then'](function(){return _0x30a2bc(0x1);});}});});};Dialer[_0xaada('0x81')][_0xaada('0x11a')]=function(_0x30158a,_0x1a334f,_0x54583a,_0x387d8f){var _0x46cddb=new Final(_0x30158a);_0x46cddb[_0xaada('0x6c')]=0xf;_0x46cddb[_0xaada('0x6d')]=_0xaada('0x1b2');this[_0xaada('0x11d')](_0x46cddb,_0x1a334f,_0x54583a,_0x387d8f);};Dialer[_0xaada('0x81')][_0xaada('0x11d')]=function(_0x27f526,_0x55cfbe,_0x255309,_0x101ea9){hopperUtils[_0xaada('0xc5')](_0x27f526)[_0xaada('0xa1')](function(){return _0x55cfbe(msgResponse(_0xaada('0x190'),'Success',_0x101ea9));})['catch'](function(){return _0x255309(msgResponse(_0xaada('0x1b3'),_0xaada('0x8e'),_0xaada('0x1b4')));});};Dialer[_0xaada('0x81')][_0xaada('0x8')]=function(_0x3e9d20){var _0xf8bf24=_0x3e9d20['dialPredictiveOptimizationPercentage']/0x64;var _0x4d60f6=_0x3e9d20[_0xaada('0x1b5')]/(_0x3e9d20[_0xaada('0x1b5')]+_0x3e9d20[_0xaada('0xbf')]);var _0x58a82e=Math[_0xaada('0x1b6')](_0x3e9d20[_0xaada('0x1b7')]*(_0x3e9d20[_0xaada('0x1b8')]/0x64));var _0x43cb2c=Math[_0xaada('0x1b6')](_0x3e9d20[_0xaada('0x1b7')]*(_0x3e9d20[_0xaada('0x1b9')]/0x64));var _0x1c015c=_0x3e9d20[_0xaada('0x132')]+_0x3e9d20['talking'];var _0x363ff4=Math[_0xaada('0x1ba')](_0x3e9d20[_0xaada('0x54')]*_0x3e9d20['erlangAbandonmentRate']*_0x3e9d20['predictiveIntervalHitRate']*_0x3e9d20[_0xaada('0x1bb')]);if(_['isUndefined'](_0x3e9d20[_0xaada('0x23')])){if(!_[_0xaada('0x39')](_0x3e9d20[_0xaada('0x5d')])){_0x3e9d20[_0xaada('0x5d')]=undefined;loggerPredictive[_0xaada('0x61')](_0xaada('0x1bc'),_0xaada('0x1bd'));}if(!_[_0xaada('0x39')](_0x3e9d20[_0xaada('0x5f')])){loggerPredictive[_0xaada('0x61')](_0xaada('0x1bc'),_0xaada('0x1be'));clearInterval(_0x3e9d20[_0xaada('0x5f')]);_0x3e9d20[_0xaada('0x5f')]=undefined;}_0x3e9d20['startProgressive']=moment()[_0xaada('0x3e')](_0xaada('0xbc'));loggerPredictive[_0xaada('0x43')](_0x3e9d20['name'],'collection\x20data\x20in\x20progressive\x20at',_0x3e9d20[_0xaada('0x23')]);this[_0xaada('0xad')](_0x3e9d20,0x1);}else if(ifInterval(_0x3e9d20[_0xaada('0x1bf')],_0x3e9d20[_0xaada('0x23')])){this[_0xaada('0xad')](_0x3e9d20,0x1);loggerPredictiveCalls['info'](_0xaada('0x1c0'),_0x3e9d20[_0xaada('0x23')],_0x3e9d20[_0xaada('0x40')]);_0x3e9d20[_0xaada('0x54')]=0x0;_0x3e9d20['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0xf8bf24<_0x4d60f6&&_0x3e9d20[_0xaada('0x1c1')]===_0xaada('0x1c2')){clearPredictiveAttributes(_0x3e9d20);loggerPredictive[_0xaada('0x43')](_0xaada('0x1c3'),_0xaada('0x1c4'),_0x4d60f6,_0xaada('0x23'),_0x3e9d20[_0xaada('0x40')]);}else if(_0x363ff4<_0x3e9d20[_0xaada('0xca')]&&_0x3e9d20[_0xaada('0x1c1')]===_0xaada('0x1c2')){clearPredictiveAttributes(_0x3e9d20);loggerPredictive['info'](_0xaada('0x1c5'),_0xaada('0x1c6'),_0x363ff4,_0xaada('0x1c7'),_0x3e9d20['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x3e9d20[_0xaada('0x40')]);}else if(!ifInterval(_0x3e9d20[_0xaada('0x1bf')],_0x3e9d20[_0xaada('0x23')])&&_[_0xaada('0x39')](_0x3e9d20[_0xaada('0x5d')])&&!_[_0xaada('0x39')](_0x3e9d20[_0xaada('0x23')])){_0x3e9d20[_0xaada('0x5d')]=moment()['format'](_0xaada('0xbc'));loggerPredictive[_0xaada('0x43')](_0x3e9d20['name'],'started\x20in\x20predictive\x20at',_0x3e9d20['startPredictive']);hopperUtils[_0xaada('0x1c8')](_0x3e9d20[_0xaada('0x1bf')])[_0xaada('0xa1')](this[_0xaada('0x1c9')](_0x3e9d20))[_0xaada('0xa1')](mergeDataErlangB(_0x3e9d20))[_0xaada('0xa1')](this['startMethodPredictive'](_0x3e9d20))[_0xaada('0x9f')](loggerCatchPredictive(_0xaada('0x1ca'),_0x3e9d20));}else if(!ifInterval(_0x3e9d20[_0xaada('0x1bf')],_0x3e9d20['startPredictive'])){_0x3e9d20['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x3e9d20[_0xaada('0x5d')]=moment()[_0xaada('0x3e')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xaada('0x43')](_0x3e9d20[_0xaada('0x40')],_0xaada('0x1cb'),_0x3e9d20[_0xaada('0x5d')]);clearInterval(_0x3e9d20[_0xaada('0x5f')]);_0x3e9d20[_0xaada('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x3e9d20[_0xaada('0x1bf')])[_0xaada('0xa1')](this[_0xaada('0x1c9')](_0x3e9d20))[_0xaada('0xa1')](mergeDataErlangB(_0x3e9d20))['then'](this[_0xaada('0x1cc')](_0x3e9d20))[_0xaada('0x9f')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x3e9d20));}else if(_0x3e9d20[_0xaada('0x1b7')]&&_0x1c015c<_0x3e9d20[_0xaada('0x1b7')]-_0x43cb2c){clearPredictiveAttributes(_0x3e9d20);loggerPredictive[_0xaada('0x43')](_0x3e9d20['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1c015c,_0xaada('0x1cd'),_0x3e9d20[_0xaada('0x1b7')],'-',_0x43cb2c,'=',_0x3e9d20['predictiveIntervalAvailable']-_0x43cb2c,')');}else if(_0x3e9d20[_0xaada('0x1b7')]&&_0x1c015c>_0x3e9d20[_0xaada('0x1b7')]+_0x58a82e){clearPredictiveAttributes(_0x3e9d20);loggerPredictive['info'](_0x3e9d20['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x1c015c,_0xaada('0x1ce'),_0x3e9d20[_0xaada('0x1b7')],'+',_0x58a82e,'=',_0x3e9d20[_0xaada('0x1b7')]+_0x58a82e,')');}};Dialer[_0xaada('0x81')][_0xaada('0x1c9')]=function(_0x19e969){var _0x293c99=this;return function(_0x55b878){return new Promise(function(_0x2c2461,_0x568746){_[_0xaada('0x5a')](_0x19e969,_0x55b878[0x0]);if(checkGetDataPredictive(_0x55b878[0x0])){var _0x47dca6=_0x19e969[_0xaada('0x1b7')]=_0x19e969[_0xaada('0x133')]+_0x19e969[_0xaada('0x132')];var _0x122fd9=_0x19e969[_0xaada('0x1bf')]*0x3c;var _0x19aeb4=_0x55b878[0x0]['predictiveIntervalAvgTalktime']+_0x55b878[0x0]['predictiveIntervalAvgHoldtime'];var _0x115076=(_0x55b878[0x0]['predictiveIntervalAnsweredCalls']+_0x55b878[0x0][_0xaada('0x1cf')]+_0x55b878[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x55b878[0x0]['predictiveIntervalTotalCalls'];_0x19e969[_0xaada('0x1d0')]=_0x115076>0x0?_0x115076:0x1;switch(_0x19e969['dialPredictiveOptimization']){case'dropRate':var _0x334143=_0x19e969['dialPredictiveOptimizationPercentage']/0x64;return _0x293c99[_0xaada('0x1d1')](_0x47dca6,_0x122fd9,_0x19aeb4,_0x115076,_0x334143)[_0xaada('0xa1')](function(_0x27c978){return _0x2c2461(_0x27c978);});case _0xaada('0x1d2'):var _0x1e2730=_0x19e969['dialPredictiveOptimizationPercentage']/0x64;return _0x293c99[_0xaada('0x1d3')](_0x47dca6,_0x122fd9,_0x19aeb4,_0x115076,_0x1e2730)[_0xaada('0xa1')](function(_0x4fb2bc){return _0x2c2461(_0x4fb2bc);});default:return _0x568746(msgResponse(_0xaada('0x1d4'),_0xaada('0x8e'),_0xaada('0x1d5')));}}else{return _0x568746(msgResponse(_0xaada('0x1d4'),_0xaada('0x8e'),_0xaada('0x1d6')));}});};};Dialer[_0xaada('0x81')][_0xaada('0x1d7')]=function(_0x4af0bd){var _0x195c37=this;return function(_0x137a2b){return new Promise(function(_0xaddbb6,_0x3c8261){_[_0xaada('0x5a')](_0x4af0bd,_0x137a2b[0x0]);if(checkGetDataPredictive(_0x137a2b[0x0])){loggerPredictive[_0xaada('0x43')](JSON[_0xaada('0x80')](_0x137a2b[0x0]));if(_0x4af0bd['dialPredictiveOptimization']==='dropRate'){return _0x195c37[_0xaada('0x148')](_0x4af0bd['id'])['then'](function(_0x5ae534){var _0x48f042=_0x4af0bd[_0xaada('0x1d8')]-_0x5ae534[0x0][_0xaada('0x1d9')];var _0xec65b7=_0x4af0bd['dialPredictiveInterval']*0x3c;var _0xa9f5dc=_0x137a2b[0x0][_0xaada('0x4e')]+_0x137a2b[0x0][_0xaada('0x4c')];var _0x446ef9=(_0x137a2b[0x0][_0xaada('0x48')]+_0x137a2b[0x0][_0xaada('0x1cf')]+_0x137a2b[0x0][_0xaada('0x4b')])/_0x137a2b[0x0][_0xaada('0x46')];var _0x4d4460=_0x4af0bd[_0xaada('0x1da')]/0x64;_0x4af0bd[_0xaada('0x1db')]=_0x5ae534[0x0]['outboundQueuePauses']||0x0;_0x4af0bd[_0xaada('0x1d0')]=_0x446ef9>0x0?_0x446ef9:0x1;return _0x195c37[_0xaada('0x1d1')](_0x48f042,_0xec65b7,_0xa9f5dc,_0x446ef9,_0x4d4460);})[_0xaada('0xa1')](function(_0x52ec3c){return _0xaddbb6(_0x52ec3c);})['catch'](function(_0x379687){return _0x3c8261(msgResponse(_0xaada('0x1dc'),_0xaada('0x8e'),JSON[_0xaada('0x80')](_0x379687)));});}if(_0x4af0bd[_0xaada('0x1c1')]===_0xaada('0x1d2')){return _0x195c37[_0xaada('0x148')](_0x4af0bd['id'])[_0xaada('0xa1')](function(_0x507697){var _0xcab04f=_0x4af0bd['loggedIn']-_0x507697[0x0]['outboundQueuePauses'];var _0x40a848=_0x4af0bd[_0xaada('0x1bf')]*0x3c;var _0x49c56c=_0x137a2b[0x0][_0xaada('0x4e')]+_0x137a2b[0x0][_0xaada('0x4c')];var _0xa7f8b0=(_0x137a2b[0x0][_0xaada('0x48')]+_0x137a2b[0x0][_0xaada('0x1cf')]+_0x137a2b[0x0][_0xaada('0x4b')])/_0x137a2b[0x0][_0xaada('0x46')];var _0x3f3f47=_0x4af0bd[_0xaada('0x1da')]/0x64;_0x4af0bd[_0xaada('0x1db')]=_0x507697[0x0]['outboundQueuePauses']||0x0;_0x4af0bd[_0xaada('0x1d0')]=_0xa7f8b0>0x0?_0xa7f8b0:0x1;return _0x195c37[_0xaada('0x1d3')](_0xcab04f,_0x40a848,_0x49c56c,_0xa7f8b0,_0x3f3f47);})[_0xaada('0xa1')](function(_0x4b1ab5){return _0xaddbb6(_0x4b1ab5);})[_0xaada('0x9f')](function(_0x542cfe){return _0x3c8261(msgResponse(_0xaada('0x1dc'),_0xaada('0x8e'),JSON[_0xaada('0x80')](_0x542cfe)));});}}else{return _0x3c8261(msgResponse(_0xaada('0x1d4'),_0xaada('0x8e'),'check\x20failure'));}});};};Dialer[_0xaada('0x81')][_0xaada('0x1cc')]=function(_0x341054){var _0x4d0ff8=this;return function(){var _0x201172=0x0;var _0x3253b8=Math[_0xaada('0x1ba')](_0x341054[_0xaada('0x55')]*0x3e8);if(_0x3253b8>0x0){_0x3253b8=_0x3253b8<0x64?0x64:_0x3253b8;loggerPredictive['info'](_0x341054[_0xaada('0x40')],'one\x20call\x20every:',_0x3253b8,_0xaada('0x1dd'));_0x341054['handlePredictive']=setInterval(function(){_0x4d0ff8['handlePredictive'](_0x341054);loggerPredictiveCalls[_0xaada('0x43')](_0xaada('0x1de'),_0x201172+=0x1);},_0x3253b8);}else{loggerPredictive[_0xaada('0x43')](_0x341054[_0xaada('0x40')],_0xaada('0x1df'));}};};Dialer[_0xaada('0x81')][_0xaada('0x1e0')]=function(_0x4900d8,_0x1ae697){var _0x92a2f6=this;return function(_0x432f9e){if(_[_0xaada('0x42')](_0x432f9e)){if(_[_0xaada('0xea')](_0x1ae697[_0xaada('0x14f')])||!_0x1ae697['recallme']){if(_0x4900d8[_0xaada('0xab')]===_0xaada('0x7')){_0x4900d8[_0xaada('0x6f')]=_[_0xaada('0x39')](_0x4900d8['queueStatusComplete'])?!![]:_0x4900d8['queueStatusComplete'];var _0x420869=uuid['v4']();_0x92a2f6[_0xaada('0x21')][_0x420869]=new Action(_0x4900d8,_0x1ae697,_0x420869);loggerBooked[_0xaada('0x43')](_0xaada('0x1e1'),_0x420869,_0xaada('0x1e2'),JSON[_0xaada('0x80')](_0x4900d8[_0xaada('0x6f')]),_0xaada('0x1e3'),_0x4900d8[_0xaada('0x40')]);if(_0x4900d8[_0xaada('0x6f')]){_0x4900d8['queueStatusComplete']=![];_0x92a2f6[_0xaada('0xef')][_0x92a2f6['actions'][_0x420869][_0xaada('0xb8')]]=[];ami[_0xaada('0x98')]({'actionid':_0x420869,'action':'queuestatus','queue':_0x4900d8['name']})['catch'](function(){_0x92a2f6[_0xaada('0xbb')](_0x4900d8);hopperUtils[_0xaada('0xd2')]({'active':![],'ContactId':_0x92a2f6[_0xaada('0x21')][_0x420869][_0xaada('0xd6')],'ListId':_0x92a2f6['actions'][_0x420869][_0xaada('0xd7')],'VoiceQueueId':_0x92a2f6[_0xaada('0x21')][_0x420869][_0xaada('0xe2')]||undefined,'CampaignId':_0x92a2f6[_0xaada('0x21')][_0x420869][_0xaada('0xd8')]||undefined})['catch'](loggerCatch(_0xaada('0x1e4')));delete _0x92a2f6[_0xaada('0x21')][_0x420869];});}else{loggerBooked[_0xaada('0x43')]('[booked][checkContactBlack][else]',JSON[_0xaada('0x80')](_0x4900d8[_0xaada('0x6f')]),_0xaada('0x1e3'),_0x4900d8[_0xaada('0x40')]);_0x92a2f6[_0xaada('0xbb')](_0x4900d8);hopperUtils[_0xaada('0xd2')]({'active':![],'ContactId':_0x92a2f6[_0xaada('0x21')][_0x420869]['ContactId'],'ListId':_0x92a2f6[_0xaada('0x21')][_0x420869][_0xaada('0xd7')],'VoiceQueueId':_0x92a2f6[_0xaada('0x21')][_0x420869][_0xaada('0xe2')]||undefined,'CampaignId':_0x92a2f6[_0xaada('0x21')][_0x420869][_0xaada('0xd8')]||undefined})[_0xaada('0x9f')](loggerCatch(_0xaada('0x1e4')));delete _0x92a2f6[_0xaada('0x21')][_0x420869];}}else{return _0x92a2f6['actionOriginate'](_0x4900d8,_0x1ae697);}}else{if(utils[_0xaada('0x5b')](undefined,_0x1ae697['scheduledat'])<_0x4900d8['dialRecallMeTimeout']*0x3c){if(_0x1ae697[_0xaada('0x13f')]&&!_0x1ae697[_0xaada('0x13f')][_0xaada('0x1e5')]){_0x92a2f6['preview']['run'](_0x1ae697['id'])[_0xaada('0xf3')](function(){_0x92a2f6['updateOriginated'](_0x4900d8);});}else{hopperUtils[_0xaada('0x1e6')]({'active':![]},_0x1ae697['id'],0x1)[_0xaada('0xf3')](function(){_0x92a2f6[_0xaada('0xbb')](_0x4900d8);});}}else{_0x4900d8[_0xaada('0x1e7')]+=0x1;_0x92a2f6[_0xaada('0xbb')](_0x4900d8);if(_0x4900d8[_0xaada('0x1e8')]){hopperUtils[_0xaada('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1ae697[_0xaada('0xd6')],'ListId':_0x1ae697[_0xaada('0xd7')],'VoiceQueueId':_0x1ae697[_0xaada('0xe2')]||undefined,'CampaignId':_0x1ae697[_0xaada('0xd8')]||undefined})['catch'](loggerCatch(_0xaada('0x1e9')));hopperUtils['createHistory'](createObjHistory(_0x4900d8,_0x1ae697,utils['CAMPAIGN_STATUS'][_0xaada('0x1ea')],0x17,_0xaada('0x1eb')))['catch'](loggerCatch(_0xaada('0x1ec')));}else{_0x92a2f6[_0xaada('0x10f')](createObjHistory(_0x4900d8,_0x1ae697,utils[_0xaada('0x6a')][_0xaada('0x1ed')],0x16,_0xaada('0x1ee')),_0xaada('0x1ef'),'[Originate][HistoryRecallClose]');}}}}else{_0x4900d8[_0xaada('0x1f0')]+=0x1;_0x92a2f6['saveInDb'](createObjHistory(_0x4900d8,_0x1ae697,utils[_0xaada('0x6a')][_0xaada('0x1f1')],0xd,'Blacklist'),_0xaada('0x1f2'),_0xaada('0x1f3'));throw _0xaada('0x1f4');}};};Dialer['prototype'][_0xaada('0x1f5')]=function(_0x1e5cd4){var _0x163289=this;var _0x258148=_0x1e5cd4[_0xaada('0x1f6')]-_0x1e5cd4[_0xaada('0x14a')]-_0x1e5cd4[_0xaada('0x1f7')];emitCampaignSummary(_0x1e5cd4);if(_0x258148>0x0){if(_0x258148>this[_0xaada('0x1f')]){_0x258148=this[_0xaada('0x1f')];}_0x1e5cd4[_0xaada('0x1f7')]+=_0x258148;hopperUtils[_0xaada('0x1f8')](_0x1e5cd4,_0x258148)[_0xaada('0xa1')](function(_0x4c1ccb){_0x1e5cd4['temp']-=_0x258148;_0x1e5cd4[_0xaada('0x1f7')]=_0x1e5cd4[_0xaada('0x1f7')]>0x0?_0x1e5cd4[_0xaada('0x1f7')]:0x0;if(!utils[_0xaada('0x1f9')](_0x4c1ccb)){_0x1e5cd4[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x1fa')];logger[_0xaada('0x43')](_0xaada('0x1fb')+_0x1e5cd4[_0xaada('0x40')]);}else{_0x1e5cd4[_0xaada('0x14a')]+=_0x4c1ccb['length'];_0x1e5cd4[_0xaada('0x66')]=utils[_0xaada('0x6a')]['RUNNING'];for(var _0x22ef97=0x0;_0x22ef97<_0x4c1ccb['length'];_0x22ef97+=0x1){_0x1e5cd4['ivrTotalCallsDays']+=0x1;if(_[_0xaada('0xea')](_0x4c1ccb[_0x22ef97])||_['isNil'](_0x4c1ccb[_0x22ef97][_0xaada('0x170')])||_[_0xaada('0xea')](_0x4c1ccb[_0x22ef97][_0xaada('0x158')])){_0x163289[_0xaada('0x14d')]('[actionOriginate]\x20',_0x1e5cd4,_0x4c1ccb[_0x22ef97]);}else{hopperUtils[_0xaada('0x1fc')](_[_0xaada('0x70')](_0x4c1ccb[_0x22ef97],['CampaignId',_0xaada('0x158')]))[_0xaada('0xa1')](_0x163289[_0xaada('0x1e0')](_0x1e5cd4,_0x4c1ccb[_0x22ef97]))[_0xaada('0x9f')](_0x163289[_0xaada('0x14c')]('[actionOriginateIvr]\x20',_0x1e5cd4));}}}})[_0xaada('0x9f')](loggerGetContactDialer(_0xaada('0x1fd'),_0x1e5cd4,_0x258148));}};Dialer[_0xaada('0x81')][_0xaada('0xad')]=function(_0x3b0153,_0x2f8994){var _0x2a23d9=this;var _0x438d84=[];if(_0x2f8994<0x1||_0x3b0153['dialMethod']===_0xaada('0x7')){_0x2f8994=0x1;}var _0x2e635e=Math[_0xaada('0x1ba')](_0x3b0153[_0xaada('0x132')]*_0x2f8994)-_0x3b0153[_0xaada('0x14a')]-_0x3b0153['temp'];if(_0x3b0153[_0xaada('0x1fe')]>0x0){var _0x546ffb=_0x3b0153[_0xaada('0x1fe')]-_0x3b0153[_0xaada('0x14a')]-_0x3b0153[_0xaada('0x133')]-_0x3b0153['temp']-_0x3b0153[_0xaada('0x134')];if(_0x2e635e>_0x546ffb){_0x2e635e=_0x546ffb;}}if(_0x2e635e>0x0){if(_0x3b0153[_0xaada('0xab')]===_0xaada('0x7')){_0x2e635e=0x1;}if(_0x2e635e>this[_0xaada('0x1f')]){_0x2e635e=this[_0xaada('0x1f')];}_0x3b0153[_0xaada('0x1f7')]+=_0x2e635e;for(var _0x4cb2f2 in this['agents']){if(typeof this[_0xaada('0xed')][_0x4cb2f2]!==_0xaada('0x14b')){if(this[_0xaada('0xed')][_0x4cb2f2][_0xaada('0x6c')]===_0xaada('0x1ff')&&this[_0xaada('0xed')][_0x4cb2f2][_0xaada('0x85')]===_0xaada('0x13c')){_0x438d84[_0xaada('0xa0')](this['agents'][_0x4cb2f2]['id']);}}}hopperUtils['getContactDialer'](_0x3b0153,_0x438d84,_0x2e635e)[_0xaada('0xa1')](function(_0x1b7285){_0x3b0153[_0xaada('0x1f7')]-=_0x2e635e;_0x3b0153[_0xaada('0x1f7')]=_0x3b0153[_0xaada('0x1f7')]>0x0?_0x3b0153['temp']:0x0;if(!utils['checkContactEmpty'](_0x1b7285)){hopperUtils['countReScheduled'](_0x3b0153)[_0xaada('0xa1')](sendMessageReschedule(_0x3b0153))[_0xaada('0x9f')](loggerCatch(_0xaada('0x200')));}else{_0x3b0153['originated']+=_0x1b7285[_0xaada('0x97')];_0x3b0153[_0xaada('0x66')]=_0x3b0153[_0xaada('0xab')]===_0xaada('0x7')?utils[_0xaada('0x6a')][_0xaada('0x135')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x58f2ab=0x0;_0x58f2ab<_0x1b7285[_0xaada('0x97')];_0x58f2ab+=0x1){if(_[_0xaada('0xea')](_0x1b7285[_0x58f2ab])||_[_0xaada('0xea')](_0x1b7285[_0x58f2ab][_0xaada('0x170')])||_[_0xaada('0xea')](_0x1b7285[_0x58f2ab]['phone'])){_0x2a23d9[_0xaada('0x14d')]('[actionOriginate]\x20',_0x3b0153,_0x1b7285[_0x58f2ab]);}else{hopperUtils['checkIsBlackList'](_[_0xaada('0x70')](_0x1b7285[_0x58f2ab],[_0xaada('0xe2'),_0xaada('0x158')]))[_0xaada('0xa1')](_0x2a23d9[_0xaada('0x1e0')](_0x3b0153,_0x1b7285[_0x58f2ab]))[_0xaada('0x9f')](_0x2a23d9['loggerHandler']('[actionOriginate]\x20',_0x3b0153));}}}})[_0xaada('0x9f')](loggerGetContactDialer('[getContactDialer2]',_0x3b0153,_0x2e635e));}};Dialer[_0xaada('0x81')][_0xaada('0x5f')]=function(_0xafe8ff){if(_0xafe8ff[_0xaada('0x1fe')]>0x0){var _0x3c1592=_0xafe8ff['dialLimitQueue']-_0xafe8ff[_0xaada('0x14a')]-_0xafe8ff[_0xaada('0x133')];if(_0x3c1592>0x0){this[_0xaada('0x201')](_0xafe8ff);}else{loggerPredictiveCalls[_0xaada('0x43')](_0xaada('0x202'));}}else{this[_0xaada('0x201')](_0xafe8ff);}};Dialer['prototype'][_0xaada('0x201')]=function(_0xcb1604){var _0x4507ee=this;var _0x30c0c5=[];_0xcb1604['originated']+=0x1;for(var _0x55df91 in this['agents']){if(typeof this['agents'][_0x55df91]!==_0xaada('0x14b')){if(this[_0xaada('0xed')][_0x55df91][_0xaada('0x6c')]===_0xaada('0x1ff')&&this[_0xaada('0xed')][_0x55df91][_0xaada('0x85')]===_0xaada('0x13c')){_0x30c0c5[_0xaada('0xa0')](this[_0xaada('0xed')][_0x55df91]['id']);}}}return this[_0xaada('0x203')](_0xcb1604['id'],_0x30c0c5,0x1,_0xcb1604['dialOrderByScheduledAt'],_0xcb1604)['then'](function(_0x4e0a4a){if(!utils[_0xaada('0x1f9')](_0x4e0a4a)){utils['checkContactLowerLimitOriginate'](_0xcb1604,0x1,0x0);return hopperUtils[_0xaada('0x204')](_0xcb1604)[_0xaada('0xa1')](sendMessageReschedule(_0xcb1604))[_0xaada('0x9f')](loggerCatch(_0xaada('0x200')));}else{_0xcb1604[_0xaada('0x66')]=utils[_0xaada('0x6a')][_0xaada('0x205')];if(_[_0xaada('0xea')](_0x4e0a4a[0x0])||_[_0xaada('0xea')](_0x4e0a4a[0x0][_0xaada('0x170')])||_['isNil'](_0x4e0a4a[0x0][_0xaada('0x158')])){_0x4507ee[_0xaada('0x14d')](_0xaada('0x206'),_0xcb1604,_0x4e0a4a[0x0]);}else{return hopperUtils[_0xaada('0x207')](_['pick'](_0x4e0a4a[0x0],['VoiceQueueId','phone']))[_0xaada('0xa1')](_0x4507ee['checkContactBlack'](_0xcb1604,_0x4e0a4a[0x0]))[_0xaada('0x9f')](_0x4507ee[_0xaada('0x14c')](_0xaada('0x208'),_0xcb1604));}}})['catch'](loggerGetContactDialer(_0xaada('0x209'),_0xcb1604,0x1));};Dialer[_0xaada('0x81')][_0xaada('0x1d1')]=function(_0x5f1504,_0x3bddcd,_0x1983dc,_0x4d13fe,_0x3d3fd6,_0x49011b){loggerPredictive['info'](_0xaada('0x20a'));loggerPredictive[_0xaada('0x43')](_0xaada('0x20b'),_0x5f1504);loggerPredictive['info'](_0xaada('0x20c'),_0x3bddcd);loggerPredictive[_0xaada('0x43')](_0xaada('0x20d'),_0x1983dc);loggerPredictive[_0xaada('0x43')](_0xaada('0x20e'),_0x4d13fe);loggerPredictive['info'](_0xaada('0x20f'),_0x3d3fd6);loggerPredictive[_0xaada('0x43')](_0xaada('0x4f'));return new Promise(function(_0xee45e,_0x3f86b4){if(_0x5f1504<=0x0||isNaN(_0x5f1504)){return _0x3f86b4(msgResponse(_0xaada('0x210'),_0xaada('0x7f'),_0xaada('0x211')+_0x5f1504));}if(_0x1983dc<=0x0||isNaN(_0x1983dc)){return _0x3f86b4(msgResponse('[abandonmentRate]','Error',_0xaada('0x212')+_0x1983dc));}if(_0x4d13fe<=0x0||isNaN(_0x4d13fe)){return _0x3f86b4(msgResponse('[abandonmentRate]',_0xaada('0x7f'),_0xaada('0x213')+_0x4d13fe));}if(_0x3bddcd<=0x0||isNaN(_0x3bddcd)){return _0x3f86b4(msgResponse(_0xaada('0x210'),'Error',_0xaada('0x214')+_0x3bddcd));}if(_0x3d3fd6<=0x0||isNaN(_0x3d3fd6)){return _0x3f86b4(msgResponse(_0xaada('0x210'),_0xaada('0x7f'),'Amax\x20=\x20'+_0x3d3fd6));}_0x49011b=_0x49011b||0x0;var _0xf0f67b=0x1/_0x1983dc;var _0x5e3c33=0x0;var _0x4c4abb=0x0;var _0x19ab74=0x0;var _0x5d132d=0x0;for(var _0x1a6ad3=0x0;_0x19ab74<_0x3d3fd6;_0x1a6ad3+=0x1){_0x4c4abb=_0x1a6ad3/_0x3bddcd;_0x5e3c33=(_0x4d13fe*_0x4c4abb+_0x49011b)/_0xf0f67b;_0x19ab74=utils['erlangb'](_0x5e3c33,_0x5f1504);_0x5d132d=_0x5e3c33/_0x5f1504*(0x1-utils['erlangb'](_0x5e3c33,_0x5f1504));}return _0xee45e({'erlangCalls':_0x1a6ad3,'erlangCallToSecond':_0x3bddcd/_0x1a6ad3,'erlangAbandonmentRate':_0x19ab74,'erlangBusyFactor':_0x5d132d});});};Dialer[_0xaada('0x81')][_0xaada('0x1d3')]=function(_0x4bcc4b,_0x512264,_0x3d4253,_0x188cb3,_0x1e524d,_0x34baa1){loggerPredictive['info'](_0xaada('0x215'));loggerPredictive['info'](_0xaada('0x20b'),_0x4bcc4b);loggerPredictive[_0xaada('0x43')](_0xaada('0x20c'),_0x512264);loggerPredictive[_0xaada('0x43')](_0xaada('0x20d'),_0x3d4253);loggerPredictive[_0xaada('0x43')](_0xaada('0x20e'),_0x188cb3);loggerPredictive[_0xaada('0x43')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e524d);loggerPredictive[_0xaada('0x43')]('---------------------------');return new Promise(function(_0x3717fd,_0x4cc77b){if(_0x4bcc4b<=0x0||isNaN(_0x4bcc4b)){return _0x4cc77b(msgResponse(_0xaada('0x216'),'Error',_0xaada('0x211')+_0x4bcc4b));}if(_0x3d4253<=0x0||isNaN(_0x3d4253)){return _0x4cc77b(msgResponse('[busyFactor]',_0xaada('0x7f'),'Ts\x20=\x20'+_0x3d4253));}if(_0x188cb3<=0x0||isNaN(_0x188cb3)){return _0x4cc77b(msgResponse(_0xaada('0x216'),_0xaada('0x7f'),'p\x20=\x20'+_0x188cb3));}if(_0x512264<=0x0||isNaN(_0x512264)){return _0x4cc77b(msgResponse('[busyFactor]','Error',_0xaada('0x214')+_0x512264));}if(_0x1e524d<=0x0||isNaN(_0x1e524d)){return _0x4cc77b(msgResponse(_0xaada('0x216'),_0xaada('0x7f'),_0xaada('0x217')+_0x1e524d));}_0x34baa1=_0x34baa1||0x0;var _0x4cbc0e=0x1/_0x3d4253;var _0x1f014e=0x0;var _0x1b6416=0x0;var _0x29ff8a=0x0;var _0x16ebfe=0x0;for(var _0x2955f9=0x0;_0x16ebfe<_0x1e524d;_0x2955f9+=0x1){_0x1b6416=_0x2955f9/_0x512264;_0x1f014e=(_0x188cb3*_0x1b6416+_0x34baa1)/_0x4cbc0e;_0x29ff8a=utils['erlangb'](_0x1f014e,_0x4bcc4b);_0x16ebfe=_0x1f014e/_0x4bcc4b*(0x1-utils['erlangb'](_0x1f014e,_0x4bcc4b));}return _0x3717fd({'erlangCalls':_0x2955f9,'erlangCallToSecond':_0x512264/_0x2955f9,'erlangAbandonmentRate':_0x29ff8a,'erlangBusyFactor':_0x16ebfe});});};module[_0xaada('0x218')]=Dialer; \ No newline at end of file +var _0xf14d=['XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','TrunkBackup','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','outboundRejectCallsDay','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','Success','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','available','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','loggedIn','predictiveIntervalPauses','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','outboundReCallsDay','dialRecallInQueue','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','temp','checkContactEmpty','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','floor','dialLimitQueue','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','defaults','redis','localhost','../rpc/cmHopper','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','campaigns','trunks','maxNumberOriginate','channels','startPredictive','startProgressive','queuesSummary','agentconnect','bind','queuecallerabandon','syncOriginateResponse','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','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','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','erlangBusyFactor','merge','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','NO_AVAILABLE_CONTACTS','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','INACTIVE','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','active','SIP/%s','status','unmonitored','isTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','length','push','Action','command','iftime\x20%s,%s','interval','timezones','content','true','catch','indexOf','all','some','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaignActive','resolve','checkIsTrunkReachable','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','syncAgentConnect','voiceQueues','queue','uniqueId','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','responsetime','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','rescheduleContact','minutes','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','syncNewExten','actions','channel','syncQueueMember','actionid','strategy','roundrobin','locked','paused','agents','stateinterface','queueBooked','idHopper','rrmemory','run','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','buildObj','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','Machine','countmachineretry','amd','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countagentrejectretry','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','saveInDb','MACHINE','custom:amd','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','outboundAnswerAgiCallsDay','AnswerAGI','AGI','[syncHangupIvr][createHistory]','Unknow','running','isPreviewCampaign','statusMessage','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','online','reachable','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0xf14d,0xb0));var _0xdf14=function(_0x32d71e,_0x42dbeb){_0x32d71e=_0x32d71e-0x0;var _0xd76e87=_0xf14d[_0x32d71e];return _0xd76e87;};'use strict';var util=require(_0xdf14('0x0'));var _=require(_0xdf14('0x1'));var uuid=require(_0xdf14('0x2'));var moment=require(_0xdf14('0x3'));var rr=require('rr');var Redis=require(_0xdf14('0x4'));var utils=require(_0xdf14('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0xdf14('0x6'));var config=require(_0xdf14('0x7'));var logger=require('../../../config/logger')(_0xdf14('0x8'));var loggerBooked=require(_0xdf14('0x9'))(_0xdf14('0xa'));var loggerPredictive=require(_0xdf14('0x9'))(_0xdf14('0xb'));var loggerPredictiveCalls=require(_0xdf14('0x9'))(_0xdf14('0xc'));var loggerSyncQueueSummary=require(_0xdf14('0x9'))(_0xdf14('0xd'));var ami=require('../ami');config['redis']=_[_0xdf14('0xe')](config[_0xdf14('0xf')],{'host':_0xdf14('0x10'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdf14('0xf')]));var cmHopper=require(_0xdf14('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0xdf14('0x12'));var Interval=require('../rpc/interval');var Action=require(_0xdf14('0x13'));var History=require(_0xdf14('0x14'));var Final=require(_0xdf14('0x15'));var AgentComplete=require(_0xdf14('0x16'));var QueueCallerAbandon=require(_0xdf14('0x17'));var Hangup=require(_0xdf14('0x18'));var ipAgi=process['env'][_0xdf14('0x19')]||_0xdf14('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xdf14('0x1b')][_0xdf14('0x1c')]=function(_0x590f71){this[_0xdf14('0x1d')]=this['tail']?this[_0xdf14('0x1d')][_0xdf14('0x1e')](_0x590f71):_0x590f71();};function Dialer(_0x110ea9,_0x36212e){this[_0xdf14('0x1f')]=new Sequence();this[_0xdf14('0x20')]=_0x36212e;this['voiceQueues']=_0x110ea9['voiceQueues'];this[_0xdf14('0x21')]=_0x110ea9[_0xdf14('0x21')];this['agents']=_0x110ea9['agents'];this[_0xdf14('0x22')]=_0x110ea9[_0xdf14('0x22')];this[_0xdf14('0x23')]=config[_0xdf14('0x23')]||0x2;this[_0xdf14('0x24')]={};this['actions']={};this['contactsId']={};this['uniqueId']={};this['optionPredictive']={};this[_0xdf14('0x25')]={};this[_0xdf14('0x26')]={};this['ivrOriginated']={};this['queueBooked']={};this['queueBookedRR']={};this[_0xdf14('0x27')]={};ami['on'](_0xdf14('0x28'),this['syncAgentConnect'][_0xdf14('0x29')](this));ami['on'](_0xdf14('0x2a'),this['syncQueueCallerAbandon']['bind'](this));ami['on']('originateresponse',this[_0xdf14('0x2b')][_0xdf14('0x29')](this));ami['on']('agentcomplete',this[_0xdf14('0x2c')][_0xdf14('0x29')](this));ami['on']('custom:queuesummary',this[_0xdf14('0xd')][_0xdf14('0x29')](this));ami['on'](_0xdf14('0x2d'),this[_0xdf14('0x2e')][_0xdf14('0x29')](this));ami['on']('hangup',this[_0xdf14('0x2f')][_0xdf14('0x29')](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xdf14('0x30'),this['syncVarSet']['bind'](this));ami['on'](_0xdf14('0x31'),this['syncQueueMember'][_0xdf14('0x29')](this));ami['on'](_0xdf14('0x32'),this[_0xdf14('0x33')][_0xdf14('0x29')](this));this[_0xdf14('0x34')]();this[_0xdf14('0x35')]();RpcSetting[_0xdf14('0x36')]()[_0xdf14('0x37')](function(_0x7e1ddc){previewRecallmeReminderInterval=_0x7e1ddc[_0xdf14('0x38')];});}function isNotNull(_0xb38606){return _0xb38606!==null&&!_[_0xdf14('0x39')](_0xb38606);}function msgResponse(_0x3e519f,_0x34de70,_0x3bf78c){return{'action':_0x3e519f,'response':_0x34de70,'message':_0x3bf78c,'stack':_0x3bf78c};}function emit(_0x317ba9,_0x43c2de,_0x19e33c){io['to'](_0x317ba9)[_0xdf14('0x3a')](_0x43c2de,_0x19e33c);}function emitOutboundVoiceQueueSummary(_0x1b772c){if(_0x1b772c[_0xdf14('0x3b')]===_0xdf14('0x3c')){logger[_0xdf14('0x3d')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xdf14('0x3e')](_0x1b772c,{'showHidden':![],'depth':null}));emit(util[_0xdf14('0x3f')](_0xdf14('0x40'),_0x1b772c['name']),_0xdf14('0x41'),_0x1b772c);}}function checkGetDataPredictive(_0x1054f3){if(isNotNull(_0x1054f3)&&!_[_0xdf14('0x42')](_0x1054f3)){loggerPredictive[_0xdf14('0x43')](_0xdf14('0x44'));loggerPredictive['info'](_0xdf14('0x45'),_0x1054f3[_0xdf14('0x46')]);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x47'),_0x1054f3[_0xdf14('0x48')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1054f3[_0xdf14('0x49')]);loggerPredictive[_0xdf14('0x43')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1054f3[_0xdf14('0x4a')]);loggerPredictive[_0xdf14('0x43')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1054f3[_0xdf14('0x4b')]);loggerPredictive['info'](_0xdf14('0x4c'),_0x1054f3[_0xdf14('0x4d')]);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x4e'));if(_0x1054f3[_0xdf14('0x46')]>0x0){if(!_['isUndefined'](_0x1054f3[_0xdf14('0x4d')])&&_0x1054f3['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0xdf14('0x43')](_0xdf14('0x4f'));if(!_[_0xdf14('0x39')](_0x1054f3[_0xdf14('0x4b')])&&_0x1054f3[_0xdf14('0x4b')]>0x0){return!![];}loggerPredictive[_0xdf14('0x43')](_0xdf14('0x50'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xdf14('0x43')](_0xdf14('0x51'));}return![];}function mergeDataErlangB(_0x125b39){return function(_0x219eda){loggerPredictive[_0xdf14('0x43')](_0xdf14('0x52'));loggerPredictive[_0xdf14('0x43')](_0xdf14('0x53'),_0x219eda[_0xdf14('0x54')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x219eda[_0xdf14('0x55')]);loggerPredictive['info'](_0xdf14('0x56'),_0x219eda[_0xdf14('0x57')]);loggerPredictive[_0xdf14('0x43')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x219eda[_0xdf14('0x58')]);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x56'),_0x219eda['erlangAbandonmentRate']);loggerPredictive['info'](_0xdf14('0x4e'));_[_0xdf14('0x59')](_0x125b39,_0x219eda);};}function ifInterval(_0x25e19d,_0x35be75){if(_[_0xdf14('0x39')](_0x35be75)){return![];}return utils['getSeconds'](undefined,_0x35be75)<_0x25e19d*0x3c;}function clearPredictiveAttributes(_0x4d31b0){if(_0x4d31b0[_0xdf14('0x26')]){_0x4d31b0[_0xdf14('0x26')]=undefined;loggerPredictive['debug'](_0x4d31b0[_0xdf14('0x5a')],_0xdf14('0x5b'));}if(_0x4d31b0['startPredictive']){_0x4d31b0['startPredictive']=undefined;loggerPredictive[_0xdf14('0x3d')](_0x4d31b0[_0xdf14('0x5a')],_0xdf14('0x5c'));}if(_0x4d31b0[_0xdf14('0x5d')]){clearInterval(_0x4d31b0[_0xdf14('0x5d')]);_0x4d31b0[_0xdf14('0x5d')]=undefined;loggerPredictive[_0xdf14('0x3d')](_0x4d31b0[_0xdf14('0x5a')],_0xdf14('0x5e'));}}function loggerCatchPredictive(_0x5d7251,_0x3ad592){return function(_0x384392){loggerPredictive[_0xdf14('0x5f')](_0x3ad592[_0xdf14('0x5a')],_0x5d7251);loggerPredictive[_0xdf14('0x5f')](_0x384392[_0xdf14('0x60')]);clearPredictiveAttributes(_0x3ad592);};}function loggerCatch(_0x2968aa){return function(_0x3cbcb8){logger[_0xdf14('0x5f')](_0x2968aa,util[_0xdf14('0x3e')](_0x3cbcb8,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1fa1b4,_0xab946d,_0x1cdfc0){return function(_0x34a25a){utils[_0xdf14('0x61')](_0xab946d,_0x1cdfc0,0x0);logger[_0xdf14('0x5f')](_0x1fa1b4,util[_0xdf14('0x3e')](_0x34a25a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x588366){return function(_0xab11f8){if(isNotNull(_0xab11f8)&&isNotNull(_0xab11f8[0x0])){if(_0xab11f8[0x0][_0xdf14('0x62')]>0x0){_0x588366[_0xdf14('0x63')]=utils[_0xdf14('0x64')][_0xdf14('0x65')];logger[_0xdf14('0x43')]('[getContactDialer2][ReScheduled]'+_0x588366[_0xdf14('0x5a')],_0xab11f8[0x0][_0xdf14('0x62')],'contacts');}else{_0x588366[_0xdf14('0x63')]=utils[_0xdf14('0x64')][_0xdf14('0x66')];logger[_0xdf14('0x43')]('[getContactDialer2][Empty]'+_0x588366[_0xdf14('0x5a')]);}}};}function createObjHistory(_0x3f7e2c,_0x55be57,_0x2c3e43,_0x2aa032,_0x374e82){_0x3f7e2c[_0xdf14('0x63')]=_0x2c3e43;var _0x6a2c3b=new Action(_0x3f7e2c,_0x55be57);var _0xe33c94=new History(_0x6a2c3b);_0xe33c94[_0xdf14('0x67')]=_0x2aa032;_0xe33c94[_0xdf14('0x68')]=_0x374e82;_0xe33c94[_0xdf14('0x69')]=_0x6a2c3b[_0xdf14('0x6a')];return _0xe33c94;}function unlockQueueStatus(_0x2f8578,_0x83ad8){setTimeout(function(){if(_[_0xdf14('0x39')](_0x2f8578[_0xdf14('0x6b')])){loggerBooked['error'](_0xdf14('0x6c'),_0x83ad8);}_0x2f8578[_0xdf14('0x6b')]=!![];loggerBooked[_0xdf14('0x43')](_0xdf14('0x6d'),_0x83ad8,JSON[_0xdf14('0x6e')](_[_0xdf14('0x6f')](_0x2f8578,[_0xdf14('0x5a'),_0xdf14('0x6b')])));},0x1f3);}function checkInterval(_0x2f5db5){return function(){if(!isNotNull(_0x2f5db5[_0xdf14('0x70')])){_0x2f5db5[_0xdf14('0x63')]=utils['CAMPAIGN_STATUS'][_0xdf14('0x71')];throw _0x2f5db5['name']+_0xdf14('0x72');}if(!isNotNull(_0x2f5db5[_0xdf14('0x70')][_0xdf14('0x73')])){_0x2f5db5[_0xdf14('0x63')]=utils[_0xdf14('0x64')][_0xdf14('0x71')];throw _0x2f5db5[_0xdf14('0x5a')]+_0xdf14('0x72');}if(!isNotNull(_[_0xdf14('0x42')](_0x2f5db5['Interval'][_0xdf14('0x73')]))){_0x2f5db5[_0xdf14('0x63')]=utils[_0xdf14('0x64')]['NULL_INTERVAL'];throw _0x2f5db5[_0xdf14('0x5a')]+_0xdf14('0x72');}};}function checkIsIVRCampaignActive(_0x323841){return function(){if(!utils['isIVRCampaignActive'](_0x323841)){_0x323841[_0xdf14('0x63')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x323841['name']+_0xdf14('0x74');}};}function emitCampaignSummary(_0xda27c0){if(utils[_0xdf14('0x75')](_0xda27c0)){emit(util['format'](_0xdf14('0x76'),_0xda27c0['name']),_0xdf14('0x77'),_0xda27c0);}}function loggerCatchQueueSummary(_0x321bc0,_0x53541f){return function(_0x41ce1f){clearPredictiveAttributes(_0x53541f);emitCampaignSummary(_0x53541f);loggerSyncQueueSummary[_0xdf14('0x3d')](_0x321bc0,util[_0xdf14('0x3e')](_0x41ce1f,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3712d4){if(_0x3712d4[_0xdf14('0x78')]){if(_0x3712d4[_0xdf14('0x79')]===0x0){_0x3712d4[_0xdf14('0x78')]=![];_0x3712d4['message']=utils[_0xdf14('0x64')][_0xdf14('0x7a')];loggerSyncQueueSummary[_0xdf14('0x3d')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3712d4[_0xdf14('0x5a')],_0xdf14('0x7b'));}else{_0x3712d4['message']=utils[_0xdf14('0x64')][_0xdf14('0x7c')];loggerSyncQueueSummary['debug'](_0xdf14('0x7d'),_0x3712d4[_0xdf14('0x5a')],'is\x20disactive');}emitCampaignSummary(_0x3712d4);}}function myreject(_0x2fb065){return function(_0x5243d7){return _0x2fb065(msgResponse(_0xdf14('0x7e'),_0xdf14('0x7f'),JSON[_0xdf14('0x6e')](_0x5243d7)));};}Dialer['prototype']['isTrunkReachable']=function(_0x39aeed){return!_[_0xdf14('0x39')](_0x39aeed)&&_0x39aeed&&!_[_0xdf14('0x39')](_0x39aeed[_0xdf14('0x5a')])&&!_[_0xdf14('0x39')](_0x39aeed['active'])&&_0x39aeed[_0xdf14('0x80')]&&(this[_0xdf14('0x22')][util[_0xdf14('0x3f')](_0xdf14('0x81'),_0x39aeed[_0xdf14('0x5a')])]['status']==='reachable'||this[_0xdf14('0x22')][util[_0xdf14('0x3f')](_0xdf14('0x81'),_0x39aeed['name'])][_0xdf14('0x82')]===_0xdf14('0x83'));};Dialer[_0xdf14('0x1b')]['checkIsTrunkReachable']=function(_0x372d8a){var _0x44bafc=this;return function(){if(!_0x44bafc[_0xdf14('0x84')](_0x372d8a[_0xdf14('0x85')])){if(!_0x44bafc[_0xdf14('0x84')](_0x372d8a['TrunkBackup'])){_0x372d8a['message']=utils[_0xdf14('0x64')][_0xdf14('0x86')];throw _0x372d8a[_0xdf14('0x5a')]+_0xdf14('0x87');}}};};Dialer[_0xdf14('0x1b')]['checkIfTime']=function(_0x21acf2,_0x484caa,_0x5dc424,_0x101031){var _0xd61bfe=this;return function(){var _0x52f3ad=!![];return _0xd61bfe[_0xdf14('0x88')](_0x21acf2,_0x484caa,_0x5dc424,_0x101031,_0x52f3ad);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x7c4d08,_0x27a48b,_0x540eb3,_0x4a7f82){var _0xa9d8ca=this;return function(){var _0x4345c4=![];return _0xa9d8ca[_0xdf14('0x88')](_0x7c4d08[_0xdf14('0x73')],_0x27a48b,_0x540eb3,_0x4a7f82,_0x4345c4);};};Dialer['prototype'][_0xdf14('0x88')]=function(_0x47d06a,_0x95b826,_0x2e6b42,_0x14d6c0,_0x493210){var _0x268cbb=[];return new Promise(function(_0x2c6310,_0x187a87){if(!isNotNull(_0x47d06a)){_0x14d6c0['message']=utils[_0xdf14('0x64')][_0xdf14('0x71')];return _0x187a87(msgResponse(_0xdf14('0x89'),_0xdf14('0x8a'),_0x2e6b42+_0xdf14('0x8b')));}if(_['isEmpty'](_0x47d06a)){_0x14d6c0[_0xdf14('0x63')]=utils['CAMPAIGN_STATUS'][_0xdf14('0x8c')];return _0x187a87(msgResponse('ifTime',_0xdf14('0x8a'),_0x2e6b42+_0xdf14('0x8d')));}if(_0x95b826&&_['isUndefined'](config['timezones'][_0x95b826])){_0x14d6c0[_0xdf14('0x63')]=utils[_0xdf14('0x64')]['UNKNOWN_TIMEZONE'];return _0x187a87(msgResponse(_0xdf14('0x89'),_0xdf14('0x8a'),_0x2e6b42+_0xdf14('0x8e')+_0x95b826));}if(_['isArray'](_0x47d06a)){for(var _0x184809=0x0;_0x184809<_0x47d06a[_0xdf14('0x8f')];_0x184809+=0x1){_0x268cbb[_0xdf14('0x90')](ami[_0xdf14('0x91')]({'action':_0xdf14('0x92'),'command':util[_0xdf14('0x3f')](_0xdf14('0x93'),_0x47d06a[_0x184809][_0xdf14('0x94')],!_[_0xdf14('0x39')](config[_0xdf14('0x95')][_0x95b826])?_0x95b826:'')})[_0xdf14('0x37')](function(_0xb4b23a){return _0xb4b23a[_0xdf14('0x96')]['indexOf'](_0xdf14('0x97'))>=0x0;})[_0xdf14('0x98')](myreject(_0x187a87)));}}else{_0x268cbb['push'](ami[_0xdf14('0x91')]({'action':_0xdf14('0x92'),'command':util[_0xdf14('0x3f')](_0xdf14('0x93'),_0x47d06a,!_[_0xdf14('0x39')](config[_0xdf14('0x95')][_0x95b826])?_0x95b826:'')})[_0xdf14('0x37')](function(_0x1a12bb){return _0x1a12bb[_0xdf14('0x96')][_0xdf14('0x99')]('true')>=0x0;})[_0xdf14('0x98')](myreject(_0x187a87)));}Promise[_0xdf14('0x9a')](_0x268cbb)['then'](function(_0x52d1d1){var _0x564084=_[_0xdf14('0x9b')](_0x52d1d1);if(_0x564084){return _0x2c6310(_0x564084);}else{_0x14d6c0['message']=_0x493210?utils[_0xdf14('0x64')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xdf14('0x64')]['OVERTIME_INTERVAL'];return _0x187a87(msgResponse('[ifTime][promiseAll]',_0xdf14('0x8a'),'Global:\x20'+_0x493210+'\x20'+_0x2e6b42+_0xdf14('0x9c')+util[_0xdf14('0x3e')](_0x47d06a,{'showHidden':![],'depth':null})+_0xdf14('0x9d')+_0x95b826));}})[_0xdf14('0x98')](function(_0x46d8a6){return _0x187a87(msgResponse(_0xdf14('0x89'),_0xdf14('0x8a'),JSON[_0xdf14('0x6e')](_0x46d8a6)));});});};Dialer[_0xdf14('0x1b')]['loopCampaigns']=function(){var _0x435838=this;return cmHopper[_0xdf14('0x9e')]({'active':![]},{'where':{'active':!![]}})[_0xdf14('0x37')](function(){setInterval(function(){_0x435838[_0xdf14('0x9f')]();},0x3e8);});};Dialer['prototype'][_0xdf14('0x9f')]=function(){var _0x4e9380=this;var _0x3f761f;for(var _0x2d36fa in this[_0xdf14('0x21')]){if(typeof this[_0xdf14('0x21')][_0x2d36fa]!==_0xdf14('0xa0')){_0x3f761f=this[_0xdf14('0x21')][_0x2d36fa];if(utils[_0xdf14('0x75')](_0x3f761f)&&utils[_0xdf14('0xa1')](_0x3f761f)){_0x3f761f[_0xdf14('0x78')]=!![];Promise[_0xdf14('0xa2')]()['then'](checkIsIVRCampaignActive(_0x3f761f))[_0xdf14('0x37')](checkInterval(_0x3f761f))['then'](_0x4e9380[_0xdf14('0xa3')](_0x3f761f))[_0xdf14('0x37')](_0x4e9380['checkIfTime'](_0x3f761f[_0xdf14('0xa4')],_0x3f761f['dialTimezone'],_0x3f761f[_0xdf14('0x5a')],_0x3f761f))[_0xdf14('0x37')](_0x4e9380[_0xdf14('0xa5')](_0x3f761f['Interval'],_0x3f761f[_0xdf14('0xa6')],_0x3f761f[_0xdf14('0x5a')],_0x3f761f))[_0xdf14('0x37')](_0x4e9380[_0xdf14('0xa7')](_0x3f761f))[_0xdf14('0x98')](loggerCatchQueueSummary(_0xdf14('0xa8'),_0x3f761f));}else{notSendMessagesCampaign(_0x3f761f);}}}};Dialer[_0xdf14('0x1b')]['checkDialMethod']=function(_0x2d47bd){if(_0x2d47bd[_0xdf14('0xa9')]!==_0xdf14('0xb')){clearPredictiveAttributes(_0x2d47bd);}switch(_0x2d47bd[_0xdf14('0xa9')]){case _0xdf14('0xaa'):this[_0xdf14('0xab')](_0x2d47bd,0x1);break;case'power':this[_0xdf14('0xab')](_0x2d47bd,_0x2d47bd[_0xdf14('0xac')]);break;case _0xdf14('0xb'):this[_0xdf14('0xb')](_0x2d47bd);break;case _0xdf14('0xa'):this[_0xdf14('0xab')](_0x2d47bd,0x1);break;default:logger[_0xdf14('0x5f')](_0xdf14('0xad'),_0x2d47bd[_0xdf14('0x5a')],_0xdf14('0xae'));}};Dialer[_0xdf14('0x1b')][_0xdf14('0x89')]=function(_0x1f6457,_0x53bc8c){var _0x4f6bbc=_0x1f6457['dialTimezone'];var _0x5ef1ec=_0x53bc8c?_0x1f6457[_0xdf14('0xa4')]:_0x1f6457[_0xdf14('0x70')]['Intervals'];logger[_0xdf14('0xaf')](_0xdf14('0xb0'),_0x5ef1ec,_0x4f6bbc,_0x1f6457[_0xdf14('0x5a')],util[_0xdf14('0x3f')](_0xdf14('0xb1'),_0x1f6457[_0xdf14('0x5a')],_0x1f6457['id']));var _0x25b3ef=null;return Interval[_0xdf14('0xb2')](_0x5ef1ec,_0x4f6bbc)[_0xdf14('0x37')](function(_0x3596e8){if(_0x3596e8===!![]){return _0x3596e8;}else{_0x1f6457[_0xdf14('0x63')]=_0x53bc8c?utils[_0xdf14('0x64')][_0xdf14('0xb3')]:utils[_0xdf14('0x64')]['OVERTIME_INTERVAL'];_0x25b3ef=msgResponse(_0xdf14('0xb4'),_0xdf14('0x8a'),_0xdf14('0xb5')+_0x53bc8c+'\x20'+_0x1f6457[_0xdf14('0x5a')]+_0xdf14('0x9c')+util['inspect'](_0x5ef1ec,{'showHidden':![],'depth':null})+_0xdf14('0x9d')+_0x4f6bbc);}if(_0x25b3ef!==null){logger[_0xdf14('0xaf')](_0xdf14('0xb6'),_0x25b3ef);_0x25b3ef[_0xdf14('0xb7')]=_0x53bc8c;throw _0x25b3ef;}})[_0xdf14('0x98')](function(_0x12a631){logger[_0xdf14('0x5f')](_0xdf14('0xb8'),_0x12a631);throw msgResponse(_0xdf14('0x7e'),_0xdf14('0x7f'),util[_0xdf14('0x3e')](_0x12a631,{'showHidden':![],'depth':null}));});};Dialer[_0xdf14('0x1b')][_0xdf14('0xb9')]=function(_0x4118f7){if(this[_0xdf14('0xba')][_0x4118f7[_0xdf14('0xbb')]]){if(this[_0xdf14('0xbc')][_0x4118f7[_0xdf14('0xbd')]]&&this[_0xdf14('0xbc')][_0x4118f7[_0xdf14('0xbd')]][_0xdf14('0x3b')]!==_0xdf14('0xbe')){this[_0xdf14('0xbf')](this['voiceQueues'][_0x4118f7[_0xdf14('0xbb')]]);this[_0xdf14('0xbc')][_0x4118f7[_0xdf14('0xbd')]][_0xdf14('0xc0')]=moment()['format'](_0xdf14('0xc1'));}}};Dialer[_0xdf14('0x1b')]['syncAgentComplete']=function(_0x2c4bc7){var _0x441aab=this[_0xdf14('0xbc')][_0x2c4bc7[_0xdf14('0xbd')]];if(this[_0xdf14('0xba')][_0x2c4bc7[_0xdf14('0xbb')]]){if(_0x441aab&&_0x441aab['type']!==_0xdf14('0xbe')){delete this['uniqueId'][_0x2c4bc7[_0xdf14('0xbd')]];this[_0xdf14('0xba')][_0x2c4bc7[_0xdf14('0xbb')]][_0xdf14('0xc2')]+=0x1;var _0x1eb7f6=new AgentComplete(_0x441aab,_0x2c4bc7);if(_0x2c4bc7[_0xdf14('0xc3')]===_0xdf14('0xc4')){_0x1eb7f6[_0xdf14('0xc5')]=this[_0xdf14('0xba')][_0x2c4bc7[_0xdf14('0xbb')]]['dialQueueProject2']&&this[_0xdf14('0xba')][_0x2c4bc7[_0xdf14('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0xdf14('0x3f')](_0xdf14('0xc1')):undefined;}hopperUtils[_0xdf14('0xc6')](_0x1eb7f6)[_0xdf14('0x98')](loggerCatch(_0xdf14('0xc7')));hopperUtils[_0xdf14('0xc8')](_0x1eb7f6)[_0xdf14('0x98')](loggerCatch(_0xdf14('0xc9')));}}};Dialer[_0xdf14('0x1b')]['syncQueueCallerAbandon']=function(_0x410a5f){var _0x113c3d=this[_0xdf14('0xbc')][_0x410a5f[_0xdf14('0xbd')]];var _0x107b10=this;var _0x53a32d=![];var _0x16cda9;var _0x5084f0;if(this['voiceQueues'][_0x410a5f[_0xdf14('0xbb')]]){if(_0x113c3d&&_0x113c3d[_0xdf14('0x3b')]!=='ivr'){delete this[_0xdf14('0xbc')][_0x410a5f[_0xdf14('0xbd')]];this[_0xdf14('0xbf')](this[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]]);_0x113c3d[_0xdf14('0xca')]=moment()[_0xdf14('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');var _0x358851=new QueueCallerAbandon(_0x113c3d,_0x410a5f);if(utils[_0xdf14('0xcb')](_0x113c3d['droptime'],_0x113c3d[_0xdf14('0xcc')])>=_0x113c3d[_0xdf14('0xcd')]){this['voiceQueues'][_0x410a5f['queue']][_0xdf14('0x49')]+=0x1;this[_0xdf14('0xba')][_0x410a5f['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xce')]+=0x1;_0x358851[_0xdf14('0x67')]=0xa;_0x358851[_0xdf14('0x68')]=_0xdf14('0xcf');_0x358851[_0xdf14('0xd0')]=_0xdf14('0xd1');_0x358851[_0xdf14('0xc5')]=this['voiceQueues'][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xd2')]?moment()['format'](_0xdf14('0xc1')):undefined;_0x358851[_0xdf14('0xd3')]+=0x1;_0x358851[_0xdf14('0xd4')]+=0x1;_0x16cda9=this['voiceQueues'][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xd5')];_0x5084f0=this[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xd6')];hopperUtils[_0xdf14('0xd7')](_0x358851,_0x358851[_0xdf14('0x67')],_0x113c3d[_0xdf14('0xd8')])['then'](function(_0x582f93){_0x53a32d=_0x582f93[_0xdf14('0xd9')]==0x1;if(_0x358851[_0xdf14('0xd3')]>=_0x107b10[_0xdf14('0xba')][_0x410a5f['queue']][_0xdf14('0xda')]){_0x107b10[_0xdf14('0xdb')](_0x358851,_0x582f93['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x358851[_0xdf14('0xd3')],'scheduledat':moment()[_0xdf14('0xdc')](_0x107b10[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xd5')],'minutes')[_0xdf14('0x3f')](_0xdf14('0xc1')),'ContactId':_0x113c3d[_0xdf14('0xdd')],'ListId':_0x113c3d[_0xdf14('0xde')],'VoiceQueueId':_0x113c3d[_0xdf14('0xdf')]||undefined,'CampaignId':_0x113c3d[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0xe1')));var _0x161353=new History(_0x358851);_0x161353['state']=0xa;_0x161353[_0xdf14('0x68')]=_0xdf14('0xcf');_0x161353[_0xdf14('0x6a')]=moment()[_0xdf14('0x3f')](_0xdf14('0xc1'));_0x161353[_0xdf14('0x69')]=_0x161353[_0xdf14('0x6a')];_0x161353[_0xdf14('0xe2')]=_0x358851[_0xdf14('0xe2')];_0x161353['calleridnum']=_0x358851[_0xdf14('0xe3')];hopperUtils[_0xdf14('0xc6')](_0x161353)[_0xdf14('0x98')](loggerCatch(_0xdf14('0xe4')));}})[_0xdf14('0x37')](function(){if(_0x53a32d)hopperUtils['swapAdditionalPhones'](_0x358851,_0x16cda9,_0x5084f0)[_0xdf14('0x37')](function(){return 0x1;});});}else{this[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0x4a')]+=0x1;this['voiceQueues'][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xe5')]+=0x1;_0x358851[_0xdf14('0x67')]=0xb;_0x358851[_0xdf14('0x68')]=_0xdf14('0xe6');_0x358851[_0xdf14('0xd0')]=_0xdf14('0xe7');_0x358851['countabandonedretry']+=0x1;_0x358851[_0xdf14('0xd4')]+=0x1;_0x16cda9=this[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xe8')];_0x5084f0=this[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xd6')];hopperUtils[_0xdf14('0xd7')](_0x358851,_0x358851[_0xdf14('0x67')],_0x113c3d[_0xdf14('0xd8')])['then'](function(_0x1d801a){if(_0x358851[_0xdf14('0xe9')]>=_0x107b10[_0xdf14('0xba')][_0x410a5f['queue']]['dialAbandonedMaxRetry']){_0x107b10[_0xdf14('0xdb')](_0x358851,_0x1d801a[_0xdf14('0xd9')]);}else{hopperUtils[_0xdf14('0xea')]({'active':![],'countabandonedretry':_0x358851[_0xdf14('0xe9')],'scheduledat':moment()[_0xdf14('0xdc')](_0x107b10[_0xdf14('0xba')][_0x410a5f[_0xdf14('0xbb')]][_0xdf14('0xe8')],_0xdf14('0xeb'))[_0xdf14('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x113c3d[_0xdf14('0xdd')],'ListId':_0x113c3d[_0xdf14('0xde')],'VoiceQueueId':_0x113c3d[_0xdf14('0xdf')]||undefined,'CampaignId':_0x113c3d[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0xec')));var _0x5bf641=new History(_0x358851);_0x5bf641[_0xdf14('0x67')]=0xb;_0x5bf641['statedesc']='Abandoned';_0x5bf641[_0xdf14('0x6a')]=moment()[_0xdf14('0x3f')]('YYYY-MM-DD\x20HH:mm:ss');_0x5bf641[_0xdf14('0x69')]=_0x5bf641[_0xdf14('0x6a')];_0x5bf641[_0xdf14('0xe2')]=_0x358851[_0xdf14('0xe2')];_0x5bf641[_0xdf14('0xe3')]=_0x358851['calleridnum'];hopperUtils['createHistory'](_0x5bf641)[_0xdf14('0x98')](loggerCatch(_0xdf14('0xed')));}})['then'](function(){if(_0x53a32d)hopperUtils[_0xdf14('0xee')](_0x358851,_0x16cda9,_0x5084f0)[_0xdf14('0x37')](function(){return 0x1;});});}}}};Dialer[_0xdf14('0x1b')][_0xdf14('0xef')]=function(_0x4de06c){if(this['actions'][_0x4de06c[_0xdf14('0xbd')]]){this[_0xdf14('0xf0')][_0x4de06c[_0xdf14('0xbd')]][_0xdf14('0xf1')]=_0x4de06c[_0xdf14('0xf1')];}if(this[_0xdf14('0xbc')][_0x4de06c[_0xdf14('0xbd')]]){this[_0xdf14('0xbc')][_0x4de06c[_0xdf14('0xbd')]]['channel']=_0x4de06c[_0xdf14('0xf1')];}};Dialer['prototype'][_0xdf14('0xf2')]=function(_0x1342fc){if(!this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]]){return;}var _0x5a9d89=this[_0xdf14('0xba')][this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]][_0xdf14('0xbb')]][_0xdf14('0xf4')]||'rrmemory';if(_0x5a9d89===_0xdf14('0xf5')){if(this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]]&&_['isNil'](this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]][_0xdf14('0xf6')])&&_0x1342fc[_0xdf14('0x82')]==='1'&&_0x1342fc[_0xdf14('0xf7')]==='0'){if(this[_0xdf14('0xf8')][_0x1342fc[_0xdf14('0xf9')]]){if(!this['agents'][_0x1342fc[_0xdf14('0xf9')]][_0xdf14('0xf6')]){this[_0xdf14('0xf8')][_0x1342fc[_0xdf14('0xf9')]]['locked']=!![];this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]]['locked']=!![];this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]][_0xdf14('0xf9')]=_0x1342fc[_0xdf14('0xf9')];}}}}else if(_0x5a9d89==='rrmemory'){if(this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]]){if(this[_0xdf14('0xf8')][_0x1342fc[_0xdf14('0xf9')]]){this[_0xdf14('0xf0')][_0x1342fc['actionid']][_0xdf14('0xf9')]=_0x1342fc[_0xdf14('0xf9')];if(_['isNil'](this['queueBooked'][this['actions'][_0x1342fc[_0xdf14('0xf3')]][_0xdf14('0xbb')]])){this['queueBooked'][this['actions'][_0x1342fc[_0xdf14('0xf3')]][_0xdf14('0xbb')]]=[];}this[_0xdf14('0xfa')][this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]]['queue']][_0xdf14('0x90')](_['merge'](_[_0xdf14('0x6f')](this[_0xdf14('0xf0')][_0x1342fc[_0xdf14('0xf3')]],[_0xdf14('0xfb'),_0xdf14('0xf9')]),{'status':_0x1342fc[_0xdf14('0x82')],'paused':_0x1342fc[_0xdf14('0xf7')]}));}}}};Dialer[_0xdf14('0x1b')][_0xdf14('0x33')]=function(_0x2b5648){if(!this[_0xdf14('0xf0')][_0x2b5648['actionid']]){return;}var _0x261b00=this;var _0x1b4b19=this[_0xdf14('0xba')][this[_0xdf14('0xf0')][_0x2b5648['actionid']][_0xdf14('0xbb')]];var _0x121d67=_0x1b4b19['strategy']||_0xdf14('0xfc');if(_0x121d67===_0xdf14('0xf5')){if(this['actions'][_0x2b5648[_0xdf14('0xf3')]]&&this[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]]['stateinterface']){this['preview'][_0xdf14('0xfd')](this['actions'][_0x2b5648[_0xdf14('0xf3')]]['idHopper'],this[_0xdf14('0xf0')][_0x2b5648['actionid']][_0xdf14('0xf9')])[_0xdf14('0x98')](function(_0x2d40d3){logger[_0xdf14('0x5f')](_0xdf14('0xfe'),util[_0xdf14('0x3e')](_0x2d40d3,{'showHidden':![],'depth':null}));})[_0xdf14('0x1e')](function(){_0x261b00[_0xdf14('0xbf')](_0x261b00[_0xdf14('0xba')][_0x261b00[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]]);_0x261b00['agents'][_0x261b00[_0xdf14('0xf0')][_0x2b5648['actionid']][_0xdf14('0xf9')]][_0xdf14('0xf6')]=![];delete _0x261b00['actions'][_0x2b5648[_0xdf14('0xf3')]];unlockQueueStatus(_0x1b4b19);});}else{this[_0xdf14('0xbf')](this[_0xdf14('0xba')][this[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]]);hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xdd')],'ListId':this[_0xdf14('0xf0')][_0x2b5648['actionid']][_0xdf14('0xde')],'VoiceQueueId':this[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xdf')]||undefined,'CampaignId':this[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xe0')]||undefined})['catch'](loggerCatch(_0xdf14('0xff')));delete this['actions'][_0x2b5648[_0xdf14('0xf3')]];unlockQueueStatus(_0x1b4b19);}}else if(_0x121d67===_0xdf14('0xfc')){var _0x5dbec3;if(this['actions'][_0x2b5648['actionid']]&&!_['isEmpty'](this[_0xdf14('0xfa')][this['actions'][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]])){if(this[_0xdf14('0x100')][_0x261b00['actions'][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]]){this[_0xdf14('0x100')][_0x261b00[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]]=this['queueBookedRR'][this['actions'][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]]?this[_0xdf14('0x100')][this[_0xdf14('0xf0')][_0x2b5648['actionid']][_0xdf14('0xbb')]]:this[_0xdf14('0xfa')][this['actions'][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]]?this[_0xdf14('0xfa')][this['actions'][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]][_0xdf14('0x101')]||0x0:0x0;}this[_0xdf14('0xfa')][this[_0xdf14('0xf0')][_0x2b5648[_0xdf14('0xf3')]]['queue']][_0xdf14('0x101')]=this['queueBookedRR'][this['actions'][_0x2b5648[_0xdf14('0xf3')]][_0xdf14('0xbb')]];for(var _0x580d4e=0x0;_0x580d4e=_0x4c0f21['dialGlobalMaxRetry']){_0x8233fb['stateGlobal'](_0x3385f7,_0x29f594,_0xaa4dfa,_0xdf14('0x126'));}else{if(_0x3385f7[_0xdf14('0x120')]>=_0x4c0f21[_0xdf14('0x127')]){_0x8233fb['createStateFinal'](_0x3385f7,_0x29f594,_0xaa4dfa,_0xdf14('0x128'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3385f7[_0xdf14('0x120')],'scheduledat':moment()['add'](_0x4c0f21[_0xdf14('0x129')],_0xdf14('0xeb'))['format'](_0xdf14('0xc1')),'ContactId':_0x3385f7['ContactId'],'ListId':_0x3385f7[_0xdf14('0xde')],'VoiceQueueId':_0x3385f7[_0xdf14('0xdf')]||undefined,'CampaignId':_0x3385f7['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x29f594({'reschedule':0x1});}}});}if(_0x1ddf33[_0xdf14('0x3b')]===_0xdf14('0xbe')&&this[_0xdf14('0x21')][_0x1ddf33[_0xdf14('0xbb')]][_0xdf14('0x116')]&&_0x4b5fd3[_0xdf14('0x117')]===_0xdf14('0x118')){delete this[_0xdf14('0xbc')][_0x4b5fd3[_0xdf14('0xbd')]];this[_0xdf14('0xbf')](this['campaigns'][_0x1ddf33[_0xdf14('0xbb')]]);_0xdeff5d=new Hangup(_0x1ddf33,_0x4b5fd3);_0xdeff5d[_0xdf14('0x67')]=0x12;_0xdeff5d[_0xdf14('0x68')]=_0xdf14('0x119');_0xdeff5d['membername']='AMD';ami[_0xdf14('0x3a')]('custom:amd',ut[_0xdf14('0x11c')](_0xdeff5d,'amd'));this[_0xdf14('0x12a')](_0xdeff5d,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x1ddf33[_0xdf14('0x3b')]===_0xdf14('0xbe')&&this[_0xdf14('0x21')][_0x1ddf33[_0xdf14('0xbb')]]['dialAMDActive']&&_0x4b5fd3[_0xdf14('0x117')]===_0xdf14('0x12b')){return new Promise(function(_0x246154,_0x23e9ea){delete _0x8233fb[_0xdf14('0xbc')][_0x4b5fd3['uniqueid']];_0x8233fb[_0xdf14('0xbf')](_0x8233fb['campaigns'][_0x1ddf33['queue']]);_0x8233fb[_0xdf14('0x21')][_0x1ddf33[_0xdf14('0xbb')]][_0xdf14('0xc2')]+=0x1;_0x8233fb['campaigns'][_0x1ddf33['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x2eb61d=_0x8233fb[_0xdf14('0x21')][_0x1ddf33[_0xdf14('0xbb')]];var _0x121e79=new Hangup(_0x1ddf33,_0x4b5fd3);_0x121e79[_0xdf14('0x67')]=0x13;_0x121e79[_0xdf14('0x68')]=_0xdf14('0x11f');_0x121e79['membername']='AMD';_0x121e79[_0xdf14('0x120')]+=0x1;_0x121e79['countglobal']+=0x1;_0x121e79[_0xdf14('0x121')]=!![];ami['emit'](_0xdf14('0x12c'),ut[_0xdf14('0x11c')](_0x121e79,_0xdf14('0x121')));hopperUtils['createHistory'](_0x121e79)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x121e79[_0xdf14('0x12d')]+_0x121e79[_0xdf14('0x123')]+_0x121e79[_0xdf14('0x12e')]+_0x121e79[_0xdf14('0x124')]+_0x121e79[_0xdf14('0xd3')]+_0x121e79[_0xdf14('0xe9')]+_0x121e79[_0xdf14('0x120')]+_0x121e79[_0xdf14('0x125')]>=_0x2eb61d[_0xdf14('0x12f')]){_0x8233fb[_0xdf14('0x130')](_0x121e79,_0x246154,_0x23e9ea,_0xdf14('0x126'));}else{if(_0x121e79[_0xdf14('0x120')]>=_0x2eb61d['dialMachineMaxRetry']){_0x8233fb[_0xdf14('0x131')](_0x121e79,_0x246154,_0x23e9ea,_0xdf14('0x128'));}else{hopperUtils[_0xdf14('0xea')]({'active':![],'countmachineretry':_0x121e79[_0xdf14('0x120')],'scheduledat':moment()[_0xdf14('0xdc')](_0x2eb61d[_0xdf14('0x129')],'minutes')[_0xdf14('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x121e79['ContactId'],'ListId':_0x121e79[_0xdf14('0xde')],'VoiceQueueId':_0x121e79[_0xdf14('0xdf')]||undefined,'CampaignId':_0x121e79['CampaignId']||undefined})[_0xdf14('0x98')](loggerCatch('[rescheduleContact][Machine]'));_0x246154({'reschedule':0x1});}}});}}};Dialer[_0xdf14('0x1b')][_0xdf14('0x2f')]=function(_0x16b082){var _0x3bd9e7=this[_0xdf14('0xbc')][_0x16b082[_0xdf14('0xbd')]];var _0xc7ca9c;if(_0x3bd9e7&&_0x3bd9e7[_0xdf14('0x3b')]===_0xdf14('0xbe')){delete this[_0xdf14('0xbc')][_0x16b082[_0xdf14('0xbd')]];this[_0xdf14('0xbf')](this['campaigns'][_0x3bd9e7[_0xdf14('0xbb')]]);this[_0xdf14('0x21')][_0x3bd9e7[_0xdf14('0xbb')]][_0xdf14('0x132')]+=0x1;_0xc7ca9c=new Hangup(_0x3bd9e7,_0x16b082);hopperUtils[_0xdf14('0xc6')](_0xc7ca9c)[_0xdf14('0x98')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xdf14('0xc8')](_0xc7ca9c)['catch'](loggerCatch(_0xdf14('0x133')));}if(_0x3bd9e7&&_0x3bd9e7[_0xdf14('0x3b')]!==_0xdf14('0xbe')&&isNotNull(this[_0xdf14('0xba')][_0x3bd9e7[_0xdf14('0xbb')]][_0xdf14('0x134')])){delete this[_0xdf14('0xbc')][_0x16b082[_0xdf14('0xbd')]];this[_0xdf14('0xbf')](this[_0xdf14('0xba')][_0x3bd9e7['queue']]);this[_0xdf14('0xba')][_0x3bd9e7[_0xdf14('0xbb')]][_0xdf14('0xc2')]+=0x1;this[_0xdf14('0xba')][_0x3bd9e7['queue']][_0xdf14('0x135')]+=0x1;_0xc7ca9c=new Hangup(_0x3bd9e7,_0x16b082);_0xc7ca9c['state']=0x10;_0xc7ca9c[_0xdf14('0x68')]=_0xdf14('0x136');_0xc7ca9c[_0xdf14('0x11a')]=_0xdf14('0x137');hopperUtils[_0xdf14('0xc6')](_0xc7ca9c)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x138')));hopperUtils[_0xdf14('0xc8')](_0xc7ca9c)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x133')));}if(_0x3bd9e7&&_0x3bd9e7[_0xdf14('0x3b')]!==_0xdf14('0xbe')&&!isNotNull(this[_0xdf14('0xba')][_0x3bd9e7[_0xdf14('0xbb')]][_0xdf14('0x134')])){delete this[_0xdf14('0xbc')][_0x16b082[_0xdf14('0xbd')]];this[_0xdf14('0xbf')](this['voiceQueues'][_0x3bd9e7[_0xdf14('0xbb')]]);this[_0xdf14('0xba')][_0x3bd9e7['queue']]['outboundUnknownCallsDay']+=0x1;_0xc7ca9c=new Hangup(_0x3bd9e7,_0x16b082);_0xc7ca9c[_0xdf14('0x67')]=0xc;_0xc7ca9c[_0xdf14('0x68')]=_0x16b082['cause-txt'];_0xc7ca9c[_0xdf14('0x11a')]=_0xdf14('0x139');hopperUtils[_0xdf14('0xc6')](_0xc7ca9c)['catch'](loggerCatch(_0xdf14('0x138')));hopperUtils[_0xdf14('0xc8')](_0xc7ca9c)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x133')));}};Dialer[_0xdf14('0x1b')][_0xdf14('0xd')]=function(_0x1ee09f){var _0x4ec828=this;if(!_0x4ec828[_0xdf14('0x27')][_0x1ee09f['name']]){_0x4ec828[_0xdf14('0x27')][_0x1ee09f['name']]={'running':![]};}else if(_0x4ec828[_0xdf14('0x27')][_0x1ee09f[_0xdf14('0x5a')]][_0xdf14('0x13a')]===!![]){return;}else if(_0x4ec828['queuesSummary'][_0x1ee09f[_0xdf14('0x5a')]][_0xdf14('0x13a')]===![]){_0x4ec828[_0xdf14('0x27')][_0x1ee09f[_0xdf14('0x5a')]][_0xdf14('0x13a')]=!![];}var _0x1c88c1=_0x4ec828[_0xdf14('0xba')][_0x1ee09f[_0xdf14('0x5a')]];var _0x3aa406=_0x1c88c1[_0xdf14('0x63')]!==utils['CAMPAIGN_STATUS'][_0xdf14('0x7a')];var _0x2a0d52=utils[_0xdf14('0x13b')](_0x1c88c1);_0x1c88c1[_0xdf14('0x13c')]=utils['getQueueCampaignStatusMessage'](_0x1c88c1,_0x4ec828[_0xdf14('0x22')]);Promise['resolve']()[_0xdf14('0x37')](function(){if(_0x1c88c1[_0xdf14('0x13c')]===utils[_0xdf14('0x64')]['INACTIVE']){if(_0x3aa406){clearPredictiveAttributes(_0x1c88c1);_0x1ee09f[_0xdf14('0x25')]=undefined;_0x1ee09f[_0xdf14('0x26')]=undefined;}if(_0x1c88c1[_0xdf14('0x13c')]===utils[_0xdf14('0x64')][_0xdf14('0x7a')]){_0x1ee09f['available']=0x0;_0x1ee09f['paused']=0x0;_0x1ee09f[_0xdf14('0x13d')]=0x0;_0x1ee09f[_0xdf14('0x13e')]=0x0;_0x1ee09f[_0xdf14('0x13f')]=0x0;}}else if(_0x1c88c1[_0xdf14('0x13c')]===utils[_0xdf14('0x64')][_0xdf14('0x140')]&&!_0x2a0d52){return _0x4ec828['ifTime'](_0x1c88c1,!![])[_0xdf14('0x37')](function(){return _0x4ec828['ifTime'](_0x1c88c1,![]);})[_0xdf14('0x37')](function(){return _0x4ec828[_0xdf14('0x141')](_0x1c88c1);})[_0xdf14('0x98')](function(_0x3cf48f){loggerSyncQueueSummary[_0xdf14('0x3d')](_0xdf14('0x142'),util[_0xdf14('0x3e')](_0x3cf48f,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x1c88c1);});}else{clearPredictiveAttributes(_0x1c88c1);}})[_0xdf14('0x37')](function(){var _0x56a0a2=_0x1ee09f[_0xdf14('0x143')](_0x1c88c1);if(_0x56a0a2||_0x1c88c1[_0xdf14('0x144')]){_0x1c88c1[_0xdf14('0x144')]=![];_0x1ee09f[_0xdf14('0x145')](_0x1c88c1);Object[_0xdf14('0x146')](_0x1c88c1,_0x1ee09f);emitOutboundVoiceQueueSummary(_0x1ee09f);}_0x4ec828[_0xdf14('0x27')][_0x1c88c1['name']][_0xdf14('0x13a')]=![];})[_0xdf14('0x98')](function(_0x3e3d44){logger[_0xdf14('0x5f')](_0xdf14('0x142'),util[_0xdf14('0x3e')](_0x3e3d44,{'showHidden':![],'depth':null}));_0x4ec828[_0xdf14('0x27')][_0x1c88c1[_0xdf14('0x5a')]][_0xdf14('0x13a')]=![];});};Dialer[_0xdf14('0x1b')][_0xdf14('0x2e')]=_[_0xdf14('0x147')](function(){var _0x67f23f=_[_0xdf14('0x148')](this[_0xdf14('0xba')],function(_0x42c167){return _0x42c167[_0xdf14('0x149')];});var _0xefae24=_[_0xdf14('0x148')](this[_0xdf14('0xf8')],function(_0x4debb1){return _0x4debb1[_0xdf14('0x14a')]&&_0x4debb1[_0xdf14('0x82')]===_0xdf14('0x14b');});if(_0x67f23f[_0xdf14('0x8f')]>0x0&&_0xefae24[_0xdf14('0x8f')]>0x0){return Promise['resolve']()[_0xdf14('0x37')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x67f23f,'id'),previewRecallmeReminderInterval,_[_0xdf14('0x14c')](_0xefae24,'id')))[_0xdf14('0x37')](function(_0x1ce985){for(var _0x136fcf=0x0;_0x136fcf<_0x1ce985['length'];_0x136fcf++){var _0x2d5453=_0x1ce985[_0x136fcf][_0xdf14('0x14d')][_0xdf14('0x5a')];if(_0x2d5453)io['to'](util[_0xdf14('0x3f')](_0xdf14('0x14e'),_0x2d5453))['emit'](_0xdf14('0x14f'),{'hopper':_0x1ce985[_0x136fcf]});}})[_0xdf14('0x98')](function(_0x2d5426){logger[_0xdf14('0x5f')](_0xdf14('0x150'),_0x2d5426);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x1fbdff=this;setInterval(function(){_0x1fbdff[_0xdf14('0x151')](_0x1fbdff[_0xdf14('0xbc')],_0xdf14('0x152'));_0x1fbdff[_0xdf14('0x151')](_0x1fbdff[_0xdf14('0xf0')],_0xdf14('0x153'));},0x32c8);};Dialer[_0xdf14('0x1b')][_0xdf14('0x151')]=function(_0x1c55c1,_0x57c6ea){var _0x8b1f7e=this;for(var _0x5d80c3 in _0x1c55c1){if(typeof _0x1c55c1[_0x5d80c3]!==_0xdf14('0xa0')){this[_0xdf14('0x1f')][_0xdf14('0x1c')](function(){if(!_[_0xdf14('0x102')](_0x1c55c1[_0x5d80c3])){return ami[_0xdf14('0x91')]({'action':_0xdf14('0x82'),'channel':_0x1c55c1[_0x5d80c3]['channel']})[_0xdf14('0x98')](function(_0x5cb9a8){if(_0x5cb9a8[_0xdf14('0x63')]===_0xdf14('0x154')){setTimeout(function(){if(_0x1c55c1[_0x5d80c3]&&_0x1c55c1[_0x5d80c3][_0xdf14('0x3b')]!==_0xdf14('0xbe')){_0x8b1f7e[_0xdf14('0xbf')](_0x8b1f7e[_0xdf14('0xba')][_0x1c55c1[_0x5d80c3]['queue']]);logger[_0xdf14('0x5f')](_0xdf14('0x155'),_0x57c6ea,_0x5d80c3,_0x1c55c1[_0x5d80c3][_0xdf14('0xbb')]);delete _0x1c55c1[_0x5d80c3];}if(_0x1c55c1[_0x5d80c3]&&_0x1c55c1[_0x5d80c3][_0xdf14('0x3b')]===_0xdf14('0xbe')){_0x8b1f7e[_0xdf14('0xbf')](_0x8b1f7e[_0xdf14('0x21')][_0x1c55c1[_0x5d80c3]['queue']]);logger[_0xdf14('0x5f')](_0xdf14('0x156'),_0x57c6ea,_0x5d80c3,_0x1c55c1[_0x5d80c3][_0xdf14('0xbb')]);delete _0x1c55c1[_0x5d80c3];}},0x2328);}});}});}}};Dialer[_0xdf14('0x1b')][_0xdf14('0x157')]=function(_0x101d20){return Promise[_0xdf14('0xa2')]()['then'](voiceQueueRt['getVoiceQueueRtPauses'](_0x101d20))['catch'](loggerCatch(_0xdf14('0x158')));};Dialer[_0xdf14('0x1b')][_0xdf14('0xbf')]=function(_0x438a30){if(!_['isUndefined'](_0x438a30)&&_0x438a30!==null){if(typeof _0x438a30[_0xdf14('0x79')]!=='undefined'){if(_0x438a30['originated']>0x0){_0x438a30[_0xdf14('0x79')]-=0x1;}else{logger[_0xdf14('0x5f')](_0xdf14('0x159'));}}}else{logger[_0xdf14('0x5f')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x291afe,_0x5e03d7){var _0x1c6070=this;return function(_0x307327){_0x1c6070[_0xdf14('0xbf')](_0x5e03d7);logger[_0xdf14('0x5f')](_0x291afe,util[_0xdf14('0x3e')](_0x307327,{'showHidden':![],'depth':null}));};};Dialer[_0xdf14('0x1b')][_0xdf14('0x15a')]=function(_0x5bcc3c,_0x4bbb90,_0x2fc7f4){var _0x43fc2a={'state':0x19,'statedesc':_0xdf14('0x15b')};this[_0xdf14('0xbf')](_0x4bbb90);this[_0xdf14('0x12a')](_[_0xdf14('0x59')](_0x43fc2a,_[_0xdf14('0x6f')](_0x2fc7f4,[_0xdf14('0xdd'),_0xdf14('0xde'),_0xdf14('0x15c'),'VoiceQueueId',_0xdf14('0xe0')])),_0xdf14('0x15d'),_0xdf14('0x15e'));logger['error'](_0x5bcc3c);};Dialer['prototype'][_0xdf14('0x12a')]=function(_0x442100,_0x30179d,_0x1d3543){hopperUtils[_0xdf14('0xc6')](_0x442100)[_0xdf14('0x98')](loggerCatch(_0x30179d));hopperUtils[_0xdf14('0xc8')](_0x442100)[_0xdf14('0x98')](loggerCatch(_0x1d3543));};Dialer[_0xdf14('0x1b')][_0xdf14('0xdb')]=function(_0x471a3b,_0x4cd838){hopperUtils[_0xdf14('0xc6')](_0x471a3b)[_0xdf14('0x98')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x4cd838==0x0){hopperUtils[_0xdf14('0xc8')](_0x471a3b)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x15f')));}};Dialer[_0xdf14('0x1b')][_0xdf14('0x150')]=function(_0x1c5a00){return Promise[_0xdf14('0xa2')]()[_0xdf14('0x37')](cmHopper['handlePreviewRecallNotifications'](_0x1c5a00['id'],previewRecallmeReminderInterval))[_0xdf14('0x37')](function(_0x4fc54b){for(var _0x2729a6=0x0;_0x2729a6<_0x4fc54b[_0xdf14('0x8f')];_0x2729a6++){var _0x39a677=_0x4fc54b[_0x2729a6][_0xdf14('0x14d')][_0xdf14('0x5a')];if(_0x39a677)io['to'](util[_0xdf14('0x3f')](_0xdf14('0x14e'),_0x39a677))[_0xdf14('0x3a')](_0xdf14('0x14f'),{'hopper':_0x4fc54b[_0x2729a6]});}})[_0xdf14('0x98')](function(){});};Dialer[_0xdf14('0x1b')][_0xdf14('0xa7')]=function(_0x1f7cde){var _0x56e167=this;return function(){_0x56e167['handleIvr'](_0x1f7cde);};};Dialer[_0xdf14('0x1b')][_0xdf14('0x160')]=function(_0x6f9a56,_0x563f68){var _0x191dbd=this;var _0x559dd7=uuid['v4']();this['actions'][_0x559dd7]=new Action(_0x6f9a56,_0x563f68,_0x559dd7);return new Promise(function(_0x4c8e96,_0x28fe85){if(_[_0xdf14('0x39')](_0x6f9a56)&&typeof _0x6f9a56!=='object'){return _0x28fe85(msgResponse(_0xdf14('0x161'),_0xdf14('0x8a'),'voiceQueue\x20is\x20undefine'));}if(_[_0xdf14('0x39')](_0x563f68[_0xdf14('0x162')])||_0x563f68['phone']===null){return _0x28fe85(msgResponse(_0xdf14('0x161'),_0xdf14('0x8a'),_0xdf14('0x163')));}var _0x3c7f71={'XMD-CALLERID':_0x191dbd[_0xdf14('0xf0')][_0x559dd7][_0xdf14('0x164')](),'XMD-AGI':_0x6f9a56['dialQueueProject']?util[_0xdf14('0x3f')](_0xdf14('0x165'),ipAgi,_0x6f9a56[_0xdf14('0x134')]):_0xdf14('0x166'),'XMD-AGIAFTER':_0x6f9a56[_0xdf14('0xd2')]?util[_0xdf14('0x3f')](_0xdf14('0x165'),ipAgi,_0x6f9a56[_0xdf14('0xd2')]):_0xdf14('0x166'),'XMD-QUEUE':utils['isOutboundQueue'](_0x6f9a56)?util[_0xdf14('0x3f')]('\x22%s,%s%s,,,%s\x22',_0x6f9a56[_0xdf14('0x5a')],_0x6f9a56[_0xdf14('0x167')]||'',_0x6f9a56['dialAgiAfterHangupAgent']?'c':'',_0x6f9a56[_0xdf14('0xcd')]||0x3):_0xdf14('0x166'),'XMD-CONTACTID':_0x563f68[_0xdf14('0xdd')],'XMD-CDRTYPE':_0xdf14('0x8'),'CALLERID(all)':_0x191dbd[_0xdf14('0xf0')][_0x559dd7][_0xdf14('0x164')](),'XMD-AMD':_0x6f9a56[_0xdf14('0x116')]?_0xdf14('0x140'):_0xdf14('0x166'),'XMD-DESTINATION':_0xdf14('0x115')};if(_0x6f9a56[_0xdf14('0x116')]){_0x3c7f71[_0xdf14('0x168')]=_0x6f9a56[_0xdf14('0x169')]||0x9c4;_0x3c7f71[_0xdf14('0x16a')]=_0x6f9a56[_0xdf14('0x16b')]||0x5dc;_0x3c7f71[_0xdf14('0x16c')]=_0x6f9a56[_0xdf14('0x16d')]||0x320;_0x3c7f71['XMD-AMDTOTALANALYSISTIME']=_0x6f9a56['dialAMDTotalAnalysisTime']||0x1388;_0x3c7f71[_0xdf14('0x16e')]=_0x6f9a56[_0xdf14('0x16f')]||0x64;_0x3c7f71[_0xdf14('0x170')]=_0x6f9a56[_0xdf14('0x171')]||0x32;_0x3c7f71[_0xdf14('0x172')]=_0x6f9a56['dialAMDMaximumNumberOfWords']||0x3;_0x3c7f71[_0xdf14('0x173')]=_0x6f9a56[_0xdf14('0x174')]||0x100;_0x3c7f71[_0xdf14('0x175')]=_0x6f9a56['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xdf14('0x176')](_0x6f9a56)){_0x3c7f71[_0xdf14('0x177')]=_0x563f68[_0xdf14('0xdf')];}else{_0x3c7f71[_0xdf14('0x178')]=_0x563f68['CampaignId'];}var _0x1d4d11=utils[_0xdf14('0x179')](_0x563f68[_0xdf14('0x17a')]);Object['assign'](_0x3c7f71,_0x1d4d11);var _0x3fd2d6=_0x191dbd[_0xdf14('0x84')](_0x6f9a56[_0xdf14('0x85')])?utils[_0xdf14('0x17b')](_0x6f9a56[_0xdf14('0x85')][_0xdf14('0x17c')],_0x6f9a56[_0xdf14('0x17d')],_0x6f9a56[_0xdf14('0x17e')]>0x0?utils[_0xdf14('0x17f')](_0x6f9a56['dialOriginateCallerIdNumber'],_0x6f9a56[_0xdf14('0x17e')]):_0x6f9a56['dialOriginateCallerIdNumber']):utils['getCallerId'](_[_0xdf14('0x102')](_0x6f9a56['TrunkBackup'])?_0x6f9a56['Trunk'][_0xdf14('0x17c')]:_0x6f9a56[_0xdf14('0x180')]['callerid'],_0x6f9a56[_0xdf14('0x17d')],_0x6f9a56['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xdf14('0x17f')](_0x6f9a56['dialOriginateCallerIdNumber'],_0x6f9a56[_0xdf14('0x17e')]):_0x6f9a56[_0xdf14('0x181')]);if(_0x3fd2d6){_0x3c7f71[_0xdf14('0x182')]=_0x191dbd[_0xdf14('0xf0')][_0x559dd7][_0xdf14('0x183')]=utils[_0xdf14('0x184')](_0x3fd2d6);_0x3c7f71['XMD-ORIGINATECALLERIDNUM']=_0x563f68[_0xdf14('0x162')];}_0x6f9a56[_0xdf14('0x185')]=_0x3c7f71;return ami[_0xdf14('0x91')]({'actionid':_0x559dd7,'action':_0xdf14('0x161'),'channel':_0x191dbd['isTrunkReachable'](_0x6f9a56['Trunk'])?util[_0xdf14('0x3f')](_0xdf14('0x186'),_0x6f9a56[_0xdf14('0x85')][_0xdf14('0x5a')],isNotNull(_0x6f9a56[_0xdf14('0x187')])?_0x6f9a56[_0xdf14('0x187')][_0xdf14('0x188')]()||'':'',_0x6f9a56[_0xdf14('0x189')]>0x0?_0x563f68[_0xdf14('0x162')][_0xdf14('0x18a')](_0x6f9a56[_0xdf14('0x189')]):_0x563f68[_0xdf14('0x162')]):util['format'](_0xdf14('0x186'),_[_0xdf14('0x102')](_0x6f9a56[_0xdf14('0x180')])?_0x6f9a56[_0xdf14('0x85')][_0xdf14('0x5a')]:_0x6f9a56[_0xdf14('0x180')][_0xdf14('0x5a')],isNotNull(_0x6f9a56[_0xdf14('0x187')])?_0x6f9a56[_0xdf14('0x187')][_0xdf14('0x188')]()||'':'',_0x6f9a56[_0xdf14('0x189')]>0x0?_0x563f68[_0xdf14('0x162')][_0xdf14('0x18a')](_0x6f9a56[_0xdf14('0x189')]):_0x563f68[_0xdf14('0x162')]),'callerid':_0x3fd2d6,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x3c7f71,'timeout':(_0x6f9a56[_0xdf14('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x559dd7})[_0xdf14('0x37')](function(_0x48ec0f){return _0x4c8e96(_0x48ec0f);})[_0xdf14('0x98')](function(_0x510963){_0x6f9a56[_0xdf14('0x18c')]+=0x1;var _0x193e07=new History(_0x191dbd['actions'][_0x559dd7]);logger[_0xdf14('0x5f')](util[_0xdf14('0x3f')](_0xdf14('0x18d'),JSON['stringify'](_0x510963)));_0x193e07[_0xdf14('0x67')]=0xe;_0x193e07[_0xdf14('0x68')]='OriginateError';_0x193e07[_0xdf14('0x6a')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x193e07[_0xdf14('0x69')]=_0x193e07[_0xdf14('0x6a')];hopperUtils[_0xdf14('0xc6')](_0x193e07)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x18e')));_0x191dbd[_0xdf14('0xc8')](_0x193e07)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x18e')))[_0xdf14('0x1e')](function(){delete _0x191dbd['actions'][_0x559dd7];return _0x28fe85(msgResponse(_0xdf14('0x161'),_0xdf14('0x7f'),_0xdf14('0x18f')));});});});};Dialer[_0xdf14('0x1b')][_0xdf14('0x190')]=function(_0x2efaa2,_0x54f4b0,_0x261c34){var _0x35ed9a=new History(_0x54f4b0);if(_0x35ed9a['countbusyretry']+_0x35ed9a[_0xdf14('0x123')]+_0x35ed9a[_0xdf14('0x12e')]+_0x35ed9a[_0xdf14('0x124')]+_0x35ed9a[_0xdf14('0xd3')]+_0x35ed9a['countabandonedretry']+_0x35ed9a['countmachineretry']+_0x35ed9a['countagentrejectretry']>=_0x261c34[_0xdf14('0x12f')]-0x1){return!![];}switch(_0x2efaa2){case 0x3:if(_0x35ed9a[_0xdf14('0x12e')]>=_0x261c34['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xdf14('0xea')]({'active':![],'countnoanswerretry':_0x35ed9a[_0xdf14('0x12e')]+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34[_0xdf14('0x191')],_0xdf14('0xeb'))[_0xdf14('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a['ListId'],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0x192')));break;case 0x5:if(_0x35ed9a[_0xdf14('0x12d')]>=_0x261c34[_0xdf14('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x35ed9a[_0xdf14('0x12d')]+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34['dialBusyRetryFrequency'],_0xdf14('0xeb'))[_0xdf14('0x3f')](_0xdf14('0xc1')),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a['ListId'],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})['catch'](loggerCatch(_0xdf14('0x194')));break;case 0x8:if(_0x35ed9a[_0xdf14('0x123')]>=_0x261c34[_0xdf14('0x195')]-0x1){return!![];}hopperUtils[_0xdf14('0xea')]({'active':![],'countcongestionretry':_0x35ed9a[_0xdf14('0x123')]+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34[_0xdf14('0x196')],_0xdf14('0xeb'))[_0xdf14('0x3f')](_0xdf14('0xc1')),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a[_0xdf14('0xde')],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0x197')));break;case 0x0:if(_0x35ed9a[_0xdf14('0x124')]>=_0x261c34[_0xdf14('0x198')]-0x1){return!![];}else{hopperUtils[_0xdf14('0xea')]({'active':![],'countnosuchnumberretry':_0x35ed9a[_0xdf14('0x124')]+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34[_0xdf14('0x199')],_0xdf14('0xeb'))[_0xdf14('0x3f')](_0xdf14('0xc1')),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a[_0xdf14('0xde')],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x35ed9a['countdropretry']>=_0x261c34[_0xdf14('0xda')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x35ed9a[_0xdf14('0xd3')]+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34[_0xdf14('0xd5')],_0xdf14('0xeb'))[_0xdf14('0x3f')](_0xdf14('0xc1')),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a[_0xdf14('0xde')],'VoiceQueueId':_0x35ed9a['VoiceQueueId']||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0xe1')));break;case 0xb:if(_0x35ed9a[_0xdf14('0xe9')]>=_0x261c34['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0xdf14('0xea')]({'active':![],'countabandonedretry':_0x35ed9a['countabandonedretry']+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34[_0xdf14('0xe8')],_0xdf14('0xeb'))['format'](_0xdf14('0xc1')),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a['ListId'],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0xec')));break;case 0x13:if(_0x35ed9a[_0xdf14('0x120')]>=_0x261c34[_0xdf14('0x127')]-0x1){return!![];}hopperUtils[_0xdf14('0xea')]({'active':![],'countmachineretry':_0x35ed9a['countmachineretry']+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34['dialMachineRetryFrequency'],_0xdf14('0xeb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a[_0xdf14('0xde')],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0x19a')));break;case 0x14:if(_0x35ed9a[_0xdf14('0x125')]>=_0x261c34[_0xdf14('0x19b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x35ed9a[_0xdf14('0x125')]+=0x1,'scheduledat':moment()[_0xdf14('0xdc')](_0x261c34['dialAgentRejectRetryFrequency'],_0xdf14('0xeb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35ed9a[_0xdf14('0xdd')],'ListId':_0x35ed9a[_0xdf14('0xde')],'VoiceQueueId':_0x35ed9a[_0xdf14('0xdf')]||undefined,'CampaignId':_0x35ed9a[_0xdf14('0xe0')]||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer[_0xdf14('0x1b')][_0xdf14('0x10f')]=function(_0x6561ec,_0x311fce,_0x527c66){var _0x100203=this;var _0x820176=new History(_0x6561ec);var _0x58c180=![];var _0xa825bc;var _0x263bd1;return new Promise(function(_0x24825a,_0x4d618c){if(_['isUndefined'](_0x311fce)&&typeof _0x311fce!==_0xdf14('0x19c')){return _0x4d618c(msgResponse(_0xdf14('0x19d'),_0xdf14('0x8a'),_0xdf14('0x19e')));}if(_[_0xdf14('0x39')](_0x527c66)&&typeof _0x527c66!==_0xdf14('0x19c')){return _0x4d618c(msgResponse(_0xdf14('0x19d'),'Failure',_0xdf14('0x19f')));}hopperUtils[_0xdf14('0xd7')](_0x820176,_0x527c66[_0xdf14('0xc3')],_0x311fce)[_0xdf14('0x37')](function(_0x4a6cbb){if(_0x4a6cbb['additional']==0x1)_0x58c180=!![];switch(_0x527c66[_0xdf14('0xc3')]){case'0':_0x311fce[_0xdf14('0x1a0')]+=0x1;_0x820176[_0xdf14('0x67')]=0x0;_0x820176[_0xdf14('0x68')]='NoSuchNumber';_0x820176[_0xdf14('0x124')]+=0x1;_0x820176['countglobal']+=0x1;ami[_0xdf14('0x3a')](_0xdf14('0x1a1'),ut['buildObj'](_0x6561ec,_0xdf14('0x1a2')));_0xa825bc=_0x311fce[_0xdf14('0x199')];_0x263bd1=_0x311fce['callAdditionalPhoneAfterMin'];hopperUtils[_0xdf14('0xc6')](_0x820176)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x122')));if(_0x100203[_0xdf14('0x190')](0x0,_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0x124')]>=_0x311fce[_0xdf14('0x198')]){_0x100203[_0xdf14('0x131')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1a3'));}else{_0x100203[_0xdf14('0x130')](_0x820176,_0x24825a,_0x4d618c,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x311fce[_0xdf14('0x1a4')]+=0x1;_0x820176[_0xdf14('0x67')]=0x3;_0x820176[_0xdf14('0x68')]=_0xdf14('0x1a5');_0x820176[_0xdf14('0x12e')]+=0x1;_0x820176[_0xdf14('0xd4')]+=0x1;var _0x3e7936=ut[_0xdf14('0x1a6')](_0x6561ec,_0x311fce);ami[_0xdf14('0x3a')](_0xdf14('0x1a7'),_0x3e7936);_0xa825bc=_0x311fce[_0xdf14('0x191')];_0x263bd1=_0x311fce[_0xdf14('0xd6')];hopperUtils[_0xdf14('0xc6')](_0x820176)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x1a8')));if(_0x100203[_0xdf14('0x190')](0x3,_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0x12e')]>=_0x311fce[_0xdf14('0x1a9')]){_0x100203[_0xdf14('0x131')](_0x820176,_0x24825a,_0x4d618c,'reason\x203\x20ringing\x20no\x20answer');}else{_0x100203[_0xdf14('0x130')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1aa'));}}break;case'5':_0x311fce[_0xdf14('0x1ab')]+=0x1;_0x820176[_0xdf14('0x67')]=0x5;_0x820176[_0xdf14('0x68')]=_0xdf14('0x1ac');_0x820176['countbusyretry']+=0x1;_0x820176[_0xdf14('0xd4')]+=0x1;ami[_0xdf14('0x3a')](_0xdf14('0x1ad'),ut[_0xdf14('0x11c')](_0x6561ec,_0xdf14('0x1ae')));_0xa825bc=_0x311fce[_0xdf14('0x1af')];_0x263bd1=_0x311fce[_0xdf14('0xd6')];hopperUtils[_0xdf14('0xc6')](_0x820176)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x1b0')));if(_0x100203[_0xdf14('0x190')](0x5,_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0x12d')]>=_0x311fce['dialBusyMaxRetry']){_0x100203[_0xdf14('0x131')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1b1'));}else{_0x100203[_0xdf14('0x130')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1b1'));}}break;case'8':_0x311fce[_0xdf14('0x1b2')]+=0x1;_0x820176[_0xdf14('0x67')]=0x8;_0x820176[_0xdf14('0x68')]=_0xdf14('0x1b3');_0x820176[_0xdf14('0x123')]+=0x1;_0x820176['countglobal']+=0x1;_0xa825bc=_0x311fce['dialCongestionRetryFrequency'];_0x263bd1=_0x311fce[_0xdf14('0xd6')];ami[_0xdf14('0x3a')](_0xdf14('0x1b4'),ut[_0xdf14('0x11c')](_0x6561ec,_0xdf14('0x1b5')));hopperUtils[_0xdf14('0xc6')](_0x820176)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x1b6')));if(_0x100203[_0xdf14('0x190')](0x8,_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0x123')]>=_0x311fce[_0xdf14('0x195')]){_0x100203[_0xdf14('0x131')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1b7'));}else{_0x100203[_0xdf14('0x130')](_0x820176,_0x24825a,_0x4d618c,'reason\x208\x20congestion');}}break;case'11':_0x311fce[_0xdf14('0x1b8')]+=0x1;_0x820176[_0xdf14('0x67')]=0xb;_0x820176[_0xdf14('0x68')]=_0xdf14('0xe6');_0x820176['countabandonedretry']+=0x1;_0x820176[_0xdf14('0xd4')]+=0x1;_0xa825bc=_0x311fce['dialAbandonedRetryFrequency'];_0x263bd1=_0x311fce['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x820176)[_0xdf14('0x98')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x100203['checkRetriveMax'](0xb,_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0xe9')]>=_0x311fce[_0xdf14('0x1b9')]){_0x100203[_0xdf14('0x131')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1ba'));}else{_0x100203[_0xdf14('0x130')](_0x820176,_0x24825a,_0x4d618c,'reason\x2011\x20abandoned');}}break;case'20':_0x311fce[_0xdf14('0x1bb')]+=0x1;_0x820176[_0xdf14('0x67')]=0x14;_0x820176[_0xdf14('0x68')]='AgentReject';_0x820176[_0xdf14('0x125')]+=0x1;_0x820176[_0xdf14('0xd4')]+=0x1;_0xa825bc=_0x311fce['dialAgentRejectRetryFrequency'];_0x263bd1=_0x311fce[_0xdf14('0xd6')];ami[_0xdf14('0x3a')](_0xdf14('0x1bc'),ut[_0xdf14('0x11c')](_0x6561ec,_0xdf14('0x1bd')));hopperUtils[_0xdf14('0xc6')](_0x820176)[_0xdf14('0x98')](loggerCatch(_0xdf14('0x1be')));if(_0x100203['checkRetriveMax'](0x14,_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0x125')]>=_0x311fce[_0xdf14('0x19b')]){_0x100203[_0xdf14('0x131')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1bf'));}else{_0x100203[_0xdf14('0x130')](_0x820176,_0x24825a,_0x4d618c,_0xdf14('0x1bf'));}}break;default:_0x311fce['outboundUnknownCallsDay']+=0x1;_0x820176['state']=0xc;_0x820176[_0xdf14('0x68')]=_0x527c66[_0xdf14('0xc3')];_0xa825bc=_0x311fce[_0xdf14('0x1c0')];_0x263bd1=_0x311fce[_0xdf14('0xd6')];hopperUtils[_0xdf14('0xc6')](_0x820176)['catch'](loggerCatch(_0xdf14('0x1c1')));if(_0x100203[_0xdf14('0x190')](_0x527c66[_0xdf14('0xc3')],_0x6561ec,_0x311fce)&&!_0x58c180){if(_0x820176[_0xdf14('0x12d')]+_0x820176[_0xdf14('0x123')]+_0x820176[_0xdf14('0x12e')]+_0x820176[_0xdf14('0x124')]+_0x820176['countdropretry']+_0x820176['countabandonedretry']+_0x820176[_0xdf14('0x120')]+_0x820176[_0xdf14('0x125')]>=_0x311fce[_0xdf14('0x12f')]){_0x100203['stateGlobal'](_0x820176,_0x24825a,_0x4d618c,_0x527c66['reason']);}else{_0x100203['createStateFinal'](_0x820176,_0x24825a,_0x4d618c,_0x527c66[_0xdf14('0xc3')]);}}}})[_0xdf14('0x37')](function(){if(_0x58c180){hopperUtils['swapAdditionalPhones'](_0x820176,_0xa825bc,_0x263bd1)[_0xdf14('0x37')](function(){return _0x24825a(0x1);});}});});};Dialer[_0xdf14('0x1b')][_0xdf14('0x130')]=function(_0x5ecd2c,_0x216ec0,_0x370ef7,_0x33063b){var _0x3b9802=new Final(_0x5ecd2c);_0x3b9802[_0xdf14('0x67')]=0xf;_0x3b9802[_0xdf14('0x68')]=_0xdf14('0x1c2');this[_0xdf14('0x131')](_0x3b9802,_0x216ec0,_0x370ef7,_0x33063b);};Dialer[_0xdf14('0x1b')][_0xdf14('0x131')]=function(_0x1f1479,_0x3bd9dc,_0x50918c,_0x419b66){hopperUtils[_0xdf14('0xc8')](_0x1f1479)['then'](function(){return _0x3bd9dc(msgResponse('[callProgressDetecting]',_0xdf14('0x1c3'),_0x419b66));})[_0xdf14('0x98')](function(){return _0x50918c(msgResponse('[moveContactManagedDialer][0]',_0xdf14('0x8a'),_0xdf14('0x1c4')));});};Dialer['prototype']['predictive']=function(_0x276843){var _0x1c06b8=_0x276843[_0xdf14('0x1c5')]/0x64;var _0x2f2c54=_0x276843[_0xdf14('0x1c6')]/(_0x276843[_0xdf14('0x1c6')]+_0x276843[_0xdf14('0xc2')]);var _0x5d7423=Math[_0xdf14('0x1c7')](_0x276843[_0xdf14('0x1c8')]*(_0x276843['predictiveIntervalMaxThreshold']/0x64));var _0x4b282f=Math[_0xdf14('0x1c7')](_0x276843['predictiveIntervalAvailable']*(_0x276843[_0xdf14('0x1c9')]/0x64));var _0x3be29f=_0x276843[_0xdf14('0x1ca')]+_0x276843[_0xdf14('0x13e')];var _0x3786e3=Math['floor'](_0x276843[_0xdf14('0x54')]*_0x276843[_0xdf14('0x57')]*_0x276843[_0xdf14('0x1cb')]*_0x276843['predictiveIntervalMultiplicativeFactor']);if(_[_0xdf14('0x39')](_0x276843[_0xdf14('0x26')])){if(!_[_0xdf14('0x39')](_0x276843[_0xdf14('0x25')])){_0x276843[_0xdf14('0x25')]=undefined;loggerPredictive[_0xdf14('0x5f')]('[startMethodPredictive][StartProgressive]',_0xdf14('0x1cc'));}if(!_[_0xdf14('0x39')](_0x276843[_0xdf14('0x5d')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x276843[_0xdf14('0x5d')]);_0x276843['handlePredictive']=undefined;}_0x276843['startProgressive']=moment()[_0xdf14('0x3f')](_0xdf14('0xc1'));loggerPredictive['info'](_0x276843[_0xdf14('0x5a')],_0xdf14('0x1cd'),_0x276843[_0xdf14('0x26')]);this['handlePower'](_0x276843,0x1);}else if(ifInterval(_0x276843[_0xdf14('0x1ce')],_0x276843[_0xdf14('0x26')])){this[_0xdf14('0xab')](_0x276843,0x1);loggerPredictiveCalls[_0xdf14('0x43')](_0xdf14('0x1cf'),_0x276843['startProgressive'],_0x276843[_0xdf14('0x5a')]);_0x276843['erlangCalls']=0x0;_0x276843[_0xdf14('0xce')]=0x0;}else if(_0x1c06b8<_0x2f2c54&&_0x276843[_0xdf14('0x1d0')]===_0xdf14('0x1d1')){clearPredictiveAttributes(_0x276843);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x1d2'),_0xdf14('0x1d3'),_0x2f2c54,_0xdf14('0x26'),_0x276843[_0xdf14('0x5a')]);}else if(_0x3786e3<_0x276843['predictiveIntervalErlangCallsDroppedCalls']&&_0x276843['dialPredictiveOptimization']==='dropRate'){clearPredictiveAttributes(_0x276843);loggerPredictive[_0xdf14('0x43')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xdf14('0x1d4'),_0x3786e3,'Drop\x20in\x20this\x20interval',_0x276843[_0xdf14('0xce')],_0xdf14('0x26'),_0x276843[_0xdf14('0x5a')]);}else if(!ifInterval(_0x276843[_0xdf14('0x1ce')],_0x276843['startProgressive'])&&_['isUndefined'](_0x276843[_0xdf14('0x25')])&&!_['isUndefined'](_0x276843[_0xdf14('0x26')])){_0x276843[_0xdf14('0x25')]=moment()[_0xdf14('0x3f')](_0xdf14('0xc1'));loggerPredictive[_0xdf14('0x43')](_0x276843['name'],'started\x20in\x20predictive\x20at',_0x276843[_0xdf14('0x25')]);hopperUtils[_0xdf14('0x1d5')](_0x276843[_0xdf14('0x1ce')])['then'](this['getDataPredictive'](_0x276843))[_0xdf14('0x37')](mergeDataErlangB(_0x276843))[_0xdf14('0x37')](this[_0xdf14('0x1d6')](_0x276843))[_0xdf14('0x98')](loggerCatchPredictive(_0xdf14('0x1d7'),_0x276843));}else if(!ifInterval(_0x276843[_0xdf14('0x1ce')],_0x276843['startPredictive'])){_0x276843[_0xdf14('0xce')]=0x0;_0x276843[_0xdf14('0x25')]=moment()[_0xdf14('0x3f')](_0xdf14('0xc1'));loggerPredictive[_0xdf14('0x43')](_0x276843[_0xdf14('0x5a')],_0xdf14('0x1d8'),_0x276843[_0xdf14('0x25')]);clearInterval(_0x276843[_0xdf14('0x5d')]);_0x276843[_0xdf14('0x5d')]=undefined;hopperUtils[_0xdf14('0x1d5')](_0x276843[_0xdf14('0x1ce')])[_0xdf14('0x37')](this[_0xdf14('0x1d9')](_0x276843))[_0xdf14('0x37')](mergeDataErlangB(_0x276843))[_0xdf14('0x37')](this['startMethodPredictive'](_0x276843))[_0xdf14('0x98')](loggerCatchPredictive(_0xdf14('0x1da'),_0x276843));}else if(_0x276843[_0xdf14('0x1c8')]&&_0x3be29f<_0x276843[_0xdf14('0x1c8')]-_0x4b282f){clearPredictiveAttributes(_0x276843);loggerPredictive[_0xdf14('0x43')](_0x276843[_0xdf14('0x5a')],_0xdf14('0x1db'),_0x3be29f,')\x20are\x20less\x20than\x20threshold\x20(',_0x276843[_0xdf14('0x1c8')],'-',_0x4b282f,'=',_0x276843[_0xdf14('0x1c8')]-_0x4b282f,')');}else if(_0x276843[_0xdf14('0x1c8')]&&_0x3be29f>_0x276843['predictiveIntervalAvailable']+_0x5d7423){clearPredictiveAttributes(_0x276843);loggerPredictive['info'](_0x276843['name'],_0xdf14('0x1db'),_0x3be29f,_0xdf14('0x1dc'),_0x276843[_0xdf14('0x1c8')],'+',_0x5d7423,'=',_0x276843['predictiveIntervalAvailable']+_0x5d7423,')');}};Dialer[_0xdf14('0x1b')][_0xdf14('0x1d9')]=function(_0x35d38c){var _0x9a19a3=this;return function(_0x1e7b03){return new Promise(function(_0x4a955e,_0x4d8248){_[_0xdf14('0x59')](_0x35d38c,_0x1e7b03[0x0]);if(checkGetDataPredictive(_0x1e7b03[0x0])){var _0x4f56cd=_0x35d38c['predictiveIntervalAvailable']=_0x35d38c[_0xdf14('0x13e')]+_0x35d38c[_0xdf14('0x1ca')];var _0x1afb55=_0x35d38c[_0xdf14('0x1ce')]*0x3c;var _0x2d304e=_0x1e7b03[0x0]['predictiveIntervalAvgTalktime']+_0x1e7b03[0x0][_0xdf14('0x4b')];var _0x67910=(_0x1e7b03[0x0][_0xdf14('0x48')]+_0x1e7b03[0x0][_0xdf14('0x49')]+_0x1e7b03[0x0][_0xdf14('0x4a')])/_0x1e7b03[0x0][_0xdf14('0x46')];_0x35d38c[_0xdf14('0x1cb')]=_0x67910>0x0?_0x67910:0x1;switch(_0x35d38c[_0xdf14('0x1d0')]){case'dropRate':var _0x4a1977=_0x35d38c[_0xdf14('0x1c5')]/0x64;return _0x9a19a3[_0xdf14('0x1dd')](_0x4f56cd,_0x1afb55,_0x2d304e,_0x67910,_0x4a1977)[_0xdf14('0x37')](function(_0x1daa59){return _0x4a955e(_0x1daa59);});case _0xdf14('0x1de'):var _0x4c2ae6=_0x35d38c['dialPredictiveOptimizationPercentage']/0x64;return _0x9a19a3[_0xdf14('0x1df')](_0x4f56cd,_0x1afb55,_0x2d304e,_0x67910,_0x4c2ae6)[_0xdf14('0x37')](function(_0x39e8ea){return _0x4a955e(_0x39e8ea);});default:return _0x4d8248(msgResponse(_0xdf14('0x1e0'),'Failure',_0xdf14('0x1e1')));}}else{return _0x4d8248(msgResponse(_0xdf14('0x1e0'),'Failure',_0xdf14('0x1e2')));}});};};Dialer[_0xdf14('0x1b')][_0xdf14('0x1e3')]=function(_0x2defbb){var _0x5ac375=this;return function(_0x2bf5d3){return new Promise(function(_0x34ed8f,_0x3f9712){_[_0xdf14('0x59')](_0x2defbb,_0x2bf5d3[0x0]);if(checkGetDataPredictive(_0x2bf5d3[0x0])){loggerPredictive[_0xdf14('0x43')](JSON[_0xdf14('0x6e')](_0x2bf5d3[0x0]));if(_0x2defbb['dialPredictiveOptimization']===_0xdf14('0x1d1')){return _0x5ac375[_0xdf14('0x157')](_0x2defbb['id'])[_0xdf14('0x37')](function(_0x56fcae){var _0x8610d9=_0x2defbb['loggedIn']-_0x56fcae[0x0][_0xdf14('0x1e4')];var _0x1107ff=_0x2defbb['dialPredictiveInterval']*0x3c;var _0x41494c=_0x2bf5d3[0x0][_0xdf14('0x4d')]+_0x2bf5d3[0x0]['predictiveIntervalAvgHoldtime'];var _0x4830ff=(_0x2bf5d3[0x0][_0xdf14('0x48')]+_0x2bf5d3[0x0][_0xdf14('0x49')]+_0x2bf5d3[0x0][_0xdf14('0x4a')])/_0x2bf5d3[0x0][_0xdf14('0x46')];var _0x493345=_0x2defbb[_0xdf14('0x1c5')]/0x64;_0x2defbb['predictiveIntervalPauses']=_0x56fcae[0x0][_0xdf14('0x1e4')]||0x0;_0x2defbb[_0xdf14('0x1cb')]=_0x4830ff>0x0?_0x4830ff:0x1;return _0x5ac375[_0xdf14('0x1dd')](_0x8610d9,_0x1107ff,_0x41494c,_0x4830ff,_0x493345);})[_0xdf14('0x37')](function(_0x4279f5){return _0x34ed8f(_0x4279f5);})[_0xdf14('0x98')](function(_0x8873e0){return _0x3f9712(msgResponse(_0xdf14('0x1e5'),_0xdf14('0x8a'),JSON[_0xdf14('0x6e')](_0x8873e0)));});}if(_0x2defbb[_0xdf14('0x1d0')]===_0xdf14('0x1de')){return _0x5ac375[_0xdf14('0x157')](_0x2defbb['id'])[_0xdf14('0x37')](function(_0x177e70){var _0x4955d1=_0x2defbb[_0xdf14('0x1e6')]-_0x177e70[0x0][_0xdf14('0x1e4')];var _0x29fc54=_0x2defbb[_0xdf14('0x1ce')]*0x3c;var _0x537ed5=_0x2bf5d3[0x0][_0xdf14('0x4d')]+_0x2bf5d3[0x0]['predictiveIntervalAvgHoldtime'];var _0x2e79fc=(_0x2bf5d3[0x0][_0xdf14('0x48')]+_0x2bf5d3[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x2bf5d3[0x0][_0xdf14('0x4a')])/_0x2bf5d3[0x0]['predictiveIntervalTotalCalls'];var _0x45ae21=_0x2defbb[_0xdf14('0x1c5')]/0x64;_0x2defbb[_0xdf14('0x1e7')]=_0x177e70[0x0][_0xdf14('0x1e4')]||0x0;_0x2defbb[_0xdf14('0x1cb')]=_0x2e79fc>0x0?_0x2e79fc:0x1;return _0x5ac375[_0xdf14('0x1df')](_0x4955d1,_0x29fc54,_0x537ed5,_0x2e79fc,_0x45ae21);})[_0xdf14('0x37')](function(_0x56e464){return _0x34ed8f(_0x56e464);})[_0xdf14('0x98')](function(_0x4f563e){return _0x3f9712(msgResponse(_0xdf14('0x1e5'),_0xdf14('0x8a'),JSON[_0xdf14('0x6e')](_0x4f563e)));});}}else{return _0x3f9712(msgResponse(_0xdf14('0x1e0'),_0xdf14('0x8a'),_0xdf14('0x1e2')));}});};};Dialer[_0xdf14('0x1b')][_0xdf14('0x1d6')]=function(_0x425415){var _0x4444e9=this;return function(){var _0x2e8c6c=0x0;var _0x12cac7=Math['floor'](_0x425415[_0xdf14('0x55')]*0x3e8);if(_0x12cac7>0x0){_0x12cac7=_0x12cac7<0x64?0x64:_0x12cac7;loggerPredictive['info'](_0x425415[_0xdf14('0x5a')],'one\x20call\x20every:',_0x12cac7,'milliseconds');_0x425415[_0xdf14('0x5d')]=setInterval(function(){_0x4444e9[_0xdf14('0x5d')](_0x425415);loggerPredictiveCalls[_0xdf14('0x43')](_0xdf14('0x1e8'),_0x2e8c6c+=0x1);},_0x12cac7);}else{loggerPredictive[_0xdf14('0x43')](_0x425415[_0xdf14('0x5a')],_0xdf14('0x1e9'));}};};Dialer[_0xdf14('0x1b')][_0xdf14('0x1ea')]=function(_0x5b76cf,_0x2caea0){var _0x25d74a=this;return function(_0x579aa0){if(_[_0xdf14('0x42')](_0x579aa0)){if(_[_0xdf14('0x102')](_0x2caea0[_0xdf14('0x15c')])||!_0x2caea0[_0xdf14('0x1eb')]){if(_0x5b76cf['dialMethod']===_0xdf14('0xa')){_0x5b76cf['queueStatusComplete']=_[_0xdf14('0x39')](_0x5b76cf['queueStatusComplete'])?!![]:_0x5b76cf[_0xdf14('0x6b')];var _0x57ec59=uuid['v4']();_0x25d74a[_0xdf14('0xf0')][_0x57ec59]=new Action(_0x5b76cf,_0x2caea0,_0x57ec59);loggerBooked[_0xdf14('0x43')](_0xdf14('0x1ec'),_0x57ec59,_0xdf14('0x1ed'),JSON[_0xdf14('0x6e')](_0x5b76cf[_0xdf14('0x6b')]),_0xdf14('0x1ee'),_0x5b76cf[_0xdf14('0x5a')]);if(_0x5b76cf[_0xdf14('0x6b')]){_0x5b76cf[_0xdf14('0x6b')]=![];_0x25d74a['queueBooked'][_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xbb')]]=[];ami[_0xdf14('0x91')]({'actionid':_0x57ec59,'action':_0xdf14('0x1ef'),'queue':_0x5b76cf[_0xdf14('0x5a')]})[_0xdf14('0x98')](function(){_0x25d74a['updateOriginated'](_0x5b76cf);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xdd')],'ListId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xde')],'VoiceQueueId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xdf')]||undefined,'CampaignId':_0x25d74a['actions'][_0x57ec59][_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch(_0xdf14('0x1f0')));delete _0x25d74a['actions'][_0x57ec59];});}else{loggerBooked['info'](_0xdf14('0x1f1'),JSON[_0xdf14('0x6e')](_0x5b76cf[_0xdf14('0x6b')]),_0xdf14('0x1ee'),_0x5b76cf[_0xdf14('0x5a')]);_0x25d74a[_0xdf14('0xbf')](_0x5b76cf);hopperUtils[_0xdf14('0xea')]({'active':![],'ContactId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xdd')],'ListId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xde')],'VoiceQueueId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xdf')]||undefined,'CampaignId':_0x25d74a[_0xdf14('0xf0')][_0x57ec59][_0xdf14('0xe0')]||undefined})['catch'](loggerCatch(_0xdf14('0x1f0')));delete _0x25d74a[_0xdf14('0xf0')][_0x57ec59];}}else{return _0x25d74a[_0xdf14('0x160')](_0x5b76cf,_0x2caea0);}}else{if(utils[_0xdf14('0xcb')](undefined,_0x2caea0['scheduledat'])<_0x5b76cf[_0xdf14('0x1f2')]*0x3c){if(_0x2caea0['Agent']&&!_0x2caea0[_0xdf14('0x14d')][_0xdf14('0x1f3')]){_0x25d74a['preview'][_0xdf14('0xfd')](_0x2caea0['id'])[_0xdf14('0x1e')](function(){_0x25d74a[_0xdf14('0xbf')](_0x5b76cf);});}else{hopperUtils['unlockContact']({'active':![]},_0x2caea0['id'],0x1)[_0xdf14('0x1e')](function(){_0x25d74a[_0xdf14('0xbf')](_0x5b76cf);});}}else{_0x5b76cf[_0xdf14('0x1f4')]+=0x1;_0x25d74a[_0xdf14('0xbf')](_0x5b76cf);if(_0x5b76cf[_0xdf14('0x1f5')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x2caea0[_0xdf14('0xdd')],'ListId':_0x2caea0[_0xdf14('0xde')],'VoiceQueueId':_0x2caea0[_0xdf14('0xdf')]||undefined,'CampaignId':_0x2caea0[_0xdf14('0xe0')]||undefined})[_0xdf14('0x98')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xdf14('0xc6')](createObjHistory(_0x5b76cf,_0x2caea0,utils[_0xdf14('0x64')]['QUEUE_RECALL'],0x17,_0xdf14('0x1f6')))[_0xdf14('0x98')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x25d74a['saveInDb'](createObjHistory(_0x5b76cf,_0x2caea0,utils[_0xdf14('0x64')][_0xdf14('0x1f7')],0x16,_0xdf14('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x5b76cf['outboundBlacklistCallsDay']+=0x1;_0x25d74a[_0xdf14('0x12a')](createObjHistory(_0x5b76cf,_0x2caea0,utils[_0xdf14('0x64')][_0xdf14('0x1f9')],0xd,_0xdf14('0x1fa')),_0xdf14('0x1fb'),'[Originate][MoveBlacklist]');throw _0xdf14('0x1fc');}};};Dialer[_0xdf14('0x1b')][_0xdf14('0x1fd')]=function(_0x1b06b9){var _0x2ae529=this;var _0x24256c=_0x1b06b9['limitCalls']-_0x1b06b9[_0xdf14('0x79')]-_0x1b06b9[_0xdf14('0x1fe')];emitCampaignSummary(_0x1b06b9);if(_0x24256c>0x0){if(_0x24256c>this[_0xdf14('0x23')]){_0x24256c=this[_0xdf14('0x23')];}_0x1b06b9['temp']+=_0x24256c;hopperUtils['getContactDialerIvr'](_0x1b06b9,_0x24256c)['then'](function(_0x3e5d8a){_0x1b06b9['temp']-=_0x24256c;_0x1b06b9['temp']=_0x1b06b9['temp']>0x0?_0x1b06b9[_0xdf14('0x1fe')]:0x0;if(!utils[_0xdf14('0x1ff')](_0x3e5d8a)){_0x1b06b9[_0xdf14('0x63')]=utils[_0xdf14('0x64')][_0xdf14('0x66')];logger[_0xdf14('0x43')]('[getContactCampaign2][Empty]'+_0x1b06b9['name']);}else{_0x1b06b9[_0xdf14('0x79')]+=_0x3e5d8a['length'];_0x1b06b9[_0xdf14('0x63')]=utils[_0xdf14('0x64')][_0xdf14('0x200')];for(var _0x5b4962=0x0;_0x5b4962<_0x3e5d8a['length'];_0x5b4962+=0x1){_0x1b06b9['ivrTotalCallsDays']+=0x1;if(_[_0xdf14('0x102')](_0x3e5d8a[_0x5b4962])||_[_0xdf14('0x102')](_0x3e5d8a[_0x5b4962][_0xdf14('0x17a')])||_[_0xdf14('0x102')](_0x3e5d8a[_0x5b4962]['phone'])){_0x2ae529['emptyContact'](_0xdf14('0x201'),_0x1b06b9,_0x3e5d8a[_0x5b4962]);}else{hopperUtils[_0xdf14('0x202')](_[_0xdf14('0x6f')](_0x3e5d8a[_0x5b4962],[_0xdf14('0xe0'),_0xdf14('0x162')]))['then'](_0x2ae529['checkContactBlack'](_0x1b06b9,_0x3e5d8a[_0x5b4962]))[_0xdf14('0x98')](_0x2ae529[_0xdf14('0x203')](_0xdf14('0x204'),_0x1b06b9));}}}})[_0xdf14('0x98')](loggerGetContactDialer('[getContactCampaign2]',_0x1b06b9,_0x24256c));}};Dialer[_0xdf14('0x1b')][_0xdf14('0xab')]=function(_0x1ed0d5,_0x17fdb6){var _0x57c277=this;var _0xadf53f=[];if(_0x17fdb6<0x1||_0x1ed0d5[_0xdf14('0xa9')]===_0xdf14('0xa')){_0x17fdb6=0x1;}var _0x4be684=Math[_0xdf14('0x205')](_0x1ed0d5['available']*_0x17fdb6)-_0x1ed0d5[_0xdf14('0x79')]-_0x1ed0d5['temp'];if(_0x1ed0d5['dialLimitQueue']>0x0){var _0x1b7821=_0x1ed0d5[_0xdf14('0x206')]-_0x1ed0d5[_0xdf14('0x79')]-_0x1ed0d5[_0xdf14('0x13e')]-_0x1ed0d5[_0xdf14('0x1fe')]-_0x1ed0d5['pTalking'];if(_0x4be684>_0x1b7821){_0x4be684=_0x1b7821;}}if(_0x4be684>0x0){if(_0x1ed0d5[_0xdf14('0xa9')]==='booked'){_0x4be684=0x1;}if(_0x4be684>this[_0xdf14('0x23')]){_0x4be684=this[_0xdf14('0x23')];}_0x1ed0d5['temp']+=_0x4be684;for(var _0x2660bf in this[_0xdf14('0xf8')]){if(typeof this[_0xdf14('0xf8')][_0x2660bf]!==_0xdf14('0xa0')){if(this[_0xdf14('0xf8')][_0x2660bf][_0xdf14('0x67')]==='not_inuse'&&this['agents'][_0x2660bf][_0xdf14('0x82')]==='reachable'){_0xadf53f[_0xdf14('0x90')](this['agents'][_0x2660bf]['id']);}}}hopperUtils[_0xdf14('0x207')](_0x1ed0d5,_0xadf53f,_0x4be684)['then'](function(_0xe8a52e){_0x1ed0d5['temp']-=_0x4be684;_0x1ed0d5['temp']=_0x1ed0d5['temp']>0x0?_0x1ed0d5[_0xdf14('0x1fe')]:0x0;if(!utils['checkContactEmpty'](_0xe8a52e)){hopperUtils[_0xdf14('0x208')](_0x1ed0d5)[_0xdf14('0x37')](sendMessageReschedule(_0x1ed0d5))[_0xdf14('0x98')](loggerCatch(_0xdf14('0x209')));}else{_0x1ed0d5['originated']+=_0xe8a52e[_0xdf14('0x8f')];_0x1ed0d5[_0xdf14('0x63')]=_0x1ed0d5[_0xdf14('0xa9')]==='booked'?utils[_0xdf14('0x64')][_0xdf14('0x140')]:utils[_0xdf14('0x64')][_0xdf14('0x200')];for(var _0x5d1969=0x0;_0x5d1969<_0xe8a52e[_0xdf14('0x8f')];_0x5d1969+=0x1){if(_['isNil'](_0xe8a52e[_0x5d1969])||_[_0xdf14('0x102')](_0xe8a52e[_0x5d1969][_0xdf14('0x17a')])||_['isNil'](_0xe8a52e[_0x5d1969][_0xdf14('0x162')])){_0x57c277['emptyContact'](_0xdf14('0x201'),_0x1ed0d5,_0xe8a52e[_0x5d1969]);}else{hopperUtils[_0xdf14('0x20a')](_[_0xdf14('0x6f')](_0xe8a52e[_0x5d1969],[_0xdf14('0xdf'),_0xdf14('0x162')]))[_0xdf14('0x37')](_0x57c277[_0xdf14('0x1ea')](_0x1ed0d5,_0xe8a52e[_0x5d1969]))[_0xdf14('0x98')](_0x57c277['loggerHandler'](_0xdf14('0x201'),_0x1ed0d5));}}}})[_0xdf14('0x98')](loggerGetContactDialer(_0xdf14('0x20b'),_0x1ed0d5,_0x4be684));}};Dialer['prototype']['handlePredictive']=function(_0x242e58){if(_0x242e58['dialLimitQueue']>0x0){var _0x22a0a2=_0x242e58[_0xdf14('0x206')]-_0x242e58[_0xdf14('0x79')]-_0x242e58[_0xdf14('0x13e')];if(_0x22a0a2>0x0){this[_0xdf14('0x20c')](_0x242e58);}else{loggerPredictiveCalls[_0xdf14('0x43')](_0xdf14('0x20d'));}}else{this[_0xdf14('0x20c')](_0x242e58);}};Dialer[_0xdf14('0x1b')][_0xdf14('0x20c')]=function(_0xdfa61f){var _0x3cd829=this;var _0x62fcfe=[];_0xdfa61f[_0xdf14('0x79')]+=0x1;for(var _0x41e052 in this[_0xdf14('0xf8')]){if(typeof this[_0xdf14('0xf8')][_0x41e052]!==_0xdf14('0xa0')){if(this[_0xdf14('0xf8')][_0x41e052][_0xdf14('0x67')]===_0xdf14('0x20e')&&this[_0xdf14('0xf8')][_0x41e052][_0xdf14('0x82')]===_0xdf14('0x14b')){_0x62fcfe[_0xdf14('0x90')](this[_0xdf14('0xf8')][_0x41e052]['id']);}}}return this[_0xdf14('0x207')](_0xdfa61f['id'],_0x62fcfe,0x1,_0xdfa61f[_0xdf14('0x20f')],_0xdfa61f)[_0xdf14('0x37')](function(_0xf669c7){if(!utils[_0xdf14('0x1ff')](_0xf669c7)){utils['checkContactLowerLimitOriginate'](_0xdfa61f,0x1,0x0);return hopperUtils[_0xdf14('0x208')](_0xdfa61f)[_0xdf14('0x37')](sendMessageReschedule(_0xdfa61f))[_0xdf14('0x98')](loggerCatch('[countReScheduled]\x20'));}else{_0xdfa61f[_0xdf14('0x63')]=utils['CAMPAIGN_STATUS'][_0xdf14('0x200')];if(_[_0xdf14('0x102')](_0xf669c7[0x0])||_[_0xdf14('0x102')](_0xf669c7[0x0][_0xdf14('0x17a')])||_[_0xdf14('0x102')](_0xf669c7[0x0][_0xdf14('0x162')])){_0x3cd829[_0xdf14('0x15a')](_0xdf14('0x201'),_0xdfa61f,_0xf669c7[0x0]);}else{return hopperUtils[_0xdf14('0x20a')](_['pick'](_0xf669c7[0x0],['VoiceQueueId',_0xdf14('0x162')]))['then'](_0x3cd829[_0xdf14('0x1ea')](_0xdfa61f,_0xf669c7[0x0]))['catch'](_0x3cd829[_0xdf14('0x203')]('[actionOriginatePredictive]\x20',_0xdfa61f));}}})[_0xdf14('0x98')](loggerGetContactDialer(_0xdf14('0x210'),_0xdfa61f,0x1));};Dialer[_0xdf14('0x1b')][_0xdf14('0x1dd')]=function(_0x5c8ae9,_0x547a77,_0x501c98,_0x5c1133,_0x1cd34f,_0x24b902){loggerPredictive['info'](_0xdf14('0x211'));loggerPredictive[_0xdf14('0x43')](_0xdf14('0x212'),_0x5c8ae9);loggerPredictive[_0xdf14('0x43')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x547a77);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x213'),_0x501c98);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x214'),_0x5c1133);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x215'),_0x1cd34f);loggerPredictive[_0xdf14('0x43')]('---------------------------');return new Promise(function(_0x1269c8,_0x2b1e78){if(_0x5c8ae9<=0x0||isNaN(_0x5c8ae9)){return _0x2b1e78(msgResponse('[abandonmentRate]',_0xdf14('0x7f'),_0xdf14('0x216')+_0x5c8ae9));}if(_0x501c98<=0x0||isNaN(_0x501c98)){return _0x2b1e78(msgResponse(_0xdf14('0x217'),'Error',_0xdf14('0x218')+_0x501c98));}if(_0x5c1133<=0x0||isNaN(_0x5c1133)){return _0x2b1e78(msgResponse(_0xdf14('0x217'),_0xdf14('0x7f'),_0xdf14('0x219')+_0x5c1133));}if(_0x547a77<=0x0||isNaN(_0x547a77)){return _0x2b1e78(msgResponse('[abandonmentRate]',_0xdf14('0x7f'),'interval\x20=\x20'+_0x547a77));}if(_0x1cd34f<=0x0||isNaN(_0x1cd34f)){return _0x2b1e78(msgResponse('[abandonmentRate]',_0xdf14('0x7f'),_0xdf14('0x21a')+_0x1cd34f));}_0x24b902=_0x24b902||0x0;var _0x320bd1=0x1/_0x501c98;var _0x5d8391=0x0;var _0x187545=0x0;var _0x3a09a1=0x0;var _0x101221=0x0;for(var _0x1b1208=0x0;_0x3a09a1<_0x1cd34f;_0x1b1208+=0x1){_0x187545=_0x1b1208/_0x547a77;_0x5d8391=(_0x5c1133*_0x187545+_0x24b902)/_0x320bd1;_0x3a09a1=utils['erlangb'](_0x5d8391,_0x5c8ae9);_0x101221=_0x5d8391/_0x5c8ae9*(0x1-utils[_0xdf14('0x21b')](_0x5d8391,_0x5c8ae9));}return _0x1269c8({'erlangCalls':_0x1b1208,'erlangCallToSecond':_0x547a77/_0x1b1208,'erlangAbandonmentRate':_0x3a09a1,'erlangBusyFactor':_0x101221});});};Dialer[_0xdf14('0x1b')][_0xdf14('0x1df')]=function(_0x3f6cdb,_0x2812bf,_0x294a46,_0x3c31a1,_0x5072fc,_0x2f7665){loggerPredictive[_0xdf14('0x43')](_0xdf14('0x21c'));loggerPredictive[_0xdf14('0x43')]('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',_0x3f6cdb);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x21d'),_0x2812bf);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x213'),_0x294a46);loggerPredictive['info'](_0xdf14('0x214'),_0x3c31a1);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x21e'),_0x5072fc);loggerPredictive[_0xdf14('0x43')](_0xdf14('0x4e'));return new Promise(function(_0xac0bf2,_0x4aebbb){if(_0x3f6cdb<=0x0||isNaN(_0x3f6cdb)){return _0x4aebbb(msgResponse(_0xdf14('0x21f'),_0xdf14('0x7f'),'m\x20=\x20'+_0x3f6cdb));}if(_0x294a46<=0x0||isNaN(_0x294a46)){return _0x4aebbb(msgResponse(_0xdf14('0x21f'),_0xdf14('0x7f'),_0xdf14('0x218')+_0x294a46));}if(_0x3c31a1<=0x0||isNaN(_0x3c31a1)){return _0x4aebbb(msgResponse(_0xdf14('0x21f'),_0xdf14('0x7f'),'p\x20=\x20'+_0x3c31a1));}if(_0x2812bf<=0x0||isNaN(_0x2812bf)){return _0x4aebbb(msgResponse(_0xdf14('0x21f'),_0xdf14('0x7f'),_0xdf14('0x220')+_0x2812bf));}if(_0x5072fc<=0x0||isNaN(_0x5072fc)){return _0x4aebbb(msgResponse(_0xdf14('0x21f'),'Error',_0xdf14('0x221')+_0x5072fc));}_0x2f7665=_0x2f7665||0x0;var _0x208473=0x1/_0x294a46;var _0x142b3d=0x0;var _0x7bdfbf=0x0;var _0x4cb70d=0x0;var _0x424a6f=0x0;for(var _0x2625cf=0x0;_0x424a6f<_0x5072fc;_0x2625cf+=0x1){_0x7bdfbf=_0x2625cf/_0x2812bf;_0x142b3d=(_0x3c31a1*_0x7bdfbf+_0x2f7665)/_0x208473;_0x4cb70d=utils[_0xdf14('0x21b')](_0x142b3d,_0x3f6cdb);_0x424a6f=_0x142b3d/_0x3f6cdb*(0x1-utils['erlangb'](_0x142b3d,_0x3f6cdb));}return _0xac0bf2({'erlangCalls':_0x2625cf,'erlangCallToSecond':_0x2812bf/_0x2625cf,'erlangAbandonmentRate':_0x4cb70d,'erlangBusyFactor':_0x424a6f});});};module[_0xdf14('0x222')]=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 40950db..2a39e91 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 _0xbb19=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','voiceQueue','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','uniqueid','name','phone','Contact','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName'];(function(_0x3ab164,_0x2fa5e9){var _0x39565e=function(_0x40dfe8){while(--_0x40dfe8){_0x3ab164['push'](_0x3ab164['shift']());}};_0x39565e(++_0x2fa5e9);}(_0xbb19,0x1db));var _0x9bb1=function(_0x4ce0c8,_0x3a4182){_0x4ce0c8=_0x4ce0c8-0x0;var _0x153cce=_0xbb19[_0x4ce0c8];return _0x153cce;};'use strict';var util=require('util');var _=require(_0x9bb1('0x0'));var moment=require(_0x9bb1('0x1'));function checkNameSurname(_0x2d7b34,_0xb7771e,_0x251191){var _0x4b1f4e='';if(!_[_0x9bb1('0x2')](_0xb7771e)&&_0x9bb1('0x3')===typeof _0xb7771e){_0x4b1f4e+=_0xb7771e;}if(!_[_0x9bb1('0x2')](_0x251191)&&_0x9bb1('0x3')===typeof _0x251191){_0x4b1f4e+='\x20'+_0x251191;}if(_0x4b1f4e!==''){return _0x4b1f4e;}return _0x2d7b34;}function Action(_0x490e3e,_0x3859e1,_0x27ee9e){this['voiceQueue']=_0x490e3e;this[_0x9bb1('0x4')]=_0x27ee9e||undefined;this[_0x9bb1('0x5')]=checkNameSurname(_0x3859e1['Contact'][_0x9bb1('0x6')],_0x3859e1[_0x9bb1('0x7')]['firstName'],_0x3859e1[_0x9bb1('0x7')][_0x9bb1('0x8')]);this[_0x9bb1('0x9')]=_0x3859e1['phone'];this[_0x9bb1('0xa')]=_0x490e3e['name'];this[_0x9bb1('0xb')]=_0x3859e1[_0x9bb1('0xb')]||![];this[_0x9bb1('0xc')]=_0x490e3e[_0x9bb1('0xc')];this['dialQueueTimeout']=_0x490e3e[_0x9bb1('0xd')]||0x3;this[_0x9bb1('0xe')]=_0x3859e1[_0x9bb1('0xe')];this[_0x9bb1('0xf')]=_0x3859e1[_0x9bb1('0xf')];this[_0x9bb1('0x10')]=_0x3859e1[_0x9bb1('0x10')];this[_0x9bb1('0x11')]=_0x3859e1['countnoanswerretry'];this['countnosuchnumberretry']=_0x3859e1[_0x9bb1('0x12')];this[_0x9bb1('0x13')]=_0x3859e1[_0x9bb1('0x13')];this[_0x9bb1('0x14')]=_0x3859e1[_0x9bb1('0x14')];this[_0x9bb1('0x15')]=_0x3859e1[_0x9bb1('0x15')];this[_0x9bb1('0x16')]=_0x3859e1['countagentrejectretry'];this['ContactId']=_0x3859e1[_0x9bb1('0x17')];this[_0x9bb1('0x18')]=_0x3859e1['ListId'];this['UserId']=_0x3859e1[_0x9bb1('0x19')];this[_0x9bb1('0x1a')]=_0x3859e1[_0x9bb1('0x1a')];this[_0x9bb1('0x1b')]=_0x3859e1['CampaignId'];this[_0x9bb1('0x1c')]=_0x3859e1['id'];this[_0x9bb1('0x1d')]=_0x3859e1[_0x9bb1('0x7')][_0x9bb1('0x1e')]||'';this[_0x9bb1('0x1f')]=moment()[_0x9bb1('0x20')](_0x9bb1('0x21'));this[_0x9bb1('0x22')]=_0x3859e1[_0x9bb1('0x22')];this[_0x9bb1('0x23')]=_0x3859e1[_0x9bb1('0x23')];this[_0x9bb1('0x24')]=_0x3859e1[_0x9bb1('0x24')];this[_0x9bb1('0x25')]=_0x3859e1['recallme'];this[_0x9bb1('0x26')]='';this[_0x9bb1('0x27')]='';}Action['prototype']['getCaller']=function(){return util[_0x9bb1('0x20')]('\x22%s\x22\x20<%s>',this[_0x9bb1('0x5')],this[_0x9bb1('0x28')][_0x9bb1('0x29')]>0x0?this[_0x9bb1('0x9')][_0x9bb1('0x2a')](this[_0x9bb1('0x28')][_0x9bb1('0x29')]):this[_0x9bb1('0x9')]);};Action[_0x9bb1('0x2b')][_0x9bb1('0x2c')]=function(){return this[_0x9bb1('0xa')];};module[_0x9bb1('0x2d')]=Action; \ No newline at end of file +var _0x64e5=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName','number','active','dialQueueTimeout','scheduledat','countcongestionretry'];(function(_0xb50ad4,_0x20d5af){var _0x45e623=function(_0x378196){while(--_0x378196){_0xb50ad4['push'](_0xb50ad4['shift']());}};_0x45e623(++_0x20d5af);}(_0x64e5,0xb9));var _0x564e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x64e5[_0xa1e3e3];return _0xc980e9;};'use strict';var util=require('util');var _=require(_0x564e('0x0'));var moment=require(_0x564e('0x1'));function checkNameSurname(_0x4fadb5,_0x32112b,_0xb61ffe){var _0x58d9dd='';if(!_[_0x564e('0x2')](_0x32112b)&&'string'===typeof _0x32112b){_0x58d9dd+=_0x32112b;}if(!_[_0x564e('0x2')](_0xb61ffe)&&_0x564e('0x3')===typeof _0xb61ffe){_0x58d9dd+='\x20'+_0xb61ffe;}if(_0x58d9dd!==''){return _0x58d9dd;}return _0x4fadb5;}function Action(_0x1e2b39,_0x386128,_0x3f031e){this[_0x564e('0x4')]=_0x1e2b39;this[_0x564e('0x5')]=_0x3f031e||undefined;this[_0x564e('0x6')]=checkNameSurname(_0x386128['Contact'][_0x564e('0x7')],_0x386128[_0x564e('0x8')][_0x564e('0x9')],_0x386128['Contact']['lastName']);this[_0x564e('0xa')]=_0x386128[_0x564e('0x7')];this['queue']=_0x1e2b39['name'];this['active']=_0x386128[_0x564e('0xb')]||![];this['type']=_0x1e2b39['type'];this['dialQueueTimeout']=_0x1e2b39[_0x564e('0xc')]||0x3;this[_0x564e('0xd')]=_0x386128['scheduledat'];this['countbusyretry']=_0x386128['countbusyretry'];this[_0x564e('0xe')]=_0x386128['countcongestionretry'];this[_0x564e('0xf')]=_0x386128[_0x564e('0xf')];this[_0x564e('0x10')]=_0x386128[_0x564e('0x10')];this[_0x564e('0x11')]=_0x386128[_0x564e('0x11')];this['countabandonedretry']=_0x386128[_0x564e('0x12')];this['countmachineretry']=_0x386128[_0x564e('0x13')];this['countagentrejectretry']=_0x386128[_0x564e('0x14')];this['ContactId']=_0x386128['ContactId'];this[_0x564e('0x15')]=_0x386128['ListId'];this[_0x564e('0x16')]=_0x386128[_0x564e('0x16')];this[_0x564e('0x17')]=_0x386128[_0x564e('0x17')];this[_0x564e('0x18')]=_0x386128[_0x564e('0x18')];this[_0x564e('0x19')]=_0x386128['id'];this[_0x564e('0x1a')]=_0x386128[_0x564e('0x8')][_0x564e('0x9')]||'';this[_0x564e('0x1b')]=moment()[_0x564e('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x564e('0x1d')]=_0x386128[_0x564e('0x1d')];this[_0x564e('0x1e')]=_0x386128[_0x564e('0x1e')];this[_0x564e('0x1f')]=_0x386128[_0x564e('0x1f')];this[_0x564e('0x20')]=_0x386128['recallme'];this['originatecalleridnum']='';this[_0x564e('0x21')]='';}Action[_0x564e('0x22')][_0x564e('0x23')]=function(){return util[_0x564e('0x1c')](_0x564e('0x24'),this[_0x564e('0x6')],this[_0x564e('0x4')][_0x564e('0x25')]>0x0?this[_0x564e('0xa')][_0x564e('0x26')](this[_0x564e('0x4')][_0x564e('0x25')]):this[_0x564e('0xa')]);};Action[_0x564e('0x22')]['getQueue']=function(){return this['queue'];};module[_0x564e('0x27')]=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 fbaba9e..9cb0c4c 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 _0x9842=['Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','moment','../utils','state'];(function(_0x2c234a,_0x4fc673){var _0x28bf8d=function(_0x5b377f){while(--_0x5b377f){_0x2c234a['push'](_0x2c234a['shift']());}};_0x28bf8d(++_0x4fc673);}(_0x9842,0x14d));var _0x2984=function(_0x128755,_0xc5b8d3){_0x128755=_0x128755-0x0;var _0x435d11=_0x9842[_0x128755];return _0x435d11;};'use strict';var moment=require(_0x2984('0x0'));var utils=require(_0x2984('0x1'));function AgentComplete(_0x21bdaa,_0x38feae){this[_0x2984('0x2')]=0x4;this['statedesc']=_0x2984('0x3');this[_0x2984('0x4')]=_0x21bdaa[_0x2984('0x4')];this[_0x2984('0x5')]=_0x21bdaa[_0x2984('0x5')];this[_0x2984('0x6')]=_0x21bdaa[_0x2984('0x5')]==='outbound'?_0x2984('0x7'):_0x21bdaa[_0x2984('0x5')];this[_0x2984('0x8')]=_0x21bdaa[_0x2984('0x8')];this[_0x2984('0x9')]=_0x21bdaa['countcongestionretry'];this[_0x2984('0xa')]=_0x21bdaa[_0x2984('0xa')];this[_0x2984('0xb')]=_0x21bdaa['countbusyretry']+_0x21bdaa[_0x2984('0x9')]+_0x21bdaa['countnoanswerretry']+_0x21bdaa['countnosuchnumberretry']+_0x21bdaa['countdropretry']+_0x21bdaa['countabandonedretry']+_0x21bdaa[_0x2984('0xc')]+_0x21bdaa[_0x2984('0xd')];this['countnosuchnumberretry']=_0x21bdaa[_0x2984('0xe')];this[_0x2984('0xf')]=_0x21bdaa[_0x2984('0xf')];this[_0x2984('0x10')]=_0x21bdaa['countabandonedretry'];this[_0x2984('0xc')]=_0x21bdaa[_0x2984('0xc')];this['countagentrejectretry']=_0x21bdaa[_0x2984('0xd')];this[_0x2984('0x11')]=_0x38feae[_0x2984('0x11')];this[_0x2984('0x12')]=_0x21bdaa[_0x2984('0x13')];this[_0x2984('0x14')]=_0x21bdaa[_0x2984('0x15')];this[_0x2984('0x16')]=_0x21bdaa[_0x2984('0x16')];this[_0x2984('0x17')]=_0x21bdaa[_0x2984('0x17')];this['answertime']=_0x21bdaa[_0x2984('0x18')];this[_0x2984('0x19')]=moment()['format'](_0x2984('0x1a'));this[_0x2984('0x1b')]=utils[_0x2984('0x1c')](_0x21bdaa[_0x2984('0x17')],_0x21bdaa['starttime']);this[_0x2984('0x1d')]=utils[_0x2984('0x1c')](_0x21bdaa[_0x2984('0x18')],_0x21bdaa[_0x2984('0x17')]);this[_0x2984('0x1e')]=utils[_0x2984('0x1c')](this[_0x2984('0x19')],_0x21bdaa[_0x2984('0x18')]);this[_0x2984('0x7')]=_0x38feae[_0x2984('0x7')];this['membername']=_0x38feae['membername'];this['reason']=_0x38feae[_0x2984('0x1f')];this[_0x2984('0x20')]=_0x21bdaa['callback'];this[_0x2984('0x21')]=_0x21bdaa[_0x2984('0x21')];this['callbackat']=_0x21bdaa[_0x2984('0x22')];this['recallme']=_0x21bdaa['recallme'];this[_0x2984('0x23')]=_0x21bdaa['ContactId'];this['ListId']=_0x21bdaa[_0x2984('0x24')];this[_0x2984('0x25')]=_0x21bdaa[_0x2984('0x25')];this['VoiceQueueId']=_0x21bdaa[_0x2984('0x26')];this[_0x2984('0x27')]=_0x21bdaa['CampaignId'];this['originatecalleridnum']=_0x21bdaa['originatecalleridnum']||'';this[_0x2984('0x28')]=_0x21bdaa['originatecalleridname']||'';this['agiafterat']=_0x21bdaa[_0x2984('0x29')];}module['exports']=AgentComplete; \ No newline at end of file +var _0xe30c=['agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime','endtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname'];(function(_0x54381d,_0x247b2c){var _0x5308a7=function(_0x3ef056){while(--_0x3ef056){_0x54381d['push'](_0x54381d['shift']());}};_0x5308a7(++_0x247b2c);}(_0xe30c,0x185));var _0xce30=function(_0x37216c,_0x267e10){_0x37216c=_0x37216c-0x0;var _0x144322=_0xe30c[_0x37216c];return _0x144322;};'use strict';var moment=require(_0xce30('0x0'));var utils=require('../utils');function AgentComplete(_0x377579,_0x7a3336){this[_0xce30('0x1')]=0x4;this[_0xce30('0x2')]=_0xce30('0x3');this[_0xce30('0x4')]=_0x377579[_0xce30('0x4')];this[_0xce30('0x5')]=_0x377579[_0xce30('0x5')];this[_0xce30('0x6')]=_0x377579[_0xce30('0x5')]==='outbound'?_0xce30('0x7'):_0x377579[_0xce30('0x5')];this[_0xce30('0x8')]=_0x377579[_0xce30('0x8')];this[_0xce30('0x9')]=_0x377579[_0xce30('0x9')];this[_0xce30('0xa')]=_0x377579['countnoanswerretry'];this['countglobal']=_0x377579[_0xce30('0x8')]+_0x377579[_0xce30('0x9')]+_0x377579[_0xce30('0xa')]+_0x377579[_0xce30('0xb')]+_0x377579['countdropretry']+_0x377579[_0xce30('0xc')]+_0x377579[_0xce30('0xd')]+_0x377579['countagentrejectretry'];this[_0xce30('0xb')]=_0x377579[_0xce30('0xb')];this[_0xce30('0xe')]=_0x377579[_0xce30('0xe')];this[_0xce30('0xc')]=_0x377579[_0xce30('0xc')];this[_0xce30('0xd')]=_0x377579[_0xce30('0xd')];this[_0xce30('0xf')]=_0x377579[_0xce30('0xf')];this[_0xce30('0x10')]=_0x7a3336['uniqueid'];this[_0xce30('0x11')]=_0x377579[_0xce30('0x12')];this[_0xce30('0x13')]=_0x377579['number'];this[_0xce30('0x14')]=_0x377579['starttime'];this['responsetime']=_0x377579[_0xce30('0x15')];this[_0xce30('0x16')]=_0x377579[_0xce30('0x16')];this['endtime']=moment()['format'](_0xce30('0x17'));this['ringtime']=utils[_0xce30('0x18')](_0x377579[_0xce30('0x15')],_0x377579[_0xce30('0x14')]);this[_0xce30('0x19')]=utils[_0xce30('0x18')](_0x377579[_0xce30('0x16')],_0x377579[_0xce30('0x15')]);this[_0xce30('0x1a')]=utils['getSeconds'](this[_0xce30('0x1b')],_0x377579[_0xce30('0x16')]);this[_0xce30('0x7')]=_0x7a3336[_0xce30('0x7')];this[_0xce30('0x1c')]=_0x7a3336[_0xce30('0x1c')];this[_0xce30('0x1d')]=_0x7a3336[_0xce30('0x1d')];this['callback']=_0x377579[_0xce30('0x1e')];this['callbackuniqueid']=_0x377579[_0xce30('0x1f')];this[_0xce30('0x20')]=_0x377579[_0xce30('0x20')];this[_0xce30('0x21')]=_0x377579[_0xce30('0x21')];this[_0xce30('0x22')]=_0x377579[_0xce30('0x22')];this[_0xce30('0x23')]=_0x377579[_0xce30('0x23')];this[_0xce30('0x24')]=_0x377579[_0xce30('0x24')];this['VoiceQueueId']=_0x377579[_0xce30('0x25')];this[_0xce30('0x26')]=_0x377579[_0xce30('0x26')];this[_0xce30('0x27')]=_0x377579[_0xce30('0x27')]||'';this['originatecalleridname']=_0x377579[_0xce30('0x28')]||'';this['agiafterat']=_0x377579[_0xce30('0x29')];}module[_0xce30('0x2a')]=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 a8e2b87..0d1a17a 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 _0xd73f=['countabandonedretry','countagentrejectretry','countdropretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x4c5fe6,_0x4af7aa){var _0x5cfd2f=function(_0x1cc3f9){while(--_0x1cc3f9){_0x4c5fe6['push'](_0x4c5fe6['shift']());}};_0x5cfd2f(++_0x4af7aa);}(_0xd73f,0x16b));var _0xfd73=function(_0x34f86d,_0x469a3b){_0x34f86d=_0x34f86d-0x0;var _0x1c457a=_0xd73f[_0x34f86d];return _0x1c457a;};'use strict';function Final(_0x257942){this[_0xfd73('0x0')]=_0x257942[_0xfd73('0x0')];this['scheduledat']=_0x257942[_0xfd73('0x1')];this[_0xfd73('0x2')]=_0x257942['type'];this[_0xfd73('0x3')]=_0x257942[_0xfd73('0x2')]===_0xfd73('0x4')?_0xfd73('0x5'):_0x257942[_0xfd73('0x2')];this[_0xfd73('0x6')]=_0x257942[_0xfd73('0x6')];this[_0xfd73('0x7')]=_0x257942[_0xfd73('0x7')];this[_0xfd73('0x8')]=_0x257942[_0xfd73('0x8')];this[_0xfd73('0x9')]=_0x257942[_0xfd73('0x6')]+_0x257942[_0xfd73('0x7')]+_0x257942['countnoanswerretry']+_0x257942[_0xfd73('0xa')]+_0x257942['countdropretry']+_0x257942[_0xfd73('0xb')]+_0x257942['countmachineretry']+_0x257942[_0xfd73('0xc')];this[_0xfd73('0xa')]=_0x257942[_0xfd73('0xa')];this[_0xfd73('0xd')]=_0x257942[_0xfd73('0xd')];this['countabandonedretry']=_0x257942[_0xfd73('0xb')];this['countmachineretry']=_0x257942[_0xfd73('0xe')];this[_0xfd73('0xc')]=_0x257942[_0xfd73('0xc')];this[_0xfd73('0x5')]=_0x257942[_0xfd73('0x5')];this[_0xfd73('0xf')]=_0x257942[_0xfd73('0xf')];this[_0xfd73('0x10')]=_0x257942[_0xfd73('0x10')];this[_0xfd73('0x11')]=_0x257942[_0xfd73('0x11')];this[_0xfd73('0x12')]=_0x257942[_0xfd73('0x12')];this['endtime']=_0x257942[_0xfd73('0x12')];this['ringtime']=_0x257942[_0xfd73('0x13')]||0x0;this['holdtime']=_0x257942[_0xfd73('0x14')]||0x0;this[_0xfd73('0x15')]=_0x257942[_0xfd73('0x15')]||0x0;this[_0xfd73('0x16')]=_0x257942[_0xfd73('0x16')];this['callbackuniqueid']=_0x257942['callbackuniqueid'];this[_0xfd73('0x17')]=_0x257942[_0xfd73('0x17')];this[_0xfd73('0x18')]=_0x257942[_0xfd73('0x18')];this[_0xfd73('0x19')]=_0x257942['ContactId'];this[_0xfd73('0x1a')]=_0x257942[_0xfd73('0x1a')];this[_0xfd73('0x1b')]=_0x257942[_0xfd73('0x1b')];this['VoiceQueueId']=_0x257942[_0xfd73('0x1c')];this[_0xfd73('0x1d')]=_0x257942[_0xfd73('0x1d')];this[_0xfd73('0x1e')]=_0x257942['originatecalleridnum']||'';this['originatecalleridname']=_0x257942[_0xfd73('0x1f')]||'';this[_0xfd73('0x20')]=_0x257942[_0xfd73('0x20')];this[_0xfd73('0x21')]=_0x257942[_0xfd73('0x21')];}module['exports']=Final; \ No newline at end of file +var _0x5367=['ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x369eb8,_0x386186){var _0xf84119=function(_0x29da31){while(--_0x29da31){_0x369eb8['push'](_0x369eb8['shift']());}};_0xf84119(++_0x386186);}(_0x5367,0x1ea));var _0x7536=function(_0x356660,_0x4c85a4){_0x356660=_0x356660-0x0;var _0x5d9860=_0x5367[_0x356660];return _0x5d9860;};'use strict';function Final(_0x419e9e){this[_0x7536('0x0')]=_0x419e9e['uniqueid'];this[_0x7536('0x1')]=_0x419e9e[_0x7536('0x1')];this[_0x7536('0x2')]=_0x419e9e[_0x7536('0x2')];this[_0x7536('0x3')]=_0x419e9e['type']===_0x7536('0x4')?'queue':_0x419e9e[_0x7536('0x2')];this[_0x7536('0x5')]=_0x419e9e[_0x7536('0x5')];this[_0x7536('0x6')]=_0x419e9e['countcongestionretry'];this[_0x7536('0x7')]=_0x419e9e[_0x7536('0x7')];this[_0x7536('0x8')]=_0x419e9e[_0x7536('0x5')]+_0x419e9e[_0x7536('0x6')]+_0x419e9e[_0x7536('0x7')]+_0x419e9e[_0x7536('0x9')]+_0x419e9e[_0x7536('0xa')]+_0x419e9e[_0x7536('0xb')]+_0x419e9e[_0x7536('0xc')]+_0x419e9e[_0x7536('0xd')];this[_0x7536('0x9')]=_0x419e9e[_0x7536('0x9')];this[_0x7536('0xa')]=_0x419e9e[_0x7536('0xa')];this[_0x7536('0xb')]=_0x419e9e['countabandonedretry'];this['countmachineretry']=_0x419e9e[_0x7536('0xc')];this['countagentrejectretry']=_0x419e9e[_0x7536('0xd')];this[_0x7536('0xe')]=_0x419e9e[_0x7536('0xe')];this[_0x7536('0xf')]=_0x419e9e['calleridname'];this[_0x7536('0x10')]=_0x419e9e[_0x7536('0x10')];this[_0x7536('0x11')]=_0x419e9e[_0x7536('0x11')];this[_0x7536('0x12')]=_0x419e9e[_0x7536('0x12')];this[_0x7536('0x13')]=_0x419e9e[_0x7536('0x12')];this[_0x7536('0x14')]=_0x419e9e[_0x7536('0x14')]||0x0;this[_0x7536('0x15')]=_0x419e9e['holdtime']||0x0;this[_0x7536('0x16')]=_0x419e9e[_0x7536('0x16')]||0x0;this[_0x7536('0x17')]=_0x419e9e[_0x7536('0x17')];this['callbackuniqueid']=_0x419e9e[_0x7536('0x18')];this[_0x7536('0x19')]=_0x419e9e[_0x7536('0x19')];this[_0x7536('0x1a')]=_0x419e9e['recallme'];this[_0x7536('0x1b')]=_0x419e9e[_0x7536('0x1b')];this[_0x7536('0x1c')]=_0x419e9e['ListId'];this[_0x7536('0x1d')]=_0x419e9e[_0x7536('0x1d')];this[_0x7536('0x1e')]=_0x419e9e['VoiceQueueId'];this['CampaignId']=_0x419e9e[_0x7536('0x1f')];this['originatecalleridnum']=_0x419e9e[_0x7536('0x20')]||'';this[_0x7536('0x21')]=_0x419e9e[_0x7536('0x21')]||'';this[_0x7536('0x22')]=_0x419e9e['state'];this['statedesc']=_0x419e9e[_0x7536('0x23')];}module[_0x7536('0x24')]=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 b51d93c..028fc71 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 _0x2570=['holdtime','talktime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds'];(function(_0x4f93ce,_0x51c256){var _0x52382a=function(_0x3cda04){while(--_0x3cda04){_0x4f93ce['push'](_0x4f93ce['shift']());}};_0x52382a(++_0x51c256);}(_0x2570,0x1d7));var _0x0257=function(_0x510c1b,_0x178e2d){_0x510c1b=_0x510c1b-0x0;var _0x183aa9=_0x2570[_0x510c1b];return _0x183aa9;};'use strict';var moment=require(_0x0257('0x0'));var utils=require('../utils');function Hangup(_0x28f808,_0x1d51d6){this['state']=0x4;this['statedesc']='Answer';this[_0x0257('0x1')]=_0x28f808[_0x0257('0x1')];this[_0x0257('0x2')]=_0x28f808[_0x0257('0x2')];this[_0x0257('0x3')]=_0x28f808[_0x0257('0x2')]===_0x0257('0x4')?'queue':_0x28f808[_0x0257('0x2')];this[_0x0257('0x5')]=_0x28f808['amd']||![];this[_0x0257('0x6')]=_0x28f808[_0x0257('0x6')];this[_0x0257('0x7')]=_0x28f808['countcongestionretry'];this['countnoanswerretry']=_0x28f808[_0x0257('0x8')];this['countglobal']=_0x28f808['countbusyretry']+_0x28f808[_0x0257('0x7')]+_0x28f808['countnoanswerretry']+_0x28f808[_0x0257('0x9')]+_0x28f808[_0x0257('0xa')]+_0x28f808[_0x0257('0xb')]+_0x28f808[_0x0257('0xc')]+_0x28f808[_0x0257('0xd')];this[_0x0257('0x9')]=_0x28f808['countnosuchnumberretry'];this[_0x0257('0xa')]=_0x28f808[_0x0257('0xa')];this['countabandonedretry']=_0x28f808['countabandonedretry'];this['countmachineretry']=_0x28f808['countmachineretry'];this[_0x0257('0xd')]=_0x28f808[_0x0257('0xd')];this[_0x0257('0xe')]=_0x1d51d6[_0x0257('0xe')];this['calleridname']=_0x28f808['name'];this[_0x0257('0xf')]=_0x28f808[_0x0257('0x10')];this['starttime']=_0x28f808[_0x0257('0x11')];this['responsetime']=_0x28f808[_0x0257('0x12')];this[_0x0257('0x13')]=moment()['format'](_0x0257('0x14'));this[_0x0257('0x15')]=utils[_0x0257('0x16')](_0x28f808[_0x0257('0x12')],_0x28f808[_0x0257('0x11')]);this[_0x0257('0x17')]=0x0;this[_0x0257('0x18')]=utils[_0x0257('0x16')](this[_0x0257('0x13')],_0x28f808['responsetime']);this[_0x0257('0x19')]=_0x28f808['queue'];this[_0x0257('0x1a')]='IVR';this[_0x0257('0x1b')]=_0x1d51d6[_0x0257('0x1c')];this[_0x0257('0x1d')]=_0x28f808[_0x0257('0x1d')];this['callbackuniqueid']=_0x28f808[_0x0257('0x1e')];this['callbackat']=_0x28f808[_0x0257('0x1f')];this[_0x0257('0x20')]=_0x28f808[_0x0257('0x20')];this[_0x0257('0x21')]=_0x28f808[_0x0257('0x21')];this[_0x0257('0x22')]=_0x28f808[_0x0257('0x22')];this['UserId']=_0x28f808[_0x0257('0x23')];this[_0x0257('0x24')]=_0x28f808[_0x0257('0x24')];this[_0x0257('0x25')]=_0x28f808['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x45d2=['membername','IVR','reason','cause-txt','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds'];(function(_0x27e133,_0x3c035e){var _0x5b6985=function(_0xa737d){while(--_0xa737d){_0x27e133['push'](_0x27e133['shift']());}};_0x5b6985(++_0x3c035e);}(_0x45d2,0x10f));var _0x245d=function(_0x4b3e5c,_0x2eaacd){_0x4b3e5c=_0x4b3e5c-0x0;var _0xbc2ab5=_0x45d2[_0x4b3e5c];return _0xbc2ab5;};'use strict';var moment=require('moment');var utils=require(_0x245d('0x0'));function Hangup(_0x25202e,_0x44feaf){this[_0x245d('0x1')]=0x4;this[_0x245d('0x2')]=_0x245d('0x3');this[_0x245d('0x4')]=_0x25202e['scheduledat'];this[_0x245d('0x5')]=_0x25202e[_0x245d('0x5')];this[_0x245d('0x6')]=_0x25202e['type']===_0x245d('0x7')?_0x245d('0x8'):_0x25202e[_0x245d('0x5')];this[_0x245d('0x9')]=_0x25202e[_0x245d('0x9')]||![];this[_0x245d('0xa')]=_0x25202e[_0x245d('0xa')];this[_0x245d('0xb')]=_0x25202e[_0x245d('0xb')];this[_0x245d('0xc')]=_0x25202e[_0x245d('0xc')];this['countglobal']=_0x25202e['countbusyretry']+_0x25202e[_0x245d('0xb')]+_0x25202e[_0x245d('0xc')]+_0x25202e['countnosuchnumberretry']+_0x25202e[_0x245d('0xd')]+_0x25202e[_0x245d('0xe')]+_0x25202e[_0x245d('0xf')]+_0x25202e[_0x245d('0x10')];this['countnosuchnumberretry']=_0x25202e[_0x245d('0x11')];this[_0x245d('0xd')]=_0x25202e[_0x245d('0xd')];this[_0x245d('0xe')]=_0x25202e['countabandonedretry'];this[_0x245d('0xf')]=_0x25202e[_0x245d('0xf')];this['countagentrejectretry']=_0x25202e[_0x245d('0x10')];this['uniqueid']=_0x44feaf[_0x245d('0x12')];this[_0x245d('0x13')]=_0x25202e[_0x245d('0x14')];this[_0x245d('0x15')]=_0x25202e['number'];this[_0x245d('0x16')]=_0x25202e['starttime'];this[_0x245d('0x17')]=_0x25202e['responsetime'];this[_0x245d('0x18')]=moment()[_0x245d('0x19')](_0x245d('0x1a'));this[_0x245d('0x1b')]=utils['getSeconds'](_0x25202e['responsetime'],_0x25202e[_0x245d('0x16')]);this[_0x245d('0x1c')]=0x0;this['talktime']=utils[_0x245d('0x1d')](this['endtime'],_0x25202e[_0x245d('0x17')]);this['queue']=_0x25202e[_0x245d('0x8')];this[_0x245d('0x1e')]=_0x245d('0x1f');this[_0x245d('0x20')]=_0x44feaf[_0x245d('0x21')];this[_0x245d('0x22')]=_0x25202e[_0x245d('0x22')];this['callbackuniqueid']=_0x25202e['callbackuniqueid'];this[_0x245d('0x23')]=_0x25202e[_0x245d('0x23')];this[_0x245d('0x24')]=_0x25202e['recallme'];this[_0x245d('0x25')]=_0x25202e[_0x245d('0x25')];this[_0x245d('0x26')]=_0x25202e[_0x245d('0x26')];this[_0x245d('0x27')]=_0x25202e['UserId'];this[_0x245d('0x28')]=_0x25202e[_0x245d('0x28')];this['CampaignId']=_0x25202e[_0x245d('0x29')];}module[_0x245d('0x2a')]=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 2760f4c..9189d68 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 _0xa5af=['countagentrejectretry','countnosuchnumberretry','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x57dc01,_0xce93c9){var _0x14916e=function(_0x298417){while(--_0x298417){_0x57dc01['push'](_0x57dc01['shift']());}};_0x14916e(++_0xce93c9);}(_0xa5af,0xd1));var _0xfa5a=function(_0x531a76,_0x472ed5){_0x531a76=_0x531a76-0x0;var _0x2607e7=_0xa5af[_0x531a76];return _0x2607e7;};'use strict';var utils=require(_0xfa5a('0x0'));function History(_0xf184e8){this[_0xfa5a('0x1')]=_0xf184e8[_0xfa5a('0x1')];this[_0xfa5a('0x2')]=_0xf184e8[_0xfa5a('0x2')]||undefined;this[_0xfa5a('0x3')]=_0xf184e8[_0xfa5a('0x3')];this[_0xfa5a('0x4')]=_0xf184e8[_0xfa5a('0x3')]==='outbound'?_0xfa5a('0x5'):_0xf184e8[_0xfa5a('0x3')];this['countbusyretry']=_0xf184e8[_0xfa5a('0x6')];this['countcongestionretry']=_0xf184e8[_0xfa5a('0x7')];this[_0xfa5a('0x8')]=_0xf184e8[_0xfa5a('0x8')];this[_0xfa5a('0x9')]=_0xf184e8[_0xfa5a('0x6')]+_0xf184e8[_0xfa5a('0x7')]+_0xf184e8[_0xfa5a('0x8')]+_0xf184e8['countnosuchnumberretry']+_0xf184e8[_0xfa5a('0xa')]+_0xf184e8[_0xfa5a('0xb')]+_0xf184e8[_0xfa5a('0xc')]+_0xf184e8[_0xfa5a('0xd')];this[_0xfa5a('0xe')]=_0xf184e8['countnosuchnumberretry'];this['countdropretry']=_0xf184e8[_0xfa5a('0xa')];this['countabandonedretry']=_0xf184e8[_0xfa5a('0xb')];this['countmachineretry']=_0xf184e8[_0xfa5a('0xc')];this['countagentrejectretry']=_0xf184e8['countagentrejectretry'];this[_0xfa5a('0x5')]=_0xf184e8[_0xfa5a('0x5')];this['calleridname']=_0xf184e8[_0xfa5a('0xf')];this[_0xfa5a('0x10')]=_0xf184e8[_0xfa5a('0x11')];this[_0xfa5a('0x12')]=_0xf184e8[_0xfa5a('0x12')];this[_0xfa5a('0x13')]=_0xf184e8['responsetime'];this['endtime']=_0xf184e8[_0xfa5a('0x13')];this[_0xfa5a('0x14')]=utils[_0xfa5a('0x15')](_0xf184e8[_0xfa5a('0x13')],_0xf184e8[_0xfa5a('0x12')]);this[_0xfa5a('0x16')]=0x0;this[_0xfa5a('0x17')]=0x0;this[_0xfa5a('0x18')]=_0xf184e8[_0xfa5a('0x18')];this['callbackuniqueid']=_0xf184e8[_0xfa5a('0x19')];this[_0xfa5a('0x1a')]=_0xf184e8[_0xfa5a('0x1a')];this[_0xfa5a('0x1b')]=_0xf184e8['recallme'];this[_0xfa5a('0x1c')]=_0xf184e8[_0xfa5a('0x1c')];this[_0xfa5a('0x1d')]=_0xf184e8[_0xfa5a('0x1d')];this[_0xfa5a('0x1e')]=_0xf184e8[_0xfa5a('0x1e')];this[_0xfa5a('0x1f')]=_0xf184e8[_0xfa5a('0x1f')];this['CampaignId']=_0xf184e8['CampaignId'];this['originatecalleridnum']=_0xf184e8[_0xfa5a('0x20')]||'';this[_0xfa5a('0x21')]=_0xf184e8[_0xfa5a('0x21')]||'';this[_0xfa5a('0x22')]=_0xf184e8[_0xfa5a('0x22')];this[_0xfa5a('0x23')]=_0xf184e8[_0xfa5a('0x23')];}module[_0xfa5a('0x24')]=History; \ No newline at end of file +var _0x1c76=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x18894b,_0xb20093){var _0x4b3230=function(_0x434091){while(--_0x434091){_0x18894b['push'](_0x18894b['shift']());}};_0x4b3230(++_0xb20093);}(_0x1c76,0x1d9));var _0x61c7=function(_0x57d81a,_0x57bdb6){_0x57d81a=_0x57d81a-0x0;var _0x291516=_0x1c76[_0x57d81a];return _0x291516;};'use strict';var utils=require(_0x61c7('0x0'));function History(_0x1e4864){this['uniqueid']=_0x1e4864['uniqueid'];this[_0x61c7('0x1')]=_0x1e4864[_0x61c7('0x1')]||undefined;this[_0x61c7('0x2')]=_0x1e4864[_0x61c7('0x2')];this[_0x61c7('0x3')]=_0x1e4864[_0x61c7('0x2')]===_0x61c7('0x4')?_0x61c7('0x5'):_0x1e4864[_0x61c7('0x2')];this[_0x61c7('0x6')]=_0x1e4864[_0x61c7('0x6')];this['countcongestionretry']=_0x1e4864['countcongestionretry'];this[_0x61c7('0x7')]=_0x1e4864[_0x61c7('0x7')];this[_0x61c7('0x8')]=_0x1e4864['countbusyretry']+_0x1e4864[_0x61c7('0x9')]+_0x1e4864[_0x61c7('0x7')]+_0x1e4864[_0x61c7('0xa')]+_0x1e4864[_0x61c7('0xb')]+_0x1e4864[_0x61c7('0xc')]+_0x1e4864[_0x61c7('0xd')]+_0x1e4864[_0x61c7('0xe')];this[_0x61c7('0xa')]=_0x1e4864[_0x61c7('0xa')];this[_0x61c7('0xb')]=_0x1e4864['countdropretry'];this['countabandonedretry']=_0x1e4864[_0x61c7('0xc')];this[_0x61c7('0xd')]=_0x1e4864[_0x61c7('0xd')];this[_0x61c7('0xe')]=_0x1e4864[_0x61c7('0xe')];this['queue']=_0x1e4864['queue'];this['calleridname']=_0x1e4864[_0x61c7('0xf')];this[_0x61c7('0x10')]=_0x1e4864[_0x61c7('0x11')];this['starttime']=_0x1e4864[_0x61c7('0x12')];this[_0x61c7('0x13')]=_0x1e4864[_0x61c7('0x13')];this['endtime']=_0x1e4864[_0x61c7('0x13')];this['ringtime']=utils[_0x61c7('0x14')](_0x1e4864[_0x61c7('0x13')],_0x1e4864[_0x61c7('0x12')]);this[_0x61c7('0x15')]=0x0;this[_0x61c7('0x16')]=0x0;this[_0x61c7('0x17')]=_0x1e4864[_0x61c7('0x17')];this[_0x61c7('0x18')]=_0x1e4864[_0x61c7('0x18')];this[_0x61c7('0x19')]=_0x1e4864[_0x61c7('0x19')];this[_0x61c7('0x1a')]=_0x1e4864[_0x61c7('0x1a')];this[_0x61c7('0x1b')]=_0x1e4864[_0x61c7('0x1b')];this[_0x61c7('0x1c')]=_0x1e4864[_0x61c7('0x1c')];this[_0x61c7('0x1d')]=_0x1e4864[_0x61c7('0x1d')];this[_0x61c7('0x1e')]=_0x1e4864[_0x61c7('0x1e')];this['CampaignId']=_0x1e4864[_0x61c7('0x1f')];this[_0x61c7('0x20')]=_0x1e4864[_0x61c7('0x20')]||'';this['originatecalleridname']=_0x1e4864[_0x61c7('0x21')]||'';this[_0x61c7('0x22')]=_0x1e4864[_0x61c7('0x22')];this[_0x61c7('0x23')]=_0x1e4864[_0x61c7('0x23')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index afdbdce..500202f 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 _0x814b=['getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason'];(function(_0x56b5d1,_0x59be02){var _0x5bfe4a=function(_0x9ed053){while(--_0x9ed053){_0x56b5d1['push'](_0x56b5d1['shift']());}};_0x5bfe4a(++_0x59be02);}(_0x814b,0xbf));var _0xb814=function(_0xb875ee,_0x583042){_0xb875ee=_0xb875ee-0x0;var _0x4c7f3a=_0x814b[_0xb875ee];return _0x4c7f3a;};'use strict';var utils=require(_0xb814('0x0'));function QueueCallerAbandon(_0xd27250,_0x291696){this[_0xb814('0x1')]=_0xd27250[_0xb814('0x1')];this[_0xb814('0x2')]=_0xd27250[_0xb814('0x2')];this[_0xb814('0x3')]=_0xd27250[_0xb814('0x2')]===_0xb814('0x4')?_0xb814('0x5'):_0xd27250[_0xb814('0x2')];this[_0xb814('0x6')]=_0xd27250['countbusyretry'];this[_0xb814('0x7')]=_0xd27250[_0xb814('0x7')];this[_0xb814('0x8')]=_0xd27250[_0xb814('0x8')];this[_0xb814('0x9')]=_0xd27250['countbusyretry']+_0xd27250[_0xb814('0x7')]+_0xd27250[_0xb814('0x8')]+_0xd27250['countnosuchnumberretry']+_0xd27250[_0xb814('0xa')]+_0xd27250[_0xb814('0xb')]+_0xd27250[_0xb814('0xc')]+_0xd27250['countagentrejectretry'];this[_0xb814('0xd')]=_0xd27250['countnosuchnumberretry'];this[_0xb814('0xa')]=_0xd27250[_0xb814('0xa')];this[_0xb814('0xb')]=_0xd27250[_0xb814('0xb')];this[_0xb814('0xc')]=_0xd27250[_0xb814('0xc')];this[_0xb814('0xe')]=_0xd27250[_0xb814('0xe')];this[_0xb814('0xf')]=_0x291696[_0xb814('0xf')];this[_0xb814('0x10')]=_0xd27250[_0xb814('0x11')];this[_0xb814('0x12')]=_0xd27250[_0xb814('0x13')];this[_0xb814('0x14')]=_0xd27250[_0xb814('0x14')];this['responsetime']=_0xd27250[_0xb814('0x15')];this[_0xb814('0x16')]=_0xd27250[_0xb814('0x16')];this['dropreason']=_0xd27250[_0xb814('0x17')];this['endtime']=this['droptime'];this['ringtime']=utils[_0xb814('0x18')](_0xd27250[_0xb814('0x15')],_0xd27250[_0xb814('0x14')]);this[_0xb814('0x19')]=utils[_0xb814('0x18')](this[_0xb814('0x16')],_0xd27250[_0xb814('0x15')]);this[_0xb814('0x1a')]=0x0;this[_0xb814('0x5')]=_0x291696[_0xb814('0x5')];this[_0xb814('0x1b')]=_0x291696[_0xb814('0x1c')];this[_0xb814('0x1d')]=_0x291696[_0xb814('0x1d')];this[_0xb814('0x1e')]=_0xd27250[_0xb814('0x1e')];this[_0xb814('0x1f')]=_0xd27250[_0xb814('0x1f')];this[_0xb814('0x20')]=_0xd27250[_0xb814('0x20')];this['recallme']=_0xd27250['recallme'];this[_0xb814('0x21')]=_0xd27250['ContactId'];this[_0xb814('0x22')]=_0xd27250['ListId'];this[_0xb814('0x23')]=_0xd27250[_0xb814('0x23')];this['VoiceQueueId']=_0xd27250[_0xb814('0x24')];this[_0xb814('0x25')]=_0xd27250['CampaignId'];this['originatecalleridnum']=_0xd27250[_0xb814('0x26')]||'';this[_0xb814('0x27')]=_0xd27250['originatecalleridname']||'';this['agiafterat']=_0xd27250['agiafterat'];this[_0xb814('0x28')]=_0xd27250['state'];this[_0xb814('0x29')]=_0xd27250[_0xb814('0x29')];}module[_0xb814('0x2a')]=QueueCallerAbandon; \ No newline at end of file +var _0xcce8=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0xcce8,0x12a));var _0x8cce=function(_0x4aec95,_0x809858){_0x4aec95=_0x4aec95-0x0;var _0x4672bd=_0xcce8[_0x4aec95];return _0x4672bd;};'use strict';var utils=require(_0x8cce('0x0'));function QueueCallerAbandon(_0x3be219,_0x2c121c){this[_0x8cce('0x1')]=_0x3be219['scheduledat'];this[_0x8cce('0x2')]=_0x3be219[_0x8cce('0x2')];this[_0x8cce('0x3')]=_0x3be219[_0x8cce('0x2')]===_0x8cce('0x4')?_0x8cce('0x5'):_0x3be219['type'];this[_0x8cce('0x6')]=_0x3be219[_0x8cce('0x6')];this[_0x8cce('0x7')]=_0x3be219['countcongestionretry'];this[_0x8cce('0x8')]=_0x3be219[_0x8cce('0x8')];this[_0x8cce('0x9')]=_0x3be219[_0x8cce('0x6')]+_0x3be219[_0x8cce('0x7')]+_0x3be219[_0x8cce('0x8')]+_0x3be219[_0x8cce('0xa')]+_0x3be219[_0x8cce('0xb')]+_0x3be219[_0x8cce('0xc')]+_0x3be219[_0x8cce('0xd')]+_0x3be219[_0x8cce('0xe')];this[_0x8cce('0xa')]=_0x3be219[_0x8cce('0xa')];this[_0x8cce('0xb')]=_0x3be219[_0x8cce('0xb')];this[_0x8cce('0xc')]=_0x3be219[_0x8cce('0xc')];this['countmachineretry']=_0x3be219[_0x8cce('0xd')];this[_0x8cce('0xe')]=_0x3be219['countagentrejectretry'];this[_0x8cce('0xf')]=_0x2c121c[_0x8cce('0xf')];this[_0x8cce('0x10')]=_0x3be219[_0x8cce('0x11')];this['calleridnum']=_0x3be219[_0x8cce('0x12')];this[_0x8cce('0x13')]=_0x3be219[_0x8cce('0x13')];this['responsetime']=_0x3be219[_0x8cce('0x14')];this[_0x8cce('0x15')]=_0x3be219['droptime'];this['dropreason']=_0x3be219['dropreason'];this[_0x8cce('0x16')]=this[_0x8cce('0x15')];this[_0x8cce('0x17')]=utils[_0x8cce('0x18')](_0x3be219[_0x8cce('0x14')],_0x3be219[_0x8cce('0x13')]);this[_0x8cce('0x19')]=utils['getSeconds'](this[_0x8cce('0x15')],_0x3be219[_0x8cce('0x14')]);this[_0x8cce('0x1a')]=0x0;this['queue']=_0x2c121c[_0x8cce('0x5')];this[_0x8cce('0x1b')]=_0x2c121c[_0x8cce('0x1c')];this[_0x8cce('0x1d')]=_0x2c121c[_0x8cce('0x1d')];this['callback']=_0x3be219[_0x8cce('0x1e')];this[_0x8cce('0x1f')]=_0x3be219[_0x8cce('0x1f')];this[_0x8cce('0x20')]=_0x3be219[_0x8cce('0x20')];this['recallme']=_0x3be219[_0x8cce('0x21')];this[_0x8cce('0x22')]=_0x3be219[_0x8cce('0x22')];this[_0x8cce('0x23')]=_0x3be219['ListId'];this[_0x8cce('0x24')]=_0x3be219[_0x8cce('0x24')];this[_0x8cce('0x25')]=_0x3be219[_0x8cce('0x25')];this[_0x8cce('0x26')]=_0x3be219[_0x8cce('0x26')];this[_0x8cce('0x27')]=_0x3be219[_0x8cce('0x27')]||'';this[_0x8cce('0x28')]=_0x3be219[_0x8cce('0x28')]||'';this[_0x8cce('0x29')]=_0x3be219['agiafterat'];this['state']=_0x3be219[_0x8cce('0x2a')];this[_0x8cce('0x2b')]=_0x3be219[_0x8cce('0x2b')];}module['exports']=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 2d8e96d..38275db 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 _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(_0x1bf451,_0x40d6fa){var _0x3aae43=function(_0x4e061e){while(--_0x4e061e){_0x1bf451['push'](_0x1bf451['shift']());}};_0x3aae43(++_0x40d6fa);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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 +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x129363,_0xe61cc9){var _0x120874=function(_0x5cb102){while(--_0x5cb102){_0x129363['push'](_0x129363['shift']());}};_0x120874(++_0xe61cc9);}(_0xb10b,0x12a));var _0xbb10=function(_0x575c75,_0x120aa9){_0x575c75=_0x575c75-0x0;var _0x436370=_0xb10b[_0x575c75];return _0x436370;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}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 137374d..639cddf 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 _0xbb77=['format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','ivr','isIVRCampaign','type','outbound','isOutboundQueue','dialActive','active','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string'];(function(_0x350a19,_0x5a1e13){var _0x40f1f5=function(_0x223ca5){while(--_0x223ca5){_0x350a19['push'](_0x350a19['shift']());}};_0x40f1f5(++_0x5a1e13);}(_0xbb77,0x179));var _0x7bb7=function(_0x5b5bdd,_0x2e215c){_0x5b5bdd=_0x5b5bdd-0x0;var _0x39c9e2=_0xbb77[_0x5b5bdd];return _0x39c9e2;};'use strict';var _=require(_0x7bb7('0x0'));var moment=require(_0x7bb7('0x1'));var util=require(_0x7bb7('0x2'));var logger=require(_0x7bb7('0x3'))(_0x7bb7('0x4'));var timezones=require(_0x7bb7('0x5'))[_0x7bb7('0x6')];var CAMPAIGN_STATUS={'ACTIVE':_0x7bb7('0x7'),'BLACKLIST':_0x7bb7('0x8'),'CONTACTS_RESCHEDULED':_0x7bb7('0x9'),'DEACTIVATED':_0x7bb7('0xa'),'DISACTIVED':_0x7bb7('0xb'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x7bb7('0xc'),'NO_AGENTS_LOGGED':_0x7bb7('0xd'),'NO_AVAILABLE_CONTACTS':_0x7bb7('0xe'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0x7bb7('0xf'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x7bb7('0x10'),'RECALL_TIMEOUT':_0x7bb7('0x11'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x7bb7('0x12'),'UNREACHABLE_TRUNK':_0x7bb7('0x13')};exports[_0x7bb7('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x2d38fc){return _0x2d38fc[_0x7bb7('0x15')]===_0x7bb7('0x16');}exports[_0x7bb7('0x17')]=isPreviewCampaign;function isIVRCampaign(_0x455bab){return _0x455bab['type']===_0x7bb7('0x18');}exports[_0x7bb7('0x19')]=isIVRCampaign;function isOutboundQueue(_0x4cc4ca){return _0x4cc4ca[_0x7bb7('0x1a')]===_0x7bb7('0x1b');}exports[_0x7bb7('0x1c')]=isOutboundQueue;function isQueueCampaignActive(_0x1ec459){return _0x1ec459[_0x7bb7('0x1d')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x59ed6d){return _0x59ed6d[_0x7bb7('0x1e')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x47d385,_0x3ea6db){var _0x371c7d=moment(_0x47d385)[_0x7bb7('0x1f')](0x0);var _0x24fc02=moment(_0x3ea6db)[_0x7bb7('0x1f')](0x0);return _0x371c7d['diff'](_0x24fc02,_0x7bb7('0x20'));}exports[_0x7bb7('0x21')]=getSeconds;function hasQueueCampaignDataChanged(_0x5c7cd8,_0x55da49){var _0x5a6a96=![];var _0x32ddc1=_0x5c7cd8[_0x7bb7('0x15')]!==_0x55da49[_0x7bb7('0x15')]||_0x5c7cd8[_0x7bb7('0x1d')]!==_0x55da49['dialActive']||_0x5c7cd8[_0x7bb7('0x22')]!==_0x55da49[_0x7bb7('0x22')];var _0xa82a46=_0x5c7cd8[_0x7bb7('0x23')]!==_0x55da49[_0x7bb7('0x23')]||_0x5c7cd8[_0x7bb7('0x24')]!==_0x55da49[_0x7bb7('0x24')]||_0x5c7cd8['loggedInDb']!==_0x55da49[_0x7bb7('0x25')]||_0x5c7cd8['paused']!==_0x55da49[_0x7bb7('0x26')]||_0x5c7cd8['talking']!==_0x55da49[_0x7bb7('0x27')]||_0x5c7cd8['pTalking']!==_0x55da49[_0x7bb7('0x28')]||_0x5c7cd8[_0x7bb7('0x29')]!==_0x55da49[_0x7bb7('0x29')]||_0x5c7cd8[_0x7bb7('0x2a')]!==_0x55da49[_0x7bb7('0x2a')]||_0x5c7cd8[_0x7bb7('0x2b')]!==_0x55da49[_0x7bb7('0x2b')];if(_0x5c7cd8['Trunk']&&_0x55da49[_0x7bb7('0x2c')]){_0x5a6a96=_0x5c7cd8[_0x7bb7('0x2c')][_0x7bb7('0x2d')]!==_0x55da49[_0x7bb7('0x2c')][_0x7bb7('0x2d')]||_0x5c7cd8['Trunk'][_0x7bb7('0x1e')]!==_0x55da49['Trunk']['active'];}return _0x32ddc1||_0xa82a46||_0x5a6a96;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x7ec4ab){var _0x2c345f=null;var _0x4311aa=_0x7ec4ab[_0x7bb7('0x2e')];if(_[_0x7bb7('0x2f')](_0x7ec4ab[_0x7bb7('0x30')])||_[_0x7bb7('0x2f')](_0x7ec4ab[_0x7bb7('0x31')])||_[_0x7bb7('0x2f')](_0x7ec4ab['Interval']['Intervals'])){_0x2c345f=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x7bb7('0x32')](_0x7ec4ab[_0x7bb7('0x30')])||_[_0x7bb7('0x32')](_0x7ec4ab['Interval'][_0x7bb7('0x33')])){_0x2c345f=CAMPAIGN_STATUS[_0x7bb7('0x34')];}else if(_0x4311aa&&!timezones[_0x4311aa]){_0x2c345f=CAMPAIGN_STATUS[_0x7bb7('0x35')];}return _0x2c345f;}function checkAnyValidTrunk(_0x2b0ed2,_0x1bc1c8){var _0x337529=null;var _0x5f35e6='SIP/';var _0x3bddeb=[_0x7bb7('0x36'),_0x7bb7('0x37')];var _0xeaa704=!![];if(_0x2b0ed2[_0x7bb7('0x2c')]&&_0x2b0ed2['Trunk'][_0x7bb7('0x1e')]){_0x5f35e6+=_0x2b0ed2['Trunk'][_0x7bb7('0x2d')];_0x337529=_0x1bc1c8[_0x5f35e6];_0xeaa704=_0x3bddeb[_0x7bb7('0x38')](_0x337529[_0x7bb7('0x39')]);}else if(_0x2b0ed2[_0x7bb7('0x3a')]&&_0x2b0ed2[_0x7bb7('0x3a')][_0x7bb7('0x1e')]){_0x5f35e6+=_0x2b0ed2['TrunkBackup'][_0x7bb7('0x2d')];_0x337529=_0x1bc1c8[_0x5f35e6];_0xeaa704=_0x3bddeb[_0x7bb7('0x38')](_0x337529['status']);}return _0xeaa704;}function getQueueCampaignStatusMessage(_0x2cfb49,_0x576936){var _0x24bcc0=CAMPAIGN_STATUS[_0x7bb7('0x7')];var _0x120253=isPreviewCampaign(_0x2cfb49);if(!isQueueCampaignActive(_0x2cfb49)){if(_0x120253){_0x24bcc0=CAMPAIGN_STATUS[_0x7bb7('0x3b')];}else{if(_0x2cfb49[_0x7bb7('0x2b')]===0x0&&_0x2cfb49[_0x7bb7('0x27')]===0x0&&_0x2cfb49[_0x7bb7('0x29')]===0x0&&(_0x2cfb49[_0x7bb7('0x28')]||0x0)===0x0){_0x24bcc0=CAMPAIGN_STATUS[_0x7bb7('0x3b')];}else{_0x24bcc0=CAMPAIGN_STATUS[_0x7bb7('0x3c')];}}}else if(_0x2cfb49[_0x7bb7('0x24')]===0x0){_0x24bcc0=CAMPAIGN_STATUS[_0x7bb7('0x3d')];}else if(!checkAnyValidTrunk(_0x2cfb49,_0x576936)){_0x24bcc0=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2cfb49)){var _0x5e71d4=checkAnyValidQueueCampaignInterval(_0x2cfb49);if(_0x5e71d4){_0x24bcc0=_0x5e71d4;}}return _0x24bcc0;}exports[_0x7bb7('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x304fc4){var _0x5af03d=CAMPAIGN_STATUS[_0x7bb7('0x3c')];if(_0x304fc4[_0x7bb7('0x2b')]===0x0&&_0x304fc4['talking']===0x0&&_0x304fc4[_0x7bb7('0x29')]===0x0&&(_0x304fc4[_0x7bb7('0x28')]||0x0)===0x0){_0x5af03d=CAMPAIGN_STATUS[_0x7bb7('0x3b')];}return _0x5af03d;}exports[_0x7bb7('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x32e238){var _0x42979e=_0x32e238[_0x7bb7('0x40')](/"(.*?)"/);return _0x42979e?_0x42979e[0x1]:_0x32e238;}exports[_0x7bb7('0x41')]=extractCalleridName;function getCallerId(_0x479c1,_0x3aa7c2,_0x3c1675){if(!_[_0x7bb7('0x42')](_0x3c1675)&&typeof _0x3c1675===_0x7bb7('0x43')&&!_['isEmpty'](_0x3c1675)){if(!_[_0x7bb7('0x42')](_0x3aa7c2)&&typeof _0x3aa7c2===_0x7bb7('0x43')&&!_[_0x7bb7('0x32')](_0x3aa7c2)){return util[_0x7bb7('0x44')](_0x7bb7('0x45'),_0x3aa7c2,_0x3c1675);}return util[_0x7bb7('0x44')](_0x7bb7('0x45'),_0x3c1675,_0x3c1675);}if(!_[_0x7bb7('0x42')](_0x479c1)&&typeof _0x479c1===_0x7bb7('0x43')&&!_[_0x7bb7('0x32')](_0x479c1)){return _0x479c1;}return _0x7bb7('0x46');}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0xf96edf,_0x4da610){var _0x4d6896;var _0x42b543;var _0x19f901;if(_0x4da610<=0x0){_0x4da610=0x1;}_0x4d6896=new RegExp(_0x7bb7('0x47')+_0x4da610+'}$');_0x42b543=Math[_0x7bb7('0x48')](0xa,_0x4da610-0x1);_0x19f901=Math[_0x7bb7('0x48')](0xa,_0x4da610)-0x1;return util[_0x7bb7('0x44')]('%s',_[_0x7bb7('0x49')](_0xf96edf,_0x4d6896,_[_0x7bb7('0x4a')](_0x42b543,_0x19f901)[_0x7bb7('0x4b')]()));}exports[_0x7bb7('0x4c')]=getCallerIdRandom;function decrementOriginate(_0x512e78){if(_0x512e78[_0x7bb7('0x2b')]&&_0x512e78['originated']>0x0){_0x512e78[_0x7bb7('0x2b')]-=0x1;}else{logger[_0x7bb7('0x4d')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0x7bb7('0x4e')]=decrementOriginate;function checkContactEmpty(_0x5aa6cd){return _0x5aa6cd&&_0x5aa6cd[_0x7bb7('0x4f')]>0x0;}exports[_0x7bb7('0x50')]=checkContactEmpty;function erlangb(_0x5ece53,_0x3b20f2){if(_0x3b20f2===0x0){return 0x0;}var _0x39ddd7=0x1;for(var _0x5847dd=0x1;_0x5847dd<=_0x3b20f2;_0x5847dd+=0x1){_0x39ddd7=0x1+_0x39ddd7*_0x5847dd/_0x5ece53;}return 0x1/_0x39ddd7;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2503e7,_0x5bdfc0,_0x5d0c79){if(_0x5bdfc0>_0x5d0c79){for(var _0x5b6033=0x0;_0x5b6033<_0x5bdfc0-_0x5d0c79;_0x5b6033+=0x1){decrementOriginate(_0x2503e7);}}}exports[_0x7bb7('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x51090b){var _0x3b6678={};var _0xb9f96a=['id',_0x7bb7('0x52'),'description',_0x7bb7('0x53'),_0x7bb7('0x54')];if(_0x51090b){for(var _0x3234f3 in _0x51090b){if(typeof _0x51090b[_0x3234f3]!=='undefined'){if(!_[_0x7bb7('0x2f')](_0x51090b[_0x3234f3])&&!_0xb9f96a['includes'](_0x3234f3)){_0x3b6678[util['format'](_0x7bb7('0x55'),_0x7bb7('0x56'),_0x3234f3[_0x7bb7('0x57')]())]=_0x51090b[_0x3234f3];}}}}return _0x3b6678;}exports[_0x7bb7('0x58')]=setXMDContactVariables; \ No newline at end of file +var _0xf44a=['format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','description','updatedAt','undefined','%s%s','XMD-','toUpperCase','setXMDContactVariables','lodash','moment','../../../../config/logger','timezones','ACTIVE','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','CAMPAIGN_STATUS','dialMethod','preview','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','UNKNOWN_TIMEZONE','reachable','includes','TrunkBackup','status','INACTIVE','NO_AGENTS_LOGGED','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string'];(function(_0x18dedd,_0x4cb9e5){var _0x35b7e1=function(_0x429eb0){while(--_0x429eb0){_0x18dedd['push'](_0x18dedd['shift']());}};_0x35b7e1(++_0x4cb9e5);}(_0xf44a,0x173));var _0xaf44=function(_0x20778c,_0x9c81a0){_0x20778c=_0x20778c-0x0;var _0x32d193=_0xf44a[_0x20778c];return _0x32d193;};'use strict';var _=require(_0xaf44('0x0'));var moment=require(_0xaf44('0x1'));var util=require('util');var logger=require(_0xaf44('0x2'))('dialer');var timezones=require('../../../../config/environment/shared')[_0xaf44('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0xaf44('0x4'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xaf44('0x5'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xaf44('0x6'),'EMPTY_INTERVAL':_0xaf44('0x7'),'INACTIVE':_0xaf44('0x8'),'NO_AGENTS_LOGGED':_0xaf44('0x9'),'NO_AVAILABLE_CONTACTS':_0xaf44('0xa'),'NULL_INTERVAL':_0xaf44('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xaf44('0xc'),'QUEUE_RECALL':_0xaf44('0xd'),'RECALL_TIMEOUT':_0xaf44('0xe'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xaf44('0xf'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xaf44('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x4725dd){return _0x4725dd[_0xaf44('0x11')]===_0xaf44('0x12');}exports[_0xaf44('0x13')]=isPreviewCampaign;function isIVRCampaign(_0x225df8){return _0x225df8[_0xaf44('0x14')]===_0xaf44('0x15');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x2419f2){return _0x2419f2[_0xaf44('0x14')]===_0xaf44('0x16');}exports[_0xaf44('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x413a79){return _0x413a79[_0xaf44('0x18')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x365ecc){return _0x365ecc[_0xaf44('0x19')];}exports[_0xaf44('0x1a')]=isIVRCampaignActive;function getSeconds(_0x57b158,_0x33cd00){var _0x41f409=moment(_0x57b158)[_0xaf44('0x1b')](0x0);var _0x2957d2=moment(_0x33cd00)[_0xaf44('0x1b')](0x0);return _0x41f409[_0xaf44('0x1c')](_0x2957d2,_0xaf44('0x1d'));}exports[_0xaf44('0x1e')]=getSeconds;function hasQueueCampaignDataChanged(_0x181e52,_0x20af87){var _0x3764d0=![];var _0x29202e=_0x181e52[_0xaf44('0x11')]!==_0x20af87[_0xaf44('0x11')]||_0x181e52[_0xaf44('0x18')]!==_0x20af87['dialActive']||_0x181e52[_0xaf44('0x1f')]!==_0x20af87[_0xaf44('0x1f')];var _0x3f3074=_0x181e52['available']!==_0x20af87[_0xaf44('0x20')]||_0x181e52[_0xaf44('0x21')]!==_0x20af87[_0xaf44('0x21')]||_0x181e52[_0xaf44('0x22')]!==_0x20af87[_0xaf44('0x22')]||_0x181e52['paused']!==_0x20af87['paused']||_0x181e52[_0xaf44('0x23')]!==_0x20af87[_0xaf44('0x23')]||_0x181e52[_0xaf44('0x24')]!==_0x20af87['pTalking']||_0x181e52['waiting']!==_0x20af87[_0xaf44('0x25')]||_0x181e52[_0xaf44('0x26')]!==_0x20af87[_0xaf44('0x26')]||_0x181e52[_0xaf44('0x27')]!==_0x20af87[_0xaf44('0x27')];if(_0x181e52[_0xaf44('0x28')]&&_0x20af87[_0xaf44('0x28')]){_0x3764d0=_0x181e52[_0xaf44('0x28')][_0xaf44('0x29')]!==_0x20af87[_0xaf44('0x28')]['name']||_0x181e52[_0xaf44('0x28')][_0xaf44('0x19')]!==_0x20af87[_0xaf44('0x28')][_0xaf44('0x19')];}return _0x29202e||_0x3f3074||_0x3764d0;}exports[_0xaf44('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x437f07){var _0x2ea6e4=null;var _0x3ecc24=_0x437f07[_0xaf44('0x2b')];if(_[_0xaf44('0x2c')](_0x437f07[_0xaf44('0x2d')])||_['isNil'](_0x437f07['Interval'])||_[_0xaf44('0x2c')](_0x437f07[_0xaf44('0x2e')]['Intervals'])){_0x2ea6e4=CAMPAIGN_STATUS[_0xaf44('0x2f')];}else if(_[_0xaf44('0x30')](_0x437f07['dialGlobalInterval'])||_[_0xaf44('0x30')](_0x437f07[_0xaf44('0x2e')][_0xaf44('0x31')])){_0x2ea6e4=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x3ecc24&&!timezones[_0x3ecc24]){_0x2ea6e4=CAMPAIGN_STATUS[_0xaf44('0x32')];}return _0x2ea6e4;}function checkAnyValidTrunk(_0x3e1d80,_0x2616ae){var _0x298ace=null;var _0x9f3e60='SIP/';var _0x1a8103=[_0xaf44('0x33'),'unmonitored'];var _0x270ac8=!![];if(_0x3e1d80['Trunk']&&_0x3e1d80[_0xaf44('0x28')][_0xaf44('0x19')]){_0x9f3e60+=_0x3e1d80['Trunk'][_0xaf44('0x29')];_0x298ace=_0x2616ae[_0x9f3e60];_0x270ac8=_0x1a8103[_0xaf44('0x34')](_0x298ace['status']);}else if(_0x3e1d80[_0xaf44('0x35')]&&_0x3e1d80[_0xaf44('0x35')]['active']){_0x9f3e60+=_0x3e1d80[_0xaf44('0x35')][_0xaf44('0x29')];_0x298ace=_0x2616ae[_0x9f3e60];_0x270ac8=_0x1a8103[_0xaf44('0x34')](_0x298ace[_0xaf44('0x36')]);}return _0x270ac8;}function getQueueCampaignStatusMessage(_0x15cc96,_0xf21264){var _0x68cf6d=CAMPAIGN_STATUS['ACTIVE'];var _0x2b6789=isPreviewCampaign(_0x15cc96);if(!isQueueCampaignActive(_0x15cc96)){if(_0x2b6789){_0x68cf6d=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x15cc96[_0xaf44('0x27')]===0x0&&_0x15cc96[_0xaf44('0x23')]===0x0&&_0x15cc96[_0xaf44('0x25')]===0x0&&(_0x15cc96['pTalking']||0x0)===0x0){_0x68cf6d=CAMPAIGN_STATUS[_0xaf44('0x37')];}else{_0x68cf6d=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x15cc96[_0xaf44('0x21')]===0x0){_0x68cf6d=CAMPAIGN_STATUS[_0xaf44('0x38')];}else if(!checkAnyValidTrunk(_0x15cc96,_0xf21264)){_0x68cf6d=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x15cc96)){var _0x2853e5=checkAnyValidQueueCampaignInterval(_0x15cc96);if(_0x2853e5){_0x68cf6d=_0x2853e5;}}return _0x68cf6d;}exports[_0xaf44('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x1b1c36){var _0x3d1e63=CAMPAIGN_STATUS[_0xaf44('0x3a')];if(_0x1b1c36[_0xaf44('0x27')]===0x0&&_0x1b1c36[_0xaf44('0x23')]===0x0&&_0x1b1c36[_0xaf44('0x25')]===0x0&&(_0x1b1c36[_0xaf44('0x24')]||0x0)===0x0){_0x3d1e63=CAMPAIGN_STATUS[_0xaf44('0x37')];}return _0x3d1e63;}exports[_0xaf44('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5cdb21){var _0x2a31ec=_0x5cdb21[_0xaf44('0x3c')](/"(.*?)"/);return _0x2a31ec?_0x2a31ec[0x1]:_0x5cdb21;}exports[_0xaf44('0x3d')]=extractCalleridName;function getCallerId(_0x13b502,_0x281cd7,_0x4dfcd1){if(!_['isUndefined'](_0x4dfcd1)&&typeof _0x4dfcd1==='string'&&!_[_0xaf44('0x30')](_0x4dfcd1)){if(!_[_0xaf44('0x3e')](_0x281cd7)&&typeof _0x281cd7===_0xaf44('0x3f')&&!_[_0xaf44('0x30')](_0x281cd7)){return util[_0xaf44('0x40')]('\x22%s\x22\x20<%s>',_0x281cd7,_0x4dfcd1);}return util[_0xaf44('0x40')](_0xaf44('0x41'),_0x4dfcd1,_0x4dfcd1);}if(!_[_0xaf44('0x3e')](_0x13b502)&&typeof _0x13b502===_0xaf44('0x3f')&&!_[_0xaf44('0x30')](_0x13b502)){return _0x13b502;}return _0xaf44('0x42');}exports[_0xaf44('0x43')]=getCallerId;function getCallerIdRandom(_0x4c304e,_0x4983fb){var _0x20003f;var _0x4edabf;var _0x157cd3;if(_0x4983fb<=0x0){_0x4983fb=0x1;}_0x20003f=new RegExp(_0xaf44('0x44')+_0x4983fb+'}$');_0x4edabf=Math[_0xaf44('0x45')](0xa,_0x4983fb-0x1);_0x157cd3=Math[_0xaf44('0x45')](0xa,_0x4983fb)-0x1;return util[_0xaf44('0x40')]('%s',_[_0xaf44('0x46')](_0x4c304e,_0x20003f,_['random'](_0x4edabf,_0x157cd3)[_0xaf44('0x47')]()));}exports[_0xaf44('0x48')]=getCallerIdRandom;function decrementOriginate(_0x59686e){if(_0x59686e[_0xaf44('0x27')]&&_0x59686e[_0xaf44('0x27')]>0x0){_0x59686e[_0xaf44('0x27')]-=0x1;}else{logger[_0xaf44('0x49')](_0xaf44('0x4a'));}}exports[_0xaf44('0x4b')]=decrementOriginate;function checkContactEmpty(_0xe2344f){return _0xe2344f&&_0xe2344f[_0xaf44('0x4c')]>0x0;}exports[_0xaf44('0x4d')]=checkContactEmpty;function erlangb(_0x4bb63d,_0x484548){if(_0x484548===0x0){return 0x0;}var _0x5b1d89=0x1;for(var _0xbe71ec=0x1;_0xbe71ec<=_0x484548;_0xbe71ec+=0x1){_0x5b1d89=0x1+_0x5b1d89*_0xbe71ec/_0x4bb63d;}return 0x1/_0x5b1d89;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x47e816,_0x1f1a1b,_0x6bb2c5){if(_0x1f1a1b>_0x6bb2c5){for(var _0x399e98=0x0;_0x399e98<_0x1f1a1b-_0x6bb2c5;_0x399e98+=0x1){decrementOriginate(_0x47e816);}}}exports[_0xaf44('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x1dd092){var _0x1fdae0={};var _0x47c583=['id',_0xaf44('0x4f'),_0xaf44('0x50'),'tags',_0xaf44('0x51')];if(_0x1dd092){for(var _0x4c7fe1 in _0x1dd092){if(typeof _0x1dd092[_0x4c7fe1]!==_0xaf44('0x52')){if(!_[_0xaf44('0x2c')](_0x1dd092[_0x4c7fe1])&&!_0x47c583[_0xaf44('0x34')](_0x4c7fe1)){_0x1fdae0[util['format'](_0xaf44('0x53'),_0xaf44('0x54'),_0x4c7fe1[_0xaf44('0x55')]())]=_0x1dd092[_0x4c7fe1];}}}}return _0x1fdae0;}exports[_0xaf44('0x56')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3040f66..1c1e2e1 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(_0x3485cb,_0x3f0ea7){var _0x52d7bd=function(_0x1dc4a0){while(--_0x1dc4a0){_0x3485cb['push'](_0x3485cb['shift']());}};_0x52d7bd(++_0x3f0ea7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x69e491,_0x3148ef){var _0x4d80cb=function(_0x3c8739){while(--_0x3c8739){_0x69e491['push'](_0x69e491['shift']());}};_0x4d80cb(++_0x3148ef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index e4bb448..5077f37 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 _0x9215=['create','parse','.pdf','then','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/attachment','channels','faxAccounts','trunks','actions','syncNewchannel','bind','syncVarSet','syncNewState','newexten','syncNewExten','receivefax','hangup','syncHangup','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message'];(function(_0x4345c1,_0x1a273f){var _0x5f56f5=function(_0x2c32de){while(--_0x2c32de){_0x4345c1['push'](_0x4345c1['shift']());}};_0x5f56f5(++_0x1a273f);}(_0x9215,0x11f));var _0x5921=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x9215[_0x4709c0];return _0x13348b;};'use strict';var util=require('util');var _=require(_0x5921('0x0'));var BPromise=require(_0x5921('0x1'));var uuid=require(_0x5921('0x2'));var moment=require('moment');var path=require(_0x5921('0x3'));var tiff2pdf=require(_0x5921('0x4'));var gs=require(_0x5921('0x5'));var logger=require(_0x5921('0x6'))(_0x5921('0x7'));var ami=require(_0x5921('0x8'));var rpcDb=require(_0x5921('0x9'));var Channel=require('./channel');var ut=require(_0x5921('0xa'));var Action=require(_0x5921('0xb'));var faxAccount=require('../rpc/faxAccount');var attachment=require(_0x5921('0xc'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2c8323){this[_0x5921('0xd')]={};this['faxAccounts']=_0x2c8323[_0x5921('0xe')];this[_0x5921('0xf')]=_0x2c8323[_0x5921('0xf')];this[_0x5921('0x10')]={};ami['on']('newchannel',this[_0x5921('0x11')][_0x5921('0x12')](this));ami['on']('varset',this[_0x5921('0x13')][_0x5921('0x12')](this));ami['on']('newstate',this[_0x5921('0x14')][_0x5921('0x12')](this));ami['on'](_0x5921('0x15'),this[_0x5921('0x16')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus']['bind'](this));ami['on'](_0x5921('0x17'),this['syncReceiveFax']['bind'](this));ami['on'](_0x5921('0x18'),this[_0x5921('0x19')][_0x5921('0x12')](this));ami['on']('originateresponse',this[_0x5921('0x1a')][_0x5921('0x12')](this));}Fax[_0x5921('0x1b')][_0x5921('0x11')]=function(_0x473f6d){if(_0x473f6d['context']===_0x5921('0x1c')){for(var _0x3afbdc in this['faxAccounts']){if(this[_0x5921('0xe')][_0x5921('0x1d')](_0x3afbdc)){if(_0x473f6d['exten']===this[_0x5921('0xe')][_0x3afbdc][_0x5921('0x1e')]){this['channels'][_0x473f6d[_0x5921('0x1f')]]={};this[_0x5921('0xd')][_0x473f6d['uniqueid']][_0x5921('0x20')]=_0x473f6d[_0x5921('0x20')];this[_0x5921('0xd')][_0x473f6d[_0x5921('0x1f')]]['id']=this[_0x5921('0xe')][_0x3afbdc]['id'];this[_0x5921('0xd')][_0x473f6d[_0x5921('0x1f')]][_0x5921('0x21')]=this['faxAccounts'][_0x3afbdc]['name'];logger[_0x5921('0x22')](_0x473f6d[_0x5921('0x1f')],_0x5921('0x23'));}}}}if(this[_0x5921('0x10')][_0x473f6d[_0x5921('0x1f')]]){this[_0x5921('0xd')][_0x473f6d[_0x5921('0x1f')]]={};this['channels'][_0x473f6d[_0x5921('0x1f')]][_0x5921('0x20')]=_0x473f6d[_0x5921('0x20')];logger[_0x5921('0x22')](_0x473f6d[_0x5921('0x1f')],_0x5921('0x23'));}};Fax[_0x5921('0x1b')][_0x5921('0x13')]=function(_0x470ef1){if(this['channels'][_0x470ef1['uniqueid']]){for(var _0xcf7b84 in _0x470ef1[_0x5921('0x24')]){if(_0x470ef1[_0x5921('0x24')][_0x5921('0x1d')](_0xcf7b84)){this[_0x5921('0xd')][_0x470ef1[_0x5921('0x1f')]][_0xcf7b84]=_0x470ef1['value'];}}}};Fax[_0x5921('0x1b')][_0x5921('0x14')]=function(_0x231d97){if(this[_0x5921('0xd')][_0x231d97['uniqueid']]){this[_0x5921('0xd')][_0x231d97[_0x5921('0x1f')]][_0x5921('0x25')]=_0x231d97['channelstate'];this[_0x5921('0xd')][_0x231d97[_0x5921('0x1f')]][_0x5921('0x26')]=_0x231d97['channelstatedesc'];}};Fax['prototype']['syncNewExten']=function(_0x52463d){if(this[_0x5921('0xd')][_0x52463d[_0x5921('0x1f')]]){for(var _0x82218f in _0x52463d[_0x5921('0x24')]){if(_0x52463d['variable'][_0x5921('0x1d')](_0x82218f)){this['channels'][_0x52463d[_0x5921('0x1f')]][_0x82218f]=_0x52463d[_0x5921('0x27')];}}}};Fax[_0x5921('0x1b')]['syncFaxStatus']=function(_0x56f1b6){if(this[_0x5921('0xd')][_0x56f1b6[_0x5921('0x1f')]]){this[_0x5921('0xd')][_0x56f1b6[_0x5921('0x1f')]][_0x5921('0x28')]=_0x56f1b6[_0x5921('0x28')];this[_0x5921('0xd')][_0x56f1b6[_0x5921('0x1f')]][_0x5921('0x29')]=_0x56f1b6[_0x5921('0x29')];this[_0x5921('0xd')][_0x56f1b6['uniqueid']][_0x5921('0x1e')]=_0x56f1b6[_0x5921('0x1e')];this[_0x5921('0xd')][_0x56f1b6['uniqueid']][_0x5921('0x2a')]=_0x56f1b6['filename'];logger[_0x5921('0x22')](_0x56f1b6['uniqueid'],_0x5921('0x2b'));}};Fax['prototype'][_0x5921('0x2c')]=function(_0x54dc51){var _0x5e9709=this;if(this[_0x5921('0xd')][_0x54dc51['uniqueid']]){var _0x4b59db=this['channels'][_0x54dc51[_0x5921('0x1f')]]['id'];this[_0x5921('0xd')][_0x54dc51['uniqueid']][_0x5921('0x2d')]=_0x54dc51['remotestationid'];this[_0x5921('0xd')][_0x54dc51[_0x5921('0x1f')]][_0x5921('0x2e')]=_0x54dc51[_0x5921('0x2e')];this['channels'][_0x54dc51[_0x5921('0x1f')]][_0x5921('0x1e')]=_0x54dc51[_0x5921('0x1e')];this[_0x5921('0xd')][_0x54dc51[_0x5921('0x1f')]][_0x5921('0x2f')]=_0x54dc51['resolution'];this['channels'][_0x54dc51[_0x5921('0x1f')]][_0x5921('0x30')]=_0x54dc51[_0x5921('0x30')];this['channels'][_0x54dc51[_0x5921('0x1f')]][_0x5921('0x2a')]=_0x54dc51[_0x5921('0x2a')];this[_0x5921('0xd')][_0x54dc51[_0x5921('0x1f')]]['calleridnum']=_0x54dc51[_0x5921('0x31')];if(this[_0x5921('0xd')][_0x54dc51[_0x5921('0x1f')]][_0x5921('0x2e')]>0x0){tiff2pdf(_0x54dc51[_0x5921('0x2a')],'/var/opt/motion2/server/files/attachments/',function(_0x583153){logger['info'](_0x54dc51[_0x5921('0x1f')],_0x5921('0x32'),_0x583153[_0x5921('0x33')]);attachment[_0x5921('0x34')]({'name':path[_0x5921('0x35')](_0x54dc51['filename'])[_0x5921('0x21')],'basename':path[_0x5921('0x35')](_0x54dc51[_0x5921('0x2a')])['name']+_0x5921('0x36'),'type':'application/pdf'})[_0x5921('0x37')](function(_0x5ada43){faxAccount['notify'](_0x4b59db,{'from':_0x54dc51[_0x5921('0x31')],'mapKey':'fax','body':path[_0x5921('0x35')](_0x54dc51[_0x5921('0x2a')])[_0x5921('0x21')]+_0x5921('0x36'),'AttachmentId':_0x5ada43['id']})[_0x5921('0x38')](function(_0x36dce0){logger[_0x5921('0x39')](_0x54dc51[_0x5921('0x1f')],_0x5921('0x3a'),JSON[_0x5921('0x3b')](_0x36dce0));});})[_0x5921('0x38')](function(_0xcb62ef){logger['error'](_0x54dc51['uniqueid'],_0x5921('0x3c'),JSON[_0x5921('0x3b')](_0xcb62ef));});});}logger[_0x5921('0x22')](_0x54dc51[_0x5921('0x1f')],_0x5921('0x3c'));}};Fax[_0x5921('0x1b')][_0x5921('0x1a')]=function(_0x3a7f5f){if(this['actions'][_0x3a7f5f[_0x5921('0x1f')]]){_[_0x5921('0x3d')](this[_0x5921('0xd')][_0x3a7f5f[_0x5921('0x1f')]],_['pick'](_0x3a7f5f,[_0x5921('0x3e'),_0x5921('0x3f')]));}};function updateStatus(_0x274f8f){if(_0x274f8f[_0x5921('0x40')]){faxMessage[_0x5921('0x41')](_0x274f8f[_0x5921('0x40')],{'failMessage':_0x5921('0x42')})['then'](function(_0x27d3ed){ut[_0x5921('0x43')](_0x5921('0x44'),_0x27d3ed);})['catch'](function(_0x556f36){ut[_0x5921('0x43')](_0x5921('0x45'),_0x556f36);});}else{ut[_0x5921('0x43')](_0x5921('0x46'));}}Fax['prototype'][_0x5921('0x47')]=function(_0x424d49,_0x1020dd,_0x1c9ed2){var _0x14a79c=this;var _0x40f5d6={};if(_0x1020dd){_0x40f5d6={'read':_0x1020dd};}else{_0x40f5d6={'failMessage':_0x1c9ed2};}if(this[_0x5921('0x10')][_0x424d49][_0x5921('0x40')]){faxMessage[_0x5921('0x41')](this[_0x5921('0x10')][_0x424d49]['AttachmentId'],_0x40f5d6)[_0x5921('0x37')](function(_0x442d90){ut[_0x5921('0x43')](_0x5921('0x48'),_0x442d90);})[_0x5921('0x38')](function(_0x3b88c0){ut[_0x5921('0x43')](_0x5921('0x49'),_0x3b88c0);})['finally'](function(){delete _0x14a79c['channels'][_0x424d49];delete _0x14a79c[_0x5921('0x10')][_0x424d49];});}else{ut[_0x5921('0x43')](_0x5921('0x4a'));delete this[_0x5921('0xd')][_0x424d49];delete this['actions'][_0x424d49];}};Fax[_0x5921('0x1b')][_0x5921('0x19')]=function(_0x3382ca){var _0x5d99c3=this;if(this['channels'][_0x3382ca[_0x5921('0x1f')]]){if(this[_0x5921('0x10')][_0x3382ca[_0x5921('0x1f')]]){this[_0x5921('0xd')][_0x3382ca[_0x5921('0x1f')]]['id']=this[_0x5921('0x10')][_0x3382ca[_0x5921('0x1f')]]['id'];this[_0x5921('0xd')][_0x3382ca[_0x5921('0x1f')]][_0x5921('0x21')]=this[_0x5921('0x10')][_0x3382ca[_0x5921('0x1f')]]['name'];}logger[_0x5921('0x22')](_0x3382ca[_0x5921('0x1f')],this[_0x5921('0x10')][_0x3382ca[_0x5921('0x1f')]]?_0x5921('0x4b'):_0x5921('0x4c'),JSON[_0x5921('0x3b')](this[_0x5921('0xd')][_0x3382ca['uniqueid']]));if(this['actions'][_0x3382ca[_0x5921('0x1f')]]){if(this[_0x5921('0xd')][_0x3382ca[_0x5921('0x1f')]][_0x5921('0x4d')]>0x0&&this[_0x5921('0xd')][_0x3382ca[_0x5921('0x1f')]]['faxstatus']==='SUCCESS'){this[_0x5921('0x47')](_0x3382ca[_0x5921('0x1f')],!![]);}else{this[_0x5921('0x47')](_0x3382ca['uniqueid'],![],this[_0x5921('0xd')][_0x3382ca[_0x5921('0x1f')]]['faxstatusstring']?'SENDING\x20FAILED:\x20'+this['channels'][_0x3382ca['uniqueid']][_0x5921('0x4e')]:_0x5921('0x4f'));}}}};Fax[_0x5921('0x1b')][_0x5921('0x50')]=function(_0x57b35c){var _0x144ffb=this;return new BPromise(function(_0x4b9e8d,_0xef946a){_0x144ffb[_0x5921('0x51')](_0x57b35c,_0x144ffb[_0x5921('0xe')][_0x57b35c['FaxAccountId']])['then'](function(_0x4822eb){ut[_0x5921('0x43')](_0x5921('0x52'),_0x4822eb);_0x4b9e8d(ut[_0x5921('0x33')](_0x5921('0x53')));})[_0x5921('0x38')](function(_0x45f7bb){ut[_0x5921('0x43')](_0x5921('0x54'),_0x45f7bb);updateStatus(_0x57b35c);_0xef946a(ut['message'](_0x5921('0x55')));});});};Fax[_0x5921('0x1b')][_0x5921('0x56')]=function(_0x1c1df8){var _0x20d05e=this;return new BPromise(function(_0x51daf9,_0x2087bf){var _0x432f30=_0x20d05e[_0x5921('0x57')](_0x20d05e[_0x5921('0xe')][_0x1c1df8[_0x5921('0x58')]]['Trunk'],_0x1c1df8);if(_0x432f30[_0x5921('0x59')]){_0x51daf9(ut[_0x5921('0x33')]('Trunk\x20Reachable'));}else{_0x2087bf(ut['message'](_0x432f30[_0x5921('0x33')]));}});};function originate(_0x863b49,_0x516ef6,_0x5ad625){return new BPromise(function(_0x4b0e61,_0x4d0370){if(_0x5ad625){var _0x6f461e=util[_0x5921('0x5a')](_0x5921('0x5b'),path[_0x5921('0x35')](_0x863b49['path'])[_0x5921('0x21')],_0x863b49['path']);gs[_0x5921('0x5c')](_0x6f461e)[_0x5921('0x37')](function(){_0x863b49[_0x5921('0x3')]=util[_0x5921('0x5a')](_0x5921('0x5d'),path[_0x5921('0x35')](_0x863b49[_0x5921('0x3')])[_0x5921('0x5e')],path['parse'](_0x863b49[_0x5921('0x3')])['name']);_0x516ef6[_0x5921('0x5f')]=_0x863b49[_0x5921('0x3')];ut[_0x5921('0x43')](_0x5921('0x60'),'');ami['Action'](ut[_0x5921('0x61')](_0x863b49,_0x516ef6))[_0x5921('0x37')](function(_0x1e518d){_0x4b0e61(_0x1e518d);})[_0x5921('0x38')](function(_0x392f87){_0x4d0370(_0x392f87);});})[_0x5921('0x38')](function(_0x825d43){_0x4d0370(_0x825d43);});}else{ami[_0x5921('0x62')](ut[_0x5921('0x61')](_0x863b49,_0x516ef6))[_0x5921('0x37')](function(_0x467e22){_0x4b0e61(_0x467e22);})[_0x5921('0x38')](function(_0xf3529c){_0x4d0370(_0xf3529c);});}});}Fax[_0x5921('0x1b')][_0x5921('0x51')]=function(_0x308bf5,_0x3e1aac){var _0x34d0f1=this;return new BPromise(function(_0x456901,_0x23b561){var _0x18116d=uuid['v4']();var _0x262cd0=ut[_0x5921('0x63')](_0x308bf5,_0x3e1aac);_0x34d0f1[_0x5921('0x10')][_0x18116d]=new Action(_0x18116d,_0x3e1aac,_0x308bf5);var _0x4745e8=_0x34d0f1['actions'][_0x18116d];if(path[_0x5921('0x35')](_0x308bf5[_0x5921('0x3')])['ext']==='.pdf'){originate(_0x4745e8,_0x262cd0,!![])['then'](function(_0x5ba466){_0x456901(_0x5ba466);})[_0x5921('0x38')](function(_0x1103d8){_0x23b561(_0x1103d8);});}else{originate(_0x4745e8,_0x262cd0,![])[_0x5921('0x37')](function(_0x40cdd3){_0x456901(_0x40cdd3);})[_0x5921('0x38')](function(_0x5494e5){_0x23b561(_0x5494e5);});}});};Fax[_0x5921('0x1b')][_0x5921('0x64')]=function(_0xbe5a55){return!_['isNil'](_0xbe5a55)&&!_[_0x5921('0x65')](_0xbe5a55[_0x5921('0x21')])&&!_[_0x5921('0x65')](_0xbe5a55['active'])&&_0xbe5a55[_0x5921('0x66')]&&!_[_0x5921('0x65')](this['trunks'][util[_0x5921('0x5a')](_0x5921('0x67'),_0xbe5a55[_0x5921('0x21')])])&&!_[_0x5921('0x65')](this[_0x5921('0xf')][util['format'](_0x5921('0x67'),_0xbe5a55[_0x5921('0x21')])]['status'])&&(this['trunks'][util[_0x5921('0x5a')]('SIP/%s',_0xbe5a55[_0x5921('0x21')])]['status']===_0x5921('0x68')||this[_0x5921('0xf')][util[_0x5921('0x5a')](_0x5921('0x67'),_0xbe5a55[_0x5921('0x21')])][_0x5921('0x29')]===_0x5921('0x69'));};Fax['prototype']['checkTrunk']=function(_0x2e69c5,_0x4f34fc){if(!this['isTrunkReachable'](_0x2e69c5)){ut[_0x5921('0x43')](_0x5921('0x6a'),_[_0x5921('0x65')](_0x2e69c5)?'':_0x2e69c5[_0x5921('0x21')]+_0x5921('0x6b'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x5921('0x65')](_0x4f34fc[_0x5921('0x7')])){ut['logger'](_0x5921('0x6c'),JSON[_0x5921('0x3b')](_0x4f34fc));return{'isValid':![],'message':_0x5921('0x6d')};}if(_[_0x5921('0x65')](_0x4f34fc[_0x5921('0x3')])){ut[_0x5921('0x43')](_0x5921('0x6e'),JSON['stringify'](_0x4f34fc));return{'isValid':![],'message':_0x5921('0x6f')};}return{'isValid':!![],'message':_0x5921('0x70')};};module['exports']=Fax; \ No newline at end of file +var _0x246b=['response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isTrunkReachable','active','isNil','trunks','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','exports','util','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','faxAccounts','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','channels','channel','uniqueid','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','catch','\x20notify\x20','stringify','error','\x20receiveFax\x20','syncOriginateResponse'];(function(_0xcc31c2,_0x180f25){var _0x50ad18=function(_0xd9810d){while(--_0xd9810d){_0xcc31c2['push'](_0xcc31c2['shift']());}};_0x50ad18(++_0x180f25);}(_0x246b,0xb5));var _0xb246=function(_0x314460,_0x356cb6){_0x314460=_0x314460-0x0;var _0x1b2c7b=_0x246b[_0x314460];return _0x1b2c7b;};'use strict';var util=require(_0xb246('0x0'));var _=require('lodash');var BPromise=require(_0xb246('0x1'));var uuid=require(_0xb246('0x2'));var moment=require(_0xb246('0x3'));var path=require(_0xb246('0x4'));var tiff2pdf=require(_0xb246('0x5'));var gs=require(_0xb246('0x6'));var logger=require(_0xb246('0x7'))(_0xb246('0x8'));var ami=require(_0xb246('0x9'));var rpcDb=require(_0xb246('0xa'));var Channel=require(_0xb246('0xb'));var ut=require('./util/util');var Action=require(_0xb246('0xc'));var faxAccount=require(_0xb246('0xd'));var attachment=require(_0xb246('0xe'));var faxMessage=require(_0xb246('0xf'));function Fax(_0x3d46a6){this['channels']={};this[_0xb246('0x10')]=_0x3d46a6[_0xb246('0x10')];this['trunks']=_0x3d46a6['trunks'];this[_0xb246('0x11')]={};ami['on'](_0xb246('0x12'),this[_0xb246('0x13')][_0xb246('0x14')](this));ami['on'](_0xb246('0x15'),this[_0xb246('0x16')][_0xb246('0x14')](this));ami['on'](_0xb246('0x17'),this[_0xb246('0x18')][_0xb246('0x14')](this));ami['on']('newexten',this[_0xb246('0x19')][_0xb246('0x14')](this));ami['on'](_0xb246('0x1a'),this[_0xb246('0x1b')][_0xb246('0x14')](this));ami['on']('receivefax',this[_0xb246('0x1c')][_0xb246('0x14')](this));ami['on'](_0xb246('0x1d'),this[_0xb246('0x1e')][_0xb246('0x14')](this));ami['on'](_0xb246('0x1f'),this['syncOriginateResponse']['bind'](this));}Fax[_0xb246('0x20')]['syncNewchannel']=function(_0x2901ef){if(_0x2901ef[_0xb246('0x21')]===_0xb246('0x22')){for(var _0x463c6f in this['faxAccounts']){if(this[_0xb246('0x10')][_0xb246('0x23')](_0x463c6f)){if(_0x2901ef[_0xb246('0x24')]===this[_0xb246('0x10')][_0x463c6f][_0xb246('0x25')]){this[_0xb246('0x26')][_0x2901ef['uniqueid']]={};this[_0xb246('0x26')][_0x2901ef['uniqueid']][_0xb246('0x27')]=_0x2901ef[_0xb246('0x27')];this['channels'][_0x2901ef[_0xb246('0x28')]]['id']=this[_0xb246('0x10')][_0x463c6f]['id'];this['channels'][_0x2901ef[_0xb246('0x28')]][_0xb246('0x29')]=this[_0xb246('0x10')][_0x463c6f][_0xb246('0x29')];logger[_0xb246('0x2a')](_0x2901ef[_0xb246('0x28')],_0xb246('0x2b'));}}}}if(this[_0xb246('0x11')][_0x2901ef[_0xb246('0x28')]]){this[_0xb246('0x26')][_0x2901ef[_0xb246('0x28')]]={};this['channels'][_0x2901ef['uniqueid']]['channel']=_0x2901ef[_0xb246('0x27')];logger[_0xb246('0x2a')](_0x2901ef[_0xb246('0x28')],_0xb246('0x2b'));}};Fax[_0xb246('0x20')][_0xb246('0x16')]=function(_0x42b37c){if(this[_0xb246('0x26')][_0x42b37c[_0xb246('0x28')]]){for(var _0x291989 in _0x42b37c['variable']){if(_0x42b37c[_0xb246('0x2c')][_0xb246('0x23')](_0x291989)){this[_0xb246('0x26')][_0x42b37c[_0xb246('0x28')]][_0x291989]=_0x42b37c['value'];}}}};Fax['prototype'][_0xb246('0x18')]=function(_0x38074d){if(this[_0xb246('0x26')][_0x38074d[_0xb246('0x28')]]){this[_0xb246('0x26')][_0x38074d[_0xb246('0x28')]][_0xb246('0x2d')]=_0x38074d[_0xb246('0x2d')];this[_0xb246('0x26')][_0x38074d['uniqueid']][_0xb246('0x2e')]=_0x38074d['channelstatedesc'];}};Fax[_0xb246('0x20')][_0xb246('0x19')]=function(_0x5f249c){if(this[_0xb246('0x26')][_0x5f249c['uniqueid']]){for(var _0x25c74b in _0x5f249c[_0xb246('0x2c')]){if(_0x5f249c[_0xb246('0x2c')][_0xb246('0x23')](_0x25c74b)){this[_0xb246('0x26')][_0x5f249c[_0xb246('0x28')]][_0x25c74b]=_0x5f249c[_0xb246('0x2f')];}}}};Fax['prototype'][_0xb246('0x1b')]=function(_0x790392){if(this[_0xb246('0x26')][_0x790392['uniqueid']]){this[_0xb246('0x26')][_0x790392['uniqueid']][_0xb246('0x30')]=_0x790392[_0xb246('0x30')];this['channels'][_0x790392['uniqueid']][_0xb246('0x31')]=_0x790392[_0xb246('0x31')];this[_0xb246('0x26')][_0x790392[_0xb246('0x28')]]['localstationid']=_0x790392[_0xb246('0x25')];this[_0xb246('0x26')][_0x790392[_0xb246('0x28')]]['filename']=_0x790392[_0xb246('0x32')];logger[_0xb246('0x2a')](_0x790392['uniqueid'],_0xb246('0x33'));}};Fax[_0xb246('0x20')][_0xb246('0x1c')]=function(_0x34761c){var _0x588384=this;if(this['channels'][_0x34761c[_0xb246('0x28')]]){var _0x1fb7f7=this[_0xb246('0x26')][_0x34761c[_0xb246('0x28')]]['id'];this['channels'][_0x34761c[_0xb246('0x28')]]['remotestationid']=_0x34761c[_0xb246('0x34')];this[_0xb246('0x26')][_0x34761c[_0xb246('0x28')]][_0xb246('0x35')]=_0x34761c['pagestransferred'];this[_0xb246('0x26')][_0x34761c[_0xb246('0x28')]][_0xb246('0x25')]=_0x34761c[_0xb246('0x25')];this['channels'][_0x34761c[_0xb246('0x28')]][_0xb246('0x36')]=_0x34761c[_0xb246('0x36')];this[_0xb246('0x26')][_0x34761c['uniqueid']][_0xb246('0x37')]=_0x34761c['transferrate'];this[_0xb246('0x26')][_0x34761c[_0xb246('0x28')]]['filename']=_0x34761c[_0xb246('0x32')];this[_0xb246('0x26')][_0x34761c['uniqueid']][_0xb246('0x38')]=_0x34761c[_0xb246('0x38')];if(this[_0xb246('0x26')][_0x34761c[_0xb246('0x28')]][_0xb246('0x35')]>0x0){tiff2pdf(_0x34761c[_0xb246('0x32')],_0xb246('0x39'),function(_0x495c6e){logger[_0xb246('0x2a')](_0x34761c[_0xb246('0x28')],_0xb246('0x3a'),_0x495c6e[_0xb246('0x3b')]);attachment[_0xb246('0x3c')]({'name':path[_0xb246('0x3d')](_0x34761c['filename'])[_0xb246('0x29')],'basename':path['parse'](_0x34761c[_0xb246('0x32')])[_0xb246('0x29')]+_0xb246('0x3e'),'type':_0xb246('0x3f')})[_0xb246('0x40')](function(_0x274f3a){faxAccount['notify'](_0x1fb7f7,{'from':_0x34761c[_0xb246('0x38')],'mapKey':_0xb246('0x8'),'body':path[_0xb246('0x3d')](_0x34761c[_0xb246('0x32')])[_0xb246('0x29')]+_0xb246('0x3e'),'AttachmentId':_0x274f3a['id']})[_0xb246('0x41')](function(_0x9e364b){logger['error'](_0x34761c['uniqueid'],_0xb246('0x42'),JSON[_0xb246('0x43')](_0x9e364b));});})['catch'](function(_0x322a59){logger[_0xb246('0x44')](_0x34761c[_0xb246('0x28')],_0xb246('0x45'),JSON['stringify'](_0x322a59));});});}logger[_0xb246('0x2a')](_0x34761c[_0xb246('0x28')],'\x20receiveFax\x20');}};Fax[_0xb246('0x20')][_0xb246('0x46')]=function(_0x1a430a){if(this[_0xb246('0x11')][_0x1a430a[_0xb246('0x28')]]){_['merge'](this['channels'][_0x1a430a[_0xb246('0x28')]],_['pick'](_0x1a430a,[_0xb246('0x47'),_0xb246('0x48')]));}};function updateStatus(_0x109ba4){if(_0x109ba4[_0xb246('0x49')]){faxMessage[_0xb246('0x4a')](_0x109ba4['AttachmentId'],{'failMessage':_0xb246('0x4b')})[_0xb246('0x40')](function(_0x22e62e){ut[_0xb246('0x4c')](_0xb246('0x4d'),_0x22e62e);})[_0xb246('0x41')](function(_0x50c670){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x50c670);});}else{ut['logger'](_0xb246('0x4e'));}}Fax[_0xb246('0x20')]['updateStatus']=function(_0x498989,_0x4a8d6d,_0x549ccc){var _0x4471ab=this;var _0x298cc9={};if(_0x4a8d6d){_0x298cc9={'read':_0x4a8d6d};}else{_0x298cc9={'failMessage':_0x549ccc};}if(this['actions'][_0x498989][_0xb246('0x49')]){faxMessage['update'](this[_0xb246('0x11')][_0x498989][_0xb246('0x49')],_0x298cc9)[_0xb246('0x40')](function(_0x3d1016){ut[_0xb246('0x4c')](_0xb246('0x4f'),_0x3d1016);})[_0xb246('0x41')](function(_0x13c62f){ut[_0xb246('0x4c')](_0xb246('0x50'),_0x13c62f);})[_0xb246('0x51')](function(){delete _0x4471ab['channels'][_0x498989];delete _0x4471ab['actions'][_0x498989];});}else{ut[_0xb246('0x4c')](_0xb246('0x52'));delete this[_0xb246('0x26')][_0x498989];delete this[_0xb246('0x11')][_0x498989];}};Fax[_0xb246('0x20')][_0xb246('0x1e')]=function(_0x518d4a){var _0x247f8e=this;if(this[_0xb246('0x26')][_0x518d4a[_0xb246('0x28')]]){if(this['actions'][_0x518d4a['uniqueid']]){this[_0xb246('0x26')][_0x518d4a['uniqueid']]['id']=this[_0xb246('0x11')][_0x518d4a['uniqueid']]['id'];this[_0xb246('0x26')][_0x518d4a[_0xb246('0x28')]][_0xb246('0x29')]=this[_0xb246('0x11')][_0x518d4a[_0xb246('0x28')]][_0xb246('0x29')];}logger[_0xb246('0x2a')](_0x518d4a['uniqueid'],this[_0xb246('0x11')][_0x518d4a['uniqueid']]?_0xb246('0x53'):_0xb246('0x54'),JSON[_0xb246('0x43')](this[_0xb246('0x26')][_0x518d4a[_0xb246('0x28')]]));if(this[_0xb246('0x11')][_0x518d4a[_0xb246('0x28')]]){if(this['channels'][_0x518d4a['uniqueid']][_0xb246('0x55')]>0x0&&this[_0xb246('0x26')][_0x518d4a[_0xb246('0x28')]][_0xb246('0x1a')]===_0xb246('0x56')){this[_0xb246('0x57')](_0x518d4a[_0xb246('0x28')],!![]);}else{this[_0xb246('0x57')](_0x518d4a[_0xb246('0x28')],![],this['channels'][_0x518d4a['uniqueid']][_0xb246('0x58')]?_0xb246('0x59')+this[_0xb246('0x26')][_0x518d4a[_0xb246('0x28')]]['faxstatusstring']:_0xb246('0x5a'));}}}};Fax[_0xb246('0x20')][_0xb246('0x5b')]=function(_0x544d75){var _0x343f0c=this;return new BPromise(function(_0x422a11,_0xad2e6c){_0x343f0c['execOriginate'](_0x544d75,_0x343f0c[_0xb246('0x10')][_0x544d75[_0xb246('0x5c')]])['then'](function(_0x34a24b){ut[_0xb246('0x4c')](_0xb246('0x5d'),_0x34a24b);_0x422a11(ut['message'](_0xb246('0x5e')));})['catch'](function(_0x53d63d){ut[_0xb246('0x4c')](_0xb246('0x5f'),_0x53d63d);updateStatus(_0x544d75);_0xad2e6c(ut[_0xb246('0x3b')](_0xb246('0x60')));});});};Fax['prototype']['checkAfterSend']=function(_0x1fa76f){var _0x427ea4=this;return new BPromise(function(_0x3ae6c9,_0x4022b8){var _0x4698d6=_0x427ea4[_0xb246('0x61')](_0x427ea4['faxAccounts'][_0x1fa76f[_0xb246('0x5c')]][_0xb246('0x62')],_0x1fa76f);if(_0x4698d6[_0xb246('0x63')]){_0x3ae6c9(ut[_0xb246('0x3b')](_0xb246('0x64')));}else{_0x4022b8(ut[_0xb246('0x3b')](_0x4698d6[_0xb246('0x3b')]));}});};function originate(_0x10d557,_0x2e5aef,_0x228805){return new BPromise(function(_0x1ff77a,_0x52dd58){if(_0x228805){var _0x2682d5=util[_0xb246('0x65')](_0xb246('0x66'),path['parse'](_0x10d557[_0xb246('0x4')])['name'],_0x10d557[_0xb246('0x4')]);gs[_0xb246('0x67')](_0x2682d5)[_0xb246('0x40')](function(){_0x10d557[_0xb246('0x4')]=util[_0xb246('0x65')](_0xb246('0x68'),path['parse'](_0x10d557['path'])[_0xb246('0x69')],path[_0xb246('0x3d')](_0x10d557['path'])[_0xb246('0x29')]);_0x2e5aef[_0xb246('0x6a')]=_0x10d557[_0xb246('0x4')];ut[_0xb246('0x4c')](_0xb246('0x6b'),'');ami[_0xb246('0x6c')](ut[_0xb246('0x6d')](_0x10d557,_0x2e5aef))[_0xb246('0x40')](function(_0x4fef64){_0x1ff77a(_0x4fef64);})[_0xb246('0x41')](function(_0x335391){_0x52dd58(_0x335391);});})[_0xb246('0x41')](function(_0x4b8c90){_0x52dd58(_0x4b8c90);});}else{ami[_0xb246('0x6c')](ut[_0xb246('0x6d')](_0x10d557,_0x2e5aef))[_0xb246('0x40')](function(_0x3ede6e){_0x1ff77a(_0x3ede6e);})[_0xb246('0x41')](function(_0x1738db){_0x52dd58(_0x1738db);});}});}Fax[_0xb246('0x20')]['execOriginate']=function(_0xfe50ee,_0x43912c){var _0x2eba4a=this;return new BPromise(function(_0x38d8c2,_0x2ff626){var _0x2fecdd=uuid['v4']();var _0x297018=ut[_0xb246('0x6e')](_0xfe50ee,_0x43912c);_0x2eba4a[_0xb246('0x11')][_0x2fecdd]=new Action(_0x2fecdd,_0x43912c,_0xfe50ee);var _0x3c21b9=_0x2eba4a[_0xb246('0x11')][_0x2fecdd];if(path[_0xb246('0x3d')](_0xfe50ee[_0xb246('0x4')])[_0xb246('0x6f')]===_0xb246('0x3e')){originate(_0x3c21b9,_0x297018,!![])[_0xb246('0x40')](function(_0x48fc65){_0x38d8c2(_0x48fc65);})[_0xb246('0x41')](function(_0x2e3d94){_0x2ff626(_0x2e3d94);});}else{originate(_0x3c21b9,_0x297018,![])[_0xb246('0x40')](function(_0x5e090d){_0x38d8c2(_0x5e090d);})[_0xb246('0x41')](function(_0x37e074){_0x2ff626(_0x37e074);});}});};Fax[_0xb246('0x20')][_0xb246('0x70')]=function(_0x437bd0){return!_['isNil'](_0x437bd0)&&!_['isNil'](_0x437bd0['name'])&&!_['isNil'](_0x437bd0['active'])&&_0x437bd0[_0xb246('0x71')]&&!_[_0xb246('0x72')](this[_0xb246('0x73')][util[_0xb246('0x65')]('SIP/%s',_0x437bd0['name'])])&&!_[_0xb246('0x72')](this[_0xb246('0x73')][util[_0xb246('0x65')](_0xb246('0x74'),_0x437bd0[_0xb246('0x29')])][_0xb246('0x31')])&&(this[_0xb246('0x73')][util[_0xb246('0x65')]('SIP/%s',_0x437bd0[_0xb246('0x29')])][_0xb246('0x31')]===_0xb246('0x75')||this[_0xb246('0x73')][util[_0xb246('0x65')](_0xb246('0x74'),_0x437bd0[_0xb246('0x29')])][_0xb246('0x31')]===_0xb246('0x76'));};Fax['prototype'][_0xb246('0x61')]=function(_0x34e8cd,_0xa05e65){if(!this[_0xb246('0x70')](_0x34e8cd)){ut[_0xb246('0x4c')](_0xb246('0x77'),_[_0xb246('0x72')](_0x34e8cd)?'':_0x34e8cd[_0xb246('0x29')]+_0xb246('0x78'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xb246('0x72')](_0xa05e65[_0xb246('0x8')])){ut['logger'](_0xb246('0x79'),JSON[_0xb246('0x43')](_0xa05e65));return{'isValid':![],'message':_0xb246('0x7a')};}if(_[_0xb246('0x72')](_0xa05e65[_0xb246('0x4')])){ut[_0xb246('0x4c')](_0xb246('0x7b'),JSON['stringify'](_0xa05e65));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xb246('0x7c')};};module[_0xb246('0x7d')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 90b5cf5..b8d69b1 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 _0x7da5=['[Notify]\x20','util','../../../config/logger','preview','../rpc/faxAccount','error','inspect','notify','resolve','then','catch'];(function(_0x51a549,_0x1dd44b){var _0x349bf9=function(_0x57e7f0){while(--_0x57e7f0){_0x51a549['push'](_0x51a549['shift']());}};_0x349bf9(++_0x1dd44b);}(_0x7da5,0x182));var _0x57da=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x7da5[_0x3ff085];return _0x2b68c3;};'use strict';var util=require(_0x57da('0x0'));var BPromise=require('bluebird');var logger=require(_0x57da('0x1'))(_0x57da('0x2'));var _=require('lodash');var faxAccount=require(_0x57da('0x3'));function loggerCatch(_0x5dae4f){return function(_0x4cc68b){logger[_0x57da('0x4')](_0x5dae4f,util[_0x57da('0x5')](_0x4cc68b,{'showHidden':![],'depth':null}));};}exports[_0x57da('0x6')]=function(_0x669b8b,_0x3a05bf){return BPromise[_0x57da('0x7')]()[_0x57da('0x8')](faxAccount['notify'](_0x669b8b,_0x3a05bf))[_0x57da('0x9')](loggerCatch(_0x57da('0xa')));}; \ No newline at end of file +var _0x83dd=['preview','lodash','../rpc/faxAccount','error','inspect','resolve','catch','[Notify]\x20','util','bluebird','../../../config/logger'];(function(_0x3ee99e,_0x4affec){var _0x1b56e1=function(_0x3857a2){while(--_0x3857a2){_0x3ee99e['push'](_0x3ee99e['shift']());}};_0x1b56e1(++_0x4affec);}(_0x83dd,0x97));var _0xd83d=function(_0x237fa4,_0x2e6e08){_0x237fa4=_0x237fa4-0x0;var _0x2bad98=_0x83dd[_0x237fa4];return _0x2bad98;};'use strict';var util=require(_0xd83d('0x0'));var BPromise=require(_0xd83d('0x1'));var logger=require(_0xd83d('0x2'))(_0xd83d('0x3'));var _=require(_0xd83d('0x4'));var faxAccount=require(_0xd83d('0x5'));function loggerCatch(_0x4aeec0){return function(_0x14f528){logger[_0xd83d('0x6')](_0x4aeec0,util[_0xd83d('0x7')](_0x14f528,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x9c53ae,_0x5c45ea){return BPromise[_0xd83d('0x8')]()['then'](faxAccount['notify'](_0x9c53ae,_0x5c45ea))[_0xd83d('0x9')](loggerCatch(_0xd83d('0xa')));}; \ 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 f6aa07a..c57a659 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 _0xc083=['execute','info','Exec\x20gs','\x20Error\x20:','../../../../config/logger','fax','bluebird','child_process','exec'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xc083,0x1ab));var _0x3c08=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc083[_0x4a9fb1];return _0x348672;};'use strict';var util=require('util');var logger=require(_0x3c08('0x0'))(_0x3c08('0x1'));var BPromise=require(_0x3c08('0x2'));var exec=require(_0x3c08('0x3'))[_0x3c08('0x4')];exports[_0x3c08('0x5')]=function(_0x198401){return new BPromise(function(_0x3dded4,_0x177881){exec(_0x198401,function(_0x1fff44,_0x20bf53,_0x1aebbd){logger[_0x3c08('0x6')](_0x3c08('0x7'),_0x20bf53);if(_0x1fff44){logger[_0x3c08('0x6')](_0x3c08('0x7'),_0x3c08('0x8'),util['inspect'](_0x1fff44,{'showHidden':![],'depth':null}),_0x20bf53,_0x1aebbd);_0x177881(_0x1fff44);}_0x3dded4(_0x20bf53);});});}; \ No newline at end of file +var _0x0e75=['execute','info','\x20Error\x20:','fax','child_process'];(function(_0x5e6a37,_0xf45005){var _0x342555=function(_0x13e962){while(--_0x13e962){_0x5e6a37['push'](_0x5e6a37['shift']());}};_0x342555(++_0xf45005);}(_0x0e75,0x139));var _0x50e7=function(_0x467932,_0x144d66){_0x467932=_0x467932-0x0;var _0xac1803=_0x0e75[_0x467932];return _0xac1803;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x50e7('0x0'));var BPromise=require('bluebird');var exec=require(_0x50e7('0x1'))['exec'];exports[_0x50e7('0x2')]=function(_0x4726ce){return new BPromise(function(_0x106924,_0x5f49cd){exec(_0x4726ce,function(_0x3821d0,_0x1d1508,_0x1d6e73){logger[_0x50e7('0x3')]('Exec\x20gs',_0x1d1508);if(_0x3821d0){logger[_0x50e7('0x3')]('Exec\x20gs',_0x50e7('0x4'),util['inspect'](_0x3821d0,{'showHidden':![],'depth':null}),_0x1d1508,_0x1d6e73);_0x5f49cd(_0x3821d0);}_0x106924(_0x1d1508);});});}; \ 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 6fe4637..8a3de34 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 _0x7d3c=['faxdetect','t38timeout','variablesAction','uniqueid','originate','channel','format','\x22%s\x22\x20<%s>','localstationid','util','fax','message','info','inspect','addVariables','ecm','headerinfo','minrate','\x22%s\x22','modem','gateway'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x7d3c,0x9c));var _0xc7d3=function(_0x98e540,_0x4c0ee1){_0x98e540=_0x98e540-0x0;var _0x392fb8=_0x7d3c[_0x98e540];return _0x392fb8;};'use strict';var util=require(_0xc7d3('0x0'));var _=require('lodash');var moment=require('moment');var logger=require('../../../../config/logger')(_0xc7d3('0x1'));exports[_0xc7d3('0x2')]=function(_0x522ccb){return{'message':_0x522ccb};};exports['logger']=function(_0x2eecb0,_0x5093b1){logger[_0xc7d3('0x3')](_0x2eecb0,util[_0xc7d3('0x4')](_0x5093b1,{'showHidden':![],'depth':null}));};exports[_0xc7d3('0x5')]=function(_0x1dbd32,_0x50674c){var _0x3b97c1={'XMF-ECM':_0x50674c[_0xc7d3('0x6')],'XMF-HEADERINFO':_0x50674c[_0xc7d3('0x7')],'XMF-MINRATE':_0x50674c[_0xc7d3('0x8')],'XMF-MAXRATE':_0x50674c['maxrate'],'XMF-MODEM':util['format'](_0xc7d3('0x9'),_0x50674c[_0xc7d3('0xa')]),'XMF-GATEWAY':_0x50674c[_0xc7d3('0xb')],'XMF-FAXDETECT':_0x50674c[_0xc7d3('0xc')],'XMF-T38TIMEOUT':_0x50674c[_0xc7d3('0xd')],'XMF-LOCALSTATIONID':_0x50674c['localstationid'],'XMF-PATH':_0x1dbd32['path']};return _0x3b97c1;};exports[_0xc7d3('0xe')]=function(_0x2d60c4,_0x3c2a10){return{'actionid':_0x2d60c4[_0xc7d3('0xf')],'action':_0xc7d3('0x10'),'channel':_0x2d60c4[_0xc7d3('0x11')],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0xc7d3('0x12')](_0xc7d3('0x13'),_0x2d60c4[_0xc7d3('0x7')]?_0x2d60c4[_0xc7d3('0x7')]:'',_0x2d60c4[_0xc7d3('0x14')]),'variable':_0x3c2a10,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2d60c4[_0xc7d3('0xf')]};}; \ No newline at end of file +var _0xb447=['fax','message','logger','inspect','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','moment','../../../../config/logger'];(function(_0x3cc5de,_0x4a45bf){var _0x5242be=function(_0x1665e5){while(--_0x1665e5){_0x3cc5de['push'](_0x3cc5de['shift']());}};_0x5242be(++_0x4a45bf);}(_0xb447,0x16e));var _0x7b44=function(_0x23edd5,_0x584fef){_0x23edd5=_0x23edd5-0x0;var _0x5b7f7f=_0xb447[_0x23edd5];return _0x5b7f7f;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x7b44('0x0'));var logger=require(_0x7b44('0x1'))(_0x7b44('0x2'));exports[_0x7b44('0x3')]=function(_0x127205){return{'message':_0x127205};};exports[_0x7b44('0x4')]=function(_0x3a2e7d,_0x37bd9e){logger['info'](_0x3a2e7d,util[_0x7b44('0x5')](_0x37bd9e,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x54e973,_0x734408){var _0x187ba1={'XMF-ECM':_0x734408[_0x7b44('0x6')],'XMF-HEADERINFO':_0x734408[_0x7b44('0x7')],'XMF-MINRATE':_0x734408[_0x7b44('0x8')],'XMF-MAXRATE':_0x734408[_0x7b44('0x9')],'XMF-MODEM':util[_0x7b44('0xa')](_0x7b44('0xb'),_0x734408[_0x7b44('0xc')]),'XMF-GATEWAY':_0x734408[_0x7b44('0xd')],'XMF-FAXDETECT':_0x734408[_0x7b44('0xe')],'XMF-T38TIMEOUT':_0x734408[_0x7b44('0xf')],'XMF-LOCALSTATIONID':_0x734408[_0x7b44('0x10')],'XMF-PATH':_0x54e973['path']};return _0x187ba1;};exports['variablesAction']=function(_0xd3b861,_0x4380fb){return{'actionid':_0xd3b861[_0x7b44('0x11')],'action':_0x7b44('0x12'),'channel':_0xd3b861[_0x7b44('0x13')],'Exten':_0x7b44('0x14'),'Context':_0x7b44('0x15'),'Priority':'1','callerid':util['format'](_0x7b44('0x16'),_0xd3b861[_0x7b44('0x7')]?_0xd3b861[_0x7b44('0x7')]:'',_0xd3b861['localstationid']),'variable':_0x4380fb,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0xd3b861[_0x7b44('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 7df4e65..62abd34 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 _0x0b13=['initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x0b13,0x150));var _0x30b1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x0b13[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x30b1('0x0'));var moment=require(_0x30b1('0x1'));var server=require(_0x30b1('0x2'));var Realtime=require(_0x30b1('0x3'));var Report=require(_0x30b1('0x4'));var Acw=require(_0x30b1('0x5'));var Trigger=require(_0x30b1('0x6'));var Dialer=require(_0x30b1('0x7'));var Preview=require(_0x30b1('0x8'));var Fax=require(_0x30b1('0x9'));var user=require(_0x30b1('0xa'));var voiceQueue=require(_0x30b1('0xb'));var voiceQueueReport=require(_0x30b1('0xc'));var voiceCallReport=require(_0x30b1('0xd'));var trunk=require(_0x30b1('0xe'));var trigger=require(_0x30b1('0xf'));var template=require(_0x30b1('0x10'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x30b1('0x11'));var voiceExtension=require(_0x30b1('0x12'));var faxAccount=require(_0x30b1('0x13'));var zendesk=require(_0x30b1('0x14'));var salesforce=require(_0x30b1('0x15'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x30b1('0x16'));var desk=require(_0x30b1('0x17'));var zoho=require('./rpc/integrations/zoho');var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0x30b1('0x18'));var servicenow=require(_0x30b1('0x19'));var dynamics365=require(_0x30b1('0x1a'));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(_0x30b1('0x1b'))(_0x30b1('0x1c'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x30b1('0x1d')](_0x30b1('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x30b1('0x1d')](_0x30b1('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x30b1('0x1f')]()[_0x30b1('0x20')](user[_0x30b1('0x21')]())[_0x30b1('0x20')](realtime['initAgents']())[_0x30b1('0x20')](user['getTelephones']())[_0x30b1('0x20')](realtime[_0x30b1('0x22')]())[_0x30b1('0x20')](trunk[_0x30b1('0x23')]())[_0x30b1('0x20')](realtime[_0x30b1('0x24')]())[_0x30b1('0x20')](voiceQueue[_0x30b1('0x25')]())[_0x30b1('0x20')](realtime[_0x30b1('0x26')]())[_0x30b1('0x20')](trigger[_0x30b1('0x27')]())[_0x30b1('0x20')](realtime[_0x30b1('0x28')]())[_0x30b1('0x20')](template['getTemplates']())[_0x30b1('0x20')](realtime[_0x30b1('0x29')]())['then'](zendesk[_0x30b1('0x2a')]())['then'](realtime[_0x30b1('0x2b')]())[_0x30b1('0x20')](salesforce[_0x30b1('0x2c')]())[_0x30b1('0x20')](realtime['initSalesforceAccounts']())[_0x30b1('0x20')](sugarcrm[_0x30b1('0x2d')]())[_0x30b1('0x20')](realtime['initSugarcrmAccounts']())[_0x30b1('0x20')](freshdesk[_0x30b1('0x2e')]())[_0x30b1('0x20')](realtime[_0x30b1('0x2f')]())[_0x30b1('0x20')](desk[_0x30b1('0x30')]())[_0x30b1('0x20')](realtime[_0x30b1('0x31')]())[_0x30b1('0x20')](zoho[_0x30b1('0x32')]())[_0x30b1('0x20')](realtime[_0x30b1('0x33')]())[_0x30b1('0x20')](vtiger['getVtigerAccounts']())[_0x30b1('0x20')](realtime[_0x30b1('0x34')]())[_0x30b1('0x20')](freshsales[_0x30b1('0x35')]())[_0x30b1('0x20')](realtime[_0x30b1('0x36')]())[_0x30b1('0x20')](servicenow['getServicenowAccounts']())[_0x30b1('0x20')](realtime[_0x30b1('0x37')]())['then'](dynamics365[_0x30b1('0x38')]())['then'](realtime[_0x30b1('0x39')]())[_0x30b1('0x20')](campaign[_0x30b1('0x3a')]())[_0x30b1('0x20')](realtime['initCampaigns']())['then'](voiceExtension['getVoiceExtensions']())[_0x30b1('0x20')](realtime[_0x30b1('0x3b')]())[_0x30b1('0x20')](faxAccount[_0x30b1('0x3c')]())[_0x30b1('0x20')](realtime[_0x30b1('0x3d')]())[_0x30b1('0x20')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x30b1('0x20')](voiceQueueReport[_0x30b1('0x3e')]())[_0x30b1('0x20')](realtime[_0x30b1('0x3f')]())[_0x30b1('0x20')](cmHopperHistory[_0x30b1('0x40')]())['then'](realtime[_0x30b1('0x41')]())[_0x30b1('0x20')](cmHopperHistory[_0x30b1('0x42')]())[_0x30b1('0x20')](realtime[_0x30b1('0x43')]())[_0x30b1('0x20')](voiceCallReport['getVoiceCallReports']())[_0x30b1('0x20')](realtime[_0x30b1('0x44')]())['catch'](function(_0x4f946b){logger[_0x30b1('0x45')](_0x30b1('0x46'),util[_0x30b1('0x47')](_0x4f946b,{'showHidden':![],'depth':null}));});}function main(){return server[_0x30b1('0x48')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x30b1('0x20')](function(){return initParams();})['then'](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x59d590){logger[_0x30b1('0x45')](_0x30b1('0x49'),util[_0x30b1('0x47')](_0x59d590,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x418b=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','util','moment','./realtime','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts'];(function(_0x2fc7d4,_0x37a136){var _0x21a187=function(_0x1d81f6){while(--_0x1d81f6){_0x2fc7d4['push'](_0x2fc7d4['shift']());}};_0x21a187(++_0x37a136);}(_0x418b,0xa6));var _0xb418=function(_0x38564e,_0x412e4d){_0x38564e=_0x38564e-0x0;var _0xf30930=_0x418b[_0x38564e];return _0xf30930;};'use strict';var util=require(_0xb418('0x0'));var moment=require(_0xb418('0x1'));var server=require('./server');var Realtime=require(_0xb418('0x2'));var Report=require('./report');var Acw=require(_0xb418('0x3'));var Trigger=require(_0xb418('0x4'));var Dialer=require(_0xb418('0x5'));var Preview=require(_0xb418('0x6'));var Fax=require('./fax');var user=require(_0xb418('0x7'));var voiceQueue=require(_0xb418('0x8'));var voiceQueueReport=require(_0xb418('0x9'));var voiceCallReport=require(_0xb418('0xa'));var trunk=require('./rpc/trunk');var trigger=require(_0xb418('0xb'));var template=require('./rpc/template');var cmHopperHistory=require(_0xb418('0xc'));var campaign=require(_0xb418('0xd'));var voiceExtension=require(_0xb418('0xe'));var faxAccount=require(_0xb418('0xf'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xb418('0x10'));var sugarcrm=require(_0xb418('0x11'));var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0xb418('0x12'));var zoho=require(_0xb418('0x13'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xb418('0x14'));var servicenow=require(_0xb418('0x15'));var dynamics365=require(_0xb418('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0xb418('0x17'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xb418('0x18')](_0xb418('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xb418('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xb418('0x1a')]()[_0xb418('0x1b')](user['getAgents']())[_0xb418('0x1b')](realtime[_0xb418('0x1c')]())[_0xb418('0x1b')](user[_0xb418('0x1d')]())['then'](realtime[_0xb418('0x1e')]())[_0xb418('0x1b')](trunk['getTrunks']())['then'](realtime[_0xb418('0x1f')]())['then'](voiceQueue[_0xb418('0x20')]())['then'](realtime['initVoiceQueues']())[_0xb418('0x1b')](trigger[_0xb418('0x21')]())['then'](realtime[_0xb418('0x22')]())[_0xb418('0x1b')](template[_0xb418('0x23')]())[_0xb418('0x1b')](realtime[_0xb418('0x24')]())['then'](zendesk[_0xb418('0x25')]())[_0xb418('0x1b')](realtime['initZendeskAccounts']())[_0xb418('0x1b')](salesforce['getSalesforceAccounts']())['then'](realtime['initSalesforceAccounts']())['then'](sugarcrm[_0xb418('0x26')]())[_0xb418('0x1b')](realtime[_0xb418('0x27')]())[_0xb418('0x1b')](freshdesk[_0xb418('0x28')]())[_0xb418('0x1b')](realtime['initFreshdeskAccounts']())[_0xb418('0x1b')](desk[_0xb418('0x29')]())[_0xb418('0x1b')](realtime[_0xb418('0x2a')]())['then'](zoho[_0xb418('0x2b')]())[_0xb418('0x1b')](realtime[_0xb418('0x2c')]())[_0xb418('0x1b')](vtiger[_0xb418('0x2d')]())['then'](realtime[_0xb418('0x2e')]())[_0xb418('0x1b')](freshsales[_0xb418('0x2f')]())[_0xb418('0x1b')](realtime[_0xb418('0x30')]())[_0xb418('0x1b')](servicenow[_0xb418('0x31')]())['then'](realtime['initServicenowAccounts']())[_0xb418('0x1b')](dynamics365[_0xb418('0x32')]())[_0xb418('0x1b')](realtime[_0xb418('0x33')]())['then'](campaign['getCampaigns']())['then'](realtime[_0xb418('0x34')]())[_0xb418('0x1b')](voiceExtension[_0xb418('0x35')]())[_0xb418('0x1b')](realtime[_0xb418('0x36')]())[_0xb418('0x1b')](faxAccount['getFaxAccounts']())[_0xb418('0x1b')](realtime[_0xb418('0x37')]())['then'](function(){return realtime;});}function initParams(){return Promise[_0xb418('0x1a')]()[_0xb418('0x1b')](voiceQueueReport[_0xb418('0x38')]())[_0xb418('0x1b')](realtime['initVoiceQueueReports']())[_0xb418('0x1b')](cmHopperHistory[_0xb418('0x39')]())[_0xb418('0x1b')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xb418('0x3a')]())[_0xb418('0x1b')](realtime[_0xb418('0x3b')]())[_0xb418('0x1b')](voiceCallReport[_0xb418('0x3c')]())['then'](realtime[_0xb418('0x3d')]())[_0xb418('0x3e')](function(_0x170d73){logger[_0xb418('0x3f')](_0xb418('0x40'),util['inspect'](_0x170d73,{'showHidden':![],'depth':null}));});}function main(){return server[_0xb418('0x41')](realtime,preview,fax)[_0xb418('0x1b')](function(){return initRealtime();})[_0xb418('0x1b')](function(){return initParams();})[_0xb418('0x1b')](function(){report[_0xb418('0x42')]();setInterval(initRealtime,0x1388);})[_0xb418('0x3e')](function(_0x530749){logger['error'](_0xb418('0x43'),util['inspect'](_0x530749,{'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 7ee8a37..1661245 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 _0x1433=['unknown','stateTime','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','toNumber','voiceStatus','name','format','user:%s','emit','lodash','util','moment','md5','../../../config/environment','redis','localhost','socket.io-emitter','email','accountcode','fullname','state'];(function(_0xc4c719,_0x4fae92){var _0x334409=function(_0x3a4282){while(--_0x3a4282){_0xc4c719['push'](_0xc4c719['shift']());}};_0x334409(++_0x4fae92);}(_0x1433,0x152));var _0x3143=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x1433[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var moment=require(_0x3143('0x2'));var md5=require(_0x3143('0x3'));var Redis=require('ioredis');var config=require(_0x3143('0x4'));config[_0x3143('0x5')]=_['defaults'](config[_0x3143('0x5')],{'host':_0x3143('0x6'),'port':0x18eb});var io=require(_0x3143('0x7'))(new Redis(config[_0x3143('0x5')]));function Agent(_0x303195){this['id']=_0x303195['id']||0x0;this['name']=_0x303195['name']||'';this[_0x3143('0x8')]=_0x303195[_0x3143('0x8')]||'';this[_0x3143('0x9')]=_0x303195[_0x3143('0x9')]||'';this[_0x3143('0xa')]=_0x303195['fullname']||'';this[_0x3143('0xb')]=_0x3143('0xc');this[_0x3143('0xd')]=0x0;this['status']=_0x3143('0xc');this['address']='';this[_0x3143('0xe')]='';this[_0x3143('0xf')]='';this[_0x3143('0x10')]='';this[_0x3143('0x11')]=_0x303195['online']||![];this['voiceStatus']='unknown';this[_0x3143('0x12')]=0x0;this[_0x3143('0x13')]='';this[_0x3143('0x14')]='';this[_0x3143('0x15')]=![];this[_0x3143('0x16')]=![];this[_0x3143('0x3')]='';}Agent[_0x3143('0x17')][_0x3143('0x18')]=function(_0x5348da){var _0x196191;if(_0x5348da&&_0x5348da['state']){_0x196191=_0x5348da['state'][_0x3143('0x19')]();switch(_0x196191){case'not_inuse':_0x196191=_0x3143('0x1a');break;case _0x3143('0x1b'):_0x196191=_0x3143('0x1c');break;}}if(_0x196191&&this['voiceStatus']!==_0x196191||_0x5348da['statePause']){this[_0x3143('0x12')]=_[_0x3143('0x1d')](moment()['format']('x'));}if(_0x196191){this[_0x3143('0x1e')]=_0x196191;}var _0x3fbe5e={'id':this['id'],'name':this[_0x3143('0x1f')],'email':this['email'],'accountcode':this[_0x3143('0x9')],'fullname':this[_0x3143('0xa')],'state':this[_0x3143('0xb')],'stateTime':this[_0x3143('0xd')],'status':this['status'],'address':this['address'],'online':this[_0x3143('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x3143('0x12')],'voiceStatusCallerIdNumber':this[_0x3143('0x13')],'voiceStatusQueue':this[_0x3143('0x14')],'interface':this[_0x3143('0x10')],'onhold':this[_0x3143('0x15')]};var _0x2335b0=md5(JSON['stringify'](_0x3fbe5e));if(this[_0x3143('0x3')]!==_0x2335b0){this[_0x3143('0x3')]=_0x2335b0;io['to'](util[_0x3143('0x20')](_0x3143('0x21'),_0x3fbe5e[_0x3143('0x1f')]))[_0x3143('0x22')]('user:save',_0x3fbe5e);io['emit']('user:presence',_0x3fbe5e);}};module['exports']=Agent; \ No newline at end of file +var _0x57e9=['idle','inuse','talking','statePause','format','stringify','user:%s','emit','user:save','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','socket.io-emitter','name','accountcode','fullname','state','stateTime','status','unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','prototype','updateStatusRealtime','toLowerCase','not_inuse'];(function(_0x203b7a,_0x532da2){var _0x4a457c=function(_0x4d9af4){while(--_0x4d9af4){_0x203b7a['push'](_0x203b7a['shift']());}};_0x4a457c(++_0x532da2);}(_0x57e9,0x12b));var _0x957e=function(_0x2660a,_0x452b69){_0x2660a=_0x2660a-0x0;var _0x2a6339=_0x57e9[_0x2660a];return _0x2a6339;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x957e('0x0'));var md5=require(_0x957e('0x1'));var Redis=require(_0x957e('0x2'));var config=require(_0x957e('0x3'));config[_0x957e('0x4')]=_['defaults'](config[_0x957e('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x957e('0x5'))(new Redis(config[_0x957e('0x4')]));function Agent(_0x3fdae0){this['id']=_0x3fdae0['id']||0x0;this[_0x957e('0x6')]=_0x3fdae0[_0x957e('0x6')]||'';this['email']=_0x3fdae0['email']||'';this['accountcode']=_0x3fdae0[_0x957e('0x7')]||'';this[_0x957e('0x8')]=_0x3fdae0[_0x957e('0x8')]||'';this[_0x957e('0x9')]='unknown';this[_0x957e('0xa')]=0x0;this[_0x957e('0xb')]=_0x957e('0xc');this[_0x957e('0xd')]='';this['phone']='';this[_0x957e('0xe')]='';this[_0x957e('0xf')]='';this['online']=_0x3fdae0[_0x957e('0x10')]||![];this[_0x957e('0x11')]=_0x957e('0xc');this[_0x957e('0x12')]=0x0;this[_0x957e('0x13')]='';this[_0x957e('0x14')]='';this['onhold']=![];this['local']=![];this['md5']='';}Agent[_0x957e('0x15')][_0x957e('0x16')]=function(_0x3397c9){var _0x22697b;if(_0x3397c9&&_0x3397c9[_0x957e('0x9')]){_0x22697b=_0x3397c9[_0x957e('0x9')][_0x957e('0x17')]();switch(_0x22697b){case _0x957e('0x18'):_0x22697b=_0x957e('0x19');break;case _0x957e('0x1a'):_0x22697b=_0x957e('0x1b');break;}}if(_0x22697b&&this[_0x957e('0x11')]!==_0x22697b||_0x3397c9[_0x957e('0x1c')]){this[_0x957e('0x12')]=_['toNumber'](moment()[_0x957e('0x1d')]('x'));}if(_0x22697b){this[_0x957e('0x11')]=_0x22697b;}var _0x34e91d={'id':this['id'],'name':this[_0x957e('0x6')],'email':this['email'],'accountcode':this[_0x957e('0x7')],'fullname':this[_0x957e('0x8')],'state':this['state'],'stateTime':this['stateTime'],'status':this[_0x957e('0xb')],'address':this[_0x957e('0xd')],'online':this[_0x957e('0x10')],'voiceStatus':this[_0x957e('0x11')],'voiceStatusTime':this[_0x957e('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x957e('0xf')],'onhold':this['onhold']};var _0x3da2c0=md5(JSON[_0x957e('0x1e')](_0x34e91d));if(this['md5']!==_0x3da2c0){this[_0x957e('0x1')]=_0x3da2c0;io['to'](util[_0x957e('0x1d')](_0x957e('0x1f'),_0x34e91d[_0x957e('0x6')]))[_0x957e('0x20')](_0x957e('0x21'),_0x34e91d);io[_0x957e('0x20')](_0x957e('0x22'),_0x34e91d);}};module[_0x957e('0x23')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 111ae9b..82016c0 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 _0x9e06=['campaign','ivrAnswerCallsDay','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type'];(function(_0x43d6e4,_0x3e4fe1){var _0x4ec1b2=function(_0x35f4b6){while(--_0x35f4b6){_0x43d6e4['push'](_0x43d6e4['shift']());}};_0x4ec1b2(++_0x3e4fe1);}(_0x9e06,0xba));var _0x69e0=function(_0x3e1480,_0x2cc4ee){_0x3e1480=_0x3e1480-0x0;var _0x145412=_0x9e06[_0x3e1480];return _0x145412;};'use strict';function Campaign(_0x5e0260){this['id']=_0x5e0260['id']||0x0;this[_0x69e0('0x0')]=_0x5e0260[_0x69e0('0x0')]||'';this[_0x69e0('0x1')]=_0x5e0260['type']||_0x69e0('0x2');this['originated']=0x0;this['temp']=0x0;this[_0x69e0('0x3')]=0x0;this['ivrTotalCallsDays']=0x0;this['message']='';this[_0x69e0('0x4')]=!![];this['active']=_0x5e0260['active'];this[_0x69e0('0x5')]=_0x5e0260[_0x69e0('0x5')];this[_0x69e0('0x6')]=_0x5e0260[_0x69e0('0x6')]||null;this[_0x69e0('0x7')]=_0x5e0260['dialGlobalInterval']?_0x5e0260[_0x69e0('0x7')]:null;this[_0x69e0('0x8')]=_0x5e0260[_0x69e0('0x8')];this[_0x69e0('0x9')]=_0x5e0260[_0x69e0('0x9')];this[_0x69e0('0xa')]=_0x5e0260['dialOriginateTimeout']||0x1e;this[_0x69e0('0xb')]=_0x5e0260[_0x69e0('0xb')];this[_0x69e0('0xc')]=_0x5e0260[_0x69e0('0xc')];this['dialBusyMaxRetry']=_0x5e0260[_0x69e0('0xd')];this[_0x69e0('0xe')]=_0x5e0260[_0x69e0('0xe')];this['dialNoAnswerMaxRetry']=_0x5e0260[_0x69e0('0xf')];this[_0x69e0('0x10')]=_0x5e0260[_0x69e0('0x10')];this['dialGlobalMaxRetry']=_0x5e0260[_0x69e0('0x11')];this[_0x69e0('0x12')]=_0x5e0260[_0x69e0('0x12')]||0x3;this[_0x69e0('0x13')]=_0x5e0260[_0x69e0('0x13')]||0x96;this[_0x69e0('0x14')]=_0x5e0260[_0x69e0('0x14')]||0x3;this['dialDropRetryFrequency']=_0x5e0260[_0x69e0('0x15')]||0x96;this[_0x69e0('0x16')]=_0x5e0260['dialAbandonedMaxRetry']||0x3;this[_0x69e0('0x17')]=_0x5e0260['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x5e0260[_0x69e0('0x18')]||0x3;this[_0x69e0('0x19')]=_0x5e0260[_0x69e0('0x19')]||0x96;this[_0x69e0('0x1a')]=_0x5e0260['dialAgentRejectMaxRetry']||0x3;this[_0x69e0('0x1b')]=_0x5e0260[_0x69e0('0x1b')]||0x96;this['dialOrderByScheduledAt']=_0x5e0260[_0x69e0('0x1c')]||_0x69e0('0x1d');this[_0x69e0('0x1e')]=_0x5e0260[_0x69e0('0x1e')]||undefined;this[_0x69e0('0x1f')]=_0x5e0260['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x69e0('0x20')]=_0x5e0260[_0x69e0('0x20')]||undefined;this[_0x69e0('0x21')]=_0x5e0260[_0x69e0('0x21')]?_0x5e0260[_0x69e0('0x21')]:undefined;this[_0x69e0('0x22')]=_0x5e0260[_0x69e0('0x22')]?_0x5e0260['Trunk']:undefined;this['Interval']=_0x5e0260[_0x69e0('0x23')]?_0x5e0260['Interval']:undefined;this[_0x69e0('0x24')]=_0x5e0260['SquareProject']?_0x5e0260[_0x69e0('0x24')]:undefined;this[_0x69e0('0x25')]=_0x5e0260[_0x69e0('0x24')]?_0x5e0260[_0x69e0('0x24')][_0x69e0('0x0')]:undefined;this['dialAMDActive']=_0x5e0260[_0x69e0('0x26')]||![];this[_0x69e0('0x27')]=_0x5e0260[_0x69e0('0x27')];this['dialAMDGreeting']=_0x5e0260[_0x69e0('0x28')];this['dialAMDAfterGreetingSilence']=_0x5e0260['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x5e0260[_0x69e0('0x29')];this[_0x69e0('0x2a')]=_0x5e0260[_0x69e0('0x2a')];this[_0x69e0('0x2b')]=_0x5e0260[_0x69e0('0x2b')];this[_0x69e0('0x2c')]=_0x5e0260[_0x69e0('0x2c')];this['dialAMDSilenceThreshold']=_0x5e0260[_0x69e0('0x2d')];this[_0x69e0('0x2e')]=_0x5e0260[_0x69e0('0x2e')];}module['exports']=Campaign; \ No newline at end of file +var _0x03ef=['dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','sendMessageOneNotActive','active','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry'];(function(_0xe092da,_0x4a4554){var _0x3d0471=function(_0x48482c){while(--_0x48482c){_0xe092da['push'](_0xe092da['shift']());}};_0x3d0471(++_0x4a4554);}(_0x03ef,0x1b6));var _0xf03e=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x03ef[_0x53ccf2];return _0x5a2964;};'use strict';function Campaign(_0x533c98){this['id']=_0x533c98['id']||0x0;this[_0xf03e('0x0')]=_0x533c98[_0xf03e('0x0')]||'';this[_0xf03e('0x1')]=_0x533c98[_0xf03e('0x1')]||'campaign';this[_0xf03e('0x2')]=0x0;this['temp']=0x0;this[_0xf03e('0x3')]=0x0;this[_0xf03e('0x4')]=0x0;this['message']='';this[_0xf03e('0x5')]=!![];this[_0xf03e('0x6')]=_0x533c98[_0xf03e('0x6')];this['limitCalls']=_0x533c98['limitCalls'];this[_0xf03e('0x7')]=_0x533c98[_0xf03e('0x7')]||null;this[_0xf03e('0x8')]=_0x533c98['dialGlobalInterval']?_0x533c98['dialGlobalInterval']:null;this[_0xf03e('0x9')]=_0x533c98[_0xf03e('0x9')];this['dialOriginateCallerIdNumber']=_0x533c98['dialOriginateCallerIdNumber'];this[_0xf03e('0xa')]=_0x533c98[_0xf03e('0xa')]||0x1e;this[_0xf03e('0xb')]=_0x533c98[_0xf03e('0xb')];this['dialCongestionRetryFrequency']=_0x533c98['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x533c98[_0xf03e('0xc')];this[_0xf03e('0xd')]=_0x533c98['dialBusyRetryFrequency'];this[_0xf03e('0xe')]=_0x533c98['dialNoAnswerMaxRetry'];this['dialNoAnswerRetryFrequency']=_0x533c98['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x533c98[_0xf03e('0xf')];this['dialNoSuchNumberMaxRetry']=_0x533c98[_0xf03e('0x10')]||0x3;this[_0xf03e('0x11')]=_0x533c98['dialNoSuchNumberRetryFrequency']||0x96;this[_0xf03e('0x12')]=_0x533c98[_0xf03e('0x12')]||0x3;this[_0xf03e('0x13')]=_0x533c98[_0xf03e('0x13')]||0x96;this[_0xf03e('0x14')]=_0x533c98[_0xf03e('0x14')]||0x3;this[_0xf03e('0x15')]=_0x533c98[_0xf03e('0x15')]||0x96;this[_0xf03e('0x16')]=_0x533c98[_0xf03e('0x16')]||0x3;this[_0xf03e('0x17')]=_0x533c98['dialMachineRetryFrequency']||0x96;this[_0xf03e('0x18')]=_0x533c98[_0xf03e('0x18')]||0x3;this[_0xf03e('0x19')]=_0x533c98[_0xf03e('0x19')]||0x96;this[_0xf03e('0x1a')]=_0x533c98[_0xf03e('0x1a')]||'DESC';this['dialPrefix']=_0x533c98[_0xf03e('0x1b')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x533c98[_0xf03e('0x1c')]||undefined;this['dialCutDigit']=_0x533c98['dialCutDigit']||undefined;this[_0xf03e('0x1d')]=_0x533c98[_0xf03e('0x1d')]?_0x533c98[_0xf03e('0x1d')]:undefined;this[_0xf03e('0x1e')]=_0x533c98[_0xf03e('0x1e')]?_0x533c98['Trunk']:undefined;this[_0xf03e('0x1f')]=_0x533c98[_0xf03e('0x1f')]?_0x533c98['Interval']:undefined;this[_0xf03e('0x20')]=_0x533c98[_0xf03e('0x20')]?_0x533c98['SquareProject']:undefined;this[_0xf03e('0x21')]=_0x533c98['SquareProject']?_0x533c98[_0xf03e('0x20')][_0xf03e('0x0')]:undefined;this[_0xf03e('0x22')]=_0x533c98['dialAMDActive']||![];this[_0xf03e('0x23')]=_0x533c98[_0xf03e('0x23')];this['dialAMDGreeting']=_0x533c98[_0xf03e('0x24')];this[_0xf03e('0x25')]=_0x533c98[_0xf03e('0x25')];this['dialAMDTotalAnalysisTime']=_0x533c98[_0xf03e('0x26')];this[_0xf03e('0x27')]=_0x533c98[_0xf03e('0x27')];this['dialAMDBetweenWordsSilence']=_0x533c98[_0xf03e('0x28')];this['dialAMDMaximumNumberOfWords']=_0x533c98[_0xf03e('0x29')];this[_0xf03e('0x2a')]=_0x533c98[_0xf03e('0x2a')];this[_0xf03e('0x2b')]=_0x533c98[_0xf03e('0x2b')];}module[_0xf03e('0x2c')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 8eb74ab..64e2372 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 _0x8d5e=['monitorFilename','queue','transfercalleridnum','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','context','uniqueid','linkedid','exten','endtime','unmanaged','lastapplication','lastdata','duration','billableseconds','type','tag'];(function(_0x38bb8f,_0x221f21){var _0x1ded6c=function(_0x2b211b){while(--_0x2b211b){_0x38bb8f['push'](_0x38bb8f['shift']());}};_0x1ded6c(++_0x221f21);}(_0x8d5e,0xf6));var _0xe8d5=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x8d5e[_0x40ac5e];return _0x2839d6;};'use strict';function Channel(){this[_0xe8d5('0x0')]=null;this[_0xe8d5('0x1')]='';this[_0xe8d5('0x2')]='';this[_0xe8d5('0x3')]=0x0;this[_0xe8d5('0x4')]='';this[_0xe8d5('0x5')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0xe8d5('0x6')]='';this[_0xe8d5('0x7')]=0x0;this[_0xe8d5('0x8')]=0x0;this[_0xe8d5('0x9')]=0x0;this['answered']=![];this['answertime']=null;this[_0xe8d5('0xa')]=null;this[_0xe8d5('0xb')]=![];this['abandoned']=![];this[_0xe8d5('0xc')]='';this[_0xe8d5('0xd')]='';this[_0xe8d5('0xe')]=0x0;this[_0xe8d5('0xf')]=0x0;this['holdtime']=0x0;this[_0xe8d5('0x10')]=null;this[_0xe8d5('0x11')]=null;this['disposition']=null;this['monitor']=![];this[_0xe8d5('0x12')]=null;this[_0xe8d5('0x13')]=null;this['monitors']=[];this[_0xe8d5('0x14')]=undefined;this['transferconnectedlinenum']=undefined;this['transferType']=undefined;this['mohtime']=0x0;}module[_0xe8d5('0x15')]=Channel; \ No newline at end of file +var _0xd7cf=['billableseconds','holdtime','tag','disposition','monitor','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','exports','destinationchannel','calleridnum','connectedlinenum','connectedlinename','uniqueid','linkedid','exten','answered','endtime','unmanaged','abandoned','lastapplication','duration'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x4e6cbb,_0x3450f0){_0x4e6cbb=_0x4e6cbb-0x0;var _0x15ced4=_0xd7cf[_0x4e6cbb];return _0x15ced4;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xfd7c('0x0')]='';this[_0xfd7c('0x1')]=0x0;this['calleridname']='';this[_0xfd7c('0x2')]=undefined;this[_0xfd7c('0x3')]=undefined;this['accountcode']=0x0;this['context']='';this[_0xfd7c('0x4')]=0x0;this[_0xfd7c('0x5')]=0x0;this[_0xfd7c('0x6')]=0x0;this[_0xfd7c('0x7')]=![];this['answertime']=null;this[_0xfd7c('0x8')]=null;this[_0xfd7c('0x9')]=![];this[_0xfd7c('0xa')]=![];this[_0xfd7c('0xb')]='';this['lastdata']='';this[_0xfd7c('0xc')]=0x0;this[_0xfd7c('0xd')]=0x0;this[_0xfd7c('0xe')]=0x0;this['type']=null;this[_0xfd7c('0xf')]=null;this[_0xfd7c('0x10')]=null;this[_0xfd7c('0x11')]=![];this['monitorFilename']=null;this[_0xfd7c('0x12')]=null;this[_0xfd7c('0x13')]=[];this[_0xfd7c('0x14')]=undefined;this[_0xfd7c('0x15')]=undefined;this[_0xfd7c('0x16')]=undefined;this['mohtime']=0x0;}module[_0xfd7c('0x17')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 505f8e3..97c1fef 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 _0xa422=['authType','password','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x422562,_0x5df39d){var _0x23081b=function(_0x388e18){while(--_0x388e18){_0x422562['push'](_0x422562['shift']());}};_0x23081b(++_0x5df39d);}(_0xa422,0xce));var _0x2a42=function(_0x1a3bec,_0x55c176){_0x1a3bec=_0x1a3bec-0x0;var _0x2bf55d=_0xa422[_0x1a3bec];return _0x2bf55d;};'use strict';function DeskAccount(_0x384579){this['id']=_0x384579['id']||0x0;this[_0x2a42('0x0')]=_0x384579[_0x2a42('0x0')]||'';this[_0x2a42('0x1')]=_0x384579[_0x2a42('0x1')]||'';this['remoteUri']=_0x384579[_0x2a42('0x2')]||'';this['authType']=_0x384579[_0x2a42('0x3')]||'';this['password']=_0x384579[_0x2a42('0x4')]||'';this['consumerKey']=_0x384579['consumerKey']||'';this['consumerSecret']=_0x384579[_0x2a42('0x5')]||'';this[_0x2a42('0x6')]=_0x384579[_0x2a42('0x6')]||'';this['tokenSecret']=_0x384579[_0x2a42('0x7')]||'';this[_0x2a42('0x8')]=_0x384579[_0x2a42('0x8')]||'';this[_0x2a42('0x9')]=_0x384579[_0x2a42('0x9')]||'';this[_0x2a42('0xa')]=_0x384579['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file +var _0x04ab=['type','Configurations','name','username','remoteUri','authType','password','consumerKey','token','tokenSecret'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x04ab,0xde));var _0xb04a=function(_0x576b0d,_0x55cd66){_0x576b0d=_0x576b0d-0x0;var _0x4fd59f=_0x04ab[_0x576b0d];return _0x4fd59f;};'use strict';function DeskAccount(_0x23ee86){this['id']=_0x23ee86['id']||0x0;this[_0xb04a('0x0')]=_0x23ee86[_0xb04a('0x0')]||'';this[_0xb04a('0x1')]=_0x23ee86[_0xb04a('0x1')]||'';this[_0xb04a('0x2')]=_0x23ee86[_0xb04a('0x2')]||'';this['authType']=_0x23ee86[_0xb04a('0x3')]||'';this[_0xb04a('0x4')]=_0x23ee86['password']||'';this[_0xb04a('0x5')]=_0x23ee86['consumerKey']||'';this['consumerSecret']=_0x23ee86['consumerSecret']||'';this[_0xb04a('0x6')]=_0x23ee86[_0xb04a('0x6')]||'';this[_0xb04a('0x7')]=_0x23ee86[_0xb04a('0x7')]||'';this[_0xb04a('0x8')]=_0x23ee86[_0xb04a('0x8')]||'';this['serverUrl']=_0x23ee86['serverUrl']||'';this[_0xb04a('0x9')]=_0x23ee86['Configurations']||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index dafe95a..552ebf7 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 _0x297a=['password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','exports','name','username'];(function(_0x25f938,_0x3a2507){var _0xc56da=function(_0x5bae79){while(--_0x5bae79){_0x25f938['push'](_0x25f938['shift']());}};_0xc56da(++_0x3a2507);}(_0x297a,0xfb));var _0xa297=function(_0x3a9876,_0x1ad0d2){_0x3a9876=_0x3a9876-0x0;var _0x544b5a=_0x297a[_0x3a9876];return _0x544b5a;};'use strict';function Dynamics365Account(_0x12af37){this['id']=_0x12af37['id']||0x0;this[_0xa297('0x0')]=_0x12af37[_0xa297('0x0')]||'';this[_0xa297('0x1')]=_0x12af37['username']||'';this[_0xa297('0x2')]=_0x12af37[_0xa297('0x2')]||'';this[_0xa297('0x3')]=_0x12af37[_0xa297('0x3')]||'';this['tenantId']=_0x12af37[_0xa297('0x4')]||'';this[_0xa297('0x5')]=_0x12af37[_0xa297('0x5')]||'';this[_0xa297('0x6')]=_0x12af37[_0xa297('0x6')]||{};this[_0xa297('0x7')]=_0x12af37[_0xa297('0x7')]||'';this[_0xa297('0x8')]=_0x12af37['modernAuthentication']||![];this[_0xa297('0x9')]=_0x12af37[_0xa297('0x9')]||{};this['CloudProvider']=_0x12af37['CloudProvider']||{};}module[_0xa297('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x0458=['Configurations','CloudProvider','exports','name','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x4f022e,_0x3cdd67){var _0x188f51=function(_0x5470fb){while(--_0x5470fb){_0x4f022e['push'](_0x4f022e['shift']());}};_0x188f51(++_0x3cdd67);}(_0x0458,0x184));var _0x8045=function(_0x1d7f34,_0x43f4b0){_0x1d7f34=_0x1d7f34-0x0;var _0x5e8d18=_0x0458[_0x1d7f34];return _0x5e8d18;};'use strict';function Dynamics365Account(_0x53c99c){this['id']=_0x53c99c['id']||0x0;this['name']=_0x53c99c[_0x8045('0x0')]||'';this['username']=_0x53c99c['username']||'';this[_0x8045('0x1')]=_0x53c99c[_0x8045('0x1')]||'';this[_0x8045('0x2')]=_0x53c99c[_0x8045('0x2')]||'';this[_0x8045('0x3')]=_0x53c99c[_0x8045('0x3')]||'';this['clientId']=_0x53c99c[_0x8045('0x4')]||'';this[_0x8045('0x5')]=_0x53c99c[_0x8045('0x5')]||{};this[_0x8045('0x6')]=_0x53c99c['serverUrl']||'';this['modernAuthentication']=_0x53c99c[_0x8045('0x7')]||![];this[_0x8045('0x8')]=_0x53c99c['Configurations']||{};this[_0x8045('0x9')]=_0x53c99c[_0x8045('0x9')]||{};}module[_0x8045('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0429ba0..8023471 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 _0x467b=['t38timeout','tech','Trunk','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x467b,0x65));var _0xb467=function(_0x22ad8d,_0x4a1eb2){_0x22ad8d=_0x22ad8d-0x0;var _0x2d865f=_0x467b[_0x22ad8d];return _0x2d865f;};'use strict';function FaxAccount(_0x11c06f){this['id']=_0x11c06f['id']||0x0;this[_0xb467('0x0')]=_0x11c06f[_0xb467('0x0')]||'';this[_0xb467('0x1')]=_0x11c06f[_0xb467('0x1')];this[_0xb467('0x2')]=_0x11c06f[_0xb467('0x2')];this[_0xb467('0x3')]=_0x11c06f['headerinfo'];this['localstationid']=_0x11c06f[_0xb467('0x4')];this[_0xb467('0x5')]=_0x11c06f[_0xb467('0x5')]||0x960;this[_0xb467('0x6')]=_0x11c06f['maxrate']||0x3840;this[_0xb467('0x7')]=_0x11c06f[_0xb467('0x7')]||_0xb467('0x8');this[_0xb467('0x9')]=_0x11c06f['gateway']||'no';this[_0xb467('0xa')]=_0x11c06f['faxdetect']||'no';this[_0xb467('0xb')]=_0x11c06f[_0xb467('0xb')]||0x1388;this[_0xb467('0xc')]=_0x11c06f['tech']||'SIP';this[_0xb467('0xd')]=_0x11c06f[_0xb467('0xd')]?_0x11c06f[_0xb467('0xd')]:undefined;this['ListId']=_0x11c06f['ListId'];this[_0xb467('0xe')]=_0x11c06f[_0xb467('0xe')];}module[_0xb467('0xf')]=FaxAccount; \ No newline at end of file +var _0x97bd=['tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x663d6f,_0x36a240){var _0x58049c=function(_0x39cbd7){while(--_0x39cbd7){_0x663d6f['push'](_0x663d6f['shift']());}};_0x58049c(++_0x36a240);}(_0x97bd,0x6b));var _0xd97b=function(_0x4e49c5,_0x237b45){_0x4e49c5=_0x4e49c5-0x0;var _0x801e1b=_0x97bd[_0x4e49c5];return _0x801e1b;};'use strict';function FaxAccount(_0x231f8c){this['id']=_0x231f8c['id']||0x0;this[_0xd97b('0x0')]=_0x231f8c[_0xd97b('0x0')]||'';this[_0xd97b('0x1')]=_0x231f8c[_0xd97b('0x1')];this['ecm']=_0x231f8c[_0xd97b('0x2')];this['headerinfo']=_0x231f8c[_0xd97b('0x3')];this[_0xd97b('0x4')]=_0x231f8c[_0xd97b('0x4')];this[_0xd97b('0x5')]=_0x231f8c['minrate']||0x960;this[_0xd97b('0x6')]=_0x231f8c[_0xd97b('0x6')]||0x3840;this[_0xd97b('0x7')]=_0x231f8c['modem']||_0xd97b('0x8');this[_0xd97b('0x9')]=_0x231f8c[_0xd97b('0x9')]||'no';this[_0xd97b('0xa')]=_0x231f8c[_0xd97b('0xa')]||'no';this[_0xd97b('0xb')]=_0x231f8c[_0xd97b('0xb')]||0x1388;this[_0xd97b('0xc')]=_0x231f8c[_0xd97b('0xc')]||'SIP';this[_0xd97b('0xd')]=_0x231f8c[_0xd97b('0xd')]?_0x231f8c[_0xd97b('0xd')]:undefined;this[_0xd97b('0xe')]=_0x231f8c['ListId'];this[_0xd97b('0xf')]=_0x231f8c[_0xd97b('0xf')];}module[_0xd97b('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 806eda3..cc040ff 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 _0x6b83=['serverUrl','Configurations','name','apiKey','remoteUri'];(function(_0x10b317,_0x2adf32){var _0x1e3054=function(_0x38ed3e){while(--_0x38ed3e){_0x10b317['push'](_0x10b317['shift']());}};_0x1e3054(++_0x2adf32);}(_0x6b83,0x10b));var _0x36b8=function(_0x444975,_0x44aaf0){_0x444975=_0x444975-0x0;var _0x45cc12=_0x6b83[_0x444975];return _0x45cc12;};'use strict';function FreshdeskAccount(_0x4eb682){this['id']=_0x4eb682['id']||0x0;this[_0x36b8('0x0')]=_0x4eb682[_0x36b8('0x0')]||'';this['username']=_0x4eb682['username']||'';this[_0x36b8('0x1')]=_0x4eb682['token']||'';this['remoteUri']=_0x4eb682[_0x36b8('0x2')]||'';this[_0x36b8('0x3')]=_0x4eb682[_0x36b8('0x3')]||'';this[_0x36b8('0x4')]=_0x4eb682[_0x36b8('0x4')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0x4a1b=['serverUrl','name','username','token','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a1b,0xb0));var _0xb4a1=function(_0x5954d2,_0x15db93){_0x5954d2=_0x5954d2-0x0;var _0x316928=_0x4a1b[_0x5954d2];return _0x316928;};'use strict';function FreshdeskAccount(_0x189017){this['id']=_0x189017['id']||0x0;this[_0xb4a1('0x0')]=_0x189017[_0xb4a1('0x0')]||'';this[_0xb4a1('0x1')]=_0x189017[_0xb4a1('0x1')]||'';this['apiKey']=_0x189017[_0xb4a1('0x2')]||'';this[_0xb4a1('0x3')]=_0x189017[_0xb4a1('0x3')]||'';this['serverUrl']=_0x189017[_0xb4a1('0x4')]||'';this['Configurations']=_0x189017['Configurations']||{};}module['exports']=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 48d45b3..75ae988 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 _0xc906=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x19c9e8,_0x186e72){var _0x4cf0fb=function(_0x56eb8b){while(--_0x56eb8b){_0x19c9e8['push'](_0x19c9e8['shift']());}};_0x4cf0fb(++_0x186e72);}(_0xc906,0x1ad));var _0x6c90=function(_0x1d7da2,_0x2135b3){_0x1d7da2=_0x1d7da2-0x0;var _0x270e24=_0xc906[_0x1d7da2];return _0x270e24;};'use strict';function FreshsalesAccount(_0x1b05cc){this['id']=_0x1b05cc['id']||0x0;this[_0x6c90('0x0')]=_0x1b05cc['name']||'';this[_0x6c90('0x1')]=_0x1b05cc[_0x6c90('0x1')]||'';this[_0x6c90('0x2')]=_0x1b05cc['token']||'';this[_0x6c90('0x3')]=_0x1b05cc[_0x6c90('0x3')]||'';this[_0x6c90('0x4')]=_0x1b05cc[_0x6c90('0x4')]||'';this[_0x6c90('0x5')]=_0x1b05cc[_0x6c90('0x5')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file +var _0xff16=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x31abee,_0x11ff0c){var _0x3c1761=function(_0x2b5062){while(--_0x2b5062){_0x31abee['push'](_0x31abee['shift']());}};_0x3c1761(++_0x11ff0c);}(_0xff16,0x7f));var _0x6ff1=function(_0x663dae,_0x1e49e3){_0x663dae=_0x663dae-0x0;var _0x2efdc3=_0xff16[_0x663dae];return _0x2efdc3;};'use strict';function FreshsalesAccount(_0x393ef9){this['id']=_0x393ef9['id']||0x0;this[_0x6ff1('0x0')]=_0x393ef9['name']||'';this[_0x6ff1('0x1')]=_0x393ef9[_0x6ff1('0x1')]||'';this[_0x6ff1('0x2')]=_0x393ef9[_0x6ff1('0x3')]||'';this[_0x6ff1('0x4')]=_0x393ef9[_0x6ff1('0x4')]||'';this[_0x6ff1('0x5')]=_0x393ef9[_0x6ff1('0x5')]||'';this['Configurations']=_0x393ef9[_0x6ff1('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5d6a3cf..9dd8585 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 _0xddca=['queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','variables','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon'];(function(_0x59b54e,_0x1bdf5d){var _0x1ff25f=function(_0x3a1db9){while(--_0x3a1db9){_0x59b54e['push'](_0x59b54e['shift']());}};_0x1ff25f(++_0x1bdf5d);}(_0xddca,0x98));var _0xaddc=function(_0x4d2c7e,_0x5df3bc){_0x4d2c7e=_0x4d2c7e-0x0;var _0x1f837f=_0xddca[_0x4d2c7e];return _0x1f837f;};'use strict';function QueueReport(){this[_0xaddc('0x0')]=_0xaddc('0x1');this['uniqueid']='';this[_0xaddc('0x2')]='';this[_0xaddc('0x3')]='';this[_0xaddc('0x4')]='';this[_0xaddc('0x5')]=null;this[_0xaddc('0x6')]=null;this[_0xaddc('0x7')]=0x1;this[_0xaddc('0x8')]=0x1;this[_0xaddc('0x9')]=![];this['queuecallerabandonAt']=null;this[_0xaddc('0xa')]=![];this[_0xaddc('0xb')]=null;this['queuecallerexit']=![];this[_0xaddc('0xc')]=null;this['originalposition']=0x1;this[_0xaddc('0xd')]='';this[_0xaddc('0xe')]='';this[_0xaddc('0xf')]='';this[_0xaddc('0x10')]='';this[_0xaddc('0x11')]='';this[_0xaddc('0x12')]='';this[_0xaddc('0x13')]='';this[_0xaddc('0x14')]=0x0;this[_0xaddc('0x15')]=![];this[_0xaddc('0x16')]='';this[_0xaddc('0x17')]=_0xaddc('0x18');this[_0xaddc('0x19')]=null;this['mohtime']=0x0;this[_0xaddc('0x1a')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0x776c=['variables','type','calleridnum','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinename','accountcode','context','priority','lastAssignedTo','motionChannel','voice','mohtime'];(function(_0x4ac650,_0x1e112f){var _0x2e67a4=function(_0x3d937a){while(--_0x3d937a){_0x4ac650['push'](_0x4ac650['shift']());}};_0x2e67a4(++_0x1e112f);}(_0x776c,0x85));var _0xc776=function(_0x1be734,_0x355e0f){_0x1be734=_0x1be734-0x0;var _0x52ac30=_0x776c[_0x1be734];return _0x52ac30;};'use strict';function QueueReport(){this[_0xc776('0x0')]='inbound';this['uniqueid']='';this[_0xc776('0x1')]='';this['calleridname']='';this[_0xc776('0x2')]='';this[_0xc776('0x3')]=null;this[_0xc776('0x4')]=null;this[_0xc776('0x5')]=0x1;this[_0xc776('0x6')]=0x1;this[_0xc776('0x7')]=![];this['queuecallerabandonAt']=null;this[_0xc776('0x8')]=![];this[_0xc776('0x9')]=null;this[_0xc776('0xa')]=![];this[_0xc776('0xb')]=null;this[_0xc776('0xc')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xc776('0xd')]='';this[_0xc776('0xe')]='';this[_0xc776('0xf')]='';this['exten']='';this[_0xc776('0x10')]='';this['holdtime']=0x0;this['assigned']=![];this[_0xc776('0x11')]='';this[_0xc776('0x12')]=_0xc776('0x13');this['routealias']=null;this[_0xc776('0x14')]=0x0;this[_0xc776('0x15')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 8b8dd58..4d308d6 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 _0xaf62=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0xbbd04,_0x4e535f){var _0x4ef8b6=function(_0x4a78ab){while(--_0x4a78ab){_0xbbd04['push'](_0xbbd04['shift']());}};_0x4ef8b6(++_0x4e535f);}(_0xaf62,0x174));var _0x2af6=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xaf62[_0xbca1b1];return _0x4e1686;};'use strict';function SalesforceAccount(_0x51dadc){this['id']=_0x51dadc['id']||0x0;this[_0x2af6('0x0')]=_0x51dadc[_0x2af6('0x0')]||'';this[_0x2af6('0x1')]=_0x51dadc['username']||'';this[_0x2af6('0x2')]=_0x51dadc[_0x2af6('0x2')]||'';this[_0x2af6('0x3')]=_0x51dadc[_0x2af6('0x3')]||'';this[_0x2af6('0x4')]=_0x51dadc['clientId']||'';this[_0x2af6('0x5')]=_0x51dadc[_0x2af6('0x5')]||'';this[_0x2af6('0x6')]=_0x51dadc[_0x2af6('0x6')]||'';this['type']=_0x51dadc[_0x2af6('0x7')]||_0x2af6('0x8');this[_0x2af6('0x9')]=_0x51dadc[_0x2af6('0x9')]||'';this[_0x2af6('0xa')]=_0x51dadc[_0x2af6('0xa')]||{};}module[_0x2af6('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x1d65=['remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username'];(function(_0x355535,_0x1e2607){var _0x2a4242=function(_0x3165b5){while(--_0x3165b5){_0x355535['push'](_0x355535['shift']());}};_0x2a4242(++_0x1e2607);}(_0x1d65,0x1d7));var _0x51d6=function(_0x319d27,_0x11d391){_0x319d27=_0x319d27-0x0;var _0x33f484=_0x1d65[_0x319d27];return _0x33f484;};'use strict';function SalesforceAccount(_0x4f90ac){this['id']=_0x4f90ac['id']||0x0;this[_0x51d6('0x0')]=_0x4f90ac[_0x51d6('0x0')]||'';this['username']=_0x4f90ac[_0x51d6('0x1')]||'';this[_0x51d6('0x2')]=_0x4f90ac['remoteUri']||'';this['password']=_0x4f90ac[_0x51d6('0x3')]||'';this['clientId']=_0x4f90ac[_0x51d6('0x4')]||'';this['clientSecret']=_0x4f90ac[_0x51d6('0x5')]||'';this[_0x51d6('0x6')]=_0x4f90ac[_0x51d6('0x6')]||'';this[_0x51d6('0x7')]=_0x4f90ac['type']||'integrationTab';this[_0x51d6('0x8')]=_0x4f90ac[_0x51d6('0x8')]||'';this[_0x51d6('0x9')]=_0x4f90ac[_0x51d6('0x9')]||{};}module[_0x51d6('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 ae3cd45..f792c89 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 _0x2555=['serverUrl','Configurations','name','username','password','remoteUri'];(function(_0x2379d9,_0x146e8e){var _0x4413f8=function(_0x4ceee7){while(--_0x4ceee7){_0x2379d9['push'](_0x2379d9['shift']());}};_0x4413f8(++_0x146e8e);}(_0x2555,0x8c));var _0x5255=function(_0x24a20c,_0x45e577){_0x24a20c=_0x24a20c-0x0;var _0x3c6807=_0x2555[_0x24a20c];return _0x3c6807;};'use strict';function ServicenowAccount(_0x387121){this['id']=_0x387121['id']||0x0;this[_0x5255('0x0')]=_0x387121[_0x5255('0x0')]||'';this[_0x5255('0x1')]=_0x387121[_0x5255('0x1')]||'';this[_0x5255('0x2')]=_0x387121[_0x5255('0x2')]||'';this[_0x5255('0x3')]=_0x387121[_0x5255('0x3')]||'';this[_0x5255('0x4')]=_0x387121['serverUrl']||'';this[_0x5255('0x5')]=_0x387121['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x958f=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x3b26fb,_0x22f314){var _0x3c0e65=function(_0x2e9a76){while(--_0x2e9a76){_0x3b26fb['push'](_0x3b26fb['shift']());}};_0x3c0e65(++_0x22f314);}(_0x958f,0xba));var _0xf958=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x958f[_0x40a045];return _0x1a687c;};'use strict';function ServicenowAccount(_0x5d45ba){this['id']=_0x5d45ba['id']||0x0;this[_0xf958('0x0')]=_0x5d45ba['name']||'';this[_0xf958('0x1')]=_0x5d45ba[_0xf958('0x1')]||'';this[_0xf958('0x2')]=_0x5d45ba[_0xf958('0x2')]||'';this[_0xf958('0x3')]=_0x5d45ba[_0xf958('0x3')]||'';this[_0xf958('0x4')]=_0x5d45ba[_0xf958('0x4')]||'';this['Configurations']=_0x5d45ba[_0xf958('0x5')]||{};}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 25b2371..e7e9ffb 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 _0x5319=['name','username','password','Configurations','exports'];(function(_0x52a292,_0x382c0c){var _0x422ea4=function(_0x303df4){while(--_0x303df4){_0x52a292['push'](_0x52a292['shift']());}};_0x422ea4(++_0x382c0c);}(_0x5319,0x1d1));var _0x9531=function(_0x537501,_0x1509e4){_0x537501=_0x537501-0x0;var _0x54bfc2=_0x5319[_0x537501];return _0x54bfc2;};'use strict';function SugarcrmAccount(_0x2012a0){this['id']=_0x2012a0['id']||0x0;this['name']=_0x2012a0[_0x9531('0x0')]||'';this['username']=_0x2012a0[_0x9531('0x1')]||'';this[_0x9531('0x2')]=_0x2012a0['password']||'';this['remoteUri']=_0x2012a0['remoteUri']||'';this['serverUrl']=_0x2012a0['serverUrl']||'';this[_0x9531('0x3')]=_0x2012a0[_0x9531('0x3')]||{};}module[_0x9531('0x4')]=SugarcrmAccount; \ No newline at end of file +var _0xb130=['name','username','password','serverUrl','Configurations','exports'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xb130,0x1ec));var _0x0b13=function(_0xd13171,_0xc54453){_0xd13171=_0xd13171-0x0;var _0x452bd0=_0xb130[_0xd13171];return _0x452bd0;};'use strict';function SugarcrmAccount(_0x1cc659){this['id']=_0x1cc659['id']||0x0;this[_0x0b13('0x0')]=_0x1cc659[_0x0b13('0x0')]||'';this[_0x0b13('0x1')]=_0x1cc659['username']||'';this[_0x0b13('0x2')]=_0x1cc659[_0x0b13('0x2')]||'';this['remoteUri']=_0x1cc659['remoteUri']||'';this[_0x0b13('0x3')]=_0x1cc659['serverUrl']||'';this['Configurations']=_0x1cc659[_0x0b13('0x4')]||{};}module[_0x0b13('0x5')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index ac6b2cd..aba081d 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 _0xf3d9=['name','accountcode','unknown','stateTime','status','address'];(function(_0x375933,_0x1bc01f){var _0x149ed1=function(_0x3bd409){while(--_0x3bd409){_0x375933['push'](_0x375933['shift']());}};_0x149ed1(++_0x1bc01f);}(_0xf3d9,0x162));var _0x9f3d=function(_0x485ca5,_0x401da6){_0x485ca5=_0x485ca5-0x0;var _0x272214=_0xf3d9[_0x485ca5];return _0x272214;};'use strict';function Telephone(_0x51f382){this['id']=_0x51f382['id']||0x0;this['name']=_0x51f382[_0x9f3d('0x0')]||'';this[_0x9f3d('0x1')]=_0x51f382[_0x9f3d('0x1')]||'';this['state']=_0x9f3d('0x2');this[_0x9f3d('0x3')]=0x0;this[_0x9f3d('0x4')]=_0x9f3d('0x2');this[_0x9f3d('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x76c0=['accountcode','state','status','unknown','address','exports','name'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0x76c0,0x84));var _0x076c=function(_0x548322,_0x242772){_0x548322=_0x548322-0x0;var _0xba62db=_0x76c0[_0x548322];return _0xba62db;};'use strict';function Telephone(_0x158b32){this['id']=_0x158b32['id']||0x0;this[_0x076c('0x0')]=_0x158b32[_0x076c('0x0')]||'';this[_0x076c('0x1')]=_0x158b32[_0x076c('0x1')]||'';this[_0x076c('0x2')]='unknown';this['stateTime']=0x0;this[_0x076c('0x3')]=_0x076c('0x4');this[_0x076c('0x5')]='';}module[_0x076c('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a3da4fc..7fb96f9 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(_0x4531eb,_0x3de363){var _0x15546a=function(_0x27e4ce){while(--_0x27e4ce){_0x4531eb['push'](_0x4531eb['shift']());}};_0x15546a(++_0x3de363);}(_0xb10b,0x12a));var _0xbb10=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0xb10b[_0x1800cb];return _0x3b5e95;};'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 _0xb10b=['name','html'];(function(_0x776c78,_0x18909c){var _0x57089b=function(_0x43712e){while(--_0x43712e){_0x776c78['push'](_0x776c78['shift']());}};_0x57089b(++_0x18909c);}(_0xb10b,0x12a));var _0xbb10=function(_0x518cc0,_0x4e38ab){_0x518cc0=_0x518cc0-0x0;var _0x281183=_0xb10b[_0x518cc0];return _0x281183;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index b945e02..7fbdb71 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['Actions','exports','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';function Trigger(_0x61caa9){this['id']=_0x61caa9['id']||0x0;this[_0x0baf('0x0')]=_0x61caa9[_0x0baf('0x0')]||'';this[_0x0baf('0x1')]=_0x61caa9[_0x0baf('0x1')]||_0x0baf('0x2');this[_0x0baf('0x3')]=_0x61caa9['status']||![];this[_0x0baf('0x4')]=_0x61caa9[_0x0baf('0x4')]||[];this[_0x0baf('0x5')]=_0x61caa9[_0x0baf('0x5')]||[];this[_0x0baf('0x6')]=_0x61caa9[_0x0baf('0x6')]||[];}module[_0x0baf('0x7')]=Trigger; \ No newline at end of file +var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x174b55,_0x2991ec){var _0xc0cfa3=function(_0x6499e8){while(--_0x6499e8){_0x174b55['push'](_0x174b55['shift']());}};_0xc0cfa3(++_0x2991ec);}(_0x14a0,0x8e));var _0x014a=function(_0x39a552,_0x367407){_0x39a552=_0x39a552-0x0;var _0x315317=_0x14a0[_0x39a552];return _0x315317;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}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 19ff17d..9ec4b5c 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 _0x599f=['domainport','stateRegistry','registrationtime','address','exports','active','name','state','status','unknown','registry','indexOf','split','host','domain'];(function(_0x25bde3,_0x24b067){var _0x4d8386=function(_0x3b3318){while(--_0x3b3318){_0x25bde3['push'](_0x25bde3['shift']());}};_0x4d8386(++_0x24b067);}(_0x599f,0xb9));var _0xf599=function(_0x5db5f1,_0x3aa07d){_0x5db5f1=_0x5db5f1-0x0;var _0x434fe2=_0x599f[_0x5db5f1];return _0x434fe2;};'use strict';function Trunk(_0x4bee6a){this['id']=_0x4bee6a['id']||0x0;this[_0xf599('0x0')]=_0x4bee6a[_0xf599('0x0')]||![];this['name']=_0x4bee6a[_0xf599('0x1')]||'';this[_0xf599('0x2')]='unknown';this['stateTime']=0x0;this[_0xf599('0x3')]=_0xf599('0x4');this[_0xf599('0x5')]=_0x4bee6a[_0xf599('0x5')]&&_0x4bee6a[_0xf599('0x5')][_0xf599('0x6')](':')?_0x4bee6a[_0xf599('0x5')][_0xf599('0x7')](':')[0x0]:'';this[_0xf599('0x8')]='';this['port']='';this[_0xf599('0x9')]='';this[_0xf599('0xa')]='';this['refresh']='';this[_0xf599('0xb')]='unknown';this[_0xf599('0xc')]='';this[_0xf599('0xd')]='';this['defaultuser']=_0x4bee6a['defaultuser']||'';}module[_0xf599('0xe')]=Trunk; \ No newline at end of file +var _0x5731=['address','defaultuser','exports','active','name','status','unknown','registry','indexOf','split','port','domain','domainport','stateRegistry','registrationtime'];(function(_0x3b832d,_0x3b944d){var _0x15d94d=function(_0x374572){while(--_0x374572){_0x3b832d['push'](_0x3b832d['shift']());}};_0x15d94d(++_0x3b944d);}(_0x5731,0x99));var _0x1573=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5731[_0x3ab51d];return _0x29a04e;};'use strict';function Trunk(_0x1db1b5){this['id']=_0x1db1b5['id']||0x0;this[_0x1573('0x0')]=_0x1db1b5[_0x1573('0x0')]||![];this['name']=_0x1db1b5[_0x1573('0x1')]||'';this['state']='unknown';this['stateTime']=0x0;this[_0x1573('0x2')]=_0x1573('0x3');this[_0x1573('0x4')]=_0x1db1b5[_0x1573('0x4')]&&_0x1db1b5[_0x1573('0x4')][_0x1573('0x5')](':')?_0x1db1b5['registry'][_0x1573('0x6')](':')[0x0]:'';this['host']='';this[_0x1573('0x7')]='';this[_0x1573('0x8')]='';this[_0x1573('0x9')]='';this['refresh']='';this[_0x1573('0xa')]=_0x1573('0x3');this[_0x1573('0xb')]='';this[_0x1573('0xc')]='';this[_0x1573('0xd')]=_0x1db1b5['defaultuser']||'';}module[_0x1573('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 21fe45e..1588058 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 _0xfbb5=['mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x191260,_0x23547d){var _0x4eed07=function(_0x24966c){while(--_0x24966c){_0x191260['push'](_0x191260['shift']());}};_0x4eed07(++_0x23547d);}(_0xfbb5,0x186));var _0x5fbb=function(_0x3586ef,_0x50ad8a){_0x3586ef=_0x3586ef-0x0;var _0x36632e=_0xfbb5[_0x3586ef];return _0x36632e;};'use strict';function voiceExtension(_0x338c7a){this['id']=_0x338c7a['id']||0x0;this[_0x5fbb('0x0')]=_0x338c7a[_0x5fbb('0x0')]||'';this[_0x5fbb('0x1')]=_0x338c7a[_0x5fbb('0x1')]||'none';this[_0x5fbb('0x2')]=_0x338c7a[_0x5fbb('0x2')]||![];}module[_0x5fbb('0x3')]=voiceExtension; \ No newline at end of file +var _0xca75=['recordingFormat','mandatoryDisposition','exports','exten'];(function(_0x4fe155,_0x4b25bb){var _0x5ea118=function(_0x101834){while(--_0x101834){_0x4fe155['push'](_0x4fe155['shift']());}};_0x5ea118(++_0x4b25bb);}(_0xca75,0xc7));var _0x5ca7=function(_0x1034ca,_0x14ecd6){_0x1034ca=_0x1034ca-0x0;var _0x1a023a=_0xca75[_0x1034ca];return _0x1a023a;};'use strict';function voiceExtension(_0x47c342){this['id']=_0x47c342['id']||0x0;this[_0x5ca7('0x0')]=_0x47c342['exten']||'';this[_0x5ca7('0x1')]=_0x47c342['recordingFormat']||'none';this[_0x5ca7('0x2')]=_0x47c342['mandatoryDisposition']||![];}module[_0x5ca7('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index fdd7cf4..12f3d12 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 _0x99c8=['dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','linear','random','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','notInUse','onHold','paused','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords'];(function(_0x273d3d,_0x64e7cd){var _0x1bd201=function(_0x267ecb){while(--_0x267ecb){_0x273d3d['push'](_0x273d3d['shift']());}};_0x1bd201(++_0x64e7cd);}(_0x99c8,0x1a5));var _0x899c=function(_0x385253,_0x84b69d){_0x385253=_0x385253-0x0;var _0x4738cb=_0x99c8[_0x385253];return _0x4738cb;};'use strict';var monitorFormat={'wav':_0x899c('0x0'),'wav49':_0x899c('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':'fewestcalls','leastrecent':'leastrecent','linear':_0x899c('0x2'),'random':_0x899c('0x3'),'ringall':_0x899c('0x4'),'rr':_0x899c('0x5'),'rrmemory':_0x899c('0x6'),'rrordered':_0x899c('0x7'),'wrandom':_0x899c('0x8')};function VoiceQueue(_0x18e8e7){this['id']=_0x18e8e7['id']||0x0;this[_0x899c('0x9')]=_0x18e8e7[_0x899c('0x9')]||'';this[_0x899c('0xa')]=_0x18e8e7[_0x899c('0xa')]||'';this[_0x899c('0xb')]=_0x18e8e7[_0x899c('0xb')]||_0x899c('0xc');this[_0x899c('0xd')]=0x0;this[_0x899c('0xe')]=0x0;this[_0x899c('0xf')]=0x0;this['sumDuration']=0x0;this[_0x899c('0x10')]=0x0;this[_0x899c('0x11')]=0x0;this[_0x899c('0x12')]=0x0;this[_0x899c('0x13')]=0x0;this[_0x899c('0x14')]=0x0;this[_0x899c('0x15')]=0x0;this['inUse']=0x0;this[_0x899c('0x16')]=0x0;this[_0x899c('0x17')]=0x0;this[_0x899c('0x18')]=0x0;this[_0x899c('0x19')]=0x0;this[_0x899c('0x1a')]=0x0;this['ringing']=0x0;this[_0x899c('0x1b')]=0x0;this[_0x899c('0x1c')]=0x0;this['unavailable']=0x0;this[_0x899c('0x1d')]=0x0;this[_0x899c('0x1e')]=_0x18e8e7['acw']||![];this[_0x899c('0x1f')]=_0x18e8e7['acwTimeout']||0xa;this[_0x899c('0x20')]=_0x18e8e7[_0x899c('0x20')]||'no';this[_0x899c('0x21')]=!![];this[_0x899c('0x22')]='';this[_0x899c('0x23')]='';this[_0x899c('0x24')]=0x0;this[_0x899c('0x25')]=0x0;this['dialTimezone']=_0x18e8e7[_0x899c('0x26')]||null;this['dialGlobalInterval']=_0x18e8e7[_0x899c('0x27')]?_0x18e8e7['dialGlobalInterval']:null;this[_0x899c('0x28')]=_0x18e8e7[_0x899c('0x28')];this[_0x899c('0x29')]=_0x18e8e7[_0x899c('0x29')]||'progressive';this[_0x899c('0x2a')]=_0x18e8e7['dialLimitChannel']||0x0;this[_0x899c('0x2b')]=_0x18e8e7[_0x899c('0x2b')]||0x0;this[_0x899c('0x2c')]=_0x18e8e7[_0x899c('0x2c')]||0x1;this['dialPredictiveOptimization']=_0x18e8e7[_0x899c('0x2d')]||_0x899c('0x2e');this[_0x899c('0x2f')]=_0x18e8e7[_0x899c('0x2f')]||0.03;this[_0x899c('0x30')]=_0x18e8e7[_0x899c('0x30')]||0x258;this[_0x899c('0x31')]=_0x18e8e7[_0x899c('0x31')]||_0x899c('0x32');this['dialOriginateCallerIdNumber']=_0x18e8e7['dialOriginateCallerIdNumber']||_0x899c('0x32');this[_0x899c('0x33')]=_0x18e8e7['dialOriginateTimeout']||0x1e;this[_0x899c('0x34')]=_0x18e8e7[_0x899c('0x34')]||'tTxX';this[_0x899c('0x35')]=_0x18e8e7['dialQueueTimeout']||0x3;this[_0x899c('0x36')]=_0x18e8e7[_0x899c('0x36')]||undefined;this[_0x899c('0x37')]=_0x18e8e7[_0x899c('0x37')]||0x3;this['dialCongestionRetryFrequency']=_0x18e8e7['dialCongestionRetryFrequency']||0x96;this['dialBusyMaxRetry']=_0x18e8e7[_0x899c('0x38')]||0x3;this['dialBusyRetryFrequency']=_0x18e8e7[_0x899c('0x39')]||0x96;this['dialNoAnswerMaxRetry']=_0x18e8e7['dialNoAnswerMaxRetry']||0x3;this[_0x899c('0x3a')]=_0x18e8e7[_0x899c('0x3a')]||0x96;this[_0x899c('0x3b')]=_0x18e8e7[_0x899c('0x3b')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x18e8e7['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x18e8e7['dialDropMaxRetry']||0x3;this[_0x899c('0x3c')]=_0x18e8e7['dialDropRetryFrequency']||0x96;this[_0x899c('0x3d')]=_0x18e8e7['dialAbandonedMaxRetry']||0x3;this[_0x899c('0x3e')]=_0x18e8e7[_0x899c('0x3e')]||0x96;this[_0x899c('0x3f')]=_0x18e8e7[_0x899c('0x3f')]||0x3;this[_0x899c('0x40')]=_0x18e8e7[_0x899c('0x40')]||0x96;this[_0x899c('0x41')]=_0x18e8e7[_0x899c('0x41')]||0x3;this[_0x899c('0x42')]=_0x18e8e7[_0x899c('0x42')]||0x96;this[_0x899c('0x43')]=_0x18e8e7['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x18e8e7[_0x899c('0x44')]||0x4;this[_0x899c('0x45')]=_0x18e8e7[_0x899c('0x45')]?_0x18e8e7[_0x899c('0x45')]:undefined;this[_0x899c('0x46')]=_0x18e8e7[_0x899c('0x46')]?_0x18e8e7[_0x899c('0x46')]:undefined;this[_0x899c('0x47')]=_0x18e8e7[_0x899c('0x47')]||undefined;this[_0x899c('0x48')]=_0x18e8e7[_0x899c('0x48')]?_0x18e8e7[_0x899c('0x48')]:undefined;this['dialOrderByScheduledAt']=_0x18e8e7[_0x899c('0x49')]||'DESC';this[_0x899c('0x4a')]=_0x18e8e7['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x899c('0x4b')]=_0x18e8e7[_0x899c('0x4b')]||undefined;this[_0x899c('0x4c')]=strategy[_0x18e8e7[_0x899c('0x4c')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x18e8e7['dialAMDActive']||![];this[_0x899c('0x4d')]=_0x18e8e7[_0x899c('0x4d')];this[_0x899c('0x4e')]=_0x18e8e7[_0x899c('0x4e')];this[_0x899c('0x4f')]=_0x18e8e7[_0x899c('0x4f')];this[_0x899c('0x50')]=_0x18e8e7[_0x899c('0x50')];this['dialAMDMinWordLength']=_0x18e8e7['dialAMDMinWordLength'];this[_0x899c('0x51')]=_0x18e8e7[_0x899c('0x51')];this[_0x899c('0x52')]=_0x18e8e7[_0x899c('0x52')];this[_0x899c('0x53')]=_0x18e8e7[_0x899c('0x53')];this['dialAMDMaximumWordLength']=_0x18e8e7[_0x899c('0x54')];this['outboundRejectCallsDay']=0x0;this[_0x899c('0x55')]=0x0;this[_0x899c('0x56')]=_0x18e8e7[_0x899c('0x56')];this[_0x899c('0x57')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x899c('0x58')]=0x0;this[_0x899c('0x59')]=0x0;this[_0x899c('0x5a')]=0x0;this[_0x899c('0x5b')]=0x0;this[_0x899c('0x5c')]=0x0;this[_0x899c('0x5d')]=0x0;this[_0x899c('0x5e')]=0x0;this[_0x899c('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x899c('0x60')]=0x0;this[_0x899c('0x61')]=0x0;this[_0x899c('0x62')]=undefined;this[_0x899c('0x63')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x899c('0x64')]=0x0;this[_0x899c('0x65')]=0x0;this[_0x899c('0x66')]=0x0;this[_0x899c('0x67')]=0x0;this[_0x899c('0x68')]=0x0;this[_0x899c('0x69')]=0x0;this[_0x899c('0x6a')]=0x0;this[_0x899c('0x6b')]=0x0;this[_0x899c('0x6c')]=_0x18e8e7[_0x899c('0x6d')]||0x14;this[_0x899c('0x6e')]=_0x18e8e7[_0x899c('0x6d')]||0xa;this[_0x899c('0x6f')]=0x0;this[_0x899c('0x70')]=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x899c('0x71')]=0x0;this[_0x899c('0x72')]=0x0;this[_0x899c('0x73')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x18e8e7[_0x899c('0x74')]||0x1e;this['dialRecallInQueue']=_0x18e8e7['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x18e8e7[_0x899c('0x75')]||![];this[_0x899c('0x76')]=!!_0x18e8e7[_0x899c('0x76')]||![];this[_0x899c('0x77')]=_0x18e8e7[_0x899c('0x77')]||undefined;this[_0x899c('0x78')]=_0x18e8e7['dialAgiAfterHangupClient']||![];this[_0x899c('0x79')]=_0x18e8e7[_0x899c('0x79')]||![];this['monitor_format']=monitorFormat[_0x18e8e7['monitor_format']]?monitorFormat[_0x18e8e7['monitor_format']]:undefined;this['mandatoryDisposition']=_0x18e8e7[_0x899c('0x7a')]||![];this['mandatoryDispositionPause']=_0x18e8e7[_0x899c('0x7b')]?_0x18e8e7[_0x899c('0x7b')]:undefined;this[_0x899c('0x7c')]=![];}module[_0x899c('0x7d')]=VoiceQueue; \ No newline at end of file +var _0xc03d=['waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','paused','ringing','ringInUse','talking','unavailable','acw','acwTimeout','autopause','sendMessageOneNotActive','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','roundrobin','rrmemory','rrordered','monitor_format','type','inbound'];(function(_0x129d96,_0x132b31){var _0x35a14c=function(_0x49c376){while(--_0x49c376){_0x129d96['push'](_0x129d96['shift']());}};_0x35a14c(++_0x132b31);}(_0xc03d,0x74));var _0xdc03=function(_0x3d19c5,_0x476061){_0x3d19c5=_0x3d19c5-0x0;var _0x323485=_0xc03d[_0x3d19c5];return _0x323485;};'use strict';var monitorFormat={'wav':_0xdc03('0x0'),'wav49':_0xdc03('0x1'),'gsm':_0xdc03('0x2')};var strategy={'fewestcalls':_0xdc03('0x3'),'leastrecent':_0xdc03('0x4'),'linear':_0xdc03('0x5'),'random':_0xdc03('0x6'),'ringall':'ringall','rr':_0xdc03('0x7'),'rrmemory':_0xdc03('0x8'),'rrordered':_0xdc03('0x9'),'wrandom':'wrandom'};function VoiceQueue(_0x4ad59d){this['id']=_0x4ad59d['id']||0x0;this['name']=_0x4ad59d['name']||'';this[_0xdc03('0xa')]=_0x4ad59d['monitor_format']||'';this[_0xdc03('0xb')]=_0x4ad59d[_0xdc03('0xb')]||_0xdc03('0xc');this[_0xdc03('0xd')]=0x0;this[_0xdc03('0xe')]=0x0;this[_0xdc03('0xf')]=0x0;this[_0xdc03('0x10')]=0x0;this[_0xdc03('0x11')]=0x0;this[_0xdc03('0x12')]=0x0;this[_0xdc03('0x13')]=0x0;this[_0xdc03('0x14')]=0x0;this[_0xdc03('0x15')]=0x0;this[_0xdc03('0x16')]=0x0;this[_0xdc03('0x17')]=0x0;this['invalid']=0x0;this[_0xdc03('0x18')]=0x0;this[_0xdc03('0x19')]=0x0;this['onHold']=0x0;this[_0xdc03('0x1a')]=0x0;this[_0xdc03('0x1b')]=0x0;this[_0xdc03('0x1c')]=0x0;this[_0xdc03('0x1d')]=0x0;this[_0xdc03('0x1e')]=0x0;this['unknown']=0x0;this[_0xdc03('0x1f')]=_0x4ad59d[_0xdc03('0x1f')]||![];this[_0xdc03('0x20')]=_0x4ad59d[_0xdc03('0x20')]||0xa;this[_0xdc03('0x21')]=_0x4ad59d[_0xdc03('0x21')]||'no';this[_0xdc03('0x22')]=!![];this['message']='';this[_0xdc03('0x23')]='';this[_0xdc03('0x24')]=0x0;this[_0xdc03('0x25')]=0x0;this[_0xdc03('0x26')]=_0x4ad59d['dialTimezone']||null;this[_0xdc03('0x27')]=_0x4ad59d[_0xdc03('0x27')]?_0x4ad59d[_0xdc03('0x27')]:null;this['dialActive']=_0x4ad59d[_0xdc03('0x28')];this['dialMethod']=_0x4ad59d['dialMethod']||_0xdc03('0x29');this['dialLimitChannel']=_0x4ad59d[_0xdc03('0x2a')]||0x0;this['dialLimitQueue']=_0x4ad59d['dialLimitQueue']||0x0;this[_0xdc03('0x2b')]=_0x4ad59d['dialPowerLevel']||0x1;this['dialPredictiveOptimization']=_0x4ad59d[_0xdc03('0x2c')]||_0xdc03('0x2d');this[_0xdc03('0x2e')]=_0x4ad59d[_0xdc03('0x2e')]||0.03;this[_0xdc03('0x2f')]=_0x4ad59d[_0xdc03('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0x4ad59d['dialOriginateCallerIdName']||_0xdc03('0x30');this[_0xdc03('0x31')]=_0x4ad59d[_0xdc03('0x31')]||'anonymous';this['dialOriginateTimeout']=_0x4ad59d['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0x4ad59d[_0xdc03('0x32')]||_0xdc03('0x33');this[_0xdc03('0x34')]=_0x4ad59d['dialQueueTimeout']||0x3;this[_0xdc03('0x35')]=_0x4ad59d['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x4ad59d[_0xdc03('0x36')]||0x3;this['dialCongestionRetryFrequency']=_0x4ad59d['dialCongestionRetryFrequency']||0x96;this[_0xdc03('0x37')]=_0x4ad59d[_0xdc03('0x37')]||0x3;this[_0xdc03('0x38')]=_0x4ad59d['dialBusyRetryFrequency']||0x96;this[_0xdc03('0x39')]=_0x4ad59d[_0xdc03('0x39')]||0x3;this[_0xdc03('0x3a')]=_0x4ad59d[_0xdc03('0x3a')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x4ad59d[_0xdc03('0x3b')]||0x3;this[_0xdc03('0x3c')]=_0x4ad59d['dialNoSuchNumberRetryFrequency']||0x96;this[_0xdc03('0x3d')]=_0x4ad59d[_0xdc03('0x3d')]||0x3;this[_0xdc03('0x3e')]=_0x4ad59d[_0xdc03('0x3e')]||0x96;this['dialAbandonedMaxRetry']=_0x4ad59d[_0xdc03('0x3f')]||0x3;this['dialAbandonedRetryFrequency']=_0x4ad59d[_0xdc03('0x40')]||0x96;this[_0xdc03('0x41')]=_0x4ad59d[_0xdc03('0x41')]||0x3;this[_0xdc03('0x42')]=_0x4ad59d['dialMachineRetryFrequency']||0x96;this[_0xdc03('0x43')]=_0x4ad59d[_0xdc03('0x43')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4ad59d[_0xdc03('0x44')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4ad59d['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x4ad59d[_0xdc03('0x45')]||0x4;this['Trunk']=_0x4ad59d[_0xdc03('0x46')]?_0x4ad59d[_0xdc03('0x46')]:undefined;this[_0xdc03('0x47')]=_0x4ad59d['TrunkBackup']?_0x4ad59d[_0xdc03('0x47')]:undefined;this[_0xdc03('0x48')]=_0x4ad59d[_0xdc03('0x48')]||undefined;this[_0xdc03('0x49')]=_0x4ad59d[_0xdc03('0x49')]?_0x4ad59d[_0xdc03('0x49')]:undefined;this[_0xdc03('0x4a')]=_0x4ad59d[_0xdc03('0x4a')]||_0xdc03('0x4b');this[_0xdc03('0x4c')]=_0x4ad59d[_0xdc03('0x4c')]||undefined;this['dialCutDigit']=_0x4ad59d['dialCutDigit']||undefined;this[_0xdc03('0x4d')]=strategy[_0x4ad59d['strategy']];this[_0xdc03('0x4e')]=!![];this['dialAMDActive']=_0x4ad59d[_0xdc03('0x4f')]||![];this[_0xdc03('0x50')]=_0x4ad59d[_0xdc03('0x50')];this[_0xdc03('0x51')]=_0x4ad59d[_0xdc03('0x51')];this[_0xdc03('0x52')]=_0x4ad59d[_0xdc03('0x52')];this['dialAMDTotalAnalysisTime']=_0x4ad59d['dialAMDTotalAnalysisTime'];this[_0xdc03('0x53')]=_0x4ad59d['dialAMDMinWordLength'];this['dialAMDBetweenWordsSilence']=_0x4ad59d[_0xdc03('0x54')];this['dialAMDMaximumNumberOfWords']=_0x4ad59d[_0xdc03('0x55')];this[_0xdc03('0x56')]=_0x4ad59d['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x4ad59d[_0xdc03('0x57')];this[_0xdc03('0x58')]=0x0;this[_0xdc03('0x59')]=0x0;this[_0xdc03('0x5a')]=_0x4ad59d[_0xdc03('0x5a')];this[_0xdc03('0x5b')]=0x0;this[_0xdc03('0x5c')]=0x0;this[_0xdc03('0x5d')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xdc03('0x5e')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xdc03('0x5f')]=0x0;this[_0xdc03('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xdc03('0x61')]=0x0;this[_0xdc03('0x62')]=0x0;this[_0xdc03('0x63')]=0x0;this[_0xdc03('0x64')]=undefined;this[_0xdc03('0x65')]=undefined;this[_0xdc03('0x66')]=undefined;this[_0xdc03('0x67')]=1.05;this[_0xdc03('0x68')]=0x0;this[_0xdc03('0x69')]=0x0;this[_0xdc03('0x6a')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0xdc03('0x6b')]=0x0;this[_0xdc03('0x6c')]=0x0;this[_0xdc03('0x6d')]=0x0;this[_0xdc03('0x6e')]=_0x4ad59d['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xdc03('0x6f')]=_0x4ad59d['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xdc03('0x70')]=0x0;this[_0xdc03('0x71')]=0x0;this[_0xdc03('0x72')]=0x1;this[_0xdc03('0x73')]=0x0;this[_0xdc03('0x74')]=0x0;this[_0xdc03('0x75')]=0x0;this[_0xdc03('0x76')]=0x0;this[_0xdc03('0x77')]=_0x4ad59d[_0xdc03('0x77')]||0x1e;this[_0xdc03('0x78')]=_0x4ad59d['dialRecallInQueue']||![];this[_0xdc03('0x79')]=!!_0x4ad59d[_0xdc03('0x79')]||![];this[_0xdc03('0x7a')]=!!_0x4ad59d['dialPreviewRecallmeReminder']||![];this[_0xdc03('0x7b')]=_0x4ad59d[_0xdc03('0x7b')]||undefined;this[_0xdc03('0x7c')]=_0x4ad59d[_0xdc03('0x7c')]||![];this[_0xdc03('0x7d')]=_0x4ad59d[_0xdc03('0x7d')]||![];this[_0xdc03('0xa')]=monitorFormat[_0x4ad59d['monitor_format']]?monitorFormat[_0x4ad59d[_0xdc03('0xa')]]:undefined;this[_0xdc03('0x7e')]=_0x4ad59d[_0xdc03('0x7e')]||![];this[_0xdc03('0x7f')]=_0x4ad59d['mandatoryDispositionPause']?_0x4ad59d['mandatoryDispositionPause']:undefined;this['queueSummaryCountersUpdated']=![];}module[_0xdc03('0x80')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 1ec60d0..fcbbabc 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 _0x6bac=['outboundReCallsDay','sumBillable','sumDuration','total','waiting','strategy','abandoned','answered','busy','invalid','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','prototype','createReport','notInUse','onHold','loggedin','callers','length','SIP/','online','includes','status','booked','keys','queue','dialer','exten','compareToInboundQueue','updateReportFromOutboundQueue','preview','available','loggedInDb','paused','ringing','talking','inUse','loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay'];(function(_0x5a2201,_0x494e47){var _0x15b753=function(_0x2ab144){while(--_0x2ab144){_0x5a2201['push'](_0x5a2201['shift']());}};_0x15b753(++_0x494e47);}(_0x6bac,0xa5));var _0xc6ba=function(_0x517b64,_0x585ed3){_0x517b64=_0x517b64-0x0;var _0x241d90=_0x6bac[_0x517b64];return _0x241d90;};'use strict';var INBOUND_COUNTERS=[_0xc6ba('0x0'),'loggedIn',_0xc6ba('0x1'),_0xc6ba('0x2'),_0xc6ba('0x3'),_0xc6ba('0x4'),'waiting'];var OUTBOUND_COUNTERS=['available','answered',_0xc6ba('0x5'),_0xc6ba('0x6'),'loggedInDb',_0xc6ba('0x7'),_0xc6ba('0x8'),_0xc6ba('0x9'),_0xc6ba('0xa'),_0xc6ba('0xb'),_0xc6ba('0xc'),'outboundNoAnswerCallsDay','outboundNoSuchCallsDay',_0xc6ba('0xd'),'outboundRejectCallsDay','outboundUnknownCallsDay','paused','pTalking','talking',_0xc6ba('0xe'),_0xc6ba('0xf'),_0xc6ba('0x10'),_0xc6ba('0x11')];function VoiceQueueSummary(_0x2e01ee){this['id']=_0x2e01ee['id'];this['name']=_0x2e01ee['name'];this[_0xc6ba('0x12')]=_0x2e01ee[_0xc6ba('0x12')];this[_0xc6ba('0x13')]=_0x2e01ee[_0xc6ba('0x13')]||0x0;this[_0xc6ba('0x14')]=_0x2e01ee['answered']||0x0;this['available']=_0x2e01ee['available']||0x0;this[_0xc6ba('0x15')]=_0x2e01ee[_0xc6ba('0x15')]||0x0;this[_0xc6ba('0x5')]=_0x2e01ee[_0xc6ba('0x5')]||0x0;this[_0xc6ba('0x16')]=_0x2e01ee[_0xc6ba('0x16')]||0x0;this[_0xc6ba('0x6')]=_0x2e01ee[_0xc6ba('0x6')]||0x0;this['loggedInDb']=_0x2e01ee['loggedInDb']||0x0;this['onHold']=_0x2e01ee['onHold']||0x0;this['notInUse']=_0x2e01ee['notInUse']||0x0;this[_0xc6ba('0x2')]=_0x2e01ee[_0xc6ba('0x2')]||0x0;this['ringing']=_0x2e01ee['ringing']||0x0;this[_0xc6ba('0x17')]=_0x2e01ee['ringInUse'];this[_0xc6ba('0xe')]=_0x2e01ee[_0xc6ba('0xe')];this['sumDuration']=_0x2e01ee[_0xc6ba('0xf')];this[_0xc6ba('0x18')]=_0x2e01ee['sumHoldTime']||0x0;this[_0xc6ba('0x4')]=_0x2e01ee[_0xc6ba('0x4')]||0x0;this[_0xc6ba('0x10')]=_0x2e01ee[_0xc6ba('0x10')]||0x0;this[_0xc6ba('0x19')]=_0x2e01ee[_0xc6ba('0x19')];this[_0xc6ba('0x1a')]=_0x2e01ee[_0xc6ba('0x1a')]||0x0;this[_0xc6ba('0x1b')]=_0x2e01ee[_0xc6ba('0x1b')]||0x0;this[_0xc6ba('0x1c')]=_0x2e01ee[_0xc6ba('0x1c')]||0x0;this[_0xc6ba('0x11')]=_0x2e01ee[_0xc6ba('0x11')]||0x0;if(_0x2e01ee[_0xc6ba('0x19')]==='outbound'){this[_0xc6ba('0x1d')]=_0x2e01ee[_0xc6ba('0x1d')]||0x0;this[_0xc6ba('0x1e')]=_0x2e01ee[_0xc6ba('0x1e')];this[_0xc6ba('0x1f')]=_0x2e01ee[_0xc6ba('0x1f')];this['dialOriginateCallerIdName']=_0x2e01ee[_0xc6ba('0x20')];this[_0xc6ba('0x21')]=_0x2e01ee['dialOriginateCallerIdNumber'];this[_0xc6ba('0x22')]=_0x2e01ee[_0xc6ba('0x22')];this['dialPrefix']=_0x2e01ee[_0xc6ba('0x23')];this['temp']=_0x2e01ee[_0xc6ba('0x24')];this[_0xc6ba('0x25')]=_0x2e01ee[_0xc6ba('0x25')];this[_0xc6ba('0x9')]=_0x2e01ee['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x2e01ee[_0xc6ba('0xa')];this['outboundBusyCallsDay']=_0x2e01ee[_0xc6ba('0xb')];this['outboundCongestionCallsDay']=_0x2e01ee[_0xc6ba('0xc')];this[_0xc6ba('0x26')]=_0x2e01ee['outboundDropCallsDayACS'];this[_0xc6ba('0x27')]=_0x2e01ee[_0xc6ba('0x27')];this[_0xc6ba('0x28')]=_0x2e01ee[_0xc6ba('0x28')];this[_0xc6ba('0x29')]=_0x2e01ee[_0xc6ba('0x29')];this['outboundNoSuchCallsDay']=_0x2e01ee[_0xc6ba('0x2a')];this[_0xc6ba('0x2b')]=_0x2e01ee['outboundOriginateFailureCallsDay'];this[_0xc6ba('0xd')]=_0x2e01ee[_0xc6ba('0xd')];this['outboundRejectCallsDay']=_0x2e01ee[_0xc6ba('0x2c')];this[_0xc6ba('0x2d')]=_0x2e01ee['outboundUnknownCallsDay'];this[_0xc6ba('0x2e')]=_0x2e01ee[_0xc6ba('0x2e')];this[_0xc6ba('0x2f')]=_0x2e01ee[_0xc6ba('0x2f')];this[_0xc6ba('0x30')]=_0x2e01ee[_0xc6ba('0x30')];this['predictiveIntervalDroppedCallsCallersExit']=_0x2e01ee[_0xc6ba('0x31')];this[_0xc6ba('0x32')]=_0x2e01ee[_0xc6ba('0x32')];this[_0xc6ba('0x33')]=_0x2e01ee[_0xc6ba('0x33')];this[_0xc6ba('0x34')]=_0x2e01ee[_0xc6ba('0x34')];this[_0xc6ba('0x35')]=_0x2e01ee[_0xc6ba('0x35')];this[_0xc6ba('0x36')]=_0x2e01ee[_0xc6ba('0x36')];this[_0xc6ba('0x37')]=_0x2e01ee[_0xc6ba('0x37')];this[_0xc6ba('0x38')]=_0x2e01ee['predictiveIntervalAvailable'];this[_0xc6ba('0x39')]=_0x2e01ee[_0xc6ba('0x39')];this[_0xc6ba('0x7')]=_0x2e01ee['originated'];this[_0xc6ba('0x3a')]=_0x2e01ee['erlangCalls'];this[_0xc6ba('0x3b')]=_0x2e01ee['erlangCallToSecond'];this[_0xc6ba('0x3c')]=_0x2e01ee['erlangAbandonmentRate'];this[_0xc6ba('0x3d')]=_0x2e01ee['erlangBusyFactor'];this['startPredictive']=_0x2e01ee[_0xc6ba('0x3e')];this[_0xc6ba('0x3f')]=_0x2e01ee[_0xc6ba('0x3f')];this[_0xc6ba('0x40')]=_0x2e01ee['message'];this[_0xc6ba('0x41')]=_0x2e01ee[_0xc6ba('0x41')];}if(_0x2e01ee[_0xc6ba('0x42')]){this[_0xc6ba('0x42')]={'id':_0x2e01ee[_0xc6ba('0x42')]['id'],'name':_0x2e01ee[_0xc6ba('0x42')][_0xc6ba('0x43')],'active':_0x2e01ee['Trunk'][_0xc6ba('0x44')],'callerid':_0x2e01ee[_0xc6ba('0x42')][_0xc6ba('0x45')]};}}VoiceQueueSummary[_0xc6ba('0x46')][_0xc6ba('0x47')]=function(_0x4985f8,_0x5af16c,_0xc58daf,_0x174062){this['loggedInDb']=0x0;this[_0xc6ba('0x4')]=0x0;this[_0xc6ba('0x2')]=0x0;this[_0xc6ba('0x1b')]=0x0;this[_0xc6ba('0x48')]=0x0;this[_0xc6ba('0x5')]=0x0;this[_0xc6ba('0x15')]=0x0;this['invalid']=0x0;this['unavailable']=0x0;this[_0xc6ba('0x3')]=0x0;this[_0xc6ba('0x17')]=0x0;this[_0xc6ba('0x49')]=0x0;if(_0xc58daf){if(_0xc58daf['available']){this['available']=Number(_0xc58daf[_0xc6ba('0x0')]);}if(_0xc58daf[_0xc6ba('0x4a')]){this[_0xc6ba('0x6')]=Number(_0xc58daf[_0xc6ba('0x4a')]);}if(_0xc58daf[_0xc6ba('0x4b')]){this['waiting']=Number(_0xc58daf[_0xc6ba('0x4b')]);}}for(var _0x1466f7=0x0;_0x1466f7<_0x4985f8[_0xc6ba('0x4c')];_0x1466f7++){var _0x47119a=_0x5af16c[_0xc6ba('0x4d')+_0x4985f8[_0x1466f7][_0xc6ba('0x43')]];if(_0x47119a&&_0x47119a[_0xc6ba('0x4e')]){this[_0xc6ba('0x1')]+=0x1;}if(_0x4985f8[_0x1466f7]['incall']==='1'){this[_0xc6ba('0x4')]+=0x1;}if(_0x4985f8[_0x1466f7][_0xc6ba('0x2')]==='1'&&!['2','7','8'][_0xc6ba('0x4f')](_0x4985f8[_0x1466f7]['status'])){this[_0xc6ba('0x2')]+=0x1;}switch(_0x4985f8[_0x1466f7][_0xc6ba('0x50')]){case'0':this[_0xc6ba('0x1b')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0xc6ba('0x15')]+=0x1;break;case'4':this[_0xc6ba('0x16')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this[_0xc6ba('0x3')]+=0x1;break;case'7':this[_0xc6ba('0x17')]+=0x1;break;case'8':this[_0xc6ba('0x49')]+=0x1;break;}}if(this[_0xc6ba('0x1f')]===_0xc6ba('0x51')){var _0x2c50ff=Object[_0xc6ba('0x52')](_0x174062);for(var _0x283dac=0x0;_0x283dac<_0x2c50ff['length'];_0x283dac++){var _0x467f93=_0x2c50ff[_0x283dac];var _0x526945=_0x174062[_0x467f93];if(_0x526945[_0xc6ba('0x53')]===this[_0xc6ba('0x43')]&&_0x526945[_0xc6ba('0x19')]===_0xc6ba('0x54')&&_0x526945[_0xc6ba('0x55')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this['talking']>this['inUse']){this[_0xc6ba('0x4')]=this['inUse'];}this[_0xc6ba('0x1d')]=0x0;}return this;};VoiceQueueSummary[_0xc6ba('0x46')][_0xc6ba('0x56')]=function(_0x27267a){var _0x59580e=![];if(_0x27267a){_0x59580e=INBOUND_COUNTERS['some'](function(_0x121fa6){return this[_0x121fa6]!==_0x27267a[_0x121fa6];},this);}return _0x59580e;};VoiceQueueSummary[_0xc6ba('0x46')]['compareToOutboundQueue']=function(_0x23513d){var _0x32d5b6=![];var _0x40b74d=![];var _0x4796c2=![];if(_0x23513d){_0x32d5b6=this[_0xc6ba('0x1f')]!==_0x23513d['dialMethod']||this[_0xc6ba('0x1e')]!==_0x23513d[_0xc6ba('0x1e')]||this[_0xc6ba('0x40')]!==_0x23513d[_0xc6ba('0x40')]||this['statusMessage']!==_0x23513d[_0xc6ba('0x41')];_0x40b74d=OUTBOUND_COUNTERS['some'](function(_0x2f993d){return this[_0x2f993d]!==_0x23513d[_0x2f993d];},this);if(this['Trunk']&&_0x23513d[_0xc6ba('0x42')]){_0x4796c2=this[_0xc6ba('0x42')]['name']!==_0x23513d[_0xc6ba('0x42')][_0xc6ba('0x43')]||this[_0xc6ba('0x42')][_0xc6ba('0x44')]!==_0x23513d[_0xc6ba('0x42')][_0xc6ba('0x44')];}}return _0x32d5b6||_0x40b74d||_0x4796c2;};VoiceQueueSummary[_0xc6ba('0x46')][_0xc6ba('0x57')]=function(_0x48efde){this[_0xc6ba('0x14')]=_0x48efde[_0xc6ba('0x14')];this[_0xc6ba('0x40')]=_0x48efde[_0xc6ba('0x40')];this[_0xc6ba('0x41')]=_0x48efde['statusMessage'];this[_0xc6ba('0x7')]=_0x48efde[_0xc6ba('0x7')];this[_0xc6ba('0x8')]=_0x48efde[_0xc6ba('0x8')];this[_0xc6ba('0x9')]=_0x48efde[_0xc6ba('0x9')];this[_0xc6ba('0xa')]=_0x48efde[_0xc6ba('0xa')];this[_0xc6ba('0xb')]=_0x48efde[_0xc6ba('0xb')];this['outboundCongestionCallsDay']=_0x48efde['outboundCongestionCallsDay'];this[_0xc6ba('0x29')]=_0x48efde['outboundNoAnswerCallsDay'];this[_0xc6ba('0x2a')]=_0x48efde[_0xc6ba('0x2a')];this[_0xc6ba('0xd')]=_0x48efde[_0xc6ba('0xd')];this[_0xc6ba('0x2c')]=_0x48efde[_0xc6ba('0x2c')];this['outboundUnknownCallsDay']=_0x48efde[_0xc6ba('0x2d')];this[_0xc6ba('0xe')]=_0x48efde[_0xc6ba('0xe')];this[_0xc6ba('0xf')]=_0x48efde[_0xc6ba('0xf')];this[_0xc6ba('0x10')]=_0x48efde[_0xc6ba('0x10')];if(this['dialMethod']===_0xc6ba('0x58')){this[_0xc6ba('0x1d')]=_0x48efde[_0xc6ba('0x1d')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x565f=['loggedin','length','SIP/','online','incall','includes','booked','queue','dialer','exten','xcally-motion-preview','some','compareToOutboundQueue','active','updateReportFromOutboundQueue','preview','exports','loggedIn','loggedInDb','paused','talking','waiting','available','answered','inUse','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','prototype','createReport'];(function(_0x162780,_0x47f2e2){var _0x1ea2dc=function(_0x123898){while(--_0x123898){_0x162780['push'](_0x162780['shift']());}};_0x1ea2dc(++_0x47f2e2);}(_0x565f,0x68));var _0xf565=function(_0x33362a,_0x3d5f3d){_0x33362a=_0x33362a-0x0;var _0x1c556d=_0x565f[_0x33362a];return _0x1c556d;};'use strict';var INBOUND_COUNTERS=['available',_0xf565('0x0'),_0xf565('0x1'),_0xf565('0x2'),'ringing',_0xf565('0x3'),_0xf565('0x4')];var OUTBOUND_COUNTERS=[_0xf565('0x5'),_0xf565('0x6'),_0xf565('0x7'),'loggedIn','loggedInDb','originated',_0xf565('0x8'),'outboundAnswerCallsDay',_0xf565('0x9'),_0xf565('0xa'),_0xf565('0xb'),'outboundNoAnswerCallsDay',_0xf565('0xc'),'outboundReCallsDay',_0xf565('0xd'),'outboundUnknownCallsDay',_0xf565('0x2'),_0xf565('0xe'),_0xf565('0x3'),_0xf565('0xf'),_0xf565('0x10'),_0xf565('0x11'),'waiting'];function VoiceQueueSummary(_0x4cb8e1){this['id']=_0x4cb8e1['id'];this[_0xf565('0x12')]=_0x4cb8e1[_0xf565('0x12')];this[_0xf565('0x13')]=_0x4cb8e1[_0xf565('0x13')];this[_0xf565('0x14')]=_0x4cb8e1[_0xf565('0x14')]||0x0;this[_0xf565('0x6')]=_0x4cb8e1[_0xf565('0x6')]||0x0;this[_0xf565('0x5')]=_0x4cb8e1[_0xf565('0x5')]||0x0;this['busy']=_0x4cb8e1[_0xf565('0x15')]||0x0;this[_0xf565('0x7')]=_0x4cb8e1['inUse']||0x0;this[_0xf565('0x16')]=_0x4cb8e1[_0xf565('0x16')]||0x0;this[_0xf565('0x0')]=_0x4cb8e1[_0xf565('0x0')]||0x0;this[_0xf565('0x1')]=_0x4cb8e1['loggedInDb']||0x0;this[_0xf565('0x17')]=_0x4cb8e1['onHold']||0x0;this['notInUse']=_0x4cb8e1[_0xf565('0x18')]||0x0;this[_0xf565('0x2')]=_0x4cb8e1['paused']||0x0;this['ringing']=_0x4cb8e1[_0xf565('0x19')]||0x0;this['ringInUse']=_0x4cb8e1[_0xf565('0x1a')];this[_0xf565('0xf')]=_0x4cb8e1[_0xf565('0xf')];this['sumDuration']=_0x4cb8e1['sumDuration'];this[_0xf565('0x1b')]=_0x4cb8e1[_0xf565('0x1b')]||0x0;this[_0xf565('0x3')]=_0x4cb8e1[_0xf565('0x3')]||0x0;this[_0xf565('0x11')]=_0x4cb8e1['total']||0x0;this[_0xf565('0x1c')]=_0x4cb8e1[_0xf565('0x1c')];this[_0xf565('0x1d')]=_0x4cb8e1[_0xf565('0x1d')]||0x0;this[_0xf565('0x1e')]=_0x4cb8e1[_0xf565('0x1e')]||0x0;this[_0xf565('0x1f')]=_0x4cb8e1[_0xf565('0x1f')]||0x0;this[_0xf565('0x4')]=_0x4cb8e1[_0xf565('0x4')]||0x0;if(_0x4cb8e1['type']===_0xf565('0x20')){this['pTalking']=_0x4cb8e1[_0xf565('0xe')]||0x0;this[_0xf565('0x21')]=_0x4cb8e1['dialActive'];this[_0xf565('0x22')]=_0x4cb8e1[_0xf565('0x22')];this[_0xf565('0x23')]=_0x4cb8e1[_0xf565('0x23')];this[_0xf565('0x24')]=_0x4cb8e1[_0xf565('0x24')];this[_0xf565('0x25')]=_0x4cb8e1[_0xf565('0x25')];this['dialPrefix']=_0x4cb8e1[_0xf565('0x26')];this[_0xf565('0x27')]=_0x4cb8e1[_0xf565('0x27')];this[_0xf565('0x28')]=_0x4cb8e1[_0xf565('0x28')];this['outboundAnswerCallsDay']=_0x4cb8e1[_0xf565('0x29')];this[_0xf565('0x9')]=_0x4cb8e1[_0xf565('0x9')];this[_0xf565('0xa')]=_0x4cb8e1[_0xf565('0xa')];this['outboundCongestionCallsDay']=_0x4cb8e1[_0xf565('0xb')];this[_0xf565('0x2a')]=_0x4cb8e1[_0xf565('0x2a')];this[_0xf565('0x2b')]=_0x4cb8e1[_0xf565('0x2b')];this[_0xf565('0x2c')]=_0x4cb8e1['outboundDropCallsDayTimeout'];this[_0xf565('0x2d')]=_0x4cb8e1[_0xf565('0x2d')];this['outboundNoSuchCallsDay']=_0x4cb8e1[_0xf565('0xc')];this[_0xf565('0x2e')]=_0x4cb8e1[_0xf565('0x2e')];this[_0xf565('0x2f')]=_0x4cb8e1[_0xf565('0x2f')];this[_0xf565('0xd')]=_0x4cb8e1[_0xf565('0xd')];this[_0xf565('0x30')]=_0x4cb8e1['outboundUnknownCallsDay'];this[_0xf565('0x31')]=_0x4cb8e1[_0xf565('0x31')];this[_0xf565('0x32')]=_0x4cb8e1['predictiveIntervalAvgHoldtime'];this[_0xf565('0x33')]=_0x4cb8e1[_0xf565('0x33')];this[_0xf565('0x34')]=_0x4cb8e1[_0xf565('0x34')];this[_0xf565('0x35')]=_0x4cb8e1['predictiveIntervalDroppedCallsTimeout'];this[_0xf565('0x36')]=_0x4cb8e1['predictiveIntervalErlangCalls'];this[_0xf565('0x37')]=_0x4cb8e1[_0xf565('0x37')];this['predictiveIntervalHitRate']=_0x4cb8e1['predictiveIntervalHitRate'];this[_0xf565('0x38')]=_0x4cb8e1[_0xf565('0x38')];this['predictiveIntervalPauses']=_0x4cb8e1[_0xf565('0x39')];this['predictiveIntervalAvailable']=_0x4cb8e1['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x4cb8e1['predictiveIntervalTotalCalls'];this[_0xf565('0x3a')]=_0x4cb8e1[_0xf565('0x3a')];this[_0xf565('0x3b')]=_0x4cb8e1['erlangCalls'];this[_0xf565('0x3c')]=_0x4cb8e1[_0xf565('0x3c')];this[_0xf565('0x3d')]=_0x4cb8e1['erlangAbandonmentRate'];this[_0xf565('0x3e')]=_0x4cb8e1['erlangBusyFactor'];this[_0xf565('0x3f')]=_0x4cb8e1[_0xf565('0x3f')];this[_0xf565('0x40')]=_0x4cb8e1['startProgressive'];this[_0xf565('0x41')]=_0x4cb8e1['message'];this[_0xf565('0x42')]=_0x4cb8e1['statusMessage'];}if(_0x4cb8e1[_0xf565('0x43')]){this[_0xf565('0x43')]={'id':_0x4cb8e1['Trunk']['id'],'name':_0x4cb8e1[_0xf565('0x43')][_0xf565('0x12')],'active':_0x4cb8e1[_0xf565('0x43')]['active'],'callerid':_0x4cb8e1[_0xf565('0x43')]['callerid']};}}VoiceQueueSummary[_0xf565('0x44')][_0xf565('0x45')]=function(_0x3c43ff,_0x45cde0,_0xf9e659,_0x2321f5){this['loggedInDb']=0x0;this['talking']=0x0;this[_0xf565('0x2')]=0x0;this[_0xf565('0x1e')]=0x0;this[_0xf565('0x18')]=0x0;this[_0xf565('0x7')]=0x0;this[_0xf565('0x15')]=0x0;this['invalid']=0x0;this[_0xf565('0x1d')]=0x0;this[_0xf565('0x19')]=0x0;this[_0xf565('0x1a')]=0x0;this[_0xf565('0x17')]=0x0;if(_0xf9e659){if(_0xf9e659['available']){this[_0xf565('0x5')]=Number(_0xf9e659['available']);}if(_0xf9e659['loggedin']){this[_0xf565('0x0')]=Number(_0xf9e659[_0xf565('0x46')]);}if(_0xf9e659['callers']){this['waiting']=Number(_0xf9e659['callers']);}}for(var _0x307cc7=0x0;_0x307cc7<_0x3c43ff[_0xf565('0x47')];_0x307cc7++){var _0x2b602f=_0x45cde0[_0xf565('0x48')+_0x3c43ff[_0x307cc7][_0xf565('0x12')]];if(_0x2b602f&&_0x2b602f[_0xf565('0x49')]){this[_0xf565('0x1')]+=0x1;}if(_0x3c43ff[_0x307cc7][_0xf565('0x4a')]==='1'){this[_0xf565('0x3')]+=0x1;}if(_0x3c43ff[_0x307cc7][_0xf565('0x2')]==='1'&&!['2','7','8'][_0xf565('0x4b')](_0x3c43ff[_0x307cc7]['status'])){this['paused']+=0x1;}switch(_0x3c43ff[_0x307cc7]['status']){case'0':this[_0xf565('0x1e')]+=0x1;break;case'1':this[_0xf565('0x18')]+=0x1;break;case'2':this[_0xf565('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0xf565('0x1d')]+=0x1;break;case'6':this[_0xf565('0x19')]+=0x1;break;case'7':this[_0xf565('0x1a')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0xf565('0x22')]===_0xf565('0x4c')){var _0x1bd9f4=Object['keys'](_0x2321f5);for(var _0x5b6cbb=0x0;_0x5b6cbb<_0x1bd9f4[_0xf565('0x47')];_0x5b6cbb++){var _0x4ed6f5=_0x1bd9f4[_0x5b6cbb];var _0x3ee900=_0x2321f5[_0x4ed6f5];if(_0x3ee900[_0xf565('0x4d')]===this[_0xf565('0x12')]&&_0x3ee900[_0xf565('0x1c')]===_0xf565('0x4e')&&_0x3ee900[_0xf565('0x4f')]===_0xf565('0x50')){this[_0xf565('0x3')]+=0x1;}}if(this[_0xf565('0x3')]>this[_0xf565('0x7')]){this[_0xf565('0x3')]=this[_0xf565('0x7')];}this[_0xf565('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xf565('0x44')]['compareToInboundQueue']=function(_0x4a49de){var _0x3deb88=![];if(_0x4a49de){_0x3deb88=INBOUND_COUNTERS[_0xf565('0x51')](function(_0x567c8e){return this[_0x567c8e]!==_0x4a49de[_0x567c8e];},this);}return _0x3deb88;};VoiceQueueSummary[_0xf565('0x44')][_0xf565('0x52')]=function(_0x52998f){var _0x4b60ae=![];var _0x13296f=![];var _0x1b1741=![];if(_0x52998f){_0x4b60ae=this[_0xf565('0x22')]!==_0x52998f[_0xf565('0x22')]||this[_0xf565('0x21')]!==_0x52998f[_0xf565('0x21')]||this[_0xf565('0x41')]!==_0x52998f[_0xf565('0x41')]||this['statusMessage']!==_0x52998f[_0xf565('0x42')];_0x13296f=OUTBOUND_COUNTERS['some'](function(_0x46a1b8){return this[_0x46a1b8]!==_0x52998f[_0x46a1b8];},this);if(this[_0xf565('0x43')]&&_0x52998f['Trunk']){_0x1b1741=this['Trunk'][_0xf565('0x12')]!==_0x52998f[_0xf565('0x43')][_0xf565('0x12')]||this[_0xf565('0x43')]['active']!==_0x52998f[_0xf565('0x43')][_0xf565('0x53')];}}return _0x4b60ae||_0x13296f||_0x1b1741;};VoiceQueueSummary[_0xf565('0x44')][_0xf565('0x54')]=function(_0x400021){this['answered']=_0x400021[_0xf565('0x6')];this['message']=_0x400021[_0xf565('0x41')];this['statusMessage']=_0x400021['statusMessage'];this[_0xf565('0x3a')]=_0x400021[_0xf565('0x3a')];this[_0xf565('0x8')]=_0x400021[_0xf565('0x8')];this[_0xf565('0x29')]=_0x400021[_0xf565('0x29')];this['outboundBlacklistCallsDay']=_0x400021['outboundBlacklistCallsDay'];this[_0xf565('0xa')]=_0x400021[_0xf565('0xa')];this['outboundCongestionCallsDay']=_0x400021['outboundCongestionCallsDay'];this[_0xf565('0x2d')]=_0x400021[_0xf565('0x2d')];this[_0xf565('0xc')]=_0x400021['outboundNoSuchCallsDay'];this[_0xf565('0x2f')]=_0x400021[_0xf565('0x2f')];this[_0xf565('0xd')]=_0x400021[_0xf565('0xd')];this['outboundUnknownCallsDay']=_0x400021[_0xf565('0x30')];this[_0xf565('0xf')]=_0x400021['sumBillable'];this[_0xf565('0x10')]=_0x400021[_0xf565('0x10')];this['total']=_0x400021[_0xf565('0x11')];if(this['dialMethod']===_0xf565('0x55')){this[_0xf565('0xe')]=_0x400021['pTalking'];}};module[_0xf565('0x56')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8d73b49..a08e844 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 _0xb6b7=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0xb6b7,0xe4));var _0x7b6b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb6b7[_0x167cc1];return _0x10bc4b;};'use strict';function VtigerAccount(_0x16b7f1){this['id']=_0x16b7f1['id']||0x0;this[_0x7b6b('0x0')]=_0x16b7f1[_0x7b6b('0x0')]||'';this[_0x7b6b('0x1')]=_0x16b7f1['username']||'';this['accessKey']=_0x16b7f1[_0x7b6b('0x2')]||'';this[_0x7b6b('0x3')]=_0x16b7f1[_0x7b6b('0x3')]||'';this[_0x7b6b('0x4')]=_0x16b7f1['serverUrl']||'';this[_0x7b6b('0x5')]=_0x16b7f1[_0x7b6b('0x5')]||{};}module[_0x7b6b('0x6')]=VtigerAccount; \ No newline at end of file +var _0x4316=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x36a9f7,_0x54fde9){var _0x256935=function(_0x5c1e26){while(--_0x5c1e26){_0x36a9f7['push'](_0x36a9f7['shift']());}};_0x256935(++_0x54fde9);}(_0x4316,0x1ee));var _0x6431=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4316[_0x20a584];return _0x4b41a8;};'use strict';function VtigerAccount(_0x172892){this['id']=_0x172892['id']||0x0;this[_0x6431('0x0')]=_0x172892[_0x6431('0x0')]||'';this[_0x6431('0x1')]=_0x172892[_0x6431('0x1')]||'';this[_0x6431('0x2')]=_0x172892['accessKey']||'';this[_0x6431('0x3')]=_0x172892[_0x6431('0x3')]||'';this[_0x6431('0x4')]=_0x172892['serverUrl']||'';this['Configurations']=_0x172892[_0x6431('0x5')]||{};}module[_0x6431('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 107c991..7ce7f7d 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 _0x00bd=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x3b4970,_0x5d8af2){var _0x64aba7=function(_0x4893d6){while(--_0x4893d6){_0x3b4970['push'](_0x3b4970['shift']());}};_0x64aba7(++_0x5d8af2);}(_0x00bd,0x1ef));var _0xd00b=function(_0x3de5b4,_0x41089){_0x3de5b4=_0x3de5b4-0x0;var _0x103eb1=_0x00bd[_0x3de5b4];return _0x103eb1;};'use strict';function ZendeskAccount(_0x8528e8){this['id']=_0x8528e8['id']||0x0;this[_0xd00b('0x0')]=_0x8528e8[_0xd00b('0x0')]||'';this[_0xd00b('0x1')]=_0x8528e8[_0xd00b('0x1')]||'';this['password']=_0x8528e8[_0xd00b('0x2')]||'';this[_0xd00b('0x3')]=_0x8528e8['token']||'';this[_0xd00b('0x4')]=_0x8528e8[_0xd00b('0x4')]||'';this[_0xd00b('0x5')]=_0x8528e8[_0xd00b('0x5')]||'';this['type']=_0x8528e8[_0xd00b('0x6')]||_0xd00b('0x7');this['serverUrl']=_0x8528e8[_0xd00b('0x8')]||'';this[_0xd00b('0x9')]=_0x8528e8[_0xd00b('0x9')]||{};}module[_0xd00b('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x4b5e=['type','integrationTab','serverUrl','Configurations','exports','name','token','remoteUri'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x4b5e,0x185));var _0xe4b5=function(_0x28701f,_0x5570c0){_0x28701f=_0x28701f-0x0;var _0x1431c7=_0x4b5e[_0x28701f];return _0x1431c7;};'use strict';function ZendeskAccount(_0x3fa68a){this['id']=_0x3fa68a['id']||0x0;this['name']=_0x3fa68a[_0xe4b5('0x0')]||'';this['username']=_0x3fa68a['username']||'';this['password']=_0x3fa68a['password']||'';this['token']=_0x3fa68a[_0xe4b5('0x1')]||'';this['remoteUri']=_0x3fa68a[_0xe4b5('0x2')]||'';this['authType']=_0x3fa68a['authType']||'';this['type']=_0x3fa68a[_0xe4b5('0x3')]||_0xe4b5('0x4');this[_0xe4b5('0x5')]=_0x3fa68a[_0xe4b5('0x5')]||'';this[_0xe4b5('0x6')]=_0x3fa68a[_0xe4b5('0x6')]||{};}module[_0xe4b5('0x7')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0fbfe6c..0d58ff4 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 _0xa329=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0x55c1f0,_0x4f574f){var _0x1530fa=function(_0x631542){while(--_0x631542){_0x55c1f0['push'](_0x55c1f0['shift']());}};_0x1530fa(++_0x4f574f);}(_0xa329,0x9a));var _0x9a32=function(_0x50bfa1,_0x5bcfc4){_0x50bfa1=_0x50bfa1-0x0;var _0xc91a29=_0xa329[_0x50bfa1];return _0xc91a29;};'use strict';function ZohoAccount(_0x44d0f9){this['id']=_0x44d0f9['id']||0x0;this['name']=_0x44d0f9[_0x9a32('0x0')]||'';this[_0x9a32('0x1')]=_0x44d0f9['description']||'';this[_0x9a32('0x2')]=_0x44d0f9['host']||'';this[_0x9a32('0x3')]=_0x44d0f9[_0x9a32('0x3')]||'';this[_0x9a32('0x4')]=_0x44d0f9[_0x9a32('0x4')]||'';this[_0x9a32('0x5')]=_0x44d0f9['clientSecret']||'';this['serverUrl']=_0x44d0f9[_0x9a32('0x6')]||'';this[_0x9a32('0x7')]=_0x44d0f9[_0x9a32('0x7')]||'';this[_0x9a32('0x8')]=_0x44d0f9[_0x9a32('0x8')]||'';this[_0x9a32('0x9')]=_0x44d0f9[_0x9a32('0x9')]||{};}module[_0x9a32('0xa')]=ZohoAccount; \ No newline at end of file +var _0x2079=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description'];(function(_0x4fa3f2,_0x54f078){var _0x439d69=function(_0x1b8e53){while(--_0x1b8e53){_0x4fa3f2['push'](_0x4fa3f2['shift']());}};_0x439d69(++_0x54f078);}(_0x2079,0x6c));var _0x9207=function(_0x2fe95e,_0x1ef600){_0x2fe95e=_0x2fe95e-0x0;var _0x1dcba5=_0x2079[_0x2fe95e];return _0x1dcba5;};'use strict';function ZohoAccount(_0x573aa9){this['id']=_0x573aa9['id']||0x0;this[_0x9207('0x0')]=_0x573aa9['name']||'';this[_0x9207('0x1')]=_0x573aa9[_0x9207('0x1')]||'';this[_0x9207('0x2')]=_0x573aa9['host']||'';this[_0x9207('0x3')]=_0x573aa9['zone']||'';this[_0x9207('0x4')]=_0x573aa9['clientId']||'';this[_0x9207('0x5')]=_0x573aa9[_0x9207('0x5')]||'';this['serverUrl']=_0x573aa9[_0x9207('0x6')]||'';this[_0x9207('0x7')]=_0x573aa9[_0x9207('0x7')]||'';this[_0x9207('0x8')]=_0x573aa9[_0x9207('0x8')]||'';this[_0x9207('0x9')]=_0x573aa9['Configurations']||{};}module[_0x9207('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 62cbb3f..e605905 100644 --- a/server/services/ami/preview/action.js +++ b/server/services/ami/preview/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3c=['firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','moment','isNil','string','idContact','type','campaigntype','queue','dialAnswer','membername','Agent','name','format','SIP/%s','calleridname','Contact','phone'];(function(_0x454e6d,_0x1e1f38){var _0x4bc294=function(_0x2c803a){while(--_0x2c803a){_0x454e6d['push'](_0x454e6d['shift']());}};_0x4bc294(++_0x1e1f38);}(_0xed3c,0x1a6));var _0xced3=function(_0x2cfbcf,_0x2cf96f){_0x2cfbcf=_0x2cfbcf-0x0;var _0x41fc13=_0xed3c[_0x2cfbcf];return _0x41fc13;};'use strict';var util=require(_0xced3('0x0'));var _=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));function checkNameSurname(_0x3fb5e1,_0x558ee8,_0xfdc1ed){var _0x144d14='';if(!_[_0xced3('0x3')](_0x558ee8)&&'string'===typeof _0x558ee8){_0x144d14+=_0x558ee8;}if(!_['isNil'](_0xfdc1ed)&&_0xced3('0x4')===typeof _0xfdc1ed){_0x144d14+='\x20'+_0xfdc1ed;}if(_0x144d14!==''){return _0x144d14;}return _0x3fb5e1;}function Action(_0x1ada18,_0x2f92f8,_0x1cd694,_0x4795cd,_0x510164){this['uniqueid']=_0x1cd694||undefined;this[_0xced3('0x5')]=_0x1ada18['id'];this['queue']=_0x2f92f8['name'];this['type']=_0x2f92f8[_0xced3('0x6')];this[_0xced3('0x7')]=_0xced3('0x8');this[_0xced3('0x9')]=![];this[_0xced3('0xa')]=_['isNil'](_0x1ada18[_0xced3('0xb')])?undefined:_0x1ada18[_0xced3('0xb')][_0xced3('0xc')];this['channelAgent']=this[_0xced3('0xa')]?util[_0xced3('0xd')](_0xced3('0xe'),this[_0xced3('0xa')]):_0x4795cd||undefined;this[_0xced3('0xf')]=checkNameSurname(_0x1ada18[_0xced3('0x10')][_0xced3('0x11')],_0x1ada18['Contact'][_0xced3('0x12')],_0x1ada18['Contact'][_0xced3('0x13')]);this[_0xced3('0x14')]=_0x1ada18[_0xced3('0x14')]||![];this[_0xced3('0x15')]=_0x1ada18['phone'];this[_0xced3('0x16')]=_0x1ada18[_0xced3('0x16')];this['countbusyretry']=_0x1ada18[_0xced3('0x17')]||0x0;this[_0xced3('0x18')]=_0x1ada18[_0xced3('0x18')]||0x0;this[_0xced3('0x19')]=_0x1ada18['countnoanswerretry']||0x0;this[_0xced3('0x1a')]=(_0x1ada18['countbusyretry']||0x0)+(_0x1ada18[_0xced3('0x18')]||0x0)+(_0x1ada18[_0xced3('0x19')]||0x0)+(_0x1ada18[_0xced3('0x1b')]||0x0)+(_0x1ada18[_0xced3('0x1c')]||0x0)+(_0x1ada18[_0xced3('0x1d')]||0x0)+(_0x1ada18[_0xced3('0x1e')]||0x0)+(_0x1ada18[_0xced3('0x1f')]||0x0);this[_0xced3('0x1b')]=_0x1ada18[_0xced3('0x1b')]||0x0;this[_0xced3('0x1c')]=_0x1ada18[_0xced3('0x1c')]||0x0;this['countabandonedretry']=_0x1ada18['countabandonedretry']||0x0;this['countmachineretry']=_0x1ada18[_0xced3('0x1e')]||0x0;this[_0xced3('0x1f')]=_0x1ada18[_0xced3('0x1f')]||0x0;this['callback']=_0x1ada18[_0xced3('0x20')];this[_0xced3('0x21')]=_0x1ada18['callbackuniqueid'];this['callbackat']=_0x1ada18[_0xced3('0x22')];this[_0xced3('0x23')]=_0x1ada18[_0xced3('0x23')];this[_0xced3('0x24')]=_0x1ada18['ContactId'];this[_0xced3('0x25')]=_0x1ada18[_0xced3('0x25')];this['UserId']=_[_0xced3('0x3')](_0x1ada18['Agent'])?_0x1ada18[_0xced3('0x26')]:_0x1ada18[_0xced3('0xb')]['id'];this[_0xced3('0x27')]=_0x1ada18[_0xced3('0x27')];this[_0xced3('0x28')]='';this['originatecalleridname']='';}Action['prototype'][_0xced3('0x29')]=function(){return util['format'](_0xced3('0x2a'),this[_0xced3('0xf')],this['number']);};module[_0xced3('0x2b')]=Action; \ No newline at end of file +var _0xd4a2=['type','campaigntype','dialAnswer','membername','format','SIP/%s','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','Agent','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','exports','util','isNil','string','uniqueid','idContact','queue','name'];(function(_0x4c3de6,_0x4fe7c8){var _0x169ac0=function(_0x2d8e9e){while(--_0x2d8e9e){_0x4c3de6['push'](_0x4c3de6['shift']());}};_0x169ac0(++_0x4fe7c8);}(_0xd4a2,0x173));var _0x2d4a=function(_0x9f142d,_0x20cdb1){_0x9f142d=_0x9f142d-0x0;var _0x5a296f=_0xd4a2[_0x9f142d];return _0x5a296f;};'use strict';var util=require(_0x2d4a('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0xfba415,_0x576ffe,_0x2a8a71){var _0x57c5ca='';if(!_[_0x2d4a('0x1')](_0x576ffe)&&'string'===typeof _0x576ffe){_0x57c5ca+=_0x576ffe;}if(!_[_0x2d4a('0x1')](_0x2a8a71)&&_0x2d4a('0x2')===typeof _0x2a8a71){_0x57c5ca+='\x20'+_0x2a8a71;}if(_0x57c5ca!==''){return _0x57c5ca;}return _0xfba415;}function Action(_0x2624b5,_0x3a88e2,_0x1ca10b,_0x57058f,_0x45fefb){this[_0x2d4a('0x3')]=_0x1ca10b||undefined;this[_0x2d4a('0x4')]=_0x2624b5['id'];this[_0x2d4a('0x5')]=_0x3a88e2[_0x2d4a('0x6')];this[_0x2d4a('0x7')]=_0x3a88e2[_0x2d4a('0x7')];this[_0x2d4a('0x8')]=_0x2d4a('0x5');this[_0x2d4a('0x9')]=![];this[_0x2d4a('0xa')]=_[_0x2d4a('0x1')](_0x2624b5['Agent'])?undefined:_0x2624b5['Agent'][_0x2d4a('0x6')];this['channelAgent']=this[_0x2d4a('0xa')]?util[_0x2d4a('0xb')](_0x2d4a('0xc'),this[_0x2d4a('0xa')]):_0x57058f||undefined;this[_0x2d4a('0xd')]=checkNameSurname(_0x2624b5[_0x2d4a('0xe')][_0x2d4a('0xf')],_0x2624b5[_0x2d4a('0xe')]['firstName'],_0x2624b5['Contact'][_0x2d4a('0x10')]);this['active']=_0x2624b5[_0x2d4a('0x11')]||![];this[_0x2d4a('0x12')]=_0x2624b5[_0x2d4a('0xf')];this[_0x2d4a('0x13')]=_0x2624b5['scheduledat'];this[_0x2d4a('0x14')]=_0x2624b5['countbusyretry']||0x0;this[_0x2d4a('0x15')]=_0x2624b5['countcongestionretry']||0x0;this[_0x2d4a('0x16')]=_0x2624b5[_0x2d4a('0x16')]||0x0;this[_0x2d4a('0x17')]=(_0x2624b5[_0x2d4a('0x14')]||0x0)+(_0x2624b5['countcongestionretry']||0x0)+(_0x2624b5['countnoanswerretry']||0x0)+(_0x2624b5['countnosuchnumberretry']||0x0)+(_0x2624b5[_0x2d4a('0x18')]||0x0)+(_0x2624b5[_0x2d4a('0x19')]||0x0)+(_0x2624b5[_0x2d4a('0x1a')]||0x0)+(_0x2624b5[_0x2d4a('0x1b')]||0x0);this[_0x2d4a('0x1c')]=_0x2624b5[_0x2d4a('0x1c')]||0x0;this['countdropretry']=_0x2624b5['countdropretry']||0x0;this[_0x2d4a('0x19')]=_0x2624b5[_0x2d4a('0x19')]||0x0;this[_0x2d4a('0x1a')]=_0x2624b5[_0x2d4a('0x1a')]||0x0;this[_0x2d4a('0x1b')]=_0x2624b5[_0x2d4a('0x1b')]||0x0;this[_0x2d4a('0x1d')]=_0x2624b5[_0x2d4a('0x1d')];this['callbackuniqueid']=_0x2624b5[_0x2d4a('0x1e')];this[_0x2d4a('0x1f')]=_0x2624b5[_0x2d4a('0x1f')];this[_0x2d4a('0x20')]=_0x2624b5[_0x2d4a('0x20')];this[_0x2d4a('0x21')]=_0x2624b5[_0x2d4a('0x21')];this[_0x2d4a('0x22')]=_0x2624b5['ListId'];this['UserId']=_['isNil'](_0x2624b5[_0x2d4a('0x23')])?_0x2624b5['UserId']:_0x2624b5[_0x2d4a('0x23')]['id'];this[_0x2d4a('0x24')]=_0x2624b5[_0x2d4a('0x24')];this[_0x2d4a('0x25')]='';this[_0x2d4a('0x26')]='';}Action[_0x2d4a('0x27')][_0x2d4a('0x28')]=function(){return util[_0x2d4a('0xb')]('\x22%s\x22\x20<%s>',this[_0x2d4a('0xd')],this['number']);};module[_0x2d4a('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 32f1318..a02ba1e 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 _0x993d=['keys','addVariable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','moment','ioredis','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','varset','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','info','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','available','paused','message','CAMPAIGN_STATUS','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','clockClearZombieChannels','hasOwnProperty','booked','type','outbound','clearZombieChannels','dialActive','setMessage','dialPreviewAutoRecallMe','recallMe','isNil','Queue','queue','originated:\x20','pTalking:\x20','pick','UserId','VoiceQueueId','ListId','Action','status','channel','catch','updateOriginated','[clearZombieChannel]','dialAnswer','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','size','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerFinal','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','cloneAction','countnosuchnumberretry','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','scheduledAt','dialNoAnswerRetryFrequency','countcongestionretry','Congestion','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','ANSWER','destlinkedid','queueSummaryCountersUpdated','isUndefined','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logBusy]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','phone','substring','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','setXMDContactVariables','assign','merge','toLowerVariables','variablesAction','OriginateError','syncNewExten','actionid','isFailure','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','callProgressDetectingAgent','destuniqueid','variables','syncVarSet','filterKey'];(function(_0x87d10c,_0x41644d){var _0x8bbbbe=function(_0x8646c8){while(--_0x8646c8){_0x87d10c['push'](_0x87d10c['shift']());}};_0x8bbbbe(++_0x41644d);}(_0x993d,0x151));var _0xd993=function(_0x1d11b3,_0xc42c6){_0x1d11b3=_0x1d11b3-0x0;var _0x211f54=_0x993d[_0x1d11b3];return _0x211f54;};'use strict';var util=require(_0xd993('0x0'));var _=require(_0xd993('0x1'));var uuid=require(_0xd993('0x2'));var moment=require(_0xd993('0x3'));var Redis=require(_0xd993('0x4'));var config=require('../../../config/environment');var logger=require(_0xd993('0x5'))(_0xd993('0x6'));var loggerAction=require(_0xd993('0x5'))('actionPreview');var ami=require(_0xd993('0x7'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0xd993('0x8'));var Action=require(_0xd993('0x9'));var ut=require(_0xd993('0xa'));var utils=require(_0xd993('0xb'));config[_0xd993('0xc')]=_['defaults'](config['redis'],{'host':_0xd993('0xd'),'port':0x18eb});var io=require(_0xd993('0xe'))(new Redis(config[_0xd993('0xc')]));var Sequence=function(){};Sequence[_0xd993('0xf')][_0xd993('0x10')]=function(_0x6057bf){this[_0xd993('0x11')]=this['tail']?this[_0xd993('0x11')][_0xd993('0x12')](_0x6057bf):_0x6057bf();};function Preview(_0x3eca6b){this[_0xd993('0x13')]=new Sequence();this[_0xd993('0x14')]=_0x3eca6b[_0xd993('0x15')];this[_0xd993('0x16')]=_0x3eca6b['trunks'];this[_0xd993('0x17')]={};this['agents']=_0x3eca6b[_0xd993('0x18')];this['clockClearZombieChannels']=0x0;ami['on'](_0xd993('0x19'),this[_0xd993('0x1a')][_0xd993('0x1b')](this));ami['on'](_0xd993('0x1c'),this[_0xd993('0x1d')]['bind'](this));ami['on'](_0xd993('0x1e'),this[_0xd993('0x1f')][_0xd993('0x1b')](this));ami['on'](_0xd993('0x20'),this[_0xd993('0x21')][_0xd993('0x1b')](this));ami['on']('newexten',this['syncNewExten'][_0xd993('0x1b')](this));ami['on'](_0xd993('0x22'),this['syncVarSet'][_0xd993('0x1b')](this));ami['on'](_0xd993('0x23'),this[_0xd993('0x24')][_0xd993('0x1b')](this));ami['on']('blindtransfer',this[_0xd993('0x25')][_0xd993('0x1b')](this));this[_0xd993('0x26')](this[_0xd993('0x14')]);}function emit(_0x14c7b1,_0x4f30db,_0x380957){io['to'](_0x14c7b1)[_0xd993('0x27')](_0x4f30db,_0x380957);}function emitVoiceQueueChannelRemove(_0x546714){logger[_0xd993('0x28')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0xd993('0x29')](_0x546714));emit(util[_0xd993('0x2a')](_0xd993('0x2b'),_0x546714[_0xd993('0x2c')]),_0xd993('0x2d'),_0x546714);io[_0xd993('0x27')](_0xd993('0x2e'),_0x546714);}function notSendMessagesQueue(_0x2c49ab){if(_0x2c49ab['sendMessageOneNotActive']){if(_0x2c49ab[_0xd993('0x2f')]===0x0&&_0x2c49ab[_0xd993('0x30')]===0x0){_0x2c49ab[_0xd993('0x31')]=![];_0x2c49ab[_0xd993('0x32')]=0x0;_0x2c49ab[_0xd993('0x33')]=0x0;_0x2c49ab[_0xd993('0x34')]=utils[_0xd993('0x35')]['INACTIVE'];ut[_0xd993('0x36')](_0xd993('0x37'),_0x2c49ab[_0xd993('0x2c')]+_0xd993('0x38'));}else{_0x2c49ab[_0xd993('0x34')]=utils[_0xd993('0x35')][_0xd993('0x39')];ut[_0xd993('0x36')](_0xd993('0x37'),_0x2c49ab[_0xd993('0x2c')]+_0xd993('0x3a'));}}}Preview[_0xd993('0xf')][_0xd993('0x26')]=function(){var _0x2efb39=this;setInterval(function(){_0x2efb39['syncCampaigns']();},0x7cf);};Preview[_0xd993('0xf')]['syncCampaigns']=function(){var _0x447018=this['campaignsPreview'];this[_0xd993('0x3b')]+=0x1;for(var _0x51f50a in _0x447018){if(_0x447018[_0xd993('0x3c')](_0x51f50a)&&(_0x447018[_0x51f50a]['dialMethod']===_0xd993('0x6')||_0x447018[_0x51f50a]['dialMethod']===_0xd993('0x3d'))&&_0x447018[_0x51f50a][_0xd993('0x3e')]===_0xd993('0x3f')){if(this[_0xd993('0x3b')]>0x7){this[_0xd993('0x3b')]=0x0;this[_0xd993('0x40')]();}}if(_0x447018['hasOwnProperty'](_0x51f50a)&&_0x447018[_0x51f50a]['dialMethod']===_0xd993('0x6')&&_0x447018[_0x51f50a]['type']===_0xd993('0x3f')){if(_0x447018[_0x51f50a][_0xd993('0x41')]){this[_0xd993('0x42')](_0x447018[_0x51f50a]);if(_0x447018[_0x51f50a][_0xd993('0x43')])this[_0xd993('0x44')](_0x447018[_0x51f50a]);}else{notSendMessagesQueue(_0x447018[_0x51f50a]);}}}};Preview[_0xd993('0xf')]['clearZombieChannel']=function(_0x1483b5){var _0x371368=this;this['sequence'][_0xd993('0x10')](function(){if(!_[_0xd993('0x45')](_0x371368[_0xd993('0x17')][_0x1483b5])){loggerAction['info']('[clearZombieChannels][talking]',_0x1483b5,_0xd993('0x46'),_0x371368['actions'][_0x1483b5][_0xd993('0x47')],_0xd993('0x48'),JSON[_0xd993('0x29')](_0x371368[_0xd993('0x14')][_0x371368[_0xd993('0x17')][_0x1483b5][_0xd993('0x47')]][_0xd993('0x2f')]),_0xd993('0x49'),JSON[_0xd993('0x29')](_0x371368['campaignsPreview'][_0x371368[_0xd993('0x17')][_0x1483b5][_0xd993('0x47')]]['pTalking']),JSON[_0xd993('0x29')](_0x371368[_0xd993('0x17')][_0x1483b5]['dialAnswer']),JSON[_0xd993('0x29')](_[_0xd993('0x4a')](_0x371368[_0xd993('0x17')][_0x1483b5],['contactId',_0xd993('0x4b'),_0xd993('0x4c'),_0xd993('0x4d')])));return ami[_0xd993('0x4e')]({'action':_0xd993('0x4f'),'channel':_0x371368['actions'][_0x1483b5][_0xd993('0x50')]})[_0xd993('0x51')](function(_0x4e23a8){if(_0x4e23a8['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x371368['actions'][_0x1483b5]){ut[_0xd993('0x52')](_0x371368[_0xd993('0x14')][_0x371368[_0xd993('0x17')][_0x1483b5][_0xd993('0x47')]],_0xd993('0x53'));if(_0x371368['actions'][_0x1483b5][_0xd993('0x54')]===!![]){ut[_0xd993('0x55')](_0x371368['campaignsPreview'][_0x371368[_0xd993('0x17')][_0x1483b5]['queue']],_0xd993('0x53'));ut[_0xd993('0x56')](_0xd993('0x57')+_0x1483b5,_0x371368[_0xd993('0x17')][_0x1483b5]['queue']);}ut[_0xd993('0x56')](_0xd993('0x58')+_0x1483b5,_0x371368[_0xd993('0x17')][_0x1483b5][_0xd993('0x47')]);delete _0x371368[_0xd993('0x17')][_0x1483b5];}},0x2328);}});}});};Preview['prototype'][_0xd993('0x40')]=function(){var _0x307627=this;loggerAction['info']('[action]',_[_0xd993('0x59')](this[_0xd993('0x17')]));for(var _0x5a34cc in this['actions']){if(_0x307627[_0xd993('0x17')][_0xd993('0x3c')](_0x5a34cc)){_0x307627['clearZombieChannel'](_0x5a34cc);}}};Preview['prototype'][_0xd993('0x44')]=function(_0x3f018d){var _0x54dc95=this;rpcDb[_0xd993('0x5a')](_0x3f018d['id'],ut[_0xd993('0x5b')](this['agents']))[_0xd993('0x5c')](function(_0x16b8e5){if(!_[_0xd993('0x45')](_0x16b8e5)){for(var _0x33e81d=0x0;_0x33e81d<_0x16b8e5[_0xd993('0x5d')];_0x33e81d+=0x1){if(ut['getDiff'](_0x16b8e5[_0x33e81d][_0xd993('0x5e')])<_0x3f018d[_0xd993('0x5f')]*0x3c){if(_0x16b8e5[_0x33e81d][_0xd993('0x60')]&&!_0x16b8e5[_0x33e81d][_0xd993('0x60')][_0xd993('0x61')]){_0x54dc95[_0xd993('0x62')](_0x16b8e5[_0x33e81d]['id'])[_0xd993('0x5c')](ut[_0xd993('0x63')](_0xd993('0x64')))[_0xd993('0x51')](ut[_0xd993('0x63')](_0xd993('0x64')));}else{rpcDb[_0xd993('0x65')](_0x16b8e5[_0x33e81d]['id']);}}else{var _0x1fcc54=new Action(_0x16b8e5[_0x33e81d],_0x3f018d);_0x1fcc54[_0xd993('0x66')]=moment()[_0xd993('0x2a')](_0xd993('0x67'));_0x3f018d['outboundReCallsDay']+=0x1;ut[_0xd993('0x68')](_0x1fcc54,0x17,_0xd993('0x69'));if(_0x3f018d[_0xd993('0x6a')]){rpcDb[_0xd993('0x6b')](ut[_0xd993('0x6c')](_0x16b8e5[_0x33e81d]));rpcDb[_0xd993('0x6d')](_0x1fcc54,_0xd993('0x6e'));}else{ut['logCustomer'](_0x1fcc54,0x16,_0xd993('0x6f'));rpcDb['createCustomerHistory'](_0x1fcc54,'[HistoryRecallClose]');rpcDb[_0xd993('0x70')](_0x1fcc54,'[HistoryRecallClose]');}}}}})[_0xd993('0x51')](ut[_0xd993('0x63')]('[getContactRecallMe]'));};Preview['prototype'][_0xd993('0x42')]=function(_0x3a00ba){_0x3a00ba[_0xd993('0x31')]=!![];if(ut['IsNotLoggedIn'](_0x3a00ba['loggedIn'])){_0x3a00ba[_0xd993('0x34')]=utils[_0xd993('0x35')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xd993('0x71')](_0x3a00ba[_0xd993('0x41')])){_0x3a00ba['message']=utils['CAMPAIGN_STATUS'][_0xd993('0x72')];}else if(!this[_0xd993('0x73')](_0x3a00ba[_0xd993('0x74')])){if(!this[_0xd993('0x73')](_0x3a00ba[_0xd993('0x75')])){_0x3a00ba[_0xd993('0x34')]=utils['CAMPAIGN_STATUS'][_0xd993('0x76')];}else{_0x3a00ba['message']=utils[_0xd993('0x35')][_0xd993('0x77')];}}else{_0x3a00ba[_0xd993('0x34')]=utils[_0xd993('0x35')]['ACTIVE'];}};Preview['prototype'][_0xd993('0x78')]=function(_0x3c7957,_0x379a7a,_0x9cd083){var _0x5d407d=this;var _0x25e3d1=this[_0xd993('0x17')][_0x379a7a];var _0x48b5cb=this['campaignsPreview'][_0x25e3d1[_0xd993('0x47')]];var _0x1ba633;var _0x41efa5=![];var _0x2fe5ea=0x2;var _0x1dd178=0x3;if(_0x48b5cb){switch(_0x9cd083){case'1':_0x48b5cb[_0xd993('0x79')]+=0x1;_0x25e3d1['countnosuchnumberretry']+=0x1;_0x25e3d1[_0xd993('0x7a')]=ut['totalGlobal'](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0x0,_0xd993('0x7b'));ami[_0xd993('0x27')](_0xd993('0x7c'),ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0x7e')));rpcDb[_0xd993('0x6d')](_0x25e3d1,'[callProgressDetectingCustomer][logNoSuch]');_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'0',_0x48b5cb)[_0xd993('0x5c')](function(_0x33b9a5){_0x41efa5=_0x33b9a5[_0xd993('0x80')]==0x1;_0x2fe5ea=_0x48b5cb[_0xd993('0x81')];_0x1dd178=_0x48b5cb[_0xd993('0x82')];if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb['dialGlobalMaxRetry']){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0xf,'Global');rpcDb[_0xd993('0x70')](_0x1ba633,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x25e3d1[_0xd993('0x85')]>=_0x48b5cb[_0xd993('0x86')]){rpcDb[_0xd993('0x70')](_0x25e3d1,_0xd993('0x87'));}else{rpcDb[_0xd993('0x88')](ut['scheduledAt'](_0x25e3d1,'countnosuchnumberretry',_0x48b5cb[_0xd993('0x81')]),_0x25e3d1['unlockAgent'],_0x25e3d1[_0xd993('0x89')]);}}delete this[_0xd993('0x17')][_0x3c7957[_0xd993('0x8a')]];}else{_0x25e3d1[_0xd993('0x85')]++;logger['info'](_0xd993('0x8b'),_0x25e3d1[_0xd993('0x85')]);logger[_0xd993('0x28')]('id',_0x25e3d1[_0xd993('0x8c')]);_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countnosuchnumberretry':_0x25e3d1[_0xd993('0x85')]}})[_0xd993('0x5c')](function(){_0x5d407d[_0xd993('0x8e')](_0x25e3d1,_0x2fe5ea,_0x1dd178)['then'](function(){});});}});break;case'ANSWER':var _0x1020f8=moment()[_0xd993('0x2a')](_0xd993('0x67'));_0x25e3d1[_0xd993('0x8f')]=_0x1020f8;_0x25e3d1[_0xd993('0x90')]=_0x1020f8;_0x25e3d1['dialAnswer']=!![];_0x48b5cb['pTalking']+=0x1;logger[_0xd993('0x28')](_0xd993('0x91'),_0x25e3d1[_0xd993('0x92')],_0xd993('0x93'),_0x48b5cb['name'],'pTalking:\x20',_0x48b5cb[_0xd993('0x30')]);ami[_0xd993('0x27')](_0xd993('0x94'),ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0x95'),this[_0xd993('0x14')][_0x25e3d1['queue']]));if(_0x48b5cb[_0xd993('0x96')]){ami[_0xd993('0x27')](_0xd993('0x97'),ut[_0xd993('0x98')](_0x25e3d1));}break;case'16':ami['emit'](_0xd993('0x99'),ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0x9a'),this[_0xd993('0x14')][_0x25e3d1[_0xd993('0x47')]]));emitVoiceQueueChannelRemove(ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0x9a')));_0x48b5cb[_0xd993('0x9b')]+=0x1;_0x48b5cb[_0xd993('0x9c')]+=0x1;_0x48b5cb['answered']+=0x1;ut['decrementTalkink'](_0x48b5cb,_0xd993('0x9d'));_0x25e3d1['countglobal']=ut[_0xd993('0x83')](_0x25e3d1);ut['logCustomer'](_0x25e3d1,0x4,_0xd993('0x9e'));rpcDb['createCustomerHistory'](_0x25e3d1,_0xd993('0x9f'));rpcDb['createCustomerFinal'](_0x25e3d1,_0xd993('0xa0'));rpcDb[_0xd993('0xa1')](_0x25e3d1);_0x48b5cb[_0xd993('0xa2')]+=_0x25e3d1[_0xd993('0xa3')];_0x48b5cb['sumBillable']+=_0x25e3d1[_0xd993('0xa3')];logger['info'](_0xd993('0xa4'),_0x25e3d1[_0xd993('0x92')],_0xd993('0x93'),_0x48b5cb[_0xd993('0x2c')],_0xd993('0x49'),_0x48b5cb['pTalking']);delete this[_0xd993('0x17')][_0x3c7957[_0xd993('0x8a')]];break;case _0xd993('0xa5'):_0x48b5cb[_0xd993('0xa6')]+=0x1;_0x25e3d1[_0xd993('0xa7')]+=0x1;_0x25e3d1['countglobal']=ut[_0xd993('0x83')](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0x5,_0xd993('0xa8'));_0x2fe5ea=_0x48b5cb['dialBusyRetryFrequency'];_0x1dd178=_0x48b5cb[_0xd993('0x82')];ami[_0xd993('0x27')](_0xd993('0xa9'),ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0xaa')));rpcDb['createCustomerHistory'](_0x25e3d1,_0xd993('0xab'));_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'5',_0x48b5cb)[_0xd993('0x5c')](function(_0x4c1840){_0x41efa5=_0x4c1840[_0xd993('0x80')]==0x1;if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb['dialGlobalMaxRetry']){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0xf,_0xd993('0xac'));rpcDb[_0xd993('0x70')](_0x1ba633,_0xd993('0xad'));}else{if(_0x25e3d1[_0xd993('0xa7')]>=_0x48b5cb[_0xd993('0xae')]){rpcDb[_0xd993('0x70')](_0x25e3d1,_0xd993('0xab'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x25e3d1,_0xd993('0xa7'),_0x48b5cb['dialBusyRetryFrequency']),_0x25e3d1[_0xd993('0xaf')],_0x25e3d1[_0xd993('0x89')]);}}}else{_0x25e3d1[_0xd993('0xa7')]++;_0x5d407d['incrementPreviewCounters']({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countbusyretry':_0x25e3d1['countbusyretry']}})['then'](function(){_0x5d407d[_0xd993('0x8e')](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});});}});break;case _0xd993('0xb0'):_0x48b5cb[_0xd993('0xb1')]+=0x1;_0x25e3d1[_0xd993('0xb2')]+=0x1;_0x25e3d1[_0xd993('0x7a')]=ut[_0xd993('0x83')](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0x3,_0xd993('0xb3'));_0x2fe5ea=_0x48b5cb['dialNoAnswerRetryFrequency'];_0x1dd178=_0x48b5cb[_0xd993('0x82')];var _0x1046ed=ut[_0xd993('0xb4')](_0x25e3d1,_0x48b5cb);ami[_0xd993('0x27')](_0xd993('0xb5'),_0x1046ed);rpcDb[_0xd993('0x6d')](_0x25e3d1,_0xd993('0xb6'));_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'3',_0x48b5cb)[_0xd993('0x5c')](function(_0x4f63ce){_0x41efa5=_0x4f63ce[_0xd993('0x80')]==0x1;if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb[_0xd993('0xb7')]){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0xf,_0xd993('0xac'));rpcDb['createCustomerFinal'](_0x1ba633,_0xd993('0xb8'));}else{if(_0x25e3d1[_0xd993('0xb2')]>=_0x48b5cb[_0xd993('0xb9')]){rpcDb[_0xd993('0x70')](_0x25e3d1,_0xd993('0xb6'));}else{rpcDb[_0xd993('0x88')](ut[_0xd993('0xba')](_0x25e3d1,_0xd993('0xb2'),_0x48b5cb[_0xd993('0xbb')]),_0x25e3d1['unlockAgent'],_0x25e3d1[_0xd993('0x89')]);}}}else{_0x25e3d1['countnoanswerretry']++;_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countnoanswerretry':_0x25e3d1[_0xd993('0xb2')]}})[_0xd993('0x5c')](function(){_0x5d407d['swapAdditionalPhones'](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});});}});break;case'CONGESTION':_0x48b5cb['outboundCongestionCallsDay']+=0x1;_0x25e3d1[_0xd993('0xbc')]+=0x1;_0x25e3d1[_0xd993('0x7a')]=ut[_0xd993('0x83')](_0x25e3d1);ut['logCustomer'](_0x25e3d1,0x8,_0xd993('0xbd'));_0x2fe5ea=_0x48b5cb['dialCongestionRetryFrequency'];_0x1dd178=_0x48b5cb[_0xd993('0x82')];ami[_0xd993('0x27')](_0xd993('0xbe'),ut[_0xd993('0x7d')](_0x25e3d1,'congestion'));rpcDb['createCustomerHistory'](_0x25e3d1,_0xd993('0xbf'));_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'8',_0x48b5cb)[_0xd993('0x5c')](function(_0x1208c9){_0x41efa5=_0x1208c9[_0xd993('0x80')]==0x1;if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb[_0xd993('0xb7')]){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0xf,'Global');rpcDb[_0xd993('0x70')](_0x1ba633,_0xd993('0xc0'));}else{if(_0x25e3d1[_0xd993('0xbc')]>=_0x48b5cb[_0xd993('0xc1')]){rpcDb[_0xd993('0x70')](_0x25e3d1,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xd993('0x88')](ut[_0xd993('0xba')](_0x25e3d1,'countcongestionretry',_0x48b5cb[_0xd993('0xc2')]),_0x25e3d1[_0xd993('0xaf')],_0x25e3d1[_0xd993('0x89')]);}}}else{_0x25e3d1['countcongestionretry']++;_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countcongestionretry':_0x25e3d1['countcongestionretry']}})[_0xd993('0x5c')](function(){_0x5d407d['swapAdditionalPhones'](_0x25e3d1,_0x2fe5ea,_0x1dd178)['then'](function(){});});}});break;case _0xd993('0xc3'):_0x48b5cb[_0xd993('0xc4')]+=0x1;_0x25e3d1['countagentrejectretry']+=0x1;_0x25e3d1[_0xd993('0x7a')]=ut[_0xd993('0x83')](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0x14,_0xd993('0xc5'));_0x2fe5ea=_0x48b5cb[_0xd993('0xc6')];_0x1dd178=_0x48b5cb[_0xd993('0x82')];ami[_0xd993('0x27')](_0xd993('0xc7'),ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0xc8')));rpcDb['createCustomerHistory'](_0x25e3d1,_0xd993('0xc9'));_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'20',_0x48b5cb)['then'](function(_0x3c1558){_0x41efa5=_0x3c1558[_0xd993('0x80')]==0x1;if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb['dialGlobalMaxRetry']){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0x14,_0xd993('0xc5'));rpcDb[_0xd993('0x70')](_0x1ba633,_0xd993('0xca'));}else{if(_0x25e3d1[_0xd993('0xcb')]>=_0x48b5cb[_0xd993('0xcc')]){rpcDb['createCustomerFinal'](_0x25e3d1,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xd993('0x88')](ut['scheduledAt'](_0x25e3d1,_0xd993('0xcb'),_0x48b5cb[_0xd993('0xc6')]),_0x25e3d1['unlockAgent'],_0x25e3d1[_0xd993('0x89')]);}}}else{_0x25e3d1['countnoanswerretry']++;_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countnoanswerretry':_0x25e3d1[_0xd993('0xb2')]}})[_0xd993('0x5c')](function(){_0x5d407d['swapAdditionalPhones'](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});});}});break;case _0xd993('0xcd'):_0x48b5cb[_0xd993('0xce')]+=0x1;_0x25e3d1[_0xd993('0xcf')]+=0x1;_0x25e3d1['countglobal']=ut[_0xd993('0x83')](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0xb,_0xd993('0xd0'));rpcDb[_0xd993('0x6d')](_0x25e3d1,'[callProgressDetectingCustomer][logAbandoned]');_0x5d407d['verifyAdditionalPhones'](_0x25e3d1,'11',_0x48b5cb)[_0xd993('0x5c')](function(_0x191147){_0x41efa5=_0x191147[_0xd993('0x80')]==0x1;if(!_0x41efa5){if(ut['totalGlobal'](_0x25e3d1)>=_0x48b5cb['dialGlobalMaxRetry']){_0x1ba633=ut['cloneAction'](_0x25e3d1,0xf,_0xd993('0xac'));rpcDb[_0xd993('0x70')](_0x1ba633,_0xd993('0xd1'));}else{if(_0x25e3d1[_0xd993('0xd2')]>=_0x48b5cb[_0xd993('0xd3')]){rpcDb[_0xd993('0x70')](_0x25e3d1,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xd993('0x88')](ut[_0xd993('0xba')](_0x25e3d1,_0xd993('0xcf'),_0x48b5cb['dialAbandonedRetryFrequency']),_0x25e3d1['unlockAgent'],_0x25e3d1[_0xd993('0x89')]);}}}else{_0x25e3d1[_0xd993('0xb2')]++;_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countnoanswerretry':_0x25e3d1[_0xd993('0xb2')]}})['then'](function(){_0x5d407d[_0xd993('0x8e')](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});});}});break;case'18':_0x48b5cb[_0xd993('0xd4')]+=0x1;_0x25e3d1[_0xd993('0xd5')]+=0x1;_0x25e3d1[_0xd993('0x7a')]=ut[_0xd993('0x83')](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0x12,_0x3c7957[_0xd993('0xd6')]||_0x3c7957[_0xd993('0xd7')]);ami[_0xd993('0x27')](_0xd993('0xd8'),ut[_0xd993('0x7d')](_0x25e3d1,_0xd993('0xd9')));rpcDb[_0xd993('0x6d')](_0x25e3d1,_0xd993('0xda'));_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'18',_0x48b5cb)[_0xd993('0x5c')](function(_0x137a4c){_0x41efa5=_0x137a4c[_0xd993('0x80')]==0x1;if(!_0x41efa5){if(ut['totalGlobal'](_0x25e3d1)>=_0x48b5cb[_0xd993('0xb7')]){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0x12,'Global');rpcDb['createCustomerFinal'](_0x1ba633,_0xd993('0xda'));}else{rpcDb[_0xd993('0x70')](_0x25e3d1,_0xd993('0xda'));}}else{_0x25e3d1[_0xd993('0xb2')]++;_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countnoanswerretry':_0x25e3d1[_0xd993('0xb2')]}})[_0xd993('0x5c')](function(){_0x5d407d[_0xd993('0x8e')](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});});}});delete this[_0xd993('0x17')][_0x3c7957['linkedid']];break;case'19':_0x48b5cb[_0xd993('0xd4')]+=0x1;_0x25e3d1[_0xd993('0x7a')]=ut['totalGlobal'](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0x13,_0x3c7957[_0xd993('0xd6')]||_0x3c7957[_0xd993('0xd7')]);ami[_0xd993('0x27')]('custom:amd',ut['buildObj'](_0x25e3d1,_0xd993('0xd9')));rpcDb[_0xd993('0x6d')](_0x25e3d1,_0xd993('0xdb'));_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'18',_0x48b5cb)[_0xd993('0x5c')](function(_0x4ef0f7){_0x41efa5=_0x4ef0f7['additional']==0x1;if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb['dialGlobalMaxRetry']){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0xf,_0xd993('0xac'));rpcDb[_0xd993('0x70')](_0x1ba633,_0xd993('0xdb'));}else{rpcDb['createCustomerFinal'](_0x25e3d1,'[callProgressDetectingCustomer][machine]');}}else{_0x25e3d1[_0xd993('0xb2')]++;_0x5d407d[_0xd993('0x8d')]({'id':_0x25e3d1[_0xd993('0x8c')],'field':{'countnoanswerretry':_0x25e3d1[_0xd993('0xb2')]}})[_0xd993('0x5c')](function(){_0x5d407d[_0xd993('0x8e')](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});});}});delete this[_0xd993('0x17')][_0x3c7957[_0xd993('0x8a')]];break;default:if(_0x25e3d1[_0xd993('0x54')]){ut[_0xd993('0x55')](_0x48b5cb,_0xd993('0xdc'));ut[_0xd993('0x56')](_0xd993('0xdd')+_0x48b5cb[_0xd993('0x2c')],_0x3c7957);}_0x48b5cb[_0xd993('0xd4')]+=0x1;_0x25e3d1['countglobal']=ut[_0xd993('0x83')](_0x25e3d1);ut[_0xd993('0x68')](_0x25e3d1,0xc,_0x3c7957['cause-txt']||_0x3c7957[_0xd993('0xd7')]);_0x2fe5ea=_0x48b5cb[_0xd993('0xc6')];_0x1dd178=_0x48b5cb['callAdditionalPhoneAfterMin'];rpcDb[_0xd993('0x6d')](_0x25e3d1,'[callProgressDetectingCustomer][logUnknown]');_0x5d407d[_0xd993('0x7f')](_0x25e3d1,'20',_0x48b5cb)[_0xd993('0x5c')](function(_0x52e253){_0x41efa5=_0x52e253['additional']==0x1;if(!_0x41efa5){if(ut[_0xd993('0x83')](_0x25e3d1)>=_0x48b5cb[_0xd993('0xb7')]){_0x1ba633=ut[_0xd993('0x84')](_0x25e3d1,0xf,_0xd993('0xac'));rpcDb['createCustomerFinal'](_0x1ba633,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0xd993('0x70')](_0x25e3d1,_0xd993('0xde'));}delete this['actions'][_0x3c7957['linkedid']];}else{_0x5d407d[_0xd993('0x8e')](_0x25e3d1,_0x2fe5ea,_0x1dd178)[_0xd993('0x5c')](function(){});}});}if(!(_0x25e3d1[_0xd993('0x54')]&&_0x9cd083==='16')){ut['updateOriginated'](_0x48b5cb,_0xd993('0xdf'));logger[_0xd993('0x28')](_0xd993('0xe0'),_0x25e3d1[_0xd993('0x92')],_0xd993('0x93'),_0x48b5cb[_0xd993('0x2c')],_0xd993('0x48'),_0x48b5cb[_0xd993('0x2f')]);}if(_0x9cd083!==_0xd993('0xe1')){delete this['actions'][_0x3c7957[_0xd993('0x8a')]];delete this[_0xd993('0x17')][_0x3c7957[_0xd993('0xe2')]];}_0x48b5cb[_0xd993('0xe3')]=!![];}};Preview['prototype']['callProgressDetectingAgent']=function(_0x2f9fe5,_0x480dfa,_0x27fb60){if(_[_0xd993('0xe4')](_0x480dfa)&&'object'!==typeof _0x480dfa){return;}if(_['isUndefined'](_0x27fb60)&&'object'!==typeof _0x27fb60){return;}switch(_0x27fb60[_0xd993('0xe5')]){case'0':ut['logAgent'](_0x2f9fe5,0x0,_0xd993('0x7b'));rpcDb[_0xd993('0xe6')](_0x2f9fe5,_0xd993('0xe7'));break;case'3':ut[_0xd993('0xe8')](_0x2f9fe5,0x3,_0xd993('0xb3'));rpcDb[_0xd993('0xe6')](_0x2f9fe5,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0xd993('0xe8')](_0x2f9fe5,0x5,_0xd993('0xa8'));rpcDb[_0xd993('0xe6')](_0x2f9fe5,_0xd993('0xe9'));break;case'8':ut[_0xd993('0xe8')](_0x2f9fe5,0x8,'Congestion');rpcDb[_0xd993('0xe6')](_0x2f9fe5,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xd993('0xe8')](_0x2f9fe5,0x16,_0xd993('0xea'));rpcDb[_0xd993('0xe6')](_0x2f9fe5,_0xd993('0xeb'));break;default:ut[_0xd993('0xe8')](_0x2f9fe5,0xc,_0x27fb60[_0xd993('0xe5')]);rpcDb[_0xd993('0xe6')](_0x2f9fe5,_0xd993('0xec'));}ut[_0xd993('0x52')](_0x480dfa,_0xd993('0xed'));logger[_0xd993('0x28')](_0xd993('0xee'),_0x2f9fe5['uniqueid'],'\x20Queue',_0x480dfa[_0xd993('0x2c')],_0xd993('0x48'),_0x480dfa[_0xd993('0x2f')]);delete this[_0xd993('0x17')][_0x2f9fe5[_0xd993('0x92')]];};Preview[_0xd993('0xf')][_0xd993('0x7f')]=function(_0x36855e,_0x4bdaf9,_0x20fd4d){return cmHopperAdditionalPhone[_0xd993('0x7f')](_0x36855e,_0x4bdaf9,_0x20fd4d)[_0xd993('0x51')](logger[_0xd993('0x28')](_0xd993('0xef')));};Preview['prototype'][_0xd993('0x8e')]=function(_0x222da8,_0x162ef7,_0x52cafe){return cmHopperAdditionalPhone[_0xd993('0x8e')](_0x222da8,_0x162ef7,_0x52cafe)[_0xd993('0x51')](logger[_0xd993('0x28')](_0xd993('0xf0')));};Preview[_0xd993('0xf')][_0xd993('0x8d')]=function(_0x2248d8){return Promise[_0xd993('0xf1')]()[_0xd993('0x5c')](cmHopperAdditionalPhone[_0xd993('0x8d')](_0x2248d8))[_0xd993('0x51')](logger[_0xd993('0x28')](_0xd993('0xf2')));};Preview[_0xd993('0xf')][_0xd993('0xf3')]=function(_0x19dd73,_0x4536a3,_0x235ea6,_0x4d7ca1,_0x49e6bf){var _0x10e6d9=this;return new Promise(function(_0x162831,_0x30fd69){if(_[_0xd993('0x45')](_0x4536a3)||_[_0xd993('0x45')](_0x4536a3[_0xd993('0xf4')])||_[_0xd993('0x45')](_0x4536a3['phone'])||_[_0xd993('0x45')](_0x4536a3[_0xd993('0x4c')])){_0x30fd69(ut['message'](_0xd993('0xf5'),_0x4d7ca1,_0x49e6bf));return;}var _0x9f8d0d=uuid['v4']();var _0x326d02=_0x10e6d9[_0xd993('0x14')][_0x4536a3[_0xd993('0x46')][_0xd993('0x2c')]];var _0x20b667=_0x235ea6?_0x10e6d9[_0xd993('0x18')][_0x235ea6]['id']:undefined;_0x10e6d9[_0xd993('0x17')][_0x9f8d0d]=new Action(_0x4536a3,_0x326d02,_0x9f8d0d,_0x235ea6,_0x20b667);var _0x14e3b9=_0x10e6d9[_0xd993('0x17')][_0x9f8d0d];_0x14e3b9[_0xd993('0xaf')]=_0x4d7ca1;_0x14e3b9[_0xd993('0x89')]=_0x49e6bf;_0x14e3b9[_0xd993('0xf6')]=_0x235ea6;if(_['isEmpty'](_0x19dd73)){_0x10e6d9[_0xd993('0xf7')](_0x14e3b9,_0x326d02,_0x4536a3,_0x235ea6)[_0xd993('0x5c')](function(_0x5338db){logger[_0xd993('0x28')](_0xd993('0xf8'),_0xd993('0xf9')+_0x14e3b9['queue']+'\x20IdHopper:\x20'+_0x14e3b9[_0xd993('0x8c')],JSON['stringify'](_0x5338db));ami['emit']('custom:agentcalled',ut[_0xd993('0x7d')](_0x14e3b9,'called',_0x10e6d9['campaignsPreview'][_0x14e3b9['queue']]));_0x162831(ut[_0xd993('0x34')](_0xd993('0xfa')));})[_0xd993('0x51')](function(_0x373126){ut[_0xd993('0x36')](_0xd993('0xfb'),_0x373126);_0x30fd69(ut[_0xd993('0x34')](_0xd993('0xfc'),_0x4d7ca1,_0x49e6bf));});}else{_0x326d02['outboundBlacklistCallsDay']+=0x1;ut[_0xd993('0xfd')](_0x14e3b9);rpcDb[_0xd993('0xfe')](_0x14e3b9,_0xd993('0xff'));delete _0x10e6d9[_0xd993('0x17')][_0x9f8d0d];_0x30fd69(ut[_0xd993('0x34')](_0xd993('0x100'),_0x4d7ca1,_0x49e6bf));}});};Preview[_0xd993('0xf')][_0xd993('0x73')]=function(_0x245374){return!_[_0xd993('0x45')](_0x245374)&&!_[_0xd993('0x45')](_0x245374[_0xd993('0x2c')])&&!_[_0xd993('0x45')](_0x245374[_0xd993('0x101')])&&_0x245374['active']&&!_['isNil'](this[_0xd993('0x16')][util[_0xd993('0x2a')](_0xd993('0x102'),_0x245374[_0xd993('0x2c')])])&&!_[_0xd993('0x45')](this['trunks'][util[_0xd993('0x2a')]('SIP/%s',_0x245374[_0xd993('0x2c')])][_0xd993('0x4f')])&&(this['trunks'][util['format'](_0xd993('0x102'),_0x245374[_0xd993('0x2c')])][_0xd993('0x4f')]===_0xd993('0x103')||this[_0xd993('0x16')][util[_0xd993('0x2a')](_0xd993('0x102'),_0x245374[_0xd993('0x2c')])][_0xd993('0x4f')]===_0xd993('0x104'));};Preview[_0xd993('0xf')][_0xd993('0x62')]=function(_0x5e3fbd,_0x249cf9){return this[_0xd993('0x105')](_0x5e3fbd,_0x249cf9)[_0xd993('0x5c')](function(_0x59c86e){return _[_0xd993('0x4a')](_0x59c86e,[_0xd993('0x34')]);})[_0xd993('0x51')](function(_0x2e1eb3){if(_0x2e1eb3[_0xd993('0x106')]){rpcDb[_0xd993('0x107')](_0x5e3fbd);}if(_0x2e1eb3[_0xd993('0x101')]){rpcDb[_0xd993('0x65')](_0x5e3fbd);}throw _[_0xd993('0x4a')](_0x2e1eb3,[_0xd993('0x34')]);});};Preview[_0xd993('0xf')]['execRun']=function(_0x2f36c1,_0x5207eb){var _0xa1cbd1=this;var _0xfdee79,_0x276655;return rpcDb[_0xd993('0x108')](_0x2f36c1)[_0xd993('0x5c')](function(_0x144010){if(!_[_0xd993('0x45')](_0x144010[0x0])){_0x276655=_0x144010[0x0]['recallme']?![]:!![];_0xfdee79=_0x144010[0x0][_0xd993('0x109')]?!![]:![];_0xfdee79=_0x5207eb?!![]:_0xfdee79;}var _0x5de53d=_0xa1cbd1[_0xd993('0x10a')](_0x144010);if(_0x5de53d[_0xd993('0x10b')]){rpcDb['checkIsBlackList'](_['pick'](_0x144010[0x0],[_0xd993('0x4c'),'phone']))[_0xd993('0x5c')](function(_0x11ea6d){_0xa1cbd1[_0xd993('0xf3')](_0x11ea6d,_0x144010[0x0],_0x5207eb,_0x276655,_0xfdee79)[_0xd993('0x5c')](function(_0x44d74f){return _0x44d74f;})[_0xd993('0x51')](function(_0x155d88){throw _0x155d88;});})[_0xd993('0x51')](function(_0xe17c34){ut['logger'](_0xd993('0x10c'),_0xe17c34);throw ut[_0xd993('0x34')](_0xd993('0x10d'),_0x276655,_0xfdee79);});}else{throw ut[_0xd993('0x34')](_0x5de53d[_0xd993('0x34')],_0x276655,_0xfdee79);}})[_0xd993('0x51')](function(_0x1b5d16){ut[_0xd993('0x36')](_0xd993('0x10e'),_0x1b5d16);throw ut[_0xd993('0x34')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xd993('0xf')]['validateContact']=function(_0x225db4){if(_[_0xd993('0x45')](_0x225db4)||_[_0xd993('0x10f')](_0x225db4)||!_['isNil'](_0x225db4[0x0][_0xd993('0x60')])&&_['isNil'](_0x225db4[0x0][_0xd993('0x60')][_0xd993('0x2c')])){ut[_0xd993('0x36')](_0xd993('0x110'),_0x225db4);return{'isValid':![],'message':_0xd993('0x111')};}var _0x1df4e7=this[_0xd993('0x14')][_0x225db4[0x0][_0xd993('0x46')][_0xd993('0x2c')]];_0x1df4e7['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xd993('0x45')](_0x1df4e7)){ut[_0xd993('0x36')](_0xd993('0x112'),_0x1df4e7);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this[_0xd993('0x73')](_0x1df4e7['Trunk'])){ut[_0xd993('0x36')](_0xd993('0x113'),_0xd993('0x114')+_0x1df4e7['name']+_0xd993('0x115'));if(!this['isTrunkReachable'](_0x1df4e7[_0xd993('0x75')])){ut[_0xd993('0x36')](_0xd993('0x113'),_0x1df4e7[_0xd993('0x2c')]+_0xd993('0x116'));return{'isValid':![],'message':_0xd993('0x117')};}}if(!ut[_0xd993('0x71')](_0x1df4e7[_0xd993('0x41')])){ut[_0xd993('0x36')]('[Preview][validateContact][Campaign\x20Active]',_0x1df4e7['name']+_0xd993('0x118'));return{'isValid':![],'message':_0xd993('0x114')+_0x1df4e7['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0xd993('0x119')};};Preview[_0xd993('0xf')]['execCall']=function(_0x294165,_0x4f3fdb,_0x4a4fb3,_0x4fbbd5){var _0x462c84=this;return new Promise(function(_0x3ba33c,_0x100b03){var _0x3c3261=_0x294165[_0xd993('0x92')];var _0x42ed79=_0x462c84['isTrunkReachable'](_0x4f3fdb[_0xd993('0x74')])?util[_0xd993('0x2a')](_0xd993('0x11a'),_0x4f3fdb['Trunk']['name'],_[_0xd993('0x45')](_0x4f3fdb[_0xd993('0x11b')])?'':_0x4f3fdb[_0xd993('0x11b')][_0xd993('0x11c')]()||'',_0x4f3fdb[_0xd993('0x11d')]>0x0?_0x4a4fb3[_0xd993('0x11e')][_0xd993('0x11f')](_0x4f3fdb[_0xd993('0x11d')]):_0x4a4fb3[_0xd993('0x11e')]):util[_0xd993('0x2a')](_0xd993('0x11a'),_[_0xd993('0x45')](_0x4f3fdb[_0xd993('0x75')])?_0x4f3fdb[_0xd993('0x74')][_0xd993('0x2c')]:_0x4f3fdb[_0xd993('0x75')]['name'],_[_0xd993('0x45')](_0x4f3fdb[_0xd993('0x11b')])?'':_0x4f3fdb[_0xd993('0x11b')][_0xd993('0x11c')]()||'',_0x4f3fdb[_0xd993('0x11d')]>0x0?_0x4a4fb3[_0xd993('0x11e')][_0xd993('0x11f')](_0x4f3fdb[_0xd993('0x11d')]):_0x4a4fb3[_0xd993('0x11e')]);var _0x33d7f5=_0x462c84[_0xd993('0x73')](_0x4f3fdb['Trunk'])?ut[_0xd993('0x120')](_0x4f3fdb[_0xd993('0x74')][_0xd993('0x121')],_0x4f3fdb[_0xd993('0x122')],_0x4f3fdb['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xd993('0x123')](_0x4f3fdb[_0xd993('0x124')],_0x4f3fdb['dialRandomLastDigitCallerIdNumber']):_0x4f3fdb[_0xd993('0x124')]):ut[_0xd993('0x120')](_['isNil'](_0x4f3fdb[_0xd993('0x75')])?_0x4f3fdb[_0xd993('0x74')][_0xd993('0x121')]:_0x4f3fdb[_0xd993('0x75')]['callerid'],_0x4f3fdb[_0xd993('0x122')],_0x4f3fdb[_0xd993('0x125')]>0x0?ut[_0xd993('0x123')](_0x4f3fdb[_0xd993('0x124')],_0x4f3fdb[_0xd993('0x125')]):_0x4f3fdb[_0xd993('0x124')]);if(_0x33d7f5){_0x294165[_0xd993('0x126')]=ut[_0xd993('0x127')](_0x33d7f5);_0x294165['originatecalleridnum']=ut[_0xd993('0x128')](_0x33d7f5);}var _0x79becf=ut[_0xd993('0x129')](_0x4f3fdb,_0x4a4fb3,_0x42ed79,_0x33d7f5,_0x3c3261,_0x294165);var _0x192cc9=utils[_0xd993('0x12a')](_0x4a4fb3[_0xd993('0xf4')]);Object[_0xd993('0x12b')](_0x79becf,_0x192cc9);_[_0xd993('0x12c')](_0x294165,ut[_0xd993('0x12d')](_0x79becf));_0x294165['starttime']=moment()['format'](_0xd993('0x67'));_0x4f3fdb['variables']=_0x79becf;var _0x14724e=ut[_0xd993('0x12e')](_0x294165,_0x4f3fdb,_0x79becf,_0x294165[_0xd993('0x89')],_0x4fbbd5);return ami['Action'](_0x14724e)[_0xd993('0x5c')](function(_0x28fbd8){_0x4f3fdb['originated']+=0x1;logger[_0xd993('0x28')]('[originated][increment]',_0x3c3261,_0xd993('0x93'),_0x4f3fdb[_0xd993('0x2c')],'originated:\x20',_0x4f3fdb[_0xd993('0x2f')]);_0x3ba33c(_0x28fbd8);})[_0xd993('0x51')](function(_0x531f5a){ut[_0xd993('0xe8')](_0x294165,0xe,_0xd993('0x12f'));rpcDb['createAgentHistory'](_0x294165,'[originateFailure][logOriginateFailure]');_0x100b03(_0x531f5a);});});};Preview[_0xd993('0xf')][_0xd993('0x130')]=function(_0x345877){if(this[_0xd993('0x17')][_0x345877['linkedid']]){this[_0xd993('0x17')][_0x345877['linkedid']]['channel']=_0x345877[_0xd993('0x50')];}};Preview['prototype'][_0xd993('0x1a')]=function(_0x201588){var _0x5e2507=this;var _0x24c673=this['actions'][_0x201588[_0xd993('0x131')]];if(_0x24c673){if(_0x24c673[_0xd993('0xf6')]&&this['agents'][_0x24c673[_0xd993('0xf6')]]){ut['logLookAgent'](_0x24c673,this[_0xd993('0x18')][_0x24c673[_0xd993('0xf6')]][_0xd993('0x2c')],this[_0xd993('0x18')][_0x24c673['lookAgent']]['id']);}var _0x2931f6=_['clone'](_0x24c673);_0x2931f6[_0xd993('0x8f')]=moment()['format'](_0xd993('0x67'));var _0x1237ca=_0x5e2507[_0xd993('0x14')][_0x24c673[_0xd993('0x47')]];if(ut[_0xd993('0x132')](_0x201588[_0xd993('0x133')])){if(_0x24c673[_0xd993('0xaf')]){rpcDb[_0xd993('0x107')](_0x24c673[_0xd993('0x8c')]);}if(_0x24c673[_0xd993('0x89')]){rpcDb[_0xd993('0x65')](_0x24c673['idContact']);}ami[_0xd993('0x27')](_0xd993('0x134'),ut[_0xd993('0x7d')](_0x24c673,_0xd993('0x135'),this[_0xd993('0x14')][_0x24c673[_0xd993('0x47')]]));this['callProgressDetectingAgent'](_0x2931f6,_0x1237ca,_0x201588);}else{_0x24c673[_0xd993('0x66')]=moment()['format'](_0xd993('0x67'));ut['logAgent'](_0x2931f6,0x4,'Answer');rpcDb[_0xd993('0xe6')](_0x2931f6,_0xd993('0x136'));}}};Preview['prototype'][_0xd993('0x1d')]=function(_0xf77bd){var _0x182b1d=this[_0xd993('0x17')][_0xf77bd[_0xd993('0x8a')]];var _0x1f1c29;if(_0x182b1d){_0x1f1c29=this[_0xd993('0x14')][_0x182b1d[_0xd993('0x47')]];logger[_0xd993('0x28')](_0xd993('0x137'),_0xf77bd['linkedid'],_0xd993('0x93'),_0x1f1c29[_0xd993('0x2c')],_0xd993('0x49'),_0x1f1c29['pTalking']);}if(this[_0xd993('0x17')][_0xf77bd[_0xd993('0x8a')]]&&_0xf77bd[_0xd993('0x8a')]!==_0xf77bd['uniqueid']){if(_0xf77bd['cause']==='16'&&this[_0xd993('0x17')][_0xf77bd[_0xd993('0x8a')]][_0xd993('0x54')]){this['callProgressDetectingCustomer'](_0xf77bd,_0xf77bd['linkedid'],_0xf77bd[_0xd993('0x138')]);}else if(this[_0xd993('0x17')][_0xf77bd[_0xd993('0x8a')]][_0xd993('0x54')]){logger[_0xd993('0x28')](_0xd993('0x139'),_0xf77bd[_0xd993('0x8a')],_0xf77bd['cause'],'\x20Queue',_0x1f1c29[_0xd993('0x2c')],'pTalking:\x20',_0x1f1c29[_0xd993('0x30')]);this[_0xd993('0x78')](_0xf77bd,_0xf77bd['linkedid'],_0xf77bd[_0xd993('0x138')]);}}else if(_0x182b1d&&_[_0xd993('0x45')](_0x182b1d[_0xd993('0x13a')])&&_0x1f1c29[_0xd993('0x13b')]&&_0xf77bd['linkedid']===_0xf77bd['uniqueid']&&_['isNil'](_0xf77bd[_0xd993('0xe5')])&&_0xf77bd[_0xd993('0x138')]==='16'&&_0xf77bd[_0xd993('0x13c')]==='6'&&_[_0xd993('0xe4')](_0x182b1d[_0xd993('0x13d')])){if(_0x182b1d['unlockAgent']){rpcDb['unlockContact'](_0x182b1d['idContact']);}if(_0x182b1d[_0xd993('0x89')]){rpcDb[_0xd993('0x65')](_0x182b1d[_0xd993('0x8c')]);}_0xf77bd[_0xd993('0xe5')]='22';this[_0xd993('0x13e')](_0x182b1d,_0x1f1c29,_0xf77bd);}else if(_0x182b1d&&_0x182b1d[_0xd993('0x13d')]){if(_0xf77bd['cause']==='16'&&this[_0xd993('0x17')][_0xf77bd['linkedid']][_0xd993('0x54')]){logger[_0xd993('0x28')]('[syncHangup][talking][transfer]',_0xf77bd[_0xd993('0x8a')],_0xf77bd[_0xd993('0x138')],_0xd993('0x93'),_0x1f1c29[_0xd993('0x2c')],_0xd993('0x49'),_0x1f1c29[_0xd993('0x30')]);this[_0xd993('0x78')](_0xf77bd,_0xf77bd[_0xd993('0x8a')],_0xf77bd['cause']);}else if(this[_0xd993('0x17')][_0xf77bd[_0xd993('0x8a')]]['dialAnswer']){logger[_0xd993('0x28')](_0xd993('0x139'),_0xf77bd[_0xd993('0x8a')],_0xf77bd[_0xd993('0x138')],_0xd993('0x93'),_0x1f1c29[_0xd993('0x2c')],'pTalking:\x20',_0x1f1c29['pTalking']);this[_0xd993('0x78')](_0xf77bd,_0xf77bd[_0xd993('0x8a')],_0xf77bd[_0xd993('0x138')]);}}};Preview[_0xd993('0xf')][_0xd993('0x21')]=function(_0x3067b7){if(this[_0xd993('0x17')][_0x3067b7[_0xd993('0xe2')]]&&_0x3067b7[_0xd993('0xe2')]!==_0x3067b7[_0xd993('0x13f')]){this['callProgressDetectingCustomer'](_0x3067b7,_0x3067b7[_0xd993('0xe2')],_0x3067b7['dialstatus']);}};Preview['prototype'][_0xd993('0x1f')]=function(_0x33bed5){if(this[_0xd993('0x17')][_0x33bed5[_0xd993('0x8a')]]&&_0x33bed5[_0xd993('0x8a')]!==_0x33bed5[_0xd993('0x92')]&&!this['actions'][_0x33bed5[_0xd993('0x8a')]][_0xd993('0x54')]){if(_0x33bed5[_0xd993('0x138')]==='1'){this[_0xd993('0x78')](_0x33bed5,_0x33bed5[_0xd993('0x8a')],_0x33bed5[_0xd993('0x138')]);}}};Preview[_0xd993('0xf')]['addVariable']=function(_0x405ca1,_0x1ab0c9,_0x40083e){if(this[_0xd993('0x17')][_0x405ca1]){if(_[_0xd993('0x45')](this[_0xd993('0x17')][_0x405ca1][_0xd993('0x140')])){this['actions'][_0x405ca1][_0xd993('0x140')]={};}this[_0xd993('0x17')][_0x405ca1][_0xd993('0x140')][_0x1ab0c9]=_0x40083e;}};Preview['prototype'][_0xd993('0x141')]=function(_0x4ba412){try{if(!_[_0xd993('0x45')](_0x4ba412)){if(ut[_0xd993('0x142')](_[_0xd993('0x143')](_0x4ba412['variable'])[0x0])){this[_0xd993('0x144')](_0x4ba412[_0xd993('0x92')],_['keys'](_0x4ba412['variable'])[0x0],_0x4ba412[_0xd993('0x145')]);}}}catch(_0x2b840a){logger['error'](_0xd993('0x146'),util[_0xd993('0x147')](_0x2b840a,{'showHidden':![],'depth':null}));}};Preview[_0xd993('0xf')][_0xd993('0x24')]=function(_0x5a7143){if(_0x5a7143){if(this['actions'][_0x5a7143['transfertargetlinkedid']]){this[_0xd993('0x17')][_0x5a7143[_0xd993('0x148')]][_0xd993('0x13d')]=!![];}}};Preview[_0xd993('0xf')][_0xd993('0x25')]=function(_0x481b70){if(_0x481b70){if(this[_0xd993('0x17')][_0x481b70[_0xd993('0x149')]]){this[_0xd993('0x17')][_0x481b70[_0xd993('0x149')]][_0xd993('0x13d')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0xd929=['extractCalleridName','originatecalleridnum','extractCalleridNumber','assign','merge','variables','variablesAction','OriginateError','[originateFailure][logOriginateFailure]','syncOriginateResponse','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','callProgressDetectingCustomer','cause','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','destuniqueid','addVariable','keys','variable','value','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','defaults','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','blindtransfer','syncBlindTransfer','loopCampaigns','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','name','voice_queue_channel:remove','sendMessageOneNotActive','pTalking','paused','message','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','clearZombieChannels','type','outbound','setMessage','dialPreviewAutoRecallMe','recallMe','clearZombieChannel','enqueue','isNil','info','[clearZombieChannels][talking]','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','[Dialer][checkChannel][pTalking][Preview]','loggerError','[Dialer][checkChannel][Preview]','[action]','getContactRecallMe','agentReadyId','then','length','scheduledat','dialRecallMeTimeout','Agent','logger2','[RecallMe]','catch','disableContact','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','dialActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','Global','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','unlockAgent','activeContact','linkedid','ANSWER','YYYY-MM-DD\x20HH:mm:ss','answertime','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','[syncHangup][talking][decrement]','\x20Queue','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','additional','cloneAction','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','[callProgressDetectingCustomer][logBusy]','scheduledAt','incrementPreviewCounters','idContact','swapAdditionalPhones','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','outboundRejectCallsDay','countagentrejectretry','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer]','originated','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','logAgent','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','updateOriginated','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','logger','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','run','execRun','getContactPreview','recallme','validateContact','isValid','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','[Preview][validateContact][Empty\x20Campaign]','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname'];(function(_0x2b2c64,_0x2e13a7){var _0x471d9b=function(_0x3a1aca){while(--_0x3a1aca){_0x2b2c64['push'](_0x2b2c64['shift']());}};_0x471d9b(++_0x2e13a7);}(_0xd929,0x167));var _0x9d92=function(_0x257913,_0x4c2bd2){_0x257913=_0x257913-0x0;var _0x49ca5d=_0xd929[_0x257913];return _0x49ca5d;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x9d92('0x0'));var moment=require(_0x9d92('0x1'));var Redis=require(_0x9d92('0x2'));var config=require(_0x9d92('0x3'));var logger=require(_0x9d92('0x4'))(_0x9d92('0x5'));var loggerAction=require(_0x9d92('0x4'))(_0x9d92('0x6'));var ami=require(_0x9d92('0x7'));var rpcDb=require(_0x9d92('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x9d92('0x9'));var ut=require(_0x9d92('0xa'));var utils=require(_0x9d92('0xb'));config[_0x9d92('0xc')]=_[_0x9d92('0xd')](config[_0x9d92('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9d92('0xc')]));var Sequence=function(){};Sequence[_0x9d92('0xe')]['enqueue']=function(_0x3aaac1){this['tail']=this[_0x9d92('0xf')]?this['tail'][_0x9d92('0x10')](_0x3aaac1):_0x3aaac1();};function Preview(_0x7c7e5b){this[_0x9d92('0x11')]=new Sequence();this[_0x9d92('0x12')]=_0x7c7e5b[_0x9d92('0x13')];this[_0x9d92('0x14')]=_0x7c7e5b[_0x9d92('0x14')];this[_0x9d92('0x15')]={};this[_0x9d92('0x16')]=_0x7c7e5b[_0x9d92('0x16')];this[_0x9d92('0x17')]=0x0;ami['on'](_0x9d92('0x18'),this['syncOriginateResponse'][_0x9d92('0x19')](this));ami['on'](_0x9d92('0x1a'),this[_0x9d92('0x1b')]['bind'](this));ami['on']('hanguprequest',this[_0x9d92('0x1c')][_0x9d92('0x19')](this));ami['on'](_0x9d92('0x1d'),this[_0x9d92('0x1e')][_0x9d92('0x19')](this));ami['on']('newexten',this[_0x9d92('0x1f')][_0x9d92('0x19')](this));ami['on'](_0x9d92('0x20'),this[_0x9d92('0x21')][_0x9d92('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer']['bind'](this));ami['on'](_0x9d92('0x22'),this[_0x9d92('0x23')]['bind'](this));this[_0x9d92('0x24')](this[_0x9d92('0x12')]);}function emit(_0x39fa37,_0x1d321f,_0x38ba9b){io['to'](_0x39fa37)[_0x9d92('0x25')](_0x1d321f,_0x38ba9b);}function emitVoiceQueueChannelRemove(_0x2a246c){logger['info'](_0x9d92('0x26'),JSON[_0x9d92('0x27')](_0x2a246c));emit(util[_0x9d92('0x28')]('voice:queue:%s',_0x2a246c[_0x9d92('0x29')]),_0x9d92('0x2a'),_0x2a246c);io[_0x9d92('0x25')]('voice_queue_presence:remove',_0x2a246c);}function notSendMessagesQueue(_0x11fb48){if(_0x11fb48[_0x9d92('0x2b')]){if(_0x11fb48['originated']===0x0&&_0x11fb48[_0x9d92('0x2c')]===0x0){_0x11fb48['sendMessageOneNotActive']=![];_0x11fb48['available']=0x0;_0x11fb48[_0x9d92('0x2d')]=0x0;_0x11fb48[_0x9d92('0x2e')]=utils[_0x9d92('0x2f')][_0x9d92('0x30')];ut['logger'](_0x9d92('0x31'),_0x11fb48['name']+_0x9d92('0x32'));}else{_0x11fb48[_0x9d92('0x2e')]=utils['CAMPAIGN_STATUS'][_0x9d92('0x33')];ut['logger']('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x11fb48['name']+_0x9d92('0x34'));}}}Preview[_0x9d92('0xe')][_0x9d92('0x24')]=function(){var _0x2b5091=this;setInterval(function(){_0x2b5091[_0x9d92('0x35')]();},0x7cf);};Preview['prototype'][_0x9d92('0x35')]=function(){var _0x410186=this[_0x9d92('0x12')];this[_0x9d92('0x17')]+=0x1;for(var _0x4a9fc7 in _0x410186){if(_0x410186[_0x9d92('0x36')](_0x4a9fc7)&&(_0x410186[_0x4a9fc7][_0x9d92('0x37')]===_0x9d92('0x5')||_0x410186[_0x4a9fc7][_0x9d92('0x37')]===_0x9d92('0x38'))&&_0x410186[_0x4a9fc7]['type']==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0x9d92('0x17')]=0x0;this[_0x9d92('0x39')]();}}if(_0x410186[_0x9d92('0x36')](_0x4a9fc7)&&_0x410186[_0x4a9fc7][_0x9d92('0x37')]===_0x9d92('0x5')&&_0x410186[_0x4a9fc7][_0x9d92('0x3a')]===_0x9d92('0x3b')){if(_0x410186[_0x4a9fc7]['dialActive']){this[_0x9d92('0x3c')](_0x410186[_0x4a9fc7]);if(_0x410186[_0x4a9fc7][_0x9d92('0x3d')])this[_0x9d92('0x3e')](_0x410186[_0x4a9fc7]);}else{notSendMessagesQueue(_0x410186[_0x4a9fc7]);}}}};Preview[_0x9d92('0xe')][_0x9d92('0x3f')]=function(_0x17f473){var _0x33d395=this;this[_0x9d92('0x11')][_0x9d92('0x40')](function(){if(!_[_0x9d92('0x41')](_0x33d395['actions'][_0x17f473])){loggerAction[_0x9d92('0x42')](_0x9d92('0x43'),_0x17f473,_0x9d92('0x44'),_0x33d395[_0x9d92('0x15')][_0x17f473]['queue'],_0x9d92('0x45'),JSON[_0x9d92('0x27')](_0x33d395['campaignsPreview'][_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x46')]]['originated']),_0x9d92('0x47'),JSON['stringify'](_0x33d395[_0x9d92('0x12')][_0x33d395['actions'][_0x17f473]['queue']][_0x9d92('0x2c')]),JSON[_0x9d92('0x27')](_0x33d395['actions'][_0x17f473][_0x9d92('0x48')]),JSON[_0x9d92('0x27')](_[_0x9d92('0x49')](_0x33d395[_0x9d92('0x15')][_0x17f473],[_0x9d92('0x4a'),_0x9d92('0x4b'),_0x9d92('0x4c'),_0x9d92('0x4d')])));return ami[_0x9d92('0x4e')]({'action':_0x9d92('0x4f'),'channel':_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x50')]})['catch'](function(_0x18df80){if(_0x18df80['message']===_0x9d92('0x51')){setTimeout(function(){if(_0x33d395[_0x9d92('0x15')][_0x17f473]){ut['updateOriginated'](_0x33d395[_0x9d92('0x12')][_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x46')]],_0x9d92('0x52'));if(_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x48')]===!![]){ut[_0x9d92('0x53')](_0x33d395[_0x9d92('0x12')][_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x46')]],'[clearZombieChannel]');ut['loggerError'](_0x9d92('0x54')+_0x17f473,_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x46')]);}ut[_0x9d92('0x55')](_0x9d92('0x56')+_0x17f473,_0x33d395[_0x9d92('0x15')][_0x17f473][_0x9d92('0x46')]);delete _0x33d395['actions'][_0x17f473];}},0x2328);}});}});};Preview[_0x9d92('0xe')][_0x9d92('0x39')]=function(){var _0x4469b0=this;loggerAction[_0x9d92('0x42')](_0x9d92('0x57'),_['size'](this[_0x9d92('0x15')]));for(var _0x1d24e2 in this[_0x9d92('0x15')]){if(_0x4469b0[_0x9d92('0x15')][_0x9d92('0x36')](_0x1d24e2)){_0x4469b0[_0x9d92('0x3f')](_0x1d24e2);}}};Preview[_0x9d92('0xe')][_0x9d92('0x3e')]=function(_0x2d2839){var _0x4ad93c=this;rpcDb[_0x9d92('0x58')](_0x2d2839['id'],ut[_0x9d92('0x59')](this['agents']))[_0x9d92('0x5a')](function(_0x56c8d5){if(!_['isNil'](_0x56c8d5)){for(var _0x7128b9=0x0;_0x7128b9<_0x56c8d5[_0x9d92('0x5b')];_0x7128b9+=0x1){if(ut['getDiff'](_0x56c8d5[_0x7128b9][_0x9d92('0x5c')])<_0x2d2839[_0x9d92('0x5d')]*0x3c){if(_0x56c8d5[_0x7128b9][_0x9d92('0x5e')]&&!_0x56c8d5[_0x7128b9][_0x9d92('0x5e')]['voicePause']){_0x4ad93c['run'](_0x56c8d5[_0x7128b9]['id'])[_0x9d92('0x5a')](ut[_0x9d92('0x5f')](_0x9d92('0x60')))[_0x9d92('0x61')](ut[_0x9d92('0x5f')](_0x9d92('0x60')));}else{rpcDb[_0x9d92('0x62')](_0x56c8d5[_0x7128b9]['id']);}}else{var _0x5b1578=new Action(_0x56c8d5[_0x7128b9],_0x2d2839);_0x5b1578[_0x9d92('0x63')]=moment()[_0x9d92('0x28')]('YYYY-MM-DD\x20HH:mm:ss');_0x2d2839['outboundReCallsDay']+=0x1;ut[_0x9d92('0x64')](_0x5b1578,0x17,_0x9d92('0x65'));if(_0x2d2839[_0x9d92('0x66')]){rpcDb[_0x9d92('0x67')](ut[_0x9d92('0x68')](_0x56c8d5[_0x7128b9]));rpcDb['createCustomerHistory'](_0x5b1578,_0x9d92('0x69'));}else{ut[_0x9d92('0x64')](_0x5b1578,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x5b1578,_0x9d92('0x6a'));rpcDb[_0x9d92('0x6b')](_0x5b1578,'[HistoryRecallClose]');}}}}})[_0x9d92('0x61')](ut[_0x9d92('0x5f')](_0x9d92('0x6c')));};Preview[_0x9d92('0xe')][_0x9d92('0x3c')]=function(_0x317103){_0x317103['sendMessageOneNotActive']=!![];if(ut[_0x9d92('0x6d')](_0x317103[_0x9d92('0x6e')])){_0x317103[_0x9d92('0x2e')]=utils[_0x9d92('0x2f')][_0x9d92('0x6f')];}else if(!ut['isActive'](_0x317103[_0x9d92('0x70')])){_0x317103[_0x9d92('0x2e')]=utils[_0x9d92('0x2f')][_0x9d92('0x30')];}else if(!this[_0x9d92('0x71')](_0x317103[_0x9d92('0x72')])){if(!this[_0x9d92('0x71')](_0x317103['TrunkBackup'])){_0x317103[_0x9d92('0x2e')]=utils[_0x9d92('0x2f')][_0x9d92('0x73')];}else{_0x317103[_0x9d92('0x2e')]=utils['CAMPAIGN_STATUS'][_0x9d92('0x74')];}}else{_0x317103['message']=utils[_0x9d92('0x2f')][_0x9d92('0x74')];}};Preview[_0x9d92('0xe')]['callProgressDetectingCustomer']=function(_0x49dbc2,_0x4e2fed,_0x579274){var _0x4bca1d=this;var _0x3817b7=this[_0x9d92('0x15')][_0x4e2fed];var _0x415755=this[_0x9d92('0x12')][_0x3817b7[_0x9d92('0x46')]];var _0x2471c3;var _0x35307d=![];var _0x2c45d8=0x2;var _0x3b9c1c=0x3;if(_0x415755){switch(_0x579274){case'1':_0x415755[_0x9d92('0x75')]+=0x1;_0x3817b7[_0x9d92('0x76')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut['totalGlobal'](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x0,_0x9d92('0x78'));ami[_0x9d92('0x25')](_0x9d92('0x79'),ut[_0x9d92('0x7a')](_0x3817b7,_0x9d92('0x7b')));rpcDb[_0x9d92('0x7c')](_0x3817b7,'[callProgressDetectingCustomer][logNoSuch]');_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'0',_0x415755)['then'](function(_0x47795b){_0x35307d=_0x47795b['additional']==0x1;_0x2c45d8=_0x415755[_0x9d92('0x7e')];_0x3b9c1c=_0x415755[_0x9d92('0x7f')];if(!_0x35307d){if(ut[_0x9d92('0x80')](_0x3817b7)>=_0x415755['dialGlobalMaxRetry']){_0x2471c3=ut['cloneAction'](_0x3817b7,0xf,_0x9d92('0x81'));rpcDb[_0x9d92('0x6b')](_0x2471c3,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3817b7[_0x9d92('0x76')]>=_0x415755[_0x9d92('0x82')]){rpcDb[_0x9d92('0x6b')](_0x3817b7,_0x9d92('0x83'));}else{rpcDb[_0x9d92('0x84')](ut['scheduledAt'](_0x3817b7,'countnosuchnumberretry',_0x415755[_0x9d92('0x7e')]),_0x3817b7[_0x9d92('0x85')],_0x3817b7[_0x9d92('0x86')]);}}delete this['actions'][_0x49dbc2[_0x9d92('0x87')]];}else{_0x3817b7['countnosuchnumberretry']++;logger['info']('actioncountonusuch',_0x3817b7['countnosuchnumberretry']);logger['info']('id',_0x3817b7['idContact']);_0x4bca1d['incrementPreviewCounters']({'id':_0x3817b7['idContact'],'field':{'countnosuchnumberretry':_0x3817b7[_0x9d92('0x76')]}})['then'](function(){_0x4bca1d['swapAdditionalPhones'](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});break;case _0x9d92('0x88'):var _0x4021e4=moment()[_0x9d92('0x28')](_0x9d92('0x89'));_0x3817b7['responsetime']=_0x4021e4;_0x3817b7[_0x9d92('0x8a')]=_0x4021e4;_0x3817b7[_0x9d92('0x48')]=!![];_0x415755[_0x9d92('0x2c')]+=0x1;logger[_0x9d92('0x42')](_0x9d92('0x8b'),_0x3817b7[_0x9d92('0x8c')],'\x20Queue',_0x415755[_0x9d92('0x29')],_0x9d92('0x47'),_0x415755[_0x9d92('0x2c')]);ami[_0x9d92('0x25')](_0x9d92('0x8d'),ut[_0x9d92('0x7a')](_0x3817b7,_0x9d92('0x8e'),this['campaignsPreview'][_0x3817b7[_0x9d92('0x46')]]));if(_0x415755[_0x9d92('0x8f')]){ami['emit']('custom:agentConnectPreview',ut[_0x9d92('0x90')](_0x3817b7));}break;case'16':ami['emit'](_0x9d92('0x91'),ut[_0x9d92('0x7a')](_0x3817b7,'complete',this[_0x9d92('0x12')][_0x3817b7['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3817b7,_0x9d92('0x92')));_0x415755[_0x9d92('0x93')]+=0x1;_0x415755[_0x9d92('0x94')]+=0x1;_0x415755[_0x9d92('0x95')]+=0x1;ut[_0x9d92('0x53')](_0x415755,_0x9d92('0x96'));_0x3817b7[_0x9d92('0x77')]=ut['totalGlobal'](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x4,_0x9d92('0x97'));rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0x98'));rpcDb['createCustomerFinal'](_0x3817b7,_0x9d92('0x99'));rpcDb[_0x9d92('0x9a')](_0x3817b7);_0x415755[_0x9d92('0x9b')]+=_0x3817b7['talktime'];_0x415755['sumBillable']+=_0x3817b7['talktime'];logger[_0x9d92('0x42')](_0x9d92('0x9c'),_0x3817b7['uniqueid'],_0x9d92('0x9d'),_0x415755[_0x9d92('0x29')],_0x9d92('0x47'),_0x415755[_0x9d92('0x2c')]);delete this[_0x9d92('0x15')][_0x49dbc2[_0x9d92('0x87')]];break;case _0x9d92('0x9e'):_0x415755[_0x9d92('0x9f')]+=0x1;_0x3817b7[_0x9d92('0xa0')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut[_0x9d92('0x80')](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x5,'Busy');_0x2c45d8=_0x415755[_0x9d92('0xa1')];_0x3b9c1c=_0x415755[_0x9d92('0x7f')];ami[_0x9d92('0x25')](_0x9d92('0xa2'),ut[_0x9d92('0x7a')](_0x3817b7,_0x9d92('0xa3')));rpcDb['createCustomerHistory'](_0x3817b7,'[callProgressDetectingCustomer][logBusy]');_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'5',_0x415755)[_0x9d92('0x5a')](function(_0x19805d){_0x35307d=_0x19805d[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut[_0x9d92('0x80')](_0x3817b7)>=_0x415755['dialGlobalMaxRetry']){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0xf,_0x9d92('0x81'));rpcDb[_0x9d92('0x6b')](_0x2471c3,_0x9d92('0xa6'));}else{if(_0x3817b7[_0x9d92('0xa0')]>=_0x415755[_0x9d92('0xa7')]){rpcDb[_0x9d92('0x6b')](_0x3817b7,_0x9d92('0xa8'));}else{rpcDb[_0x9d92('0x84')](ut[_0x9d92('0xa9')](_0x3817b7,'countbusyretry',_0x415755[_0x9d92('0xa1')]),_0x3817b7[_0x9d92('0x85')],_0x3817b7['activeContact']);}}}else{_0x3817b7['countbusyretry']++;_0x4bca1d[_0x9d92('0xaa')]({'id':_0x3817b7[_0x9d92('0xab')],'field':{'countbusyretry':_0x3817b7[_0x9d92('0xa0')]}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});break;case _0x9d92('0xad'):_0x415755['outboundNoAnswerCallsDay']+=0x1;_0x3817b7[_0x9d92('0xae')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut['totalGlobal'](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x3,_0x9d92('0xaf'));_0x2c45d8=_0x415755[_0x9d92('0xb0')];_0x3b9c1c=_0x415755[_0x9d92('0x7f')];var _0xce3ed8=ut[_0x9d92('0xb1')](_0x3817b7,_0x415755);ami[_0x9d92('0x25')](_0x9d92('0xb2'),_0xce3ed8);rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0xb3'));_0x4bca1d['verifyAdditionalPhones'](_0x3817b7,'3',_0x415755)['then'](function(_0x1ce9d4){_0x35307d=_0x1ce9d4['additional']==0x1;if(!_0x35307d){if(ut[_0x9d92('0x80')](_0x3817b7)>=_0x415755[_0x9d92('0xb4')]){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0xf,'Global');rpcDb[_0x9d92('0x6b')](_0x2471c3,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x3817b7[_0x9d92('0xae')]>=_0x415755['dialNoAnswerMaxRetry']){rpcDb[_0x9d92('0x6b')](_0x3817b7,_0x9d92('0xb3'));}else{rpcDb[_0x9d92('0x84')](ut[_0x9d92('0xa9')](_0x3817b7,_0x9d92('0xae'),_0x415755[_0x9d92('0xb0')]),_0x3817b7['unlockAgent'],_0x3817b7[_0x9d92('0x86')]);}}}else{_0x3817b7[_0x9d92('0xae')]++;_0x4bca1d[_0x9d92('0xaa')]({'id':_0x3817b7[_0x9d92('0xab')],'field':{'countnoanswerretry':_0x3817b7['countnoanswerretry']}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});break;case _0x9d92('0xb5'):_0x415755[_0x9d92('0xb6')]+=0x1;_0x3817b7[_0x9d92('0xb7')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut[_0x9d92('0x80')](_0x3817b7);ut['logCustomer'](_0x3817b7,0x8,_0x9d92('0xb8'));_0x2c45d8=_0x415755[_0x9d92('0xb9')];_0x3b9c1c=_0x415755[_0x9d92('0x7f')];ami['emit'](_0x9d92('0xba'),ut[_0x9d92('0x7a')](_0x3817b7,'congestion'));rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0xbb'));_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'8',_0x415755)[_0x9d92('0x5a')](function(_0x4b4394){_0x35307d=_0x4b4394[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut['totalGlobal'](_0x3817b7)>=_0x415755[_0x9d92('0xb4')]){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0xf,_0x9d92('0x81'));rpcDb['createCustomerFinal'](_0x2471c3,_0x9d92('0xbc'));}else{if(_0x3817b7[_0x9d92('0xb7')]>=_0x415755['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0x3817b7,_0x9d92('0xbb'));}else{rpcDb[_0x9d92('0x84')](ut[_0x9d92('0xa9')](_0x3817b7,_0x9d92('0xb7'),_0x415755['dialBusyRetryFrequency']),_0x3817b7['unlockAgent'],_0x3817b7[_0x9d92('0x86')]);}}}else{_0x3817b7[_0x9d92('0xb7')]++;_0x4bca1d[_0x9d92('0xaa')]({'id':_0x3817b7['idContact'],'field':{'countcongestionretry':_0x3817b7[_0x9d92('0xb7')]}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)['then'](function(){});});}});break;case _0x9d92('0xbd'):_0x415755[_0x9d92('0xbe')]+=0x1;_0x3817b7[_0x9d92('0xbf')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut[_0x9d92('0x80')](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x14,'AgentReject');_0x2c45d8=_0x415755[_0x9d92('0xc0')];_0x3b9c1c=_0x415755[_0x9d92('0x7f')];ami[_0x9d92('0x25')]('custom:agentreject',ut[_0x9d92('0x7a')](_0x3817b7,_0x9d92('0xc1')));rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0xc2'));_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'20',_0x415755)['then'](function(_0x34c77a){_0x35307d=_0x34c77a[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut[_0x9d92('0x80')](_0x3817b7)>=_0x415755[_0x9d92('0xb4')]){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0x14,'AgentReject');rpcDb[_0x9d92('0x6b')](_0x2471c3,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x3817b7[_0x9d92('0xbf')]>=_0x415755[_0x9d92('0xc3')]){rpcDb[_0x9d92('0x6b')](_0x3817b7,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3817b7,'countagentrejectretry',_0x415755['dialAgentRejectRetryFrequency']),_0x3817b7['unlockAgent'],_0x3817b7[_0x9d92('0x86')]);}}}else{_0x3817b7['countnoanswerretry']++;_0x4bca1d['incrementPreviewCounters']({'id':_0x3817b7[_0x9d92('0xab')],'field':{'countnoanswerretry':_0x3817b7[_0x9d92('0xae')]}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});break;case _0x9d92('0xc4'):_0x415755['outboundAbandonedCallsDay']+=0x1;_0x3817b7[_0x9d92('0xc5')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut[_0x9d92('0x80')](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0xb,_0x9d92('0xc6'));rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0xc7'));_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'11',_0x415755)[_0x9d92('0x5a')](function(_0x188701){_0x35307d=_0x188701[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut['totalGlobal'](_0x3817b7)>=_0x415755[_0x9d92('0xb4')]){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0xf,_0x9d92('0x81'));rpcDb[_0x9d92('0x6b')](_0x2471c3,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3817b7[_0x9d92('0xc8')]>=_0x415755[_0x9d92('0xc9')]){rpcDb[_0x9d92('0x6b')](_0x3817b7,_0x9d92('0xc7'));}else{rpcDb[_0x9d92('0x84')](ut[_0x9d92('0xa9')](_0x3817b7,'countabandonedretry',_0x415755[_0x9d92('0xca')]),_0x3817b7[_0x9d92('0x85')],_0x3817b7[_0x9d92('0x86')]);}}}else{_0x3817b7[_0x9d92('0xae')]++;_0x4bca1d[_0x9d92('0xaa')]({'id':_0x3817b7[_0x9d92('0xab')],'field':{'countnoanswerretry':_0x3817b7[_0x9d92('0xae')]}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});break;case'18':_0x415755[_0x9d92('0xcb')]+=0x1;_0x3817b7[_0x9d92('0xcc')]+=0x1;_0x3817b7[_0x9d92('0x77')]=ut[_0x9d92('0x80')](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x12,_0x49dbc2['cause-txt']||_0x49dbc2[_0x9d92('0xcd')]);ami[_0x9d92('0x25')](_0x9d92('0xce'),ut[_0x9d92('0x7a')](_0x3817b7,_0x9d92('0xcf')));rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0xd0'));_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'18',_0x415755)[_0x9d92('0x5a')](function(_0x23401f){_0x35307d=_0x23401f[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut['totalGlobal'](_0x3817b7)>=_0x415755['dialGlobalMaxRetry']){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0x12,_0x9d92('0x81'));rpcDb[_0x9d92('0x6b')](_0x2471c3,_0x9d92('0xd0'));}else{rpcDb[_0x9d92('0x6b')](_0x3817b7,_0x9d92('0xd0'));}}else{_0x3817b7[_0x9d92('0xae')]++;_0x4bca1d[_0x9d92('0xaa')]({'id':_0x3817b7[_0x9d92('0xab')],'field':{'countnoanswerretry':_0x3817b7['countnoanswerretry']}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});delete this[_0x9d92('0x15')][_0x49dbc2[_0x9d92('0x87')]];break;case'19':_0x415755['outboundUnknownCallsDay']+=0x1;_0x3817b7[_0x9d92('0x77')]=ut[_0x9d92('0x80')](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0x13,_0x49dbc2[_0x9d92('0xd1')]||_0x49dbc2[_0x9d92('0xcd')]);ami[_0x9d92('0x25')](_0x9d92('0xce'),ut[_0x9d92('0x7a')](_0x3817b7,'amd'));rpcDb[_0x9d92('0x7c')](_0x3817b7,_0x9d92('0xd2'));_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'18',_0x415755)[_0x9d92('0x5a')](function(_0x53361f){_0x35307d=_0x53361f[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut[_0x9d92('0x80')](_0x3817b7)>=_0x415755[_0x9d92('0xb4')]){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0xf,_0x9d92('0x81'));rpcDb[_0x9d92('0x6b')](_0x2471c3,_0x9d92('0xd2'));}else{rpcDb[_0x9d92('0x6b')](_0x3817b7,_0x9d92('0xd2'));}}else{_0x3817b7[_0x9d92('0xae')]++;_0x4bca1d[_0x9d92('0xaa')]({'id':_0x3817b7[_0x9d92('0xab')],'field':{'countnoanswerretry':_0x3817b7[_0x9d92('0xae')]}})[_0x9d92('0x5a')](function(){_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});});}});delete this[_0x9d92('0x15')][_0x49dbc2['linkedid']];break;default:if(_0x3817b7[_0x9d92('0x48')]){ut[_0x9d92('0x53')](_0x415755,_0x9d92('0xd3'));ut['loggerError'](_0x9d92('0xd4')+_0x415755[_0x9d92('0x29')],_0x49dbc2);}_0x415755['outboundUnknownCallsDay']+=0x1;_0x3817b7[_0x9d92('0x77')]=ut['totalGlobal'](_0x3817b7);ut[_0x9d92('0x64')](_0x3817b7,0xc,_0x49dbc2[_0x9d92('0xd1')]||_0x49dbc2[_0x9d92('0xcd')]);_0x2c45d8=_0x415755[_0x9d92('0xc0')];_0x3b9c1c=_0x415755[_0x9d92('0x7f')];rpcDb['createCustomerHistory'](_0x3817b7,_0x9d92('0xd5'));_0x4bca1d[_0x9d92('0x7d')](_0x3817b7,'20',_0x415755)[_0x9d92('0x5a')](function(_0x280425){_0x35307d=_0x280425[_0x9d92('0xa4')]==0x1;if(!_0x35307d){if(ut[_0x9d92('0x80')](_0x3817b7)>=_0x415755['dialGlobalMaxRetry']){_0x2471c3=ut[_0x9d92('0xa5')](_0x3817b7,0xf,_0x9d92('0x81'));rpcDb[_0x9d92('0x6b')](_0x2471c3,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x9d92('0x6b')](_0x3817b7,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0x9d92('0x15')][_0x49dbc2[_0x9d92('0x87')]];}else{_0x4bca1d[_0x9d92('0xac')](_0x3817b7,_0x2c45d8,_0x3b9c1c)[_0x9d92('0x5a')](function(){});}});}if(!(_0x3817b7[_0x9d92('0x48')]&&_0x579274==='16')){ut['updateOriginated'](_0x415755,_0x9d92('0xd6'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x3817b7['uniqueid'],'\x20Queue',_0x415755['name'],_0x9d92('0x45'),_0x415755[_0x9d92('0xd7')]);}if(_0x579274!==_0x9d92('0x88')){delete this[_0x9d92('0x15')][_0x49dbc2['linkedid']];delete this[_0x9d92('0x15')][_0x49dbc2[_0x9d92('0xd8')]];}_0x415755[_0x9d92('0xd9')]=!![];}};Preview[_0x9d92('0xe')][_0x9d92('0xda')]=function(_0x457e5d,_0x1d3ecc,_0x14e278){if(_[_0x9d92('0xdb')](_0x1d3ecc)&&'object'!==typeof _0x1d3ecc){return;}if(_[_0x9d92('0xdb')](_0x14e278)&&_0x9d92('0xdc')!==typeof _0x14e278){return;}switch(_0x14e278[_0x9d92('0xdd')]){case'0':ut['logAgent'](_0x457e5d,0x0,_0x9d92('0x78'));rpcDb[_0x9d92('0xde')](_0x457e5d,_0x9d92('0xdf'));break;case'3':ut[_0x9d92('0xe0')](_0x457e5d,0x3,_0x9d92('0xaf'));rpcDb[_0x9d92('0xde')](_0x457e5d,_0x9d92('0xe1'));break;case'5':ut['logAgent'](_0x457e5d,0x5,_0x9d92('0xe2'));rpcDb['createAgentHistory'](_0x457e5d,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x9d92('0xe0')](_0x457e5d,0x8,'Congestion');rpcDb[_0x9d92('0xde')](_0x457e5d,_0x9d92('0xe3'));break;case'22':ut['logAgent'](_0x457e5d,0x16,_0x9d92('0xe4'));rpcDb[_0x9d92('0xde')](_0x457e5d,_0x9d92('0xe5'));break;default:ut[_0x9d92('0xe0')](_0x457e5d,0xc,_0x14e278[_0x9d92('0xdd')]);rpcDb['createAgentHistory'](_0x457e5d,_0x9d92('0xe3'));}ut[_0x9d92('0xe6')](_0x1d3ecc,_0x9d92('0xe7'));logger[_0x9d92('0x42')](_0x9d92('0xe8'),_0x457e5d[_0x9d92('0x8c')],_0x9d92('0x9d'),_0x1d3ecc[_0x9d92('0x29')],_0x9d92('0x45'),_0x1d3ecc[_0x9d92('0xd7')]);delete this[_0x9d92('0x15')][_0x457e5d[_0x9d92('0x8c')]];};Preview['prototype'][_0x9d92('0x7d')]=function(_0x427802,_0x4540e9,_0x59c221){return cmHopperAdditionalPhone[_0x9d92('0x7d')](_0x427802,_0x4540e9,_0x59c221)['catch'](logger[_0x9d92('0x42')](_0x9d92('0xe9')));};Preview[_0x9d92('0xe')][_0x9d92('0xac')]=function(_0x1e8e00,_0x209607,_0x1b4fff){return cmHopperAdditionalPhone[_0x9d92('0xac')](_0x1e8e00,_0x209607,_0x1b4fff)[_0x9d92('0x61')](logger[_0x9d92('0x42')](_0x9d92('0xea')));};Preview['prototype'][_0x9d92('0xaa')]=function(_0x311b7f){return Promise[_0x9d92('0xeb')]()[_0x9d92('0x5a')](cmHopperAdditionalPhone[_0x9d92('0xaa')](_0x311b7f))[_0x9d92('0x61')](logger[_0x9d92('0x42')](_0x9d92('0xec')));};Preview[_0x9d92('0xe')][_0x9d92('0xed')]=function(_0x5d554b,_0x2bf889,_0x25634f,_0x512869,_0x545d50){var _0x5f5a14=this;return new Promise(function(_0x1d2926,_0x24972b){if(_[_0x9d92('0x41')](_0x2bf889)||_['isNil'](_0x2bf889[_0x9d92('0xee')])||_['isNil'](_0x2bf889[_0x9d92('0xef')])||_[_0x9d92('0x41')](_0x2bf889['VoiceQueueId'])){_0x24972b(ut[_0x9d92('0x2e')](_0x9d92('0xf0'),_0x512869,_0x545d50));return;}var _0x5da684=uuid['v4']();var _0x4ec002=_0x5f5a14['campaignsPreview'][_0x2bf889[_0x9d92('0x44')][_0x9d92('0x29')]];var _0x280e52=_0x25634f?_0x5f5a14[_0x9d92('0x16')][_0x25634f]['id']:undefined;_0x5f5a14[_0x9d92('0x15')][_0x5da684]=new Action(_0x2bf889,_0x4ec002,_0x5da684,_0x25634f,_0x280e52);var _0x3aec9d=_0x5f5a14[_0x9d92('0x15')][_0x5da684];_0x3aec9d[_0x9d92('0x85')]=_0x512869;_0x3aec9d[_0x9d92('0x86')]=_0x545d50;_0x3aec9d[_0x9d92('0xf1')]=_0x25634f;if(_['isEmpty'](_0x5d554b)){_0x5f5a14[_0x9d92('0xf2')](_0x3aec9d,_0x4ec002,_0x2bf889,_0x25634f)[_0x9d92('0x5a')](function(_0x5c156d){logger[_0x9d92('0x42')]('[Preview][execCall][success]',_0x9d92('0xf3')+_0x3aec9d['queue']+_0x9d92('0xf4')+_0x3aec9d[_0x9d92('0xab')],JSON[_0x9d92('0x27')](_0x5c156d));ami[_0x9d92('0x25')](_0x9d92('0xf5'),ut[_0x9d92('0x7a')](_0x3aec9d,_0x9d92('0xf6'),_0x5f5a14[_0x9d92('0x12')][_0x3aec9d[_0x9d92('0x46')]]));_0x1d2926(ut[_0x9d92('0x2e')](_0x9d92('0xf7')));})[_0x9d92('0x61')](function(_0x48110e){ut[_0x9d92('0xf8')](_0x9d92('0xf9'),_0x48110e);_0x24972b(ut[_0x9d92('0x2e')]('Call\x20failed',_0x512869,_0x545d50));});}else{_0x4ec002[_0x9d92('0xfa')]+=0x1;ut['logBlacklist'](_0x3aec9d);rpcDb[_0x9d92('0xfb')](_0x3aec9d,_0x9d92('0xfc'));delete _0x5f5a14[_0x9d92('0x15')][_0x5da684];_0x24972b(ut[_0x9d92('0x2e')](_0x9d92('0xfd'),_0x512869,_0x545d50));}});};Preview['prototype'][_0x9d92('0x71')]=function(_0x1d1b2d){return!_[_0x9d92('0x41')](_0x1d1b2d)&&!_['isNil'](_0x1d1b2d[_0x9d92('0x29')])&&!_[_0x9d92('0x41')](_0x1d1b2d[_0x9d92('0xfe')])&&_0x1d1b2d[_0x9d92('0xfe')]&&!_[_0x9d92('0x41')](this[_0x9d92('0x14')][util['format'](_0x9d92('0xff'),_0x1d1b2d[_0x9d92('0x29')])])&&!_[_0x9d92('0x41')](this['trunks'][util['format'](_0x9d92('0xff'),_0x1d1b2d[_0x9d92('0x29')])][_0x9d92('0x4f')])&&(this[_0x9d92('0x14')][util['format']('SIP/%s',_0x1d1b2d[_0x9d92('0x29')])][_0x9d92('0x4f')]===_0x9d92('0x100')||this['trunks'][util['format'](_0x9d92('0xff'),_0x1d1b2d[_0x9d92('0x29')])]['status']===_0x9d92('0x101'));};Preview[_0x9d92('0xe')][_0x9d92('0x102')]=function(_0xc08af6,_0x24cf1b){return this[_0x9d92('0x103')](_0xc08af6,_0x24cf1b)[_0x9d92('0x5a')](function(_0x2403d6){return _[_0x9d92('0x49')](_0x2403d6,[_0x9d92('0x2e')]);})[_0x9d92('0x61')](function(_0x1dd95f){if(_0x1dd95f['unlock']){rpcDb['unlockContact'](_0xc08af6);}if(_0x1dd95f[_0x9d92('0xfe')]){rpcDb[_0x9d92('0x62')](_0xc08af6);}throw _[_0x9d92('0x49')](_0x1dd95f,[_0x9d92('0x2e')]);});};Preview[_0x9d92('0xe')][_0x9d92('0x103')]=function(_0x1158a3,_0x7a0fc){var _0x466c8c=this;var _0x24e14,_0x215dc5;return rpcDb[_0x9d92('0x104')](_0x1158a3)[_0x9d92('0x5a')](function(_0x483584){if(!_[_0x9d92('0x41')](_0x483584[0x0])){_0x215dc5=_0x483584[0x0][_0x9d92('0x105')]?![]:!![];_0x24e14=_0x483584[0x0][_0x9d92('0x105')]?!![]:![];_0x24e14=_0x7a0fc?!![]:_0x24e14;}var _0x4ef02e=_0x466c8c[_0x9d92('0x106')](_0x483584);if(_0x4ef02e[_0x9d92('0x107')]){rpcDb['checkIsBlackList'](_[_0x9d92('0x49')](_0x483584[0x0],['VoiceQueueId',_0x9d92('0xef')]))[_0x9d92('0x5a')](function(_0x3adbb5){_0x466c8c[_0x9d92('0xed')](_0x3adbb5,_0x483584[0x0],_0x7a0fc,_0x215dc5,_0x24e14)[_0x9d92('0x5a')](function(_0x3969fe){return _0x3969fe;})['catch'](function(_0x2b408d){throw _0x2b408d;});})[_0x9d92('0x61')](function(_0x54c974){ut[_0x9d92('0xf8')](_0x9d92('0x108'),_0x54c974);throw ut[_0x9d92('0x2e')](_0x9d92('0x109'),_0x215dc5,_0x24e14);});}else{throw ut[_0x9d92('0x2e')](_0x4ef02e[_0x9d92('0x2e')],_0x215dc5,_0x24e14);}})['catch'](function(_0x24be2d){ut['logger'](_0x9d92('0x10a'),_0x24be2d);throw ut[_0x9d92('0x2e')](_0x9d92('0x109'),![],!![]);});};Preview[_0x9d92('0xe')][_0x9d92('0x106')]=function(_0x3df2d5){if(_[_0x9d92('0x41')](_0x3df2d5)||_['isEmpty'](_0x3df2d5)||!_[_0x9d92('0x41')](_0x3df2d5[0x0]['Agent'])&&_[_0x9d92('0x41')](_0x3df2d5[0x0]['Agent']['name'])){ut[_0x9d92('0xf8')](_0x9d92('0x10b'),_0x3df2d5);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x1329a6=this[_0x9d92('0x12')][_0x3df2d5[0x0][_0x9d92('0x44')][_0x9d92('0x29')]];_0x1329a6[_0x9d92('0x2e')]=utils[_0x9d92('0x2f')][_0x9d92('0x74')];if(_['isNil'](_0x1329a6)){ut[_0x9d92('0xf8')](_0x9d92('0x10c'),_0x1329a6);return{'isValid':![],'message':'Empty\x20Campaign'};}if(!this['isTrunkReachable'](_0x1329a6[_0x9d92('0x72')])){ut[_0x9d92('0xf8')](_0x9d92('0x10d'),_0x9d92('0x10e')+_0x1329a6[_0x9d92('0x29')]+_0x9d92('0x10f'));if(!this[_0x9d92('0x71')](_0x1329a6[_0x9d92('0x110')])){ut[_0x9d92('0xf8')](_0x9d92('0x10d'),_0x1329a6[_0x9d92('0x29')]+_0x9d92('0x111'));return{'isValid':![],'message':_0x9d92('0x112')};}}if(!ut[_0x9d92('0x113')](_0x1329a6[_0x9d92('0x70')])){ut[_0x9d92('0xf8')](_0x9d92('0x114'),_0x1329a6[_0x9d92('0x29')]+'\x20Not\x20Active');return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x1329a6[_0x9d92('0x29')]+_0x9d92('0x115')};}return{'isValid':!![],'message':_0x9d92('0x116')};};Preview[_0x9d92('0xe')][_0x9d92('0xf2')]=function(_0x379f5b,_0x4d6418,_0x1691cc,_0x5c450a){var _0x4432c5=this;return new Promise(function(_0x335aba,_0x13e383){var _0x40f070=_0x379f5b[_0x9d92('0x8c')];var _0x232954=_0x4432c5[_0x9d92('0x71')](_0x4d6418['Trunk'])?util[_0x9d92('0x28')](_0x9d92('0x117'),_0x4d6418[_0x9d92('0x72')]['name'],_['isNil'](_0x4d6418[_0x9d92('0x118')])?'':_0x4d6418['dialPrefix'][_0x9d92('0x119')]()||'',_0x4d6418[_0x9d92('0x11a')]>0x0?_0x1691cc[_0x9d92('0xef')][_0x9d92('0x11b')](_0x4d6418[_0x9d92('0x11a')]):_0x1691cc[_0x9d92('0xef')]):util[_0x9d92('0x28')]('SIP/%s/%s%s',_[_0x9d92('0x41')](_0x4d6418[_0x9d92('0x110')])?_0x4d6418[_0x9d92('0x72')]['name']:_0x4d6418[_0x9d92('0x110')][_0x9d92('0x29')],_[_0x9d92('0x41')](_0x4d6418['dialPrefix'])?'':_0x4d6418[_0x9d92('0x118')][_0x9d92('0x119')]()||'',_0x4d6418[_0x9d92('0x11a')]>0x0?_0x1691cc[_0x9d92('0xef')]['substring'](_0x4d6418[_0x9d92('0x11a')]):_0x1691cc['phone']);var _0xf4ed03=_0x4432c5[_0x9d92('0x71')](_0x4d6418[_0x9d92('0x72')])?ut['getCallerId'](_0x4d6418[_0x9d92('0x72')][_0x9d92('0x11c')],_0x4d6418[_0x9d92('0x11d')],_0x4d6418[_0x9d92('0x11e')]>0x0?ut[_0x9d92('0x11f')](_0x4d6418[_0x9d92('0x120')],_0x4d6418[_0x9d92('0x11e')]):_0x4d6418[_0x9d92('0x120')]):ut[_0x9d92('0x121')](_[_0x9d92('0x41')](_0x4d6418[_0x9d92('0x110')])?_0x4d6418[_0x9d92('0x72')]['callerid']:_0x4d6418[_0x9d92('0x110')][_0x9d92('0x11c')],_0x4d6418[_0x9d92('0x11d')],_0x4d6418['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x4d6418[_0x9d92('0x120')],_0x4d6418['dialRandomLastDigitCallerIdNumber']):_0x4d6418['dialOriginateCallerIdNumber']);if(_0xf4ed03){_0x379f5b[_0x9d92('0x122')]=ut[_0x9d92('0x123')](_0xf4ed03);_0x379f5b[_0x9d92('0x124')]=ut[_0x9d92('0x125')](_0xf4ed03);}var _0x358e2a=ut['addVariables'](_0x4d6418,_0x1691cc,_0x232954,_0xf4ed03,_0x40f070,_0x379f5b);var _0x35448e=utils['setXMDContactVariables'](_0x1691cc[_0x9d92('0xee')]);Object[_0x9d92('0x126')](_0x358e2a,_0x35448e);_[_0x9d92('0x127')](_0x379f5b,ut['toLowerVariables'](_0x358e2a));_0x379f5b[_0x9d92('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x4d6418[_0x9d92('0x128')]=_0x358e2a;var _0x4f3a08=ut[_0x9d92('0x129')](_0x379f5b,_0x4d6418,_0x358e2a,_0x379f5b[_0x9d92('0x86')],_0x5c450a);return ami[_0x9d92('0x4e')](_0x4f3a08)[_0x9d92('0x5a')](function(_0x5317fe){_0x4d6418[_0x9d92('0xd7')]+=0x1;logger[_0x9d92('0x42')]('[originated][increment]',_0x40f070,_0x9d92('0x9d'),_0x4d6418['name'],'originated:\x20',_0x4d6418['originated']);_0x335aba(_0x5317fe);})['catch'](function(_0x4e017e){ut[_0x9d92('0xe0')](_0x379f5b,0xe,_0x9d92('0x12a'));rpcDb[_0x9d92('0xde')](_0x379f5b,_0x9d92('0x12b'));_0x13e383(_0x4e017e);});});};Preview[_0x9d92('0xe')][_0x9d92('0x1f')]=function(_0x3e206f){if(this[_0x9d92('0x15')][_0x3e206f[_0x9d92('0x87')]]){this[_0x9d92('0x15')][_0x3e206f['linkedid']]['channel']=_0x3e206f[_0x9d92('0x50')];}};Preview[_0x9d92('0xe')][_0x9d92('0x12c')]=function(_0x2de55e){var _0x2d191a=this;var _0xaeee0a=this[_0x9d92('0x15')][_0x2de55e['actionid']];if(_0xaeee0a){if(_0xaeee0a['lookAgent']&&this[_0x9d92('0x16')][_0xaeee0a['lookAgent']]){ut[_0x9d92('0x12d')](_0xaeee0a,this[_0x9d92('0x16')][_0xaeee0a['lookAgent']]['name'],this[_0x9d92('0x16')][_0xaeee0a[_0x9d92('0xf1')]]['id']);}var _0x52c13d=_[_0x9d92('0x12e')](_0xaeee0a);_0x52c13d[_0x9d92('0x12f')]=moment()[_0x9d92('0x28')](_0x9d92('0x89'));var _0x8f5e33=_0x2d191a[_0x9d92('0x12')][_0xaeee0a[_0x9d92('0x46')]];if(ut[_0x9d92('0x130')](_0x2de55e[_0x9d92('0x131')])){if(_0xaeee0a['unlockAgent']){rpcDb[_0x9d92('0x132')](_0xaeee0a[_0x9d92('0xab')]);}if(_0xaeee0a[_0x9d92('0x86')]){rpcDb[_0x9d92('0x62')](_0xaeee0a['idContact']);}ami[_0x9d92('0x25')](_0x9d92('0x133'),ut['buildObj'](_0xaeee0a,'rejected',this['campaignsPreview'][_0xaeee0a[_0x9d92('0x46')]]));this[_0x9d92('0xda')](_0x52c13d,_0x8f5e33,_0x2de55e);}else{_0xaeee0a[_0x9d92('0x63')]=moment()[_0x9d92('0x28')](_0x9d92('0x89'));ut[_0x9d92('0xe0')](_0x52c13d,0x4,'Answer');rpcDb[_0x9d92('0xde')](_0x52c13d,_0x9d92('0x134'));}}};Preview[_0x9d92('0xe')][_0x9d92('0x1b')]=function(_0x1a924d){var _0x2e4080=this[_0x9d92('0x15')][_0x1a924d[_0x9d92('0x87')]];var _0x117bec;if(_0x2e4080){_0x117bec=this[_0x9d92('0x12')][_0x2e4080[_0x9d92('0x46')]];logger['info'](_0x9d92('0x135'),_0x1a924d[_0x9d92('0x87')],'\x20Queue',_0x117bec[_0x9d92('0x29')],_0x9d92('0x47'),_0x117bec[_0x9d92('0x2c')]);}if(this['actions'][_0x1a924d[_0x9d92('0x87')]]&&_0x1a924d[_0x9d92('0x87')]!==_0x1a924d[_0x9d92('0x8c')]){if(_0x1a924d['cause']==='16'&&this[_0x9d92('0x15')][_0x1a924d[_0x9d92('0x87')]][_0x9d92('0x48')]){this[_0x9d92('0x136')](_0x1a924d,_0x1a924d[_0x9d92('0x87')],_0x1a924d['cause']);}else if(this[_0x9d92('0x15')][_0x1a924d[_0x9d92('0x87')]][_0x9d92('0x48')]){logger[_0x9d92('0x42')]('[syncHangup][talking][cause]',_0x1a924d[_0x9d92('0x87')],_0x1a924d[_0x9d92('0x137')],_0x9d92('0x9d'),_0x117bec[_0x9d92('0x29')],_0x9d92('0x47'),_0x117bec[_0x9d92('0x2c')]);this[_0x9d92('0x136')](_0x1a924d,_0x1a924d[_0x9d92('0x87')],_0x1a924d[_0x9d92('0x137')]);}}else if(_0x2e4080&&_[_0x9d92('0x41')](_0x2e4080['statedesc'])&&_0x117bec['dialQueueProject']&&_0x1a924d[_0x9d92('0x87')]===_0x1a924d[_0x9d92('0x8c')]&&_[_0x9d92('0x41')](_0x1a924d[_0x9d92('0xdd')])&&_0x1a924d[_0x9d92('0x137')]==='16'&&_0x1a924d['channelstate']==='6'&&_[_0x9d92('0xdb')](_0x2e4080[_0x9d92('0x138')])){if(_0x2e4080['unlockAgent']){rpcDb['unlockContact'](_0x2e4080[_0x9d92('0xab')]);}if(_0x2e4080[_0x9d92('0x86')]){rpcDb[_0x9d92('0x62')](_0x2e4080['idContact']);}_0x1a924d[_0x9d92('0xdd')]='22';this[_0x9d92('0xda')](_0x2e4080,_0x117bec,_0x1a924d);}else if(_0x2e4080&&_0x2e4080[_0x9d92('0x138')]){if(_0x1a924d[_0x9d92('0x137')]==='16'&&this[_0x9d92('0x15')][_0x1a924d['linkedid']]['dialAnswer']){logger['info'](_0x9d92('0x139'),_0x1a924d[_0x9d92('0x87')],_0x1a924d['cause'],_0x9d92('0x9d'),_0x117bec[_0x9d92('0x29')],'pTalking:\x20',_0x117bec[_0x9d92('0x2c')]);this['callProgressDetectingCustomer'](_0x1a924d,_0x1a924d[_0x9d92('0x87')],_0x1a924d[_0x9d92('0x137')]);}else if(this['actions'][_0x1a924d['linkedid']][_0x9d92('0x48')]){logger[_0x9d92('0x42')](_0x9d92('0x13a'),_0x1a924d[_0x9d92('0x87')],_0x1a924d[_0x9d92('0x137')],_0x9d92('0x9d'),_0x117bec['name'],_0x9d92('0x47'),_0x117bec[_0x9d92('0x2c')]);this[_0x9d92('0x136')](_0x1a924d,_0x1a924d[_0x9d92('0x87')],_0x1a924d[_0x9d92('0x137')]);}}};Preview['prototype'][_0x9d92('0x1e')]=function(_0x1d1378){if(this[_0x9d92('0x15')][_0x1d1378['destlinkedid']]&&_0x1d1378[_0x9d92('0xd8')]!==_0x1d1378[_0x9d92('0x13b')]){this[_0x9d92('0x136')](_0x1d1378,_0x1d1378['destlinkedid'],_0x1d1378[_0x9d92('0xcd')]);}};Preview[_0x9d92('0xe')][_0x9d92('0x1c')]=function(_0xe58fd6){if(this[_0x9d92('0x15')][_0xe58fd6[_0x9d92('0x87')]]&&_0xe58fd6[_0x9d92('0x87')]!==_0xe58fd6[_0x9d92('0x8c')]&&!this[_0x9d92('0x15')][_0xe58fd6['linkedid']]['dialAnswer']){if(_0xe58fd6['cause']==='1'){this[_0x9d92('0x136')](_0xe58fd6,_0xe58fd6[_0x9d92('0x87')],_0xe58fd6[_0x9d92('0x137')]);}}};Preview[_0x9d92('0xe')][_0x9d92('0x13c')]=function(_0x39cd44,_0x189d0f,_0x50f714){if(this[_0x9d92('0x15')][_0x39cd44]){if(_[_0x9d92('0x41')](this[_0x9d92('0x15')][_0x39cd44][_0x9d92('0x128')])){this['actions'][_0x39cd44]['variables']={};}this['actions'][_0x39cd44][_0x9d92('0x128')][_0x189d0f]=_0x50f714;}};Preview[_0x9d92('0xe')][_0x9d92('0x21')]=function(_0x5bc100){try{if(!_[_0x9d92('0x41')](_0x5bc100)){if(ut['filterKey'](_[_0x9d92('0x13d')](_0x5bc100[_0x9d92('0x13e')])[0x0])){this[_0x9d92('0x13c')](_0x5bc100[_0x9d92('0x8c')],_[_0x9d92('0x13d')](_0x5bc100[_0x9d92('0x13e')])[0x0],_0x5bc100[_0x9d92('0x13f')]);}}}catch(_0x269916){logger['error'](_0x9d92('0x140'),util[_0x9d92('0x141')](_0x269916,{'showHidden':![],'depth':null}));}};Preview[_0x9d92('0xe')][_0x9d92('0x142')]=function(_0xbd9cc5){if(_0xbd9cc5){if(this[_0x9d92('0x15')][_0xbd9cc5[_0x9d92('0x143')]]){this['actions'][_0xbd9cc5['transfertargetlinkedid']][_0x9d92('0x138')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x10fcdc){if(_0x10fcdc){if(this[_0x9d92('0x15')][_0x10fcdc[_0x9d92('0x144')]]){this['actions'][_0x10fcdc[_0x9d92('0x144')]][_0x9d92('0x138')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index a92cac3..bbe8876 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 _0xeacb=['disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xeacb,0xeb));var _0xbeac=function(_0x1619d8,_0x2643fa){_0x1619d8=_0x1619d8-0x0;var _0x61c38d=_0xeacb[_0x1619d8];return _0x61c38d;};'use strict';var util=require(_0xbeac('0x0'));var BPromise=require(_0xbeac('0x1'));var logger=require(_0xbeac('0x2'))(_0xbeac('0x3'));var cmHopper=require(_0xbeac('0x4'));var cmHopperHistory=require(_0xbeac('0x5'));var cmHopperBlack=require(_0xbeac('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xbeac('0x7'));function loggerCatch(_0x44aae5){return function(_0x530c98){logger[_0xbeac('0x8')](_0x44aae5,util[_0xbeac('0x9')](_0x530c98,{'showHidden':![],'depth':null}));};}function create(_0x13487d){return cmHopperHistory[_0xbeac('0xa')](_0x13487d)[_0xbeac('0xb')](loggerCatch(_0xbeac('0xc')));}function createAgent(_0x1bf28c){return BPromise[_0xbeac('0xd')]()[_0xbeac('0xe')](agentReportPreview[_0xbeac('0xa')](_0x1bf28c))[_0xbeac('0xb')](loggerCatch(_0xbeac('0xc')));}function moveContact(_0x49c15f){return cmHopper[_0xbeac('0xf')](_0x49c15f,!![])['catch'](loggerCatch(_0xbeac('0x10')));}exports[_0xbeac('0x11')]=function(_0x30a919){return cmHopperBlack[_0xbeac('0x11')](_0x30a919)[_0xbeac('0xb')](loggerCatch(_0xbeac('0x12')));};exports[_0xbeac('0x13')]=function(_0x7fcad1){return BPromise[_0xbeac('0xd')]()[_0xbeac('0xe')](cmHopper['getContactPreview'](_0x7fcad1))[_0xbeac('0xb')](loggerCatch(_0xbeac('0x14')));};exports[_0xbeac('0xa')]=function(_0x5b88c5,_0x526258){create(_0x5b88c5)[_0xbeac('0xb')](loggerCatch(_0x526258));moveContact(_0x5b88c5)[_0xbeac('0xb')](loggerCatch(_0x526258));};exports[_0xbeac('0x15')]=function(_0x575464,_0x5e35fb){createAgent(_0x575464)[_0xbeac('0xb')](loggerCatch(_0x5e35fb));};exports[_0xbeac('0x16')]=function(_0x423d42,_0x9f116d){create(_0x423d42)['catch'](loggerCatch(_0x9f116d));};exports['createCustomerFinal']=function(_0x77ab12,_0x17db61){moveContact(_0x77ab12)[_0xbeac('0xb')](loggerCatch(_0x17db61));};exports['rescheduleContact']=function(_0x203a2f,_0x459f31,_0x2ae596){if(_0x459f31){_0x203a2f[_0xbeac('0x17')]=null;}if(_0x2ae596){_0x203a2f['active']=![];}return cmHopper[_0xbeac('0x18')](_0x203a2f)['catch'](loggerCatch(_0xbeac('0x19')));};exports['countReScheduled']=function(_0x279cc2){return cmHopper[_0xbeac('0x1a')](_0x279cc2)[_0xbeac('0xb')](loggerCatch(_0xbeac('0x1b')));};exports[_0xbeac('0x1c')]=function(_0x44b003){return cmHopper[_0xbeac('0x1c')]({'UserId':null},_0x44b003,0x1)[_0xbeac('0xb')](loggerCatch(_0xbeac('0x1d')));};exports[_0xbeac('0x1e')]=function(_0x106bba){return cmHopper[_0xbeac('0x1c')]({'active':![]},_0x106bba,0x1)[_0xbeac('0xb')](loggerCatch(_0xbeac('0x1f')));};exports[_0xbeac('0x20')]=function(_0x1d2df0){var _0xf944c9={};_0xf944c9['type']=_0x1d2df0[_0xbeac('0x21')];_0xf944c9[_0xbeac('0x22')]=_0x1d2df0[_0xbeac('0x22')];_0xf944c9['calleridnum']=_0x1d2df0[_0xbeac('0x23')];_0xf944c9[_0xbeac('0x24')]=_0x1d2df0[_0xbeac('0x24')];_0xf944c9[_0xbeac('0x25')]=_0x1d2df0['queue'];_0xf944c9[_0xbeac('0x26')]=_0x1d2df0['answertime'];_0xf944c9[_0xbeac('0x27')]=_0x1d2df0['answertime'];_0xf944c9[_0xbeac('0x28')]=0x1;_0xf944c9[_0xbeac('0x29')]=_0x1d2df0[_0xbeac('0x2a')];_0xf944c9['connectedlinename']=_0x1d2df0['membername'];_0xf944c9[_0xbeac('0x2b')]=_0xbeac('0x2c');_0xf944c9['exten']=_0xbeac('0x2d');_0xf944c9[_0xbeac('0x2e')]=0x0;_0xf944c9[_0xbeac('0x2f')]=0x1;_0xf944c9[_0xbeac('0x30')]=_0x1d2df0['membername'];_0xf944c9['queuecallerexitreason']='COMPLETED';return BPromise[_0xbeac('0xd')]()[_0xbeac('0xe')](voiceQueueReport[_0xbeac('0x31')](_0xf944c9))[_0xbeac('0xb')](loggerCatch(_0xbeac('0x32')));};exports[_0xbeac('0x33')]=function(_0x106c4f,_0x2a64cb){return BPromise[_0xbeac('0xd')]()[_0xbeac('0xe')](cmHopper[_0xbeac('0x33')](_0x106c4f,_0x2a64cb))[_0xbeac('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xbeac('0x34')]=function(_0x13acd3){return cmHopper[_0xbeac('0x18')](_0x13acd3,!![],!![])[_0xbeac('0xb')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0xa173=['countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','uniqueid','calleridnum','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x2a37ea,_0x4dc7e7){var _0x4177c1=function(_0x125d87){while(--_0x125d87){_0x2a37ea['push'](_0x2a37ea['shift']());}};_0x4177c1(++_0x4dc7e7);}(_0xa173,0x16e));var _0x3a17=function(_0x24c482,_0x53b98e){_0x24c482=_0x24c482-0x0;var _0x29d402=_0xa173[_0x24c482];return _0x29d402;};'use strict';var util=require(_0x3a17('0x0'));var BPromise=require(_0x3a17('0x1'));var logger=require(_0x3a17('0x2'))(_0x3a17('0x3'));var cmHopper=require(_0x3a17('0x4'));var cmHopperHistory=require(_0x3a17('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x3a17('0x6'));var voiceQueueReport=require(_0x3a17('0x7'));function loggerCatch(_0x567e1e){return function(_0x41bc98){logger[_0x3a17('0x8')](_0x567e1e,util[_0x3a17('0x9')](_0x41bc98,{'showHidden':![],'depth':null}));};}function create(_0x138f28){return cmHopperHistory[_0x3a17('0xa')](_0x138f28)[_0x3a17('0xb')](loggerCatch(_0x3a17('0xc')));}function createAgent(_0x86543e){return BPromise[_0x3a17('0xd')]()[_0x3a17('0xe')](agentReportPreview[_0x3a17('0xa')](_0x86543e))[_0x3a17('0xb')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x3666da){return cmHopper[_0x3a17('0xf')](_0x3666da,!![])[_0x3a17('0xb')](loggerCatch(_0x3a17('0x10')));}exports['checkIsBlackList']=function(_0x3951da){return cmHopperBlack['checkIsBlackList'](_0x3951da)[_0x3a17('0xb')](loggerCatch(_0x3a17('0x11')));};exports['getContactPreview']=function(_0x21a834){return BPromise[_0x3a17('0xd')]()[_0x3a17('0xe')](cmHopper['getContactPreview'](_0x21a834))[_0x3a17('0xb')](loggerCatch(_0x3a17('0x12')));};exports[_0x3a17('0xa')]=function(_0x358f2b,_0x1e4921){create(_0x358f2b)[_0x3a17('0xb')](loggerCatch(_0x1e4921));moveContact(_0x358f2b)[_0x3a17('0xb')](loggerCatch(_0x1e4921));};exports[_0x3a17('0x13')]=function(_0x24e01f,_0x4d2f37){createAgent(_0x24e01f)[_0x3a17('0xb')](loggerCatch(_0x4d2f37));};exports[_0x3a17('0x14')]=function(_0xec6eed,_0x36312c){create(_0xec6eed)[_0x3a17('0xb')](loggerCatch(_0x36312c));};exports[_0x3a17('0x15')]=function(_0x1ad2f4,_0x5cf932){moveContact(_0x1ad2f4)['catch'](loggerCatch(_0x5cf932));};exports[_0x3a17('0x16')]=function(_0x912e8,_0x22b941,_0x2f58b7){if(_0x22b941){_0x912e8[_0x3a17('0x17')]=null;}if(_0x2f58b7){_0x912e8[_0x3a17('0x18')]=![];}return cmHopper[_0x3a17('0x16')](_0x912e8)['catch'](loggerCatch(_0x3a17('0x19')));};exports['countReScheduled']=function(_0x1a5480){return cmHopper[_0x3a17('0x1a')](_0x1a5480)[_0x3a17('0xb')](loggerCatch(_0x3a17('0x1b')));};exports[_0x3a17('0x1c')]=function(_0x4200fd){return cmHopper[_0x3a17('0x1c')]({'UserId':null},_0x4200fd,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x3ecfea){return cmHopper['unlockContact']({'active':![]},_0x3ecfea,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0x3a17('0x1d')]=function(_0x5d0520){var _0x176eeb={};_0x176eeb['type']=_0x5d0520['type'];_0x176eeb[_0x3a17('0x1e')]=_0x5d0520[_0x3a17('0x1e')];_0x176eeb[_0x3a17('0x1f')]=_0x5d0520[_0x3a17('0x1f')];_0x176eeb['calleridname']=_0x5d0520['calleridname'];_0x176eeb['queue']=_0x5d0520['queue'];_0x176eeb[_0x3a17('0x20')]=_0x5d0520[_0x3a17('0x21')];_0x176eeb['queuecallerleaveAt']=_0x5d0520[_0x3a17('0x21')];_0x176eeb[_0x3a17('0x22')]=0x1;_0x176eeb['queuecallercompleteAt']=_0x5d0520[_0x3a17('0x23')];_0x176eeb[_0x3a17('0x24')]=_0x5d0520[_0x3a17('0x25')];_0x176eeb[_0x3a17('0x26')]='from-sip';_0x176eeb[_0x3a17('0x27')]=_0x3a17('0x28');_0x176eeb['holdtime']=0x0;_0x176eeb[_0x3a17('0x29')]=0x1;_0x176eeb[_0x3a17('0x2a')]=_0x5d0520[_0x3a17('0x25')];_0x176eeb[_0x3a17('0x2b')]=_0x3a17('0x2c');return BPromise[_0x3a17('0xd')]()[_0x3a17('0xe')](voiceQueueReport[_0x3a17('0x2d')](_0x176eeb))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x3a17('0x2e')]=function(_0x20a1c9,_0x650fc7){return BPromise[_0x3a17('0xd')]()[_0x3a17('0xe')](cmHopper[_0x3a17('0x2e')](_0x20a1c9,_0x650fc7))[_0x3a17('0xb')](loggerCatch(_0x3a17('0x2f')));};exports[_0x3a17('0x30')]=function(_0x3bf569){return cmHopper[_0x3a17('0x16')](_0x3bf569,!![],!![])[_0x3a17('0xb')](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/preview/util/util.js b/server/services/ami/preview/util/util.js index cb5457c..cc098a9 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 _0x10ee=['variables','keys','forEach','buildNoAnswerEventPayload','util','moment','env','XCALLY_IP_AGI','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','Blacklist','starttime','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','ringtime','getSeconds','membername','UserId','logCustomer','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','channelAgent','calleridnum','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','motionChannel','voice','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','push','getDiff','milliseconds','seconds','createBody','VoiceQueueId','filterKey','type','campaigntype','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','noanswer'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x10ee,0x11a));var _0xe10e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x10ee[_0x59ee6f];return _0x4c0979;};'use strict';var util=require(_0xe10e('0x0'));var _=require('lodash');var moment=require(_0xe10e('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xe10e('0x2')][_0xe10e('0x3')]||'127.0.0.1';var utils=require(_0xe10e('0x4'));exports[_0xe10e('0x5')]=function(_0x1aae88){return function(_0x5615b5){logger[_0xe10e('0x6')](_0x1aae88,util[_0xe10e('0x7')](_0x5615b5,{'showHidden':![],'depth':null}));};};exports[_0xe10e('0x8')]=function(_0x1700ac,_0x49b729){logger[_0xe10e('0x9')](_0x1700ac,util[_0xe10e('0x7')](_0x49b729,{'showHidden':![],'depth':null}));};exports[_0xe10e('0xa')]=function(_0x250d82,_0xa672f7){logger[_0xe10e('0x6')](_0x250d82,util['inspect'](_0xa672f7,{'showHidden':![],'depth':null}));};exports[_0xe10e('0xb')]=function(_0x57a9ef){return function(_0x55fe4f){logger[_0xe10e('0x9')](_0x57a9ef,util[_0xe10e('0x7')](_0x55fe4f,{'showHidden':![],'depth':null}));};};exports[_0xe10e('0xc')]=function(_0xb1c594,_0x9632ca,_0x2df700){return{'message':_0xb1c594,'unlock':_0x9632ca,'active':_0x2df700};};exports[_0xe10e('0xd')]=function(_0x2da01f,_0x3bd976,_0x2f3b40){if(!_[_0xe10e('0xe')](_0x2f3b40)&&_0xe10e('0xf')===typeof _0x2f3b40&&!_[_0xe10e('0x10')](_0x2f3b40)){if(!_[_0xe10e('0xe')](_0x3bd976)&&_0xe10e('0xf')===typeof _0x3bd976&&!_['isEmpty'](_0x3bd976)){return util[_0xe10e('0x11')](_0xe10e('0x12'),_0x3bd976,_0x2f3b40);}return util[_0xe10e('0x11')]('\x22%s\x22\x20<%s>',_0x2f3b40,_0x2f3b40);}if(!_['isUndefined'](_0x2da01f)&&_0xe10e('0xf')===typeof _0x2da01f&&!_[_0xe10e('0x10')](_0x2da01f)){return _0x2da01f;}return _0xe10e('0x13');};exports[_0xe10e('0x14')]=function(_0x4ff7eb){if(_[_0xe10e('0x15')](_0x4ff7eb)){return![];}return _0x4ff7eb;};exports[_0xe10e('0x16')]=function(_0x42a72d,_0x377b84,_0x24e09e,_0x1fac03,_0x283a98,_0x53099e){var _0x14510c={'XMD-QUEUE':_0x377b84[_0xe10e('0x17')]?_0x377b84[_0xe10e('0x17')][_0xe10e('0x18')]:'','XMD-CALLERID':_0x1fac03,'XMD-CALLERID-PREVIEW':_0x53099e?util[_0xe10e('0x11')](_0xe10e('0x12'),_0x53099e[_0xe10e('0x19')],_0x53099e['calleridnum']):_0x1fac03,'XMD-DIALID':_0x283a98,'XMD-CONTACTID':_0x377b84[_0xe10e('0x1a')],'XMD-CDRTYPE':_0xe10e('0x1b'),'CALLERID(all)':_0x1fac03,'XMD-VOICEQUEUEID':_0x377b84['VoiceQueueId'],'XMD-DIALCHANNEL':_0x24e09e,'XMD-DIALTIMEOUT':_0x42a72d[_0xe10e('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0xe10e('0x11')](_0xe10e('0x1d'),_0x42a72d[_0xe10e('0x1e')]?'g':'',_[_0xe10e('0x10')](_0x42a72d['monitor_format'])?'':_0xe10e('0x1f')),'XMD-DIALURL':_0x42a72d['dialPreviewUrl']||'','XMD-AGI':_0x42a72d[_0xe10e('0x20')]?util['format'](_0xe10e('0x21'),ipAgi,_0x42a72d['dialQueueProject']):_0xe10e('0x22'),'XMD-AGIAFTER':_0x42a72d['dialQueueProject2']?util[_0xe10e('0x11')](_0xe10e('0x21'),ipAgi,_0x42a72d[_0xe10e('0x1e')]):_0xe10e('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x53099e?_0x53099e[_0xe10e('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x53099e?_0x53099e[_0xe10e('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0xe10e('0x25')};if(!_[_0xe10e('0x10')](_0x42a72d['monitor_format'])){_0x14510c[util[_0xe10e('0x11')]('%s',_0xe10e('0x26'))]=_0x42a72d[_0xe10e('0x27')];_0x14510c[util[_0xe10e('0x11')]('%s',_0xe10e('0x28'))]=_0x283a98;}return _0x14510c;};exports[_0xe10e('0x29')]=function(_0x2f5836){var _0x12e4af={};for(var _0x5221c9 in _0x2f5836){if(_0x2f5836[_0xe10e('0x2a')](_0x5221c9)){_0x12e4af[util[_0xe10e('0x11')]('%s',_['toLower'](_0x5221c9))]=_0x2f5836[_0x5221c9];}}return{'variables':_0x12e4af};};exports['updateOriginated']=function(_0x580a48,_0x31ed1d){if(!_[_0xe10e('0x15')](_0x580a48)){if(_0x580a48[_0xe10e('0x2a')](_0xe10e('0x2b'))){if(_0x580a48[_0xe10e('0x2b')]>0x0){_0x580a48[_0xe10e('0x2b')]-=0x1;}else{logger[_0xe10e('0x6')](_0xe10e('0x2c'),_0x31ed1d);}}}else{logger[_0xe10e('0x6')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x31ed1d);}};exports[_0xe10e('0x2d')]=function(_0x97aec9){var _0x4af264=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x97aec9['state']=0xd;_0x97aec9['statedesc']=_0xe10e('0x2e');_0x97aec9[_0xe10e('0x2f')]=_0x4af264;_0x97aec9[_0xe10e('0x30')]=_0x4af264;_0x97aec9[_0xe10e('0x31')]=_0x4af264;};exports[_0xe10e('0x32')]=function(_0x165dd0,_0x2cffe3,_0x3f0355){var _0x48150d=moment()[_0xe10e('0x11')](_0xe10e('0x33'));_0x165dd0[_0xe10e('0x34')]=_0x2cffe3;_0x165dd0[_0xe10e('0x35')]=_0x3f0355;_0x165dd0[_0xe10e('0x30')]=_0x48150d;_0x165dd0[_0xe10e('0x36')]=utils[_0xe10e('0x37')](_0x165dd0[_0xe10e('0x30')],_0x165dd0['starttime']);};exports['logLookAgent']=function(_0x5e19e9,_0x3a18a7,_0x45a9a5){_0x5e19e9[_0xe10e('0x38')]=_0x3a18a7;_0x5e19e9[_0xe10e('0x39')]=_0x45a9a5;};exports[_0xe10e('0x3a')]=function(_0x2349b9,_0x59b4cb,_0x58d1cc){var _0x152aa9=moment()[_0xe10e('0x11')](_0xe10e('0x33'));_0x2349b9['state']=_0x59b4cb;_0x2349b9[_0xe10e('0x35')]=_0x58d1cc;_0x2349b9[_0xe10e('0x30')]=_0x2349b9[_0xe10e('0x30')]?_0x2349b9[_0xe10e('0x30')]:_0x152aa9;_0x2349b9['endtime']=_0x2349b9[_0xe10e('0x31')]?_0x2349b9[_0xe10e('0x31')]:_0x152aa9;_0x2349b9[_0xe10e('0x36')]=utils[_0xe10e('0x37')](_0x2349b9['responsetime']||0x0,_0x2349b9['starttime']||0x0);_0x2349b9['talktime']=_0x2349b9[_0xe10e('0x3b')]?utils[_0xe10e('0x37')](_0x2349b9[_0xe10e('0x31')],_0x2349b9[_0xe10e('0x3b')]):0x0;};exports[_0xe10e('0x3c')]=function(_0x5cf5ee){return _0x5cf5ee===_0xe10e('0x3d');};exports['variablesAction']=function(_0x52b38d,_0x2b5ffe,_0x1fa480,_0x3e6019,_0x14bbf4){var _0x4961f2=_0x3e6019?_0xe10e('0x3e'):_0x52b38d['calleridname'];_0x4961f2=_0x14bbf4?_0xe10e('0x3f'):_0x4961f2;return{'actionid':_0x52b38d[_0xe10e('0x40')],'action':'originate','channel':_0x52b38d[_0xe10e('0x41')],'callerid':util[_0xe10e('0x11')]('\x22%s\x22\x20<%s>',_0x4961f2,_0x52b38d[_0xe10e('0x42')]),'Exten':_0xe10e('0x43'),'Context':_0xe10e('0x44'),'Priority':'1','variable':_0x1fa480,'timeout':(_0x2b5ffe[_0xe10e('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x52b38d[_0xe10e('0x40')]};};exports[_0xe10e('0x46')]=function(_0x12089a){return _0x12089a[_0xe10e('0x47')]+_0x12089a[_0xe10e('0x48')]+_0x12089a[_0xe10e('0x49')]+_0x12089a['countagentrejectretry']+_0x12089a[_0xe10e('0x4a')];};exports['cloneAction']=function(_0x3ae820){var _0x1694ab=_[_0xe10e('0x4b')](_0x3ae820);_0x1694ab[_0xe10e('0x34')]=0xf;_0x1694ab[_0xe10e('0x35')]=_0xe10e('0x4c');return _0x1694ab;};exports[_0xe10e('0x4d')]=function(_0x4c6a8b,_0x1ecc66,_0x5c8b00){var _0x2b29d6={};_0x2b29d6[_0x1ecc66]=_0x4c6a8b[_0x1ecc66];_0x2b29d6[_0xe10e('0x4e')]=![];_0x2b29d6[_0xe10e('0x4f')]=moment()[_0xe10e('0x50')](_0x5c8b00,'minutes')[_0xe10e('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x2b29d6[_0xe10e('0x1a')]=_0x4c6a8b[_0xe10e('0x1a')];_0x2b29d6[_0xe10e('0x51')]=_0x4c6a8b['ListId'];_0x2b29d6['VoiceQueueId']=_0x4c6a8b['VoiceQueueId']||undefined;return _0x2b29d6;};exports[_0xe10e('0x52')]=function(_0x22729d,_0x3963a2){if(!_['isNil'](_0x22729d)){if(_0x22729d['pTalking']>0x0){_0x22729d[_0xe10e('0x53')]-=0x1;}else{logger[_0xe10e('0x6')](_0x3963a2,_0xe10e('0x54'));}}else{logger[_0xe10e('0x6')](_0x3963a2,_0xe10e('0x55'));}};exports[_0xe10e('0x56')]=function(_0x1d5572){if(_0x1d5572<=0x0){return!![];}return![];};function buildObj(_0x459e19,_0x583410,_0xa7275b){_0x459e19['lastevent']=_0x583410;_0x459e19[_0xe10e('0x18')]=_0x459e19[_0xe10e('0x57')];_0x459e19['interface']=_0x459e19[_0xe10e('0x41')];_0x459e19[_0xe10e('0x58')]=_0xe10e('0x59');if(_0xa7275b){_0x459e19['mandatoryDisposition']=_0xa7275b[_0xe10e('0x5a')];}return _0x459e19;}exports['buildObj']=buildObj;exports[_0xe10e('0x5b')]=function(_0x5888aa){var _0x5a1fef={};_0x5a1fef['queue']=_0x5888aa[_0xe10e('0x57')];_0x5a1fef[_0xe10e('0x5c')]=_0x5888aa[_0xe10e('0x41')];_0x5a1fef[_0xe10e('0x40')]=_0x5888aa['uniqueid'];return _0x5a1fef;};exports[_0xe10e('0x5d')]=function(_0x34d676){var _0x569535=[];for(var _0x1571b1 in _0x34d676){if(_0x34d676[_0xe10e('0x2a')](_0x1571b1)){if(!_[_0xe10e('0x15')](_0x34d676[_0x1571b1])&&_0x34d676[_0x1571b1]['state']===_0xe10e('0x5e')&&_0x34d676[_0x1571b1][_0xe10e('0x5f')]==='reachable'){_0x569535[_0xe10e('0x60')](_0x34d676[_0x1571b1]['id']);}}}return _0x569535;};exports[_0xe10e('0x61')]=function(_0x210183){var _0x53937a=moment()[_0xe10e('0x62')](0x0);var _0x138627=moment(_0x210183)['milliseconds'](0x0);return _0x53937a['diff'](_0x138627,_0xe10e('0x63'));};exports[_0xe10e('0x64')]=function(_0x52b91c){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x52b91c[_0xe10e('0x1a')],'ListId':_0x52b91c[_0xe10e('0x51')],'VoiceQueueId':_0x52b91c[_0xe10e('0x65')]||undefined,'CampaignId':_0x52b91c['CampaignId']||undefined};};exports[_0xe10e('0x66')]=function(_0x579086){if(_0x579086===_0xe10e('0x40')||_0x579086==='idContact'||_0x579086==='queue'||_0x579086===_0xe10e('0x67')||_0x579086===_0xe10e('0x68')||_0x579086==='dialAnswer'||_0x579086===_0xe10e('0x38')||_0x579086==='channelAgent'||_0x579086===_0xe10e('0x19')||_0x579086==='active'||_0x579086==='calleridnum'||_0x579086===_0xe10e('0x4f')||_0x579086===_0xe10e('0x47')||_0x579086===_0xe10e('0x48')||_0x579086===_0xe10e('0x49')||_0x579086==='countglobal'||_0x579086===_0xe10e('0x69')||_0x579086===_0xe10e('0x6a')||_0x579086===_0xe10e('0x6b')||_0x579086===_0xe10e('0x6c')||_0x579086===_0xe10e('0x1a')||_0x579086===_0xe10e('0x51')||_0x579086===_0xe10e('0x39')||_0x579086==='VoiceQueueId'||_0x579086===_0xe10e('0x6d')||_0x579086===_0xe10e('0x6e')||_0x579086===_0xe10e('0x6f')||_0x579086===_0xe10e('0x70')||_0x579086===_0xe10e('0x71')||_0x579086===_0xe10e('0x72')||_0x579086===_0xe10e('0x73')||_0x579086==='xmd-dialoptions'||_0x579086==='xmd-dialid'||_0x579086==='xmd-dialchannel'||_0x579086===_0xe10e('0x74')||_0x579086===_0xe10e('0x75')||_0x579086===_0xe10e('0x76')||_0x579086===_0xe10e('0x77')||_0x579086===_0xe10e('0x78')||_0x579086===_0xe10e('0x79')||_0x579086===_0xe10e('0x7a')||_0x579086===_0xe10e('0x7b')||_0x579086==='rtpaudioqosjitterbridged'||_0x579086===_0xe10e('0x7c')||_0x579086==='rtpaudioqoslossbridged'||_0x579086===_0xe10e('0x7d')||_0x579086===_0xe10e('0x7e')||_0x579086===_0xe10e('0x79')||_0x579086===_0xe10e('0x7a')||_0x579086==='rtpaudioqosjitter'||_0x579086===_0xe10e('0x7f')||_0x579086===_0xe10e('0x7c')||_0x579086===_0xe10e('0x80')||_0x579086===_0xe10e('0x7d')||_0x579086==='rtpaudioqosrttbridged'||_0x579086===_0xe10e('0x81')||_0x579086==='bridgepvtcallid'||_0x579086===_0xe10e('0x34')||_0x579086===_0xe10e('0x35')){return![];}return!![];};exports[_0xe10e('0x82')]=function(_0x33d685,_0x560cc3){var _0x41425a,_0x41c2a4,_0x17653c;if(_0x560cc3<=0x0){_0x560cc3=0x1;}_0x41425a=new RegExp(_0xe10e('0x83')+_0x560cc3+'}$');_0x41c2a4=Math[_0xe10e('0x84')](0xa,_0x560cc3-0x1);_0x17653c=Math['pow'](0xa,_0x560cc3)-0x1;return util[_0xe10e('0x11')]('%s',_[_0xe10e('0x85')](_0x33d685,_0x41425a,_['random'](_0x41c2a4,_0x17653c)));};exports['extractCalleridName']=function(_0xbb08c0){var _0x18c1a9=_0xbb08c0['match'](/"(.*?)"/);return _0x18c1a9?_0x18c1a9[0x1]:_0xbb08c0;};exports['extractCalleridNumber']=function(_0x5cb32b){var _0x132dfe=_0x5cb32b['match'](/<(.*?)>/);return _0x132dfe?_0x132dfe[0x1]:_0x5cb32b;};function buildNoAnswerEventPayload(_0x156631,_0x3365c4){var _0x35e45d=buildObj(_0x156631,_0xe10e('0x86'));if(!_[_0xe10e('0x10')](_0x3365c4[_0xe10e('0x87')])){Object[_0xe10e('0x88')](_0x3365c4[_0xe10e('0x87')])[_0xe10e('0x89')](function(_0x5794f9){_0x35e45d[_0x5794f9['toLowerCase']()]=_0x3365c4['variables'][_0x5794f9];});}return _0x35e45d;}exports[_0xe10e('0x8a')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xcc79=['channelAgent','calleridnum','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','ListId','decrementTalkink','pTalking','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','status','push','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','type','dialAnswer','membername','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','noanswer','keys','forEach','toLowerCase','variables','lodash','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','loggerCatch','inspect','logger','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','Queue','name','calleridname','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','getSeconds','starttime','logLookAgent','ringtime','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xcc79,0xda));var _0x9cc7=function(_0x48c22d,_0x43018d){_0x48c22d=_0x48c22d-0x0;var _0x2ba79c=_0xcc79[_0x48c22d];return _0x2ba79c;};'use strict';var util=require('util');var _=require(_0x9cc7('0x0'));var moment=require(_0x9cc7('0x1'));var logger=require(_0x9cc7('0x2'))(_0x9cc7('0x3'));var ipAgi=process['env'][_0x9cc7('0x4')]||_0x9cc7('0x5');var utils=require('../../dialer/utils');exports[_0x9cc7('0x6')]=function(_0x45ea88){return function(_0x4e4a13){logger['error'](_0x45ea88,util[_0x9cc7('0x7')](_0x4e4a13,{'showHidden':![],'depth':null}));};};exports[_0x9cc7('0x8')]=function(_0x1e2798,_0x8d1591){logger['info'](_0x1e2798,util[_0x9cc7('0x7')](_0x8d1591,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1138bb,_0xf76950){logger[_0x9cc7('0x9')](_0x1138bb,util[_0x9cc7('0x7')](_0xf76950,{'showHidden':![],'depth':null}));};exports[_0x9cc7('0xa')]=function(_0x34983d){return function(_0x3599f5){logger['info'](_0x34983d,util['inspect'](_0x3599f5,{'showHidden':![],'depth':null}));};};exports[_0x9cc7('0xb')]=function(_0x103c4f,_0x1a1e02,_0x3029e0){return{'message':_0x103c4f,'unlock':_0x1a1e02,'active':_0x3029e0};};exports[_0x9cc7('0xc')]=function(_0x1599d9,_0x4af594,_0xcb6259){if(!_[_0x9cc7('0xd')](_0xcb6259)&&_0x9cc7('0xe')===typeof _0xcb6259&&!_[_0x9cc7('0xf')](_0xcb6259)){if(!_[_0x9cc7('0xd')](_0x4af594)&&_0x9cc7('0xe')===typeof _0x4af594&&!_['isEmpty'](_0x4af594)){return util[_0x9cc7('0x10')](_0x9cc7('0x11'),_0x4af594,_0xcb6259);}return util[_0x9cc7('0x10')](_0x9cc7('0x11'),_0xcb6259,_0xcb6259);}if(!_['isUndefined'](_0x1599d9)&&_0x9cc7('0xe')===typeof _0x1599d9&&!_[_0x9cc7('0xf')](_0x1599d9)){return _0x1599d9;}return _0x9cc7('0x12');};exports[_0x9cc7('0x13')]=function(_0x14fdf2){if(_[_0x9cc7('0x14')](_0x14fdf2)){return![];}return _0x14fdf2;};exports['addVariables']=function(_0x177e7f,_0x122ae9,_0x4d2c14,_0x52eaa4,_0x3f7fff,_0x21dd82){var _0x1ee8db={'XMD-QUEUE':_0x122ae9[_0x9cc7('0x15')]?_0x122ae9[_0x9cc7('0x15')][_0x9cc7('0x16')]:'','XMD-CALLERID':_0x52eaa4,'XMD-CALLERID-PREVIEW':_0x21dd82?util[_0x9cc7('0x10')](_0x9cc7('0x11'),_0x21dd82[_0x9cc7('0x17')],_0x21dd82['calleridnum']):_0x52eaa4,'XMD-DIALID':_0x3f7fff,'XMD-CONTACTID':_0x122ae9[_0x9cc7('0x18')],'XMD-CDRTYPE':_0x9cc7('0x19'),'CALLERID(all)':_0x52eaa4,'XMD-VOICEQUEUEID':_0x122ae9[_0x9cc7('0x1a')],'XMD-DIALCHANNEL':_0x4d2c14,'XMD-DIALTIMEOUT':_0x177e7f[_0x9cc7('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x9cc7('0x10')]('\x22rtTxX%s%s\x22',_0x177e7f[_0x9cc7('0x1c')]?'g':'',_[_0x9cc7('0xf')](_0x177e7f['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x177e7f['dialPreviewUrl']||'','XMD-AGI':_0x177e7f['dialQueueProject']?util[_0x9cc7('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x177e7f[_0x9cc7('0x1d')]):_0x9cc7('0x1e'),'XMD-AGIAFTER':_0x177e7f[_0x9cc7('0x1c')]?util[_0x9cc7('0x10')](_0x9cc7('0x1f'),ipAgi,_0x177e7f[_0x9cc7('0x1c')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x21dd82?_0x21dd82['originatecalleridnum']:'','XMD-ORIGINATECALLERIDNAME':_0x21dd82?_0x21dd82['originatecalleridname']:'','XMD-DESTINATION':_0x9cc7('0x20'),'SIPADDHEADER':_0x9cc7('0x21')};if(!_['isEmpty'](_0x177e7f[_0x9cc7('0x22')])){_0x1ee8db[util[_0x9cc7('0x10')]('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x177e7f[_0x9cc7('0x22')];_0x1ee8db[util['format']('%s',_0x9cc7('0x23'))]=_0x3f7fff;}return _0x1ee8db;};exports[_0x9cc7('0x24')]=function(_0x55c4ff){var _0x218d19={};for(var _0x3e87a6 in _0x55c4ff){if(_0x55c4ff[_0x9cc7('0x25')](_0x3e87a6)){_0x218d19[util[_0x9cc7('0x10')]('%s',_[_0x9cc7('0x26')](_0x3e87a6))]=_0x55c4ff[_0x3e87a6];}}return{'variables':_0x218d19};};exports[_0x9cc7('0x27')]=function(_0x4b03e7,_0x2c13fa){if(!_[_0x9cc7('0x14')](_0x4b03e7)){if(_0x4b03e7['hasOwnProperty'](_0x9cc7('0x28'))){if(_0x4b03e7['originated']>0x0){_0x4b03e7[_0x9cc7('0x28')]-=0x1;}else{logger[_0x9cc7('0x9')](_0x9cc7('0x29'),_0x2c13fa);}}}else{logger[_0x9cc7('0x9')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2c13fa);}};exports[_0x9cc7('0x2a')]=function(_0x42b272){var _0xf5258f=moment()[_0x9cc7('0x10')](_0x9cc7('0x2b'));_0x42b272[_0x9cc7('0x2c')]=0xd;_0x42b272[_0x9cc7('0x2d')]=_0x9cc7('0x2e');_0x42b272['starttime']=_0xf5258f;_0x42b272[_0x9cc7('0x2f')]=_0xf5258f;_0x42b272[_0x9cc7('0x30')]=_0xf5258f;};exports[_0x9cc7('0x31')]=function(_0x422a7e,_0x18061b,_0x4b5f86){var _0x25ba99=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x422a7e[_0x9cc7('0x2c')]=_0x18061b;_0x422a7e[_0x9cc7('0x2d')]=_0x4b5f86;_0x422a7e['responsetime']=_0x25ba99;_0x422a7e['ringtime']=utils[_0x9cc7('0x32')](_0x422a7e[_0x9cc7('0x2f')],_0x422a7e[_0x9cc7('0x33')]);};exports[_0x9cc7('0x34')]=function(_0x171fa7,_0x4606c5,_0x1a5abd){_0x171fa7['membername']=_0x4606c5;_0x171fa7['UserId']=_0x1a5abd;};exports['logCustomer']=function(_0x5d89bb,_0x521051,_0x1d1faf){var _0x469171=moment()['format'](_0x9cc7('0x2b'));_0x5d89bb[_0x9cc7('0x2c')]=_0x521051;_0x5d89bb[_0x9cc7('0x2d')]=_0x1d1faf;_0x5d89bb['responsetime']=_0x5d89bb[_0x9cc7('0x2f')]?_0x5d89bb[_0x9cc7('0x2f')]:_0x469171;_0x5d89bb[_0x9cc7('0x30')]=_0x5d89bb[_0x9cc7('0x30')]?_0x5d89bb[_0x9cc7('0x30')]:_0x469171;_0x5d89bb[_0x9cc7('0x35')]=utils['getSeconds'](_0x5d89bb[_0x9cc7('0x2f')]||0x0,_0x5d89bb[_0x9cc7('0x33')]||0x0);_0x5d89bb[_0x9cc7('0x36')]=_0x5d89bb[_0x9cc7('0x37')]?utils['getSeconds'](_0x5d89bb[_0x9cc7('0x30')],_0x5d89bb[_0x9cc7('0x37')]):0x0;};exports['isFailure']=function(_0x1a56e5){return _0x1a56e5===_0x9cc7('0x38');};exports[_0x9cc7('0x39')]=function(_0x35a261,_0x4ed410,_0x391895,_0x5a1ef3,_0x4f2740){var _0x32e1cb=_0x5a1ef3?_0x9cc7('0x3a'):_0x35a261[_0x9cc7('0x17')];_0x32e1cb=_0x4f2740?_0x9cc7('0x3b'):_0x32e1cb;return{'actionid':_0x35a261[_0x9cc7('0x3c')],'action':_0x9cc7('0x3d'),'channel':_0x35a261[_0x9cc7('0x3e')],'callerid':util[_0x9cc7('0x10')]('\x22%s\x22\x20<%s>',_0x32e1cb,_0x35a261[_0x9cc7('0x3f')]),'Exten':_0x9cc7('0x20'),'Context':'from-sip','Priority':'1','variable':_0x391895,'timeout':(_0x4ed410[_0x9cc7('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x35a261['uniqueid']};};exports[_0x9cc7('0x41')]=function(_0x3556df){return _0x3556df[_0x9cc7('0x42')]+_0x3556df[_0x9cc7('0x43')]+_0x3556df[_0x9cc7('0x44')]+_0x3556df[_0x9cc7('0x45')]+_0x3556df[_0x9cc7('0x46')];};exports[_0x9cc7('0x47')]=function(_0x13530b){var _0x49e9f1=_[_0x9cc7('0x48')](_0x13530b);_0x49e9f1['state']=0xf;_0x49e9f1[_0x9cc7('0x2d')]=_0x9cc7('0x49');return _0x49e9f1;};exports[_0x9cc7('0x4a')]=function(_0x10f8fe,_0x285aa8,_0x2120c6){var _0xdba301={};_0xdba301[_0x285aa8]=_0x10f8fe[_0x285aa8];_0xdba301[_0x9cc7('0x4b')]=![];_0xdba301[_0x9cc7('0x4c')]=moment()[_0x9cc7('0x4d')](_0x2120c6,'minutes')[_0x9cc7('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0xdba301[_0x9cc7('0x18')]=_0x10f8fe[_0x9cc7('0x18')];_0xdba301[_0x9cc7('0x4e')]=_0x10f8fe['ListId'];_0xdba301['VoiceQueueId']=_0x10f8fe[_0x9cc7('0x1a')]||undefined;return _0xdba301;};exports[_0x9cc7('0x4f')]=function(_0x49cf82,_0x1db35f){if(!_['isNil'](_0x49cf82)){if(_0x49cf82[_0x9cc7('0x50')]>0x0){_0x49cf82[_0x9cc7('0x50')]-=0x1;}else{logger[_0x9cc7('0x9')](_0x1db35f,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x9cc7('0x9')](_0x1db35f,'[decrementTalkink]\x20is\x20null\x20or\x20undefined');}};exports[_0x9cc7('0x51')]=function(_0xb43b9b){if(_0xb43b9b<=0x0){return!![];}return![];};function buildObj(_0x310931,_0x2cc045,_0x4416c8){_0x310931[_0x9cc7('0x52')]=_0x2cc045;_0x310931['name']=_0x310931[_0x9cc7('0x53')];_0x310931[_0x9cc7('0x54')]=_0x310931[_0x9cc7('0x3e')];_0x310931[_0x9cc7('0x55')]=_0x9cc7('0x56');if(_0x4416c8){_0x310931[_0x9cc7('0x57')]=_0x4416c8[_0x9cc7('0x57')];}return _0x310931;}exports[_0x9cc7('0x58')]=buildObj;exports[_0x9cc7('0x59')]=function(_0x4db9fc){var _0x305a06={};_0x305a06[_0x9cc7('0x53')]=_0x4db9fc['queue'];_0x305a06[_0x9cc7('0x54')]=_0x4db9fc[_0x9cc7('0x3e')];_0x305a06[_0x9cc7('0x3c')]=_0x4db9fc[_0x9cc7('0x3c')];return _0x305a06;};exports[_0x9cc7('0x5a')]=function(_0x592f61){var _0x2361ee=[];for(var _0x476719 in _0x592f61){if(_0x592f61[_0x9cc7('0x25')](_0x476719)){if(!_[_0x9cc7('0x14')](_0x592f61[_0x476719])&&_0x592f61[_0x476719][_0x9cc7('0x2c')]===_0x9cc7('0x5b')&&_0x592f61[_0x476719][_0x9cc7('0x5c')]==='reachable'){_0x2361ee[_0x9cc7('0x5d')](_0x592f61[_0x476719]['id']);}}}return _0x2361ee;};exports[_0x9cc7('0x5e')]=function(_0x2c0da9){var _0x18e255=moment()[_0x9cc7('0x5f')](0x0);var _0x1862fe=moment(_0x2c0da9)[_0x9cc7('0x5f')](0x0);return _0x18e255[_0x9cc7('0x60')](_0x1862fe,'seconds');};exports[_0x9cc7('0x61')]=function(_0x5824a1){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x5824a1[_0x9cc7('0x18')],'ListId':_0x5824a1[_0x9cc7('0x4e')],'VoiceQueueId':_0x5824a1['VoiceQueueId']||undefined,'CampaignId':_0x5824a1[_0x9cc7('0x62')]||undefined};};exports[_0x9cc7('0x63')]=function(_0x5a4264){if(_0x5a4264==='uniqueid'||_0x5a4264===_0x9cc7('0x64')||_0x5a4264===_0x9cc7('0x53')||_0x5a4264===_0x9cc7('0x65')||_0x5a4264==='campaigntype'||_0x5a4264===_0x9cc7('0x66')||_0x5a4264===_0x9cc7('0x67')||_0x5a4264===_0x9cc7('0x3e')||_0x5a4264==='calleridname'||_0x5a4264===_0x9cc7('0x4b')||_0x5a4264===_0x9cc7('0x3f')||_0x5a4264===_0x9cc7('0x4c')||_0x5a4264===_0x9cc7('0x42')||_0x5a4264===_0x9cc7('0x43')||_0x5a4264==='countnoanswerretry'||_0x5a4264==='countglobal'||_0x5a4264===_0x9cc7('0x68')||_0x5a4264===_0x9cc7('0x69')||_0x5a4264===_0x9cc7('0x6a')||_0x5a4264===_0x9cc7('0x6b')||_0x5a4264==='ContactId'||_0x5a4264===_0x9cc7('0x4e')||_0x5a4264==='UserId'||_0x5a4264==='VoiceQueueId'||_0x5a4264===_0x9cc7('0x6c')||_0x5a4264===_0x9cc7('0x6d')||_0x5a4264==='xmd-queue'||_0x5a4264===_0x9cc7('0x6e')||_0x5a4264===_0x9cc7('0x6f')||_0x5a4264===_0x9cc7('0x70')||_0x5a4264===_0x9cc7('0x71')||_0x5a4264===_0x9cc7('0x72')||_0x5a4264===_0x9cc7('0x73')||_0x5a4264===_0x9cc7('0x74')||_0x5a4264===_0x9cc7('0x75')||_0x5a4264===_0x9cc7('0x76')||_0x5a4264==='xmd-callerid'||_0x5a4264===_0x9cc7('0x77')||_0x5a4264===_0x9cc7('0x78')||_0x5a4264==='rtpaudioqos'||_0x5a4264==='rtpaudioqosbridged'||_0x5a4264===_0x9cc7('0x79')||_0x5a4264===_0x9cc7('0x7a')||_0x5a4264===_0x9cc7('0x7b')||_0x5a4264===_0x9cc7('0x7c')||_0x5a4264==='rtpaudioqosrtt'||_0x5a4264===_0x9cc7('0x7d')||_0x5a4264===_0x9cc7('0x7e')||_0x5a4264==='rtpaudioqosbridged'||_0x5a4264===_0x9cc7('0x79')||_0x5a4264===_0x9cc7('0x7a')||_0x5a4264===_0x9cc7('0x7b')||_0x5a4264==='rtpaudioqoslossbridged'||_0x5a4264==='rtpaudioqosrtt'||_0x5a4264==='rtpaudioqosrttbridged'||_0x5a4264==='bridgepeer'||_0x5a4264===_0x9cc7('0x7f')||_0x5a4264===_0x9cc7('0x2c')||_0x5a4264===_0x9cc7('0x2d')){return![];}return!![];};exports[_0x9cc7('0x80')]=function(_0x324d60,_0x16f0d7){var _0x26841b,_0x2e7b54,_0x301db6;if(_0x16f0d7<=0x0){_0x16f0d7=0x1;}_0x26841b=new RegExp(_0x9cc7('0x81')+_0x16f0d7+'}$');_0x2e7b54=Math['pow'](0xa,_0x16f0d7-0x1);_0x301db6=Math[_0x9cc7('0x82')](0xa,_0x16f0d7)-0x1;return util[_0x9cc7('0x10')]('%s',_[_0x9cc7('0x83')](_0x324d60,_0x26841b,_[_0x9cc7('0x84')](_0x2e7b54,_0x301db6)));};exports['extractCalleridName']=function(_0x321bf0){var _0x6fa7fd=_0x321bf0[_0x9cc7('0x85')](/"(.*?)"/);return _0x6fa7fd?_0x6fa7fd[0x1]:_0x321bf0;};exports[_0x9cc7('0x86')]=function(_0x4c7911){var _0x5a18e2=_0x4c7911['match'](/<(.*?)>/);return _0x5a18e2?_0x5a18e2[0x1]:_0x4c7911;};function buildNoAnswerEventPayload(_0x35b637,_0x448ee4){var _0x541c69=buildObj(_0x35b637,_0x9cc7('0x87'));if(!_[_0x9cc7('0xf')](_0x448ee4['variables'])){Object[_0x9cc7('0x88')](_0x448ee4['variables'])[_0x9cc7('0x89')](function(_0x4586ff){_0x541c69[_0x4586ff[_0x9cc7('0x8a')]()]=_0x448ee4[_0x9cc7('0x8b')][_0x4586ff];});}return _0x541c69;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index e4dd4d3..ddaa87c 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 _0x5b92=['voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove','queuepause','reload','voicequeuechannel'];(function(_0x34e668,_0xe92467){var _0x3b84a2=function(_0x22d059){while(--_0x22d059){_0x34e668['push'](_0x34e668['shift']());}};_0x3b84a2(++_0xe92467);}(_0x5b92,0xb7));var _0x25b9=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5b92[_0x5ddb1c];return _0x354adc;};'use strict';exports[_0x25b9('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x25b9('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x25b9('0x2'),'required':![]}};exports[_0x25b9('0x3')]={'queue':{'type':_0x25b9('0x1'),'required':!![]},'interface':{'type':_0x25b9('0x1'),'required':!![]}};exports[_0x25b9('0x4')]={'interface':{'type':_0x25b9('0x1'),'required':!![]},'paused':{'type':_0x25b9('0x2')},'reason':{'type':_0x25b9('0x1'),'required':![]}};exports[_0x25b9('0x5')]={'module':{'type':_0x25b9('0x1'),'required':![]}};exports[_0x25b9('0x6')]={'uniqueid':{'type':_0x25b9('0x1'),'required':!![]}};exports[_0x25b9('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x25b9('0x8')]={'uniqueid':{'type':_0x25b9('0x1'),'required':!![]}};exports[_0x25b9('0x9')]={'uniqueid':{'type':_0x25b9('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0x25b9('0x1')}}; \ No newline at end of file +var _0x3129=['boolean','queueremove','queuepause','voicechannel','voicequeuechannelredirect','queueadd','string','number'];(function(_0x1ea46e,_0x52a054){var _0x50ab27=function(_0x26cbe2){while(--_0x26cbe2){_0x1ea46e['push'](_0x1ea46e['shift']());}};_0x50ab27(++_0x52a054);}(_0x3129,0x14d));var _0x9312=function(_0x3cdcbb,_0x1c9f17){_0x3cdcbb=_0x3cdcbb-0x0;var _0x18bbd2=_0x3129[_0x3cdcbb];return _0x18bbd2;};'use strict';exports[_0x9312('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x9312('0x1'),'required':!![]},'membername':{'type':_0x9312('0x1'),'required':!![]},'penalty':{'type':_0x9312('0x2'),'required':![]},'paused':{'type':_0x9312('0x3'),'required':![]}};exports[_0x9312('0x4')]={'queue':{'type':_0x9312('0x1'),'required':!![]},'interface':{'type':_0x9312('0x1'),'required':!![]}};exports[_0x9312('0x5')]={'interface':{'type':_0x9312('0x1'),'required':!![]},'paused':{'type':_0x9312('0x3')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x9312('0x1'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x9312('0x1'),'required':!![]}};exports[_0x9312('0x6')]={'uniqueid':{'type':_0x9312('0x1'),'required':!![]},'filename':{'type':_0x9312('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0x9312('0x1'),'required':!![]}};exports[_0x9312('0x7')]={'uniqueid':{'type':_0x9312('0x1'),'required':!![]},'exten':{'type':_0x9312('0x1'),'required':!![]},'context':{'type':_0x9312('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index e6b7f1e..f8cedcb 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x5b2f1a,_0x5f21b6){var _0x1cff47=function(_0x1c175f){while(--_0x1c175f){_0x5b2f1a['push'](_0x5b2f1a['shift']());}};_0x1cff47(++_0x5f21b6);}(_0xdb28,0x106));var _0x8db2=function(_0x4828f5,_0x232ab2){_0x4828f5=_0x4828f5-0x0;var _0x14b2a9=_0xdb28[_0x4828f5];return _0x14b2a9;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +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(_0x2aa117,_0x28e829){var _0x449e16=function(_0x556d95){while(--_0x556d95){_0x2aa117['push'](_0x2aa117['shift']());}};_0x449e16(++_0x28e829);}(_0xb10b,0x12a));var _0xbb10=function(_0x1d95e1,_0x2dac2f){_0x1d95e1=_0x1d95e1-0x0;var _0x542fa0=_0xb10b[_0x1d95e1];return _0x542fa0;};'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 diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index d60d79e..565cb45 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 _0x8bf2=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x347ce2,_0x131d66){var _0x38d479=function(_0xf17344){while(--_0xf17344){_0x347ce2['push'](_0x347ce2['shift']());}};_0x38d479(++_0x131d66);}(_0x8bf2,0x154));var _0x28bf=function(_0x4b1dd4,_0x292d3a){_0x4b1dd4=_0x4b1dd4-0x0;var _0x2c87dd=_0x8bf2[_0x4b1dd4];return _0x2c87dd;};'use strict';function mergeDBDataToRealtime(_0x237a33,_0x5d19aa){var _0x256864=Object[_0x28bf('0x0')]({},_0x237a33);for(var _0x25434a in _0x5d19aa){if(_0x256864[_0x28bf('0x1')](_0x25434a)){_0x256864[_0x25434a]=_0x5d19aa[_0x25434a];}}return _0x256864;}exports[_0x28bf('0x2')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x7983=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x229226,_0x4cc6da){var _0x35e879=function(_0x268c4e){while(--_0x268c4e){_0x229226['push'](_0x229226['shift']());}};_0x35e879(++_0x4cc6da);}(_0x7983,0x6a));var _0x3798=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7983[_0x1d1779];return _0x2377e9;};'use strict';function mergeDBDataToRealtime(_0x46a054,_0x5aa522){var _0x483c25=Object[_0x3798('0x0')]({},_0x46a054);for(var _0x2077fc in _0x5aa522){if(_0x483c25[_0x3798('0x1')](_0x2077fc)){_0x483c25[_0x2077fc]=_0x5aa522[_0x2077fc];}}return _0x483c25;}exports[_0x3798('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 ceb76e2..a34f792 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 _0x630b=['transfereelinkedid','UserId','split','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','forEach','startsWith','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','SIP/%s','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexitAt','create','match','getAgentByInternal','keys','length','getCallType','channel','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','disposition','ANSWERED','calleridname','transfers','linkedid'];(function(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x630b,0xcb));var _0xb630=function(_0x17e759,_0xa2f033){_0x17e759=_0x17e759-0x0;var _0x21d01c=_0x630b[_0x17e759];return _0x21d01c;};'use strict';var _=require(_0xb630('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xb630('0x1'));var ami=require(_0xb630('0x2'));var RpcVoiceAgentReport=require(_0xb630('0x3'));var RpcVoiceCallReport=require(_0xb630('0x4'));var RpcVoiceDialReport=require(_0xb630('0x5'));var RpcMemberReport=require(_0xb630('0x6'));var RpcVoiceQueueReport=require(_0xb630('0x7'));var RpcVoiceRecording=require(_0xb630('0x8'));var RpcVoiceTransferReport=require(_0xb630('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xb630('0xa'));var VoiceDialReport=require(_0xb630('0xb'));var UserReport=require(_0xb630('0xc'));function Report(_0x48927c){this[_0xb630('0xd')]=_0x48927c;this[_0xb630('0xe')]=_0x48927c[_0xb630('0xe')];this[_0xb630('0xf')]=_0x48927c[_0xb630('0xf')];}Report[_0xb630('0x10')][_0xb630('0x11')]=function(_0x337bf3){var _0x5ac68a=new VoiceQueueReport(this[_0xb630('0xd')]);var _0x593b6f=new VoiceAgentReport(this[_0xb630('0xd')]);var _0x1bc581=new VoiceDialReport(this[_0xb630('0xd')]);var _0xc99c56=new VoiceCallReport(this[_0xb630('0xd')]);var _0x9bcd99=new UserReport(this[_0xb630('0xd')]);if(config['xdr']&&config[_0xb630('0x12')][_0xb630('0x13')]){ami['on'](_0xb630('0x14'),this[_0xb630('0x15')][_0xb630('0x16')](this));ami['on'](_0xb630('0x17'),this[_0xb630('0x18')][_0xb630('0x16')](this));ami['on'](_0xb630('0x19'),this[_0xb630('0x1a')]['bind'](this));ami['on'](_0xb630('0x1b'),this[_0xb630('0x1c')]['bind'](this));ami['on'](_0xb630('0x1d'),this[_0xb630('0x1e')]['bind'](this));ami['on'](_0xb630('0x1f'),this[_0xb630('0x20')][_0xb630('0x16')](this));}};Report['prototype'][_0xb630('0x21')]=function(_0x44e017){var _0x56fed7;_0x56fed7=_[_0xb630('0x22')](this[_0xb630('0xe')],function(_0x4fe29b){return _0x4fe29b['accountcode']==_0x44e017||_0x4fe29b[_0xb630('0x23')]==_0x44e017;});if(_[_0xb630('0x24')](_0x56fed7)){var _0x9b2492=_[_0xb630('0x22')](this[_0xb630('0xf')],function(_0x4459ae){return _0x4459ae[_0xb630('0x25')]==_0x44e017||_0x4459ae[_0xb630('0x23')]==_0x44e017;});if(_0x9b2492){_0x56fed7=_[_0xb630('0x22')](this[_0xb630('0xe')],function(_0x341622){return _0x341622[_0xb630('0x26')]==util[_0xb630('0x27')](_0xb630('0x28'),_0x9b2492[_0xb630('0x23')]);});}}return _0x56fed7;};Report[_0xb630('0x10')][_0xb630('0x15')]=function(_0x13a5ea){for(var _0x3f49fc=0x0;_0x3f49fc<_0x13a5ea['length'];_0x3f49fc+=0x1){var _0x3aa0e2=this[_0xb630('0x21')](_0x13a5ea[_0x3f49fc][_0xb630('0x29')]);if(_0x3aa0e2){_0x13a5ea[_0x3f49fc][_0xb630('0x25')]=_0x3aa0e2['accountcode'];_0x13a5ea[_0x3f49fc][_0xb630('0x2a')]=!![];_0x13a5ea[_0x3f49fc][_0xb630('0x2b')]=_0x3aa0e2[_0xb630('0x23')];_0x13a5ea[_0x3f49fc]['interface']=_[_0xb630('0x24')](_0x3aa0e2[_0xb630('0x26')])?util['format'](_0xb630('0x28'),_0x3aa0e2['name']):_0x3aa0e2[_0xb630('0x26')];if(_0x13a5ea[_0x3f49fc][_0xb630('0x2c')]){_0x13a5ea[_0x3f49fc]['queuecallercompleteAt']=moment()[_0xb630('0x27')](_0xb630('0x2d'));}if(_0x13a5ea[_0x3f49fc]['queuecallerexit']){_0x13a5ea[_0x3f49fc][_0xb630('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xb630('0x15')](_0x13a5ea[_0x3f49fc]);}RpcVoiceQueueReport[_0xb630('0x2f')](_0x13a5ea[_0x3f49fc]);}};function extractCalleridNumber(_0x4668e1){var _0x227283=_0x4668e1[_0xb630('0x30')](/<(.*?)>/);return _0x227283?_0x227283[0x1]:_0x4668e1;}Report[_0xb630('0x10')][_0xb630('0x31')]=function(_0x5cfe0b){for(var _0x3f11a4=0x0;_0x3f11a4',_0x3db54e[_0xb630('0x49')],_0x3db54e[_0xb630('0x36')]);}if(RpcVoiceTransferReport[_0xb630('0x4a')][_0x3db54e['linkedid']]){var _0x2f67c5=RpcVoiceTransferReport[_0xb630('0x4a')][_0x3db54e[_0xb630('0x4b')]];_0x2f67c5[_0xb630('0x4c')]=_0x3db54e['uniqueid'];RpcVoiceTransferReport['blindTransfer'](_0x2f67c5);delete RpcVoiceTransferReport[_0xb630('0x4a')][_0x3db54e[_0xb630('0x4b')]];}if(_[_0xb630('0x24')](_0x3db54e[_0xb630('0x3b')])){_0x3db54e[_0xb630('0x3b')]=this[_0xb630('0x34')](_0x3db54e);}if(_[_0xb630('0x24')](_0x3db54e[_0xb630('0x4d')])){var _0x24b6ed=_0x3db54e['channel'][_0xb630('0x4e')]('-')[0x0];var _0x1d1c58=this[_0xb630('0xe')][_0x24b6ed];if(!_0x1d1c58)_0x1d1c58=this[_0xb630('0x31')](_0x3db54e['accountcode']);if(_0x1d1c58){_0x3db54e['UserId']=_0x1d1c58['id'];_0x3db54e['membername']=_0x1d1c58[_0xb630('0x23')];}}RpcVoiceCallReport[_0xb630('0x2f')](_0x3db54e);if(_0x3db54e[_0xb630('0x4f')]){for(var _0x5ad727=0x0;_0x5ad727<_0x3db54e[_0xb630('0x50')][_0xb630('0x33')];_0x5ad727+=0x1){_0x3db54e[_0xb630('0x51')]=_0x3db54e[_0xb630('0x50')][_0x5ad727]['filename'];_0x3db54e[_0xb630('0x52')]=_0x3db54e[_0xb630('0x50')][_0x5ad727]['createdAt'];if(_0x3db54e[_0xb630('0x3a')]==_0xb630('0x43')){_0x3db54e[_0xb630('0x36')]=_0x3db54e[_0xb630('0x29')];_0x3db54e['calleridname']=_0x3db54e['connectedlinename'];_0x3db54e[_0xb630('0x29')]=_0x3db54e[_0xb630('0x25')];_0x3db54e[_0xb630('0x53')]=_0x3db54e['membername'];_0x3db54e['exten']=_0x3db54e['originatecalleridnum'];}else if(_0x3db54e[_0xb630('0x3a')]==_0xb630('0x54')){_0x3db54e[_0xb630('0x36')]=_0x3db54e['destination'];_0x3db54e[_0xb630('0x3a')]=_0x3db54e[_0xb630('0x45')];}RpcVoiceRecording[_0xb630('0x2f')](_0x3db54e);}}};Report[_0xb630('0x10')]['voiceAgentReport']=function(_0xc9707f){if(_['isArray'](_0xc9707f)){_0xc9707f[_0xb630('0x55')](function(_0x39f639){RpcVoiceAgentReport[_0xb630('0x2f')](_0x39f639);});}else{RpcVoiceAgentReport['create'](_0xc9707f);}};Report[_0xb630('0x10')][_0xb630('0x1c')]=function(_0xd5562f){RpcVoiceDialReport['create'](_0xd5562f);var _0x4a4ffc;var _0x314f77;var _0x212ec5=_0xd5562f['channel'];if(_[_0xb630('0x56')](_0x212ec5,_0xb630('0x57'))){_0x314f77=_0x212ec5[_0xb630('0x58')](_0x212ec5['indexOf']('/')+0x1,_0x212ec5[_0xb630('0x59')]('@'));_0x4a4ffc=_[_0xb630('0x22')](this['agents'],function(_0x292828){return _0x292828[_0xb630('0x5a')]==_0x314f77||_0x292828['phone']==_0x314f77||_0x292828['accountcode']==_0x314f77;});}else{_0x314f77=_0x212ec5['substring'](_0x212ec5['indexOf']('/')+0x1,_0x212ec5[_0xb630('0x5b')]('-'));_0x4a4ffc=this[_0xb630('0x21')](_0x314f77);}if(_0x4a4ffc){_0xd5562f[_0xb630('0x26')]=_[_0xb630('0x24')](_0x4a4ffc[_0xb630('0x26')])?util['format'](_0xb630('0x28'),_0x4a4ffc['name']):_0x4a4ffc[_0xb630('0x26')];_0xd5562f['membername']=_0x4a4ffc[_0xb630('0x23')];_0xd5562f[_0xb630('0x25')]=_0x4a4ffc[_0xb630('0x25')];RpcMemberReport[_0xb630('0x1c')](_0xd5562f);}};Report[_0xb630('0x10')][_0xb630('0x1e')]=function(_0x47804e){RpcVoiceTransferReport[_0xb630('0x4a')][_0x47804e[_0xb630('0x5c')]]=_0x47804e;};Report[_0xb630('0x10')][_0xb630('0x20')]=function(_0x3c2ae9){RpcVoiceTransferReport[_0xb630('0x20')](_0x3c2ae9);};module['exports']=Report; \ No newline at end of file +var _0xcd2d=['UserId','monitors','monitorFilename','filename','createdAt','xcally-motion-preview','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','interface','SIP/%s','connectedlinenum','lastAssignedTo','isNil','format','queuecallercomplete','queuecallerexit','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','length','keys','getCallType','channel','split','internal','voiceCallReport','destination','exten','type','queue','lastdata','from-voip-provider','context','from-sip','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','callerid','disposition','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','transfers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd2d,0x1e8));var _0xdcd2=function(_0x5b4bee,_0x272800){_0x5b4bee=_0x5b4bee-0x0;var _0x34f9f2=_0xcd2d[_0x5b4bee];return _0x34f9f2;};'use strict';var _=require(_0xdcd2('0x0'));var moment=require(_0xdcd2('0x1'));var util=require(_0xdcd2('0x2'));var config=require(_0xdcd2('0x3'));var ami=require(_0xdcd2('0x4'));var RpcVoiceAgentReport=require(_0xdcd2('0x5'));var RpcVoiceCallReport=require(_0xdcd2('0x6'));var RpcVoiceDialReport=require(_0xdcd2('0x7'));var RpcMemberReport=require(_0xdcd2('0x8'));var RpcVoiceQueueReport=require(_0xdcd2('0x9'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xdcd2('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xdcd2('0xb'));var VoiceAgentReport=require(_0xdcd2('0xc'));var VoiceDialReport=require(_0xdcd2('0xd'));var UserReport=require(_0xdcd2('0xe'));function Report(_0x5d44af){this[_0xdcd2('0xf')]=_0x5d44af;this[_0xdcd2('0x10')]=_0x5d44af['agents'];this[_0xdcd2('0x11')]=_0x5d44af['telephones'];}Report[_0xdcd2('0x12')][_0xdcd2('0x13')]=function(_0x2c0ed6){var _0x6e9054=new VoiceQueueReport(this[_0xdcd2('0xf')]);var _0x43851c=new VoiceAgentReport(this[_0xdcd2('0xf')]);var _0x5e4d4c=new VoiceDialReport(this[_0xdcd2('0xf')]);var _0x555e80=new VoiceCallReport(this['realtime']);var _0x20e96a=new UserReport(this[_0xdcd2('0xf')]);if(config[_0xdcd2('0x14')]&&config[_0xdcd2('0x14')][_0xdcd2('0x15')]){ami['on'](_0xdcd2('0x16'),this[_0xdcd2('0x17')][_0xdcd2('0x18')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0xdcd2('0x19'),this[_0xdcd2('0x1a')]['bind'](this));ami['on'](_0xdcd2('0x1b'),this[_0xdcd2('0x1c')]['bind'](this));ami['on'](_0xdcd2('0x1d'),this[_0xdcd2('0x1e')][_0xdcd2('0x18')](this));ami['on'](_0xdcd2('0x1f'),this[_0xdcd2('0x20')][_0xdcd2('0x18')](this));}};Report[_0xdcd2('0x12')][_0xdcd2('0x21')]=function(_0x302dff){var _0xbb41f;_0xbb41f=_[_0xdcd2('0x22')](this[_0xdcd2('0x10')],function(_0x37f376){return _0x37f376[_0xdcd2('0x23')]==_0x302dff||_0x37f376[_0xdcd2('0x24')]==_0x302dff;});if(_['isNil'](_0xbb41f)){var _0x17d142=_[_0xdcd2('0x22')](this[_0xdcd2('0x11')],function(_0x5d241a){return _0x5d241a[_0xdcd2('0x23')]==_0x302dff||_0x5d241a[_0xdcd2('0x24')]==_0x302dff;});if(_0x17d142){_0xbb41f=_[_0xdcd2('0x22')](this[_0xdcd2('0x10')],function(_0x5b3a23){return _0x5b3a23[_0xdcd2('0x25')]==util['format'](_0xdcd2('0x26'),_0x17d142[_0xdcd2('0x24')]);});}}return _0xbb41f;};Report[_0xdcd2('0x12')][_0xdcd2('0x17')]=function(_0x37494e){for(var _0x24b865=0x0;_0x24b865<_0x37494e['length'];_0x24b865+=0x1){var _0x1333ca=this['findAgent'](_0x37494e[_0x24b865][_0xdcd2('0x27')]);if(_0x1333ca){_0x37494e[_0x24b865]['accountcode']=_0x1333ca['accountcode'];_0x37494e[_0x24b865]['assigned']=!![];_0x37494e[_0x24b865][_0xdcd2('0x28')]=_0x1333ca[_0xdcd2('0x24')];_0x37494e[_0x24b865]['interface']=_[_0xdcd2('0x29')](_0x1333ca[_0xdcd2('0x25')])?util[_0xdcd2('0x2a')](_0xdcd2('0x26'),_0x1333ca['name']):_0x1333ca[_0xdcd2('0x25')];if(_0x37494e[_0x24b865][_0xdcd2('0x2b')]){_0x37494e[_0x24b865]['queuecallercompleteAt']=moment()[_0xdcd2('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x37494e[_0x24b865][_0xdcd2('0x2c')]){_0x37494e[_0x24b865]['queuecallerexitAt']=moment()['format'](_0xdcd2('0x2d'));}RpcMemberReport[_0xdcd2('0x17')](_0x37494e[_0x24b865]);}RpcVoiceQueueReport[_0xdcd2('0x2e')](_0x37494e[_0x24b865]);}};function extractCalleridNumber(_0x30d54c){var _0x998729=_0x30d54c[_0xdcd2('0x2f')](/<(.*?)>/);return _0x998729?_0x998729[0x1]:_0x30d54c;}Report[_0xdcd2('0x12')][_0xdcd2('0x30')]=function(_0x4957ec){for(var _0x35b2d3=0x0;_0x35b2d30x0?!![]:![];if(!_0x17f8a9){return this[_0x37cb('0x19')](this[_0x37cb('0x64')][_0x37cb('0x74')]);}};VoiceQueueReport[_0x37cb('0x3e')][_0x37cb('0x1c')]=function(_0x3a8049){var _0x278968=this[_0x37cb('0x64')]['id'];if(this[_0x37cb('0x64')][_0x37cb('0x66')][_0x278968]&&this['summary'][_0x37cb('0x66')][_0x278968][_0x3a8049['actionid']]){this[_0x37cb('0x64')]['queuestatus'][_0x278968][_0x3a8049[_0x37cb('0x65')]][_0x37cb('0x11')][_0x37cb('0x75')](_0x3a8049);}};VoiceQueueReport[_0x37cb('0x3e')]['syncQueueSummary']=function(_0x5ca29b){var _0xf43c34=this;try{if(this[_0x37cb('0x76')](_0x5ca29b)&&this[_0x37cb('0x76')](_0x5ca29b[_0x37cb('0x53')])){logger['debug'](_0x37cb('0x77'),util[_0x37cb('0x46')](_0x5ca29b,{'showHidden':![],'depth':null}));var _0x213937=this[_0x37cb('0x14')][_0x5ca29b[_0x37cb('0x53')]];if(_0x213937){logger[_0x37cb('0x4e')](_0x37cb('0x78'),_0x213937[_0x37cb('0x5e')]);this['summary'][_0x37cb('0x79')][_0x213937[_0x37cb('0x5e')]]={'summaryEvent':_0x5ca29b};this[_0x37cb('0x64')][_0x37cb('0x73')]+=0x1;return ami[_0x37cb('0x41')]({'action':_0x37cb('0x66'),'queue':_0x213937[_0x37cb('0x5e')]})[_0x37cb('0x7a')](function(_0x5a206f){if(!_0xf43c34[_0x37cb('0x64')][_0x37cb('0x66')][_0x5ca29b[_0x37cb('0x65')]]){_0xf43c34[_0x37cb('0x64')][_0x37cb('0x66')][_0x5ca29b[_0x37cb('0x65')]]={};}_0xf43c34[_0x37cb('0x64')][_0x37cb('0x66')][_0x5ca29b['actionid']][_0x5a206f[_0x37cb('0x65')]]={'queue':_0x213937[_0x37cb('0x5e')],'agents':[]};})[_0x37cb('0x44')](function(_0x3c3909){throw _0x3c3909;});}}}catch(_0x152ee9){logger['error'](_0x37cb('0x67'),util[_0x37cb('0x46')](_0x152ee9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x37cb('0x19')]=function(_0x7c6403){if(this[_0x37cb('0x64')][_0x37cb('0x73')]>0x0){this[_0x37cb('0x64')][_0x37cb('0x74')]=_0x7c6403;return;}logger['debug'](_0x37cb('0x7b'),util[_0x37cb('0x46')](_0x7c6403,{'showHidden':![],'depth':null}));this[_0x37cb('0x64')]=initializeSummary();ami[_0x37cb('0x4c')](_0x37cb('0x7c'),{});};VoiceQueueReport[_0x37cb('0x3e')]['syncQueueCallerJoin']=function(_0x542ef6){try{if(this[_0x37cb('0x76')](_0x542ef6)){logger[_0x37cb('0x4e')]('[%s][voiceQueueReport][queuecallerjoin]',_0x542ef6[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x542ef6,{'showHidden':![],'depth':null}));if(_[_0x37cb('0x60')](this[_0x37cb('0x10')][_0x542ef6['uniqueid']])){this[_0x37cb('0x10')][_0x542ef6[_0x37cb('0x51')]]=[];}if(_[_0x37cb('0x60')](this[_0x37cb('0x12')][_0x542ef6[_0x37cb('0x51')]])){this[_0x37cb('0x12')][_0x542ef6[_0x37cb('0x51')]]={};}var _0x53b3fb=new QueueReport();_0x53b3fb[_0x37cb('0x53')]=_0x542ef6[_0x37cb('0x53')];_0x53b3fb[_0x37cb('0x70')]=this[_0x37cb('0x14')][_0x53b3fb[_0x37cb('0x53')]]&&this[_0x37cb('0x14')][_0x53b3fb[_0x37cb('0x53')]]['type']?this[_0x37cb('0x14')][_0x53b3fb[_0x37cb('0x53')]][_0x37cb('0x70')]||_0x37cb('0x5c'):'inbound';_0x53b3fb[_0x37cb('0x7d')]=moment()[_0x37cb('0x58')](_0x37cb('0x7e'));_0x53b3fb[_0x37cb('0x7f')]=_0x542ef6['position'];_0x53b3fb['count']=_0x542ef6[_0x37cb('0x80')];_0x53b3fb['uniqueid']=_0x542ef6['uniqueid'];_0x53b3fb[_0x37cb('0x81')]=this[_0x37cb('0x12')][_0x542ef6[_0x37cb('0x51')]][_0x37cb('0x81')];logger['info'](_0x37cb('0x82'),_0x53b3fb['queue'],_0x53b3fb[_0x37cb('0x70')]);Object['assign'](_0x53b3fb,_['pick'](_0x542ef6,_['keys'](_0x53b3fb)));this[_0x37cb('0x10')][_0x542ef6[_0x37cb('0x51')]][_0x37cb('0x75')](_0x53b3fb);this[_0x37cb('0x12')][_0x542ef6[_0x37cb('0x51')]]=_0x53b3fb;this[_0x37cb('0x4d')](_0x53b3fb,_0x37cb('0x1e'));}}catch(_0x220752){logger[_0x37cb('0x47')](_0x37cb('0x83'),_0x542ef6[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x220752,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerAbandon']=function(_0x3301a9){try{if(this[_0x37cb('0x76')](_0x3301a9)){logger[_0x37cb('0x4e')](_0x37cb('0x84'),_0x3301a9[_0x37cb('0x51')],util['inspect'](_0x3301a9,{'showHidden':![],'depth':null}));if(this[_0x37cb('0x10')][_0x3301a9[_0x37cb('0x51')]]){var _0x34181c=_['last'](this[_0x37cb('0x10')][_0x3301a9[_0x37cb('0x51')]]);_0x34181c[_0x37cb('0x3d')]=![];_0x34181c[_0x37cb('0x85')]=null;_0x34181c['holdtime']=_0x3301a9[_0x37cb('0x86')];_0x34181c[_0x37cb('0x87')]=_0x3301a9[_0x37cb('0x87')];_0x34181c[_0x37cb('0x20')]=!![];_0x34181c['queuecallerabandonAt']=moment()[_0x37cb('0x58')](_0x37cb('0x7e'));_0x34181c[_0x37cb('0x88')]=_0x37cb('0x89');_0x34181c[_0x37cb('0x8a')]=null;logger['info'](_0x37cb('0x8b'),_0x34181c[_0x37cb('0x53')],_0x34181c[_0x37cb('0x70')]);this[_0x37cb('0x12')][_0x3301a9[_0x37cb('0x51')]]=_0x34181c;this[_0x37cb('0x4a')](_0x34181c,'queuecallerabandon');}}}catch(_0x101506){logger[_0x37cb('0x47')](_0x37cb('0x84'),_0x3301a9[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x101506,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37cb('0x3e')][_0x37cb('0x22')]=function(_0x26712d){try{if(this[_0x37cb('0x76')](_0x26712d)){logger['debug'](_0x37cb('0x8c'),_0x26712d[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x26712d,{'showHidden':![],'depth':null}));if(this[_0x37cb('0x10')][_0x26712d[_0x37cb('0x51')]]){var _0x22e081=_[_0x37cb('0x8d')](this['queueReports'][_0x26712d['uniqueid']]);_0x22e081[_0x37cb('0x8e')]=moment()['format'](_0x37cb('0x7e'));_0x22e081[_0x37cb('0x8f')]=_0x26712d[_0x37cb('0x8f')];_0x22e081[_0x37cb('0x90')]=_0x26712d[_0x37cb('0x90')];logger['info'](_0x37cb('0x91'),_0x22e081[_0x37cb('0x53')],_0x22e081[_0x37cb('0x70')],_0x26712d[_0x37cb('0x8f')],_0x26712d[_0x37cb('0x90')]);this[_0x37cb('0x12')][_0x26712d[_0x37cb('0x51')]]=_0x22e081;this['emitVoiceQueueChannelSave'](_0x22e081,_0x37cb('0x21'));}}}catch(_0x14e54f){logger['error']('[%s][voiceQueueReport][queuecallerleave]',_0x26712d[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x14e54f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37cb('0x3e')][_0x37cb('0x26')]=function(_0x5a1d97){try{if(this[_0x37cb('0x76')](_0x5a1d97)){logger[_0x37cb('0x4e')](_0x37cb('0x92'),_0x5a1d97['uniqueid'],util[_0x37cb('0x46')](_0x5a1d97,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5a1d97[_0x37cb('0x51')]]){var _0x18a26b=_['last'](this['queueReports'][_0x5a1d97[_0x37cb('0x51')]]);_0x18a26b[_0x37cb('0x3d')]=!![];_0x18a26b[_0x37cb('0x88')]=_0x37cb('0x93');logger[_0x37cb('0x94')](_0x37cb('0x95'),_0x18a26b[_0x37cb('0x53')],_0x18a26b[_0x37cb('0x70')]);}}}catch(_0x4711c2){logger['error'](_0x37cb('0x92'),_0x5a1d97[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x4711c2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37cb('0x3e')]['syncAgentComplete']=function(_0x3fc1a3){try{if(this['isNotNull'](_0x3fc1a3)){logger[_0x37cb('0x4e')]('[%s][voiceQueueReport][agentcomplete]',_0x3fc1a3['uniqueid'],util['inspect'](_0x3fc1a3,{'showHidden':![],'depth':null}));if(this[_0x37cb('0x10')][_0x3fc1a3[_0x37cb('0x51')]]){var _0x5b4ac1=_[_0x37cb('0x8d')](this[_0x37cb('0x10')][_0x3fc1a3[_0x37cb('0x51')]]);_0x5b4ac1[_0x37cb('0x20')]=![];_0x5b4ac1[_0x37cb('0x96')]=null;_0x5b4ac1[_0x37cb('0x97')]=!![];_0x5b4ac1[_0x37cb('0x8a')]=_0x3fc1a3[_0x37cb('0x98')];_0x5b4ac1[_0x37cb('0x86')]=_0x3fc1a3['holdtime'];_0x5b4ac1[_0x37cb('0x3d')]=!![];_0x5b4ac1['queuecallerexit']=![];_0x5b4ac1['queuecallerexitAt']=null;if(!_0x5b4ac1['transfer']){if(_0x3fc1a3['reason']=='transfer'){_0x5b4ac1['queuecallerexitreason']=_0x37cb('0x99');logger['info'](_0x37cb('0x9a'),_0x5b4ac1['queue'],_0x5b4ac1['type']);}else{if(_[_0x37cb('0x9b')](_0x3fc1a3['channel'][_0x37cb('0x9c')](),'local/')){if(this[_0x37cb('0x10')][_0x3fc1a3[_0x37cb('0x9d')]]){var _0x2a8f42=_[_0x37cb('0x8d')](this['queueReports'][_0x3fc1a3['linkedid']]);_0x2a8f42['queuecallercomplete']=![];_0x2a8f42['queuecallerexit']=!![];_0x2a8f42['queuecallerexitAt']=moment(_0x5b4ac1[_0x37cb('0x7d')])[_0x37cb('0x9e')](_0x3fc1a3['holdtime'],_0x37cb('0x9f'))[_0x37cb('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x2a8f42['queuecallerexitreason']=_0x37cb('0xa0');_0x2a8f42[_0x37cb('0xa1')]=!![];_0x2a8f42[_0x37cb('0xa2')]=_0x37cb('0xa3');_0x2a8f42['transferexten']=_0x3fc1a3['destexten'];_0x2a8f42[_0x37cb('0xa4')]=_0x3fc1a3[_0x37cb('0x51')];logger[_0x37cb('0x94')](_0x37cb('0xa5'),_0x2a8f42[_0x37cb('0x53')],_0x2a8f42[_0x37cb('0x70')]);var _0x252ba5=this[_0x37cb('0x10')][_0x3fc1a3['linkedid']];this[_0x37cb('0x10')][_0x3fc1a3[_0x37cb('0x9d')]]=this[_0x37cb('0x10')][_0x3fc1a3[_0x37cb('0x51')]];this[_0x37cb('0x10')][_0x3fc1a3[_0x37cb('0x51')]]=_0x252ba5;}}else{_0x5b4ac1['queuecallerexitreason']=_0x37cb('0xa6')+_0x3fc1a3[_0x37cb('0xa7')]['toUpperCase']();logger[_0x37cb('0x94')](_0x37cb('0xa8'),_0x5b4ac1['queue'],_0x5b4ac1[_0x37cb('0x70')],_0x5b4ac1[_0x37cb('0x88')]);}}}this[_0x37cb('0x12')][_0x3fc1a3['uniqueid']]=_0x5b4ac1;}}}catch(_0x4cecc2){logger[_0x37cb('0x47')]('[%s][voiceQueueReport][agentcomplete]',_0x3fc1a3['uniqueid'],util[_0x37cb('0x46')](_0x4cecc2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37cb('0x3e')][_0x37cb('0x28')]=function(_0x238a9a){try{if(this['isNotNull'](_0x238a9a)){logger[_0x37cb('0x4e')]('[%s][voiceQueueReport][varset]',_0x238a9a[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x238a9a,{'showHidden':![],'depth':null}));this[_0x37cb('0xa9')](_0x238a9a[_0x37cb('0x51')],_[_0x37cb('0xaa')](_0x238a9a['variable'])[0x0],_0x238a9a['value']);if(this[_0x37cb('0x10')][_0x238a9a[_0x37cb('0x51')]]){var _0x380aa8=_[_0x37cb('0x8d')](this[_0x37cb('0x10')][_0x238a9a[_0x37cb('0x51')]]);if(_0x380aa8){if(this['isNotNull'](_0x238a9a[_0x37cb('0xab')])&&this[_0x37cb('0x76')](_0x238a9a[_0x37cb('0xab')]['queuestatus'])){switch(_0x238a9a[_0x37cb('0xac')]){case _0x37cb('0xad'):_0x380aa8['queuecallerexit']=![];_0x380aa8[_0x37cb('0xae')]=null;break;case'TIMEOUT':_0x380aa8[_0x37cb('0xaf')]='timeout';_0x380aa8['queuecallerexit']=!![];_0x380aa8['queuecallerexitAt']=moment()[_0x37cb('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x380aa8[_0x37cb('0x8e')]=moment()[_0x37cb('0x58')](_0x37cb('0x7e'));logger['debug'](_0x37cb('0xb0'),_0x238a9a['uniqueid'],util['inspect'](_0x380aa8,{'showHidden':![],'depth':null}));ami['emit'](_0x37cb('0xb1'),_0x380aa8);break;default:_0x380aa8['queuecallerexit']=!![];_0x380aa8['queuecallerexitAt']=moment()[_0x37cb('0x58')](_0x37cb('0x7e'));_0x380aa8[_0x37cb('0x8e')]=moment()[_0x37cb('0x58')](_0x37cb('0x7e'));}_0x380aa8[_0x37cb('0x20')]=![];_0x380aa8['queuecallerabandonAt']=null;_0x380aa8[_0x37cb('0x88')]=_0x238a9a['value'];this[_0x37cb('0x12')][_0x238a9a[_0x37cb('0x51')]]=_0x380aa8;this[_0x37cb('0x4a')](_0x380aa8,_0x37cb('0x27'));}else if(this[_0x37cb('0x76')](_0x238a9a['variable'])&&this[_0x37cb('0x76')](_0x238a9a['variable'][_0x37cb('0xb2')])){if(!_0x380aa8[_0x37cb('0x20')]){_0x380aa8[_0x37cb('0x3c')]=!![];_0x380aa8[_0x37cb('0xae')]=moment()[_0x37cb('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x380aa8[_0x37cb('0x88')]=_0x37cb('0xb3');_0x380aa8[_0x37cb('0x8e')]=moment()[_0x37cb('0x58')](_0x37cb('0x7e'));this[_0x37cb('0x12')][_0x238a9a[_0x37cb('0x51')]]=_0x380aa8;}}logger['info'](_0x37cb('0xb4'),_0x238a9a[_0x37cb('0x51')],_0x380aa8['queue'],_0x380aa8[_0x37cb('0x70')],_['keys'](_0x238a9a[_0x37cb('0xab')])[0x0],_0x238a9a[_0x37cb('0xac')]);_0x380aa8[_0x37cb('0x16')]=this[_0x37cb('0x16')][_0x238a9a[_0x37cb('0x51')]];}}}}catch(_0x5bf4e2){logger[_0x37cb('0x47')](_0x37cb('0xb5'),_0x238a9a[_0x37cb('0x51')],util[_0x37cb('0x46')](_0x5bf4e2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x37cb('0x3e')][_0x37cb('0xa9')]=function(_0x1a4002,_0x47a194,_0xb920c9){var _0x24be15=['rtpaudioqos',_0x37cb('0xb6'),_0x37cb('0xb7'),_0x37cb('0xb8'),'rtpaudioqosloss',_0x37cb('0xb9'),_0x37cb('0xba'),'rtpaudioqosrttbridged',_0x37cb('0xbb'),_0x37cb('0xbc'),_0x37cb('0xbd'),_0x37cb('0xbe'),_0x37cb('0xbf'),_0x37cb('0xc0'),_0x37cb('0xc1'),_0x37cb('0xc2'),_0x37cb('0x98'),'memberpenalty','memberrealtime'];if(!_[_0x37cb('0x40')](_0x47a194)&&!_[_0x37cb('0xc3')](_0x24be15,_0x47a194)){if(_[_0x37cb('0x60')](this[_0x37cb('0x16')][_0x1a4002])){this[_0x37cb('0x16')][_0x1a4002]={};}this['variables'][_0x1a4002][_0x47a194]=_0xb920c9;}};VoiceQueueReport[_0x37cb('0x3e')][_0x37cb('0xc4')]=function(_0x461be9,_0x117e7e,_0x3d88bc){var _0x5dbc48={};for(var _0x1de3ae=0x0;_0x1de3ae0x0?!![]:![];if(!_0x4a061e){return this[_0xae72('0x13')](this[_0xae72('0xe')][_0xae72('0x6c')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0x551b8f){var _0x1b42fe=this[_0xae72('0xe')]['id'];if(this[_0xae72('0xe')]['queuestatus'][_0x1b42fe]&&this[_0xae72('0xe')][_0xae72('0x68')][_0x1b42fe][_0x551b8f['actionid']]){this[_0xae72('0xe')][_0xae72('0x68')][_0x1b42fe][_0x551b8f[_0xae72('0x61')]][_0xae72('0xa')][_0xae72('0x6d')](_0x551b8f);}};VoiceQueueReport[_0xae72('0x37')]['syncQueueSummary']=function(_0xe5fbc1){var _0x2644ba=this;try{if(this['isNotNull'](_0xe5fbc1)&&this[_0xae72('0x6e')](_0xe5fbc1[_0xae72('0x52')])){logger[_0xae72('0x58')]('[voiceQueueReport][queuesummary]\x20event:',util[_0xae72('0x43')](_0xe5fbc1,{'showHidden':![],'depth':null}));var _0x2d6e68=this['voiceQueues'][_0xe5fbc1[_0xae72('0x52')]];if(_0x2d6e68){logger[_0xae72('0x58')](_0xae72('0x6f'),_0x2d6e68['name']);this[_0xae72('0xe')][_0xae72('0x5c')][_0x2d6e68[_0xae72('0x5a')]]={'summaryEvent':_0xe5fbc1};this[_0xae72('0xe')][_0xae72('0x6b')]+=0x1;return ami['Action']({'action':_0xae72('0x68'),'queue':_0x2d6e68[_0xae72('0x5a')]})[_0xae72('0x70')](function(_0x39d4e2){if(!_0x2644ba['summary'][_0xae72('0x68')][_0xe5fbc1[_0xae72('0x61')]]){_0x2644ba[_0xae72('0xe')][_0xae72('0x68')][_0xe5fbc1['actionid']]={};}_0x2644ba[_0xae72('0xe')]['queuestatus'][_0xe5fbc1[_0xae72('0x61')]][_0x39d4e2['actionid']]={'queue':_0x2d6e68[_0xae72('0x5a')],'agents':[]};})['catch'](function(_0x5d11fd){throw _0x5d11fd;});}}}catch(_0x5d26c4){logger[_0xae72('0x3e')](_0xae72('0x62'),util['inspect'](_0x5d26c4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae72('0x37')][_0xae72('0x13')]=function(_0xd86ec){if(this[_0xae72('0xe')][_0xae72('0x6b')]>0x0){this['summary'][_0xae72('0x6c')]=_0xd86ec;return;}logger[_0xae72('0x58')](_0xae72('0x71'),util[_0xae72('0x43')](_0xd86ec,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xae72('0x47')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xae72('0x37')][_0xae72('0x17')]=function(_0x5a769b){try{if(this[_0xae72('0x6e')](_0x5a769b)){logger[_0xae72('0x58')](_0xae72('0x72'),_0x5a769b['uniqueid'],util[_0xae72('0x43')](_0x5a769b,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xae72('0x40')][_0x5a769b[_0xae72('0x4a')]])){this[_0xae72('0x40')][_0x5a769b['uniqueid']]=[];}if(_['isUndefined'](this[_0xae72('0xb')][_0x5a769b[_0xae72('0x4a')]])){this[_0xae72('0xb')][_0x5a769b['uniqueid']]={};}var _0x25ed5c=new QueueReport();_0x25ed5c[_0xae72('0x52')]=_0x5a769b[_0xae72('0x52')];_0x25ed5c[_0xae72('0x56')]=this['voiceQueues'][_0x25ed5c[_0xae72('0x52')]]&&this[_0xae72('0x69')][_0x25ed5c[_0xae72('0x52')]][_0xae72('0x56')]?this[_0xae72('0x69')][_0x25ed5c[_0xae72('0x52')]][_0xae72('0x56')]||_0xae72('0x57'):_0xae72('0x57');_0x25ed5c[_0xae72('0x73')]=moment()[_0xae72('0x4b')](_0xae72('0x74'));_0x25ed5c[_0xae72('0x75')]=_0x5a769b[_0xae72('0x75')];_0x25ed5c[_0xae72('0x76')]=_0x5a769b[_0xae72('0x76')];_0x25ed5c[_0xae72('0x4a')]=_0x5a769b[_0xae72('0x4a')];_0x25ed5c[_0xae72('0x77')]=this[_0xae72('0xb')][_0x5a769b[_0xae72('0x4a')]][_0xae72('0x77')];logger[_0xae72('0x78')](_0xae72('0x79'),_0x25ed5c['queue'],_0x25ed5c[_0xae72('0x56')]);Object[_0xae72('0x7a')](_0x25ed5c,_[_0xae72('0x7b')](_0x5a769b,_['keys'](_0x25ed5c)));this[_0xae72('0x40')][_0x5a769b['uniqueid']]['push'](_0x25ed5c);this[_0xae72('0xb')][_0x5a769b['uniqueid']]=_0x25ed5c;this[_0xae72('0x48')](_0x25ed5c,'queuecallerjoin');}}catch(_0x2cd380){logger['error'](_0xae72('0x72'),_0x5a769b[_0xae72('0x4a')],util['inspect'](_0x2cd380,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae72('0x37')]['syncQueueCallerAbandon']=function(_0x53b8e3){try{if(this[_0xae72('0x6e')](_0x53b8e3)){logger['debug'](_0xae72('0x7c'),_0x53b8e3[_0xae72('0x4a')],util[_0xae72('0x43')](_0x53b8e3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x53b8e3[_0xae72('0x4a')]]){var _0x500a23=_[_0xae72('0x7d')](this[_0xae72('0x40')][_0x53b8e3[_0xae72('0x4a')]]);_0x500a23[_0xae72('0x36')]=![];_0x500a23[_0xae72('0x7e')]=null;_0x500a23[_0xae72('0x7f')]=_0x53b8e3[_0xae72('0x7f')];_0x500a23[_0xae72('0x80')]=_0x53b8e3[_0xae72('0x80')];_0x500a23['queuecallerabandon']=!![];_0x500a23[_0xae72('0x81')]=moment()[_0xae72('0x4b')](_0xae72('0x74'));_0x500a23['queuecallerexitreason']=_0xae72('0x82');_0x500a23[_0xae72('0x83')]=null;logger['info'](_0xae72('0x84'),_0x500a23[_0xae72('0x52')],_0x500a23[_0xae72('0x56')]);this[_0xae72('0xb')][_0x53b8e3[_0xae72('0x4a')]]=_0x500a23;this['emitVoiceQueueChannelRemove'](_0x500a23,_0xae72('0x18'));}}}catch(_0x5c2dec){logger[_0xae72('0x3e')]('[%s][voiceQueueReport][queuecallerabandon]',_0x53b8e3[_0xae72('0x4a')],util[_0xae72('0x43')](_0x5c2dec,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae72('0x37')]['syncQueueCallerLeave']=function(_0x328a58){try{if(this[_0xae72('0x6e')](_0x328a58)){logger[_0xae72('0x58')](_0xae72('0x85'),_0x328a58[_0xae72('0x4a')],util[_0xae72('0x43')](_0x328a58,{'showHidden':![],'depth':null}));if(this[_0xae72('0x40')][_0x328a58[_0xae72('0x4a')]]){var _0xd92461=_['last'](this[_0xae72('0x40')][_0x328a58[_0xae72('0x4a')]]);_0xd92461[_0xae72('0x86')]=moment()[_0xae72('0x4b')](_0xae72('0x74'));_0xd92461['connectedlinenum']=_0x328a58[_0xae72('0x87')];_0xd92461['connectedlinename']=_0x328a58['connectedlinename'];logger['info'](_0xae72('0x88'),_0xd92461[_0xae72('0x52')],_0xd92461[_0xae72('0x56')],_0x328a58[_0xae72('0x87')],_0x328a58[_0xae72('0x89')]);this['channels'][_0x328a58['uniqueid']]=_0xd92461;this['emitVoiceQueueChannelSave'](_0xd92461,'queuecallerleave');}}}catch(_0x5e98f7){logger[_0xae72('0x3e')](_0xae72('0x85'),_0x328a58[_0xae72('0x4a')],util[_0xae72('0x43')](_0x5e98f7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae72('0x37')][_0xae72('0x1e')]=function(_0x5a1d46){try{if(this[_0xae72('0x6e')](_0x5a1d46)){logger['debug'](_0xae72('0x8a'),_0x5a1d46[_0xae72('0x4a')],util[_0xae72('0x43')](_0x5a1d46,{'showHidden':![],'depth':null}));if(this[_0xae72('0x40')][_0x5a1d46[_0xae72('0x4a')]]){var _0x47484b=_[_0xae72('0x7d')](this[_0xae72('0x40')][_0x5a1d46['uniqueid']]);_0x47484b['queuecallercomplete']=!![];_0x47484b[_0xae72('0x4f')]=_0xae72('0x8b');logger['info'](_0xae72('0x8c'),_0x47484b[_0xae72('0x52')],_0x47484b[_0xae72('0x56')]);}}}catch(_0x303e74){logger['error'](_0xae72('0x8a'),_0x5a1d46[_0xae72('0x4a')],util[_0xae72('0x43')](_0x303e74,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xae72('0x1c')]=function(_0x111616){try{if(this['isNotNull'](_0x111616)){logger[_0xae72('0x58')](_0xae72('0x8d'),_0x111616[_0xae72('0x4a')],util[_0xae72('0x43')](_0x111616,{'showHidden':![],'depth':null}));if(this[_0xae72('0x40')][_0x111616[_0xae72('0x4a')]]){var _0x3c6d87=_[_0xae72('0x7d')](this[_0xae72('0x40')][_0x111616['uniqueid']]);_0x3c6d87['queuecallerabandon']=![];_0x3c6d87['queuecallerabandonAt']=null;_0x3c6d87[_0xae72('0x8e')]=!![];_0x3c6d87[_0xae72('0x83')]=_0x111616['membername'];_0x3c6d87[_0xae72('0x7f')]=_0x111616[_0xae72('0x7f')];_0x3c6d87[_0xae72('0x36')]=!![];_0x3c6d87[_0xae72('0x35')]=![];_0x3c6d87[_0xae72('0x8f')]=null;if(!_0x3c6d87[_0xae72('0x90')]){if(_0x111616['reason']==_0xae72('0x90')){_0x3c6d87['queuecallerexitreason']='COMPLETED';logger[_0xae72('0x78')](_0xae72('0x91'),_0x3c6d87[_0xae72('0x52')],_0x3c6d87[_0xae72('0x56')]);}else{if(_[_0xae72('0x92')](_0x111616[_0xae72('0x3c')]['toLowerCase'](),'local/')){if(this[_0xae72('0x40')][_0x111616[_0xae72('0x93')]]){var _0x4a62d5=_[_0xae72('0x7d')](this[_0xae72('0x40')][_0x111616[_0xae72('0x93')]]);_0x4a62d5['queuecallercomplete']=![];_0x4a62d5[_0xae72('0x35')]=!![];_0x4a62d5['queuecallerexitAt']=moment(_0x3c6d87[_0xae72('0x73')])[_0xae72('0x94')](_0x111616[_0xae72('0x7f')],_0xae72('0x95'))[_0xae72('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x4a62d5['queuecallerexitreason']=_0xae72('0x96');_0x4a62d5['transfer']=!![];_0x4a62d5[_0xae72('0x97')]=_0xae72('0x98');_0x4a62d5[_0xae72('0x99')]=_0x111616[_0xae72('0x9a')];_0x4a62d5[_0xae72('0x9b')]=_0x111616[_0xae72('0x4a')];logger['info'](_0xae72('0x9c'),_0x4a62d5[_0xae72('0x52')],_0x4a62d5[_0xae72('0x56')]);var _0xb98cd2=this[_0xae72('0x40')][_0x111616['linkedid']];this[_0xae72('0x40')][_0x111616[_0xae72('0x93')]]=this['queueReports'][_0x111616[_0xae72('0x4a')]];this[_0xae72('0x40')][_0x111616['uniqueid']]=_0xb98cd2;}}else{_0x3c6d87[_0xae72('0x4f')]=_0xae72('0x9d')+_0x111616[_0xae72('0x9e')][_0xae72('0x9f')]();logger[_0xae72('0x78')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x3c6d87[_0xae72('0x52')],_0x3c6d87[_0xae72('0x56')],_0x3c6d87[_0xae72('0x4f')]);}}}this['channels'][_0x111616[_0xae72('0x4a')]]=_0x3c6d87;}}}catch(_0x3351af){logger['error'](_0xae72('0x8d'),_0x111616[_0xae72('0x4a')],util['inspect'](_0x3351af,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncVarSet']=function(_0x3e3ec4){try{if(this['isNotNull'](_0x3e3ec4)){logger['debug'](_0xae72('0xa0'),_0x3e3ec4['uniqueid'],util[_0xae72('0x43')](_0x3e3ec4,{'showHidden':![],'depth':null}));this['addVariable'](_0x3e3ec4[_0xae72('0x4a')],_[_0xae72('0xa1')](_0x3e3ec4[_0xae72('0xa2')])[0x0],_0x3e3ec4[_0xae72('0xa3')]);if(this[_0xae72('0x40')][_0x3e3ec4[_0xae72('0x4a')]]){var _0x8d3050=_[_0xae72('0x7d')](this[_0xae72('0x40')][_0x3e3ec4[_0xae72('0x4a')]]);if(_0x8d3050){if(this[_0xae72('0x6e')](_0x3e3ec4['variable'])&&this[_0xae72('0x6e')](_0x3e3ec4[_0xae72('0xa2')][_0xae72('0x68')])){switch(_0x3e3ec4[_0xae72('0xa3')]){case _0xae72('0xa4'):_0x8d3050[_0xae72('0x35')]=![];_0x8d3050[_0xae72('0x8f')]=null;break;case _0xae72('0xa5'):_0x8d3050['lastevent']=_0xae72('0xa6');_0x8d3050['queuecallerexit']=!![];_0x8d3050[_0xae72('0x8f')]=moment()[_0xae72('0x4b')](_0xae72('0x74'));_0x8d3050['queuecallerleaveAt']=moment()[_0xae72('0x4b')](_0xae72('0x74'));logger[_0xae72('0x58')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x3e3ec4['uniqueid'],util[_0xae72('0x43')](_0x8d3050,{'showHidden':![],'depth':null}));ami['emit'](_0xae72('0xa7'),_0x8d3050);break;default:_0x8d3050[_0xae72('0x35')]=!![];_0x8d3050[_0xae72('0x8f')]=moment()['format'](_0xae72('0x74'));_0x8d3050['queuecallerleaveAt']=moment()['format'](_0xae72('0x74'));}_0x8d3050['queuecallerabandon']=![];_0x8d3050[_0xae72('0x81')]=null;_0x8d3050[_0xae72('0x4f')]=_0x3e3ec4[_0xae72('0xa3')];this[_0xae72('0xb')][_0x3e3ec4[_0xae72('0x4a')]]=_0x8d3050;this[_0xae72('0x46')](_0x8d3050,_0xae72('0x1f'));}else if(this['isNotNull'](_0x3e3ec4[_0xae72('0xa2')])&&this['isNotNull'](_0x3e3ec4['variable'][_0xae72('0xa8')])){if(!_0x8d3050[_0xae72('0x18')]){_0x8d3050[_0xae72('0x35')]=!![];_0x8d3050[_0xae72('0x8f')]=moment()[_0xae72('0x4b')](_0xae72('0x74'));_0x8d3050[_0xae72('0x4f')]=_0xae72('0xa9');_0x8d3050[_0xae72('0x86')]=moment()['format'](_0xae72('0x74'));this[_0xae72('0xb')][_0x3e3ec4[_0xae72('0x4a')]]=_0x8d3050;}}logger[_0xae72('0x78')](_0xae72('0xaa'),_0x3e3ec4[_0xae72('0x4a')],_0x8d3050[_0xae72('0x52')],_0x8d3050[_0xae72('0x56')],_[_0xae72('0xa1')](_0x3e3ec4[_0xae72('0xa2')])[0x0],_0x3e3ec4[_0xae72('0xa3')]);_0x8d3050[_0xae72('0xf')]=this['variables'][_0x3e3ec4[_0xae72('0x4a')]];}}}}catch(_0x22db79){logger[_0xae72('0x3e')](_0xae72('0xa0'),_0x3e3ec4['uniqueid'],util['inspect'](_0x22db79,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xae72('0x37')][_0xae72('0xab')]=function(_0x47f729,_0x441b49,_0x14c788){var _0x4e47ef=['rtpaudioqos',_0xae72('0xac'),_0xae72('0xad'),_0xae72('0xae'),_0xae72('0xaf'),_0xae72('0xb0'),_0xae72('0xb1'),'rtpaudioqosrttbridged',_0xae72('0xb2'),_0xae72('0xb3'),'bridgepeer','bridgepvtcallid',_0xae72('0xb4'),'memberdynamic','memberinterface',_0xae72('0xb5'),_0xae72('0xb6'),'memberpenalty','memberrealtime'];if(!_[_0xae72('0x3b')](_0x441b49)&&!_[_0xae72('0xb7')](_0x4e47ef,_0x441b49)){if(_[_0xae72('0xb8')](this['variables'][_0x47f729])){this[_0xae72('0xf')][_0x47f729]={};}this[_0xae72('0xf')][_0x47f729][_0x441b49]=_0x14c788;}};VoiceQueueReport['prototype'][_0xae72('0xb9')]=function(_0xa3325e,_0x305112,_0x3b7941){var _0x5b2d5b={};for(var _0x471eb8=0x0;_0x471eb8=0x0?moment(_0x355ec3[_0x9d60('0x16')])[_0x9d60('0xc')](_0x355ec3[_0x9d60('0x15')],_0x9d60('0x17')):null,'data1':_0x9d60('0x18'),'data2':_0x355ec3['accountcode'],'data3':_0x355ec3['exten'],'data4':_0x355ec3[_0x9d60('0x19')]||null,'role':_0x9d60('0xf'),'internal':_0x355ec3['accountcode']?_[_0x9d60('0x10')](_0x355ec3[_0x9d60('0x11')]):undefined,'uniqueid':_0x355ec3[_0x9d60('0x1a')]},'log':_0x9d60('0x6')});}; \ No newline at end of file +var _0x0d4f=['exten','uniqueid','moment','lodash','util','queuecallercompleteAt','queuecallerexitAt','Request','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','inbound','queue','agent','toNumber','accountcode','CreateMemberReport','voice','membername','starttime','endtime','seconds','outbound'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x0d4f,0xc6));var _0xf0d4=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x0d4f[_0xaaf2e2];return _0x28bc36;};'use strict';var moment=require(_0xf0d4('0x0'));var _=require(_0xf0d4('0x1'));var util=require(_0xf0d4('0x2'));var client=require('../client');exports['voiceQueueReport']=function(_0x1f583c){var _0x29e91c=_0x1f583c[_0xf0d4('0x3')]||_0x1f583c[_0xf0d4('0x4')];return client[_0xf0d4('0x5')]('CreateMemberReport',{'body':{'channel':'voice','membername':_0x1f583c[_0xf0d4('0x6')],'interface':_[_0xf0d4('0x7')](_0x1f583c[_0xf0d4('0x8')])?util[_0xf0d4('0x9')](_0xf0d4('0xa'),_0x1f583c[_0xf0d4('0x6')]):_0x1f583c['interface'],'type':_0xf0d4('0xb'),'enterAt':_0x1f583c[_0xf0d4('0xc')],'exitAt':_0x29e91c,'duration':moment(_0x29e91c)[_0xf0d4('0xd')](_0x1f583c[_0xf0d4('0xc')],'seconds'),'data1':_0xf0d4('0xe'),'data2':_0x1f583c['calleridnum'],'data3':_0x1f583c['exten'],'data4':null,'data5':_0x1f583c[_0xf0d4('0xf')],'role':_0xf0d4('0x10'),'internal':_0x1f583c['accountcode']?_[_0xf0d4('0x11')](_0x1f583c[_0xf0d4('0x12')]):undefined,'uniqueid':_0x1f583c['uniqueid']},'log':_0xf0d4('0x13')});};exports['voiceDialReport']=function(_0x53e1af){return client['Request'](_0xf0d4('0x13'),{'body':{'channel':_0xf0d4('0x14'),'membername':_0x53e1af[_0xf0d4('0x15')],'interface':_0x53e1af[_0xf0d4('0x8')],'type':_0xf0d4('0xb'),'enterAt':_0x53e1af[_0xf0d4('0x16')],'exitAt':_0x53e1af[_0xf0d4('0x17')],'duration':moment(_0x53e1af[_0xf0d4('0x17')])[_0xf0d4('0xd')](_0x53e1af[_0xf0d4('0x16')],_0xf0d4('0x18'))>=0x0?moment(_0x53e1af[_0xf0d4('0x17')])[_0xf0d4('0xd')](_0x53e1af[_0xf0d4('0x16')],'seconds'):null,'data1':_0xf0d4('0x19'),'data2':_0x53e1af['accountcode'],'data3':_0x53e1af[_0xf0d4('0x1a')],'data4':_0x53e1af['dialstring']||null,'role':_0xf0d4('0x10'),'internal':_0x53e1af[_0xf0d4('0x12')]?_[_0xf0d4('0x11')](_0x53e1af[_0xf0d4('0x12')]):undefined,'uniqueid':_0x53e1af[_0xf0d4('0x1b')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 8874786..8fbe29f 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 _0x64eb=['ShowSetting','previewRecallmeReminderInterval','GetSettings','../client','getSettings'];(function(_0x329d8d,_0x48b6c2){var _0x3bf18f=function(_0x151e83){while(--_0x151e83){_0x329d8d['push'](_0x329d8d['shift']());}};_0x3bf18f(++_0x48b6c2);}(_0x64eb,0xc6));var _0xb64e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x64eb[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xb64e('0x0'));exports[_0xb64e('0x1')]=function(){return client['Request'](_0xb64e('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xb64e('0x3')]},'log':_0xb64e('0x4')});}; \ No newline at end of file +var _0x6427=['ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings','Request'];(function(_0x1d3c9f,_0x5598a0){var _0x2682de=function(_0x9f95d7){while(--_0x9f95d7){_0x1d3c9f['push'](_0x1d3c9f['shift']());}};_0x2682de(++_0x5598a0);}(_0x6427,0xbe));var _0x7642=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x6427[_0x4fc9e6];return _0x551d28;};'use strict';var client=require('../client');exports[_0x7642('0x0')]=function(){return client[_0x7642('0x1')](_0x7642('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x7642('0x3'),_0x7642('0x4')]},'log':_0x7642('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 928b1f9..7cb6732 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 _0x176a=['GetTemplate','html','../client','Request'];(function(_0x1490a9,_0x1cf7f2){var _0x418c4a=function(_0x4654fe){while(--_0x4654fe){_0x1490a9['push'](_0x1490a9['shift']());}};_0x418c4a(++_0x1cf7f2);}(_0x176a,0x8a));var _0xa176=function(_0xff7646,_0x5dfd0f){_0xff7646=_0xff7646-0x0;var _0x279698=_0x176a[_0xff7646];return _0x279698;};'use strict';var client=require(_0xa176('0x0'));exports['getTemplates']=function(_0x5cca11){return function(_0x506343){return client[_0xa176('0x1')](_0xa176('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0xa176('0x3')]},'log':_0xa176('0x2')});};}; \ No newline at end of file +var _0x8c43=['../client','getTemplates','Request','name','html'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0x8c43,0x1e5));var _0x38c4=function(_0x58a0f6,_0x57fa56){_0x58a0f6=_0x58a0f6-0x0;var _0x19250b=_0x8c43[_0x58a0f6];return _0x19250b;};'use strict';var client=require(_0x38c4('0x0'));exports[_0x38c4('0x1')]=function(_0xab6842){return function(_0x2bcd90){return client[_0x38c4('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x38c4('0x3'),_0x38c4('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 13d42e5..bac9a37 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 _0xe5fc=['data5','data7','GetTrigger','../client','getTriggers','name','channel','status','AllConditions','field','operator','value','Condition','AnyConditions','Action','Actions','data1','data2','data3','data4'];(function(_0x282494,_0x4b59d0){var _0x5c79e5=function(_0x55f4bf){while(--_0x55f4bf){_0x282494['push'](_0x282494['shift']());}};_0x5c79e5(++_0x4b59d0);}(_0xe5fc,0x12f));var _0xce5f=function(_0x18af5e,_0x3e44b8){_0x18af5e=_0x18af5e-0x0;var _0x2a4a45=_0xe5fc[_0x18af5e];return _0x2a4a45;};'use strict';var client=require(_0xce5f('0x0'));exports[_0xce5f('0x1')]=function(_0x1e3af1){return function(_0x44310a){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xce5f('0x2'),_0xce5f('0x3'),_0xce5f('0x4')],'include':[{'model':'Condition','as':_0xce5f('0x5'),'attributes':['id',_0xce5f('0x6'),_0xce5f('0x7'),_0xce5f('0x8')]},{'model':_0xce5f('0x9'),'as':_0xce5f('0xa'),'attributes':['id',_0xce5f('0x6'),_0xce5f('0x7'),_0xce5f('0x8')]},{'model':_0xce5f('0xb'),'as':_0xce5f('0xc'),'attributes':['id','action',_0xce5f('0xd'),_0xce5f('0xe'),_0xce5f('0xf'),_0xce5f('0x10'),_0xce5f('0x11'),'data6',_0xce5f('0x12')]}]},'log':_0xce5f('0x13')});};}; \ No newline at end of file +var _0xfa18=['name','status','field','operator','value','Condition','AnyConditions','Action','Actions','data1','data2','data3','data4','data6','data7','../client','getTriggers','GetTrigger'];(function(_0x625009,_0x1a801f){var _0x49b4b7=function(_0xc1dbfe){while(--_0xc1dbfe){_0x625009['push'](_0x625009['shift']());}};_0x49b4b7(++_0x1a801f);}(_0xfa18,0xb1));var _0x8fa1=function(_0xc9c14e,_0x5255c4){_0xc9c14e=_0xc9c14e-0x0;var _0xb20a2b=_0xfa18[_0xc9c14e];return _0xb20a2b;};'use strict';var client=require(_0x8fa1('0x0'));exports[_0x8fa1('0x1')]=function(_0x1d4d98){return function(_0x25634e){return client['Request'](_0x8fa1('0x2'),{'options':{'raw':![],'attributes':['id',_0x8fa1('0x3'),'channel',_0x8fa1('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x8fa1('0x5'),_0x8fa1('0x6'),_0x8fa1('0x7')]},{'model':_0x8fa1('0x8'),'as':_0x8fa1('0x9'),'attributes':['id',_0x8fa1('0x5'),_0x8fa1('0x6'),_0x8fa1('0x7')]},{'model':_0x8fa1('0xa'),'as':_0x8fa1('0xb'),'attributes':['id','action',_0x8fa1('0xc'),_0x8fa1('0xd'),_0x8fa1('0xe'),_0x8fa1('0xf'),'data5',_0x8fa1('0x10'),_0x8fa1('0x11')]}]},'log':_0x8fa1('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 4d214ba..06264fd 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 _0x6f7f=['Request','GetTrunk','registry','getTrunks'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6f7f,0x177));var _0xf6f7=function(_0xf6235e,_0x54b6d4){_0xf6235e=_0xf6235e-0x0;var _0x211352=_0x6f7f[_0xf6235e];return _0x211352;};'use strict';var client=require('../client');exports[_0xf6f7('0x0')]=function(_0x2d025d){return function(_0x2b4ee7){return client[_0xf6f7('0x1')](_0xf6f7('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf6f7('0x3'),'defaultuser']},'log':_0xf6f7('0x2')});};}; \ No newline at end of file +var _0xa671=['getTrunks','Request','registry','GetTrunk'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xa671,0x1a4));var _0x1a67=function(_0x2f9e6c,_0x2d85db){_0x2f9e6c=_0x2f9e6c-0x0;var _0xc246e6=_0xa671[_0x2f9e6c];return _0xc246e6;};'use strict';var client=require('../client');exports[_0x1a67('0x0')]=function(_0x37177c){return function(_0xb7957c){return client[_0x1a67('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x1a67('0x2'),'defaultuser']},'log':_0x1a67('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index ec7dbce..a2b6452 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(_0x4c444c,_0x22adba){var _0x883fbc=function(_0x40c100){while(--_0x40c100){_0x4c444c['push'](_0x4c444c['shift']());}};_0x883fbc(++_0x22adba);}(_0xedd9,0xfc));var _0x9edd=function(_0x44a8ec,_0xe17393){_0x44a8ec=_0x44a8ec-0x0;var _0x8f7d06=_0xedd9[_0x44a8ec];return _0x8f7d06;};'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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe706,0xa3));var _0x6e70=function(_0x31efe7,_0x52fe9e){_0x31efe7=_0x31efe7-0x0;var _0x24b6ee=_0xe706[_0x31efe7];return _0x24b6ee;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 91ffed0..36190d6 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 _0xec67=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xec67,0x1e1));var _0x7ec6=function(_0x532d78,_0x25b6a8){_0x532d78=_0x532d78-0x0;var _0x5990c4=_0xec67[_0x532d78];return _0x5990c4;};'use strict';var client=require(_0x7ec6('0x0'));exports[_0x7ec6('0x1')]=function(_0x58b001){return client[_0x7ec6('0x2')](_0x7ec6('0x3'),{'body':_0x58b001,'log':_0x7ec6('0x3')});};exports['update']=function(_0x56d768,_0x5b5aaf,_0x8bfd27){return client[_0x7ec6('0x2')](_0x7ec6('0x4'),{'body':_0x56d768,'options':{'where':{'uniqueid':_0x5b5aaf,'interface':_0x8bfd27,'agentcomplete':!![]}},'log':_0x7ec6('0x4')});}; \ No newline at end of file +var _0x23d5=['create','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3c71b8,_0x36b598){var _0x2a9acb=function(_0x4814ff){while(--_0x4814ff){_0x3c71b8['push'](_0x3c71b8['shift']());}};_0x2a9acb(++_0x36b598);}(_0x23d5,0xe6));var _0x523d=function(_0x36d2a5,_0x3f5f46){_0x36d2a5=_0x36d2a5-0x0;var _0x402384=_0x23d5[_0x36d2a5];return _0x402384;};'use strict';var client=require('../client');exports[_0x523d('0x0')]=function(_0x54b031){return client[_0x523d('0x1')]('CreateVoiceAgentReport',{'body':_0x54b031,'log':_0x523d('0x2')});};exports[_0x523d('0x3')]=function(_0x21085f,_0x4a8b3d,_0x5039c1){return client[_0x523d('0x1')](_0x523d('0x4'),{'body':_0x21085f,'options':{'where':{'uniqueid':_0x4a8b3d,'interface':_0x5039c1,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 44f193c..72eddca 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 _0x089d=['callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','GetVoiceCallReports','moment','util','lodash','Request','CreateVoiceCallReport','calleridnum','context'];(function(_0x4f3288,_0x3e5fae){var _0x24786c=function(_0x5e1083){while(--_0x5e1083){_0x4f3288['push'](_0x4f3288['shift']());}};_0x24786c(++_0x3e5fae);}(_0x089d,0xca));var _0xd089=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x089d[_0x16b9ed];return _0x66b1f8;};'use strict';var moment=require(_0xd089('0x0'));var util=require(_0xd089('0x1'));var _=require(_0xd089('0x2'));var client=require('../client');exports['create']=function(_0x398d46){return client[_0xd089('0x3')](_0xd089('0x4'),{'body':_['merge'](_0x398d46,{'source':_0x398d46[_0xd089('0x5')],'destinationcontext':_0x398d46[_0xd089('0x6')],'callerid':_0x398d46[_0xd089('0x7')],'amaflags':_0xd089('0x8')}),'log':_0xd089('0x4')});};exports[_0xd089('0x9')]=function(){return function(){return client[_0xd089('0x3')](_0xd089('0xa'),{'options':{'where':{'type':[_0xd089('0xb')],'createdAt':{'$between':[moment()[_0xd089('0xc')]('day')[_0xd089('0xd')](_0xd089('0xe')),moment()['endOf']('day')[_0xd089('0xd')](_0xd089('0xe'))]}},'attributes':[_0xd089('0xf'),_0xd089('0x10'),_0xd089('0x11'),'billableseconds']},'log':_0xd089('0x12')});};}; \ No newline at end of file +var _0xe5a6=['CreateVoiceCallReport','merge','calleridnum','context','callerid','getVoiceCallReports','Request','GetVoiceCallReport','day','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create'];(function(_0x43841f,_0x4df0c4){var _0x417f61=function(_0x4a354e){while(--_0x4a354e){_0x43841f['push'](_0x43841f['shift']());}};_0x417f61(++_0x4df0c4);}(_0xe5a6,0x10c));var _0x6e5a=function(_0x1622a0,_0x2b55a9){_0x1622a0=_0x1622a0-0x0;var _0x2a2308=_0xe5a6[_0x1622a0];return _0x2a2308;};'use strict';var moment=require(_0x6e5a('0x0'));var util=require(_0x6e5a('0x1'));var _=require(_0x6e5a('0x2'));var client=require(_0x6e5a('0x3'));exports[_0x6e5a('0x4')]=function(_0x5b5c31){return client['Request'](_0x6e5a('0x5'),{'body':_[_0x6e5a('0x6')](_0x5b5c31,{'source':_0x5b5c31[_0x6e5a('0x7')],'destinationcontext':_0x5b5c31[_0x6e5a('0x8')],'callerid':_0x5b5c31[_0x6e5a('0x9')],'amaflags':'DOCUMENTATION'}),'log':'CreateVoiceCallReport'});};exports[_0x6e5a('0xa')]=function(){return function(){return client[_0x6e5a('0xb')](_0x6e5a('0xc'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x6e5a('0xd'))['format'](_0x6e5a('0xe')),moment()[_0x6e5a('0xf')](_0x6e5a('0xd'))['format'](_0x6e5a('0xe'))]}},'attributes':[_0x6e5a('0x10'),_0x6e5a('0x11'),_0x6e5a('0x12'),_0x6e5a('0x13')]},'log':_0x6e5a('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 82c4b64..edee102 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 _0x59f0=['../client','create','Request','CreateVoiceDialReport'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x59f0,0x118));var _0x059f=function(_0x42b9fe,_0x1db8cb){_0x42b9fe=_0x42b9fe-0x0;var _0x58c2f0=_0x59f0[_0x42b9fe];return _0x58c2f0;};'use strict';var client=require(_0x059f('0x0'));exports[_0x059f('0x1')]=function(_0x551e6f){return client[_0x059f('0x2')](_0x059f('0x3'),{'body':_0x551e6f,'log':_0x059f('0x3')});}; \ No newline at end of file +var _0xed0b=['CreateVoiceDialReport'];(function(_0x195270,_0x412abb){var _0x5398dd=function(_0x1deab2){while(--_0x1deab2){_0x195270['push'](_0x195270['shift']());}};_0x5398dd(++_0x412abb);}(_0xed0b,0x1ac));var _0xbed0=function(_0x1afabf,_0x56fdcc){_0x1afabf=_0x1afabf-0x0;var _0x497ff1=_0xed0b[_0x1afabf];return _0x497ff1;};'use strict';var client=require('../client');exports['create']=function(_0x3c37d4){return client['Request']('CreateVoiceDialReport',{'body':_0x3c37d4,'log':_0xbed0('0x0')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 4d086a5..611f4e6 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 _0xb43b=['getVoiceExtensions','GetVoiceExtension','exten','recordingFormat','../client'];(function(_0x15cca8,_0x8fd236){var _0x16bdb4=function(_0x5a105a){while(--_0x5a105a){_0x15cca8['push'](_0x15cca8['shift']());}};_0x16bdb4(++_0x8fd236);}(_0xb43b,0x1b2));var _0xbb43=function(_0x7e5542,_0x2d4550){_0x7e5542=_0x7e5542-0x0;var _0x576f75=_0xb43b[_0x7e5542];return _0x576f75;};'use strict';var client=require(_0xbb43('0x0'));exports[_0xbb43('0x1')]=function(){return function(){return client['Request'](_0xbb43('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbb43('0x3'),_0xbb43('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9e5e=['exten','recordingFormat','../client','getVoiceExtensions','GetVoiceExtension'];(function(_0x54727f,_0x81ee6f){var _0x5900df=function(_0x387844){while(--_0x387844){_0x54727f['push'](_0x54727f['shift']());}};_0x5900df(++_0x81ee6f);}(_0x9e5e,0x1e2));var _0xe9e5=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x9e5e[_0x5c2e3e];return _0x53f64a;};'use strict';var client=require(_0xe9e5('0x0'));exports[_0xe9e5('0x1')]=function(){return function(){return client['Request'](_0xe9e5('0x2'),{'options':{'raw':!![],'attributes':['id',_0xe9e5('0x3'),_0xe9e5('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index a152a96..3dedd43 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 _0x4e3d=['Trunk','active','mandatoryDispositionPause','TrunkBackup','callerid','Interval','interval','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'];(function(_0x5ac6b5,_0x4d5fad){var _0x530832=function(_0x7ff482){while(--_0x7ff482){_0x5ac6b5['push'](_0x5ac6b5['shift']());}};_0x530832(++_0x4d5fad);}(_0x4e3d,0x14b));var _0xd4e3=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4e3d[_0x2c91e9];return _0x13f0ff;};'use strict';var client=require('../client');exports[_0xd4e3('0x0')]=function(){return function(){return client['Request'](_0xd4e3('0x1'),{'options':{'raw':![],'attributes':['id',_0xd4e3('0x2'),_0xd4e3('0x3'),_0xd4e3('0x4'),'autopause','monitor_format','type',_0xd4e3('0x5'),_0xd4e3('0x6'),_0xd4e3('0x7'),'dialLimitQueue',_0xd4e3('0x8'),_0xd4e3('0x9'),_0xd4e3('0xa'),_0xd4e3('0xb'),_0xd4e3('0xc'),'dialOriginateCallerIdNumber',_0xd4e3('0xd'),'dialQueueOptions',_0xd4e3('0xe'),_0xd4e3('0xf'),_0xd4e3('0x10'),_0xd4e3('0x11'),_0xd4e3('0x12'),'dialBusyRetryFrequency','dialNoAnswerMaxRetry',_0xd4e3('0x13'),_0xd4e3('0x14'),'dialTimezone','dialGlobalInterval',_0xd4e3('0x15'),_0xd4e3('0x16'),_0xd4e3('0x17'),'dialAMDInitialSilence',_0xd4e3('0x18'),_0xd4e3('0x19'),_0xd4e3('0x1a'),_0xd4e3('0x1b'),'dialAMDBetweenWordsSilence',_0xd4e3('0x1c'),_0xd4e3('0x1d'),'dialAMDMaximumWordLength',_0xd4e3('0x1e'),_0xd4e3('0x1f'),'dialRecallInQueue','dialOrderByScheduledAt',_0xd4e3('0x20'),_0xd4e3('0x21'),'dialQueueProject2',_0xd4e3('0x22'),'strategy',_0xd4e3('0x23'),_0xd4e3('0x24'),_0xd4e3('0x25'),_0xd4e3('0x26'),_0xd4e3('0x27'),'dialDropRetryFrequency',_0xd4e3('0x28'),'dialAbandonedRetryFrequency',_0xd4e3('0x29'),'dialMachineRetryFrequency',_0xd4e3('0x2a'),_0xd4e3('0x2b'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0xd4e3('0x2c'),_0xd4e3('0x2d'),_0xd4e3('0x2e')],'include':[{'model':_0xd4e3('0x2f'),'as':'Trunk','attributes':['id',_0xd4e3('0x2'),'callerid',_0xd4e3('0x30')]},{'model':'Pause','as':_0xd4e3('0x31'),'attributes':['id',_0xd4e3('0x2')]},{'model':'Trunk','as':_0xd4e3('0x32'),'attributes':['id','name',_0xd4e3('0x33'),_0xd4e3('0x30')]},{'model':_0xd4e3('0x34'),'as':_0xd4e3('0x34'),'attributes':['id',_0xd4e3('0x2')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0xd4e3('0x2'),_0xd4e3('0x35')]}]}]},'log':_0xd4e3('0x0')});};}; \ No newline at end of file +var _0xf611=['dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','name','acw','autopause'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf611,0x13a));var _0x1f61=function(_0x27638d,_0x4094db){_0x27638d=_0x27638d-0x0;var _0x35da35=_0xf611[_0x27638d];return _0x35da35;};'use strict';var client=require(_0x1f61('0x0'));exports[_0x1f61('0x1')]=function(){return function(){return client[_0x1f61('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x1f61('0x3'),_0x1f61('0x4'),'acwTimeout',_0x1f61('0x5'),'monitor_format','type',_0x1f61('0x6'),_0x1f61('0x7'),_0x1f61('0x8'),'dialLimitQueue',_0x1f61('0x9'),_0x1f61('0xa'),_0x1f61('0xb'),_0x1f61('0xc'),'dialOriginateCallerIdName',_0x1f61('0xd'),_0x1f61('0xe'),_0x1f61('0xf'),_0x1f61('0x10'),_0x1f61('0x11'),_0x1f61('0x12'),_0x1f61('0x13'),'dialBusyMaxRetry',_0x1f61('0x14'),'dialNoAnswerMaxRetry',_0x1f61('0x15'),_0x1f61('0x16'),_0x1f61('0x17'),_0x1f61('0x18'),_0x1f61('0x19'),'dialCheckDuplicateType','dialAMDActive',_0x1f61('0x1a'),_0x1f61('0x1b'),_0x1f61('0x1c'),_0x1f61('0x1d'),_0x1f61('0x1e'),_0x1f61('0x1f'),_0x1f61('0x20'),_0x1f61('0x21'),_0x1f61('0x22'),_0x1f61('0x23'),'dialRecallMeTimeout',_0x1f61('0x24'),_0x1f61('0x25'),_0x1f61('0x26'),_0x1f61('0x27'),'dialQueueProject2',_0x1f61('0x28'),_0x1f61('0x29'),_0x1f61('0x2a'),'dialCutDigit','dialNoSuchNumberMaxRetry',_0x1f61('0x2b'),_0x1f61('0x2c'),_0x1f61('0x2d'),_0x1f61('0x2e'),_0x1f61('0x2f'),_0x1f61('0x30'),_0x1f61('0x31'),_0x1f61('0x32'),'dialAgentRejectRetryFrequency',_0x1f61('0x33'),_0x1f61('0x34'),_0x1f61('0x35'),_0x1f61('0x36'),_0x1f61('0x37')],'include':[{'model':_0x1f61('0x38'),'as':_0x1f61('0x38'),'attributes':['id',_0x1f61('0x3'),_0x1f61('0x39'),_0x1f61('0x3a')]},{'model':_0x1f61('0x3b'),'as':_0x1f61('0x3c'),'attributes':['id',_0x1f61('0x3')]},{'model':_0x1f61('0x38'),'as':_0x1f61('0x3d'),'attributes':['id','name',_0x1f61('0x39'),'active']},{'model':_0x1f61('0x3e'),'as':_0x1f61('0x3e'),'attributes':['id',_0x1f61('0x3')],'include':[{'model':_0x1f61('0x3e'),'as':'Intervals','attributes':['id',_0x1f61('0x3'),_0x1f61('0x3f')]}]}]},'log':_0x1f61('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index a7f19a1..ed724f4 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(_0x3d5489,_0x332b8b){var _0x200432=function(_0xd545b7){while(--_0xd545b7){_0x3d5489['push'](_0x3d5489['shift']());}};_0x200432(++_0x332b8b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x56a16c,_0x38c96f){var _0x565d82=function(_0x3fcaed){while(--_0x3fcaed){_0x56a16c['push'](_0x56a16c['shift']());}};_0x565d82(++_0x38c96f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 b67f0c7..2b1dccb 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 _0x2de0=['Request','getVoiceQueueRtPauses','../client'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0x2de0,0x98));var _0x02de=function(_0x14c94b,_0x2ca2ec){_0x14c94b=_0x14c94b-0x0;var _0x48e5f5=_0x2de0[_0x14c94b];return _0x48e5f5;};'use strict';var client=require(_0x02de('0x0'));exports['getVoiceQueueRtPauses']=function(_0x5f101c){return function(){return client[_0x02de('0x1')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x5f101c,'paused':!![]},'raw':!![]},'log':_0x02de('0x2')});};}; \ No newline at end of file +var _0xec75=['getVoiceQueueRtPauses','Request','../client'];(function(_0x6da71e,_0x2ba266){var _0x4120ca=function(_0x26a0d3){while(--_0x26a0d3){_0x6da71e['push'](_0x6da71e['shift']());}};_0x4120ca(++_0x2ba266);}(_0xec75,0x131));var _0x5ec7=function(_0x5dac29,_0x5e3be2){_0x5dac29=_0x5dac29-0x0;var _0x24c5a2=_0xec75[_0x5dac29];return _0x24c5a2;};'use strict';var client=require(_0x5ec7('0x0'));exports[_0x5ec7('0x1')]=function(_0x4cfa55){return function(){return client[_0x5ec7('0x2')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x4cfa55,'paused':!![]},'raw':!![]},'log':_0x5ec7('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 43afb36..4e902d1 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(_0x369cae,_0x584825){var _0x2f7925=function(_0x31f9a4){while(--_0x31f9a4){_0x369cae['push'](_0x369cae['shift']());}};_0x2f7925(++_0x584825);}(_0x7a54,0x106));var _0x47a5=function(_0x47731d,_0x373604){_0x47731d=_0x47731d-0x0;var _0x243666=_0x7a54[_0x47731d];return _0x243666;};'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(_0x8c3953,_0x505160){var _0x515da0=function(_0x4960fb){while(--_0x4960fb){_0x8c3953['push'](_0x8c3953['shift']());}};_0x515da0(++_0x505160);}(_0x7a54,0x106));var _0x47a5=function(_0x31e47a,_0x1d489d){_0x31e47a=_0x31e47a-0x0;var _0x435c45=_0x7a54[_0x31e47a];return _0x435c45;};'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 5a00b26..c9ba66d 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 _0xe8c1=['origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','attendedTransfer','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x423c83,_0x4ab4b2){var _0x2a48d0=function(_0x57e0ba){while(--_0x57e0ba){_0x423c83['push'](_0x423c83['shift']());}};_0x2a48d0(++_0x4ab4b2);}(_0xe8c1,0x1b8));var _0x1e8c=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0xe8c1[_0x19b3f9];return _0x18c3f6;};'use strict';var client=require(_0x1e8c('0x0'));exports['transfers']={};exports['blindTransfer']=function(_0x110922){return client[_0x1e8c('0x1')](_0x1e8c('0x2'),{'body':{'result':_0x110922[_0x1e8c('0x3')],'transfererchannel':_0x110922[_0x1e8c('0x4')],'transferercalleridnum':_0x110922[_0x1e8c('0x5')],'transferercalleridname':_0x110922[_0x1e8c('0x6')],'transfererconnectedlinenum':_0x110922[_0x1e8c('0x7')],'transfererconnectedlinename':_0x110922[_0x1e8c('0x8')],'transfereraccountcode':_0x110922[_0x1e8c('0x9')],'transferercontext':_0x110922[_0x1e8c('0xa')],'transfererexten':_0x110922['transfererexten'],'transfererlinkedid':_0x110922[_0x1e8c('0xb')],'transfereechannel':_0x110922[_0x1e8c('0xc')],'transfereecalleridnum':_0x110922[_0x1e8c('0xd')],'transfereecalleridname':_0x110922[_0x1e8c('0xe')],'transfereeconnectedlinenum':_0x110922[_0x1e8c('0xf')],'transfereeconnectedlinename':_0x110922[_0x1e8c('0x10')],'transfereeaccountcode':_0x110922[_0x1e8c('0x11')],'transfereecontext':_0x110922[_0x1e8c('0x12')],'transfereeexten':_0x110922['transfereeexten'],'transfereelinkedid':_0x110922[_0x1e8c('0x13')],'isexternal':_0x110922[_0x1e8c('0x14')],'context':_0x110922[_0x1e8c('0x15')],'extension':_0x110922['extension'],'type':'blind'},'log':_0x1e8c('0x2')});};exports[_0x1e8c('0x16')]=function(_0x1aab55){return client[_0x1e8c('0x1')](_0x1e8c('0x2'),{'body':{'result':_0x1aab55[_0x1e8c('0x3')],'transfererchannel':_0x1aab55[_0x1e8c('0x17')],'transferercalleridnum':_0x1aab55[_0x1e8c('0x18')],'transferercalleridname':_0x1aab55['origtransferercalleridname'],'transfererconnectedlinenum':_0x1aab55[_0x1e8c('0x19')],'transfererconnectedlinename':_0x1aab55[_0x1e8c('0x1a')],'transfereraccountcode':_0x1aab55[_0x1e8c('0x1b')],'transferercontext':_0x1aab55['secondtransferercontext'],'transfererexten':_0x1aab55['secondtransfererexten'],'transfererlinkedid':_0x1aab55[_0x1e8c('0x1c')],'transfereechannel':_0x1aab55['transfertargetchannel'],'transfereecalleridnum':_0x1aab55[_0x1e8c('0x1d')],'transfereecalleridname':_0x1aab55[_0x1e8c('0x1e')],'transfereeconnectedlinenum':_0x1aab55[_0x1e8c('0x1f')],'transfereeconnectedlinename':_0x1aab55[_0x1e8c('0x20')],'transfereeaccountcode':_0x1aab55[_0x1e8c('0x21')],'transfereecontext':_0x1aab55[_0x1e8c('0x22')],'transfereeexten':_0x1aab55[_0x1e8c('0x23')],'transfereelinkedid':_0x1aab55[_0x1e8c('0x24')],'isexternal':_0x1aab55[_0x1e8c('0x14')],'context':_0x1aab55[_0x1e8c('0x25')],'extension':_0x1aab55['origtransfererexten'],'type':_0x1e8c('0x26')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x30a2=['transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','blindTransfer','Request','CreateVoiceTransferReport','result'];(function(_0x20c893,_0xbef2b4){var _0xc705e8=function(_0x449739){while(--_0x449739){_0x20c893['push'](_0x20c893['shift']());}};_0xc705e8(++_0xbef2b4);}(_0x30a2,0x1ea));var _0x230a=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x30a2[_0x540dcb];return _0x49353c;};'use strict';var client=require('../client');exports['transfers']={};exports[_0x230a('0x0')]=function(_0x5f1c21){return client[_0x230a('0x1')](_0x230a('0x2'),{'body':{'result':_0x5f1c21[_0x230a('0x3')],'transfererchannel':_0x5f1c21[_0x230a('0x4')],'transferercalleridnum':_0x5f1c21[_0x230a('0x5')],'transferercalleridname':_0x5f1c21[_0x230a('0x6')],'transfererconnectedlinenum':_0x5f1c21[_0x230a('0x7')],'transfererconnectedlinename':_0x5f1c21[_0x230a('0x8')],'transfereraccountcode':_0x5f1c21['transfereraccountcode'],'transferercontext':_0x5f1c21[_0x230a('0x9')],'transfererexten':_0x5f1c21[_0x230a('0xa')],'transfererlinkedid':_0x5f1c21[_0x230a('0xb')],'transfereechannel':_0x5f1c21[_0x230a('0xc')],'transfereecalleridnum':_0x5f1c21['transfereecalleridnum'],'transfereecalleridname':_0x5f1c21[_0x230a('0xd')],'transfereeconnectedlinenum':_0x5f1c21[_0x230a('0xe')],'transfereeconnectedlinename':_0x5f1c21[_0x230a('0xf')],'transfereeaccountcode':_0x5f1c21[_0x230a('0x10')],'transfereecontext':_0x5f1c21[_0x230a('0x11')],'transfereeexten':_0x5f1c21[_0x230a('0x12')],'transfereelinkedid':_0x5f1c21['transfereelinkedid'],'isexternal':_0x5f1c21[_0x230a('0x13')],'context':_0x5f1c21[_0x230a('0x14')],'extension':_0x5f1c21[_0x230a('0x15')],'type':_0x230a('0x16')},'log':_0x230a('0x2')});};exports['attendedTransfer']=function(_0xb23ee6){return client[_0x230a('0x1')](_0x230a('0x2'),{'body':{'result':_0xb23ee6['result'],'transfererchannel':_0xb23ee6['origtransfererchannel'],'transferercalleridnum':_0xb23ee6[_0x230a('0x17')],'transferercalleridname':_0xb23ee6[_0x230a('0x18')],'transfererconnectedlinenum':_0xb23ee6[_0x230a('0x19')],'transfererconnectedlinename':_0xb23ee6['secondtransfererconnectedlinename'],'transfereraccountcode':_0xb23ee6[_0x230a('0x1a')],'transferercontext':_0xb23ee6[_0x230a('0x1b')],'transfererexten':_0xb23ee6['secondtransfererexten'],'transfererlinkedid':_0xb23ee6[_0x230a('0x1c')],'transfereechannel':_0xb23ee6['transfertargetchannel'],'transfereecalleridnum':_0xb23ee6['transfertargetcalleridnum'],'transfereecalleridname':_0xb23ee6['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xb23ee6[_0x230a('0x1d')],'transfereeconnectedlinename':_0xb23ee6[_0x230a('0x1e')],'transfereeaccountcode':_0xb23ee6[_0x230a('0x1f')],'transfereecontext':_0xb23ee6[_0x230a('0x20')],'transfereeexten':_0xb23ee6[_0x230a('0x21')],'transfereelinkedid':_0xb23ee6[_0x230a('0x22')],'isexternal':_0xb23ee6['isexternal'],'context':_0xb23ee6[_0x230a('0x23')],'extension':_0xb23ee6[_0x230a('0x24')],'type':_0x230a('0x25')},'log':_0x230a('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 124497d..13599c3 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 _0x1b20=['context','telephones','trunks','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','%s/%s','SIP','name','timers','timer','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','username','join','pick','keys','reload','Reload','Action','message','catch','ami\x20disconnected','command','action','Command','then','content','voiceQueues','hasOwnProperty','length','find','omit','undefined','values','channels','uniqueid','format','wav','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','push','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','rec','Channel\x20doesn\x27t\x20exist','voicechannel','validate','map','resolve','StopMixMonitor','destinationchannel','status','stop','%s.%s','filename','StopMixMonitor\x20Success','queueChannels','type','inbound','outbound','includes','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','Redirect','exten'];(function(_0x33287e,_0x14414e){var _0x582601=function(_0x770da5){while(--_0x770da5){_0x33287e['push'](_0x33287e['shift']());}};_0x582601(++_0x14414e);}(_0x1b20,0x66));var _0x01b2=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1b20[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var jayson=require(_0x01b2('0x1'));var schema=require('validate');var moment=require('moment');var config=require(_0x01b2('0x2'));var properties=require(_0x01b2('0x3'));var ami=require(_0x01b2('0x4'));var VoiceQueueSummary=require(_0x01b2('0x5'));exports[_0x01b2('0x6')]=function(_0x365550,_0x419c17,_0x28de4a){return new Promise(function(_0x46e745,_0xa64ad1){var _0x43d561={'QueuePause':function(_0x323470){return new Promise(function(_0x508add){var _0x132a08=util['format'](_0x01b2('0x7'),_0x01b2('0x8'),_0x323470[_0x01b2('0x9')]);if(_0x365550[_0x01b2('0xa')]&&_0x365550[_0x01b2('0xa')][_0x132a08]&&_0x365550[_0x01b2('0xa')][_0x132a08][_0x01b2('0xb')]){_0x365550[_0x01b2('0xa')][_0x132a08]['updateAcw']();}if(_0x365550[_0x01b2('0xc')][_0x132a08]){_0x365550['agents'][_0x132a08][_0x01b2('0xd')]({'statePause':_0x323470['pause']?!![]:![]});}_0x508add({'code':0xc8,'message':_0x01b2('0xe')});});},'Reload':function(_0x8ac569){var _0x2c6d4d=this;return new Promise(function(_0x5ed1e2,_0x578477){if(ami[_0x01b2('0xf')]()==![]){return _0x578477(_0x2c6d4d[_0x01b2('0x10')](0x1f4,[config[_0x01b2('0x11')]['ip'],config[_0x01b2('0x11')][_0x01b2('0x12')],'ami\x20disconnected'][_0x01b2('0x13')]('\x20')));}_0x8ac569=_[_0x01b2('0x14')](_0x8ac569,_[_0x01b2('0x15')](properties[_0x01b2('0x16')]['module']));_0x8ac569['action']=_0x01b2('0x17');return ami[_0x01b2('0x18')](_0x8ac569)['then'](function(_0x1eafc4){_0x5ed1e2({'code':0xc8,'message':_0x1eafc4[_0x01b2('0x19')]});})[_0x01b2('0x1a')](function(_0x5986f5){_0x578477(_0x2c6d4d[_0x01b2('0x10')](0x1f5,_0x5986f5[_0x01b2('0x19')]));});});},'Command':function(_0x38c4c8){var _0xd2acbb=this;return new Promise(function(_0x1391f5,_0x56ea3c){if(ami[_0x01b2('0xf')]()==![]){return _0x56ea3c(_0xd2acbb['error'](0x1f4,[config[_0x01b2('0x11')]['ip'],config['asterisk'][_0x01b2('0x12')],_0x01b2('0x1b')][_0x01b2('0x13')]('\x20')));}_0x38c4c8=_['pick'](_0x38c4c8,_0x01b2('0x1c'));_0x38c4c8[_0x01b2('0x1d')]=_0x01b2('0x1e');return ami[_0x01b2('0x18')](_0x38c4c8)[_0x01b2('0x1f')](function(_0x479e94){_0x1391f5({'code':0xc8,'message':_0x479e94[_0x01b2('0x20')]});})['catch'](function(_0x54e866){_0x56ea3c(_0xd2acbb[_0x01b2('0x10')](0x1f5,_0x54e866[_0x01b2('0x19')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3fcb69){var _0x1d2e56=[];for(var _0x2e32c1 in _0x365550[_0x01b2('0x21')]){if(_0x365550['voiceQueues'][_0x01b2('0x22')](_0x2e32c1)){var _0x239543=_0x365550[_0x01b2('0x21')][_0x2e32c1];var _0x17274f=new VoiceQueueSummary(_0x239543);_0x1d2e56['push'](_0x17274f);}}_0x3fcb69({'count':_0x1d2e56[_0x01b2('0x23')],'rows':_0x1d2e56});});},'UpdateVoiceQueue':function(_0x586814){return new Promise(function(_0x122925,_0x1e6ac2){var _0x5da26c=_[_0x01b2('0x24')](_0x365550['voiceQueues'],{'id':parseInt(_0x586814['id'])});var _0x487c49=_[_0x01b2('0x25')](_0x586814,['id']);if(_0x5da26c){for(var _0x4363ec in _0x487c49){if(typeof _0x487c49[_0x4363ec]!=='undefined'&&typeof _0x5da26c[_0x4363ec]!==_0x01b2('0x26')){_0x5da26c[_0x4363ec]=_0x487c49[_0x4363ec];}}_0x122925(_0x5da26c);}else{_0x1e6ac2();}});},'VoiceChannels':function(){return new Promise(function(_0x4549a0){var _0x32aab0=_[_0x01b2('0x27')](_0x365550[_0x01b2('0x28')]);_0x4549a0({'count':_0x32aab0[_0x01b2('0x23')],'rows':_0x32aab0});});},'VoiceChannelMixMonitor':function(_0xd60b46){var _0x3169f5=this;return new Promise(function(_0x27eeb3,_0x11d8e5){if(ami[_0x01b2('0xf')]()==![]){return _0x11d8e5(_0x3169f5['error'](0x1f4,[config[_0x01b2('0x11')]['ip'],config[_0x01b2('0x11')][_0x01b2('0x12')],_0x01b2('0x1b')][_0x01b2('0x13')]('\x20')));}var _0x11dd4e=schema(properties['voicechannel'])['validate'](_0xd60b46);if(_0x11dd4e[_0x01b2('0x23')]>0x0){return _0x11d8e5(_0x3169f5['error'](0x1f4,_['map'](_0x11dd4e,_0x01b2('0x19'))[_0x01b2('0x13')](',\x20')));}var _0x21405c=_[_0x01b2('0x24')](_0x365550['channels'],{'uniqueid':_0xd60b46[_0x01b2('0x29')]});if(_0x21405c&&_0x21405c['channel']){var _0xcd6801=util['format']('%s.%s',_0xd60b46['filename']||_0xd60b46[_0x01b2('0x29')],_0xd60b46[_0x01b2('0x2a')]||_0x01b2('0x2b'));return ami[_0x01b2('0x18')]({'action':'MixMonitor','channel':_0x21405c[_0x01b2('0x2c')],'file':_0xcd6801,'options':_0x01b2('0x2d')})['then'](function(_0xecbce4){var _0x1b77f7=_[_0x01b2('0x24')](_0x21405c[_0x01b2('0x2e')],{'filename':_0x01b2('0x2f')+_0xcd6801[_0x01b2('0x30')]()});if(_['isNil'](_0x1b77f7)){_0x21405c[_0x01b2('0x2e')][_0x01b2('0x31')]({'filename':'/var/spool/asterisk/monitor/'+_0xcd6801['toLowerCase'](),'createdAt':moment()[_0x01b2('0x2a')](_0x01b2('0x32')),'mixmonitorid':_0xecbce4[_0x01b2('0x33')],'status':_0x01b2('0x34')});}else{_0x1b77f7[_0x01b2('0x33')]=_0xecbce4[_0x01b2('0x33')];_0x1b77f7['status']='rec';}_0x27eeb3({'code':0xc8,'message':[_0xd60b46[_0x01b2('0x29')],'MixMonitor\x20Success',_0xecbce4[_0x01b2('0x33')]][_0x01b2('0x13')]('\x20'),'mixmonitorid':_0xecbce4[_0x01b2('0x33')]});})[_0x01b2('0x1a')](function(_0xb381ec){_0x11d8e5(_0x3169f5['error'](0x1f5,[_0xd60b46[_0x01b2('0x29')],_0xb381ec[_0x01b2('0x19')][_0x01b2('0x30')]()]['join']('\x20')));});}else{return _0x11d8e5(_0x3169f5[_0x01b2('0x10')](0x1f5,_0x01b2('0x35')));}});},'VoiceChannelStopMixMonitor':function(_0x28a0f4){var _0x5a7b44=this;return new Promise(function(_0x34f646,_0x51e67c){if(ami[_0x01b2('0xf')]()==![]){return _0x51e67c(_0x5a7b44[_0x01b2('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x01b2('0x11')][_0x01b2('0x12')],'ami\x20disconnected'][_0x01b2('0x13')]('\x20')));}var _0x223029=schema(properties[_0x01b2('0x36')])[_0x01b2('0x37')](_0x28a0f4);if(_0x223029[_0x01b2('0x23')]>0x0){return _0x51e67c(_0x5a7b44['error'](0x1f4,_[_0x01b2('0x38')](_0x223029,_0x01b2('0x19'))[_0x01b2('0x13')](',\x20')));}var _0x5d1b39=_[_0x01b2('0x24')](_0x365550[_0x01b2('0x28')],{'uniqueid':_0x28a0f4[_0x01b2('0x29')]});if(_0x5d1b39){return Promise[_0x01b2('0x39')]()[_0x01b2('0x1f')](function(){if(_0x5d1b39[_0x01b2('0x2c')]){return ami[_0x01b2('0x18')]({'action':_0x01b2('0x3a'),'channel':_0x5d1b39['channel'],'mixmonitorid':_0x28a0f4[_0x01b2('0x33')]})[_0x01b2('0x1a')](function(){});}})[_0x01b2('0x1f')](function(){if(_0x5d1b39[_0x01b2('0x3b')]){return ami[_0x01b2('0x18')]({'action':_0x01b2('0x3a'),'channel':_0x5d1b39[_0x01b2('0x3b')],'mixmonitorid':_0x28a0f4['mixmonitorid']})[_0x01b2('0x1a')](function(){});}})[_0x01b2('0x1f')](function(){var _0x1855d2=_[_0x01b2('0x24')](_0x5d1b39['monitors'],{'mixmonitorid':_0x28a0f4['mixmonitorid']});if(_0x1855d2){_0x1855d2[_0x01b2('0x3c')]=_0x01b2('0x3d');}})[_0x01b2('0x1f')](function(){var _0x49370d=util[_0x01b2('0x2a')](_0x01b2('0x3e'),_0x28a0f4[_0x01b2('0x3f')]||_0x28a0f4[_0x01b2('0x29')],_0x28a0f4[_0x01b2('0x2a')]||_0x01b2('0x2b'));var _0x5b54c5=_[_0x01b2('0x24')](_0x5d1b39['monitors'],{'filename':_0x01b2('0x2f')+_0x49370d['toLowerCase']()});if(_0x5b54c5){_0x5b54c5['status']=_0x01b2('0x3d');}})[_0x01b2('0x1f')](function(){_0x34f646({'code':0xc8,'message':[_0x28a0f4[_0x01b2('0x29')],_0x01b2('0x40')][_0x01b2('0x13')]('\x20')});})['catch'](function(_0x47ff3c){_0x51e67c(_0x5a7b44[_0x01b2('0x10')](0x1f5,[_0x28a0f4[_0x01b2('0x29')],_0x47ff3c[_0x01b2('0x19')][_0x01b2('0x30')]()][_0x01b2('0x13')]('\x20')));});}else{return _0x51e67c(_0x5a7b44[_0x01b2('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x1dfc43){var _0x11248e=this;return new Promise(function(_0x12ec87){var _0x2b5bb5=_[_0x01b2('0x27')](_0x365550[_0x01b2('0x41')]);var _0x2a60c4={'count':_0x2b5bb5['length'],'rows':_0x2b5bb5};if(_0x1dfc43&&_0x1dfc43[_0x01b2('0x42')]){if(![_0x01b2('0x43'),_0x01b2('0x44')][_0x01b2('0x45')](_0x1dfc43[_0x01b2('0x42')])){return _0xa64ad1(_0x11248e[_0x01b2('0x10')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x8c3266=_[_0x01b2('0x46')](_0x2b5bb5,function(_0x1c9f3e){return _0x1c9f3e[_0x01b2('0x42')]===_0x1dfc43[_0x01b2('0x42')];});_0x2a60c4[_0x01b2('0x47')]=_0x8c3266[_0x01b2('0x23')];_0x2a60c4[_0x01b2('0x48')]=_0x8c3266;}_0x12ec87(_0x2a60c4);});},'VoiceQueuesChannel':function(_0x19ec33){var _0x1b5db2=this;return new Promise(function(_0x29ebdb,_0x43f453){var _0x11a8a0=schema(properties[_0x01b2('0x49')])['validate'](_0x19ec33);if(_0x11a8a0['length']>0x0){return _0x43f453(_0x1b5db2['error'](0x1f4,_['map'](_0x11a8a0,_0x01b2('0x19'))[_0x01b2('0x13')](',\x20')));}var _0x9daac7=_['find'](_0x365550[_0x01b2('0x41')],{'uniqueid':_0x19ec33['uniqueid']});if(_0x9daac7){_0x29ebdb(_0x9daac7);}else{return _0x43f453(_0x1b5db2[_0x01b2('0x10')](0x1f5,_0x01b2('0x35')));}});},'VoiceQueuesChannelHangup':function(_0x1f4de8){var _0x3eb974=this;return new Promise(function(_0x1dc49e,_0x5e9f8e){if(ami[_0x01b2('0xf')]()==![]){return _0x5e9f8e(_0x3eb974['error'](0x1f4,[config[_0x01b2('0x11')]['ip'],config[_0x01b2('0x11')]['username'],_0x01b2('0x1b')]['join']('\x20')));}var _0x2347ed=schema(properties[_0x01b2('0x4a')])[_0x01b2('0x37')](_0x1f4de8);if(_0x2347ed[_0x01b2('0x23')]>0x0){return _0x5e9f8e(_0x3eb974[_0x01b2('0x10')](0x1f4,_[_0x01b2('0x38')](_0x2347ed,_0x01b2('0x19'))[_0x01b2('0x13')](',\x20')));}var _0x2d4e47=_[_0x01b2('0x24')](_0x365550['queueChannels'],{'uniqueid':_0x1f4de8[_0x01b2('0x29')]});if(_0x2d4e47&&_0x2d4e47['channel']){return ami[_0x01b2('0x18')]({'action':_0x01b2('0x4b'),'channel':_0x2d4e47[_0x01b2('0x2c')]})['then'](function(_0x126538){_0x1dc49e({'code':0xc8,'message':[_0x1f4de8['uniqueid'],_0x126538['message'][_0x01b2('0x30')]()][_0x01b2('0x13')]('\x20')});})[_0x01b2('0x1a')](function(_0x5d3b04){_0x5e9f8e(_0x3eb974[_0x01b2('0x10')](0x1f5,[_0x1f4de8[_0x01b2('0x29')],_0x5d3b04[_0x01b2('0x19')]['toLowerCase']()][_0x01b2('0x13')]('\x20')));});}else{return _0x5e9f8e(_0x3eb974[_0x01b2('0x10')](0x1f5,_0x01b2('0x35')));}});},'VoiceQueuesChannelRedirect':function(_0x1b11ee){var _0x26ae10=this;return new Promise(function(_0x1e13af,_0x275465){if(ami['isConnected']()==![]){return _0x275465(_0x26ae10['error'](0x1f4,[config[_0x01b2('0x11')]['ip'],config['asterisk']['username'],_0x01b2('0x1b')]['join']('\x20')));}var _0xbe104b=schema(properties['voicequeuechannelredirect'])[_0x01b2('0x37')](_0x1b11ee);if(_0xbe104b[_0x01b2('0x23')]>0x0){return _0x275465(_0x26ae10[_0x01b2('0x10')](0x1f4,_[_0x01b2('0x38')](_0xbe104b,'message')[_0x01b2('0x13')](',\x20')));}var _0x5aa15c=_[_0x01b2('0x24')](_0x365550['queueChannels'],{'uniqueid':_0x1b11ee[_0x01b2('0x29')]});if(_0x5aa15c&&_0x5aa15c['channel']){return ami[_0x01b2('0x18')]({'action':_0x01b2('0x4c'),'channel':_0x5aa15c['channel'],'exten':_0x1b11ee[_0x01b2('0x4d')],'context':_0x1b11ee[_0x01b2('0x4e')]||_0x5aa15c[_0x01b2('0x4e')],'priority':0x1})[_0x01b2('0x1f')](function(_0x16c830){_0x1e13af({'code':0xc8,'message':[_0x1b11ee[_0x01b2('0x29')],_0x16c830[_0x01b2('0x19')][_0x01b2('0x30')]()][_0x01b2('0x13')]('\x20')});})[_0x01b2('0x1a')](function(_0x2cc237){_0x275465(_0x26ae10[_0x01b2('0x10')](0x1f5,[_0x1b11ee[_0x01b2('0x29')],_0x2cc237['message']['toLowerCase']()][_0x01b2('0x13')]('\x20')));});}else{return _0x275465(_0x26ae10[_0x01b2('0x10')](0x1f5,_0x01b2('0x35')));}});},'Agents':function(_0x427358){return new Promise(function(_0x21cecf){var _0x3a44d2=_[_0x01b2('0x27')](_0x365550[_0x01b2('0xc')]);if(_0x427358&&_0x427358['id']){var _0x5b292e=_[_0x01b2('0x24')](_0x3a44d2,function(_0x5f2a73){return _0x5f2a73['id']===_0x427358['id'];});_0x21cecf(_0x5b292e);}else{_0x21cecf({'count':_0x3a44d2[_0x01b2('0x23')],'rows':_0x3a44d2});}});},'Telephones':function(){return new Promise(function(_0x23bca9){var _0x390e18=_[_0x01b2('0x27')](_0x365550[_0x01b2('0x4f')]);_0x23bca9({'count':_0x390e18['length'],'rows':_0x390e18});});},'Trunks':function(){return new Promise(function(_0x5dd4d4){var _0x2b7bf6=_[_0x01b2('0x27')](_0x365550[_0x01b2('0x50')]);_0x5dd4d4({'count':_0x2b7bf6['length'],'rows':_0x2b7bf6});});},'OutboundChannels':function(){return new Promise(function(_0x3d3248){var _0x2f6d16=_[_0x01b2('0x27')](_0x365550['outboundChannels']);_0x3d3248({'count':_0x2f6d16[_0x01b2('0x23')],'rows':_0x2f6d16});});},'Outbound':function(){return new Promise(function(_0xdf1d4c){_0xdf1d4c(_0x365550[_0x01b2('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x5b34bb){var _0x4b8ee0=_[_0x01b2('0x27')](_0x365550['campaigns']);_0x5b34bb({'count':_0x4b8ee0[_0x01b2('0x23')],'rows':_0x4b8ee0});});},'VoiceQueuesPreview':function(_0x10d19f){var _0x2f41b6=this;return new Promise(function(_0x2e36f8,_0x19a417){_0x419c17[_0x01b2('0x51')](_0x10d19f['id'])['then'](function(_0x3cd94a){_0x2e36f8({'code':0xc8,'message':_0x3cd94a[_0x01b2('0x19')]});})[_0x01b2('0x1a')](function(_0x2612aa){_0x19a417(_0x2f41b6[_0x01b2('0x10')](0x1f4,_0x2612aa[_0x01b2('0x19')]));});});},'EventManager':function(_0x5038b2){var _0x12f5ed=this;return new Promise(function(_0x1dcd45,_0x2a5603){if(!_0x5038b2[_0x01b2('0x52')]){return _0x2a5603(_0x12f5ed[_0x01b2('0x10')](0x1f4,_0x01b2('0x53')));}ami['emit'](_0x01b2('0x54')+_0x5038b2['event'],_0x5038b2[_0x01b2('0x19')]);_0x1dcd45({'code':0xc8,'message':_0x5038b2});});},'FaxAccounts':function(){return new Promise(function(_0x5de7c2){var _0x5d03b0=_[_0x01b2('0x27')](_0x365550[_0x01b2('0x55')]);_0x5de7c2({'count':_0x5d03b0['length'],'rows':_0x5d03b0});});},'SendFax':function(_0x2e43df){var _0x4015e2=this;return new Promise(function(_0x288e34,_0x270479){_0x28de4a['send'](_0x2e43df)[_0x01b2('0x1f')](function(_0x42c703){_0x288e34({'code':0xc8,'message':_0x42c703[_0x01b2('0x19')]});})[_0x01b2('0x1a')](function(_0x20a0fd){_0x270479(_0x4015e2[_0x01b2('0x10')](0x1f4,_0x20a0fd[_0x01b2('0x19')]));});});},'CheckAfterSend':function(_0x44034b){var _0x31e865=this;return new Promise(function(_0x3cc29b,_0x24e16e){_0x28de4a['checkAfterSend'](_0x44034b)[_0x01b2('0x1f')](function(_0x3e17c3){_0x3cc29b({'code':0xc8,'message':_0x3e17c3[_0x01b2('0x19')]});})[_0x01b2('0x1a')](function(_0x903a9f){_0x24e16e(_0x31e865[_0x01b2('0x10')](0x1f4,_0x903a9f[_0x01b2('0x19')]));});});}};var _0x1c7f70=jayson['server'](_0x43d561)['http']();_0x1c7f70['on'](_0x01b2('0x10'),function(_0x15cd87){return _0xa64ad1(_0x15cd87);});_0x1c7f70[_0x01b2('0x6')](0x232a,_0x01b2('0x56'),function(){console[_0x01b2('0x57')](_0x01b2('0x58'),0x232a);return _0x46e745(_0x01b2('0x59')+0x232a);});});}; \ No newline at end of file +var _0x038b=['format','%s/%s','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','join','pick','keys','reload','module','action','Action','then','message','ami\x20disconnected','command','Command','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','filename','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','MixMonitor\x20Success','catch','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','status','stop','%s.%s','StopMixMonitor\x20Success','queueChannels','type','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','context','telephones','trunks','outboundChannels','campaigns','run','event','Event\x20name\x20mandatory','emit','custom:','send','checkAfterSend','server','http','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','util','jayson/promise','validate','../../../config/environment','../ami','../model/voiceQueueSummary'];(function(_0x56092a,_0x291ce5){var _0x1c9558=function(_0x5bf0c5){while(--_0x5bf0c5){_0x56092a['push'](_0x56092a['shift']());}};_0x1c9558(++_0x291ce5);}(_0x038b,0x114));var _0xb038=function(_0x30f809,_0xb267e6){_0x30f809=_0x30f809-0x0;var _0x2aada5=_0x038b[_0x30f809];return _0x2aada5;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var jayson=require(_0xb038('0x1'));var schema=require(_0xb038('0x2'));var moment=require('moment');var config=require(_0xb038('0x3'));var properties=require('../properties');var ami=require(_0xb038('0x4'));var VoiceQueueSummary=require(_0xb038('0x5'));exports['listen']=function(_0x3737b5,_0x11da3a,_0x4fe092){return new Promise(function(_0x54e1e7,_0x2e3e64){var _0x1b077a={'QueuePause':function(_0x1534a9){return new Promise(function(_0x4b4085){var _0x48a4d7=util[_0xb038('0x6')](_0xb038('0x7'),'SIP',_0x1534a9['name']);if(_0x3737b5[_0xb038('0x8')]&&_0x3737b5[_0xb038('0x8')][_0x48a4d7]&&_0x3737b5['timers'][_0x48a4d7][_0xb038('0x9')]){_0x3737b5[_0xb038('0x8')][_0x48a4d7][_0xb038('0xa')]();}if(_0x3737b5[_0xb038('0xb')][_0x48a4d7]){_0x3737b5[_0xb038('0xb')][_0x48a4d7][_0xb038('0xc')]({'statePause':_0x1534a9[_0xb038('0xd')]?!![]:![]});}_0x4b4085({'code':0xc8,'message':_0xb038('0xe')});});},'Reload':function(_0x16e4a3){var _0x57acd8=this;return new Promise(function(_0x60f332,_0x119c81){if(ami[_0xb038('0xf')]()==![]){return _0x119c81(_0x57acd8[_0xb038('0x10')](0x1f4,[config[_0xb038('0x11')]['ip'],config[_0xb038('0x11')][_0xb038('0x12')],'ami\x20disconnected'][_0xb038('0x13')]('\x20')));}_0x16e4a3=_[_0xb038('0x14')](_0x16e4a3,_[_0xb038('0x15')](properties[_0xb038('0x16')][_0xb038('0x17')]));_0x16e4a3[_0xb038('0x18')]='Reload';return ami[_0xb038('0x19')](_0x16e4a3)[_0xb038('0x1a')](function(_0xd1fae0){_0x60f332({'code':0xc8,'message':_0xd1fae0[_0xb038('0x1b')]});})['catch'](function(_0x49b237){_0x119c81(_0x57acd8[_0xb038('0x10')](0x1f5,_0x49b237[_0xb038('0x1b')]));});});},'Command':function(_0x3e06ef){var _0x31c348=this;return new Promise(function(_0x4fd2e8,_0x222b84){if(ami[_0xb038('0xf')]()==![]){return _0x222b84(_0x31c348[_0xb038('0x10')](0x1f4,[config[_0xb038('0x11')]['ip'],config[_0xb038('0x11')]['username'],_0xb038('0x1c')][_0xb038('0x13')]('\x20')));}_0x3e06ef=_[_0xb038('0x14')](_0x3e06ef,_0xb038('0x1d'));_0x3e06ef['action']=_0xb038('0x1e');return ami[_0xb038('0x19')](_0x3e06ef)['then'](function(_0x1eb9cd){_0x4fd2e8({'code':0xc8,'message':_0x1eb9cd[_0xb038('0x1f')]});})['catch'](function(_0x241329){_0x222b84(_0x31c348['error'](0x1f5,_0x241329[_0xb038('0x1b')]));});});},'VoiceQueues':function(){return new Promise(function(_0x36eb5b){var _0x27ff21=[];for(var _0x1df7c4 in _0x3737b5[_0xb038('0x20')]){if(_0x3737b5[_0xb038('0x20')][_0xb038('0x21')](_0x1df7c4)){var _0x576be5=_0x3737b5[_0xb038('0x20')][_0x1df7c4];var _0x33cf3c=new VoiceQueueSummary(_0x576be5);_0x27ff21[_0xb038('0x22')](_0x33cf3c);}}_0x36eb5b({'count':_0x27ff21['length'],'rows':_0x27ff21});});},'UpdateVoiceQueue':function(_0xa8fe18){return new Promise(function(_0x3af191,_0x1fa72d){var _0x47ff40=_[_0xb038('0x23')](_0x3737b5[_0xb038('0x20')],{'id':parseInt(_0xa8fe18['id'])});var _0x28a6a9=_[_0xb038('0x24')](_0xa8fe18,['id']);if(_0x47ff40){for(var _0xc387d in _0x28a6a9){if(typeof _0x28a6a9[_0xc387d]!=='undefined'&&typeof _0x47ff40[_0xc387d]!==_0xb038('0x25')){_0x47ff40[_0xc387d]=_0x28a6a9[_0xc387d];}}_0x3af191(_0x47ff40);}else{_0x1fa72d();}});},'VoiceChannels':function(){return new Promise(function(_0x1a8aa5){var _0x3d2719=_[_0xb038('0x26')](_0x3737b5[_0xb038('0x27')]);_0x1a8aa5({'count':_0x3d2719[_0xb038('0x28')],'rows':_0x3d2719});});},'VoiceChannelMixMonitor':function(_0x29a0d7){var _0x3695aa=this;return new Promise(function(_0xe4eb72,_0x22fb2c){if(ami[_0xb038('0xf')]()==![]){return _0x22fb2c(_0x3695aa[_0xb038('0x10')](0x1f4,[config[_0xb038('0x11')]['ip'],config['asterisk'][_0xb038('0x12')],'ami\x20disconnected'][_0xb038('0x13')]('\x20')));}var _0x13bf20=schema(properties[_0xb038('0x29')])[_0xb038('0x2')](_0x29a0d7);if(_0x13bf20[_0xb038('0x28')]>0x0){return _0x22fb2c(_0x3695aa[_0xb038('0x10')](0x1f4,_[_0xb038('0x2a')](_0x13bf20,_0xb038('0x1b'))[_0xb038('0x13')](',\x20')));}var _0x883647=_['find'](_0x3737b5[_0xb038('0x27')],{'uniqueid':_0x29a0d7[_0xb038('0x2b')]});if(_0x883647&&_0x883647[_0xb038('0x2c')]){var _0x560342=util['format']('%s.%s',_0x29a0d7[_0xb038('0x2d')]||_0x29a0d7[_0xb038('0x2b')],_0x29a0d7[_0xb038('0x6')]||_0xb038('0x2e'));return ami[_0xb038('0x19')]({'action':_0xb038('0x2f'),'channel':_0x883647['channel'],'file':_0x560342,'options':_0xb038('0x30')})[_0xb038('0x1a')](function(_0x1b6f1e){var _0x17c445=_['find'](_0x883647[_0xb038('0x31')],{'filename':_0xb038('0x32')+_0x560342['toLowerCase']()});if(_['isNil'](_0x17c445)){_0x883647[_0xb038('0x31')][_0xb038('0x22')]({'filename':_0xb038('0x32')+_0x560342[_0xb038('0x33')](),'createdAt':moment()[_0xb038('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x1b6f1e[_0xb038('0x34')],'status':_0xb038('0x35')});}else{_0x17c445[_0xb038('0x34')]=_0x1b6f1e[_0xb038('0x34')];_0x17c445['status']=_0xb038('0x35');}_0xe4eb72({'code':0xc8,'message':[_0x29a0d7[_0xb038('0x2b')],_0xb038('0x36'),_0x1b6f1e['mixmonitorid']][_0xb038('0x13')]('\x20'),'mixmonitorid':_0x1b6f1e['mixmonitorid']});})[_0xb038('0x37')](function(_0x2a539a){_0x22fb2c(_0x3695aa[_0xb038('0x10')](0x1f5,[_0x29a0d7['uniqueid'],_0x2a539a[_0xb038('0x1b')][_0xb038('0x33')]()][_0xb038('0x13')]('\x20')));});}else{return _0x22fb2c(_0x3695aa['error'](0x1f5,_0xb038('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0xa5971a){var _0x307a4a=this;return new Promise(function(_0x3c291e,_0x5ad462){if(ami[_0xb038('0xf')]()==![]){return _0x5ad462(_0x307a4a[_0xb038('0x10')](0x1f4,[config[_0xb038('0x11')]['ip'],config[_0xb038('0x11')]['username'],_0xb038('0x1c')][_0xb038('0x13')]('\x20')));}var _0x57816c=schema(properties[_0xb038('0x29')])[_0xb038('0x2')](_0xa5971a);if(_0x57816c[_0xb038('0x28')]>0x0){return _0x5ad462(_0x307a4a['error'](0x1f4,_[_0xb038('0x2a')](_0x57816c,_0xb038('0x1b'))['join'](',\x20')));}var _0x527eaa=_[_0xb038('0x23')](_0x3737b5[_0xb038('0x27')],{'uniqueid':_0xa5971a[_0xb038('0x2b')]});if(_0x527eaa){return Promise[_0xb038('0x39')]()[_0xb038('0x1a')](function(){if(_0x527eaa[_0xb038('0x2c')]){return ami[_0xb038('0x19')]({'action':_0xb038('0x3a'),'channel':_0x527eaa['channel'],'mixmonitorid':_0xa5971a['mixmonitorid']})['catch'](function(){});}})[_0xb038('0x1a')](function(){if(_0x527eaa[_0xb038('0x3b')]){return ami['Action']({'action':_0xb038('0x3a'),'channel':_0x527eaa[_0xb038('0x3b')],'mixmonitorid':_0xa5971a[_0xb038('0x34')]})['catch'](function(){});}})[_0xb038('0x1a')](function(){var _0x544f96=_['find'](_0x527eaa[_0xb038('0x31')],{'mixmonitorid':_0xa5971a[_0xb038('0x34')]});if(_0x544f96){_0x544f96[_0xb038('0x3c')]=_0xb038('0x3d');}})[_0xb038('0x1a')](function(){var _0x3b09e3=util[_0xb038('0x6')](_0xb038('0x3e'),_0xa5971a[_0xb038('0x2d')]||_0xa5971a[_0xb038('0x2b')],_0xa5971a['format']||_0xb038('0x2e'));var _0x3ed968=_['find'](_0x527eaa[_0xb038('0x31')],{'filename':_0xb038('0x32')+_0x3b09e3['toLowerCase']()});if(_0x3ed968){_0x3ed968[_0xb038('0x3c')]=_0xb038('0x3d');}})[_0xb038('0x1a')](function(){_0x3c291e({'code':0xc8,'message':[_0xa5971a[_0xb038('0x2b')],_0xb038('0x3f')][_0xb038('0x13')]('\x20')});})[_0xb038('0x37')](function(_0x19ed8d){_0x5ad462(_0x307a4a[_0xb038('0x10')](0x1f5,[_0xa5971a['uniqueid'],_0x19ed8d[_0xb038('0x1b')][_0xb038('0x33')]()][_0xb038('0x13')]('\x20')));});}else{return _0x5ad462(_0x307a4a[_0xb038('0x10')](0x1f5,_0xb038('0x38')));}});},'VoiceQueuesChannels':function(_0x2e1875){var _0x591077=this;return new Promise(function(_0x1f4997){var _0x2f3622=_[_0xb038('0x26')](_0x3737b5[_0xb038('0x40')]);var _0x2dfa96={'count':_0x2f3622[_0xb038('0x28')],'rows':_0x2f3622};if(_0x2e1875&&_0x2e1875[_0xb038('0x41')]){if(!['inbound',_0xb038('0x42')]['includes'](_0x2e1875[_0xb038('0x41')])){return _0x2e3e64(_0x591077[_0xb038('0x10')](0x190,_0xb038('0x43')));}var _0x998fe3=_[_0xb038('0x44')](_0x2f3622,function(_0x5ea7df){return _0x5ea7df['type']===_0x2e1875['type'];});_0x2dfa96[_0xb038('0x45')]=_0x998fe3[_0xb038('0x28')];_0x2dfa96[_0xb038('0x46')]=_0x998fe3;}_0x1f4997(_0x2dfa96);});},'VoiceQueuesChannel':function(_0x218368){var _0x3ec397=this;return new Promise(function(_0xb4eb34,_0x525687){var _0x27758c=schema(properties[_0xb038('0x47')])['validate'](_0x218368);if(_0x27758c['length']>0x0){return _0x525687(_0x3ec397[_0xb038('0x10')](0x1f4,_['map'](_0x27758c,_0xb038('0x1b'))['join'](',\x20')));}var _0x413640=_[_0xb038('0x23')](_0x3737b5[_0xb038('0x40')],{'uniqueid':_0x218368[_0xb038('0x2b')]});if(_0x413640){_0xb4eb34(_0x413640);}else{return _0x525687(_0x3ec397['error'](0x1f5,_0xb038('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x3f53a2){var _0x6fba95=this;return new Promise(function(_0x24de1d,_0x1c5e1d){if(ami[_0xb038('0xf')]()==![]){return _0x1c5e1d(_0x6fba95[_0xb038('0x10')](0x1f4,[config[_0xb038('0x11')]['ip'],config[_0xb038('0x11')][_0xb038('0x12')],_0xb038('0x1c')][_0xb038('0x13')]('\x20')));}var _0x4fb407=schema(properties[_0xb038('0x48')])[_0xb038('0x2')](_0x3f53a2);if(_0x4fb407[_0xb038('0x28')]>0x0){return _0x1c5e1d(_0x6fba95[_0xb038('0x10')](0x1f4,_[_0xb038('0x2a')](_0x4fb407,'message')[_0xb038('0x13')](',\x20')));}var _0x4ea9b2=_[_0xb038('0x23')](_0x3737b5[_0xb038('0x40')],{'uniqueid':_0x3f53a2['uniqueid']});if(_0x4ea9b2&&_0x4ea9b2[_0xb038('0x2c')]){return ami[_0xb038('0x19')]({'action':_0xb038('0x49'),'channel':_0x4ea9b2[_0xb038('0x2c')]})[_0xb038('0x1a')](function(_0x2f01c0){_0x24de1d({'code':0xc8,'message':[_0x3f53a2[_0xb038('0x2b')],_0x2f01c0[_0xb038('0x1b')][_0xb038('0x33')]()][_0xb038('0x13')]('\x20')});})['catch'](function(_0x42219b){_0x1c5e1d(_0x6fba95['error'](0x1f5,[_0x3f53a2[_0xb038('0x2b')],_0x42219b[_0xb038('0x1b')][_0xb038('0x33')]()][_0xb038('0x13')]('\x20')));});}else{return _0x1c5e1d(_0x6fba95[_0xb038('0x10')](0x1f5,_0xb038('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0x1d6cf5){var _0x4c23b2=this;return new Promise(function(_0x572ad4,_0x24ea03){if(ami[_0xb038('0xf')]()==![]){return _0x24ea03(_0x4c23b2[_0xb038('0x10')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xb038('0x12')],'ami\x20disconnected'][_0xb038('0x13')]('\x20')));}var _0x50e078=schema(properties[_0xb038('0x4a')])['validate'](_0x1d6cf5);if(_0x50e078[_0xb038('0x28')]>0x0){return _0x24ea03(_0x4c23b2[_0xb038('0x10')](0x1f4,_[_0xb038('0x2a')](_0x50e078,_0xb038('0x1b'))[_0xb038('0x13')](',\x20')));}var _0xbd6185=_['find'](_0x3737b5['queueChannels'],{'uniqueid':_0x1d6cf5[_0xb038('0x2b')]});if(_0xbd6185&&_0xbd6185['channel']){return ami[_0xb038('0x19')]({'action':_0xb038('0x4b'),'channel':_0xbd6185[_0xb038('0x2c')],'exten':_0x1d6cf5['exten'],'context':_0x1d6cf5[_0xb038('0x4c')]||_0xbd6185['context'],'priority':0x1})[_0xb038('0x1a')](function(_0x218394){_0x572ad4({'code':0xc8,'message':[_0x1d6cf5[_0xb038('0x2b')],_0x218394[_0xb038('0x1b')][_0xb038('0x33')]()][_0xb038('0x13')]('\x20')});})[_0xb038('0x37')](function(_0x137d26){_0x24ea03(_0x4c23b2[_0xb038('0x10')](0x1f5,[_0x1d6cf5['uniqueid'],_0x137d26['message']['toLowerCase']()][_0xb038('0x13')]('\x20')));});}else{return _0x24ea03(_0x4c23b2['error'](0x1f5,_0xb038('0x38')));}});},'Agents':function(_0x5a995c){return new Promise(function(_0x3e036f){var _0x240e88=_[_0xb038('0x26')](_0x3737b5[_0xb038('0xb')]);if(_0x5a995c&&_0x5a995c['id']){var _0x7c8d01=_[_0xb038('0x23')](_0x240e88,function(_0x9440bc){return _0x9440bc['id']===_0x5a995c['id'];});_0x3e036f(_0x7c8d01);}else{_0x3e036f({'count':_0x240e88[_0xb038('0x28')],'rows':_0x240e88});}});},'Telephones':function(){return new Promise(function(_0xf7a0e9){var _0x35d579=_[_0xb038('0x26')](_0x3737b5[_0xb038('0x4d')]);_0xf7a0e9({'count':_0x35d579[_0xb038('0x28')],'rows':_0x35d579});});},'Trunks':function(){return new Promise(function(_0x56d454){var _0x328ced=_[_0xb038('0x26')](_0x3737b5[_0xb038('0x4e')]);_0x56d454({'count':_0x328ced[_0xb038('0x28')],'rows':_0x328ced});});},'OutboundChannels':function(){return new Promise(function(_0x1f9a30){var _0x5d0f38=_[_0xb038('0x26')](_0x3737b5[_0xb038('0x4f')]);_0x1f9a30({'count':_0x5d0f38[_0xb038('0x28')],'rows':_0x5d0f38});});},'Outbound':function(){return new Promise(function(_0x16bb58){_0x16bb58(_0x3737b5[_0xb038('0x42')]);});},'Campaigns':function(){return new Promise(function(_0x5ead21){var _0x375cf6=_[_0xb038('0x26')](_0x3737b5[_0xb038('0x50')]);_0x5ead21({'count':_0x375cf6[_0xb038('0x28')],'rows':_0x375cf6});});},'VoiceQueuesPreview':function(_0x34e222){var _0x468b41=this;return new Promise(function(_0x2acbf6,_0x2d0313){_0x11da3a[_0xb038('0x51')](_0x34e222['id'])['then'](function(_0x52ca15){_0x2acbf6({'code':0xc8,'message':_0x52ca15[_0xb038('0x1b')]});})['catch'](function(_0xafc73d){_0x2d0313(_0x468b41['error'](0x1f4,_0xafc73d['message']));});});},'EventManager':function(_0x4aeb6b){var _0x43c4b7=this;return new Promise(function(_0x463ae6,_0x593f93){if(!_0x4aeb6b[_0xb038('0x52')]){return _0x593f93(_0x43c4b7[_0xb038('0x10')](0x1f4,_0xb038('0x53')));}ami[_0xb038('0x54')](_0xb038('0x55')+_0x4aeb6b[_0xb038('0x52')],_0x4aeb6b[_0xb038('0x1b')]);_0x463ae6({'code':0xc8,'message':_0x4aeb6b});});},'FaxAccounts':function(){return new Promise(function(_0x252733){var _0x20926a=_[_0xb038('0x26')](_0x3737b5['faxAccounts']);_0x252733({'count':_0x20926a[_0xb038('0x28')],'rows':_0x20926a});});},'SendFax':function(_0x272eaf){var _0x183f2f=this;return new Promise(function(_0x258af9,_0xfd78cf){_0x4fe092[_0xb038('0x56')](_0x272eaf)[_0xb038('0x1a')](function(_0x47b0f9){_0x258af9({'code':0xc8,'message':_0x47b0f9[_0xb038('0x1b')]});})[_0xb038('0x37')](function(_0x300b94){_0xfd78cf(_0x183f2f['error'](0x1f4,_0x300b94['message']));});});},'CheckAfterSend':function(_0x2adf3b){var _0x150bb7=this;return new Promise(function(_0x1d5f79,_0x577c1c){_0x4fe092[_0xb038('0x57')](_0x2adf3b)[_0xb038('0x1a')](function(_0x5b003a){_0x1d5f79({'code':0xc8,'message':_0x5b003a[_0xb038('0x1b')]});})[_0xb038('0x37')](function(_0x240d06){_0x577c1c(_0x150bb7[_0xb038('0x10')](0x1f4,_0x240d06[_0xb038('0x1b')]));});});}};var _0x3dc0ba=jayson[_0xb038('0x58')](_0x1b077a)[_0xb038('0x59')]();_0x3dc0ba['on'](_0xb038('0x10'),function(_0x3d077c){return _0x2e3e64(_0x3d077c);});_0x3dc0ba[_0xb038('0x5a')](0x232a,_0xb038('0x5b'),function(){console[_0xb038('0x5c')](_0xb038('0x5d'),0x232a);return _0x54e1e7('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 825c7c1..375ef2e 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 _0x80cd=['../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','getContacts','then','isEmpty','length','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','info','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment'];(function(_0x2e0e3a,_0x20ae64){var _0x58e859=function(_0x5f1401){while(--_0x5f1401){_0x2e0e3a['push'](_0x2e0e3a['shift']());}};_0x58e859(++_0x20ae64);}(_0x80cd,0x146));var _0xd80c=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x80cd[_0x75ce5b];return _0x22195e;};'use strict';var _=require('lodash');var BPromise=require(_0xd80c('0x0'));var Redis=require(_0xd80c('0x1'));var util=require(_0xd80c('0x2'));var config=require(_0xd80c('0x3'));var logger=require(_0xd80c('0x4'))(_0xd80c('0x5'));var cmContactRpc=require(_0xd80c('0x6'));config[_0xd80c('0x7')]=_['defaults'](config[_0xd80c('0x7')],{'host':_0xd80c('0x8'),'port':0x18eb});var io=require(_0xd80c('0x9'))(new Redis(config[_0xd80c('0x7')]));function emit(_0x508e19,_0x343595,_0x20cd74,_0x2dc89b,_0x3aa004){logger['info'](_0xd80c('0xa'),_0x508e19,_0x343595['id'],_0x20cd74,_0x2dc89b,JSON['stringify'](_0x3aa004));io['to'](_0x20cd74)['emit'](_0x2dc89b,_0x3aa004);}exports[_0xd80c('0xb')]=function(_0x511f14,_0x18720f,_0x41a78e,_0x28dce1){var _0x3c4807,_0x2e048b;var _0x380e84={};var _0x14be44;var _0x4ae830=Number(_0x41a78e[_0xd80c('0xc')]);var _0x107c85=_0x41a78e[_0xd80c('0xd')]?Boolean(Number(_0x41a78e[_0xd80c('0xd')])):![];var _0x3a5531;var _0x422969=![];if(!_[_0xd80c('0xe')](_0x41a78e[_0xd80c('0xf')])){if(_0x41a78e[_0xd80c('0xf')]=='1')_0x422969=!![];}if(!_0x422969){if(_0x28dce1['xmd-contactid']){_0x380e84['id']=_0x28dce1[_0xd80c('0x10')];}}if(!_0x380e84['id']){_0x380e84[_0xd80c('0x11')]=_0x4ae830;_0x3a5531=_0x41a78e[_0xd80c('0x12')]&&_0x41a78e[_0xd80c('0x12')]!=='0'?_0x41a78e[_0xd80c('0x12')]['split'](','):[_0xd80c('0x13')];_0x380e84[_0xd80c('0x14')]=_[_0xd80c('0x15')](_0x3a5531,function(_0x233677){var _0xbeab7c={};_0xbeab7c[_0x233677]=_0x28dce1[_0xd80c('0x16')]?_0x28dce1[_0xd80c('0x17')]:_0x28dce1[_0xd80c('0x18')];return _0xbeab7c;});_0x14be44=_0x28dce1['routeId']?_0x28dce1[_0xd80c('0x17')]:_0x28dce1[_0xd80c('0x18')];}var _0x229710=['id',_0xd80c('0x19'),'lastName',_0xd80c('0x13'),_0xd80c('0x1a'),_0xd80c('0x1b'),'ListId',_0xd80c('0x1c'),_0xd80c('0x1d'),'updatedAt'];var _0x31d666=_['union'](_0x229710,_0x3a5531);BPromise['resolve']()['then'](cmContactRpc[_0xd80c('0x1e')]({'attributes':_0x31d666,'where':_0x380e84,'phone':_0x14be44}))[_0xd80c('0x1f')](function(_0x205124){_0x2e048b=_0x205124;if(!_[_0xd80c('0x20')](_0x2e048b)){if(_0x2e048b[_0xd80c('0x21')]===0x1){_0x3c4807=_0x2e048b[0x0];logger['info']('[CM][%s][%s]\x20Contact\x20found:%s',_0x28dce1[_0xd80c('0x22')],_0x18720f['id'],_0x3c4807['id']);}else{logger['info'](_0xd80c('0x23'),_0x28dce1[_0xd80c('0x22')],_0x18720f['id'],_[_0xd80c('0x15')](_0x2e048b,'id')[_0xd80c('0x24')](','));}return;}else{logger['info'](_0xd80c('0x25'),_0x28dce1[_0xd80c('0x22')],_0x18720f['id']);var _0x3bbf75={'ListId':_0x4ae830};var _0xc32df6=_0x41a78e[_0xd80c('0x26')]&&_0x41a78e[_0xd80c('0x26')]!=='0'?_0x41a78e[_0xd80c('0x26')]:_0xd80c('0x13');if(_0x107c85){logger[_0xd80c('0x27')](_0xd80c('0x28'),_0x28dce1[_0xd80c('0x22')],_0x18720f['id']);_0x3bbf75[_0xc32df6]=_[_0xd80c('0xe')](_0x28dce1[_0xd80c('0x16')])?_0x28dce1[_0xd80c('0x18')]:_0x28dce1[_0xd80c('0x17')];if(_['isNil'](_0x28dce1[_0xd80c('0x16')])){_0x3bbf75[_0xd80c('0x19')]=_0x28dce1[_0xd80c('0x29')]&&_0x28dce1[_0xd80c('0x29')]!==_0xd80c('0x2a')?_0x28dce1[_0xd80c('0x29')]:_0xd80c('0x2b');}else{_0x3bbf75['firstName']=_0x28dce1[_0xd80c('0x2c')]&&_0x28dce1[_0xd80c('0x2c')]!==_0xd80c('0x2a')?_0x28dce1[_0xd80c('0x2c')]:'Unknown';}return BPromise[_0xd80c('0x2d')]()['then'](cmContactRpc[_0xd80c('0x2e')](_0x3bbf75))[_0xd80c('0x1f')](function(_0x4e1464){_0x3c4807=_0x4e1464;_0x2e048b[_0xd80c('0x2f')](_0x4e1464);if(_0x3c4807){logger['info'](_0xd80c('0x30'),_0x28dce1[_0xd80c('0x22')],_0x18720f['id'],_0x3c4807['id']);}return;});}else{logger['info'](_0xd80c('0x31'),_0x28dce1[_0xd80c('0x22')],_0x18720f['id']);_0x3bbf75[_0xc32df6]=_[_0xd80c('0xe')](_0x28dce1[_0xd80c('0x16')])?_0x28dce1[_0xd80c('0x18')]:_0x28dce1[_0xd80c('0x17')];if(_[_0xd80c('0xe')](_0x28dce1[_0xd80c('0x16')])){_0x3bbf75['firstName']=_0x28dce1[_0xd80c('0x29')]&&_0x28dce1[_0xd80c('0x29')]!==_0xd80c('0x2a')?_0x28dce1['calleridname']:_0xd80c('0x2b');}else{_0x3bbf75[_0xd80c('0x19')]=_0x28dce1[_0xd80c('0x2c')]&&_0x28dce1['destcalleridname']!==''?_0x28dce1[_0xd80c('0x2c')]:_0xd80c('0x2b');}_0x3c4807=_0x3bbf75;_0x2e048b[_0xd80c('0x2f')](_0x3bbf75);return;}}})[_0xd80c('0x1f')](function(){if(_0x511f14){emit(_0x28dce1['uniqueid'],_0x18720f,util[_0xd80c('0x32')](_0xd80c('0x33'),_0x511f14['name']),util['format']('trigger:%s',_0x41a78e[_0xd80c('0x34')][_0xd80c('0x35')]()),{'evt':_[_0xd80c('0x36')](_0x28dce1,{'autoCreate':_0x107c85}),'contact':_0x3c4807===undefined?{}:_0x3c4807,'contacts':_0x2e048b[_0xd80c('0x21')]===0x0?undefined:_0x2e048b});}});}; \ No newline at end of file +var _0xf990=['fax','ListId','createdAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','Unknown','destcalleridname','','resolve','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/logger','trigger','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','map','routeId','destcalleridnum','calleridnum','firstName','lastName'];(function(_0x5374a7,_0x40cf14){var _0x40b3b0=function(_0x34a575){while(--_0x34a575){_0x5374a7['push'](_0x5374a7['shift']());}};_0x40b3b0(++_0x40cf14);}(_0xf990,0x87));var _0x0f99=function(_0x3f94c0,_0x21c689){_0x3f94c0=_0x3f94c0-0x0;var _0x9e5521=_0xf990[_0x3f94c0];return _0x9e5521;};'use strict';var _=require(_0x0f99('0x0'));var BPromise=require('bluebird');var Redis=require(_0x0f99('0x1'));var util=require(_0x0f99('0x2'));var config=require('../../../../config/environment');var logger=require(_0x0f99('0x3'))(_0x0f99('0x4'));var cmContactRpc=require('../../rpc/cmContact');config[_0x0f99('0x5')]=_[_0x0f99('0x6')](config['redis'],{'host':_0x0f99('0x7'),'port':0x18eb});var io=require(_0x0f99('0x8'))(new Redis(config[_0x0f99('0x5')]));function emit(_0x43c4aa,_0x5581b7,_0x56ac4c,_0x166219,_0x4365a3){logger[_0x0f99('0x9')](_0x0f99('0xa'),_0x43c4aa,_0x5581b7['id'],_0x56ac4c,_0x166219,JSON['stringify'](_0x4365a3));io['to'](_0x56ac4c)[_0x0f99('0xb')](_0x166219,_0x4365a3);}exports[_0x0f99('0xc')]=function(_0x1dae9f,_0x32a489,_0x56b042,_0x8dad18){var _0x1288f8,_0x31c4e8;var _0x1d570f={};var _0x5e804f;var _0x4b8ab7=Number(_0x56b042[_0x0f99('0xd')]);var _0x10c6ba=_0x56b042[_0x0f99('0xe')]?Boolean(Number(_0x56b042[_0x0f99('0xe')])):![];var _0x422cbe;var _0x35681f=![];if(!_[_0x0f99('0xf')](_0x56b042[_0x0f99('0x10')])){if(_0x56b042['data5']=='1')_0x35681f=!![];}if(!_0x35681f){if(_0x8dad18[_0x0f99('0x11')]){_0x1d570f['id']=_0x8dad18['xmd-contactid'];}}if(!_0x1d570f['id']){_0x1d570f['ListId']=_0x4b8ab7;_0x422cbe=_0x56b042[_0x0f99('0x12')]&&_0x56b042[_0x0f99('0x12')]!=='0'?_0x56b042[_0x0f99('0x12')][_0x0f99('0x13')](','):[_0x0f99('0x14')];_0x1d570f['$or']=_[_0x0f99('0x15')](_0x422cbe,function(_0x398a4c){var _0x5922f6={};_0x5922f6[_0x398a4c]=_0x8dad18[_0x0f99('0x16')]?_0x8dad18[_0x0f99('0x17')]:_0x8dad18[_0x0f99('0x18')];return _0x5922f6;});_0x5e804f=_0x8dad18[_0x0f99('0x16')]?_0x8dad18[_0x0f99('0x17')]:_0x8dad18[_0x0f99('0x18')];}var _0xb0c591=['id',_0x0f99('0x19'),_0x0f99('0x1a'),_0x0f99('0x14'),'mobile',_0x0f99('0x1b'),_0x0f99('0x1c'),_0x0f99('0x1d'),'scheduledAt','updatedAt'];var _0x62ae7a=_[_0x0f99('0x1e')](_0xb0c591,_0x422cbe);BPromise['resolve']()[_0x0f99('0x1f')](cmContactRpc[_0x0f99('0x20')]({'attributes':_0x62ae7a,'where':_0x1d570f,'phone':_0x5e804f}))[_0x0f99('0x1f')](function(_0x5b92de){_0x31c4e8=_0x5b92de;if(!_[_0x0f99('0x21')](_0x31c4e8)){if(_0x31c4e8[_0x0f99('0x22')]===0x1){_0x1288f8=_0x31c4e8[0x0];logger[_0x0f99('0x9')](_0x0f99('0x23'),_0x8dad18[_0x0f99('0x24')],_0x32a489['id'],_0x1288f8['id']);}else{logger[_0x0f99('0x9')](_0x0f99('0x25'),_0x8dad18[_0x0f99('0x24')],_0x32a489['id'],_['map'](_0x31c4e8,'id')[_0x0f99('0x26')](','));}return;}else{logger[_0x0f99('0x9')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x8dad18[_0x0f99('0x24')],_0x32a489['id']);var _0x4eef5b={'ListId':_0x4b8ab7};var _0x4695ec=_0x56b042[_0x0f99('0x27')]&&_0x56b042['data4']!=='0'?_0x56b042['data4']:_0x0f99('0x14');if(_0x10c6ba){logger[_0x0f99('0x9')](_0x0f99('0x28'),_0x8dad18[_0x0f99('0x24')],_0x32a489['id']);_0x4eef5b[_0x4695ec]=_['isNil'](_0x8dad18[_0x0f99('0x16')])?_0x8dad18[_0x0f99('0x18')]:_0x8dad18[_0x0f99('0x17')];if(_['isNil'](_0x8dad18[_0x0f99('0x16')])){_0x4eef5b['firstName']=_0x8dad18['calleridname']&&_0x8dad18[_0x0f99('0x29')]!==''?_0x8dad18['calleridname']:_0x0f99('0x2a');}else{_0x4eef5b[_0x0f99('0x19')]=_0x8dad18['destcalleridname']&&_0x8dad18[_0x0f99('0x2b')]!==_0x0f99('0x2c')?_0x8dad18[_0x0f99('0x2b')]:_0x0f99('0x2a');}return BPromise[_0x0f99('0x2d')]()[_0x0f99('0x1f')](cmContactRpc['createContact'](_0x4eef5b))['then'](function(_0x4465df){_0x1288f8=_0x4465df;_0x31c4e8[_0x0f99('0x2e')](_0x4465df);if(_0x1288f8){logger[_0x0f99('0x9')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x8dad18[_0x0f99('0x24')],_0x32a489['id'],_0x1288f8['id']);}return;});}else{logger[_0x0f99('0x9')](_0x0f99('0x2f'),_0x8dad18[_0x0f99('0x24')],_0x32a489['id']);_0x4eef5b[_0x4695ec]=_[_0x0f99('0xf')](_0x8dad18[_0x0f99('0x16')])?_0x8dad18[_0x0f99('0x18')]:_0x8dad18[_0x0f99('0x17')];if(_[_0x0f99('0xf')](_0x8dad18[_0x0f99('0x16')])){_0x4eef5b[_0x0f99('0x19')]=_0x8dad18[_0x0f99('0x29')]&&_0x8dad18[_0x0f99('0x29')]!==_0x0f99('0x2c')?_0x8dad18[_0x0f99('0x29')]:'Unknown';}else{_0x4eef5b[_0x0f99('0x19')]=_0x8dad18[_0x0f99('0x2b')]&&_0x8dad18[_0x0f99('0x2b')]!==_0x0f99('0x2c')?_0x8dad18[_0x0f99('0x2b')]:_0x0f99('0x2a');}_0x1288f8=_0x4eef5b;_0x31c4e8[_0x0f99('0x2e')](_0x4eef5b);return;}}})[_0x0f99('0x1f')](function(){if(_0x1dae9f){emit(_0x8dad18[_0x0f99('0x24')],_0x32a489,util[_0x0f99('0x30')](_0x0f99('0x31'),_0x1dae9f[_0x0f99('0x32')]),util[_0x0f99('0x30')]('trigger:%s',_0x56b042[_0x0f99('0x33')][_0x0f99('0x34')]()),{'evt':_[_0x0f99('0x35')](_0x8dad18,{'autoCreate':_0x10c6ba}),'contact':_0x1288f8===undefined?{}:_0x1288f8,'contacts':_0x31c4e8['length']===0x0?undefined:_0x31c4e8});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index b214b7b..8c8b8b2 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 _0x6a83=['data6','winApplication','winArguments','format','user:%s','name','action','trigger:%s','exec','integration','queue','routeId','urlforward','script','buildUri','parse','query','replace','channel','AllConditions','checkConditions','checkTrigger:\x20trigger','evt','field','account','operator','value','ChatWebsiteId','upperFirst','AccountId','event','agent','membername','lastevent','mailSubstatus','substatus','created','equals','exports','util','lodash','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','defaults','redis','localhost','socket.io-emitter','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','syncCustomEvent','custom:agentconnect','custom:agentcomplete','bind','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','uri','isNil','data3','data4','location','windowWidth','data5','800','windowHeight'];(function(_0x7bd68f,_0x35456d){var _0x98a43b=function(_0x908f24){while(--_0x908f24){_0x7bd68f['push'](_0x7bd68f['shift']());}};_0x98a43b(++_0x35456d);}(_0x6a83,0x1a4));var _0x36a8=function(_0x491e8d,_0x5ec2cc){_0x491e8d=_0x491e8d-0x0;var _0x3a4e1a=_0x6a83[_0x491e8d];return _0x3a4e1a;};'use strict';var util=require(_0x36a8('0x0'));var _=require(_0x36a8('0x1'));var url=require('url');var Mustache=require(_0x36a8('0x2'));var Redis=require(_0x36a8('0x3'));var urlforward=require(_0x36a8('0x4'));var integration=require('./integration');var cmContact=require(_0x36a8('0x5'));var script=require(_0x36a8('0x6'));var config=require(_0x36a8('0x7'));var logger=require(_0x36a8('0x8'))(_0x36a8('0x9'));var ami=require(_0x36a8('0xa'));config['redis']=_[_0x36a8('0xb')](config[_0x36a8('0xc')],{'host':_0x36a8('0xd'),'port':0x18eb});var io=require(_0x36a8('0xe'))(new Redis(config['redis']));var operators={'equals':function(_0x5eb30e,_0x4f085a){return _0x5eb30e==_0x4f085a;},'not_equals':function(_0x501f50,_0x2f7d8e){return _0x501f50!=_0x2f7d8e;}};var barAndWebActions=['popup',_0x36a8('0xf'),_0x36a8('0x10')];function Trigger(_0x29dd50){this['triggers']=_0x29dd50[_0x36a8('0x11')];this[_0x36a8('0x12')]=_0x29dd50['agents'];this['voiceQueues']=_0x29dd50[_0x36a8('0x13')];this[_0x36a8('0x14')]=_0x29dd50[_0x36a8('0x14')];this['voiceExtensions']=_0x29dd50[_0x36a8('0x15')];this[_0x36a8('0x16')]=_0x29dd50['zendeskAccounts'];this[_0x36a8('0x17')]=_0x29dd50['freshdeskAccounts'];this['salesforceAccounts']=_0x29dd50[_0x36a8('0x18')];this[_0x36a8('0x19')]=_0x29dd50[_0x36a8('0x19')];this['zohoAccounts']=_0x29dd50[_0x36a8('0x1a')];this[_0x36a8('0x1b')]=_0x29dd50[_0x36a8('0x1b')];this[_0x36a8('0x1c')]=_0x29dd50[_0x36a8('0x1c')];this[_0x36a8('0x1d')]=_0x29dd50[_0x36a8('0x1d')];this[_0x36a8('0x1e')]=_0x29dd50[_0x36a8('0x1e')];this[_0x36a8('0x1f')]=_0x29dd50[_0x36a8('0x1f')];this['accounts']={'zendesk':this[_0x36a8('0x16')],'salesforce':this['salesforceAccounts'],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x36a8('0x19')],'zoho':this[_0x36a8('0x1a')],'desk':this[_0x36a8('0x1b')],'vtiger':this[_0x36a8('0x1c')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x36a8('0x1f')],'servicenow':this[_0x36a8('0x1d')]};ami['on']('custom:agentcalled',this[_0x36a8('0x20')]['bind'](this));ami['on'](_0x36a8('0x21'),this[_0x36a8('0x20')]['bind'](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent']['bind'](this));ami['on'](_0x36a8('0x22'),this[_0x36a8('0x20')]['bind'](this));ami['on']('custom:agentnosuchnumber',this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x24'),this['syncCustomEvent'][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x25'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x26'),this[_0x36a8('0x20')]['bind'](this));ami['on'](_0x36a8('0x27'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x28'),this['syncCustomEvent'][_0x36a8('0x23')](this));ami['on']('custom:queuecallerabandon',this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x29'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x2a'),this[_0x36a8('0x2b')][_0x36a8('0x23')](this));ami['on']('custom:dialconnect',this[_0x36a8('0x2b')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x2c'),this[_0x36a8('0x2b')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x2d'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x2e'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x2f'),this[_0x36a8('0x20')]['bind'](this));ami['on'](_0x36a8('0x30'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on'](_0x36a8('0x31'),this[_0x36a8('0x20')]['bind'](this));ami['on'](_0x36a8('0x32'),this[_0x36a8('0x20')][_0x36a8('0x23')](this));ami['on']('custom:rejectmessage',this[_0x36a8('0x20')]['bind'](this));ami['on']('custom:offlineMessage',this[_0x36a8('0x20')][_0x36a8('0x23')](this));}Trigger[_0x36a8('0x33')]['emit']=function(_0x1c593e,_0x167eef,_0x155e46){logger[_0x36a8('0x34')](_0x1c593e,_0x167eef,JSON[_0x36a8('0x35')](_0x155e46));io['to'](_0x1c593e)[_0x36a8('0x36')](_0x167eef,_0x155e46);};Trigger[_0x36a8('0x33')][_0x36a8('0x20')]=function(_0x521e77){var _0x4cf1ec=_[_0x36a8('0x37')](_0x521e77);if(typeof _0x4cf1ec[_0x36a8('0x38')]===_0x36a8('0x39')){_0x4cf1ec[_0x36a8('0x38')]=_0x36a8('0x3a');}logger[_0x36a8('0x3b')](_0x36a8('0x20'),util[_0x36a8('0x3c')](_0x4cf1ec,{'showHidden':!![],'depth':null}));this[_0x36a8('0x3d')](_0x4cf1ec);};Trigger[_0x36a8('0x33')][_0x36a8('0x2b')]=function(_0x3ff3b6){if(this[_0x36a8('0x12')][_0x3ff3b6[_0x36a8('0x3e')]]){this[_0x36a8('0x20')](_0x3ff3b6);}};Trigger[_0x36a8('0x33')][_0x36a8('0x3d')]=function(_0x436b77){var _0xda1d07;for(var _0x8c5948 in this[_0x36a8('0x11')]){if(this[_0x36a8('0x11')][_0x36a8('0x3f')](_0x8c5948)){if(this[_0x36a8('0x11')][_0x8c5948][_0x36a8('0x40')]){_0xda1d07=this[_0x36a8('0x41')](this[_0x36a8('0x11')][_0x8c5948],_0x436b77);if(_0xda1d07){_[_0x36a8('0x42')](_0x436b77,_0x436b77[_0x36a8('0x43')]);for(var _0x143188=0x0,_0x3cf11d,_0x304dfd,_0x46cff4;_0x1431880x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x5988ef,_0x4e215a){var _0x481c07=function(_0x3151e4){while(--_0x3151e4){_0x5988ef['push'](_0x5988ef['shift']());}};_0x481c07(++_0x4e215a);}(_0x3e74,0x175));var _0x43e7=function(_0x2234d9,_0x446da6){_0x2234d9=_0x2234d9-0x0;var _0x5f5bd2=_0x3e74[_0x2234d9];return _0x5f5bd2;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index d3c5395..7620eb6 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 _0x7b4c=['userEmail','internalemailaddress','userId','toLowerCase','contacts','substring','lastIndexOf','enduserId','outbound','calleridnum','telephone1','GET','&$filter=','\x20eq\x20\x27','replace','%2b','value','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','idField','indexOf','content','ticketType','incidents','assign','getString','/contacts(','/systemusers(','Fields','Bearer\x20','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','odata-entityid','format','emit','trigger:browser:url','stripTrailingSlash','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','Error\x20running\x20Dynamics365\x20integration','request-promise','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','resolve','data5','POST','clientId','username','password','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','4.0','validateEmail','email','length','isdisabled','info','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!'];(function(_0x5f0fec,_0x62015d){var _0x40f104=function(_0x32c924){while(--_0x32c924){_0x5f0fec['push'](_0x5f0fec['shift']());}};_0x40f104(++_0x62015d);}(_0x7b4c,0xaf));var _0xc7b4=function(_0x42f28c,_0x28c28d){_0x42f28c=_0x42f28c-0x0;var _0x3efbc6=_0x7b4c[_0x42f28c];return _0x3efbc6;};'use strict';var _=require('lodash');var rp=require(_0xc7b4('0x0'));var util=require('util');var intUtil=require(_0xc7b4('0x1'));var md5=require(_0xc7b4('0x2'));var Redis=require(_0xc7b4('0x3'));var logger=require(_0xc7b4('0x4'))(_0xc7b4('0x5'));var config=require(_0xc7b4('0x6'));config['redis']=_['defaults'](config[_0xc7b4('0x7')],{'host':_0xc7b4('0x8'),'port':0x18eb});var io=require(_0xc7b4('0x9'))(new Redis(config['redis']));function getAuthToken(_0x17aaa3,_0x578fe6,_0x4d2d2d){if(_0x17aaa3[_0xc7b4('0xa')]){_0x17aaa3[_0xc7b4('0xb')]=_0x17aaa3[_0xc7b4('0xc')][_0xc7b4('0xd')];_0x17aaa3['tenantId']=_0x17aaa3['CloudProvider']['data2'];return Promise[_0xc7b4('0xe')](_0x17aaa3[_0xc7b4('0xc')][_0xc7b4('0xf')]);}var _0xf3a20c={'method':_0xc7b4('0x10'),'uri':_0x578fe6,'form':{'client_id':_0x17aaa3[_0xc7b4('0x11')],'resource':_0x17aaa3[_0xc7b4('0xb')],'username':_0x17aaa3[_0xc7b4('0x12')],'password':_0x17aaa3[_0xc7b4('0x13')],'grant_type':'password','client_secret':_0x17aaa3['clientSecret']},'json':!![]};return rp(_0xf3a20c)[_0xc7b4('0x14')](function(_0x45631a){return _0x45631a[_0xc7b4('0x15')];})[_0xc7b4('0x16')](function(_0x2ae4f2){logger[_0xc7b4('0x17')]('['+[_0x4d2d2d[_0xc7b4('0x18')]()]+_0xc7b4('0x19'));return _0x2ae4f2[_0xc7b4('0x1a')];});}function getUser(_0x44c700,_0x589bde,_0x361d64,_0x2940c1,_0x5206b4,_0x386e0d){return new Promise(function(_0xaf56cc,_0x5006f9){return getAuthToken(_0x589bde,_0x2940c1,_0x386e0d)[_0xc7b4('0x14')](function(_0x1067c8){var _0x504296={'method':'GET','uri':_0x5206b4+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x1067c8,'OData-Version':_0xc7b4('0x1b')},'json':!![]};return rp(_0x504296);})['then'](function(_0x2c9c71){var _0x1f1228=_0x2c9c71['value'];var _0x2646e7=![];var _0x98dc11=null;if(!_['isNil'](_0x361d64)){if(intUtil[_0xc7b4('0x1c')](_0x361d64[_0xc7b4('0x1d')])){_0x44c700['userEmail']=_0x361d64[_0xc7b4('0x1d')];for(_0x98dc11=0x0;_0x98dc11<_0x1f1228[_0xc7b4('0x1e')];_0x98dc11++){if(_0x1f1228[_0x98dc11]['internalemailaddress']===_0x361d64[_0xc7b4('0x1d')]&&!_0x1f1228[_0x98dc11][_0xc7b4('0x1f')]){_0x2646e7=!![];logger[_0xc7b4('0x20')]('['+[_0x386e0d[_0xc7b4('0x18')]()]+']\x20Agent\x20found\x20'+_0x1f1228[_0x98dc11][_0xc7b4('0x21')]+'!');_0x44c700['userId']=_0x1f1228[_0x98dc11][_0xc7b4('0x21')];}}}}if(!_0x2646e7){logger['info']('['+[_0x386e0d[_0xc7b4('0x18')]()]+_0xc7b4('0x22'));_0x44c700[_0xc7b4('0x23')]=_0x589bde[_0xc7b4('0x12')];for(_0x98dc11=0x0;_0x98dc11<_0x1f1228[_0xc7b4('0x1e')];_0x98dc11++){if(_0x1f1228[_0x98dc11][_0xc7b4('0x24')]===_0x589bde[_0xc7b4('0x12')]){_0x44c700[_0xc7b4('0x25')]=_0x1f1228[_0x98dc11][_0xc7b4('0x21')];}}}_0xaf56cc(_0x44c700);})[_0xc7b4('0x16')](function(_0x3f57e8){_0x5006f9(_0x3f57e8[_0xc7b4('0x1a')]);});});}function createEndUser(_0x4b9c80,_0x9bc7af,_0x12939e,_0x531dfb,_0x5ef3d8,_0x2eec0b,_0x4498e5){return new Promise(function(_0x907f4b,_0x55bffc){return getAuthToken(_0x9bc7af,_0x12939e,_0x2eec0b)[_0xc7b4('0x14')](function(_0x1636f2){var _0x44fd9b=_0x2eec0b[_0xc7b4('0x26')]()==='outbound'?_0x5ef3d8['destcalleridnum']:_0x5ef3d8['calleridnum'];var _0x2f05be={'method':_0xc7b4('0x10'),'uri':_0x531dfb+_0xc7b4('0x27'),'body':{'fullname':_0x44fd9b,'firstname':_0x44fd9b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x4b9c80[_0xc7b4('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x1636f2,'OData-Version':_0xc7b4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};_0x2f05be['body'][_0x4498e5]=_0x44fd9b;return rp(_0x2f05be);})['then'](function(_0x47fd00){var _0x3edc99=_0x47fd00['headers']['odata-entityid'];var _0x4105b2=_0x3edc99[_0xc7b4('0x28')](_0x3edc99[_0xc7b4('0x29')]('(')+0x1,_0x3edc99[_0xc7b4('0x29')](')'));_0x4b9c80[_0xc7b4('0x2a')]=_0x4105b2;_0x907f4b(_0x4b9c80);})['catch'](function(_0x3fb7f7){_0x55bffc(_0x3fb7f7[_0xc7b4('0x1a')]);});});}function getEndUser(_0x42f96b,_0x14724d,_0x344818,_0x586640,_0x259a4e,_0x3574c,_0x4977d5,_0x4e4236){var _0x4e417f=_0x3574c['toLowerCase']()===_0xc7b4('0x2b')?_0x259a4e['destcalleridnum']:_0x259a4e[_0xc7b4('0x2c')];return getAuthToken(_0x14724d,_0x344818,_0x3574c)['then'](function(_0x9820cd){_0x4e4236=_0x4e4236?_0x4e4236:_0xc7b4('0x2d');var _0x2efd74={'method':_0xc7b4('0x2e'),'uri':_0x586640+'contacts?$select='+_0x4e4236+_0xc7b4('0x2f')+_0x4e4236+_0xc7b4('0x30')+_0x4e417f[_0xc7b4('0x31')]('+',_0xc7b4('0x32'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x9820cd,'If-None-Match':null,'OData-Version':_0xc7b4('0x1b')},'json':!![]};return rp(_0x2efd74);})[_0xc7b4('0x14')](function(_0x469251){var _0x22f1d1=![];if(!_0x469251)return _0x22f1d1;var _0x54a41e=_0x469251[_0xc7b4('0x33')];for(var _0x359af7=0x0;_0x359af7<_0x54a41e[_0xc7b4('0x1e')];_0x359af7++){if(_0x54a41e[_0x359af7][_0x4e4236]===_0x4e417f){_0x22f1d1=!![];_0x42f96b[_0xc7b4('0x2a')]=_0x54a41e[_0x359af7][_0xc7b4('0x34')];}}return _0x22f1d1;})['then'](function(_0x8a111a){if(_0x8a111a)return _0x42f96b;if(_0x4977d5===_0xc7b4('0x35')){logger[_0xc7b4('0x20')]('['+[_0x3574c[_0xc7b4('0x18')]()]+_0xc7b4('0x36'));return _0x42f96b;}return createEndUser(_0x42f96b,_0x14724d,_0x344818,_0x586640,_0x259a4e,_0x3574c,_0x4e4236)[_0xc7b4('0x14')](function(_0x119ab9){logger[_0xc7b4('0x20')]('['+[_0x3574c[_0xc7b4('0x18')]()]+_0xc7b4('0x37'),_0x119ab9[_0xc7b4('0x2a')]);return _0x119ab9;});});}function getCustomFields(_0x59a0c0,_0x38c45d,_0x5e5745){var _0x59b444={};if(_0x59a0c0['length']>0x0){_[_0xc7b4('0x38')](_0x59a0c0,function(_0x235b46){if(_[_0xc7b4('0x39')](['string',_0xc7b4('0x3a')],_0x235b46[_0xc7b4('0x3b')])&&_0x235b46[_0xc7b4('0x3c')]&&!_0x235b46['customField']){var _0x345982=_0x235b46[_0xc7b4('0x3d')][_0xc7b4('0x26')]();var _0x1bd151=_0x345982[_0xc7b4('0x28')](0x0,_0x345982[_0xc7b4('0x3e')]('_'));var _0x2c5e1a=_0x345982[_0xc7b4('0x28')](_0x345982[_0xc7b4('0x3e')]('_')+0x1);if(_0x1bd151===_0x5e5745){_0x59b444[_0x2c5e1a]=_0x235b46[_0xc7b4('0x3f')];}}});}return _0x59b444;}function getTicket(_0x618cbe,_0x281d6a,_0x469d74,_0x4200b2,_0x395504,_0x3c9266,_0xed7cd5){return new Promise(function(_0x3888a3,_0x5d6362){var _0xdedd8b;return getAuthToken(_0x281d6a,_0x469d74,_0xed7cd5)[_0xc7b4('0x14')](function(_0x396a2f){if(_0x3c9266[_0xc7b4('0x40')]==='incident'){_0xdedd8b={'method':_0xc7b4('0x10'),'uri':_0x4200b2+_0xc7b4('0x41'),'body':Object[_0xc7b4('0x42')]({},{'title':intUtil['getString'](_0x3c9266['Subjects'],_0x395504,'\x20'),'description':intUtil[_0xc7b4('0x43')](_0x3c9266['Descriptions'],_0x395504,'\x0a'),'customerid_contact@odata.bind':_0x618cbe[_0xc7b4('0x2a')]?_0xc7b4('0x44')+_0x618cbe[_0xc7b4('0x2a')]+')':undefined,'ownerid@odata.bind':_0xc7b4('0x45')+_0x618cbe[_0xc7b4('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x3c9266[_0xc7b4('0x46')],_0x395504,_0x3c9266['ticketType'])),'headers':{'Authorization':_0xc7b4('0x47')+_0x396a2f,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x3c9266[_0xc7b4('0x40')]===_0xc7b4('0x48')){var _0x417624=_0x618cbe[_0xc7b4('0x2a')]?[{'partyid_systemuser@odata.bind':_0xc7b4('0x45')+_0x618cbe[_0xc7b4('0x25')]+')','participationtypemask':_0x618cbe[_0xc7b4('0x49')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xc7b4('0x44')+_0x618cbe[_0xc7b4('0x2a')]+')','participationtypemask':_0x618cbe[_0xc7b4('0x49')]===_0xc7b4('0x4a')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xc7b4('0x45')+_0x618cbe[_0xc7b4('0x25')]+')','participationtypemask':_0x618cbe[_0xc7b4('0x49')]==='queue'?0x2:0x1}];_0xdedd8b={'method':_0xc7b4('0x10'),'uri':_0x4200b2+_0xc7b4('0x4b'),'body':Object['assign']({},{'subject':intUtil[_0xc7b4('0x43')](_0x3c9266[_0xc7b4('0x4c')],_0x395504,'\x20'),'phonenumber':String(_0x395504[_0xc7b4('0x2c')]),'description':intUtil[_0xc7b4('0x43')](_0x3c9266[_0xc7b4('0x4d')],_0x395504,'\x0a'),'regardingobjectid_contact@odata.bind':_0x618cbe[_0xc7b4('0x2a')]?'/contacts('+_0x618cbe[_0xc7b4('0x2a')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x618cbe[_0xc7b4('0x25')]+')','directioncode':_0x618cbe[_0xc7b4('0x49')]==='queue'?![]:!![],'phonecall_activity_parties':_0x417624},getCustomFields(_0x3c9266[_0xc7b4('0x46')],_0x395504,_0x3c9266[_0xc7b4('0x40')])),'headers':{'Authorization':_0xc7b4('0x47')+_0x396a2f,'OData-Version':_0xc7b4('0x1b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xdedd8b);})[_0xc7b4('0x14')](function(_0x25f5e1){var _0x28a041=_0x25f5e1['headers'][_0xc7b4('0x4e')];var _0x2b64ad=_0x28a041[_0xc7b4('0x28')](_0x28a041[_0xc7b4('0x29')]('(')+0x1,_0x28a041[_0xc7b4('0x29')](')'));_0x618cbe['ticketId']=_0x2b64ad;_0x3888a3(_0x618cbe);})['catch'](function(_0xc02807){_0x5d6362(_0xc02807['message']);});});}function emit(_0x10a079,_0x19381c,_0x8e9018,_0x261106){var _0x3aef8e={'uri':util['format']('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x10a079,_0x8e9018,_0x261106)};io['to'](util[_0xc7b4('0x4f')]('user:%s',_0x19381c))[_0xc7b4('0x50')](_0xc7b4('0x51'),_0x3aef8e);}exports['cs']=function(_0x5b7d22,_0x4dfb9c,_0x3eb905,_0x12e8f5,_0x43d904,_0xaf6f52,_0x17c44f,_0x3a9e31){var _0x56e2b0={};_0xaf6f52[_0xc7b4('0xb')]=_0xaf6f52['modernAuthentication']?intUtil[_0xc7b4('0x52')](_0xaf6f52[_0xc7b4('0xc')][_0xc7b4('0xd')]):intUtil[_0xc7b4('0x52')](_0xaf6f52[_0xc7b4('0xb')]);_0xaf6f52['serverUrl']=intUtil['stripTrailingSlash'](_0xaf6f52['serverUrl']);_0x56e2b0[_0xc7b4('0x49')]=_0x3a9e31===_0xc7b4('0x4a')||_0x3a9e31===_0xc7b4('0x53')?_0xc7b4('0x4a'):'outbound';var _0x4eda82=_0xaf6f52[_0xc7b4('0xa')]?util[_0xc7b4('0x4f')]('%s/api/data/v9.0/',_0xaf6f52[_0xc7b4('0xc')][_0xc7b4('0xd')]):util['format']('%s/api/data/v9.0/',_0xaf6f52[_0xc7b4('0xb')]);var _0x3cb8c3=util[_0xc7b4('0x4f')](_0xc7b4('0x54'),_0xaf6f52['tenantId']);var _0x5bdd78=util['format'](_0xc7b4('0x55'),_0xaf6f52[_0xc7b4('0x56')],_0x4dfb9c[_0xc7b4('0x57')],md5(_0x4dfb9c[_0xc7b4('0x57')]));if(_0x43d904&&_0x43d904[_0xc7b4('0x58')]){logger['info']('[QUEUE]',_0xc7b4('0x59'));_0x4dfb9c['recordingURL']=_0x5bdd78;}else if(_0x17c44f&&_0x17c44f[_0xc7b4('0x5a')]&&_0x17c44f[_0xc7b4('0x5a')]!==_0xc7b4('0x5b')){logger[_0xc7b4('0x20')](_0xc7b4('0x5c'),_0xc7b4('0x59'));_0x4dfb9c[_0xc7b4('0x5d')]=_0x5bdd78;}else{_0x4dfb9c[_0xc7b4('0x5d')]='';}return getUser(_0x56e2b0,_0xaf6f52,_0x12e8f5,_0x3cb8c3,_0x4eda82,_0x3a9e31)[_0xc7b4('0x14')](function(_0x2f334d){logger[_0xc7b4('0x20')]('['+_0x3a9e31[_0xc7b4('0x18')]()+_0xc7b4('0x5e'),_0x2f334d['userId']);logger['info']('['+_0x3a9e31[_0xc7b4('0x18')]()+']\x20The\x20User\x20email\x20is:',_0x2f334d[_0xc7b4('0x23')]);return getEndUser(_0x2f334d,_0xaf6f52,_0x3cb8c3,_0x4eda82,_0x4dfb9c,_0x3a9e31,_0x3eb905[_0xc7b4('0x5f')],_0x3eb905[_0xc7b4('0x60')]);})[_0xc7b4('0x14')](function(_0x4a65b9){logger[_0xc7b4('0x20')]('['+_0x3a9e31['toUpperCase']()+_0xc7b4('0x61'),_0x4a65b9[_0xc7b4('0x2a')]);logger['info']('['+_0x3a9e31[_0xc7b4('0x18')]()+_0xc7b4('0x62'),_0x4dfb9c[_0xc7b4('0x2c')]);return getTicket(_0x4a65b9,_0xaf6f52,_0x3cb8c3,_0x4eda82,_0x4dfb9c,_0x3eb905,_0x3a9e31);})[_0xc7b4('0x14')](function(_0x1db5cb){logger['info'](util['format']('['+_0x3a9e31[_0xc7b4('0x18')]()+_0xc7b4('0x63'),_0x3eb905[_0xc7b4('0x40')],_0x1db5cb[_0xc7b4('0x64')]));logger[_0xc7b4('0x20')](util['format']('['+_0x3a9e31[_0xc7b4('0x18')]()+']\x20Call\x20direction:\x20%s',_0x3a9e31));if(_0x3a9e31!==_0xc7b4('0x53')&&_0x3eb905[_0xc7b4('0x65')]){logger['info']('['+_0x3a9e31[_0xc7b4('0x18')]()+']',_0xc7b4('0x66'));emit(_0xaf6f52[_0xc7b4('0xb')],_0x12e8f5[_0xc7b4('0x67')],_0x3eb905['ticketType'],_0x1db5cb[_0xc7b4('0x64')]);}})[_0xc7b4('0x16')](function(_0x387d3e){logger[_0xc7b4('0x17')]('['+_0x3a9e31[_0xc7b4('0x18')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x387d3e['message']);console[_0xc7b4('0x17')](_0xc7b4('0x68'),_0x387d3e);});}; \ No newline at end of file +var _0x313d=['username','password','clientSecret','then','access_token','catch',']\x20Wrong\x20credentials!','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','isdisabled','info','toUpperCase','systemuserid','userId','internalemailaddress','message','outbound','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','toLowerCase','telephone1','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','%2b','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','string','picklist','type','nameField','customField','idField','indexOf','incident','incidents','assign','getString','Descriptions','enduserId','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Subjects','ticketId','format','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','monitor_format','Recording\x20is\x20enabled!','recordingURL','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','lodash','util','./util','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','POST'];(function(_0x3c2988,_0x4f9e12){var _0x435758=function(_0x2d23df){while(--_0x2d23df){_0x3c2988['push'](_0x3c2988['shift']());}};_0x435758(++_0x4f9e12);}(_0x313d,0x12b));var _0xd313=function(_0x34ca3a,_0x5e4558){_0x34ca3a=_0x34ca3a-0x0;var _0x23b8ad=_0x313d[_0x34ca3a];return _0x23b8ad;};'use strict';var _=require(_0xd313('0x0'));var rp=require('request-promise');var util=require(_0xd313('0x1'));var intUtil=require(_0xd313('0x2'));var md5=require('md5');var Redis=require(_0xd313('0x3'));var logger=require(_0xd313('0x4'))(_0xd313('0x5'));var config=require('../../../../config/environment');config[_0xd313('0x6')]=_[_0xd313('0x7')](config[_0xd313('0x6')],{'host':_0xd313('0x8'),'port':0x18eb});var io=require(_0xd313('0x9'))(new Redis(config[_0xd313('0x6')]));function getAuthToken(_0x352978,_0x23aad8,_0x229c16){if(_0x352978[_0xd313('0xa')]){_0x352978[_0xd313('0xb')]=_0x352978['CloudProvider'][_0xd313('0xc')];_0x352978[_0xd313('0xd')]=_0x352978[_0xd313('0xe')][_0xd313('0xf')];return Promise[_0xd313('0x10')](_0x352978[_0xd313('0xe')][_0xd313('0x11')]);}var _0x5e4f43={'method':_0xd313('0x12'),'uri':_0x23aad8,'form':{'client_id':_0x352978['clientId'],'resource':_0x352978[_0xd313('0xb')],'username':_0x352978[_0xd313('0x13')],'password':_0x352978[_0xd313('0x14')],'grant_type':'password','client_secret':_0x352978[_0xd313('0x15')]},'json':!![]};return rp(_0x5e4f43)[_0xd313('0x16')](function(_0x81549){return _0x81549[_0xd313('0x17')];})[_0xd313('0x18')](function(_0x5c13f0){logger['error']('['+[_0x229c16['toUpperCase']()]+_0xd313('0x19'));return _0x5c13f0['message'];});}function getUser(_0x3774c3,_0x3b5922,_0x4ae530,_0x5b323d,_0x166ea0,_0x5629e4){return new Promise(function(_0x37b237,_0x11a30f){return getAuthToken(_0x3b5922,_0x5b323d,_0x5629e4)[_0xd313('0x16')](function(_0x253205){var _0x497a98={'method':_0xd313('0x1a'),'uri':_0x166ea0+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xd313('0x1b')+_0x253205,'OData-Version':_0xd313('0x1c')},'json':!![]};return rp(_0x497a98);})[_0xd313('0x16')](function(_0x398664){var _0x58c56c=_0x398664[_0xd313('0x1d')];var _0x9a32d4=![];var _0x27174f=null;if(!_[_0xd313('0x1e')](_0x4ae530)){if(intUtil[_0xd313('0x1f')](_0x4ae530[_0xd313('0x20')])){_0x3774c3[_0xd313('0x21')]=_0x4ae530[_0xd313('0x20')];for(_0x27174f=0x0;_0x27174f<_0x58c56c[_0xd313('0x22')];_0x27174f++){if(_0x58c56c[_0x27174f]['internalemailaddress']===_0x4ae530[_0xd313('0x20')]&&!_0x58c56c[_0x27174f][_0xd313('0x23')]){_0x9a32d4=!![];logger[_0xd313('0x24')]('['+[_0x5629e4[_0xd313('0x25')]()]+']\x20Agent\x20found\x20'+_0x58c56c[_0x27174f][_0xd313('0x26')]+'!');_0x3774c3[_0xd313('0x27')]=_0x58c56c[_0x27174f]['systemuserid'];}}}}if(!_0x9a32d4){logger[_0xd313('0x24')]('['+[_0x5629e4['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3774c3[_0xd313('0x21')]=_0x3b5922[_0xd313('0x13')];for(_0x27174f=0x0;_0x27174f<_0x58c56c[_0xd313('0x22')];_0x27174f++){if(_0x58c56c[_0x27174f][_0xd313('0x28')]===_0x3b5922[_0xd313('0x13')]){_0x3774c3[_0xd313('0x27')]=_0x58c56c[_0x27174f][_0xd313('0x26')];}}}_0x37b237(_0x3774c3);})[_0xd313('0x18')](function(_0xf41c1a){_0x11a30f(_0xf41c1a[_0xd313('0x29')]);});});}function createEndUser(_0x6f65d8,_0x2d9d6f,_0x238952,_0x11da7c,_0x3234bd,_0x131850,_0x431eab){return new Promise(function(_0x398b74,_0x17652d){return getAuthToken(_0x2d9d6f,_0x238952,_0x131850)[_0xd313('0x16')](function(_0x254e95){var _0x47030a=_0x131850['toLowerCase']()===_0xd313('0x2a')?_0x3234bd[_0xd313('0x2b')]:_0x3234bd[_0xd313('0x2c')];var _0x54174c={'method':_0xd313('0x12'),'uri':_0x11da7c+'contacts','body':{'fullname':_0x47030a,'firstname':_0x47030a,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xd313('0x2d')+_0x6f65d8[_0xd313('0x27')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x254e95,'OData-Version':_0xd313('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x54174c[_0xd313('0x2e')][_0x431eab]=_0x47030a;return rp(_0x54174c);})[_0xd313('0x16')](function(_0x444aef){var _0x5ce91b=_0x444aef[_0xd313('0x2f')][_0xd313('0x30')];var _0x390fe1=_0x5ce91b[_0xd313('0x31')](_0x5ce91b[_0xd313('0x32')]('(')+0x1,_0x5ce91b[_0xd313('0x32')](')'));_0x6f65d8['enduserId']=_0x390fe1;_0x398b74(_0x6f65d8);})[_0xd313('0x18')](function(_0x1e7de1){_0x17652d(_0x1e7de1['message']);});});}function getEndUser(_0x466a31,_0x225789,_0x4d3422,_0x395abb,_0x5a670e,_0x3b3d60,_0x474679,_0x40e684){var _0x512f27=_0x3b3d60[_0xd313('0x33')]()===_0xd313('0x2a')?_0x5a670e[_0xd313('0x2b')]:_0x5a670e[_0xd313('0x2c')];return getAuthToken(_0x225789,_0x4d3422,_0x3b3d60)['then'](function(_0x1263b8){_0x40e684=_0x40e684?_0x40e684:_0xd313('0x34');var _0x34f993={'method':'GET','uri':_0x395abb+_0xd313('0x35')+_0x40e684+_0xd313('0x36')+_0x40e684+_0xd313('0x37')+_0x512f27[_0xd313('0x38')]('+',_0xd313('0x39'))+'\x27','headers':{'Authorization':_0xd313('0x1b')+_0x1263b8,'If-None-Match':null,'OData-Version':_0xd313('0x1c')},'json':!![]};return rp(_0x34f993);})[_0xd313('0x16')](function(_0x52f590){var _0x2635b6=![];if(!_0x52f590)return _0x2635b6;var _0x43bea9=_0x52f590['value'];for(var _0x103086=0x0;_0x103086<_0x43bea9[_0xd313('0x22')];_0x103086++){if(_0x43bea9[_0x103086][_0x40e684]===_0x512f27){_0x2635b6=!![];_0x466a31['enduserId']=_0x43bea9[_0x103086]['contactid'];}}return _0x2635b6;})[_0xd313('0x16')](function(_0x37d76f){if(_0x37d76f)return _0x466a31;if(_0x474679===_0xd313('0x3a')){logger['info']('['+[_0x3b3d60[_0xd313('0x25')]()]+_0xd313('0x3b'));return _0x466a31;}return createEndUser(_0x466a31,_0x225789,_0x4d3422,_0x395abb,_0x5a670e,_0x3b3d60,_0x40e684)['then'](function(_0x3b1b46){logger[_0xd313('0x24')]('['+[_0x3b3d60[_0xd313('0x25')]()]+_0xd313('0x3c'),_0x3b1b46['enduserId']);return _0x3b1b46;});});}function getCustomFields(_0x12d966,_0x4a5ef0,_0x157129){var _0x535f7c={};if(_0x12d966[_0xd313('0x22')]>0x0){_[_0xd313('0x3d')](_0x12d966,function(_0x3e9d03){if(_['includes']([_0xd313('0x3e'),_0xd313('0x3f')],_0x3e9d03[_0xd313('0x40')])&&_0x3e9d03[_0xd313('0x41')]&&!_0x3e9d03[_0xd313('0x42')]){var _0x57c6c8=_0x3e9d03[_0xd313('0x43')][_0xd313('0x33')]();var _0x59edaf=_0x57c6c8['substring'](0x0,_0x57c6c8[_0xd313('0x44')]('_'));var _0x84eb4d=_0x57c6c8[_0xd313('0x31')](_0x57c6c8[_0xd313('0x44')]('_')+0x1);if(_0x59edaf===_0x157129){_0x535f7c[_0x84eb4d]=_0x3e9d03['content'];}}});}return _0x535f7c;}function getTicket(_0x3ed1e2,_0x5ef311,_0xc906e1,_0x151b90,_0x14f91b,_0x4753ce,_0x462b59){return new Promise(function(_0x3ea501,_0x4bfe69){var _0x5a4f20;return getAuthToken(_0x5ef311,_0xc906e1,_0x462b59)[_0xd313('0x16')](function(_0x4b848c){if(_0x4753ce['ticketType']===_0xd313('0x45')){_0x5a4f20={'method':_0xd313('0x12'),'uri':_0x151b90+_0xd313('0x46'),'body':Object[_0xd313('0x47')]({},{'title':intUtil[_0xd313('0x48')](_0x4753ce['Subjects'],_0x14f91b,'\x20'),'description':intUtil[_0xd313('0x48')](_0x4753ce[_0xd313('0x49')],_0x14f91b,'\x0a'),'customerid_contact@odata.bind':_0x3ed1e2[_0xd313('0x4a')]?_0xd313('0x4b')+_0x3ed1e2[_0xd313('0x4a')]+')':undefined,'ownerid@odata.bind':_0xd313('0x2d')+_0x3ed1e2[_0xd313('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x4753ce[_0xd313('0x4c')],_0x14f91b,_0x4753ce['ticketType'])),'headers':{'Authorization':_0xd313('0x1b')+_0x4b848c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x4753ce[_0xd313('0x4d')]===_0xd313('0x4e')){var _0x2a5781=_0x3ed1e2['enduserId']?[{'partyid_systemuser@odata.bind':_0xd313('0x2d')+_0x3ed1e2[_0xd313('0x27')]+')','participationtypemask':_0x3ed1e2[_0xd313('0x4f')]===_0xd313('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0xd313('0x4b')+_0x3ed1e2['enduserId']+')','participationtypemask':_0x3ed1e2[_0xd313('0x4f')]===_0xd313('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xd313('0x2d')+_0x3ed1e2[_0xd313('0x27')]+')','participationtypemask':_0x3ed1e2['callDirection']===_0xd313('0x50')?0x2:0x1}];_0x5a4f20={'method':_0xd313('0x12'),'uri':_0x151b90+_0xd313('0x51'),'body':Object['assign']({},{'subject':intUtil[_0xd313('0x48')](_0x4753ce[_0xd313('0x52')],_0x14f91b,'\x20'),'phonenumber':String(_0x14f91b[_0xd313('0x2c')]),'description':intUtil[_0xd313('0x48')](_0x4753ce[_0xd313('0x49')],_0x14f91b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x3ed1e2['enduserId']?_0xd313('0x4b')+_0x3ed1e2[_0xd313('0x4a')]+')':undefined,'ownerid@odata.bind':_0xd313('0x2d')+_0x3ed1e2['userId']+')','directioncode':_0x3ed1e2[_0xd313('0x4f')]===_0xd313('0x50')?![]:!![],'phonecall_activity_parties':_0x2a5781},getCustomFields(_0x4753ce[_0xd313('0x4c')],_0x14f91b,_0x4753ce[_0xd313('0x4d')])),'headers':{'Authorization':'Bearer\x20'+_0x4b848c,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5a4f20);})[_0xd313('0x16')](function(_0x3ab3d8){var _0x27d46a=_0x3ab3d8['headers'][_0xd313('0x30')];var _0x5275a3=_0x27d46a[_0xd313('0x31')](_0x27d46a['lastIndexOf']('(')+0x1,_0x27d46a[_0xd313('0x32')](')'));_0x3ed1e2[_0xd313('0x53')]=_0x5275a3;_0x3ea501(_0x3ed1e2);})['catch'](function(_0x21d9fa){_0x4bfe69(_0x21d9fa[_0xd313('0x29')]);});});}function emit(_0x16e582,_0x165844,_0x454820,_0x3aacda){var _0x3dc0b4={'uri':util[_0xd313('0x54')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x16e582,_0x454820,_0x3aacda)};io['to'](util[_0xd313('0x54')]('user:%s',_0x165844))[_0xd313('0x55')](_0xd313('0x56'),_0x3dc0b4);}exports['cs']=function(_0x437327,_0x37f47c,_0x579655,_0x5b27ed,_0x1ed84b,_0x1e354c,_0x4c40f0,_0x5e6963){var _0x20d6f5={};_0x1e354c[_0xd313('0xb')]=_0x1e354c['modernAuthentication']?intUtil[_0xd313('0x57')](_0x1e354c[_0xd313('0xe')]['data7']):intUtil[_0xd313('0x57')](_0x1e354c[_0xd313('0xb')]);_0x1e354c[_0xd313('0x58')]=intUtil[_0xd313('0x57')](_0x1e354c[_0xd313('0x58')]);_0x20d6f5[_0xd313('0x4f')]=_0x5e6963==='queue'||_0x5e6963===_0xd313('0x59')?_0xd313('0x50'):_0xd313('0x2a');var _0x2560ee=_0x1e354c['modernAuthentication']?util[_0xd313('0x54')](_0xd313('0x5a'),_0x1e354c['CloudProvider'][_0xd313('0xc')]):util[_0xd313('0x54')](_0xd313('0x5a'),_0x1e354c['remoteUri']);var _0x3fedcb=util['format'](_0xd313('0x5b'),_0x1e354c['tenantId']);var _0x30697d=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e354c['serverUrl'],_0x37f47c['uniqueid'],md5(_0x37f47c['uniqueid']));if(_0x1ed84b&&_0x1ed84b[_0xd313('0x5c')]){logger[_0xd313('0x24')]('[QUEUE]',_0xd313('0x5d'));_0x37f47c[_0xd313('0x5e')]=_0x30697d;}else if(_0x4c40f0&&_0x4c40f0['recordingFormat']&&_0x4c40f0['recordingFormat']!==_0xd313('0x5f')){logger[_0xd313('0x24')](_0xd313('0x60'),_0xd313('0x5d'));_0x37f47c[_0xd313('0x5e')]=_0x30697d;}else{_0x37f47c[_0xd313('0x5e')]='';}return getUser(_0x20d6f5,_0x1e354c,_0x5b27ed,_0x3fedcb,_0x2560ee,_0x5e6963)[_0xd313('0x16')](function(_0x1d9d24){logger[_0xd313('0x24')]('['+_0x5e6963[_0xd313('0x25')]()+']\x20The\x20User\x20ID\x20is:',_0x1d9d24[_0xd313('0x27')]);logger[_0xd313('0x24')]('['+_0x5e6963['toUpperCase']()+_0xd313('0x61'),_0x1d9d24['userEmail']);return getEndUser(_0x1d9d24,_0x1e354c,_0x3fedcb,_0x2560ee,_0x37f47c,_0x5e6963,_0x579655[_0xd313('0x62')],_0x579655[_0xd313('0x63')]);})[_0xd313('0x16')](function(_0x252962){logger['info']('['+_0x5e6963[_0xd313('0x25')]()+_0xd313('0x64'),_0x252962[_0xd313('0x4a')]);logger[_0xd313('0x24')]('['+_0x5e6963[_0xd313('0x25')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x37f47c[_0xd313('0x2c')]);return getTicket(_0x252962,_0x1e354c,_0x3fedcb,_0x2560ee,_0x37f47c,_0x579655,_0x5e6963);})['then'](function(_0x1f1d8f){logger[_0xd313('0x24')](util[_0xd313('0x54')]('['+_0x5e6963['toUpperCase']()+_0xd313('0x65'),_0x579655[_0xd313('0x4d')],_0x1f1d8f[_0xd313('0x53')]));logger[_0xd313('0x24')](util[_0xd313('0x54')]('['+_0x5e6963[_0xd313('0x25')]()+_0xd313('0x66'),_0x5e6963));if(_0x5e6963!==_0xd313('0x59')&&_0x579655[_0xd313('0x67')]){logger[_0xd313('0x24')]('['+_0x5e6963['toUpperCase']()+']',_0xd313('0x68'));emit(_0x1e354c['remoteUri'],_0x5b27ed[_0xd313('0x69')],_0x579655[_0xd313('0x4d')],_0x1f1d8f[_0xd313('0x53')]);}})[_0xd313('0x18')](function(_0x3bb721){logger['error']('['+_0x5e6963[_0xd313('0x25')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x3bb721[_0xd313('0x29')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x3bb721);});}; \ 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 5c07495..db8a289 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 _0x85f7=['Fields','custom_fields','mapValues','keyBy','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','remoteUri','length','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','GET','map','forEach','string','type','customField','toLowerCase','idField','content','variable','variableName','push','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','[QUEUE]','outbound','none','[OUTBOUND]','Authorization','email','destcalleridname','trigger:browser:url','%s/helpdesk/tickets/%d','lastevent','toUpperCase','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','localhost','redis','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x85f7,0x157));var _0x785f=function(_0x1d0de9,_0x13e43d){_0x1d0de9=_0x1d0de9-0x0;var _0x3fbc29=_0x85f7[_0x1d0de9];return _0x3fbc29;};'use strict';var _=require(_0x785f('0x0'));var rp=require(_0x785f('0x1'));var md5=require('md5');var util=require(_0x785f('0x2'));var Redis=require(_0x785f('0x3'));var intUtil=require(_0x785f('0x4'));var config=require(_0x785f('0x5'));var logger=require(_0x785f('0x6'))('freshdesk');config['redis']=_[_0x785f('0x7')](config['redis'],{'host':_0x785f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x785f('0x9')]));var headers={'Content-Type':_0x785f('0xa'),'Accept':_0x785f('0xa')};function emit(_0x5e2173,_0x4d4b01,_0x580737){io['to'](_0x5e2173)[_0x785f('0xb')](_0x4d4b01,_0x580737);}function getTicket(_0x513aa7,_0x21f65a,_0x29cb5b,_0x52c4aa,_0x5a5ecd){logger[_0x785f('0xc')](_0x785f('0xd'));var _0x50feb6=_[_0x785f('0xe')]({'responder_id':_0x21f65a['id'],'requester_id':_0x29cb5b['id'],'name':util[_0x785f('0xf')](_0x785f('0x10'),_0x5a5ecd[_0x785f('0x11')]),'phone':_0x5a5ecd[_0x785f('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x785f('0x13')](_0x52c4aa[_0x785f('0x14')],_0x5a5ecd,'\x20'),'description':intUtil[_0x785f('0x13')](_0x52c4aa[_0x785f('0x15')],_0x5a5ecd,_0x785f('0x16')),'tags':getTags(_0x52c4aa[_0x785f('0x17')],_0x785f('0x18'))},getCustomFields(_0x52c4aa[_0x785f('0x19')],_0x5a5ecd));_0x50feb6[_0x785f('0x1a')]=_[_0x785f('0x1b')](_[_0x785f('0x1c')](_0x50feb6[_0x785f('0x1a')],'id'),'value');return request({'uri':util['format']('%s/api/v2/tickets',_0x513aa7['remoteUri']),'method':_0x785f('0x1d'),'body':_0x50feb6})[_0x785f('0x1e')](function(_0x5eaa7c){logger[_0x785f('0xc')](_0x785f('0x1f'));return _0x5eaa7c;});}function getUser(_0x47434e,_0x1e8cb8){if(intUtil[_0x785f('0x20')](_0x1e8cb8)){return request({'uri':util[_0x785f('0xf')](_0x785f('0x21'),_0x47434e[_0x785f('0x22')]),'qs':{'email':_0x1e8cb8}})[_0x785f('0x1e')](function(_0x2d35cf){if(_0x2d35cf[_0x785f('0x23')]){logger[_0x785f('0xc')]('Agent\x20found!');return _['find'](_0x2d35cf,function(_0x9264bc){return _0x9264bc[_0x785f('0x24')]['email']===_0x1e8cb8;});}else{logger[_0x785f('0xc')](_0x785f('0x25'));return request({'uri':util[_0x785f('0xf')](_0x785f('0x26'),_0x47434e[_0x785f('0x22')])})[_0x785f('0x1e')](function(_0x9778b6){logger[_0x785f('0xc')](_0x785f('0x27'));return _0x9778b6;});}});}else{logger[_0x785f('0xc')](_0x785f('0x28'));return request({'uri':util[_0x785f('0xf')](_0x785f('0x26'),_0x47434e[_0x785f('0x22')])})[_0x785f('0x1e')](function(_0x5ebac3){logger[_0x785f('0xc')]('Admin\x20account\x20selected.');return _0x5ebac3;});}}function getEndUser(_0x26f085,_0x3f9f90,_0x1c9071){logger[_0x785f('0xc')]('Searching\x20enduser\x20with\x20phone',_0x1c9071);return request({'uri':util[_0x785f('0xf')]('%s/api/v2/contacts',_0x26f085[_0x785f('0x22')]),'qs':{'phone':_0x1c9071}})['then'](function(_0x1d9b9c){if(_0x1d9b9c[_0x785f('0x23')]){logger['info'](_0x785f('0x29'));return _[_0x785f('0x2a')](_0x1d9b9c,{'phone':_0x1c9071});}else{logger[_0x785f('0xc')](_0x785f('0x2b'));return request({'uri':util[_0x785f('0xf')](_0x785f('0x2c'),_0x26f085[_0x785f('0x22')]),'method':_0x785f('0x1d'),'body':{'name':_0x3f9f90,'phone':_0x1c9071}})[_0x785f('0x1e')](function(_0x72ba2a){logger[_0x785f('0xc')](_0x785f('0x2d'));return _0x72ba2a;});}});}function getAuth(_0x55fdb5){return util[_0x785f('0xf')](_0x785f('0x2e'),new Buffer(_0x55fdb5[_0x785f('0x2f')]+':X')[_0x785f('0x30')](_0x785f('0x31')));}function request(_0x5d3cee){logger['debug'](_0x785f('0x32'),JSON[_0x785f('0x33')](_0x5d3cee));return rp(_[_0x785f('0x7')](_0x5d3cee,{'method':_0x785f('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x14b40b,_0xfa02b6){var _0x255a8a=[];if(_0x14b40b&&_0x14b40b['length']>0x0){_0x255a8a=_[_0x785f('0x35')](_0x14b40b,_0xfa02b6);}return _0x255a8a;}function getCustomFields(_0x557509,_0x55ca70){var _0x2688a5=[];var _0x2cd7c8={'custom_fields':[]};if(_0x557509['length']>0x0){_[_0x785f('0x36')](_0x557509,function(_0xc94020){if(_['includes']([_0x785f('0x37'),'picklist'],_0xc94020[_0x785f('0x38')])&&_0xc94020['nameField']&&!_0xc94020[_0x785f('0x39')]){_0x2cd7c8[_0xc94020['nameField'][_0x785f('0x3a')]()]=_0xc94020['content']['toString']();}else if(_['includes']([_0x785f('0x37'),'picklist'],_0xc94020[_0x785f('0x38')])&&_0xc94020['idField']&&_0xc94020[_0x785f('0x39')]){_0x2cd7c8[_0x785f('0x1a')]['push']({'id':_0xc94020[_0x785f('0x3b')],'value':_0xc94020[_0x785f('0x3c')]['toString']()});}else if(_0xc94020[_0x785f('0x38')]===_0x785f('0x3d')&&_0xc94020[_0x785f('0x3e')]&&_0xc94020[_0x785f('0x3b')]&&_0xc94020[_0x785f('0x39')]){_0x55ca70[_0xc94020[_0x785f('0x3e')]]&&_0x2cd7c8[_0x785f('0x1a')][_0x785f('0x3f')]({'id':_0xc94020['idField'],'value':_0x55ca70[_0xc94020['variableName']][_0x785f('0x30')]()});}else if(_0xc94020[_0x785f('0x38')]===_0x785f('0x40')&&_0xc94020[_0x785f('0x41')]&&_0xc94020[_0x785f('0x41')][_0x785f('0x18')]&&_0xc94020[_0x785f('0x3b')]&&_0xc94020['customField']){_0x55ca70[_0xc94020[_0x785f('0x41')]['name'][_0x785f('0x3a')]()]&&_0x2cd7c8[_0x785f('0x1a')][_0x785f('0x3f')]({'id':_0xc94020[_0x785f('0x3b')],'value':_0x55ca70[_0xc94020[_0x785f('0x41')][_0x785f('0x18')]['toLowerCase']()][_0x785f('0x30')]()});}});}return _0x2cd7c8;}exports[_0x785f('0x42')]=function(_0x816374,_0x127b47,_0xe7293,_0x86e613,_0x3735eb,_0x25ee44){var _0x5e3141,_0xdc64c8;_0x25ee44[_0x785f('0x22')]=intUtil['stripTrailingSlash'](_0x25ee44['remoteUri']);_0x25ee44[_0x785f('0x43')]=intUtil[_0x785f('0x44')](_0x25ee44[_0x785f('0x43')]);if(_0x3735eb&&_0x3735eb[_0x785f('0x45')]){logger[_0x785f('0xc')]('[QUEUE]',_0x785f('0x46'));_0x127b47[_0x785f('0x47')]=util[_0x785f('0xf')](_0x785f('0x48'),_0x25ee44[_0x785f('0x43')],_0x127b47[_0x785f('0x49')],md5(_0x127b47[_0x785f('0x49')]));}else{_0x127b47[_0x785f('0x47')]='';}headers['Authorization']=getAuth(_0x25ee44);return getUser(_0x25ee44,_0x86e613['email'])[_0x785f('0x1e')](function(_0x24d3bb){_0x5e3141=_0x24d3bb;logger[_0x785f('0xc')](_0x785f('0x4a'),_0x5e3141['id']);return getEndUser(_0x25ee44,_0x127b47[_0x785f('0x11')],_0x127b47['calleridnum']);})[_0x785f('0x1e')](function(_0x5b065e){_0xdc64c8=_0x5b065e;logger[_0x785f('0xc')](_0x785f('0x4b'),_0xdc64c8['id']);return getTicket(_0x25ee44,_0x5e3141,_0xdc64c8,_0xe7293,_0x127b47);})['then'](function(_0x17a941){if(_0x17a941&&_0x17a941['id']){logger[_0x785f('0xc')](_0x785f('0x1f'));logger[_0x785f('0xc')](_0x785f('0x4c'),_0x17a941['id']);logger[_0x785f('0xc')]('[QUEUE]',_0x785f('0x4d'));emit(util[_0x785f('0xf')](_0x785f('0x4e'),_0x86e613['name']),'trigger:browser:url',{'uri':util[_0x785f('0xf')]('%s/helpdesk/tickets/%d',_0x25ee44[_0x785f('0x22')],_0x17a941['id'])});}})[_0x785f('0x4f')](function(_0x4a7ea9){logger[_0x785f('0x50')](_0x785f('0x51'),JSON[_0x785f('0x33')](_0x4a7ea9));});};exports[_0x785f('0x52')]=function(_0x199053,_0x324aa1,_0x5a3d3e,_0x5b7422,_0x14a8d0,_0xb40bc7,_0x1095fc){var _0x3375a1,_0x20b52c;_0xb40bc7[_0x785f('0x22')]=intUtil[_0x785f('0x44')](_0xb40bc7[_0x785f('0x22')]);_0xb40bc7[_0x785f('0x43')]=intUtil[_0x785f('0x44')](_0xb40bc7[_0x785f('0x43')]);if(_0x1095fc&&_0x1095fc['recordingFormat']&&_0x1095fc['recordingFormat']!==_0x785f('0x53')){logger[_0x785f('0xc')](_0x785f('0x54'),_0x785f('0x46'));_0x324aa1[_0x785f('0x47')]=util[_0x785f('0xf')](_0x785f('0x48'),_0xb40bc7['serverUrl'],_0x324aa1[_0x785f('0x49')],md5(_0x324aa1['uniqueid']));}headers[_0x785f('0x55')]=getAuth(_0xb40bc7);return getUser(_0xb40bc7,_0x5b7422[_0x785f('0x56')])[_0x785f('0x1e')](function(_0x2b7c33){_0x3375a1=_0x2b7c33;logger[_0x785f('0xc')](_0x785f('0x4a'),_0x3375a1['id']);return getEndUser(_0xb40bc7,_0x324aa1[_0x785f('0x57')],_0x324aa1['destcalleridnum']);})['then'](function(_0x17b66a){_0x20b52c=_0x17b66a;logger[_0x785f('0xc')](_0x785f('0x4b'),_0x20b52c['id']);return getTicket(_0xb40bc7,_0x3375a1,_0x20b52c,_0x5a3d3e,_0x324aa1);})[_0x785f('0x1e')](function(_0x34928c){if(_0x34928c&&_0x34928c['id']){logger['info'](_0x785f('0x1f'));logger[_0x785f('0xc')](_0x785f('0x4c'),_0x34928c['id']);logger['info']('[OUTBOUND]',_0x785f('0x4d'));emit(util[_0x785f('0xf')]('user:%s',_0x5b7422[_0x785f('0x18')]),_0x785f('0x58'),{'uri':util[_0x785f('0xf')](_0x785f('0x59'),_0xb40bc7[_0x785f('0x22')],_0x34928c['id'])});}})[_0x785f('0x4f')](function(_0x1dc3da){logger[_0x785f('0x50')]('[OUTBOUND]',JSON[_0x785f('0x33')](_0x1dc3da));});};exports['unmanaged']=function(_0x58c6c2,_0x3d6f5d,_0x2d368c,_0x5e55ef,_0x403741,_0x49a1e0){var _0x3f5bf0,_0x31cc4a;_0x49a1e0[_0x785f('0x22')]=intUtil['stripTrailingSlash'](_0x49a1e0[_0x785f('0x22')]);_0x49a1e0[_0x785f('0x43')]=intUtil['stripTrailingSlash'](_0x49a1e0['serverUrl']);if(_0x403741&&_0x403741['monitor_format']){logger[_0x785f('0xc')]('['+_0x3d6f5d[_0x785f('0x5a')][_0x785f('0x5b')]()+']',_0x785f('0x46'));_0x3d6f5d[_0x785f('0x47')]=util[_0x785f('0xf')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x49a1e0[_0x785f('0x43')],_0x3d6f5d[_0x785f('0x49')],md5(_0x3d6f5d[_0x785f('0x49')]));}else{_0x3d6f5d[_0x785f('0x47')]='';}headers[_0x785f('0x55')]=getAuth(_0x49a1e0);return getUser(_0x49a1e0,'')['then'](function(_0x199fb1){_0x3f5bf0=_0x199fb1;logger[_0x785f('0xc')](_0x785f('0x4a'),_0x3f5bf0['id']);return getEndUser(_0x49a1e0,_0x3d6f5d[_0x785f('0x11')],_0x3d6f5d[_0x785f('0x12')]);})[_0x785f('0x1e')](function(_0x44ff0c){_0x31cc4a=_0x44ff0c;logger[_0x785f('0xc')](_0x785f('0x4b'),_0x31cc4a['id']);return getTicket(_0x49a1e0,_0x3f5bf0,_0x31cc4a,_0x2d368c,_0x3d6f5d);})[_0x785f('0x1e')](function(_0x1d4502){if(_0x1d4502){logger[_0x785f('0xc')](_0x785f('0x1f'));logger['info'](_0x785f('0x4c'),_0x1d4502['id']);}})['catch'](function(_0x4600f8){logger[_0x785f('0x50')]('['+_0x3d6f5d[_0x785f('0x5a')][_0x785f('0x5b')]()+']',JSON[_0x785f('0x33')](_0x4600f8));});}; \ No newline at end of file +var _0xd8b5=['Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','unmanaged','toUpperCase','request-promise','md5','util','./util','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','forEach','string','picklist','nameField','customField','toLowerCase','includes','idField','push','type','variable','customVariable','Variable','name','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]'];(function(_0x1f5dec,_0x3b0c14){var _0x2d37fd=function(_0x339660){while(--_0x339660){_0x1f5dec['push'](_0x1f5dec['shift']());}};_0x2d37fd(++_0x3b0c14);}(_0xd8b5,0x6d));var _0x5d8b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd8b5[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var rp=require(_0x5d8b('0x0'));var md5=require(_0x5d8b('0x1'));var util=require(_0x5d8b('0x2'));var Redis=require('ioredis');var intUtil=require(_0x5d8b('0x3'));var config=require('../../../../config/environment');var logger=require(_0x5d8b('0x4'))(_0x5d8b('0x5'));config[_0x5d8b('0x6')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x5d8b('0x7'))(new Redis(config[_0x5d8b('0x6')]));var headers={'Content-Type':_0x5d8b('0x8'),'Accept':_0x5d8b('0x8')};function emit(_0x3ca745,_0x9bde22,_0x527f94){io['to'](_0x3ca745)[_0x5d8b('0x9')](_0x9bde22,_0x527f94);}function getTicket(_0x4393b8,_0x5e9fbf,_0x2fe759,_0x4edae8,_0x2139a6){logger[_0x5d8b('0xa')](_0x5d8b('0xb'));var _0xc6bf00=_['merge']({'responder_id':_0x5e9fbf['id'],'requester_id':_0x2fe759['id'],'name':util[_0x5d8b('0xc')](_0x5d8b('0xd'),_0x2139a6[_0x5d8b('0xe')]),'phone':_0x2139a6[_0x5d8b('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x5d8b('0x10')](_0x4edae8[_0x5d8b('0x11')],_0x2139a6,'\x20'),'description':intUtil[_0x5d8b('0x10')](_0x4edae8[_0x5d8b('0x12')],_0x2139a6,_0x5d8b('0x13')),'tags':getTags(_0x4edae8['Tags'],'name')},getCustomFields(_0x4edae8[_0x5d8b('0x14')],_0x2139a6));_0xc6bf00['custom_fields']=_[_0x5d8b('0x15')](_[_0x5d8b('0x16')](_0xc6bf00[_0x5d8b('0x17')],'id'),_0x5d8b('0x18'));return request({'uri':util['format'](_0x5d8b('0x19'),_0x4393b8[_0x5d8b('0x1a')]),'method':_0x5d8b('0x1b'),'body':_0xc6bf00})[_0x5d8b('0x1c')](function(_0x181489){logger['info'](_0x5d8b('0x1d'));return _0x181489;});}function getUser(_0x2c2607,_0x8a820d){if(intUtil[_0x5d8b('0x1e')](_0x8a820d)){return request({'uri':util[_0x5d8b('0xc')](_0x5d8b('0x1f'),_0x2c2607['remoteUri']),'qs':{'email':_0x8a820d}})[_0x5d8b('0x1c')](function(_0x34db58){if(_0x34db58[_0x5d8b('0x20')]){logger[_0x5d8b('0xa')]('Agent\x20found!');return _[_0x5d8b('0x21')](_0x34db58,function(_0x549a2e){return _0x549a2e[_0x5d8b('0x22')]['email']===_0x8a820d;});}else{logger['info'](_0x5d8b('0x23'));return request({'uri':util[_0x5d8b('0xc')]('%s/api/v2/agents/me',_0x2c2607[_0x5d8b('0x1a')])})[_0x5d8b('0x1c')](function(_0x2b57ce){logger[_0x5d8b('0xa')]('Admin\x20account\x20selected.');return _0x2b57ce;});}});}else{logger['info'](_0x5d8b('0x24'));return request({'uri':util[_0x5d8b('0xc')](_0x5d8b('0x25'),_0x2c2607[_0x5d8b('0x1a')])})[_0x5d8b('0x1c')](function(_0x4506f1){logger[_0x5d8b('0xa')](_0x5d8b('0x26'));return _0x4506f1;});}}function getEndUser(_0x4d6f31,_0x43e244,_0x4deade){logger['info']('Searching\x20enduser\x20with\x20phone',_0x4deade);return request({'uri':util[_0x5d8b('0xc')](_0x5d8b('0x27'),_0x4d6f31[_0x5d8b('0x1a')]),'qs':{'phone':_0x4deade}})[_0x5d8b('0x1c')](function(_0x521139){if(_0x521139[_0x5d8b('0x20')]){logger[_0x5d8b('0xa')]('Enduser\x20found!');return _[_0x5d8b('0x21')](_0x521139,{'phone':_0x4deade});}else{logger[_0x5d8b('0xa')](_0x5d8b('0x28'));return request({'uri':util[_0x5d8b('0xc')]('%s/api/v2/contacts',_0x4d6f31[_0x5d8b('0x1a')]),'method':_0x5d8b('0x1b'),'body':{'name':_0x43e244,'phone':_0x4deade}})['then'](function(_0x1d92a8){logger['info']('Enduser\x20created.');return _0x1d92a8;});}});}function getAuth(_0x59b7a0){return util['format'](_0x5d8b('0x29'),new Buffer(_0x59b7a0[_0x5d8b('0x2a')]+':X')[_0x5d8b('0x2b')](_0x5d8b('0x2c')));}function request(_0xd41812){logger['debug'](_0x5d8b('0x2d'),JSON[_0x5d8b('0x2e')](_0xd41812));return rp(_['defaults'](_0xd41812,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4e2254,_0x49022e){var _0x34ed67=[];if(_0x4e2254&&_0x4e2254['length']>0x0){_0x34ed67=_['map'](_0x4e2254,_0x49022e);}return _0x34ed67;}function getCustomFields(_0x4eb694,_0x19533b){var _0x2d6f73=[];var _0x1dfb98={'custom_fields':[]};if(_0x4eb694[_0x5d8b('0x20')]>0x0){_[_0x5d8b('0x2f')](_0x4eb694,function(_0x429752){if(_['includes']([_0x5d8b('0x30'),_0x5d8b('0x31')],_0x429752['type'])&&_0x429752[_0x5d8b('0x32')]&&!_0x429752[_0x5d8b('0x33')]){_0x1dfb98[_0x429752[_0x5d8b('0x32')][_0x5d8b('0x34')]()]=_0x429752['content']['toString']();}else if(_[_0x5d8b('0x35')]([_0x5d8b('0x30'),_0x5d8b('0x31')],_0x429752['type'])&&_0x429752[_0x5d8b('0x36')]&&_0x429752['customField']){_0x1dfb98[_0x5d8b('0x17')][_0x5d8b('0x37')]({'id':_0x429752[_0x5d8b('0x36')],'value':_0x429752['content'][_0x5d8b('0x2b')]()});}else if(_0x429752[_0x5d8b('0x38')]===_0x5d8b('0x39')&&_0x429752['variableName']&&_0x429752[_0x5d8b('0x36')]&&_0x429752[_0x5d8b('0x33')]){_0x19533b[_0x429752['variableName']]&&_0x1dfb98['custom_fields']['push']({'id':_0x429752[_0x5d8b('0x36')],'value':_0x19533b[_0x429752['variableName']][_0x5d8b('0x2b')]()});}else if(_0x429752['type']===_0x5d8b('0x3a')&&_0x429752[_0x5d8b('0x3b')]&&_0x429752['Variable']['name']&&_0x429752[_0x5d8b('0x36')]&&_0x429752[_0x5d8b('0x33')]){_0x19533b[_0x429752['Variable'][_0x5d8b('0x3c')][_0x5d8b('0x34')]()]&&_0x1dfb98['custom_fields'][_0x5d8b('0x37')]({'id':_0x429752[_0x5d8b('0x36')],'value':_0x19533b[_0x429752[_0x5d8b('0x3b')][_0x5d8b('0x3c')]['toLowerCase']()]['toString']()});}});}return _0x1dfb98;}exports['queue']=function(_0x360ef8,_0x261de8,_0x43c230,_0x50fa5e,_0x5df9a2,_0x48fb54){var _0x59df23,_0x1cde71;_0x48fb54['remoteUri']=intUtil[_0x5d8b('0x3d')](_0x48fb54[_0x5d8b('0x1a')]);_0x48fb54[_0x5d8b('0x3e')]=intUtil[_0x5d8b('0x3d')](_0x48fb54[_0x5d8b('0x3e')]);if(_0x5df9a2&&_0x5df9a2[_0x5d8b('0x3f')]){logger['info'](_0x5d8b('0x40'),_0x5d8b('0x41'));_0x261de8['recordingURL']=util['format'](_0x5d8b('0x42'),_0x48fb54[_0x5d8b('0x3e')],_0x261de8['uniqueid'],md5(_0x261de8[_0x5d8b('0x43')]));}else{_0x261de8[_0x5d8b('0x44')]='';}headers[_0x5d8b('0x45')]=getAuth(_0x48fb54);return getUser(_0x48fb54,_0x50fa5e[_0x5d8b('0x46')])['then'](function(_0x456b9b){_0x59df23=_0x456b9b;logger[_0x5d8b('0xa')](_0x5d8b('0x47'),_0x59df23['id']);return getEndUser(_0x48fb54,_0x261de8[_0x5d8b('0xe')],_0x261de8[_0x5d8b('0xf')]);})[_0x5d8b('0x1c')](function(_0x265d71){_0x1cde71=_0x265d71;logger[_0x5d8b('0xa')](_0x5d8b('0x48'),_0x1cde71['id']);return getTicket(_0x48fb54,_0x59df23,_0x1cde71,_0x43c230,_0x261de8);})['then'](function(_0x496e1b){if(_0x496e1b&&_0x496e1b['id']){logger['info'](_0x5d8b('0x1d'));logger[_0x5d8b('0xa')](_0x5d8b('0x49'),_0x496e1b['id']);logger['info'](_0x5d8b('0x40'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x5d8b('0xc')](_0x5d8b('0x4a'),_0x50fa5e[_0x5d8b('0x3c')]),_0x5d8b('0x4b'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x48fb54[_0x5d8b('0x1a')],_0x496e1b['id'])});}})['catch'](function(_0x2490a3){logger[_0x5d8b('0x4c')]('[QUEUE]',JSON[_0x5d8b('0x2e')](_0x2490a3));});};exports[_0x5d8b('0x4d')]=function(_0x3e399a,_0x5ee83a,_0x368d04,_0xbfc3c8,_0x139b77,_0x288d34,_0x3abccb){var _0x79cf6e,_0x7cdaf5;_0x288d34['remoteUri']=intUtil[_0x5d8b('0x3d')](_0x288d34[_0x5d8b('0x1a')]);_0x288d34['serverUrl']=intUtil['stripTrailingSlash'](_0x288d34[_0x5d8b('0x3e')]);if(_0x3abccb&&_0x3abccb[_0x5d8b('0x4e')]&&_0x3abccb[_0x5d8b('0x4e')]!==_0x5d8b('0x4f')){logger[_0x5d8b('0xa')](_0x5d8b('0x50'),_0x5d8b('0x41'));_0x5ee83a[_0x5d8b('0x44')]=util[_0x5d8b('0xc')](_0x5d8b('0x42'),_0x288d34[_0x5d8b('0x3e')],_0x5ee83a[_0x5d8b('0x43')],md5(_0x5ee83a[_0x5d8b('0x43')]));}headers[_0x5d8b('0x45')]=getAuth(_0x288d34);return getUser(_0x288d34,_0xbfc3c8[_0x5d8b('0x46')])[_0x5d8b('0x1c')](function(_0x221829){_0x79cf6e=_0x221829;logger[_0x5d8b('0xa')]('The\x20User\x20ID\x20is:',_0x79cf6e['id']);return getEndUser(_0x288d34,_0x5ee83a[_0x5d8b('0x51')],_0x5ee83a[_0x5d8b('0x52')]);})[_0x5d8b('0x1c')](function(_0x2ac9f8){_0x7cdaf5=_0x2ac9f8;logger[_0x5d8b('0xa')](_0x5d8b('0x48'),_0x7cdaf5['id']);return getTicket(_0x288d34,_0x79cf6e,_0x7cdaf5,_0x368d04,_0x5ee83a);})[_0x5d8b('0x1c')](function(_0x39cf98){if(_0x39cf98&&_0x39cf98['id']){logger[_0x5d8b('0xa')]('Ticket\x20created!');logger[_0x5d8b('0xa')](_0x5d8b('0x49'),_0x39cf98['id']);logger[_0x5d8b('0xa')](_0x5d8b('0x50'),_0x5d8b('0x53'));emit(util['format'](_0x5d8b('0x4a'),_0xbfc3c8[_0x5d8b('0x3c')]),'trigger:browser:url',{'uri':util['format']('%s/helpdesk/tickets/%d',_0x288d34[_0x5d8b('0x1a')],_0x39cf98['id'])});}})[_0x5d8b('0x54')](function(_0x175a14){logger[_0x5d8b('0x4c')]('[OUTBOUND]',JSON['stringify'](_0x175a14));});};exports[_0x5d8b('0x55')]=function(_0x177617,_0x432bbf,_0x364b25,_0x20f3ee,_0xfd9356,_0x40dfae){var _0x1e81eb,_0x359d8b;_0x40dfae['remoteUri']=intUtil[_0x5d8b('0x3d')](_0x40dfae[_0x5d8b('0x1a')]);_0x40dfae[_0x5d8b('0x3e')]=intUtil[_0x5d8b('0x3d')](_0x40dfae[_0x5d8b('0x3e')]);if(_0xfd9356&&_0xfd9356['monitor_format']){logger[_0x5d8b('0xa')]('['+_0x432bbf['lastevent'][_0x5d8b('0x56')]()+']','Recording\x20is\x20enabled!');_0x432bbf[_0x5d8b('0x44')]=util[_0x5d8b('0xc')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x40dfae['serverUrl'],_0x432bbf[_0x5d8b('0x43')],md5(_0x432bbf[_0x5d8b('0x43')]));}else{_0x432bbf[_0x5d8b('0x44')]='';}headers[_0x5d8b('0x45')]=getAuth(_0x40dfae);return getUser(_0x40dfae,'')[_0x5d8b('0x1c')](function(_0x5638f8){_0x1e81eb=_0x5638f8;logger[_0x5d8b('0xa')](_0x5d8b('0x47'),_0x1e81eb['id']);return getEndUser(_0x40dfae,_0x432bbf[_0x5d8b('0xe')],_0x432bbf[_0x5d8b('0xf')]);})[_0x5d8b('0x1c')](function(_0x1ad900){_0x359d8b=_0x1ad900;logger['info'](_0x5d8b('0x48'),_0x359d8b['id']);return getTicket(_0x40dfae,_0x1e81eb,_0x359d8b,_0x364b25,_0x432bbf);})[_0x5d8b('0x1c')](function(_0x5bca7d){if(_0x5bca7d){logger[_0x5d8b('0xa')](_0x5d8b('0x1d'));logger[_0x5d8b('0xa')](_0x5d8b('0x49'),_0x5bca7d['id']);}})['catch'](function(_0x156a59){logger[_0x5d8b('0x4c')]('['+_0x432bbf['lastevent']['toUpperCase']()+']',JSON[_0x5d8b('0x2e')](_0x156a59));});}; \ 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 3bfebc8..bdffb78 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 _0xa607=['contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','/api/tasks','Subjects','getString','Descriptions','add','ticketId','Task\x20created:','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','adminId','error','/api/lookup?q=','&entities=contact','find','contacts','format'];(function(_0x10c6ad,_0x1dc570){var _0x1e41d6=function(_0x1a1bee){while(--_0x1a1bee){_0x10c6ad['push'](_0x10c6ad['shift']());}};_0x1e41d6(++_0x1dc570);}(_0xa607,0x17f));var _0x7a60=function(_0x1a48a0,_0x3c95f5){_0x1a48a0=_0x1a48a0-0x0;var _0x269714=_0xa607[_0x1a48a0];return _0x269714;};'use strict';var _=require(_0x7a60('0x0'));var rp=require(_0x7a60('0x1'));var md5=require(_0x7a60('0x2'));var util=require('util');var moment=require(_0x7a60('0x3'));var Promise=require(_0x7a60('0x4'));var Redis=require(_0x7a60('0x5'));var intUtil=require(_0x7a60('0x6'));var config=require(_0x7a60('0x7'));var logger=require(_0x7a60('0x8'))(_0x7a60('0x9'));config[_0x7a60('0xa')]=_[_0x7a60('0xb')](config['redis'],{'host':_0x7a60('0xc'),'port':0x18eb});var io=require(_0x7a60('0xd'))(new Redis(config[_0x7a60('0xa')]));function getAdminId(_0x2f348c,_0x15bd0f,_0x2a82f4,_0x2fefea){return new Promise(function(_0x12fed5,_0x337489){var _0x5650e0=![];var _0x3941f1={'method':_0x7a60('0xe'),'uri':_0x2fefea+_0x7a60('0xf'),'json':!![]};_0x3941f1[_0x7a60('0x10')]=_0x2a82f4;logger['info'](_0x7a60('0x11'));return rp(_0x3941f1)[_0x7a60('0x12')](function(_0x111f73){if(_0x111f73){var _0x44f432=_0x111f73[_0x7a60('0x13')];var _0x499940=null;for(_0x499940=0x0;_0x499940<_0x44f432[_0x7a60('0x14')];_0x499940++){if(_0x44f432[_0x499940][_0x7a60('0x15')]===_0x2f348c[_0x7a60('0x16')]){_0x2f348c['adminId']=_0x44f432[_0x499940]['id'];_0x5650e0=!![];}}if(_0x5650e0){logger[_0x7a60('0x17')](_0x7a60('0x18'),_0x2f348c['adminId']);_0x12fed5(_0x2f348c);}else{_0x337489({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x337489({'statusCode':0x194,'message':_0x7a60('0x19')});}})[_0x7a60('0x1a')](function(_0x221931){logger['error']('['+[_0x15bd0f[_0x7a60('0x1b')]()]+']',_0x221931[_0x7a60('0x1c')]);_0x337489(_0x221931);});});}function getUser(_0x252192,_0x9447db,_0xb0990c){return function(_0x4f0e5f){return new Promise(function(_0x230a30,_0x3d92e7){var _0x3b2f51={'method':_0x7a60('0xe'),'uri':_0xb0990c+_0x7a60('0xf'),'json':!![]};_0x3b2f51['headers']=_0x9447db;logger[_0x7a60('0x17')](_0x7a60('0x1d'));return rp(_0x3b2f51)[_0x7a60('0x12')](function(_0xe4c00f){if(_0xe4c00f){var _0x34b277=_0xe4c00f['users'];var _0x3dd5c3=![];var _0x1bf95a=null;if(_0x4f0e5f['agentEmail']!==null){logger['info']('Getting\x20user\x20with\x20email',_0x4f0e5f[_0x7a60('0x1e')]);_0x4f0e5f[_0x7a60('0x1f')]=_0x4f0e5f[_0x7a60('0x1e')];for(_0x1bf95a=0x0;_0x1bf95a<_0x34b277[_0x7a60('0x14')];_0x1bf95a++){if(_0x34b277[_0x1bf95a][_0x7a60('0x15')]===_0x4f0e5f[_0x7a60('0x1e')]){_0x3dd5c3=!![];_0x4f0e5f[_0x7a60('0x20')]=_0x34b277[_0x1bf95a]['id'];logger[_0x7a60('0x17')](_0x7a60('0x21'),_0x4f0e5f[_0x7a60('0x20')]);}}}if(!_0x3dd5c3){logger[_0x7a60('0x17')](_0x7a60('0x22'));_0x4f0e5f[_0x7a60('0x1f')]=_0x4f0e5f['adminEmail'];_0x4f0e5f[_0x7a60('0x20')]=_0x4f0e5f[_0x7a60('0x23')];_0x3dd5c3=!![];}if(_0x3dd5c3){_0x230a30(_0x4f0e5f);}else{_0x3d92e7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3d92e7({'statusCode':0x194,'message':_0x7a60('0x19')});}})['catch'](function(_0x5b9c1f){logger[_0x7a60('0x24')]('['+[_0x252192[_0x7a60('0x1b')]()]+']',_0x5b9c1f[_0x7a60('0x1c')]);_0x3d92e7(_0x5b9c1f);});});};}function searchContact(_0x481e74,_0x59623d,_0x17ca32,_0x2c6a85){return new Promise(function(_0x57dd50,_0x290a93){var _0xdbda06={'method':_0x7a60('0xe'),'headers':_0x59623d,'uri':_0x481e74+_0x7a60('0x25')+_0x2c6a85+'&f='+_0x17ca32+_0x7a60('0x26'),'json':!![]};rp(_0xdbda06)[_0x7a60('0x12')](function(_0x16394f){var _0x163524=_[_0x7a60('0x27')](_0x16394f[_0x7a60('0x28')]['contacts'],[_0x17ca32,_0x2c6a85]);_0x57dd50(_0x163524);})['catch'](function(_0x4ef6ea){_0x290a93(_0x4ef6ea);});});}function getEndUser(_0x4a6fc2,_0x7f10a,_0x1953fe){return function(_0x2cbb62){return new Promise(function(_0x5997a2,_0x443a18){logger['info'](util[_0x7a60('0x29')]('Searching\x20contact\x20with\x20phone\x20%s',_0x2cbb62[_0x7a60('0x2a')]));searchContact(_0x1953fe,_0x7f10a,'mobile_number',_0x2cbb62[_0x7a60('0x2a')])['then'](function(_0x5506ec){if(_0x5506ec){_0x2cbb62[_0x7a60('0x2b')]=_0x5506ec['id'];logger[_0x7a60('0x17')](_0x7a60('0x2c'),_0x2cbb62['endUserId']);return _0x5997a2(_0x2cbb62);}searchContact(_0x1953fe,_0x7f10a,_0x7a60('0x2d'),_0x2cbb62[_0x7a60('0x2a')])['then'](function(_0x230a6c){if(_0x230a6c){_0x2cbb62[_0x7a60('0x2b')]=_0x230a6c['id'];logger[_0x7a60('0x17')](_0x7a60('0x2e'),_0x2cbb62[_0x7a60('0x2b')]);return _0x5997a2(_0x2cbb62);}createEndUser(_0x2cbb62,_0x4a6fc2,_0x7f10a,_0x1953fe)[_0x7a60('0x12')](function(_0x2a295e){logger[_0x7a60('0x17')](_0x7a60('0x2f'),_0x2a295e[_0x7a60('0x2b')]);return _0x5997a2(_0x2a295e);});});})[_0x7a60('0x1a')](function(_0x2cf4b0){_0x443a18(_0x2cf4b0);});});};}function createEndUser(_0x2bfc26,_0x9896dc,_0x5f326a,_0xc482cd){return new Promise(function(_0x4fbe23,_0x3368ea){var _0x4a9549=moment();var _0x210b92={'method':_0x7a60('0x30'),'uri':_0xc482cd+_0x7a60('0x31'),'body':{'contact':{'last_name':_0x2bfc26[_0x7a60('0x2a')],'work_number':_0x2bfc26[_0x7a60('0x2a')],'mobile_number':_0x2bfc26[_0x7a60('0x2a')],'owner_id':_0x2bfc26[_0x7a60('0x20')],'created_at':_0x4a9549['format'](_0x7a60('0x32'))}},'json':!![]};_0x210b92['headers']=_0x5f326a;logger[_0x7a60('0x17')](_0x7a60('0x33'));return rp(_0x210b92)[_0x7a60('0x12')](function(_0x1e68c6){_0x2bfc26[_0x7a60('0x2b')]=_0x1e68c6['contact']['id'];_0x4fbe23(_0x2bfc26);})[_0x7a60('0x1a')](function(_0x2b6db1){logger[_0x7a60('0x24')]('['+[_0x9896dc[_0x7a60('0x1b')]()]+']',_0x2b6db1[_0x7a60('0x1c')]);_0x3368ea(_0x2b6db1[_0x7a60('0x1c')]);});});}function getTicket(_0x64c310,_0x193a0d,_0x1832a3,_0x447669,_0x319712){return function(_0x5d2d80){logger[_0x7a60('0x17')]('Creating\x20new\x20task');return new Promise(function(_0x246bc4,_0x11fd93){var _0x58e342=moment();var _0x224a2f={'method':_0x7a60('0x30'),'uri':_0x1832a3+_0x7a60('0x34'),'body':{'title':intUtil['getString'](_0x447669[_0x7a60('0x35')],_0x319712,'\x20'),'description':intUtil[_0x7a60('0x36')](_0x447669[_0x7a60('0x37')],_0x319712,'\x0a'),'owner_id':_0x5d2d80['userId'],'creater_id':_0x5d2d80[_0x7a60('0x23')],'targetable_id':_0x5d2d80[_0x7a60('0x2b')],'targetable_type':'Contact','created_at':_0x58e342[_0x7a60('0x29')](_0x7a60('0x32')),'due_date':_0x58e342[_0x7a60('0x38')](0x1e,'m')['format'](_0x7a60('0x32'))},'json':!![]};_0x224a2f[_0x7a60('0x10')]=_0x193a0d;return rp(_0x224a2f)[_0x7a60('0x12')](function(_0x4f7c6d){_0x5d2d80[_0x7a60('0x39')]=_0x4f7c6d['task']['id'];logger['info'](_0x7a60('0x3a'),_0x5d2d80['ticketId']);_0x246bc4(_0x5d2d80);})[_0x7a60('0x1a')](function(_0x24a015){logger[_0x7a60('0x24')]('['+[_0x64c310[_0x7a60('0x1b')]()]+']',_0x24a015[_0x7a60('0x1c')]);_0x11fd93(_0x24a015[_0x7a60('0x1c')]);});});};}function emit(_0x2cdb51,_0x5b4e43,_0x3be719){var _0x10b4f8={'uri':_0x2cdb51+'/contacts/'+_0x3be719};io['to'](util[_0x7a60('0x29')](_0x7a60('0x3b'),_0x5b4e43))['emit'](_0x7a60('0x3c'),_0x10b4f8);}exports['cs']=function(_0x5adb49,_0x58fa9d,_0x32f3fd,_0x15c93f,_0x525b0f,_0x1aa7ca,_0x65c697,_0xfefc8c){var _0x209ab9={};var _0x280dbd={'Authorization':_0x7a60('0x3d')+_0x1aa7ca[_0x7a60('0x3e')]};_0x1aa7ca['remoteUri']=intUtil[_0x7a60('0x3f')](_0x1aa7ca[_0x7a60('0x40')]);_0x1aa7ca[_0x7a60('0x41')]=intUtil['stripTrailingSlash'](_0x1aa7ca['serverUrl']);var _0x14afd2=_0x1aa7ca[_0x7a60('0x40')];_0x209ab9['adminEmail']=_0x1aa7ca[_0x7a60('0x42')];_0x209ab9[_0x7a60('0x2a')]=_0xfefc8c[_0x7a60('0x43')]()===_0x7a60('0x44')?_0x58fa9d['destcalleridnum']:_0x58fa9d[_0x7a60('0x45')];_0x209ab9[_0x7a60('0x46')]=_0xfefc8c==='queue'||_0xfefc8c===_0x7a60('0x47')?_0x7a60('0x48'):_0x7a60('0x44');if(_0x15c93f){_0x209ab9[_0x7a60('0x1e')]=_0x15c93f[_0x7a60('0x15')];}var _0x1788b6=util[_0x7a60('0x29')](_0x7a60('0x49'),_0x1aa7ca[_0x7a60('0x41')],_0x58fa9d[_0x7a60('0x4a')],md5(_0x58fa9d['uniqueid']));if(_0x525b0f&&_0x525b0f[_0x7a60('0x4b')]){logger[_0x7a60('0x17')]('[QUEUE]',_0x7a60('0x4c'));_0x58fa9d[_0x7a60('0x4d')]=_0x1788b6;}else if(_0x65c697&&_0x65c697[_0x7a60('0x4e')]&&_0x65c697[_0x7a60('0x4e')]!==_0x7a60('0x4f')){logger[_0x7a60('0x17')](_0x7a60('0x50'),_0x7a60('0x4c'));_0x58fa9d[_0x7a60('0x4d')]=_0x1788b6;}else{_0x58fa9d[_0x7a60('0x4d')]='';}return getAdminId(_0x209ab9,_0xfefc8c,_0x280dbd,_0x14afd2)[_0x7a60('0x12')](getUser(_0xfefc8c,_0x280dbd,_0x14afd2))['then'](getEndUser(_0xfefc8c,_0x280dbd,_0x14afd2))[_0x7a60('0x12')](getTicket(_0xfefc8c,_0x280dbd,_0x14afd2,_0x32f3fd,_0x58fa9d))[_0x7a60('0x12')](function(_0x5b2d69){logger[_0x7a60('0x17')](util[_0x7a60('0x29')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5b2d69[_0x7a60('0x39')]));if(_0xfefc8c!==_0x7a60('0x47')){logger[_0x7a60('0x17')]('['+[_0xfefc8c['toUpperCase']()]+']',_0x7a60('0x51'));emit(_0x14afd2,_0x15c93f[_0x7a60('0x52')],_0x5b2d69[_0x7a60('0x2b')]);}})['catch'](function(_0x427486){logger[_0x7a60('0x24')]('['+[_0xfefc8c[_0x7a60('0x1b')]()]+_0x7a60('0x53'),util[_0x7a60('0x54')](_0x427486,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb9f8=['mobile_number','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','then','Contact\x20created:','POST','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','/api/tasks','getString','Subjects','Contact','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','Task\x20created:','/contacts/','emit','trigger:browser:url','Token\x20token=','stripTrailingSlash','remoteUri','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','Getting\x20admin\x20information','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format'];(function(_0x51ecc2,_0x42aa94){var _0x1e12b9=function(_0x148f53){while(--_0x148f53){_0x51ecc2['push'](_0x51ecc2['shift']());}};_0x1e12b9(++_0x42aa94);}(_0xb9f8,0x1c4));var _0x8b9f=function(_0x4f7c74,_0x506462){_0x4f7c74=_0x4f7c74-0x0;var _0x6e7b2d=_0xb9f8[_0x4f7c74];return _0x6e7b2d;};'use strict';var _=require(_0x8b9f('0x0'));var rp=require(_0x8b9f('0x1'));var md5=require(_0x8b9f('0x2'));var util=require(_0x8b9f('0x3'));var moment=require('moment');var Promise=require(_0x8b9f('0x4'));var Redis=require(_0x8b9f('0x5'));var intUtil=require(_0x8b9f('0x6'));var config=require(_0x8b9f('0x7'));var logger=require(_0x8b9f('0x8'))('freshsales');config[_0x8b9f('0x9')]=_['defaults'](config[_0x8b9f('0x9')],{'host':_0x8b9f('0xa'),'port':0x18eb});var io=require(_0x8b9f('0xb'))(new Redis(config[_0x8b9f('0x9')]));function getAdminId(_0xe73473,_0x1a787c,_0x496761,_0x387e16){return new Promise(function(_0x5380f1,_0x45b798){var _0x33f542=![];var _0x338c2e={'method':_0x8b9f('0xc'),'uri':_0x387e16+_0x8b9f('0xd'),'json':!![]};_0x338c2e[_0x8b9f('0xe')]=_0x496761;logger[_0x8b9f('0xf')](_0x8b9f('0x10'));return rp(_0x338c2e)['then'](function(_0x5256aa){if(_0x5256aa){var _0x4aa966=_0x5256aa[_0x8b9f('0x11')];var _0x47b538=null;for(_0x47b538=0x0;_0x47b538<_0x4aa966[_0x8b9f('0x12')];_0x47b538++){if(_0x4aa966[_0x47b538][_0x8b9f('0x13')]===_0xe73473[_0x8b9f('0x14')]){_0xe73473[_0x8b9f('0x15')]=_0x4aa966[_0x47b538]['id'];_0x33f542=!![];}}if(_0x33f542){logger['info']('Admin\x20found:',_0xe73473[_0x8b9f('0x15')]);_0x5380f1(_0xe73473);}else{_0x45b798({'statusCode':0x194,'message':_0x8b9f('0x16')});}}else{_0x45b798({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x8b9f('0x17')](function(_0x17c9db){logger[_0x8b9f('0x18')]('['+[_0x1a787c[_0x8b9f('0x19')]()]+']',_0x17c9db[_0x8b9f('0x1a')]);_0x45b798(_0x17c9db);});});}function getUser(_0x32ef1a,_0x15a968,_0x206672){return function(_0x47bf01){return new Promise(function(_0x43bfd1,_0x2660c1){var _0x1a9aee={'method':_0x8b9f('0xc'),'uri':_0x206672+_0x8b9f('0xd'),'json':!![]};_0x1a9aee[_0x8b9f('0xe')]=_0x15a968;logger[_0x8b9f('0xf')](_0x8b9f('0x1b'));return rp(_0x1a9aee)['then'](function(_0x320ecb){if(_0x320ecb){var _0x3c9ebf=_0x320ecb[_0x8b9f('0x11')];var _0x491476=![];var _0x103e6c=null;if(_0x47bf01[_0x8b9f('0x1c')]!==null){logger[_0x8b9f('0xf')](_0x8b9f('0x1d'),_0x47bf01[_0x8b9f('0x1c')]);_0x47bf01['userEmail']=_0x47bf01[_0x8b9f('0x1c')];for(_0x103e6c=0x0;_0x103e6c<_0x3c9ebf[_0x8b9f('0x12')];_0x103e6c++){if(_0x3c9ebf[_0x103e6c][_0x8b9f('0x13')]===_0x47bf01['agentEmail']){_0x491476=!![];_0x47bf01[_0x8b9f('0x1e')]=_0x3c9ebf[_0x103e6c]['id'];logger[_0x8b9f('0xf')](_0x8b9f('0x1f'),_0x47bf01[_0x8b9f('0x1e')]);}}}if(!_0x491476){logger[_0x8b9f('0xf')](_0x8b9f('0x20'));_0x47bf01[_0x8b9f('0x21')]=_0x47bf01[_0x8b9f('0x14')];_0x47bf01[_0x8b9f('0x1e')]=_0x47bf01[_0x8b9f('0x15')];_0x491476=!![];}if(_0x491476){_0x43bfd1(_0x47bf01);}else{_0x2660c1({'statusCode':0x194,'message':_0x8b9f('0x16')});}}else{_0x2660c1({'statusCode':0x194,'message':_0x8b9f('0x16')});}})[_0x8b9f('0x17')](function(_0xe7244e){logger['error']('['+[_0x32ef1a[_0x8b9f('0x19')]()]+']',_0xe7244e[_0x8b9f('0x1a')]);_0x2660c1(_0xe7244e);});});};}function searchContact(_0x10dc3d,_0x29e0fb,_0x55bf52,_0x410196){return new Promise(function(_0x40f355,_0x1611ef){var _0x59379f={'method':'GET','headers':_0x29e0fb,'uri':_0x10dc3d+_0x8b9f('0x22')+_0x410196+_0x8b9f('0x23')+_0x55bf52+_0x8b9f('0x24'),'json':!![]};rp(_0x59379f)['then'](function(_0x100134){var _0x115934=_[_0x8b9f('0x25')](_0x100134['contacts'][_0x8b9f('0x26')],[_0x55bf52,_0x410196]);_0x40f355(_0x115934);})[_0x8b9f('0x17')](function(_0x158d9f){_0x1611ef(_0x158d9f);});});}function getEndUser(_0x3af719,_0x4eb6df,_0x57aa27){return function(_0x17cfcf){return new Promise(function(_0x38b290,_0x231934){logger['info'](util[_0x8b9f('0x27')]('Searching\x20contact\x20with\x20phone\x20%s',_0x17cfcf['contactNumber']));searchContact(_0x57aa27,_0x4eb6df,_0x8b9f('0x28'),_0x17cfcf[_0x8b9f('0x29')])['then'](function(_0x17bf70){if(_0x17bf70){_0x17cfcf[_0x8b9f('0x2a')]=_0x17bf70['id'];logger[_0x8b9f('0xf')](_0x8b9f('0x2b'),_0x17cfcf['endUserId']);return _0x38b290(_0x17cfcf);}searchContact(_0x57aa27,_0x4eb6df,_0x8b9f('0x2c'),_0x17cfcf[_0x8b9f('0x29')])[_0x8b9f('0x2d')](function(_0x2befdb){if(_0x2befdb){_0x17cfcf[_0x8b9f('0x2a')]=_0x2befdb['id'];logger['info']('Contact\x20found\x20work_number:',_0x17cfcf[_0x8b9f('0x2a')]);return _0x38b290(_0x17cfcf);}createEndUser(_0x17cfcf,_0x3af719,_0x4eb6df,_0x57aa27)[_0x8b9f('0x2d')](function(_0x1cfea5){logger[_0x8b9f('0xf')](_0x8b9f('0x2e'),_0x1cfea5[_0x8b9f('0x2a')]);return _0x38b290(_0x1cfea5);});});})['catch'](function(_0x3dfffe){_0x231934(_0x3dfffe);});});};}function createEndUser(_0x124b2a,_0x7386ca,_0x1fbb03,_0x22392c){return new Promise(function(_0x379caf,_0x320e0e){var _0x1f74dc=moment();var _0x17ed80={'method':_0x8b9f('0x2f'),'uri':_0x22392c+'/api/contacts','body':{'contact':{'last_name':_0x124b2a[_0x8b9f('0x29')],'work_number':_0x124b2a[_0x8b9f('0x29')],'mobile_number':_0x124b2a['contactNumber'],'owner_id':_0x124b2a['userId'],'created_at':_0x1f74dc[_0x8b9f('0x27')]('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x17ed80['headers']=_0x1fbb03;logger[_0x8b9f('0xf')](_0x8b9f('0x30'));return rp(_0x17ed80)['then'](function(_0x11e4f7){_0x124b2a['endUserId']=_0x11e4f7[_0x8b9f('0x31')]['id'];_0x379caf(_0x124b2a);})[_0x8b9f('0x17')](function(_0x53a359){logger[_0x8b9f('0x18')]('['+[_0x7386ca[_0x8b9f('0x19')]()]+']',_0x53a359[_0x8b9f('0x1a')]);_0x320e0e(_0x53a359['message']);});});}function getTicket(_0x3bded6,_0x1ed377,_0x58c3f5,_0x27bfd7,_0x183c45){return function(_0xb2fdfd){logger[_0x8b9f('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x199e8a,_0x589ddd){var _0x594346=moment();var _0x2dcfc8={'method':_0x8b9f('0x2f'),'uri':_0x58c3f5+_0x8b9f('0x32'),'body':{'title':intUtil[_0x8b9f('0x33')](_0x27bfd7[_0x8b9f('0x34')],_0x183c45,'\x20'),'description':intUtil[_0x8b9f('0x33')](_0x27bfd7['Descriptions'],_0x183c45,'\x0a'),'owner_id':_0xb2fdfd[_0x8b9f('0x1e')],'creater_id':_0xb2fdfd[_0x8b9f('0x15')],'targetable_id':_0xb2fdfd[_0x8b9f('0x2a')],'targetable_type':_0x8b9f('0x35'),'created_at':_0x594346[_0x8b9f('0x27')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x594346[_0x8b9f('0x36')](0x1e,'m')[_0x8b9f('0x27')](_0x8b9f('0x37'))},'json':!![]};_0x2dcfc8[_0x8b9f('0xe')]=_0x1ed377;return rp(_0x2dcfc8)[_0x8b9f('0x2d')](function(_0x402a1d){_0xb2fdfd[_0x8b9f('0x38')]=_0x402a1d[_0x8b9f('0x39')]['id'];logger['info'](_0x8b9f('0x3a'),_0xb2fdfd[_0x8b9f('0x38')]);_0x199e8a(_0xb2fdfd);})[_0x8b9f('0x17')](function(_0xa0e4e1){logger['error']('['+[_0x3bded6[_0x8b9f('0x19')]()]+']',_0xa0e4e1[_0x8b9f('0x1a')]);_0x589ddd(_0xa0e4e1[_0x8b9f('0x1a')]);});});};}function emit(_0xcd100a,_0x4bebce,_0x17ae2f){var _0x21cd5f={'uri':_0xcd100a+_0x8b9f('0x3b')+_0x17ae2f};io['to'](util['format']('user:%s',_0x4bebce))[_0x8b9f('0x3c')](_0x8b9f('0x3d'),_0x21cd5f);}exports['cs']=function(_0x5dfc05,_0x10f2af,_0x58bca2,_0x54d0d9,_0x1ae0c5,_0x3d4c89,_0x190abb,_0x1f154d){var _0x4d26b6={};var _0x37c3da={'Authorization':_0x8b9f('0x3e')+_0x3d4c89['apiKey']};_0x3d4c89['remoteUri']=intUtil[_0x8b9f('0x3f')](_0x3d4c89[_0x8b9f('0x40')]);_0x3d4c89['serverUrl']=intUtil[_0x8b9f('0x3f')](_0x3d4c89[_0x8b9f('0x41')]);var _0x5496d2=_0x3d4c89['remoteUri'];_0x4d26b6[_0x8b9f('0x14')]=_0x3d4c89[_0x8b9f('0x42')];_0x4d26b6[_0x8b9f('0x29')]=_0x1f154d[_0x8b9f('0x43')]()===_0x8b9f('0x44')?_0x10f2af['destcalleridnum']:_0x10f2af[_0x8b9f('0x45')];_0x4d26b6[_0x8b9f('0x46')]=_0x1f154d===_0x8b9f('0x47')||_0x1f154d===_0x8b9f('0x48')?_0x8b9f('0x47'):_0x8b9f('0x44');if(_0x54d0d9){_0x4d26b6[_0x8b9f('0x1c')]=_0x54d0d9[_0x8b9f('0x13')];}var _0x449353=util[_0x8b9f('0x27')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d4c89[_0x8b9f('0x41')],_0x10f2af['uniqueid'],md5(_0x10f2af['uniqueid']));if(_0x1ae0c5&&_0x1ae0c5['monitor_format']){logger['info'](_0x8b9f('0x49'),_0x8b9f('0x4a'));_0x10f2af['recordingURL']=_0x449353;}else if(_0x190abb&&_0x190abb[_0x8b9f('0x4b')]&&_0x190abb[_0x8b9f('0x4b')]!==_0x8b9f('0x4c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x10f2af[_0x8b9f('0x4d')]=_0x449353;}else{_0x10f2af['recordingURL']='';}return getAdminId(_0x4d26b6,_0x1f154d,_0x37c3da,_0x5496d2)[_0x8b9f('0x2d')](getUser(_0x1f154d,_0x37c3da,_0x5496d2))[_0x8b9f('0x2d')](getEndUser(_0x1f154d,_0x37c3da,_0x5496d2))['then'](getTicket(_0x1f154d,_0x37c3da,_0x5496d2,_0x58bca2,_0x10f2af))[_0x8b9f('0x2d')](function(_0x249b81){logger['info'](util[_0x8b9f('0x27')](_0x8b9f('0x4e'),_0x249b81['ticketId']));if(_0x1f154d!==_0x8b9f('0x48')){logger[_0x8b9f('0xf')]('['+[_0x1f154d['toUpperCase']()]+']',_0x8b9f('0x4f'));emit(_0x5496d2,_0x54d0d9['name'],_0x249b81[_0x8b9f('0x2a')]);}})['catch'](function(_0x4929c3){logger[_0x8b9f('0x18')]('['+[_0x1f154d[_0x8b9f('0x19')]()]+_0x8b9f('0x50'),util[_0x8b9f('0x51')](_0x4929c3,{'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 574c69e..e419f4e 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 _0xc4bd=['lodash','util','./zendesk','./salesforce','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','data2','find','Configurations','queue','routeId','outbound','log','unmanaged','toLowerCase','zendesk','salesforce','desk','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','error','%s\x20account\x20#%s\x20not\x20found'];(function(_0x437cc1,_0x194bc7){var _0x270685=function(_0x12796d){while(--_0x12796d){_0x437cc1['push'](_0x437cc1['shift']());}};_0x270685(++_0x194bc7);}(_0xc4bd,0x75));var _0xdc4b=function(_0x420023,_0x24bdc0){_0x420023=_0x420023-0x0;var _0x1f7de8=_0xc4bd[_0x420023];return _0x1f7de8;};'use strict';var _=require(_0xdc4b('0x0'));var util=require(_0xdc4b('0x1'));var zendesk=require(_0xdc4b('0x2'));var salesforce=require(_0xdc4b('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require('./freshdesk');var zoho=require(_0xdc4b('0x4'));var desk=require(_0xdc4b('0x5'));var vtiger=require(_0xdc4b('0x6'));var servicenow=require(_0xdc4b('0x7'));var dynamics365=require(_0xdc4b('0x8'));var freshsales=require(_0xdc4b('0x9'));var integrations=['zendesk','salesforce',_0xdc4b('0xa'),_0xdc4b('0xb'),_0xdc4b('0xc'),'desk',_0xdc4b('0xd'),_0xdc4b('0xe'),_0xdc4b('0xf'),_0xdc4b('0x10')];exports[_0xdc4b('0x11')]=function(_0xbbced6,_0x58f89d,_0xd940a,_0x49e7ce,_0x48abc9,_0x50ad80){if(_0xd940a){if(_[_0xdc4b('0x12')](integrations,_0xbbced6[_0xdc4b('0x13')]['toLowerCase']())){try{var _0x20a9ab=null;var _0x9a6c80='';var _0x334eac=_0xd940a[_0xbbced6[_0xdc4b('0x13')]['toLowerCase']()];if(_0x334eac){var _0x2379c9=_0x334eac[_0xbbced6[_0xdc4b('0x14')]];if(_0x2379c9){var _0x17734f=_[_0xdc4b('0x15')](_0x2379c9[_0xdc4b('0x16')],{'id':parseInt(_0xbbced6['data3'],0xa)});if(_0x17734f){if(_0x49e7ce){if(_0x48abc9&&_0x58f89d[_0xdc4b('0x17')]){_0x9a6c80=_0xdc4b('0x17');}else if(_0x58f89d[_0xdc4b('0x18')]){_0x9a6c80=_0xdc4b('0x19');}else{console[_0xdc4b('0x1a')]('EVENT\x20UNKNOWN',_0x58f89d);}}else{_0x9a6c80=_0xdc4b('0x1b');}switch(_0xbbced6[_0xdc4b('0x13')][_0xdc4b('0x1c')]()){case _0xdc4b('0x1d'):zendesk[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0x1e'):salesforce[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0xa'):sugarcrm[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0xb'):freshdesk[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0xc'):zoho[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0x1f'):desk[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0xd'):vtiger[_0x9a6c80](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80);break;case _0xdc4b('0xf'):freshsales['cs'](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80,_0x9a6c80);break;case'servicenow':servicenow['cs'](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80,_0x9a6c80);break;case _0xdc4b('0xe'):dynamics365['cs'](_0xbbced6,_0x58f89d,_0x17734f,_0x49e7ce,_0x48abc9,_0x2379c9,_0x50ad80,_0x9a6c80);break;default:console[_0xdc4b('0x1a')]('unknown\x20integration');}}else{_0x20a9ab=require(_0xdc4b('0x20'))(_0xbbced6[_0xdc4b('0x13')][_0xdc4b('0x1c')]());_0x20a9ab['error'](_0xdc4b('0x21'),util[_0xdc4b('0x22')](_0xdc4b('0x23'),_0xbbced6[_0xdc4b('0x13')][_0xdc4b('0x1c')](),_0xbbced6[_0xdc4b('0x24')]));}}else{_0x20a9ab=require(_0xdc4b('0x20'))(_0xbbced6[_0xdc4b('0x13')]['toLowerCase']());_0x20a9ab[_0xdc4b('0x25')](_0xdc4b('0x21'),util['format'](_0xdc4b('0x26'),_0xbbced6[_0xdc4b('0x13')][_0xdc4b('0x1c')](),_0xbbced6['data2']));}}else{}}catch(_0x26c492){console[_0xdc4b('0x25')](_0x26c492);}}}}; \ No newline at end of file +var _0xa689=['log','EVENT\x20UNKNOWN','unmanaged','sugarcrm','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./vtiger','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','vtiger','dynamics365','freshsales','servicenow','data1','toLowerCase','data2','find','Configurations','queue','routeId','outbound'];(function(_0x12e32e,_0x9f79f6){var _0x10f55f=function(_0x21c62d){while(--_0x21c62d){_0x12e32e['push'](_0x12e32e['shift']());}};_0x10f55f(++_0x9f79f6);}(_0xa689,0x174));var _0x9a68=function(_0x1598e8,_0x5df7a7){_0x1598e8=_0x1598e8-0x0;var _0x1f71da=_0xa689[_0x1598e8];return _0x1f71da;};'use strict';var _=require(_0x9a68('0x0'));var util=require(_0x9a68('0x1'));var zendesk=require(_0x9a68('0x2'));var salesforce=require(_0x9a68('0x3'));var sugarcrm=require(_0x9a68('0x4'));var freshdesk=require(_0x9a68('0x5'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x9a68('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0x9a68('0x7'));var freshsales=require(_0x9a68('0x8'));var integrations=[_0x9a68('0x9'),_0x9a68('0xa'),'sugarcrm',_0x9a68('0xb'),'zoho','desk',_0x9a68('0xc'),_0x9a68('0xd'),_0x9a68('0xe'),_0x9a68('0xf')];exports['exec']=function(_0x5bf112,_0x2a8c99,_0x2c487b,_0x5a1923,_0xcbcdfb,_0x2f6ebc){if(_0x2c487b){if(_['includes'](integrations,_0x5bf112[_0x9a68('0x10')][_0x9a68('0x11')]())){try{var _0x4cb5d7=null;var _0x128d85='';var _0x47ea23=_0x2c487b[_0x5bf112[_0x9a68('0x10')]['toLowerCase']()];if(_0x47ea23){var _0x560e20=_0x47ea23[_0x5bf112[_0x9a68('0x12')]];if(_0x560e20){var _0x15b8f7=_[_0x9a68('0x13')](_0x560e20[_0x9a68('0x14')],{'id':parseInt(_0x5bf112['data3'],0xa)});if(_0x15b8f7){if(_0x5a1923){if(_0xcbcdfb&&_0x2a8c99[_0x9a68('0x15')]){_0x128d85='queue';}else if(_0x2a8c99[_0x9a68('0x16')]){_0x128d85=_0x9a68('0x17');}else{console[_0x9a68('0x18')](_0x9a68('0x19'),_0x2a8c99);}}else{_0x128d85=_0x9a68('0x1a');}switch(_0x5bf112['data1'][_0x9a68('0x11')]()){case _0x9a68('0x9'):zendesk[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case'salesforce':salesforce[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case _0x9a68('0x1b'):sugarcrm[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case'freshdesk':freshdesk[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case _0x9a68('0x1c'):zoho[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case'desk':desk[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case _0x9a68('0xc'):vtiger[_0x128d85](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc);break;case _0x9a68('0xe'):freshsales['cs'](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc,_0x128d85);break;case _0x9a68('0xf'):servicenow['cs'](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc,_0x128d85);break;case _0x9a68('0xd'):dynamics365['cs'](_0x5bf112,_0x2a8c99,_0x15b8f7,_0x5a1923,_0xcbcdfb,_0x560e20,_0x2f6ebc,_0x128d85);break;default:console['log'](_0x9a68('0x1d'));}}else{_0x4cb5d7=require(_0x9a68('0x1e'))(_0x5bf112['data1'][_0x9a68('0x11')]());_0x4cb5d7[_0x9a68('0x1f')](_0x9a68('0x20'),util[_0x9a68('0x21')](_0x9a68('0x22'),_0x5bf112[_0x9a68('0x10')]['toLowerCase'](),_0x5bf112['data3']));}}else{_0x4cb5d7=require('../../../../config/logger')(_0x5bf112[_0x9a68('0x10')][_0x9a68('0x11')]());_0x4cb5d7[_0x9a68('0x1f')](_0x9a68('0x20'),util[_0x9a68('0x21')](_0x9a68('0x23'),_0x5bf112['data1'][_0x9a68('0x11')](),_0x5bf112[_0x9a68('0x12')]));}}else{}}catch(_0x322827){console['error'](_0x322827);}}}}; \ 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 a3818df..5801228 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 _0x236a=['./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','assign','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','sobject','find','then','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','Contact','execute','$or','Lead','account_contact_lead','additionalSearchAccount','Account','length','additionalSearchLead','account','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','','upperFirst','forEach','includes','string','picklist','idField','content','variable','variableName','customVariable','Variable','name','toString','password','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridname','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','catch','lodash','moment','bluebird','md5','jsforce','ioredis'];(function(_0x1dfcb9,_0x3f245e){var _0xc930a7=function(_0x4e8cfe){while(--_0x4e8cfe){_0x1dfcb9['push'](_0x1dfcb9['shift']());}};_0xc930a7(++_0x3f245e);}(_0x236a,0x183));var _0xa236=function(_0x280090,_0x5d0f72){_0x280090=_0x280090-0x0;var _0x5717f1=_0x236a[_0x280090];return _0x5717f1;};'use strict';var _=require(_0xa236('0x0'));var rp=require('request-promise');var moment=require(_0xa236('0x1'));var BPromise=require(_0xa236('0x2'));var md5=require(_0xa236('0x3'));var jsforce=require(_0xa236('0x4'));var util=require('util');var Redis=require(_0xa236('0x5'));var intUtil=require(_0xa236('0x6'));var config=require(_0xa236('0x7'));var logger=require(_0xa236('0x8'))('salesforce');config[_0xa236('0x9')]=_[_0xa236('0xa')](config['redis'],{'host':_0xa236('0xb'),'port':0x18eb});var io=require(_0xa236('0xc'))(new Redis(config[_0xa236('0x9')]));function emit(_0x284bd4,_0x46ddb9,_0x2248a9){io['to'](_0x284bd4)['emit'](_0x46ddb9,_0x2248a9);}function getTicket(_0x3dc1a7,_0x5527c2,_0xefe9d0,_0x41f69b,_0x59d717,_0x1e1284,_0x7e3bf,_0x1ea1a1){var _0x1700b8=Object[_0xa236('0xd')]({},{'OwnerId':_0x5527c2['id'],'Subject':intUtil['getString'](_0x41f69b['Subjects'],_0x59d717,'\x20'),'Description':intUtil['getString'](_0x41f69b[_0xa236('0xe')],_0x59d717,'\x0a')},getCustomFields(_0x1e1284,_0x59d717));if(_0xefe9d0){if(_0x41f69b[_0xa236('0xf')]===_0xa236('0x10')){_0x1700b8[_0xa236('0x11')]=moment[_0xa236('0x12')]();_0x1700b8[_0xa236('0x13')]=![];_0x1700b8[_0xa236('0x14')]=![];if(_0xefe9d0[_0xa236('0x15')]===_0xa236('0x16')||_0xefe9d0[_0xa236('0x15')]===_0xa236('0x17')){_0x1700b8[_0xa236('0x18')]=_0xefe9d0['id'];}else if(_0xefe9d0[_0xa236('0x15')]==='account'){_0x1700b8['WhatId']=_0xefe9d0['id'];}}else if(_0x41f69b[_0xa236('0xf')]==='Case'){if(_0xefe9d0['endUserType']===_0xa236('0x16')){_0x1700b8[_0xa236('0x19')]=_0xefe9d0['id'];}else if(_0xefe9d0[_0xa236('0x15')]==='account'){_0x1700b8[_0xa236('0x1a')]=_0xefe9d0['id'];}else if(_0xefe9d0['endUserType']===_0xa236('0x17')&&_0x41f69b[_0xa236('0x1b')]){_0x1700b8[_0x41f69b[_0xa236('0x1b')]]=_0xefe9d0['id'];}else{logger[_0xa236('0x1c')](_0xa236('0x1d'));}}}return _0x7e3bf['sobject'](_0x41f69b['ticketType'])[_0xa236('0x1e')](_0x1700b8);}function getUser(_0x22bb6c,_0x29326b,_0x478b42){if(!_[_0xa236('0x1f')](_0x29326b)&&intUtil['validateEmail'](_0x29326b)){var _0x26b18b={'Email':_0x29326b};var _0x3f4f2a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x478b42[_0xa236('0x20')]('User')[_0xa236('0x21')](_0x26b18b,_0x3f4f2a)['execute']()[_0xa236('0x22')](function(_0x5394aa){if(_0x5394aa['length']){var _0x462ac4=_['find'](_0x5394aa,function(_0x4dcb4c){return _0x4dcb4c[_0xa236('0x23')]===_0x29326b;});if(_0x462ac4){logger[_0xa236('0x1c')](_0xa236('0x24'),_0x29326b);return BPromise['resolve']({'id':_0x462ac4['Id'],'name':_0x462ac4[_0xa236('0x25')]});}}else{logger[_0xa236('0x1c')](_0xa236('0x26'),_0x29326b);return _0x478b42['identity']()[_0xa236('0x22')](function(_0x1a6767){return BPromise[_0xa236('0x27')]({'id':_0x1a6767[_0xa236('0x28')],'name':_0x1a6767[_0xa236('0x29')]});});}});}else{logger[_0xa236('0x1c')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x29326b);return _0x478b42[_0xa236('0x2a')]()[_0xa236('0x22')](function(_0x28c5ae){return BPromise[_0xa236('0x27')]({'id':_0x28c5ae[_0xa236('0x28')],'name':_0x28c5ae[_0xa236('0x29')]});});}}function getEndUser(_0x40aedb,_0xb6b4e0,_0x42eb13,_0x2cf16d,_0x387345){var _0x48b06c={'$or':{'Phone':_0x2cf16d}};var _0x1f5587={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa236('0x27')]()['then'](function(){logger['info'](_0xa236('0x2b'),_0x2cf16d,_0xb6b4e0[_0xa236('0x2c')]);switch(_0xb6b4e0[_0xa236('0x2c')]){case _0xa236('0x2d'):var _0x52fca1=_[_0xa236('0x2e')](_0x48b06c);if(_0xb6b4e0[_0xa236('0x2f')]){var _0x5a344c={};_0x5a344c[_0xb6b4e0[_0xa236('0x2f')]]=_0x2cf16d;_[_0xa236('0x30')](_0x52fca1['$or'],_0x5a344c);}return _0x387345['sobject'](_0xa236('0x31'))[_0xa236('0x21')](_0x52fca1,_0x1f5587)[_0xa236('0x32')]()[_0xa236('0x22')](function(_0x1d64ae){if(_0x1d64ae&&_0x1d64ae['length']){return _0x1d64ae;}else{var _0x3bb353=_['cloneDeep'](_0x48b06c);if(_0xb6b4e0['additionalSearchLead']){var _0x3b5d47={};_0x3b5d47[_0xb6b4e0['additionalSearchLead']]=_0x2cf16d;_[_0xa236('0x30')](_0x3bb353[_0xa236('0x33')],_0x3b5d47);}return _0x387345[_0xa236('0x20')](_0xa236('0x34'))['find'](_0x3bb353,_0x1f5587);}});case _0xa236('0x35'):var _0x351b44=_['cloneDeep'](_0x48b06c);if(_0xb6b4e0[_0xa236('0x36')]){var _0x5a344c={};_0x5a344c[_0xb6b4e0[_0xa236('0x36')]]=_0x2cf16d;_[_0xa236('0x30')](_0x351b44[_0xa236('0x33')],_0x5a344c);}return _0x387345[_0xa236('0x20')](_0xa236('0x37'))[_0xa236('0x21')](_0x351b44,_0x1f5587)['execute']()[_0xa236('0x22')](function(_0x5d60e3){if(_0x5d60e3&&_0x5d60e3[_0xa236('0x38')]){return _0x5d60e3;}else{var _0x225c93=_[_0xa236('0x2e')](_0x48b06c);if(_0xb6b4e0[_0xa236('0x2f')]){var _0x25c402={};_0x25c402[_0xb6b4e0['additionalSearchContact']]=_0x2cf16d;_['merge'](_0x225c93[_0xa236('0x33')],_0x25c402);}return _0x387345[_0xa236('0x20')](_0xa236('0x31'))['find'](_0x225c93,_0x1f5587)['then'](function(_0x317e8e){if(_0x317e8e&&_0x317e8e[_0xa236('0x38')]){return _0x317e8e;}else{var _0x579395=_['cloneDeep'](_0x48b06c);if(_0xb6b4e0[_0xa236('0x39')]){var _0x788651={};_0x788651[_0xb6b4e0[_0xa236('0x39')]]=_0x2cf16d;_[_0xa236('0x30')](_0x579395['$or'],_0x788651);}return _0x387345[_0xa236('0x20')]('Lead')[_0xa236('0x21')](_0x579395,_0x1f5587);}});}});case _0xa236('0x16'):var _0x52fca1=_[_0xa236('0x2e')](_0x48b06c);if(_0xb6b4e0['additionalSearchContact']){var _0x5a344c={};_0x5a344c[_0xb6b4e0[_0xa236('0x2f')]]=_0x2cf16d;_[_0xa236('0x30')](_0x52fca1[_0xa236('0x33')],_0x5a344c);}return _0x387345['sobject'](_0xa236('0x31'))['find'](_0x52fca1,_0x1f5587)[_0xa236('0x32')]();case _0xa236('0x17'):var _0x5b9ade=_['cloneDeep'](_0x48b06c);if(_0xb6b4e0[_0xa236('0x39')]){var _0x5a344c={};_0x5a344c[_0xb6b4e0[_0xa236('0x39')]]=_0x2cf16d;_[_0xa236('0x30')](_0x5b9ade['$or'],_0x5a344c);}return _0x387345['sobject'](_0xa236('0x34'))['find'](_0x5b9ade,_0x1f5587);case _0xa236('0x3a'):var _0x351b44=_[_0xa236('0x2e')](_0x48b06c);if(_0xb6b4e0['additionalSearchAccount']){var _0x5a344c={};_0x5a344c[_0xb6b4e0[_0xa236('0x36')]]=_0x2cf16d;_['merge'](_0x351b44[_0xa236('0x33')],_0x5a344c);}return _0x387345[_0xa236('0x20')](_0xa236('0x37'))[_0xa236('0x21')](_0x351b44,_0x1f5587);default:return null;}})['then'](function(_0x22b9a4){if(_0x22b9a4&&_0x22b9a4[_0xa236('0x38')]){var _0x38840b=_['first'](_0x22b9a4);if(_0x38840b){return BPromise[_0xa236('0x27')]({'id':_0x38840b['Id'],'name':_0x38840b['Name'],'phone':_0x38840b['Phone'],'endUserType':_0x38840b[_0xa236('0x3b')][_0xa236('0x3c')][_0xa236('0x3d')]()});}}})[_0xa236('0x22')](function(_0x3aea93){if(_0x3aea93){logger[_0xa236('0x1c')](_0xa236('0x3e'),_0x3aea93[_0xa236('0x15')],_0x2cf16d);return BPromise[_0xa236('0x27')](_0x3aea93);}else{logger[_0xa236('0x1c')](_0xa236('0x3f'),_0x2cf16d);var _0x136ba2={'Phone':_0x2cf16d};if(_0xb6b4e0['moduleCreate']){if(_0xb6b4e0[_0xa236('0x40')]===_0xa236('0x16')){logger[_0xa236('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2cf16d,_0xb6b4e0[_0xa236('0x40')]);_0x136ba2[_0xa236('0x41')]=_0x42eb13!==''?_0x42eb13:util[_0xa236('0x42')](_0xa236('0x43'),_0x2cf16d);}else if(_0xb6b4e0[_0xa236('0x40')]===_0xa236('0x17')){logger[_0xa236('0x1c')](_0xa236('0x44'),_0x2cf16d,_0xb6b4e0[_0xa236('0x40')]);_0x136ba2[_0xa236('0x41')]=_0x42eb13!==''?_0x42eb13:util[_0xa236('0x42')](_0xa236('0x43'),_0x2cf16d);_0x136ba2[_0xa236('0x45')]=_0xa236('0x46');}else if(_0xb6b4e0[_0xa236('0x40')]===_0xa236('0x3a')){logger[_0xa236('0x1c')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2cf16d,_0xb6b4e0['moduleCreate']);_0x136ba2[_0xa236('0x25')]=_0x42eb13!==_0xa236('0x47')?_0x42eb13:util[_0xa236('0x42')](_0xa236('0x43'),_0x2cf16d);}else{return null;}}return _0x387345['sobject'](_[_0xa236('0x48')](_0xb6b4e0[_0xa236('0x40')]))['create'](_0x136ba2)[_0xa236('0x22')](function(_0x36e549){return BPromise['resolve']({'id':_0x36e549['id'],'endUserType':_0xb6b4e0[_0xa236('0x40')]});});}});}function getCustomFields(_0x3e3a79,_0x2bba90){var _0x45f772={};if(_0x3e3a79[_0xa236('0x38')]>0x0){_[_0xa236('0x49')](_0x3e3a79,function(_0xe62b79){if(_[_0xa236('0x4a')]([_0xa236('0x4b'),_0xa236('0x4c')],_0xe62b79[_0xa236('0x3c')])&&_0xe62b79['idField']){_0x45f772[_0xe62b79[_0xa236('0x4d')]]=_0xe62b79[_0xa236('0x4e')]['toString']();}else if(_0xe62b79[_0xa236('0x3c')]===_0xa236('0x4f')&&_0xe62b79[_0xa236('0x50')]&&_0xe62b79[_0xa236('0x4d')]){_0x2bba90[_0xe62b79['variableName']]&&(_0x45f772[_0xe62b79[_0xa236('0x4d')]]=_0x2bba90[_0xe62b79['variableName']]['toString']());}else if(_0xe62b79['type']===_0xa236('0x51')&&_0xe62b79['Variable']&&_0xe62b79[_0xa236('0x52')]['name']&&_0xe62b79[_0xa236('0x4d')]){_0x2bba90[_0xe62b79[_0xa236('0x52')][_0xa236('0x53')][_0xa236('0x3d')]()]&&(_0x45f772[_0xe62b79[_0xa236('0x4d')]]=_0x2bba90[_0xe62b79[_0xa236('0x52')]['name'][_0xa236('0x3d')]()][_0xa236('0x54')]());}});}return _0x45f772;}function getConnection(_0x3a4c2d){var _0x488544=_0x3a4c2d[_0xa236('0x55')][_0xa236('0x56')](_0x3a4c2d[_0xa236('0x57')]);var _0x2e2a82=new jsforce['Connection']({'oauth2':{'loginUrl':_0x3a4c2d[_0xa236('0x58')]||_0xa236('0x59'),'clientId':_0x3a4c2d[_0xa236('0x5a')],'clientSecret':_0x3a4c2d['clientSecret']}});return _0x2e2a82[_0xa236('0x5b')](_0x3a4c2d[_0xa236('0x5c')],_0x488544)[_0xa236('0x22')](function(){logger[_0xa236('0x1c')](_0xa236('0x5d'));return _0x2e2a82;});}exports[_0xa236('0x5e')]=function(_0xbfc813,_0x555e26,_0x286462,_0x517da7,_0x22de0e,_0xc2896a){var _0x1c644e,_0x36f27b,_0x5e4264,_0x4c67ec;_0xc2896a[_0xa236('0x5f')]=intUtil['stripTrailingSlash'](_0xc2896a[_0xa236('0x5f')]);_0xc2896a[_0xa236('0x58')]=intUtil['stripTrailingSlash'](_0xc2896a['remoteUri']);if(_0x22de0e&&_0x22de0e[_0xa236('0x60')]){logger[_0xa236('0x1c')]('[QUEUE]',_0xa236('0x61'));_0x555e26[_0xa236('0x62')]=util[_0xa236('0x42')](_0xa236('0x63'),_0xc2896a[_0xa236('0x5f')],_0x555e26['uniqueid'],md5(_0x555e26[_0xa236('0x64')]));}else{_0x555e26[_0xa236('0x62')]='';}return getConnection(_0xc2896a)[_0xa236('0x22')](function(_0x43074e){_0x4c67ec=_0x43074e;return getUser(_0xc2896a,_0x517da7[_0xa236('0x65')],_0x4c67ec);})[_0xa236('0x22')](function(_0x2fbb93){_0x1c644e=_0x2fbb93;return getEndUser(_0xc2896a,_0x286462,_0x555e26['calleridname'],_0x555e26[_0xa236('0x66')],_0x4c67ec);})[_0xa236('0x22')](function(_0x18d296){_0x36f27b=_0x18d296;return getTicket(_0xc2896a,_0x1c644e,_0x36f27b,_0x286462,_0x555e26,_0x286462['Fields'],_0x4c67ec,'queue');})[_0xa236('0x22')](function(_0x102fd4){_0x5e4264=_0x102fd4;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x5e4264['id']);logger[_0xa236('0x1c')](_0xa236('0x67'),_0x5e4264['id'],_0x517da7[_0xa236('0x53')],_0xc2896a[_0xa236('0x3c')]);switch(_0xc2896a[_0xa236('0x3c')]){case _0xa236('0x68'):emit(util[_0xa236('0x42')]('user:%s',_0x517da7[_0xa236('0x53')]),_0xa236('0x69'),{'recordId':_0x5e4264['id']});break;case _0xa236('0x6a'):emit(util[_0xa236('0x42')](_0xa236('0x6b'),_0x517da7[_0xa236('0x53')]),_0xa236('0x6c'),{'uri':util['format']('%s/%s/e',_0x4c67ec[_0xa236('0x6d')],_0x5e4264['id'])});break;default:logger[_0xa236('0x6e')](_0xa236('0x6f'));}})['catch'](function(_0x5a5577){logger[_0xa236('0x6e')](_0xa236('0x70'),_0x5a5577);});};exports[_0xa236('0x71')]=function(_0x356cbd,_0x4ce5ba,_0x5ca1b3,_0x2dfbfc,_0x158cbb,_0x1a32e3,_0x43ef6d){var _0x9993e2,_0x3a1553,_0x208262,_0x124f2e;_0x1a32e3['serverUrl']=intUtil[_0xa236('0x72')](_0x1a32e3[_0xa236('0x5f')]);_0x1a32e3[_0xa236('0x58')]=intUtil['stripTrailingSlash'](_0x1a32e3['remoteUri']);if(_0x43ef6d&&_0x43ef6d['recordingFormat']&&_0x43ef6d[_0xa236('0x73')]!==_0xa236('0x74')){logger[_0xa236('0x1c')](_0xa236('0x75'),_0xa236('0x61'));_0x4ce5ba['recordingURL']=util[_0xa236('0x42')](_0xa236('0x63'),_0x1a32e3[_0xa236('0x5f')],_0x4ce5ba[_0xa236('0x64')],md5(_0x4ce5ba[_0xa236('0x64')]));}return getConnection(_0x1a32e3)[_0xa236('0x22')](function(_0x976bf1){_0x124f2e=_0x976bf1;return getUser(_0x1a32e3,_0x2dfbfc[_0xa236('0x65')],_0x124f2e);})['then'](function(_0xde26b5){_0x9993e2=_0xde26b5;return getEndUser(_0x1a32e3,_0x5ca1b3,_0x4ce5ba[_0xa236('0x76')],_0x4ce5ba['destcalleridnum'],_0x124f2e);})[_0xa236('0x22')](function(_0x5ac926){_0x3a1553=_0x5ac926;return getTicket(_0x1a32e3,_0x9993e2,_0x3a1553,_0x5ca1b3,_0x4ce5ba,_0x5ca1b3[_0xa236('0x77')],_0x124f2e,_0xa236('0x71'));})[_0xa236('0x22')](function(_0x177dd7){_0x208262=_0x177dd7;logger['info'](_0xa236('0x78'),_0x208262['id']);logger[_0xa236('0x1c')](_0xa236('0x79'),_0x208262['id'],_0x2dfbfc[_0xa236('0x53')],_0x1a32e3[_0xa236('0x3c')]);switch(_0x1a32e3[_0xa236('0x3c')]){case _0xa236('0x68'):emit(util[_0xa236('0x42')](_0xa236('0x6b'),_0x2dfbfc[_0xa236('0x53')]),_0xa236('0x69'),{'recordId':_0x208262['id']});break;case _0xa236('0x6a'):emit(util['format'](_0xa236('0x6b'),_0x2dfbfc[_0xa236('0x53')]),_0xa236('0x6c'),{'uri':util[_0xa236('0x42')](_0xa236('0x7a'),_0x124f2e['instanceUrl'],_0x208262['id'])});break;default:logger[_0xa236('0x6e')](_0xa236('0x75'),_0xa236('0x7b'));}})['catch'](function(_0x380170){logger['error']('[OUTBOUND]',_0x380170);});};exports[_0xa236('0x7c')]=function(_0x4b6de0,_0x3f4248,_0x53fb08,_0x240a96,_0x2de007,_0x408334){var _0x1e9ad4,_0x588eaf,_0xf5588,_0x347e92;_0x408334[_0xa236('0x5f')]=intUtil[_0xa236('0x72')](_0x408334['serverUrl']);_0x408334[_0xa236('0x58')]=intUtil[_0xa236('0x72')](_0x408334[_0xa236('0x58')]);if(_0x2de007&&_0x2de007[_0xa236('0x60')]){logger[_0xa236('0x1c')]('['+_0x3f4248['lastevent'][_0xa236('0x7d')]()+']','Recording\x20is\x20enabled!');_0x3f4248['recordingURL']=util['format'](_0xa236('0x63'),_0x408334[_0xa236('0x5f')],_0x3f4248['uniqueid'],md5(_0x3f4248['uniqueid']));}else{_0x3f4248['recordingURL']='';}return getConnection(_0x408334)[_0xa236('0x22')](function(_0x2d7a79){_0x347e92=_0x2d7a79;if(!_[_0xa236('0x1f')](_0x240a96)){return getUser(_0x408334,_0x240a96[_0xa236('0x53')],_0x347e92);}else{return getUser(_0x408334,null,_0x347e92);}})[_0xa236('0x22')](function(_0x2a5900){_0x1e9ad4=_0x2a5900;return getEndUser(_0x408334,_0x53fb08,_0x3f4248[_0xa236('0x7e')],_0x3f4248['calleridnum'],_0x347e92);})[_0xa236('0x22')](function(_0x41ab7c){_0x588eaf=_0x41ab7c;return getTicket(_0x408334,_0x1e9ad4,_0x588eaf,_0x53fb08,_0x3f4248,_0x53fb08[_0xa236('0x77')],_0x347e92);})[_0xa236('0x22')](function(_0x557646){_0xf5588=_0x557646;logger[_0xa236('0x1c')]('['+_0x3f4248[_0xa236('0x7f')][_0xa236('0x7d')]()+_0xa236('0x80'),_0xf5588['id']);logger[_0xa236('0x1c')]('['+_0x3f4248['lastevent'][_0xa236('0x7d')]()+_0xa236('0x81'),_0x408334['type']);})[_0xa236('0x82')](function(_0x45a992){logger[_0xa236('0x6e')]('['+_0x3f4248[_0xa236('0x7f')]['toUpperCase']()+']',_0x45a992);});}; \ No newline at end of file +var _0x61ad=['socket.io-emitter','emit','assign','getString','Subjects','ticketType','Task','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','account','WhatId','Case','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','execute','length','Email','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','resolve','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','additionalSearchLead','$or','Lead','account_contact_lead','additionalSearchAccount','Account','Contact','first','type','toLowerCase','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','string','idField','content','variableName','toString','customVariable','Variable','name','password','concat','securityToken','Connection','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','calleridnum','lastevent','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x61ad,0x1eb));var _0xd61a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61ad[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd61a('0x0'));var rp=require(_0xd61a('0x1'));var moment=require(_0xd61a('0x2'));var BPromise=require(_0xd61a('0x3'));var md5=require(_0xd61a('0x4'));var jsforce=require(_0xd61a('0x5'));var util=require(_0xd61a('0x6'));var Redis=require(_0xd61a('0x7'));var intUtil=require('./util');var config=require(_0xd61a('0x8'));var logger=require(_0xd61a('0x9'))(_0xd61a('0xa'));config['redis']=_[_0xd61a('0xb')](config[_0xd61a('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0xd61a('0xd'))(new Redis(config[_0xd61a('0xc')]));function emit(_0x55b1fe,_0xaf887f,_0x3247b8){io['to'](_0x55b1fe)[_0xd61a('0xe')](_0xaf887f,_0x3247b8);}function getTicket(_0x50feb3,_0x39a5d7,_0x455896,_0x21d0d9,_0x2c3a7f,_0x1d1c5b,_0x560c40,_0x6c891e){var _0x273a6f=Object[_0xd61a('0xf')]({},{'OwnerId':_0x39a5d7['id'],'Subject':intUtil[_0xd61a('0x10')](_0x21d0d9[_0xd61a('0x11')],_0x2c3a7f,'\x20'),'Description':intUtil['getString'](_0x21d0d9['Descriptions'],_0x2c3a7f,'\x0a')},getCustomFields(_0x1d1c5b,_0x2c3a7f));if(_0x455896){if(_0x21d0d9[_0xd61a('0x12')]===_0xd61a('0x13')){_0x273a6f['ActivityDate']=moment[_0xd61a('0x14')]();_0x273a6f[_0xd61a('0x15')]=![];_0x273a6f[_0xd61a('0x16')]=![];if(_0x455896[_0xd61a('0x17')]===_0xd61a('0x18')||_0x455896[_0xd61a('0x17')]===_0xd61a('0x19')){_0x273a6f['WhoId']=_0x455896['id'];}else if(_0x455896[_0xd61a('0x17')]===_0xd61a('0x1a')){_0x273a6f[_0xd61a('0x1b')]=_0x455896['id'];}}else if(_0x21d0d9[_0xd61a('0x12')]===_0xd61a('0x1c')){if(_0x455896[_0xd61a('0x17')]==='contact'){_0x273a6f['ContactId']=_0x455896['id'];}else if(_0x455896['endUserType']===_0xd61a('0x1a')){_0x273a6f['AccountId']=_0x455896['id'];}else if(_0x455896['endUserType']==='lead'&&_0x21d0d9[_0xd61a('0x1d')]){_0x273a6f[_0x21d0d9[_0xd61a('0x1d')]]=_0x455896['id'];}else{logger[_0xd61a('0x1e')](_0xd61a('0x1f'));}}}return _0x560c40[_0xd61a('0x20')](_0x21d0d9[_0xd61a('0x12')])[_0xd61a('0x21')](_0x273a6f);}function getUser(_0x2920ad,_0x162f71,_0x3523a){if(!_[_0xd61a('0x22')](_0x162f71)&&intUtil[_0xd61a('0x23')](_0x162f71)){var _0x15531a={'Email':_0x162f71};var _0x1ade3a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3523a[_0xd61a('0x20')]('User')[_0xd61a('0x24')](_0x15531a,_0x1ade3a)[_0xd61a('0x25')]()['then'](function(_0x7f8da6){if(_0x7f8da6[_0xd61a('0x26')]){var _0x56bc1d=_[_0xd61a('0x24')](_0x7f8da6,function(_0x31fc48){return _0x31fc48[_0xd61a('0x27')]===_0x162f71;});if(_0x56bc1d){logger[_0xd61a('0x1e')](_0xd61a('0x28'),_0x162f71);return BPromise['resolve']({'id':_0x56bc1d['Id'],'name':_0x56bc1d[_0xd61a('0x29')]});}}else{logger[_0xd61a('0x1e')](_0xd61a('0x2a'),_0x162f71);return _0x3523a[_0xd61a('0x2b')]()[_0xd61a('0x2c')](function(_0x6cb6f5){return BPromise[_0xd61a('0x2d')]({'id':_0x6cb6f5[_0xd61a('0x2e')],'name':_0x6cb6f5[_0xd61a('0x2f')]});});}});}else{logger['info'](_0xd61a('0x2a'),_0x162f71);return _0x3523a[_0xd61a('0x2b')]()[_0xd61a('0x2c')](function(_0x4764c4){return BPromise['resolve']({'id':_0x4764c4[_0xd61a('0x2e')],'name':_0x4764c4[_0xd61a('0x2f')]});});}}function getEndUser(_0x4d9a67,_0x2cd99a,_0x2e45ed,_0x2a4404,_0x5092ea){var _0x1f1207={'$or':{'Phone':_0x2a4404}};var _0x465656={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xd61a('0x2d')]()['then'](function(){logger[_0xd61a('0x1e')](_0xd61a('0x30'),_0x2a4404,_0x2cd99a[_0xd61a('0x31')]);switch(_0x2cd99a[_0xd61a('0x31')]){case _0xd61a('0x32'):var _0x47fa1e=_[_0xd61a('0x33')](_0x1f1207);if(_0x2cd99a['additionalSearchContact']){var _0x2b21e2={};_0x2b21e2[_0x2cd99a[_0xd61a('0x34')]]=_0x2a4404;_[_0xd61a('0x35')](_0x47fa1e['$or'],_0x2b21e2);}return _0x5092ea['sobject']('Contact')[_0xd61a('0x24')](_0x47fa1e,_0x465656)['execute']()[_0xd61a('0x2c')](function(_0x1151ec){if(_0x1151ec&&_0x1151ec[_0xd61a('0x26')]){return _0x1151ec;}else{var _0x4183ea=_['cloneDeep'](_0x1f1207);if(_0x2cd99a['additionalSearchLead']){var _0x2bda44={};_0x2bda44[_0x2cd99a[_0xd61a('0x36')]]=_0x2a4404;_[_0xd61a('0x35')](_0x4183ea[_0xd61a('0x37')],_0x2bda44);}return _0x5092ea['sobject'](_0xd61a('0x38'))[_0xd61a('0x24')](_0x4183ea,_0x465656);}});case _0xd61a('0x39'):var _0x1ab10b=_['cloneDeep'](_0x1f1207);if(_0x2cd99a[_0xd61a('0x3a')]){var _0x2b21e2={};_0x2b21e2[_0x2cd99a[_0xd61a('0x3a')]]=_0x2a4404;_[_0xd61a('0x35')](_0x1ab10b[_0xd61a('0x37')],_0x2b21e2);}return _0x5092ea[_0xd61a('0x20')](_0xd61a('0x3b'))[_0xd61a('0x24')](_0x1ab10b,_0x465656)[_0xd61a('0x25')]()['then'](function(_0x289643){if(_0x289643&&_0x289643[_0xd61a('0x26')]){return _0x289643;}else{var _0x4d932b=_[_0xd61a('0x33')](_0x1f1207);if(_0x2cd99a[_0xd61a('0x34')]){var _0x28c6d1={};_0x28c6d1[_0x2cd99a['additionalSearchContact']]=_0x2a4404;_[_0xd61a('0x35')](_0x4d932b[_0xd61a('0x37')],_0x28c6d1);}return _0x5092ea['sobject'](_0xd61a('0x3c'))[_0xd61a('0x24')](_0x4d932b,_0x465656)[_0xd61a('0x2c')](function(_0x26e830){if(_0x26e830&&_0x26e830[_0xd61a('0x26')]){return _0x26e830;}else{var _0x304007=_[_0xd61a('0x33')](_0x1f1207);if(_0x2cd99a[_0xd61a('0x36')]){var _0x580aa3={};_0x580aa3[_0x2cd99a[_0xd61a('0x36')]]=_0x2a4404;_[_0xd61a('0x35')](_0x304007['$or'],_0x580aa3);}return _0x5092ea[_0xd61a('0x20')](_0xd61a('0x38'))[_0xd61a('0x24')](_0x304007,_0x465656);}});}});case _0xd61a('0x18'):var _0x47fa1e=_[_0xd61a('0x33')](_0x1f1207);if(_0x2cd99a[_0xd61a('0x34')]){var _0x2b21e2={};_0x2b21e2[_0x2cd99a[_0xd61a('0x34')]]=_0x2a4404;_['merge'](_0x47fa1e['$or'],_0x2b21e2);}return _0x5092ea[_0xd61a('0x20')](_0xd61a('0x3c'))[_0xd61a('0x24')](_0x47fa1e,_0x465656)[_0xd61a('0x25')]();case _0xd61a('0x19'):var _0x36371b=_['cloneDeep'](_0x1f1207);if(_0x2cd99a[_0xd61a('0x36')]){var _0x2b21e2={};_0x2b21e2[_0x2cd99a['additionalSearchLead']]=_0x2a4404;_['merge'](_0x36371b[_0xd61a('0x37')],_0x2b21e2);}return _0x5092ea[_0xd61a('0x20')](_0xd61a('0x38'))[_0xd61a('0x24')](_0x36371b,_0x465656);case _0xd61a('0x1a'):var _0x1ab10b=_['cloneDeep'](_0x1f1207);if(_0x2cd99a[_0xd61a('0x3a')]){var _0x2b21e2={};_0x2b21e2[_0x2cd99a[_0xd61a('0x3a')]]=_0x2a4404;_[_0xd61a('0x35')](_0x1ab10b[_0xd61a('0x37')],_0x2b21e2);}return _0x5092ea[_0xd61a('0x20')](_0xd61a('0x3b'))['find'](_0x1ab10b,_0x465656);default:return null;}})['then'](function(_0x23d7eb){if(_0x23d7eb&&_0x23d7eb['length']){var _0x2d5a68=_[_0xd61a('0x3d')](_0x23d7eb);if(_0x2d5a68){return BPromise['resolve']({'id':_0x2d5a68['Id'],'name':_0x2d5a68[_0xd61a('0x29')],'phone':_0x2d5a68['Phone'],'endUserType':_0x2d5a68['attributes'][_0xd61a('0x3e')][_0xd61a('0x3f')]()});}}})[_0xd61a('0x2c')](function(_0x21aaf1){if(_0x21aaf1){logger[_0xd61a('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x21aaf1[_0xd61a('0x17')],_0x2a4404);return BPromise[_0xd61a('0x2d')](_0x21aaf1);}else{logger[_0xd61a('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2a4404);var _0x3ef82b={'Phone':_0x2a4404};if(_0x2cd99a[_0xd61a('0x40')]){if(_0x2cd99a['moduleCreate']===_0xd61a('0x18')){logger[_0xd61a('0x1e')](_0xd61a('0x41'),_0x2a4404,_0x2cd99a['moduleCreate']);_0x3ef82b['LastName']=_0x2e45ed!==_0xd61a('0x42')?_0x2e45ed:util[_0xd61a('0x43')](_0xd61a('0x44'),_0x2a4404);}else if(_0x2cd99a[_0xd61a('0x40')]===_0xd61a('0x19')){logger[_0xd61a('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2a4404,_0x2cd99a[_0xd61a('0x40')]);_0x3ef82b['LastName']=_0x2e45ed!==''?_0x2e45ed:util[_0xd61a('0x43')](_0xd61a('0x44'),_0x2a4404);_0x3ef82b[_0xd61a('0x45')]=_0xd61a('0x46');}else if(_0x2cd99a[_0xd61a('0x40')]==='account'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2a4404,_0x2cd99a[_0xd61a('0x40')]);_0x3ef82b[_0xd61a('0x29')]=_0x2e45ed!==_0xd61a('0x42')?_0x2e45ed:util['format'](_0xd61a('0x44'),_0x2a4404);}else{return null;}}return _0x5092ea[_0xd61a('0x20')](_['upperFirst'](_0x2cd99a[_0xd61a('0x40')]))[_0xd61a('0x21')](_0x3ef82b)['then'](function(_0x67f534){return BPromise[_0xd61a('0x2d')]({'id':_0x67f534['id'],'endUserType':_0x2cd99a[_0xd61a('0x40')]});});}});}function getCustomFields(_0x59f040,_0x238245){var _0x43ff38={};if(_0x59f040[_0xd61a('0x26')]>0x0){_[_0xd61a('0x47')](_0x59f040,function(_0x3d65e4){if(_[_0xd61a('0x48')]([_0xd61a('0x49'),'picklist'],_0x3d65e4[_0xd61a('0x3e')])&&_0x3d65e4[_0xd61a('0x4a')]){_0x43ff38[_0x3d65e4[_0xd61a('0x4a')]]=_0x3d65e4[_0xd61a('0x4b')]['toString']();}else if(_0x3d65e4['type']==='variable'&&_0x3d65e4[_0xd61a('0x4c')]&&_0x3d65e4[_0xd61a('0x4a')]){_0x238245[_0x3d65e4[_0xd61a('0x4c')]]&&(_0x43ff38[_0x3d65e4['idField']]=_0x238245[_0x3d65e4['variableName']][_0xd61a('0x4d')]());}else if(_0x3d65e4['type']===_0xd61a('0x4e')&&_0x3d65e4[_0xd61a('0x4f')]&&_0x3d65e4[_0xd61a('0x4f')][_0xd61a('0x50')]&&_0x3d65e4[_0xd61a('0x4a')]){_0x238245[_0x3d65e4['Variable'][_0xd61a('0x50')]['toLowerCase']()]&&(_0x43ff38[_0x3d65e4[_0xd61a('0x4a')]]=_0x238245[_0x3d65e4['Variable']['name'][_0xd61a('0x3f')]()][_0xd61a('0x4d')]());}});}return _0x43ff38;}function getConnection(_0x2a351e){var _0x23ec51=_0x2a351e[_0xd61a('0x51')][_0xd61a('0x52')](_0x2a351e[_0xd61a('0x53')]);var _0x4ae933=new jsforce[(_0xd61a('0x54'))]({'oauth2':{'loginUrl':_0x2a351e['remoteUri']||_0xd61a('0x55'),'clientId':_0x2a351e[_0xd61a('0x56')],'clientSecret':_0x2a351e['clientSecret']}});return _0x4ae933['login'](_0x2a351e[_0xd61a('0x57')],_0x23ec51)[_0xd61a('0x2c')](function(){logger[_0xd61a('0x1e')](_0xd61a('0x58'));return _0x4ae933;});}exports[_0xd61a('0x59')]=function(_0x3d8152,_0x39c1ee,_0x2d227c,_0x3f4994,_0x3230b2,_0x50ed93){var _0x1c1bdd,_0x4451cd,_0x2570d2,_0x74dfb5;_0x50ed93[_0xd61a('0x5a')]=intUtil['stripTrailingSlash'](_0x50ed93[_0xd61a('0x5a')]);_0x50ed93[_0xd61a('0x5b')]=intUtil[_0xd61a('0x5c')](_0x50ed93[_0xd61a('0x5b')]);if(_0x3230b2&&_0x3230b2[_0xd61a('0x5d')]){logger[_0xd61a('0x1e')](_0xd61a('0x5e'),_0xd61a('0x5f'));_0x39c1ee['recordingURL']=util['format'](_0xd61a('0x60'),_0x50ed93[_0xd61a('0x5a')],_0x39c1ee[_0xd61a('0x61')],md5(_0x39c1ee[_0xd61a('0x61')]));}else{_0x39c1ee[_0xd61a('0x62')]='';}return getConnection(_0x50ed93)[_0xd61a('0x2c')](function(_0x788072){_0x74dfb5=_0x788072;return getUser(_0x50ed93,_0x3f4994[_0xd61a('0x63')],_0x74dfb5);})['then'](function(_0x87632d){_0x1c1bdd=_0x87632d;return getEndUser(_0x50ed93,_0x2d227c,_0x39c1ee[_0xd61a('0x64')],_0x39c1ee['calleridnum'],_0x74dfb5);})[_0xd61a('0x2c')](function(_0x34399){_0x4451cd=_0x34399;return getTicket(_0x50ed93,_0x1c1bdd,_0x4451cd,_0x2d227c,_0x39c1ee,_0x2d227c[_0xd61a('0x65')],_0x74dfb5,_0xd61a('0x59'));})[_0xd61a('0x2c')](function(_0x4a8067){_0x2570d2=_0x4a8067;logger['info'](_0xd61a('0x66'),_0x2570d2['id']);logger[_0xd61a('0x1e')](_0xd61a('0x67'),_0x2570d2['id'],_0x3f4994[_0xd61a('0x50')],_0x50ed93[_0xd61a('0x3e')]);switch(_0x50ed93[_0xd61a('0x3e')]){case _0xd61a('0x68'):emit(util[_0xd61a('0x43')](_0xd61a('0x69'),_0x3f4994['name']),_0xd61a('0x6a'),{'recordId':_0x2570d2['id']});break;case'newTab':emit(util[_0xd61a('0x43')](_0xd61a('0x69'),_0x3f4994['name']),_0xd61a('0x6b'),{'uri':util[_0xd61a('0x43')](_0xd61a('0x6c'),_0x74dfb5[_0xd61a('0x6d')],_0x2570d2['id'])});break;default:logger['error'](_0xd61a('0x6e'));}})[_0xd61a('0x6f')](function(_0x470999){logger[_0xd61a('0x70')]('[QUEUE]',_0x470999);});};exports[_0xd61a('0x71')]=function(_0x5d1eb3,_0x23a336,_0x33ff5e,_0x743e5d,_0x4597cb,_0x56c633,_0x5ae72f){var _0x2a858b,_0x4b6958,_0x475aa2,_0x917b93;_0x56c633[_0xd61a('0x5a')]=intUtil[_0xd61a('0x5c')](_0x56c633['serverUrl']);_0x56c633[_0xd61a('0x5b')]=intUtil[_0xd61a('0x5c')](_0x56c633[_0xd61a('0x5b')]);if(_0x5ae72f&&_0x5ae72f['recordingFormat']&&_0x5ae72f[_0xd61a('0x72')]!==_0xd61a('0x73')){logger[_0xd61a('0x1e')](_0xd61a('0x74'),_0xd61a('0x5f'));_0x23a336[_0xd61a('0x62')]=util[_0xd61a('0x43')](_0xd61a('0x60'),_0x56c633[_0xd61a('0x5a')],_0x23a336[_0xd61a('0x61')],md5(_0x23a336[_0xd61a('0x61')]));}return getConnection(_0x56c633)[_0xd61a('0x2c')](function(_0x1121f6){_0x917b93=_0x1121f6;return getUser(_0x56c633,_0x743e5d[_0xd61a('0x63')],_0x917b93);})[_0xd61a('0x2c')](function(_0x18e36e){_0x2a858b=_0x18e36e;return getEndUser(_0x56c633,_0x33ff5e,_0x23a336[_0xd61a('0x75')],_0x23a336[_0xd61a('0x76')],_0x917b93);})[_0xd61a('0x2c')](function(_0x31401a){_0x4b6958=_0x31401a;return getTicket(_0x56c633,_0x2a858b,_0x4b6958,_0x33ff5e,_0x23a336,_0x33ff5e[_0xd61a('0x65')],_0x917b93,'outbound');})[_0xd61a('0x2c')](function(_0xc2f9c6){_0x475aa2=_0xc2f9c6;logger[_0xd61a('0x1e')](_0xd61a('0x77'),_0x475aa2['id']);logger[_0xd61a('0x1e')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x475aa2['id'],_0x743e5d[_0xd61a('0x50')],_0x56c633['type']);switch(_0x56c633[_0xd61a('0x3e')]){case _0xd61a('0x68'):emit(util[_0xd61a('0x43')](_0xd61a('0x69'),_0x743e5d[_0xd61a('0x50')]),_0xd61a('0x6a'),{'recordId':_0x475aa2['id']});break;case _0xd61a('0x78'):emit(util[_0xd61a('0x43')]('user:%s',_0x743e5d[_0xd61a('0x50')]),'trigger:browser:url',{'uri':util[_0xd61a('0x43')]('%s/%s/e',_0x917b93[_0xd61a('0x6d')],_0x475aa2['id'])});break;default:logger[_0xd61a('0x70')](_0xd61a('0x74'),_0xd61a('0x79'));}})[_0xd61a('0x6f')](function(_0x5d5c05){logger[_0xd61a('0x70')](_0xd61a('0x74'),_0x5d5c05);});};exports[_0xd61a('0x7a')]=function(_0x52e47e,_0x51fe3b,_0x53e3df,_0x488ac0,_0x23d688,_0x2f176f){var _0x46389a,_0x3895ba,_0x648ec1,_0x37c23f;_0x2f176f[_0xd61a('0x5a')]=intUtil['stripTrailingSlash'](_0x2f176f[_0xd61a('0x5a')]);_0x2f176f[_0xd61a('0x5b')]=intUtil['stripTrailingSlash'](_0x2f176f[_0xd61a('0x5b')]);if(_0x23d688&&_0x23d688[_0xd61a('0x5d')]){logger[_0xd61a('0x1e')]('['+_0x51fe3b['lastevent'][_0xd61a('0x7b')]()+']',_0xd61a('0x5f'));_0x51fe3b['recordingURL']=util[_0xd61a('0x43')](_0xd61a('0x60'),_0x2f176f['serverUrl'],_0x51fe3b[_0xd61a('0x61')],md5(_0x51fe3b[_0xd61a('0x61')]));}else{_0x51fe3b[_0xd61a('0x62')]='';}return getConnection(_0x2f176f)['then'](function(_0x186387){_0x37c23f=_0x186387;if(!_['isNil'](_0x488ac0)){return getUser(_0x2f176f,_0x488ac0[_0xd61a('0x50')],_0x37c23f);}else{return getUser(_0x2f176f,null,_0x37c23f);}})[_0xd61a('0x2c')](function(_0x43831f){_0x46389a=_0x43831f;return getEndUser(_0x2f176f,_0x53e3df,_0x51fe3b[_0xd61a('0x64')],_0x51fe3b[_0xd61a('0x7c')],_0x37c23f);})[_0xd61a('0x2c')](function(_0x2c7d4c){_0x3895ba=_0x2c7d4c;return getTicket(_0x2f176f,_0x46389a,_0x3895ba,_0x53e3df,_0x51fe3b,_0x53e3df[_0xd61a('0x65')],_0x37c23f);})[_0xd61a('0x2c')](function(_0x3456b3){_0x648ec1=_0x3456b3;logger[_0xd61a('0x1e')]('['+_0x51fe3b['lastevent'][_0xd61a('0x7b')]()+']\x20Ticket\x20%s\x20created.',_0x648ec1['id']);logger[_0xd61a('0x1e')]('['+_0x51fe3b[_0xd61a('0x7d')]['toUpperCase']()+']\x20Integration\x20account\x20type\x20%s.',_0x2f176f['type']);})['catch'](function(_0x2a3cb3){logger[_0xd61a('0x70')]('['+_0x51fe3b[_0xd61a('0x7d')][_0xd61a('0x7b')]()+']',_0x2a3cb3);});}; \ 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 7b64764..b4eea16 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 _0xb521=[']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','info','],\x20getUser\x20rp\x20obj','active','userId','sys_id','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','true','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','string','idField','content','toString','variable','variableName','customVariable','Variable','name','outbound','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','trigger:browser:url','username','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','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','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...'];(function(_0x676195,_0x3aedd2){var _0x1f3e3d=function(_0x15fb03){while(--_0x15fb03){_0x676195['push'](_0x676195['shift']());}};_0x1f3e3d(++_0x3aedd2);}(_0xb521,0x155));var _0x1b52=function(_0x30cb3f,_0x859105){_0x30cb3f=_0x30cb3f-0x0;var _0x527cc1=_0xb521[_0x30cb3f];return _0x527cc1;};'use strict';var _=require(_0x1b52('0x0'));var Promise=require(_0x1b52('0x1'));var rp=require(_0x1b52('0x2'));var util=require(_0x1b52('0x3'));var md5=require(_0x1b52('0x4'));var Redis=require(_0x1b52('0x5'));var intUtil=require(_0x1b52('0x6'));var config=require(_0x1b52('0x7'));var logger=require(_0x1b52('0x8'))('servicenow');config[_0x1b52('0x9')]=_[_0x1b52('0xa')](config['redis'],{'host':_0x1b52('0xb'),'port':0x18eb});var io=require(_0x1b52('0xc'))(new Redis(config['redis']));function getAdminUser(_0x3c369f,_0x226079,_0x7e63dc,_0x5a1c8e,_0x48e874,_0x1e3256){return new Promise(function(_0x5b3df2,_0x4a3ff0){var _0x1de975={'method':_0x1b52('0xd'),'uri':_0x5a1c8e+_0x1b52('0xe')+'&'+_0x48e874+'&'+_0x1e3256,'auth':_0x226079,'json':!![]};return rp(_0x1de975)[_0x1b52('0xf')](function(_0x4d0412){if(_0x4d0412[_0x1b52('0x10')][_0x1b52('0x11')]>0x0){_0x7e63dc['adminId']=_0x4d0412[_0x1b52('0x10')][0x0]['sys_id'];}logger['info']('['+[_0x3c369f[_0x1b52('0x12')]()]+_0x1b52('0x13'),_0x7e63dc);_0x5b3df2(_0x7e63dc);})[_0x1b52('0x14')](function(_0x4b388c){logger[_0x1b52('0x15')]('['+[_0x3c369f[_0x1b52('0x12')]()]+']',_0x4b388c[_0x1b52('0x16')]);_0x4a3ff0(_0x4b388c[_0x1b52('0x16')]);});});}function getUser(_0x19b5aa,_0x35b882,_0x2e86e2,_0x3c7205,_0x1edcbb){return function(_0x3e74de){logger['info']('['+[_0x19b5aa['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x3e74de);return new Promise(function(_0x4c2031,_0x56c395){if(intUtil[_0x1b52('0x17')](_0x3e74de[_0x1b52('0x18')])){var _0x541258={'method':_0x1b52('0xd'),'uri':_0x2e86e2+_0x1b52('0x19')+_0x3e74de[_0x1b52('0x18')]+'&'+_0x3c7205+'&'+_0x1edcbb,'auth':_0x35b882,'json':!![]};logger[_0x1b52('0x1a')]('['+[_0x19b5aa[_0x1b52('0x12')]()]+_0x1b52('0x1b'),_0x541258);return rp(_0x541258)[_0x1b52('0xf')](function(_0x342b7d){logger[_0x1b52('0x1a')]('['+[_0x19b5aa[_0x1b52('0x12')]()]+'],\x20getUser\x20entity',_0x342b7d);if(_0x342b7d[_0x1b52('0x10')]['length']>0x0&&String(_0x342b7d[_0x1b52('0x10')][0x0][_0x1b52('0x1c')])==='true'){_0x3e74de[_0x1b52('0x1d')]=_0x342b7d[_0x1b52('0x10')][0x0][_0x1b52('0x1e')];}else{_0x3e74de[_0x1b52('0x1d')]=_0x3e74de[_0x1b52('0x1f')];_0x3e74de[_0x1b52('0x18')]=_0x3e74de[_0x1b52('0x20')];}logger[_0x1b52('0x1a')]('['+[_0x19b5aa[_0x1b52('0x12')]()]+_0x1b52('0x21'),_0x3e74de);_0x4c2031(_0x3e74de);})['catch'](function(_0x35476a){logger[_0x1b52('0x15')]('['+[_0x19b5aa[_0x1b52('0x12')]()]+']',_0x35476a['message']);_0x56c395(_0x35476a['message']);});}else{logger['info']('['+[_0x19b5aa[_0x1b52('0x12')]()]+_0x1b52('0x22'));_0x3e74de[_0x1b52('0x1d')]=_0x3e74de[_0x1b52('0x1f')];_0x3e74de[_0x1b52('0x18')]=_0x3e74de[_0x1b52('0x20')];_0x4c2031(_0x3e74de);}});};}function createEndUser(_0x3727d8,_0x432bff,_0x400a0a,_0x57a8ec,_0x17789d){logger[_0x1b52('0x1a')]('['+[_0x3727d8[_0x1b52('0x12')]()]+_0x1b52('0x23'),_0x400a0a);return new Promise(function(_0x1f11d3,_0x4816dd){var _0x4952d8={'method':_0x1b52('0x24'),'uri':_0x57a8ec+'sys_user?'+_0x17789d,'body':{'user_name':_0x400a0a[_0x1b52('0x25')],'roles':_0x1b52('0x26'),'first_name':_0x400a0a[_0x1b52('0x25')],'active':_0x1b52('0x27'),'date_format':_0x1b52('0x28'),'phone':_0x400a0a['endUserNumber']},'auth':_0x432bff,'json':!![]};return rp(_0x4952d8)[_0x1b52('0xf')](function(_0x5975f7){logger[_0x1b52('0x1a')]('['+[_0x3727d8[_0x1b52('0x12')]()]+_0x1b52('0x29'),_0x5975f7[_0x1b52('0x10')]);_0x400a0a['endUserId']=_0x5975f7[_0x1b52('0x10')][_0x1b52('0x1e')];_0x1f11d3(_0x400a0a);})['catch'](function(_0x329da7){logger[_0x1b52('0x15')]('['+[_0x3727d8[_0x1b52('0x12')]()]+']',_0x329da7['message']);_0x4816dd(_0x329da7[_0x1b52('0x16')]);});});}function getEndUser(_0x1c5a5e,_0xffdded,_0x2ac646,_0x1d94f4,_0x379980){return function(_0x3f2fbe){logger[_0x1b52('0x1a')]('['+[_0x1c5a5e['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x3f2fbe);return new Promise(function(_0x574035,_0x1fb512){var _0x70ec34={'method':_0x1b52('0xd'),'uri':_0x2ac646+'sys_user?sysparm_query=phone%3D'+_0x3f2fbe[_0x1b52('0x25')]+'&'+_0x1d94f4+'&'+_0x379980,'auth':_0xffdded,'json':!![]};return rp(_0x70ec34)[_0x1b52('0xf')](function(_0xa70e23){if(_0xa70e23[_0x1b52('0x10')]['length']>0x0){_0x3f2fbe[_0x1b52('0x2a')]=_0xa70e23[_0x1b52('0x10')][0x0][_0x1b52('0x1e')];logger[_0x1b52('0x1a')]('['+[_0x1c5a5e['toUpperCase']()]+_0x1b52('0x2b'),_0x3f2fbe);_0x574035(_0x3f2fbe);}else{return createEndUser(_0x1c5a5e,_0xffdded,_0x3f2fbe,_0x2ac646,_0x1d94f4)[_0x1b52('0xf')](function(_0x152a10){logger['info']('['+[_0x1c5a5e[_0x1b52('0x12')]()]+_0x1b52('0x2c'),_0x152a10);_0x574035(_0x152a10);});}})[_0x1b52('0x14')](function(_0x23ce3e){logger['error']('['+[_0x1c5a5e[_0x1b52('0x12')]()]+']',_0x23ce3e[_0x1b52('0x16')]);_0x1fb512(_0x23ce3e[_0x1b52('0x16')]);});});};}function getCustomFields(_0x4e0ecc,_0x2277f9){var _0x95e557={};if(_0x4e0ecc[_0x1b52('0x11')]>0x0){_[_0x1b52('0x2d')](_0x4e0ecc,function(_0x431091){if(_[_0x1b52('0x2e')](['string','picklist'],_0x431091[_0x1b52('0x2f')])&&_0x431091[_0x1b52('0x30')]&&!_0x431091[_0x1b52('0x31')]){_0x95e557[_0x431091[_0x1b52('0x30')][_0x1b52('0x32')]()]=_0x431091['content']['toString']();}else if(_['includes']([_0x1b52('0x33'),'picklist'],_0x431091[_0x1b52('0x2f')])&&_0x431091['idField']&&_0x431091[_0x1b52('0x31')]){_0x95e557[_0x431091[_0x1b52('0x34')]['toLowerCase']()]=_0x431091[_0x1b52('0x35')][_0x1b52('0x36')]();}else if(_0x431091[_0x1b52('0x2f')]===_0x1b52('0x37')&&_0x431091[_0x1b52('0x38')]&&_0x431091['idField']&&_0x431091[_0x1b52('0x31')]){_0x95e557[_0x431091[_0x1b52('0x34')]['toLowerCase']()]=_0x2277f9[_0x431091[_0x1b52('0x38')]][_0x1b52('0x36')]();}else if(_0x431091[_0x1b52('0x2f')]===_0x1b52('0x39')&&_0x431091['Variable']&&_0x431091[_0x1b52('0x3a')][_0x1b52('0x3b')]&&_0x431091[_0x1b52('0x34')]&&_0x431091[_0x1b52('0x31')]){_0x95e557[_0x431091[_0x1b52('0x34')][_0x1b52('0x32')]()]=_0x2277f9[_0x431091['Variable'][_0x1b52('0x3b')]['toLowerCase']()][_0x1b52('0x36')]();}});}return _0x95e557;}function getTicket(_0x1a6615,_0xd200d3,_0x23c469,_0x56f0f8,_0x257371,_0x44c2e8){return function(_0x1693f5){logger[_0x1b52('0x1a')]('['+[_0x1a6615[_0x1b52('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x1693f5);return new Promise(function(_0x35d5e9,_0x14fdb9){var _0xd94a2e=_0x1a6615[_0x1b52('0x32')]()===_0x1b52('0x3c')?_0x1693f5['userId']:_0x1693f5[_0x1b52('0x2a')];var _0x31d5c3={'method':_0x1b52('0x24'),'uri':_0x23c469+_0x1b52('0x3d')+'?'+_0x44c2e8,'body':Object[_0x1b52('0x3e')]({},{'active':_0x1b52('0x27'),'caller_id':_0xd94a2e,'assigned_to':_0x1693f5[_0x1b52('0x1d')],'short_description':intUtil[_0x1b52('0x3f')](_0x56f0f8[_0x1b52('0x40')],_0x257371,'\x20'),'description':intUtil['getString'](_0x56f0f8[_0x1b52('0x41')],_0x257371,'\x0a')},getCustomFields(_0x56f0f8['Fields'],_0x257371)),'auth':_0xd200d3,'json':!![]};return rp(_0x31d5c3)[_0x1b52('0xf')](function(_0x46540b){logger['info']('['+[_0x1a6615[_0x1b52('0x12')]()]+_0x1b52('0x42'),_0x46540b[_0x1b52('0x10')]);_0x1693f5[_0x1b52('0x43')]=_0x46540b[_0x1b52('0x10')][_0x1b52('0x1e')];_0x1693f5[_0x1b52('0x44')]=_0x46540b[_0x1b52('0x10')][_0x1b52('0x45')];logger[_0x1b52('0x1a')]('['+[_0x1a6615[_0x1b52('0x12')]()]+']\x20getTicket\x20crm',_0x1693f5);_0x35d5e9(_0x1693f5);})[_0x1b52('0x14')](function(_0xbe987){logger[_0x1b52('0x15')]('['+[_0x1a6615['toUpperCase']()]+']',_0xbe987[_0x1b52('0x16')]);_0x14fdb9(_0xbe987[_0x1b52('0x16')]);});});};}function createRemoteTag(_0x123ee8,_0x3a6ce1,_0x357795,_0x577a05){return new Promise(function(_0x241be1,_0x415f24){var _0x5bd68b={'method':_0x1b52('0x24'),'uri':_0x357795+_0x1b52('0x46')+'?'+_0x577a05,'body':{'short_description':_0x123ee8,'global':!![],'active':!![],'name':_0x123ee8},'auth':_0x3a6ce1,'json':!![]};return rp(_0x5bd68b)[_0x1b52('0xf')](function(_0x1b268d){var _0xf5f37a=_0x1b268d[_0x1b52('0x10')][_0x1b52('0x1e')];_0x241be1(_0xf5f37a);});});}function getRemoteTag(_0x273176,_0x58dd80,_0x4518e4,_0x226ed7,_0x329f4a){return new Promise(function(_0xaf144b,_0x5e7426){var _0x402a4a={'method':_0x1b52('0xd'),'uri':_0x4518e4+_0x1b52('0x46')+_0x1b52('0x47')+_0x273176+'&'+_0x226ed7,'auth':_0x58dd80,'json':!![]};return rp(_0x402a4a)[_0x1b52('0xf')](function(_0x561552){if(_0x561552[_0x1b52('0x10')][_0x1b52('0x11')]>0x0){var _0x586129=_0x561552[_0x1b52('0x10')][0x0]['sys_id'];_0xaf144b(_0x586129);}else{return createRemoteTag(_0x273176,_0x58dd80,_0x4518e4,_0x226ed7)['then'](function(_0x1c7f69){_0xaf144b(_0x1c7f69);});}});});}function assignTagToIncident(_0xa2b4a0,_0x19255a,_0x25d9c5,_0x3f63da,_0x30ab9d){return new Promise(function(_0x33cdeb,_0x54ebdb){var _0x475fbe={'method':_0x1b52('0x24'),'uri':_0x25d9c5+_0x1b52('0x48')+'?'+_0x30ab9d,'body':{'label':_0xa2b4a0,'table':_0x1b52('0x3d'),'id_type':_0x1b52('0x49'),'table_key':_0x3f63da['ticketId'],'title':_0x1b52('0x4a')+_0x3f63da[_0x1b52('0x44')],'id_display':_0x3f63da[_0x1b52('0x44')]},'auth':_0x19255a,'json':!![]};return rp(_0x475fbe)[_0x1b52('0xf')](function(_0x30f9d1){_0x33cdeb();})['catch'](function(){_0x33cdeb();});});}function manageTags(_0x33e715,_0x50dd80,_0x13d39b,_0x5a606e,_0x549262,_0x257d20,_0xccf44e){return new Promise(function(_0xfcf703,_0x1c01d2){var _0x1ad550=[];_0x50dd80[_0x1b52('0x2d')](function(_0x7840db){_0x1ad550[_0x1b52('0x4b')](getRemoteTag(_0x7840db,_0x13d39b,_0x5a606e,_0x257d20,_0xccf44e));});return Promise[_0x1b52('0x4c')](_0x1ad550)[_0x1b52('0xf')](function(_0x374938){if(_0x374938[_0x1b52('0x11')]){logger[_0x1b52('0x1a')]('['+[_0x33e715['toUpperCase']()]+_0x1b52('0x4d'),_0x374938);var _0x39d56b=[];_0x374938[_0x1b52('0x2d')](function(_0x26bac0){_0x39d56b['push'](assignTagToIncident(_0x26bac0,_0x13d39b,_0x5a606e,_0x549262,_0x257d20));});return Promise[_0x1b52('0x4c')](_0x39d56b)[_0x1b52('0xf')](function(){_0xfcf703();})[_0x1b52('0x14')](function(){_0xfcf703();});}else{_0xfcf703();}});});}function getTags(_0x31606e,_0x4ca7ed,_0x302479,_0x3e08e4,_0x5e4f95,_0x4b7f53){return function(_0x3edc47){return new Promise(function(_0x5e183f,_0x353e42){var _0x10e9d2=[];var _0x296c7c=_0x3e08e4[_0x1b52('0x4e')];if(_0x296c7c&&_0x296c7c[_0x1b52('0x11')]>0x0){_0x10e9d2=_[_0x1b52('0x4f')](_0x296c7c,'name');}if(_0x10e9d2[_0x1b52('0x11')]>0x0){return manageTags(_0x31606e,_0x10e9d2,_0x4ca7ed,_0x302479,_0x3edc47,_0x5e4f95,_0x4b7f53)[_0x1b52('0xf')](function(){_0x5e183f(_0x3edc47);});}else{_0x5e183f(_0x3edc47);}});};}function emit(_0x4ede7e,_0x16b22f,_0x417e2c){var _0xbc74c4=_0x1b52('0x50')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x1b52('0x51')+'%255EORDERBYDESCnumber';var _0x885037={'uri':_0x4ede7e+_0x1b52('0x52')+_0x417e2c+_0xbc74c4};io['to'](util[_0x1b52('0x53')](_0x1b52('0x54'),_0x16b22f))['emit'](_0x1b52('0x55'),_0x885037);}exports['cs']=function(_0x5ef254,_0x3d6e56,_0x338127,_0x588434,_0x552350,_0x3a3b7d,_0x51393e,_0x2c388d){var _0x41c055={};var _0x3dc66e={'user':_0x3a3b7d[_0x1b52('0x56')],'pass':_0x3a3b7d['password']};var _0x5726d6='sysparm_limit=1';var _0x494c5c=_0x1b52('0x57');_0x3a3b7d[_0x1b52('0x58')]=intUtil[_0x1b52('0x59')](_0x3a3b7d['remoteUri']);_0x3a3b7d[_0x1b52('0x5a')]=intUtil[_0x1b52('0x59')](_0x3a3b7d[_0x1b52('0x5a')]);var _0x448467=util[_0x1b52('0x53')](_0x1b52('0x5b'),_0x3a3b7d['remoteUri']);_0x41c055[_0x1b52('0x18')]=!_[_0x1b52('0x5c')](_0x588434)?_0x588434[_0x1b52('0x5d')]:null;_0x41c055[_0x1b52('0x20')]=_0x3a3b7d['email'];_0x41c055[_0x1b52('0x25')]=_0x2c388d[_0x1b52('0x32')]()===_0x1b52('0x3c')?_0x3d6e56[_0x1b52('0x5e')]:_0x3d6e56[_0x1b52('0x5f')];_0x41c055[_0x1b52('0x60')]=_0x2c388d===_0x1b52('0x61')||_0x2c388d===_0x1b52('0x62')?_0x1b52('0x61'):'outbound';var _0x82bc08=util[_0x1b52('0x53')](_0x1b52('0x63'),_0x3a3b7d['serverUrl'],_0x3d6e56[_0x1b52('0x64')],md5(_0x3d6e56['uniqueid']));if(_0x552350&&_0x552350[_0x1b52('0x65')]){logger[_0x1b52('0x1a')](_0x1b52('0x66'),_0x1b52('0x67'));_0x3d6e56[_0x1b52('0x68')]=_0x82bc08;}else if(_0x51393e&&_0x51393e['recordingFormat']&&_0x51393e[_0x1b52('0x69')]!==_0x1b52('0x6a')){logger['info'](_0x1b52('0x6b'),'Recording\x20is\x20enabled!');_0x3d6e56[_0x1b52('0x68')]=_0x82bc08;}else{_0x3d6e56[_0x1b52('0x68')]='';}return getAdminUser(_0x2c388d,_0x3dc66e,_0x41c055,_0x448467,_0x494c5c,_0x5726d6)[_0x1b52('0xf')](getUser(_0x2c388d,_0x3dc66e,_0x448467,_0x494c5c,_0x5726d6))['then'](getEndUser(_0x2c388d,_0x3dc66e,_0x448467,_0x494c5c,_0x5726d6))[_0x1b52('0xf')](getTicket(_0x2c388d,_0x3dc66e,_0x448467,_0x338127,_0x3d6e56,_0x494c5c))['then'](function(_0x2cd4ef){logger['info'](util[_0x1b52('0x53')](_0x1b52('0x6c'),_0x2cd4ef['ticketId']));logger['info'](util[_0x1b52('0x53')](_0x1b52('0x6d'),_0x2c388d));if(_0x2c388d!==_0x1b52('0x62')){logger[_0x1b52('0x1a')]('['+[_0x2c388d[_0x1b52('0x12')]()]+']',_0x1b52('0x6e'));emit(_0x3a3b7d['remoteUri'],_0x588434[_0x1b52('0x3b')],_0x2cd4ef[_0x1b52('0x43')]);}})[_0x1b52('0x14')](function(_0x577cb5){logger['error']('['+[_0x2c388d[_0x1b52('0x12')]()]+_0x1b52('0x6f'),util[_0x1b52('0x70')](_0x577cb5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0aea=['label','?sysparm_query=name%3D','label_entry','incident','Incident','Incident\x20-\x20','push','all','Tags','map','name','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','emit','username','password','remoteUri','stripTrailingSlash','serverUrl','format','%s/api/now/table/','isNil','email','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','localhost','socket.io-emitter','GET','then','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','forEach','includes','string','type','nameField','toLowerCase','content','toString','picklist','customField','idField','variableName','customVariable','Variable','outbound','POST','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm'];(function(_0x4497d1,_0x3b9f15){var _0x43cfd4=function(_0x2a6d4f){while(--_0x2a6d4f){_0x4497d1['push'](_0x4497d1['shift']());}};_0x43cfd4(++_0x3b9f15);}(_0x0aea,0x109));var _0xa0ae=function(_0x1895b7,_0x21fbc7){_0x1895b7=_0x1895b7-0x0;var _0x1aecdc=_0x0aea[_0x1895b7];return _0x1aecdc;};'use strict';var _=require(_0xa0ae('0x0'));var Promise=require(_0xa0ae('0x1'));var rp=require(_0xa0ae('0x2'));var util=require('util');var md5=require(_0xa0ae('0x3'));var Redis=require(_0xa0ae('0x4'));var intUtil=require(_0xa0ae('0x5'));var config=require(_0xa0ae('0x6'));var logger=require(_0xa0ae('0x7'))(_0xa0ae('0x8'));config['redis']=_['defaults'](config[_0xa0ae('0x9')],{'host':_0xa0ae('0xa'),'port':0x18eb});var io=require(_0xa0ae('0xb'))(new Redis(config[_0xa0ae('0x9')]));function getAdminUser(_0x557fa4,_0x31a922,_0x19239a,_0x2b8566,_0x2faefd,_0x3fe51f){return new Promise(function(_0x58d091,_0xf1bb07){var _0x5a95cd={'method':_0xa0ae('0xc'),'uri':_0x2b8566+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x2faefd+'&'+_0x3fe51f,'auth':_0x31a922,'json':!![]};return rp(_0x5a95cd)[_0xa0ae('0xd')](function(_0x3dd910){if(_0x3dd910['result'][_0xa0ae('0xe')]>0x0){_0x19239a[_0xa0ae('0xf')]=_0x3dd910[_0xa0ae('0x10')][0x0][_0xa0ae('0x11')];}logger[_0xa0ae('0x12')]('['+[_0x557fa4[_0xa0ae('0x13')]()]+_0xa0ae('0x14'),_0x19239a);_0x58d091(_0x19239a);})[_0xa0ae('0x15')](function(_0x124024){logger[_0xa0ae('0x16')]('['+[_0x557fa4[_0xa0ae('0x13')]()]+']',_0x124024[_0xa0ae('0x17')]);_0xf1bb07(_0x124024[_0xa0ae('0x17')]);});});}function getUser(_0x1af212,_0x2ce501,_0x4a6cee,_0x33397a,_0x330be1){return function(_0x2a7004){logger[_0xa0ae('0x12')]('['+[_0x1af212['toUpperCase']()]+_0xa0ae('0x18'),_0x2a7004);return new Promise(function(_0x41510c,_0xe90ef7){if(intUtil[_0xa0ae('0x19')](_0x2a7004[_0xa0ae('0x1a')])){var _0x3b04b1={'method':'GET','uri':_0x4a6cee+_0xa0ae('0x1b')+_0x2a7004[_0xa0ae('0x1a')]+'&'+_0x33397a+'&'+_0x330be1,'auth':_0x2ce501,'json':!![]};logger[_0xa0ae('0x12')]('['+[_0x1af212[_0xa0ae('0x13')]()]+_0xa0ae('0x1c'),_0x3b04b1);return rp(_0x3b04b1)[_0xa0ae('0xd')](function(_0x186c21){logger[_0xa0ae('0x12')]('['+[_0x1af212[_0xa0ae('0x13')]()]+_0xa0ae('0x1d'),_0x186c21);if(_0x186c21[_0xa0ae('0x10')][_0xa0ae('0xe')]>0x0&&String(_0x186c21[_0xa0ae('0x10')][0x0][_0xa0ae('0x1e')])===_0xa0ae('0x1f')){_0x2a7004[_0xa0ae('0x20')]=_0x186c21[_0xa0ae('0x10')][0x0][_0xa0ae('0x11')];}else{_0x2a7004[_0xa0ae('0x20')]=_0x2a7004[_0xa0ae('0xf')];_0x2a7004[_0xa0ae('0x1a')]=_0x2a7004[_0xa0ae('0x21')];}logger[_0xa0ae('0x12')]('['+[_0x1af212[_0xa0ae('0x13')]()]+_0xa0ae('0x22'),_0x2a7004);_0x41510c(_0x2a7004);})[_0xa0ae('0x15')](function(_0x28f44e){logger[_0xa0ae('0x16')]('['+[_0x1af212['toUpperCase']()]+']',_0x28f44e[_0xa0ae('0x17')]);_0xe90ef7(_0x28f44e[_0xa0ae('0x17')]);});}else{logger[_0xa0ae('0x12')]('['+[_0x1af212[_0xa0ae('0x13')]()]+_0xa0ae('0x23'));_0x2a7004[_0xa0ae('0x20')]=_0x2a7004['adminId'];_0x2a7004[_0xa0ae('0x1a')]=_0x2a7004['adminEmail'];_0x41510c(_0x2a7004);}});};}function createEndUser(_0x3a9b88,_0x3d4e89,_0x2be283,_0x41502c,_0x3a15f9){logger[_0xa0ae('0x12')]('['+[_0x3a9b88[_0xa0ae('0x13')]()]+_0xa0ae('0x24'),_0x2be283);return new Promise(function(_0x120897,_0x49edc5){var _0x4c0d3a={'method':'POST','uri':_0x41502c+_0xa0ae('0x25')+_0x3a15f9,'body':{'user_name':_0x2be283[_0xa0ae('0x26')],'roles':'user','first_name':_0x2be283[_0xa0ae('0x26')],'active':_0xa0ae('0x1f'),'date_format':'System','phone':_0x2be283[_0xa0ae('0x26')]},'auth':_0x3d4e89,'json':!![]};return rp(_0x4c0d3a)[_0xa0ae('0xd')](function(_0x3dade4){logger[_0xa0ae('0x12')]('['+[_0x3a9b88['toUpperCase']()]+'],\x20EndUser\x20schema',_0x3dade4[_0xa0ae('0x10')]);_0x2be283['endUserId']=_0x3dade4[_0xa0ae('0x10')][_0xa0ae('0x11')];_0x120897(_0x2be283);})[_0xa0ae('0x15')](function(_0x149524){logger[_0xa0ae('0x16')]('['+[_0x3a9b88[_0xa0ae('0x13')]()]+']',_0x149524[_0xa0ae('0x17')]);_0x49edc5(_0x149524[_0xa0ae('0x17')]);});});}function getEndUser(_0x414116,_0x4fd639,_0x2beeb9,_0x4f7010,_0xe7711b){return function(_0x2f5545){logger[_0xa0ae('0x12')]('['+[_0x414116[_0xa0ae('0x13')]()]+_0xa0ae('0x27'),_0x2f5545);return new Promise(function(_0xe82e24,_0x3d1d17){var _0x49d617={'method':'GET','uri':_0x2beeb9+_0xa0ae('0x28')+_0x2f5545[_0xa0ae('0x26')]+'&'+_0x4f7010+'&'+_0xe7711b,'auth':_0x4fd639,'json':!![]};return rp(_0x49d617)['then'](function(_0x357a29){if(_0x357a29['result'][_0xa0ae('0xe')]>0x0){_0x2f5545[_0xa0ae('0x29')]=_0x357a29['result'][0x0][_0xa0ae('0x11')];logger[_0xa0ae('0x12')]('['+[_0x414116[_0xa0ae('0x13')]()]+'],\x20getEndUser\x20crm',_0x2f5545);_0xe82e24(_0x2f5545);}else{return createEndUser(_0x414116,_0x4fd639,_0x2f5545,_0x2beeb9,_0x4f7010)[_0xa0ae('0xd')](function(_0x548cdf){logger['info']('['+[_0x414116['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x548cdf);_0xe82e24(_0x548cdf);});}})[_0xa0ae('0x15')](function(_0x315e1d){logger[_0xa0ae('0x16')]('['+[_0x414116[_0xa0ae('0x13')]()]+']',_0x315e1d[_0xa0ae('0x17')]);_0x3d1d17(_0x315e1d[_0xa0ae('0x17')]);});});};}function getCustomFields(_0x4036f5,_0xb4caee){var _0x2cbbd8={};if(_0x4036f5['length']>0x0){_[_0xa0ae('0x2a')](_0x4036f5,function(_0x289674){if(_[_0xa0ae('0x2b')]([_0xa0ae('0x2c'),'picklist'],_0x289674[_0xa0ae('0x2d')])&&_0x289674[_0xa0ae('0x2e')]&&!_0x289674['customField']){_0x2cbbd8[_0x289674[_0xa0ae('0x2e')][_0xa0ae('0x2f')]()]=_0x289674[_0xa0ae('0x30')][_0xa0ae('0x31')]();}else if(_[_0xa0ae('0x2b')]([_0xa0ae('0x2c'),_0xa0ae('0x32')],_0x289674[_0xa0ae('0x2d')])&&_0x289674['idField']&&_0x289674[_0xa0ae('0x33')]){_0x2cbbd8[_0x289674[_0xa0ae('0x34')][_0xa0ae('0x2f')]()]=_0x289674[_0xa0ae('0x30')][_0xa0ae('0x31')]();}else if(_0x289674[_0xa0ae('0x2d')]==='variable'&&_0x289674[_0xa0ae('0x35')]&&_0x289674[_0xa0ae('0x34')]&&_0x289674[_0xa0ae('0x33')]){_0x2cbbd8[_0x289674[_0xa0ae('0x34')][_0xa0ae('0x2f')]()]=_0xb4caee[_0x289674[_0xa0ae('0x35')]][_0xa0ae('0x31')]();}else if(_0x289674[_0xa0ae('0x2d')]===_0xa0ae('0x36')&&_0x289674[_0xa0ae('0x37')]&&_0x289674['Variable']['name']&&_0x289674['idField']&&_0x289674[_0xa0ae('0x33')]){_0x2cbbd8[_0x289674[_0xa0ae('0x34')][_0xa0ae('0x2f')]()]=_0xb4caee[_0x289674[_0xa0ae('0x37')]['name'][_0xa0ae('0x2f')]()]['toString']();}});}return _0x2cbbd8;}function getTicket(_0x911f5,_0xf9d2e,_0xf2f727,_0x1822da,_0x2bbffc,_0x2613f2){return function(_0x4ce1d5){logger[_0xa0ae('0x12')]('['+[_0x911f5[_0xa0ae('0x13')]()]+']\x20getTicket\x20input\x20crm',_0x4ce1d5);return new Promise(function(_0xc046fe,_0x4be902){var _0x526050=_0x911f5[_0xa0ae('0x2f')]()===_0xa0ae('0x38')?_0x4ce1d5[_0xa0ae('0x20')]:_0x4ce1d5[_0xa0ae('0x29')];var _0x17e43c={'method':_0xa0ae('0x39'),'uri':_0xf2f727+'incident'+'?'+_0x2613f2,'body':Object[_0xa0ae('0x3a')]({},{'active':_0xa0ae('0x1f'),'caller_id':_0x526050,'assigned_to':_0x4ce1d5[_0xa0ae('0x20')],'short_description':intUtil[_0xa0ae('0x3b')](_0x1822da[_0xa0ae('0x3c')],_0x2bbffc,'\x20'),'description':intUtil[_0xa0ae('0x3b')](_0x1822da[_0xa0ae('0x3d')],_0x2bbffc,'\x0a')},getCustomFields(_0x1822da[_0xa0ae('0x3e')],_0x2bbffc)),'auth':_0xf9d2e,'json':!![]};return rp(_0x17e43c)[_0xa0ae('0xd')](function(_0x5aff73){logger[_0xa0ae('0x12')]('['+[_0x911f5[_0xa0ae('0x13')]()]+_0xa0ae('0x3f'),_0x5aff73[_0xa0ae('0x10')]);_0x4ce1d5[_0xa0ae('0x40')]=_0x5aff73[_0xa0ae('0x10')][_0xa0ae('0x11')];_0x4ce1d5[_0xa0ae('0x41')]=_0x5aff73[_0xa0ae('0x10')][_0xa0ae('0x42')];logger[_0xa0ae('0x12')]('['+[_0x911f5[_0xa0ae('0x13')]()]+_0xa0ae('0x43'),_0x4ce1d5);_0xc046fe(_0x4ce1d5);})[_0xa0ae('0x15')](function(_0x3dcc70){logger[_0xa0ae('0x16')]('['+[_0x911f5[_0xa0ae('0x13')]()]+']',_0x3dcc70[_0xa0ae('0x17')]);_0x4be902(_0x3dcc70[_0xa0ae('0x17')]);});});};}function createRemoteTag(_0x3e0b60,_0x36165b,_0x4e007d,_0x37acec){return new Promise(function(_0x5d83bd,_0x4657c4){var _0x7a04f6={'method':_0xa0ae('0x39'),'uri':_0x4e007d+_0xa0ae('0x44')+'?'+_0x37acec,'body':{'short_description':_0x3e0b60,'global':!![],'active':!![],'name':_0x3e0b60},'auth':_0x36165b,'json':!![]};return rp(_0x7a04f6)[_0xa0ae('0xd')](function(_0x3c48a8){var _0x3d80cb=_0x3c48a8[_0xa0ae('0x10')][_0xa0ae('0x11')];_0x5d83bd(_0x3d80cb);});});}function getRemoteTag(_0x2931f3,_0xc65581,_0x10b88e,_0x595e0e,_0x42cbc5){return new Promise(function(_0x2c8464,_0x3e7c0d){var _0x1ae075={'method':_0xa0ae('0xc'),'uri':_0x10b88e+'label'+_0xa0ae('0x45')+_0x2931f3+'&'+_0x595e0e,'auth':_0xc65581,'json':!![]};return rp(_0x1ae075)[_0xa0ae('0xd')](function(_0x5abe58){if(_0x5abe58[_0xa0ae('0x10')][_0xa0ae('0xe')]>0x0){var _0x560002=_0x5abe58[_0xa0ae('0x10')][0x0]['sys_id'];_0x2c8464(_0x560002);}else{return createRemoteTag(_0x2931f3,_0xc65581,_0x10b88e,_0x595e0e)['then'](function(_0x5243c6){_0x2c8464(_0x5243c6);});}});});}function assignTagToIncident(_0x1daf63,_0xea14a2,_0x242b4a,_0x4a1d46,_0x1ef73a){return new Promise(function(_0x2514f0,_0x22e734){var _0x1b2a63={'method':_0xa0ae('0x39'),'uri':_0x242b4a+_0xa0ae('0x46')+'?'+_0x1ef73a,'body':{'label':_0x1daf63,'table':_0xa0ae('0x47'),'id_type':_0xa0ae('0x48'),'table_key':_0x4a1d46[_0xa0ae('0x40')],'title':_0xa0ae('0x49')+_0x4a1d46[_0xa0ae('0x41')],'id_display':_0x4a1d46[_0xa0ae('0x41')]},'auth':_0xea14a2,'json':!![]};return rp(_0x1b2a63)[_0xa0ae('0xd')](function(_0x195d12){_0x2514f0();})[_0xa0ae('0x15')](function(){_0x2514f0();});});}function manageTags(_0x228dca,_0x58b6bb,_0xd49c48,_0x24ba5f,_0x125753,_0xd78e85,_0x43cc44){return new Promise(function(_0x3ad271,_0x396ac6){var _0xd182f3=[];_0x58b6bb[_0xa0ae('0x2a')](function(_0x1df692){_0xd182f3[_0xa0ae('0x4a')](getRemoteTag(_0x1df692,_0xd49c48,_0x24ba5f,_0xd78e85,_0x43cc44));});return Promise[_0xa0ae('0x4b')](_0xd182f3)[_0xa0ae('0xd')](function(_0x5544f3){if(_0x5544f3[_0xa0ae('0xe')]){logger[_0xa0ae('0x12')]('['+[_0x228dca[_0xa0ae('0x13')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x5544f3);var _0x453792=[];_0x5544f3['forEach'](function(_0x5edc76){_0x453792[_0xa0ae('0x4a')](assignTagToIncident(_0x5edc76,_0xd49c48,_0x24ba5f,_0x125753,_0xd78e85));});return Promise[_0xa0ae('0x4b')](_0x453792)[_0xa0ae('0xd')](function(){_0x3ad271();})[_0xa0ae('0x15')](function(){_0x3ad271();});}else{_0x3ad271();}});});}function getTags(_0x385f6e,_0x3916ac,_0x489d19,_0x209b9c,_0x26cb6e,_0x26af81){return function(_0x42aa77){return new Promise(function(_0x51d9c4,_0x1bbbb1){var _0x25af3d=[];var _0x2cb039=_0x209b9c[_0xa0ae('0x4c')];if(_0x2cb039&&_0x2cb039[_0xa0ae('0xe')]>0x0){_0x25af3d=_[_0xa0ae('0x4d')](_0x2cb039,_0xa0ae('0x4e'));}if(_0x25af3d[_0xa0ae('0xe')]>0x0){return manageTags(_0x385f6e,_0x25af3d,_0x3916ac,_0x489d19,_0x42aa77,_0x26cb6e,_0x26af81)[_0xa0ae('0xd')](function(){_0x51d9c4(_0x42aa77);});}else{_0x51d9c4(_0x42aa77);}});};}function emit(_0x50dab0,_0x3f1075,_0x36f452){var _0x259a66=_0xa0ae('0x4f')+_0xa0ae('0x50')+_0xa0ae('0x51')+_0xa0ae('0x52');var _0x3fed5c={'uri':_0x50dab0+_0xa0ae('0x53')+_0x36f452+_0x259a66};io['to'](util['format'](_0xa0ae('0x54'),_0x3f1075))[_0xa0ae('0x55')]('trigger:browser:url',_0x3fed5c);}exports['cs']=function(_0x2dd489,_0x3b1c80,_0x3cfe97,_0x2191ca,_0x31315e,_0x48fabd,_0x6108cc,_0x264096){var _0xed5822={};var _0x4540c6={'user':_0x48fabd[_0xa0ae('0x56')],'pass':_0x48fabd[_0xa0ae('0x57')]};var _0x1288bd='sysparm_limit=1';var _0x351d67='sysparm_display_value=true';_0x48fabd[_0xa0ae('0x58')]=intUtil[_0xa0ae('0x59')](_0x48fabd[_0xa0ae('0x58')]);_0x48fabd[_0xa0ae('0x5a')]=intUtil[_0xa0ae('0x59')](_0x48fabd[_0xa0ae('0x5a')]);var _0x4417c5=util[_0xa0ae('0x5b')](_0xa0ae('0x5c'),_0x48fabd[_0xa0ae('0x58')]);_0xed5822[_0xa0ae('0x1a')]=!_[_0xa0ae('0x5d')](_0x2191ca)?_0x2191ca[_0xa0ae('0x5e')]:null;_0xed5822[_0xa0ae('0x21')]=_0x48fabd['email'];_0xed5822[_0xa0ae('0x26')]=_0x264096[_0xa0ae('0x2f')]()===_0xa0ae('0x38')?_0x3b1c80['destcalleridnum']:_0x3b1c80[_0xa0ae('0x5f')];_0xed5822[_0xa0ae('0x60')]=_0x264096===_0xa0ae('0x61')||_0x264096===_0xa0ae('0x62')?_0xa0ae('0x61'):_0xa0ae('0x38');var _0x25d6d0=util['format'](_0xa0ae('0x63'),_0x48fabd['serverUrl'],_0x3b1c80['uniqueid'],md5(_0x3b1c80['uniqueid']));if(_0x31315e&&_0x31315e['monitor_format']){logger[_0xa0ae('0x12')](_0xa0ae('0x64'),_0xa0ae('0x65'));_0x3b1c80[_0xa0ae('0x66')]=_0x25d6d0;}else if(_0x6108cc&&_0x6108cc[_0xa0ae('0x67')]&&_0x6108cc['recordingFormat']!==_0xa0ae('0x68')){logger[_0xa0ae('0x12')](_0xa0ae('0x69'),_0xa0ae('0x65'));_0x3b1c80[_0xa0ae('0x66')]=_0x25d6d0;}else{_0x3b1c80['recordingURL']='';}return getAdminUser(_0x264096,_0x4540c6,_0xed5822,_0x4417c5,_0x351d67,_0x1288bd)[_0xa0ae('0xd')](getUser(_0x264096,_0x4540c6,_0x4417c5,_0x351d67,_0x1288bd))[_0xa0ae('0xd')](getEndUser(_0x264096,_0x4540c6,_0x4417c5,_0x351d67,_0x1288bd))[_0xa0ae('0xd')](getTicket(_0x264096,_0x4540c6,_0x4417c5,_0x3cfe97,_0x3b1c80,_0x351d67))[_0xa0ae('0xd')](function(_0x5665c0){logger[_0xa0ae('0x12')](util[_0xa0ae('0x5b')](_0xa0ae('0x6a'),_0x5665c0['ticketId']));logger[_0xa0ae('0x12')](util[_0xa0ae('0x5b')](_0xa0ae('0x6b'),_0x264096));if(_0x264096!=='unmanaged'){logger[_0xa0ae('0x12')]('['+[_0x264096['toUpperCase']()]+']',_0xa0ae('0x6c'));emit(_0x48fabd['remoteUri'],_0x2191ca[_0xa0ae('0x4e')],_0x5665c0[_0xa0ae('0x40')]);}})['catch'](function(_0x16cc2b){logger[_0xa0ae('0x16')]('['+[_0x264096['toUpperCase']()]+_0xa0ae('0x6d'),util[_0xa0ae('0x6e')](_0x16cc2b,{'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 e6c2776..7e24f27 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 _0x1de9=['unmanaged','lastevent','toUpperCase','The\x20User\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','assigned_user_id','created_by','getString','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','length','push','variableName','set_entry','JSON','stringify','Calls','format','toString','base64','get_server_info','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','user_name','value','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','first_name','','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','customField','toLowerCase','content','idField','custom_fields','variable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','uri','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','trigger:browser:url','catch'];(function(_0x3fc7c1,_0x4d6afd){var _0x9f8580=function(_0x26a4fa){while(--_0x26a4fa){_0x3fc7c1['push'](_0x3fc7c1['shift']());}};_0x9f8580(++_0x4d6afd);}(_0x1de9,0x7a));var _0x91de=function(_0x555949,_0x3bff24){_0x555949=_0x555949-0x0;var _0x435f5f=_0x1de9[_0x555949];return _0x435f5f;};'use strict';var _=require(_0x91de('0x0'));var rp=require(_0x91de('0x1'));var BPromise=require(_0x91de('0x2'));var md5=require(_0x91de('0x3'));var util=require(_0x91de('0x4'));var Redis=require(_0x91de('0x5'));var intUtil=require(_0x91de('0x6'));var config=require(_0x91de('0x7'));var logger=require(_0x91de('0x8'))(_0x91de('0x9'));config[_0x91de('0xa')]=_['defaults'](config[_0x91de('0xa')],{'host':_0x91de('0xb'),'port':0x18eb});var io=require(_0x91de('0xc'))(new Redis(config[_0x91de('0xa')]));var def={'method':_0x91de('0xd'),'json':!![]};function emit(_0x43eda1,_0x50f5ae,_0x4effc4){io['to'](_0x43eda1)[_0x91de('0xe')](_0x50f5ae,_0x4effc4);}function getTicket(_0x5788df,_0x2500e7,_0x37b8dd,_0x86ea17,_0x38e5bb,_0x585e0e,_0x12da7c,_0x1d09d6){logger[_0x91de('0xf')](_0x91de('0x10'));var _0x268187=new Date();var _0x3bc171=[{'name':_0x91de('0x11'),'value':intUtil['getString'](_0x86ea17['Subjects'],_0x38e5bb,'\x20')},{'name':_0x91de('0x12'),'value':_0x2500e7['id']},{'name':_0x91de('0x13'),'value':_0x2500e7['id']},{'name':'description','value':intUtil[_0x91de('0x14')](_0x86ea17['Descriptions'],_0x38e5bb,'\x0a')},{'name':_0x91de('0x15'),'value':_0x268187[_0x91de('0x16')]()[_0x91de('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0x91de('0x18'),'value':'0'},{'name':_0x91de('0x19'),'value':'15'},{'name':_0x91de('0x1a'),'value':_0x37b8dd['id']},{'name':_0x91de('0x1b'),'value':_0x91de('0x1c')},{'name':_0x91de('0x1d'),'value':_0x37b8dd[_0x91de('0x11')]},{'name':'direction','value':_0x1d09d6}];if(_0x585e0e[_0x91de('0x1e')]){_['forEach'](_0x585e0e,function(_0x5b6606){if(_0x38e5bb[_0x5b6606['variableName']]){_0x3bc171[_0x91de('0x1f')]({'name':_0x5b6606['idField'],'value':_0x38e5bb[_0x5b6606[_0x91de('0x20')]]});}});}return request({'form':{'method':_0x91de('0x21'),'input_type':_0x91de('0x22'),'response_type':_0x91de('0x22'),'rest_data':JSON[_0x91de('0x23')]({'session':_0x12da7c['id'],'module_name':_0x91de('0x24'),'name_value_list':_0x3bc171})}});}function getAuth(_0x4f388b){return util[_0x91de('0x25')]('Basic\x20%s',new Buffer(_0x4f388b['apiKey']+':X')[_0x91de('0x26')](_0x91de('0x27')));}function getServerInfo(_0x4ea18c){return request({'form':{'method':_0x91de('0x28'),'input_type':_0x91de('0x22'),'response_type':_0x91de('0x22'),'rest_data':JSON[_0x91de('0x23')]({'session':_0x4ea18c['id']})}});}function getUser(_0x173771,_0x288a6f,_0x42de5e){if(!_['isNil'](_0x288a6f)){logger['info']('Getting\x20agent\x20with\x20name',_0x288a6f);return request({'form':{'method':_0x91de('0x29'),'input_type':_0x91de('0x22'),'response_type':_0x91de('0x22'),'rest_data':JSON[_0x91de('0x23')]({'session':_0x42de5e['id'],'module_name':_0x91de('0x2a'),'query':util['format'](_0x91de('0x2b'),_0x288a6f),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x91de('0x2c')](function(_0x1a28f0){if(_0x1a28f0[_0x91de('0x2d')][_0x91de('0x1e')]){var _0x3622a2=_['find'](_0x1a28f0[_0x91de('0x2d')],function(_0x211ea8){return _0x211ea8['name_value_list'][_0x91de('0x2e')][_0x91de('0x2f')]===_0x288a6f;});if(_0x3622a2){logger[_0x91de('0xf')]('Agent\x20found!');return BPromise[_0x91de('0x30')]({'id':_0x3622a2[_0x91de('0x31')]['id'][_0x91de('0x2f')],'name':_0x3622a2[_0x91de('0x31')][_0x91de('0x11')][_0x91de('0x2f')]});}}logger['info'](_0x91de('0x32'));return BPromise['resolve']({'id':_0x42de5e['name_value_list'][_0x91de('0x33')][_0x91de('0x2f')],'name':_0x42de5e[_0x91de('0x31')][_0x91de('0x2e')][_0x91de('0x2f')]});});}else{logger[_0x91de('0xf')](_0x91de('0x34'));return BPromise['resolve']({'id':_0x42de5e[_0x91de('0x31')][_0x91de('0x33')][_0x91de('0x2f')],'name':_0x42de5e[_0x91de('0x31')][_0x91de('0x2e')][_0x91de('0x2f')]});}}function getEndUser(_0xdc6ec2,_0x4ec402,_0x2db49c,_0x4afa25){logger[_0x91de('0xf')]('Searching\x20enduser\x20with\x20phone',_0x2db49c);return request({'form':{'method':'get_entry_list','input_type':_0x91de('0x22'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4afa25['id'],'module_name':_0x91de('0x1c'),'query':util[_0x91de('0x25')](_0x91de('0x35'),_0x2db49c),'order_by':'','offset':'0','select_fields':['id','name',_0x91de('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x91de('0x2c')](function(_0x26051f){if(_0x26051f[_0x91de('0x2d')][_0x91de('0x1e')]){var _0x432f31=_[_0x91de('0x37')](_0x26051f[_0x91de('0x2d')],function(_0x2cbc1e){return _0x2cbc1e[_0x91de('0x31')][_0x91de('0x36')][_0x91de('0x2f')]===_0x2db49c;});if(_0x432f31){logger[_0x91de('0xf')](_0x91de('0x38'));return BPromise[_0x91de('0x30')]({'id':_0x432f31[_0x91de('0x31')]['id'][_0x91de('0x2f')],'name':_0x432f31[_0x91de('0x31')][_0x91de('0x11')]['value'],'phone':_0x432f31[_0x91de('0x31')][_0x91de('0x36')][_0x91de('0x2f')]});}}else{logger[_0x91de('0xf')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x91de('0x21'),'input_type':'JSON','response_type':_0x91de('0x22'),'rest_data':JSON[_0x91de('0x23')]({'session':_0x4afa25['id'],'module_name':_0x91de('0x1c'),'name_value_list':[{'name':_0x91de('0x39'),'value':_0x4ec402!==_0x91de('0x3a')?_0x4ec402:util[_0x91de('0x25')]('Caller\x20-\x20%s',_0x2db49c)},{'name':_0x91de('0x36'),'value':_0x2db49c}]})}})[_0x91de('0x2c')](function(_0x48db0b){logger[_0x91de('0xf')](_0x91de('0x3b'));return BPromise[_0x91de('0x30')]({'id':_0x48db0b['id'],'name':_0x48db0b[_0x91de('0x2d')]['first_name'][_0x91de('0x2f')],'phone':_0x48db0b['entry_list'][_0x91de('0x36')]['value']});});}});}function request(_0x3ae414){logger[_0x91de('0x3c')](_0x91de('0x3d'),JSON[_0x91de('0x23')](_0x3ae414));return rp(_[_0x91de('0x3e')](def,_0x3ae414));}function getTags(_0x3f56db,_0x1a28a2){var _0x5dad7a=[];if(_0x3f56db&&_0x3f56db['length']>0x0){_0x5dad7a=_[_0x91de('0x3f')](_0x3f56db,_0x1a28a2);}return _0x5dad7a;}function getCustomFields(_0x2a014c,_0x3d47b7){var _0x3772b3=[];var _0x1122ef={'custom_fields':[]};if(_0x2a014c[_0x91de('0x1e')]>0x0){_[_0x91de('0x40')](_0x2a014c,function(_0x34c6e7){if(_0x34c6e7[_0x91de('0x41')]==='string'&&_0x34c6e7['nameField']&&!_0x34c6e7[_0x91de('0x42')]){_0x1122ef[_0x34c6e7['nameField'][_0x91de('0x43')]()]=_0x34c6e7[_0x91de('0x44')][_0x91de('0x26')]();}else if(_0x34c6e7[_0x91de('0x41')]==='string'&&_0x34c6e7[_0x91de('0x45')]&&_0x34c6e7['customField']){_0x1122ef[_0x91de('0x46')]['push']({'id':_0x34c6e7['idField'],'value':_0x34c6e7[_0x91de('0x44')][_0x91de('0x26')]()});}else if(_0x34c6e7[_0x91de('0x41')]===_0x91de('0x47')&&_0x34c6e7[_0x91de('0x20')]&&_0x34c6e7[_0x91de('0x45')]&&_0x34c6e7['customField']){_0x3d47b7[_0x34c6e7[_0x91de('0x20')]]&&_0x1122ef['custom_fields'][_0x91de('0x1f')]({'id':_0x34c6e7[_0x91de('0x45')],'value':_0x3d47b7[_0x34c6e7['variableName']][_0x91de('0x26')]()});}else if(_0x34c6e7[_0x91de('0x41')]==='customVariable'&&_0x34c6e7[_0x91de('0x48')]&&_0x34c6e7[_0x91de('0x48')][_0x91de('0x11')]&&_0x34c6e7[_0x91de('0x45')]&&_0x34c6e7['customField']){_0x3d47b7[_0x34c6e7['Variable']['name']['toLowerCase']()]&&_0x1122ef[_0x91de('0x46')][_0x91de('0x1f')]({'id':_0x34c6e7['idField'],'value':_0x3d47b7[_0x34c6e7[_0x91de('0x48')][_0x91de('0x11')][_0x91de('0x43')]()][_0x91de('0x26')]()});}});}return _0x1122ef;}function getConnection(_0x4d0228){return request({'method':'POST','form':{'method':_0x91de('0x49'),'input_type':_0x91de('0x22'),'response_type':_0x91de('0x22'),'rest_data':JSON[_0x91de('0x23')]({'user_auth':{'user_name':_0x4d0228['username'],'password':_0x4d0228[_0x91de('0x4a')],'encryption':_0x91de('0x4b')},'application':_0x91de('0x4c')})}})[_0x91de('0x2c')](function(_0x423cd6){var _0x35e84a=_0x423cd6;if(_0x35e84a['id']){def[_0x91de('0x4d')]=_0x35e84a['id'];return BPromise[_0x91de('0x30')](_0x35e84a);}else{throw new Error(util[_0x91de('0x25')](_0x91de('0x4e'),_0x4d0228['id']));}});}function setRelationship(_0x30df2a,_0x1e5e5f,_0x5af5ab,_0x519bde){return request({'form':{'method':_0x91de('0x4f'),'input_type':_0x91de('0x22'),'response_type':_0x91de('0x22'),'rest_data':JSON[_0x91de('0x23')]({'session':_0x30df2a['id'],'module_name':_0x91de('0x24'),'module_id':_0x5af5ab['id'],'link_field_name':_0x519bde,'related_ids':[_0x1e5e5f['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x91de('0x50')]=function(_0x4888bd,_0x189617,_0x47e909,_0x5736fe,_0x56ccfe,_0x25df4c){var _0x9989e4,_0x55125e,_0x12449f,_0x2461c0;_0x25df4c[_0x91de('0x51')]=intUtil[_0x91de('0x52')](_0x25df4c['remoteUri']);_0x25df4c[_0x91de('0x53')]=intUtil[_0x91de('0x52')](_0x25df4c[_0x91de('0x53')]);def['uri']=util[_0x91de('0x25')](_0x91de('0x54'),_0x25df4c[_0x91de('0x51')]);if(_0x56ccfe&&_0x56ccfe[_0x91de('0x55')]){logger['info'](_0x91de('0x56'),_0x91de('0x57'));_0x189617[_0x91de('0x58')]=util[_0x91de('0x25')](_0x91de('0x59'),_0x25df4c[_0x91de('0x53')],_0x189617[_0x91de('0x5a')],md5(_0x189617[_0x91de('0x5a')]));}else{_0x189617['recordingURL']='';}return getConnection(_0x25df4c)[_0x91de('0x2c')](function(_0x4e829f){_0x2461c0=_0x4e829f;return getUser(_0x25df4c,_0x5736fe['name'],_0x2461c0);})[_0x91de('0x2c')](function(_0x530dc2){_0x9989e4=_0x530dc2;logger[_0x91de('0xf')]('The\x20User\x20ID\x20is:',_0x9989e4['id']);return getEndUser(_0x25df4c,_0x189617[_0x91de('0x5b')],_0x189617[_0x91de('0x5c')],_0x2461c0);})[_0x91de('0x2c')](function(_0x1672a1){_0x55125e=_0x1672a1;logger[_0x91de('0xf')](_0x91de('0x5d'),_0x55125e['id']);return getTicket(_0x25df4c,_0x9989e4,_0x55125e,_0x47e909,_0x189617,_0x47e909[_0x91de('0x5e')],_0x2461c0,_0x91de('0x5f'));})['then'](function(_0x40726b){_0x12449f=_0x40726b;logger[_0x91de('0xf')](_0x91de('0x60'));logger[_0x91de('0xf')](_0x91de('0x61'),_0x12449f['id']);return setRelationship(_0x2461c0,_0x9989e4,_0x12449f,_0x91de('0x62'));})[_0x91de('0x2c')](function(){return setRelationship(_0x2461c0,_0x55125e,_0x12449f,'contacts');})[_0x91de('0x2c')](function(){return getServerInfo(_0x2461c0);})['then'](function(_0x12fad7){var _0x1fa6f2=parseInt(_0x12fad7[_0x91de('0x63')][_0x91de('0x64')](0x0));var _0x5f0c1e=util['format'](_0x91de('0x65'),_0x25df4c['remoteUri'],_0x12449f['id']);if(_0x1fa6f2>0x6){_0x5f0c1e=util[_0x91de('0x25')](_0x91de('0x66'),_0x25df4c[_0x91de('0x51')],_0x12449f['id']);}logger['info']('[QUEUE]',_0x91de('0x67'));emit(util[_0x91de('0x25')](_0x91de('0x68'),_0x5736fe[_0x91de('0x11')]),'trigger:browser:url',{'uri':_0x5f0c1e});})['catch'](function(_0x1f1641){logger[_0x91de('0x69')](_0x91de('0x56'),JSON[_0x91de('0x23')](_0x1f1641));});};exports['outbound']=function(_0x4f3dd4,_0x4b2b2e,_0x166fd3,_0x189e5e,_0x5d29f7,_0x5f510e,_0x1140a9){var _0x18ea88,_0x1f0d83,_0x3256cf,_0x25a1db;_0x5f510e[_0x91de('0x51')]=intUtil['stripTrailingSlash'](_0x5f510e[_0x91de('0x51')]);_0x5f510e['serverUrl']=intUtil[_0x91de('0x52')](_0x5f510e[_0x91de('0x53')]);def[_0x91de('0x6a')]=util[_0x91de('0x25')](_0x91de('0x54'),_0x5f510e[_0x91de('0x51')]);if(_0x1140a9&&_0x1140a9[_0x91de('0x6b')]&&_0x1140a9['recordingFormat']!=='none'){logger['info'](_0x91de('0x6c'),_0x91de('0x57'));_0x4b2b2e['recordingURL']=util['format'](_0x91de('0x59'),_0x5f510e['serverUrl'],_0x4b2b2e['uniqueid'],md5(_0x4b2b2e['uniqueid']));}return getConnection(_0x5f510e)[_0x91de('0x2c')](function(_0x58d472){_0x25a1db=_0x58d472;return getUser(_0x5f510e,_0x189e5e[_0x91de('0x11')],_0x25a1db);})[_0x91de('0x2c')](function(_0xbea444){_0x18ea88=_0xbea444;logger[_0x91de('0xf')]('The\x20User\x20ID\x20is:',_0x18ea88['id']);return getEndUser(_0x5f510e,_0x4b2b2e[_0x91de('0x6d')],_0x4b2b2e[_0x91de('0x6e')],_0x25a1db);})['then'](function(_0x493494){_0x1f0d83=_0x493494;logger[_0x91de('0xf')](_0x91de('0x5d'),_0x1f0d83['id']);return getTicket(_0x5f510e,_0x18ea88,_0x1f0d83,_0x166fd3,_0x4b2b2e,_0x166fd3['Fields'],_0x25a1db,_0x91de('0x6f'));})[_0x91de('0x2c')](function(_0x2eccfd){_0x3256cf=_0x2eccfd;logger[_0x91de('0xf')](_0x91de('0x60'));logger[_0x91de('0xf')](_0x91de('0x61'),_0x3256cf['id']);return setRelationship(_0x25a1db,_0x18ea88,_0x3256cf,_0x91de('0x62'));})[_0x91de('0x2c')](function(){return setRelationship(_0x25a1db,_0x1f0d83,_0x3256cf,'contacts');})['then'](function(){return getServerInfo(_0x25a1db);})[_0x91de('0x2c')](function(_0x5f6b9d){var _0x245e6c=parseInt(_0x5f6b9d[_0x91de('0x63')][_0x91de('0x64')](0x0));var _0x103340=util[_0x91de('0x25')](_0x91de('0x65'),_0x5f510e[_0x91de('0x51')],_0x3256cf['id']);if(_0x245e6c>0x6){_0x103340=util[_0x91de('0x25')](_0x91de('0x66'),_0x5f510e[_0x91de('0x51')],_0x3256cf['id']);}logger[_0x91de('0xf')](_0x91de('0x6c'),_0x91de('0x67'));emit(util[_0x91de('0x25')](_0x91de('0x68'),_0x189e5e['name']),_0x91de('0x70'),{'uri':_0x103340});})[_0x91de('0x71')](function(_0x5e51c9){logger[_0x91de('0x69')]('[OUTBOUND]',JSON[_0x91de('0x23')](_0x5e51c9));});};exports[_0x91de('0x72')]=function(_0xc7cd6f,_0x35f64d,_0x1f1cb5,_0x111a8c,_0x12d270,_0x599142){var _0x3f1fb8,_0x29be6e,_0x5ce2d7,_0xcf9bf2;_0x599142['remoteUri']=intUtil[_0x91de('0x52')](_0x599142[_0x91de('0x51')]);_0x599142[_0x91de('0x53')]=intUtil[_0x91de('0x52')](_0x599142[_0x91de('0x53')]);def[_0x91de('0x6a')]=util[_0x91de('0x25')](_0x91de('0x54'),_0x599142[_0x91de('0x51')]);if(_0x12d270&&_0x12d270[_0x91de('0x55')]){logger[_0x91de('0xf')]('['+_0x35f64d[_0x91de('0x73')][_0x91de('0x74')]()+']','Recording\x20is\x20enabled!');_0x35f64d['recordingURL']=util['format'](_0x91de('0x59'),_0x599142[_0x91de('0x53')],_0x35f64d[_0x91de('0x5a')],md5(_0x35f64d[_0x91de('0x5a')]));}else{_0x35f64d['recordingURL']='';}return getConnection(_0x599142)['then'](function(_0x1af500){_0xcf9bf2=_0x1af500;if(!_['isNil'](_0x111a8c)){return getUser(_0x599142,_0x111a8c[_0x91de('0x11')],_0xcf9bf2);}else{return getUser(_0x599142,null,_0xcf9bf2);}})[_0x91de('0x2c')](function(_0x7245ad){_0x3f1fb8=_0x7245ad;logger['info'](_0x91de('0x75'),_0x3f1fb8['id']);return getEndUser(_0x599142,_0x35f64d[_0x91de('0x5b')],_0x35f64d[_0x91de('0x5c')],_0xcf9bf2);})[_0x91de('0x2c')](function(_0x42427d){_0x29be6e=_0x42427d;logger[_0x91de('0xf')](_0x91de('0x5d'),_0x29be6e['id']);return getTicket(_0x599142,_0x3f1fb8,_0x29be6e,_0x1f1cb5,_0x35f64d,_0x1f1cb5['Fields'],_0xcf9bf2,_0x91de('0x5f'));})['then'](function(_0x418059){_0x5ce2d7=_0x418059;logger['info']('Ticket\x20created!');logger[_0x91de('0xf')]('The\x20Ticket\x20ID\x20is:',_0x5ce2d7['id']);return setRelationship(_0xcf9bf2,_0x3f1fb8,_0x5ce2d7,_0x91de('0x62'));})[_0x91de('0x2c')](function(){return setRelationship(_0xcf9bf2,_0x29be6e,_0x5ce2d7,'contacts');})[_0x91de('0x2c')](function(){return getServerInfo(_0xcf9bf2);})['catch'](function(_0x4ea9d7){logger[_0x91de('0x69')]('['+_0x35f64d['lastevent'][_0x91de('0x74')]()+']',JSON[_0x91de('0x23')](_0x4ea9d7));});}; \ No newline at end of file +var _0xf180=['toUpperCase','Inbound','lastevent','lodash','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','length','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','get_server_info','isNil','get_entry_list','Employees','user_name','entry_list','find','value','Agent\x20found!','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','name','phone_home','then','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toString','custom_fields','idField','variable','customVariable','Variable','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','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','[QUEUE]','user:%s','catch','outbound','none','[OUTBOUND]','destcalleridnum','Outbound','contacts','trigger:browser:url','error','unmanaged'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xf180,0x165));var _0x0f18=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xf180[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0f18('0x0'));var rp=require('request-promise');var BPromise=require(_0x0f18('0x1'));var md5=require(_0x0f18('0x2'));var util=require(_0x0f18('0x3'));var Redis=require(_0x0f18('0x4'));var intUtil=require(_0x0f18('0x5'));var config=require(_0x0f18('0x6'));var logger=require(_0x0f18('0x7'))('sugarcrm');config[_0x0f18('0x8')]=_[_0x0f18('0x9')](config[_0x0f18('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x0f18('0xa'))(new Redis(config[_0x0f18('0x8')]));var def={'method':_0x0f18('0xb'),'json':!![]};function emit(_0x333e4b,_0x11c596,_0x2081b5){io['to'](_0x333e4b)['emit'](_0x11c596,_0x2081b5);}function getTicket(_0x3cf836,_0x2fcd05,_0x9f1963,_0x5269fc,_0x6cc6b5,_0x14284a,_0x3f1dbe,_0xdbf78e){logger[_0x0f18('0xc')](_0x0f18('0xd'));var _0x3c9326=new Date();var _0xa159c9=[{'name':'name','value':intUtil[_0x0f18('0xe')](_0x5269fc['Subjects'],_0x6cc6b5,'\x20')},{'name':_0x0f18('0xf'),'value':_0x2fcd05['id']},{'name':_0x0f18('0x10'),'value':_0x2fcd05['id']},{'name':'description','value':intUtil[_0x0f18('0xe')](_0x5269fc[_0x0f18('0x11')],_0x6cc6b5,'\x0a')},{'name':_0x0f18('0x12'),'value':_0x3c9326[_0x0f18('0x13')]()[_0x0f18('0x14')](0x0,0x13)[_0x0f18('0x15')]('T','\x20')},{'name':_0x0f18('0x16'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x0f18('0x17'),'value':_0x9f1963['id']},{'name':_0x0f18('0x18'),'value':'Contacts'},{'name':_0x0f18('0x19'),'value':_0x9f1963['name']},{'name':_0x0f18('0x1a'),'value':_0xdbf78e}];if(_0x14284a[_0x0f18('0x1b')]){_['forEach'](_0x14284a,function(_0x440534){if(_0x6cc6b5[_0x440534[_0x0f18('0x1c')]]){_0xa159c9[_0x0f18('0x1d')]({'name':_0x440534['idField'],'value':_0x6cc6b5[_0x440534['variableName']]});}});}return request({'form':{'method':_0x0f18('0x1e'),'input_type':_0x0f18('0x1f'),'response_type':_0x0f18('0x1f'),'rest_data':JSON[_0x0f18('0x20')]({'session':_0x3f1dbe['id'],'module_name':'Calls','name_value_list':_0xa159c9})}});}function getAuth(_0x5e744f){return util[_0x0f18('0x21')](_0x0f18('0x22'),new Buffer(_0x5e744f[_0x0f18('0x23')]+':X')['toString']('base64'));}function getServerInfo(_0x8b5d39){return request({'form':{'method':_0x0f18('0x24'),'input_type':'JSON','response_type':_0x0f18('0x1f'),'rest_data':JSON[_0x0f18('0x20')]({'session':_0x8b5d39['id']})}});}function getUser(_0x129da4,_0x229a8a,_0x776bb){if(!_[_0x0f18('0x25')](_0x229a8a)){logger[_0x0f18('0xc')]('Getting\x20agent\x20with\x20name',_0x229a8a);return request({'form':{'method':_0x0f18('0x26'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x0f18('0x20')]({'session':_0x776bb['id'],'module_name':_0x0f18('0x27'),'query':util[_0x0f18('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x229a8a),'order_by':'','offset':'0','select_fields':['id','name',_0x0f18('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x413ae8){if(_0x413ae8[_0x0f18('0x29')][_0x0f18('0x1b')]){var _0x555253=_[_0x0f18('0x2a')](_0x413ae8['entry_list'],function(_0x352456){return _0x352456['name_value_list'][_0x0f18('0x28')][_0x0f18('0x2b')]===_0x229a8a;});if(_0x555253){logger[_0x0f18('0xc')](_0x0f18('0x2c'));return BPromise['resolve']({'id':_0x555253[_0x0f18('0x2d')]['id'][_0x0f18('0x2b')],'name':_0x555253['name_value_list']['name'][_0x0f18('0x2b')]});}}logger[_0x0f18('0xc')](_0x0f18('0x2e'));return BPromise[_0x0f18('0x2f')]({'id':_0x776bb[_0x0f18('0x2d')]['user_id'][_0x0f18('0x2b')],'name':_0x776bb['name_value_list'][_0x0f18('0x28')][_0x0f18('0x2b')]});});}else{logger[_0x0f18('0xc')](_0x0f18('0x30'));return BPromise[_0x0f18('0x2f')]({'id':_0x776bb[_0x0f18('0x2d')][_0x0f18('0x31')][_0x0f18('0x2b')],'name':_0x776bb[_0x0f18('0x2d')][_0x0f18('0x28')][_0x0f18('0x2b')]});}}function getEndUser(_0xf25083,_0x2431c6,_0x532c89,_0x548d3d){logger[_0x0f18('0xc')](_0x0f18('0x32'),_0x532c89);return request({'form':{'method':'get_entry_list','input_type':_0x0f18('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0f18('0x20')]({'session':_0x548d3d['id'],'module_name':_0x0f18('0x33'),'query':util[_0x0f18('0x21')](_0x0f18('0x34'),_0x532c89),'order_by':'','offset':'0','select_fields':['id',_0x0f18('0x35'),_0x0f18('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0f18('0x37')](function(_0x45de71){if(_0x45de71[_0x0f18('0x29')][_0x0f18('0x1b')]){var _0x3ccf03=_[_0x0f18('0x2a')](_0x45de71[_0x0f18('0x29')],function(_0x376298){return _0x376298[_0x0f18('0x2d')]['phone_home'][_0x0f18('0x2b')]===_0x532c89;});if(_0x3ccf03){logger['info'](_0x0f18('0x38'));return BPromise['resolve']({'id':_0x3ccf03[_0x0f18('0x2d')]['id'][_0x0f18('0x2b')],'name':_0x3ccf03[_0x0f18('0x2d')][_0x0f18('0x35')][_0x0f18('0x2b')],'phone':_0x3ccf03['name_value_list'][_0x0f18('0x36')][_0x0f18('0x2b')]});}}else{logger[_0x0f18('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x0f18('0x1e'),'input_type':_0x0f18('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x548d3d['id'],'module_name':_0x0f18('0x33'),'name_value_list':[{'name':_0x0f18('0x39'),'value':_0x2431c6!==_0x0f18('0x3a')?_0x2431c6:util['format'](_0x0f18('0x3b'),_0x532c89)},{'name':_0x0f18('0x36'),'value':_0x532c89}]})}})['then'](function(_0xce54cb){logger['info']('Enduser\x20created.');return BPromise['resolve']({'id':_0xce54cb['id'],'name':_0xce54cb[_0x0f18('0x29')][_0x0f18('0x39')][_0x0f18('0x2b')],'phone':_0xce54cb['entry_list']['phone_home']['value']});});}});}function request(_0x472415){logger[_0x0f18('0x3c')](_0x0f18('0x3d'),JSON[_0x0f18('0x20')](_0x472415));return rp(_[_0x0f18('0x3e')](def,_0x472415));}function getTags(_0x457987,_0x599edd){var _0x4fc172=[];if(_0x457987&&_0x457987[_0x0f18('0x1b')]>0x0){_0x4fc172=_[_0x0f18('0x3f')](_0x457987,_0x599edd);}return _0x4fc172;}function getCustomFields(_0x731c76,_0x114d6c){var _0x592fab=[];var _0x22510e={'custom_fields':[]};if(_0x731c76[_0x0f18('0x1b')]>0x0){_[_0x0f18('0x40')](_0x731c76,function(_0x35c2a7){if(_0x35c2a7[_0x0f18('0x41')]===_0x0f18('0x42')&&_0x35c2a7[_0x0f18('0x43')]&&!_0x35c2a7[_0x0f18('0x44')]){_0x22510e[_0x35c2a7[_0x0f18('0x43')]['toLowerCase']()]=_0x35c2a7['content'][_0x0f18('0x45')]();}else if(_0x35c2a7[_0x0f18('0x41')]===_0x0f18('0x42')&&_0x35c2a7['idField']&&_0x35c2a7[_0x0f18('0x44')]){_0x22510e[_0x0f18('0x46')][_0x0f18('0x1d')]({'id':_0x35c2a7[_0x0f18('0x47')],'value':_0x35c2a7['content'][_0x0f18('0x45')]()});}else if(_0x35c2a7[_0x0f18('0x41')]===_0x0f18('0x48')&&_0x35c2a7[_0x0f18('0x1c')]&&_0x35c2a7[_0x0f18('0x47')]&&_0x35c2a7[_0x0f18('0x44')]){_0x114d6c[_0x35c2a7[_0x0f18('0x1c')]]&&_0x22510e[_0x0f18('0x46')][_0x0f18('0x1d')]({'id':_0x35c2a7[_0x0f18('0x47')],'value':_0x114d6c[_0x35c2a7[_0x0f18('0x1c')]]['toString']()});}else if(_0x35c2a7['type']===_0x0f18('0x49')&&_0x35c2a7['Variable']&&_0x35c2a7[_0x0f18('0x4a')][_0x0f18('0x35')]&&_0x35c2a7[_0x0f18('0x47')]&&_0x35c2a7[_0x0f18('0x44')]){_0x114d6c[_0x35c2a7['Variable']['name']['toLowerCase']()]&&_0x22510e[_0x0f18('0x46')][_0x0f18('0x1d')]({'id':_0x35c2a7[_0x0f18('0x47')],'value':_0x114d6c[_0x35c2a7[_0x0f18('0x4a')][_0x0f18('0x35')]['toLowerCase']()]['toString']()});}});}return _0x22510e;}function getConnection(_0x27e76f){return request({'method':_0x0f18('0xb'),'form':{'method':'login','input_type':_0x0f18('0x1f'),'response_type':_0x0f18('0x1f'),'rest_data':JSON[_0x0f18('0x20')]({'user_auth':{'user_name':_0x27e76f['username'],'password':_0x27e76f[_0x0f18('0x4b')],'encryption':_0x0f18('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x0f18('0x37')](function(_0x4eddb3){var _0x1b3400=_0x4eddb3;if(_0x1b3400['id']){def[_0x0f18('0x4d')]=_0x1b3400['id'];return BPromise[_0x0f18('0x2f')](_0x1b3400);}else{throw new Error(util[_0x0f18('0x21')](_0x0f18('0x4e'),_0x27e76f['id']));}});}function setRelationship(_0x699f97,_0x50d117,_0xa95e3b,_0x2d3936){return request({'form':{'method':_0x0f18('0x4f'),'input_type':_0x0f18('0x1f'),'response_type':'JSON','rest_data':JSON[_0x0f18('0x20')]({'session':_0x699f97['id'],'module_name':_0x0f18('0x50'),'module_id':_0xa95e3b['id'],'link_field_name':_0x2d3936,'related_ids':[_0x50d117['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0f18('0x51')]=function(_0x56d2fd,_0xa4a6cb,_0x1906e8,_0x41bdb2,_0x3074a9,_0x184ba5){var _0x348360,_0x1dcd51,_0x2acc4a,_0x179513;_0x184ba5[_0x0f18('0x52')]=intUtil[_0x0f18('0x53')](_0x184ba5[_0x0f18('0x52')]);_0x184ba5[_0x0f18('0x54')]=intUtil[_0x0f18('0x53')](_0x184ba5[_0x0f18('0x54')]);def[_0x0f18('0x55')]=util[_0x0f18('0x21')](_0x0f18('0x56'),_0x184ba5[_0x0f18('0x52')]);if(_0x3074a9&&_0x3074a9[_0x0f18('0x57')]){logger['info']('[QUEUE]',_0x0f18('0x58'));_0xa4a6cb[_0x0f18('0x59')]=util[_0x0f18('0x21')](_0x0f18('0x5a'),_0x184ba5[_0x0f18('0x54')],_0xa4a6cb['uniqueid'],md5(_0xa4a6cb[_0x0f18('0x5b')]));}else{_0xa4a6cb[_0x0f18('0x59')]='';}return getConnection(_0x184ba5)[_0x0f18('0x37')](function(_0x1af80e){_0x179513=_0x1af80e;return getUser(_0x184ba5,_0x41bdb2[_0x0f18('0x35')],_0x179513);})[_0x0f18('0x37')](function(_0x351245){_0x348360=_0x351245;logger[_0x0f18('0xc')](_0x0f18('0x5c'),_0x348360['id']);return getEndUser(_0x184ba5,_0xa4a6cb[_0x0f18('0x5d')],_0xa4a6cb[_0x0f18('0x5e')],_0x179513);})['then'](function(_0x323194){_0x1dcd51=_0x323194;logger[_0x0f18('0xc')](_0x0f18('0x5f'),_0x1dcd51['id']);return getTicket(_0x184ba5,_0x348360,_0x1dcd51,_0x1906e8,_0xa4a6cb,_0x1906e8[_0x0f18('0x60')],_0x179513,'Inbound');})['then'](function(_0x3c2d77){_0x2acc4a=_0x3c2d77;logger[_0x0f18('0xc')](_0x0f18('0x61'));logger[_0x0f18('0xc')](_0x0f18('0x62'),_0x2acc4a['id']);return setRelationship(_0x179513,_0x348360,_0x2acc4a,_0x0f18('0x63'));})[_0x0f18('0x37')](function(){return setRelationship(_0x179513,_0x1dcd51,_0x2acc4a,'contacts');})[_0x0f18('0x37')](function(){return getServerInfo(_0x179513);})['then'](function(_0x266e5a){var _0x372f4c=parseInt(_0x266e5a[_0x0f18('0x64')]['charAt'](0x0));var _0x507a14=util[_0x0f18('0x21')](_0x0f18('0x65'),_0x184ba5[_0x0f18('0x52')],_0x2acc4a['id']);if(_0x372f4c>0x6){_0x507a14=util[_0x0f18('0x21')](_0x0f18('0x66'),_0x184ba5[_0x0f18('0x52')],_0x2acc4a['id']);}logger[_0x0f18('0xc')](_0x0f18('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0f18('0x21')](_0x0f18('0x68'),_0x41bdb2[_0x0f18('0x35')]),'trigger:browser:url',{'uri':_0x507a14});})[_0x0f18('0x69')](function(_0x809ef5){logger['error'](_0x0f18('0x67'),JSON['stringify'](_0x809ef5));});};exports[_0x0f18('0x6a')]=function(_0x298a7f,_0x3bab89,_0x7a8d20,_0x4b4830,_0x1c2cfb,_0x203516,_0x4c0fce){var _0x41c552,_0x3311c3,_0x5823c7,_0x2e9e56;_0x203516[_0x0f18('0x52')]=intUtil['stripTrailingSlash'](_0x203516[_0x0f18('0x52')]);_0x203516[_0x0f18('0x54')]=intUtil[_0x0f18('0x53')](_0x203516['serverUrl']);def[_0x0f18('0x55')]=util[_0x0f18('0x21')]('%s/service/v4_1/rest.php',_0x203516[_0x0f18('0x52')]);if(_0x4c0fce&&_0x4c0fce['recordingFormat']&&_0x4c0fce['recordingFormat']!==_0x0f18('0x6b')){logger['info'](_0x0f18('0x6c'),_0x0f18('0x58'));_0x3bab89[_0x0f18('0x59')]=util[_0x0f18('0x21')](_0x0f18('0x5a'),_0x203516['serverUrl'],_0x3bab89[_0x0f18('0x5b')],md5(_0x3bab89[_0x0f18('0x5b')]));}return getConnection(_0x203516)[_0x0f18('0x37')](function(_0x278a44){_0x2e9e56=_0x278a44;return getUser(_0x203516,_0x4b4830[_0x0f18('0x35')],_0x2e9e56);})['then'](function(_0x5e3298){_0x41c552=_0x5e3298;logger['info'](_0x0f18('0x5c'),_0x41c552['id']);return getEndUser(_0x203516,_0x3bab89['destcalleridname'],_0x3bab89[_0x0f18('0x6d')],_0x2e9e56);})[_0x0f18('0x37')](function(_0x344334){_0x3311c3=_0x344334;logger['info'](_0x0f18('0x5f'),_0x3311c3['id']);return getTicket(_0x203516,_0x41c552,_0x3311c3,_0x7a8d20,_0x3bab89,_0x7a8d20['Fields'],_0x2e9e56,_0x0f18('0x6e'));})['then'](function(_0x3aa593){_0x5823c7=_0x3aa593;logger[_0x0f18('0xc')](_0x0f18('0x61'));logger[_0x0f18('0xc')](_0x0f18('0x62'),_0x5823c7['id']);return setRelationship(_0x2e9e56,_0x41c552,_0x5823c7,_0x0f18('0x63'));})['then'](function(){return setRelationship(_0x2e9e56,_0x3311c3,_0x5823c7,_0x0f18('0x6f'));})[_0x0f18('0x37')](function(){return getServerInfo(_0x2e9e56);})[_0x0f18('0x37')](function(_0x4220b0){var _0x38c24f=parseInt(_0x4220b0[_0x0f18('0x64')]['charAt'](0x0));var _0x1fa56a=util['format'](_0x0f18('0x65'),_0x203516[_0x0f18('0x52')],_0x5823c7['id']);if(_0x38c24f>0x6){_0x1fa56a=util[_0x0f18('0x21')](_0x0f18('0x66'),_0x203516[_0x0f18('0x52')],_0x5823c7['id']);}logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x0f18('0x21')](_0x0f18('0x68'),_0x4b4830[_0x0f18('0x35')]),_0x0f18('0x70'),{'uri':_0x1fa56a});})['catch'](function(_0x5a64a6){logger[_0x0f18('0x71')]('[OUTBOUND]',JSON[_0x0f18('0x20')](_0x5a64a6));});};exports[_0x0f18('0x72')]=function(_0x5937e5,_0x48cd22,_0x158431,_0x284e11,_0x25bbb8,_0x3dd806){var _0x57646d,_0x4216fe,_0x1b6102,_0x514cc9;_0x3dd806['remoteUri']=intUtil['stripTrailingSlash'](_0x3dd806[_0x0f18('0x52')]);_0x3dd806[_0x0f18('0x54')]=intUtil[_0x0f18('0x53')](_0x3dd806[_0x0f18('0x54')]);def[_0x0f18('0x55')]=util[_0x0f18('0x21')]('%s/service/v4_1/rest.php',_0x3dd806[_0x0f18('0x52')]);if(_0x25bbb8&&_0x25bbb8['monitor_format']){logger['info']('['+_0x48cd22['lastevent'][_0x0f18('0x73')]()+']',_0x0f18('0x58'));_0x48cd22[_0x0f18('0x59')]=util[_0x0f18('0x21')](_0x0f18('0x5a'),_0x3dd806[_0x0f18('0x54')],_0x48cd22['uniqueid'],md5(_0x48cd22[_0x0f18('0x5b')]));}else{_0x48cd22[_0x0f18('0x59')]='';}return getConnection(_0x3dd806)[_0x0f18('0x37')](function(_0x224d0c){_0x514cc9=_0x224d0c;if(!_[_0x0f18('0x25')](_0x284e11)){return getUser(_0x3dd806,_0x284e11[_0x0f18('0x35')],_0x514cc9);}else{return getUser(_0x3dd806,null,_0x514cc9);}})[_0x0f18('0x37')](function(_0x45f2be){_0x57646d=_0x45f2be;logger[_0x0f18('0xc')](_0x0f18('0x5c'),_0x57646d['id']);return getEndUser(_0x3dd806,_0x48cd22[_0x0f18('0x5d')],_0x48cd22[_0x0f18('0x5e')],_0x514cc9);})['then'](function(_0x46c995){_0x4216fe=_0x46c995;logger['info'](_0x0f18('0x5f'),_0x4216fe['id']);return getTicket(_0x3dd806,_0x57646d,_0x4216fe,_0x158431,_0x48cd22,_0x158431[_0x0f18('0x60')],_0x514cc9,_0x0f18('0x74'));})[_0x0f18('0x37')](function(_0x22e1ea){_0x1b6102=_0x22e1ea;logger[_0x0f18('0xc')](_0x0f18('0x61'));logger[_0x0f18('0xc')](_0x0f18('0x62'),_0x1b6102['id']);return setRelationship(_0x514cc9,_0x57646d,_0x1b6102,_0x0f18('0x63'));})[_0x0f18('0x37')](function(){return setRelationship(_0x514cc9,_0x4216fe,_0x1b6102,'contacts');})[_0x0f18('0x37')](function(){return getServerInfo(_0x514cc9);})[_0x0f18('0x69')](function(_0xab03d0){logger[_0x0f18('0x71')]('['+_0x48cd22[_0x0f18('0x75')]['toUpperCase']()+']',JSON[_0x0f18('0x20')](_0xab03d0));});}; \ 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 de0c140..da71f15 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 _0xd9f4=['variableName','push','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','keyContent','variable','customVariable','join','stripTrailingSlash','substring','lastIndexOf','isNil','test','lodash','getString','length','type'];(function(_0xf10840,_0xad3916){var _0x1fdf7e=function(_0x463be3){while(--_0x463be3){_0xf10840['push'](_0xf10840['shift']());}};_0x1fdf7e(++_0xad3916);}(_0xd9f4,0xc4));var _0x4d9f=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xd9f4[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x4d9f('0x0'));var util=require('util');exports[_0x4d9f('0x1')]=function(_0x9aeee,_0x9f2b02,_0x617fff){var _0x35a676=[];if(_0x9aeee[_0x4d9f('0x2')]>0x0){var _0x38c9ad=_['sortBy'](_0x9aeee,['id']);for(var _0x552415=0x0;_0x552415<_0x38c9ad['length'];_0x552415++){var _0x7014f=_0x38c9ad[_0x552415];if(_0x7014f[_0x4d9f('0x3')]==='string'){_0x35a676['push'](_0x7014f['content']);}else if(_0x7014f['type']==='variable'&&_0x7014f[_0x4d9f('0x4')]){_0x9f2b02[_0x7014f[_0x4d9f('0x4')]]&&_0x35a676[_0x4d9f('0x5')](_0x9f2b02[_0x7014f[_0x4d9f('0x4')]][_0x4d9f('0x6')]());}else if(_0x7014f['type']==='customVariable'&&_0x7014f[_0x4d9f('0x7')]&&_0x7014f['Variable']['name']){_0x9f2b02[_0x7014f[_0x4d9f('0x7')][_0x4d9f('0x8')][_0x4d9f('0x9')]()]&&_0x35a676[_0x4d9f('0x5')](_0x9f2b02[_0x7014f['Variable'][_0x4d9f('0x8')][_0x4d9f('0x9')]()][_0x4d9f('0x6')]());}else if(_0x7014f[_0x4d9f('0x3')]===_0x4d9f('0xa')){if(_0x7014f[_0x4d9f('0xb')]===_0x4d9f('0xc')&&_0x7014f[_0x4d9f('0xd')]){_0x35a676['push'](util[_0x4d9f('0xe')](_0x4d9f('0xf'),_0x7014f[_0x4d9f('0xd')],_0x7014f[_0x4d9f('0x10')]));}else if(_0x7014f[_0x4d9f('0xb')]===_0x4d9f('0x11')&&_0x7014f[_0x4d9f('0x4')]&&_0x7014f[_0x4d9f('0xd')]){_0x9f2b02[_0x7014f[_0x4d9f('0x4')]]&&_0x35a676['push'](util[_0x4d9f('0xe')](_0x4d9f('0xf'),_0x7014f['key'],_0x9f2b02[_0x7014f[_0x4d9f('0x4')]]));}else if(_0x7014f[_0x4d9f('0xb')]===_0x4d9f('0x12')&&_0x7014f['Variable']&&_0x7014f[_0x4d9f('0x7')]['name']&&_0x7014f[_0x4d9f('0xd')]){_0x9f2b02[_0x7014f[_0x4d9f('0x7')]['name'][_0x4d9f('0x9')]()]&&_0x35a676['push'](util[_0x4d9f('0xe')](_0x4d9f('0xf'),_0x7014f['key'],_0x9f2b02[_0x7014f[_0x4d9f('0x7')][_0x4d9f('0x8')][_0x4d9f('0x9')]()]));}}}}return _0x35a676[_0x4d9f('0x13')](_0x617fff);};exports[_0x4d9f('0x14')]=function(_0x49f675){var _0x1a67f9=_0x49f675['slice'](-0x1);if(_0x1a67f9==='/'){_0x49f675=_0x49f675[_0x4d9f('0x15')](0x0,_0x49f675[_0x4d9f('0x16')](_0x1a67f9));}return _0x49f675;};exports['validateEmail']=function(_0x11bdd3){if(!_[_0x4d9f('0x17')](_0x11bdd3)&&_0x11bdd3!==''){var _0x2fcb3c=/^(([^<>()\[\]\\.,;:\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 _0x2fcb3c[_0x4d9f('0x18')](String(_0x11bdd3)[_0x4d9f('0x9')]());}else{return![];}}; \ No newline at end of file +var _0x73d8=['key','format','%s:\x20%s','keyContent','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','util','getString','sortBy','type','push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType'];(function(_0x489eac,_0x3828bb){var _0x10b18a=function(_0x3b6b6b){while(--_0x3b6b6b){_0x489eac['push'](_0x489eac['shift']());}};_0x10b18a(++_0x3828bb);}(_0x73d8,0x1e5));var _0x873d=function(_0x4ac3b6,_0x1d220e){_0x4ac3b6=_0x4ac3b6-0x0;var _0x72a594=_0x73d8[_0x4ac3b6];return _0x72a594;};'use strict';var _=require('lodash');var util=require(_0x873d('0x0'));exports[_0x873d('0x1')]=function(_0x14ec0e,_0x4754b6,_0x30d5df){var _0x1845d3=[];if(_0x14ec0e['length']>0x0){var _0x2c77cf=_[_0x873d('0x2')](_0x14ec0e,['id']);for(var _0x46bee=0x0;_0x46bee<_0x2c77cf['length'];_0x46bee++){var _0x2920ef=_0x2c77cf[_0x46bee];if(_0x2920ef[_0x873d('0x3')]==='string'){_0x1845d3[_0x873d('0x4')](_0x2920ef[_0x873d('0x5')]);}else if(_0x2920ef['type']===_0x873d('0x6')&&_0x2920ef[_0x873d('0x7')]){_0x4754b6[_0x2920ef[_0x873d('0x7')]]&&_0x1845d3[_0x873d('0x4')](_0x4754b6[_0x2920ef[_0x873d('0x7')]][_0x873d('0x8')]());}else if(_0x2920ef['type']===_0x873d('0x9')&&_0x2920ef[_0x873d('0xa')]&&_0x2920ef['Variable'][_0x873d('0xb')]){_0x4754b6[_0x2920ef['Variable'][_0x873d('0xb')][_0x873d('0xc')]()]&&_0x1845d3[_0x873d('0x4')](_0x4754b6[_0x2920ef[_0x873d('0xa')]['name']['toLowerCase']()][_0x873d('0x8')]());}else if(_0x2920ef[_0x873d('0x3')]===_0x873d('0xd')){if(_0x2920ef[_0x873d('0xe')]==='string'&&_0x2920ef[_0x873d('0xf')]){_0x1845d3[_0x873d('0x4')](util[_0x873d('0x10')](_0x873d('0x11'),_0x2920ef['key'],_0x2920ef[_0x873d('0x12')]));}else if(_0x2920ef[_0x873d('0xe')]===_0x873d('0x6')&&_0x2920ef[_0x873d('0x7')]&&_0x2920ef[_0x873d('0xf')]){_0x4754b6[_0x2920ef['variableName']]&&_0x1845d3[_0x873d('0x4')](util[_0x873d('0x10')](_0x873d('0x11'),_0x2920ef['key'],_0x4754b6[_0x2920ef['variableName']]));}else if(_0x2920ef[_0x873d('0xe')]===_0x873d('0x9')&&_0x2920ef[_0x873d('0xa')]&&_0x2920ef[_0x873d('0xa')][_0x873d('0xb')]&&_0x2920ef[_0x873d('0xf')]){_0x4754b6[_0x2920ef[_0x873d('0xa')][_0x873d('0xb')][_0x873d('0xc')]()]&&_0x1845d3[_0x873d('0x4')](util[_0x873d('0x10')](_0x873d('0x11'),_0x2920ef[_0x873d('0xf')],_0x4754b6[_0x2920ef[_0x873d('0xa')][_0x873d('0xb')]['toLowerCase']()]));}}}}return _0x1845d3[_0x873d('0x13')](_0x30d5df);};exports[_0x873d('0x14')]=function(_0x12a508){var _0x5a3a8c=_0x12a508[_0x873d('0x15')](-0x1);if(_0x5a3a8c==='/'){_0x12a508=_0x12a508[_0x873d('0x16')](0x0,_0x12a508[_0x873d('0x17')](_0x5a3a8c));}return _0x12a508;};exports['validateEmail']=function(_0x41a7a6){if(!_[_0x873d('0x18')](_0x41a7a6)&&_0x41a7a6!==''){var _0x168d17=/^(([^<>()\[\]\\.,;:\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 _0x168d17['test'](String(_0x41a7a6)[_0x873d('0xc')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 28cdbe5..33cf86b 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(_0x126931,_0x2fa7cf){var _0x26ff5b=function(_0x34bdca){while(--_0x34bdca){_0x126931['push'](_0x126931['shift']());}};_0x26ff5b(++_0x2fa7cf);}(_0x34e8,0x12c));var _0x834e=function(_0x494e87,_0x34dac1){_0x494e87=_0x494e87-0x0;var _0x4fce0a=_0x34e8[_0x494e87];return _0x4fce0a;};'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 _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x3ec333,_0x26bcbe){var _0x15ccb8=function(_0x2c4d0c){while(--_0x2c4d0c){_0x3ec333['push'](_0x3ec333['shift']());}};_0x15ccb8(++_0x26bcbe);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 5e5a5c6..133bf58 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 _0x308a=['end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','POST','Caller\x20-\x20%s','Enduser\x20created.','authType','password','token','%s/token:%s','toString','base64','debug','defaults','GET','forEach','includes','string','type','customField','nameField','toLowerCase','content','picklist','idField','push','variableName','custom_fields','customVariable','Variable','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','stripTrailingSlash','recordingFormat','none','destcalleridname','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','%s/agent/tickets/%s','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:','lastevent','lodash','request-promise','util','ioredis','./util','../../../../config/environment','zendesk','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','%s/search.json','type:user\x20role:end-user\x20phone:%s','length','results'];(function(_0x2287df,_0x5a4a24){var _0x2afbc1=function(_0x3af10a){while(--_0x3af10a){_0x2287df['push'](_0x2287df['shift']());}};_0x2afbc1(++_0x5a4a24);}(_0x308a,0xb1));var _0xa308=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x308a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa308('0x0'));var rp=require(_0xa308('0x1'));var md5=require('md5');var util=require(_0xa308('0x2'));var Redis=require(_0xa308('0x3'));var intUtil=require(_0xa308('0x4'));var config=require(_0xa308('0x5'));var logger=require('../../../../config/logger')(_0xa308('0x6'));config[_0xa308('0x7')]=_['defaults'](config[_0xa308('0x7')],{'host':_0xa308('0x8'),'port':0x18eb});var io=require(_0xa308('0x9'))(new Redis(config[_0xa308('0x7')]));function emit(_0x65d750,_0x476999,_0x56bf6f){io['to'](_0x65d750)[_0xa308('0xa')](_0x476999,_0x56bf6f);}var headers={'Content-Type':_0xa308('0xb'),'Accept':_0xa308('0xb')};function getTicket(_0x186daa,_0x319b54,_0x1445f8,_0x3d6032,_0x2cbba1){logger[_0xa308('0xc')](_0xa308('0xd'));return request({'uri':util[_0xa308('0xe')]('%s/tickets.json',_0x186daa[_0xa308('0xf')]),'method':'POST','body':{'ticket':_[_0xa308('0x10')]({'requester_id':_0x1445f8['id'],'submitter_id':_0x319b54?_0x319b54['id']:undefined,'assignee_id':_0x319b54?_0x319b54['id']:undefined,'tags':getTags(_0x3d6032[_0xa308('0x11')],_0xa308('0x12')),'subject':intUtil[_0xa308('0x13')](_0x3d6032[_0xa308('0x14')],_0x2cbba1,'\x20'),'description':intUtil['getString'](_0x3d6032[_0xa308('0x15')],_0x2cbba1,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa308('0x13')](_0x3d6032['Descriptions'],_0x2cbba1,'\x0a')}},getCustomFields(_0x3d6032[_0xa308('0x16')],_0x2cbba1))}})[_0xa308('0x17')](function(_0x45e32a){logger[_0xa308('0xc')](_0xa308('0x18'));return _0x45e32a[_0xa308('0x19')];});}function getUser(_0x42e277,_0x3223ba){if(intUtil[_0xa308('0x1a')](_0x3223ba)){logger[_0xa308('0xc')](_0xa308('0x1b'),_0x3223ba);return request({'uri':util[_0xa308('0xe')]('%s/search.json',_0x42e277[_0xa308('0xf')]),'qs':{'query':util[_0xa308('0xe')](_0xa308('0x1c'),_0x3223ba)}})[_0xa308('0x17')](function(_0x27e614){if(_0x27e614[_0xa308('0x1d')]){logger['info'](_0xa308('0x1e'));return _[_0xa308('0x1f')](_0x27e614['results'],{'email':_0x3223ba,'role':_0xa308('0x20')});}else{logger[_0xa308('0xc')](_0xa308('0x21'));return request({'uri':util[_0xa308('0xe')]('%s/users/me.json',_0x42e277[_0xa308('0xf')])})[_0xa308('0x17')](function(_0x368b67){logger['info'](_0xa308('0x22'));return _0x368b67[_0xa308('0x23')];});}});}else{logger[_0xa308('0xc')](_0xa308('0x21'));return request({'uri':util['format']('%s/users/me.json',_0x42e277[_0xa308('0xf')])})[_0xa308('0x17')](function(_0x4912ea){logger[_0xa308('0xc')](_0xa308('0x22'));return _0x4912ea[_0xa308('0x23')];});}}function getEndUser(_0x27db3c,_0x2bdac2,_0x121180){logger[_0xa308('0xc')](_0xa308('0x24'),_0x121180);return request({'uri':util[_0xa308('0xe')](_0xa308('0x25'),_0x27db3c['remoteUri']),'qs':{'query':util['format'](_0xa308('0x26'),_0x121180)}})[_0xa308('0x17')](function(_0x22a8aa){var _0x56164a;if(_0x22a8aa['results'][_0xa308('0x27')]){_0x22a8aa[_0xa308('0x28')]=_['filter'](_0x22a8aa['results'],{'suspended':![],'role':_0xa308('0x29')});if(_0x22a8aa[_0xa308('0x28')][_0xa308('0x27')]){_0x56164a=_[_0xa308('0x2a')](_0x22a8aa['results']);}}if(_0x56164a){logger['info'](_0xa308('0x2b'));return _0x56164a;}else{logger[_0xa308('0xc')](_0xa308('0x2c'));return request({'uri':util['format'](_0xa308('0x2d'),_0x27db3c[_0xa308('0xf')]),'method':_0xa308('0x2e'),'body':{'user':{'role':_0xa308('0x29'),'name':util[_0xa308('0xe')](_0xa308('0x2f'),_0x2bdac2||_0x121180),'phone':_0x121180}}})[_0xa308('0x17')](function(_0x45c588){logger['info'](_0xa308('0x30'));return _0x45c588[_0xa308('0x23')];});}});}function getAuth(_0xdf53a7){var _0x1e3cd0;if(_0xdf53a7[_0xa308('0x31')]==='password'){_0x1e3cd0=util['format']('%s:%s',_0xdf53a7['username'],_0xdf53a7[_0xa308('0x32')]);}else if(_0xdf53a7[_0xa308('0x31')]===_0xa308('0x33')){_0x1e3cd0=util[_0xa308('0xe')](_0xa308('0x34'),_0xdf53a7['username'],_0xdf53a7['token']);}return util['format']('Basic\x20%s',new Buffer(_0x1e3cd0)[_0xa308('0x35')](_0xa308('0x36')));}function request(_0x5ce1e5){logger[_0xa308('0x37')]('[HTTP]',JSON['stringify'](_0x5ce1e5));return rp(_[_0xa308('0x38')](_0x5ce1e5,{'method':_0xa308('0x39'),'headers':headers,'json':!![]}));}function getTags(_0x2a5360,_0x253517){var _0x5f3677=[];if(_0x2a5360&&_0x2a5360[_0xa308('0x27')]>0x0){_0x5f3677=_['map'](_0x2a5360,_0x253517);}return _0x5f3677;}function getCustomFields(_0x59425c,_0xc84ef3){var _0x4b7b09=[];var _0x49d378={'custom_fields':[]};if(_0x59425c[_0xa308('0x27')]>0x0){_[_0xa308('0x3a')](_0x59425c,function(_0x49f893){if(_[_0xa308('0x3b')]([_0xa308('0x3c'),'picklist'],_0x49f893[_0xa308('0x3d')])&&_0x49f893['nameField']&&!_0x49f893[_0xa308('0x3e')]){_0x49d378[_0x49f893[_0xa308('0x3f')][_0xa308('0x40')]()]=_0x49f893[_0xa308('0x41')]['toString']();}else if(_[_0xa308('0x3b')]([_0xa308('0x3c'),_0xa308('0x42')],_0x49f893['type'])&&_0x49f893[_0xa308('0x43')]&&_0x49f893[_0xa308('0x3e')]){_0x49d378['custom_fields'][_0xa308('0x44')]({'id':_0x49f893[_0xa308('0x43')],'value':_0x49f893[_0xa308('0x41')][_0xa308('0x35')]()});}else if(_0x49f893[_0xa308('0x3d')]==='variable'&&_0x49f893[_0xa308('0x45')]&&_0x49f893['idField']&&_0x49f893[_0xa308('0x3e')]){_0xc84ef3[_0x49f893[_0xa308('0x45')]]&&_0x49d378[_0xa308('0x46')][_0xa308('0x44')]({'id':_0x49f893['idField'],'value':_0xc84ef3[_0x49f893[_0xa308('0x45')]][_0xa308('0x35')]()});}else if(_0x49f893['type']===_0xa308('0x47')&&_0x49f893[_0xa308('0x48')]&&_0x49f893[_0xa308('0x48')][_0xa308('0x12')]&&_0x49f893['idField']&&_0x49f893['customField']){_0xc84ef3[_0x49f893[_0xa308('0x48')][_0xa308('0x12')][_0xa308('0x40')]()]&&_0x49d378['custom_fields'][_0xa308('0x44')]({'id':_0x49f893[_0xa308('0x43')],'value':_0xc84ef3[_0x49f893['Variable'][_0xa308('0x12')][_0xa308('0x40')]()][_0xa308('0x35')]()});}});}return _0x49d378;}exports['queue']=function(_0x36f306,_0x65de00,_0x4908b0,_0x1cf094,_0x1bf38a,_0x2754c1){var _0x4cc89a,_0x340ffc;_0x2754c1[_0xa308('0xf')]=intUtil['stripTrailingSlash'](_0x2754c1['remoteUri']);_0x2754c1[_0xa308('0x49')]=intUtil['stripTrailingSlash'](_0x2754c1['serverUrl']);if(_0x1bf38a&&_0x1bf38a[_0xa308('0x4a')]){logger[_0xa308('0xc')](_0xa308('0x4b'),_0xa308('0x4c'));_0x65de00[_0xa308('0x4d')]=util[_0xa308('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2754c1[_0xa308('0x49')],_0x65de00['uniqueid'],md5(_0x65de00[_0xa308('0x4e')]));}else{_0x65de00[_0xa308('0x4d')]='';}headers[_0xa308('0x4f')]=getAuth(_0x2754c1);return getUser(_0x2754c1,_0x1cf094[_0xa308('0x50')])[_0xa308('0x17')](function(_0x3a38ec){_0x4cc89a=_0x3a38ec;logger[_0xa308('0xc')]('The\x20User\x20ID\x20is:',_0x4cc89a['id']);return getEndUser(_0x2754c1,_0x65de00['calleridname'],_0x65de00[_0xa308('0x51')]);})[_0xa308('0x17')](function(_0x3f4426){_0x340ffc=_0x3f4426;logger[_0xa308('0xc')]('The\x20Enduser\x20ID\x20is:',_0x340ffc['id']);return getTicket(_0x2754c1,_0x4cc89a,_0x340ffc,_0x4908b0,_0x65de00);})[_0xa308('0x17')](function(_0x378c7f){if(_0x378c7f){logger[_0xa308('0xc')](_0xa308('0x52'),_0x378c7f['id']);switch(_0x2754c1[_0xa308('0x3d')]){case _0xa308('0x53'):logger[_0xa308('0xc')](_0xa308('0x4b'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x2754c1[_0xa308('0xf')],_0x4cc89a['id'],_0x378c7f['id']),'method':_0xa308('0x2e')});case _0xa308('0x54'):logger[_0xa308('0xc')](_0xa308('0x4b'),_0xa308('0x55'));emit(util[_0xa308('0xe')](_0xa308('0x56'),_0x1cf094[_0xa308('0x12')]),_0xa308('0x57'),{'uri':util[_0xa308('0xe')]('%s/agent/tickets/%s',_0x2754c1[_0xa308('0xf')][_0xa308('0x58')]('/api/v2',''),_0x378c7f['id'])});break;default:logger[_0xa308('0x59')]('[QUEUE]',_0xa308('0x5a'));}}})[_0xa308('0x5b')](function(_0x4fbbcf){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa308('0x5c')](_0x4fbbcf,{'showHidden':!![],'depth':null}));});};exports[_0xa308('0x5d')]=function(_0x846bed,_0x2af281,_0x57100e,_0x4e0180,_0x2d5710,_0x4e7e17,_0x1076c8){var _0x2615ea,_0x23506f;_0x4e7e17['remoteUri']=intUtil['stripTrailingSlash'](_0x4e7e17[_0xa308('0xf')]);_0x4e7e17[_0xa308('0x49')]=intUtil[_0xa308('0x5e')](_0x4e7e17[_0xa308('0x49')]);if(_0x1076c8&&_0x1076c8[_0xa308('0x5f')]&&_0x1076c8[_0xa308('0x5f')]!==_0xa308('0x60')){logger[_0xa308('0xc')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x2af281['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e7e17['serverUrl'],_0x2af281['uniqueid'],md5(_0x2af281[_0xa308('0x4e')]));}headers[_0xa308('0x4f')]=getAuth(_0x4e7e17);return getUser(_0x4e7e17,_0x4e0180['email'])['then'](function(_0x1f9aff){_0x2615ea=_0x1f9aff;logger[_0xa308('0xc')]('The\x20User\x20ID\x20is:',_0x2615ea['id']);return getEndUser(_0x4e7e17,_0x2af281[_0xa308('0x61')],_0x2af281['destcalleridnum']);})[_0xa308('0x17')](function(_0x5ace7b){_0x23506f=_0x5ace7b;logger[_0xa308('0xc')]('The\x20Enduser\x20ID\x20is:',_0x23506f['id']);return getTicket(_0x4e7e17,_0x2615ea,_0x23506f,_0x57100e,_0x2af281);})[_0xa308('0x17')](function(_0x2f8445){if(_0x2f8445){logger[_0xa308('0xc')]('The\x20Ticket\x20ID\x20is:',_0x2f8445['id']);switch(_0x4e7e17[_0xa308('0x3d')]){case'integrationTab':logger[_0xa308('0xc')](_0xa308('0x62'),_0xa308('0x63'));return request({'uri':util[_0xa308('0xe')](_0xa308('0x64'),_0x4e7e17[_0xa308('0xf')],_0x2615ea['id'],_0x2f8445['id']),'method':_0xa308('0x2e')});case'newTab':logger['info'](_0xa308('0x62'),_0xa308('0x55'));emit(util[_0xa308('0xe')](_0xa308('0x56'),_0x4e0180[_0xa308('0x12')]),_0xa308('0x57'),{'uri':util['format'](_0xa308('0x65'),_0x4e7e17[_0xa308('0xf')][_0xa308('0x58')](_0xa308('0x66'),''),_0x2f8445['id'])});break;default:logger[_0xa308('0x59')](_0xa308('0x62'),_0xa308('0x5a'));}}})[_0xa308('0x5b')](function(_0x437613){logger['error'](_0xa308('0x67'),util[_0xa308('0x5c')](_0x437613,{'showHidden':!![],'depth':null}));});};exports[_0xa308('0x68')]=function(_0x5e4e27,_0x5b78e0,_0x465681,_0x45f47e,_0x53d103,_0x23584a){var _0x23602d,_0x55d384;_0x23584a[_0xa308('0xf')]=intUtil[_0xa308('0x5e')](_0x23584a[_0xa308('0xf')]);_0x23584a['serverUrl']=intUtil['stripTrailingSlash'](_0x23584a[_0xa308('0x49')]);if(_0x53d103&&_0x53d103[_0xa308('0x4a')]){logger['info']('['+_0x5b78e0['lastevent'][_0xa308('0x69')]()+']',_0xa308('0x4c'));_0x5b78e0[_0xa308('0x4d')]=util[_0xa308('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23584a[_0xa308('0x49')],_0x5b78e0[_0xa308('0x4e')],md5(_0x5b78e0['uniqueid']));}else{_0x5b78e0['recordingURL']='';}headers[_0xa308('0x4f')]=getAuth(_0x23584a);return getUser(_0x23584a)[_0xa308('0x17')](function(_0x42a966){_0x23602d=_0x42a966;logger['info']('The\x20User\x20ID\x20is:',_0x23602d['id']);return getEndUser(_0x23584a,_0x5b78e0[_0xa308('0x6a')],_0x5b78e0[_0xa308('0x51')]);})[_0xa308('0x17')](function(_0x2e219c){_0x55d384=_0x2e219c;logger[_0xa308('0xc')](_0xa308('0x6b'),_0x55d384['id']);return getTicket(_0x23584a,_0x23602d,_0x55d384,_0x465681,_0x5b78e0);})[_0xa308('0x17')](function(_0x3dc36e){if(_0x3dc36e){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3dc36e['id']);}})[_0xa308('0x5b')](function(_0x36389d){logger[_0xa308('0x59')]('['+_0x5b78e0[_0xa308('0x6c')][_0xa308('0x69')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xa308('0x5c')](_0x36389d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa27c=['calleridnum','catch','toUpperCase','request-promise','md5','./util','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','filter','end-user','first','Enduser\x20found!','%s/users.json','password','username','authType','%s/token:%s','token','Basic\x20%s','toString','base64','[HTTP]','defaults','length','forEach','string','picklist','type','nameField','customField','toLowerCase','includes','custom_fields','idField','variableName','Variable','push','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','inspect','recordingFormat','none','recordingURL','Authorization','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','newTab','trigger:browser:url','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','monitor_format','lastevent'];(function(_0x2cd57,_0x14549f){var _0x39d8a6=function(_0x269346){while(--_0x269346){_0x2cd57['push'](_0x2cd57['shift']());}};_0x39d8a6(++_0x14549f);}(_0xa27c,0x68));var _0xca27=function(_0x16597f,_0x5d3279){_0x16597f=_0x16597f-0x0;var _0x4ba6ea=_0xa27c[_0x16597f];return _0x4ba6ea;};'use strict';var _=require('lodash');var rp=require(_0xca27('0x0'));var md5=require(_0xca27('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xca27('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xca27('0x3'));config['redis']=_['defaults'](config[_0xca27('0x4')],{'host':_0xca27('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0xdf8c15,_0x1b1732,_0x4bfd38){io['to'](_0xdf8c15)[_0xca27('0x6')](_0x1b1732,_0x4bfd38);}var headers={'Content-Type':'application/json','Accept':_0xca27('0x7')};function getTicket(_0x50e1b2,_0x4fae25,_0x14edbe,_0x1a77a9,_0x2531be){logger[_0xca27('0x8')](_0xca27('0x9'));return request({'uri':util[_0xca27('0xa')](_0xca27('0xb'),_0x50e1b2[_0xca27('0xc')]),'method':_0xca27('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x14edbe['id'],'submitter_id':_0x4fae25?_0x4fae25['id']:undefined,'assignee_id':_0x4fae25?_0x4fae25['id']:undefined,'tags':getTags(_0x1a77a9[_0xca27('0xe')],_0xca27('0xf')),'subject':intUtil[_0xca27('0x10')](_0x1a77a9['Subjects'],_0x2531be,'\x20'),'description':intUtil[_0xca27('0x10')](_0x1a77a9[_0xca27('0x11')],_0x2531be,'\x0a'),'comment':{'public':![],'body':intUtil[_0xca27('0x10')](_0x1a77a9[_0xca27('0x11')],_0x2531be,'\x0a')}},getCustomFields(_0x1a77a9[_0xca27('0x12')],_0x2531be))}})[_0xca27('0x13')](function(_0x31b131){logger[_0xca27('0x8')](_0xca27('0x14'));return _0x31b131[_0xca27('0x15')];});}function getUser(_0x380f82,_0x21d293){if(intUtil[_0xca27('0x16')](_0x21d293)){logger[_0xca27('0x8')](_0xca27('0x17'),_0x21d293);return request({'uri':util[_0xca27('0xa')](_0xca27('0x18'),_0x380f82[_0xca27('0xc')]),'qs':{'query':util[_0xca27('0xa')](_0xca27('0x19'),_0x21d293)}})['then'](function(_0x27c880){if(_0x27c880[_0xca27('0x1a')]){logger[_0xca27('0x8')]('Agent\x20found!');return _[_0xca27('0x1b')](_0x27c880[_0xca27('0x1c')],{'email':_0x21d293,'role':_0xca27('0x1d')});}else{logger[_0xca27('0x8')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xca27('0xa')](_0xca27('0x1e'),_0x380f82['remoteUri'])})[_0xca27('0x13')](function(_0x132973){logger[_0xca27('0x8')](_0xca27('0x1f'));return _0x132973[_0xca27('0x20')];});}});}else{logger['info'](_0xca27('0x21'));return request({'uri':util['format'](_0xca27('0x1e'),_0x380f82['remoteUri'])})[_0xca27('0x13')](function(_0x2adece){logger[_0xca27('0x8')](_0xca27('0x1f'));return _0x2adece['user'];});}}function getEndUser(_0x53b5a6,_0xdc9290,_0x208e75){logger[_0xca27('0x8')]('Searching\x20enduser\x20with\x20phone',_0x208e75);return request({'uri':util[_0xca27('0xa')](_0xca27('0x18'),_0x53b5a6[_0xca27('0xc')]),'qs':{'query':util['format'](_0xca27('0x22'),_0x208e75)}})['then'](function(_0x2b0617){var _0x55279d;if(_0x2b0617[_0xca27('0x1c')]['length']){_0x2b0617[_0xca27('0x1c')]=_[_0xca27('0x23')](_0x2b0617[_0xca27('0x1c')],{'suspended':![],'role':_0xca27('0x24')});if(_0x2b0617[_0xca27('0x1c')]['length']){_0x55279d=_[_0xca27('0x25')](_0x2b0617[_0xca27('0x1c')]);}}if(_0x55279d){logger[_0xca27('0x8')](_0xca27('0x26'));return _0x55279d;}else{logger[_0xca27('0x8')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xca27('0xa')](_0xca27('0x27'),_0x53b5a6[_0xca27('0xc')]),'method':_0xca27('0xd'),'body':{'user':{'role':_0xca27('0x24'),'name':util[_0xca27('0xa')]('Caller\x20-\x20%s',_0xdc9290||_0x208e75),'phone':_0x208e75}}})['then'](function(_0x21ffaa){logger[_0xca27('0x8')]('Enduser\x20created.');return _0x21ffaa['user'];});}});}function getAuth(_0x147cd8){var _0x59ec41;if(_0x147cd8['authType']===_0xca27('0x28')){_0x59ec41=util[_0xca27('0xa')]('%s:%s',_0x147cd8[_0xca27('0x29')],_0x147cd8[_0xca27('0x28')]);}else if(_0x147cd8[_0xca27('0x2a')]==='token'){_0x59ec41=util[_0xca27('0xa')](_0xca27('0x2b'),_0x147cd8['username'],_0x147cd8[_0xca27('0x2c')]);}return util[_0xca27('0xa')](_0xca27('0x2d'),new Buffer(_0x59ec41)[_0xca27('0x2e')](_0xca27('0x2f')));}function request(_0x32759e){logger['debug'](_0xca27('0x30'),JSON['stringify'](_0x32759e));return rp(_[_0xca27('0x31')](_0x32759e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5da84c,_0x1e02fb){var _0x10b95e=[];if(_0x5da84c&&_0x5da84c['length']>0x0){_0x10b95e=_['map'](_0x5da84c,_0x1e02fb);}return _0x10b95e;}function getCustomFields(_0x47807f,_0x57fc5e){var _0x3f897d=[];var _0x4aa84a={'custom_fields':[]};if(_0x47807f[_0xca27('0x32')]>0x0){_[_0xca27('0x33')](_0x47807f,function(_0x4093c1){if(_['includes']([_0xca27('0x34'),_0xca27('0x35')],_0x4093c1[_0xca27('0x36')])&&_0x4093c1[_0xca27('0x37')]&&!_0x4093c1[_0xca27('0x38')]){_0x4aa84a[_0x4093c1[_0xca27('0x37')][_0xca27('0x39')]()]=_0x4093c1['content'][_0xca27('0x2e')]();}else if(_[_0xca27('0x3a')]([_0xca27('0x34'),_0xca27('0x35')],_0x4093c1[_0xca27('0x36')])&&_0x4093c1['idField']&&_0x4093c1[_0xca27('0x38')]){_0x4aa84a[_0xca27('0x3b')]['push']({'id':_0x4093c1[_0xca27('0x3c')],'value':_0x4093c1['content'][_0xca27('0x2e')]()});}else if(_0x4093c1[_0xca27('0x36')]==='variable'&&_0x4093c1[_0xca27('0x3d')]&&_0x4093c1[_0xca27('0x3c')]&&_0x4093c1['customField']){_0x57fc5e[_0x4093c1[_0xca27('0x3d')]]&&_0x4aa84a[_0xca27('0x3b')]['push']({'id':_0x4093c1[_0xca27('0x3c')],'value':_0x57fc5e[_0x4093c1[_0xca27('0x3d')]][_0xca27('0x2e')]()});}else if(_0x4093c1[_0xca27('0x36')]==='customVariable'&&_0x4093c1[_0xca27('0x3e')]&&_0x4093c1['Variable'][_0xca27('0xf')]&&_0x4093c1[_0xca27('0x3c')]&&_0x4093c1[_0xca27('0x38')]){_0x57fc5e[_0x4093c1[_0xca27('0x3e')][_0xca27('0xf')]['toLowerCase']()]&&_0x4aa84a[_0xca27('0x3b')][_0xca27('0x3f')]({'id':_0x4093c1[_0xca27('0x3c')],'value':_0x57fc5e[_0x4093c1[_0xca27('0x3e')][_0xca27('0xf')][_0xca27('0x39')]()][_0xca27('0x2e')]()});}});}return _0x4aa84a;}exports[_0xca27('0x40')]=function(_0x16ae06,_0x116080,_0x355005,_0x7dcf6c,_0x231146,_0x3ed07b){var _0xe9b9d1,_0x8c51dc;_0x3ed07b[_0xca27('0xc')]=intUtil[_0xca27('0x41')](_0x3ed07b[_0xca27('0xc')]);_0x3ed07b[_0xca27('0x42')]=intUtil['stripTrailingSlash'](_0x3ed07b[_0xca27('0x42')]);if(_0x231146&&_0x231146['monitor_format']){logger[_0xca27('0x8')](_0xca27('0x43'),_0xca27('0x44'));_0x116080['recordingURL']=util[_0xca27('0xa')](_0xca27('0x45'),_0x3ed07b['serverUrl'],_0x116080[_0xca27('0x46')],md5(_0x116080[_0xca27('0x46')]));}else{_0x116080['recordingURL']='';}headers['Authorization']=getAuth(_0x3ed07b);return getUser(_0x3ed07b,_0x7dcf6c[_0xca27('0x47')])[_0xca27('0x13')](function(_0x3f54bf){_0xe9b9d1=_0x3f54bf;logger[_0xca27('0x8')](_0xca27('0x48'),_0xe9b9d1['id']);return getEndUser(_0x3ed07b,_0x116080[_0xca27('0x49')],_0x116080['calleridnum']);})['then'](function(_0x421856){_0x8c51dc=_0x421856;logger[_0xca27('0x8')](_0xca27('0x4a'),_0x8c51dc['id']);return getTicket(_0x3ed07b,_0xe9b9d1,_0x8c51dc,_0x355005,_0x116080);})[_0xca27('0x13')](function(_0x3408a4){if(_0x3408a4){logger[_0xca27('0x8')]('The\x20Ticket\x20ID\x20is:',_0x3408a4['id']);switch(_0x3ed07b[_0xca27('0x36')]){case _0xca27('0x4b'):logger['info']('[QUEUE]',_0xca27('0x4c'));return request({'uri':util[_0xca27('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3ed07b[_0xca27('0xc')],_0xe9b9d1['id'],_0x3408a4['id']),'method':_0xca27('0xd')});case'newTab':logger['info']('[QUEUE]',_0xca27('0x4d'));emit(util['format'](_0xca27('0x4e'),_0x7dcf6c['name']),'trigger:browser:url',{'uri':util[_0xca27('0xa')](_0xca27('0x4f'),_0x3ed07b['remoteUri'][_0xca27('0x50')]('/api/v2',''),_0x3408a4['id'])});break;default:logger[_0xca27('0x51')](_0xca27('0x43'),_0xca27('0x52'));}}})['catch'](function(_0x4fd127){logger[_0xca27('0x51')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0xca27('0x53')](_0x4fd127,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x3a8acd,_0x129033,_0x24b712,_0x51a81c,_0x1c2bb5,_0x107da4,_0x3e50da){var _0x324372,_0x5ebac2;_0x107da4[_0xca27('0xc')]=intUtil[_0xca27('0x41')](_0x107da4[_0xca27('0xc')]);_0x107da4[_0xca27('0x42')]=intUtil[_0xca27('0x41')](_0x107da4[_0xca27('0x42')]);if(_0x3e50da&&_0x3e50da[_0xca27('0x54')]&&_0x3e50da[_0xca27('0x54')]!==_0xca27('0x55')){logger['info']('[OUTBOUND]',_0xca27('0x44'));_0x129033[_0xca27('0x56')]=util[_0xca27('0xa')](_0xca27('0x45'),_0x107da4[_0xca27('0x42')],_0x129033['uniqueid'],md5(_0x129033[_0xca27('0x46')]));}headers[_0xca27('0x57')]=getAuth(_0x107da4);return getUser(_0x107da4,_0x51a81c['email'])['then'](function(_0x28e529){_0x324372=_0x28e529;logger[_0xca27('0x8')](_0xca27('0x48'),_0x324372['id']);return getEndUser(_0x107da4,_0x129033[_0xca27('0x58')],_0x129033[_0xca27('0x59')]);})[_0xca27('0x13')](function(_0x2fa300){_0x5ebac2=_0x2fa300;logger[_0xca27('0x8')]('The\x20Enduser\x20ID\x20is:',_0x5ebac2['id']);return getTicket(_0x107da4,_0x324372,_0x5ebac2,_0x24b712,_0x129033);})[_0xca27('0x13')](function(_0x408f4f){if(_0x408f4f){logger[_0xca27('0x8')](_0xca27('0x5a'),_0x408f4f['id']);switch(_0x107da4[_0xca27('0x36')]){case _0xca27('0x4b'):logger[_0xca27('0x8')](_0xca27('0x5b'),_0xca27('0x4c'));return request({'uri':util[_0xca27('0xa')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x107da4[_0xca27('0xc')],_0x324372['id'],_0x408f4f['id']),'method':_0xca27('0xd')});case _0xca27('0x5c'):logger[_0xca27('0x8')](_0xca27('0x5b'),_0xca27('0x4d'));emit(util[_0xca27('0xa')](_0xca27('0x4e'),_0x51a81c[_0xca27('0xf')]),_0xca27('0x5d'),{'uri':util[_0xca27('0xa')](_0xca27('0x4f'),_0x107da4[_0xca27('0xc')][_0xca27('0x50')](_0xca27('0x5e'),''),_0x408f4f['id'])});break;default:logger[_0xca27('0x51')](_0xca27('0x5b'),_0xca27('0x52'));}}})['catch'](function(_0x367ea9){logger[_0xca27('0x51')](_0xca27('0x5f'),util[_0xca27('0x53')](_0x367ea9,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x1935f4,_0x286f2f,_0x593b5,_0x120819,_0x212272,_0x352e1a){var _0x3be7e4,_0x391f47;_0x352e1a[_0xca27('0xc')]=intUtil['stripTrailingSlash'](_0x352e1a[_0xca27('0xc')]);_0x352e1a['serverUrl']=intUtil[_0xca27('0x41')](_0x352e1a[_0xca27('0x42')]);if(_0x212272&&_0x212272[_0xca27('0x60')]){logger[_0xca27('0x8')]('['+_0x286f2f[_0xca27('0x61')]['toUpperCase']()+']',_0xca27('0x44'));_0x286f2f[_0xca27('0x56')]=util[_0xca27('0xa')](_0xca27('0x45'),_0x352e1a[_0xca27('0x42')],_0x286f2f['uniqueid'],md5(_0x286f2f[_0xca27('0x46')]));}else{_0x286f2f[_0xca27('0x56')]='';}headers['Authorization']=getAuth(_0x352e1a);return getUser(_0x352e1a)[_0xca27('0x13')](function(_0x105927){_0x3be7e4=_0x105927;logger['info'](_0xca27('0x48'),_0x3be7e4['id']);return getEndUser(_0x352e1a,_0x286f2f[_0xca27('0x49')],_0x286f2f[_0xca27('0x62')]);})[_0xca27('0x13')](function(_0xa013e5){_0x391f47=_0xa013e5;logger[_0xca27('0x8')](_0xca27('0x4a'),_0x391f47['id']);return getTicket(_0x352e1a,_0x3be7e4,_0x391f47,_0x593b5,_0x286f2f);})[_0xca27('0x13')](function(_0x22bd8d){if(_0x22bd8d){logger['info'](_0xca27('0x5a'),_0x22bd8d['id']);}})[_0xca27('0x63')](function(_0x1bd7b0){logger['error']('['+_0x286f2f[_0xca27('0x61')][_0xca27('0x64')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xca27('0x53')](_0x1bd7b0,{'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 5c15abe..3aa8405 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 _0x40b5=['Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','Outbound','trigger:browser:url','unmanaged','lastevent','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','[HTTP]','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','data','https://www.zohoapis.','startCase','moduleCreate','role','last_name','Zoho-oauthtoken\x20','code','SUCCESS','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','nothing','contact','Contacts','lead','Leads','Creating\x20new\x20call...','Owner','administrator','first_name','Subject','getString','Subjects','Description','Descriptions','enduserType','Full_Name','First_Name','What_Id','Last_Name','talktime','Call_Duration','format','answertime','endtime','YYYY-MM-DDTHH:mm:ss','mm:ss','Call_Result','Called','complete','Answered','Rejected','abandoned','Abandoned','timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','Fields','/crm/v2/Calls','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:'];(function(_0x175a02,_0xb92de3){var _0x5b70cc=function(_0x68dcd9){while(--_0x68dcd9){_0x175a02['push'](_0x175a02['shift']());}};_0x5b70cc(++_0xb92de3);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var rp=require(_0x540b('0x1'));var md5=require(_0x540b('0x2'));var util=require(_0x540b('0x3'));var intUtil=require(_0x540b('0x4'));var moment=require(_0x540b('0x5'));var Redis=require(_0x540b('0x6'));var BPromise=require('bluebird');var config=require(_0x540b('0x7'));var logger=require(_0x540b('0x8'))(_0x540b('0x9'));config[_0x540b('0xa')]=_[_0x540b('0xb')](config['redis'],{'host':_0x540b('0xc'),'port':0x18eb});var io=require(_0x540b('0xd'))(new Redis(config[_0x540b('0xa')]));function emit(_0x5aeb5f,_0x5a9a78,_0x4aed86){io['to'](_0x5aeb5f)['emit'](_0x5a9a78,_0x4aed86);}function request(_0x5c4ca0){logger['debug'](_0x540b('0xe'),JSON['stringify'](_0x5c4ca0));return rp(_0x5c4ca0);}function getCustomFields(_0x1746d4,_0x4e295b){var _0x5f23ae={};if(_0x1746d4[_0x540b('0xf')]>0x0){_[_0x540b('0x10')](_0x1746d4,function(_0x598bce){if(_[_0x540b('0x11')]([_0x540b('0x12'),_0x540b('0x13')],_0x598bce[_0x540b('0x14')])&&_0x598bce['idField']){_0x5f23ae[_0x598bce[_0x540b('0x15')]]=_0x598bce[_0x540b('0x16')][_0x540b('0x17')]();}else if(_0x598bce[_0x540b('0x14')]==='variable'&&_0x598bce[_0x540b('0x18')]&&_0x598bce['idField']&&_0x4e295b[_0x598bce['variableName']]){_0x5f23ae[_0x598bce[_0x540b('0x15')]]=_0x4e295b[_0x598bce[_0x540b('0x18')]][_0x540b('0x17')]();}else if(_0x598bce[_0x540b('0x14')]===_0x540b('0x19')&&_0x598bce['Variable']&&_0x598bce[_0x540b('0x1a')][_0x540b('0x1b')]&&_0x598bce[_0x540b('0x15')]&&_0x4e295b[_0x598bce[_0x540b('0x1a')][_0x540b('0x1b')][_0x540b('0x1c')]()]){_0x5f23ae[_0x598bce[_0x540b('0x15')]]=_0x4e295b[_0x598bce[_0x540b('0x1a')][_0x540b('0x1b')]['toLowerCase']()][_0x540b('0x17')]();}});}return _0x5f23ae;}function getName(_0x471429){if(_0x471429['indexOf']('\x20')>0x0){var _0x135cd7=_0x471429['split'](/ (.+)/);if(_0x135cd7[0x1]){return _0x135cd7;}}return[_0x471429,_0x471429];}var accountsTokens={};function getAccessToken(_0x342cbd){return new Promise(function(_0x5e49d7,_0x4a37f9){if(!_[_0x540b('0x1d')](accountsTokens[_0x342cbd['id']])&&!_['isNil'](accountsTokens[_0x342cbd['id']][_0x540b('0x1e')])){if(moment()[_0x540b('0x1f')](accountsTokens[_0x342cbd['id']][_0x540b('0x20')])){_0x5e49d7(accountsTokens[_0x342cbd['id']]['access_token']);}}var _0x445462;switch(_0x342cbd[_0x540b('0x21')]){case'US':_0x445462=_0x540b('0x22');break;case'AU':_0x445462=_0x540b('0x23');break;case'EU':_0x445462=_0x540b('0x24');break;case'IN':_0x445462=_0x540b('0x25');break;case'CN':_0x445462=_0x540b('0x26');break;default:_0x445462=_0x540b('0x24');break;}var _0x9478e1={'method':_0x540b('0x27'),'uri':_0x445462+'/oauth/v2/token','qs':{'refresh_token':_0x342cbd[_0x540b('0x28')],'client_id':_0x342cbd[_0x540b('0x29')],'client_secret':_0x342cbd['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x9478e1)[_0x540b('0x2a')](function(_0x3d6b0c){accountsTokens[_0x342cbd['id']]={'access_token':_0x3d6b0c[_0x540b('0x1e')],'expires_in':moment()[_0x540b('0x2b')](_0x3d6b0c['expires_in'],_0x540b('0x2c'))};_0x5e49d7(_0x3d6b0c[_0x540b('0x1e')]);})[_0x540b('0x2d')](function(_0x38a93b){logger[_0x540b('0x2e')](_0x540b('0x2f'),_0x38a93b[_0x540b('0x30')]);_0x4a37f9(_0x38a93b);});});}function getUser(_0x4ee8be,_0x574c97,_0x491eca,_0xfd6e3f){logger[_0x540b('0x31')](_0x540b('0x32'));return request({'method':'GET','uri':util['format'](_0x540b('0x33'),_0x574c97),'qs':{'type':_0x540b('0x34')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4ee8be},'json':!![]})[_0x540b('0x2a')](function(_0x4693b2){if(_0x4693b2[_0x540b('0x35')]){var _0x3179bb=-0x1;if(_[_0x540b('0x36')](_0x4693b2[_0x540b('0x35')])){if(!_[_0x540b('0x1d')](_0xfd6e3f)){_0x3179bb=_[_0x540b('0x37')](_0x4693b2[_0x540b('0x35')],function(_0x57ce86){return _0x57ce86[_0x540b('0x38')]===_0xfd6e3f;});}if(_0x3179bb>=0x0){logger['info'](_0x540b('0x39'));}else{logger[_0x540b('0x31')](_0x540b('0x3a'));_0x3179bb=_[_0x540b('0x37')](_0x4693b2[_0x540b('0x35')],function(_0xae5f9){return _0xae5f9[_0x540b('0x3b')][_0x540b('0x1b')]===_0x540b('0x3c');});}return _0x4693b2[_0x540b('0x35')][_0x3179bb];}else{if(_0x4693b2['user'][_0x540b('0x3b')]['name']===_0x540b('0x3c')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x4693b2['user'];return user;}else{logger[_0x540b('0x2e')]('The\x20failing\x20result\x20is',JSON[_0x540b('0x3d')](_0x4693b2));throw new Error(_0x540b('0x3e')+JSON['stringify'](_0x4693b2));}}}else{logger['error'](_0x540b('0x3f'),JSON['stringify'](_0x4693b2));throw new Error(_0x540b('0x3e')+JSON[_0x540b('0x3d')](_0x4693b2));}})[_0x540b('0x2d')](function(_0x636df7){console[_0x540b('0x2e')](_0x636df7);});}function getZohoUser(_0x579732,_0x1c9393){return new BPromise(function(_0x36b77d,_0x2adc9f){request(_0x579732)[_0x540b('0x2a')](function(_0x48cf5b){var _0x4df448=null;if(_0x48cf5b){_0x4df448=_0x48cf5b[_0x540b('0x40')][0x0];_0x4df448['enduserType']=_0x1c9393;}_0x36b77d(_0x4df448);})[_0x540b('0x2d')](function(_0x382c24){_0x2adc9f(_0x382c24);});});}function createEndUser(_0x27055a,_0x57eec5,_0x5a8e76,_0x55bf49,_0x4fe6ee,_0x1484db){var _0x5a8e76=getName(_0x5a8e76);return request({'method':'POST','uri':_0x540b('0x41')+_0x57eec5+'/crm/v2/'+_[_0x540b('0x42')](_0x1484db[_0x540b('0x43')])+'s','body':{'data':[{'Last_Name':_0x5a8e76[0x1],'First_Name':_0x5a8e76[0x0],'Phone':_0x55bf49,'Owner':{'name':!_[_0x540b('0x1d')](_0x4fe6ee['role'][_0x540b('0x1b')])?_0x4fe6ee[_0x540b('0x44')][_0x540b('0x1b')]:!_['isNil'](_0x4fe6ee['first_name'])?_0x4fe6ee['first_name']+'\x20'+_0x4fe6ee['last_name']:_0x4fe6ee[_0x540b('0x45')],'id':_0x4fe6ee['id']}}]},'headers':{'Authorization':_0x540b('0x46')+_0x27055a},'json':!![]})[_0x540b('0x2a')](function(_0x39f1b2){if(_0x39f1b2&&_0x39f1b2[_0x540b('0x40')][0x0][_0x540b('0x47')]===_0x540b('0x48')){var _0x3511cf=_0x39f1b2['data'][0x0]['details'];_0x3511cf['enduserType']=_['startCase'](_0x1484db[_0x540b('0x43')])+'s';return _0x3511cf;}logger[_0x540b('0x2e')](_0x540b('0x3f'),JSON[_0x540b('0x3d')](data));throw new Error('Error:\x20'+JSON[_0x540b('0x3d')](data));})[_0x540b('0x2d')](function(_0xd7a3e){console[_0x540b('0x49')](_0x540b('0x4a'),_0xd7a3e);});}function getEndUser(_0x5d9101,_0x461d8e,_0x408e69,_0x2b0838,_0x111919,_0x517f27,_0x57f0bd){var _0x5a57a1={'method':_0x540b('0x4b'),'uri':'','headers':{'Authorization':_0x540b('0x46')+_0x5d9101},'json':!![]};switch(_0x57f0bd[_0x540b('0x4c')]){case _0x540b('0x4d'):_0x5a57a1[_0x540b('0x4e')]=_0x540b('0x41')+_0x461d8e+_0x540b('0x4f')+_0x111919+'))';return getZohoUser(_0x5a57a1,'Contacts')[_0x540b('0x2a')](function(_0x1d5ae7){if(_0x1d5ae7)return _0x1d5ae7;_0x5a57a1['uri']=_0x540b('0x41')+_0x461d8e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x111919+'))';return getZohoUser(_0x5a57a1,'Leads')[_0x540b('0x2a')](function(_0x2616e9){if(_0x2616e9)return _0x2616e9;if(_0x57f0bd[_0x540b('0x43')]!=_0x540b('0x50')){return createEndUser(_0x5d9101,_0x461d8e,_0x2b0838,_0x111919,_0x517f27,_0x57f0bd);}else{return{};}});});break;case _0x540b('0x51'):_0x5a57a1[_0x540b('0x4e')]='https://www.zohoapis.'+_0x461d8e+_0x540b('0x4f')+_0x111919+'))';return getZohoUser(_0x5a57a1,_0x540b('0x52'))['then'](function(_0x301776){if(_0x301776)return _0x301776;if(_0x57f0bd['moduleCreate']!=_0x540b('0x50')){return createEndUser(_0x5d9101,_0x461d8e,_0x2b0838,_0x111919,_0x517f27,_0x57f0bd);}else{return{};}});break;case _0x540b('0x53'):_0x5a57a1[_0x540b('0x4e')]=_0x540b('0x41')+_0x461d8e+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x111919+'))';return getZohoUser(_0x5a57a1,_0x540b('0x54'))[_0x540b('0x2a')](function(_0x2e8641){if(_0x2e8641)return _0x2e8641;if(_0x57f0bd[_0x540b('0x43')]!=_0x540b('0x50')){return createEndUser(_0x5d9101,_0x461d8e,_0x2b0838,_0x111919,_0x517f27,_0x57f0bd);}else{return{};}});break;}}function getCall(_0x1d89c0,_0x382587,_0x4a5dcf,_0x4f5094,_0x4c58a9,_0x378017,_0x1cd691,_0x130e2d){logger[_0x540b('0x31')](_0x540b('0x55'));var _0x7c851f={};_0x7c851f[_0x540b('0x56')]={'name':!_[_0x540b('0x1d')](_0x4f5094[_0x540b('0x44')][_0x540b('0x1b')])&&!_['isNil'](_0x4f5094[_0x540b('0x3b')][_0x540b('0x1b')])&&_0x4f5094['profile'][_0x540b('0x1b')]===_0x540b('0x57')?_0x4f5094['role'][_0x540b('0x1b')]:!_[_0x540b('0x1d')](_0x4f5094[_0x540b('0x58')])?_0x4f5094[_0x540b('0x58')]+'\x20'+_0x4f5094[_0x540b('0x45')]:_0x4f5094[_0x540b('0x45')],'id':_0x4f5094['id']};_0x7c851f[_0x540b('0x59')]=intUtil[_0x540b('0x5a')](_0x378017[_0x540b('0x5b')],_0x1cd691,'\x20');_0x7c851f[_0x540b('0x5c')]=intUtil[_0x540b('0x5a')](_0x378017[_0x540b('0x5d')],_0x1cd691,'\x0a');if(_0x4c58a9[_0x540b('0x5e')]===_0x540b('0x52')){_0x7c851f['Who_Id']={'name':!_[_0x540b('0x1d')](_0x4c58a9[_0x540b('0x5f')])?_0x4c58a9['Full_Name']:!_[_0x540b('0x1d')](_0x4c58a9[_0x540b('0x60')])?_0x4c58a9['First_Name']+'\x20'+_0x4c58a9['Last_Name']:_0x4c58a9['Last_Name'],'id':_0x4c58a9['id']};}if(_0x4c58a9[_0x540b('0x5e')]===_0x540b('0x54')){_0x7c851f[_0x540b('0x61')]={'name':!_[_0x540b('0x1d')](_0x4c58a9['Full_Name'])?_0x4c58a9[_0x540b('0x5f')]:!_['isNil'](_0x4c58a9[_0x540b('0x60')])?_0x4c58a9[_0x540b('0x60')]+'\x20'+_0x4c58a9[_0x540b('0x62')]:_0x4c58a9[_0x540b('0x62')],'id':_0x4c58a9['id']};_0x7c851f['$se_module']=_[_0x540b('0x42')](_0x4c58a9[_0x540b('0x5e')]);}if(_0x1cd691[_0x540b('0x63')]){_0x7c851f[_0x540b('0x64')]=moment['utc'](parseInt(_0x1cd691[_0x540b('0x63')])*0x3e8)[_0x540b('0x65')]('mm:ss');}else if(_0x1cd691[_0x540b('0x66')]&&_0x1cd691['endtime']){_0x7c851f[_0x540b('0x64')]=moment['utc'](moment(_0x1cd691[_0x540b('0x67')],_0x540b('0x68'))['diff'](moment(_0x1cd691['starttime'],_0x540b('0x68'))))['format'](_0x540b('0x69'));}switch(_0x1cd691['lastevent']){case'called':_0x7c851f[_0x540b('0x6a')]=_0x540b('0x6b');break;case _0x540b('0x6c'):case'connect':_0x7c851f[_0x540b('0x6a')]=_0x540b('0x6d');break;case'rejected':_0x7c851f['Call_Result']=_0x540b('0x6e');break;case _0x540b('0x6f'):_0x7c851f['Call_Result']=_0x540b('0x70');break;case _0x540b('0x71'):_0x7c851f[_0x540b('0x6a')]='Timeout';default:}_0x7c851f[_0x540b('0x72')]=(_0x130e2d===_0x540b('0x73')?moment(_0x1cd691[_0x540b('0x74')])[_0x540b('0x65')](_0x540b('0x68')):moment(_0x1cd691['agentcalledAt'])[_0x540b('0x65')](_0x540b('0x68')))||moment()['format'](_0x540b('0x68'));_0x7c851f[_0x540b('0x75')]=_0x130e2d||_0x540b('0x76');_0x7c851f=_['merge'](_0x7c851f,getCustomFields(_0x378017[_0x540b('0x77')],_0x1cd691));return request({'method':_0x540b('0x27'),'uri':_0x540b('0x41')+_0x382587+_0x540b('0x78'),'headers':{'Authorization':_0x540b('0x46')+_0x1d89c0},'body':{'data':[_0x7c851f]},'json':!![]})['then'](function(_0x573713){if(_0x573713&&_0x573713[_0x540b('0x40')][0x0][_0x540b('0x47')]===_0x540b('0x48')){logger[_0x540b('0x31')](_0x540b('0x79'));return{'id':_0x573713[_0x540b('0x40')][0x0][_0x540b('0x7a')]['id']};}})[_0x540b('0x2d')](function(_0x33e956){logger['info'](_0x540b('0x7b'),_0x33e956['stack']);console[_0x540b('0x49')]('err',_0x33e956);});}exports['queue']=function(_0xe114cd,_0x7f429d,_0x164b82,_0x2119f5,_0x53e806,_0x4fbd42){var _0x49f0b7,_0xbd6a8b,_0xf4b76c;_0x4fbd42[_0x540b('0x7c')]=intUtil[_0x540b('0x7d')](_0x4fbd42[_0x540b('0x7c')]);_0x4fbd42[_0x540b('0x7e')]=intUtil[_0x540b('0x7d')](_0x4fbd42[_0x540b('0x7e')]);if(_0x53e806&&_0x53e806[_0x540b('0x7f')]){logger[_0x540b('0x31')]('[QUEUE]','Recording\x20is\x20enabled!');_0x7f429d[_0x540b('0x80')]=_0x4fbd42[_0x540b('0x7e')]+_0x540b('0x81')+_0x7f429d['uniqueid']+_0x540b('0x82')+md5(_0x7f429d[_0x540b('0x83')]);}else{_0x7f429d[_0x540b('0x80')]='';}var _0x22a9e8=_0x4fbd42[_0x540b('0x7c')]===_0x540b('0x84')?'eu':_0x540b('0x85');return getAccessToken(_0x4fbd42)['then'](function(_0x4a81c3){_0xf4b76c=_0x4a81c3;return getUser(_0xf4b76c,_0x22a9e8,_0x4fbd42,_0x2119f5[_0x540b('0x38')]);})[_0x540b('0x2a')](function(_0x281b07){_0x49f0b7=_0x281b07;logger[_0x540b('0x31')]('The\x20User\x20ID\x20is:',_0x49f0b7['id']);return getEndUser(_0xf4b76c,_0x22a9e8,_0x4fbd42,_0x7f429d[_0x540b('0x86')],_0x7f429d[_0x540b('0x87')],_0x49f0b7,_0x164b82);})[_0x540b('0x2a')](function(_0x75149f){_0xbd6a8b=_0x75149f;return getCall(_0xf4b76c,_0x22a9e8,_0x4fbd42,_0x49f0b7,_0xbd6a8b,_0x164b82,_0x7f429d,'Inbound');})[_0x540b('0x2a')](function(_0x44a6b0){if(_0x44a6b0){logger['info'](_0x540b('0x88'),_0x44a6b0['id']);logger[_0x540b('0x31')]('[QUEUE]',_0x540b('0x89'));emit(util[_0x540b('0x65')](_0x540b('0x8a'),_0x2119f5[_0x540b('0x1b')]),'trigger:browser:url',{'uri':_0x540b('0x8b')+_0x4fbd42['host']+_0x540b('0x8c')+_0x44a6b0['id']});}})[_0x540b('0x2d')](function(_0x1b071a){logger[_0x540b('0x2e')](_0x540b('0x8d'),JSON['stringify'](_0x1b071a));});};exports[_0x540b('0x73')]=function(_0x3ece6b,_0x13b8a1,_0x5f0bd7,_0x498618,_0x35a3d4,_0x409ce5,_0x4a1265){var _0x384e51,_0x244da5,_0x2ac9e5;_0x409ce5['host']=intUtil[_0x540b('0x7d')](_0x409ce5[_0x540b('0x7c')]);_0x409ce5['serverUrl']=intUtil[_0x540b('0x7d')](_0x409ce5[_0x540b('0x7e')]);if(_0x4a1265&&_0x4a1265[_0x540b('0x8e')]&&_0x4a1265[_0x540b('0x8e')]!==_0x540b('0x8f')){logger['info'](_0x540b('0x90'),_0x540b('0x91'));_0x13b8a1[_0x540b('0x80')]=_0x409ce5[_0x540b('0x7e')]+'/api/voice/recordings/'+_0x13b8a1[_0x540b('0x83')]+_0x540b('0x82')+md5(_0x13b8a1['uniqueid']);}var _0xfaf1c8=_0x409ce5[_0x540b('0x7c')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x409ce5)['then'](function(_0x2fb8fc){_0x2ac9e5=_0x2fb8fc;return getUser(_0x2ac9e5,_0xfaf1c8,_0x409ce5,_0x498618[_0x540b('0x38')]);})['then'](function(_0x49dc87){_0x384e51=_0x49dc87;logger[_0x540b('0x31')](_0x540b('0x92'),_0x384e51['id']);return getEndUser(_0x2ac9e5,_0xfaf1c8,_0x409ce5,_0x13b8a1[_0x540b('0x93')],_0x13b8a1['destcalleridnum'],_0x384e51,_0x5f0bd7);})[_0x540b('0x2a')](function(_0x1d19e7){_0x244da5=_0x1d19e7;return getCall(_0x2ac9e5,_0xfaf1c8,_0x409ce5,_0x384e51,_0x244da5,_0x5f0bd7,_0x13b8a1,_0x540b('0x94'));})[_0x540b('0x2a')](function(_0x57db82){if(_0x57db82){logger[_0x540b('0x31')](_0x540b('0x88'),_0x57db82['id']);logger[_0x540b('0x31')]('[OUTBOUND]',_0x540b('0x89'));emit(util['format'](_0x540b('0x8a'),_0x498618[_0x540b('0x1b')]),_0x540b('0x95'),{'uri':_0x540b('0x8b')+_0x409ce5[_0x540b('0x7c')]+_0x540b('0x8c')+_0x57db82['id']});}})[_0x540b('0x2d')](function(_0x47f709){logger[_0x540b('0x2e')](_0x540b('0x90'),JSON[_0x540b('0x3d')](_0x47f709));});};exports[_0x540b('0x96')]=function(_0x279fbf,_0x3b6908,_0xde0938,_0x423e86,_0x1dd2f7,_0x57b054){var _0x2cbfa3,_0x5357c9,_0x95dcf;_0x57b054['host']=intUtil[_0x540b('0x7d')](_0x57b054['host']);_0x57b054[_0x540b('0x7e')]=intUtil[_0x540b('0x7d')](_0x57b054[_0x540b('0x7e')]);if(_0x1dd2f7&&_0x1dd2f7[_0x540b('0x7f')]){logger[_0x540b('0x31')]('['+_0x3b6908[_0x540b('0x97')]['toUpperCase']()+']',_0x540b('0x91'));_0x3b6908[_0x540b('0x80')]=_0x57b054['serverUrl']+'/api/voice/recordings/'+_0x3b6908[_0x540b('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x3b6908[_0x540b('0x83')]);}else{_0x3b6908['recordingURL']='';}var _0x210afe=_0x57b054[_0x540b('0x7c')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x57b054)[_0x540b('0x2a')](function(_0x1a91e7){_0x95dcf=_0x1a91e7;return getUser(_0x95dcf,_0x210afe,_0x57b054);})[_0x540b('0x2a')](function(_0xf3c770){_0x2cbfa3=_0xf3c770;logger[_0x540b('0x31')](_0x540b('0x92'),_0x2cbfa3['id']);return getEndUser(_0x95dcf,_0x210afe,_0x57b054,_0x3b6908[_0x540b('0x86')],_0x3b6908['calleridnum'],_0x2cbfa3,_0xde0938);})[_0x540b('0x2a')](function(_0x1c8144){_0x5357c9=_0x1c8144;return getCall(_0x95dcf,_0x210afe,_0x57b054,_0x2cbfa3,_0x5357c9,_0xde0938,_0x3b6908,'Inbound');})[_0x540b('0x2a')](function(_0x4d9e85){if(_0x4d9e85){logger[_0x540b('0x31')]('The\x20Call\x20ID\x20is:',_0x4d9e85['id']);}})[_0x540b('0x2d')](function(_0x9d5a15){logger['error']('['+_0x3b6908[_0x540b('0x97')]['toUpperCase']()+']',JSON[_0x540b('0x3d')](_0x9d5a15));});}; \ No newline at end of file +var _0xaea1=['Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','administrator','Subject','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','mm:ss','called','Call_Result','complete','connect','Answered','Rejected','abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','host','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','https://crm.','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','redis','defaults','localhost','emit','debug','stringify','length','forEach','includes','type','idField','content','variableName','toString','customVariable','Variable','toLowerCase','indexOf','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','POST','/oauth/v2/token','refreshToken','clientSecret','add','seconds','catch','Failing\x20creating\x20the\x20access_token','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','name','user','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','then','enduserType','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','data','code','details'];(function(_0x49d5cd,_0x2e5856){var _0x5c96f2=function(_0x4df856){while(--_0x4df856){_0x49d5cd['push'](_0x49d5cd['shift']());}};_0x5c96f2(++_0x2e5856);}(_0xaea1,0xe8));var _0x1aea=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaea1[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var rp=require(_0x1aea('0x0'));var md5=require(_0x1aea('0x1'));var util=require(_0x1aea('0x2'));var intUtil=require(_0x1aea('0x3'));var moment=require(_0x1aea('0x4'));var Redis=require(_0x1aea('0x5'));var BPromise=require(_0x1aea('0x6'));var config=require(_0x1aea('0x7'));var logger=require('../../../../config/logger')('zoho');config[_0x1aea('0x8')]=_[_0x1aea('0x9')](config[_0x1aea('0x8')],{'host':_0x1aea('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1aea('0x8')]));function emit(_0x123435,_0x1af9b2,_0x4d982c){io['to'](_0x123435)[_0x1aea('0xb')](_0x1af9b2,_0x4d982c);}function request(_0x5ba9ba){logger[_0x1aea('0xc')]('[HTTP]',JSON[_0x1aea('0xd')](_0x5ba9ba));return rp(_0x5ba9ba);}function getCustomFields(_0x26b722,_0x114e0a){var _0x4d4b4b={};if(_0x26b722[_0x1aea('0xe')]>0x0){_[_0x1aea('0xf')](_0x26b722,function(_0x49b506){if(_[_0x1aea('0x10')](['string','picklist'],_0x49b506[_0x1aea('0x11')])&&_0x49b506[_0x1aea('0x12')]){_0x4d4b4b[_0x49b506[_0x1aea('0x12')]]=_0x49b506[_0x1aea('0x13')]['toString']();}else if(_0x49b506['type']==='variable'&&_0x49b506[_0x1aea('0x14')]&&_0x49b506[_0x1aea('0x12')]&&_0x114e0a[_0x49b506[_0x1aea('0x14')]]){_0x4d4b4b[_0x49b506[_0x1aea('0x12')]]=_0x114e0a[_0x49b506[_0x1aea('0x14')]][_0x1aea('0x15')]();}else if(_0x49b506[_0x1aea('0x11')]===_0x1aea('0x16')&&_0x49b506['Variable']&&_0x49b506['Variable']['name']&&_0x49b506['idField']&&_0x114e0a[_0x49b506[_0x1aea('0x17')]['name'][_0x1aea('0x18')]()]){_0x4d4b4b[_0x49b506[_0x1aea('0x12')]]=_0x114e0a[_0x49b506[_0x1aea('0x17')]['name'][_0x1aea('0x18')]()][_0x1aea('0x15')]();}});}return _0x4d4b4b;}function getName(_0x2b9264){if(_0x2b9264[_0x1aea('0x19')]('\x20')>0x0){var _0x3e002b=_0x2b9264[_0x1aea('0x1a')](/ (.+)/);if(_0x3e002b[0x1]){return _0x3e002b;}}return[_0x2b9264,_0x2b9264];}var accountsTokens={};function getAccessToken(_0x37ec40){return new Promise(function(_0x3058c7,_0x1ce87c){if(!_[_0x1aea('0x1b')](accountsTokens[_0x37ec40['id']])&&!_['isNil'](accountsTokens[_0x37ec40['id']][_0x1aea('0x1c')])){if(moment()[_0x1aea('0x1d')](accountsTokens[_0x37ec40['id']][_0x1aea('0x1e')])){_0x3058c7(accountsTokens[_0x37ec40['id']]['access_token']);}}var _0x3d599d;switch(_0x37ec40[_0x1aea('0x1f')]){case'US':_0x3d599d=_0x1aea('0x20');break;case'AU':_0x3d599d='https://accounts.zoho.com.au';break;case'EU':_0x3d599d=_0x1aea('0x21');break;case'IN':_0x3d599d=_0x1aea('0x22');break;case'CN':_0x3d599d=_0x1aea('0x23');break;default:_0x3d599d=_0x1aea('0x21');break;}var _0x3f46bc={'method':_0x1aea('0x24'),'uri':_0x3d599d+_0x1aea('0x25'),'qs':{'refresh_token':_0x37ec40[_0x1aea('0x26')],'client_id':_0x37ec40['clientId'],'client_secret':_0x37ec40[_0x1aea('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3f46bc)['then'](function(_0x4ba258){accountsTokens[_0x37ec40['id']]={'access_token':_0x4ba258['access_token'],'expires_in':moment()[_0x1aea('0x28')](_0x4ba258[_0x1aea('0x1e')],_0x1aea('0x29'))};_0x3058c7(_0x4ba258[_0x1aea('0x1c')]);})[_0x1aea('0x2a')](function(_0x2fba74){logger['error'](_0x1aea('0x2b'),_0x2fba74['stack']);_0x1ce87c(_0x2fba74);});});}function getUser(_0x486de8,_0x306e4f,_0x1dcb2e,_0xfcbcce){logger[_0x1aea('0x2c')](_0x1aea('0x2d'));return request({'method':_0x1aea('0x2e'),'uri':util[_0x1aea('0x2f')](_0x1aea('0x30'),_0x306e4f),'qs':{'type':_0x1aea('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x486de8},'json':!![]})['then'](function(_0x5eb966){if(_0x5eb966[_0x1aea('0x32')]){var _0x36fdff=-0x1;if(_[_0x1aea('0x33')](_0x5eb966[_0x1aea('0x32')])){if(!_[_0x1aea('0x1b')](_0xfcbcce)){_0x36fdff=_['findIndex'](_0x5eb966[_0x1aea('0x32')],function(_0x170b0d){return _0x170b0d[_0x1aea('0x34')]===_0xfcbcce;});}if(_0x36fdff>=0x0){logger[_0x1aea('0x2c')](_0x1aea('0x35'));}else{logger[_0x1aea('0x2c')](_0x1aea('0x36'));_0x36fdff=_['findIndex'](_0x5eb966[_0x1aea('0x32')],function(_0x38bd04){return _0x38bd04['profile'][_0x1aea('0x37')]==='Administrator';});}return _0x5eb966['users'][_0x36fdff];}else{if(_0x5eb966[_0x1aea('0x38')][_0x1aea('0x39')][_0x1aea('0x37')]===_0x1aea('0x3a')){logger[_0x1aea('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x5eb966[_0x1aea('0x38')];return user;}else{logger[_0x1aea('0x3b')](_0x1aea('0x3c'),JSON[_0x1aea('0xd')](_0x5eb966));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1aea('0xd')](_0x5eb966));}}}else{logger['error'](_0x1aea('0x3c'),JSON['stringify'](_0x5eb966));throw new Error(_0x1aea('0x3d')+JSON[_0x1aea('0xd')](_0x5eb966));}})[_0x1aea('0x2a')](function(_0x39c6bd){console[_0x1aea('0x3b')](_0x39c6bd);});}function getZohoUser(_0x3da5b9,_0x223b0e){return new BPromise(function(_0x38cc87,_0x56daef){request(_0x3da5b9)[_0x1aea('0x3e')](function(_0x206fe6){var _0x42d82c=null;if(_0x206fe6){_0x42d82c=_0x206fe6['data'][0x0];_0x42d82c[_0x1aea('0x3f')]=_0x223b0e;}_0x38cc87(_0x42d82c);})['catch'](function(_0xf87a01){_0x56daef(_0xf87a01);});});}function createEndUser(_0xbd144c,_0x543f37,_0x194ab6,_0x50247b,_0x13b7bf,_0x402f67){var _0x194ab6=getName(_0x194ab6);return request({'method':_0x1aea('0x24'),'uri':_0x1aea('0x40')+_0x543f37+'/crm/v2/'+_[_0x1aea('0x41')](_0x402f67[_0x1aea('0x42')])+'s','body':{'data':[{'Last_Name':_0x194ab6[0x1],'First_Name':_0x194ab6[0x0],'Phone':_0x50247b,'Owner':{'name':!_[_0x1aea('0x1b')](_0x13b7bf[_0x1aea('0x43')][_0x1aea('0x37')])?_0x13b7bf[_0x1aea('0x43')]['name']:!_['isNil'](_0x13b7bf['first_name'])?_0x13b7bf[_0x1aea('0x44')]+'\x20'+_0x13b7bf[_0x1aea('0x45')]:_0x13b7bf[_0x1aea('0x45')],'id':_0x13b7bf['id']}}]},'headers':{'Authorization':_0x1aea('0x46')+_0xbd144c},'json':!![]})[_0x1aea('0x3e')](function(_0x29d2fb){if(_0x29d2fb&&_0x29d2fb[_0x1aea('0x47')][0x0][_0x1aea('0x48')]==='SUCCESS'){var _0x17ec07=_0x29d2fb[_0x1aea('0x47')][0x0][_0x1aea('0x49')];_0x17ec07[_0x1aea('0x3f')]=_['startCase'](_0x402f67[_0x1aea('0x42')])+'s';return _0x17ec07;}logger[_0x1aea('0x3b')](_0x1aea('0x3c'),JSON[_0x1aea('0xd')](data));throw new Error(_0x1aea('0x4a')+JSON['stringify'](data));})[_0x1aea('0x2a')](function(_0x2a806f){console[_0x1aea('0x4b')](_0x1aea('0x4c'),_0x2a806f);});}function getEndUser(_0x48f4ba,_0x31a199,_0x38adfb,_0x3f94dd,_0x349a2e,_0x18f000,_0x41b4b3){var _0x2b4837={'method':'GET','uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x48f4ba},'json':!![]};switch(_0x41b4b3[_0x1aea('0x4d')]){case _0x1aea('0x4e'):_0x2b4837[_0x1aea('0x4f')]='https://www.zohoapis.'+_0x31a199+_0x1aea('0x50')+_0x349a2e+'))';return getZohoUser(_0x2b4837,_0x1aea('0x51'))[_0x1aea('0x3e')](function(_0x21982d){if(_0x21982d)return _0x21982d;_0x2b4837['uri']=_0x1aea('0x40')+_0x31a199+_0x1aea('0x52')+_0x349a2e+'))';return getZohoUser(_0x2b4837,_0x1aea('0x53'))[_0x1aea('0x3e')](function(_0x4fbf07){if(_0x4fbf07)return _0x4fbf07;if(_0x41b4b3[_0x1aea('0x42')]!=_0x1aea('0x54')){return createEndUser(_0x48f4ba,_0x31a199,_0x3f94dd,_0x349a2e,_0x18f000,_0x41b4b3);}else{return{};}});});break;case _0x1aea('0x55'):_0x2b4837[_0x1aea('0x4f')]=_0x1aea('0x40')+_0x31a199+_0x1aea('0x50')+_0x349a2e+'))';return getZohoUser(_0x2b4837,_0x1aea('0x51'))[_0x1aea('0x3e')](function(_0x277acf){if(_0x277acf)return _0x277acf;if(_0x41b4b3['moduleCreate']!=_0x1aea('0x54')){return createEndUser(_0x48f4ba,_0x31a199,_0x3f94dd,_0x349a2e,_0x18f000,_0x41b4b3);}else{return{};}});break;case _0x1aea('0x56'):_0x2b4837[_0x1aea('0x4f')]=_0x1aea('0x40')+_0x31a199+_0x1aea('0x52')+_0x349a2e+'))';return getZohoUser(_0x2b4837,_0x1aea('0x53'))[_0x1aea('0x3e')](function(_0x4ac465){if(_0x4ac465)return _0x4ac465;if(_0x41b4b3[_0x1aea('0x42')]!=_0x1aea('0x54')){return createEndUser(_0x48f4ba,_0x31a199,_0x3f94dd,_0x349a2e,_0x18f000,_0x41b4b3);}else{return{};}});break;}}function getCall(_0x1260bf,_0x21d026,_0xdfb4f2,_0x4d583f,_0x56051c,_0x4989e3,_0x495aaa,_0x208942){logger['info']('Creating\x20new\x20call...');var _0x30f4a2={};_0x30f4a2['Owner']={'name':!_[_0x1aea('0x1b')](_0x4d583f[_0x1aea('0x43')]['name'])&&!_[_0x1aea('0x1b')](_0x4d583f[_0x1aea('0x39')]['name'])&&_0x4d583f[_0x1aea('0x39')][_0x1aea('0x37')]===_0x1aea('0x57')?_0x4d583f[_0x1aea('0x43')][_0x1aea('0x37')]:!_['isNil'](_0x4d583f[_0x1aea('0x44')])?_0x4d583f['first_name']+'\x20'+_0x4d583f[_0x1aea('0x45')]:_0x4d583f[_0x1aea('0x45')],'id':_0x4d583f['id']};_0x30f4a2[_0x1aea('0x58')]=intUtil[_0x1aea('0x59')](_0x4989e3[_0x1aea('0x5a')],_0x495aaa,'\x20');_0x30f4a2[_0x1aea('0x5b')]=intUtil[_0x1aea('0x59')](_0x4989e3[_0x1aea('0x5c')],_0x495aaa,'\x0a');if(_0x56051c[_0x1aea('0x3f')]===_0x1aea('0x51')){_0x30f4a2[_0x1aea('0x5d')]={'name':!_['isNil'](_0x56051c[_0x1aea('0x5e')])?_0x56051c['Full_Name']:!_[_0x1aea('0x1b')](_0x56051c[_0x1aea('0x5f')])?_0x56051c['First_Name']+'\x20'+_0x56051c[_0x1aea('0x60')]:_0x56051c[_0x1aea('0x60')],'id':_0x56051c['id']};}if(_0x56051c[_0x1aea('0x3f')]===_0x1aea('0x53')){_0x30f4a2['What_Id']={'name':!_['isNil'](_0x56051c['Full_Name'])?_0x56051c[_0x1aea('0x5e')]:!_[_0x1aea('0x1b')](_0x56051c[_0x1aea('0x5f')])?_0x56051c[_0x1aea('0x5f')]+'\x20'+_0x56051c[_0x1aea('0x60')]:_0x56051c['Last_Name'],'id':_0x56051c['id']};_0x30f4a2[_0x1aea('0x61')]=_[_0x1aea('0x41')](_0x56051c[_0x1aea('0x3f')]);}if(_0x495aaa[_0x1aea('0x62')]){_0x30f4a2[_0x1aea('0x63')]=moment[_0x1aea('0x64')](parseInt(_0x495aaa[_0x1aea('0x62')])*0x3e8)[_0x1aea('0x2f')]('mm:ss');}else if(_0x495aaa[_0x1aea('0x65')]&&_0x495aaa[_0x1aea('0x66')]){_0x30f4a2[_0x1aea('0x63')]=moment[_0x1aea('0x64')](moment(_0x495aaa[_0x1aea('0x66')],_0x1aea('0x67'))[_0x1aea('0x68')](moment(_0x495aaa[_0x1aea('0x69')],_0x1aea('0x67'))))[_0x1aea('0x2f')](_0x1aea('0x6a'));}switch(_0x495aaa['lastevent']){case _0x1aea('0x6b'):_0x30f4a2[_0x1aea('0x6c')]='Called';break;case _0x1aea('0x6d'):case _0x1aea('0x6e'):_0x30f4a2[_0x1aea('0x6c')]=_0x1aea('0x6f');break;case'rejected':_0x30f4a2[_0x1aea('0x6c')]=_0x1aea('0x70');break;case _0x1aea('0x71'):_0x30f4a2[_0x1aea('0x6c')]='Abandoned';break;case _0x1aea('0x72'):_0x30f4a2[_0x1aea('0x6c')]=_0x1aea('0x73');default:}_0x30f4a2['Call_Start_Time']=(_0x208942===_0x1aea('0x74')?moment(_0x495aaa['starttime'])[_0x1aea('0x2f')](_0x1aea('0x67')):moment(_0x495aaa[_0x1aea('0x75')])['format'](_0x1aea('0x67')))||moment()[_0x1aea('0x2f')](_0x1aea('0x67'));_0x30f4a2[_0x1aea('0x76')]=_0x208942||_0x1aea('0x77');_0x30f4a2=_['merge'](_0x30f4a2,getCustomFields(_0x4989e3[_0x1aea('0x78')],_0x495aaa));return request({'method':_0x1aea('0x24'),'uri':'https://www.zohoapis.'+_0x21d026+_0x1aea('0x79'),'headers':{'Authorization':_0x1aea('0x46')+_0x1260bf},'body':{'data':[_0x30f4a2]},'json':!![]})[_0x1aea('0x3e')](function(_0x250e9e){if(_0x250e9e&&_0x250e9e[_0x1aea('0x47')][0x0]['code']==='SUCCESS'){logger[_0x1aea('0x2c')]('Call\x20created!');return{'id':_0x250e9e[_0x1aea('0x47')][0x0][_0x1aea('0x49')]['id']};}})[_0x1aea('0x2a')](function(_0x55f323){logger['info'](_0x1aea('0x7a'),_0x55f323['stack']);console[_0x1aea('0x4b')](_0x1aea('0x7a'),_0x55f323);});}exports[_0x1aea('0x7b')]=function(_0x2d5f71,_0x382981,_0x402d39,_0x9bed36,_0x156137,_0x1a4528){var _0x230ed3,_0x55aa82,_0x2aaa7c;_0x1a4528['host']=intUtil['stripTrailingSlash'](_0x1a4528['host']);_0x1a4528[_0x1aea('0x7c')]=intUtil[_0x1aea('0x7d')](_0x1a4528[_0x1aea('0x7c')]);if(_0x156137&&_0x156137[_0x1aea('0x7e')]){logger[_0x1aea('0x2c')]('[QUEUE]',_0x1aea('0x7f'));_0x382981[_0x1aea('0x80')]=_0x1a4528[_0x1aea('0x7c')]+_0x1aea('0x81')+_0x382981[_0x1aea('0x82')]+_0x1aea('0x83')+md5(_0x382981[_0x1aea('0x82')]);}else{_0x382981[_0x1aea('0x80')]='';}var _0x12e260=_0x1a4528['host']===_0x1aea('0x84')?'eu':_0x1aea('0x85');return getAccessToken(_0x1a4528)[_0x1aea('0x3e')](function(_0x4b39ce){_0x2aaa7c=_0x4b39ce;return getUser(_0x2aaa7c,_0x12e260,_0x1a4528,_0x9bed36[_0x1aea('0x34')]);})[_0x1aea('0x3e')](function(_0x156448){_0x230ed3=_0x156448;logger[_0x1aea('0x2c')](_0x1aea('0x86'),_0x230ed3['id']);return getEndUser(_0x2aaa7c,_0x12e260,_0x1a4528,_0x382981[_0x1aea('0x87')],_0x382981[_0x1aea('0x88')],_0x230ed3,_0x402d39);})[_0x1aea('0x3e')](function(_0x49cbb3){_0x55aa82=_0x49cbb3;return getCall(_0x2aaa7c,_0x12e260,_0x1a4528,_0x230ed3,_0x55aa82,_0x402d39,_0x382981,_0x1aea('0x77'));})[_0x1aea('0x3e')](function(_0x45f987){if(_0x45f987){logger[_0x1aea('0x2c')]('The\x20Call\x20ID\x20is:',_0x45f987['id']);logger[_0x1aea('0x2c')](_0x1aea('0x89'),_0x1aea('0x8a'));emit(util[_0x1aea('0x2f')](_0x1aea('0x8b'),_0x9bed36[_0x1aea('0x37')]),_0x1aea('0x8c'),{'uri':'https://crm.'+_0x1a4528[_0x1aea('0x8d')]+'/crm/EntityInfo.do?module=Calls&id='+_0x45f987['id']});}})['catch'](function(_0x2d1d5f){logger[_0x1aea('0x3b')]('[QUEUE]',JSON[_0x1aea('0xd')](_0x2d1d5f));});};exports[_0x1aea('0x74')]=function(_0x2afa2f,_0x2fad13,_0x172ec3,_0x2fc290,_0x46e7bd,_0x193406,_0x171fea){var _0x32a59f,_0x40b00b,_0xefbc0b;_0x193406[_0x1aea('0x8d')]=intUtil[_0x1aea('0x7d')](_0x193406['host']);_0x193406[_0x1aea('0x7c')]=intUtil[_0x1aea('0x7d')](_0x193406[_0x1aea('0x7c')]);if(_0x171fea&&_0x171fea['recordingFormat']&&_0x171fea['recordingFormat']!==_0x1aea('0x8e')){logger[_0x1aea('0x2c')](_0x1aea('0x8f'),_0x1aea('0x7f'));_0x2fad13[_0x1aea('0x80')]=_0x193406[_0x1aea('0x7c')]+_0x1aea('0x81')+_0x2fad13[_0x1aea('0x82')]+_0x1aea('0x83')+md5(_0x2fad13[_0x1aea('0x82')]);}var _0x150909=_0x193406['host']===_0x1aea('0x84')?'eu':_0x1aea('0x85');return getAccessToken(_0x193406)[_0x1aea('0x3e')](function(_0x46b9a4){_0xefbc0b=_0x46b9a4;return getUser(_0xefbc0b,_0x150909,_0x193406,_0x2fc290[_0x1aea('0x34')]);})['then'](function(_0x8d9cd6){_0x32a59f=_0x8d9cd6;logger[_0x1aea('0x2c')]('The\x20User\x20ID\x20is:',_0x32a59f['id']);return getEndUser(_0xefbc0b,_0x150909,_0x193406,_0x2fad13[_0x1aea('0x90')],_0x2fad13[_0x1aea('0x91')],_0x32a59f,_0x172ec3);})[_0x1aea('0x3e')](function(_0x4edc80){_0x40b00b=_0x4edc80;return getCall(_0xefbc0b,_0x150909,_0x193406,_0x32a59f,_0x40b00b,_0x172ec3,_0x2fad13,_0x1aea('0x92'));})[_0x1aea('0x3e')](function(_0x47d2de){if(_0x47d2de){logger['info'](_0x1aea('0x93'),_0x47d2de['id']);logger['info'](_0x1aea('0x8f'),_0x1aea('0x8a'));emit(util[_0x1aea('0x2f')]('user:%s',_0x2fc290[_0x1aea('0x37')]),_0x1aea('0x8c'),{'uri':_0x1aea('0x94')+_0x193406['host']+_0x1aea('0x95')+_0x47d2de['id']});}})[_0x1aea('0x2a')](function(_0x7d024a){logger[_0x1aea('0x3b')](_0x1aea('0x8f'),JSON[_0x1aea('0xd')](_0x7d024a));});};exports[_0x1aea('0x96')]=function(_0x3bc490,_0x1b6d08,_0x422d22,_0x14de82,_0x54b727,_0x54e172){var _0x1b04dc,_0x157e29,_0x4bb03c;_0x54e172[_0x1aea('0x8d')]=intUtil[_0x1aea('0x7d')](_0x54e172[_0x1aea('0x8d')]);_0x54e172[_0x1aea('0x7c')]=intUtil['stripTrailingSlash'](_0x54e172[_0x1aea('0x7c')]);if(_0x54b727&&_0x54b727[_0x1aea('0x7e')]){logger['info']('['+_0x1b6d08[_0x1aea('0x97')][_0x1aea('0x98')]()+']','Recording\x20is\x20enabled!');_0x1b6d08['recordingURL']=_0x54e172[_0x1aea('0x7c')]+'/api/voice/recordings/'+_0x1b6d08[_0x1aea('0x82')]+'/downloads?type=uniqueid&token='+md5(_0x1b6d08['uniqueid']);}else{_0x1b6d08[_0x1aea('0x80')]='';}var _0xc16fe0=_0x54e172['host']===_0x1aea('0x84')?'eu':_0x1aea('0x85');return getAccessToken(_0x54e172)[_0x1aea('0x3e')](function(_0x1c2a51){_0x4bb03c=_0x1c2a51;return getUser(_0x4bb03c,_0xc16fe0,_0x54e172);})[_0x1aea('0x3e')](function(_0x4acbad){_0x1b04dc=_0x4acbad;logger['info'](_0x1aea('0x86'),_0x1b04dc['id']);return getEndUser(_0x4bb03c,_0xc16fe0,_0x54e172,_0x1b6d08[_0x1aea('0x87')],_0x1b6d08[_0x1aea('0x88')],_0x1b04dc,_0x422d22);})['then'](function(_0x2e796e){_0x157e29=_0x2e796e;return getCall(_0x4bb03c,_0xc16fe0,_0x54e172,_0x1b04dc,_0x157e29,_0x422d22,_0x1b6d08,_0x1aea('0x77'));})['then'](function(_0xbe4243){if(_0xbe4243){logger[_0x1aea('0x2c')](_0x1aea('0x93'),_0xbe4243['id']);}})[_0x1aea('0x2a')](function(_0x5b135a){logger[_0x1aea('0x3b')]('['+_0x1b6d08[_0x1aea('0x97')][_0x1aea('0x98')]()+']',JSON[_0x1aea('0xd')](_0x5b135a));});}; \ 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 9517971..6ee0e40 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 _0x0d3a=['info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s'];(function(_0x4f3cf6,_0x1d8c0b){var _0x26309f=function(_0x5031c5){while(--_0x5031c5){_0x4f3cf6['push'](_0x4f3cf6['shift']());}};_0x26309f(++_0x1d8c0b);}(_0x0d3a,0x1c9));var _0xa0d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d3a[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xa0d3('0x0'));var sh=require(_0xa0d3('0x1'));var Mustache=require(_0xa0d3('0x2'));var logger=require(_0xa0d3('0x3'))('trigger');exports['exec']=function(_0x43f49,_0x5d3be8){var _0x4c91bc=_0x43f49[_0xa0d3('0x4')]?_0x43f49['data2']:_0xa0d3('0x5');var _0x2f6e87=_0x43f49[_0xa0d3('0x6')]?Mustache[_0xa0d3('0x7')](_0x43f49[_0xa0d3('0x6')],_0x5d3be8):_0x5d3be8;sh[_0xa0d3('0x8')](_0x2f6e87,function(_0x1418db,_0x28aa4a,_0x73fa42){if(_0x1418db!==0x0){logger['error'](util[_0xa0d3('0x9')](_0xa0d3('0xa'),_0x4c91bc,_0x2f6e87,_0x1418db,_0x73fa42));}else{logger[_0xa0d3('0xb')](util[_0xa0d3('0x9')](_0xa0d3('0xc'),_0x4c91bc,_0x2f6e87,_0x28aa4a));}});}; \ No newline at end of file +var _0xca5e=['data3','render','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2'];(function(_0x58578e,_0x513072){var _0x4018de=function(_0xd637cb){while(--_0xd637cb){_0x58578e['push'](_0x58578e['shift']());}};_0x4018de(++_0x513072);}(_0xca5e,0xa2));var _0xeca5=function(_0x13d9b3,_0x56c25e){_0x13d9b3=_0x13d9b3-0x0;var _0x30d6c4=_0xca5e[_0x13d9b3];return _0x30d6c4;};'use strict';var util=require(_0xeca5('0x0'));var sh=require(_0xeca5('0x1'));var Mustache=require(_0xeca5('0x2'));var logger=require(_0xeca5('0x3'))(_0xeca5('0x4'));exports[_0xeca5('0x5')]=function(_0x332d72,_0x41b821){var _0x2817d5=_0x332d72['data2']?_0x332d72[_0xeca5('0x6')]:'Script';var _0x1af48f=_0x332d72[_0xeca5('0x7')]?Mustache[_0xeca5('0x8')](_0x332d72[_0xeca5('0x7')],_0x41b821):_0x41b821;sh[_0xeca5('0x5')](_0x1af48f,function(_0x4f6c34,_0x16bdcd,_0xc436a2){if(_0x4f6c34!==0x0){logger['error'](util[_0xeca5('0x9')](_0xeca5('0xa'),_0x2817d5,_0x1af48f,_0x4f6c34,_0xc436a2));}else{logger[_0xeca5('0xb')](util[_0xeca5('0x9')](_0xeca5('0xc'),_0x2817d5,_0x1af48f,_0x16bdcd));}});}; \ 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 582b394..0d5a824 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 _0xdd1c=['util','mustache','trigger','exec','data1','toUpperCase','data2','data5','number','headers','data6','parse','render','stack','GET','DELETE','PUT','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise'];(function(_0x2ae2cd,_0xb42c96){var _0xc52725=function(_0x4dda00){while(--_0x4dda00){_0x2ae2cd['push'](_0x2ae2cd['shift']());}};_0xc52725(++_0xb42c96);}(_0xdd1c,0x83));var _0xcdd1=function(_0x2e249d,_0x41b7e7){_0x2e249d=_0x2e249d-0x0;var _0x1faa37=_0xdd1c[_0x2e249d];return _0x1faa37;};'use strict';var rp=require(_0xcdd1('0x0'));var util=require(_0xcdd1('0x1'));var _=require('lodash');var Mustache=require(_0xcdd1('0x2'));var logger=require('../../../../config/logger')(_0xcdd1('0x3'));exports[_0xcdd1('0x4')]=function(_0xd2b6d0,_0x139b10){var _0x16ad79,_0x449e34;var _0x49f55f={'method':_0xd2b6d0[_0xcdd1('0x5')][_0xcdd1('0x6')](),'uri':Mustache['render'](_0xd2b6d0[_0xcdd1('0x7')],_0x139b10),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xd2b6d0[_0xcdd1('0x8')])===_0xcdd1('0x9')&&parseInt(_0xd2b6d0[_0xcdd1('0x8')])>=0x1&&parseInt(_0xd2b6d0['data5'])<=0xa?parseInt(_0xd2b6d0['data5'])*0x3e8:0x5*0x3e8};try{_0x49f55f[_0xcdd1('0xa')]=_0xd2b6d0[_0xcdd1('0xb')]?JSON[_0xcdd1('0xc')](Mustache[_0xcdd1('0xd')](_0xd2b6d0[_0xcdd1('0xb')],_0x139b10)):{};}catch(_0x1870f9){logger['error'](_0x1870f9[_0xcdd1('0xe')]);}switch(_0xd2b6d0[_0xcdd1('0x5')]['toUpperCase']()){case _0xcdd1('0xf'):case _0xcdd1('0x10'):_0x16ad79=null;_0x49f55f['qs']=_0x139b10;break;case'POST':case _0xcdd1('0x11'):if(_0xd2b6d0['data7']){try{_0x16ad79=JSON[_0xcdd1('0xc')](Mustache['render'](_0xd2b6d0[_0xcdd1('0x12')],_0x139b10));_0x49f55f[_0xcdd1('0x13')]=_0x16ad79;}catch(_0x14ee27){logger[_0xcdd1('0x14')](_0x14ee27[_0xcdd1('0xe')]);logger[_0xcdd1('0x14')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x16ad79=_0x139b10;_0x49f55f['body']=_0x16ad79;}break;}logger[_0xcdd1('0x15')](util[_0xcdd1('0x16')](_0xcdd1('0x17'),_0xd2b6d0['data1'],_0xd2b6d0[_0xcdd1('0x7')],JSON[_0xcdd1('0x18')](_0x49f55f)));rp(_0x49f55f)[_0xcdd1('0x19')](function(_0x30cf2e){_0x16ad79=!_[_0xcdd1('0x1a')](_0x16ad79)?_0xcdd1('0x1b')+_0x16ad79:'';_0x449e34=typeof _0x30cf2e[_0xcdd1('0x13')]===_0xcdd1('0x1c')?JSON[_0xcdd1('0x18')](_0x30cf2e[_0xcdd1('0x13')]):_0x30cf2e[_0xcdd1('0x13')];logger[_0xcdd1('0x15')](util[_0xcdd1('0x16')](_0xcdd1('0x1d'),_0xd2b6d0['data1'],_0xd2b6d0['data2'],_0x30cf2e[_0xcdd1('0x1e')],_0x449e34));})['catch'](function(_0x27b940){logger[_0xcdd1('0x14')](util[_0xcdd1('0x16')](_0xcdd1('0x1f'),_0xd2b6d0[_0xcdd1('0x5')],_0xd2b6d0['data2'],_0x27b940['statusCode'],_0x27b940['name'],_0x27b940[_0xcdd1('0x20')]));});}; \ No newline at end of file +var _0x050e=['util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','data5','number','headers','data6','parse','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','message'];(function(_0x8b2d38,_0x1c8388){var _0x10e826=function(_0x2434c6){while(--_0x2434c6){_0x8b2d38['push'](_0x8b2d38['shift']());}};_0x10e826(++_0x1c8388);}(_0x050e,0x120));var _0xe050=function(_0x2b7868,_0x44616c){_0x2b7868=_0x2b7868-0x0;var _0x3e7ce4=_0x050e[_0x2b7868];return _0x3e7ce4;};'use strict';var rp=require('request-promise');var util=require(_0xe050('0x0'));var _=require(_0xe050('0x1'));var Mustache=require(_0xe050('0x2'));var logger=require(_0xe050('0x3'))(_0xe050('0x4'));exports[_0xe050('0x5')]=function(_0x59ae76,_0x166663){var _0x41b637,_0x43acd2;var _0x7c9048={'method':_0x59ae76[_0xe050('0x6')]['toUpperCase'](),'uri':Mustache[_0xe050('0x7')](_0x59ae76[_0xe050('0x8')],_0x166663),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x59ae76[_0xe050('0x9')])===_0xe050('0xa')&&parseInt(_0x59ae76['data5'])>=0x1&&parseInt(_0x59ae76[_0xe050('0x9')])<=0xa?parseInt(_0x59ae76[_0xe050('0x9')])*0x3e8:0x5*0x3e8};try{_0x7c9048[_0xe050('0xb')]=_0x59ae76[_0xe050('0xc')]?JSON[_0xe050('0xd')](Mustache['render'](_0x59ae76[_0xe050('0xc')],_0x166663)):{};}catch(_0x2983b1){logger[_0xe050('0xe')](_0x2983b1[_0xe050('0xf')]);}switch(_0x59ae76['data1'][_0xe050('0x10')]()){case _0xe050('0x11'):case _0xe050('0x12'):_0x41b637=null;_0x7c9048['qs']=_0x166663;break;case _0xe050('0x13'):case _0xe050('0x14'):if(_0x59ae76[_0xe050('0x15')]){try{_0x41b637=JSON[_0xe050('0xd')](Mustache[_0xe050('0x7')](_0x59ae76[_0xe050('0x15')],_0x166663));_0x7c9048[_0xe050('0x16')]=_0x41b637;}catch(_0x161d42){logger[_0xe050('0xe')](_0x161d42['stack']);logger[_0xe050('0xe')](_0xe050('0x17'));}}else{_0x41b637=_0x166663;_0x7c9048[_0xe050('0x16')]=_0x41b637;}break;}logger[_0xe050('0x18')](util[_0xe050('0x19')](_0xe050('0x1a'),_0x59ae76[_0xe050('0x6')],_0x59ae76['data2'],JSON[_0xe050('0x1b')](_0x7c9048)));rp(_0x7c9048)[_0xe050('0x1c')](function(_0x499547){_0x41b637=!_[_0xe050('0x1d')](_0x41b637)?_0xe050('0x1e')+_0x41b637:'';_0x43acd2=typeof _0x499547[_0xe050('0x16')]===_0xe050('0x1f')?JSON[_0xe050('0x1b')](_0x499547[_0xe050('0x16')]):_0x499547['body'];logger[_0xe050('0x18')](util[_0xe050('0x19')](_0xe050('0x20'),_0x59ae76[_0xe050('0x6')],_0x59ae76[_0xe050('0x8')],_0x499547['statusCode'],_0x43acd2));})['catch'](function(_0x89f282){logger['error'](util[_0xe050('0x19')](_0xe050('0x21'),_0x59ae76[_0xe050('0x6')],_0x59ae76[_0xe050('0x8')],_0x89f282[_0xe050('0x22')],_0x89f282['name'],_0x89f282[_0xe050('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index de2e64a..1048399 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 _0x633a=['debug','rpc','error','message','catch','jayson/promise','bluebird','../../config/logger','routing','http','Request','request','then'];(function(_0x4b6eed,_0x2b2ea1){var _0x1523c3=function(_0x982808){while(--_0x982808){_0x4b6eed['push'](_0x4b6eed['shift']());}};_0x1523c3(++_0x2b2ea1);}(_0x633a,0x1cc));var _0xa633=function(_0xc42499,_0x511a21){_0xc42499=_0xc42499-0x0;var _0x4633d1=_0x633a[_0xc42499];return _0x4633d1;};'use strict';var jayson=require(_0xa633('0x0'));var BPromise=require(_0xa633('0x1'));var logger=require(_0xa633('0x2'))(_0xa633('0x3'));var client=jayson['client'][_0xa633('0x4')]({'port':0x2329});client[_0xa633('0x5')]=function(_0xfde693,_0x2a28be){return new BPromise(function(_0x506398,_0x48c37e){return client[_0xa633('0x6')](_0xfde693,_0x2a28be)[_0xa633('0x7')](function(_0x3619eb){logger[_0xa633('0x8')](_0xa633('0x9'),'routing',_0xfde693,_0x2a28be,_0x3619eb);if(_0x3619eb[_0xa633('0xa')]){logger[_0xa633('0xa')](_0xa633('0x9'),_0xa633('0x3'),_0xfde693,_0x3619eb[_0xa633('0xa')]['message'],_0x2a28be);return _0x48c37e(_0x3619eb[_0xa633('0xa')][_0xa633('0xb')]);}else{return _0x506398(_0x3619eb['result']);}})[_0xa633('0xc')](function(_0x11a2a7){logger[_0xa633('0xa')]('rpc',_0xa633('0x3'),_0xfde693,_0x11a2a7,_0x2a28be);return _0x48c37e(_0x11a2a7);});});};module['exports']=client; \ No newline at end of file +var _0x3f00=['request','then','rpc','routing','error','message','result','catch','exports','jayson/promise','bluebird','http','Request'];(function(_0x46a3ce,_0xe270ce){var _0xc1af09=function(_0x17d0f1){while(--_0x17d0f1){_0x46a3ce['push'](_0x46a3ce['shift']());}};_0xc1af09(++_0xe270ce);}(_0x3f00,0x100));var _0x03f0=function(_0x46a0f3,_0xc3c10c){_0x46a0f3=_0x46a0f3-0x0;var _0xd6604a=_0x3f00[_0x46a0f3];return _0xd6604a;};'use strict';var jayson=require(_0x03f0('0x0'));var BPromise=require(_0x03f0('0x1'));var logger=require('../../config/logger')('routing');var client=jayson['client'][_0x03f0('0x2')]({'port':0x2329});client[_0x03f0('0x3')]=function(_0x2a7413,_0x1bcba0){return new BPromise(function(_0x2e4563,_0x103254){return client[_0x03f0('0x4')](_0x2a7413,_0x1bcba0)[_0x03f0('0x5')](function(_0x34e737){logger['debug'](_0x03f0('0x6'),_0x03f0('0x7'),_0x2a7413,_0x1bcba0,_0x34e737);if(_0x34e737[_0x03f0('0x8')]){logger[_0x03f0('0x8')](_0x03f0('0x6'),_0x03f0('0x7'),_0x2a7413,_0x34e737[_0x03f0('0x8')][_0x03f0('0x9')],_0x1bcba0);return _0x103254(_0x34e737[_0x03f0('0x8')]['message']);}else{return _0x2e4563(_0x34e737[_0x03f0('0xa')]);}})[_0x03f0('0xb')](function(_0x450607){logger[_0x03f0('0x8')]('rpc','routing',_0x2a7413,_0x450607,_0x1bcba0);return _0x103254(_0x450607);});});};module[_0x03f0('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index a21c421..3e6aa80 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 _0xa55a=['then','initMailAccounts','mailAccounts','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','email','resolve','getMailAccounts'];(function(_0x34fe5f,_0x2bf817){var _0x3544a8=function(_0xc0c120){while(--_0xc0c120){_0x34fe5f['push'](_0x34fe5f['shift']());}};_0x3544a8(++_0x2bf817);}(_0xa55a,0xf5));var _0xaa55=function(_0xac84a5,_0x12ed84){_0xac84a5=_0xac84a5-0x0;var _0x3bf698=_0xa55a[_0xac84a5];return _0x3bf698;};'use strict';var server=require(_0xaa55('0x0'));var Realtime=require(_0xaa55('0x1'));var EmailChannel=require(_0xaa55('0x2'));var mailAccount=require(_0xaa55('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')(_0xaa55('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xaa55('0x5')]()['then'](mailAccount[_0xaa55('0x6')]())[_0xaa55('0x7')](realtime[_0xaa55('0x8')]())['then'](function(){email['refresh'](realtime[_0xaa55('0x9')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0xaa55('0x7')](function(){return initRealtime();})[_0xaa55('0x7')](function(){return setting['getSettings']();})[_0xaa55('0x7')](function(_0x5f4c21){return setInterval(initRealtime,_0x5f4c21['loginMailFrequency']*0x3e8);})['catch'](function(_0x438b4f){logger[_0xaa55('0xa')](_0xaa55('0xb'),_0x438b4f);});}main(); \ No newline at end of file +var _0xd0f4=['getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./realtime','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','listen'];(function(_0x53c739,_0x34dd56){var _0x1cf22e=function(_0x176909){while(--_0x176909){_0x53c739['push'](_0x53c739['shift']());}};_0x1cf22e(++_0x34dd56);}(_0xd0f4,0x75));var _0x4d0f=function(_0x486bc0,_0x52b098){_0x486bc0=_0x486bc0-0x0;var _0xaa4d0=_0xd0f4[_0x486bc0];return _0xaa4d0;};'use strict';var server=require(_0x4d0f('0x0'));var Realtime=require(_0x4d0f('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require(_0x4d0f('0x2'));var setting=require('./rpc/setting');var logger=require(_0x4d0f('0x3'))(_0x4d0f('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x4d0f('0x5')]()[_0x4d0f('0x6')](mailAccount[_0x4d0f('0x7')]())[_0x4d0f('0x6')](realtime[_0x4d0f('0x8')]())['then'](function(){email['refresh'](realtime[_0x4d0f('0x9')]);return realtime;});}function main(){return server[_0x4d0f('0xa')](realtime,email)[_0x4d0f('0x6')](function(){return initRealtime();})[_0x4d0f('0x6')](function(){return setting[_0x4d0f('0xb')]();})[_0x4d0f('0x6')](function(_0x49869d){return setInterval(initRealtime,_0x49869d[_0x4d0f('0xc')]*0x3e8);})[_0x4d0f('0xd')](function(_0x4e6f0d){logger[_0x4d0f('0xe')](_0x4d0f('0xf'),_0x4e6f0d);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 3b16172..f213db7 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 _0xd319=['sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','status','messageStatus','total','isNil','stringify','mailAccount:update','prototype','refresh','Imap','service','custom','email','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError'];(function(_0x32efb5,_0x1b6f42){var _0x5b644c=function(_0x44e59b){while(--_0x44e59b){_0x32efb5['push'](_0x32efb5['shift']());}};_0x5b644c(++_0x1b6f42);}(_0xd319,0xe3));var _0x9d31=function(_0x225491,_0x3a9357){_0x225491=_0x225491-0x0;var _0x4c8500=_0xd319[_0x225491];return _0x4c8500;};'use strict';var _=require(_0x9d31('0x0'));var moment=require(_0x9d31('0x1'));var BPromise=require(_0x9d31('0x2'));var md5=require(_0x9d31('0x3'));var Redis=require(_0x9d31('0x4'));var config=require(_0x9d31('0x5'));var logger=require('../../../config/logger')('email');config[_0x9d31('0x6')]=_['defaults'](config[_0x9d31('0x6')],{'host':_0x9d31('0x7'),'port':0x18eb});var io=require(_0x9d31('0x8'))(new Redis(config[_0x9d31('0x6')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x9d31('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x55a67e){logger[_0x9d31('0xa')](_0x9d31('0xb'));this[_0x9d31('0xc')]=_0x55a67e[_0x9d31('0xc')];this[_0x9d31('0xd')]={};this[_0x9d31('0xe')]=new EmailSmtp();}EmailChannel['prototype'][_0x9d31('0xf')]=function(_0x56af2c){var _0x223f3b=this[_0x9d31('0xc')][_0x56af2c];var _0x2d52c8={'id':_0x223f3b['id'],'name':_0x223f3b[_0x9d31('0x10')],'key':_0x223f3b[_0x9d31('0x11')],'active':_0x223f3b[_0x9d31('0x12')],'Imap':{'status':_0x223f3b['Imap'][_0x9d31('0x13')],'messageStatus':_0x223f3b['Imap'][_0x9d31('0x14')],'total':_0x223f3b['Imap'][_0x9d31('0x15')]}};if(_[_0x9d31('0x16')](md5Accounts[_0x56af2c])){md5Accounts[_0x56af2c]={};}var _0x2e5656=md5(JSON[_0x9d31('0x17')](_0x2d52c8));if(md5Accounts[_0x56af2c][_0x9d31('0x3')]!==_0x2e5656){md5Accounts[_0x56af2c][_0x9d31('0x3')]=_0x2e5656;io[_0x9d31('0xf')](_0x9d31('0x18'),_0x2d52c8);}};EmailChannel[_0x9d31('0x19')][_0x9d31('0x1a')]=function(_0x2dbdc3){for(var _0x2c5b9e in _0x2dbdc3){if(_0x2dbdc3['hasOwnProperty'](_0x2c5b9e)){if(_0x2dbdc3[_0x2c5b9e][_0x9d31('0x1b')]&&_0x2dbdc3[_0x2c5b9e][_0x9d31('0x12')]){var _0x4ed07e=_0x2dbdc3[_0x2c5b9e]['Imap'];if(!_0x4ed07e[_0x9d31('0x1c')]&&_0x2dbdc3[_0x2c5b9e]['provider']!==_0x9d31('0x1d'))_0x4ed07e[_0x9d31('0x1c')]=_0x2dbdc3[_0x2c5b9e]['provider'];if(!this['imapAccounts']['hasOwnProperty'](_0x4ed07e['id'])){this[_0x9d31('0xd')][_0x4ed07e['id']]=new EmailImap(_0x4ed07e,_0x2dbdc3[_0x2c5b9e][_0x9d31('0x1e')]);this[_0x9d31('0xd')][_0x4ed07e['id']]['on'](_0x9d31('0x1f'),this[_0x9d31('0x20')][_0x9d31('0x21')](this,_0x2c5b9e));this[_0x9d31('0xd')][_0x4ed07e['id']]['on'](_0x9d31('0x1e'),this[_0x9d31('0x22')][_0x9d31('0x21')](this,_0x2c5b9e));this[_0x9d31('0xd')][_0x4ed07e['id']]['on']('end',this[_0x9d31('0x23')][_0x9d31('0x21')](this,_0x2c5b9e));this[_0x9d31('0xd')][_0x4ed07e['id']]['on'](_0x9d31('0x24'),this['handleImapError'][_0x9d31('0x21')](this,_0x2c5b9e));}}else{if(_[_0x9d31('0x16')](this[_0x9d31('0xc')][_0x2c5b9e][_0x9d31('0x1b')])){this[_0x9d31('0xc')][_0x2c5b9e][_0x9d31('0x1b')]={};}this[_0x9d31('0xc')][_0x2c5b9e][_0x9d31('0x1b')][_0x9d31('0x13')]='disabled';this['mailAccounts'][_0x2c5b9e][_0x9d31('0x1b')][_0x9d31('0x14')]='';this['emit'](_0x2c5b9e);}}}};EmailChannel[_0x9d31('0x19')][_0x9d31('0x20')]=function(_0x6d6250,_0x464539){if(this[_0x9d31('0xc')][_0x6d6250]){this['mailAccounts'][_0x6d6250]['Imap'][_0x9d31('0x13')]='connected';this[_0x9d31('0xc')][_0x6d6250][_0x9d31('0x1b')][_0x9d31('0x14')]=_0x464539['name'];if(_0x464539[_0x9d31('0x25')]){this[_0x9d31('0xc')][_0x6d6250][_0x9d31('0x1b')]['total']=_0x464539[_0x9d31('0x25')][_0x9d31('0x15')];}return this['emit'](_0x6d6250);}};EmailChannel[_0x9d31('0x19')]['handleImapEmail']=function(_0x1ca2b7,_0x181b65){logger[_0x9d31('0xa')](_0x9d31('0x26'),_0x181b65[_0x9d31('0x27')],_0x181b65[_0x9d31('0x28')],_0x181b65[_0x9d31('0x29')],_0x1ca2b7);if(this[_0x9d31('0xc')][_0x1ca2b7]){return mailAccount[_0x9d31('0x2a')](_0x1ca2b7,_0x181b65)[_0x9d31('0x2b')](function(_0xd24e62){if(_0xd24e62){logger[_0x9d31('0xa')](_0x9d31('0x2c'));}})[_0x9d31('0x2d')](function(_0x7ddbb8){logger['error']('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x9d31('0x17')](_0x7ddbb8));});}};EmailChannel[_0x9d31('0x19')][_0x9d31('0x23')]=function(_0x2168a1){if(this[_0x9d31('0xc')][_0x2168a1]&&this['mailAccounts'][_0x2168a1]['Imap']){if(this['imapAccounts'][this[_0x9d31('0xc')][_0x2168a1]['Imap']['id']]){delete this['imapAccounts'][this[_0x9d31('0xc')][_0x2168a1][_0x9d31('0x1b')]['id']];}this[_0x9d31('0xc')][_0x2168a1][_0x9d31('0x1b')][_0x9d31('0x2e')]=moment();this[_0x9d31('0xf')](_0x2168a1);}};EmailChannel[_0x9d31('0x19')][_0x9d31('0x2f')]=function(_0x35d2c3,_0x514b4a){if(this[_0x9d31('0xc')][_0x35d2c3]){this[_0x9d31('0xc')][_0x35d2c3][_0x9d31('0x1b')]['status']=_0x9d31('0x24');this[_0x9d31('0xc')][_0x35d2c3][_0x9d31('0x1b')]['messageStatus']=_0x514b4a;return this[_0x9d31('0xf')](_0x35d2c3);}};EmailChannel[_0x9d31('0x19')][_0x9d31('0x30')]=function(_0x34756b,_0x19a6ce){return this['smtp'][_0x9d31('0x31')](_0x34756b,_0x19a6ce);};EmailChannel[_0x9d31('0x19')][_0x9d31('0x32')]=function(_0x2ea859){var _0x4e70d2=this;if(this[_0x9d31('0xc')][_0x2ea859['id']]){if(_[_0x9d31('0x16')](this['mailAccounts'][_0x2ea859['id']][_0x9d31('0x33')])){this[_0x9d31('0xc')][_0x2ea859['id']][_0x9d31('0x33')]={};}this[_0x9d31('0xc')][_0x2ea859['id']][_0x9d31('0x33')][_0x9d31('0x2e')]=moment();return new BPromise(function(_0x3086be,_0x590de5){return _0x4e70d2[_0x9d31('0xe')][_0x9d31('0x34')](_0x2ea859)['then'](function(_0x131b7d){_0x4e70d2[_0x9d31('0xc')][_0x2ea859['id']][_0x9d31('0x33')][_0x9d31('0x13')]=_0x9d31('0x35');_0x4e70d2[_0x9d31('0xc')][_0x2ea859['id']][_0x9d31('0x33')][_0x9d31('0x14')]='';_0x4e70d2['emit'](_0x2ea859['id']);_0x3086be(_0x131b7d);})['catch'](function(_0x4cea8d){_0x4e70d2[_0x9d31('0xc')][_0x2ea859['id']][_0x9d31('0x33')][_0x9d31('0x13')]=_0x9d31('0x24');_0x4e70d2[_0x9d31('0xc')][_0x2ea859['id']][_0x9d31('0x33')]['messageStatus']=_0x4cea8d;_0x4e70d2[_0x9d31('0xf')](_0x2ea859['id']);_0x590de5(_0x4cea8d);});});}return this[_0x9d31('0xe')][_0x9d31('0x34')](_0x2ea859);};module[_0x9d31('0x36')]=EmailChannel; \ No newline at end of file +var _0xc249=['mailAccounts','imapAccounts','smtp','prototype','name','key','active','status','Imap','messageStatus','total','isNil','emit','refresh','hasOwnProperty','service','provider','custom','box','bind','end','error','handleImapError','disabled','handleImapBox','connected','messages','handleImapEmail','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','sendMail','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','socket.io-emitter','./imap','./smtp','info','start\x20email\x20channel'];(function(_0x103f17,_0x2c4779){var _0x210a6c=function(_0x178f65){while(--_0x178f65){_0x103f17['push'](_0x103f17['shift']());}};_0x210a6c(++_0x2c4779);}(_0xc249,0x118));var _0x9c24=function(_0x5de366,_0x42e495){_0x5de366=_0x5de366-0x0;var _0x5687c5=_0xc249[_0x5de366];return _0x5687c5;};'use strict';var _=require(_0x9c24('0x0'));var moment=require(_0x9c24('0x1'));var BPromise=require(_0x9c24('0x2'));var md5=require(_0x9c24('0x3'));var Redis=require(_0x9c24('0x4'));var config=require(_0x9c24('0x5'));var logger=require(_0x9c24('0x6'))(_0x9c24('0x7'));config[_0x9c24('0x8')]=_[_0x9c24('0x9')](config[_0x9c24('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x9c24('0xa'))(new Redis(config['redis']));var EmailImap=require(_0x9c24('0xb'));var EmailSmtp=require(_0x9c24('0xc'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5041f6){logger[_0x9c24('0xd')](_0x9c24('0xe'));this['mailAccounts']=_0x5041f6[_0x9c24('0xf')];this[_0x9c24('0x10')]={};this[_0x9c24('0x11')]=new EmailSmtp();}EmailChannel[_0x9c24('0x12')]['emit']=function(_0x3d5fda){var _0x3730b7=this[_0x9c24('0xf')][_0x3d5fda];var _0x5cc9c9={'id':_0x3730b7['id'],'name':_0x3730b7[_0x9c24('0x13')],'key':_0x3730b7[_0x9c24('0x14')],'active':_0x3730b7[_0x9c24('0x15')],'Imap':{'status':_0x3730b7['Imap'][_0x9c24('0x16')],'messageStatus':_0x3730b7[_0x9c24('0x17')][_0x9c24('0x18')],'total':_0x3730b7['Imap'][_0x9c24('0x19')]}};if(_[_0x9c24('0x1a')](md5Accounts[_0x3d5fda])){md5Accounts[_0x3d5fda]={};}var _0x1f03b5=md5(JSON['stringify'](_0x5cc9c9));if(md5Accounts[_0x3d5fda][_0x9c24('0x3')]!==_0x1f03b5){md5Accounts[_0x3d5fda]['md5']=_0x1f03b5;io[_0x9c24('0x1b')]('mailAccount:update',_0x5cc9c9);}};EmailChannel[_0x9c24('0x12')][_0x9c24('0x1c')]=function(_0x4c49cc){for(var _0x357f4c in _0x4c49cc){if(_0x4c49cc[_0x9c24('0x1d')](_0x357f4c)){if(_0x4c49cc[_0x357f4c][_0x9c24('0x17')]&&_0x4c49cc[_0x357f4c][_0x9c24('0x15')]){var _0x4bf8d4=_0x4c49cc[_0x357f4c]['Imap'];if(!_0x4bf8d4[_0x9c24('0x1e')]&&_0x4c49cc[_0x357f4c][_0x9c24('0x1f')]!==_0x9c24('0x20'))_0x4bf8d4[_0x9c24('0x1e')]=_0x4c49cc[_0x357f4c][_0x9c24('0x1f')];if(!this[_0x9c24('0x10')][_0x9c24('0x1d')](_0x4bf8d4['id'])){this[_0x9c24('0x10')][_0x4bf8d4['id']]=new EmailImap(_0x4bf8d4,_0x4c49cc[_0x357f4c][_0x9c24('0x7')]);this['imapAccounts'][_0x4bf8d4['id']]['on'](_0x9c24('0x21'),this['handleImapBox'][_0x9c24('0x22')](this,_0x357f4c));this[_0x9c24('0x10')][_0x4bf8d4['id']]['on'](_0x9c24('0x7'),this['handleImapEmail'][_0x9c24('0x22')](this,_0x357f4c));this[_0x9c24('0x10')][_0x4bf8d4['id']]['on'](_0x9c24('0x23'),this['handleImapEnd'][_0x9c24('0x22')](this,_0x357f4c));this[_0x9c24('0x10')][_0x4bf8d4['id']]['on'](_0x9c24('0x24'),this[_0x9c24('0x25')][_0x9c24('0x22')](this,_0x357f4c));}}else{if(_['isNil'](this[_0x9c24('0xf')][_0x357f4c][_0x9c24('0x17')])){this['mailAccounts'][_0x357f4c][_0x9c24('0x17')]={};}this[_0x9c24('0xf')][_0x357f4c][_0x9c24('0x17')][_0x9c24('0x16')]=_0x9c24('0x26');this[_0x9c24('0xf')][_0x357f4c][_0x9c24('0x17')][_0x9c24('0x18')]='';this[_0x9c24('0x1b')](_0x357f4c);}}}};EmailChannel[_0x9c24('0x12')][_0x9c24('0x27')]=function(_0x590707,_0x39bbd8){if(this[_0x9c24('0xf')][_0x590707]){this[_0x9c24('0xf')][_0x590707][_0x9c24('0x17')][_0x9c24('0x16')]=_0x9c24('0x28');this[_0x9c24('0xf')][_0x590707][_0x9c24('0x17')][_0x9c24('0x18')]=_0x39bbd8[_0x9c24('0x13')];if(_0x39bbd8[_0x9c24('0x29')]){this[_0x9c24('0xf')][_0x590707][_0x9c24('0x17')][_0x9c24('0x19')]=_0x39bbd8[_0x9c24('0x29')][_0x9c24('0x19')];}return this['emit'](_0x590707);}};EmailChannel[_0x9c24('0x12')][_0x9c24('0x2a')]=function(_0x1f6ea7,_0x3561e6){logger[_0x9c24('0xd')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x3561e6['firstName'],_0x3561e6[_0x9c24('0x2b')],_0x3561e6[_0x9c24('0x2c')],_0x1f6ea7);if(this[_0x9c24('0xf')][_0x1f6ea7]){return mailAccount[_0x9c24('0x2d')](_0x1f6ea7,_0x3561e6)['then'](function(_0x21d6ab){if(_0x21d6ab){logger['info'](_0x9c24('0x2e'));}})[_0x9c24('0x2f')](function(_0x22fb69){logger['error'](_0x9c24('0x30'),JSON[_0x9c24('0x31')](_0x22fb69));});}};EmailChannel[_0x9c24('0x12')][_0x9c24('0x32')]=function(_0x58ee0f){if(this[_0x9c24('0xf')][_0x58ee0f]&&this[_0x9c24('0xf')][_0x58ee0f]['Imap']){if(this['imapAccounts'][this['mailAccounts'][_0x58ee0f][_0x9c24('0x17')]['id']]){delete this[_0x9c24('0x10')][this['mailAccounts'][_0x58ee0f]['Imap']['id']];}this[_0x9c24('0xf')][_0x58ee0f][_0x9c24('0x17')][_0x9c24('0x33')]=moment();this[_0x9c24('0x1b')](_0x58ee0f);}};EmailChannel[_0x9c24('0x12')][_0x9c24('0x25')]=function(_0x9f6aff,_0x21918e){if(this['mailAccounts'][_0x9f6aff]){this[_0x9c24('0xf')][_0x9f6aff][_0x9c24('0x17')]['status']=_0x9c24('0x24');this[_0x9c24('0xf')][_0x9f6aff]['Imap'][_0x9c24('0x18')]=_0x21918e;return this['emit'](_0x9f6aff);}};EmailChannel[_0x9c24('0x12')][_0x9c24('0x34')]=function(_0x5232f4,_0x577954){return this[_0x9c24('0x11')]['send'](_0x5232f4,_0x577954);};EmailChannel[_0x9c24('0x12')][_0x9c24('0x35')]=function(_0xaa34f6){var _0x2d526b=this;if(this['mailAccounts'][_0xaa34f6['id']]){if(_[_0x9c24('0x1a')](this[_0x9c24('0xf')][_0xaa34f6['id']][_0x9c24('0x36')])){this[_0x9c24('0xf')][_0xaa34f6['id']][_0x9c24('0x36')]={};}this['mailAccounts'][_0xaa34f6['id']]['Smtp'][_0x9c24('0x33')]=moment();return new BPromise(function(_0x459be0,_0x22dc84){return _0x2d526b[_0x9c24('0x11')][_0x9c24('0x37')](_0xaa34f6)[_0x9c24('0x38')](function(_0x113a76){_0x2d526b[_0x9c24('0xf')][_0xaa34f6['id']][_0x9c24('0x36')]['status']=_0x9c24('0x39');_0x2d526b[_0x9c24('0xf')][_0xaa34f6['id']][_0x9c24('0x36')][_0x9c24('0x18')]='';_0x2d526b[_0x9c24('0x1b')](_0xaa34f6['id']);_0x459be0(_0x113a76);})[_0x9c24('0x2f')](function(_0x5ad2aa){_0x2d526b['mailAccounts'][_0xaa34f6['id']]['Smtp'][_0x9c24('0x16')]='error';_0x2d526b['mailAccounts'][_0xaa34f6['id']]['Smtp'][_0x9c24('0x18')]=_0x5ad2aa;_0x2d526b['emit'](_0xaa34f6['id']);_0x22dc84(_0x5ad2aa);});});}return this['smtp'][_0x9c24('0x37')](_0xaa34f6);};module[_0x9c24('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 4c32b10..8e584ae 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 _0x6942=['account','handleFetchEnd','handleFetchError','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','iconv','Iconv','events','EventEmitter','./utils','email','mailbox','once','ready','handleReady','end','handleEnd','error','handleError','connect','inherits','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','generateXOAuth2Token','data5','password','host','port','tls','autotls','openBox','handleOpenBox','bind','prototype','emit','box','readUnseen','handleCloseBox','search','UNSEEN','length','message','handleFetchMessage','closeBox','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser'];(function(_0x2a4172,_0x5bd9f1){var _0x24e48d=function(_0x241747){while(--_0x241747){_0x2a4172['push'](_0x2a4172['shift']());}};_0x24e48d(++_0x5bd9f1);}(_0x6942,0xf7));var _0x2694=function(_0x1665f6,_0x86e2b){_0x1665f6=_0x1665f6-0x0;var _0x2593f9=_0x6942[_0x1665f6];return _0x2593f9;};'use strict';var _=require(_0x2694('0x0'));var util=require(_0x2694('0x1'));var Imap=require(_0x2694('0x2'));var simpleParser=require(_0x2694('0x3'))['simpleParser'];var Iconv=require(_0x2694('0x4'))[_0x2694('0x5')];var EventEmitter=require(_0x2694('0x6'))[_0x2694('0x7')];var utils=require(_0x2694('0x8'));var logger=require('../../../config/logger')(_0x2694('0x9'));function EmailImap(_0x29427b,_0x489900){this[_0x2694('0xa')]=_0x29427b[_0x2694('0xa')];this['account']=this['getAccount'](_0x29427b,_0x489900);this[_0x2694('0x2')]=new Imap(this['account']);this['imap'][_0x2694('0xb')](_0x2694('0xc'),this[_0x2694('0xd')]['bind'](this));this[_0x2694('0x2')][_0x2694('0xb')](_0x2694('0xe'),this[_0x2694('0xf')]['bind'](this));this[_0x2694('0x2')]['on'](_0x2694('0x10'),this[_0x2694('0x11')]['bind'](this));this['imap'][_0x2694('0x12')]();}util[_0x2694('0x13')](EmailImap,EventEmitter);EmailImap['prototype'][_0x2694('0x14')]=function(_0x21f996,_0x42c221){var _0x1fc45d={'connTimeout':_0x21f996[_0x2694('0x15')]?_0x21f996[_0x2694('0x15')]*0x3e8:0x2710,'authTimeout':_0x21f996[_0x2694('0x16')]?_0x21f996[_0x2694('0x16')]*0x3e8:0x1388};if(_0x21f996[_0x2694('0x17')]){_0x1fc45d[_0x2694('0x18')]=_0x21f996[_0x2694('0x18')];if(_0x21f996[_0x2694('0x19')]){_0x1fc45d['xoauth2']=utils[_0x2694('0x1a')](_0x21f996['CloudProvider'][_0x2694('0x1b')],_0x21f996[_0x2694('0x18')]);}else{_0x1fc45d['password']=_0x21f996[_0x2694('0x1c')];}}else{if(_0x21f996['authentication']){_0x1fc45d[_0x2694('0x18')]=_0x21f996['user'];_0x1fc45d['password']=_0x21f996['password'];}}_0x1fc45d['email']=_0x42c221||_0x21f996[_0x2694('0x18')]||'anonymous@xcally.com';_0x1fc45d[_0x2694('0x1d')]=_0x21f996[_0x2694('0x1d')];_0x1fc45d[_0x2694('0x1e')]=_0x21f996[_0x2694('0x1e')]||0x3e1;if(_0x21f996['tls']){_0x1fc45d['tls']=!![];}else{_0x1fc45d[_0x2694('0x1f')]=![];_0x1fc45d[_0x2694('0x20')]='required';}return _0x1fc45d;};EmailImap['prototype'][_0x2694('0xd')]=function(){this[_0x2694('0x2')][_0x2694('0x21')](this[_0x2694('0xa')],![],this[_0x2694('0x22')][_0x2694('0x23')](this));};EmailImap[_0x2694('0x24')][_0x2694('0x22')]=function(_0xc57230,_0x2c5ef0){if(_0xc57230){this[_0x2694('0x11')](_0xc57230,!![]);}else{this[_0x2694('0x25')](_0x2694('0x26'),_0x2c5ef0);this[_0x2694('0x27')]();}};EmailImap[_0x2694('0x24')][_0x2694('0x28')]=function(_0x2c5e52){if(_0x2c5e52){this[_0x2694('0x11')](_0x2c5e52,!![]);}else{this['imap'][_0x2694('0xe')]();}};EmailImap['prototype'][_0x2694('0x27')]=function(){this['imap'][_0x2694('0x29')]([_0x2694('0x2a')],this['handleReadUnseen']['bind'](this));};EmailImap[_0x2694('0x24')]['handleReadUnseen']=function(_0x227392,_0x1c53ad){if(_0x227392){this['handleError'](_0x227392,!![]);}else{if(_0x1c53ad[_0x2694('0x2b')]){try{var _0x4ac964=this['imap']['fetch'](_0x1c53ad,{'bodies':'','markSeen':!![]});_0x4ac964['on'](_0x2694('0x2c'),this[_0x2694('0x2d')]['bind'](this));_0x4ac964[_0x2694('0xb')](_0x2694('0x10'),this['handleFetchError'][_0x2694('0x23')](this));_0x4ac964[_0x2694('0xb')]('end',this['handleFetchEnd'][_0x2694('0x23')](this));}catch(_0xace7b){logger[_0x2694('0x10')](_0xace7b);}}else{this[_0x2694('0x2')][_0x2694('0x2e')](!![],this[_0x2694('0x28')][_0x2694('0x23')](this));}}};EmailImap['prototype'][_0x2694('0x2d')]=function(_0x3df328){_0x3df328['on']('body',this[_0x2694('0x2f')]['bind'](this));_0x3df328[_0x2694('0xb')](_0x2694('0x30'),this[_0x2694('0x31')][_0x2694('0x23')](this));_0x3df328[_0x2694('0xb')](_0x2694('0xe'),this[_0x2694('0x32')][_0x2694('0x23')](this));};EmailImap['prototype'][_0x2694('0x2f')]=function(_0x587304){simpleParser(_0x587304,{'Iconv':Iconv},this[_0x2694('0x33')][_0x2694('0x23')](this));};EmailImap[_0x2694('0x24')][_0x2694('0x31')]=function(){};EmailImap[_0x2694('0x24')][_0x2694('0x32')]=function(){};EmailImap[_0x2694('0x24')]['handleSimpleParser']=function(_0x1dfe3f,_0x1e4765){if(_0x1dfe3f){logger['error'](_0x1dfe3f);}else{var _0x40ebb6=this;utils[_0x2694('0x34')](this[_0x2694('0x35')],_0x1e4765,function(_0x117a08){_0x40ebb6[_0x2694('0x25')]('email',_0x117a08);});}};EmailImap[_0x2694('0x24')][_0x2694('0x36')]=function(){this[_0x2694('0x2')][_0x2694('0x2e')](!![],this[_0x2694('0x28')][_0x2694('0x23')](this));};EmailImap[_0x2694('0x24')][_0x2694('0x37')]=function(_0x240cad){this[_0x2694('0x11')](_0x240cad);this[_0x2694('0x2')][_0x2694('0x2e')](!![],this['handleCloseBox'][_0x2694('0x23')](this));};EmailImap[_0x2694('0x24')][_0x2694('0xf')]=function(){this['emit'](_0x2694('0xe'));};EmailImap[_0x2694('0x24')]['handleError']=function(_0x42b686,_0x2045aa){logger[_0x2694('0x10')]('handleError',this['account'][_0x2694('0x9')],JSON['stringify'](_0x42b686));var _0x43e741='';if(_0x42b686){if(_0x42b686[_0x2694('0x38')]){_0x43e741=_0x42b686[_0x2694('0x38')];}else{for(var _0x54ba50 in _0x42b686){if(_0x42b686[_0x2694('0x39')](_0x54ba50)){_0x43e741+=_[_0x2694('0x3a')](_0x54ba50)+':\x20'+_0x42b686[_0x54ba50]+'\x0a';}}}}if(_0x2045aa){this[_0x2694('0x2')][_0x2694('0xe')]();}else{this['emit'](_0x2694('0x10'),_0x43e741);this[_0x2694('0x25')](_0x2694('0xe'));}};module[_0x2694('0x3b')]=EmailImap; \ No newline at end of file +var _0x69eb=['inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','required','handleReady','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','message','error','handleFetchError','handleFetchEnd','handleFetchMessage','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','closeBox','handleEnd','stringify','textCode','hasOwnProperty','lodash','imap','simpleParser','Iconv','EventEmitter','./utils','../../../config/logger','email','mailbox','getAccount','account','once','ready','bind','end','handleError'];(function(_0x2b372c,_0x1ecdfe){var _0x519cef=function(_0x5edf40){while(--_0x5edf40){_0x2b372c['push'](_0x2b372c['shift']());}};_0x519cef(++_0x1ecdfe);}(_0x69eb,0xa1));var _0xb69e=function(_0x32a413,_0x189539){_0x32a413=_0x32a413-0x0;var _0x445da1=_0x69eb[_0x32a413];return _0x445da1;};'use strict';var _=require(_0xb69e('0x0'));var util=require('util');var Imap=require(_0xb69e('0x1'));var simpleParser=require('mailparser')[_0xb69e('0x2')];var Iconv=require('iconv')[_0xb69e('0x3')];var EventEmitter=require('events')[_0xb69e('0x4')];var utils=require(_0xb69e('0x5'));var logger=require(_0xb69e('0x6'))(_0xb69e('0x7'));function EmailImap(_0x25e22e,_0x1e4717){this['mailbox']=_0x25e22e[_0xb69e('0x8')];this['account']=this[_0xb69e('0x9')](_0x25e22e,_0x1e4717);this[_0xb69e('0x1')]=new Imap(this[_0xb69e('0xa')]);this[_0xb69e('0x1')][_0xb69e('0xb')](_0xb69e('0xc'),this['handleReady'][_0xb69e('0xd')](this));this[_0xb69e('0x1')][_0xb69e('0xb')](_0xb69e('0xe'),this['handleEnd'][_0xb69e('0xd')](this));this[_0xb69e('0x1')]['on']('error',this[_0xb69e('0xf')][_0xb69e('0xd')](this));this[_0xb69e('0x1')]['connect']();}util[_0xb69e('0x10')](EmailImap,EventEmitter);EmailImap[_0xb69e('0x11')]['getAccount']=function(_0x2e0c84,_0x2fa05e){var _0x2823bf={'connTimeout':_0x2e0c84['connTimeout']?_0x2e0c84[_0xb69e('0x12')]*0x3e8:0x2710,'authTimeout':_0x2e0c84['authTimeout']?_0x2e0c84[_0xb69e('0x13')]*0x3e8:0x1388};if(_0x2e0c84[_0xb69e('0x14')]){_0x2823bf['user']=_0x2e0c84[_0xb69e('0x15')];if(_0x2e0c84[_0xb69e('0x16')]){_0x2823bf[_0xb69e('0x17')]=utils[_0xb69e('0x18')](_0x2e0c84[_0xb69e('0x19')][_0xb69e('0x1a')],_0x2e0c84['user']);}else{_0x2823bf['password']=_0x2e0c84[_0xb69e('0x1b')];}}else{if(_0x2e0c84[_0xb69e('0x1c')]){_0x2823bf[_0xb69e('0x15')]=_0x2e0c84[_0xb69e('0x15')];_0x2823bf[_0xb69e('0x1b')]=_0x2e0c84[_0xb69e('0x1b')];}}_0x2823bf[_0xb69e('0x7')]=_0x2fa05e||_0x2e0c84['user']||_0xb69e('0x1d');_0x2823bf[_0xb69e('0x1e')]=_0x2e0c84[_0xb69e('0x1e')];_0x2823bf[_0xb69e('0x1f')]=_0x2e0c84['port']||0x3e1;if(_0x2e0c84[_0xb69e('0x20')]){_0x2823bf[_0xb69e('0x20')]=!![];}else{_0x2823bf[_0xb69e('0x20')]=![];_0x2823bf['autotls']=_0xb69e('0x21');}return _0x2823bf;};EmailImap[_0xb69e('0x11')][_0xb69e('0x22')]=function(){this[_0xb69e('0x1')]['openBox'](this['mailbox'],![],this['handleOpenBox'][_0xb69e('0xd')](this));};EmailImap[_0xb69e('0x11')]['handleOpenBox']=function(_0x4752fd,_0x5d68cc){if(_0x4752fd){this['handleError'](_0x4752fd,!![]);}else{this[_0xb69e('0x23')](_0xb69e('0x24'),_0x5d68cc);this[_0xb69e('0x25')]();}};EmailImap[_0xb69e('0x11')][_0xb69e('0x26')]=function(_0x10a595){if(_0x10a595){this[_0xb69e('0xf')](_0x10a595,!![]);}else{this[_0xb69e('0x1')][_0xb69e('0xe')]();}};EmailImap[_0xb69e('0x11')][_0xb69e('0x25')]=function(){this[_0xb69e('0x1')][_0xb69e('0x27')]([_0xb69e('0x28')],this[_0xb69e('0x29')][_0xb69e('0xd')](this));};EmailImap[_0xb69e('0x11')][_0xb69e('0x29')]=function(_0xa7a2d8,_0x501010){if(_0xa7a2d8){this[_0xb69e('0xf')](_0xa7a2d8,!![]);}else{if(_0x501010[_0xb69e('0x2a')]){try{var _0x39aa04=this[_0xb69e('0x1')][_0xb69e('0x2b')](_0x501010,{'bodies':'','markSeen':!![]});_0x39aa04['on'](_0xb69e('0x2c'),this['handleFetchMessage'][_0xb69e('0xd')](this));_0x39aa04[_0xb69e('0xb')](_0xb69e('0x2d'),this[_0xb69e('0x2e')][_0xb69e('0xd')](this));_0x39aa04[_0xb69e('0xb')](_0xb69e('0xe'),this[_0xb69e('0x2f')][_0xb69e('0xd')](this));}catch(_0x2cac9f){logger[_0xb69e('0x2d')](_0x2cac9f);}}else{this[_0xb69e('0x1')]['closeBox'](!![],this[_0xb69e('0x26')]['bind'](this));}}};EmailImap[_0xb69e('0x11')][_0xb69e('0x30')]=function(_0xc6735c){_0xc6735c['on'](_0xb69e('0x31'),this['handleMessageBody'][_0xb69e('0xd')](this));_0xc6735c[_0xb69e('0xb')](_0xb69e('0x32'),this[_0xb69e('0x33')]['bind'](this));_0xc6735c[_0xb69e('0xb')](_0xb69e('0xe'),this[_0xb69e('0x34')][_0xb69e('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x3653ae){simpleParser(_0x3653ae,{'Iconv':Iconv},this[_0xb69e('0x35')]['bind'](this));};EmailImap[_0xb69e('0x11')][_0xb69e('0x33')]=function(){};EmailImap['prototype'][_0xb69e('0x34')]=function(){};EmailImap[_0xb69e('0x11')][_0xb69e('0x35')]=function(_0x2d302b,_0x4d4740){if(_0x2d302b){logger['error'](_0x2d302b);}else{var _0x269ae1=this;utils['parser'](this['account'],_0x4d4740,function(_0x577514){_0x269ae1[_0xb69e('0x23')](_0xb69e('0x7'),_0x577514);});}};EmailImap['prototype']['handleFetchEnd']=function(){this[_0xb69e('0x1')][_0xb69e('0x36')](!![],this[_0xb69e('0x26')][_0xb69e('0xd')](this));};EmailImap[_0xb69e('0x11')][_0xb69e('0x2e')]=function(_0x484c38){this[_0xb69e('0xf')](_0x484c38);this['imap'][_0xb69e('0x36')](!![],this[_0xb69e('0x26')][_0xb69e('0xd')](this));};EmailImap['prototype'][_0xb69e('0x37')]=function(){this[_0xb69e('0x23')]('end');};EmailImap[_0xb69e('0x11')]['handleError']=function(_0x4e5470,_0x418825){logger[_0xb69e('0x2d')](_0xb69e('0xf'),this['account'][_0xb69e('0x7')],JSON[_0xb69e('0x38')](_0x4e5470));var _0x41e621='';if(_0x4e5470){if(_0x4e5470['textCode']){_0x41e621=_0x4e5470[_0xb69e('0x39')];}else{for(var _0x4254e7 in _0x4e5470){if(_0x4e5470[_0xb69e('0x3a')](_0x4254e7)){_0x41e621+=_['upperFirst'](_0x4254e7)+':\x20'+_0x4e5470[_0x4254e7]+'\x0a';}}}}if(_0x418825){this[_0xb69e('0x1')][_0xb69e('0xe')]();}else{this['emit'](_0xb69e('0x2d'),_0x41e621);this['emit'](_0xb69e('0xe'));}};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 7797323..de80d0d 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 _0x514b=['use','compile','sendMail','toString','Not\x20verifired','nodemailer','prototype','send','createTransport'];(function(_0x38b090,_0x471976){var _0x1788ad=function(_0x1c7880){while(--_0x1c7880){_0x38b090['push'](_0x38b090['shift']());}};_0x1788ad(++_0x471976);}(_0x514b,0x137));var _0xb514=function(_0x5b246b,_0x5de701){_0x5b246b=_0x5b246b-0x0;var _0x436974=_0x514b[_0x5b246b];return _0x436974;};'use strict';var nodemailer=require(_0xb514('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0xb514('0x1')][_0xb514('0x2')]=function(_0x4eed57,_0x13dff3){return new Promise(function(_0x3fe3b9,_0x49d74b){var _0x50c016=nodemailer[_0xb514('0x3')](_0x4eed57);_0x50c016[_0xb514('0x4')](_0xb514('0x5'),inlineBase64());_0x50c016[_0xb514('0x6')](_0x13dff3,function(_0x499488,_0x56d6d6){if(_0x499488){_0x49d74b(_0x499488[_0xb514('0x7')]());}else{_0x3fe3b9(_0x56d6d6);}});});};EmailSmtp['prototype']['verify']=function(_0x1a59be){return new Promise(function(_0x45128f,_0x3fcf26){var _0x55e1e8=nodemailer['createTransport'](_0x1a59be);_0x55e1e8['verify'](function(_0x2fb4a2,_0xab6e43){if(_0x2fb4a2){_0x3fcf26(_0x2fb4a2['toString']());}else{if(_0xab6e43){_0x45128f(_0xab6e43);}else{_0x3fcf26(_0xb514('0x8'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x2ca9=['send','sendMail','toString','createTransport','verify','exports','nodemailer-plugin-inline-base64','prototype'];(function(_0x1bb174,_0x5b15b7){var _0x3596fb=function(_0x28b9e3){while(--_0x28b9e3){_0x1bb174['push'](_0x1bb174['shift']());}};_0x3596fb(++_0x5b15b7);}(_0x2ca9,0x116));var _0x92ca=function(_0x4d9ff2,_0x426e18){_0x4d9ff2=_0x4d9ff2-0x0;var _0xaca268=_0x2ca9[_0x4d9ff2];return _0xaca268;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x92ca('0x0'));function EmailSmtp(){}EmailSmtp[_0x92ca('0x1')][_0x92ca('0x2')]=function(_0x5085a7,_0x113340){return new Promise(function(_0x2ab798,_0x1a2936){var _0x3b0d25=nodemailer['createTransport'](_0x5085a7);_0x3b0d25['use']('compile',inlineBase64());_0x3b0d25[_0x92ca('0x3')](_0x113340,function(_0x202e0a,_0xb3d684){if(_0x202e0a){_0x1a2936(_0x202e0a[_0x92ca('0x4')]());}else{_0x2ab798(_0xb3d684);}});});};EmailSmtp[_0x92ca('0x1')]['verify']=function(_0x230287){return new Promise(function(_0x26bdce,_0x1c53be){var _0x50c724=nodemailer[_0x92ca('0x5')](_0x230287);_0x50c724[_0x92ca('0x6')](function(_0x2d51fc,_0x23512a){if(_0x2d51fc){_0x1c53be(_0x2d51fc[_0x92ca('0x4')]());}else{if(_0x23512a){_0x26bdce(_0x23512a);}else{_0x1c53be('Not\x20verifired');}}});});};module[_0x92ca('0x7')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index cf35bcb..dcfb5bb 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 _0xaf06=['path','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','slice','join','Anonymous','pop','length','anonymous','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','isEmpty','originCc','bcc','attach','type','attachment','attachment-','format','%s-%s','now','server/files/attachments/','writeFileSync','content','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','isAutoreply','parser','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','

Empty\x20message

','Attachments','base64','lodash','randomstring'];(function(_0x3b3199,_0x10216d){var _0x4f592c=function(_0x1160c3){while(--_0x1160c3){_0x3b3199['push'](_0x3b3199['shift']());}};_0x4f592c(++_0x10216d);}(_0xaf06,0x112));var _0x6af0=function(_0x1171ca,_0xa4765){_0x1171ca=_0x1171ca-0x0;var _0x9c52fb=_0xaf06[_0x1171ca];return _0x9c52fb;};'use strict';var _=require(_0x6af0('0x0'));var moment=require('moment');var random=require(_0x6af0('0x1'));var fs=require('fs');var path=require(_0x6af0('0x2'));var util=require('util');var tnef=require(_0x6af0('0x3'));var logger=require(_0x6af0('0x4'))(_0x6af0('0x5'));var config=require(_0x6af0('0x6'));function getAddress(_0xb08898){var _0x3a19cc=_[_0x6af0('0x7')](_0xb08898[_0x6af0('0x8')]);return _0x3a19cc&&_0x3a19cc['address']?_0x3a19cc[_0x6af0('0x9')]:'anonymous'+random[_0x6af0('0xa')](0x6)+_0x6af0('0xb');}function getFirstName(_0x2bc9e2){var _0x40f1b=_[_0x6af0('0x7')](_0x2bc9e2[_0x6af0('0x8')]);if(_0x40f1b&&_0x40f1b[_0x6af0('0xc')]){if(_0x40f1b[_0x6af0('0xc')]==_0x40f1b[_0x6af0('0x9')]){return _0x40f1b[_0x6af0('0xc')]['substring'](0x0,_0x40f1b[_0x6af0('0xc')]['indexOf']('@'));}var _0x37d1a0=_0x40f1b[_0x6af0('0xc')][_0x6af0('0xd')](/\s+/);return _0x37d1a0['length']>0x1?_0x37d1a0[_0x6af0('0xe')](0x0,-0x1)[_0x6af0('0xf')]('\x20'):_0x40f1b[_0x6af0('0xc')];}return _0x6af0('0x10');}function getLastName(_0x16e5dc){var _0x58a1fe=_[_0x6af0('0x7')](_0x16e5dc[_0x6af0('0x8')]);if(_0x58a1fe&&_0x58a1fe[_0x6af0('0xc')]){var _0x3e33e5=_0x58a1fe[_0x6af0('0xc')][_0x6af0('0xd')](/\s+/);return _0x3e33e5['length']>0x1?_0x3e33e5[_0x6af0('0x11')]():'';}return'';}function getMails(_0x5f03e0,_0x984a69){var _0x1abffc='';for(var _0x2fbab9=0x0;_0x2fbab9<_0x984a69[_0x6af0('0x8')][_0x6af0('0x12')];_0x2fbab9+=0x1){if(_0x984a69[_0x6af0('0x8')][_0x2fbab9][_0x6af0('0x9')]!==_0x5f03e0){if(!_['isEmpty'](_0x1abffc)){_0x1abffc+=',';}_0x1abffc+=_0x984a69['value'][_0x2fbab9][_0x6af0('0xc')]||_0x984a69[_0x6af0('0x8')][_0x2fbab9][_0x6af0('0x9')]||'';_0x1abffc+='\x20<';_0x1abffc+=_0x984a69[_0x6af0('0x8')][_0x2fbab9][_0x6af0('0x9')]?_0x984a69['value'][_0x2fbab9]['address']:_0x6af0('0x13')+random[_0x6af0('0xa')](0x6)+'@xcally.com';_0x1abffc+='>';}}return _0x1abffc;}function parseEmail(_0x14de20,_0x46207e,_0xa36ffe){if(_0x46207e['html']){var _0xadc930=/)<[^<]*)*<\/script>/gi;while(_0xadc930['test'](_0x46207e['html'])){_0x46207e[_0x6af0('0x14')]=_0x46207e['html'][_0x6af0('0x15')](_0xadc930,'');}if(_0x46207e['html'][_0x6af0('0x16')](_0x6af0('0x17'))){var _0xcb0ae6=[];_0x46207e[_0x6af0('0x18')][_0x6af0('0x19')](_0x294c84=>{_0xcb0ae6[_0x6af0('0x1a')](_0x294c84[_0x6af0('0x1b')]);});var _0x243ce5=/]+>/g;var _0x4c494e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x1524d7=_0x46207e[_0x6af0('0x14')][_0x6af0('0x15')](_0x4c494e,_0x6af0('0x1c'));var _0x46e371=_0x1524d7['replace'](_0x243ce5,_0x6af0('0x1d'));for(let _0x54aea6=0x0;_0x54aea6<_0xcb0ae6[_0x6af0('0x12')];_0x54aea6++){var _0x589e14=_0x46e371[_0x6af0('0x15')]('_IMG',_0x6af0('0x1e')+_0xcb0ae6[_0x54aea6]+_0x6af0('0x1f'));_0x46e371=_0x589e14;}_0x46207e['html']=_0x46e371;}_0xa36ffe[_0x6af0('0x20')]=_0x46207e[_0x6af0('0x14')];}else{_0xa36ffe[_0x6af0('0x20')]=_0x46207e[_0x6af0('0x21')];}if(_0xa36ffe[_0x6af0('0x20')]){_0xa36ffe['body']=_0xa36ffe[_0x6af0('0x20')][_0x6af0('0x15')](/0x0){var _0x5965c6=[_0x6af0('0x33'),_0x6af0('0x34'),_0x6af0('0x35')];for(var _0x20aec9=0x0;_0x20aec9<_0x46207e[_0x6af0('0x32')][_0x6af0('0x12')];_0x20aec9++){var _0x260a92=_[_0x6af0('0x36')](_0x5965c6,_0x46207e[_0x6af0('0x32')][_0x20aec9]['line']);if(_0x260a92>=0x0){_0xa36ffe[_0x6af0('0x37')]=!![];}}}return _0xa36ffe;}exports[_0x6af0('0x38')]=function(_0x4f55a3,_0x203829,_0x25560d){var _0x207bd6={'from':getAddress(_0x203829['from']),'firstName':getFirstName(_0x203829[_0x6af0('0x39')]),'lastName':getLastName(_0x203829[_0x6af0('0x39')]),'mapKey':_0x6af0('0x5'),'message':{'from':getMails(_0x4f55a3[_0x6af0('0x5')],_0x203829[_0x6af0('0x39')]),'to':_0x4f55a3[_0x6af0('0x5')],'cc':'','subject':_0x203829[_0x6af0('0x3a')]||'','messageId':_0x203829['messageId'],'inReplyTo':_0x203829[_0x6af0('0x3b')],'sentAt':moment(_0x203829[_0x6af0('0x3c')])[_0x6af0('0x2b')](_0x6af0('0x3d')),'attach':![],'attachments':[]}};if(!_0x203829[_0x6af0('0x14')]&&!_0x203829[_0x6af0('0x21')]){var _0x3d7e1a=_[_0x6af0('0x3e')](_0x203829['attachments'],{'contentType':'application/ms-tnef'});if(_0x3d7e1a['length']){logger[_0x6af0('0x3f')](util['format'](_0x6af0('0x40'),_0x203829['messageId']));tnef[_0x6af0('0x41')](_['first'](_0x3d7e1a)[_0x6af0('0x30')],function(_0x1c8594,_0x361802){if(_0x361802){_0x203829[_0x6af0('0x14')]=_0x361802['BodyHTML']||_0x6af0('0x42');if(_0x361802[_0x6af0('0x43')]){for(var _0x24cfa6=0x0;_0x24cfa6<_0x361802[_0x6af0('0x43')][_0x6af0('0x12')];_0x24cfa6++){var _0x57e090=_0x361802[_0x6af0('0x43')][_0x24cfa6];_0x207bd6[_0x6af0('0x22')][_0x6af0('0x18')][_0x6af0('0x1a')]({'filename':_0x57e090['Title'],'content':Buffer[_0x6af0('0x39')](_0x57e090['Data'])});}}}_0x25560d(parseEmail(_0x4f55a3,_0x203829,_0x207bd6));});}else{_0x203829['html']=_0x6af0('0x42');_0x25560d(parseEmail(_0x4f55a3,_0x203829,_0x207bd6));}}else{_0x25560d(parseEmail(_0x4f55a3,_0x203829,_0x207bd6));}};exports['generateXOAuth2Token']=function(_0xa1ee7e,_0x238271){var _0x4a8384=['user='+(_0x238271||''),'auth=Bearer\x20'+_0xa1ee7e,'',''];return Buffer[_0x6af0('0x39')](_0x4a8384[_0x6af0('0xf')](''),'utf-8')['toString'](_0x6af0('0x44'));}; \ No newline at end of file +var _0x0715=['path','node-tnef','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','Anonymous','pop','isEmpty','generate','html','replace','includes','\x20[Attachment:\x20','body','Empty\x20message

','Attachments','push','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring'];(function(_0x29ddb7,_0x4f6bad){var _0x5aebef=function(_0x54452b){while(--_0x54452b){_0x29ddb7['push'](_0x29ddb7['shift']());}};_0x5aebef(++_0x4f6bad);}(_0x0715,0xde));var _0x5071=function(_0x5a93f6,_0x311b53){_0x5a93f6=_0x5a93f6-0x0;var _0x41fd24=_0x0715[_0x5a93f6];return _0x41fd24;};'use strict';var _=require(_0x5071('0x0'));var moment=require(_0x5071('0x1'));var random=require(_0x5071('0x2'));var fs=require('fs');var path=require(_0x5071('0x3'));var util=require('util');var tnef=require(_0x5071('0x4'));var logger=require('../../../config/logger')(_0x5071('0x5'));var config=require(_0x5071('0x6'));function getAddress(_0x18c2e8){var _0x3f4553=_[_0x5071('0x7')](_0x18c2e8[_0x5071('0x8')]);return _0x3f4553&&_0x3f4553[_0x5071('0x9')]?_0x3f4553[_0x5071('0x9')]:_0x5071('0xa')+random['generate'](0x6)+_0x5071('0xb');}function getFirstName(_0x5c9492){var _0x27d2c9=_[_0x5071('0x7')](_0x5c9492[_0x5071('0x8')]);if(_0x27d2c9&&_0x27d2c9['name']){if(_0x27d2c9[_0x5071('0xc')]==_0x27d2c9[_0x5071('0x9')]){return _0x27d2c9[_0x5071('0xc')][_0x5071('0xd')](0x0,_0x27d2c9[_0x5071('0xc')][_0x5071('0xe')]('@'));}var _0x5894b9=_0x27d2c9[_0x5071('0xc')][_0x5071('0xf')](/\s+/);return _0x5894b9[_0x5071('0x10')]>0x1?_0x5894b9[_0x5071('0x11')](0x0,-0x1)['join']('\x20'):_0x27d2c9[_0x5071('0xc')];}return _0x5071('0x12');}function getLastName(_0xf1071){var _0x3db7ea=_[_0x5071('0x7')](_0xf1071[_0x5071('0x8')]);if(_0x3db7ea&&_0x3db7ea[_0x5071('0xc')]){var _0x52c514=_0x3db7ea[_0x5071('0xc')][_0x5071('0xf')](/\s+/);return _0x52c514[_0x5071('0x10')]>0x1?_0x52c514[_0x5071('0x13')]():'';}return'';}function getMails(_0x224ae9,_0x9ce894){var _0x3964e2='';for(var _0x4cacdc=0x0;_0x4cacdc<_0x9ce894[_0x5071('0x8')][_0x5071('0x10')];_0x4cacdc+=0x1){if(_0x9ce894[_0x5071('0x8')][_0x4cacdc]['address']!==_0x224ae9){if(!_[_0x5071('0x14')](_0x3964e2)){_0x3964e2+=',';}_0x3964e2+=_0x9ce894[_0x5071('0x8')][_0x4cacdc][_0x5071('0xc')]||_0x9ce894['value'][_0x4cacdc]['address']||'';_0x3964e2+='\x20<';_0x3964e2+=_0x9ce894[_0x5071('0x8')][_0x4cacdc][_0x5071('0x9')]?_0x9ce894[_0x5071('0x8')][_0x4cacdc][_0x5071('0x9')]:_0x5071('0xa')+random[_0x5071('0x15')](0x6)+_0x5071('0xb');_0x3964e2+='>';}}return _0x3964e2;}function parseEmail(_0x30506f,_0xbfef0f,_0x2e32e4){if(_0xbfef0f['html']){var _0x37065e=/)<[^<]*)*<\/script>/gi;while(_0x37065e['test'](_0xbfef0f[_0x5071('0x16')])){_0xbfef0f[_0x5071('0x16')]=_0xbfef0f[_0x5071('0x16')][_0x5071('0x17')](_0x37065e,'');}if(_0xbfef0f[_0x5071('0x16')][_0x5071('0x18')](_0x5071('0x19'))){var _0x2ec522=[];_0xbfef0f[_0x5071('0x1a')]['forEach'](_0x4489b5=>{_0x2ec522['push'](_0x4489b5['filename']);});var _0x19aa73=/]+>/g;var _0x34b7d8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x10188d=_0xbfef0f[_0x5071('0x16')][_0x5071('0x17')](_0x34b7d8,_0x5071('0x1b'));var _0x3db693=_0x10188d['replace'](_0x19aa73,_0x5071('0x1c'));for(let _0x5823dc=0x0;_0x5823dc<_0x2ec522[_0x5071('0x10')];_0x5823dc++){var _0x157072=_0x3db693['replace'](_0x5071('0x1c'),_0x5071('0x1d')+_0x2ec522[_0x5823dc]+'\x20]');_0x3db693=_0x157072;}_0xbfef0f[_0x5071('0x16')]=_0x3db693;}_0x2e32e4[_0x5071('0x1e')]=_0xbfef0f[_0x5071('0x16')];}else{_0x2e32e4[_0x5071('0x1e')]=_0xbfef0f['textAsHtml'];}if(_0x2e32e4['body']){_0x2e32e4[_0x5071('0x1e')]=_0x2e32e4[_0x5071('0x1e')]['replace'](/0x0){var _0x3bf984=['Auto-Submitted:\x20auto-replied',_0x5071('0x32'),_0x5071('0x33')];for(var _0x21998a=0x0;_0x21998a<_0xbfef0f[_0x5071('0x31')]['length'];_0x21998a++){var _0x5ffdbf=_[_0x5071('0xe')](_0x3bf984,_0xbfef0f[_0x5071('0x31')][_0x21998a][_0x5071('0x34')]);if(_0x5ffdbf>=0x0){_0x2e32e4[_0x5071('0x35')]=!![];}}}return _0x2e32e4;}exports['parser']=function(_0x46dc7b,_0x5d063b,_0x4e4a00){var _0x8e5bb8={'from':getAddress(_0x5d063b[_0x5071('0x36')]),'firstName':getFirstName(_0x5d063b[_0x5071('0x36')]),'lastName':getLastName(_0x5d063b[_0x5071('0x36')]),'mapKey':'email','message':{'from':getMails(_0x46dc7b['email'],_0x5d063b[_0x5071('0x36')]),'to':_0x46dc7b[_0x5071('0x5')],'cc':'','subject':_0x5d063b['subject']||'','messageId':_0x5d063b[_0x5071('0x37')],'inReplyTo':_0x5d063b[_0x5071('0x38')],'sentAt':moment(_0x5d063b[_0x5071('0x39')])[_0x5071('0x28')](_0x5071('0x3a')),'attach':![],'attachments':[]}};if(!_0x5d063b[_0x5071('0x16')]&&!_0x5d063b[_0x5071('0x3b')]){var _0x451e9f=_[_0x5071('0x3c')](_0x5d063b[_0x5071('0x1a')],{'contentType':_0x5071('0x3d')});if(_0x451e9f[_0x5071('0x10')]){logger[_0x5071('0x3e')](util[_0x5071('0x28')](_0x5071('0x3f'),_0x5d063b['messageId']));tnef[_0x5071('0x40')](_[_0x5071('0x41')](_0x451e9f)['content'],function(_0x5dffb3,_0x5f00bd){if(_0x5f00bd){_0x5d063b[_0x5071('0x16')]=_0x5f00bd[_0x5071('0x42')]||_0x5071('0x43');if(_0x5f00bd[_0x5071('0x44')]){for(var _0x22617f=0x0;_0x22617f<_0x5f00bd[_0x5071('0x44')][_0x5071('0x10')];_0x22617f++){var _0x592166=_0x5f00bd[_0x5071('0x44')][_0x22617f];_0x8e5bb8[_0x5071('0x20')]['attachments'][_0x5071('0x45')]({'filename':_0x592166['Title'],'content':Buffer[_0x5071('0x36')](_0x592166['Data'])});}}}_0x4e4a00(parseEmail(_0x46dc7b,_0x5d063b,_0x8e5bb8));});}else{_0x5d063b[_0x5071('0x16')]=_0x5071('0x43');_0x4e4a00(parseEmail(_0x46dc7b,_0x5d063b,_0x8e5bb8));}}else{_0x4e4a00(parseEmail(_0x46dc7b,_0x5d063b,_0x8e5bb8));}};exports['generateXOAuth2Token']=function(_0x14b88a,_0x42d84a){var _0x1e533a=[_0x5071('0x46')+(_0x42d84a||''),_0x5071('0x47')+_0x14b88a,'',''];return Buffer['from'](_0x1e533a[_0x5071('0x2b')](''),_0x5071('0x48'))[_0x5071('0x49')](_0x5071('0x4a'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index f753a17..68fbdfb 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 _0x6426=['name','key','active','Imap','Smtp','exports','lodash'];(function(_0x1865f3,_0x5154be){var _0xb69290=function(_0x12e20b){while(--_0x12e20b){_0x1865f3['push'](_0x1865f3['shift']());}};_0xb69290(++_0x5154be);}(_0x6426,0xca));var _0x6642=function(_0x50c78d,_0xc42273){_0x50c78d=_0x50c78d-0x0;var _0x5ef890=_0x6426[_0x50c78d];return _0x5ef890;};'use strict';var _=require(_0x6642('0x0'));function MailAccount(_0x1db1d2){this['id']=_0x1db1d2['id']||0x0;this[_0x6642('0x1')]=_0x1db1d2[_0x6642('0x1')]||'Service';this['key']=_0x1db1d2[_0x6642('0x2')]||'SERV';this['active']=_0x1db1d2[_0x6642('0x3')]||![];this['Imap']=_0x1db1d2[_0x6642('0x4')]||[];this[_0x6642('0x5')]=_0x1db1d2[_0x6642('0x5')]||[];}module[_0x6642('0x6')]=MailAccount; \ No newline at end of file +var _0xb953=['name','Service','key','SERV','active','Imap','Smtp','exports','lodash'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb953,0x8f));var _0x3b95=function(_0x2efb36,_0x32b7e0){_0x2efb36=_0x2efb36-0x0;var _0x35c705=_0xb953[_0x2efb36];return _0x35c705;};'use strict';var _=require(_0x3b95('0x0'));function MailAccount(_0xc33c65){this['id']=_0xc33c65['id']||0x0;this[_0x3b95('0x1')]=_0xc33c65[_0x3b95('0x1')]||_0x3b95('0x2');this['key']=_0xc33c65[_0x3b95('0x3')]||_0x3b95('0x4');this[_0x3b95('0x5')]=_0xc33c65[_0x3b95('0x5')]||![];this[_0x3b95('0x6')]=_0xc33c65[_0x3b95('0x6')]||[];this[_0x3b95('0x7')]=_0xc33c65[_0x3b95('0x7')]||[];}module[_0x3b95('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 7d79591..005677f 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 _0x0874=['merge','exports','../model/mailAccount','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','isUndefined'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x0874,0x14c));var _0x4087=function(_0x5cd26b,_0x4edbb7){_0x5cd26b=_0x5cd26b-0x0;var _0x4d2b2a=_0x0874[_0x5cd26b];return _0x4d2b2a;};'use strict';var _=require('lodash');var MailAccount=require(_0x4087('0x0'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x22cf16,_0x2eba4b,_0x28bcd8){var _0x261d87=_['mapKeys'](_0x22cf16,function(_0x599671,_0x39ed0c){return _0x599671[_0x28bcd8];});for(var _0x73d616 in _0x2eba4b){if(_0x2eba4b[_0x4087('0x1')](_0x73d616)){if(!_0x261d87[_0x73d616]){delete _0x2eba4b[_0x73d616];}}}}Realtime[_0x4087('0x2')][_0x4087('0x3')]=function(_0x53e9a2,_0x4b7e8e){for(var _0x54a52a in _0x4b7e8e){if(_0x53e9a2[_0x4087('0x1')](_0x54a52a)){_0x53e9a2[_0x54a52a]=_0x4b7e8e[_0x54a52a];}}};Realtime[_0x4087('0x2')][_0x4087('0x4')]=function(){var _0x1178b1=this;return function(_0xde0fd8){if(_0xde0fd8){freeIsNotKey(_0xde0fd8,_0x1178b1[_0x4087('0x5')],'id');for(var _0x71223=0x0,_0x595b6d={},_0x406205={};_0x71223<_0xde0fd8[_0x4087('0x6')];_0x71223+=0x1){_0x595b6d=_0xde0fd8[_0x71223];if(_[_0x4087('0x7')](_0x1178b1[_0x4087('0x5')][_0x595b6d['id']])){_0x1178b1['mailAccounts'][_0x595b6d['id']]=new MailAccount(_0x595b6d);}else{_[_0x4087('0x8')](_0x1178b1['mailAccounts'][_0x595b6d['id']],_0x595b6d);}}}return _0x1178b1[_0x4087('0x5')];};};module[_0x4087('0x9')]=Realtime; \ No newline at end of file +var _0x13c8=['isUndefined','lodash','mapKeys','prototype','hasOwnProperty','mailAccounts'];(function(_0x54d3e7,_0x22aed6){var _0x78829=function(_0x5dca17){while(--_0x5dca17){_0x54d3e7['push'](_0x54d3e7['shift']());}};_0x78829(++_0x22aed6);}(_0x13c8,0x16f));var _0x813c=function(_0x1d30a3,_0x5f428c){_0x1d30a3=_0x1d30a3-0x0;var _0x32bba1=_0x13c8[_0x1d30a3];return _0x32bba1;};'use strict';var _=require(_0x813c('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x26aeef,_0x17683b,_0x542257){var _0x3dee3e=_[_0x813c('0x1')](_0x26aeef,function(_0x59d6ea,_0x435c3c){return _0x59d6ea[_0x542257];});for(var _0x1d9dd4 in _0x17683b){if(_0x17683b['hasOwnProperty'](_0x1d9dd4)){if(!_0x3dee3e[_0x1d9dd4]){delete _0x17683b[_0x1d9dd4];}}}}Realtime[_0x813c('0x2')]['mergeFromDatabase']=function(_0x5b2d54,_0x348739){for(var _0x18a057 in _0x348739){if(_0x5b2d54[_0x813c('0x3')](_0x18a057)){_0x5b2d54[_0x18a057]=_0x348739[_0x18a057];}}};Realtime[_0x813c('0x2')]['initMailAccounts']=function(){var _0x348992=this;return function(_0x4ffc16){if(_0x4ffc16){freeIsNotKey(_0x4ffc16,_0x348992[_0x813c('0x4')],'id');for(var _0x2510b5=0x0,_0xcfc85d={},_0x3ef6ae={};_0x2510b5<_0x4ffc16['length'];_0x2510b5+=0x1){_0xcfc85d=_0x4ffc16[_0x2510b5];if(_[_0x813c('0x5')](_0x348992['mailAccounts'][_0xcfc85d['id']])){_0x348992[_0x813c('0x4')][_0xcfc85d['id']]=new MailAccount(_0xcfc85d);}else{_['merge'](_0x348992[_0x813c('0x4')][_0xcfc85d['id']],_0xcfc85d);}}}return _0x348992['mailAccounts'];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 87ef055..fad3fbf 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 _0x8e20=['active','key','ListId','TemplateId','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','../client','getMailAccounts','Request','name','provider','email'];(function(_0x1a32a4,_0x787642){var _0x15f169=function(_0xdcdb46){while(--_0xdcdb46){_0x1a32a4['push'](_0x1a32a4['shift']());}};_0x15f169(++_0x787642);}(_0x8e20,0x1af));var _0x08e2=function(_0x209bbf,_0x2e2375){_0x209bbf=_0x209bbf-0x0;var _0x592d4b=_0x8e20[_0x209bbf];return _0x592d4b;};'use strict';var client=require(_0x08e2('0x0'));exports[_0x08e2('0x1')]=function(){return function(){return client[_0x08e2('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x08e2('0x3'),_0x08e2('0x4'),'service',_0x08e2('0x5'),_0x08e2('0x6'),_0x08e2('0x7'),_0x08e2('0x8'),_0x08e2('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x08e2('0xa'),'include':[{'model':_0x08e2('0xb'),'attributes':['id','name',_0x08e2('0xc'),_0x08e2('0xd'),_0x08e2('0xe')],'as':_0x08e2('0xb')}]},{'model':_0x08e2('0xf'),'as':_0x08e2('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0x08e2('0x3'),'service','type',_0x08e2('0xe')],'as':_0x08e2('0xb')}]}]},'log':_0x08e2('0x11')});};};exports[_0x08e2('0x12')]=function(_0x485c80,_0x504b35){return client[_0x08e2('0x2')]('NotifyMailAccount',{'account':{'id':_0x485c80},'body':_0x504b35,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0xb245=['provider','active','key','ListId','MailServerIn','Imap','data5','CloudProvider','Smtp','service','type','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request','name'];(function(_0x5f322f,_0x1f2cde){var _0x43499c=function(_0x51f1e7){while(--_0x51f1e7){_0x5f322f['push'](_0x5f322f['shift']());}};_0x43499c(++_0x1f2cde);}(_0xb245,0xf8));var _0x5b24=function(_0x58dbb8,_0x1762ad){_0x58dbb8=_0x58dbb8-0x0;var _0x542fd3=_0xb245[_0x58dbb8];return _0x542fd3;};'use strict';var client=require(_0x5b24('0x0'));exports[_0x5b24('0x1')]=function(){return function(){return client[_0x5b24('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x5b24('0x3'),_0x5b24('0x4'),'service','email',_0x5b24('0x5'),_0x5b24('0x6'),_0x5b24('0x7'),'TemplateId'],'raw':![],'include':[{'model':_0x5b24('0x8'),'as':_0x5b24('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x5b24('0x3'),'service','type',_0x5b24('0xa')],'as':_0x5b24('0xb')}]},{'model':'MailServerOut','as':_0x5b24('0xc'),'include':[{'model':'CloudProvider','attributes':['id','name',_0x5b24('0xd'),_0x5b24('0xe'),_0x5b24('0xa')],'as':_0x5b24('0xb')}]}]},'log':_0x5b24('0xf')});};};exports[_0x5b24('0x10')]=function(_0x20a254,_0x176a4d){return client['Request'](_0x5b24('0x11'),{'account':{'id':_0x20a254},'body':_0x176a4d,'log':_0x5b24('0x11')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index cf9d30a..57005bf 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 _0xb4c9=['getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb4c9,0x68));var _0x9b4c=function(_0x238942,_0x3f45d9){_0x238942=_0x238942-0x0;var _0x3978ad=_0xb4c9[_0x238942];return _0x3978ad;};'use strict';var client=require('../client');exports[_0x9b4c('0x0')]=function(){return client[_0x9b4c('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x9b4c('0x2')]},'log':_0x9b4c('0x3')});}; \ No newline at end of file +var _0x3d1b=['../client','getSettings','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x4ae024,_0x2e3bfc){var _0x1b0f81=function(_0x52417d){while(--_0x52417d){_0x4ae024['push'](_0x4ae024['shift']());}};_0x1b0f81(++_0x2e3bfc);}(_0x3d1b,0xc8));var _0xb3d1=function(_0x4caa51,_0x46800d){_0x4caa51=_0x4caa51-0x0;var _0x140064=_0x3d1b[_0x4caa51];return _0x140064;};'use strict';var client=require(_0xb3d1('0x0'));exports[_0xb3d1('0x1')]=function(){return client['Request'](_0xb3d1('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xb3d1('0x3')]},'log':_0xb3d1('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a3e51d5..d632968 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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 98b60c0..f0569a2 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 _0x53aa=['../../routes','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','default','../../config/socketio'];(function(_0x544071,_0x2d90d0){var _0x136039=function(_0x4d4ec8){while(--_0x4d4ec8){_0x544071['push'](_0x544071['shift']());}};_0x136039(++_0x2d90d0);}(_0x53aa,0x119));var _0xa53a=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x53aa[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xa53a('0x0'));var http=require('http');var express=require(_0xa53a('0x1'));var sticky=require(_0xa53a('0x2'));var Redis=require(_0xa53a('0x3'));var config=require(_0xa53a('0x4'));var app=express();var server=http[_0xa53a('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0xa53a('0x6')](server,config[_0xa53a('0x7')])){var socketio=require(_0xa53a('0x8'))(server,{'transports':[_0xa53a('0x9'),_0xa53a('0xa')]});config[_0xa53a('0xb')]=_[_0xa53a('0xc')](config['redis'],{'host':_0xa53a('0xd'),'port':0x18eb});socketio[_0xa53a('0xe')](require(_0xa53a('0xf'))({'pubClient':new Redis(config[_0xa53a('0xb')]),'subClient':new Redis(config[_0xa53a('0xb')])}));require('../../config/triggers')[_0xa53a('0x10')]();require(_0xa53a('0x11'))[_0xa53a('0x10')](socketio);require('../../config/express')[_0xa53a('0x10')](app);require(_0xa53a('0x12'))['default'](app);}else{server['once'](_0xa53a('0x13'),function(){console[_0xa53a('0x14')](_0xa53a('0x15'),config[_0xa53a('0x7')]);});}exports=module[_0xa53a('0x16')]=app; \ No newline at end of file +var _0x3b4a=['lodash','http','sticky-session','../../config/environment','createServer','timeout','listen','socket.io','websocket','polling','socket.io-redis','redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0x3b4a,0x187));var _0xa3b4=function(_0xc2b3ce,_0x533dfd){_0xc2b3ce=_0xc2b3ce-0x0;var _0x30e6bb=_0x3b4a[_0xc2b3ce];return _0x30e6bb;};'use strict';var _=require(_0xa3b4('0x0'));var http=require(_0xa3b4('0x1'));var express=require('express');var sticky=require(_0xa3b4('0x2'));var Redis=require('ioredis');var config=require(_0xa3b4('0x3'));var app=express();var server=http[_0xa3b4('0x4')](app);server[_0xa3b4('0x5')]=0xdbba0;if(sticky[_0xa3b4('0x6')](server,config['port'])){var socketio=require(_0xa3b4('0x7'))(server,{'transports':[_0xa3b4('0x8'),_0xa3b4('0x9')]});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});socketio['adapter'](require(_0xa3b4('0xa'))({'pubClient':new Redis(config[_0xa3b4('0xb')]),'subClient':new Redis(config[_0xa3b4('0xb')])}));require(_0xa3b4('0xc'))[_0xa3b4('0xd')]();require(_0xa3b4('0xe'))[_0xa3b4('0xd')](socketio);require(_0xa3b4('0xf'))['default'](app);require(_0xa3b4('0x10'))[_0xa3b4('0xd')](app);}else{server[_0xa3b4('0x11')](_0xa3b4('0x12'),function(){console[_0xa3b4('0x13')](_0xa3b4('0x14'),config[_0xa3b4('0x15')]);});}exports=module[_0xa3b4('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index a87e43a..c4ad1de 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 _0x2a18=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','request','then','debug','error','rpc'];(function(_0x2a2a16,_0x20471b){var _0x5d7dab=function(_0x550209){while(--_0x550209){_0x2a2a16['push'](_0x2a2a16['shift']());}};_0x5d7dab(++_0x20471b);}(_0x2a18,0x1e4));var _0x82a1=function(_0x18a01c,_0xd1a13a){_0x18a01c=_0x18a01c-0x0;var _0x2b0cd6=_0x2a18[_0x18a01c];return _0x2b0cd6;};'use strict';var jayson=require(_0x82a1('0x0'));var BPromise=require(_0x82a1('0x1'));var logger=require(_0x82a1('0x2'))(_0x82a1('0x3'));var client=jayson[_0x82a1('0x4')][_0x82a1('0x5')]({'port':0x2329});client[_0x82a1('0x6')]=function(_0x5bd022,_0x3ebde1){return new BPromise(function(_0x1b8230,_0x1065d4){return client[_0x82a1('0x7')](_0x5bd022,_0x3ebde1)[_0x82a1('0x8')](function(_0x33804d){logger[_0x82a1('0x9')]('rpc',_0x82a1('0x3'),_0x5bd022,_0x3ebde1,_0x33804d);if(_0x33804d[_0x82a1('0xa')]){logger['error'](_0x82a1('0xb'),_0x82a1('0x3'),_0x5bd022,_0x33804d[_0x82a1('0xa')][_0x82a1('0xc')],_0x3ebde1);return _0x1065d4(_0x33804d['error'][_0x82a1('0xc')]);}else{return _0x1b8230(_0x33804d[_0x82a1('0xd')]);}})[_0x82a1('0xe')](function(_0x37a6a3){logger['error'](_0x82a1('0xb'),'routing',_0x5bd022,_0x37a6a3,_0x3ebde1);return _0x1065d4(_0x37a6a3);});});};module[_0x82a1('0xf')]=client; \ No newline at end of file +var _0x4bbd=['../../config/logger','client','http','request','then','debug','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0xba6e76,_0x388582){var _0x5b98a6=function(_0x1ca556){while(--_0x1ca556){_0xba6e76['push'](_0xba6e76['shift']());}};_0x5b98a6(++_0x388582);}(_0x4bbd,0x109));var _0xd4bb=function(_0x3ee993,_0x1b0dcf){_0x3ee993=_0x3ee993-0x0;var _0x198e7b=_0x4bbd[_0x3ee993];return _0x198e7b;};'use strict';var jayson=require(_0xd4bb('0x0'));var BPromise=require('bluebird');var logger=require(_0xd4bb('0x1'))('routing');var client=jayson[_0xd4bb('0x2')][_0xd4bb('0x3')]({'port':0x2329});client['Request']=function(_0x4c631e,_0x367a63){return new BPromise(function(_0x319e1a,_0x40d917){return client[_0xd4bb('0x4')](_0x4c631e,_0x367a63)[_0xd4bb('0x5')](function(_0xc55dfb){logger[_0xd4bb('0x6')](_0xd4bb('0x7'),_0xd4bb('0x8'),_0x4c631e,_0x367a63,_0xc55dfb);if(_0xc55dfb['error']){logger[_0xd4bb('0x9')]('rpc',_0xd4bb('0x8'),_0x4c631e,_0xc55dfb[_0xd4bb('0x9')][_0xd4bb('0xa')],_0x367a63);return _0x40d917(_0xc55dfb['error'][_0xd4bb('0xa')]);}else{return _0x319e1a(_0xc55dfb[_0xd4bb('0xb')]);}})[_0xd4bb('0xc')](function(_0x477922){logger[_0xd4bb('0x9')](_0xd4bb('0x7'),_0xd4bb('0x8'),_0x4c631e,_0x477922,_0x367a63);return _0x40d917(_0x477922);});});};module[_0xd4bb('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 033c1cc..086a20b 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 _0xf667=['getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues','listen','catch','log','bluebird','./realtime','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','then'];(function(_0x618a8e,_0x303940){var _0x45539e=function(_0x270deb){while(--_0x270deb){_0x618a8e['push'](_0x618a8e['shift']());}};_0x45539e(++_0x303940);}(_0xf667,0x105));var _0x7f66=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf667[_0x101e7b];return _0x4995c0;};'use strict';var BPromise=require(_0x7f66('0x0'));var server=require('./server');var Realtime=require(_0x7f66('0x1'));var user=require('./rpc/user');var interval=require(_0x7f66('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7f66('0x3'));var smsQueue=require(_0x7f66('0x4'));var mailQueue=require(_0x7f66('0x5'));var faxQueue=require(_0x7f66('0x6'));var whatsappQueue=require(_0x7f66('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()[_0x7f66('0x8')](user['getAgents']())[_0x7f66('0x8')](realtime['initAgents']())[_0x7f66('0x8')](interval['getIntervals']())['then'](realtime['initIntervals']())[_0x7f66('0x8')](openchannelQueue[_0x7f66('0x9')]())['then'](realtime[_0x7f66('0xa')]())[_0x7f66('0x8')](chatQueue['getChatQueues']())[_0x7f66('0x8')](realtime[_0x7f66('0xb')]())[_0x7f66('0x8')](smsQueue[_0x7f66('0xc')]())['then'](realtime['initSmsQueues']())['then'](mailQueue[_0x7f66('0xd')]())[_0x7f66('0x8')](realtime[_0x7f66('0xe')]())[_0x7f66('0x8')](faxQueue['getFaxQueues']())[_0x7f66('0x8')](realtime['initFaxQueues']())[_0x7f66('0x8')](whatsappQueue['getWhatsappQueues']())[_0x7f66('0x8')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x7f66('0xf')](realtime)[_0x7f66('0x8')](function(_0x3209a0){return initRealtime();})[_0x7f66('0x8')](function(_0x30fff5){return setInterval(initRealtime,0x1388);})[_0x7f66('0x10')](function(_0x487293){console[_0x7f66('0x11')](_0x487293);});}main(); \ No newline at end of file +var _0xaf5e=['./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','getAgents','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','bluebird'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xaf5e,0x1a8));var _0xeaf5=function(_0x15962d,_0x2e6625){_0x15962d=_0x15962d-0x0;var _0x4d6d92=_0xaf5e[_0x15962d];return _0x4d6d92;};'use strict';var BPromise=require(_0xeaf5('0x0'));var server=require(_0xeaf5('0x1'));var Realtime=require(_0xeaf5('0x2'));var user=require(_0xeaf5('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xeaf5('0x4'));var chatQueue=require(_0xeaf5('0x5'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xeaf5('0x6'));var faxQueue=require(_0xeaf5('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xeaf5('0x8')]()['then'](user[_0xeaf5('0x9')]())[_0xeaf5('0xa')](realtime[_0xeaf5('0xb')]())[_0xeaf5('0xa')](interval[_0xeaf5('0xc')]())[_0xeaf5('0xa')](realtime[_0xeaf5('0xd')]())[_0xeaf5('0xa')](openchannelQueue[_0xeaf5('0xe')]())[_0xeaf5('0xa')](realtime[_0xeaf5('0xf')]())['then'](chatQueue['getChatQueues']())[_0xeaf5('0xa')](realtime[_0xeaf5('0x10')]())[_0xeaf5('0xa')](smsQueue[_0xeaf5('0x11')]())[_0xeaf5('0xa')](realtime[_0xeaf5('0x12')]())[_0xeaf5('0xa')](mailQueue[_0xeaf5('0x13')]())['then'](realtime[_0xeaf5('0x14')]())['then'](faxQueue['getFaxQueues']())[_0xeaf5('0xa')](realtime[_0xeaf5('0x15')]())[_0xeaf5('0xa')](whatsappQueue[_0xeaf5('0x16')]())['then'](realtime[_0xeaf5('0x17')]())[_0xeaf5('0xa')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xeaf5('0xa')](function(_0x55687f){return initRealtime();})['then'](function(_0x4c8dda){return setInterval(initRealtime,0x1388);})[_0xeaf5('0x18')](function(_0x144f9c){console['log'](_0x144f9c);});}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 a41a420..d617631 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0xce2c01,_0x44872d){var _0x36b1ae=function(_0x37726f){while(--_0x37726f){_0xce2c01['push'](_0xce2c01['shift']());}};_0x36b1ae(++_0x44872d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x25e22f,_0x407b82){var _0x2b1351=function(_0x270262){while(--_0x270262){_0x25e22f['push'](_0x25e22f['shift']());}};_0x2b1351(++_0x407b82);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 52010dc..9fcdd9a 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 _0x1c95=['request','then','error','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x329f8d,_0x19fa11){var _0x15c43b=function(_0xc7024c){while(--_0xc7024c){_0x329f8d['push'](_0x329f8d['shift']());}};_0x15c43b(++_0x19fa11);}(_0x1c95,0x1ab));var _0x51c9=function(_0x1b600f,_0xb440ff){_0x1b600f=_0x1b600f-0x0;var _0x1fca54=_0x1c95[_0x1b600f];return _0x1fca54;};'use strict';var BPromise=require(_0x51c9('0x0'));var jayson=require(_0x51c9('0x1'));var client=jayson['client'][_0x51c9('0x2')]({'port':0x232b});function request(_0x4fe37f,_0x1ef561){return new BPromise(function(_0x5ec7c8,_0x593cd9){return client[_0x51c9('0x3')](_0x4fe37f,_0x1ef561)[_0x51c9('0x4')](function(_0x36bbe6){if(_0x36bbe6[_0x51c9('0x5')]){return _0x593cd9(_0x36bbe6[_0x51c9('0x5')]['message']);}else{return _0x5ec7c8(_0x36bbe6[_0x51c9('0x6')]);}})[_0x51c9('0x7')](function(_0x32a916){return _0x593cd9(_0x32a916);});});}exports[_0x51c9('0x8')]=function(_0x4f23df,_0x4eb343){return request(_0x51c9('0x9'),{'account':_0x4f23df,'message':_0x4eb343});}; \ No newline at end of file +var _0x8fde=['result','catch','SendMail','bluebird','jayson/promise','http','request','then','error','message'];(function(_0xbdf3dc,_0x1a16af){var _0x14b895=function(_0x6ff16b){while(--_0x6ff16b){_0xbdf3dc['push'](_0xbdf3dc['shift']());}};_0x14b895(++_0x1a16af);}(_0x8fde,0xfd));var _0xe8fd=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x8fde[_0x5c2e3e];return _0x53f64a;};'use strict';var BPromise=require(_0xe8fd('0x0'));var jayson=require(_0xe8fd('0x1'));var client=jayson['client'][_0xe8fd('0x2')]({'port':0x232b});function request(_0x2add88,_0xebe33f){return new BPromise(function(_0x19491e,_0x2279ca){return client[_0xe8fd('0x3')](_0x2add88,_0xebe33f)[_0xe8fd('0x4')](function(_0x1d1d1b){if(_0x1d1d1b[_0xe8fd('0x5')]){return _0x2279ca(_0x1d1d1b[_0xe8fd('0x5')][_0xe8fd('0x6')]);}else{return _0x19491e(_0x1d1d1b[_0xe8fd('0x7')]);}})[_0xe8fd('0x8')](function(_0x4d4a5c){return _0x2279ca(_0x4d4a5c);});});}exports['sendMailMessage']=function(_0x381da3,_0xf6cb38){return request(_0xe8fd('0x9'),{'account':_0x381da3,'message':_0xf6cb38});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 8787e4b..10d597a 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 _0xa8d7=['fax','sms','whatsapp','length','Status','StatusTime','toNumber','chatStatus','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelWaitingInteractions','stringify','user:save','exports','lodash','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','chat','openchannel'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa8d7,0xda));var _0x7a8d=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0xa8d7[_0x2b305c];return _0x5d8c85;};'use strict';var _=require(_0x7a8d('0x0'));var moment=require(_0x7a8d('0x1'));var md5=require(_0x7a8d('0x2'));var Redis=require('ioredis');var config=require(_0x7a8d('0x3'));config[_0x7a8d('0x4')]=_[_0x7a8d('0x5')](config[_0x7a8d('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x7a8d('0x6'))(new Redis(config['redis']));function Agent(_0x515d68){this['id']=_0x515d68['id']||0x0;this[_0x7a8d('0x7')]=_0x515d68['name']||'';this[_0x7a8d('0x8')]=_0x515d68[_0x7a8d('0x8')]||!![];this['voicePause']=_0x515d68[_0x7a8d('0x9')]||![];this[_0x7a8d('0xa')]=_0x515d68[_0x7a8d('0xa')]||![];this[_0x7a8d('0xb')]=_0x515d68['mailPause']||![];this[_0x7a8d('0xc')]=_0x515d68[_0x7a8d('0xc')]||![];this[_0x7a8d('0xd')]=_0x515d68[_0x7a8d('0xd')]||![];this[_0x7a8d('0xe')]=_0x515d68['openchannelPause']||![];this['chatStatus']=_0x7a8d('0xf');this[_0x7a8d('0x10')]=0x0;this[_0x7a8d('0x11')]=_0x515d68[_0x7a8d('0x11')]||0x0;this[_0x7a8d('0x12')]=0x0;this[_0x7a8d('0x13')]=_0x7a8d('0xf');this[_0x7a8d('0x14')]=0x0;this[_0x7a8d('0x15')]=_0x515d68[_0x7a8d('0x15')]||0x0;this[_0x7a8d('0x16')]=0x0;this[_0x7a8d('0x17')]=_0x7a8d('0xf');this[_0x7a8d('0x18')]=0x0;this[_0x7a8d('0x19')]=_0x515d68[_0x7a8d('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x7a8d('0x1a')]=_0x7a8d('0xf');this[_0x7a8d('0x1b')]=0x0;this['smsCapacity']=_0x515d68['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x7a8d('0x1c')]='unknown';this[_0x7a8d('0x1d')]=0x0;this['whatsappCapacity']=_0x515d68[_0x7a8d('0x1e')]||0x0;this[_0x7a8d('0x1f')]=0x0;this['openchannelStatus']=_0x7a8d('0xf');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x515d68[_0x7a8d('0x20')]||0x0;this[_0x7a8d('0x21')]=0x0;this[_0x7a8d('0x22')]=![];this[_0x7a8d('0x23')]=undefined;this[_0x7a8d('0x2')]='';this[_0x7a8d('0x24')]={};this[_0x7a8d('0x25')]={};this[_0x7a8d('0x26')]={};this['openchannelWaitingInteractions']={};this[_0x7a8d('0x27')]={};this[_0x7a8d('0x28')]={};this[_0x7a8d('0x29')]();}Agent[_0x7a8d('0x2a')][_0x7a8d('0x2b')]=function(_0x5dc52c){if(this[_0x5dc52c+_0x7a8d('0x2c')]>0x0){if(this[_0x5dc52c+'Capacity']>0x0&&this[_0x5dc52c+_0x7a8d('0x2c')]>=this[_0x5dc52c+_0x7a8d('0x2d')]){return _0x7a8d('0x2e');}else{return _0x7a8d('0x2f');}}else{return'idle';}};Agent[_0x7a8d('0x2a')][_0x7a8d('0x29')]=function(){var _0xa84039=['mail',_0x7a8d('0x30'),_0x7a8d('0x31'),_0x7a8d('0x32'),_0x7a8d('0x33'),_0x7a8d('0x34')];for(var _0x332bc8=0x0;_0x332bc8<_0xa84039[_0x7a8d('0x35')];_0x332bc8+=0x1){var _0x50a235=this[_0x7a8d('0x2b')](_0xa84039[_0x332bc8]);if(this[_0xa84039[_0x332bc8]+_0x7a8d('0x36')]!==_0x50a235){this[_0xa84039[_0x332bc8]+_0x7a8d('0x37')]=_[_0x7a8d('0x38')](moment()['format']('x'));}this[_0xa84039[_0x332bc8]+_0x7a8d('0x36')]=_0x50a235;}var _0x5061ad={'id':this['id'],'name':this[_0x7a8d('0x7')],'online':this[_0x7a8d('0x8')],'voicePause':this[_0x7a8d('0x9')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0x7a8d('0xd')],'faxPause':this[_0x7a8d('0xc')],'openchannelPause':this[_0x7a8d('0xe')],'chatStatus':this[_0x7a8d('0x39')],'chatStatusTime':this[_0x7a8d('0x10')],'chatCapacity':this[_0x7a8d('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x7a8d('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x7a8d('0x15')],'mailCurrentCapacity':this[_0x7a8d('0x16')],'faxStatus':this[_0x7a8d('0x17')],'faxStatusTime':this[_0x7a8d('0x18')],'faxCapacity':this[_0x7a8d('0x19')],'faxCurrentCapacity':this[_0x7a8d('0x3a')],'smsStatus':this[_0x7a8d('0x1a')],'smsStatusTime':this[_0x7a8d('0x1b')],'smsCapacity':this[_0x7a8d('0x3b')],'smsCurrentCapacity':this[_0x7a8d('0x3c')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7a8d('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x7a8d('0x3d')],'openchannelStatusTime':this[_0x7a8d('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x7a8d('0x23')],'chatWaitingInteractions':this[_0x7a8d('0x24')],'faxWaitingInteractions':this[_0x7a8d('0x25')],'mailWaitingInteractions':this[_0x7a8d('0x26')],'openchannelWaitingInteractions':this[_0x7a8d('0x3f')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x26c467=md5(JSON[_0x7a8d('0x40')](_0x5061ad));if(this[_0x7a8d('0x2')]!==_0x26c467){this[_0x7a8d('0x2')]=_0x26c467;io['emit'](_0x7a8d('0x41'),_0x5061ad);}};module[_0x7a8d('0x42')]=Agent; \ No newline at end of file +var _0x0072=['localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busyQueue','md5','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','chatCurrentCapacity','faxCurrentCapacity','whatsappStatus','openchannelStatus','busy','smsWaitingInteractions','stringify','emit','user:save','exports','lodash','moment','ioredis','redis'];(function(_0x30f101,_0x2c5d67){var _0xf9d748=function(_0x48feba){while(--_0x48feba){_0x30f101['push'](_0x30f101['shift']());}};_0xf9d748(++_0x2c5d67);}(_0x0072,0x7c));var _0x2007=function(_0x86eb44,_0x1960f3){_0x86eb44=_0x86eb44-0x0;var _0x1f070b=_0x0072[_0x86eb44];return _0x1f070b;};'use strict';var _=require(_0x2007('0x0'));var moment=require(_0x2007('0x1'));var md5=require('md5');var Redis=require(_0x2007('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x2007('0x3')],{'host':_0x2007('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2007('0x3')]));function Agent(_0x304340){this['id']=_0x304340['id']||0x0;this[_0x2007('0x5')]=_0x304340['name']||'';this[_0x2007('0x6')]=_0x304340[_0x2007('0x6')]||!![];this[_0x2007('0x7')]=_0x304340[_0x2007('0x7')]||![];this[_0x2007('0x8')]=_0x304340[_0x2007('0x8')]||![];this[_0x2007('0x9')]=_0x304340['mailPause']||![];this[_0x2007('0xa')]=_0x304340[_0x2007('0xa')]||![];this['smsPause']=_0x304340[_0x2007('0xb')]||![];this['openchannelPause']=_0x304340[_0x2007('0xc')]||![];this[_0x2007('0xd')]=_0x2007('0xe');this[_0x2007('0xf')]=0x0;this[_0x2007('0x10')]=_0x304340['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x2007('0xe');this[_0x2007('0x11')]=0x0;this[_0x2007('0x12')]=_0x304340[_0x2007('0x12')]||0x0;this[_0x2007('0x13')]=0x0;this[_0x2007('0x14')]=_0x2007('0xe');this[_0x2007('0x15')]=0x0;this[_0x2007('0x16')]=_0x304340['faxCapacity']||0x0;this['faxCurrentCapacity']=0x0;this[_0x2007('0x17')]=_0x2007('0xe');this[_0x2007('0x18')]=0x0;this[_0x2007('0x19')]=_0x304340[_0x2007('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']='unknown';this[_0x2007('0x1a')]=0x0;this['whatsappCapacity']=_0x304340[_0x2007('0x1b')]||0x0;this[_0x2007('0x1c')]=0x0;this['openchannelStatus']=_0x2007('0xe');this['openchannelStatusTime']=0x0;this[_0x2007('0x1d')]=_0x304340[_0x2007('0x1d')]||0x0;this[_0x2007('0x1e')]=0x0;this['busy']=![];this[_0x2007('0x1f')]=undefined;this[_0x2007('0x20')]='';this[_0x2007('0x21')]={};this[_0x2007('0x22')]={};this[_0x2007('0x23')]={};this[_0x2007('0x24')]={};this['smsWaitingInteractions']={};this[_0x2007('0x25')]={};this[_0x2007('0x26')]();}Agent[_0x2007('0x27')][_0x2007('0x28')]=function(_0x456723){if(this[_0x456723+_0x2007('0x29')]>0x0){if(this[_0x456723+_0x2007('0x2a')]>0x0&&this[_0x456723+_0x2007('0x29')]>=this[_0x456723+_0x2007('0x2a')]){return _0x2007('0x2b');}else{return _0x2007('0x2c');}}else{return'idle';}};Agent[_0x2007('0x27')][_0x2007('0x26')]=function(){var _0x158c38=[_0x2007('0x2d'),_0x2007('0x2e'),_0x2007('0x2f'),_0x2007('0x30'),_0x2007('0x31'),_0x2007('0x32')];for(var _0x214ed2=0x0;_0x214ed2<_0x158c38[_0x2007('0x33')];_0x214ed2+=0x1){var _0x4de50c=this[_0x2007('0x28')](_0x158c38[_0x214ed2]);if(this[_0x158c38[_0x214ed2]+_0x2007('0x34')]!==_0x4de50c){this[_0x158c38[_0x214ed2]+'StatusTime']=_[_0x2007('0x35')](moment()['format']('x'));}this[_0x158c38[_0x214ed2]+_0x2007('0x34')]=_0x4de50c;}var _0x357d70={'id':this['id'],'name':this[_0x2007('0x5')],'online':this['online'],'voicePause':this[_0x2007('0x7')],'chatPause':this[_0x2007('0x8')],'mailPause':this[_0x2007('0x9')],'smsPause':this['smsPause'],'faxPause':this[_0x2007('0xa')],'openchannelPause':this[_0x2007('0xc')],'chatStatus':this[_0x2007('0xd')],'chatStatusTime':this[_0x2007('0xf')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0x2007('0x36')],'mailStatus':this['mailStatus'],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2007('0x12')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x2007('0x16')],'faxCurrentCapacity':this[_0x2007('0x37')],'smsStatus':this[_0x2007('0x17')],'smsStatusTime':this[_0x2007('0x18')],'smsCapacity':this[_0x2007('0x19')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x2007('0x38')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x2007('0x1b')],'whatsappCurrentCapacity':this[_0x2007('0x1c')],'openchannelStatus':this[_0x2007('0x39')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x2007('0x1d')],'openchannelCurrentCapacity':this[_0x2007('0x1e')],'busy':this[_0x2007('0x3a')],'busyQueue':this[_0x2007('0x1f')],'chatWaitingInteractions':this[_0x2007('0x21')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x2007('0x23')],'openchannelWaitingInteractions':this[_0x2007('0x24')],'smsWaitingInteractions':this[_0x2007('0x3b')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x32f3d4=md5(JSON[_0x2007('0x3c')](_0x357d70));if(this['md5']!==_0x32f3d4){this['md5']=_0x32f3d4;io[_0x2007('0x3d')](_0x2007('0x3e'),_0x357d70);}};module[_0x2007('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 5d2634a..2186dc7 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 _0x62fc=['paused','length','online','chatPause','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x62fc,0x1e6));var _0xc62f=function(_0x1d2371,_0x666740){_0x1d2371=_0x1d2371-0x0;var _0x5d3f47=_0x62fc[_0x1d2371];return _0x5d3f47;};'use strict';var _=require(_0xc62f('0x0'));var md5=require(_0xc62f('0x1'));var util=require('util');var Redis=require(_0xc62f('0x2'));var config=require('../../../config/environment');config[_0xc62f('0x3')]=_['defaults'](config[_0xc62f('0x3')],{'host':_0xc62f('0x4'),'port':0x18eb});var io=require(_0xc62f('0x5'))(new Redis(config['redis']));function ChatQueue(_0x159cd1){this['id']=_0x159cd1['id']||0x0;this['name']=_0x159cd1[_0xc62f('0x6')]||'';this[_0xc62f('0x7')]=_0x159cd1['timeout']||0xa;this[_0xc62f('0x8')]=_0x159cd1[_0xc62f('0x8')]||'beepall';this[_0xc62f('0x9')]=_0x159cd1['Agents'];this[_0xc62f('0xa')]={};this[_0xc62f('0xb')]=0x0;this['md5']='';this[_0xc62f('0xc')]();this[_0xc62f('0xd')]();}ChatQueue[_0xc62f('0xe')][_0xc62f('0xc')]=function(){var _0x480537=this[_0xc62f('0xa')][_0xc62f('0xf')];this[_0xc62f('0xa')]=_[_0xc62f('0x10')](this[_0xc62f('0x9')],'id');this[_0xc62f('0xa')]['_rr']=_0x480537;};ChatQueue[_0xc62f('0xe')][_0xc62f('0xd')]=function(){this[_0xc62f('0x11')]=0x0;this[_0xc62f('0x12')]=0x0;for(var _0x20f271=0x0;_0x20f271=0x0?this[_0xc62f('0x16')]:0x0;var _0x5b2cf6={'id':this['id'],'available':this[_0xc62f('0x16')],'loggedIn':this[_0xc62f('0x11')],'name':this[_0xc62f('0x6')],'paused':this[_0xc62f('0x12')],'waiting':this[_0xc62f('0xb')]};var _0x46fd4f=md5(JSON[_0xc62f('0x17')](_0x5b2cf6));if(this['md5']!==_0x46fd4f){this[_0xc62f('0x1')]=_0x46fd4f;io['to'](util[_0xc62f('0x18')](_0xc62f('0x19'),_0x5b2cf6['name']))['emit'](_0xc62f('0x1a'),_0x5b2cf6);}};module[_0xc62f('0x1b')]=ChatQueue; \ No newline at end of file +var _0x0cc4=['strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout'];(function(_0x5499ab,_0x4c1128){var _0x344478=function(_0x5d767e){while(--_0x5d767e){_0x5499ab['push'](_0x5499ab['shift']());}};_0x344478(++_0x4c1128);}(_0x0cc4,0x19b));var _0x40cc=function(_0x9861ff,_0x41fb17){_0x9861ff=_0x9861ff-0x0;var _0x48852b=_0x0cc4[_0x9861ff];return _0x48852b;};'use strict';var _=require(_0x40cc('0x0'));var md5=require(_0x40cc('0x1'));var util=require(_0x40cc('0x2'));var Redis=require(_0x40cc('0x3'));var config=require(_0x40cc('0x4'));config[_0x40cc('0x5')]=_['defaults'](config[_0x40cc('0x5')],{'host':_0x40cc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x31e564){this['id']=_0x31e564['id']||0x0;this[_0x40cc('0x7')]=_0x31e564[_0x40cc('0x7')]||'';this[_0x40cc('0x8')]=_0x31e564[_0x40cc('0x8')]||0xa;this[_0x40cc('0x9')]=_0x31e564[_0x40cc('0x9')]||_0x40cc('0xa');this['Agents']=_0x31e564[_0x40cc('0xb')];this[_0x40cc('0xc')]={};this[_0x40cc('0xd')]=0x0;this['md5']='';this['updateRouting']();this[_0x40cc('0xe')]();}ChatQueue[_0x40cc('0xf')]['updateRouting']=function(){var _0x3441b7=this[_0x40cc('0xc')][_0x40cc('0x10')];this[_0x40cc('0xc')]=_[_0x40cc('0x11')](this[_0x40cc('0xb')],'id');this[_0x40cc('0xc')][_0x40cc('0x10')]=_0x3441b7;};ChatQueue[_0x40cc('0xf')][_0x40cc('0xe')]=function(){this[_0x40cc('0x12')]=0x0;this[_0x40cc('0x13')]=0x0;for(var _0xb2cae1=0x0;_0xb2cae1=0x0?this[_0x40cc('0x17')]:0x0;var _0x46e36e={'id':this['id'],'available':this[_0x40cc('0x17')],'loggedIn':this[_0x40cc('0x12')],'name':this[_0x40cc('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x230d8f=md5(JSON[_0x40cc('0x18')](_0x46e36e));if(this['md5']!==_0x230d8f){this[_0x40cc('0x1')]=_0x230d8f;io['to'](util[_0x40cc('0x19')](_0x40cc('0x1a'),_0x46e36e[_0x40cc('0x7')]))[_0x40cc('0x1b')](_0x40cc('0x1c'),_0x46e36e);}};module[_0x40cc('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 27e98e0..fd0dc28 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 _0xfc20=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x29d6d9,_0x5c3cbb){var _0x24f7d9=function(_0x593c94){while(--_0x593c94){_0x29d6d9['push'](_0x29d6d9['shift']());}};_0x24f7d9(++_0x5c3cbb);}(_0xfc20,0xe3));var _0x0fc2=function(_0x31f2d1,_0x50083e){_0x31f2d1=_0x31f2d1-0x0;var _0x38f2bd=_0xfc20[_0x31f2d1];return _0x38f2bd;};'use strict';var _=require('lodash');var md5=require(_0x0fc2('0x0'));var util=require(_0x0fc2('0x1'));var Redis=require(_0x0fc2('0x2'));var config=require(_0x0fc2('0x3'));config['redis']=_[_0x0fc2('0x4')](config[_0x0fc2('0x5')],{'host':_0x0fc2('0x6'),'port':0x18eb});var io=require(_0x0fc2('0x7'))(new Redis(config[_0x0fc2('0x5')]));function FaxQueue(_0x229e6e){this['id']=_0x229e6e['id']||0x0;this[_0x0fc2('0x8')]=_0x229e6e[_0x0fc2('0x8')]||'';this[_0x0fc2('0x9')]=_0x229e6e[_0x0fc2('0x9')]||0xa;this['strategy']=_0x229e6e[_0x0fc2('0xa')]||_0x0fc2('0xb');this['Agents']=_0x229e6e[_0x0fc2('0xc')];this[_0x0fc2('0xd')]={};this[_0x0fc2('0xe')]=0x0;this[_0x0fc2('0x0')]='';this[_0x0fc2('0xf')]();this[_0x0fc2('0x10')]();}FaxQueue[_0x0fc2('0x11')]['updateRouting']=function(){var _0x9dc211=this[_0x0fc2('0xd')][_0x0fc2('0x12')];this[_0x0fc2('0xd')]=_[_0x0fc2('0x13')](this['Agents'],'id');this[_0x0fc2('0xd')][_0x0fc2('0x12')]=_0x9dc211;};FaxQueue[_0x0fc2('0x11')][_0x0fc2('0x10')]=function(){this[_0x0fc2('0x14')]=0x0;this[_0x0fc2('0x15')]=0x0;for(var _0x62218a=0x0;_0x62218a=0x0?this[_0x0fc2('0x17')]:0x0;var _0xe474ec={'id':this['id'],'available':this[_0x0fc2('0x17')],'loggedIn':this[_0x0fc2('0x14')],'name':this[_0x0fc2('0x8')],'paused':this[_0x0fc2('0x15')],'waiting':this[_0x0fc2('0xe')]};var _0x3cd8b3=md5(JSON[_0x0fc2('0x18')](_0xe474ec));if(this[_0x0fc2('0x0')]!==_0x3cd8b3){this[_0x0fc2('0x0')]=_0x3cd8b3;io['to'](util[_0x0fc2('0x19')](_0x0fc2('0x1a'),_0xe474ec[_0x0fc2('0x8')]))[_0x0fc2('0x1b')](_0x0fc2('0x1c'),_0xe474ec);}};module[_0x0fc2('0x1d')]=FaxQueue; \ No newline at end of file +var _0xc2b9=['fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','strategy','mapAgentsId','waiting','updateRouting','_rr','map','Agents','prototype','updateRealtime','loggedIn','length','faxPause','paused','available','stringify','format'];(function(_0x35d775,_0x25431e){var _0x59384d=function(_0x1a0c15){while(--_0x1a0c15){_0x35d775['push'](_0x35d775['shift']());}};_0x59384d(++_0x25431e);}(_0xc2b9,0x170));var _0x9c2b=function(_0x622352,_0x22ca0a){_0x622352=_0x622352-0x0;var _0x31dd87=_0xc2b9[_0x622352];return _0x31dd87;};'use strict';var _=require(_0x9c2b('0x0'));var md5=require(_0x9c2b('0x1'));var util=require(_0x9c2b('0x2'));var Redis=require('ioredis');var config=require(_0x9c2b('0x3'));config[_0x9c2b('0x4')]=_[_0x9c2b('0x5')](config[_0x9c2b('0x4')],{'host':_0x9c2b('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9c2b('0x4')]));function FaxQueue(_0x2fa3a3){this['id']=_0x2fa3a3['id']||0x0;this[_0x9c2b('0x7')]=_0x2fa3a3[_0x9c2b('0x7')]||'';this['timeout']=_0x2fa3a3['timeout']||0xa;this[_0x9c2b('0x8')]=_0x2fa3a3['strategy']||'beepall';this['Agents']=_0x2fa3a3['Agents'];this[_0x9c2b('0x9')]={};this[_0x9c2b('0xa')]=0x0;this['md5']='';this[_0x9c2b('0xb')]();this['updateRealtime']();}FaxQueue['prototype'][_0x9c2b('0xb')]=function(){var _0x289048=this[_0x9c2b('0x9')][_0x9c2b('0xc')];this['mapAgentsId']=_[_0x9c2b('0xd')](this[_0x9c2b('0xe')],'id');this['mapAgentsId']['_rr']=_0x289048;};FaxQueue[_0x9c2b('0xf')][_0x9c2b('0x10')]=function(){this[_0x9c2b('0x11')]=0x0;this['paused']=0x0;for(var _0x4a171b=0x0;_0x4a171b=0x0?this[_0x9c2b('0x15')]:0x0;var _0x31000f={'id':this['id'],'available':this[_0x9c2b('0x15')],'loggedIn':this[_0x9c2b('0x11')],'name':this[_0x9c2b('0x7')],'paused':this[_0x9c2b('0x14')],'waiting':this[_0x9c2b('0xa')]};var _0xa50f59=md5(JSON[_0x9c2b('0x16')](_0x31000f));if(this[_0x9c2b('0x1')]!==_0xa50f59){this['md5']=_0xa50f59;io['to'](util[_0x9c2b('0x17')](_0x9c2b('0x18'),_0x31000f[_0x9c2b('0x7')]))[_0x9c2b('0x19')](_0x9c2b('0x1a'),_0x31000f);}};module[_0x9c2b('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 68db457..a71c6ba 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 _0xb0e5=['name','Intervals'];(function(_0x4c29e2,_0xba783a){var _0x50eb50=function(_0xb60fa1){while(--_0xb60fa1){_0x4c29e2['push'](_0x4c29e2['shift']());}};_0x50eb50(++_0xba783a);}(_0xb0e5,0x182));var _0x5b0e=function(_0x83487c,_0x1104d8){_0x83487c=_0x83487c-0x0;var _0x25ce18=_0xb0e5[_0x83487c];return _0x25ce18;};'use strict';function Interval(_0x582c51){this['id']=_0x582c51['id']||0x0;this[_0x5b0e('0x0')]=_0x582c51[_0x5b0e('0x0')]||'';this['Intervals']=_0x582c51[_0x5b0e('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xe919=['Intervals','name'];(function(_0x16b584,_0x1166a8){var _0x2e4b6e=function(_0x24cbc6){while(--_0x24cbc6){_0x16b584['push'](_0x16b584['shift']());}};_0x2e4b6e(++_0x1166a8);}(_0xe919,0x1a1));var _0x9e91=function(_0x5caabb,_0x2b0cc1){_0x5caabb=_0x5caabb-0x0;var _0x2929d8=_0xe919[_0x5caabb];return _0x2929d8;};'use strict';function Interval(_0x3078e6){this['id']=_0x3078e6['id']||0x0;this[_0x9e91('0x0')]=_0x3078e6[_0x9e91('0x0')]||'';this[_0x9e91('0x1')]=_0x3078e6[_0x9e91('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index e0545df..d4f113c 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 _0x4ad9=['Agents','mapAgentsId','updateRouting','prototype','_rr','map','length','online','loggedIn','mailPause','available','paused','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ad9,0x117));var _0x94ad=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4ad9[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x94ad('0x0'));var md5=require(_0x94ad('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x94ad('0x2'));config[_0x94ad('0x3')]=_[_0x94ad('0x4')](config[_0x94ad('0x3')],{'host':_0x94ad('0x5'),'port':0x18eb});var io=require(_0x94ad('0x6'))(new Redis(config[_0x94ad('0x3')]));function MailQueue(_0x12d25b){this['id']=_0x12d25b['id']||0x0;this['name']=_0x12d25b[_0x94ad('0x7')]||'';this[_0x94ad('0x8')]=_0x12d25b[_0x94ad('0x8')]||0xa;this[_0x94ad('0x9')]=_0x12d25b[_0x94ad('0x9')]||_0x94ad('0xa');this[_0x94ad('0xb')]=_0x12d25b[_0x94ad('0xb')];this[_0x94ad('0xc')]={};this['waiting']=0x0;this[_0x94ad('0x1')]='';this[_0x94ad('0xd')]();this['updateRealtime']();}MailQueue[_0x94ad('0xe')]['updateRouting']=function(){var _0x2a02ba=this[_0x94ad('0xc')][_0x94ad('0xf')];this[_0x94ad('0xc')]=_[_0x94ad('0x10')](this['Agents'],'id');this[_0x94ad('0xc')][_0x94ad('0xf')]=_0x2a02ba;};MailQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x24c025=0x0;_0x24c025=0x0?this[_0x94ad('0x15')]:0x0;var _0x13be3b={'id':this['id'],'available':this[_0x94ad('0x15')],'loggedIn':this['loggedIn'],'name':this[_0x94ad('0x7')],'paused':this[_0x94ad('0x16')],'waiting':this['waiting']};var _0x162e4b=md5(JSON[_0x94ad('0x17')](_0x13be3b));if(this[_0x94ad('0x1')]!==_0x162e4b){this[_0x94ad('0x1')]=_0x162e4b;io['to'](util[_0x94ad('0x18')](_0x94ad('0x19'),_0x13be3b[_0x94ad('0x7')]))[_0x94ad('0x1a')](_0x94ad('0x1b'),_0x13be3b);}};module[_0x94ad('0x1c')]=MailQueue; \ No newline at end of file +var _0x7054=['paused','format','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','mailPause','available'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7054,0x161));var _0x4705=function(_0x44c801,_0x5ad314){_0x44c801=_0x44c801-0x0;var _0x3f3468=_0x7054[_0x44c801];return _0x3f3468;};'use strict';var _=require(_0x4705('0x0'));var md5=require(_0x4705('0x1'));var util=require(_0x4705('0x2'));var Redis=require('ioredis');var config=require(_0x4705('0x3'));config[_0x4705('0x4')]=_[_0x4705('0x5')](config[_0x4705('0x4')],{'host':_0x4705('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4705('0x4')]));function MailQueue(_0x3712ad){this['id']=_0x3712ad['id']||0x0;this[_0x4705('0x7')]=_0x3712ad[_0x4705('0x7')]||'';this[_0x4705('0x8')]=_0x3712ad['timeout']||0xa;this['strategy']=_0x3712ad[_0x4705('0x9')]||_0x4705('0xa');this[_0x4705('0xb')]=_0x3712ad[_0x4705('0xb')];this[_0x4705('0xc')]={};this[_0x4705('0xd')]=0x0;this[_0x4705('0x1')]='';this[_0x4705('0xe')]();this[_0x4705('0xf')]();}MailQueue[_0x4705('0x10')][_0x4705('0xe')]=function(){var _0x5e1885=this[_0x4705('0xc')][_0x4705('0x11')];this[_0x4705('0xc')]=_[_0x4705('0x12')](this[_0x4705('0xb')],'id');this[_0x4705('0xc')][_0x4705('0x11')]=_0x5e1885;};MailQueue[_0x4705('0x10')]['updateRealtime']=function(){this[_0x4705('0x13')]=0x0;this['paused']=0x0;for(var _0xea0cec=0x0;_0xea0cec=0x0?this[_0x4705('0x17')]:0x0;var _0x54792e={'id':this['id'],'available':this[_0x4705('0x17')],'loggedIn':this[_0x4705('0x13')],'name':this[_0x4705('0x7')],'paused':this[_0x4705('0x18')],'waiting':this[_0x4705('0xd')]};var _0xee7335=md5(JSON['stringify'](_0x54792e));if(this[_0x4705('0x1')]!==_0xee7335){this['md5']=_0xee7335;io['to'](util[_0x4705('0x19')]('mail:queue:%s',_0x54792e[_0x4705('0x7')]))[_0x4705('0x1a')](_0x4705('0x1b'),_0x54792e);}};module[_0x4705('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index ca4569c..a7c4c92 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 _0xadb5=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','paused','loggedIn','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','md5','ioredis'];(function(_0x256cc1,_0x568424){var _0x330d0a=function(_0x4c8cc1){while(--_0x4c8cc1){_0x256cc1['push'](_0x256cc1['shift']());}};_0x330d0a(++_0x568424);}(_0xadb5,0xad));var _0x5adb=function(_0x3d7927,_0x5ab5ad){_0x3d7927=_0x3d7927-0x0;var _0x4ae48d=_0xadb5[_0x3d7927];return _0x4ae48d;};'use strict';var _=require('lodash');var md5=require(_0x5adb('0x0'));var util=require('util');var Redis=require(_0x5adb('0x1'));var config=require(_0x5adb('0x2'));config[_0x5adb('0x3')]=_['defaults'](config[_0x5adb('0x3')],{'host':_0x5adb('0x4'),'port':0x18eb});var io=require(_0x5adb('0x5'))(new Redis(config['redis']));function OpenchannelQueue(_0x35a5d3){this['id']=_0x35a5d3['id']||0x0;this[_0x5adb('0x6')]=_0x35a5d3[_0x5adb('0x6')]||'';this[_0x5adb('0x7')]=_0x35a5d3[_0x5adb('0x7')]||0xa;this[_0x5adb('0x8')]=_0x35a5d3[_0x5adb('0x8')]||_0x5adb('0x9');this[_0x5adb('0xa')]=_0x35a5d3[_0x5adb('0xa')];this[_0x5adb('0xb')]={};this[_0x5adb('0xc')]=0x0;this[_0x5adb('0x0')]='';this[_0x5adb('0xd')]();this['updateRealtime']();}OpenchannelQueue['prototype'][_0x5adb('0xd')]=function(){var _0x1ea238=this[_0x5adb('0xb')]['_rr'];this[_0x5adb('0xb')]=_['map'](this[_0x5adb('0xa')],'id');this['mapAgentsId'][_0x5adb('0xe')]=_0x1ea238;};OpenchannelQueue[_0x5adb('0xf')][_0x5adb('0x10')]=function(){this['loggedIn']=0x0;this[_0x5adb('0x11')]=0x0;for(var _0x34af2c=0x0;_0x34af2c=0x0?this['available']:0x0;var _0x3fff62={'id':this['id'],'available':this['available'],'loggedIn':this[_0x5adb('0x12')],'name':this['name'],'paused':this[_0x5adb('0x11')],'waiting':this['waiting']};var _0x5e218c=md5(JSON[_0x5adb('0x15')](_0x3fff62));if(this[_0x5adb('0x0')]!==_0x5e218c){this[_0x5adb('0x0')]=_0x5e218c;io['to'](util[_0x5adb('0x16')](_0x5adb('0x17'),_0x3fff62['name']))[_0x5adb('0x18')]('openchannel_queue:save',_0x3fff62);}};module['exports']=OpenchannelQueue; \ No newline at end of file +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(_0x386b08,_0x5d49da){var _0x4b38ef=function(_0x197a15){while(--_0x197a15){_0x386b08['push'](_0x386b08['shift']());}};_0x4b38ef(++_0x5d49da);}(_0x5fc3,0xa8));var _0x35fc=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x5fc3[_0x4704dc];return _0x254d81;};'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 diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 012e378..7cbb32f 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 _0x8a55=['updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0xc08f4,_0x32c956){var _0x2c84b3=function(_0x3622f3){while(--_0x3622f3){_0xc08f4['push'](_0xc08f4['shift']());}};_0x2c84b3(++_0x32c956);}(_0x8a55,0x185));var _0x58a5=function(_0x11c0e6,_0x53741d){_0x11c0e6=_0x11c0e6-0x0;var _0x527ffb=_0x8a55[_0x11c0e6];return _0x527ffb;};'use strict';var _=require(_0x58a5('0x0'));var md5=require(_0x58a5('0x1'));var util=require(_0x58a5('0x2'));var Redis=require(_0x58a5('0x3'));var config=require(_0x58a5('0x4'));config[_0x58a5('0x5')]=_[_0x58a5('0x6')](config[_0x58a5('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x58a5('0x7'))(new Redis(config[_0x58a5('0x5')]));function SmsQueue(_0x4e2752){this['id']=_0x4e2752['id']||0x0;this[_0x58a5('0x8')]=_0x4e2752[_0x58a5('0x8')]||'';this[_0x58a5('0x9')]=_0x4e2752[_0x58a5('0x9')]||0xa;this[_0x58a5('0xa')]=_0x4e2752[_0x58a5('0xa')]||'beepall';this[_0x58a5('0xb')]=_0x4e2752[_0x58a5('0xb')];this[_0x58a5('0xc')]={};this[_0x58a5('0xd')]=0x0;this[_0x58a5('0x1')]='';this[_0x58a5('0xe')]();this[_0x58a5('0xf')]();}SmsQueue[_0x58a5('0x10')][_0x58a5('0xe')]=function(){var _0x2f6bd9=this[_0x58a5('0xc')][_0x58a5('0x11')];this[_0x58a5('0xc')]=_[_0x58a5('0x12')](this['Agents'],'id');this[_0x58a5('0xc')][_0x58a5('0x11')]=_0x2f6bd9;};SmsQueue[_0x58a5('0x10')][_0x58a5('0xf')]=function(){this[_0x58a5('0x13')]=0x0;this['paused']=0x0;for(var _0x504295=0x0;_0x504295=0x0?this[_0x58a5('0x18')]:0x0;var _0x59c170={'id':this['id'],'available':this['available'],'loggedIn':this[_0x58a5('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x12abb2=md5(JSON[_0x58a5('0x19')](_0x59c170));if(this['md5']!==_0x12abb2){this[_0x58a5('0x1')]=_0x12abb2;io['to'](util[_0x58a5('0x1a')](_0x58a5('0x1b'),_0x59c170['name']))[_0x58a5('0x1c')](_0x58a5('0x1d'),_0x59c170);}};module[_0x58a5('0x1e')]=SmsQueue; \ No newline at end of file +var _0xfa2f=['loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','_rr','map','prototype','length','online'];(function(_0xa8369e,_0x4f06d8){var _0x4d68c5=function(_0x5ee1ef){while(--_0x5ee1ef){_0xa8369e['push'](_0xa8369e['shift']());}};_0x4d68c5(++_0x4f06d8);}(_0xfa2f,0xe8));var _0xffa2=function(_0x15d4ad,_0x16ebe1){_0x15d4ad=_0x15d4ad-0x0;var _0x602d4c=_0xfa2f[_0x15d4ad];return _0x602d4c;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xffa2('0x0'));var Redis=require('ioredis');var config=require(_0xffa2('0x1'));config[_0xffa2('0x2')]=_[_0xffa2('0x3')](config['redis'],{'host':_0xffa2('0x4'),'port':0x18eb});var io=require(_0xffa2('0x5'))(new Redis(config[_0xffa2('0x2')]));function SmsQueue(_0x14787c){this['id']=_0x14787c['id']||0x0;this[_0xffa2('0x6')]=_0x14787c[_0xffa2('0x6')]||'';this[_0xffa2('0x7')]=_0x14787c['timeout']||0xa;this['strategy']=_0x14787c[_0xffa2('0x8')]||_0xffa2('0x9');this[_0xffa2('0xa')]=_0x14787c[_0xffa2('0xa')];this[_0xffa2('0xb')]={};this[_0xffa2('0xc')]=0x0;this[_0xffa2('0xd')]='';this['updateRouting']();this[_0xffa2('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x2eb5bb=this[_0xffa2('0xb')][_0xffa2('0xf')];this[_0xffa2('0xb')]=_[_0xffa2('0x10')](this['Agents'],'id');this[_0xffa2('0xb')][_0xffa2('0xf')]=_0x2eb5bb;};SmsQueue[_0xffa2('0x11')][_0xffa2('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32e54e=0x0;_0x32e54e=0x0?this[_0xffa2('0x17')]:0x0;var _0x2ae03f={'id':this['id'],'available':this[_0xffa2('0x17')],'loggedIn':this[_0xffa2('0x14')],'name':this[_0xffa2('0x6')],'paused':this[_0xffa2('0x16')],'waiting':this[_0xffa2('0xc')]};var _0xc10cfb=md5(JSON[_0xffa2('0x18')](_0x2ae03f));if(this[_0xffa2('0xd')]!==_0xc10cfb){this['md5']=_0xc10cfb;io['to'](util[_0xffa2('0x19')](_0xffa2('0x1a'),_0x2ae03f[_0xffa2('0x6')]))['emit'](_0xffa2('0x1b'),_0x2ae03f);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 6b0b10c..6d68599 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 _0xc837=['updateRouting','updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','whatsappPause','available','stringify','format','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0xbab353,_0x37e159){var _0x56871e=function(_0x474f77){while(--_0x474f77){_0xbab353['push'](_0xbab353['shift']());}};_0x56871e(++_0x37e159);}(_0xc837,0xe2));var _0x7c83=function(_0x4bc08a,_0x58660d){_0x4bc08a=_0x4bc08a-0x0;var _0x3ee179=_0xc837[_0x4bc08a];return _0x3ee179;};'use strict';var _=require('lodash');var md5=require(_0x7c83('0x0'));var util=require(_0x7c83('0x1'));var Redis=require(_0x7c83('0x2'));var config=require(_0x7c83('0x3'));config[_0x7c83('0x4')]=_[_0x7c83('0x5')](config[_0x7c83('0x4')],{'host':_0x7c83('0x6'),'port':0x18eb});var io=require(_0x7c83('0x7'))(new Redis(config[_0x7c83('0x4')]));function WhatsappQueue(_0x107bf6){this['id']=_0x107bf6['id']||0x0;this[_0x7c83('0x8')]=_0x107bf6[_0x7c83('0x8')]||'';this['timeout']=_0x107bf6[_0x7c83('0x9')]||0xa;this[_0x7c83('0xa')]=_0x107bf6[_0x7c83('0xa')]||_0x7c83('0xb');this[_0x7c83('0xc')]=_0x107bf6[_0x7c83('0xc')];this[_0x7c83('0xd')]={};this['waiting']=0x0;this['md5']='';this[_0x7c83('0xe')]();this[_0x7c83('0xf')]();}WhatsappQueue[_0x7c83('0x10')][_0x7c83('0xe')]=function(){var _0x52d9ac=this[_0x7c83('0xd')][_0x7c83('0x11')];this[_0x7c83('0xd')]=_[_0x7c83('0x12')](this[_0x7c83('0xc')],'id');this[_0x7c83('0xd')][_0x7c83('0x11')]=_0x52d9ac;};WhatsappQueue[_0x7c83('0x10')][_0x7c83('0xf')]=function(){this['loggedIn']=0x0;this[_0x7c83('0x13')]=0x0;for(var _0x12887e=0x0;_0x12887e=0x0?this['available']:0x0;var _0x339782={'id':this['id'],'available':this['available'],'loggedIn':this[_0x7c83('0x16')],'name':this[_0x7c83('0x8')],'paused':this[_0x7c83('0x13')],'waiting':this['waiting']};var _0x3d4ed8=md5(JSON[_0x7c83('0x19')](_0x339782));if(this[_0x7c83('0x0')]!==_0x3d4ed8){this['md5']=_0x3d4ed8;io['to'](util[_0x7c83('0x1a')]('whatsapp:queue:%s',_0x339782[_0x7c83('0x8')]))[_0x7c83('0x1b')](_0x7c83('0x1c'),_0x339782);}};module[_0x7c83('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0x4bf1=['name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','_rr','map','prototype','updateRealtime','loggedIn','paused','length','available','stringify','emit','whatsapp_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','localhost','redis'];(function(_0x3d9565,_0x5db973){var _0x546f66=function(_0x137352){while(--_0x137352){_0x3d9565['push'](_0x3d9565['shift']());}};_0x546f66(++_0x5db973);}(_0x4bf1,0xaf));var _0x14bf=function(_0x530898,_0x341be3){_0x530898=_0x530898-0x0;var _0x4da9e0=_0x4bf1[_0x530898];return _0x4da9e0;};'use strict';var _=require('lodash');var md5=require(_0x14bf('0x0'));var util=require(_0x14bf('0x1'));var Redis=require(_0x14bf('0x2'));var config=require(_0x14bf('0x3'));config['redis']=_[_0x14bf('0x4')](config['redis'],{'host':_0x14bf('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x14bf('0x6')]));function WhatsappQueue(_0x52dfec){this['id']=_0x52dfec['id']||0x0;this[_0x14bf('0x7')]=_0x52dfec[_0x14bf('0x7')]||'';this[_0x14bf('0x8')]=_0x52dfec[_0x14bf('0x8')]||0xa;this[_0x14bf('0x9')]=_0x52dfec[_0x14bf('0x9')]||_0x14bf('0xa');this[_0x14bf('0xb')]=_0x52dfec['Agents'];this[_0x14bf('0xc')]={};this[_0x14bf('0xd')]=0x0;this[_0x14bf('0x0')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x2b756c=this[_0x14bf('0xc')][_0x14bf('0xe')];this[_0x14bf('0xc')]=_[_0x14bf('0xf')](this['Agents'],'id');this[_0x14bf('0xc')][_0x14bf('0xe')]=_0x2b756c;};WhatsappQueue[_0x14bf('0x10')][_0x14bf('0x11')]=function(){this[_0x14bf('0x12')]=0x0;this[_0x14bf('0x13')]=0x0;for(var _0x5ce878=0x0;_0x5ce878=0x0?this[_0x14bf('0x15')]:0x0;var _0x36855b={'id':this['id'],'available':this[_0x14bf('0x15')],'loggedIn':this[_0x14bf('0x12')],'name':this[_0x14bf('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x893c37=md5(JSON[_0x14bf('0x16')](_0x36855b));if(this[_0x14bf('0x0')]!==_0x893c37){this[_0x14bf('0x0')]=_0x893c37;io['to'](util['format']('whatsapp:queue:%s',_0x36855b[_0x14bf('0x7')]))[_0x14bf('0x17')](_0x14bf('0x18'),_0x36855b);}};module[_0x14bf('0x19')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3c8af80..0d7fab3 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(_0x53745b,_0x974d57){var _0x8c9562=function(_0x14dabc){while(--_0x14dabc){_0x53745b['push'](_0x53745b['shift']());}};_0x8c9562(++_0x974d57);}(_0xb10b,0x12a));var _0xbb10=function(_0x209fcd,_0x1ecccc){_0x209fcd=_0x209fcd-0x0;var _0x501d5e=_0xb10b[_0x209fcd];return _0x501d5e;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x1d0f98,_0x5ebcbb){var _0x478959=function(_0x17b79c){while(--_0x17b79c){_0x1d0f98['push'](_0x1d0f98['shift']());}};_0x478959(++_0x5ebcbb);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a71f5,_0x401424){_0x4a71f5=_0x4a71f5-0x0;var _0x27162f=_0xb10b[_0x4a71f5];return _0x27162f;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 65e75f4..24beac0 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 _0x2f35=['update','Request','UpdateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client'];(function(_0x4e697a,_0x56a14b){var _0x88850c=function(_0x4e368a){while(--_0x4e368a){_0x4e697a['push'](_0x4e697a['shift']());}};_0x88850c(++_0x56a14b);}(_0x2f35,0x68));var _0x52f3=function(_0x52f73a,_0x4418dd){_0x52f73a=_0x52f73a-0x0;var _0x4b5d40=_0x2f35[_0x52f73a];return _0x4b5d40;};'use strict';var client=require(_0x52f3('0x0'));exports[_0x52f3('0x1')]=function(_0x573c0a,_0x168b5f){return client[_0x52f3('0x2')](_0x52f3('0x3'),{'body':_0x168b5f,'options':{'where':{'id':_0x573c0a}},'log':'updateChatInteraction'});};exports[_0x52f3('0x4')]=function(_0x25cadf,_0x50fb97){return client[_0x52f3('0x2')](_0x52f3('0x5'),{'body':_0x50fb97,'options':{'where':{'id':_0x25cadf}},'log':_0x52f3('0x6')});}; \ No newline at end of file +var _0x61c7=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','UpdateChatInteraction','updateChatInteraction','Request'];(function(_0x21a848,_0x5ce41a){var _0x5aaf99=function(_0x342593){while(--_0x342593){_0x21a848['push'](_0x21a848['shift']());}};_0x5aaf99(++_0x5ce41a);}(_0x61c7,0x17c));var _0x761c=function(_0x2b3e44,_0x1c6aad){_0x2b3e44=_0x2b3e44-0x0;var _0x21263f=_0x61c7[_0x2b3e44];return _0x21263f;};'use strict';var client=require(_0x761c('0x0'));exports['update']=function(_0x1cc41b,_0x80a7f4){return client['Request'](_0x761c('0x1'),{'body':_0x80a7f4,'options':{'where':{'id':_0x1cc41b}},'log':_0x761c('0x2')});};exports['addTags']=function(_0x268fdd,_0x222b67){return client[_0x761c('0x3')](_0x761c('0x4'),{'body':_0x222b67,'options':{'where':{'id':_0x268fdd}},'log':_0x761c('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 4fad828..8581d8d 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 _0x7ca2=['Request','createChatMessage','../client','create'];(function(_0x3b395a,_0xb9a82d){var _0x4aeef2=function(_0x44ef00){while(--_0x44ef00){_0x3b395a['push'](_0x3b395a['shift']());}};_0x4aeef2(++_0xb9a82d);}(_0x7ca2,0x196));var _0x27ca=function(_0x52d5ed,_0x516f5f){_0x52d5ed=_0x52d5ed-0x0;var _0x3f9b6c=_0x7ca2[_0x52d5ed];return _0x3f9b6c;};'use strict';var client=require(_0x27ca('0x0'));exports[_0x27ca('0x1')]=function(_0x38711a){return client[_0x27ca('0x2')]('CreateChatMessage',{'body':_0x38711a,'log':_0x27ca('0x3')});}; \ No newline at end of file +var _0xf58c=['Request','CreateChatMessage','../client','create'];(function(_0x246a98,_0xdf59a8){var _0x3b8b79=function(_0x2d0a7b){while(--_0x2d0a7b){_0x246a98['push'](_0x246a98['shift']());}};_0x3b8b79(++_0xdf59a8);}(_0xf58c,0x6a));var _0xcf58=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0xf58c[_0x2e6dee];return _0x47706;};'use strict';var client=require(_0xcf58('0x0'));exports[_0xcf58('0x1')]=function(_0x303b10){return client[_0xcf58('0x2')](_0xcf58('0x3'),{'body':_0x303b10,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 0b96584..e100e1a 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 _0x27c5=['chatPause','getChatQueues','Request','GetChatQueue','name','strategy','User','Agents','online'];(function(_0xa7228,_0x437876){var _0x273d85=function(_0x145d86){while(--_0x145d86){_0xa7228['push'](_0xa7228['shift']());}};_0x273d85(++_0x437876);}(_0x27c5,0x173));var _0x527c=function(_0x1be3b3,_0x4335ee){_0x1be3b3=_0x1be3b3-0x0;var _0x4f8b2d=_0x27c5[_0x1be3b3];return _0x4f8b2d;};'use strict';var client=require('../client');exports['getChatQueues']=function(){return function(){return client[_0x527c('0x0')](_0x527c('0x1'),{'options':{'raw':![],'attributes':['id',_0x527c('0x2'),'timeout',_0x527c('0x3')],'include':[{'model':_0x527c('0x4'),'as':_0x527c('0x5'),'attributes':['id',_0x527c('0x2'),_0x527c('0x6'),_0x527c('0x7')]}]},'log':_0x527c('0x8')});};}; \ No newline at end of file +var _0x1061=['strategy','User','Agents','online','chatPause','../client','name','timeout'];(function(_0x3d5158,_0x15479b){var _0x39d34b=function(_0x105994){while(--_0x105994){_0x3d5158['push'](_0x3d5158['shift']());}};_0x39d34b(++_0x15479b);}(_0x1061,0x1b5));var _0x1106=function(_0x54da47,_0x53f679){_0x54da47=_0x54da47-0x0;var _0x5d8771=_0x1061[_0x54da47];return _0x5d8771;};'use strict';var client=require(_0x1106('0x0'));exports['getChatQueues']=function(){return function(){return client['Request']('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0x1106('0x1'),_0x1106('0x2'),_0x1106('0x3')],'include':[{'model':_0x1106('0x4'),'as':_0x1106('0x5'),'attributes':['id',_0x1106('0x1'),_0x1106('0x6'),_0x1106('0x7')]}]},'log':'getChatQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index f73e707..94e78cf 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 _0xdadd=['../client','CreateChatQueueReport','update','Request','UpdateChatQueueReport','DESC'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0xdadd,0x1c8));var _0xddad=function(_0x4e9861,_0x25fe5f){_0x4e9861=_0x4e9861-0x0;var _0x49802f=_0xdadd[_0x4e9861];return _0x49802f;};'use strict';var client=require(_0xddad('0x0'));exports['create']=function(_0x34afe8){return client['Request'](_0xddad('0x1'),{'body':_0x34afe8,'log':_0xddad('0x1')});};exports[_0xddad('0x2')]=function(_0x484d96,_0x3d18f1){return client[_0xddad('0x3')](_0xddad('0x4'),{'body':_0x3d18f1,'options':{'where':{'uniqueid':_0x484d96},'order':[['id',_0xddad('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc577=['CreateChatQueueReport','update','DESC','UpdateChatQueueReport','../client','Request'];(function(_0x4763ff,_0x344536){var _0x39921a=function(_0x2345fa){while(--_0x2345fa){_0x4763ff['push'](_0x4763ff['shift']());}};_0x39921a(++_0x344536);}(_0xc577,0x172));var _0x7c57=function(_0x52dd39,_0xdb90a5){_0x52dd39=_0x52dd39-0x0;var _0x1d4076=_0xc577[_0x52dd39];return _0x1d4076;};'use strict';var client=require(_0x7c57('0x0'));exports['create']=function(_0x5cbd78){return client[_0x7c57('0x1')](_0x7c57('0x2'),{'body':_0x5cbd78,'log':_0x7c57('0x2')});};exports[_0x7c57('0x3')]=function(_0x3abdb2,_0x304922){return client[_0x7c57('0x1')]('UpdateChatQueueReport',{'body':_0x304922,'options':{'where':{'uniqueid':_0x3abdb2},'order':[['id',_0x7c57('0x4')]],'limit':0x1},'log':_0x7c57('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index e6f6669..d88b6e9 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(_0x12e073,_0x4d43db){var _0x267748=function(_0x381284){while(--_0x381284){_0x12e073['push'](_0x12e073['shift']());}};_0x267748(++_0x4d43db);}(_0x7a54,0x106));var _0x47a5=function(_0x27e80e,_0x2280ca){_0x27e80e=_0x27e80e-0x0;var _0x43e0c3=_0x7a54[_0x27e80e];return _0x43e0c3;};'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(_0x3dd812,_0x5af958){var _0x21f70c=function(_0x1c1d95){while(--_0x1c1d95){_0x3dd812['push'](_0x3dd812['shift']());}};_0x21f70c(++_0x5af958);}(_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 8c8afc1..8127b19 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 _0x5dab=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x4ec93c,_0x175e38){var _0x576871=function(_0x1150d4){while(--_0x1150d4){_0x4ec93c['push'](_0x4ec93c['shift']());}};_0x576871(++_0x175e38);}(_0x5dab,0x115));var _0xb5da=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x5dab[_0x5b561d];return _0x431060;};'use strict';var client=require(_0xb5da('0x0'));exports['create']=function(_0xeac521){return client[_0xb5da('0x1')](_0xb5da('0x2'),{'body':_0xeac521,'log':_0xb5da('0x3')});}; \ No newline at end of file +var _0x2230=['../client'];(function(_0x5c749a,_0x46d113){var _0x52088e=function(_0x6b261d){while(--_0x6b261d){_0x5c749a['push'](_0x5c749a['shift']());}};_0x52088e(++_0x46d113);}(_0x2230,0xbc));var _0x0223=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2230[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0223('0x0'));exports['create']=function(_0x485c2c){return client['Request']('CreateFaxMessage',{'body':_0x485c2c,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 81781af..6ce60f3 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 _0xe3d3=['../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents','name','faxPause'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xe3d3,0x154));var _0x3e3d=function(_0x1efe9c,_0x2d2abe){_0x1efe9c=_0x1efe9c-0x0;var _0x4802c9=_0xe3d3[_0x1efe9c];return _0x4802c9;};'use strict';var client=require(_0x3e3d('0x0'));exports[_0x3e3d('0x1')]=function(){return function(){return client[_0x3e3d('0x2')](_0x3e3d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3e3d('0x4'),_0x3e3d('0x5')],'include':[{'model':_0x3e3d('0x6'),'as':_0x3e3d('0x7'),'attributes':['id',_0x3e3d('0x8'),'online',_0x3e3d('0x9')]}]},'log':_0x3e3d('0x1')});};}; \ No newline at end of file +var _0x3a92=['Agents','name','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','timeout','strategy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3a92,0xcc));var _0x23a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a92[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x23a9('0x0'));exports[_0x23a9('0x1')]=function(){return function(){return client[_0x23a9('0x2')](_0x23a9('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x23a9('0x4'),_0x23a9('0x5')],'include':[{'model':'User','as':_0x23a9('0x6'),'attributes':['id',_0x23a9('0x7'),_0x23a9('0x8'),_0x23a9('0x9')]}]},'log':_0x23a9('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index e222296..9dd8f7a 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 _0x666c=['create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport','DESC','../client'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x666c,0x1f0));var _0xc666=function(_0x574de7,_0x24ce60){_0x574de7=_0x574de7-0x0;var _0x568f46=_0x666c[_0x574de7];return _0x568f46;};'use strict';var client=require(_0xc666('0x0'));exports[_0xc666('0x1')]=function(_0xa4555e){return client['Request'](_0xc666('0x2'),{'body':_0xa4555e,'log':_0xc666('0x2')});};exports[_0xc666('0x3')]=function(_0x16ab45,_0xe1401d){return client[_0xc666('0x4')](_0xc666('0x5'),{'body':_0xe1401d,'options':{'where':{'uniqueid':_0x16ab45},'order':[['id',_0xc666('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x734b=['../client','create','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x3b1a5b,_0x11e93e){var _0x1775d2=function(_0x557625){while(--_0x557625){_0x3b1a5b['push'](_0x3b1a5b['shift']());}};_0x1775d2(++_0x11e93e);}(_0x734b,0xaa));var _0xb734=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x734b[_0x4a747d];return _0x3a5b5c;};'use strict';var client=require(_0xb734('0x0'));exports[_0xb734('0x1')]=function(_0x159e04){return client['Request'](_0xb734('0x2'),{'body':_0x159e04,'log':_0xb734('0x2')});};exports[_0xb734('0x3')]=function(_0x33651a,_0x500c44){return client['Request'](_0xb734('0x4'),{'body':_0x500c44,'options':{'where':{'uniqueid':_0x33651a},'order':[['id','DESC']],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index a986d20..fbc5d09 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 _0xc75d=['Intervals','name','interval','../client','getIntervals','Request','GetInterval'];(function(_0x28faf6,_0x4c12f0){var _0x835145=function(_0x2f040b){while(--_0x2f040b){_0x28faf6['push'](_0x28faf6['shift']());}};_0x835145(++_0x4c12f0);}(_0xc75d,0x65));var _0xdc75=function(_0x405890,_0x90bef6){_0x405890=_0x405890-0x0;var _0x3b4426=_0xc75d[_0x405890];return _0x3b4426;};'use strict';var client=require(_0xdc75('0x0'));exports[_0xdc75('0x1')]=function(){return function(){return client[_0xdc75('0x2')](_0xdc75('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':_0xdc75('0x4'),'attributes':['id',_0xdc75('0x5'),_0xdc75('0x6')]}]},'log':_0xdc75('0x1')});};}; \ No newline at end of file +var _0xac30=['../client','Request','name','Interval','getIntervals'];(function(_0x118c78,_0x166e70){var _0x1bc4a4=function(_0x5576d7){while(--_0x5576d7){_0x118c78['push'](_0x118c78['shift']());}};_0x1bc4a4(++_0x166e70);}(_0xac30,0x1d1));var _0x0ac3=function(_0x9e0cb3,_0x9cd497){_0x9e0cb3=_0x9e0cb3-0x0;var _0x5926b7=_0xac30[_0x9e0cb3];return _0x5926b7;};'use strict';var client=require(_0x0ac3('0x0'));exports['getIntervals']=function(){return function(){return client[_0x0ac3('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x0ac3('0x2')],'include':[{'model':_0x0ac3('0x3'),'as':'Intervals','attributes':['id',_0x0ac3('0x2'),'interval']}]},'log':_0x0ac3('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 62e566e..2dbf43f 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 _0x8f4c=['update','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','../client'];(function(_0x542818,_0x33eb50){var _0x3b202c=function(_0x31272b){while(--_0x31272b){_0x542818['push'](_0x542818['shift']());}};_0x3b202c(++_0x33eb50);}(_0x8f4c,0x113));var _0xc8f4=function(_0x43cba5,_0x4a2f83){_0x43cba5=_0x43cba5-0x0;var _0x359d1a=_0x8f4c[_0x43cba5];return _0x359d1a;};'use strict';var client=require(_0xc8f4('0x0'));exports[_0xc8f4('0x1')]=function(_0xce26f2,_0x43926b){return client[_0xc8f4('0x2')](_0xc8f4('0x3'),{'body':_0x43926b,'options':{'where':{'id':_0xce26f2}},'log':'updateMailInteraction'});};exports[_0xc8f4('0x4')]=function(_0x47350d,_0x133764){return client['Request'](_0xc8f4('0x5'),{'body':_0x133764,'options':{'where':{'id':_0x47350d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xd943=['addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags'];(function(_0x3888bc,_0xdc0345){var _0x180ee3=function(_0x1981d3){while(--_0x1981d3){_0x3888bc['push'](_0x3888bc['shift']());}};_0x180ee3(++_0xdc0345);}(_0xd943,0x15d));var _0x3d94=function(_0x5ed35a,_0x557f21){_0x5ed35a=_0x5ed35a-0x0;var _0x51432d=_0xd943[_0x5ed35a];return _0x51432d;};'use strict';var client=require(_0x3d94('0x0'));exports[_0x3d94('0x1')]=function(_0x55353d,_0x440dd8){return client['Request'](_0x3d94('0x2'),{'body':_0x440dd8,'options':{'where':{'id':_0x55353d}},'log':_0x3d94('0x3')});};exports[_0x3d94('0x4')]=function(_0xc13b61,_0xaf8962){return client['Request']('AddTagsToMailInteraction',{'body':_0xaf8962,'options':{'where':{'id':_0xc13b61}},'log':_0x3d94('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 16d0f57..7ed8864 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 _0xe34f=['createMailMessage','../client','Request'];(function(_0x470244,_0x10294b){var _0x4e1052=function(_0x2dc9ec){while(--_0x2dc9ec){_0x470244['push'](_0x470244['shift']());}};_0x4e1052(++_0x10294b);}(_0xe34f,0x15a));var _0xfe34=function(_0x10ae06,_0x269932){_0x10ae06=_0x10ae06-0x0;var _0x56a368=_0xe34f[_0x10ae06];return _0x56a368;};'use strict';var client=require(_0xfe34('0x0'));exports['create']=function(_0x2e3762){return client[_0xfe34('0x1')]('CreateMailMessage',{'body':_0x2e3762,'log':_0xfe34('0x2')});}; \ No newline at end of file +var _0xe508=['CreateMailMessage','createMailMessage','../client','Request'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xe508,0xce));var _0x8e50=function(_0x543b5c,_0x2f4bc3){_0x543b5c=_0x543b5c-0x0;var _0x57be8a=_0xe508[_0x543b5c];return _0x57be8a;};'use strict';var client=require(_0x8e50('0x0'));exports['create']=function(_0x5b62e9){return client[_0x8e50('0x1')](_0x8e50('0x2'),{'body':_0x5b62e9,'log':_0x8e50('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index fead054..41af677 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 _0x3492=['User','online','mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout'];(function(_0x3050e7,_0x1d080d){var _0x88f963=function(_0x4c9a22){while(--_0x4c9a22){_0x3050e7['push'](_0x3050e7['shift']());}};_0x88f963(++_0x1d080d);}(_0x3492,0x123));var _0x2349=function(_0x391839,_0x2a3019){_0x391839=_0x391839-0x0;var _0x1e6960=_0x3492[_0x391839];return _0x1e6960;};'use strict';var client=require(_0x2349('0x0'));exports[_0x2349('0x1')]=function(){return function(){return client[_0x2349('0x2')](_0x2349('0x3'),{'options':{'raw':![],'attributes':['id',_0x2349('0x4'),_0x2349('0x5'),'strategy'],'include':[{'model':_0x2349('0x6'),'as':'Agents','attributes':['id','name',_0x2349('0x7'),_0x2349('0x8')]}]},'log':_0x2349('0x1')});};}; \ No newline at end of file +var _0x54ad=['strategy','User','Agents','online','name'];(function(_0x5053bb,_0x5160be){var _0x185b74=function(_0x1621c5){while(--_0x1621c5){_0x5053bb['push'](_0x5053bb['shift']());}};_0x185b74(++_0x5160be);}(_0x54ad,0x130));var _0xd54a=function(_0x46fed2,_0x33eb1b){_0x46fed2=_0x46fed2-0x0;var _0x3ffc58=_0x54ad[_0x46fed2];return _0x3ffc58;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xd54a('0x0'),'timeout',_0xd54a('0x1')],'include':[{'model':_0xd54a('0x2'),'as':_0xd54a('0x3'),'attributes':['id',_0xd54a('0x0'),_0xd54a('0x4'),'mailPause']}]},'log':'getMailQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index d5dee82..f1eb88e 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 _0xd389=['update','UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport'];(function(_0x30f768,_0x4872f0){var _0x3f4edc=function(_0x411c2a){while(--_0x411c2a){_0x30f768['push'](_0x30f768['shift']());}};_0x3f4edc(++_0x4872f0);}(_0xd389,0x135));var _0x9d38=function(_0x287f6c,_0x778cc9){_0x287f6c=_0x287f6c-0x0;var _0x40d97f=_0xd389[_0x287f6c];return _0x40d97f;};'use strict';var client=require(_0x9d38('0x0'));exports['create']=function(_0x50c11a){return client[_0x9d38('0x1')](_0x9d38('0x2'),{'body':_0x50c11a,'log':'CreateMailQueueReport'});};exports[_0x9d38('0x3')]=function(_0x2de500,_0x311f84){return client[_0x9d38('0x1')](_0x9d38('0x4'),{'body':_0x311f84,'options':{'where':{'uniqueid':_0x2de500},'order':[['id',_0x9d38('0x5')]],'limit':0x1},'log':_0x9d38('0x4')});}; \ No newline at end of file +var _0x1b8f=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x15b580,_0x343baf){var _0x47cd5e=function(_0x51993a){while(--_0x51993a){_0x15b580['push'](_0x15b580['shift']());}};_0x47cd5e(++_0x343baf);}(_0x1b8f,0xca));var _0xf1b8=function(_0x410b1a,_0x20b0c7){_0x410b1a=_0x410b1a-0x0;var _0xdb2a6e=_0x1b8f[_0x410b1a];return _0xdb2a6e;};'use strict';var client=require(_0xf1b8('0x0'));exports[_0xf1b8('0x1')]=function(_0x272420){return client[_0xf1b8('0x2')](_0xf1b8('0x3'),{'body':_0x272420,'log':_0xf1b8('0x3')});};exports[_0xf1b8('0x4')]=function(_0xc1b413,_0x1c7e8b){return client['Request'](_0xf1b8('0x5'),{'body':_0x1c7e8b,'options':{'where':{'uniqueid':_0xc1b413},'order':[['id',_0xf1b8('0x6')]],'limit':0x1},'log':_0xf1b8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 827b0bd..ddea8bc 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 _0xf41f=['addTagsToChatInteraction','update','Request','AddTagsToOpenchannelInteraction'];(function(_0x3b5587,_0x22a6f4){var _0x3fbb62=function(_0x41f5ce){while(--_0x41f5ce){_0x3b5587['push'](_0x3b5587['shift']());}};_0x3fbb62(++_0x22a6f4);}(_0xf41f,0x79));var _0xff41=function(_0x10ea83,_0x1c4798){_0x10ea83=_0x10ea83-0x0;var _0x77609f=_0xf41f[_0x10ea83];return _0x77609f;};'use strict';var client=require('../client');exports[_0xff41('0x0')]=function(_0x4236ac,_0xde32e6){return client[_0xff41('0x1')]('UpdateOpenchannelInteraction',{'body':_0xde32e6,'options':{'where':{'id':_0x4236ac}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x1a24a5,_0x4264a6){return client[_0xff41('0x1')](_0xff41('0x2'),{'body':_0x4264a6,'options':{'where':{'id':_0x1a24a5}},'log':_0xff41('0x3')});}; \ No newline at end of file +var _0x44d5=['updateOpenchannelInteraction','addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x44d5,0x9d));var _0x544d=function(_0x39ea42,_0x3c1f50){_0x39ea42=_0x39ea42-0x0;var _0x33f5b7=_0x44d5[_0x39ea42];return _0x33f5b7;};'use strict';var client=require(_0x544d('0x0'));exports[_0x544d('0x1')]=function(_0x1b9791,_0x4f0ba8){return client[_0x544d('0x2')](_0x544d('0x3'),{'body':_0x4f0ba8,'options':{'where':{'id':_0x1b9791}},'log':_0x544d('0x4')});};exports[_0x544d('0x5')]=function(_0x2fb81d,_0x4ff619){return client[_0x544d('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x4ff619,'options':{'where':{'id':_0x2fb81d}},'log':_0x544d('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 60697b2..14048e2 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 _0xd269=['CreateOpenchannelMessage','../client'];(function(_0xb56a21,_0x3093c7){var _0x121573=function(_0x4bb965){while(--_0x4bb965){_0xb56a21['push'](_0xb56a21['shift']());}};_0x121573(++_0x3093c7);}(_0xd269,0x175));var _0x9d26=function(_0x582438,_0x3e6171){_0x582438=_0x582438-0x0;var _0x52d463=_0xd269[_0x582438];return _0x52d463;};'use strict';var client=require(_0x9d26('0x0'));exports['create']=function(_0x5116c3){return client['Request'](_0x9d26('0x1'),{'body':_0x5116c3,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0xe245=['../client','create','createOpenchannelMessage'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe245,0x1ef));var _0x5e24=function(_0x13f0a2,_0x1b3623){_0x13f0a2=_0x13f0a2-0x0;var _0x4cd0b4=_0xe245[_0x13f0a2];return _0x4cd0b4;};'use strict';var client=require(_0x5e24('0x0'));exports[_0x5e24('0x1')]=function(_0x3f9e97){return client['Request']('CreateOpenchannelMessage',{'body':_0x3f9e97,'log':_0x5e24('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5ac46c5..c7eca7a 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 _0x3abb=['online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','strategy','User','Agents'];(function(_0x2142c8,_0x3001eb){var _0x4286e9=function(_0x43d768){while(--_0x43d768){_0x2142c8['push'](_0x2142c8['shift']());}};_0x4286e9(++_0x3001eb);}(_0x3abb,0xeb));var _0xb3ab=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x3abb[_0x500419];return _0x241c1a;};'use strict';var client=require(_0xb3ab('0x0'));exports[_0xb3ab('0x1')]=function(){return function(){return client[_0xb3ab('0x2')](_0xb3ab('0x3'),{'options':{'raw':![],'attributes':['id',_0xb3ab('0x4'),'timeout',_0xb3ab('0x5')],'include':[{'model':_0xb3ab('0x6'),'as':_0xb3ab('0x7'),'attributes':['id',_0xb3ab('0x4'),_0xb3ab('0x8'),'openchannelPause']}]},'log':_0xb3ab('0x1')});};}; \ No newline at end of file +var _0x1d68=['strategy','online','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','name','timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1d68,0x1db));var _0x81d6=function(_0x1f8f66,_0x5dc25a){_0x1f8f66=_0x1f8f66-0x0;var _0x3b992d=_0x1d68[_0x1f8f66];return _0x3b992d;};'use strict';var client=require(_0x81d6('0x0'));exports[_0x81d6('0x1')]=function(){return function(){return client['Request'](_0x81d6('0x2'),{'options':{'raw':![],'attributes':['id',_0x81d6('0x3'),_0x81d6('0x4'),_0x81d6('0x5')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x81d6('0x3'),_0x81d6('0x6'),_0x81d6('0x7')]}]},'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 41723d7..52ce55e 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 _0x60ab=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x41a7cc,_0x4700fd){var _0x4ed37d=function(_0x4aea45){while(--_0x4aea45){_0x41a7cc['push'](_0x41a7cc['shift']());}};_0x4ed37d(++_0x4700fd);}(_0x60ab,0x72));var _0xb60a=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x60ab[_0x485f53];return _0x480f1e;};'use strict';var client=require('../client');exports[_0xb60a('0x0')]=function(_0x39023c){return client[_0xb60a('0x1')]('CreateOpenchannelQueueReport',{'body':_0x39023c,'log':_0xb60a('0x2')});};exports[_0xb60a('0x3')]=function(_0x2c746b,_0x1cdcc5){return client[_0xb60a('0x1')](_0xb60a('0x4'),{'body':_0x1cdcc5,'options':{'where':{'uniqueid':_0x2c746b},'order':[['id',_0xb60a('0x5')]],'limit':0x1},'log':_0xb60a('0x4')});}; \ No newline at end of file +var _0x896f=['DESC','../client','Request','update','UpdateOpenchannelQueueReport'];(function(_0x312404,_0x41d584){var _0x16a262=function(_0x3d12cf){while(--_0x3d12cf){_0x312404['push'](_0x312404['shift']());}};_0x16a262(++_0x41d584);}(_0x896f,0x92));var _0xf896=function(_0x154cb5,_0x1a8d5a){_0x154cb5=_0x154cb5-0x0;var _0x3f574f=_0x896f[_0x154cb5];return _0x3f574f;};'use strict';var client=require(_0xf896('0x0'));exports['create']=function(_0x39e0a7){return client[_0xf896('0x1')]('CreateOpenchannelQueueReport',{'body':_0x39e0a7,'log':'CreateOpenchannelQueueReport'});};exports[_0xf896('0x2')]=function(_0x178b12,_0x50e86){return client[_0xf896('0x1')](_0xf896('0x3'),{'body':_0x50e86,'options':{'where':{'uniqueid':_0x178b12},'order':[['id',_0xf896('0x4')]],'limit':0x1},'log':_0xf896('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 4e240ca..d4f9e78 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 _0xf0ba=['AddTagsToSmsInteraction','../client','update','Request','updateSmsInteraction','addTags'];(function(_0x2c6991,_0x4b5775){var _0x4de9fa=function(_0x4ad213){while(--_0x4ad213){_0x2c6991['push'](_0x2c6991['shift']());}};_0x4de9fa(++_0x4b5775);}(_0xf0ba,0x1ed));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaf0b('0x0'));exports[_0xaf0b('0x1')]=function(_0x1caf8c,_0x38cf45){return client[_0xaf0b('0x2')]('UpdateSmsInteraction',{'body':_0x38cf45,'options':{'where':{'id':_0x1caf8c}},'log':_0xaf0b('0x3')});};exports[_0xaf0b('0x4')]=function(_0x4cffa5,_0xcd565f){return client['Request'](_0xaf0b('0x5'),{'body':_0xcd565f,'options':{'where':{'id':_0x4cffa5}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file +var _0x1f75=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x1f75,0x12c));var _0x51f7=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x1f75[_0x50a0c2];return _0x5ebadd;};'use strict';var client=require(_0x51f7('0x0'));exports[_0x51f7('0x1')]=function(_0x3470f9,_0x485ae5){return client[_0x51f7('0x2')](_0x51f7('0x3'),{'body':_0x485ae5,'options':{'where':{'id':_0x3470f9}},'log':_0x51f7('0x4')});};exports[_0x51f7('0x5')]=function(_0x3df27f,_0x4e6fc){return client[_0x51f7('0x2')](_0x51f7('0x6'),{'body':_0x4e6fc,'options':{'where':{'id':_0x3df27f}},'log':_0x51f7('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 99a44ac..1f02630 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 _0x0fca=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x405ac9,_0x2c795c){var _0x2d200f=function(_0x27ae59){while(--_0x27ae59){_0x405ac9['push'](_0x405ac9['shift']());}};_0x2d200f(++_0x2c795c);}(_0x0fca,0x16f));var _0xa0fc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x0fca[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xa0fc('0x0'));exports[_0xa0fc('0x1')]=function(_0x367483){return client[_0xa0fc('0x2')](_0xa0fc('0x3'),{'body':_0x367483,'log':_0xa0fc('0x4')});}; \ No newline at end of file +var _0xa33b=['CreateSmsMessage','../client','create','Request'];(function(_0x35129e,_0x2cdece){var _0x2e0139=function(_0x2ed147){while(--_0x2ed147){_0x35129e['push'](_0x35129e['shift']());}};_0x2e0139(++_0x2cdece);}(_0xa33b,0x141));var _0xba33=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xa33b[_0x2e4aa2];return _0x5e6092;};'use strict';var client=require(_0xba33('0x0'));exports[_0xba33('0x1')]=function(_0x55385e){return client[_0xba33('0x2')](_0xba33('0x3'),{'body':_0x55385e,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 5e9a400..a4225fa 100644 --- a/server/services/routing/rpc/smsQueue.js +++ b/server/services/routing/rpc/smsQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x41927e,_0x3243d6){var _0x3dfbd5=function(_0x768d1d){while(--_0x768d1d){_0x41927e['push'](_0x41927e['shift']());}};_0x3dfbd5(++_0x3243d6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x5af346,_0x3e001f){var _0x1c5583=function(_0x5cfd54){while(--_0x5cfd54){_0x5af346['push'](_0x5af346['shift']());}};_0x1c5583(++_0x3e001f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index a2d06e1..c874547 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x17474a,_0xd1a49c){var _0x3a5495=function(_0x10e1b4){while(--_0x10e1b4){_0x17474a['push'](_0x17474a['shift']());}};_0x3a5495(++_0xd1a49c);}(_0x008c,0x188));var _0xc008=function(_0x50d0a5,_0x3ece14){_0x50d0a5=_0x50d0a5-0x0;var _0x16a49c=_0x008c[_0x50d0a5];return _0x16a49c;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x43f489,_0x2b4fea){var _0x4134b4=function(_0x4365f6){while(--_0x4365f6){_0x43f489['push'](_0x43f489['shift']());}};_0x4134b4(++_0x2b4fea);}(_0xedd9,0xfc));var _0x9edd=function(_0x5f37de,_0x1a5921){_0x5f37de=_0x5f37de-0x0;var _0x114e32=_0xedd9[_0x5f37de];return _0x114e32;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 40c871a..26763ef 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(_0x5ce44b,_0x1b2779){var _0x57a6cc=function(_0x9d5883){while(--_0x9d5883){_0x5ce44b['push'](_0x5ce44b['shift']());}};_0x57a6cc(++_0x1b2779);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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(_0x20afcc,_0x11a44f){var _0x415a62=function(_0x386fe0){while(--_0x386fe0){_0x20afcc['push'](_0x20afcc['shift']());}};_0x415a62(++_0x11a44f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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 525d11e..dcd3d11 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 _0xee3c=['../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x30e444,_0x508ed2){var _0x540809=function(_0x5217bd){while(--_0x5217bd){_0x30e444['push'](_0x30e444['shift']());}};_0x540809(++_0x508ed2);}(_0xee3c,0x14a));var _0xcee3=function(_0x4032f0,_0x2ee6ce){_0x4032f0=_0x4032f0-0x0;var _0x4145ee=_0xee3c[_0x4032f0];return _0x4145ee;};'use strict';var client=require(_0xcee3('0x0'));exports[_0xcee3('0x1')]=function(_0x325d92,_0x3de08f){return client[_0xcee3('0x2')](_0xcee3('0x3'),{'body':_0x3de08f,'options':{'where':{'id':_0x325d92}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x435892,_0x4cd398){return client[_0xcee3('0x2')](_0xcee3('0x4'),{'body':_0x4cd398,'options':{'where':{'id':_0x435892}},'log':_0xcee3('0x5')});}; \ No newline at end of file +var _0x9576=['addTagsToWhatsappInteraction','../client','update','updateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction'];(function(_0x308489,_0x3af5df){var _0x3d9456=function(_0xe7fe10){while(--_0xe7fe10){_0x308489['push'](_0x308489['shift']());}};_0x3d9456(++_0x3af5df);}(_0x9576,0x182));var _0x6957=function(_0x5d3f87,_0x2ec8e4){_0x5d3f87=_0x5d3f87-0x0;var _0x574553=_0x9576[_0x5d3f87];return _0x574553;};'use strict';var client=require(_0x6957('0x0'));exports[_0x6957('0x1')]=function(_0x3ed084,_0x27eb1b){return client['Request']('UpdateWhatsappInteraction',{'body':_0x27eb1b,'options':{'where':{'id':_0x3ed084}},'log':_0x6957('0x2')});};exports[_0x6957('0x3')]=function(_0x9e834,_0x10ed80){return client[_0x6957('0x4')](_0x6957('0x5'),{'body':_0x10ed80,'options':{'where':{'id':_0x9e834}},'log':_0x6957('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 381c4e1..78d920f 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 _0xe0cf=['../client','create','CreateWhatsappMessage'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xe0cf,0x177));var _0xfe0c=function(_0x117f85,_0x5afa65){_0x117f85=_0x117f85-0x0;var _0x1c61a7=_0xe0cf[_0x117f85];return _0x1c61a7;};'use strict';var client=require(_0xfe0c('0x0'));exports[_0xfe0c('0x1')]=function(_0x566f24){return client['Request'](_0xfe0c('0x2'),{'body':_0x566f24,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0xad5f=['CreateWhatsappMessage','createWhatsappMessage','../client','create'];(function(_0x59fe10,_0x40c080){var _0x4033a8=function(_0x5d5d54){while(--_0x5d5d54){_0x59fe10['push'](_0x59fe10['shift']());}};_0x4033a8(++_0x40c080);}(_0xad5f,0x6a));var _0xfad5=function(_0x58c053,_0x51c43f){_0x58c053=_0x58c053-0x0;var _0xe1079=_0xad5f[_0x58c053];return _0xe1079;};'use strict';var client=require(_0xfad5('0x0'));exports[_0xfad5('0x1')]=function(_0x20ccb7){return client['Request'](_0xfad5('0x2'),{'body':_0x20ccb7,'log':_0xfad5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index fb02a20..cc48b27 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 _0xb13e=['Request','GetWhatsappQueue','name','strategy','Agents','online','whatsappPause','getWhatsappQueues'];(function(_0x2aa02e,_0x597fe0){var _0xb7e780=function(_0x19fed9){while(--_0x19fed9){_0x2aa02e['push'](_0x2aa02e['shift']());}};_0xb7e780(++_0x597fe0);}(_0xb13e,0x127));var _0xeb13=function(_0x1f8122,_0x2f28ff){_0x1f8122=_0x1f8122-0x0;var _0x49d964=_0xb13e[_0x1f8122];return _0x49d964;};'use strict';var client=require('../client');exports[_0xeb13('0x0')]=function(){return function(){return client[_0xeb13('0x1')](_0xeb13('0x2'),{'options':{'raw':![],'attributes':['id',_0xeb13('0x3'),'timeout',_0xeb13('0x4')],'include':[{'model':'User','as':_0xeb13('0x5'),'attributes':['id',_0xeb13('0x3'),_0xeb13('0x6'),_0xeb13('0x7')]}]},'log':_0xeb13('0x0')});};}; \ No newline at end of file +var _0xd624=['GetWhatsappQueue','name','strategy','User','Agents','../client','getWhatsappQueues','Request'];(function(_0x7b28fe,_0x14b077){var _0x3eea1b=function(_0x1de10c){while(--_0x1de10c){_0x7b28fe['push'](_0x7b28fe['shift']());}};_0x3eea1b(++_0x14b077);}(_0xd624,0x13d));var _0x4d62=function(_0x24bc57,_0x53016a){_0x24bc57=_0x24bc57-0x0;var _0x23222e=_0xd624[_0x24bc57];return _0x23222e;};'use strict';var client=require(_0x4d62('0x0'));exports[_0x4d62('0x1')]=function(){return function(){return client[_0x4d62('0x2')](_0x4d62('0x3'),{'options':{'raw':![],'attributes':['id',_0x4d62('0x4'),'timeout',_0x4d62('0x5')],'include':[{'model':_0x4d62('0x6'),'as':_0x4d62('0x7'),'attributes':['id',_0x4d62('0x4'),'online','whatsappPause']}]},'log':_0x4d62('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index fda8edf..aa64377 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 _0x8dcb=['DESC','../client','create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8dcb,0x1f2));var _0xb8dc=function(_0x2741d1,_0x501426){_0x2741d1=_0x2741d1-0x0;var _0x521e37=_0x8dcb[_0x2741d1];return _0x521e37;};'use strict';var client=require(_0xb8dc('0x0'));exports[_0xb8dc('0x1')]=function(_0x21580f){return client[_0xb8dc('0x2')](_0xb8dc('0x3'),{'body':_0x21580f,'log':_0xb8dc('0x3')});};exports[_0xb8dc('0x4')]=function(_0x2a463a,_0x27dffd){return client['Request'](_0xb8dc('0x5'),{'body':_0x27dffd,'options':{'where':{'uniqueid':_0x2a463a},'order':[['id',_0xb8dc('0x6')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});}; \ No newline at end of file +var _0xa948=['Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client','create'];(function(_0x2bbe8d,_0x5156c2){var _0x539e7a=function(_0x518447){while(--_0x518447){_0x2bbe8d['push'](_0x2bbe8d['shift']());}};_0x539e7a(++_0x5156c2);}(_0xa948,0xa6));var _0x8a94=function(_0x20c809,_0x26b566){_0x20c809=_0x20c809-0x0;var _0x1064a1=_0xa948[_0x20c809];return _0x1064a1;};'use strict';var client=require(_0x8a94('0x0'));exports[_0x8a94('0x1')]=function(_0xfc68d8){return client[_0x8a94('0x2')]('CreateWhatsappQueueReport',{'body':_0xfc68d8,'log':_0x8a94('0x3')});};exports[_0x8a94('0x4')]=function(_0x325ff9,_0x474cd0){return client[_0x8a94('0x2')](_0x8a94('0x5'),{'body':_0x474cd0,'options':{'where':{'uniqueid':_0x325ff9},'order':[['id',_0x8a94('0x6')]],'limit':0x1},'log':_0x8a94('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 bf31740..1becc82 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 _0x5f03=['stop','find','agents','timeout','createQueue','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','length','error','message','join'];(function(_0x4f5d87,_0x4f37fb){var _0x593ffe=function(_0x3ba3eb){while(--_0x3ba3eb){_0x4f5d87['push'](_0x4f5d87['shift']());}};_0x593ffe(++_0x4f37fb);}(_0x5f03,0xd0));var _0x35f0=function(_0x3c2be8,_0x112d63){_0x3c2be8=_0x3c2be8-0x0;var _0x23cea3=_0x5f03[_0x3c2be8];return _0x23cea3;};'use strict';var schema=require(_0x35f0('0x0'));var _=require(_0x35f0('0x1'));var util=require(_0x35f0('0x2'));var seqqueue=require(_0x35f0('0x3'));var logger=require(_0x35f0('0x4'))('routing');var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x35f0('0x5')},'timeout':{'type':_0x35f0('0x6'),'message':_0x35f0('0x7')}});function writeLog(_0x2d6231,_0x492fdc,_0x3d47fb){return logger[_0x35f0('0x8')](util[_0x35f0('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x2d6231,_0x492fdc['name'],_0x3d47fb));}function handleFindAgent(_0x2eb98d){return function(_0x57cb35){return _0x57cb35[_0x35f0('0xa')][_0x35f0('0xb')]()===_0x2eb98d[_0x35f0('0xb')]();};}exports['consequence']=function(_0x13e74b,_0x5c86e2,_0x4a6f45,_0x120244){return function(_0x3b6e6b){try{var _0xbce201={'name':_0x5c86e2[0x0],'timeout':_0x5c86e2[0x1]};var _0x57a0f9=queue['validate'](_0xbce201,{'typecast':!![]});if(_0x57a0f9[_0x35f0('0xc')]){logger[_0x35f0('0xd')]('[%s][AGENT]\x20%s',_0x13e74b,_['map'](_0x57a0f9,_0x35f0('0xe'))[_0x35f0('0xf')](',\x20'));_0x3b6e6b[_0x35f0('0x10')]();}else{var _0xc557dc=_[_0x35f0('0x11')](_0x4a6f45[_0x35f0('0x12')],handleFindAgent(_0xbce201[_0x35f0('0xa')]));if(_0xc557dc){var _0x4af3b1=(_0xbce201[_0x35f0('0x13')]||0xa)*0x3e8;var _0x1bfee2,_0x255252;var _0x138046=seqqueue[_0x35f0('0x14')](_0x4af3b1);_0x138046['id']=_0x13e74b;_0x138046['atimeout']=_0x4af3b1;_0x138046['channel']=_0x120244[_0x35f0('0x15')];writeLog(_0x13e74b,_0xc557dc,util[_0x35f0('0x9')]('START:%s',_0x4af3b1));_0x4a6f45[_0x35f0('0x16')][_0x13e74b]['on'](_0x35f0('0x17'),function(){logger[_0x35f0('0x8')](_0x35f0('0x18'),_0x13e74b);clearTimeout(_0x255252);_0x255252=undefined;_0x138046[_0x35f0('0x19')]();if(_0x4a6f45[_0x35f0('0x16')][_0x13e74b]){delete _0x4a6f45[_0x35f0('0x16')][_0x13e74b];}_0x3b6e6b[_0x35f0('0x10')]();});_0x4a6f45['rules'][_0x13e74b]['on'](_0x35f0('0x1a'),function(){if(_0x4a6f45[_0x35f0('0x16')][_0x13e74b]){delete _0x4a6f45['rules'][_0x13e74b];}});_0x255252=setTimeout(function(){logger[_0x35f0('0x8')](_0x35f0('0x1b'),_0x13e74b);clearTimeout(_0x255252);_0x138046[_0x35f0('0x19')]();_0x3b6e6b['next']();},_0x4af3b1);strategy[_0x35f0('0x1c')](_0x138046,_0xc557dc,_0x4a6f45,_0x120244);}else{logger[_0x35f0('0xd')](_0x35f0('0x1d'),_0x13e74b,_0xbce201['name']);_0x3b6e6b['stop']();}}}catch(_0x59b01c){console[_0x35f0('0x1e')](_0x59b01c);logger['error']('[%s][QUEUE]\x20%s',_0x13e74b,_0x59b01c[_0x35f0('0x1f')]);_0x3b6e6b['stop']();}};}; \ No newline at end of file +var _0x6462=['timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','stop','find','agents','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x3eac5b,_0x4ab9de){var _0x243df1=function(_0x3cc11d){while(--_0x3cc11d){_0x3eac5b['push'](_0x3eac5b['shift']());}};_0x243df1(++_0x4ab9de);}(_0x6462,0x11f));var _0x2646=function(_0xad6218,_0x1d3012){_0xad6218=_0xad6218-0x0;var _0x351a18=_0x6462[_0xad6218];return _0x351a18;};'use strict';var schema=require(_0x2646('0x0'));var _=require(_0x2646('0x1'));var util=require(_0x2646('0x2'));var seqqueue=require(_0x2646('0x3'));var logger=require('../../../../config/logger')(_0x2646('0x4'));var strategy=require(_0x2646('0x5'));var queue=schema({'name':{'type':_0x2646('0x6'),'required':!![],'message':_0x2646('0x7')},'timeout':{'type':_0x2646('0x8'),'message':_0x2646('0x9')}});function writeLog(_0x301b01,_0x482618,_0x4d7b76){return logger[_0x2646('0xa')](util[_0x2646('0xb')](_0x2646('0xc'),_0x301b01,_0x482618['name'],_0x4d7b76));}function handleFindAgent(_0x22796c){return function(_0xf19960){return _0xf19960[_0x2646('0xd')][_0x2646('0xe')]()===_0x22796c[_0x2646('0xe')]();};}exports[_0x2646('0xf')]=function(_0x5b666d,_0x38682a,_0x2897b2,_0x50aa72){return function(_0x35c9ed){try{var _0x4b4023={'name':_0x38682a[0x0],'timeout':_0x38682a[0x1]};var _0x3a3daf=queue[_0x2646('0x0')](_0x4b4023,{'typecast':!![]});if(_0x3a3daf[_0x2646('0x10')]){logger[_0x2646('0x11')]('[%s][AGENT]\x20%s',_0x5b666d,_[_0x2646('0x12')](_0x3a3daf,'message')['join'](',\x20'));_0x35c9ed[_0x2646('0x13')]();}else{var _0x538ca6=_[_0x2646('0x14')](_0x2897b2[_0x2646('0x15')],handleFindAgent(_0x4b4023[_0x2646('0xd')]));if(_0x538ca6){var _0x59b899=(_0x4b4023['timeout']||0xa)*0x3e8;var _0x1097e4,_0x19a4a1;var _0x52914d=seqqueue['createQueue'](_0x59b899);_0x52914d['id']=_0x5b666d;_0x52914d[_0x2646('0x16')]=_0x59b899;_0x52914d[_0x2646('0x17')]=_0x50aa72[_0x2646('0x17')];writeLog(_0x5b666d,_0x538ca6,util[_0x2646('0xb')](_0x2646('0x18'),_0x59b899));_0x2897b2[_0x2646('0x19')][_0x5b666d]['on'](_0x2646('0x1a'),function(){logger[_0x2646('0xa')](_0x2646('0x1b'),_0x5b666d);clearTimeout(_0x19a4a1);_0x19a4a1=undefined;_0x52914d[_0x2646('0x1c')]();if(_0x2897b2[_0x2646('0x19')][_0x5b666d]){delete _0x2897b2['rules'][_0x5b666d];}_0x35c9ed['stop']();});_0x2897b2['rules'][_0x5b666d]['on'](_0x2646('0x1d'),function(){if(_0x2897b2[_0x2646('0x19')][_0x5b666d]){delete _0x2897b2[_0x2646('0x19')][_0x5b666d];}});_0x19a4a1=setTimeout(function(){logger[_0x2646('0xa')](_0x2646('0x1e'),_0x5b666d);clearTimeout(_0x19a4a1);_0x52914d['close']();_0x35c9ed[_0x2646('0x1f')]();},_0x59b899);strategy[_0x2646('0x20')](_0x52914d,_0x538ca6,_0x2897b2,_0x50aa72);}else{logger[_0x2646('0x11')](_0x2646('0x21'),_0x5b666d,_0x4b4023[_0x2646('0xd')]);_0x35c9ed[_0x2646('0x13')]();}}}catch(_0xf23d82){console[_0x2646('0x22')](_0xf23d82);logger[_0x2646('0x11')](_0x2646('0x23'),_0x5b666d,_0xf23d82[_0x2646('0x24')]);_0x35c9ed[_0x2646('0x13')]();}};}; \ 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 716bd04..8a77105 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 _0xe3a2=['../../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.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','postText','next','amazonlex','providerName','dialogState','Failed','catch','lodash','aws-sdk','./utils','routing'];(function(_0x4b600b,_0x5a9b60){var _0x2ae8c1=function(_0x125a43){while(--_0x125a43){_0x4b600b['push'](_0x4b600b['shift']());}};_0x2ae8c1(++_0x5a9b60);}(_0xe3a2,0x1be));var _0x2e3a=function(_0x3b42e0,_0x379f3f){_0x3b42e0=_0x3b42e0-0x0;var _0x428c96=_0xe3a2[_0x3b42e0];return _0x428c96;};'use strict';var _=require(_0x2e3a('0x0'));var moment=require('moment');var AWS=require(_0x2e3a('0x1'));var utils=require(_0x2e3a('0x2'));var logger=require('../../../../config/logger')(_0x2e3a('0x3'));var rpc={'chatMessage':require(_0x2e3a('0x4')),'openchannelMessage':require(_0x2e3a('0x5')),'mailMessage':require(_0x2e3a('0x6')),'smsMessage':require(_0x2e3a('0x7')),'faxMessage':require(_0x2e3a('0x8')),'whatsappMessage':require(_0x2e3a('0x9'))};exports[_0x2e3a('0xa')]=function(_0x297199,_0x35f816){return function(_0xd8866e){try{if(!_[_0x2e3a('0xb')](this[_0x2e3a('0xc')][_0x2e3a('0xd')])){logger[_0x2e3a('0xe')](_0x2e3a('0xf'),_0x297199,_0x2e3a('0x10'));return _0xd8866e['next']();}var _0x5cd95f={'ContactId':this[_0x2e3a('0x11')]['id'],'sentAt':moment()[_0x2e3a('0x12')](_0x2e3a('0x13')),'direction':'out'};if(this[_0x2e3a('0x14')]===_0x2e3a('0x15')||this['channel']===_0x2e3a('0x16')){_0x5cd95f[_0x2e3a('0x17')]=this[_0x2e3a('0xc')][_0x2e3a('0x17')];}var _0x375e6f=this[_0x2e3a('0x14')];if(_0x375e6f==='chat'){_0x5cd95f[_0x2e3a('0x18')]=this[_0x2e3a('0x19')]['id'];}else{_0x5cd95f[_[_0x2e3a('0x1a')](_0x375e6f)+_0x2e3a('0x1b')]=this[_0x2e3a('0x19')]['id'];}_0x5cd95f[_['upperFirst'](_0x375e6f)+_0x2e3a('0x1c')]=this[_0x2e3a('0xc')]['id'];if(this[_0x2e3a('0xc')][_0x2e3a('0x1d')]){var _0x36a329=_0x35f816[0x4];if(!_[_0x2e3a('0x1e')](_0x36a329)){_0x5cd95f[_0x2e3a('0x1f')]=utils[_0x2e3a('0x20')](_0x36a329,this);return rpc[_0x375e6f+_0x2e3a('0x21')][_0x2e3a('0x22')](_0x5cd95f)[_0x2e3a('0x23')](function(_0x2a0ef9){logger[_0x2e3a('0xe')]('[%s][AMAZONLEX]\x20%s',_0x297199,_0x5cd95f['body']);})['catch'](function(_0x4a323b){logger[_0x2e3a('0x24')](_0x2e3a('0xf'),_0x297199,JSON[_0x2e3a('0x25')](_0x4a323b));})['finally'](function(){logger[_0x2e3a('0xe')](_0x2e3a('0x26'),_0x297199);_0xd8866e[_0x2e3a('0x27')]();});}else{logger['info'](_0x2e3a('0x28'),_0x297199);_0xd8866e[_0x2e3a('0x27')]();}}else{var _0x246f67=this;var _0x133953=new AWS['LexRuntime']({'accessKeyId':_0x35f816[0x0],'secretAccessKey':_0x35f816[0x1],'region':_0x35f816[0x2]});var _0x912dc={'botAlias':_0x2e3a('0x29'),'botName':_0x35f816[0x3],'inputText':this[_0x2e3a('0x2a')]['body'],'userId':this[_0x2e3a('0x14')]+':'+this[_0x2e3a('0xc')]['id']['toString']()};_0x133953[_0x2e3a('0x2b')](_0x912dc,function(_0x51f00b,_0x32c4f6){if(_0x51f00b){logger['error'](_0x2e3a('0xf'),_0x297199,_0x51f00b[_0x2e3a('0x2a')]);_0xd8866e[_0x2e3a('0x2c')]();}else if(_0x32c4f6&&_0x32c4f6[_0x2e3a('0x2a')]){_0x246f67[_0x2e3a('0x1f')][_0x2e3a('0x2d')]=_0x32c4f6;_0x5cd95f[_0x2e3a('0x1f')]=_0x32c4f6[_0x2e3a('0x2a')];_0x5cd95f[_0x2e3a('0x2e')]=_0x2e3a('0x2d');_0x5cd95f['providerResponse']=JSON['stringify'](_0x32c4f6);return rpc[_0x375e6f+_0x2e3a('0x21')]['create'](_0x5cd95f)[_0x2e3a('0x23')](function(_0x4abb8){logger[_0x2e3a('0xe')]('[%s][AMAZONLEX]\x20%s',_0x297199,_0x5cd95f[_0x2e3a('0x1f')]);if(_0x32c4f6[_0x2e3a('0x2f')]==_0x2e3a('0x30')){_0xd8866e[_0x2e3a('0x2c')]();}else{_0xd8866e['stop']();}})[_0x2e3a('0x31')](function(_0x5f1192){logger[_0x2e3a('0x24')](_0x2e3a('0xf'),_0x297199,JSON[_0x2e3a('0x25')](_0x5f1192));_0xd8866e[_0x2e3a('0x2c')]();});}else{_0xd8866e[_0x2e3a('0x2c')]();}});}}catch(_0x534019){logger['error'](_0x2e3a('0xf'),_0x297199,JSON['stringify'](_0x534019));_0xd8866e[_0x2e3a('0x27')]();}};}; \ No newline at end of file +var _0xc83d=['create','then','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','postText','message','next','amazonlex','Message','dialogState','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender'];(function(_0x5beb38,_0x1e27c1){var _0x4122ae=function(_0x59ba6f){while(--_0x59ba6f){_0x5beb38['push'](_0x5beb38['shift']());}};_0x4122ae(++_0x1e27c1);}(_0xc83d,0x1c0));var _0xdc83=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc83d[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var moment=require(_0xdc83('0x0'));var AWS=require(_0xdc83('0x1'));var utils=require('./utils');var logger=require(_0xdc83('0x2'))(_0xdc83('0x3'));var rpc={'chatMessage':require(_0xdc83('0x4')),'openchannelMessage':require(_0xdc83('0x5')),'mailMessage':require(_0xdc83('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xdc83('0x7')),'whatsappMessage':require(_0xdc83('0x8'))};exports[_0xdc83('0x9')]=function(_0x7b6afa,_0x4dbd66){return function(_0x4e9c44){try{if(!_[_0xdc83('0xa')](this[_0xdc83('0xb')][_0xdc83('0xc')])){logger[_0xdc83('0xd')](_0xdc83('0xe'),_0x7b6afa,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4e9c44['next']();}var _0xb4f1e7={'ContactId':this[_0xdc83('0xf')]['id'],'sentAt':moment()[_0xdc83('0x10')](_0xdc83('0x11')),'direction':_0xdc83('0x12')};if(this[_0xdc83('0x13')]===_0xdc83('0x14')||this[_0xdc83('0x13')]===_0xdc83('0x15')){_0xb4f1e7[_0xdc83('0x16')]=this[_0xdc83('0xb')][_0xdc83('0x16')];}var _0x19400a=this[_0xdc83('0x13')];if(_0x19400a==='chat'){_0xb4f1e7[_0xdc83('0x17')]=this[_0xdc83('0x18')]['id'];}else{_0xb4f1e7[_[_0xdc83('0x19')](_0x19400a)+_0xdc83('0x1a')]=this['account']['id'];}_0xb4f1e7[_['upperFirst'](_0x19400a)+_0xdc83('0x1b')]=this[_0xdc83('0xb')]['id'];if(this['interaction'][_0xdc83('0x1c')]){var _0xd1744e=_0x4dbd66[0x4];if(!_[_0xdc83('0x1d')](_0xd1744e)){_0xb4f1e7[_0xdc83('0x1e')]=utils[_0xdc83('0x1f')](_0xd1744e,this);return rpc[_0x19400a+'Message'][_0xdc83('0x20')](_0xb4f1e7)[_0xdc83('0x21')](function(_0x35210e){logger[_0xdc83('0xd')](_0xdc83('0xe'),_0x7b6afa,_0xb4f1e7[_0xdc83('0x1e')]);})[_0xdc83('0x22')](function(_0x4ababf){logger[_0xdc83('0x23')](_0xdc83('0xe'),_0x7b6afa,JSON[_0xdc83('0x24')](_0x4ababf));})[_0xdc83('0x25')](function(){logger[_0xdc83('0xd')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x7b6afa);_0x4e9c44['stop']();});}else{logger[_0xdc83('0xd')](_0xdc83('0x26'),_0x7b6afa);_0x4e9c44[_0xdc83('0x27')]();}}else{var _0x71dc05=this;var _0x4c781a=new AWS[(_0xdc83('0x28'))]({'accessKeyId':_0x4dbd66[0x0],'secretAccessKey':_0x4dbd66[0x1],'region':_0x4dbd66[0x2]});var _0x4d0414={'botAlias':_0xdc83('0x29'),'botName':_0x4dbd66[0x3],'inputText':this['message'][_0xdc83('0x1e')],'userId':this[_0xdc83('0x13')]+':'+this['interaction']['id']['toString']()};_0x4c781a[_0xdc83('0x2a')](_0x4d0414,function(_0xf2bf47,_0x59aa6b){if(_0xf2bf47){logger[_0xdc83('0x23')](_0xdc83('0xe'),_0x7b6afa,_0xf2bf47[_0xdc83('0x2b')]);_0x4e9c44[_0xdc83('0x2c')]();}else if(_0x59aa6b&&_0x59aa6b[_0xdc83('0x2b')]){_0x71dc05[_0xdc83('0x1e')]['amazonlex']=_0x59aa6b;_0xb4f1e7[_0xdc83('0x1e')]=_0x59aa6b[_0xdc83('0x2b')];_0xb4f1e7['providerName']=_0xdc83('0x2d');_0xb4f1e7['providerResponse']=JSON['stringify'](_0x59aa6b);return rpc[_0x19400a+_0xdc83('0x2e')][_0xdc83('0x20')](_0xb4f1e7)[_0xdc83('0x21')](function(_0x3c0841){logger[_0xdc83('0xd')](_0xdc83('0xe'),_0x7b6afa,_0xb4f1e7[_0xdc83('0x1e')]);if(_0x59aa6b[_0xdc83('0x2f')]=='Failed'){_0x4e9c44['next']();}else{_0x4e9c44[_0xdc83('0x27')]();}})[_0xdc83('0x22')](function(_0x25e5b7){logger[_0xdc83('0x23')](_0xdc83('0xe'),_0x7b6afa,JSON[_0xdc83('0x24')](_0x25e5b7));_0x4e9c44[_0xdc83('0x2c')]();});}else{_0x4e9c44[_0xdc83('0x2c')]();}});}}catch(_0x35f5c4){logger[_0xdc83('0x23')](_0xdc83('0xe'),_0x7b6afa,JSON['stringify'](_0x35f5c4));_0x4e9c44[_0xdc83('0x27')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 07cc3a2..4248165 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 _0xe40e=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','next','isNil','created','interaction','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','subject','startsWith','Re:\x20','ChatWebsiteId','upperFirst','account','InteractionId','inReplyTo','messageId','html','','','headers','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','Message','catch','error','[RPC][%s][AUTOREPLY]\x20%s','stringify','finally','resolve','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','stop','lodash','moment','./utils','../../../../config/logger'];(function(_0x1b0d03,_0x2fda32){var _0x37cc8c=function(_0x17d854){while(--_0x17d854){_0x1b0d03['push'](_0x1b0d03['shift']());}};_0x37cc8c(++_0x2fda32);}(_0xe40e,0x1d8));var _0xee40=function(_0x23cfd6,_0x2bd876){_0x23cfd6=_0x23cfd6-0x0;var _0x4a39ef=_0xe40e[_0x23cfd6];return _0x4a39ef;};'use strict';var _=require(_0xee40('0x0'));var moment=require(_0xee40('0x1'));var utils=require(_0xee40('0x2'));var logger=require(_0xee40('0x3'))('routing');var rpc={'chatMessage':require(_0xee40('0x4')),'openchannelMessage':require(_0xee40('0x5')),'mailMessage':require(_0xee40('0x6')),'smsMessage':require(_0xee40('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xee40('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xee40('0x9')),'mailInteraction':require(_0xee40('0xa')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0xee40('0xb')),'whatsappInteraction':require(_0xee40('0xc'))};var mailRpc=require(_0xee40('0xd'));exports['consequence']=function(_0x2f8b08,_0x5735fd,_0x201b40,_0x4b71a){return function(_0x49b0d4){try{var _0xb162b2=this[_0xee40('0xe')];if(_0xb162b2===_0xee40('0xf')&&_0x4b71a[_0xee40('0x10')][_0xee40('0x11')]){logger[_0xee40('0x12')](_0xee40('0x13'),_0x2f8b08,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x49b0d4[_0xee40('0x14')]();}if(_0x5735fd[0x0]==='1'&&(_[_0xee40('0x15')](this['interaction'][_0xee40('0x16')])||!this[_0xee40('0x17')][_0xee40('0x16')])){logger[_0xee40('0x12')](_0xee40('0x13'),_0x2f8b08,_0xee40('0x18'));return _0x49b0d4['next']();}if(_0x5735fd[0x0]==='2'&&this[_0xee40('0x17')]['autoreplyExecuted']){logger[_0xee40('0x12')](_0xee40('0x19'),_0x2f8b08,_0xee40('0x1a'));return _0x49b0d4[_0xee40('0x14')]();}var _0xf37bce={'ContactId':this[_0xee40('0x1b')]['id'],'sentAt':moment()[_0xee40('0x1c')](_0xee40('0x1d')),'direction':_0xee40('0x1e')};if(this[_0xee40('0xe')]===_0xee40('0xf')){_0xf37bce[_0xee40('0x10')]=utils[_0xee40('0x1f')](_0x5735fd[0x2],this);}else{_0xf37bce['body']=utils[_0xee40('0x1f')](_0x5735fd[0x1],this);}if(this[_0xee40('0x20')]){_0xf37bce['to']=this[_0xee40('0x20')]['from']||'';if(this[_0xee40('0xe')]===_0xee40('0xf')&&_0x5735fd[0x1]==='1'){_0xf37bce['cc']=this[_0xee40('0x20')]['cc']||'';}_0xf37bce[_0xee40('0x21')]=this[_0xee40('0x20')]['to']||'';_0xf37bce[_0xee40('0x22')]=this['message'][_0xee40('0x22')]||'';_0xf37bce['read']=!![];if(this[_0xee40('0x20')]['subject']){_0xf37bce['subject']='';_0xf37bce[_0xee40('0x23')]+=_[_0xee40('0x24')](this[_0xee40('0x20')][_0xee40('0x23')],'Re:')?'':_0xee40('0x25');_0xf37bce['subject']+=this[_0xee40('0x20')][_0xee40('0x23')];}}if(this[_0xee40('0xe')]==='chat'){_0xf37bce[_0xee40('0x26')]=this['account']['id'];}else{_0xf37bce[_[_0xee40('0x27')](this[_0xee40('0xe')])+'AccountId']=this[_0xee40('0x28')]['id'];}_0xf37bce[_[_0xee40('0x27')](this[_0xee40('0xe')])+_0xee40('0x29')]=this[_0xee40('0x17')]['id'];var _0xe94b73=this[_0xee40('0x17')];if(rpc[this[_0xee40('0xe')]+'Message']){if(this[_0xee40('0xe')]===_0xee40('0xf')){_0xf37bce[_0xee40('0x2a')]=this[_0xee40('0x20')][_0xee40('0x2b')];_0xf37bce[_0xee40('0x2c')]=_0xee40('0x2d')+_['replace'](_0xf37bce['body'],_0xee40('0x2e'),_0xee40('0x2f'))+_0xee40('0x30');_0xf37bce[_0xee40('0x31')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':'All','Precedence':_0xee40('0x32')};return mailRpc[_0xee40('0x33')](this[_0xee40('0x28')][_0xee40('0x34')],_0xf37bce)[_0xee40('0x35')](function(_0x34afe8){logger[_0xee40('0x12')](_0xee40('0x36'),_0x2f8b08);_0xf37bce['messageId']=_0x34afe8['message']['messageId'];return rpc[_0xb162b2+_0xee40('0x37')]['create'](_0xf37bce);})[_0xee40('0x35')](function(_0x306b40){logger[_0xee40('0x12')]('[%s][AUTOREPLY]\x20%s',_0x2f8b08,JSON['stringify'](_0x306b40));})[_0xee40('0x38')](function(_0x1e81fd){logger[_0xee40('0x39')](_0xee40('0x3a'),_0x2f8b08,JSON[_0xee40('0x3b')](_0x1e81fd));})[_0xee40('0x3c')](function(){Promise[_0xee40('0x3d')]()['then'](function(){if(_0x5735fd[0x0]!=='2'||_0xe94b73[_0xee40('0x3e')])return;return rpc[_0xb162b2+_0xee40('0x3f')][_0xee40('0x40')](_0xe94b73['id'],{'autoreplyExecuted':!![]})[_0xee40('0x35')](function(_0x4d394a){logger[_0xee40('0x12')](_0xee40('0x19'),_0x2f8b08,JSON[_0xee40('0x3b')](_0x4d394a));})['catch'](function(_0x39cf7c){logger['error'](_0xee40('0x41'),_0x2f8b08,JSON[_0xee40('0x3b')](_0x39cf7c));});})['then'](function(){_0x49b0d4['next']();});});}else{return rpc[this[_0xee40('0xe')]+_0xee40('0x37')][_0xee40('0x42')](_0xf37bce)[_0xee40('0x35')](function(){logger[_0xee40('0x12')](_0xee40('0x13'),_0x2f8b08,_0xf37bce['body']);})['catch'](function(_0x15c8bf){logger[_0xee40('0x39')](_0xee40('0x13'),_0x2f8b08,JSON[_0xee40('0x3b')](_0x15c8bf));})[_0xee40('0x3c')](function(){Promise[_0xee40('0x3d')]()[_0xee40('0x35')](function(){if(_0x5735fd[0x0]!=='2'||_0xe94b73[_0xee40('0x3e')])return;return rpc[_0xb162b2+'Interaction'][_0xee40('0x40')](_0xe94b73['id'],{'autoreplyExecuted':!![]})[_0xee40('0x35')](function(_0x26cc51){logger[_0xee40('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x2f8b08,JSON[_0xee40('0x3b')](_0x26cc51));})[_0xee40('0x38')](function(_0x43dbb1){logger['error'](_0xee40('0x41'),_0x2f8b08,JSON[_0xee40('0x3b')](_0x43dbb1));});})['then'](function(){_0x49b0d4[_0xee40('0x14')]();});});}}}catch(_0x2b0e89){logger['error'](_0xee40('0x13'),_0x2f8b08,JSON[_0xee40('0x3b')](_0x2b0e89));_0x49b0d4[_0xee40('0x43')]();}};}; \ No newline at end of file +var _0xf016=['All','auto_reply','sendMailMessage','smtpOptions','then','Message','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','autoreplyExecuted','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','resolve','Interaction','update','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','body','from','message','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','inReplyTo','messageId','html','','replace','';_0x51da52['headers']={'Auto-Submitted':_0x6f01('0x32'),'X-Auto-Response-Suppress':_0x6f01('0x33'),'Precedence':_0x6f01('0x34')};return mailRpc[_0x6f01('0x35')](this['account'][_0x6f01('0x36')],_0x51da52)[_0x6f01('0x37')](function(_0x3d5224){logger[_0x6f01('0x10')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x45a87b);_0x51da52[_0x6f01('0x2d')]=_0x3d5224[_0x6f01('0x22')][_0x6f01('0x2d')];return rpc[_0x5a1365+_0x6f01('0x38')][_0x6f01('0x39')](_0x51da52);})[_0x6f01('0x37')](function(_0x2a5a2f){logger['info'](_0x6f01('0x16'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x2a5a2f));})[_0x6f01('0x3b')](function(_0x5f437e){logger['error'](_0x6f01('0x3c'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x5f437e));})['finally'](function(){Promise['resolve']()[_0x6f01('0x37')](function(){if(_0x2e4dc0[0x0]!=='2'||_0xbc212c[_0x6f01('0x3d')])return;return rpc[_0x5a1365+'Interaction']['update'](_0xbc212c['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5f0c19){logger[_0x6f01('0x10')](_0x6f01('0x18'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x5f0c19));})[_0x6f01('0x3b')](function(_0x1d6039){logger[_0x6f01('0x3e')](_0x6f01('0x3f'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x1d6039));});})[_0x6f01('0x37')](function(){_0xa2bb3a[_0x6f01('0x12')]();});});}else{return rpc[this[_0x6f01('0x1e')]+_0x6f01('0x38')][_0x6f01('0x39')](_0x51da52)[_0x6f01('0x37')](function(){logger[_0x6f01('0x10')](_0x6f01('0x16'),_0x45a87b,_0x51da52['body']);})['catch'](function(_0x54f4ea){logger[_0x6f01('0x3e')](_0x6f01('0x16'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x54f4ea));})[_0x6f01('0x40')](function(){Promise[_0x6f01('0x41')]()[_0x6f01('0x37')](function(){if(_0x2e4dc0[0x0]!=='2'||_0xbc212c[_0x6f01('0x3d')])return;return rpc[_0x5a1365+_0x6f01('0x42')][_0x6f01('0x43')](_0xbc212c['id'],{'autoreplyExecuted':!![]})[_0x6f01('0x37')](function(_0x45a706){logger[_0x6f01('0x10')](_0x6f01('0x18'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x45a706));})['catch'](function(_0x1950fa){logger[_0x6f01('0x3e')](_0x6f01('0x3f'),_0x45a87b,JSON['stringify'](_0x1950fa));});})[_0x6f01('0x37')](function(){_0xa2bb3a[_0x6f01('0x12')]();});});}}}catch(_0x5e5c26){logger['error'](_0x6f01('0x16'),_0x45a87b,JSON[_0x6f01('0x3a')](_0x5e5c26));_0xa2bb3a[_0x6f01('0x44')]();}};}; \ 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 9f0fa7e..4b699ac 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 _0x43cc=['stringify','finally','stop','[%s][CLOSE]\x20%s','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','catch','error'];(function(_0x541190,_0x3e2a58){var _0x5eed5b=function(_0x3bdf57){while(--_0x3bdf57){_0x541190['push'](_0x541190['shift']());}};_0x5eed5b(++_0x3e2a58);}(_0x43cc,0xac));var _0xc43c=function(_0x48cb1f,_0x5ca68d){_0x48cb1f=_0x48cb1f-0x0;var _0x172c4d=_0x43cc[_0x48cb1f];return _0x172c4d;};'use strict';var moment=require('moment');var logger=require(_0xc43c('0x0'))(_0xc43c('0x1'));var rpc={'chatInteraction':require(_0xc43c('0x2')),'openchannelInteraction':require(_0xc43c('0x3')),'smsInteraction':require(_0xc43c('0x4')),'mailInteraction':require(_0xc43c('0x5')),'faxInteraction':require(_0xc43c('0x6')),'whatsappInteraction':require(_0xc43c('0x7'))};exports[_0xc43c('0x8')]=function(_0x321c7f,_0x17b8f5,_0x5a50a7,_0x5d6e06){return function(_0x2e91fc){try{logger[_0xc43c('0x9')](_0xc43c('0xa'),_0x321c7f,_0x17b8f5[0x0]);var _0x379822={'closed':0x1,'closedAt':moment()[_0xc43c('0xb')](_0xc43c('0xc')),'closeReason':_0xc43c('0xd'),'disposition':_0x17b8f5[0x0]};if(rpc[_0x5d6e06['channel']+'Interaction']){rpc[_0x5d6e06[_0xc43c('0xe')]+_0xc43c('0xf')]['update'](_0x5d6e06['interaction']['id'],_0x379822)['then'](function(_0x58fbf0){logger[_0xc43c('0x9')](_0xc43c('0x10'),_0x321c7f,_0x5d6e06[_0xc43c('0x11')]['id']);})[_0xc43c('0x12')](function(_0xf4e93a){logger[_0xc43c('0x13')]('[%s][CLOSE]\x20%s',_0x321c7f,JSON[_0xc43c('0x14')](_0xf4e93a));})[_0xc43c('0x15')](function(){_0x2e91fc[_0xc43c('0x16')]();});}}catch(_0x1149ff){logger['error'](_0xc43c('0x17'),_0x321c7f,JSON[_0xc43c('0x14')](_0x1149ff));_0x2e91fc['stop']();}};}; \ No newline at end of file +var _0xdd9b=['../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','stop','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x1433b7,_0xcca004){var _0x441510=function(_0x49a59c){while(--_0x49a59c){_0x1433b7['push'](_0x1433b7['shift']());}};_0x441510(++_0xcca004);}(_0xdd9b,0x134));var _0xbdd9=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xdd9b[_0x2ec461];return _0x28603d;};'use strict';var moment=require(_0xbdd9('0x0'));var logger=require(_0xbdd9('0x1'))('routing');var rpc={'chatInteraction':require(_0xbdd9('0x2')),'openchannelInteraction':require(_0xbdd9('0x3')),'smsInteraction':require(_0xbdd9('0x4')),'mailInteraction':require(_0xbdd9('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xbdd9('0x6'))};exports[_0xbdd9('0x7')]=function(_0x5676f6,_0x36f520,_0x583919,_0x39da52){return function(_0x151495){try{logger[_0xbdd9('0x8')](_0xbdd9('0x9'),_0x5676f6,_0x36f520[0x0]);var _0x4bdffd={'closed':0x1,'closedAt':moment()[_0xbdd9('0xa')](_0xbdd9('0xb')),'closeReason':_0xbdd9('0xc'),'disposition':_0x36f520[0x0]};if(rpc[_0x39da52[_0xbdd9('0xd')]+'Interaction']){rpc[_0x39da52[_0xbdd9('0xd')]+_0xbdd9('0xe')][_0xbdd9('0xf')](_0x39da52[_0xbdd9('0x10')]['id'],_0x4bdffd)[_0xbdd9('0x11')](function(_0x162705){logger[_0xbdd9('0x8')](_0xbdd9('0x12'),_0x5676f6,_0x39da52['interaction']['id']);})[_0xbdd9('0x13')](function(_0x31f14e){logger['error'](_0xbdd9('0x14'),_0x5676f6,JSON[_0xbdd9('0x15')](_0x31f14e));})['finally'](function(){_0x151495[_0xbdd9('0x16')]();});}}catch(_0x208a8f){logger[_0xbdd9('0x17')](_0xbdd9('0x14'),_0x5676f6,JSON[_0xbdd9('0x15')](_0x208a8f));_0x151495[_0xbdd9('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 edc704d..c1109af 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 _0xd2f5=['interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','created','body','getMustacheRender','Message','create','[%s][DIALOGFLOW]\x20%s','catch','error','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','stringify','result','endConversation','lodash','apiai-promise','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xd2f5,0x144));var _0x5d2f=function(_0x29b3be,_0x4d4267){_0x29b3be=_0x29b3be-0x0;var _0x5c25ef=_0xd2f5[_0x29b3be];return _0x5c25ef;};'use strict';var _=require(_0x5d2f('0x0'));var moment=require('moment');var apiai=require(_0x5d2f('0x1'));var md5=require('md5');var utils=require(_0x5d2f('0x2'));var logger=require('../../../../config/logger')(_0x5d2f('0x3'));var rpc={'chatMessage':require(_0x5d2f('0x4')),'openchannelMessage':require(_0x5d2f('0x5')),'mailMessage':require(_0x5d2f('0x6')),'smsMessage':require(_0x5d2f('0x7')),'faxMessage':require(_0x5d2f('0x8')),'whatsappMessage':require(_0x5d2f('0x9'))};exports[_0x5d2f('0xa')]=function(_0x4b2540,_0x443779){return function(_0x908c6){try{if(!_[_0x5d2f('0xb')](this[_0x5d2f('0xc')][_0x5d2f('0xd')])){logger[_0x5d2f('0xe')]('[%s][DIALOGFLOW]\x20%s',_0x4b2540,_0x5d2f('0xf'));return _0x908c6[_0x5d2f('0x10')]();}var _0x4e24af={'ContactId':this[_0x5d2f('0x11')]['id'],'sentAt':moment()[_0x5d2f('0x12')](_0x5d2f('0x13')),'direction':'out'};if(this[_0x5d2f('0x14')]===_0x5d2f('0x15')||this[_0x5d2f('0x14')]==='whatsapp'){_0x4e24af['phone']=this[_0x5d2f('0xc')]['phone'];}var _0x293e95=this[_0x5d2f('0x14')];if(_0x293e95==='chat'){_0x4e24af[_0x5d2f('0x16')]=this['account']['id'];}else{_0x4e24af[_[_0x5d2f('0x17')](_0x293e95)+_0x5d2f('0x18')]=this[_0x5d2f('0x19')]['id'];}_0x4e24af[_['upperFirst'](_0x293e95)+_0x5d2f('0x1a')]=this[_0x5d2f('0xc')]['id'];if(this[_0x5d2f('0xc')][_0x5d2f('0x1b')]){var _0x1536ee=_0x443779[0x2];if(!_['isEmpty'](_0x1536ee)){_0x4e24af[_0x5d2f('0x1c')]=utils[_0x5d2f('0x1d')](_0x1536ee,this);return rpc[_0x293e95+_0x5d2f('0x1e')][_0x5d2f('0x1f')](_0x4e24af)['then'](function(_0x27e16d){logger[_0x5d2f('0xe')](_0x5d2f('0x20'),_0x4b2540,_0x4e24af[_0x5d2f('0x1c')]);})[_0x5d2f('0x21')](function(_0x32ec09){logger[_0x5d2f('0x22')]('[%s][DIALOGFLOW]\x20%s',_0x4b2540,JSON['stringify'](_0x32ec09));})['finally'](function(){logger[_0x5d2f('0xe')](_0x5d2f('0x23'),_0x4b2540);_0x908c6[_0x5d2f('0x24')]();});}else{logger[_0x5d2f('0xe')](_0x5d2f('0x25'),_0x4b2540);_0x908c6['stop']();}}else{var _0x5cc8d6=this;var _0x368693=apiai(_0x443779[0x0],{'language':_0x443779[0x1]||'en'});return _0x368693['textRequest'](this[_0x5d2f('0x26')][_0x5d2f('0x1c')],{'sessionId':md5(this[_0x5d2f('0xc')]['id'])})[_0x5d2f('0x27')](function(_0x6d4ad2){_0x5cc8d6[_0x5d2f('0x1c')][_0x5d2f('0x28')]=_0x6d4ad2;_0x4e24af[_0x5d2f('0x1c')]=_0x6d4ad2['result'][_0x5d2f('0x29')][_0x5d2f('0x2a')];_0x4e24af[_0x5d2f('0x2b')]=_0x5d2f('0x28');_0x4e24af[_0x5d2f('0x2c')]=JSON[_0x5d2f('0x2d')](_0x6d4ad2);return rpc[_0x293e95+_0x5d2f('0x1e')][_0x5d2f('0x1f')](_0x4e24af)['then'](function(_0x10351a){logger[_0x5d2f('0xe')](_0x5d2f('0x20'),_0x4b2540,_0x4e24af[_0x5d2f('0x1c')]);if(_0x6d4ad2[_0x5d2f('0x2e')]['metadata'][_0x5d2f('0x2f')]){_0x908c6[_0x5d2f('0x10')]();}else{_0x908c6[_0x5d2f('0x24')]();}})[_0x5d2f('0x21')](function(_0x536f1d){logger[_0x5d2f('0x22')](_0x5d2f('0x20'),_0x4b2540,JSON['stringify'](_0x536f1d));_0x908c6[_0x5d2f('0x10')]();});})[_0x5d2f('0x21')](function(_0x26e988){logger['error'](_0x5d2f('0x20'),_0x4b2540,_0x26e988[_0x5d2f('0x26')]);_0x908c6[_0x5d2f('0x10')]();});}}catch(_0x4b30e4){logger[_0x5d2f('0x22')](_0x5d2f('0x20'),_0x4b2540,JSON['stringify'](_0x4b30e4));_0x908c6[_0x5d2f('0x24')]();}};}; \ No newline at end of file +var _0x96e0=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','interaction','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','stringify','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','result','speech','providerName','metadata','endConversation','stop','error','lodash','apiai-promise','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','isNil','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x96e0,0x7e));var _0x096e=function(_0x5bf979,_0x28abbf){_0x5bf979=_0x5bf979-0x0;var _0x3fa70e=_0x96e0[_0x5bf979];return _0x3fa70e;};'use strict';var _=require(_0x096e('0x0'));var moment=require('moment');var apiai=require(_0x096e('0x1'));var md5=require('md5');var utils=require('./utils');var logger=require(_0x096e('0x2'))(_0x096e('0x3'));var rpc={'chatMessage':require(_0x096e('0x4')),'openchannelMessage':require(_0x096e('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x096e('0x6'))};exports[_0x096e('0x7')]=function(_0x23c5ab,_0x8c6e0c){return function(_0x1f773){try{if(!_[_0x096e('0x8')](this['interaction'][_0x096e('0x9')])){logger['info'](_0x096e('0xa'),_0x23c5ab,_0x096e('0xb'));return _0x1f773[_0x096e('0xc')]();}var _0x512ff5={'ContactId':this[_0x096e('0xd')]['id'],'sentAt':moment()[_0x096e('0xe')](_0x096e('0xf')),'direction':'out'};if(this[_0x096e('0x10')]===_0x096e('0x11')||this[_0x096e('0x10')]===_0x096e('0x12')){_0x512ff5[_0x096e('0x13')]=this[_0x096e('0x14')][_0x096e('0x13')];}var _0x5dd037=this[_0x096e('0x10')];if(_0x5dd037===_0x096e('0x15')){_0x512ff5['ChatWebsiteId']=this[_0x096e('0x16')]['id'];}else{_0x512ff5[_[_0x096e('0x17')](_0x5dd037)+_0x096e('0x18')]=this[_0x096e('0x16')]['id'];}_0x512ff5[_['upperFirst'](_0x5dd037)+_0x096e('0x19')]=this[_0x096e('0x14')]['id'];if(this['interaction'][_0x096e('0x1a')]){var _0x565ca1=_0x8c6e0c[0x2];if(!_[_0x096e('0x1b')](_0x565ca1)){_0x512ff5[_0x096e('0x1c')]=utils[_0x096e('0x1d')](_0x565ca1,this);return rpc[_0x5dd037+_0x096e('0x1e')][_0x096e('0x1f')](_0x512ff5)[_0x096e('0x20')](function(_0x32da71){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x23c5ab,_0x512ff5['body']);})[_0x096e('0x21')](function(_0x2c0d1c){logger['error'](_0x096e('0xa'),_0x23c5ab,JSON[_0x096e('0x22')](_0x2c0d1c));})['finally'](function(){logger[_0x096e('0x23')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x23c5ab);_0x1f773['stop']();});}else{logger[_0x096e('0x23')](_0x096e('0x24'),_0x23c5ab);_0x1f773['stop']();}}else{var _0x22e788=this;var _0x63bce1=apiai(_0x8c6e0c[0x0],{'language':_0x8c6e0c[0x1]||'en'});return _0x63bce1[_0x096e('0x25')](this['message']['body'],{'sessionId':md5(this[_0x096e('0x14')]['id'])})[_0x096e('0x20')](function(_0x2affa2){_0x22e788[_0x096e('0x1c')][_0x096e('0x26')]=_0x2affa2;_0x512ff5['body']=_0x2affa2[_0x096e('0x27')]['fulfillment'][_0x096e('0x28')];_0x512ff5[_0x096e('0x29')]=_0x096e('0x26');_0x512ff5['providerResponse']=JSON[_0x096e('0x22')](_0x2affa2);return rpc[_0x5dd037+'Message']['create'](_0x512ff5)[_0x096e('0x20')](function(_0x38809a){logger[_0x096e('0x23')](_0x096e('0xa'),_0x23c5ab,_0x512ff5[_0x096e('0x1c')]);if(_0x2affa2['result'][_0x096e('0x2a')][_0x096e('0x2b')]){_0x1f773[_0x096e('0xc')]();}else{_0x1f773[_0x096e('0x2c')]();}})['catch'](function(_0x59c684){logger[_0x096e('0x2d')](_0x096e('0xa'),_0x23c5ab,JSON[_0x096e('0x22')](_0x59c684));_0x1f773[_0x096e('0xc')]();});})[_0x096e('0x21')](function(_0x11c585){logger[_0x096e('0x2d')](_0x096e('0xa'),_0x23c5ab,_0x11c585['message']);_0x1f773[_0x096e('0xc')]();});}}catch(_0xe8d1c1){logger['error'](_0x096e('0xa'),_0x23c5ab,JSON[_0x096e('0x22')](_0xe8d1c1));_0x1f773[_0x096e('0x2c')]();}};}; \ 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 b3bcf17..f0f7319 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 _0x6d11=['DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','push','fulfillmentText','stack','next','md5','bluebird','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','clone','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','body','error','stringify','consequence','isNil','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','phone','interaction','chat','ChatWebsiteId','account','AccountId','upperFirst','created','getMustacheRender','then','catch','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION'];(function(_0x4b79b3,_0x172604){var _0x76bb48=function(_0x137c29){while(--_0x137c29){_0x4b79b3['push'](_0x4b79b3['shift']());}};_0x76bb48(++_0x172604);}(_0x6d11,0x195));var _0x16d1=function(_0x1aa77d,_0x34d92c){_0x1aa77d=_0x1aa77d-0x0;var _0x132b30=_0x6d11[_0x1aa77d];return _0x132b30;};'use strict';var _=require('lodash');var dialogflow=require('dialogflow');var md5=require(_0x16d1('0x0'));var moment=require('moment');var Promise=require(_0x16d1('0x1'));var logger=require(_0x16d1('0x2'))('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0x16d1('0x3')),'openchannelMessage':require(_0x16d1('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x16d1('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x385b7d,_0x3ae03b,_0x3710ad,_0x3763a3){return new Promise(function(_0x492bda,_0x479d1b){var _0x45ede1=_[_0x16d1('0x6')](_0x3710ad);_0x45ede1['body']=_0x3763a3;return rpc[_0x3ae03b+_0x16d1('0x7')][_0x16d1('0x8')](_0x45ede1)['then'](function(){logger[_0x16d1('0x9')](_0x16d1('0xa'),_0x385b7d,_0x45ede1[_0x16d1('0xb')]);_0x492bda();})['catch'](function(_0x594d40){logger[_0x16d1('0xc')](_0x16d1('0xa'),_0x385b7d,JSON[_0x16d1('0xd')](_0x594d40));_0x479d1b(_0x594d40);});});}exports[_0x16d1('0xe')]=function(_0x2c5de3,_0x223ea4){return function(_0x393a15){try{if(!_[_0x16d1('0xf')](this['interaction']['UserId'])){logger[_0x16d1('0x9')]('[%s][DIALOGFLOWV2]\x20%s',_0x2c5de3,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x393a15['next']();}var _0x329753={'ContactId':this[_0x16d1('0x10')]['id'],'sentAt':moment()[_0x16d1('0x11')](_0x16d1('0x12')),'direction':_0x16d1('0x13')};if(this[_0x16d1('0x14')]==='sms'||this['channel']==='whatsapp'){_0x329753[_0x16d1('0x15')]=this[_0x16d1('0x16')][_0x16d1('0x15')];}var _0x920d4c=this[_0x16d1('0x14')];if(_0x920d4c===_0x16d1('0x17')){_0x329753[_0x16d1('0x18')]=this[_0x16d1('0x19')]['id'];}else{_0x329753[_['upperFirst'](_0x920d4c)+_0x16d1('0x1a')]=this[_0x16d1('0x19')]['id'];}_0x329753[_[_0x16d1('0x1b')](_0x920d4c)+'InteractionId']=this['interaction']['id'];if(this[_0x16d1('0x16')][_0x16d1('0x1c')]){var _0x12fd91=_0x223ea4[0x4];if(!_['isEmpty'](_0x12fd91)){_0x329753['body']=utils[_0x16d1('0x1d')](_0x12fd91,this);return rpc[_0x920d4c+_0x16d1('0x7')][_0x16d1('0x8')](_0x329753)[_0x16d1('0x1e')](function(_0x32485e){logger[_0x16d1('0x9')](_0x16d1('0xa'),_0x2c5de3,_0x329753[_0x16d1('0xb')]);})[_0x16d1('0x1f')](function(_0x5d6f72){logger[_0x16d1('0xc')](_0x16d1('0xa'),_0x2c5de3,JSON[_0x16d1('0xd')](_0x5d6f72));})[_0x16d1('0x20')](function(){logger[_0x16d1('0x9')](_0x16d1('0x21'),_0x2c5de3);_0x393a15[_0x16d1('0x22')]();});}else{logger[_0x16d1('0x9')](_0x16d1('0x23'),_0x2c5de3);_0x393a15['stop']();}}else{var _0x12a025=this;var _0x1326e5=_0x223ea4[0x2][_0x16d1('0x24')](/\\n/g,'\x0a');var _0x386f1c={'credentials':{'private_key':_0x1326e5,'client_email':_0x223ea4[0x1]}};var _0x885035=new dialogflow['SessionsClient'](_0x386f1c);var _0x4e38a2=_0x885035['sessionPath'](_0x223ea4[0x0],md5(_0x12a025[_0x16d1('0x16')]['id']));var _0x13ff0f={'session':_0x4e38a2,'queryInput':{'text':{'text':_0x12a025[_0x16d1('0x25')][_0x16d1('0xb')],'languageCode':_0x223ea4[0x3]||'en'}}};return _0x885035[_0x16d1('0x26')](_0x13ff0f)['then'](function(_0x38cdd0){if(_0x38cdd0&&_0x38cdd0[_0x16d1('0x27')]){_0x12a025['body'][_0x16d1('0x28')]=_0x38cdd0;var _0x1635a7=_0x38cdd0[0x0];var _0x3598fa=_0x1635a7[_0x16d1('0x29')]['diagnosticInfo']&&_0x1635a7[_0x16d1('0x29')][_0x16d1('0x2a')][_0x16d1('0x2b')]?_0x1635a7[_0x16d1('0x29')][_0x16d1('0x2a')][_0x16d1('0x2b')][_0x16d1('0x2c')][_0x16d1('0x2d')]:![];_0x12a025[_0x16d1('0xb')][_0x16d1('0x2e')]=_0x1635a7[_0x16d1('0x29')]['action'];_0x12a025['body'][_0x16d1('0x2f')]=_0x1635a7['queryResult'][_0x16d1('0x30')];_0x12a025[_0x16d1('0xb')][_0x16d1('0x31')]=_0x1635a7['queryResult'][_0x16d1('0x2a')]&&_0x1635a7['queryResult']['diagnosticInfo']['fields']?_0x1635a7[_0x16d1('0x29')][_0x16d1('0x2a')]['fields']['end_conversation'][_0x16d1('0x2d')]:![];_0x12a025[_0x16d1('0xb')][_0x16d1('0x32')]=_0x1635a7[_0x16d1('0x29')][_0x16d1('0x33')][_0x16d1('0x34')];_0x12a025[_0x16d1('0xb')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x1635a7[_0x16d1('0x29')][_0x16d1('0x33')][_0x16d1('0x35')];_0x12a025[_0x16d1('0xb')][_0x16d1('0x36')]=_0x1635a7['queryResult'][_0x16d1('0x33')]['isFallback'];_0x12a025[_0x16d1('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1635a7['queryResult'][_0x16d1('0x37')];_0x12a025[_0x16d1('0xb')][_0x16d1('0x38')]=_0x1635a7['queryResult'][_0x16d1('0x39')];_0x12a025[_0x16d1('0xb')][_0x16d1('0x3a')]=_0x1635a7[_0x16d1('0x29')][_0x16d1('0x3b')];_0x329753['providerName']='dialogflowV2';_0x329753[_0x16d1('0x3c')]=JSON[_0x16d1('0xd')](_0x38cdd0);var _0x10a97d=[];for(var _0x28d2da=0x0;_0x28d2da<_0x38cdd0[_0x16d1('0x27')];_0x28d2da++){var _0x1d43a1=_0x38cdd0[_0x28d2da];if(_0x1d43a1&&_0x1d43a1['queryResult']&&_0x1d43a1[_0x16d1('0x29')]['fulfillmentText']){_0x10a97d[_0x16d1('0x3d')](createMessage(_0x2c5de3,_0x920d4c,_0x329753,_0x1d43a1[_0x16d1('0x29')][_0x16d1('0x3e')]));}}return Promise['all'](_0x10a97d)['then'](function(){if(_0x3598fa){_0x393a15['next']();}else{_0x393a15[_0x16d1('0x22')]();}})['catch'](function(_0x5cc647){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x2c5de3,JSON[_0x16d1('0xd')](_0x5cc647));_0x393a15['next']();});}})['catch'](function(_0x55cefb){logger['error'](_0x16d1('0xa'),_0x2c5de3,_0x55cefb[_0x16d1('0x25')],_0x55cefb[_0x16d1('0x3f')]);_0x393a15[_0x16d1('0x40')]();});}}catch(_0x787f35){logger[_0x16d1('0xc')](_0x16d1('0xa'),_0x2c5de3,JSON['stringify'](_0x787f35));_0x393a15['stop']();}};}; \ No newline at end of file +var _0xc785=['out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','sessionPath','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','DIALOGFLOWV2_ACTION','action','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','dialogflowV2','providerResponse','fulfillmentText','push','all','message','stack','lodash','dialogflow','moment','bluebird','../../../../config/logger','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','info','next','contact','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x589248,_0x31dea3){var _0x486750=function(_0x3e7c21){while(--_0x3e7c21){_0x589248['push'](_0x589248['shift']());}};_0x486750(++_0x31dea3);}(_0xc785,0x15c));var _0x5c78=function(_0x46c88b,_0x2feeda){_0x46c88b=_0x46c88b-0x0;var _0x3a6278=_0xc785[_0x46c88b];return _0x3a6278;};'use strict';var _=require(_0x5c78('0x0'));var dialogflow=require(_0x5c78('0x1'));var md5=require('md5');var moment=require(_0x5c78('0x2'));var Promise=require(_0x5c78('0x3'));var logger=require(_0x5c78('0x4'))(_0x5c78('0x5'));var utils=require(_0x5c78('0x6'));var rpc={'chatMessage':require(_0x5c78('0x7')),'openchannelMessage':require(_0x5c78('0x8')),'mailMessage':require(_0x5c78('0x9')),'smsMessage':require(_0x5c78('0xa')),'faxMessage':require(_0x5c78('0xb')),'whatsappMessage':require(_0x5c78('0xc'))};function createMessage(_0x5df781,_0xda819c,_0x566963,_0xef5b4e){return new Promise(function(_0x528a22,_0x1dd31f){var _0x5c6f0e=_[_0x5c78('0xd')](_0x566963);_0x5c6f0e[_0x5c78('0xe')]=_0xef5b4e;return rpc[_0xda819c+_0x5c78('0xf')][_0x5c78('0x10')](_0x5c6f0e)[_0x5c78('0x11')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x5df781,_0x5c6f0e['body']);_0x528a22();})[_0x5c78('0x12')](function(_0x3a2277){logger[_0x5c78('0x13')](_0x5c78('0x14'),_0x5df781,JSON[_0x5c78('0x15')](_0x3a2277));_0x1dd31f(_0x3a2277);});});}exports['consequence']=function(_0x946111,_0x4a1cf9){return function(_0x556458){try{if(!_['isNil'](this[_0x5c78('0x16')]['UserId'])){logger[_0x5c78('0x17')](_0x5c78('0x14'),_0x946111,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x556458[_0x5c78('0x18')]();}var _0x1a0e0c={'ContactId':this[_0x5c78('0x19')]['id'],'sentAt':moment()['format'](_0x5c78('0x1a')),'direction':_0x5c78('0x1b')};if(this[_0x5c78('0x1c')]===_0x5c78('0x1d')||this[_0x5c78('0x1c')]===_0x5c78('0x1e')){_0x1a0e0c[_0x5c78('0x1f')]=this[_0x5c78('0x16')]['phone'];}var _0x553f3f=this['channel'];if(_0x553f3f===_0x5c78('0x20')){_0x1a0e0c[_0x5c78('0x21')]=this['account']['id'];}else{_0x1a0e0c[_['upperFirst'](_0x553f3f)+'AccountId']=this[_0x5c78('0x22')]['id'];}_0x1a0e0c[_[_0x5c78('0x23')](_0x553f3f)+_0x5c78('0x24')]=this['interaction']['id'];if(this[_0x5c78('0x16')][_0x5c78('0x25')]){var _0x3bb73d=_0x4a1cf9[0x4];if(!_[_0x5c78('0x26')](_0x3bb73d)){_0x1a0e0c[_0x5c78('0xe')]=utils[_0x5c78('0x27')](_0x3bb73d,this);return rpc[_0x553f3f+_0x5c78('0xf')]['create'](_0x1a0e0c)[_0x5c78('0x11')](function(_0x434312){logger[_0x5c78('0x17')](_0x5c78('0x14'),_0x946111,_0x1a0e0c[_0x5c78('0xe')]);})[_0x5c78('0x12')](function(_0x4ce4e7){logger[_0x5c78('0x13')](_0x5c78('0x14'),_0x946111,JSON[_0x5c78('0x15')](_0x4ce4e7));})[_0x5c78('0x28')](function(){logger[_0x5c78('0x17')](_0x5c78('0x29'),_0x946111);_0x556458[_0x5c78('0x2a')]();});}else{logger[_0x5c78('0x17')](_0x5c78('0x2b'),_0x946111);_0x556458['stop']();}}else{var _0x5e7d9f=this;var _0x2eb58c=_0x4a1cf9[0x2]['replace'](/\\n/g,'\x0a');var _0x2625c4={'credentials':{'private_key':_0x2eb58c,'client_email':_0x4a1cf9[0x1]}};var _0xbfa89b=new dialogflow['SessionsClient'](_0x2625c4);var _0x4be655=_0xbfa89b[_0x5c78('0x2c')](_0x4a1cf9[0x0],md5(_0x5e7d9f[_0x5c78('0x16')]['id']));var _0x5c9c7e={'session':_0x4be655,'queryInput':{'text':{'text':_0x5e7d9f['message'][_0x5c78('0xe')],'languageCode':_0x4a1cf9[0x3]||'en'}}};return _0xbfa89b[_0x5c78('0x2d')](_0x5c9c7e)[_0x5c78('0x11')](function(_0x3fc408){if(_0x3fc408&&_0x3fc408[_0x5c78('0x2e')]){_0x5e7d9f['body']['dialogflowV2']=_0x3fc408;var _0x5c8108=_0x3fc408[0x0];var _0x42c89a=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x30')]&&_0x5c8108[_0x5c78('0x2f')]['diagnosticInfo'][_0x5c78('0x31')]?_0x5c8108[_0x5c78('0x2f')]['diagnosticInfo'][_0x5c78('0x31')][_0x5c78('0x32')]['boolValue']:![];_0x5e7d9f[_0x5c78('0xe')][_0x5c78('0x33')]=_0x5c8108['queryResult'][_0x5c78('0x34')];_0x5e7d9f[_0x5c78('0xe')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x35')];_0x5e7d9f[_0x5c78('0xe')][_0x5c78('0x36')]=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x30')]&&_0x5c8108['queryResult'][_0x5c78('0x30')][_0x5c78('0x31')]?_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x30')][_0x5c78('0x31')]['end_conversation']['boolValue']:![];_0x5e7d9f['body']['DIALOGFLOWV2_INTENTNAME']=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x37')][_0x5c78('0x38')];_0x5e7d9f['body'][_0x5c78('0x39')]=_0x5c8108['queryResult'][_0x5c78('0x37')][_0x5c78('0x3a')];_0x5e7d9f[_0x5c78('0xe')][_0x5c78('0x3b')]=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x37')][_0x5c78('0x3c')];_0x5e7d9f[_0x5c78('0xe')][_0x5c78('0x3d')]=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x3e')];_0x5e7d9f[_0x5c78('0xe')][_0x5c78('0x3f')]=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x40')];_0x5e7d9f[_0x5c78('0xe')][_0x5c78('0x41')]=_0x5c8108[_0x5c78('0x2f')][_0x5c78('0x42')];_0x1a0e0c[_0x5c78('0x43')]=_0x5c78('0x44');_0x1a0e0c[_0x5c78('0x45')]=JSON[_0x5c78('0x15')](_0x3fc408);var _0x572997=[];for(var _0x233404=0x0;_0x233404<_0x3fc408[_0x5c78('0x2e')];_0x233404++){var _0x3f1935=_0x3fc408[_0x233404];if(_0x3f1935&&_0x3f1935[_0x5c78('0x2f')]&&_0x3f1935[_0x5c78('0x2f')][_0x5c78('0x46')]){_0x572997[_0x5c78('0x47')](createMessage(_0x946111,_0x553f3f,_0x1a0e0c,_0x3f1935[_0x5c78('0x2f')][_0x5c78('0x46')]));}}return Promise[_0x5c78('0x48')](_0x572997)[_0x5c78('0x11')](function(){if(_0x42c89a){_0x556458[_0x5c78('0x18')]();}else{_0x556458['stop']();}})[_0x5c78('0x12')](function(_0x1a1796){logger[_0x5c78('0x13')](_0x5c78('0x14'),_0x946111,JSON['stringify'](_0x1a1796));_0x556458['next']();});}})['catch'](function(_0x22abc7){logger[_0x5c78('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x946111,_0x22abc7[_0x5c78('0x49')],_0x22abc7[_0x5c78('0x4a')]);_0x556458[_0x5c78('0x18')]();});}}catch(_0x5e491d){logger[_0x5c78('0x13')](_0x5c78('0x14'),_0x946111,JSON[_0x5c78('0x15')](_0x5e491d));_0x556458[_0x5c78('0x2a')]();}};}; \ 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 bf90d4d..fe024d6 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 _0x1179=['condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','join'];(function(_0x3f4027,_0x221cbb){var _0x4aea2e=function(_0x29bcbb){while(--_0x29bcbb){_0x3f4027['push'](_0x3f4027['shift']());}};_0x4aea2e(++_0x221cbb);}(_0x1179,0x139));var _0x9117=function(_0x1b453f,_0x17520b){_0x1b453f=_0x1b453f-0x0;var _0x581714=_0x1179[_0x1b453f];return _0x581714;};'use strict';var schema=require(_0x9117('0x0'));var _=require(_0x9117('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x9117('0x2'));var logger=require(_0x9117('0x3'))(_0x9117('0x4'));var gotoif=schema({'condition':{'type':_0x9117('0x5'),'required':!![],'message':_0x9117('0x6')},'priorityTrue':{'type':_0x9117('0x7'),'message':_0x9117('0x8')},'priorityFalse':{'type':_0x9117('0x7'),'message':_0x9117('0x9')}});exports['consequence']=function(_0x38383a,_0x2eb925){return function(_0x2554b0){try{var _0x19384f={'condition':htmlToText[_0x9117('0xa')](utils[_0x9117('0xb')](_0x2eb925[0x0],this),{'wordwrap':![]})[_0x9117('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2eb925[0x1],'priorityFalse':_0x2eb925[0x2]};var _0x11e8b6=gotoif[_0x9117('0x0')](_0x19384f,{'typecast':!![]});if(_0x11e8b6[_0x9117('0xd')]){logger[_0x9117('0xe')](_0x9117('0xf'),_0x38383a,_['map'](_0x11e8b6,'message')[_0x9117('0x10')](',\x20'));_0x2554b0['stop']();}else{try{var _0x45ac52=eval('('+_0x19384f[_0x9117('0x11')]+')');var _0x44d58e=_0x45ac52?_0x19384f[_0x9117('0x12')]:_0x19384f[_0x9117('0x13')];logger[_0x9117('0x14')](_0x9117('0x15'),_0x38383a,_0x19384f[_0x9117('0x11')],_0x45ac52,_0x44d58e||_0x9117('0x16'));if(_0x44d58e){var _0x8861f7=_['findIndex'](_0x2554b0[_0x9117('0x17')](),{'p':_0x44d58e});if(_0x8861f7>=0x0){logger['info'](_0x9117('0x18'),_0x38383a,_0x44d58e||_0x9117('0x16'),_0x8861f7);_0x2554b0[_0x9117('0x16')](_0x8861f7);}else{logger['info'](_0x9117('0x19'),_0x38383a,_0x44d58e||'next');_0x2554b0[_0x9117('0x1a')]();}}else{_0x2554b0['next']();}}catch(_0x583ce1){logger[_0x9117('0xe')](_0x9117('0x1b'),_0x38383a,_0x583ce1[_0x9117('0x1c')]);_0x2554b0[_0x9117('0x1a')]();}}}catch(_0x53d6c9){logger[_0x9117('0xe')](_0x9117('0xf'),_0x38383a,JSON[_0x9117('0x1d')](_0x53d6c9));_0x2554b0['stop']();}};}; \ No newline at end of file +var _0xde82=['replace','error','[%s][GOTOIF]\x20%s','map','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','string','number','consequence','fromString','getMustacheRender'];(function(_0x4bdda3,_0x25f960){var _0x3f8722=function(_0x341120){while(--_0x341120){_0x4bdda3['push'](_0x4bdda3['shift']());}};_0x3f8722(++_0x25f960);}(_0xde82,0x19f));var _0x2de8=function(_0x46548b,_0x40b9d4){_0x46548b=_0x46548b-0x0;var _0x42fe95=_0xde82[_0x46548b];return _0x42fe95;};'use strict';var schema=require(_0x2de8('0x0'));var _=require(_0x2de8('0x1'));var htmlToText=require(_0x2de8('0x2'));var utils=require(_0x2de8('0x3'));var logger=require(_0x2de8('0x4'))('routing');var gotoif=schema({'condition':{'type':_0x2de8('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x2de8('0x6'),'message':'priority\x20true\x20is\x20a\x20number'},'priorityFalse':{'type':_0x2de8('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x2de8('0x7')]=function(_0x52212c,_0x17ec34){return function(_0x4fee84){try{var _0x4eb29={'condition':htmlToText[_0x2de8('0x8')](utils[_0x2de8('0x9')](_0x17ec34[0x0],this),{'wordwrap':![]})[_0x2de8('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x17ec34[0x1],'priorityFalse':_0x17ec34[0x2]};var _0x592102=gotoif[_0x2de8('0x0')](_0x4eb29,{'typecast':!![]});if(_0x592102['length']){logger[_0x2de8('0xb')](_0x2de8('0xc'),_0x52212c,_[_0x2de8('0xd')](_0x592102,'message')['join'](',\x20'));_0x4fee84[_0x2de8('0xe')]();}else{try{var _0x7bc3ab=eval('('+_0x4eb29['condition']+')');var _0x3550b7=_0x7bc3ab?_0x4eb29['priorityTrue']:_0x4eb29[_0x2de8('0xf')];logger[_0x2de8('0x10')](_0x2de8('0x11'),_0x52212c,_0x4eb29[_0x2de8('0x12')],_0x7bc3ab,_0x3550b7||_0x2de8('0x13'));if(_0x3550b7){var _0x55d005=_[_0x2de8('0x14')](_0x4fee84[_0x2de8('0x15')](),{'p':_0x3550b7});if(_0x55d005>=0x0){logger[_0x2de8('0x10')](_0x2de8('0x16'),_0x52212c,_0x3550b7||'next',_0x55d005);_0x4fee84[_0x2de8('0x13')](_0x55d005);}else{logger[_0x2de8('0x10')](_0x2de8('0x17'),_0x52212c,_0x3550b7||'next');_0x4fee84['stop']();}}else{_0x4fee84[_0x2de8('0x13')]();}}catch(_0x117d42){logger[_0x2de8('0xb')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x52212c,_0x117d42['message']);_0x4fee84['stop']();}}}catch(_0x3e2ef0){logger[_0x2de8('0xb')]('[%s][GOTOIF]\x20%s',_0x52212c,JSON[_0x2de8('0x18')](_0x3e2ef0));_0x4fee84[_0x2de8('0xe')]();}};}; \ 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 c220171..a2e9c70 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 _0x316b=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','next','stringify','../../../../config/logger','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','message','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x316b,0x1a6));var _0xb316=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x316b[_0x3f8759];return _0x2d33ca;};'use strict';var schema=require('validate');var _=require('lodash');var logger=require(_0xb316('0x0'))('routing');var gotop=schema({'priority':{'type':_0xb316('0x1'),'required':!![],'message':_0xb316('0x2')}});exports[_0xb316('0x3')]=function(_0x4547a2,_0x5bd660){return function(_0x5f95fd){try{var _0x3d791d={'priority':_0x5bd660[0x0]};var _0xc7fc1f=gotop[_0xb316('0x4')](_0x3d791d,{'typecast':!![]});if(_0xc7fc1f[_0xb316('0x5')]){logger[_0xb316('0x6')](_0xb316('0x7'),_0x4547a2,_['map'](_0xc7fc1f,_0xb316('0x8'))['join'](',\x20'));_0x5f95fd['stop']();}else{logger[_0xb316('0x9')](_0xb316('0xa'),_0x4547a2,_0x3d791d[_0xb316('0xb')]);if(_0x3d791d[_0xb316('0xb')]){var _0x4709fc=_[_0xb316('0xc')](_0x5f95fd[_0xb316('0xd')](),{'p':_0x3d791d[_0xb316('0xb')]});if(_0x4709fc>=0x0){logger[_0xb316('0x9')](_0xb316('0xe'),_0x4547a2,_0x3d791d[_0xb316('0xb')]||'next',_0x4709fc);_0x5f95fd['next'](_0x4709fc);}else{logger['info'](_0xb316('0xf'),_0x4547a2,_0x3d791d['priority']||'next');_0x5f95fd[_0xb316('0x10')]();}}else{_0x5f95fd[_0xb316('0x11')]();}}}catch(_0x49aff6){logger[_0xb316('0x6')](_0xb316('0x7'),_0x4547a2,JSON[_0xb316('0x12')](_0x49aff6));_0x5f95fd[_0xb316('0x10')]();}};}; \ No newline at end of file +var _0x03a4=['priority','findIndex','rules','info','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s'];(function(_0xdfc87d,_0x28e1a5){var _0x4e2a5e=function(_0x55f2f7){while(--_0x55f2f7){_0xdfc87d['push'](_0xdfc87d['shift']());}};_0x4e2a5e(++_0x28e1a5);}(_0x03a4,0x10b));var _0x403a=function(_0x240c19,_0x11de1b){_0x240c19=_0x240c19-0x0;var _0x18d022=_0x03a4[_0x240c19];return _0x18d022;};'use strict';var schema=require('validate');var _=require(_0x403a('0x0'));var logger=require(_0x403a('0x1'))('routing');var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x403a('0x2')}});exports[_0x403a('0x3')]=function(_0xe70ee6,_0x29d538){return function(_0x1a30f8){try{var _0x21ee19={'priority':_0x29d538[0x0]};var _0x12a60c=gotop[_0x403a('0x4')](_0x21ee19,{'typecast':!![]});if(_0x12a60c[_0x403a('0x5')]){logger[_0x403a('0x6')](_0x403a('0x7'),_0xe70ee6,_[_0x403a('0x8')](_0x12a60c,_0x403a('0x9'))[_0x403a('0xa')](',\x20'));_0x1a30f8[_0x403a('0xb')]();}else{logger['info'](_0x403a('0xc'),_0xe70ee6,_0x21ee19[_0x403a('0xd')]);if(_0x21ee19[_0x403a('0xd')]){var _0x2a5ecd=_[_0x403a('0xe')](_0x1a30f8[_0x403a('0xf')](),{'p':_0x21ee19['priority']});if(_0x2a5ecd>=0x0){logger[_0x403a('0x10')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0xe70ee6,_0x21ee19[_0x403a('0xd')]||_0x403a('0x11'),_0x2a5ecd);_0x1a30f8[_0x403a('0x11')](_0x2a5ecd);}else{logger['info'](_0x403a('0x12'),_0xe70ee6,_0x21ee19[_0x403a('0xd')]||_0x403a('0x11'));_0x1a30f8['stop']();}}else{_0x1a30f8['next']();}}}catch(_0x34ed9f){logger[_0x403a('0x6')](_0x403a('0x7'),_0xe70ee6,JSON[_0x403a('0x13')](_0x34ed9f));_0x1a30f8['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 0be401f..8ae802a 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 _0x3134=['[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info'];(function(_0x375b8e,_0x142acd){var _0x555ef4=function(_0x5f046a){while(--_0x5f046a){_0x375b8e['push'](_0x375b8e['shift']());}};_0x555ef4(++_0x142acd);}(_0x3134,0xdf));var _0x4313=function(_0x566f57,_0x280fae){_0x566f57=_0x566f57-0x0;var _0x201163=_0x3134[_0x566f57];return _0x201163;};'use strict';var _=require(_0x4313('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x4313('0x1'));var rpc={'chatMessage':require(_0x4313('0x2')),'openchannelMessage':require(_0x4313('0x3')),'mailMessage':require(_0x4313('0x4')),'smsMessage':require(_0x4313('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4313('0x6')]=function(_0xabfb98,_0x5045c9){return function(_0x85b15c){try{var _0x4def4a={'body':utils['getMustacheRender'](_0x5045c9[0x0],this),'ContactId':this[_0x4313('0x7')]['id']};if(this[_0x4313('0x8')]===_0x4313('0x9')){_0x4def4a[_0x4313('0xa')]=this[_0x4313('0xb')]['id'];}else{_0x4def4a[_[_0x4313('0xc')](this[_0x4313('0x8')])+_0x4313('0xd')]=this[_0x4313('0xb')]['id'];}_0x4def4a[_['upperFirst'](this[_0x4313('0x8')])+_0x4313('0xe')]=this[_0x4313('0xf')]['id'];if(rpc[this['channel']+_0x4313('0x10')]){return rpc[this[_0x4313('0x8')]+_0x4313('0x10')][_0x4313('0x11')](_0x4def4a)[_0x4313('0x12')](function(_0x3986a5){logger[_0x4313('0x13')](_0x4313('0x14'),_0xabfb98,_0x4def4a[_0x4313('0x15')]);_0x85b15c[_0x4313('0x16')]();})[_0x4313('0x17')](function(_0x2ca18f){logger[_0x4313('0x18')](_0x4313('0x14'),_0xabfb98,JSON[_0x4313('0x19')](_0x2ca18f));_0x85b15c[_0x4313('0x1a')]();});}}catch(_0x3a262e){logger[_0x4313('0x18')]('[%s][MESSAGE]\x20%s',_0xabfb98,JSON[_0x4313('0x19')](_0x3a262e));_0x85b15c[_0x4313('0x1a')]();}};}; \ No newline at end of file +var _0x5e2b=['chat','ChatWebsiteId','upperFirst','AccountId','account','Message','create','then','[%s][MESSAGE]\x20%s','stringify','stop','error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','getMustacheRender','contact','channel'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x5e2b,0xd2));var _0xb5e2=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x5e2b[_0x1ccbcc];return _0x1e873f;};'use strict';var _=require('lodash');var utils=require(_0xb5e2('0x0'));var logger=require(_0xb5e2('0x1'))(_0xb5e2('0x2'));var rpc={'chatMessage':require(_0xb5e2('0x3')),'openchannelMessage':require(_0xb5e2('0x4')),'mailMessage':require(_0xb5e2('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb5e2('0x6')]=function(_0x589eec,_0x347bf1){return function(_0xd7053d){try{var _0x303e37={'body':utils[_0xb5e2('0x7')](_0x347bf1[0x0],this),'ContactId':this[_0xb5e2('0x8')]['id']};if(this[_0xb5e2('0x9')]===_0xb5e2('0xa')){_0x303e37[_0xb5e2('0xb')]=this['account']['id'];}else{_0x303e37[_[_0xb5e2('0xc')](this[_0xb5e2('0x9')])+_0xb5e2('0xd')]=this[_0xb5e2('0xe')]['id'];}_0x303e37[_[_0xb5e2('0xc')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this['channel']+_0xb5e2('0xf')]){return rpc[this['channel']+_0xb5e2('0xf')][_0xb5e2('0x10')](_0x303e37)[_0xb5e2('0x11')](function(_0x7df84e){logger['info'](_0xb5e2('0x12'),_0x589eec,_0x303e37['body']);_0xd7053d['next']();})['catch'](function(_0x27b249){logger['error'](_0xb5e2('0x12'),_0x589eec,JSON[_0xb5e2('0x13')](_0x27b249));_0xd7053d[_0xb5e2('0x14')]();});}}catch(_0x2885f5){logger[_0xb5e2('0x15')]('[%s][MESSAGE]\x20%s',_0x589eec,JSON[_0xb5e2('0x13')](_0x2885f5));_0xd7053d[_0xb5e2('0x14')]();}};}; \ 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 73a1ea0..261736d 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 _0xa1bb=['stringify','./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error'];(function(_0x2e0fc2,_0x4351dc){var _0x32bd4a=function(_0x190640){while(--_0x190640){_0x2e0fc2['push'](_0x2e0fc2['shift']());}};_0x32bd4a(++_0x4351dc);}(_0xa1bb,0x157));var _0xba1b=function(_0xe90b6f,_0x3fef7d){_0xe90b6f=_0xe90b6f-0x0;var _0x37c506=_0xa1bb[_0xe90b6f];return _0x37c506;};'use strict';var utils=require(_0xba1b('0x0'));var logger=require('../../../../config/logger')(_0xba1b('0x1'));exports[_0xba1b('0x2')]=function(_0x298926,_0x1c820b){return function(_0x2fc2c9){try{logger[_0xba1b('0x3')](_0xba1b('0x4'),_0x298926,utils[_0xba1b('0x5')](_0x1c820b[0x0],this));_0x2fc2c9[_0xba1b('0x6')]();}catch(_0x22b65d){logger[_0xba1b('0x7')](_0xba1b('0x4'),_0x298926,JSON[_0xba1b('0x8')](_0x22b65d));_0x2fc2c9['stop']();}};}; \ No newline at end of file +var _0xccbc=['./utils','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','stringify'];(function(_0x2a5476,_0xd8ec70){var _0x279820=function(_0xd60d70){while(--_0xd60d70){_0x2a5476['push'](_0x2a5476['shift']());}};_0x279820(++_0xd8ec70);}(_0xccbc,0x1d8));var _0xcccb=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xccbc[_0x19950b];return _0x3c6b41;};'use strict';var utils=require(_0xcccb('0x0'));var logger=require('../../../../config/logger')(_0xcccb('0x1'));exports[_0xcccb('0x2')]=function(_0x5ef095,_0x3797b3){return function(_0xbeb94c){try{logger[_0xcccb('0x3')](_0xcccb('0x4'),_0x5ef095,utils[_0xcccb('0x5')](_0x3797b3[0x0],this));_0xbeb94c[_0xcccb('0x6')]();}catch(_0x2a4c4c){logger['error']('[%s][NOOP]\x20%s',_0x5ef095,JSON[_0xcccb('0x7')](_0x2a4c4c));_0xbeb94c['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 2c8f330..7751ffb 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 _0x5f85=['emit','clone','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','qtimeout','rules','end','info','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','moment','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5f85,0x1d8));var _0x55f8=function(_0x57f319,_0x27b333){_0x57f319=_0x57f319-0x0;var _0x28f49e=_0x5f85[_0x57f319];return _0x28f49e;};'use strict';var schema=require(_0x55f8('0x0'));var _=require('lodash');var util=require(_0x55f8('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x55f8('0x2'));var Redis=require('ioredis');var config=require(_0x55f8('0x3'));var logger=require('../../../../config/logger')(_0x55f8('0x4'));var strategy=require(_0x55f8('0x5'));config[_0x55f8('0x6')]=_[_0x55f8('0x7')](config['redis'],{'host':_0x55f8('0x8'),'port':0x18eb});var io=require(_0x55f8('0x9'))(new Redis(config[_0x55f8('0x6')]));var attributes=['id',_0x55f8('0xa'),'account',_0x55f8('0xb'),_0x55f8('0xc'),_0x55f8('0xd')];function emit(_0x5b26d3,_0x41d0a5,_0x5d73ba){io['to'](_0x5b26d3)[_0x55f8('0xe')](_0x41d0a5,_0x5d73ba);}function emitChannelQueueInteraction(_0x4361db,_0x57235e,_0x361101,_0x6d25e9,_0x2f332a,_0x5d7b48,_0x47ea68,_0x35a22e){var _0x1baa3a=_[_0x55f8('0xf')](_0x361101);_0x1baa3a['queue_id']=_0x35a22e;_0x1baa3a['queue']=_0x57235e;_0x1baa3a[_0x55f8('0x10')]=_0x6d25e9;_0x1baa3a['id']=_0x2f332a;if(_0x5d7b48){attributes[_0x55f8('0x11')](_[_0x55f8('0x12')](_0x4361db)+_0x55f8('0x13'));_0x47ea68[util[_0x55f8('0x14')](_0x55f8('0x15'),_0x4361db)][_0x2f332a]=_[_0x55f8('0x16')](_0x1baa3a,attributes);}else{delete _0x47ea68[util[_0x55f8('0x14')](_0x55f8('0x15'),_0x4361db)][_0x2f332a];}emit(util['format'](_0x55f8('0x17'),_0x4361db,_0x57235e),util[_0x55f8('0x14')](_0x55f8('0x18'),_0x4361db,_0x5d7b48?_0x55f8('0x19'):'remove'),_[_0x55f8('0x16')](_0x1baa3a,attributes));}var rpc={'openchannelQueueReport':require(_0x55f8('0x1a')),'mailQueueReport':require(_0x55f8('0x1b')),'chatQueueReport':require(_0x55f8('0x1c')),'smsQueueReport':require(_0x55f8('0x1d')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x55f8('0x1e'))};var queue=schema({'name':{'type':_0x55f8('0x1f'),'required':!![],'message':_0x55f8('0x20')},'timeout':{'type':_0x55f8('0x21'),'message':_0x55f8('0x22')}});function startRouting(_0x3a5b9e,_0x31ba3e,_0x148778,_0x1c4b91){if(_0x3a5b9e&&_0x31ba3e&&_0x148778){_0x31ba3e[_0x55f8('0x23')]+=0x1;var _0x568948={'uniqueid':_0x3a5b9e,'from':_0x148778[_0x55f8('0x24')]?_0x148778[_0x55f8('0x24')][_0x55f8('0xc')]:'','joinAt':moment()[_0x55f8('0x14')](_0x55f8('0x25')),'ContactId':_0x148778[_0x55f8('0x26')]?_0x148778[_0x55f8('0x26')]['id']:null,'ListId':_0x148778[_0x55f8('0x27')]?_0x148778['list']['id']:null};_0x568948[_[_0x55f8('0x28')](_0x148778[_0x55f8('0x29')])+_0x55f8('0x2a')]=_0x31ba3e['id']||null;_0x568948[_[_0x55f8('0x28')](_0x148778[_0x55f8('0x29')])+'InteractionId']=_0x148778[_0x55f8('0x2b')]?_0x148778[_0x55f8('0x2b')]['id']:null;_0x568948[_['upperFirst'](_0x148778[_0x55f8('0x29')])+_0x55f8('0x2c')]=_0x148778['message']?_0x148778[_0x55f8('0x2d')]['id']:null;_0x568948[_[_0x55f8('0x28')](_0x148778[_0x55f8('0x29')])+(_0x148778[_0x55f8('0x29')]!==_0x55f8('0x2e')?_0x55f8('0x2f'):_0x55f8('0x30'))]=_0x148778[_0x55f8('0x10')]?_0x148778[_0x55f8('0x10')]['id']:null;logger['info'](util['format'](_0x55f8('0x31'),_0x3a5b9e,_0x31ba3e['name']));emitChannelQueueInteraction(_0x148778[_0x55f8('0x29')],_0x31ba3e[_0x55f8('0x32')],_0x568948,_0x148778[_0x55f8('0x10')]['name'],_0x148778['message']['id'],!![],_0x1c4b91,_0x31ba3e['id']);if(rpc[_0x148778[_0x55f8('0x29')]+_0x55f8('0x33')]){return rpc[_0x148778[_0x55f8('0x29')]+_0x55f8('0x33')][_0x55f8('0x34')](_0x568948)[_0x55f8('0x35')](function(_0x488a1c){logger[_0x55f8('0x36')](_0x55f8('0x37'));});}}}function stopRouting(_0x42295f,_0x3dfcb5,_0x436d96,_0x40a0f7){if(_0x42295f&&_0x3dfcb5){_0x3dfcb5[_0x55f8('0x23')]-=0x1;var _0x497b6={'leaveAt':moment()[_0x55f8('0x14')](_0x55f8('0x25')),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger['info'](util[_0x55f8('0x14')](_0x55f8('0x38'),_0x42295f,_0x3dfcb5[_0x55f8('0x32')]));emitChannelQueueInteraction(_0x436d96[_0x55f8('0x29')],_0x3dfcb5[_0x55f8('0x32')],_0x436d96['body'],_0x436d96[_0x55f8('0x10')][_0x55f8('0x32')],_0x436d96[_0x55f8('0x2d')]['id'],![],_0x40a0f7,_0x3dfcb5['id']);if(rpc[_0x436d96['channel']+_0x55f8('0x33')]){return rpc[_0x436d96[_0x55f8('0x29')]+'QueueReport'][_0x55f8('0x39')](_0x42295f,_0x497b6)[_0x55f8('0x35')](function(_0x5de5e1){logger[_0x55f8('0x36')]('update\x20queue\x20report');});}}}function endRouting(_0x1d6269,_0x5b381d,_0x150b42,_0x58cdb4){if(_0x1d6269&&_0x5b381d){_0x5b381d[_0x55f8('0x23')]-=0x1;var _0x15fb9f={'leaveAt':moment()[_0x55f8('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x55f8('0x14')](_0x55f8('0x25')),'reason':'timeout'};logger['info'](util['format'](_0x55f8('0x3a'),_0x1d6269,_0x5b381d[_0x55f8('0x32')]));emitChannelQueueInteraction(_0x150b42[_0x55f8('0x29')],_0x5b381d[_0x55f8('0x32')],_0x150b42[_0x55f8('0x24')],_0x150b42[_0x55f8('0x10')][_0x55f8('0x32')],_0x150b42[_0x55f8('0x2d')]['id'],![],_0x58cdb4);if(rpc[_0x150b42[_0x55f8('0x29')]+_0x55f8('0x33')]){return rpc[_0x150b42[_0x55f8('0x29')]+_0x55f8('0x33')][_0x55f8('0x39')](_0x1d6269,_0x15fb9f)[_0x55f8('0x35')](function(_0x4d84bd){logger['error'](_0x55f8('0x3b'));});}}}function handleFindQueue(_0x3d1117){return function(_0xeecf5c){return _0xeecf5c[_0x55f8('0x32')]['toLowerCase']()===_0x3d1117[_0x55f8('0x3c')]();};}exports['consequence']=function(_0x42e030,_0x1d6b1e,_0x23a654,_0x44c3f9){return function(_0x366df7){try{var _0x32dd32={'name':_0x1d6b1e[0x0],'timeout':_0x1d6b1e[0x1]};var _0x24a1e8=queue['validate'](_0x32dd32,{'typecast':!![]});if(_0x24a1e8['length']){logger[_0x55f8('0x36')](_0x55f8('0x3d'),_0x42e030,_[_0x55f8('0x3e')](_0x24a1e8,_0x55f8('0x2d'))[_0x55f8('0x3f')](',\x20'));_0x366df7[_0x55f8('0x40')]();}else{var _0x77cbc3=_[_0x55f8('0x41')](_0x23a654[_0x44c3f9['channel']+_0x55f8('0x42')],handleFindQueue(_0x32dd32[_0x55f8('0x32')]));if(_0x77cbc3){startRouting(_0x42e030,_0x77cbc3,_0x44c3f9,_0x23a654);var _0xa30444=(_0x77cbc3[_0x55f8('0x43')]||0xa)*0x3e8;var _0x31dfa9=(_0x32dd32[_0x55f8('0x43')]||0x14)*0x3e8;var _0xefe49a;if(_0xa30444>_0x31dfa9){_0x31dfa9=_0xa30444;}var _0x2c6b01=seqqueue[_0x55f8('0x44')](_0xa30444);_0x2c6b01['id']=_0x42e030;_0x2c6b01['atimeout']=_0xa30444;_0x2c6b01[_0x55f8('0x45')]=_0x31dfa9;_0x2c6b01['channel']=_0x44c3f9[_0x55f8('0x29')];_0x23a654[_0x55f8('0x46')][_0x42e030]['on'](_0x55f8('0x47'),function(){logger[_0x55f8('0x48')](_0x55f8('0x49'),_0x42e030);stopRouting(_0x42e030,_0x77cbc3,_0x44c3f9,_0x23a654);clearTimeout(_0xefe49a);_0xefe49a=undefined;_0x2c6b01[_0x55f8('0x4a')](!![]);if(_0x23a654[_0x55f8('0x46')][_0x42e030]){delete _0x23a654['rules'][_0x42e030];}_0x366df7[_0x55f8('0x40')]();});_0x23a654['rules'][_0x42e030]['on'](_0x55f8('0x4b'),function(){if(_0x23a654['rules'][_0x42e030]){delete _0x23a654[_0x55f8('0x46')][_0x42e030];}});_0xefe49a=setTimeout(function(){logger[_0x55f8('0x48')](_0x55f8('0x4c'),_0x42e030);endRouting(_0x42e030,_0x77cbc3,_0x44c3f9,_0x23a654);clearTimeout(_0xefe49a);_0x2c6b01['close'](!![]);_0x366df7[_0x55f8('0x4d')]();},_0x31dfa9);switch(_0x77cbc3['strategy']){case _0x55f8('0x4e'):strategy['rrmemory'](_0x2c6b01,_0x77cbc3,_0x23a654,_0x44c3f9);break;default:strategy['beepall'](_0x2c6b01,_0x77cbc3,_0x23a654,_0x44c3f9);}}else{logger[_0x55f8('0x36')](_0x55f8('0x4f'),_0x42e030,_0x32dd32[_0x55f8('0x32')]);_0x366df7[_0x55f8('0x40')]();}}}catch(_0x510727){console['log'](_0x510727);logger[_0x55f8('0x36')]('[%s][QUEUE]\x20%s',_0x42e030,_0x510727[_0x55f8('0x50')]);_0x366df7['stop']();}};}; \ No newline at end of file +var _0x1b86=['name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','waiting','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','redis','defaults','queue_id','account','queue','from','joinAt','emit','clone','%sQueuesWaitingInteractions','pick','format','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string'];(function(_0x3f8f34,_0x39be40){var _0x18d93a=function(_0x1707ae){while(--_0x1707ae){_0x3f8f34['push'](_0x3f8f34['shift']());}};_0x18d93a(++_0x39be40);}(_0x1b86,0x7f));var _0x61b8=function(_0x322c34,_0x1a2e41){_0x322c34=_0x322c34-0x0;var _0x5de006=_0x1b86[_0x322c34];return _0x5de006;};'use strict';var schema=require(_0x61b8('0x0'));var _=require(_0x61b8('0x1'));var util=require(_0x61b8('0x2'));var seqqueue=require(_0x61b8('0x3'));var moment=require('moment');var Redis=require(_0x61b8('0x4'));var config=require('../../../../config/environment');var logger=require(_0x61b8('0x5'))(_0x61b8('0x6'));var strategy=require('./strategy');config[_0x61b8('0x7')]=_[_0x61b8('0x8')](config[_0x61b8('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x61b8('0x7')]));var attributes=['id',_0x61b8('0x9'),_0x61b8('0xa'),_0x61b8('0xb'),_0x61b8('0xc'),_0x61b8('0xd')];function emit(_0x46f403,_0x496643,_0x6fc56){io['to'](_0x46f403)[_0x61b8('0xe')](_0x496643,_0x6fc56);}function emitChannelQueueInteraction(_0x4ee5e8,_0x4bef9e,_0x52b8a6,_0x3f9591,_0x1c8494,_0x2a6ae1,_0x2e3332,_0x59027e){var _0x3d2c2b=_[_0x61b8('0xf')](_0x52b8a6);_0x3d2c2b['queue_id']=_0x59027e;_0x3d2c2b[_0x61b8('0xb')]=_0x4bef9e;_0x3d2c2b[_0x61b8('0xa')]=_0x3f9591;_0x3d2c2b['id']=_0x1c8494;if(_0x2a6ae1){attributes['push'](_['capitalize'](_0x4ee5e8)+'InteractionId');_0x2e3332[util['format'](_0x61b8('0x10'),_0x4ee5e8)][_0x1c8494]=_[_0x61b8('0x11')](_0x3d2c2b,attributes);}else{delete _0x2e3332[util['format']('%sQueuesWaitingInteractions',_0x4ee5e8)][_0x1c8494];}emit(util[_0x61b8('0x12')]('%s:queue:%s',_0x4ee5e8,_0x4bef9e),util['format']('%s_queue_waiting_interaction:%s',_0x4ee5e8,_0x2a6ae1?_0x61b8('0x13'):_0x61b8('0x14')),_[_0x61b8('0x11')](_0x3d2c2b,attributes));}var rpc={'openchannelQueueReport':require(_0x61b8('0x15')),'mailQueueReport':require(_0x61b8('0x16')),'chatQueueReport':require(_0x61b8('0x17')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x61b8('0x18')),'whatsappQueueReport':require(_0x61b8('0x19'))};var queue=schema({'name':{'type':_0x61b8('0x1a'),'required':!![],'message':_0x61b8('0x1b')},'timeout':{'type':_0x61b8('0x1c'),'message':_0x61b8('0x1d')}});function startRouting(_0x1384b6,_0x3bafe0,_0x5502da,_0x4178f9){if(_0x1384b6&&_0x3bafe0&&_0x5502da){_0x3bafe0['waiting']+=0x1;var _0x3e1b81={'uniqueid':_0x1384b6,'from':_0x5502da[_0x61b8('0x1e')]?_0x5502da[_0x61b8('0x1e')][_0x61b8('0xc')]:'','joinAt':moment()[_0x61b8('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5502da['contact']?_0x5502da[_0x61b8('0x1f')]['id']:null,'ListId':_0x5502da[_0x61b8('0x20')]?_0x5502da[_0x61b8('0x20')]['id']:null};_0x3e1b81[_[_0x61b8('0x21')](_0x5502da[_0x61b8('0x22')])+_0x61b8('0x23')]=_0x3bafe0['id']||null;_0x3e1b81[_[_0x61b8('0x21')](_0x5502da['channel'])+_0x61b8('0x24')]=_0x5502da[_0x61b8('0x25')]?_0x5502da['interaction']['id']:null;_0x3e1b81[_[_0x61b8('0x21')](_0x5502da[_0x61b8('0x22')])+_0x61b8('0x26')]=_0x5502da[_0x61b8('0x27')]?_0x5502da[_0x61b8('0x27')]['id']:null;_0x3e1b81[_['upperFirst'](_0x5502da[_0x61b8('0x22')])+(_0x5502da['channel']!==_0x61b8('0x28')?_0x61b8('0x29'):_0x61b8('0x2a'))]=_0x5502da[_0x61b8('0xa')]?_0x5502da['account']['id']:null;logger[_0x61b8('0x2b')](util[_0x61b8('0x12')](_0x61b8('0x2c'),_0x1384b6,_0x3bafe0['name']));emitChannelQueueInteraction(_0x5502da[_0x61b8('0x22')],_0x3bafe0[_0x61b8('0x2d')],_0x3e1b81,_0x5502da[_0x61b8('0xa')]['name'],_0x5502da[_0x61b8('0x27')]['id'],!![],_0x4178f9,_0x3bafe0['id']);if(rpc[_0x5502da[_0x61b8('0x22')]+_0x61b8('0x2e')]){return rpc[_0x5502da[_0x61b8('0x22')]+_0x61b8('0x2e')]['create'](_0x3e1b81)[_0x61b8('0x2f')](function(_0x4369a6){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x11920b,_0x4d9fd9,_0x48f144,_0x4d47f6){if(_0x11920b&&_0x4d9fd9){_0x4d9fd9[_0x61b8('0x30')]-=0x1;var _0x72c066={'leaveAt':moment()[_0x61b8('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x61b8('0x12')](_0x61b8('0x31')),'reason':'accepted'};logger[_0x61b8('0x2b')](util[_0x61b8('0x12')](_0x61b8('0x32'),_0x11920b,_0x4d9fd9[_0x61b8('0x2d')]));emitChannelQueueInteraction(_0x48f144[_0x61b8('0x22')],_0x4d9fd9[_0x61b8('0x2d')],_0x48f144[_0x61b8('0x1e')],_0x48f144[_0x61b8('0xa')][_0x61b8('0x2d')],_0x48f144[_0x61b8('0x27')]['id'],![],_0x4d47f6,_0x4d9fd9['id']);if(rpc[_0x48f144[_0x61b8('0x22')]+_0x61b8('0x2e')]){return rpc[_0x48f144[_0x61b8('0x22')]+_0x61b8('0x2e')][_0x61b8('0x33')](_0x11920b,_0x72c066)[_0x61b8('0x2f')](function(_0x30256d){logger[_0x61b8('0x34')](_0x61b8('0x35'));});}}}function endRouting(_0x476107,_0x3dec40,_0x14b1f1,_0x3bf631){if(_0x476107&&_0x3dec40){_0x3dec40[_0x61b8('0x30')]-=0x1;var _0x22374b={'leaveAt':moment()['format'](_0x61b8('0x31')),'exitAt':moment()[_0x61b8('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x61b8('0x36')};logger[_0x61b8('0x2b')](util[_0x61b8('0x12')](_0x61b8('0x37'),_0x476107,_0x3dec40[_0x61b8('0x2d')]));emitChannelQueueInteraction(_0x14b1f1[_0x61b8('0x22')],_0x3dec40[_0x61b8('0x2d')],_0x14b1f1[_0x61b8('0x1e')],_0x14b1f1[_0x61b8('0xa')][_0x61b8('0x2d')],_0x14b1f1[_0x61b8('0x27')]['id'],![],_0x3bf631);if(rpc[_0x14b1f1[_0x61b8('0x22')]+_0x61b8('0x2e')]){return rpc[_0x14b1f1['channel']+_0x61b8('0x2e')][_0x61b8('0x33')](_0x476107,_0x22374b)['catch'](function(_0x1ee377){logger[_0x61b8('0x34')](_0x61b8('0x35'));});}}}function handleFindQueue(_0x24110a){return function(_0x79b044){return _0x79b044[_0x61b8('0x2d')][_0x61b8('0x38')]()===_0x24110a[_0x61b8('0x38')]();};}exports[_0x61b8('0x39')]=function(_0x3bbd69,_0x32431e,_0x13ddd3,_0x283cbc){return function(_0x3865f1){try{var _0x3d2424={'name':_0x32431e[0x0],'timeout':_0x32431e[0x1]};var _0x290386=queue['validate'](_0x3d2424,{'typecast':!![]});if(_0x290386[_0x61b8('0x3a')]){logger[_0x61b8('0x34')](_0x61b8('0x3b'),_0x3bbd69,_[_0x61b8('0x3c')](_0x290386,_0x61b8('0x27'))[_0x61b8('0x3d')](',\x20'));_0x3865f1[_0x61b8('0x3e')]();}else{var _0x5c80ba=_['find'](_0x13ddd3[_0x283cbc[_0x61b8('0x22')]+'Queues'],handleFindQueue(_0x3d2424[_0x61b8('0x2d')]));if(_0x5c80ba){startRouting(_0x3bbd69,_0x5c80ba,_0x283cbc,_0x13ddd3);var _0x2619eb=(_0x5c80ba[_0x61b8('0x36')]||0xa)*0x3e8;var _0x3514cf=(_0x3d2424[_0x61b8('0x36')]||0x14)*0x3e8;var _0x40148a;if(_0x2619eb>_0x3514cf){_0x3514cf=_0x2619eb;}var _0x304ead=seqqueue['createQueue'](_0x2619eb);_0x304ead['id']=_0x3bbd69;_0x304ead[_0x61b8('0x3f')]=_0x2619eb;_0x304ead[_0x61b8('0x40')]=_0x3514cf;_0x304ead['channel']=_0x283cbc[_0x61b8('0x22')];_0x13ddd3[_0x61b8('0x41')][_0x3bbd69]['on'](_0x61b8('0x42'),function(){logger['info'](_0x61b8('0x43'),_0x3bbd69);stopRouting(_0x3bbd69,_0x5c80ba,_0x283cbc,_0x13ddd3);clearTimeout(_0x40148a);_0x40148a=undefined;_0x304ead[_0x61b8('0x44')](!![]);if(_0x13ddd3['rules'][_0x3bbd69]){delete _0x13ddd3[_0x61b8('0x41')][_0x3bbd69];}_0x3865f1[_0x61b8('0x3e')]();});_0x13ddd3[_0x61b8('0x41')][_0x3bbd69]['on'](_0x61b8('0x45'),function(){if(_0x13ddd3[_0x61b8('0x41')][_0x3bbd69]){delete _0x13ddd3[_0x61b8('0x41')][_0x3bbd69];}});_0x40148a=setTimeout(function(){logger[_0x61b8('0x2b')](_0x61b8('0x46'),_0x3bbd69);endRouting(_0x3bbd69,_0x5c80ba,_0x283cbc,_0x13ddd3);clearTimeout(_0x40148a);_0x304ead['close'](!![]);_0x3865f1[_0x61b8('0x47')]();},_0x3514cf);switch(_0x5c80ba[_0x61b8('0x48')]){case _0x61b8('0x49'):strategy[_0x61b8('0x49')](_0x304ead,_0x5c80ba,_0x13ddd3,_0x283cbc);break;default:strategy[_0x61b8('0x4a')](_0x304ead,_0x5c80ba,_0x13ddd3,_0x283cbc);}}else{logger[_0x61b8('0x34')](_0x61b8('0x4b'),_0x3bbd69,_0x3d2424['name']);_0x3865f1['stop']();}}}catch(_0x1c973c){console['log'](_0x1c973c);logger[_0x61b8('0x34')]('[%s][QUEUE]\x20%s',_0x3bbd69,_0x1c973c[_0x61b8('0x4c')]);_0x3865f1[_0x61b8('0x3e')]();}};}; \ 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 95c7177..3da4d6c 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 _0xcb66=['prototype','[%s][AGENT]\x20try\x20with\x20%s','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','realtime','agents','busy','busyQueue','saveWaitingNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x570a3d,_0x17b25a){var _0x5a0e92=function(_0x308277){while(--_0x308277){_0x570a3d['push'](_0x570a3d['shift']());}};_0x5a0e92(++_0x17b25a);}(_0xcb66,0x19f));var _0x6cb6=function(_0x510b98,_0x4c4cbb){_0x510b98=_0x510b98-0x0;var _0x45e775=_0xcb66[_0x510b98];return _0x45e775;};'use strict';var _=require('lodash');var uuid=require(_0x6cb6('0x0'));var util=require(_0x6cb6('0x1'));var logger=require(_0x6cb6('0x2'))(_0x6cb6('0x3'));var Agent=function(_0x205243,_0x56618a,_0xe996ed,_0x2d7dbb){this[_0x6cb6('0x4')]=uuid['v4']();this[_0x6cb6('0x5')]=_0x205243;this[_0x6cb6('0x6')]=_0x56618a;this['realtime']=_0xe996ed;this['routing']=_0x2d7dbb;this[_0x6cb6('0x5')][_0x6cb6('0x7')](this[_0x6cb6('0x8')][_0x6cb6('0x9')](this),this[_0x6cb6('0xa')][_0x6cb6('0x9')](this));this[_0x6cb6('0x5')]['on'](_0x6cb6('0xb'),this[_0x6cb6('0xa')][_0x6cb6('0x9')](this));this[_0x6cb6('0x5')]['on'](_0x6cb6('0xc'),this[_0x6cb6('0xd')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue'][_0x6cb6('0x7')](this[_0x6cb6('0x8')][_0x6cb6('0x9')](this),this[_0x6cb6('0xa')]['bind'](this));};Agent[_0x6cb6('0xe')][_0x6cb6('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0x6cb6('0xe')][_0x6cb6('0x8')]=function(){logger['debug'](_0x6cb6('0xf'),this[_0x6cb6('0x5')]['id'],this['agent']['id']);if(_['isNil'](this['realtime']['agents'][this[_0x6cb6('0x6')]['id']])){logger[_0x6cb6('0x10')](_0x6cb6('0x11'),this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);setTimeout(this[_0x6cb6('0x7')]['bind'](this),0x3e8);}else{if(this[_0x6cb6('0x3')][_0x6cb6('0x12')]||util['isAgentAvailable'](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],this['squeue'][_0x6cb6('0x13')],![])){this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x16')]=!![];this['realtime']['agents'][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x17')]=undefined;util[_0x6cb6('0x18')](this[_0x6cb6('0x14')],this['routing'],this[_0x6cb6('0x6')],this[_0x6cb6('0x5')]['channel']);util['showNotification'](this[_0x6cb6('0x4')],this['squeue']['id'],this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']],null,this[_0x6cb6('0x3')]);util[_0x6cb6('0x19')](this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']],_0x6cb6('0x1a')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger[_0x6cb6('0x10')](_0x6cb6('0x1b'),this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);setTimeout(this[_0x6cb6('0x7')][_0x6cb6('0x9')](this),0x3e8);}}};Agent['prototype'][_0x6cb6('0xa')]=function(_0x4d4ad9){if(_[_0x6cb6('0x1c')](this['realtime'][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']])){return logger[_0x6cb6('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);}else{logger[_0x6cb6('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x6')]['id']);util[_0x6cb6('0x1d')](this['notificationId'],this[_0x6cb6('0x5')]['id'],this[_0x6cb6('0x14')]['agents'][this[_0x6cb6('0x6')]['id']],null,this[_0x6cb6('0x3')]);this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x16')]=![];this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']][_0x6cb6('0x17')]=undefined;util['removeWaitingNotification'](this[_0x6cb6('0x14')],this[_0x6cb6('0x3')],this[_0x6cb6('0x6')],this[_0x6cb6('0x5')]['channel']);util['writeLog'](this['squeue']['id'],this[_0x6cb6('0x14')][_0x6cb6('0x15')][this[_0x6cb6('0x6')]['id']],_0x4d4ad9?_0x6cb6('0x1e'):_0x6cb6('0x1f'));}if(!_0x4d4ad9){setTimeout(this[_0x6cb6('0x7')][_0x6cb6('0x9')](this),0x3e8);}};function agent(_0x950248,_0x4bbecb,_0x44d970,_0x559b1d){return new Agent(_0x950248,_0x4bbecb,_0x44d970,_0x559b1d);}module[_0x6cb6('0x20')]=agent; \ No newline at end of file +var _0x4bc3=['hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','bind','handleTimeout','timeout','drained','handleDrained','push','handleRun','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','busy','busyQueue','saveWaitingNotification','channel','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x2cb2c8,_0x407464){var _0x5b5457=function(_0x1610a9){while(--_0x1610a9){_0x2cb2c8['push'](_0x2cb2c8['shift']());}};_0x5b5457(++_0x407464);}(_0x4bc3,0x16e));var _0x34bc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x4bc3[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0x34bc('0x0'));var uuid=require(_0x34bc('0x1'));var util=require('./util');var logger=require(_0x34bc('0x2'))(_0x34bc('0x3'));var Agent=function(_0x5b45c7,_0x178fc0,_0x616014,_0x3ce1c3){this[_0x34bc('0x4')]=uuid['v4']();this[_0x34bc('0x5')]=_0x5b45c7;this[_0x34bc('0x6')]=_0x178fc0;this[_0x34bc('0x7')]=_0x616014;this['routing']=_0x3ce1c3;this[_0x34bc('0x5')]['push'](this['handleRun'][_0x34bc('0x8')](this),this[_0x34bc('0x9')][_0x34bc('0x8')](this));this[_0x34bc('0x5')]['on'](_0x34bc('0xa'),this[_0x34bc('0x9')]['bind'](this));this['squeue']['on'](_0x34bc('0xb'),this[_0x34bc('0xc')][_0x34bc('0x8')](this));};Agent['prototype'][_0x34bc('0xd')]=function(){this['squeue'][_0x34bc('0xd')](this[_0x34bc('0xe')][_0x34bc('0x8')](this),this['handleTimeout'][_0x34bc('0x8')](this));};Agent['prototype'][_0x34bc('0xc')]=function(){this[_0x34bc('0x9')](!![]);};Agent[_0x34bc('0xf')]['handleRun']=function(){logger['debug'](_0x34bc('0x10'),this['squeue']['id'],this[_0x34bc('0x6')]['id']);if(_[_0x34bc('0x11')](this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']])){logger[_0x34bc('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}else{if(this[_0x34bc('0x3')][_0x34bc('0x14')]||util['isAgentAvailable'](this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')]['agents'][this[_0x34bc('0x6')]['id']],this[_0x34bc('0x5')]['channel'],![])){this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']][_0x34bc('0x15')]=!![];this[_0x34bc('0x7')][_0x34bc('0x12')][this['agent']['id']][_0x34bc('0x16')]=undefined;util[_0x34bc('0x17')](this[_0x34bc('0x7')],this['routing'],this['agent'],this[_0x34bc('0x5')][_0x34bc('0x18')]);util[_0x34bc('0x19')](this[_0x34bc('0x4')],this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],null,this[_0x34bc('0x3')]);util[_0x34bc('0x1a')](this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')]['agents'][this[_0x34bc('0x6')]['id']],'RINGING'+(this['routing'][_0x34bc('0x14')]?':FORCED':''));}else{logger[_0x34bc('0x13')](_0x34bc('0x1b'),this[_0x34bc('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}}};Agent[_0x34bc('0xf')][_0x34bc('0x9')]=function(_0x2bb874){if(_[_0x34bc('0x11')](this['realtime'][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']])){return logger[_0x34bc('0x13')](_0x34bc('0x1c'),this[_0x34bc('0x5')]['id'],this[_0x34bc('0x6')]['id']);}else{logger['debug'](_0x34bc('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x34bc('0x1e')](this['notificationId'],this[_0x34bc('0x5')]['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],null,this[_0x34bc('0x3')]);this[_0x34bc('0x7')][_0x34bc('0x12')][this['agent']['id']][_0x34bc('0x15')]=![];this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']][_0x34bc('0x16')]=undefined;util['removeWaitingNotification'](this[_0x34bc('0x7')],this[_0x34bc('0x3')],this[_0x34bc('0x6')],this[_0x34bc('0x5')][_0x34bc('0x18')]);util['writeLog'](this['squeue']['id'],this[_0x34bc('0x7')][_0x34bc('0x12')][this[_0x34bc('0x6')]['id']],_0x2bb874?_0x34bc('0x1f'):'TIMEOUT');}if(!_0x2bb874){setTimeout(this[_0x34bc('0xd')][_0x34bc('0x8')](this),0x3e8);}};function agent(_0x32cf3b,_0x5b6acd,_0x37cd30,_0x42d1eb){return new Agent(_0x32cf3b,_0x5b6acd,_0x37cd30,_0x42d1eb);}module[_0x34bc('0x20')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index 725e3ef..7e27f11 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 _0x44c7=['isAgentAvailable','channel','realtime','RINGING','busyQueue','name','saveWaitingNotification','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','writeLog','STOP','busy','exports','lodash','./util','../../../../../config/logger','routing','squeue','queue','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','push','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x44c7,0x1a6));var _0x744c=function(_0x14e089,_0x3996f6){_0x14e089=_0x14e089-0x0;var _0x441ba3=_0x44c7[_0x14e089];return _0x441ba3;};'use strict';var _=require(_0x744c('0x0'));var uuid=require('uuid');var util=require(_0x744c('0x1'));var logger=require(_0x744c('0x2'))(_0x744c('0x3'));var Beepall=function(_0x45261a,_0x4bd6bd,_0x3d8843,_0x4f73b0){this['notificationId']=uuid['v4']();this[_0x744c('0x4')]=_0x45261a;this[_0x744c('0x5')]=_0x4bd6bd;this['realtime']=_0x3d8843;this['routing']=_0x4f73b0;this['squeue']['push'](this[_0x744c('0x6')]['bind'](this),this[_0x744c('0x7')][_0x744c('0x8')](this));this[_0x744c('0x4')]['on'](_0x744c('0x9'),this[_0x744c('0x7')][_0x744c('0x8')](this));this[_0x744c('0x4')]['on'](_0x744c('0xa'),this[_0x744c('0xb')]['bind'](this));};Beepall[_0x744c('0xc')][_0x744c('0xd')]=function(){this['squeue'][_0x744c('0xd')](this[_0x744c('0x6')][_0x744c('0x8')](this),this[_0x744c('0x7')][_0x744c('0x8')](this));};Beepall[_0x744c('0xc')][_0x744c('0xb')]=function(){this[_0x744c('0x7')](!![]);};Beepall['prototype'][_0x744c('0x6')]=function(){var _0x580583=!![];if(!_[_0x744c('0xe')](this[_0x744c('0x5')])&&!_[_0x744c('0xe')](this[_0x744c('0x5')][_0x744c('0xf')])&&this[_0x744c('0x5')][_0x744c('0xf')][_0x744c('0x10')]>0x0){for(var _0x3f8dfc=0x0,_0x1e44b6;_0x3f8dfc0x0){for(var _0x251dfc=0x0,_0x51a66c;_0x251dfc0x0&&_0x1e5676[_0x2e327f+_0xe8e4('0x1e')]>=_0x1e5676[_0x2e327f+_0xe8e4('0x1f')]){writeLog(_0x31522c,_0x1e5676,_0x2e327f['toUpperCase']()+_0xe8e4('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x414fd2,_0x5eb587,_0x2cbe9b,_0xc60d18,_0x1518c3){return sendNotification(!![],_0x414fd2,_0x5eb587,_0x2cbe9b,_0xc60d18,_0x1518c3);};exports[_0xe8e4('0x21')]=function(_0x5f4e27,_0x4976d5,_0x28aaa1,_0x412113,_0x316c39){return sendNotification(![],_0x5f4e27,_0x4976d5,_0x28aaa1,_0x412113,_0x316c39);};exports['checkWaitingNotifications']=function(_0x565f48,_0xdaccf6,_0x46dc47){var _0x1e7ac7=_0xdaccf6['interaction'][_0xe8e4('0x22')];if(!_0x1e7ac7&&_0x46dc47){_0x1e7ac7=_0x46dc47['id'];}var _0x171d7d=_[_0xe8e4('0x23')](_0x565f48[_0xdaccf6[_0xe8e4('0x24')]+'QueuesWaitingInteractions'],function(_0x162a49){var _0x1602f1=_['capitalize'](_0xdaccf6['channel'])+_0xe8e4('0x25');return _0x162a49[_0x1602f1]===_0xdaccf6['interaction']['id'];});if(!_0x171d7d&&_0x1e7ac7){_0x171d7d=_['some'](_0x565f48['agents'][_0x1e7ac7][_0xdaccf6[_0xe8e4('0x24')]+_0xe8e4('0x26')],function(_0x174bff){return _0x174bff['id']===_0xdaccf6[_0xe8e4('0x27')]['id'];});}return _0x171d7d;};exports[_0xe8e4('0x28')]=function(_0x1ba4e1,_0x4f8378,_0x550b25,_0x3f2c4d){_0x1ba4e1['agents'][_0x550b25['id']][_0x3f2c4d+_0xe8e4('0x26')][_0x4f8378[_0xe8e4('0x14')]['id']]={'id':_0x4f8378['interaction']['id']};};exports[_0xe8e4('0x29')]=function(_0x1d05cd,_0x5d0fce,_0xd976aa,_0x1a5549){delete _0x1d05cd['agents'][_0xd976aa['id']][_0x1a5549+'WaitingInteractions'][_0x5d0fce['message']['id']];};exports[_0xe8e4('0x2a')]=writeLog; \ No newline at end of file +var _0x2419=['../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','name','emit','user:save','split','account','notificationSound','notificationShake','body','queue','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','message','notification:%s','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','\x20MAXCAPACITY','hideNotification','checkWaitingNotifications','interaction','capitalize','channel','InteractionId','some','agents','WaitingInteractions','saveWaitingNotification','writeLog','lodash','../utils','ioredis','../../../../../config/environment'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x2419,0xc0));var _0x9241=function(_0x3141ff,_0x573b81){_0x3141ff=_0x3141ff-0x0;var _0x18cd0c=_0x2419[_0x3141ff];return _0x18cd0c;};'use strict';var _=require(_0x9241('0x0'));var util=require('util');var utils=require(_0x9241('0x1'));var Redis=require(_0x9241('0x2'));var config=require(_0x9241('0x3'));var logger=require(_0x9241('0x4'))(_0x9241('0x5'));config[_0x9241('0x6')]=_[_0x9241('0x7')](config[_0x9241('0x6')],{'host':_0x9241('0x8'),'port':0x18eb});var io=require(_0x9241('0x9'))(new Redis(config['redis']));function sendNotification(_0x42e73e,_0x184908,_0x46a7d3,_0x14b52c,_0x6b7cff,_0x158a47){io['to'](util[_0x9241('0xa')](_0x9241('0xb'),_0x14b52c[_0x9241('0xc')]))[_0x9241('0xd')](_0x9241('0xe'),_0x14b52c);var _0x4dbbac=_0x158a47||{};var _0x23a40d=_0x46a7d3[_0x9241('0xf')]('.');var _0x40bf29={'uniqueid':_0x184908,'channel':_0x23a40d[0x0],'id':_0x23a40d[0x1],'title':_0x23a40d[0x0]+'\x20interaction','interactionId':_0x23a40d[0x2],'queue':_0x6b7cff?_0x6b7cff[_0x9241('0xc')]:null,'sound':_0x4dbbac[_0x9241('0x10')][_0x9241('0x11')],'shake':_0x4dbbac['account'][_0x9241('0x12')]};try{if(!_0x4dbbac[_0x9241('0x13')]){_0x4dbbac[_0x9241('0x13')]={};}if(_0x6b7cff){_0x4dbbac['body'][_0x9241('0x14')]=_0x6b7cff;}else if(_0x4dbbac[_0x9241('0x13')]['queue']){delete _0x4dbbac[_0x9241('0x13')][_0x9241('0x14')];}_0x40bf29['msg']=utils[_0x9241('0x15')](_0x4dbbac['account'][_0x9241('0x16')],_0x4dbbac);}catch(_0xe77bad){_0x40bf29['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x9241('0x17')](util[_0x9241('0xa')](_0x9241('0x18'),_0x184908,_0xe77bad[_0x9241('0x19')]));}io['to'](util[_0x9241('0xa')](_0x9241('0xb'),_0x14b52c[_0x9241('0xc')]))['emit'](util[_0x9241('0xa')](_0x9241('0x1a'),_0x42e73e?'save':_0x9241('0x1b')),_0x40bf29);}function writeLog(_0x2783a3,_0xc66f63,_0x1fadbe){return logger[_0x9241('0x1c')](util[_0x9241('0xa')](_0x9241('0x1d'),_0x2783a3,_0xc66f63[_0x9241('0xc')],_0x1fadbe));}exports[_0x9241('0x1e')]=function(_0x72d0f9,_0xf3c129,_0x3e4064,_0x2c7664){if(_0xf3c129[_0x9241('0x1f')]){writeLog(_0x72d0f9,_0xf3c129,'BUSY');return![];}if(!_0xf3c129[_0x9241('0x20')]){writeLog(_0x72d0f9,_0xf3c129,'OFFLINE');return![];}if(_0xf3c129[_0x3e4064+'Pause']){writeLog(_0x72d0f9,_0xf3c129,_0x9241('0x21'));return![];}if(_0x2c7664&&_0xf3c129['hasOwnProperty'](_0x3e4064+_0x9241('0x22'))&&_0xf3c129[_0x9241('0x23')](_0x3e4064+'CurrentCapacity')){if(_0xf3c129[_0x3e4064+_0x9241('0x22')]>0x0&&_0xf3c129[_0x3e4064+_0x9241('0x24')]>=_0xf3c129[_0x3e4064+'Capacity']){writeLog(_0x72d0f9,_0xf3c129,_0x3e4064['toUpperCase']()+_0x9241('0x25'));return![];}}return!![];};exports['showNotification']=function(_0x1de178,_0x178527,_0x26bacc,_0x296dbc,_0x3db3a9){return sendNotification(!![],_0x1de178,_0x178527,_0x26bacc,_0x296dbc,_0x3db3a9);};exports[_0x9241('0x26')]=function(_0x5e2707,_0x461e84,_0x19c6e4,_0x1e4863,_0x21d93a){return sendNotification(![],_0x5e2707,_0x461e84,_0x19c6e4,_0x1e4863,_0x21d93a);};exports[_0x9241('0x27')]=function(_0x4b69fc,_0x2f807b,_0x5c6264){var _0x196515=_0x2f807b[_0x9241('0x28')]['UserId'];if(!_0x196515&&_0x5c6264){_0x196515=_0x5c6264['id'];}var _0x360c42=_['some'](_0x4b69fc[_0x2f807b['channel']+'QueuesWaitingInteractions'],function(_0x487a23){var _0x5c59bf=_[_0x9241('0x29')](_0x2f807b[_0x9241('0x2a')])+_0x9241('0x2b');return _0x487a23[_0x5c59bf]===_0x2f807b[_0x9241('0x28')]['id'];});if(!_0x360c42&&_0x196515){_0x360c42=_[_0x9241('0x2c')](_0x4b69fc[_0x9241('0x2d')][_0x196515][_0x2f807b[_0x9241('0x2a')]+_0x9241('0x2e')],function(_0x263f6b){return _0x263f6b['id']===_0x2f807b[_0x9241('0x28')]['id'];});}return _0x360c42;};exports[_0x9241('0x2f')]=function(_0x39d20f,_0x33bce6,_0x3d6376,_0x10066d){_0x39d20f[_0x9241('0x2d')][_0x3d6376['id']][_0x10066d+'WaitingInteractions'][_0x33bce6[_0x9241('0x19')]['id']]={'id':_0x33bce6[_0x9241('0x28')]['id']};};exports['removeWaitingNotification']=function(_0xaae7f3,_0x1d7361,_0x13a460,_0x54205b){delete _0xaae7f3['agents'][_0x13a460['id']][_0x54205b+_0x9241('0x2e')][_0x1d7361['message']['id']];};exports[_0x9241('0x30')]=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 18cc533..2f2cb30 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 _0x9751=['length','error','[%s][SYSTEM]\x20%s','message','join','info','next','[%s][SYSTEM]\x20commnad:\x20%s','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','./utils','../../../../config/logger','string'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x9751,0x145));var _0x1975=function(_0x3d2f87,_0xa9f93a){_0x3d2f87=_0x3d2f87-0x0;var _0x45e78c=_0x9751[_0x3d2f87];return _0x45e78c;};'use strict';var schema=require(_0x1975('0x0'));var sh=require(_0x1975('0x1'));var _=require('lodash');var utils=require(_0x1975('0x2'));var logger=require(_0x1975('0x3'))('routing');var system=schema({'command':{'type':_0x1975('0x4'),'required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x230ced,_0x2ef1c9){return function(_0x5a64b1){try{var _0x58150d={'command':_0x2ef1c9[0x0]};var _0x38e297=system[_0x1975('0x0')](_0x58150d,{'typecast':!![]});if(_0x38e297[_0x1975('0x5')]){logger[_0x1975('0x6')](_0x1975('0x7'),_0x230ced,_['map'](_0x38e297,_0x1975('0x8'))[_0x1975('0x9')](',\x20'));logger[_0x1975('0xa')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x230ced);_0x5a64b1[_0x1975('0xb')]();}else{var _0x24ea5e=this;var _0x1e4dfa=utils['getMustacheRender'](_0x2ef1c9[0x0],this);logger['info'](_0x1975('0xc'),_0x230ced,_0x1e4dfa);sh['exec'](_['trim'](_0x1e4dfa),function(_0x3e6913,_0x3090b7){logger[_0x1975('0xa')](_0x1975('0xd'),_0x230ced,_0x3e6913);if(_0x3e6913==0x0){var _0x4e8a1e=_0x3090b7[_0x1975('0xe')](/(\r\n|\n|\r)/gm,'');if(_[_0x1975('0xf')](_0x2ef1c9[0x1])||_[_0x1975('0x10')](_0x2ef1c9[0x1])){logger['info'](_0x1975('0x11'),_0x230ced);_0x24ea5e[_0x1975('0x12')][_0x2ef1c9[0x1]]=_0x4e8a1e;}else{logger[_0x1975('0xa')](_0x1975('0x13'),_0x230ced,_0x2ef1c9[0x1],_0x4e8a1e);_0x24ea5e[_0x1975('0x12')][_0x2ef1c9[0x1]]=_0x4e8a1e;}}_0x5a64b1[_0x1975('0xb')]();});}}catch(_0x4b62db){logger[_0x1975('0x6')](_0x1975('0x7'),_0x230ced,_['isObject'](_0x4b62db)?JSON[_0x1975('0x14')](_0x4b62db):_0x4b62db);logger[_0x1975('0xa')](_0x1975('0x15'),_0x230ced);_0x5a64b1[_0x1975('0xb')]();}};}; \ No newline at end of file +var _0xa5fd=['consequence','length','error','[%s][SYSTEM]\x20%s','message','next','getMustacheRender','info','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','stringify','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x399056,_0x2672b4){var _0xea2e6d=function(_0x40a52e){while(--_0x40a52e){_0x399056['push'](_0x399056['shift']());}};_0xea2e6d(++_0x2672b4);}(_0xa5fd,0x90));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0xda5f('0x0'));var sh=require('shelljs');var _=require(_0xda5f('0x1'));var utils=require(_0xda5f('0x2'));var logger=require(_0xda5f('0x3'))('routing');var system=schema({'command':{'type':_0xda5f('0x4'),'required':!![],'message':_0xda5f('0x5')}});exports[_0xda5f('0x6')]=function(_0x76ad13,_0x4f1d99){return function(_0x52d92f){try{var _0x372ee6={'command':_0x4f1d99[0x0]};var _0x2798db=system[_0xda5f('0x0')](_0x372ee6,{'typecast':!![]});if(_0x2798db[_0xda5f('0x7')]){logger[_0xda5f('0x8')](_0xda5f('0x9'),_0x76ad13,_['map'](_0x2798db,_0xda5f('0xa'))['join'](',\x20'));logger['info']('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x76ad13);_0x52d92f[_0xda5f('0xb')]();}else{var _0x5cfad5=this;var _0x20e9cf=utils[_0xda5f('0xc')](_0x4f1d99[0x0],this);logger[_0xda5f('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x76ad13,_0x20e9cf);sh[_0xda5f('0xe')](_[_0xda5f('0xf')](_0x20e9cf),function(_0x1386fc,_0x5311b6){logger['info'](_0xda5f('0x10'),_0x76ad13,_0x1386fc);if(_0x1386fc==0x0){var _0x307e91=_0x5311b6[_0xda5f('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xda5f('0x12')](_0x4f1d99[0x1])||_['isEmpty'](_0x4f1d99[0x1])){logger[_0xda5f('0xd')](_0xda5f('0x13'),_0x76ad13);_0x5cfad5['body'][_0x4f1d99[0x1]]=_0x307e91;}else{logger[_0xda5f('0xd')](_0xda5f('0x14'),_0x76ad13,_0x4f1d99[0x1],_0x307e91);_0x5cfad5[_0xda5f('0x15')][_0x4f1d99[0x1]]=_0x307e91;}}_0x52d92f[_0xda5f('0xb')]();});}}catch(_0xddb4af){logger[_0xda5f('0x8')](_0xda5f('0x9'),_0x76ad13,_[_0xda5f('0x16')](_0xddb4af)?JSON[_0xda5f('0x17')](_0xddb4af):_0xddb4af);logger[_0xda5f('0xd')](_0xda5f('0x18'),_0x76ad13);_0x52d92f[_0xda5f('0xb')]();}};}; \ 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 491f615..343eb41 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 _0xfead=['finally','isObject','stringify','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','message','join','info','next','Interaction','channel','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xfead,0x18b));var _0xdfea=function(_0x22d76c,_0x1feded){_0x22d76c=_0x22d76c-0x0;var _0x9cc8fb=_0xfead[_0x22d76c];return _0x9cc8fb;};'use strict';var schema=require(_0xdfea('0x0'));var _=require(_0xdfea('0x1'));var rpc={'chatInteraction':require(_0xdfea('0x2')),'openchannelInteraction':require(_0xdfea('0x3')),'smsInteraction':require(_0xdfea('0x4')),'mailInteraction':require(_0xdfea('0x5')),'faxInteraction':require(_0xdfea('0x6')),'whatsappInteraction':require(_0xdfea('0x7'))};var logger=require(_0xdfea('0x8'))('routing');var tag=schema({'tag':{'type':_0xdfea('0x9'),'required':!![],'message':_0xdfea('0xa')}});exports['consequence']=function(_0x4e1335,_0x3ac340,_0x3a0643,_0x5192aa){return function(_0x2b32ff){try{var _0x3baea4={'tag':_0x3ac340[0x0]};var _0x2a17eb=tag['validate'](_0x3baea4,{'typecast':!![]});if(_0x2a17eb['length']){logger[_0xdfea('0xb')]('[%s][TAG]\x20%s',_0x4e1335,_[_0xdfea('0xc')](_0x2a17eb,_0xdfea('0xd'))[_0xdfea('0xe')](',\x20'));logger[_0xdfea('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x4e1335);_0x2b32ff[_0xdfea('0x10')]();}else{var _0x49064f={'ids':[_0x3ac340[0x0]]};if(rpc[_0x5192aa['channel']+_0xdfea('0x11')]){rpc[_0x5192aa[_0xdfea('0x12')]+_0xdfea('0x11')]['addTags'](_0x5192aa[_0xdfea('0x13')]['id'],_0x49064f)[_0xdfea('0x14')](function(_0x3fc54d){logger[_0xdfea('0xf')](_0xdfea('0x15'),_0x4e1335,_0x3ac340[0x1],_0x5192aa[_0xdfea('0x12')],_0x5192aa[_0xdfea('0x13')]['id']);})[_0xdfea('0x16')](function(_0x5b2c7d){logger[_0xdfea('0xb')](_0xdfea('0x17'),_0x4e1335,JSON['stringify'](_0x5b2c7d));logger[_0xdfea('0xf')](_0xdfea('0x18'),_0x4e1335);})[_0xdfea('0x19')](function(){_0x2b32ff[_0xdfea('0x10')]();});}}}catch(_0x1901d0){logger['error'](_0xdfea('0x17'),_0x4e1335,_[_0xdfea('0x1a')](_0x1901d0)?JSON[_0xdfea('0x1b')](_0x1901d0):_0x1901d0);logger[_0xdfea('0xf')](_0xdfea('0x18'),_0x4e1335);_0x2b32ff['next']();}};}; \ No newline at end of file +var _0xf60f=['error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length'];(function(_0x2abf82,_0x45019f){var _0x2898fd=function(_0x48afb6){while(--_0x48afb6){_0x2abf82['push'](_0x2abf82['shift']());}};_0x2898fd(++_0x45019f);}(_0xf60f,0x85));var _0xff60=function(_0x3fdb78,_0x25fbb6){_0x3fdb78=_0x3fdb78-0x0;var _0x4edb8f=_0xf60f[_0x3fdb78];return _0x4edb8f;};'use strict';var schema=require(_0xff60('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xff60('0x1')),'openchannelInteraction':require(_0xff60('0x2')),'smsInteraction':require(_0xff60('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xff60('0x4')),'whatsappInteraction':require(_0xff60('0x5'))};var logger=require(_0xff60('0x6'))(_0xff60('0x7'));var tag=schema({'tag':{'type':_0xff60('0x8'),'required':!![],'message':_0xff60('0x9')}});exports[_0xff60('0xa')]=function(_0x31f4a4,_0x17108c,_0x1bc8c8,_0x51c50e){return function(_0x409fa2){try{var _0x16c8fb={'tag':_0x17108c[0x0]};var _0x46d7d5=tag[_0xff60('0x0')](_0x16c8fb,{'typecast':!![]});if(_0x46d7d5[_0xff60('0xb')]){logger[_0xff60('0xc')](_0xff60('0xd'),_0x31f4a4,_[_0xff60('0xe')](_0x46d7d5,_0xff60('0xf'))[_0xff60('0x10')](',\x20'));logger[_0xff60('0x11')](_0xff60('0x12'),_0x31f4a4);_0x409fa2[_0xff60('0x13')]();}else{var _0xd68bfe={'ids':[_0x17108c[0x0]]};if(rpc[_0x51c50e[_0xff60('0x14')]+'Interaction']){rpc[_0x51c50e[_0xff60('0x14')]+'Interaction'][_0xff60('0x15')](_0x51c50e[_0xff60('0x16')]['id'],_0xd68bfe)[_0xff60('0x17')](function(_0x1c1488){logger[_0xff60('0x11')](_0xff60('0x18'),_0x31f4a4,_0x17108c[0x1],_0x51c50e[_0xff60('0x14')],_0x51c50e[_0xff60('0x16')]['id']);})[_0xff60('0x19')](function(_0x19f3d4){logger[_0xff60('0xc')]('[%s][TAG]\x20%s',_0x31f4a4,JSON[_0xff60('0x1a')](_0x19f3d4));logger[_0xff60('0x11')](_0xff60('0x12'),_0x31f4a4);})[_0xff60('0x1b')](function(){_0x409fa2[_0xff60('0x13')]();});}}}catch(_0x4f3806){logger[_0xff60('0xc')](_0xff60('0xd'),_0x31f4a4,_[_0xff60('0x1c')](_0x4f3806)?JSON[_0xff60('0x1a')](_0x4f3806):_0x4f3806);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x31f4a4);_0x409fa2['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 50fea2f..0fc1eb8 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 _0x2f28=['jsonrpc','method','login','params','stringify','utf8','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','push','urlOnAnswer','?params=','urlOnRing','title'];(function(_0x1d2e5e,_0x145ae6){var _0x4a1d68=function(_0x3dd5b6){while(--_0x3dd5b6){_0x1d2e5e['push'](_0x1d2e5e['shift']());}};_0x4a1d68(++_0x145ae6);}(_0x2f28,0xfd));var _0x82f2=function(_0x3134ed,_0xaf0de3){_0x3134ed=_0x3134ed-0x0;var _0x5b974f=_0x2f28[_0x3134ed];return _0x5b974f;};'use strict';var rp=require(_0x82f2('0x0'));var logger=require(_0x82f2('0x1'))(_0x82f2('0x2'));var _=require(_0x82f2('0x3'));var arr=[];exports['consequence']=function(_0x440906,_0x2d92a5){return function(_0x2cdf72){var _0x580a5d=_0x2d92a5[0xa];var _0x154295=_0x2d92a5[0xb];var _0x17ec1c=_0x2d92a5[0xc];var _0x45c1f9=_0x2d92a5[0xd];var _0x3f2377=_0x2d92a5[0xe];var _0x1c0f2e=_0x2d92a5[0xf][_0x82f2('0x4')](/\n/g,_0x82f2('0x5'));var _0x219d53=_0x2d92a5[0x10][_0x82f2('0x4')](/\n/g,'\x20');if(!arr['includes'](_0x154295)){arr[_0x82f2('0x6')](_0x154295);var _0x311128=_0x2d92a5[0x3];var _0x1f06ab=_0x2d92a5[0x4];var _0xf574f6=_0x2d92a5[0x1];var _0x48eb99=_0x2d92a5[0x0];var _0x2983bd={};_0x2983bd[_0x82f2('0x7')]=_0x2d92a5[0x8]+_0x82f2('0x8')+_0x17ec1c+'|'+_0x580a5d+'|'+_0x45c1f9+'|'+_0x154295+'|'+_0x3f2377;_0x2983bd[_0x82f2('0x9')]=_0x2d92a5[0x7]+_0x82f2('0x8')+_0x17ec1c+'|'+_0x580a5d+'|'+_0x45c1f9+'|'+_0x154295+'|'+_0x3f2377+'|'+_0x1c0f2e+'|'+_0x219d53;_0x2983bd[_0x82f2('0xa')]=_0x2d92a5[0x9];var _0x2a5d69={};_0x2a5d69[_0x82f2('0xb')]='2.0';_0x2a5d69[_0x82f2('0xc')]=_0x82f2('0xd');var _0x26b729=[];_0x26b729['push'](_0x2d92a5[0x2]);_0x26b729[_0x82f2('0x6')](_0x2d92a5[0x5]);_0x26b729[_0x82f2('0x6')](_0x2d92a5[0x6]);_0x2a5d69[_0x82f2('0xe')]=_0x26b729;_0x2a5d69['id']=0x1;var _0x1a3bef=JSON[_0x82f2('0xf')](_0x2a5d69);var _0x7c2565={'encoding':_0x82f2('0x10'),'method':_0x82f2('0x11'),'timeout':0x2710,'url':_0x311128,'headers':{'Content-Type':'application/json-rpc'},'body':_0x1a3bef};return rp(_0x7c2565)[_0x82f2('0x12')](function(_0x229f28){const _0x141b22=JSON[_0x82f2('0x13')](_0x229f28);if(!_0x141b22[_0x82f2('0x14')][_0x82f2('0x15')]){throw new Error(_0x82f2('0x16'));}var _0x5e995a=_0x154295;var _0x1fe495='channelId='+_0xf574f6+_0x82f2('0x17')+_0x48eb99+'&sessionId='+_0x5e995a+_0x82f2('0x18')+JSON[_0x82f2('0xf')](_0x2983bd);var _0x6dac5d=_0x1f06ab+'?'+_0x1fe495;return rp(_0x6dac5d);})[_0x82f2('0x12')](function(_0x5137f6){logger[_0x82f2('0x19')](_0x82f2('0x1a'),_0x440906,_0x5137f6);_0x2cdf72[_0x82f2('0x1b')]();})[_0x82f2('0x1c')](function(_0x175a08){logger[_0x82f2('0x1d')](_0x82f2('0x1e'),_0x440906,_[_0x82f2('0x1f')](_0x175a08)?JSON[_0x82f2('0xf')](_0x175a08):_0x175a08);_0x2cdf72[_0x82f2('0x1b')]();});}else{logger[_0x82f2('0x19')](_0x82f2('0x20'),_0x440906);_0x2cdf72['next']();}};}; \ No newline at end of file +var _0xc5dd=['next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','push','?params=','urlOnRing','title','2.0','method','login','utf8','application/json-rpc','then','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','stringify'];(function(_0x37ef38,_0x2cfe4e){var _0x499daa=function(_0x18d0f5){while(--_0x18d0f5){_0x37ef38['push'](_0x37ef38['shift']());}};_0x499daa(++_0x2cfe4e);}(_0xc5dd,0x194));var _0xdc5d=function(_0x761f7d,_0x373e8){_0x761f7d=_0x761f7d-0x0;var _0x4bc9e2=_0xc5dd[_0x761f7d];return _0x4bc9e2;};'use strict';var rp=require(_0xdc5d('0x0'));var logger=require(_0xdc5d('0x1'))(_0xdc5d('0x2'));var _=require(_0xdc5d('0x3'));var arr=[];exports[_0xdc5d('0x4')]=function(_0x2f5423,_0x246d40){return function(_0x166d15){var _0x151982=_0x246d40[0xa];var _0x48ed4a=_0x246d40[0xb];var _0x206b27=_0x246d40[0xc];var _0x3dc896=_0x246d40[0xd];var _0x7990e2=_0x246d40[0xe];var _0x2c6939=_0x246d40[0xf]['replace'](/\n/g,_0xdc5d('0x5'));var _0x88fd67=_0x246d40[0x10][_0xdc5d('0x6')](/\n/g,'\x20');if(!arr[_0xdc5d('0x7')](_0x48ed4a)){arr[_0xdc5d('0x8')](_0x48ed4a);var _0x116314=_0x246d40[0x3];var _0x593294=_0x246d40[0x4];var _0x4389a1=_0x246d40[0x1];var _0x4f680b=_0x246d40[0x0];var _0x375a85={};_0x375a85['urlOnAnswer']=_0x246d40[0x8]+_0xdc5d('0x9')+_0x206b27+'|'+_0x151982+'|'+_0x3dc896+'|'+_0x48ed4a+'|'+_0x7990e2;_0x375a85[_0xdc5d('0xa')]=_0x246d40[0x7]+'?params='+_0x206b27+'|'+_0x151982+'|'+_0x3dc896+'|'+_0x48ed4a+'|'+_0x7990e2+'|'+_0x2c6939+'|'+_0x88fd67;_0x375a85[_0xdc5d('0xb')]=_0x246d40[0x9];var _0x524bf4={};_0x524bf4['jsonrpc']=_0xdc5d('0xc');_0x524bf4[_0xdc5d('0xd')]=_0xdc5d('0xe');var _0x2e2136=[];_0x2e2136['push'](_0x246d40[0x2]);_0x2e2136[_0xdc5d('0x8')](_0x246d40[0x5]);_0x2e2136['push'](_0x246d40[0x6]);_0x524bf4['params']=_0x2e2136;_0x524bf4['id']=0x1;var _0x3cbd74=JSON['stringify'](_0x524bf4);var _0x2ee946={'encoding':_0xdc5d('0xf'),'method':'POST','timeout':0x2710,'url':_0x116314,'headers':{'Content-Type':_0xdc5d('0x10')},'body':_0x3cbd74};return rp(_0x2ee946)[_0xdc5d('0x11')](function(_0x80e146){const _0x2ee57c=JSON['parse'](_0x80e146);if(!_0x2ee57c[_0xdc5d('0x12')][_0xdc5d('0x13')]){throw new Error(_0xdc5d('0x14'));}var _0x2a09ca=_0x48ed4a;var _0xebd45f=_0xdc5d('0x15')+_0x4389a1+'&serviceId='+_0x4f680b+_0xdc5d('0x16')+_0x2a09ca+_0xdc5d('0x17')+JSON['stringify'](_0x375a85);var _0x510664=_0x593294+'?'+_0xebd45f;return rp(_0x510664);})[_0xdc5d('0x11')](function(_0x11bb3f){logger[_0xdc5d('0x18')](_0xdc5d('0x19'),_0x2f5423,_0x11bb3f);_0x166d15[_0xdc5d('0x1a')]();})[_0xdc5d('0x1b')](function(_0x3c7a28){logger[_0xdc5d('0x1c')]('[%s][TVOX]\x20%s',_0x2f5423,_['isObject'](_0x3c7a28)?JSON[_0xdc5d('0x1d')](_0x3c7a28):_0x3c7a28);_0x166d15[_0xdc5d('0x1a')]();});}else{logger['info']('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x2f5423);_0x166d15[_0xdc5d('0x1e')]();}};}; \ 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 dea66cd..f9504e3 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x5477c4,_0x274469){var _0x188261=function(_0x642d89){while(--_0x642d89){_0x5477c4['push'](_0x5477c4['shift']());}};_0x188261(++_0x274469);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file +var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0xe91037,_0x45e8c7){var _0x2a7d4e=function(_0x28f2d4){while(--_0x28f2d4){_0xe91037['push'](_0xe91037['shift']());}};_0x2a7d4e(++_0x45e8c7);}(_0xe706,0xa3));var _0x6e70=function(_0xe33b12,_0x2a9761){_0xe33b12=_0xe33b12-0x0;var _0x30699d=_0xe706[_0xe33b12];return _0x30699d;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 94d780f..cd5dbdc 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 _0x5367=['Intervals','interval','channel','message','interaction','isArray','applications','existsSync','join','app','toLowerCase','appdata','mail','push','slice','length','dialogflow','split','dialogflowv2','amazonlex','tag','TagId','tvox','account','notificationTemplate','ContactId','body','./interval','condition','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','Please\x20create\x20a\x20new\x20file\x20under','.js','rules','execute','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busy','end','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','values','find','chatQueues','loggedIn','name','waiting','mailQueues','available','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','listen','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','IntervalId','isNil','map'];(function(_0x2ae14b,_0x47446c){var _0x4a21a2=function(_0x24012e){while(--_0x24012e){_0x2ae14b['push'](_0x2ae14b['shift']());}};_0x4a21a2(++_0x47446c);}(_0x5367,0x187));var _0x7536=function(_0xe18f7c,_0x1b2fe7){_0xe18f7c=_0xe18f7c-0x0;var _0x34ef15=_0x5367[_0xe18f7c];return _0x34ef15;};'use strict';var _=require(_0x7536('0x0'));var util=require(_0x7536('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x7536('0x2'));var BPromise=require(_0x7536('0x3'));var utils=require(_0x7536('0x4'));var sUtils=require(_0x7536('0x5'));var logger=require(_0x7536('0x6'))(_0x7536('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x7536('0x8')),'chatQueueReport':require(_0x7536('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x7536('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x7536('0xb'));function getId(_0x48ac11,_0x5a8198,_0x4b219b){return util[_0x7536('0xc')](_0x7536('0xd'),_0x48ac11,_0x5a8198||0x0,_0x4b219b||0x0);}function getIntervals(_0x8b4cad,_0x409f62){var _0x368195=[];if(!_['isNil'](_0x409f62[_0x7536('0xe')])&&!_[_0x7536('0xf')](_0x8b4cad[_0x409f62[_0x7536('0xe')]])&&!_[_0x7536('0xf')](_0x8b4cad[_0x409f62[_0x7536('0xe')]]['Intervals'])){_0x368195=_[_0x7536('0x10')](_0x8b4cad[_0x409f62[_0x7536('0xe')]][_0x7536('0x11')],'interval');}else if(!_[_0x7536('0xf')](_0x409f62[_0x7536('0x12')])){_0x368195=[_0x409f62[_0x7536('0x12')]];}return _0x368195;}exports['listen']=function(_0x3bc992){_0x3bc992['rules']={};return new BPromise(function(_0x2ff931,_0x45a3e0){var _0x34435f={'Start':function(_0xc14865){var _0x5b7e2b=this;return new Promise(function(_0xc68a5a,_0x29b27f){if(_0xc14865){try{var _0x3e8d56=[];var _0x1ac2a5=getId(_0xc14865[_0x7536('0x13')],_0xc14865[_0x7536('0x14')]?_0xc14865[_0x7536('0x14')]['id']:0x0,_0xc14865[_0x7536('0x15')]?_0xc14865[_0x7536('0x15')]['id']:0x0);var _0x5d1ae0=sUtils['checkWaitingNotifications'](_0x3bc992,_0xc14865);if(!_0x5d1ae0&&_0xc14865['applications']&&_[_0x7536('0x16')](_0xc14865[_0x7536('0x17')])&&_0xc14865[_0x7536('0x17')]['length']){for(var _0x35d23f=0x0;_0x35d23f<_0xc14865['applications']['length'];_0x35d23f+=0x1){var _0x670d1=_0xc14865[_0x7536('0x17')][_0x35d23f];if(fs[_0x7536('0x18')](path[_0x7536('0x19')](__dirname,_0x7536('0x17'),_0x670d1[_0x7536('0x1a')]+'.js'))){var _0xb55e58=[];switch(_0x670d1['app'][_0x7536('0x1b')]()){case'autoreply':var _0x34eb8f=_0x670d1[_0x7536('0x1c')]['split'](',');if(_0xc14865[_0x7536('0x13')]===_0x7536('0x1d')){_0xb55e58['push'](_0x34eb8f[0x0]);_0xb55e58[_0x7536('0x1e')](_0x34eb8f[0x1]);_0xb55e58[_0x7536('0x1e')](_0x34eb8f[_0x7536('0x1f')](0x2,_0x34eb8f[_0x7536('0x20')])['join'](','));}else{_0xb55e58['push'](_0x34eb8f[0x0]);_0xb55e58[_0x7536('0x1e')](_0x34eb8f[_0x7536('0x1f')](0x1,_0x34eb8f[_0x7536('0x20')])['join'](','));}break;case _0x7536('0x21'):var _0xf59500=_0x670d1[_0x7536('0x1c')][_0x7536('0x22')](',');_0xb55e58[_0x7536('0x1e')](_0xf59500[0x0]);_0xb55e58[_0x7536('0x1e')](_0xf59500[0x1]);_0xb55e58[_0x7536('0x1e')](_0xf59500[_0x7536('0x1f')](0x2,_0xf59500[_0x7536('0x20')])[_0x7536('0x19')](','));break;case _0x7536('0x23'):var _0x2a1e06=_0x670d1['appdata'][_0x7536('0x22')](',');_0xb55e58['push'](_0x2a1e06[0x0]);_0xb55e58[_0x7536('0x1e')](_0x2a1e06[0x1]);_0xb55e58[_0x7536('0x1e')](_0x2a1e06[0x2]);_0xb55e58['push'](_0x2a1e06[0x3]);_0xb55e58[_0x7536('0x1e')](_0x2a1e06[_0x7536('0x1f')](0x4,_0x2a1e06[_0x7536('0x20')])[_0x7536('0x19')](','));break;case _0x7536('0x24'):var _0x55a2e6=_0x670d1['appdata'][_0x7536('0x22')](',');_0xb55e58['push'](_0x55a2e6[0x0]);_0xb55e58['push'](_0x55a2e6[0x1]);_0xb55e58['push'](_0x55a2e6[0x2]);_0xb55e58[_0x7536('0x1e')](_0x55a2e6[0x3]);_0xb55e58[_0x7536('0x1e')](_0x55a2e6[_0x7536('0x1f')](0x4,_0x55a2e6[_0x7536('0x20')])[_0x7536('0x19')](','));break;case _0x7536('0x14'):_0xb55e58['push'](_0x670d1[_0x7536('0x1c')]);break;case _0x7536('0x25'):_0xb55e58['push'](_0x670d1[_0x7536('0x26')]);_0xb55e58[_0x7536('0x1e')](_0x670d1['appdata']);break;case _0x7536('0x27'):var _0xd122cf=utils['getMustacheRender'](_0xc14865[_0x7536('0x28')][_0x7536('0x29')],_0xc14865);var _0x4bfa73=_0x670d1['appdata'][_0x7536('0x22')](',');_0xb55e58['push'](_0x4bfa73[0x0]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x1]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x2]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x3]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x4]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x5]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x6]);_0xb55e58['push'](_0x4bfa73[0x7]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x8]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0x9]);_0xb55e58[_0x7536('0x1e')](_0x4bfa73[0xa]);_0xb55e58['push'](_0xc14865[_0x7536('0x15')]['id']);_0xb55e58['push'](_0xc14865[_0x7536('0x14')]['id']);_0xb55e58['push'](_0x670d1['ChatWebsiteId']);_0xb55e58[_0x7536('0x1e')](_0xc14865[_0x7536('0x15')][_0x7536('0x2a')]);_0xb55e58[_0x7536('0x1e')](_0xc14865[_0x7536('0x2b')][_0x7536('0x2b')]);_0xb55e58[_0x7536('0x1e')](_0xd122cf);break;default:_0xb55e58=_[_0x7536('0xf')](_0x670d1[_0x7536('0x1c')])?[]:_0x670d1[_0x7536('0x1c')]['split'](',');}var _0x55fb42={'id':util[_0x7536('0xc')]('%s:%s:%s',_0x1ac2a5,_0x670d1['id'],_0x670d1[_0x7536('0x1a')]),'condition':require(_0x7536('0x2c'))[_0x7536('0x2d')](_0x1ac2a5,getIntervals(_0x3bc992[_0x7536('0x2e')],_0x670d1),_0x3bc992),'consequence':require(_0x7536('0x2f')+_0x670d1['app'])[_0x7536('0x30')](_0x1ac2a5,_0xb55e58,_0x3bc992,_0xc14865),'p':_0x670d1[_0x7536('0x31')]||0x0};logger[_0x7536('0x32')](_0x7536('0x33'),_0x55fb42['id'],'on\x20interval',getIntervals(_0x3bc992[_0x7536('0x2e')],_0x670d1)['join']('\x20|\x20'));_0x3e8d56[_0x7536('0x1e')](_0x55fb42);}else{logger['error'](_0x7536('0x34'),path[_0x7536('0x19')](__dirname,_0x7536('0x17'),_0x670d1['app']+_0x7536('0x35')));}}_0x3bc992[_0x7536('0x36')][_0x1ac2a5]=new RuleEngine(_0x3e8d56);_0x3bc992[_0x7536('0x36')][_0x1ac2a5][_0x7536('0x37')](_0xc14865,function(_0x195720){logger[_0x7536('0x32')]('Applications\x20executed',JSON[_0x7536('0x38')](_0x195720[_0x7536('0x39')]));if(_0x3bc992[_0x7536('0x36')][_0x1ac2a5]){_0x3bc992[_0x7536('0x36')][_0x1ac2a5][_0x7536('0x3a')]('complete');}});return _0xc68a5a({'code':0xc8,'message':_0xc14865});}else{if(_0x5d1ae0){logger[_0x7536('0x32')](util[_0x7536('0xc')](_0x7536('0x3b'),_0x1ac2a5));}else{logger[_0x7536('0x32')](_0x7536('0x3c'));}return _0xc68a5a({'code':0xc8,'message':_0xc14865});}}catch(_0x3edab1){logger[_0x7536('0x3d')](_0x3edab1['stack']);return _0x29b27f(_0x5b7e2b[_0x7536('0x3d')](0x1f4,_0x3edab1));}}return _0x29b27f(_0x7536('0x3e'));});},'AcceptMessage':function(_0x1d9347){var _0x13477c=this;return new Promise(function(_0x2fc59f,_0xc233d0){if(_0x1d9347[_0x7536('0x3f')]&&_0x1d9347[_0x7536('0x3f')]['id']){if(_0x3bc992[_0x7536('0x40')][_0x1d9347[_0x7536('0x3f')]['id']]){_0x3bc992[_0x7536('0x40')][_0x1d9347[_0x7536('0x3f')]['id']]['busy']=![];_0x3bc992['agents'][_0x1d9347['agent']['id']][_0x7536('0x41')]=undefined;}}if(_0x1d9347[_0x7536('0x14')]&&_0x1d9347['message']['id']){try{var _0xd200c=getId(_0x1d9347[_0x7536('0x13')],_0x1d9347[_0x7536('0x14')]?_0x1d9347[_0x7536('0x14')]['id']:0x0,_0x1d9347[_0x7536('0x15')]?_0x1d9347[_0x7536('0x15')]['id']:0x0);if(_0x3bc992['rules'][_0xd200c]){_0x3bc992[_0x7536('0x36')][_0xd200c]['emit']('end');if(rpc[_0x1d9347[_0x7536('0x13')]+'QueueReport']){rpc[_0x1d9347[_0x7536('0x13')]+_0x7536('0x42')][_0x7536('0x43')](_0xd200c,{'UserId':_0x1d9347[_0x7536('0x14')][_0x7536('0x44')]})[_0x7536('0x45')](function(){logger['error'](_0x7536('0x46'));});}}return _0x2fc59f({'code':0xc8,'message':_0x1d9347});}catch(_0xd7fbf9){logger[_0x7536('0x3d')](_0xd7fbf9[_0x7536('0x47')]);return _0xc233d0(_0x13477c[_0x7536('0x3d')](0x1f4,_0xd7fbf9));}}logger[_0x7536('0x3d')](_0x7536('0x48'));return _0xc233d0(_0x13477c[_0x7536('0x3d')](0x1f4,_0x7536('0x48')));});},'RejectMessage':function(_0x3b49c3){var _0xabbf78=this;return new Promise(function(_0x170c40,_0x379f1f){if(_0x3b49c3[_0x7536('0x3f')]&&_0x3b49c3[_0x7536('0x3f')]['id']){try{if(_0x3bc992[_0x7536('0x40')][_0x3b49c3['agent']['id']]){_0x3bc992[_0x7536('0x40')][_0x3b49c3['agent']['id']][_0x7536('0x49')]=![];_0x3bc992['agents'][_0x3b49c3[_0x7536('0x3f')]['id']][_0x7536('0x41')]=undefined;}return _0x170c40({'code':0xc8,'message':_0x3b49c3});}catch(_0x11e93b){logger[_0x7536('0x3d')](_0x11e93b['stack']);return _0x379f1f(_0xabbf78[_0x7536('0x3d')](0x1f4,_0x11e93b));}}logger[_0x7536('0x3d')](_0x7536('0x48'));return _0x379f1f(_0xabbf78['error'](0x1f4,_0x7536('0x48')));});},'AbandonInteraction':function(_0x2336f6){var _0x745e15=this;return new Promise(function(_0x2f987f,_0x1a420b){if(_0x2336f6[_0x7536('0x13')]&&_0x2336f6['interaction']&&_0x2336f6[_0x7536('0x15')]['id']){try{var _0x231f21=getId(_0x2336f6['channel'],_0x2336f6[_0x7536('0x14')]?_0x2336f6['message']['id']:0x0,_0x2336f6[_0x7536('0x15')]?_0x2336f6[_0x7536('0x15')]['id']:0x0);if(_0x3bc992[_0x7536('0x36')][_0x231f21]){_0x3bc992[_0x7536('0x36')][_0x231f21][_0x7536('0x3a')](_0x7536('0x4a'));}return _0x2f987f({'code':0xc8,'message':_0x2336f6});}catch(_0x578a3e){logger['error'](_0x578a3e[_0x7536('0x47')]);return _0x1a420b(_0x745e15[_0x7536('0x3d')](0x1f4,_0x578a3e));}}logger[_0x7536('0x3d')](_0x7536('0x48'));return _0x1a420b(_0x745e15['error'](0x1f4,_0x7536('0x48')));});},'AgentCapacity':function(_0x479537){var _0xcea9d8=this;return new Promise(function(_0x2d27f4,_0x393b85){if(_0x3bc992[_0x7536('0x40')]['hasOwnProperty'](_0x479537['id'])){for(var _0x2749b9 in _0x479537[_0x7536('0x4b')]){if(_0x479537[_0x7536('0x4b')][_0x7536('0x4c')](_0x2749b9)){if(_0x3bc992[_0x7536('0x40')][_0x479537['id']][_0x7536('0x4c')](_0x2749b9+_0x7536('0x4d'))){_0x3bc992[_0x7536('0x40')][_0x479537['id']][_0x2749b9+_0x7536('0x4d')]=parseInt(_0x479537[_0x7536('0x4b')][_0x2749b9],0xa);}}}_0x3bc992[_0x7536('0x40')][_0x479537['id']][_0x7536('0x4e')]();return _0x2d27f4({'code':0xc8,'message':_0x3bc992['agents'][_0x479537['id']]});}else{return _0x393b85(_0xcea9d8['error'](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x4155ee){return new Promise(function(_0x55b88a){var _0x4f31a6=_[_0x7536('0x4f')](_0x3bc992[_0x7536('0x40')]);if(_0x4155ee&&_0x4155ee['id']){var _0x560b4b=_[_0x7536('0x50')](_0x4f31a6,function(_0xff8e37){return _0xff8e37['id']===_0x4155ee['id'];});_0x55b88a(_0x560b4b);}else{_0x55b88a({'count':_0x4f31a6[_0x7536('0x20')],'rows':_0x4f31a6});}});},'ChatQueues':function(){return new Promise(function(_0x410c4f){var _0x17d1ca=[];for(var _0x54a82e in _0x3bc992[_0x7536('0x51')]){if(_0x3bc992['chatQueues'][_0x7536('0x4c')](_0x54a82e)){var _0x2b98c8=_0x3bc992[_0x7536('0x51')][_0x54a82e];var _0xde95c3={'id':_0x2b98c8['id'],'available':_0x2b98c8['available'],'loggedIn':_0x2b98c8[_0x7536('0x52')],'name':_0x2b98c8[_0x7536('0x53')],'paused':_0x2b98c8['paused'],'waiting':_0x2b98c8[_0x7536('0x54')]};_0x17d1ca['push'](_0xde95c3);}}_0x410c4f({'count':_0x17d1ca[_0x7536('0x20')],'rows':_0x17d1ca});});},'MailQueues':function(){return new Promise(function(_0x31f24c){var _0x4f437f=[];for(var _0x8ff34e in _0x3bc992[_0x7536('0x55')]){if(_0x3bc992[_0x7536('0x55')]['hasOwnProperty'](_0x8ff34e)){var _0x381317=_0x3bc992[_0x7536('0x55')][_0x8ff34e];var _0x150070={'id':_0x381317['id'],'available':_0x381317[_0x7536('0x56')],'loggedIn':_0x381317[_0x7536('0x52')],'name':_0x381317[_0x7536('0x53')],'paused':_0x381317[_0x7536('0x57')],'waiting':_0x381317['waiting']};_0x4f437f[_0x7536('0x1e')](_0x150070);}}_0x31f24c({'count':_0x4f437f['length'],'rows':_0x4f437f});});},'OpenchannelQueues':function(){return new Promise(function(_0x1fb3eb){var _0x981a47=[];for(var _0x51422d in _0x3bc992[_0x7536('0x58')]){if(_0x3bc992[_0x7536('0x58')][_0x7536('0x4c')](_0x51422d)){var _0x2300df=_0x3bc992['openchannelQueues'][_0x51422d];var _0x35ab4b={'id':_0x2300df['id'],'available':_0x2300df[_0x7536('0x56')],'loggedIn':_0x2300df['loggedIn'],'name':_0x2300df['name'],'paused':_0x2300df[_0x7536('0x57')],'waiting':_0x2300df[_0x7536('0x54')]};_0x981a47[_0x7536('0x1e')](_0x35ab4b);}}_0x1fb3eb({'count':_0x981a47[_0x7536('0x20')],'rows':_0x981a47});});},'SmsQueues':function(){return new Promise(function(_0x2d3226){var _0x345cd0=[];for(var _0x501210 in _0x3bc992[_0x7536('0x59')]){if(_0x3bc992['smsQueues'][_0x7536('0x4c')](_0x501210)){var _0x35f2d1=_0x3bc992[_0x7536('0x59')][_0x501210];var _0x79b995={'id':_0x35f2d1['id'],'available':_0x35f2d1['available'],'loggedIn':_0x35f2d1['loggedIn'],'name':_0x35f2d1[_0x7536('0x53')],'paused':_0x35f2d1['paused'],'waiting':_0x35f2d1['waiting']};_0x345cd0[_0x7536('0x1e')](_0x79b995);}}_0x2d3226({'count':_0x345cd0['length'],'rows':_0x345cd0});});},'FaxQueues':function(){return new Promise(function(_0x20b156){var _0x531045=[];for(var _0x1d373d in _0x3bc992[_0x7536('0x5a')]){if(_0x3bc992[_0x7536('0x5a')][_0x7536('0x4c')](_0x1d373d)){var _0x416f96=_0x3bc992[_0x7536('0x5a')][_0x1d373d];var _0x248b17={'id':_0x416f96['id'],'available':_0x416f96[_0x7536('0x56')],'loggedIn':_0x416f96[_0x7536('0x52')],'name':_0x416f96['name'],'paused':_0x416f96['paused'],'waiting':_0x416f96[_0x7536('0x54')]};_0x531045['push'](_0x248b17);}}_0x20b156({'count':_0x531045[_0x7536('0x20')],'rows':_0x531045});});},'WhatsappQueues':function(){return new Promise(function(_0x13732c){var _0x4d2221=[];for(var _0x538adb in _0x3bc992[_0x7536('0x5b')]){if(_0x3bc992[_0x7536('0x5b')]['hasOwnProperty'](_0x538adb)){var _0x530f1c=_0x3bc992[_0x7536('0x5b')][_0x538adb];var _0x357f24={'id':_0x530f1c['id'],'available':_0x530f1c[_0x7536('0x56')],'loggedIn':_0x530f1c['loggedIn'],'name':_0x530f1c[_0x7536('0x53')],'paused':_0x530f1c[_0x7536('0x57')],'waiting':_0x530f1c[_0x7536('0x54')]};_0x4d2221[_0x7536('0x1e')](_0x357f24);}}_0x13732c({'count':_0x4d2221[_0x7536('0x20')],'rows':_0x4d2221});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2485f1){var _0x4cc2d3=_[_0x7536('0x4f')](_0x3bc992[_0x7536('0x5c')]);_0x2485f1({'count':_0x4cc2d3['length'],'rows':_0x4cc2d3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4221fe){var _0x28be7c=_[_0x7536('0x4f')](_0x3bc992[_0x7536('0x5d')]);_0x4221fe({'count':_0x28be7c[_0x7536('0x20')],'rows':_0x28be7c});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x31a997){var _0x596546=_[_0x7536('0x4f')](_0x3bc992[_0x7536('0x5e')]);_0x31a997({'count':_0x596546['length'],'rows':_0x596546});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4dc883){var _0x2f9024=_[_0x7536('0x4f')](_0x3bc992[_0x7536('0x5f')]);_0x4dc883({'count':_0x2f9024[_0x7536('0x20')],'rows':_0x2f9024});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x32e17c){var _0x3013dd=_[_0x7536('0x4f')](_0x3bc992[_0x7536('0x60')]);_0x32e17c({'count':_0x3013dd[_0x7536('0x20')],'rows':_0x3013dd});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x3a6bf5){var _0x5b7fd0=_[_0x7536('0x4f')](_0x3bc992['whatsappQueuesWaitingInteractions']);_0x3a6bf5({'count':_0x5b7fd0[_0x7536('0x20')],'rows':_0x5b7fd0});});}};var _0x48e846=jayson[_0x7536('0x61')](_0x34435f)['http']();_0x48e846['on'](_0x7536('0x3d'),function(_0x18c518){logger[_0x7536('0x3d')](JSON[_0x7536('0x38')](_0x18c518));return _0x45a3e0(_0x18c518);});_0x48e846[_0x7536('0x62')](0x232c,_0x7536('0x63'),function(){console['log'](_0x7536('0x64'),0x232c);return _0x2ff931(_0x7536('0x65')+0x232c);});});}; \ No newline at end of file +var _0x14c2=['Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','bluebird','./applications/utils','../../../config/logger','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','autoreply','mail','push','slice','dialogflow','appdata','split','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','./applications/','consequence','priority','info','Push\x20new\x20rule','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','agent','agents','busy','busyQueue','emit','end','QueueReport','update','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log'];(function(_0x4abdc8,_0x40a0df){var _0x3f4fde=function(_0x213a45){while(--_0x213a45){_0x4abdc8['push'](_0x4abdc8['shift']());}};_0x3f4fde(++_0x40a0df);}(_0x14c2,0x11c));var _0x214c=function(_0x16a6e7,_0x36b8be){_0x16a6e7=_0x16a6e7-0x0;var _0x972589=_0x14c2[_0x16a6e7];return _0x972589;};'use strict';var _=require(_0x214c('0x0'));var util=require(_0x214c('0x1'));var path=require(_0x214c('0x2'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0x214c('0x3'));var utils=require(_0x214c('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x214c('0x5'))('routing');var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x214c('0x6')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0x214c('0x7')),'faxQueueReport':require(_0x214c('0x8')),'whatsappQueueReport':require(_0x214c('0x9'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2e5fe1,_0xfcfc6a,_0x2fef56){return util[_0x214c('0xa')]('%s.%s.%s',_0x2e5fe1,_0xfcfc6a||0x0,_0x2fef56||0x0);}function getIntervals(_0x1c9089,_0x1480b9){var _0xbdac99=[];if(!_[_0x214c('0xb')](_0x1480b9[_0x214c('0xc')])&&!_[_0x214c('0xb')](_0x1c9089[_0x1480b9['IntervalId']])&&!_[_0x214c('0xb')](_0x1c9089[_0x1480b9[_0x214c('0xc')]][_0x214c('0xd')])){_0xbdac99=_['map'](_0x1c9089[_0x1480b9['IntervalId']]['Intervals'],_0x214c('0xe'));}else if(!_[_0x214c('0xb')](_0x1480b9[_0x214c('0xe')])){_0xbdac99=[_0x1480b9[_0x214c('0xe')]];}return _0xbdac99;}exports['listen']=function(_0x1e2804){_0x1e2804[_0x214c('0xf')]={};return new BPromise(function(_0x105386,_0x1b7af5){var _0x2c4f6a={'Start':function(_0x3518dc){var _0x3c787a=this;return new Promise(function(_0x14ab5d,_0x2e4b4e){if(_0x3518dc){try{var _0x229ad1=[];var _0xff3aad=getId(_0x3518dc[_0x214c('0x10')],_0x3518dc[_0x214c('0x11')]?_0x3518dc[_0x214c('0x11')]['id']:0x0,_0x3518dc[_0x214c('0x12')]?_0x3518dc[_0x214c('0x12')]['id']:0x0);var _0x53af26=sUtils[_0x214c('0x13')](_0x1e2804,_0x3518dc);if(!_0x53af26&&_0x3518dc[_0x214c('0x14')]&&_['isArray'](_0x3518dc['applications'])&&_0x3518dc[_0x214c('0x14')][_0x214c('0x15')]){for(var _0x4bc57f=0x0;_0x4bc57f<_0x3518dc[_0x214c('0x14')][_0x214c('0x15')];_0x4bc57f+=0x1){var _0x3172dd=_0x3518dc[_0x214c('0x14')][_0x4bc57f];if(fs[_0x214c('0x16')](path[_0x214c('0x17')](__dirname,_0x214c('0x14'),_0x3172dd[_0x214c('0x18')]+'.js'))){var _0x13a3c0=[];switch(_0x3172dd[_0x214c('0x18')]['toLowerCase']()){case _0x214c('0x19'):var _0x207318=_0x3172dd['appdata']['split'](',');if(_0x3518dc[_0x214c('0x10')]===_0x214c('0x1a')){_0x13a3c0[_0x214c('0x1b')](_0x207318[0x0]);_0x13a3c0['push'](_0x207318[0x1]);_0x13a3c0['push'](_0x207318[_0x214c('0x1c')](0x2,_0x207318[_0x214c('0x15')])['join'](','));}else{_0x13a3c0[_0x214c('0x1b')](_0x207318[0x0]);_0x13a3c0[_0x214c('0x1b')](_0x207318['slice'](0x1,_0x207318[_0x214c('0x15')])[_0x214c('0x17')](','));}break;case _0x214c('0x1d'):var _0x20b101=_0x3172dd[_0x214c('0x1e')][_0x214c('0x1f')](',');_0x13a3c0[_0x214c('0x1b')](_0x20b101[0x0]);_0x13a3c0[_0x214c('0x1b')](_0x20b101[0x1]);_0x13a3c0[_0x214c('0x1b')](_0x20b101[_0x214c('0x1c')](0x2,_0x20b101[_0x214c('0x15')])[_0x214c('0x17')](','));break;case'dialogflowv2':var _0x265ff9=_0x3172dd[_0x214c('0x1e')][_0x214c('0x1f')](',');_0x13a3c0[_0x214c('0x1b')](_0x265ff9[0x0]);_0x13a3c0[_0x214c('0x1b')](_0x265ff9[0x1]);_0x13a3c0[_0x214c('0x1b')](_0x265ff9[0x2]);_0x13a3c0[_0x214c('0x1b')](_0x265ff9[0x3]);_0x13a3c0[_0x214c('0x1b')](_0x265ff9[_0x214c('0x1c')](0x4,_0x265ff9[_0x214c('0x15')])['join'](','));break;case'amazonlex':var _0xfb44fb=_0x3172dd[_0x214c('0x1e')][_0x214c('0x1f')](',');_0x13a3c0[_0x214c('0x1b')](_0xfb44fb[0x0]);_0x13a3c0[_0x214c('0x1b')](_0xfb44fb[0x1]);_0x13a3c0[_0x214c('0x1b')](_0xfb44fb[0x2]);_0x13a3c0[_0x214c('0x1b')](_0xfb44fb[0x3]);_0x13a3c0[_0x214c('0x1b')](_0xfb44fb[_0x214c('0x1c')](0x4,_0xfb44fb[_0x214c('0x15')])[_0x214c('0x17')](','));break;case _0x214c('0x11'):_0x13a3c0['push'](_0x3172dd[_0x214c('0x1e')]);break;case _0x214c('0x20'):_0x13a3c0[_0x214c('0x1b')](_0x3172dd[_0x214c('0x21')]);_0x13a3c0[_0x214c('0x1b')](_0x3172dd[_0x214c('0x1e')]);break;case _0x214c('0x22'):var _0x3b4d2a=utils[_0x214c('0x23')](_0x3518dc[_0x214c('0x24')][_0x214c('0x25')],_0x3518dc);var _0x2955bb=_0x3172dd[_0x214c('0x1e')][_0x214c('0x1f')](',');_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0x0]);_0x13a3c0['push'](_0x2955bb[0x1]);_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0x2]);_0x13a3c0['push'](_0x2955bb[0x3]);_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0x4]);_0x13a3c0['push'](_0x2955bb[0x5]);_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0x6]);_0x13a3c0['push'](_0x2955bb[0x7]);_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0x8]);_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0x9]);_0x13a3c0[_0x214c('0x1b')](_0x2955bb[0xa]);_0x13a3c0[_0x214c('0x1b')](_0x3518dc['interaction']['id']);_0x13a3c0[_0x214c('0x1b')](_0x3518dc[_0x214c('0x11')]['id']);_0x13a3c0[_0x214c('0x1b')](_0x3172dd[_0x214c('0x26')]);_0x13a3c0[_0x214c('0x1b')](_0x3518dc[_0x214c('0x12')][_0x214c('0x27')]);_0x13a3c0[_0x214c('0x1b')](_0x3518dc[_0x214c('0x28')][_0x214c('0x28')]);_0x13a3c0[_0x214c('0x1b')](_0x3b4d2a);break;default:_0x13a3c0=_[_0x214c('0xb')](_0x3172dd[_0x214c('0x1e')])?[]:_0x3172dd[_0x214c('0x1e')][_0x214c('0x1f')](',');}var _0x539cb3={'id':util[_0x214c('0xa')]('%s:%s:%s',_0xff3aad,_0x3172dd['id'],_0x3172dd['app']),'condition':require('./interval')['condition'](_0xff3aad,getIntervals(_0x1e2804['intervals'],_0x3172dd),_0x1e2804),'consequence':require(_0x214c('0x29')+_0x3172dd[_0x214c('0x18')])[_0x214c('0x2a')](_0xff3aad,_0x13a3c0,_0x1e2804,_0x3518dc),'p':_0x3172dd[_0x214c('0x2b')]||0x0};logger[_0x214c('0x2c')](_0x214c('0x2d'),_0x539cb3['id'],'on\x20interval',getIntervals(_0x1e2804[_0x214c('0x2e')],_0x3172dd)[_0x214c('0x17')](_0x214c('0x2f')));_0x229ad1[_0x214c('0x1b')](_0x539cb3);}else{logger[_0x214c('0x30')](_0x214c('0x31'),path[_0x214c('0x17')](__dirname,_0x214c('0x14'),_0x3172dd['app']+_0x214c('0x32')));}}_0x1e2804['rules'][_0xff3aad]=new RuleEngine(_0x229ad1);_0x1e2804[_0x214c('0xf')][_0xff3aad][_0x214c('0x33')](_0x3518dc,function(_0x104d8c){logger['info'](_0x214c('0x34'),JSON[_0x214c('0x35')](_0x104d8c['matchPath']));if(_0x1e2804['rules'][_0xff3aad]){_0x1e2804[_0x214c('0xf')][_0xff3aad]['emit']('complete');}});return _0x14ab5d({'code':0xc8,'message':_0x3518dc});}else{if(_0x53af26){logger[_0x214c('0x2c')](util['format'](_0x214c('0x36'),_0xff3aad));}else{logger[_0x214c('0x2c')](_0x214c('0x37'));}return _0x14ab5d({'code':0xc8,'message':_0x3518dc});}}catch(_0x5a6cc9){logger[_0x214c('0x30')](_0x5a6cc9[_0x214c('0x38')]);return _0x2e4b4e(_0x3c787a[_0x214c('0x30')](0x1f4,_0x5a6cc9));}}return _0x2e4b4e('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2bdaac){var _0x54e675=this;return new Promise(function(_0xda6473,_0x47e863){if(_0x2bdaac[_0x214c('0x39')]&&_0x2bdaac[_0x214c('0x39')]['id']){if(_0x1e2804[_0x214c('0x3a')][_0x2bdaac[_0x214c('0x39')]['id']]){_0x1e2804[_0x214c('0x3a')][_0x2bdaac[_0x214c('0x39')]['id']][_0x214c('0x3b')]=![];_0x1e2804[_0x214c('0x3a')][_0x2bdaac[_0x214c('0x39')]['id']][_0x214c('0x3c')]=undefined;}}if(_0x2bdaac['message']&&_0x2bdaac[_0x214c('0x11')]['id']){try{var _0x2ba4f1=getId(_0x2bdaac['channel'],_0x2bdaac[_0x214c('0x11')]?_0x2bdaac[_0x214c('0x11')]['id']:0x0,_0x2bdaac[_0x214c('0x12')]?_0x2bdaac[_0x214c('0x12')]['id']:0x0);if(_0x1e2804[_0x214c('0xf')][_0x2ba4f1]){_0x1e2804[_0x214c('0xf')][_0x2ba4f1][_0x214c('0x3d')](_0x214c('0x3e'));if(rpc[_0x2bdaac[_0x214c('0x10')]+_0x214c('0x3f')]){rpc[_0x2bdaac['channel']+_0x214c('0x3f')][_0x214c('0x40')](_0x2ba4f1,{'UserId':_0x2bdaac[_0x214c('0x11')]['UserId']})[_0x214c('0x41')](function(){logger[_0x214c('0x30')](_0x214c('0x42'));});}}return _0xda6473({'code':0xc8,'message':_0x2bdaac});}catch(_0x187a6b){logger[_0x214c('0x30')](_0x187a6b[_0x214c('0x38')]);return _0x47e863(_0x54e675[_0x214c('0x30')](0x1f4,_0x187a6b));}}logger[_0x214c('0x30')](_0x214c('0x43'));return _0x47e863(_0x54e675[_0x214c('0x30')](0x1f4,_0x214c('0x43')));});},'RejectMessage':function(_0x29efdd){var _0x6e5494=this;return new Promise(function(_0x3b2fc7,_0x4b72bb){if(_0x29efdd[_0x214c('0x39')]&&_0x29efdd['agent']['id']){try{if(_0x1e2804['agents'][_0x29efdd[_0x214c('0x39')]['id']]){_0x1e2804[_0x214c('0x3a')][_0x29efdd['agent']['id']][_0x214c('0x3b')]=![];_0x1e2804[_0x214c('0x3a')][_0x29efdd[_0x214c('0x39')]['id']][_0x214c('0x3c')]=undefined;}return _0x3b2fc7({'code':0xc8,'message':_0x29efdd});}catch(_0x331949){logger[_0x214c('0x30')](_0x331949[_0x214c('0x38')]);return _0x4b72bb(_0x6e5494['error'](0x1f4,_0x331949));}}logger['error']('message\x20is\x20empty');return _0x4b72bb(_0x6e5494['error'](0x1f4,_0x214c('0x43')));});},'AbandonInteraction':function(_0x514e56){var _0x594f1e=this;return new Promise(function(_0x2efc69,_0x1d7c4b){if(_0x514e56[_0x214c('0x10')]&&_0x514e56[_0x214c('0x12')]&&_0x514e56[_0x214c('0x12')]['id']){try{var _0x380cc6=getId(_0x514e56[_0x214c('0x10')],_0x514e56[_0x214c('0x11')]?_0x514e56['message']['id']:0x0,_0x514e56['interaction']?_0x514e56[_0x214c('0x12')]['id']:0x0);if(_0x1e2804[_0x214c('0xf')][_0x380cc6]){_0x1e2804['rules'][_0x380cc6]['emit']('end');}return _0x2efc69({'code':0xc8,'message':_0x514e56});}catch(_0x280b89){logger['error'](_0x280b89['stack']);return _0x1d7c4b(_0x594f1e[_0x214c('0x30')](0x1f4,_0x280b89));}}logger['error'](_0x214c('0x43'));return _0x1d7c4b(_0x594f1e[_0x214c('0x30')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x336587){var _0x5d6a14=this;return new Promise(function(_0x23dc8d,_0x1349a1){if(_0x1e2804[_0x214c('0x3a')][_0x214c('0x44')](_0x336587['id'])){for(var _0x385deb in _0x336587[_0x214c('0x45')]){if(_0x336587[_0x214c('0x45')]['hasOwnProperty'](_0x385deb)){if(_0x1e2804[_0x214c('0x3a')][_0x336587['id']]['hasOwnProperty'](_0x385deb+_0x214c('0x46'))){_0x1e2804['agents'][_0x336587['id']][_0x385deb+_0x214c('0x46')]=parseInt(_0x336587['capacity'][_0x385deb],0xa);}}}_0x1e2804[_0x214c('0x3a')][_0x336587['id']]['updateRealtime']();return _0x23dc8d({'code':0xc8,'message':_0x1e2804['agents'][_0x336587['id']]});}else{return _0x1349a1(_0x5d6a14[_0x214c('0x30')](0x1f4,_0x214c('0x47')));}});},'Agents':function(_0x2f7e90){return new Promise(function(_0x3d02d0){var _0x29d68a=_[_0x214c('0x48')](_0x1e2804['agents']);if(_0x2f7e90&&_0x2f7e90['id']){var _0x1374e9=_['find'](_0x29d68a,function(_0x52fc28){return _0x52fc28['id']===_0x2f7e90['id'];});_0x3d02d0(_0x1374e9);}else{_0x3d02d0({'count':_0x29d68a[_0x214c('0x15')],'rows':_0x29d68a});}});},'ChatQueues':function(){return new Promise(function(_0xc9f938){var _0x72195b=[];for(var _0x339294 in _0x1e2804['chatQueues']){if(_0x1e2804[_0x214c('0x49')][_0x214c('0x44')](_0x339294)){var _0x17a30f=_0x1e2804[_0x214c('0x49')][_0x339294];var _0x3edb30={'id':_0x17a30f['id'],'available':_0x17a30f[_0x214c('0x4a')],'loggedIn':_0x17a30f['loggedIn'],'name':_0x17a30f[_0x214c('0x4b')],'paused':_0x17a30f[_0x214c('0x4c')],'waiting':_0x17a30f[_0x214c('0x4d')]};_0x72195b['push'](_0x3edb30);}}_0xc9f938({'count':_0x72195b[_0x214c('0x15')],'rows':_0x72195b});});},'MailQueues':function(){return new Promise(function(_0x187ae5){var _0x4463e5=[];for(var _0x4bcdfc in _0x1e2804[_0x214c('0x4e')]){if(_0x1e2804[_0x214c('0x4e')][_0x214c('0x44')](_0x4bcdfc)){var _0x39e4f4=_0x1e2804[_0x214c('0x4e')][_0x4bcdfc];var _0xc4f9e9={'id':_0x39e4f4['id'],'available':_0x39e4f4[_0x214c('0x4a')],'loggedIn':_0x39e4f4[_0x214c('0x4f')],'name':_0x39e4f4['name'],'paused':_0x39e4f4['paused'],'waiting':_0x39e4f4['waiting']};_0x4463e5[_0x214c('0x1b')](_0xc4f9e9);}}_0x187ae5({'count':_0x4463e5[_0x214c('0x15')],'rows':_0x4463e5});});},'OpenchannelQueues':function(){return new Promise(function(_0x55a654){var _0x1189dc=[];for(var _0x28acec in _0x1e2804['openchannelQueues']){if(_0x1e2804[_0x214c('0x50')]['hasOwnProperty'](_0x28acec)){var _0x364b48=_0x1e2804[_0x214c('0x50')][_0x28acec];var _0x3ebde8={'id':_0x364b48['id'],'available':_0x364b48[_0x214c('0x4a')],'loggedIn':_0x364b48['loggedIn'],'name':_0x364b48[_0x214c('0x4b')],'paused':_0x364b48[_0x214c('0x4c')],'waiting':_0x364b48[_0x214c('0x4d')]};_0x1189dc['push'](_0x3ebde8);}}_0x55a654({'count':_0x1189dc[_0x214c('0x15')],'rows':_0x1189dc});});},'SmsQueues':function(){return new Promise(function(_0x49646d){var _0x46172c=[];for(var _0x16d6de in _0x1e2804[_0x214c('0x51')]){if(_0x1e2804[_0x214c('0x51')][_0x214c('0x44')](_0x16d6de)){var _0x23680c=_0x1e2804[_0x214c('0x51')][_0x16d6de];var _0xf4dec2={'id':_0x23680c['id'],'available':_0x23680c[_0x214c('0x4a')],'loggedIn':_0x23680c[_0x214c('0x4f')],'name':_0x23680c[_0x214c('0x4b')],'paused':_0x23680c[_0x214c('0x4c')],'waiting':_0x23680c['waiting']};_0x46172c[_0x214c('0x1b')](_0xf4dec2);}}_0x49646d({'count':_0x46172c[_0x214c('0x15')],'rows':_0x46172c});});},'FaxQueues':function(){return new Promise(function(_0x166d8c){var _0x2d3df6=[];for(var _0x530b9a in _0x1e2804['faxQueues']){if(_0x1e2804['faxQueues'][_0x214c('0x44')](_0x530b9a)){var _0x4b6991=_0x1e2804['faxQueues'][_0x530b9a];var _0x492bc2={'id':_0x4b6991['id'],'available':_0x4b6991[_0x214c('0x4a')],'loggedIn':_0x4b6991[_0x214c('0x4f')],'name':_0x4b6991[_0x214c('0x4b')],'paused':_0x4b6991[_0x214c('0x4c')],'waiting':_0x4b6991[_0x214c('0x4d')]};_0x2d3df6[_0x214c('0x1b')](_0x492bc2);}}_0x166d8c({'count':_0x2d3df6[_0x214c('0x15')],'rows':_0x2d3df6});});},'WhatsappQueues':function(){return new Promise(function(_0x368000){var _0x87817e=[];for(var _0x232511 in _0x1e2804[_0x214c('0x52')]){if(_0x1e2804[_0x214c('0x52')]['hasOwnProperty'](_0x232511)){var _0x340688=_0x1e2804[_0x214c('0x52')][_0x232511];var _0x2dd714={'id':_0x340688['id'],'available':_0x340688[_0x214c('0x4a')],'loggedIn':_0x340688[_0x214c('0x4f')],'name':_0x340688[_0x214c('0x4b')],'paused':_0x340688[_0x214c('0x4c')],'waiting':_0x340688['waiting']};_0x87817e[_0x214c('0x1b')](_0x2dd714);}}_0x368000({'count':_0x87817e['length'],'rows':_0x87817e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4e3cb3){var _0x4ccb8d=_[_0x214c('0x48')](_0x1e2804['chatQueuesWaitingInteractions']);_0x4e3cb3({'count':_0x4ccb8d[_0x214c('0x15')],'rows':_0x4ccb8d});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x258612){var _0x10a1e7=_['values'](_0x1e2804[_0x214c('0x53')]);_0x258612({'count':_0x10a1e7[_0x214c('0x15')],'rows':_0x10a1e7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x529791){var _0x44c3a0=_[_0x214c('0x48')](_0x1e2804[_0x214c('0x54')]);_0x529791({'count':_0x44c3a0[_0x214c('0x15')],'rows':_0x44c3a0});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x3c20fd){var _0x270d7e=_[_0x214c('0x48')](_0x1e2804[_0x214c('0x55')]);_0x3c20fd({'count':_0x270d7e['length'],'rows':_0x270d7e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x289617){var _0x21c3f3=_[_0x214c('0x48')](_0x1e2804['faxQueuesWaitingInteractions']);_0x289617({'count':_0x21c3f3[_0x214c('0x15')],'rows':_0x21c3f3});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x11c85c){var _0x3f86b8=_[_0x214c('0x48')](_0x1e2804[_0x214c('0x56')]);_0x11c85c({'count':_0x3f86b8[_0x214c('0x15')],'rows':_0x3f86b8});});}};var _0x1a3476=jayson[_0x214c('0x57')](_0x2c4f6a)[_0x214c('0x58')]();_0x1a3476['on'](_0x214c('0x30'),function(_0x2a68d3){logger[_0x214c('0x30')](JSON['stringify'](_0x2a68d3));return _0x1b7af5(_0x2a68d3);});_0x1a3476[_0x214c('0x59')](0x232c,_0x214c('0x5a'),function(){console[_0x214c('0x5b')](_0x214c('0x5c'),0x232c);return _0x105386(_0x214c('0x5d')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 7fc1f5e..8852f8a 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 _0xba42=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','iftime\x20%s','indexOf','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','util','bluebird','jayson/promise','../../../config/logger','client','http','request','then','error','message','result','catch','condition','rules'];(function(_0x292d59,_0x4c3328){var _0x1a89ea=function(_0x4baec7){while(--_0x4baec7){_0x292d59['push'](_0x292d59['shift']());}};_0x1a89ea(++_0x4c3328);}(_0xba42,0x15e));var _0x2ba4=function(_0x10d670,_0x178996){_0x10d670=_0x10d670-0x0;var _0x20d6f8=_0xba42[_0x10d670];return _0x20d6f8;};'use strict';var util=require(_0x2ba4('0x0'));var BPromise=require(_0x2ba4('0x1'));var jayson=require(_0x2ba4('0x2'));var _=require('lodash');var logger=require(_0x2ba4('0x3'))('routing');var client=jayson[_0x2ba4('0x4')][_0x2ba4('0x5')]({'port':0x232a});function request(_0xf8904,_0x29f4eb){return new BPromise(function(_0x40c16e,_0x44b379){return client[_0x2ba4('0x6')](_0xf8904,_0x29f4eb)[_0x2ba4('0x7')](function(_0x546b72){if(_0x546b72[_0x2ba4('0x8')]){return _0x44b379(_0x546b72['error'][_0x2ba4('0x9')]);}else{return _0x40c16e(_0x546b72[_0x2ba4('0xa')]);}})[_0x2ba4('0xb')](function(_0xd57013){return _0x44b379(_0xd57013);});});}exports[_0x2ba4('0xc')]=function(_0x3ef826,_0x33710a,_0x33ec8b){return function(_0x4b1932){if(_0x33ec8b['rules']&&!_0x33ec8b[_0x2ba4('0xd')][_0x3ef826]){logger[_0x2ba4('0xe')](_0x2ba4('0xf'),_0x3ef826);return _0x4b1932[_0x2ba4('0x10')]();}var _0x580e37=[];for(var _0x109f01=0x0;_0x109f01<_0x33710a[_0x2ba4('0x11')];_0x109f01+=0x1){_0x580e37['push'](request(_0x2ba4('0x12'),{'command':util['format'](_0x2ba4('0x13'),_0x33710a[_0x109f01])})[_0x2ba4('0x7')](function(_0x103d3e){return _0x103d3e&&_0x103d3e[_0x2ba4('0x9')]&&_0x103d3e['message'][_0x2ba4('0x14')]('true')>=0x0?!![]:![];})[_0x2ba4('0xb')](function(_0x4d476b){logger[_0x2ba4('0x8')]('[%s][INTERVAL]\x20%s',_0x3ef826,_0x33710a[_0x109f01]);}));}BPromise[_0x2ba4('0x15')](_0x580e37)[_0x2ba4('0x7')](function(_0xa2e98a){var _0x16ccbe=_[_0x2ba4('0x16')](_0xa2e98a);logger[_0x2ba4('0xe')](_0x2ba4('0x17'),_0x3ef826,_0x33710a['join'](_0x2ba4('0x18')),_0x16ccbe);_0x4b1932[_0x2ba4('0x19')](_0x16ccbe);})[_0x2ba4('0xb')](function(_0x587b1c){console[_0x2ba4('0x1a')](_0x587b1c);logger['error'](_0x2ba4('0x17'),_0x3ef826,_0x33710a[_0x2ba4('0x1b')](_0x2ba4('0x18')),_0x587b1c['stack']);_0x4b1932[_0x2ba4('0x10')]();});};}; \ No newline at end of file +var _0x94bc=['jayson/promise','lodash','../../../config/logger','routing','error','message','catch','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','Command','format','indexOf','[%s][INTERVAL]\x20%s','then','some','join','\x20|\x20','when','log','[%s][INTERVAL]\x20%s\x20%s','stack','stop','util','bluebird'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x94bc,0x1f2));var _0xc94b=function(_0x56727c,_0x3a4af4){_0x56727c=_0x56727c-0x0;var _0x1de7ba=_0x94bc[_0x56727c];return _0x1de7ba;};'use strict';var util=require(_0xc94b('0x0'));var BPromise=require(_0xc94b('0x1'));var jayson=require(_0xc94b('0x2'));var _=require(_0xc94b('0x3'));var logger=require(_0xc94b('0x4'))(_0xc94b('0x5'));var client=jayson['client']['http']({'port':0x232a});function request(_0x4715da,_0x537468){return new BPromise(function(_0x2a9c91,_0x4d0949){return client['request'](_0x4715da,_0x537468)['then'](function(_0x286ac7){if(_0x286ac7[_0xc94b('0x6')]){return _0x4d0949(_0x286ac7[_0xc94b('0x6')][_0xc94b('0x7')]);}else{return _0x2a9c91(_0x286ac7['result']);}})[_0xc94b('0x8')](function(_0x613e6e){return _0x4d0949(_0x613e6e);});});}exports['condition']=function(_0x156791,_0x4c1c82,_0x2b7ee1){return function(_0x7b92d0){if(_0x2b7ee1[_0xc94b('0x9')]&&!_0x2b7ee1[_0xc94b('0x9')][_0x156791]){logger[_0xc94b('0xa')](_0xc94b('0xb'),_0x156791);return _0x7b92d0['stop']();}var _0x1cb770=[];for(var _0x463beb=0x0;_0x463beb<_0x4c1c82['length'];_0x463beb+=0x1){_0x1cb770['push'](request(_0xc94b('0xc'),{'command':util[_0xc94b('0xd')]('iftime\x20%s',_0x4c1c82[_0x463beb])})['then'](function(_0x19314c){return _0x19314c&&_0x19314c[_0xc94b('0x7')]&&_0x19314c['message'][_0xc94b('0xe')]('true')>=0x0?!![]:![];})[_0xc94b('0x8')](function(_0x43e014){logger[_0xc94b('0x6')](_0xc94b('0xf'),_0x156791,_0x4c1c82[_0x463beb]);}));}BPromise['all'](_0x1cb770)[_0xc94b('0x10')](function(_0x513fc4){var _0x369ef4=_[_0xc94b('0x11')](_0x513fc4);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x156791,_0x4c1c82[_0xc94b('0x12')](_0xc94b('0x13')),_0x369ef4);_0x7b92d0[_0xc94b('0x14')](_0x369ef4);})[_0xc94b('0x8')](function(_0x654ddd){console[_0xc94b('0x15')](_0x654ddd);logger['error'](_0xc94b('0x16'),_0x156791,_0x4c1c82[_0xc94b('0x12')](_0xc94b('0x13')),_0x654ddd[_0xc94b('0x17')]);_0x7b92d0[_0xc94b('0x18')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index e141f56..02a8404 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 _0x7072=['acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','format','[%s][agents][agentcalled]','now','connectedlinename','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','timeout','holdtime','ringtime','talktime','push','error','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','agentringnoanswerAt','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','reason','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','[%s][agents][agentcomplete]','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfer','ATTENDED','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','complete','util','./utils','info','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7072,0x138));var _0x2707=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x7072[_0x58afd5];return _0x3e503b;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var utils=require(_0x2707('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x127e9c,_0x1bbc92){utils[_0x2707('0x2')](util['format']('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x127e9c[_0x2707('0x3')],_0x127e9c['channel'],_0x127e9c[_0x2707('0x4')],_0x127e9c[_0x2707('0x5')],_0x127e9c[_0x2707('0x6')],_0x127e9c[_0x2707('0x7')],_0x127e9c[_0x2707('0x8')],_0x127e9c[_0x2707('0x9')]));if(_0x127e9c[_0x2707('0x4')]){utils[_0x2707('0xa')](_0x127e9c[_0x2707('0x4')])[_0x2707('0xb')](function(_0x51ffc4){if(_0x51ffc4){_0x127e9c['type']=_0x51ffc4[_0x2707('0xc')];_0x127e9c[_0x2707('0xd')]=_0x127e9c[_0x2707('0xe')]?_0x51ffc4[_0x2707('0xf')]:![];_0x127e9c[_0x2707('0x10')]=_0x127e9c[_0x2707('0xd')]?_0x51ffc4[_0x2707('0x11')]:0x0;}utils[_0x2707('0x12')](_0x2707('0x13'),_0x127e9c);});}else{utils[_0x2707('0x12')](_0x2707('0x13'),_0x127e9c);}if(_0x1bbc92){delete transfers[_0x127e9c[_0x2707('0x3')]];}else{delete agents[_0x127e9c[_0x2707('0x14')]];}}exports['agentcalled']=function(_0x44c1d7){try{utils['debug'](util[_0x2707('0x15')](_0x2707('0x16'),_0x44c1d7[_0x2707('0x3')]),_0x44c1d7);agents[_0x44c1d7[_0x2707('0x14')]]=_0x44c1d7;agents[_0x44c1d7[_0x2707('0x14')]]['agentcalledAt']=utils[_0x2707('0x17')]();agents[_0x44c1d7[_0x2707('0x14')]][_0x2707('0x9')]='called';agents[_0x44c1d7[_0x2707('0x14')]][_0x2707('0x8')]=null;agents[_0x44c1d7[_0x2707('0x14')]][_0x2707('0x18')]=null;utils[_0x2707('0x2')](util[_0x2707('0x15')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x44c1d7[_0x2707('0x3')],agents[_0x44c1d7[_0x2707('0x14')]][_0x2707('0x5')],_0x44c1d7['destuniqueid']));}catch(_0x529936){utils['error'](util[_0x2707('0x15')](_0x2707('0x16'),_0x44c1d7[_0x2707('0x3')]),_0x529936);}};exports[_0x2707('0x19')]=function(_0x1a0e1a){try{if(!_[_0x2707('0x1a')](agents[_0x1a0e1a[_0x2707('0x14')]])){utils[_0x2707('0x1b')](util[_0x2707('0x15')](_0x2707('0x1c'),_0x1a0e1a[_0x2707('0x3')]),_0x1a0e1a);utils[_0x2707('0x2')](util[_0x2707('0x15')](_0x2707('0x1d'),_0x1a0e1a['uniqueid'],agents[_0x1a0e1a[_0x2707('0x14')]][_0x2707('0x5')],_0x1a0e1a[_0x2707('0x14')]));agents[_0x1a0e1a[_0x2707('0x14')]][_0x2707('0x19')]=!![];agents[_0x1a0e1a[_0x2707('0x14')]]['agentringnoanswerAt']=utils[_0x2707('0x17')]();agents[_0x1a0e1a[_0x2707('0x14')]][_0x2707('0x9')]=_0x2707('0x1e');agents[_0x1a0e1a[_0x2707('0x14')]]['reason']=_0x2707('0x1e');agents[_0x1a0e1a['destuniqueid']][_0x2707('0x1f')]=_0x1a0e1a[_0x2707('0x20')]?parseInt(_0x1a0e1a[_0x2707('0x20')])/0x3e8:0x0;agents[_0x1a0e1a['destuniqueid']][_0x2707('0x21')]=0x0;unanswered[_0x2707('0x22')](_0x1a0e1a[_0x2707('0x14')]);}}catch(_0x529be8){utils[_0x2707('0x23')](util[_0x2707('0x15')]('[%s][agents][agentringnoanswer]',_0x1a0e1a[_0x2707('0x3')]),_0x529be8);}};exports['queuecallerabandon']=function(_0x5aaffb){try{_[_0x2707('0x24')](agents,function(_0x4e0c93,_0x2a0d24){if(_0x4e0c93[_0x2707('0x3')]==_0x5aaffb[_0x2707('0x3')]&&!_[_0x2707('0x25')](unanswered,_0x4e0c93['destuniqueid'])){utils[_0x2707('0x1b')](util[_0x2707('0x15')](_0x2707('0x26'),_0x5aaffb[_0x2707('0x3')]),_0x5aaffb);utils[_0x2707('0x2')](util[_0x2707('0x15')](_0x2707('0x27'),_0x5aaffb[_0x2707('0x3')],_0x4e0c93[_0x2707('0x5')],_0x4e0c93['destuniqueid']));_0x4e0c93[_0x2707('0x19')]=!![];_0x4e0c93[_0x2707('0x28')]=utils['now']();_0x4e0c93['lastevent']='abandoned';_0x4e0c93['reason']='abandoned';_0x4e0c93[_0x2707('0x1f')]=_0x5aaffb['holdtime'];_0x4e0c93['talktime']=0x0;writeDB(_0x4e0c93);}});}catch(_0x4558bb){utils[_0x2707('0x23')](util['format'](_0x2707('0x26'),_0x5aaffb[_0x2707('0x3')]),_0x4558bb);}};exports['agentconnect']=function(_0x5e6b51){try{if(agents[_0x5e6b51[_0x2707('0x14')]]){utils[_0x2707('0x1b')](util['format']('[%s][agents][agentconnect]',_0x5e6b51[_0x2707('0x3')]),_0x5e6b51);utils[_0x2707('0x2')](util['format'](_0x2707('0x29'),_0x5e6b51[_0x2707('0x3')],agents[_0x5e6b51[_0x2707('0x14')]][_0x2707('0x5')],_0x5e6b51[_0x2707('0x14')]));agents[_0x5e6b51[_0x2707('0x14')]]['agentconnectAt']=utils[_0x2707('0x17')]();agents[_0x5e6b51[_0x2707('0x14')]][_0x2707('0x8')]=_0x5e6b51[_0x2707('0x8')];agents[_0x5e6b51[_0x2707('0x14')]][_0x2707('0x18')]=_0x5e6b51[_0x2707('0x18')];agents[_0x5e6b51['destuniqueid']][_0x2707('0x1f')]=_0x5e6b51[_0x2707('0x20')];agents[_0x5e6b51[_0x2707('0x14')]][_0x2707('0x9')]=_0x2707('0x2a');_[_0x2707('0x24')](agents,function(_0x3ed513,_0x39d9f6){if(_0x3ed513[_0x2707('0x14')]!=_0x5e6b51[_0x2707('0x14')]&&_0x3ed513[_0x2707('0x3')]==_0x5e6b51[_0x2707('0x3')]){_0x3ed513[_0x2707('0x21')]=0x0;_0x3ed513[_0x2707('0x1f')]=_0x5e6b51[_0x2707('0x20')];_0x3ed513[_0x2707('0x19')]=!![];_0x3ed513['agentringnoanswerAt']=utils[_0x2707('0x17')]();_0x3ed513[_0x2707('0x9')]='answered_elsewhere';_0x3ed513[_0x2707('0x2b')]='answered_elsewhere';_0x3ed513[_0x2707('0x2c')]=_0x5e6b51[_0x2707('0x14')];_0x3ed513[_0x2707('0x2d')]=_0x5e6b51[_0x2707('0x5')];writeDB(_0x3ed513);}});}}catch(_0x13e1c0){utils[_0x2707('0x23')](util[_0x2707('0x15')]('[%s][agents][agentconnect]',_0x5e6b51[_0x2707('0x3')]),_0x13e1c0);}};exports[_0x2707('0xe')]=function(_0x4c8dbf){try{if(!_[_0x2707('0x1a')](agents[_0x4c8dbf[_0x2707('0x14')]])){utils[_0x2707('0x1b')](util['format']('[%s][agents][agentcomplete]',_0x4c8dbf[_0x2707('0x3')]),_0x4c8dbf);utils[_0x2707('0x2')](util['format'](_0x2707('0x2e'),_0x4c8dbf['uniqueid'],agents[_0x4c8dbf[_0x2707('0x14')]][_0x2707('0x5')],_0x4c8dbf[_0x2707('0x14')]));agents[_0x4c8dbf[_0x2707('0x14')]]['agentcomplete']=!![];agents[_0x4c8dbf[_0x2707('0x14')]][_0x2707('0x2f')]=utils[_0x2707('0x17')]();agents[_0x4c8dbf[_0x2707('0x14')]][_0x2707('0x21')]=utils[_0x2707('0x30')](agents[_0x4c8dbf[_0x2707('0x14')]]['agentcompleteAt'],agents[_0x4c8dbf[_0x2707('0x14')]][_0x2707('0x31')]);agents[_0x4c8dbf[_0x2707('0x14')]][_0x2707('0x2b')]=_0x4c8dbf[_0x2707('0x2b')];agents[_0x4c8dbf['destuniqueid']][_0x2707('0x9')]='complete';writeDB(agents[_0x4c8dbf[_0x2707('0x14')]]);}}catch(_0x6ada76){utils['error'](util[_0x2707('0x15')](_0x2707('0x32'),_0x4c8dbf[_0x2707('0x3')]),_0x6ada76);}};exports['blindtransfer']=function(_0x1a8034){try{if(!_['isNil'](agents[_0x1a8034[_0x2707('0x33')]])){utils[_0x2707('0x1b')](util['format'](_0x2707('0x34'),_0x1a8034[_0x2707('0x3')]),_0x1a8034);utils[_0x2707('0x2')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1a8034[_0x2707('0x3')],agents[_0x1a8034[_0x2707('0x33')]][_0x2707('0x5')],agents[_0x1a8034[_0x2707('0x33')]][_0x2707('0x3')]));agents[_0x1a8034['transfereruniqueid']]['transfer']=!![];agents[_0x1a8034['transfereruniqueid']][_0x2707('0x35')]=_0x2707('0x36');agents[_0x1a8034[_0x2707('0x33')]][_0x2707('0x37')]=_0x1a8034[_0x2707('0x38')];agents[_0x1a8034['transfereruniqueid']][_0x2707('0x39')]=agents[_0x1a8034[_0x2707('0x33')]]['uniqueid'];}}catch(_0x482ed1){utils[_0x2707('0x23')](util[_0x2707('0x15')](_0x2707('0x34'),_0x1a8034['uniqueid']),_0x482ed1);}};exports[_0x2707('0x3a')]=function(_0x40a1a8){try{utils[_0x2707('0x1b')](util[_0x2707('0x15')]('[%s][agents][attendedtransfer]',_0x40a1a8[_0x2707('0x3b')]),_0x40a1a8);if(_0x40a1a8[_0x2707('0x3b')]==_0x40a1a8[_0x2707('0x3c')]){if(!_[_0x2707('0x1a')](agents[_0x40a1a8[_0x2707('0x3d')]])){utils[_0x2707('0x2')](util[_0x2707('0x15')](_0x2707('0x3e'),_0x40a1a8[_0x2707('0x3b')],agents[_0x40a1a8[_0x2707('0x3d')]]['membername']));agents[_0x40a1a8[_0x2707('0x3d')]]['transfer']=!![];agents[_0x40a1a8['secondtransfereruniqueid']][_0x2707('0x35')]='ATTENDED';agents[_0x40a1a8['secondtransfereruniqueid']][_0x2707('0x37')]=_0x40a1a8[_0x2707('0x3f')];agents[_0x40a1a8[_0x2707('0x3d')]][_0x2707('0x39')]=_0x40a1a8[_0x2707('0x3b')];}if(_0x40a1a8[_0x2707('0x40')]&&agents[_0x40a1a8[_0x2707('0x40')]]){agents[_0x40a1a8[_0x2707('0x40')]][_0x2707('0x41')]=0x1;transfers[_0x40a1a8[_0x2707('0x40')]]=_[_0x2707('0x42')](agents[_0x40a1a8['transfereeuniqueid']]);transfers[_0x40a1a8['transfereeuniqueid']]['calleridnum']=agents[_0x40a1a8[_0x2707('0x3d')]][_0x2707('0x7')];transfers[_0x40a1a8[_0x2707('0x40')]]['calleridname']=agents[_0x40a1a8['secondtransfereruniqueid']][_0x2707('0x43')];transfers[_0x40a1a8[_0x2707('0x40')]][_0x2707('0x44')]=utils[_0x2707('0x17')]();transfers[_0x40a1a8[_0x2707('0x40')]]['agentconnectAt']=utils['now']();transfers[_0x40a1a8[_0x2707('0x40')]][_0x2707('0x1f')]=0x0;transfers[_0x40a1a8[_0x2707('0x40')]][_0x2707('0x41')]=0x2;}}else if(_0x40a1a8[_0x2707('0x3d')]==_0x40a1a8[_0x2707('0x45')]){if(!_[_0x2707('0x1a')](agents[_0x40a1a8[_0x2707('0x3b')]])){utils[_0x2707('0x2')](util['format'](_0x2707('0x3e'),_0x40a1a8[_0x2707('0x3b')],agents[_0x40a1a8[_0x2707('0x3b')]][_0x2707('0x5')]));agents[_0x40a1a8[_0x2707('0x3b')]][_0x2707('0x46')]=!![];agents[_0x40a1a8['origtransfereruniqueid']]['transfertype']=_0x2707('0x47');agents[_0x40a1a8[_0x2707('0x3b')]]['transferexten']=_0x40a1a8['secondtransfererexten'];agents[_0x40a1a8['origtransfereruniqueid']]['transferuniqueid']=_0x40a1a8[_0x2707('0x3d')];}if(_0x40a1a8[_0x2707('0x48')]&&agents[_0x40a1a8['transfertargetuniqueid']]){agents[_0x40a1a8[_0x2707('0x48')]][_0x2707('0x41')]=0x1;transfers[_0x40a1a8[_0x2707('0x48')]]=_['clone'](agents[_0x40a1a8['transfertargetuniqueid']]);transfers[_0x40a1a8[_0x2707('0x48')]][_0x2707('0x7')]=agents[_0x40a1a8[_0x2707('0x3b')]][_0x2707('0x7')];transfers[_0x40a1a8[_0x2707('0x48')]][_0x2707('0x43')]=agents[_0x40a1a8[_0x2707('0x3b')]]['calleridname'];transfers[_0x40a1a8[_0x2707('0x48')]][_0x2707('0x44')]=utils[_0x2707('0x17')]();transfers[_0x40a1a8[_0x2707('0x48')]][_0x2707('0x31')]=utils[_0x2707('0x17')]();transfers[_0x40a1a8['transfertargetuniqueid']][_0x2707('0x1f')]=0x0;transfers[_0x40a1a8[_0x2707('0x48')]][_0x2707('0x41')]=0x2;}}}catch(_0x142606){utils[_0x2707('0x23')](util[_0x2707('0x15')]('[%s][agents][attendedtransfer]',_0x40a1a8['origtransfereruniqueid']),_0x142606);}};exports[_0x2707('0x49')]=function(_0x2b0df0){try{utils[_0x2707('0x1b')](util[_0x2707('0x15')](_0x2707('0x4a'),_0x2b0df0[_0x2707('0x3')]),_0x2b0df0);if(agents[_0x2b0df0['uniqueid']]&&agents[_0x2b0df0['uniqueid']][_0x2707('0x2b')]==='timeout'){if(_0x2b0df0[_0x2707('0x4b')]==='21'){agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2b')]=_0x2707('0x4c');agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x9')]='rejected';}utils[_0x2707('0x2')](util['format'](_0x2707('0x4d'),_0x2b0df0[_0x2707('0x3')],agents[_0x2b0df0['uniqueid']][_0x2707('0x5')],agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2b')],agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x9')]));writeDB(agents[_0x2b0df0['uniqueid']]);var _0x3bfec3=unanswered[_0x2707('0x4e')](_0x2b0df0[_0x2707('0x3')]);if(_0x3bfec3>-0x1){unanswered[_0x2707('0x4f')](_0x3bfec3,0x1);}}if(transfers[_0x2b0df0[_0x2707('0x3')]]){transfers[_0x2b0df0[_0x2707('0x3')]][_0x2707('0xe')]=!![];transfers[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2f')]=utils[_0x2707('0x17')]();transfers[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x21')]=utils[_0x2707('0x30')](transfers[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2f')],transfers[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x31')]);transfers[_0x2b0df0[_0x2707('0x3')]]['reason']=_0x2707('0x50');transfers[_0x2b0df0['uniqueid']]['lastevent']=_0x2707('0x51');utils[_0x2707('0x2')](util[_0x2707('0x15')](_0x2707('0x4d'),_0x2b0df0[_0x2707('0x3')],transfers[_0x2b0df0[_0x2707('0x3')]]['membername'],transfers[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2b')],transfers[_0x2b0df0[_0x2707('0x3')]]['lastevent']));writeDB(transfers[_0x2b0df0[_0x2707('0x3')]],!![]);}if(agents[_0x2b0df0[_0x2707('0x3')]]&&agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x31')]){agents[_0x2b0df0['uniqueid']][_0x2707('0xe')]=!![];agents[_0x2b0df0['uniqueid']][_0x2707('0x2f')]=utils[_0x2707('0x17')]();agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x21')]=utils[_0x2707('0x30')](agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2f')],agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x31')]);agents[_0x2b0df0['uniqueid']][_0x2707('0x2b')]=agents[_0x2b0df0['uniqueid']][_0x2707('0x46')]?_0x2707('0x46'):_0x2707('0x50');agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x9')]=_0x2707('0x51');utils['info'](util['format'](_0x2707('0x4d'),_0x2b0df0['uniqueid'],agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x5')],agents[_0x2b0df0[_0x2707('0x3')]][_0x2707('0x2b')],agents[_0x2b0df0['uniqueid']][_0x2707('0x9')]));writeDB(agents[_0x2b0df0[_0x2707('0x3')]]);}}catch(_0x17b7b7){utils['error'](util[_0x2707('0x15')](_0x2707('0x4a'),_0x2b0df0[_0x2707('0x3')]),_0x17b7b7);}}; \ No newline at end of file +var _0xe605=['agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','lastevent','timeout','holdtime','ringtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','now','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','agentconnectAt','reason','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfer','transfertype','transferexten','extension','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','type','agentacw','agentcomplete','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','agentcalledAt','called','connectedlinename','error','[%s][agents][agentcalled]'];(function(_0x2bb12c,_0x4524da){var _0x28f3ee=function(_0x1f2dc6){while(--_0x1f2dc6){_0x2bb12c['push'](_0x2bb12c['shift']());}};_0x28f3ee(++_0x4524da);}(_0xe605,0x92));var _0x5e60=function(_0xc07db,_0x5a056e){_0xc07db=_0xc07db-0x0;var _0x4f8ffe=_0xe605[_0xc07db];return _0x4f8ffe;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x36add0,_0x455efd){utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x4'),_0x36add0[_0x5e60('0x5')],_0x36add0[_0x5e60('0x6')],_0x36add0[_0x5e60('0x7')],_0x36add0[_0x5e60('0x8')],_0x36add0[_0x5e60('0x9')],_0x36add0[_0x5e60('0xa')],_0x36add0[_0x5e60('0xb')],_0x36add0['lastevent']));if(_0x36add0[_0x5e60('0x7')]){utils['getVoiceQueueByName'](_0x36add0['queue'])['then'](function(_0x43f7eb){if(_0x43f7eb){_0x36add0[_0x5e60('0xc')]=_0x43f7eb[_0x5e60('0xc')];_0x36add0[_0x5e60('0xd')]=_0x36add0[_0x5e60('0xe')]?_0x43f7eb[_0x5e60('0xf')]:![];_0x36add0['acwtime']=_0x36add0[_0x5e60('0xd')]?_0x43f7eb['acwTimeout']:0x0;}utils[_0x5e60('0x10')](_0x5e60('0x11'),_0x36add0);});}else{utils[_0x5e60('0x10')]('CreateVoiceAgentReport',_0x36add0);}if(_0x455efd){delete transfers[_0x36add0[_0x5e60('0x5')]];}else{delete agents[_0x36add0[_0x5e60('0x12')]];}}exports[_0x5e60('0x13')]=function(_0xe039de){try{utils[_0x5e60('0x14')](util[_0x5e60('0x3')]('[%s][agents][agentcalled]',_0xe039de[_0x5e60('0x5')]),_0xe039de);agents[_0xe039de[_0x5e60('0x12')]]=_0xe039de;agents[_0xe039de[_0x5e60('0x12')]][_0x5e60('0x15')]=utils['now']();agents[_0xe039de[_0x5e60('0x12')]]['lastevent']=_0x5e60('0x16');agents[_0xe039de[_0x5e60('0x12')]]['connectedlinenum']=null;agents[_0xe039de[_0x5e60('0x12')]][_0x5e60('0x17')]=null;utils[_0x5e60('0x2')](util[_0x5e60('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xe039de[_0x5e60('0x5')],agents[_0xe039de[_0x5e60('0x12')]]['membername'],_0xe039de[_0x5e60('0x12')]));}catch(_0x3a9e6b){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x19'),_0xe039de[_0x5e60('0x5')]),_0x3a9e6b);}};exports[_0x5e60('0x1a')]=function(_0x524c93){try{if(!_[_0x5e60('0x1b')](agents[_0x524c93[_0x5e60('0x12')]])){utils[_0x5e60('0x14')](util['format'](_0x5e60('0x1c'),_0x524c93['uniqueid']),_0x524c93);utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x1d'),_0x524c93[_0x5e60('0x5')],agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x8')],_0x524c93[_0x5e60('0x12')]));agents[_0x524c93['destuniqueid']][_0x5e60('0x1a')]=!![];agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x1e')]=utils['now']();agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x1f')]=_0x5e60('0x20');agents[_0x524c93[_0x5e60('0x12')]]['reason']=_0x5e60('0x20');agents[_0x524c93['destuniqueid']][_0x5e60('0x21')]=_0x524c93[_0x5e60('0x22')]?parseInt(_0x524c93['ringtime'])/0x3e8:0x0;agents[_0x524c93[_0x5e60('0x12')]][_0x5e60('0x23')]=0x0;unanswered['push'](_0x524c93[_0x5e60('0x12')]);}}catch(_0xac9c7a){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x524c93[_0x5e60('0x5')]),_0xac9c7a);}};exports[_0x5e60('0x24')]=function(_0x2e8e9e){try{_[_0x5e60('0x25')](agents,function(_0x3ccfee,_0x558197){if(_0x3ccfee[_0x5e60('0x5')]==_0x2e8e9e[_0x5e60('0x5')]&&!_['includes'](unanswered,_0x3ccfee[_0x5e60('0x12')])){utils['debug'](util['format'](_0x5e60('0x26'),_0x2e8e9e[_0x5e60('0x5')]),_0x2e8e9e);utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x27'),_0x2e8e9e[_0x5e60('0x5')],_0x3ccfee[_0x5e60('0x8')],_0x3ccfee[_0x5e60('0x12')]));_0x3ccfee[_0x5e60('0x1a')]=!![];_0x3ccfee[_0x5e60('0x1e')]=utils['now']();_0x3ccfee[_0x5e60('0x1f')]='abandoned';_0x3ccfee['reason']=_0x5e60('0x28');_0x3ccfee[_0x5e60('0x21')]=_0x2e8e9e['holdtime'];_0x3ccfee[_0x5e60('0x23')]=0x0;writeDB(_0x3ccfee);}});}catch(_0x576c70){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x26'),_0x2e8e9e[_0x5e60('0x5')]),_0x576c70);}};exports[_0x5e60('0x29')]=function(_0x23498b){try{if(agents[_0x23498b[_0x5e60('0x12')]]){utils[_0x5e60('0x14')](util['format'](_0x5e60('0x2a'),_0x23498b[_0x5e60('0x5')]),_0x23498b);utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x2b'),_0x23498b[_0x5e60('0x5')],agents[_0x23498b[_0x5e60('0x12')]]['membername'],_0x23498b[_0x5e60('0x12')]));agents[_0x23498b[_0x5e60('0x12')]]['agentconnectAt']=utils['now']();agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0xb')]=_0x23498b[_0x5e60('0xb')];agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0x17')]=_0x23498b['connectedlinename'];agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0x21')]=_0x23498b[_0x5e60('0x22')];agents[_0x23498b[_0x5e60('0x12')]][_0x5e60('0x1f')]=_0x5e60('0x2c');_[_0x5e60('0x25')](agents,function(_0x54022a,_0x401bf1){if(_0x54022a[_0x5e60('0x12')]!=_0x23498b['destuniqueid']&&_0x54022a['uniqueid']==_0x23498b['uniqueid']){_0x54022a[_0x5e60('0x23')]=0x0;_0x54022a[_0x5e60('0x21')]=_0x23498b[_0x5e60('0x22')];_0x54022a[_0x5e60('0x1a')]=!![];_0x54022a['agentringnoanswerAt']=utils[_0x5e60('0x2d')]();_0x54022a[_0x5e60('0x1f')]='answered_elsewhere';_0x54022a['reason']=_0x5e60('0x2e');_0x54022a[_0x5e60('0x2f')]=_0x23498b[_0x5e60('0x12')];_0x54022a[_0x5e60('0x30')]=_0x23498b[_0x5e60('0x8')];writeDB(_0x54022a);}});}}catch(_0x3899ae){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x2a'),_0x23498b['uniqueid']),_0x3899ae);}};exports[_0x5e60('0xe')]=function(_0x2bb154){try{if(!_['isNil'](agents[_0x2bb154[_0x5e60('0x12')]])){utils[_0x5e60('0x14')](util[_0x5e60('0x3')](_0x5e60('0x31'),_0x2bb154[_0x5e60('0x5')]),_0x2bb154);utils['info'](util[_0x5e60('0x3')](_0x5e60('0x32'),_0x2bb154[_0x5e60('0x5')],agents[_0x2bb154[_0x5e60('0x12')]]['membername'],_0x2bb154['destuniqueid']));agents[_0x2bb154['destuniqueid']][_0x5e60('0xe')]=!![];agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x33')]=utils[_0x5e60('0x2d')]();agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x23')]=utils['diffTime'](agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x33')],agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x34')]);agents[_0x2bb154[_0x5e60('0x12')]][_0x5e60('0x35')]=_0x2bb154[_0x5e60('0x35')];agents[_0x2bb154['destuniqueid']][_0x5e60('0x1f')]=_0x5e60('0x36');writeDB(agents[_0x2bb154[_0x5e60('0x12')]]);}}catch(_0x1b3add){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x31'),_0x2bb154[_0x5e60('0x5')]),_0x1b3add);}};exports[_0x5e60('0x37')]=function(_0x350d6d){try{if(!_[_0x5e60('0x1b')](agents[_0x350d6d[_0x5e60('0x38')]])){utils[_0x5e60('0x14')](util[_0x5e60('0x3')](_0x5e60('0x39'),_0x350d6d[_0x5e60('0x5')]),_0x350d6d);utils[_0x5e60('0x2')](util[_0x5e60('0x3')]('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x350d6d['uniqueid'],agents[_0x350d6d[_0x5e60('0x38')]]['membername'],agents[_0x350d6d[_0x5e60('0x38')]][_0x5e60('0x5')]));agents[_0x350d6d[_0x5e60('0x38')]][_0x5e60('0x3a')]=!![];agents[_0x350d6d[_0x5e60('0x38')]][_0x5e60('0x3b')]='blind';agents[_0x350d6d['transfereruniqueid']][_0x5e60('0x3c')]=_0x350d6d[_0x5e60('0x3d')];agents[_0x350d6d[_0x5e60('0x38')]]['transferuniqueid']=agents[_0x350d6d['transfereruniqueid']][_0x5e60('0x5')];}}catch(_0x46f3ba){utils[_0x5e60('0x18')](util['format'](_0x5e60('0x39'),_0x350d6d[_0x5e60('0x5')]),_0x46f3ba);}};exports[_0x5e60('0x3e')]=function(_0xf18339){try{utils[_0x5e60('0x14')](util[_0x5e60('0x3')]('[%s][agents][attendedtransfer]',_0xf18339[_0x5e60('0x3f')]),_0xf18339);if(_0xf18339[_0x5e60('0x3f')]==_0xf18339['origtransfererlinkedid']){if(!_[_0x5e60('0x1b')](agents[_0xf18339[_0x5e60('0x40')]])){utils[_0x5e60('0x2')](util['format'](_0x5e60('0x41'),_0xf18339[_0x5e60('0x3f')],agents[_0xf18339['secondtransfereruniqueid']][_0x5e60('0x8')]));agents[_0xf18339[_0x5e60('0x40')]][_0x5e60('0x3a')]=!![];agents[_0xf18339[_0x5e60('0x40')]]['transfertype']=_0x5e60('0x42');agents[_0xf18339[_0x5e60('0x40')]]['transferexten']=_0xf18339[_0x5e60('0x43')];agents[_0xf18339['secondtransfereruniqueid']][_0x5e60('0x44')]=_0xf18339['origtransfereruniqueid'];}if(_0xf18339[_0x5e60('0x45')]&&agents[_0xf18339[_0x5e60('0x45')]]){agents[_0xf18339['transfereeuniqueid']][_0x5e60('0x46')]=0x1;transfers[_0xf18339['transfereeuniqueid']]=_[_0x5e60('0x47')](agents[_0xf18339['transfereeuniqueid']]);transfers[_0xf18339[_0x5e60('0x45')]]['calleridnum']=agents[_0xf18339[_0x5e60('0x40')]][_0x5e60('0xa')];transfers[_0xf18339[_0x5e60('0x45')]][_0x5e60('0x48')]=agents[_0xf18339[_0x5e60('0x40')]][_0x5e60('0x48')];transfers[_0xf18339[_0x5e60('0x45')]]['agentcalledAt']=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x45')]][_0x5e60('0x34')]=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x45')]][_0x5e60('0x21')]=0x0;transfers[_0xf18339['transfereeuniqueid']]['agententerreason']=0x2;}}else if(_0xf18339['secondtransfereruniqueid']==_0xf18339[_0x5e60('0x49')]){if(!_[_0x5e60('0x1b')](agents[_0xf18339['origtransfereruniqueid']])){utils[_0x5e60('0x2')](util[_0x5e60('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xf18339[_0x5e60('0x3f')],agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x8')]));agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x3a')]=!![];agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x3b')]=_0x5e60('0x42');agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x3c')]=_0xf18339[_0x5e60('0x4a')];agents[_0xf18339[_0x5e60('0x3f')]][_0x5e60('0x44')]=_0xf18339[_0x5e60('0x40')];}if(_0xf18339[_0x5e60('0x4b')]&&agents[_0xf18339[_0x5e60('0x4b')]]){agents[_0xf18339[_0x5e60('0x4b')]]['agententerreason']=0x1;transfers[_0xf18339[_0x5e60('0x4b')]]=_[_0x5e60('0x47')](agents[_0xf18339[_0x5e60('0x4b')]]);transfers[_0xf18339['transfertargetuniqueid']][_0x5e60('0xa')]=agents[_0xf18339[_0x5e60('0x3f')]]['calleridnum'];transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x48')]=agents[_0xf18339['origtransfereruniqueid']][_0x5e60('0x48')];transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x15')]=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x34')]=utils[_0x5e60('0x2d')]();transfers[_0xf18339[_0x5e60('0x4b')]][_0x5e60('0x21')]=0x0;transfers[_0xf18339['transfertargetuniqueid']][_0x5e60('0x46')]=0x2;}}}catch(_0x2615f8){utils[_0x5e60('0x18')](util['format'](_0x5e60('0x4c'),_0xf18339[_0x5e60('0x3f')]),_0x2615f8);}};exports[_0x5e60('0x4d')]=function(_0x15d975){try{utils[_0x5e60('0x14')](util['format'](_0x5e60('0x4e'),_0x15d975[_0x5e60('0x5')]),_0x15d975);if(agents[_0x15d975[_0x5e60('0x5')]]&&agents[_0x15d975['uniqueid']]['reason']===_0x5e60('0x20')){if(_0x15d975[_0x5e60('0x4f')]==='21'){agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x35')]=_0x5e60('0x50');agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x1f')]='rejected';}utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x51'),_0x15d975['uniqueid'],agents[_0x15d975['uniqueid']][_0x5e60('0x8')],agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x35')],agents[_0x15d975['uniqueid']]['lastevent']));writeDB(agents[_0x15d975[_0x5e60('0x5')]]);var _0x45cc9c=unanswered[_0x5e60('0x52')](_0x15d975[_0x5e60('0x5')]);if(_0x45cc9c>-0x1){unanswered[_0x5e60('0x53')](_0x45cc9c,0x1);}}if(transfers[_0x15d975[_0x5e60('0x5')]]){transfers[_0x15d975['uniqueid']][_0x5e60('0xe')]=!![];transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')]=utils[_0x5e60('0x2d')]();transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x23')]=utils[_0x5e60('0x54')](transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')],transfers[_0x15d975['uniqueid']][_0x5e60('0x34')]);transfers[_0x15d975[_0x5e60('0x5')]]['reason']=_0x5e60('0x55');transfers[_0x15d975[_0x5e60('0x5')]]['lastevent']=_0x5e60('0x36');utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x51'),_0x15d975[_0x5e60('0x5')],transfers[_0x15d975[_0x5e60('0x5')]]['membername'],transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x35')],transfers[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x1f')]));writeDB(transfers[_0x15d975[_0x5e60('0x5')]],!![]);}if(agents[_0x15d975[_0x5e60('0x5')]]&&agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x34')]){agents[_0x15d975[_0x5e60('0x5')]]['agentcomplete']=!![];agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')]=utils[_0x5e60('0x2d')]();agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x23')]=utils[_0x5e60('0x54')](agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x33')],agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x34')]);agents[_0x15d975['uniqueid']]['reason']=agents[_0x15d975['uniqueid']][_0x5e60('0x3a')]?_0x5e60('0x3a'):_0x5e60('0x55');agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x1f')]=_0x5e60('0x36');utils[_0x5e60('0x2')](util[_0x5e60('0x3')](_0x5e60('0x51'),_0x15d975['uniqueid'],agents[_0x15d975[_0x5e60('0x5')]][_0x5e60('0x8')],agents[_0x15d975[_0x5e60('0x5')]]['reason'],agents[_0x15d975[_0x5e60('0x5')]]['lastevent']));writeDB(agents[_0x15d975['uniqueid']]);}}catch(_0x5c1aa2){utils[_0x5e60('0x18')](util[_0x5e60('0x3')](_0x5e60('0x4e'),_0x15d975[_0x5e60('0x5')]),_0x5c1aa2);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 9b083e4..1745587 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 _0x29e8=['error','attendedtransfer','[%s][calls][attendedtransfer]','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','_attended','origtransfererchannel','userfield','origtransfereruniqueid','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','lastdata','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','application','toLowerCase','set','startsWith','appdata','cdr','substring','lastIndexOf','noop','execif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','uniqueid','blinds','transfereeuniqueid','info','format','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','UserId','request','CreateVoiceCallReport','recording','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','systemanswertime','channelstate','transfer','destinationchannel','answertime','now','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','cause-txt','duration','diffTime','endtime','starttime','billableseconds'];(function(_0xf2e4e7,_0xdef7e1){var _0x51c09=function(_0x1170ae){while(--_0x1170ae){_0xf2e4e7['push'](_0xf2e4e7['shift']());}};_0x51c09(++_0xdef7e1);}(_0x29e8,0x116));var _0x829e=function(_0x5611ec,_0x543fcb){_0x5611ec=_0x5611ec-0x0;var _0x274432=_0x29e8[_0x5611ec];return _0x274432;};'use strict';var _=require(_0x829e('0x0'));var util=require(_0x829e('0x1'));var utils=require(_0x829e('0x2'));var transfers=require(_0x829e('0x3'));var dispositions=['NO\x20ANSWER',_0x829e('0x4'),'FAILED',_0x829e('0x5'),_0x829e('0x5'),_0x829e('0x5'),_0x829e('0x6'),'BUSY','FAILED',_0x829e('0x4'),'FAILED'];var channels={};function writeDB(_0x4a2a28){var _0x2764f7;if(transfers['blinds'][_0x4a2a28[_0x829e('0x7')]]){_0x2764f7=_0x4a2a28['uniqueid'];_0x4a2a28['uniqueid']=transfers[_0x829e('0x8')][_0x4a2a28[_0x829e('0x7')]][_0x829e('0x9')];}utils[_0x829e('0xa')](util[_0x829e('0xb')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x4a2a28[_0x829e('0x7')],_0x4a2a28[_0x829e('0xc')],_0x4a2a28[_0x829e('0xd')],_0x4a2a28[_0x829e('0xe')],_0x4a2a28['interface'],_0x4a2a28[_0x829e('0xf')],_0x4a2a28[_0x829e('0x10')],_0x4a2a28[_0x829e('0x11')]));if(_0x4a2a28['accountcode']){utils[_0x829e('0x12')](_0x4a2a28[_0x829e('0x13')])[_0x829e('0x14')](function(_0x1f81bb){if(_0x1f81bb){_0x4a2a28[_0x829e('0x15')]=_0x1f81bb['id'];}utils[_0x829e('0x16')]('CreateVoiceCallReport',_0x4a2a28);});}else{utils[_0x829e('0x16')](_0x829e('0x17'),_0x4a2a28);}if(channels[_0x4a2a28['uniqueid']]){delete channels[_0x4a2a28['uniqueid']];}else if(_0x2764f7&&channels[_0x2764f7]){if(!transfers[_0x829e('0x8')][_0x2764f7][_0x829e('0x18')])delete transfers[_0x829e('0x8')][_0x2764f7];delete channels[_0x2764f7];}}exports['newchannel']=function(_0x575bed){try{utils[_0x829e('0x19')](util['format'](_0x829e('0x1a'),_0x575bed[_0x829e('0x7')]),_0x575bed);if(_0x575bed['uniqueid']==_0x575bed[_0x829e('0x1b')]&&_0x575bed[_0x829e('0xc')]!=_0x829e('0x1c')){utils[_0x829e('0xa')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x575bed['uniqueid'],_0x575bed[_0x829e('0x1d')],_0x575bed[_0x829e('0x1e')]));channels[_0x575bed[_0x829e('0x7')]]={'uniqueid':_0x575bed['uniqueid'],'accountcode':_0x575bed['accountcode'],'source':_0x575bed['calleridnum'],'destination':_0x575bed['exten'],'destinationcontext':_0x575bed[_0x829e('0x1d')],'channel':_0x575bed[_0x829e('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x829e('0x5'),'amaflags':_0x829e('0x1f')};}}catch(_0x244b66){utils['error'](util[_0x829e('0xb')]('[%s][calls][newchannel]',_0x575bed[_0x829e('0x7')]),_0x244b66);}};exports[_0x829e('0x20')]=function(_0x460ee9){try{utils[_0x829e('0x19')](util[_0x829e('0xb')](_0x829e('0x21'),_0x460ee9[_0x829e('0x7')]),_0x460ee9);if(!_[_0x829e('0x22')](channels[_0x460ee9[_0x829e('0x7')]])&&_0x460ee9['channelstate']==0x6){utils[_0x829e('0xa')](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x460ee9[_0x829e('0x7')],_0x460ee9[_0x829e('0x1d')],_0x460ee9[_0x829e('0xc')]));if(_[_0x829e('0x22')](channels[_0x460ee9[_0x829e('0x7')]][_0x829e('0x23')])){channels[_0x460ee9[_0x829e('0x7')]][_0x829e('0x23')]=utils['now']();}}else if(!_[_0x829e('0x22')](channels[_0x460ee9[_0x829e('0x1b')]])&&_0x460ee9[_0x829e('0x24')]==0x6&&_0x460ee9[_0x829e('0x1d')]!=_0x829e('0x25')){utils[_0x829e('0xa')](util[_0x829e('0xb')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x460ee9[_0x829e('0x7')],_0x460ee9[_0x829e('0x1b')],_0x460ee9['context'],_0x460ee9[_0x829e('0xc')]));channels[_0x460ee9['linkedid']][_0x829e('0x13')]=_0x460ee9['accountcode'];channels[_0x460ee9['linkedid']][_0x829e('0x26')]=_0x460ee9[_0x829e('0xc')];if(_[_0x829e('0x22')](channels[_0x460ee9[_0x829e('0x1b')]][_0x829e('0x27')])){channels[_0x460ee9[_0x829e('0x1b')]][_0x829e('0x27')]=utils[_0x829e('0x28')]();}channels[_0x460ee9[_0x829e('0x1b')]][_0x829e('0x29')]=dispositions[_[_0x829e('0x2a')](_0x460ee9[_0x829e('0x24')])]||'ANSWERED';}}catch(_0x36bc5b){utils['error'](util[_0x829e('0xb')](_0x829e('0x21'),_0x460ee9[_0x829e('0x7')]),_0x36bc5b);}};exports[_0x829e('0x2b')]=function(_0x1def40){try{if(!_[_0x829e('0x22')](channels[_0x1def40[_0x829e('0x7')]])){utils[_0x829e('0x19')](util[_0x829e('0xb')](_0x829e('0x2c'),_0x1def40[_0x829e('0x7')]),_0x1def40);if(_[_0x829e('0x22')](channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x2d')])){channels[_0x1def40[_0x829e('0x7')]]['callerid']=_0x1def40['calleridname']+'\x20<'+_0x1def40['calleridnum']+'>';}utils[_0x829e('0xa')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1def40[_0x829e('0x7')],channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x2d')],_0x1def40[_0x829e('0x2e')]));channels[_0x1def40[_0x829e('0x7')]]['endtime']=utils[_0x829e('0x28')]();channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x2f')]=utils[_0x829e('0x30')](channels[_0x1def40['uniqueid']][_0x829e('0x31')],channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x32')]);channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x33')]=channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x27')]?utils[_0x829e('0x30')](channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x31')],channels[_0x1def40[_0x829e('0x7')]][_0x829e('0x27')]):0x0;writeDB(channels[_0x1def40[_0x829e('0x7')]]);}}catch(_0x15240f){utils[_0x829e('0x34')](util[_0x829e('0xb')](_0x829e('0x2c'),_0x1def40[_0x829e('0x7')]),_0x15240f);}};exports[_0x829e('0x35')]=function(_0x184a96){try{if(!_[_0x829e('0x22')](channels[_0x184a96['localtwolinkedid']])){utils[_0x829e('0x19')](util[_0x829e('0xb')](_0x829e('0x36'),_0x184a96['origtransfereruniqueid']),_0x184a96);if(channels[_0x184a96[_0x829e('0x37')]][_0x829e('0xc')]==_0x184a96[_0x829e('0x38')]){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x39'),_0x184a96['origtransfereruniqueid'],_0x184a96['localtwolinkedid'],_0x184a96[_0x829e('0x3a')]));channels[_0x184a96[_0x829e('0x37')]][_0x829e('0x26')]=_0x184a96[_0x829e('0x3a')];channels[_0x184a96[_0x829e('0x37')]]['userfield']=_0x829e('0x3b');}else if(channels[_0x184a96['localtwolinkedid']]['channel']=_0x184a96['transfertargetchannel']){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x39'),_0x184a96['origtransfereruniqueid'],_0x184a96['localtwolinkedid'],_0x184a96[_0x829e('0x3c')]));channels[_0x184a96['localtwolinkedid']]['destinationchannel']=_0x184a96[_0x829e('0x3c')];channels[_0x184a96[_0x829e('0x37')]][_0x829e('0x3d')]='_attended';}}}catch(_0x1d8643){utils[_0x829e('0x34')](util['format'](_0x829e('0x36'),_0x184a96[_0x829e('0x3e')]),_0x1d8643);}};exports[_0x829e('0x3f')]=function(_0x4cd880){try{if(!_['isNil'](channels[_0x4cd880[_0x829e('0x7')]])){utils[_0x829e('0x19')](util[_0x829e('0xb')](_0x829e('0x40'),_0x4cd880[_0x829e('0x7')]),_0x4cd880);channels[_0x4cd880[_0x829e('0x7')]][_0x829e('0x41')]=utils[_0x829e('0x28')]();utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x42'),_0x4cd880[_0x829e('0x7')],channels[_0x4cd880[_0x829e('0x7')]][_0x829e('0x41')]));}}catch(_0x52b62b){utils[_0x829e('0x34')](util[_0x829e('0xb')](_0x829e('0x40'),_0x4cd880[_0x829e('0x7')]),_0x52b62b);}};exports['musiconholdstop']=function(_0x270f53){try{if(!_['isNil'](channels[_0x270f53['uniqueid']])){utils['debug'](util[_0x829e('0xb')](_0x829e('0x43'),_0x270f53[_0x829e('0x7')]),_0x270f53);if(!_['isNil'](channels[_0x270f53['uniqueid']][_0x829e('0x41')])){channels[_0x270f53[_0x829e('0x7')]][_0x829e('0x44')]+=utils[_0x829e('0x30')](utils[_0x829e('0x28')](),channels[_0x270f53[_0x829e('0x7')]][_0x829e('0x41')]);utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x45'),_0x270f53[_0x829e('0x7')],channels[_0x270f53[_0x829e('0x7')]][_0x829e('0x44')]));delete channels[_0x270f53[_0x829e('0x7')]][_0x829e('0x41')];}}}catch(_0x492855){utils[_0x829e('0x34')](util[_0x829e('0xb')](_0x829e('0x43'),_0x270f53[_0x829e('0x7')]),_0x492855);}};exports[_0x829e('0x46')]=function(_0x2203ae){try{if(!_[_0x829e('0x22')](channels[_0x2203ae[_0x829e('0x7')]])){utils[_0x829e('0x19')](util[_0x829e('0xb')](_0x829e('0x47'),_0x2203ae[_0x829e('0x7')]),_0x2203ae);if(!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')][_0x829e('0x49')])){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x4a'),_0x2203ae[_0x829e('0x7')],_0x2203ae[_0x829e('0x4b')]));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x4c')]=_0x2203ae[_0x829e('0x4b')];}if(!_['isNil'](_0x2203ae[_0x829e('0x48')][_0x829e('0x4d')])){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x4e'),_0x2203ae[_0x829e('0x7')],_0x2203ae[_0x829e('0x4b')]));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x4f')]=_0x2203ae[_0x829e('0x4b')];channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x2d')]='\x22'+_0x2203ae[_0x829e('0x4b')]+_0x829e('0x50')+_0x2203ae[_0x829e('0x4b')]+'>';}if(!_['isNil'](_0x2203ae[_0x829e('0x48')][_0x829e('0x51')])||!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')][_0x829e('0x52')])){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x53'),_0x2203ae[_0x829e('0x7')],!_['isNil'](_0x2203ae['variable']['xmd-callerid-preview'])?_0x829e('0x51'):_0x829e('0x52'),_0x2203ae['value']));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x2d')]=_0x2203ae[_0x829e('0x4b')];}if(!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')][_0x829e('0x54')])||!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')][_0x829e('0x55')])){utils[_0x829e('0xa')](util[_0x829e('0xb')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x2203ae[_0x829e('0x7')],!_['isNil'](_0x2203ae['variable'][_0x829e('0x54')])?_0x829e('0x54'):_0x829e('0x55'),_0x2203ae['value']));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x56')]='Queue';channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x57')]=_0x2203ae[_0x829e('0x4b')];channels[_0x2203ae[_0x829e('0x7')]]['queue']=!![];}if(!_['isNil'](_0x2203ae[_0x829e('0x48')]['xmd-contactid'])){utils[_0x829e('0xa')](util['format'](_0x829e('0x58'),_0x2203ae[_0x829e('0x7')],_0x2203ae[_0x829e('0x4b')]));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x59')]=_0x2203ae[_0x829e('0x4b')];}if(!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')][_0x829e('0x5a')])){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x5b'),_0x2203ae[_0x829e('0x7')],_0x2203ae[_0x829e('0x4b')]));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x5c')]=_0x2203ae[_0x829e('0x4b')];}if(!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')][_0x829e('0x5d')])){utils[_0x829e('0xa')](util['format'](_0x829e('0x5e'),_0x2203ae[_0x829e('0x7')],_0x2203ae[_0x829e('0x4b')]));channels[_0x2203ae[_0x829e('0x7')]][_0x829e('0x5f')]=_0x2203ae[_0x829e('0x4b')];}if(!_[_0x829e('0x22')](_0x2203ae[_0x829e('0x48')]['sipcallid'])){utils[_0x829e('0xa')](util[_0x829e('0xb')](_0x829e('0x60'),_0x2203ae[_0x829e('0x7')],_0x2203ae['value']));channels[_0x2203ae['uniqueid']][_0x829e('0x61')]=_0x2203ae['value'];}}}catch(_0x2565fd){utils[_0x829e('0x34')](util[_0x829e('0xb')]('[%s][calls][varset]',_0x2203ae['uniqueid']),_0x2565fd);}};exports[_0x829e('0x62')]=function(_0x12cb50){try{if(!_[_0x829e('0x22')](channels[_0x12cb50['uniqueid']])){utils[_0x829e('0x19')](util[_0x829e('0xb')](_0x829e('0x63'),_0x12cb50[_0x829e('0x7')]),_0x12cb50);utils[_0x829e('0xa')](util[_0x829e('0xb')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x12cb50[_0x829e('0x7')],_0x12cb50['application'],_0x12cb50['appdata']));if(_0x12cb50[_0x829e('0x64')][_0x829e('0x65')]()==_0x829e('0x66')&&_[_0x829e('0x67')](_0x12cb50[_0x829e('0x68')]['toLowerCase'](),_0x829e('0x69'))){var _0x399abd=_0x12cb50[_0x829e('0x68')]['split']('=');var _0x5b1759=_0x399abd[0x0][_0x829e('0x6a')](_0x399abd[0x0][_0x829e('0x6b')]('(')+0x1,_0x399abd[0x0][_0x829e('0x6b')](')'));var _0x1734fd=_0x399abd[0x1];channels[_0x12cb50[_0x829e('0x7')]][_0x5b1759]=_0x1734fd;}if(!_['includes']([_0x829e('0x2b'),_0x829e('0x6c'),_0x829e('0x6d'),_0x829e('0x66'),'gotoif'],_0x12cb50[_0x829e('0x64')][_0x829e('0x65')]())){channels[_0x12cb50[_0x829e('0x7')]][_0x829e('0x56')]=_0x12cb50['application'];channels[_0x12cb50[_0x829e('0x7')]]['lastdata']=_0x12cb50[_0x829e('0x68')];}}}catch(_0x586a3b){utils[_0x829e('0x34')](util[_0x829e('0xb')]('[%s][calls][newexten]',_0x12cb50[_0x829e('0x7')]),_0x586a3b);}}; \ No newline at end of file +var _0xd8a5=['[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','[%s][calls][newexten]','lodash','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','linkedid','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','DOCUMENTATION','error','[%s][calls][newchannel]','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','isNil','systemanswertime','now','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','localtwolinkedid','[%s][calls][attendedtransfer]','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','xmd-phone','destination','xmd-callerid','xmd-callerid-preview','xmd-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','lastapplication','lastdata','queue','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd8a5,0x160));var _0x5d8a=function(_0xe126d5,_0x2e013f){_0xe126d5=_0xe126d5-0x0;var _0x13ed00=_0xd8a5[_0xe126d5];return _0x13ed00;};'use strict';var _=require(_0x5d8a('0x0'));var util=require('util');var utils=require(_0x5d8a('0x1'));var transfers=require(_0x5d8a('0x2'));var dispositions=['NO\x20ANSWER',_0x5d8a('0x3'),_0x5d8a('0x3'),_0x5d8a('0x4'),_0x5d8a('0x4'),_0x5d8a('0x4'),_0x5d8a('0x5'),_0x5d8a('0x6'),_0x5d8a('0x3'),_0x5d8a('0x3'),_0x5d8a('0x3')];var channels={};function writeDB(_0x441fb9){var _0x3514c5;if(transfers[_0x5d8a('0x7')][_0x441fb9['uniqueid']]){_0x3514c5=_0x441fb9[_0x5d8a('0x8')];_0x441fb9[_0x5d8a('0x8')]=transfers[_0x5d8a('0x7')][_0x441fb9[_0x5d8a('0x8')]][_0x5d8a('0x9')];}utils['info'](util[_0x5d8a('0xa')](_0x5d8a('0xb'),_0x441fb9[_0x5d8a('0x8')],_0x441fb9[_0x5d8a('0xc')],_0x441fb9['queue'],_0x441fb9[_0x5d8a('0xd')],_0x441fb9[_0x5d8a('0xe')],_0x441fb9['calleridnum'],_0x441fb9[_0x5d8a('0xf')],_0x441fb9[_0x5d8a('0x10')]));if(_0x441fb9[_0x5d8a('0x11')]){utils[_0x5d8a('0x12')](_0x441fb9[_0x5d8a('0x11')])[_0x5d8a('0x13')](function(_0x3727d3){if(_0x3727d3){_0x441fb9[_0x5d8a('0x14')]=_0x3727d3['id'];}utils[_0x5d8a('0x15')](_0x5d8a('0x16'),_0x441fb9);});}else{utils[_0x5d8a('0x15')](_0x5d8a('0x16'),_0x441fb9);}if(channels[_0x441fb9['uniqueid']]){delete channels[_0x441fb9['uniqueid']];}else if(_0x3514c5&&channels[_0x3514c5]){if(!transfers[_0x5d8a('0x7')][_0x3514c5][_0x5d8a('0x17')])delete transfers['blinds'][_0x3514c5];delete channels[_0x3514c5];}}exports[_0x5d8a('0x18')]=function(_0x119d08){try{utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')]('[%s][calls][newchannel]',_0x119d08[_0x5d8a('0x8')]),_0x119d08);if(_0x119d08['uniqueid']==_0x119d08[_0x5d8a('0x1a')]&&_0x119d08[_0x5d8a('0xc')]!=_0x5d8a('0x1b')){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x1d'),_0x119d08[_0x5d8a('0x8')],_0x119d08['context'],_0x119d08[_0x5d8a('0x1e')]));channels[_0x119d08[_0x5d8a('0x8')]]={'uniqueid':_0x119d08[_0x5d8a('0x8')],'accountcode':_0x119d08[_0x5d8a('0x11')],'source':_0x119d08['calleridnum'],'destination':_0x119d08[_0x5d8a('0x1e')],'destinationcontext':_0x119d08[_0x5d8a('0x1f')],'channel':_0x119d08[_0x5d8a('0xc')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x5d8a('0x4'),'amaflags':_0x5d8a('0x20')};}}catch(_0x186aa9){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x22'),_0x119d08[_0x5d8a('0x8')]),_0x186aa9);}};exports['newstate']=function(_0x93d735){try{utils['debug'](util[_0x5d8a('0xa')](_0x5d8a('0x23'),_0x93d735[_0x5d8a('0x8')]),_0x93d735);if(!_['isNil'](channels[_0x93d735[_0x5d8a('0x8')]])&&_0x93d735[_0x5d8a('0x24')]==0x6){utils['info'](util['format'](_0x5d8a('0x25'),_0x93d735[_0x5d8a('0x8')],_0x93d735[_0x5d8a('0x1f')],_0x93d735['channel']));if(_[_0x5d8a('0x26')](channels[_0x93d735[_0x5d8a('0x8')]]['systemanswertime'])){channels[_0x93d735[_0x5d8a('0x8')]][_0x5d8a('0x27')]=utils[_0x5d8a('0x28')]();}}else if(!_[_0x5d8a('0x26')](channels[_0x93d735[_0x5d8a('0x1a')]])&&_0x93d735['channelstate']==0x6&&_0x93d735[_0x5d8a('0x1f')]!=_0x5d8a('0x29')){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x2a'),_0x93d735[_0x5d8a('0x8')],_0x93d735[_0x5d8a('0x1a')],_0x93d735[_0x5d8a('0x1f')],_0x93d735['channel']));channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x11')]=_0x93d735[_0x5d8a('0x11')];channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x2b')]=_0x93d735[_0x5d8a('0xc')];if(_[_0x5d8a('0x26')](channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x2c')])){channels[_0x93d735[_0x5d8a('0x1a')]][_0x5d8a('0x2c')]=utils[_0x5d8a('0x28')]();}channels[_0x93d735['linkedid']][_0x5d8a('0x2d')]=dispositions[_[_0x5d8a('0x2e')](_0x93d735[_0x5d8a('0x24')])]||'ANSWERED';}}catch(_0x3d6b9c){utils['error'](util[_0x5d8a('0xa')]('[%s][calls][newstate]',_0x93d735['uniqueid']),_0x3d6b9c);}};exports[_0x5d8a('0x2f')]=function(_0x543f69){try{if(!_['isNil'](channels[_0x543f69[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')](_0x5d8a('0x30'),_0x543f69[_0x5d8a('0x8')]),_0x543f69);if(_[_0x5d8a('0x26')](channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x31')])){channels[_0x543f69[_0x5d8a('0x8')]]['callerid']=_0x543f69['calleridname']+'\x20<'+_0x543f69['calleridnum']+'>';}utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x32'),_0x543f69[_0x5d8a('0x8')],channels[_0x543f69['uniqueid']]['callerid'],_0x543f69[_0x5d8a('0x33')]));channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x34')]=utils[_0x5d8a('0x28')]();channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x35')]=utils[_0x5d8a('0x36')](channels[_0x543f69['uniqueid']]['endtime'],channels[_0x543f69['uniqueid']][_0x5d8a('0x37')]);channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x38')]=channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x2c')]?utils[_0x5d8a('0x36')](channels[_0x543f69[_0x5d8a('0x8')]]['endtime'],channels[_0x543f69[_0x5d8a('0x8')]][_0x5d8a('0x2c')]):0x0;writeDB(channels[_0x543f69[_0x5d8a('0x8')]]);}}catch(_0x4c87ca){utils[_0x5d8a('0x21')](util[_0x5d8a('0xa')](_0x5d8a('0x30'),_0x543f69[_0x5d8a('0x8')]),_0x4c87ca);}};exports['attendedtransfer']=function(_0x58ea69){try{if(!_[_0x5d8a('0x26')](channels[_0x58ea69[_0x5d8a('0x39')]])){utils[_0x5d8a('0x19')](util['format'](_0x5d8a('0x3a'),_0x58ea69['origtransfereruniqueid']),_0x58ea69);if(channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0xc')]==_0x58ea69['transfereechannel']){utils['info'](util[_0x5d8a('0xa')](_0x5d8a('0x3b'),_0x58ea69[_0x5d8a('0x3c')],_0x58ea69[_0x5d8a('0x39')],_0x58ea69[_0x5d8a('0x3d')]));channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x2b')]=_0x58ea69[_0x5d8a('0x3d')];channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x3e')]=_0x5d8a('0x3f');}else if(channels[_0x58ea69['localtwolinkedid']][_0x5d8a('0xc')]=_0x58ea69[_0x5d8a('0x40')]){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x3b'),_0x58ea69[_0x5d8a('0x3c')],_0x58ea69['localtwolinkedid'],_0x58ea69['origtransfererchannel']));channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x2b')]=_0x58ea69[_0x5d8a('0x41')];channels[_0x58ea69[_0x5d8a('0x39')]][_0x5d8a('0x3e')]=_0x5d8a('0x3f');}}}catch(_0x1d1d54){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x3a'),_0x58ea69['origtransfereruniqueid']),_0x1d1d54);}};exports['musiconholdstart']=function(_0x37cd25){try{if(!_['isNil'](channels[_0x37cd25[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')](_0x5d8a('0x42'),_0x37cd25['uniqueid']),_0x37cd25);channels[_0x37cd25['uniqueid']][_0x5d8a('0x43')]=utils[_0x5d8a('0x28')]();utils['info'](util[_0x5d8a('0xa')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x37cd25['uniqueid'],channels[_0x37cd25[_0x5d8a('0x8')]][_0x5d8a('0x43')]));}}catch(_0x513b8f){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x42'),_0x37cd25[_0x5d8a('0x8')]),_0x513b8f);}};exports[_0x5d8a('0x44')]=function(_0x3543c2){try{if(!_[_0x5d8a('0x26')](channels[_0x3543c2[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')]('[%s][calls][musiconholdstop]',_0x3543c2['uniqueid']),_0x3543c2);if(!_[_0x5d8a('0x26')](channels[_0x3543c2['uniqueid']]['musiconholdstartAt'])){channels[_0x3543c2[_0x5d8a('0x8')]][_0x5d8a('0x45')]+=utils['diffTime'](utils['now'](),channels[_0x3543c2[_0x5d8a('0x8')]]['musiconholdstartAt']);utils[_0x5d8a('0x1c')](util['format'](_0x5d8a('0x46'),_0x3543c2[_0x5d8a('0x8')],channels[_0x3543c2[_0x5d8a('0x8')]][_0x5d8a('0x45')]));delete channels[_0x3543c2[_0x5d8a('0x8')]][_0x5d8a('0x43')];}}}catch(_0x27ac14){utils['error'](util[_0x5d8a('0xa')](_0x5d8a('0x47'),_0x3543c2[_0x5d8a('0x8')]),_0x27ac14);}};exports[_0x5d8a('0x48')]=function(_0xf1ee00){try{if(!_['isNil'](channels[_0xf1ee00[_0x5d8a('0x8')]])){utils['debug'](util[_0x5d8a('0xa')]('[%s][calls][varset]',_0xf1ee00[_0x5d8a('0x8')]),_0xf1ee00);if(!_['isNil'](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x4a')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x4b'),_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x4d')]=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x4e')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x4f')]=_0xf1ee00[_0x5d8a('0x4c')];channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x31')]='\x22'+_0xf1ee00['value']+'\x22\x20<'+_0xf1ee00[_0x5d8a('0x4c')]+'>';}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')]['xmd-callerid-preview'])||!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x50')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xf1ee00[_0x5d8a('0x8')],!_['isNil'](_0xf1ee00['variable'][_0x5d8a('0x51')])?_0x5d8a('0x51'):_0x5d8a('0x50'),_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]]['callerid']=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00['variable'][_0x5d8a('0x52')])||!_['isNil'](_0xf1ee00['variable']['xmcs-queue'])){utils[_0x5d8a('0x1c')](util['format'](_0x5d8a('0x53'),_0xf1ee00[_0x5d8a('0x8')],!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x52')])?'xmd-queue':_0x5d8a('0x54'),_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x55')]='Queue';channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x56')]=_0xf1ee00[_0x5d8a('0x4c')];channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x57')]=!![];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')]['xmd-contactid'])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0xf1ee00['uniqueid'],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]][_0x5d8a('0x58')]=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x59')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')](_0x5d8a('0x5a'),_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]]['type']=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x5b')])){utils[_0x5d8a('0x1c')](util['format'](_0x5d8a('0x5c'),_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00['uniqueid']][_0x5d8a('0x5d')]=_0xf1ee00[_0x5d8a('0x4c')];}if(!_[_0x5d8a('0x26')](_0xf1ee00[_0x5d8a('0x49')][_0x5d8a('0x5e')])){utils[_0x5d8a('0x1c')](util[_0x5d8a('0xa')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0xf1ee00[_0x5d8a('0x8')],_0xf1ee00[_0x5d8a('0x4c')]));channels[_0xf1ee00[_0x5d8a('0x8')]]['sipcallid']=_0xf1ee00[_0x5d8a('0x4c')];}}}catch(_0x40aab8){utils[_0x5d8a('0x21')](util[_0x5d8a('0xa')](_0x5d8a('0x5f'),_0xf1ee00['uniqueid']),_0x40aab8);}};exports[_0x5d8a('0x60')]=function(_0x1a3084){try{if(!_[_0x5d8a('0x26')](channels[_0x1a3084[_0x5d8a('0x8')]])){utils[_0x5d8a('0x19')](util[_0x5d8a('0xa')]('[%s][calls][newexten]',_0x1a3084[_0x5d8a('0x8')]),_0x1a3084);utils['info'](util[_0x5d8a('0xa')](_0x5d8a('0x61'),_0x1a3084['uniqueid'],_0x1a3084[_0x5d8a('0x62')],_0x1a3084[_0x5d8a('0x63')]));if(_0x1a3084['application']['toLowerCase']()==_0x5d8a('0x64')&&_[_0x5d8a('0x65')](_0x1a3084['appdata'][_0x5d8a('0x66')](),_0x5d8a('0x67'))){var _0x2c78d2=_0x1a3084[_0x5d8a('0x63')]['split']('=');var _0x483dd2=_0x2c78d2[0x0][_0x5d8a('0x68')](_0x2c78d2[0x0][_0x5d8a('0x69')]('(')+0x1,_0x2c78d2[0x0][_0x5d8a('0x69')](')'));var _0x17ffdd=_0x2c78d2[0x1];channels[_0x1a3084[_0x5d8a('0x8')]][_0x483dd2]=_0x17ffdd;}if(!_[_0x5d8a('0x6a')]([_0x5d8a('0x2f'),_0x5d8a('0x6b'),_0x5d8a('0x6c'),_0x5d8a('0x64'),_0x5d8a('0x6d')],_0x1a3084[_0x5d8a('0x62')][_0x5d8a('0x66')]())){channels[_0x1a3084['uniqueid']][_0x5d8a('0x55')]=_0x1a3084[_0x5d8a('0x62')];channels[_0x1a3084[_0x5d8a('0x8')]][_0x5d8a('0x56')]=_0x1a3084[_0x5d8a('0x63')];}}}catch(_0x4c87aa){utils[_0x5d8a('0x21')](util['format'](_0x5d8a('0x6e'),_0x1a3084[_0x5d8a('0x8')]),_0x4c87aa);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 138058e..6af176f 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 _0xf121=['shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','managerevent','connect','info','[core]\x20connected'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf121,0x76));var _0x1f12=function(_0x2bea70,_0x3ff17c){_0x2bea70=_0x2bea70-0x0;var _0x264d07=_0xf121[_0x2bea70];return _0x264d07;};'use strict';var utils=require('./utils');exports[_0x1f12('0x0')]=function(){utils[_0x1f12('0x1')](_0x1f12('0x2'));};exports[_0x1f12('0x3')]=function(){utils[_0x1f12('0x1')](_0x1f12('0x4'));};exports[_0x1f12('0x5')]=function(){utils['info'](_0x1f12('0x6'));};exports['error']=function(_0x595cea){utils[_0x1f12('0x7')]('[core]\x20error',_0x595cea);};exports[_0x1f12('0x8')]=function(){utils['info'](_0x1f12('0x9'));};exports[_0x1f12('0xa')]=function(_0x496636){}; \ No newline at end of file +var _0x3594=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x3594,0x1f2));var _0x4359=function(_0x3eeddb,_0x4c6397){_0x3eeddb=_0x3eeddb-0x0;var _0x54dbe1=_0x3594[_0x3eeddb];return _0x54dbe1;};'use strict';var utils=require('./utils');exports[_0x4359('0x0')]=function(){utils[_0x4359('0x1')](_0x4359('0x2'));};exports[_0x4359('0x3')]=function(){utils[_0x4359('0x1')]('[core]\x20shutdown');};exports[_0x4359('0x4')]=function(){utils[_0x4359('0x1')](_0x4359('0x5'));};exports[_0x4359('0x6')]=function(_0x40d83f){utils[_0x4359('0x6')](_0x4359('0x7'),_0x40d83f);};exports[_0x4359('0x8')]=function(){utils['info'](_0x4359('0x9'));};exports[_0x4359('0xa')]=function(_0xa09a0f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 671f783..0a26b89 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 _0xd808=['dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','diffTime','holdtime','endtime','billableseconds','util','./utils','info','format','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','uniqueid','application','set','startsWith','appdata','cdr(routeid)','split','error','[%s][dials][varset]','isNil','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialbegin]'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xd808,0x100));var _0x8d80=function(_0x5ef905,_0x564b87){_0x5ef905=_0x5ef905-0x0;var _0x367808=_0xd808[_0x5ef905];return _0x367808;};'use strict';var _=require('lodash');var util=require(_0x8d80('0x0'));var utils=require(_0x8d80('0x1'));var dials={};function writeDB(_0xb03af8){utils[_0x8d80('0x2')](util[_0x8d80('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0xb03af8['uniqueid'],_0xb03af8[_0x8d80('0x4')],_0xb03af8[_0x8d80('0x5')],_0xb03af8[_0x8d80('0x6')],_0xb03af8[_0x8d80('0x7')],_0xb03af8[_0x8d80('0x8')]));utils[_0x8d80('0x9')]('CreateVoiceDialReport',_0xb03af8);delete dials[_0xb03af8['uniqueid']];}exports['newexten']=function(_0x3e75a5){try{utils[_0x8d80('0xa')](util['format'](_0x8d80('0xb'),_0x3e75a5['uniqueid']),_0x3e75a5);utils[_0x8d80('0x2')](util[_0x8d80('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3e75a5[_0x8d80('0xc')],_0x3e75a5[_0x8d80('0xd')],_0x3e75a5['appdata']));if(_0x3e75a5[_0x8d80('0xd')]['toLowerCase']()==_0x8d80('0xe')&&_[_0x8d80('0xf')](_0x3e75a5[_0x8d80('0x10')]['toLowerCase'](),_0x8d80('0x11'))){var _0x1756f9=_0x3e75a5[_0x8d80('0x10')][_0x8d80('0x12')]('=');dials[_0x3e75a5[_0x8d80('0xc')]]={'routeId':_0x1756f9[0x1]};}}catch(_0x12a6ee){utils[_0x8d80('0x13')](util[_0x8d80('0x3')](_0x8d80('0xb'),_0x3e75a5['uniqueid']),_0x12a6ee);}};exports['varset']=function(_0x2c3a74){try{utils[_0x8d80('0xa')](util[_0x8d80('0x3')](_0x8d80('0x14'),_0x2c3a74[_0x8d80('0xc')]),_0x2c3a74);if(!_[_0x8d80('0x15')](_0x2c3a74['variable']['outboundrouteid'])){utils[_0x8d80('0x2')](util[_0x8d80('0x3')](_0x8d80('0x16'),_0x2c3a74[_0x8d80('0xc')],_0x2c3a74[_0x8d80('0x17')]));dials[_0x2c3a74[_0x8d80('0xc')]]={'routeId':_0x2c3a74[_0x8d80('0x17')]};}}catch(_0x261829){utils[_0x8d80('0x13')](util[_0x8d80('0x3')](_0x8d80('0x14'),_0x2c3a74[_0x8d80('0xc')]),_0x261829);}};exports[_0x8d80('0x18')]=function(_0x4cc580){try{if(!_[_0x8d80('0x15')](dials[_0x4cc580[_0x8d80('0xc')]])){utils[_0x8d80('0xa')](util['format']('[%s][dials][dialbegin]',_0x4cc580[_0x8d80('0xc')]),_0x4cc580);dials[_0x4cc580[_0x8d80('0xc')]]=_[_0x8d80('0x19')](dials[_0x4cc580[_0x8d80('0xc')]],_0x4cc580);dials[_0x4cc580['uniqueid']][_0x8d80('0x1a')]=utils[_0x8d80('0x1b')]();dials[_0x4cc580[_0x8d80('0xc')]][_0x8d80('0x1c')]=_0x8d80('0x1d');utils[_0x8d80('0x2')](util[_0x8d80('0x3')](_0x8d80('0x1e'),_0x4cc580['uniqueid'],dials[_0x4cc580[_0x8d80('0xc')]][_0x8d80('0x1a')]));}}catch(_0x3e9fce){utils[_0x8d80('0x13')](util[_0x8d80('0x3')](_0x8d80('0x1f'),_0x4cc580[_0x8d80('0xc')]),_0x3e9fce);}};exports[_0x8d80('0x20')]=function(_0x1a6b1d){try{if(!_[_0x8d80('0x15')](dials[_0x1a6b1d['uniqueid']])){utils[_0x8d80('0xa')](util['format'](_0x8d80('0x21'),_0x1a6b1d[_0x8d80('0xc')]),_0x1a6b1d);dials[_0x1a6b1d['uniqueid']][_0x8d80('0x8')]=_0x1a6b1d[_0x8d80('0x8')];if(_0x1a6b1d[_0x8d80('0x8')]==_0x8d80('0x22')){dials[_0x1a6b1d[_0x8d80('0xc')]]=_[_0x8d80('0x19')](dials[_0x1a6b1d[_0x8d80('0xc')]],_0x1a6b1d);dials[_0x1a6b1d[_0x8d80('0xc')]][_0x8d80('0x23')]=utils[_0x8d80('0x1b')]();dials[_0x1a6b1d[_0x8d80('0xc')]][_0x8d80('0x1c')]='connect';utils[_0x8d80('0x2')](util[_0x8d80('0x3')](_0x8d80('0x24'),_0x1a6b1d['uniqueid'],_0x1a6b1d[_0x8d80('0x8')],dials[_0x1a6b1d[_0x8d80('0xc')]]['answertime']));}else{utils[_0x8d80('0x2')](util['format'](_0x8d80('0x25'),_0x1a6b1d[_0x8d80('0xc')],_0x1a6b1d[_0x8d80('0x8')]));}}}catch(_0x2652f8){utils[_0x8d80('0x13')](util['format'](_0x8d80('0x21'),_0x1a6b1d['uniqueid']),_0x2652f8);}};exports[_0x8d80('0x26')]=function(_0x4f1e4a){try{if(!_[_0x8d80('0x15')](dials[_0x4f1e4a['uniqueid']])){utils['debug'](util[_0x8d80('0x3')](_0x8d80('0x27'),_0x4f1e4a[_0x8d80('0xc')]),_0x4f1e4a);utils[_0x8d80('0x2')](util[_0x8d80('0x3')](_0x8d80('0x28'),_0x4f1e4a['uniqueid'],_0x4f1e4a[_0x8d80('0x6')],_0x4f1e4a[_0x8d80('0x29')],_0x4f1e4a[_0x8d80('0x2a')]));dials[_0x4f1e4a[_0x8d80('0xc')]]=_[_0x8d80('0x19')](dials[_0x4f1e4a[_0x8d80('0xc')]],{'endtime':utils[_0x8d80('0x1b')](),'lastevent':_0x8d80('0x2b')});dials[_0x4f1e4a[_0x8d80('0xc')]]['duration']=utils[_0x8d80('0x2c')](dials[_0x4f1e4a['uniqueid']]['endtime'],dials[_0x4f1e4a[_0x8d80('0xc')]][_0x8d80('0x1a')]);dials[_0x4f1e4a['uniqueid']][_0x8d80('0x2d')]=utils[_0x8d80('0x2c')](dials[_0x4f1e4a[_0x8d80('0xc')]][_0x8d80('0x23')]||dials[_0x4f1e4a[_0x8d80('0xc')]][_0x8d80('0x2e')],dials[_0x4f1e4a[_0x8d80('0xc')]][_0x8d80('0x1a')]);dials[_0x4f1e4a[_0x8d80('0xc')]][_0x8d80('0x2f')]=dials[_0x4f1e4a[_0x8d80('0xc')]][_0x8d80('0x23')]?utils['diffTime'](dials[_0x4f1e4a[_0x8d80('0xc')]]['endtime'],dials[_0x4f1e4a[_0x8d80('0xc')]]['answertime']):0x0;writeDB(dials[_0x4f1e4a['uniqueid']]);}}catch(_0x346516){utils[_0x8d80('0x13')](util['format']('[%s][dials][hangup]',_0x4f1e4a[_0x8d80('0xc')]),_0x346516);}}; \ No newline at end of file +var _0xac6a=['outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','set','startsWith','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable'];(function(_0x3917a2,_0x4c4c26){var _0x4a9110=function(_0x42247d){while(--_0x42247d){_0x3917a2['push'](_0x3917a2['shift']());}};_0x4a9110(++_0x4c4c26);}(_0xac6a,0x19f));var _0xaac6=function(_0x5d1c11,_0x35d3a8){_0x5d1c11=_0x5d1c11-0x0;var _0x308b83=_0xac6a[_0x5d1c11];return _0x308b83;};'use strict';var _=require('lodash');var util=require(_0xaac6('0x0'));var utils=require(_0xaac6('0x1'));var dials={};function writeDB(_0x150fed){utils[_0xaac6('0x2')](util['format'](_0xaac6('0x3'),_0x150fed[_0xaac6('0x4')],_0x150fed[_0xaac6('0x5')],_0x150fed[_0xaac6('0x6')],_0x150fed['calleridnum'],_0x150fed['connectedlinenum'],_0x150fed[_0xaac6('0x7')]));utils[_0xaac6('0x8')](_0xaac6('0x9'),_0x150fed);delete dials[_0x150fed['uniqueid']];}exports[_0xaac6('0xa')]=function(_0x17dbde){try{utils[_0xaac6('0xb')](util[_0xaac6('0xc')](_0xaac6('0xd'),_0x17dbde['uniqueid']),_0x17dbde);utils['info'](util[_0xaac6('0xc')](_0xaac6('0xe'),_0x17dbde[_0xaac6('0x4')],_0x17dbde['application'],_0x17dbde[_0xaac6('0xf')]));if(_0x17dbde['application']['toLowerCase']()==_0xaac6('0x10')&&_[_0xaac6('0x11')](_0x17dbde[_0xaac6('0xf')][_0xaac6('0x12')](),_0xaac6('0x13'))){var _0x245660=_0x17dbde[_0xaac6('0xf')][_0xaac6('0x14')]('=');dials[_0x17dbde[_0xaac6('0x4')]]={'routeId':_0x245660[0x1]};}}catch(_0x4a9244){utils[_0xaac6('0x15')](util[_0xaac6('0xc')]('[%s][dials][newexten]',_0x17dbde['uniqueid']),_0x4a9244);}};exports[_0xaac6('0x16')]=function(_0x3625f8){try{utils[_0xaac6('0xb')](util[_0xaac6('0xc')](_0xaac6('0x17'),_0x3625f8[_0xaac6('0x4')]),_0x3625f8);if(!_[_0xaac6('0x18')](_0x3625f8[_0xaac6('0x19')][_0xaac6('0x1a')])){utils['info'](util['format'](_0xaac6('0x1b'),_0x3625f8[_0xaac6('0x4')],_0x3625f8[_0xaac6('0x1c')]));dials[_0x3625f8[_0xaac6('0x4')]]={'routeId':_0x3625f8[_0xaac6('0x1c')]};}}catch(_0x32642e){utils[_0xaac6('0x15')](util[_0xaac6('0xc')](_0xaac6('0x17'),_0x3625f8[_0xaac6('0x4')]),_0x32642e);}};exports[_0xaac6('0x1d')]=function(_0x1ef81a){try{if(!_[_0xaac6('0x18')](dials[_0x1ef81a[_0xaac6('0x4')]])){utils['debug'](util[_0xaac6('0xc')](_0xaac6('0x1e'),_0x1ef81a[_0xaac6('0x4')]),_0x1ef81a);dials[_0x1ef81a[_0xaac6('0x4')]]=_[_0xaac6('0x1f')](dials[_0x1ef81a['uniqueid']],_0x1ef81a);dials[_0x1ef81a[_0xaac6('0x4')]][_0xaac6('0x20')]=utils[_0xaac6('0x21')]();dials[_0x1ef81a[_0xaac6('0x4')]]['lastevent']='called';utils[_0xaac6('0x2')](util['format'](_0xaac6('0x22'),_0x1ef81a['uniqueid'],dials[_0x1ef81a[_0xaac6('0x4')]][_0xaac6('0x20')]));}}catch(_0x37aac2){utils['error'](util['format']('[%s][dials][dialbegin]',_0x1ef81a[_0xaac6('0x4')]),_0x37aac2);}};exports['dialend']=function(_0xa32918){try{if(!_[_0xaac6('0x18')](dials[_0xa32918[_0xaac6('0x4')]])){utils[_0xaac6('0xb')](util[_0xaac6('0xc')]('[%s][dials][dialend]',_0xa32918[_0xaac6('0x4')]),_0xa32918);dials[_0xa32918[_0xaac6('0x4')]][_0xaac6('0x7')]=_0xa32918['dialstatus'];if(_0xa32918[_0xaac6('0x7')]==_0xaac6('0x23')){dials[_0xa32918['uniqueid']]=_[_0xaac6('0x1f')](dials[_0xa32918['uniqueid']],_0xa32918);dials[_0xa32918[_0xaac6('0x4')]][_0xaac6('0x24')]=utils[_0xaac6('0x21')]();dials[_0xa32918[_0xaac6('0x4')]]['lastevent']='connect';utils[_0xaac6('0x2')](util[_0xaac6('0xc')](_0xaac6('0x25'),_0xa32918[_0xaac6('0x4')],_0xa32918[_0xaac6('0x7')],dials[_0xa32918['uniqueid']][_0xaac6('0x24')]));}else{utils[_0xaac6('0x2')](util[_0xaac6('0xc')](_0xaac6('0x26'),_0xa32918[_0xaac6('0x4')],_0xa32918['dialstatus']));}}}catch(_0x53ee2f){utils[_0xaac6('0x15')](util[_0xaac6('0xc')](_0xaac6('0x27'),_0xa32918['uniqueid']),_0x53ee2f);}};exports['hangup']=function(_0x44bc84){try{if(!_[_0xaac6('0x18')](dials[_0x44bc84[_0xaac6('0x4')]])){utils[_0xaac6('0xb')](util[_0xaac6('0xc')]('[%s][dials][hangup]',_0x44bc84[_0xaac6('0x4')]),_0x44bc84);utils[_0xaac6('0x2')](util[_0xaac6('0xc')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x44bc84['uniqueid'],_0x44bc84[_0xaac6('0x28')],_0x44bc84[_0xaac6('0x29')],_0x44bc84[_0xaac6('0x2a')]));dials[_0x44bc84[_0xaac6('0x4')]]=_[_0xaac6('0x1f')](dials[_0x44bc84[_0xaac6('0x4')]],{'endtime':utils[_0xaac6('0x21')](),'lastevent':_0xaac6('0x2b')});dials[_0x44bc84['uniqueid']][_0xaac6('0x2c')]=utils[_0xaac6('0x2d')](dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x2e')],dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x20')]);dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x2f')]=utils[_0xaac6('0x2d')](dials[_0x44bc84[_0xaac6('0x4')]]['answertime']||dials[_0x44bc84[_0xaac6('0x4')]]['endtime'],dials[_0x44bc84['uniqueid']]['starttime']);dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x30')]=dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x24')]?utils[_0xaac6('0x2d')](dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x2e')],dials[_0x44bc84[_0xaac6('0x4')]][_0xaac6('0x24')]):0x0;writeDB(dials[_0x44bc84[_0xaac6('0x4')]]);}}catch(_0x271795){utils['error'](util[_0xaac6('0xc')]('[%s][dials][hangup]',_0x44bc84[_0xaac6('0x4')]),_0x271795);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ba2da0f..8b281ff 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 _0x9a82=['[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend'];(function(_0x2c55a2,_0x3bc170){var _0x20fdcb=function(_0x36ee86){while(--_0x36ee86){_0x2c55a2['push'](_0x2c55a2['shift']());}};_0x20fdcb(++_0x3bc170);}(_0x9a82,0x109));var _0x29a8=function(_0x138980,_0x99e2d5){_0x138980=_0x138980-0x0;var _0x45bf47=_0x9a82[_0x138980];return _0x45bf47;};var AsteriskManager=require(_0x29a8('0x0'));var config=require(_0x29a8('0x1'));var utils=require(_0x29a8('0x2'));var util=require(_0x29a8('0x3'));var isXDREnabled=config[_0x29a8('0x4')]&&config[_0x29a8('0x4')][_0x29a8('0x5')]?!config[_0x29a8('0x4')][_0x29a8('0x5')]:!![];var isProduction=config['env']===_0x29a8('0x6')||![];var isLocalAsterisk=config['xdr']&&config['xdr'][_0x29a8('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x29a8('0x8')][_0x29a8('0x9')],config[_0x29a8('0x8')]['ip'],config[_0x29a8('0x8')][_0x29a8('0xa')],config[_0x29a8('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info']('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x29a8('0xb'));}else{var agents=require('./agents.controller');var calls=require(_0x29a8('0xc'));var queues=require(_0x29a8('0xd'));var recordings=require('./recordings.controller');var members=require(_0x29a8('0xe'));var dials=require(_0x29a8('0xf'));var transfers=require('./transfers.controller');var core=require(_0x29a8('0x10'));ami['on'](_0x29a8('0x11'),core[_0x29a8('0x11')]);ami['on'](_0x29a8('0x12'),core[_0x29a8('0x12')]);ami['on'](_0x29a8('0x13'),core[_0x29a8('0x13')]);ami['on'](_0x29a8('0x14'),core[_0x29a8('0x14')]);ami['on']('close',core[_0x29a8('0x15')]);ami['on'](_0x29a8('0x16'),core[_0x29a8('0x16')]);ami['on'](_0x29a8('0x17'),function(_0x27ec3b){try{utils[_0x29a8('0x18')](util['format']('[%s][index][devicestatechange]',_0x27ec3b['device']),_0x27ec3b);members['devicestatechange'](_0x27ec3b);}catch(_0xdf246c){utils[_0x29a8('0x14')](util[_0x29a8('0x19')]('[%s][index][devicestatechange]',_0x27ec3b['device']),_0xdf246c);}});ami['on']('agentcalled',function(_0x370339){try{utils[_0x29a8('0x18')](util['format'](_0x29a8('0x1a'),_0x370339[_0x29a8('0x1b')]),_0x370339);agents[_0x29a8('0x1c')](_0x370339);}catch(_0x41394c){utils['error'](util[_0x29a8('0x19')]('[%s][index][agentcalled]',_0x370339['uniqueid']),_0x41394c);}});ami['on'](_0x29a8('0x1d'),function(_0x4ace69){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x1e'),_0x4ace69[_0x29a8('0x1b')]),_0x4ace69);agents[_0x29a8('0x1d')](_0x4ace69);}catch(_0x1671c7){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x1e'),_0x4ace69[_0x29a8('0x1b')]),_0x1671c7);}});ami['on'](_0x29a8('0x1f'),function(_0x3e370c){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x20'),_0x3e370c[_0x29a8('0x1b')]),_0x3e370c);agents[_0x29a8('0x1f')](_0x3e370c);queues[_0x29a8('0x1f')](_0x3e370c);}catch(_0x42c739){utils[_0x29a8('0x14')](util['format'](_0x29a8('0x20'),_0x3e370c[_0x29a8('0x1b')]),_0x42c739);}});ami['on']('agentcomplete',function(_0x25dcce){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x21'),_0x25dcce[_0x29a8('0x1b')]),_0x25dcce);agents[_0x29a8('0x22')](_0x25dcce);queues[_0x29a8('0x22')](_0x25dcce);members[_0x29a8('0x22')](_0x25dcce);}catch(_0x7d95a9){utils[_0x29a8('0x14')](util['format']('[%s][index][agentcomplete]',_0x25dcce['uniqueid']),_0x7d95a9);}});ami['on'](_0x29a8('0x23'),function(_0xe3ddc0){try{utils['debug'](util[_0x29a8('0x19')](_0x29a8('0x24'),_0xe3ddc0[_0x29a8('0x1b')]),_0xe3ddc0);agents[_0x29a8('0x23')](_0xe3ddc0);queues[_0x29a8('0x23')](_0xe3ddc0);}catch(_0x5c2c13){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x24'),_0xe3ddc0['uniqueid']),_0x5c2c13);}});ami['on'](_0x29a8('0x25'),function(_0x5362a5){try{utils[_0x29a8('0x18')](util['format']('[%s][index][queuecallerjoin]',_0x5362a5[_0x29a8('0x1b')]),_0x5362a5);queues[_0x29a8('0x25')](_0x5362a5);recordings[_0x29a8('0x25')](_0x5362a5);}catch(_0x13c509){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x26'),_0x5362a5[_0x29a8('0x1b')]),_0x13c509);}});ami['on'](_0x29a8('0x27'),function(_0x3962b4){try{utils[_0x29a8('0x18')](util['format'](_0x29a8('0x28'),_0x3962b4['uniqueid']),_0x3962b4);queues[_0x29a8('0x27')](_0x3962b4);}catch(_0x2797bb){utils[_0x29a8('0x14')](util['format'](_0x29a8('0x28'),_0x3962b4[_0x29a8('0x1b')]),_0x2797bb);}});ami['on']('musiconholdstart',function(_0x51462d){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')]('[%s][index][musiconholdstart]',_0x51462d[_0x29a8('0x1b')]),_0x51462d);queues[_0x29a8('0x29')](_0x51462d);calls[_0x29a8('0x29')](_0x51462d);}catch(_0x40d8ea){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x2a'),_0x51462d[_0x29a8('0x1b')]),_0x40d8ea);}});ami['on'](_0x29a8('0x2b'),function(_0x3a5637){try{utils['debug'](util[_0x29a8('0x19')](_0x29a8('0x2c'),_0x3a5637[_0x29a8('0x1b')]),_0x3a5637);queues[_0x29a8('0x2b')](_0x3a5637);calls[_0x29a8('0x2b')](_0x3a5637);}catch(_0x420c8b){utils['error'](util[_0x29a8('0x19')](_0x29a8('0x2c'),_0x3a5637[_0x29a8('0x1b')]),_0x420c8b);}});ami['on'](_0x29a8('0x2d'),function(_0x3e348b){try{utils['debug'](util[_0x29a8('0x19')](_0x29a8('0x2e'),_0x3e348b['uniqueid']),_0x3e348b);calls[_0x29a8('0x2d')](_0x3e348b);recordings[_0x29a8('0x2d')](_0x3e348b);}catch(_0xdfdd6c){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x2e'),_0x3e348b[_0x29a8('0x1b')]),_0xdfdd6c);}});ami['on']('hangup',function(_0x562f25){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x2f'),_0x562f25['uniqueid']),_0x562f25);calls['hangup'](_0x562f25);recordings['hangup'](_0x562f25);dials[_0x29a8('0x30')](_0x562f25);agents[_0x29a8('0x30')](_0x562f25);queues[_0x29a8('0x30')](_0x562f25);}catch(_0x1bd96c){utils['error'](util[_0x29a8('0x19')](_0x29a8('0x2f'),_0x562f25[_0x29a8('0x1b')]),_0x1bd96c);}});ami['on'](_0x29a8('0x31'),function(_0x51752b){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x32'),_0x51752b[_0x29a8('0x1b')]),_0x51752b);members[_0x29a8('0x31')](_0x51752b);}catch(_0x361dd9){utils[_0x29a8('0x14')](util[_0x29a8('0x19')]('[%s][index][cdr]',_0x51752b[_0x29a8('0x1b')]),_0x361dd9);}});ami['on'](_0x29a8('0x33'),function(_0x301caf){try{utils['debug'](util[_0x29a8('0x19')]('[%s][index][blindtransfer]',_0x301caf['uniqueid']),_0x301caf);queues[_0x29a8('0x33')](_0x301caf);agents[_0x29a8('0x33')](_0x301caf);transfers[_0x29a8('0x33')](_0x301caf);recordings[_0x29a8('0x33')](_0x301caf);}catch(_0x217e8b){utils[_0x29a8('0x14')](util['format']('[%s][index][blindtransfer]',_0x301caf[_0x29a8('0x1b')]),_0x217e8b);}});ami['on'](_0x29a8('0x34'),function(_0x163eb3){try{utils['debug'](util[_0x29a8('0x19')](_0x29a8('0x35'),_0x163eb3['origtransfereruniqueid']),_0x163eb3);queues[_0x29a8('0x34')](_0x163eb3);transfers[_0x29a8('0x34')](_0x163eb3);agents[_0x29a8('0x34')](_0x163eb3);calls['attendedtransfer'](_0x163eb3);}catch(_0x12f09b){utils[_0x29a8('0x14')](util[_0x29a8('0x19')]('[%s][index][attendedtransfer]',_0x163eb3[_0x29a8('0x36')]),_0x12f09b);}});ami['on'](_0x29a8('0x37'),function(_0x246829){try{utils['debug'](util[_0x29a8('0x19')](_0x29a8('0x38'),_0x246829[_0x29a8('0x1b')]),_0x246829);queues['varset'](_0x246829);recordings['varset'](_0x246829);calls[_0x29a8('0x37')](_0x246829);dials['varset'](_0x246829);}catch(_0x19f799){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x38'),_0x246829[_0x29a8('0x1b')]),_0x19f799);}});ami['on']('newexten',function(_0x2d4b92){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x39'),_0x2d4b92[_0x29a8('0x1b')]),_0x2d4b92);calls['newexten'](_0x2d4b92);recordings['newexten'](_0x2d4b92);dials[_0x29a8('0x3a')](_0x2d4b92);}catch(_0x188de7){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x39'),_0x2d4b92['uniqueid']),_0x188de7);}});ami['on'](_0x29a8('0x3b'),function(_0x468605){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x3c'),_0x468605[_0x29a8('0x1b')]),_0x468605);calls[_0x29a8('0x3b')](_0x468605);recordings[_0x29a8('0x3b')](_0x468605);}catch(_0x415d59){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x3c'),_0x468605['uniqueid']),_0x415d59);}});ami['on'](_0x29a8('0x3d'),function(_0x1a1ff4){try{utils[_0x29a8('0x18')](util['format'](_0x29a8('0x3e'),_0x1a1ff4[_0x29a8('0x1b')]),_0x1a1ff4);dials[_0x29a8('0x3d')](_0x1a1ff4);}catch(_0x565eef){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x3f'),_0x1a1ff4['uniqueid']),_0x565eef);}});ami['on'](_0x29a8('0x40'),function(_0x4790c7){try{utils[_0x29a8('0x18')](util[_0x29a8('0x19')](_0x29a8('0x41'),_0x4790c7[_0x29a8('0x1b')]),_0x4790c7);dials[_0x29a8('0x40')](_0x4790c7);}catch(_0x5ad699){utils[_0x29a8('0x14')](util[_0x29a8('0x19')](_0x29a8('0x41'),_0x4790c7[_0x29a8('0x1b')]),_0x5ad699);}});} \ No newline at end of file +var _0x75e8=['[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','./utils','util','xdr','disabled','env','local','port','asterisk','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave'];(function(_0x5e7990,_0x20fcbe){var _0x5d5b2e=function(_0x1cce14){while(--_0x1cce14){_0x5e7990['push'](_0x5e7990['shift']());}};_0x5d5b2e(++_0x20fcbe);}(_0x75e8,0x183));var _0x875e=function(_0x58544f,_0x450cca){_0x58544f=_0x58544f-0x0;var _0x252d30=_0x75e8[_0x58544f];return _0x252d30;};var AsteriskManager=require(_0x875e('0x0'));var config=require('../../config/environment');var utils=require(_0x875e('0x1'));var util=require(_0x875e('0x2'));var isXDREnabled=config[_0x875e('0x3')]&&config[_0x875e('0x3')][_0x875e('0x4')]?!config[_0x875e('0x3')][_0x875e('0x4')]:!![];var isProduction=config[_0x875e('0x5')]==='production'||![];var isLocalAsterisk=config[_0x875e('0x3')]&&config[_0x875e('0x3')][_0x875e('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x875e('0x7')],config[_0x875e('0x8')]['ip'],config['asterisk']['username'],config['asterisk'][_0x875e('0x9')],!![]);ami[_0x875e('0xa')]();if(!isXDREnabled){utils[_0x875e('0xb')](_0x875e('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x875e('0xd'));}else{var agents=require(_0x875e('0xe'));var calls=require('./calls.controller');var queues=require(_0x875e('0xf'));var recordings=require(_0x875e('0x10'));var members=require(_0x875e('0x11'));var dials=require(_0x875e('0x12'));var transfers=require(_0x875e('0x13'));var core=require(_0x875e('0x14'));ami['on'](_0x875e('0x15'),core[_0x875e('0x15')]);ami['on'](_0x875e('0x16'),core[_0x875e('0x16')]);ami['on'](_0x875e('0x17'),core['fullybooted']);ami['on'](_0x875e('0x18'),core[_0x875e('0x18')]);ami['on'](_0x875e('0x19'),core[_0x875e('0x19')]);ami['on']('managerevent',core[_0x875e('0x1a')]);ami['on'](_0x875e('0x1b'),function(_0x3d139c){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')]('[%s][index][devicestatechange]',_0x3d139c[_0x875e('0x1e')]),_0x3d139c);members[_0x875e('0x1b')](_0x3d139c);}catch(_0x39a7bf){utils[_0x875e('0x18')](util[_0x875e('0x1d')]('[%s][index][devicestatechange]',_0x3d139c['device']),_0x39a7bf);}});ami['on'](_0x875e('0x1f'),function(_0x4a6754){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x20'),_0x4a6754[_0x875e('0x21')]),_0x4a6754);agents[_0x875e('0x1f')](_0x4a6754);}catch(_0x3d01f7){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x20'),_0x4a6754[_0x875e('0x21')]),_0x3d01f7);}});ami['on'](_0x875e('0x22'),function(_0x4c5f98){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x23'),_0x4c5f98[_0x875e('0x21')]),_0x4c5f98);agents['agentringnoanswer'](_0x4c5f98);}catch(_0x40979e){utils['error'](util[_0x875e('0x1d')](_0x875e('0x23'),_0x4c5f98['uniqueid']),_0x40979e);}});ami['on']('agentconnect',function(_0x2b6157){try{utils[_0x875e('0x1c')](util['format']('[%s][index][agentconnect]',_0x2b6157[_0x875e('0x21')]),_0x2b6157);agents[_0x875e('0x24')](_0x2b6157);queues[_0x875e('0x24')](_0x2b6157);}catch(_0x221d46){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x25'),_0x2b6157[_0x875e('0x21')]),_0x221d46);}});ami['on'](_0x875e('0x26'),function(_0x3576eb){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x27'),_0x3576eb['uniqueid']),_0x3576eb);agents['agentcomplete'](_0x3576eb);queues['agentcomplete'](_0x3576eb);members[_0x875e('0x26')](_0x3576eb);}catch(_0xad5ab2){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x27'),_0x3576eb['uniqueid']),_0xad5ab2);}});ami['on'](_0x875e('0x28'),function(_0x4a4f5c){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x29'),_0x4a4f5c['uniqueid']),_0x4a4f5c);agents[_0x875e('0x28')](_0x4a4f5c);queues[_0x875e('0x28')](_0x4a4f5c);}catch(_0x3a6430){utils[_0x875e('0x18')](util[_0x875e('0x1d')]('[%s][index][queuecallerabandon]',_0x4a4f5c[_0x875e('0x21')]),_0x3a6430);}});ami['on'](_0x875e('0x2a'),function(_0x93c504){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')]('[%s][index][queuecallerjoin]',_0x93c504[_0x875e('0x21')]),_0x93c504);queues[_0x875e('0x2a')](_0x93c504);recordings[_0x875e('0x2a')](_0x93c504);}catch(_0x5ce4df){utils['error'](util[_0x875e('0x1d')](_0x875e('0x2b'),_0x93c504['uniqueid']),_0x5ce4df);}});ami['on'](_0x875e('0x2c'),function(_0x2aa5e3){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')]('[%s][index][queuecallerleave]',_0x2aa5e3[_0x875e('0x21')]),_0x2aa5e3);queues[_0x875e('0x2c')](_0x2aa5e3);}catch(_0x358727){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x2d'),_0x2aa5e3[_0x875e('0x21')]),_0x358727);}});ami['on'](_0x875e('0x2e'),function(_0x27c281){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x2f'),_0x27c281[_0x875e('0x21')]),_0x27c281);queues[_0x875e('0x2e')](_0x27c281);calls['musiconholdstart'](_0x27c281);}catch(_0xe1eb01){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x2f'),_0x27c281[_0x875e('0x21')]),_0xe1eb01);}});ami['on'](_0x875e('0x30'),function(_0x88d6ec){try{utils['debug'](util[_0x875e('0x1d')]('[%s][index][musiconholdstop]',_0x88d6ec['uniqueid']),_0x88d6ec);queues['musiconholdstop'](_0x88d6ec);calls['musiconholdstop'](_0x88d6ec);}catch(_0x39f3d1){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x31'),_0x88d6ec[_0x875e('0x21')]),_0x39f3d1);}});ami['on'](_0x875e('0x32'),function(_0x4d56ba){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x33'),_0x4d56ba[_0x875e('0x21')]),_0x4d56ba);calls[_0x875e('0x32')](_0x4d56ba);recordings[_0x875e('0x32')](_0x4d56ba);}catch(_0x16ec3f){utils['error'](util[_0x875e('0x1d')](_0x875e('0x33'),_0x4d56ba['uniqueid']),_0x16ec3f);}});ami['on']('hangup',function(_0x4753a3){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x34'),_0x4753a3['uniqueid']),_0x4753a3);calls[_0x875e('0x35')](_0x4753a3);recordings['hangup'](_0x4753a3);dials['hangup'](_0x4753a3);agents[_0x875e('0x35')](_0x4753a3);queues['hangup'](_0x4753a3);}catch(_0x291931){utils[_0x875e('0x18')](util[_0x875e('0x1d')]('[%s][index][hangup]',_0x4753a3[_0x875e('0x21')]),_0x291931);}});ami['on'](_0x875e('0x36'),function(_0xb0a49d){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x37'),_0xb0a49d[_0x875e('0x21')]),_0xb0a49d);members[_0x875e('0x36')](_0xb0a49d);}catch(_0x6eddf0){utils[_0x875e('0x18')](util['format'](_0x875e('0x37'),_0xb0a49d['uniqueid']),_0x6eddf0);}});ami['on']('blindtransfer',function(_0x56625b){try{utils['debug'](util[_0x875e('0x1d')](_0x875e('0x38'),_0x56625b[_0x875e('0x21')]),_0x56625b);queues[_0x875e('0x39')](_0x56625b);agents[_0x875e('0x39')](_0x56625b);transfers['blindtransfer'](_0x56625b);recordings[_0x875e('0x39')](_0x56625b);}catch(_0x1d521f){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x38'),_0x56625b[_0x875e('0x21')]),_0x1d521f);}});ami['on'](_0x875e('0x3a'),function(_0x2f6361){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')]('[%s][index][attendedtransfer]',_0x2f6361['origtransfereruniqueid']),_0x2f6361);queues[_0x875e('0x3a')](_0x2f6361);transfers[_0x875e('0x3a')](_0x2f6361);agents['attendedtransfer'](_0x2f6361);calls[_0x875e('0x3a')](_0x2f6361);}catch(_0x5916ff){utils[_0x875e('0x18')](util['format'](_0x875e('0x3b'),_0x2f6361[_0x875e('0x3c')]),_0x5916ff);}});ami['on'](_0x875e('0x3d'),function(_0x4653a4){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x3e'),_0x4653a4['uniqueid']),_0x4653a4);queues[_0x875e('0x3d')](_0x4653a4);recordings[_0x875e('0x3d')](_0x4653a4);calls['varset'](_0x4653a4);dials[_0x875e('0x3d')](_0x4653a4);}catch(_0x49f1c6){utils['error'](util[_0x875e('0x1d')](_0x875e('0x3e'),_0x4653a4[_0x875e('0x21')]),_0x49f1c6);}});ami['on'](_0x875e('0x3f'),function(_0x20f6ad){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x40'),_0x20f6ad[_0x875e('0x21')]),_0x20f6ad);calls['newexten'](_0x20f6ad);recordings['newexten'](_0x20f6ad);dials[_0x875e('0x3f')](_0x20f6ad);}catch(_0x566904){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x40'),_0x20f6ad['uniqueid']),_0x566904);}});ami['on'](_0x875e('0x41'),function(_0x5e0a20){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x42'),_0x5e0a20[_0x875e('0x21')]),_0x5e0a20);calls['newchannel'](_0x5e0a20);recordings[_0x875e('0x41')](_0x5e0a20);}catch(_0x29ccb8){utils['error'](util[_0x875e('0x1d')](_0x875e('0x42'),_0x5e0a20[_0x875e('0x21')]),_0x29ccb8);}});ami['on'](_0x875e('0x43'),function(_0x559b85){try{utils[_0x875e('0x1c')](util[_0x875e('0x1d')](_0x875e('0x44'),_0x559b85[_0x875e('0x21')]),_0x559b85);dials[_0x875e('0x43')](_0x559b85);}catch(_0x4c80a7){utils[_0x875e('0x18')](util[_0x875e('0x1d')](_0x875e('0x45'),_0x559b85[_0x875e('0x21')]),_0x4c80a7);}});ami['on']('dialend',function(_0x4bd080){try{utils[_0x875e('0x1c')](util['format'](_0x875e('0x46'),_0x4bd080['uniqueid']),_0x4bd080);dials[_0x875e('0x47')](_0x4bd080);}catch(_0x2d62b8){utils[_0x875e('0x18')](util['format']('[%s][index][dialend]',_0x4bd080[_0x875e('0x21')]),_0x2d62b8);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index e10bd52..ff35daf 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 _0x0241=['[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','getUserByInterface','then','internal','request','getUserByName','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','duration','diffTime','exitAt','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','cdr','[%s][members][cdr]','channel','split','type','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','assign','data1','lodash','./utils','Local/_attended@transfer','Queue:','format'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x0241,0x65));var _0x1024=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0241[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x1024('0x0'));var util=require('util');var utils=require(_0x1024('0x1'));var members={};var exclude=[_0x1024('0x2'),_0x1024('0x3')];function writeDB(_0x3f453f){utils['info'](util[_0x1024('0x4')](_0x1024('0x5'),_0x3f453f[_0x1024('0x6')],_0x3f453f[_0x1024('0x7')],_0x3f453f['channel'],_0x3f453f['data2'],_0x3f453f[_0x1024('0x8')],_0x3f453f['type']));if(_0x3f453f[_0x1024('0x7')]){utils[_0x1024('0x9')](_0x3f453f['interface'])[_0x1024('0xa')](function(_0x15c52a){if(_0x15c52a){_0x3f453f['membername']=_0x15c52a['name'];_0x3f453f[_0x1024('0xb')]=_0x15c52a[_0x1024('0xb')];utils[_0x1024('0xc')]('CreateMemberReport',_0x3f453f);}else{utils[_0x1024('0xd')](_0x3f453f[_0x1024('0x7')]['split']('/')[0x1])[_0x1024('0xa')](function(_0x3c680b){if(_0x3c680b){_0x3f453f[_0x1024('0x8')]=_0x3c680b['name'];_0x3f453f[_0x1024('0xb')]=_0x3c680b['internal'];utils['request'](_0x1024('0xe'),_0x3f453f);}});}})[_0x1024('0xf')](function(_0xbcda87){utils[_0x1024('0x10')](util[_0x1024('0x4')](_0x1024('0x11'),_0x3f453f[_0x1024('0x6')]),_0xbcda87);});}delete members[_0x3f453f[_0x1024('0x7')]];}function startsWith(_0x30fcb5,_0x5d2bcd){return _[_0x1024('0x12')](_0x30fcb5,function(_0x4ebf31){return _[_0x1024('0x13')](_0x5d2bcd,_0x4ebf31);});}exports['devicestatechange']=function(_0x5e7022){try{utils[_0x1024('0x14')](util[_0x1024('0x4')](_0x1024('0x15'),members[_0x5e7022[_0x1024('0x16')]]?members[_0x5e7022['device']]['uniqueid']:_0x5e7022[_0x1024('0x16')]),_0x5e7022);utils[_0x1024('0x17')](util[_0x1024('0x4')](_0x1024('0x18'),members[_0x5e7022[_0x1024('0x16')]]?members[_0x5e7022['device']]['uniqueid']:_0x5e7022[_0x1024('0x16')],_0x5e7022[_0x1024('0x19')],_0x5e7022[_0x1024('0x16')]));switch(_0x5e7022['state']){case _0x1024('0x1a'):case _0x1024('0x1b'):if(!startsWith(exclude,_0x5e7022[_0x1024('0x16')])){members[_0x5e7022['device']]={'channel':_0x1024('0x1c'),'interface':_0x5e7022[_0x1024('0x16')],'type':_0x1024('0x1d'),'enterAt':utils[_0x1024('0x1e')](),'role':_0x1024('0x1f')};}break;case _0x1024('0x20'):if(!_[_0x1024('0x21')](members[_0x5e7022['device']])){members[_0x5e7022[_0x1024('0x16')]]['exitAt']=utils[_0x1024('0x1e')]();members[_0x5e7022[_0x1024('0x16')]][_0x1024('0x22')]=utils[_0x1024('0x23')](members[_0x5e7022[_0x1024('0x16')]][_0x1024('0x24')],members[_0x5e7022[_0x1024('0x16')]][_0x1024('0x25')]);if(members[_0x5e7022[_0x1024('0x16')]][_0x1024('0x6')]){writeDB(members[_0x5e7022[_0x1024('0x16')]]);}}break;default:break;}}catch(_0x4f1b62){utils['error'](util[_0x1024('0x4')](_0x1024('0x15'),members[_0x5e7022[_0x1024('0x16')]]?members[_0x5e7022['device']]['uniqueid']:_0x5e7022[_0x1024('0x16')]),_0x4f1b62);}};exports['agentcomplete']=function(_0x2c4f86){try{if(!_[_0x1024('0x21')](members[_0x2c4f86['interface']])){utils[_0x1024('0x14')](util['format'](_0x1024('0x26'),_0x2c4f86['uniqueid']),_0x2c4f86);utils['info'](util[_0x1024('0x4')](_0x1024('0x27'),_0x2c4f86['uniqueid'],_0x2c4f86[_0x1024('0x7')],_0x2c4f86['queue']));members[_0x2c4f86[_0x1024('0x7')]]=_['assign'](members[_0x2c4f86['interface']],{'data4':_0x2c4f86['queue'],'uniqueid':_0x2c4f86[_0x1024('0x6')]});}}catch(_0x580c19){utils[_0x1024('0x10')](util[_0x1024('0x4')](_0x1024('0x26'),_0x2c4f86['uniqueid']),_0x580c19);}};exports[_0x1024('0x28')]=function(_0x5c8295){try{utils['debug'](util[_0x1024('0x4')](_0x1024('0x29'),_0x5c8295[_0x1024('0x6')]),_0x5c8295);if(_0x5c8295[_0x1024('0x2a')]){var _0xfc1a2b=_0x5c8295[_0x1024('0x2a')][_0x1024('0x2b')]('-')[0x0];if(!_[_0x1024('0x21')](members[_0xfc1a2b])){members[_0xfc1a2b]=_['assign'](members[_0xfc1a2b],{'data1':members[_0xfc1a2b]['data1']||_0x5c8295[_0x1024('0x2c')],'data2':members[_0xfc1a2b][_0x1024('0x2d')]||_0x5c8295[_0x1024('0x2e')],'data3':members[_0xfc1a2b]['data3']||_0x5c8295[_0x1024('0x2f')],'uniqueid':members[_0xfc1a2b][_0x1024('0x6')]||_0x5c8295[_0x1024('0x6')]});utils[_0x1024('0x17')](util[_0x1024('0x4')](_0x1024('0x30'),_0x5c8295[_0x1024('0x6')],members[_0xfc1a2b]['data1'],members[_0xfc1a2b][_0x1024('0x2d')],members[_0xfc1a2b][_0x1024('0x31')]));if(members[_0xfc1a2b][_0x1024('0x24')]){writeDB(members[_0xfc1a2b]);}}}if(_0x5c8295[_0x1024('0x32')]){var _0x36754c=_0x5c8295[_0x1024('0x32')]['split']('-')[0x0];if(!_[_0x1024('0x21')](members[_0x36754c])){members[_0x36754c]=_[_0x1024('0x33')](members[_0x36754c],{'data1':members[_0x36754c][_0x1024('0x34')]||_0x5c8295[_0x1024('0x2c')],'data2':members[_0x36754c][_0x1024('0x2d')]||_0x5c8295[_0x1024('0x2e')],'data3':members[_0x36754c][_0x1024('0x31')]||_0x5c8295[_0x1024('0x2f')],'uniqueid':members[_0x36754c][_0x1024('0x6')]||_0x5c8295[_0x1024('0x6')]});utils[_0x1024('0x17')](util[_0x1024('0x4')](_0x1024('0x30'),_0x5c8295[_0x1024('0x6')],members[_0x36754c][_0x1024('0x34')],members[_0x36754c][_0x1024('0x2d')],members[_0x36754c]['data3']));if(members[_0x36754c][_0x1024('0x24')]){writeDB(members[_0x36754c]);}}}}catch(_0x7d1855){utils[_0x1024('0x10')](util[_0x1024('0x4')](_0x1024('0x29'),_0x5c8295[_0x1024('0x6')]),_0x7d1855);}}; \ No newline at end of file +var _0x63c4=['data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','destination','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','error','some','startsWith','devicestatechange','debug','[%s][members][devicestatechange]','device','uniqueid','state','INUSE','voice','now','agent','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','data1','type','source'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x63c4,0x1c6));var _0x463c=function(_0x132561,_0x54dcd4){_0x132561=_0x132561-0x0;var _0x56651d=_0x63c4[_0x132561];return _0x56651d;};'use strict';var _=require(_0x463c('0x0'));var util=require(_0x463c('0x1'));var utils=require(_0x463c('0x2'));var members={};var exclude=[_0x463c('0x3'),_0x463c('0x4')];function writeDB(_0x37fc1e){utils[_0x463c('0x5')](util[_0x463c('0x6')](_0x463c('0x7'),_0x37fc1e['uniqueid'],_0x37fc1e[_0x463c('0x8')],_0x37fc1e[_0x463c('0x9')],_0x37fc1e[_0x463c('0xa')],_0x37fc1e[_0x463c('0xb')],_0x37fc1e['type']));if(_0x37fc1e[_0x463c('0x8')]){utils[_0x463c('0xc')](_0x37fc1e[_0x463c('0x8')])[_0x463c('0xd')](function(_0x37d114){if(_0x37d114){_0x37fc1e['membername']=_0x37d114[_0x463c('0xe')];_0x37fc1e[_0x463c('0xf')]=_0x37d114['internal'];utils[_0x463c('0x10')](_0x463c('0x11'),_0x37fc1e);}else{utils[_0x463c('0x12')](_0x37fc1e[_0x463c('0x8')][_0x463c('0x13')]('/')[0x1])['then'](function(_0x1540c5){if(_0x1540c5){_0x37fc1e[_0x463c('0xb')]=_0x1540c5['name'];_0x37fc1e['internal']=_0x1540c5['internal'];utils[_0x463c('0x10')](_0x463c('0x11'),_0x37fc1e);}});}})['catch'](function(_0x76c843){utils[_0x463c('0x14')](util['format']('[%s][members][writeDB]',_0x37fc1e['uniqueid']),_0x76c843);});}delete members[_0x37fc1e[_0x463c('0x8')]];}function startsWith(_0x87e15f,_0xf49a35){return _[_0x463c('0x15')](_0x87e15f,function(_0x4d984e){return _[_0x463c('0x16')](_0xf49a35,_0x4d984e);});}exports[_0x463c('0x17')]=function(_0x3fec53){try{utils[_0x463c('0x18')](util[_0x463c('0x6')](_0x463c('0x19'),members[_0x3fec53[_0x463c('0x1a')]]?members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x1b')]:_0x3fec53['device']),_0x3fec53);utils['info'](util[_0x463c('0x6')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3fec53['device']]?members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x1b')]:_0x3fec53[_0x463c('0x1a')],_0x3fec53[_0x463c('0x1c')],_0x3fec53['device']));switch(_0x3fec53['state']){case _0x463c('0x1d'):case'BUSY':if(!startsWith(exclude,_0x3fec53[_0x463c('0x1a')])){members[_0x3fec53['device']]={'channel':_0x463c('0x1e'),'interface':_0x3fec53['device'],'type':'TALKING','enterAt':utils[_0x463c('0x1f')](),'role':_0x463c('0x20')};}break;case _0x463c('0x21'):if(!_['isNil'](members[_0x3fec53[_0x463c('0x1a')]])){members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x22')]=utils['now']();members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x23')]=utils['diffTime'](members[_0x3fec53[_0x463c('0x1a')]]['exitAt'],members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x24')]);if(members[_0x3fec53[_0x463c('0x1a')]]['uniqueid']){writeDB(members[_0x3fec53[_0x463c('0x1a')]]);}}break;default:break;}}catch(_0x3f5762){utils['error'](util['format'](_0x463c('0x19'),members[_0x3fec53[_0x463c('0x1a')]]?members[_0x3fec53[_0x463c('0x1a')]][_0x463c('0x1b')]:_0x3fec53[_0x463c('0x1a')]),_0x3f5762);}};exports[_0x463c('0x25')]=function(_0x5a7ee3){try{if(!_[_0x463c('0x26')](members[_0x5a7ee3[_0x463c('0x8')]])){utils['debug'](util['format'](_0x463c('0x27'),_0x5a7ee3[_0x463c('0x1b')]),_0x5a7ee3);utils['info'](util['format'](_0x463c('0x28'),_0x5a7ee3['uniqueid'],_0x5a7ee3['interface'],_0x5a7ee3['queue']));members[_0x5a7ee3[_0x463c('0x8')]]=_[_0x463c('0x29')](members[_0x5a7ee3['interface']],{'data4':_0x5a7ee3['queue'],'uniqueid':_0x5a7ee3['uniqueid']});}}catch(_0x2543dd){utils[_0x463c('0x14')](util[_0x463c('0x6')](_0x463c('0x27'),_0x5a7ee3[_0x463c('0x1b')]),_0x2543dd);}};exports[_0x463c('0x2a')]=function(_0x1497d8){try{utils[_0x463c('0x18')](util[_0x463c('0x6')]('[%s][members][cdr]',_0x1497d8[_0x463c('0x1b')]),_0x1497d8);if(_0x1497d8[_0x463c('0x9')]){var _0x15781d=_0x1497d8[_0x463c('0x9')]['split']('-')[0x0];if(!_['isNil'](members[_0x15781d])){members[_0x15781d]=_[_0x463c('0x29')](members[_0x15781d],{'data1':members[_0x15781d][_0x463c('0x2b')]||_0x1497d8[_0x463c('0x2c')],'data2':members[_0x15781d][_0x463c('0xa')]||_0x1497d8[_0x463c('0x2d')],'data3':members[_0x15781d][_0x463c('0x2e')]||_0x1497d8['destination'],'uniqueid':members[_0x15781d][_0x463c('0x1b')]||_0x1497d8[_0x463c('0x1b')]});utils[_0x463c('0x5')](util['format'](_0x463c('0x2f'),_0x1497d8[_0x463c('0x1b')],members[_0x15781d]['data1'],members[_0x15781d][_0x463c('0xa')],members[_0x15781d][_0x463c('0x2e')]));if(members[_0x15781d][_0x463c('0x22')]){writeDB(members[_0x15781d]);}}}if(_0x1497d8[_0x463c('0x30')]){var _0x3d2a2a=_0x1497d8[_0x463c('0x30')]['split']('-')[0x0];if(!_[_0x463c('0x26')](members[_0x3d2a2a])){members[_0x3d2a2a]=_[_0x463c('0x29')](members[_0x3d2a2a],{'data1':members[_0x3d2a2a]['data1']||_0x1497d8[_0x463c('0x2c')],'data2':members[_0x3d2a2a][_0x463c('0xa')]||_0x1497d8['source'],'data3':members[_0x3d2a2a]['data3']||_0x1497d8[_0x463c('0x31')],'uniqueid':members[_0x3d2a2a][_0x463c('0x1b')]||_0x1497d8[_0x463c('0x1b')]});utils[_0x463c('0x5')](util[_0x463c('0x6')](_0x463c('0x2f'),_0x1497d8['uniqueid'],members[_0x3d2a2a]['data1'],members[_0x3d2a2a][_0x463c('0xa')],members[_0x3d2a2a][_0x463c('0x2e')]));if(members[_0x3d2a2a][_0x463c('0x22')]){writeDB(members[_0x3d2a2a]);}}}}catch(_0x13731f){utils[_0x463c('0x14')](util[_0x463c('0x6')]('[%s][members][cdr]',_0x1497d8['uniqueid']),_0x13731f);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 85ba440..858481c 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 _0xee27=['[%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','ATTENDED','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%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]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','hangup','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinenum','queuecallerleaveAt','holdtime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','[%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','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime'];(function(_0x2bb66c,_0x36c6c6){var _0x1e0f98=function(_0x1e3412){while(--_0x1e3412){_0x2bb66c['push'](_0x2bb66c['shift']());}};_0x1e0f98(++_0x36c6c6);}(_0xee27,0xe2));var _0x7ee2=function(_0x3ed7ab,_0x1bd279){_0x3ed7ab=_0x3ed7ab-0x0;var _0x3951b7=_0xee27[_0x3ed7ab];return _0x3951b7;};'use strict';var _=require(_0x7ee2('0x0'));var util=require(_0x7ee2('0x1'));var utils=require(_0x7ee2('0x2'));var queues={};function writeDB(_0x11b752){utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x5'),_0x11b752[_0x7ee2('0x6')],_0x11b752[_0x7ee2('0x7')],_0x11b752['queue'],_0x11b752[_0x7ee2('0x8')],_0x11b752[_0x7ee2('0x9')],_0x11b752[_0x7ee2('0xa')],_0x11b752[_0x7ee2('0xb')]));if(_0x11b752[_0x7ee2('0xc')]){utils[_0x7ee2('0xd')](_0x11b752[_0x7ee2('0xc')])[_0x7ee2('0xe')](function(_0x3c9331){if(_0x3c9331){_0x11b752['type']=_0x3c9331[_0x7ee2('0xf')];}utils[_0x7ee2('0x10')](_0x7ee2('0x11'),_0x11b752);});}else{utils[_0x7ee2('0x10')](_0x7ee2('0x11'),_0x11b752);}if(_0x11b752[_0x7ee2('0x12')]){delete queues[_0x11b752[_0x7ee2('0x12')]];}else{delete queues[_0x11b752[_0x7ee2('0x6')]];}}exports['queuecallerjoin']=function(_0x4731c3){try{utils['debug'](util[_0x7ee2('0x4')]('[%s][queues][queuecallerjoin]',_0x4731c3[_0x7ee2('0x6')]),_0x4731c3);utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x13'),_0x4731c3[_0x7ee2('0x6')],_0x4731c3[_0x7ee2('0xc')],_0x4731c3[_0x7ee2('0x14')]));queues[_0x4731c3[_0x7ee2('0x6')]]=_['assign'](_0x4731c3,{'originalposition':_0x4731c3['position'],'queuecallerjoinAt':utils[_0x7ee2('0x15')](),'mohtime':0x0});}catch(_0x172b1b){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x17'),_0x4731c3[_0x7ee2('0x6')]),_0x172b1b);}};exports[_0x7ee2('0x18')]=function(_0x48539b){try{if(!_[_0x7ee2('0x19')](queues[_0x48539b['uniqueid']])){utils[_0x7ee2('0x1a')](util[_0x7ee2('0x4')](_0x7ee2('0x1b'),_0x48539b['uniqueid']),_0x48539b);if(queues[_0x48539b['uniqueid']]['queuecallerleaveAt']){if(!queues[_0x48539b[_0x7ee2('0x6')]][_0x7ee2('0x1c')]&&!queues[_0x48539b['uniqueid']]['queuecallerexit']){queues[_0x48539b['uniqueid']]['queuecallercomplete']=!![];queues[_0x48539b[_0x7ee2('0x6')]][_0x7ee2('0x1d')]=utils['now']();queues[_0x48539b[_0x7ee2('0x6')]][_0x7ee2('0xb')]=_0x7ee2('0x1e');}utils['info'](util[_0x7ee2('0x4')](_0x7ee2('0x1f'),_0x48539b[_0x7ee2('0x6')],queues[_0x48539b[_0x7ee2('0x6')]][_0x7ee2('0x20')],queues[_0x48539b[_0x7ee2('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x48539b['uniqueid']]);}else if(queues[_0x48539b[_0x7ee2('0x6')]][_0x7ee2('0x12')]){utils['info'](util[_0x7ee2('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x48539b['uniqueid'],queues[_0x48539b['uniqueid']][_0x7ee2('0x20')],queues[_0x48539b['uniqueid']][_0x7ee2('0x12')]));queues[queues[_0x48539b[_0x7ee2('0x6')]][_0x7ee2('0x12')]]=queues[_0x48539b[_0x7ee2('0x6')]];queues[queues[_0x48539b[_0x7ee2('0x6')]]['transfereduniqueid']][_0x7ee2('0x21')]=0x2;delete queues[_0x48539b[_0x7ee2('0x6')]];}}}catch(_0x41a8a7){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x1b'),_0x48539b[_0x7ee2('0x6')]),_0x41a8a7);}};exports[_0x7ee2('0x22')]=function(_0x223878){try{utils['debug'](util['format'](_0x7ee2('0x23'),_0x223878['uniqueid']),_0x223878);if(!_[_0x7ee2('0x19')](_0x223878[_0x7ee2('0x24')][_0x7ee2('0x25')])&&_0x223878[_0x7ee2('0x26')][_0x7ee2('0x27')]()!==_0x7ee2('0x28')){if(!_[_0x7ee2('0x19')](queues[_0x223878[_0x7ee2('0x6')]])){queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x1c')]=![];queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x29')]=null;queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x2a')]=!![];queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x2b')]=utils[_0x7ee2('0x15')]();queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0xb')]=_0x223878[_0x7ee2('0x26')][_0x7ee2('0x27')]();utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x223878[_0x7ee2('0x6')],queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x20')],_0x223878[_0x7ee2('0x26')],queues[_0x223878['uniqueid']][_0x7ee2('0xb')]));writeDB(queues[_0x223878[_0x7ee2('0x6')]]);}}else if(!_['isNil'](_0x223878[_0x7ee2('0x24')][_0x7ee2('0x2c')])){if(!_[_0x7ee2('0x19')](queues[_0x223878[_0x7ee2('0x6')]])&&!queues[_0x223878['uniqueid']][_0x7ee2('0x1c')]){queues[_0x223878['uniqueid']][_0x7ee2('0x1c')]=![];queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x29')]=null;queues[_0x223878[_0x7ee2('0x6')]]['queuecallerexit']=!![];queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x2b')]=utils[_0x7ee2('0x15')]();queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0xb')]=_0x7ee2('0x2d');utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x2e'),_0x223878[_0x7ee2('0x6')],queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0x20')],_0x223878['value'],queues[_0x223878[_0x7ee2('0x6')]][_0x7ee2('0xb')]));}}}catch(_0x47ca6e){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')]('[%s][queues][varset]',_0x223878[_0x7ee2('0x6')]),_0x47ca6e);}};exports[_0x7ee2('0x1c')]=function(_0x192b65){try{if(!_[_0x7ee2('0x19')](queues[_0x192b65[_0x7ee2('0x6')]])){utils['debug'](util['format'](_0x7ee2('0x2f'),_0x192b65[_0x7ee2('0x6')]),_0x192b65);queues[_0x192b65[_0x7ee2('0x6')]]['queuecallerexit']=![];queues[_0x192b65[_0x7ee2('0x6')]]['queuecallerexitAt']=null;queues[_0x192b65[_0x7ee2('0x6')]][_0x7ee2('0x1c')]=!![];queues[_0x192b65['uniqueid']][_0x7ee2('0x29')]=utils[_0x7ee2('0x15')]();queues[_0x192b65[_0x7ee2('0x6')]]['queuecallerexitreason']='ABANDONED';utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x30'),_0x192b65[_0x7ee2('0x6')],queues[_0x192b65[_0x7ee2('0x6')]][_0x7ee2('0x20')],queues[_0x192b65['uniqueid']][_0x7ee2('0xb')]));}}catch(_0x3ae3b7){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x2f'),_0x192b65[_0x7ee2('0x6')]),_0x3ae3b7);}};exports[_0x7ee2('0x31')]=function(_0x4cc0d2){try{if(!_[_0x7ee2('0x19')](queues[_0x4cc0d2[_0x7ee2('0x6')]])){utils[_0x7ee2('0x1a')](util[_0x7ee2('0x4')](_0x7ee2('0x32'),_0x4cc0d2[_0x7ee2('0x6')]),_0x4cc0d2);utils['info'](util[_0x7ee2('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4cc0d2[_0x7ee2('0x6')],queues[_0x4cc0d2[_0x7ee2('0x6')]]['name'],_0x4cc0d2[_0x7ee2('0x33')],_0x4cc0d2['connectedlinename']));queues[_0x4cc0d2[_0x7ee2('0x6')]][_0x7ee2('0x31')]=!![];queues[_0x4cc0d2[_0x7ee2('0x6')]][_0x7ee2('0x34')]=utils[_0x7ee2('0x15')]();queues[_0x4cc0d2['uniqueid']][_0x7ee2('0x35')]=utils['diffTime'](queues[_0x4cc0d2['uniqueid']][_0x7ee2('0x34')],queues[_0x4cc0d2[_0x7ee2('0x6')]][_0x7ee2('0x36')]);queues[_0x4cc0d2[_0x7ee2('0x6')]][_0x7ee2('0x14')]=_0x4cc0d2['position'];queues[_0x4cc0d2[_0x7ee2('0x6')]]['count']=_0x4cc0d2[_0x7ee2('0x37')];queues[_0x4cc0d2[_0x7ee2('0x6')]][_0x7ee2('0x33')]=_0x4cc0d2[_0x7ee2('0x33')];queues[_0x4cc0d2['uniqueid']][_0x7ee2('0x38')]=_0x4cc0d2[_0x7ee2('0x38')];}}catch(_0x5109bb){utils[_0x7ee2('0x16')](util['format'](_0x7ee2('0x32'),_0x4cc0d2[_0x7ee2('0x6')]),_0x5109bb);}};exports[_0x7ee2('0x39')]=function(_0x17c312){try{if(!_[_0x7ee2('0x19')](queues[_0x17c312[_0x7ee2('0x6')]])){utils['debug'](util[_0x7ee2('0x4')](_0x7ee2('0x3a'),_0x17c312[_0x7ee2('0x6')]),_0x17c312);utils['info'](util[_0x7ee2('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x17c312[_0x7ee2('0x6')],queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0x20')],_0x17c312[_0x7ee2('0x3b')],_0x17c312[_0x7ee2('0x3c')]));queues[_0x17c312['uniqueid']][_0x7ee2('0x1c')]=![];queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0x1c')]=![];queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0x29')]=null;queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0x2a')]=![];queues[_0x17c312[_0x7ee2('0x6')]]['queuecallerexitreason']=null;queues[_0x17c312[_0x7ee2('0x6')]]['queuecallerexitAt']=null;queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0x3d')]=!![];queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0xa')]=_0x17c312[_0x7ee2('0x3c')];queues[_0x17c312[_0x7ee2('0x6')]][_0x7ee2('0x8')]=_0x17c312[_0x7ee2('0x3b')];}}catch(_0x30b263){utils['error'](util[_0x7ee2('0x4')](_0x7ee2('0x3a'),_0x17c312[_0x7ee2('0x6')]),_0x30b263);}};exports[_0x7ee2('0x3e')]=function(_0x1a1a15){try{if(!_[_0x7ee2('0x19')](queues[_0x1a1a15[_0x7ee2('0x6')]])){if(queues[_0x1a1a15[_0x7ee2('0x6')]]['queuecallerleaveAt']){utils[_0x7ee2('0x1a')](util['format'](_0x7ee2('0x3f'),_0x1a1a15[_0x7ee2('0x6')]),_0x1a1a15);queues[_0x1a1a15['uniqueid']]['queuecallerabandon']=![];queues[_0x1a1a15['uniqueid']][_0x7ee2('0x1c')]=![];queues[_0x1a1a15[_0x7ee2('0x6')]]['queuecallerabandonAt']=null;queues[_0x1a1a15['uniqueid']]['queuecallerexit']=![];queues[_0x1a1a15[_0x7ee2('0x6')]][_0x7ee2('0x2b')]=null;queues[_0x1a1a15[_0x7ee2('0x6')]][_0x7ee2('0x3d')]=!![];queues[_0x1a1a15[_0x7ee2('0x6')]]['lastAssignedTo']=_0x1a1a15[_0x7ee2('0x3b')];queues[_0x1a1a15[_0x7ee2('0x6')]][_0x7ee2('0x40')]=!![];queues[_0x1a1a15['uniqueid']][_0x7ee2('0x1d')]=utils['now']();if(_0x1a1a15[_0x7ee2('0x41')]=='transfer'){if(!queues[_0x1a1a15[_0x7ee2('0x6')]][_0x7ee2('0x42')]){queues[_0x1a1a15[_0x7ee2('0x6')]]['queuecallerexitreason']=_0x7ee2('0x43');}}else{queues[_0x1a1a15[_0x7ee2('0x6')]]['queuecallerexitreason']='COMPLETEDBY'+_0x1a1a15[_0x7ee2('0x41')][_0x7ee2('0x27')]();}utils['info'](util[_0x7ee2('0x4')](_0x7ee2('0x44'),_0x1a1a15[_0x7ee2('0x6')],queues[_0x1a1a15[_0x7ee2('0x6')]][_0x7ee2('0x20')],_0x1a1a15[_0x7ee2('0x3b')],queues[_0x1a1a15[_0x7ee2('0x6')]][_0x7ee2('0xb')]));writeDB(queues[_0x1a1a15[_0x7ee2('0x6')]]);}}}catch(_0x19f91f){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x3f'),_0x1a1a15[_0x7ee2('0x6')]),_0x19f91f);}};exports['blindtransfer']=function(_0x42d4a1){try{if(!_['isNil'](queues[_0x42d4a1['transfereeuniqueid']])){utils[_0x7ee2('0x1a')](util[_0x7ee2('0x4')](_0x7ee2('0x45'),_0x42d4a1[_0x7ee2('0x6')]),_0x42d4a1);queues[_0x42d4a1[_0x7ee2('0x46')]][_0x7ee2('0x42')]=!![];queues[_0x42d4a1['transfereeuniqueid']][_0x7ee2('0x47')]=_0x7ee2('0x48');queues[_0x42d4a1[_0x7ee2('0x46')]][_0x7ee2('0x49')]=_0x42d4a1[_0x7ee2('0x4a')];queues[_0x42d4a1[_0x7ee2('0x46')]][_0x7ee2('0x4b')]=_0x42d4a1[_0x7ee2('0x46')];queues[_0x42d4a1[_0x7ee2('0x46')]][_0x7ee2('0xb')]=_0x7ee2('0x4c');utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x4d'),_0x42d4a1[_0x7ee2('0x6')],queues[_0x42d4a1['transfereeuniqueid']]['name'],_0x42d4a1['transfereeuniqueid'],_0x42d4a1[_0x7ee2('0x4a')]));}}catch(_0x1cb440){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')]('[%s][queues][blindtransfer]',_0x42d4a1['uniqueid']),_0x1cb440);}};exports['attendedtransfer']=function(_0x42998e){try{utils[_0x7ee2('0x1a')](util['format'](_0x7ee2('0x4e'),_0x42998e[_0x7ee2('0x4f')]),_0x42998e);if(_0x42998e[_0x7ee2('0x4f')]==_0x42998e[_0x7ee2('0x50')]){if(!_['isNil'](queues[_0x42998e[_0x7ee2('0x51')]])){utils[_0x7ee2('0x3')](util['format'](_0x7ee2('0x52'),_0x42998e[_0x7ee2('0x4f')],queues[_0x42998e['secondtransfererlinkedid']][_0x7ee2('0x20')],_0x42998e['origtransfererexten']));queues[_0x42998e[_0x7ee2('0x51')]][_0x7ee2('0x42')]=!![];queues[_0x42998e[_0x7ee2('0x51')]][_0x7ee2('0x47')]='ATTENDED';queues[_0x42998e[_0x7ee2('0x51')]]['transferexten']=_0x42998e[_0x7ee2('0x53')];queues[_0x42998e[_0x7ee2('0x51')]][_0x7ee2('0x4b')]=_0x42998e[_0x7ee2('0x4f')];queues[_0x42998e['secondtransfererlinkedid']][_0x7ee2('0xb')]=_0x7ee2('0x54');}if(!_[_0x7ee2('0x19')](queues[_0x42998e['origtransfererlinkedid']])){if(_0x42998e[_0x7ee2('0x55')]&&queues[_0x42998e['transfereelinkedid']]){queues[_0x42998e[_0x7ee2('0x55')]][_0x7ee2('0x21')]=0x1;queues[_0x42998e['transfereeuniqueid']]=_[_0x7ee2('0x56')](queues[_0x42998e[_0x7ee2('0x55')]]);queues[_0x42998e['transfereeuniqueid']][_0x7ee2('0x12')]=_0x42998e['transfertargetuniqueid'];queues[_0x42998e[_0x7ee2('0x46')]]['queuecallerenterreason']=0x2;queues[_0x42998e['transfereeuniqueid']][_0x7ee2('0x9')]=queues[_0x42998e['secondtransfererlinkedid']][_0x7ee2('0x9')];queues[_0x42998e['transfereeuniqueid']][_0x7ee2('0x57')]=queues[_0x42998e[_0x7ee2('0x51')]]['calleridname'];queues[_0x42998e[_0x7ee2('0x46')]]['queuecallerjoinAt']=utils[_0x7ee2('0x15')]();queues[_0x42998e['transfereeuniqueid']][_0x7ee2('0x34')]=utils[_0x7ee2('0x15')]();queues[_0x42998e[_0x7ee2('0x46')]][_0x7ee2('0x35')]=0x0;queues[_0x42998e[_0x7ee2('0x46')]][_0x7ee2('0x58')]=0x0;utils['info'](util[_0x7ee2('0x4')](_0x7ee2('0x59'),_0x42998e[_0x7ee2('0x4f')],queues[_0x42998e['transfereeuniqueid']]['name'],queues[_0x42998e[_0x7ee2('0x46')]][_0x7ee2('0x9')],queues[_0x42998e[_0x7ee2('0x46')]][_0x7ee2('0x57')]));}else{utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x5a'),_0x42998e['origtransfereruniqueid'],queues[_0x42998e[_0x7ee2('0x50')]][_0x7ee2('0x20')],_0x42998e['secondtransfererlinkedid']));queues[_0x42998e['origtransfererlinkedid']][_0x7ee2('0x12')]=_0x42998e[_0x7ee2('0x51')];}}}else if(_0x42998e['secondtransfereruniqueid']==_0x42998e[_0x7ee2('0x51')]){if(!_[_0x7ee2('0x19')](queues[_0x42998e[_0x7ee2('0x50')]])){utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x5b'),_0x42998e['origtransfereruniqueid'],queues[_0x42998e[_0x7ee2('0x50')]][_0x7ee2('0x20')],_0x42998e[_0x7ee2('0x5c')],_0x42998e['secondtransfererexten']));queues[_0x42998e['origtransfererlinkedid']][_0x7ee2('0x42')]=!![];queues[_0x42998e[_0x7ee2('0x50')]][_0x7ee2('0x47')]=_0x7ee2('0x5d');queues[_0x42998e['origtransfererlinkedid']]['transferexten']=_0x42998e[_0x7ee2('0x5e')];queues[_0x42998e[_0x7ee2('0x50')]][_0x7ee2('0x4b')]=_0x42998e[_0x7ee2('0x5c')];queues[_0x42998e['origtransfererlinkedid']][_0x7ee2('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x7ee2('0x19')](queues[_0x42998e[_0x7ee2('0x51')]])){if(_0x42998e[_0x7ee2('0x5f')]&&queues[_0x42998e[_0x7ee2('0x5f')]]){queues[_0x42998e[_0x7ee2('0x5f')]][_0x7ee2('0x21')]=0x1;queues[_0x42998e[_0x7ee2('0x60')]]=_[_0x7ee2('0x56')](queues[_0x42998e[_0x7ee2('0x5f')]]);queues[_0x42998e[_0x7ee2('0x60')]]['transfereduniqueid']=_0x42998e[_0x7ee2('0x60')];queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x21')]=0x2;queues[_0x42998e[_0x7ee2('0x60')]]['calleridnum']=queues[_0x42998e[_0x7ee2('0x50')]]['calleridnum'];queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x57')]=queues[_0x42998e['origtransfererlinkedid']][_0x7ee2('0x57')];queues[_0x42998e['transfertargetuniqueid']][_0x7ee2('0x36')]=utils[_0x7ee2('0x15')]();queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x34')]=utils[_0x7ee2('0x15')]();queues[_0x42998e['transfertargetuniqueid']][_0x7ee2('0x35')]=0x0;queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x58')]=0x0;utils['info'](util[_0x7ee2('0x4')](_0x7ee2('0x61'),_0x42998e[_0x7ee2('0x4f')],queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x20')],queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x12')],queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x9')],queues[_0x42998e[_0x7ee2('0x60')]][_0x7ee2('0x57')]));}else{utils[_0x7ee2('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x42998e['origtransfereruniqueid'],queues[_0x42998e[_0x7ee2('0x51')]][_0x7ee2('0x20')],_0x42998e[_0x7ee2('0x50')]));queues[_0x42998e['secondtransfererlinkedid']]['transfereduniqueid']=_0x42998e[_0x7ee2('0x50')];}}}}catch(_0x40161d){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x4e'),_0x42998e[_0x7ee2('0x4f')]),_0x40161d);}};exports[_0x7ee2('0x62')]=function(_0x4be6b3){try{if(!_[_0x7ee2('0x19')](queues[_0x4be6b3[_0x7ee2('0x6')]])){utils['debug'](util['format'](_0x7ee2('0x63'),_0x4be6b3['uniqueid']),_0x4be6b3);queues[_0x4be6b3[_0x7ee2('0x6')]][_0x7ee2('0x64')]=utils['now']();utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x65'),_0x4be6b3[_0x7ee2('0x6')],queues[_0x4be6b3[_0x7ee2('0x6')]][_0x7ee2('0x20')],queues[_0x4be6b3[_0x7ee2('0x6')]][_0x7ee2('0x64')]));}}catch(_0x2dbe09){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x63'),_0x4be6b3[_0x7ee2('0x6')]),_0x2dbe09);}};exports['musiconholdstop']=function(_0x2a1c41){try{if(!_[_0x7ee2('0x19')](queues[_0x2a1c41[_0x7ee2('0x6')]])){if(!_[_0x7ee2('0x19')](queues[_0x2a1c41['uniqueid']][_0x7ee2('0x64')])){utils[_0x7ee2('0x1a')](util[_0x7ee2('0x4')]('[%s][queues][musiconholdstop]',_0x2a1c41[_0x7ee2('0x6')]),_0x2a1c41);queues[_0x2a1c41[_0x7ee2('0x6')]]['mohtime']+=utils[_0x7ee2('0x66')](utils['now'](),queues[_0x2a1c41[_0x7ee2('0x6')]]['musiconholdstartAt']);utils[_0x7ee2('0x3')](util[_0x7ee2('0x4')](_0x7ee2('0x67'),_0x2a1c41['uniqueid'],queues[_0x2a1c41[_0x7ee2('0x6')]][_0x7ee2('0x20')],queues[_0x2a1c41[_0x7ee2('0x6')]][_0x7ee2('0x58')]));delete queues[_0x2a1c41['uniqueid']][_0x7ee2('0x64')];}}}catch(_0x260561){utils[_0x7ee2('0x16')](util[_0x7ee2('0x4')](_0x7ee2('0x68'),_0x2a1c41['uniqueid']),_0x260561);}}; \ No newline at end of file +var _0x79d3=['request','CreateVoiceQueueReport','transfereduniqueid','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','toUpperCase','CONTINUE','queuecallerabandonAt','value','queueposition','queuecallerexitAt','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerleave]','connectedlinenum','connectedlinename','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','transfertype','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','accountcode','queuecallerexitreason','type'];(function(_0x1e9e56,_0x34a74a){var _0x5d5e2e=function(_0x4bfcc2){while(--_0x4bfcc2){_0x1e9e56['push'](_0x1e9e56['shift']());}};_0x5d5e2e(++_0x34a74a);}(_0x79d3,0x179));var _0x379d=function(_0x17c938,_0x557096){_0x17c938=_0x17c938-0x0;var _0x2d22b2=_0x79d3[_0x17c938];return _0x2d22b2;};'use strict';var _=require(_0x379d('0x0'));var util=require(_0x379d('0x1'));var utils=require(_0x379d('0x2'));var queues={};function writeDB(_0x135893){utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x5'),_0x135893[_0x379d('0x6')],_0x135893['channel'],_0x135893[_0x379d('0x7')],_0x135893['lastAssignedTo'],_0x135893['calleridnum'],_0x135893[_0x379d('0x8')],_0x135893[_0x379d('0x9')]));if(_0x135893[_0x379d('0x7')]){utils['getVoiceQueueByName'](_0x135893[_0x379d('0x7')])['then'](function(_0x2cd1af){if(_0x2cd1af){_0x135893[_0x379d('0xa')]=_0x2cd1af['type'];}utils[_0x379d('0xb')](_0x379d('0xc'),_0x135893);});}else{utils[_0x379d('0xb')](_0x379d('0xc'),_0x135893);}if(_0x135893[_0x379d('0xd')]){delete queues[_0x135893['transfereduniqueid']];}else{delete queues[_0x135893[_0x379d('0x6')]];}}exports['queuecallerjoin']=function(_0x5479de){try{utils['debug'](util[_0x379d('0x4')]('[%s][queues][queuecallerjoin]',_0x5479de[_0x379d('0x6')]),_0x5479de);utils[_0x379d('0x3')](util[_0x379d('0x4')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5479de['uniqueid'],_0x5479de[_0x379d('0x7')],_0x5479de[_0x379d('0xe')]));queues[_0x5479de[_0x379d('0x6')]]=_[_0x379d('0xf')](_0x5479de,{'originalposition':_0x5479de[_0x379d('0xe')],'queuecallerjoinAt':utils[_0x379d('0x10')](),'mohtime':0x0});}catch(_0x993fc){utils[_0x379d('0x11')](util['format'](_0x379d('0x12'),_0x5479de['uniqueid']),_0x993fc);}};exports['hangup']=function(_0x243b9d){try{if(!_[_0x379d('0x13')](queues[_0x243b9d[_0x379d('0x6')]])){utils[_0x379d('0x14')](util[_0x379d('0x4')](_0x379d('0x15'),_0x243b9d[_0x379d('0x6')]),_0x243b9d);if(queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0x16')]){if(!queues[_0x243b9d['uniqueid']][_0x379d('0x17')]&&!queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0x18')]){queues[_0x243b9d[_0x379d('0x6')]]['queuecallercomplete']=!![];queues[_0x243b9d['uniqueid']][_0x379d('0x19')]=utils[_0x379d('0x10')]();queues[_0x243b9d[_0x379d('0x6')]]['queuecallerexitreason']=_0x379d('0x1a');}utils[_0x379d('0x3')](util['format'](_0x379d('0x1b'),_0x243b9d['uniqueid'],queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0x1c')],queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0x9')]));writeDB(queues[_0x243b9d[_0x379d('0x6')]]);}else if(queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0xd')]){utils['info'](util[_0x379d('0x4')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x243b9d[_0x379d('0x6')],queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0x1c')],queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0xd')]));queues[queues[_0x243b9d[_0x379d('0x6')]]['transfereduniqueid']]=queues[_0x243b9d[_0x379d('0x6')]];queues[queues[_0x243b9d[_0x379d('0x6')]][_0x379d('0xd')]][_0x379d('0x1d')]=0x2;delete queues[_0x243b9d[_0x379d('0x6')]];}}}catch(_0x40659d){utils[_0x379d('0x11')](util[_0x379d('0x4')](_0x379d('0x15'),_0x243b9d[_0x379d('0x6')]),_0x40659d);}};exports['varset']=function(_0x406092){try{utils['debug'](util[_0x379d('0x4')](_0x379d('0x1e'),_0x406092[_0x379d('0x6')]),_0x406092);if(!_[_0x379d('0x13')](_0x406092[_0x379d('0x1f')]['queuestatus'])&&_0x406092['value'][_0x379d('0x20')]()!==_0x379d('0x21')){if(!_[_0x379d('0x13')](queues[_0x406092['uniqueid']])){queues[_0x406092[_0x379d('0x6')]]['queuecallerabandon']=![];queues[_0x406092[_0x379d('0x6')]][_0x379d('0x22')]=null;queues[_0x406092[_0x379d('0x6')]][_0x379d('0x18')]=!![];queues[_0x406092[_0x379d('0x6')]]['queuecallerexitAt']=utils[_0x379d('0x10')]();queues[_0x406092['uniqueid']][_0x379d('0x9')]=_0x406092[_0x379d('0x23')][_0x379d('0x20')]();utils['info'](util[_0x379d('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x406092[_0x379d('0x6')],queues[_0x406092[_0x379d('0x6')]]['name'],_0x406092[_0x379d('0x23')],queues[_0x406092['uniqueid']][_0x379d('0x9')]));writeDB(queues[_0x406092[_0x379d('0x6')]]);}}else if(!_[_0x379d('0x13')](_0x406092[_0x379d('0x1f')][_0x379d('0x24')])){if(!_[_0x379d('0x13')](queues[_0x406092[_0x379d('0x6')]])&&!queues[_0x406092[_0x379d('0x6')]]['queuecallerabandon']){queues[_0x406092['uniqueid']][_0x379d('0x17')]=![];queues[_0x406092['uniqueid']]['queuecallerabandonAt']=null;queues[_0x406092[_0x379d('0x6')]][_0x379d('0x18')]=!![];queues[_0x406092['uniqueid']][_0x379d('0x25')]=utils[_0x379d('0x10')]();queues[_0x406092[_0x379d('0x6')]][_0x379d('0x9')]='EXITWITHKEY';utils[_0x379d('0x3')](util[_0x379d('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x406092[_0x379d('0x6')],queues[_0x406092[_0x379d('0x6')]][_0x379d('0x1c')],_0x406092[_0x379d('0x23')],queues[_0x406092[_0x379d('0x6')]][_0x379d('0x9')]));}}}catch(_0x4d56fd){utils[_0x379d('0x11')](util[_0x379d('0x4')](_0x379d('0x1e'),_0x406092[_0x379d('0x6')]),_0x4d56fd);}};exports[_0x379d('0x17')]=function(_0x438424){try{if(!_[_0x379d('0x13')](queues[_0x438424['uniqueid']])){utils['debug'](util['format'](_0x379d('0x26'),_0x438424[_0x379d('0x6')]),_0x438424);queues[_0x438424[_0x379d('0x6')]][_0x379d('0x18')]=![];queues[_0x438424['uniqueid']][_0x379d('0x25')]=null;queues[_0x438424[_0x379d('0x6')]]['queuecallerabandon']=!![];queues[_0x438424[_0x379d('0x6')]][_0x379d('0x22')]=utils[_0x379d('0x10')]();queues[_0x438424['uniqueid']][_0x379d('0x9')]=_0x379d('0x27');utils[_0x379d('0x3')](util[_0x379d('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x438424[_0x379d('0x6')],queues[_0x438424[_0x379d('0x6')]][_0x379d('0x1c')],queues[_0x438424[_0x379d('0x6')]][_0x379d('0x9')]));}}catch(_0x48ce08){utils['error'](util[_0x379d('0x4')](_0x379d('0x26'),_0x438424[_0x379d('0x6')]),_0x48ce08);}};exports['queuecallerleave']=function(_0x52f7eb){try{if(!_[_0x379d('0x13')](queues[_0x52f7eb[_0x379d('0x6')]])){utils[_0x379d('0x14')](util[_0x379d('0x4')](_0x379d('0x28'),_0x52f7eb[_0x379d('0x6')]),_0x52f7eb);utils[_0x379d('0x3')](util[_0x379d('0x4')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x52f7eb[_0x379d('0x6')],queues[_0x52f7eb[_0x379d('0x6')]]['name'],_0x52f7eb[_0x379d('0x29')],_0x52f7eb[_0x379d('0x2a')]));queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0x2b')]=!![];queues[_0x52f7eb[_0x379d('0x6')]]['queuecallerleaveAt']=utils[_0x379d('0x10')]();queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0x2c')]=utils[_0x379d('0x2d')](queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0x16')],queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0x2e')]);queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0xe')]=_0x52f7eb[_0x379d('0xe')];queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0x2f')]=_0x52f7eb[_0x379d('0x2f')];queues[_0x52f7eb[_0x379d('0x6')]]['connectedlinenum']=_0x52f7eb[_0x379d('0x29')];queues[_0x52f7eb[_0x379d('0x6')]][_0x379d('0x2a')]=_0x52f7eb['connectedlinename'];}}catch(_0x2232a0){utils[_0x379d('0x11')](util['format']('[%s][queues][queuecallerleave]',_0x52f7eb[_0x379d('0x6')]),_0x2232a0);}};exports[_0x379d('0x30')]=function(_0x3ad0b8){try{if(!_[_0x379d('0x13')](queues[_0x3ad0b8[_0x379d('0x6')]])){utils[_0x379d('0x14')](util[_0x379d('0x4')](_0x379d('0x31'),_0x3ad0b8['uniqueid']),_0x3ad0b8);utils['info'](util[_0x379d('0x4')](_0x379d('0x32'),_0x3ad0b8[_0x379d('0x6')],queues[_0x3ad0b8[_0x379d('0x6')]][_0x379d('0x1c')],_0x3ad0b8[_0x379d('0x33')],_0x3ad0b8[_0x379d('0x34')]));queues[_0x3ad0b8[_0x379d('0x6')]]['queuecallerabandon']=![];queues[_0x3ad0b8['uniqueid']][_0x379d('0x17')]=![];queues[_0x3ad0b8[_0x379d('0x6')]][_0x379d('0x22')]=null;queues[_0x3ad0b8['uniqueid']][_0x379d('0x18')]=![];queues[_0x3ad0b8['uniqueid']][_0x379d('0x9')]=null;queues[_0x3ad0b8['uniqueid']][_0x379d('0x25')]=null;queues[_0x3ad0b8[_0x379d('0x6')]][_0x379d('0x35')]=!![];queues[_0x3ad0b8[_0x379d('0x6')]]['accountcode']=_0x3ad0b8[_0x379d('0x34')];queues[_0x3ad0b8[_0x379d('0x6')]][_0x379d('0x36')]=_0x3ad0b8[_0x379d('0x33')];}}catch(_0x3a48d0){utils[_0x379d('0x11')](util[_0x379d('0x4')](_0x379d('0x31'),_0x3ad0b8[_0x379d('0x6')]),_0x3a48d0);}};exports[_0x379d('0x37')]=function(_0x824010){try{if(!_['isNil'](queues[_0x824010[_0x379d('0x6')]])){if(queues[_0x824010[_0x379d('0x6')]][_0x379d('0x16')]){utils[_0x379d('0x14')](util[_0x379d('0x4')](_0x379d('0x38'),_0x824010['uniqueid']),_0x824010);queues[_0x824010[_0x379d('0x6')]][_0x379d('0x17')]=![];queues[_0x824010[_0x379d('0x6')]][_0x379d('0x17')]=![];queues[_0x824010['uniqueid']][_0x379d('0x22')]=null;queues[_0x824010[_0x379d('0x6')]]['queuecallerexit']=![];queues[_0x824010['uniqueid']][_0x379d('0x25')]=null;queues[_0x824010[_0x379d('0x6')]]['assigned']=!![];queues[_0x824010[_0x379d('0x6')]][_0x379d('0x36')]=_0x824010[_0x379d('0x33')];queues[_0x824010[_0x379d('0x6')]][_0x379d('0x39')]=!![];queues[_0x824010['uniqueid']][_0x379d('0x19')]=utils[_0x379d('0x10')]();if(_0x824010[_0x379d('0x3a')]==_0x379d('0x3b')){if(!queues[_0x824010[_0x379d('0x6')]][_0x379d('0x3b')]){queues[_0x824010['uniqueid']][_0x379d('0x9')]=_0x379d('0x3c');}}else{queues[_0x824010[_0x379d('0x6')]][_0x379d('0x9')]='COMPLETEDBY'+_0x824010[_0x379d('0x3a')][_0x379d('0x20')]();}utils[_0x379d('0x3')](util[_0x379d('0x4')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x824010['uniqueid'],queues[_0x824010[_0x379d('0x6')]][_0x379d('0x1c')],_0x824010[_0x379d('0x33')],queues[_0x824010['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x824010['uniqueid']]);}}}catch(_0x1b6f72){utils[_0x379d('0x11')](util[_0x379d('0x4')]('[%s][queues][agentcomplete]',_0x824010[_0x379d('0x6')]),_0x1b6f72);}};exports[_0x379d('0x3d')]=function(_0x371370){try{if(!_['isNil'](queues[_0x371370[_0x379d('0x3e')]])){utils['debug'](util[_0x379d('0x4')](_0x379d('0x3f'),_0x371370[_0x379d('0x6')]),_0x371370);queues[_0x371370[_0x379d('0x3e')]][_0x379d('0x3b')]=!![];queues[_0x371370[_0x379d('0x3e')]]['transfertype']='BLIND';queues[_0x371370[_0x379d('0x3e')]]['transferexten']=_0x371370[_0x379d('0x40')];queues[_0x371370[_0x379d('0x3e')]][_0x379d('0x41')]=_0x371370[_0x379d('0x3e')];queues[_0x371370[_0x379d('0x3e')]][_0x379d('0x9')]=_0x379d('0x42');utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x43'),_0x371370[_0x379d('0x6')],queues[_0x371370[_0x379d('0x3e')]]['name'],_0x371370[_0x379d('0x3e')],_0x371370[_0x379d('0x40')]));}}catch(_0x569bbc){utils[_0x379d('0x11')](util['format'](_0x379d('0x3f'),_0x371370['uniqueid']),_0x569bbc);}};exports['attendedtransfer']=function(_0x477a4f){try{utils[_0x379d('0x14')](util[_0x379d('0x4')](_0x379d('0x44'),_0x477a4f[_0x379d('0x45')]),_0x477a4f);if(_0x477a4f[_0x379d('0x45')]==_0x477a4f['origtransfererlinkedid']){if(!_[_0x379d('0x13')](queues[_0x477a4f[_0x379d('0x46')]])){utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x47'),_0x477a4f[_0x379d('0x45')],queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x1c')],_0x477a4f['origtransfererexten']));queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x3b')]=!![];queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x48')]=_0x379d('0x49');queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x4a')]=_0x477a4f[_0x379d('0x4b')];queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x41')]=_0x477a4f[_0x379d('0x45')];queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x9')]=_0x379d('0x4c');}if(!_[_0x379d('0x13')](queues[_0x477a4f[_0x379d('0x4d')]])){if(_0x477a4f['transfereelinkedid']&&queues[_0x477a4f[_0x379d('0x4e')]]){queues[_0x477a4f[_0x379d('0x4e')]][_0x379d('0x1d')]=0x1;queues[_0x477a4f[_0x379d('0x3e')]]=_['clone'](queues[_0x477a4f[_0x379d('0x4e')]]);queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0xd')]=_0x477a4f[_0x379d('0x4f')];queues[_0x477a4f[_0x379d('0x3e')]]['queuecallerenterreason']=0x2;queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x50')]=queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x50')];queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x51')]=queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x51')];queues[_0x477a4f[_0x379d('0x3e')]]['queuecallerjoinAt']=utils[_0x379d('0x10')]();queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x16')]=utils[_0x379d('0x10')]();queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x2c')]=0x0;queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x52')]=0x0;utils[_0x379d('0x3')](util['format'](_0x379d('0x53'),_0x477a4f[_0x379d('0x45')],queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x1c')],queues[_0x477a4f[_0x379d('0x3e')]][_0x379d('0x50')],queues[_0x477a4f['transfereeuniqueid']][_0x379d('0x51')]));}else{utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x54'),_0x477a4f[_0x379d('0x45')],queues[_0x477a4f[_0x379d('0x4d')]]['name'],_0x477a4f['secondtransfererlinkedid']));queues[_0x477a4f[_0x379d('0x4d')]]['transfereduniqueid']=_0x477a4f[_0x379d('0x46')];}}}else if(_0x477a4f[_0x379d('0x55')]==_0x477a4f[_0x379d('0x46')]){if(!_[_0x379d('0x13')](queues[_0x477a4f['origtransfererlinkedid']])){utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x56'),_0x477a4f['origtransfereruniqueid'],queues[_0x477a4f['origtransfererlinkedid']][_0x379d('0x1c')],_0x477a4f[_0x379d('0x55')],_0x477a4f[_0x379d('0x57')]));queues[_0x477a4f[_0x379d('0x4d')]][_0x379d('0x3b')]=!![];queues[_0x477a4f[_0x379d('0x4d')]][_0x379d('0x48')]=_0x379d('0x49');queues[_0x477a4f['origtransfererlinkedid']][_0x379d('0x4a')]=_0x477a4f[_0x379d('0x57')];queues[_0x477a4f[_0x379d('0x4d')]][_0x379d('0x41')]=_0x477a4f[_0x379d('0x55')];queues[_0x477a4f[_0x379d('0x4d')]][_0x379d('0x9')]='ATTENDEDTRANSFER';}if(!_[_0x379d('0x13')](queues[_0x477a4f['secondtransfererlinkedid']])){if(_0x477a4f['transfertargetlinkedid']&&queues[_0x477a4f['transfertargetlinkedid']]){queues[_0x477a4f[_0x379d('0x58')]][_0x379d('0x1d')]=0x1;queues[_0x477a4f[_0x379d('0x4f')]]=_[_0x379d('0x59')](queues[_0x477a4f[_0x379d('0x58')]]);queues[_0x477a4f['transfertargetuniqueid']][_0x379d('0xd')]=_0x477a4f[_0x379d('0x4f')];queues[_0x477a4f[_0x379d('0x4f')]][_0x379d('0x1d')]=0x2;queues[_0x477a4f['transfertargetuniqueid']]['calleridnum']=queues[_0x477a4f[_0x379d('0x4d')]][_0x379d('0x50')];queues[_0x477a4f['transfertargetuniqueid']]['calleridname']=queues[_0x477a4f['origtransfererlinkedid']][_0x379d('0x51')];queues[_0x477a4f[_0x379d('0x4f')]]['queuecallerjoinAt']=utils[_0x379d('0x10')]();queues[_0x477a4f[_0x379d('0x4f')]][_0x379d('0x16')]=utils[_0x379d('0x10')]();queues[_0x477a4f[_0x379d('0x4f')]]['holdtime']=0x0;queues[_0x477a4f[_0x379d('0x4f')]][_0x379d('0x52')]=0x0;utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x5a'),_0x477a4f[_0x379d('0x45')],queues[_0x477a4f[_0x379d('0x4f')]][_0x379d('0x1c')],queues[_0x477a4f['transfertargetuniqueid']][_0x379d('0xd')],queues[_0x477a4f[_0x379d('0x4f')]]['calleridnum'],queues[_0x477a4f['transfertargetuniqueid']][_0x379d('0x51')]));}else{utils[_0x379d('0x3')](util[_0x379d('0x4')](_0x379d('0x54'),_0x477a4f[_0x379d('0x45')],queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0x1c')],_0x477a4f[_0x379d('0x4d')]));queues[_0x477a4f[_0x379d('0x46')]][_0x379d('0xd')]=_0x477a4f[_0x379d('0x4d')];}}}}catch(_0x22e478){utils['error'](util[_0x379d('0x4')](_0x379d('0x44'),_0x477a4f[_0x379d('0x45')]),_0x22e478);}};exports[_0x379d('0x5b')]=function(_0x33d161){try{if(!_['isNil'](queues[_0x33d161[_0x379d('0x6')]])){utils[_0x379d('0x14')](util[_0x379d('0x4')]('[%s][queues][musiconholdstart]',_0x33d161[_0x379d('0x6')]),_0x33d161);queues[_0x33d161[_0x379d('0x6')]][_0x379d('0x5c')]=utils['now']();utils[_0x379d('0x3')](util[_0x379d('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x33d161[_0x379d('0x6')],queues[_0x33d161[_0x379d('0x6')]][_0x379d('0x1c')],queues[_0x33d161[_0x379d('0x6')]][_0x379d('0x5c')]));}}catch(_0x5af1d0){utils[_0x379d('0x11')](util[_0x379d('0x4')](_0x379d('0x5d'),_0x33d161[_0x379d('0x6')]),_0x5af1d0);}};exports[_0x379d('0x5e')]=function(_0x599bc1){try{if(!_['isNil'](queues[_0x599bc1[_0x379d('0x6')]])){if(!_[_0x379d('0x13')](queues[_0x599bc1[_0x379d('0x6')]][_0x379d('0x5c')])){utils[_0x379d('0x14')](util[_0x379d('0x4')](_0x379d('0x5f'),_0x599bc1[_0x379d('0x6')]),_0x599bc1);queues[_0x599bc1[_0x379d('0x6')]][_0x379d('0x52')]+=utils[_0x379d('0x2d')](utils[_0x379d('0x10')](),queues[_0x599bc1[_0x379d('0x6')]][_0x379d('0x5c')]);utils[_0x379d('0x3')](util['format'](_0x379d('0x60'),_0x599bc1[_0x379d('0x6')],queues[_0x599bc1['uniqueid']][_0x379d('0x1c')],queues[_0x599bc1['uniqueid']]['mohtime']));delete queues[_0x599bc1[_0x379d('0x6')]]['musiconholdstartAt'];}}}catch(_0x467f73){utils[_0x379d('0x11')](util['format'](_0x379d('0x5f'),_0x599bc1[_0x379d('0x6')]),_0x467f73);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 9d90a79..12a30a7 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 _0xb016=['connectedlinenum','connectedlinename','type','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','context','exten','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','value','.wav49','replace','.WAV','find','monitors','push','[%s][recordings][varset]','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xb016,0x1c5));var _0x6b01=function(_0x5eb7d7,_0xdefdbe){_0x5eb7d7=_0x5eb7d7-0x0;var _0x4821a6=_0xb016[_0x5eb7d7];return _0x4821a6;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6b01('0x0'));var transfers=require(_0x6b01('0x1'));var recordings={};function writeDB(_0x18a319){var _0x1f95d5;utils[_0x6b01('0x2')](util[_0x6b01('0x3')](_0x6b01('0x4'),_0x18a319[_0x6b01('0x5')]));if(transfers[_0x6b01('0x6')][_0x18a319['uniqueid']]){_0x1f95d5=_0x18a319[_0x6b01('0x5')];_0x18a319[_0x6b01('0x5')]=transfers[_0x6b01('0x6')][_0x18a319[_0x6b01('0x5')]][_0x6b01('0x7')];}if(_0x18a319['accountcode']){utils[_0x6b01('0x8')](_0x18a319[_0x6b01('0x9')])[_0x6b01('0xa')](function(_0x16cee4){if(_0x16cee4){_0x18a319[_0x6b01('0xb')]=_0x16cee4[_0x6b01('0xc')];_0x18a319[_0x6b01('0xd')]=_0x16cee4['id'];}utils[_0x6b01('0xe')](_0x6b01('0xf'),_0x18a319);});}else{utils[_0x6b01('0xe')]('CreateVoiceRecording',_0x18a319);}if(_0x1f95d5)delete transfers[_0x6b01('0x6')][_0x1f95d5];}exports[_0x6b01('0x10')]=function(_0x169034){try{utils[_0x6b01('0x11')](util[_0x6b01('0x3')](_0x6b01('0x12'),_0x169034[_0x6b01('0x5')]),_0x169034);if(_0x169034[_0x6b01('0x5')]==_0x169034['linkedid']){utils['info'](util[_0x6b01('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x169034[_0x6b01('0x5')],_0x169034[_0x6b01('0x13')],_0x169034[_0x6b01('0x14')]));recordings[_0x169034['uniqueid']]={'uniqueid':_0x169034[_0x6b01('0x5')],'accountcode':_0x169034[_0x6b01('0x9')],'exten':_0x169034[_0x6b01('0x14')],'context':_0x169034[_0x6b01('0x13')],'channel':_0x169034['channel'],'monitors':[]};}}catch(_0x258c2a){utils[_0x6b01('0x15')](util['format'](_0x6b01('0x12'),_0x169034[_0x6b01('0x5')]),_0x258c2a);}};exports['newstate']=function(_0x188c21){try{utils[_0x6b01('0x11')](util['format'](_0x6b01('0x16'),_0x188c21[_0x6b01('0x5')]),_0x188c21);if(!_[_0x6b01('0x17')](recordings[_0x188c21[_0x6b01('0x5')]])&&_0x188c21[_0x6b01('0x18')]==0x6){utils[_0x6b01('0x2')](util[_0x6b01('0x3')](_0x6b01('0x19'),_0x188c21['uniqueid'],_0x188c21[_0x6b01('0x13')],_0x188c21[_0x6b01('0x1a')]));}else if(!_[_0x6b01('0x17')](recordings[_0x188c21[_0x6b01('0x1b')]])&&_0x188c21[_0x6b01('0x18')]==0x6&&_0x188c21[_0x6b01('0x13')]!='transfer'){utils[_0x6b01('0x2')](util[_0x6b01('0x3')](_0x6b01('0x1c'),_0x188c21[_0x6b01('0x5')],_0x188c21[_0x6b01('0x1b')],_0x188c21[_0x6b01('0x13')],_0x188c21['channel']));recordings[_0x188c21[_0x6b01('0x1b')]][_0x6b01('0x9')]=_0x188c21[_0x6b01('0x9')];}}catch(_0x2ddb79){utils[_0x6b01('0x15')](util['format'](_0x6b01('0x16'),_0x188c21[_0x6b01('0x5')]),_0x2ddb79);}};exports[_0x6b01('0x1d')]=function(_0x2c8bbe){try{if(!_[_0x6b01('0x17')](_0x2c8bbe[_0x6b01('0x1e')])&&!_['isNil'](_0x2c8bbe['variable'][_0x6b01('0x1f')])){utils['debug'](util['format']('[%s][recordings][varset]',_0x2c8bbe[_0x6b01('0x5')]),_0x2c8bbe);utils[_0x6b01('0x2')](util[_0x6b01('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2c8bbe[_0x6b01('0x5')],_0x2c8bbe[_0x6b01('0x1e')],_0x2c8bbe[_0x6b01('0x20')]));if(_['endsWith'](_0x2c8bbe[_0x6b01('0x20')],_0x6b01('0x21'))){_0x2c8bbe[_0x6b01('0x20')]=_0x2c8bbe[_0x6b01('0x20')][_0x6b01('0x22')](_0x6b01('0x21'),_0x6b01('0x23'));}if(recordings[_0x2c8bbe[_0x6b01('0x1b')]]){var _0x4d08d0=_[_0x6b01('0x24')](recordings[_0x2c8bbe[_0x6b01('0x1b')]][_0x6b01('0x25')],{'value':_0x2c8bbe[_0x6b01('0x20')]});if(_[_0x6b01('0x17')](_0x4d08d0)){recordings[_0x2c8bbe[_0x6b01('0x1b')]][_0x6b01('0x25')][_0x6b01('0x26')]({'value':_0x2c8bbe[_0x6b01('0x20')]});}}}}catch(_0x13ca57){utils[_0x6b01('0x15')](util[_0x6b01('0x3')](_0x6b01('0x27'),_0x2c8bbe[_0x6b01('0x5')]),_0x13ca57);}};exports['hangup']=function(_0x4ce56c){try{if(!_['isNil'](recordings[_0x4ce56c[_0x6b01('0x5')]])){utils[_0x6b01('0x11')](util[_0x6b01('0x3')](_0x6b01('0x28'),_0x4ce56c[_0x6b01('0x5')]),_0x4ce56c);utils[_0x6b01('0x2')](util[_0x6b01('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4ce56c['uniqueid'],_0x4ce56c[_0x6b01('0x29')],_0x4ce56c[_0x6b01('0x2a')],_0x4ce56c[_0x6b01('0x2b')]));recordings[_0x4ce56c['uniqueid']][_0x6b01('0x29')]=_0x4ce56c[_0x6b01('0x29')];recordings[_0x4ce56c[_0x6b01('0x5')]][_0x6b01('0x2a')]=_0x4ce56c[_0x6b01('0x2a')];recordings[_0x4ce56c[_0x6b01('0x5')]][_0x6b01('0x2c')]=_0x4ce56c[_0x6b01('0x2c')];recordings[_0x4ce56c[_0x6b01('0x5')]]['connectedlinename']=_0x4ce56c[_0x6b01('0x2d')];if(recordings[_0x4ce56c[_0x6b01('0x5')]][_0x6b01('0x2e')]=='outbound'&&recordings[_0x4ce56c['uniqueid']][_0x6b01('0x9')]){recordings[_0x4ce56c['uniqueid']][_0x6b01('0x2c')]=recordings[_0x4ce56c[_0x6b01('0x5')]][_0x6b01('0x9')];recordings[_0x4ce56c[_0x6b01('0x5')]][_0x6b01('0x2d')]='';}recordings[_0x4ce56c[_0x6b01('0x5')]][_0x6b01('0x25')][_0x6b01('0x2f')](function(_0x3f535e){var _0x15ae65=_[_0x6b01('0x30')](recordings[_0x4ce56c['uniqueid']]);_0x15ae65[_0x6b01('0x20')]=_0x3f535e[_0x6b01('0x20')];writeDB(_0x15ae65);});delete recordings[_0x4ce56c['uniqueid']];}}catch(_0x7b5644){utils[_0x6b01('0x15')](util[_0x6b01('0x3')](_0x6b01('0x28'),_0x4ce56c[_0x6b01('0x5')]),_0x7b5644);}};exports[_0x6b01('0x31')]=function(_0x1c4336){try{if(!_[_0x6b01('0x17')](recordings[_0x1c4336[_0x6b01('0x5')]])){utils[_0x6b01('0x11')](util[_0x6b01('0x3')]('[%s][recordings][newexten]',_0x1c4336[_0x6b01('0x5')]),_0x1c4336);utils[_0x6b01('0x2')](util[_0x6b01('0x3')](_0x6b01('0x32'),_0x1c4336[_0x6b01('0x5')],_0x1c4336['application'],_0x1c4336['appdata']));if(_0x1c4336[_0x6b01('0x33')][_0x6b01('0x34')]()==_0x6b01('0x35')&&_[_0x6b01('0x36')](_0x1c4336[_0x6b01('0x37')][_0x6b01('0x34')](),_0x6b01('0x38'))){var _0x1af280=_0x1c4336[_0x6b01('0x37')][_0x6b01('0x39')]('=');var _0x30f710=_0x1af280[0x0]['substring'](_0x1af280[0x0][_0x6b01('0x3a')]('(')+0x1,_0x1af280[0x0][_0x6b01('0x3a')](')'));var _0x29bae4=_0x1af280[0x1];recordings[_0x1c4336[_0x6b01('0x5')]][_0x30f710]=_0x29bae4;}}}catch(_0x5c3d52){utils['error'](util[_0x6b01('0x3')](_0x6b01('0x3b'),_0x1c4336[_0x6b01('0x5')]),_0x5c3d52);}};exports[_0x6b01('0x3c')]=function(_0x41b211){try{if(!_[_0x6b01('0x17')](recordings[_0x41b211[_0x6b01('0x5')]])){utils[_0x6b01('0x11')](util['format'](_0x6b01('0x3d'),_0x41b211[_0x6b01('0x5')]),_0x41b211);utils['info'](util[_0x6b01('0x3')](_0x6b01('0x3e'),_0x41b211[_0x6b01('0x5')],_0x41b211[_0x6b01('0x3f')]));recordings[_0x41b211[_0x6b01('0x5')]][_0x6b01('0x3f')]=_0x41b211['queue'];}}catch(_0x43878f){utils['error'](util[_0x6b01('0x3')](_0x6b01('0x3d'),_0x41b211[_0x6b01('0x5')]),_0x43878f);}};exports['blindtransfer']=function(_0x3b07ce){try{utils[_0x6b01('0x11')](util['format'](_0x6b01('0x40'),_0x3b07ce[_0x6b01('0x5')]),_0x3b07ce);utils[_0x6b01('0x2')](util[_0x6b01('0x3')](_0x6b01('0x41'),_0x3b07ce[_0x6b01('0x5')],_0x3b07ce[_0x6b01('0x42')],_0x3b07ce[_0x6b01('0x43')],_0x3b07ce[_0x6b01('0x44')],_0x3b07ce[_0x6b01('0x45')]));if(recordings[_0x3b07ce[_0x6b01('0x46')]]&&transfers[_0x6b01('0x6')][_0x3b07ce[_0x6b01('0x46')]]){transfers[_0x6b01('0x6')][_0x3b07ce[_0x6b01('0x46')]]['recording']=!![];}}catch(_0x39f986){utils[_0x6b01('0x15')](util[_0x6b01('0x3')](_0x6b01('0x40'),_0x3b07ce[_0x6b01('0x5')]),_0x39f986);}}; \ No newline at end of file +var _0xcb0a=['[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','debug','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','split','lastIndexOf','[%s][recordings][newexten]','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','blindtransfer','[%s][recordings][blindtransfer]','[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereruniqueid','recording','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','channel','error'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0xcb0a,0x1da));var _0xacb0=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xcb0a[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0xacb0('0x0'));var util=require(_0xacb0('0x1'));var utils=require(_0xacb0('0x2'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x18a285){var _0x5a7604;utils[_0xacb0('0x3')](util[_0xacb0('0x4')](_0xacb0('0x5'),_0x18a285[_0xacb0('0x6')]));if(transfers['blinds'][_0x18a285[_0xacb0('0x6')]]){_0x5a7604=_0x18a285['uniqueid'];_0x18a285[_0xacb0('0x6')]=transfers[_0xacb0('0x7')][_0x18a285['uniqueid']][_0xacb0('0x8')];}if(_0x18a285[_0xacb0('0x9')]){utils[_0xacb0('0xa')](_0x18a285['accountcode'])[_0xacb0('0xb')](function(_0x1b8ea0){if(_0x1b8ea0){_0x18a285[_0xacb0('0xc')]=_0x1b8ea0['name'];_0x18a285[_0xacb0('0xd')]=_0x1b8ea0['id'];}utils[_0xacb0('0xe')](_0xacb0('0xf'),_0x18a285);});}else{utils[_0xacb0('0xe')](_0xacb0('0xf'),_0x18a285);}if(_0x5a7604)delete transfers[_0xacb0('0x7')][_0x5a7604];}exports[_0xacb0('0x10')]=function(_0x5ca996){try{utils['debug'](util['format'](_0xacb0('0x11'),_0x5ca996[_0xacb0('0x6')]),_0x5ca996);if(_0x5ca996[_0xacb0('0x6')]==_0x5ca996[_0xacb0('0x12')]){utils[_0xacb0('0x3')](util[_0xacb0('0x4')](_0xacb0('0x13'),_0x5ca996[_0xacb0('0x6')],_0x5ca996[_0xacb0('0x14')],_0x5ca996['exten']));recordings[_0x5ca996[_0xacb0('0x6')]]={'uniqueid':_0x5ca996[_0xacb0('0x6')],'accountcode':_0x5ca996[_0xacb0('0x9')],'exten':_0x5ca996['exten'],'context':_0x5ca996[_0xacb0('0x14')],'channel':_0x5ca996[_0xacb0('0x15')],'monitors':[]};}}catch(_0x3ea4f6){utils[_0xacb0('0x16')](util[_0xacb0('0x4')](_0xacb0('0x11'),_0x5ca996[_0xacb0('0x6')]),_0x3ea4f6);}};exports['newstate']=function(_0x3921bc){try{utils['debug'](util[_0xacb0('0x4')](_0xacb0('0x17'),_0x3921bc[_0xacb0('0x6')]),_0x3921bc);if(!_[_0xacb0('0x18')](recordings[_0x3921bc['uniqueid']])&&_0x3921bc['channelstate']==0x6){utils['info'](util[_0xacb0('0x4')](_0xacb0('0x19'),_0x3921bc[_0xacb0('0x6')],_0x3921bc[_0xacb0('0x14')],_0x3921bc[_0xacb0('0x15')]));}else if(!_[_0xacb0('0x18')](recordings[_0x3921bc[_0xacb0('0x12')]])&&_0x3921bc[_0xacb0('0x1a')]==0x6&&_0x3921bc[_0xacb0('0x14')]!='transfer'){utils[_0xacb0('0x3')](util[_0xacb0('0x4')](_0xacb0('0x1b'),_0x3921bc[_0xacb0('0x6')],_0x3921bc[_0xacb0('0x12')],_0x3921bc['context'],_0x3921bc[_0xacb0('0x15')]));recordings[_0x3921bc[_0xacb0('0x12')]][_0xacb0('0x9')]=_0x3921bc[_0xacb0('0x9')];}}catch(_0x430e98){utils[_0xacb0('0x16')](util[_0xacb0('0x4')]('[%s][recordings][newstate]',_0x3921bc['uniqueid']),_0x430e98);}};exports[_0xacb0('0x1c')]=function(_0x2f44c3){try{if(!_[_0xacb0('0x18')](_0x2f44c3[_0xacb0('0x1d')])&&!_[_0xacb0('0x18')](_0x2f44c3[_0xacb0('0x1d')][_0xacb0('0x1e')])){utils['debug'](util[_0xacb0('0x4')](_0xacb0('0x1f'),_0x2f44c3[_0xacb0('0x6')]),_0x2f44c3);utils['info'](util[_0xacb0('0x4')](_0xacb0('0x20'),_0x2f44c3[_0xacb0('0x6')],_0x2f44c3[_0xacb0('0x1d')],_0x2f44c3[_0xacb0('0x21')]));if(_[_0xacb0('0x22')](_0x2f44c3[_0xacb0('0x21')],_0xacb0('0x23'))){_0x2f44c3['value']=_0x2f44c3[_0xacb0('0x21')][_0xacb0('0x24')](_0xacb0('0x23'),'.WAV');}if(recordings[_0x2f44c3[_0xacb0('0x12')]]){var _0x48d4cf=_[_0xacb0('0x25')](recordings[_0x2f44c3[_0xacb0('0x12')]][_0xacb0('0x26')],{'value':_0x2f44c3[_0xacb0('0x21')]});if(_['isNil'](_0x48d4cf)){recordings[_0x2f44c3[_0xacb0('0x12')]][_0xacb0('0x26')][_0xacb0('0x27')]({'value':_0x2f44c3[_0xacb0('0x21')]});}}}}catch(_0x2fdc25){utils[_0xacb0('0x16')](util[_0xacb0('0x4')](_0xacb0('0x1f'),_0x2f44c3[_0xacb0('0x6')]),_0x2fdc25);}};exports[_0xacb0('0x28')]=function(_0x5a9844){try{if(!_[_0xacb0('0x18')](recordings[_0x5a9844['uniqueid']])){utils[_0xacb0('0x29')](util[_0xacb0('0x4')](_0xacb0('0x2a'),_0x5a9844[_0xacb0('0x6')]),_0x5a9844);utils[_0xacb0('0x3')](util[_0xacb0('0x4')](_0xacb0('0x2b'),_0x5a9844[_0xacb0('0x6')],_0x5a9844[_0xacb0('0x2c')],_0x5a9844[_0xacb0('0x2d')],_0x5a9844[_0xacb0('0x2e')]));recordings[_0x5a9844['uniqueid']][_0xacb0('0x2c')]=_0x5a9844[_0xacb0('0x2c')];recordings[_0x5a9844[_0xacb0('0x6')]][_0xacb0('0x2d')]=_0x5a9844['calleridname'];recordings[_0x5a9844['uniqueid']]['connectedlinenum']=_0x5a9844[_0xacb0('0x2f')];recordings[_0x5a9844['uniqueid']]['connectedlinename']=_0x5a9844[_0xacb0('0x30')];if(recordings[_0x5a9844[_0xacb0('0x6')]][_0xacb0('0x31')]==_0xacb0('0x32')&&recordings[_0x5a9844[_0xacb0('0x6')]][_0xacb0('0x9')]){recordings[_0x5a9844[_0xacb0('0x6')]][_0xacb0('0x2f')]=recordings[_0x5a9844['uniqueid']][_0xacb0('0x9')];recordings[_0x5a9844['uniqueid']][_0xacb0('0x30')]='';}recordings[_0x5a9844['uniqueid']]['monitors'][_0xacb0('0x33')](function(_0xe6feb5){var _0x1ad5d3=_[_0xacb0('0x34')](recordings[_0x5a9844[_0xacb0('0x6')]]);_0x1ad5d3[_0xacb0('0x21')]=_0xe6feb5[_0xacb0('0x21')];writeDB(_0x1ad5d3);});delete recordings[_0x5a9844['uniqueid']];}}catch(_0x157034){utils[_0xacb0('0x16')](util[_0xacb0('0x4')](_0xacb0('0x2a'),_0x5a9844[_0xacb0('0x6')]),_0x157034);}};exports[_0xacb0('0x35')]=function(_0x3a6214){try{if(!_['isNil'](recordings[_0x3a6214[_0xacb0('0x6')]])){utils[_0xacb0('0x29')](util[_0xacb0('0x4')]('[%s][recordings][newexten]',_0x3a6214[_0xacb0('0x6')]),_0x3a6214);utils[_0xacb0('0x3')](util[_0xacb0('0x4')](_0xacb0('0x36'),_0x3a6214[_0xacb0('0x6')],_0x3a6214['application'],_0x3a6214[_0xacb0('0x37')]));if(_0x3a6214[_0xacb0('0x38')][_0xacb0('0x39')]()==_0xacb0('0x3a')&&_['startsWith'](_0x3a6214[_0xacb0('0x37')]['toLowerCase'](),'cdr')){var _0x48fec1=_0x3a6214['appdata'][_0xacb0('0x3b')]('=');var _0x4da42c=_0x48fec1[0x0]['substring'](_0x48fec1[0x0][_0xacb0('0x3c')]('(')+0x1,_0x48fec1[0x0]['lastIndexOf'](')'));var _0x28515d=_0x48fec1[0x1];recordings[_0x3a6214['uniqueid']][_0x4da42c]=_0x28515d;}}}catch(_0xd307b){utils[_0xacb0('0x16')](util[_0xacb0('0x4')](_0xacb0('0x3d'),_0x3a6214[_0xacb0('0x6')]),_0xd307b);}};exports['queuecallerjoin']=function(_0x16c9f7){try{if(!_[_0xacb0('0x18')](recordings[_0x16c9f7[_0xacb0('0x6')]])){utils[_0xacb0('0x29')](util[_0xacb0('0x4')](_0xacb0('0x3e'),_0x16c9f7['uniqueid']),_0x16c9f7);utils['info'](util[_0xacb0('0x4')](_0xacb0('0x3f'),_0x16c9f7[_0xacb0('0x6')],_0x16c9f7[_0xacb0('0x40')]));recordings[_0x16c9f7[_0xacb0('0x6')]]['queue']=_0x16c9f7[_0xacb0('0x40')];}}catch(_0x2eb42c){utils['error'](util['format']('[%s][recordings][queuecallerjoin]',_0x16c9f7['uniqueid']),_0x2eb42c);}};exports[_0xacb0('0x41')]=function(_0x495f17){try{utils[_0xacb0('0x29')](util[_0xacb0('0x4')](_0xacb0('0x42'),_0x495f17[_0xacb0('0x6')]),_0x495f17);utils[_0xacb0('0x3')](util['format'](_0xacb0('0x43'),_0x495f17['uniqueid'],_0x495f17['transferercalleridnum'],_0x495f17[_0xacb0('0x44')],_0x495f17['transfereecalleridnum'],_0x495f17['transfereecalleridname']));if(recordings[_0x495f17[_0xacb0('0x45')]]&&transfers[_0xacb0('0x7')][_0x495f17[_0xacb0('0x45')]]){transfers[_0xacb0('0x7')][_0x495f17['transfereruniqueid']][_0xacb0('0x46')]=!![];}}catch(_0x47bf50){utils[_0xacb0('0x16')](util[_0xacb0('0x4')](_0xacb0('0x42'),_0x495f17['uniqueid']),_0x47bf50);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 5a90367..e7fc439 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 _0x9104=['util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','attended','origtransfereruniqueid','type','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','[%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','origtransferercalleridname','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','origtransfererlinkedid','origtransfererexten','transfereechannel','assign','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash'];(function(_0x20bf3f,_0x6729a7){var _0x10c51f=function(_0x1886d2){while(--_0x1886d2){_0x20bf3f['push'](_0x20bf3f['shift']());}};_0x10c51f(++_0x6729a7);}(_0x9104,0xf5));var _0x4910=function(_0x496ab6,_0x430b41){_0x496ab6=_0x496ab6-0x0;var _0xbec9f6=_0x9104[_0x496ab6];return _0xbec9f6;};'use strict';var _=require(_0x4910('0x0'));var util=require(_0x4910('0x1'));var utils=require(_0x4910('0x2'));function writeDB(_0x5eefea){utils[_0x4910('0x3')](util[_0x4910('0x4')](_0x4910('0x5'),_0x5eefea['type']===_0x4910('0x6')?_0x5eefea[_0x4910('0x7')]:_0x5eefea['uniqueid'],_0x5eefea[_0x4910('0x8')]));utils['request'](_0x4910('0x9'),_0x5eefea);}exports['blinds']={};exports[_0x4910('0xa')]=function(_0xcd570a){try{utils[_0x4910('0xb')](util[_0x4910('0x4')](_0x4910('0xc'),_0xcd570a[_0x4910('0xd')]),_0xcd570a);utils['info'](util[_0x4910('0x4')](_0x4910('0xe'),_0xcd570a[_0x4910('0xd')],_0xcd570a[_0x4910('0xf')],_0xcd570a[_0x4910('0x10')],_0xcd570a[_0x4910('0x11')],_0xcd570a[_0x4910('0x12')]));_0xcd570a[_0x4910('0x8')]='blind';exports[_0x4910('0x13')][_0xcd570a[_0x4910('0x14')]]=_0xcd570a;writeDB(_0xcd570a);}catch(_0x7104f1){utils[_0x4910('0x15')](util[_0x4910('0x4')](_0x4910('0xc'),_0xcd570a[_0x4910('0xd')]),_0x7104f1);}};exports[_0x4910('0x16')]=function(_0xe31c1f){try{utils[_0x4910('0xb')](util[_0x4910('0x4')](_0x4910('0x17'),_0xe31c1f['origtransfereruniqueid']),_0xe31c1f);utils['info'](util['format'](_0x4910('0x18'),_0xe31c1f[_0x4910('0x7')],_0xe31c1f[_0x4910('0x19')],_0xe31c1f[_0x4910('0x1a')],_0xe31c1f['transfertargetcalleridnum'],_0xe31c1f[_0x4910('0x1b')]));_0xe31c1f=_['assign'](_0xe31c1f,{'transfererchannel':_0xe31c1f[_0x4910('0x1c')],'transferercalleridnum':_0xe31c1f[_0x4910('0x19')],'transferercalleridname':_0xe31c1f[_0x4910('0x1a')],'transfererconnectedlinenum':_0xe31c1f['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0xe31c1f[_0x4910('0x1d')],'transfereraccountcode':_0xe31c1f['origtransfereraccountcode'],'transferercontext':_0xe31c1f[_0x4910('0x1e')],'transfererexten':_0xe31c1f['secondtransfererexten'],'transfererlinkedid':_0xe31c1f[_0x4910('0x1f')],'context':_0xe31c1f['origtransferercontext'],'extension':_0xe31c1f[_0x4910('0x20')],'type':_0x4910('0x6')});if(_['isNil'](_0xe31c1f[_0x4910('0x21')])){_0xe31c1f=_[_0x4910('0x22')](_0xe31c1f,{'transfereechannel':_0xe31c1f['transfertargetchannel'],'transfereecalleridnum':_0xe31c1f[_0x4910('0x23')],'transfereecalleridname':_0xe31c1f[_0x4910('0x1b')],'transfereeconnectedlinenum':_0xe31c1f[_0x4910('0x24')],'transfereeconnectedlinename':_0xe31c1f[_0x4910('0x25')],'transfereeaccountcode':_0xe31c1f[_0x4910('0x26')],'transfereecontext':_0xe31c1f['transfertargetcontext'],'transfereeexten':_0xe31c1f[_0x4910('0x27')],'transfereelinkedid':_0xe31c1f[_0x4910('0x28')]});}writeDB(_0xe31c1f);}catch(_0xeb4b20){utils[_0x4910('0x15')](util[_0x4910('0x4')](_0x4910('0x17'),_0xe31c1f[_0x4910('0x7')]),_0xeb4b20);}}; \ No newline at end of file +var _0x90b5=['transferercalleridnum','transferercalleridname','transfereecalleridnum','blind','blinds','transfereruniqueid','error','uniqueid','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','lodash','./utils','format','type','attended','request','blindtransfer','debug','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x90b5,0x73));var _0x590b=function(_0x3d17ab,_0x2416b4){_0x3d17ab=_0x3d17ab-0x0;var _0x2fd463=_0x90b5[_0x3d17ab];return _0x2fd463;};'use strict';var _=require(_0x590b('0x0'));var util=require('util');var utils=require(_0x590b('0x1'));function writeDB(_0x5e9605){utils['info'](util[_0x590b('0x2')]('[%s][transfers][writeDB]\x20type:%s',_0x5e9605[_0x590b('0x3')]===_0x590b('0x4')?_0x5e9605['origtransfereruniqueid']:_0x5e9605['uniqueid'],_0x5e9605[_0x590b('0x3')]));utils[_0x590b('0x5')]('CreateVoiceTransferReport',_0x5e9605);}exports['blinds']={};exports[_0x590b('0x6')]=function(_0xccb749){try{utils[_0x590b('0x7')](util[_0x590b('0x2')](_0x590b('0x8'),_0xccb749['uniqueid']),_0xccb749);utils[_0x590b('0x9')](util[_0x590b('0x2')](_0x590b('0xa'),_0xccb749['uniqueid'],_0xccb749[_0x590b('0xb')],_0xccb749[_0x590b('0xc')],_0xccb749[_0x590b('0xd')],_0xccb749['transfereecalleridname']));_0xccb749[_0x590b('0x3')]=_0x590b('0xe');exports[_0x590b('0xf')][_0xccb749[_0x590b('0x10')]]=_0xccb749;writeDB(_0xccb749);}catch(_0x1f25bb){utils[_0x590b('0x11')](util[_0x590b('0x2')](_0x590b('0x8'),_0xccb749[_0x590b('0x12')]),_0x1f25bb);}};exports[_0x590b('0x13')]=function(_0x22b553){try{utils[_0x590b('0x7')](util[_0x590b('0x2')](_0x590b('0x14'),_0x22b553[_0x590b('0x15')]),_0x22b553);utils[_0x590b('0x9')](util[_0x590b('0x2')](_0x590b('0x16'),_0x22b553[_0x590b('0x15')],_0x22b553[_0x590b('0x17')],_0x22b553[_0x590b('0x18')],_0x22b553[_0x590b('0x19')],_0x22b553[_0x590b('0x1a')]));_0x22b553=_[_0x590b('0x1b')](_0x22b553,{'transfererchannel':_0x22b553[_0x590b('0x1c')],'transferercalleridnum':_0x22b553['origtransferercalleridnum'],'transferercalleridname':_0x22b553['origtransferercalleridname'],'transfererconnectedlinenum':_0x22b553[_0x590b('0x1d')],'transfererconnectedlinename':_0x22b553[_0x590b('0x1e')],'transfereraccountcode':_0x22b553['origtransfereraccountcode'],'transferercontext':_0x22b553[_0x590b('0x1f')],'transfererexten':_0x22b553[_0x590b('0x20')],'transfererlinkedid':_0x22b553[_0x590b('0x21')],'context':_0x22b553[_0x590b('0x22')],'extension':_0x22b553[_0x590b('0x23')],'type':_0x590b('0x4')});if(_['isNil'](_0x22b553['transfereechannel'])){_0x22b553=_[_0x590b('0x1b')](_0x22b553,{'transfereechannel':_0x22b553[_0x590b('0x24')],'transfereecalleridnum':_0x22b553[_0x590b('0x19')],'transfereecalleridname':_0x22b553[_0x590b('0x1a')],'transfereeconnectedlinenum':_0x22b553[_0x590b('0x25')],'transfereeconnectedlinename':_0x22b553[_0x590b('0x26')],'transfereeaccountcode':_0x22b553[_0x590b('0x27')],'transfereecontext':_0x22b553[_0x590b('0x28')],'transfereeexten':_0x22b553['transfertargetexten'],'transfereelinkedid':_0x22b553[_0x590b('0x29')]});}writeDB(_0x22b553);}catch(_0x466f4f){utils['error'](util[_0x590b('0x2')](_0x590b('0x14'),_0x22b553['origtransfereruniqueid']),_0x466f4f);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index d781cea..b2d01c2 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 _0xa5c5=['add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','GetUser','name','[utils][getUser]\x20where:%s','result','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime'];(function(_0x40612d,_0x15508a){var _0x4258f2=function(_0x577d70){while(--_0x577d70){_0x40612d['push'](_0x40612d['shift']());}};_0x4258f2(++_0x15508a);}(_0xa5c5,0xba));var _0x5a5c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa5c5[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require(_0x5a5c('0x0'));var jayson=require(_0x5a5c('0x1'));var moment=require(_0x5a5c('0x2'));var util=require('util');var client=jayson[_0x5a5c('0x3')][_0x5a5c('0x4')]({'port':0x2329});var logger=require(_0x5a5c('0x5'))(_0x5a5c('0x6'));exports[_0x5a5c('0x7')]=function(_0x54e820,_0x3986ff){logger[_0x5a5c('0x7')](_0x54e820,_0x3986ff?util[_0x5a5c('0x8')](_0x3986ff,{'showHidden':![],'depth':null}):'');};exports[_0x5a5c('0x9')]=function(_0x4dc66e,_0x27876a){logger[_0x5a5c('0x9')](_0x4dc66e,_0x27876a?util[_0x5a5c('0x8')](_0x27876a,{'showHidden':![],'depth':null}):'');};exports[_0x5a5c('0xa')]=function(_0x5b061b,_0x349e05){logger[_0x5a5c('0xa')](_0x5b061b,_0x349e05?util[_0x5a5c('0x8')](_0x349e05,{'showHidden':![],'depth':null}):'');};exports[_0x5a5c('0xb')]=function(_0x42efe1,_0x3cb67e){return client[_0x5a5c('0xb')](_0x42efe1,{'body':_0x3cb67e})[_0x5a5c('0xc')](function(_0x29122f){logger[_0x5a5c('0x9')](_0x5a5c('0xd'),_0x42efe1,_0x29122f?util[_0x5a5c('0x8')](_0x29122f,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x2db85a){logger['error'](_0x5a5c('0xd'),_0x42efe1,_0x2db85a?util['inspect'](_0x2db85a,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1389db){return client[_0x5a5c('0xb')](_0x5a5c('0xe'),{'options':{'raw':!![],'attributes':['id','internal',_0x5a5c('0xf'),'interface'],'where':_0x1389db,'limit':0x1}})[_0x5a5c('0xc')](function(_0x117558){logger[_0x5a5c('0x9')](_0x5a5c('0x10'),JSON['stringify'](_0x1389db),_0x117558?util['inspect'](_0x117558,{'showHidden':![],'depth':null}):'');return _0x117558[_0x5a5c('0x11')][_0x5a5c('0x12')]?_0x117558[_0x5a5c('0x11')][0x0]:null;});}exports[_0x5a5c('0x13')]=function(_0x17b534){return new BPromise(function(_0x5ccd84,_0x171efb){if(_0x17b534){return getUser({'internal':_0x17b534})[_0x5a5c('0xc')](function(_0x495211){logger[_0x5a5c('0x7')](_0x5a5c('0x14'),_0x17b534,_0x495211?_0x5a5c('0x15'):_0x5a5c('0x16'));return _0x5ccd84(_0x495211);})[_0x5a5c('0x17')](function(_0x1b27b2){logger[_0x5a5c('0xa')]('[utils][getUserByInternal]',_0x1b27b2?util[_0x5a5c('0x8')](_0x1b27b2,{'showHidden':![],'depth':null}):'');return _0x5ccd84(null);});}return _0x5ccd84(null);});};exports[_0x5a5c('0x18')]=function(_0x384c14){return new BPromise(function(_0x3e5f16,_0x368eb0){if(_0x384c14){return getUser({'interface':_0x384c14})[_0x5a5c('0xc')](function(_0x537a0a){logger[_0x5a5c('0x7')](_0x5a5c('0x19'),_0x384c14,_0x537a0a?_0x5a5c('0x15'):_0x5a5c('0x16'));return _0x3e5f16(_0x537a0a);})[_0x5a5c('0x17')](function(_0x957ed1){logger[_0x5a5c('0xa')](_0x5a5c('0x1a'),_0x957ed1?util['inspect'](_0x957ed1,{'showHidden':![],'depth':null}):'');return _0x3e5f16(null);});}return _0x3e5f16(null);});};exports[_0x5a5c('0x1b')]=function(_0x2de170){return new BPromise(function(_0x3b6f76,_0x17f5ba){if(_0x2de170){return getUser({'name':_0x2de170})[_0x5a5c('0xc')](function(_0x75c4fc){logger[_0x5a5c('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2de170,_0x75c4fc?_0x5a5c('0x15'):'notfound');return _0x3b6f76(_0x75c4fc);})[_0x5a5c('0x17')](function(_0x1fb9b3){logger['error']('[utils][getUserByName]',_0x1fb9b3?util[_0x5a5c('0x8')](_0x1fb9b3,{'showHidden':![],'depth':null}):'');return _0x3b6f76(null);});}return _0x3b6f76(null);});};exports['getVoiceQueueByName']=function(_0x2ac622){return new BPromise(function(_0x2b22b6,_0x2a7c25){if(_0x2ac622){return client[_0x5a5c('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x5a5c('0xf'),_0x5a5c('0x1c'),_0x5a5c('0x1d'),'acwTimeout'],'where':{'name':_0x2ac622},'limit':0x1}})[_0x5a5c('0xc')](function(_0x15c554){logger[_0x5a5c('0x9')](_0x5a5c('0x1e'),_0x2ac622,_0x15c554?util['inspect'](_0x15c554,{'showHidden':![],'depth':null}):'');logger[_0x5a5c('0x7')](_0x5a5c('0x1f'),_0x2ac622,_0x15c554?_0x5a5c('0x15'):'notfound');return _0x2b22b6(_0x15c554[_0x5a5c('0x11')]['length']?_0x15c554[_0x5a5c('0x11')][0x0]:null);})['catch'](function(_0x20c9ce){logger[_0x5a5c('0xa')](_0x5a5c('0x20'),_0x20c9ce?util[_0x5a5c('0x8')](_0x20c9ce,{'showHidden':![],'depth':null}):'');return _0x2b22b6(null);});}return _0x2b22b6(null);});};exports[_0x5a5c('0x21')]=function(_0x7a6824,_0x3dc5bb){return moment(_0x7a6824)[_0x5a5c('0x22')](_0x3dc5bb,_0x5a5c('0x23'))[_0x5a5c('0x24')](_0x5a5c('0x25'));};exports[_0x5a5c('0x26')]=function(_0x51e65b,_0xcc6c58){return moment(_0x51e65b)['subtract'](_0xcc6c58,_0x5a5c('0x23'))[_0x5a5c('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5a5c('0x27')]=function(_0x55f58a,_0xb5c5e8){return moment(_0x55f58a)['diff'](moment(_0xb5c5e8),'seconds');};exports[_0x5a5c('0x28')]=function(_0x36dee0,_0x43ddde){return parseInt(_0x36dee0,0xa)+parseInt(_0x43ddde,0xa);};exports[_0x5a5c('0x29')]=function(){return moment()['format'](_0x5a5c('0x25'));};exports[_0x5a5c('0x2a')]=function(_0x495b2d,_0x10bf90){if(_0x10bf90){return moment(_0x495b2d)[_0x5a5c('0x2a')](_0x10bf90);}return!![];};exports['isBefore']=function(_0x1f819e,_0x2d0eb0){if(_0x2d0eb0){return moment(_0x1f819e)[_0x5a5c('0x2b')](_0x2d0eb0);}else if(_0x1f819e){return!![];}return![];}; \ No newline at end of file +var _0x088e=['getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','subtract','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x088e,0x172));var _0xe088=function(_0x37f3e0,_0x5559bf){_0x37f3e0=_0x37f3e0-0x0;var _0x58d081=_0x088e[_0x37f3e0];return _0x58d081;};'use strict';var BPromise=require(_0xe088('0x0'));var jayson=require(_0xe088('0x1'));var moment=require(_0xe088('0x2'));var util=require('util');var client=jayson[_0xe088('0x3')][_0xe088('0x4')]({'port':0x2329});var logger=require(_0xe088('0x5'))(_0xe088('0x6'));exports[_0xe088('0x7')]=function(_0x32edf3,_0x14731b){logger['info'](_0x32edf3,_0x14731b?util[_0xe088('0x8')](_0x14731b,{'showHidden':![],'depth':null}):'');};exports[_0xe088('0x9')]=function(_0x508f8f,_0x3723cb){logger[_0xe088('0x9')](_0x508f8f,_0x3723cb?util[_0xe088('0x8')](_0x3723cb,{'showHidden':![],'depth':null}):'');};exports[_0xe088('0xa')]=function(_0x4ba71c,_0x9f9bb2){logger[_0xe088('0xa')](_0x4ba71c,_0x9f9bb2?util[_0xe088('0x8')](_0x9f9bb2,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x202af5,_0x4031a4){return client[_0xe088('0xb')](_0x202af5,{'body':_0x4031a4})[_0xe088('0xc')](function(_0x12cef9){logger[_0xe088('0x9')](_0xe088('0xd'),_0x202af5,_0x12cef9?util[_0xe088('0x8')](_0x12cef9,{'showHidden':![],'depth':null}):'');})[_0xe088('0xe')](function(_0x22db47){logger[_0xe088('0xa')](_0xe088('0xd'),_0x202af5,_0x22db47?util[_0xe088('0x8')](_0x22db47,{'showHidden':![],'depth':null}):'');});};function getUser(_0x504b79){return client[_0xe088('0xb')](_0xe088('0xf'),{'options':{'raw':!![],'attributes':['id',_0xe088('0x10'),_0xe088('0x11'),_0xe088('0x12')],'where':_0x504b79,'limit':0x1}})['then'](function(_0x248378){logger['debug'](_0xe088('0x13'),JSON['stringify'](_0x504b79),_0x248378?util[_0xe088('0x8')](_0x248378,{'showHidden':![],'depth':null}):'');return _0x248378[_0xe088('0x14')][_0xe088('0x15')]?_0x248378[_0xe088('0x14')][0x0]:null;});}exports[_0xe088('0x16')]=function(_0x5bd620){return new BPromise(function(_0x5e8b3b,_0x9ad9d5){if(_0x5bd620){return getUser({'internal':_0x5bd620})[_0xe088('0xc')](function(_0x535e58){logger[_0xe088('0x7')](_0xe088('0x17'),_0x5bd620,_0x535e58?_0xe088('0x18'):_0xe088('0x19'));return _0x5e8b3b(_0x535e58);})['catch'](function(_0x4f14d8){logger[_0xe088('0xa')](_0xe088('0x1a'),_0x4f14d8?util['inspect'](_0x4f14d8,{'showHidden':![],'depth':null}):'');return _0x5e8b3b(null);});}return _0x5e8b3b(null);});};exports[_0xe088('0x1b')]=function(_0x5d4e7a){return new BPromise(function(_0x4a81ee,_0x520a7c){if(_0x5d4e7a){return getUser({'interface':_0x5d4e7a})['then'](function(_0x15c6f7){logger[_0xe088('0x7')](_0xe088('0x1c'),_0x5d4e7a,_0x15c6f7?_0xe088('0x18'):_0xe088('0x19'));return _0x4a81ee(_0x15c6f7);})['catch'](function(_0x3607e1){logger['error'](_0xe088('0x1d'),_0x3607e1?util['inspect'](_0x3607e1,{'showHidden':![],'depth':null}):'');return _0x4a81ee(null);});}return _0x4a81ee(null);});};exports[_0xe088('0x1e')]=function(_0x10c29d){return new BPromise(function(_0x1b1d67,_0x30396e){if(_0x10c29d){return getUser({'name':_0x10c29d})['then'](function(_0x49c772){logger[_0xe088('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x10c29d,_0x49c772?_0xe088('0x18'):'notfound');return _0x1b1d67(_0x49c772);})['catch'](function(_0x5c6c2e){logger[_0xe088('0xa')]('[utils][getUserByName]',_0x5c6c2e?util[_0xe088('0x8')](_0x5c6c2e,{'showHidden':![],'depth':null}):'');return _0x1b1d67(null);});}return _0x1b1d67(null);});};exports[_0xe088('0x1f')]=function(_0x28b984){return new BPromise(function(_0x496cbf,_0x5c9743){if(_0x28b984){return client['request'](_0xe088('0x20'),{'options':{'raw':!![],'attributes':['id',_0xe088('0x11'),_0xe088('0x21'),'acw',_0xe088('0x22')],'where':{'name':_0x28b984},'limit':0x1}})[_0xe088('0xc')](function(_0x41a30f){logger[_0xe088('0x9')](_0xe088('0x23'),_0x28b984,_0x41a30f?util[_0xe088('0x8')](_0x41a30f,{'showHidden':![],'depth':null}):'');logger[_0xe088('0x7')](_0xe088('0x24'),_0x28b984,_0x41a30f?_0xe088('0x18'):_0xe088('0x19'));return _0x496cbf(_0x41a30f[_0xe088('0x14')][_0xe088('0x15')]?_0x41a30f[_0xe088('0x14')][0x0]:null);})['catch'](function(_0x5e3a64){logger[_0xe088('0xa')](_0xe088('0x25'),_0x5e3a64?util[_0xe088('0x8')](_0x5e3a64,{'showHidden':![],'depth':null}):'');return _0x496cbf(null);});}return _0x496cbf(null);});};exports[_0xe088('0x26')]=function(_0x26e443,_0x556660){return moment(_0x26e443)[_0xe088('0x27')](_0x556660,_0xe088('0x28'))['format']('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x2de4f3,_0x106417){return moment(_0x2de4f3)[_0xe088('0x29')](_0x106417,'seconds')[_0xe088('0x2a')](_0xe088('0x2b'));};exports[_0xe088('0x2c')]=function(_0x171a36,_0x44a821){return moment(_0x171a36)['diff'](moment(_0x44a821),_0xe088('0x28'));};exports[_0xe088('0x2d')]=function(_0x3f0ad5,_0x456db5){return parseInt(_0x3f0ad5,0xa)+parseInt(_0x456db5,0xa);};exports[_0xe088('0x2e')]=function(){return moment()[_0xe088('0x2a')](_0xe088('0x2b'));};exports[_0xe088('0x2f')]=function(_0x4edcfd,_0x1b152f){if(_0x1b152f){return moment(_0x4edcfd)['isAfter'](_0x1b152f);}return!![];};exports[_0xe088('0x30')]=function(_0x3bd4c8,_0xb8d565){if(_0xb8d565){return moment(_0x3bd4c8)[_0xe088('0x30')](_0xb8d565);}else if(_0x3bd4c8){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 6e8a726..508a7b0 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 _0xdb7c=['agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','statusCode','responseTime','agent_name','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','client','role','name','ensureDir','catch','user','then','no-user','data','timestamp','error','api','set','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','connection','remoteAddress','url','inspect','device'];(function(_0x112fe3,_0x16b642){var _0x1ec903=function(_0x1539eb){while(--_0x1539eb){_0x112fe3['push'](_0x112fe3['shift']());}};_0x1ec903(++_0x16b642);}(_0xdb7c,0x149));var _0xcdb7=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xdb7c[_0x1bc013];return _0x55df36;};var fs=require(_0xcdb7('0x0'));var _=require(_0xcdb7('0x1'));var ewinston=require(_0xcdb7('0x2'));var path=require('path');var util=require(_0xcdb7('0x3'));var fileLogger=require(_0xcdb7('0x4'))[_0xcdb7('0x5')];var safeTemplate=require(_0xcdb7('0x6'))[_0xcdb7('0x7')];var maskSensitiveData=require(_0xcdb7('0x8'))[_0xcdb7('0x9')];function ClientSideLogger(){function _0x2b9e4c(_0xb19005){var _0x5843fd=path[_0xcdb7('0xa')](_0xcdb7('0xb'),_0xcdb7('0xc'),'xcally');var _0x297dd9=path['join'](_0xcdb7('0xd'),_0xb19005[_0xcdb7('0xe')]+'-'+_0xb19005[_0xcdb7('0xf')]);return fs[_0xcdb7('0x10')](path[_0xcdb7('0xa')](_0x5843fd,_0x297dd9))['then'](function(){var _0x55f46d=fileLogger(_0xcdb7('0xd'),path[_0xcdb7('0xa')](_0x5843fd,_0x297dd9));return _0x55f46d;})[_0xcdb7('0x11')](function(_0x5bf7b9){throw _0x5bf7b9;});}this[_0xcdb7('0xc')]=function(_0x20ed0b,_0xbfa256,_0x158b45,_0x391690){return _0x2b9e4c(_0x20ed0b[_0xcdb7('0x12')])[_0xcdb7('0x13')](function(_0x6f7048){var _0x465ffb=_0x6f7048[_0xbfa256];return _0x465ffb;})[_0xcdb7('0x13')](function(_0xc6964f){var _0x44912c=_0x20ed0b['user']?_0x20ed0b[_0xcdb7('0x12')]['id']:_0xcdb7('0x14');var _0x5a1978=_0x391690[_0xcdb7('0x15')];var _0x5206b3=_0x391690[_0xcdb7('0x16')];var _0x5af634=new Date(Number(_0x5206b3));return _0xc6964f(_0x44912c,_0x5af634,_0x158b45,_0x5a1978);})['catch'](function(_0x51a375){fileLogger(_0xcdb7('0xd'))[_0xcdb7('0x17')](_0x51a375);});};}function setupLoggers(_0x199c07){return new Promise(function(_0x18e545){var _0x3f4ab5=new ClientSideLogger();var _0x5aa4af=fileLogger(_0xcdb7('0x18'));var _0x58f053=fileLogger('auth');_0x199c07[_0xcdb7('0x19')]('client-side-logger',_0x3f4ab5);_0x199c07['use'](ewinston[_0xcdb7('0x1a')]({'winstonInstance':_0x5aa4af,'meta':![],'statusLevels':!![],'msg':function(_0x95c453,_0x38cac5){var _0x5e8a1a=_0xcdb7('0x1b');if(!_[_0xcdb7('0x1c')](_0x95c453[_0xcdb7('0x1d')])){_0x5e8a1a+=_0xcdb7('0x1e');var _0x516f9e=_0x95c453[_0xcdb7('0x1d')];maskSensitiveData(_0x516f9e);}return safeTemplate(util[_0xcdb7('0x1f')](_0x5e8a1a,_0x95c453[_0xcdb7('0x20')],_0x95c453['headers'][_0xcdb7('0x21')]?_0x95c453['headers']['x-forwarded-for']:_0x95c453[_0xcdb7('0x22')][_0xcdb7('0x23')]||_0x95c453['ip'],_0x95c453[_0xcdb7('0x24')],_0x38cac5['statusCode'],_0x38cac5['responseTime'],_0x95c453[_0xcdb7('0x12')]?_0x95c453[_0xcdb7('0x12')]['id']:null,_0x95c453[_0xcdb7('0x12')]?_0x95c453[_0xcdb7('0x12')][_0xcdb7('0xf')]:null,_0x95c453[_0xcdb7('0x12')]?_0x95c453['user']['role']:null,_0x516f9e?util[_0xcdb7('0x25')](_0x516f9e,![],null):''));}}));_0x199c07['use'](ewinston[_0xcdb7('0x1a')]({'winstonInstance':_0x58f053,'meta':![],'statusLevels':!![],'msg':function(_0x4917fe,_0x49102d){var _0x2a8598='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4917fe[_0xcdb7('0x1d')]&&_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x26')]&&_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x27')]){_0x2a8598=_0xcdb7('0x28');}return util[_0xcdb7('0x1f')](_0x2a8598,_0x4917fe[_0xcdb7('0x20')],_0x4917fe['headers']['x-forwarded-for']?_0x4917fe[_0xcdb7('0x29')][_0xcdb7('0x21')]:_0x4917fe['connection'][_0xcdb7('0x23')]||_0x4917fe['ip'],_0x4917fe[_0xcdb7('0x24')],_0x49102d[_0xcdb7('0x2a')],_0x49102d[_0xcdb7('0x2b')],_0x4917fe[_0xcdb7('0x12')]?_0x4917fe[_0xcdb7('0x12')]['id']:null,_0x4917fe[_0xcdb7('0x12')]?_0x4917fe[_0xcdb7('0x12')][_0xcdb7('0xf')]:null,_0x4917fe[_0xcdb7('0x12')]?_0x4917fe[_0xcdb7('0x12')][_0xcdb7('0xe')]:null,_0x4917fe[_0xcdb7('0x1d')]&&_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x26')]?_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x26')]:'other',_0x4917fe[_0xcdb7('0x1d')]&&_0x4917fe['body'][_0xcdb7('0x27')]?_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x27')]:'',_0x4917fe[_0xcdb7('0x1d')]&&_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x2c')]?_0x4917fe[_0xcdb7('0x1d')][_0xcdb7('0x2c')]:'');},'ignoreRoute':function(_0x249a44){var _0x547434=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x547434['test'](_0x249a44['url']);}}));return _0x18e545();});}exports[_0xcdb7('0x2d')]=setupLoggers; \ No newline at end of file +var _0x8ddb=['role','name','then','catch','user','no-user','error','api','auth','client-side-logger','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','method','headers','x-forwarded-for','connection','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','format','remoteAddress','other','agent_name','test','setupLoggers','lodash','express-winston','path','util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','log','xcally','client'];(function(_0x3a4592,_0x4af1be){var _0x7fb678=function(_0x21449e){while(--_0x21449e){_0x3a4592['push'](_0x3a4592['shift']());}};_0x7fb678(++_0x4af1be);}(_0x8ddb,0x15b));var _0xb8dd=function(_0x5cce5a,_0x298d54){_0x5cce5a=_0x5cce5a-0x0;var _0x354e33=_0x8ddb[_0x5cce5a];return _0x354e33;};var fs=require('fs-extra');var _=require(_0xb8dd('0x0'));var ewinston=require(_0xb8dd('0x1'));var path=require(_0xb8dd('0x2'));var util=require(_0xb8dd('0x3'));var fileLogger=require(_0xb8dd('0x4'))[_0xb8dd('0x5')];var safeTemplate=require(_0xb8dd('0x6'))['safeTemplate'];var maskSensitiveData=require(_0xb8dd('0x7'))[_0xb8dd('0x8')];function ClientSideLogger(){function _0x3cafcd(_0x34876a){var _0x5351ff=path[_0xb8dd('0x9')]('/var',_0xb8dd('0xa'),_0xb8dd('0xb'));var _0x99b0e2=path['join'](_0xb8dd('0xc'),_0x34876a[_0xb8dd('0xd')]+'-'+_0x34876a[_0xb8dd('0xe')]);return fs['ensureDir'](path[_0xb8dd('0x9')](_0x5351ff,_0x99b0e2))[_0xb8dd('0xf')](function(){var _0x1cd396=fileLogger(_0xb8dd('0xc'),path[_0xb8dd('0x9')](_0x5351ff,_0x99b0e2));return _0x1cd396;})[_0xb8dd('0x10')](function(_0x3d366f){throw _0x3d366f;});}this[_0xb8dd('0xa')]=function(_0x5d5cb2,_0x19419c,_0x105757,_0x3aea63){return _0x3cafcd(_0x5d5cb2[_0xb8dd('0x11')])['then'](function(_0x2be93c){var _0x74b05f=_0x2be93c[_0x19419c];return _0x74b05f;})[_0xb8dd('0xf')](function(_0x3391f6){var _0x5c8540=_0x5d5cb2[_0xb8dd('0x11')]?_0x5d5cb2[_0xb8dd('0x11')]['id']:_0xb8dd('0x12');var _0x13f8f3=_0x3aea63['data'];var _0xe47ee3=_0x3aea63['timestamp'];var _0x19b54f=new Date(Number(_0xe47ee3));return _0x3391f6(_0x5c8540,_0x19b54f,_0x105757,_0x13f8f3);})[_0xb8dd('0x10')](function(_0x99ab87){fileLogger('client')[_0xb8dd('0x13')](_0x99ab87);});};}function setupLoggers(_0x43d6fd){return new Promise(function(_0x35ada0){var _0x43f136=new ClientSideLogger();var _0x543507=fileLogger(_0xb8dd('0x14'));var _0x4d07bd=fileLogger(_0xb8dd('0x15'));_0x43d6fd['set'](_0xb8dd('0x16'),_0x43f136);_0x43d6fd['use'](ewinston[_0xb8dd('0x17')]({'winstonInstance':_0x543507,'meta':![],'statusLevels':!![],'msg':function(_0x6247c8,_0x3ed6d4){var _0x29fc7d=_0xb8dd('0x18');if(!_[_0xb8dd('0x19')](_0x6247c8['body'])){_0x29fc7d+=_0xb8dd('0x1a');var _0x5d2f67=_0x6247c8[_0xb8dd('0x1b')];maskSensitiveData(_0x5d2f67);}return safeTemplate(util['format'](_0x29fc7d,_0x6247c8[_0xb8dd('0x1c')],_0x6247c8['headers']['x-forwarded-for']?_0x6247c8[_0xb8dd('0x1d')][_0xb8dd('0x1e')]:_0x6247c8[_0xb8dd('0x1f')]['remoteAddress']||_0x6247c8['ip'],_0x6247c8[_0xb8dd('0x20')],_0x3ed6d4[_0xb8dd('0x21')],_0x3ed6d4[_0xb8dd('0x22')],_0x6247c8[_0xb8dd('0x11')]?_0x6247c8[_0xb8dd('0x11')]['id']:null,_0x6247c8['user']?_0x6247c8[_0xb8dd('0x11')]['name']:null,_0x6247c8['user']?_0x6247c8[_0xb8dd('0x11')][_0xb8dd('0xd')]:null,_0x5d2f67?util[_0xb8dd('0x23')](_0x5d2f67,![],null):''));}}));_0x43d6fd['use'](ewinston[_0xb8dd('0x17')]({'winstonInstance':_0x4d07bd,'meta':![],'statusLevels':!![],'msg':function(_0x23676b,_0x772f92){var _0x4dbb68=_0xb8dd('0x24');if(_0x23676b['body']&&_0x23676b['body'][_0xb8dd('0x25')]&&_0x23676b['body'][_0xb8dd('0x26')]){_0x4dbb68='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0xb8dd('0x27')](_0x4dbb68,_0x23676b[_0xb8dd('0x1c')],_0x23676b[_0xb8dd('0x1d')][_0xb8dd('0x1e')]?_0x23676b['headers'][_0xb8dd('0x1e')]:_0x23676b['connection'][_0xb8dd('0x28')]||_0x23676b['ip'],_0x23676b[_0xb8dd('0x20')],_0x772f92[_0xb8dd('0x21')],_0x772f92['responseTime'],_0x23676b[_0xb8dd('0x11')]?_0x23676b[_0xb8dd('0x11')]['id']:null,_0x23676b[_0xb8dd('0x11')]?_0x23676b[_0xb8dd('0x11')]['name']:null,_0x23676b[_0xb8dd('0x11')]?_0x23676b[_0xb8dd('0x11')][_0xb8dd('0xd')]:null,_0x23676b[_0xb8dd('0x1b')]&&_0x23676b[_0xb8dd('0x1b')][_0xb8dd('0x25')]?_0x23676b[_0xb8dd('0x1b')][_0xb8dd('0x25')]:_0xb8dd('0x29'),_0x23676b[_0xb8dd('0x1b')]&&_0x23676b[_0xb8dd('0x1b')]['agent_id']?_0x23676b['body'][_0xb8dd('0x26')]:'',_0x23676b['body']&&_0x23676b[_0xb8dd('0x1b')]['agent_name']?_0x23676b[_0xb8dd('0x1b')][_0xb8dd('0x2a')]:'');},'ignoreRoute':function(_0x2f45fc){var _0x4514f7=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4514f7[_0xb8dd('0x2b')](_0x2f45fc['url']);}}));return _0x35ada0();});}exports[_0xb8dd('0x2c')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index c118b3d..6c2fad8 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a8c=['clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','includes','dowCompare','date','max','min','domCompare','MMM','monthCompare','guess','test','isMoment','length','padStart','iftime','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','toLowerCase','locale','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7a8c,0x177));var _0xc7a8=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x7a8c[_0x5f1391];return _0x50ebe3;};var _=require('lodash');var moment=require('moment-timezone');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(_0x1195c7){return _0x1195c7[_0xc7a8('0x0')];})[_0xc7a8('0x1')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc7a8('0x2');var EINVALID_DATE=_0xc7a8('0x3');function throwIfDateNotValid(_0x3db148){if(!_0x3db148[_0xc7a8('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x58c6ad){var _0x2be935=_0x58c6ad[_0xc7a8('0x5')](':')[_0xc7a8('0x6')](function(_0x55c781){return parseInt(_0x55c781,0xa);});var _0x4ba16d=_0x2be935[0x0];var _0x5dd650=_0x2be935[0x1];if(_0x4ba16d<0x0||_0x4ba16d>0x17||_0x5dd650<0x0||_0x5dd650>0x3b){throw new Error(EINVALID_DATE);}return[_0x4ba16d,_0x5dd650];}function circularDoWInterval(_0x516ea,_0x2a418d){if(_0x516ea===_0x2a418d){return[_0x516ea];}else{var _0xf6ee5c=moment['locale']();moment['locale']('en');var _0xb3ba5b=moment['weekdaysShort']()[_0xc7a8('0x6')](function(_0x66917c){return _0x66917c[_0xc7a8('0x7')]();});moment[_0xc7a8('0x8')](_0xf6ee5c);var _0x288849=_0xb3ba5b[_0xc7a8('0x9')](_0x516ea);var _0x29a612=_0xb3ba5b[_0xc7a8('0x9')](_0x2a418d);if(_0x29a612>_0x288849){return _0xb3ba5b[_0xc7a8('0xa')](_0x288849,_0x29a612+0x1);}else{var _0x55d9b1=_0xb3ba5b['slice'](0x0,_0x29a612+0x1);var _0x4524d4=_0xb3ba5b['slice'](_0x288849);return _0x4524d4[_0xc7a8('0xb')](_0x55d9b1);}}}module[_0xc7a8('0xc')][_0xc7a8('0xd')]=circularDoWInterval;function circularMonthInterval(_0x194fae,_0x1549c0){if(_0x194fae===_0x1549c0){return[_0x194fae];}else{var _0x2238a8=moment[_0xc7a8('0x8')]();moment[_0xc7a8('0x8')]('en');var _0x5a58d7=moment['monthsShort']()[_0xc7a8('0x6')](function(_0x4ea868){return _0x4ea868[_0xc7a8('0x7')]();});moment[_0xc7a8('0x8')](_0x2238a8);var _0x874083=_0x5a58d7[_0xc7a8('0x9')](_0x194fae);var _0x4bf156=_0x5a58d7[_0xc7a8('0x9')](_0x1549c0);if(_0x4bf156>_0x874083){return _0x5a58d7[_0xc7a8('0xa')](_0x874083,_0x4bf156+0x1);}else{var _0x186b6e=_0x5a58d7[_0xc7a8('0xa')](0x0,_0x4bf156+0x1);var _0x3cc995=_0x5a58d7[_0xc7a8('0xa')](_0x874083);return _0x3cc995[_0xc7a8('0xb')](_0x186b6e);}}}module[_0xc7a8('0xc')][_0xc7a8('0xe')]=circularMonthInterval;function parseDom(_0xb797fe){var _0x43661a=parseInt(_0xb797fe,0xa);if(_0x43661a<0x1||_0x43661a>0x1f){throw new Error(EINVALID_DATE);}return _0x43661a;}function timeCompare(_0x236e9c,_0xf7aba,_0xbe0c9e){var _0x95aa53=_0x236e9c[_0xc7a8('0xf')]();var _0x3fa9b5=extractTime(_0xf7aba);var _0x88ebf3=_0x3fa9b5[0x0];var _0x1dec1d=_0x3fa9b5[0x1];var _0x542b39=_0x236e9c[_0xc7a8('0xf')]()[_0xc7a8('0x10')](_0x88ebf3)[_0xc7a8('0x11')](_0x1dec1d);throwIfDateNotValid(_0x542b39);var _0x4dc18b=extractTime(_0xbe0c9e);var _0x2461e5=_0x4dc18b[0x0];var _0x4fbba7=_0x4dc18b[0x1];var _0x3bf6e8=_0x236e9c['clone']()[_0xc7a8('0x10')](_0x2461e5)[_0xc7a8('0x11')](_0x4fbba7);throwIfDateNotValid(_0x3bf6e8);if(_0x3bf6e8[_0xc7a8('0x12')](_0x542b39)){var _0x4b424f=_0x95aa53[_0xc7a8('0xf')]()[_0xc7a8('0x13')](_0xc7a8('0x14'));var _0x3294ca=_0x95aa53[_0xc7a8('0xf')]()[_0xc7a8('0x15')]('day');return _0x95aa53[_0xc7a8('0x16')](_0x542b39,_0x3294ca,undefined,'[]')||_0x95aa53['isBetween'](_0x4b424f,_0x3bf6e8,undefined,'[]');}else{return _0x95aa53[_0xc7a8('0x16')](_0x542b39,_0x3bf6e8,undefined,'[]');}}module[_0xc7a8('0xc')][_0xc7a8('0x17')]=timeCompare;function dowCompare(_0x27fca2,_0x3cadd3,_0x693438){var _0x2043ac=_0x27fca2['locale']('en')[_0xc7a8('0x18')]('ddd')[_0xc7a8('0x7')]();return circularDoWInterval(_0x3cadd3,_0x693438)[_0xc7a8('0x19')](_0x2043ac);}module[_0xc7a8('0xc')][_0xc7a8('0x1a')]=dowCompare;function domCompare(_0x281e6d,_0x2c8b38,_0x2a03e2){var _0x1ce4bc=_0x281e6d[_0xc7a8('0x1b')]();if(_0x2c8b38===_0x2a03e2){return _0x1ce4bc===_0x2c8b38;}else{var _0x497733=_0x281e6d['daysInMonth']();var _0xf959c9=_0x2c8b38<_0x2a03e2;let _0x1b1567=![];var _0x18f83a=0x0;var _0x2ac8bd=0x0;if(_0xf959c9){_0x18f83a=Math[_0xc7a8('0x1c')](0x1,_0x2c8b38);_0x2ac8bd=Math['min'](_0x2a03e2,_0x497733);_0x1b1567=_0x1ce4bc>=_0x18f83a&&_0x1ce4bc<=_0x2ac8bd;}else{_0x18f83a=Math[_0xc7a8('0x1d')](_0x2c8b38,_0x497733);_0x2ac8bd=Math[_0xc7a8('0x1c')](0x1,_0x2a03e2);_0x1b1567=_0x1ce4bc>=_0x18f83a||_0x1ce4bc<=_0x2ac8bd;}return _0x1b1567;}}module[_0xc7a8('0xc')][_0xc7a8('0x1e')]=domCompare;function monthCompare(_0x1fa352,_0x4123f7,_0x5918fd){var _0x49e1dc=_0x1fa352[_0xc7a8('0x8')]('en')['format'](_0xc7a8('0x1f'))[_0xc7a8('0x7')]();return circularMonthInterval(_0x4123f7,_0x5918fd)[_0xc7a8('0x19')](_0x49e1dc);}module[_0xc7a8('0xc')][_0xc7a8('0x20')]=monthCompare;function iftime(_0x4f07ca,_0x1d9af8=moment['tz'][_0xc7a8('0x21')](),_0x2f5334=moment()){if(!validateRx[_0xc7a8('0x22')](_0x4f07ca)){throw new Error(EINVALID_STRING);}else{var _0x3f73c4=(moment[_0xc7a8('0x23')](_0x2f5334)?_0x2f5334[_0xc7a8('0xf')]():moment(_0x2f5334))['tz'](_0x1d9af8)[_0xc7a8('0x8')]('en');throwIfDateNotValid(_0x3f73c4);var _0x188b04=_0x4f07ca[_0xc7a8('0x5')](',');var _0x1140c4=_0x188b04[0x0];var _0x3cb009=_0x188b04[0x1];var _0xc2e2bc=_0x188b04[0x2];var _0x56c466=_0x188b04[0x3];let _0x118115=!![];if(_0x1140c4!=='*'){var _0x2e31cb=_0x1140c4[_0xc7a8('0x5')]('-');var _0x5d262d=_['padStart'](_0x2e31cb[0x0],0x5,'0');var _0x36a8d5=_0x2e31cb[_0xc7a8('0x24')]===0x2?_[_0xc7a8('0x25')](_0x2e31cb[0x1],0x5,'0'):_0x5d262d;_0x118115=timeCompare(_0x3f73c4,_0x5d262d,_0x36a8d5);}let _0x243741=!![];if(_0x3cb009!=='*'){var _0xbadf37=_0x3cb009[_0xc7a8('0x5')]('-');var _0x1a181c=_0xbadf37[0x0];var _0x380995=_0xbadf37['length']===0x2?_0xbadf37[0x1]:_0x1a181c;_0x243741=dowCompare(_0x3f73c4,_0x1a181c,_0x380995);}let _0xf68758=!![];if(_0xc2e2bc!=='*'){var _0x4092fd=_0xc2e2bc[_0xc7a8('0x5')]('-');var _0x1f32fd=parseDom(_0x4092fd[0x0]);var _0x157b83=_0x4092fd[_0xc7a8('0x24')]===0x2?parseDom(_0x4092fd[0x1]):_0x1f32fd;_0xf68758=domCompare(_0x3f73c4,_0x1f32fd,_0x157b83);}let _0x2b63c0=!![];if(_0x56c466!=='*'){var _0x584021=_0x56c466[_0xc7a8('0x5')]('-');var _0xe9f655=_0x584021[0x0];var _0x310457=_0x584021[_0xc7a8('0x24')]===0x2?_0x584021[0x1]:_0x584021[0x0];_0x2b63c0=monthCompare(_0x3f73c4,_0xe9f655,_0x310457);}return _0x118115&&_0x243741&&_0xf68758&&_0x2b63c0;}}module[_0xc7a8('0xc')][_0xc7a8('0x26')]=iftime; \ No newline at end of file +var _0xccda=['max','min','domCompare','MMM','monthCompare','test','isMoment','padStart','length','iftime','lodash','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','split','map','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','minutes','hours','isBefore','endOf','isBetween','timeCompare','format','ddd','includes','date','daysInMonth'];(function(_0x784d32,_0xd2fc77){var _0xf5b407=function(_0x483648){while(--_0x483648){_0x784d32['push'](_0x784d32['shift']());}};_0xf5b407(++_0xd2fc77);}(_0xccda,0x169));var _0xaccd=function(_0x2c2b30,_0x48ed61){_0x2c2b30=_0x2c2b30-0x0;var _0x3b386a=_0xccda[_0x2c2b30];return _0x3b386a;};var _=require(_0xaccd('0x0'));var moment=require(_0xaccd('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]['map'](function(_0x1bca3c){return _0x1bca3c[_0xaccd('0x2')];})[_0xaccd('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xaccd('0x4');var EINVALID_DATE=_0xaccd('0x5');function throwIfDateNotValid(_0x1a3407){if(!_0x1a3407['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x51d77b){var _0x2bb25a=_0x51d77b[_0xaccd('0x6')](':')[_0xaccd('0x7')](function(_0x51e761){return parseInt(_0x51e761,0xa);});var _0x59321d=_0x2bb25a[0x0];var _0xc8ce36=_0x2bb25a[0x1];if(_0x59321d<0x0||_0x59321d>0x17||_0xc8ce36<0x0||_0xc8ce36>0x3b){throw new Error(EINVALID_DATE);}return[_0x59321d,_0xc8ce36];}function circularDoWInterval(_0xbe3339,_0x351994){if(_0xbe3339===_0x351994){return[_0xbe3339];}else{var _0x4c86ad=moment['locale']();moment[_0xaccd('0x8')]('en');var _0x1ae3ce=moment[_0xaccd('0x9')]()[_0xaccd('0x7')](function(_0x19aece){return _0x19aece[_0xaccd('0xa')]();});moment['locale'](_0x4c86ad);var _0x1f93f6=_0x1ae3ce[_0xaccd('0xb')](_0xbe3339);var _0x1479d8=_0x1ae3ce[_0xaccd('0xb')](_0x351994);if(_0x1479d8>_0x1f93f6){return _0x1ae3ce[_0xaccd('0xc')](_0x1f93f6,_0x1479d8+0x1);}else{var _0x1988ac=_0x1ae3ce[_0xaccd('0xc')](0x0,_0x1479d8+0x1);var _0x2f1e9a=_0x1ae3ce[_0xaccd('0xc')](_0x1f93f6);return _0x2f1e9a[_0xaccd('0xd')](_0x1988ac);}}}module[_0xaccd('0xe')][_0xaccd('0xf')]=circularDoWInterval;function circularMonthInterval(_0x48a95b,_0x5db006){if(_0x48a95b===_0x5db006){return[_0x48a95b];}else{var _0xfd6810=moment[_0xaccd('0x8')]();moment[_0xaccd('0x8')]('en');var _0x57e208=moment[_0xaccd('0x10')]()[_0xaccd('0x7')](function(_0x180011){return _0x180011[_0xaccd('0xa')]();});moment[_0xaccd('0x8')](_0xfd6810);var _0x46fe15=_0x57e208[_0xaccd('0xb')](_0x48a95b);var _0x257467=_0x57e208[_0xaccd('0xb')](_0x5db006);if(_0x257467>_0x46fe15){return _0x57e208['slice'](_0x46fe15,_0x257467+0x1);}else{var _0x224e6a=_0x57e208[_0xaccd('0xc')](0x0,_0x257467+0x1);var _0x510cbc=_0x57e208[_0xaccd('0xc')](_0x46fe15);return _0x510cbc[_0xaccd('0xd')](_0x224e6a);}}}module[_0xaccd('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x1e4ffb){var _0x21d713=parseInt(_0x1e4ffb,0xa);if(_0x21d713<0x1||_0x21d713>0x1f){throw new Error(EINVALID_DATE);}return _0x21d713;}function timeCompare(_0x39fed7,_0xcc7b94,_0x3d1c2a){var _0x243034=_0x39fed7[_0xaccd('0x11')]();var _0xb79a7f=extractTime(_0xcc7b94);var _0x532d54=_0xb79a7f[0x0];var _0x2aaa27=_0xb79a7f[0x1];var _0x593b64=_0x39fed7[_0xaccd('0x11')]()['hours'](_0x532d54)[_0xaccd('0x12')](_0x2aaa27);throwIfDateNotValid(_0x593b64);var _0xc967f2=extractTime(_0x3d1c2a);var _0x194673=_0xc967f2[0x0];var _0x3c55c1=_0xc967f2[0x1];var _0x44e924=_0x39fed7[_0xaccd('0x11')]()[_0xaccd('0x13')](_0x194673)[_0xaccd('0x12')](_0x3c55c1);throwIfDateNotValid(_0x44e924);if(_0x44e924[_0xaccd('0x14')](_0x593b64)){var _0x54ee74=_0x243034[_0xaccd('0x11')]()['startOf']('day');var _0x369160=_0x243034[_0xaccd('0x11')]()[_0xaccd('0x15')]('day');return _0x243034[_0xaccd('0x16')](_0x593b64,_0x369160,undefined,'[]')||_0x243034['isBetween'](_0x54ee74,_0x44e924,undefined,'[]');}else{return _0x243034[_0xaccd('0x16')](_0x593b64,_0x44e924,undefined,'[]');}}module[_0xaccd('0xe')][_0xaccd('0x17')]=timeCompare;function dowCompare(_0x324e35,_0x58e215,_0xd22db){var _0x2a701e=_0x324e35['locale']('en')[_0xaccd('0x18')](_0xaccd('0x19'))[_0xaccd('0xa')]();return circularDoWInterval(_0x58e215,_0xd22db)[_0xaccd('0x1a')](_0x2a701e);}module[_0xaccd('0xe')]['dowCompare']=dowCompare;function domCompare(_0x53ece2,_0x215a0b,_0x2e00cc){var _0x15fe43=_0x53ece2[_0xaccd('0x1b')]();if(_0x215a0b===_0x2e00cc){return _0x15fe43===_0x215a0b;}else{var _0x439007=_0x53ece2[_0xaccd('0x1c')]();var _0x18e57c=_0x215a0b<_0x2e00cc;let _0x38cff0=![];var _0x757db2=0x0;var _0x4e6bf6=0x0;if(_0x18e57c){_0x757db2=Math[_0xaccd('0x1d')](0x1,_0x215a0b);_0x4e6bf6=Math['min'](_0x2e00cc,_0x439007);_0x38cff0=_0x15fe43>=_0x757db2&&_0x15fe43<=_0x4e6bf6;}else{_0x757db2=Math[_0xaccd('0x1e')](_0x215a0b,_0x439007);_0x4e6bf6=Math['max'](0x1,_0x2e00cc);_0x38cff0=_0x15fe43>=_0x757db2||_0x15fe43<=_0x4e6bf6;}return _0x38cff0;}}module['exports'][_0xaccd('0x1f')]=domCompare;function monthCompare(_0x215bb6,_0x412a79,_0x2ae769){var _0x131b9d=_0x215bb6[_0xaccd('0x8')]('en')[_0xaccd('0x18')](_0xaccd('0x20'))[_0xaccd('0xa')]();return circularMonthInterval(_0x412a79,_0x2ae769)[_0xaccd('0x1a')](_0x131b9d);}module[_0xaccd('0xe')][_0xaccd('0x21')]=monthCompare;function iftime(_0x2fbdb8,_0x1d4559=moment['tz']['guess'](),_0x106868=moment()){if(!validateRx[_0xaccd('0x22')](_0x2fbdb8)){throw new Error(EINVALID_STRING);}else{var _0x5b7a5e=(moment[_0xaccd('0x23')](_0x106868)?_0x106868[_0xaccd('0x11')]():moment(_0x106868))['tz'](_0x1d4559)[_0xaccd('0x8')]('en');throwIfDateNotValid(_0x5b7a5e);var _0x19c012=_0x2fbdb8[_0xaccd('0x6')](',');var _0xba4b78=_0x19c012[0x0];var _0x1eb199=_0x19c012[0x1];var _0x1c37b4=_0x19c012[0x2];var _0x1562c2=_0x19c012[0x3];let _0x255b56=!![];if(_0xba4b78!=='*'){var _0x4c1218=_0xba4b78[_0xaccd('0x6')]('-');var _0x570db8=_[_0xaccd('0x24')](_0x4c1218[0x0],0x5,'0');var _0x553fc8=_0x4c1218[_0xaccd('0x25')]===0x2?_[_0xaccd('0x24')](_0x4c1218[0x1],0x5,'0'):_0x570db8;_0x255b56=timeCompare(_0x5b7a5e,_0x570db8,_0x553fc8);}let _0xff1284=!![];if(_0x1eb199!=='*'){var _0x1c46d1=_0x1eb199[_0xaccd('0x6')]('-');var _0x3b7c0b=_0x1c46d1[0x0];var _0x4f1c8e=_0x1c46d1[_0xaccd('0x25')]===0x2?_0x1c46d1[0x1]:_0x3b7c0b;_0xff1284=dowCompare(_0x5b7a5e,_0x3b7c0b,_0x4f1c8e);}let _0x13b3ca=!![];if(_0x1c37b4!=='*'){var _0x1a884a=_0x1c37b4[_0xaccd('0x6')]('-');var _0x276c0b=parseDom(_0x1a884a[0x0]);var _0x293f70=_0x1a884a[_0xaccd('0x25')]===0x2?parseDom(_0x1a884a[0x1]):_0x276c0b;_0x13b3ca=domCompare(_0x5b7a5e,_0x276c0b,_0x293f70);}let _0x429266=!![];if(_0x1562c2!=='*'){var _0x1f9480=_0x1562c2[_0xaccd('0x6')]('-');var _0x21e26c=_0x1f9480[0x0];var _0x44bf9f=_0x1f9480[_0xaccd('0x25')]===0x2?_0x1f9480[0x1]:_0x1f9480[0x0];_0x429266=monthCompare(_0x5b7a5e,_0x21e26c,_0x44bf9f);}return _0x255b56&&_0xff1284&&_0x13b3ca&&_0x429266;}}module['exports'][_0xaccd('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index dc585ae..a7916ec 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5ca9=['[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','warn','transports','File','%s-%s','error','Console','fileLogger','path','moment','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','bold\x20white','bold\x20green','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify'];(function(_0x299afe,_0x4b7d9c){var _0x577bca=function(_0x29c68a){while(--_0x29c68a){_0x299afe['push'](_0x299afe['shift']());}};_0x577bca(++_0x4b7d9c);}(_0x5ca9,0x1c5));var _0x95ca=function(_0x4fe409,_0x57740d){_0x4fe409=_0x4fe409-0x0;var _0x4a5523=_0x5ca9[_0x4fe409];return _0x4a5523;};'use strict';var path=require(_0x95ca('0x0'));var util=require('util');var moment=require(_0x95ca('0x1'));var winston=require('winston');var config=require(_0x95ca('0x2'));var debugLevel=config[_0x95ca('0x3')]?config['debugLevel']['toLowerCase']():_0x95ca('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':_0x95ca('0x5'),'error':_0x95ca('0x6'),'warn':_0x95ca('0x7'),'info':'white','print':_0x95ca('0x8'),'success':_0x95ca('0x9'),'http':'gray','verbose':_0x95ca('0xa'),'debug':_0x95ca('0xb'),'silly':_0x95ca('0xc')};winston[_0x95ca('0xd')](XC_LOG_COLORS);function getLogFileName(_0xd22ca5,_0x5208c0,_0x2d8e79){var _0x54284c=_0xd22ca5||_0x95ca('0xe');return path['join'](_0x54284c,util[_0x95ca('0xf')](_0x95ca('0x10'),_0x5208c0,_0x2d8e79));}function formatter(_0x57b9de,_0x3055cf){_0x3055cf[_0x95ca('0x11')]=_0x3055cf[_0x95ca('0x11')][_0x95ca('0x12')](/@@{/g,_0x95ca('0x13'))[_0x95ca('0x12')](/}@@/g,_0x95ca('0x14'))[_0x95ca('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x95ca('0xf')](_0x95ca('0x15'),moment()[_0x95ca('0xf')](_0x95ca('0x16')),_0x3055cf[_0x95ca('0x17')]['toUpperCase'](),_0x57b9de,_0x3055cf[_0x95ca('0x11')]);}function fileFormat(_0x55ef82,_0x3cdee0){_0x3cdee0[_0x95ca('0x11')]=_0x3cdee0[_0x95ca('0x11')][_0x95ca('0x12')](/@@{/g,_0x95ca('0x13'))[_0x95ca('0x12')](/}@@/g,_0x95ca('0x14'))[_0x95ca('0x12')](/@{/g,'{{')[_0x95ca('0x12')](/}@/g,'}}');var _0x5e0a53=_0x3cdee0[_0x95ca('0x18')]&&Object[_0x95ca('0x19')](_0x3cdee0[_0x95ca('0x18')])[_0x95ca('0x1a')]?'\x0a\x09'+JSON[_0x95ca('0x1b')](_0x3cdee0[_0x95ca('0x18')]):'';return util[_0x95ca('0xf')](_0x95ca('0x1c'),moment()[_0x95ca('0xf')](_0x95ca('0x16')),_0x3cdee0[_0x95ca('0x17')][_0x95ca('0x1d')](),_0x55ef82,_0x3cdee0[_0x95ca('0x11')],_0x5e0a53);}function consoleLogger(){var _0x49deec=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports']['Console']({'level':_0x95ca('0x1e'),'json':![],'formatter':function(_0x492f7c){return formatter('',_0x492f7c);}})]});return _0x49deec;}function fileLogger(_0x17bb34,_0x10a221){var _0x4f23cc=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x95ca('0x1f'))][(_0x95ca('0x20'))]({'name':util[_0x95ca('0xf')](_0x95ca('0x21'),_0x17bb34,_0x95ca('0x22')),'filename':getLogFileName(_0x10a221,_0x17bb34,_0x95ca('0x22')),'level':_0x95ca('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x324d7d){return fileFormat(_0x17bb34,_0x324d7d);}}),new winston['transports'][(_0x95ca('0x20'))]({'name':util[_0x95ca('0xf')]('%s-%s',_0x17bb34,debugLevel),'filename':getLogFileName(_0x10a221,_0x17bb34,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x10ea81){return fileFormat(_0x17bb34,_0x10ea81);}}),new winston[(_0x95ca('0x1f'))][(_0x95ca('0x23'))]({'level':_0x95ca('0x1e'),'json':![],'formatter':function(_0x5a69cf){return fileFormat(_0x17bb34,_0x5a69cf);}})]});return _0x4f23cc;}exports['consoleLogger']=consoleLogger;exports[_0x95ca('0x24')]=fileLogger; \ No newline at end of file +var _0xfc82=['[%s]\x20[%s]\x20%s\x20-\x20%s','level','meta','length','stringify','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','File','%s-%s','error','warn','consoleLogger','path','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}'];(function(_0x850d51,_0x3a1fd4){var _0x17541a=function(_0x146e4d){while(--_0x146e4d){_0x850d51['push'](_0x850d51['shift']());}};_0x17541a(++_0x3a1fd4);}(_0xfc82,0x12d));var _0x2fc8=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xfc82[_0x3b380d];return _0x54502b;};'use strict';var path=require(_0x2fc8('0x0'));var util=require('util');var moment=require(_0x2fc8('0x1'));var winston=require(_0x2fc8('0x2'));var config=require(_0x2fc8('0x3'));var debugLevel=config['debugLevel']?config[_0x2fc8('0x4')][_0x2fc8('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x2fc8('0x6'),'error':_0x2fc8('0x7'),'warn':_0x2fc8('0x8'),'info':_0x2fc8('0x9'),'print':_0x2fc8('0xa'),'success':_0x2fc8('0xb'),'http':_0x2fc8('0xc'),'verbose':_0x2fc8('0xd'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0x2fc8('0xe')](XC_LOG_COLORS);function getLogFileName(_0x1e3861,_0x7220b9,_0x3fb44b){var _0x249003=_0x1e3861||_0x2fc8('0xf');return path[_0x2fc8('0x10')](_0x249003,util[_0x2fc8('0x11')](_0x2fc8('0x12'),_0x7220b9,_0x3fb44b));}function formatter(_0x31815a,_0x3dd452){_0x3dd452['message']=_0x3dd452[_0x2fc8('0x13')][_0x2fc8('0x14')](/@@{/g,_0x2fc8('0x15'))[_0x2fc8('0x14')](/}@@/g,_0x2fc8('0x16'))[_0x2fc8('0x14')](/@{/g,'{{')[_0x2fc8('0x14')](/}@/g,'}}');return util[_0x2fc8('0x11')](_0x2fc8('0x17'),moment()[_0x2fc8('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3dd452[_0x2fc8('0x18')]['toUpperCase'](),_0x31815a,_0x3dd452[_0x2fc8('0x13')]);}function fileFormat(_0xa0e68f,_0x57243a){_0x57243a[_0x2fc8('0x13')]=_0x57243a[_0x2fc8('0x13')][_0x2fc8('0x14')](/@@{/g,_0x2fc8('0x15'))['replace'](/}@@/g,_0x2fc8('0x16'))[_0x2fc8('0x14')](/@{/g,'{{')[_0x2fc8('0x14')](/}@/g,'}}');var _0x5ad462=_0x57243a['meta']&&Object['keys'](_0x57243a[_0x2fc8('0x19')])[_0x2fc8('0x1a')]?'\x0a\x09'+JSON[_0x2fc8('0x1b')](_0x57243a[_0x2fc8('0x19')]):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x2fc8('0x11')](_0x2fc8('0x1c')),_0x57243a[_0x2fc8('0x18')]['toUpperCase'](),_0xa0e68f,_0x57243a['message'],_0x5ad462);}function consoleLogger(){var _0x4b317e=new winston[(_0x2fc8('0x1d'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2fc8('0x1e'))]['Console']({'level':'warn','json':![],'formatter':function(_0x530d43){return formatter('',_0x530d43);}})]});return _0x4b317e;}function fileLogger(_0x2a6447,_0x80d6de){var _0x248d65=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2fc8('0x1e'))][(_0x2fc8('0x1f'))]({'name':util[_0x2fc8('0x11')](_0x2fc8('0x20'),_0x2a6447,'error'),'filename':getLogFileName(_0x80d6de,_0x2a6447,_0x2fc8('0x21')),'level':_0x2fc8('0x21'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xbbdccf){return fileFormat(_0x2a6447,_0xbbdccf);}}),new winston['transports'][(_0x2fc8('0x1f'))]({'name':util[_0x2fc8('0x11')]('%s-%s',_0x2a6447,debugLevel),'filename':getLogFileName(_0x80d6de,_0x2a6447,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x45b0f4){return fileFormat(_0x2a6447,_0x45b0f4);}}),new winston[(_0x2fc8('0x1e'))]['Console']({'level':_0x2fc8('0x22'),'json':![],'formatter':function(_0x257e73){return fileFormat(_0x2a6447,_0x257e73);}})]});return _0x248d65;}exports[_0x2fc8('0x23')]=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 0de5e0a..ad29553 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 _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x133e66,_0x2b0d46){var _0x1e5066=function(_0x449d08){while(--_0x449d08){_0x133e66['push'](_0x133e66['shift']());}};_0x1e5066(++_0x2b0d46);}(_0x0b0e,0x187));var _0xe0b0=function(_0x53361f,_0x3b2cb6){_0x53361f=_0x53361f-0x0;var _0x279237=_0x0b0e[_0x53361f];return _0x279237;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdb28,0x106));var _0x8db2=function(_0x180ce8,_0x4d080d){_0x180ce8=_0x180ce8-0x0;var _0x367c84=_0xdb28[_0x180ce8];return _0x367c84;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index e180036..b50d4d3 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 _0x3423=['isArray','map','isPlainObject','keys','reduce','exports','safeTemplate','{\x20{\x20','\x20}\x20}','string','replace'];(function(_0x3948b9,_0x49ad6c){var _0x92e289=function(_0x57d216){while(--_0x57d216){_0x3948b9['push'](_0x3948b9['shift']());}};_0x92e289(++_0x49ad6c);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4a04c7){return _0x4a04c7==='{{'?_0x3342('0x0'):_0x3342('0x1');}function safeTemplate(_0x3477de){var _0x3b763d=_0x3477de;if(typeof _0x3477de===_0x3342('0x2')){_0x3b763d=_0x3477de[_0x3342('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3342('0x4')](_0x3477de)){_0x3b763d=_0x3477de[_0x3342('0x5')](function(_0x3075f8){return safeTemplate(_0x3075f8);});}else if(_[_0x3342('0x6')](_0x3477de)){_0x3b763d=Object[_0x3342('0x7')](_0x3477de)[_0x3342('0x8')](function(_0x29c40c,_0x420d4b){_0x29c40c[_0x420d4b]=safeTemplate(_0x3477de[_0x420d4b]);return _0x29c40c;},{});}return _0x3b763d;}module[_0x3342('0x9')][_0x3342('0xa')]=safeTemplate; \ No newline at end of file +var _0x9ffd=['{\x20{\x20','string','replace','map','keys','reduce','exports','safeTemplate','lodash'];(function(_0x43a37c,_0x25a567){var _0x5d1d40=function(_0x3ec673){while(--_0x3ec673){_0x43a37c['push'](_0x43a37c['shift']());}};_0x5d1d40(++_0x25a567);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x4e4ae3,_0xe4641e){_0x4e4ae3=_0x4e4ae3-0x0;var _0x3ece7f=_0x9ffd[_0x4e4ae3];return _0x3ece7f;};var _=require(_0xd9ff('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x413161){return _0x413161==='{{'?_0xd9ff('0x1'):'\x20}\x20}';}function safeTemplate(_0x3480c0){var _0x1530b1=_0x3480c0;if(typeof _0x3480c0===_0xd9ff('0x2')){_0x1530b1=_0x3480c0[_0xd9ff('0x3')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x3480c0)){_0x1530b1=_0x3480c0[_0xd9ff('0x4')](function(_0x111697){return safeTemplate(_0x111697);});}else if(_['isPlainObject'](_0x3480c0)){_0x1530b1=Object[_0xd9ff('0x5')](_0x3480c0)[_0xd9ff('0x6')](function(_0x13ea8c,_0x270eb2){_0x13ea8c[_0x270eb2]=safeTemplate(_0x3480c0[_0x270eb2]);return _0x13ea8c;},{});}return _0x1530b1;}module[_0xd9ff('0x7')][_0xd9ff('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index db776c2..0978503 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 _0xe571=['isArray','apps','name','motion2','NODE_PATH','string','pathExists','readJSON','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','../config/environment','server/app.json','resolve','legacy-libs'];(function(_0x233811,_0x1283e9){var _0x292f41=function(_0xe78d9d){while(--_0xe78d9d){_0x233811['push'](_0x233811['shift']());}};_0x292f41(++_0x1283e9);}(_0xe571,0x1e0));var _0x1e57=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe571[_0x122ef9];return _0x42fba0;};var fs=require(_0x1e57('0x0'));var path=require(_0x1e57('0x1'));var config=require(_0x1e57('0x2'));var root=config['root'];var APP_JSON_PATH=path['resolve'](root,_0x1e57('0x3'));var NODEPATH=path[_0x1e57('0x4')](root,_0x1e57('0x5'));function setLegacyLibsNodeEnvPath(_0x3dc212){let _0x2835c8=![];if(Array[_0x1e57('0x6')](_0x3dc212['apps'])){var _0x568513=_0x3dc212[_0x1e57('0x7')]['findIndex'](function(_0x418c6f){return _0x418c6f[_0x1e57('0x8')]===_0x1e57('0x9');});if(_0x568513>-0x1){var _0x15af9d=_0x3dc212[_0x1e57('0x7')][_0x568513];if(typeof _0x15af9d['env'][_0x1e57('0xa')]!==_0x1e57('0xb')){_0x15af9d['env'][_0x1e57('0xa')]=NODEPATH;_0x2835c8=!![];}}return{'appConfig':_0x3dc212,'updated':_0x2835c8};}}function updateAppConfig(_0x4eafb7){return fs[_0x1e57('0xc')](APP_JSON_PATH)['then'](function(_0x70501f){if(_0x70501f){return fs[_0x1e57('0xd')](APP_JSON_PATH)['then'](function(_0x238b8c){var _0xf61794=setLegacyLibsNodeEnvPath(_0x238b8c);if(_0xf61794['updated']){_0x4eafb7[_0x1e57('0xe')](_0x1e57('0xf'));return fs[_0x1e57('0x10')](APP_JSON_PATH,_0x238b8c,{'spaces':0x2});}else{return Promise[_0x1e57('0x4')]();}});}else{return Promise[_0x1e57('0x4')]();}});}module[_0x1e57('0x11')]=updateAppConfig; \ No newline at end of file +var _0x887a=['readJSON','updated','Updating\x20app.json','writeJSON','exports','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','env','string','NODE_PATH','pathExists','then'];(function(_0x1667d6,_0x5bd26a){var _0x46c904=function(_0x332904){while(--_0x332904){_0x1667d6['push'](_0x1667d6['shift']());}};_0x46c904(++_0x5bd26a);}(_0x887a,0x1b5));var _0xa887=function(_0x93dbdf,_0x550b98){_0x93dbdf=_0x93dbdf-0x0;var _0x4571eb=_0x887a[_0x93dbdf];return _0x4571eb;};var fs=require('fs-extra');var path=require('path');var config=require(_0xa887('0x0'));var root=config['root'];var APP_JSON_PATH=path[_0xa887('0x1')](root,_0xa887('0x2'));var NODEPATH=path['resolve'](root,_0xa887('0x3'));function setLegacyLibsNodeEnvPath(_0x3c9089){let _0x3c1da7=![];if(Array[_0xa887('0x4')](_0x3c9089[_0xa887('0x5')])){var _0x272bf8=_0x3c9089[_0xa887('0x5')][_0xa887('0x6')](function(_0x3d71e2){return _0x3d71e2[_0xa887('0x7')]==='motion2';});if(_0x272bf8>-0x1){var _0x49c50e=_0x3c9089[_0xa887('0x5')][_0x272bf8];if(typeof _0x49c50e[_0xa887('0x8')]['NODE_PATH']!==_0xa887('0x9')){_0x49c50e[_0xa887('0x8')][_0xa887('0xa')]=NODEPATH;_0x3c1da7=!![];}}return{'appConfig':_0x3c9089,'updated':_0x3c1da7};}}function updateAppConfig(_0xd9d463){return fs[_0xa887('0xb')](APP_JSON_PATH)[_0xa887('0xc')](function(_0x3413f3){if(_0x3413f3){return fs[_0xa887('0xd')](APP_JSON_PATH)[_0xa887('0xc')](function(_0x18cf09){var _0x1bc13d=setLegacyLibsNodeEnvPath(_0x18cf09);if(_0x1bc13d[_0xa887('0xe')]){_0xd9d463['info'](_0xa887('0xf'));return fs[_0xa887('0x10')](APP_JSON_PATH,_0x18cf09,{'spaces':0x2});}else{return Promise[_0xa887('0x1')]();}});}else{return Promise[_0xa887('0x1')]();}});}module[_0xa887('0x11')]=updateAppConfig; \ No newline at end of file